(()=>{var PJe=Object.create;var j_e=Object.defineProperty;var TJe=Object.getOwnPropertyDescriptor;var IJe=Object.getOwnPropertyNames;var CJe=Object.getPrototypeOf,SJe=Object.prototype.hasOwnProperty;var wd=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var Fp=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var EJe=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of IJe(t))!SJe.call(o,i)&&i!==e&&j_e(o,i,{get:()=>t[i],enumerable:!(r=TJe(t,i))||r.enumerable});return o};var nd=(o,t,e)=>(e=o!=null?PJe(CJe(o)):{},EJe(t||!o||!o.__esModule?j_e(e,"default",{value:o,enumerable:!0}):e,o));var $_e=Fp((qMt,q_e)=>{var X_e=[];X_e.push(`<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>EasyEDA PCB</title>
		<style type="text/css">
			html,
			body {
				padding: 0px;
				margin: 0px;
				border: none;
				background-color: #000;
			}

			/*#root{position: absolute;left:0px;top:0px;}*/
			body > #root {
				position: absolute;
				left: 0px;
				top: 0px;
				margin: 0;
			}

			/*position is needed when put svg root on the body center,*/
		</style>
	</head>

	<body>
		<canvas id="canvas"></canvas>
	</body>
</html>
`);q_e.exports=X_e.join("")});var J_e=Fp(($Mt,Z_e)=>{var KK=[];KK.push('body,html{background-color:#000}body>#root{left:0;margin:0;position:absolute;top:0}body,html{border:none;height:100%;margin:0;overflow:hidden;padding:0}body::-webkit-scrollbar{height:12px;width:12px}body::-webkit-scrollbar-track{border-radius:10px;-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.3)}body::-webkit-scrollbar-thumb{background:rgba(205,227,255,.8);border:1px solid #62b0ff;border-radius:10px;-webkit-box-shadow:inset 0 0 6px rgba(98,176,255,.5)}body::-webkit-scrollbar-thumb:window-inactive{background:rgba(205,227,255,.4)}input:not([type])::-ms-clear,input[type=text]::-ms-clear{display:none}svg,text{-webkit-user-select:none;-moz-user-select:none;-o-user-select:none;user-select:none}text,tspan{-webkit-text-size-adjust:none}svg{overflow:hidden}.highlight [stroke=none],.highlight[stroke=none],.selected [stroke=none],.selected[stroke=none]{stroke-width:1;vector-effect:non-scaling-stroke}.hidetext g text{display:none}text{cursor:default}.hidetext text,text.hidetext{display:none}#gControlDots rect{shape-rendering:auto}#gControlDots circle{shape-rendering:auto;vector-effect:non-scaling-stroke}#gControlDots circle.light{fill:#aea}#gControlLines line,#gControlRects rect{fill:none;shape-rendering:auto;stroke:#00c;vector-effect:non-scaling-stroke}#gControlLines line:not([stroke-dasharray]),#gControlRects rect:not([stroke-dasharray]),#selectBox1{stroke-dasharray:3,3}#selectBox1{fill:none;shape-rendering:crispEdges}.bw-chrome.cursor-cross-red{cursor:none,crosshair}.cursor-none{cursor:none}.cursor-crosshair{cursor:crosshair}.cursor-row-resize{cursor:row-resize}.cursor-col-resize{cursor:col-resize}.cursor-zoom-in{cursor:-moz-zoom-in;cursor:-webkit-zoom-in;cursor:zoom-in}.cursor-zoom-out{cursor:-moz-zoom-out;cursor:-webkit-zoom-out;cursor:zoom-out}.events-all{pointer-events:all}#gridOH,#gridOV{shape-rendering:crispEdges}#gCurParts circle.pindot{fill:silver;fill-opacity:.6;stroke:none}#g1 circle.pindot{fill:none;pointer-events:fill;stroke:none}#g1 .selected circle.pindot{fill:silver;fill-opacity:.6;stroke:none}polyline[c_etype=wire].designManager_selected{stroke-width:3!important}g[c_partid=part_netLabel_text]>path{stroke:#5a5757;stroke-linecap:inherit}#g1 circle,#g1 ellipse,#g1 line,#g1 path,#g1 polygon,#g1 polyline,#g1 rect{shape-rendering:auto}#g1 path[d*=A],#g1 path[d*=C]{shape-rendering:initial}line,path,polygon,polyline{stroke-linecap:round;stroke-linejoin:round}#gCurParts *{shape-rendering:crispEdges}svg rect.hitbox{fill:none;pointer-events:all;stroke:none}#textBoxContainer{background-color:var(--bg-color-input);-o-box-shadow:0 0 10px 5px #666;box-shadow:0 0 10px 5px #666;font-size:12px;overflow:auto;padding:2px;position:absolute;resize:both}#textBoxContainer div.tip{color:#978e8e;margin-left:1px}#bodyPlaceholder{height:100px;margin:0;width:100px}.fixed-center{left:50%;position:fixed;top:-1000px;-moz-transform:translate(-50%);-webkit-transform:translate(-50%);transform:translate(-50%)}.one-time-tip{background-color:rgba(0,0,0,.5);color:#fff;font-family:Arial;padding:10px;top:10px}.one-time-tip .content{max-width:700px;white-space:nowrap}.one-time-tip em{color:#ff0}.one-time-tip .content+.content{margin-top:6px}.one-time-tip .btns{text-align:right}#g1 .fm-0{font-family:\u5B8B\u4F53}#g1 .fm-1{font-family:Times New Roman}#g1 .fm-2{font-family:Arial}#g1 .fm-3{font-family:helvetica}#g1 .fm-4{font-family:"sans-serif"}#g1 .fm-5{font-family:"monospace"}#g1 .fm-6{font-family:Tahoma}#g1 .fm-7{font-family:Courier New}#g1 .fm-8{font-family:MS Gothic}#g1 .fm-9{font-family:Arial Black}#g1 .fm-10{font-family:Arial Narrow}#g1 .fm-11{font-family:Verdana}#g1 .fw-normal{font-weight:400}#g1 .fw-bold{font-weight:700}#g1 .fw-bolder{font-weight:bolder}#g1 .fw-lighter{font-weight:lighter}#g1 .fw-1{font-weight:100}#g1 .fw-2{font-weight:200}#g1 .fw-3{font-weight:300}#g1 .fw-4{font-weight:400}#g1 .fw-5{font-weight:500}#g1 .fw-6{font-weight:600}#g1 .fw-7{font-weight:700}#g1 .fw-8{font-weight:800}#g1 .fw-9{font-weight:900}#g1 .stroke-width-1{stroke-width:1}#g1 .stroke-width-2{stroke-width:2}#g1 .stroke-width-3{stroke-width:3}#g1 .stroke-width-4{stroke-width:4}#g1 .stroke-width-5{stroke-width:5}#g1 .stroke-width-6{stroke-width:6}#g1 .stroke-width-7{stroke-width:7}#g1 .stroke-width-8{stroke-width:8}#g1 .stroke-width-9{stroke-width:9}#g1 .stroke-width-10{stroke-width:10}#g1 .stroke-dasharray-0{stroke-dasharray:0}#g1 .stroke-dasharray-1{stroke-dasharray:6,6}#g1 .stroke-dasharray-2{stroke-dasharray:3,10}#g1 .fs-4{font-size:4pt}#g1 .fs-05{font-size:5.5pt}#g1 .fs-065{font-size:6.5pt}#g1 .fs-7{font-size:7pt}#g1 .fs-075{font-size:7.5pt}#g1 .fs-8{font-size:8pt}#g1 .fs-9{font-size:9pt}#g1 .fs-10{font-size:10pt}#g1 .fs-11{font-size:11pt}#g1 .fs-12{font-size:12pt}#g1 .fs-14{font-size:14pt}#g1 .fs-16{font-size:16pt}#g1 .fs-18{font-size:18pt}#g1 .fs-20{font-size:20pt}#g1 .fs-22{font-size:22pt}#g1 .fs-24{font-size:24pt}#g1 .fs-26{font-size:26pt}#g1 .fs-28{font-size:28pt}#g1 .fs-36{font-size:36pt}#g1 .fs-48{font-size:48pt}#g1 .fs-72{font-size:72pt}#g1 .font-style-0{font-style:normal}#g1 .font-style-1{font-style:italic}#g1 .font-style-2{font-style:inherit}#g1 g[id^=frame_lib_]{pointer-events:none}#g1>g[id^=frame_lib_]>.editing{pointer-events:all}#g1 .objectUnSelected:not([c_partid^=part_lib_]),#g1 g[c_partid^=part_lib_].objectUnSelected :not([c_partid=part_annotation]):not([c_note=note_name]):not([c_partid=part_pin]):not([c_pinname]):not([c_pinnumber]),#g1 g[c_partid^=part_lib_]>g[c_partid=part_annotation].objectUnSelected,#g1 g[c_partid^=part_lib_]>g[c_partid=part_pin].objectUnSelected,.objectUnSelected:not([c_partid^=part_lib_]) *{pointer-events:none}.selected .net-guideline{display:inline;display:initial;stroke:#fff;stroke-dasharray:3,3}.is-draging .net-guideline,.net-guideline{display:none}');KK=KK.join("");function K_e(){let o=document.createElement("style");o.innerHTML=KK,document.head.appendChild(o)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",K_e):K_e();Z_e.exports={root:"root",highlight:"highlight",selected:"selected",hidetext:"hidetext",gControlDots:"gControlDots",light:"light",gControlLines:"gControlLines",gControlRects:"gControlRects",selectBox1:"selectBox1","bw-chrome":"bw-chrome","cursor-cross-red":"cursor-cross-red","cursor-none":"cursor-none","cursor-crosshair":"cursor-crosshair","cursor-row-resize":"cursor-row-resize","cursor-col-resize":"cursor-col-resize","cursor-zoom-in":"cursor-zoom-in","cursor-zoom-out":"cursor-zoom-out","events-all":"events-all",gridOH:"gridOH",gridOV:"gridOV",gCurParts:"gCurParts",pindot:"pindot",g1:"g1",designManager_selected:"designManager_selected",hitbox:"hitbox",textBoxContainer:"textBoxContainer",tip:"tip",bodyPlaceholder:"bodyPlaceholder","fixed-center":"fixed-center","one-time-tip":"one-time-tip",content:"content",btns:"btns","fm-0":"fm-0","fm-1":"fm-1","fm-2":"fm-2","fm-3":"fm-3","fm-4":"fm-4","fm-5":"fm-5","fm-6":"fm-6","fm-7":"fm-7","fm-8":"fm-8","fm-9":"fm-9","fm-10":"fm-10","fm-11":"fm-11","fw-normal":"fw-normal","fw-bold":"fw-bold","fw-bolder":"fw-bolder","fw-lighter":"fw-lighter","fw-1":"fw-1","fw-2":"fw-2","fw-3":"fw-3","fw-4":"fw-4","fw-5":"fw-5","fw-6":"fw-6","fw-7":"fw-7","fw-8":"fw-8","fw-9":"fw-9","stroke-width-1":"stroke-width-1","stroke-width-2":"stroke-width-2","stroke-width-3":"stroke-width-3","stroke-width-4":"stroke-width-4","stroke-width-5":"stroke-width-5","stroke-width-6":"stroke-width-6","stroke-width-7":"stroke-width-7","stroke-width-8":"stroke-width-8","stroke-width-9":"stroke-width-9","stroke-width-10":"stroke-width-10","stroke-dasharray-0":"stroke-dasharray-0","stroke-dasharray-1":"stroke-dasharray-1","stroke-dasharray-2":"stroke-dasharray-2","fs-4":"fs-4","fs-05":"fs-05","fs-065":"fs-065","fs-7":"fs-7","fs-075":"fs-075","fs-8":"fs-8","fs-9":"fs-9","fs-10":"fs-10","fs-11":"fs-11","fs-12":"fs-12","fs-14":"fs-14","fs-16":"fs-16","fs-18":"fs-18","fs-20":"fs-20","fs-22":"fs-22","fs-24":"fs-24","fs-26":"fs-26","fs-28":"fs-28","fs-36":"fs-36","fs-48":"fs-48","fs-72":"fs-72","font-style-0":"font-style-0","font-style-1":"font-style-1","font-style-2":"font-style-2",editing:"editing",objectUnSelected:"objectUnSelected","net-guideline":"net-guideline","is-draging":"is-draging"}});var Lb=Fp((e4t,cve)=>{"use strict";var d1e=Object.defineProperty,OJe=Object.getOwnPropertyDescriptor,AJe=Object.getOwnPropertyNames,_Je=Object.prototype.hasOwnProperty,vJe=(o,t)=>{for(var e in t)d1e(o,e,{get:t[e],enumerable:!0})},xJe=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of AJe(t))!_Je.call(o,i)&&i!==e&&d1e(o,i,{get:()=>t[i],enumerable:!(r=OJe(t,i))||r.enumerable});return o},RJe=o=>xJe(d1e({},"__esModule",{value:!0}),o),tve={};vJe(tve,{BroadcastChannelMessageBus:()=>XJe,MessageBus:()=>HJe,MessageBus2:()=>YJe,MessageBusTask:()=>h1e,MessageBusTask2:()=>_H,WindowMessageBridge:()=>UJe,WorkerMessageBridge:()=>GJe,createBroadcastP2PStream:()=>ave,createBufferedByteBufferStream:()=>sve,createBufferedStream:()=>m1e,createBufferedStringStream:()=>ove,dropP2PStream:()=>qJe,flowRead:()=>KJe,flowWrite:()=>$Je});cve.exports=RJe(tve);var ZK=class{constructor(o=1.5){this.growthFactor=o,this.capacity=10,this.buffer=new Array(this.capacity),this.head=0,this.tail=0,this.count=0}enqueue(o){if(this.count===this.capacity){let t=Math.floor(this.capacity*this.growthFactor);console.log("grow",this.capacity,t);let e=new Array(t);for(let r=0;r<this.count;r++)e[r]=this.buffer[(this.head+r)%this.capacity];this.buffer=e,this.head=0,this.tail=this.count,this.capacity=t}this.buffer[this.tail]=o,this.tail=(this.tail+1)%this.capacity,this.count++}dequeue(){if(this.isEmpty())return;let o=this.buffer[this.head];return this.head=(this.head+1)%this.capacity,this.count--,o}peek(){return this.buffer[this.head]}isEmpty(){return this.count===0}clear(){this.buffer.length=0,this.head=0,this.tail=0,this.count=0}},p1e=new ArrayBuffer(8),ZMt=new Float64Array(p1e),JMt=new Uint32Array(p1e),QMt=new Uint16Array(p1e),c1e=ArrayBuffer;try{c1e=self.HTMLImageElement||c1e}catch{}var DJe=typeof SharedArrayBuffer<"u";function JK(o){if(typeof o!="object"||o===null||o instanceof Date||o instanceof ArrayBuffer||DJe&&o instanceof SharedArrayBuffer||o instanceof Blob||o instanceof FormData||o instanceof Function||o instanceof Uint8ClampedArray||o instanceof c1e)return o;if(Array.isArray(o))return o.map(JK);{let t={};for(let e in o)Object.hasOwnProperty.call(o,e)&&(t[e]=JK(o[e]));return t}}function l1e(o,t){return wJe(o,t,()=>[])}function wJe(o,t,e){let r=o[t];return r!==void 0||(r=e(t),o[t]=r),r}var LJe=class{constructor(o){this.maxResources=o,this.idle=new ZK,this.isClosed=!1,this.resources=o}acquire(o){this.isClosed?Promise.resolve(!1).then(o):this.resources>0?(this.resources--,Promise.resolve(!0).then(o)):this.idle.enqueue(o)}acquireSync(){return new Promise(o=>{this.acquire(o)})}release(){if(!this.isClosed){let o=this.idle.dequeue();o?Promise.resolve(!0).then(o):this.resources++}}close(){if(!this.isClosed)for(this.isClosed=!0;!this.idle.isEmpty();){let o=this.idle.dequeue();Promise.resolve(!1).then(o)}}};function MJe(){if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis;if(typeof global<"u")return global}function NJe(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}var kJe=MJe(),BJe=kJe.WeakRef||(o=>o);function cL(o){if(o!=null){if(typeof o=="object")return new BJe(o);console.error(o,o instanceof Object,typeof o);return}}function cv(o){return o==null?void 0:o.deref()}var FJe="_MSG_BUS_RPC_",f1e=300*1e3,VJe=(o=>(o.PUBLISH="publish",o.SUBSCRIBE="subscribe",o.PUSH="push",o.PULL="pull",o))(VJe||{}),rve=class{constructor(o){this.bus=o}processRemoteMessage(o,t){let e=cL(t),r=o.topic,i=o.type,n=o.message;switch(i){case"pull":this.bus.pull(r,s=>{this.push(r,s,cv(e))});break;case"subscribe":this.bus.subscribe(r,s=>{this.publish(r,s,cv(e))});break;case"publish":this.bus.publish(r,n,this,cv(e));break;case"push":this.bus.push(r,n,this,cv(e));break;default:console.debug("unknown message type "+i)}}rpcCall(o,t,e,r=f1e){let i=cL(e),n=new Promise(s=>{let a=this.bus.uniqueRpcTopic(o);this.publish(o,{message:t,reply:a},cv(i)),this.bus.pull(a,(l,c,h)=>{s({message:l,bridge:c,source:cL(h)})})});return r>0?Promise.race([n,new Promise((s,a)=>{setTimeout(a,r)})]):n}},GJe=class extends rve{constructor(o,t){super(o),this.worker=t,t.onmessage=e=>{this.processRemoteMessage(e.data,void 0)}}publish(o,t){this.postMessage(o,"publish",t)}subscribe(o){this.postMessage(o,"subscribe",null)}push(o,t){this.postMessage(o,"push",t)}pull(o){this.postMessage(o,"pull",null)}rpcCall(o,t,e=f1e){return super.rpcCall(o,t,void 0,e)}postMessage(o,t,e){let r={topic:o,type:t,message:e};this.worker.postMessage(r)}discard(){this.worker.terminate()}},UJe=class extends rve{constructor(o){super(o),window.addEventListener("message",t=>{this.processRemoteMessage(t.data,t.source)},!1)}publish(o,t,e){this.postMessage(o,"publish",t,e)}subscribe(o,t){if(t===window)throw new Error("regist remote subscribe from current window is not permitted");this.postMessage(o,"subscribe",null,t)}push(o,t,e){this.postMessage(o,"push",t,e)}pull(o,t){if(t===window)throw new Error("regist remote pull from current window is not permitted");this.postMessage(o,"pull",null,t)}postMessage(o,t,e,r){let i={topic:o,type:t,message:e};r&&r.postMessage(i,"*")}},h1e=class{constructor(o){this.isRunning=!0,this.callback=o}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}execute(o,t,e,r){try{o=r?o:JK(o),this.callback(o,t,e)}catch(i){console.error(i)}}},HJe=class{constructor(o=!1){this.subscribed={},this.pulled={},this.pushed={},this.uuid=crypto.randomUUID().replace(/-/g,""),this.rpcTicket=0,this.unsafe=o}uniqueRpcTopic(o){return`${FJe}-${o}-${this.uuid}-${this.rpcTicket++}`}publish(o,t,e,r){let i=this.subscribed[o];if(i){let n;for(let s of i)s.running()?s.execute(t,e,r,this.unsafe):(n=n||new Array,n.push(s));if(n)for(let s of n)NJe(i,s)}else console.debug("no sub on topic: "+o)}subscribe(o,t){let e=new h1e(t);return l1e(this.subscribed,o).push(e),e}push(o,t,e,r){let i=!1,n=this.pulled[o];if(n){for(;n.length>0;){let s=n.shift();if(s.running()){s.execute(t,e,r,this.unsafe),i=!0;break}}n.length===0&&delete this.pulled[o]}i||l1e(this.pushed,o).push({message:t,bridge:e,source:cL(r)})}pull(o,t){let e=new h1e(t),r=this.pushed[o];if(r){let i=r.shift();e.execute(i.message,i.bridge,cv(i.source),this.unsafe),r.length===0&&delete this.pushed[o]}else l1e(this.pulled,o).push(e);return e}pullA(o){return new Promise(t=>{this.pull(o,(e,r,i)=>{t({message:e,bridge:r,source:cL(i)})})})}rpcService(o,t){this.subscribe(o,(e,r,i)=>{let{message:n,reply:s}=e;try{let a=t(n);if(a instanceof Promise){let l=cL(i);a.then(c=>{this.rpcReply(c,s,r,cv(l))},c=>{console.error(c),this.rpcReply(void 0,s,r,cv(l))})}else this.rpcReply(a,s,r,i)}catch(a){console.error(a),this.rpcReply(void 0,s,r,i)}})}rpcCall(o,t,e=f1e){let r=new Promise(i=>{let n=this.uniqueRpcTopic(o);this.publish(o,{message:t,reply:n}),this.pull(n,(s,a,l)=>{i({message:s,bridge:a,source:cL(l)})})});return e>0?Promise.race([r,new Promise((i,n)=>{setTimeout(n,e)})]):r}rpcReply(o,t,e,r){e?e.push(t,o,r):this.push(t,o)}},WJe="_MSG_BUS_RPC_";function u1e(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}function d7(o,t){return zJe(o,t,()=>[])}function zJe(o,t,e){let r=o[t];return r!==void 0||(r=e(t),o[t]=r),r}var _H=class{constructor(o,t){this.callback=o,this.unsafe=t,this.isRunning=!0}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}async execute(o){try{o=this.unsafe?o:JK(o),this.callback(o)}catch(t){console.error(t)}}},ive=class{constructor(o=crypto.randomUUID()){this.uuid=o,this.rpcTicket=0}subscribeOnce(o,t){let e=this.subscribe(o,r=>{e.cancel(),t(r)});return e}pullA(o){return new Promise(t=>{this.pull(o,t)})}rpcService(o,t){let e=r=>{try{let{message:i,replyTopic:n}=r;try{let s=t(i);s instanceof Promise?s.then(a=>{this.publish(n,{success:!0,result:a})}).catch(a=>{console.error(a),this.publish(n,{success:!1,err:String(a)})}):this.publish(n,{success:!0,result:s})}catch(s){this.publish(n,{success:!1,err:String(s)})}}finally{this.pull(o,e)}};this.pull(o,e)}rpcCall(o,t,e=0){let r=new Promise((i,n)=>{let s=`${WJe}-${o}-${this.uuid}-${this.rpcTicket++}`;this.subscribeOnce(s,a=>{a.success?i(a.result):n(new Error(a.err))}),this.push(o,{message:t,replyTopic:s})});return e>0?Promise.race([r,new Promise((i,n)=>{setTimeout(n,e)})]):r}},YJe=class extends ive{constructor(o=!1){super(),this.unsafe=o,this.subscribed={},this.pulled={},this.pushed={}}publish(o,t){let e=this.subscribed[o];if(e){let r;for(let i of e)i.running()?i.execute(t):(r=r||new Array,r.push(i));if(r)for(let i of r)u1e(e,i)}}subscribe(o,t){let e=new _H(t,this.unsafe);return d7(this.subscribed,o).push(e),e}push(o,t){let e=!1,r=this.pulled[o];if(r){for(;r.length>0;){let i=r.shift();if(i&&i.running()){i.execute(t),e=!0;break}}r.length===0&&delete this.pulled[o]}e||d7(this.pushed,o).push(t)}pull(o,t){let e=new _H(t,this.unsafe);return this.repull(o,e),e}repull(o,t){let e=this.pushed[o];if(e){let r=e.shift();r&&(t.execute(r),e.length===0&&delete this.pushed[o])}else d7(this.pulled,o).push(t)}},jJe=class extends ive{constructor(o=crypto.randomUUID()){super(o),this.subscribed={},this.pushed={},this.pulled={},this.pushCnt=0}publish(o,t){console.debug("BC",this.uuid,"PUBLISH",o,t),this.broadcastPublish(o,t)}subscribe(o,t){console.debug("BC",this.uuid,"SUBSCRIBE",o);let e=new _H(t,!0);return d7(this.subscribed,o).push(e),e}push(o,t){let e=this.pushCnt++;console.debug("BC",this.uuid,"PUSH",o,`(${e})`,t),d7(this.pushed,o).push({id:e,message:t}),this.broadcastPushedHeadMessage(o)}pull(o,t){console.debug("BC",this.uuid,"PULL",o);let e=new _H(t,!0);return d7(this.pulled,o).push(e),this.broadcastWhoHas(o),e}broadcastPushedHeadMessage(o){let t=this.pushed[o];t&&t[0]&&this.broadcastIHave(o,t[0].id)}onReceivedPublish(o,t,e){console.debug("BCMSG(",this.uuid,")","from",o,"PUBLISH",t,"message",e);let r=this.subscribed[t];if(r){let i;for(let n of r)n.running()?n.execute(e):(i=i||new Array,i.push(n));if(i)for(let n of i)u1e(r,n);r.length===0&&delete this.subscribed[t]}}onReceivedWhoHas(o,t){console.debug("BCMSG(",this.uuid,")","from",o,"WHOHAS",t),this.broadcastPushedHeadMessage(t)}onReceivedIHave(o,t,e){console.debug("BCMSG(",this.uuid,")","from",o,"IHAVE",t,"id",e);let r=this.pulled[t];if(r){let i;for(let n of r)if(n.running()){this.broadcastINeed(t,o,e);break}else i=i||new Array,i.push(n);if(i)for(let n of i)u1e(r,n);r.length===0&&delete this.pulled[t]}}onReceivedINeed(o,t,e,r){if(console.debug("BCMSG(",this.uuid,")","from",o,"INEED",t,"source",e,"id",r),this.uuid===e){let i=this.pushed[t];if(i&&i[0]&&i[0].id===r){let{message:n}=i.shift();this.broadcastIGive(t,r,o,n),this.broadcastPushedHeadMessage(t),i.length===0&&delete this.pushed[t]}}}onReceivedIGive(o,t,e,r,i){console.debug("BCMSG(",this.uuid,")","from",o,"IGIVE",t,"id",e,"target",r,"message",i);let n=this.pulled[t];if(n&&this.uuid===r){let s=!1;for(;n.length>0;){let a=n.shift();if(a.running()){a.execute(i),s=!0;break}}s||this.push(t,i),n.length===0&&delete this.pulled[t]}}},XJe=class extends jJe{constructor(o,t=crypto.randomUUID()){super(t),this.bc=new BroadcastChannel(o),this.bc.onmessage=e=>{this.onMessage(e.data)}}onMessage(o){let{type:t,uuid:e,topic:r}=o;switch(t){case"PUBLISH":{let{message:i}=o;this.onReceivedPublish(e,r,i);break}case"WHOHAS":{this.onReceivedWhoHas(e,r);break}case"IHAVE":{let{id:i}=o;this.onReceivedIHave(e,r,i);break}case"INEED":{let{source:i,id:n}=o;this.onReceivedINeed(e,r,i,n);break}case"IGIVE":{let{target:i,id:n,message:s}=o;this.onReceivedIGive(e,r,n,i,s);break}default:console.warn("unsupported",o)}}broadcastPublish(o,t){this.post({type:"PUBLISH",uuid:this.uuid,topic:o,message:t})}broadcastWhoHas(o){this.post({type:"WHOHAS",uuid:this.uuid,topic:o})}broadcastIHave(o,t){this.post({type:"IHAVE",uuid:this.uuid,topic:o,id:t})}broadcastINeed(o,t,e){this.post({type:"INEED",uuid:this.uuid,topic:o,source:t,id:e})}broadcastIGive(o,t,e,r){this.post({type:"IGIVE",uuid:this.uuid,topic:o,id:t,target:e,message:r})}post(o){this.bc.postMessage(o),Promise.resolve().then(()=>{this.onMessage(o)})}},p7=Symbol("BLOCKING_QUEUE_RESET"),nve=class{constructor(o,t=()=>1){if(this.maxSize=o,this.itemSizeOf=t,this.queue=new ZK,this.waitingConsumers=new ZK,this.waitingProducers=new ZK,this.queueSize=0,this.closePromise=null,this.closeResolve=null,o<=0)throw new Error("Max size must be greater than 0")}enqueue(o){return this.closePromise?!1:this.isFull()?(async()=>{console.debug("queue is full",this.queueSize,this.maxSize);let t=await new Promise(e=>{this.waitingProducers.enqueue(e)});return console.debug("queue is not full",this.size(),t),t?(this.innerEnqueue(o),!0):!1})():(this.innerEnqueue(o),!0)}innerEnqueue(o){if(this.waitingConsumers.isEmpty())this.queue.enqueue(o),this.queueSize+=this.itemSizeOf(o),console.debug("queue pushed",o,"size",this.queueSize);else{let t=this.waitingConsumers.dequeue();Promise.resolve(o).then(t),console.debug("queue direct",o,"size",this.queueSize)}}dequeue(){if(this.queue.isEmpty())if(this.closePromise){for(;!this.waitingConsumers.isEmpty();){let o=this.waitingConsumers.dequeue();Promise.resolve(p7).then(o)}return setTimeout(()=>this.closeResolve(),0),p7}else return new Promise(o=>{this.waitingConsumers.enqueue(o)});else{let o=this.queue.dequeue();if(this.queueSize-=this.itemSizeOf(o),!this.waitingProducers.isEmpty()){let t=this.waitingProducers.dequeue();Promise.resolve(!0).then(t)}return o}}size(){return this.queueSize}isEmpty(){return this.queueSize===0}isFull(){return this.queueSize>=this.maxSize}close(){return this.closePromise||(this.closePromise=new Promise(o=>{for(this.closeResolve=o;!this.waitingProducers.isEmpty();){let t=this.waitingProducers.dequeue();Promise.resolve(!1).then(t)}if(this.queueSize===0){for(;!this.waitingConsumers.isEmpty();){let t=this.waitingConsumers.dequeue();Promise.resolve(p7).then(t)}o()}})),this.closePromise}};function m1e(o,t,e=Number.MAX_SAFE_INTEGER){let r=new nve(e,t),i=new ReadableStream({pull(s){let a=!0,l=(async()=>{let c=new Array;do{let h=r.dequeue();if(h instanceof Promise){a=!1;let u=await h;u===p7?s.close():c.push(u)}else{let u=h;u===p7?s.close():c.push(u)}}while(r.size()>0);if(c.length>0){let h=o(c);s.enqueue(h)}})();if(!a)return console.debug("read stream stucked --------------------------------------"),l},async cancel(){console.debug("buffered readable cancel"),await r.close()}}),n=new WritableStream({write(s,a){let l=!0,c=(async()=>{let h=r.enqueue(s);typeof h=="boolean"?h||a.error(new Error("Write stream closed")):(l=!1,await h||a.error(new Error("Write stream closed")))})();if(!l)return console.debug("read stream stucked >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"),c},async close(){console.debug("buffered writable closing",r.size()),await r.close(),console.debug("buffered writable closed",r.size())},async abort(){console.debug("buffered writable aborting",r.size()),await r.close(),console.debug("buffered writable aborted",r.size())}});return{readable:i,writable:n}}function ove(o=Number.MAX_SAFE_INTEGER){return m1e(t=>t.join(""),t=>t.length,o)}function sve(o=Number.MAX_SAFE_INTEGER){return m1e(t=>{let e=new Uint8Array(t.reduce((i,n)=>i+n.byteLength,0)),r=0;return t.forEach(i=>{e.set(i,r),r+=i.byteLength}),e},t=>t.byteLength,o)}function ave(o){return new Promise((t,e)=>{let r=new BroadcastChannel(o),i=new nve(1),n=new LJe(1),s=null,a=!1,l=!1,c=!1;r.onmessage=h=>{let u=h.data,{type:d}=u;if(console.debug("p2p",o,"type",d,"data",d==="DATA"&&u.data),d==="DATA")i.enqueue(u.data);else if(d==="HI"){if(!s){r.postMessage({type:"HI"});let y=0;s={rs:new ReadableStream({async pull(b){let P=await i.dequeue();P===p7?(await m(),b.close()):(b.enqueue(P),r.postMessage({type:"ACK"}))},cancel(){return m()}}),ws:new WritableStream({async write(b,P){await n.acquireSync()?r.postMessage({type:"DATA",id:y++,data:b}):(p(),P.error(new Error("Write stream closed")))},close(){p()},abort(){p()}})},t(s)}}else d==="REND"?s?n.close():g("REND1"):d==="WEND"?s?i.close():g("WEND1"):d==="ACK"&&n.release();function p(){a||(a=!0,console.debug(o,"p2p write stream closed"),n.close(),r.postMessage({type:"WEND"}),l&&(console.debug(o,"p2p channel closed on ws"),r.close()))}async function m(){l||(l=!0,console.debug(o,"p2p read stream closed"),r.postMessage({type:"REND"}),await i.close(),a&&(console.debug(o,"p2p channel closed on rs"),r.close()))}async function g(y){c||(c=!0,console.debug(o,"p2p channel connection released on",y),n.close(),i.close(),s?(s.rs.locked||(console.debug(o,"p2p unlocked read stream direct cancel"),s.rs.cancel()),s.ws.locked||(console.debug(o,"p2p unlocked write stream direct close"),s.ws.close())):(r.postMessage({type:"HI"}),r.close()),e(new Error("p2p channel connection released")))}},r.postMessage({type:"HI"})})}function qJe(o){return new Promise(t=>{let e=new BroadcastChannel(o);e.onmessage=r=>{let i=r.data,{type:n}=i;n==="HI"&&(e.postMessage({type:"REND"}),e.close(),t())},e.postMessage({type:"REND"})})}async function lve(o){try{return await ave(o)}catch(t){t.message!=="p2p channel connection released"&&console.error(t)}}async function $Je(o,t,e=10*1024*1024,r=!0){let i=await lve(o);if(!i)return!1;let n=!1;try{let s,a=l=>{if(!s)if(!r)s=i.ws.getWriter();else if(typeof l=="string"){let c=ove(e);c.readable.pipeTo(i.ws),s=c.writable.getWriter()}else{let c=sve(e);c.readable.pipeTo(i.ws),s=c.writable.getWriter()}return s.write(l)};if(Array.isArray(t))for(let l of t)await a(l);else await t({write:a,get desiredSize(){return((s==null?void 0:s.desiredSize)||0)+10}});s&&await s.close(),n=!0}catch(s){console.error(s)}finally{return i.rs.cancel(),n}}async function KJe(o,t){var r,i;let e=await lve(o);if(e)try{let n=e.rs.getReader();for((r=t.start)==null?void 0:r.call(t);;){let{value:s,done:a}=await n.read();if(s!==void 0){let l;if(t.update instanceof Promise?l=await t.update(s):l=t.update(s),l){await n.cancel();break}}if(a){(i=t.end)==null||i.call(t);break}}}catch(n){console.error(n)}finally{e.ws.close()}}});var hFe=Fp((LSr,cFe)=>{(function(){var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t={rotl:function(e,r){return e<<r|e>>>32-r},rotr:function(e,r){return e<<32-r|e>>>r},endian:function(e){if(e.constructor==Number)return t.rotl(e,8)&16711935|t.rotl(e,24)&4278255360;for(var r=0;r<e.length;r++)e[r]=t.endian(e[r]);return e},randomBytes:function(e){for(var r=[];e>0;e--)r.push(Math.floor(Math.random()*256));return r},bytesToWords:function(e){for(var r=[],i=0,n=0;i<e.length;i++,n+=8)r[n>>>5]|=e[i]<<24-n%32;return r},wordsToBytes:function(e){for(var r=[],i=0;i<e.length*32;i+=8)r.push(e[i>>>5]>>>24-i%32&255);return r},bytesToHex:function(e){for(var r=[],i=0;i<e.length;i++)r.push((e[i]>>>4).toString(16)),r.push((e[i]&15).toString(16));return r.join("")},hexToBytes:function(e){for(var r=[],i=0;i<e.length;i+=2)r.push(parseInt(e.substr(i,2),16));return r},bytesToBase64:function(e){for(var r=[],i=0;i<e.length;i+=3)for(var n=e[i]<<16|e[i+1]<<8|e[i+2],s=0;s<4;s++)i*8+s*6<=e.length*8?r.push(o.charAt(n>>>6*(3-s)&63)):r.push("=");return r.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/ig,"");for(var r=[],i=0,n=0;i<e.length;n=++i%4)n!=0&&r.push((o.indexOf(e.charAt(i-1))&Math.pow(2,-2*n+8)-1)<<n*2|o.indexOf(e.charAt(i))>>>6-n*2);return r}};cFe.exports=t})()});var kCe=Fp((MSr,uFe)=>{var NCe={utf8:{stringToBytes:function(o){return NCe.bin.stringToBytes(unescape(encodeURIComponent(o)))},bytesToString:function(o){return decodeURIComponent(escape(NCe.bin.bytesToString(o)))}},bin:{stringToBytes:function(o){for(var t=[],e=0;e<o.length;e++)t.push(o.charCodeAt(e)&255);return t},bytesToString:function(o){for(var t=[],e=0;e<o.length;e++)t.push(String.fromCharCode(o[e]));return t.join("")}}};uFe.exports=NCe});var fFe=Fp((NSr,pFe)=>{pFe.exports=function(o){return o!=null&&(dFe(o)||dEt(o)||!!o._isBuffer)};function dFe(o){return!!o.constructor&&typeof o.constructor.isBuffer=="function"&&o.constructor.isBuffer(o)}function dEt(o){return typeof o.readFloatLE=="function"&&typeof o.slice=="function"&&dFe(o.slice(0,0))}});var cj=Fp((kSr,mFe)=>{(function(){var o=hFe(),t=kCe().utf8,e=fFe(),r=kCe().bin,i=function(n,s){n.constructor==String?s&&s.encoding==="binary"?n=r.stringToBytes(n):n=t.stringToBytes(n):e(n)?n=Array.prototype.slice.call(n,0):!Array.isArray(n)&&n.constructor!==Uint8Array&&(n=n.toString());for(var a=o.bytesToWords(n),l=n.length*8,c=1732584193,h=-271733879,u=-1732584194,d=271733878,p=0;p<a.length;p++)a[p]=(a[p]<<8|a[p]>>>24)&16711935|(a[p]<<24|a[p]>>>8)&4278255360;a[l>>>5]|=128<<l%32,a[(l+64>>>9<<4)+14]=l;for(var m=i._ff,g=i._gg,y=i._hh,b=i._ii,p=0;p<a.length;p+=16){var P=c,T=h,I=u,C=d;c=m(c,h,u,d,a[p+0],7,-680876936),d=m(d,c,h,u,a[p+1],12,-389564586),u=m(u,d,c,h,a[p+2],17,606105819),h=m(h,u,d,c,a[p+3],22,-1044525330),c=m(c,h,u,d,a[p+4],7,-176418897),d=m(d,c,h,u,a[p+5],12,1200080426),u=m(u,d,c,h,a[p+6],17,-1473231341),h=m(h,u,d,c,a[p+7],22,-45705983),c=m(c,h,u,d,a[p+8],7,1770035416),d=m(d,c,h,u,a[p+9],12,-1958414417),u=m(u,d,c,h,a[p+10],17,-42063),h=m(h,u,d,c,a[p+11],22,-1990404162),c=m(c,h,u,d,a[p+12],7,1804603682),d=m(d,c,h,u,a[p+13],12,-40341101),u=m(u,d,c,h,a[p+14],17,-1502002290),h=m(h,u,d,c,a[p+15],22,1236535329),c=g(c,h,u,d,a[p+1],5,-165796510),d=g(d,c,h,u,a[p+6],9,-1069501632),u=g(u,d,c,h,a[p+11],14,643717713),h=g(h,u,d,c,a[p+0],20,-373897302),c=g(c,h,u,d,a[p+5],5,-701558691),d=g(d,c,h,u,a[p+10],9,38016083),u=g(u,d,c,h,a[p+15],14,-660478335),h=g(h,u,d,c,a[p+4],20,-405537848),c=g(c,h,u,d,a[p+9],5,568446438),d=g(d,c,h,u,a[p+14],9,-1019803690),u=g(u,d,c,h,a[p+3],14,-187363961),h=g(h,u,d,c,a[p+8],20,1163531501),c=g(c,h,u,d,a[p+13],5,-1444681467),d=g(d,c,h,u,a[p+2],9,-51403784),u=g(u,d,c,h,a[p+7],14,1735328473),h=g(h,u,d,c,a[p+12],20,-1926607734),c=y(c,h,u,d,a[p+5],4,-378558),d=y(d,c,h,u,a[p+8],11,-2022574463),u=y(u,d,c,h,a[p+11],16,1839030562),h=y(h,u,d,c,a[p+14],23,-35309556),c=y(c,h,u,d,a[p+1],4,-1530992060),d=y(d,c,h,u,a[p+4],11,1272893353),u=y(u,d,c,h,a[p+7],16,-155497632),h=y(h,u,d,c,a[p+10],23,-1094730640),c=y(c,h,u,d,a[p+13],4,681279174),d=y(d,c,h,u,a[p+0],11,-358537222),u=y(u,d,c,h,a[p+3],16,-722521979),h=y(h,u,d,c,a[p+6],23,76029189),c=y(c,h,u,d,a[p+9],4,-640364487),d=y(d,c,h,u,a[p+12],11,-421815835),u=y(u,d,c,h,a[p+15],16,530742520),h=y(h,u,d,c,a[p+2],23,-995338651),c=b(c,h,u,d,a[p+0],6,-198630844),d=b(d,c,h,u,a[p+7],10,1126891415),u=b(u,d,c,h,a[p+14],15,-1416354905),h=b(h,u,d,c,a[p+5],21,-57434055),c=b(c,h,u,d,a[p+12],6,1700485571),d=b(d,c,h,u,a[p+3],10,-1894986606),u=b(u,d,c,h,a[p+10],15,-1051523),h=b(h,u,d,c,a[p+1],21,-2054922799),c=b(c,h,u,d,a[p+8],6,1873313359),d=b(d,c,h,u,a[p+15],10,-30611744),u=b(u,d,c,h,a[p+6],15,-1560198380),h=b(h,u,d,c,a[p+13],21,1309151649),c=b(c,h,u,d,a[p+4],6,-145523070),d=b(d,c,h,u,a[p+11],10,-1120210379),u=b(u,d,c,h,a[p+2],15,718787259),h=b(h,u,d,c,a[p+9],21,-343485551),c=c+P>>>0,h=h+T>>>0,u=u+I>>>0,d=d+C>>>0}return o.endian([c,h,u,d])};i._ff=function(n,s,a,l,c,h,u){var d=n+(s&a|~s&l)+(c>>>0)+u;return(d<<h|d>>>32-h)+s},i._gg=function(n,s,a,l,c,h,u){var d=n+(s&l|a&~l)+(c>>>0)+u;return(d<<h|d>>>32-h)+s},i._hh=function(n,s,a,l,c,h,u){var d=n+(s^a^l)+(c>>>0)+u;return(d<<h|d>>>32-h)+s},i._ii=function(n,s,a,l,c,h,u){var d=n+(a^(s|~l))+(c>>>0)+u;return(d<<h|d>>>32-h)+s},i._blocksize=16,i._digestsize=16,mFe.exports=function(n,s){if(n==null)throw new Error("Illegal argument "+n);var a=o.wordsToBytes(i(n,s));return s&&s.asBytes?a:s&&s.asString?r.bytesToString(a):o.bytesToHex(a)}})()});var b_=Fp(n2=>{"use strict";var KOt=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function ZOt(o,t){return Object.prototype.hasOwnProperty.call(o,t)}n2.assign=function(o){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(var r in e)ZOt(e,r)&&(o[r]=e[r])}}return o};n2.shrinkBuf=function(o,t){return o.length===t?o:o.subarray?o.subarray(0,t):(o.length=t,o)};var JOt={arraySet:function(o,t,e,r,i){if(t.subarray&&o.subarray){o.set(t.subarray(e,e+r),i);return}for(var n=0;n<r;n++)o[i+n]=t[e+n]},flattenChunks:function(o){var t,e,r,i,n,s;for(r=0,t=0,e=o.length;t<e;t++)r+=o[t].length;for(s=new Uint8Array(r),i=0,t=0,e=o.length;t<e;t++)n=o[t],s.set(n,i),i+=n.length;return s}},QOt={arraySet:function(o,t,e,r,i){for(var n=0;n<r;n++)o[i+n]=t[e+n]},flattenChunks:function(o){return[].concat.apply([],o)}};n2.setTyped=function(o){o?(n2.Buf8=Uint8Array,n2.Buf16=Uint16Array,n2.Buf32=Int32Array,n2.assign(n2,JOt)):(n2.Buf8=Array,n2.Buf16=Array,n2.Buf32=Array,n2.assign(n2,QOt))};n2.setTyped(KOt)});var lHe=Fp(MV=>{"use strict";var eAt=b_(),tAt=4,GUe=0,UUe=1,rAt=2;function LV(o){for(var t=o.length;--t>=0;)o[t]=0}var iAt=0,XUe=1,nAt=2,oAt=3,sAt=258,J9e=29,XX=256,WX=XX+1+J9e,wV=30,Q9e=19,qUe=2*WX+1,v5=15,j9e=16,aAt=7,eEe=256,$Ue=16,KUe=17,ZUe=18,K9e=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],sae=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],lAt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],JUe=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],cAt=512,P_=new Array((WX+2)*2);LV(P_);var HX=new Array(wV*2);LV(HX);var zX=new Array(cAt);LV(zX);var YX=new Array(sAt-oAt+1);LV(YX);var tEe=new Array(J9e);LV(tEe);var aae=new Array(wV);LV(aae);function X9e(o,t,e,r,i){this.static_tree=o,this.extra_bits=t,this.extra_base=e,this.elems=r,this.max_length=i,this.has_stree=o&&o.length}var QUe,eHe,tHe;function q9e(o,t){this.dyn_tree=o,this.max_code=0,this.stat_desc=t}function rHe(o){return o<256?zX[o]:zX[256+(o>>>7)]}function jX(o,t){o.pending_buf[o.pending++]=t&255,o.pending_buf[o.pending++]=t>>>8&255}function PP(o,t,e){o.bi_valid>j9e-e?(o.bi_buf|=t<<o.bi_valid&65535,jX(o,o.bi_buf),o.bi_buf=t>>j9e-o.bi_valid,o.bi_valid+=e-j9e):(o.bi_buf|=t<<o.bi_valid&65535,o.bi_valid+=e)}function L3(o,t,e){PP(o,e[t*2],e[t*2+1])}function iHe(o,t){var e=0;do e|=o&1,o>>>=1,e<<=1;while(--t>0);return e>>>1}function hAt(o){o.bi_valid===16?(jX(o,o.bi_buf),o.bi_buf=0,o.bi_valid=0):o.bi_valid>=8&&(o.pending_buf[o.pending++]=o.bi_buf&255,o.bi_buf>>=8,o.bi_valid-=8)}function uAt(o,t){var e=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,n=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length,c,h,u,d,p,m,g=0;for(d=0;d<=v5;d++)o.bl_count[d]=0;for(e[o.heap[o.heap_max]*2+1]=0,c=o.heap_max+1;c<qUe;c++)h=o.heap[c],d=e[e[h*2+1]*2+1]+1,d>l&&(d=l,g++),e[h*2+1]=d,!(h>r)&&(o.bl_count[d]++,p=0,h>=a&&(p=s[h-a]),m=e[h*2],o.opt_len+=m*(d+p),n&&(o.static_len+=m*(i[h*2+1]+p)));if(g!==0){do{for(d=l-1;o.bl_count[d]===0;)d--;o.bl_count[d]--,o.bl_count[d+1]+=2,o.bl_count[l]--,g-=2}while(g>0);for(d=l;d!==0;d--)for(h=o.bl_count[d];h!==0;)u=o.heap[--c],!(u>r)&&(e[u*2+1]!==d&&(o.opt_len+=(d-e[u*2+1])*e[u*2],e[u*2+1]=d),h--)}}function nHe(o,t,e){var r=new Array(v5+1),i=0,n,s;for(n=1;n<=v5;n++)r[n]=i=i+e[n-1]<<1;for(s=0;s<=t;s++){var a=o[s*2+1];a!==0&&(o[s*2]=iHe(r[a]++,a))}}function dAt(){var o,t,e,r,i,n=new Array(v5+1);for(e=0,r=0;r<J9e-1;r++)for(tEe[r]=e,o=0;o<1<<K9e[r];o++)YX[e++]=r;for(YX[e-1]=r,i=0,r=0;r<16;r++)for(aae[r]=i,o=0;o<1<<sae[r];o++)zX[i++]=r;for(i>>=7;r<wV;r++)for(aae[r]=i<<7,o=0;o<1<<sae[r]-7;o++)zX[256+i++]=r;for(t=0;t<=v5;t++)n[t]=0;for(o=0;o<=143;)P_[o*2+1]=8,o++,n[8]++;for(;o<=255;)P_[o*2+1]=9,o++,n[9]++;for(;o<=279;)P_[o*2+1]=7,o++,n[7]++;for(;o<=287;)P_[o*2+1]=8,o++,n[8]++;for(nHe(P_,WX+1,n),o=0;o<wV;o++)HX[o*2+1]=5,HX[o*2]=iHe(o,5);QUe=new X9e(P_,K9e,XX+1,WX,v5),eHe=new X9e(HX,sae,0,wV,v5),tHe=new X9e(new Array(0),lAt,0,Q9e,aAt)}function oHe(o){var t;for(t=0;t<WX;t++)o.dyn_ltree[t*2]=0;for(t=0;t<wV;t++)o.dyn_dtree[t*2]=0;for(t=0;t<Q9e;t++)o.bl_tree[t*2]=0;o.dyn_ltree[eEe*2]=1,o.opt_len=o.static_len=0,o.last_lit=o.matches=0}function sHe(o){o.bi_valid>8?jX(o,o.bi_buf):o.bi_valid>0&&(o.pending_buf[o.pending++]=o.bi_buf),o.bi_buf=0,o.bi_valid=0}function pAt(o,t,e,r){sHe(o),r&&(jX(o,e),jX(o,~e)),eAt.arraySet(o.pending_buf,o.window,t,e,o.pending),o.pending+=e}function HUe(o,t,e,r){var i=t*2,n=e*2;return o[i]<o[n]||o[i]===o[n]&&r[t]<=r[e]}function $9e(o,t,e){for(var r=o.heap[e],i=e<<1;i<=o.heap_len&&(i<o.heap_len&&HUe(t,o.heap[i+1],o.heap[i],o.depth)&&i++,!HUe(t,r,o.heap[i],o.depth));)o.heap[e]=o.heap[i],e=i,i<<=1;o.heap[e]=r}function WUe(o,t,e){var r,i,n=0,s,a;if(o.last_lit!==0)do r=o.pending_buf[o.d_buf+n*2]<<8|o.pending_buf[o.d_buf+n*2+1],i=o.pending_buf[o.l_buf+n],n++,r===0?L3(o,i,t):(s=YX[i],L3(o,s+XX+1,t),a=K9e[s],a!==0&&(i-=tEe[s],PP(o,i,a)),r--,s=rHe(r),L3(o,s,e),a=sae[s],a!==0&&(r-=aae[s],PP(o,r,a)));while(n<o.last_lit);L3(o,eEe,t)}function Z9e(o,t){var e=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,n=t.stat_desc.elems,s,a,l=-1,c;for(o.heap_len=0,o.heap_max=qUe,s=0;s<n;s++)e[s*2]!==0?(o.heap[++o.heap_len]=l=s,o.depth[s]=0):e[s*2+1]=0;for(;o.heap_len<2;)c=o.heap[++o.heap_len]=l<2?++l:0,e[c*2]=1,o.depth[c]=0,o.opt_len--,i&&(o.static_len-=r[c*2+1]);for(t.max_code=l,s=o.heap_len>>1;s>=1;s--)$9e(o,e,s);c=n;do s=o.heap[1],o.heap[1]=o.heap[o.heap_len--],$9e(o,e,1),a=o.heap[1],o.heap[--o.heap_max]=s,o.heap[--o.heap_max]=a,e[c*2]=e[s*2]+e[a*2],o.depth[c]=(o.depth[s]>=o.depth[a]?o.depth[s]:o.depth[a])+1,e[s*2+1]=e[a*2+1]=c,o.heap[1]=c++,$9e(o,e,1);while(o.heap_len>=2);o.heap[--o.heap_max]=o.heap[1],uAt(o,t),nHe(e,l,o.bl_count)}function zUe(o,t,e){var r,i=-1,n,s=t[1],a=0,l=7,c=4;for(s===0&&(l=138,c=3),t[(e+1)*2+1]=65535,r=0;r<=e;r++)n=s,s=t[(r+1)*2+1],!(++a<l&&n===s)&&(a<c?o.bl_tree[n*2]+=a:n!==0?(n!==i&&o.bl_tree[n*2]++,o.bl_tree[$Ue*2]++):a<=10?o.bl_tree[KUe*2]++:o.bl_tree[ZUe*2]++,a=0,i=n,s===0?(l=138,c=3):n===s?(l=6,c=3):(l=7,c=4))}function YUe(o,t,e){var r,i=-1,n,s=t[1],a=0,l=7,c=4;for(s===0&&(l=138,c=3),r=0;r<=e;r++)if(n=s,s=t[(r+1)*2+1],!(++a<l&&n===s)){if(a<c)do L3(o,n,o.bl_tree);while(--a!==0);else n!==0?(n!==i&&(L3(o,n,o.bl_tree),a--),L3(o,$Ue,o.bl_tree),PP(o,a-3,2)):a<=10?(L3(o,KUe,o.bl_tree),PP(o,a-3,3)):(L3(o,ZUe,o.bl_tree),PP(o,a-11,7));a=0,i=n,s===0?(l=138,c=3):n===s?(l=6,c=3):(l=7,c=4)}}function fAt(o){var t;for(zUe(o,o.dyn_ltree,o.l_desc.max_code),zUe(o,o.dyn_dtree,o.d_desc.max_code),Z9e(o,o.bl_desc),t=Q9e-1;t>=3&&o.bl_tree[JUe[t]*2+1]===0;t--);return o.opt_len+=3*(t+1)+5+5+4,t}function mAt(o,t,e,r){var i;for(PP(o,t-257,5),PP(o,e-1,5),PP(o,r-4,4),i=0;i<r;i++)PP(o,o.bl_tree[JUe[i]*2+1],3);YUe(o,o.dyn_ltree,t-1),YUe(o,o.dyn_dtree,e-1)}function gAt(o){var t=4093624447,e;for(e=0;e<=31;e++,t>>>=1)if(t&1&&o.dyn_ltree[e*2]!==0)return GUe;if(o.dyn_ltree[18]!==0||o.dyn_ltree[20]!==0||o.dyn_ltree[26]!==0)return UUe;for(e=32;e<XX;e++)if(o.dyn_ltree[e*2]!==0)return UUe;return GUe}var jUe=!1;function yAt(o){jUe||(dAt(),jUe=!0),o.l_desc=new q9e(o.dyn_ltree,QUe),o.d_desc=new q9e(o.dyn_dtree,eHe),o.bl_desc=new q9e(o.bl_tree,tHe),o.bi_buf=0,o.bi_valid=0,oHe(o)}function aHe(o,t,e,r){PP(o,(iAt<<1)+(r?1:0),3),pAt(o,t,e,!0)}function bAt(o){PP(o,XUe<<1,3),L3(o,eEe,P_),hAt(o)}function PAt(o,t,e,r){var i,n,s=0;o.level>0?(o.strm.data_type===rAt&&(o.strm.data_type=gAt(o)),Z9e(o,o.l_desc),Z9e(o,o.d_desc),s=fAt(o),i=o.opt_len+3+7>>>3,n=o.static_len+3+7>>>3,n<=i&&(i=n)):i=n=e+5,e+4<=i&&t!==-1?aHe(o,t,e,r):o.strategy===tAt||n===i?(PP(o,(XUe<<1)+(r?1:0),3),WUe(o,P_,HX)):(PP(o,(nAt<<1)+(r?1:0),3),mAt(o,o.l_desc.max_code+1,o.d_desc.max_code+1,s+1),WUe(o,o.dyn_ltree,o.dyn_dtree)),oHe(o),r&&sHe(o)}function TAt(o,t,e){return o.pending_buf[o.d_buf+o.last_lit*2]=t>>>8&255,o.pending_buf[o.d_buf+o.last_lit*2+1]=t&255,o.pending_buf[o.l_buf+o.last_lit]=e&255,o.last_lit++,t===0?o.dyn_ltree[e*2]++:(o.matches++,t--,o.dyn_ltree[(YX[e]+XX+1)*2]++,o.dyn_dtree[rHe(t)*2]++),o.last_lit===o.lit_bufsize-1}MV._tr_init=yAt;MV._tr_stored_block=aHe;MV._tr_flush_block=PAt;MV._tr_tally=TAt;MV._tr_align=bAt});var rEe=Fp((cVn,cHe)=>{"use strict";function IAt(o,t,e,r){for(var i=o&65535|0,n=o>>>16&65535|0,s=0;e!==0;){s=e>2e3?2e3:e,e-=s;do i=i+t[r++]|0,n=n+i|0;while(--s);i%=65521,n%=65521}return i|n<<16|0}cHe.exports=IAt});var iEe=Fp((hVn,hHe)=>{"use strict";function CAt(){for(var o,t=[],e=0;e<256;e++){o=e;for(var r=0;r<8;r++)o=o&1?3988292384^o>>>1:o>>>1;t[e]=o}return t}var SAt=CAt();function EAt(o,t,e,r){var i=SAt,n=r+e;o^=-1;for(var s=r;s<n;s++)o=o>>>8^i[(o^t[s])&255];return o^-1}hHe.exports=EAt});var lae=Fp((uVn,uHe)=>{"use strict";uHe.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var THe=Fp(k3=>{"use strict";var o2=b_(),SC=lHe(),mHe=rEe(),FD=iEe(),OAt=lae(),w5=0,AAt=1,_At=3,WD=4,dHe=5,N3=0,pHe=1,EC=-2,vAt=-3,nEe=-5,xAt=-1,RAt=1,cae=2,DAt=3,wAt=4,LAt=0,MAt=2,pae=8,NAt=9,kAt=15,BAt=8,FAt=29,VAt=256,sEe=VAt+1+FAt,GAt=30,UAt=19,HAt=2*sEe+1,WAt=15,Zc=3,UD=258,d9=UD+Zc+1,zAt=32,fae=42,aEe=69,hae=73,uae=91,dae=103,x5=113,$X=666,fg=1,KX=2,R5=3,BV=4,YAt=3;function HD(o,t){return o.msg=OAt[t],t}function fHe(o){return(o<<1)-(o>4?9:0)}function GD(o){for(var t=o.length;--t>=0;)o[t]=0}function VD(o){var t=o.state,e=t.pending;e>o.avail_out&&(e=o.avail_out),e!==0&&(o2.arraySet(o.output,t.pending_buf,t.pending_out,e,o.next_out),o.next_out+=e,t.pending_out+=e,o.total_out+=e,o.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))}function Z1(o,t){SC._tr_flush_block(o,o.block_start>=0?o.block_start:-1,o.strstart-o.block_start,t),o.block_start=o.strstart,VD(o.strm)}function Gh(o,t){o.pending_buf[o.pending++]=t}function qX(o,t){o.pending_buf[o.pending++]=t>>>8&255,o.pending_buf[o.pending++]=t&255}function jAt(o,t,e,r){var i=o.avail_in;return i>r&&(i=r),i===0?0:(o.avail_in-=i,o2.arraySet(t,o.input,o.next_in,i,e),o.state.wrap===1?o.adler=mHe(o.adler,t,i,e):o.state.wrap===2&&(o.adler=FD(o.adler,t,i,e)),o.next_in+=i,o.total_in+=i,i)}function gHe(o,t){var e=o.max_chain_length,r=o.strstart,i,n,s=o.prev_length,a=o.nice_match,l=o.strstart>o.w_size-d9?o.strstart-(o.w_size-d9):0,c=o.window,h=o.w_mask,u=o.prev,d=o.strstart+UD,p=c[r+s-1],m=c[r+s];o.prev_length>=o.good_match&&(e>>=2),a>o.lookahead&&(a=o.lookahead);do if(i=t,!(c[i+s]!==m||c[i+s-1]!==p||c[i]!==c[r]||c[++i]!==c[r+1])){r+=2,i++;do;while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&r<d);if(n=UD-(d-r),r=d-UD,n>s){if(o.match_start=t,s=n,n>=a)break;p=c[r+s-1],m=c[r+s]}}while((t=u[t&h])>l&&--e!==0);return s<=o.lookahead?s:o.lookahead}function D5(o){var t=o.w_size,e,r,i,n,s;do{if(n=o.window_size-o.lookahead-o.strstart,o.strstart>=t+(t-d9)){o2.arraySet(o.window,o.window,t,t,0),o.match_start-=t,o.strstart-=t,o.block_start-=t,r=o.hash_size,e=r;do i=o.head[--e],o.head[e]=i>=t?i-t:0;while(--r);r=t,e=r;do i=o.prev[--e],o.prev[e]=i>=t?i-t:0;while(--r);n+=t}if(o.strm.avail_in===0)break;if(r=jAt(o.strm,o.window,o.strstart+o.lookahead,n),o.lookahead+=r,o.lookahead+o.insert>=Zc)for(s=o.strstart-o.insert,o.ins_h=o.window[s],o.ins_h=(o.ins_h<<o.hash_shift^o.window[s+1])&o.hash_mask;o.insert&&(o.ins_h=(o.ins_h<<o.hash_shift^o.window[s+Zc-1])&o.hash_mask,o.prev[s&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=s,s++,o.insert--,!(o.lookahead+o.insert<Zc)););}while(o.lookahead<d9&&o.strm.avail_in!==0)}function XAt(o,t){var e=65535;for(e>o.pending_buf_size-5&&(e=o.pending_buf_size-5);;){if(o.lookahead<=1){if(D5(o),o.lookahead===0&&t===w5)return fg;if(o.lookahead===0)break}o.strstart+=o.lookahead,o.lookahead=0;var r=o.block_start+e;if((o.strstart===0||o.strstart>=r)&&(o.lookahead=o.strstart-r,o.strstart=r,Z1(o,!1),o.strm.avail_out===0)||o.strstart-o.block_start>=o.w_size-d9&&(Z1(o,!1),o.strm.avail_out===0))return fg}return o.insert=0,t===WD?(Z1(o,!0),o.strm.avail_out===0?R5:BV):(o.strstart>o.block_start&&(Z1(o,!1),o.strm.avail_out===0),fg)}function oEe(o,t){for(var e,r;;){if(o.lookahead<d9){if(D5(o),o.lookahead<d9&&t===w5)return fg;if(o.lookahead===0)break}if(e=0,o.lookahead>=Zc&&(o.ins_h=(o.ins_h<<o.hash_shift^o.window[o.strstart+Zc-1])&o.hash_mask,e=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart),e!==0&&o.strstart-e<=o.w_size-d9&&(o.match_length=gHe(o,e)),o.match_length>=Zc)if(r=SC._tr_tally(o,o.strstart-o.match_start,o.match_length-Zc),o.lookahead-=o.match_length,o.match_length<=o.max_lazy_match&&o.lookahead>=Zc){o.match_length--;do o.strstart++,o.ins_h=(o.ins_h<<o.hash_shift^o.window[o.strstart+Zc-1])&o.hash_mask,e=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart;while(--o.match_length!==0);o.strstart++}else o.strstart+=o.match_length,o.match_length=0,o.ins_h=o.window[o.strstart],o.ins_h=(o.ins_h<<o.hash_shift^o.window[o.strstart+1])&o.hash_mask;else r=SC._tr_tally(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++;if(r&&(Z1(o,!1),o.strm.avail_out===0))return fg}return o.insert=o.strstart<Zc-1?o.strstart:Zc-1,t===WD?(Z1(o,!0),o.strm.avail_out===0?R5:BV):o.last_lit&&(Z1(o,!1),o.strm.avail_out===0)?fg:KX}function NV(o,t){for(var e,r,i;;){if(o.lookahead<d9){if(D5(o),o.lookahead<d9&&t===w5)return fg;if(o.lookahead===0)break}if(e=0,o.lookahead>=Zc&&(o.ins_h=(o.ins_h<<o.hash_shift^o.window[o.strstart+Zc-1])&o.hash_mask,e=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart),o.prev_length=o.match_length,o.prev_match=o.match_start,o.match_length=Zc-1,e!==0&&o.prev_length<o.max_lazy_match&&o.strstart-e<=o.w_size-d9&&(o.match_length=gHe(o,e),o.match_length<=5&&(o.strategy===RAt||o.match_length===Zc&&o.strstart-o.match_start>4096)&&(o.match_length=Zc-1)),o.prev_length>=Zc&&o.match_length<=o.prev_length){i=o.strstart+o.lookahead-Zc,r=SC._tr_tally(o,o.strstart-1-o.prev_match,o.prev_length-Zc),o.lookahead-=o.prev_length-1,o.prev_length-=2;do++o.strstart<=i&&(o.ins_h=(o.ins_h<<o.hash_shift^o.window[o.strstart+Zc-1])&o.hash_mask,e=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart);while(--o.prev_length!==0);if(o.match_available=0,o.match_length=Zc-1,o.strstart++,r&&(Z1(o,!1),o.strm.avail_out===0))return fg}else if(o.match_available){if(r=SC._tr_tally(o,0,o.window[o.strstart-1]),r&&Z1(o,!1),o.strstart++,o.lookahead--,o.strm.avail_out===0)return fg}else o.match_available=1,o.strstart++,o.lookahead--}return o.match_available&&(r=SC._tr_tally(o,0,o.window[o.strstart-1]),o.match_available=0),o.insert=o.strstart<Zc-1?o.strstart:Zc-1,t===WD?(Z1(o,!0),o.strm.avail_out===0?R5:BV):o.last_lit&&(Z1(o,!1),o.strm.avail_out===0)?fg:KX}function qAt(o,t){for(var e,r,i,n,s=o.window;;){if(o.lookahead<=UD){if(D5(o),o.lookahead<=UD&&t===w5)return fg;if(o.lookahead===0)break}if(o.match_length=0,o.lookahead>=Zc&&o.strstart>0&&(i=o.strstart-1,r=s[i],r===s[++i]&&r===s[++i]&&r===s[++i])){n=o.strstart+UD;do;while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&i<n);o.match_length=UD-(n-i),o.match_length>o.lookahead&&(o.match_length=o.lookahead)}if(o.match_length>=Zc?(e=SC._tr_tally(o,1,o.match_length-Zc),o.lookahead-=o.match_length,o.strstart+=o.match_length,o.match_length=0):(e=SC._tr_tally(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++),e&&(Z1(o,!1),o.strm.avail_out===0))return fg}return o.insert=0,t===WD?(Z1(o,!0),o.strm.avail_out===0?R5:BV):o.last_lit&&(Z1(o,!1),o.strm.avail_out===0)?fg:KX}function $At(o,t){for(var e;;){if(o.lookahead===0&&(D5(o),o.lookahead===0)){if(t===w5)return fg;break}if(o.match_length=0,e=SC._tr_tally(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++,e&&(Z1(o,!1),o.strm.avail_out===0))return fg}return o.insert=0,t===WD?(Z1(o,!0),o.strm.avail_out===0?R5:BV):o.last_lit&&(Z1(o,!1),o.strm.avail_out===0)?fg:KX}function M3(o,t,e,r,i){this.good_length=o,this.max_lazy=t,this.nice_length=e,this.max_chain=r,this.func=i}var kV;kV=[new M3(0,0,0,0,XAt),new M3(4,4,8,4,oEe),new M3(4,5,16,8,oEe),new M3(4,6,32,32,oEe),new M3(4,4,16,16,NV),new M3(8,16,32,32,NV),new M3(8,16,128,128,NV),new M3(8,32,128,256,NV),new M3(32,128,258,1024,NV),new M3(32,258,258,4096,NV)];function KAt(o){o.window_size=2*o.w_size,GD(o.head),o.max_lazy_match=kV[o.level].max_lazy,o.good_match=kV[o.level].good_length,o.nice_match=kV[o.level].nice_length,o.max_chain_length=kV[o.level].max_chain,o.strstart=0,o.block_start=0,o.lookahead=0,o.insert=0,o.match_length=o.prev_length=Zc-1,o.match_available=0,o.ins_h=0}function ZAt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=pae,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o2.Buf16(HAt*2),this.dyn_dtree=new o2.Buf16((2*GAt+1)*2),this.bl_tree=new o2.Buf16((2*UAt+1)*2),GD(this.dyn_ltree),GD(this.dyn_dtree),GD(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o2.Buf16(WAt+1),this.heap=new o2.Buf16(2*sEe+1),GD(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o2.Buf16(2*sEe+1),GD(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function yHe(o){var t;return!o||!o.state?HD(o,EC):(o.total_in=o.total_out=0,o.data_type=MAt,t=o.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?fae:x5,o.adler=t.wrap===2?0:1,t.last_flush=w5,SC._tr_init(t),N3)}function bHe(o){var t=yHe(o);return t===N3&&KAt(o.state),t}function JAt(o,t){return!o||!o.state||o.state.wrap!==2?EC:(o.state.gzhead=t,N3)}function PHe(o,t,e,r,i,n){if(!o)return EC;var s=1;if(t===xAt&&(t=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>NAt||e!==pae||r<8||r>15||t<0||t>9||n<0||n>wAt)return HD(o,EC);r===8&&(r=9);var a=new ZAt;return o.state=a,a.strm=o,a.wrap=s,a.gzhead=null,a.w_bits=r,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+Zc-1)/Zc),a.window=new o2.Buf8(a.w_size*2),a.head=new o2.Buf16(a.hash_size),a.prev=new o2.Buf16(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=a.lit_bufsize*4,a.pending_buf=new o2.Buf8(a.pending_buf_size),a.d_buf=1*a.lit_bufsize,a.l_buf=3*a.lit_bufsize,a.level=t,a.strategy=n,a.method=e,bHe(o)}function QAt(o,t){return PHe(o,t,pae,kAt,BAt,LAt)}function e_t(o,t){var e,r,i,n;if(!o||!o.state||t>dHe||t<0)return o?HD(o,EC):EC;if(r=o.state,!o.output||!o.input&&o.avail_in!==0||r.status===$X&&t!==WD)return HD(o,o.avail_out===0?nEe:EC);if(r.strm=o,e=r.last_flush,r.last_flush=t,r.status===fae)if(r.wrap===2)o.adler=0,Gh(r,31),Gh(r,139),Gh(r,8),r.gzhead?(Gh(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Gh(r,r.gzhead.time&255),Gh(r,r.gzhead.time>>8&255),Gh(r,r.gzhead.time>>16&255),Gh(r,r.gzhead.time>>24&255),Gh(r,r.level===9?2:r.strategy>=cae||r.level<2?4:0),Gh(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(Gh(r,r.gzhead.extra.length&255),Gh(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(o.adler=FD(o.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=aEe):(Gh(r,0),Gh(r,0),Gh(r,0),Gh(r,0),Gh(r,0),Gh(r,r.level===9?2:r.strategy>=cae||r.level<2?4:0),Gh(r,YAt),r.status=x5);else{var s=pae+(r.w_bits-8<<4)<<8,a=-1;r.strategy>=cae||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,s|=a<<6,r.strstart!==0&&(s|=zAt),s+=31-s%31,r.status=x5,qX(r,s),r.strstart!==0&&(qX(r,o.adler>>>16),qX(r,o.adler&65535)),o.adler=1}if(r.status===aEe)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(r.gzhead.extra.length&65535)&&!(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(o.adler=FD(o.adler,r.pending_buf,r.pending-i,i)),VD(o),i=r.pending,r.pending===r.pending_buf_size));)Gh(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(o.adler=FD(o.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=hae)}else r.status=hae;if(r.status===hae)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(o.adler=FD(o.adler,r.pending_buf,r.pending-i,i)),VD(o),i=r.pending,r.pending===r.pending_buf_size)){n=1;break}r.gzindex<r.gzhead.name.length?n=r.gzhead.name.charCodeAt(r.gzindex++)&255:n=0,Gh(r,n)}while(n!==0);r.gzhead.hcrc&&r.pending>i&&(o.adler=FD(o.adler,r.pending_buf,r.pending-i,i)),n===0&&(r.gzindex=0,r.status=uae)}else r.status=uae;if(r.status===uae)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(o.adler=FD(o.adler,r.pending_buf,r.pending-i,i)),VD(o),i=r.pending,r.pending===r.pending_buf_size)){n=1;break}r.gzindex<r.gzhead.comment.length?n=r.gzhead.comment.charCodeAt(r.gzindex++)&255:n=0,Gh(r,n)}while(n!==0);r.gzhead.hcrc&&r.pending>i&&(o.adler=FD(o.adler,r.pending_buf,r.pending-i,i)),n===0&&(r.status=dae)}else r.status=dae;if(r.status===dae&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&VD(o),r.pending+2<=r.pending_buf_size&&(Gh(r,o.adler&255),Gh(r,o.adler>>8&255),o.adler=0,r.status=x5)):r.status=x5),r.pending!==0){if(VD(o),o.avail_out===0)return r.last_flush=-1,N3}else if(o.avail_in===0&&fHe(t)<=fHe(e)&&t!==WD)return HD(o,nEe);if(r.status===$X&&o.avail_in!==0)return HD(o,nEe);if(o.avail_in!==0||r.lookahead!==0||t!==w5&&r.status!==$X){var l=r.strategy===cae?$At(r,t):r.strategy===DAt?qAt(r,t):kV[r.level].func(r,t);if((l===R5||l===BV)&&(r.status=$X),l===fg||l===R5)return o.avail_out===0&&(r.last_flush=-1),N3;if(l===KX&&(t===AAt?SC._tr_align(r):t!==dHe&&(SC._tr_stored_block(r,0,0,!1),t===_At&&(GD(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),VD(o),o.avail_out===0))return r.last_flush=-1,N3}return t!==WD?N3:r.wrap<=0?pHe:(r.wrap===2?(Gh(r,o.adler&255),Gh(r,o.adler>>8&255),Gh(r,o.adler>>16&255),Gh(r,o.adler>>24&255),Gh(r,o.total_in&255),Gh(r,o.total_in>>8&255),Gh(r,o.total_in>>16&255),Gh(r,o.total_in>>24&255)):(qX(r,o.adler>>>16),qX(r,o.adler&65535)),VD(o),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?N3:pHe)}function t_t(o){var t;return!o||!o.state?EC:(t=o.state.status,t!==fae&&t!==aEe&&t!==hae&&t!==uae&&t!==dae&&t!==x5&&t!==$X?HD(o,EC):(o.state=null,t===x5?HD(o,vAt):N3))}function r_t(o,t){var e=t.length,r,i,n,s,a,l,c,h;if(!o||!o.state||(r=o.state,s=r.wrap,s===2||s===1&&r.status!==fae||r.lookahead))return EC;for(s===1&&(o.adler=mHe(o.adler,t,e,0)),r.wrap=0,e>=r.w_size&&(s===0&&(GD(r.head),r.strstart=0,r.block_start=0,r.insert=0),h=new o2.Buf8(r.w_size),o2.arraySet(h,t,e-r.w_size,r.w_size,0),t=h,e=r.w_size),a=o.avail_in,l=o.next_in,c=o.input,o.avail_in=e,o.next_in=0,o.input=t,D5(r);r.lookahead>=Zc;){i=r.strstart,n=r.lookahead-(Zc-1);do r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+Zc-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++;while(--n);r.strstart=i,r.lookahead=Zc-1,D5(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Zc-1,r.match_available=0,o.next_in=l,o.input=c,o.avail_in=a,r.wrap=s,N3}k3.deflateInit=QAt;k3.deflateInit2=PHe;k3.deflateReset=bHe;k3.deflateResetKeep=yHe;k3.deflateSetHeader=JAt;k3.deflate=e_t;k3.deflateEnd=t_t;k3.deflateSetDictionary=r_t;k3.deflateInfo="pako deflate (from Nodeca project)"});var lEe=Fp(FV=>{"use strict";var mae=b_(),IHe=!0,CHe=!0;try{String.fromCharCode.apply(null,[0])}catch{IHe=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{CHe=!1}var ZX=new mae.Buf8(256);for(T_=0;T_<256;T_++)ZX[T_]=T_>=252?6:T_>=248?5:T_>=240?4:T_>=224?3:T_>=192?2:1;var T_;ZX[254]=ZX[254]=1;FV.string2buf=function(o){var t,e,r,i,n,s=o.length,a=0;for(i=0;i<s;i++)e=o.charCodeAt(i),(e&64512)===55296&&i+1<s&&(r=o.charCodeAt(i+1),(r&64512)===56320&&(e=65536+(e-55296<<10)+(r-56320),i++)),a+=e<128?1:e<2048?2:e<65536?3:4;for(t=new mae.Buf8(a),n=0,i=0;n<a;i++)e=o.charCodeAt(i),(e&64512)===55296&&i+1<s&&(r=o.charCodeAt(i+1),(r&64512)===56320&&(e=65536+(e-55296<<10)+(r-56320),i++)),e<128?t[n++]=e:e<2048?(t[n++]=192|e>>>6,t[n++]=128|e&63):e<65536?(t[n++]=224|e>>>12,t[n++]=128|e>>>6&63,t[n++]=128|e&63):(t[n++]=240|e>>>18,t[n++]=128|e>>>12&63,t[n++]=128|e>>>6&63,t[n++]=128|e&63);return t};function SHe(o,t){if(t<65534&&(o.subarray&&CHe||!o.subarray&&IHe))return String.fromCharCode.apply(null,mae.shrinkBuf(o,t));for(var e="",r=0;r<t;r++)e+=String.fromCharCode(o[r]);return e}FV.buf2binstring=function(o){return SHe(o,o.length)};FV.binstring2buf=function(o){for(var t=new mae.Buf8(o.length),e=0,r=t.length;e<r;e++)t[e]=o.charCodeAt(e);return t};FV.buf2string=function(o,t){var e,r,i,n,s=t||o.length,a=new Array(s*2);for(r=0,e=0;e<s;){if(i=o[e++],i<128){a[r++]=i;continue}if(n=ZX[i],n>4){a[r++]=65533,e+=n-1;continue}for(i&=n===2?31:n===3?15:7;n>1&&e<s;)i=i<<6|o[e++]&63,n--;if(n>1){a[r++]=65533;continue}i<65536?a[r++]=i:(i-=65536,a[r++]=55296|i>>10&1023,a[r++]=56320|i&1023)}return SHe(a,r)};FV.utf8border=function(o,t){var e;for(t=t||o.length,t>o.length&&(t=o.length),e=t-1;e>=0&&(o[e]&192)===128;)e--;return e<0||e===0?t:e+ZX[o[e]]>t?e:t}});var cEe=Fp((fVn,EHe)=>{"use strict";function i_t(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}EHe.exports=i_t});var vHe=Fp(eq=>{"use strict";var JX=THe(),QX=b_(),uEe=lEe(),dEe=lae(),n_t=cEe(),_He=Object.prototype.toString,o_t=0,hEe=4,VV=0,OHe=1,AHe=2,s_t=-1,a_t=0,l_t=8;function L5(o){if(!(this instanceof L5))return new L5(o);this.options=QX.assign({level:s_t,method:l_t,chunkSize:16384,windowBits:15,memLevel:8,strategy:a_t,to:""},o||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new n_t,this.strm.avail_out=0;var e=JX.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==VV)throw new Error(dEe[e]);if(t.header&&JX.deflateSetHeader(this.strm,t.header),t.dictionary){var r;if(typeof t.dictionary=="string"?r=uEe.string2buf(t.dictionary):_He.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,e=JX.deflateSetDictionary(this.strm,r),e!==VV)throw new Error(dEe[e]);this._dict_set=!0}}L5.prototype.push=function(o,t){var e=this.strm,r=this.options.chunkSize,i,n;if(this.ended)return!1;n=t===~~t?t:t===!0?hEe:o_t,typeof o=="string"?e.input=uEe.string2buf(o):_He.call(o)==="[object ArrayBuffer]"?e.input=new Uint8Array(o):e.input=o,e.next_in=0,e.avail_in=e.input.length;do{if(e.avail_out===0&&(e.output=new QX.Buf8(r),e.next_out=0,e.avail_out=r),i=JX.deflate(e,n),i!==OHe&&i!==VV)return this.onEnd(i),this.ended=!0,!1;(e.avail_out===0||e.avail_in===0&&(n===hEe||n===AHe))&&(this.options.to==="string"?this.onData(uEe.buf2binstring(QX.shrinkBuf(e.output,e.next_out))):this.onData(QX.shrinkBuf(e.output,e.next_out)))}while((e.avail_in>0||e.avail_out===0)&&i!==OHe);return n===hEe?(i=JX.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===VV):(n===AHe&&(this.onEnd(VV),e.avail_out=0),!0)};L5.prototype.onData=function(o){this.chunks.push(o)};L5.prototype.onEnd=function(o){o===VV&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=QX.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg};function pEe(o,t){var e=new L5(t);if(e.push(o,!0),e.err)throw e.msg||dEe[e.err];return e.result}function c_t(o,t){return t=t||{},t.raw=!0,pEe(o,t)}function h_t(o,t){return t=t||{},t.gzip=!0,pEe(o,t)}eq.Deflate=L5;eq.deflate=pEe;eq.deflateRaw=c_t;eq.gzip=h_t});var RHe=Fp((gVn,xHe)=>{"use strict";var gae=30,u_t=12;xHe.exports=function(t,e){var r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v,D;r=t.state,i=t.next_in,v=t.input,n=i+(t.avail_in-5),s=t.next_out,D=t.output,a=s-(e-t.avail_out),l=s+(t.avail_out-257),c=r.dmax,h=r.wsize,u=r.whave,d=r.wnext,p=r.window,m=r.hold,g=r.bits,y=r.lencode,b=r.distcode,P=(1<<r.lenbits)-1,T=(1<<r.distbits)-1;e:do{g<15&&(m+=v[i++]<<g,g+=8,m+=v[i++]<<g,g+=8),I=y[m&P];t:for(;;){if(C=I>>>24,m>>>=C,g-=C,C=I>>>16&255,C===0)D[s++]=I&65535;else if(C&16){E=I&65535,C&=15,C&&(g<C&&(m+=v[i++]<<g,g+=8),E+=m&(1<<C)-1,m>>>=C,g-=C),g<15&&(m+=v[i++]<<g,g+=8,m+=v[i++]<<g,g+=8),I=b[m&T];r:for(;;){if(C=I>>>24,m>>>=C,g-=C,C=I>>>16&255,C&16){if(O=I&65535,C&=15,g<C&&(m+=v[i++]<<g,g+=8,g<C&&(m+=v[i++]<<g,g+=8)),O+=m&(1<<C)-1,O>c){t.msg="invalid distance too far back",r.mode=gae;break e}if(m>>>=C,g-=C,C=s-a,O>C){if(C=O-C,C>u&&r.sane){t.msg="invalid distance too far back",r.mode=gae;break e}if(_=0,R=p,d===0){if(_+=h-C,C<E){E-=C;do D[s++]=p[_++];while(--C);_=s-O,R=D}}else if(d<C){if(_+=h+d-C,C-=d,C<E){E-=C;do D[s++]=p[_++];while(--C);if(_=0,d<E){C=d,E-=C;do D[s++]=p[_++];while(--C);_=s-O,R=D}}}else if(_+=d-C,C<E){E-=C;do D[s++]=p[_++];while(--C);_=s-O,R=D}for(;E>2;)D[s++]=R[_++],D[s++]=R[_++],D[s++]=R[_++],E-=3;E&&(D[s++]=R[_++],E>1&&(D[s++]=R[_++]))}else{_=s-O;do D[s++]=D[_++],D[s++]=D[_++],D[s++]=D[_++],E-=3;while(E>2);E&&(D[s++]=D[_++],E>1&&(D[s++]=D[_++]))}}else if((C&64)===0){I=b[(I&65535)+(m&(1<<C)-1)];continue r}else{t.msg="invalid distance code",r.mode=gae;break e}break}}else if((C&64)===0){I=y[(I&65535)+(m&(1<<C)-1)];continue t}else if(C&32){r.mode=u_t;break e}else{t.msg="invalid literal/length code",r.mode=gae;break e}break}}while(i<n&&s<l);E=g>>3,i-=E,g-=E<<3,m&=(1<<g)-1,t.next_in=i,t.next_out=s,t.avail_in=i<n?5+(n-i):5-(i-n),t.avail_out=s<l?257+(l-s):257-(s-l),r.hold=m,r.bits=g}});var BHe=Fp((yVn,kHe)=>{"use strict";var DHe=b_(),GV=15,wHe=852,LHe=592,MHe=0,fEe=1,NHe=2,d_t=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],p_t=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],f_t=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],m_t=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];kHe.exports=function(t,e,r,i,n,s,a,l){var c=l.bits,h=0,u=0,d=0,p=0,m=0,g=0,y=0,b=0,P=0,T=0,I,C,E,O,_,R=null,v=0,D,w=new DHe.Buf16(GV+1),F=new DHe.Buf16(GV+1),H=null,z=0,G,W,L;for(h=0;h<=GV;h++)w[h]=0;for(u=0;u<i;u++)w[e[r+u]]++;for(m=c,p=GV;p>=1&&w[p]===0;p--);if(m>p&&(m=p),p===0)return n[s++]=1<<24|64<<16|0,n[s++]=1<<24|64<<16|0,l.bits=1,0;for(d=1;d<p&&w[d]===0;d++);for(m<d&&(m=d),b=1,h=1;h<=GV;h++)if(b<<=1,b-=w[h],b<0)return-1;if(b>0&&(t===MHe||p!==1))return-1;for(F[1]=0,h=1;h<GV;h++)F[h+1]=F[h]+w[h];for(u=0;u<i;u++)e[r+u]!==0&&(a[F[e[r+u]]++]=u);if(t===MHe?(R=H=a,D=19):t===fEe?(R=d_t,v-=257,H=p_t,z-=257,D=256):(R=f_t,H=m_t,D=-1),T=0,u=0,h=d,_=s,g=m,y=0,E=-1,P=1<<m,O=P-1,t===fEe&&P>wHe||t===NHe&&P>LHe)return 1;for(;;){G=h-y,a[u]<D?(W=0,L=a[u]):a[u]>D?(W=H[z+a[u]],L=R[v+a[u]]):(W=96,L=0),I=1<<h-y,C=1<<g,d=C;do C-=I,n[_+(T>>y)+C]=G<<24|W<<16|L|0;while(C!==0);for(I=1<<h-1;T&I;)I>>=1;if(I!==0?(T&=I-1,T+=I):T=0,u++,--w[h]===0){if(h===p)break;h=e[r+a[u]]}if(h>m&&(T&O)!==E){for(y===0&&(y=m),_+=d,g=h-y,b=1<<g;g+y<p&&(b-=w[g+y],!(b<=0));)g++,b<<=1;if(P+=1<<g,t===fEe&&P>wHe||t===NHe&&P>LHe)return 1;E=T&O,n[E]=m<<24|g<<16|_-s|0}}return T!==0&&(n[_+T]=h-y<<24|64<<16|0),l.bits=m,0}});var bWe=Fp(p9=>{"use strict";var HT=b_(),TEe=rEe(),B3=iEe(),g_t=RHe(),tq=BHe(),y_t=0,cWe=1,hWe=2,FHe=4,b_t=5,yae=6,M5=0,P_t=1,T_t=2,OC=-2,uWe=-3,IEe=-4,I_t=-5,VHe=8,dWe=1,GHe=2,UHe=3,HHe=4,WHe=5,zHe=6,YHe=7,jHe=8,XHe=9,qHe=10,Tae=11,I_=12,mEe=13,$He=14,gEe=15,KHe=16,ZHe=17,JHe=18,QHe=19,bae=20,Pae=21,eWe=22,tWe=23,rWe=24,iWe=25,nWe=26,yEe=27,oWe=28,sWe=29,c0=30,CEe=31,C_t=32,S_t=852,E_t=592,O_t=15,A_t=O_t;function aWe(o){return(o>>>24&255)+(o>>>8&65280)+((o&65280)<<8)+((o&255)<<24)}function __t(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new HT.Buf16(320),this.work=new HT.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function pWe(o){var t;return!o||!o.state?OC:(t=o.state,o.total_in=o.total_out=t.total=0,o.msg="",t.wrap&&(o.adler=t.wrap&1),t.mode=dWe,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new HT.Buf32(S_t),t.distcode=t.distdyn=new HT.Buf32(E_t),t.sane=1,t.back=-1,M5)}function fWe(o){var t;return!o||!o.state?OC:(t=o.state,t.wsize=0,t.whave=0,t.wnext=0,pWe(o))}function mWe(o,t){var e,r;return!o||!o.state||(r=o.state,t<0?(e=0,t=-t):(e=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?OC:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=e,r.wbits=t,fWe(o))}function gWe(o,t){var e,r;return o?(r=new __t,o.state=r,r.window=null,e=mWe(o,t),e!==M5&&(o.state=null),e):OC}function v_t(o){return gWe(o,A_t)}var lWe=!0,bEe,PEe;function x_t(o){if(lWe){var t;for(bEe=new HT.Buf32(512),PEe=new HT.Buf32(32),t=0;t<144;)o.lens[t++]=8;for(;t<256;)o.lens[t++]=9;for(;t<280;)o.lens[t++]=7;for(;t<288;)o.lens[t++]=8;for(tq(cWe,o.lens,0,288,bEe,0,o.work,{bits:9}),t=0;t<32;)o.lens[t++]=5;tq(hWe,o.lens,0,32,PEe,0,o.work,{bits:5}),lWe=!1}o.lencode=bEe,o.lenbits=9,o.distcode=PEe,o.distbits=5}function yWe(o,t,e,r){var i,n=o.state;return n.window===null&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new HT.Buf8(n.wsize)),r>=n.wsize?(HT.arraySet(n.window,t,e-n.wsize,n.wsize,0),n.wnext=0,n.whave=n.wsize):(i=n.wsize-n.wnext,i>r&&(i=r),HT.arraySet(n.window,t,e-r,i,n.wnext),r-=i,r?(HT.arraySet(n.window,t,e-r,r,0),n.wnext=r,n.whave=n.wsize):(n.wnext+=i,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=i))),0}function R_t(o,t){var e,r,i,n,s,a,l,c,h,u,d,p,m,g,y=0,b,P,T,I,C,E,O,_,R=new HT.Buf8(4),v,D,w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!o||!o.state||!o.output||!o.input&&o.avail_in!==0)return OC;e=o.state,e.mode===I_&&(e.mode=mEe),s=o.next_out,i=o.output,l=o.avail_out,n=o.next_in,r=o.input,a=o.avail_in,c=e.hold,h=e.bits,u=a,d=l,_=M5;e:for(;;)switch(e.mode){case dWe:if(e.wrap===0){e.mode=mEe;break}for(;h<16;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(e.wrap&2&&c===35615){e.check=0,R[0]=c&255,R[1]=c>>>8&255,e.check=B3(e.check,R,2,0),c=0,h=0,e.mode=GHe;break}if(e.flags=0,e.head&&(e.head.done=!1),!(e.wrap&1)||(((c&255)<<8)+(c>>8))%31){o.msg="incorrect header check",e.mode=c0;break}if((c&15)!==VHe){o.msg="unknown compression method",e.mode=c0;break}if(c>>>=4,h-=4,O=(c&15)+8,e.wbits===0)e.wbits=O;else if(O>e.wbits){o.msg="invalid window size",e.mode=c0;break}e.dmax=1<<O,o.adler=e.check=1,e.mode=c&512?qHe:I_,c=0,h=0;break;case GHe:for(;h<16;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(e.flags=c,(e.flags&255)!==VHe){o.msg="unknown compression method",e.mode=c0;break}if(e.flags&57344){o.msg="unknown header flags set",e.mode=c0;break}e.head&&(e.head.text=c>>8&1),e.flags&512&&(R[0]=c&255,R[1]=c>>>8&255,e.check=B3(e.check,R,2,0)),c=0,h=0,e.mode=UHe;case UHe:for(;h<32;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}e.head&&(e.head.time=c),e.flags&512&&(R[0]=c&255,R[1]=c>>>8&255,R[2]=c>>>16&255,R[3]=c>>>24&255,e.check=B3(e.check,R,4,0)),c=0,h=0,e.mode=HHe;case HHe:for(;h<16;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}e.head&&(e.head.xflags=c&255,e.head.os=c>>8),e.flags&512&&(R[0]=c&255,R[1]=c>>>8&255,e.check=B3(e.check,R,2,0)),c=0,h=0,e.mode=WHe;case WHe:if(e.flags&1024){for(;h<16;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}e.length=c,e.head&&(e.head.extra_len=c),e.flags&512&&(R[0]=c&255,R[1]=c>>>8&255,e.check=B3(e.check,R,2,0)),c=0,h=0}else e.head&&(e.head.extra=null);e.mode=zHe;case zHe:if(e.flags&1024&&(p=e.length,p>a&&(p=a),p&&(e.head&&(O=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Array(e.head.extra_len)),HT.arraySet(e.head.extra,r,n,p,O)),e.flags&512&&(e.check=B3(e.check,r,p,n)),a-=p,n+=p,e.length-=p),e.length))break e;e.length=0,e.mode=YHe;case YHe:if(e.flags&2048){if(a===0)break e;p=0;do O=r[n+p++],e.head&&O&&e.length<65536&&(e.head.name+=String.fromCharCode(O));while(O&&p<a);if(e.flags&512&&(e.check=B3(e.check,r,p,n)),a-=p,n+=p,O)break e}else e.head&&(e.head.name=null);e.length=0,e.mode=jHe;case jHe:if(e.flags&4096){if(a===0)break e;p=0;do O=r[n+p++],e.head&&O&&e.length<65536&&(e.head.comment+=String.fromCharCode(O));while(O&&p<a);if(e.flags&512&&(e.check=B3(e.check,r,p,n)),a-=p,n+=p,O)break e}else e.head&&(e.head.comment=null);e.mode=XHe;case XHe:if(e.flags&512){for(;h<16;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(c!==(e.check&65535)){o.msg="header crc mismatch",e.mode=c0;break}c=0,h=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),o.adler=e.check=0,e.mode=I_;break;case qHe:for(;h<32;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}o.adler=e.check=aWe(c),c=0,h=0,e.mode=Tae;case Tae:if(e.havedict===0)return o.next_out=s,o.avail_out=l,o.next_in=n,o.avail_in=a,e.hold=c,e.bits=h,T_t;o.adler=e.check=1,e.mode=I_;case I_:if(t===b_t||t===yae)break e;case mEe:if(e.last){c>>>=h&7,h-=h&7,e.mode=yEe;break}for(;h<3;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}switch(e.last=c&1,c>>>=1,h-=1,c&3){case 0:e.mode=$He;break;case 1:if(x_t(e),e.mode=bae,t===yae){c>>>=2,h-=2;break e}break;case 2:e.mode=ZHe;break;case 3:o.msg="invalid block type",e.mode=c0}c>>>=2,h-=2;break;case $He:for(c>>>=h&7,h-=h&7;h<32;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if((c&65535)!==(c>>>16^65535)){o.msg="invalid stored block lengths",e.mode=c0;break}if(e.length=c&65535,c=0,h=0,e.mode=gEe,t===yae)break e;case gEe:e.mode=KHe;case KHe:if(p=e.length,p){if(p>a&&(p=a),p>l&&(p=l),p===0)break e;HT.arraySet(i,r,n,p,s),a-=p,n+=p,l-=p,s+=p,e.length-=p;break}e.mode=I_;break;case ZHe:for(;h<14;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(e.nlen=(c&31)+257,c>>>=5,h-=5,e.ndist=(c&31)+1,c>>>=5,h-=5,e.ncode=(c&15)+4,c>>>=4,h-=4,e.nlen>286||e.ndist>30){o.msg="too many length or distance symbols",e.mode=c0;break}e.have=0,e.mode=JHe;case JHe:for(;e.have<e.ncode;){for(;h<3;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}e.lens[w[e.have++]]=c&7,c>>>=3,h-=3}for(;e.have<19;)e.lens[w[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,v={bits:e.lenbits},_=tq(y_t,e.lens,0,19,e.lencode,0,e.work,v),e.lenbits=v.bits,_){o.msg="invalid code lengths set",e.mode=c0;break}e.have=0,e.mode=QHe;case QHe:for(;e.have<e.nlen+e.ndist;){for(;y=e.lencode[c&(1<<e.lenbits)-1],b=y>>>24,P=y>>>16&255,T=y&65535,!(b<=h);){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(T<16)c>>>=b,h-=b,e.lens[e.have++]=T;else{if(T===16){for(D=b+2;h<D;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(c>>>=b,h-=b,e.have===0){o.msg="invalid bit length repeat",e.mode=c0;break}O=e.lens[e.have-1],p=3+(c&3),c>>>=2,h-=2}else if(T===17){for(D=b+3;h<D;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}c>>>=b,h-=b,O=0,p=3+(c&7),c>>>=3,h-=3}else{for(D=b+7;h<D;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}c>>>=b,h-=b,O=0,p=11+(c&127),c>>>=7,h-=7}if(e.have+p>e.nlen+e.ndist){o.msg="invalid bit length repeat",e.mode=c0;break}for(;p--;)e.lens[e.have++]=O}}if(e.mode===c0)break;if(e.lens[256]===0){o.msg="invalid code -- missing end-of-block",e.mode=c0;break}if(e.lenbits=9,v={bits:e.lenbits},_=tq(cWe,e.lens,0,e.nlen,e.lencode,0,e.work,v),e.lenbits=v.bits,_){o.msg="invalid literal/lengths set",e.mode=c0;break}if(e.distbits=6,e.distcode=e.distdyn,v={bits:e.distbits},_=tq(hWe,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,v),e.distbits=v.bits,_){o.msg="invalid distances set",e.mode=c0;break}if(e.mode=bae,t===yae)break e;case bae:e.mode=Pae;case Pae:if(a>=6&&l>=258){o.next_out=s,o.avail_out=l,o.next_in=n,o.avail_in=a,e.hold=c,e.bits=h,g_t(o,d),s=o.next_out,i=o.output,l=o.avail_out,n=o.next_in,r=o.input,a=o.avail_in,c=e.hold,h=e.bits,e.mode===I_&&(e.back=-1);break}for(e.back=0;y=e.lencode[c&(1<<e.lenbits)-1],b=y>>>24,P=y>>>16&255,T=y&65535,!(b<=h);){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(P&&(P&240)===0){for(I=b,C=P,E=T;y=e.lencode[E+((c&(1<<I+C)-1)>>I)],b=y>>>24,P=y>>>16&255,T=y&65535,!(I+b<=h);){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}c>>>=I,h-=I,e.back+=I}if(c>>>=b,h-=b,e.back+=b,e.length=T,P===0){e.mode=nWe;break}if(P&32){e.back=-1,e.mode=I_;break}if(P&64){o.msg="invalid literal/length code",e.mode=c0;break}e.extra=P&15,e.mode=eWe;case eWe:if(e.extra){for(D=e.extra;h<D;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}e.length+=c&(1<<e.extra)-1,c>>>=e.extra,h-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=tWe;case tWe:for(;y=e.distcode[c&(1<<e.distbits)-1],b=y>>>24,P=y>>>16&255,T=y&65535,!(b<=h);){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if((P&240)===0){for(I=b,C=P,E=T;y=e.distcode[E+((c&(1<<I+C)-1)>>I)],b=y>>>24,P=y>>>16&255,T=y&65535,!(I+b<=h);){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}c>>>=I,h-=I,e.back+=I}if(c>>>=b,h-=b,e.back+=b,P&64){o.msg="invalid distance code",e.mode=c0;break}e.offset=T,e.extra=P&15,e.mode=rWe;case rWe:if(e.extra){for(D=e.extra;h<D;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}e.offset+=c&(1<<e.extra)-1,c>>>=e.extra,h-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){o.msg="invalid distance too far back",e.mode=c0;break}e.mode=iWe;case iWe:if(l===0)break e;if(p=d-l,e.offset>p){if(p=e.offset-p,p>e.whave&&e.sane){o.msg="invalid distance too far back",e.mode=c0;break}p>e.wnext?(p-=e.wnext,m=e.wsize-p):m=e.wnext-p,p>e.length&&(p=e.length),g=e.window}else g=i,m=s-e.offset,p=e.length;p>l&&(p=l),l-=p,e.length-=p;do i[s++]=g[m++];while(--p);e.length===0&&(e.mode=Pae);break;case nWe:if(l===0)break e;i[s++]=e.length,l--,e.mode=Pae;break;case yEe:if(e.wrap){for(;h<32;){if(a===0)break e;a--,c|=r[n++]<<h,h+=8}if(d-=l,o.total_out+=d,e.total+=d,d&&(o.adler=e.check=e.flags?B3(e.check,i,d,s-d):TEe(e.check,i,d,s-d)),d=l,(e.flags?c:aWe(c))!==e.check){o.msg="incorrect data check",e.mode=c0;break}c=0,h=0}e.mode=oWe;case oWe:if(e.wrap&&e.flags){for(;h<32;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(c!==(e.total&4294967295)){o.msg="incorrect length check",e.mode=c0;break}c=0,h=0}e.mode=sWe;case sWe:_=P_t;break e;case c0:_=uWe;break e;case CEe:return IEe;case C_t:default:return OC}return o.next_out=s,o.avail_out=l,o.next_in=n,o.avail_in=a,e.hold=c,e.bits=h,(e.wsize||d!==o.avail_out&&e.mode<c0&&(e.mode<yEe||t!==FHe))&&yWe(o,o.output,o.next_out,d-o.avail_out)?(e.mode=CEe,IEe):(u-=o.avail_in,d-=o.avail_out,o.total_in+=u,o.total_out+=d,e.total+=d,e.wrap&&d&&(o.adler=e.check=e.flags?B3(e.check,i,d,o.next_out-d):TEe(e.check,i,d,o.next_out-d)),o.data_type=e.bits+(e.last?64:0)+(e.mode===I_?128:0)+(e.mode===bae||e.mode===gEe?256:0),(u===0&&d===0||t===FHe)&&_===M5&&(_=I_t),_)}function D_t(o){if(!o||!o.state)return OC;var t=o.state;return t.window&&(t.window=null),o.state=null,M5}function w_t(o,t){var e;return!o||!o.state||(e=o.state,(e.wrap&2)===0)?OC:(e.head=t,t.done=!1,M5)}function L_t(o,t){var e=t.length,r,i,n;return!o||!o.state||(r=o.state,r.wrap!==0&&r.mode!==Tae)?OC:r.mode===Tae&&(i=1,i=TEe(i,t,e,0),i!==r.check)?uWe:(n=yWe(o,t,e,e),n?(r.mode=CEe,IEe):(r.havedict=1,M5))}p9.inflateReset=fWe;p9.inflateReset2=mWe;p9.inflateResetKeep=pWe;p9.inflateInit=v_t;p9.inflateInit2=gWe;p9.inflate=R_t;p9.inflateEnd=D_t;p9.inflateGetHeader=w_t;p9.inflateSetDictionary=L_t;p9.inflateInfo="pako inflate (from Nodeca project)"});var SEe=Fp((PVn,PWe)=>{"use strict";PWe.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var IWe=Fp((TVn,TWe)=>{"use strict";function M_t(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}TWe.exports=M_t});var SWe=Fp(iq=>{"use strict";var UV=bWe(),rq=b_(),Iae=lEe(),Hf=SEe(),EEe=lae(),N_t=cEe(),k_t=IWe(),CWe=Object.prototype.toString;function N5(o){if(!(this instanceof N5))return new N5(o);this.options=rq.assign({chunkSize:16384,windowBits:0,to:""},o||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(o&&o.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new N_t,this.strm.avail_out=0;var e=UV.inflateInit2(this.strm,t.windowBits);if(e!==Hf.Z_OK)throw new Error(EEe[e]);if(this.header=new k_t,UV.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Iae.string2buf(t.dictionary):CWe.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=UV.inflateSetDictionary(this.strm,t.dictionary),e!==Hf.Z_OK)))throw new Error(EEe[e])}N5.prototype.push=function(o,t){var e=this.strm,r=this.options.chunkSize,i=this.options.dictionary,n,s,a,l,c,h=!1;if(this.ended)return!1;s=t===~~t?t:t===!0?Hf.Z_FINISH:Hf.Z_NO_FLUSH,typeof o=="string"?e.input=Iae.binstring2buf(o):CWe.call(o)==="[object ArrayBuffer]"?e.input=new Uint8Array(o):e.input=o,e.next_in=0,e.avail_in=e.input.length;do{if(e.avail_out===0&&(e.output=new rq.Buf8(r),e.next_out=0,e.avail_out=r),n=UV.inflate(e,Hf.Z_NO_FLUSH),n===Hf.Z_NEED_DICT&&i&&(n=UV.inflateSetDictionary(this.strm,i)),n===Hf.Z_BUF_ERROR&&h===!0&&(n=Hf.Z_OK,h=!1),n!==Hf.Z_STREAM_END&&n!==Hf.Z_OK)return this.onEnd(n),this.ended=!0,!1;e.next_out&&(e.avail_out===0||n===Hf.Z_STREAM_END||e.avail_in===0&&(s===Hf.Z_FINISH||s===Hf.Z_SYNC_FLUSH))&&(this.options.to==="string"?(a=Iae.utf8border(e.output,e.next_out),l=e.next_out-a,c=Iae.buf2string(e.output,a),e.next_out=l,e.avail_out=r-l,l&&rq.arraySet(e.output,e.output,a,l,0),this.onData(c)):this.onData(rq.shrinkBuf(e.output,e.next_out))),e.avail_in===0&&e.avail_out===0&&(h=!0)}while((e.avail_in>0||e.avail_out===0)&&n!==Hf.Z_STREAM_END);return n===Hf.Z_STREAM_END&&(s=Hf.Z_FINISH),s===Hf.Z_FINISH?(n=UV.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Hf.Z_OK):(s===Hf.Z_SYNC_FLUSH&&(this.onEnd(Hf.Z_OK),e.avail_out=0),!0)};N5.prototype.onData=function(o){this.chunks.push(o)};N5.prototype.onEnd=function(o){o===Hf.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=rq.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg};function OEe(o,t){var e=new N5(t);if(e.push(o,!0),e.err)throw e.msg||EEe[e.err];return e.result}function B_t(o,t){return t=t||{},t.raw=!0,OEe(o,t)}iq.Inflate=N5;iq.inflate=OEe;iq.inflateRaw=B_t;iq.ungzip=OEe});var AWe=Fp((CVn,OWe)=>{"use strict";var F_t=b_().assign,V_t=vHe(),G_t=SWe(),U_t=SEe(),EWe={};F_t(EWe,V_t,G_t,U_t);OWe.exports=EWe});var jD=Fp((qWe,wEe)=>{(function(o){typeof qWe=="object"&&typeof wEe<"u"?wEe.exports=o():typeof define=="function"&&define.amd?define([],o):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=o()})(function(){return(function o(t,e,r){function i(a,l){if(!e[a]){if(!t[a]){var c=typeof wd=="function"&&wd;if(!l&&c)return c(a,!0);if(n)return n(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var u=e[a]={exports:{}};t[a][0].call(u.exports,function(d){var p=t[a][1][d];return i(p||d)},u,u.exports,o,t,e,r)}return e[a].exports}for(var n=typeof wd=="function"&&wd,s=0;s<r.length;s++)i(r[s]);return i})({1:[function(o,t,e){"use strict";var r=o("./utils"),i=o("./support"),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.encode=function(s){for(var a,l,c,h,u,d,p,m=[],g=0,y=s.length,b=y,P=r.getTypeOf(s)!=="string";g<s.length;)b=y-g,c=P?(a=s[g++],l=g<y?s[g++]:0,g<y?s[g++]:0):(a=s.charCodeAt(g++),l=g<y?s.charCodeAt(g++):0,g<y?s.charCodeAt(g++):0),h=a>>2,u=(3&a)<<4|l>>4,d=1<b?(15&l)<<2|c>>6:64,p=2<b?63&c:64,m.push(n.charAt(h)+n.charAt(u)+n.charAt(d)+n.charAt(p));return m.join("")},e.decode=function(s){var a,l,c,h,u,d,p=0,m=0,g="data:";if(s.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var y,b=3*(s=s.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(s.charAt(s.length-1)===n.charAt(64)&&b--,s.charAt(s.length-2)===n.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(y=i.uint8array?new Uint8Array(0|b):new Array(0|b);p<s.length;)a=n.indexOf(s.charAt(p++))<<2|(h=n.indexOf(s.charAt(p++)))>>4,l=(15&h)<<4|(u=n.indexOf(s.charAt(p++)))>>2,c=(3&u)<<6|(d=n.indexOf(s.charAt(p++))),y[m++]=a,u!==64&&(y[m++]=l),d!==64&&(y[m++]=c);return y}},{"./support":30,"./utils":32}],2:[function(o,t,e){"use strict";var r=o("./external"),i=o("./stream/DataWorker"),n=o("./stream/Crc32Probe"),s=o("./stream/DataLengthProbe");function a(l,c,h,u,d){this.compressedSize=l,this.uncompressedSize=c,this.crc32=h,this.compression=u,this.compressedContent=d}a.prototype={getContentWorker:function(){var l=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),c=this;return l.on("end",function(){if(this.streamInfo.data_length!==c.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),l},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(l,c,h){return l.pipe(new n).pipe(new s("uncompressedSize")).pipe(c.compressWorker(h)).pipe(new s("compressedSize")).withStreamInfo("compression",c)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(o,t,e){"use strict";var r=o("./stream/GenericWorker");e.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},e.DEFLATE=o("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(o,t,e){"use strict";var r=o("./utils"),i=(function(){for(var n,s=[],a=0;a<256;a++){n=a;for(var l=0;l<8;l++)n=1&n?3988292384^n>>>1:n>>>1;s[a]=n}return s})();t.exports=function(n,s){return n!==void 0&&n.length?r.getTypeOf(n)!=="string"?(function(a,l,c,h){var u=i,d=h+c;a^=-1;for(var p=h;p<d;p++)a=a>>>8^u[255&(a^l[p])];return-1^a})(0|s,n,n.length,0):(function(a,l,c,h){var u=i,d=h+c;a^=-1;for(var p=h;p<d;p++)a=a>>>8^u[255&(a^l.charCodeAt(p))];return-1^a})(0|s,n,n.length,0):0}},{"./utils":32}],5:[function(o,t,e){"use strict";e.base64=!1,e.binary=!1,e.dir=!1,e.createFolders=!0,e.date=null,e.compression=null,e.compressionOptions=null,e.comment=null,e.unixPermissions=null,e.dosPermissions=null},{}],6:[function(o,t,e){"use strict";var r=null;r=typeof Promise<"u"?Promise:o("lie"),t.exports={Promise:r}},{lie:37}],7:[function(o,t,e){"use strict";var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=o("pako"),n=o("./utils"),s=o("./stream/GenericWorker"),a=r?"uint8array":"array";function l(c,h){s.call(this,"FlateWorker/"+c),this._pako=null,this._pakoAction=c,this._pakoOptions=h,this.meta={}}e.magic="\b\0",n.inherits(l,s),l.prototype.processChunk=function(c){this.meta=c.meta,this._pako===null&&this._createPako(),this._pako.push(n.transformTo(a,c.data),!1)},l.prototype.flush=function(){s.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var c=this;this._pako.onData=function(h){c.push({data:h,meta:c.meta})}},e.compressWorker=function(c){return new l("Deflate",c)},e.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(o,t,e){"use strict";function r(u,d){var p,m="";for(p=0;p<d;p++)m+=String.fromCharCode(255&u),u>>>=8;return m}function i(u,d,p,m,g,y){var b,P,T=u.file,I=u.compression,C=y!==a.utf8encode,E=n.transformTo("string",y(T.name)),O=n.transformTo("string",a.utf8encode(T.name)),_=T.comment,R=n.transformTo("string",y(_)),v=n.transformTo("string",a.utf8encode(_)),D=O.length!==T.name.length,w=v.length!==_.length,F="",H="",z="",G=T.dir,W=T.date,L={crc32:0,compressedSize:0,uncompressedSize:0};d&&!p||(L.crc32=u.crc32,L.compressedSize=u.compressedSize,L.uncompressedSize=u.uncompressedSize);var B=0;d&&(B|=8),C||!D&&!w||(B|=2048);var N=0,U=0;G&&(N|=16),g==="UNIX"?(U=798,N|=(function(V,Y){var X=V;return V||(X=Y?16893:33204),(65535&X)<<16})(T.unixPermissions,G)):(U=20,N|=(function(V){return 63&(V||0)})(T.dosPermissions)),b=W.getUTCHours(),b<<=6,b|=W.getUTCMinutes(),b<<=5,b|=W.getUTCSeconds()/2,P=W.getUTCFullYear()-1980,P<<=4,P|=W.getUTCMonth()+1,P<<=5,P|=W.getUTCDate(),D&&(H=r(1,1)+r(l(E),4)+O,F+="up"+r(H.length,2)+H),w&&(z=r(1,1)+r(l(R),4)+v,F+="uc"+r(z.length,2)+z);var k="";return k+=`
\0`,k+=r(B,2),k+=I.magic,k+=r(b,2),k+=r(P,2),k+=r(L.crc32,4),k+=r(L.compressedSize,4),k+=r(L.uncompressedSize,4),k+=r(E.length,2),k+=r(F.length,2),{fileRecord:c.LOCAL_FILE_HEADER+k+E+F,dirRecord:c.CENTRAL_FILE_HEADER+r(U,2)+k+r(R.length,2)+"\0\0\0\0"+r(N,4)+r(m,4)+E+F+R}}var n=o("../utils"),s=o("../stream/GenericWorker"),a=o("../utf8"),l=o("../crc32"),c=o("../signature");function h(u,d,p,m){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=p,this.encodeFileName=m,this.streamFiles=u,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}n.inherits(h,s),h.prototype.push=function(u){var d=u.meta.percent||0,p=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(u):(this.bytesWritten+=u.data.length,s.prototype.push.call(this,{data:u.data,meta:{currentFile:this.currentFile,percent:p?(d+100*(p-m-1))/p:100}}))},h.prototype.openedSource=function(u){this.currentSourceOffset=this.bytesWritten,this.currentFile=u.file.name;var d=this.streamFiles&&!u.file.dir;if(d){var p=i(u,d,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(u){this.accumulate=!1;var d=this.streamFiles&&!u.file.dir,p=i(u,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),d)this.push({data:(function(m){return c.DATA_DESCRIPTOR+r(m.crc32,4)+r(m.compressedSize,4)+r(m.uncompressedSize,4)})(u),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var u=this.bytesWritten,d=0;d<this.dirRecords.length;d++)this.push({data:this.dirRecords[d],meta:{percent:100}});var p=this.bytesWritten-u,m=(function(g,y,b,P,T){var I=n.transformTo("string",T(P));return c.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(g,2)+r(g,2)+r(y,4)+r(b,4)+r(I.length,2)+I})(this.dirRecords.length,p,u,this.zipComment,this.encodeFileName);this.push({data:m,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(u){this._sources.push(u);var d=this;return u.on("data",function(p){d.processChunk(p)}),u.on("end",function(){d.closedSource(d.previous.streamInfo),d._sources.length?d.prepareNextSource():d.end()}),u.on("error",function(p){d.error(p)}),this},h.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(u){var d=this._sources;if(!s.prototype.error.call(this,u))return!1;for(var p=0;p<d.length;p++)try{d[p].error(u)}catch{}return!0},h.prototype.lock=function(){s.prototype.lock.call(this);for(var u=this._sources,d=0;d<u.length;d++)u[d].lock()},t.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(o,t,e){"use strict";var r=o("../compressions"),i=o("./ZipFileWorker");e.generateWorker=function(n,s,a){var l=new i(s.streamFiles,a,s.platform,s.encodeFileName),c=0;try{n.forEach(function(h,u){c++;var d=(function(y,b){var P=y||b,T=r[P];if(!T)throw new Error(P+" is not a valid compression method !");return T})(u.options.compression,s.compression),p=u.options.compressionOptions||s.compressionOptions||{},m=u.dir,g=u.date;u._compressWorker(d,p).withStreamInfo("file",{name:h,dir:m,date:g,comment:u.comment||"",unixPermissions:u.unixPermissions,dosPermissions:u.dosPermissions}).pipe(l)}),l.entriesCount=c}catch(h){l.error(h)}return l}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(o,t,e){"use strict";function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new r;for(var n in this)typeof this[n]!="function"&&(i[n]=this[n]);return i}}(r.prototype=o("./object")).loadAsync=o("./load"),r.support=o("./support"),r.defaults=o("./defaults"),r.version="3.10.1",r.loadAsync=function(i,n){return new r().loadAsync(i,n)},r.external=o("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(o,t,e){"use strict";var r=o("./utils"),i=o("./external"),n=o("./utf8"),s=o("./zipEntries"),a=o("./stream/Crc32Probe"),l=o("./nodejsUtils");function c(h){return new i.Promise(function(u,d){var p=h.decompressed.getContentWorker().pipe(new a);p.on("error",function(m){d(m)}).on("end",function(){p.streamInfo.crc32!==h.decompressed.crc32?d(new Error("Corrupted zip : CRC32 mismatch")):u()}).resume()})}t.exports=function(h,u){var d=this;return u=r.extend(u||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:n.utf8decode}),l.isNode&&l.isStream(h)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",h,!0,u.optimizedBinaryString,u.base64).then(function(p){var m=new s(u);return m.load(p),m}).then(function(p){var m=[i.Promise.resolve(p)],g=p.files;if(u.checkCRC32)for(var y=0;y<g.length;y++)m.push(c(g[y]));return i.Promise.all(m)}).then(function(p){for(var m=p.shift(),g=m.files,y=0;y<g.length;y++){var b=g[y],P=b.fileNameStr,T=r.resolve(b.fileNameStr);d.file(T,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:u.createFolders}),b.dir||(d.file(T).unsafeOriginalName=P)}return m.zipComment.length&&(d.comment=m.zipComment),d})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(o,t,e){"use strict";var r=o("../utils"),i=o("../stream/GenericWorker");function n(s,a){i.call(this,"Nodejs stream input adapter for "+s),this._upstreamEnded=!1,this._bindStream(a)}r.inherits(n,i),n.prototype._bindStream=function(s){var a=this;(this._stream=s).pause(),s.on("data",function(l){a.push({data:l,meta:{percent:0}})}).on("error",function(l){a.isPaused?this.generatedError=l:a.error(l)}).on("end",function(){a.isPaused?a._upstreamEnded=!0:a.end()})},n.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},n.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=n},{"../stream/GenericWorker":28,"../utils":32}],13:[function(o,t,e){"use strict";var r=o("readable-stream").Readable;function i(n,s,a){r.call(this,s),this._helper=n;var l=this;n.on("data",function(c,h){l.push(c)||l._helper.pause(),a&&a(h)}).on("error",function(c){l.emit("error",c)}).on("end",function(){l.push(null)})}o("../utils").inherits(i,r),i.prototype._read=function(){this._helper.resume()},t.exports=i},{"../utils":32,"readable-stream":16}],14:[function(o,t,e){"use strict";t.exports={isNode:typeof Buffer<"u",newBufferFrom:function(r,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,i);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,i)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var i=new Buffer(r);return i.fill(0),i},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(o,t,e){"use strict";function r(T,I,C){var E,O=n.getTypeOf(I),_=n.extend(C||{},l);_.date=_.date||new Date,_.compression!==null&&(_.compression=_.compression.toUpperCase()),typeof _.unixPermissions=="string"&&(_.unixPermissions=parseInt(_.unixPermissions,8)),_.unixPermissions&&16384&_.unixPermissions&&(_.dir=!0),_.dosPermissions&&16&_.dosPermissions&&(_.dir=!0),_.dir&&(T=g(T)),_.createFolders&&(E=m(T))&&y.call(this,E,!0);var R=O==="string"&&_.binary===!1&&_.base64===!1;C&&C.binary!==void 0||(_.binary=!R),(I instanceof c&&I.uncompressedSize===0||_.dir||!I||I.length===0)&&(_.base64=!1,_.binary=!0,I="",_.compression="STORE",O="string");var v=null;v=I instanceof c||I instanceof s?I:d.isNode&&d.isStream(I)?new p(T,I):n.prepareContent(T,I,_.binary,_.optimizedBinaryString,_.base64);var D=new h(T,v,_);this.files[T]=D}var i=o("./utf8"),n=o("./utils"),s=o("./stream/GenericWorker"),a=o("./stream/StreamHelper"),l=o("./defaults"),c=o("./compressedObject"),h=o("./zipObject"),u=o("./generate"),d=o("./nodejsUtils"),p=o("./nodejs/NodejsStreamInputAdapter"),m=function(T){T.slice(-1)==="/"&&(T=T.substring(0,T.length-1));var I=T.lastIndexOf("/");return 0<I?T.substring(0,I):""},g=function(T){return T.slice(-1)!=="/"&&(T+="/"),T},y=function(T,I){return I=I!==void 0?I:l.createFolders,T=g(T),this.files[T]||r.call(this,T,null,{dir:!0,createFolders:I}),this.files[T]};function b(T){return Object.prototype.toString.call(T)==="[object RegExp]"}var P={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(T){var I,C,E;for(I in this.files)E=this.files[I],(C=I.slice(this.root.length,I.length))&&I.slice(0,this.root.length)===this.root&&T(C,E)},filter:function(T){var I=[];return this.forEach(function(C,E){T(C,E)&&I.push(E)}),I},file:function(T,I,C){if(arguments.length!==1)return T=this.root+T,r.call(this,T,I,C),this;if(b(T)){var E=T;return this.filter(function(_,R){return!R.dir&&E.test(_)})}var O=this.files[this.root+T];return O&&!O.dir?O:null},folder:function(T){if(!T)return this;if(b(T))return this.filter(function(O,_){return _.dir&&T.test(O)});var I=this.root+T,C=y.call(this,I),E=this.clone();return E.root=C.name,E},remove:function(T){T=this.root+T;var I=this.files[T];if(I||(T.slice(-1)!=="/"&&(T+="/"),I=this.files[T]),I&&!I.dir)delete this.files[T];else for(var C=this.filter(function(O,_){return _.name.slice(0,T.length)===T}),E=0;E<C.length;E++)delete this.files[C[E].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(T){var I,C={};try{if((C=n.extend(T||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=C.type.toLowerCase(),C.compression=C.compression.toUpperCase(),C.type==="binarystring"&&(C.type="string"),!C.type)throw new Error("No output type specified.");n.checkSupport(C.type),C.platform!=="darwin"&&C.platform!=="freebsd"&&C.platform!=="linux"&&C.platform!=="sunos"||(C.platform="UNIX"),C.platform==="win32"&&(C.platform="DOS");var E=C.comment||this.comment||"";I=u.generateWorker(this,C,E)}catch(O){(I=new s("error")).error(O)}return new a(I,C.type||"string",C.mimeType)},generateAsync:function(T,I){return this.generateInternalStream(T).accumulate(I)},generateNodeStream:function(T,I){return(T=T||{}).type||(T.type="nodebuffer"),this.generateInternalStream(T).toNodejsStream(I)}};t.exports=P},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(o,t,e){"use strict";t.exports=o("stream")},{stream:void 0}],17:[function(o,t,e){"use strict";var r=o("./DataReader");function i(n){r.call(this,n);for(var s=0;s<this.data.length;s++)n[s]=255&n[s]}o("../utils").inherits(i,r),i.prototype.byteAt=function(n){return this.data[this.zero+n]},i.prototype.lastIndexOfSignature=function(n){for(var s=n.charCodeAt(0),a=n.charCodeAt(1),l=n.charCodeAt(2),c=n.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===s&&this.data[h+1]===a&&this.data[h+2]===l&&this.data[h+3]===c)return h-this.zero;return-1},i.prototype.readAndCheckSignature=function(n){var s=n.charCodeAt(0),a=n.charCodeAt(1),l=n.charCodeAt(2),c=n.charCodeAt(3),h=this.readData(4);return s===h[0]&&a===h[1]&&l===h[2]&&c===h[3]},i.prototype.readData=function(n){if(this.checkOffset(n),n===0)return[];var s=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i},{"../utils":32,"./DataReader":18}],18:[function(o,t,e){"use strict";var r=o("../utils");function i(n){this.data=n,this.length=n.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(n){this.checkIndex(this.index+n)},checkIndex:function(n){if(this.length<this.zero+n||n<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+n+"). Corrupted zip ?")},setIndex:function(n){this.checkIndex(n),this.index=n},skip:function(n){this.setIndex(this.index+n)},byteAt:function(){},readInt:function(n){var s,a=0;for(this.checkOffset(n),s=this.index+n-1;s>=this.index;s--)a=(a<<8)+this.byteAt(s);return this.index+=n,a},readString:function(n){return r.transformTo("string",this.readData(n))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var n=this.readInt(4);return new Date(Date.UTC(1980+(n>>25&127),(n>>21&15)-1,n>>16&31,n>>11&31,n>>5&63,(31&n)<<1))}},t.exports=i},{"../utils":32}],19:[function(o,t,e){"use strict";var r=o("./Uint8ArrayReader");function i(n){r.call(this,n)}o("../utils").inherits(i,r),i.prototype.readData=function(n){this.checkOffset(n);var s=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(o,t,e){"use strict";var r=o("./DataReader");function i(n){r.call(this,n)}o("../utils").inherits(i,r),i.prototype.byteAt=function(n){return this.data.charCodeAt(this.zero+n)},i.prototype.lastIndexOfSignature=function(n){return this.data.lastIndexOf(n)-this.zero},i.prototype.readAndCheckSignature=function(n){return n===this.readData(4)},i.prototype.readData=function(n){this.checkOffset(n);var s=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(o,t,e){"use strict";var r=o("./ArrayReader");function i(n){r.call(this,n)}o("../utils").inherits(i,r),i.prototype.readData=function(n){if(this.checkOffset(n),n===0)return new Uint8Array(0);var s=this.data.subarray(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(o,t,e){"use strict";var r=o("../utils"),i=o("../support"),n=o("./ArrayReader"),s=o("./StringReader"),a=o("./NodeBufferReader"),l=o("./Uint8ArrayReader");t.exports=function(c){var h=r.getTypeOf(c);return r.checkSupport(h),h!=="string"||i.uint8array?h==="nodebuffer"?new a(c):i.uint8array?new l(r.transformTo("uint8array",c)):new n(r.transformTo("array",c)):new s(c)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(o,t,e){"use strict";e.LOCAL_FILE_HEADER="PK",e.CENTRAL_FILE_HEADER="PK",e.CENTRAL_DIRECTORY_END="PK",e.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",e.ZIP64_CENTRAL_DIRECTORY_END="PK",e.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(o,t,e){"use strict";var r=o("./GenericWorker"),i=o("../utils");function n(s){r.call(this,"ConvertWorker to "+s),this.destType=s}i.inherits(n,r),n.prototype.processChunk=function(s){this.push({data:i.transformTo(this.destType,s.data),meta:s.meta})},t.exports=n},{"../utils":32,"./GenericWorker":28}],25:[function(o,t,e){"use strict";var r=o("./GenericWorker"),i=o("../crc32");function n(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}o("../utils").inherits(n,r),n.prototype.processChunk=function(s){this.streamInfo.crc32=i(s.data,this.streamInfo.crc32||0),this.push(s)},t.exports=n},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(o,t,e){"use strict";var r=o("../utils"),i=o("./GenericWorker");function n(s){i.call(this,"DataLengthProbe for "+s),this.propName=s,this.withStreamInfo(s,0)}r.inherits(n,i),n.prototype.processChunk=function(s){if(s){var a=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=a+s.data.length}i.prototype.processChunk.call(this,s)},t.exports=n},{"../utils":32,"./GenericWorker":28}],27:[function(o,t,e){"use strict";var r=o("../utils"),i=o("./GenericWorker");function n(s){i.call(this,"DataWorker");var a=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,s.then(function(l){a.dataIsReady=!0,a.data=l,a.max=l&&l.length||0,a.type=r.getTypeOf(l),a.isPaused||a._tickAndRepeat()},function(l){a.error(l)})}r.inherits(n,i),n.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},n.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},n.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},n.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var s=null,a=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":s=this.data.substring(this.index,a);break;case"uint8array":s=this.data.subarray(this.index,a);break;case"array":case"nodebuffer":s=this.data.slice(this.index,a)}return this.index=a,this.push({data:s,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=n},{"../utils":32,"./GenericWorker":28}],28:[function(o,t,e){"use strict";function r(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,n){return this._listeners[i].push(n),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,n){if(this._listeners[i])for(var s=0;s<this._listeners[i].length;s++)this._listeners[i][s].call(this,n)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var n=this;return i.on("data",function(s){n.processChunk(s)}),i.on("end",function(){n.end()}),i.on("error",function(s){n.error(s)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,n){return this.extraStreamInfo[i]=n,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},t.exports=r},{}],29:[function(o,t,e){"use strict";var r=o("../utils"),i=o("./ConvertWorker"),n=o("./GenericWorker"),s=o("../base64"),a=o("../support"),l=o("../external"),c=null;if(a.nodestream)try{c=o("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(d,p){return new l.Promise(function(m,g){var y=[],b=d._internalType,P=d._outputType,T=d._mimeType;d.on("data",function(I,C){y.push(I),p&&p(C)}).on("error",function(I){y=[],g(I)}).on("end",function(){try{var I=(function(C,E,O){switch(C){case"blob":return r.newBlob(r.transformTo("arraybuffer",E),O);case"base64":return s.encode(E);default:return r.transformTo(C,E)}})(P,(function(C,E){var O,_=0,R=null,v=0;for(O=0;O<E.length;O++)v+=E[O].length;switch(C){case"string":return E.join("");case"array":return Array.prototype.concat.apply([],E);case"uint8array":for(R=new Uint8Array(v),O=0;O<E.length;O++)R.set(E[O],_),_+=E[O].length;return R;case"nodebuffer":return Buffer.concat(E);default:throw new Error("concat : unsupported type '"+C+"'")}})(b,y),T);m(I)}catch(C){g(C)}y=[]}).resume()})}function u(d,p,m){var g=p;switch(p){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=p,this._mimeType=m,r.checkSupport(g),this._worker=d.pipe(new i(g)),d.lock()}catch(y){this._worker=new n("error"),this._worker.error(y)}}u.prototype={accumulate:function(d){return h(this,d)},on:function(d,p){var m=this;return d==="data"?this._worker.on(d,function(g){p.call(m,g.data,g.meta)}):this._worker.on(d,function(){r.delay(p,arguments,m)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(d){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new c(this,{objectMode:this._outputType!=="nodebuffer"},d)}},t.exports=u},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(o,t,e){"use strict";if(e.base64=!0,e.array=!0,e.string=!0,e.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",e.nodebuffer=typeof Buffer<"u",e.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")e.blob=!1;else{var r=new ArrayBuffer(0);try{e.blob=new Blob([r],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),e.blob=i.getBlob("application/zip").size===0}catch{e.blob=!1}}}try{e.nodestream=!!o("readable-stream").Readable}catch{e.nodestream=!1}},{"readable-stream":16}],31:[function(o,t,e){"use strict";for(var r=o("./utils"),i=o("./support"),n=o("./nodejsUtils"),s=o("./stream/GenericWorker"),a=new Array(256),l=0;l<256;l++)a[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;a[254]=a[254]=1;function c(){s.call(this,"utf-8 decode"),this.leftOver=null}function h(){s.call(this,"utf-8 encode")}e.utf8encode=function(u){return i.nodebuffer?n.newBufferFrom(u,"utf-8"):(function(d){var p,m,g,y,b,P=d.length,T=0;for(y=0;y<P;y++)(64512&(m=d.charCodeAt(y)))==55296&&y+1<P&&(64512&(g=d.charCodeAt(y+1)))==56320&&(m=65536+(m-55296<<10)+(g-56320),y++),T+=m<128?1:m<2048?2:m<65536?3:4;for(p=i.uint8array?new Uint8Array(T):new Array(T),y=b=0;b<T;y++)(64512&(m=d.charCodeAt(y)))==55296&&y+1<P&&(64512&(g=d.charCodeAt(y+1)))==56320&&(m=65536+(m-55296<<10)+(g-56320),y++),m<128?p[b++]=m:(m<2048?p[b++]=192|m>>>6:(m<65536?p[b++]=224|m>>>12:(p[b++]=240|m>>>18,p[b++]=128|m>>>12&63),p[b++]=128|m>>>6&63),p[b++]=128|63&m);return p})(u)},e.utf8decode=function(u){return i.nodebuffer?r.transformTo("nodebuffer",u).toString("utf-8"):(function(d){var p,m,g,y,b=d.length,P=new Array(2*b);for(p=m=0;p<b;)if((g=d[p++])<128)P[m++]=g;else if(4<(y=a[g]))P[m++]=65533,p+=y-1;else{for(g&=y===2?31:y===3?15:7;1<y&&p<b;)g=g<<6|63&d[p++],y--;1<y?P[m++]=65533:g<65536?P[m++]=g:(g-=65536,P[m++]=55296|g>>10&1023,P[m++]=56320|1023&g)}return P.length!==m&&(P.subarray?P=P.subarray(0,m):P.length=m),r.applyFromCharCode(P)})(u=r.transformTo(i.uint8array?"uint8array":"array",u))},r.inherits(c,s),c.prototype.processChunk=function(u){var d=r.transformTo(i.uint8array?"uint8array":"array",u.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var p=d;(d=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),d.set(p,this.leftOver.length)}else d=this.leftOver.concat(d);this.leftOver=null}var m=(function(y,b){var P;for((b=b||y.length)>y.length&&(b=y.length),P=b-1;0<=P&&(192&y[P])==128;)P--;return P<0||P===0?b:P+a[y[P]]>b?P:b})(d),g=d;m!==d.length&&(i.uint8array?(g=d.subarray(0,m),this.leftOver=d.subarray(m,d.length)):(g=d.slice(0,m),this.leftOver=d.slice(m,d.length))),this.push({data:e.utf8decode(g),meta:u.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:e.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},e.Utf8DecodeWorker=c,r.inherits(h,s),h.prototype.processChunk=function(u){this.push({data:e.utf8encode(u.data),meta:u.meta})},e.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(o,t,e){"use strict";var r=o("./support"),i=o("./base64"),n=o("./nodejsUtils"),s=o("./external");function a(p){return p}function l(p,m){for(var g=0;g<p.length;++g)m[g]=255&p.charCodeAt(g);return m}o("setimmediate"),e.newBlob=function(p,m){e.checkSupport("blob");try{return new Blob([p],{type:m})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(p),g.getBlob(m)}catch{throw new Error("Bug : can't construct the Blob.")}}};var c={stringifyByChunk:function(p,m,g){var y=[],b=0,P=p.length;if(P<=g)return String.fromCharCode.apply(null,p);for(;b<P;)m==="array"||m==="nodebuffer"?y.push(String.fromCharCode.apply(null,p.slice(b,Math.min(b+g,P)))):y.push(String.fromCharCode.apply(null,p.subarray(b,Math.min(b+g,P)))),b+=g;return y.join("")},stringifyByChar:function(p){for(var m="",g=0;g<p.length;g++)m+=String.fromCharCode(p[g]);return m},applyCanBeUsed:{uint8array:(function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,n.allocBuffer(1)).length===1}catch{return!1}})()}};function h(p){var m=65536,g=e.getTypeOf(p),y=!0;if(g==="uint8array"?y=c.applyCanBeUsed.uint8array:g==="nodebuffer"&&(y=c.applyCanBeUsed.nodebuffer),y)for(;1<m;)try{return c.stringifyByChunk(p,g,m)}catch{m=Math.floor(m/2)}return c.stringifyByChar(p)}function u(p,m){for(var g=0;g<p.length;g++)m[g]=p[g];return m}e.applyFromCharCode=h;var d={};d.string={string:a,array:function(p){return l(p,new Array(p.length))},arraybuffer:function(p){return d.string.uint8array(p).buffer},uint8array:function(p){return l(p,new Uint8Array(p.length))},nodebuffer:function(p){return l(p,n.allocBuffer(p.length))}},d.array={string:h,array:a,arraybuffer:function(p){return new Uint8Array(p).buffer},uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return n.newBufferFrom(p)}},d.arraybuffer={string:function(p){return h(new Uint8Array(p))},array:function(p){return u(new Uint8Array(p),new Array(p.byteLength))},arraybuffer:a,uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return n.newBufferFrom(new Uint8Array(p))}},d.uint8array={string:h,array:function(p){return u(p,new Array(p.length))},arraybuffer:function(p){return p.buffer},uint8array:a,nodebuffer:function(p){return n.newBufferFrom(p)}},d.nodebuffer={string:h,array:function(p){return u(p,new Array(p.length))},arraybuffer:function(p){return d.nodebuffer.uint8array(p).buffer},uint8array:function(p){return u(p,new Uint8Array(p.length))},nodebuffer:a},e.transformTo=function(p,m){if(m=m||"",!p)return m;e.checkSupport(p);var g=e.getTypeOf(m);return d[g][p](m)},e.resolve=function(p){for(var m=p.split("/"),g=[],y=0;y<m.length;y++){var b=m[y];b==="."||b===""&&y!==0&&y!==m.length-1||(b===".."?g.pop():g.push(b))}return g.join("/")},e.getTypeOf=function(p){return typeof p=="string"?"string":Object.prototype.toString.call(p)==="[object Array]"?"array":r.nodebuffer&&n.isBuffer(p)?"nodebuffer":r.uint8array&&p instanceof Uint8Array?"uint8array":r.arraybuffer&&p instanceof ArrayBuffer?"arraybuffer":void 0},e.checkSupport=function(p){if(!r[p.toLowerCase()])throw new Error(p+" is not supported by this platform")},e.MAX_VALUE_16BITS=65535,e.MAX_VALUE_32BITS=-1,e.pretty=function(p){var m,g,y="";for(g=0;g<(p||"").length;g++)y+="\\x"+((m=p.charCodeAt(g))<16?"0":"")+m.toString(16).toUpperCase();return y},e.delay=function(p,m,g){setImmediate(function(){p.apply(g||null,m||[])})},e.inherits=function(p,m){function g(){}g.prototype=m.prototype,p.prototype=new g},e.extend=function(){var p,m,g={};for(p=0;p<arguments.length;p++)for(m in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],m)&&g[m]===void 0&&(g[m]=arguments[p][m]);return g},e.prepareContent=function(p,m,g,y,b){return s.Promise.resolve(m).then(function(P){return r.blob&&(P instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(P))!==-1)&&typeof FileReader<"u"?new s.Promise(function(T,I){var C=new FileReader;C.onload=function(E){T(E.target.result)},C.onerror=function(E){I(E.target.error)},C.readAsArrayBuffer(P)}):P}).then(function(P){var T=e.getTypeOf(P);return T?(T==="arraybuffer"?P=e.transformTo("uint8array",P):T==="string"&&(b?P=i.decode(P):g&&y!==!0&&(P=(function(I){return l(I,r.uint8array?new Uint8Array(I.length):new Array(I.length))})(P))),P):s.Promise.reject(new Error("Can't read the data of '"+p+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(o,t,e){"use strict";var r=o("./reader/readerFor"),i=o("./utils"),n=o("./signature"),s=o("./zipEntry"),a=o("./support");function l(c){this.files=[],this.loadOptions=c}l.prototype={checkSignature:function(c){if(!this.reader.readAndCheckSignature(c)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(h)+", expected "+i.pretty(c)+")")}},isSignature:function(c,h){var u=this.reader.index;this.reader.setIndex(c);var d=this.reader.readString(4)===h;return this.reader.setIndex(u),d},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var c=this.reader.readData(this.zipCommentLength),h=a.uint8array?"uint8array":"array",u=i.transformTo(h,c);this.zipComment=this.loadOptions.decodeFileName(u)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var c,h,u,d=this.zip64EndOfCentralSize-44;0<d;)c=this.reader.readInt(2),h=this.reader.readInt(4),u=this.reader.readData(h),this.zip64ExtensibleData[c]={id:c,length:h,value:u}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var c,h;for(c=0;c<this.files.length;c++)h=this.files[c],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(n.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var c;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(n.CENTRAL_FILE_HEADER);)(c=new s({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(c);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var c=this.reader.lastIndexOfSignature(n.CENTRAL_DIRECTORY_END);if(c<0)throw this.isSignature(0,n.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(c);var h=c;if(this.checkSignature(n.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(c=this.reader.lastIndexOfSignature(n.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(c),this.checkSignature(n.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,n.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(n.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(n.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var u=this.centralDirOffset+this.centralDirSize;this.zip64&&(u+=20,u+=12+this.zip64EndOfCentralSize);var d=h-u;if(0<d)this.isSignature(h,n.CENTRAL_FILE_HEADER)||(this.reader.zero=d);else if(d<0)throw new Error("Corrupted zip: missing "+Math.abs(d)+" bytes.")},prepareReader:function(c){this.reader=r(c)},load:function(c){this.prepareReader(c),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=l},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(o,t,e){"use strict";var r=o("./reader/readerFor"),i=o("./utils"),n=o("./compressedObject"),s=o("./crc32"),a=o("./utf8"),l=o("./compressions"),c=o("./support");function h(u,d){this.options=u,this.loadOptions=d}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(u){var d,p;if(u.skip(22),this.fileNameLength=u.readInt(2),p=u.readInt(2),this.fileName=u.readData(this.fileNameLength),u.skip(p),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((d=(function(m){for(var g in l)if(Object.prototype.hasOwnProperty.call(l,g)&&l[g].magic===m)return l[g];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new n(this.compressedSize,this.uncompressedSize,this.crc32,d,u.readData(this.compressedSize))},readCentralPart:function(u){this.versionMadeBy=u.readInt(2),u.skip(2),this.bitFlag=u.readInt(2),this.compressionMethod=u.readString(2),this.date=u.readDate(),this.crc32=u.readInt(4),this.compressedSize=u.readInt(4),this.uncompressedSize=u.readInt(4);var d=u.readInt(2);if(this.extraFieldsLength=u.readInt(2),this.fileCommentLength=u.readInt(2),this.diskNumberStart=u.readInt(2),this.internalFileAttributes=u.readInt(2),this.externalFileAttributes=u.readInt(4),this.localHeaderOffset=u.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");u.skip(d),this.readExtraFields(u),this.parseZIP64ExtraField(u),this.fileComment=u.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var u=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),u==0&&(this.dosPermissions=63&this.externalFileAttributes),u==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var u=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=u.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=u.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=u.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=u.readInt(4))}},readExtraFields:function(u){var d,p,m,g=u.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});u.index+4<g;)d=u.readInt(2),p=u.readInt(2),m=u.readData(p),this.extraFields[d]={id:d,length:p,value:m};u.setIndex(g)},handleUTF8:function(){var u=c.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var d=this.findExtraFieldUnicodePath();if(d!==null)this.fileNameStr=d;else{var p=i.transformTo(u,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(p)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var g=i.transformTo(u,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var u=this.extraFields[28789];if(u){var d=r(u.value);return d.readInt(1)!==1||s(this.fileName)!==d.readInt(4)?null:a.utf8decode(d.readData(u.length-5))}return null},findExtraFieldUnicodeComment:function(){var u=this.extraFields[25461];if(u){var d=r(u.value);return d.readInt(1)!==1||s(this.fileComment)!==d.readInt(4)?null:a.utf8decode(d.readData(u.length-5))}return null}},t.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(o,t,e){"use strict";function r(d,p,m){this.name=d,this.dir=m.dir,this.date=m.date,this.comment=m.comment,this.unixPermissions=m.unixPermissions,this.dosPermissions=m.dosPermissions,this._data=p,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var i=o("./stream/StreamHelper"),n=o("./stream/DataWorker"),s=o("./utf8"),a=o("./compressedObject"),l=o("./stream/GenericWorker");r.prototype={internalStream:function(d){var p=null,m="string";try{if(!d)throw new Error("No output type specified.");var g=(m=d.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),p=this._decompressWorker();var y=!this._dataBinary;y&&!g&&(p=p.pipe(new s.Utf8EncodeWorker)),!y&&g&&(p=p.pipe(new s.Utf8DecodeWorker))}catch(b){(p=new l("error")).error(b)}return new i(p,m,"")},async:function(d,p){return this.internalStream(d).accumulate(p)},nodeStream:function(d,p){return this.internalStream(d||"nodebuffer").toNodejsStream(p)},_compressWorker:function(d,p){if(this._data instanceof a&&this._data.compression.magic===d.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new s.Utf8EncodeWorker)),a.createWorkerFrom(m,d,p)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof l?this._data:new n(this._data)}};for(var c=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u<c.length;u++)r.prototype[c[u]]=h;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(o,t,e){(function(r){"use strict";var i,n,s=r.MutationObserver||r.WebKitMutationObserver;if(s){var a=0,l=new s(d),c=r.document.createTextNode("");l.observe(c,{characterData:!0}),i=function(){c.data=a=++a%2}}else if(r.setImmediate||r.MessageChannel===void 0)i="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var p=r.document.createElement("script");p.onreadystatechange=function(){d(),p.onreadystatechange=null,p.parentNode.removeChild(p),p=null},r.document.documentElement.appendChild(p)}:function(){setTimeout(d,0)};else{var h=new r.MessageChannel;h.port1.onmessage=d,i=function(){h.port2.postMessage(0)}}var u=[];function d(){var p,m;n=!0;for(var g=u.length;g;){for(m=u,u=[],p=-1;++p<g;)m[p]();g=u.length}n=!1}t.exports=function(p){u.push(p)!==1||n||i()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(o,t,e){"use strict";var r=o("immediate");function i(){}var n={},s=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function c(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,g!==i&&p(this,g)}function h(g,y,b){this.promise=g,typeof y=="function"&&(this.onFulfilled=y,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function u(g,y,b){r(function(){var P;try{P=y(b)}catch(T){return n.reject(g,T)}P===g?n.reject(g,new TypeError("Cannot resolve promise with itself")):n.resolve(g,P)})}function d(g){var y=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof y=="function")return function(){y.apply(g,arguments)}}function p(g,y){var b=!1;function P(C){b||(b=!0,n.reject(g,C))}function T(C){b||(b=!0,n.resolve(g,C))}var I=m(function(){y(T,P)});I.status==="error"&&P(I.value)}function m(g,y){var b={};try{b.value=g(y),b.status="success"}catch(P){b.status="error",b.value=P}return b}(t.exports=c).prototype.finally=function(g){if(typeof g!="function")return this;var y=this.constructor;return this.then(function(b){return y.resolve(g()).then(function(){return b})},function(b){return y.resolve(g()).then(function(){throw b})})},c.prototype.catch=function(g){return this.then(null,g)},c.prototype.then=function(g,y){if(typeof g!="function"&&this.state===a||typeof y!="function"&&this.state===s)return this;var b=new this.constructor(i);return this.state!==l?u(b,this.state===a?g:y,this.outcome):this.queue.push(new h(b,g,y)),b},h.prototype.callFulfilled=function(g){n.resolve(this.promise,g)},h.prototype.otherCallFulfilled=function(g){u(this.promise,this.onFulfilled,g)},h.prototype.callRejected=function(g){n.reject(this.promise,g)},h.prototype.otherCallRejected=function(g){u(this.promise,this.onRejected,g)},n.resolve=function(g,y){var b=m(d,y);if(b.status==="error")return n.reject(g,b.value);var P=b.value;if(P)p(g,P);else{g.state=a,g.outcome=y;for(var T=-1,I=g.queue.length;++T<I;)g.queue[T].callFulfilled(y)}return g},n.reject=function(g,y){g.state=s,g.outcome=y;for(var b=-1,P=g.queue.length;++b<P;)g.queue[b].callRejected(y);return g},c.resolve=function(g){return g instanceof this?g:n.resolve(new this(i),g)},c.reject=function(g){var y=new this(i);return n.reject(y,g)},c.all=function(g){var y=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=g.length,P=!1;if(!b)return this.resolve([]);for(var T=new Array(b),I=0,C=-1,E=new this(i);++C<b;)O(g[C],C);return E;function O(_,R){y.resolve(_).then(function(v){T[R]=v,++I!==b||P||(P=!0,n.resolve(E,T))},function(v){P||(P=!0,n.reject(E,v))})}},c.race=function(g){var y=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=g.length,P=!1;if(!b)return this.resolve([]);for(var T=-1,I=new this(i);++T<b;)C=g[T],y.resolve(C).then(function(E){P||(P=!0,n.resolve(I,E))},function(E){P||(P=!0,n.reject(I,E))});var C;return I}},{immediate:36}],38:[function(o,t,e){"use strict";var r={};(0,o("./lib/utils/common").assign)(r,o("./lib/deflate"),o("./lib/inflate"),o("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(o,t,e){"use strict";var r=o("./zlib/deflate"),i=o("./utils/common"),n=o("./utils/strings"),s=o("./zlib/messages"),a=o("./zlib/zstream"),l=Object.prototype.toString,c=0,h=-1,u=0,d=8;function p(g){if(!(this instanceof p))return new p(g);this.options=i.assign({level:h,method:d,chunkSize:16384,windowBits:15,memLevel:8,strategy:u,to:""},g||{});var y=this.options;y.raw&&0<y.windowBits?y.windowBits=-y.windowBits:y.gzip&&0<y.windowBits&&y.windowBits<16&&(y.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var b=r.deflateInit2(this.strm,y.level,y.method,y.windowBits,y.memLevel,y.strategy);if(b!==c)throw new Error(s[b]);if(y.header&&r.deflateSetHeader(this.strm,y.header),y.dictionary){var P;if(P=typeof y.dictionary=="string"?n.string2buf(y.dictionary):l.call(y.dictionary)==="[object ArrayBuffer]"?new Uint8Array(y.dictionary):y.dictionary,(b=r.deflateSetDictionary(this.strm,P))!==c)throw new Error(s[b]);this._dict_set=!0}}function m(g,y){var b=new p(y);if(b.push(g,!0),b.err)throw b.msg||s[b.err];return b.result}p.prototype.push=function(g,y){var b,P,T=this.strm,I=this.options.chunkSize;if(this.ended)return!1;P=y===~~y?y:y===!0?4:0,typeof g=="string"?T.input=n.string2buf(g):l.call(g)==="[object ArrayBuffer]"?T.input=new Uint8Array(g):T.input=g,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new i.Buf8(I),T.next_out=0,T.avail_out=I),(b=r.deflate(T,P))!==1&&b!==c)return this.onEnd(b),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||P!==4&&P!==2)||(this.options.to==="string"?this.onData(n.buf2binstring(i.shrinkBuf(T.output,T.next_out))):this.onData(i.shrinkBuf(T.output,T.next_out)))}while((0<T.avail_in||T.avail_out===0)&&b!==1);return P===4?(b=r.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===c):P!==2||(this.onEnd(c),!(T.avail_out=0))},p.prototype.onData=function(g){this.chunks.push(g)},p.prototype.onEnd=function(g){g===c&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},e.Deflate=p,e.deflate=m,e.deflateRaw=function(g,y){return(y=y||{}).raw=!0,m(g,y)},e.gzip=function(g,y){return(y=y||{}).gzip=!0,m(g,y)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(o,t,e){"use strict";var r=o("./zlib/inflate"),i=o("./utils/common"),n=o("./utils/strings"),s=o("./zlib/constants"),a=o("./zlib/messages"),l=o("./zlib/zstream"),c=o("./zlib/gzheader"),h=Object.prototype.toString;function u(p){if(!(this instanceof u))return new u(p);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},p||{});var m=this.options;m.raw&&0<=m.windowBits&&m.windowBits<16&&(m.windowBits=-m.windowBits,m.windowBits===0&&(m.windowBits=-15)),!(0<=m.windowBits&&m.windowBits<16)||p&&p.windowBits||(m.windowBits+=32),15<m.windowBits&&m.windowBits<48&&(15&m.windowBits)==0&&(m.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var g=r.inflateInit2(this.strm,m.windowBits);if(g!==s.Z_OK)throw new Error(a[g]);this.header=new c,r.inflateGetHeader(this.strm,this.header)}function d(p,m){var g=new u(m);if(g.push(p,!0),g.err)throw g.msg||a[g.err];return g.result}u.prototype.push=function(p,m){var g,y,b,P,T,I,C=this.strm,E=this.options.chunkSize,O=this.options.dictionary,_=!1;if(this.ended)return!1;y=m===~~m?m:m===!0?s.Z_FINISH:s.Z_NO_FLUSH,typeof p=="string"?C.input=n.binstring2buf(p):h.call(p)==="[object ArrayBuffer]"?C.input=new Uint8Array(p):C.input=p,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new i.Buf8(E),C.next_out=0,C.avail_out=E),(g=r.inflate(C,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&O&&(I=typeof O=="string"?n.string2buf(O):h.call(O)==="[object ArrayBuffer]"?new Uint8Array(O):O,g=r.inflateSetDictionary(this.strm,I)),g===s.Z_BUF_ERROR&&_===!0&&(g=s.Z_OK,_=!1),g!==s.Z_STREAM_END&&g!==s.Z_OK)return this.onEnd(g),!(this.ended=!0);C.next_out&&(C.avail_out!==0&&g!==s.Z_STREAM_END&&(C.avail_in!==0||y!==s.Z_FINISH&&y!==s.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=n.utf8border(C.output,C.next_out),P=C.next_out-b,T=n.buf2string(C.output,b),C.next_out=P,C.avail_out=E-P,P&&i.arraySet(C.output,C.output,b,P,0),this.onData(T)):this.onData(i.shrinkBuf(C.output,C.next_out)))),C.avail_in===0&&C.avail_out===0&&(_=!0)}while((0<C.avail_in||C.avail_out===0)&&g!==s.Z_STREAM_END);return g===s.Z_STREAM_END&&(y=s.Z_FINISH),y===s.Z_FINISH?(g=r.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===s.Z_OK):y!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),!(C.avail_out=0))},u.prototype.onData=function(p){this.chunks.push(p)},u.prototype.onEnd=function(p){p===s.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},e.Inflate=u,e.inflate=d,e.inflateRaw=function(p,m){return(m=m||{}).raw=!0,d(p,m)},e.ungzip=d},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(o,t,e){"use strict";var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";e.assign=function(s){for(var a=Array.prototype.slice.call(arguments,1);a.length;){var l=a.shift();if(l){if(typeof l!="object")throw new TypeError(l+"must be non-object");for(var c in l)l.hasOwnProperty(c)&&(s[c]=l[c])}}return s},e.shrinkBuf=function(s,a){return s.length===a?s:s.subarray?s.subarray(0,a):(s.length=a,s)};var i={arraySet:function(s,a,l,c,h){if(a.subarray&&s.subarray)s.set(a.subarray(l,l+c),h);else for(var u=0;u<c;u++)s[h+u]=a[l+u]},flattenChunks:function(s){var a,l,c,h,u,d;for(a=c=0,l=s.length;a<l;a++)c+=s[a].length;for(d=new Uint8Array(c),a=h=0,l=s.length;a<l;a++)u=s[a],d.set(u,h),h+=u.length;return d}},n={arraySet:function(s,a,l,c,h){for(var u=0;u<c;u++)s[h+u]=a[l+u]},flattenChunks:function(s){return[].concat.apply([],s)}};e.setTyped=function(s){s?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,i)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,n))},e.setTyped(r)},{}],42:[function(o,t,e){"use strict";var r=o("./common"),i=!0,n=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{n=!1}for(var s=new r.Buf8(256),a=0;a<256;a++)s[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function l(c,h){if(h<65537&&(c.subarray&&n||!c.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(c,h));for(var u="",d=0;d<h;d++)u+=String.fromCharCode(c[d]);return u}s[254]=s[254]=1,e.string2buf=function(c){var h,u,d,p,m,g=c.length,y=0;for(p=0;p<g;p++)(64512&(u=c.charCodeAt(p)))==55296&&p+1<g&&(64512&(d=c.charCodeAt(p+1)))==56320&&(u=65536+(u-55296<<10)+(d-56320),p++),y+=u<128?1:u<2048?2:u<65536?3:4;for(h=new r.Buf8(y),p=m=0;m<y;p++)(64512&(u=c.charCodeAt(p)))==55296&&p+1<g&&(64512&(d=c.charCodeAt(p+1)))==56320&&(u=65536+(u-55296<<10)+(d-56320),p++),u<128?h[m++]=u:(u<2048?h[m++]=192|u>>>6:(u<65536?h[m++]=224|u>>>12:(h[m++]=240|u>>>18,h[m++]=128|u>>>12&63),h[m++]=128|u>>>6&63),h[m++]=128|63&u);return h},e.buf2binstring=function(c){return l(c,c.length)},e.binstring2buf=function(c){for(var h=new r.Buf8(c.length),u=0,d=h.length;u<d;u++)h[u]=c.charCodeAt(u);return h},e.buf2string=function(c,h){var u,d,p,m,g=h||c.length,y=new Array(2*g);for(u=d=0;u<g;)if((p=c[u++])<128)y[d++]=p;else if(4<(m=s[p]))y[d++]=65533,u+=m-1;else{for(p&=m===2?31:m===3?15:7;1<m&&u<g;)p=p<<6|63&c[u++],m--;1<m?y[d++]=65533:p<65536?y[d++]=p:(p-=65536,y[d++]=55296|p>>10&1023,y[d++]=56320|1023&p)}return l(y,d)},e.utf8border=function(c,h){var u;for((h=h||c.length)>c.length&&(h=c.length),u=h-1;0<=u&&(192&c[u])==128;)u--;return u<0||u===0?h:u+s[c[u]]>h?u:h}},{"./common":41}],43:[function(o,t,e){"use strict";t.exports=function(r,i,n,s){for(var a=65535&r|0,l=r>>>16&65535|0,c=0;n!==0;){for(n-=c=2e3<n?2e3:n;l=l+(a=a+i[s++]|0)|0,--c;);a%=65521,l%=65521}return a|l<<16|0}},{}],44:[function(o,t,e){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(o,t,e){"use strict";var r=(function(){for(var i,n=[],s=0;s<256;s++){i=s;for(var a=0;a<8;a++)i=1&i?3988292384^i>>>1:i>>>1;n[s]=i}return n})();t.exports=function(i,n,s,a){var l=r,c=a+s;i^=-1;for(var h=a;h<c;h++)i=i>>>8^l[255&(i^n[h])];return-1^i}},{}],46:[function(o,t,e){"use strict";var r,i=o("../utils/common"),n=o("./trees"),s=o("./adler32"),a=o("./crc32"),l=o("./messages"),c=0,h=4,u=0,d=-2,p=-1,m=4,g=2,y=8,b=9,P=286,T=30,I=19,C=2*P+1,E=15,O=3,_=258,R=_+O+1,v=42,D=113,w=1,F=2,H=3,z=4;function G(K,me){return K.msg=l[me],me}function W(K){return(K<<1)-(4<K?9:0)}function L(K){for(var me=K.length;0<=--me;)K[me]=0}function B(K){var me=K.state,Oe=me.pending;Oe>K.avail_out&&(Oe=K.avail_out),Oe!==0&&(i.arraySet(K.output,me.pending_buf,me.pending_out,Oe,K.next_out),K.next_out+=Oe,me.pending_out+=Oe,K.total_out+=Oe,K.avail_out-=Oe,me.pending-=Oe,me.pending===0&&(me.pending_out=0))}function N(K,me){n._tr_flush_block(K,0<=K.block_start?K.block_start:-1,K.strstart-K.block_start,me),K.block_start=K.strstart,B(K.strm)}function U(K,me){K.pending_buf[K.pending++]=me}function k(K,me){K.pending_buf[K.pending++]=me>>>8&255,K.pending_buf[K.pending++]=255&me}function V(K,me){var Oe,Ie,ue=K.max_chain_length,Pe=K.strstart,j=K.prev_length,J=K.nice_match,oe=K.strstart>K.w_size-R?K.strstart-(K.w_size-R):0,pe=K.window,ge=K.w_mask,Se=K.prev,De=K.strstart+_,tt=pe[Pe+j-1],Ze=pe[Pe+j];K.prev_length>=K.good_match&&(ue>>=2),J>K.lookahead&&(J=K.lookahead);do if(pe[(Oe=me)+j]===Ze&&pe[Oe+j-1]===tt&&pe[Oe]===pe[Pe]&&pe[++Oe]===pe[Pe+1]){Pe+=2,Oe++;do;while(pe[++Pe]===pe[++Oe]&&pe[++Pe]===pe[++Oe]&&pe[++Pe]===pe[++Oe]&&pe[++Pe]===pe[++Oe]&&pe[++Pe]===pe[++Oe]&&pe[++Pe]===pe[++Oe]&&pe[++Pe]===pe[++Oe]&&pe[++Pe]===pe[++Oe]&&Pe<De);if(Ie=_-(De-Pe),Pe=De-_,j<Ie){if(K.match_start=me,J<=(j=Ie))break;tt=pe[Pe+j-1],Ze=pe[Pe+j]}}while((me=Se[me&ge])>oe&&--ue!=0);return j<=K.lookahead?j:K.lookahead}function Y(K){var me,Oe,Ie,ue,Pe,j,J,oe,pe,ge,Se=K.w_size;do{if(ue=K.window_size-K.lookahead-K.strstart,K.strstart>=Se+(Se-R)){for(i.arraySet(K.window,K.window,Se,Se,0),K.match_start-=Se,K.strstart-=Se,K.block_start-=Se,me=Oe=K.hash_size;Ie=K.head[--me],K.head[me]=Se<=Ie?Ie-Se:0,--Oe;);for(me=Oe=Se;Ie=K.prev[--me],K.prev[me]=Se<=Ie?Ie-Se:0,--Oe;);ue+=Se}if(K.strm.avail_in===0)break;if(j=K.strm,J=K.window,oe=K.strstart+K.lookahead,pe=ue,ge=void 0,ge=j.avail_in,pe<ge&&(ge=pe),Oe=ge===0?0:(j.avail_in-=ge,i.arraySet(J,j.input,j.next_in,ge,oe),j.state.wrap===1?j.adler=s(j.adler,J,ge,oe):j.state.wrap===2&&(j.adler=a(j.adler,J,ge,oe)),j.next_in+=ge,j.total_in+=ge,ge),K.lookahead+=Oe,K.lookahead+K.insert>=O)for(Pe=K.strstart-K.insert,K.ins_h=K.window[Pe],K.ins_h=(K.ins_h<<K.hash_shift^K.window[Pe+1])&K.hash_mask;K.insert&&(K.ins_h=(K.ins_h<<K.hash_shift^K.window[Pe+O-1])&K.hash_mask,K.prev[Pe&K.w_mask]=K.head[K.ins_h],K.head[K.ins_h]=Pe,Pe++,K.insert--,!(K.lookahead+K.insert<O)););}while(K.lookahead<R&&K.strm.avail_in!==0)}function X(K,me){for(var Oe,Ie;;){if(K.lookahead<R){if(Y(K),K.lookahead<R&&me===c)return w;if(K.lookahead===0)break}if(Oe=0,K.lookahead>=O&&(K.ins_h=(K.ins_h<<K.hash_shift^K.window[K.strstart+O-1])&K.hash_mask,Oe=K.prev[K.strstart&K.w_mask]=K.head[K.ins_h],K.head[K.ins_h]=K.strstart),Oe!==0&&K.strstart-Oe<=K.w_size-R&&(K.match_length=V(K,Oe)),K.match_length>=O)if(Ie=n._tr_tally(K,K.strstart-K.match_start,K.match_length-O),K.lookahead-=K.match_length,K.match_length<=K.max_lazy_match&&K.lookahead>=O){for(K.match_length--;K.strstart++,K.ins_h=(K.ins_h<<K.hash_shift^K.window[K.strstart+O-1])&K.hash_mask,Oe=K.prev[K.strstart&K.w_mask]=K.head[K.ins_h],K.head[K.ins_h]=K.strstart,--K.match_length!=0;);K.strstart++}else K.strstart+=K.match_length,K.match_length=0,K.ins_h=K.window[K.strstart],K.ins_h=(K.ins_h<<K.hash_shift^K.window[K.strstart+1])&K.hash_mask;else Ie=n._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++;if(Ie&&(N(K,!1),K.strm.avail_out===0))return w}return K.insert=K.strstart<O-1?K.strstart:O-1,me===h?(N(K,!0),K.strm.avail_out===0?H:z):K.last_lit&&(N(K,!1),K.strm.avail_out===0)?w:F}function Z(K,me){for(var Oe,Ie,ue;;){if(K.lookahead<R){if(Y(K),K.lookahead<R&&me===c)return w;if(K.lookahead===0)break}if(Oe=0,K.lookahead>=O&&(K.ins_h=(K.ins_h<<K.hash_shift^K.window[K.strstart+O-1])&K.hash_mask,Oe=K.prev[K.strstart&K.w_mask]=K.head[K.ins_h],K.head[K.ins_h]=K.strstart),K.prev_length=K.match_length,K.prev_match=K.match_start,K.match_length=O-1,Oe!==0&&K.prev_length<K.max_lazy_match&&K.strstart-Oe<=K.w_size-R&&(K.match_length=V(K,Oe),K.match_length<=5&&(K.strategy===1||K.match_length===O&&4096<K.strstart-K.match_start)&&(K.match_length=O-1)),K.prev_length>=O&&K.match_length<=K.prev_length){for(ue=K.strstart+K.lookahead-O,Ie=n._tr_tally(K,K.strstart-1-K.prev_match,K.prev_length-O),K.lookahead-=K.prev_length-1,K.prev_length-=2;++K.strstart<=ue&&(K.ins_h=(K.ins_h<<K.hash_shift^K.window[K.strstart+O-1])&K.hash_mask,Oe=K.prev[K.strstart&K.w_mask]=K.head[K.ins_h],K.head[K.ins_h]=K.strstart),--K.prev_length!=0;);if(K.match_available=0,K.match_length=O-1,K.strstart++,Ie&&(N(K,!1),K.strm.avail_out===0))return w}else if(K.match_available){if((Ie=n._tr_tally(K,0,K.window[K.strstart-1]))&&N(K,!1),K.strstart++,K.lookahead--,K.strm.avail_out===0)return w}else K.match_available=1,K.strstart++,K.lookahead--}return K.match_available&&(Ie=n._tr_tally(K,0,K.window[K.strstart-1]),K.match_available=0),K.insert=K.strstart<O-1?K.strstart:O-1,me===h?(N(K,!0),K.strm.avail_out===0?H:z):K.last_lit&&(N(K,!1),K.strm.avail_out===0)?w:F}function Q(K,me,Oe,Ie,ue){this.good_length=K,this.max_lazy=me,this.nice_length=Oe,this.max_chain=Ie,this.func=ue}function ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=y,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*C),this.dyn_dtree=new i.Buf16(2*(2*T+1)),this.bl_tree=new i.Buf16(2*(2*I+1)),L(this.dyn_ltree),L(this.dyn_dtree),L(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(E+1),this.heap=new i.Buf16(2*P+1),L(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*P+1),L(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function he(K){var me;return K&&K.state?(K.total_in=K.total_out=0,K.data_type=g,(me=K.state).pending=0,me.pending_out=0,me.wrap<0&&(me.wrap=-me.wrap),me.status=me.wrap?v:D,K.adler=me.wrap===2?0:1,me.last_flush=c,n._tr_init(me),u):G(K,d)}function re(K){var me=he(K);return me===u&&(function(Oe){Oe.window_size=2*Oe.w_size,L(Oe.head),Oe.max_lazy_match=r[Oe.level].max_lazy,Oe.good_match=r[Oe.level].good_length,Oe.nice_match=r[Oe.level].nice_length,Oe.max_chain_length=r[Oe.level].max_chain,Oe.strstart=0,Oe.block_start=0,Oe.lookahead=0,Oe.insert=0,Oe.match_length=Oe.prev_length=O-1,Oe.match_available=0,Oe.ins_h=0})(K.state),me}function se(K,me,Oe,Ie,ue,Pe){if(!K)return d;var j=1;if(me===p&&(me=6),Ie<0?(j=0,Ie=-Ie):15<Ie&&(j=2,Ie-=16),ue<1||b<ue||Oe!==y||Ie<8||15<Ie||me<0||9<me||Pe<0||m<Pe)return G(K,d);Ie===8&&(Ie=9);var J=new ae;return(K.state=J).strm=K,J.wrap=j,J.gzhead=null,J.w_bits=Ie,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=ue+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+O-1)/O),J.window=new i.Buf8(2*J.w_size),J.head=new i.Buf16(J.hash_size),J.prev=new i.Buf16(J.w_size),J.lit_bufsize=1<<ue+6,J.pending_buf_size=4*J.lit_bufsize,J.pending_buf=new i.Buf8(J.pending_buf_size),J.d_buf=1*J.lit_bufsize,J.l_buf=3*J.lit_bufsize,J.level=me,J.strategy=Pe,J.method=Oe,re(K)}r=[new Q(0,0,0,0,function(K,me){var Oe=65535;for(Oe>K.pending_buf_size-5&&(Oe=K.pending_buf_size-5);;){if(K.lookahead<=1){if(Y(K),K.lookahead===0&&me===c)return w;if(K.lookahead===0)break}K.strstart+=K.lookahead,K.lookahead=0;var Ie=K.block_start+Oe;if((K.strstart===0||K.strstart>=Ie)&&(K.lookahead=K.strstart-Ie,K.strstart=Ie,N(K,!1),K.strm.avail_out===0)||K.strstart-K.block_start>=K.w_size-R&&(N(K,!1),K.strm.avail_out===0))return w}return K.insert=0,me===h?(N(K,!0),K.strm.avail_out===0?H:z):(K.strstart>K.block_start&&(N(K,!1),K.strm.avail_out),w)}),new Q(4,4,8,4,X),new Q(4,5,16,8,X),new Q(4,6,32,32,X),new Q(4,4,16,16,Z),new Q(8,16,32,32,Z),new Q(8,16,128,128,Z),new Q(8,32,128,256,Z),new Q(32,128,258,1024,Z),new Q(32,258,258,4096,Z)],e.deflateInit=function(K,me){return se(K,me,y,15,8,0)},e.deflateInit2=se,e.deflateReset=re,e.deflateResetKeep=he,e.deflateSetHeader=function(K,me){return K&&K.state?K.state.wrap!==2?d:(K.state.gzhead=me,u):d},e.deflate=function(K,me){var Oe,Ie,ue,Pe;if(!K||!K.state||5<me||me<0)return K?G(K,d):d;if(Ie=K.state,!K.output||!K.input&&K.avail_in!==0||Ie.status===666&&me!==h)return G(K,K.avail_out===0?-5:d);if(Ie.strm=K,Oe=Ie.last_flush,Ie.last_flush=me,Ie.status===v)if(Ie.wrap===2)K.adler=0,U(Ie,31),U(Ie,139),U(Ie,8),Ie.gzhead?(U(Ie,(Ie.gzhead.text?1:0)+(Ie.gzhead.hcrc?2:0)+(Ie.gzhead.extra?4:0)+(Ie.gzhead.name?8:0)+(Ie.gzhead.comment?16:0)),U(Ie,255&Ie.gzhead.time),U(Ie,Ie.gzhead.time>>8&255),U(Ie,Ie.gzhead.time>>16&255),U(Ie,Ie.gzhead.time>>24&255),U(Ie,Ie.level===9?2:2<=Ie.strategy||Ie.level<2?4:0),U(Ie,255&Ie.gzhead.os),Ie.gzhead.extra&&Ie.gzhead.extra.length&&(U(Ie,255&Ie.gzhead.extra.length),U(Ie,Ie.gzhead.extra.length>>8&255)),Ie.gzhead.hcrc&&(K.adler=a(K.adler,Ie.pending_buf,Ie.pending,0)),Ie.gzindex=0,Ie.status=69):(U(Ie,0),U(Ie,0),U(Ie,0),U(Ie,0),U(Ie,0),U(Ie,Ie.level===9?2:2<=Ie.strategy||Ie.level<2?4:0),U(Ie,3),Ie.status=D);else{var j=y+(Ie.w_bits-8<<4)<<8;j|=(2<=Ie.strategy||Ie.level<2?0:Ie.level<6?1:Ie.level===6?2:3)<<6,Ie.strstart!==0&&(j|=32),j+=31-j%31,Ie.status=D,k(Ie,j),Ie.strstart!==0&&(k(Ie,K.adler>>>16),k(Ie,65535&K.adler)),K.adler=1}if(Ie.status===69)if(Ie.gzhead.extra){for(ue=Ie.pending;Ie.gzindex<(65535&Ie.gzhead.extra.length)&&(Ie.pending!==Ie.pending_buf_size||(Ie.gzhead.hcrc&&Ie.pending>ue&&(K.adler=a(K.adler,Ie.pending_buf,Ie.pending-ue,ue)),B(K),ue=Ie.pending,Ie.pending!==Ie.pending_buf_size));)U(Ie,255&Ie.gzhead.extra[Ie.gzindex]),Ie.gzindex++;Ie.gzhead.hcrc&&Ie.pending>ue&&(K.adler=a(K.adler,Ie.pending_buf,Ie.pending-ue,ue)),Ie.gzindex===Ie.gzhead.extra.length&&(Ie.gzindex=0,Ie.status=73)}else Ie.status=73;if(Ie.status===73)if(Ie.gzhead.name){ue=Ie.pending;do{if(Ie.pending===Ie.pending_buf_size&&(Ie.gzhead.hcrc&&Ie.pending>ue&&(K.adler=a(K.adler,Ie.pending_buf,Ie.pending-ue,ue)),B(K),ue=Ie.pending,Ie.pending===Ie.pending_buf_size)){Pe=1;break}Pe=Ie.gzindex<Ie.gzhead.name.length?255&Ie.gzhead.name.charCodeAt(Ie.gzindex++):0,U(Ie,Pe)}while(Pe!==0);Ie.gzhead.hcrc&&Ie.pending>ue&&(K.adler=a(K.adler,Ie.pending_buf,Ie.pending-ue,ue)),Pe===0&&(Ie.gzindex=0,Ie.status=91)}else Ie.status=91;if(Ie.status===91)if(Ie.gzhead.comment){ue=Ie.pending;do{if(Ie.pending===Ie.pending_buf_size&&(Ie.gzhead.hcrc&&Ie.pending>ue&&(K.adler=a(K.adler,Ie.pending_buf,Ie.pending-ue,ue)),B(K),ue=Ie.pending,Ie.pending===Ie.pending_buf_size)){Pe=1;break}Pe=Ie.gzindex<Ie.gzhead.comment.length?255&Ie.gzhead.comment.charCodeAt(Ie.gzindex++):0,U(Ie,Pe)}while(Pe!==0);Ie.gzhead.hcrc&&Ie.pending>ue&&(K.adler=a(K.adler,Ie.pending_buf,Ie.pending-ue,ue)),Pe===0&&(Ie.status=103)}else Ie.status=103;if(Ie.status===103&&(Ie.gzhead.hcrc?(Ie.pending+2>Ie.pending_buf_size&&B(K),Ie.pending+2<=Ie.pending_buf_size&&(U(Ie,255&K.adler),U(Ie,K.adler>>8&255),K.adler=0,Ie.status=D)):Ie.status=D),Ie.pending!==0){if(B(K),K.avail_out===0)return Ie.last_flush=-1,u}else if(K.avail_in===0&&W(me)<=W(Oe)&&me!==h)return G(K,-5);if(Ie.status===666&&K.avail_in!==0)return G(K,-5);if(K.avail_in!==0||Ie.lookahead!==0||me!==c&&Ie.status!==666){var J=Ie.strategy===2?(function(oe,pe){for(var ge;;){if(oe.lookahead===0&&(Y(oe),oe.lookahead===0)){if(pe===c)return w;break}if(oe.match_length=0,ge=n._tr_tally(oe,0,oe.window[oe.strstart]),oe.lookahead--,oe.strstart++,ge&&(N(oe,!1),oe.strm.avail_out===0))return w}return oe.insert=0,pe===h?(N(oe,!0),oe.strm.avail_out===0?H:z):oe.last_lit&&(N(oe,!1),oe.strm.avail_out===0)?w:F})(Ie,me):Ie.strategy===3?(function(oe,pe){for(var ge,Se,De,tt,Ze=oe.window;;){if(oe.lookahead<=_){if(Y(oe),oe.lookahead<=_&&pe===c)return w;if(oe.lookahead===0)break}if(oe.match_length=0,oe.lookahead>=O&&0<oe.strstart&&(Se=Ze[De=oe.strstart-1])===Ze[++De]&&Se===Ze[++De]&&Se===Ze[++De]){tt=oe.strstart+_;do;while(Se===Ze[++De]&&Se===Ze[++De]&&Se===Ze[++De]&&Se===Ze[++De]&&Se===Ze[++De]&&Se===Ze[++De]&&Se===Ze[++De]&&Se===Ze[++De]&&De<tt);oe.match_length=_-(tt-De),oe.match_length>oe.lookahead&&(oe.match_length=oe.lookahead)}if(oe.match_length>=O?(ge=n._tr_tally(oe,1,oe.match_length-O),oe.lookahead-=oe.match_length,oe.strstart+=oe.match_length,oe.match_length=0):(ge=n._tr_tally(oe,0,oe.window[oe.strstart]),oe.lookahead--,oe.strstart++),ge&&(N(oe,!1),oe.strm.avail_out===0))return w}return oe.insert=0,pe===h?(N(oe,!0),oe.strm.avail_out===0?H:z):oe.last_lit&&(N(oe,!1),oe.strm.avail_out===0)?w:F})(Ie,me):r[Ie.level].func(Ie,me);if(J!==H&&J!==z||(Ie.status=666),J===w||J===H)return K.avail_out===0&&(Ie.last_flush=-1),u;if(J===F&&(me===1?n._tr_align(Ie):me!==5&&(n._tr_stored_block(Ie,0,0,!1),me===3&&(L(Ie.head),Ie.lookahead===0&&(Ie.strstart=0,Ie.block_start=0,Ie.insert=0))),B(K),K.avail_out===0))return Ie.last_flush=-1,u}return me!==h?u:Ie.wrap<=0?1:(Ie.wrap===2?(U(Ie,255&K.adler),U(Ie,K.adler>>8&255),U(Ie,K.adler>>16&255),U(Ie,K.adler>>24&255),U(Ie,255&K.total_in),U(Ie,K.total_in>>8&255),U(Ie,K.total_in>>16&255),U(Ie,K.total_in>>24&255)):(k(Ie,K.adler>>>16),k(Ie,65535&K.adler)),B(K),0<Ie.wrap&&(Ie.wrap=-Ie.wrap),Ie.pending!==0?u:1)},e.deflateEnd=function(K){var me;return K&&K.state?(me=K.state.status)!==v&&me!==69&&me!==73&&me!==91&&me!==103&&me!==D&&me!==666?G(K,d):(K.state=null,me===D?G(K,-3):u):d},e.deflateSetDictionary=function(K,me){var Oe,Ie,ue,Pe,j,J,oe,pe,ge=me.length;if(!K||!K.state||(Pe=(Oe=K.state).wrap)===2||Pe===1&&Oe.status!==v||Oe.lookahead)return d;for(Pe===1&&(K.adler=s(K.adler,me,ge,0)),Oe.wrap=0,ge>=Oe.w_size&&(Pe===0&&(L(Oe.head),Oe.strstart=0,Oe.block_start=0,Oe.insert=0),pe=new i.Buf8(Oe.w_size),i.arraySet(pe,me,ge-Oe.w_size,Oe.w_size,0),me=pe,ge=Oe.w_size),j=K.avail_in,J=K.next_in,oe=K.input,K.avail_in=ge,K.next_in=0,K.input=me,Y(Oe);Oe.lookahead>=O;){for(Ie=Oe.strstart,ue=Oe.lookahead-(O-1);Oe.ins_h=(Oe.ins_h<<Oe.hash_shift^Oe.window[Ie+O-1])&Oe.hash_mask,Oe.prev[Ie&Oe.w_mask]=Oe.head[Oe.ins_h],Oe.head[Oe.ins_h]=Ie,Ie++,--ue;);Oe.strstart=Ie,Oe.lookahead=O-1,Y(Oe)}return Oe.strstart+=Oe.lookahead,Oe.block_start=Oe.strstart,Oe.insert=Oe.lookahead,Oe.lookahead=0,Oe.match_length=Oe.prev_length=O-1,Oe.match_available=0,K.next_in=J,K.input=oe,K.avail_in=j,Oe.wrap=Pe,u},e.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(o,t,e){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(o,t,e){"use strict";t.exports=function(r,i){var n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v,D,w,F;n=r.state,s=r.next_in,w=r.input,a=s+(r.avail_in-5),l=r.next_out,F=r.output,c=l-(i-r.avail_out),h=l+(r.avail_out-257),u=n.dmax,d=n.wsize,p=n.whave,m=n.wnext,g=n.window,y=n.hold,b=n.bits,P=n.lencode,T=n.distcode,I=(1<<n.lenbits)-1,C=(1<<n.distbits)-1;e:do{b<15&&(y+=w[s++]<<b,b+=8,y+=w[s++]<<b,b+=8),E=P[y&I];t:for(;;){if(y>>>=O=E>>>24,b-=O,(O=E>>>16&255)===0)F[l++]=65535&E;else{if(!(16&O)){if((64&O)==0){E=P[(65535&E)+(y&(1<<O)-1)];continue t}if(32&O){n.mode=12;break e}r.msg="invalid literal/length code",n.mode=30;break e}_=65535&E,(O&=15)&&(b<O&&(y+=w[s++]<<b,b+=8),_+=y&(1<<O)-1,y>>>=O,b-=O),b<15&&(y+=w[s++]<<b,b+=8,y+=w[s++]<<b,b+=8),E=T[y&C];r:for(;;){if(y>>>=O=E>>>24,b-=O,!(16&(O=E>>>16&255))){if((64&O)==0){E=T[(65535&E)+(y&(1<<O)-1)];continue r}r.msg="invalid distance code",n.mode=30;break e}if(R=65535&E,b<(O&=15)&&(y+=w[s++]<<b,(b+=8)<O&&(y+=w[s++]<<b,b+=8)),u<(R+=y&(1<<O)-1)){r.msg="invalid distance too far back",n.mode=30;break e}if(y>>>=O,b-=O,(O=l-c)<R){if(p<(O=R-O)&&n.sane){r.msg="invalid distance too far back",n.mode=30;break e}if(D=g,(v=0)===m){if(v+=d-O,O<_){for(_-=O;F[l++]=g[v++],--O;);v=l-R,D=F}}else if(m<O){if(v+=d+m-O,(O-=m)<_){for(_-=O;F[l++]=g[v++],--O;);if(v=0,m<_){for(_-=O=m;F[l++]=g[v++],--O;);v=l-R,D=F}}}else if(v+=m-O,O<_){for(_-=O;F[l++]=g[v++],--O;);v=l-R,D=F}for(;2<_;)F[l++]=D[v++],F[l++]=D[v++],F[l++]=D[v++],_-=3;_&&(F[l++]=D[v++],1<_&&(F[l++]=D[v++]))}else{for(v=l-R;F[l++]=F[v++],F[l++]=F[v++],F[l++]=F[v++],2<(_-=3););_&&(F[l++]=F[v++],1<_&&(F[l++]=F[v++]))}break}}break}}while(s<a&&l<h);s-=_=b>>3,y&=(1<<(b-=_<<3))-1,r.next_in=s,r.next_out=l,r.avail_in=s<a?a-s+5:5-(s-a),r.avail_out=l<h?h-l+257:257-(l-h),n.hold=y,n.bits=b}},{}],49:[function(o,t,e){"use strict";var r=o("../utils/common"),i=o("./adler32"),n=o("./crc32"),s=o("./inffast"),a=o("./inftrees"),l=1,c=2,h=0,u=-2,d=1,p=852,m=592;function g(v){return(v>>>24&255)+(v>>>8&65280)+((65280&v)<<8)+((255&v)<<24)}function y(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(v){var D;return v&&v.state?(D=v.state,v.total_in=v.total_out=D.total=0,v.msg="",D.wrap&&(v.adler=1&D.wrap),D.mode=d,D.last=0,D.havedict=0,D.dmax=32768,D.head=null,D.hold=0,D.bits=0,D.lencode=D.lendyn=new r.Buf32(p),D.distcode=D.distdyn=new r.Buf32(m),D.sane=1,D.back=-1,h):u}function P(v){var D;return v&&v.state?((D=v.state).wsize=0,D.whave=0,D.wnext=0,b(v)):u}function T(v,D){var w,F;return v&&v.state?(F=v.state,D<0?(w=0,D=-D):(w=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15<D)?u:(F.window!==null&&F.wbits!==D&&(F.window=null),F.wrap=w,F.wbits=D,P(v))):u}function I(v,D){var w,F;return v?(F=new y,(v.state=F).window=null,(w=T(v,D))!==h&&(v.state=null),w):u}var C,E,O=!0;function _(v){if(O){var D;for(C=new r.Buf32(512),E=new r.Buf32(32),D=0;D<144;)v.lens[D++]=8;for(;D<256;)v.lens[D++]=9;for(;D<280;)v.lens[D++]=7;for(;D<288;)v.lens[D++]=8;for(a(l,v.lens,0,288,C,0,v.work,{bits:9}),D=0;D<32;)v.lens[D++]=5;a(c,v.lens,0,32,E,0,v.work,{bits:5}),O=!1}v.lencode=C,v.lenbits=9,v.distcode=E,v.distbits=5}function R(v,D,w,F){var H,z=v.state;return z.window===null&&(z.wsize=1<<z.wbits,z.wnext=0,z.whave=0,z.window=new r.Buf8(z.wsize)),F>=z.wsize?(r.arraySet(z.window,D,w-z.wsize,z.wsize,0),z.wnext=0,z.whave=z.wsize):(F<(H=z.wsize-z.wnext)&&(H=F),r.arraySet(z.window,D,w-F,H,z.wnext),(F-=H)?(r.arraySet(z.window,D,w-F,F,0),z.wnext=F,z.whave=z.wsize):(z.wnext+=H,z.wnext===z.wsize&&(z.wnext=0),z.whave<z.wsize&&(z.whave+=H))),0}e.inflateReset=P,e.inflateReset2=T,e.inflateResetKeep=b,e.inflateInit=function(v){return I(v,15)},e.inflateInit2=I,e.inflate=function(v,D){var w,F,H,z,G,W,L,B,N,U,k,V,Y,X,Z,Q,ae,he,re,se,K,me,Oe,Ie,ue=0,Pe=new r.Buf8(4),j=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!v||!v.state||!v.output||!v.input&&v.avail_in!==0)return u;(w=v.state).mode===12&&(w.mode=13),G=v.next_out,H=v.output,L=v.avail_out,z=v.next_in,F=v.input,W=v.avail_in,B=w.hold,N=w.bits,U=W,k=L,me=h;e:for(;;)switch(w.mode){case d:if(w.wrap===0){w.mode=13;break}for(;N<16;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}if(2&w.wrap&&B===35615){Pe[w.check=0]=255&B,Pe[1]=B>>>8&255,w.check=n(w.check,Pe,2,0),N=B=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&B)<<8)+(B>>8))%31){v.msg="incorrect header check",w.mode=30;break}if((15&B)!=8){v.msg="unknown compression method",w.mode=30;break}if(N-=4,K=8+(15&(B>>>=4)),w.wbits===0)w.wbits=K;else if(K>w.wbits){v.msg="invalid window size",w.mode=30;break}w.dmax=1<<K,v.adler=w.check=1,w.mode=512&B?10:12,N=B=0;break;case 2:for(;N<16;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}if(w.flags=B,(255&w.flags)!=8){v.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){v.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=B>>8&1),512&w.flags&&(Pe[0]=255&B,Pe[1]=B>>>8&255,w.check=n(w.check,Pe,2,0)),N=B=0,w.mode=3;case 3:for(;N<32;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}w.head&&(w.head.time=B),512&w.flags&&(Pe[0]=255&B,Pe[1]=B>>>8&255,Pe[2]=B>>>16&255,Pe[3]=B>>>24&255,w.check=n(w.check,Pe,4,0)),N=B=0,w.mode=4;case 4:for(;N<16;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}w.head&&(w.head.xflags=255&B,w.head.os=B>>8),512&w.flags&&(Pe[0]=255&B,Pe[1]=B>>>8&255,w.check=n(w.check,Pe,2,0)),N=B=0,w.mode=5;case 5:if(1024&w.flags){for(;N<16;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}w.length=B,w.head&&(w.head.extra_len=B),512&w.flags&&(Pe[0]=255&B,Pe[1]=B>>>8&255,w.check=n(w.check,Pe,2,0)),N=B=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(W<(V=w.length)&&(V=W),V&&(w.head&&(K=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),r.arraySet(w.head.extra,F,z,V,K)),512&w.flags&&(w.check=n(w.check,F,V,z)),W-=V,z+=V,w.length-=V),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(W===0)break e;for(V=0;K=F[z+V++],w.head&&K&&w.length<65536&&(w.head.name+=String.fromCharCode(K)),K&&V<W;);if(512&w.flags&&(w.check=n(w.check,F,V,z)),W-=V,z+=V,K)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(W===0)break e;for(V=0;K=F[z+V++],w.head&&K&&w.length<65536&&(w.head.comment+=String.fromCharCode(K)),K&&V<W;);if(512&w.flags&&(w.check=n(w.check,F,V,z)),W-=V,z+=V,K)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;N<16;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}if(B!==(65535&w.check)){v.msg="header crc mismatch",w.mode=30;break}N=B=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),v.adler=w.check=0,w.mode=12;break;case 10:for(;N<32;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}v.adler=w.check=g(B),N=B=0,w.mode=11;case 11:if(w.havedict===0)return v.next_out=G,v.avail_out=L,v.next_in=z,v.avail_in=W,w.hold=B,w.bits=N,2;v.adler=w.check=1,w.mode=12;case 12:if(D===5||D===6)break e;case 13:if(w.last){B>>>=7&N,N-=7&N,w.mode=27;break}for(;N<3;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}switch(w.last=1&B,N-=1,3&(B>>>=1)){case 0:w.mode=14;break;case 1:if(_(w),w.mode=20,D!==6)break;B>>>=2,N-=2;break e;case 2:w.mode=17;break;case 3:v.msg="invalid block type",w.mode=30}B>>>=2,N-=2;break;case 14:for(B>>>=7&N,N-=7&N;N<32;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}if((65535&B)!=(B>>>16^65535)){v.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&B,N=B=0,w.mode=15,D===6)break e;case 15:w.mode=16;case 16:if(V=w.length){if(W<V&&(V=W),L<V&&(V=L),V===0)break e;r.arraySet(H,F,z,V,G),W-=V,z+=V,L-=V,G+=V,w.length-=V;break}w.mode=12;break;case 17:for(;N<14;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}if(w.nlen=257+(31&B),B>>>=5,N-=5,w.ndist=1+(31&B),B>>>=5,N-=5,w.ncode=4+(15&B),B>>>=4,N-=4,286<w.nlen||30<w.ndist){v.msg="too many length or distance symbols",w.mode=30;break}w.have=0,w.mode=18;case 18:for(;w.have<w.ncode;){for(;N<3;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}w.lens[j[w.have++]]=7&B,B>>>=3,N-=3}for(;w.have<19;)w.lens[j[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,Oe={bits:w.lenbits},me=a(0,w.lens,0,19,w.lencode,0,w.work,Oe),w.lenbits=Oe.bits,me){v.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have<w.nlen+w.ndist;){for(;Q=(ue=w.lencode[B&(1<<w.lenbits)-1])>>>16&255,ae=65535&ue,!((Z=ue>>>24)<=N);){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}if(ae<16)B>>>=Z,N-=Z,w.lens[w.have++]=ae;else{if(ae===16){for(Ie=Z+2;N<Ie;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}if(B>>>=Z,N-=Z,w.have===0){v.msg="invalid bit length repeat",w.mode=30;break}K=w.lens[w.have-1],V=3+(3&B),B>>>=2,N-=2}else if(ae===17){for(Ie=Z+3;N<Ie;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}N-=Z,K=0,V=3+(7&(B>>>=Z)),B>>>=3,N-=3}else{for(Ie=Z+7;N<Ie;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}N-=Z,K=0,V=11+(127&(B>>>=Z)),B>>>=7,N-=7}if(w.have+V>w.nlen+w.ndist){v.msg="invalid bit length repeat",w.mode=30;break}for(;V--;)w.lens[w.have++]=K}}if(w.mode===30)break;if(w.lens[256]===0){v.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,Oe={bits:w.lenbits},me=a(l,w.lens,0,w.nlen,w.lencode,0,w.work,Oe),w.lenbits=Oe.bits,me){v.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,Oe={bits:w.distbits},me=a(c,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,Oe),w.distbits=Oe.bits,me){v.msg="invalid distances set",w.mode=30;break}if(w.mode=20,D===6)break e;case 20:w.mode=21;case 21:if(6<=W&&258<=L){v.next_out=G,v.avail_out=L,v.next_in=z,v.avail_in=W,w.hold=B,w.bits=N,s(v,k),G=v.next_out,H=v.output,L=v.avail_out,z=v.next_in,F=v.input,W=v.avail_in,B=w.hold,N=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;Q=(ue=w.lencode[B&(1<<w.lenbits)-1])>>>16&255,ae=65535&ue,!((Z=ue>>>24)<=N);){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}if(Q&&(240&Q)==0){for(he=Z,re=Q,se=ae;Q=(ue=w.lencode[se+((B&(1<<he+re)-1)>>he)])>>>16&255,ae=65535&ue,!(he+(Z=ue>>>24)<=N);){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}B>>>=he,N-=he,w.back+=he}if(B>>>=Z,N-=Z,w.back+=Z,w.length=ae,Q===0){w.mode=26;break}if(32&Q){w.back=-1,w.mode=12;break}if(64&Q){v.msg="invalid literal/length code",w.mode=30;break}w.extra=15&Q,w.mode=22;case 22:if(w.extra){for(Ie=w.extra;N<Ie;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}w.length+=B&(1<<w.extra)-1,B>>>=w.extra,N-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;Q=(ue=w.distcode[B&(1<<w.distbits)-1])>>>16&255,ae=65535&ue,!((Z=ue>>>24)<=N);){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}if((240&Q)==0){for(he=Z,re=Q,se=ae;Q=(ue=w.distcode[se+((B&(1<<he+re)-1)>>he)])>>>16&255,ae=65535&ue,!(he+(Z=ue>>>24)<=N);){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}B>>>=he,N-=he,w.back+=he}if(B>>>=Z,N-=Z,w.back+=Z,64&Q){v.msg="invalid distance code",w.mode=30;break}w.offset=ae,w.extra=15&Q,w.mode=24;case 24:if(w.extra){for(Ie=w.extra;N<Ie;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}w.offset+=B&(1<<w.extra)-1,B>>>=w.extra,N-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){v.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(L===0)break e;if(V=k-L,w.offset>V){if((V=w.offset-V)>w.whave&&w.sane){v.msg="invalid distance too far back",w.mode=30;break}Y=V>w.wnext?(V-=w.wnext,w.wsize-V):w.wnext-V,V>w.length&&(V=w.length),X=w.window}else X=H,Y=G-w.offset,V=w.length;for(L<V&&(V=L),L-=V,w.length-=V;H[G++]=X[Y++],--V;);w.length===0&&(w.mode=21);break;case 26:if(L===0)break e;H[G++]=w.length,L--,w.mode=21;break;case 27:if(w.wrap){for(;N<32;){if(W===0)break e;W--,B|=F[z++]<<N,N+=8}if(k-=L,v.total_out+=k,w.total+=k,k&&(v.adler=w.check=w.flags?n(w.check,H,k,G-k):i(w.check,H,k,G-k)),k=L,(w.flags?B:g(B))!==w.check){v.msg="incorrect data check",w.mode=30;break}N=B=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;N<32;){if(W===0)break e;W--,B+=F[z++]<<N,N+=8}if(B!==(4294967295&w.total)){v.msg="incorrect length check",w.mode=30;break}N=B=0}w.mode=29;case 29:me=1;break e;case 30:me=-3;break e;case 31:return-4;case 32:default:return u}return v.next_out=G,v.avail_out=L,v.next_in=z,v.avail_in=W,w.hold=B,w.bits=N,(w.wsize||k!==v.avail_out&&w.mode<30&&(w.mode<27||D!==4))&&R(v,v.output,v.next_out,k-v.avail_out)?(w.mode=31,-4):(U-=v.avail_in,k-=v.avail_out,v.total_in+=U,v.total_out+=k,w.total+=k,w.wrap&&k&&(v.adler=w.check=w.flags?n(w.check,H,k,v.next_out-k):i(w.check,H,k,v.next_out-k)),v.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(U==0&&k===0||D===4)&&me===h&&(me=-5),me)},e.inflateEnd=function(v){if(!v||!v.state)return u;var D=v.state;return D.window&&(D.window=null),v.state=null,h},e.inflateGetHeader=function(v,D){var w;return v&&v.state?(2&(w=v.state).wrap)==0?u:((w.head=D).done=!1,h):u},e.inflateSetDictionary=function(v,D){var w,F=D.length;return v&&v.state?(w=v.state).wrap!==0&&w.mode!==11?u:w.mode===11&&i(1,D,F,0)!==w.check?-3:R(v,D,F,F)?(w.mode=31,-4):(w.havedict=1,h):u},e.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(o,t,e){"use strict";var r=o("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],n=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(l,c,h,u,d,p,m,g){var y,b,P,T,I,C,E,O,_,R=g.bits,v=0,D=0,w=0,F=0,H=0,z=0,G=0,W=0,L=0,B=0,N=null,U=0,k=new r.Buf16(16),V=new r.Buf16(16),Y=null,X=0;for(v=0;v<=15;v++)k[v]=0;for(D=0;D<u;D++)k[c[h+D]]++;for(H=R,F=15;1<=F&&k[F]===0;F--);if(F<H&&(H=F),F===0)return d[p++]=20971520,d[p++]=20971520,g.bits=1,0;for(w=1;w<F&&k[w]===0;w++);for(H<w&&(H=w),v=W=1;v<=15;v++)if(W<<=1,(W-=k[v])<0)return-1;if(0<W&&(l===0||F!==1))return-1;for(V[1]=0,v=1;v<15;v++)V[v+1]=V[v]+k[v];for(D=0;D<u;D++)c[h+D]!==0&&(m[V[c[h+D]]++]=D);if(C=l===0?(N=Y=m,19):l===1?(N=i,U-=257,Y=n,X-=257,256):(N=s,Y=a,-1),v=w,I=p,G=D=B=0,P=-1,T=(L=1<<(z=H))-1,l===1&&852<L||l===2&&592<L)return 1;for(;;){for(E=v-G,_=m[D]<C?(O=0,m[D]):m[D]>C?(O=Y[X+m[D]],N[U+m[D]]):(O=96,0),y=1<<v-G,w=b=1<<z;d[I+(B>>G)+(b-=y)]=E<<24|O<<16|_|0,b!==0;);for(y=1<<v-1;B&y;)y>>=1;if(y!==0?(B&=y-1,B+=y):B=0,D++,--k[v]==0){if(v===F)break;v=c[h+m[D]]}if(H<v&&(B&T)!==P){for(G===0&&(G=H),I+=w,W=1<<(z=v-G);z+G<F&&!((W-=k[z+G])<=0);)z++,W<<=1;if(L+=1<<z,l===1&&852<L||l===2&&592<L)return 1;d[P=B&T]=H<<24|z<<16|I-p|0}}return B!==0&&(d[I+B]=v-G<<24|64<<16|0),g.bits=H,0}},{"../utils/common":41}],51:[function(o,t,e){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(o,t,e){"use strict";var r=o("../utils/common"),i=0,n=1;function s(ue){for(var Pe=ue.length;0<=--Pe;)ue[Pe]=0}var a=0,l=29,c=256,h=c+1+l,u=30,d=19,p=2*h+1,m=15,g=16,y=7,b=256,P=16,T=17,I=18,C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],E=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],_=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],R=new Array(2*(h+2));s(R);var v=new Array(2*u);s(v);var D=new Array(512);s(D);var w=new Array(256);s(w);var F=new Array(l);s(F);var H,z,G,W=new Array(u);function L(ue,Pe,j,J,oe){this.static_tree=ue,this.extra_bits=Pe,this.extra_base=j,this.elems=J,this.max_length=oe,this.has_stree=ue&&ue.length}function B(ue,Pe){this.dyn_tree=ue,this.max_code=0,this.stat_desc=Pe}function N(ue){return ue<256?D[ue]:D[256+(ue>>>7)]}function U(ue,Pe){ue.pending_buf[ue.pending++]=255&Pe,ue.pending_buf[ue.pending++]=Pe>>>8&255}function k(ue,Pe,j){ue.bi_valid>g-j?(ue.bi_buf|=Pe<<ue.bi_valid&65535,U(ue,ue.bi_buf),ue.bi_buf=Pe>>g-ue.bi_valid,ue.bi_valid+=j-g):(ue.bi_buf|=Pe<<ue.bi_valid&65535,ue.bi_valid+=j)}function V(ue,Pe,j){k(ue,j[2*Pe],j[2*Pe+1])}function Y(ue,Pe){for(var j=0;j|=1&ue,ue>>>=1,j<<=1,0<--Pe;);return j>>>1}function X(ue,Pe,j){var J,oe,pe=new Array(m+1),ge=0;for(J=1;J<=m;J++)pe[J]=ge=ge+j[J-1]<<1;for(oe=0;oe<=Pe;oe++){var Se=ue[2*oe+1];Se!==0&&(ue[2*oe]=Y(pe[Se]++,Se))}}function Z(ue){var Pe;for(Pe=0;Pe<h;Pe++)ue.dyn_ltree[2*Pe]=0;for(Pe=0;Pe<u;Pe++)ue.dyn_dtree[2*Pe]=0;for(Pe=0;Pe<d;Pe++)ue.bl_tree[2*Pe]=0;ue.dyn_ltree[2*b]=1,ue.opt_len=ue.static_len=0,ue.last_lit=ue.matches=0}function Q(ue){8<ue.bi_valid?U(ue,ue.bi_buf):0<ue.bi_valid&&(ue.pending_buf[ue.pending++]=ue.bi_buf),ue.bi_buf=0,ue.bi_valid=0}function ae(ue,Pe,j,J){var oe=2*Pe,pe=2*j;return ue[oe]<ue[pe]||ue[oe]===ue[pe]&&J[Pe]<=J[j]}function he(ue,Pe,j){for(var J=ue.heap[j],oe=j<<1;oe<=ue.heap_len&&(oe<ue.heap_len&&ae(Pe,ue.heap[oe+1],ue.heap[oe],ue.depth)&&oe++,!ae(Pe,J,ue.heap[oe],ue.depth));)ue.heap[j]=ue.heap[oe],j=oe,oe<<=1;ue.heap[j]=J}function re(ue,Pe,j){var J,oe,pe,ge,Se=0;if(ue.last_lit!==0)for(;J=ue.pending_buf[ue.d_buf+2*Se]<<8|ue.pending_buf[ue.d_buf+2*Se+1],oe=ue.pending_buf[ue.l_buf+Se],Se++,J===0?V(ue,oe,Pe):(V(ue,(pe=w[oe])+c+1,Pe),(ge=C[pe])!==0&&k(ue,oe-=F[pe],ge),V(ue,pe=N(--J),j),(ge=E[pe])!==0&&k(ue,J-=W[pe],ge)),Se<ue.last_lit;);V(ue,b,Pe)}function se(ue,Pe){var j,J,oe,pe=Pe.dyn_tree,ge=Pe.stat_desc.static_tree,Se=Pe.stat_desc.has_stree,De=Pe.stat_desc.elems,tt=-1;for(ue.heap_len=0,ue.heap_max=p,j=0;j<De;j++)pe[2*j]!==0?(ue.heap[++ue.heap_len]=tt=j,ue.depth[j]=0):pe[2*j+1]=0;for(;ue.heap_len<2;)pe[2*(oe=ue.heap[++ue.heap_len]=tt<2?++tt:0)]=1,ue.depth[oe]=0,ue.opt_len--,Se&&(ue.static_len-=ge[2*oe+1]);for(Pe.max_code=tt,j=ue.heap_len>>1;1<=j;j--)he(ue,pe,j);for(oe=De;j=ue.heap[1],ue.heap[1]=ue.heap[ue.heap_len--],he(ue,pe,1),J=ue.heap[1],ue.heap[--ue.heap_max]=j,ue.heap[--ue.heap_max]=J,pe[2*oe]=pe[2*j]+pe[2*J],ue.depth[oe]=(ue.depth[j]>=ue.depth[J]?ue.depth[j]:ue.depth[J])+1,pe[2*j+1]=pe[2*J+1]=oe,ue.heap[1]=oe++,he(ue,pe,1),2<=ue.heap_len;);ue.heap[--ue.heap_max]=ue.heap[1],(function(Ze,Wt){var Nr,Lr,Dr,Rr,ke,Yt,Ut=Wt.dyn_tree,ar=Wt.max_code,Fe=Wt.stat_desc.static_tree,it=Wt.stat_desc.has_stree,ye=Wt.stat_desc.extra_bits,bt=Wt.stat_desc.extra_base,zt=Wt.stat_desc.max_length,de=0;for(Rr=0;Rr<=m;Rr++)Ze.bl_count[Rr]=0;for(Ut[2*Ze.heap[Ze.heap_max]+1]=0,Nr=Ze.heap_max+1;Nr<p;Nr++)zt<(Rr=Ut[2*Ut[2*(Lr=Ze.heap[Nr])+1]+1]+1)&&(Rr=zt,de++),Ut[2*Lr+1]=Rr,ar<Lr||(Ze.bl_count[Rr]++,ke=0,bt<=Lr&&(ke=ye[Lr-bt]),Yt=Ut[2*Lr],Ze.opt_len+=Yt*(Rr+ke),it&&(Ze.static_len+=Yt*(Fe[2*Lr+1]+ke)));if(de!==0){do{for(Rr=zt-1;Ze.bl_count[Rr]===0;)Rr--;Ze.bl_count[Rr]--,Ze.bl_count[Rr+1]+=2,Ze.bl_count[zt]--,de-=2}while(0<de);for(Rr=zt;Rr!==0;Rr--)for(Lr=Ze.bl_count[Rr];Lr!==0;)ar<(Dr=Ze.heap[--Nr])||(Ut[2*Dr+1]!==Rr&&(Ze.opt_len+=(Rr-Ut[2*Dr+1])*Ut[2*Dr],Ut[2*Dr+1]=Rr),Lr--)}})(ue,Pe),X(pe,tt,ue.bl_count)}function K(ue,Pe,j){var J,oe,pe=-1,ge=Pe[1],Se=0,De=7,tt=4;for(ge===0&&(De=138,tt=3),Pe[2*(j+1)+1]=65535,J=0;J<=j;J++)oe=ge,ge=Pe[2*(J+1)+1],++Se<De&&oe===ge||(Se<tt?ue.bl_tree[2*oe]+=Se:oe!==0?(oe!==pe&&ue.bl_tree[2*oe]++,ue.bl_tree[2*P]++):Se<=10?ue.bl_tree[2*T]++:ue.bl_tree[2*I]++,pe=oe,tt=(Se=0)===ge?(De=138,3):oe===ge?(De=6,3):(De=7,4))}function me(ue,Pe,j){var J,oe,pe=-1,ge=Pe[1],Se=0,De=7,tt=4;for(ge===0&&(De=138,tt=3),J=0;J<=j;J++)if(oe=ge,ge=Pe[2*(J+1)+1],!(++Se<De&&oe===ge)){if(Se<tt)for(;V(ue,oe,ue.bl_tree),--Se!=0;);else oe!==0?(oe!==pe&&(V(ue,oe,ue.bl_tree),Se--),V(ue,P,ue.bl_tree),k(ue,Se-3,2)):Se<=10?(V(ue,T,ue.bl_tree),k(ue,Se-3,3)):(V(ue,I,ue.bl_tree),k(ue,Se-11,7));pe=oe,tt=(Se=0)===ge?(De=138,3):oe===ge?(De=6,3):(De=7,4)}}s(W);var Oe=!1;function Ie(ue,Pe,j,J){k(ue,(a<<1)+(J?1:0),3),(function(oe,pe,ge,Se){Q(oe),Se&&(U(oe,ge),U(oe,~ge)),r.arraySet(oe.pending_buf,oe.window,pe,ge,oe.pending),oe.pending+=ge})(ue,Pe,j,!0)}e._tr_init=function(ue){Oe||((function(){var Pe,j,J,oe,pe,ge=new Array(m+1);for(oe=J=0;oe<l-1;oe++)for(F[oe]=J,Pe=0;Pe<1<<C[oe];Pe++)w[J++]=oe;for(w[J-1]=oe,oe=pe=0;oe<16;oe++)for(W[oe]=pe,Pe=0;Pe<1<<E[oe];Pe++)D[pe++]=oe;for(pe>>=7;oe<u;oe++)for(W[oe]=pe<<7,Pe=0;Pe<1<<E[oe]-7;Pe++)D[256+pe++]=oe;for(j=0;j<=m;j++)ge[j]=0;for(Pe=0;Pe<=143;)R[2*Pe+1]=8,Pe++,ge[8]++;for(;Pe<=255;)R[2*Pe+1]=9,Pe++,ge[9]++;for(;Pe<=279;)R[2*Pe+1]=7,Pe++,ge[7]++;for(;Pe<=287;)R[2*Pe+1]=8,Pe++,ge[8]++;for(X(R,h+1,ge),Pe=0;Pe<u;Pe++)v[2*Pe+1]=5,v[2*Pe]=Y(Pe,5);H=new L(R,C,c+1,h,m),z=new L(v,E,0,u,m),G=new L(new Array(0),O,0,d,y)})(),Oe=!0),ue.l_desc=new B(ue.dyn_ltree,H),ue.d_desc=new B(ue.dyn_dtree,z),ue.bl_desc=new B(ue.bl_tree,G),ue.bi_buf=0,ue.bi_valid=0,Z(ue)},e._tr_stored_block=Ie,e._tr_flush_block=function(ue,Pe,j,J){var oe,pe,ge=0;0<ue.level?(ue.strm.data_type===2&&(ue.strm.data_type=(function(Se){var De,tt=4093624447;for(De=0;De<=31;De++,tt>>>=1)if(1&tt&&Se.dyn_ltree[2*De]!==0)return i;if(Se.dyn_ltree[18]!==0||Se.dyn_ltree[20]!==0||Se.dyn_ltree[26]!==0)return n;for(De=32;De<c;De++)if(Se.dyn_ltree[2*De]!==0)return n;return i})(ue)),se(ue,ue.l_desc),se(ue,ue.d_desc),ge=(function(Se){var De;for(K(Se,Se.dyn_ltree,Se.l_desc.max_code),K(Se,Se.dyn_dtree,Se.d_desc.max_code),se(Se,Se.bl_desc),De=d-1;3<=De&&Se.bl_tree[2*_[De]+1]===0;De--);return Se.opt_len+=3*(De+1)+5+5+4,De})(ue),oe=ue.opt_len+3+7>>>3,(pe=ue.static_len+3+7>>>3)<=oe&&(oe=pe)):oe=pe=j+5,j+4<=oe&&Pe!==-1?Ie(ue,Pe,j,J):ue.strategy===4||pe===oe?(k(ue,2+(J?1:0),3),re(ue,R,v)):(k(ue,4+(J?1:0),3),(function(Se,De,tt,Ze){var Wt;for(k(Se,De-257,5),k(Se,tt-1,5),k(Se,Ze-4,4),Wt=0;Wt<Ze;Wt++)k(Se,Se.bl_tree[2*_[Wt]+1],3);me(Se,Se.dyn_ltree,De-1),me(Se,Se.dyn_dtree,tt-1)})(ue,ue.l_desc.max_code+1,ue.d_desc.max_code+1,ge+1),re(ue,ue.dyn_ltree,ue.dyn_dtree)),Z(ue),J&&Q(ue)},e._tr_tally=function(ue,Pe,j){return ue.pending_buf[ue.d_buf+2*ue.last_lit]=Pe>>>8&255,ue.pending_buf[ue.d_buf+2*ue.last_lit+1]=255&Pe,ue.pending_buf[ue.l_buf+ue.last_lit]=255&j,ue.last_lit++,Pe===0?ue.dyn_ltree[2*j]++:(ue.matches++,Pe--,ue.dyn_ltree[2*(w[j]+c+1)]++,ue.dyn_dtree[2*N(Pe)]++),ue.last_lit===ue.lit_bufsize-1},e._tr_align=function(ue){k(ue,2,3),V(ue,b,R),(function(Pe){Pe.bi_valid===16?(U(Pe,Pe.bi_buf),Pe.bi_buf=0,Pe.bi_valid=0):8<=Pe.bi_valid&&(Pe.pending_buf[Pe.pending++]=255&Pe.bi_buf,Pe.bi_buf>>=8,Pe.bi_valid-=8)})(ue)}},{"../utils/common":41}],53:[function(o,t,e){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(o,t,e){(function(r){(function(i,n){"use strict";if(!i.setImmediate){var s,a,l,c,h=1,u={},d=!1,p=i.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(i);m=m&&m.setTimeout?m:i,s={}.toString.call(i.process)==="[object process]"?function(P){process.nextTick(function(){y(P)})}:(function(){if(i.postMessage&&!i.importScripts){var P=!0,T=i.onmessage;return i.onmessage=function(){P=!1},i.postMessage("","*"),i.onmessage=T,P}})()?(c="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",b,!1):i.attachEvent("onmessage",b),function(P){i.postMessage(c+P,"*")}):i.MessageChannel?((l=new MessageChannel).port1.onmessage=function(P){y(P.data)},function(P){l.port2.postMessage(P)}):p&&"onreadystatechange"in p.createElement("script")?(a=p.documentElement,function(P){var T=p.createElement("script");T.onreadystatechange=function(){y(P),T.onreadystatechange=null,a.removeChild(T),T=null},a.appendChild(T)}):function(P){setTimeout(y,0,P)},m.setImmediate=function(P){typeof P!="function"&&(P=new Function(""+P));for(var T=new Array(arguments.length-1),I=0;I<T.length;I++)T[I]=arguments[I+1];var C={callback:P,args:T};return u[h]=C,s(h),h++},m.clearImmediate=g}function g(P){delete u[P]}function y(P){if(d)setTimeout(y,0,P);else{var T=u[P];if(T){d=!0;try{(function(I){var C=I.callback,E=I.args;switch(E.length){case 0:C();break;case 1:C(E[0]);break;case 2:C(E[0],E[1]);break;case 3:C(E[0],E[1],E[2]);break;default:C.apply(n,E)}})(T)}finally{g(P),d=!1}}}}function b(P){P.source===i&&typeof P.data=="string"&&P.data.indexOf(c)===0&&y(+P.data.slice(c.length))}})(typeof self>"u"?r===void 0?this:r:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})});var Q_e=nd($_e()),eve=nd(J_e());if(window.frameElement&&!window["USE-IFRAME-FOR-MAIN"]){let o=document.createElement("style");o.innerHTML=eve.default,document.head.appendChild(o),document.write(Q_e.default)}var hL=nd(Lb());var QK=class{constructor(){this.workerBus=null;this.messageBus2=new hL.MessageBus2(!0);let t=hI(),e=!!t.frameElement&&!t["USE-IFRAME-FOR-MAIN"]&&!t["META-PANELIZE-ENV"];t["META-PANELIZE-ENV"]&&t._MSG_BUS_&&(t._MSG_BUS_.unsafe=!0),this.globalMessageBus=t._MSG_BUS_=t._MSG_BUS_||new hL.MessageBus(!e),this.messageBus=e?new hL.MessageBus(!0):this.globalMessageBus,this.windowBridge=e?new hL.WindowMessageBridge(this.messageBus):this.messageBus,this.workerBus=null,this.extensionApiMessageBus2=()=>t.top._MSG_BUS2_EXTAPI_}publish(t,e,r){r!=null&&r!=null?this.windowBridge.publish(t,e,r):this.messageBus.publish(t,e)}subscribe(t,e,r){let i=hI();r!=null&&r!=null&&r!==i&&this.windowBridge.subscribe(t,r),this.messageBus.subscribe(t,e)}push(t,e,r){r!=null&&r!=null?this.windowBridge.push(t,e,r):this.messageBus.push(t,e)}pull(t,e,r){r!=null&&r!=null&&this.windowBridge.pull(t,r),this.messageBus.pull(t,e)}};function hI(){if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis;if(typeof eZ<"u")return eZ}var eZ=hI(),ie=eZ.MSG_BUS_PCB=eZ.MSG_BUS_PCB||new QK;var ZJe=Object.create,jve=Object.defineProperty,JJe=Object.getOwnPropertyDescriptor,QJe=Object.getOwnPropertyNames,eQe=Object.getPrototypeOf,tQe=Object.prototype.hasOwnProperty,rQe=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),iQe=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of QJe(t))!tQe.call(o,i)&&i!==e&&jve(o,i,{get:()=>t[i],enumerable:!(r=JJe(t,i))||r.enumerable});return o},nQe=(o,t,e)=>(e=o!=null?ZJe(eQe(o)):{},iQe(t||!o||!o.__esModule?jve(e,"default",{value:o,enumerable:!0}):e,o)),oQe=rQe((o,t)=>{"use strict";t.exports=e,t.exports.default=e;function e(L,B,N){N=N||2;var U=B&&B.length,k=U?B[0]*N:L.length,V=r(L,0,k,N,!0),Y=[];if(!V||V.next===V.prev)return Y;var X,Z,Q,ae,he,re,se;if(U&&(V=h(L,B,V,N)),L.length>80*N){X=Q=L[0],Z=ae=L[1];for(var K=N;K<k;K+=N)he=L[K],re=L[K+1],he<X&&(X=he),re<Z&&(Z=re),he>Q&&(Q=he),re>ae&&(ae=re);se=Math.max(Q-X,ae-Z),se=se!==0?32767/se:0}return n(V,Y,N,X,Z,se,0),Y}function r(L,B,N,U,k){var V,Y;if(k===W(L,B,N,U)>0)for(V=B;V<N;V+=U)Y=H(V,L[V],L[V+1],Y);else for(V=N-U;V>=B;V-=U)Y=H(V,L[V],L[V+1],Y);return Y&&E(Y,Y.next)&&(z(Y),Y=Y.next),Y}function i(L,B){if(!L)return L;B||(B=L);var N=L,U;do if(U=!1,!N.steiner&&(E(N,N.next)||C(N.prev,N,N.next)===0)){if(z(N),N=B=N.prev,N===N.next)break;U=!0}else N=N.next;while(U||N!==B);return B}function n(L,B,N,U,k,V,Y){if(L){!Y&&V&&g(L,U,k,V);for(var X=L,Z,Q;L.prev!==L.next;){if(Z=L.prev,Q=L.next,V?a(L,U,k,V):s(L)){B.push(Z.i/N|0),B.push(L.i/N|0),B.push(Q.i/N|0),z(L),L=Q.next,X=Q.next;continue}if(L=Q,L===X){Y?Y===1?(L=l(i(L),B,N),n(L,B,N,U,k,V,2)):Y===2&&c(L,B,N,U,k,V):n(i(L),B,N,U,k,V,1);break}}}}function s(L){var B=L.prev,N=L,U=L.next;if(C(B,N,U)>=0)return!1;for(var k=B.x,V=N.x,Y=U.x,X=B.y,Z=N.y,Q=U.y,ae=k<V?k<Y?k:Y:V<Y?V:Y,he=X<Z?X<Q?X:Q:Z<Q?Z:Q,re=k>V?k>Y?k:Y:V>Y?V:Y,se=X>Z?X>Q?X:Q:Z>Q?Z:Q,K=U.next;K!==B;){if(K.x>=ae&&K.x<=re&&K.y>=he&&K.y<=se&&T(k,X,V,Z,Y,Q,K.x,K.y)&&C(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function a(L,B,N,U){var k=L.prev,V=L,Y=L.next;if(C(k,V,Y)>=0)return!1;for(var X=k.x,Z=V.x,Q=Y.x,ae=k.y,he=V.y,re=Y.y,se=X<Z?X<Q?X:Q:Z<Q?Z:Q,K=ae<he?ae<re?ae:re:he<re?he:re,me=X>Z?X>Q?X:Q:Z>Q?Z:Q,Oe=ae>he?ae>re?ae:re:he>re?he:re,Ie=b(se,K,B,N,U),ue=b(me,Oe,B,N,U),Pe=L.prevZ,j=L.nextZ;Pe&&Pe.z>=Ie&&j&&j.z<=ue;){if(Pe.x>=se&&Pe.x<=me&&Pe.y>=K&&Pe.y<=Oe&&Pe!==k&&Pe!==Y&&T(X,ae,Z,he,Q,re,Pe.x,Pe.y)&&C(Pe.prev,Pe,Pe.next)>=0||(Pe=Pe.prevZ,j.x>=se&&j.x<=me&&j.y>=K&&j.y<=Oe&&j!==k&&j!==Y&&T(X,ae,Z,he,Q,re,j.x,j.y)&&C(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;Pe&&Pe.z>=Ie;){if(Pe.x>=se&&Pe.x<=me&&Pe.y>=K&&Pe.y<=Oe&&Pe!==k&&Pe!==Y&&T(X,ae,Z,he,Q,re,Pe.x,Pe.y)&&C(Pe.prev,Pe,Pe.next)>=0)return!1;Pe=Pe.prevZ}for(;j&&j.z<=ue;){if(j.x>=se&&j.x<=me&&j.y>=K&&j.y<=Oe&&j!==k&&j!==Y&&T(X,ae,Z,he,Q,re,j.x,j.y)&&C(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function l(L,B,N){var U=L;do{var k=U.prev,V=U.next.next;!E(k,V)&&O(k,U,U.next,V)&&D(k,V)&&D(V,k)&&(B.push(k.i/N|0),B.push(U.i/N|0),B.push(V.i/N|0),z(U),z(U.next),U=L=V),U=U.next}while(U!==L);return i(U)}function c(L,B,N,U,k,V){var Y=L;do{for(var X=Y.next.next;X!==Y.prev;){if(Y.i!==X.i&&I(Y,X)){var Z=F(Y,X);Y=i(Y,Y.next),Z=i(Z,Z.next),n(Y,B,N,U,k,V,0),n(Z,B,N,U,k,V,0);return}X=X.next}Y=Y.next}while(Y!==L)}function h(L,B,N,U){var k=[],V,Y,X,Z,Q;for(V=0,Y=B.length;V<Y;V++)X=B[V]*U,Z=V<Y-1?B[V+1]*U:L.length,Q=r(L,X,Z,U,!1),Q===Q.next&&(Q.steiner=!0),k.push(P(Q));for(k.sort(u),V=0;V<k.length;V++)N=d(k[V],N);return N}function u(L,B){return L.x-B.x}function d(L,B){var N=p(L,B);if(!N)return B;var U=F(N,L);return i(U,U.next),i(N,N.next)}function p(L,B){var N=B,U=L.x,k=L.y,V=-1/0,Y;do{if(k<=N.y&&k>=N.next.y&&N.next.y!==N.y){var X=N.x+(k-N.y)*(N.next.x-N.x)/(N.next.y-N.y);if(X<=U&&X>V&&(V=X,Y=N.x<N.next.x?N:N.next,X===U))return Y}N=N.next}while(N!==B);if(!Y)return null;var Z=Y,Q=Y.x,ae=Y.y,he=1/0,re;N=Y;do U>=N.x&&N.x>=Q&&U!==N.x&&T(k<ae?U:V,k,Q,ae,k<ae?V:U,k,N.x,N.y)&&(re=Math.abs(k-N.y)/(U-N.x),D(N,L)&&(re<he||re===he&&(N.x>Y.x||N.x===Y.x&&m(Y,N)))&&(Y=N,he=re)),N=N.next;while(N!==Z);return Y}function m(L,B){return C(L.prev,L,B.prev)<0&&C(B.next,L,L.next)<0}function g(L,B,N,U){var k=L;do k.z===0&&(k.z=b(k.x,k.y,B,N,U)),k.prevZ=k.prev,k.nextZ=k.next,k=k.next;while(k!==L);k.prevZ.nextZ=null,k.prevZ=null,y(k)}function y(L){var B,N,U,k,V,Y,X,Z,Q=1;do{for(N=L,L=null,V=null,Y=0;N;){for(Y++,U=N,X=0,B=0;B<Q&&(X++,U=U.nextZ,!!U);B++);for(Z=Q;X>0||Z>0&&U;)X!==0&&(Z===0||!U||N.z<=U.z)?(k=N,N=N.nextZ,X--):(k=U,U=U.nextZ,Z--),V?V.nextZ=k:L=k,k.prevZ=V,V=k;N=U}V.nextZ=null,Q*=2}while(Y>1);return L}function b(L,B,N,U,k){return L=(L-N)*k|0,B=(B-U)*k|0,L=(L|L<<8)&16711935,L=(L|L<<4)&252645135,L=(L|L<<2)&858993459,L=(L|L<<1)&1431655765,B=(B|B<<8)&16711935,B=(B|B<<4)&252645135,B=(B|B<<2)&858993459,B=(B|B<<1)&1431655765,L|B<<1}function P(L){var B=L,N=L;do(B.x<N.x||B.x===N.x&&B.y<N.y)&&(N=B),B=B.next;while(B!==L);return N}function T(L,B,N,U,k,V,Y,X){return(k-Y)*(B-X)>=(L-Y)*(V-X)&&(L-Y)*(U-X)>=(N-Y)*(B-X)&&(N-Y)*(V-X)>=(k-Y)*(U-X)}function I(L,B){return L.next.i!==B.i&&L.prev.i!==B.i&&!v(L,B)&&(D(L,B)&&D(B,L)&&w(L,B)&&(C(L.prev,L,B.prev)||C(L,B.prev,B))||E(L,B)&&C(L.prev,L,L.next)>0&&C(B.prev,B,B.next)>0)}function C(L,B,N){return(B.y-L.y)*(N.x-B.x)-(B.x-L.x)*(N.y-B.y)}function E(L,B){return L.x===B.x&&L.y===B.y}function O(L,B,N,U){var k=R(C(L,B,N)),V=R(C(L,B,U)),Y=R(C(N,U,L)),X=R(C(N,U,B));return!!(k!==V&&Y!==X||k===0&&_(L,N,B)||V===0&&_(L,U,B)||Y===0&&_(N,L,U)||X===0&&_(N,B,U))}function _(L,B,N){return B.x<=Math.max(L.x,N.x)&&B.x>=Math.min(L.x,N.x)&&B.y<=Math.max(L.y,N.y)&&B.y>=Math.min(L.y,N.y)}function R(L){return L>0?1:L<0?-1:0}function v(L,B){var N=L;do{if(N.i!==L.i&&N.next.i!==L.i&&N.i!==B.i&&N.next.i!==B.i&&O(N,N.next,L,B))return!0;N=N.next}while(N!==L);return!1}function D(L,B){return C(L.prev,L,L.next)<0?C(L,B,L.next)>=0&&C(L,L.prev,B)>=0:C(L,B,L.prev)<0||C(L,L.next,B)<0}function w(L,B){var N=L,U=!1,k=(L.x+B.x)/2,V=(L.y+B.y)/2;do N.y>V!=N.next.y>V&&N.next.y!==N.y&&k<(N.next.x-N.x)*(V-N.y)/(N.next.y-N.y)+N.x&&(U=!U),N=N.next;while(N!==L);return U}function F(L,B){var N=new G(L.i,L.x,L.y),U=new G(B.i,B.x,B.y),k=L.next,V=B.prev;return L.next=B,B.prev=L,N.next=k,k.prev=N,U.next=N,N.prev=U,V.next=U,U.prev=V,U}function H(L,B,N,U){var k=new G(L,B,N);return U?(k.next=U.next,k.prev=U,U.next.prev=k,U.next=k):(k.prev=k,k.next=k),k}function z(L){L.next.prev=L.prev,L.prev.next=L.next,L.prevZ&&(L.prevZ.nextZ=L.nextZ),L.nextZ&&(L.nextZ.prevZ=L.prevZ)}function G(L,B,N){this.i=L,this.x=B,this.y=N,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}e.deviation=function(L,B,N,U){var k=B&&B.length,V=k?B[0]*N:L.length,Y=Math.abs(W(L,0,V,N));if(k)for(var X=0,Z=B.length;X<Z;X++){var Q=B[X]*N,ae=X<Z-1?B[X+1]*N:L.length;Y-=Math.abs(W(L,Q,ae,N))}var he=0;for(X=0;X<U.length;X+=3){var re=U[X]*N,se=U[X+1]*N,K=U[X+2]*N;he+=Math.abs((L[re]-L[K])*(L[se+1]-L[re+1])-(L[re]-L[se])*(L[K+1]-L[re+1]))}return Y===0&&he===0?0:Math.abs((he-Y)/Y)};function W(L,B,N,U){for(var k=0,V=B,Y=N-U;V<N;V+=U)k+=(L[Y]-L[V])*(L[V+1]+L[Y+1]),Y=V;return k}e.flatten=function(L){for(var B=L[0][0].length,N={vertices:[],holes:[],dimensions:B},U=0,k=0;k<L.length;k++){for(var V=0;V<L[k].length;V++)for(var Y=0;Y<B;Y++)N.vertices.push(L[k][V][Y]);k>0&&(U+=L[k-1].length,N.holes.push(U))}return N}}),hve={mil:1,inch:1e3,ft:12e3,yard:36e3,mile:6336e4,km:3937007874e-2,dm:3937,mm:39.37,um:.039,nm:394e-7,pt:13.88888888888889,"px(72)":13.88888888888889,"px(96)":10.416666666666666,"px(100)":10},T4t=(()=>{let o={};for(let t in hve)o[hve[t]]=t;return o})(),uve=class{constructor(t,e){this.ratio=t/e}wrap(t){return t*this.ratio}static convert(t,e,r){return t*e/r}};uve.ASIS=new uve(1,1);var LZ=class{conversion(o,t,e){if(o===t)return e;let r=o+2+t;return this[r](e)}conversion1(o,t,e){let r=o+2+t,i=this[r](e);return t=="mil"?Math.round(i*10)/10:Math.round(i*1e3)/1e3}mil2mil(o){return o}mil2mm(o){return o*.0254}mil2cm(o){return o*.00254}mil2inch(o){return o/1e3}mm2mm(o){return o}mm2mil(o){let t=Math.pow(10,5);return Math.round(o*39.37007874015748*t)/t}mm2cm(o){return o/10}mm2inch(o){let t=Math.pow(10,8);return Math.round(o*.03937007874015748*t)/t}cm2mil(o){let t=Math.pow(10,6);return Math.round(o*393.7007874015748*t)/t}cm2mm(o){return o*10}cm2inch(o){let t=Math.pow(10,7);return Math.round(o*.3937007874015748*t)/t}inch2mil(o){return o*1e3}inch2mm(o){return o*25.4}inch2cm(o){return o*2.54}};LZ.prototype["px(100)2mil"]=o=>o*10;LZ.prototype["px(100)2mm"]=o=>o*.254;LZ.prototype["mil2px(100)"]=o=>o/10;LZ.prototype["mm2px(100)"]=o=>{let t=Math.pow(10,5);return Math.round(o*3.937007874015748*t)/t};var tZ=null,K1e=new ArrayBuffer(8),g1e=new Float64Array(K1e),y1e=new Uint32Array(K1e),dve=new Uint16Array(K1e),pve=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!tZ){let o=this.getUrlVars().version;o?tZ="/analyzer/v"+o:tZ="/analyzer"}return tZ}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;g1e[0]=new Date().getTime(),o.push(y1e[1].toString(16)),g1e[0]=Math.random(),o.push(dve[3].toString(16));let t=dve[2].toString(16);o.push("4"+t.substr(0,3)),g1e[0]=performance.now();let e=y1e[0].toString(16)+y1e[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},Xve=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(E7.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(E7.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(E7.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(E7.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},sQe=/(\.?0+)$/,E7=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(pve.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(pve.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);Xve.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(sQe,"")}};function aQe(o){switch(o){case 0:return"DEBUG";case 1:return"INFO";case 2:return"WARNING";case 3:return"ERROR";case 4:return"DUMMY"}}var lQe=(o,t)=>{o===3?console.error(t):console.log(t)},cQe=(o,t)=>E7.format("%s %s: %s",new Date,aQe(o),t),k1e=class B1e{constructor(t,e=lQe,r=cQe){this.debug=!1,this.level=t,this.writer=e,this.fmt=r}static mix(...t){let e=4;for(let r of t)r.level<e&&(e=r.level);return new B1e(e,(r,i)=>{for(let n of t)n.write1(r,i)},(r,i)=>i)}wrap(t=null,e=null){let r=t===null?this.fmt:(n,s)=>(s=t(n,s),this.fmt(n,s)),i=e===null?this.writer:(n,s)=>{e(n,s),this.writer(n,s)};return new B1e(this.level,i,r)}chain(t){return t.wrap(this.fmt.bind(this),this.writer.bind(this))}include(t){return this.level<=t}write3(t,e,r){this.include(t)&&this.writer(t,this.fmt(t,E7.format(e,...r)))}write2(t,e){this.include(t)&&(e instanceof Error?this.writer(t,this.fmt(t,e.stack)):this.writer(t,this.fmt(t,e.toString())))}write1(t,e){this.include(t)&&this.writer(t,this.fmt(t,e))}debug3(t,...e){this.write3(0,t,e)}debug2(t){this.write2(0,t)}debug1(t){this.write1(0,t)}info3(t,...e){this.write3(1,t,e)}info2(t){this.write2(1,t)}info1(t){this.write1(1,t)}warning3(t,...e){this.write3(2,t,e)}warning2(t){this.write2(2,t)}warning1(t){this.write1(2,t)}error3(t,...e){this.write3(3,t,e)}error2(t){this.write2(3,t)}error1(t){this.write1(3,t)}};k1e.DUMMY=new k1e(4);var MZ=k1e,Z1e=new ArrayBuffer(8),b1e=new Float64Array(Z1e),P1e=new Uint32Array(Z1e),fve=new Uint16Array(Z1e),mve=ArrayBuffer;try{mve=self.HTMLImageElement||mve}catch{}var rZ=null;function gL(o,t,e=0,r=o.length){i(o,null,t,e,r);function i(s,a,l,c,h){let u,d,p,m;if(c<h-1){let g=h-c;if(g>50)a===null&&(a=new Array(g+1)),n(s,a,l,c,(c+h)/2|0,h);else{u=s[c],d=c,p=c,m=h;let y=d+1;for(;y<m;){if(p!=m){if(m=m+-1,l(u,s[m])<=0)continue;s[p]=s[m],p=m;continue}if(l(u,s[y])>=0){d=y,y=d+1;continue}s[p]=s[y],d=y,p=y,y=d+1}s[p]=u,i(s,a,l,c,p),i(s,a,l,p+1,h)}}}function n(s,a,l,c,h,u){i(s,a,l,c,h),i(s,a,l,h,u);for(var d=c,p=h,m=0,g=s[d],y=s[p];d<h&&p<u;){var b=l(g,y);isNaN(b)?(a[m++]=y,y=s[++p]):(b<=0&&(a[m++]=g,g=s[++d]),b>=0&&(a[m++]=y,y=s[++p]))}for(;d<h;d++)a[m++]=s[d];for(;p<u;p++)a[m++]=s[p];for(d=c,p=0;p<m;d++,p++)s[d]=a[p]}}var m1=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!rZ){let o=this.getUrlVars().version;o?rZ="/analyzer/v"+o:rZ="/analyzer"}return rZ}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;b1e[0]=new Date().getTime(),o.push(P1e[1].toString(16)),b1e[0]=Math.random(),o.push(fve[3].toString(16));let t=fve[2].toString(16);o.push("4"+t.substr(0,3)),b1e[0]=performance.now();let e=P1e[0].toString(16)+P1e[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},hQe=[1,10,100,1e3],iZ=0,uL=0;function gve(o,t,e){return iZ=Math.abs(o-t),e>=5&&iZ>1e-5||isNaN(e)&&iZ>1e-8?!1:iZ<1e-13?!0:(uL=Math.min(yve(o),yve(t)),uL<10&&(uL=10),isNaN(e)||(uL=Math.min(uL,e)),bve(o,uL)===bve(t,uL))}var nZ=0,oZ=0;function yve(o){return nZ=0,oZ=0,o>0?nZ=o-Math.floor(o):nZ=o-Math.ceil(o),oZ=(nZ.toString()||"").length,oZ>2?oZ-2:0}function bve(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=hQe[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}var uQe=/(\.?0+)$/,O7=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(m1.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(m1.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);rl.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(uQe,"")}},rl=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(O7.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(O7.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(O7.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(O7.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},mr=class{static regular(o){return Math.round(o*this.precision)/this.precision}static eq(o,t){return Math.abs(o-t)<=this.eps}static neq(o,t){return Math.abs(o-t)>this.eps}static less(o,t){return o-t<-this.eps}static lesseq(o,t){return o-t<=this.eps}static greater(o,t){return o-t>this.eps}static greatereq(o,t){return o-t>=-this.eps}static sqrt(o){return Math.abs(o)<=1e-10?0:Math.sqrt(o)}static sortAsc(o,t){return o-t}static sortDesc(o,t){return t-o}};mr.eps=1e-8,mr.precision=1e8;function _7(o,t){CZ(o.iterator(),t)}function CZ(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var dQe=class{constructor(o){this.idx=-1,this.lst=o}hasNext(){return this.idx<this.lst.length-1}next(){if(this.idx<this.lst.length-1)return this.idx++,this.lst[this.idx];throw new Error("bug")}};function F1e(o){return new dQe(o)}var gZ=class VP{static toDegrees(t){return t*180/Math.PI}static toRadians(t){return t/180*Math.PI}static regularD(t){return t=t%360,t=t<0?360+t:t,t===360?0:t}static regular(t){return t=t%VP.PIx2,t=t<0?VP.PIx2+t:t,t===VP.PIx2?0:t}static toQuarterBase(t){return VP.regular((t+VP.PI_4)/VP.PI_2*VP.PI_2)}static toQuarterBaseD(t){return VP.regularD(((t+45)/90|0)*90)}static transformD(t,e){return VP.toDegrees(VP.transform(VP.toRadians(t),e))}static transform(t,e){let r=Math.cos(t),i=Math.sin(t),n=new S(e.data[6],e.data[7]),s=new S(r,i).multiply3(e);return VP.regular(s.angle(n))}};gZ.PIx2=Math.PI*2,gZ.PI_2=Math.PI/2,gZ.PI_4=Math.PI/4;var To=gZ,Up=class{static dotProd1(o,t,e,r){return o*e+t*r}static dotProd2(o,t,e,r,i,n){return this.dotProd1(e-o,r-t,i-e,n-r)}static dotProd3(o,t,e){return this.dotProd2(o.x,o.y,t.x,t.y,e.x,e.y)}static crossProd1(o,t,e,r){return o*r-t*e}static crossProd2(o,t,e,r,i,n){return this.crossProd1(e-o,r-t,i-e,n-r)}static crossProd3(o,t,e){return this.crossProd2(o.x,o.y,t.x,t.y,e.x,e.y)}static distance2(o,t,e,r){let i=e-o,n=r-t;return i*i+n*n}static distance1(o,t,e,r){return this.hypot(e-o,r-t)}static distance1p(o,t){return this.distance1(o.x,o.y,t.x,t.y)}static hypot(o,t){if(o=Math.abs(o),t=Math.abs(t),t>o){var e=t;t=o,o=e}if(o===0)return t;var r=t/o;return o*Math.sqrt(1+r*r)}},qve=new ArrayBuffer(16),Pve=new Float64Array(qve),sZ=new Int32Array(qve),dL=class gu{static sortByXAsc(t,e){return t.x-e.x}static sortByYAsc(t,e){return t.y-e.y}static sortByXYAsc(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y-e.y}static caculateAngle(t,e){let r=Math.cos(t),i=Math.sin(t),n=r*e.data[0]+i*e.data[4],s=r*e.data[1]+i*e.data[5],a=new gu(n,s).normalize();return Math.atan2(a.y,a.x)}static normal(t,e,r){let i=e.sub(t),n=r.sub(e);return i.cross(n)}static getVector2(t){return new gu(Math.cos(t),Math.sin(t))}static getCrossPoint1(t,e,r,i){if(t.equals1(e)||r.equals1(i)||mr.eq(1,Math.abs(e.sub(t).normalize().dot(i.sub(r).normalize()))))return null;let n=e.y-t.y,s=t.x-e.x,a=e.x*t.y-t.x*e.y,l=i.y-r.y,c=r.x-i.x,h=i.x*r.y-r.x*i.y,u=n*c-l*s;return new gu((h*s-a*c)/u,(a*l-h*n)/u)}static getCrossPoint2(t,e,r,i){return this.getCrossPoint1(t,t.add(e),r,r.add(i))}constructor(t,e){this.x=rl.normal(t),this.y=rl.normal(e)}get hashed(){return this._hashed==null&&(Pve[0]=this.x,Pve[1]=this.y,this._hashed=sZ[0]^sZ[1]^sZ[2]^sZ[3]),this._hashed}dot(t){return this.x*t.x+this.y*t.y}length(){return Math.sqrt(this.dot(this))}getCos(){return this.x/this.length()}sub(t){var e=this.x-t.x,r=this.y-t.y;return new gu(e,r)}add(t){var e=this.x+t.x,r=this.y+t.y;return new gu(e,r)}div(t){return new gu(this.x/t,this.y/t)}add1(t,e){return new gu(this.x+t,this.y+e)}mul(t){return new gu(this.x*t,this.y*t)}cross(t){return this.x*t.y-this.y*t.x}getSin(){return this.y/this.length()}angle2(t){let e=this.y-t.y,r=this.x-t.x;return e=Math.abs(e-0)<10**-4?0:e,r=Math.abs(r-0)<10**-4?0:r,Math.atan2(e,r)}angleD2(t){return To.toDegrees(this.angle2(t))}angle(t){return Math.atan2(this.y-t.y,this.x-t.x)}angleX(t=gu.ORIGIN){let e=this.angle(t);return e<0&&(e=Math.PI*2+e),e}angleD(t){return To.toDegrees(this.angle(t))}distance1(t){let e=t.x-this.x,r=t.y-this.y;return Up.hypot(e,r)}distance2(t){let e=t.x-this.x,r=t.y-this.y;return e*e+r*r}rotateD(t,e){return this.rotate(t,To.toRadians(e))}rotate(t,e){let r=Math.cos(e),i=Math.sin(e),n=this.x-t.x,s=this.y-t.y,a=n*r+s*-i,l=n*i+s*r;return t.add1(a,l)}multiply3(t){let e=this.x*t.data[0]+this.y*t.data[3]+t.data[6],r=this.x*t.data[1]+this.y*t.data[4]+t.data[7];return new gu(e,r)}multiply4(t){let e=this.x*t.data[0]+this.y*t.data[4]+t.data[12],r=this.x*t.data[1]+this.y*t.data[5]+t.data[13];return new gu(e,r)}hashCode(){return this.hashed}equals(t,e){return t instanceof gu?gve(t.x,this.x,e)&&gve(t.y,this.y,e):!1}equals1(t){return t?mr.eq(this.x,t.x)&&mr.eq(this.y,t.y):!1}equals2(t,e){return t instanceof gu?Math.abs(this.x-t.x)<=e&&Math.abs(this.y-t.y)<=e:!1}similarEquals(t,e=.5){return Math.abs(this.x*.1-t.x*.1)<=e&&Math.abs(this.y*.1-t.y*.1)<=e}toString(){return"Vector [X="+this.x+", Y="+this.y+"]"}bbox(){let t=this.x,e=this.y;return new ut(t,t,e,e)}normalize(){if(this.x===0&&this.y===0)return new gu(0,0);let t=this.x/this.length(),e=this.y/this.length();return new gu(t,e)}regular(t=1e-4){let e=Math.round(1/t);return new gu(Math.round(this.x*e)/e,Math.round(this.y*e)/e)}round(t=4){let e=10**(t|0);return new gu(Math.round(this.x*e)/e,Math.round(this.y*e)/e)}mirrorX(t=gu.ORIGIN){return new gu(this.x,2*t.y-this.y)}mirrorY(t=gu.ORIGIN){return new gu(2*t.x-this.x,this.y)}mirrorCenter(t=gu.ORIGIN){return new gu(2*t.x-this.x,2*t.y-this.y)}clone(){return new gu(this.x,this.y)}mirror(t=gu.ORIGIN){return new gu(2*t.x-this.x,2*t.y-this.y)}pointOnRays(t,e){let r=To.toRadians(t);return new gu(this.x+Math.cos(r)*e,this.y+Math.sin(r)*e)}pointOnRays2(t,e){let r=t.angle(this);return new gu(this.x+Math.cos(r)*e,this.y+Math.sin(r)*e)}scale(t){return new gu(this.x*t,this.y*t)}};dL.ORIGIN=new dL(0,0),dL.X_UNIT_VECTOR=new dL(1,0),dL.Y_UNIT_VECTOR=new dL(0,1);var S=dL,J1e=(o=>(o[o.LEFT=0]="LEFT",o[o.CENTER=1]="CENTER",o[o.RIGHT=2]="RIGHT",o))(J1e||{}),yy=(o=>(o[o.TOP=0]="TOP",o[o.CENTER=1]="CENTER",o[o.BOTTOM=2]="BOTTOM",o))(yy||{}),Wm=class{constructor(t,e){this.horizontal=t,this.vertical=e}};Wm.LT=new Wm(0,0),Wm.LC=new Wm(0,1),Wm.LB=new Wm(0,2),Wm.CT=new Wm(1,0),Wm.CC=new Wm(1,1),Wm.CB=new Wm(1,2),Wm.RT=new Wm(2,0),Wm.RC=new Wm(2,1),Wm.RB=new Wm(2,2);var jm=Wm,_e=class{constructor(){this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY}ext1(o){return this.minX=Math.min(this.minX,o.minX),this.maxX=Math.max(this.maxX,o.maxX),this.minY=Math.min(this.minY,o.minY),this.maxY=Math.max(this.maxY,o.maxY),this}ext2(o){return this.minX=Math.min(this.minX,o.x),this.maxX=Math.max(this.maxX,o.x),this.minY=Math.min(this.minY,o.y),this.maxY=Math.max(this.maxY,o.y),this}ext3(o){for(let t=0;t<o.length;t++){let e=o[t];this.ext2(e)}return this}ext4(o){return _7(o,(t,e)=>(this.ext2(e),!0)),this}ext5(o,t,e,r){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,t),this.minY=Math.min(this.minY,e),this.maxY=Math.max(this.maxY,r),this}ext6(o,t){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,o),this.minY=Math.min(this.minY,t),this.maxY=Math.max(this.maxY,t),this}ext7(o){if(o<0){let t=o*2;if(t<this.minX-this.maxX||t<this.minY-this.maxY)throw new Error("")}return this.minX-=o,this.maxX+=o,this.minY-=o,this.maxY+=o,this}ext8(o){let t=[];for(let e=0;e<o.length;e+=2)t.push(new S(o[e],o[e+1]));return this.ext3(t)}ext9(o,t,e,r){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,o+e),this.minY=Math.min(this.minY,t),this.maxY=Math.max(this.maxY,t+r),this}ext10({x:o,y:t,width:e,height:r}){return this.ext9(o,t,e,r)}valid(){return isFinite(this.minX)&&isFinite(this.maxX)&&isFinite(this.minY)&&isFinite(this.maxY)}clear(){this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY}build(){return new ut(this.minX,this.maxX,this.minY,this.maxY)}build1(){return this.valid()?new ut(this.minX,this.maxX,this.minY,this.maxY):new ut(0,0,0,0)}},vH=new Float64Array(4),ut=class uI{static extendRect({x:t,y:e,width:r,height:i}){return new uI(t,t+r,e,e+i)}static extend1(t,e){if(t===null)return new uI(e.x,e.x,e.y,e.y);{let r=Math.min(t.minX,e.x),i=Math.max(t.maxX,e.x),n=Math.min(t.minY,e.y),s=Math.max(t.maxY,e.y);return new uI(r,i,n,s)}}static extend2(t,e){if(t){let r=Math.min(t.minX,e.minX),i=Math.max(t.maxX,e.maxX),n=Math.min(t.minY,e.minY),s=Math.max(t.maxY,e.maxY);return new uI(r,i,n,s)}else return e}static extend3(t,e){let r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),n=Math.min(t.y,e.y),s=Math.max(t.y,e.y);return new uI(r,i,n,s)}static extend4(t,e,r){return new uI(t.x-e/2,t.x+e/2,t.y-r/2,t.y+r/2)}constructor(t,e,r,i){if(this.minX=rl.normal(t),this.maxX=rl.normal(e),this.minY=rl.normal(r),this.maxY=rl.normal(i),t>e||r>i)throw new Error(`min > max is not permitted: [${t}, ${e}, ${r}, ${i}]`)}get data(){return vH[0]=this.minX,vH[1]=this.maxX,vH[2]=this.minY,vH[3]=this.maxY,vH}isContains(t){return this.isContains1(t.x,t.y)}points(){return[this.LL(),this.LR(),this.UR(),this.UL(),this.LL()]}isContains1(t,e){return this.isContainsX(t)&&this.isContainsY(e)}isContains2(t,e){return this.isContainsX1(t)&&this.isContainsY1(e)}isContainsX(t){return t>=this.minX&&t<=this.maxX}isContainsX1(t){return mr.greatereq(t,this.minX)&&mr.lesseq(t,this.maxX)}isContainsY(t){return t>=this.minY&&t<=this.maxY}isContainsY1(t){return mr.greatereq(t,this.minY)&&mr.lesseq(t,this.maxY)}isIntersect(t){return!(this.maxX<t.minX||this.minX>t.maxX||this.maxY<t.minY||this.minY>t.maxY)}extendOfSize(t){return rl.positiveOr0(this.maxX-this.minX+t*2),rl.positiveOr0(this.maxY-this.minY+t*2),new uI(this.minX-t,this.maxX+t,this.minY-t,this.maxY+t)}isInside(t){return this.minX>=t.minX&&this.maxX<=t.maxX&&this.minY>=t.minY&&this.maxY<=t.maxY}isContainsBBox(t){return this.maxX>=t.maxX&&this.minX<=t.minX&&this.maxY>=t.maxY&&this.minY<=t.minY}isContainsBBox1(t){return mr.greatereq(this.maxX,t.maxX)&&mr.lesseq(this.minX,t.minX)&&mr.greatereq(this.maxY,t.maxY)&&mr.lesseq(this.minY,t.minY)}intersect(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX);if(e>r)return null;let i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY);return i>n?null:new uI(e,r,i,n)}intersection1(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX);if(mr.greater(e,r))return null;e>r&&(r=e);let i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY);return mr.greater(i,n)?null:(i>n&&(n=i),new uI(e,r,i,n))}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}UL(){return new S(this.minX,this.maxY)}UR(){return new S(this.maxX,this.maxY)}LL(){return new S(this.minX,this.minY)}LR(){return new S(this.maxX,this.minY)}center(){return new S(this.maxX-(this.maxX-this.minX)/2,this.maxY-(this.maxY-this.minY)/2)}area(){return this.width()*this.height()}transform(t){let e=new _e;return e.ext2(this.LL().multiply3(t)),e.ext2(this.LR().multiply3(t)),e.ext2(this.UR().multiply3(t)),e.ext2(this.UL().multiply3(t)),e.build()}transform4(t){let e=new _e;return e.ext2(this.LL().multiply4(t)),e.ext2(this.LR().multiply4(t)),e.ext2(this.UR().multiply4(t)),e.ext2(this.UL().multiply4(t)),e.build()}isSeparated(t){if(t==null||t==null)return!1;let e;this.minX>=t.minX?e=this.minX:e=t.minX;let r;if(this.maxX<=t.maxX?r=this.maxX:r=t.maxX,e>r)return!0;{let i;this.minY>=t.minY?i=this.minY:i=t.minY;let n;return this.maxY<=t.maxY?n=this.maxY:n=t.maxY,i>n}}relation(t){let e=0,r=0,i;this.minX>t.minX?(e++,i=this.minX):this.minX===t.minX?i=this.minX:(r++,i=t.minX);let n;if(this.maxX<t.maxX?(e++,n=this.maxX):this.maxX===t.maxX?n=this.maxX:(r++,n=t.maxX),i>n)return 2;{let s;this.minY>t.minY?(e++,s=this.minY):this.minY===t.minY?s=this.minY:(r++,s=t.minY);let a;return this.maxY<t.maxY?(e++,a=this.maxY):this.maxY===t.maxY?a=this.maxY:(r++,a=t.maxY),s>a?2:e===4?0:r===4?1:e===0&&r===0?4:i===n||s===a?6:e!==r?5:3}}zoom(t){let e=this.width(),r=this.height(),i=this.center();return t!=0&&(e/=t/2,r/=t/2),new uI(i.x-e,i.x+e,i.y-e,i.y+e)}toString(){return"BBox [minX="+this.minX+", maxX="+this.maxX+", minY="+this.minY+", maxY="+this.maxY+"]"}equals(t){return this.minY==t.minY&&this.minX==t.minX&&this.maxX==t.maxX&&this.maxY==t.maxY}extendSize(t,e){return Object.is(void 0,e)&&(e=t),uI.extend4(this.center(),this.width()+t,this.height()+e)}positionOnBBox(t,e=0){let r=this.center(),i=this.width()*e/2,n=this.height()*e/2,s=t.x-r.x,a=t.y-r.y;return s>i?a>n?jm.RT:a<-n?jm.RB:jm.RC:s<-i?a>n?jm.LT:a<-n?jm.LB:jm.LC:a>n?jm.CT:a<-n?jm.CB:jm.CC}bbox(){return this}},SZ=class _l{static mul(t,e,r,i,n,s){let a=0,l=0;for(let c=0;c<t;c++){for(let h=0;h<r;h++){let u=h,d=0;for(let p=0;p<e;p++)d+=i[l+p]*n[u],u+=r;s[a++]=d}l+=e}}constructor(t,e,r){this.m=rl.normal(t),this.n=rl.normal(e);let i=t*e;if(r.length===i){for(let n=0;n<r.length;n++)rl.normal(r[n]);this.data=r}else throw new Error("invalid matrix size")}mul(t){if(this.n===t.m){let e=new Array(this.m*t.n);return _l.mul(this.m,this.n,t.n,this.data,t.data,e),new _l(this.m,t.n,e)}else throw new Error("m !== p")}toString(){let t=[];t.push("Matrix ("),t.push(this.m.toString()),t.push(" x "),t.push(this.n.toString()),t.push(")");let e=0;for(let r=0;r<this.m;r++)for(let i=0;i<this.n;i++){let n=this.data[e++].toString();i===0?(t.push(`
`),t.push("	"),t.push(n)):(t.push(", "),t.push(n))}return t.join("")}static on(t,e,r){return t*e+r}initExpandMatrix(t){let e=this.m,r=this.n,i=r*2,n=new Array(e*i);for(let s=0;s<e;s++)for(let a=0;a<i;a++)a<r?n[_l.on(i,s,a)]=t[_l.on(r,s,a)]:a===e+s?n[_l.on(i,s,a)]=1:n[_l.on(i,s,a)]=0;return n}inverseMatrix(t,e,r){for(let i=0;i<e;i++){let n=t[_l.on(r,i,i)];for(let s=0;s<r;s++)t[_l.on(r,i,s)]/=n}return t}getMatrixRank(t,e,r){let i=Math.min(e,r);for(let n=0;n<e;n++){if(t[_l.on(r,n,n)]===0){let s=new Array(r),a;for(a=n;a<e;a++)if(t[_l.on(r,a,n)]!==0){m1.arraycopy(t,_l.on(r,a,0),s,0,r),m1.arraycopy(t,_l.on(r,n,0),t,_l.on(r,a,0),r),m1.arraycopy(s,0,t,_l.on(r,n,0),r);break}a>=e&&(i-=1)}if(!(i<e))for(let s=0;s<e;s++){if(s===n)continue;let a=t[_l.on(r,s,n)]/t[_l.on(r,n,n)];for(let l=0;l<r;l++)t[_l.on(r,s,l)]-=t[_l.on(r,n,l)]*a}}return i}getInverseMatrix(){if(this.m!==this.n)throw new Error("The matrix is an "+this.m+"x"+this.n+" order matrix, non-square matrix, please check!");function t(s){return mr.lesseq(Math.abs(s),0)}let e=this.initExpandMatrix(this.data.slice(0)),r=this.n*2;function i(s,a){for(let l=0;l<r;l++){let c=e[_l.on(r,s,l)];e[_l.on(r,s,l)]=e[_l.on(r,a,l)],e[_l.on(r,a,l)]=c}}for(let s=0;s<this.m;s++){let a=Math.abs(e[_l.on(r,s,s)]),l=s;if(t(e[_l.on(r,s,s)]))for(let h=s+1;h<this.m;h++){if(t(e[_l.on(r,h,s)])){Math.abs(e[_l.on(r,h,s)])>a&&(a=Math.abs(e[_l.on(r,h,s)]),l=h);continue}i(s,h);break}if(t(e[_l.on(r,s,s)])){if(a===0)throw new Error("The matrix is a non-full rank matrix, please check!");console.warn("The matrix may be a non-full rank matrix, please check!"),l!==s&&i(s,l)}let c=1/e[_l.on(r,s,s)];for(let h=0;h<r;h++)e[_l.on(r,s,h)]*=c;for(let h=0;h<this.m;h++){if(s===h)continue;let u=e[_l.on(r,h,s)];for(let d=s;d<r;d++)e[_l.on(r,h,d)]-=e[_l.on(r,s,d)]*u}}let n=[];for(let s=0;s<this.m;s++)for(let a=this.n;a<r;a++)n[_l.on(this.n,s,a-this.n)]=e[_l.on(r,s,a)];return new _l(this.m,this.n,n)}getTransposeMatrix(){let t=new Array(this.data.length);for(let e=0;e<this.m;e++)for(let r=0;r<this.n;r++)t[r*this.n+e]=this.data[e*this.m+r];return new _l(this.n,this.m,t)}hashCode(){let t=0;for(let e of this.data)t+=e;return t}equals(t){return this===t?!0:t===null?!1:t instanceof _l?!(this.m!=t.m||this.n!=t.n||!m1.equals(this.data,t.data)):!1}},pQe=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],V1e=class hp extends SZ{static translate(t,e,r){return new hp([1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1])}static translate1(t){return new hp([1,0,0,0,0,1,0,0,0,0,1,0,t.x,t.y,t.z,1])}static rotateX(t){let e=Math.cos(t),r=Math.sin(t);return new hp([1,0,0,0,0,e,r,0,0,-r,e,0,0,0,0,1])}static rotateY(t){let e=Math.cos(t),r=Math.sin(t);return new hp([e,0,-r,0,0,1,0,0,r,0,e,0,0,0,0,1])}static rotateZ(t){let e=Math.cos(t),r=Math.sin(t);return new hp([e,r,0,0,-r,e,0,0,0,0,1,0,0,0,0,1])}static rotateAxis(t,e){t=t.normalize();let r=t.x,i=t.y,n=t.z,s=Math.sin(e),a=Math.cos(e);return new hp([r*r*(1-a)+a,r*i*(1-a)+n*s,r*n*(1-a)-i*s,0,r*i*(1-a)-n*s,i*i*(1-a)+a,i*n*(1-a)+r*s,0,r*n*(1-a)+i*s,i*n*(1-a)-r*s,n*n*(1-a)+a,0,0,0,0,1])}static scale(t,e=t,r=t){return new hp([t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1])}static flipX(){return new hp([1,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,1])}static flipY(){return new hp([-1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static rotateZForPoint(t,e){return t.equals1(S.ORIGIN)?hp.rotateZ(e):hp.translate(-t.x,-t.y,0).rotateZ(e).translate1(t.x,t.y,0)}static getMatrix4(t,e,r,i){let n=Math.cos(e),s=Math.sin(e),a=r*(t.x*n-t.y*s)+i.x,l=t.x*s+t.y*n+i.y,c=[r*n,s,0,0,-s*r,n,0,0,0,0,1,0,a,l,0,1];return new hp(c)}constructor(t=pQe){super(4,4,t)}translate(t){return this.multiply4(hp.translate1(t))}translate1(t,e,r){return this.multiply4(hp.translate(t,e,r))}rotateX(t){return this.multiply4(hp.rotateX(t))}rotateY(t){return this.multiply4(hp.rotateY(t))}rotateZ(t){return this.multiply4(hp.rotateZ(t))}scale(t,e=t,r=t){return this.multiply4(hp.scale(t,e,r))}scale1(t){return this.multiply4(hp.scale(t.x,t.y,t.z))}setOrigin(t,e,r){return hp.translate(-t,-e,-r).multiply4(this).translate1(t,e,r)}setOrigin1(t){return this.setOrigin(t.x,t.y,t.z)}multiply4(t){let e=new Array(16);return SZ.mul(4,4,4,this.data,t.data,e),new hp(e)}getInverseMatrix(){let t=super.getInverseMatrix();return new hp(t.data)}getTransposeMatrix(){let t=super.getTransposeMatrix();return new hp(t.data)}inverse(){let t=this.getInverseMatrix();return new hp(t.data)}toMatrix3(){let t=this.data;return new Qe([t[0],t[1],0,t[4],t[5],0,t[12],t[13],1])}};V1e.ORIGIN=new V1e;var Ae=V1e;function xH(o){return Xve.normal(parseFloat(o))}var fQe=[1,0,0,0,1,0,0,0,1],rS=class zm extends SZ{static translate(t,e){return new zm([1,0,0,0,1,0,t,e,1])}static translate1(t){return this.translate(t.x,t.y)}static rotate(t){let e=Math.cos(t),r=Math.sin(t);return new zm([e,r,0,-r,e,0,0,0,1])}static rotateD(t){return this.rotate(To.toRadians(t))}static scale(t,e=t){return new zm([t,0,0,0,e,0,0,0,1])}static scale1(t,e){return new zm([t,0,0,0,e,0,0,0,1])}static toDOMMatrix(t){let[e,r,,i,n,,s,a]=t.data;return`matrix(${[e,r,i,n,s,a].join(",")})`}static svgTrasform(t){let e=t.split(" "),r=null;return e.forEach(i=>{i=i.trim();let n=i.trim().replace(")","").split("("),s=n[0],a=n[1].split(",");switch(s){case"translate":let l=xH(a[0]),c=xH(a[1]);r=r?r.translate(l,c):zm.translate(l,c);break;case"rotate":let h=xH(a[0]),u=xH(a[1]),d=xH(a[2]);r=r?r.setOrigin(u,d):zm.translate(u,d),r=r.rotateD(h);break;default:return}}),r}constructor(t=fQe){super(3,3,t);let e=t[0],r=t[3],i=t[1],n=t[4];this.iScale=Math.sqrt(e*e+i*i),this.jScale=Math.sqrt(r*r+n*n)}isMirrored(){return this.det()<0}multiply3(t){let e=new Array(9);return SZ.mul(3,3,3,this.data,t.data,e),new zm(e)}translate(t,e){return this.multiply3(zm.translate(t,e))}translate1(t){return this.multiply3(zm.translate1(t))}scale(t,e=t){return this.multiply3(zm.scale(t,e))}scale1(t,e){return this.multiply3(zm.scale1(t,e))}det(){return this.data[0]*this.data[4]-this.data[3]*this.data[1]}invert(){let t=this.getInverseMatrix();return new zm(t.data)}rotateD(t){return this.multiply3(zm.rotateD(t))}rotate(t){return this.multiply3(zm.rotate(t))}resetOffset(){let t=this.data;return new zm([t[0],t[1],0,t[3],t[4],0,0,0,1])}setOrigin(t,e){return zm.translate(-t,-e).multiply3(this).translate(t,e)}setOrigin1(t){return this.setOrigin(t.x,t.y)}getInverseMatrix(){return new zm(super.getInverseMatrix().data)}getTransposeMatrix(){let t=super.getTransposeMatrix();return new zm(t.data)}toMatrix4(){let t=this.data;return new Ae([t[0],t[1],0,t[2],t[3],t[4],0,t[5],0,0,1,0,t[6],t[7],0,t[8]])}scaleNum(t){return!t||isNaN(t)?t:t*this.iScale}};rS.ORIGIN=new rS,rS.MIRROR_Y=new rS([1,0,0,0,-1,0,0,0,1]),rS.MIRROR_X=new rS([-1,0,0,0,1,0,0,0,1]),rS.ROT_90=new rS([0,1,0,-1,0,0,0,0,1]),rS.ROT_N90=new rS([0,-1,0,1,0,0,0,0,1]);var Qe=rS,kr=(o=>(o[o.BUTT=0]="BUTT",o[o.ROUND=1]="ROUND",o[o.SQUARE=2]="SQUARE",o))(kr||{}),le=(o=>(o[o.CW=0]="CW",o[o.CCW=1]="CCW",o))(le||{}),Tl=class{},CO=class LH{constructor(t,e,r){this.p1=t,this.p2=e,this.p3=r}barycentre(){return LH.barycentre(this.p1,this.p2,this.p3)}incentre(){return LH.incentre(this.p1,this.p2,this.p3)}static barycentre(t,e,r){let i=t.x+e.x+r.x,n=t.y+e.y+r.y;return new S(i/3,n/3)}static incentre(t,e,r){let i=e.sub(r).length(),n=t.sub(r).length(),s=t.sub(e).length(),a=i+n+s,l=i*t.x+n*e.x+s*r.x,c=i*t.y+n*e.y+s*r.y;return new S(l/a,c/a)}area(){return LH.area(this.p1,this.p2,this.p3)}static area(t,e,r){return this.area2(t.x,t.y,e.x,e.y,r.x,r.y)/2}static area2(t,e,r,i,n,s){return Math.abs(Up.crossProd2(t,e,r,i,n,s))}scale(t,e){let r=Qe.translate(-t.x,-t.y).scale(e).translate1(t),i=this.p1.multiply3(r),n=this.p2.multiply3(r),s=this.p3.multiply3(r);return new LH(i,n,s)}scaleOnBarycentre(t){return this.scale(this.barycentre(),t)}scaleOnIncentre(t){return this.scale(this.incentre(),t)}extend(t){let e=this.incentre(),r=this.p1.add(this.p2).sub(e).scale(1/2),i=r.length(),n=S.ORIGIN.pointOnRays2(r,i+t).length()/i;return this.scaleOnIncentre(n)}container(t){let e=this.p3.sub(this.p1),r=this.p2.sub(this.p1),i=t.sub(this.p1),n=e.dot(e),s=e.dot(r),a=e.dot(i),l=r.dot(r),c=r.dot(i),h=1/(n*l-s*s),u=(l*a-s*c)*h;if(u<0||u>1)return!1;let d=(n*c-s*a)*h;return d<0||d>1?!1:u+d<=1}};function aZ(){return{minDistance:Number.POSITIVE_INFINITY,start:null,end:null}}var ir=class uv{static getMinDistanceWithoutCross(t,e){let r=aZ();return uv.minLine(t,e,r),r.minDistance}static getMinDistance(t,e){return Pf(t,e)?0:this.getMinDistanceWithoutCross(t,e)}static getMinLineWithCross(t,e){let r=aZ();return uv.minLine(t,e,r),new M(r.start,r.end)}static getMinLine(t,e){return uv.intersection(t,e)||this.getMinLineWithCross(t,e)}static getMinDistanceFromPoint(t,e){let r=aZ();if(e instanceof M)this.point2LineMinLine(r,e,t);else if(e instanceof q)this.point2ArcMinDistance(t,e,r);else throw new Error("not support");return r.minDistance}constructor(t,e){if(this.pt1=t,this.pt2=e,this.minline=uv.intersection(t,e),this.minline)this.minDistance=0;else{let r=aZ();uv.minLine(t,e,r),this.minline=new M(r.start,r.end),this.minDistance=r.minDistance}}getDistance(){return this.minDistance}getLine(){return this.minline}static intersection(t,e){let r=Pf(t,e);if(r===0)return;let i=new Array;for(let n=0;n<r;n+=2){let s=new S(Ke[n],Ke[n+1]);i.push(s)}return i.length>1?new M(i[0],i[1]):new M(i[0],i[0])}static minLine(t,e,r){if(t instanceof M&&e instanceof M)return this.minDistanceForLines(t,e,r);if(t instanceof q&&e instanceof M)return this.minDistanceForLineAndArc(t,e,r);if(t instanceof M&&e instanceof q)return this.minDistanceForLineAndArc(e,t,r);if(t instanceof q&&e instanceof q)return this.minDistanceForArcs(t,e,r);throw new Error("not support")}static minDistanceForLines(t,e,r){[t.start(),t.end(),e.start(),e.end()].forEach((i,n)=>{n<2?this.point2LineMinLine(r,e,i):this.point2LineMinLine(r,t,i)})}static minDistanceForLineAndArc(t,e,r){this.point2LineMinLine(r,e,t.start()),this.point2LineMinLine(r,e,t.svgEnd);let i=uv.foot(e,t.center);e.bbox().extendOfSize(1e-8).isContains(i)&&this.point2ArcMinLine(r,t,i),this.point2ArcMinLine(r,t,e.start()),this.point2ArcMinLine(r,t,e.end())}static minDistanceForArcs(t,e,r){this.concentricArc(t,e,r),this.point2ArcMinDistance(e.start(),t,r),this.point2ArcMinDistance(e.svgEnd,t,r),this.point2ArcMinDistance(t.start(),e,r),this.point2ArcMinDistance(t.svgEnd,e,r),(bf(t,e.center)||bf(e,t.center))&&this.shortestLineForArcs(t,e,r)}static minLineForArcAndLine(t,e,r){let i=t.pointOn(r.angleD(t.center)),n=t.pointOn(t.center.angleD(r));this.arcShortestLine(t,e,r,i),this.arcShortestLine(t,e,r,n)}static arcInnerLineFootSegment(t,e,r){let i=r.distance1(t.center);if(i!==0){let n=t.rx*(r.y-t.center.y)/i+t.center.y,s=t.rx*(r.x-t.center.x)/i+t.center.x;i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=new S(s,n),e.end=r)}else i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=t.start(),e.end=r)}static shortestLineForArcs(t,e,r){let i=t.center.angleD(e.center),n=e.center.angleD(t.center),s=t.pointOn(i),a=t.pointOn(n),l=e.pointOn(i),c=e.pointOn(n);bf(t,s)&&(this.arcShortestLine(e,r,s,l),this.arcShortestLine(e,r,s,c)),bf(t,a)&&(this.arcShortestLine(e,r,a,l),this.arcShortestLine(e,r,a,c)),this.shortestLineForArcs1(t,e,r)}static shortestLineForArcs1(t,e,r){let i=e.start().sub(t.center).normalize(),n=e.end().sub(t.center).normalize(),s=t.start().sub(e.center).normalize(),a=t.end().sub(e.center).normalize(),l=t.center.add(i.mul(t.rx)),c=t.center.add(n.mul(t.rx)),h=e.center.add(s.mul(e.rx)),u=e.center.add(a.mul(e.rx));bf(t,l)&&mr.greater(e.start().distance2(t.center),0)&&this.arcShortestLine(t,r,e.start(),l),bf(t,c)&&mr.greater(e.end().distance2(t.center),0)&&this.arcShortestLine(t,r,e.end(),c),bf(e,h)&&mr.greater(t.start().distance2(e.center),0)&&this.arcShortestLine(e,r,t.start(),h),bf(e,u)&&mr.greater(t.end().distance2(e.center),0)&&this.arcShortestLine(e,r,t.end(),u)}static concentricArc(t,e,r){if(!(t.center.distance1(e.center)<1e-5&&t.rx===e.rx&&t.ry===e.ry))return;let i=t.start().distance1(e.svgEnd);i<r.minDistance&&(r.minDistance=i,r.start=t.start(),r.end=e.svgEnd),i=e.start().distance1(t.svgEnd),i<r.minDistance&&(r.minDistance=i,r.start=e.start(),r.end=t.svgEnd)}static point2ArcMinDistance(t,e,r){if(bf(e,t)){let i=e.pointOn(t.angleD(e.center)),n=e.pointOn(e.center.angleD(t));this.arcShortestLine(e,r,t,i),this.arcShortestLine(e,r,t,n)}else this.minLineSegment(r,e.start(),t),this.minLineSegment(r,e.svgEnd,t)}static point2ArcMinLine(t,e,r){if(bf(e,r)){let i=r.distance1(e.center);i>e.rx||i>e.ry?this.minLineForArcAndLine(e,t,r):this.arcInnerLineFootSegment(e,t,r)}}static point2LineMinLine(t,e,r){let i=uv.foot(e,r);e.bbox().extendOfSize(1e-8).isContains(i)?this.minLineSegment(t,i,r):(this.minLineSegment(t,e.start(),r),this.minLineSegment(t,e.end(),r))}static minLineSegment(t,e,r){let i=e.distance1(r);i<t.minDistance&&(t.minDistance=i,t.start=e,t.end=r)}static arcShortestLine(t,e,r,i){if(!bf(t,i))return;let n=r.distance1(i);n<e.minDistance&&(e.minDistance=n,e.start=r,e.end=i)}static foot(t,e){if(t.isPoint())return t.start();if(!mr.eq(t.b,0)&&!mr.eq(t.a,0)){let r=t.start(),i=t.direct,n=(e.x-r.x)*i.x+(e.y-r.y)*i.y;return new S(r.x+i.x*n,r.y+i.y*n)}else return mr.eq(t.b,0)&&!mr.eq(t.a,0)?new S(t.start().x,e.y):!mr.eq(t.b,0)&&mr.eq(t.a,0)?new S(e.x,t.start().y):e}};function bf(o,t){if(mr.eq(o.sweepAngle,360))return!0;let e=To.regularD(t.angleD(o.center));return o.sweepAngle>0?(mr.less(e,o.startAngle)&&(e+=360),mr.greatereq(o.endAngle(),e)):(mr.greater(e,o.startAngle)&&(e-=360),mr.lesseq(o.endAngle(),e))}var mQe=[1,10,100,1e3],Tve="http://www.w3.org/2000/svg",Ive="http://www.w3.org/1999/xlink",Cve="http://www.w3.org/XML/1998/namespace",Sve="https://easyeda.com/",S4t=(function(){var o={svg:Tve,xlink:Ive,xml:Cve,c:Sve};return o[Tve]="svg",o[Ive]="xlink",o[Cve]="xml",o[Sve]="c",o})(),d0=(function(){var o={RATLINES:9,MODEL3D:19,ALL:11,TOPSILKLAYER:3,TOPLAYER:1,TOPPASTERLAYER:5,TOPSOLDERLAYER:7,LIBBODY:99,PADSURFACE:100,BOARDOUTLINE:10,DOCUMENT:12,TOPASSEMBLY:13,MECHANICAL:15,TOPCOMPONENT:16,SUBSTRATE:18},t;for(t=21;t<53;t++)o["INNER"+(t-20)]=t;for(o.BOTTOMSILKLAYER=4,o.BOTTOMLAYER=2,o.BOTTOMPASTERLAYER=6,o.BOTTOMSOLDERLAYER=8,o.BOTTOMASSEMBLY=14,o.BOTTOMCOMPONENT=17,t=53;t<85;t++)o["BOARD"+(t-52)]=t;return o})(),E4t=(function(){var o={COPPERAREA:[1,2,21,22,23,24],PLANEZONE:[1,2,21,22,23,24],RECT:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,99],TRACK:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],PAD:[11,1,2],VIA:[11],HOLE:[11],TEXT:[3,4,1,2,7,8,12,13,14,15,21,22,23,24],ARC:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],ELLIPSE:[3,4,12,13,14,15],CIRCLE:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],DIMENSION:[3,4,12,13,14,15],FOOTPRINT:[1,2],SOLIDREGION:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,11,99,100],SVGNODE:[1,2,3,4,7,8,12,13,14,15],PROTRACTOR:[3,4,12,13,14,15],SHEET:[12,13,14,15]};o["3D"]=(function(){for(var i=[16,19,3,7,5,1],n=21;n<52;n++)i.push(n+32,n);return i.push(2,6,8,4,17),i})();var t,e,r;for(t in o)if(o.hasOwnProperty(t)&&(r=o[t],r.indexOf(21)>0&&r.indexOf(25)===-1))for(e=25;e<=52;e++)r.push(e);return o})(),Hm=(function(){var o={1:"TopLayer",2:"BottomLayer",3:"TopSilkLayer",4:"BottomSilkLayer",5:"TopPasteMaskLayer",6:"BottomPasteMaskLayer",7:"TopSolderMaskLayer",8:"BottomSolderMaskLayer",9:"Ratlines",10:"BoardOutLine",11:"Multi-Layer",12:"Document",13:"TopAssembly",14:"BottomAssembly",15:"Mechanical",16:"TopComponents",17:"BottomComponents",18:"Substrate",19:"3DModel",99:"ComponentShapeLayer",100:"LeadShapeLayer"},t;for(t=21;t<53;t++)o[t]="Inner"+(t-20);for(t=53;t<85;t++)o[t]="Substrate"+(t-52);return o})(),O4t=(function(){var o=[],t=[];for(var e in d0)if(d0.hasOwnProperty(e)){if(e.match(/^BOARD\d+/))continue;o.push(d0[e])}o.sort(),t.sort();var r={},i,n={21:"#999966",22:"#008000",23:"#00FF00",24:"#BC8E00",25:"#70DBFA",26:"#00CC66",27:"#9966FF",28:"#800080",29:"#008080",30:"#15935F",31:"#000080",32:"#00B400",33:"#2E4756",34:"#99842F",35:"#FFFFAA",36:"#99842F",37:"#2E4756",38:"#3535FF",39:"#8000BC",40:"#43AE5F",41:"#C3ECCE",42:"#728978",43:"#39503F",44:"#0C715D",45:"#5A8A80",46:"#2B937E",47:"#23999D",48:"#45B4E3",49:"#215DA1",50:"#4564D7",51:"#6969E9",52:"#9069E9"};o.forEach(function(a){switch(a){case d0.TOPLAYER:i={name:Hm[a],color:"#FF0000",darkColor:"#CC0000",visible:!0,active:!0,config:!0};break;case d0.BOTTOMLAYER:i={name:Hm[a],color:"#0000FF",darkColor:"#000080",visible:!0,active:!1,config:!0};break;case d0.TOPSILKLAYER:i={name:Hm[a],color:"#FFCC00",darkColor:"#806600",visible:!0,active:!1,config:!0};break;case d0.BOTTOMSILKLAYER:i={name:Hm[a],color:"#66CC33",darkColor:"#33661A",visible:!0,active:!1,config:!0};break;case d0.TOPPASTERLAYER:i={name:Hm[a],color:"#808080",darkColor:"#666666",visible:!0,active:!1,config:!0};break;case d0.BOTTOMPASTERLAYER:i={name:Hm[a],color:"#800000",darkColor:"#660000",visible:!0,active:!1,config:!0};break;case d0.TOPSOLDERLAYER:i={name:Hm[a],color:"#800080",darkColor:"#660066",visible:!0,active:!1,transparency:.3,config:!0};break;case d0.BOTTOMSOLDERLAYER:i={name:Hm[a],color:"#AA00FF",darkColor:"#8800CC",visible:!0,active:!1,transparency:.3,config:!0};break;case d0.RATLINES:i={name:Hm[a],color:"#6464FF",darkColor:"#5050CC",visible:!1,active:!1,config:!0};break;case d0.BOARDOUTLINE:i={name:Hm[a],color:"#FF00FF",darkColor:"#CC00CC",visible:!0,active:!1,config:!0};break;case d0.ALL:i={name:Hm[a],color:"#C0C0C0",darkColor:"#999999",visible:!0,active:!1,config:!0};break;case d0.DOCUMENT:i={name:Hm[a],color:"#FFFFFF",darkColor:"#CCCCCC",visible:!0,active:!1,config:!0};break;case d0.TOPASSEMBLY:i={name:Hm[a],color:"#33CC99",darkColor:"#33AA99",visible:!1,active:!1,config:!1};break;case d0.BOTTOMASSEMBLY:i={name:Hm[a],color:"#5555FF",darkColor:"#8888FF",visible:!1,active:!1,config:!1};break;case d0.MECHANICAL:i={name:Hm[a],color:"#F022F0",darkColor:"#F088F0",visible:!1,active:!1,config:!1};break;case d0.MODEL3D:i={name:Hm[a],color:"#66CCFF",visible:!1,active:!1,config:!1};break;case d0.LIBBODY:i={name:Hm[a],color:"#00CCCC",visible:!1,active:!1,config:!1};break;case d0.PADSURFACE:i={name:Hm[a],color:"#CC9999",visible:!1,active:!1,config:!1};break;default:a>=d0.INNER1&&a<=d0.INNER32?i={name:Hm[a],color:n[a],darkColor:s(n[a]),visible:!1,active:!1,config:!1}:i=null;break}i&&(r[a]=i)}),r.Hole={config:!0,name:"Hole",darkColor:"#222222",color:"#222222"},r.DRCError={config:!0,name:"DRCError",color:"#FAD609",darkColor:"#FAD609"};function s(a){if(typeof a!="string"||!a.match(/#?([\da-f]{6})/i))return a;var l=parseInt(RegExp.$1,16),c=.5,h=Math.min(255,Math.round((l>>16)*c)),u=Math.min(255,Math.round((l>>8&255)*c)),d=Math.min(255,Math.round((l&255)*c)),p=((h<<16)+(u<<8)+d).toString(16);return"#"+("00000"+p).substr(-6).toUpperCase()}return r})(),Eve={BLANK:0,SCH:1,PART:2,PCB:3,FOOTPRINT:4,PRJ:5,SUBPART:6,SPICESYMBOL:7,SUBCKT:8,NETLIST:9,WAVEFORM:10,SCHLIB3D:11,PHOTOVIEW:12,SCHMODULE:13,PCBMODULE:14,VIEW3D:15,PCBLIB3D:16,BLOCK_SYMBOL:17,NETFLAG:18,NETPORT:19,SHEET_SYMBOL:20,NONEELEC_SYMBOL:21,SHORT_SYMBOL:22,FOOTPRINTVIEW:23,CNCPRINTVIEW:24,PCB2D:31,PCB3D:32},A4t=(function(){var o={};for(let t in Eve)o[Eve[t]]=t;return o})(),NZ=Math.PI*2,EZ=Math.PI/2,_4t=Math.sin(Math.PI/180);function gQe(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=mQe[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}function $ve(o,t,e){var r=o-t;return e||(e=1e-10),(r>0?r:-r)<e}function yQe(o,t,e){var r=h(o)&&h(t)&&h(e);if(!r)return console.warn("Bad arguments"),null;var i=t.x-e.x>0?t.x:e.x,n=t.y-e.y>0?t.y:e.y,s=t.x-e.x>0?e.x:t.x,a=t.y-e.y>0?e.y:t.y,l=o.x,c=o.y;return l<=i+.001&&l>=s-.001&&c<=n+.001&&c>=a-.001;function h(u){return u?(u.x=Number(u.x),u.y=Number(u.y),isNaN(u.x)||isNaN(u.y)?(console.warn("Can not convert to Number, NaN found"),!1):!0):(console.warn("Empty input!"),!1)}}function bQe(o,t,e,r,i,n){var s=(i-e)*(o-e)+(n-r)*(t-r),a=(i-e)*(i-e)+(n-r)*(n-r),l=s/a,c=e+(i-e)*l,h=r+(n-r)*l;return s<=0?Math.sqrt((o-e)*(o-e)+(t-r)*(t-r)):s>=a?Math.sqrt((o-i)*(o-i)+(t-n)*(t-n)):Math.sqrt((o-c)*(o-c)+(h-t)*(h-t))}function PQe(o,t,e){return yQe(o,t,e)?$ve((o.x-t.x)*(e.y-t.y),(e.x-t.x)*(o.y-t.y),.001):!1}var MH=1e-4,Ke=new Float64Array(100);function Pf(o,t){if(o instanceof M&&t instanceof M)return Z9(o,t);if(o instanceof q&&t instanceof M)return G1e(o,t);if(o instanceof M&&t instanceof q)return G1e(t,o);if(o instanceof q&&t instanceof q)return Zve(o,t);if(o instanceof Mr&&t instanceof Mr)return yZ(o,t);if(o instanceof Mr&&t instanceof M)return yZ(o,new Mr([t.start(),t.end()]));if(o instanceof M&&t instanceof Mr)return yZ(new Mr([o.start(),o.end()]),t);if(o instanceof Mr&&t instanceof q)return Dve(t,o);if(o instanceof q&&t instanceof Mr)return Dve(o,t);throw new Error("not supported operation")}function TQe(o,t){let e=o.bbox();if(e.isContainsY1(t)){let r=new M(new S(e.minX-1,t),new S(e.maxX+1,t));return Z9(r,o)>0?1:0}else return 0}function IQe(o,t){if(o.rx===o.ry){let e=o.bbox();if(e.isContainsY1(t)){let r=new M(new S(e.minX-1,t),new S(e.maxX+1,t));return OZ(o,r)>0?1:0}else return 0}else throw new Error("not supported operation")}function Ove(o,t){let e=o.bbox();return e.isContainsY1(t)&&yZ(new Mr([new S(e.minX-1,t),new S(e.maxX+1,t)]),o)>0?1:0}function Ave(o,t,e){return isFinite(t)&&isFinite(e)?o.isContains2(t,e):!1}function CQe(o,t){let e=t.length(),r=Up.crossProd3(t.start(),t.end(),o.start())/e,i=Up.crossProd3(t.start(),t.end(),o.end())/e;return Math.abs(r)<1e-8||Math.abs(i)<1e-8||r*i<0}function Z9(o,t){let e=o.bbox().intersection1(t.bbox());if(!e)return 0;if(o.isPoint())if(t.isPoint()){let r=e.center();return Ke[0]=r.x,Ke[1]=r.y,2}else return _ve(t,o,e);else{if(t.isPoint())return _ve(o,t,e);{let r=function(T,I){e.isContains2(T,I)&&(Ke[P++]=T,Ke[P++]=I)};if(!CQe(o,t))return 0;let i=o.start().x,n=o.start().y,s=o.end().x,a=o.end().y,l=t.start().x,c=t.start().y,h=t.end().x,u=t.end().y,d=t.length(),p=Up.crossProd2(i,n,l,c,h,u)/d,m=Up.crossProd2(s,a,l,c,h,u)/d;if(p*m>0&&!mr.eq(p,0)&&!mr.eq(m,0))return 0;let g=o.length(),y=Up.crossProd2(l,c,i,n,s,a)/g,b=Up.crossProd2(h,u,i,n,s,a)/g;if(y*b>0&&!mr.eq(y,0)&&!mr.eq(b,0))return 0;let P=0;if(mr.eq(p,0)&&mr.eq(m,0)){let T=e.UL(),I=e.UR(),C=e.LL(),E=e.LR();if(mr.eq(e.width(),0))mr.eq(e.height(),0)?(Ke[P++]=T.x,Ke[P++]=T.y):(Ke[P++]=T.x,Ke[P++]=T.y,Ke[P++]=C.x,Ke[P++]=C.y);else if(mr.eq(e.height(),0))Ke[P++]=T.x,Ke[P++]=T.y,Ke[P++]=I.x,Ke[P++]=I.y;else{let O=CO.area2(T.x,T.y,l,c,h,u),_=CO.area2(I.x,I.y,l,c,h,u);O<_?(Ke[P++]=T.x,Ke[P++]=T.y,Ke[P++]=E.x,Ke[P++]=E.y):(Ke[P++]=I.x,Ke[P++]=I.y,Ke[P++]=C.x,Ke[P++]=C.y)}}else if(mr.eq(p,0))r(i,n);else if(mr.eq(m,0))r(s,a);else{let T=Math.abs(p/(p-m));r(i+(s-i)*T,n+(a-n)*T)}return P}}}function _ve(o,t,e){let r=t.start(),i=t.end(),n=Up.crossProd3(o.start(),o.end(),t.start()),s=Up.crossProd3(o.start(),o.end(),t.end());if(n*s<0){let a=e.center();return Ke[0]=a.x,Ke[1]=a.y,2}else if(Math.abs(n)<Math.abs(s)){if(mr.eq(n/o.length(),0))return Ke[0]=r.x,Ke[1]=r.y,2}else if(mr.eq(s/o.length(),0))return Ke[0]=i.x,Ke[1]=i.y,2;return 0}function OZ(o,t){let e=o.bbox().intersection1(t.bbox());if(e!=null){e=e.extendOfSize(MH);let r=o.center.x,i=o.center.y,n=o.rx,s=o.rx2,a=t.start().x,l=t.start().y,c=t.end().x,h=t.end().y,u=o.center.distance1(t.start()),d=o.center.distance1(t.end()),p=mr.eq(u,n)?0:u>n?1:-1,m=mr.eq(d,n)?0:d>n?1:-1,g=0;if(p===-1&&m===-1)return 0;if(p===0&&m===0)Ke[g++]=a,Ke[g++]=l,Ke[g++]=c,Ke[g++]=h;else if(p===1&&m===1){let y=ir.foot(t,o.center),b=y.distance1(o.center);if(mr.greater(b,n))return 0;if(mr.eq(b,n))mr.eq(t.distance2(o.start()),0)?(Ke[g++]=o.start().x,Ke[g++]=o.start().y,Ke[g++]=o.start().x,Ke[g++]=o.start().y):mr.eq(t.distance2(o.end()),0)?(Ke[g++]=o.end().x,Ke[g++]=o.end().y,Ke[g++]=o.end().x,Ke[g++]=o.end().y):(Ke[g++]=y.x,Ke[g++]=y.y,Ke[g++]=y.x,Ke[g++]=y.y);else{g=Kve(r,i,a,l,c,h,g,y);let P=Ke[g-2],T=Ke[g-1];g-=2;let I=Up.distance1(r,i,P,T);if(mr.eq(I,n))Ke[g++]=P,Ke[g++]=T,Ke[g++]=P,Ke[g++]=T;else if(I<n)g=Zf(s,r,i,a,l,P,T,g),g=Zf(s,r,i,P,T,c,h,g);else return 0}}else if(p===-1||m===-1)g=Zf(s,r,i,a,l,c,h,g);else{let y=ir.foot(t,o.center),b=y.distance1(o.center);if(mr.eq(b,n)){let P=function(C){return Ave(e,C.x,C.y)&&Gp(o,C)},T=o.start(),I=o.end();if(p===0){let C=t.start();if(P(C))return Ke[g++]=C.x,Ke[g++]=C.y,Ke[g++]=C.x,Ke[g++]=C.y,g;if(P(y))return Ke[g++]=y.x,Ke[g++]=y.y,Ke[g++]=y.x,Ke[g++]=y.y,g;if(mr.eq(t.distance2(T),0)&&P(T))return Ke[g++]=T.x,Ke[g++]=T.y,Ke[g++]=T.x,Ke[g++]=T.y,g;if(mr.eq(t.distance2(I),0)&&P(I))return Ke[g++]=I.x,Ke[g++]=I.y,Ke[g++]=I.x,Ke[g++]=I.y,g;if(u<=n)g=Zf(s,r,i,y.x,y.y,c,h,g),g===2&&(Ke[g++]=Ke[0],Ke[g++]=Ke[1]);else if(b<n){if(g=Zf(s,r,i,y.x,y.y,c,h,g),g===2&&P(new S(Ke[0],Ke[1])))return Ke[g++]=Ke[0],Ke[g++]=Ke[1],g;g=Zf(s,r,i,y.x,y.y,a,l,0),g===2&&(Ke[g++]=Ke[0],Ke[g++]=Ke[1])}}else{let C=t.end();if(P(C))return Ke[g++]=C.x,Ke[g++]=C.y,Ke[g++]=C.x,Ke[g++]=C.y,g;if(P(y))return Ke[g++]=y.x,Ke[g++]=y.y,Ke[g++]=y.x,Ke[g++]=y.y,g;if(mr.eq(t.distance2(T),0)&&P(T))return Ke[g++]=T.x,Ke[g++]=T.y,Ke[g++]=T.x,Ke[g++]=T.y,g;if(mr.eq(t.distance2(I),0)&&P(I))return Ke[g++]=I.x,Ke[g++]=I.y,Ke[g++]=I.x,Ke[g++]=I.y,g;if(d<=n)g=Zf(s,r,i,y.x,y.y,a,l,g),g===2&&(Ke[g++]=Ke[0],Ke[g++]=Ke[1]);else if(b<n){if(g=Zf(s,r,i,y.x,y.y,a,l,g),g===2&&P(new S(Ke[0],Ke[1])))return Ke[g++]=Ke[0],Ke[g++]=Ke[1],g;g=Zf(s,r,i,y.x,y.y,c,h,0),g===2&&(Ke[g++]=Ke[0],Ke[g++]=Ke[1])}}}else if(p===0){let P=t.start();Ke[g++]=P.x,Ke[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=Zf(s,r,i,y.x,y.y,c,h,g))}else{let P=t.end();Ke[g++]=P.x,Ke[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=Zf(s,r,i,y.x,y.y,a,l,g))}}if(g>0){let y=0;for(let b=0;b<g;b+=2){let P=Ke[b],T=Ke[b+1];isFinite(P)&&isFinite(T)&&Ave(e,P,T)&&Gp(o,new S(P,T))&&(Ke[y++]=P,Ke[y++]=T)}return y}else return 0}else return 0}function SQe(o,t){if(o.bbox()){let e=o.center.x,r=o.center.y,i=o.rx2,n=t.start().x,s=t.start().y,a=t.end().x,l=t.end().y,c=o.center.distance2(t.start()),h=o.center.distance2(t.end()),u=mr.eq(c,i)?0:c>i?1:-1,d=mr.eq(h,i)?0:h>i?1:-1,p=0;if(u===-1&&d===-1)return 0;if(u===0&&d===0)Ke[p++]=n,Ke[p++]=s,Ke[p++]=a,Ke[p++]=l;else if(u===1&&d===1){let m=ir.foot(t,o.center),g=m.distance2(o.center);if(mr.greater(g,i))return 0;if(mr.eq(g,i)){let y=m.distance2(o.start()),b=m.distance2(o.end());mr.eq(y,0)?(Ke[p++]=o.start().x,Ke[p++]=o.start().y):mr.eq(b,0)?(Ke[p++]=o.end().x,Ke[p++]=o.end().y):(Ke[p++]=m.x,Ke[p++]=m.y)}else{p=Kve(e,r,n,s,a,l,p,m);let y=Ke[p-2],b=Ke[p-1],P=Up.distance2(e,r,y,b);if(p-=2,mr.eq(P,i))Ke[p++]=y,Ke[p++]=b;else if(P<i)p=Zf(i,e,r,n,s,y,b,p),p=Zf(i,e,r,y,b,a,l,p);else return 0}}else if(u===-1||d===-1)p=Zf(i,e,r,n,s,a,l,p);else{let m=ir.foot(t,o.center);u===0?(Ke[p++]=t.start().x,Ke[p++]=t.start().y,mr.neq(m.distance2(t.start()),0)&&(n-m.x)*(a-m.x)+(s-m.y)*(l-m.y)<0&&(p=Zf(i,e,r,m.x,m.y,a,l,p))):(Ke[p++]=t.end().x,Ke[p++]=t.end().y,mr.neq(m.distance2(t.end()),0)&&(n-m.x)*(a-m.x)+(s-m.y)*(l-m.y)<0&&(p=Zf(i,e,r,m.x,m.y,n,s,p)))}if(p>0){let m=0;for(let g=0;g<p;g+=2){let y=Ke[g],b=Ke[g+1];isFinite(y)&&isFinite(b)&&(Ke[m++]=y,Ke[m++]=b)}return m}else return 0}else return 0}function Zf(o,t,e,r,i,n,s,a){if(i==s){let P=o-(i-e)*(i-e);if(mr.greater(P,0)){let T=Math.sqrt(P),I=t-T,C=t+T,E=Math.min(r,n),O=Math.max(r,n);return I>=E&&I<=O&&(Ke[a++]=I,Ke[a++]=i),C>=E&&C<=O&&(Ke[a++]=C,Ke[a++]=i),a}}let l=Up.distance2(r,i,t,e)-o;if(l===0)return Ke[a++]=r,Ke[a++]=i,a;let c=Up.distance2(n,s,t,e)-o;if(c===0)return Ke[a++]=n,Ke[a++]=s,a;if(l<0&&c<0)return l>c?mr.eq(l,0)&&(Ke[a++]=r,Ke[a++]=i):mr.eq(c,0)&&(Ke[a++]=n,Ke[a++]=s),a;if(l>0&&c>0&&(r-t)*(n-t)+(i-e)*(s-e)>0)return l<c?mr.eq(l,0)&&(Ke[a++]=r,Ke[a++]=i):mr.eq(c,0)&&(Ke[a++]=n,Ke[a++]=s),a;let h=r,u=i,d=n,p=s,m=NaN,g=NaN,y=Number.POSITIVE_INFINITY,b=0;for(;y!==0;){b++;let P=Math.max(Math.min(Math.abs(l)/(Math.abs(l)+Math.abs(c)),.75),.25);if(m=h+(d-h)*P,g=u+(p-u)*P,h===m&&u===g||d===m&&p===g){Math.abs(l)>Math.abs(c)?(m=d,g=p,y=c):(m=h,g=u,y=l);break}else y=Up.distance2(m,g,t,e)-o,(y<0?l>c:l<c)?(d=m,p=g,c=y):(h=m,u=g,l=y)}return Ke[a++]=m,Ke[a++]=g,a}function Kve(o,t,e,r,i,n,s,a){let l=Up.dotProd2(e,r,i,n,o,t),c=Up.dotProd2(i,n,e,r,o,t);if(l>=0)return Ke[s++]=i,Ke[s++]=n,s;if(c>=0)return Ke[s++]=e,Ke[s++]=r,s;if(Up.crossProd2(e,r,i,n,o,t)==0)return Ke[s++]=o,Ke[s++]=t,s;{let h=NaN,u=NaN,d=e,p=r,m=i,g=n,y=Up.distance2(e,r,o,t),b=Up.distance2(i,n,o,t),P=Number.POSITIVE_INFINITY,T=0;for(;P>0&&(T++,h=d+(m-d)*.5,u=p+(g-p)*.5,!(y==b||d==h&&p==u||m==h&&g==u));){P=Up.distance2(h,u,o,t);let I=Up.dotProd2(d,p,h,u,o,t);if(I==0)break;I<0?(m=h,g=u,b=P):(d=h,p=u,y=P)}return Up.distance2(h,u,o,t)<Up.distance2(a.x,a.y,o,t)?(Ke[s++]=h,Ke[s++]=u):(Ke[s++]=a.x,Ke[s++]=a.y),s}}function G1e(o,t){if(o.rx===o.ry)return OZ(o,t);throw new Error("not supported")}function EQe(o,t){if(o.rx===o.ry)return SQe(o,t);throw new Error("not supported")}function Zve(o,t){if(o.bbox().intersection1(t.bbox())!=null){if(o.rx===o.ry&&t.rx===t.ry)return OQe(o,t);throw new Error("not supported operation")}return 0}function OQe(o,t){let e=o.center.x,r=o.center.y,i=t.center.x,n=t.center.y,s=o.rx,a=t.rx,l=o.rx2,c=t.rx2,h=o.center.distance1(t.center),u=Math.abs(s-a),d=s+a;if(mr.greater(h,d)||mr.less(h,u))return 0;if(mr.eq(u+h,0)){let p=0,m;return Gp(o,t.start())&&(Ke[p]=t.start().x,Ke[p+1]=t.start().y,p+=2,m=t.start()),Gp(o,t.end())&&(Ke[p]=t.end().x,Ke[p+1]=t.end().y,p+=2,m=t.end()),p===0?(Gp(t,o.start())&&(Ke[p]=o.start().x,Ke[p+1]=o.start().y,p+=2),Gp(t,o.end())&&(Ke[p]=o.end().x,Ke[p+1]=o.end().y,p+=2)):p===2&&(!m.equals1(o.start())&&Gp(t,o.start())&&(Ke[p]=o.start().x,Ke[p+1]=o.start().y,p+=2),!m.equals1(o.end())&&Gp(t,o.end())&&(Ke[p]=o.end().x,Ke[p+1]=o.end().y,p+=2)),p}else if(mr.eq(h,d)){if(vve(o,t))return 4;let p=new M(o.center,t.center),m=OZ(t,p);return m=xve(o,m),m!==0?m:(m=OZ(o,p),xve(t,m))}else if(mr.eq(h,u)){if(vve(o,t))return 4;if(s>a){let p=(s-a)/s;return Ke[0]=e+(i-e)/p,Ke[1]=r+(n-r)/p,Rve(o,t,2)}else{let p=(a-s)/a;return Ke[0]=i+(e-i)/p,Ke[1]=n+(r-n)/p,Rve(o,t,2)}}else{let p,m;if(o.rx>t.rx){let R=(o.center.distance2(t.center)-l+c)/(h*2)/h;p=(e-i)*R+i,m=(r-n)*R+n}else{let R=(o.center.distance2(t.center)-c+l)/(h*2)/h;p=(i-e)*R+e,m=(n-r)*R+r}let g=i-e,y=n-r,b=Math.max(s,a)*2,P,T,I,C;if(Math.abs(g)<Math.abs(y)){let R=g/-y,v=m-R*p;P=p-b,T=R*P+v,I=p+b,C=R*I+v}else{let R=y/-g,v=p-R*m;T=m-b,P=R*T+v,C=m+b,I=R*C+v}let E;if(o.rx>t.rx?(E=Zf(c,i,n,P,T,p,m,0),E=Zf(c,i,n,p,m,I,C,E)):(E=Zf(l,e,r,P,T,p,m,0),E=Zf(l,e,r,p,m,I,C,E)),E!==4)throw new Error("cnt !== 4");let O=new S(Ke[0],Ke[1]),_=new S(Ke[2],Ke[3]);if(Gp(o,O)&&Gp(t,O))return Gp(o,_)&&Gp(t,_)?4:hv(o.start(),t,_,O)?(Ke[2]=o.start().x,Ke[3]=o.start().y,4):hv(o.end(),t,_,O)?(Ke[2]=o.end().x,Ke[3]=o.end().y,4):hv(t.start(),o,_,O)?(Ke[2]=t.start().x,Ke[3]=t.start().y,4):hv(t.end(),o,_,O)?(Ke[2]=t.end().x,Ke[3]=t.end().y,4):2;if(Gp(o,_)&&Gp(t,_))return hv(o.start(),t,O,_)?(Ke[0]=o.start().x,Ke[1]=o.start().y,4):hv(o.end(),t,O,_)?(Ke[0]=o.end().x,Ke[1]=o.end().y,4):hv(t.start(),o,O,_)?(Ke[0]=t.start().x,Ke[1]=t.start().y,4):hv(t.end(),o,O,_)?(Ke[0]=t.end().x,Ke[1]=t.end().y,4):(Ke[0]=Ke[2],Ke[1]=Ke[3],2);{let R=function(F,H){if(mr.eq(F.distance1(H.center),H.rx)&&Gp(H,F)){if(F.distance2(O)<F.distance2(_)){if(v)return;v=!0}else{if(D)return;D=!0}Ke[w++]=F.x,Ke[w++]=F.y}},v=!1,D=!1,w=0;return R(o.start(),t),R(o.end(),t),R(t.start(),o),R(t.end(),o),w}}}function hv(o,t,e,r){return mr.eq(o.distance1(t.center),t.rx)&&Gp(t,o)&&o.distance2(e)<o.distance2(r)}function vve(o,t){return mr.eq(t.start().distance1(o.center),o.rx)&&Gp(o,t.start())?(Ke[0]=t.start().x,Ke[1]=t.start().y,Ke[2]=t.start().x,Ke[3]=t.start().y,!0):mr.eq(t.end().distance1(o.center),o.rx)&&Gp(o,t.end())?(Ke[0]=t.end().x,Ke[1]=t.end().y,Ke[2]=t.end().x,Ke[3]=t.end().y,!0):mr.eq(o.start().distance1(t.center),t.rx)&&Gp(t,o.start())?(Ke[0]=o.start().x,Ke[1]=o.start().y,Ke[2]=o.start().x,Ke[3]=o.start().y,!0):mr.eq(o.end().distance1(t.center),t.rx)&&Gp(t,o.end())?(Ke[0]=o.end().x,Ke[1]=o.end().y,Ke[2]=o.end().x,Ke[3]=o.end().y,!0):!1}function xve(o,t){if(t===0)return 0;let e=Ke[0],r=Ke[1];return Gp(o,new S(e,r))?(Ke[0]=e,Ke[1]=r,Ke[2]=e,Ke[3]=r,4):0}function Rve(o,t,e){if(e===0)return 0;let r=Ke[0],i=Ke[1],n=new S(r,i);return Gp(o,n)&&Gp(t,n)?(Ke[0]=r,Ke[1]=i,Ke[2]=r,Ke[3]=i,4):0}function f7(o,t){return Math.abs(o-t)<=1e-6}function Gp(o,t){let e=o.bbox();if(t.x-e.minX>-MH&&t.x-e.maxX<MH&&t.y-e.minY>-MH&&t.y-e.maxY<MH){let r=To.regularD(t.angleD(o.center));return f7(r,o.startAngle)||f7(r,o.startAngle+360)||f7(r,o.startAngle-360)||f7(r,o.endAngle())||f7(r,o.endAngle()+360)||f7(r,o.endAngle()-360)?!0:o.sweepAngle>0?(mr.less(r,o.startAngle)&&(r+=360),mr.greatereq(o.endAngle(),r)):(mr.greater(r,o.startAngle)&&(r-=360),mr.lesseq(o.endAngle(),r))}else return!1}function AQe(o,t){let e=o[1].x-o[0].x,r=o[1].y-o[0].y,i=t[1].x-t[0].x,n=t[1].y-t[0].y;if(e===0&&i!==0||e!==0&&i===0)return!1;if(e===0&&i===0)return!0;let s=r/e,a=n/i;return $ve(s,a,Math.sin(Math.PI/180))}function _Qe(o,t,e){var r,i=+t.x,n=+t.y,s=+e.x,a=+e.y,l=+o.x,c=+o.y,h=s-i,u=a-n,d=l-i,p=c-n,m,g,y,b,P,T;return h===0&&u===0?{d:Math.sqrt(d*d+p*p),point:new S(i,n)}:(r=(d*h+p*u)/(h*h+u*u),r<0?{d:Math.sqrt(d*d+p*p),point:new S(i,n)}:r>1?(m=l-s,g=c-a,{d:Math.sqrt(m*m+g*g),point:new S(s,a)}):(P=i+r*h,T=n+r*u,y=l-P,b=c-T,{d:Math.sqrt(y*y+b*b),point:new S(P,T)}))}function oS(o,t){if(!o||!t||o.length!=t.length)return!1;let e="equals1";return!o.some((r,i)=>{let n=t[i],s=!1;return r&&n&&typeof r=="object"&&typeof n=="object"?typeof r[e]=="function"&&xQe(r,n)?s=!r[e].call(r,n):s=!(r===n||r.toString()===n.toString()):typeof r=="number"&&typeof n=="number"?s=!(vQe(r,n)||Number.isNaN(r)&&Number.isNaN(n)):s=r!==n,s})}function vQe(o,t,e=5){return Math.abs(o-t)*Math.pow(10,e)<1}function xQe(o,t){return!o||!t||typeof o!="object"||typeof t!="object"?o===t:o.constructor===t.constructor}var $s=new Float64Array(100);function yZ(o,t){if(o.bbox().extendOfSize(mr.eps).isSeparated(t.bbox()))return 0;let e=[[o,t]],r=(o.controls.length-1)*(t.controls.length-1)*8,i=0,n=Number.POSITIVE_INFINITY;for(;e.length!==0;){let s=function(G){D=Math.min(D,G),w=Math.max(w,G)},a=function(G,W){let L=Z9(G,W);if(L===0)throw new Error("cnt === 0");for(let B=0;B<L;B+=2)s(Ke[B])};if(i>r){for(let G=i-2;G>=2;G-=2)for(let W=G-2;W>=0;W-=2)if(mr.eq($s[G],$s[W])&&mr.eq($s[G+1],$s[W+1])){$s[W]=($s[G]+$s[W])/2,$s[W+1]=($s[G+1]+$s[W+1])/2;for(let L=i-3;L>=G;L--)$s[L]=$s[L+2];i-=2;break}if(i>r){i=0;let G=t.start(),W=new Float64Array(8);o.getPercent(G)!==null&&(W[i++]=G.x,W[i++]=G.y);let L=t.end();o.getPercent(L)!==null&&(W[i++]=L.x,W[i++]=L.y);let B=o.start();t.getPercent(B)!==null&&(W[i++]=B.x,W[i++]=B.y);let N=o.end();return t.getPercent(N)!==null&&(W[i++]=N.x,W[i++]=N.y),Ke.set(W),i}}let[l,c]=e.pop(),h=l.controls,u=c.controls;if(h.length===2&&u.length===2){let G=Z9(new M(h[0],h[1]),new M(u[0],u[1]));for(let W=0;W<G;W++)$s[i++]=Ke[W];continue}let d=h[0],p=h[h.length-1];d.equals1(p)&&(p=d.add1(1,0));let m=p.y-d.y,g=d.x-p.x,y=-m*d.x-g*d.y,b=Math.sqrt(1/(m**2+g**2));m*=b,g*=b,y*=b;let P=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(h.forEach(G=>{let W=m*G.x+g*G.y+y;W<P&&(P=W),W>T&&(T=W)}),mr.eq(P,T)){if(c.controls.length===2){let G=Z9(new M(l.start(),l.end()),new M(c.start(),c.end()));for(let W=0;W<G;W++)$s[i++]=Ke[W];if(G!==0)continue}l=new Mr([h[0],h[h.length-1]]),h=l.controls}let I=u.map(G=>{let W=m*G.x+g*G.y+y,L=Math.abs(W);return L<n&&(n=L),W}),C=0;for(let G of I){if(mr.less(G,P))C=C|1;else if(mr.greater(G,T))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let E=0,O=0,_=p.x-d.x,R=p.y-d.y,v=Math.sqrt(1/(_**2+R**2));_*=v,R*=v;for(let G=1;G<h.length;G++){let W=h[G],L=(W.x-d.x)*_+(W.y-d.y)*R;L<E?E=L:L>O&&(O=L)}C=0;for(let G of u){let W=(G.x-d.x)*_+(G.y-d.y)*R;if(mr.less(W,E))C=C|1;else if(mr.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let D=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY;n/=2,n<=mr.eps&&(n=mr.eps),P-=n,T+=n,I.forEach((G,W)=>{G>=P&&G<=T&&s(W/(I.length-1))});let F=new M(new S(0,P),new S(1,P)),H=new M(new S(0,T),new S(1,T));for(let G=0;G<I.length-1;G++){let W=new S(G/(I.length-1),I[G]),L=W.y<P?1:W.y>T?2:3;for(let B=0;B<I.length;B++){let N=new S(B/(I.length-1),I[B]),U=N.y<P?1:N.y>T?2:3;L!==U&&(L===1?U===2?(a(new M(W,N),F),a(new M(W,N),H)):a(new M(W,N),F):L===2?U===1?(a(new M(W,N),F),a(new M(W,N),H)):a(new M(W,N),H):U===1?a(new M(W,N),F):a(new M(W,N),H))}}D!==0&&(c=c.clip(D)[1]),w!==1&&(c=c.clip((w-D)/(1-D))[0]);let z=c.bbox();if(mr.eq(z.minX,z.maxX)&&mr.eq(z.minY,z.maxY)){C=0;for(let G of c.controls){let W=(G.x-d.x)*_+(G.y-d.y)*R;if(mr.less(W,E))C=C|1;else if(mr.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C===3){let G=new S((z.minX+z.maxX)/2,(z.minY+z.maxY)/2);l.getPercent(G)&&($s[i++]=G.x,$s[i++]=G.y)}continue}if(w-D>.8){let[G,W]=c.clip(.5);e.push([G,l]),e.push([W,l])}else e.push([c,l])}for(let s=0;s<i;s++)Ke[s]=$s[s];return i}function RQe(o,t){if(o.bbox().extendOfSize(mr.eps).isSeparated(t.bbox()))return{cnt:0};let e=[[o,t]],r=(o.controls.length-1)*(t.controls.length-1)*8,i=0,n=Number.POSITIVE_INFINITY;for(;e.length!==0;){let s=function(G){D=Math.min(D,G),w=Math.max(w,G)},a=function(G,W){let L=Z9(G,W);if(L===0)throw new Error("cnt === 0");for(let B=0;B<L;B+=2)s(Ke[B])};if(i>r){for(let G=i-2;G>=2;G-=2)for(let W=G-2;W>=0;W-=2)if(mr.eq($s[G],$s[W])&&mr.eq($s[G+1],$s[W+1])){$s[W]=($s[G]+$s[W])/2,$s[W+1]=($s[G+1]+$s[W+1])/2;for(let L=i-3;L>=G;L--)$s[L]=$s[L+2];i-=2;break}if(i>r){i=0;let G=new Float64Array(8),W=t.end(),L=0;o.getPercent(W)!==null&&(G[i++]=W.x,G[i++]=W.y,L=2);let B=o.end();return t.getPercent(B)!==null&&(G[i++]=B.x,G[i++]=B.y,L=L===0?1:3),Ke.set(G),{havOverlap:L,cnt:i}}}let[l,c]=e.pop(),h=l.controls,u=c.controls;if(h.length===2&&u.length===2){let G=Z9(new M(h[0],h[1]),new M(u[0],u[1]));for(let W=0;W<G;W++)$s[i++]=Ke[W];continue}let d=h[0],p=h[h.length-1];d.equals1(p)&&(p=d.add1(1,0));let m=p.y-d.y,g=d.x-p.x,y=-m*d.x-g*d.y,b=Math.sqrt(1/(m**2+g**2));m*=b,g*=b,y*=b;let P=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(h.forEach(G=>{let W=m*G.x+g*G.y+y;W<P&&(P=W),W>T&&(T=W)}),mr.eq(P,T)){if(c.controls.length===2){let G=Z9(new M(l.start(),l.end()),new M(c.start(),c.end()));for(let W=0;W<G;W++)$s[i++]=Ke[W];if(G!==0)continue}l=new Mr([h[0],h[h.length-1]]),h=l.controls}let I=u.map(G=>{let W=m*G.x+g*G.y+y,L=Math.abs(W);return L<n&&(n=L),W}),C=0;for(let G of I){if(mr.less(G,P))C=C|1;else if(mr.greater(G,T))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let E=0,O=0,_=p.x-d.x,R=p.y-d.y,v=Math.sqrt(1/(_**2+R**2));_*=v,R*=v;for(let G=1;G<h.length;G++){let W=h[G],L=(W.x-d.x)*_+(W.y-d.y)*R;L<E?E=L:L>O&&(O=L)}C=0;for(let G of u){let W=(G.x-d.x)*_+(G.y-d.y)*R;if(mr.less(W,E))C=C|1;else if(mr.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let D=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY;n/=2,n<=mr.eps&&(n=mr.eps),P-=n,T+=n,I.forEach((G,W)=>{G>=P&&G<=T&&s(W/(I.length-1))});let F=new M(new S(0,P),new S(1,P)),H=new M(new S(0,T),new S(1,T));for(let G=0;G<I.length-1;G++){let W=new S(G/(I.length-1),I[G]),L=W.y<P?1:W.y>T?2:3;for(let B=0;B<I.length;B++){let N=new S(B/(I.length-1),I[B]),U=N.y<P?1:N.y>T?2:3;L!==U&&(L===1?U===2?(a(new M(W,N),F),a(new M(W,N),H)):a(new M(W,N),F):L===2?U===1?(a(new M(W,N),F),a(new M(W,N),H)):a(new M(W,N),H):U===1?a(new M(W,N),F):a(new M(W,N),H))}}D!==0&&(c=c.clip(D)[1]),w!==1&&(c=c.clip((w-D)/(1-D))[0]);let z=c.bbox();if(mr.eq(z.minX,z.maxX)&&mr.eq(z.minY,z.maxY)){C=0;for(let G of c.controls){let W=(G.x-d.x)*_+(G.y-d.y)*R;if(mr.less(W,E))C=C|1;else if(mr.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C===3){let G=new S((z.minX+z.maxX)/2,(z.minY+z.maxY)/2);l.getPercent(G)&&($s[i++]=G.x,$s[i++]=G.y)}continue}if(w-D>.8){let[G,W]=c.clip(.5);e.push([G,l]),e.push([W,l])}else e.push([c,l])}for(let s=0;s<i;s++)Ke[s]=$s[s];return{cnt:i}}var DQe=class{constructor(o=mr.eps){this.eps=o}eq(o,t){return Math.abs(o-t)<=this.eps}setEps(o){this.eps=o}},RH=new DQe;function Dve(o,t){if(o.bbox().extendOfSize(mr.eps).isSeparated(t.bbox()))return 0;let e=[[o,t]],r=(t.controls.length-1)*16,i=0;for(;e.length!==0;){if(i>r){let s=function(){for(let c=0;c<i;c+=2)for(let h=c+2;h<i;h+=2)if(!(RH.eq($s[c],$s[h])&&RH.eq($s[c+1],$s[h+1]))){l($s[h],$s[h+1],a);break}function l(c,h,u){let d=!1;for(let p=0;p<u.length;p+=2)if(RH.eq(c,u[p])&&RH.eq(h,u[p+1])){d=!0;break}d||u.push(c,h)}},a=[$s[0],$s[1]];if(s(),a.length>=100&&(RH.setEps(.001),a=[$s[0],$s[1]],s(),a.length>=100))throw new Error("clearSamePoint()");i=a.length,a.forEach((l,c)=>$s[c]=l)}let n=e.pop();if(n[0]instanceof q){let s=function(H){R=Math.min(R,H),v=Math.max(v,H)},a=function(H,z){let G=Z9(H,z);if(G===0)throw new Error("cnt === 0");for(let W=0;W<G;W+=2)s(Ke[W])},[l,c]=n,h=c.controls;if(h.length===2){let H=G1e(l,new M(h[0],h[1]));for(let z=0;z<H;z++)$s[i++]=Ke[z];continue}let u=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,p,m,g,y,b;if(Math.abs(l.sweepAngle)>359){let H=l.rx;p=l.center.add1(H,0),m=l.center.add1(-H,0),u=-H,d=H,g=0,y=1,b=-l.center.y}else{p=l.start(),m=l.end(),g=m.y-p.y,y=p.x-m.x,b=-g*p.x-y*p.y;let H=Math.sqrt(1/(g**2+y**2));g*=H,y*=H,b*=H;let z=g*l.center.x+y*l.center.y+b;l.isCCW?(d=l.rx+z,u=0):(u=z-l.rx,d=0)}let P=h.map(H=>g*H.x+y*H.y+b),T=0;for(let H of P){if(mr.less(H,u))T=T|1;else if(mr.greater(H,d))T=T|2;else{T=3;break}if(T===3)break}if(T!==3)continue;let I=0,C=0,E=m.x-p.x,O=m.y-p.y,_=Math.sqrt(1/(E**2+O**2));if(E*=_,O*=_,Math.abs(l.sweepAngle)<=180)I=0,C=(m.x-p.x)*E+(m.y-p.y)*O;else throw new Error("not support");T=0;for(let H of h){let z=(H.x-p.x)*E+(H.y-p.y)*O;if(mr.less(z,I))T=T|1;else if(mr.greater(z,C))T=T|2;else{T=3;break}if(T===3)break}if(T!==3)continue;let R=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY;u-=mr.eps,d+=mr.eps,P.forEach((H,z)=>{H>=u&&H<=d&&s(z/(P.length-1))});let D=new M(new S(0,u),new S(1,u)),w=new M(new S(0,d),new S(1,d));for(let H=0;H<P.length-1;H++){let z=new S(H/(P.length-1),P[H]),G=z.y<u?1:z.y>d?2:3;for(let W=0;W<P.length;W++){let L=new S(W/(P.length-1),P[W]),B=L.y<u?1:L.y>d?2:3;G!==B&&(G===1?B===2?(a(new M(z,L),D),a(new M(z,L),w)):a(new M(z,L),D):G===2?B===1?(a(new M(z,L),D),a(new M(z,L),w)):a(new M(z,L),w):B===1?a(new M(z,L),D):a(new M(z,L),w))}}R!==0&&(c=c.clip(R)[1]),v!==1&&(c=c.clip((v-R)/(1-R))[0]);let F=c.bbox();if(mr.eq(F.minX,F.maxX)&&mr.eq(F.minY,F.maxY)){T=0;for(let H of c.controls){let z=(H.x-p.x)*E+(H.y-p.y)*O;if(mr.less(z,I))T=T|1;else if(mr.greater(z,C))T=T|2;else{T=3;break}if(T===3)break}T===3&&($s[i++]=(F.minX+F.maxX)/2,$s[i++]=(F.minY+F.maxY)/2);continue}v-R>.8?c.clip(.5).forEach(H=>e.push([H,l])):e.push([c,l])}else{let[s,a]=n;e.push([q.build3(a.center,a.startAngle,a.sweepAngle/2,a.rx,a.ry),s]),e.push([q.build3(a.center,a.startAngle+a.sweepAngle/2,a.sweepAngle/2,a.rx,a.ry),s])}}for(let n=0;n<i;n++)Ke[n]=$s[n];return i}var wQe=class{static getSweep(o){if(o.length>2){let t=0,e=o.length;for(let n=0;n<e-1;n++){let s=o[n],a=o[n+1];t+=(a.x+s.x)*(a.y-s.y)}let r=o[0],i=o[e-1];return t+=(r.x+i.x)*(r.y-i.y),t>0}else throw new Error("Unable to determine the direction of rotation!")}static isClose(o){return!!(o.primitives.length>0&&o.primitives[0].start().equals1(o.primitives[o.primitives.length-1].end()))}};function LQe(o){let t=o.primitives,e=t[0],r=e instanceof q?e.sweepAngle%360:null;if(t.length===1&&e instanceof q&&(mr.eq(r,0)||mr.eq(Math.abs(r),360)))return!!e.isCCW;let i=new Array;return o.points(.1,n=>{i.push(n)}),wQe.getSweep(i)}var MQe=class{static zoomCorner(o,t){let e=new Array,r=new Array,i=new Array;return this.getPanPrimitive(o,e,i,t),this.rearrange(e,i),this.processStart(e,i),this.getResult(e,i,r,t),r.length>0?fe.build2(r):null}static zoomPolygon(o,t){let e=new Array,r=new Array,i=new Array;return LQe(o)&&(o=o.reverse().asClose()),this.getPanPrimitive(o,e,i,t),this.rearrange(e,i),this.processStart(e,i),this.getResult(e,i,r,t),r.length>0?fe.build2(r):null}static zoomLines(o,t){return this.zoomPolygon(fe.build2(o.primitives.concat(o.reverse().primitives)),t/2)}static getPanPrimitive(o,t,e,r){let i=o.primitives;for(let n of i){let s=this.panDistance(n,r);s!==void 0&&(t.push(s),e.push(n))}}static rearrange(o,t){let e=o.length,r=0;for(let s=0;s<e;s++){let a=t[s],l=o[s],c=s==e-1?o[0]:o[s+1];if(!(l instanceof q&&c instanceof q)&&!this.isCW(l.end(),c.start(),a.end())){if(Pf(l,c)!=0){r=s==e-1?0:s+1;break}}else{r=s;break}}let i=this.start4Index(t,r),n=this.start4Index(o,r);t.length=0,o.length=0,i.forEach(s=>{t.push(s)}),n.forEach(s=>{o.push(s)})}static processStart(o,t){let e=o.length;if(e>2){let r=o[e-1],i=o[0],n=t[e-1];if(!(r instanceof q&&i instanceof q)&&!this.isCW(r.end(),i.start(),n.end())){let s=Pf(r,i);for(let a=0;a<s;a+=2){let l=new S(Ke[a],Ke[a+1]);o[e-1]=this.generatePrimitive(r,r.start(),l),o[0]=this.generatePrimitive(i,l,i.end())}}}}static getResult(o,t,e,r){let i=o.length;for(let n=0;n<i;n++){let s=t[n],a=n===i-1?t[0]:t[n+1],l=n==i-1?0:n+1,c=l==i-1?t[0]:t[l+1],h=o[n],u=n==i-1?o[0]:o[n+1],d=l==i-1?o[0]:o[l+1];if(!(h instanceof q&&u instanceof q)&&!this.isCW(h.end(),u.start(),s.end())){let m=this.add(o,e,n,h,u,0);m=this.update(o,e,n,u,m);let g=this.generateArc(a,c,u,d,r);if(m=this.add(o,e,n,h,g,m),m=this.update(o,e,n,g,m),m>0)continue}e.push(h);let p=this.generateArc(s,a,h,u,r);p!==void 0&&e.push(p)}}static generateArc(o,t,e,r,i){if(i>0){let n=o.end(),s=t.start(),a=e.end(),l=r.start();if(a.distance2(l)>1e-8)if(n.equals(s)){let c=a.angleD(n),h=l.angleD(n);return q.build2(n,c,h,i,i,0)}else{let c=a.angleD(n),h=l.angleD(n),u=a.angleD(s),d=l.angleD(s),p=q.build2(n,c,h,i,i,0),m=q.build2(s,u,d,i,i,0);return p.pointOn(p.endAngle()).equals1(l)?p:m.pointOn(m.endAngle()).equals1(l)?m:p}}}static updateNews(o,t,e,r){let i=o.length,n=t==i-1?0:t+1;o[n]=this.generatePrimitive(e,r,e.end())}static add(o,t,e,r,i,n){if(n>0)return n;if(r!=null&&i!=null){let s=Pf(r,i);for(let a=0;a<s;a+=2){let l=new S(Ke[a],Ke[a+1]);t.push(this.generatePrimitive(r,r.start(),l)),this.updateNews(o,e,i,l);break}return s}else return 0}static update(o,t,e,r,i){if(i>0)return i;let n=t.length;if(n>0&&r!=null){let s=t[n-1],a=Pf(s,r);for(let l=0;l<a;l+=2){let c=new S(Ke[l],Ke[l+1]);t[n-1]=this.generatePrimitive(s,s.start(),c),this.updateNews(o,e,r,c)}return a}else return 0}static generatePrimitive(o,t,e){if(o instanceof M)return new M(t,e);if(o instanceof q){let r=o,i=t.angleD(r.center),n=e.angleD(r.center);return q.build2(r.center,i,n,r.rx,r.ry,r.sweep())}else throw new Error("not supported operation")}static start4Index(o,t){let e=o.length,r=new Array;for(let i=t;i<e;i++)r.push(o[i]);for(let i=0;i<t;i++)r.push(o[i]);return r}static isCW(o,t,e){let r=new M(e,o),i=new M(e,t),n=r.end().x-r.start().x,s=r.end().y-r.start().y,a=i.end().x-i.start().x,l=i.end().y-i.start().y;return!(n*l-s*a>0)}static panDistance(o,t){if(o instanceof M){if(o.isPoint())return;{let e=o.panDistance(t);return e.length()>1e-5?e:void 0}}else if(o instanceof q){let e=o;if(e.sweepAngle>0){if(e.rx-t<=0||e.ry-t<=0)return}else if(e.sweepAngle<0&&(e.rx+t<=0||e.ry+t<=0))return;return e=e.panDistance(t),e.start().distance1(e.end())>1e-5||mr.eq(Math.abs(e.sweepAngle),360)?e:void 0}else throw new Error("not supported operation")}},co=.001,y1=co**2;function un(o,t){return o.distance2(t)<y1}function J9(o,t){return Math.abs(o-t)<=1e-4}function NQe(o,t){if(o instanceof M)return new M(o.start(),t);if(o instanceof q){let e=t.angleD(o.center);return J9(To.regularD(o.startAngle),To.regularD(e))?q.build3(o.center,o.startAngle,0,o.rx,o.ry):q.build2(o.center,o.startAngle,e,o.rx,o.ry,o.isCCW?1:0)}else{if(o instanceof Mr)return o.clip(o.getPercent(t,co))[0];throw new Error("not supported operation")}}function sS(o,t=To.toRadians(o.startAngle)){return o.isCCW?t+=EZ:t-=EZ,new S(Math.cos(t),Math.sin(t))}function zH(o,t=0){let e=o.controls;if(t===0){let r=e[0],i=e.slice(1).find(n=>!(n.x===r.x&&n.y===r.y));if(!i)throw Error("getTangentBezier(bezier: Bezier, t: number = 0)");return i.sub(r)}else if(t===1){let r=e[e.length-1],i=e.slice(0,-1).reverse().find(n=>!(n.x===r.x&&n.y===r.y));if(!i)throw Error("getTangentBezier(bezier: Bezier, t: number = 0)");return r.sub(i)}if(e.length===3){let[r,i,n]=e;return i.sub(r).mul(2*(1-t)).add(n.sub(i).mul(2*t)).normalize()}else{let[r,i,n,s]=e;return i.sub(r).mul(3*(1-t)**2).add(n.sub(i).mul(6*(1-t)*t)).add(s.sub(n).mul(3*t**2)).normalize()}}function A7(o,t,e){let r=o.slice(1).findIndex(n=>!(n.x===t.x&&n.y===t.y)),i=o[r+1];if(e&&(e.getPercent(i,co)!==null||new M(e.start(),e.end()).distance(i)<=co)&&(i=o[r+2]),!i)throw Error("getSecondPoint(controls: readonly Vector2[])");return i}function lo(o,t){if(o instanceof M)return o.end().sub(o.start()).normalize();if(o instanceof q)return(t?sS(o,t.angle(o.center)):sS(o)).normalize();if(o instanceof Mr)if(o.controls.length===2){let[e,r]=o.controls;if(un(e,r))throw Error("equalsPP(p0, p1)");return r.sub(e).normalize()}else return(t?zH(o,o.getPercent(t,co)):zH(o)).normalize();else throw new Error("not support")}function kQe(o,t,e){let r=[],i=t**2-4*o*e;if(i>=0){let n=-t/(2*o),s=Math.sqrt(i)/(2*o),a=n+s;if(r.push(a),i>0){let l=n-s;r.push(l)}}return r}function BQe(o,t,e,r,i=0,n=1){let s=[],a=o*Math.pow(i,3)+t*Math.pow(i,2)+e*i+r,l=o*Math.pow(n,3)+t*Math.pow(n,2)+e*n+r,c,h;if(a*l<0)for(;Math.abs(i-n)>co;)if(c=(i+n)/2,h=o*Math.pow(c,3)+t*Math.pow(c,2)+e*c+r,Math.abs(h)<co){s.push(c);break}else a*h<0?n=c:l*h<0&&(i=c);else a*l===0&&(a===0&&s.push(i),l===0&&s.push(n));return s}function T1e(o,t,e){if(o instanceof M||t.distance2(e)<=y1)return new M(t,e);if(o instanceof q)return q.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?1:0);if(o instanceof Mr){let r=o.getPercent(t,co),i=o.getPercent(e,co);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function U1e(o){return mr.greater(o,0)&&mr.less(o,1)}function AZ(o,t,e,r){let i=o[r]-2*t[r]+e[r],n=t[r]-o[r];if(i===0)return[];let s=-n/i,a=[];return U1e(s)&&a.push(s),a}function _Z(o,t,e,r,i){let n,s,a=-o[i]+3*t[i]-3*e[i]+r[i],l=2*(o[i]-2*t[i]+e[i]),c=t[i]-o[i],h=l**2-4*a*c;if(mr.lesseq(h,0))n=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;else{let d=Math.sqrt(h);n=(-l-d)/(2*a),s=(-l+d)/(2*a);let p=a*2;if(mr.lesseq(n,1)&&mr.greatereq(n,0)){let m=Number.NEGATIVE_INFINITY;for(;mr.neq(n,m);){m=n;let g=p*n+l;n=-(a*n**2+l*n+c-g*n)/g}}if(mr.lesseq(s,1)&&mr.greatereq(s,0)){let m=Number.NEGATIVE_INFINITY;for(;mr.neq(s,m);){m=s;let g=p*s+l;s=-(a*s**2+l*s+c-g*s)/g}}}let u=[];return U1e(s)&&u.push(s),U1e(n)&&u.push(n),u}function Jve(o,t){if(o.controls.length===2){let[a,l]=o.controls;un(a,l)||t.push(new M(a,l));return}let e,r;if(o.controls.length===3){let[a,l,c]=o.controls;e=AZ(a,l,c,"x"),r=AZ(a,l,c,"y")}else{let[a,l,c,h]=o.controls;e=_Z(a,l,c,h,"x"),r=_Z(a,l,c,h,"y")}e.sort((a,l)=>l-a),r.sort((a,l)=>l-a);let i=e.pop()||1,n=r.pop()||1,s=0;for(;i!==1||n!==1;)if(mr.eq(i,n))i=e.pop()||1,n=r.pop()||1;else if(i<n){let[a,l]=o.clip((i-s)/(1-s));s=i,t.push(a),o=l,i=e.pop()||1}else{let[a,l]=o.clip((n-s)/(1-s));s=n,t.push(a),o=l,n=r.pop()||1}t.push(o)}var FQe=1e-5,Q1e=1,Mr=class my extends Tl{constructor(t){if(super(),this._startToEndL=null,t.length<2)throw new Error("Bezier needs at least 2 endpoints");this.controls=t.slice()}get startToEndL(){return this._startToEndL===null&&(this._startToEndL=new M(this.start(),this.end())),this._startToEndL}build1(t){let e=[];return _7(t,(r,i)=>(e.push(i),!0)),new my(e)}start(){return this.controls[0]}end(){return this.controls[this.controls.length-1]}static pointOn(t,e){if(e.length<1)throw new Error("bezier must have at least 1 point");if(e.length===1)return e[0];{let r=new Array(e.length-1);for(let i=1;i<e.length;i++){let n=e[i-1],s=e[i],a=(s.x-n.x)*t,l=(s.y-n.y)*t;r[i-1]=n.add1(a,l)}return my.pointOn(t,r)}}clip1(t,e,r,i){if(r.push(e[0]),i.push(e[e.length-1]),e.length<2)throw new Error("bezier clip must have at least 2 point");if(e.length===2){let n=e[0],s=e[1],a=(s.x-n.x)*t,l=(s.y-n.y)*t,c=n.add1(a,l);r.push(c),i.push(c)}else{let n=new Array(e.length-1);for(let s=1;s<e.length;s++){let a=e[s-1],l=e[s],c=(l.x-a.x)*t,h=(l.y-a.y)*t;n[s-1]=a.add1(c,h)}this.clip1(t,n,r,i)}}clip(t){let e=[],r=[];return this.clip1(t,this.controls,e,r),[new my(e),new my(r.reverse())]}greater(t,e,r){return t-e>r}less(t,e,r){return t-e<-r}eq(t,e,r){return Math.abs(t-e)<=r}eqPP(t,e,r){return!t||!e?!1:this.eq(t.x,e.x,r)&&this.eq(t.y,e.y,r)}isInRange(t,e=mr.eps){let r=this.controls.map(n=>n.y-t.y),i=0;for(let n of r){if(this.less(n,0,e))i=i|1;else if(this.greater(n,0,e))i=i|2;else{i=3;break}if(i===3)break}if(i!==3)return!1;i=0;for(let n of this.controls){let s=n.x-t.x;if(this.less(s,0,e))i=i|1;else if(this.greater(s,0,e))i=i|2;else{i=3;break}if(i===3)break}return i===3}getPercent(t,e=mr.eps){if(!this.isInRange(t,e))return null;let r=Number.POSITIVE_INFINITY,i=[[this,0,1]];for(;i.length!==0;){let n=function(y){h=Math.min(h,y),u=Math.max(u,y)},s=function(y,b){let P=Z9(y,b);if(P===0)throw new Error("cnt === 0");for(let T=0;T<P;T+=2)n(Ke[T])},[a,l,c]=i.pop();if(this.eqPP(a.start(),t,e))return l;if(this.eqPP(a.end(),t,e))return c;let h=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,d=a.controls.map(y=>y.y-t.y);r=d.reduce((y,b)=>{let P=Math.abs(b);return P<y?P:y},r),r/=2,r<=e&&(r=e),d.forEach((y,b)=>{this.eq(y,0,e)&&n(b/(d.length-1))});let p=new M(new S(0,-r),new S(1,-r)),m=new M(new S(0,r),new S(1,r));for(let y=0;y<d.length-1;y++){let b=new S(y/(d.length-1),d[y]),P=this.less(b.y,0,e)?1:this.greater(b.y,0,e)?2:3;for(let T=0;T<d.length;T++){let I=new S(T/(d.length-1),d[T]),C=this.less(I.y,0,e)?1:this.greater(I.y,0,e)?2:3;P!==C&&(P===1?C===2?(s(new M(b,I),p),s(new M(b,I),m)):s(new M(b,I),p):P===2?C===1?(s(new M(b,I),p),s(new M(b,I),m)):s(new M(b,I),m):C===1?s(new M(b,I),p):s(new M(b,I),m))}}if(!isFinite(h)){if(Math.max(...d.map(y=>Math.abs(y)))<e*4)return(l+c)/2;continue}if(h!==0&&(a=a.clip(h)[1],l=(c-l)*h+l),u!==1){let y=(u-h)/(1-h);a=a.clip(y)[0],c=(c-l)*y+l}if(!a.isInRange(t,e))continue;let g=a.controls.reduce((y,b)=>y.ext2(b),new _e).build1();if(this.eq(g.minX,g.maxX,e)&&this.eq(g.minY,g.maxY,e))return(l+c)/2;if(u-h>.8){let[y,b]=a.clip(.5);y.isInRange(t,e)?(i.push([y,l,(l+c)/2]),b.isInRange(t,e)&&i.push([b,(l+c)/2,c])):i.push([b,(l+c)/2,c])}else i.push([a,l,c])}return null}toBezier(){return this}toString(){return"Bezier ["+this.controls.join(" ")+"]"}bbox(){return this._bbox||(this._bbox=new _e().ext3(this.points(.1)).build1()),this._bbox}bboxWithControls(){return this._bbox_controls||(this._bbox_controls=new _e().ext3(this.controls).build()),this._bbox_controls}multiply3(t){let e=new Array(this.controls.length);for(let r=0;r<this.controls.length;r++){let i=this.controls[r];e[r]=i.multiply3(t)}return new my(e)}stroke(t,e,r,i=Q1e){let n=MQe.zoomLines(fe.build4(this.points(i)),t);return r===0?n:n.reverse()}points(t){let e=[];return this.getBezierPoints(t,r=>e.push(r)),e}getBezierPoints(t,e){if(this.controls.length===2){e(this.start()),e(this.end());return}let r=[this];for(e(this.start());r.length!==0;){let n=r.pop(),s=new M(n.start(),n.end());if(i(n.controls,s)<=t)e(n.end());else{let[a,l]=n.clip(.5);r.push(l,a)}}function i(n,s){let a=s.start(),l=s.end();a.equals1(l)&&(l=a.add1(1,0));let c=l.y-a.y,h=a.x-l.x,u=-c*a.x-h*a.y,d=Math.sqrt(1/(c**2+h**2));c*=d,h*=d,u*=d;let p=n.map(m=>Math.abs(c*m.x+h*m.y+u));return Math.max(...p)}}getBezierPoints3(t,e){if(this.controls.length===2){e(this.start()),e(this.end());return}let r=t*t,i=this.controls[0],n=.5;for(;n>FQe&&!(i.distance2(my.pointOn(n,this.controls))<=r);n*=.5);let s=Math.ceil(1/n);n=1/s,e(i);let a=0;for(let l=1;l<s;l++)a+=n,e(my.pointOn(a,this.controls));e(this.end())}getPointsBySlope(t){if(this.controls.length===4)return this.getPointsBySlope4(t);throw new Error("Currently, only 4 control points are supported!")}getPointsBySlope4(t){let[e,r,i,n]=this.controls,s=-3*e.x+9*r.x-9*i.x+3*n.x,a=6*e.x-12*r.x+6*i.x,l=-3*e.x+3*r.x,c=[];if(Number.isFinite(t)){let h=-3*e.y+9*r.y-9*i.y+3*n.y,u=6*e.y-12*r.y+6*i.y,d=-3*e.y+3*r.y,p=h-s*t,m=u-a*t,g=d-l*t,y=-m/(2*p),b=Math.sqrt(m**2-4*p*g)/(2*p),P=y+b;P>=0&&P<=1&&c.push(my.pointOn(P,this.controls));let T=y-b;T>=0&&T<=1&&c.push(my.pointOn(T,this.controls))}else{let h=-a/(2*s),u=Math.sqrt(a**2-4*s*l)/(2*s),d=h+u;d>=0&&d<=1&&c.push(my.pointOn(d,this.controls));let p=h-u;p>=0&&p<=1&&c.push(my.pointOn(p,this.controls))}return c}buildConverxHull(t=mr.eps){let e=[...this.controls],r=[],i=e[0],n=1;do{let s=e[n%e.length];this.eqPP(i,s,t)||r.push(new M(i,s)),i=s,n++}while(i!==e[0]);if(r.length===0)throw Error("buildConverxHull(diff = DoubleKit.eps)");return fe.build7(r).asClose()}getExtremePoints(t){if(!t)return s(this.controls);let e=t.start(),r=t.end(),i=r.x-e.x,n=r.y-e.y;if(Math.abs(i)<=mr.eps||Math.abs(n)<=mr.eps)return s(this.controls);{let a=n/i;if(this.controls.length===3){e.equals1(r)&&(r=e.add1(1,0));let l=r.y-e.y,c=e.x-r.x,h=-l*e.x-c*e.y,u=Math.sqrt(1/(l**2+c**2));l*=u,c*=u,h*=u;let d=this.controls.map(g=>l*g.x+c*g.y+h),p=d[0]-2*d[1]+d[2],m=d[1]-d[0]-a/2;if(p!==0){let g=-m/p;if(mr.greater(g,0)&&mr.less(g,1))return[my.pointOn(g,this.controls)]}}else if(this.controls.length===4)return this.getPointsBySlope(a)}return[];function s(a){let l,c;if(a.length===3){let[p,m,g]=a;l=AZ(p,m,g,"x"),c=AZ(p,m,g,"y")}else if(a.length===4){let[p,m,g,y]=a;l=_Z(p,m,g,y,"x"),c=_Z(p,m,g,y,"y")}l.sort((p,m)=>m-p),c.sort((p,m)=>m-p);let h=l.pop()||1,u=c.pop()||1,d=[];for(;h!==1||u!==1;)mr.eq(h,u)?(h=l.pop()||1,u=c.pop()||1):h<u?(d.push(my.pointOn(h,a)),h=l.pop()||1):(d.push(my.pointOn(u,a)),u=c.pop()||1);return d}}getToLineMaxDis2(t){let e=this.getExtremePoints(t),r=t.distance2(this.start()),i=t.distance2(this.end()),n=Math.max(r,i);return e.forEach(a=>s(t.distance2(a))),n;function s(a){n=Math.max(n,a)}}getToLineMinAndMaxDis_Controls(t){let e=t.start(),r=t.end();t.start().equals1(t.end())&&(r=e.add1(1,0));let i=r.y-e.y,n=e.x-r.x,s=-i*e.x-n*e.y,a=Math.sqrt(1/(i**2+n**2));i*=a,n*=a,s*=a;let l=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY;return this.controls.forEach(h=>{let u=i*h.x+n*h.y+s;u<l&&(l=u),u>c&&(c=u)}),{minDis:l,maxDis:c}}getPercentInLine(t){let e=[],r=[],i=this.controls,n=t.start(),s=t.end(),a=s.y-n.y,l=n.x-s.x,c=-a*n.x-l*n.y,h=Math.sqrt(1/(a**2+l**2));if(a*=h,l*=h,c*=h,a**2+l**2<=0)return e;if(i.length===3){let[u,d,p]=i,m=a*(u.x-2*d.x+p.x)+l*(u.y-2*d.y+p.y),g=2*(a*(d.x-u.x)+l*(d.y-u.y)),y=a*u.x+l*u.y+c;r=kQe(m,g,y)}else if(i.length===4){let[u,d,p,m]=i,g=m.sub(p.mul(3)).add(d.mul(3)).sub(u),y=u.sub(d.mul(2)).add(p).mul(3),b=d.sub(u).mul(3),P=u,T=a*g.x+l*g.y,I=a*y.x+l*y.y,C=a*b.x+l*b.y,E=a*P.x+l*P.y+c,O=Math.sqrt(1/(T**2+I**2));T*=O,I*=O,C*=O,E*=O,r=BQe(T,I,C,E)}else throw Error("not support getBeizerPointInLine");return r.forEach(u=>{u>=0&&u<=1&&e.push(u)}),e}reverse(){return new my(this.controls.slice().reverse())}},Qve=class NH{constructor(){this.textCache=new Map,this.numCache=new Array(20),this.boxCache=new Array(4),this.textOffsetCache=new Array(9),this.BuildLineCache=new Array(7),this.BuildTrackCache=new Array(7),this.BuildViaCache=new Array(11),this.BuildBoxCache=new Array(10),this.BuildArcCache=new Array(10),this.BuildArcTrackCache=new Array(10),this.BuildTextCache=new Array(7),this.BuildPadStyleCache=new Array(4),this.BuildPadCache=new Array(12),this.ARRAY1=new Array(1),this.ARRAY2=new Array(2),this.ARRAY3=new Array(3),this.ARRAY4=new Array(4),this.ARRAY5=new Array(5),this.ARRAY6=new Array(6),this.ARRAY7=new Array(7),this.ARRAY8=new Array(8),this.ARRAY9=new Array(9),this.ARRAY10=new Array(10),this.ARRAY11=new Array(11),this.ARRAY12=new Array(12),this.textOffsetCache[0]=S.ORIGIN,this.textOffsetCache[1]=new S(0,-.5),this.textOffsetCache[2]=new S(0,-1),this.textOffsetCache[3]=new S(-.5,0),this.textOffsetCache[4]=new S(-.5,-.5),this.textOffsetCache[5]=new S(-.5,-1),this.textOffsetCache[6]=new S(-1,0),this.textOffsetCache[7]=new S(-1,-.5),this.textOffsetCache[8]=new S(-1,-1)}static getCache(){return NH.instance==null&&(NH.instance=new NH),NH.instance}};Qve.instance=null;var exe=Qve,M=class pL extends Tl{constructor(t,e){super(),this._start=t,this._end=e}get a(){return this._a==null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._a}get b(){return this._b==null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._b}get c(){return this._c==null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._c}get hashed(){return this._hashed==null&&(this._hashed=this._hashCode()),this._hashed}get direct(){return this._direct==null&&(this._direct=this._end.sub(this._start).normalize()),this._direct}cutLine(t){if(mr.eq(this.distance(t),0)){let e=new pL(this._start,t);return e._a=this._a,e._b=this._b,e._c=this._c,e}return new pL(this._start,t)}get midPoint(){return this._start.add(this._end).mul(.5)}toBezier(){return new Mr([this._start,this._end])}_hashCode(){let t=31,e=1;return e=t*e+this._start.hashCode(),e=t*e+this._end.hashCode(),e}start(){return this._start}end(){return this._end}center(){let t=this.start(),e=this.end();return t.add(e).mul(.5)}panDistance(t){let e=this._end.x-this._start.x,r=this._end.y-this._start.y,i=this.length();e=e*t/i,r=-r*t/i;let n=new S(this._start.x+r,this._start.y+e),s=new S(this._end.x+r,this._end.y+e);return new pL(n,s)}isPoint(){return this._start.distance2(this._end)<=1e-8}length(){return this._start.distance1(this._end)}toString(){return"Line [start="+this._start+", end="+this._end+"]"}bbox(){if(this.__bbox==null){let t=exe.getCache().boxCache;t[0]=Math.min(this._start.x,this._end.x),t[1]=Math.max(this._start.x,this._end.x),t[2]=Math.min(this._start.y,this._end.y),t[3]=Math.max(this._start.y,this._end.y),this.__bbox=new ut(t[0],t[1],t[2],t[3])}return this.__bbox}multiply3(t){return new pL(this._start.multiply3(t),this._end.multiply3(t))}hashCode(){return this.hashed}equals(t){let e=t;return this.hashed===e.hashed&&this._start.equals(e._start)&&this._end.equals(e._end)}equals1(t){let e=t;return this.hashed===e.hashed&&this._start.equals1(e._start)&&this._end.equals1(e._end)}equals2(t){let e=[this.start(),this.end()],r=[t.start(),t.end()];return oS(e,r)||oS(e,r.reverse())}stroke(t,e,r){let i,n,s;this._end.x<this._start.x?(n=this._start.x-this._end.x,s=this._start.y-this._end.y,i=this._end):(n=this._end.x-this._start.x,s=this._end.y-this._start.y,i=this._start);let a=Math.sqrt(n*n+s*s),l=t/2,c,h,u;e===2?(h=-l,u=a+l):(h=0,u=a),e===0||e===2?r===0?c=fe.build5([h,-l,h,l,u,l,u,-l]):c=fe.build5([h,l,h,-l,u,-l,u,l]):r===0?c=fe.build2([q.build3(new S(h,0),-90,-180,l,l),q.build3(new S(u,0),90,-180,l,l)]):c=fe.build2([q.build3(new S(h,0),90,180,l,l),q.build3(new S(u,0),-90,180,l,l)]);let d=Math.atan2(s,n),p=Qe.rotate(d).translate1(i);return c.asClose().multiply3(p)}points(t){return[this._start,this._end]}mirrorY(t){return new pL(this.start().mirrorY(t),this.end().mirrorY(t))}reverse(){return new pL(this._end,this._start)}inArea(t,e,r){let i=t.x,n=t.y,s=this._start,a=this._end,l=r==1,c=i-s.x,h=n-s.y,u=i-a.x,d=n-a.y,p=a.x-s.x,m=a.y-s.y,g=new S(-m,p).normalize(),y=p+g.x*e/2,b=m+g.y*e/2,P=y*y+b*b,T=c*c+h*h,I=u*u+d*d,C=Math.abs(c*m-h*p)/2,E=Math.sqrt(p*p+m*m)*e/4;if(C<=E&&T<=P&&I<=P){if(l)return!0;{let O=new S(i,n).sub(a).normalize(),_=new S(i,n).sub(s).normalize(),R=new S(g.x,g.y).cross(O),v=new S(g.x,g.y).cross(_);return R>=0&&v<=0}}else if(l){let O=e/2;return T<=O*O?!0:I<=O*O}else return!1}isParallel(t,e=!1){let r=mr.eq(Math.abs(this.direct.cross(t.direct)),0),i=!e||mr.greatereq(this.direct.dot(t.direct),0);return r&&i}distance2(t){return(this.a*t.x+this.b*t.y+this.c)**2/(this.a**2+this.b**2)}distance2ForPP(t){let{x:e,y:r}=t,{x:i,y:n}=this.start(),{x:s,y:a}=this.end();return((e-i)*(a-n)-(r-n)*(s-i))**2/((a-n)**2+(s-i)**2)}distance(t){return Math.abs(this.a*t.x+this.b*t.y+this.c)/Math.sqrt(this.a**2+this.b**2)}};function VQe(o,t=.05){if(o.length<3)return o.slice();let e=o.slice(0,1),r=(n,s,a)=>bQe(n.x,n.y,s.x,s.y,a.x,a.y);for(;;){e=o.slice(0,1);for(let n=1;n<o.length-1;n+=2)r(o[n],o[n-1],o[n+1])>t&&e.push(o[n]),e.push(o[n+1]);if(e.at(-1).equals1(o.at(-1))||e.push(o.at(-1)),o.length==e.length)break;o=e}let i=o[o.length-1];return e.push(i),e}var GQe=nQe(oQe());function Hp(o){if(o instanceof M)o=new M(o.end(),o.start());else if(o instanceof q)o=o.exchangeSweep();else if(o instanceof Mr)o=new Mr(o.controls.slice().reverse());else throw new Error("bug");return o}function txe(o){if(o.length>2){let t=o[0],e=new Array;e.push(t);for(let r=1,i=o.length;r<i;r++){let n=o[r],s=!1;if(r+1<i){let a=n.sub(t).normalize(),l=o[r+1].sub(t).normalize(),c=a.cross(l);Math.abs(c)<.01&&(s=!0)}s||(e.push(n),t=n)}return e}else return o}var UQe=class{constructor(){this.fac=new _e,this.length=0,this.box=null,this.pt=null,this.i=0}calcBBox(o){for(this.fac.clear(),this.length=o.length,this.box=null,this.pt=null,this.i=0;this.i<this.length;this.i++)this.pt=o[this.i],this.box=this.pt.bbox(),this.fac.ext1(this.box);return this.fac.build1()}},HQe=new UQe,fe=class Vp{constructor(t,e){this.primitives=t,this.__bbox=e}static calcBBox(t){return HQe.calcBBox(t)}static build1(t){let e=[],r=null;return CZ(t,(i,n)=>{let s=n.start();return r!==null&&!s.equals(r)&&e.push(new M(r,s)),e.push(n),r=n.end(),!0}),e.length===0&&r!=null&&e.push(new M(r,r)),new Vp(e)}static build2(t){return Vp.build1(F1e(t))}static build3(t){let e=[],r=null;return CZ(t,(i,n)=>(r!==null&&e.push(new M(r,n)),r=n,!0)),new Vp(e)}static build4(t){return this.build3(F1e(t))}static build5(t){let e=[];for(let r=0;r<t.length;r+=2)e.push(new S(t[r],t[r+1]));return this.build4(e)}static build6(t){return Vp.build4([t.LL(),t.LR(),t.UR(),t.UL(),t.LL()])}static build7(t){return new Vp(t)}static build8(t){let e=new S(t[0],t[1]),r,i=[],n,s=(a,l)=>a.length==l&&a.every(c=>typeof c=="number");for(let a=2;a<t.length;)switch(typeof t[a]=="string"?n=t[a]:a-=1,n){case"ARC":{let l=t.slice(a+1,a+4);if(!s(l,3))throw new Error("invalid rawData");let c=l[0];r=new S(l[1],l[2]),i.push(q.build5(e,r,c)),e=r,a+=4;break}case"L":{let l=t.slice(a+1,a+3);if(!s(l,2))throw new Error("invalid rawData");r=new S(l[0],l[1]),i.push(new M(e,r)),e=r,a+=3;break}case"C":{let l=t.slice(a+1,a+7);if(!s(l,7))throw new Error("invalid rawData");let c=new S(l[0],l[1]),h=new S(l[2],l[3]);r=new S(l[4],l[5]),i.push(new Mr([e,c,h,r])),e=r,a+=7;break}default:throw new Error("invalid rawData")}return Vp.build2(i)}static buildBBox(t,e=0){return e===1?Vp.build5([t.minX,t.minY,t.maxX,t.minY,t.maxX,t.maxY,t.minX,t.maxY,t.minX,t.minY]):Vp.build5([t.minX,t.minY,t.minX,t.maxY,t.maxX,t.maxY,t.maxX,t.minY,t.minX,t.minY])}static triangulate(t,e,r=1,i=!1){let n=i?(h,u)=>{h.points(r,u)}:(h,u)=>{h.points2(r,u)};if(t.length===1){let h=new Array;n(t[0].asClose(),m=>h.push(m));let u,d=h[0],p=[];for(let m=0;m<h.length-2;m+=2){let g=h[m+1],y=h[m+2],b=g.sub(d).normalize().cross(y.sub(d).normalize());if(mr.neq(b,0)){if(u===!0){if(b<0){p.length=0;break}}else if(u===!1){if(b>0){p.length=0;break}}else u=b>0;p.push(d),p.push(g),p.push(y)}h.push(d),d=y}if(p.length!==0){for(let m=0;m<p.length;m+=3)e(p[m],p[m+1],p[m+2]);return}}let s=[],a=[];t.forEach(h=>{s.length!==0&&a.push(s.length/2),n(h.asClose(),u=>s.push(u.x,u.y))});let l=GQe.default(s,a),c=[];for(let h=1;h<s.length;h+=2)c.push(new S(s[h-1],s[h]));for(let h=0;h<l.length;h+=3)e(c[l[h]],c[l[h+1]],c[l[h+2]])}lines(t,e){let r=new Array;this.points(t,n=>r.push(n));let i=r[0];for(let n=1;n<r.length;n++){let s=r[n];e(i),e(s),i=s}}triangles(t,e,r=!1){Vp.triangulate([this],(...i)=>{i.forEach(n=>e(n))},t,r)}mirror(){let t=[];return this.primitives.forEach(e=>{if(e instanceof M)e=new M(e.start().mirror(),e.end().mirror());else if(e instanceof q)e=e.mirror();else if(e instanceof Mr){let r=e.controls.map(i=>i.mirror());e=new Mr(r)}else throw new Error("bug");t.push(e)}),new Vp(t,this.__bbox)}getPoints(t){let e=[];for(let r of this.primitives)for(let i of r.points(t))e.push(i);return e}round(t=4){let e=this.primitives.slice();for(let r=0;r<e.length;r++){let i=e[r];if(i instanceof M){let n=i.start().round(t),s=i.end().round(t);e[r]=new M(n,s)}else if(i instanceof Mr){let n=i.controls.map(s=>s.round(t));e[r]=new Mr(n)}else if(i instanceof q){let n=i.start().round(t),s=i.end().round(t),a=i.sweepAngle;e[r]=q.build5(n,s,a)}}return new Vp(e,this.__bbox)}simplify(t=.05){let e=[],r=!1,i=[],n=this.closed();if(this.primitives.length<=1)return Vp.build2(this.primitives);let s=()=>{if(i.length>2){let l=VQe(i,t);for(let c=1;c<l.length;c++)e.push(new M(l[c-1],l[c]))}else e.push(new M(i[0],i[1]));i.length=0,r=!1};for(let l=0;l<this.primitives.length;l++){let c=this.primitives[l];c instanceof M?(r?i.push(c.end()):(i.length=0,i.push(c.start(),c.end()),r=!0),l===this.primitives.length-1&&s()):(r&&s(),e.push(c))}let a=new Vp(e,this.__bbox);return n&&!a.closed()&&(a=a.asClose()),a}hasBackLine(){let{primitives:t}=this,e;for(let r=0;r<t.length;r++){let i=t[r];if(i instanceof M){if(i.end().equals1(i.start()))continue;if(e&&(i.end().equals1(e.start())||PQe(i.end(),e.start(),e.end())))return!0;e=i}else e=null}return!1}area(t=.1){let e=0,r=this.end();return this.primitives.forEach(i=>{let n=i.start(),s=i.end();if(e+=(n.x+r.x)*(n.y-r.y),i instanceof M)e+=(s.x+n.x)*(s.y-n.y);else if(i instanceof q)e+=(s.x+n.x)*(s.y-n.y),e+=Math.PI*i.rx2*i.sweepAngle/180-S.normal(i.center,i.start(),i.end());else if(i instanceof Mr){let a=n;i.points(t).forEach(l=>{e+=(l.x+a.x)*(l.y-a.y),a=l}),e+=(s.x+a.x)*(s.y-a.y)}r=s}),e/2}closed(t){return this.primitives.length===0?!1:this.start().equals(this.end(),t)}asClose(){let t=this.primitives[0],e=this.primitives[this.primitives.length-1],r=t.start(),i=e.end();if(r.equals(i))return this;{let n=new Array;return m1.addAll(n,this.primitives),n.push(new M(i,r)),Vp.build2(n)}}closeEndpoint(){let t=this.primitives[0],e=this.primitives[this.primitives.length-1],r=t.start(),i=e.end();if(r.equals1(i))return this;{let n=new Array;return m1.addAll(n,this.primitives),n.push(new M(i,r)),new Vp(n)}}reverse(){let t=new Array(this.primitives.length);for(let e=0,r=this.primitives.length-1;r>=0;e++,r--){let i=this.primitives[r];if(i instanceof M)i=new M(i.end(),i.start());else if(i instanceof q)i=i.exchangeSweep();else if(i instanceof Mr)i=new Mr(i.controls.slice().reverse());else throw new Error("bug");t[e]=i}return new Vp(t,this.__bbox)}reverse1(){let t=new Array(this.primitives.length);for(let e=0,r=this.primitives.length-1;r>=0;e++,r--){let i=this.primitives[r];if(i instanceof M)i=new M(i.end(),i.start());else if(i instanceof q)i=i.exchangeSweep1();else if(i instanceof Mr)i=new Mr(i.controls.slice().reverse());else throw new Error("bug");t[e]=i}return new Vp(t,this.__bbox)}mirrorY(t){let e=[];return this.primitives.forEach(r=>{if(r instanceof M)r=r.mirrorY(t);else if(r instanceof q)r=r.mirrorY(t);else if(r instanceof Mr){let i=r.controls.map(n=>n.mirrorY(t));r=new Mr(i)}else throw new Error("bug");e.push(r)}),new Vp(e,this.__bbox)}points(t,e){if(this.primitives.length!==0){for(let r=0;r<this.primitives.length-1;r++){let i=this.primitives[r].points(t);i.pop(),i.forEach(n=>e(n))}this.primitives[this.primitives.length-1].points(t).forEach(r=>e(r))}}points1(t,e){if(this.primitives.length===0)return;for(let i=0;i<this.primitives.length-1;i++){let n=this.primitives[i],s=n instanceof q?n.points1(t):n.points(t);s.pop(),s.forEach(a=>e(a))}let r=this.primitives[this.primitives.length-1];(r instanceof q?r.points1(t):r.points(t)).forEach(i=>e(i))}points2(t,e){if(this.primitives.length===0)return;for(let i=0;i<this.primitives.length-1;i++){let n=this.primitives[i],s=n instanceof q?n.points2():n.points(t);s.pop(),s.forEach(a=>e(a))}let r=this.primitives[this.primitives.length-1];(r instanceof q?r.points2():r.points(t)).forEach(i=>e(i))}multiply3(t){let e=new Array(this.primitives.length);for(let r=0;r<this.primitives.length;r++)e[r]=this.primitives[r].multiply3(t);return Vp.build7(e)}bbox(){return this.__bbox==null&&(this.__bbox=Vp.calcBBox(this.primitives)),this.__bbox}start(){return this.primitives.length!==0?this.primitives[0].start():null}end(){return this.primitives.length!==0?this.primitives[this.primitives.length-1].end():null}isClose(t){if(this.primitives.length<=1&&!(this.primitives[0]instanceof q))return!1;{let e=this.primitives[0],r=this.primitives[this.primitives.length-1];return e.start().equals(r.end(),t)}}isEqual(t){if(t instanceof Vp&&t.primitives.length==this.primitives.length){let e=t.primitives.length;for(let r=0;r<e;r++){let i=t.primitives[r],n=this.primitives[r];if(JSON.stringify(i)!=JSON.stringify(n))return!1}return!0}return!1}equals(t){if(!t)return!1;let e=this.primitives,r=t.primitives;if(e.length!=r.length)return!1;if(t.isClose()){let i=0;for(;i<e.length;){let n=e.slice(i).concat(e.slice(0,i));if(oS(n,r)||oS(n.reverse(),r))return!0;i++}return!1}else return oS(this.primitives,t.primitives)}clone(){return Vp.build2(this.primitives)}putItem(t,e){if(!t)return!1;if(t instanceof Vp)return this.mergePolyline(t,e);let r=this.start();if(!r){this.primitives.push(t),this.__bbox=t.bbox();return}let i=this.end();if(r.equals(i,e))return!1;let n=t.start(),s=t.end(),a=!1,l=!1;if(r.equals(n,e))a=!0,l=!1;else if(r.equals(s,e))a=!1,l=!1;else if(i.equals(n,e))a=!1,l=!0;else if(i.equals(s,e))a=!0,l=!0;else return!1;return l?this.primitives.push(a?t.reverse():t):this.primitives.unshift(a?t.reverse():t),this.__bbox=ut.extend2(this.__bbox,t.bbox()),!0}mergePolyline(t,e,r=0){if(!t)return!1;let i=this.start();if(!i){this.primitives.push(...t.primitives),this.__bbox=t.bbox();return}let n=this.end();if(i.equals(n,e))return!1;let s=t.start(),a=t.end(),l=!1,c=!1;if(i.equals(s,e))l=!0,c=!1;else if(i.equals(a,e))l=!1,c=!1;else if(n.equals(s,e))l=!1,c=!0;else if(n.equals(a,e))l=!0,c=!0;else return!1;let h=l?t.reverse():t;return c?this.primitives.push(...h.primitives):this.primitives.unshift(...h.primitives),this.__bbox=ut.extend2(this.__bbox,t.bbox()),!0}deDuplicationPoint(t){let e=this.primitives[this.primitives.length-1].start(),r=this.primitives[this.primitives.length-1].end(),i=t.primitives[0].start(),n=t.primitives[0].end();if(this.primitives[this.primitives.length-1]instanceof M&&t.primitives[0]instanceof M&&AQe([e,r],[i,n])){this.primitives.pop(),t.primitives.shift();let s=[];s.push(new M(e,n)),this.primitives.push(...s)}}getMaxBBoxHeightByVec(t){let e=t.normalize(),r=-1/0,i=1/0;if(this.primitives.forEach(s=>{let a=s.start().dot(e),l=s.end().dot(e);if(n(a),n(l),s instanceof q){let c=t.angleD(S.ORIGIN);if(s.angleIsInArc(c)){let h=s.pointOn(c).dot(e);n(h)}if(s.angleIsInArc(c+180)){let h=s.pointOn(c-180).dot(e);n(h)}}}),r-i<=0)throw new Error("getMaxBBoxHeightByVec");return r-i;function n(s){s>r&&(r=s),s<i&&(i=s)}}getWindingNum(t){let e=this.end(),r=0,{x:i,y:n}=t;for(let a of this.primitives){if(e.y>n?a.bbox().minY>n:a.bbox().maxY<=n){e=a.end();continue}if(a instanceof q&&(a.isCCW?Math.floor(a.startAngle/90)+1!==Math.ceil(a.endAngle()/90):Math.ceil(a.startAngle/90)-1!==Math.floor(a.endAngle()/90))){let l=a.startAngle,c=a.endAngle();if(a.sweepAngle>0){let h=90;for(;h<=c;)h>l&&(s(q.build3(a.center,l,h-l,a.rx,a.ry)),l=h),h+=90;l<c&&s(q.build3(a.center,l,c-l,a.rx,a.ry))}else{let h=270;for(;h>=c;)h<l&&(s(q.build3(a.center,l,h-l,a.rx,a.ry)),l=h),h-=90;l>c&&s(q.build3(a.center,l,c-l,a.rx,a.ry))}}else if(a instanceof Mr){let l=[];Jve(a,l),l.forEach(c=>s(c))}else s(a)}return r;function s(a){let l=a.start(),c=a.end();if(e.y>n!=l.y>n&&(e.x>i?l.x>i?r+=l.y>e.y?1:-1:e.y>l.y?(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)<0&&r--:(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)>0&&r++:l.x>i&&(e.y>l.y?(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)<0&&r--:(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)>0&&r++)),l.y>n!=c.y>n){if(l.x>i)if(c.x>i)r+=c.y>l.y?1:-1;else if(a instanceof M)l.y>c.y?(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)<0&&r--:(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)>0&&r++;else if(a instanceof q){let{center:h,isCCW:u,rx2:d}=a,p=(h.x-i)**2+(h.y-n)**2;l.y>c.y?(u?p>d:p<d)&&r--:(u?p<d:p>d)&&r++}else if(a instanceof Mr){if(Ove(a,n)===0)throw new Error("no inters");Ke[0]>i&&(r+=c.y>l.y?1:-1)}else throw new Error("not support!");else if(c.x>i)if(a instanceof M)l.y>c.y?(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)<0&&r--:(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)>0&&r++;else if(a instanceof q){let{center:h,isCCW:u,rx2:d}=a,p=(h.x-i)**2+(h.y-n)**2;l.y>c.y?(u?p>d:p<d)&&r--:(u?p<d:p>d)&&r++}else if(a instanceof Mr){if(Ove(a,n)===0)throw new Error("no inters");Ke[0]>i&&(r+=c.y>l.y?1:-1)}else throw new Error("not support!")}e=c}}},lZ=Math.PI*2,v4t=Math.PI/2,x4t=Math.sin(Math.PI/180),WQe=4,q=class Bc extends Tl{constructor(t,e,r,i,n){super(),this.rx=t,this.ry=e,this.center=r,this.startAngle=i,this.sweepAngle=n,this._start=S.ORIGIN,this._end=S.ORIGIN,this._start=this.pointOn(i),this._end=this.pointOn(i+n)}get hashed(){return this._hashed==null&&(this._hashed=this._hashCode()),this._hashed}hashCode(){return this.hashed}_hashCode(){let t=31,e=1;return e=t*e+new S(this.rx,this.rx).hashCode(),e=t*e+this.center.hashCode(),e=t*e+new S(this.startAngle,this.sweepAngle).hashCode(),e}get rx2(){return this._rx2==null&&(this._rx2=this.rx*this.rx),this._rx2}get ry2(){return this._ry2==null&&(this._ry2=this.ry*this.ry),this._ry2}get svgEnd(){return this._svgEnd==null&&(this._svgEnd=this.getSvgEnd(this.startAngle,this.sweepAngle,this._start,this._end)),this._svgEnd}getSvgEnd(t,e,r,i){let n=e>=0?-.01:.01,s=t+e;for(;(e>=0&&s>t||e<0&&s<t)&&r.distance2(i)<2e-4;)n*=2,s+=n,i=this.pointOn(s);return i}static build1(t,e,r,i,n,s){rl.positive(r),rl.positive(i);let a=t.equals(e);if(a)return new Bc(r,i,t,0,n?360:0);{let l=t.x,c=-t.y,h=e.x,u=-e.y,d=s===0,p=(l-h)/2,m=(c-u)/2,g=Math.cos(0),y=Math.sin(0),b=g*p+y*m,P=-y*p+g*m;r=Math.abs(r),i=Math.abs(i);let T=r*r,I=i*i,C=b*b,E=P*P,O=n===d?-1:1,_=(T*I-T*E-I*C)/(T*E+I*C);_=_<0?0:_;let R=O*Math.sqrt(_),v=R*(r*P/i),D=R*-(i*b/r),w=(l+h)/2,F=(c+u)/2,H=w+(g*v-y*D),z=F+(y*v+g*D),G=(b-v)/r,W=(P-D)/i,L=(-b-v)/r,B=(-P-D)/i,N,U;U=Math.sqrt(G*G+W*W),N=G,O=W<0?-1:1;let k=To.toDegrees(O*Math.acos(N/U));U=Math.sqrt((G*G+W*W)*(L*L+B*B)),N=G*L+W*B,O=G*B-W*L<0?-1:1;let V=N/U,Y;V<-1?Y=Math.acos(-1):V>1?Y=Math.acos(1):Y=Math.acos(V);let X=To.toDegrees(O*Y);!d&&X>0?X-=360:d&&X<0&&(X+=360),rl.normal(k),rl.normal(X);let Z=p*p/T+m*m/I,Q=t.distance1(e)/2;r<Q&&i<Q&&(r*=Math.sqrt(Z),i*=Math.sqrt(Z));let ae=a?0:To.regularD(-k),he=a?n?360:0:-X;return new Bc(r,i,new S(H,-z),ae,he)}}static build2(t,e,r,i,n,s){rl.positive(i),rl.positive(n),rl.normal(e),rl.normal(r);let a;return e===r?(e=To.regularD(e),r=To.regularD(r),a=0):(e=To.regularD(e),r=To.regularD(r),s===1?r<=e&&(r+=360):r>=e&&(e+=360),a=r-e),new Bc(i,n,t,To.regularD(e),a)}static build3(t,e,r,i,n){return rl.positive(i),rl.positive(n),rl.normal(r),new Bc(i,n,t,To.regularD(e),r)}static build4(t,e,r,i,n,s){let a=t.angleD(r),l=e.angleD(r);return Bc.build2(r,a,l,i,n,s)}static build5(t,e,r){r=To.toRadians(r);let i=e.sub(t),n=new S(-i.y,i.x).normalize(),s=Math.abs(r)/2,a;if(s!=0)a=i.length()/2/Math.sin(s);else throw new Error("Can't represent circle!!!");let l=n.rotate(S.ORIGIN,s),c,h;r>0?(c=1,h=e.add(l.scale(a))):(c=0,h=t.sub(l.scale(a)));let u=To.toDegrees(t.angle(h)),d=To.toDegrees(e.angle(h));return Bc.build2(h,u,d,a,a,c)}static buildCircle(t,e,r=0){return Bc.build2(t,0,360,e,e,r)}start(){return this._start}end(){return this._end}isLarge(){return Math.abs(this.sweepAngle)>180}sweep(){return this.sweepAngle>=0?1:0}get isCCW(){return this.sweepAngle>=0}endAngle(){return this.startAngle+this.sweepAngle}pointOn(t){t=To.regularD(t);let e=this.rx,r=this.ry;if(t===0)return this.center.add1(e,0);if(t===90)return this.center.add1(0,r);if(t===180)return this.center.add1(-e,0);if(t===270)return this.center.add1(0,-r);{let i=this.rx2,n=this.ry2,s=Math.tan(To.toRadians(t)),a=s*s,l=Math.sqrt(i*n/(i+n/a)),c=Math.sqrt(i*n/(n+i*a));return t>90&&t<270&&(c=-c),t>180&&t<360&&(l=-l),isNaN(c)&&(c=0),isNaN(l)&&(l=0),this.center.add1(c,l)}}exchangeSweep(){return Bc.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,this.rx,this.ry)}exchangeSweepAndStart(){return Bc.build1(this.end(),this.start(),this.rx,this.ry,this.isLarge(),this.sweepAngle>=0?0:1)}exchangeSweep1(){return Bc.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle+.01,this.rx,this.ry)}mirrorY(t){let e=this.start(),r=this.end();return e.equals(r)?Bc.build3(this.center.mirrorY(),0,360,this.rx,this.ry):Bc.build1(e.mirrorY(t),r.mirrorY(t),this.rx,this.ry,this.isLarge(),this.sweepAngle>=0?0:1)}mirror(t=S.ORIGIN){let e=this.start(),r=this.end();return e.equals(r)?Bc.build3(this.center.mirror(t),0,360,this.rx,this.ry):Bc.build1(e.mirror(t),r.mirror(t),this.rx,this.ry,this.isLarge(),this.sweep())}sectorArea(){return Math.abs(this.sweepAngle)/360*Math.PI*this.rx*this.ry}area(){let t=CO.area(this.center,this._start,this.pointOn(this.endAngle()));return this.sectorArea()-t}multiply3(t){let e;t.isMirrored()?e=-this.sweepAngle:e=this.sweepAngle;let r;return t.equals(Qe.ROT_90)?r=To.regularD(this.startAngle+90):t.equals(Qe.ROT_N90)?r=To.regularD(this.startAngle-90):r=To.transformD(this.startAngle,t),Bc.build3(this.center.multiply3(t),r,e,t.iScale*this.rx,t.iScale*this.ry)}angleIsInArc(t){return t=To.regularD(t),this.sweepAngle>0?(t<this.startAngle&&(t+=360),this.endAngle()>t):(t>this.startAngle&&(t-=360),this.endAngle()<t)}toBezier(){if(Math.abs(this.sweepAngle)>90)throw new Error("not support!");let t=this.start(),e=this.end(),r=To.toRadians(this.sweepAngle)/2,i=4/3*(1-Math.cos(r))/Math.sin(r)*this.rx;return new Mr([t,t.add(new S(i,0).multiply3(Qe.rotateD(this.startAngle+90))),e.add(new S(i,0).multiply3(Qe.rotateD(this.endAngle()-90))),e])}toBezier2(){let t=[];r(this,90);let e=[];return t.forEach(i=>e.push(i.toBezier())),e;function r(i,n){if(Math.abs(i.sweepAngle)>n){let s=i.sweepAngle/2;r(Bc.build3(i.center,i.startAngle,s,i.rx,i.ry),n),r(Bc.build3(i.center,i.startAngle+s,s,i.rx,i.ry),n)}else t.push(i)}}buildBBox(){let t=exe.getCache().boxCache,e=this.startAngle+this.sweepAngle;if(t[0]=Math.min(this._start.x,this._end.x),t[1]=Math.max(this._start.x,this._end.x),t[2]=Math.min(this._start.y,this._end.y),t[3]=Math.max(this._start.y,this._end.y),this.sweepAngle>0){let r=0;for(;r<e;){if(r>this.startAngle){let i=this.pointOn(r);t[0]=Math.min(t[0],i.x),t[1]=Math.max(t[1],i.x),t[2]=Math.min(t[2],i.y),t[3]=Math.max(t[3],i.y)}r+=90}}else if(this.sweepAngle<0){let r=360;for(;r>e;){if(r<this.startAngle){let i=this.pointOn(r);t[0]=Math.min(t[0],i.x),t[1]=Math.max(t[1],i.x),t[2]=Math.min(t[2],i.y),t[3]=Math.max(t[3],i.y)}r-=90}}return new ut(t[0],t[1],t[2],t[3])}bbox(){return this.__bbox==null&&(this.__bbox=this.buildBBox()),this.__bbox}length(){return Math.abs(this.rx*this.sweepAngle*Math.PI/180)}toString(){return O7.format("Arc [start=%s, end=%s, rx=%s, ry=%s, center=%s, startAngle=%s, sweepAngle=%s]",this._start,this._end,this.rx,this.ry,this.center,this.startAngle,this.sweepAngle)}stroke(t,e,r){let i=t/2,n=this.rx+i,s=this.ry+i,a=this.rx-i,l=this.ry-i,c=new Qe;a<0&&(a=-a,c=c.multiply3(Qe.MIRROR_Y)),l<0&&(l=-l,c=c.multiply3(Qe.MIRROR_X)),a===0&&(a=.001),l===0&&(l=.001),c=c.setOrigin1(this.center);let h,u;switch(r===this.sweep()?(h=Bc.build3(this.center,this.startAngle,this.sweepAngle,n,s),u=Bc.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,a,l)):(h=Bc.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,n,s),u=Bc.build3(this.center,this.startAngle,this.sweepAngle,a,l)),u=u.multiply3(c),e){case 1:{let d=r===1?180:-180,p=r===this.sweep()?this.pointOn(this.endAngle()):this.pointOn(this.startAngle),m=r===this.sweep()?this.pointOn(this.startAngle):this.pointOn(this.endAngle()),g=h.pointOn(h.endAngle()).angleD(p),y=u.pointOn(u.endAngle()).angleD(m);return fe.build2([h,Bc.build3(p,g,d,i,i),u,Bc.build3(m,y,d,i,i)])}default:return fe.build2([h,u])}}points2(){let t=Math.ceil(Math.abs(this.sweepAngle)/WQe),e=this.sweepAngle/t,r=[this._start];for(let i=1;i<t;i++)r.push(this.pointOn(this.startAngle+e*i));return r.push(this._end),r}points1(t){let e=Math.max(this.rx,this.ry);if(e<=t)return[this.start(),this.svgEnd];let r=(e-t)/e,i=Math.ceil(Math.abs(this.sweepAngle/To.toDegrees(Math.acos(r))/2)),n=new Array(i+1),s=this.sweepAngle/i,a=this.startAngle;for(let l=0;l<=i;l++,a+=s)n[l]=this.pointOn(a);return n}points(t){let e=Math.max(this.rx,this.ry);if(t=Math.abs(t),e<=t)return[this.start(),this.svgEnd];t=Math.max(t,e*1e-5),t=Math.min(t,e*(1-Math.SQRT1_2));let r=(e-t)/e,i=Math.ceil(Math.abs(this.sweepAngle/To.toDegrees(Math.acos(r))/2));i=Math.max(i,2);let n=new Array(i+1),s=this.sweepAngle/i,a=this.startAngle+s;n[0]=this.start();for(let l=1;l<i;l++,a+=s)n[l]=this.pointOn(a);return n[i]=this.end(),n}panDistance(t){return this.sweepAngle>0?new Bc(this.rx-t,this.ry-t,this.center,this.startAngle,this.sweepAngle):new Bc(this.rx+t,this.ry+t,this.center,this.startAngle,this.sweepAngle)}panDistance1(t){if(this.sweepAngle>0){let e=this.rx-t;return e<0?(e=Math.abs(e),Bc.build3(this.center,this.startAngle-180,this.sweepAngle,e,e)):new Bc(e,e,this.center,this.startAngle,this.sweepAngle)}else{let e=this.rx+t;return e<0?(e=Math.abs(e),Bc.build3(this.center,this.startAngle-180,this.sweepAngle,e,e)):new Bc(e,e,this.center,this.startAngle,this.sweepAngle)}}get bulge(){let t=Math.abs(gQe(this.sweepAngle,3))/180*Math.PI;return Math.tan(t/4)}get midPoint(){let t=To.toRadians(this.startAngle),e=To.toRadians(this.endAngle()),r=this.sweep(),i=this.center,n=this.rx;if(r==1)if(e>t){let s=(e-t)/2+t;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(e+lZ-t)/2+t;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}}else if(e>t){let s=(t+lZ-e)/2+e;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(t-e)/2+e;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}}}get svgPathData(){return[{type:"M",values:[this._start.x,this._start.y]},{type:"A",values:[this.rx,this.ry,0,this.isLarge()?1:0,this.isCCW,this._end.x,this._end.y]}]}equals(t){let e=To.regularD(this.startAngle),r=To.regularD(this.sweepAngle),i=To.regularD(t.startAngle),n=To.regularD(t.sweepAngle);return oS([this.rx,this.ry,this.center,Math.abs(r)],[t.rx,t.ry,t.center,Math.abs(n)])&&(oS([r,e],[n,i])||oS([To.regularD(e+r)],[i]))}equals1(t){let e=To.regularD(this.startAngle),r=To.regularD(this.sweepAngle),i=To.regularD(t.startAngle),n=To.regularD(t.sweepAngle);return oS([this.rx,this.ry,this.center,Math.abs(r)],[t.rx,t.ry,t.center,Math.abs(n)])&&(oS([r,e],[n,i])||oS([To.regularD(e+r)],[i]))}inArea(t,e){let r=t.x,i=t.y,n=this.center,s=this.rx,a=To.toRadians(this.startAngle);this.sweep()==0&&(a=To.toRadians(this.endAngle()));let l=To.toRadians(this.endAngle());this.sweep()==0&&(l=To.toRadians(this.startAngle));let c=s-e/2,h=s+e/2;var u=r-n.x,d=i-n.y,p=Math.atan2(d,u);if(p<0&&(p+=lZ),a<=l&&p>=a&&p<=l||a>l&&(p>=a&&p<=lZ||p>=0&&p<=l)||a==l){var m=Math.sqrt(u*u+d*d);return m<=h&&m>=c}else{var m=(h+c)/2,g=new S(n.x+Math.cos(a)*m,n.y+Math.sin(a)*m),y=new S(n.x+Math.cos(l)*m,n.y+Math.sin(l)*m),b=r-g.x,P=i-g.y,T=r-y.x,I=i-y.y;return b*b+P*P<=e*e/4?!0:T*T+I*I<=e*e/4}}isCircle(){return(mr.eq(Math.abs(this.sweepAngle),360)||this._start.equals1(this._end))&&this.rx==this.ry}reverse(){return Bc.build3(this.center,this.endAngle(),-this.sweepAngle,this.rx,this.ry)}getAngle(){let t=Math.PI*2;return this.sweep()==1?(this.endAngle()-this.startAngle+t)%t:(this.startAngle-this.endAngle()+t)%t}isValid(){return this.rx>0&&this.ry>0}panDistance2(t){if(this.sweepAngle>0){let e=this.rx-t;if(e===0)return new M(this.center,this.center);if(e<mr.eps){e=Math.abs(e);let r=Bc.build3(this.center,this.startAngle-180,this.sweepAngle,e,e);return r.area()<1e-5?new M(r.start(),r.end()):r}return new Bc(e,e,this.center,this.startAngle,this.sweepAngle)}else{let e=this.rx+t;if(e===0)return new M(this.center,this.center);if(e<mr.eps){e=Math.abs(e);let r=Bc.build3(this.center,this.startAngle-180,this.sweepAngle,e,e);return r.area()<1e-5?new M(r.start(),r.end()):r}return new Bc(e,e,this.center,this.startAngle,this.sweepAngle)}}},rxe=new ArrayBuffer(24),I1e=new Float64Array(rxe),m7=new Int32Array(rxe),mO=class iS{static normal(t,e,r){let i=e.sub(t),n=r.sub(e);return i.cross(n)}static random(){return new iS(t(),t(),t()).normalize();function t(){return Math.sqrt(-2*Math.log(Math.random()))*Math.cos(2*Math.PI*Math.random())}}constructor(t,e,r){this.x=rl.normal(t),this.y=rl.normal(e),this.z=rl.normal(r),I1e[0]=t,I1e[1]=e,I1e[2]=r,this.hashed=m7[0]^m7[1]^m7[2]^m7[3]^m7[4]^m7[5]}isNormalized(){return mr.eq(this.length(),1)}isZeroVector(){return this.x===0&&this.y===0&&this.z===0}hashCode(){return this.hashed}equals(t){return t instanceof iS?t.x===this.x&&t.y===this.y&&t.z===this.z:!1}cross(t){return new iS(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}normalize(){var t=this.length();return new iS(this.x/t,this.y/t,this.z/t)}sub(t){return new iS(this.x-t.x,this.y-t.y,this.z-t.z)}add(t){return new iS(this.x+t.x,this.y+t.y,this.z+t.z)}scale(t){return new iS(this.x*t,this.y*t,this.z*t)}neg(){return new iS(-this.x,-this.y,-this.z)}multiply4(t){var e=this.x*t.data[0]+this.y*t.data[4]+this.z*t.data[8]+t.data[12],r=this.x*t.data[1]+this.y*t.data[5]+this.z*t.data[9]+t.data[13],i=this.x*t.data[2]+this.y*t.data[6]+this.z*t.data[10]+t.data[14],n=this.x*t.data[3]+this.y*t.data[7]+this.z*t.data[11]+t.data[15];return n!=0?new iS(e/n,r/n,i/n):new iS(e,r,i)}rotate(t,e){return this.multiply4(Ae.rotateAxis(t,e))}toVector2(){return new S(this.x,this.y)}};mO.ORIGIN=new mO(0,0,0),mO.X_UNIT_VECTOR=new mO(1,0,0),mO.Y_UNIT_VECTOR=new mO(0,1,0),mO.Z_UNIT_VECTOR=new mO(0,0,1);var Mt=mO,Xm=class{constructor(){this.clear()}clear(){this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.minZ=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY,this.maxZ=Number.NEGATIVE_INFINITY}ext1(o,t,e,r,i,n){if(o<=r&&t<=i&&e<=n)this.minX=Math.min(this.minX,o),this.minY=Math.min(this.minY,t),this.minZ=Math.min(this.minZ,e),this.maxX=Math.max(this.maxX,r),this.maxY=Math.max(this.maxY,i),this.maxZ=Math.max(this.maxZ,n);else throw new Error("min > max is not permitted");return this}ext2(o,t,e){return this.minX=Math.min(this.minX,o),this.minY=Math.min(this.minY,t),this.minZ=Math.min(this.minZ,e),this.maxX=Math.max(this.maxX,o),this.maxY=Math.max(this.maxY,t),this.maxZ=Math.max(this.maxZ,e),this}ext3(o){return this.ext2(o.x,o.y,o.z)}ext4(o){return this.ext1(o.minX,o.minY,o.minZ,o.maxX,o.maxY,o.maxZ)}ext5(o,t){return this.minX=Math.min(this.minX,o),this.minY=Math.min(this.minY,t),this.maxX=Math.max(this.maxX,o),this.maxY=Math.max(this.maxY,t),this}ext6(o){return this.minZ=Math.min(this.minZ,o),this.maxZ=Math.max(this.maxZ,o),this}ext7(o){return this.minX=Math.min(this.minX,o.minX),this.minY=Math.min(this.minY,o.minY),this.maxX=Math.max(this.maxX,o.maxX),this.maxY=Math.max(this.maxY,o.maxY),this}isValid(){return isFinite(this.minX)&&isFinite(this.minY)&&isFinite(this.minZ)&&isFinite(this.maxX)&&isFinite(this.maxY)&&isFinite(this.maxZ)}build(){return new by(this.minX,this.minY,this.minZ,this.maxX,this.maxY,this.maxZ)}},by=class{constructor(o,t,e,r,i,n){if(o<=r&&t<=i&&e<=n)this.minX=rl.normal(o),this.minY=rl.normal(t),this.minZ=rl.normal(e),this.maxX=rl.normal(r),this.maxY=rl.normal(i),this.maxZ=rl.normal(n);else throw new Error("min > max is not permitted")}center(){return new Mt((this.minX+this.maxX)/2,(this.minY+this.maxY)/2,(this.minZ+this.maxZ)/2)}transform(o){let t=new Xm;for(let e of this.getVertexes())t.ext3(e.multiply4(o));return t.build()}isContains(o){return!(o.x<this.minX||o.y<this.minY||o.z<this.minZ||o.x>this.maxX||o.y>this.maxY||o.z>this.maxZ)}getVertexes(){return[new Mt(this.minX,this.minY,this.minZ),new Mt(this.minX,this.minY,this.maxZ),new Mt(this.minX,this.maxY,this.minZ),new Mt(this.minX,this.maxY,this.maxZ),new Mt(this.maxX,this.minY,this.minZ),new Mt(this.maxX,this.minY,this.maxZ),new Mt(this.maxX,this.maxY,this.minZ),new Mt(this.maxX,this.maxY,this.maxZ)]}diagonalLength(){let o=this.maxX-this.minX,t=this.maxY-this.minY,e=this.maxZ-this.minZ;return Math.sqrt(o*o+t*t+e*e)}toBBox2(){return new ut(this.minX,this.maxX,this.minY,this.maxY)}},Jo=class T7{static build(t){return t instanceof fe?new T7([new hs([t])]):t instanceof hs?new T7([t]):t}static buildByPolygon(t){return t?new T7([t]):new T7([])}static buildByStroke(t,e,r=1,i){return this.buildByPolygon(hs.buildByStroke(t,e,r,Q1e,i))}static buildCircle(t,e){return this.buildByPolygon(hs.buildCircle(t,e))}static buildRect(t){return this.buildByPolygon(hs.buildRect(t))}static buildBBox(t){return this.buildByPolygon(hs.buildBBox(t))}constructor(t){this.items=t.slice()}multiply3(t){return new T7(this.items.map(e=>e.multiply3(t)))}bbox(){return this._bbox||(this._bbox=this.items.reduce((t,e)=>t.ext1(e.bbox()),new _e).build1()),this._bbox}toPolylineGroups(){return this.items.map(t=>t.toPolylineGroup())}},Ym=class dI{static isHexFormate(t){return!t||typeof t!="string"?!1:/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)}static of1(t){return this.of2(t>>16&255,t>>8&255,t&255)}static of2(t,e,r,i=255){return new dI(t/255,e/255,r/255,i/255)}static of3(t){t.startsWith("#")&&(t=t.substr(1));let e=t.length;if(e==3)return new dI(parseInt(t[0],16)/15,parseInt(t[1],16)/15,parseInt(t[2],16)/15);if(e==6)return new dI(parseInt(t.substr(0,2),16)/255,parseInt(t.substr(2,2),16)/255,parseInt(t.substr(4,2),16)/255);if(e==8)return new dI(parseInt(t.substr(0,2),16)/255,parseInt(t.substr(2,2),16)/255,parseInt(t.substr(4,2),16)/255,parseInt(t.substr(6,2),16)/255);throw new Error("invalid color string")}static of4(t){let e=parseInt(t.r*255+"").toString(16),r=parseInt(t.g*255+"").toString(16),i=parseInt(t.b*255+"").toString(16);return e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),("#"+e+r+i).toUpperCase()}static of5(t,e){if(t.startsWith("#")&&(t=t.substr(1)),t.length==3)return new dI(parseInt(t[0],16)/15,parseInt(t[1],16)/15,parseInt(t[2],16)/15,e);if(t.length==6)return new dI(parseInt(t.substr(0,2),16)/255,parseInt(t.substr(2,2),16)/255,parseInt(t.substr(4,2),16)/255,e);throw new Error("invalid color string")}static of6(t,e){return new dI(t.r,t.g,t.b,e)}static of7(t){return t==null?null:dI.of3(t)}constructor(t,e,r,i=1){this.r=rl.positiveOr0(t),this.g=rl.positiveOr0(e),this.b=rl.positiveOr0(r),this.alpha=i}hashCode(){return this.r+this.g+this.b+this.alpha}equals(t,e=!1){let r=this.r===t.r&&this.g===t.g&&this.b===t.b;return e?r:r&&this.alpha===t.alpha}add(t,e,r,i){return new dI(Math.max(0,Math.min(1,this.r+t)),Math.max(0,Math.min(1,this.g+e)),Math.max(0,Math.min(1,this.b+r)),Math.max(0,Math.min(1,this.alpha+i)))}mul(t){return new dI(Math.max(0,Math.min(1,this.r*t)),Math.max(0,Math.min(1,this.g*t)),Math.max(0,Math.min(1,this.b*t)),this.alpha)}mul1(t){return new dI(Math.max(0,this.r*t),Math.max(0,this.g*t),Math.max(0,this.b*t),this.alpha)}getData(){return[this.r,this.g,this.b,this.alpha]}toString(){let t=(this.r*255).toString(16),e=(this.g*255).toString(16),r=(this.b*255).toString(16);return t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),"#"+t.substr(0,2)+e.substr(0,2)+r.substr(0,2)}toString1(){let t=(this.r*255).toString(16),e=(this.g*255).toString(16),r=(this.b*255).toString(16),i=(this.alpha*255).toString(16);return t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),"#"+t.substr(0,2)+e.substr(0,2)+r.substr(0,2)+i.substr(0,2)}toRGBA(){let t=this.r*255,e=this.g*255,r=this.b*255;return[t,e,r,this.alpha]}toRGBAString(){let t=this.r*255,e=this.g*255,r=this.b*255;return`rgba(${t},${e},${r},${this.alpha})`}isWHITE(){return this.r===1&&this.g===1&&this.b===1&&this.alpha===1}};Ym.WHITE=new Ym(1,1,1,1),Ym.BLACK=new Ym(0,0,0,1),Ym.RED=new Ym(1,0,0,1),Ym.GREEN=new Ym(0,1,0,1),Ym.BLUE=new Ym(0,0,1,1),Ym.Gray=Ym.of3("#9966ff"),Ym.Silver=Ym.of3("#D2D2D2"),Ym.Golden=Ym.of3("#DCAA14"),Ym.Pink=Ym.of3("#ffaec9");var Vl=Ym,wve=!1,ixe=class{onRTreeBBox(o){}onResultSide(o){}onOriginSide(o){}onSplitedSide(o){}onDebugSide(o){}onSweep(o,t,e,r,i,n){}onIntersect(o,t,e){}onSegment(o,t,e,r,i,n){}onSegment1(o,t,e){if(wve){let r=new S(o.getX(e),e),i=new S(t.getX(e),e);this.onSegment(r,o.weight,o,i,t.weight,t)}else this.onSegment(o.start,o.weight,o,t.end,t.weight,t)}onSweep1(o,t,e){if(wve){let r=new S(o.getX(e),e),i=new S(t.getX(e),e);this.onSweep(r,o.weight,o,i,t.weight,t)}else this.onSweep(o.start,o.weight,o,t.end,t.weight,t)}},HH=class extends ixe{constructor(o){super(),this.plGrps=new Array,this.debug=o}onPolylineGroup(o,t){this.plGrps.push(o)}},jH=class{constructor(o){this.cache={},this.levels=o,this.result=new Array(o),this.weights=new Array(o),this.maxIdx=o-1,this.rule=this.decide.bind(this);let t=1;for(let e=0;e<o;e++)this.weights[e]=t,t*=50}weight(o){return this.weights[o]}decide(o){o=Math.abs(o);let t=this.cache[o];if(t===void 0){let e=o;for(let r=this.maxIdx;r>=0;r--){let i=this.weights[r],n=o/i|0,s=o%i;s>(i/2|0)?(o=i-s,n++):o=s,this.result[r]=n>0}t=this.decide1(this.result),this.cache[e]=t}return t}},zQe=o=>o!==0;var YQe=new class extends jH{decide1(o){return o[0]||o[1]}}(2),bZ=new class extends jH{decide1(o){return o[0]&&!o[1]}}(2),PZ=new class extends jH{decide1(o){return o[0]&&o[1]}}(2),C1e=new class extends jH{decide1(o){return o[0]&&!o[1]||!o[0]&&o[1]}}(2),x7=class I7{constructor(t,e,r,i,n,s,a){this.inters=[],this.connect=new Array,this.previous=null,this.next=null,this.finalGrp=-1,this.trans=NaN,this.outsideWeight=0,this.insideWeight=0,this.invalidWeight=0,this._confidence=0,this._confidence_y=NaN,this._x=NaN,this._x_y=NaN,this.status=0,this.bo=t,this.shape=e,this.baseWeight=r,i.y>n.y?this.weight=-r:i.y==n.y?this.weight=0:this.weight=r,this.start=i,this.end=n,this.polyGrp=s,this.polyIndex=a,this._bbox=new _e().ext1(e.bbox()).ext2(i).ext2(n).build1(),this.inters.push(i),this.inters.push(n);let l=31,c=1;c=l*c+this.polyGrp,c=l*c+this.polyIndex,this._hashcode=c}static rebuild(t,e,r){if(t instanceof M||e.distance2(r)<1e-6)return new M(e,r);if(t instanceof q){let i=t,n=t.bbox().center().x,s;e.y>r.y?s=n>i.center.x?0:1:s=n>i.center.x?1:0;let a=e.angleD(i.center),l=r.angleD(i.center);return q.build2(i.center,a,l,i.rx,i.ry,s)}else throw new Error("not supported operation")}updateBbox(){this._bbox=new _e().ext2(this.start).ext2(this.end).build1()}is(t,e){return t===this.polyGrp&&e===this.polyIndex}confidence(t){if(this._confidence_y!=t){let e=this._bbox.height();if(e!==0)if(Math.abs(t-this._bbox.maxY)>5e-4&&Math.abs(t-this._bbox.minY)>5e-4){let r=1-Math.abs(2*t-this._bbox.maxY-this._bbox.minY)/e;this._confidence=r*1e4|0}else this._confidence=0;else this._confidence=1;this._confidence_y=t}return this._confidence}needCountWeight(){return this.outsideWeight+this.insideWeight+this.invalidWeight<5e3}revokeOutside(t){let e=this.confidence(t);return this.outsideWeight-=e,this.invalidWeight+=e,e}revokeInside(t){let e=this.confidence(t);return this.insideWeight-=e,this.invalidWeight+=e,e}setOutside(t){let e=this.confidence(t);return this.outsideWeight+=e,e}setInside(t){let e=this.confidence(t);return this.insideWeight+=e,e}setInvalid(t){let e=this.confidence(t);return this.invalidWeight+=e,e}prevNot0(){let t=this.previous;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.previous}return null}nextNot0(){let t=this.next;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.next}return null}getX(t){if(this.bo!==null)return(this._x_y!=t||isNaN(this._x))&&(QQe(this,t)>0?this._x=Ke[0]:this._x=NaN,this._x_y=t),this._x;throw new Error("not supported operation")}voteStatus(){return this.outsideWeight>this.insideWeight&&this.outsideWeight>this.invalidWeight?2:this.insideWeight>this.outsideWeight&&this.insideWeight>this.invalidWeight?1:this.invalidWeight>this.outsideWeight&&this.invalidWeight>this.insideWeight?3:0}reverse(t){if(t===2)if(this.start.y>this.end.y){let e=I7.rebuild(this.shape,this.end,this.start),r=new I7(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return m1.addAll(r.connect,this.connect),r}else return this;else if(t===1)if(this.start.y<this.end.y){let e=I7.rebuild(this.shape,this.end,this.start),r=new I7(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return m1.addAll(r.connect,this.connect),r}else return this;return this}isNeedScan(t){return this.needCountWeight()&&this.confidence(t)>0}hashCode(){return this._hashcode}equals(t){return t instanceof I7?!(this.polyGrp!==t.polyGrp||this.polyIndex!==t.polyIndex):!1}bbox(){return this._bbox}toString(){return O7.format("(%d,%d,%d) (%d,%d,%d) %s %s",this.polyGrp,this.polyIndex,this.weight,this.outsideWeight,this.invalidWeight,this.insideWeight,this.start,this.end)}};function jQe(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minY+e.maxY)/2,n=(r.minY+r.maxY)/2;return i-n}function XQe(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minX+e.maxX)/2,n=(r.minX+r.maxX)/2;return i-n}var g7=class{constructor(o){if(this.__bbox=null,typeof o<"u")if(o instanceof Array){this.__items=[];for(let t of o)this.add(t)}else this.__items=o,this.__bbox=o.bbox();else this.__items=[]}add(o){if(this.__items instanceof Array)this.__items.push(o),this.__bbox=ut.extend2(this.__bbox,o.bbox());else throw new Error("can't insert multiple item into leaf node")}items(){return this.__items}bbox(){if(this.__bbox!==null)return this.__bbox;throw new Error("bug")}},Mb=class{constructor(o){this.changed=!1,this.root=new g7,this.capacity=o,this.capacity2=o*o,this.itemList=[]}size(){return this.itemList.length}items(){return this.flushWhenNeed(),this.itemList}add(o){this.itemList.push(o),this.changed=!0}remove(o){m1.remove(this.itemList,o),this.changed=!0}clear(){this.changed=!1,this.root=new g7,this.itemList.length=0}flushWhenNeed(){if(this.changed){let o=new Array;for(let t of this.itemList)o.push(new g7(t));for(;;){let t=this.organize(o);if(t.length>1)o=t;else break}this.root=new g7(o),this.changed=!1}}organize(o){gL(o,XQe,0,o.length);let t=o.length,e=[];for(let r=0;r<t;)if(r+this.capacity2<=t){let i=r+this.capacity2;gL(o,jQe,r,i);for(let n=r;n<i;n+=this.capacity){let s=new g7(o.slice(n,n+this.capacity));e.push(s)}r=r+this.capacity*this.capacity}else{let i=new g7(o.slice(r,r+this.capacity));e.push(i),r=r+this.capacity}return e}search(o){this.flushWhenNeed();let t=[],e=[];for(e.push(this.root);;){let r=e.shift();if(typeof r<"u"){let i=r.items();if(i instanceof Array){for(let n of i)if(!o.isSeparated(n.bbox())){let s=n.items();s instanceof Array?e.push(n):t.push(s)}}else o.isSeparated(r.bbox())||t.push(i)}else break}return t}walker(o){this.flushWhenNeed(),this._walker(this.root,0,o)}_walker(o,t,e){this.flushWhenNeed();let r=o.items();if(r instanceof Array)for(let i of r)this._walker(i,t+1,e);else e(r,t)}bbox(){return this.flushWhenNeed(),this.root.bbox()}};function S1e(o,t){qQe(o.iterator(),t)}function qQe(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var cZ=new Error("list is empty"),hZ=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},$Qe=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},KQe=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},fL=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw cZ;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw cZ;return this.remove(o),o.item}addLast(o){return this.first===null||this.last===null?(this.first=new hZ(this,o),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new hZ(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw cZ;return this.first.item}getLast(){if(this.last===null)throw cZ;return this.last.item}insertAfter(o,t){let e=new hZ(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new hZ(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new $Qe(this.first)}listIterator(){return new KQe(this.first)}toArray(){let o=new Array(this.cnt),t=this.first,e=0;for(;t!=null;)o[e]=t.item,t=t.next,e++;return o}};function E1e(o){throw new Error("")}var uZ=class{constructor(o,t){this.node1=null,this.node2=null,this.key=o,this.value=t}},ZQe=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().key}},JQe=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().value}},vZ=class{constructor(){this.innerList=new fL,this.innerMap={}}replace(o,t){o.node1!==null&&(o.node1.set(t),t.node1=o.node1),o.node2!==null&&(o.node2.set(t),t.node2=o.node2)}clear(){this.innerList.clear();for(let o in this.innerMap)delete this.innerMap[o]}put(o,t){let e=o.hashCode(),r=new uZ(o,t),i=this.innerMap[e];if(i===void 0)return r.node1=this.innerList.add(r),this.innerMap[e]=r,null;if(i instanceof uZ){if(i.key.equals(o))return this.innerMap[e]=r,this.replace(i,r),i.value;{r.node1=this.innerList.add(r);let n=new fL;return i.node2=n.add(i),r.node2=n.add(r),this.innerMap[e]=n,null}}if(i instanceof fL){let n=null;return S1e(i,(s,a)=>a.key.equals(o)?(this.replace(a,r),n=a.value,!1):!0),n===null?(r.node1=this.innerList.add(r),r.node2=i.push(r),null):n}return E1e(i)}get(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof uZ)return e.key.equals(o)?e.value:null;if(e instanceof fL){let r=null;return S1e(e,(i,n)=>n.key.equals(o)?(r=n.value,!1):!0),r}return E1e(e)}containsKey(o){return this.get(o)!==null}delete(o){o.node1!==null&&o.node1.parent.remove(o.node1),o.node2===null?delete this.innerMap[o.key.hashCode()]:o.node2.parent.remove(o.node2)}remove(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof uZ)return e.key.equals(o)?(this.delete(e),e.value):null;if(e instanceof fL){let r=null;return S1e(e,(i,n)=>n.key.equals(o)?(r=n.value,this.delete(n),!1):!0),r}return E1e(e)}computeIfAbsent(o,t){let e=this.get(o);if(e===null){let r=t(o);return this.put(o,r),r}else return e}size(){return this.innerList.size()}isEmpty(){return this.innerList.size()===0}keys(){return new ZQe(this.innerList.iterator())}values(){return new JQe(this.innerList.iterator())}entries(){return this.innerList.iterator()}},v7=class{constructor(){this.innerMap=new vZ}add(o){return this.innerMap.put(o,!0)!==!0}remove(o){this.innerMap.remove(o)}contains(o){return this.innerMap.get(o)===!0}iterator(){return this.innerMap.keys()}addAll(o){let t=o.iterator();for(;t.hasNext();)this.add(t.next())}size(){return this.innerMap.size()}clear(){let o=this.iterator();for(;o.hasNext();){let t=o.next();this.remove(t)}}},Lve=m1.funcCopy(gL);function QQe(o,t){let e=0;if(Math.abs(o.start.y-t)<=1e-4)Ke[e++]=o.start.x;else if(Math.abs(o.end.y-t)<=1e-4)Ke[e++]=o.end.x;else if(o.shape instanceof M)e=TQe(o.shape,t);else if(o.shape instanceof q)e=IQe(o.shape,t);else throw new Error("not supported operation");return e}var TZ=class{constructor(o,t,e,r){this.sides=new Array,this.loader=o,this.loader.bo=this,this.logger=e,this.rule=t,this.event=r}static sortByBBoxMinY(o,t){return o.bbox().minY-t.bbox().minY}static sortByBBoxAreaDesc(o,t){return t.bbox().area()-o.bbox().area()}addPolyline(o,t=1,e=.01,r=!0){for(let i of this.loader.buildGroup(o,t,e,r))this.sides.push(i),this.event.onOriginSide(i)}buildRTree(){let o=new Mb(10);for(let t of this.sides)o.add(t);return o}fillValidSides(o,t,e){for(let r of t)isFinite(r.getX(e))&&o.push(r)}getSortedEndpointsLineAsc(o){let t=new Array;for(let i of o)i.needCountWeight()&&(t.push(i.start),t.push(i.end));Lve(t,S.sortByYAsc,0,t.length);let e=new Array,r=Number.NEGATIVE_INFINITY;for(let i of t){let n=i.y;n>r&&(e.push(n),r=n)}return e}splitSides(o,t,e){let r=o.start,i=o.end,n=new S(i.x+(r.x-i.x)*2,i.y+(r.y-i.y)*2);Lve(o.inters,(a,l)=>a.distance2(n)-l.distance2(n),0,o.inters.length);let s=null;for(let a of o.inters)if(s==null)a.equals(r)&&(s=a);else if(!a.equals(s)){let l=x7.rebuild(o.shape,s,a);l instanceof q&&Math.abs(l.sweepAngle)>190&&(l=new M(s,a));let c=new x7(this,l,o.baseWeight,s,a,o.polyGrp,e++);if(t.push(c),c.updateBbox(),a.equals(i))break;s=a}return e}splitSidesByInters(){let o=new Array;for(let t of this.sides)if(t.polyIndex==0){let e=0,r=null,i=null;do{let n=new Array;e=this.splitSides(t,n,e);for(let s of n)r!=null?(r.next=s,s.previous=r):i=s,r=s,this.event.onSplitedSide(s),o.push(s);if(t.next===null)throw new Error("not supported operation");t=t.next}while(t.polyIndex!==0);i!=null&&r!=null&&(i.previous=r,r.next=i)}this.sides.length=0;for(let t of o)this.sides.push(t)}seekIntersection(){if(this.sides.length>0){let o=this.buildRTree(),t=new v7;for(let e of this.sides){t.add(e);let r=e.bbox().extendOfSize(1e-5),i=e.shape instanceof M;for(let n of o.search(r))if(!t.contains(n)){let s=n.shape instanceof M;if(!(i&&s&&e.next!==null&&e.previous!==null&&(e.next.equals(n)||e.previous.equals(n)))){let a=Pf(e.shape,n.shape);for(let l=0;l<a;l+=2){let c=new S(Ke[l],Ke[l+1]);e.inters.push(c),n.inters.push(c),this.event.onIntersect(c,e,n)}}}}}}},eet=class nxe{constructor(t){this.sides=new v7,this.others=new v7,this.id=t}add(t){this.sides.add(t),t.finalGrp=this.id;for(let e of t.connect)this.others.add(e)}polyline(){let t=new Array;return _7(this.sides,(e,r)=>(t.push(r.shape),!0)),fe.build2(t).asClose()}hashCode(){return this.id}equals(t){return t!=null&&t instanceof nxe?this.id===t.id:!1}},oxe=class{constructor(o){this.bo=null,this.sides=new Array,this.polyGrp=0,this.polyIndex=0,this.prevSide=null,this.firstSide=null,this.noWeight0=o}completeGroup(o){this.prevSide!=null&&this.firstSide!=null&&!this.prevSide.end.equals(this.firstSide.start)&&this.addSide(new M(this.prevSide.end,this.firstSide.start),o);let t=new Array,e=null,r=null;for(let i of this.sides)(!this.noWeight0||i.weight!==0)&&(e!=null?(e.next=i,i.previous=e):r=i,e=i,t.push(i));return e!=null&&r!=null&&(r.previous=e,e.next=r),this.polyGrp++,this.sides.length=0,this.prevSide=null,this.firstSide=null,this.polyIndex=0,t}buildGroup(o,t,e,r=!0){for(let i of o.primitives)if(i instanceof M)this.addSide(i,t);else if(r&&i instanceof q&&i.rx===i.ry)this.addArc(i,t);else{let n=null;for(let s of i.points(e))n!=null&&this.addSide(new M(n,s),t),n=s}return this.completeGroup(t)}addArc(o,t){let e=o.sweepAngle,r=To.regularD(o.startAngle),i=r+e;if(e>0){let n=90;for(;n<=i;)n>r&&(this.addSide(q.build3(o.center,r,n-r,o.rx,o.ry),t),r=n),n+=90;r<i&&this.addSide(q.build3(o.center,r,i-r,o.rx,o.ry),t)}else if(e<0){let n=270;for(;n>=i;)n<r&&(this.addSide(q.build3(o.center,r,n-r,o.rx,o.ry),t),r=n),n-=90;r>i&&this.addSide(q.build3(o.center,r,i-r,o.rx,o.ry),t)}}addSide(o,t){if(o.start().equals(o.end()))return;let e=o.start(),r;this.prevSide!=null?(this.prevSide.end.equals(e)||this.addSide(new M(this.prevSide.end,e),t),r=new x7(this.bo,o,t,o.start(),o.end(),this.polyGrp,this.polyIndex++)):(r=new x7(this.bo,o,t,o.start(),o.end(),this.polyGrp,this.polyIndex++),this.firstSide=r),this.prevSide=r,this.sides.push(r)}},sxe=class{constructor(o,t,e){this.eps=new Array,this.curWeight=0,this.start=null,this.last=null,this.prevStart=null,this.prevEnd=null,this.y=e,this.rule=o,this.bo=t,this.event=t.event}onEp(o){this.tuningWeight(o),this.start===null?this.rule(this.curWeight)?this.in(o):o.setInvalid(this.y):this.rule(this.curWeight)?o.setInvalid(this.y):this.out(o,this.start),this.last!==null&&this.event.onSweep1(this.last,o,this.y),this.last=o}in(o){this.prevEnd!=null&&this.onSameX(o,this.prevEnd)?(this.start=this.prevStart,this.prevStart=null,this.prevEnd.revokeInside(this.y),this.prevEnd=null):(this.start=o,this.start.setOutside(this.y))}out(o,t){if(this.onSameX(t,o))t.revokeOutside(this.y);else{if(o.setInside(this.y)>0&&t.confidence(this.y)>0){let e=t.voteStatus(),r=o.voteStatus();this.isValid(e)&&this.isValid(r)?e==2&&r==1&&(o.connect.push(t),t.connect.push(o)):(o.connect.push(t),t.connect.push(o))}this.event.onSegment1(t,o,this.y),this.eps.push(t),this.eps.push(o),this.prevStart=t,this.prevEnd=o}this.start=null}isValid(o){return o==1||o==2}onSameX(o,t){return o.bbox().isIntersect(t.bbox())&&mr.eq(o.getX(this.y),t.getX(this.y))}tuningWeight(o){this.curWeight+=o.weight;let t=o.nextNot0(),e=o.prevNot0();t!=null&&o.weight===t.weight&&t.trans===this.y&&(this.curWeight-=o.weight),e!=null&&o.weight===e.weight&&e.trans===this.y&&(this.curWeight-=o.weight),o.trans=this.y}},xZ=new Error,Mve=new class extends jH{decide1(o){return o[0]&&o[1]}}(2),tet=new class extends ixe{onPolylineGroup(o,t){throw xZ}onSegment(o,t,e,r,i,n){throw xZ}},ret=class{constructor(o,t){this.rtree=o,this.level=t}},iet=class axe extends TZ{static isIntersect(t,e,r=MZ.DUMMY){let i=new axe(r),n=i.createGroup1(t.items),s=i.createGroup2(e.items);return n.rtree.itemList.length==0||s.rtree.itemList.length==0?!1:i.isIntersect(n,s)}constructor(t){super(new oxe(!1),Mve.rule,t,tet)}createGroup1(t){return this.createGroup(t,0)}createGroup2(t){return this.createGroup(t,1)}createGroup(t,e){let r=Mve.weight(e);for(let n of t)this.addPolyline(n,r);let i=this.buildRTree();return this.sides.length=0,new ret(i,e)}isIntersect(t,e){if(t.level!==e.level){let r=t.rtree.bbox().intersection1(e.rtree.bbox());if(r!==null){try{this.inters(t,e);let i=(r.minY+r.maxY)/2;this.sweep(t,e,i)}catch(i){if(i===xZ)return!0;throw i}return!1}else return!1}else throw new Error("inersection detection should not in same group")}inters(t,e){if(t.rtree.size()>e.rtree.size()){let r=t;t=e,e=r}for(let r of t.rtree.items()){r.trans=NaN;let i=r.bbox().extendOfSize(1e-5);for(let n of e.rtree.search(i))if(n.trans=NaN,Pf(r.shape,n.shape)>0)throw xZ}}sweep(t,e,r){let i=ut.extend2(t.rtree.bbox(),e.rtree.bbox()).extendOfSize(1e-5),n=new Array;this.fillValidSides(n,t.rtree.search(i),r),this.fillValidSides(n,e.rtree.search(i),r),gL(n,(a,l)=>a.getX(r)-l.getX(r),0,n.length);let s=new sxe(this.rule,this,r);for(let a of n)s.onEp(a)}},Gt=class gO{constructor(t){this.items=new Array(t.length),m1.arraycopy(t,0,this.items,0,t.length),this.__bbox=this.calcBBox()}static build1(t){let e=[];return CZ(t,(r,i)=>(e.push(i),!0)),new gO(e)}static build2(t){let e=t.map(r=>fe.build8(r));return new gO(e)}static combinePolylineGroupArr(t){let e=[];for(let r of t)e=e.concat(r.items);return new gO(e)}calcBBox(){let t=new _e;for(let e=0;e<this.items.length;e++)t.ext1(this.items[e].bbox());return t.build1()}multiply3(t){let e=new Array(this.items.length);for(let r=0;r<e.length;r++)e[r]=this.items[r].multiply3(t);return new gO(e)}bbox(){return this.__bbox}asClose(){return this.items.forEach(t=>t.asClose()),this}mirrorY(t){return this.items.forEach(e=>e.mirrorY(t)),this}closeEndpoint(){return this.items.forEach(t=>t.closeEndpoint()),this}get primitives(){return this.items.map(t=>t.primitives).flat(2)}isEqual(t){return t instanceof gO?this.items.every(e=>t.items.some(r=>r.isEqual(e))):!1}getOutMostPolyline(){return this.items.reduce((t,e)=>e.bbox().area()>t.bbox().area()?e:t,this.items[0])}getOutline(){let t=this.items;if(t.length===1)return{outline:t,hole:new Array};let e=new Set,r=new Set;for(let i=0,n=t.length;i<n;i++){let s=t[i];if(!e.has(s)&&!r.has(s)){i+1>=n&&e.add(s);for(let a=i+1;a<n;a++){let l=t[a];if(!e.has(l)&&!r.has(l)){if(!s.bbox().isInside(l.bbox().extendOfSize(1e-4))&&!l.bbox().isInside(s.bbox().extendOfSize(1e-4)))continue;iet.isIntersect(new gO([s]),new gO([l]))&&(s.bbox().area()>l.bbox().area()?(e.add(s),r.add(l)):(e.add(l),r.add(s)))}}!e.has(s)&&!r.has(s)&&e.add(s)}}return{outline:[...e],hole:[...r]}}round(t=4){let e=this.items.map(r=>r.round(t));return new gO(e)}},net=m1.funcCopy(gL),oet=m1.funcCopy(gL),set=m1.funcCopy(gL);function aet(o){return new Array}function cet(o,t){let e=new HH(!1),r=new WH(o,MZ.DUMMY,e);for(let i of t)r.addPolyline(i);return r.simplify(),e.plGrps}var WH=class extends TZ{constructor(o,t,e){super(new oxe(!1),o,t,e),this.finalSides=new Array,this.sideGroups={},this.vecSides=new Array,this.scanY=NaN,this.curNetIndex=0,this.curIndex=-1,this.scanLines=0}sweep(o,t,e){this.scanY=NaN,this.scanLines=0,net(t,TZ.sortByBBoxMinY,0,t.length);let r=new fL;this.curNetIndex=0;let i=Number.POSITIVE_INFINITY;for(let n of o)n>i&&this.scan(r,(i+n)/2,t),i=n;this.getAllMarkPrimitive(e,t),this.logger.debug3("scan %s %d",e,this.scanLines)}simplify(){this.seekIntersection(),this.splitSidesByInters(),this.sweep(this.getSortedEndpointsLineAsc(this.sides),this.sides,!1),this.flipSides(),this.sweep(this.getSortedEndpointsLineAsc(this.vecSides),this.vecSides,!0),this.connectSides(),this.fillResult()}addPolyline(o,t=1,e=.01,r=!0){super.addPolyline(o,t,e,r)}scan(o,t,e){if(this.scanY==t)return;this.scanY=t;let r=!1,i=o.listIterator();for(;i.hasNext();){let n=i.next(),s=n.item;mr.less(s.bbox().maxY,t)?o.remove(n):!r&&s.isNeedScan(t)&&(r=!0)}for(;this.curNetIndex<e.length;){let n=e[this.curNetIndex];if(mr.less(n.bbox().minY,t))mr.greatereq(n.bbox().maxY,t)&&(this.add2AET(o,n),!r&&n.isNeedScan(t)&&(r=!0)),this.curNetIndex++;else break}if(r){this.scanLines++;let n=new sxe(this.rule,this,t),s=o.iterator();for(;s.hasNext();){let a=s.next();n.onEp(a)}}}add2AET(o,t){let e=t.bbox().minX,r=t.bbox().maxX,i=t.bbox().minY,n=t.bbox().maxY,s=o.listIterator(),a=null;for(;s.hasNext();){let l,c=s.next(),h=c.item,u=h.bbox().minX,d=h.bbox().maxX;if(r<=u)l=-1;else if(d<=e)l=1;else{let m=h.bbox().minY,g=h.bbox().maxY,y=Math.max(i,m),b=Math.min(n,g);l=this.compareBySweep(t,h,(y+b)/2)}let p=h.shape;if(p instanceof M&&p.length()<.001&&a==null&&l<0){a=c;continue}if(a!=null&&l<0){o.insertBefore(a,t);return}if(l<0){o.insertBefore(c,t);return}else a=null}o.add(t)}getLineAngle(o){let t=o.start().angle(o.end());return t<0&&(t+=Math.PI),t}getArcAngle(o,t){let e=Math.asin((t-o.center.y)/o.rx);return o.startAngle>90&&o.startAngle<270&&(e=-e),e<0&&(e+=Math.PI),(e+Math.PI/2)%Math.PI}compareArcLine(o,t,e){let r=this.getArcAngle(o,e),i=this.getLineAngle(t);return mr.eq(r,i)?-o.sweepAngle:i-r}compareBySweep(o,t,e){let r=o.getX(e);if(!isFinite(r))return 0;let i=t.getX(e);if(!isFinite(i))return 0;if(!mr.eq(r,i))return r-i;if(o.shape instanceof M)return t.shape instanceof M?this.getLineAngle(t.shape)-this.getLineAngle(o.shape):-this.compareArcLine(t.shape,o.shape,e);if(t.shape instanceof M)return this.compareArcLine(o.shape,t.shape,e);{let n=o.shape,s=t.shape,a=this.getArcAngle(n,e),l=this.getArcAngle(s,e);return mr.eq(a,l)?n.sweepAngle*s.sweepAngle<=0?n.sweepAngle<=0?1:-1:n.sweepAngle>0?n.rx-s.rx:s.rx-n.rx:l-a}}getAllMarkPrimitive(o,t){for(let e of t)if(e.status===0&&e.bbox().height()!=0){let r=e.voteStatus();if(r===2||r===1){e.status=r;let i=e.reverse(r);if(o){this.event.onResultSide(i);let n=i.shape.multiply3(Qe.ROT_N90),s=i.start.multiply3(Qe.ROT_N90),a=i.end.multiply3(Qe.ROT_N90);i=new x7(this,n,i.baseWeight,s,a,i.polyGrp,i.polyIndex)}this.finalSides.push(i),this.event.onResultSide(i)}}}flipSides(){for(let o of this.sides)if(o.polyIndex==0){let t=null,e=null;do{let r=o.shape.multiply3(Qe.ROT_90),i=o.start.multiply3(Qe.ROT_90),n=o.end.multiply3(Qe.ROT_90),s=new x7(this,r,o.baseWeight,i,n,o.polyGrp,o.polyIndex);if(s.outsideWeight=o.outsideWeight,s.insideWeight=o.insideWeight,s.invalidWeight=o.invalidWeight,s.status=o.status,t!=null?(t.next=s,s.previous=t):e=s,this.vecSides.push(s),this.event.onSplitedSide(s),t=s,o.next!==null)o=o.next;else break}while(o.polyIndex!=0);e!=null&&(e.previous=t,t.next=e)}}canBeEnd(o,t){if(o.size()==1){let e=o.getFirst().shape;if(e instanceof q){if(t&&e.rx<=t)return!1}else if(e instanceof M&&t&&e.length()<=t)return!1}return!0}connectSides(){let o=new vZ,t=new Mb(10);for(let n of this.finalSides)o.computeIfAbsent(n.start,aet).push(n),t.add(n.start);let e=0,r=new v7,i=new Array;for(let n of this.finalSides)if(!r.contains(n)){let s=new v7,a=n.start,l=new fL;l.add(n),r.add(n);let c=n.end;for(;l.size()>0;)if(this.isStart(a,c)&&this.canBeEnd(l,.01)){l.size()>1&&this.fillSideGroups(l,e++);break}else{let h=o.get(c),u=this.findNext(r,h);if(u==null&&(c=this.findNeigber(c,s,t,.01),c!==null&&(h=o.get(c),u=this.findNext(r,h))),u!=null)l.add(u),r.add(u),c=u.end;else if(c!=null?s.add(c):(i.length==0&&l.size()>1&&this.logger.warning3("unable to connect at %s",l.getLast()),i.push(l.removeLast())),l.size()>0)c=l.getLast().end;else break}}}fillSideGroups(o,t){let e=new eet(t);_7(o,(r,i)=>(e.add(i),!0)),this.sideGroups[e.id]=e}isStart(o,t){return o.distance2(t)<=1e-4}findNext(o,t){if(t!=null){for(let e of t)if(!o.contains(e))return e}return null}fillResult(){let o=0,t=new vZ;for(let r in this.sideGroups){let i=this.sideGroups[r];_7(i.sides,(n,s)=>(s.polyGrp!=-2&&t.put(s,s),!0))}let e=new v7;for(let r in this.sideGroups){let i=this.sideGroups[r];if(e.add(i)){let n=0,s=new Array;for(s.push(i);n<s.length;){let l=s[n],c=new Array;_7(l.others,(u,d)=>{let p=t.get(d);return p!=null&&c.push(p.finalGrp),!0}),oet(c,m1.sortAsc,0,c.length);let h=l.id;for(let u of c)if(u!=h&&u!=l.id){let d=this.sideGroups[u];e.add(d)&&s.push(d),h=u}n++}let a=new Array;for(let l of s)a.push(l.polyline());set(a,TZ.sortByBBoxAreaDesc,0,a.length),this.event.onPolylineGroup(new Gt(a),o++)}}}findNeigber(o,t,e,r){let i=r*r,n=Number.MAX_VALUE,s=null;for(let a of e.search(o.bbox().extendOfSize(r)))if(!t.contains(a)){let l=o.distance2(a);l<n&&(n=l,s=a)}return n<i?s:null}},het=class{constructor(){this.points=[],this.lines=[],this.arcs=[],this.beziers=[],this.listText=[],this.fonts=[]}addPt(o,t=!0){if(o instanceof M)this.lines.push(o);else if(o instanceof q)this.arcs.push(o);else if(o instanceof Mr)this.beziers.push(o);else throw new Error("not support");t&&this.points.push(o.start())}addPoint(o){this.points.push(o)}addText(o,t,e=1,r=.1,i=!0){this.listText.push({pos:o,str:t,size:e,width:r}),i&&this.points.push(o)}addPly(o,t=!0){o.primitives.forEach(e=>this.addPt(e,t))}build(){let o=[],t=[],e=[],r=[],i=[],n=[];return this.points.forEach(s=>o.push(s.x,s.y)),this.lines.forEach(s=>t.push(s.start().x,s.start().y,s.end().x,s.end().y)),this.arcs.forEach(s=>e.push(s.center.x,s.center.y,s.rx,To.toRadians(s.startAngle),To.toRadians(s.endAngle()),s.sweep())),this.beziers.forEach(s=>{s.controls.forEach(a=>{r.push(a.x,a.y)}),r.push("end")}),this.listText.forEach(s=>i.push(s.pos.x,s.pos.y,s.str,s.width,s.size)),this.fonts.forEach(s=>n.push(s)),{points:o,lines:t,arcs:e,texts:i,beziers:r,fonts:n}}},H1e=class lxe{constructor(t){this.map=new vZ,this.bus=t}initColor(t){return this.map.computeIfAbsent(t,()=>new het)}draw(){let t={},e=this.map.entries();for(;e.hasNext();){let r=e.next();t[r.key.toString()]=r.value.build()}this.bus.publish("/debug/draw",t)}clear(){this.map.clear()}static init(t){if(!t)throw new Error("bus is undefined!");this.palette=new lxe(t)}static initPalette(t){this.palette=t}static getDefaultColor(){for(let t of this.colorBuffersMap)if(t[0]!==null&&t[0])return t[0]=!1,t[1];return this.colorBuffersMap.forEach(t=>{if(t[0]===null){console.log(1);return}t[0]=!0}),this.getDefaultColor()}static clear(){this.palette.clear()}static auto(t,e=this.getDefaultColor()){if(Array.isArray(t))t.forEach(r=>{this.auto(r,e)});else if(t instanceof S)this.point(t,e);else if(t instanceof ut)this.bbox(t,e);else if(t instanceof Tl)this.primitive(t,e);else if(t instanceof fe)this.polyline(t,e);else if(t instanceof hs)this.polygon(t,e);else if(t instanceof Jo)this.group(t,e);else if(t instanceof Gt)this.auto(t.items,e);else{debugger;throw new Error("No incoming type!")}}static text(t,e,r=.5,i=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");this.palette.initColor(i).addText(t,e,r,r/10),this.palette.draw()}static point(t,e=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let r=this.palette.initColor(e);Array.isArray(t)?t.forEach(i=>{this.point(i,e)}):r.addPoint(t),this.palette.draw()}static bbox(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.bbox(r,e)}):(this.primitive(new M(new S(t.maxX,t.maxY),new S(t.maxX,t.minY)),e),this.primitive(new M(new S(t.maxX,t.maxY),new S(t.minX,t.maxY)),e),this.primitive(new M(new S(t.minX,t.minY),new S(t.maxX,t.minY)),e),this.primitive(new M(new S(t.minX,t.minY),new S(t.minX,t.maxY)),e))}static primitive(t,e=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let r=this.palette.initColor(e);Array.isArray(t)?t.forEach(i=>{this.primitive(i,e)}):r.addPt(t),this.palette.draw()}static polyline(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.polyline(r,e)}):t.primitives.forEach(r=>{this.primitive(r,e)})}static polygon(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.polygon(r,e)}):t.items.forEach(r=>{this.polyline(r,e)})}static group(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.group(r,e)}):t.items.forEach(r=>{this.polygon(r,e)})}static async begin(){this.t1=performance.now()}static async end(t){console.log(t||"t1:",performance.now()-this.t1)}static async log(t){console.log(t||"==================")}};H1e.colorBuffersMap=[[!0,Vl.BLUE],[!0,Vl.GREEN],[!0,Vl.WHITE],[!0,Vl.RED],[!0,Vl.Golden],[!0,Vl.Gray]],H1e.t1=0;var XH=H1e,uet=0,qH=class W1e{constructor(t,e){this.inters=[],this.shape=t,this.start=t.start(),this.end=t.end(),this.judgeOverlapMap=new Map,e&&(this.id=uet++)}reverse(){this.shape=this.shape.reverse();let t=this.start;this.start=this.end,this.end=t}getCenterPoint(t=this.end){let{x:e,y:r}=this.start,{x:i,y:n}=t;if(this.shape instanceof q){let s=this.shape.rx,a=new S((e+i)/2,(r+n)/2),l=this.shape.center,c;return a.x!==l.x||a.y!==l.y?(c=a.angle(l),Math.abs(this.shape.sweepAngle)>180&&(c+=c>=0?-180:180)):c=(this.shape.startAngle+this.shape.endAngle())/2,new S(l.x+Math.cos(c)*s,l.y+Math.sin(c)*s)}else{if(this.shape instanceof M)return new S((e+i)/2,(r+n)/2);if(this.shape instanceof Mr){let s=this.shape.getPercent(t,co);return Mr.pointOn(s/2,this.shape.controls)}else throw Error("not support")}}static finalAngle(t,e,r){let i=t.cross(e)>0,n=Math.acos(Math.min(1,Math.max(-1,t.dot(e)/e.length())));return(r?!i:i)&&(n=NZ-n),n}sortInters(){if(this.shape instanceof q){let t=this.shape.center,e=this.shape.start().sub(t).normalize(),r=this.shape.isCCW;this.inters.sort((i,n)=>{let s=i.coord.sub(t),a=n.coord.sub(t);return W1e.finalAngle(e,s,r)-W1e.finalAngle(e,a,r)<=0?-1:1})}else if(this.shape instanceof M){let t=this.start,e=this.end,r=new S(e.x+(t.x-e.x)*2,e.y+(t.y-e.y)*2);this.inters.sort((i,n)=>i.coord.distance2(r)-n.coord.distance2(r)<=0?-1:1)}else if(this.shape instanceof Mr){let t=this.shape;this.inters.sort((e,r)=>t.getPercent(e.coord,co)-t.getPercent(r.coord,co)<=0?-1:1)}else throw Error("not support the primitive type");this.inters.forEach((t,e)=>t.setIndex(e))}getStart(){return this.start}getEnd(){return this.end}getShape(){return this.shape}connect(t){this.nextSide=t,t.prevSide=this}static returnPolygonList(t){let e=[];return t.forEach(r=>{let i=[];r.forEach((n,s)=>{let a=[];n.forEach(l=>{a.push(l.shape)}),i.push(fe.build7(a))}),e.push(new hs(i))}),e}addInter(t){this.inters.push(t)}static returnPolygonGroup(t){let e=[];return t.forEach(r=>{let i=[];r.forEach((n,s)=>{let a=[];n.forEach(l=>{a.push(l.shape)}),i.push(fe.build7(a))}),e.push(new hs(i))}),new Jo(e)}static rebuild(t,e,r){let i;if(t instanceof M||e.distance2(r)<1e-6)i=new M(e,r);else if(t instanceof q)i=q.build2(t.center,e.angleD(t.center),r.angleD(t.center),t.rx,t.ry,t.isCCW?1:0);else if(t instanceof Mr){let n=t.getPercent(e,co),s=t.clip(n)[1];i=s.clip(s.getPercent(r,co))[0]}else throw new Error("not supported operation");return lo(t,e).dot(lo(i,e))<0?null:i}static returnPolyline(t){return fe.build7(t.map(e=>e.shape))}bbox(){return this.shape.bbox()}};function g1(o,t,e){if(o instanceof q&&t instanceof q)return fet(o,t);if(o instanceof q&&t instanceof M)return Bve(o,t);if(o instanceof M&&t instanceof q)return kve(o,t);if(o instanceof M&&t instanceof M)return mL(o,t);if(o instanceof Mr&&t instanceof M)return o.controls.length===2||IO(o)?mL(new M(o.start(),o.end()),t):cxe(o,t);if(o instanceof M&&t instanceof Mr)return t.controls.length===2||IO(t)?mL(o,new M(t.start(),t.end())):z1e(o,t);if(o instanceof q&&t instanceof Mr)return t.controls.length===2||IO(t)?Bve(o,new M(t.start(),t.end())):det(o,t);if(o instanceof Mr&&t instanceof q)return o.controls.length===2||IO(o)?kve(new M(o.start(),o.end()),t):pet(o,t);if(o instanceof Mr&&t instanceof Mr)return eye(o,t);throw new Error("not support")}function y7(o,t){return lo(o,t.start()).dot(lo(t,t.start()))<=0?!1:g1(o,t).state<=2}function O1e(o,t){let e=t.getPercent(o.end(),co);if(e===null)return!1;if(e===0)return!0;let r=t.clip(e)[0],i=o.buildConverxHull(co),n=r.buildConverxHull(co),s=c(i),a=c(n);return l(s,a);function l(h,u){let d=new Map([[0,1],[1,0],[2,2],[3,4],[4,3]]),p=h[0],m=u[0];if(!p||!m)throw Error("isAllOverlap(sides1: PackSide[], sides2: PackSide[])");let g=!0;do{let y=p.getShape(),b=m.getShape();if(y instanceof M&&b instanceof M){let P=g?mL(y,b).state:d.get(mL(b,y).state);if(P===0)p=p.nextSide,g=!1;else if(P===1)m=m.nextSide,g=!0;else if(P===2)p=p.nextSide,m=m.nextSide,g=!0;else return!1}else throw Error("not support")}while(p!==h[0].prevSide&&m!==u[0].prevSide);return!0}function c(h){let u=h.primitives.map(p=>new qH(p)),d=u[u.length-1];return u.forEach(p=>{d.connect(p),d=p}),u}}function Nve(o,t){let e=o.end().distance2(t.center);if(e>(t.rx+co)**2||e<(t.rx-co)**2||!(un(o.end(),t.end())||tye(t,o.end())))return!1;if(o.center.equals1(t.center))return!0;let r=o.center.distance1(t.center),i=Math.abs(o.rx-t.rx);if(r>Math.min(o.rx,t.rx)){let n=o.center.angleD(t.center);return o.rx>t.rx?!(r+i>co&&$9(o,n))&&!(r-i>co&&o.rx+t.rx-r>co&&$9(o,n+180)):!(r-i>co&&$9(o,n))&&!(o.rx+t.rx-r>co&&$9(o,n+180))}else{if(r+i<=co)return!0;let n=o.rx>t.rx?o.center.angleD(t.center):t.center.angleD(o.center);return $9(o,n)?!1:r-i<=co?!0:!$9(o,n+180)}}function det(o,t){let e=rye(o,t.start()).toBezier2(),r,i=0;for(let n=e.length;i<n;i++){let s=e[i];if(r=eye(s,t).state,r!==0)break}return r===2&&i!==e.length-1?{state:1}:{state:r}}function pet(o,t){let e=t.toBezier2(),r,i=0;for(let n=e.length;i<n;i++){let s=e[i];if(r=eye(o,s).state,r!==1)break}return r===2&&i!==e.length-1?{state:0}:{state:r}}function eye(o,t){if(o.controls.length===2||IO(o))return t.controls.length===2||IO(t)?mL(new M(o.start(),t.end()),new M(t.start(),t.end())):z1e(new M(t.start(),o.end()),t);if(t.controls.length===2||IO(t))return cxe(Y1e(o,t.start()),new M(t.start(),t.end()));let e=Y1e(o,t.start());if(IO(e))return z1e(new M(t.start(),o.end()),t);let r=O1e(e,t),i=O1e(t,e);if(!r&&!i){let n=RQe(e,t);if(n.havOverlap){let s=n.havOverlap!==2,a=n.havOverlap!==1;return SO(o,t,s,a)}else{let s=function(){for(let u=0;u<c;u+=2)Ke[u]=h[u],Ke[u+1]=h[u+1]},a,l,c=n.cnt,h=new Array(c).fill(0).map((u,d)=>Ke[d]);for(let u=0;u<c;u+=2){let d=new S(Ke[u],Ke[u+1]),p=e.getPercent(d,co),m=t.getPercent(d,co);if(p===0||m===0)continue;let g=p===1?e:e.clip(p)[0],y=m===1?t:t.clip(m)[0];if(O1e(g,y)){let b=lo(o,d).cross(lo(t,d));if(b===0){a=e.end(),l=t.end();break}return{state:b<0?3:4}}s()}return(!a||!l)&&(a=A7(e.controls,e.controls[0],t),l=A7(t.controls,e.controls[0],e)),{state:a.sub(e.controls[0]).cross(l.sub(e.controls[0]))>0?4:3}}}return SO(o,t,r,i)}function cxe(o,t){let e=Y1e(o,t.start());if(IO(e))return mL(new M(e.start(),e.end()),t);let r=uxe(e,t),{isIn:i,bezierIsInLeft:n}=hxe(t,e);if(!r&&!i){if(n!==void 0)return{state:n?3:4};let s=null,a=o.getPercent(t.start(),co)+.01;for(let l=a>1?1:a;l<=1;){let c=Mr.pointOn(l,o.controls);if(YH(t,c)>y1){s=c;break}l+=.01,l>1&&(l=1)}if(!s)throw Error("!end1 && !end2 not result");return{state:t.direct.cross(s.sub(t.start()))<0?4:3}}return SO(e,t,r,i)}function z1e(o,t){let{isIn:e,bezierIsInLeft:r}=hxe(o,t),i=uxe(t,o);if(!e&&!i){if(r!==void 0)return{state:r?4:3};let n=null;for(let s=.01;s<=1;){let a=Mr.pointOn(s,t.controls);if(YH(o,a)>y1){n=a;break}s+=.01,s>1&&(s=1)}if(!n)throw Error("!end1 && !end2 not result");return{state:o.direct.cross(n.sub(o.start()))<0?3:4}}return SO(t,o,e,i)}function fet(o,t){let e=Nve(rye(o,t.start()),t),r=Nve(t,o);if(!e&&!r){let i=sS(t);if(o.center.sub(t.start()).dot(t.center.sub(t.start()))>0){if(o.rx===t.rx)return o.isCCW?{state:i.dot(o.center.sub(t.center))<0?3:4,exitIsInvalid:!1}:{state:i.dot(o.center.sub(t.center))>0?3:4,exitIsInvalid:!1};let n,s;return o.rx>t.rx?(n=o,s=t):(n=t,s=o),i.dot(s.center.sub(n.center))>0&&s.rx+s.center.distance1(n.center)-n.rx>co?o.isCCW?{state:o.rx>t.rx?3:4,exitIsInvalid:!1}:{state:o.rx<t.rx?3:4,exitIsInvalid:!1}:o.isCCW?{state:o.rx<t.rx?3:4,exitIsInvalid:!0}:{state:o.rx>t.rx?3:4,exitIsInvalid:!0}}else return o.rx+t.rx-o.center.distance1(t.center)>co&&i.dot(o.center.sub(t.center))>0?{state:t.isCCW?3:4,exitIsInvalid:!1}:{state:o.isCCW?3:4,exitIsInvalid:!0}}return SO(o,t,e,r)}function kve(o,t){let e=ir.foot(o,t.center),r=o.end().distance2(t.center),i=o.end().sub(o.start()),n=(t.rx-co)**2,s=r<=(t.rx+co)**2&&r>=n&&(i.dot(e.sub(t.start()))<=0||o.start().distance2(o.end())<=o.start().distance2(e)||e.distance2(t.center)>=n)&&(un(o.end(),t.end())||tye(t,o.end())),a=dxe(t,o);if(!s&&!a){let l=o.distance2(t.center);return l<=y1?{state:i.cross(sS(t))>0?4:3}:i.dot(e.sub(t.start()))>=0&&(r<n||o.start().distance2(t.center)<n||l<n)?{state:i.cross(t.center.sub(o.start()))<0?4:3}:{state:i.cross(t.center.sub(o.start()))>0?4:3}}return SO(t,o,s,a)}function $9(o,t){return t=To.regularD(t),o.sweepAngle>0?(t<o.startAngle&&(t+=360),o.endAngle()>t):(t>o.startAngle&&(t-=360),o.endAngle()<t)}function tye(o,t){return un(o.end(),t)||un(o.start(),t)||$9(o,t.angleD(o.center))}function hxe(o,t){let e=o.panDistance(co),r=o.panDistance(-co),i=Fve(t,e),n=Fve(t,r);if(!i.length&&!n.length)return{isIn:t.getPercent(o.end(),co)!==null};let s=[...i,...n].sort((h,u)=>h.t-u.t),a=new M(r.start(),e.start()),l=[];for(let h=0,u=s.length;h<u;h++){let d=s[h];if(l.push(d),a.distance(d.interP)>o.length()+co)break;if(l.length===2){let p=(l[1].t*10+l.shift().t*10)/20,m=Mr.pointOn(p,t.controls);if(o.distance2(m)>y1)return{isIn:!1,bezierIsInLeft:o.direct.cross(m.sub(o.start()))>0}}}let c=l.length?a.distance(l[0].interP)>=o.length()+co:!0;return{isIn:c,bezierIsInLeft:c?void 0:o.direct.cross(l[0].interP.sub(o.start()))>0}}function uxe(o,t){if(YH(t,o.end())>y1||o.getToLineMaxDis2(t)>y1)return!1;let e=get(t,y1);return o.getToLineMaxDis2(e)<=(t.length()+co)**2}function dxe(o,t){let e=t.end().angleD(t.start()),r=met(t,o.end());if(r>y1)return!1;if($9(o,e+90)){if(ir.foot(t,o.center).distance1(o.pointOn(e+90))>o.rx)return!1;r=Math.max(r,(o.rx-t.distance(o.center))**2)}if($9(o,e-90)){if(ir.foot(t,o.center).distance1(o.pointOn(e-90))>o.rx)return!1;r=Math.max(r,(o.rx-t.distance(o.center))**2)}return r<=y1&&(un(o.end(),t.end())||j1e(t,o.end()))}var pxe=(co*2)**2;function rye(o,t){if(un(o.end(),t))return q.build3(o.center,o.endAngle(),0,o.rx,o.ry);if(o.start().distance2(t)<pxe)return o;let e=To.regularD(t.angleD(o.center));if(!$9(o,e))throw new Error("!angleIsInArc(arc, angle)");return q.build2(o.center,e,o.endAngle(),o.rx,o.ry,o.isCCW?1:0)}function Y1e(o,t){if(un(o.end(),t))return new Mr([t,t]);if(o.start().distance2(t)<pxe)return o;let e=o.getPercent(t,co);if(e===null)throw new Error("!cutBezier(bezier: Bezier, p: Vector2)");return o.clip(e)[1]}function Bve(o,t){let e=dxe(rye(o,t.start()),t),r=t.end().distance2(o.center),i=t.end().sub(t.start()),n=ir.foot(t,o.center),s=(o.rx-co)**2,a=r<=(o.rx+co)**2&&r>=s&&(i.dot(n.sub(t.start()))<=0||t.start().distance2(t.end())<=t.start().distance2(n)||n.distance2(o.center)>=s)&&(un(o.end(),t.end())||tye(o,t.end()));if(!e&&!a){let l=t.distance2(o.center);return l<=y1?{state:i.cross(sS(o,t.start().angle(o.center)))>0?3:4}:i.dot(n.sub(t.start()))>=0&&(r<s||t.start().distance2(o.center)<s||l<s)?{state:i.cross(o.center.sub(t.start()))>0?4:3}:{state:i.cross(o.center.sub(t.start()))<0?4:3}}return SO(t,o,e,a)}function mL(o,t){if(un(o.end(),t.end()))return SO(o,t,!0,!0);let e=YH(t,o.end())<=y1&&j1e(t,o.end()),r=YH(o,t.end())<=y1&&j1e(o,t.end());if(!e&&!r){let i=o.direct.x===0&&o.direct.y===0,n=t.direct.x===0&&t.direct.y===0;if(i&&n)throw Error("2LineAllIsPoint");return i?{state:t.direct.cross(o.end().sub(t.start()))>0?3:4}:{state:o.end().sub(o.start()).cross(t.end().sub(o.start()))>0?4:3}}return SO(o,t,e,r)}function j1e(o,t){return ir.foot(o,t).distance2(o.start())<o.end().distance2(o.start())}function SO(o,t,e,r){if(e)return r?un(o.end(),t.end())?{state:2}:{state:0}:{state:0};if(r)return{state:1};throw new Error("!end1 && !end2")}function YH(o,t){return(o.a*t.x+o.b*t.y+o.c)**2/(o.a**2+o.b**2)}function met(o,t){return Math.min(o.distance2(t),ir.foot(o,t).distance2(t))}function get(o,t){let e=o.panDistance(t),r=o.panDistance(-t);return new M(r.start(),e.start())}function IO(o){let t=o.start(),e=o.end();t.equals1(e)&&(e=t.add1(1,0));let r=e.y-t.y,i=t.x-e.x,n=-r*t.x-i*t.y,s=Math.sqrt(1/(r**2+i**2));r*=s,i*=s,n*=s;let a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;return o.controls.forEach(c=>{let h=r*c.x+i*c.y+n;h<a&&(a=h),h>l&&(l=h)}),J9(a,l)}function Fve(o,t){let e=Pf(o,t),r=[],i=new Array(e).fill(0).map((s,a)=>Ke[a]);for(let s=0;s<e;s+=2){let a=new S(Ke[s],Ke[s+1]),l=o.getPercent(a);r.push({interP:a,t:l}),n()}function n(){for(let s=0;s<e;s+=2)Ke[s]=i[s],Ke[s+1]=i[s+1]}return r}var q9=.01,yet=270;function Qf(o){let t=q9**2,e=o.end(),r=[],i=[];for(let p=0,m=o.primitives.length;p<m;p++){let g=function(v,D){return v instanceof M&&D instanceof M&&Math.abs(v.direct.cross(D.direct))<mr.eps&&v.direct.dot(D.direct)>0||v instanceof q&&D instanceof q&&Math.abs(v.rx-D.rx)<=mr.eps&&v.center.distance2(D.center)<mr.eps&&v.isCCW===D.isCCW},y=function(v){if(GP(v,q9))i.push(null);else{if(v instanceof M)i.push(v);else if(v instanceof q&&v.rx===v.ry)u(v,i);else if(v instanceof Mr){let D=[];Jve(v,D),D.forEach(w=>{let F=w.start(),H=w.end();h(F,H)||i.push(w)})}else throw new Error("not support!");e=I}},b=function(v){if(v instanceof M)return v.direct.x===0&&v.direct.y===0;if(v instanceof q)return v.sweepAngle===0;if(v instanceof Mr){let D=new Set(v.controls.map(F=>F.x)),w=new Set(v.controls.map(F=>F.y));return D.size===1&&w.size===1}else throw new Error("not support")},P=o.primitives[p],T=P.start(),I=P.end();if(b(P))continue;h(e,T)||(i.push(new M(e,T)),e=T);let C=(p+1)%m,E=o.primitives[C];for(;g(P,E)&&(C=(C+1)%m,E=o.primitives[C],E!==P););if(C===(p+1)%m){y(P);continue}if(E===P){if(!(P instanceof q)){if(Math.abs(o.area(.1))<t)return null;throw new Error("simplifyPolyline not support")}let v=P instanceof q?P.isCCW:o.area(.1)>0;i.length=0;let D=v?180:-180;i.push(q.build3(P.center,P.startAngle,D,P.rx,P.ry),q.build3(P.center,P.startAngle+D,D,P.rx,P.ry));break}let O=(()=>{if(P instanceof M)return(v,D)=>{let w=new M(v,D);return GP(w,q9)?null:[w]};if(P instanceof q)return(v,D)=>{let w;if(v.equals1(D)?w=q.build3(P.center,P.startAngle,P.sweep()===1?360:-360,P.rx,P.ry):w=q.build4(v,D,P.center,P.rx,P.ry,P.sweep()),GP(w,q9))return null;let F=w.pointOn(w.startAngle+w.sweepAngle/2),H=q.build4(w.start(),F,P.center,P.rx,P.ry,P.sweep()),z=q.build4(F,w.end(),P.center,P.rx,P.ry,P.sweep());return GP(H,q9)||GP(z,q9)?[w]:[H,z]};throw new Error("not support")})(),_=C===0;if(C<p&&!_&&(_=!O(o.primitives[0].start(),o.primitives[C-1].end()),!_)){let v=O(P.start(),i[0].end());if(v.length===1)i[0]=v[0];else if(v.length===2)i[0]=v[1],i.push(v[0]);else throw new Error("!!!generatorPt");break}p=C===0?m-1:C-1,E=o.primitives[p];let R=O(P.start(),E.end());if(R?(R.forEach(v=>i.push(v)),e=E.end()):y(null),_)break}let n=i.length;if(i.forEach((p,m)=>{if(p)r.push(p);else{let g,y;m===n-1&&(g=r[0],y=r[r.length-1]);let b=(m+1)%n;if(g=g!=null?g:i[b],g){let P=m,T=!1;for(;y=y!=null?y:i[(--P+n)%n],y!==g;)if(y){T=!0;break}if(T){if(g.start().equals1(y.end()))return;if(lo(y,y.end()).dot(lo(g,g.start()))<0){if(!h(y.end(),g.start())){let O=new M(y.end(),g.start());r.push(O);return}let{rebuildPrevPt:I,rebuildNextPt:C,rebuildLinkLine:E}=Vve(i[(P-1+n)%n],y,new M(y.end(),g.start()),g,i[(m+2)%n]);I&&C&&(I!==y?(i[(P+n)%n]=I,r[r.length-1]&&(r[r.length-1]=I)):C!==g&&(i[(m+1)%n]=C,r[0]===g&&(r[0]=C)),E&&r.push(E))}}}}}),r.length===0)return null;h(e,r[0].start())||r.push(new M(e,r[0].start()));let s=r[r.length-1];if(r.length===1)return s instanceof q?fe.build7([q.build2(s.center,0,180,s.rx,s.ry,s.sweep()),q.build2(s.center,180,360,s.rx,s.ry,s.sweep())]):s instanceof Mr?fe.build7(s.clip(.5)):null;let a=r.map(p=>new bet(p)),l=a[a.length-1];for(a.forEach(p=>{p.connect(l),l=p});!l.isVisited;){let p=function(){l.next.connect(g),l=l.next,l.isConnected=!1,l.isVisited=!1},m=function(){l.connect(g.prev),l.isConnected=!1},g=l.prev;if(l===g)break;let y=l.pt,b=g.pt,P=b.end();if(!l.isConnected&&!P.equals(y.start())){let T=function(C){l.isConnected=!0,l.pt=y=C,l.next.isVisited=!1},I=function(C){l.isConnected=!0,g.pt=C,g.isVisited=!1,l=g};if(y instanceof M)if(h(P,y.end())){p();continue}else T(new M(P,y.end()));else if(b instanceof M){h(b.start(),y.start())?m():I(new M(b.start(),y.start()));continue}else if(y instanceof Mr)if(h(P,y.end())&&!(y.controls.length!==2&&y.getToLineMaxDis2(y.startToEndL)>=t)){p();continue}else T(new Mr([P,...y.controls.slice(1)]));else if(b instanceof Mr)h(b.start(),y.start())&&!(b.controls.length!==2&&b.getToLineMaxDis2(b.startToEndL)>=t)?m():I(new Mr([...b.controls.slice(0,-1),y.start()]));else if(y instanceof q&&b instanceof q)if(Math.abs(Math.abs(y.sweepAngle)-180)<Math.abs(Math.abs(b.sweepAngle)-180)){let C=q.build5(P,y.end(),y.sweepAngle);if(h(C.start(),C.end())&&!(C.rx>=q9&&Math.abs(C.sweepAngle)>180)){p();continue}else T(C)}else{let C=q.build5(b.start(),y.start(),b.sweepAngle);h(C.start(),C.end())&&!(C.rx>=q9&&Math.abs(C.sweepAngle)>180)?m():I(C);continue}else throw new Error("not support")}if(lo(y,y.start()).dot(lo(b,b.end()))<0){let T=function(E,O,_,R,v,D){if(l.next===g){l=null;return}let{rebuildLinkLine:w,rebuildPrevPt:F,rebuildNextPt:H}=Vve(E,O,_,R,v);F&&H&&(F!==O&&(g.prev.pt=F),H!==R&&(l.next.pt=H),w?D.pt=w:p())},I=function(){l.next===g?l=null:(l.next.connect(g.prev),l=l.next,l.isConnected=!1,l.isVisited=!1)},C=g1(b.reverse(),y).state;if(C===0){let E=Gve(y,b.start(),y.end());if(d(E)){let O=g.prev.pt,_=l.next.pt;if(lo(_,_.start()).dot(lo(O,O.end()))>=0){if(I(),!l)break;continue}if(T(g.prev.prev.pt,O,E instanceof M?E:new M(E.start(),E.end()),_,l.next.next.pt,l),!l)break}else l.pt=E;m();continue}else if(C===1){let E=Gve(b,b.start(),y.end());if(d(E)){let O=g.prev.pt,_=l.next.pt;if(lo(_,_.start()).dot(lo(O,O.end()))>=0){if(I(),!l)break;continue}if(T(g.prev.prev.pt,O,E instanceof M?E:new M(E.start(),E.end()),_,l.next.next.pt,g),!l)break}else g.pt=E;p();continue}else if(C===2){if(I(),!l)break;continue}}l.isVisited=!0,l=l.next}if(!l)return null;r.length=0;let c=l;for(r.push(l.pt),l=l.next;l!==c;)r.push(l.pt),l=l.next;if(r.length===1){let p=r[0];return p instanceof q?(h(p.start(),p.end())?r[0]=q.buildCircle(p.center,p.rx,p.sweep()):r.push(new M(p.end(),p.start())),fe.build7(r)):p instanceof Mr?(h(p.start(),p.end())||r.push(new M(p.end(),p.start())),fe.build7(r)):null}if(o=fe.build7(r),Math.abs(o.area(.1))<t)return null;return o;function h(p,m){return p.distance2(m)<t}function u(p,m){if(Math.abs(p.sweepAngle)>yet){let g=p.sweepAngle/2;u(q.build3(p.center,p.startAngle,g,p.rx,p.ry),m),u(q.build3(p.center,p.startAngle+g,g,p.rx,p.ry),m)}else m.push(p)}function d(p){return p.start().distance2(p.end())<t&&!(p instanceof q&&p.rx>=q9&&Math.abs(p.sweepAngle)>180||p instanceof Mr&&p.controls.length!==2&&p.getToLineMaxDis2(new M(p.start().add1(1,0),p.end()))>=t)}}function GP(o,t){if(!o)return!0;let e=o.start(),r=o.end();if(e.distance2(r)<t**2)if(o instanceof q){if(!(o.rx>=t&&Math.abs(o.sweepAngle)>180))return!0}else if(o instanceof Mr){if(!(o.controls.length!==2&&o.getToLineMaxDis2(new M(o.start().add1(1,0),o.end()))>=t))return!0}else return!0;return!1}function b7(o){if(o.direct.x===0&&o.direct.y===0)throw Error("getEndOfExtendLine(line: Line, distance: number)");let t=Math.abs(q9-o.length())+mr.eps,e={x:o.direct.normalize().x*t,y:o.direct.normalize().y*t},r=o.end();return new S(r.x+e.x,r.y+e.y)}function Vve(o,t,e,r,i){if(!o)s();else if(!i)a();else{let l=lo(o,o.end()),c=lo(t,o.end()),h=l.dot(c);if(h>=0)s();else{let u=lo(r,r.end()),d=lo(i,r.end()),p=u.dot(d);if(p>=0)a();else if(J9(h,-1)&&J9(p,-1)){let m=e.center();n(m),e=null}else h>p?s():a()}}function n(l){let c;if(t instanceof M)c=new M(t.start(),l);else if(t instanceof Mr)c=new Mr([...t.controls.slice(0,-1),l]);else if(t instanceof q)c=q.build5(t.start(),l,t.sweepAngle);else throw new Error("not supported");t=GP(c,co)?null:c;let h;if(r instanceof M)h=new M(l,r.end());else if(r instanceof Mr)h=new Mr([l,...r.controls.slice(1)]);else if(r instanceof q)h=q.build5(l,r.end(),r.sweepAngle);else throw new Error("supported");r=GP(h,co)?null:h}function s(){if(t instanceof M){let l=b7(e.reverse());e=new M(l,e.end());let c=new M(t.start(),l);t=GP(c,co)?null:c}else if(t instanceof Mr){let l=b7(e.reverse());e=new M(l,e.end());let c=new Mr([...t.controls.slice(0,-1),l]);t=GP(c,co)?null:c}else if(t instanceof q){let l=b7(e.reverse());e=new M(l,e.end());let c=q.build5(t.start(),l,t.sweepAngle);t=GP(c,co)?null:c}else throw new Error("not supported")}function a(){if(r instanceof M){let l=b7(e);e=new M(e.start(),l);let c=new M(l,r.end());r=GP(c,co)?null:c}else if(r instanceof Mr){let l=b7(e);e=new M(e.start(),l);let c=new Mr([l,...r.controls.slice(1)]);r=GP(c,co)?null:c}else if(r instanceof q){let l=b7(e);e=new M(e.start(),l);let c=q.build5(l,r.end(),r.sweepAngle);r=GP(c,co)?null:c}else throw new Error("not supported")}return{rebuildPrevPt:t,rebuildNextPt:r,rebuildLinkLine:e}}function Gve(o,t,e){if(o instanceof M||t.distance2(e)<=y1)return new M(t,e);if(o instanceof q)return q.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?1:0);if(o instanceof Mr){let r=o.getPercent(t,co),i=o.getPercent(e,co);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}var bet=class{constructor(o){this.pt=o}connect(o){this.prev=o,o.next=this}};function RZ(o){let t=EO(),e;if(o instanceof fe){let r=Qf(o);if(r===null)return null;e=r}else if(o instanceof hs){let r=o.items.map(i=>RZ(i)).filter(i=>i!==null);if(r.length===0)return null;e=new hs(r)}else{let r=o.items.map(i=>RZ(i)).filter(i=>i!==null);if(r.length===0)return null;e=new Jo(r)}return I2.preprocessPolyline+=pI(t),e}var I2={addDocShapes2RTree:0,getPour:0,prepare:0,getSinglePourLayerPolyline:0,combindOutlines:0,mergeSameNet:0,run:0,end:0,deSelfIntersection:0,changeDirect:0,extend:0,preprocessPolyline:0,runBoolean:0,IntersectionSeeker:0,BooleanTools:0,totalBool:0};function EO(){return{timeIndex:Object.assign({},I2),start:performance.now()}}function Uve(o){return Object.values(o).reduce((t,e)=>t+e,0)}function pI(o){return performance.now()-o.start-(Uve(I2)-Uve(o.timeIndex))}function Jf(o,t,e,r){let i=Vl.RED,n=Vl.Golden;function s(){if(!r)return;let d=r.initColor(Vl.Golden);d.addPt(a),d.addPoint(a.end()),r.initColor(Vl.RED).addPt(l),r.draw();debugger}let a=o.getShape(),l=e?t.getShape():t.getShape().reverse(),c=lo(a,l.start()),h=lo(l),u=c.cross(h);if(J9(u,0))if(a instanceof M)if(l instanceof M){if(mr.eq(u,0)&&(c.dot(h)>0?!un(a.end(),l.start()):!un(a.start(),l.start())))throw s(),new Error("line and line");return u<0}else{if(l instanceof q)return c.cross(l.center.sub(a.start()))<0;if(l instanceof Mr){let d=l.getExtremePoints(a),p=d.length?d[0]:A7(l.controls,a.start());return c.cross(p.sub(a.start()))<0}else throw new Error("not support")}else if(a instanceof q){if(l instanceof M)return a.isCCW;if(l instanceof q){if(l.center.equals1(a.center)&&(c.dot(h)>0?!un(a.end(),l.start())&&a.end().sub(l.start()).dot(h)>0:!un(a.start(),l.start())&&a.start().sub(l.start()).dot(h)>0))throw s(),new Error("arc and arc");return l.rx>=a.rx||l.center.distance2(a.center)>a.rx2?a.isCCW:!a.isCCW}else throw new Error("not support")}else if(a instanceof Mr)if(l instanceof M){let d=a.getPercent(l.start(),co),p=a.clip(d)[1],m=p.getExtremePoints(l);return(m.length?m[0]:A7(p.controls,l.start())).sub(l.start()).cross(h)<0}else if(l instanceof Mr){let d=a.getPercent(l.start(),co),p=a.clip(d)[1],m=p.getExtremePoints(new M(l.start(),l.end())),g=l.getExtremePoints(new M(p.start(),p.end())),y=m.length?m[0]:A7(p.controls,l.start()),b=g.length?g[0]:A7(l.controls,l.start()),P=y.sub(l.start()),T=b.sub(l.start());return P.cross(T)<0}else throw Error("not support");else throw new Error("not support");else return u<0}function yL(o,t,e,r,i){let n=o.getShape(),s=t.getShape(),a=n instanceof q?sS(n,To.toRadians(n.endAngle())):n instanceof Mr?zH(n,1):n.end().sub(n.start()).normalize(),l=lo(s),c=a.dot(l);if(J9(c,-1))return Jf(o,t,!0,i)?Jf(o,e,r,i)&&Jf(t,e,r,i):Jf(o,e,r,i)||Jf(t,e,r,i);{let h=a.scale(-1).angle(S.ORIGIN),u=l.angle(S.ORIGIN);h>u&&(h-=NZ);let d=(h+u)/2,p=new S(Math.cos(d),Math.sin(d)),m=r?e.getShape():e.getShape().reverse(),g=lo(m);return p.cross(g)<0?Jf(o,e,r,i):Jf(t,e,r,i)}}function A1e(o,t,e,r,i){let n=o.getShape(),s=t.getShape(),a=n instanceof q?sS(n,To.toRadians(n.endAngle())):n instanceof Mr?zH(n,1):n.end().sub(n.start()).normalize(),l=lo(s),c=a.dot(l);if(J9(c,-1))return Jf(o,t,!0,i)?Jf(o,e,r,i)&&Jf(t,e,r,i):Jf(o,e,r,i)||Jf(t,e,r,i);{let h=a.scale(-1).angle(S.ORIGIN),u=l.angle(S.ORIGIN);h>u&&(h-=NZ);let d=(h+u)/2,p=new S(Math.cos(d),Math.sin(d)),m=r?e.getShape():e.getShape().reverse(),g=lo(m);if(p.cross(g)<0){let y=a.dot(g)<0,b=g1(y?o.getShape().reverse():o.getShape(),m).state;return b!==3&&b!==4?Jf(o,e,r,i):b===(y?4:3)}else{let y=l.dot(g)<0,b=g1(y?t.getShape().reverse():t.getShape(),m).state;return b!==3&&b!==4?Jf(t,e,r,i):b===(y?4:3)}}}var K9,pv=!1;function UP(o,t,e,r,i,n,s,a=e.side===t,l=!0,c){return K9=i,pv=n,fxe(mxe(o,t,l,c,s,e,a,r),e,a,r,0)}function bO(o,t,e,r,i,n,s,a=r.side===e){K9=i,pv=n;let l=gxe(o,t,e,new Map,r,a,s),c=l instanceof Array?-1:1;return fxe(l,r,a,s,c)}function fxe(o,t,e,r,i){for(;o instanceof Array;)i++,o.length===4?o=gxe(...o,t,e,r):o=mxe(...o,t,e,r);return{...o,existOverlap:i>0}}function mxe(o,t,e,r,i,n,s,a){if(DZ===-1){a.initColor(Vl.RED).addPt(o.getShape()),a.initColor(Vl.Golden).addPt(t.getShape()),a.draw();debugger}let l=o.getShape(),c=s?t.getShape().reverse():t.getShape(),h=(l instanceof q?sS(l,e?c.start().angle(l.center):r?To.toRadians(l.endAngle()):void 0):l instanceof Mr?lo(l,e?c.start():r?l.end():l.start()):l.end().sub(l.start())).normalize(),u=(c instanceof q?sS(c,e?void 0:(r?l.end():l.start()).angle(c.center)):c instanceof Mr?lo(c,e?void 0:r?l.end():l.start()):c.end().sub(c.start())).normalize();if(r===void 0){let m=h.dot(u);if(r=m<0,J9(m,0))return{state:Jf(o,t,!s,a)?1:0,inter:PO(o,t,n,s,e,r,i)}}else if(r?h.dot(u)>0:h.dot(u)<0)if(e){let m,g=!0;if(l instanceof M&&un(ir.foot(l,c.start()),r?l.end():l.start()))g=!1;else if(l instanceof q||l instanceof Mr){let y=r?l.reverse():l,b=g1(c,NQe(y,c.start()).reverse()).state;(b===1||b===2)&&(g=!1)}if(g){let y=!r;m=g1(y?l.reverse():l,c,a).state===(y?4:3)?1:0}else r?m=yL(o,o.nextSide,t,!s,a)?1:0:m=yL(o.prevSide,o,t,!s,a)?1:0;return{state:m,inter:PO(o,t,n,s,e,r,i)}}else return r?{state:Jf(o,o.nextSide,!0,a)?0:1,inter:PO(o,t,n,s,e,r,i),isReversed:!0}:{state:Jf(o.prevSide,o,!0,a)?0:1,inter:PO(o,t,n,s,e,r,i),isReversed:!0};let d,p=new Map([[3,4],[4,3],[0,1],[1,0],[2,2]]);if(e)if(o.judgeOverlapMap.has(t)&&!pv){let m=o.judgeOverlapMap.get(t);d=r?p.get(m.state):m.state}else d=g1(r?l.reverse():l,c).state,(d===3||d===4)&&o.judgeOverlapMap.set(t,{state:r?p.get(d):d});else{if(t.judgeOverlapMap.has(o)&&!pv){let m=t.judgeOverlapMap.get(o);d=s?p.get(m.state):m.state}else d=g1(c,r?l.reverse():l).state,(d===3||d===4)&&t.judgeOverlapMap.set(o,{state:s?p.get(d):d});d=p.get(d)}if(d===1||d===2){let m=s?t.prevSide:t,g=m.inters,y=m.getEnd();for(let b=g.length-1;b>=0;b--){let P=g[b];if(!(m.getShape()instanceof Mr)&&!un(y,P.coord))break;if(P===n)return{state:2,inter:PO(o,t,n,s,e,r,i)}}}if(d===3||d===4)return{state:d===(r?4:3)?1:0,inter:PO(o,t,n,s,e,r,i)};if(i.has(o)?i.get(o).mapSideList.push(t):i.set(o,{sideIsReversed:r,mapSideList:[t]}),i.has(t)?i.get(t).mapSideList.push(o):i.set(t,{sideIsReversed:s,mapSideList:[o]}),d===2)return r?[o.prevSide,o,s?t.prevSide:t.nextSide,i]:[o,o.nextSide,s?t.prevSide:t.nextSide,i];if(d===0)return[r?o.prevSide:o.nextSide,t,!1,r,i];if(d===1)return[o,s?t.prevSide:t.nextSide,!0,r,i];throw Error("not support")}function PO(o,t,e,r,i,n,s){if(pv)return null;let a=o.getShape(),l=r?t.getShape().reverse():t.getShape(),c=r;if(!i){let p=t;t=o,o=p,r=n,e=e.getBindedInter()}let h=p=>!(i?n:c)&&un(p,o.prevSide.getEnd())?o.prevSide:o;if(r){let p=t.inters;for(let m=0;m<p.length;m++){let g=p[m];if(g.isInvalid&&n===void 0)continue;if(g===e&&un(l.start(),e.coord))return i?g:g.getBindedInter();let y=g.getBindedInter().side,b=h(g.coord);if(y===b&&u(g))return d(g)}for(;;){t=t.nextSide;let m=t.inters;for(let g=0;g<m.length;g++){let y=m[g];if(y===e)return i?y:y.getBindedInter();if(s.has(t)){let b=y.getBindedInter().side;if(s.get(t).mapSideList.includes(b)||un(y.coord,b.getEnd())&&s.get(t).mapSideList.includes(b.nextSide))return d(y);if(s.has(b)){let P=t.getShape().reverse(),T=lo(P,y.coord).dot(lo(b.getShape(),y.coord))<0,I=T?b.getShape().reverse():b.getShape(),C=g1(P,T?T1e(I,y.coord,I.end()):T1e(I,I.start(),y.coord)).state;if(C===1||C===2)return d(y)}else s.has(b.nextSide)}else if(y.side===e.side&&u(y))return d(y)}}}else{let p=t.inters;for(let m=p.length-1;m>=0;m--){let g=p[m];if(g.isInvalid&&n===void 0)continue;if(g===e&&un(l.start(),e.coord))return i?g:g.getBindedInter();let y=g.getBindedInter().side,b=h(g.coord);if(y===b&&u(g))return d(g)}for(;;){t=t.prevSide;let m=t.inters;for(let g=m.length-1;g>=0;g--){let y=m[g];if(y===e)return i?y:y.getBindedInter();if(s.has(t)){let b=y.getBindedInter().side;if(s.get(t).mapSideList.includes(b)||un(y.coord,y.getBindedInter().side.getEnd())&&s.get(t).mapSideList.includes(b.nextSide))return d(y);if(!s.has(b)&&s.has(b.prevSide)){let P=t.getShape().reverse(),T=lo(P,y.coord).dot(lo(b.getShape(),y.coord))<0;if(s.has(b.prevSide)){let I=T?b.getShape().reverse():b.getShape(),C=g1(t.getShape(),T1e(I,y.coord,I.end())).state;if(C===1||C===2)return d(y)}}}else if(y.side===e.side&&u(y))return d(y)}}}function u(p){if(p.isInvalid||p.getBindedInter().side!==(un(p.coord,o.prevSide.getEnd())?o.prevSide:o))return!1;let m;if(i){if(un(p.coord,l.start()))return!0;m=g1(n?a.reverse():a,g(l)).state}else{if(un(p.coord,n?a.end():a.start()))return!0;m=g1(l,g(n?a.reverse():a)).state}return m===2||m===1;function g(y){if(y instanceof M)return un(p.coord,y.end())?y:y.cutLine(p.coord);if(y instanceof q)return q.build2(y.center,y.startAngle,p.coord.angleD(y.center),y.rx,y.ry,y.isCCW?1:0);if(y instanceof Mr)return y.clip(y.getPercent(p.coord,co))[0];throw new Error("not supported operation")}}function d(p){let m=e.getBindedInter(),g=e.side,y=m.side,b=e===p,P=e;if(r){let T=e.getIndex()-1;for(;g;){let I=g.inters;for(;T>=0;T--)if(e=I[T],e===p){b||(e.setIsInvalid(),e.isDealed(),P=e),g=null;break}else if(K9===0)!e.isInvalid&&(!un(e.coord,p.coord)||e.side===p.side&&e.getBindedInter().side===p.getBindedInter().side)&&(e.setIsInvalid(),e.isDealed(),P=e);else if(K9===1){if(e.isInvalid)continue;let C=e.getBindedInter().side;s.has(g)&&s.get(g).mapSideList.includes(C)&&(e.setIsInvalid(),e.isDealed(),P=e)}g=g==null?void 0:g.prevSide,T=(g==null?void 0:g.inters.length)-1}}else{let T=e.getIndex()+1;for(;g;){let I=g.inters;for(;T<I.length;T++){e=I[T];let C=e.getBindedInter();if(e===p){b||(e.setIsInvalid(),e.isDealed(),P=e),g=null;break}else if(K9===0)!e.isInvalid&&(!un(e.coord,p.coord)||g===p.side&&(un(C.side.getEnd(),e.coord)?C.side.nextSide:C.side)===p.getBindedInter().side)&&(e.setIsInvalid(),e.isDealed(),P=e);else if(K9===1){let E=C.side;s.has(g)&&s.get(g).mapSideList.includes(E)&&(e.setIsInvalid(),e.isDealed(),P=e)}}g=g==null?void 0:g.nextSide,T=0}}if(K9===0&&!un(m.coord,p.coord))if(i?s.has(y)?s.get(y).sideIsReversed:n:c){let T=m.getIndex()-1;for(;y;){let I=s.has(y),C=y.inters;for(;T>=0;T--){if(m=C[T],m===p.getBindedInter()){y=null;break}m.isInvalid||!I||(!un(m.coord,p.getBindedInter().coord)||m.side===p.side&&m.getBindedInter().side===p.getBindedInter().side)&&(m.setIsInvalid(),m.isDealed())}y=y==null?void 0:y.prevSide,T=(y==null?void 0:y.inters.length)-1}}else{let T=m.getIndex()+1;for(;y;){let I=y.inters,C=s.has(y);for(;T<I.length;T++){if(m=I[T],m===p.getBindedInter()){y=null;break}let E=un(y.getEnd(),m.coord)?s.has(y.nextSide):!1;m.isInvalid||!(C||E)||(!un(m.coord,p.getBindedInter().coord)||m.side===p.side&&m.getBindedInter().side===p.getBindedInter().side)&&(m.setIsInvalid(),m.isDealed())}y=y==null?void 0:y.nextSide,T=0}}return i?P:P.getBindedInter()}}function gxe(o,t,e,r,i,n,s){let a=o.getShape(),l=t.getShape(),c=n?e.getShape().reverse():e.getShape(),h=(a instanceof q?sS(a,c.start().angle(a.center)):a instanceof Mr?lo(a,c.start()):a.end().sub(a.start())).normalize(),u=(l instanceof q?sS(l,c.start().angle(l.center)):l instanceof Mr?lo(l,c.start()):l.end().sub(l.start())).normalize(),d=h.dot(u);if(J9(d,-1)){let p=n?e.getShape().reverse():e.getShape(),m=lo(p).normalize(),g=h.add(u.scale(-1)).normalize().dot(m),y=g1(a.reverse(),l,s).state;if(g>-.9&&(y===3||y===4))return{state:y===4?0:1,inter:PO(t,e,i,n,!0,!1,r)};let b=UP(o,e,i,s,K9,pv,r.size===0?new Map:r,n);return b.state===2?b:y===4?b.state===0||b.inter!==i?b:UP(t,e,i,s,K9,pv,r.size===0?new Map:r,n):b.state===1||b.inter!==i?b:UP(t,e,i,s,K9,pv,r.size===0?new Map:r,n)}else{let p=h.scale(-1).angle(S.ORIGIN),m=u.angle(S.ORIGIN);p>m&&(p-=NZ);let g=(p+m)/2,y=new S(Math.cos(g),Math.sin(g)),b=lo(c).normalize(),P=b.angle(S.ORIGIN),T=p<P&&P<m&&a instanceof M&&l instanceof M&&c instanceof M;if(y.cross(b)<=0){if(h.scale(-1).dot(b)<0){let I;return i.coord.equals1(c.start())?I=lo(a,i.coord).dot(lo(c,i.coord))<0:c instanceof M&&(I=lo(a,a.end()).dot(c.direct)<0),{state:yL(o,t,e,!n,s)?1:0,inter:PO(o,e,i,n,!0,I,r)}}return T&&a.distance2(c.start())>y1?[t,e,!0,void 0,r]:[o,e,!0,void 0,r]}else return u.dot(b)<=0?{state:yL(o,t,e,!n,s)?1:0,inter:PO(t,e,i,n,!0,void 0,r)}:T&&l.distance2(c.start())>y1?[o,e,!0,void 0,r]:[t,e,!0,void 0,r]}}var DZ=0;function Pet(o,t,e,r){let i=t.getBindedInter(),n=t.side,s=i.side,a=n.getShape(),l=s.getShape();if(r&&(DZ++,DZ===-1)){r.initColor(Vl.RED).addPt(a),r.initColor(Vl.Golden).addPt(l),r.draw();debugger}let c=0,h=!1;if(o===-1){let O=bO(n,n.nextSide,s,i,c,h,r),_=O.state!==0;if(O.state===2){let v=lo(a,t.coord).add(lo(n.nextSide.getShape(),t.coord)).normalize(),D=lo(l,t.coord).add(lo(s.nextSide.getShape(),t.coord)).normalize();return E(_,v.dot(D)>0)}let R=bO(n,n.nextSide,s.nextSide,i,c,h,r);return O.state!==R.state?(C(O,R),1):E(_,O.state!==bO(s,s.nextSide,n,t,c,!0,r).state,O.inter,R.inter)}if(o===1){let O=UP(n,s,i,r,c,h,new Map),_=O.state!==0;if(O.state===2)return E(_,lo(a,t.coord).dot(lo(l,t.coord))>0);let R;if(O.isReversed&&O.existOverlap&&un(O.inter.coord,s.getEnd())&&O.inter.getBindedInter().side!==n){let w=O.inter.getBindedInter().side;if(w===n.nextSide)R={state:yL(n,w,s.nextSide,!0,r)?1:0,inter:i};else if(w===n.prevSide){if(R={state:yL(w,n,s.nextSide,!0,r)?1:0,inter:O.inter},O.state===R.state&&t!==O.inter){let F=lo(l,t.coord),H=lo(s.nextSide.getShape(),t.coord),z=lo(w.getShape(),t.coord);return E(_,F.add(H).dot(z)>0,O.inter,R.inter)}}else R=UP(n,s.nextSide,i,r,c,h,new Map)}else R=UP(n,s.nextSide,i,r,c,h,new Map);if(O.state!==R.state)return C(O,R),1;let v=lo(l,t.coord),D=lo(s.nextSide.getShape(),t.coord);if(J9(v.dot(D),-1)){let w=Jf(s,s.nextSide,!0,r);return E(_,O.state!==UP(s.nextSide,n,t,r,c,!0,new Map,w?!_:_,!1).state,O.inter,R.inter)}else{let w=lo(a,t.coord);return E(_,v.add(D).dot(w)>0,O.inter,R.inter)}}if(!(a instanceof Mr||l instanceof Mr))return 1;let u=lo(a,t.coord),d=lo(l,t.coord),p,m;if(l instanceof M)p=new M(t.coord,l.start()),m=new M(t.coord,l.end());else if(l instanceof q){let O=t.coord.angleD(l.center);p=q.build2(l.center,O,l.startAngle,l.rx,l.ry,l.isCCW?0:1),m=q.build2(l.center,O,l.endAngle(),l.rx,l.ry,l.isCCW?1:0)}else if(l instanceof Mr){let O=l.getPercent(t.coord,co);[p,m]=l.clip(O),p=p.reverse()}else throw new Error("not support");let g=u.dot(d)>0,y,b;g?(y=g1(a.reverse(),p).state,b=g1(a,m).state):(y=g1(a,p).state,b=g1(a.reverse(),m).state);let P;y===0?P=UP(g?n.prevSide:n.nextSide,s,i,r,c,h,new Map,!0,!1,g):y===1?P=UP(n,s.prevSide,i,r,c,h,new Map,!0,!0,g):y===2?g?P=bO(n.prevSide,n,s.prevSide,i,c,h,r,!0):P=bO(n,n.nextSide,s.prevSide,i,c,h,r,!0):g?y===3?P={inter:i,state:0}:P={inter:i,state:1}:y===3?P={inter:i,state:1}:P={inter:i,state:0};let T=P.state!==0;if(P.state===2)return E(T,g);let I;if(b===0?I=UP(g?n.nextSide:n.prevSide,s,i,r,c,h,new Map,!1,!1,!g):b===1?I=UP(n,s.nextSide,i,r,c,h,new Map,!1,!0,!g):b===2?g?I=bO(n,n.nextSide,s.nextSide,i,c,h,r,!1):I=bO(n.prevSide,n,s.nextSide,i,c,h,r,!1):g?b===3?I={inter:i,state:1}:I={inter:i,state:0}:b===3?I={inter:i,state:0}:I={inter:i,state:1},P.state===I.state)return P.inter===I.inter?(t.setIsInvalid(),0):E(T,g,P.inter,I.inter);return C(P,I),1;function C(O,_){let R=O.state!==0;if(O.inter===_.inter){t.setOutToIn(R);return}else P7(O.inter,_.inter,!0),P7(_.inter,O.inter,!1);let v=[];if(o===-1){let w=lo(a,t.coord),F=lo(n.nextSide.getShape(),t.coord),H=lo(l,t.coord),z=lo(s.nextSide.getShape(),t.coord);v.push(w.dot(H)),v.push(w.dot(z)),v.push(F.dot(H)),v.push(F.dot(z))}else{let w=lo(a,t.coord);v.push(lo(l,t.coord).dot(w)),v.push(lo(s.nextSide.getShape(),t.coord).dot(w))}if(v.reduce((w,F)=>Math.abs(w)>Math.abs(F)?w:F,0)>0)if(e===1||e===0||e===2||e===3)t.setOutToIn(R);else throw new Error("not support");else if(e===1)D(!R);else if(e===0||e===2||e===3)D(R);else throw new Error("not support");function D(w){t.setIsInvalid();let F=(w?O:_).inter;delete F.isInvalid,delete F.getBindedInter().isInvalid,F.setOutToIn(!R)}}function E(O,_,R,v){if(R===v){if(t.side.outline.inters.find(F=>!F.isInvalid&&F!==t&&un(F.coord,t.coord)))return t.setIsInvalid(),0;let D=new TO(t.coord,n,r),w=new TO(t.coord,s,r);return D.bind(w),_?n.inters.splice(t.getIndex(),0,D):n.inters.splice(t.getIndex()+1,0,D),s.inters.splice(t.getBindedInter().getIndex(),0,w),D.setOutToIn(O),t.setOutToIn(!O),D.isDealed(),n.inters.forEach((F,H)=>F.setIndex(H)),s.inters.forEach((F,H)=>F.setIndex(H)),2}else{let D=function(){let w=R.getBindedInter(),F=v.getBindedInter();delete R.isInvalid,delete w.isInvalid,delete v.isInvalid,delete F.isInvalid,R.setOutToIn(!O),v.setOutToIn(O),P7(R,v,!0),P7(v,R,!1),P7(w,F,_),P7(F,w,!_)};if(t.setIsInvalid(),_){if(e===1||e===0||e===2||e===3)return D(),2;throw new Error("not support")}else{if(e===1)return O?0:(D(),2);if(e===0||e===2||e===3)return O?(D(),2):0;throw new Error("not support")}}}}function P7(o,t,e){let{judge:r,changeNum:i}=s(),n=o.getIndex();for(let a=n+i,l=o.side.inters;r(a);a+=i){if(l[a].isInvalid)continue;if(!un(l[a].coord,o.coord))break;l[a].setIndex(n),l[n].setIndex(a);let c=l[a];l[a]=l[n],l[n]=c,n=a}function s(){let a=o.side===t.side;if(e){let l=a?t.getIndex():o.side.inters.length;return{judge:c=>c<l,changeNum:1}}else{let l=a?t.getIndex()+1:0;return{judge:c=>c>=l,changeNum:-1}}}}var Hve=0,TO=class{constructor(o,t,e){this.id=Hve++,this.coord=o,this.side=t,e&&(this.id=Hve++,this.drawDebug=e);let r=new _e;r.ext2(o),this._bbox=r.build1()}bbox(){return this._bbox}resetVisitStatus(){this.visited=!1,this.bindedInter.visited=!1}isDealed(){this.dealed=!0,this.getBindedInter().dealed=!0}setOutToIn(o){this.outToIn=o,this.bindedInter.outToIn=!o}setIsInvalid(){this.isInvalid=!0,this.getBindedInter().isInvalid=!0}getBindedInter(){return this.bindedInter}bind(o){this.bindedInter=o,o.bindedInter=this}setIndex(o){this.index=o}isSorted(){return this.index!==void 0}getIndex(){return this.index}getVisited(){return this.visited}visitSelf(){this.visited=!0}visit(){this.visited=!0,this.bindedInter.visited=!0}getPrevPoint(){let o=this.getIndex(),t=this.side.getStart();return o&&(t=this.side.inters[o-1].coord),t}getTangent(){let o=this.side.getShape();if(o instanceof M)return o.end().sub(o.start());if(o instanceof q){let t=this.coord.angle(o.center);return o.isCCW?t+=EZ:t-=EZ,new S(Math.cos(t),Math.sin(t))}else{if(o instanceof Mr)return zH(o,o.getPercent(this.coord,co));throw new Error("not support")}}findStartInter(){return this.outToIn===void 0?this.getTangent().cross(this.bindedInter.getTangent())>0?this:this.bindedInter:this.outToIn?this:this.bindedInter}run(){let o=[],t=this,e;if(this.drawDebug){_1e++;let r=_1e===-1,i=this.drawDebug.initColor(Vl.RED);if(r){this.drawDebug.draw();debugger}e=n=>{if(o.push(n),r){i.addPt(o[o.length-1]),this.drawDebug.draw();debugger}}}else e=r=>o.push(r);for(;!t.visited;){let r=function(a,l){if(mr.eq(a.distance2(l),0))return;let c=qH.rebuild(n.getShape(),a,l);if(!c)return!0;e(c)};t.visit();let i=t.getIndex(),n=t.side,s=n.inters[i+1];for(;s!=null&&s.isInvalid;)s=n.inters[s.getIndex()+1];if(s)r(t.coord,s.coord),t=s.bindedInter;else{let a=r(t.coord,n.getEnd()),l=t.coord;for(n=n.nextSide,t=null;;){for(let c of n.inters)if(!c.isInvalid){t=c.bindedInter;break}if(t)break;a?(r(l,n.getEnd()),a=!1):e(n.getShape()),n=n.nextSide}a?(mr.eq(l.distance2(t.coord),0)?r(l,n.getEnd()):r(l,t.coord),a=!1):mr.eq(n.getEnd().distance2(t.coord),0)?e(n.getShape()):r(n.getStart(),t.coord)}}if(t!==this)throw this.drawDebug&&console.log(JSON.stringify({runId:_1e,handleId:DZ,boolId:BH})),new Error("inter !== this");return Qf(fe.build7(o))}},_1e=0,v1e=class X1e{constructor(t,e,r,i,n){this.inters=[],this.allInterIsInvalid=!0,this.isVisit=!1,this.sides=t,this.isGroup1=r,this.isOutside=i,this.finalIsOutside=i,this.polyline=e,n&&(this.polygon=n),t.forEach(s=>s.outline=this)}static build(t,e,r,i,n){let s=t.primitives.map(l=>new qH(l,i)),a=s[s.length-1];return s.forEach(l=>{a.connect(l),a=l}),n?new X1e(s,t,e,r,n):new X1e(s,t,e,r)}setFinalIsOutSide(t){this.finalIsOutside=t}startAndEndIsSameOutsideFlag(){return this.isOutside===this.finalIsOutside}get hasInter(){return!!this.interOutlines}isAllInterIsInvalid(){return this.allInterIsInvalid}setAllInterIsInvalidToFalse(){this.allInterIsInvalid=!1}resetVisited(){this.isVisit=!1}intersect(t,e){if(!(t.interOutlines&&t.interOutlines===this.interOutlines))if(t.interOutlines)if(this.interOutlines){let r,i;this.interOutlines.length>t.interOutlines.length?(r=this.interOutlines,i=t.interOutlines):(r=t.interOutlines,i=this.interOutlines),i.forEach(n=>{r.push(n),n.interOutlines=r}),e.delete(i)}else t.interOutlines.push(this),this.interOutlines=t.interOutlines;else this.interOutlines?(this.interOutlines.push(t),t.interOutlines=this.interOutlines):(t.interOutlines=this.interOutlines=[this,t],e.add(this.interOutlines))}isContain(t){if(!this.polyline.bbox().extendOfSize(co).isContainsBBox(t.polyline.bbox()))return!1;let e=t.polyline.primitives[0].start();if(t.hasInter&&t.isAllInterIsInvalid()){let r=t.inters[0];r.getBindedInter().side.outline!==this?e=r.side.getCenterPoint():e=r.side.getCenterPoint(r.coord)}return!!this.polyline.getWindingNum(e)}isInternally(t){return!!this.polyline.getWindingNum(t)}isEqual(t){return this.polyline===t.polyline}bbox(){return this.polyline.bbox()}reverse(){this.sides.reverse();let t=this.sides[this.sides.length-1];this.sides.forEach(e=>{e.reverse(),t.connect(e),t=e})}returnPolyline(){let t=this.sides.map(r=>r.getShape()),e=this.polyline.primitives;if(this.sides.length===e.length){let r=new Set(e);if(!t.some(i=>!r.has(i)))return this.polyline}return fe.build7(t)}};function Wve(o,t,e){let r=[];return o.forEach(i=>i.forEach(n=>{if(n.hasInter&&!n.isAllInterIsInvalid())return;let s=n.bbox(),a=t.search(s.extendOfSize(co)).filter(l=>l.bbox().extendOfSize(co).isContainsBBox(s)).sort((l,c)=>l.bbox().area()-c.bbox().area());for(let l of a)if(l.isContain(n)){let c=e(!n.isOutside,l.isOutside),h=e(n.isOutside,l.isOutside);c!==h&&(r.push(n),n.setFinalIsOutSide(!c));return}e(n.isOutside,!1)!==e(!n.isOutside,!1)&&r.push(n)})),r}function Tet(o,t,e){let r;switch(e){case 0:r=(a,l)=>a&&l;break;case 1:r=(a,l)=>a||l;break;case 2:r=(a,l)=>a&&!l;break;case 3:r=(a,l)=>a&&!l||!a&&l;break;default:throw Error("not support the rule")}let i=new Mb(10),n=new Mb(10);o.forEach(a=>a.forEach(l=>i.add(l))),t.forEach(a=>a.forEach(l=>n.add(l)));let s=Wve(o,n,r);return Wve(t,i,(a,l)=>r(l,a)).forEach(a=>s.push(a)),s}var Iet=class{constructor(o){this.roots=[],this.nodes=o.sort((t,e)=>t.bbox().minX-e.bbox().minX).map(t=>new Cet(t)),this.nodes.forEach((t,e)=>{t.visit()&&(this.roots.push(t),this.build(e))})}build(o){let t=this.nodes[o];for(let e=o+1,r=this.nodes.length;e<r;e++){let i=this.nodes[e];if(t.key.bbox().maxX<i.key.bbox().minX)break;i.getIsVisit()||t.isContain(i)&&(i.visit(),t.addChild(i),this.build(e))}}getPolygons(){let o=[];return this.roots.forEach(t=>t.getPolygons().forEach(e=>o.push(e))),o}},Cet=class{constructor(o){this.children=[],this.isVisit=!1,this.key=o}getIsVisit(){return this.isVisit}isContain(o){return this.key.isContain(o.key)}addChild(o){this.children.push(o)}getPolygons(){let o=[];return this.getPolylineList(o),o.map(t=>{let e=t[0].polygon;if(e&&e.items.length===t.length){let r=t.map(n=>n.returnPolyline()),i=new Set(e.items);return r.some(n=>!i.has(n))?new hs(r):e}else return new hs(t.map(r=>r.returnPolyline()))})}getPolylineList(o,t){t?(t.push(this.key),t=null):(t=[this.key],o.push(t)),this.children.forEach(e=>e.getPolylineList(o,t))}visit(){return this.isVisit?!1:(this.isVisit=!0,!0)}};function zve(o){let t="";return o.items.forEach((e,r)=>{let i="$";if(e.items.forEach((n,s)=>{let a="[";if(n.primitives.forEach((l,c)=>{let h="";if(l instanceof M)h=`Line,${l.start().x},${l.start().y},${l.end().x},${l.end().y}`;else if(l instanceof q)h=`Arc,${l.center.x},${l.center.y},${l.startAngle},${l.sweepAngle},${l.rx}`;else if(l instanceof Mr)h=`Bezier,${l.controls.map(u=>`${u.x},${u.y}`).join(",")}`;else throw new Error("not supported");if(c===n.primitives.length-1){a+=`${h}]`;return}a+=`${h},`}),s===e.items.length-1){i+=`${a}$`;return}i+=`${a}_`}),r===o.items.length-1){t+=`${i}`;return}t+=`${i}^`}),console.log(t),t}function Yve(o){let t=o.split("^"),e=[];return t.forEach(i=>{let n=/\$(.*?)\$/,s=i.match(n)[1].split("_"),a=[];s.forEach(c=>{let h=/\[(.*?)\]/,u=c.match(h)[1].split(","),d=[],p=[];for(let g=0;g<u.length;g++){let y=u[g];if(y==="Line"||y==="Arc"||y==="Bezier"){if(d.length){let b=r(d);p.push(b),d.length=0}d.push(y);continue}d.push(Number(y))}d.length&&(p.push(r(d)),d.length=0);let m=fe.build7(p);a.push(m)});let l=new hs(a);e.push(l)}),new Jo(e);function r(i){let n=i[0];if(n==="Line")return new M(new S(i[1],i[2]),new S(i[3],i[4]));if(n==="Arc")return q.build3(new S(i[1],i[2]),i[3],i[4],i[5],i[5]);if(n==="Bezier"){let s=[];for(let a=1;a<i.length;a+=2)s.push(new S(i[a],i[a+1]));return new Mr(s)}else throw new Error("not support")}}var Eet=class{constructor(o=1){this.group1Str="$[Line,20193.777980000017,4122.200439600661,20193.77082,4211.848760073709,Arc,20193.972672902382,4211.8487570980205,179.99915535323618,-89.99540000050294,0.2018529024026465,Line,20193.972659672283,4212.050609999989,20193.972660393258,4212.039610000013,Arc,20193.97217289501,4211.848257065248,89.85403133887164,89.99540000041924,0.19135355574930143,Line,20193.78082,4211.848759926291,20193.78897999998,4122.200440479205,Line,20193.78897999998,4122.200440479205,20193.777980000017,4122.200439600661]$",this.group2Str="$[Arc,20209.72784128151,4122.2007625157785,258.46768032837986,-75.66780748375947,4.138846238512183,Line,20205.593935808283,4121.998590004101,20193.97982992629,4121.998600000001,Arc,20193.97983290198,4122.2004529023825,269.9991553532362,-89.99540000050297,0.20185290240401074,Arc,20193.782979999996,4122.20044,180.00375535340328,-180.0000000000027,0.004999999999025513,Arc,20193.979332869207,4122.200952909754,180.15347936671733,89.99540000008247,0.19135355575111057,Line,20193.97983008845,4122.009599999999,20205.603694309226,4122.003828485546,Arc,20209.733142304296,4122.194577876843,182.64475341258483,75.73379999998886,4.133851239977064,Line,20208.900400396684,4118.145470939558,20208.902599535475,4118.156248870184,Arc,20206.972515961093,4108.700057667588,78.46393309088245,-78.46759999998636,9.65115405866796,Arc,20216.618669999996,4108.69944,359.99996825446135,-180,0.004999999999200412,Arc,20206.973015966745,4108.699445349495,359.99996822365375,78.46759999998409,9.640654033253735]$^$[Line,20193.997796883676,4095.399470032799,20205.596133314026,4095.4013992171836,Arc,20209.72470159858,4095.1923799234505,177.10172964919312,-75.64935037184974,4.133855965730166,Arc,20209.73000213952,4095.198565517174,101.5415133143569,75.7293000000185,4.128850963459707,Line,20205.605834328744,4095.395161923586,20193.997203529463,4095.389485743675,Arc,20193.994588809255,4095.197684525904,89.21896662213764,4.544099999999517,0.19181903946188483,Arc,20193.981499796217,4095.1977402038,89.85034659953621,89.9999999995926,0.19135044893494071,Arc,20193.78515,4095.19824,0,-180,0.005,Arc,20193.98200016982,4095.1982398301675,179.99995179248322,-89.99999999974185,0.20185016982129908,Arc,20193.981986624152,4095.198185381971,89.9961078637802,-4.487285276547311,0.2019046184835962]$",this.rule=o}getGroup1(){return Yve(this.group1Str)}getGroup2(){return Yve(this.group2Str)}},x1e=new MZ(2),kH=class{getUnion(o,t=!0){return t&&(o=o.map(e=>this.asSameSweep([e])[0])),cet(zQe,o)}asSameSweep(o){let t=0;return o.forEach(e=>t+=e.area(.01)),t>0?o.map(e=>e.reverse()):o}getSubtraction(o,t){let e=new HH(!1),r=new WH(bZ.rule,x1e,e);for(let i of o){let n=bZ.weight(0);r.addPolyline(i,n)}for(let i of t){let n=bZ.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}getIntersection(o,t){let e=new HH(!1),r=new WH(PZ.rule,x1e,e);for(let i of o){let n=PZ.weight(0);r.addPolyline(i,n)}for(let i of t){let n=PZ.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}getMutuallyExclusive(o,t){let e=new HH(!1),r=new WH(C1e.rule,x1e,e);for(let i of o){let n=C1e.weight(0);r.addPolyline(i,n)}for(let i of t){let n=C1e.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}},BH=0,R1e=!1;function FH(o,t,e,r,i){let n=EO(),s=[],a=[],l=[],c=new Set,h;if(i){if(h=new XH(i),BH++,R1e){debugger;R1e=!1;let I=new Eet;FH(I.rule,I.getGroup1(),I.getGroup2(),r,i)}if(BH===-1||R1e){console.table({rule:o,group1:zve(t),group2:zve(e)}),h.clear();let I=h.initColor(Vl.GREEN),C=h.initColor(Vl.WHITE),E=h.initColor(Vl.BLUE),O=h.initColor(Vl.Gray);t.items.forEach(_=>_.items.forEach((R,v)=>{v>0?C.addPly(R):I.addPly(R)})),e.items.forEach(_=>_.items.forEach((R,v)=>{v>0?O.addPly(R):E.addPly(R)})),h.draw();debugger}}let u=t.items.length!==0&&e.items.length!==0?t.bbox().extendOfSize(co).intersection1(e.bbox().extendOfSize(co)):null;if(u){let I=[],C=[];switch(o){case 0:{for(let E of t.items)E.bbox().isIntersect(u)&&I.push(E);for(let E of e.items)E.bbox().isIntersect(u)&&C.push(E);break}case 1:case 3:{for(let E of t.items)E.bbox().isIntersect(u)?I.push(E):s.push(E);for(let E of e.items)E.bbox().isIntersect(u)?C.push(E):s.push(E);break}case 2:{for(let E of t.items)E.bbox().isIntersect(u)?I.push(E):s.push(E);for(let E of e.items)E.bbox().isIntersect(u)&&C.push(E);break}default:throw new Error("not support")}I.length!==t.items.length&&(t=new Jo(I)),C.length!==e.items.length&&(e=new Jo(C))}else{switch(o){case 0:break;case 1:case 3:{t.items.forEach(I=>s.push(I)),e.items.forEach(I=>s.push(I));break}case 2:{t.items.forEach(I=>s.push(I));break}default:throw new Error("not support")}t=new Jo([]),e=new Jo([])}P(t,a,!0),P(e,l,!1);let d=o===2||o===3?(I,C)=>un(I.getEnd(),C)?I.nextSide:I:(I,C)=>un(I.prevSide.getEnd(),C)?I.prevSide:I,p=(I,C,E)=>{if(un(I.getEnd(),E)){if(I.inters.findIndex(O=>O.getBindedInter().side===C&&un(O.coord,I.getEnd()))===-1)return new TO(E,I,h)}else return new TO(E,I,h)},m=o===2||o===3?(I,C,E)=>{if(un(I.getStart(),E)){if(I.inters.findIndex(O=>O.getBindedInter().side===C&&un(O.coord,I.getStart()))===-1)return new TO(E,I,h)}else return new TO(E,I,h)}:p;r.seek(t,e,(I,C,E,O,_,R)=>{let v=a[I][C],D=l[O][_],w=v.sides[E],F=D.sides[R],H=Pf(w.getShape(),F.getShape());if((w.getShape()instanceof Mr||F.getShape()instanceof Mr)&&H>=4){if(w.getShape()instanceof q||F.getShape()instanceof q){let G=function(L,B){let N=!1;for(let U=0;U<B.length;U+=2)un(new S(B[U],B[U+1]),L)&&(N=!0);N||B.push(L.x,L.y)},W=[Ke[0],Ke[1]];for(let L=0;L<H;L+=2){let B=new S(Ke[L],Ke[L+1]);for(let N=L+2;N<H;N+=2){let U=new S(Ke[N],Ke[N+1]);if(!un(B,U)){G(U,W);break}}}H=W.length,W.forEach((L,B)=>Ke[B]=L)}else for(let G=H-2;G>=2;G-=2)for(let W=G-2;W>=0;W-=2)if(un(new S(Ke[G],Ke[G+1]),new S(Ke[W],Ke[W+1]))){Ke[W]=(Ke[G]+Ke[W])/2,Ke[W+1]=(Ke[G+1]+Ke[W+1])/2;for(let L=H-3;L>=G;L--)Ke[L]=Ke[L+2];H-=2;break}}let z=0;if(H===4){let G=function(B){return un(w.getEnd(),B)||un(w.prevSide.getEnd(),B)||un(F.prevSide.getEnd(),B)||un(F.getEnd(),B)},W=new S(Ke[0],Ke[1]),L=()=>{let B=new TO(W,w,h),N=new TO(W,F,h);B.bind(N),B.setIsInvalid(),B.isDealed(),v.inters.push(B),D.inters.push(N)};if(Ke[0]===Ke[2]&&Ke[1]===Ke[3])if(G(W))z=2;else{L();return}}for(;z<H;z+=2){let G=new S(Ke[z],Ke[z+1]),W=w,L=F;if(un(W.prevSide.getEnd(),G)&&(W=W.prevSide),L=d(L,G),w!==W&&F!==L){let N=o===2||o===3?F.getEnd():L.getEnd();W.getEnd().distance1(G)<N.distance1(G)?(G=W.getEnd(),un(N,G)||(L=F)):(G=N,un(W.getEnd(),G)||(W=w))}let B=p(W,L,G);if(B){let N=m(L,W,G);N&&(W.addInter(B),v.inters.push(B),L.addInter(N),D.inters.push(N),B.bind(N),v.intersect(D,c))}}return H},i);let g=T(),y=Tet(a,l,o);y.forEach(I=>!I.startAndEndIsSameOutsideFlag()&&I.reverse()),new Iet(g.concat(y)).getPolygons().forEach(I=>s.push(I));let b=new Jo(s);if(h){if(BH===-1){let I=h.initColor(Vl.RED),C=h.initColor(Vl.Golden);s.forEach(E=>{I.addPly(E.items[0]),E.items.slice(1).forEach(O=>C.addPly(O))}),h.draw();debugger;throw new Error}b.id=BH}return I2.BooleanTools+=pI(n),b;function P(I,C,E){I.items.forEach(O=>{let _=[];_.push(v1e.build(O.items[0],E,!0,h,O)),O.items.slice(1).forEach(R=>{_.push(v1e.build(R,E,!1,h))}),C.push(_)})}function T(){let I=[];return c.forEach(E=>{o===2||o===3?E.forEach(_=>{_.isGroup1||_.reverse(),_.sides.forEach(R=>R.sortInters())}):E.forEach(_=>_.sides.forEach(R=>R.sortInters())),E.map(_=>_.sides.filter(R=>R.inters.length)).flat(2).sort((_,R)=>{let v=_.inters,D=R.inters,w=un(v[v.length-1].coord,_.getEnd()),F=un(D[D.length-1].coord,R.getEnd());if(w&&F){let H=0,z=0;for(let G=v.length-2;G>=0&&un(v[G].coord,_.getEnd());G--)H++;for(let G=D.length-2;G>=0&&un(D[G].coord,R.getEnd());G--)z++;return z-H}else return w?-1:1}).forEach(_=>{_.inters.forEach(R=>{if(R.dealed)return;let v=R.side,D=R.getBindedInter().side,w;un(v.getEnd(),R.coord)&&un(D.getEnd(),R.coord)?w=-1:un(v.getEnd(),R.coord)?(w=1,R=R.getBindedInter()):un(D.getEnd(),R.coord)&&(w=1);let F=Pet(w,R,o,h);R.isDealed(),F&&(v.outline.setAllInterIsInvalidToFalse(),D.outline.setAllInterIsInvalidToFalse())})}),O(E),o===3&&(E.forEach(_=>{_.reverse(),_.sides.forEach(R=>{R.sortInters(),R.inters.forEach(v=>{v.resetVisitStatus()})})}),O(E));function O(_){_.forEach(R=>{R.inters.forEach(v=>{if(v.isInvalid||v.getVisited())return;let D=v.findStartInter(),w=C(o)?D.run():D.getBindedInter().run(),F=R.polyline.primitives;if(w){if(F.length===w.primitives.length){let H=new Set(F);if(!w.primitives.some(z=>!H.has(z))){I.push(R);return}}I.push(v1e.build(w,!0,!0,h))}})})}}),I;function C(E){switch(E){case 0:case 2:case 3:return!0;case 1:return!1;default:throw Error("not support the rule")}}}}var dZ=/\bstablilizetion\b/.test(self.location.href)||!0,pZ={intersect(o,t,e,r){try{return FH(0,o,t,e,r)}catch(i){if(dZ){let n=new kH().getIntersection(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new Jo(n.map(s=>new hs(s.items)))}throw i}},union(o,t,e,r){try{return FH(1,o,t,e,r)}catch(i){if(dZ){let n=new kH,s=o.items.map(l=>l.items.map(c=>c)).flat(2);t.items.forEach(l=>l.items.forEach(c=>s.push(c)));let a=n.getUnion(s);return new Jo(a.map(l=>new hs(l.items)))}throw i}},diff(o,t,e,r){try{return FH(2,o,t,e,r)}catch(i){if(dZ){let n=new kH().getSubtraction(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new Jo(n.map(s=>new hs(s.items)))}throw i}},xor(o,t,e,r){try{return FH(3,o,t,e,r)}catch(i){if(dZ){let n=new kH().getMutuallyExclusive(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new Jo(n.map(s=>new hs(s.items)))}throw i}}},Oet=class extends WH{constructor(o,t,e,r,i,n){super(o.rule,MZ.DUMMY,t),this.sideGroup1=[],this.sideGroup2=[],this.group1=e,this.group2=r,this.seeker=i,this.addGroup(e,o.weight(0),this.sideGroup1),this.addGroup(r,o.weight(1),this.sideGroup2),this.bus=n}addGroup(o,t,e){if(!o)debugger;o.items.forEach(r=>{let i=[];r.items.forEach(n=>{let s=this.sides.length;this.addPolyline(n,t),i.push(this.sides.slice(s))}),e.push(i)})}seekIntersection(){this.seeker.seek(this.group1,this.group2,(o,t,e,r,i,n)=>{let s=this.sideGroup1[o][t][e],a=this.sideGroup2[r][i][n],l=Pf(s.shape,a.shape);for(let c=0;c<l;c+=2){let h=new S(Ke[c],Ke[c+1]);s.inters.push(h),a.inters.push(h),this.event.onIntersect(h,s,a)}return l},this.bus)}},Aet=class extends HH{constructor(o){super(!!o),o&&(this.drawDebug=new XH(o),this.blueDrawing=this.drawDebug.initColor(Vl.BLUE),this.greenDrawing=this.drawDebug.initColor(Vl.GREEN),this.redDrawing=this.drawDebug.initColor(Vl.RED))}onOriginSide(o){super.onOriginSide(o),this.debug&&this.blueDrawing.addPt(o.shape)}onPolylineGroup(o,t){super.onPolylineGroup(o,t),this.debug&&o.items.forEach(e=>this.greenDrawing.addPly(e))}draw(){this.drawDebug.draw()}};function D1e(o,t,e,r,i){let n=EO(),s=new Aet(i);new Oet(o,s,t,e,r,i).simplify();let a=[];s.plGrps.forEach(c=>{let h=c.items.map(u=>RZ(u));h[0]&&a.push(new hs(h.filter(u=>u)))});let l=new Jo(a);return I2.BooleanTools+=pI(n),l}var w1e=!0,DH={intersect(o,t,e,r){try{return pZ.intersect(o,t,e,r)}catch(i){if(w1e)throw i;return console.error(i),D1e(PZ,o,t,e,r)}},union(o,t,e,r){try{return pZ.union(o,t,e,r)}catch(i){if(w1e)throw i;return console.error(i),D1e(YQe,o,t,e,r)}},diff(o,t,e,r){try{return pZ.diff(o,t,e,r)}catch(i){if(w1e)throw i;return console.error(i),D1e(bZ,o,t,e,r)}},xor(o,t,e,r){return pZ.xor(o,t,e,r)}},_et=class{init(o){}seek(o,t,e,r){let i=o.bbox().extendOfSize(5e-6).intersection1(t.bbox().extendOfSize(5e-6));if(!i)return;let n=EO(),s=[];for(let d=0,p=o.items.length;d<p;d++){let m=o.items[d];if(i.isIntersect(m.bbox()))for(let g=0,y=m.items.length;g<y;g++){let b=m.items[g];if(i.isIntersect(b.bbox()))for(let P=0,T=b.primitives.length;P<T;P++){let I=b.primitives[P].bbox();i.isIntersect(I)&&s.push({bbox:I,polygonIndex:d,polylineIndex:g,ptIndex:P})}}}let a=s.length;if(a===0){I2.IntersectionSeeker+=pI(n);return}let l=[];for(let d=0,p=t.items.length;d<p;d++){let m=t.items[d];if(i.isIntersect(m.bbox()))for(let g=0,y=m.items.length;g<y;g++){let b=m.items[g];if(i.isIntersect(b.bbox()))for(let P=0,T=b.primitives.length;P<T;P++){let I=b.primitives[P].bbox();i.isIntersect(I)&&l.push({bbox:I,polygonIndex:d,polylineIndex:g,ptIndex:P})}}}let c=l.length;if(c===0){I2.IntersectionSeeker+=pI(n);return}if(a<5||c<5){for(let d=0,p=s.length;d<p;d++)for(let m=0,g=l.length;m<g;m++)if(s[d].bbox.isIntersect(l[m].bbox.extendOfSize(1e-5))){let y=s[d],b=l[m];e(y.polygonIndex,y.polylineIndex,y.ptIndex,b.polygonIndex,b.polylineIndex,b.ptIndex)}I2.IntersectionSeeker+=pI(n);return}s.sort((d,p)=>d.bbox.minX-p.bbox.minX),l.sort((d,p)=>d.bbox.minX-p.bbox.minX);let h=0,u=0;for(;h<a&&u<c;)if(s[h].bbox.minX<l[u].bbox.minX){let d=s[h],p=d.bbox;for(let m=u;m<c;m++){let g=l[m],y=g.bbox;if(y.minX>p.maxX+1e-5)break;(p.minY<y.minY?y.minY:p.minY)<(p.maxY<y.maxY?p.maxY:y.maxY)+1e-5&&e(d.polygonIndex,d.polylineIndex,d.ptIndex,g.polygonIndex,g.polylineIndex,g.ptIndex)}h++}else{let d=l[u],p=d.bbox;for(let m=h;m<a;m++){let g=s[m],y=g.bbox;if(y.minX>p.maxX+1e-5)break;(y.minY<p.minY?p.minY:y.minY)<(y.maxY<p.maxY?y.maxY:p.maxY)+1e-5&&e(g.polygonIndex,g.polylineIndex,g.ptIndex,d.polygonIndex,d.polylineIndex,d.ptIndex)}u++}I2.IntersectionSeeker+=pI(n)}},C7=class yO{static getDebug(){return yO.drawDebug||(yO.drawDebug=new XH(yO.curBus)),yO.drawDebug}static getDrawing(t=Vl.GREEN){return this.getDebug().initColor(t)}static clearDrawing(){yO.getDebug().clear()}static drawText(t,e,r=Vl.GREEN){yO.getDrawing(r).addText(t,e,1.5,.1,!0)}static drawBBox(t,e=Vl.GREEN){if(!t)return;let r=yO.getDrawing(e),i=new M(t.UL(),t.UR()),n=new M(t.UR(),t.LR()),s=new M(t.LR(),t.LL()),a=new M(t.LL(),t.UL());r.addPt(i),r.addPt(n),r.addPt(s),r.addPt(a)}static drawPolyType(t,e){let r=yO.getDrawing(e);if(t instanceof fe)r.addPly(t);else if(t instanceof hs)for(let i of t.items)i instanceof fe?r.addPly(i):this.drawPolyType(i,e);else if(t instanceof Jo)for(let i of t.items)this.drawPolyType(i,e)}static translate(t){switch(t){case 0:return"\u2229";case 2:return"-";case 1:return"U";case 3:return"X";default:break}}};C7.UseOptimizeSplit=!0,C7.LocalBestThread=4,C7.HandleDiff=!0,C7.OcTreeSplitStep=4,C7.PrintStart=new S(150,-200);var f1=C7,wH=class q1e{static getPolyTypeLine(t){let e=[];if(t instanceof fe)for(let r of t.primitives)e.push(r);else if(t instanceof hs)for(let r of t.items)if(r instanceof fe)for(let i of r.primitives)e.push(i);else{let i=this.getPolyTypeLine(r);for(let n of i)e.push(n)}else if(t instanceof Jo)for(let r of t.items){let i=this.getPolyTypeLine(r);for(let n of i)e.push(n)}return e}static getPolyTypePolyLine(t){let e=[];if(t instanceof fe)e.push(t);else if(t instanceof hs)for(let r of t.items)if(r instanceof fe)e.push(r);else{let i=this.getPolyTypePolyLine(r);for(let n of i)e.push(n)}else if(t instanceof Jo)for(let r of t.items){let i=this.getPolyTypePolyLine(r);for(let n of i)e.push(n)}return e}static getListBBox(t){if(t.length<=0)return;let e=new _e;for(let r of t){let i=q1e.getSingleBBox(r);e.ext1(i)}return e.build1()}static getSingleBBox(t){if(t instanceof Array){let e=new _e,r=q1e.getListBBox(t.slice(1));return e.ext1(r),e.build1()}else return t.bbox()}static doDrawRule(t,e=f1.PrintStart){if(t.length<2)return[e,e,e];let r=5,i=10,n=t[0],s=f1.translate(n),a=[],l=e.y,c=e.x,h=e.x;e=e.add(new S(0,-i));for(let p=1;p<t.length;p++){let m=t[p];if(m instanceof Array){e=e.add(new S(r,0));let g=this.doDrawRule(m,e);a.push(g[0]),g[1].x<=c&&(c=g[1].x),g[2].x>=h&&(h=g[2].x),e=new S(g[2].x+r,e.y)}else a.push(e.clone()),e.x<=c&&(c=e.x),e.x>=h&&(h=e.x),f1.drawText(e,m.name),e=e.add(new S(r,0))}let u=0;for(let p of a)u+=p.x;let d=new S(u/a.length,e.y+i);f1.drawText(d,"N:"+s);for(let p of a){let m=new M(p,d),g=new Array;g.push(m);let y=fe.build1(F1e(g));f1.drawPolyType(y,Vl.GREEN)}return[d,new S(c,l),new S(h,l)]}static drawRule(t,e=f1.PrintStart,r=!1,i){f1.clearDrawing(),this.doDrawRule(t,e),r&&this.doDrawRulePolygon(t,i),f1.getDebug().draw()}static doDrawRulePolygon(t,e){let r=t[0];for(let i=1;i<t.length;i++){let n=t[i];if(n instanceof Array)this.doDrawRulePolygon(n,e);else{let s=e;r===2&&i===1&&(s=Vl.RED),n.name&&f1.drawText(n.bbox().UL(),n.name,s),f1.drawPolyType(n,s)}}}static IsCenterBBoxPointInPolygonType(t,e){let r=t.center();for(let i of e.items)if(i.getOutMostPolyline().getWindingNum(r))return!0;return!1}static KeepBBoxPolygonGroup(t,e){let r=e.bbox().intersection1(t);if(!r)return!1;for(let i of e.items)if(i.bbox().isIntersect(r)){for(let n of i.items)if(n.bbox().isIntersect(r)){for(let s of n.primitives)if(r.isIntersect(s.bbox()))return!0}}return!!this.IsCenterBBoxPointInPolygonType(t,e)}},vet=class S7{static createNode(t,e,r){let i=t.UL(),n=t.width()/e,s=t.height()/e,a=~~(r/e),l=r-a*e,c=i.x+l*n,h=i.y-(a+1)*s,u=c+n,d=h+s;return new ut(c,u,h,d)}static ocTreeSplitNode(t,e,r,i,n=2){if(t.length<=r)return t;let s=[],a=n**2,l=new Array(a),c=new Array(a);for(let p=0;p<a;p++)l[p]=new Array(t.length),c[p]=0;let h=e.UL(),u=e.width()/n,d=e.height()/n;for(let p of t){let m=i(p).center(),g=~~((m.x-h.x)/u),y=~~((h.y-m.y)/d)*n+g;try{l[y][c[y]]=p,c[y]+=1}catch{s.push(p)}}for(let p=0;p<l.length;p++){let m=c[p];if(m<=0)continue;let g=l[p].slice(0,m);if(g.length===t.length)return t;let y=S7.createNode(e,n,p),b=S7.ocTreeSplitNode(g,y,r,i,n);if(b.length===t.length)return t;s.push(b)}return s}static ocTreeSplitNodeMinIntersect(t,e,r,i){let n=[];if(t.length<=r)return t;let s=3,a=e.LL(),l=e.UR(),c=e.width()/(s+1),h=e.height()/(s+1),u=-(2**32),d=[],p=[];for(let m=1;m<=s;m++)for(let g=1;g<=s;g++){let y=a.x+c*m,b=a.y+h*g,P=[[],[],[],[]],T=new Array(4),I=new Array(4);I[0]=new ut(a.x,y,b,l.y),I[1]=new ut(y,l.x,b,l.y),I[2]=new ut(a.x,y,a.y,b),I[3]=new ut(y,l.x,a.y,b);for(let _ of t){let R=i(_).center(),v=-1,D=-1;R.x===y?v=Math.random()>=.5?1:-1:R.x>y?v=1:R.x<y&&(v=-1),R.y===b?D=Math.random()>=.5?1:-1:R.y>b?D=1:R.y<b&&(D=-1),v===1&&D===1?P[1].push(_):v===1&&D===-1?P[3].push(_):v===-1&&D===-1?P[2].push(_):v===-1&&D===1&&P[0].push(_)}for(let _=0;_<4;_++){let R=P[_];if(R.length<=0)continue;let v=new _e;for(let D of R)v.ext1(i(D));T[_]=v.build1()}let C=0,E=0;for(let _ of T)_&&(C+=_.area());E=C;let O=(_,R)=>{if(!T[_]||!T[R])return 0;let v=T[_].intersection1(T[R]);return v?v.area():0};E-=O(0,1),E-=O(0,2),E-=O(0,3),E-=O(1,2),E-=O(1,3),E-=O(2,3),E/C>=u&&(d=P,p=I)}for(let m=0;m<d.length;m++){let g=d[m];if(g.length<=0)continue;let y=p[m],b;if(g.length===t.length?b=S7.ocTreeSplitNode(g,y,r,i):b=S7.ocTreeSplitNodeMinIntersect(g,y,r,i),b.length===t.length)return t;n.push(b)}return n}static ocTreeSplit(t,e,r,i){return S7.ocTreeSplitNode(t,e,r,i,f1.OcTreeSplitStep)}},xet=class yxe{static OcTreeOptimizeSplit(t){let e=t[0];if(e!==1||t.length<=f1.LocalBestThread+1)return t;let r=t.slice(1),i=new Array(r.length);for(let c=1;c<t.length;c++)i[c-1]=c;let n=wH.getListBBox(r),s=vet.ocTreeSplit(i,n,f1.LocalBestThread,c=>{let h=t[c];return wH.getSingleBBox(h)}),a=(c,h)=>{if(!(c.length<=0))for(let u of c)if(Array.isArray(u)){let d=[h[0]];a(u,d),h.push(d)}else{let d=t[u];h.push(d)}},l=[e];return a(s,l),l}static optimizeSplit(t,e){let r=t[0];if(r===2){if(f1.HandleDiff){let n=t[1],s;if(Array.isArray(n)){let a=this.optimizeSplit(n,e);if(a.length<=1)return[2];s=wZ(a,e)}else s=wZ([2,n],e);if(t.length>3){let a;a=[1];for(let l=2;l<t.length;l++){let c=t[l];if(Array.isArray(c)){let h=wH.getListBBox([...c.slice(1)]);wH.KeepBBoxPolygonGroup(h,s)&&a.push(c)}else wH.KeepBBoxPolygonGroup(c.bbox(),s)&&a.push(c)}return a.length<=1?[2,s]:(a=this.optimizeSplit(a,e),a.length>1?[2,s,...a.slice(1)]:[2,s])}else{let a=t[2];if(Array.isArray(a)&&a[0]===1&&a.length>2){let l=a.slice(1);return this.optimizeSplit([2,s,...l],e)}}}else if(t.slice(1).length>2){let n=t[1],s=t.slice(2),a=this.optimizeSplit([1,...s],e);return a.length>1?[2,n,...a.slice(1)]:n}}else if(r===1){if(t.length-1>f1.LocalBestThread){let n=!1;for(let s=1;s<t.length;s++){let a=t[s];if(!Array.isArray(a)){n=!0;break}}n&&(t=yxe.OcTreeOptimizeSplit(t))}}else if(r===0&&t.length<=2)return[0];let i=[r];for(let n=1;n<t.length;n++){let s=t[n];if(Array.isArray(s)){let a=this.optimizeSplit(s,e);if(a.length<=1)continue;i.push(a)}else i.push(s)}return i}},Gl=(o=>(o[o.INTERSECT=0]="INTERSECT",o[o.UNION=1]="UNION",o[o.DIFF=2]="DIFF",o[o.XOR=3]="XOR",o))(Gl||{});function VH(o){let t=o[0],e=[t];switch(t){case 0:for(let i=1;i<o.length;i++){let n=o[i];if(Array.isArray(n)&&(n=VH(n),!n))return null;e.push(n)}break;case 1:case 3:for(let i=1;i<o.length;i++){let n=o[i];Array.isArray(n)&&(n=VH(n),!n)||e.push(n)}break;case 2:let r=o[1];if(Array.isArray(r)&&(r=VH(r)),!r)return null;e.push(r);for(let i=2;i<o.length;i++){let n=o[i];Array.isArray(n)&&(n=VH(n),!n)||e.push(n)}break;default:throw new Error("not support boolean rule!")}return e.length===1?null:e.length===2?e[1]:e}function L1e(o,t,e){return Array.isArray(o)?bxe(o,t,e):o}function M1e(o,t,e,r,i=!0){if(i)for(;o.length>1;){let n,s=[];for(o.length%2===1?(s.push(o[0]),n=1):n=0;n<o.length;n+=2)s.push(t(o[n],o[n+1],e,r));o=s}else for(;o.length>1;){if(o.length===2)return t(o[0],o[1],e,r);o=[t(o[0],o[1],e,r),...o.slice(2)]}return o[0]}function bxe(o,t,e,r=!0){let i=new Array(o.length-1);for(let n=1;n<o.length;n++)i[n-1]=L1e(o[n],t,e);switch(o[0]){case 0:return M1e(i,DH.intersect,t,e);case 1:return M1e(i,DH.union,t,e);case 2:let n=M1e(i.slice(1),DH.union,t,e);return n?DH.diff(i[0],n,t,e):i[0];case 3:let s=L1e(o[1],t,e);for(let a=2;a<o.length;a++)s=DH.xor(s,L1e(o[a],t,e),t,e);return s;default:throw new Error("not support boolean rule! "+o[0])}}function Pxe(o){let t=[o[0]];for(let e=1;e<o.length;e++){let r=o[e];if(Array.isArray(r)){let i=Pxe(r);Array.isArray(i)?i.length>1&&t.push(i):t.push(i)}else{let i=RZ(r);i!==null&&t.push(Jo.build(i))}}return t}function Ret(o){let t=[];for(let e=0;e<o.length;e+=2){let r=o[e],i=o[e+1];i?t.push({xor:dv([3,r,i]),union:dv([1,r,i])}):t.push({xor:r,union:r})}for(;t.length!==1;){for(let e=0;e<t.length;e+=2){let r=t[e],i=t[e+1],n=e/2;if(!i){t[n]=r;break}let s=dv([2,r.xor,i.union]),a=dv([2,i.xor,r.union]),l=[];s.items.forEach(c=>l.push(c)),a.items.forEach(c=>l.push(c)),t[n]={xor:new Jo(l),union:dv([1,r.union,i.union])}}t.length=Math.ceil(t.length/2)}return t[0].xor}function $1e(o){let t=o[0];if(t===3&&o.length>3){let r=[];for(let i=1;i<o.length;i++){let n=o[i];if(n instanceof Jo)r.push(n);else{let s=$1e(n);s instanceof Jo?r.push(s):r.push(dv(s))}}return Ret(r)}let e=[t];for(let r=1;r<o.length;r++){let i=o[r];i instanceof Jo?e.push(i):e.push($1e(i))}return dv(e)}function dv(o,t){if(!f1.UseOptimizeSplit)return wZ(o,t);let e=xet.optimizeSplit(o,t);return e.length<=1?new Jo([]):wZ(e,t)}function HP(o,t){f1.curBus=t;let e=Pxe(o),r=VH(e);if(!(r instanceof Array))return r||new Jo([]);let i=$1e(r);return i instanceof Jo?i:dv(i)}function wZ(o,t,e=!0){if(!o||o.length===1)return new Jo([]);let r=o,i=new _et,n=[];function s(a){for(let l=1;l<a.length;l++){let c=a[l];Array.isArray(c)?s(c):n.push(c)}}return s(r),i.init(n),bxe(r,i,t,e)}var fZ=new Error("list is empty"),mZ=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},Det=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},wet=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},Let=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw fZ;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw fZ;return this.remove(o),o.item}addLast(o){if(this.first===null||this.last===null){let t=new mZ(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new mZ(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw fZ;return this.first.item}getLast(){if(this.last===null)throw fZ;return this.last.item}insertAfter(o,t){let e=new mZ(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new mZ(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new Det(this.first)}listIterator(){return new wet(this.first)}toArray(){let o=new Array,t=this.first;for(;t!=null;)o.push(t.item),t=t.next;return o}},IZ=class{constructor(o){this.inters=[],o&&(this.inters=o)}addInter(o){this.inters.push(o),o.group=this}findInter(o){let t=this.inters.find(e=>un(e.coord,o.coord));return t&&this.inters.find(e=>e.side===o.side)&&o.visitSelf(),t}getOutInter(o){let t=this.inters.filter(e=>!e.getVisited());if(t.length!==0)return t.length===1?t[0]:t.reduce((e,r)=>{if(!e||e.side.getShape()===o)return r;if(r.side.getShape()===o)return e;let i=e.coord,n=lo(o,i),s=lo(e.side.getShape(),i),a=lo(r.side.getShape(),i);return n.dot(s)>n.dot(a)?e:r},void 0)}getEntryInter(){}},N1e=0;function fv(o,t){let e=o.primitives[0];if(o.primitives.length===1&&e instanceof q&&Math.abs(e.sweepAngle)===360)return[o];let r=EO();N1e++;let i,n=Het(o);if(n.length===0)return[];let s=ket(n);if(N1e===-1){i=new XH(t);let h=i.initColor(Vl.BLUE);n.forEach(d=>h.addPt(d.getShape()));let u=i.initColor(Vl.GREEN);s.forEach(d=>u.addPoint(d.coord)),i.draw();debugger;throw new Error}if(s.length===0)return[fe.build7(n.map(h=>h.getShape()))];Bet(s);let a=[],l=!1;try{Get(s,i)}catch(h){h.customType==="IS_OVERLAP"?(l=!0,a=new kH().getUnion([o]).map(u=>u.items).flat(2)):console.error(h)}if(l)return a;let c=Vet(s);if(!c.length)return[fe.build7(n.map(h=>h.getShape()))];if(a=Met(c,i),a.length===0)return console.warn("=====deSelfIntersection=====",N1e),[];if(i)throw a.forEach(h=>{i.initColor(Vl.WHITE).addPly(h),i.draw();debugger}),new Error;return I2.deSelfIntersection+=pI(r),a}function Met(o,t){let e=[];return o.forEach(r=>{let i=r;r.inters.forEach(n=>{if(n.getVisited())return;let s=[],a=[],l;if(t){debugger;let h=t.initColor(Vl.RED);l=u=>{s.push(u),h.addPt(s[s.length-1]),t.draw();debugger}}else l=h=>s.push(h);do{let h=function(g,y){mr.eq(g.distance2(y),0)||l(Txe(p.getShape(),g,y))},u=a.findIndex(g=>g===n.group);if(u!==-1){let g=s.findIndex(P=>P===n.group),y=s.splice(g).filter(P=>!(P instanceof IZ));if(y.length){let P=Qf(fe.build7(y));P&&e.push(P)}let b=s.filter(P=>!(P instanceof IZ));if(n=a[u].getOutInter(b[b.length-1]),a.splice(u),!n)throw Error("interGroup not hav inter!!!2");continue}n.visitSelf(),a.push(n.group),s.push(n.group);let d=n.getIndex(),p=n.side,m=p.inters[d+1];for(;m!=null&&m.isInvalid||m&&m.group===n.group;)m=p.inters[m.getIndex()+1];if(m){h(n.coord,m.coord);let g=m.getBindedInter();if(n=g.getVisited()?g.group.getOutInter(g.side.getShape()):g,!n){if(m.group===i)break;throw new Error("interGroup not hav inter!!!3")}}else{for(h(n.coord,p.getEnd()),p=p.nextSide,n=null;;){for(let g of p.inters)if(!g.isInvalid){let y=g.group.getOutInter(p.getShape());if(!y){if(g.group===i){n=g;break}else if(g.getBindedInter().group===i){n=g.getBindedInter();break}continue}n=y;break}if(n)break;l(p.getShape()),p=p.nextSide}mr.eq(p.getEnd().distance2(n.coord),0)?l(p.getShape()):h(p.getStart(),n.coord)}}while(n.group!==i);let c=Qf(fe.build7(s.filter(h=>!(h instanceof IZ))));c&&e.push(c)})}),e}function Net(o){return{next(){return o.hasNext()?{value:o.next()}:{done:!0,value:void 0}},[Symbol.iterator](){return this}}}function ket(o){let t=[],e=new Let;for(let r of o.slice().sort((i,n)=>i.bbox().minY-n.bbox().minY)){for(let i of Net(e.listIterator())){let n=i.item;if(n.bbox().maxY<r.bbox().minY)e.remove(i);else{let s=function(d,p){let m=new TO(p,d,null);return d.inters.push(m),t.push(m),m},a=function(d,p){let m=d.getEnd(),g=new S(Ke[0],Ke[1]),y=new S(Ke[2],Ke[3]),b=m.distance2(g)>m.distance2(y)?g:y,P=d.prevSide;s(un(P.getEnd(),b)?P:d,b).bind(s(p,b))},l=n.getShape(),c=r.getShape(),h=Pf(l,c),u=h===4&&Ke[0]===Ke[2]&&Ke[1]===Ke[3];if(u&&(h-=2),n.nextSide===r)n.prevSide!==r&&h===4&&a(n,r);else if(n.prevSide===r)h===4&&a(r,n);else if(h!==0){let d=function(m,g){let y=m.prevSide;return s(un(y.getEnd(),g)?y:m,g)},p=new S(Ke[0],Ke[1]);if(u&&!un(p,n.prevSide.getEnd())&&!un(p,r.prevSide.getEnd())&&lo(l,p).dot(lo(c,p))>0)continue;for(let m=0;m<h;m+=2){let g=new S(Ke[m],Ke[m+1]);d(n,g).bind(d(r,g))}}}}e.add(r)}return t.forEach(r=>{r.getIndex()===void 0&&r.side.sortInters()}),t}function Bet(o){o.forEach(t=>{let e=t.side.getEnd();if(t.isInvalid||!un(t.coord,e))return;let r=t.side.inters,i=t.getBindedInter().side;for(let n=r.length-1;n>=0;n--){let s=r[n];if(!un(s.coord,e))break;s!==t&&s.getBindedInter().side===i&&s.setIsInvalid()}})}function Fet(o){let t=new Mb(10);return o.forEach(e=>{e.isInvalid||t.add(e)}),t}function Vet(o){let t=[],e=Fet(o);return o.forEach(r=>{if(r.isInvalid||r.group)return;let i=e.search(r.bbox().extendOfSize(mr.eps)).filter(n=>!n.group);if(i.length){let n=new Set,s=new IZ(i);i.forEach(a=>{a.group=s,n.has(a.side)&&a.visitSelf(),n.add(a.side)}),t.push(s)}}),t}function Get(o,t){o.forEach(e=>{if(e.isInvalid||e.dealed)return;let r=e.side,i=e.getBindedInter().side,n;un(r.getEnd(),e.coord)&&un(i.getEnd(),e.coord)?n=-1:un(r.getEnd(),e.coord)?r.nextSide!==i&&(n=1,e=e.getBindedInter()):un(i.getEnd(),e.coord)&&i.nextSide!==r&&(n=1),Uet(n,e,t),e.isDealed()})}function Uet(o,t,e){let r=t.getBindedInter(),i=t.side,n=r.side,s=i.getShape(),a=n.getShape(),l=1,c=!1;if(o===-1){if(y7(s.reverse(),a.reverse())||y7(i.nextSide.getShape(),n.nextSide.getShape())){let u=bO(i,i.nextSide,n,r,l,c,e);if(u.state===2){let p=new Error("info1.state === InState.IS_OVERLAP");throw p.customType="IS_OVERLAP",p}let d=bO(i,i.nextSide,n.nextSide,r,l,c,e);u.state===d.state&&h(u,d)}else if(!(y7(s.reverse(),n.nextSide.getShape())||y7(i.nextSide.getShape(),a.reverse()))){let u=A1e(i,i.nextSide,n,!1,e);u===A1e(i,i.nextSide,n.nextSide,!0,e)&&u!==A1e(n,n.nextSide,i.nextSide,!0,e)&&t.setIsInvalid()}}else if(o===1){let u=function(d,p){return lo(d,p.start()).dot(lo(p,p.start()))>0};if(y7(s.reverse(),a.reverse())||y7(s,n.nextSide.getShape())){let d=UP(i,n,r,e,l,c,new Map);if(d.state===2){let m=new Error("info1.state === InState.IS_OVERLAP");throw m.customType="IS_OVERLAP",m}let p=UP(i,n.nextSide,r,e,l,c,new Map);d.state===p.state&&h(d,p)}else if(u(s.reverse(),a.reverse())&&u(s,n.nextSide.getShape())){let d=Jf(i,n,!1,e);d===Jf(i,n.nextSide,!0,e)&&d!==yL(n,n.nextSide,new qH(Txe(s,t.coord,s.end()),e),!0,e)&&t.setIsInvalid()}}function h(u,d){u.inter.setIsInvalid(),d.inter.setIsInvalid(),t.setIsInvalid()}}function Txe(o,t,e){if(o instanceof M||t.distance2(e)<1e-6)return new M(t,e);if(o instanceof q)return q.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.sweep());if(o instanceof Mr){let r=o.getPercent(t,co),i=o.getPercent(e,co);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function Het(o){let t=Qf(o);if(!t)return[];let e=t.primitives.map(i=>new qH(i,null)),r=e[e.length-1];return e.forEach(i=>{r.connect(i),r=i}),e}var gy=class{static clearData(o){this.originalPrimitive=[],this.offsetPrimitive=[],this.rawOffsetPrimitive=[],this.offsetDistance=0,this.testI++,this.testI===0?this.drawDebug=new XH(o):delete this.drawDebug}static createRawOffsetEdge(){if(this.drawDebug){let o=this.drawDebug.initColor(Vl.WHITE);this.originalPrimitive.forEach(t=>o.addPt(t)),this.drawDebug.draw();debugger}for(let o=0;o<this.originalPrimitive.length;o+=1){let t=this.originalPrimitive[o];this.offsetPrimitive.push({index:o,offsetEdge:this.createOffsetEdge(t)})}if(this.drawDebug){let o=this.drawDebug.initColor(Vl.Golden);this.offsetPrimitive.forEach(t=>o.addPt(t.offsetEdge)),this.drawDebug.draw();debugger}if(this.offsetPrimitive.length>1)for(let o=0;o<this.offsetPrimitive.length;o+=1)if(o===this.offsetPrimitive.length-1){this.connectPrimitive(this.offsetPrimitive[o],this.offsetPrimitive[0]);let t=this.rawOffsetPrimitive[0],e;t instanceof q?e=q.build4(this.offsetPrimitive[0].offsetEdge.start(),t.end(),t.center,t.rx,t.ry,t.sweep()):e=new M(this.offsetPrimitive[0].offsetEdge.start(),t.end()),this.rawOffsetPrimitive.shift(),this.rawOffsetPrimitive.unshift(e)}else this.connectPrimitive(this.offsetPrimitive[o],this.offsetPrimitive[o+1]);else this.rawOffsetPrimitive=[]}static createCirclePrimitive(o,t){let e=o.width()*.5,r=o.height()*.5,i=Math.sqrt(e**2+r**2)+t;return[q.buildCircle(o.center(),i)]}static getExtendPolyLine(o,t,e=!0,r){var i,n;if(!((i=o==null?void 0:o.primitives)!=null&&i.length))return[];this.isExpansion=t>0;let s=Qf(o);if(!((n=s==null?void 0:s.primitives)!=null&&n.length)){if(this.isExpansion){let l=[1],c=t*2;o.primitives.forEach(u=>l.push(u.stroke(c,1,0)));let h=HP(l,r);if(h.items.length!==1)throw new Error("group.items.length !== 1 ");return[h.items[0].items[0]]}return[]}if(o=s,this.clearData(r),this.originalPrimitive=o.primitives,this.offsetDistance=t,this.createRawOffsetEdge(),this.drawDebug){let l=this.drawDebug.initColor(Vl.BLUE);this.rawOffsetPrimitive.forEach(c=>l.addPt(c)),this.drawDebug.draw();debugger}let a=e?this.createClippingEdge(r):[fe.build2(this.rawOffsetPrimitive)];if(this.drawDebug){let l=this.drawDebug.initColor(Vl.RED);a.forEach(c=>l.addPly(c)),this.drawDebug.draw();debugger}if(a.length&&(!this.isExpansion||this.isExpansion&&a.length>1)&&(a=this.getValidityPrimitive(a)),this.drawDebug){let l=this.drawDebug.initColor(Vl.GREEN);a.forEach(c=>l.addPly(c)),this.drawDebug.draw();debugger;throw new Error}return a}static getValidityPrimitive(o){let t=[],e=Math.abs(this.offsetDistance);for(let r=0;r<o.length;r+=1){let i=!0,n=o[r].primitives;e:for(let s=0;s<n.length;s+=1){let a=n[s],l;if(a instanceof q)l=a.midPoint;else if(a instanceof M)l=a.start();else throw new Error("not support!");for(let c=0;c<this.originalPrimitive.length;c+=1){let h=this.originalPrimitive[c],u;if(h instanceof q?u=this.pointArcClosest(l,h):u=_Qe(l,h.start(),h.end()).d,e-u>.01){i=!1;break e}}}i&&t.push(o[r])}return t}static getInters(o){let t=[];for(let e=0;e<o;e+=2)t.push(new S(Ke[e],Ke[e+1]));return t}static pointArcClosest(o,t){let e=t.center;if(o.equals1(t.center))return t.rx;if(t.inArea(o,0)){let n=o.sub(e);return Math.abs(n.length()-t.rx)}let r=o.distance2(t.start()),i=o.distance2(t.end());return mr.less(r,i)?Math.sqrt(r):Math.sqrt(i)}static createClippingEdge(o){let t=[],e=[],r=fv(fe.build2(this.rawOffsetPrimitive),o);r.forEach(n=>{let s=n.area(.01);t.push(s)});let i=Math.min(...t.filter(n=>n<0));for(let n=0;n<t.length;n+=1){let s=t[n];mr.eq(s,0)||(!this.isExpansion&&s<0||this.isExpansion&&(s<0&&t[n]===i||s>0))&&e.push(r[n])}return e}static createOffsetEdge(o){if(o instanceof q)return o.panDistance2(this.offsetDistance);if(o instanceof M)return o.panDistance(this.offsetDistance);throw new Error("not support!")}static connectPrimitive(o,t){o.offsetEdge instanceof M&&t.offsetEdge instanceof M?this.lineToLineConnect(o,t):o.offsetEdge instanceof q&&t.offsetEdge instanceof q?this.arcToArcConnect(o,t):o.offsetEdge instanceof M&&t.offsetEdge instanceof q?this.lineToArcConnect(o,t):this.arcToLineConnect(o,t)}static isFalseIntersection(o){return o>1||o<0}static lineToLineConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.originalPrimitive[n].start();if(e.isParallel(r))e.bbox().intersection1(r.bbox())?this.rawOffsetPrimitive.push(e):this.lineToLineUseArcToConnect(s,e,r,i);else{let a=this.getLineToLineT(e,r),l=a[0],c=a[1];if(this.isFalseIntersection(l)||this.isFalseIntersection(c))l>1&&this.isFalseIntersection(c)?this.lineToLineUseArcToConnect(s,e,r,i):this.useLineToConnect(e,r);else if(!this.isFalseIntersection(l)&&!this.isFalseIntersection(c)){let h=e.end().sub(e.start()),u=e.start().add(h.mul(l)),d=new M(e.start(),u);this.rawOffsetPrimitive.push(d);let p=new M(u,r.end());this.updateNextOffsetPrimitive(n,p)}}}static updateNextOffsetPrimitive(o,t){this.offsetPrimitive[o].offsetEdge=t}static useLineToConnect(o,t){this.rawOffsetPrimitive.push(o);let e=new M(o.end(),t.start());this.rawOffsetPrimitive.push(e)}static lineToLineUseArcToConnect(o,t,e,r){let i=this.getSweep(o,t,r),n=this.getSweepAngel(t.end(),e.start(),o,i);if(n===0){this.useLineToConnect(t,e);return}this.rawOffsetPrimitive.push(t);let s=q.build5(t.end(),e.start(),n);this.rawOffsetPrimitive.push(s)}static getSweep(o,t,e){let r=null,i=e||e===0?this.originalPrimitive[e]:t;if(i instanceof q){let n=i.center.sub(i.end()).normalize();i.isCCW?r=new S(n.y,-n.x):r=new S(-n.y,n.x)}else r=t.end().sub(t.start()).normalize();return o.sub(t.end()).normalize().cross(r)>0?0:1}static getLineToLineT(o,t){let e=o.end().sub(o.start()),r=t.end().sub(t.start()),i=e.cross(r),n=t.start().sub(o.start()),s=o.start().sub(t.start()),a=n.cross(r)/i,l=s.cross(e)/-i;return[a,l]}static lineToArcConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.getLineJoinArcScalarAndIntersectionNum(e,r),a=this.originalPrimitive[n].start();if(s.intersectionNum===0)this.lineAndArcUseArcConnect(a,e,r,i);else if(s.intersectionNum===1){let l=s.points[0];this.lineAndArcConnectionDetail(e,r,s.t[0],l,a,i,n)}else if(s.intersectionNum===2){let l=s.points[0],c=s.points[1],h=l.distance2(a),u=c.distance2(a);this.lineAndArcConnectionDetail(e,r,h<u?s.t[0]:s.t[1],h<u?l:c,a,i,n)}}static lineAndArcConnectionDetail(o,t,e,r,i,n,s){let a=this.isTrueArcIntersection(t,r);if(!this.isFalseIntersection(e)&&a){let l=new M(o.start(),r);this.rawOffsetPrimitive.push(l);let c;!t.center.equals1(r)||t.sweepAngle>1e-4?(c=q.build4(r,t.end(),t.center,t.rx,t.ry,t.sweep()),c instanceof q&&c.sweepAngle===0&&(c=new M(c.start(),c.end()))):c=new M(t.center,r),this.updateNextOffsetPrimitive(s,c)}else a?this.useLineToConnect(o,t):this.lineAndArcUseArcConnect(i,o,t,n)}static lineAndArcUseArcConnect(o,t,e,r){let i=this.getSweep(o,t,r),n=this.getSweepAngel(t.end(),e.start(),o,i);if(n===0){this.useLineToConnect(t,e);return}let s=q.build5(t.end(),e.start(),n);this.rawOffsetPrimitive.push(t),this.rawOffsetPrimitive.push(s)}static arcToLineConnectionDetail(o,t,e,r,i,n,s){let a=this.isTrueArcIntersection(o,r);if(!this.isFalseIntersection(e)&&a){let l;o.center.equals1(r)?l=new M(o.center,r):Math.abs(o.sweepAngle)<1e-4?l=new M(o.start(),r):(l=q.build4(o.start(),r,o.center,o.rx,o.ry,o.sweep()),l instanceof q&&l.sweepAngle===0&&(l=new M(l.start(),l.end()))),this.rawOffsetPrimitive.push(l);let c=new M(r,t.end());this.updateNextOffsetPrimitive(s,c)}else a?this.useLineToConnect(o,t):this.lineAndArcUseArcConnect(i,o,t,n)}static isTrueArcIntersection(o,t){return Gp(o,t)}static getSweepAngel(o,t,e,r){let i=o.angleD(e),n=t.angleD(e),s;return i===n?s=0:(i=To.regularD(i),n=To.regularD(n),r===1?n<=i&&(n+=360):n>=i&&(i+=360),s=n-i),s}static getLineJoinArcScalarAndIntersectionNum(o,t){let e={t:[],intersectionNum:0,points:[]},r=EQe(t,o);if(r){e.intersectionNum=r/2;for(let i=0;i<r-1;i+=2){let n=new S(Ke[i],Ke[i+1]);e.points.push(n),n.sub(o.start()).x<1e-4||n.sub(o.start()).y<1e-4?e.t.push(0):e.t.push(n.sub(o.start()).x/o.end().sub(o.start()).x)}}else e.intersectionNum=0;return e}static arcToLineConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.getLineJoinArcScalarAndIntersectionNum(r,e),a=this.originalPrimitive[n].start();if(s.intersectionNum===0)this.lineAndArcUseArcConnect(a,e,r,i);else if(s.intersectionNum===1){let l=s.points[0];this.arcToLineConnectionDetail(e,r,s.t[0],l,a,i,n)}else if(s.intersectionNum===2){let l=s.points[0],c=s.points[1],h=l.distance2(a),u=c.distance2(a);this.arcToLineConnectionDetail(e,r,h<u?s.t[0]:s.t[1],h<u?l:c,a,i,n)}}static rxChangeStatus(o){return o===1?!this.isExpansion:this.isExpansion}static arcToArcConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=Zve(e,r);if(i){let n=this.getInters(i),s;if(n.length===2){let c=this.originalPrimitive[t.index].start(),h=n[0],u=n[1],d=h.distance2(c),p=u.distance2(c);d<p?s=h:s=u}else s=n[0];let a,l;s.equals1(e.center)?a=new M(e.center,s):Math.abs(e.sweepAngle)<1e-4?a=new M(e.start(),s):(a=q.build4(e.start(),s,e.center,e.rx,e.ry,e.sweep()),a instanceof q&&a.sweepAngle===0&&(a=new M(a.start(),a.end()))),this.rawOffsetPrimitive.push(a),s.equals1(r.center)?l=new M(s,r.center):Math.abs(r.sweepAngle)<1e-4?l=new M(s,r.end()):(l=q.build4(s,r.end(),r.center,r.rx,r.ry,r.sweep()),l instanceof q&&l.sweepAngle===0&&(l=new M(l.start(),l.end()))),this.updateNextOffsetPrimitive(t.index,l)}else{let n=this.originalPrimitive[o.index],s=this.originalPrimitive[t.index],a=this.rxChangeStatus(n.sweep()),l=this.rxChangeStatus(s.sweep()),c=this.originalPrimitive[t.index].start(),h=this.getSweep(c,e,o.index),u=Math.abs(this.offsetDistance),d=q.build2(c,a?n.endAngle():n.endAngle()+180,l?s.startAngle:s.startAngle+180,u,u,h);this.rawOffsetPrimitive.push(e),this.rawOffsetPrimitive.push(d)}}};gy.originalPrimitive=[],gy.offsetPrimitive=[],gy.rawOffsetPrimitive=[],gy.testI=0;var $H=class GH extends Tl{constructor(t,e,r,i,n,s){if(super(),e<0||r<0)throw new Error("The width and height of rect can't be less than 0!");this.leftUpPoint=t,this.width=e,this.height=r,this.angle=i,this.isCCW=n,this.radius=Math.min(Math.max(s,0),e/2,r/2)}get radiusRatio(){return this.radius/Math.min(this.width,this.height)}start(){return this.leftUpPoint.add(new S(this.radius,0).multiply3(Qe.rotateD(this.angle)))}end(){return this.start()}getLeftPoint(){return this.leftUpPoint.add(new S(0,-this.height/2).multiply3(Qe.rotateD(this.angle)))}getRightPoint(){return this.leftUpPoint.add(new S(this.width,-this.height/2).multiply3(Qe.rotateD(this.angle)))}extend(t){return new GH(this.leftUpPoint.add(new S(-t,t).rotateD(S.ORIGIN,this.angle)),this.width+t*2,this.height+t*2,this.angle,this.isCCW,this.radius+t)}bbox(){let t=Qe.rotateD(this.angle),{leftUpPoint:e,width:r,height:i,radius:n}=this,s=e.add(new S(n,-n).multiply3(t)),a=e.add(new S(n,n-i).multiply3(t)),l=e.add(new S(r-n,-n).multiply3(t)),c=e.add(new S(r-n,n-i).multiply3(t));return new ut(Math.min(s.x,a.x,l.x,c.x)-n,Math.max(s.x,a.x,l.x,c.x)+n,Math.min(s.y,a.y,l.y,c.y)-n,Math.max(s.y,a.y,l.y,c.y)+n)}toPolyline(){let t=[],{leftUpPoint:e,width:r,height:i,radius:n}=this;if(n===0){let a=S.ORIGIN,l=new S(r,0),c=new S(r,-i),h=new S(0,-i);t.push(new M(a,l),new M(l,c),new M(c,h),new M(h,a))}else{let a=new S(0,-n),l=new S(n,0),c=new S(r-n,0),h=new S(r,-n),u=new S(r,n-i),d=new S(r-n,-i),p=new S(n,-i),m=new S(0,n-i);t.push(q.build1(a,l,n,n,!1,0),new M(l,c),q.build1(c,h,n,n,!1,0),new M(h,u),q.build1(u,d,n,n,!1,0),new M(d,p),q.build1(p,m,n,n,!1,0),new M(m,a))}t=t.filter(a=>!a.start().equals1(a.end())),this.isCCW&&(t.forEach((a,l)=>t[l]=a.reverse()),t.reverse());let s=Qe.rotateD(this.angle).translate1(e);return fe.build2(t.map(a=>a.multiply3(s)))}center(){return this.leftUpPoint.add1(this.width/2,this.height/2).rotateD(this.leftUpPoint,this.angle)}multiply3(t){let e=this.leftUpPoint.multiply3(t),r=new S(this.width,0).multiply3(Qe.rotateD(this.angle)).multiply3(t),i=new S(0,-this.height).multiply3(Qe.rotateD(this.angle)).multiply3(t);return t.isMirrored()?new GH(e,i.length(),r.length(),i.angleD(S.ORIGIN),this.isCCW===1?0:1,this.radius*r.length()/this.width):new GH(e,r.length(),i.length(),r.angleD(S.ORIGIN),this.isCCW,this.radius*r.length()/this.width)}reverse(){return new GH(this.leftUpPoint,this.width,this.height,this.angle,this.isCCW===1?0:1,this.radius)}stroke(t,e,r){let i=this.stroke1(t,e,r);if(i.length===1)return i[0];{let[n,s]=i;return fe.build2(n.primitives.concat(new M(n.primitives[0].start(),s.primitives[0].start()),s.primitives,new M(s.primitives[0].start(),n.primitives[0].start())))}}stroke1(t,e,r){let i=r===this.isCCW?this:this.reverse(),n=t/2,s=Math.min(i.width,i.height)/2,a=i.extend(n).toPolyline();return s<=n?[a]:[a,i.extend(-n).toPolyline().reverse()]}points(t){let e=this.toPolyline(),r=[];return e.points(t,i=>r.push(i)),r}toBezier(){throw new Error("Method not implemented.")}},Wet=.01,hs=class nS{static simplify(t){return t=Qf(t),t?new nS([t]):null}static buildByStroke(t,e,r=1,i=Q1e,n){if(t instanceof q&&(t.rx<e/2+Wet||Math.abs(t.sweepAngle)>180&&mr.lesseq(t.start().distance1(t.end()),e))){let a=fv(t.stroke(e,r,0),n);if(a.length===0)return null;if(a.length===1)return new nS(a);let l=[null],c=Number.POSITIVE_INFINITY;return a.forEach(h=>{let u=h.area(.1);u<0?u<c&&(l[0]=h,c=u):l.push(h)}),new nS(l)}else if(t instanceof $H){let a=t.stroke1(e,r,0).map(l=>Qf(l));return a[0]?a[1]?new nS(a):new nS([a[0]]):null}let s=t.stroke(e,r,0,i);return s?this.simplify(s):null}static buildCircle(t,e){return this.simplify(fe.build7([q.buildCircle(t,e,0)]))}static buildRect(t){return this.simplify(t.toPolyline())}static buildBBox(t){return this.simplify(fe.buildBBox(t,0))}constructor(t){this.items=t.slice()}multiply3(t){return new nS(this.items.map(e=>e.multiply3(t)))}bbox(){return this.items[0].bbox()}isEqual(t){return t instanceof nS?this.items.every(e=>t.items.some(r=>r.isEqual(e))):!1}getOutMostPolyline(){return this.items[0]}extend(t,e){if(this.items.length!==1)throw new Error("this.items.length !== 1");if(t===0)return new Jo([this]);let r=this.items[0],i=[];for(let h of r.primitives)if(h instanceof M)i.push(h);else if(h instanceof q&&h.rx===h.ry)s(h);else if(h instanceof Mr)n(h);else throw new Error("not support!");r=fe.build7(i);function n(h){let u=h.points(.1);for(let d=0;d<u.length-1;d++){let p=u[d],m=u[d+1];i.push(new M(p,m))}}function s(h){if(Math.abs(h.sweepAngle)>270){let u=h.sweepAngle/2;s(q.build3(h.center,h.startAngle,u,h.rx,h.ry)),s(q.build3(h.center,h.startAngle+u,u,h.rx,h.ry))}else i.push(h)}let a=[],l=[];gy.getExtendPolyLine(r,t,!0,e).forEach(h=>{(h.area(.1)>0?l:a).push(h)});let c;if(a.length===1)l.forEach(h=>a.push(h)),c=new Jo([new nS(a)]);else if(a.length===0)console.warn("outlines.length === 0"),c=new Jo([]);else if(l.length===0)c=new Jo(a.map(h=>new nS([h])));else{let h=a.map(u=>[u]);l.forEach(u=>{let d=[],p=u.bbox();if(h.forEach(m=>{m[0].bbox().isContainsBBox1(p)&&d.push(m)}),d.length===1)d[0].push(u);else{if(d.length===0)throw new Error("inPlsArr.length === 0");for(let m of d.sort((g,y)=>g[0].bbox().area()-y[0].bbox().area()))if(m[0].getWindingNum(u.start())===-1){m.push(u);break}}}),c=new Jo(h.map(u=>new nS(u)))}return c}toPolylineGroup(){return new Gt(this.items)}},Q9=class UH extends q{toTypeArc(t){return new UH(t.rx,t.ry,t.center,t.startAngle,t.sweepAngle)}constructor(t,e,r,i,n){super(t,e,r,i,n)}static build2(t,e,r,i,n,s){rl.positive(i),rl.positive(n),rl.normal(e),rl.normal(r);let a;return e===r?(e=To.regularD(e),r=To.regularD(r),a=0):(e=To.regularD(e),r=To.regularD(r),s===1?r<=e&&(r+=360):r>=e&&(e+=360),a=r-e),new UH(i,n,t,To.regularD(e),a)}static build3(t,e,r,i,n){return rl.positive(i),rl.positive(n),rl.normal(r),new UH(i,n,t,To.regularD(e),r)}static build4(t,e,r,i,n,s){let a=t.angleD(r),l=e.angleD(r);return UH.build2(r,a,l,i,n,s)}reverse(){return this.toTypeArc(super.reverse())}exchangeSweep(){return this.toTypeArc(super.exchangeSweep())}exchangeSweepAndStart(){return this.toTypeArc(super.exchangeSweepAndStart())}exchangeSweep1(){return this.toTypeArc(super.exchangeSweep1())}mirrorY(t){return this.toTypeArc(super.mirrorY(t))}mirror(t=S.ORIGIN){return this.toTypeArc(super.mirror(t))}multiply3(t){return this.toTypeArc(super.multiply3(t))}};var KH="#000000",kZ="default";var iye={mil:1,inch:1e3,ft:12e3,yard:36e3,mile:6336e4,km:3937007874e-2,dm:3937,mm:39.37,um:.039,nm:394e-7,pt:13.88888888888889,"px(72)":13.88888888888889,"px(96)":10.416666666666666,"px(100)":10},zet=(()=>{let o={};for(let t in iye)o[iye[t]]=t;return o})();function nye(o,t){return zet[o]||t}function bL(o,t){return iye[o]||t}var BZ=class BZ{constructor(t,e){this.ratio=t/e}wrap(t){return t*this.ratio}static convert(t,e,r){return t*e/r}};BZ.ASIS=new BZ(1,1);var Di=BZ;var Yet=Object.create,SDe=Object.defineProperty,jet=Object.getOwnPropertyDescriptor,Xet=Object.getOwnPropertyNames,qet=Object.getPrototypeOf,$et=Object.prototype.hasOwnProperty,FO=(o=>typeof wd<"u"?wd:typeof Proxy<"u"?new Proxy(o,{get:(t,e)=>(typeof wd<"u"?wd:t)[e]}):o)(function(o){if(typeof wd<"u")return wd.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')}),Xn=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),Ket=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xet(t))!$et.call(o,i)&&i!==e&&SDe(o,i,{get:()=>t[i],enumerable:!(r=jet(t,i))||r.enumerable});return o},EDe=(o,t,e)=>(e=o!=null?Yet(qet(o)):{},Ket(t||!o||!o.__esModule?SDe(e,"default",{value:o,enumerable:!0}):e,o)),JJ=Xn((o,t)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?t.exports={nextTick:e}:t.exports=process;function e(r,i,n,s){if(typeof r!="function")throw new TypeError('"callback" argument must be a function');var a=arguments.length,l,c;switch(a){case 0:case 1:return process.nextTick(r);case 2:return process.nextTick(function(){r.call(null,i)});case 3:return process.nextTick(function(){r.call(null,i,n)});case 4:return process.nextTick(function(){r.call(null,i,n,s)});default:for(l=new Array(a-1),c=0;c<l.length;)l[c++]=arguments[c];return process.nextTick(function(){r.apply(null,l)})}}}),Zet=Xn((o,t)=>{var e={}.toString;t.exports=Array.isArray||function(r){return e.call(r)=="[object Array]"}}),ODe=Xn((o,t)=>{t.exports=FO("stream")}),QJ=Xn((o,t)=>{var e=FO("buffer"),r=e.Buffer;function i(s,a){for(var l in s)a[l]=s[l]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=e:(i(e,o),o.Buffer=n);function n(s,a,l){return r(s,a,l)}i(r,n),n.from=function(s,a,l){if(typeof s=="number")throw new TypeError("Argument must not be a number");return r(s,a,l)},n.alloc=function(s,a,l){if(typeof s!="number")throw new TypeError("Argument must be a number");var c=r(s);return a!==void 0?typeof l=="string"?c.fill(a,l):c.fill(a):c.fill(0),c},n.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r(s)},n.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return e.SlowBuffer(s)}}),SW=Xn(o=>{function t(y){return Array.isArray?Array.isArray(y):g(y)==="[object Array]"}o.isArray=t;function e(y){return typeof y=="boolean"}o.isBoolean=e;function r(y){return y===null}o.isNull=r;function i(y){return y==null}o.isNullOrUndefined=i;function n(y){return typeof y=="number"}o.isNumber=n;function s(y){return typeof y=="string"}o.isString=s;function a(y){return typeof y=="symbol"}o.isSymbol=a;function l(y){return y===void 0}o.isUndefined=l;function c(y){return g(y)==="[object RegExp]"}o.isRegExp=c;function h(y){return typeof y=="object"&&y!==null}o.isObject=h;function u(y){return g(y)==="[object Date]"}o.isDate=u;function d(y){return g(y)==="[object Error]"||y instanceof Error}o.isError=d;function p(y){return typeof y=="function"}o.isFunction=p;function m(y){return y===null||typeof y=="boolean"||typeof y=="number"||typeof y=="string"||typeof y=="symbol"||typeof y>"u"}o.isPrimitive=m,o.isBuffer=FO("buffer").Buffer.isBuffer;function g(y){return Object.prototype.toString.call(y)}}),Jet=Xn((o,t)=>{typeof Object.create=="function"?t.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}}),EW=Xn((o,t)=>{try{if(e=FO("util"),typeof e.inherits!="function")throw"";t.exports=e.inherits}catch{t.exports=Jet()}var e}),Qet=Xn((o,t)=>{"use strict";function e(s,a){if(!(s instanceof a))throw new TypeError("Cannot call a class as a function")}var r=QJ().Buffer,i=FO("util");function n(s,a,l){s.copy(a,l)}t.exports=(function(){function s(){e(this,s),this.head=null,this.tail=null,this.length=0}return s.prototype.push=function(a){var l={data:a,next:null};this.length>0?this.tail.next=l:this.head=l,this.tail=l,++this.length},s.prototype.unshift=function(a){var l={data:a,next:this.head};this.length===0&&(this.tail=l),this.head=l,++this.length},s.prototype.shift=function(){if(this.length!==0){var a=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,a}},s.prototype.clear=function(){this.head=this.tail=null,this.length=0},s.prototype.join=function(a){if(this.length===0)return"";for(var l=this.head,c=""+l.data;l=l.next;)c+=a+l.data;return c},s.prototype.concat=function(a){if(this.length===0)return r.alloc(0);for(var l=r.allocUnsafe(a>>>0),c=this.head,h=0;c;)n(c.data,l,h),h+=c.data.length,c=c.next;return l},s})(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var s=i.inspect({length:this.length});return this.constructor.name+" "+s})}),ADe=Xn((o,t)=>{"use strict";var e=JJ();function r(s,a){var l=this,c=this._readableState&&this._readableState.destroyed,h=this._writableState&&this._writableState.destroyed;return c||h?(a?a(s):s&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(n,this,s)):e.nextTick(n,this,s)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(s||null,function(u){!a&&u?l._writableState?l._writableState.errorEmitted||(l._writableState.errorEmitted=!0,e.nextTick(n,l,u)):e.nextTick(n,l,u):a&&a(u)}),this)}function i(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function n(s,a){s.emit("error",a)}t.exports={destroy:r,undestroy:i}}),ett=Xn((o,t)=>{t.exports=FO("util").deprecate}),_De=Xn((o,t)=>{"use strict";var e=JJ();t.exports=b;function r(B){var N=this;this.next=null,this.entry=null,this.finish=function(){L(N,B)}}var i=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:e.nextTick,n;b.WritableState=g;var s=Object.create(SW());s.inherits=EW();var a={deprecate:ett()},l=ODe(),c=QJ().Buffer,h=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function u(B){return c.from(B)}function d(B){return c.isBuffer(B)||B instanceof h}var p=ADe();s.inherits(b,l);function m(){}function g(B,N){n=n||ok(),B=B||{};var U=N instanceof n;this.objectMode=!!B.objectMode,U&&(this.objectMode=this.objectMode||!!B.writableObjectMode);var k=B.highWaterMark,V=B.writableHighWaterMark,Y=this.objectMode?16:16*1024;k||k===0?this.highWaterMark=k:U&&(V||V===0)?this.highWaterMark=V:this.highWaterMark=Y,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var X=B.decodeStrings===!1;this.decodeStrings=!X,this.defaultEncoding=B.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Z){R(N,Z)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}g.prototype.getBuffer=function(){for(var B=this.bufferedRequest,N=[];B;)N.push(B),B=B.next;return N},(function(){try{Object.defineProperty(g.prototype,"buffer",{get:a.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var y;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(y=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(B){return y.call(this,B)?!0:this!==b?!1:B&&B._writableState instanceof g}})):y=function(B){return B instanceof this};function b(B){if(n=n||ok(),!y.call(b,this)&&!(this instanceof n))return new b(B);this._writableState=new g(B,this),this.writable=!0,B&&(typeof B.write=="function"&&(this._write=B.write),typeof B.writev=="function"&&(this._writev=B.writev),typeof B.destroy=="function"&&(this._destroy=B.destroy),typeof B.final=="function"&&(this._final=B.final)),l.call(this)}b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function P(B,N){var U=new Error("write after end");B.emit("error",U),e.nextTick(N,U)}function T(B,N,U,k){var V=!0,Y=!1;return U===null?Y=new TypeError("May not write null values to stream"):typeof U!="string"&&U!==void 0&&!N.objectMode&&(Y=new TypeError("Invalid non-string/buffer chunk")),Y&&(B.emit("error",Y),e.nextTick(k,Y),V=!1),V}b.prototype.write=function(B,N,U){var k=this._writableState,V=!1,Y=!k.objectMode&&d(B);return Y&&!c.isBuffer(B)&&(B=u(B)),typeof N=="function"&&(U=N,N=null),Y?N="buffer":N||(N=k.defaultEncoding),typeof U!="function"&&(U=m),k.ended?P(this,U):(Y||T(this,k,B,U))&&(k.pendingcb++,V=C(this,k,Y,B,N,U)),V},b.prototype.cork=function(){var B=this._writableState;B.corked++},b.prototype.uncork=function(){var B=this._writableState;B.corked&&(B.corked--,!B.writing&&!B.corked&&!B.bufferProcessing&&B.bufferedRequest&&w(this,B))},b.prototype.setDefaultEncoding=function(B){if(typeof B=="string"&&(B=B.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((B+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+B);return this._writableState.defaultEncoding=B,this};function I(B,N,U){return!B.objectMode&&B.decodeStrings!==!1&&typeof N=="string"&&(N=c.from(N,U)),N}Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function C(B,N,U,k,V,Y){if(!U){var X=I(N,k,V);k!==X&&(U=!0,V="buffer",k=X)}var Z=N.objectMode?1:k.length;N.length+=Z;var Q=N.length<N.highWaterMark;if(Q||(N.needDrain=!0),N.writing||N.corked){var ae=N.lastBufferedRequest;N.lastBufferedRequest={chunk:k,encoding:V,isBuf:U,callback:Y,next:null},ae?ae.next=N.lastBufferedRequest:N.bufferedRequest=N.lastBufferedRequest,N.bufferedRequestCount+=1}else E(B,N,!1,Z,k,V,Y);return Q}function E(B,N,U,k,V,Y,X){N.writelen=k,N.writecb=X,N.writing=!0,N.sync=!0,U?B._writev(V,N.onwrite):B._write(V,Y,N.onwrite),N.sync=!1}function O(B,N,U,k,V){--N.pendingcb,U?(e.nextTick(V,k),e.nextTick(G,B,N),B._writableState.errorEmitted=!0,B.emit("error",k)):(V(k),B._writableState.errorEmitted=!0,B.emit("error",k),G(B,N))}function _(B){B.writing=!1,B.writecb=null,B.length-=B.writelen,B.writelen=0}function R(B,N){var U=B._writableState,k=U.sync,V=U.writecb;if(_(U),N)O(B,U,k,N,V);else{var Y=F(U);!Y&&!U.corked&&!U.bufferProcessing&&U.bufferedRequest&&w(B,U),k?i(v,B,U,Y,V):v(B,U,Y,V)}}function v(B,N,U,k){U||D(B,N),N.pendingcb--,k(),G(B,N)}function D(B,N){N.length===0&&N.needDrain&&(N.needDrain=!1,B.emit("drain"))}function w(B,N){N.bufferProcessing=!0;var U=N.bufferedRequest;if(B._writev&&U&&U.next){var k=N.bufferedRequestCount,V=new Array(k),Y=N.corkedRequestsFree;Y.entry=U;for(var X=0,Z=!0;U;)V[X]=U,U.isBuf||(Z=!1),U=U.next,X+=1;V.allBuffers=Z,E(B,N,!0,N.length,V,"",Y.finish),N.pendingcb++,N.lastBufferedRequest=null,Y.next?(N.corkedRequestsFree=Y.next,Y.next=null):N.corkedRequestsFree=new r(N),N.bufferedRequestCount=0}else{for(;U;){var Q=U.chunk,ae=U.encoding,he=U.callback,re=N.objectMode?1:Q.length;if(E(B,N,!1,re,Q,ae,he),U=U.next,N.bufferedRequestCount--,N.writing)break}U===null&&(N.lastBufferedRequest=null)}N.bufferedRequest=U,N.bufferProcessing=!1}b.prototype._write=function(B,N,U){U(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(B,N,U){var k=this._writableState;typeof B=="function"?(U=B,B=null,N=null):typeof N=="function"&&(U=N,N=null),B!=null&&this.write(B,N),k.corked&&(k.corked=1,this.uncork()),k.ending||W(this,k,U)};function F(B){return B.ending&&B.length===0&&B.bufferedRequest===null&&!B.finished&&!B.writing}function H(B,N){B._final(function(U){N.pendingcb--,U&&B.emit("error",U),N.prefinished=!0,B.emit("prefinish"),G(B,N)})}function z(B,N){!N.prefinished&&!N.finalCalled&&(typeof B._final=="function"?(N.pendingcb++,N.finalCalled=!0,e.nextTick(H,B,N)):(N.prefinished=!0,B.emit("prefinish")))}function G(B,N){var U=F(N);return U&&(z(B,N),N.pendingcb===0&&(N.finished=!0,B.emit("finish"))),U}function W(B,N,U){N.ending=!0,G(B,N),U&&(N.finished?e.nextTick(U):B.once("finish",U)),N.ended=!0,B.writable=!1}function L(B,N,U){var k=B.entry;for(B.entry=null;k;){var V=k.callback;N.pendingcb--,V(U),k=k.next}N.corkedRequestsFree.next=B}Object.defineProperty(b.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(B){this._writableState&&(this._writableState.destroyed=B)}}),b.prototype.destroy=p.destroy,b.prototype._undestroy=p.undestroy,b.prototype._destroy=function(B,N){this.end(),N(B)}}),ok=Xn((o,t)=>{"use strict";var e=JJ(),r=Object.keys||function(p){var m=[];for(var g in p)m.push(g);return m};t.exports=h;var i=Object.create(SW());i.inherits=EW();var n=vDe(),s=_De();for(i.inherits(h,n),a=r(s.prototype),c=0;c<a.length;c++)l=a[c],h.prototype[l]||(h.prototype[l]=s.prototype[l]);var a,l,c;function h(p){if(!(this instanceof h))return new h(p);n.call(this,p),s.call(this,p),p&&p.readable===!1&&(this.readable=!1),p&&p.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,p&&p.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",u)}Object.defineProperty(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function u(){this.allowHalfOpen||this._writableState.ended||e.nextTick(d,this)}function d(p){p.end()}Object.defineProperty(h.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(p){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=p,this._writableState.destroyed=p)}}),h.prototype._destroy=function(p,m){this.push(null),this.end(),e.nextTick(m,p)}}),Ixe=Xn(o=>{"use strict";var t=QJ().Buffer,e=t.isEncoding||function(P){switch(P=""+P,P&&P.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(P){if(!P)return"utf8";for(var T;;)switch(P){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return P;default:if(T)return;P=(""+P).toLowerCase(),T=!0}}function i(P){var T=r(P);if(typeof T!="string"&&(t.isEncoding===e||!e(P)))throw new Error("Unknown encoding: "+P);return T||P}o.StringDecoder=n;function n(P){this.encoding=i(P);var T;switch(this.encoding){case"utf16le":this.text=d,this.end=p,T=4;break;case"utf8":this.fillLast=c,T=4;break;case"base64":this.text=m,this.end=g,T=3;break;default:this.write=y,this.end=b;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(T)}n.prototype.write=function(P){if(P.length===0)return"";var T,I;if(this.lastNeed){if(T=this.fillLast(P),T===void 0)return"";I=this.lastNeed,this.lastNeed=0}else I=0;return I<P.length?T?T+this.text(P,I):this.text(P,I):T||""},n.prototype.end=u,n.prototype.text=h,n.prototype.fillLast=function(P){if(this.lastNeed<=P.length)return P.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);P.copy(this.lastChar,this.lastTotal-this.lastNeed,0,P.length),this.lastNeed-=P.length};function s(P){return P<=127?0:P>>5===6?2:P>>4===14?3:P>>3===30?4:P>>6===2?-1:-2}function a(P,T,I){var C=T.length-1;if(C<I)return 0;var E=s(T[C]);return E>=0?(E>0&&(P.lastNeed=E-1),E):--C<I||E===-2?0:(E=s(T[C]),E>=0?(E>0&&(P.lastNeed=E-2),E):--C<I||E===-2?0:(E=s(T[C]),E>=0?(E>0&&(E===2?E=0:P.lastNeed=E-3),E):0))}function l(P,T,I){if((T[0]&192)!==128)return P.lastNeed=0,"\uFFFD";if(P.lastNeed>1&&T.length>1){if((T[1]&192)!==128)return P.lastNeed=1,"\uFFFD";if(P.lastNeed>2&&T.length>2&&(T[2]&192)!==128)return P.lastNeed=2,"\uFFFD"}}function c(P){var T=this.lastTotal-this.lastNeed,I=l(this,P,T);if(I!==void 0)return I;if(this.lastNeed<=P.length)return P.copy(this.lastChar,T,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);P.copy(this.lastChar,T,0,P.length),this.lastNeed-=P.length}function h(P,T){var I=a(this,P,T);if(!this.lastNeed)return P.toString("utf8",T);this.lastTotal=I;var C=P.length-(I-this.lastNeed);return P.copy(this.lastChar,0,C),P.toString("utf8",T,C)}function u(P){var T=P&&P.length?this.write(P):"";return this.lastNeed?T+"\uFFFD":T}function d(P,T){if((P.length-T)%2===0){var I=P.toString("utf16le",T);if(I){var C=I.charCodeAt(I.length-1);if(C>=55296&&C<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=P[P.length-2],this.lastChar[1]=P[P.length-1],I.slice(0,-1)}return I}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=P[P.length-1],P.toString("utf16le",T,P.length-1)}function p(P){var T=P&&P.length?this.write(P):"";if(this.lastNeed){var I=this.lastTotal-this.lastNeed;return T+this.lastChar.toString("utf16le",0,I)}return T}function m(P,T){var I=(P.length-T)%3;return I===0?P.toString("base64",T):(this.lastNeed=3-I,this.lastTotal=3,I===1?this.lastChar[0]=P[P.length-1]:(this.lastChar[0]=P[P.length-2],this.lastChar[1]=P[P.length-1]),P.toString("base64",T,P.length-I))}function g(P){var T=P&&P.length?this.write(P):"";return this.lastNeed?T+this.lastChar.toString("base64",0,3-this.lastNeed):T}function y(P){return P.toString(this.encoding)}function b(P){return P&&P.length?this.write(P):""}}),vDe=Xn((o,t)=>{"use strict";var e=JJ();t.exports=C;var r=Zet(),i;C.ReadableState=I;var n=FO("events").EventEmitter,s=function(re,se){return re.listeners(se).length},a=ODe(),l=QJ().Buffer,c=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function h(re){return l.from(re)}function u(re){return l.isBuffer(re)||re instanceof c}var d=Object.create(SW());d.inherits=EW();var p=FO("util"),m=void 0;p&&p.debuglog?m=p.debuglog("stream"):m=function(){};var g=Qet(),y=ADe(),b;d.inherits(C,a);var P=["error","close","destroy","pause","resume"];function T(re,se,K){if(typeof re.prependListener=="function")return re.prependListener(se,K);!re._events||!re._events[se]?re.on(se,K):r(re._events[se])?re._events[se].unshift(K):re._events[se]=[K,re._events[se]]}function I(re,se){i=i||ok(),re=re||{};var K=se instanceof i;this.objectMode=!!re.objectMode,K&&(this.objectMode=this.objectMode||!!re.readableObjectMode);var me=re.highWaterMark,Oe=re.readableHighWaterMark,Ie=this.objectMode?16:16*1024;me||me===0?this.highWaterMark=me:K&&(Oe||Oe===0)?this.highWaterMark=Oe:this.highWaterMark=Ie,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=re.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,re.encoding&&(b||(b=Ixe().StringDecoder),this.decoder=new b(re.encoding),this.encoding=re.encoding)}function C(re){if(i=i||ok(),!(this instanceof C))return new C(re);this._readableState=new I(re,this),this.readable=!0,re&&(typeof re.read=="function"&&(this._read=re.read),typeof re.destroy=="function"&&(this._destroy=re.destroy)),a.call(this)}Object.defineProperty(C.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(re){this._readableState&&(this._readableState.destroyed=re)}}),C.prototype.destroy=y.destroy,C.prototype._undestroy=y.undestroy,C.prototype._destroy=function(re,se){this.push(null),se(re)},C.prototype.push=function(re,se){var K=this._readableState,me;return K.objectMode?me=!0:typeof re=="string"&&(se=se||K.defaultEncoding,se!==K.encoding&&(re=l.from(re,se),se=""),me=!0),E(this,re,se,!1,me)},C.prototype.unshift=function(re){return E(this,re,null,!0,!1)};function E(re,se,K,me,Oe){var Ie=re._readableState;if(se===null)Ie.reading=!1,F(re,Ie);else{var ue;Oe||(ue=_(Ie,se)),ue?re.emit("error",ue):Ie.objectMode||se&&se.length>0?(typeof se!="string"&&!Ie.objectMode&&Object.getPrototypeOf(se)!==l.prototype&&(se=h(se)),me?Ie.endEmitted?re.emit("error",new Error("stream.unshift() after end event")):O(re,Ie,se,!0):Ie.ended?re.emit("error",new Error("stream.push() after EOF")):(Ie.reading=!1,Ie.decoder&&!K?(se=Ie.decoder.write(se),Ie.objectMode||se.length!==0?O(re,Ie,se,!1):G(re,Ie)):O(re,Ie,se,!1))):me||(Ie.reading=!1)}return R(Ie)}function O(re,se,K,me){se.flowing&&se.length===0&&!se.sync?(re.emit("data",K),re.read(0)):(se.length+=se.objectMode?1:K.length,me?se.buffer.unshift(K):se.buffer.push(K),se.needReadable&&H(re)),G(re,se)}function _(re,se){var K;return!u(se)&&typeof se!="string"&&se!==void 0&&!re.objectMode&&(K=new TypeError("Invalid non-string/buffer chunk")),K}function R(re){return!re.ended&&(re.needReadable||re.length<re.highWaterMark||re.length===0)}C.prototype.isPaused=function(){return this._readableState.flowing===!1},C.prototype.setEncoding=function(re){return b||(b=Ixe().StringDecoder),this._readableState.decoder=new b(re),this._readableState.encoding=re,this};var v=8388608;function D(re){return re>=v?re=v:(re--,re|=re>>>1,re|=re>>>2,re|=re>>>4,re|=re>>>8,re|=re>>>16,re++),re}function w(re,se){return re<=0||se.length===0&&se.ended?0:se.objectMode?1:re!==re?se.flowing&&se.length?se.buffer.head.data.length:se.length:(re>se.highWaterMark&&(se.highWaterMark=D(re)),re<=se.length?re:se.ended?se.length:(se.needReadable=!0,0))}C.prototype.read=function(re){m("read",re),re=parseInt(re,10);var se=this._readableState,K=re;if(re!==0&&(se.emittedReadable=!1),re===0&&se.needReadable&&(se.length>=se.highWaterMark||se.ended))return m("read: emitReadable",se.length,se.ended),se.length===0&&se.ended?Q(this):H(this),null;if(re=w(re,se),re===0&&se.ended)return se.length===0&&Q(this),null;var me=se.needReadable;m("need readable",me),(se.length===0||se.length-re<se.highWaterMark)&&(me=!0,m("length less than watermark",me)),se.ended||se.reading?(me=!1,m("reading or ended",me)):me&&(m("do read"),se.reading=!0,se.sync=!0,se.length===0&&(se.needReadable=!0),this._read(se.highWaterMark),se.sync=!1,se.reading||(re=w(K,se)));var Oe;return re>0?Oe=V(re,se):Oe=null,Oe===null?(se.needReadable=!0,re=0):se.length-=re,se.length===0&&(se.ended||(se.needReadable=!0),K!==re&&se.ended&&Q(this)),Oe!==null&&this.emit("data",Oe),Oe};function F(re,se){if(!se.ended){if(se.decoder){var K=se.decoder.end();K&&K.length&&(se.buffer.push(K),se.length+=se.objectMode?1:K.length)}se.ended=!0,H(re)}}function H(re){var se=re._readableState;se.needReadable=!1,se.emittedReadable||(m("emitReadable",se.flowing),se.emittedReadable=!0,se.sync?e.nextTick(z,re):z(re))}function z(re){m("emit readable"),re.emit("readable"),k(re)}function G(re,se){se.readingMore||(se.readingMore=!0,e.nextTick(W,re,se))}function W(re,se){for(var K=se.length;!se.reading&&!se.flowing&&!se.ended&&se.length<se.highWaterMark&&(m("maybeReadMore read 0"),re.read(0),K!==se.length);)K=se.length;se.readingMore=!1}C.prototype._read=function(re){this.emit("error",new Error("_read() is not implemented"))},C.prototype.pipe=function(re,se){var K=this,me=this._readableState;switch(me.pipesCount){case 0:me.pipes=re;break;case 1:me.pipes=[me.pipes,re];break;default:me.pipes.push(re);break}me.pipesCount+=1,m("pipe count=%d opts=%j",me.pipesCount,se);var Oe=(!se||se.end!==!1)&&re!==process.stdout&&re!==process.stderr,Ie=Oe?Pe:Ze;me.endEmitted?e.nextTick(Ie):K.once("end",Ie),re.on("unpipe",ue);function ue(Wt,Nr){m("onunpipe"),Wt===K&&Nr&&Nr.hasUnpiped===!1&&(Nr.hasUnpiped=!0,oe())}function Pe(){m("onend"),re.end()}var j=L(K);re.on("drain",j);var J=!1;function oe(){m("cleanup"),re.removeListener("close",De),re.removeListener("finish",tt),re.removeListener("drain",j),re.removeListener("error",Se),re.removeListener("unpipe",ue),K.removeListener("end",Pe),K.removeListener("end",Ze),K.removeListener("data",ge),J=!0,me.awaitDrain&&(!re._writableState||re._writableState.needDrain)&&j()}var pe=!1;K.on("data",ge);function ge(Wt){m("ondata"),pe=!1;var Nr=re.write(Wt);Nr===!1&&!pe&&((me.pipesCount===1&&me.pipes===re||me.pipesCount>1&&he(me.pipes,re)!==-1)&&!J&&(m("false write response, pause",me.awaitDrain),me.awaitDrain++,pe=!0),K.pause())}function Se(Wt){m("onerror",Wt),Ze(),re.removeListener("error",Se),s(re,"error")===0&&re.emit("error",Wt)}T(re,"error",Se);function De(){re.removeListener("finish",tt),Ze()}re.once("close",De);function tt(){m("onfinish"),re.removeListener("close",De),Ze()}re.once("finish",tt);function Ze(){m("unpipe"),K.unpipe(re)}return re.emit("pipe",K),me.flowing||(m("pipe resume"),K.resume()),re};function L(re){return function(){var se=re._readableState;m("pipeOnDrain",se.awaitDrain),se.awaitDrain&&se.awaitDrain--,se.awaitDrain===0&&s(re,"data")&&(se.flowing=!0,k(re))}}C.prototype.unpipe=function(re){var se=this._readableState,K={hasUnpiped:!1};if(se.pipesCount===0)return this;if(se.pipesCount===1)return re&&re!==se.pipes?this:(re||(re=se.pipes),se.pipes=null,se.pipesCount=0,se.flowing=!1,re&&re.emit("unpipe",this,K),this);if(!re){var me=se.pipes,Oe=se.pipesCount;se.pipes=null,se.pipesCount=0,se.flowing=!1;for(var Ie=0;Ie<Oe;Ie++)me[Ie].emit("unpipe",this,{hasUnpiped:!1});return this}var ue=he(se.pipes,re);return ue===-1?this:(se.pipes.splice(ue,1),se.pipesCount-=1,se.pipesCount===1&&(se.pipes=se.pipes[0]),re.emit("unpipe",this,K),this)},C.prototype.on=function(re,se){var K=a.prototype.on.call(this,re,se);if(re==="data")this._readableState.flowing!==!1&&this.resume();else if(re==="readable"){var me=this._readableState;!me.endEmitted&&!me.readableListening&&(me.readableListening=me.needReadable=!0,me.emittedReadable=!1,me.reading?me.length&&H(this):e.nextTick(B,this))}return K},C.prototype.addListener=C.prototype.on;function B(re){m("readable nexttick read 0"),re.read(0)}C.prototype.resume=function(){var re=this._readableState;return re.flowing||(m("resume"),re.flowing=!0,N(this,re)),this};function N(re,se){se.resumeScheduled||(se.resumeScheduled=!0,e.nextTick(U,re,se))}function U(re,se){se.reading||(m("resume read 0"),re.read(0)),se.resumeScheduled=!1,se.awaitDrain=0,re.emit("resume"),k(re),se.flowing&&!se.reading&&re.read(0)}C.prototype.pause=function(){return m("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(m("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function k(re){var se=re._readableState;for(m("flow",se.flowing);se.flowing&&re.read()!==null;);}C.prototype.wrap=function(re){var se=this,K=this._readableState,me=!1;re.on("end",function(){if(m("wrapped end"),K.decoder&&!K.ended){var ue=K.decoder.end();ue&&ue.length&&se.push(ue)}se.push(null)}),re.on("data",function(ue){if(m("wrapped data"),K.decoder&&(ue=K.decoder.write(ue)),!(K.objectMode&&ue==null)&&!(!K.objectMode&&(!ue||!ue.length))){var Pe=se.push(ue);Pe||(me=!0,re.pause())}});for(var Oe in re)this[Oe]===void 0&&typeof re[Oe]=="function"&&(this[Oe]=(function(ue){return function(){return re[ue].apply(re,arguments)}})(Oe));for(var Ie=0;Ie<P.length;Ie++)re.on(P[Ie],this.emit.bind(this,P[Ie]));return this._read=function(ue){m("wrapped _read",ue),me&&(me=!1,re.resume())},this},Object.defineProperty(C.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),C._fromList=V;function V(re,se){if(se.length===0)return null;var K;return se.objectMode?K=se.buffer.shift():!re||re>=se.length?(se.decoder?K=se.buffer.join(""):se.buffer.length===1?K=se.buffer.head.data:K=se.buffer.concat(se.length),se.buffer.clear()):K=Y(re,se.buffer,se.decoder),K}function Y(re,se,K){var me;return re<se.head.data.length?(me=se.head.data.slice(0,re),se.head.data=se.head.data.slice(re)):re===se.head.data.length?me=se.shift():me=K?X(re,se):Z(re,se),me}function X(re,se){var K=se.head,me=1,Oe=K.data;for(re-=Oe.length;K=K.next;){var Ie=K.data,ue=re>Ie.length?Ie.length:re;if(ue===Ie.length?Oe+=Ie:Oe+=Ie.slice(0,re),re-=ue,re===0){ue===Ie.length?(++me,K.next?se.head=K.next:se.head=se.tail=null):(se.head=K,K.data=Ie.slice(ue));break}++me}return se.length-=me,Oe}function Z(re,se){var K=l.allocUnsafe(re),me=se.head,Oe=1;for(me.data.copy(K),re-=me.data.length;me=me.next;){var Ie=me.data,ue=re>Ie.length?Ie.length:re;if(Ie.copy(K,K.length-re,0,ue),re-=ue,re===0){ue===Ie.length?(++Oe,me.next?se.head=me.next:se.head=se.tail=null):(se.head=me,me.data=Ie.slice(ue));break}++Oe}return se.length-=Oe,K}function Q(re){var se=re._readableState;if(se.length>0)throw new Error('"endReadable()" called on non-empty stream');se.endEmitted||(se.ended=!0,e.nextTick(ae,se,re))}function ae(re,se){!re.endEmitted&&re.length===0&&(re.endEmitted=!0,se.readable=!1,se.emit("end"))}function he(re,se){for(var K=0,me=re.length;K<me;K++)if(re[K]===se)return K;return-1}}),xDe=Xn((o,t)=>{"use strict";t.exports=n;var e=ok(),r=Object.create(SW());r.inherits=EW(),r.inherits(n,e);function i(l,c){var h=this._transformState;h.transforming=!1;var u=h.writecb;if(!u)return this.emit("error",new Error("write callback called multiple times"));h.writechunk=null,h.writecb=null,c!=null&&this.push(c),u(l);var d=this._readableState;d.reading=!1,(d.needReadable||d.length<d.highWaterMark)&&this._read(d.highWaterMark)}function n(l){if(!(this instanceof n))return new n(l);e.call(this,l),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,l&&(typeof l.transform=="function"&&(this._transform=l.transform),typeof l.flush=="function"&&(this._flush=l.flush)),this.on("prefinish",s)}function s(){var l=this;typeof this._flush=="function"?this._flush(function(c,h){a(l,c,h)}):a(this,null,null)}n.prototype.push=function(l,c){return this._transformState.needTransform=!1,e.prototype.push.call(this,l,c)},n.prototype._transform=function(l,c,h){throw new Error("_transform() is not implemented")},n.prototype._write=function(l,c,h){var u=this._transformState;if(u.writecb=h,u.writechunk=l,u.writeencoding=c,!u.transforming){var d=this._readableState;(u.needTransform||d.needReadable||d.length<d.highWaterMark)&&this._read(d.highWaterMark)}},n.prototype._read=function(l){var c=this._transformState;c.writechunk!==null&&c.writecb&&!c.transforming?(c.transforming=!0,this._transform(c.writechunk,c.writeencoding,c.afterTransform)):c.needTransform=!0},n.prototype._destroy=function(l,c){var h=this;e.prototype._destroy.call(this,l,function(u){c(u),h.emit("close")})};function a(l,c,h){if(c)return l.emit("error",c);if(h!=null&&l.push(h),l._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(l._transformState.transforming)throw new Error("Calling transform done when still transforming");return l.push(null)}}),ttt=Xn((o,t)=>{"use strict";t.exports=i;var e=xDe(),r=Object.create(SW());r.inherits=EW(),r.inherits(i,e);function i(n){if(!(this instanceof i))return new i(n);e.call(this,n)}i.prototype._transform=function(n,s,a){a(null,n)}}),RDe=Xn((o,t)=>{var e=FO("stream");process.env.READABLE_STREAM==="disable"&&e?(t.exports=e,o=t.exports=e.Readable,o.Readable=e.Readable,o.Writable=e.Writable,o.Duplex=e.Duplex,o.Transform=e.Transform,o.PassThrough=e.PassThrough,o.Stream=e):(o=t.exports=vDe(),o.Stream=e||o,o.Readable=o,o.Writable=_De(),o.Duplex=ok(),o.Transform=xDe(),o.PassThrough=ttt())}),Lv=Xn(o=>{"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{t=new ArrayBuffer(0);try{o.blob=new Blob([t],{type:"application/zip"}).size===0}catch{try{e=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,r=new e,r.append(t),o.blob=r.getBlob("application/zip").size===0}catch{o.blob=!1}}}var t,e,r;try{o.nodestream=!!RDe().Readable}catch{o.nodestream=!1}}),DDe=Xn(o=>{"use strict";var t=W0(),e=Lv(),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(i){for(var n=[],s,a,l,c,h,u,d,p=0,m=i.length,g=m,y=t.getTypeOf(i)!=="string";p<i.length;)g=m-p,y?(s=i[p++],a=p<m?i[p++]:0,l=p<m?i[p++]:0):(s=i.charCodeAt(p++),a=p<m?i.charCodeAt(p++):0,l=p<m?i.charCodeAt(p++):0),c=s>>2,h=(s&3)<<4|a>>4,u=g>1?(a&15)<<2|l>>6:64,d=g>2?l&63:64,n.push(r.charAt(c)+r.charAt(h)+r.charAt(u)+r.charAt(d));return n.join("")},o.decode=function(i){var n,s,a,l,c,h,u,d=0,p=0,m="data:";if(i.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");i=i.replace(/[^A-Za-z0-9+/=]/g,"");var g=i.length*3/4;if(i.charAt(i.length-1)===r.charAt(64)&&g--,i.charAt(i.length-2)===r.charAt(64)&&g--,g%1!==0)throw new Error("Invalid base64 input, bad content length.");var y;for(e.uint8array?y=new Uint8Array(g|0):y=new Array(g|0);d<i.length;)l=r.indexOf(i.charAt(d++)),c=r.indexOf(i.charAt(d++)),h=r.indexOf(i.charAt(d++)),u=r.indexOf(i.charAt(d++)),n=l<<2|c>>4,s=(c&15)<<4|h>>2,a=(h&3)<<6|u,y[p++]=n,h!==64&&(y[p++]=s),u!==64&&(y[p++]=a);return y}}),eQ=Xn((o,t)=>{"use strict";t.exports={isNode:typeof Buffer<"u",newBufferFrom:function(e,r){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,r);if(typeof e=="number")throw new Error('The "data" argument must not be a number');return new Buffer(e,r)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var r=new Buffer(e);return r.fill(0),r},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&typeof e.on=="function"&&typeof e.pause=="function"&&typeof e.resume=="function"}}}),rtt=Xn((o,t)=>{"use strict";var e=global.MutationObserver||global.WebKitMutationObserver,r;process.browser?e?(i=0,n=new e(h),s=global.document.createTextNode(""),n.observe(s,{characterData:!0}),r=function(){s.data=i=++i%2}):!global.setImmediate&&typeof global.MessageChannel<"u"?(a=new global.MessageChannel,a.port1.onmessage=h,r=function(){a.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?r=function(){var d=global.document.createElement("script");d.onreadystatechange=function(){h(),d.onreadystatechange=null,d.parentNode.removeChild(d),d=null},global.document.documentElement.appendChild(d)}:r=function(){setTimeout(h,0)}:r=function(){process.nextTick(h)};var i,n,s,a,l,c=[];function h(){l=!0;for(var d,p,m=c.length;m;){for(p=c,c=[],d=-1;++d<m;)p[d]();m=c.length}l=!1}t.exports=u;function u(d){c.push(d)===1&&!l&&r()}}),itt=Xn((o,t)=>{"use strict";var e=rtt();function r(){}var i={},n=["REJECTED"],s=["FULFILLED"],a=["PENDING"];process.browser||(l=["UNHANDLED"]);var l;t.exports=c;function c(T){if(typeof T!="function")throw new TypeError("resolver must be a function");this.state=a,this.queue=[],this.outcome=void 0,process.browser||(this.handled=l),T!==r&&p(this,T)}c.prototype.finally=function(T){if(typeof T!="function")return this;var I=this.constructor;return this.then(C,E);function C(O){function _(){return O}return I.resolve(T()).then(_)}function E(O){function _(){throw O}return I.resolve(T()).then(_)}},c.prototype.catch=function(T){return this.then(null,T)},c.prototype.then=function(T,I){if(typeof T!="function"&&this.state===s||typeof I!="function"&&this.state===n)return this;var C=new this.constructor(r);if(process.browser||this.handled===l&&(this.handled=null),this.state!==a){var E=this.state===s?T:I;u(C,E,this.outcome)}else this.queue.push(new h(C,T,I));return C};function h(T,I,C){this.promise=T,typeof I=="function"&&(this.onFulfilled=I,this.callFulfilled=this.otherCallFulfilled),typeof C=="function"&&(this.onRejected=C,this.callRejected=this.otherCallRejected)}h.prototype.callFulfilled=function(T){i.resolve(this.promise,T)},h.prototype.otherCallFulfilled=function(T){u(this.promise,this.onFulfilled,T)},h.prototype.callRejected=function(T){i.reject(this.promise,T)},h.prototype.otherCallRejected=function(T){u(this.promise,this.onRejected,T)};function u(T,I,C){e(function(){var E;try{E=I(C)}catch(O){return i.reject(T,O)}E===T?i.reject(T,new TypeError("Cannot resolve promise with itself")):i.resolve(T,E)})}i.resolve=function(T,I){var C=m(d,I);if(C.status==="error")return i.reject(T,C.value);var E=C.value;if(E)p(T,E);else{T.state=s,T.outcome=I;for(var O=-1,_=T.queue.length;++O<_;)T.queue[O].callFulfilled(I)}return T},i.reject=function(T,I){T.state=n,T.outcome=I,process.browser||T.handled===l&&e(function(){T.handled===l&&process.emit("unhandledRejection",I,T)});for(var C=-1,E=T.queue.length;++C<E;)T.queue[C].callRejected(I);return T};function d(T){var I=T&&T.then;if(T&&(typeof T=="object"||typeof T=="function")&&typeof I=="function")return function(){I.apply(T,arguments)}}function p(T,I){var C=!1;function E(v){C||(C=!0,i.reject(T,v))}function O(v){C||(C=!0,i.resolve(T,v))}function _(){I(O,E)}var R=m(_);R.status==="error"&&E(R.value)}function m(T,I){var C={};try{C.value=T(I),C.status="success"}catch(E){C.status="error",C.value=E}return C}c.resolve=g;function g(T){return T instanceof this?T:i.resolve(new this(r),T)}c.reject=y;function y(T){var I=new this(r);return i.reject(I,T)}c.all=b;function b(T){var I=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=T.length,E=!1;if(!C)return this.resolve([]);for(var O=new Array(C),_=0,R=-1,v=new this(r);++R<C;)D(T[R],R);return v;function D(w,F){I.resolve(w).then(H,function(z){E||(E=!0,i.reject(v,z))});function H(z){O[F]=z,++_===C&&!E&&(E=!0,i.resolve(v,O))}}}c.race=P;function P(T){var I=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=T.length,E=!1;if(!C)return this.resolve([]);for(var O=-1,_=new this(r);++O<C;)R(T[O]);return _;function R(v){I.resolve(v).then(function(D){E||(E=!0,i.resolve(_,D))},function(D){E||(E=!0,i.reject(_,D))})}}}),OW=Xn((o,t)=>{"use strict";var e=null;typeof Promise<"u"?e=Promise:e=itt(),t.exports={Promise:e}}),ntt=Xn(o=>{(function(t,e){"use strict";if(t.setImmediate)return;var r=1,i={},n=!1,s=t.document,a;function l(T){typeof T!="function"&&(T=new Function(""+T));for(var I=new Array(arguments.length-1),C=0;C<I.length;C++)I[C]=arguments[C+1];var E={callback:T,args:I};return i[r]=E,a(r),r++}function c(T){delete i[T]}function h(T){var I=T.callback,C=T.args;switch(C.length){case 0:I();break;case 1:I(C[0]);break;case 2:I(C[0],C[1]);break;case 3:I(C[0],C[1],C[2]);break;default:I.apply(e,C);break}}function u(T){if(n)setTimeout(u,0,T);else{var I=i[T];if(I){n=!0;try{h(I)}finally{c(T),n=!1}}}}function d(){a=function(T){process.nextTick(function(){u(T)})}}function p(){if(t.postMessage&&!t.importScripts){var T=!0,I=t.onmessage;return t.onmessage=function(){T=!1},t.postMessage("","*"),t.onmessage=I,T}}function m(){var T="setImmediate$"+Math.random()+"$",I=function(C){C.source===t&&typeof C.data=="string"&&C.data.indexOf(T)===0&&u(+C.data.slice(T.length))};t.addEventListener?t.addEventListener("message",I,!1):t.attachEvent("onmessage",I),a=function(C){t.postMessage(T+C,"*")}}function g(){var T=new MessageChannel;T.port1.onmessage=function(I){var C=I.data;u(C)},a=function(I){T.port2.postMessage(I)}}function y(){var T=s.documentElement;a=function(I){var C=s.createElement("script");C.onreadystatechange=function(){u(I),C.onreadystatechange=null,T.removeChild(C),C=null},T.appendChild(C)}}function b(){a=function(T){setTimeout(u,0,T)}}var P=Object.getPrototypeOf&&Object.getPrototypeOf(t);P=P&&P.setTimeout?P:t,{}.toString.call(t.process)==="[object process]"?d():p()?m():t.MessageChannel?g():s&&"onreadystatechange"in s.createElement("script")?y():b(),P.setImmediate=l,P.clearImmediate=c})(typeof self>"u"?typeof global>"u"?o:global:self)}),W0=Xn(o=>{"use strict";var t=Lv(),e=DDe(),r=eQ(),i=OW();ntt();function n(d){var p=null;return t.uint8array?p=new Uint8Array(d.length):p=new Array(d.length),a(d,p)}o.newBlob=function(d,p){o.checkSupport("blob");try{return new Blob([d],{type:p})}catch{try{var m=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,g=new m;return g.append(d),g.getBlob(p)}catch{throw new Error("Bug : can't construct the Blob.")}}};function s(d){return d}function a(d,p){for(var m=0;m<d.length;++m)p[m]=d.charCodeAt(m)&255;return p}var l={stringifyByChunk:function(d,p,m){var g=[],y=0,b=d.length;if(b<=m)return String.fromCharCode.apply(null,d);for(;y<b;)p==="array"||p==="nodebuffer"?g.push(String.fromCharCode.apply(null,d.slice(y,Math.min(y+m,b)))):g.push(String.fromCharCode.apply(null,d.subarray(y,Math.min(y+m,b)))),y+=m;return g.join("")},stringifyByChar:function(d){for(var p="",m=0;m<d.length;m++)p+=String.fromCharCode(d[m]);return p},applyCanBeUsed:{uint8array:(function(){try{return t.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return t.nodebuffer&&String.fromCharCode.apply(null,r.allocBuffer(1)).length===1}catch{return!1}})()}};function c(d){var p=65536,m=o.getTypeOf(d),g=!0;if(m==="uint8array"?g=l.applyCanBeUsed.uint8array:m==="nodebuffer"&&(g=l.applyCanBeUsed.nodebuffer),g)for(;p>1;)try{return l.stringifyByChunk(d,m,p)}catch{p=Math.floor(p/2)}return l.stringifyByChar(d)}o.applyFromCharCode=c;function h(d,p){for(var m=0;m<d.length;m++)p[m]=d[m];return p}var u={};u.string={string:s,array:function(d){return a(d,new Array(d.length))},arraybuffer:function(d){return u.string.uint8array(d).buffer},uint8array:function(d){return a(d,new Uint8Array(d.length))},nodebuffer:function(d){return a(d,r.allocBuffer(d.length))}},u.array={string:c,array:s,arraybuffer:function(d){return new Uint8Array(d).buffer},uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return r.newBufferFrom(d)}},u.arraybuffer={string:function(d){return c(new Uint8Array(d))},array:function(d){return h(new Uint8Array(d),new Array(d.byteLength))},arraybuffer:s,uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return r.newBufferFrom(new Uint8Array(d))}},u.uint8array={string:c,array:function(d){return h(d,new Array(d.length))},arraybuffer:function(d){return d.buffer},uint8array:s,nodebuffer:function(d){return r.newBufferFrom(d)}},u.nodebuffer={string:c,array:function(d){return h(d,new Array(d.length))},arraybuffer:function(d){return u.nodebuffer.uint8array(d).buffer},uint8array:function(d){return h(d,new Uint8Array(d.length))},nodebuffer:s},o.transformTo=function(d,p){if(p||(p=""),!d)return p;o.checkSupport(d);var m=o.getTypeOf(p),g=u[m][d](p);return g},o.resolve=function(d){for(var p=d.split("/"),m=[],g=0;g<p.length;g++){var y=p[g];y==="."||y===""&&g!==0&&g!==p.length-1||(y===".."?m.pop():m.push(y))}return m.join("/")},o.getTypeOf=function(d){if(typeof d=="string")return"string";if(Object.prototype.toString.call(d)==="[object Array]")return"array";if(t.nodebuffer&&r.isBuffer(d))return"nodebuffer";if(t.uint8array&&d instanceof Uint8Array)return"uint8array";if(t.arraybuffer&&d instanceof ArrayBuffer)return"arraybuffer"},o.checkSupport=function(d){var p=t[d.toLowerCase()];if(!p)throw new Error(d+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(d){var p="",m,g;for(g=0;g<(d||"").length;g++)m=d.charCodeAt(g),p+="\\x"+(m<16?"0":"")+m.toString(16).toUpperCase();return p},o.delay=function(d,p,m){setImmediate(function(){d.apply(m||null,p||[])})},o.inherits=function(d,p){var m=function(){};m.prototype=p.prototype,d.prototype=new m},o.extend=function(){var d={},p,m;for(p=0;p<arguments.length;p++)for(m in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],m)&&typeof d[m]>"u"&&(d[m]=arguments[p][m]);return d},o.prepareContent=function(d,p,m,g,y){var b=i.Promise.resolve(p).then(function(P){var T=t.blob&&(P instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(P))!==-1);return T&&typeof FileReader<"u"?new i.Promise(function(I,C){var E=new FileReader;E.onload=function(O){I(O.target.result)},E.onerror=function(O){C(O.target.error)},E.readAsArrayBuffer(P)}):P});return b.then(function(P){var T=o.getTypeOf(P);return T?(T==="arraybuffer"?P=o.transformTo("uint8array",P):T==="string"&&(y?P=e.decode(P):m&&g!==!0&&(P=n(P))),P):i.Promise.reject(new Error("Can't read the data of '"+d+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}}),CI=Xn((o,t)=>{"use strict";function e(r){this.name=r||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}e.prototype={push:function(r){this.emit("data",r)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(r){this.emit("error",r)}return!0},error:function(r){return this.isFinished?!1:(this.isPaused?this.generatedError=r:(this.isFinished=!0,this.emit("error",r),this.previous&&this.previous.error(r),this.cleanUp()),!0)},on:function(r,i){return this._listeners[r].push(i),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(r,i){if(this._listeners[r])for(var n=0;n<this._listeners[r].length;n++)this._listeners[r][n].call(this,i)},pipe:function(r){return r.registerPrevious(this)},registerPrevious:function(r){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=r.streamInfo,this.mergeStreamInfo(),this.previous=r;var i=this;return r.on("data",function(n){i.processChunk(n)}),r.on("end",function(){i.end()}),r.on("error",function(n){i.error(n)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var r=!1;return this.generatedError&&(this.error(this.generatedError),r=!0),this.previous&&this.previous.resume(),!r},flush:function(){},processChunk:function(r){this.push(r)},withStreamInfo:function(r,i){return this.extraStreamInfo[r]=i,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var r in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,r)&&(this.streamInfo[r]=this.extraStreamInfo[r])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var r="Worker "+this.name;return this.previous?this.previous+" -> "+r:r}},t.exports=e}),AW=Xn(o=>{"use strict";var t=W0(),e=Lv(),r=eQ(),i=CI(),n=new Array(256);for(s=0;s<256;s++)n[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;var s;n[254]=n[254]=1;var a=function(d){var p,m,g,y,b,P=d.length,T=0;for(y=0;y<P;y++)m=d.charCodeAt(y),(m&64512)===55296&&y+1<P&&(g=d.charCodeAt(y+1),(g&64512)===56320&&(m=65536+(m-55296<<10)+(g-56320),y++)),T+=m<128?1:m<2048?2:m<65536?3:4;for(e.uint8array?p=new Uint8Array(T):p=new Array(T),b=0,y=0;b<T;y++)m=d.charCodeAt(y),(m&64512)===55296&&y+1<P&&(g=d.charCodeAt(y+1),(g&64512)===56320&&(m=65536+(m-55296<<10)+(g-56320),y++)),m<128?p[b++]=m:m<2048?(p[b++]=192|m>>>6,p[b++]=128|m&63):m<65536?(p[b++]=224|m>>>12,p[b++]=128|m>>>6&63,p[b++]=128|m&63):(p[b++]=240|m>>>18,p[b++]=128|m>>>12&63,p[b++]=128|m>>>6&63,p[b++]=128|m&63);return p},l=function(d,p){var m;for(p=p||d.length,p>d.length&&(p=d.length),m=p-1;m>=0&&(d[m]&192)===128;)m--;return m<0||m===0?p:m+n[d[m]]>p?m:p},c=function(d){var p,m,g,y,b=d.length,P=new Array(b*2);for(m=0,p=0;p<b;){if(g=d[p++],g<128){P[m++]=g;continue}if(y=n[g],y>4){P[m++]=65533,p+=y-1;continue}for(g&=y===2?31:y===3?15:7;y>1&&p<b;)g=g<<6|d[p++]&63,y--;if(y>1){P[m++]=65533;continue}g<65536?P[m++]=g:(g-=65536,P[m++]=55296|g>>10&1023,P[m++]=56320|g&1023)}return P.length!==m&&(P.subarray?P=P.subarray(0,m):P.length=m),t.applyFromCharCode(P)};o.utf8encode=function(d){return e.nodebuffer?r.newBufferFrom(d,"utf-8"):a(d)},o.utf8decode=function(d){return e.nodebuffer?t.transformTo("nodebuffer",d).toString("utf-8"):(d=t.transformTo(e.uint8array?"uint8array":"array",d),c(d))};function h(){i.call(this,"utf-8 decode"),this.leftOver=null}t.inherits(h,i),h.prototype.processChunk=function(d){var p=t.transformTo(e.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(e.uint8array){var m=p;p=new Uint8Array(m.length+this.leftOver.length),p.set(this.leftOver,0),p.set(m,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var g=l(p),y=p;g!==p.length&&(e.uint8array?(y=p.subarray(0,g),this.leftOver=p.subarray(g,p.length)):(y=p.slice(0,g),this.leftOver=p.slice(g,p.length))),this.push({data:o.utf8decode(y),meta:d.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=h;function u(){i.call(this,"utf-8 encode")}t.inherits(u,i),u.prototype.processChunk=function(d){this.push({data:o.utf8encode(d.data),meta:d.meta})},o.Utf8EncodeWorker=u}),ott=Xn((o,t)=>{"use strict";var e=CI(),r=W0();function i(n){e.call(this,"ConvertWorker to "+n),this.destType=n}r.inherits(i,e),i.prototype.processChunk=function(n){this.push({data:r.transformTo(this.destType,n.data),meta:n.meta})},t.exports=i}),stt=Xn((o,t)=>{"use strict";var e=RDe().Readable,r=W0();r.inherits(i,e);function i(n,s,a){e.call(this,s),this._helper=n;var l=this;n.on("data",function(c,h){l.push(c)||l._helper.pause(),a&&a(h)}).on("error",function(c){l.emit("error",c)}).on("end",function(){l.push(null)})}i.prototype._read=function(){this._helper.resume()},t.exports=i}),wDe=Xn((o,t)=>{"use strict";var e=W0(),r=ott(),i=CI(),n=DDe(),s=Lv(),a=OW(),l=null;if(s.nodestream)try{l=stt()}catch{}function c(p,m,g){switch(p){case"blob":return e.newBlob(e.transformTo("arraybuffer",m),g);case"base64":return n.encode(m);default:return e.transformTo(p,m)}}function h(p,m){var g,y=0,b=null,P=0;for(g=0;g<m.length;g++)P+=m[g].length;switch(p){case"string":return m.join("");case"array":return Array.prototype.concat.apply([],m);case"uint8array":for(b=new Uint8Array(P),g=0;g<m.length;g++)b.set(m[g],y),y+=m[g].length;return b;case"nodebuffer":return Buffer.concat(m);default:throw new Error("concat : unsupported type '"+p+"'")}}function u(p,m){return new a.Promise(function(g,y){var b=[],P=p._internalType,T=p._outputType,I=p._mimeType;p.on("data",function(C,E){b.push(C),m&&m(E)}).on("error",function(C){b=[],y(C)}).on("end",function(){try{var C=c(T,h(P,b),I);g(C)}catch(E){y(E)}b=[]}).resume()})}function d(p,m,g){var y=m;switch(m){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string";break}try{this._internalType=y,this._outputType=m,this._mimeType=g,e.checkSupport(y),this._worker=p.pipe(new r(y)),p.lock()}catch(b){this._worker=new i("error"),this._worker.error(b)}}d.prototype={accumulate:function(p){return u(this,p)},on:function(p,m){var g=this;return p==="data"?this._worker.on(p,function(y){m.call(g,y.data,y.meta)}):this._worker.on(p,function(){e.delay(m,arguments,g)}),this},resume:function(){return e.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(e.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:this._outputType!=="nodebuffer"},p)}},t.exports=d}),LDe=Xn(o=>{"use strict";o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null}),MDe=Xn((o,t)=>{"use strict";var e=W0(),r=CI(),i=16*1024;function n(s){r.call(this,"DataWorker");var a=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,s.then(function(l){a.dataIsReady=!0,a.data=l,a.max=l&&l.length||0,a.type=e.getTypeOf(l),a.isPaused||a._tickAndRepeat()},function(l){a.error(l)})}e.inherits(n,r),n.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},n.prototype.resume=function(){return r.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,e.delay(this._tickAndRepeat,[],this)),!0):!1},n.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(e.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},n.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var s=i,a=null,l=Math.min(this.max,this.index+s);if(this.index>=this.max)return this.end();switch(this.type){case"string":a=this.data.substring(this.index,l);break;case"uint8array":a=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":a=this.data.slice(this.index,l);break}return this.index=l,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=n}),Hbe=Xn((o,t)=>{"use strict";var e=W0();function r(){for(var a,l=[],c=0;c<256;c++){a=c;for(var h=0;h<8;h++)a=a&1?3988292384^a>>>1:a>>>1;l[c]=a}return l}var i=r();function n(a,l,c,h){var u=i,d=h+c;a=a^-1;for(var p=h;p<d;p++)a=a>>>8^u[(a^l[p])&255];return a^-1}function s(a,l,c,h){var u=i,d=h+c;a=a^-1;for(var p=h;p<d;p++)a=a>>>8^u[(a^l.charCodeAt(p))&255];return a^-1}t.exports=function(a,l){if(typeof a>"u"||!a.length)return 0;var c=e.getTypeOf(a)!=="string";return c?n(l|0,a,a.length,0):s(l|0,a,a.length,0)}}),NDe=Xn((o,t)=>{"use strict";var e=CI(),r=Hbe(),i=W0();function n(){e.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}i.inherits(n,e),n.prototype.processChunk=function(s){this.streamInfo.crc32=r(s.data,this.streamInfo.crc32||0),this.push(s)},t.exports=n}),att=Xn((o,t)=>{"use strict";var e=W0(),r=CI();function i(n){r.call(this,"DataLengthProbe for "+n),this.propName=n,this.withStreamInfo(n,0)}e.inherits(i,r),i.prototype.processChunk=function(n){if(n){var s=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=s+n.data.length}r.prototype.processChunk.call(this,n)},t.exports=i}),Wbe=Xn((o,t)=>{"use strict";var e=OW(),r=MDe(),i=NDe(),n=att();function s(a,l,c,h,u){this.compressedSize=a,this.uncompressedSize=l,this.crc32=c,this.compression=h,this.compressedContent=u}s.prototype={getContentWorker:function(){var a=new r(e.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new n("data_length")),l=this;return a.on("end",function(){if(this.streamInfo.data_length!==l.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),a},getCompressedWorker:function(){return new r(e.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(a,l,c){return a.pipe(new i).pipe(new n("uncompressedSize")).pipe(l.compressWorker(c)).pipe(new n("compressedSize")).withStreamInfo("compression",l)},t.exports=s}),ltt=Xn((o,t)=>{"use strict";var e=wDe(),r=MDe(),i=AW(),n=Wbe(),s=CI(),a=function(u,d,p){this.name=u,this.dir=p.dir,this.date=p.date,this.comment=p.comment,this.unixPermissions=p.unixPermissions,this.dosPermissions=p.dosPermissions,this._data=d,this._dataBinary=p.binary,this.options={compression:p.compression,compressionOptions:p.compressionOptions}};a.prototype={internalStream:function(u){var d=null,p="string";try{if(!u)throw new Error("No output type specified.");p=u.toLowerCase();var m=p==="string"||p==="text";(p==="binarystring"||p==="text")&&(p="string"),d=this._decompressWorker();var g=!this._dataBinary;g&&!m&&(d=d.pipe(new i.Utf8EncodeWorker)),!g&&m&&(d=d.pipe(new i.Utf8DecodeWorker))}catch(y){d=new s("error"),d.error(y)}return new e(d,p,"")},async:function(u,d){return this.internalStream(u).accumulate(d)},nodeStream:function(u,d){return this.internalStream(u||"nodebuffer").toNodejsStream(d)},_compressWorker:function(u,d){if(this._data instanceof n&&this._data.compression.magic===u.magic)return this._data.getCompressedWorker();var p=this._decompressWorker();return this._dataBinary||(p=p.pipe(new i.Utf8EncodeWorker)),n.createWorkerFrom(p,u,d)},_decompressWorker:function(){return this._data instanceof n?this._data.getContentWorker():this._data instanceof s?this._data:new r(this._data)}};var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],c=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(h=0;h<l.length;h++)a.prototype[l[h]]=c;var h;t.exports=a}),Mv=Xn(o=>{"use strict";var t=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function e(n,s){return Object.prototype.hasOwnProperty.call(n,s)}o.assign=function(n){for(var s=Array.prototype.slice.call(arguments,1);s.length;){var a=s.shift();if(a){if(typeof a!="object")throw new TypeError(a+"must be non-object");for(var l in a)e(a,l)&&(n[l]=a[l])}}return n},o.shrinkBuf=function(n,s){return n.length===s?n:n.subarray?n.subarray(0,s):(n.length=s,n)};var r={arraySet:function(n,s,a,l,c){if(s.subarray&&n.subarray){n.set(s.subarray(a,a+l),c);return}for(var h=0;h<l;h++)n[c+h]=s[a+h]},flattenChunks:function(n){var s,a,l,c,h,u;for(l=0,s=0,a=n.length;s<a;s++)l+=n[s].length;for(u=new Uint8Array(l),c=0,s=0,a=n.length;s<a;s++)h=n[s],u.set(h,c),c+=h.length;return u}},i={arraySet:function(n,s,a,l,c){for(var h=0;h<l;h++)n[c+h]=s[a+h]},flattenChunks:function(n){return[].concat.apply([],n)}};o.setTyped=function(n){n?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,r)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,i))},o.setTyped(t)}),ctt=Xn(o=>{"use strict";var t=Mv(),e=4,r=0,i=1,n=2;function s(ke){for(var Yt=ke.length;--Yt>=0;)ke[Yt]=0}var a=0,l=1,c=2,h=3,u=258,d=29,p=256,m=p+1+d,g=30,y=19,b=2*m+1,P=15,T=16,I=7,C=256,E=16,O=17,_=18,R=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],v=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],F=512,H=new Array((m+2)*2);s(H);var z=new Array(g*2);s(z);var G=new Array(F);s(G);var W=new Array(u-h+1);s(W);var L=new Array(d);s(L);var B=new Array(g);s(B);function N(ke,Yt,Ut,ar,Fe){this.static_tree=ke,this.extra_bits=Yt,this.extra_base=Ut,this.elems=ar,this.max_length=Fe,this.has_stree=ke&&ke.length}var U,k,V;function Y(ke,Yt){this.dyn_tree=ke,this.max_code=0,this.stat_desc=Yt}function X(ke){return ke<256?G[ke]:G[256+(ke>>>7)]}function Z(ke,Yt){ke.pending_buf[ke.pending++]=Yt&255,ke.pending_buf[ke.pending++]=Yt>>>8&255}function Q(ke,Yt,Ut){ke.bi_valid>T-Ut?(ke.bi_buf|=Yt<<ke.bi_valid&65535,Z(ke,ke.bi_buf),ke.bi_buf=Yt>>T-ke.bi_valid,ke.bi_valid+=Ut-T):(ke.bi_buf|=Yt<<ke.bi_valid&65535,ke.bi_valid+=Ut)}function ae(ke,Yt,Ut){Q(ke,Ut[Yt*2],Ut[Yt*2+1])}function he(ke,Yt){var Ut=0;do Ut|=ke&1,ke>>>=1,Ut<<=1;while(--Yt>0);return Ut>>>1}function re(ke){ke.bi_valid===16?(Z(ke,ke.bi_buf),ke.bi_buf=0,ke.bi_valid=0):ke.bi_valid>=8&&(ke.pending_buf[ke.pending++]=ke.bi_buf&255,ke.bi_buf>>=8,ke.bi_valid-=8)}function se(ke,Yt){var Ut=Yt.dyn_tree,ar=Yt.max_code,Fe=Yt.stat_desc.static_tree,it=Yt.stat_desc.has_stree,ye=Yt.stat_desc.extra_bits,bt=Yt.stat_desc.extra_base,zt=Yt.stat_desc.max_length,de,qe,lt,Ne,et,At,dr=0;for(Ne=0;Ne<=P;Ne++)ke.bl_count[Ne]=0;for(Ut[ke.heap[ke.heap_max]*2+1]=0,de=ke.heap_max+1;de<b;de++)qe=ke.heap[de],Ne=Ut[Ut[qe*2+1]*2+1]+1,Ne>zt&&(Ne=zt,dr++),Ut[qe*2+1]=Ne,!(qe>ar)&&(ke.bl_count[Ne]++,et=0,qe>=bt&&(et=ye[qe-bt]),At=Ut[qe*2],ke.opt_len+=At*(Ne+et),it&&(ke.static_len+=At*(Fe[qe*2+1]+et)));if(dr!==0){do{for(Ne=zt-1;ke.bl_count[Ne]===0;)Ne--;ke.bl_count[Ne]--,ke.bl_count[Ne+1]+=2,ke.bl_count[zt]--,dr-=2}while(dr>0);for(Ne=zt;Ne!==0;Ne--)for(qe=ke.bl_count[Ne];qe!==0;)lt=ke.heap[--de],!(lt>ar)&&(Ut[lt*2+1]!==Ne&&(ke.opt_len+=(Ne-Ut[lt*2+1])*Ut[lt*2],Ut[lt*2+1]=Ne),qe--)}}function K(ke,Yt,Ut){var ar=new Array(P+1),Fe=0,it,ye;for(it=1;it<=P;it++)ar[it]=Fe=Fe+Ut[it-1]<<1;for(ye=0;ye<=Yt;ye++){var bt=ke[ye*2+1];bt!==0&&(ke[ye*2]=he(ar[bt]++,bt))}}function me(){var ke,Yt,Ut,ar,Fe,it=new Array(P+1);for(Ut=0,ar=0;ar<d-1;ar++)for(L[ar]=Ut,ke=0;ke<1<<R[ar];ke++)W[Ut++]=ar;for(W[Ut-1]=ar,Fe=0,ar=0;ar<16;ar++)for(B[ar]=Fe,ke=0;ke<1<<v[ar];ke++)G[Fe++]=ar;for(Fe>>=7;ar<g;ar++)for(B[ar]=Fe<<7,ke=0;ke<1<<v[ar]-7;ke++)G[256+Fe++]=ar;for(Yt=0;Yt<=P;Yt++)it[Yt]=0;for(ke=0;ke<=143;)H[ke*2+1]=8,ke++,it[8]++;for(;ke<=255;)H[ke*2+1]=9,ke++,it[9]++;for(;ke<=279;)H[ke*2+1]=7,ke++,it[7]++;for(;ke<=287;)H[ke*2+1]=8,ke++,it[8]++;for(K(H,m+1,it),ke=0;ke<g;ke++)z[ke*2+1]=5,z[ke*2]=he(ke,5);U=new N(H,R,p+1,m,P),k=new N(z,v,0,g,P),V=new N(new Array(0),D,0,y,I)}function Oe(ke){var Yt;for(Yt=0;Yt<m;Yt++)ke.dyn_ltree[Yt*2]=0;for(Yt=0;Yt<g;Yt++)ke.dyn_dtree[Yt*2]=0;for(Yt=0;Yt<y;Yt++)ke.bl_tree[Yt*2]=0;ke.dyn_ltree[C*2]=1,ke.opt_len=ke.static_len=0,ke.last_lit=ke.matches=0}function Ie(ke){ke.bi_valid>8?Z(ke,ke.bi_buf):ke.bi_valid>0&&(ke.pending_buf[ke.pending++]=ke.bi_buf),ke.bi_buf=0,ke.bi_valid=0}function ue(ke,Yt,Ut,ar){Ie(ke),ar&&(Z(ke,Ut),Z(ke,~Ut)),t.arraySet(ke.pending_buf,ke.window,Yt,Ut,ke.pending),ke.pending+=Ut}function Pe(ke,Yt,Ut,ar){var Fe=Yt*2,it=Ut*2;return ke[Fe]<ke[it]||ke[Fe]===ke[it]&&ar[Yt]<=ar[Ut]}function j(ke,Yt,Ut){for(var ar=ke.heap[Ut],Fe=Ut<<1;Fe<=ke.heap_len&&(Fe<ke.heap_len&&Pe(Yt,ke.heap[Fe+1],ke.heap[Fe],ke.depth)&&Fe++,!Pe(Yt,ar,ke.heap[Fe],ke.depth));)ke.heap[Ut]=ke.heap[Fe],Ut=Fe,Fe<<=1;ke.heap[Ut]=ar}function J(ke,Yt,Ut){var ar,Fe,it=0,ye,bt;if(ke.last_lit!==0)do ar=ke.pending_buf[ke.d_buf+it*2]<<8|ke.pending_buf[ke.d_buf+it*2+1],Fe=ke.pending_buf[ke.l_buf+it],it++,ar===0?ae(ke,Fe,Yt):(ye=W[Fe],ae(ke,ye+p+1,Yt),bt=R[ye],bt!==0&&(Fe-=L[ye],Q(ke,Fe,bt)),ar--,ye=X(ar),ae(ke,ye,Ut),bt=v[ye],bt!==0&&(ar-=B[ye],Q(ke,ar,bt)));while(it<ke.last_lit);ae(ke,C,Yt)}function oe(ke,Yt){var Ut=Yt.dyn_tree,ar=Yt.stat_desc.static_tree,Fe=Yt.stat_desc.has_stree,it=Yt.stat_desc.elems,ye,bt,zt=-1,de;for(ke.heap_len=0,ke.heap_max=b,ye=0;ye<it;ye++)Ut[ye*2]!==0?(ke.heap[++ke.heap_len]=zt=ye,ke.depth[ye]=0):Ut[ye*2+1]=0;for(;ke.heap_len<2;)de=ke.heap[++ke.heap_len]=zt<2?++zt:0,Ut[de*2]=1,ke.depth[de]=0,ke.opt_len--,Fe&&(ke.static_len-=ar[de*2+1]);for(Yt.max_code=zt,ye=ke.heap_len>>1;ye>=1;ye--)j(ke,Ut,ye);de=it;do ye=ke.heap[1],ke.heap[1]=ke.heap[ke.heap_len--],j(ke,Ut,1),bt=ke.heap[1],ke.heap[--ke.heap_max]=ye,ke.heap[--ke.heap_max]=bt,Ut[de*2]=Ut[ye*2]+Ut[bt*2],ke.depth[de]=(ke.depth[ye]>=ke.depth[bt]?ke.depth[ye]:ke.depth[bt])+1,Ut[ye*2+1]=Ut[bt*2+1]=de,ke.heap[1]=de++,j(ke,Ut,1);while(ke.heap_len>=2);ke.heap[--ke.heap_max]=ke.heap[1],se(ke,Yt),K(Ut,zt,ke.bl_count)}function pe(ke,Yt,Ut){var ar,Fe=-1,it,ye=Yt[1],bt=0,zt=7,de=4;for(ye===0&&(zt=138,de=3),Yt[(Ut+1)*2+1]=65535,ar=0;ar<=Ut;ar++)it=ye,ye=Yt[(ar+1)*2+1],!(++bt<zt&&it===ye)&&(bt<de?ke.bl_tree[it*2]+=bt:it!==0?(it!==Fe&&ke.bl_tree[it*2]++,ke.bl_tree[E*2]++):bt<=10?ke.bl_tree[O*2]++:ke.bl_tree[_*2]++,bt=0,Fe=it,ye===0?(zt=138,de=3):it===ye?(zt=6,de=3):(zt=7,de=4))}function ge(ke,Yt,Ut){var ar,Fe=-1,it,ye=Yt[1],bt=0,zt=7,de=4;for(ye===0&&(zt=138,de=3),ar=0;ar<=Ut;ar++)if(it=ye,ye=Yt[(ar+1)*2+1],!(++bt<zt&&it===ye)){if(bt<de)do ae(ke,it,ke.bl_tree);while(--bt!==0);else it!==0?(it!==Fe&&(ae(ke,it,ke.bl_tree),bt--),ae(ke,E,ke.bl_tree),Q(ke,bt-3,2)):bt<=10?(ae(ke,O,ke.bl_tree),Q(ke,bt-3,3)):(ae(ke,_,ke.bl_tree),Q(ke,bt-11,7));bt=0,Fe=it,ye===0?(zt=138,de=3):it===ye?(zt=6,de=3):(zt=7,de=4)}}function Se(ke){var Yt;for(pe(ke,ke.dyn_ltree,ke.l_desc.max_code),pe(ke,ke.dyn_dtree,ke.d_desc.max_code),oe(ke,ke.bl_desc),Yt=y-1;Yt>=3&&ke.bl_tree[w[Yt]*2+1]===0;Yt--);return ke.opt_len+=3*(Yt+1)+5+5+4,Yt}function De(ke,Yt,Ut,ar){var Fe;for(Q(ke,Yt-257,5),Q(ke,Ut-1,5),Q(ke,ar-4,4),Fe=0;Fe<ar;Fe++)Q(ke,ke.bl_tree[w[Fe]*2+1],3);ge(ke,ke.dyn_ltree,Yt-1),ge(ke,ke.dyn_dtree,Ut-1)}function tt(ke){var Yt=4093624447,Ut;for(Ut=0;Ut<=31;Ut++,Yt>>>=1)if(Yt&1&&ke.dyn_ltree[Ut*2]!==0)return r;if(ke.dyn_ltree[18]!==0||ke.dyn_ltree[20]!==0||ke.dyn_ltree[26]!==0)return i;for(Ut=32;Ut<p;Ut++)if(ke.dyn_ltree[Ut*2]!==0)return i;return r}var Ze=!1;function Wt(ke){Ze||(me(),Ze=!0),ke.l_desc=new Y(ke.dyn_ltree,U),ke.d_desc=new Y(ke.dyn_dtree,k),ke.bl_desc=new Y(ke.bl_tree,V),ke.bi_buf=0,ke.bi_valid=0,Oe(ke)}function Nr(ke,Yt,Ut,ar){Q(ke,(a<<1)+(ar?1:0),3),ue(ke,Yt,Ut,!0)}function Lr(ke){Q(ke,l<<1,3),ae(ke,C,H),re(ke)}function Dr(ke,Yt,Ut,ar){var Fe,it,ye=0;ke.level>0?(ke.strm.data_type===n&&(ke.strm.data_type=tt(ke)),oe(ke,ke.l_desc),oe(ke,ke.d_desc),ye=Se(ke),Fe=ke.opt_len+3+7>>>3,it=ke.static_len+3+7>>>3,it<=Fe&&(Fe=it)):Fe=it=Ut+5,Ut+4<=Fe&&Yt!==-1?Nr(ke,Yt,Ut,ar):ke.strategy===e||it===Fe?(Q(ke,(l<<1)+(ar?1:0),3),J(ke,H,z)):(Q(ke,(c<<1)+(ar?1:0),3),De(ke,ke.l_desc.max_code+1,ke.d_desc.max_code+1,ye+1),J(ke,ke.dyn_ltree,ke.dyn_dtree)),Oe(ke),ar&&Ie(ke)}function Rr(ke,Yt,Ut){return ke.pending_buf[ke.d_buf+ke.last_lit*2]=Yt>>>8&255,ke.pending_buf[ke.d_buf+ke.last_lit*2+1]=Yt&255,ke.pending_buf[ke.l_buf+ke.last_lit]=Ut&255,ke.last_lit++,Yt===0?ke.dyn_ltree[Ut*2]++:(ke.matches++,Yt--,ke.dyn_ltree[(W[Ut]+p+1)*2]++,ke.dyn_dtree[X(Yt)*2]++),ke.last_lit===ke.lit_bufsize-1}o._tr_init=Wt,o._tr_stored_block=Nr,o._tr_flush_block=Dr,o._tr_tally=Rr,o._tr_align=Lr}),kDe=Xn((o,t)=>{"use strict";function e(r,i,n,s){for(var a=r&65535|0,l=r>>>16&65535|0,c=0;n!==0;){c=n>2e3?2e3:n,n-=c;do a=a+i[s++]|0,l=l+a|0;while(--c);a%=65521,l%=65521}return a|l<<16|0}t.exports=e}),BDe=Xn((o,t)=>{"use strict";function e(){for(var n,s=[],a=0;a<256;a++){n=a;for(var l=0;l<8;l++)n=n&1?3988292384^n>>>1:n>>>1;s[a]=n}return s}var r=e();function i(n,s,a,l){var c=r,h=l+a;n^=-1;for(var u=l;u<h;u++)n=n>>>8^c[(n^s[u])&255];return n^-1}t.exports=i}),zbe=Xn((o,t)=>{"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}}),htt=Xn(o=>{"use strict";var t=Mv(),e=ctt(),r=kDe(),i=BDe(),n=zbe(),s=0,a=1,l=3,c=4,h=5,u=0,d=1,p=-2,m=-3,g=-5,y=-1,b=1,P=2,T=3,I=4,C=0,E=2,O=8,_=9,R=15,v=8,D=29,w=256,F=w+1+D,H=30,z=19,G=2*F+1,W=15,L=3,B=258,N=B+L+1,U=32,k=42,V=69,Y=73,X=91,Z=103,Q=113,ae=666,he=1,re=2,se=3,K=4,me=3;function Oe(de,qe){return de.msg=n[qe],qe}function Ie(de){return(de<<1)-(de>4?9:0)}function ue(de){for(var qe=de.length;--qe>=0;)de[qe]=0}function Pe(de){var qe=de.state,lt=qe.pending;lt>de.avail_out&&(lt=de.avail_out),lt!==0&&(t.arraySet(de.output,qe.pending_buf,qe.pending_out,lt,de.next_out),de.next_out+=lt,qe.pending_out+=lt,de.total_out+=lt,de.avail_out-=lt,qe.pending-=lt,qe.pending===0&&(qe.pending_out=0))}function j(de,qe){e._tr_flush_block(de,de.block_start>=0?de.block_start:-1,de.strstart-de.block_start,qe),de.block_start=de.strstart,Pe(de.strm)}function J(de,qe){de.pending_buf[de.pending++]=qe}function oe(de,qe){de.pending_buf[de.pending++]=qe>>>8&255,de.pending_buf[de.pending++]=qe&255}function pe(de,qe,lt,Ne){var et=de.avail_in;return et>Ne&&(et=Ne),et===0?0:(de.avail_in-=et,t.arraySet(qe,de.input,de.next_in,et,lt),de.state.wrap===1?de.adler=r(de.adler,qe,et,lt):de.state.wrap===2&&(de.adler=i(de.adler,qe,et,lt)),de.next_in+=et,de.total_in+=et,et)}function ge(de,qe){var lt=de.max_chain_length,Ne=de.strstart,et,At,dr=de.prev_length,vr=de.nice_match,Zr=de.strstart>de.w_size-N?de.strstart-(de.w_size-N):0,xi=de.window,Zi=de.w_mask,Fi=de.prev,$i=de.strstart+B,yo=xi[Ne+dr-1],Ha=xi[Ne+dr];de.prev_length>=de.good_match&&(lt>>=2),vr>de.lookahead&&(vr=de.lookahead);do if(et=qe,!(xi[et+dr]!==Ha||xi[et+dr-1]!==yo||xi[et]!==xi[Ne]||xi[++et]!==xi[Ne+1])){Ne+=2,et++;do;while(xi[++Ne]===xi[++et]&&xi[++Ne]===xi[++et]&&xi[++Ne]===xi[++et]&&xi[++Ne]===xi[++et]&&xi[++Ne]===xi[++et]&&xi[++Ne]===xi[++et]&&xi[++Ne]===xi[++et]&&xi[++Ne]===xi[++et]&&Ne<$i);if(At=B-($i-Ne),Ne=$i-B,At>dr){if(de.match_start=qe,dr=At,At>=vr)break;yo=xi[Ne+dr-1],Ha=xi[Ne+dr]}}while((qe=Fi[qe&Zi])>Zr&&--lt!==0);return dr<=de.lookahead?dr:de.lookahead}function Se(de){var qe=de.w_size,lt,Ne,et,At,dr;do{if(At=de.window_size-de.lookahead-de.strstart,de.strstart>=qe+(qe-N)){t.arraySet(de.window,de.window,qe,qe,0),de.match_start-=qe,de.strstart-=qe,de.block_start-=qe,Ne=de.hash_size,lt=Ne;do et=de.head[--lt],de.head[lt]=et>=qe?et-qe:0;while(--Ne);Ne=qe,lt=Ne;do et=de.prev[--lt],de.prev[lt]=et>=qe?et-qe:0;while(--Ne);At+=qe}if(de.strm.avail_in===0)break;if(Ne=pe(de.strm,de.window,de.strstart+de.lookahead,At),de.lookahead+=Ne,de.lookahead+de.insert>=L)for(dr=de.strstart-de.insert,de.ins_h=de.window[dr],de.ins_h=(de.ins_h<<de.hash_shift^de.window[dr+1])&de.hash_mask;de.insert&&(de.ins_h=(de.ins_h<<de.hash_shift^de.window[dr+L-1])&de.hash_mask,de.prev[dr&de.w_mask]=de.head[de.ins_h],de.head[de.ins_h]=dr,dr++,de.insert--,!(de.lookahead+de.insert<L)););}while(de.lookahead<N&&de.strm.avail_in!==0)}function De(de,qe){var lt=65535;for(lt>de.pending_buf_size-5&&(lt=de.pending_buf_size-5);;){if(de.lookahead<=1){if(Se(de),de.lookahead===0&&qe===s)return he;if(de.lookahead===0)break}de.strstart+=de.lookahead,de.lookahead=0;var Ne=de.block_start+lt;if((de.strstart===0||de.strstart>=Ne)&&(de.lookahead=de.strstart-Ne,de.strstart=Ne,j(de,!1),de.strm.avail_out===0)||de.strstart-de.block_start>=de.w_size-N&&(j(de,!1),de.strm.avail_out===0))return he}return de.insert=0,qe===c?(j(de,!0),de.strm.avail_out===0?se:K):(de.strstart>de.block_start&&(j(de,!1),de.strm.avail_out),he)}function tt(de,qe){for(var lt,Ne;;){if(de.lookahead<N){if(Se(de),de.lookahead<N&&qe===s)return he;if(de.lookahead===0)break}if(lt=0,de.lookahead>=L&&(de.ins_h=(de.ins_h<<de.hash_shift^de.window[de.strstart+L-1])&de.hash_mask,lt=de.prev[de.strstart&de.w_mask]=de.head[de.ins_h],de.head[de.ins_h]=de.strstart),lt!==0&&de.strstart-lt<=de.w_size-N&&(de.match_length=ge(de,lt)),de.match_length>=L)if(Ne=e._tr_tally(de,de.strstart-de.match_start,de.match_length-L),de.lookahead-=de.match_length,de.match_length<=de.max_lazy_match&&de.lookahead>=L){de.match_length--;do de.strstart++,de.ins_h=(de.ins_h<<de.hash_shift^de.window[de.strstart+L-1])&de.hash_mask,lt=de.prev[de.strstart&de.w_mask]=de.head[de.ins_h],de.head[de.ins_h]=de.strstart;while(--de.match_length!==0);de.strstart++}else de.strstart+=de.match_length,de.match_length=0,de.ins_h=de.window[de.strstart],de.ins_h=(de.ins_h<<de.hash_shift^de.window[de.strstart+1])&de.hash_mask;else Ne=e._tr_tally(de,0,de.window[de.strstart]),de.lookahead--,de.strstart++;if(Ne&&(j(de,!1),de.strm.avail_out===0))return he}return de.insert=de.strstart<L-1?de.strstart:L-1,qe===c?(j(de,!0),de.strm.avail_out===0?se:K):de.last_lit&&(j(de,!1),de.strm.avail_out===0)?he:re}function Ze(de,qe){for(var lt,Ne,et;;){if(de.lookahead<N){if(Se(de),de.lookahead<N&&qe===s)return he;if(de.lookahead===0)break}if(lt=0,de.lookahead>=L&&(de.ins_h=(de.ins_h<<de.hash_shift^de.window[de.strstart+L-1])&de.hash_mask,lt=de.prev[de.strstart&de.w_mask]=de.head[de.ins_h],de.head[de.ins_h]=de.strstart),de.prev_length=de.match_length,de.prev_match=de.match_start,de.match_length=L-1,lt!==0&&de.prev_length<de.max_lazy_match&&de.strstart-lt<=de.w_size-N&&(de.match_length=ge(de,lt),de.match_length<=5&&(de.strategy===b||de.match_length===L&&de.strstart-de.match_start>4096)&&(de.match_length=L-1)),de.prev_length>=L&&de.match_length<=de.prev_length){et=de.strstart+de.lookahead-L,Ne=e._tr_tally(de,de.strstart-1-de.prev_match,de.prev_length-L),de.lookahead-=de.prev_length-1,de.prev_length-=2;do++de.strstart<=et&&(de.ins_h=(de.ins_h<<de.hash_shift^de.window[de.strstart+L-1])&de.hash_mask,lt=de.prev[de.strstart&de.w_mask]=de.head[de.ins_h],de.head[de.ins_h]=de.strstart);while(--de.prev_length!==0);if(de.match_available=0,de.match_length=L-1,de.strstart++,Ne&&(j(de,!1),de.strm.avail_out===0))return he}else if(de.match_available){if(Ne=e._tr_tally(de,0,de.window[de.strstart-1]),Ne&&j(de,!1),de.strstart++,de.lookahead--,de.strm.avail_out===0)return he}else de.match_available=1,de.strstart++,de.lookahead--}return de.match_available&&(Ne=e._tr_tally(de,0,de.window[de.strstart-1]),de.match_available=0),de.insert=de.strstart<L-1?de.strstart:L-1,qe===c?(j(de,!0),de.strm.avail_out===0?se:K):de.last_lit&&(j(de,!1),de.strm.avail_out===0)?he:re}function Wt(de,qe){for(var lt,Ne,et,At,dr=de.window;;){if(de.lookahead<=B){if(Se(de),de.lookahead<=B&&qe===s)return he;if(de.lookahead===0)break}if(de.match_length=0,de.lookahead>=L&&de.strstart>0&&(et=de.strstart-1,Ne=dr[et],Ne===dr[++et]&&Ne===dr[++et]&&Ne===dr[++et])){At=de.strstart+B;do;while(Ne===dr[++et]&&Ne===dr[++et]&&Ne===dr[++et]&&Ne===dr[++et]&&Ne===dr[++et]&&Ne===dr[++et]&&Ne===dr[++et]&&Ne===dr[++et]&&et<At);de.match_length=B-(At-et),de.match_length>de.lookahead&&(de.match_length=de.lookahead)}if(de.match_length>=L?(lt=e._tr_tally(de,1,de.match_length-L),de.lookahead-=de.match_length,de.strstart+=de.match_length,de.match_length=0):(lt=e._tr_tally(de,0,de.window[de.strstart]),de.lookahead--,de.strstart++),lt&&(j(de,!1),de.strm.avail_out===0))return he}return de.insert=0,qe===c?(j(de,!0),de.strm.avail_out===0?se:K):de.last_lit&&(j(de,!1),de.strm.avail_out===0)?he:re}function Nr(de,qe){for(var lt;;){if(de.lookahead===0&&(Se(de),de.lookahead===0)){if(qe===s)return he;break}if(de.match_length=0,lt=e._tr_tally(de,0,de.window[de.strstart]),de.lookahead--,de.strstart++,lt&&(j(de,!1),de.strm.avail_out===0))return he}return de.insert=0,qe===c?(j(de,!0),de.strm.avail_out===0?se:K):de.last_lit&&(j(de,!1),de.strm.avail_out===0)?he:re}function Lr(de,qe,lt,Ne,et){this.good_length=de,this.max_lazy=qe,this.nice_length=lt,this.max_chain=Ne,this.func=et}var Dr;Dr=[new Lr(0,0,0,0,De),new Lr(4,4,8,4,tt),new Lr(4,5,16,8,tt),new Lr(4,6,32,32,tt),new Lr(4,4,16,16,Ze),new Lr(8,16,32,32,Ze),new Lr(8,16,128,128,Ze),new Lr(8,32,128,256,Ze),new Lr(32,128,258,1024,Ze),new Lr(32,258,258,4096,Ze)];function Rr(de){de.window_size=2*de.w_size,ue(de.head),de.max_lazy_match=Dr[de.level].max_lazy,de.good_match=Dr[de.level].good_length,de.nice_match=Dr[de.level].nice_length,de.max_chain_length=Dr[de.level].max_chain,de.strstart=0,de.block_start=0,de.lookahead=0,de.insert=0,de.match_length=de.prev_length=L-1,de.match_available=0,de.ins_h=0}function ke(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=O,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new t.Buf16(G*2),this.dyn_dtree=new t.Buf16((2*H+1)*2),this.bl_tree=new t.Buf16((2*z+1)*2),ue(this.dyn_ltree),ue(this.dyn_dtree),ue(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new t.Buf16(W+1),this.heap=new t.Buf16(2*F+1),ue(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new t.Buf16(2*F+1),ue(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Yt(de){var qe;return!de||!de.state?Oe(de,p):(de.total_in=de.total_out=0,de.data_type=E,qe=de.state,qe.pending=0,qe.pending_out=0,qe.wrap<0&&(qe.wrap=-qe.wrap),qe.status=qe.wrap?k:Q,de.adler=qe.wrap===2?0:1,qe.last_flush=s,e._tr_init(qe),u)}function Ut(de){var qe=Yt(de);return qe===u&&Rr(de.state),qe}function ar(de,qe){return!de||!de.state||de.state.wrap!==2?p:(de.state.gzhead=qe,u)}function Fe(de,qe,lt,Ne,et,At){if(!de)return p;var dr=1;if(qe===y&&(qe=6),Ne<0?(dr=0,Ne=-Ne):Ne>15&&(dr=2,Ne-=16),et<1||et>_||lt!==O||Ne<8||Ne>15||qe<0||qe>9||At<0||At>I)return Oe(de,p);Ne===8&&(Ne=9);var vr=new ke;return de.state=vr,vr.strm=de,vr.wrap=dr,vr.gzhead=null,vr.w_bits=Ne,vr.w_size=1<<vr.w_bits,vr.w_mask=vr.w_size-1,vr.hash_bits=et+7,vr.hash_size=1<<vr.hash_bits,vr.hash_mask=vr.hash_size-1,vr.hash_shift=~~((vr.hash_bits+L-1)/L),vr.window=new t.Buf8(vr.w_size*2),vr.head=new t.Buf16(vr.hash_size),vr.prev=new t.Buf16(vr.w_size),vr.lit_bufsize=1<<et+6,vr.pending_buf_size=vr.lit_bufsize*4,vr.pending_buf=new t.Buf8(vr.pending_buf_size),vr.d_buf=1*vr.lit_bufsize,vr.l_buf=3*vr.lit_bufsize,vr.level=qe,vr.strategy=At,vr.method=lt,Ut(de)}function it(de,qe){return Fe(de,qe,O,R,v,C)}function ye(de,qe){var lt,Ne,et,At;if(!de||!de.state||qe>h||qe<0)return de?Oe(de,p):p;if(Ne=de.state,!de.output||!de.input&&de.avail_in!==0||Ne.status===ae&&qe!==c)return Oe(de,de.avail_out===0?g:p);if(Ne.strm=de,lt=Ne.last_flush,Ne.last_flush=qe,Ne.status===k)if(Ne.wrap===2)de.adler=0,J(Ne,31),J(Ne,139),J(Ne,8),Ne.gzhead?(J(Ne,(Ne.gzhead.text?1:0)+(Ne.gzhead.hcrc?2:0)+(Ne.gzhead.extra?4:0)+(Ne.gzhead.name?8:0)+(Ne.gzhead.comment?16:0)),J(Ne,Ne.gzhead.time&255),J(Ne,Ne.gzhead.time>>8&255),J(Ne,Ne.gzhead.time>>16&255),J(Ne,Ne.gzhead.time>>24&255),J(Ne,Ne.level===9?2:Ne.strategy>=P||Ne.level<2?4:0),J(Ne,Ne.gzhead.os&255),Ne.gzhead.extra&&Ne.gzhead.extra.length&&(J(Ne,Ne.gzhead.extra.length&255),J(Ne,Ne.gzhead.extra.length>>8&255)),Ne.gzhead.hcrc&&(de.adler=i(de.adler,Ne.pending_buf,Ne.pending,0)),Ne.gzindex=0,Ne.status=V):(J(Ne,0),J(Ne,0),J(Ne,0),J(Ne,0),J(Ne,0),J(Ne,Ne.level===9?2:Ne.strategy>=P||Ne.level<2?4:0),J(Ne,me),Ne.status=Q);else{var dr=O+(Ne.w_bits-8<<4)<<8,vr=-1;Ne.strategy>=P||Ne.level<2?vr=0:Ne.level<6?vr=1:Ne.level===6?vr=2:vr=3,dr|=vr<<6,Ne.strstart!==0&&(dr|=U),dr+=31-dr%31,Ne.status=Q,oe(Ne,dr),Ne.strstart!==0&&(oe(Ne,de.adler>>>16),oe(Ne,de.adler&65535)),de.adler=1}if(Ne.status===V)if(Ne.gzhead.extra){for(et=Ne.pending;Ne.gzindex<(Ne.gzhead.extra.length&65535)&&!(Ne.pending===Ne.pending_buf_size&&(Ne.gzhead.hcrc&&Ne.pending>et&&(de.adler=i(de.adler,Ne.pending_buf,Ne.pending-et,et)),Pe(de),et=Ne.pending,Ne.pending===Ne.pending_buf_size));)J(Ne,Ne.gzhead.extra[Ne.gzindex]&255),Ne.gzindex++;Ne.gzhead.hcrc&&Ne.pending>et&&(de.adler=i(de.adler,Ne.pending_buf,Ne.pending-et,et)),Ne.gzindex===Ne.gzhead.extra.length&&(Ne.gzindex=0,Ne.status=Y)}else Ne.status=Y;if(Ne.status===Y)if(Ne.gzhead.name){et=Ne.pending;do{if(Ne.pending===Ne.pending_buf_size&&(Ne.gzhead.hcrc&&Ne.pending>et&&(de.adler=i(de.adler,Ne.pending_buf,Ne.pending-et,et)),Pe(de),et=Ne.pending,Ne.pending===Ne.pending_buf_size)){At=1;break}Ne.gzindex<Ne.gzhead.name.length?At=Ne.gzhead.name.charCodeAt(Ne.gzindex++)&255:At=0,J(Ne,At)}while(At!==0);Ne.gzhead.hcrc&&Ne.pending>et&&(de.adler=i(de.adler,Ne.pending_buf,Ne.pending-et,et)),At===0&&(Ne.gzindex=0,Ne.status=X)}else Ne.status=X;if(Ne.status===X)if(Ne.gzhead.comment){et=Ne.pending;do{if(Ne.pending===Ne.pending_buf_size&&(Ne.gzhead.hcrc&&Ne.pending>et&&(de.adler=i(de.adler,Ne.pending_buf,Ne.pending-et,et)),Pe(de),et=Ne.pending,Ne.pending===Ne.pending_buf_size)){At=1;break}Ne.gzindex<Ne.gzhead.comment.length?At=Ne.gzhead.comment.charCodeAt(Ne.gzindex++)&255:At=0,J(Ne,At)}while(At!==0);Ne.gzhead.hcrc&&Ne.pending>et&&(de.adler=i(de.adler,Ne.pending_buf,Ne.pending-et,et)),At===0&&(Ne.status=Z)}else Ne.status=Z;if(Ne.status===Z&&(Ne.gzhead.hcrc?(Ne.pending+2>Ne.pending_buf_size&&Pe(de),Ne.pending+2<=Ne.pending_buf_size&&(J(Ne,de.adler&255),J(Ne,de.adler>>8&255),de.adler=0,Ne.status=Q)):Ne.status=Q),Ne.pending!==0){if(Pe(de),de.avail_out===0)return Ne.last_flush=-1,u}else if(de.avail_in===0&&Ie(qe)<=Ie(lt)&&qe!==c)return Oe(de,g);if(Ne.status===ae&&de.avail_in!==0)return Oe(de,g);if(de.avail_in!==0||Ne.lookahead!==0||qe!==s&&Ne.status!==ae){var Zr=Ne.strategy===P?Nr(Ne,qe):Ne.strategy===T?Wt(Ne,qe):Dr[Ne.level].func(Ne,qe);if((Zr===se||Zr===K)&&(Ne.status=ae),Zr===he||Zr===se)return de.avail_out===0&&(Ne.last_flush=-1),u;if(Zr===re&&(qe===a?e._tr_align(Ne):qe!==h&&(e._tr_stored_block(Ne,0,0,!1),qe===l&&(ue(Ne.head),Ne.lookahead===0&&(Ne.strstart=0,Ne.block_start=0,Ne.insert=0))),Pe(de),de.avail_out===0))return Ne.last_flush=-1,u}return qe!==c?u:Ne.wrap<=0?d:(Ne.wrap===2?(J(Ne,de.adler&255),J(Ne,de.adler>>8&255),J(Ne,de.adler>>16&255),J(Ne,de.adler>>24&255),J(Ne,de.total_in&255),J(Ne,de.total_in>>8&255),J(Ne,de.total_in>>16&255),J(Ne,de.total_in>>24&255)):(oe(Ne,de.adler>>>16),oe(Ne,de.adler&65535)),Pe(de),Ne.wrap>0&&(Ne.wrap=-Ne.wrap),Ne.pending!==0?u:d)}function bt(de){var qe;return!de||!de.state?p:(qe=de.state.status,qe!==k&&qe!==V&&qe!==Y&&qe!==X&&qe!==Z&&qe!==Q&&qe!==ae?Oe(de,p):(de.state=null,qe===Q?Oe(de,m):u))}function zt(de,qe){var lt=qe.length,Ne,et,At,dr,vr,Zr,xi,Zi;if(!de||!de.state||(Ne=de.state,dr=Ne.wrap,dr===2||dr===1&&Ne.status!==k||Ne.lookahead))return p;for(dr===1&&(de.adler=r(de.adler,qe,lt,0)),Ne.wrap=0,lt>=Ne.w_size&&(dr===0&&(ue(Ne.head),Ne.strstart=0,Ne.block_start=0,Ne.insert=0),Zi=new t.Buf8(Ne.w_size),t.arraySet(Zi,qe,lt-Ne.w_size,Ne.w_size,0),qe=Zi,lt=Ne.w_size),vr=de.avail_in,Zr=de.next_in,xi=de.input,de.avail_in=lt,de.next_in=0,de.input=qe,Se(Ne);Ne.lookahead>=L;){et=Ne.strstart,At=Ne.lookahead-(L-1);do Ne.ins_h=(Ne.ins_h<<Ne.hash_shift^Ne.window[et+L-1])&Ne.hash_mask,Ne.prev[et&Ne.w_mask]=Ne.head[Ne.ins_h],Ne.head[Ne.ins_h]=et,et++;while(--At);Ne.strstart=et,Ne.lookahead=L-1,Se(Ne)}return Ne.strstart+=Ne.lookahead,Ne.block_start=Ne.strstart,Ne.insert=Ne.lookahead,Ne.lookahead=0,Ne.match_length=Ne.prev_length=L-1,Ne.match_available=0,de.next_in=Zr,de.input=xi,de.avail_in=vr,Ne.wrap=dr,u}o.deflateInit=it,o.deflateInit2=Fe,o.deflateReset=Ut,o.deflateResetKeep=Yt,o.deflateSetHeader=ar,o.deflate=ye,o.deflateEnd=bt,o.deflateSetDictionary=zt,o.deflateInfo="pako deflate (from Nodeca project)"}),FDe=Xn(o=>{"use strict";var t=Mv(),e=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch{e=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{r=!1}var i=new t.Buf8(256);for(n=0;n<256;n++)i[n]=n>=252?6:n>=248?5:n>=240?4:n>=224?3:n>=192?2:1;var n;i[254]=i[254]=1,o.string2buf=function(a){var l,c,h,u,d,p=a.length,m=0;for(u=0;u<p;u++)c=a.charCodeAt(u),(c&64512)===55296&&u+1<p&&(h=a.charCodeAt(u+1),(h&64512)===56320&&(c=65536+(c-55296<<10)+(h-56320),u++)),m+=c<128?1:c<2048?2:c<65536?3:4;for(l=new t.Buf8(m),d=0,u=0;d<m;u++)c=a.charCodeAt(u),(c&64512)===55296&&u+1<p&&(h=a.charCodeAt(u+1),(h&64512)===56320&&(c=65536+(c-55296<<10)+(h-56320),u++)),c<128?l[d++]=c:c<2048?(l[d++]=192|c>>>6,l[d++]=128|c&63):c<65536?(l[d++]=224|c>>>12,l[d++]=128|c>>>6&63,l[d++]=128|c&63):(l[d++]=240|c>>>18,l[d++]=128|c>>>12&63,l[d++]=128|c>>>6&63,l[d++]=128|c&63);return l};function s(a,l){if(l<65534&&(a.subarray&&r||!a.subarray&&e))return String.fromCharCode.apply(null,t.shrinkBuf(a,l));for(var c="",h=0;h<l;h++)c+=String.fromCharCode(a[h]);return c}o.buf2binstring=function(a){return s(a,a.length)},o.binstring2buf=function(a){for(var l=new t.Buf8(a.length),c=0,h=l.length;c<h;c++)l[c]=a.charCodeAt(c);return l},o.buf2string=function(a,l){var c,h,u,d,p=l||a.length,m=new Array(p*2);for(h=0,c=0;c<p;){if(u=a[c++],u<128){m[h++]=u;continue}if(d=i[u],d>4){m[h++]=65533,c+=d-1;continue}for(u&=d===2?31:d===3?15:7;d>1&&c<p;)u=u<<6|a[c++]&63,d--;if(d>1){m[h++]=65533;continue}u<65536?m[h++]=u:(u-=65536,m[h++]=55296|u>>10&1023,m[h++]=56320|u&1023)}return s(m,h)},o.utf8border=function(a,l){var c;for(l=l||a.length,l>a.length&&(l=a.length),c=l-1;c>=0&&(a[c]&192)===128;)c--;return c<0||c===0?l:c+i[a[c]]>l?c:l}}),VDe=Xn((o,t)=>{"use strict";function e(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=e}),utt=Xn(o=>{"use strict";var t=htt(),e=Mv(),r=FDe(),i=zbe(),n=VDe(),s=Object.prototype.toString,a=0,l=4,c=0,h=1,u=2,d=-1,p=0,m=8;function g(T){if(!(this instanceof g))return new g(T);this.options=e.assign({level:d,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},T||{});var I=this.options;I.raw&&I.windowBits>0?I.windowBits=-I.windowBits:I.gzip&&I.windowBits>0&&I.windowBits<16&&(I.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new n,this.strm.avail_out=0;var C=t.deflateInit2(this.strm,I.level,I.method,I.windowBits,I.memLevel,I.strategy);if(C!==c)throw new Error(i[C]);if(I.header&&t.deflateSetHeader(this.strm,I.header),I.dictionary){var E;if(typeof I.dictionary=="string"?E=r.string2buf(I.dictionary):s.call(I.dictionary)==="[object ArrayBuffer]"?E=new Uint8Array(I.dictionary):E=I.dictionary,C=t.deflateSetDictionary(this.strm,E),C!==c)throw new Error(i[C]);this._dict_set=!0}}g.prototype.push=function(T,I){var C=this.strm,E=this.options.chunkSize,O,_;if(this.ended)return!1;_=I===~~I?I:I===!0?l:a,typeof T=="string"?C.input=r.string2buf(T):s.call(T)==="[object ArrayBuffer]"?C.input=new Uint8Array(T):C.input=T,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new e.Buf8(E),C.next_out=0,C.avail_out=E),O=t.deflate(C,_),O!==h&&O!==c)return this.onEnd(O),this.ended=!0,!1;(C.avail_out===0||C.avail_in===0&&(_===l||_===u))&&(this.options.to==="string"?this.onData(r.buf2binstring(e.shrinkBuf(C.output,C.next_out))):this.onData(e.shrinkBuf(C.output,C.next_out)))}while((C.avail_in>0||C.avail_out===0)&&O!==h);return _===l?(O=t.deflateEnd(this.strm),this.onEnd(O),this.ended=!0,O===c):(_===u&&(this.onEnd(c),C.avail_out=0),!0)},g.prototype.onData=function(T){this.chunks.push(T)},g.prototype.onEnd=function(T){T===c&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=T,this.msg=this.strm.msg};function y(T,I){var C=new g(I);if(C.push(T,!0),C.err)throw C.msg||i[C.err];return C.result}function b(T,I){return I=I||{},I.raw=!0,y(T,I)}function P(T,I){return I=I||{},I.gzip=!0,y(T,I)}o.Deflate=g,o.deflate=y,o.deflateRaw=b,o.gzip=P}),dtt=Xn((o,t)=>{"use strict";var e=30,r=12;t.exports=function(i,n){var s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v,D,w,F,H;s=i.state,a=i.next_in,F=i.input,l=a+(i.avail_in-5),c=i.next_out,H=i.output,h=c-(n-i.avail_out),u=c+(i.avail_out-257),d=s.dmax,p=s.wsize,m=s.whave,g=s.wnext,y=s.window,b=s.hold,P=s.bits,T=s.lencode,I=s.distcode,C=(1<<s.lenbits)-1,E=(1<<s.distbits)-1;e:do{P<15&&(b+=F[a++]<<P,P+=8,b+=F[a++]<<P,P+=8),O=T[b&C];t:for(;;){if(_=O>>>24,b>>>=_,P-=_,_=O>>>16&255,_===0)H[c++]=O&65535;else if(_&16){R=O&65535,_&=15,_&&(P<_&&(b+=F[a++]<<P,P+=8),R+=b&(1<<_)-1,b>>>=_,P-=_),P<15&&(b+=F[a++]<<P,P+=8,b+=F[a++]<<P,P+=8),O=I[b&E];r:for(;;){if(_=O>>>24,b>>>=_,P-=_,_=O>>>16&255,_&16){if(v=O&65535,_&=15,P<_&&(b+=F[a++]<<P,P+=8,P<_&&(b+=F[a++]<<P,P+=8)),v+=b&(1<<_)-1,v>d){i.msg="invalid distance too far back",s.mode=e;break e}if(b>>>=_,P-=_,_=c-h,v>_){if(_=v-_,_>m&&s.sane){i.msg="invalid distance too far back",s.mode=e;break e}if(D=0,w=y,g===0){if(D+=p-_,_<R){R-=_;do H[c++]=y[D++];while(--_);D=c-v,w=H}}else if(g<_){if(D+=p+g-_,_-=g,_<R){R-=_;do H[c++]=y[D++];while(--_);if(D=0,g<R){_=g,R-=_;do H[c++]=y[D++];while(--_);D=c-v,w=H}}}else if(D+=g-_,_<R){R-=_;do H[c++]=y[D++];while(--_);D=c-v,w=H}for(;R>2;)H[c++]=w[D++],H[c++]=w[D++],H[c++]=w[D++],R-=3;R&&(H[c++]=w[D++],R>1&&(H[c++]=w[D++]))}else{D=c-v;do H[c++]=H[D++],H[c++]=H[D++],H[c++]=H[D++],R-=3;while(R>2);R&&(H[c++]=H[D++],R>1&&(H[c++]=H[D++]))}}else if((_&64)===0){O=I[(O&65535)+(b&(1<<_)-1)];continue r}else{i.msg="invalid distance code",s.mode=e;break e}break}}else if((_&64)===0){O=T[(O&65535)+(b&(1<<_)-1)];continue t}else if(_&32){s.mode=r;break e}else{i.msg="invalid literal/length code",s.mode=e;break e}break}}while(a<l&&c<u);R=P>>3,a-=R,P-=R<<3,b&=(1<<P)-1,i.next_in=a,i.next_out=c,i.avail_in=a<l?5+(l-a):5-(a-l),i.avail_out=c<u?257+(u-c):257-(c-u),s.hold=b,s.bits=P}}),ptt=Xn((o,t)=>{"use strict";var e=Mv(),r=15,i=852,n=592,s=0,a=1,l=2,c=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],h=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],u=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(p,m,g,y,b,P,T,I){var C=I.bits,E=0,O=0,_=0,R=0,v=0,D=0,w=0,F=0,H=0,z=0,G,W,L,B,N,U=null,k=0,V,Y=new e.Buf16(r+1),X=new e.Buf16(r+1),Z=null,Q=0,ae,he,re;for(E=0;E<=r;E++)Y[E]=0;for(O=0;O<y;O++)Y[m[g+O]]++;for(v=C,R=r;R>=1&&Y[R]===0;R--);if(v>R&&(v=R),R===0)return b[P++]=1<<24|64<<16|0,b[P++]=1<<24|64<<16|0,I.bits=1,0;for(_=1;_<R&&Y[_]===0;_++);for(v<_&&(v=_),F=1,E=1;E<=r;E++)if(F<<=1,F-=Y[E],F<0)return-1;if(F>0&&(p===s||R!==1))return-1;for(X[1]=0,E=1;E<r;E++)X[E+1]=X[E]+Y[E];for(O=0;O<y;O++)m[g+O]!==0&&(T[X[m[g+O]]++]=O);if(p===s?(U=Z=T,V=19):p===a?(U=c,k-=257,Z=h,Q-=257,V=256):(U=u,Z=d,V=-1),z=0,O=0,E=_,N=P,D=v,w=0,L=-1,H=1<<v,B=H-1,p===a&&H>i||p===l&&H>n)return 1;for(;;){ae=E-w,T[O]<V?(he=0,re=T[O]):T[O]>V?(he=Z[Q+T[O]],re=U[k+T[O]]):(he=96,re=0),G=1<<E-w,W=1<<D,_=W;do W-=G,b[N+(z>>w)+W]=ae<<24|he<<16|re|0;while(W!==0);for(G=1<<E-1;z&G;)G>>=1;if(G!==0?(z&=G-1,z+=G):z=0,O++,--Y[E]===0){if(E===R)break;E=m[g+T[O]]}if(E>v&&(z&B)!==L){for(w===0&&(w=v),N+=_,D=E-w,F=1<<D;D+w<R&&(F-=Y[D+w],!(F<=0));)D++,F<<=1;if(H+=1<<D,p===a&&H>i||p===l&&H>n)return 1;L=z&B,b[L]=v<<24|D<<16|N-P|0}}return z!==0&&(b[N+z]=E-w<<24|64<<16|0),I.bits=v,0}}),ftt=Xn(o=>{"use strict";var t=Mv(),e=kDe(),r=BDe(),i=dtt(),n=ptt(),s=0,a=1,l=2,c=4,h=5,u=6,d=0,p=1,m=2,g=-2,y=-3,b=-4,P=-5,T=8,I=1,C=2,E=3,O=4,_=5,R=6,v=7,D=8,w=9,F=10,H=11,z=12,G=13,W=14,L=15,B=16,N=17,U=18,k=19,V=20,Y=21,X=22,Z=23,Q=24,ae=25,he=26,re=27,se=28,K=29,me=30,Oe=31,Ie=32,ue=852,Pe=592,j=15,J=j;function oe(Fe){return(Fe>>>24&255)+(Fe>>>8&65280)+((Fe&65280)<<8)+((Fe&255)<<24)}function pe(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new t.Buf16(320),this.work=new t.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ge(Fe){var it;return!Fe||!Fe.state?g:(it=Fe.state,Fe.total_in=Fe.total_out=it.total=0,Fe.msg="",it.wrap&&(Fe.adler=it.wrap&1),it.mode=I,it.last=0,it.havedict=0,it.dmax=32768,it.head=null,it.hold=0,it.bits=0,it.lencode=it.lendyn=new t.Buf32(ue),it.distcode=it.distdyn=new t.Buf32(Pe),it.sane=1,it.back=-1,d)}function Se(Fe){var it;return!Fe||!Fe.state?g:(it=Fe.state,it.wsize=0,it.whave=0,it.wnext=0,ge(Fe))}function De(Fe,it){var ye,bt;return!Fe||!Fe.state||(bt=Fe.state,it<0?(ye=0,it=-it):(ye=(it>>4)+1,it<48&&(it&=15)),it&&(it<8||it>15))?g:(bt.window!==null&&bt.wbits!==it&&(bt.window=null),bt.wrap=ye,bt.wbits=it,Se(Fe))}function tt(Fe,it){var ye,bt;return Fe?(bt=new pe,Fe.state=bt,bt.window=null,ye=De(Fe,it),ye!==d&&(Fe.state=null),ye):g}function Ze(Fe){return tt(Fe,J)}var Wt=!0,Nr,Lr;function Dr(Fe){if(Wt){var it;for(Nr=new t.Buf32(512),Lr=new t.Buf32(32),it=0;it<144;)Fe.lens[it++]=8;for(;it<256;)Fe.lens[it++]=9;for(;it<280;)Fe.lens[it++]=7;for(;it<288;)Fe.lens[it++]=8;for(n(a,Fe.lens,0,288,Nr,0,Fe.work,{bits:9}),it=0;it<32;)Fe.lens[it++]=5;n(l,Fe.lens,0,32,Lr,0,Fe.work,{bits:5}),Wt=!1}Fe.lencode=Nr,Fe.lenbits=9,Fe.distcode=Lr,Fe.distbits=5}function Rr(Fe,it,ye,bt){var zt,de=Fe.state;return de.window===null&&(de.wsize=1<<de.wbits,de.wnext=0,de.whave=0,de.window=new t.Buf8(de.wsize)),bt>=de.wsize?(t.arraySet(de.window,it,ye-de.wsize,de.wsize,0),de.wnext=0,de.whave=de.wsize):(zt=de.wsize-de.wnext,zt>bt&&(zt=bt),t.arraySet(de.window,it,ye-bt,zt,de.wnext),bt-=zt,bt?(t.arraySet(de.window,it,ye-bt,bt,0),de.wnext=bt,de.whave=de.wsize):(de.wnext+=zt,de.wnext===de.wsize&&(de.wnext=0),de.whave<de.wsize&&(de.whave+=zt))),0}function ke(Fe,it){var ye,bt,zt,de,qe,lt,Ne,et,At,dr,vr,Zr,xi,Zi,Fi=0,$i,yo,Ha,da,Ic,kp,Cc,Dt,Al=new t.Buf8(4),ht,_t,rr=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!Fe||!Fe.state||!Fe.output||!Fe.input&&Fe.avail_in!==0)return g;ye=Fe.state,ye.mode===z&&(ye.mode=G),qe=Fe.next_out,zt=Fe.output,Ne=Fe.avail_out,de=Fe.next_in,bt=Fe.input,lt=Fe.avail_in,et=ye.hold,At=ye.bits,dr=lt,vr=Ne,Dt=d;e:for(;;)switch(ye.mode){case I:if(ye.wrap===0){ye.mode=G;break}for(;At<16;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}if(ye.wrap&2&&et===35615){ye.check=0,Al[0]=et&255,Al[1]=et>>>8&255,ye.check=r(ye.check,Al,2,0),et=0,At=0,ye.mode=C;break}if(ye.flags=0,ye.head&&(ye.head.done=!1),!(ye.wrap&1)||(((et&255)<<8)+(et>>8))%31){Fe.msg="incorrect header check",ye.mode=me;break}if((et&15)!==T){Fe.msg="unknown compression method",ye.mode=me;break}if(et>>>=4,At-=4,Cc=(et&15)+8,ye.wbits===0)ye.wbits=Cc;else if(Cc>ye.wbits){Fe.msg="invalid window size",ye.mode=me;break}ye.dmax=1<<Cc,Fe.adler=ye.check=1,ye.mode=et&512?F:z,et=0,At=0;break;case C:for(;At<16;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}if(ye.flags=et,(ye.flags&255)!==T){Fe.msg="unknown compression method",ye.mode=me;break}if(ye.flags&57344){Fe.msg="unknown header flags set",ye.mode=me;break}ye.head&&(ye.head.text=et>>8&1),ye.flags&512&&(Al[0]=et&255,Al[1]=et>>>8&255,ye.check=r(ye.check,Al,2,0)),et=0,At=0,ye.mode=E;case E:for(;At<32;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}ye.head&&(ye.head.time=et),ye.flags&512&&(Al[0]=et&255,Al[1]=et>>>8&255,Al[2]=et>>>16&255,Al[3]=et>>>24&255,ye.check=r(ye.check,Al,4,0)),et=0,At=0,ye.mode=O;case O:for(;At<16;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}ye.head&&(ye.head.xflags=et&255,ye.head.os=et>>8),ye.flags&512&&(Al[0]=et&255,Al[1]=et>>>8&255,ye.check=r(ye.check,Al,2,0)),et=0,At=0,ye.mode=_;case _:if(ye.flags&1024){for(;At<16;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}ye.length=et,ye.head&&(ye.head.extra_len=et),ye.flags&512&&(Al[0]=et&255,Al[1]=et>>>8&255,ye.check=r(ye.check,Al,2,0)),et=0,At=0}else ye.head&&(ye.head.extra=null);ye.mode=R;case R:if(ye.flags&1024&&(Zr=ye.length,Zr>lt&&(Zr=lt),Zr&&(ye.head&&(Cc=ye.head.extra_len-ye.length,ye.head.extra||(ye.head.extra=new Array(ye.head.extra_len)),t.arraySet(ye.head.extra,bt,de,Zr,Cc)),ye.flags&512&&(ye.check=r(ye.check,bt,Zr,de)),lt-=Zr,de+=Zr,ye.length-=Zr),ye.length))break e;ye.length=0,ye.mode=v;case v:if(ye.flags&2048){if(lt===0)break e;Zr=0;do Cc=bt[de+Zr++],ye.head&&Cc&&ye.length<65536&&(ye.head.name+=String.fromCharCode(Cc));while(Cc&&Zr<lt);if(ye.flags&512&&(ye.check=r(ye.check,bt,Zr,de)),lt-=Zr,de+=Zr,Cc)break e}else ye.head&&(ye.head.name=null);ye.length=0,ye.mode=D;case D:if(ye.flags&4096){if(lt===0)break e;Zr=0;do Cc=bt[de+Zr++],ye.head&&Cc&&ye.length<65536&&(ye.head.comment+=String.fromCharCode(Cc));while(Cc&&Zr<lt);if(ye.flags&512&&(ye.check=r(ye.check,bt,Zr,de)),lt-=Zr,de+=Zr,Cc)break e}else ye.head&&(ye.head.comment=null);ye.mode=w;case w:if(ye.flags&512){for(;At<16;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}if(et!==(ye.check&65535)){Fe.msg="header crc mismatch",ye.mode=me;break}et=0,At=0}ye.head&&(ye.head.hcrc=ye.flags>>9&1,ye.head.done=!0),Fe.adler=ye.check=0,ye.mode=z;break;case F:for(;At<32;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}Fe.adler=ye.check=oe(et),et=0,At=0,ye.mode=H;case H:if(ye.havedict===0)return Fe.next_out=qe,Fe.avail_out=Ne,Fe.next_in=de,Fe.avail_in=lt,ye.hold=et,ye.bits=At,m;Fe.adler=ye.check=1,ye.mode=z;case z:if(it===h||it===u)break e;case G:if(ye.last){et>>>=At&7,At-=At&7,ye.mode=re;break}for(;At<3;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}switch(ye.last=et&1,et>>>=1,At-=1,et&3){case 0:ye.mode=W;break;case 1:if(Dr(ye),ye.mode=V,it===u){et>>>=2,At-=2;break e}break;case 2:ye.mode=N;break;case 3:Fe.msg="invalid block type",ye.mode=me}et>>>=2,At-=2;break;case W:for(et>>>=At&7,At-=At&7;At<32;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}if((et&65535)!==(et>>>16^65535)){Fe.msg="invalid stored block lengths",ye.mode=me;break}if(ye.length=et&65535,et=0,At=0,ye.mode=L,it===u)break e;case L:ye.mode=B;case B:if(Zr=ye.length,Zr){if(Zr>lt&&(Zr=lt),Zr>Ne&&(Zr=Ne),Zr===0)break e;t.arraySet(zt,bt,de,Zr,qe),lt-=Zr,de+=Zr,Ne-=Zr,qe+=Zr,ye.length-=Zr;break}ye.mode=z;break;case N:for(;At<14;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}if(ye.nlen=(et&31)+257,et>>>=5,At-=5,ye.ndist=(et&31)+1,et>>>=5,At-=5,ye.ncode=(et&15)+4,et>>>=4,At-=4,ye.nlen>286||ye.ndist>30){Fe.msg="too many length or distance symbols",ye.mode=me;break}ye.have=0,ye.mode=U;case U:for(;ye.have<ye.ncode;){for(;At<3;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}ye.lens[rr[ye.have++]]=et&7,et>>>=3,At-=3}for(;ye.have<19;)ye.lens[rr[ye.have++]]=0;if(ye.lencode=ye.lendyn,ye.lenbits=7,ht={bits:ye.lenbits},Dt=n(s,ye.lens,0,19,ye.lencode,0,ye.work,ht),ye.lenbits=ht.bits,Dt){Fe.msg="invalid code lengths set",ye.mode=me;break}ye.have=0,ye.mode=k;case k:for(;ye.have<ye.nlen+ye.ndist;){for(;Fi=ye.lencode[et&(1<<ye.lenbits)-1],$i=Fi>>>24,yo=Fi>>>16&255,Ha=Fi&65535,!($i<=At);){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}if(Ha<16)et>>>=$i,At-=$i,ye.lens[ye.have++]=Ha;else{if(Ha===16){for(_t=$i+2;At<_t;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}if(et>>>=$i,At-=$i,ye.have===0){Fe.msg="invalid bit length repeat",ye.mode=me;break}Cc=ye.lens[ye.have-1],Zr=3+(et&3),et>>>=2,At-=2}else if(Ha===17){for(_t=$i+3;At<_t;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}et>>>=$i,At-=$i,Cc=0,Zr=3+(et&7),et>>>=3,At-=3}else{for(_t=$i+7;At<_t;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}et>>>=$i,At-=$i,Cc=0,Zr=11+(et&127),et>>>=7,At-=7}if(ye.have+Zr>ye.nlen+ye.ndist){Fe.msg="invalid bit length repeat",ye.mode=me;break}for(;Zr--;)ye.lens[ye.have++]=Cc}}if(ye.mode===me)break;if(ye.lens[256]===0){Fe.msg="invalid code -- missing end-of-block",ye.mode=me;break}if(ye.lenbits=9,ht={bits:ye.lenbits},Dt=n(a,ye.lens,0,ye.nlen,ye.lencode,0,ye.work,ht),ye.lenbits=ht.bits,Dt){Fe.msg="invalid literal/lengths set",ye.mode=me;break}if(ye.distbits=6,ye.distcode=ye.distdyn,ht={bits:ye.distbits},Dt=n(l,ye.lens,ye.nlen,ye.ndist,ye.distcode,0,ye.work,ht),ye.distbits=ht.bits,Dt){Fe.msg="invalid distances set",ye.mode=me;break}if(ye.mode=V,it===u)break e;case V:ye.mode=Y;case Y:if(lt>=6&&Ne>=258){Fe.next_out=qe,Fe.avail_out=Ne,Fe.next_in=de,Fe.avail_in=lt,ye.hold=et,ye.bits=At,i(Fe,vr),qe=Fe.next_out,zt=Fe.output,Ne=Fe.avail_out,de=Fe.next_in,bt=Fe.input,lt=Fe.avail_in,et=ye.hold,At=ye.bits,ye.mode===z&&(ye.back=-1);break}for(ye.back=0;Fi=ye.lencode[et&(1<<ye.lenbits)-1],$i=Fi>>>24,yo=Fi>>>16&255,Ha=Fi&65535,!($i<=At);){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}if(yo&&(yo&240)===0){for(da=$i,Ic=yo,kp=Ha;Fi=ye.lencode[kp+((et&(1<<da+Ic)-1)>>da)],$i=Fi>>>24,yo=Fi>>>16&255,Ha=Fi&65535,!(da+$i<=At);){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}et>>>=da,At-=da,ye.back+=da}if(et>>>=$i,At-=$i,ye.back+=$i,ye.length=Ha,yo===0){ye.mode=he;break}if(yo&32){ye.back=-1,ye.mode=z;break}if(yo&64){Fe.msg="invalid literal/length code",ye.mode=me;break}ye.extra=yo&15,ye.mode=X;case X:if(ye.extra){for(_t=ye.extra;At<_t;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}ye.length+=et&(1<<ye.extra)-1,et>>>=ye.extra,At-=ye.extra,ye.back+=ye.extra}ye.was=ye.length,ye.mode=Z;case Z:for(;Fi=ye.distcode[et&(1<<ye.distbits)-1],$i=Fi>>>24,yo=Fi>>>16&255,Ha=Fi&65535,!($i<=At);){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}if((yo&240)===0){for(da=$i,Ic=yo,kp=Ha;Fi=ye.distcode[kp+((et&(1<<da+Ic)-1)>>da)],$i=Fi>>>24,yo=Fi>>>16&255,Ha=Fi&65535,!(da+$i<=At);){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}et>>>=da,At-=da,ye.back+=da}if(et>>>=$i,At-=$i,ye.back+=$i,yo&64){Fe.msg="invalid distance code",ye.mode=me;break}ye.offset=Ha,ye.extra=yo&15,ye.mode=Q;case Q:if(ye.extra){for(_t=ye.extra;At<_t;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}ye.offset+=et&(1<<ye.extra)-1,et>>>=ye.extra,At-=ye.extra,ye.back+=ye.extra}if(ye.offset>ye.dmax){Fe.msg="invalid distance too far back",ye.mode=me;break}ye.mode=ae;case ae:if(Ne===0)break e;if(Zr=vr-Ne,ye.offset>Zr){if(Zr=ye.offset-Zr,Zr>ye.whave&&ye.sane){Fe.msg="invalid distance too far back",ye.mode=me;break}Zr>ye.wnext?(Zr-=ye.wnext,xi=ye.wsize-Zr):xi=ye.wnext-Zr,Zr>ye.length&&(Zr=ye.length),Zi=ye.window}else Zi=zt,xi=qe-ye.offset,Zr=ye.length;Zr>Ne&&(Zr=Ne),Ne-=Zr,ye.length-=Zr;do zt[qe++]=Zi[xi++];while(--Zr);ye.length===0&&(ye.mode=Y);break;case he:if(Ne===0)break e;zt[qe++]=ye.length,Ne--,ye.mode=Y;break;case re:if(ye.wrap){for(;At<32;){if(lt===0)break e;lt--,et|=bt[de++]<<At,At+=8}if(vr-=Ne,Fe.total_out+=vr,ye.total+=vr,vr&&(Fe.adler=ye.check=ye.flags?r(ye.check,zt,vr,qe-vr):e(ye.check,zt,vr,qe-vr)),vr=Ne,(ye.flags?et:oe(et))!==ye.check){Fe.msg="incorrect data check",ye.mode=me;break}et=0,At=0}ye.mode=se;case se:if(ye.wrap&&ye.flags){for(;At<32;){if(lt===0)break e;lt--,et+=bt[de++]<<At,At+=8}if(et!==(ye.total&4294967295)){Fe.msg="incorrect length check",ye.mode=me;break}et=0,At=0}ye.mode=K;case K:Dt=p;break e;case me:Dt=y;break e;case Oe:return b;case Ie:default:return g}return Fe.next_out=qe,Fe.avail_out=Ne,Fe.next_in=de,Fe.avail_in=lt,ye.hold=et,ye.bits=At,(ye.wsize||vr!==Fe.avail_out&&ye.mode<me&&(ye.mode<re||it!==c))&&Rr(Fe,Fe.output,Fe.next_out,vr-Fe.avail_out)?(ye.mode=Oe,b):(dr-=Fe.avail_in,vr-=Fe.avail_out,Fe.total_in+=dr,Fe.total_out+=vr,ye.total+=vr,ye.wrap&&vr&&(Fe.adler=ye.check=ye.flags?r(ye.check,zt,vr,Fe.next_out-vr):e(ye.check,zt,vr,Fe.next_out-vr)),Fe.data_type=ye.bits+(ye.last?64:0)+(ye.mode===z?128:0)+(ye.mode===V||ye.mode===L?256:0),(dr===0&&vr===0||it===c)&&Dt===d&&(Dt=P),Dt)}function Yt(Fe){if(!Fe||!Fe.state)return g;var it=Fe.state;return it.window&&(it.window=null),Fe.state=null,d}function Ut(Fe,it){var ye;return!Fe||!Fe.state||(ye=Fe.state,(ye.wrap&2)===0)?g:(ye.head=it,it.done=!1,d)}function ar(Fe,it){var ye=it.length,bt,zt,de;return!Fe||!Fe.state||(bt=Fe.state,bt.wrap!==0&&bt.mode!==H)?g:bt.mode===H&&(zt=1,zt=e(zt,it,ye,0),zt!==bt.check)?y:(de=Rr(Fe,it,ye,ye),de?(bt.mode=Oe,b):(bt.havedict=1,d))}o.inflateReset=Se,o.inflateReset2=De,o.inflateResetKeep=ge,o.inflateInit=Ze,o.inflateInit2=tt,o.inflate=ke,o.inflateEnd=Yt,o.inflateGetHeader=Ut,o.inflateSetDictionary=ar,o.inflateInfo="pako inflate (from Nodeca project)"}),GDe=Xn((o,t)=>{"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}}),mtt=Xn((o,t)=>{"use strict";function e(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}t.exports=e}),gtt=Xn(o=>{"use strict";var t=ftt(),e=Mv(),r=FDe(),i=GDe(),n=zbe(),s=VDe(),a=mtt(),l=Object.prototype.toString;function c(d){if(!(this instanceof c))return new c(d);this.options=e.assign({chunkSize:16384,windowBits:0,to:""},d||{});var p=this.options;p.raw&&p.windowBits>=0&&p.windowBits<16&&(p.windowBits=-p.windowBits,p.windowBits===0&&(p.windowBits=-15)),p.windowBits>=0&&p.windowBits<16&&!(d&&d.windowBits)&&(p.windowBits+=32),p.windowBits>15&&p.windowBits<48&&(p.windowBits&15)===0&&(p.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var m=t.inflateInit2(this.strm,p.windowBits);if(m!==i.Z_OK)throw new Error(n[m]);if(this.header=new a,t.inflateGetHeader(this.strm,this.header),p.dictionary&&(typeof p.dictionary=="string"?p.dictionary=r.string2buf(p.dictionary):l.call(p.dictionary)==="[object ArrayBuffer]"&&(p.dictionary=new Uint8Array(p.dictionary)),p.raw&&(m=t.inflateSetDictionary(this.strm,p.dictionary),m!==i.Z_OK)))throw new Error(n[m])}c.prototype.push=function(d,p){var m=this.strm,g=this.options.chunkSize,y=this.options.dictionary,b,P,T,I,C,E=!1;if(this.ended)return!1;P=p===~~p?p:p===!0?i.Z_FINISH:i.Z_NO_FLUSH,typeof d=="string"?m.input=r.binstring2buf(d):l.call(d)==="[object ArrayBuffer]"?m.input=new Uint8Array(d):m.input=d,m.next_in=0,m.avail_in=m.input.length;do{if(m.avail_out===0&&(m.output=new e.Buf8(g),m.next_out=0,m.avail_out=g),b=t.inflate(m,i.Z_NO_FLUSH),b===i.Z_NEED_DICT&&y&&(b=t.inflateSetDictionary(this.strm,y)),b===i.Z_BUF_ERROR&&E===!0&&(b=i.Z_OK,E=!1),b!==i.Z_STREAM_END&&b!==i.Z_OK)return this.onEnd(b),this.ended=!0,!1;m.next_out&&(m.avail_out===0||b===i.Z_STREAM_END||m.avail_in===0&&(P===i.Z_FINISH||P===i.Z_SYNC_FLUSH))&&(this.options.to==="string"?(T=r.utf8border(m.output,m.next_out),I=m.next_out-T,C=r.buf2string(m.output,T),m.next_out=I,m.avail_out=g-I,I&&e.arraySet(m.output,m.output,T,I,0),this.onData(C)):this.onData(e.shrinkBuf(m.output,m.next_out))),m.avail_in===0&&m.avail_out===0&&(E=!0)}while((m.avail_in>0||m.avail_out===0)&&b!==i.Z_STREAM_END);return b===i.Z_STREAM_END&&(P=i.Z_FINISH),P===i.Z_FINISH?(b=t.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===i.Z_OK):(P===i.Z_SYNC_FLUSH&&(this.onEnd(i.Z_OK),m.avail_out=0),!0)},c.prototype.onData=function(d){this.chunks.push(d)},c.prototype.onEnd=function(d){d===i.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=d,this.msg=this.strm.msg};function h(d,p){var m=new c(p);if(m.push(d,!0),m.err)throw m.msg||n[m.err];return m.result}function u(d,p){return p=p||{},p.raw=!0,h(d,p)}o.Inflate=c,o.inflate=h,o.inflateRaw=u,o.ungzip=h}),ytt=Xn((o,t)=>{"use strict";var e=Mv().assign,r=utt(),i=gtt(),n=GDe(),s={};e(s,r,i,n),t.exports=s}),btt=Xn(o=>{"use strict";var t=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",e=ytt(),r=W0(),i=CI(),n=t?"uint8array":"array";o.magic="\b\0";function s(a,l){i.call(this,"FlateWorker/"+a),this._pako=null,this._pakoAction=a,this._pakoOptions=l,this.meta={}}r.inherits(s,i),s.prototype.processChunk=function(a){this.meta=a.meta,this._pako===null&&this._createPako(),this._pako.push(r.transformTo(n,a.data),!1)},s.prototype.flush=function(){i.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this._pako=null},s.prototype._createPako=function(){this._pako=new e[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var a=this;this._pako.onData=function(l){a.push({data:l,meta:a.meta})}},o.compressWorker=function(a){return new s("Deflate",a)},o.uncompressWorker=function(){return new s("Inflate",{})}}),UDe=Xn(o=>{"use strict";var t=CI();o.STORE={magic:"\0\0",compressWorker:function(){return new t("STORE compression")},uncompressWorker:function(){return new t("STORE decompression")}},o.DEFLATE=btt()}),HDe=Xn(o=>{"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"}),Ptt=Xn((o,t)=>{"use strict";var e=W0(),r=CI(),i=AW(),n=Hbe(),s=HDe(),a=function(m,g){var y="",b;for(b=0;b<g;b++)y+=String.fromCharCode(m&255),m=m>>>8;return y},l=function(m,g){var y=m;return m||(y=g?16893:33204),(y&65535)<<16},c=function(m){return(m||0)&63},h=function(m,g,y,b,P,T){var I=m.file,C=m.compression,E=T!==i.utf8encode,O=e.transformTo("string",T(I.name)),_=e.transformTo("string",i.utf8encode(I.name)),R=I.comment,v=e.transformTo("string",T(R)),D=e.transformTo("string",i.utf8encode(R)),w=_.length!==I.name.length,F=D.length!==R.length,H,z,G="",W="",L="",B=I.dir,N=I.date,U={crc32:0,compressedSize:0,uncompressedSize:0};(!g||y)&&(U.crc32=m.crc32,U.compressedSize=m.compressedSize,U.uncompressedSize=m.uncompressedSize);var k=0;g&&(k|=8),!E&&(w||F)&&(k|=2048);var V=0,Y=0;B&&(V|=16),P==="UNIX"?(Y=798,V|=l(I.unixPermissions,B)):(Y=20,V|=c(I.dosPermissions,B)),H=N.getUTCHours(),H=H<<6,H=H|N.getUTCMinutes(),H=H<<5,H=H|N.getUTCSeconds()/2,z=N.getUTCFullYear()-1980,z=z<<4,z=z|N.getUTCMonth()+1,z=z<<5,z=z|N.getUTCDate(),w&&(W=a(1,1)+a(n(O),4)+_,G+="up"+a(W.length,2)+W),F&&(L=a(1,1)+a(n(v),4)+D,G+="uc"+a(L.length,2)+L);var X="";X+=`
\0`,X+=a(k,2),X+=C.magic,X+=a(H,2),X+=a(z,2),X+=a(U.crc32,4),X+=a(U.compressedSize,4),X+=a(U.uncompressedSize,4),X+=a(O.length,2),X+=a(G.length,2);var Z=s.LOCAL_FILE_HEADER+X+O+G,Q=s.CENTRAL_FILE_HEADER+a(Y,2)+X+a(v.length,2)+"\0\0\0\0"+a(V,4)+a(b,4)+O+G+v;return{fileRecord:Z,dirRecord:Q}},u=function(m,g,y,b,P){var T="",I=e.transformTo("string",P(b));return T=s.CENTRAL_DIRECTORY_END+"\0\0\0\0"+a(m,2)+a(m,2)+a(g,4)+a(y,4)+a(I.length,2)+I,T},d=function(m){var g="";return g=s.DATA_DESCRIPTOR+a(m.crc32,4)+a(m.compressedSize,4)+a(m.uncompressedSize,4),g};function p(m,g,y,b){r.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=y,this.encodeFileName=b,this.streamFiles=m,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}e.inherits(p,r),p.prototype.push=function(m){var g=m.meta.percent||0,y=this.entriesCount,b=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,r.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:y?(g+100*(y-b-1))/y:100}}))},p.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var g=this.streamFiles&&!m.file.dir;if(g){var y=h(m,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:y.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(m){this.accumulate=!1;var g=this.streamFiles&&!m.file.dir,y=h(m,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(y.dirRecord),g)this.push({data:d(m),meta:{percent:100}});else for(this.push({data:y.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var m=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var y=this.bytesWritten-m,b=u(this.dirRecords.length,y,m,this.zipComment,this.encodeFileName);this.push({data:b,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(m){this._sources.push(m);var g=this;return m.on("data",function(y){g.processChunk(y)}),m.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),m.on("error",function(y){g.error(y)}),this},p.prototype.resume=function(){if(!r.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0},p.prototype.error=function(m){var g=this._sources;if(!r.prototype.error.call(this,m))return!1;for(var y=0;y<g.length;y++)try{g[y].error(m)}catch{}return!0},p.prototype.lock=function(){r.prototype.lock.call(this);for(var m=this._sources,g=0;g<m.length;g++)m[g].lock()},t.exports=p}),Ttt=Xn(o=>{"use strict";var t=UDe(),e=Ptt(),r=function(i,n){var s=i||n,a=t[s];if(!a)throw new Error(s+" is not a valid compression method !");return a};o.generateWorker=function(i,n,s){var a=new e(n.streamFiles,s,n.platform,n.encodeFileName),l=0;try{i.forEach(function(c,h){l++;var u=r(h.options.compression,n.compression),d=h.options.compressionOptions||n.compressionOptions||{},p=h.dir,m=h.date;h._compressWorker(u,d).withStreamInfo("file",{name:c,dir:p,date:m,comment:h.comment||"",unixPermissions:h.unixPermissions,dosPermissions:h.dosPermissions}).pipe(a)}),a.entriesCount=l}catch(c){a.error(c)}return a}}),Itt=Xn((o,t)=>{"use strict";var e=W0(),r=CI();function i(n,s){r.call(this,"Nodejs stream input adapter for "+n),this._upstreamEnded=!1,this._bindStream(s)}e.inherits(i,r),i.prototype._bindStream=function(n){var s=this;this._stream=n,n.pause(),n.on("data",function(a){s.push({data:a,meta:{percent:0}})}).on("error",function(a){s.isPaused?this.generatedError=a:s.error(a)}).on("end",function(){s.isPaused?s._upstreamEnded=!0:s.end()})},i.prototype.pause=function(){return r.prototype.pause.call(this)?(this._stream.pause(),!0):!1},i.prototype.resume=function(){return r.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1},t.exports=i}),Ctt=Xn((o,t)=>{"use strict";var e=AW(),r=W0(),i=CI(),n=wDe(),s=LDe(),a=Wbe(),l=ltt(),c=Ttt(),h=eQ(),u=Itt(),d=function(P,T,I){var C=r.getTypeOf(T),E,O=r.extend(I||{},s);O.date=O.date||new Date,O.compression!==null&&(O.compression=O.compression.toUpperCase()),typeof O.unixPermissions=="string"&&(O.unixPermissions=parseInt(O.unixPermissions,8)),O.unixPermissions&&O.unixPermissions&16384&&(O.dir=!0),O.dosPermissions&&O.dosPermissions&16&&(O.dir=!0),O.dir&&(P=m(P)),O.createFolders&&(E=p(P))&&g.call(this,E,!0);var _=C==="string"&&O.binary===!1&&O.base64===!1;(!I||typeof I.binary>"u")&&(O.binary=!_);var R=T instanceof a&&T.uncompressedSize===0;(R||O.dir||!T||T.length===0)&&(O.base64=!1,O.binary=!0,T="",O.compression="STORE",C="string");var v=null;T instanceof a||T instanceof i?v=T:h.isNode&&h.isStream(T)?v=new u(P,T):v=r.prepareContent(P,T,O.binary,O.optimizedBinaryString,O.base64);var D=new l(P,v,O);this.files[P]=D},p=function(P){P.slice(-1)==="/"&&(P=P.substring(0,P.length-1));var T=P.lastIndexOf("/");return T>0?P.substring(0,T):""},m=function(P){return P.slice(-1)!=="/"&&(P+="/"),P},g=function(P,T){return T=typeof T<"u"?T:s.createFolders,P=m(P),this.files[P]||d.call(this,P,null,{dir:!0,createFolders:T}),this.files[P]};function y(P){return Object.prototype.toString.call(P)==="[object RegExp]"}var b={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(P){var T,I,C;for(T in this.files)C=this.files[T],I=T.slice(this.root.length,T.length),I&&T.slice(0,this.root.length)===this.root&&P(I,C)},filter:function(P){var T=[];return this.forEach(function(I,C){P(I,C)&&T.push(C)}),T},file:function(P,T,I){if(arguments.length===1)if(y(P)){var C=P;return this.filter(function(O,_){return!_.dir&&C.test(O)})}else{var E=this.files[this.root+P];return E&&!E.dir?E:null}else P=this.root+P,d.call(this,P,T,I);return this},folder:function(P){if(!P)return this;if(y(P))return this.filter(function(E,O){return O.dir&&P.test(E)});var T=this.root+P,I=g.call(this,T),C=this.clone();return C.root=I.name,C},remove:function(P){P=this.root+P;var T=this.files[P];if(T||(P.slice(-1)!=="/"&&(P+="/"),T=this.files[P]),T&&!T.dir)delete this.files[P];else for(var I=this.filter(function(E,O){return O.name.slice(0,P.length)===P}),C=0;C<I.length;C++)delete this.files[I[C].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(P){var T,I={};try{if(I=r.extend(P||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:e.utf8encode}),I.type=I.type.toLowerCase(),I.compression=I.compression.toUpperCase(),I.type==="binarystring"&&(I.type="string"),!I.type)throw new Error("No output type specified.");r.checkSupport(I.type),(I.platform==="darwin"||I.platform==="freebsd"||I.platform==="linux"||I.platform==="sunos")&&(I.platform="UNIX"),I.platform==="win32"&&(I.platform="DOS");var C=I.comment||this.comment||"";T=c.generateWorker(this,I,C)}catch(E){T=new i("error"),T.error(E)}return new n(T,I.type||"string",I.mimeType)},generateAsync:function(P,T){return this.generateInternalStream(P).accumulate(T)},generateNodeStream:function(P,T){return P=P||{},P.type||(P.type="nodebuffer"),this.generateInternalStream(P).toNodejsStream(T)}};t.exports=b}),WDe=Xn((o,t)=>{"use strict";var e=W0();function r(i){this.data=i,this.length=i.length,this.index=0,this.zero=0}r.prototype={checkOffset:function(i){this.checkIndex(this.index+i)},checkIndex:function(i){if(this.length<this.zero+i||i<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+i+"). Corrupted zip ?")},setIndex:function(i){this.checkIndex(i),this.index=i},skip:function(i){this.setIndex(this.index+i)},byteAt:function(){},readInt:function(i){var n=0,s;for(this.checkOffset(i),s=this.index+i-1;s>=this.index;s--)n=(n<<8)+this.byteAt(s);return this.index+=i,n},readString:function(i){return e.transformTo("string",this.readData(i))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var i=this.readInt(4);return new Date(Date.UTC((i>>25&127)+1980,(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(i&31)<<1))}},t.exports=r}),zDe=Xn((o,t)=>{"use strict";var e=WDe(),r=W0();function i(n){e.call(this,n);for(var s=0;s<this.data.length;s++)n[s]=n[s]&255}r.inherits(i,e),i.prototype.byteAt=function(n){return this.data[this.zero+n]},i.prototype.lastIndexOfSignature=function(n){for(var s=n.charCodeAt(0),a=n.charCodeAt(1),l=n.charCodeAt(2),c=n.charCodeAt(3),h=this.length-4;h>=0;--h)if(this.data[h]===s&&this.data[h+1]===a&&this.data[h+2]===l&&this.data[h+3]===c)return h-this.zero;return-1},i.prototype.readAndCheckSignature=function(n){var s=n.charCodeAt(0),a=n.charCodeAt(1),l=n.charCodeAt(2),c=n.charCodeAt(3),h=this.readData(4);return s===h[0]&&a===h[1]&&l===h[2]&&c===h[3]},i.prototype.readData=function(n){if(this.checkOffset(n),n===0)return[];var s=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i}),Stt=Xn((o,t)=>{"use strict";var e=WDe(),r=W0();function i(n){e.call(this,n)}r.inherits(i,e),i.prototype.byteAt=function(n){return this.data.charCodeAt(this.zero+n)},i.prototype.lastIndexOfSignature=function(n){return this.data.lastIndexOf(n)-this.zero},i.prototype.readAndCheckSignature=function(n){var s=this.readData(4);return n===s},i.prototype.readData=function(n){this.checkOffset(n);var s=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i}),YDe=Xn((o,t)=>{"use strict";var e=zDe(),r=W0();function i(n){e.call(this,n)}r.inherits(i,e),i.prototype.readData=function(n){if(this.checkOffset(n),n===0)return new Uint8Array(0);var s=this.data.subarray(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i}),Ett=Xn((o,t)=>{"use strict";var e=YDe(),r=W0();function i(n){e.call(this,n)}r.inherits(i,e),i.prototype.readData=function(n){this.checkOffset(n);var s=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i}),jDe=Xn((o,t)=>{"use strict";var e=W0(),r=Lv(),i=zDe(),n=Stt(),s=Ett(),a=YDe();t.exports=function(l){var c=e.getTypeOf(l);return e.checkSupport(c),c==="string"&&!r.uint8array?new n(l):c==="nodebuffer"?new s(l):r.uint8array?new a(e.transformTo("uint8array",l)):new i(e.transformTo("array",l))}}),Ott=Xn((o,t)=>{"use strict";var e=jDe(),r=W0(),i=Wbe(),n=Hbe(),s=AW(),a=UDe(),l=Lv(),c=0,h=3,u=function(p){for(var m in a)if(Object.prototype.hasOwnProperty.call(a,m)&&a[m].magic===p)return a[m];return null};function d(p,m){this.options=p,this.loadOptions=m}d.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(p){var m,g;if(p.skip(22),this.fileNameLength=p.readInt(2),g=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(g),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(m=u(this.compressionMethod),m===null)throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new i(this.compressedSize,this.uncompressedSize,this.crc32,m,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var m=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(m),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),p===c&&(this.dosPermissions=this.externalFileAttributes&63),p===h&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=e(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var m=p.index+this.extraFieldsLength,g,y,b;for(this.extraFields||(this.extraFields={});p.index+4<m;)g=p.readInt(2),y=p.readInt(2),b=p.readData(y),this.extraFields[g]={id:g,length:y,value:b};p.setIndex(m)},handleUTF8:function(){var p=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=s.utf8decode(this.fileName),this.fileCommentStr=s.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var g=r.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(g)}var y=this.findExtraFieldUnicodeComment();if(y!==null)this.fileCommentStr=y;else{var b=r.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var m=e(p.value);return m.readInt(1)!==1||n(this.fileName)!==m.readInt(4)?null:s.utf8decode(m.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var m=e(p.value);return m.readInt(1)!==1||n(this.fileComment)!==m.readInt(4)?null:s.utf8decode(m.readData(p.length-5))}return null}},t.exports=d}),Att=Xn((o,t)=>{"use strict";var e=jDe(),r=W0(),i=HDe(),n=Ott(),s=Lv();function a(l){this.files=[],this.loadOptions=l}a.prototype={checkSignature:function(l){if(!this.reader.readAndCheckSignature(l)){this.reader.index-=4;var c=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+r.pretty(c)+", expected "+r.pretty(l)+")")}},isSignature:function(l,c){var h=this.reader.index;this.reader.setIndex(l);var u=this.reader.readString(4),d=u===c;return this.reader.setIndex(h),d},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var l=this.reader.readData(this.zipCommentLength),c=s.uint8array?"uint8array":"array",h=r.transformTo(c,l);this.zipComment=this.loadOptions.decodeFileName(h)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var l=this.zip64EndOfCentralSize-44,c=0,h,u,d;c<l;)h=this.reader.readInt(2),u=this.reader.readInt(4),d=this.reader.readData(u),this.zip64ExtensibleData[h]={id:h,length:u,value:d}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var l,c;for(l=0;l<this.files.length;l++)c=this.files[l],this.reader.setIndex(c.localHeaderOffset),this.checkSignature(i.LOCAL_FILE_HEADER),c.readLocalPart(this.reader),c.handleUTF8(),c.processAttributes()},readCentralDir:function(){var l;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(i.CENTRAL_FILE_HEADER);)l=new n({zip64:this.zip64},this.loadOptions),l.readCentralPart(this.reader),this.files.push(l);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var l=this.reader.lastIndexOfSignature(i.CENTRAL_DIRECTORY_END);if(l<0){var c=!this.isSignature(0,i.LOCAL_FILE_HEADER);throw c?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(l);var h=l;if(this.checkSignature(i.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r.MAX_VALUE_16BITS||this.centralDirRecords===r.MAX_VALUE_16BITS||this.centralDirSize===r.MAX_VALUE_32BITS||this.centralDirOffset===r.MAX_VALUE_32BITS){if(this.zip64=!0,l=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),l<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(l),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,i.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var u=this.centralDirOffset+this.centralDirSize;this.zip64&&(u+=20,u+=12+this.zip64EndOfCentralSize);var d=h-u;if(d>0)this.isSignature(h,i.CENTRAL_FILE_HEADER)||(this.reader.zero=d);else if(d<0)throw new Error("Corrupted zip: missing "+Math.abs(d)+" bytes.")},prepareReader:function(l){this.reader=e(l)},load:function(l){this.prepareReader(l),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=a}),_tt=Xn((o,t)=>{"use strict";var e=W0(),r=OW(),i=AW(),n=Att(),s=NDe(),a=eQ();function l(c){return new r.Promise(function(h,u){var d=c.decompressed.getContentWorker().pipe(new s);d.on("error",function(p){u(p)}).on("end",function(){d.streamInfo.crc32!==c.decompressed.crc32?u(new Error("Corrupted zip : CRC32 mismatch")):h()}).resume()})}t.exports=function(c,h){var u=this;return h=e.extend(h||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:i.utf8decode}),a.isNode&&a.isStream(c)?r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):e.prepareContent("the loaded zip file",c,!0,h.optimizedBinaryString,h.base64).then(function(d){var p=new n(h);return p.load(d),p}).then(function(d){var p=[r.Promise.resolve(d)],m=d.files;if(h.checkCRC32)for(var g=0;g<m.length;g++)p.push(l(m[g]));return r.Promise.all(p)}).then(function(d){for(var p=d.shift(),m=p.files,g=0;g<m.length;g++){var y=m[g],b=y.fileNameStr,P=e.resolve(y.fileNameStr);u.file(P,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:h.createFolders}),y.dir||(u.file(P).unsafeOriginalName=b)}return p.zipComment.length&&(u.comment=p.zipComment),u})}}),XDe=Xn((o,t)=>{"use strict";function e(){if(!(this instanceof e))return new e;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var r=new e;for(var i in this)typeof this[i]!="function"&&(r[i]=this[i]);return r}}e.prototype=Ctt(),e.prototype.loadAsync=_tt(),e.support=Lv(),e.defaults=LDe(),e.version="3.10.1",e.loadAsync=function(r,i){return new e().loadAsync(r,i)},e.external=OW(),t.exports=e}),qDe=class{constructor(o,t=null){if(this.outNum=0,t&&o.length!==t.length)throw new Error("The length of vertexes and normals is not equal!");if(o.length===0)throw new Error("The length of vertexes can't be 0!");o instanceof Float32Array?(this.vertexes=o,this.vertexNum=o.length/3):(this.vertexes=this.createArray(o),this.vertexNum=o.length),t instanceof Float32Array?this.normals=t:t&&(this.normals=this.createArray(t))}hasNormals(){return!!this.normals}iterVertexes(o){for(let t=0;t<this.vertexes.length;t+=3)o(new Mt(this.vertexes[t],this.vertexes[t+1],this.vertexes[t+2]))}iterVertexesNormals(o,t){for(let e=0;e<this.vertexes.length;e+=3)o(new Mt(this.vertexes[e],this.vertexes[e+1],this.vertexes[e+2])),t(new Mt(this.normals[e],this.normals[e+1],this.normals[e+2]))}createArray(o){let t=new Float32Array(o.length*3),e=0;for(let r of o)t[e++]=r.x,t[e++]=r.y,t[e++]=r.z;return t}incOut(){this.outNum++}decOut(){this.outNum--,this.outNum===0&&(this.vertexBuf.destroy(),this.normalsBuf.destroy())}getData(o,t){}getVertexBuf(o){return this.vertexBuf||(this.vertexBuf=o.createDynamicBuffer(this.vertexes.length,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,"vertexBuf of Elements"),this.vertexBuf.write(0,this.vertexes)),this.vertexBuf}getNormalsBuf(o){var t,e;return this.normalsBuf||(this.normalsBuf=o.createDynamicBuffer(((t=this.normals)==null?void 0:t.length)||this.vertexes.length,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,"normalsBuf of Elements"),(e=this.normals)!=null&&e.length&&this.normalsBuf.write(0,this.normals),delete this.normals,delete this.vertexes),this.normalsBuf}getBBox(){if(!this.bbox){let o=new Xm;for(let t=0;t<this.vertexes.length;t+=3)o.ext2(this.vertexes[t],this.vertexes[t+1],this.vertexes[t+2]);this.bbox=o.build()}return this.bbox}},vtt=class extends qDe{constructor(o,t=null){if(super(o,t),!Number.isInteger(this.vertexes.length/6))throw new Error("The length of vertexs is not a multiple of 2!")}},xtt=class extends qDe{constructor(o,t=null){if(super(o,t),!Number.isInteger(this.vertexes.length/9))throw new Error("The length of vertexs is not a multiple of 3!")}};function Rtt(o){let t=o.toString(2),e=32-t.length;return e>0?"0".repeat(e)+t:t}var Cg=class $De{constructor(t,e=null){this.marked=0,this.emptyStart=0,this.max=-1,this.size=t,this.index=new Uint32Array(Math.ceil(t/32)),e&&(this.index.set(e.index),this.marked=e.marked,this.emptyStart=e.emptyStart,this.max=e.max,this.trimListeners=e.trimListeners)}extSize(t){return new $De(t,this)}isEmpty(){return this.marked===0}getMarked(){return this.marked}getChunk(t){return this.index[t]}isUsed(t){let e=t/32|0,r=this.index[e];return r===4294967295?!0:r===0?!1:(r>>31-t&1)===1}markUsed(t){let e=t/32|0,r=this.index[e],i=1<<31-t;(r&i)===0&&(this.index[e]=r|i,this.marked++),t>this.max&&(this.max=t)}markRemove(t){var e;let r=t/32|0,i=this.index[r],n=1<<31-t;if((i&n)!==0&&(this.index[r]=i&(4294967295^n),this.marked--,t<this.emptyStart&&(this.emptyStart=t),t===this.max)){if(i=this.index[r],i!==0)for(this.max--;(i&1<<31-this.max)===0;)this.max--;else{for(i=this.index[--r];i===0;)i=this.index[--r];if(i===void 0)this.max=-1;else for(this.max=r*32+31;(i&1<<31-this.max)===0;)this.max--}(e=this.trimListeners)==null||e.forEach(s=>s(this.max+1))}}addTrimListener(t){this.trimListeners||(this.trimListeners=new Set),this.trimListeners.add(t)}deleteTrimListener(t){this.trimListeners.delete(t)}reset(){this.index.fill(0),this.marked=0,this.emptyStart=0,this.max=-1}findEmpty(t=1){if(this.size-this.marked<t)return-1;if(this.size-this.max-1>=t)return this.max+1;let e=this.index,r=-1,i=!1;for(let n=Math.floor(this.emptyStart/32);n<e.length;n++){let s=e[n];if(s===0){if(r===-1){if(r=n*32,i||(this.emptyStart=r,i=!0),t<=32)return r}else if((n+1)*32-r>=t)return r}else if(s!==4294967295)for(let a=31;a>=0;a--)if((s>>a&1)===0){let l=n*32+31-a;if(r===-1&&(r=l,i||(this.emptyStart=r,i=!0)),l-r+1>=t)return r}else r=-1;else r=-1}return-1}hasNEmpty(t=1){return this.size-this.marked>=t}findNEmpty(t=1){let e=[];if(this.size-this.marked<t)return e;if(this.size-this.max-1>=t){let i=this.max+t;for(let n=this.max+1;n<=i;n++)e.push(n);return e}let r=this.index;for(let i=Math.floor(this.emptyStart/32);i<r.length;i++){if(this.marked+e.length===i*32){for(let s=i*32;e.length!==t;s++)e.push(s);return this.emptyStart=e[0],e}let n=r[i];if(n===0){let s=i*32;if(e.indexOf(s)==-1){if(e.push(s),e.length>=t)return this.emptyStart=e[0],e;{let a=t-e.length;if(a<32){for(let l=0;l<a;l++)e.push(s+l+1);return this.emptyStart=e[0],e}else for(let l=0;l<31;l++)e.push(s+l+1)}}}else if(n!==4294967295){for(let s=31;s>=0;s--)if((n>>s&1)===0){let a=i*32+31-s;if(e.indexOf(a)==-1&&(e.push(a),e.length==t))return this.emptyStart=e[0],e}}}return this.emptyStart=e.length===0?this.size:e[0],[]}getMax(){return this.max}debug(){let t=[],e=this.index;for(let r=0;r<e.length;r++)t.push(Rtt(e[r]));console.log(t.join(" "))}},Cxe={mil:1,inch:1e3,ft:12e3,yard:36e3,mile:6336e4,km:3937007874e-2,dm:3937,mm:39.37,um:.039,nm:394e-7,pt:13.88888888888889,"px(72)":13.88888888888889,"px(96)":10.416666666666666,"px(100)":10},X6t=(()=>{let o={};for(let t in Cxe)o[Cxe[t]]=t;return o})(),Sxe=class{constructor(t,e){this.ratio=t/e}wrap(t){return t*this.ratio}static convert(t,e,r){return t*e/r}};Sxe.ASIS=new Sxe(1,1);var ML=class{conversion(o,t,e){if(o===t)return e;let r=o+2+t;return this[r](e)}conversion1(o,t,e){let r=o+2+t,i=this[r](e);return t=="mil"?Math.round(i*10)/10:Math.round(i*1e3)/1e3}mil2mil(o){return o}mil2mm(o){return o*.0254}mil2cm(o){return o*.00254}mil2inch(o){return o/1e3}mm2mm(o){return o}mm2mil(o){let t=Math.pow(10,5);return Math.round(o*39.37007874015748*t)/t}mm2cm(o){return o/10}mm2inch(o){let t=Math.pow(10,8);return Math.round(o*.03937007874015748*t)/t}cm2mil(o){let t=Math.pow(10,6);return Math.round(o*393.7007874015748*t)/t}cm2mm(o){return o*10}cm2inch(o){let t=Math.pow(10,7);return Math.round(o*.3937007874015748*t)/t}inch2mil(o){return o*1e3}inch2mm(o){return o*25.4}inch2cm(o){return o*2.54}};ML.prototype["px(100)2mil"]=o=>o*10;ML.prototype["px(100)2mm"]=o=>o*.254;ML.prototype["mil2px(100)"]=o=>o/10;ML.prototype["mm2px(100)"]=o=>{let t=Math.pow(10,5);return Math.round(o*3.937007874015748*t)/t};var FZ=null,Ybe=new ArrayBuffer(8),oye=new Float64Array(Ybe),sye=new Uint32Array(Ybe),Exe=new Uint16Array(Ybe),pa=Math.PI*2,II=Math.PI/2,FJ=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!FZ){let o=this.getUrlVars().version;o?FZ="/analyzer/v"+o:FZ="/analyzer"}return FZ}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;oye[0]=new Date().getTime(),o.push(sye[1].toString(16)),oye[0]=Math.random(),o.push(Exe[3].toString(16));let t=Exe[2].toString(16);o.push("4"+t.substr(0,3)),oye[0]=performance.now();let e=sye[0].toString(16)+sye[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},Dtt=[1,10,100,1e3];function Oxe(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=Dtt[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}function wtt(o,t={},...e){t=Object.assign({color:"#75de75","font-style":"italic","background-color":"#333",padding:"2px","font-size":"16px"},t),o.includes("%c")||(o="%c "+o),console.log(o,JSON.stringify(t).replace(/[\"\{\}]/g,"").replace(/,/g,";"),...e)}function Ltt(){if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis;if(typeof global<"u")return global}function VZ(o,t){return Math.abs(o-t)<=1e-4}var Mtt=/(\.?0+)$/,GZ=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(FJ.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(FJ.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);J7.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(Mtt,"")}},J7=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(GZ.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(GZ.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(GZ.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(GZ.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},Jc=class Cy{static build(t,e,r,i=1){let n=this.getHash(t,e,r,i),s=this._colorCache[n];return s||(s=new Cy(t,e,r,i),this._colorCache[n]=s),s}static getHash(t,e,r,i=1){return 31*(31*(31*t+e)+r)+i}static isHexFormate(t){return!t||typeof t!="string"?!1:/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)}static of1(t){return this.of2(t>>16&255,t>>8&255,t&255)}static of2(t,e,r,i=255){return Cy.build(t/255,e/255,r/255,i/255)}static of3(t){t.startsWith("#")&&(t=t.substr(1));let e=t.length;if(e==3)return Cy.build(parseInt(t[0],16)/15,parseInt(t[1],16)/15,parseInt(t[2],16)/15);if(e==6)return Cy.build(parseInt(t.substr(0,2),16)/255,parseInt(t.substr(2,2),16)/255,parseInt(t.substr(4,2),16)/255);if(e==8)return Cy.build(parseInt(t.substr(0,2),16)/255,parseInt(t.substr(2,2),16)/255,parseInt(t.substr(4,2),16)/255,parseInt(t.substr(6,2),16)/255);throw new Error("invalid color string")}static of4(t){let e=parseInt(t.r*255+"").toString(16),r=parseInt(t.g*255+"").toString(16),i=parseInt(t.b*255+"").toString(16);return e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),("#"+e+r+i).toUpperCase()}static of5(t,e){if(t.startsWith("#")&&(t=t.substr(1)),t.length==3)return Cy.build(parseInt(t[0],16)/15,parseInt(t[1],16)/15,parseInt(t[2],16)/15,e);if(t.length==6)return Cy.build(parseInt(t.substr(0,2),16)/255,parseInt(t.substr(2,2),16)/255,parseInt(t.substr(4,2),16)/255,e);throw new Error("invalid color string")}static of6(t,e){return Cy.build(t.r,t.g,t.b,e)}static of7(t){return t==null?null:Cy.of3(t)}static ofNew(t){return Cy.build(t.r,t.g,t.b,t.alpha)}constructor(t,e,r,i=1){this.r=J7.positiveOr0(t),this.g=J7.positiveOr0(e),this.b=J7.positiveOr0(r),this.alpha=i}mulAlpha(t){return new Cy(this.r,this.g,this.b,this.alpha*t)}hashCode(){return Cy.getHash(this.r,this.g,this.b,this.alpha)}equals(t,e=!1){if(!t)return!1;let r=this.r===t.r&&this.g===t.g&&this.b===t.b;return e?r:r&&this.alpha===t.alpha}add(t,e,r,i){return Cy.build(Math.max(0,Math.min(1,this.r+t)),Math.max(0,Math.min(1,this.g+e)),Math.max(0,Math.min(1,this.b+r)),Math.max(0,Math.min(1,this.alpha+i)))}mul(t){return Cy.build(Math.max(0,Math.min(1,this.r*t)),Math.max(0,Math.min(1,this.g*t)),Math.max(0,Math.min(1,this.b*t)),this.alpha)}mul1(t){return Cy.build(Math.max(0,this.r*t),Math.max(0,this.g*t),Math.max(0,this.b*t),this.alpha)}getData(){return[this.r,this.g,this.b,this.alpha]}toString(){let t=(this.r*255).toString(16),e=(this.g*255).toString(16),r=(this.b*255).toString(16);return t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),"#"+t.substr(0,2)+e.substr(0,2)+r.substr(0,2)}toString1(){let t=(this.r*255).toString(16),e=(this.g*255).toString(16),r=(this.b*255).toString(16),i=(this.alpha*255).toString(16);return t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),"#"+t.substr(0,2)+e.substr(0,2)+r.substr(0,2)+i.substr(0,2)}toRGBA(){let t=this.r*255,e=this.g*255,r=this.b*255;return[t,e,r,this.alpha]}toRGBAString(){let t=this.r*255,e=this.g*255,r=this.b*255;return`rgba(${t},${e},${r},${this.alpha})`}isWHITE(){return this.r===1&&this.g===1&&this.b===1&&this.alpha===1}toCSS(){return`rgba(${this.r*255}, ${this.g*255}, ${this.b*255}, ${this.alpha})`}};Jc._colorCache={},Jc.WHITE=Jc.build(1,1,1,1),Jc.BLACK=Jc.build(0,0,0,1),Jc.RED=Jc.build(1,0,0,1),Jc.GREEN=Jc.build(0,1,0,1),Jc.BLUE=Jc.build(0,0,1,1),Jc.Gray=Jc.of3("#9966ff"),Jc.Silver=Jc.of3("#D2D2D2"),Jc.Golden=Jc.of3("#DCAA14"),Jc.DefaultHighLightColor=Jc.build(1,1,1,.5),Jc.YELLOW=new Jc(1,1,0,1),Jc.PURPLE=new Jc(1,0,1,1),Jc.CYAN=new Jc(0,1,1,1),Jc.LightGray=Jc.of3("#d9d9d9"),Jc.ZERO=new Jc(0,0,0,0),Jc.ORANGE=Jc.of3("#ffa500"),Jc.AMARANTH=Jc.of3("#ff00ff");var ee=Jc,fa=10,ak=7,Ntt=2**ak-1<<fa,J6t=2**fa-1,Is=1<<fa+ak,fW=2**32-1-Is,f0=class{constructor(o,t,e){this.DataIndex=e,this.length=t,VJ[o]=t,KDe[o]=(r,i,n,s)=>this.getBBox(r,i,n,s),rwe[o]=(r,i)=>this.compare(r,i),ZDe[o]=(r,i,n)=>this.getOrder(r,i,n),QDe[o]=(r,i,n)=>this.getGroupIdByBuilder(r,i,n),JDe[o]=(r,i,n)=>this.getGroupId(r,i,n),ewe[o]=(r,i,n)=>this.getTemplateId(r,i,n),twe[o]=(r,i,n)=>this.getColorIndex(r,i,n),iwe[o]=this,this.type=o}updateLength(o,t){this.length=o,VJ[t]=o}compare(o,t){if((o[0]&fW)!==(t[0]&fW))return!1;for(let e=1;e<this.length;e++)if(o[e]!==t[e])return!1;return!0}createBBox(o,t,e,r){let i=this.getBBox(o,t,e,r);return new ut(i.minX,i.maxX,i.minY,i.maxY)}getOrder(o,t,e){if(!this.DataIndex.ORDER)throw new Error("GetOrder error ");return o[t+this.DataIndex.ORDER]}getGroupIdByBuilder(o,t,e){if(!this.DataIndex.GROUP_ID)throw new Error("GetGroupId error ");return o.get(t+this.DataIndex.GROUP_ID)}getGroupId(o,t,e){if(!this.DataIndex.GROUP_ID)throw new Error("GetGroupId error ");return o[t+this.DataIndex.GROUP_ID]}getTemplateId(o,t,e){if(!this.DataIndex.TEMPLATE)throw new Error("GetTemplateId error ");return o[t+this.DataIndex.TEMPLATE]}getColorIndex(o,t,e){if(!this.DataIndex.COLOR_INDEX)throw new Error("GetColorIndex error ");return o[t+this.DataIndex.COLOR_INDEX]}},VJ=new Float64Array(70),KDe=[],ZDe=[],JDe=[],QDe=[],ewe=[],twe=[],rwe=[],iwe=[],Ur={getType(o){return(o&Ntt)>>fa},getPtLength(o){return VJ[Ur.getType(o)]},getBBox(o,t,e,r){return KDe[Ur.getType(o[t])](o,t,e,r)},compare(o,t){return rwe[Ur.getType(o[0])](o,t)},getPtLengthByType(o){return VJ[o]},getTool(o){return iwe[o]},isPolygonType(o){switch(o){case 6:case 7:case 8:case 9:case 26:case 27:case 29:case 28:case 11:case 12:case 13:case 14:case 31:case 32:case 33:case 34:case 41:case 42:case 43:case 44:case 46:case 47:case 48:case 49:return!0;default:return!1}},isTemplateOriginPtType(o){switch(o){case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 65:return!0;default:return!1}},isCustomTemplateInstanceType(o){switch(o){case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:return!0;default:return!1}},getCustomTemplateInstanceType(o){switch(o){case 21:return 36;case 22:return 37;case 23:return 38;case 24:return 39;case 25:return 40;case 26:return 41;case 27:return 42;case 28:return 43;case 29:return 44;case 30:return 45;case 31:return 46;case 32:return 47;case 33:return 48;case 34:return 49;case 35:return 50;default:return o}},getTemplateTypeByCustomInstanceType(o){switch(o){case 36:return 21;case 37:return 22;case 38:return 23;case 39:return 24;case 40:return 25;case 41:return 26;case 42:return 27;case 43:return 28;case 44:return 29;case 45:return 30;case 46:return 31;case 47:return 32;case 48:return 33;case 49:return 34;case 50:return 35;default:return o}},isTemplateNormalPolygonType(o){switch(o){case 56:case 57:case 59:case 58:return!0;default:return!1}},isTemplateWireFramePolygonType(o){switch(o){case 61:case 62:case 63:case 64:return!0;default:return!1}},isNormalPolygonType(o){switch(o){case 6:case 7:case 8:case 9:case 26:case 27:case 29:case 28:case 41:case 42:case 43:case 44:case 56:case 57:case 59:case 58:return!0;default:return!1}},isWireFramePolygonType(o){return o===11||o===12||o===13||o===14},isStaticPtType(o){switch(o){case 8:case 9:case 29:case 28:case 43:case 44:case 59:case 58:case 13:case 14:case 63:case 64:case 33:case 34:case 48:case 49:return!0;default:return!1}},isTemplateInstancePtType(o){switch(o){case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:return!0;default:return!1}},getTemplateInstanceType(o){switch(o){case 51:return 21;case 52:return 22;case 53:return 23;case 65:return 35;case 54:return 24;case 55:return 25;case 56:return 26;case 57:return 27;case 59:return 29;case 58:return 28;case 61:return 31;case 62:return 32;case 63:return 33;case 64:return 34;case 60:return 30;default:throw new Error(`type${o}`)}},getTemplateTypeByTemplateInstanceType(o){switch(o){case 21:case 36:return 51;case 22:case 37:return 52;case 23:case 38:return 53;case 24:case 39:return 54;case 25:case 40:return 55;case 26:case 41:return 56;case 27:case 42:return 57;case 29:case 44:return 59;case 28:case 43:return 58;case 31:case 46:return 61;case 32:case 47:return 62;case 33:case 48:return 63;case 34:case 49:return 64;case 30:case 45:return 60;case 35:case 50:return 65;default:return o}},isNormalType(o){return!Ur.isPolygonType(o)&&o!=10},getOrder(o,t,e){return ZDe[Ur.getType(o[t])](o,t,e)},getGroupIdByBuilder(o,t,e){return QDe[Ur.getType(o.get(t))](o,t,e)},getTemplateId(o,t,e){return ewe[Ur.getType(o[t])](o,t,e)},getColorIndex(o,t,e){return twe[Ur.getType(o[t])](o,t,e)},getGroupId(o,t,e){return JDe[Ur.getType(o[0])](o,t,e)}},AJ=[];function NL(o,t){AJ.push(o,t)}function nwe(o){for(let t=0;t<AJ.length;t+=2)o==="cpu"?AJ[t]():AJ[t+1]()}var Ld=12,NO=class owe{constructor(t){this.chunks=[],this.length=0,this.isChanged=!1,this.arrayConstructor=t}get(t){return this.chunks[Math.floor(t/1024)][t%1024]}slice(t,e){if(e=Math.min(e,this.length),t>=e)return new this.arrayConstructor(0);let r=Math.floor(t/1024),i=Math.floor((e-1)/1024);if(r===i){let l=r*1024;return this.chunks[r].slice(t-l,e-l)}let n=new this.arrayConstructor(e-t),s=0,a=t%1024;for(let l=r;l<=i;l++){let c=this.chunks[l],h=a+Math.min(1024-a,n.length-s);for(;a<h;)n[s++]=c[a++];a=0}return n}forEach(t){this.length!==0&&this.chunks.forEach((e,r)=>{let i=r*1024;if(r===this.chunks.length-1&&this.length!==1024*this.chunks.length)for(let n=0,s=this.length%1024;n<s;n++)t(e[n],i++);else e.forEach(n=>t(n,i++))})}copy(){let t=new owe(this.arrayConstructor);return this.chunks.forEach(e=>t.chunks.push(e.slice())),t.length=this.length,t.isChanged=!0,t}buildArr(){let t=new this.arrayConstructor(this.length),e=0;return this.chunks.forEach((r,i)=>{if(i===this.chunks.length-1&&this.length!==1024*this.chunks.length)for(let n=0,s=this.length%1024;n<s;n++)t[e++]=r[n];else t.set(r,e);e+=1024}),t}getLength(){return this.length}setLength(t){if(this.length===t)return;let e=Math.ceil(t/1024);if(e<=this.chunks.length)this.chunks.length=e;else for(;this.chunks.length<e;)this.chunks.push(new this.arrayConstructor(1024));this.length>t?this.markChange(t,this.length):this.markChange(this.length,t),this.length=t}trimChunk(t){Math.ceil(t/1024)!==this.chunks.length&&this.setLength(t)}extArr(t){t<=this.length||this.setLength(t)}markChange(t,e){this.isChanged=!0}set(t,e){this.extArr(t+1),this.chunks[Math.floor(t/1024)][t%1024]=e,this.markChange(t,t+1)}setArr(t,e){let r=e+t.length;this.extArr(r);let i=Math.floor(e/1024),n=Math.floor((e+t.length-1)/1024);if(i===n)this.chunks[i].set(t,e%1024);else{let s=0,a=e%1024;for(let l=i;l<=n;l++){let c=this.chunks[l],h=a+Math.min(1024-a,t.length-s);for(;a<h;)c[a++]=t[s++];a=0}}this.markChange(e,r)}push(t){return this.set(this.length,t),this.length}pushArr(t){return this.setArr(t,this.length),this.length}isChange(){return this.isChanged}clear(){this.chunks.length=0,this.length=0,this.markChange(0,0)}},ktt=class{constructor(){this._minX=0,this._maxX=0,this._minY=0,this._maxY=0}modify(o,t,e,r){return this._minX=o,this._maxX=t,this._minY=e,this._maxY=r,this}get minX(){return this._minX}get maxX(){return this._maxX}get minY(){return this._minY}get maxY(){return this._maxY}modify1(o){return this._minX=o.minX,this._maxX=o.maxX,this._minY=o.minY,this._maxY=o.maxY,this}center(){return new S(this.maxX-(this.maxX-this.minX)/2,this.maxY-(this.maxY-this.minY)/2)}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}UL(){return new S(this.minX,this.maxY)}UR(){return new S(this.maxX,this.maxY)}LL(){return new S(this.minX,this.minY)}LR(){return new S(this.maxX,this.minY)}transform4(o){let t=new _e;return t.ext2(this.LL().multiply4(o)),t.ext2(this.LR().multiply4(o)),t.ext2(this.UR().multiply4(o)),t.ext2(this.UL().multiply4(o)),t.build()}build(){return new ut(this.minX,this.maxX,this.minY,this.maxY)}},ul=new ktt,Btt="struct O_a { O_b : i32 , O_c : i32 , O_d : i32 , O_e : i32 , O_f : i32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_g : O_a ; @ group ( 0 ) @ binding ( 1 ) var < storage , read > O_h : array < f32 > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read_write > O_i : array < f32 > ; override MAX_COMPUTE_WORKGROUP_SIZE_X : u32 ; fn O_j ( O_k : vec2 < f32 > , ) -> f32 { let O_e = O_g . O_c ; let O_f = O_g . O_d ; let O_l = fract ( O_k . x ) ; let O_m = fract ( O_k . y ) ; let O_n = i32 ( O_k . x ) ; let O_o = i32 ( O_k . y ) ; let O_p = clamp ( O_n , 0 , O_e - 1 ) ; let O_q = clamp ( O_n + 1 , 0 , O_e - 1 ) ; let O_r = clamp ( O_o , 0 , O_f - 1 ) ; let O_s = clamp ( O_o + 1 , 0 , O_f - 1 ) ; let O_t = O_h [ O_r * O_e + O_p ] ; let O_u = O_h [ O_r * O_e + O_q ] ; let O_v = O_h [ O_s * O_e + O_p ] ; let O_w = O_h [ O_s * O_e + O_q ] ; let O_x = mix ( O_t , O_u , O_l ) ; let O_y = mix ( O_v , O_w , O_l ) ; return mix ( O_x , O_y , O_m ) ; } @ compute @ workgroup_size ( MAX_COMPUTE_WORKGROUP_SIZE_X ) fn reduceSdf ( @ builtin ( global_invocation_id ) id : vec3 < u32 > , ) { let O_z = i32 ( id . x ) + O_g . O_b ; if ( O_z > O_g . O_e * O_g . O_f ) { return ; } let O_aa = O_g . O_f ; let O_ab = O_g . O_e ; let O_ac = f32 ( O_g . O_c ) ; let O_ad = f32 ( O_g . O_d ) ; let O_ae : i32 = i32 ( floor ( f32 ( O_z ) / f32 ( O_ab ) ) ) ; let O_af : i32 = O_z % O_ab ; let O_ag = O_ae * O_ab + O_af ; let O_ah = ( f32 ( O_af ) + 0.5 ) / f32 ( O_ab ) ; let O_ai = ( f32 ( O_ae ) + 0.5 ) / f32 ( O_aa ) ; let O_aj = ( O_ah * O_ac - 0.5 ) ; let O_ak = ( O_ai * O_ad - 0.5 ) ; let O_al = O_j ( vec2 ( O_aj , O_ak ) ) ; O_i [ O_ag ] = O_al ; } ",Ftt="struct O_a { O_b : i32 , O_c : i32 , O_d : i32 , O_e : i32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_f : O_a ; @ group ( 0 ) @ binding ( 1 ) var < storage , read_write > O_g : array < atomic < u32 > > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read_write > O_h : array < atomic < u32 > > ; @ group ( 0 ) @ binding ( 3 ) var < storage , read_write > O_i : array < u32 > ; @ group ( 0 ) @ binding ( 4 ) var < storage , read_write > O_j : array < u32 > ; override INF : u32 ; override MAX_COMPUTE_WORKGROUP_SIZE_X : u32 ; fn O_k ( O_l : i32 , O_m : i32 , O_n : i32 , ) { if ( O_i [ O_l ] == INF ) { return ; } if ( O_f . O_e == 1 ) { for ( var O_o = O_m - 1 ; O_o >= 0 ; O_o -= 1 ) { let O_p = O_n * O_f . O_c + O_o ; if ( O_i [ O_p ] == 0 ) { break ; } var O_q = u32 ( ( O_o - O_m ) * ( O_o - O_m ) ) ; let O_r = atomicMin ( & O_g [ O_p ] , O_q ) ; if ( O_r <= O_q ) { break ; } } for ( var O_o = O_m + 1 ; O_o < O_f . O_c ; O_o += 1 ) { let O_p = O_n * O_f . O_c + O_o ; if ( O_i [ O_p ] == 0 ) { break ; } var O_q = u32 ( ( O_o - O_m ) * ( O_o - O_m ) ) ; let O_r = atomicMin ( & O_g [ O_p ] , O_q ) ; if ( O_r <= O_q ) { break ; } } } else { for ( var O_o = O_n - 1 ; O_o >= 0 ; O_o -= 1 ) { if ( O_n >= O_f . O_d ) { return ; } let O_s = O_o * O_f . O_c + O_m ; if ( O_i [ O_s ] <= O_i [ O_l ] ) { break ; } var O_q = u32 ( ( O_o - O_n ) * ( O_o - O_n ) ) + O_i [ O_l ] ; let O_r = atomicMin ( & O_g [ O_s ] , O_q ) ; } for ( var O_o = O_n + 1 ; O_o < O_f . O_d ; O_o += 1 ) { let O_s = O_o * O_f . O_c + O_m ; if ( O_i [ O_s ] <= O_i [ O_l ] ) { break ; } var O_q = u32 ( ( O_o - O_n ) * ( O_o - O_n ) ) + O_i [ O_l ] ; let O_r = atomicMin ( & O_g [ O_s ] , O_q ) ; } } } fn O_t ( O_l : i32 , O_m : i32 , O_n : i32 , ) { if ( O_j [ O_l ] == INF ) { return ; } if ( O_f . O_e == 1 ) { for ( var O_o = O_m - 1 ; O_o >= 0 ; O_o -= 1 ) { let O_p = O_n * O_f . O_c + O_o ; if ( O_j [ O_p ] == 0 ) { break ; } var O_q = u32 ( ( O_o - O_m ) * ( O_o - O_m ) ) ; let O_r = atomicMin ( & O_h [ O_p ] , O_q ) ; if ( O_r <= O_q ) { break ; } } for ( var O_o = O_m + 1 ; O_o < O_f . O_c ; O_o += 1 ) { let O_p = O_n * O_f . O_c + O_o ; if ( O_j [ O_p ] == 0 ) { break ; } var O_q = u32 ( ( O_o - O_m ) * ( O_o - O_m ) ) ; let O_r = atomicMin ( & O_h [ O_p ] , O_q ) ; if ( O_r <= O_q ) { break ; } } } else { for ( var O_o = O_n - 1 ; O_o >= 0 ; O_o -= 1 ) { if ( O_n >= O_f . O_d ) { return ; } let O_s = O_o * O_f . O_c + O_m ; if ( O_j [ O_s ] <= O_j [ O_l ] ) { break ; } var O_q = u32 ( ( O_o - O_n ) * ( O_o - O_n ) ) + O_j [ O_l ] ; let O_r = atomicMin ( & O_h [ O_s ] , O_q ) ; } for ( var O_o = O_n + 1 ; O_o < O_f . O_d ; O_o += 1 ) { let O_s = O_o * O_f . O_c + O_m ; if ( O_j [ O_s ] <= O_j [ O_l ] ) { break ; } var O_q = u32 ( ( O_o - O_n ) * ( O_o - O_n ) ) + O_j [ O_l ] ; let O_r = atomicMin ( & O_h [ O_s ] , O_q ) ; } } } @ compute @ workgroup_size ( MAX_COMPUTE_WORKGROUP_SIZE_X ) fn calculateGridRowData ( @ builtin ( global_invocation_id ) id : vec3 < u32 > , ) { let O_l = i32 ( id . x ) + O_f . O_b ; if ( O_l > O_f . O_c * O_f . O_d ) { return ; } let O_m = O_l % O_f . O_c ; let O_n = i32 ( floor ( f32 ( O_l / O_f . O_c ) ) ) ; O_k ( O_l , O_m , O_n ) ; O_t ( O_l , O_m , O_n ) ; } ",Vtt="struct O_a { O_b : i32 , O_c : i32 , O_d : i32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_e : O_a ; @ group ( 0 ) @ binding ( 1 ) var < storage , read_write > O_f : array < u32 > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read_write > O_g : array < u32 > ; @ group ( 0 ) @ binding ( 3 ) var < storage , read_write > O_h : array < f32 > ; override MAX_COMPUTE_WORKGROUP_SIZE_X : u32 ; @ compute @ workgroup_size ( MAX_COMPUTE_WORKGROUP_SIZE_X ) fn computeSdfData ( @ builtin ( global_invocation_id ) id : vec3 < u32 > , ) { let O_i = i32 ( id . x ) + O_e . O_b ; if ( O_i > O_e . O_c * O_e . O_d ) { return ; } let O_j = sqrt ( f32 ( O_f [ O_i ] ) ) - sqrt ( f32 ( O_g [ O_i ] ) ) ; O_h [ O_i ] = round ( 255 - 255 * O_j ) ; } ",Gtt="struct O_a { O_b : i32 , O_c : i32 , O_d : i32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_e : O_a ; @ group ( 0 ) @ binding ( 1 ) var < storage , read_write > O_f : array < u32 > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read_write > O_g : array < u32 > ; @ group ( 0 ) @ binding ( 3 ) var O_h : texture_2d < f32 > ; override INF : u32 ; override MAX_COMPUTE_WORKGROUP_SIZE_X : u32 ; @ compute @ workgroup_size ( MAX_COMPUTE_WORKGROUP_SIZE_X ) fn createGridData ( @ builtin ( global_invocation_id ) id : vec3 < u32 > , ) { let O_i = i32 ( id . x ) + O_e . O_b ; if ( O_i > O_e . O_c * O_e . O_d ) { return ; } let O_j = i32 ( floor ( f32 ( O_i / O_e . O_c ) ) ) ; let O_k = O_i % O_e . O_c ; let O_l = textureLoad ( O_h , vec2 < i32 > ( O_k , O_j ) , 0 ) ; if ( O_l . a > 0.5 ) { O_f [ O_i ] = 0 ; O_g [ O_i ] = INF ; } else { O_f [ O_i ] = INF ; O_g [ O_i ] = 0 ; } } ",K7=512,Axe="#000000",_xe="#000000",vxe=[1,0,0,1,0,0],xxe="10px sans-serif",Tf=class{constructor(o){this.stateStack=[],this.operateStack=[],this.transformMatrix=vxe,this.fillStyle=Axe,this.strokeStyle=_xe,this.font=xxe,this.context=o}getContext(){return this.context}originSave(){this.context.save()}originRestore(){this.context.restore(),this.reset()}reset(){delete this.lastState,delete this.lastOperate,this.transformMatrix=vxe,this.fillStyle=Axe,this.strokeStyle=_xe,this.font=xxe}save(){this.lastState={},this.stateStack.push(this.lastState),this.lastOperate=[],this.operateStack.push(this.lastOperate)}restore(){let o=Object.keys(this.lastState).filter(e=>e==="transform");for(let e in this.lastState){let r=this.lastState[e];switch(e){case"transform":{this.context.setTransform(r[0],r[1],r[2],r[3],r[4],r[5]),this.transformMatrix=r;break}case"lineDash":{this.context.setLineDash(r);break}default:{switch(e){case"fillStyle":{this.fillStyle=r;break}case"strokeStyle":{this.strokeStyle=r;break}case"font":{this.font=r;break}}this.context[e]=r}}}let t=[];if(!o.length)for(let e of this.lastOperate.reverse())if(typeof e=="string")switch(e){case"translate":{this.context.translate(t[1],t[0]),t=[];break}case"rotate":{this.context.rotate(t[0]),t=[];break}case"scale":{this.context.scale(t[1],t[0]),t=[];break}}else t.push(e);this.stateStack.pop(),this.lastState=this.stateStack[this.stateStack.length-1],this.operateStack.pop(),this.lastOperate=this.operateStack[this.operateStack.length-1]}setFillStyle(o){o!==this.fillStyle&&(this.lastState&&this.lastState.fillStyle===void 0&&(this.lastState.fillStyle=this.fillStyle),this.fillStyle=o,this.context.fillStyle=o)}setStrokeStyle(o){o!==this.strokeStyle&&(this.lastState&&this.lastState.strokeStyle===void 0&&(this.lastState.strokeStyle=this.strokeStyle),this.strokeStyle=o,this.context.strokeStyle=o)}setLineCap(o){o!==this.context.lineCap&&(this.lastState&&this.lastState.lineCap===void 0&&(this.lastState.lineCap=this.context.lineCap),this.context.lineCap=o)}setTranslate(o,t){var e;(e=this.lastOperate)==null||e.push("translate",-o,-t),this.context.translate(o,t)}setRotate(o){var t;(t=this.lastOperate)==null||t.push("rotate",-o),this.context.rotate(o)}setScale(o,t){var e;(e=this.lastOperate)==null||e.push("scale",1/o,1/t),this.context.scale(o,t)}setTransform(o){this.lastState&&this.lastState.transform===void 0&&(this.lastState.transform=this.transformMatrix),this.transformMatrix=[o[0],o[1],o[2],o[3],o[4],o[5]],this.context.setTransform(o[0],o[1],o[2],o[3],o[4],o[5])}setLineDash(o){let t=this.context.getLineDash();JSON.stringify(o)!==JSON.stringify(t)&&(this.lastState&&this.lastState.lineDash===void 0&&(this.lastState.lineDash=t),this.context.setLineDash(o))}setLineWidth(o){o!==this.context.lineWidth&&(this.lastState&&this.lastState.lineWidth===void 0&&(this.lastState.lineWidth=this.context.lineWidth),this.context.lineWidth=o)}setTextAlign(o){o!==this.context.textAlign&&(this.lastState&&this.lastState.textAlign===void 0&&(this.lastState.textAlign=this.context.textAlign),this.context.textAlign=o)}setTextBaseLine(o){o!==this.context.textBaseline&&(this.lastState&&this.lastState.textBaseline===void 0&&(this.lastState.textBaseline=this.context.textBaseline),this.context.textBaseline=o)}setFont(o){o!==this.font&&(this.lastState&&this.lastState.font===void 0&&(this.lastState.font=this.font),this.font=o,this.context.font=o)}setGlobalAlpha(o){o!==this.context.globalAlpha&&(this.lastState&&this.lastState.globalAlpha===void 0&&(this.lastState.globalAlpha=this.context.globalAlpha),this.context.globalAlpha=o)}setShadowBlur(o){o!==this.context.shadowBlur&&(this.lastState&&this.lastState.shadowBlur===void 0&&(this.lastState.shadowBlur=this.context.shadowBlur),this.context.shadowBlur=o)}setShadowColor(o){o!==this.context.shadowColor&&(this.lastState&&this.lastState.shadowColor===void 0&&(this.lastState.shadowColor=this.context.shadowColor),this.context.shadowColor=o)}setShadowOffsetX(o){o!==this.context.shadowOffsetX&&(this.lastState&&this.lastState.shadowOffsetX===void 0&&(this.lastState.shadowOffsetX=this.context.shadowOffsetX),this.context.shadowOffsetX=o)}setShadowOffsetY(o){o!==this.context.shadowOffsetY&&(this.lastState&&this.lastState.shadowOffsetY===void 0&&(this.lastState.shadowOffsetY=this.context.shadowOffsetY),this.context.shadowOffsetY=o)}setGlobalCompositeOperation(o){o!==this.context.globalCompositeOperation&&(this.lastState&&this.lastState.globalCompositeOperation===void 0&&(this.lastState.globalCompositeOperation=this.context.globalCompositeOperation),this.context.globalCompositeOperation=o)}},tQ=6,rQ=5,iQ=4,nQ=3,oQ=2,Utt=1,TI=2,swe=class{constructor(o){this.data=o,this.bitmap=new Cg(4),this.bitmap.addTrimListener(t=>{this.data.trimChunk(t)})}add(){let o=this.bitmap.findEmpty();return o===-1&&(this.bitmap=this.bitmap.extSize(this.bitmap.size*2),o=this.bitmap.findEmpty()),this.bitmap.markUsed(o),this.data.setArr([0,0],o*TI),o}remove(o){this.data.setArr([0,0],o*TI),this.bitmap.markRemove(o)}set(o,t,e,r,i,n=0,s=0){if(!this.bitmap.isUsed(o))throw new Error("groupId does not exist");if(r!=null&&r!==0&&r!==1)throw new Error("highLightGroupId is incorrect");let a=t?0:1,l=r==null?0:1,c=e?1:0,h=i?1:0;this.data.setArr([(s<<tQ)+(a<<rQ)+(l<<iQ)+(r<<nQ)+(c<<oQ)+h,n],o*TI)}getData(){return this.data}},_h={isDoubleRgb(o,t){if(o==-1)return!1;let e=o*TI;return!!(t!=null&&t.getLength()&&(t.get(e)>>oQ&1)==1)},isHidden(o,t){if(o==-1)return!1;let e=o*TI;return!!(t!=null&&t.getLength()&&t.get(e)>>rQ==1)},isHighLight(o,t){if(o==-1)return!1;let e=o*TI;return!!(t!=null&&t.getLength()&&(t.get(e)>>iQ&1)==1)},getHighLightGroupId(o,t){if(o==-1)throw new Error("GroupId error");if(!t.getLength())throw new Error("GroupId getHighLightGroupId error");let e=o*TI;return t.get(e)>>nQ&1},isForceHighLight(o,t){if(o==-1)return!1;if(t!=null&&t.getLength()){let e=o*TI;return(t.get(e)&Utt)==1}return!1},getColorIndex(o,t){if(o==-1)return 0;if(t!=null&&t.getLength()){let e=o*TI;return t.get(e+1)}return 0},getRenderMode(o,t){if(o==-1)return 0;let e=o*TI;return t!=null&&t.getLength()?t.get(e)>>tQ:0}},Htt="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_n : mat4x4 < f32 > , O_ap : vec4 < f32 > , O_aq : vec4 < f32 > , O_ar : vec3 < f32 > , O_as : vec3 < f32 > , O_at : vec3 < f32 > , O_au : f32 , O_av : f32 , O_i : f32 , O_ad : u32 , O_aw : u32 , O_ax : f32 , O_ay : u32 , O_az : u32 , O_ba : f32 , O_bb : vec4 < f32 > , O_bc : vec4 < f32 > , O_bd : f32 , O_be : f32 , O_bf : f32 , O_bg : f32 , O_bh : f32 , O_bi : u32 , O_bj : f32 , O_bk : f32 , O_bl : vec4 < f32 > , O_bm : f32 , O_bn : f32 , O_bo : f32 , O_bp : f32 , O_bq : O_ae , @ align ( 16 ) O_br : vec3 < f32 > , O_bs : vec3 < f32 > , O_bt : vec3 < f32 > , O_bu : vec2 < f32 > , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_bv : O_a ; @ binding ( 1 ) @ group ( 0 ) var < uniform > O_bw : O_ao ; @ binding ( 4 ) @ group ( 0 ) var < storage , read > O_bx : array < vec4 < f32 > > ; @ binding ( 5 ) @ group ( 0 ) var O_by : sampler ; @ binding ( 6 ) @ group ( 0 ) var O_bz : texture_2d < f32 > ; @ binding ( 7 ) @ group ( 0 ) var < storage , read > O_ca : array < O_m > ; @ binding ( 8 ) @ group ( 0 ) var < storage , read > O_cb : array < u32 > ; @ binding ( 9 ) @ group ( 0 ) var < storage , read > O_cc : array < u32 > ; @ binding ( 10 ) @ group ( 0 ) var < storage , read_write > O_cd : array < atomic < i32 > > ; @ binding ( 11 ) @ group ( 0 ) var < storage , read > O_ce : array < f32 > ; @ binding ( 12 ) @ group ( 0 ) var < storage , read > O_cf : array < f32 > ; @ binding ( 13 ) @ group ( 0 ) var < storage , read > O_cg : array < f32 > ; @ binding ( 14 ) @ group ( 0 ) var < storage , read > O_ch : array < O_u > ; @ binding ( 15 ) @ group ( 0 ) var < storage , read > O_ci : array < f32 > ; override VISIBLE_MASK : u32 ; override MATH_PI : f32 ; override CHAR_WIDTH : f32 ; override CHAR_HEIGHT : f32 ; override CANVAS_WIDTH : f32 ; override CANVAS_HEIGHT : f32 ; override PTGROUP_VISIBLE_SHIFT : u32 ; override PTGROUP_DOUBLERGB_SHIFT : u32 ; override PTGROUP_HIGH_LIGHT_SHIFT : u32 ; override PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT : u32 ; override PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT : u32 ; override ANTIALIAS_RATIO : f32 ; override MIN_PX_LENGTH_RATIO : f32 ; override SDF_WIDTH : f32 ; override SDF_HEIGHT : f32 ; override RENDER_HIGHLIGHT_TYPE_SHIFT : f32 ; override TEMPLATE_OFFSET_DATA_LENGTH : u32 ; override CIRCLE_INSTANCE_PT_LENGTH : i32 ; override TRIANGLE_INSTANCE_PT_LENGTH : i32 ; override CUTED_CIRCLE_INSTANCE_PT_LENGTH : i32 ; override LINE_WIRE_INSTANCE_FRAME_PT_LENGTH : i32 ; override ARC_WIRE_FRAME_INSTANCE_PT_LENGTH : i32 ; override STRING_INSTANCE_PT_LENGTH : i32 ; override STATIC_TRIANGLE_INSTANCE_PT_LENGTH : i32 ; override STATIC_CUTED_CIRCLE_INSTANCE_PT_LENGTH : i32 ; override STATIC_LINE_WIRE_FRAME_INSTANCE_PT_LENGTH : i32 ; override STATIC_ARC_WIRE_FRAME_INSTANCE_PT_LENGTH : i32 ; override STRING_LEVEL_BITLENGTH : u32 ; override ARC_INSTANCE_PT_LENGTH : i32 ; override RECT_INSTANCE_PT_LENGTH : i32 ; override LINE_INSTANCE_PT_LENGTH : i32 ; override LINESEGMENT_INSTANCE_PT_LENGTH : i32 ; override SEMICIRCLE_INSTANCE_PT_LENGTH : i32 ; override GROUP_DATA_LENGTH : u32 ; struct O_cj { @ location ( 0 ) O_ap : vec4 < f32 > , @ location ( 1 ) O_bb : vec4 < f32 > , @ location ( 2 ) O_bc : vec4 < f32 > , } struct O_ck { O_cl : vec4 < f32 > , O_cm : vec4 < f32 > , } fn O_cn ( O_y : f32 , O_z : f32 , O_ap : vec4 < f32 > , O_av : f32 , O_ab : f32 , ) -> O_ck { var O_co : O_ck ; if ( O_y == 1 ) { if ( O_ab == 0 || O_bw . O_bk == 0 ) { if ( O_z == 0 ) { O_co . O_cl = O_bw . O_bb ; } else { O_co . O_cm = O_bw . O_bc ; } } else { if ( O_z == 0 ) { O_co . O_cl = O_ap ; } else { O_co . O_cm = O_ap ; } } O_co . O_cl . a *= O_av ; O_co . O_cm . a *= O_av ; } return O_co ; } fn O_cp ( O_y : f32 , O_z : f32 , O_e : vec4 < f32 > , O_cq : bool , O_ab : f32 , ) { if ( O_y == 1 ) { let O_k = i32 ( O_bv . O_k * O_bw . O_bd ) ; let O_l = i32 ( O_bv . O_l * O_bw . O_bd ) ; var O_cr = i32 ( ( i32 ( O_l ) - 1 - i32 ( O_e . y ) ) * i32 ( O_k ) + i32 ( O_e . x ) ) ; if ( O_cq ) { if ( O_bw . O_bk == 1 && O_ab == 1 ) { atomicAdd ( & O_cd [ O_l * O_k * 2 + O_cr ] , 1 ) ; return ; } if ( O_z == 0 ) { atomicAdd ( & O_cd [ O_cr ] , 1 ) ; } else { atomicAdd ( & O_cd [ O_l * O_k + O_cr ] , 1 ) ; } } else { if ( O_bw . O_bk == 1 && O_ab == 1 ) { atomicSub ( & O_cd [ O_l * O_k * 2 + O_cr ] , 1 ) ; return ; } if ( O_z == 0 ) { atomicSub ( & O_cd [ O_cr ] , 1 ) ; } else { atomicSub ( & O_cd [ O_l * O_k + O_cr ] , 1 ) ; } } } } fn O_cs ( O_ct : f32 , O_cu : f32 , O_cv : O_w , ) -> f32 { let O_p = O_cw ( O_cu ) ; let O_av = select ( 1 , O_bx [ O_p ] . a , O_p > 0 ) ; if ( O_av == 0 ) { return 0 ; } let O_cx = u32 ( O_ct ) ; let O_cy : u32 = O_cx & VISIBLE_MASK ; if ( O_cy == 0 ) { return 0 ; } if ( O_cv . O_x == 1 ) { return 0 ; } if ( O_bw . O_ay == 0 && O_cv . O_ab == 0 ) { return 0 ; } if ( O_bw . O_ay == 0 && O_cv . O_ab == 1 && ( O_bw . O_bm == 0 || O_bw . O_bn == 1 ) ) { return 0 ; } return 1 ; } fn O_cz ( O_r : f32 , ) -> vec2f { var O_da = vec2f ( 0 , 0 ) ; if ( O_r != - 1 ) { let O_cr = u32 ( O_r ) * TEMPLATE_OFFSET_DATA_LENGTH ; O_da = vec2f ( O_cg [ O_cr ] , O_cg [ O_cr + 1 ] ) ; } return O_da ; } fn O_db ( O_dc : f32 , O_dd : f32 , O_de : f32 , ) -> f32 { let O_df = acos ( ( O_de * O_de + O_dc * O_dc - O_dd * O_dd ) / ( 2.0 * O_de * O_dc ) ) ; let O_dg = acos ( ( O_de * O_de + O_dd * O_dd - O_dc * O_dc ) / ( 2.0 * O_de * O_dd ) ) ; let O_dh = O_dc * O_dc * O_df ; let O_di = O_dd * O_dd * O_dg ; if ( O_dc > O_dd ) { return O_di - O_dd * cos ( O_dg ) * O_dd * sin ( O_dg ) ; } else { return O_dh - O_dc * cos ( O_df ) * O_dc * sin ( O_df ) ; } } fn O_dj ( O_aa : f32 , O_ab : f32 , ) -> f32 { if ( O_bw . O_ba != O_aa ) { return 0 ; } if ( O_bw . O_bp != 1 && O_ab == 1 && O_bw . O_bk == 0 && O_bw . O_bm == 1 ) { return 0 ; } if ( O_bw . O_bp == 1 && O_ab == 0 ) { return 0 ; } return 1 ; } fn O_dk ( O_ab : f32 , ) -> bool { return O_ab != 1 || ( O_ab == 1 && O_bw . O_bk == 0 ) ; } fn O_dl ( O_dm : vec4f , ) -> vec4f { var O_dn = O_dm ; O_dn . x += O_bw . O_bu . x * O_dm . w ; O_dn . y += O_bw . O_bu . y * O_dm . w ; return O_dn ; } fn O_cw ( O_cr : f32 , ) -> u32 { return u32 ( O_cr ) >> u32 ( RENDER_HIGHLIGHT_TYPE_SHIFT ) ; } fn O_do ( O_dm : vec4 < f32 > , ) -> O_al { var O_co : O_al ; if ( O_bw . O_ad == 2 ) { let O_n = O_bv . O_c * O_bw . O_n ; O_co . O_am = mat3x3 ( vec3 ( O_n [ 0 ] . xyz ) , vec3 ( O_n [ 1 ] . xyz ) , vec3 ( O_n [ 2 ] . xyz ) ) * vec3 < f32 > ( 0 , 0 , 1 ) ; let O_e = O_n * vec4 ( O_dm . xy , 0 , 1 ) ; O_co . O_an = - O_e . xyz / O_e . w ; } return O_co ; } fn O_dp ( O_cu : f32 , O_aa : f32 , O_ab : f32 , ) -> vec4 < f32 > { let O_p = O_cw ( O_cu ) ; var O_ap : vec4 < f32 > ; var O_dq = O_bw . O_ap ; if ( O_bw . O_bi == 0 && O_bw . O_bm == 1 && O_ab == 1 ) { O_dq = O_bw . O_bl ; } if ( O_p == 0 || ( O_bw . O_bi == 0 && O_bw . O_bm == 0 ) || ( O_bw . O_bi == 0 && O_bw . O_bm == 1 && O_ab == 0 ) ) { O_ap = O_dq ; } else { O_ap = O_bx [ O_p ] ; if ( O_ap . r + O_ap . g + O_ap . b == 0 ) { O_ap . r = O_dq . r ; O_ap . g = O_dq . g ; O_ap . b = O_dq . b ; } O_ap . a *= O_dq . a ; } var O_dr = O_bw . O_ax ; if ( O_aa == 1 || O_bw . O_ba == 1 || O_ab == 1 ) { O_dr = 1 ; } O_ap . r *= O_dr ; O_ap . g *= O_dr ; O_ap . b *= O_dr ; return O_ap ; } fn O_ds ( O_cu : f32 , O_am : vec3 < f32 > , O_an : vec3 < f32 > , O_aa : f32 , O_ab : f32 , ) -> vec4 < f32 > { if ( O_bw . O_ad == 0 || O_bw . O_ad == 1 ) { return O_dp ( O_cu , O_aa , O_ab ) ; } let O_p = O_cw ( O_cu ) ; var O_ar : vec3 < f32 > ; var O_as : vec3 < f32 > ; var O_at : vec3 < f32 > ; if ( O_p == 0 ) { O_ar = O_bw . O_ar ; O_as = O_bw . O_as ; O_at = O_bw . O_at ; } else { let O_dq = O_bx [ O_p ] . rgb ; O_ar = O_dq ; O_as = O_ar ; O_at = O_ar ; } var O_dt = O_ar * O_bw . O_br ; var O_du = normalize ( O_am ) ; var O_bt = O_bw . O_bt ; var O_dv = abs ( dot ( O_du , O_bt ) ) * O_as * O_bw . O_bs ; var O_dw = - 2.0 * O_du * dot ( O_bt , O_du ) + O_bt ; var O_dx = normalize ( O_an ) ; var O_dy = abs ( dot ( O_dw , O_dx ) ) ; var O_dz = O_at * O_bw . O_bs * pow ( O_dy , 300.0 ) * O_bw . O_au * 0.1 ; var O_ap = vec4 ( O_dt + O_dv + O_dz , O_bw . O_av ) ; return O_ap ; } fn O_ea ( O_eb : f32 , O_dm : vec2 < f32 > , ) -> vec2 < f32 > { let O_ec = O_ch [ i32 ( O_eb ) ] ; return O_ec . O_n * vec3 ( O_dm , 1.0 ) ; } fn O_ed ( O_ee : vec2 < f32 > , vec2 : vec2 < f32 > , ) -> f32 { return O_ee . x * vec2 . y - O_ee . y * vec2 . x ; } fn O_ef ( O_eg : f32 , ) -> vec4 < f32 > { let O_eh = vec4 ( 1.0 , 2.0 , 3.0 , 4.0 ) - O_eg ; let O_ei = O_eh * O_eh * O_eh ; let O_ej = O_ei . x ; let O_ek = O_ei . y - 4.0 * O_ei . x ; let O_el = O_ei . z - 4.0 * O_ei . y + 6.0 * O_ei . x ; let O_em = 6.0 - O_ej - O_ek - O_el ; return vec4 ( O_ej , O_ek , O_el , O_em ) * ( 1.0 / 6.0 ) ; } fn O_en ( O_eo : vec2 < f32 > , O_ep : f32 , O_eq : f32 , O_er : f32 , ) -> f32 { let size = vec2 < f32 > ( O_ep , O_eq ) ; let O_es = 1.0 / size ; var O_et = O_eo * size - 0.5 ; let O_eu = fract ( O_et ) ; O_et = O_et - O_eu ; let O_ev = O_ef ( O_eu . x ) ; let O_ew = O_ef ( O_eu . y ) ; let O_ex = O_et . xxyy + vec4 ( - 0.5 , 1.5 , - 0.5 , 1.5 ) ; let O_ei = vec4 ( O_ev . xz + O_ev . yw , O_ew . xz + O_ew . yw ) ; var O_da = O_ex + vec4 ( O_ev . yw , O_ew . yw ) / O_ei ; O_da = O_da * O_es . xxyy ; let O_ey = O_ez ( O_da . xz , O_ep , O_eq , O_er ) ; let O_fa = O_ez ( O_da . yz , O_ep , O_eq , O_er ) ; let O_fb = O_ez ( O_da . xw , O_ep , O_eq , O_er ) ; let O_fc = O_ez ( O_da . yw , O_ep , O_eq , O_er ) ; let O_fd = O_ei . x / ( O_ei . x + O_ei . y ) ; let O_fe = O_ei . z / ( O_ei . z + O_ei . w ) ; return mix ( mix ( O_fc , O_fb , O_fd ) , mix ( O_fa , O_ey , O_fd ) , O_fe ) ; } fn O_ez ( O_eo : vec2 < f32 > , O_ep : f32 , O_eq : f32 , O_er : f32 , ) -> f32 { let O_k = i32 ( O_ep ) ; let O_l = i32 ( O_eq ) ; let O_ff = O_eo . x * O_ep - 0.5 ; let O_fg = O_eo . y * O_eq - 0.5 ; let O_fh = fract ( O_ff ) ; let O_fi = fract ( O_fg ) ; let O_da = i32 ( O_er ) ; let O_fj = i32 ( floor ( O_ff ) ) ; let O_fk = i32 ( floor ( O_fg ) ) ; let O_fl = clamp ( O_fj , 0 , O_k - 1 ) ; let O_fm = clamp ( O_fj + 1 , 0 , O_k - 1 ) ; let O_fn = clamp ( O_fk , 0 , O_l - 1 ) ; let O_fo = clamp ( O_fk + 1 , 0 , O_l - 1 ) ; let O_fp = O_cf [ O_da + ( O_fn * O_k + O_fl ) ] ; let O_fq = O_cf [ O_da + ( O_fn * O_k + O_fm ) ] ; let O_fr = O_cf [ O_da + ( O_fo * O_k + O_fl ) ] ; let O_fs = O_cf [ O_da + ( O_fo * O_k + O_fm ) ] ; let O_ft = mix ( O_fp , O_fq , O_fh ) ; let O_fu = mix ( O_fr , O_fs , O_fh ) ; return mix ( O_ft , O_fu , O_fi ) ; } fn O_fv ( O_fw : u32 , O_fx : vec2 < f32 > , O_fy : f32 , O_fz : f32 , O_ga : f32 , O_gb : f32 , O_gc : f32 , ) -> vec2 < f32 > { let O_gd = O_ga + O_gb / 2 ; let O_ge = vec2 ( cos ( O_gd ) , sin ( O_gd ) ) ; var O_gf = vec2 ( O_ge . y , - O_ge . x ) ; let O_gg = cos ( O_gb / 2 ) * O_fz - O_gc ; let O_gh = O_ge * O_gg ; let O_ej = ( - O_gg + sqrt ( O_gg * O_gg + 8 * O_fy * O_fy ) ) / 2 ; let O_gi = O_ge * O_ej ; let tan = sqrt ( O_ej * O_ej - O_fy * O_fy ) / O_fy ; let O_gj = O_gf * ( ( O_ej - O_gg ) / tan ) ; var O_dm = O_fx ; if ( O_gb < 0 ) { if ( O_fw == 0 ) { O_dm += O_gj ; O_dm += O_gh ; } else if ( O_fw == 1 ) { O_dm -= O_gj ; O_dm += O_gh ; } else { O_dm += O_gi ; } } else { if ( O_fw == 0 ) { O_dm -= O_gj ; O_dm += O_gh ; } else if ( O_fw == 1 ) { O_dm += O_gj ; O_dm += O_gh ; } else { O_dm += O_gi ; } } return O_dm ; } fn O_gk ( O_fw : u32 , O_fx : vec2 < f32 > , O_fy : f32 , O_ga : f32 , O_gb : f32 , O_gl : vec2 < f32 > , O_gm : vec2 < f32 > , ) -> vec2 < f32 > { var O_dm = vec2f ( 0 , 0 ) ; if ( abs ( abs ( O_gb ) - 6.283185307179586 ) <= 1e-8 ) { O_dm = O_fx ; if ( O_gb > 0 ) { if ( O_fw == 0 ) { O_dm . x += O_fy * ( - sqrt ( 3.0 ) ) ; O_dm . y += O_fy * ( - 1.0 ) ; } else if ( O_fw == 1 ) { O_dm . x += O_fy * ( sqrt ( 3.0 ) ) ; O_dm . y += O_fy * ( - 1.0 ) ; } else { O_dm . y += O_fy * ( 2.0 ) ; } } else { if ( O_fw == 0 ) { O_dm . x += O_fy * ( sqrt ( 3.0 ) ) ; O_dm . y += O_fy * ( - 1.0 ) ; } else if ( O_fw == 1 ) { O_dm . x += O_fy * ( - sqrt ( 3.0 ) ) ; O_dm . y += O_fy * ( - 1.0 ) ; } else { O_dm . y += O_fy * ( 2.0 ) ; } } } else { let O_gd = O_ga + O_gb / 2 ; let O_ge = vec2 ( cos ( O_gd ) , sin ( O_gd ) ) ; var O_gf = normalize ( O_gm - O_gl ) ; let O_gg = cos ( O_gb / 2 ) * O_fy ; let O_ej = ( - O_gg + sqrt ( O_gg * O_gg + 8 * O_fy * O_fy ) ) / 2 ; let O_gi = O_ge * O_ej ; let tan = sqrt ( O_ej * O_ej - O_fy * O_fy ) / O_fy ; let O_gj = O_gf * ( ( O_ej - O_gg ) / tan ) - ( O_gm - O_gl ) / 2 ; if ( O_fw == 0 ) { O_dm = O_gm + O_gj ; } else if ( O_fw == 1 ) { O_dm = O_gl - O_gj ; } else { O_dm = O_fx + O_gi ; } } return O_dm ; } struct O_gn { O_gl : vec2f , O_gm : vec2f , O_gf : vec2f , } fn O_go ( O_gl : vec2f , O_gm : vec2f , O_gp : f32 , O_k : f32 , O_gq : f32 , ) -> O_gn { var O_co : O_gn ; var O_gf = normalize ( O_gm - O_gl ) ; if ( O_gp == 1 || O_gp == 2 ) { var O_gr : vec2f ; if ( all ( O_gl == O_gm ) ) { O_gf = vec2 ( 1 , 0 ) ; } O_gr = O_gf * max ( O_k , O_gq ) / 2 ; O_co . O_gl = O_gl - O_gr ; O_co . O_gm = O_gm + O_gr ; O_co . O_gf = O_gf ; return O_co ; } O_co . O_gl = O_gl ; O_co . O_gm = O_gm ; O_co . O_gf = O_gf ; return O_co ; } fn O_gs ( O_gt : u32 , ) -> u32 { return O_gt >> PTGROUP_VISIBLE_SHIFT ; } fn O_gu ( O_gt : u32 , ) -> u32 { return ( O_gt >> PTGROUP_DOUBLERGB_SHIFT ) & 1 ; } fn O_gv ( O_gt : u32 , ) -> u32 { return ( O_gt >> PTGROUP_HIGH_LIGHT_SHIFT ) & 1 ; } fn O_gw ( O_gt : u32 , ) -> u32 { return ( O_gt >> PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT ) & 1 ; } fn O_gx ( O_gt : u32 , ) -> u32 { return O_gt & 1 ; } fn O_gy ( O_gt : u32 , ) -> u32 { return O_gt >> PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT ; } fn O_gz ( O_q : f32 , ) -> O_w { var O_co : O_w ; if ( O_q != - 1 ) { let O_gt = O_cc [ u32 ( O_q ) * GROUP_DATA_LENGTH ] ; O_co . O_ac = f32 ( O_cc [ u32 ( O_q ) * GROUP_DATA_LENGTH + 1 ] ) ; O_co . O_y = f32 ( O_gv ( O_gt ) ) ; O_co . O_x = f32 ( O_gs ( O_gt ) ) ; if ( O_co . O_y == 1 ) { O_co . O_z = f32 ( O_gw ( O_gt ) ) ; O_co . O_ab = f32 ( O_gx ( O_gt ) ) ; } O_co . O_aa = f32 ( O_gu ( O_gt ) ) ; O_co . O_ad = f32 ( O_gy ( O_gt ) ) ; } return O_co ; } fn O_ha ( O_cu : f32 , O_hb : f32 , ) -> f32 { if ( O_cw ( O_cu ) != 0 ) { return O_cu ; } if ( O_cw ( O_hb ) != 0 ) { return O_hb ; } return O_cu ; } fn O_hc ( O_p : f32 , O_hd : f32 , ) -> bool { if ( O_bw . O_bj != O_p || O_hd == 1 ) { return false ; } return true ; } fn O_he ( O_hd : f32 , O_hf : u32 , ) -> bool { if ( O_hd == 0 ) { if ( O_hf == 1 ) { return true ; } return false ; } if ( O_hd == 1 ) { return true ; } if ( O_hd == 2 ) { return false ; } return false ; } struct O_hg { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_hi : f32 , @ location ( 1 ) @ interpolate ( flat ) r : f32 , @ location ( 2 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_ga : f32 , @ location ( 4 ) @ interpolate ( flat ) O_hj : f32 , @ location ( 5 ) O_dm : vec2 < f32 > , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 10 ) @ interpolate ( flat ) O_y : f32 , @ location ( 11 ) @ interpolate ( flat ) O_z : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) @ interpolate ( flat ) O_hd : f32 , } fn O_hk ( O_ct : f32 , O_fw : u32 , O_fx : vec2 < f32 > , O_fz : f32 , O_k : f32 , O_ga : f32 , O_gb : f32 , O_p : f32 , O_da : vec2 < f32 > , O_gq : f32 , O_q : f32 , O_hl : bool , ) -> O_hg { var O_co : O_hg ; let O_cv = O_gz ( O_q ) ; if ( O_hl && ! O_he ( O_cv . O_ad , O_bw . O_ad ) ) { return O_co ; } let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } var O_hm = O_fx + O_da ; O_co . O_fx = O_hm ; O_co . O_hj = O_ga + O_gb ; let O_gc = max ( O_k , O_gq ) / 2 ; O_co . O_hi = O_fz + O_gc ; O_co . r = O_fz - O_gc ; let O_fy = O_co . O_hi ; O_co . O_dm = O_fv ( O_fw , O_hm , O_fy , O_fz , O_ga , O_gb , O_gc ) ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; O_co . O_ga = O_ga ; O_co . O_p = O_ac ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn arcVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_k : f32 , @ location ( 4 ) O_ga : f32 , @ location ( 5 ) O_gb : f32 , @ location ( 6 ) O_o : f32 , @ location ( 7 ) O_p : f32 , @ location ( 8 ) O_q : f32 , ) -> O_hg { var O_co : O_hg ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_k , O_ga , O_gb , O_p , vec2f ( 0 , 0 ) , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_q , false ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn arcTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_k : f32 , @ location ( 4 ) O_ga : f32 , @ location ( 5 ) O_gb : f32 , @ location ( 6 ) O_o : f32 , @ location ( 7 ) O_p : f32 , @ location ( 8 ) O_q : f32 , @ location ( 9 ) O_r : f32 , ) -> O_hg { var O_co : O_hg ; let O_da = O_cz ( O_r ) ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_k , O_ga , O_gb , O_p , O_da , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_q , false ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; return O_co ; } @ vertex fn arcTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_hg { var O_co : O_hg ; let O_hp = i32 ( O_cr ) * ARC_INSTANCE_PT_LENGTH ; var O_hq = O_p ; var O_hr = O_q ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 8 ] ; } if ( O_hr == - 1 ) { O_hr = O_ci [ O_hp + 10 ] ; } let O_fx = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = O_ci [ O_hp + 3 ] ; let O_k = O_ci [ O_hp + 4 ] ; let O_ga = O_ci [ O_hp + 5 ] ; let O_gb = O_ci [ O_hp + 6 ] ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_k , O_ga , O_gb , O_hq , vec2f ( 0 , 0 ) , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_hr , false ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } @ fragment fn arcFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_hi : f32 , @ location ( 1 ) @ interpolate ( flat ) O_fz : f32 , @ location ( 2 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_ga : f32 , @ location ( 4 ) @ interpolate ( flat ) O_hj : f32 , @ location ( 5 ) O_dm : vec2 < f32 > , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 10 ) @ interpolate ( flat ) O_y : f32 , @ location ( 11 ) @ interpolate ( flat ) O_z : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } let O_de = length ( O_dm - O_fx ) ; let O_ht = sqrt ( 1.0 / 2.0 ) * O_bw . O_i ; if ( O_de >= O_hi + O_ht || O_de <= O_fz - O_ht ) { discard ; } let O_gf = O_dm - O_fx ; let O_hu = vec2 ( cos ( O_ga ) , sin ( O_ga ) ) ; let O_hv = O_hu . x * O_gf . y - O_hu . y * O_gf . x ; let O_hw = vec2 ( cos ( O_hj ) , sin ( O_hj ) ) ; let O_hx = O_hw . x * O_gf . y - O_hw . y * O_gf . x ; let O_hy = O_hj - O_ga ; var O_av = 0.0 ; let O_hz = 0.0 ; let O_ia = MATH_PI * O_ht * O_ht ; let O_ib = O_he ( O_hd , O_bw . O_ad ) ; if ( ( O_hy < MATH_PI && ( O_hv < 0.0 || O_hx > 0.0 ) ) || ( O_hy >= MATH_PI && ( O_hv < 0.0 && O_hx > 0.0 ) ) ) { let O_ic = ( O_hi - O_fz ) / 2.0 ; let O_fy = ( O_hi + O_fz ) / 2.0 ; let O_id = O_fx + O_hu * O_fy ; let O_ie = length ( O_dm - O_id ) ; let O_if = O_fx + O_hw * O_fy ; let O_ig = length ( O_dm - O_if ) ; let O_ih = min ( O_ie , O_ig ) ; if ( O_ih >= O_ic + O_ht ) { discard ; } else if ( O_ih <= O_ic - O_ht ) { if ( O_ib && ( O_ie < O_ic - O_bw . O_i * 2 || O_ig < O_ic - O_bw . O_i * 2 ) ) { discard ; } O_av = 1 ; } else { O_av = smoothstep ( O_hz , O_ia , O_db ( O_ic , O_ht , O_ih ) ) ; } } else { if ( O_de > O_hi - O_ht ) { O_av = smoothstep ( O_hz , O_ia , O_db ( O_hi , O_ht , O_de ) ) ; } else if ( O_de < O_fz + O_ht ) { O_av = smoothstep ( O_hz , O_ia , O_ia - O_db ( O_fz , O_ht , O_de ) ) ; } else { if ( O_ib && O_de < O_hi - O_bw . O_i * 2 && O_de > O_fz + O_bw . O_i * 2 ) { discard ; } O_av = 1 ; } } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = vec4f ( O_ap . rgb , O_ap . a * O_av ) ; } let O_ii = O_cn ( O_y , O_z , O_ap , O_av , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } struct O_ij { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) r : f32 , @ location ( 2 ) O_am : vec3 < f32 > , @ location ( 3 ) O_an : vec3 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_p : f32 , @ location ( 5 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 6 ) @ interpolate ( flat ) O_y : f32 , @ location ( 7 ) @ interpolate ( flat ) O_z : f32 , @ location ( 8 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 9 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 10 ) @ interpolate ( flat ) O_hd : f32 , } fn O_ik ( O_ct : f32 , O_fw : u32 , O_fx : vec2 < f32 > , O_fz : f32 , O_p : f32 , O_da : vec2 < f32 > , O_gq : f32 , O_i : f32 , O_q : f32 , ) -> O_ij { var O_co : O_ij ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } var O_hm = O_fx + O_da ; O_co . r = max ( O_fz , O_gq / 2 ) ; var O_il = sqrt ( 3.0 ) ; var O_fy = O_co . r ; O_fy += O_i * sqrt ( 0.5 ) ; if ( O_fw == 0 ) { O_co . O_dm = O_hm + vec2 ( - O_fy * O_il , - O_fy ) ; } else if ( O_fw == 1 ) { O_co . O_dm = O_hm + vec2 ( O_fy * O_il , - O_fy ) ; } else { O_co . O_dm = O_hm + vec2 ( 0 , 2 * O_fy ) ; } O_co . O_fx = O_hm ; O_co . O_p = O_ac ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn circleVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_o : f32 , @ location ( 4 ) O_p : f32 , @ location ( 5 ) O_q : f32 , ) -> O_ij { var O_co : O_ij ; O_co = O_ik ( O_ct , O_fw , O_fx , O_fz , O_p , vec2f ( 0 , 0 ) , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn circleTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_o : f32 , @ location ( 4 ) O_p : f32 , @ location ( 5 ) O_q : f32 , @ location ( 6 ) O_r : f32 , ) -> O_ij { var O_co : O_ij ; let O_da = O_cz ( O_r ) ; O_co = O_ik ( O_ct , O_fw , O_fx , O_fz , O_p , O_da , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; return O_co ; } @ vertex fn circleTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_ij { var O_co : O_ij ; let O_hp = i32 ( O_cr ) * CIRCLE_INSTANCE_PT_LENGTH ; var O_hq = O_p ; var O_hr = O_q ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 5 ] ; } if ( O_hr == - 1 ) { O_hr = O_ci [ O_hp + 10 ] ; } let O_fx = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = max ( O_ci [ O_hp + 3 ] , O_bw . O_i * MIN_PX_LENGTH_RATIO / 2 ) ; O_co = O_ik ( O_ct , O_fw , O_fx , O_fz , O_hq , vec2f ( 0 , 0 ) , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_bw . O_i , O_hr ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs . xy , 0 , 1 ) ; return O_co ; } @ fragment fn circleFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_fz : f32 , @ location ( 2 ) O_am : vec3 < f32 > , @ location ( 3 ) O_an : vec3 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_p : f32 , @ location ( 5 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 6 ) @ interpolate ( flat ) O_y : f32 , @ location ( 7 ) @ interpolate ( flat ) O_z : f32 , @ location ( 8 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 9 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 10 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } let O_de = length ( O_dm - O_fx ) ; let O_ht = sqrt ( 1.0 / 2.0 ) * O_bw . O_i ; if ( O_de >= O_fz + O_ht ) { discard ; } var O_av : f32 = 0.0 ; let O_hz = 0.0 ; let O_ia = MATH_PI * O_ht * O_ht ; let O_ib = O_he ( O_hd , O_bw . O_ad ) ; if ( O_de < O_fz - O_ht ) { if ( O_ib && O_de < O_fz - O_bw . O_i * 2 ) { discard ; } O_av = 1 ; } else if ( O_de < O_fz + O_ht ) { O_av = smoothstep ( O_hz , O_ia , O_db ( O_fz , O_ht , O_de ) ) ; } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = vec4f ( O_ap . rgb , O_ap . a * O_av ) ; } let O_ii = O_cn ( O_y , O_z , O_ap , O_av , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } struct O_im { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_in : f32 , @ location ( 1 ) O_dm : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 4 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 5 ) O_am : vec3 < f32 > , @ location ( 6 ) O_an : vec3 < f32 > , } fn O_io ( O_ct : f32 , O_fw : u32 , O_in : f32 , O_p : f32 , O_q : f32 , ) -> O_im { var O_co : O_im ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } O_co . O_in = O_in ; O_co . O_p = O_ac ; let O_il = sqrt ( 3.0 ) ; if ( O_fw == 0 ) { O_co . O_dm = vec2 ( - O_il , - 1 ) ; } else if ( O_fw == 1 ) { O_co . O_dm = vec2 ( O_il , - 1 ) ; } else { O_co . O_dm = vec2 ( 0 , 2 ) ; } O_co . O_aa = O_cv . O_aa ; O_co . O_ab = O_cv . O_ab ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn pointVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_in : f32 , @ location ( 3 ) size : f32 , @ location ( 4 ) O_o : f32 , @ location ( 5 ) O_p : f32 , @ location ( 6 ) O_q : f32 , ) -> O_im { var O_co : O_im ; let O_fz = size * O_bv . O_i / 4 * O_in * select ( 0.5 , 1 , O_in == 1 ) ; O_co = O_io ( O_ct , O_fw , O_in , O_p , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_fx + O_co . O_dm * O_fz , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ fragment fn pointFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_in : f32 , @ location ( 1 ) O_dm : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 4 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 5 ) O_am : vec3 < f32 > , @ location ( 6 ) O_an : vec3 < f32 > , ) -> O_cj { var O_co : O_cj ; if ( O_in < 1.25 && O_dm . x * O_dm . x + O_dm . y * O_dm . y > 1 ) { discard ; } O_co . O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; O_co . O_bc = vec4f ( 0 , 0 , 0 , 0 ) ; O_co . O_bb = vec4f ( 0 , 0 , 0 , 0 ) ; return O_co ; } struct O_ip { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_gl : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_gm : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_iq : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fy : f32 , @ location ( 5 ) O_am : vec3 < f32 > , @ location ( 6 ) O_an : vec3 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) @ interpolate ( flat ) O_ir : vec2 < f32 > , @ location ( 12 ) @ interpolate ( flat ) O_is : vec2 < f32 > , @ location ( 13 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 14 ) @ interpolate ( flat ) O_hd : f32 , } fn O_it ( O_ct : f32 , O_fw : u32 , O_iu : vec2 < f32 > , O_iv : f32 , O_iw : f32 , O_hy : f32 , O_fy : f32 , O_p : f32 , O_da : vec2 < f32 > , O_gq : f32 , O_i : f32 , O_q : f32 , ) -> O_ip { var O_co : O_ip ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } let O_k = max ( O_iv , O_gq ) ; let O_l = max ( O_iw , O_gq ) ; var O_ix = O_iu + O_da ; O_co . O_fy = O_fy ; O_co . O_p = O_ac ; O_co . O_iq = O_l / 2 ; let O_iy = cos ( O_hy ) ; let O_iz = sin ( O_hy ) ; let O_ja = mat2x2 < f32 > ( O_iy , O_iz , - O_iz , O_iy ) ; O_co . O_gl = O_ix + O_ja * vec2 ( 0 , - O_co . O_iq ) ; O_co . O_gm = O_ix + O_ja * vec2 ( O_k , - O_co . O_iq ) ; let O_gf = normalize ( O_co . O_gm - O_co . O_gl ) ; let O_ge = vec2 ( - O_gf . y , O_gf . x ) ; let O_ir = O_ge * O_co . O_iq ; let O_jb = O_ge * sqrt ( 0.5 ) * O_i ; var O_gr = O_gf * sqrt ( 0.5 ) * O_i ; if ( O_fw == 0 || O_fw == 5 ) { O_co . O_dm = O_co . O_gl - O_ir - O_jb - O_gr ; } else if ( O_fw == 1 ) { O_co . O_dm = O_co . O_gm - O_ir - O_jb + O_gr ; } else if ( O_fw == 2 || O_fw == 3 ) { O_co . O_dm = O_co . O_gm + O_ir + O_jb + O_gr ; } else if ( O_fw == 4 ) { O_co . O_dm = O_co . O_gl + O_ir + O_jb - O_gr ; } O_co . O_ir = O_ir ; O_co . O_is = O_gf * O_k * 0.5 ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn rectVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_iu : vec2 < f32 > , @ location ( 2 ) O_iv : f32 , @ location ( 3 ) O_iw : f32 , @ location ( 4 ) O_hy : f32 , @ location ( 5 ) O_fy : f32 , @ location ( 6 ) O_o : f32 , @ location ( 7 ) O_p : f32 , @ location ( 8 ) O_q : f32 , ) -> O_ip { var O_co : O_ip ; let O_gq = O_bw . O_i * MIN_PX_LENGTH_RATIO ; O_co = O_it ( O_ct , O_fw , O_iu , O_iv , O_iw , O_hy , O_fy , O_p , vec2f ( 0 , 0 ) , O_gq , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn rectTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_iu : vec2 < f32 > , @ location ( 2 ) O_iv : f32 , @ location ( 3 ) O_iw : f32 , @ location ( 4 ) O_hy : f32 , @ location ( 5 ) O_fy : f32 , @ location ( 6 ) O_o : f32 , @ location ( 7 ) O_p : f32 , @ location ( 8 ) O_q : f32 , @ location ( 9 ) O_r : f32 , ) -> O_ip { var O_co : O_ip ; let O_gq = O_bw . O_i * MIN_PX_LENGTH_RATIO ; let O_da = O_cz ( O_r ) ; O_co = O_it ( O_ct , O_fw , O_iu , O_iv , O_iw , O_hy , O_fy , O_p , O_da , O_gq , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; return O_co ; } @ vertex fn rectTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_ip { var O_co : O_ip ; let O_hp = i32 ( O_cr ) * RECT_INSTANCE_PT_LENGTH ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 8 ] ; } let O_gq = O_bw . O_i * MIN_PX_LENGTH_RATIO ; let O_iu = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_iv = O_ci [ O_hp + 3 ] ; let O_iw = O_ci [ O_hp + 4 ] ; let O_hy = O_ci [ O_hp + 5 ] ; let O_fy = O_ci [ O_hp + 6 ] ; let O_k = max ( O_iv , O_gq ) ; let O_l = max ( O_iw , O_gq ) ; O_co = O_it ( O_ct , O_fw , O_iu , O_iv , O_iw , O_hy , O_fy , O_hq , vec2f ( 0 , 0 ) , O_gq , O_bw . O_i , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } @ fragment fn rectFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_gl : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_gm : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_iq : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fy : f32 , @ location ( 5 ) O_am : vec3 < f32 > , @ location ( 6 ) O_an : vec3 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) @ interpolate ( flat ) O_ir : vec2 < f32 > , @ location ( 12 ) @ interpolate ( flat ) O_is : vec2 < f32 > , @ location ( 13 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 14 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } var O_gf = O_gm - O_gl ; let O_jc = length ( O_gf ) ; if ( O_jc == 0 ) { O_gf = vec2 ( 1 , 0 ) ; } else { O_gf = normalize ( O_gf ) ; } let O_ge = vec2 ( O_gf . y , - O_gf . x ) ; var O_av : f32 = 1 ; let O_fx = ( O_gl + O_gm ) * 0.5 ; let O_jd = O_dm - O_fx ; let O_ej = abs ( dot ( O_gf , O_jd ) ) ; let O_ek = abs ( O_jd . x * O_gf . y - O_jd . y * O_gf . x ) ; let O_je = O_jc * 0.5 - O_fy ; let O_jf = O_iq - O_fy ; let O_ib = O_he ( O_hd , O_bw . O_ad ) ; if ( O_ib ) { let O_jg = O_ej - O_je ; let O_jh = O_ek - O_jf ; if ( O_ej > O_je && O_ek > O_jf ) { let O_ji = length ( vec2 ( O_jg , O_jh ) ) ; if ( O_ji > O_fy || O_ji < O_fy - O_bw . O_i * 2 ) { discard ; } } else { if ( O_jh < O_fy - O_bw . O_i * 2 ) { if ( O_jg < O_fy - O_bw . O_i * 2 ) { discard ; } } } } else { let O_fz = sqrt ( 1.0 / 2.0 ) * O_bw . O_i ; if ( O_ej > O_je && O_ek > O_jf ) { let O_jg = O_ej - O_je ; let O_jh = O_ek - O_jf ; let O_ji = length ( vec2 ( O_jg , O_jh ) ) ; if ( O_ji > ( O_fy + O_fz ) ) { discard ; } } let O_jj = length ( O_is ) ; let O_jk = length ( O_ir ) ; let O_jl = O_jj - O_jk ; let O_jm = vec2f ( O_jj - O_fy , O_jk - O_fy ) ; if ( O_fy >= O_fz && O_ej > O_jm . x && O_ek > O_jm . y ) { var distance = length ( vec2 ( O_ej , O_ek ) - O_jm ) ; if ( distance >= O_fy + O_fz ) { discard ; } else if ( distance < O_fy - O_fz ) { O_av = 1 ; } else { let O_ia : f32 = MATH_PI * O_fz * O_fz ; let O_hz : f32 = 0 ; var O_jn = O_db ( O_fy , O_fz , distance ) ; O_av = smoothstep ( O_hz , O_ia , O_jn ) ; } } else { let O_jo = select ( ( O_ek > - O_jl && O_ek + O_jl > O_ej ) , ( O_ej <= O_jl ) || ( O_ej - O_jl < O_ek ) , ( O_jl > 0 ) ) ; let distance = - select ( O_jj - O_ej , O_jk - O_ek , O_jo ) ; if ( distance <= - O_fz ) { O_av = 1 ; } else { let O_ia : f32 = MATH_PI * O_fz * O_fz ; let O_hz : f32 = 0 ; let O_hy = acos ( abs ( distance ) / O_fz ) ; let O_jp = abs ( O_hy * O_fz * O_fz ) ; let O_jq = sqrt ( O_fz * O_fz - distance * distance ) ; let O_jr = O_jq * abs ( distance ) ; var O_jn = O_jp - O_jr ; if ( distance < 0 ) { O_jn = O_ia - O_jn ; } O_av = smoothstep ( O_hz , O_ia * ANTIALIAS_RATIO , O_jn ) ; } } } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = vec4f ( O_ap . rgb , O_ap . a * O_av ) ; } let O_ii = O_cn ( O_y , O_z , O_ap , O_av , O_ab ) ; O_co . O_bb = vec4f ( O_ii . O_cl . rgb , O_ii . O_cl . a * O_av ) ; O_co . O_bc = vec4f ( O_ii . O_cm . rgb , O_ii . O_cm . a * O_av ) ; return O_co ; } struct O_js { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_gl : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_gm : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_iq : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fy : f32 , @ location ( 5 ) O_am : vec3 < f32 > , @ location ( 6 ) O_an : vec3 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) @ interpolate ( flat ) O_ir : vec2 < f32 > , @ location ( 12 ) @ interpolate ( flat ) O_is : vec2 < f32 > , @ location ( 13 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 14 ) @ interpolate ( flat ) O_hd : f32 , } fn O_jt ( O_ct : f32 , O_fw : u32 , O_gl : vec2 < f32 > , O_gm : vec2 < f32 > , O_k : f32 , O_p : f32 , O_gp : f32 , O_gq : f32 , O_i : f32 , O_q : f32 , ) -> O_js { var O_co : O_js ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } O_co . O_p = O_ac ; let O_ju = O_go ( O_gl , O_gm , O_gp , O_k , O_gq ) ; O_co . O_gl = O_ju . O_gl ; O_co . O_gm = O_ju . O_gm ; let O_gf = O_ju . O_gf ; O_co . O_iq = max ( O_k , O_gq ) / 2 ; if ( O_gp == 1 ) { O_co . O_fy = O_co . O_iq ; } let O_ge = vec2 ( - O_gf . y , O_gf . x ) ; let O_ir = O_ge * O_co . O_iq ; let O_jb = O_ge * sqrt ( 0.5 ) * O_i ; var O_gr = O_gf * sqrt ( 0.5 ) * O_i ; if ( O_fw == 0 || O_fw == 5 ) { O_co . O_dm = O_co . O_gl - O_ir - O_jb - O_gr ; } else if ( O_fw == 1 ) { O_co . O_dm = O_co . O_gm - O_ir - O_jb + O_gr ; } else if ( O_fw == 2 || O_fw == 3 ) { O_co . O_dm = O_co . O_gm + O_ir + O_jb + O_gr ; } else if ( O_fw == 4 ) { O_co . O_dm = O_co . O_gl + O_ir + O_jb - O_gr ; } O_co . O_ir = O_ir ; O_co . O_is = O_gf * length ( O_co . O_gm - O_co . O_gl ) * 0.5 ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn lineVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_k : f32 , @ location ( 4 ) O_o : f32 , @ location ( 5 ) O_p : f32 , @ location ( 6 ) O_q : f32 , @ location ( 7 ) O_gp : f32 , ) -> O_js { var O_co : O_js ; O_co = O_jt ( O_ct , O_fw , O_gl , O_gm , O_k , O_p , O_gp , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn lineTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_k : f32 , @ location ( 4 ) O_o : f32 , @ location ( 5 ) O_p : f32 , @ location ( 6 ) O_q : f32 , @ location ( 7 ) O_gp : f32 , @ location ( 8 ) O_r : f32 , ) -> O_js { var O_co : O_js ; O_co = O_jt ( O_ct , O_fw , O_gl , O_gm , O_k , O_p , O_gp , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_bw . O_i , O_q ) ; let O_da = O_cz ( O_r ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm + O_da , 0 , 1 ) ; return O_co ; } @ vertex fn lineTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_js { var O_co : O_js ; let O_hp = i32 ( O_cr ) * LINE_INSTANCE_PT_LENGTH ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 7 ] ; } let O_gl = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_gm = vec2f ( O_ci [ O_hp + 3 ] , O_ci [ O_hp + 4 ] ) ; let O_k = O_ci [ O_hp + 5 ] ; let O_gp = O_ci [ O_hp + 9 ] ; O_co = O_jt ( O_ct , O_fw , O_gl , O_gm , O_k , O_hq , O_gp , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_bw . O_i , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } @ fragment fn lineFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_gl : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_gm : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_iq : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fy : f32 , @ location ( 5 ) O_am : vec3 < f32 > , @ location ( 6 ) O_an : vec3 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) @ interpolate ( flat ) O_ir : vec2 < f32 > , @ location ( 12 ) @ interpolate ( flat ) O_is : vec2 < f32 > , @ location ( 13 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 14 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } var O_gf = O_gm - O_gl ; let O_jc = length ( O_gf ) ; if ( O_jc == 0 ) { O_gf = vec2 ( 1 , 0 ) ; } else { O_gf = normalize ( O_gf ) ; } let O_ge = vec2 ( O_gf . y , - O_gf . x ) ; var O_av : f32 = 1 ; let O_fx = ( O_gl + O_gm ) * 0.5 ; let O_jd = O_dm - O_fx ; let O_ej = abs ( dot ( O_gf , O_jd ) ) ; let O_ek = abs ( O_jd . x * O_gf . y - O_jd . y * O_gf . x ) ; let O_je = O_jc * 0.5 - O_fy ; let O_jf = O_iq - O_fy ; let O_ib = O_he ( O_hd , O_bw . O_ad ) ; if ( O_ib ) { let O_jg = O_ej - O_je ; let O_jh = O_ek - O_jf ; if ( O_ej > O_je && O_ek > O_jf ) { let O_ji = length ( vec2 ( O_jg , O_jh ) ) ; if ( O_ji > O_fy || O_ji < O_fy - O_bw . O_i * 2 ) { discard ; } } else { if ( O_jh < O_fy - O_bw . O_i * 2 ) { if ( O_jg < O_fy - O_bw . O_i * 2 ) { discard ; } } } } else { let O_fz = sqrt ( 1.0 / 2.0 ) * O_bw . O_i ; if ( O_ej > O_je && O_ek > O_jf ) { let O_jg = O_ej - O_je ; let O_jh = O_ek - O_jf ; let O_ji = length ( vec2 ( O_jg , O_jh ) ) ; if ( O_ji > ( O_fy + O_fz ) ) { discard ; } } let O_jj = length ( O_is ) ; let O_jk = length ( O_ir ) ; let O_jl = O_jj - O_jk ; let O_jm = vec2f ( O_jj - O_fy , O_jk - O_fy ) ; if ( O_fy >= O_fz && O_ej > O_jm . x && O_ek > O_jm . y ) { var distance = length ( vec2 ( O_ej , O_ek ) - O_jm ) ; if ( distance >= O_fy + O_fz ) { discard ; } else if ( distance <= O_fy - O_fz ) { O_av = 1 ; } else { let O_ia : f32 = MATH_PI * O_fz * O_fz ; let O_hz : f32 = 0 ; let O_df = acos ( ( O_fy * O_fy + distance * distance - O_fz * O_fz ) / ( 2 * O_fy * distance ) ) ; let O_dg = acos ( ( O_fz * O_fz + distance * distance - O_fy * O_fy ) / ( 2 * O_fz * distance ) ) ; let O_jv = O_df * O_fy * O_fy ; let O_jw = O_dg * O_fz * O_fz ; let O_jr = O_fy * sin ( O_df ) * distance ; var O_jn = O_jv + O_jw - O_jr ; O_av = smoothstep ( O_hz , O_ia , O_jn ) ; } } else { let O_jo = select ( ( O_ek > - O_jl && O_ek + O_jl > O_ej ) , ( O_ej <= O_jl ) || ( O_ej - O_jl < O_ek ) , ( O_jl > 0 ) ) ; let distance = - select ( O_jj - O_ej , O_jk - O_ek , O_jo ) ; if ( distance <= - O_fz ) { O_av = 1 ; } else { let O_ia : f32 = MATH_PI * O_fz * O_fz ; let O_hz : f32 = 0 ; let O_hy = acos ( abs ( distance ) / O_fz ) ; let O_jp = abs ( O_hy * O_fz * O_fz ) ; let O_jq = sqrt ( O_fz * O_fz - distance * distance ) ; let O_jr = O_jq * abs ( distance ) ; var O_jn = O_jp - O_jr ; if ( distance < 0 ) { O_jn = O_ia - O_jn ; } O_av = smoothstep ( O_hz , O_ia * ANTIALIAS_RATIO , O_jn ) ; } } } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = vec4f ( O_ap . rgb , O_ap . a * O_av ) ; } let O_ii = O_cn ( O_y , O_z , O_ap , O_av , O_ab ) ; O_co . O_bb = vec4f ( O_ii . O_cl . rgb , O_ii . O_cl . a * O_av ) ; O_co . O_bc = vec4f ( O_ii . O_cm . rgb , O_ii . O_cm . a * O_av ) ; return O_co ; } struct O_jx { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_ji : f32 , @ location ( 1 ) @ interpolate ( flat ) O_jy : f32 , @ location ( 2 ) @ interpolate ( flat ) O_jz : f32 , @ location ( 3 ) @ interpolate ( flat ) O_p : f32 , @ location ( 4 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 5 ) @ interpolate ( flat ) O_y : f32 , @ location ( 6 ) @ interpolate ( flat ) O_z : f32 , @ location ( 7 ) @ interpolate ( flat ) O_gf : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_gl : vec2 < f32 > , @ location ( 9 ) O_dm : vec2 < f32 > , @ location ( 10 ) @ interpolate ( flat ) O_ir : vec2 < f32 > , @ location ( 11 ) @ interpolate ( flat ) O_ka : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) O_am : vec3 < f32 > , @ location ( 14 ) O_an : vec3 < f32 > , @ location ( 15 ) @ interpolate ( flat ) O_hd : f32 , } fn O_kb ( O_ct : f32 , O_fw : u32 , O_gl : vec2 < f32 > , O_gm : vec2 < f32 > , O_jc : f32 , O_kc : f32 , O_p : f32 , O_da : vec2 < f32 > , O_i : f32 , O_q : f32 , ) -> O_jx { var O_co : O_jx ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } O_co . O_gl = O_gl ; O_co . O_jy = O_jc ; O_co . O_jz = O_kc ; O_co . O_p = O_ac ; var O_dm : vec2 < f32 > ; let O_gf = normalize ( O_gm - O_gl ) ; O_co . O_gf = O_gf ; let O_ge = vec2 ( - O_gf . y , O_gf . x ) ; let O_kd = O_i * 0.5 ; let O_ir = O_ge * O_kd ; let O_jb = O_ge * sqrt ( 2 ) * O_kd ; let O_ke = O_ir + O_jb ; if ( O_fw == 0 || O_fw == 5 ) { O_dm = O_gl - O_ke ; O_co . O_ji = 0 ; } else if ( O_fw == 1 ) { O_dm = O_gm - O_ke ; O_co . O_ji = distance ( O_gl , O_gm ) / O_kd ; } else if ( O_fw == 2 || O_fw == 3 ) { O_dm = O_gm + O_ke ; O_co . O_ji = distance ( O_gl , O_gm ) / O_kd ; } else if ( O_fw == 4 ) { O_dm = O_gl + O_ke ; O_co . O_ji = 0 ; } O_co . O_ir = O_ir ; O_dm += O_da ; O_co . O_dm = O_dm ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn lineSegmentVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_jc : f32 , @ location ( 4 ) O_kc : f32 , @ location ( 5 ) O_o : f32 , @ location ( 6 ) O_p : f32 , @ location ( 7 ) O_q : f32 , ) -> O_jx { var O_co : O_jx ; O_co = O_kb ( O_ct , O_fw , O_gl , O_gm , O_jc , O_kc , O_p , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn lineSegmentTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_jc : f32 , @ location ( 4 ) O_kc : f32 , @ location ( 5 ) O_o : f32 , @ location ( 6 ) O_p : f32 , @ location ( 7 ) O_q : f32 , @ location ( 8 ) O_r : f32 , ) -> O_jx { var O_co : O_jx ; let O_da = O_cz ( O_r ) ; O_co = O_kb ( O_ct , O_fw , O_gl , O_gm , O_jc , O_kc , O_p , O_da , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; return O_co ; } @ vertex fn lineSegmentTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_jx { var O_co : O_jx ; let O_hp = i32 ( O_cr ) * LINESEGMENT_INSTANCE_PT_LENGTH ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 8 ] ; } let O_gl = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_gm = vec2 ( O_ci [ O_hp + 3 ] , O_ci [ O_hp + 4 ] ) ; let O_jc = O_ci [ O_hp + 5 ] ; let O_kc = O_ci [ O_hp + 6 ] ; O_co = O_kb ( O_ct , O_fw , O_gl , O_gm , O_jc , O_kc , O_p , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } @ fragment fn lineSegmentFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_ji : f32 , @ location ( 1 ) @ interpolate ( flat ) O_jy : f32 , @ location ( 2 ) @ interpolate ( flat ) O_jz : f32 , @ location ( 3 ) @ interpolate ( flat ) O_p : f32 , @ location ( 4 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 5 ) @ interpolate ( flat ) O_y : f32 , @ location ( 6 ) @ interpolate ( flat ) O_z : f32 , @ location ( 7 ) @ interpolate ( flat ) O_gf : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_gl : vec2 < f32 > , @ location ( 9 ) O_dm : vec2 < f32 > , @ location ( 10 ) @ interpolate ( flat ) O_ir : vec2 < f32 > , @ location ( 11 ) @ interpolate ( flat ) O_ka : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) O_am : vec3 < f32 > , @ location ( 14 ) O_an : vec3 < f32 > , @ location ( 15 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) || O_ji % O_jy > O_jz ) { discard ; } var O_av : f32 = 0 ; let O_kf = O_dm - O_gl ; let O_jk = length ( O_ir ) ; let O_fz = sqrt ( 1.0 / 2.0 ) * O_bw . O_i ; let distance : f32 = abs ( dot ( O_kf , vec2 ( O_gf . y , - O_gf . x ) ) ) - O_jk ; if ( distance <= - O_fz ) { O_av = 1 ; } else { let O_ia : f32 = MATH_PI * O_fz * O_fz ; let O_hz : f32 = 0 ; let O_hy = acos ( abs ( distance ) / O_fz ) ; let O_jp = abs ( O_hy * O_fz * O_fz ) ; let O_jq = sqrt ( O_fz * O_fz - distance * distance ) ; let O_jr = O_jq * abs ( distance ) ; var O_jn = O_jp - O_jr ; if ( distance < 0 ) { O_jn = O_ia - O_jn ; } O_av = smoothstep ( O_hz , O_ia * ANTIALIAS_RATIO , O_jn ) ; } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = vec4f ( O_ap . rgb , O_ap . a * O_av ) ; } let O_ii = O_cn ( O_y , O_z , O_ap , O_av , O_ab ) ; O_co . O_bb = vec4f ( O_ii . O_cl . rgb , O_ii . O_cl . a * O_av ) ; O_co . O_bc = vec4f ( O_ii . O_cm . rgb , O_ii . O_cm . a * O_av ) ; return O_co ; } struct O_kg { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) r : f32 , @ location ( 2 ) @ interpolate ( flat ) O_hq : f32 , @ location ( 3 ) @ interpolate ( flat ) O_kh : f32 , @ location ( 4 ) @ interpolate ( flat ) O_y : f32 , @ location ( 5 ) @ interpolate ( flat ) O_z : f32 , @ location ( 6 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 7 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 8 ) O_am : vec3 < f32 > , @ location ( 9 ) O_an : vec3 < f32 > , } fn O_ki ( O_ct : f32 , O_fw : u32 , O_fx : vec2 < f32 > , O_fz : f32 , O_hq : f32 , O_kh : f32 , O_da : vec2 < f32 > , O_i : f32 , O_q : f32 , ) -> O_kg { var O_co : O_kg ; let O_cv = O_gz ( O_q ) ; if ( O_cs ( O_ct , O_hq , O_cv ) == 0 || O_cs ( O_ct , O_kh , O_cv ) == 0 ) { return O_co ; } O_co . r = max ( O_fz , O_i / 2 ) ; O_co . O_hq = O_hq ; O_co . O_kh = O_kh ; var O_il = sqrt ( 3.0 ) ; if ( O_fw == 0 ) { O_co . O_dm = O_fx + vec2 ( - O_co . r * O_il , - O_co . r ) ; } else if ( O_fw == 1 ) { O_co . O_dm = O_fx + vec2 ( O_co . r * O_il , - O_co . r ) ; } else { O_co . O_dm = O_fx + vec2 ( 0 , 2 * O_co . r ) ; } O_co . O_dm += O_da ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn semicircleVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_hq : f32 , @ location ( 4 ) O_kh : f32 , @ location ( 5 ) O_o : f32 , @ location ( 6 ) O_q : f32 , ) -> O_kg { var O_co : O_kg ; O_co = O_ki ( O_ct , O_fw , O_fx , O_fz , O_hq , O_kh , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; O_co . O_dm -= O_fx ; return O_co ; } @ vertex fn semicircleTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_hq : f32 , @ location ( 4 ) O_kh : f32 , @ location ( 5 ) O_o : f32 , @ location ( 6 ) O_q : f32 , @ location ( 7 ) O_r : f32 , ) -> O_kg { var O_co : O_kg ; let O_da = O_cz ( O_r ) ; O_co = O_ki ( O_ct , O_fw , O_fx , O_fz , O_hq , O_kh , O_da , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_dm -= O_fx ; return O_co ; } @ vertex fn semicircleTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_kg { var O_co : O_kg ; let O_hp = i32 ( O_cr ) * SEMICIRCLE_INSTANCE_PT_LENGTH ; let O_hq = O_ci [ O_hp + 4 ] ; let O_kh = O_ci [ O_hp + 5 ] ; let O_fx = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = O_ci [ O_hp + 3 ] ; O_co = O_ki ( O_ct , O_fw , O_fx , O_fz , O_hq , O_kh , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; O_co . O_dm -= O_fx ; return O_co ; } @ fragment fn semicircleFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_fz : f32 , @ location ( 2 ) @ interpolate ( flat ) O_hq : f32 , @ location ( 3 ) @ interpolate ( flat ) O_kh : f32 , @ location ( 4 ) @ interpolate ( flat ) O_y : f32 , @ location ( 5 ) @ interpolate ( flat ) O_z : f32 , @ location ( 6 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 7 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 8 ) O_am : vec3 < f32 > , @ location ( 9 ) O_an : vec3 < f32 > , ) -> O_cj { var O_co : O_cj ; if ( ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) || length ( O_dm ) > O_fz ) { discard ; } let O_ap = select ( O_ds ( O_hq , O_am , O_an , O_aa , O_ab ) , O_ds ( O_kh , O_am , O_an , O_aa , O_ab ) , O_dm . x < 0 ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = O_ap ; } let O_ii = O_cn ( O_y , O_z , O_ap , 1 , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } struct O_kj { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_p : f32 , @ location ( 1 ) @ interpolate ( flat ) O_kk : f32 , @ location ( 2 ) @ interpolate ( flat ) O_kl : f32 , @ location ( 3 ) O_km : vec2 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_gc : f32 , @ location ( 5 ) @ interpolate ( flat ) O_iq : f32 , @ location ( 6 ) O_dm : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) O_am : vec3 < f32 > , @ location ( 12 ) O_an : vec3 < f32 > , @ location ( 13 ) @ interpolate ( flat ) O_kn : f32 , @ location ( 14 ) @ interpolate ( flat ) O_ab : f32 , } fn O_ko ( O_ct : f32 , O_fw : u32 , O_e : vec2 < f32 > , O_k : f32 , O_l : f32 , O_hy : f32 , O_kp : f32 , O_kk : f32 , O_kl : f32 , O_p : f32 , O_bf : f32 , O_i : f32 , O_kq : f32 , MATH_PI : f32 , SDF_WIDTH : f32 , SDF_HEIGHT : f32 , O_q : f32 , ) -> O_kj { var O_co : O_kj ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } O_co . O_p = O_ac ; O_co . O_kk = O_kk ; O_co . O_kl = O_kl ; O_co . O_fx = O_e ; var O_kn = 1.0 ; let O_kr = O_l / O_kq ; if ( O_bf == 1 && O_kr > O_kp ) { O_kn = O_kp / O_kr ; } let O_gc = O_k * 0.5 * O_kn ; let O_iq = O_l * 0.5 * O_kn ; O_co . O_gc = O_gc ; O_co . O_iq = O_iq ; var O_dm : vec2 < f32 > ; let O_jk = O_i ; let O_dr = O_iq / O_gc ; let O_df = atan ( O_dr ) ; let O_dg = ( MATH_PI * 0.5 - O_df ) * 0.5 ; let O_ks : f32 = O_jk / sin ( O_df ) ; let O_kt : f32 = O_jk / tan ( O_dg ) ; let O_gj = 0.25 ; let O_ku = O_gc * 2 ; let O_kv = SDF_HEIGHT / SDF_WIDTH ; var O_ej = O_ku * O_iq / ( O_kv * O_iq + O_ku ) ; var O_ek = O_kv * O_ej ; let O_kw = O_gc / O_ej ; let O_kx = ( O_iq - O_ek * 0.5 ) / O_ek ; if ( O_fw == 0 ) { O_dm = vec2 ( - O_gc - O_jk , - O_iq - O_kt ) ; O_co . O_km = vec2 ( 0 , - O_kx ) ; } else if ( O_fw == 1 ) { O_dm = vec2 ( O_ks , 0 ) ; O_co . O_km = vec2 ( O_kw , 0.5 ) ; } else if ( O_fw == 2 ) { O_dm = vec2 ( - O_gc - O_jk , O_iq + O_kt ) ; O_co . O_km = vec2 ( 0 , 1 + O_kx ) ; } else if ( O_fw == 3 ) { O_dm = vec2 ( O_gc + O_jk , - O_iq - O_kt ) ; O_co . O_km = vec2 ( 1 , - O_kx ) ; } else if ( O_fw == 4 ) { O_dm = vec2 ( O_gc + O_jk , O_iq + O_kt ) ; O_co . O_km = vec2 ( 1 , 1 + O_kx ) ; } else { O_dm = vec2 ( - O_ks , 0 ) ; O_co . O_km = vec2 ( 1 - O_kw , 0.5 ) ; } if ( O_fw < 3 ) { O_co . O_km . x -= O_gj ; } else { O_co . O_km . x += O_gj ; } O_co . O_kn = O_kn ; let cos = cos ( O_hy ) ; let sin = sin ( O_hy ) ; O_dm = mat2x2 ( cos , sin , - sin , cos ) * O_dm ; O_dm += O_e ; O_co . O_dm = O_dm ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn drcVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_e : vec2 < f32 > , @ location ( 2 ) O_k : f32 , @ location ( 3 ) O_l : f32 , @ location ( 4 ) O_hy : f32 , @ location ( 5 ) O_ky : f32 , @ location ( 6 ) O_kp : f32 , @ location ( 7 ) O_kk : f32 , @ location ( 8 ) O_kl : f32 , @ location ( 9 ) O_o : f32 , @ location ( 10 ) O_q : f32 , @ location ( 11 ) O_p : f32 , ) -> O_kj { var O_co : O_kj ; if ( O_bw . O_bf == 1 && O_ky < O_bv . O_i ) { return O_co ; } O_co = O_ko ( O_ct , O_fw , O_e , O_k , O_l , O_hy , O_kp , O_kk , O_kl , O_p , O_bw . O_bf , O_bw . O_i , O_bv . O_i , MATH_PI , SDF_WIDTH , SDF_HEIGHT , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm . xy , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ fragment fn drcFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_p : f32 , @ location ( 1 ) @ interpolate ( flat ) O_kk : f32 , @ location ( 2 ) @ interpolate ( flat ) O_kl : f32 , @ location ( 3 ) O_km : vec2 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_gc : f32 , @ location ( 5 ) @ interpolate ( flat ) O_iq : f32 , @ location ( 6 ) O_dm : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) O_am : vec3 < f32 > , @ location ( 12 ) O_an : vec3 < f32 > , @ location ( 13 ) @ interpolate ( flat ) O_kn : f32 , @ location ( 14 ) @ interpolate ( flat ) O_ab : f32 , ) -> O_cj { var O_co : O_cj ; var O_av : f32 = 1 ; let O_i = O_bw . O_i ; let O_dr = O_iq / O_gc ; let O_kz = atan ( O_dr ) ; let O_gf = vec2f ( 1.0 , 0 ) ; var O_la = 1.0 ; if ( dot ( O_gf , O_dm - O_fx ) < 0 ) { O_la = - 1.0 ; } var O_lb = normalize ( vec2f ( O_la , O_dr ) ) ; if ( O_ed ( O_dm - O_fx , O_gf ) > 0 ) { O_lb = normalize ( vec2f ( O_la , - O_dr ) ) ; } let O_kf = O_dm - O_fx ; var O_jk = 0.5 * O_i ; if ( O_bw . O_bg == 1 ) { O_jk = 1.5 * O_i ; } let O_fz = sqrt ( 1.0 / 2.0 ) * O_i ; let distance : f32 = abs ( dot ( O_kf , vec2 ( O_lb . y , - O_lb . x ) ) ) - O_jk ; let O_lc = abs ( dot ( O_kf , O_lb ) ) ; if ( distance <= - O_fz ) { O_av = 1 ; } else { let O_ia : f32 = MATH_PI * O_fz * O_fz ; let O_hz : f32 = 0 ; let O_hy = acos ( abs ( distance ) / O_fz ) ; let O_jp = abs ( O_hy * O_fz * O_fz ) ; let O_jq = sqrt ( O_fz * O_fz - distance * distance ) ; let O_jr = O_jq * abs ( distance ) ; var O_jn = O_jp - O_jr ; if ( distance < 0 ) { O_jn = O_ia - O_jn ; } O_av = smoothstep ( O_hz , O_ia * ANTIALIAS_RATIO , O_jn ) ; } if ( O_bw . O_bg == 1 ) { if ( O_lc >= ( O_gc ) / cos ( O_kz ) - O_fz ) { discard ; } } else { let O_ej = abs ( dot ( O_gf , O_dm - O_fx ) ) ; let O_ld = dot ( O_gf , O_dm - O_fx ) ; if ( O_ej >= O_gc - O_i ) { O_av = 1 ; } let O_kw = O_km . x ; let O_kx = 1 - O_km . y ; if ( O_av == 0 && ( O_kw > 1 || O_kw < 0 || O_kx > 1 || O_kx < 0 ) ) { discard ; } var O_cr : f32 = 0 ; if ( O_ld < 0 ) { O_cr = O_ce [ u32 ( O_kk ) ] ; } else if ( O_ld > 0 ) { O_cr = O_ce [ u32 ( O_kl ) ] ; } let O_ff = clamp ( O_kw , 0 , 1 ) ; let O_fg = clamp ( O_kx , 0 , 1 ) ; let O_da = O_cr * SDF_WIDTH * SDF_HEIGHT ; let O_ep = SDF_WIDTH ; let O_eq = SDF_HEIGHT ; let O_le : f32 = O_en ( vec2 ( O_ff , O_fg ) , O_ep , O_eq , O_da ) ; let O_lf = fwidth ( O_le ) * 0.7 ; let O_lg = smoothstep ( 0.5 - O_lf , 0.5 + O_lf , O_le ) ; if ( O_av == 0 ) { O_av = O_lg ; } } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) || O_bw . O_bf == 1 ) { O_co . O_ap = vec4 ( O_ap . rgb , O_ap . a * O_av ) ; } let O_ii = O_cn ( O_y , O_z , O_ap , 1 , O_ab ) ; O_co . O_bb = vec4 ( O_ii . O_cl . rgb , O_ii . O_cl . a * O_av ) ; O_co . O_bc = vec4 ( O_ii . O_cm . rgb , O_ii . O_cl . a * O_av ) ; return O_co ; } struct O_lh { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_km : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_li : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 4 ) O_dm : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_hd : f32 , } fn O_lj ( O_ct : f32 , O_fw : u32 , O_e : vec2 < f32 > , O_k : f32 , O_l : f32 , O_hy : f32 , O_lk : f32 , O_li : f32 , O_kp : f32 , O_p : f32 , O_da : vec2 < f32 > , O_kq : f32 , O_ll : f32 , O_q : f32 , O_lm : f32 , O_ln : f32 , O_lo : bool , O_ky : f32 , ) -> O_lh { var O_co : O_lh ; if ( O_lo && O_ky < O_bv . O_i ) { return O_co ; } let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } O_co . O_p = O_ac ; O_co . O_li = O_li ; let O_gc = O_k / 2 ; let O_iq = O_l / 2 ; var O_dm : vec2 < f32 > ; if ( O_ll == 0 ) { if ( O_fw == 0 || O_fw == 5 ) { O_dm = vec2 ( - O_gc , - O_iq ) ; O_co . O_km = vec2 ( 0 , 0 ) ; } else if ( O_fw == 1 ) { O_dm = vec2 ( O_gc , - O_iq ) ; O_co . O_km = vec2 ( O_lk , 0 ) ; } else if ( O_fw == 2 || O_fw == 3 ) { O_dm = vec2 ( O_gc , O_iq ) ; O_co . O_km = vec2 ( O_lk , 1 ) ; } else if ( O_fw == 4 ) { O_dm = vec2 ( - O_gc , O_iq ) ; O_co . O_km = vec2 ( 0 , 1 ) ; } } else { if ( O_fw == 0 || O_fw == 5 ) { O_dm = vec2 ( - O_gc , - O_iq ) ; O_co . O_km = vec2 ( O_lk , 0 ) ; } else if ( O_fw == 1 ) { O_dm = vec2 ( O_gc , - O_iq ) ; O_co . O_km = vec2 ( 0 , 0 ) ; } else if ( O_fw == 2 || O_fw == 3 ) { O_dm = vec2 ( O_gc , O_iq ) ; O_co . O_km = vec2 ( 0 , 1 ) ; } else if ( O_fw == 4 ) { O_dm = vec2 ( - O_gc , O_iq ) ; O_co . O_km = vec2 ( O_lk , 1 ) ; } } O_dm . x += O_k * O_lm ; O_dm . y += O_l * O_ln ; if ( O_lo ) { let O_kr = O_l / O_kq ; if ( O_kr > O_kp ) { O_dm *= O_kp / O_kr ; } } let cos = cos ( O_hy ) ; let sin = sin ( O_hy ) ; O_dm = mat2x2 ( cos , sin , - sin , cos ) * O_dm ; O_dm += O_e ; O_dm += O_da ; O_co . O_dm = O_dm ; O_co . O_aa = O_cv . O_aa ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn stringVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_e : vec2 < f32 > , @ location ( 2 ) O_k : f32 , @ location ( 3 ) O_l : f32 , @ location ( 4 ) O_hy : f32 , @ location ( 5 ) O_lk : f32 , @ location ( 6 ) O_li : f32 , @ location ( 7 ) O_lp : f32 , @ location ( 8 ) O_kp : f32 , @ location ( 9 ) O_q : f32 , @ location ( 10 ) O_p : f32 , @ location ( 11 ) O_o : f32 , @ location ( 12 ) O_lm : f32 , @ location ( 13 ) O_ln : f32 , ) -> O_lh { var O_co : O_lh ; O_co = O_lj ( O_ct , O_fw , O_e , O_k , O_l , O_hy , O_lk , O_li , O_kp , O_p , vec2f ( 0 , 0 ) , O_bv . O_i , O_bv . O_j , O_q , O_lm , O_ln , true , O_lp ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm . xy , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn stringTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_e : vec2 < f32 > , @ location ( 2 ) O_k : f32 , @ location ( 3 ) O_l : f32 , @ location ( 4 ) O_hy : f32 , @ location ( 5 ) O_lk : f32 , @ location ( 6 ) O_li : f32 , @ location ( 7 ) O_lp : f32 , @ location ( 8 ) O_kp : f32 , @ location ( 9 ) O_q : f32 , @ location ( 10 ) O_p : f32 , @ location ( 11 ) O_o : f32 , @ location ( 12 ) O_lm : f32 , @ location ( 13 ) O_ln : f32 , @ location ( 14 ) O_r : f32 , ) -> O_lh { var O_co : O_lh ; let O_da = O_cz ( O_r ) ; O_co = O_lj ( O_ct , O_fw , O_e , O_k , O_l , O_hy , O_lk , O_li , O_kp , O_p , O_da , O_bv . O_i , O_bv . O_j , O_q , O_lm , O_ln , true , O_lp ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm . xy , 0 , 1 ) ; return O_co ; } @ vertex fn stringTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_lh { var O_co : O_lh ; let O_lq = u32 ( O_cr ) >> STRING_LEVEL_BITLENGTH ; var O_hp = i32 ( O_lq ) * STRING_INSTANCE_PT_LENGTH ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 11 ] ; } let O_li = O_ci [ O_hp + 7 ] ; let O_k = O_ci [ O_hp + 3 ] ; let O_l = O_ci [ O_hp + 4 ] ; let O_lk = O_ci [ O_hp + 6 ] ; let O_kp = O_ci [ O_hp + 9 ] ; let O_hy = O_ci [ O_hp + 5 ] ; let O_e = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_lm = O_ci [ O_hp + 13 ] ; let O_ln = O_ci [ O_hp + 14 ] ; let O_lp = O_ci [ O_hp + 8 ] ; O_co = O_lj ( O_ct , O_fw , O_e , O_k , O_l , O_hy , O_lk , O_li , O_kp , O_hq , vec2f ( 0 , 0 ) , O_bv . O_i , O_bv . O_j , O_q , O_lm , O_ln , true , O_lp ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs . xy , 0 , 1 ) ; return O_co ; } @ fragment fn stringFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_km : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_li : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 4 ) O_dm : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; let O_lr = CHAR_WIDTH + CHAR_HEIGHT / 8.0 ; let O_ls = CHAR_HEIGHT + CHAR_HEIGHT / 4.0 ; let O_lt = u32 ( CANVAS_WIDTH / O_lr ) ; let O_cr = O_cb [ u32 ( O_li + O_km . x ) ] ; let O_lu = O_cr / O_lt ; let O_lv = O_cr % O_lt ; let O_lw = O_lr * f32 ( O_lv ) ; let O_lx = O_ls * f32 ( O_lu ) ; let O_ly = O_lw ; let O_lz = O_lx ; let O_ma = O_ly + CHAR_WIDTH ; let O_mb = O_lz + CHAR_HEIGHT ; let O_mc = O_ly / CANVAS_WIDTH ; let O_md = O_ma / CANVAS_WIDTH ; let O_me = O_mb / CANVAS_HEIGHT ; let O_mf = O_lz / CANVAS_HEIGHT ; let O_ap = textureSample ( O_bz , O_by , vec2 ( O_mc + ( O_md - O_mc ) * ( O_km . x % 1.0 ) , O_me + ( O_mf - O_me ) * O_km . y ) ) ; if ( O_ap . r <= 0.1 ) { discard ; } var O_mg : vec4f ; if ( O_p > 0 ) { O_mg = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; } else { O_mg = O_bw . O_aq ; if ( O_aa == 0 && O_ab == 0 ) { var O_dr = O_bw . O_ax ; O_mg . r *= O_dr ; O_mg . g *= O_dr ; O_mg . b *= O_dr ; } } O_co . O_ap = vec4 ( O_mg . rgb , O_mg . a * O_ap . r + 0.1 ) ; if ( O_ab == 1 && O_bw . O_bk == 1 ) { O_co . O_bb = vec4 ( O_mg . rgb , O_mg . a * O_ap . r + 0.1 ) ; } return O_co ; } @ fragment fn stringRulerFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_km : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_li : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 4 ) O_dm : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ab : f32 , ) -> @ location ( 0 ) vec4 < f32 > { let O_lr = CHAR_WIDTH + CHAR_HEIGHT / 8.0 ; let O_ls = CHAR_HEIGHT + CHAR_HEIGHT / 4.0 ; let O_lt = u32 ( CANVAS_WIDTH / O_lr ) ; let O_cr = O_cb [ u32 ( O_li + O_km . x ) ] ; let O_lu = O_cr / O_lt ; let O_lv = O_cr % O_lt ; let O_lw = O_lr * f32 ( O_lv ) ; let O_lx = O_ls * f32 ( O_lu ) ; let O_ly = O_lw ; let O_lz = O_lx ; let O_ma = O_ly + CHAR_WIDTH ; let O_mb = O_lz + CHAR_HEIGHT ; let O_mc = O_ly / CANVAS_WIDTH ; let O_md = O_ma / CANVAS_WIDTH ; let O_me = O_mb / CANVAS_HEIGHT ; let O_mf = O_lz / CANVAS_HEIGHT ; let O_ap = textureSample ( O_bz , O_by , vec2 ( O_mc + ( O_md - O_mc ) * ( O_km . x % 1.0 ) , O_me + ( O_mf - O_me ) * O_km . y ) ) ; if ( O_ap . r <= 0.1 ) { discard ; } var O_mg : vec4f ; if ( O_p > 0 ) { let O_mh = O_cw ( O_p ) ; O_mg = O_bx [ O_mh ] ; if ( O_mg . r + O_mg . g + O_mg . b == 0 ) { O_mg . r = O_bw . O_ap . r ; O_mg . g = O_bw . O_ap . g ; O_mg . b = O_bw . O_ap . b ; } O_mg . a *= O_bw . O_ap . a ; } else { O_mg = O_bw . O_aq ; } return vec4 ( O_mg . rgb , O_mg . a * O_ap . r + 0.1 ) ; } @ vertex fn scaleStringVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_e : vec2 < f32 > , @ location ( 2 ) O_k : f32 , @ location ( 3 ) O_l : f32 , @ location ( 4 ) O_hy : f32 , @ location ( 5 ) O_lk : f32 , @ location ( 6 ) O_li : f32 , @ location ( 7 ) O_q : f32 , @ location ( 8 ) O_p : f32 , @ location ( 9 ) O_o : f32 , @ location ( 10 ) O_lm : f32 , @ location ( 11 ) O_ln : f32 , ) -> O_lh { var O_co : O_lh ; O_co = O_lj ( O_ct , O_fw , O_e , O_k , O_l , O_hy , O_lk , O_li , 0 , O_p , vec2f ( 0 , 0 ) , O_bv . O_i , O_bv . O_j , O_q , O_lm , O_ln , false , 0 ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm . xy , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } struct O_mi { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) a : f32 , @ location ( 2 ) @ interpolate ( flat ) b : f32 , @ location ( 3 ) @ interpolate ( flat ) O_ga : f32 , @ location ( 4 ) @ interpolate ( flat ) O_hj : f32 , @ location ( 5 ) @ interpolate ( flat ) O_mj : f32 , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 10 ) @ interpolate ( flat ) O_y : f32 , @ location ( 11 ) @ interpolate ( flat ) O_z : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) @ interpolate ( flat ) O_hd : f32 , } fn O_mk ( O_dm : vec2 < f32 > , O_ml : f32 , ) -> vec2 < f32 > { let O_mm : f32 = cos ( O_ml ) ; let O_mn : f32 = sin ( O_ml ) ; let O_ej : f32 = O_dm . x * O_mm - O_dm . y * O_mn ; let O_ek : f32 = O_dm . x * O_mn + O_dm . y * O_mm ; return vec2 < f32 > ( O_ej , O_ek ) ; } fn O_mo ( O_ct : f32 , O_fw : u32 , O_fx : vec2 < f32 > , O_kv : f32 , O_fu : f32 , O_ga : f32 , O_hj : f32 , O_ml : f32 , O_mj : f32 , O_p : f32 , O_q : f32 , ) -> O_mi { var O_co : O_mi ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } O_co . a = O_kv ; O_co . b = O_fu ; O_co . O_ga = O_ga ; O_co . O_hj = O_hj ; O_co . O_mj = O_mj ; let O_mp = max ( O_kv , O_fu ) ; O_co . O_dm = vec2 ( 0 , 0 ) ; if ( O_fw == 0 ) { O_co . O_dm . x += O_mp * ( - sqrt ( 3.0 ) ) ; O_co . O_dm . y += O_mp * ( - 1.0 ) ; } else if ( O_fw == 1 ) { O_co . O_dm . x += O_mp * ( sqrt ( 3.0 ) ) ; O_co . O_dm . y += O_mp * ( - 1.0 ) ; } else { O_co . O_dm . y += O_mp * ( 2.0 ) ; } O_co . O_dm = O_mk ( O_co . O_dm , O_ml ) + O_fx ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; O_co . O_p = O_ac ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn ellipseVert ( @ builtin ( vertex_index ) O_fw : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_kv : f32 , @ location ( 3 ) O_fu : f32 , @ location ( 4 ) O_ga : f32 , @ location ( 5 ) O_hj : f32 , @ location ( 6 ) O_ml : f32 , @ location ( 7 ) O_mj : f32 , @ location ( 8 ) O_o : f32 , @ location ( 9 ) O_p : f32 , @ location ( 10 ) O_q : f32 , ) -> O_mi { var O_co : O_mi ; O_co = O_mo ( O_ct , O_fw , O_fx , O_kv , O_fu , O_ga , O_hj , O_ml , O_mj , O_p , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ fragment fn ellipseFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_kv : f32 , @ location ( 2 ) @ interpolate ( flat ) O_fu : f32 , @ location ( 3 ) @ interpolate ( flat ) O_ga : f32 , @ location ( 4 ) @ interpolate ( flat ) O_hj : f32 , @ location ( 5 ) @ interpolate ( flat ) O_mj : f32 , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 10 ) @ interpolate ( flat ) O_y : f32 , @ location ( 11 ) @ interpolate ( flat ) O_z : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } let O_mp = max ( O_kv , O_fu ) ; if ( length ( O_dm ) > O_mp ) { discard ; } let O_mq = max ( O_mj , O_bw . O_i * 2.0 ) / 2.0 ; let O_mr = O_dm . x ; let O_ms = O_dm . y ; let O_mt = O_kv + O_mq ; let O_mu = O_fu + O_mq ; let O_mv = O_kv - O_mq ; let O_mw = O_fu - O_mq ; let O_mx = pow ( O_mr , 2.0 ) ; let O_my = pow ( O_ms , 2.0 ) ; let O_mz = O_mx / pow ( O_mt , 2.0 ) + O_my / pow ( O_mu , 2.0 ) ; let O_na = O_mx / pow ( O_mv , 2.0 ) + O_my / pow ( O_mw , 2.0 ) ; if ( O_mz > 1 ) { discard ; } else if ( O_na > 1 ) { } else { discard ; } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = O_ap ; } let O_ii = O_cn ( O_y , O_z , O_ap , 1 , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } @ vertex fn arcWireFrameVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_ga : f32 , @ location ( 4 ) O_gb : f32 , @ location ( 5 ) O_o : f32 , @ location ( 6 ) O_p : f32 , @ location ( 7 ) O_q : f32 , ) -> O_hg { var O_co : O_hg ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_bw . O_i , O_ga , O_gb , O_p , vec2f ( 0 , 0 ) , O_bw . O_i , O_q , true ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn arcWireFrameTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_ga : f32 , @ location ( 4 ) O_gb : f32 , @ location ( 5 ) O_o : f32 , @ location ( 6 ) O_p : f32 , @ location ( 7 ) O_q : f32 , @ location ( 8 ) O_r : f32 , ) -> O_hg { var O_co : O_hg ; let O_da = O_cz ( O_r ) ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_bw . O_i , O_ga , O_gb , O_p , O_da , O_bw . O_i , O_q , true ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn arcWireFrameTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_hg { var O_co : O_hg ; let O_hp = i32 ( O_cr ) * ARC_WIRE_FRAME_INSTANCE_PT_LENGTH ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 7 ] ; } let O_fx = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = O_ci [ O_hp + 3 ] ; let O_ga = O_ci [ O_hp + 4 ] ; let O_gb = O_ci [ O_hp + 5 ] ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_bw . O_i , O_ga , O_gb , O_hq , vec2f ( 0 , 0 ) , O_bw . O_i , O_q , true ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } @ fragment fn arcWireFrameFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_hi : f32 , @ location ( 1 ) @ interpolate ( flat ) O_fz : f32 , @ location ( 2 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_ga : f32 , @ location ( 4 ) @ interpolate ( flat ) O_hj : f32 , @ location ( 5 ) O_dm : vec2 < f32 > , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 10 ) @ interpolate ( flat ) O_y : f32 , @ location ( 11 ) @ interpolate ( flat ) O_z : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) ) { discard ; } let O_de = length ( O_dm - O_fx ) ; if ( O_de > O_hi || O_de < O_fz ) { discard ; } let O_gf = O_dm - O_fx ; let O_hu = vec2 ( cos ( O_ga ) , sin ( O_ga ) ) ; let O_hv = O_hu . x * O_gf . y - O_hu . y * O_gf . x ; let O_hw = vec2 ( cos ( O_hj ) , sin ( O_hj ) ) ; let O_hx = O_hw . x * O_gf . y - O_hw . y * O_gf . x ; let O_hy = O_hj - O_ga ; if ( ( O_hy < MATH_PI && ( O_hv < 0.0 || O_hx > 0.0 ) ) || ( O_hy >= MATH_PI && ( O_hv < 0.0 && O_hx > 0.0 ) ) ) { let O_ic = ( O_hi - O_fz ) / 2.0 ; let O_fy = ( O_hi + O_fz ) / 2.0 ; let O_id = O_fx + O_hu * O_fy ; let O_ie = length ( O_dm - O_id ) ; let O_if = O_fx + O_hw * O_fy ; let O_ig = length ( O_dm - O_if ) ; if ( O_ie > O_ic && O_ig > O_ic ) { discard ; } if ( O_ie < O_ic - O_bw . O_i * 2 || O_ig < O_ic - O_bw . O_i * 2 ) { discard ; } } else if ( O_de < O_hi - O_bw . O_i * 2 && O_de > O_fz + O_bw . O_i * 2 ) { discard ; } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = O_ap ; } let O_ii = O_cn ( O_y , O_z , O_ap , 1 , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } @ vertex fn staticArcWireFrameVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_ga : f32 , @ location ( 4 ) O_gb : f32 , @ location ( 5 ) O_nb : f32 , ) -> O_hg { var O_co : O_hg ; let O_ec = O_ca [ u32 ( O_nb ) ] ; let O_q = O_ec . O_q ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_bw . O_i , O_ga , O_gb , O_ec . O_p , vec2f ( 0 , 0 ) , O_bw . O_i , O_q , true ) ; var O_hs = O_ec . O_n * vec3 ( O_co . O_dm , 1 ) ; let O_da = O_cz ( O_ec . O_r ) ; O_hs += O_da ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn staticArcWireFrameTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_hg { var O_co : O_hg ; let O_hp = i32 ( O_cr ) * STATIC_ARC_WIRE_FRAME_INSTANCE_PT_LENGTH ; let O_nb = O_ci [ O_hp + 6 ] ; let O_ec = O_ca [ u32 ( O_nb ) ] ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ec . O_p ; } let O_fx = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = O_ci [ O_hp + 3 ] ; let O_ga = O_ci [ O_hp + 4 ] ; let O_gb = O_ci [ O_hp + 5 ] ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_bw . O_i , O_ga , O_gb , O_hq , vec2f ( 0 , 0 ) , O_bw . O_i , O_q , true ) ; var O_hs = O_ec . O_n * vec3 ( O_co . O_dm , 1 ) ; O_hs = O_ea ( O_eb , O_hs ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } struct O_nc { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_p : f32 , @ location ( 1 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 2 ) @ interpolate ( flat ) O_y : f32 , @ location ( 3 ) @ interpolate ( flat ) O_z : f32 , @ location ( 4 ) O_dm : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_hd : f32 , } fn O_nd ( O_ct : f32 , O_fw : u32 , O_gl : vec2 < f32 > , O_gm : vec2 < f32 > , O_p : f32 , O_da : vec2 < f32 > , O_i : f32 , O_q : f32 , ) -> O_nc { var O_co : O_nc ; let O_cv = O_gz ( O_q ) ; let O_ib = O_he ( O_cv . O_ad , O_bw . O_ad ) ; if ( ! O_ib ) { return O_co ; } let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } var O_dm : vec2 < f32 > ; let O_gf = normalize ( O_gm - O_gl ) ; let O_ge = vec2 ( - O_gf . y , O_gf . x ) ; let O_ir = vec2 ( O_ge * O_i ) ; if ( O_fw == 0 || O_fw == 5 ) { O_dm = O_gl - O_ir ; } else if ( O_fw == 1 ) { O_dm = O_gm - O_ir ; } else if ( O_fw == 2 || O_fw == 3 ) { O_dm = O_gm + O_ir ; } else if ( O_fw == 4 ) { O_dm = O_gl + O_ir ; } O_dm += O_da ; O_co . O_dm = O_dm ; O_co . O_p = O_ac ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn lineWireFrameVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_o : f32 , @ location ( 4 ) O_p : f32 , @ location ( 5 ) O_q : f32 , ) -> O_nc { var O_co : O_nc ; O_co = O_nd ( O_ct , O_fw , O_gl , O_gm , O_p , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn lineWireFrameTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_o : f32 , @ location ( 4 ) O_p : f32 , @ location ( 5 ) O_q : f32 , @ location ( 6 ) O_r : f32 , ) -> O_nc { var O_co : O_nc ; let O_da = O_cz ( O_r ) ; O_co = O_nd ( O_ct , O_fw , O_gl , O_gm , O_p , O_da , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; return O_co ; } @ vertex fn lineWireFrameTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_nc { var O_co : O_nc ; let O_hp = i32 ( O_cr ) * LINE_WIRE_INSTANCE_FRAME_PT_LENGTH ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 6 ] ; } let O_gl = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_gm = vec2f ( O_ci [ O_hp + 3 ] , O_ci [ O_hp + 4 ] ) ; O_co = O_nd ( O_ct , O_fw , O_gl , O_gm , O_hq , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } @ fragment fn lineWireFrameFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_p : f32 , @ location ( 1 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 2 ) @ interpolate ( flat ) O_y : f32 , @ location ( 3 ) @ interpolate ( flat ) O_z : f32 , @ location ( 4 ) O_dm : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) ) { discard ; } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = O_ap ; } let O_ii = O_cn ( O_y , O_z , O_ap , 1 , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } @ vertex fn staticLineWireFrameVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_nb : f32 , ) -> O_nc { var O_co : O_nc ; let O_ec = O_ca [ u32 ( O_nb ) ] ; let O_q = O_ec . O_q ; let O_da = O_cz ( O_ec . O_r ) ; let O_ne = O_ec . O_n * vec3 ( O_gl , 1 ) ; let O_nf = O_ec . O_n * vec3 ( O_gm , 1 ) ; O_co = O_nd ( O_ct , O_fw , O_ne , O_nf , O_ec . O_p , O_da , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn staticLineWireFrameTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_nc { var O_co : O_nc ; let O_hp = i32 ( O_cr ) * STATIC_LINE_WIRE_FRAME_INSTANCE_PT_LENGTH ; let O_nb = O_ci [ O_hp + 5 ] ; let O_ec = O_ca [ u32 ( O_nb ) ] ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ec . O_p ; } let O_gl = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_gm = vec2f ( O_ci [ O_hp + 3 ] , O_ci [ O_hp + 4 ] ) ; let O_ne = O_ec . O_n * vec3 ( O_gl , 1 ) ; let O_nf = O_ec . O_n * vec3 ( O_gm , 1 ) ; O_co = O_nd ( O_ct , O_fw , O_ne , O_nf , O_hq , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } struct O_ng { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 1 ) O_am : vec3 < f32 > , @ location ( 2 ) O_an : vec3 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_p : f32 , @ location ( 4 ) @ interpolate ( flat ) O_nh : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ni : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_nj : vec2 < f32 > , @ location ( 7 ) O_dm : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 12 ) @ interpolate ( flat ) O_hd : f32 , } fn O_nk ( O_ct : f32 , O_fw : u32 , O_nh : vec2 < f32 > , O_ni : vec2 < f32 > , O_nj : vec2 < f32 > , O_p : f32 , O_da : vec2 < f32 > , O_q : f32 , ) -> O_ng { var O_co : O_ng ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 || ! O_hc ( O_ac , O_cv . O_ad ) ) { return O_co ; } O_co . O_p = O_ac ; var O_dm : vec2 < f32 > ; if ( O_fw == 0 ) { O_dm = O_nh ; } else if ( O_fw == 1 ) { O_dm = O_ni ; } else { O_dm = O_nj ; } O_dm += O_da ; O_co . O_nh = O_nh ; O_co . O_ni = O_ni ; O_co . O_nj = O_nj ; O_co . O_dm = O_dm ; O_co . O_p = O_p ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn triangleVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_nh : vec2 < f32 > , @ location ( 2 ) O_ni : vec2 < f32 > , @ location ( 3 ) O_nj : vec2 < f32 > , @ location ( 4 ) O_o : f32 , @ location ( 5 ) O_p : f32 , @ location ( 6 ) O_q : f32 , ) -> O_ng { var O_co : O_ng ; O_co = O_nk ( O_ct , O_fw , O_nh , O_ni , O_nj , O_p , vec2f ( 0 , 0 ) , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn triangleTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_nh : vec2 < f32 > , @ location ( 2 ) O_ni : vec2 < f32 > , @ location ( 3 ) O_nj : vec2 < f32 > , @ location ( 4 ) O_o : f32 , @ location ( 5 ) O_p : f32 , @ location ( 6 ) O_q : f32 , @ location ( 7 ) O_r : f32 , ) -> O_ng { var O_co : O_ng ; let O_da = O_cz ( O_r ) ; O_co = O_nk ( O_ct , O_fw , O_nh , O_ni , O_nj , O_p , O_da , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; return O_co ; } @ vertex fn triangleTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_ng { var O_co : O_ng ; let O_hp = i32 ( O_cr ) * TRIANGLE_INSTANCE_PT_LENGTH ; var O_nh : vec2 < f32 > = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; var O_ni : vec2 < f32 > = vec2 ( O_ci [ O_hp + 3 ] , O_ci [ O_hp + 4 ] ) ; var O_nj : vec2 < f32 > = vec2 ( O_ci [ O_hp + 5 ] , O_ci [ O_hp + 6 ] ) ; O_co = O_nk ( O_ct , O_fw , O_nh , O_ni , O_nj , O_p , vec2f ( 0 , 0 ) , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs . xy , 0 , 1 ) ; return O_co ; } @ fragment fn triangleFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ builtin ( front_facing ) O_cq : bool , @ location ( 1 ) O_am : vec3 < f32 > , @ location ( 2 ) O_an : vec3 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_p : f32 , @ location ( 4 ) @ interpolate ( flat ) O_nh : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ni : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_nj : vec2 < f32 > , @ location ( 7 ) O_dm : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 12 ) @ interpolate ( flat ) O_hd : f32 , ) -> @ location ( 0 ) vec4 < f32 > { if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } if ( O_dj ( O_aa , O_ab ) == 0 ) { discard ; } if ( O_y == 1 ) { if ( O_ab == 0 || O_bw . O_bk == 0 || O_p == O_bw . O_bo ) { O_cp ( O_y , O_z , O_hh , O_cq , O_ab ) ; } } if ( ! O_dk ( O_ab ) ) { discard ; } return vec4f ( 0 , 0 , 0 , 0 ) ; } @ vertex fn staticTriangleVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_nh : vec2 < f32 > , @ location ( 2 ) O_ni : vec2 < f32 > , @ location ( 3 ) O_nj : vec2 < f32 > , @ location ( 4 ) O_nb : f32 , ) -> O_ng { var O_co : O_ng ; let O_ec = O_ca [ u32 ( O_nb ) ] ; let O_r = O_ec . O_r ; let O_q = O_ec . O_q ; let O_p = O_ec . O_p ; O_co = O_nk ( O_ct , O_fw , O_nh , O_ni , O_nj , O_p , vec2f ( 0 , 0 ) , O_q ) ; var O_hs = O_ec . O_n * vec3 ( O_co . O_dm , 1 ) ; let O_da = O_cz ( O_r ) ; O_hs += O_da ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn staticTriangleTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_ng { var O_co : O_ng ; let O_hp = i32 ( O_cr ) * STATIC_TRIANGLE_INSTANCE_PT_LENGTH ; let O_nb = O_ci [ O_hp + 7 ] ; let O_ec = O_ca [ u32 ( O_nb ) ] ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ec . O_p ; } let O_nh = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_ni = vec2f ( O_ci [ O_hp + 3 ] , O_ci [ O_hp + 4 ] ) ; let O_nj = vec2f ( O_ci [ O_hp + 5 ] , O_ci [ O_hp + 6 ] ) ; O_co = O_nk ( O_ct , O_fw , O_nh , O_ni , O_nj , O_hq , vec2f ( 0 , 0 ) , O_q ) ; var O_hs = O_ec . O_n * vec3 ( O_co . O_dm , 1 ) ; O_hs = O_ea ( O_eb , O_hs ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } struct O_nl { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) r : f32 , @ location ( 1 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 2 ) O_dm : vec2 < f32 > , @ location ( 3 ) O_am : vec3 < f32 > , @ location ( 4 ) O_an : vec3 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_p : f32 , @ location ( 6 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 7 ) @ interpolate ( flat ) O_y : f32 , @ location ( 8 ) @ interpolate ( flat ) O_z : f32 , @ location ( 9 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 10 ) @ interpolate ( flat ) O_hd : f32 , } fn O_nm ( O_ct : f32 , O_fw : u32 , O_fx : vec2 < f32 > , O_fz : f32 , O_ga : f32 , O_gb : f32 , O_gl : vec2 < f32 > , O_gm : vec2 < f32 > , O_p : f32 , O_da : vec2 < f32 > , O_q : f32 , ) -> O_nl { var O_co : O_nl ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 || ! O_hc ( O_ac , O_cv . O_ad ) ) { return O_co ; } var O_dm = O_gk ( O_fw , O_fx , O_fz , O_ga , O_gb , O_gl , O_gm ) ; O_dm += O_da ; O_co . O_dm = O_dm ; O_co . O_fx = O_fx ; O_co . r = O_fz ; O_co . O_p = O_ac ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn cutedCircleVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_ga : f32 , @ location ( 4 ) O_gb : f32 , @ location ( 5 ) O_gl : vec2 < f32 > , @ location ( 6 ) O_gm : vec2 < f32 > , @ location ( 7 ) O_o : f32 , @ location ( 8 ) O_p : f32 , @ location ( 9 ) O_q : f32 , ) -> O_nl { var O_co : O_nl ; O_co = O_nm ( O_ct , O_fw , O_fx , O_fz , O_ga , O_gb , O_gl , O_gm , O_p , vec2f ( 0 , 0 ) , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn cutedCircleTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_ga : f32 , @ location ( 4 ) O_gb : f32 , @ location ( 5 ) O_gl : vec2 < f32 > , @ location ( 6 ) O_gm : vec2 < f32 > , @ location ( 7 ) O_o : f32 , @ location ( 8 ) O_p : f32 , @ location ( 9 ) O_q : f32 , @ location ( 10 ) O_r : f32 , ) -> O_nl { var O_co : O_nl ; O_co = O_nm ( O_ct , O_fw , O_fx , O_fz , O_ga , O_gb , O_gl , O_gm , O_p , vec2f ( 0 , 0 ) , O_q ) ; let O_da = O_cz ( O_r ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm + O_da , 0 , 1 ) ; return O_co ; } @ vertex fn cutedCircleTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_nl { var O_co : O_nl ; let O_hp = i32 ( O_cr ) * CUTED_CIRCLE_INSTANCE_PT_LENGTH ; let O_fx = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = O_ci [ O_hp + 3 ] ; let O_ga = O_ci [ O_hp + 4 ] ; let O_gb = O_ci [ O_hp + 5 ] ; let O_gl = vec2f ( O_ci [ O_hp + 6 ] , O_ci [ O_hp + 7 ] ) ; let O_gm = vec2f ( O_ci [ O_hp + 8 ] , O_ci [ O_hp + 9 ] ) ; O_co = O_nm ( O_ct , O_fw , O_fx , O_fz , O_ga , O_gb , O_gl , O_gm , O_p , vec2f ( 0 , 0 ) , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs . xy , 0 , 1 ) ; return O_co ; } @ fragment fn cutedCircleFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ builtin ( front_facing ) O_cq : bool , @ location ( 0 ) @ interpolate ( flat ) O_fz : f32 , @ location ( 1 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 2 ) O_dm : vec2 < f32 > , @ location ( 3 ) O_am : vec3 < f32 > , @ location ( 4 ) O_an : vec3 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_p : f32 , @ location ( 6 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 7 ) @ interpolate ( flat ) O_y : f32 , @ location ( 8 ) @ interpolate ( flat ) O_z : f32 , @ location ( 9 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 10 ) @ interpolate ( flat ) O_hd : f32 , ) -> @ location ( 0 ) vec4 < f32 > { if ( ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) || length ( O_dm - O_fx ) > O_fz ) { discard ; } if ( O_dj ( O_aa , O_ab ) == 0 ) { discard ; } if ( O_y == 1 ) { if ( O_ab == 0 || O_bw . O_bk == 0 || O_p == O_bw . O_bo ) { O_cp ( O_y , O_z , O_hh , O_cq , O_ab ) ; } } if ( ! O_dk ( O_ab ) ) { discard ; } return vec4f ( 0 , 0 , 0 , 0 ) ; } @ vertex fn staticCutedCircleVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_ga : f32 , @ location ( 4 ) O_gb : f32 , @ location ( 5 ) O_gl : vec2 < f32 > , @ location ( 6 ) O_gm : vec2 < f32 > , @ location ( 7 ) O_nb : f32 , ) -> O_nl { var O_co : O_nl ; let O_ec = O_ca [ u32 ( O_nb ) ] ; let O_r = O_ec . O_r ; let O_q = O_ec . O_q ; let O_p = O_ec . O_p ; O_co = O_nm ( O_ct , O_fw , O_fx , O_fz , O_ga , O_gb , O_gl , O_gm , O_p , vec2 ( 0 , 0 ) , O_q ) ; var O_hs = O_ec . O_n * vec3 ( O_co . O_dm , 1 ) ; let O_da = O_cz ( O_r ) ; O_hs += O_da ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn staticCutedCircleTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_nl { var O_co : O_nl ; let O_hp = i32 ( O_cr ) * STATIC_CUTED_CIRCLE_INSTANCE_PT_LENGTH ; let O_nb = O_ci [ O_hp + 12 ] ; let O_ec = O_ca [ u32 ( O_nb ) ] ; let O_fx = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = O_ci [ O_hp + 3 ] ; let O_ga = O_ci [ O_hp + 4 ] ; let O_gb = O_ci [ O_hp + 5 ] ; let O_gl = vec2f ( O_ci [ O_hp + 6 ] , O_ci [ O_hp + 7 ] ) ; let O_gm = vec2f ( O_ci [ O_hp + 8 ] , O_ci [ O_hp + 9 ] ) ; O_co = O_nm ( O_ct , O_fw , O_fx , O_fz , O_ga , O_gb , O_gl , O_gm , O_p , vec2f ( 0 , 0 ) , O_q ) ; var O_hs = O_ec . O_n * vec3 ( O_co . O_dm , 1 ) ; O_hs = O_ea ( O_eb , O_hs ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } struct O_nn { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_hy : f32 , @ location ( 2 ) O_am : vec3 < f32 > , @ location ( 3 ) O_an : vec3 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_p : f32 , @ location ( 5 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 6 ) @ interpolate ( flat ) O_y : f32 , @ location ( 7 ) @ interpolate ( flat ) O_z : f32 , @ location ( 8 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 9 ) @ interpolate ( flat ) O_hd : f32 , } fn O_no ( O_ct : f32 , O_fw : u32 , O_e : vec2 < f32 > , O_hy : f32 , O_q : f32 , O_gq : f32 , O_lo : bool , ) -> O_nn { var O_co : O_nn ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_bw . O_bq . O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } let O_af = max ( O_bw . O_bq . O_af , O_gq ) ; let O_ag = max ( O_bw . O_bq . O_ag , O_gq ) ; let O_ah = max ( O_bw . O_bq . O_ah , O_gq ) ; let O_ai = max ( O_bw . O_bq . O_ai , O_gq ) ; O_co . O_p = O_ac ; let O_aj = O_bw . O_bq . O_aj ; var O_dm : vec2 < f32 > ; if ( O_fw == 0 ) { O_dm = vec2f ( 0 , 0 ) ; } else if ( O_fw == 1 ) { O_dm = vec2f ( O_af , - O_ag / 2 ) ; } else if ( O_fw == 2 ) { O_dm = vec2f ( O_af , O_ag / 2 ) ; } else if ( O_fw == 3 || O_fw == 8 ) { O_dm = vec2f ( O_af , O_ai / 2 ) ; } else if ( O_fw == 4 ) { O_dm = vec2f ( O_af + O_ah , O_ai / 2 ) ; } else if ( O_fw == 5 || O_fw == 6 ) { O_dm = vec2f ( O_af + O_ah , - O_ai / 2 ) ; } else if ( O_fw == 7 ) { O_dm = vec2f ( O_af , - O_ai / 2 ) ; } if ( O_lo ) { let O_kr = O_ag / O_bv . O_i ; if ( O_kr > O_aj ) { O_dm *= O_aj / O_kr ; } let O_iq = O_gq / 2 ; if ( O_fw == 3 || O_fw == 8 || O_fw == 4 ) { O_dm . y = O_iq ; } else if ( O_fw == 5 || O_fw == 6 || O_fw == 7 ) { O_dm . y = - O_iq ; } } let cos = cos ( O_hy ) ; let sin = sin ( O_hy ) ; O_dm = mat2x2 ( cos , sin , - sin , cos ) * O_dm ; O_dm += O_e ; O_co . O_dm = O_dm ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn scaleArrowVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_e : vec2 < f32 > , @ location ( 2 ) O_hy : f32 , @ location ( 3 ) O_o : f32 , @ location ( 4 ) O_q : f32 , ) -> O_nn { var O_co : O_nn ; let O_gq = O_bw . O_i * MIN_PX_LENGTH_RATIO ; O_co = O_no ( O_ct , O_fw , O_e , O_hy , O_q , O_gq , false ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm . xy , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ fragment fn scaleArrowFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_hy : f32 , @ location ( 2 ) O_am : vec3 < f32 > , @ location ( 3 ) O_an : vec3 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_p : f32 , @ location ( 5 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 6 ) @ interpolate ( flat ) O_y : f32 , @ location ( 7 ) @ interpolate ( flat ) O_z : f32 , @ location ( 8 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 9 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = O_ap ; } let O_ii = O_cn ( O_y , O_z , O_ap , 1 , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } @ vertex fn fixedArrowVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_e : vec2 < f32 > , @ location ( 2 ) O_hy : f32 , @ location ( 3 ) O_o : f32 , @ location ( 4 ) O_q : f32 , ) -> O_nn { var O_co : O_nn ; let O_gq = O_bw . O_i * MIN_PX_LENGTH_RATIO ; O_co = O_no ( O_ct , O_fw , O_e , O_hy , O_q , O_gq , true ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm . xy , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } ",Wtt="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_ap : vec4 < f32 > , O_aq : vec4 < f32 > , O_ar : f32 , O_ab : f32 , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_as : O_a ; @ binding ( 1 ) @ group ( 0 ) var < uniform > O_at : O_ao ; @ binding ( 2 ) @ group ( 0 ) var < storage , read > O_au : array < i32 > ; @ vertex fn v_main ( @ builtin ( vertex_index ) O_av : u32 , ) -> @ builtin ( position ) vec4 < f32 > { var O_e = array < vec2 < f32 > , 6 > ( vec2 < f32 > ( 1.0 , 1.0 ) , vec2 < f32 > ( 1.0 , - 1.0 ) , vec2 < f32 > ( - 1.0 , - 1.0 ) , vec2 < f32 > ( 1.0 , 1.0 ) , vec2 < f32 > ( - 1.0 , - 1.0 ) , vec2 < f32 > ( - 1.0 , 1.0 ) ) ; return vec4 < f32 > ( O_e [ O_av ] , 0.5 , 1.0 ) ; } struct O_aw { @ location ( 0 ) O_ap : vec4 < f32 > , @ location ( 1 ) O_aq : vec4 < f32 > , } @ fragment fn v_frag ( @ builtin ( position ) O_e : vec4 < f32 > , ) -> O_aw { var O_ax : O_aw ; let O_k = i32 ( O_as . O_k * O_at . O_ar ) ; let O_l = i32 ( O_as . O_l * O_at . O_ar ) ; var O_ay = i32 ( ( O_l - 1 - i32 ( O_e . y ) ) * O_k + i32 ( O_e . x ) ) ; if ( O_at . O_ab == 1 ) { if ( O_au [ O_l * O_k * 2 + O_ay ] != 0 ) { O_ax . O_ap = O_at . O_ap ; } return O_ax ; } if ( O_au [ O_ay ] != 0 ) { O_ax . O_ap = O_at . O_ap ; } if ( O_au [ O_l * O_k + O_ay ] != 0 ) { O_ax . O_aq = O_at . O_aq ; } return O_ax ; } ",ztt="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_n : mat4x4 < f32 > , O_ap : vec4 < f32 > , O_aq : vec4 < f32 > , O_ar : vec3 < f32 > , O_as : vec3 < f32 > , O_at : vec3 < f32 > , O_au : f32 , O_av : f32 , O_i : f32 , O_ad : u32 , O_aw : u32 , O_ax : f32 , O_ay : u32 , O_az : u32 , O_ba : f32 , O_bb : vec4 < f32 > , O_bc : vec4 < f32 > , O_bd : f32 , O_be : f32 , O_bf : f32 , O_bg : f32 , O_bh : f32 , O_bi : u32 , O_bj : f32 , O_bk : f32 , O_bl : vec4 < f32 > , O_bm : f32 , O_bn : f32 , O_bo : f32 , O_bp : f32 , O_bq : O_ae , @ align ( 16 ) O_br : vec3 < f32 > , O_bs : vec3 < f32 > , O_bt : vec3 < f32 > , O_bu : vec2 < f32 > , } struct O_bv { O_p : u32 , } struct O_bw { @ location ( 0 ) O_ap : vec4 < f32 > , @ location ( 1 ) O_bx : f32 , } override RENDER_HIGHLIGHT_TYPE_SHIFT : f32 ; @ binding ( 0 ) @ group ( 0 ) var < uniform > O_by : O_ao ; @ binding ( 1 ) @ group ( 0 ) var < uniform > O_bz : O_bv ; @ binding ( 2 ) @ group ( 0 ) var < storage , read > O_ca : array < vec4 < f32 > > ; @ binding ( 3 ) @ group ( 0 ) var < uniform > O_cb : O_a ; fn O_cc ( O_cd : f32 , ) -> u32 { return u32 ( O_cd ) >> u32 ( RENDER_HIGHLIGHT_TYPE_SHIFT ) ; } fn O_ce ( O_cf : vec4 < f32 > , ) -> O_al { var O_cg : O_al ; if ( O_by . O_ad == 2 ) { let O_n = O_cb . O_c * O_by . O_n ; O_cg . O_am = mat3x3 ( vec3 ( O_n [ 0 ] . xyz ) , vec3 ( O_n [ 1 ] . xyz ) , vec3 ( O_n [ 2 ] . xyz ) ) * vec3 < f32 > ( 0 , 0 , 1 ) ; let O_e = O_n * vec4 ( O_cf . xy , 0 , 1 ) ; O_cg . O_an = - O_e . xyz / O_e . w ; } return O_cg ; } fn O_ch ( O_ci : f32 , O_aa : f32 , O_ab : f32 , ) -> vec4 < f32 > { let O_p = O_cc ( O_ci ) ; var O_ap : vec4 < f32 > ; var O_cj = O_by . O_ap ; if ( O_by . O_bi == 0 && O_by . O_bm == 1 && O_ab == 1 ) { O_cj = O_by . O_bl ; } if ( O_p == 0 || ( O_by . O_bi == 0 && O_by . O_bm == 0 ) || ( O_by . O_bi == 0 && O_by . O_bm == 1 && O_ab == 0 ) ) { O_ap = O_cj ; } else { O_ap = O_ca [ O_p ] ; if ( O_ap . r + O_ap . g + O_ap . b == 0 ) { O_ap . r = O_cj . r ; O_ap . g = O_cj . g ; O_ap . b = O_cj . b ; } O_ap . a *= O_cj . a ; } var O_ck = O_by . O_ax ; if ( O_aa == 1 || O_by . O_ba == 1 || O_ab == 1 ) { O_ck = 1 ; } O_ap . r *= O_ck ; O_ap . g *= O_ck ; O_ap . b *= O_ck ; return O_ap ; } fn O_cl ( O_ci : f32 , O_am : vec3 < f32 > , O_an : vec3 < f32 > , O_aa : f32 , O_ab : f32 , ) -> vec4 < f32 > { if ( O_by . O_ad == 0 || O_by . O_ad == 1 ) { return O_ch ( O_ci , O_aa , O_ab ) ; } let O_p = O_cc ( O_ci ) ; var O_ar : vec3 < f32 > ; var O_as : vec3 < f32 > ; var O_at : vec3 < f32 > ; if ( O_p == 0 ) { O_ar = O_by . O_ar ; O_as = O_by . O_as ; O_at = O_by . O_at ; } else { let O_cj = O_ca [ O_p ] . rgb ; O_ar = O_cj ; O_as = O_ar ; O_at = O_ar ; } var O_cm = O_ar * O_by . O_br ; var O_cn = normalize ( O_am ) ; var O_bt = O_by . O_bt ; var O_co = abs ( dot ( O_cn , O_bt ) ) * O_as * O_by . O_bs ; var O_cp = - 2.0 * O_cn * dot ( O_bt , O_cn ) + O_bt ; var O_cq = normalize ( O_an ) ; var O_cr = abs ( dot ( O_cp , O_cq ) ) ; var O_cs = O_at * O_by . O_bs * pow ( O_cr , 300.0 ) * O_by . O_au * 0.1 ; var O_ap = vec4 ( O_cm + O_co + O_cs , O_by . O_av ) ; return O_ap ; } struct O_ct { @ builtin ( position ) O_cu : vec4 < f32 > , @ location ( 0 ) O_am : vec3 < f32 > , @ location ( 1 ) O_an : vec3 < f32 > , } @ vertex fn v_main ( @ builtin ( vertex_index ) O_cv : u32 , @ location ( 0 ) O_cw : vec2 < f32 > , @ location ( 1 ) O_k : f32 , @ location ( 2 ) O_l : f32 , ) -> O_ct { var O_cg : O_ct ; var O_cf : vec2f ; if ( O_cv == 0 || O_cv == 5 ) { O_cf = O_cw ; } else if ( O_cv == 1 ) { O_cf = O_cw + vec2f ( 0 , - O_l ) ; } else if ( O_cv == 2 || O_cv == 3 ) { O_cf = O_cw + vec2f ( O_k , - O_l ) ; } else if ( O_cv == 4 ) { O_cf = O_cw + vec2f ( O_k , 0 ) ; } O_cg . O_cu = O_cb . O_b * O_by . O_n * vec4 ( O_cf . xy , 0 , 1.0 ) ; let O_cx = O_ce ( vec4f ( O_cf , 0 , 1 ) ) ; O_cg . O_am = O_cx . O_am ; O_cg . O_an = O_cx . O_an ; return O_cg ; } @ fragment fn v_frag ( @ builtin ( position ) O_cu : vec4 < f32 > , @ location ( 0 ) O_am : vec3 < f32 > , @ location ( 1 ) O_an : vec3 < f32 > , ) -> O_bw { var O_cg : O_bw ; O_cg . O_ap = O_cl ( f32 ( O_bz . O_p ) , O_am , O_an , O_by . O_ba , O_by . O_bp ) ; return O_cg ; } ",Ytt="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_n : mat4x4 < f32 > , O_ap : mat4x4 < f32 > , O_i : f32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_aq : O_ao ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_ar : O_a ; @ group ( 0 ) @ binding ( 2 ) var O_as : sampler ; @ group ( 0 ) @ binding ( 3 ) var O_at : texture_2d < f32 > ; @ group ( 0 ) @ binding ( 4 ) var < storage , read > O_au : array < f32 > ; @ group ( 0 ) @ binding ( 5 ) var < storage , read > O_av : array < f32 > ; @ group ( 0 ) @ binding ( 6 ) var < storage , read > O_aw : array < O_u > ; override TEMPLATE_BBOX_DATA_LENGTH : u32 ; override MIN_PX_LENGTH_RATIO : f32 ; override TEMPLATE_OFFSET_DATA_LENGTH : u32 ; struct O_ax { @ builtin ( position ) O_ay : vec4 < f32 > , @ location ( 0 ) O_az : vec2 < f32 > , } struct O_ba { @ location ( 0 ) O_bb : vec4 < f32 > , @ location ( 1 ) O_bc : vec4 < f32 > , @ location ( 2 ) O_bd : vec4 < f32 > , @ location ( 3 ) O_be : f32 , } @ vertex fn v_main ( @ builtin ( vertex_index ) O_bf : u32 , @ location ( 0 ) id : f32 , ) -> O_ax { var O_bg : O_ax ; if ( id == - 1 ) { return O_bg ; } let O_bh = O_aw [ i32 ( id ) ] ; var O_r = O_bh . O_r ; if ( O_r == - 1 ) { return O_bg ; } var O_bi = u32 ( O_r ) * TEMPLATE_BBOX_DATA_LENGTH ; if ( O_au [ O_bi + 2 ] == 0 || O_au [ O_bi + 3 ] == 0 ) { return O_bg ; } let O_n = O_bh . O_n ; let O_bj = vec2f ( O_au [ O_bi ] , O_au [ O_bi + 1 ] ) ; let O_bk = O_aq . O_i * MIN_PX_LENGTH_RATIO ; let O_k = max ( O_au [ O_bi + 2 ] , O_bk ) ; let O_l = max ( O_au [ O_bi + 3 ] , O_bk ) ; let O_bl = O_l / 2 ; var O_bm : vec2f ; let O_bn = O_bj + vec2 ( 0 , - O_bl ) ; let O_bo = O_bj + vec2 ( O_k , - O_bl ) ; let O_bp = normalize ( O_bo - O_bn ) ; let O_bq = vec2 ( - O_bp . y , O_bp . x ) ; let O_br = O_bq * O_bl ; let O_bs = O_bq * O_aq . O_i * 0 ; var O_bt = O_bp * O_aq . O_i * 0 ; if ( O_bf == 0 || O_bf == 5 ) { O_bm = O_bn - O_br - O_bs - O_bt ; } else if ( O_bf == 1 ) { O_bm = O_bo - O_br - O_bs + O_bt ; } else if ( O_bf == 2 || O_bf == 3 ) { O_bm = O_bo + O_br + O_bs + O_bt ; } else if ( O_bf == 4 ) { O_bm = O_bn + O_br + O_bs - O_bt ; } let O_bu = O_n * vec3 ( O_bm , 1.0 ) ; O_bg . O_ay = O_ar . O_b * O_aq . O_n * vec4 ( O_bu . xy , 0 , 1.0 ) ; let O_bv = u32 ( O_r ) * TEMPLATE_OFFSET_DATA_LENGTH ; let O_bw = vec2f ( O_av [ O_bv ] , O_av [ O_bv + 1 ] ) ; let O_bx = O_bm + O_bw ; let O_by = O_aq . O_ap * vec4 ( O_bx , 0 , 1 ) ; let O_bz = O_by . xy ; var O_az : vec2f ; O_az = ( O_bz + 1.0 ) * 0.5 ; O_az . y = 1 - O_az . y ; O_bg . O_az = O_az ; return O_bg ; } @ fragment fn v_frag ( @ builtin ( position ) O_bm : vec4 < f32 > , @ location ( 0 ) O_az : vec2 < f32 > , ) -> O_ba { var O_bg : O_ba ; var O_bb = textureSample ( O_at , O_as , O_az ) ; if ( O_az . x < 0 || O_az . x > 1 || O_az . y < 0 || O_az . y > 1 ) { O_bb = vec4 ( 0 , 0 , 1 , 1 ) ; } O_bg . O_bb = O_bb ; return O_bg ; } ",$m=class awe extends NO{constructor(t,e,r,i){super(e),this.gpu=t,this.usage=r,this.label=i,this.updateStart=Number.POSITIVE_INFINITY,this.updateEnd=Number.NEGATIVE_INFINITY}static create(t,e,r,i){return new awe(e,t,r,i)}isChange(){return Number.isFinite(this.updateStart)}markUpdated(){this.updateStart=Number.POSITIVE_INFINITY,this.updateEnd=Number.NEGATIVE_INFINITY}setLength(t){let e=this.length;super.setLength(t),e>t&&this.updateBuf()}updateBuf(){if(this.buf||(this.buf=this.gpu.createSharedBuffer(Math.max(this.length,1),this.usage,this.label)),!this.isChange())return this.buf;let t=Math.max(this.length,1);if(this.buf.setSize(t),this.updateStart<this.length){let e=Math.min(this.updateEnd,this.length),r=this.updateStart;for(;r<e;){let i=Math.floor(r/1024),n=r%1024;this.buf.write(r,this.chunks[i],n,Math.min(e-r,1024-n)),r=(i+1)*1024}}return this.markUpdated(),this.buf}markChange(t,e){this.updateStart=Math.min(t,this.updateStart),this.updateEnd=Math.max(e,this.updateEnd)}clear(){super.clear(),this.buf&&this.buf.setSize(1,!1),this.markUpdated()}destroy(){var t;(t=this.buf)==null||t.free()}},lk="Consolas, SimHei",Rv=class{constructor(){if(this._charString="",this.changed=!1,this.canvas=document.createElement("canvas"),this.canvas.width=4e3,this.canvas.height=4e3,this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.context===null)throw new Error("canvas2d not supported");this.currX=0,this.currY=200,this.drawFlag();let o=200;try{this.context.font=o+"px "+lk}catch(t){console.log(t)}this.context.fillStyle="red",this.context.textBaseline="bottom",this.context.strokeStyle="black",this.preLoadASCII(),this.canvas.style.display="none",this.canvas.style.width=4e3/2+"px",this.canvas.style.height=4e3/2+"px"}getCharIndex(o){return this._charString.indexOf(o)}addChar(o){if(o.length!=1)throw new Error("char.length not equals 1");let t=this.getCharIndex(o);if(t>=0)return t;let e=108+200/8,r=200+200/4,i=this.currX+e;return i>=4e3&&(this.currY+=r,this.currX=0,i=this.currX+e),this.context.fillText(o,this.currX,this.currY,108),this._charString+=o,this.changed=!0,this.currX=i,this._charString.length-1}static getStrWidth(o){return 108*o.length}static getStrHeight(o){return 200}preLoadASCII(){let o="`1234567890-=~!@#$%^&*()_+qwertyuiop[]asdfghjklzxcvbnm,.QWERTYUIOPASDFGHJKLZXCVBNM{}";for(let t of o)try{this.addChar(t)}catch(e){console.log(e)}}drawFlag(){let o=48.5;this.context.lineWidth=8,this.context.strokeStyle="red",this.context.beginPath(),this.context.moveTo(2,o),this.context.lineTo(o*2+2,o*3),this.context.moveTo(o*2+2,o),this.context.lineTo(2,o*3),this.context.stroke(),this.context.lineWidth=1}createString(o,t){for(let e=0;e<o.length;e++){let r=this.addChar(o[e]);t(r)}}static getStrInfo(o,t,e){let r=this.getStrWidth(o),i=this.getStrHeight(o),n=0,s=0,a=0;return o.length!==0&&(n=t/r,s=e/i,a=Math.min(n,s)),{strWidth:r*a,strHeight:i*a}}},Rxe=512,Av=64,xL=Av*2,jtt=10,R7=1,Dxe=1e8,lwe=["L","P","V","S","H","K","O","C","W","N","D","I"],Xtt=lwe.length*Av*xL,qtt=class{constructor(o){this.scene=o,this.stringInfoMap=new Map,this.fontStyle={"font-family":lk},this.gpu=this.scene.gpu,this.maxComputeWorkgroupSizeX=o.gpu.limits.maxComputeWorkgroupSizeX,this.imagesTexture=this.gpu.createDynamicTexture(1,1,za,GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,"texture of sdfStringLibrary"),this.stringInfoBuilder=$m.create(Float32Array,this.gpu,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"stringInfoBuf of sdfStringLibrary"),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.initPipeline(),this.initBuffer(),this.initBindGroup()}init(){lwe.forEach(o=>{this.create(o)})}getIndex(o){if(!o)return-1;let t=this.stringInfoMap.get(o);if(t==null)throw new Error("The value is not in the font library");return t}initPipeline(){let o=this.gpu.device,t=this.gpu.createShaderModule(Ftt),e=o.createComputePipeline({layout:"auto",compute:{module:t,entryPoint:"calculateGridRowData",constants:{INF:Dxe,MAX_COMPUTE_WORKGROUP_SIZE_X:this.maxComputeWorkgroupSizeX}}}),r=this.gpu.createShaderModule(Vtt),i=o.createComputePipeline({layout:"auto",compute:{module:r,entryPoint:"computeSdfData",constants:{MAX_COMPUTE_WORKGROUP_SIZE_X:this.maxComputeWorkgroupSizeX}}}),n=this.gpu.createShaderModule(Btt),s=o.createComputePipeline({layout:"auto",compute:{module:n,entryPoint:"reduceSdf",constants:{MAX_COMPUTE_WORKGROUP_SIZE_X:this.maxComputeWorkgroupSizeX}}}),a=this.gpu.createShaderModule(Gtt),l=o.createComputePipeline({layout:"auto",compute:{module:a,entryPoint:"createGridData",constants:{INF:Dxe,MAX_COMPUTE_WORKGROUP_SIZE_X:this.maxComputeWorkgroupSizeX}}});this.computePipelines={calculateGridRowData:e,calculateSdfData:i,reduceSdfData:s,createGridData:l}}initBuffer(){let o=this.gpu;this.uniformsBuf=o.createDynamicBuffer(jtt,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,"uniformsBuf"),this.grid1Buf=o.createDynamicBuffer(R7,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"grid1Buffer"),this.grid2Buf=o.createDynamicBuffer(R7,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"grid2Buffer"),this.originalGrid1Buf=o.createDynamicBuffer(R7,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"originalGrid1Buf"),this.originalGrid2Buf=o.createDynamicBuffer(R7,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"originalGrid2Buf"),this.currentSdfBuf=o.createDynamicBuffer(R7,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"sdfBuf"),this.sdfBuf=o.createDynamicBuffer(Xtt,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"sdfBuf")}initBindGroup(){this.generateGridByImageDataBindGroup=this.gpu.createDynamicBindGroup(this.computePipelines.createGridData.getBindGroupLayout(0),0,this.uniformsBuf,1,this.grid1Buf,2,this.grid2Buf,3,this.imagesTexture),this.calculateGridRowDataBindGroup=this.gpu.createDynamicBindGroup(this.computePipelines.calculateGridRowData.getBindGroupLayout(0),0,this.uniformsBuf,1,this.grid1Buf,2,this.grid2Buf,3,this.originalGrid1Buf,4,this.originalGrid2Buf),this.generateSdfBindGroup=this.gpu.createDynamicBindGroup(this.computePipelines.calculateSdfData.getBindGroupLayout(0),0,this.uniformsBuf,1,this.grid1Buf,2,this.grid2Buf,3,this.currentSdfBuf)}create(o){let t=this.stringInfoMap.get(o);t||(t=this.stringInfoBuilder.getLength(),this.stringInfoMap.set(o,t),this.stringInfoBuilder.push(t),this.generateGridBufferFormImageData(o,t))}generateGridBufferFormImageData(o,t){let[e,r]=this.drawText(o,this.fontStyle);this.createGridData(e,r),this.calculateSdfBuf(e,r);let i=this.reduceSdfGPU(e,r);this.gpu.copyBufferToBuffer(i,0,this.sdfBuf,t*Av*xL,i.getSize())}updateGridBufSize(o,t){let e=o*t;e>R7&&(this.grid1Buf.extSize(e*4),this.grid2Buf.extSize(e*4),this.currentSdfBuf.extSize(e*4),this.originalGrid1Buf.extSize(e*4),this.originalGrid2Buf.extSize(e*4))}createGridData(o,t){let e=this.gpu.device;this.updateGridBufSize(o,t);let r=e.createCommandEncoder({label:"encoder1"});this.uniformsBuf.write(0,new Uint32Array([0,o,t]));let i=o*t;this.gpu.runComputePass(r,this.computePipelines.createGridData,this.generateGridByImageDataBindGroup.getBindGroup(),i,s=>this.gpu.copyBufferToBuffer(this.gpu.groupOffsetXsBuf,s,this.uniformsBuf,0,1,r));let n=r.finish();e.queue.submit([n])}drawText(o,t){this.context.font=wL(t,Rxe);let e=this.context.measureText(o),r=Math.ceil(Math.max(e.width,e.actualBoundingBoxRight)/4)*4,i=e.fontBoundingBoxAscent,n=e.fontBoundingBoxDescent,s=i+n,a=0,l=i;return this.canvas.width=r,this.canvas.height=s,this.context.font=wL(t,Rxe),this.context.fillText(o,a,l),this.imagesTexture.updateSize(r,s),this.scene.gpu.device.queue.copyExternalImageToTexture({source:this.canvas},{texture:this.imagesTexture.texture},[r,s]),[r,s]}calculateSdfBuf(o,t){let e=this.gpu.device;{let r=e.createCommandEncoder({label:"encoder1"});this.gpu.copyBufferToBuffer(this.grid1Buf,0,this.originalGrid1Buf,0,o*t,r),this.gpu.copyBufferToBuffer(this.grid2Buf,0,this.originalGrid2Buf,0,o*t,r),this.uniformsBuf.write(0,new Int32Array([0,o,t,1]));let i=t*o;this.gpu.runComputePass(r,this.computePipelines.calculateGridRowData,this.calculateGridRowDataBindGroup.getBindGroup(),i,s=>this.gpu.copyBufferToBuffer(this.gpu.groupOffsetXsBuf,s,this.uniformsBuf,0,1,r));let n=r.finish();e.queue.submit([n])}{let r=e.createCommandEncoder({label:"encoder"});this.gpu.copyBufferToBuffer(this.grid1Buf,0,this.originalGrid1Buf,0,o*t,r),this.gpu.copyBufferToBuffer(this.grid2Buf,0,this.originalGrid2Buf,0,o*t,r),this.uniformsBuf.write(0,new Int32Array([0,o,t,0]));let i=o*t;this.gpu.runComputePass(r,this.computePipelines.calculateGridRowData,this.calculateGridRowDataBindGroup.getBindGroup(),i,s=>this.gpu.copyBufferToBuffer(this.gpu.groupOffsetXsBuf,s,this.uniformsBuf,0,1,r));let n=r.finish();e.queue.submit([n])}{this.uniformsBuf.write(0,new Int32Array([0,o,t]));let r=e.createCommandEncoder(),i=t*o;this.gpu.runComputePass(r,this.computePipelines.calculateSdfData,this.generateSdfBindGroup.getBindGroup(),i,s=>this.gpu.copyBufferToBuffer(this.gpu.groupOffsetXsBuf,s,this.uniformsBuf,0,1,r));let n=r.finish();e.queue.submit([n])}}reduceSdfGPU(o,t){let e=this.gpu.device,r=this.gpu.createDynamicBuffer(Av*xL,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"reduce sdf");this.uniformsBuf.write(0,new Int32Array([0,o,t,Av,xL]));let i=this.gpu.createDynamicBindGroup(this.computePipelines.reduceSdfData.getBindGroupLayout(0),0,this.uniformsBuf,1,this.currentSdfBuf,2,r),n=e.createCommandEncoder({label:"reduceSdf"}),s=Av*xL;this.gpu.runComputePass(n,this.computePipelines.reduceSdfData,i.getBindGroup(),s,l=>this.gpu.copyBufferToBuffer(this.gpu.groupOffsetXsBuf,l,this.uniformsBuf,0,1,n));let a=n.finish();return e.queue.submit([a]),r}getSdfBuffer(){return this.sdfBuf}},jbe=1,aye=92,wxe=12,Lxe=4,Mxe=36,cwe=2,$tt=[0,1,2,15,3,4,66,67,68],Ktt=[11,12,13,14],Ztt=[6,7,8,9];var Hs={0:"circle",1:"arc",2:"rect",15:"line",16:"ellipse",3:"lineSegment",4:"semicircle",5:"point",10:"string",66:"scaleString",6:"triangle",7:"cutedCircle",8:"staticTriangle",9:"staticCutedCircle",11:"lineWireFrame",12:"arcWireFrame",14:"staticArcWireFrame",13:"staticLineWireFrame",18:"sdfString",19:"drc",21:"circleTemplateInstance",26:"triangleTemplateInstance",30:"stringTemplateInstance",27:"cutedCircleTemplateInstance",31:"lineWireFrameTemplateInstance",32:"arcWireFrameTemplateInstance",28:"staticTriangleTemplateInstance",29:"staticCutedCircleTemplateInstance",33:"staticLineWireFrameTemplateInstance",34:"staticArcWireFrameTemplateInstance",22:"arcTemplateInstance",23:"rectTemplateInstance",24:"lineSegmentTemplateInstance",25:"semicircleTemplateInstance",35:"lineTemplateInstance",51:"circleTemplate",56:"triangleTemplate",60:"stringTemplate",57:"cutedCircleTemplate",61:"lineWireFrameTemplate",62:"arcWireFrameTemplate",58:"staticTriangle",59:"staticCutedCircle",63:"staticLineWireFrame",64:"staticArcWireFrame",52:"arcTemplate",53:"rectTemplate",54:"lineSegmentTemplate",55:"semicircleTemplate",65:"lineTemplate",67:"scaleArrow",68:"fixedArrow"},Xbe=2,UZ=.5,PL=Math.sqrt(.5),hwe=1-(Math.acos(UZ/PL)*PL*PL-UZ*Math.sqrt(PL*PL-UZ*UZ))/Math.PI/(PL*PL),OO={VISIBLE_MASK:Is,MATH_PI:Math.PI,CHAR_WIDTH:108,CHAR_HEIGHT:200,CANVAS_WIDTH:4e3,CANVAS_HEIGHT:4e3,PTGROUP_VISIBLE_SHIFT:rQ,PTGROUP_DOUBLERGB_SHIFT:oQ,PTGROUP_HIGH_LIGHT_SHIFT:iQ,PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT:nQ,PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT:tQ,ANTIALIAS_RATIO:hwe,MIN_PX_LENGTH_RATIO:Xbe,SDF_HEIGHT:xL,SDF_WIDTH:Av,RENDER_HIGHLIGHT_TYPE_SHIFT:jbe,TEMPLATE_OFFSET_DATA_LENGTH:cwe,CIRCLE_INSTANCE_PT_LENGTH:8,TRIANGLE_INSTANCE_PT_LENGTH:11,STRING_INSTANCE_PT_LENGTH:15,STRING_LEVEL_BITLENGTH:pS,CUTED_CIRCLE_INSTANCE_PT_LENGTH:14,LINE_WIRE_INSTANCE_FRAME_PT_LENGTH:9,ARC_WIRE_FRAME_INSTANCE_PT_LENGTH:10,STATIC_TRIANGLE_INSTANCE_PT_LENGTH:9,STATIC_CUTED_CIRCLE_INSTANCE_PT_LENGTH:12,STATIC_LINE_WIRE_FRAME_INSTANCE_PT_LENGTH:6,STATIC_ARC_WIRE_FRAME_INSTANCE_PT_LENGTH:7,ARC_INSTANCE_PT_LENGTH:11,RECT_INSTANCE_PT_LENGTH:11,LINE_INSTANCE_PT_LENGTH:11,LINESEGMENT_INSTANCE_PT_LENGTH:11,SEMICIRCLE_INSTANCE_PT_LENGTH:9,GROUP_DATA_LENGTH:TI};function GJ(o){let t={};return t.RENDER_HIGHLIGHT_TYPE_SHIFT=OO.RENDER_HIGHLIGHT_TYPE_SHIFT,t.GROUP_DATA_LENGTH=OO.GROUP_DATA_LENGTH,o.indexOf("Vert")&&(t.VISIBLE_MASK=OO.VISIBLE_MASK,t.PTGROUP_VISIBLE_SHIFT=OO.PTGROUP_VISIBLE_SHIFT,t.PTGROUP_DOUBLERGB_SHIFT=OO.PTGROUP_DOUBLERGB_SHIFT,t.PTGROUP_HIGH_LIGHT_SHIFT=OO.PTGROUP_HIGH_LIGHT_SHIFT,t.PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT=OO.PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT,t.PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT=OO.PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT),Nxe[o]&&Nxe[o].forEach(e=>{t[e]=OO[e]}),t}function UJ(o){switch(o){case 11:case 61:case 31:case 46:case 13:case 63:case 33:case 48:case 3:case 54:case 24:case 39:case 2:case 53:case 23:case 38:case 15:case 65:case 35:case 50:case 10:case 60:case 30:case 45:case 66:case 18:case 19:return 6;case 67:case 68:return 9;default:return 3}}var Nxe={circleVert:["MIN_PX_LENGTH_RATIO"],circleTemplateVert:["MIN_PX_LENGTH_RATIO","TEMPLATE_OFFSET_DATA_LENGTH"],circleFrag:["MATH_PI"],arcVert:["MIN_PX_LENGTH_RATIO"],arcTemplateVert:["MIN_PX_LENGTH_RATIO","TEMPLATE_OFFSET_DATA_LENGTH"],arcFrag:["MATH_PI"],triangleTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],triangleFrag:[],rectVert:["MIN_PX_LENGTH_RATIO"],rectTemplateVert:["MIN_PX_LENGTH_RATIO","TEMPLATE_OFFSET_DATA_LENGTH"],rectFrag:["MATH_PI","ANTIALIAS_RATIO"],lineVert:["MIN_PX_LENGTH_RATIO"],lineTemplateVert:["MIN_PX_LENGTH_RATIO","TEMPLATE_OFFSET_DATA_LENGTH"],lineFrag:["MATH_PI","ANTIALIAS_RATIO"],cutedCircleTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],lineSegmentTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],lineSegmentFrag:["MATH_PI","ANTIALIAS_RATIO"],semicircleTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],stringTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],stringFrag:["CHAR_WIDTH","CHAR_HEIGHT","CANVAS_WIDTH","CANVAS_HEIGHT"],drcVert:["MATH_PI","SDF_HEIGHT","SDF_WIDTH"],drcFrag:["SDF_HEIGHT","SDF_WIDTH","ANTIALIAS_RATIO","MATH_PI"],staticTriangleVert:["TEMPLATE_OFFSET_DATA_LENGTH"],staticCutedCircleVert:["TEMPLATE_OFFSET_DATA_LENGTH"],arcWireFrameTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],arcWireFrameFrag:["MATH_PI"],lineWireFrameTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],staticArcWireFrameVert:["TEMPLATE_OFFSET_DATA_LENGTH"],staticLineWireFrameVert:["TEMPLATE_OFFSET_DATA_LENGTH"],circleTemplateInstanceVert:["MIN_PX_LENGTH_RATIO","CIRCLE_INSTANCE_PT_LENGTH"],triangleTemplateInstanceVert:["TRIANGLE_INSTANCE_PT_LENGTH"],stringTemplateInstanceVert:["PTGROUP_HIGH_LIGHT_SHIFT"],cutedCircleTemplateInstanceVert:["CUTED_CIRCLE_INSTANCE_PT_LENGTH"],lineWireFrameTemplateInstanceVert:["LINE_WIRE_INSTANCE_FRAME_PT_LENGTH"],arcWireFrameTemplateInstanceVert:["ARC_WIRE_FRAME_INSTANCE_PT_LENGTH"],staticTriangleTemplateInstanceVert:["STATIC_TRIANGLE_INSTANCE_PT_LENGTH"],staticCutedCircleTemplateInstanceVert:["STATIC_CUTED_CIRCLE_INSTANCE_PT_LENGTH"],staticArcWireFrameTemplateInstanceVert:["STATIC_ARC_WIRE_FRAME_INSTANCE_PT_LENGTH"],staticLineWireFrameTemplateInstanceVert:["STATIC_LINE_WIRE_FRAME_INSTANCE_PT_LENGTH"],arcTemplateInstanceVert:["MIN_PX_LENGTH_RATIO","ARC_INSTANCE_PT_LENGTH"],rectTemplateInstanceVert:["MIN_PX_LENGTH_RATIO","RECT_INSTANCE_PT_LENGTH"],lineTemplateInstanceVert:["MIN_PX_LENGTH_RATIO","LINE_INSTANCE_PT_LENGTH"],lineSegmentTemplateInstanceVert:["LINESEGMENT_INSTANCE_PT_LENGTH"],semicircleTemplateInstanceVert:["SEMICIRCLE_INSTANCE_PT_LENGTH"],scaleArrowVert:["MIN_PX_LENGTH_RATIO"],fixedArrowVert:["MIN_PX_LENGTH_RATIO"]},Jtt=[16,17,20,18],kxe=[5,18];function Qtt(o){return o.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:1,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:4,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:5,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:6,visibility:GPUShaderStage.FRAGMENT,texture:{}},{binding:7,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:8,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:9,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:10,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"storage"}},{binding:11,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:12,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:13,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:14,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:15,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}}]})}function ert(o){return o.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:1,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{}},{binding:4,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:5,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:6,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}}]})}function uwe(o,t){let e=t[2],r=t[6];return e/r>o}function Fc(...o){let t=[],e=0;return o.forEach((r,i)=>{t.push({shaderLocation:i,offset:e,format:r===1?"float32":`float32x${r}`}),e+=r*fs}),[{arrayStride:e,attributes:t,stepMode:"instance"}]}function trt(){return Fc(1,1,1,1,1)}function dwe(o){switch(o){case 0:return Fc(1,2,1,1,1,1);case 51:return Fc(1,2,1,1,1,1,1);case 1:return Fc(1,2,1,1,1,1,1,1,1);case 52:return Fc(1,2,1,1,1,1,1,1,1,1);case 2:return Fc(1,2,1,1,1,1,1,1,1);case 53:return Fc(1,2,1,1,1,1,1,1,1,1);case 15:return Fc(1,2,2,1,1,1,1,1);case 65:return Fc(1,2,2,1,1,1,1,1,1);case 16:return Fc(1,2,1,1,1,1,1,1,1,1,1);case 3:return Fc(1,2,2,1,1,1,1,1);case 54:return Fc(1,2,2,1,1,1,1,1,1);case 4:return Fc(1,2,1,1,1,1,1);case 55:return Fc(1,2,1,1,1,1,1,1);case 5:return Fc(1,2,1,1,1,1,1);case 10:return Fc(1,2,1,1,1,1,1,1,1,1,1,1,1,1);case 66:return Fc(1,2,1,1,1,1,1,1,1,1,1,1);case 60:return Fc(1,2,1,1,1,1,1,1,1,1,1,1,1,1,1);case 11:return Fc(1,2,2,1,1,1);case 61:return Fc(1,2,2,1,1,1,1);case 12:return Fc(1,2,1,1,1,1,1,1);case 62:return Fc(1,2,1,1,1,1,1,1,1);case 14:case 64:return Fc(1,2,1,1,1,1);case 13:case 63:return Fc(1,2,2,1);case 18:return Fc(1,1,2,1,1,1,1,1,1);case 19:return Fc(1,2,1,1,1,1,1,1,1,1,1,1);case 6:return Fc(1,2,2,2,1,1,1);case 56:return Fc(1,2,2,2,1,1,1,1);case 8:case 58:return Fc(1,2,2,2,1,1);case 7:return Fc(1,2,1,1,1,2,2,1,1,1);case 57:return Fc(1,2,1,1,1,2,2,1,1,1,1);case 9:case 59:return Fc(1,2,1,1,1,2,2,1,1);case 21:case 26:case 30:case 27:case 31:case 32:case 28:case 29:case 34:case 33:case 22:case 23:case 24:case 25:case 35:case 36:return trt();case 67:case 68:return Fc(1,2,1,1,1);default:throw new Error("type error")}}function HJ(o,t){if(Ur.isTemplateInstancePtType(t)||Ur.isTemplateOriginPtType(t))switch(o){case Hs[21]:case Hs[51]:return Hs[0];case Hs[56]:case Hs[26]:case Hs[58]:case Hs[28]:return Hs[6];case Hs[60]:case Hs[30]:return Hs[10];case Hs[57]:case Hs[27]:case Hs[59]:case Hs[29]:return Hs[7];case Hs[61]:case Hs[31]:case Hs[63]:case Hs[33]:return Hs[11];case Hs[62]:case Hs[32]:case Hs[64]:case Hs[34]:return Hs[12];case Hs[52]:case Hs[22]:return Hs[1];case Hs[53]:case Hs[23]:return Hs[2];case Hs[54]:case Hs[24]:return Hs[3];case Hs[55]:case Hs[25]:return Hs[4];case Hs[65]:case Hs[35]:return Hs[15]}else{if(t===13)return Hs[11];if(t===14)return Hs[12];if(t===8)return Hs[6];if(t===9)return Hs[7];if(t===66)return Hs[10];if(t===68)return Hs[67]}return o}function rrt(o,t,e,r,i,n){let s=Hs[o],a=`${s}Vert`,l=`${HJ(s,o)}Frag`;return t.createRenderPipeline({layout:r,vertex:{module:e,entryPoint:a,constants:n(a),buffers:dwe(o)},fragment:{module:e,entryPoint:l,constants:n(l),targets:[{format:za,writeMask:0}]},primitive:{topology:"triangle-list"},depthStencil:{format:v2,depthCompare:"always",depthWriteEnabled:!1,stencilReadMask:i,stencilFront:{compare:"not-equal",passOp:"increment-wrap"},stencilBack:{compare:"not-equal",passOp:"decrement-wrap"}},label:`renderPt ${o} pipeline`})}function irt(o,t,e,r,i,n,s,a,l){Ur.isCustomTemplateInstanceType(o)&&(o=Ur.getTemplateTypeByCustomInstanceType(o));let c=Hs[o],h=`${c}Vert`,u=`${HJ(c,o)}Frag`;return t.createRenderPipeline({layout:r,vertex:{module:e,entryPoint:h,constants:l(h),buffers:dwe(o)},fragment:{module:e,entryPoint:u,constants:l(u),targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}},writeMask:i?15:0},{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}},writeMask:i&&!kxe.includes(o)?15:0},{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}},writeMask:i&&!kxe.includes(o)?15:0}]},primitive:{topology:"triangle-list"},depthStencil:{format:v2,depthCompare:"always",depthWriteEnabled:!!(i&&a),stencilReadMask:n,stencilFront:s,stencilBack:s},label:`renderPt ${o} pipeline`})}function Bxe(o,t,e){return o.createRenderPipeline({layout:"auto",vertex:{module:t,entryPoint:"v_main",buffers:[{arrayStride:4*fs,attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:2*fs,format:"float32"},{shaderLocation:2,offset:3*fs,format:"float32"}],stepMode:"instance"}]},fragment:{module:t,entryPoint:"v_frag",constants:{RENDER_HIGHLIGHT_TYPE_SHIFT:jbe},targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}},writeMask:15}]},primitive:{topology:"triangle-list"},depthStencil:{format:v2,depthCompare:"always",depthWriteEnabled:!!e,stencilReadMask:63,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}})}function Fxe(o,t,e,r){let i={color:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}};return o.createRenderPipeline({layout:e,vertex:{module:t,entryPoint:"v_main",constants:{TEMPLATE_BBOX_DATA_LENGTH:GLe,MIN_PX_LENGTH_RATIO:Xbe,TEMPLATE_OFFSET_DATA_LENGTH:cwe},buffers:Fc(1)},fragment:{module:t,entryPoint:"v_frag",targets:[{format:za,blend:i,writeMask:15},{format:za,blend:i,writeMask:0},{format:za,blend:i,writeMask:0}]},primitive:{topology:"triangle-list"},depthStencil:{format:v2,depthCompare:"always",depthWriteEnabled:!!r}})}function nrt(o){let{device:t}=o,e=Qtt(t),r=ert(t),i=o.createShaderModule(Htt),n=t.createPipelineLayout({bindGroupLayouts:[e]}),s=t.createPipelineLayout({bindGroupLayouts:[r]});return{renderPtBindGroupLayout:e,renderPtPipelineLayout:n,templateLayout:r,templatePipelineLayout:s,drawStringPipeline:t.createRenderPipeline({layout:n,vertex:{module:i,entryPoint:"stringVert",constants:GJ("stringVert"),buffers:Fc(1,2,1,1,1,1,1,1,1,1,1,1,1,1)},fragment:{module:i,entryPoint:"stringRulerFrag",constants:GJ("stringFrag"),targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}}),sampler:o.linearSampler,nearSampler:o.nearestSampler,module:i}}var ort=class{constructor(o,t){this.renderPipelines=[],this.renderPipelinesWithoutDepthWrite=[],this.drawPassStencilPipelines=[],this.drawNotPassStencilPipelines=[],this.drawInterStencilPipelines=[],this.afterDraw={render:(s,a,l)=>{this.polygonRenderDesc1.colorAttachments[0].view=s.colorTexture.view,this.polygonRenderDesc1.depthStencilAttachment.view=s.depthStencilTexture.view;let c=new Uint32Array(Lxe);c.set([a]),this.scene.addData(c,this.drawPolygonUniformsBuf);let h=this.scene.commandEncoder.beginRenderPass(this.polygonRenderDesc1);h.setStencilReference(64),h.setPipeline(l?this.drawPolygonPipeline:this.drawPolygonPipelineWithoutDepth),h.setBindGroup(0,l?this.drawPolygonBindGroup.getBindGroup():this.drawPolygonBindGroupWithoutDepth.getBindGroup()),h.setVertexBuffer(0,this.polygonVertexBuf.getBuffer()),h.draw(6,1),h.end()},renderPolygonHighLightColor:(s,a=ee.DefaultHighLightColor,l=ee.DefaultHighLightColor,c=!1)=>{this.highLightPolygonRenderDesc.colorAttachments[0].view=s.highLightColorTexture0.view,this.highLightPolygonRenderDesc.colorAttachments[1].view=s.highLightColorTexture1.view;let h=new Float32Array(wxe);h.set(a.getData()),h.set(l.getData(),4),h[8]=this.scene.getSampling(),h[9]=c?1:0,this.scene.addData(new Uint32Array(h.buffer),this.drawHighLightPolygonUniformsBuf);let u=this.scene.commandEncoder.beginRenderPass(this.highLightPolygonRenderDesc);u.setPipeline(this.drawHighLightPolygonPipeline),u.setBindGroup(0,this.drawHighLightPolygonBindGroup.getBindGroup()),u.draw(6),u.end()},drawPassStencil:s=>{this.scene.drawStencilProgram.draw(s,!1,64,63)},drawNotPassStencil:s=>{this.scene.drawStencilProgram.draw(s,!1,128,63)},drawInterStencil:s=>{}},this.renderPtBindGroupLayout=t.renderPtBindGroupLayout,this.templateLayout=t.templateLayout,this.templatePipelineLayout=t.templatePipelineLayout,this.renderPtModule=t.module,this.drawStringPipeline=t.drawStringPipeline,this.sampler=t.sampler,this.nearSampler=t.nearSampler,this.renderPtPipelineLayout=t.renderPtPipelineLayout,this.desc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"},{view:null,loadOp:"load",storeOp:"store"},{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"},label:"desc of RenderPtProgram"},this.polygonRenderDesc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"},label:"polygonRenderDesc of RenderPtProgram"},this.polygonRenderDesc1={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"},label:"polygonRenderDesc1 of RenderPtProgram"},this.highLightPolygonRenderDesc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"},{view:null,loadOp:"load",storeOp:"store"}],label:"highLightPolygonRenderDesc of RenderPtProgram"},this.stringDesc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],label:"stringDesc of RenderPtProgram"},this.scene=o;let e=o.gpu;this.gpu=e,this.templateCamera=new xv(null,Ov,j7),this.templateCamera.setScene(o),this.templateCamera.setCameraType(!0,!1),this.templateCamera.setCameraDirect(!0,!1),this.templateTarget={colorTexture:e.createDynamicTexture(Ov,j7,za,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,"colorTexture of templateTarget"),depthStencilTexture:e.createDynamicTexture(Ov,j7,v2,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,"depthStencilTexture of templateTarget"),highLightColorTexture0:e.createDynamicTexture(Ov,j7,za,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,"highLightColorTexture0 of templateTarget"),highLightColorTexture1:e.createDynamicTexture(Ov,j7,za,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,"highLightColorTexture1 of templateTarget")},this.clearTemplateDesc={colorAttachments:[{view:this.templateTarget.colorTexture.view,loadOp:"clear",storeOp:"store"}],label:"clearTemplateDesc of renderPtProgram"};let r=e.createShaderModule(Ytt);this.drawTemplatePipeline=Fxe(e.device,r,this.templatePipelineLayout,!0),this.drawTemplatePipelineWithoutDepth=Fxe(e.device,r,this.templatePipelineLayout,!1),this.uniformsBuf=e.createDynamicBuffer(aye,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"uniformsBuf of RenderPtProgram"),this.drawHighLightPolygonUniformsBuf=e.createDynamicBuffer(wxe,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"drawHighLightPolygonUniformsBuf of RenderPtProgram"),this.highLightStencilBuf=e.createDynamicBuffer(1,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,"highLightStencilBuf of RenderPtProgram"),this.sdfInitBuffer=e.createDynamicBuffer(1,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,"sdfBuffer of RenderPtProgram");let i=e.createShaderModule(Wtt);this.drawHighLightPolygonPipeline=e.device.createRenderPipeline({layout:"auto",vertex:{module:i,entryPoint:"v_main"},fragment:{module:i,entryPoint:"v_frag",targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}},{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}}),this.drawHighLightPolygonBindGroup=this.createDrawHighLightPolygonColorBindGroup(),this.drawPolygonUniformsBuf=e.createDynamicBuffer(Lxe,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"drawPolygonUniformsBuf of RenderPtProgram");let n=e.createShaderModule(ztt);this.polygonVertexBuf=e.createDynamicBuffer(4,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,"polygonVertexBuf of RenderPtProgram"),this.drawPolygonPipeline=Bxe(e.device,n,!0),this.drawPolygonPipelineWithoutDepth=Bxe(e.device,n,!1),this.drawPolygonBindGroup=this.createDrawPolygonColorBindGroup(this.drawPolygonPipeline),this.drawPolygonBindGroupWithoutDepth=this.createDrawPolygonColorBindGroup(this.drawPolygonPipelineWithoutDepth),this.drawTemplatePipelineUniformsBuf=e.createDynamicBuffer(Mxe,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"TemplateP uniformsBuf of RenderPtProgram")}createPipelineByType(o,t,e,r,i,n=!0){let{device:s}=this.gpu,a;if(Ur.isNormalPolygonType(o))a=rrt(o,s,this.renderPtModule,this.renderPtPipelineLayout,i,GJ);else{if(Jtt.includes(o))return;a=irt(o,s,this.renderPtModule,this.renderPtPipelineLayout,t,e,r,n,GJ)}return a}updateSize(o,t){this.highLightStencilBuf.setSize(o*t*3)}createDrawHighLightPolygonColorBindGroup(){return this.gpu.createDynamicBindGroup(this.drawHighLightPolygonPipeline.getBindGroupLayout(0),0,this.scene.cameraBuf,1,this.drawHighLightPolygonUniformsBuf,2,this.highLightStencilBuf)}createDrawPolygonColorBindGroup(o){return this.gpu.createDynamicBindGroup(o.getBindGroupLayout(0),0,this.uniformsBuf,1,this.drawPolygonUniformsBuf,2,this.scene.colorsBuf,3,this.scene.cameraBuf)}draw0(o,t,e,r,i){let n=t;if(Ur.isCustomTemplateInstanceType(t)&&(t=Ur.getTemplateTypeByCustomInstanceType(t)),!e)throw new Error("pipelines type Error");o.setPipeline(e),o.setStencilReference(r);let s=UJ(t),a;for(let[l,c,h]of i){a!=h&&(o.setBindGroup(0,h.getBindGroup()),a=h);let u=c.getMemory();o.setVertexBuffer(0,u.getBuffer(),u.getOffset(),u.getSize()),o.draw(s,l),this.scene.renderPtNum+=l,this.scene.renderPtTypeNum[n]+=l,this.scene.renderVertexNum+=l*s,this.scene.drawTimes++}}render(o,t,e,r){let i;r?(this.renderPipelines[t]||(this.renderPipelines[t]=this.createPipelineByType(t,!0,255,{compare:"equal"},127)),i=this.renderPipelines[t]):(this.renderPipelinesWithoutDepthWrite[t]||(this.renderPipelinesWithoutDepthWrite[t]=this.createPipelineByType(t,!0,255,{compare:"equal"},127,!1)),i=this.renderPipelinesWithoutDepthWrite[t]),Ur.isNormalPolygonType(t)?this.draw0(o,t,i,0,e):this.draw0(o,t,i,64,e)}drawPassStencil(o,t,e){this.drawPassStencilPipelines[t]||(this.drawPassStencilPipelines[t]=this.createPipelineByType(t,!1,255,{compare:"always",passOp:"replace"},255)),this.draw0(o,t,this.drawPassStencilPipelines[t],64,e)}drawNotPassStencil(o,t,e){this.drawNotPassStencilPipelines[t]||(this.drawNotPassStencilPipelines[t]=this.createPipelineByType(t,!1,127,{compare:"not-equal",passOp:"replace"},127)),Ur.isNormalPolygonType(t)?this.draw0(o,t,this.drawNotPassStencilPipelines[t],0,e):this.draw0(o,t,this.drawNotPassStencilPipelines[t],128,e)}drawInterStencil(o,t,e){this.drawInterStencilPipelines[t]||(this.drawInterStencilPipelines[t]=this.createPipelineByType(t,!1,255,{compare:"equal",passOp:"increment-wrap"},127)),this.draw0(o,t,this.drawInterStencilPipelines[t],Ur.isNormalPolygonType(t)?0:64,e)}drawString(o,t,e,r,i){this.stringDesc.colorAttachments[0].view=o,this.scene.char.flush(),this.scene.stringInfoBuilder.updateBuf();let n=new Uint32Array(aye),s=new Float32Array(n.buffer);s.set(Ae.ORIGIN.data),s.set(e.getColor().getData(),16),s[37]=e.getPxLength(t,Ae.ORIGIN),s[40]=e.getAllRgbRatio(),s[41]=e.isVisible()?1:0,n[57]=e.isColorful?1:0,this.scene.addData(n,this.uniformsBuf);let a=this.scene.commandEncoder.beginRenderPass(this.stringDesc);a.setPipeline(this.drawStringPipeline),a.setBindGroup(0,i.getBindGroup());let l=r.updateBuf().getMemory();a.setVertexBuffer(0,l.getBuffer(),l.getOffset(),l.getSize()),a.draw(6,r.getLength()/ck.length),a.end()}isRenderForceHighLightPtPolygon(o,t=this.scene.ptGroup.getData()){return this.scene.getGlobalHighLightType()===0&&this.scene.getForceVisibleHighLightPt()&&_h.isForceHighLight(o,t)}getPolygonRenderColors(o,t){let e=[t],r=[{colorIndexs:e,isGroupForceHighLight:!1,isDoubleRgb:!1,isForceHighLight:!1}],i=o.polygonColorAndGroupIdMap.get(t);if(!i&&i!==0)return r;let n=this.scene.ptGroup.getData(),s=!1;if(Array.isArray(i)){let a=!1,l=!1;for(let c=0;c<i.length;c+=1){let h=i[c],u=_h.getColorIndex(h,n);u&&!e.includes(u)&&e.push(u),_h.isDoubleRgb(h,n)&&(!a&&r.push({colorIndexs:e,isDoubleRgb:!0,isForceHighLight:!1,isGroupForceHighLight:!1}),a=!0),this.isRenderForceHighLightPtPolygon(h,n)&&(!l&&r.push({colorIndexs:e,isDoubleRgb:!1,isForceHighLight:!0,isGroupForceHighLight:!1}),l=!0),s||(s=_h.isForceHighLight(h,n))}}else{let a=_h.getColorIndex(i,n);s=_h.isForceHighLight(i,n),a&&!e.includes(a)&&e.push(a),_h.isDoubleRgb(i,n)&&r.push({colorIndexs:e,isDoubleRgb:!0,isForceHighLight:!1,isGroupForceHighLight:!1}),this.isRenderForceHighLightPtPolygon(i,n)&&r.push({colorIndexs:e,isDoubleRgb:!1,isForceHighLight:!0,isGroupForceHighLight:!1})}return r[0].isGroupForceHighLight=s,r}getGroupForceHighLightColorByColorIndex(o,t){let e=o>>jbe,r=t.getColor();if(!t.isColorful&&this.scene.getForceVisibleHighLightPt()&&(r=t.getOriginalColor()),e==0)return r;let i=this.scene.colors[e];return i.r+i.g+i.b==0&&(i=ee.of6(r,i.alpha)),i=i.mulAlpha(r.alpha),i}drawPolygon(o,t,e,r,i,n,s,a,l,c){if(i===1||r.scene.getGroupUseWireFramePolygon()){let h=[];n.forEach(d=>{d.getBuilders().forEach((p,m)=>{let g=d.getMaxLength(m);!l[m]||!g||mv(h,m).push([g,p.updateBuf(),a.getBindGroup(m)])})});let u=this.scene.commandEncoder.beginRenderPass(this.desc);for(let d=0;d<h.length;d++){let p=h[d];p&&this[s](u,d,p,c)}u.end()}if(i!==1||r.scene.getGroupUseColorPolygon()){let h={};n.forEach(u=>{u.getPolygonBuilders().forEach((d,p)=>{d.length&&(h[p]||(h[p]=[]),h[p].push({builders:d,getRenderLength:u.getPolygonMaxLength.bind(u)}))})});for(let u of Object.keys(h)){let d=Number(u),p=this.getPolygonRenderColors(r,d);for(let m=0;m<p.length;m++){let g=p[m].isDoubleRgb?1:0,y=p[m].isForceHighLight?1:0,b=p[m].isGroupForceHighLight,P=p[m].colorIndexs;for(let T=0;T<P.length;T++){let I=P[T];t[43]!==g&&(t[43]=g),t[67]!==y&&(t[67]=y),this.scene.getHasGroupForceHighLight()&&this.scene.getGlobalHighLightType()===1&&(t[66]=Number(d)),t[58]=I,this.scene.addData(o,this.uniformsBuf);let C=[];h[d].forEach(O=>{O.builders.forEach((_,R)=>{let v=O.getRenderLength(R,u);!l[R]||!v||mv(C,R).push([v,_.updateBuf(),a.getBindGroup(Ur.getTemplateTypeByTemplateInstanceType(R))])})});let E=this.scene.commandEncoder.beginRenderPass(this.polygonRenderDesc);for(let O=0;O<C.length;O++){let _=C[O];_&&this[s](E,O,_,c)}E.end(),this.afterDraw[s](e,Number(I),c),this.scene.getGlobalHighLightType()===1&&b&&(this.afterDraw.renderPolygonHighLightColor(e,this.getGroupForceHighLightColorByColorIndex(Number(I),r),void 0,!0),this.highLightStencilBuf.clear(this.scene.commandEncoder,this.highLightStencilBuf.getSize()/3*2))}}}t[43]=0,t[66]=-1,t[67]=0,this.scene.addData(o,this.uniformsBuf)}}flushTarget(o){this.desc.colorAttachments[0].view=o.colorTexture.view,this.desc.colorAttachments[1].view=o.highLightColorTexture0.view,this.desc.colorAttachments[2].view=o.highLightColorTexture1.view,this.desc.depthStencilAttachment.view=o.depthStencilTexture.view,this.polygonRenderDesc.colorAttachments[0].view=o.colorTexture.view,this.polygonRenderDesc.depthStencilAttachment.view=o.depthStencilTexture.view}flush(o,t){return this.flushTarget(o),this.scene.char.flush(),this.scene.sdfStringInfoBuilder.updateBuf(),this.scene.ptGroup.getData().updateBuf(),this.scene.ptTemplate.getTemplateInstanceData().updateBuf(),this.scene.sdfStringLibrary.stringInfoBuilder.updateBuf(),this.scene.addData(t,this.uniformsBuf),this.scene.renderPtNum}drawTemplateToTarget(o,t,e,r,i){let n=new Uint32Array(Mxe),s=new Float32Array(n.buffer);s.set(e.data),s.set(this.templateCamera.getRenderMatrix().data,16),s[33]=o.getPxLength(r,e),this.scene.addData(n,this.drawTemplatePipelineUniformsBuf),this.flushTarget(t);let a=this.scene.commandEncoder.beginRenderPass(this.desc),l=o.drawTemplateBindGroup;a.setPipeline(i?this.drawTemplatePipeline:this.drawTemplatePipelineWithoutDepth),a.setBindGroup(0,l.getBindGroup()),this.scene.ptTemplate.getTemplateInstanceData().updateBuf();let c=o.templateInstance.getData().updateBuf().getMemory();a.setVertexBuffer(0,c.getBuffer(),c.getOffset(),c.getSize()),a.draw(6,o.templateInstance.getMaxTemplateInstanceIndex()+1),a.end(),this.scene.submitCommandEncoder(),this.scene.drawTemplateToTargetTimes++}drawPolygonTemplate(o,t,e,r,i,n,s,a="render",l,c,h){if(c){if(l!==1){let u=[];if(i.getBuilders().forEach((p,m)=>{!Ur.isTemplateNormalPolygonType(m)||!i.getMaxLength(m)||(u[m]=p)}),!u.length)return;this.scene.commandEncoder.beginRenderPass(this.clearTemplateDesc).end(),this.scene.updateCameraBuf(this.templateCamera,Number.NEGATIVE_INFINITY),this.flushTarget(this.templateTarget);let d=Array.from(new Set(r.polygonTemplatePtColorArr));for(let p=0;p<d.length;p++){let m=d[p],g=this.getPolygonRenderColors(r,Number(m));for(let y=0;y<g.length;y++){let b=g[y].isDoubleRgb?1:0,P=g[y].colorIndexs;for(let T=0;T<P.length;T++){let I=P[T];s[43]!==b&&(s[43]=b),s[58]=I,this.scene.addData(n,this.uniformsBuf);let C=[];u.forEach((O,_)=>{let R=i.getMaxLength(_);R&&mv(C,_).push([R,O.updateBuf(),i.getBindGroup(_)])});let E=this.scene.commandEncoder.beginRenderPass(this.polygonRenderDesc);for(let O=0;O<C.length;O++){let _=C[O];_&&this[a](E,O,_,h)}E.end(),this.afterDraw[a](this.templateTarget,I,h)}}}s[43]=0,this.scene.addData(n,this.uniformsBuf)}else{this.scene.commandEncoder.beginRenderPass(this.clearTemplateDesc).end(),this.scene.updateCameraBuf(this.templateCamera,Number.NEGATIVE_INFINITY),this.flushTarget(this.templateTarget),this.scene.addData(n,this.uniformsBuf);let u=this.scene.commandEncoder.beginRenderPass(this.desc);i.getBuilders().forEach((d,p)=>{let m=i.getMaxLength(p);!Ur.isTemplateWireFramePolygonType(p)||!m||this[a](u,p,[[m,d.updateBuf(),i.getBindGroup(p)]],h)}),u.end()}this.scene.updateCameraBuf(e,Number.NEGATIVE_INFINITY),this.drawTemplateToTarget(r,o,t,e,h)}}isRenderTemplatePtType(o,t){return!(o&&Ur.isTemplateInstancePtType(t)&&!Ur.isCustomTemplateInstanceType(t))}draw(o,t,e,r,i,n,s,a,l,c,h,u="render",d,p,m){var g,y;let b=r.getBBox().toBBox2();this.scene.addData(new Uint32Array(new Float32Array([b.UL().x,b.UR().y,b.width(),b.height()]).buffer),this.polygonVertexBuf);let P=[];s&&(P[10]=!0,P[60]=!0,P[30]=!0),a&&(P[19]=!0),l&&(P[5]=!0),c&&$tt.forEach(z=>{this.isRenderTemplatePtType(p,z)&&(P[z]=!0)}),h&&((i===1||r.scene.getGroupUseWireFramePolygon())&&Ktt.forEach(z=>{this.isRenderTemplatePtType(p,z)&&(P[z]=!0)}),(i!==1||r.scene.getGroupUseColorPolygon())&&Ztt.forEach(z=>{this.isRenderTemplatePtType(p,z)&&(P[z]=!0)}));let T=r.getPxLength(e,t),I=uwe(T,this.scene.getFixedPtData()),C=this.scene.renderPtNum,E=new Uint32Array(aye),O=new Float32Array(E.buffer);O.set(t.data),O[37]=T,E[38]=i,E[39]=r.isNormal?1:0,O[40]=r.getAllRgbRatio(),E[41]=r.isVisible()?1:0,E[42]=0,E[43]=0,O[66]=-1,O[67]=0,E[57]=r.isColorful?1:0,O.set(((g=this.scene.highLightColor[0])==null?void 0:g.getData())||ee.DefaultHighLightColor.getData(),44),O.set(((y=this.scene.highLightColor[1])==null?void 0:y.getData())||ee.DefaultHighLightColor.getData(),48);let _=this.scene.drcRenderModel===0;O[52]=this.scene.getSampling(),O[53]=0,O[54]=_?1:0,O[55]=this.scene.drcRenderStyle===0?1:0,O[56]=0,O[59]=this.scene.getGlobalHighLightType(),r.getOriginalColor()&&O.set(r.getOriginalColor().getData(),60),O[64]=this.scene.getForceVisibleHighLightPt()?1:0,O[65]=r.ignoreForceHighLightEffect?1:0;let R=this.scene.getFixedPtData();O[68]=R[0],O[69]=R[1],O[70]=R[2],O[71]=R[3],O[72]=R[4],O[73]=R[5],O[74]=R[6],O.set(this.scene.ambientLight.color.getData(),76),O.set(this.scene.directionalLight.color.getData(),80);let v=this.scene.directionalLight.direction();O.set([v.x,v.y,v.z],84);let D=this.scene.getViewOffset();O.set([D.x,D.y],88),this.flush(o,E);let w=r.getColor();w&&O.set(w.getData(),16),O.set(r.getNetStringColor().getData(),20);let F=r.getMaterial();F&&(O.set(F.ambient.getData(),24),O.set(F.diffuse.getData(),28),O.set(F.specular.getData(),32),O[35]=F.shininess,O[36]=F.alpha),this.scene.addData(E,this.uniformsBuf);let H=[];if(p&&c){this.scene.commandEncoder.beginRenderPass(this.clearTemplateDesc).end(),this.scene.updateCameraBuf(this.templateCamera,Number.NEGATIVE_INFINITY),this.flushTarget(this.templateTarget);let z=this.scene.commandEncoder.beginRenderPass(this.desc),G=!1;d.getBuilders().forEach((W,L)=>{let B=d.getMaxLength(L);!P[L]||Ur.isPolygonType(L)||!B||(G=!0,this[u](z,L,[[B,W.updateBuf(),d.getBindGroup(L)]],m))}),z.end(),G?(this.scene.updateCameraBuf(e,Number.NEGATIVE_INFINITY),this.drawTemplateToTarget(r,o,t,e,m)):(this.scene.updateCameraBuf(e,Number.NEGATIVE_INFINITY),this.flushTarget(o))}if(c&&n.forEach(z=>{z.getBuilders().forEach((G,W)=>{let L=z.getMaxLength(W);!P[W]||!L||W===68&&!I||mv(H,W).push([L,G.updateBuf(),d.getBindGroup(Ur.getTemplateTypeByTemplateInstanceType(W))])})}),s){if(p){let z=[];if(d.drawString(T,(G,W,L)=>{z.push([L,G.updateBuf(),d.getBindGroup(60)])}),z.length){this.scene.commandEncoder.beginRenderPass(this.clearTemplateDesc).end(),this.scene.updateCameraBuf(this.templateCamera,Number.NEGATIVE_INFINITY),this.flushTarget(this.templateTarget);let G=this.scene.commandEncoder.beginRenderPass(this.desc);this[u](G,60,z,m),G.end(),this.scene.updateCameraBuf(e,Number.NEGATIVE_INFINITY),this.drawTemplateToTarget(r,o,t,e,m)}}n.forEach(z=>{z.drawString(T,(G,W,L)=>{mv(H,10).push([L,G.updateBuf(),d.getStringTemplateBindGroup(W)])}),!p&&z.drawTemplateString(T,(G,W,L)=>{mv(H,30).push([L,G.updateBuf(),d.getStringTemplateBindGroup(W)])}),z.drawCustomTemplateString(T,(G,W,L)=>{mv(H,45).push([L,G.updateBuf(),d.getStringTemplateBindGroup(W)])})})}a&&n.forEach(z=>{let G=z.getBuilders()[19],W=z.getMaxLength(19);!W||_&&z.getDrcPxLength()<T||mv(H,19).push([W,G.updateBuf(),d.getBindGroup(19)])});{let z=this.scene.commandEncoder.beginRenderPass(this.desc);for(let G=0;G<H.length;G++){let W=H[G];W&&this[u](z,G,W,m)}z.end()}h&&(r.polygonColorAlphaRatio!==1&&(O[19]=r.polygonColorAlphaRatio*w.alpha,O[63]=r.polygonColorAlphaRatio*r.getOriginalColor().alpha),this.drawPolygonTemplate(o,t,e,r,d,E,O,u,i,p,m),this.drawPolygon(E,O,o,r,i,n,u,d,P,m))}};function mv(o,t){return o[t]||(o[t]=[])}var srt=!1,fs=4,art=2**30/fs,t5t=art/2,r5t=2**(2**7-1),i5t=2**31-1,lrt=1024;function gS(){return window}async function crt(o){return await t(o);async function t(e){try{let r=nrt(e);return await e.device.queue.onSubmittedWorkDone(),{renderPt:r}}catch(r){throw r}}}var za="rgba8unorm",v2="depth24plus-stencil8",Jye="sans-serif";function wL(o,t){return`${o["font-style"]||"normal"} ${o["font-weight"]||"normal"} ${`${t||parseFloat(o["font-size"])||10}px`} "${o["font-family"]}", ${Jye}`}var pwe=class sW{constructor(){this.lastFontStyleString="",this.lastRatio=0,this.ctx=new Tf(document.createElement("canvas").getContext("2d")),this.recordFontFamily=new Map}static getInstance(){return sW.instance==null&&(sW.instance=new sW),sW.instance}isFontApplied(t,e,r){let i=t.getContext().font.toLowerCase();return i.includes(e.toString())&&r.split(",").some(n=>(n=n.trim(),n=n.replace(/^['"]|['"]$/g,""),i.includes(n.toLowerCase())))}getApplyFontFamily(t,e){if(!e)return t;let r=this.recordFontFamily.get(t);if(r)return r;let i=Jye;return this.ctx.setFont(`${K7}px "${t}"`),this.isFontApplied(this.ctx,K7,t)&&(i=t),this.ctx.setFont(`10px ${Jye}`),this.recordFontFamily.set(t,i),i}getTextInfo(t,e,r=!0,i=!0){if(e["font-family"]=this.getApplyFontFamily(e["font-family"],i),this.ctx.setTextBaseLine("bottom"),!r)return this.getTextInfoDisableCorrection(t,e);let n=parseFloat(e["font-size"]),s=JSON.stringify(e);if(!this.lastFontStyleString||!this.lastRatio||s!==this.lastFontStyleString){let c=wL(e,K7);this.ctx.setFont(c);let h=this.ctx.getContext().measureText(t),u=Math.abs(h.fontBoundingBoxAscent)+Math.abs(h.fontBoundingBoxDescent);this.lastRatio=K7/u,this.lastFontStyleString=s}let a=n*this.lastRatio,l=wL(e,a);return this.ctx.setFont(l),{width:this.ctx.getContext().measureText(t).width,height:n,fontFamily:e["font-family"],renderFontSize:a}}getTextInfoDisableCorrection(t,e){let r=parseFloat(e["font-size"]),i=wL(e,r);this.ctx.setFont(i);let n=this.ctx.getContext().measureText(t);return{width:n.width,height:Math.abs(n.fontBoundingBoxAscent)+Math.abs(n.fontBoundingBoxDescent),fontFamily:e["font-family"],renderFontSize:r}}};pwe.instance=null;var hrt=pwe,qbe=class{};qbe.value=null;function Qye(o){if(typeof o!="object"||o===null||o instanceof Date||o instanceof ArrayBuffer)return o;if(Array.isArray(o))return o.map(Qye);{let t={};for(let e in o)o.hasOwnProperty(e)&&(t[e]=Qye(o[e]));return t}}function Vxe(o,t,e){return{x:t*o[0]+e*o[3]+o[6],y:t*o[1]+e*o[4]+o[7]}}function Hl(o,t,e){return{x:o*Math.cos(e)-t*Math.sin(e),y:o*Math.sin(e)+t*Math.cos(e)}}function Gxe(o,t,e,r){return{x:o*e,y:t*r}}function ebe(o,t,e){let r=o[t];return r!==void 0||(r=e(t),o[t]=r),r}function urt(o,t){return ebe(o,t,()=>[])}var drt=II*3,$be=(o=>(o[o.ID=0]="ID",o[o.POSITION_X=1]="POSITION_X",o[o.POSITION_Y=2]="POSITION_Y",o[o.WIDTH=3]="WIDTH",o[o.HEIGHT=4]="HEIGHT",o[o.ANGLE=5]="ANGLE",o[o.STRING_LENGTH=6]="STRING_LENGTH",o[o.STRING_INDEX=7]="STRING_INDEX",o[o.MAX_PX_HEIGHT=8]="MAX_PX_HEIGHT",o[o.LIMIT_MAX=9]="LIMIT_MAX",o[o.GROUP_ID=10]="GROUP_ID",o[o.COLOR_INDEX=11]="COLOR_INDEX",o[o.ORDER=12]="ORDER",o[o.WIDTH_OFFSET_RATIO=13]="WIDTH_OFFSET_RATIO",o[o.HEIGHT_OFFSET_RATIO=14]="HEIGHT_OFFSET_RATIO",o[o.TEMPLATE_ID=15]="TEMPLATE_ID",o))($be||{}),fwe=15,qm=[],mwe=class extends f0{create(o,t,e,r,i,n,s,a,l,c=-1,h,u,d,p){return qm[0]=o+(10<<fa)+Is,qm[1]=t.x,qm[2]=t.y,qm[3]=e,qm[4]=r,qm[5]=(i%pa+pa)%pa,qm[6]=n,qm[7]=s,qm[8]=r/a,qm[9]=l,qm[10]=c,qm[11]=h||0,qm[12]=u||0,qm[13]=d||0,qm[14]=p||0,qm}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+5],n=o[t+3]/2,s=o[t+4]/2,a=o[t+13],l=o[t+14];if(e+=a*n*2,r+=l*s*2,i===0||i===Math.PI)return ul.modify(e-n,e+n,r-s,r+s);if(i===II||i===drt)return ul.modify(e-s,e+s,r-n,r+n);let c=Hl(n,-s,i),h=Hl(n,s,i),u=Hl(-n,-s,i),d=Hl(-n,s,i),p={x:e+d.x,y:r+d.y},m={x:e+u.x,y:r+u.y},g={x:e+h.x,y:r+h.y},y={x:e+c.x,y:r+c.y};return ul.modify(Math.min(p.x,m.x,g.x,y.x),Math.max(p.x,m.x,g.x,y.x),Math.min(p.y,m.y,g.y,y.y),Math.max(p.y,m.y,g.y,y.y))}},prt=class extends mwe{create(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m){return super.create(o,t,e,r,i,n,s,a,l,c,h,u,d,p),qm[0]=o+(60<<fa)+Is,qm[14]=m,qm}},ck=new mwe(10,fwe,$be),WJ=new prt(60,fwe+1,$be),eE=2,_J=class{constructor(o){this.data=o,this.bitmap=new Cg(32),this.bitmap.addTrimListener(t=>{this.data.trimChunk(t*eE)}),this.indexMap=new Map}add(o,t){let e=this.bitmap.findEmpty();e===-1&&(this.bitmap=this.bitmap.extSize(this.bitmap.size*2),e=this.bitmap.findEmpty()),this.bitmap.markUsed(e);let r=this.indexMap.get(o);r||r==0?Array.isArray(r)?r.push(e):(r=[r,e],this.indexMap.set(o,r)):this.indexMap.set(o,e),this.data.setArr([o,t],e*eE)}getColorIndex(o){return o>>ek}getColorIndexByDataIndex(o){return this.data.get(o*eE+1)}getDataIndexArrayByColorIndex(o,t,e){let r=[];if(t.forEach(i=>{let n=this.getColorIndexByDataIndex(i);o===n&&r.push(i)}),!r.length)throw new Error(`colorIndex error id:${e},colorIndex:${o}`);return r}remove(o,t){let e=this.indexMap.get(o);if(e==null)return 0;if(Array.isArray(e)){if(t){let r=this.getDataIndexArrayByColorIndex(t,e,o),i=r[r.length-1];this.data.set(i*eE,-1),this.bitmap.markRemove(i),e.forEach((n,s)=>{n===i&&e.splice(s,1)})}else{let r=e.length-1;this.data.set(e[r]*eE,-1),this.bitmap.markRemove(e[r]),e.pop()}e.length?e.length>1?this.indexMap.set(o,e):this.indexMap.set(o,e[0]):this.indexMap.delete(o)}else{if(t){let r=this.getColorIndexByDataIndex(e);if(t!==r)throw new Error(`colorIndex error id:${o},colorIndex:${t},recordColorIndex: ${r}`)}this.data.set(e*eE,-1),this.bitmap.markRemove(e),this.indexMap.delete(o)}return 1}getData(){return this.data}getMaxLength(){return this.bitmap.getMax()+1}getPtHighLightColorArray(o){let t=this.indexMap.get(o),e=[];if(t||t==0)if(!Array.isArray(t))e.push(this.data.get(t*eE+1));else for(let r=0;r<t.length;r+=1)e.push(this.data.get(t[r]*eE+1));return e}},frt=II*3,gwe=(o=>(o[o.ID=0]="ID",o[o.POSITION_X=1]="POSITION_X",o[o.POSITION_Y=2]="POSITION_Y",o[o.WIDTH=3]="WIDTH",o[o.HEIGHT=4]="HEIGHT",o[o.ANGLE=5]="ANGLE",o[o.MAX_PX_LENGTH=6]="MAX_PX_LENGTH",o[o.LIMIT_MAX=7]="LIMIT_MAX",o[o.LEFT_STRING_INDEX=8]="LEFT_STRING_INDEX",o[o.RIGHT_STRING_INDEX=9]="RIGHT_STRING_INDEX",o[o.ORDER=10]="ORDER",o[o.GROUP_ID=11]="GROUP_ID",o[o.COLOR_INDEX=12]="COLOR_INDEX",o[o.TEMPLATE_ID=13]="TEMPLATE_ID",o))(gwe||{}),mrt=13,C2=[],grt=class extends f0{create(o,t,e,r,i,n,s,a,l,c=-1,h,u){return C2[0]=o+(19<<fa)+Is,C2[1]=t.x,C2[2]=t.y,C2[3]=e,C2[4]=r,C2[5]=(i%pa+pa)%pa,C2[6]=r/n,C2[7]=s,C2[8]=a,C2[9]=l,C2[10]=u||0,C2[11]=c,C2[12]=h||0,C2}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+5],n=o[t+3]/2,s=o[t+4]/2;if(i===0||i===Math.PI)return ul.modify(e-n,e+n,r-s,r+s);if(i===II||i===frt)return ul.modify(e-s,e+s,r-n,r+n);let a=Hl(n,-s,i),l=Hl(n,s,i),c=Hl(-n,-s,i),h=Hl(-n,s,i),u={x:e+h.x,y:r+h.y},d={x:e+c.x,y:r+c.y},p={x:e+l.x,y:r+l.y},m={x:e+a.x,y:r+a.y};return ul.modify(Math.min(u.x,d.x,p.x,m.x),Math.max(u.x,d.x,p.x,m.x),Math.min(u.y,d.y,p.y,m.y),Math.max(u.y,d.y,p.y,m.y))}},Kbe=new grt(19,mrt,gwe),_W=class extends f0{getOrder(o,t,e){let r=o[t+this.DataIndex.GROUP_ID]*Ld+6;return e.get(r)}getGroupIdByBuilder(o,t,e){if(!this.DataIndex.GROUP_ID)throw new Error("GetGroupId error ");let r=o.get(t+this.DataIndex.GROUP_ID)*Ld+8;return e.get(r)}getTemplateId(o,t,e){let r=o[t+this.DataIndex.GROUP_ID]*Ld+9;return e.get(r)}getColorIndex(o,t,e){let r=o[t+this.DataIndex.GROUP_ID]*Ld+7;return e.get(r)}},$h=(o=>(o[o.ID=0]="ID",o[o.INDEX=1]="INDEX",o[o.TEMPLATE_INSTANCE_INDEX=2]="TEMPLATE_INSTANCE_INDEX",o[o.COLOR_INDEX=3]="COLOR_INDEX",o[o.GROUP_ID=4]="GROUP_ID",o))($h||{}),yu=5,D7=[];function ywe(o,t,e,r,i=-1){return D7[0]=o+(this.type<<fa)+Is,D7[1]=t,D7[2]=e,D7[3]=r||0,D7[4]=i,D7}var z0=class extends f0{create(o,t,e,r,i=-1){return ywe(o,t,e,r,i)}getBBox(o,t){return ul}},Nv=class extends _W{create(o,t,e,r,i=-1){return ywe(o,t,e,r,i)}getBBox(o,t){return ul}},yrt=new z0(21,yu,$h),brt=new z0(22,yu,$h),Prt=new z0(23,yu,$h),Trt=new z0(24,yu,$h),Irt=new z0(25,yu,$h),Crt=new z0(26,yu,$h),Srt=new z0(27,yu,$h),Ert=new Nv(28,yu,$h),Ort=new Nv(29,yu,$h),Sv=new z0(30,yu,$h),Art=new z0(31,yu,$h),_rt=new z0(32,yu,$h),vrt=new Nv(33,yu,$h),xrt=new Nv(34,yu,$h),Rrt=new z0(35,yu,$h),Drt=new z0(36,yu,$h),wrt=new z0(37,yu,$h),Lrt=new z0(38,yu,$h),Mrt=new z0(39,yu,$h),Nrt=new z0(40,yu,$h),krt=new z0(41,yu,$h),Brt=new z0(42,yu,$h),Frt=new Nv(43,yu,$h),Vrt=new Nv(44,yu,$h),Grt=new z0(45,yu,$h),Urt=new z0(46,yu,$h),Hrt=new z0(47,yu,$h),Wrt=new Nv(48,yu,$h),zrt=new Nv(49,yu,$h),Yrt=new z0(50,yu,$h),pS=4,vJ=2**pS-1,Zbe=class{constructor(o,t,e,r){if(this.minStringLevel=t,this.maxStringLevel=e,this.builders=[],this.bitmaps=[],this.strBuilders=[],this.strBitmaps=[],this.templateStrBuilders=[],this.templateStrBitmaps=[],this.customTemplateStrBuilders=[],this.customTemplateStrBitmaps=[],this.stringMaxPxLength=Number.NEGATIVE_INFINITY,this.drcPtMaxPxLength=null,this.sdfStrBuilders=[],this.sdfStrBitmaps=[],this.highLightGroupIds=[],this.stringHighLightGroupIds=[],this.stringTemplateHighLightGroupIds=[],this.stringCustomTemplateHighLightGroupIds=[],this.createBuilder=o,this.createHighLightIdsBuilder=r,e-t+1>2**pS)throw new Error("maxStringLevel - minStringLevel + 1 > 2 ** StringLevelBitLength")}clear(){this.builders.length=0,this.bitmaps.length=0,this.strBuilders.length=0,this.strBitmaps.length=0,this.templateStrBuilders.length=0,this.templateStrBitmaps.length=0,this.customTemplateStrBuilders.length=0,this.customTemplateStrBuilders.length=0,this.stringMaxPxLength=Number.NEGATIVE_INFINITY,this.drcPtMaxPxLength=null,this.sdfStrBuilders.length=0,this.sdfStrBitmaps.length=0,this.highLightGroupIds.length=0,this.stringHighLightGroupIds.length=0,this.stringTemplateHighLightGroupIds.length=0,this.stringCustomTemplateHighLightGroupIds.length=0}addStringHighLightPt(o,t,e,r){let{level:i,index:n}=this.getStringInfo(o,r);this.stringHighLightGroupIds[t]||(this.stringHighLightGroupIds[t]=[]),this.stringHighLightGroupIds[t][i]||(this.stringHighLightGroupIds[t][i]=new _J(this.createHighLightIdsBuilder(i))),this.stringHighLightGroupIds[t][i].add(n,e)}addStringTemplateHighLightPt(o,t,e,r){let{level:i,index:n}=this.getTemplateStringInfo(o,r),s=r===30?this.stringTemplateHighLightGroupIds:this.stringCustomTemplateHighLightGroupIds;s[t]||(s[t]=[]),s[t][i]||(s[t][i]=new _J(this.createHighLightIdsBuilder(i))),s[t][i].add(n,e)}isTemplateStringType(o){return o===30||o===45}addHighLightPt(o,t,e,r){if(this.isStringType(o)){this.addStringHighLightPt(t,e,r,o);return}if(this.isTemplateStringType(o)){this.addStringTemplateHighLightPt(t,e,r,o);return}this.highLightGroupIds[e]||(this.highLightGroupIds[e]=[]),this.highLightGroupIds[e][o]||(this.highLightGroupIds[e][o]=new _J(this.createHighLightIdsBuilder(o))),this.highLightGroupIds[e][o].add(t,r)}removeHighLightPt(o,t,e,r){var i;return this.isStringType(o)?this.removeStringHighLightPt(t,e,r,o):this.isTemplateStringType(o)?this.removeStringTemplateHighLightPt(t,e,r,o):(i=this.highLightGroupIds[e])!=null&&i[o]?this.highLightGroupIds[e][o].remove(t,r):0}removeStringHighLightPt(o,t,e,r){let{level:i,index:n}=this.getStringInfo(o,r);return this.stringHighLightGroupIds[t][i].remove(n,e)}removeStringTemplateHighLightPt(o,t,e,r){let{level:i,index:n}=this.getTemplateStringInfo(o,r);return(r===30?this.stringTemplateHighLightGroupIds:this.stringCustomTemplateHighLightGroupIds)[t][i].remove(n,e)}getHighLightIds(o,t=1){var e;return this.isStringType(t)?this.getStringHighLightIds(o):this.isTemplateStringType(t)?this.getStringTemplateHighLightIds(o,t):(e=this.highLightGroupIds)==null?void 0:e[o]}getStringHighLightIds(o){var t;return(t=this.stringHighLightGroupIds)==null?void 0:t[o]}getStringTemplateHighLightIds(o,t){var e,r;return t===30?(e=this.stringTemplateHighLightGroupIds)==null?void 0:e[o]:(r=this.stringCustomTemplateHighLightGroupIds)==null?void 0:r[o]}getHighLightInfo(o,t){var e,r;if(this.isStringType(o))return this.getStringHighLightInfo(t,o);if(this.isTemplateStringType(o))return this.getStringTemplateHighLightInfo(t,o);let i=[];for(let n=0;n<this.highLightGroupIds.length;n++){let s=(r=(e=this.highLightGroupIds[n])==null?void 0:e[o])==null?void 0:r.getPtHighLightColorArray(t);s!=null&&s.length&&(i[n]=s)}return i}getStringHighLightInfo(o,t){var e,r;let{level:i,index:n}=this.getStringInfo(o,t),s=[];for(let a=0;a<this.stringHighLightGroupIds.length;a++){let l=(r=(e=this.stringHighLightGroupIds[a])==null?void 0:e[i])==null?void 0:r.getPtHighLightColorArray(n);l!=null&&l.length&&(s[a]=l)}return s}getStringTemplateHighLightInfo(o,t){var e,r;let{level:i,index:n}=this.getTemplateStringInfo(o,t),s=[],a=t===30?this.stringTemplateHighLightGroupIds:this.stringCustomTemplateHighLightGroupIds;for(let l=0;l<a.length;l++){let c=(r=(e=a[l])==null?void 0:e[i])==null?void 0:r.getPtHighLightColorArray(n);c!=null&&c.length&&(s[l]=c)}return s}getHighLightIdInfo(o,t,e){var r,i;return this.isStringType(o)?this.getStringHighLightIdInfo(t,e,o):((i=(r=this.highLightGroupIds[e])==null?void 0:r[o])==null?void 0:i.getPtHighLightColorArray(t))||[]}getStringHighLightIdInfo(o,t,e){var r,i;let{level:n,index:s}=this.getStringInfo(o,e);return((i=(r=this.stringHighLightGroupIds[t])==null?void 0:r[n])==null?void 0:i.getPtHighLightColorArray(s))||[]}removeHighLightPtAll(o,t,e,r){let i=0;for(let n=0;n<e.length;n++){let s=e[n];for(let a=0;a<(s==null?void 0:s.length);a++)r?r===s[a]&&(i+=this.removeHighLightPt(o,t,n,s[a])):i+=this.removeHighLightPt(o,t,n,s[a])}return i}addHighLightPtAll(o,t,e){let r=0;for(let i=0;i<e.length;i++){let n=e[i];for(let s=0;s<(n==null?void 0:n.length);s++)r++,this.addHighLightPt(o,t,i,n[s])}return r}setHighLightPtNum(o,t,e,r,i){let n=this.getHighLightIdInfo(o,t,e),s="none",a=n.filter(l=>l===i);if(a.length==r)return{operate:s,highLightNum:0};if(a.length==n.length){let l=r-n.length,c=Math.abs(l);if(l>0){s="add";for(let h=0;h<c;h++)this.addHighLightPt(o,t,e,i)}else{s="remove";for(let h=0;h<c;h++)this.removeHighLightPt(o,t,e,i)}return{operate:s,highLightNum:c}}else if(r==n.length){for(let l=0;l<r;l++)this.removeHighLightPt(o,t,e,n[0]);for(let l=0;l<r;l++)this.addHighLightPt(o,t,e,i);return{operate:s,highLightNum:0}}else{let l=r-n.length,c=Math.abs(l);for(let h=0;h<n.length;h++)this.removeHighLightPt(o,t,e,n[h]);l>0?s="add":s="remove";for(let h=0;h<r;h++)this.addHighLightPt(o,t,e,i);return{operate:s,highLightNum:c}}}getPtNum(o){var t;if(Ur.isNormalPolygonType(o))throw new Error("type error");return((t=this.bitmaps[o])==null?void 0:t.getMarked())||0}getStringMaxPxLength(){return this.stringMaxPxLength}getDrcPxLength(){return this.drcPtMaxPxLength}calStringLevel(o){return Math.max(this.minStringLevel,Math.min(this.maxStringLevel,Math.ceil(Math.log2(o))))-this.minStringLevel}calStringPtLevel(o){let t=o[8];return t>this.stringMaxPxLength&&(this.stringMaxPxLength=t),this.calStringLevel(t)}addString(o,t,e){let r=this.calStringPtLevel(o),i=this.getStringEnvLength(e),n=this.strBitmaps[r];if(!n){this.strBitmaps[r]=n=new Cg(32);let a=this.strBuilders[r]=this.createBuilder(e);this.strBitmaps[r].addTrimListener(l=>{a.trimChunk(l*i)})}let s=n.findEmpty();s===-1&&(this.strBitmaps[r]=n=n.extSize(n.size*2),s=n.findEmpty()),n.markUsed(s),this.strBuilders[r].setArr(o,s*i),this.builders[e].set(t,(s<<pS)+r)}addTemplateString(o,t,e){let r=e===30?this.templateStrBitmaps:this.customTemplateStrBitmaps,i=this.templateStrBuilders,n=o[1]&vJ,s=r[n];if(!s){r[n]=s=new Cg(32);let l=i[n]=this.createBuilder(30);r[n].addTrimListener(c=>{l.trimChunk(c*Sv.length)})}let a=s.findEmpty();a===-1&&(r[n]=s=s.extSize(s.size*2),a=s.findEmpty()),s.markUsed(a),i[n].setArr(o,a*Sv.length),this.builders[e].set(t,(a<<pS)+n)}calDrcPtLevel(o){let t=o[6];this.drcPtMaxPxLength=t}createId(o,t,e){let r=this.bitmaps[o];if(!r){this.bitmaps[o]=r=new Cg(32),this.builders[o]||(this.builders[o]=this.createBuilder(o));let n=this.builders[o];r.addTrimListener(s=>{n.trimChunk(s*e)})}let i=r.findEmpty();return i===-1&&(this.bitmaps[o]=r=r.extSize(r.size*2),i=r.findEmpty()),r.markUsed(i),i}addPt(o,t,e){let r=this.createId(o,t,e);return this.isStringType(o)?this.addString(t,r,o):this.isTemplateStringType(o)?this.addTemplateString(t,r,o):(o===19&&!this.drcPtMaxPxLength&&this.calDrcPtLevel(t),this.builders[o].setArr(t,r*Ur.getPtLengthByType(o))),r}getStringInfo(o,t){o=this.builders[t].get(o);let e=o&vJ,r=o>>pS;return{level:e,index:r,builder:this.strBuilders[e],bitmap:this.strBitmaps[e]}}removeString(o,t){let{builder:e,bitmap:r,index:i}=this.getStringInfo(o,t);e.set(i*this.getStringEnvLength(t),0),r.markRemove(i)}getTemplateStringInfo(o,t){let e=t===30?this.templateStrBitmaps:this.customTemplateStrBitmaps,r=this.templateStrBuilders;o=this.builders[30].get(o);let i=o&vJ,n=o>>pS;return{level:i,index:n,builder:r[i],bitmap:e[i]}}removeTemplateString(o,t){let{builder:e,bitmap:r,index:i}=this.getTemplateStringInfo(o,t);e.set(i*Sv.length,0),r.markRemove(i)}isStringType(o){return o===10||o===60}getStringEnvLength(o){return o===10?ck.length:WJ.length}removePt(o,t){this.isStringType(o)?this.removeString(t,o):this.isTemplateStringType(o)?this.removeTemplateString(t,o):this.builders[o].set(t*Ur.getPtLengthByType(o),0),this.bitmaps[o].markRemove(t)}updatePt(o,t,e){if(this.isStringType(o)){let{builder:r,level:i,index:n}=this.getStringInfo(t,o),s=this.calStringPtLevel(e);return i===s?r.setArr(e,n*this.getStringEnvLength(o)):(this.removeString(t,o),this.addString(e,t,o)),t}if(this.isTemplateStringType(o)){let{builder:r,level:i,index:n}=this.getTemplateStringInfo(t,o),s=this.calStringPtLevel(e);return i===s?r.setArr(e,n*Sv.length):(this.removeTemplateString(t,o),this.addTemplateString(e,t,o)),t}return this.builders[o].setArr(e,t*Ur.getPtLengthByType(o)),t}getPt(o,t){if(this.isStringType(o)){let{builder:r,index:i}=this.getStringInfo(t,o);return r.slice(i*this.getStringEnvLength(o),(i+1)*this.getStringEnvLength(o))}if(this.isTemplateStringType(o)){let{builder:r,index:i}=this.getTemplateStringInfo(t,o);return r.slice(i*Sv.length,(i+1)*Sv.length)}let e=Ur.getPtLengthByType(o);return this.builders[o].slice(t*e,(t+1)*e)}setPtVisible(o,t,e){let r,i=!1,n,s;if(this.isStringType(o)){let{builder:l,index:c}=this.getStringInfo(t,o);n=c*this.getStringEnvLength(o),s=l}else if(this.isTemplateStringType(o)){let{builder:l,index:c}=this.getTemplateStringInfo(t,o);n=c*Sv.length,s=l}else n=t*Ur.getPtLengthByType(o),s=this.builders[o];let a=(s.get(n)&Is)!==0;return e!==a&&(e?s.set(n,s.get(n)|Is):s.set(n,s.get(n)&fW),r=s.slice(n,n+Ur.getPtLengthByType(o)),i=!0),{ptData:r,isUpdate:i}}getBuilders(){return this.builders}getMaxLength(o){var t;return(t=this.bitmaps)!=null&&t[o]?this.bitmaps[o].getMax()+1:0}getStringBuilders(){return this.strBuilders}getTemplateStringBuilders(){return this.templateStrBuilders}drawString(o,t){for(let e=this.calStringLevel(o);e<this.strBuilders.length;e++){let r=this.strBuilders[e],i=this.strBitmaps[e]?this.strBitmaps[e].getMax()+1:0;!r||!i||t(r,e,i)}}drawTemplateString(o,t){for(let e=this.calStringLevel(o);e<this.templateStrBuilders.length;e++){let r=this.templateStrBuilders[e],i=this.templateStrBitmaps[e]?this.templateStrBitmaps[e].getMax()+1:0;!r||!i||i&&t(r,e,i)}}drawCustomTemplateString(o,t){for(let e=this.calStringLevel(o);e<this.customTemplateStrBuilders.length;e++){let r=this.customTemplateStrBuilders[e],i=this.customTemplateStrBitmaps[e]?this.customTemplateStrBitmaps[e].getMax()+1:0;!r||!i||t(r,e,i)}}drawSdfString(o){for(let t=0;t<this.sdfStrBuilders.length;t++){let e=this.sdfStrBuilders[t],r=this.sdfStrBitmaps[t]?this.sdfStrBitmaps[t].getMax()+1:0;!e||!r||o(e,t)}}},jrt=2**ak-1,bwe=class{constructor(){this.ptNum=0,this.indexsArr=new Array(69).fill(0).map(()=>[]),this.bitmaps=[]}static getTypeById(o){return o&jrt}getIndexsArrIndex(o){return o>>ak}getIndex(o){let t=this.bitmaps[o];t||(this.bitmaps[o]=t=new Cg(32));let e=t.findEmpty();return e===-1&&(this.bitmaps[o]=t=t.extSize(t.size*2),e=t.findEmpty()),t.markUsed(e),e}clearArrData(){this.ptNum=0,this.indexsArr.forEach(o=>o.length=0),this.bitmaps.length=0}addHighLightPt(o,t,e){let{block:r,index:i,type:n}=this.getInfo(o);return r.addHighLightPt(n,i,t,e),this.scene.needRender=!0,r.getPt(n,i)}removeHighLightPt(o,t,e){let{block:r,index:i,type:n}=this.getInfo(o),s=0;if(t||t==0)s=r.removeHighLightPt(n,i,t,e);else{let a=r.getHighLightInfo(n,i);s=r.removeHighLightPtAll(n,i,a,e)}return this.scene.needRender=!0,{pt:r.getPt(n,i),num:s}}setHighLightPtNum(o,t,e,r){let{block:i,index:n,type:s}=this.getInfo(o);i.setHighLightPtNum(s,n,t,e,r);let a=i.getPt(s,n);return this.scene.needRender=!0,a}getPt(o){let{block:t,index:e,type:r}=this.getInfo(o);return t.getPt(r,e)}setPtVisible(o,t){let{block:e,index:r,type:i}=this.getInfo(o),{ptData:n,isUpdate:s}=e.setPtVisible(i,r,t);return s&&(this.scene.needRender=!0),{ptData:n,isUpdate:s}}getPtNum(){return this.ptNum}};function HZ(){return new Zbe(()=>new NO(Float32Array),-10,5,()=>new NO(Int32Array))}var Xrt=class Pwe extends bwe{constructor(t,e){super(),this.plane=e,this.ptNums=new Array(69).fill(0),this.stringMaxPxLength=Number.NEGATIVE_INFINITY,this.grids=[],this.levelsArr=new Array(69).fill(0).map(()=>[]),this.xsArr=new Array(69).fill(0).map(()=>[]),this.ysArr=new Array(69).fill(0).map(()=>[]),this.scene=t,t.getUseGridAccelerate()||(this.block=HZ()),this.MIN_WH=this.scene.getMinWh()}getInfo(t){let e=Pwe.getTypeById(t),r=this.getIndexsArrIndex(t),i=this.levelsArr[e][r];if(i===-1)return{block:this.block,type:e,ptId:r,level:i,index:this.indexsArr[e][r]};let n=this.xsArr[e][r],s=this.ysArr[e][r];return{block:this.grids[i].get(n).get(s),type:e,ptId:r,level:i,x:n,y:s,index:this.indexsArr[e][r]}}clear(){this.clearArrData(),this.levelsArr.forEach(t=>t.length=0),this.xsArr.forEach(t=>t.length=0),this.ysArr.forEach(t=>t.length=0),this.ptNums.fill(0),this.stringMaxPxLength=Number.NEGATIVE_INFINITY,this.grids.length=0}calGrid(t,e,r=this.plane.getPtBBox(t,0,e)){let i,n,s,a=-1,l=this.MIN_WH;if(!this.scene.getUseGridAccelerate())i=this.block;else{let h=r.width(),u=r.height();if(a=Math.floor(Math.log2(Math.max(h,u)/l)),a<0)a=0;else{let g=l*2**a;(h>g&&Math.floor(r.minX/g+.5)!==Math.floor(r.maxX/g-.5)||u>g&&Math.floor(r.minY/g+.5)!==Math.floor(r.maxY/g-.5))&&a++}let d=r.center(),p=l*2**a;n=Math.floor(d.x/p),s=Math.floor(d.y/p);let m=this.grids[a];if(m){let g=m.get(n);g?(i=g.get(s),i||(i=HZ(),g.set(s,i))):(g=new Map,m.set(n,g),i=HZ(),g.set(s,i))}else{this.grids[a]=m=new Map;let g=new Map;m.set(n,g),i=HZ(),g.set(s,i)}}let c=Ur.getType(t[0]);return{block:i,type:c,x:n,y:s,level:a}}addPt(t,e,r,i,n=this.calGrid(t,e,i)){let{type:s,block:a,level:l,x:c,y:h}=n,u=a.addPt(s,t,Ur.getPtLengthByType(s));if(r===void 0){let d=this.getIndex(s);r=(d<<ak)+s;let p=s;this.indexsArr[p][d]=u,this.levelsArr[p][d]=l,this.xsArr[p][d]=c,this.ysArr[p][d]=h,this.ptNum++,this.ptNums[s]++,this.stringMaxPxLength<a.getStringMaxPxLength()&&(this.stringMaxPxLength=a.getStringMaxPxLength())}else{let d=this.getIndexsArrIndex(r),p=s;this.indexsArr[p][d]=u,this.levelsArr[p][d]=l,this.xsArr[p][d]=c,this.ysArr[p][d]=h}return this.scene.needRender=!0,r}removePt(t){let e=!1,{block:r,index:i,type:n,ptId:s}=this.getInfo(t),a=r.getPt(n,i),l=r.getHighLightInfo(n,i);l.length&&(e=!0,r.removeHighLightPtAll(n,i,l)),r.removePt(n,i);let c=n;return delete this.indexsArr[c][s],delete this.levelsArr[c][s],delete this.xsArr[c][s],delete this.ysArr[c][s],this.bitmaps[n].markRemove(s),this.ptNum--,this.ptNums[n]--,this.scene.needRender=!0,{oldPt:a,isHighLightPt:e}}updatePt(t,e,r){let i=!1,{block:n,index:s,type:a}=this.getInfo(t),l=n.getPt(a,s),c=this.calGrid(e,r),h=n.getHighLightInfo(a,s);if(n===c.block&&a===c.type)a!==8&&a!==9&&n.updatePt(a,s,e),h.length&&(i=!0);else if(h.length&&(n.removeHighLightPtAll(a,s,h),i=!0),n.removePt(a,s),this.addPt(e,r,t,void 0,c),h.length){let{block:u,index:d}=this.getInfo(t);u.addHighLightPtAll(a,d,h)}return this.stringMaxPxLength<n.getStringMaxPxLength()&&(this.stringMaxPxLength=n.getStringMaxPxLength()),this.scene.needRender=!0,{oldPt:l,isHighLightPt:i}}getBlocks(t,e,r,i,n,s){let a=[],l=e.getPxLength();if(!n&&!s&&(!r||l>this.stringMaxPxLength)&&(!i||this.ptNums[5]===0))return a;if(!this.scene.getUseGridAccelerate())return a.push(this.block),a;let c=e.getBBox2().transform4(t.getInverseMatrix());return this.grids.forEach((h,u)=>{let d=this.MIN_WH*2**u,p=Math.floor(c.minX/d-.5),m=Math.floor(c.maxX/d+.5),g=Math.floor(c.minY/d-.5),y=Math.floor(c.maxY/d+.5);h.forEach((b,P)=>{P<p||P>m||b.forEach((T,I)=>{I<g||I>y||a.push(T)})})}),a}},Twe=(o=>(o[o.ID=0]="ID",o[o.POSITION_X=1]="POSITION_X",o[o.POSITION_Y=2]="POSITION_Y",o[o.IS_TRIANGLE=3]="IS_TRIANGLE",o[o.SIZE=4]="SIZE",o[o.ORDER=5]="ORDER",o[o.COLOR_INDEX=6]="COLOR_INDEX",o[o.GROUP_ID=7]="GROUP_ID",o[o.TEMPLATE_ID=8]="TEMPLATE_ID",o))(Twe||{}),qrt=8,AO=[],$rt=class extends f0{create(o,t,e,r,i,n,s=-1){return AO[0]=o+(5<<fa)+Is,AO[1]=t.x,AO[2]=t.y,AO[3]=r?1.5:1,AO[4]=e,AO[5]=n||0,AO[6]=i||0,AO[7]=s,AO}getBBox(o,t){let e=o[t+1],r=o[t+2];return ul.modify(e,e,r,r)}},Jbe=new $rt(5,qrt,Twe),Qbe=(o=>(o[o.ID=0]="ID",o[o.START_X=1]="START_X",o[o.START_Y=2]="START_Y",o[o.END_X=3]="END_X",o[o.END_Y=4]="END_Y",o[o.LEN_ADD_GAP=5]="LEN_ADD_GAP",o[o.LEN=6]="LEN",o[o.ORDER=7]="ORDER",o[o.COLOR_INDEX=8]="COLOR_INDEX",o[o.GROUP_ID=9]="GROUP_ID",o[o.TEMPLATE_ID=10]="TEMPLATE_ID",o))(Qbe||{}),Iwe=10,A2=[],Cwe=class extends f0{create(o,t,e,r,i,n,s,a,l=-1){return A2[0]=o+(3<<fa)+Is,A2[1]=t.x,A2[2]=t.y,A2[3]=e.x,A2[4]=e.y,A2[5]=r?1:i+n,A2[6]=r?1:i,A2[7]=s||0,A2[8]=a||0,A2[9]=l,A2}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=Math.max(e,i),a=Math.min(e,i),l=Math.max(r,n),c=Math.min(r,n);return ul.modify(a,s,c,l)}},Krt=class extends Cwe{create(o,t,e,r,i,n,s,a,l=-1,c=-1){return super.create(o,t,e,r,i,n,s,a,l),A2[0]=o+(54<<fa)+Is,A2[10]=c,A2}},e2e=new Cwe(3,Iwe,Qbe),Zrt=new Krt(54,Iwe+1,Qbe),zJ=1e-9,xJ=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.WIDTH=4]="WIDTH",o[o.START_ANGLE=5]="START_ANGLE",o[o.SWEEP_ANGLE=6]="SWEEP_ANGLE",o[o.ORDER=7]="ORDER",o[o.COLOR_INDEX=8]="COLOR_INDEX",o[o.GROUP_ID=9]="GROUP_ID",o[o.DASH_ARR_INDEX=10]="DASH_ARR_INDEX",o[o.LINE_CAP=11]="LINE_CAP",o))(xJ||{}),Uxe=10,Jrt=12,Ig=[],t2e=class extends f0{create(o,t,e,r,i,n,s,a,l=-1){return Ig[0]=o+(1<<fa)+Is,Ig[1]=t.x,Ig[2]=t.y,Ig[3]=e,Ig[4]=r,Ig[5]=i,Ig[6]=n,Ig[7]=s||0,Ig[8]=a||0,Ig[9]=l,Ig}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=o[t+5],a=s+o[t+6],{x:l,y:c}=Hl(1,0,s),{x:h,y:u}=Hl(1,0,a),d=Math.min(l,h),p=Math.max(l,h),m=Math.min(c,u),g=Math.max(c,u),y=n/2;for(let b=Math.ceil(s/(Math.PI/2))*(Math.PI/2);b<a;b+=Math.PI/2){let{x:P,y:T}=Hl(1,0,b);d=Math.min(P,d),p=Math.max(P,p),m=Math.min(T,m),g=Math.max(T,g)}return ul.modify(d*i+e-y,p*i+e+y,m*i+r-y,g*i+r+y)}},Qrt=class extends t2e{create(o,t,e,r,i,n,s,a,l=-1,c=-1,h="round"){return super.create(o,t,e,r,i,n,s,a,l),Ig[10]=c,Ig[11]=sk[h],Ig}},eit=class extends t2e{create(o,t,e,r,i,n,s,a,l=-1){return super.create(o,t,e,r,i,n,s,a,l),Ig}},tit=class extends t2e{create(o,t,e,r,i,n,s,a,l=-1,c=-1){return super.create(o,t,e,r,i,n,s,a,l),Ig[0]=o+(52<<fa)+Is,Ig[10]=c,Ig}},Swe,r2e,Ewe;NL(()=>Swe=new Qrt(1,Jrt,xJ),()=>{r2e=new eit(1,Uxe,xJ),Ewe=new tit(52,Uxe+1,xJ)});var i2e=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.COLOR_INDEX1=4]="COLOR_INDEX1",o[o.COLOR_INDEX2=5]="COLOR_INDEX2",o[o.ORDER=6]="ORDER",o[o.GROUP_ID=7]="GROUP_ID",o[o.TEMPLATE_ID=8]="TEMPLATE_ID",o))(i2e||{}),Owe=8,bI=[],Awe=class extends f0{create(o,t,e,r,i,n,s=-1){return bI[0]=o+(4<<fa)+Is,bI[1]=t.x,bI[2]=t.y,bI[3]=e,bI[4]=r,bI[5]=i,bI[6]=n||0,bI[7]=s,bI}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3];return ul.modify(e-i,e+i,r-i,r+i)}},rit=class extends Awe{create(o,t,e,r,i,n,s,a){return super.create(o,t,e,r,i,n,s),bI[0]=o+(55<<fa)+Is,bI[8]=a,bI}},n2e=new Awe(4,Owe,i2e),iit=new rit(55,Owe+1,i2e),Hxe=10,nit=11,RJ=(o=>(o[o.ID=0]="ID",o[o.LEFT_POINT_X=1]="LEFT_POINT_X",o[o.LEFT_POINT_Y=2]="LEFT_POINT_Y",o[o.WIDTH=3]="WIDTH",o[o.HEIGHT=4]="HEIGHT",o[o.ANGLE=5]="ANGLE",o[o.RADIUS=6]="RADIUS",o[o.ORDER=7]="ORDER",o[o.COLOR_INDEX=8]="COLOR_INDEX",o[o.GROUP_ID=9]="GROUP_ID",o[o.TEMPLATE_ID=10]="TEMPLATE_ID",o))(RJ||{}),Sy=[],o2e=class extends f0{create(o,t,e,r,i,n,s,a,l=-1){return Sy[0]=o+(2<<fa)+Is,Sy[1]=t.x,Sy[2]=t.y,Sy[3]=e,Sy[4]=r,Sy[5]=i,Sy[6]=n,Sy[7]=s||0,Sy[8]=a||0,Sy[9]=l,Sy}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=o[t+5];if(s===0)return ul.modify(e,e+i,r-n,r);let a=o[t+6],l=Hl(a,-a,s),c=Hl(a,a-n,s),h=Hl(i-a,-a,s),u=Hl(i-a,a-n,s),d={x:e+l.x,y:r+l.y},p={x:e+c.x,y:r+c.y},m={x:e+h.x,y:r+h.y},g={x:e+u.x,y:r+u.y};return ul.modify(Math.min(d.x,p.x,m.x,g.x)-a,Math.max(d.x,p.x,m.x,g.x)+a,Math.min(d.y,p.y,m.y,g.y)-a,Math.max(d.y,p.y,m.y,g.y)+a)}},oit=class extends o2e{create(o,t,e,r,i,n,s,a,l=-1,c=1){return super.create(o,t,e,r,i,n,s,a,l),Sy[10]=c,Sy}},sit=class extends o2e{create(o,t,e,r,i,n,s,a,l=-1){return super.create(o,t,e,r,i,n,s,a,l)}},ait=class extends o2e{create(o,t,e,r,i,n,s,a,l=-1,c=-1){return super.create(o,t,e,r,i,n,s,a,l),Sy[0]=o+(53<<fa)+Is,Sy[10]=c,Sy}},_we,s2e,vwe;NL(()=>_we=new oit(2,nit,RJ),()=>{s2e=new sit(2,Hxe,RJ),vwe=new ait(53,Hxe+1,RJ)});var a2e=(o=>(o[o.ID=0]="ID",o[o.POINT1_X=1]="POINT1_X",o[o.POINT1_Y=2]="POINT1_Y",o[o.POINT2_X=3]="POINT2_X",o[o.POINT2_Y=4]="POINT2_Y",o[o.POINT3_X=5]="POINT3_X",o[o.POINT3_Y=6]="POINT3_Y",o[o.GROUP_ID=7]="GROUP_ID",o[o.FillStyle=8]="FillStyle",o))(a2e||{}),xwe=9,gI=[],Rwe=class extends _W{create(o,t,e,r,i,n=1){return gI[0]=o+(8<<fa)+Is,gI[1]=t.x,gI[2]=t.y,gI[3]=e.x,gI[4]=e.y,gI[5]=r.x,gI[6]=r.y,gI[7]=i,gI[8]=n,gI}getBBox(o,t,e){let r=o[t+1],i=o[t+2],n=o[t+3],s=o[t+4],a=o[t+5],l=o[t+6],c=o[t+7]*Ld,h=e.get(c),u=e.get(c+1),d=e.get(c+2),p=e.get(c+3),m=e.get(c+4),g=e.get(c+5),y=r*h+i*d+m,b=r*u+i*p+g,P=n*h+s*d+m,T=n*u+s*p+g,I=a*h+l*d+m,C=a*u+l*p+g;return ul.modify(Math.min(y,P,I),Math.max(y,P,I),Math.min(b,T,C),Math.max(b,T,C))}},lit=class extends Rwe{create(o,t,e,r,i,n){return super.create(o,t,e,r,i,n),gI[0]=o+(58<<fa)+Is,gI}},vW=new Rwe(8,xwe,a2e),cit=new lit(58,xwe,a2e),Dv=class{static regular(o){return Math.round(o*this.precision)/this.precision}static eq(o,t){return Math.abs(o-t)<=this.eps}static neq(o,t){return Math.abs(o-t)>this.eps}static less(o,t){return o-t<-this.eps}static lesseq(o,t){return o-t<this.eps}static greater(o,t){return o-t>this.eps}static greatereq(o,t){return o-t>-this.eps}static sqrt(o){return Math.abs(o)<=1e-10?0:Math.sqrt(o)}static sortAsc(o,t){return o-t}static sortDesc(o,t){return t-o}};Dv.eps=1e-8,Dv.precision=1e8;var vL=class Dwe{constructor(t,e,r,i,n,s,a=0,l=ee.WHITE,c=0,h){this.isMirroredX=1,this.valid=!1,this.scene=h,this.create(t,e,r,i,n,s,a,l,c)}static build(t,e){return new Dwe(t,e.UL(),e.LL(),e.UR(),e.LR(),1,0,ee.WHITE,0)}create(t,e,r,i,n,s,a=0,l=ee.WHITE,c=0){t===null?this.image=null:t&&(this.image=t,t instanceof Promise&&t.then(p=>{this.image=p,this.scene&&(this.scene.needRender=!0)}));let h=[e,i,n,r].map((p,m,g)=>p.angle(g[m===0?g.length-1:m-1])),u,d=h[h.length-1];h.forEach((p,m)=>{let g=(p+pa-d)%pa;if(Dv.eq(g,II)){if(m===0)u=!0;else if(u!==!0)throw new Error("not support")}else if(Dv.eq(g,II*3)){if(m===0)u=!1;else if(u!==!1)throw new Error("not support")}else throw new Error("not support");d=p}),this.width=e.distance1(i),this.height=e.distance1(r),u?(this.isMirroredX=-1,this.angle=-(h[1]-Math.PI)):(this.isMirroredX=1,this.angle=-h[1]),this.valid=!0,this.luPoint=e,this.ldPoint=r,this.ruPoint=i,this.rdPoint=n,this.order=a,this.alpha=s,this.shadowColor=l,this.shadowBlur=c}getBBox(){let t=Math.min(this.luPoint.x,this.ldPoint.x,this.ruPoint.x,this.rdPoint.x),e=Math.max(this.luPoint.x,this.ldPoint.x,this.ruPoint.x,this.rdPoint.x),r=Math.min(this.luPoint.y,this.ldPoint.y,this.ruPoint.y,this.rdPoint.y),i=Math.max(this.luPoint.y,this.ldPoint.y,this.ruPoint.y,this.rdPoint.y);return ul.modify(t,e,r,i)}sycnStatus(t,e,r,i,n,s=1,a=0,l,c){return this.create(t,e,r,i,n,s,a,l,c),this}getOrder(){return this.order}render(t,e,r){if(!this.valid||!this.image||this.image instanceof Promise)return;let i=t.getRenderMatrix(),n=t.getScale()*t.getSampling(),s=this.luPoint.multiply4(r.multiply4(i)),a=i.data[10]<0?-1:1;a*=this.isMirroredX;let l=Math.round(s.x+this.width*n)-Math.round(s.x),c=Math.round(s.y+this.height*n)-Math.round(s.y);e.save(),e.setTranslate(Math.round(s.x),Math.round(s.y)),e.setRotate(this.angle),e.setScale(a,1),e.setGlobalAlpha(this.alpha),this.shadowBlur>0&&(e.setShadowBlur(this.shadowBlur),e.setShadowColor(this.shadowColor.toCSS())),e.getContext().drawImage(this.image,0,0,l,c),e.restore()}},DJ=class YP{static toDegrees(t){return t*180/Math.PI}static toRadians(t){return t/180*Math.PI}static regularD(t){return t=t%360,t=t<0?360+t:t,t===360?0:t}static regular(t){return t=t%YP.PIx2,t=t<0?YP.PIx2+t:t,t===YP.PIx2?0:t}static toQuarterBase(t){return YP.regular((t+YP.PI_4)/YP.PI_2*YP.PI_2)}static toQuarterBaseD(t){return YP.regularD(((t+45)/90|0)*90)}static transformD(t,e){return YP.toDegrees(YP.transform(YP.toRadians(t),e))}static transform(t,e){let r=Math.cos(t),i=Math.sin(t),n=new S(e.data[6],e.data[7]),s=new S(r,i).multiply3(e);return YP.regular(s.angle(n))}};DJ.PIx2=Math.PI*2,DJ.PI_2=Math.PI/2,DJ.PI_4=Math.PI/4;var qh=DJ,l2e=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.START_ANGLE=4]="START_ANGLE",o[o.SWEEP_ANGLE=5]="SWEEP_ANGLE",o[o.START_X=6]="START_X",o[o.START_Y=7]="START_Y",o[o.END_X=8]="END_X",o[o.END_Y=9]="END_Y",o[o.GROUP_ID=10]="GROUP_ID",o[o.FillStyle=11]="FillStyle",o))(l2e||{}),wwe=12,Nb=[],Lwe=class extends _W{create(o,t,e,r,i,n,s,a,l=1){return Nb[0]=o+(9<<fa)+Is,Nb[1]=t.x,Nb[2]=t.y,Nb[3]=e,Nb[4]=r,Nb[5]=i,Nb[6]=n.x,Nb[7]=n.y,Nb[8]=s.x,Nb[9]=s.y,Nb[10]=a,Nb[11]=l,Nb}getBBox(o,t,e){let r=o[t+1],i=o[t+2],n=o[t+3],s=o[t+4],a=s+o[t+5],l=o[t+10]*Ld,c=new _e;function h(d){let{x:p,y:m}=Hl(n,0,d);p+=r,m+=i,c.ext6(p*e.get(l)+m*e.get(l+2)+e.get(l+4),p*e.get(l+1)+m*e.get(l+3)+e.get(l+5))}if(h(s),h(a),s<a)for(let d=Math.ceil(s/(Math.PI/2))*(Math.PI/2);d<a;d+=Math.PI/2)h(d);else for(let d=Math.floor(s/(Math.PI/2))*(Math.PI/2);d>a;d-=Math.PI/2)h(d);let u=c.build1();return ul.modify(u.minX,u.maxX,u.minY,u.maxY)}},hit=class extends Lwe{create(o,t,e,r,i,n,s,a,l){return super.create(o,t,e,r,i,n,s,a,l),Nb[0]=o+(59<<fa)+Is,Nb}},xW=new Lwe(9,wwe,l2e),uit=new hit(59,wwe,l2e),c2e=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.START_ANGLE=4]="START_ANGLE",o[o.SWEEP_ANGLE=5]="SWEEP_ANGLE",o[o.ORDER=6]="ORDER",o[o.COLOR_INDEX=7]="COLOR_INDEX",o[o.GROUP_ID=8]="GROUP_ID",o[o.TEMPLATE_ID=9]="TEMPLATE_ID",o))(c2e||{}),Mwe=9,XP=[],Nwe=class extends f0{create(o,t,e,r,i,n,s,a=-1){return XP[0]=o+(12<<fa)+Is,XP[1]=t.x,XP[2]=t.y,XP[3]=e,XP[4]=r,XP[5]=i,XP[6]=n||0,XP[7]=s||0,XP[8]=a,XP}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=n+o[t+5],{x:a,y:l}=Hl(1,0,n),{x:c,y:h}=Hl(1,0,s),u=Math.min(a,c),d=Math.max(a,c),p=Math.min(l,h),m=Math.max(l,h);for(let g=Math.ceil(n/(Math.PI/2))*(Math.PI/2);g<s;g+=Math.PI/2){let{x:y,y:b}=Hl(1,0,g);u=Math.min(y,u),d=Math.max(y,d),p=Math.min(b,p),m=Math.max(b,m)}return ul.modify(u*i+e,d*i+e,p*i+r,m*i+r)}},dit=class extends Nwe{create(o,t,e,r,i,n,s,a=-1,l=-1){return super.create(o,t,e,r,i,n,s,a),XP[0]=o+(62<<fa)+Is,XP[9]=l,XP}},h2e=new Nwe(12,Mwe,c2e),pit=new dit(62,Mwe+1,c2e),u2e=(o=>(o[o.ID=0]="ID",o[o.START_X=1]="START_X",o[o.START_Y=2]="START_Y",o[o.END_X=3]="END_X",o[o.END_Y=4]="END_Y",o[o.ORDER=5]="ORDER",o[o.COLOR_INDEX=6]="COLOR_INDEX",o[o.GROUP_ID=7]="GROUP_ID",o[o.TEMPLATE_ID=8]="TEMPLATE_ID",o))(u2e||{}),kwe=8,PI=[],Bwe=class extends f0{create(o,t,e,r,i,n=-1){return PI[0]=o+(11<<fa)+Is,PI[1]=t.x,PI[2]=t.y,PI[3]=e.x,PI[4]=e.y,PI[5]=r||0,PI[6]=i||0,PI[7]=n,PI}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=Math.max(e,i),a=Math.min(e,i),l=Math.max(r,n),c=Math.min(r,n);return ul.modify(a,s,c,l)}},fit=class extends Bwe{create(o,t,e,r,i,n,s){return super.create(o,t,e,r,i,n),PI[0]=o+(61<<fa)+Is,PI[8]=s,PI}},mW=new Bwe(11,kwe,u2e),Wxe=new fit(61,kwe+1,u2e),d2e=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.START_ANGLE=4]="START_ANGLE",o[o.SWEEP_ANGLE=5]="SWEEP_ANGLE",o[o.GROUP_ID=6]="GROUP_ID",o))(d2e||{}),tE=[],Fwe=7,Vwe=class extends _W{create(o,t,e,r,i,n){return tE[0]=o+(14<<fa)+Is,tE[1]=t.x,tE[2]=t.y,tE[3]=e,tE[4]=r,tE[5]=i,tE[6]=n,tE}getBBox(o,t,e){let r=o[t+1],i=o[t+2],n=o[t+3],s=o[t+4],a=s+o[t+5],l=o[t+6]*Ld,c=new _e;function h(d){let{x:p,y:m}=Hl(n,0,d);p+=r,m+=i,c.ext6(p*e.get(l)+m*e.get(l+2)+e.get(l+4),p*e.get(l+1)+m*e.get(l+3)+e.get(l+5))}if(h(s),h(a),s<a)for(let d=Math.ceil(s/(Math.PI/2))*(Math.PI/2);d<a;d+=Math.PI/2)h(d);else for(let d=Math.floor(s/(Math.PI/2))*(Math.PI/2);d>a;d-=Math.PI/2)h(d);let u=c.build1();return ul.modify(u.minX,u.maxX,u.minY,u.maxY)}},mit=class extends Vwe{create(o,t,e,r,i,n){return super.create(o,t,e,r,i,n),tE[0]=o+(64<<fa)+Is,tE}},p2e=new Vwe(14,Fwe,d2e),git=new mit(64,Fwe,d2e),f2e=(o=>(o[o.ID=0]="ID",o[o.START_X=1]="START_X",o[o.START_Y=2]="START_Y",o[o.END_X=3]="END_X",o[o.END_Y=4]="END_Y",o[o.GROUP_ID=5]="GROUP_ID",o))(f2e||{}),Gwe=6,MO=[],Uwe=class extends _W{create(o,t,e,r){return MO[0]=o+(13<<fa)+Is,MO[1]=t.x,MO[2]=t.y,MO[3]=e.x,MO[4]=e.y,MO[5]=r,MO}getBBox(o,t,e){let r=o[t+1],i=o[t+2],n=o[t+3],s=o[t+4],a=o[t+5]*Ld,l=e.get(a),c=e.get(a+1),h=e.get(a+2),u=e.get(a+3),d=e.get(a+4),p=e.get(a+5),m=r*l+i*h+d,g=r*c+i*u+p,y=n*l+s*h+d,b=n*c+s*u+p;return ul.modify(Math.min(m,y),Math.max(m,y),Math.min(g,b),Math.max(g,b))}},yit=class extends Uwe{create(o,t,e,r){return super.create(o,t,e,r),MO[0]=o+(63<<fa)+Is,MO}},gW=new Uwe(13,Gwe,f2e),zxe=new yit(63,Gwe,f2e),Hwe=(o=>(o[o.ID=0]="ID",o[o.CenterX=1]="CenterX",o[o.CenterY=2]="CenterY",o[o.A=3]="A",o[o.B=4]="B",o[o.StartAngle=5]="StartAngle",o[o.EndAngle=6]="EndAngle",o[o.Rotation=7]="Rotation",o[o.Stroke=8]="Stroke",o[o.StrokeColorIndex=9]="StrokeColorIndex",o[o.DashArrayIndex=10]="DashArrayIndex",o[o.LineCapIndex=11]="LineCapIndex",o[o.FillColorIndex=12]="FillColorIndex",o[o.FillStyleIndex=13]="FillStyleIndex",o[o.ORDER=14]="ORDER",o[o.GROUP_ID=15]="GROUP_ID",o))(Hwe||{}),b1=[],bit=class extends f0{create(o,t,e,r,i,n,s,a,l=0,c=-1,h=1,u=0,d=1,p=0,m=-1){return b1[0]=o+(16<<fa)+Is,b1[1]=t.x,b1[2]=t.y,b1[3]=e,b1[4]=r,b1[5]=i,b1[6]=n,b1[7]=s,b1[8]=a,b1[9]=l,b1[10]=c,b1[11]=h,b1[12]=u,b1[13]=d,b1[14]=p,b1[15]=m,b1}getBBox(o,t){let e=new S(o[t+1],o[t+2]),r=o[t+3],i=o[t+4],n=o[t+5],s=o[t+6],a=o[t+7],l=o[t+8]/2,c=r+l,h=i+l,u=new S(c,0),d=new S(-c,0),p=new S(0,h),m=new S(0,-h),g=_(r,i,-n),y=_(r,i,-s),b=Oxe(qh.regular(n),3),P=Oxe(b,3);b==P&&b==0&&(s<n?b=qh.PIx2:P=qh.PIx2);let T=Math.PI,I=T/2,C=T*3/2,E=new _e;b==0?P==0?E.ext5(-l,l,-l,l):P<I?(E.ext2(u),E.ext2(y)):P<T?(E.ext2(u),E.ext2(m),E.ext2(y)):P<C?(E.ext2(u),E.ext2(m),E.ext2(d),E.ext2(y)):(E.ext2(u),E.ext2(m),E.ext2(d),E.ext2(p),E.ext2(y)):P==0?(E.ext2(g),E.ext2(m),E.ext2(d),E.ext2(p),E.ext2(u)):P<I?(E.ext2(g),E.ext2(y)):P<T?(E.ext2(g),E.ext2(m),E.ext2(y)):P<C?(E.ext2(g),E.ext2(m),E.ext2(d),E.ext2(y)):(E.ext2(g),E.ext2(m),E.ext2(d),E.ext2(p),E.ext2(y));let O=E.build().transform(Qe.rotate(-a).translate1(e));return ul.modify(O.minX,O.maxX,O.minY,O.maxY);function _(R,v,D){let w=R*Math.cos(D),F=v*Math.sin(D);return new S(w,F)}}},sQ=new bit(16,16,Hwe),Py=[],Wwe=(o=>(o[o.ID=0]="ID",o[o.EndPointX1=1]="EndPointX1",o[o.EndPointY1=2]="EndPointY1",o[o.EndPointX2=3]="EndPointX2",o[o.EndPointY2=4]="EndPointY2",o[o.ControlX1=5]="ControlX1",o[o.ControlY1=6]="ControlY1",o[o.ControlX2=7]="ControlX2",o[o.ControlY2=8]="ControlY2",o[o.Stroke=9]="Stroke",o[o.StrokeColorIndex=10]="StrokeColorIndex",o[o.DashArrayIndex=11]="DashArrayIndex",o[o.LineCapIndex=12]="LineCapIndex",o[o.ORDER=13]="ORDER",o[o.GROUP_ID=14]="GROUP_ID",o))(Wwe||{}),Pit=class extends f0{create(o,t,e,r,i,n,s=0,a=-1,l=1,c=0,h=-1){return Py[0]=o+(17<<fa)+Is,Py[1]=t.x,Py[2]=t.y,Py[3]=e.x,Py[4]=e.y,Py[5]=r.x,Py[6]=r.y,Py[7]=i.x,Py[8]=i.y,Py[9]=n,Py[10]=s,Py[11]=a,Py[12]=l,Py[13]=c,Py[14]=h,Py}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=o[t+5],a=o[t+6],l=o[t+7],c=o[t+8],h=o[t+9]/2,u=new Mr([new S(e,r),new S(s,a),new S(l,c),new S(i,n)]).bbox().extendOfSize(h);return ul.modify1(u)}},m2e=new Pit(17,15,Wwe);function LO(o){return o>>ek}function kL(o){return o&ek}function Md(o,t){var e;let r=!0,i=LO(o);return i!=0&&!((e=t[i])!=null&&e.alpha)&&(r=!1),r}function hk(o,t,e){return!RW(o,t,e)}function RW(o,t,e){let r=_h.getRenderMode(t,e),i;return r===0?i=o:r===1?i=!1:r===2&&(i=!0),i}function Sg(o){let{plane:t,highLightColorIndex:e}=o,r=!0,i=kL(e);return!t.isVisible()&&i&&(!t.scene.getForceVisibleHighLightPt()||t.ignoreForceHighLightEffect)&&(r=!1),r}function lye(o,t,e,r,i){r.push(o.x,o.y,t.x,t.y,e.x,e.y),i&&r.push(i.x,i.y)}function zwe(o,t,e,r,i,n,s,a,l,c,h,u,d=0){var p,m,g,y,b,P;let{trianglesArr:T,doubleRgbTrianglesArr:I,groupHighLightTrianglesArr:C,groupForceHighLightTrianglesArr:E}=c,O=[],_=[],R=[],v=_h.isDoubleRgb(i,l),D=_h.isForceHighLight(i,l);v?(O=(m=(p=I[a])==null?void 0:p[r])==null?void 0:m[s],O||(I[a]||(I[a]=[]),I[a][r]||(I[a][r]=[]),I[a][r][s]||(I[a][r][s]=O=[]))):D||(O=(y=(g=T[a])==null?void 0:g[r])==null?void 0:y[s],O||(T[a]||(T[a]=[]),T[a][r]||(T[a][r]=[]),T[a][r][s]||(T[a][r][s]=O=[]))),P1(h,D,d)&&lye(o,t,e,O,n);let w=u(i);w&&((d===0||!D)&&(_=C[w.highLightGroupId],_||(C[w.highLightGroupId]=_=[]),lye(o,t,e,_)),D&&(R=(P=(b=E[a])==null?void 0:b[r])==null?void 0:P[s],R||(E[a]||(E[a]=[]),E[a][r]||(E[a][r]=[]),E[a][r][s]||(E[a][r][s]=R=[])),lye(o,t,e,R,n)))}function cye(o,t,e,r,i,n){i.push(o.x,o.y,t,e,r),n&&i.push(n.x,n.y)}function Ywe(o,t,e,r,i,n,s,a,l,c,h,u,d,p=0){var m,g,y,b,P,T;let{circlesArr:I,doubleRgbCirclesArr:C,groupHighLightCirclesArr:E,groupForceHighLightCirclesArr:O}=h,_=[],R=[],v=[],D=_h.isDoubleRgb(n,c),w=_h.isForceHighLight(n,c);D?(_=(g=(m=C[l])==null?void 0:m[i])==null?void 0:g[s],_||(C[l]||(C[l]=[]),C[l][i]||(C[l][i]=[]),C[l][i][s]||(C[l][i][s]=_=[]))):w||(_=(b=(y=I[l])==null?void 0:y[i])==null?void 0:b[s],_||(I[l]||(I[l]=[]),I[l][i]||(I[l][i]=[]),I[l][i][s]||(I[l][i][s]=_=[])));let F=d(n);P1(u,w,p)&&cye(o,t,e,r,_,a),F&&((p===0||!w)&&(R=E[F.highLightGroupId],R||(E[F.highLightGroupId]=R=[]),cye(o,t,e,r,R)),w&&(v=(T=(P=O[l])==null?void 0:P[i])==null?void 0:T[s],v||(O[l]||(O[l]=[]),O[l][i]||(O[l][i]=[]),O[l][i][s]||(O[l][i][s]=v=[])),cye(o,t,e,r,v,a)))}var Tit=8,Iit=6,Cit=7,Sit=5;function g2e(o,t,e,r){return[o+e*Math.cos(r),t-e*Math.sin(r)]}function hye(o,t,e,r,i,n,s=!1,a,l=!1,c,h,u){var d,p;let m=t.getContext();for(let g=0;g<e;g++){let y=r[g],b=i[g],P=Math.max((y==null?void 0:y.length)||0,(b==null?void 0:b.length)||0);for(let T=1;T<P;T+=1){t.save();let I=1e9,C=1e9;m.beginPath();for(let E=0;E<((d=y==null?void 0:y[T])==null?void 0:d.length);E+=Tit){let O=y[T];m.moveTo(O[E],O[E+1]),m.lineTo(O[E+2],O[E+3]),m.lineTo(O[E+4],O[E+5]),I=Math.min(O[E+6],I),C=Math.min(O[E+7],C)}for(let E=0;E<((p=b==null?void 0:b[T])==null?void 0:p.length);E+=Cit){let O=b[T],_=O[E],R=O[E+1],v=O[E+2],D=O[E+3],w=O[E+4],F=O[E+5],H=O[E+6],[z,G]=g2e(_,R,v,D);m.moveTo(z,G),m.arc(_,R,v,-D,-(D+w),w>0),I=Math.min(F,I),C=Math.min(H,C)}m.closePath(),t.setTranslate(I,C),o.setFillStyle(t,T,g,s,a,l,c,!0,h,u),m.fill(),t.restore()}}}function Eit(o,t,e,r,i){let n=Math.max(r.length,i.length);for(let s=0;s<n;s++){let a;if(s==0)a=o;else if(s==1)a=t;else throw new Error("highLightGroupId is incorrect");let l=a.getContext();l.beginPath();let c=r[s];if(c)for(let u=0;u<c.length;u+=Iit)l.moveTo(c[u],c[u+1]),l.lineTo(c[u+2],c[u+3]),l.lineTo(c[u+4],c[u+5]);let h=i[s];if(h)for(let u=0;u<h.length;u+=Sit){let d=h[u],p=h[u+1],m=h[u+2],g=h[u+3],y=h[u+4],[b,P]=g2e(d,p,m,g);l.moveTo(b,P),l.arc(d,p,m,-g,-(g+y),y>0)}l.closePath(),l.fill()}}var Oit=3,Ait=5;function _it(o,t,e,r,i){var n,s,a,l;let c=o.getContext(),h=Math.max((e==null?void 0:e.length)||0,(r==null?void 0:r.length)||0);for(let u=0;u<h;u+=1){let d=u!==0,p=Math.max(((n=e[u])==null?void 0:n.length)||0,((s=r[u])==null?void 0:s.length)||0);for(let m=0;m<p;m++){o.save(),c.beginPath();let g=(a=e[u])==null?void 0:a[m],y=!1;if(g){y=!0;for(let P=0;P<g.length;P+=Oit){let T=g[P],I=g[P+1],C=g[P+2];c.moveTo(T.x,T.y),c.lineTo(I.x,I.y),c.lineTo(C.x,C.y)}}let b=(l=r[u])==null?void 0:l[m];if(b){y=!0;for(let P=0;P<b.length;P+=Ait){let T=b[P],I=b[P+1],C=b[P+2],E=b[P+3],O=b[P+4],[_,R]=g2e(T,I,C,E);c.moveTo(_,R),c.arc(T,I,C,-E,-(E+O),O>0)}}if(y){let P=d?void 0:m,T=d?m:void 0;i.highLightPtSetCustomizedColor(o,P,T,void 0,!0)}c.closePath(),c.fill(),o.restore()}}}function aQ(o,t){return new Ae([o.get(t),o.get(t+1),0,0,o.get(t+2),o.get(t+3),0,0,0,0,1,0,o.get(t+4),o.get(t+5),0,1])}function P1(o,t,e){return!o&&(!t||t&&e===0)}function vit(o,t,e,r){var i,n;let{plane:s,onlyRenderHighLightPt:a,globalHighLightType:l}=r,c=e.get(t+9),h=e.get(t+12),u=s.scene.colors;if(!Md(c,u)&&!Md(h,u))return;let d=jwe(e,t,r);P1(a,(i=d.highLightInfo)==null?void 0:i.isForceHighLight,l)&&tbe(o,d),(n=d.highLightInfo)!=null&&n.ctx&&tbe(d.highLightInfo.ctx,d,"groupId")}function jwe(o,t,e,r="none"){let{plane:i,scale:n,getHighLightDrawInfo:s,renderMatrix3:a,sampling:l}=e,c=o.get(t+3),h=o.get(t+4),u=o.get(t+5),d=o.get(t+6),p=o.get(t+7),m=o.get(t+8),g=o.get(t+9),y=o.get(t+10),b=o.get(t+11),P=o.get(t+12),T=o.get(t+13),I=o.get(t+15),C=i.getDashedArray(y,n,m),E=hQ[b],O=r==="select"?null:s(I),_=new S(o.get(t+1),o.get(t+2)).multiply3(a),R=c*n,v=h*n,D=i.getRenderLineWidth(l,m,n),w=!1,F=_h.isDoubleRgb(I,i.scene.ptGroup.getData()),H=i.getPtBBox(o.slice(t,t+sQ.length)).UL().multiply3(a);return{...e,center:_,a:R,b:v,startAngle:u,endAngle:d,rotation:p,stroke:D,strokeColorIndex:g,lineCap:E,fillColorIndex:P,fillStyleIndex:T,dashedArray:C,groupId:I,highLightInfo:O,anticlockwise:w,isDoubleRgb:F,leftUpPoint:H}}function tbe(o,t,e="none"){let{center:r,a:i,b:n,startAngle:s,endAngle:a,rotation:l,stroke:c,dashedArray:h,lineCap:u,strokeColorIndex:d,fillColorIndex:p,groupId:m,fillStyleIndex:g,highLightInfo:y,plane:b,anticlockwise:P,isDoubleRgb:T,samplingPxLength:I,leftUpPoint:C,camera:E,material:O,renderMode:_}=t;switch(o.save(),e){case"none":{b.ptSetCustomizedColor(o,E,d,O,_,m);break}case"groupId":{b.setGroupHighLightColor(o,E,d,y.isForceHighLight);break}}let R=o.getContext();o.setLineWidth(c),o.setLineDash(h),o.setLineCap(u),R.beginPath(),R.ellipse(r.x,r.y,i,n,-l,s,a,P),o.setTranslate(C.x,C.y),e==="none"&&(b.setFillStyle(o,g,p,T,I,void 0,E,!1,O,_),R.fill()),R.stroke(),o.restore()}function xit(o,t,e,r){if(!Sg(r))return;let i=jwe(e,t,r,"select");tbe(o,i,"select")}var Xwe=(o=>(o[o.ID=0]="ID",o[o.START_X=1]="START_X",o[o.START_Y=2]="START_Y",o[o.END_X=3]="END_X",o[o.END_Y=4]="END_Y",o[o.WIDTH=5]="WIDTH",o[o.ORDER=6]="ORDER",o[o.COLOR_INDEX=7]="COLOR_INDEX",o[o.GROUP_ID=8]="GROUP_ID",o[o.LINE_CAP=9]="LINE_CAP",o[o.DASH_ARR_INDEX=10]="DASH_ARR_INDEX",o[o.SHADOW_COLOR_INDEX=11]="SHADOW_COLOR_INDEX",o[o.SHADOW_BLUR=12]="SHADOW_BLUR",o[o.SHADOW_OFFSET_X=13]="SHADOW_OFFSET_X",o[o.SHADOW_OFFSET_Y=14]="SHADOW_OFFSET_Y",o[o.TEMPLATE_ID=15]="TEMPLATE_ID",o))(Xwe||{}),rbe=(o=>(o[o.ID=0]="ID",o[o.START_X=1]="START_X",o[o.START_Y=2]="START_Y",o[o.END_X=3]="END_X",o[o.END_Y=4]="END_Y",o[o.WIDTH=5]="WIDTH",o[o.ORDER=6]="ORDER",o[o.COLOR_INDEX=7]="COLOR_INDEX",o[o.GROUP_ID=8]="GROUP_ID",o[o.LINE_CAP=9]="LINE_CAP",o[o.TEMPLATE_ID=10]="TEMPLATE_ID",o))(rbe||{}),Rit=15,Yxe=10,rm=[],y2e=class extends f0{create(o,t,e,r,i="round",n,s,a=-1){return rm[0]=o+(15<<fa)+Is,rm[1]=t.x,rm[2]=t.y,rm[3]=e.x,rm[4]=e.y,rm[5]=r,rm[6]=n||0,rm[7]=s||0,rm[8]=a,rm[9]=sk[i],rm}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=o[t+5],a=Math.max(e,i),l=Math.min(e,i),c=Math.max(r,n),h=Math.min(r,n),u=s/2;return ul.modify(l-u,a+u,h-u,c+u)}},Dit=class extends y2e{create(o,t,e,r,i="round",n,s,a=-1,l=-1,c,h,u,d){return super.create(o,t,e,r,i,n,s,a),rm[10]=l,rm[11]=c||0,rm[12]=h||0,rm[13]=u||0,rm[14]=d||0,rm}},wit=class extends y2e{create(o,t,e,r,i="round",n,s,a=-1){return super.create(o,t,e,r,i,n,s,a)}},Lit=class extends y2e{create(o,t,e,r,i="round",n,s,a=-1,l=-1){return super.create(o,t,e,r,i,n,s,a),rm[0]=o+(65<<fa)+Is,rm[10]=l,rm}},qwe,b2e,$we;NL(()=>qwe=new Dit(15,Rit,Xwe),()=>{b2e=new wit(15,Yxe,rbe),$we=new Lit(65,Yxe+1,rbe)});function Mit(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=Kwe(e,t,r);l&&(P1(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&ibe(o,l),(n=l.highLightInfo)!=null&&n.ctx&&ibe(l.highLightInfo.ctx,l,"groupId"))}function Kwe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,scale:a,sampling:l}=e,c=o.get(t+8),h=i.getPtColorIndex(o.get(t+7),c);if(r!=="select"&&!Md(h,i.scene.colors))return;let u=e.highLightColorIndex,d=r==="select"?null:n(c),p=new S(o.get(t+1),o.get(t+2)).multiply4(s),m=new S(o.get(t+3),o.get(t+4)).multiply4(s),g=o.get(t+5),y=i.getRenderLineWidth(l,g,a),b=o.get(t+9),P=o.get(t+10),T=i.getDashedArray(P,a,g),I=o.get(t+12),C=o.get(t+11),E=o.get(t+13),O=o.get(t+14);return{...e,highLightInfo:d,colorIndex:h,groupIdIndex:c,dashedArray:T,lineWidth:y,start:p,end:m,lineCap:b,highLightColorIndex:u,shadowBlur:I,shadowColorIndex:C,shadowOffsetX:E,shadowOffsetY:O}}function ibe(o,t,e="none"){let{highLightInfo:r,bNeedFill:i,colorIndex:n,groupIdIndex:s,dashedArray:a,lineWidth:l,start:c,end:h,lineCap:u,plane:d,highLightColorIndex:p,shadowBlur:m,shadowColorIndex:g,shadowOffsetX:y,shadowOffsetY:b,camera:P,groupIdBuilder:T,material:I,renderMode:C}=t,E=RW(i,s,T);switch(o.save(),e){case"none":{d.ptSetCustomizedColor(o,P,n,I,C,s);break}case"groupId":{d.setGroupHighLightColor(o,P,n,r.isForceHighLight);break}case"select":{d.highLightPtSetCustomizedColor(o,p,n);break}}d.setRenderShadowInfo(o,m,g,y,b);let O=o.getContext();if(o.setLineDash(a),E)O.beginPath(),o.setLineWidth(l),O.moveTo(c.x,c.y),O.lineTo(h.x,h.y),o.setLineCap(hQ[u]),O.stroke();else{o.setLineWidth(1);let _=h.sub(c).normalize();O.moveTo(c.x,c.y),O.beginPath(),O.arc(c.x,c.y,l/2,0,Math.PI*2),O.closePath(),O.stroke(),O.moveTo(h.x,h.y),O.beginPath(),O.arc(h.x,h.y,l/2,0,Math.PI*2),O.closePath(),O.stroke();let R=c.add(_.mul(l/2)).rotateD(c,90),v=h.add(_.mul(l/2)).rotateD(h,90),D=c.add(_.mul(l/2)).rotateD(c,-90),w=h.add(_.mul(l/2)).rotateD(h,-90);O.beginPath(),O.moveTo(R.x,R.y),O.lineTo(v.x,v.y),O.stroke(),O.moveTo(D.x,D.y),O.lineTo(w.x,w.y),O.closePath(),O.stroke()}o.restore()}function Nit(o,t,e,r){if(!Sg(r))return;let i=Kwe(e,t,r,"select");ibe(o,i,"select")}var Zwe=(o=>(o[o.ID=0]="ID",o[o.POINT1_X=1]="POINT1_X",o[o.POINT1_Y=2]="POINT1_Y",o[o.POINT2_X=3]="POINT2_X",o[o.POINT2_Y=4]="POINT2_Y",o[o.POINT3_X=5]="POINT3_X",o[o.POINT3_Y=6]="POINT3_Y",o[o.ORDER=7]="ORDER",o[o.COLOR_INDEX=8]="COLOR_INDEX",o[o.GROUP_ID=9]="GROUP_ID",o[o.FILL_STYLE=10]="FILL_STYLE",o))(Zwe||{}),jxe=10,kit=11,Ey=[],wJ=(o=>(o[o.ID=0]="ID",o[o.POINT1_X=1]="POINT1_X",o[o.POINT1_Y=2]="POINT1_Y",o[o.POINT2_X=3]="POINT2_X",o[o.POINT2_Y=4]="POINT2_Y",o[o.POINT3_X=5]="POINT3_X",o[o.POINT3_Y=6]="POINT3_Y",o[o.ORDER=7]="ORDER",o[o.COLOR_INDEX=8]="COLOR_INDEX",o[o.GROUP_ID=9]="GROUP_ID",o[o.TEMPLATE_ID=10]="TEMPLATE_ID",o))(wJ||{}),P2e=class extends f0{create(o,t,e,r,i,n,s=-1){return Ey[0]=o+(6<<fa)+Is,Ey[1]=t.x,Ey[2]=t.y,Ey[3]=e.x,Ey[4]=e.y,Ey[5]=r.x,Ey[6]=r.y,Ey[7]=i||0,Ey[8]=n||0,Ey[9]=s,Ey}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=o[t+5],a=o[t+6];return ul.modify(Math.min(e,i,s),Math.max(e,i,s),Math.min(r,n,a),Math.max(r,n,a))}},Bit=class extends P2e{create(o,t,e,r,i,n,s=-1,a=1){return super.create(o,t,e,r,i,n,s),Ey[10]=a,Ey}},Fit=class extends P2e{create(o,t,e,r,i,n,s=-1){return super.create(o,t,e,r,i,n,s)}},Vit=class extends P2e{create(o,t,e,r,i,n,s=-1,a=-1){return super.create(o,t,e,r,i,n,s),Ey[0]=o+(56<<fa)+Is,Ey[10]=a,Ey}},T2e,I2e,Jwe;NL(()=>(T2e=new Bit(6,kit,Zwe),wJ),()=>{I2e=new Fit(6,jxe,wJ),Jwe=new Vit(56,jxe+1,wJ)});function Git(o,t,e){let{plane:r,triangleContainerArr:i,getHighLightDrawInfo:n,renderMatrix:s,onlyRenderHighLightPt:a,groupIdBuilder:l,bNeedFill:c}=e,h=t.get(o+9),u=r.getPtColorIndex(t.get(o+8),h),d=r.scene.colors;if(!Md(u,d)||hk(c,h,l))return;let p=t.get(o+7),m=r.getPtBBox(t.slice(o,o+T2e.length),0,null).UL().multiply4(s),g=t.get(o+10),y=new S(t.get(o+1),t.get(o+2)).multiply4(s),b=new S(t.get(o+3),t.get(o+4)).multiply4(s),P=new S(t.get(o+5),t.get(o+6)).multiply4(s);zwe(y,b,P,u,h,m,g,p,r.scene.ptGroup.getData(),i,a,n,r.getSceneGlobalHighLightType())}function Uit(o,t,e){var r;if(!Sg(e))return;let{plane:i,trianglesArr:n,renderMatrix:s,highLightColorIndex:a}=e,l=kL(a),c=a;l&&(c=i.getPtColorIndex(t.get(o+8),t.get(o+9)));let h=(r=n[l])==null?void 0:r[c];n[l]||(n[l]=[]),h||(n[l][c]=h=[]),h.push(new S(t.get(o+1),t.get(o+2)).multiply4(s),new S(t.get(o+3),t.get(o+4)).multiply4(s),new S(t.get(o+5),t.get(o+6)).multiply4(s))}var Qwe=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.START_ANGLE=4]="START_ANGLE",o[o.SWEEP_ANGLE=5]="SWEEP_ANGLE",o[o.START_X=6]="START_X",o[o.START_Y=7]="START_Y",o[o.END_X=8]="END_X",o[o.END_Y=9]="END_Y",o[o.ORDER=10]="ORDER",o[o.COLOR_INDEX=11]="COLOR_INDEX",o[o.GROUP_ID=12]="GROUP_ID",o[o.FillStyle=13]="FillStyle",o))(Qwe||{}),nbe=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.START_ANGLE=4]="START_ANGLE",o[o.SWEEP_ANGLE=5]="SWEEP_ANGLE",o[o.START_X=6]="START_X",o[o.START_Y=7]="START_Y",o[o.END_X=8]="END_X",o[o.END_Y=9]="END_Y",o[o.ORDER=10]="ORDER",o[o.COLOR_INDEX=11]="COLOR_INDEX",o[o.GROUP_ID=12]="GROUP_ID",o[o.TEMPLATE_ID=13]="TEMPLATE_ID",o))(nbe||{}),Xxe=13,Hit=14,tm=[],C2e=class extends f0{create(o,t,e,r,i,n,s,a,l,c=-1){return tm[0]=o+(7<<fa)+Is,tm[1]=t.x,tm[2]=t.y,tm[3]=e,tm[4]=r,tm[5]=i,tm[6]=n.x,tm[7]=n.y,tm[8]=s.x,tm[9]=s.y,tm[10]=a||0,tm[11]=l||0,tm[12]=c,tm}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=n+o[t+5],{x:a,y:l}=Hl(1,0,n),{x:c,y:h}=Hl(1,0,s),u=Math.min(a,c),d=Math.max(a,c),p=Math.min(l,h),m=Math.max(l,h);if(n<s)for(let g=Math.ceil(n/(Math.PI/2))*(Math.PI/2);g<s;g+=Math.PI/2){let{x:y,y:b}=Hl(1,0,g);u=Math.min(y,u),d=Math.max(y,d),p=Math.min(b,p),m=Math.max(b,m)}else for(let g=Math.floor(n/(Math.PI/2))*(Math.PI/2);g>s;g-=Math.PI/2){let y=Math.cos(g),b=Math.sin(g);u=Math.min(y,u),d=Math.max(y,d),p=Math.min(b,p),m=Math.max(b,m)}return ul.modify(u*i+e,d*i+e,p*i+r,m*i+r)}},Wit=class extends C2e{create(o,t,e,r,i,n,s,a,l,c=-1,h=1){return super.create(o,t,e,r,i,n,s,a,l,c),tm[13]=h,tm}},zit=class extends C2e{create(o,t,e,r,i,n,s,a,l,c=-1){return super.create(o,t,e,r,i,n,s,a,l,c),tm}},Yit=class extends C2e{create(o,t,e,r,i,n,s,a,l,c=-1,h=-1){return super.create(o,t,e,r,i,n,s,a,l,c),tm[0]=o+(57<<fa)+Is,tm[13]=h,tm}},S2e,E2e,eLe;NL(()=>S2e=new Wit(7,Hit,Qwe),()=>{E2e=new zit(7,Xxe,nbe),eLe=new Yit(57,Xxe+1,nbe)});function jit(o,t,e){let{plane:r,circleContainerArr:i,getHighLightDrawInfo:n,renderMatrix:s,onlyRenderHighLightPt:a,isMirrored:l,groupIdBuilder:c,bNeedFill:h}=e,u=t.get(o+12),d=r.getPtColorIndex(t.get(o+11),u);if(!Md(d,r.scene.colors)||hk(h,u,c))return;let p=t.get(o+10),m=new S(t.get(o+1),t.get(o+2)).multiply4(s),g=new S(t.get(o+1)+t.get(o+3),t.get(o+2)).multiply4(s),y=Math.abs(g.x-m.x),b=l?Math.PI-t.get(o+4):t.get(o+4),P=l?-t.get(o+5):t.get(o+5),T=t.get(o+13),I=r.getPtBBox(t.slice(o,o+S2e.length)).UL().multiply4(s);Ywe(m,y,b,P,d,u,T,I,p,r.scene.ptGroup.getData(),i,a,n,r.getSceneGlobalHighLightType())}function Xit(o,t,e){var r;if(!Sg(e))return;let{plane:i,circlesArr:n,renderMatrix:s,isMirrored:a,highLightColorIndex:l}=e,c=kL(l),h=l;c&&(h=i.getPtColorIndex(t.get(o+11),t.get(o+12)));let u=(r=n[c])==null?void 0:r[h];n[c]||(n[c]=[]),n[c][h]||(n[c][h]=u=[]);let d=new S(t.get(o+1),t.get(o+2)).multiply4(s),p=new S(t.get(o+1)+t.get(o+3),t.get(o+2)).multiply4(s),m=Math.abs(p.x-d.x),g=a?Math.PI-t.get(o+4):t.get(o+4),y=a?-t.get(o+5):t.get(o+5);u.push(d.x,d.y,m,g,y)}function qit(o,t,e){let{plane:r,triangleContainerArr:i,getHighLightDrawInfo:n,renderMatrix:s,onlyRenderHighLightPt:a,groupIdBuilder:l,bNeedFill:c}=e,h=t.get(o+7)*Ld,u=r.scene.staticPolygonInfoBuilder,d=u.get(h+8),p=r.getPtColorIndex(u.get(h+7),d);if(!Md(p,r.scene.colors)||hk(c,d,l))return;let m=aQ(u,h).multiply4(s),g=u.get(h+6),y=t.get(o+8),b=new S(t.get(o+1),t.get(o+2)).multiply4(m),P=new S(t.get(o+3),t.get(o+4)).multiply4(m),T=new S(t.get(o+5),t.get(o+6)).multiply4(m),I=r.getPtBBox(t.slice(o,o+vW.length),0,u).UL().multiply4(s);zwe(b,P,T,p,d,I,y,g,r.scene.ptGroup.getData(),i,a,n,r.getSceneGlobalHighLightType())}function $it(o,t,e){var r;if(!Sg(e))return;let{plane:i,trianglesArr:n,renderMatrix:s,staticPolygonInfoBuilder:a,highLightColorIndex:l}=e,c=t.get(o+7)*Ld,h=kL(l),u=l;h&&(u=i.getPtColorIndex(a.get(c+7),a.get(c+8)));let d=aQ(a,c).multiply4(s),p=(r=n[h])==null?void 0:r[u];n[h]||(n[h]=[]),p||(n[h][u]=p=[]),p.push(new S(t.get(o+1),t.get(o+2)).multiply4(d),new S(t.get(o+3),t.get(o+4)).multiply4(d),new S(t.get(o+5),t.get(o+6)).multiply4(d))}function Kit(o,t,e){let{plane:r,circleContainerArr:i,getHighLightDrawInfo:n,renderMatrix:s,onlyRenderHighLightPt:a,isMirrored:l,groupIdBuilder:c,bNeedFill:h}=e,u=t.get(o+10)*Ld,d=r.scene.staticPolygonInfoBuilder,p=d.get(u+8),m=r.getPtColorIndex(d.get(u+7),p);if(!Md(m,r.scene.colors)||hk(h,p,c))return;let g=aQ(d,u).multiply4(s),y=d.get(u+6),b=t.get(o+11),P=l?Math.PI-t.get(o+4):t.get(o+4),T=l?-t.get(o+5):t.get(o+5),I=new S(t.get(o+1),t.get(o+2)).multiply4(g),C=new S(t.get(o+1)+t.get(o+3),t.get(o+2)).multiply4(g),E=Math.abs(C.x-I.x),O=r.getPtBBox(t.slice(o,o+xW.length),0,d).UL().multiply4(s);Ywe(I,E,P,T,m,p,b,O,y,r.scene.ptGroup.getData(),i,a,n,r.getSceneGlobalHighLightType())}function Zit(o,t,e){var r;if(!Sg(e))return;let{plane:i,circlesArr:n,renderMatrix:s,isMirrored:a,staticPolygonInfoBuilder:l,highLightColorIndex:c}=e,h=kL(c),u=t.get(o+10)*Ld,d=c;h&&(d=i.getPtColorIndex(l.get(u+7),l.get(u+8)));let p=aQ(l,u).multiply4(s),m=(r=n[h])==null?void 0:r[d];n[h]||(n[h]=[]),m||(n[h][d]=m=[]);let g=new S(t.get(o+1),t.get(o+2)).multiply4(p),y=new S(t.get(o+1)+t.get(o+3),t.get(o+2)).multiply4(p),b=Math.abs(y.x-g.x),P=a?Math.PI-t.get(o+4):t.get(o+4),T=a?-t.get(o+5):t.get(o+5);m.push(g.x,g.y,b,P,T)}function Jit(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=tLe(e,t,r);l&&(P1(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&obe(o,l),(n=l.highLightInfo)!=null&&n.ctx&&obe(l.highLightInfo.ctx,l,"groupId"))}function tLe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix3:s,scale:a,sampling:l}=e,c=e.highLightColorIndex,h=o.get(t+9),u=i.getPtColorIndex(o.get(t+8),h);if(r!=="select"&&!Md(u,i.scene.colors))return;let d=r==="select"?null:n(h),p=o.get(t+11),m=o.get(t+10),g=o.get(t+4),y=i.getDashedArray(m,a,g),b=q.build3(new S(o.get(t+1),o.get(t+2)),o.get(t+5)*360/pa,o.get(t+6)*360/pa,o.get(t+3),o.get(t+3)).multiply3(s),P=i.getRenderLineWidth(l,g,a);return{...e,colorIndex:u,groupIdIndex:h,dashedArray:y,lineWidth:P,arc:b,lineCap:p,highLightInfo:d,highLightColorIndex:c}}function obe(o,t,e="none"){let{bNeedFill:r,colorIndex:i,groupIdIndex:n,dashedArray:s,lineWidth:a,arc:l,lineCap:c,plane:h,highLightColorIndex:u,highLightInfo:d,camera:p,groupIdBuilder:m,material:g,renderMode:y}=t;switch(o.save(),e){case"none":{h.ptSetCustomizedColor(o,p,i,g,y,n);break}case"groupId":{h.setGroupHighLightColor(o,p,i,d.isForceHighLight);break}case"select":{h.highLightPtSetCustomizedColor(o,u,i);break}}o.setLineDash(s);let b=o.getContext();if(RW(r,n,m))o.setLineWidth(a),b.beginPath(),b.arc(l.center.x,l.center.y,l.rx,l.startAngle*pa/360,l.endAngle()*pa/360,l.sweepAngle<0),o.setLineCap(hQ[c]),b.stroke();else{o.setLineWidth(1),b.beginPath(),b.arc(l.center.x,l.center.y,l.rx+a/2,l.startAngle*pa/360,l.endAngle()*pa/360,l.sweepAngle<0),b.stroke(),l.rx-a/2>0&&(b.beginPath(),b.arc(l.center.x,l.center.y,l.rx-a/2,l.startAngle*pa/360,l.endAngle()*pa/360,l.sweepAngle<0),b.stroke());let P=l.center.add(new S(l.rx,0)).rotate(l.center,l.startAngle*pa/360),T=l.center.add(new S(l.rx,0)).rotate(l.center,l.endAngle()*pa/360);b.beginPath(),b.arc(P.x,P.y,a/2,0,2*Math.PI),b.stroke(),b.beginPath(),b.arc(T.x,T.y,a/2,0,2*Math.PI),b.stroke()}o.restore()}function Qit(o,t,e,r){if(!Sg(r))return;let i=tLe(e,t,r,"select");obe(o,i,"select")}var rLe=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.ORDER=4]="ORDER",o[o.COLOR_INDEX=5]="COLOR_INDEX",o[o.GROUP_ID=6]="GROUP_ID",o[o.FILL_STYLE=7]="FILL_STYLE",o))(rLe||{}),sbe=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.ORDER=4]="ORDER",o[o.COLOR_INDEX=5]="COLOR_INDEX",o[o.GROUP_ID=6]="GROUP_ID",o[o.TEMPLATE_ID=7]="TEMPLATE_ID",o))(sbe||{}),qxe=7,ent=8,qP=[],O2e=class extends f0{create(o,t,e,r,i,n=-1){return qP[0]=o+(0<<fa)+Is,qP[1]=t.x,qP[2]=t.y,qP[3]=e,qP[4]=r||0,qP[5]=i||0,qP[6]=n,qP}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3];return ul.modify(e-i,e+i,r-i,r+i)}},tnt=class extends O2e{create(o,t,e,r,i,n=-1,s=1){return super.create(o,t,e,r,i,n),qP[7]=s,qP}},rnt=class extends O2e{create(o,t,e,r,i,n){return super.create(o,t,e,r,i,n)}},int=class extends O2e{create(o,t,e,r,i,n,s=-1){return super.create(o,t,e,r,i,n),qP[0]=o+(51<<fa)+Is,qP[7]=s,qP}},A2e,_2e,iLe;NL(()=>A2e=new tnt(0,ent,rLe),()=>{_2e=new rnt(0,qxe,sbe),iLe=new int(51,qxe+1,sbe)});function nnt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=nLe(e,t,r);l&&(P1(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&abe(o,l),(n=l.highLightInfo)!=null&&n.ctx&&abe(l.highLightInfo.ctx,l,"groupId"))}function nLe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,scale:a}=e,l=o.get(t+6),c=i.getPtColorIndex(o.get(t+5),l);if(r!=="select"&&!Md(c,i.scene.colors))return;let h=r==="select"?null:n(l),u=new S(o.get(t+1),o.get(t+2)).multiply4(s),d=o.get(t+3)*a,p=i.getPtBBox(o.slice(t,t+A2e.length)).UL().multiply4(s),m=o.get(t+7),g=_h.isDoubleRgb(l,i.scene.ptGroup.getData());return{...e,highLightInfo:h,colorIndex:c,groupIdIndex:l,center:u,radius:d,leftUpPoint:p,fillStyle:m,isDoubleRgb:g}}function abe(o,t,e="none"){let{bNeedFill:r,colorIndex:i,groupIdIndex:n,center:s,radius:a,plane:l,leftUpPoint:c,fillStyle:h,isDoubleRgb:u,samplingPxLength:d,highLightColorIndex:p,highLightInfo:m,camera:g,groupIdBuilder:y,material:b,renderMode:P}=t,T=RW(r,n,y);switch(o.save(),e){case"none":{l.ptSetCustomizedColor(o,g,i,b,P,n);break}case"groupId":{l.setGroupHighLightColor(o,g,i,m.isForceHighLight);break}case"select":{l.highLightPtSetCustomizedColor(o,p,i);break}}let I=o.getContext();I.beginPath(),I.arc(s.x,s.y,a,0,pa),o.setTranslate(c.x,c.y),e=="none"&&l.setFillStyle(o,h,i,u,d,void 0,g,!1,b,P),T?I.fill():I.stroke(),o.restore()}function ont(o,t,e,r){if(!Sg(r))return;let i=nLe(e,t,r,"select");abe(o,i,"select")}function snt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=oLe(e,t,r);l&&((P1(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)||l.isDrcRenderFixed)&&lbe(o,l),(n=l.highLightInfo)!=null&&n.ctx&&lbe(l.highLightInfo.ctx,l,"groupId"))}function oLe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,samplingPxLength:a,scale:l,sampling:c}=e,h=o.get(t+11),u=i.getPtColorIndex(o.get(t+12),h);if(r!=="select"&&!Md(u,i.scene.colors))return;let d=e.highLightColorIndex,p=r==="select"?null:n(h),m=o.get(t+5),g=o.get(t+3)*l,y=o.get(t+4)*l,b=i.scene.drcRenderModel===0,P=i.scene.drcRenderStyle===0;b&&(y=Math.min(o.get(t+4)/a,o.get(t+7)*c),g=o.get(t+3)*y/o.get(t+4));let T=g*.5,I=y*.5,C=new S(-T,I),E=new S(T,-I),O=new S(T,I),_=new S(-T,-I),R=i.scene.stringInfos[o.get(t+8)],v=i.scene.stringInfos[o.get(t+9)],D=new S(o.get(t+1),o.get(t+2)).multiply4(s);return{...e,colorIndex:u,groupIdIndex:h,position:D,angle:m,isDrcRenderFixed:b,isDrcStyleCross:P,start1:C,end1:E,start2:O,end2:_,height:y,halfHeight:I,halfWidth:T,leftText:R,rightText:v,highLightInfo:p,highLightColorIndex:d}}function lbe(o,t,e="none"){let{colorIndex:r,groupIdIndex:i,position:n,angle:s,isDrcStyleCross:a,start1:l,end1:c,start2:h,end2:u,height:d,halfHeight:p,halfWidth:m,leftText:g,rightText:y,plane:b,highLightColorIndex:P,highLightInfo:T,sampling:I,camera:C,material:E,renderMode:O}=t;switch(o.save(),e){case"none":{b.ptSetCustomizedColor(o,C,r,E,O,i);break}case"groupId":{b.setGroupHighLightColor(o,C,r,T.isForceHighLight);break}case"select":{b.highLightPtSetCustomizedColor(o,P,r);break}}let _=o.getContext();if(o.setTranslate(n.x,n.y),o.setRotate(-s),a)o.setLineWidth(I*2),_.beginPath(),_.moveTo(l.x,l.y),_.lineTo(c.x,c.y),_.moveTo(h.x,h.y),_.lineTo(u.x,u.y),_.stroke();else{o.setLineWidth(I),_.beginPath(),_.moveTo(l.x,l.y),_.lineTo(c.x,c.y),_.moveTo(h.x,h.y),_.lineTo(u.x,u.y),_.moveTo(l.x,l.y),_.lineTo(u.x,u.y),_.moveTo(h.x,h.y),_.lineTo(c.x,c.y),_.stroke(),o.setTextAlign("center"),o.setTextBaseLine("middle");let R=d*.4;o.setFont(`normal ${R}px ${lk}`);let v=p/m,D=Math.atan(v),w=m*p,F=p*2+p/Math.sin(D)*2,H=2*w/F;_.fillText(g,-(H/Math.sin(D)),0),_.fillText(y,H/Math.sin(D),0)}o.restore()}function ant(o,t,e,r){if(!Sg(r))return;let i=oLe(e,t,r,"select");lbe(o,i,"select")}function lnt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=sLe(e,t,r);l&&(P1(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&cbe(o,l),(n=l.highLightInfo)!=null&&n.ctx&&cbe(l.highLightInfo.ctx,l,"groupId"))}function sLe(o,t,e,r="none"){let{plane:i,pxLength:n,getHighLightDrawInfo:s,renderMatrix:a}=e,l=o.get(t+7),c=i.getPtColorIndex(o.get(t+6),l);if(r!=="select"&&!Md(c,i.scene.colors))return;let h=r==="select"?null:s(l),u=new S(o.get(t+1),o.get(t+2)),d=o.get(t+3),p=o.get(t+4)*n/8*d*(d===1?.5:1),m=Math.sqrt(3),g=u.add(new S(-m,-1).mul(p)).multiply4(a),y=u.add(new S(m,-1).mul(p)).multiply4(a),b=u.add(new S(0,2).mul(p)).multiply4(a),P;return d===1&&(u=u.multiply4(a),P=Math.sqrt((u.x-b.x)**2+(u.y-b.y)**2)*2),{...e,highLightInfo:h,colorIndex:c,groupIdIndex:l,isTriangle:d,point:u,p1:g,p2:y,p3:b}}function cbe(o,t,e="none"){let{highLightInfo:r,colorIndex:i,groupIdIndex:n,plane:s,isTriangle:a,point:l,p1:c,p2:h,p3:u,highLightColorIndex:d,camera:p,material:m,renderMode:g}=t;switch(o.save(),e){case"none":{s.ptSetCustomizedColor(o,p,i,m,g,n);break}case"groupId":{s.setGroupHighLightColor(o,p,i,r.isForceHighLight);break}case"select":{s.highLightPtSetCustomizedColor(o,d,i);break}}let y=o.getContext();if(y.beginPath(),a===1){let b=Math.sqrt((l.x-u.x)**2+(l.y-u.y)**2)*2;y.arc(l.x,l.y,b,0,Math.PI*2)}else y.moveTo(c.x,c.y),y.lineTo(h.x,h.y),y.lineTo(u.x,u.y);y.closePath(),y.fill(),o.restore()}function cnt(o,t,e,r){if(!Sg(r))return;let i=sLe(e,t,r,"select");cbe(o,i,"select")}function hnt(o,t,e,r){var i;let{plane:n,samplingPxLength:s}=r;if(e.get(t+8)<s)return;let a=aLe(e,t,r);a&&(n.getSceneGlobalHighLightType()==1&&(i=a.highLightInfo)!=null&&i.ctx?hbe(a.highLightInfo.ctx,a,"groupId"):hbe(o,a))}function aLe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,highLightColorIndex:a}=e,l=o.get(t+10),c=i.getPtColorIndex(o.get(t+11),l);if(r!=="select"&&!Md(c,i.scene.colors))return;let h=new S(o.get(t+1),o.get(t+2)).multiply4(s),u=i.scene.stringInfos[o.get(t+7)],d=o.get(t+5),p=o.get(t+3),m=o.get(t+4),g=o.get(t+9),y=r==="select"?null:n(l),b=_h.isDoubleRgb(l,i.scene.ptGroup.getData()),P=p*o.get(t+13),T=m*o.get(t+14);return{...e,colorIndex:c,groupIdIndex:l,point:h,text:u,angle:d,height:m,limitMax:g,isDoubleRgb:b,highLightInfo:y,highLightColorIndex:a,widthOffset:P,heightOffset:T}}function hbe(o,t,e="none"){let{plane:r,colorIndex:i,point:n,text:s,angle:a,height:l,limitMax:c,samplingPxLength:h,sampling:u,isDoubleRgb:d,highLightColorIndex:p,highLightInfo:m,widthOffset:g,heightOffset:y,camera:b}=t;o.save();let P=o.getContext();switch(e){case"none":{o.setFillStyle(r.getNetStringColor(i,d,!1,b));break}case"groupId":{r.setGroupHighLightStringColor(o,i,m.isForceHighLight,b);break}case"select":{r.highLightPtSetCustomizedColor(o,p,i,10);break}}o.setTranslate(n.x,n.y),o.setRotate(-a),o.setTextAlign("center"),o.setTextBaseLine("middle");let T=Math.min(l/h,c*u);o.setFont(`normal ${T}px ${lk}`),P.fillText(s,g/h,-y/h),o.restore()}function unt(o,t,e,r){if(!Sg(r))return;let i=aLe(e,t,r,"select");hbe(o,i,"select")}function dnt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=lLe(e,t,r);l&&(P1(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&ube(o,l),(n=l.highLightInfo)!=null&&n.ctx&&ube(l.highLightInfo.ctx,l,"groupId"))}function pnt(o,t,e="none"){let{leftUpPointX:r,leftUpPointY:i,width:n,height:s}=t,a=t.radius;o.roundRect?o.roundRect(r,i,n,s,a):(o.beginPath(),2*a>Math.min(n,s)&&(a=Math.min(n,s)/2),o.moveTo(r+a,i),o.lineTo(r+n-a,i),o.arc(r+n-a,i+a,a,Math.PI*1.5,Math.PI*2),o.lineTo(r+n,i+s-a),o.arc(r+n-a,i+s-a,a,0,Math.PI*.5),o.lineTo(r+n-a,i+s),o.arc(r+a,i+s-a,a,Math.PI*.5,Math.PI),o.lineTo(r,i+a),o.arc(r+a,i+a,a,Math.PI,Math.PI*1.5),o.closePath())}function lLe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,pxLength:a,scale:l}=e,c=o.get(t+9),h=i.getPtColorIndex(o.get(t+8),c);if(r!=="select"&&!Md(h,i.scene.colors))return;let u=e.highLightColorIndex,d=r==="select"?null:n(c),p=Math.max(o.get(t+3),a),m=Math.max(o.get(t+4),a),g=o.get(t+5),y=o.get(t+10),b=_h.isDoubleRgb(c,i.scene.ptGroup.getData()),P=o.get(t+6),T=new S(o.get(t+1),o.get(t+2)).multiply4(s);return{...e,highLightInfo:d,colorIndex:h,groupIdIndex:c,leftUpPoint:T,radius:P*l,width:p*l,height:m*l,isDoubleRgb:b,fillStyle:y,highLightColorIndex:u,angle:g}}function ube(o,t,e="none"){let{plane:r,bNeedFill:i,highLightInfo:n,colorIndex:s,groupIdIndex:a,leftUpPoint:l,radius:c,height:h,width:u,isDoubleRgb:d,fillStyle:p,samplingPxLength:m,highLightColorIndex:g,angle:y,isNobodyRect:b,isMirrored:P,camera:T,groupIdBuilder:I,material:C,renderMode:E}=t,O=o.getContext();O.beginPath();let _=RW(i,a,I);switch(o.save(),e){case"none":{r.ptSetCustomizedColor(o,T,s,C,E,a);break}case"groupId":{r.setGroupHighLightColor(o,T,s,n.isForceHighLight);break}case"select":{b?r.setNoBodyRectColor(o,T,g,s,a):r.highLightPtSetCustomizedColor(o,g,s);break}}o.setTranslate(l.x,l.y),o.setScale(P?-1:1,1),o.setRotate(-y),c?pnt(O,{leftUpPointX:0,leftUpPointY:0,width:u,height:h,radius:c}):(O.beginPath(),O.moveTo(0,0),O.lineTo(u,0),O.lineTo(u,h),O.lineTo(0,h),O.closePath()),e==="none"&&r.setFillStyle(o,p,s,d,m,void 0,T,!1,C,E),_?O.fill():O.stroke(),o.restore()}function fnt(o,t,e,r){if(!r.isNobodyRect&&!Sg(r))return;let i=lLe(e,t,r,"select");i.isNobodyRect=r.isNobodyRect,ube(o,i,"select")}function mnt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=cLe(e,t,r);l&&(P1(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&dbe(o,l),(n=l.highLightInfo)!=null&&n.ctx&&dbe(l.highLightInfo.ctx,l))}function cLe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,sampling:a}=e,l=o.get(t+9),c=i.getPtColorIndex(o.get(t+8),l);if(r!=="select"&&!Md(c,i.scene.colors))return;let h=e.highLightColorIndex,u=r==="select"?null:n(l),d=new S(o.get(t+1),o.get(t+2)).multiply4(s),p=new S(o.get(t+3),o.get(t+4)).multiply4(s),m=a,g=o.get(t+5),y=o.get(t+6);return{...e,highLightInfo:u,colorIndex:c,groupIdIndex:l,lineWidth:m,start:d,end:p,lenAndGap:g,len:y,highLightColorIndex:h}}function dbe(o,t,e="none"){let{highLightInfo:r,colorIndex:i,groupIdIndex:n,lineWidth:s,start:a,end:l,plane:c,lenAndGap:h,len:u,highLightColorIndex:d,camera:p,material:m,renderMode:g}=t;switch(o.save(),e){case"none":{c.ptSetCustomizedColor(o,p,i,m,g,n);break}case"groupId":{c.setGroupHighLightColor(o,p,i,r.isForceHighLight);break}case"select":{c.highLightPtSetCustomizedColor(o,d,i);break}}o.setLineWidth(s);let y=o.getContext();h!==u&&o.setLineDash([u,h-u]),y.beginPath(),y.moveTo(a.x,a.y),y.lineTo(l.x,l.y),y.stroke(),o.restore()}function gnt(o,t,e,r){if(!Sg(r))return;let i=cLe(e,t,r,"select");dbe(o,i,"select")}function ynt(o,t,e,r){var i,n;let{plane:s,onlyRenderHighLightPt:a,globalHighLightType:l}=r,c=e.get(t+4),h=e.get(t+5),u=s.scene.colors;if(!Md(c,u)&&!Md(h,u))return;let d=hLe(e,t,r);P1(a,(i=d.highLightInfo)==null?void 0:i.isForceHighLight,l)&&pbe(o,d),(n=d.highLightInfo)!=null&&n.ctx&&pbe(d.highLightInfo.ctx,d,"groupId")}function hLe(o,t,e,r="none"){let{getHighLightDrawInfo:i,renderMatrix:n,scale:s,plane:a}=e,l=0,c=e.highLightColorIndex,h=o.get(t+4),u=o.get(t+5),d=o.get(t+7),p=r==="select"?null:i(d),m=o.get(t+3)*s,g=_h.isDoubleRgb(d,a.scene.ptGroup.getData()),y=new S(o.get(t+1),o.get(t+2)).multiply4(n);return{...e,highLightInfo:p,colorIndex1:h,colorIndex2:u,groupIdIndex:d,radius:m,center:y,colorIndex:l,isDoubleRgb:g,highLightColorIndex:c}}function pbe(o,t,e="none"){let{highLightInfo:r,colorIndex:i,colorIndex1:n,colorIndex2:s,groupIdIndex:a,radius:l,center:c,isMirrored:h,plane:u,isDoubleRgb:d,highLightColorIndex:p,camera:m,material:g,renderMode:y}=t;o.save();let b,P,T=o.getContext();switch(e){case"none":{b=u.getFillStyle(n,d,m,!1,g,y),P=u.getFillStyle(s,d,m,!1,g,y);break}case"groupId":{b=u.getGroupHighLightColor(n,r.isForceHighLight,m),P=u.getGroupHighLightColor(s,r.isForceHighLight,m);break}case"select":{if(kL(p))b=u.getSemicirclePtHighLightFillStyle(n,!0),P=u.getSemicirclePtHighLightFillStyle(s,!0);else{T.beginPath(),T.arc(c.x,c.y,l,0,pa),o.setFillStyle(u.getFillStyle(p,d,m,!1,g,y)),T.fill(),o.restore();return}break}}T.beginPath(),T.arc(c.x,c.y,l,Math.PI/2,Math.PI/2+Math.PI),T.closePath();let I=h?P:b;I&&o.setFillStyle(I),T.fill(),T.beginPath(),T.arc(c.x,c.y,l,-Math.PI/2,Math.PI/2),T.closePath();let C=h?b:P;C&&o.setFillStyle(C),T.fill(),o.restore()}function bnt(o,t,e,r){if(!Sg(r))return;let i=hLe(e,t,r,"select");pbe(o,i,"select")}function Pnt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=Tnt(e,t,r);l&&(P1(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&$xe(o,l),(n=l.highLightInfo)!=null&&n.ctx&&$xe(l.highLightInfo.ctx,l,"groupId"))}function Tnt(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix3:s,sampling:a}=e,l=o.get(t+8),c=i.getPtColorIndex(o.get(t+7),l);if(r!=="select"&&!Md(c,i.scene.colors))return;let h=r==="select"?null:n(l),u=q.build3(new S(o.get(t+1),o.get(t+2)),o.get(t+4)*360/pa,o.get(t+5)*360/pa,o.get(t+3),o.get(t+3)).multiply3(s);return{...e,colorIndex:c,groupIdIndex:l,lineWidth:a,arc:u,highLightInfo:h}}function $xe(o,t,e="none"){let{colorIndex:r,groupIdIndex:i,lineWidth:n,arc:s,plane:a,highLightInfo:l,camera:c,material:h,renderMode:u}=t;switch(o.save(),e){case"none":{a.ptSetCustomizedColor(o,c,r,h,u,i,void 0,!0);break}case"groupId":{a.setGroupHighLightColor(o,c,r,l.isForceHighLight,!0);break}}let d=o.getContext();o.setLineWidth(n),d.beginPath(),d.arc(s.center.x,s.center.y,s.rx,s.startAngle*pa/360,s.endAngle()*pa/360,s.sweepAngle<0),d.stroke(),o.restore()}function Int(o,t,e,r){var i;let{plane:n,onlyRenderHighLightPt:s,groupIdBuilder:a,bNeedFill:l}=r,c=e.get(t+6)*Ld,h=n.scene.staticPolygonInfoBuilder,u=h.get(c+8),d=n.getPtColorIndex(h.get(c+7),u);if(!Md(d,n.scene.colors)||!hk(l,u,a))return;let p=Cnt(e,t,r,h,c);!s&&Kxe(o,p),(i=p.highLightInfo)!=null&&i.ctx&&Kxe(p.highLightInfo.ctx,p,"groupId")}function Cnt(o,t,e,r,i,n="none"){let{getHighLightDrawInfo:s,renderMatrix:a,sampling:l}=e,c=new Ae([r.get(i),r.get(i+1),0,0,r.get(i+2),r.get(i+3),0,0,0,0,1,0,r.get(i+4),r.get(i+5),0,1]).multiply4(a),h=q.build3(new S(o.get(t+1),o.get(t+2)),o.get(t+4)*360/pa,o.get(t+5)*360/pa,o.get(t+3),o.get(t+3)).multiply3(c.toMatrix3()),u=l,d=r.get(i+7),p=r.get(i+8),m=n==="select"?null:s(p);return{...e,colorIndex:d,groupIdIndex:p,lineWidth:u,arc:h,highLightInfo:m}}function Kxe(o,t,e="none"){let{colorIndex:r,groupIdIndex:i,lineWidth:n,arc:s,plane:a,highLightInfo:l,camera:c,material:h,renderMode:u}=t;switch(o.save(),e){case"none":{a.ptSetCustomizedColor(o,c,r,h,u,i,void 0,!0);break}case"groupId":{a.setGroupHighLightColor(o,c,r,l.isForceHighLight,!0);break}}let d=o.getContext();o.setLineWidth(n),d.beginPath(),d.arc(s.center.x,s.center.y,s.rx,s.startAngle*pa/360,s.endAngle()*pa/360,s.sweepAngle<0),d.stroke(),o.restore()}function Snt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=Ent(e,t,r);l&&(P1(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&Zxe(o,l),(n=l.highLightInfo)!=null&&n.ctx&&Zxe(l.highLightInfo.ctx,l,"groupId"))}function Ent(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,sampling:a}=e,l=o.get(t+7),c=i.getPtColorIndex(o.get(t+6),l);if(r!=="select"&&!Md(c,i.scene.colors))return;let h=r==="select"?null:n(l),u=new S(o.get(t+1),o.get(t+2)).multiply4(s),d=new S(o.get(t+3),o.get(t+4)).multiply4(s);return{...e,highLightInfo:h,colorIndex:c,groupIdIndex:l,lineWidth:a,start:u,end:d}}function Zxe(o,t,e="none"){let{highLightInfo:r,colorIndex:i,groupIdIndex:n,lineWidth:s,start:a,end:l,plane:c,camera:h,material:u,renderMode:d}=t;switch(o.save(),e){case"none":{c.ptSetCustomizedColor(o,h,i,u,d,n,void 0,!0);break}case"groupId":{c.setGroupHighLightColor(o,h,i,r.isForceHighLight,!0);break}}let p=o.getContext();o.setLineWidth(s),p.beginPath(),p.moveTo(a.x,a.y),p.lineTo(l.x,l.y),p.stroke(),o.restore()}function Ont(o,t,e,r){var i;let{plane:n,onlyRenderHighLightPt:s,groupIdBuilder:a,bNeedFill:l}=r,c=e.get(t+5)*Ld,h=n.scene.staticPolygonInfoBuilder.get(c+8),u=n.getPtColorIndex(n.scene.staticPolygonInfoBuilder.get(c+7),h);if(!Md(u,n.scene.colors)||!hk(l,h,a))return;let d=Ant(e,t,r,n.scene.staticPolygonInfoBuilder,c);!s&&Jxe(o,d),(i=d.highLightInfo)!=null&&i.ctx&&Jxe(d.highLightInfo.ctx,d,"groupId")}function Ant(o,t,e,r,i,n=!1){let{getHighLightDrawInfo:s,renderMatrix:a,sampling:l}=e,c=new Ae([r.get(i),r.get(i+1),0,0,r.get(i+2),r.get(i+3),0,0,0,0,1,0,r.get(i+4),r.get(i+5),0,1]).multiply4(a),h=r.get(i+7),u=r.get(i+8),d=n?null:s(u),p=new S(o.get(t+1),o.get(t+2)).multiply4(c),m=new S(o.get(t+3),o.get(t+4)).multiply4(c);return{...e,highLightInfo:d,colorIndex:h,groupIdIndex:u,lineWidth:l,start:p,end:m}}function Jxe(o,t,e="none"){let{highLightInfo:r,colorIndex:i,groupIdIndex:n,lineWidth:s,start:a,end:l,plane:c,camera:h,material:u,renderMode:d}=t;switch(o.save(),e){case"none":{c.ptSetCustomizedColor(o,h,i,u,d,n,void 0,!0);break}case"groupId":{c.setGroupHighLightColor(o,h,i,r.isForceHighLight,!0);break}}let p=o.getContext();o.setLineWidth(s),p.beginPath(),p.moveTo(a.x,a.y),p.lineTo(l.x,l.y),p.stroke(),o.restore()}var uLe=(o=>(o[o.ID=0]="ID",o[o.STRING_INDEX=1]="STRING_INDEX",o[o.CONTENT_WIDTH=2]="CONTENT_WIDTH",o[o.CONTENT_HEIGHT=3]="CONTENT_HEIGHT",o[o.Matrix3Start=4]="Matrix3Start",o[o.Matrix3End=12]="Matrix3End",o[o.COLOR_INDEX=13]="COLOR_INDEX",o[o.ORDER=14]="ORDER",o[o.GROUP_ID=15]="GROUP_ID",o[o.TEXT_WRAP=16]="TEXT_WRAP",o[o.TEXT_ALIGN=17]="TEXT_ALIGN",o[o.TEXT_VERTICAL_ALIGN=18]="TEXT_VERTICAL_ALIGN",o[o.OVERFLOW=19]="OVERFLOW",o[o.LINE_HEIGHT=20]="LINE_HEIGHT",o[o.SHADOW_COLOR_INDEX=21]="SHADOW_COLOR_INDEX",o[o.SHADOW_BLUR=22]="SHADOW_BLUR",o))(uLe||{}),_nt=23,Vc=[],vnt=class extends f0{create(o,t,e,r,i,n,s,a=-1,l=0,c=0,h=0,u=1,d,p,m){return Vc[0]=o+(18<<fa)+Is,Vc[1]=t,Vc[2]=r,Vc[3]=i,Vc[4]=e.data[0],Vc[5]=e.data[1],Vc[6]=e.data[2],Vc[7]=e.data[3],Vc[8]=e.data[4],Vc[9]=e.data[5],Vc[10]=e.data[6],Vc[11]=e.data[7],Vc[12]=e.data[8],Vc[13]=n||0,Vc[14]=s||0,Vc[15]=a,Vc[16]=l,Vc[17]=c,Vc[18]=h,Vc[19]=u,Vc[20]=d||1,Vc[21]=p,Vc[22]=m||0,Vc}getBBox(o,t){let e=o[t+2],r=o[t+3],i=o.slice(t+4,t+12+1),{x:n,y:s}=Vxe(i,0,0),{x:a,y:l}=Vxe(i,e,r);return ul.modify(Math.min(n,a),Math.max(n,a),Math.min(s,l),Math.max(s,l))}},xnt=II*3,Rnt=10,dLe=(o=>(o[o.ID=0]="ID",o[o.STRING_INDEX=1]="STRING_INDEX",o[o.POSITION_X=2]="POSITION_X",o[o.POSITION_Y=3]="POSITION_Y",o[o.ANGLE=4]="ANGLE",o[o.WIDTH=5]="WIDTH",o[o.HEIGHT=6]="HEIGHT",o[o.COLOR_INDEX=7]="COLOR_INDEX",o[o.ORDER=8]="ORDER",o[o.GROUP_ID=9]="GROUP_ID",o))(dLe||{}),Dnt=class extends f0{create(o,t,e,r,i,n,s,a,l=-1){return Vc[0]=o+(18<<fa)+Is,Vc[1]=t,Vc[2]=e.x,Vc[3]=e.y,Vc[4]=(r%pa+pa)%pa,Vc[5]=i,Vc[6]=n,Vc[7]=s||0,Vc[8]=a||0,Vc[9]=l,Vc}getBBox(o,t){let e=o[t+5],r=o[t+6],i=o[t+2]+e/2,n=o[t+3]+r/2,s=o[t+4],a=e/2,l=r/2;if(s===0||s===Math.PI){let p=Math.min(i-a,i+a),m=Math.max(i-a,i+a),g=Math.min(n-l,n+l),y=Math.max(n-l,n+l);return ul.modify(p,m,g,y)}if(s===II||s===xnt){let p=Math.min(i-l,i+l),m=Math.max(i-l,i+l),g=Math.min(n-a,n+a),y=Math.max(n-a,n+a);return ul.modify(p,m,g,y)}let c=Hl(a,l,s),h=Hl(-a,-l,s),u=e>0?1:-1,d=r>0?1:-1;return c=Gxe(c.x,c.y,u,d),h=Gxe(h.x,h.y,u,d),ul.modify(Math.min(c.x,h.x)+i,Math.max(c.x,h.x)+i,Math.min(c.y,h.y)+n,Math.max(c.y,h.y)+n)}},pLe,RL;NL(()=>pLe=new vnt(18,_nt,uLe),()=>{RL=new Dnt(18,Rnt,dLe)});function wnt(o,t,e,r){let i=Lnt(e,t,r);i&&Mnt(o,i)}function Lnt(o,t,e){let{plane:r,renderMatrix3:i,currentRenderFont:n}=e,s=o.get(t+15),a=r.getPtColorIndex(o.get(t+13),s);if(!Md(a,r.scene.colors))return;let l=r.scene.sdfStringInfos[o.get(t+1)],c=o.get(t+16),h=o.get(t+2),u=o.get(t+3),d=o.get(t+17),p=o.get(t+18),m=o.get(t+19),g=l["text-decoration"],y=new Qe(Array.from(o.slice(t+4,t+12+1))).multiply3(i),b=o.get(t+20),P=o.get(t+21),T=o.get(t+22);return{...e,textStyleObj:l,matrix:y,colorIndex:a,groupIdIndex:s,overflow:m,contentWidth:h,contentHeight:u,textWrap:c,textVerticalAlign:p,textAlign:d,textDecoration:g,currentRenderFont:n,lineHeight:b,shadowColorIndex:P,shadowBlur:T}}function Mnt(o,t){let{plane:e,textStyleObj:r,matrix:i,colorIndex:n,groupIdIndex:s,overflow:a,contentWidth:l,contentHeight:c,textWrap:h,textVerticalAlign:u,textAlign:d,textDecoration:p,currentRenderFont:m,lineHeight:g,shadowColorIndex:y,shadowBlur:b,camera:P,material:T,renderMode:I}=t,C,E=o.getContext(),O=parseFloat(r["font-size"]);o.setTextBaseLine("bottom");let _=1,R=e.scene.getTextSizeCorrectionEnabled();if(R){let N=wL(r,K7);if(!m.style||m.style!==N){o.setFont(N);let U=E.measureText(r.value);_=K7/(Math.abs(U.fontBoundingBoxAscent)+Math.abs(U.fontBoundingBoxDescent)),m.style=N,m.ratio=_}else _=m.ratio}let v=wL(r,O*_);o.setFont(v),a==0?(C=!0,o.originSave()):o.save(),e.ptSetCustomizedColor(o,P,n,T,I,s),e.setRenderShadowInfo(o,b,y),o.setTransform([i.data[0],i.data[1],i.data[3],i.data[4],i.data[6],i.data[7]]),o.setScale(1,-1);let D=E.measureText(r.value),w=r.value.split(`
`),F=D.width,H=R?O:Math.abs(D.fontBoundingBoxAscent)+Math.abs(D.fontBoundingBoxDescent),z=r.value,G=H/8,W=0,L=0;a==0&&(E.beginPath(),E.rect(0,-c,l,c),E.clip());let B=H*g;if(w.length==1&&(F<l||h==0)){switch(u){case 0:{W=-c+B;break}case 2:{W=-(c-B)*.5;break}case 1:break}if(D.width<l)switch(d){case 0:break;case 2:{L=(l-D.width)*.5;break}case 1:{L=l-D.width;break}}o.setTranslate(Math.round(L),Math.round(W)),p&&p!=="none"&&(o.setLineWidth(G),E.beginPath(),p=="overline"?(E.moveTo(0,-H),E.lineTo(F,-H)):p=="line-through"?(E.moveTo(0,-H/2),E.lineTo(F,-H/2)):p=="underline"&&(E.moveTo(0,0),E.lineTo(F,0)),E.closePath(),E.stroke()),E.fillText(z,0,0)}else{let N=[];for(let k=0;k<w.length;k+=1){let V="",Y=w[k];for(let X=0;X<Y.length;X+=1){let Z=V+Y[X];E.measureText(Z).width>l?(N.push(V),W+=B,V=Y[X]):V=Z}N.push(V)}let U=N.length;for(let k=0;k<U;k+=1){switch(u){case 0:{W=-c+B+B*k;break}case 2:{W=-((c-B*U)*.5)-(U-1-k)*B;break}case 1:{W=-B*(U-1-k);break}}let V=E.measureText(N[k]).width;switch(d){case 0:break;case 2:{L=(l-V)*.5;break}case 1:{L=l-V;break}}p&&p!=="none"&&(o.setLineWidth(G),E.beginPath(),p=="overline"?(E.moveTo(L,W-H),E.lineTo(L+V,W-H)):p=="line-through"?(E.moveTo(L,W-H*.5),E.lineTo(L+V,W-H*.5)):p=="underline"&&(E.moveTo(L,W),E.lineTo(L+V,W)),E.closePath(),E.stroke()),E.fillText(N[k],Math.round(L),Math.round(W))}}C?o.originRestore():o.restore()}function Nnt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=fLe(e,t,r);l&&(P1(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&fbe(o,l),(n=l.highLightInfo)!=null&&n.ctx&&fbe(l.highLightInfo.ctx,l,"groupId"))}function fLe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix3:s,sampling:a,scale:l}=e,c=o.get(t+14),h=i.getPtColorIndex(o.get(t+10),c);if(r!=="select"&&!Md(h,i.scene.colors))return;let u=o.get(t+1),d=o.get(t+2),p=o.get(t+3),m=o.get(t+4),g=o.get(t+5),y=o.get(t+6),b=o.get(t+7),P=o.get(t+8),T=o.get(t+9),I=o.get(t+11),C=o.get(t+12),E=r==="select"?null:n(c),O=new S(u,d).multiply3(s),_=new S(p,m).multiply3(s),R=new S(g,y).multiply3(s),v=new S(b,P).multiply3(s),D=i.getRenderLineWidth(a,T,l),w=i.getDashedArray(I,l,T),F=hQ[C];return{...e,groupId:c,highLightInfo:E,strokeColorIndex:h,endPoint1:O,endPoint2:_,control1:R,control2:v,stroke:D,dashedArray:w,lineCap:F}}function fbe(o,t,e="none"){let{plane:r,dashedArray:i,lineCap:n,stroke:s,strokeColorIndex:a,groupId:l,endPoint1:c,endPoint2:h,control1:u,control2:d,highLightInfo:p,camera:m,material:g,renderMode:y}=t;switch(o.save(),e){case"none":{r.ptSetCustomizedColor(o,m,a,g,y,l);break}case"groupId":{r.setGroupHighLightColor(o,m,a,p.isForceHighLight);break}}let b=o.getContext();o.setLineWidth(s),o.setLineDash(i),n&&o.setLineCap(n),b.beginPath(),b.moveTo(c.x,c.y),b.bezierCurveTo(u.x,u.y,d.x,d.y,h.x,h.y),b.stroke(),o.restore()}function knt(o,t,e,r){if(!Sg(r))return;let i=fLe(e,t,r,"select");fbe(o,i,"select")}var mLe=(o=>(o[o.ID=0]="ID",o[o.LEFT_POINT_X=1]="LEFT_POINT_X",o[o.LEFT_POINT_Y=2]="LEFT_POINT_Y",o[o.WIDTH=3]="WIDTH",o[o.HEIGHT=4]="HEIGHT",o[o.ANGLE=5]="ANGLE",o[o.ORDER=6]="ORDER",o[o.SHADOW_COLOR_INDEX=7]="SHADOW_COLOR_INDEX",o[o.SHADOW_BLUR=8]="SHADOW_BLUR",o[o.GROUP_ID=9]="GROUP_ID",o))(mLe||{}),Bnt=10,aS=[],Fnt=class extends f0{create(o,t,e,r,i,n,s,a,l=-1){return aS[0]=o+(20<<fa)+Is,aS[1]=t.x,aS[2]=t.y,aS[3]=e,aS[4]=r,aS[5]=i,aS[6]=a||0,aS[7]=n||0,aS[8]=s||0,aS[9]=l,aS}getBBox(o,t){let e=new S(o[t+1],o[t+2]),r=o[t+3],i=o[t+4],n=o[t+5];if(n===0)return ul.modify(e.x,e.x+r,e.y-i,e.y);let s=Hl(0,0,n),a=Hl(0,-i,n),l=Hl(r,0,n),c=Hl(r,-i,n),h=e.add1(s.x,s.y),u=e.add1(a.x,a.y),d=e.add1(l.x,l.y),p=e.add1(c.x,c.y);return ul.modify(Math.min(h.x,u.x,d.x,p.x),Math.max(h.x,u.x,d.x,p.x),Math.min(h.y,u.y,d.y,p.y),Math.max(h.y,u.y,d.y,p.y))}},Vnt=new Fnt(20,Bnt,mLe);function Gnt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=Unt(e,t,r);l&&(P1(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&Qxe(o,l),(n=l.highLightInfo)!=null&&n.ctx&&Qxe(l.highLightInfo.ctx,l,"groupId"))}function Unt(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,pxLength:a,scale:l}=e,c=o.get(t+9),h=i.getPtColorIndex(o.get(t+7),c);if(!Md(h,i.scene.colors))return null;let u=o.get(t+8),d=e.highLightColorIndex,p=r==="select"?null:n(c),m=Math.max(o.get(t+3),a),g=Math.max(o.get(t+4),a),y=o.get(t+5),b=_h.isDoubleRgb(c,i.scene.ptGroup.getData()),P=new S(o.get(t+1),o.get(t+2)).multiply4(s);return{...e,highLightInfo:p,shadowColorIndex:h,shadowBlur:u,groupIdIndex:c,leftUpPoint:P,width:m*l,height:g*l,isDoubleRgb:b,angle:y,highLightColorIndex:d}}function Qxe(o,t,e="none"){let{plane:r,shadowColorIndex:i,leftUpPoint:n,height:s,width:a,isDoubleRgb:l,shadowBlur:c,angle:h,isMirrored:u}=t,d=o.getContext();o.save(),o.setStrokeStyle(ee.BLACK.toCSS());let p=-a,m=-s;o.setTranslate(p,m),o.setScale(u?-1:1,1),o.setRotate(-h);let g=n.rotate(new S(p,m),-h);g=n.add1(-p,-m),r.setRenderRectShadowInfo(o,c,i,g.x,g.y,l),d.beginPath(),d.moveTo(0,0),d.lineTo(a,0),d.lineTo(a,s),d.lineTo(0,s),d.closePath(),d.stroke(),o.restore()}var If=class{static init(o){let t=!1;try{qbe.value.location.search}catch{t=!0}t||(this.url=new URLSearchParams(o.location.search),this._useProxy=this.url.has("useProxy"),this._useCpuEngine=this.url.has("cpuEngine"),this._useGpuEngine=this.url.has("gpuEngine"),this._minRenderGridWH=Number(this.url.get("minRenderGridWH"))||0,this._enableLog=this.url.has("enableLog"),this._infiniteScaling=this.url.has("infiniteScaling"),this._isContinuedRender=this.url.has("isContinuedRender"))}static useProxy(){return this._useProxy}static useCpuEngine(){return this._useCpuEngine}static useGpuEngine(){return this._useGpuEngine}static getMinRenderGridWH(){return this._minRenderGridWH}static isEnableLog(){return this._enableLog}static getInfiniteScaling(){return this._infiniteScaling}static isContinuedRender(){return this._isContinuedRender}};If.url=null,If._useProxy=!1,If._useCpuEngine=!1,If._useGpuEngine=!1,If._minRenderGridWH=0,If._enableLog=!1,If._infiniteScaling=!1,If._isContinuedRender=!1;var Oy=class extends If{static init(o){super.init(o),this.url&&(this._logFps=this.url.has("logFps"),this._forceRender=this.url.has("render"),this._textureSize=Number(this.url.get("textureSize"))||0,this._macNoOnSubmittedWorkDone=this.url.has("macNoOnSubmittedWorkDone"),this._closeGridMulAcc=this.url.has("closeGridMulAcc"),this._closeGirdRender=this.url.has("closeGridRender"))}static macNoOnSubmittedWorkDone(){return this._macNoOnSubmittedWorkDone}static useLogFps(){return this._logFps}static useForceRender(){return this._forceRender}static getTextureSize(){return this._textureSize}static isCloseGridMulAcc(){return this._closeGridMulAcc}static isCloseGridRender(){return this._closeGirdRender}};Oy._logFps=!1,Oy._forceRender=!1,Oy._textureSize=0,Oy._macNoOnSubmittedWorkDone=!1,Oy._closeGridMulAcc=!1,Oy._closeGirdRender=!1;var yW=class extends If{static init(o){super.init(o),this.url&&this.url.get("alpha")&&(this._alpha=Number(this.url.get("alpha")))}static getAlpha(){return this._alpha}};yW._alpha=void 0;var Hnt=II*3,gLe=(o=>(o[o.ID=0]="ID",o[o.POSITION_X=1]="POSITION_X",o[o.POSITION_Y=2]="POSITION_Y",o[o.WIDTH=3]="WIDTH",o[o.HEIGHT=4]="HEIGHT",o[o.ANGLE=5]="ANGLE",o[o.STRING_LENGTH=6]="STRING_LENGTH",o[o.STRING_INDEX=7]="STRING_INDEX",o[o.GROUP_ID=8]="GROUP_ID",o[o.COLOR_INDEX=9]="COLOR_INDEX",o[o.ORDER=10]="ORDER",o[o.WIDTH_OFFSET_RATIO=11]="WIDTH_OFFSET_RATIO",o[o.HEIGHT_OFFSET_RATIO=12]="HEIGHT_OFFSET_RATIO",o))(gLe||{}),Wnt=13,S2=[],znt=class extends f0{create(o,t,e,r,i,n,s,a=-1,l,c,h,u){return S2[0]=o+(66<<fa)+Is,S2[1]=t.x,S2[2]=t.y,S2[3]=e,S2[4]=r,S2[5]=(i%pa+pa)%pa,S2[6]=n,S2[7]=s,S2[8]=a,S2[9]=l||0,S2[10]=c||0,S2[11]=h||0,S2[12]=u||0,S2}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+5],n=o[t+3]/2,s=o[t+4]/2,a=o[t+11],l=o[t+12];if(e+=a*n*2,r+=l*s*2,i===0||i===Math.PI)return ul.modify(e-n,e+n,r-s,r+s);if(i===II||i===Hnt)return ul.modify(e-s,e+s,r-n,r+n);let c=Hl(n,-s,i),h=Hl(n,s,i),u=Hl(-n,-s,i),d=Hl(-n,s,i),p={x:e+d.x,y:r+d.y},m={x:e+u.x,y:r+u.y},g={x:e+h.x,y:r+h.y},y={x:e+c.x,y:r+c.y};return ul.modify(Math.min(p.x,m.x,g.x,y.x),Math.max(p.x,m.x,g.x,y.x),Math.min(p.y,m.y,g.y,y.y),Math.max(p.y,m.y,g.y,y.y))}},yLe=new znt(66,Wnt,gLe);function Ynt(o,t,e,r){var i;let{plane:n}=r,s=bLe(e,t,r);s&&(n.getSceneGlobalHighLightType()==1&&(i=s.highLightInfo)!=null&&i.ctx?mbe(s.highLightInfo.ctx,s,"groupId"):mbe(o,s))}function bLe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,highLightColorIndex:a}=e,l=o.get(t+8),c=i.getPtColorIndex(o.get(t+9),l);if(r!=="select"&&!Md(c,i.scene.colors))return;let h=new S(o.get(t+1),o.get(t+2)).multiply4(s),u=i.scene.stringInfos[o.get(t+7)],d=o.get(t+5),p=o.get(t+3),m=o.get(t+4),g=r==="select"?null:n(l),y=_h.isDoubleRgb(l,i.scene.ptGroup.getData()),b=p*o.get(t+11),P=m*o.get(t+12);return{...e,colorIndex:c,groupIdIndex:l,point:h,text:u,angle:d,height:m,isDoubleRgb:y,highLightInfo:g,highLightColorIndex:a,widthOffset:b,heightOffset:P}}function mbe(o,t,e="none"){let{plane:r,colorIndex:i,point:n,text:s,angle:a,height:l,samplingPxLength:c,sampling:h,isDoubleRgb:u,highLightColorIndex:d,highLightInfo:p,widthOffset:m,heightOffset:g,camera:y}=t;o.save();let b=o.getContext();switch(e){case"none":{o.setFillStyle(r.getNetStringColor(i,u,!1,y));break}case"groupId":{r.setGroupHighLightStringColor(o,i,p.isForceHighLight,y);break}case"select":{r.highLightPtSetCustomizedColor(o,d,i,10);break}}o.setTranslate(n.x,n.y),o.setRotate(-a),o.setTextAlign("center"),o.setTextBaseLine("middle");let P=l/c;o.setFont(`normal ${P}px ${lk}`),b.fillText(s,m/c,-g/c),o.restore()}function jnt(o,t,e,r){if(!Sg(r))return;let i=bLe(e,t,r,"select");mbe(o,i,"select")}var k5t=II*3,v2e=(o=>(o[o.ID=0]="ID",o[o.POSITION_X=1]="POSITION_X",o[o.POSITION_Y=2]="POSITION_Y",o[o.ANGLE=3]="ANGLE",o[o.ORDER=4]="ORDER",o[o.GROUP_ID=5]="GROUP_ID",o))(v2e||{}),PLe=6,nE=[],TLe=class extends f0{create(o,t,e,r,i=-1){return nE[1]=t.x,nE[2]=t.y,nE[3]=e,nE[4]=r||0,nE[5]=i,nE}getBBox(o,t,e,r){let i=r[1],n=i+r[3],s=r[2],a=r[4]/2,l=s/2,c=o[t+1],h=o[t+2],u=o[t+3];if(u===0)return ul.modify(c,c+n,h-l,h+l);let d=Hl(0,0,u),p=Hl(i,l,u),m=Hl(i,-l,u),g=Hl(n,a,u),y=Hl(n,-a,u),b={x:c+d.x,y:h+d.y},P={x:c+p.x,y:h+p.y},T={x:c+m.x,y:h+m.y},I={x:c+g.x,y:h+g.y},C={x:c+y.x,y:h+y.y};return ul.modify(Math.min(b.x,P.x,T.x,I.x,C.x),Math.max(b.x,P.x,T.x,I.x,C.x),Math.min(b.y,P.y,T.y,I.y,C.y),Math.max(b.y,P.y,T.y,I.y,C.y))}},Xnt=class extends TLe{create(o,t,e,r,i=-1){return super.create(o,t,e,r,i),nE[0]=o+(67<<fa)+Is,nE}},qnt=class extends TLe{create(o,t,e,r,i=-1){return super.create(o,t,e,r,i),nE[0]=o+(68<<fa)+Is,nE}},ILe=new Xnt(67,PLe,v2e),CLe=new qnt(68,PLe,v2e);function $nt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=SLe(e,t,r);l&&(P1(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&gbe(o,l),(n=l.highLightInfo)!=null&&n.ctx&&gbe(l.highLightInfo.ctx,l,"groupId"))}function SLe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,highLightColorIndex:a,pxLength:l,scale:c}=e,h=o.get(t+5),u=i.getFixedPtData(),d=i.getPtColorIndex(u[0],h);if(r!=="select"&&!Md(d,i.scene.colors))return;let p=new S(o.get(t+1),o.get(t+2)).multiply4(s),m=o.get(t+3),g=Math.max(u[1],l),y=Math.max(u[2],l),b=Math.max(u[3],l),P=Math.max(u[4],l),T=r==="select"?null:n(h),I=_h.isDoubleRgb(h,i.scene.ptGroup.getData());return{...e,colorIndex:d,groupIdIndex:h,point:p,angle:m,isDoubleRgb:I,highLightInfo:T,highLightColorIndex:a,arrowWidth:g*c,arrowHeight:y*c,arrowLineLength:b*c,arrowLineWidth:P*c}}function gbe(o,t,e="none"){let{plane:r,colorIndex:i,point:n,angle:s,isDoubleRgb:a,highLightColorIndex:l,highLightInfo:c,arrowWidth:h,arrowHeight:u,arrowLineLength:d,arrowLineWidth:p,camera:m}=t;o.save();let g=o.getContext();switch(e){case"none":{o.setFillStyle(r.getNetStringColor(i,a,!1,m));break}case"groupId":{r.setGroupHighLightStringColor(o,i,c.isForceHighLight,m);break}case"select":{r.highLightPtSetCustomizedColor(o,l,i,10);break}}o.setTranslate(n.x,n.y),o.setRotate(-s),g.beginPath(),g.moveTo(0,0),g.lineTo(h,-u/2),g.lineTo(h,u/2),g.moveTo(h,-p/2),g.lineTo(h+d,-p/2),g.lineTo(h+d,p/2),g.lineTo(h,p/2),g.closePath(),g.fill(),o.restore()}function Knt(o,t,e,r){if(!Sg(r))return;let i=SLe(e,t,r,"select");gbe(o,i,"select")}function Znt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=ELe(e,t,r);l&&(P1(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&ybe(o,l),(n=l.highLightInfo)!=null&&n.ctx&&ybe(l.highLightInfo.ctx,l,"groupId"))}function ELe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,highLightColorIndex:a,pxLength:l,scale:c}=e,h=o.get(t+5),u=i.getFixedPtData(),d=i.getPtColorIndex(u[0],h);if(r!=="select"&&!Md(d,i.scene.colors))return;let p=new S(o.get(t+1),o.get(t+2)).multiply4(s),m=o.get(t+3),g=u[5],y=u[1],b=u[2],P=u[3],T=g/b,I=Math.max(Math.min(y*c,y*T),1),C=Math.max(Math.min(b*c,b*T),1),E=Math.max(Math.min(P*c,P*T),1),O=1,_=r==="select"?null:n(h),R=_h.isDoubleRgb(h,i.scene.ptGroup.getData());return{...e,colorIndex:d,groupIdIndex:h,point:p,angle:m,isDoubleRgb:R,highLightInfo:_,highLightColorIndex:a,arrowWidth:I,arrowHeight:C,arrowLineLength:E,arrowLineWidth:O}}function ybe(o,t,e="none"){let{plane:r,colorIndex:i,point:n,angle:s,isDoubleRgb:a,highLightColorIndex:l,highLightInfo:c,arrowWidth:h,arrowHeight:u,arrowLineLength:d,arrowLineWidth:p,camera:m}=t;o.save();let g=o.getContext();switch(e){case"none":{o.setFillStyle(r.getNetStringColor(i,a,!1,m));break}case"groupId":{r.setGroupHighLightStringColor(o,i,c.isForceHighLight,m);break}case"select":{r.highLightPtSetCustomizedColor(o,l,i,10);break}}o.setTranslate(n.x,n.y),o.setRotate(-s),g.beginPath(),g.moveTo(0,0),g.lineTo(h,-u/2),g.lineTo(h,u/2),g.moveTo(h,-p/2),g.lineTo(h+d,-p/2),g.lineTo(h+d,p/2),g.lineTo(h,p/2),g.closePath(),g.fill(),o.restore()}function Jnt(o,t,e,r){if(!Sg(r))return;let i=ELe(e,t,r,"select");ybe(o,i,"select")}var x2e=class{constructor(o,t,e){this.outMatrixParamMap=new Map,o&&(this.color=o),t&&(this.material=t),e&&(this.label=e)}getMaterial(){return this.material}setMaterial(o){this.material=o}getColor(){return this.color}setColor(o){this.color=o}updateMatrix(o){for(let t of o.entries())this.outMatrixParamMap.has(t[0])?(this.outMatrixParamMap.set(t[1],this.outMatrixParamMap.get(t[0])),this.outMatrixParamMap.delete(t[0])):this.outMatrixParamMap.set(t[1],{visible:!0,color:ee.BLACK})}markDrawn(o,t){this.outMatrixParamMap.get(o).renderI=t}hadDrawn(o,t){return this.outMatrixParamMap.get(o).renderI===t}removeOutMatrixs(o){for(let t of o)this.outMatrixParamMap.delete(t);this.outMatrixParamMap.size===0&&this.clear()}setOutMatrixVisible(o,t){this.outMatrixParamMap.get(t).visible=o}setSingleColor(o,t){this.outMatrixParamMap.get(t).color=o}getSingleColor(o){return this.outMatrixParamMap.get(o).color}},gv=2*Math.PI,Qnt=.75;function eRe(o,t){let e=t[2],r=t[6];return e/r>o}var WZ={0(o,t,e,r,i){let n={...r,highLightColorIndex:i};ont(o,t,e,n)},1(o,t,e,r,i){let n={...r,highLightColorIndex:i};Qit(o,t,e,n)},16(o,t,e,r,i){let n={...r,highLightColorIndex:i};xit(o,t,e,n)},17(o,t,e,r,i){let n={...r,highLightColorIndex:i};knt(o,t,e,n)},19(o,t,e,r,i){let n={...r,highLightColorIndex:i};ant(o,t,e,n)},2(o,t,e,r,i,n=!1){o.save();let s={...r,highLightColorIndex:i,isNobodyRect:n};fnt(o,t,e,s),o.restore()},5(o,t,e,r,i){o.save();let n={...r,highLightColorIndex:i};cnt(o,t,e,n),o.restore()},15(o,t,e,r,i){let n={...r,highLightColorIndex:i};Nit(o,t,e,n)},3(o,t,e,r,i){let n={...r,highLightColorIndex:i};gnt(o,t,e,n)},4(o,t,e,r,i){let n={...r,highLightColorIndex:i};bnt(o,t,e,n)},6(o,t,e,r){Uit(o,t,{...e,highLightColorIndex:r})},7(o,t,e,r){Xit(o,t,{...e,highLightColorIndex:r})},8(o,t,e,r,i){$it(o,t,{...e,staticPolygonInfoBuilder:r,highLightColorIndex:i})},9(o,t,e,r,i){Zit(o,t,{...e,staticPolygonInfoBuilder:r,highLightColorIndex:i})},10(o,t,e,r,i){let n={...r,highLightColorIndex:i};unt(o,t,e,n)},66(o,t,e,r,i){let n={...r,highLightColorIndex:i};jnt(o,t,e,n)},67(o,t,e,r,i){let n={...r,highLightColorIndex:i};Knt(o,t,e,n)},68(o,t,e,r,i){let n={...r,highLightColorIndex:i};Jnt(o,t,e,n)}},OL=class extends x2e{constructor(o,t,e,r=!0,i=!0,n=!1,s=!1,a=!1){i||(r=!1),super(t,void 0,e),this.ignoreForceHighLightEffect=s,this.textures=[],this.bboxFac2=new _e,this.ptNum=0,this.ptTypeNum=Array(69).fill(0),this.id=1,this.isColorful=!1,this.visible=!0,this._highLightPtByIdNum=0,this.networkTextColor=ee.WHITE,this.polygonColorAlphaRatio=1,this.alphaOverlay=1,this.schNetworkHighLightStatus=!1,this.isUnderGrid=!1,this.interPlanes=[this],this.deactivateAlphaRatio=1,this.setNoBodyRectColor=(l,c,h,u,d,p,m=null,g=this.scene.getRenderMode())=>{let y=p!==void 0?p:_h.isDoubleRgb(d,this.scene.ptGroup.getData()),{noSetCustomizedColor:b,color:P}=this.getCustomizedColor(u,y,void 0,c,!1,m,g);b&&(P=this.scene.highLightColor[h]),P=P.mulAlpha(.5);let T=P.toCSS();l.setFillStyle(T),l.setStrokeStyle(T)},this.subPlanes=[],this.transparentObjs=[],this.renderTexture=!0,this.renderOther=!0,this.parts=[{matrix:Qe.ORIGIN,plane:this}],this.alwaysUpdateBBox=!0,this.dictOutMatrixRenderCfg={},this.originalColor=t,this.scene=o,this.isNormal=r,this.label=e,this.isUnderGrid=a,this.underGridError(),this.builder=new Xrt(o,this),this.panelize=i,this.isHighLight=n,!r&&!n?o.hardRenderPlane.push(this):(n||(this.levelTextureManager=o.levelTextureManager,o.normalPlanes.push(this)),this.highLightTextureManager=o.highLightLevelTextureManager)}set highLightPtByIdNum(o){this._highLightPtByIdNum=o}get highLightPtByIdNum(){return this._highLightPtByIdNum}setIsColorful(o){this.isColorful!=o&&(this.isColorful=o)}getPtBBox(o,t=0,e=this.scene.staticPolygonInfoBuilder,r=this.scene.getFixedPtData()){return Ur.getBBox(o,t,e,r)}underGridError(){if(this.isUnderGrid&&this.isNormal)throw new Error("Under grid plane is normal")}setNetworkHighLightStatus(o){o!=this.schNetworkHighLightStatus&&(this.schNetworkHighLightStatus=o,this.scene.clearAccelerateTexture(),this.scene.needRender=!0)}setNetworkTextColor(o){this.networkTextColor!=o&&(this.networkTextColor=o)}setPolygonColorAlphaRatio(o){this.polygonColorAlphaRatio!=o&&(this.polygonColorAlphaRatio=o)}setAlphaOverlay(o){this.alphaOverlay!=o&&(this.alphaOverlay=o,this.setColor(ee.of6(this.color,this.color.alpha*o)))}getPtNum(){return this.ptNum||0}getPtTypeNum(){return this.ptTypeNum}getHighLightPtNumById(){return this.highLightPtByIdNum}getDashedArray(o,t,e){let r=[];return o==-1||(r=Array.from(this.scene.dashedInfoBuilder.slice(o+1,this.scene.dashedInfoBuilder.get(o)+o+1)),this.isSchOnePxStatus(e))||(r=r.map(i=>i*t)),r}getStringColor(){return ee.of6(this.networkTextColor,this.networkTextColor.alpha+.1)}getPtColorIndex(o,t){if(LO(o))return o;let e=_h.getColorIndex(t,this.scene.ptGroup.getData());return LO(e)?e:o}ptSetCustomizedColor(o,t,e,r,i,n,s,a=!1){let l=this.scene.ptGroup.getData(),c=s!==void 0?s:_h.isDoubleRgb(n,l),h=_h.isForceHighLight(n,l),{style:u,noSetCustomizedColor:d}=this.getCustomizedColor(e,c,h,t,a,r,i);d||u&&(o.setFillStyle(u),o.setStrokeStyle(u))}setGroupHighLightColor(o,t,e,r,i=!1){let n=this.getGroupHighLightColor(e,r,t,i);n&&(o.setFillStyle(n),o.setStrokeStyle(n))}getGroupHighLightColor(o,t,e,r=!1,i=null,n=this.scene.getRenderMode()){if(this.scene.getGlobalHighLightType()===0||!t)return;let{style:s}=this.getCustomizedColor(o,!1,t,e,r,i,n);return s}setGroupHighLightStringColor(o,t,e,r){if(this.scene.getGlobalHighLightType()===0||!e)return;let i=this.getNetStringColor(t,!1,!!e,r);i&&(o.setFillStyle(i),o.setStrokeStyle(i))}setRenderShadowInfo(o,t,e,r=0,i=0){if(e===0||!t)return;o.setShadowBlur(t);let n=LO(e);o.setShadowColor(this.scene.colors[n].toCSS()),o.setShadowOffsetX(r),o.setShadowOffsetY(i)}setRenderRectShadowInfo(o,t,e,r=0,i=0,n){if(e===0||!t)return;let s=LO(e),a;bW.includes(this.scene.getSceneType())&&!n&&this.schNetworkHighLightStatus&&(a=this.getSchPtColor(s)),o.setShadowBlur(t),o.setShadowColor(a.toCSS()),o.setShadowOffsetX(r),o.setShadowOffsetY(i)}highLightPtSetCustomizedColor(o,t,e,r,i){let n=0;if(!t&&t!==0?n=1:n=kL(t),!this.scene.getForceVisibleHighLightPt()&&!this.isColorful&&n&&r!==10){let l=this.color.toCSS();o.setFillStyle(l),o.setStrokeStyle(l);return}let s;if(n)if(r==10&&e==0)s=this.getStringColor();else{let l=LO(e);s=this.getPtColor(l,!0,i)}else{let l=LO(t);if(l==0||(s=this.scene.colors[l],s.r+s.g+s.b===0))return}let a=s.toCSS();o.setFillStyle(a),o.setStrokeStyle(a)}getSemicirclePtHighLightFillStyle(o,t){let e=LO(o);return this.getPtColor(e,t).toCSS()}getOrInitId(){return 1}createOrUpdatePt(o,t){return t!=null&&t>=0?this.updatePt(t,o):t=this.addPt(o),t}createOrUpdateCircle(o,t,e,r,i,n,s){return this.createOrUpdatePt(A2e.create(this.getOrInitId(),t,e,i,this.scene.getColorIndex(r),n,s),o)}createOrUpdatePoint(o,t,e,r,i,n,s){return this.createOrUpdatePt(Jbe.create(this.getOrInitId(),t,e,r,this.scene.getColorIndex(i),n,s),o)}createOrUpdateLine(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.scene.getColorIndex(c),m=this.scene.addDashedInfo(l);return this.createOrUpdatePt(qwe.create(this.getOrInitId(),t,e,r,i,s,this.scene.getColorIndex(n),a,m,p,h,u,d),o)}createOrUpdateRectShadowFrame(o,t,e,r,i,n,s,a,l){return this.createOrUpdatePt(Vnt.create(this.id,t,e,r,i,this.scene.getColorIndex(n),s,a,l),o)}createOrUpdateRect(o,t,e,r,i,n=0,s,a,l,c){return this.createOrUpdatePt(_we.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l,c),o)}createRect(o,t,e,r,i,n){this.createOrUpdateRect(-1,o.leftUpPoint,o.width,o.height,qh.toRadians(o.angle),o.radius,t,e,r,i)}createOrUpdateDrcArrow(o,t,e,r,i){return this.createOrUpdatePt(this.scene.drcRenderModel===1?ILe.create(this.id,t,e,r,i):CLe.create(this.id,t,e,r,i),o)}addHighLightPt(o,t,e,r=0){var i;let n=this.scene.getColorIndex(e,r),s=this.builder.addHighLightPt(o,t,n);(i=this.highLightTextureManager)==null||i.update(this.getPtBBox(s)),this.highLightPtByIdNum++}removeHighLightPt(o,t,e,r=0){var i;let n=this.scene.getColorIndex(e,r),{pt:s,num:a}=this.builder.removeHighLightPt(o,t,n);(i=this.highLightTextureManager)==null||i.update(this.getPtBBox(s)),this.highLightPtByIdNum-=a}setHighLightPtNum(o,t,e,r,i=0){let n=this.scene.getColorIndex(r,i),s=this.builder.setHighLightPtNum(o,t,e,n);this.scene.highLightLevelTextureManager.update(this.getPtBBox(s)),this.highLightPtByIdNum+=e}addHighLightPts(o,t,e,r=0){switch(o[0]){case 1:for(let i=1;i<o.length;i++)this.addHighLightPt(o[i],t,e,r);break;case 0:for(let i=2;i<o.length;i++)this.addHighLightPt(o[i],t,e,r);break;default:throw new Error("addHighLightPts not support")}}removeHighLightPts(o,t,e,r=0){switch(o[0]){case 1:for(let i=1;i<o.length;i++)this.removeHighLightPt(o[i],t,e,r);break;case 0:for(let i=2;i<o.length;i++)this.removeHighLightPt(o[i],t,e,r);break;default:throw new Error("removeHighLightPts not support")}}setHighLightPtsNum(o,t,e,r,i=0){switch(o[0]){case 1:for(let n=1;n<o.length;n++)this.setHighLightPtNum(o[n],t,e,r,i);break;case 0:for(let n=2;n<o.length;n++)this.setHighLightPtNum(o[n],t,e,r,i);break;default:throw new Error("setHighLightPtsNum not support")}}createOrUpdateLineSegment(o,t,e,r,i,n,s,a,l){return this.createOrUpdatePt(e2e.create(this.getOrInitId(),t,e,r,i,n,a,this.scene.getColorIndex(s),l),o)}createOrUpdateArc(o,t,e,r,i,n,s,a,l,c,h){e<zJ&&(e=zJ),n<0&&(i+=n,n=-n),i%=gv,i<0&&(i+=gv);let u=this.scene.addDashedInfo(h);return this.createOrUpdatePt(Swe.create(this.getOrInitId(),t,e,r,i,n,a,this.scene.getColorIndex(s),l,u,c),o)}createOrUpdateEllipse(o,t,e,r,i,n,s,a,l,c,h="round",u,d=0,p,m){let g=this.scene.addDashedInfo(c),y=sk[h],b=this.scene.getColorIndex(l),P=this.scene.getColorIndex(u);return this.createOrUpdatePt(sQ.create(this.id,t,e,r,i,n,s,a,b,g,y,P,d,p,m),o)}createOrUpdateBezier(o,t,e,r,i,n,s,a,l="round",c,h){let u=this.scene.addDashedInfo(a),d=sk[l],p=this.scene.getColorIndex(s);return this.createOrUpdatePt(m2e.create(this.id,t,e,r,i,n,p,u,d,c,h),o)}createOrUpdateSemicircle(o,t,e,r,i,n,s){return this.createOrUpdatePt(n2e.create(this.getOrInitId(),t,e,this.scene.getColorIndex(r),this.scene.getColorIndex(i),n,s),o)}createWireFramePts(o,t,e,r,i,n,s){o.forEach(a=>{if(a instanceof q){let l=qh.toRadians(a.sweepAngle),c=qh.toRadians(a.startAngle);l<0&&(c=c+l,l=-l),c%=gv,c<0&&(c+=gv),e.push(this.addPt(h2e.create(t,a.center,a.rx,c,l,r,i,s)))}else if(a instanceof Mr){let l=a.points(.1);for(let c=0;c<l.length-1;c+=1)e.push(this.addPt(mW.create(t,l[c],l[c+1],r,i,s)))}else a instanceof M?e.push(this.addPt(mW.create(t,a.start(),a.end(),r,i,s))):console.error("Not Support Primitive Type")})}createStaticWireFramePts(o,t,e,r,i,n){o.forEach(s=>{if(s instanceof q){let a=qh.toRadians(s.sweepAngle),l=qh.toRadians(s.startAngle);a<0&&(l=l+a,a=-a),l%=gv,l<0&&(l+=gv),e.push(this.addPt(p2e.create(t,s.center,s.rx,l,a,r),n))}else if(s instanceof Mr){let a=s.points(.1);for(let l=0;l<a.length-1;l+=1)e.push(this.addPt(gW.create(t,a[l],a[l+1],r),n))}else s instanceof M?e.push(this.addPt(gW.create(t,s.start(),s.end(),r),n)):console.error("Not Support Primitive Type")})}createPolygon0(o,t,e,r,i,n,s=null,a,l,c,h=.1){var u,d;this.scene.addPolygonGroupId(l);let p=[],m=this.scene.getColorIndex(e);for(let g of t){if(!((u=g.primitives)!=null&&u.length))continue;o[0]===1?n(g.primitives,this.id,o,a,m,null,l):n(g.primitives,this.id,o,o[1],null,s);let y=[],b,P,T,I,C,E=(d=g.primitives)==null?void 0:d[g.primitives.length-1].end(),O=()=>{if(b){if(I>0)for(let D=0;D<I;D+=360)o.push(this.addPt(r(this.id,b,P,qh.toRadians(T+D),qh.toRadians(Math.min(I-D,360)),C,E,a,m,l),s));else for(let D=0;D>I;D-=360)o.push(this.addPt(r(this.id,b,P,qh.toRadians(T+D),qh.toRadians(Math.max(I-D,-360)),C,E,a,m,l),s));C.equals(E)||y.push(new M(C,E)),b=null}};if(g.primitives.forEach((D,w)=>{if(D instanceof q&&D.rx===D.ry){if(b){if(P===D.rx&&b.equals(D.center)&&Dv.eq(qh.regularD(T+I),qh.regularD(D.startAngle))){I+=D.sweepAngle,E=D.end();return}O()}b=D.center,P=D.rx,T=D.startAngle,I=D.sweepAngle,D.start().equals(E)||y.push(new M(E,D.start())),C=D.start()}else O(),D.start().equals(E)||y.push(new M(E,D.start())),y.push(D);E=D.end()}),O(),y.length===0)continue;let _=[];for(fe.build2(y).points(h,D=>_.push(D));_.length!==0&&_[0].equals(_[_.length-1]);)_.pop();if(_.length<3)continue;let R=_[0],v=[R];for(let D=1;D<_.length;D++){let w=_[D];R.equals(w)||(v.push(w),R=w)}v.length>=3&&p.push(v)}for(let g of p){let y=g.slice();for(let b=0;b<y.length-2;b+=2)o.push(this.addPt(i(this.id,y[b],y[b+1],y[b+2],a,m,l),s)),y.push(y[b])}return o}createPolygon(o,t,e,r,i,n=.1){return this.createPolygon0([1],o,t,(s,a,l,c,h,u,d,p,m)=>S2e.create(s,a,l,c,h,u,d,p,m,r,i),(s,a,l,c,h,u)=>T2e.create(s,a,l,c,h,u,r,i),this.createWireFramePts.bind(this),null,e,r,n)}createStaticPolygon(o,t,e,r,i,n,s,a){let l=this.scene.addStaticPolygonInfo(e,t,r,i);return this.createPolygon0([0,l],o,t,(c,h,u,d,p,m,g)=>xW.create(c,h,u,d,p,m,g,l,n),(c,h,u,d)=>vW.create(c,h,u,d,l,n),this.createStaticWireFramePts.bind(this),this.scene.staticPolygonInfoBuilder,e,r,s,a)}createStringPt(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.scene.getColorIndex(a),p=this.scene.addStringInfo(o),{strWidth:m,strHeight:g}=Rv.getStrInfo(o,n,s);return ck.create(this.getOrInitId(),t,m,g,e,o.length,p,r,i,l,d,c,h,u)}createScaleStringPt(o,t,e,r,i,n,s,a,l,c){let h=this.scene.getColorIndex(n),u=this.scene.addStringInfo(o),{strWidth:d,strHeight:p}=Rv.getStrInfo(o,r,i);return yLe.create(this.getOrInitId(),t,d,p,e,o.length,u,s,h,a,l,c)}createTextPt(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m){let g=this.scene.getColorIndex(n);i["font-family"]=hrt.getInstance().getApplyFontFamily(i["font-family"],this.scene.getTextFontFamilyCorrectionEnabled());let y=this.scene.addTextInfo(o,i),b=this.scene.getColorIndex(p);return pLe.create(this.getOrInitId(),y,r,t,e,g,s,a,l,c,h,u,d,b,m)}createOrUpdateNetWorkText(o,t,e,r,i,n,s,a,l,c,h,u,d){return this.createOrUpdatePt(this.createStringPt(t,e,r,i,n,s,a,l,h,c,u,d),o)}createOrUpdateScaleString(o,t,e,r,i,n,s,a,l,c,h){return this.createOrUpdatePt(this.createScaleStringPt(t,e,r,i,n,s,l,a,c,h),o)}createOrUpdateDrc(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.scene.getColorIndex(c),p=this.scene.addStringInfo(a),m=this.scene.addStringInfo(l);return this.createOrUpdatePt(Kbe.create(this.id,t,n,s,e,r,i,p,m,u,d,h),o)}createOrUpdateNormalString(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I){let C=Qe.ORIGIN.translate(e.x,e.y).rotate(n).setOrigin(e.x,e.y).scale(a?-l:l,s?-c:c);return this.createOrUpdateNormalStringMatrix(o,t,r,i,C,h,u,d,p,m,g,y,b,P,T,I)}createOrUpdateNormalStringMatrix(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g){return this.createOrUpdatePt(this.createTextPt(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g),o)}createOrUpdateTexture(o,t,e,r,i,n,s,a,l,c,h){var u,d,p;if(o==null||o<0){let m=new vL(n,e,t,i,r,a,l,c,h,this.scene);o=this.textures.findIndex(y=>!y),o===-1?(this.textures.push(m),o=this.textures.length-1):this.textures[o]=m;let g=m.getBBox();this.bboxFac2.ext5(g.minX,g.maxX,g.minY,g.maxY),this.isNormal&&((u=this.levelTextureManager)==null||u.update(g)),this.ptNum++,this.ptTypeNum[70]++}else{let m=this.textures[o],g=m.getBBox();this.isNormal&&((d=this.levelTextureManager)==null||d.update(g)),m.sycnStatus(n,e,t,i,r,a,l,c,h);let y=m.getBBox();this.bboxFac2.ext5(y.minX,y.maxX,y.minY,y.maxY),this.isNormal&&((p=this.levelTextureManager)==null||p.update(y))}return this.scene.needRender=!0,o}isRender(){return this.scene.getHasGroupForceHighLight()&&this.scene.getForceVisibleHighLightPt()&&!this.ignoreForceHighLightEffect?!0:this.visible}isVisible(){return this.visible}isHiddenGroupPt(o,t,e){let r=Ur.getGroupIdByBuilder(o,t,e);if(r==-1)return!1;let i=this.scene.ptGroup.getData();if(_h.isHidden(r,i))return!0;let n=_h.isForceHighLight(r,this.scene.ptGroup.getData());return!this.visible&&!n?!0:(!this.visible&&n&&(!this.scene.getForceVisibleHighLightPt()||this.ignoreForceHighLightEffect),!1)}setVisible(o){o!==void 0&&o!==this.visible&&this.scene.setStateInfo("plane_visible_"+this.label,o,this.isNormal),this.visible=o,this.scene.needRender=!0}clear(){this.ptNum=0,this.ptTypeNum=Array(69).fill(0),this.bboxFac2.clear(),this.builder.clear()}getArcSweepAngle(o,t,e){return e===le.CCW?t>o?t-o:t-o+gv:t<o?t-o:t-o-gv}createOrUpdateArcSegment(o,t,e,r,i,n,s,a,l){return this.createOrUpdateArc(o,t,e,0,r,this.getArcSweepAngle(r,i,n),s,a,l,"round",[])}setEmpty(){this.bboxFac2.clear()}isEmpty(){return this.parts.every(({plane:o})=>!o.bboxFac2.valid())}removeTexture(o){var t;this.isNormal&&((t=this.levelTextureManager)==null||t.update(this.textures[o].getBBox())),delete this.textures[o],--this.ptNum===0&&this.setEmpty(),this.ptTypeNum[70]--,this.scene.needRender=!0}removePt(o,t=this.scene.staticPolygonInfoBuilder){var e,r;let{oldPt:i,isHighLightPt:n}=this.builder.removePt(o);--this.ptNum===0&&this.setEmpty();let s=Ur.getType(i[0]);if(this.ptTypeNum[s]--,this.isUpdateAccelerateTexture(s)){let a=this.getPtBBox(i,0,t);(e=this.levelTextureManager)==null||e.update(a),n&&((r=this.highLightTextureManager)==null||r.update(a))}else if(this.isUpdateHighLightAccelerateTexture(s)){let a=this.getPtBBox(i,0,t);this.scene.highLightLevelTextureManager.update(a)}return{pt:i}}hiddenPt(o){var t;let{isUpdate:e,ptData:r}=this.builder.setPtVisible(o,!1);this.isNormal&&e&&((t=this.levelTextureManager)==null||t.update(this.getPtBBox(r)))}showPt(o){var t;let{isUpdate:e,ptData:r}=this.builder.setPtVisible(o,!0);this.isNormal&&e&&((t=this.levelTextureManager)==null||t.update(this.getPtBBox(r)))}removePoint(o){this.builder.removePt(o),--this.ptNum===0&&this.setEmpty(),this.ptTypeNum[5]--}hiddenPoint(o){this.builder.setPtVisible(o,!1)}showPoint(o){this.builder.setPtVisible(o,!0)}removePolygonPt(o){let t=this.scene.staticPolygonInfoBuilder,e;switch(o[0]){case 1:for(let i=1;i<o.length;i++){let{pt:n}=this.removePt(o[i],t);e===void 0&&(e=Ur.getGroupId(n,0,t))}break;case 0:let r=o[1];this.scene.removeStaticPolygonInfo(r);for(let i=2;i<o.length;i++){let{pt:n}=this.removePt(o[i],t);e===void 0&&(e=Ur.getGroupId(n,0,t))}break;default:throw new Error("ids error")}this.scene.removePolygonGroupId(e)}hiddenPolygonPt(o){switch(o[0]){case 1:for(let t=1;t<o.length;t++)this.hiddenPt(o[t]);break;case 0:for(let t=2;t<o.length;t++)this.hiddenPt(o[t]);break;default:throw new Error("ids error")}}showPolygonPt(o){switch(o[0]){case 1:for(let t=1;t<o.length;t++)this.showPt(o[t]);break;case 0:for(let t=2;t<o.length;t++)this.showPt(o[t]);break;default:throw new Error("ids error")}}setStaticPolygonInfo(o,t){let e=o[1],r=this.scene.staticPolygonInfoBuilder.copy();this.scene.setStaticPolygonInfo(e,t);let i=this.scene.staticPolygonInfoBuilder,n=s=>{var a,l;let c=this.builder.getPt(s);this.builder.updatePt(s,c,i);let h=this.getPtBBox(c,0,i);this.bboxFac2.ext5(h.minX,h.maxX,h.minY,h.maxY),this.isNormal&&((a=this.levelTextureManager)==null||a.update(h),(l=this.levelTextureManager)==null||l.update(this.getPtBBox(c,0,r)))};for(let s=2;s<o.length;s++)n(o[s])}updatePt(o,t){var e,r,i,n,s,a;let l=this.getPtBBox(t);this.bboxFac2.ext5(l.minX,l.maxX,l.minY,l.maxY);let{oldPt:c,isHighLightPt:h}=this.builder.updatePt(o,t,null),u=Ur.getType(c[0]);if(this.isUpdateAccelerateTexture(u)){(e=this.levelTextureManager)==null||e.update(l);let d;h&&((r=this.highLightTextureManager)==null||r.update(l),d=this.getPtBBox(c),(i=this.highLightTextureManager)==null||i.update(d)),(n=this.levelTextureManager)==null||n.update(d||this.getPtBBox(c))}else this.isUpdateHighLightAccelerateTexture(u)&&((s=this.highLightTextureManager)==null||s.update(l),(a=this.highLightTextureManager)==null||a.update(this.getPtBBox(c)))}setIsUnderGrid(o){this.isUnderGrid!=o&&(this.underGridError(),this.scene.setStateInfo("plane_isUnderGrid_"+this.label,o,this.isNormal),this.isUnderGrid=o,this.scene.needRender=!0)}getIsUnderGrid(){return this.isUnderGrid}getOriginalColor(){return this.originalColor||this.color}setColor(o){this.isColorful&&(this.originalColor=o),o!==this.color&&o!==void 0&&(this.scene.setStateInfo("plane_color"+this.label,o,this.isNormal),super.setColor(o),this.scene.needRender=!0)}getAllPtBbox(){return this.bboxFac2.valid()?this.bboxFac2.build1():null}getAllRgbRatio(){return this.scene.getForceDeactivateRatio()*this.getRgbRatio()}isUpdateAccelerateTexture(o){return!!(this.isNormal&&o!==10&&o!==5&&o!==19||o===19&&this.scene.drcRenderModel===1)}isUpdateHighLightAccelerateTexture(o){return!!this.isHighLight}addPt(o,t){var e,r;let i=this.getPtBBox(o,0,t),n=Ur.getType(o[0]);return this.bboxFac2.ext5(i.minX,i.maxX,i.minY,i.maxY),this.isUpdateAccelerateTexture(n)?(e=this.levelTextureManager)==null||e.update(i):this.isUpdateHighLightAccelerateTexture(n)&&((r=this.highLightTextureManager)==null||r.update(i)),this.ptNum++,this.ptTypeNum[n]++,this.builder.addPt(o,t,void 0,i)}render(o,t,e,r,i=!1,n,s,a){let l=!0;this.isNormal&&(l=!n),this.render0(s,o,t,!0,!this.isNormal||!n||i||this.scene.drcRenderModel===0,!0,l||i,a,!0,e,r,i,n,this.getMaterial(),this.renderTexture,this.renderOther)}render0(o,t,e,r,i,n,s,a,l=!1,c,h,u=!1,d=!1,p,m,g){let y=!1;this.renderedPtNum=0;let b=this.outMatrixParamMap.get(o);if(b){if(b.renderI===this.scene.renderI)return;b.renderI=this.scene.renderI}if(this.interPlanes.length===0||!this.isColorful&&(a===2&&this.getMaterial().alpha===0||(a===0||a===1)&&this.getColor().alpha===0)||this.noDrawing)return;let P=this.interPlanes.slice(),T=this.subPlanes.slice(),I=this.dictOutMatrixRenderCfg[o.toString()];if(I)if(I.replacePlane){T=I.listSubPlane;for(let _ of I.listInterPlane)_&&P.push(_)}else{for(let _ of I.listSubPlane)_&&T.push(_);for(let _ of I.listInterPlane)_&&P.push(_)}if(P.length==1&&!T.length){y=P[0].renderByMatrix0(o,t,e,r,i,n,s,a,l,c,h,u,d,p,!1,m,g);return}this.planeCanvas?this.planeCanvasCtx.reset():(this.planeCanvas=document.createElement("canvas"),this.planeCanvasCtx=new Tf(this.planeCanvas.getContext("2d"))),this.tempCanvas?this.tempCanvasCtx.reset():(this.tempCanvas=document.createElement("canvas"),this.tempCanvasCtx=new Tf(this.tempCanvas.getContext("2d")));let C=t.getWidth(),E=t.getHeight();this.planeCanvas.width=C,this.planeCanvas.height=E,this.tempCanvas.width=C,this.tempCanvas.height=E;let O=P[0].renderByMatrix0(o,t,this.planeCanvasCtx,r,i,n,s,a,l,c,h,u,d,p,!1,m,g);if(O&&(y=O),P.length!==1){this.planeCanvasCtx.setGlobalCompositeOperation("destination-in");for(let _=0;_<P.length;_++){let R=P[_].renderByMatrix0(o,t,this.tempCanvasCtx,r,i,n,s,a,l,c,h,u,d,p,!0,m,g);this.planeCanvasCtx.getContext().drawImage(this.tempCanvas,0,0),this.tempCanvasCtx.getContext().clearRect(0,0,C,E),R&&(y=R)}}this.planeCanvasCtx.setGlobalCompositeOperation("destination-out");for(let _ of T){let R=_.renderByMatrix0(o,t,this.planeCanvasCtx,r,i,n,s,a,l,c,h,u,d,p,!0,m,g);R&&(y=R)}return e.getContext().drawImage(this.planeCanvas,0,0),this.planeCanvasCtx.setGlobalCompositeOperation("source-over"),y}renderHighLightPt(o,t,e,r,i,n,s){this.builder.getPtNum()!==0&&this.renderHighLightMatrix(o,t,e,!0,r,i,n,s)}getPtColor(o,t,e=!1){let r,i=this.color;return t&&!this.isColorful&&this.scene.getForceVisibleHighLightPt()&&(i=this.getOriginalColor()),o==0?(r=i,e&&(r=r.mulAlpha(this.polygonColorAlphaRatio))):(r=this.scene.colors[o],r.r+r.g+r.b==0&&(r=ee.of6(i,r.alpha)),r=r.mulAlpha(i.alpha)),r}getSchPtColor(o){let t=o===0?this.color:this.scene.colors[o],e=yW.getAlpha()||Qnt,r=this.scene.getDrawingBgColor().mulAlpha(e);t=t.mul(t.alpha),r=r.mul(r.alpha);let i=r.r+t.r*(1-r.alpha),n=r.g+t.g*(1-r.alpha),s=r.b+t.b*(1-r.alpha),a=r.alpha+t.alpha*(1-r.alpha);return ee.build(i,n,s,a).mul(1/a)}getCustomizedColor(o,t=!1,e=!1,r,i,n,s){let a,l=!1,c,h=LO(o);if(s===2){if(h===0)return l=!0,{style:null,noSetCustomizedColor:l};let{style:u,color:d}=this.getPlaneMaterialColorString(r,h,n);a=u,c=d}else{if(!e&&(h===0&&!t||!this.isColorful))return l=!0,{style:null,noSetCustomizedColor:l};if(c=h===0?this.color:this.scene.colors[h],bW.includes(this.scene.getSceneType()))!t&&this.schNetworkHighLightStatus&&(c=this.getSchPtColor(h));else if(c=this.getPtColor(h,e,i),!t&&!e){let u=this.getAllRgbRatio();c=c.mul(u)}a=c.toCSS()}return{style:a,noSetCustomizedColor:l,color:c}}getPlaneMaterialColorString(o,t,e){let r,i=this.scene.colors[t],n=i,s=o.getViewMatrix(),a=new Mt(0,0,1).multiply4(new Ae([s.data[0],s.data[1],s.data[2],s.data[3],s.data[4],s.data[5],s.data[6],s.data[7],s.data[8],s.data[9],s.data[10],s.data[11],0,0,0,1])).normalize(),l=ee.build(i.r*this.scene.ambientLight.color.r,i.g*this.scene.ambientLight.color.g,i.b*this.scene.ambientLight.color.b,1),c=Math.abs(a.dot(this.scene.directionalLight.direction())),h=ee.build(n.r*this.scene.directionalLight.color.r*c,n.g*this.scene.directionalLight.color.g*c,n.b*this.scene.directionalLight.color.b*c,1),u=ee.build(l.r+h.r,l.g+h.g,l.b+h.b,(e==null?void 0:e.alpha)||0);return r=u.toCSS(),{style:r,color:u}}setFillStyle(o,t,e,r,i,n=!1,s,a=!1,l,c){if(t===1){let h=this.getCustomizedColor(e,r,n,s,a,l,c).style;h&&o.setFillStyle(h)}else if(t===0)o.setFillStyle("rgba(0, 0, 0, 0)");else{let h=this.getCustomizedColor(e,r,void 0,s,a,l,c).style;h||(h=o.getContext().fillStyle),o.setFillStyle(this.scene.fillParam.getPattern(t,h,i))}}getNetStringColor(o,t,e,r,i=null,n=0){if(o==0){let s=this.getStringColor();if(t||e)return s.toCSS();let a=this.getAllRgbRatio();return s.mul(a).toCSS()}return this.getCustomizedColor(o,t,e,r,!1,i,n).style}isPanelize(){return this.panelize}getFillStyle(o,t,e,r=!1,i,n){return this.getCustomizedColor(o,t,void 0,e,r,i,n).style}setHighLightColor(o,t){let e=this.scene.highLightColor[t];if(e){let r=e.toCSS();o.setFillStyle(r),o.setStrokeStyle(r)}}renderByMatrix0(o,t,e,r,i,n,s,a,l=!1,c,h,u=!1,d=!1,p,m=!1,g,y){let b=!1;for(let P of this.parts){let T=P.matrix.toMatrix4().multiply4(o);P.plane.renderByMatrix(T,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y)&&(b=!0)}return b}getDefaultMaterialStyle(o,t=this.getMaterial()){let e=(t==null?void 0:t.ambient)||ee.BLACK,r=(t==null?void 0:t.diffuse)||ee.BLACK,i=o.getViewMatrix(),n=new Mt(0,0,1).multiply4(new Ae([i.data[0],i.data[1],i.data[2],i.data[3],i.data[4],i.data[5],i.data[6],i.data[7],i.data[8],i.data[9],i.data[10],i.data[11],0,0,0,1])).normalize(),s=ee.build(e.r*this.scene.ambientLight.color.r,e.g*this.scene.ambientLight.color.g,e.b*this.scene.ambientLight.color.b,1),a=Math.abs(n.dot(this.scene.directionalLight.direction())),l=ee.build(r.r*this.scene.directionalLight.color.r*a,r.g*this.scene.directionalLight.color.g*a,r.b*this.scene.directionalLight.color.b*a,1),c=ee.build(s.r+l.r,s.g+l.g,s.b+l.b,(t==null?void 0:t.alpha)||0);return{style:c.toCSS(),color:c}}renderByMatrix(o,t,e,r,i,n,s,a,l=!1,c,h,u=!1,d=!1,p,m=!1,g,y){var b,P,T,I,C,E;let O={style:"",ratio:1};d=this.isNormal&&d;let _=!1,R=!1,v=this.scene,D=o.multiply4(t.getRenderMatrix()),w=D.toMatrix3(),F=!w.isMirrored(),H=new Uint8ClampedArray(4),z=this.getAllRgbRatio(),G;a===2?G=this.getDefaultMaterialStyle(t,p).style:this.color&&(H.set([this.color.r*z*255,this.color.g*z*255,this.color.b*z*255,this.color.alpha]),G=ee.build(this.color.r*z,this.color.g*z,this.color.b*z,this.color.alpha).toCSS());let W=t.getSampling(),L=t.getScale()*W,B=t.getPxLength(),N=B/W,U=eRe(B,this.getFixedPtData()),k=t.getWidth()*W-1,V=t.getHeight()*W-1,Y={},X={},Z={},Q={},ae=[],he=[],re={},se={};this.setHighLightColor(c,0),this.setHighLightColor(h,1),e.setFillStyle(G),e.setStrokeStyle(G),e.setLineCap("round");let K=a!==1,me=this.scene.ptGroup.getData(),Oe=[],Ie={plane:this,getHighLightDrawInfo:J=>{if(J==-1)return null;if(_h.isHighLight(J,me)){let oe=_h.getHighLightGroupId(J,me),pe=_h.isForceHighLight(J,me);if(oe==0)return{highLightGroupId:oe,ctx:c,isForceHighLight:pe};if(oe==1)return{highLightGroupId:oe,ctx:c,isForceHighLight:pe}}return null},renderMatrix3:w,scale:L,sampling:W,onlyRenderHighLightPt:u,bNeedFill:K,camera:t,globalHighLightType:this.scene.getGlobalHighLightType(),renderMatrix:D,samplingPxLength:N,isMirrored:F,pxLength:B,currentRenderFont:O,groupIdBuilder:me,material:p,renderMode:a};Oe[0]=(J,oe)=>{nnt(e,J,oe,Ie)},Oe[1]=(J,oe)=>{Jit(e,J,oe,Ie)},Oe[4]=(J,oe)=>{ynt(e,J,oe,Ie)},Oe[16]=(J,oe)=>{vit(e,J,oe,Ie)},Oe[17]=(J,oe)=>{Nnt(e,J,oe,Ie)},Oe[19]=(J,oe)=>{snt(e,J,oe,Ie)},Oe[2]=(J,oe)=>{dnt(e,J,oe,Ie)},Oe[20]=(J,oe)=>{Gnt(e,J,oe,Ie)},Oe[15]=(J,oe)=>{Mit(e,J,oe,Ie)},Oe[3]=(J,oe)=>{mnt(e,J,oe,Ie)},Oe[11]=(J,oe)=>{Snt(e,J,oe,Ie)},Oe[13]=(J,oe)=>{Ont(e,J,oe,Ie)},Oe[12]=(J,oe)=>{Pnt(e,J,oe,Ie)},Oe[14]=(J,oe)=>{Int(e,J,oe,Ie)},Oe[5]=(J,oe)=>{lnt(e,J,oe,Ie)},Oe[6]=(J,oe)=>{Git(J,oe,{...Ie,triangleContainerArr:{trianglesArr:Y,doubleRgbTrianglesArr:Z,groupHighLightTrianglesArr:ae,groupForceHighLightTrianglesArr:re}})},Oe[7]=(J,oe)=>{jit(J,oe,{...Ie,circleContainerArr:{circlesArr:X,doubleRgbCirclesArr:Q,groupHighLightCirclesArr:he,groupForceHighLightCirclesArr:se}})},Oe[8]=(J,oe)=>{qit(J,oe,{...Ie,triangleContainerArr:{trianglesArr:Y,doubleRgbTrianglesArr:Z,groupHighLightTrianglesArr:ae,groupForceHighLightTrianglesArr:re}})},Oe[9]=(J,oe)=>{Kit(J,oe,{...Ie,circleContainerArr:{circlesArr:X,doubleRgbCirclesArr:Q,groupHighLightCirclesArr:he,groupForceHighLightCirclesArr:se}})},Oe[10]=(J,oe)=>{hnt(e,J,oe,Ie)},Oe[66]=(J,oe)=>{Ynt(e,J,oe,Ie)},Oe[18]=(J,oe)=>{wnt(e,J,oe,Ie)},Oe[67]=(J,oe)=>{$nt(e,J,oe,Ie)},Oe[68]=(J,oe)=>{Znt(e,J,oe,Ie)};let ue=v.staticPolygonInfoBuilder,Pe=(J,oe,pe)=>{let ge=Oe[oe];if(!ge){console.warn("Unsupported render type:",oe);return}let Se=Ur.getPtLengthByType(oe);for(let De=0;De<pe*Se;De+=Se)if(!(!(J.get(De)&Is)||this.isHiddenGroupPt(J,De,ue))){if(!this.scene.getRunCapture()){let tt=this.getPtBBox(J.slice(De,De+Se),0,ue).transform4(D);if(tt.minX>k||tt.maxX<0||tt.minY>V||tt.maxY<0)continue}_=!0,l&&this.renderedPtNum++,ge(De,J)}},j;if(!m&&!y?j=[]:j=this.builder.getBlocks(o,t,r,n,s,i),s){let J={};j.forEach((pe,ge)=>{pe.getBuilders().forEach((Se,De)=>{if(De===10||De===19||Ur.isWireFramePolygonType(De)&&K&&!this.scene.getGroupUseWireFramePolygon()||De===68&&!U)return;let tt=pe.getMaxLength(De);if(!tt)return;let Ze=Ur.getPtLengthByType(De);for(let Wt=0;Wt<tt*Ze;Wt+=Ze){if(!(Se.get(Wt)&Is)||this.isHiddenGroupPt(Se,Wt,ue))continue;let Nr=Se.slice(Wt,Wt+Ze);if(!this.scene.getRunCapture()){let Rr=this.getPtBBox(Nr,0,ue).transform4(D);if(Rr.minX>k||Rr.maxX<0||Rr.minY>V||Rr.maxY<0)continue}let Lr=Ur.getOrder(Nr,0,ue),Dr=(a!==1||this.scene.getGroupUseColorPolygon())&&Ur.isNormalPolygonType(De);if(J[Lr]||(J[Lr]={otherPts:[],polygonPts:!1}),Dr){let Rr=Oe[De];Rr(Wt,Se),J[Lr].polygonPts=!0}else J[Lr].otherPts.push(ge,De,Wt)}})}),d||this.textures.forEach(pe=>{let ge=pe.getOrder();J[ge]||(J[ge]={otherPts:[],polygonPts:!1}),J[ge].otherPts.push(pe)});let oe=Object.keys(J).sort((pe,ge)=>Number(ge)-Number(pe));for(let pe=0;pe<oe.length;pe++){let ge=oe[pe],Se=J[ge].otherPts,De=J[ge].polygonPts;for(let tt=0;tt<Se.length;tt+=0){if(_=!0,l&&this.renderedPtNum++,Se[tt]instanceof vL){g&&Se[tt].render(t,e,o),tt+=1;continue}let Ze=Se[tt+1],Wt=j[Se[tt]].getBuilders()[Ze],Nr=Se[tt+2],Lr=Oe[Ze];if(Ze==5&&!n||Ur.isNormalType(Ze)&&!s){tt+=3;continue}Lr(Nr,Wt),tt+=3}if(De){R=!0,_=!0;let tt=this.color,Ze=G;this.polygonColorAlphaRatio!==1&&(this.color=ee.of6(this.color,this.polygonColorAlphaRatio*this.color.alpha),G=ee.build(this.color.r*z,this.color.g*z,this.color.b*z,this.color.alpha).toCSS(),e.setFillStyle(G),e.setStrokeStyle(G));let Wt=Math.max(((b=Y[ge])==null?void 0:b.length)||0,((P=X[ge])==null?void 0:P.length)||0);hye(this,e,Wt,Y[ge]||[],X[ge]||[],K,!1,N,void 0,t,p,a);let Nr=Math.max(((T=Z[ge])==null?void 0:T.length)||0,((I=Q[ge])==null?void 0:I.length)||0);hye(this,e,Nr,Z[ge]||[],Q[ge]||[],K,!0,N,void 0,t,p,a);let Lr=Math.max(((C=re[ge])==null?void 0:C.length)||0,((E=se[ge])==null?void 0:E.length)||0);hye(this,e,Lr,re[ge]||[],se[ge]||[],K,!0,N,!0,t,p,a),e.setFillStyle(Ze),e.setStrokeStyle(Ze),this.color=tt,G=Ze}}}if(R){let J=this.color,oe=G;this.polygonColorAlphaRatio!==1&&(this.color=ee.of6(this.color,this.polygonColorAlphaRatio*this.color.alpha),G=ee.build(this.color.r*z,this.color.g*z,this.color.b*z,this.color.alpha).toCSS(),e.setFillStyle(G),e.setStrokeStyle(G)),Eit(c,h,K,ae,he),e.setFillStyle(oe),e.setStrokeStyle(oe),this.color=J,G=oe}return r&&j.forEach(J=>{J.getStringMaxPxLength()<B||J.drawString(B,(oe,pe,ge)=>Pe(oe,10,ge))}),i&&j.forEach(J=>{let oe=J.getBuilders()[19],pe=J.getMaxLength(19);!pe||this.scene.drcRenderModel===0&&J.getDrcPxLength()<B||Pe(oe,19,pe)}),_}renderHighLightMatrix(o,t,e,r=!0,i,n,s,a){let l=this.scene.staticPolygonInfoBuilder,c=o.getRenderMatrix(),h=c.toMatrix3(),u=!h.isMirrored(),d=o.getSampling(),p=o.getScale()*d,m=o.getWidth()*d,g=m-1,y=o.getHeight()*d-1,b=[],P=[],T=o.getPxLength(),I=eRe(T,this.getFixedPtData()),C=T/d,E=this.scene.getRenderMode()!==1,O=this.scene.highLightColor[e].toCSS();t.setFillStyle(O),t.setStrokeStyle(O),t.setLineCap("round");let _=this.scene.drcRenderModel===0,R=this.scene.drcRenderStyle===0,v={sampling:d,scale:p,width:m,trianglesArr:b,circlesArr:P,isMirrored:u,renderMatrix:c,renderMatrix3:h,pxLength:T,bNeedFill:E,samplingPxLength:C,isDrcRenderFixed:_,isDrcStyleCross:R,plane:this,camera:o,groupIdBuilder:this.scene.ptGroup.getData()},D=(H,z,G,W)=>{let L=Ur.getPtLengthByType(z);for(let B=0;B<W*eE;B+=eE){let N=G.get(B),U=G.get(B+1);if(N==-1)continue;let k=N*L;if(!(H.get(k)&Is))continue;let V=this.getPtBBox(H.slice(k,k+L),0,l).transform4(c);V.minX>g||V.maxX<0||V.minY>y||V.maxY<0||(z==8||z==9?WZ[z].call(this,k,H,v,l,U):z==6||z==7?WZ[z].call(this,k,H,v,U):WZ[z].call(this,t,k,H,v,U))}r&&(this.renderedPtNum+=W)},w=(H,z,G)=>{let W=Ur.getPtLengthByType(z);for(let L=0;L<G*W;L+=W){if(!(H.get(L)&Is))continue;let B=this.getPtBBox(H.slice(L,L+W),0,l).transform4(c);B.minX>g||B.maxX<0||B.minY>y||B.maxY<0||WZ[z].call(this,t,L,H,v,e,!0)}},F=this.builder.getBlocks(Ae.ORIGIN,o,s,a,i,n);this.isHighLight?F.forEach(H=>{H.getBuilders().forEach((z,G)=>{if(G!==2)throw new Error("Highlight Plane data is incorrect");let W=H.getMaxLength(G);W&&w(z,G,W)})}):F.forEach(H=>{let z=H.getHighLightIds(e);if(!z)return;let G=H.getBuilders();i&&G.forEach((W,L)=>{if(!H.getMaxLength(L)||L===10||L===19||Ur.isWireFramePolygonType(L)||L===68&&!I)return;let B=z[L],N=B==null?void 0:B.getMaxLength();N&&D(W,L,B.getData(),N)})}),_it(t,E,b,P,this),s&&F.forEach(H=>{let z=H.getHighLightIds(e,10);if(!z||H.getStringMaxPxLength()<T)return;let G;H.drawString(T,(W,L)=>{G=z[L];let B=G==null?void 0:G.getMaxLength();B&&D(W,10,G.getData(),B)})}),n&&F.forEach(H=>{let z=H.getHighLightIds(e);if(!z)return;let G=H.getBuilders()[19],W=z[19],L=W==null?void 0:W.getMaxLength();!L||!H.getMaxLength(19)||this.scene.drcRenderModel===0&&H.getDrcPxLength()<T||D(G,19,W.getData(),L)}),a&&F.forEach(H=>{let z=H.getHighLightIds(e);if(!z)return;let G=5,W=H.getBuilders()[G],L=z[G],B=L==null?void 0:L.getMaxLength();!B||H!=null&&H.getMaxLength(G)||D(W,G,L.getData(),B)})}getSceneGlobalHighLightType(){return this.scene.getGlobalHighLightType()}isSchOnePxStatus(o){return this.scene.getDrawLineWidthStyle()==1&&o===1}getRenderLineWidth(o,t,e){return this.isSchOnePxStatus(t)?o:Math.max(o,t*e)}setTemplateInstancePt(o,t,e,r){}setTemplateInstancePts(o,t,e,r){}addTemplateHighLightPt(o,t,e,r,i=0){}setTemplateHighLightPtNum(o,t,e,r,i,n=0){}removeTemplateHighLightPt(o,t,e,r,i=0){}addTemplateHighLightPts(o,t,e,r,i=0){}removeTemplateHighLightPts(o,t,e,r,i=0){}setTemplateHighLightPtsNum(o,t,e,r,i,n=0){}getPtBboxById(o){let t=this.builder.getPt(o);return this.getPtBBox(t).build()}getBBox(){try{let o=Number.NEGATIVE_INFINITY,t=Number.NEGATIVE_INFINITY,e=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;for(let i of this.interPlanes){let n=i.getBBox2ContainsPart();o=Math.max(n.minX,o),e=Math.min(n.maxX,e),t=Math.max(n.minY,t),r=Math.min(n.maxY,r)}return new by(o,t,0,e,r,0)}catch{return null}}getFixedPtData(){return this.scene.getFixedPtData()}setRgbRatio(o){o!==this.deactivateAlphaRatio&&(this.deactivateAlphaRatio=o,this.scene.setStateInfo("plane_deactivateAlphaRatio"+this.label,o,this.isNormal),this.scene.needRender=!0)}getRgbRatio(){return this.deactivateAlphaRatio}setRenderProcess(o=[this],t=[]){this.interPlanes=o.filter(e=>e),this.subPlanes=t.filter(e=>e&&!e.isEmpty())}sortTransparentObjs(){}getIsColorFul(){return this.isColorful}addPart(o,t){this.parts.push({matrix:o,plane:t}),this.scene.clearAccelerateTexture()}clearParts(){this.parts.length=0,this.scene.clearAccelerateTexture()}setPolygonAbleInter(o){}setAlwaysUpdateBBox(o){this.alwaysUpdateBBox=o}updateBBox(){try{let o=Number.NEGATIVE_INFINITY,t=Number.NEGATIVE_INFINITY,e=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;for(let i of this.interPlanes){let n=i.getAllPtBbox();o=Math.max(n.minX,o),e=Math.min(n.maxX,e),t=Math.max(n.minY,t),r=Math.min(n.maxY,r)}return this.bBox=new by(o,t,0,e,r,0),this.bBox}catch{return this.bBox=null,this.bBox}}addRenderProcess(o=[this],t=[]){for(let e of o)this.interPlanes.indexOf(e)<=-1&&this.interPlanes.push(e);for(let e of t)this.subPlanes.indexOf(e)<=-1&&this.subPlanes.push(e)}removeRenderProcess(o=[this],t=[]){for(let e of o){let r=this.interPlanes.indexOf(e);r>=0&&this.interPlanes.splice(r,1)}for(let e of t){let r=this.subPlanes.indexOf(e);r>=0&&this.subPlanes.splice(r,1)}}addOutMatrixRenderCfg(o,t){let e=o.getSelfAsOutToChildMatrix();for(let r of e){let i=this.outMatrixParamMap.get(r);i&&(t.visible=i.visible,this.dictOutMatrixRenderCfg[r.toString()]=t)}}removeOutMatrixRenderCfg(o,t){let e=o.getSelfAsOutToChildMatrix();for(let r of e)this.outMatrixParamMap.get(r)&&delete this.dictOutMatrixRenderCfg[r.toString()]}getBBox2ContainsPart(){let o=new _e;for(let t of this.parts){let{plane:e,matrix:r}=t,i=e.getAllPtBbox();i&&o.ext1(i.transform(r))}return o.valid()?o.build():null}getBBox2(){let o,t=this.getBBox();return t&&(o=t.toBBox2()),o}clearCpuMemory(){}getUnPanelBBox(){let o=new _e,{plane:t,matrix:e}=this.parts[0],r=t.getAllPtBbox();return r&&o.ext1(r.transform(e)),o.build()}};function uye(o,t){eot(o.iterator(),t)}function eot(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var zZ=new Error("list is empty"),YZ=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},tot=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},rot=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},Y7=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw zZ;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw zZ;return this.remove(o),o.item}addLast(o){return this.first===null||this.last===null?(this.first=new YZ(this,o),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new YZ(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw zZ;return this.first.item}getLast(){if(this.last===null)throw zZ;return this.last.item}insertAfter(o,t){let e=new YZ(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new YZ(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new tot(this.first)}listIterator(){return new rot(this.first)}toArray(){let o=new Array(this.cnt),t=this.first,e=0;for(;t!=null&&(o[e]=t.item,t=t.next,e++,!(t==this.first||e==this.cnt)););return o}};function dye(o){throw new Error("")}var jZ=class{constructor(o,t){this.node1=null,this.node2=null,this.key=o,this.value=t}},iot=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().key}},not=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().value}},OLe=class{constructor(){this.innerList=new Y7,this.innerMap={}}replace(o,t){o.node1!==null&&(o.node1.set(t),t.node1=o.node1),o.node2!==null&&(o.node2.set(t),t.node2=o.node2)}clear(){this.innerList.clear();for(let o in this.innerMap)delete this.innerMap[o]}put(o,t){let e=o.hashCode(),r=new jZ(o,t),i=this.innerMap[e];if(i===void 0)return r.node1=this.innerList.add(r),this.innerMap[e]=r,null;if(i instanceof jZ){if(i.key.equals(o))return this.innerMap[e]=r,this.replace(i,r),i.value;{r.node1=this.innerList.add(r);let n=new Y7;return i.node2=n.add(i),r.node2=n.add(r),this.innerMap[e]=n,null}}if(i instanceof Y7){let n=null;return uye(i,(s,a)=>a.key.equals(o)?(this.replace(a,r),n=a.value,!1):!0),n===null?(r.node1=this.innerList.add(r),r.node2=i.push(r),null):n}return dye(i)}get(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof jZ)return e.key.equals(o)?e.value:null;if(e instanceof Y7){let r=null;return uye(e,(i,n)=>n.key.equals(o)?(r=n.value,!1):!0),r}return dye(e)}containsKey(o){return this.get(o)!==null}delete(o){o.node1!==null&&o.node1.parent.remove(o.node1),o.node2===null?delete this.innerMap[o.key.hashCode()]:o.node2.parent.remove(o.node2)}remove(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof jZ)return e.key.equals(o)?(this.delete(e),e.value):null;if(e instanceof Y7){let r=null;return uye(e,(i,n)=>n.key.equals(o)?(r=n.value,this.delete(n),!1):!0),r}return dye(e)}computeIfAbsent(o,t){let e=this.get(o);if(e===null){let r=t(o);return this.put(o,r),r}else return e}size(){return this.innerList.size()}isEmpty(){return this.innerList.size()===0}keys(){return new iot(this.innerList.iterator())}values(){return new not(this.innerList.iterator())}entries(){return this.innerList.iterator()}},T1=(o=>(o[o.NOTSHOW=0]="NOTSHOW",o[o.ONLYAXIS=1]="ONLYAXIS",o[o.SHOW=2]="SHOW",o))(T1||{}),bS=(o=>(o[o.Line=0]="Line",o[o.Point=1]="Point",o[o.None=2]="None",o))(bS||{}),oot=class{constructor(){this._visible=0,this._flip=!1,this._currentCoord=!0,this._gridColor=ee.WHITE,this._transparency=.3,this._multiGridColor=ee.WHITE,this._multiTransparency=.55,this._coordinateAxisColor=ee.WHITE,this._coordinateAxisTransparency=1,this._stepX=.5,this._stepY=.5,this._snapX=.5,this._snapY=.5,this._pattern=!0,this._multiRatio=5,this._multiStyle=2,this._angleDelta=Math.PI/4,this._startAngle=0,this._endAngle=pa,this._step=39.37,this._minRadius=3.937,this._maxRadius=393.7,this.updateListeners=[],this._gridInstance=null,this.pointSize=1,this._renderGrid=!0,this._renderCoordinateAxis=!0}set renderGrid(o){this._renderGrid!==o&&(this._renderGrid=o,this.updateListeners.forEach(t=>t()))}get renderGrid(){return this._renderGrid}set visible(o){o!==this._visible&&(this._visible=o,this.updateListeners.forEach(t=>t()))}get visible(){return this._visible}get flip(){return this._flip}set flip(o){this._flip=o,this.updateListeners.forEach(t=>t())}get gridColor(){return this._gridColor}set gridColor(o){this._gridColor=o,this._gridInstance!=null&&this._gridInstance.modifyColor(o,1-this.transparency),this.updateListeners.forEach(t=>t())}get currentCoord(){return this._currentCoord}set currentCoord(o){this._currentCoord=o,this.updateListeners.forEach(t=>t())}get minRadius(){return this._minRadius}set minRadius(o){this._minRadius=o,this.updateListeners.forEach(t=>t())}get maxRadius(){return this._maxRadius}set maxRadius(o){this._maxRadius=o,this.updateListeners.forEach(t=>t())}get angleDelta(){return this._angleDelta}set angleDelta(o){this._angleDelta=o,this.updateListeners.forEach(t=>t())}get radius(){return this._step}set radius(o){this._step=o,this.updateListeners.forEach(t=>t())}get startAngle(){return this._startAngle}set startAngle(o){o%=pa,o<0&&(o+=pa),this._startAngle=o,this.updateListeners.forEach(t=>t())}get endAngle(){return this._endAngle}set endAngle(o){this._endAngle=o,this.updateListeners.forEach(t=>t())}get sweepAngle(){return this.endAngle>this.startAngle?this.endAngle-this.startAngle:this.endAngle-this.startAngle+pa}addUpdateListener(o){this.updateListeners.push(o)}modify(o,t,e,r,i){this._stepX=o,this._stepY=t,this._snapX=e,this._snapY=r,this._pattern=i,this._gridInstance!=null&&this._gridInstance.flush(),this.updateListeners.forEach(n=>n())}updateGridParam(o,t,e,r){let i=o?2:1;this._stepX=t,this._stepY=e,o!==void 0&&(this.visible=i),r!==void 0&&(this._pattern=r),this._gridInstance!=null&&this._gridInstance.flush(),this.updateListeners.forEach(n=>n())}attach(o){this._gridInstance=o,this._gridInstance!=null&&(this._gridInstance.flush(),this._gridInstance.modifyColor(this._gridColor,1-this.transparency)),this.updateListeners.forEach(t=>t())}setGridX(o){o>0&&(this.updateListeners.forEach(t=>t()),this._stepX=o,this._gridInstance!=null&&this._gridInstance.flush())}getGridX(){return this._stepX}setGridY(o){o>0&&(this.updateListeners.forEach(t=>t()),this._stepY=o,this._gridInstance!=null&&this._gridInstance.flush())}getGridY(){return this._stepY}getPointSize(){return this.pointSize}setPointSize(o){o<0||o===this.pointSize||(this.pointSize=o,this.updateListeners.forEach(t=>t()))}getMultiRatio(){return this._multiRatio}setMultiRatio(o){o>=1&&(this._multiRatio=o,this.updateListeners.forEach(t=>t()))}getMultiStyle(){return this._multiStyle}setMultiStyle(o){return this.updateListeners.forEach(t=>t()),this._multiStyle=o}setSnapX(o){o>0&&(this.updateListeners.forEach(t=>t()),this._snapX=o)}getSnapX(){return this._snapX}setSnapY(o){o>0&&(this.updateListeners.forEach(t=>t()),this._snapY=o)}getSnapY(){return this._snapY}get pattern(){return this._pattern}set pattern(o){this.updateListeners.forEach(t=>t()),this._pattern=o,this._gridInstance!=null&&this._gridInstance.flush()}get transparency(){return this._transparency}set transparency(o){this.updateListeners.forEach(t=>t()),this._transparency=o,this._gridInstance!=null&&this._gridInstance.modifyColor(this._gridColor,1-this.transparency)}get multiGridColor(){return this._multiGridColor}set multiGridColor(o){this.updateListeners.forEach(t=>t()),this._multiGridColor=o}get multiTransparency(){return this._multiTransparency}set multiTransparency(o){this.updateListeners.forEach(t=>t()),this._multiTransparency=o}get coordinateAxisColor(){return this._coordinateAxisColor}set coordinateAxisColor(o){this.updateListeners.forEach(t=>t()),this._coordinateAxisColor=o}get coordinateAxisTransparency(){return this._coordinateAxisTransparency}set coordinateAxisTransparency(o){this.updateListeners.forEach(t=>t()),this._coordinateAxisTransparency=o}set renderCoordinateAxis(o){this.updateListeners.forEach(t=>t()),this._renderCoordinateAxis=o}get renderCoordinateAxis(){return this._renderCoordinateAxis}},pye=1e5;function ALe(o,t,e,r){let i=o.getScale(),n=0,s=i;for(;;)if(s>=1){if(s=s/10,s<1)break;n++}else if(s=s*10,n--,s>=1)break;let a=i/Math.pow(10,n);return a>=1&&a<2?i=Math.pow(10,n):a>=2&&a<5?i=2*Math.pow(10,n):i=5*Math.pow(10,n),i=i>500?500:i,t.conversion1("mil",e,r)/i}var fye=7,_Le=class{constructor(o,t,e){this.plane=o,this.camera=t,this.arcTextColor=ee.WHITE,this.textDxDyFontSize=14,this.textDlFontSize=14,this.textAngleFontSize=14,this.unitConversion=new ML,this.unit="mil",this.longLinePxLength=20,this.middleLinePxLength=14,this.shortLinePxLength=8,this.scaleFontSize=14,this.arcRadius=40,this.showAngleInfo=!0,this.showTextMilInfo=!0,this.unitScale=1,this.useEnTranslate=!1,this.leftAndRightSpacing=9,this.backgroundRectHeight=24,this.strokeLineColor=ee.Gray,this.data=e,this.bitmap=new Cg(4),this.bitmap.addTrimListener(r=>{this.data.trimChunk(r)}),this.measureIdAndNormalIds=new Map,this.measureIdAndRulerIds=new Map,this.measureIdAnTextInfoIds=new Map}get spacing(){return this.unitScale*10*10}setUseEnTranslate(o){this.useEnTranslate=o}setShowAngleInfo(o){this.showAngleInfo=o}setShowTextMilInfo(o){this.showTextMilInfo=o}setMeasureToolPtStyle(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T){this.scaleColor=o,this.scaleTextColor=t,this.textColor=e,this.textDxDyBackgroundColor=r,this.textDLBackgroundColor=i,this.textAngleBackgroundColor=n,this.angleArcColor=s,this.textHeightMaxPxLimit=l,this.longLinePxLength=c,this.middleLinePxLength=h,this.shortLinePxLength=u,this.scaleFontSize=d,this.arcRadius=p,this.leftAndRightSpacing=m,this.textDxDyFontSize=g,this.textDlFontSize=y,this.textAngleFontSize=b,this.backgroundRectHeight=P,this.strokeLineColor=a,this.arcTextColor=T}getAngle(o,t){let e=o.sub(t).normalize();return Math.atan2(e.y,e.x)}getStartAndEndAngle(o,t){let e=0,r=0;return t.x>o.x?(e=t.y<=o.y?90*(Math.PI/180):-90*(Math.PI/180),r=this.getAngle(o,t)):t.x<o.x&&(e=this.getAngle(o,t),r=t.y<=o.y?90*(Math.PI/180):-90*(Math.PI/180)),{startAngle:e,endAngle:r}}getSweep(o,t){let e=o.sub(t).normalize();return new S(1,0).cross(e)>=0?le.CCW:le.CW}createLineSegment(o,t){return this.plane.createOrUpdateLineSegment(-1,o,t,!0,0,0,this.scaleColor,4)}createArcSegment(o,t){let{startAngle:e,endAngle:r}=this.getStartAndEndAngle(o,t);return this.plane.createOrUpdateArcSegment(-1,t,this.arcRadius,e,r,this.getSweep(o,t),this.angleArcColor)}conversion(o){let t=this.unitConversion.conversion("mil",this.unit,o);return t=Math.round(t*1e4)/1e3,t.toString()}createRuler(o,t,e,r){let i=ALe(this.camera,this.unitConversion,this.unit,this.spacing);i=this.unitConversion.conversion(this.unit,"mil",i)/10;let n=this.camera.getScale();this.LastScale=n;let s=[],a=t.distance1(r),l=e.distance1(r),c=e.sub(r).normalize(),h=t.sub(r).normalize(),u=1,d=this.shortLinePxLength/n,p=this.middleLinePxLength/n,m=this.longLinePxLength/n;for(let g=i;g<=a;g+=i){let y=r.add(h.mul(g)),b;if(u%10==0){b=y.add(c.mul(m));let T=this.plane.createOrUpdateNetWorkText(-1,this.conversion(g),b,0,5,15,pye,this.scaleFontSize,this.scaleTextColor);s.push(T)}else u%5==0?b=y.add(c.mul(p)):b=y.add(c.mul(d));let P=this.plane.createOrUpdateLineSegment(-1,y,b,!0,0,0,this.scaleColor,4);s.push(P),u++}u=1;for(let g=i;g<=l;g+=i){let y=r.add(c.mul(g)),b;if(u%10==0){b=y.add(h.mul(m));let T=this.plane.createOrUpdateNetWorkText(-1,this.conversion(g),b.add(h.mul(m)),0,5,this.textHeightMaxPxLimit,pye,this.scaleFontSize,this.scaleTextColor);s.push(T)}else u%5==0?b=y.add(h.mul(p)):b=y.add(h.mul(d));let P=this.plane.createOrUpdateLineSegment(-1,y,b,!0,0,0,this.scaleColor,4);s.push(P),u++}this.measureIdAndRulerIds.set(o,s)}getLengthInfo(o){let t=this.unitConversion.conversion("mil","mm",o)*10;t=Math.round(t*1e3)/1e3;let e="";return this.showTextMilInfo&&(e="("+(Math.round(o*100)/10).toFixed(1)+"mil)"),t.toFixed(3)+"mm"+e}createTextInfo(o,t,e,r,i){let n=this.camera.getScale(),s=(this.plane.scene.getPixelRatio()||1)/n,a=t,l=e;i&&(a=e,l=t);let c=a.distance1(r),h=l.distance1(r),u=t.distance1(e),{startAngle:d,endAngle:p}=this.getStartAndEndAngle(t,e),m=(Math.abs(d-p)/Math.PI*180).toFixed(3)+"\xB0",g=this.getLengthInfo(c),y=this.getLengthInfo(h),b=this.getLengthInfo(u),P=m,T=a.sub(r).normalize(),I=l.sub(r).normalize(),C=this.arcRadius,E=a.add(r).mul(.5),O=l.add(r).mul(.5),_=t.add(e).mul(.5).add(T.mul(10*s)),R=e,v=T.dot(new S(this.camera.getTar2Pos().z<0?-1:1,0))>0,D=I.dot(new S(0,1))>0,w=D?"topCenter":"bottomCenter",F=v?"rightCenter":"leftCenter",H=Number(D)^Number(i)?"bottomCenter":"topCenter",z=v?"leftBottom":"rightBottom";if(D||(z=v?"leftTop":"rightTop"),i?R=e.sub(I.mul(23*s)):D||(H=v?"leftTop":"rightTop"),i?c>.1&&h<.1?(F=v?"rightTop":"leftTop",R=R.add(new S(0,1).mul(43*s))):c<.1&&h>.1&&(F="rightCenter",E=E.sub(I.mul(43*s)),D?(H="leftTop",w="leftTop"):(H="leftBottom",w="leftBottom")):c>.1&&h<.1?(v?(F="rightTop",O=O.sub(T.mul(C+10*s))):F="leftTop",R=R.add(new S(0,1).mul(65*s))):c<.1&&h>.1&&(D?(H="rightBottom",w="rightTop"):(H="rightTop",w="rightBottom")),c<.1&&h<.1&&(R=r.add(new S(0,1).mul(C)),E=r.add(new S(-1,0).mul(C)),O=r.add(new S(1,0).mul(C)),H="bottomCenter",w="rightCenter",F="leftCenter"),h>.1&&c>.1){let W=this.backgroundRectHeight*s,L,B=!1;i?(v&&h<C||!v&&c<C)&&(L=a.add(new S(1,0).mul(C)),B=!0):(!v&&h<C||v&&c<C)&&(L=D?l:r,L=L.add(new S(1,0).mul(C)),B=!0),B&&(L=L.add(new S(0,1).mul(W)),w="leftTop",F="leftTop",H="leftTop",z="leftTop",E=L,O=E.add(new S(0,-1).mul(W)),R=O.add(new S(0,-1).mul(W)),_=R.add(new S(0,-1).mul(W)),g="DX: "+g,y="DY: "+y,P=this.useEnTranslate?"R":"\u89D2\u5EA6: "+P,b=this.useEnTranslate?"L":"\u957F\u5EA6: "+b)}let G=[];this.createTextAndRect(g,E,w,G,this.textDxDyBackgroundColor,this.textDxDyFontSize),this.createTextAndRect(y,O,F,G,this.textDxDyBackgroundColor,this.textDxDyFontSize),this.createTextAndRect(P,R,H,G,this.textAngleBackgroundColor,this.textAngleFontSize,this.arcTextColor),Math.abs(c)>=1e-8&&Math.abs(h)>=1e-8&&this.createTextAndRect(b,_,z,G,this.textDLBackgroundColor,this.textDlFontSize),this.measureIdAnTextInfoIds.set(o,G)}createStrokeLine(o,t){return this.plane.createOrUpdateLineSegment(-1,o,t,!0,0,0,this.strokeLineColor,2)}createTextAndRect(o,t,e,r,i,n,s=this.textColor){let a=pye,l=this.camera.getScale(),c=n,h=this.backgroundRectHeight/l,{strWidth:u,strHeight:d}=Rv.getStrInfo(o,a,c),p=(u+this.leftAndRightSpacing*2)/l,m=p*.5,g=h*.5,y;switch(e){case"bottomCenter":{y=t.add1(-m,h);break}case"leftBottom":{y=t.add1(0,h);break}case"leftCenter":{y=t.add1(0,g);break}case"leftTop":{y=t;break}case"rightBottom":{y=t.add1(-p,h);break}case"rightCenter":{y=t.add1(-p,g);break}case"rightTop":{y=t.add1(-p,0);break}case"topCenter":{y=t.add1(-m,0);break}}let b=this.plane.createOrUpdateRect(-1,y,p,h,0,0,i,3);r.push(b);let P=this.createStrokeLine(y,y.add1(p,0)),T=this.createStrokeLine(y.add1(p,0),y.add1(p,-h)),I=this.createStrokeLine(y.add1(p,-h),y.add1(0,-h)),C=this.createStrokeLine(y.add1(0,-h),y);r.push(P,T,I,C);let E=this.plane.createOrUpdateScaleString(-1,o,y.add1(m,-g),0,a,c/l,s,1,-1);r.push(E)}modifyUnit(o){o!=this.unit&&(o!="mil"?this.unitScale=this.unitConversion.conversion(o,"mil",1)/100:this.unitScale=1,this.unit=o)}createMeasureTool(o,t,e,r){let i=this.bitmap.findEmpty();i===-1&&(this.bitmap=this.bitmap.extSize(this.bitmap.size*2),i=this.bitmap.findEmpty()),this.bitmap.markUsed(i),this.data.setArr([o.x,o.y,t.x,t.y,e.x,e.y,r?1:0],i*fye);let n=[],s=this.createLineSegment(o,t),a=this.createLineSegment(e,o),l=this.createLineSegment(e,t);if(n.push(s,a,l),this.showAngleInfo){let c=this.createArcSegment(o,t);n.push(c)}return this.measureIdAndNormalIds.set(i,n),this.createRuler(i,o,t,e),this.createTextInfo(i,o,t,e,r),i}removeMeasureTool(o){this.data.setArr(new Array(6).fill(0),o*fye),this.bitmap.markRemove(o);let t=this.measureIdAndNormalIds.get(o),e=this.measureIdAndRulerIds.get(o);if(!t||!e){console.error("measureToolId error");return}let r=this.measureIdAnTextInfoIds.get(o);t.forEach(i=>{this.plane.removePt(i)}),e.forEach(i=>{this.plane.removePt(i)}),r.forEach(i=>{this.plane.removePt(i)}),this.measureIdAndNormalIds.delete(o),this.measureIdAndRulerIds.delete(o),this.measureIdAnTextInfoIds.delete(o)}updateRuler(){Math.abs(this.LastScale-this.camera.getScale())<1e-8||this.measureIdAndRulerIds.forEach((o,t)=>{let e=this.measureIdAndRulerIds.get(t),r=this.measureIdAnTextInfoIds.get(t);e||console.error("measureToolId error"),e.forEach(g=>{this.plane.removePt(g)}),r.forEach(g=>{this.plane.removePt(g)});let i=t*fye,n=this.data.get(i+0),s=this.data.get(i+1),a=this.data.get(i+2),l=this.data.get(i+3),c=this.data.get(i+4),h=this.data.get(i+5),u=this.data.get(i+6),d=new S(n,s),p=new S(a,l),m=new S(c,h);this.createRuler(t,d,p,m),this.createTextInfo(t,d,p,m,!!u)})}};function vLe(o){return ee.build(o.r,o.g,o.b,o.alpha+.1)}var aW=class{constructor(t){this.bgRuler=new sot(t),this.scaleRuler=new aot}render(t,e,r,i,n){n=vLe(n),this.bgRuler.render(t,i,n),this.scaleRuler.render(t,e,r,n)}};aW.DELTA=18,aW.canvasOrigin=new S(aW.DELTA,aW.DELTA);var Xh=aW,sot=class{constructor(o){this.sceneType=o}render(o,t,e){let r=o.getContext();o.setFillStyle(t.toRGBAString()),r.fillRect(0,0,r.canvas.width,Xh.DELTA),r.fillRect(0,0,Xh.DELTA,r.canvas.height),bW.includes(this.sceneType)&&(o.setLineWidth(1),o.setStrokeStyle(e.toRGBAString()),r.beginPath(),r.moveTo(Xh.DELTA,Xh.DELTA),r.lineTo(Xh.DELTA,r.canvas.height),r.stroke(),r.beginPath(),r.moveTo(Xh.DELTA,Xh.DELTA),r.lineTo(r.canvas.width,Xh.DELTA),r.stroke())}},aot=class{constructor(){this.primitives=[],this.spacing=2,this.scale=1,this.ratio=5,this.delta=1,this.unit="mil",this.magnification=10,this.unitConversion=new ML,this.fontSize=14,this.offNum=5}get spacing10(){return this.spacing*this.ratio*this.scale*10}modifyUnit(o){o!=this.unit&&(o!="mil"?this.scale=this.unitConversion.conversion(o,"mil",1)/100:this.scale=1,this.unit=o)}clearPrimitives(){this.primitives.length=0}updateMagnification(o){this.magnification=rE(o)}updateDelta(o){this.delta=rE(o)}createRuler(o,t,e,r){let i,n,s;t===0?(i=-1,n=0,s=2):(i=1,n=1,s=3);let a=rE(i*Math.floor(e/r)*this.delta),l=e%r;if(t===0)if(e>=0){let c=10-Math.abs(rE(a/this.delta)%10),h=rE(a+i*this.delta*c),u=h.toString(),d=this.ctx.getContext().measureText(u).width;if((c-1)*r<d){let p=Xh.DELTA-c*r+Math.abs(l),m=new qZ(u,h,t,new Mt(p+d+3,Xh.DELTA/2,0),!0);this.primitives.push(m)}}else{let c=Math.abs(a/this.delta)%10;if(c!==0){let h=rE(a+i*this.delta*c),u=h.toString(),d=this.ctx.getContext().measureText(u).width;if((c-1)*r<d){let p=Xh.DELTA-c*r+(l+r),m=new qZ(u,h,t,new Mt(p+d+3,Xh.DELTA/2,0),!0);this.primitives.push(m)}}}for(let c=l<0?l+r:l;c<=o;c+=r){let h=c+Xh.DELTA,u=[Xh.DELTA,Xh.DELTA,Xh.DELTA-this.offNum,Xh.DELTA-this.offNum];u[n]=h,u[s]=h,this.createScale(u,a,t),a=rE(a-i*this.delta)}}createScale(o,t,e){let r=bbe(t,this.magnification)===0,i=bbe(t,this.magnification/2)===0;r?e===0?o[3]=0:o[2]=0:i&&(e===0?o[3]=Xh.DELTA/2:o[2]=Xh.DELTA/2);let n=new XZ(e,o);if(this.primitives.push(n),r){let s=t.toString(),a=new qZ(s,t,e,new Mt(e===0?o[0]+3:Xh.DELTA/2,e===0?Xh.DELTA/2:o[1]-3,0));this.primitives.push(a)}}createScaleIdentification(o){let t=o.getScreenPosition().multiply4(o.get2dCameraMatrix().getInverseMatrix()),{x:e,y:r}=t.multiply4(o.getRenderMatrix()).scale(1/o.getSampling());if(e>=Xh.canvasOrigin.x){let i=[e,Xh.DELTA,e,0];this.primitives.push(new XZ(0,i))}if(r>=Xh.canvasOrigin.y){let i=[Xh.DELTA,r,0,r];this.primitives.push(new XZ(1,i))}}autoScale(o){let t=ALe(o,this.unitConversion,this.unit,this.spacing10),e=10,r=1;this.unit=="inch"&&(e=1,r=.1),this.updateMagnification(t*e),this.updateDelta(t*r)}render(o,t,e,r){this.autoScale(t);let i=o.getContext();this.ctx=o,o.save();let n=vLe(r).toRGBAString();o.setStrokeStyle(n),o.setLineWidth(1),o.setFillStyle(n),o.setTextBaseLine("middle"),o.setFont(`normal ${this.fontSize}px ${lk}`);let s=i.canvas.width,a=i.canvas.height,l=e,c=l.multiply4(t.getRenderMatrix()).scale(1/t.getSampling()),h=c.sub(Xh.canvasOrigin),u=this.unitConversion.conversion1(this.unit,"mil",this.magnification)/10,d=new S(u,0).add(l).multiply4(t.getRenderMatrix()).scale(1/t.getSampling()),p=Math.abs(d.x-c.x)/10,m=rE(-1*Math.floor(Math.max(Math.abs(h.x),Math.abs(h.y))/p)*this.delta);this.ctx.getContext().measureText(m.toString()).width>p*10&&(this.magnification*=2),this.createRuler(s,0,h.x,p),this.createRuler(a,1,h.y,p),this.createScaleIdentification(t);let g=7;this.primitives.forEach(y=>{if(i.beginPath(),y instanceof XZ){let{startPoint:{x:b,y:P},width:T,height:I}=y.getRectInfo();i.fillRect(b,P,T,I)}else if(y instanceof qZ){if(y.text==="")return;let{x:b,y:P}=y.getPosition();if(y.direction===1){let T=0,I=0;if(y.text[0]==="-"){if(P-i.measureText("-").width<=Xh.DELTA)return;o.save(),o.setTranslate(b,P),o.setRotate(-Math.PI/2),i.fillText("-",0,0),o.restore(),I=g/2,T=1}for(;T<y.text.length;T++){let C=P-T*g+I;if(C-i.measureText(y.text[T]).width<=Xh.DELTA)return;o.save(),o.setTranslate(b,C),o.setRotate(-Math.PI/2),i.fillText(y.text[T],0,0),o.restore()}}else if(y.isSpecial){o.save();let T=i.measureText(y.text).width,I=b-T;o.setTranslate(I,P);let C=0;for(let E=0;E<y.text.length;E++){let O=y.text[E],_=i.measureText(O).width;I+C>=Xh.DELTA&&i.fillText(O,C,0),C=C+_}o.restore()}else i.fillText(y.text,b,P)}else throw Error("not support")}),o.restore(),this.clearPrimitives()}},XZ=class{constructor(o,t){if(this.lineWidth=1,this.direction=o,o===0)this.rectInfo={startPoint:new Mt(t[2],t[3],0),width:this.lineWidth,height:rE(t[1]-t[3])};else if(o===1)this.rectInfo={startPoint:new Mt(t[2],t[3],0),width:rE(t[0]-t[2]),height:this.lineWidth};else throw new Error("not support the DIRECTION")}getRectInfo(){return this.rectInfo}},qZ=class{constructor(o,t,e,r,i){this.text=o,this.scale=t,this.direction=e,this.position=r,this.isSpecial=i}getPosition(){return this.position}};function rE(o){return Math.round(o*1e3)/1e3}function bbe(o,t){let{integerPart:e,divisor:r}=s(o),{integerPart:i,divisor:n}=s(t);if(r>n)return e%Math.round(t*r)/r;return r<n?Math.round(o*n)%i/n:e%i/r;function s(a){let l=a.toString(),c=l.indexOf(".");if(c===-1)return{integerPart:a,divisor:1};let h=l.length-c-1,u=Math.pow(10,h);return{integerPart:Math.round(a*u),divisor:u}}}var lot=class{constructor(o,t){this.scene=o,this.rectangularProgram=new cot(t,this.scene.gridParam),this.polarProgram=new hot(t,this.scene.gridParam)}render(o,t){this.scene.gridParam.currentCoord?this.rectangularProgram.render(o,t,this.scene.getOrigin()):this.polarProgram.render(o,t,this.rectangularProgram.getRenderColor(),this.scene.getAntialias(),this.scene.getOrigin())}modifyModel(o){this.scene.gridParam.pattern=o}getRectangularProgram(){return this.rectangularProgram}getPolarProgram(){return this.polarProgram}},$Z=2,cot=class{constructor(o,t){this.gridParam=t,this.m_color=o,this.gridColor=this.getRenderColor(),this.boldColor=ee.of6(t.multiGridColor,1-t.multiTransparency),this.axisColor=ee.of6(t.coordinateAxisColor,1-t.coordinateAxisTransparency),t.attach(this)}getRenderColor(){return this.m_color}get visible(){return this.gridParam.visible}set visible(o){this.gridParam.visible=o}setGridX(o){o>0&&this.gridParam.setGridX(o)}getGridX(){return this.gridParam.getGridX()}setGridY(o){o>0&&this.gridParam.setGridY(o)}getGridY(){return this.gridParam.getGridY()}setSnapX(o){o>0&&this.gridParam.setSnapX(o)}getSnapX(){return this.gridParam.getSnapX()}setSnapY(o){o>0&&this.gridParam.setSnapY(o)}getSnapY(){return this.gridParam.getSnapY()}getPointSize(){return this.gridParam.getPointSize()}setPointSize(o){this.gridParam.setPointSize(o)}get pattern(){return this.gridParam.pattern}modifyColor(o,t=o.alpha){this.m_color=ee.of6(o,t)}getRenderState(){let o=this.gridParam,t=o.getMultiStyle(),e=!1,r=!1,i=!1,n=!1,s=!1;if(this.visible==0&&t==2)return{showCoor:e,showLine:r,showBoldLine:i,showPoint:n,showBoldPoint:s};e=!0;let a=this.visible==2;return r=a&&o.pattern,n=a&&!o.pattern,i=t==0,s=t==1,{showCoor:e,showLine:r,showBoldLine:i,showPoint:n,showBoldPoint:s}}flush(){let o=this.gridParam;this.gridColor=this.getRenderColor(),this.boldColor=ee.of6(o.multiGridColor,1-o.multiTransparency),this.axisColor=ee.of6(o.coordinateAxisColor,1-o.coordinateAxisTransparency)}autoScale(o){let t=o.getScale(),e=this.gridParam,r=e.getGridX(),i=e.getGridY(),n=parseInt(e.getMultiRatio().toString()),s=r*n,a=i*n,l=Math.min(r,i),c=Math.min(s,a),h=l*t,u=c*t,d=5,p=20,m=P(h),g=P(u),y=r*t,b=i*t;return{stepX:y,stepY:b,multiRatio:n,gridAlphaRatio:m,multiGridAlphaRatio:g};function P(T){return T<=d?0:T>=p?1:(T-d)/(p-d)}}render(o,t,e){let r=this.gridParam.getMultiStyle();if(this.visible==0&&r==2)return;let{showCoor:i,showLine:n,showPoint:s,showBoldLine:a,showBoldPoint:l}=this.getRenderState(),c=this.getPointSize(),h=1;this.flush(),s&&(this.gridColor=this.gridColor.mulAlpha(2)),l&&(this.boldColor=this.boldColor.mulAlpha(2));let u=o.getContext(),d=e.multiply4(t.getRenderMatrix()),p=new S(d.x,d.y),m=u.canvas.width,g=u.canvas.height,{stepX:y,stepY:b,multiRatio:P,gridAlphaRatio:T,multiGridAlphaRatio:I}=this.autoScale(t),C=T==0,E=I==0,O=this.gridParam.renderCoordinateAxis;if(O&&(!(s||l||n||a)||C&&E)){o.setFillStyle(this.axisColor.toRGBAString()),u.fillRect(p.x,0,1,g),u.fillRect(0,p.y,m,1);return}let _=this.gridColor.mulAlpha(T).toRGBAString(),R=this.boldColor.mulAlpha(I).toRGBAString(),v=(D,w,F,H,z,G,W)=>{let L=z.getContext(),B=G?V=>{L.fillRect(V,0,h,H)}:V=>{L.fillRect(0,V,H,h)},{start:N,count:U,divisor:k}=mye(D,w);for(;N<=F;N+=w){if(Math.abs(N-D)<=Number.EPSILON){U+=k;continue}!E&&W&&U%W===0?(z.setFillStyle(R),B(N)):!C&&n&&(z.setFillStyle(_),B(N)),U+=k}};if(s||l){let{start:D,count:w,divisor:F}=mye(p.x,y),{start:H,count:z,divisor:G}=mye(p.y,b);if(n||a){let W=a?P:void 0;v(p.x,y,m,g,o,!0,W),v(p.y,b,g,m,o,!1,W);let L=s?this.gridColor.mulAlpha(T):this.boldColor.mulAlpha(I);o.setFillStyle(L.toRGBAString());for(let B=D,N=w;B<=m;B+=y){for(let U=H,k=z;U<=g;U+=b){if(!E&&l&&N%P===0&&k%P===0){if(O&&(VZ(B,p.x)||VZ(U,p.y)))continue;u.fillRect(B,U,c*$Z,c*$Z)}else!C&&s&&u.fillRect(B,U,c,c);k+=G}N+=F}}else for(let W=D,L=w;W<=m;W+=y){for(let B=H,N=z;B<=g;B+=b)O&&(VZ(W,p.x)||VZ(B,p.y))||(!E&&l&&L%P===0&&N%P===0?(o.setFillStyle(R),u.fillRect(W,B,c*$Z,c*$Z)):!C&&s&&(o.setFillStyle(_),u.fillRect(W,B,c,c)),N+=G);L+=F}}else{let D=a?P:void 0;v(p.x,y,m,g,o,!0,D),v(p.y,b,g,m,o,!1,D)}O&&(o.setFillStyle(this.axisColor.toRGBAString()),u.fillRect(p.x,0,1,g),u.fillRect(0,p.y,m,1))}};function mye(o,t){let e=bbe(o,t),r=Math.floor(o/t),i=-1;return e<0&&(e=e+t,i=1,r=Math.abs(r)),{start:e,count:r,divisor:i}}var hot=class{constructor(o,t){this.gridParam=t}getStep(o){let t=10,e=o.getPxLength(),r=this.gridParam.radius/e;if(r<t)for(let i=0;;i++){let n=this.gridParam.radius*Math.pow(5,i);if(r=n/e,!(r<t))return n}return this.gridParam.radius}render(o,t,e,r,i){if(this.gridParam.visible!==2)return;let n=o.getContext();o.setLineWidth(1);let s=2,a=r?[.3,.8]:[.15,.4],l=[this.gridParam.minRadius,this.gridParam.maxRadius],c=this.getStep(t)*t.getScale(),h=l[1]*t.getScale(),u=l[0]*t.getScale(),d=i.multiply4(t.getRenderMatrix()),p=new S(d.x,d.y),m=Math.floor((h-u)/c);m<=1&&(u=0);let g=Math.ceil(this.gridParam.sweepAngle/this.gridParam.angleDelta),y=this.gridParam.sweepAngle===Math.PI*2?g:g+1,b=this.gridParam.startAngle,P=this.gridParam.angleDelta;if(this.gridParam.pattern){let T=ee.of6(e,a[1]),I=ee.of6(e,a[0]);o.setStrokeStyle(I.toRGBAString());for(let C=1;C<=m;C++){let E=u+C*c;n.beginPath(),n.arc(p.x,p.y,E,0,2*Math.PI),n.stroke(),n.closePath()}o.save(),o.setFillStyle(T.toRGBAString()),o.setTranslate(p.x,p.y);for(let C=0;C<y;C++)o.setRotate(Math.PI*2-(C==0?b:P)),n.fillRect(u,0,h,1);o.restore(),u>0&&(o.setStrokeStyle(I.toRGBAString()),n.beginPath(),n.arc(p.x,p.y,u,0,2*Math.PI),n.closePath(),n.stroke())}else{let T=ee.of6(e,a[1]);o.setFillStyle(T.toRGBAString());for(let I=0;I<m+1;I++){let C=u+I*c;for(let E=0;E<y;E++){let O=Math.PI*2-(b+E*P),_=p.x+C*Math.cos(O),R=p.y+C*Math.sin(O);n.fillRect(_,R,s,s)}}}}},uot=class{constructor(){this.spacing=10,this.patternMap=new Map,this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d")}setSpacing(o){this.spacing=o}updateSize(o,t){this.canvas.width=o,this.canvas.height=t}renderGrid(o,t){let e=this.spacing/t;this.updateSize(e+1,e+1),this.context.strokeStyle=o,this.context.beginPath(),this.context.moveTo(0,e),this.context.lineTo(this.canvas.width,e),this.context.stroke(),this.context.beginPath(),this.context.moveTo(e,0),this.context.lineTo(e,this.canvas.height),this.context.stroke();let r=this.context.createPattern(this.canvas,"repeat");return this.patternMap.get(2).set(`${o}-${t}`,r),r}renderHorizontalLine(o,t){let e=this.spacing/t;this.updateSize(1,e+1),this.context.strokeStyle=o,this.context.beginPath(),this.context.moveTo(0,e),this.context.lineTo(1,e),this.context.stroke();let r=this.context.createPattern(this.canvas,"repeat");return this.patternMap.get(3).set(`${o}-${t}`,r),r}renderVerticalLine(o,t){let e=this.spacing/t;this.updateSize(e+1,1),this.context.strokeStyle=o,this.context.beginPath(),this.context.moveTo(e,0),this.context.lineTo(e,1),this.context.stroke();let r=this.context.createPattern(this.canvas,"repeat");return this.patternMap.get(4).set(`${o}-${t}`,r),r}renderRhombicGrid(o,t){let e=this.spacing/t;this.updateSize(Math.max(e,1),Math.max(e,1)),this.context.strokeStyle=o,this.context.beginPath(),this.context.moveTo(0,e),this.context.lineTo(e,0),this.context.stroke(),this.context.beginPath(),this.context.moveTo(0,0),this.context.lineTo(e,e),this.context.stroke();let r=this.context.createPattern(this.canvas,"repeat");return this.patternMap.get(5).set(`${o}-${t}`,r),r}renderLeftSlashLine(o,t){let e=this.spacing/t;this.updateSize(Math.max(e,1),Math.max(e,1)),this.context.strokeStyle=o,this.context.beginPath(),this.context.moveTo(0,e),this.context.lineTo(e,0),this.context.stroke();let r=this.context.createPattern(this.canvas,"repeat");return this.patternMap.get(6).set(`${o}-${t}`,r),r}renderRightSlashLine(o,t){let e=this.spacing/t;this.updateSize(Math.max(e,1),Math.max(e,1)),this.context.strokeStyle=o,this.context.beginPath(),this.context.moveTo(0,0),this.context.lineTo(e,e),this.context.stroke();let r=this.context.createPattern(this.canvas,"repeat");return this.patternMap.get(7).set(`${o}-${t}`,r),r}getCatchPattern(o,t,e){let r=this.patternMap.get(o);if(r){let i=r.get(`${t}-${e}`);if(i)return i}else{let i=new Map;this.patternMap.set(o,i)}return null}getPattern(o,t,e){let r=this.getCatchPattern(o,t,e);if(r)return r;switch(o){case 2:return this.renderGrid(t,e);case 3:return this.renderHorizontalLine(t,e);case 4:return this.renderVerticalLine(t,e);case 5:return this.renderRhombicGrid(t,e);case 6:return this.renderLeftSlashLine(t,e);case 7:return this.renderRightSlashLine(t,e)}}},dot=class{constructor(o,t){this.x=o,this.y=t,this.indexsArr=new Array(0),this.bitmaps=new Array(0),this.highLightNum=0}getPtNum(){return this.bitmaps.reduce((o,t)=>o+(t==null?void 0:t.getMarked())||0,0)}getSdfStringInfo(o){return this.blockGPU.getSdfStringInfo(o)}addHighLightPt(o,t,e,r){this.blockGPU.addHighLightPt(o,this.indexsArr[o][t],e,r)}removeHighLightPt(o,t,e,r){return this.blockGPU.removeHighLightPt(o,this.indexsArr[o][t],e,r)}getHighLightInfo(o,t){return this.blockGPU.getHighLightInfo(o,this.indexsArr[o][t])}getHighLightIdNum(o,t,e){return this.blockGPU.getHighLightIdInfo(o,this.indexsArr[o][t],e)}removeHighLightPtAll(o,t,e,r){let i=this.blockGPU.removeHighLightPtAll(o,this.indexsArr[o][t],e,r);return this.highLightNum-=i,i}addHighLightPtAll(o,t,e){let r=this.blockGPU.addHighLightPtAll(o,this.indexsArr[o][t],e);return this.highLightNum+=r,r}setHighLightPtNum(o,t,e,r,i){let{operate:n,highLightNum:s}=this.blockGPU.setHighLightPtNum(o,this.indexsArr[o][t],e,r,i);return n==="add"?this.highLightNum+=s:n==="remove"&&(this.highLightNum-=s),{operate:n,highLightNum:s}}initBitmap(o){this.indexsArr[o]=[];let t=new Cg(32);return this.bitmaps[o]=t,t.addTrimListener(e=>{this.indexsArr[o].length=e}),t}addPt(o,t){let e=this.bitmaps[o];e==null&&(e=this.initBitmap(o));let r=e.findEmpty();return r===-1&&(this.bitmaps[o]=e=e.extSize(e.size*2),r=e.findEmpty()),e.markUsed(r),this.indexsArr[o][r]=this.blockGPU.addPt(o,t),r}removePt(o,t){var e;this.blockGPU.removePt(o,this.indexsArr[o][t]),delete this.indexsArr[o][t],(e=this.bitmaps[o])==null||e.markRemove(t)}updatePt(o,t,e){return this.blockGPU.updatePt(o,this.indexsArr[o][t],e)}getPt(o,t){return this.blockGPU.getPt(o,this.indexsArr[o][t])}getStringInfo(o,t){return this.blockGPU.getStringInfo(this.indexsArr[10][o],t)}setPtVisible(o,t,e){return this.blockGPU.setPtVisible(o,this.indexsArr[o][t],e)}setPtBlockGPU(o){o.addPts(this.blockGPU,this.indexsArr),this.blockGPU=o}getLoc(){return this.blockGPU.loc}},fI=3,pot=class{constructor(o,t,e,r){this.plane=o,this.builders=[],this.bitmaps=[],this.ptInfoBuilder=new NO(Float32Array),this.ptIdAndHighLightColorIndexMap=new Map,this.highLightGroupIds=[],this.createBuilder=t,this.createHighLightIdsBuilder=r,this.staticPolygonInfoBuilder=e,this.bitmapIndex=new Cg(32)}clear(){this.builders.length=0,this.bitmaps.length=0,this.bitmapIndex=new Cg(32),this.ptInfoBuilder.clear(),this.ptIdAndHighLightColorIndexMap.clear(),this.highLightGroupIds.length=0}getPolygonPtId(o,t,e){let r=this.bitmapIndex.getMax()+1,i;for(let n=0;n<r;n++){let s=this.ptInfoBuilder.get(n*fI),a=this.ptInfoBuilder.get(n*fI+1),l=this.ptInfoBuilder.get(n*fI+2);if(s===o&&l===e&&a===t){i=n;break}}if(i===void 0)throw new Error("getPolygonPtId error");return i}addHighLightPt(o,t,e,r){let{colorIndex:i,ptIndex:n}=this.getColorAndIndex(t);this.highLightGroupIds[e]||(this.highLightGroupIds[e]=[]),this.highLightGroupIds[e][i]||(this.highLightGroupIds[e][i]=[]),this.highLightGroupIds[e][i][r]||(this.highLightGroupIds[e][i][r]=[]),this.highLightGroupIds[e][i][r][o]||(this.highLightGroupIds[e][i][r][o]=new _J(this.createHighLightIdsBuilder(o)));let s=this.ptIdAndHighLightColorIndexMap.get(t);if(s!=null&&s.length)s[e]?s[e].push(r):s[e]=[r],this.ptIdAndHighLightColorIndexMap.set(t,s);else{let a=[];a[e]=[r],this.ptIdAndHighLightColorIndexMap.set(t,a)}this.highLightGroupIds[e][i][r][o].add(n,r)}removeHighLightPt(o,t,e,r){let{colorIndex:i,ptIndex:n}=this.getColorAndIndex(t),s=0;if(r!==void 0)s=this.highLightGroupIds[e][i][r][o].remove(n,r);else{let l=this.ptIdAndHighLightColorIndexMap.get(t);for(let c=0;c<l.length;c+=1)s+=this.highLightGroupIds[e][i][l[e][c]][o].remove(n,r)}let a=this.ptIdAndHighLightColorIndexMap.get(t);return a[e].forEach((l,c)=>{l===r&&a[e].splice(c,1)}),this.ptIdAndHighLightColorIndexMap.set(t,a),s}getHighLightInfo(o,t){return Qye(this.ptIdAndHighLightColorIndexMap.get(t))||[]}getHighLightIdNum(o,t,e){var r;return((r=this.ptIdAndHighLightColorIndexMap.get(t))==null?void 0:r[e])||[]}getPtNum(o,t){var e;return((e=this.bitmaps[o][t])==null?void 0:e.getMarked())||0}createPtId(){let o=this.bitmapIndex.findEmpty();return o===-1&&(this.bitmapIndex=this.bitmapIndex.extSize(this.bitmapIndex.size*2),o=this.bitmapIndex.findEmpty()),this.bitmapIndex.markUsed(o),o}getColorIndex(o,t){let e;switch(o){case 6:e=t[8];break;case 7:e=t[11];break;case 8:e=this.staticPolygonInfoBuilder.get(t[7]*Ld+7);break;case 9:e=this.staticPolygonInfoBuilder.get(t[10]*Ld+7);break;case 26:case 27:case 28:case 29:case 41:case 42:case 43:case 44:if(e=t[3],e==0){let r=this.plane.builder.getTemplatePt(t[1],Ur.getTemplateTypeByTemplateInstanceType(o));e=Ur.getColorIndex(r,0,this.staticPolygonInfoBuilder)}break;default:throw new Error("PtType is error")}return e}addPt(o,t){var e;let r=this.getColorIndex(o,t),i=(e=this.bitmaps[r])==null?void 0:e[o],n=Ur.getPtLengthByType(o);if(!i){!this.bitmaps[r]&&(this.bitmaps[r]=[]),this.bitmaps[r][o]=i=new Cg(32),!this.builders[r]&&(this.builders[r]=[]);let l=this.builders[r][o]=this.createBuilder(o);i.addTrimListener(c=>{l.trimChunk(c*n)})}let s=i.findEmpty();s===-1&&(this.bitmaps[r][o]=i=i.extSize(i.size*2),s=i.findEmpty()),i.markUsed(s),this.builders[r][o].setArr(t,s*Ur.getPtLengthByType(o));let a=this.createPtId();return this.ptInfoBuilder.set(a*fI,r),this.ptInfoBuilder.set(a*fI+1,s),this.ptInfoBuilder.set(a*fI+2,o),a}updatePt(o,t,e){let{colorIndex:r,ptIndex:i}=this.getColorAndIndex(t),n=this.getColorIndex(o,e);return r===n?this.builders[n][o].setArr(e,i*Ur.getPtLengthByType(o)):(this.removePt(o,t),t=this.addPt(o,e)),t}getBuildersByColorIndex(o){return this.builders[o]}getBuilders(){return this.builders}getMaxLength(o,t){var e,r;return(r=(e=this.bitmaps)==null?void 0:e[t])!=null&&r[o]?this.bitmaps[t][o].getMax()+1:0}getPt(o,t){let{colorIndex:e,ptIndex:r}=this.getColorAndIndex(t),i=Ur.getPtLengthByType(o);return this.builders[e][o].slice(r*i,(r+1)*i)}getColorAndIndex(o){if(o*fI+1>this.ptInfoBuilder.getLength())throw new Error("id error");let t=this.ptInfoBuilder.get(o*fI),e=this.ptInfoBuilder.get(o*fI+1);if(t==-1||e==-1)throw new Error("id error");return{colorIndex:t,ptIndex:e}}removePt(o,t){let{colorIndex:e,ptIndex:r}=this.getColorAndIndex(t);this.builders[e][o].set(r*Ur.getPtLengthByType(o),0),this.bitmaps[e][o].markRemove(r),this.ptInfoBuilder.set(t*fI,-1),this.ptInfoBuilder.set(t*fI+1,-1),this.ptInfoBuilder.set(t*fI+2,-1),this.bitmapIndex.markRemove(t)}setPtVisible(o,t,e){let r,i=!1,{colorIndex:n,ptIndex:s}=this.getColorAndIndex(t),a=Ur.getPtLengthByType(o),l=this.builders[n][o],c=s*a,h=(l.get(c)&Is)!==0;return e!==h&&(e?l.set(c,l.get(c)|Is):l.set(c,l.get(c)&fW),r=l.slice(c,c+Ur.getPtLengthByType(o)),i=!0),{ptData:r,isUpdate:i}}},KZ=3,AL=class extends Zbe{constructor(o,t,e,r,i,n){super(s=>$m.create(Float32Array,o,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,`ptsBuf${s} of builder`),-3,-2,s=>$m.create(Int32Array,o,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,`${s} highLightIds of builder`)),this.sdfStringInfoBuilder=t,this.renderHighLightPtProgram=e,this.loc=r,this.staticPolygonInfoBuilder=i,this.plane=n,this.highLightBindGroups=[],this.polygonHighLightBindGroups=[],this.stringHighLightBindGroups=[],this.templateStringHighLightBindGroups=[],this.polygonPtManager=new pot(n,s=>$m.create(Float32Array,o,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,`ptsBuf${s} of polygonPtManager builders`),i,s=>$m.create(Int32Array,o,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,`${s} highLightIds of polygonPtManager`))}addHighLightPt(o,t,e,r){if(Ur.isNormalPolygonType(o)){this.polygonPtManager.addHighLightPt(o,t,e,r);return}super.addHighLightPt(o,t,e,r)}removeHighLightPt(o,t,e,r){return Ur.isNormalPolygonType(o)?this.polygonPtManager.removeHighLightPt(o,t,e,r):super.removeHighLightPt(o,t,e,r)}getPolygonHighLightIds(o){var t;return(t=this.polygonPtManager.highLightGroupIds)==null?void 0:t[o]}getHighLightInfo(o,t){return Ur.isNormalPolygonType(o)?this.polygonPtManager.getHighLightInfo(o,t):super.getHighLightInfo(o,t)}getHighLightIdInfo(o,t,e){return Ur.isNormalPolygonType(o)?this.polygonPtManager.getHighLightIdNum(o,t,e):super.getHighLightIdInfo(o,t,e)}getPolygonPtNum(o,t){return this.polygonPtManager.getPtNum(o,t)}addPt(o,t){if(Ur.isNormalPolygonType(o))return this.polygonPtManager.addPt(o,t);if(o===18){let e=this.createId(o,t);return this.addSdfString(t,e),e}return super.addPt(o,t,this.getDataPtLength(o))}addSdfString(o,t){let e=o[1],[r]=this.sdfStringInfoBuilder.slice(e,(e+1)*Vot),i=this.sdfStrBitmaps[r];if(!i){this.sdfStrBitmaps[r]=i=new Cg(32);let s=this.sdfStrBuilders[r]=this.createBuilder(18);this.sdfStrBitmaps[r].addTrimListener(a=>{s.trimChunk(a*RL.length)})}let n=i.findEmpty();n===-1&&(this.sdfStrBitmaps[r]=i=i.extSize(i.size*2),n=i.findEmpty()),i.markUsed(n),this.sdfStrBuilders[r].setArr(o,n*RL.length),this.builders[18].setArr([n,e,r],t*KZ)}updatePt(o,t,e){if(o===18){let{pt:r,bufIndex:i,index:n}=this.getSdfStringInfo(t);return e[1]==r[1]?this.sdfStrBuilders[i].setArr(e,n*RL.length):(this.removeSdfString(t),this.addSdfString(e,t)),t}else if(Ur.isNormalPolygonType(o))return this.polygonPtManager.updatePt(o,t,e);return super.updatePt(o,t,e)}removeSdfString(o){let{pt:t,bufIndex:e,index:r}=this.getSdfStringInfo(o);this.sdfStrBuilders[e].set(r*RL.length,0),this.sdfStrBitmaps[e].markRemove(r)}getSdfStringInfo(o){let[t,e,r]=this.builders[18].slice(o*KZ,(o+1)*KZ),i=Ur.getPtLengthByType(18);return{pt:this.sdfStrBuilders[r].slice(t*i,(t+1)*i),bufIndex:r,index:t,strIndex:e}}removePt(o,t){if(Ur.isNormalPolygonType(o)){this.polygonPtManager.removePt(o,t);return}else if(o===18){this.removeSdfString(t),this.bitmaps[o].markRemove(t);return}super.removePt(o,t)}getPt(o,t){return Ur.isNormalPolygonType(o)?this.polygonPtManager.getPt(o,t):o===18?this.getSdfStringInfo(t).pt:super.getPt(o,t)}setPtVisible(o,t,e){if(Ur.isNormalPolygonType(o))return this.polygonPtManager.setPtVisible(o,t,e);if(o===18){let r,i=!1,n,{pt:s,bufIndex:a,strIndex:l,index:c}=this.getSdfStringInfo(t),h=this.sdfStrBuilders[a];n=c*Ur.getPtLengthByType(o);let u=(h.get(n)&Is)!==0;if(e!==u){e?h.set(n,h.get(n)|Is):h.set(n,h.get(n)&fW),i=!0;let d=Ur.getPtLengthByType(18);r=this.sdfStrBuilders[a].slice(c*d,(c+1)*d)}return{ptData:r,isUpdate:i}}return super.setPtVisible(o,t,e)}getPolygonHighLightBindGroup(o,t,e){return this.polygonHighLightBindGroups[o]||(this.polygonHighLightBindGroups[o]=[]),this.polygonHighLightBindGroups[o][t]?(this.getPolygonBuildersByColorIndex(o)[t].updateBuf(),Ur.isTemplateInstancePtType(t)?e.getBuilders()[Ur.getTemplateTypeByTemplateInstanceType(t)].updateBuf():this.getPolygonBuildersByColorIndex(o)[t].updateBuf()):this.polygonHighLightBindGroups[o][t]=this.initHighLightPolygonBindGroup(o,t,e),this.polygonHighLightBindGroups[o][t]}getStringHighLightBindGroup(o,t){return this.stringHighLightBindGroups[o]?t.updateBuf():this.stringHighLightBindGroups[o]=this.initStringBindGroup(t),this.stringHighLightBindGroups[o]}getTemplateStringHighLightBindGroup(o,t,e){return this.templateStringHighLightBindGroups[o]?(t.updateBuf(),e.getStringBuilders()[o].updateBuf()):this.templateStringHighLightBindGroups[o]=this.initTemplateStringBindGroup(t,e.getStringBuilders()[o]),this.templateStringHighLightBindGroups[o]}getPolygonBuildersByColorIndex(o){return this.polygonPtManager.getBuildersByColorIndex(o)}getPolygonBuilders(){return this.polygonPtManager.getBuilders()}getPolygonMaxLength(o,t){return this.polygonPtManager.getMaxLength(o,t)}getHighLightBindGroup(o,t){return this.highLightBindGroups[o]?(this.getBuilders()[o].updateBuf(),Ur.isTemplateInstancePtType(o)?t.getBuilders()[Ur.getTemplateTypeByTemplateInstanceType(o)].updateBuf():this.getBuilders()[o].updateBuf()):this.highLightBindGroups[o]=this.initRenderHighLightBindGroup(o,t),this.highLightBindGroups[o]}getHighLightBindGroup0(o){return this.highLightBindGroups[o]?this.getBuilders()[o].updateBuf():this.highLightBindGroups[o]=this.initRenderHighLightBindGroup0(o),this.highLightBindGroups[o]}initHighLightPolygonBindGroup(o,t,e){return this.renderHighLightPtProgram.createDynamicBindGroup(this.getPolygonBuildersByColorIndex(o)[t].updateBuf(),Ur.isTemplateInstancePtType(t)?e.getBuilders()[Ur.getTemplateTypeByTemplateInstanceType(t)].updateBuf():this.getPolygonBuildersByColorIndex(o)[t].updateBuf())}initStringBindGroup(o){return this.renderHighLightPtProgram.createDynamicBindGroup(o.updateBuf(),o.updateBuf())}initTemplateStringBindGroup(o,t){return this.renderHighLightPtProgram.createDynamicBindGroup(o.updateBuf(),t.updateBuf())}initRenderHighLightBindGroup(o,t){return this.renderHighLightPtProgram.createDynamicBindGroup(this.getBuilders()[o].updateBuf(),Ur.isTemplateInstancePtType(o)?t.getBuilders()[Ur.getTemplateTypeByTemplateInstanceType(o)].updateBuf():this.getBuilders()[o].updateBuf())}initRenderHighLightBindGroup0(o){let t=this.getBuilders()[o].updateBuf();return this.renderHighLightPtProgram.createDynamicBindGroup(t,t)}addPts(o,t){o&&t.forEach((e,r)=>{e.forEach((i,n)=>{let s=o.getHighLightInfo(r,i);e[n]=this.addPt(r,o.getPt(r,i)),s.length&&this.addHighLightPtAll(r,e[n],s)})})}getDataPtLength(o){let t;return o===10||o===60||o===30?t=1:o===18?t=KZ:t=Ur.getPtLengthByType(o),t}createId(o,t){return super.createId(o,t,this.getDataPtLength(o))}getPolygonPtId(o,t,e){return this.polygonPtManager.getPolygonPtId(o,t,e)}reverseGetPtDataCalGrid(o,t){for(let e=0;e<this.getBuilders().length;e++){let r=this.getMaxLength(e)-1;for(;r>=0;){if(!this.bitmaps[e].isUsed(r)){r-=1;continue}let i=this.getPt(e,r);if(i[0]==0){r-=1;continue}if(o(i,e,r))return;r-=1}}t()}destroy(){this.builders.forEach(o=>o.destroy()),this.strBuilders.forEach(o=>o.destroy()),this.sdfStrBuilders.forEach(o=>o.destroy()),this.highLightGroupIds.forEach(o=>o.forEach(t=>t.getData().destroy())),this.stringHighLightGroupIds.forEach(o=>o.forEach(t=>t.getData().destroy())),this.templateStrBuilders.forEach(o=>o.destroy()),this.customTemplateStrBuilders.forEach(o=>o.destroy()),this.highLightBindGroups.forEach(o=>o.destroy()),this.polygonHighLightBindGroups.forEach(o=>o.forEach(t=>t.destroy())),this.polygonPtManager.getBuilders().forEach(o=>o.forEach(t=>t.destroy())),this.polygonPtManager.highLightGroupIds.forEach(o=>o.forEach(t=>t.forEach(e=>e.forEach(r=>r.getData().destroy())))),this.stringHighLightBindGroups.forEach(o=>o.destroy()),this.templateStringHighLightBindGroups.forEach(o=>o.destroy())}clear(){this.destroy(),super.clear(),this.highLightBindGroups.length=0,this.polygonHighLightBindGroups.length=0,this.polygonPtManager.clear(),this.stringHighLightBindGroups.length=0}},gye=class extends Zbe{constructor(o,t,e,r,i,n){super(s=>$m.create(Float32Array,o,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,`ptsBuf${s} of builder`),-3,-2,s=>$m.create(Int32Array,o,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,`${s} highLightIds of builder`)),this.sdfStringInfoBuilder=t,this.renderHighLightPtProgram=e,this.loc=r,this.staticPolygonInfoBuilder=i,this.plane=n,this.bindGroups=[],this.stringBindGroups=[]}addPt(o,t){return super.addPt(o,t,this.getDataPtLength(o))}getStringPt(o){let t=o&vJ,e=o>>pS;return this.strBuilders[t].slice(e*WJ.length,(e+1)*WJ.length)}initBindGroup(o){return this.getBuilders()[o]||(this.builders[o]=this.createBuilder(o)),this.plane.createDynamicBindGroup(this.getBuilders()[o].updateBuf())}getBindGroup(o){return this.bindGroups[o]?this.getBuilders()[o].updateBuf():this.bindGroups[o]=this.initBindGroup(o),this.bindGroups[o]}initStringTemplateBindGroup(o){return this.strBuilders[o]||(this.strBuilders[o]=this.createBuilder(60)),this.plane.createDynamicBindGroup(this.strBuilders[o].updateBuf())}getStringTemplateBindGroup(o){return this.stringBindGroups[o]?this.strBuilders[o].updateBuf():this.stringBindGroups[o]=this.initStringTemplateBindGroup(o),this.stringBindGroups[o]}getDataPtLength(o){let t;return o===10||o===60?t=1:t=Ur.getPtLengthByType(o),t}createId(o,t){return super.createId(o,t,this.getDataPtLength(o))}destroy(){this.builders.forEach(o=>o.destroy()),this.strBuilders.forEach(o=>o.destroy()),this.sdfStrBuilders.forEach(o=>o.destroy()),this.highLightGroupIds.forEach(o=>o.forEach(t=>t.getData().destroy())),this.stringHighLightGroupIds.forEach(o=>o.forEach(t=>t.getData().destroy())),this.bindGroups.forEach(o=>o.destroy()),this.stringBindGroups.forEach(o=>o.destroy())}clear(){this.destroy(),super.clear(),this.bindGroups.length=0,this.stringBindGroups.length=0}},R2e=6,tRe=R2e-1,fot=2**16,mot=10,yye=5,rRe=28,iRe=14,nRe=class xLe extends bwe{constructor(t,e,r){super(),this.recordGridNum=e,this.plane=r,this.grid=new Map,this.bufGrids=new Array(R2e).fill(0).map(()=>new Map),this.isProcessing=!1,this.defaultBlockIndexIdMap=new Array(69).fill(0).map(()=>new Map),this.locInfosArr=new Array(69).fill(0).map(()=>[]),this.scene=t,this.block=new AL(t.gpu,t.sdfStringInfoBuilder,t.renderHighLightPtProgram,{level:-1,x:0,y:0},t.staticPolygonInfoBuilder,r),this.defaultBlock=new AL(t.gpu,t.sdfStringInfoBuilder,t.renderHighLightPtProgram,{level:-2,x:0,y:0},t.staticPolygonInfoBuilder,r),this.templateBlock=new gye(t.gpu,t.sdfStringInfoBuilder,t.renderHighLightPtProgram,{level:-3,x:0,y:0},t.staticPolygonInfoBuilder,r),this.MIN_WH=t.getMinWh(),this.MIN_WH2=this.MIN_WH/2}isBigLevel(t){return t<-8||t>7}isBigLoc(t,e){return t<-8192||t>8191||e<-8192||e>8191}getBlockLocInfo(t,e=0,r=0){let i=t+8,n=e+8192,s=r+8192;return(i<<rRe)+(n<<iRe)+s}expandLocLevel(t){let e=(t>>>rRe)-8,r=(t>>>iRe&16383)-8192,i=(t&16383)-8192;return{level:e,x:r,y:i}}getAllPtBlock(){let{bufGrids:t,block:e,defaultBlock:r,templateBlock:i}=this,n=[r,e];return t.forEach(s=>{s.forEach(a=>{a.forEach(l=>{n.push(l)})})}),n}getInfo(t){let e=xLe.getTypeById(t),r=this.getIndexsArrIndex(t),i=this.locInfosArr[e][r],{level:n,x:s,y:a}=this.expandLocLevel(i);return n===-1?{block:this.block,type:e,ptId:r,level:n,index:this.indexsArr[e][r]}:n===-2?{block:this.defaultBlock,type:e,ptId:r,level:n,index:this.indexsArr[e][r]}:n===-3?{block:this.templateBlock,type:e,ptId:r,level:n,index:this.indexsArr[e][r]}:{block:this.grid.get(s).get(a),type:e,ptId:r,level:n,x:s,y:a,index:this.indexsArr[e][r]}}clear(){this.clearArrData(),this.locInfosArr.forEach(t=>t.length=0),this.grid.clear(),this.bufGrids.forEach(t=>t.forEach(e=>e.forEach(r=>r.destroy()))),this.bufGrids.forEach(t=>t.clear()),this.block.clear(),this.defaultBlock.clear(),this.defaultBlockIndexIdMap.forEach(t=>t.clear()),this.isProcessing=!1,this.templateBlock.clear()}getTemplatePt(t,e){return e===60?this.templateBlock.getStringPt(t):this.templateBlock.getPt(e,t)}addBufs(t,e){let r=this.bufGrids[t.level].get(t.x);if(r){let i=r.get(t.y);i||(i=new AL(this.scene.gpu,this.scene.sdfStringInfoBuilder,this.scene.renderHighLightPtProgram,t,this.scene.staticPolygonInfoBuilder,this.plane),r.set(t.y,i)),e.setPtBlockGPU(i)}else{r=new Map,this.bufGrids[t.level].set(t.x,r);let i=new AL(this.scene.gpu,this.scene.sdfStringInfoBuilder,this.scene.renderHighLightPtProgram,t,this.scene.staticPolygonInfoBuilder,this.plane);e.setPtBlockGPU(i),r.set(t.y,i)}}getBufLoc(t,e){var r;for(let i=0;i<tRe;i++){if(((r=this.scene.numGrids[i].get(t))==null?void 0:r.get(e))!==void 0)return{level:i,x:t,y:e};t=Math.floor(t/2),e=Math.floor(e/2)}return{level:tRe,x:t,y:e}}initPtIndexBlock(t,e){let r=new dot(t,e);return this.addBufs(this.getBufLoc(t,e),r),r}adjustGridInfo(t,e,r){let i=this.calGrid(t,this.scene.staticPolygonInfoBuilder),{block:n,locInfo:s}=i,a=this.getIndexsArrIndex(this.defaultBlockIndexIdMap[e].get(r)),l=n.addPt(e,t);this.indexsArr[e][a]=l,this.locInfosArr[e][a]=s;let c=this.defaultBlock.getHighLightInfo(e,r);return c.length&&(this.defaultBlock.removeHighLightPtAll(e,r,c),n.addHighLightPtAll(e,l,c)),this.defaultBlockIndexIdMap[e].delete(r),this.defaultBlock.removePt(e,r),this.addGridNum(n)}processData(){let t=performance.now();if(this.scene.toSplitLoc){for(let r of this.scene.planes)if(r.builder.split0(this.scene.toSplitLoc),performance.now()-t>=yye){setTimeout(()=>this.processData());return}delete this.scene.toSplitLoc}let e=0;this.scene.processDefaultBlockData=!0,this.defaultBlock.reverseGetPtDataCalGrid((r,i,n)=>{let s=this.adjustGridInfo(r,i,n);if(++e%1e3===0&&performance.now()-t>=mot)return setTimeout(()=>this.processData()),!0;if(s){if(performance.now()-t>=yye)return setTimeout(()=>this.processData()),!0;for(let a of this.scene.planes)if(a.builder.split0(this.scene.toSplitLoc),performance.now()-t>=yye)return setTimeout(()=>this.processData()),!0;delete this.scene.toSplitLoc}},()=>{this.isProcessing=!1})}processCalGrid(){this.isProcessing||(this.isProcessing=!0,setTimeout(()=>this.processData()))}getDefaultBlockInfo(t){let e=Ur.getType(t[0]);return Ur.isTemplateOriginPtType(e)?{block:this.templateBlock,type:e,level:-3}:{block:this.defaultBlock,type:e,level:-2}}calGrid(t,e,r=this.plane.getPtBBox(t,void 0,e)){let i,n,s,a=-1,l=this.MIN_WH;if(!this.scene.getUseGridAccelerate())s=this.block;else{let h=r.width(),u=r.height();if(a=Math.floor(Math.log2(Math.max(h,u)/l)),a<0?a=0:a===0?(h>l&&Math.floor(r.minX/l+.5)!==Math.floor(r.maxX/l-.5)||u>l&&Math.floor(r.minY/l+.5)!==Math.floor(r.maxY/l-.5))&&(a=-1):a=-1,a===-1)s=this.block;else{let d=r.center();if(i=Math.floor(d.x/l),n=Math.floor(d.y/l),this.isBigLoc(i,n))a=-1,s=this.block,i=0,n=0;else{let p=this.grid.get(i);if(p)s=p.get(n),s||(s=this.initPtIndexBlock(i,n),p.set(n,s));else{p=new Map,this.grid.set(i,p),s=this.initPtIndexBlock(i,n),p.set(n,s);let m=s.getLoc(),g=this.scene.numGrids[m.level];g.get(m.x)||g.set(m.x,new Map)}}}}let c=Ur.getType(t[0]);return{block:s,type:c,locInfo:this.getBlockLocInfo(a,i,n)}}addPt(t,e,r,i,n=this.getDefaultBlockInfo(t)){let{type:s,block:a,level:l}=n,c=a.addPt(s,t);if(r===void 0){let h=this.getIndex(s);r=(h<<ak)+s,this.indexsArr[s][h]=c,this.locInfosArr[s][h]=this.getBlockLocInfo(l),this.ptNum++}else{let h=this.getIndexsArrIndex(r);this.indexsArr[s][h]=c,this.locInfosArr[s][h]=this.getBlockLocInfo(l)}return l===-2&&(this.defaultBlockIndexIdMap[s].set(c,r),this.processCalGrid()),this.scene.needRender=!0,r}addHighLightPt(t,e,r){let{block:i,index:n,type:s}=this.getInfo(t);return i.addHighLightPt(s,n,e,r),this.scene.needRender=!0,null}removeHighLightPt(t,e,r){let{block:i,index:n,type:s}=this.getInfo(t),a=0;if(e||e==0)a=i.removeHighLightPt(s,n,e,r);else{let l=i.getHighLightInfo(s,n);a=i.removeHighLightPtAll(s,n,l,r)}return this.scene.needRender=!0,{pt:null,num:a}}setHighLightPtNum(t,e,r,i){let{block:n,index:s,type:a}=this.getInfo(t);return n.setHighLightPtNum(a,s,e,r,i),this.scene.needRender=!0,null}split0(t){var e;let r=(e=this.bufGrids[t.level].get(t.x))==null?void 0:e.get(t.y);if(!r)return;this.bufGrids[t.level].get(t.x).delete(t.y),r.destroy();let i=t.x*2**t.level,n=(t.x+1)*2**t.level,s=t.y*2**t.level,a=(t.y+1)*2**t.level;for(let l=i;l<n;l++){let c=this.grid.get(l);if(c)for(let h=s;h<a;h++){let u=c.get(h);if(!u)continue;let d=this.getBufLoc(l,h);if(this.addBufs(d,u),this.recordGridNum){let p=this.scene.numGrids[d.level].get(d.x);p.set(d.y,(p.get(d.y)||0)+u.getPtNum())}}}}split(t){if(t.level===0)return!1;this.scene.numGrids[t.level].get(t.x).delete(t.y);let e=this.scene.numGrids[t.level-1];return e.get(t.x*2)||e.set(t.x*2,new Map),e.get(t.x*2).set(t.y*2,0),e.get(t.x*2).set(t.y*2+1,0),e.get(t.x*2+1)||e.set(t.x*2+1,new Map),e.get(t.x*2+1).set(t.y*2,0),e.get(t.x*2+1).set(t.y*2+1,0),this.scene.toSplitLoc=t,!0}decGridNum(t,e=1){if(!this.recordGridNum||t instanceof AL||t instanceof gye)return;let r=t.getLoc(),i=this.scene.numGrids[r.level].get(r.x);i.set(r.y,i.get(r.y)-e)}addGridNum(t,e=1){if(!this.recordGridNum||t instanceof AL||t instanceof gye)return;let r=t.getLoc(),i=this.scene.numGrids[r.level].get(r.x),n=(i.get(r.y)||0)+e;return i.set(r.y,n),n>fot?this.split(r):!1}removePt(t){let e=!1,{block:r,index:i,type:n,level:s,x:a,y:l,ptId:c}=this.getInfo(t),h=r.getPt(n,i),u=r.getHighLightInfo(n,i);return u.length&&(e=!0,r.removeHighLightPtAll(n,i,u)),r.removePt(n,i),s===-2&&this.defaultBlockIndexIdMap[n].delete(i),delete this.indexsArr[n][c],delete this.locInfosArr[n][c],this.bitmaps[n].markRemove(c),this.ptNum--,this.decGridNum(r),this.scene.needRender=!0,{oldPt:h,isHighLightPt:e,highLightInfo:u}}getSdfPtInfo(t){}updatePt(t,e,r,i){let n=!1,{block:s,index:a,type:l,level:c,x:h,y:u}=this.getInfo(t),d=s.getPt(l,a),p=this.getDefaultBlockInfo(e),m=s.getHighLightInfo(l,a);if(s===p.block&&l===p.type){if(l!==8&&l!==9){let g=this.getIndexsArrIndex(t),y=s.updatePt(l,a,e),b=this.indexsArr[l][g];this.indexsArr[l][g]=y,c===-2&&(this.defaultBlockIndexIdMap[l].delete(b),this.defaultBlockIndexIdMap[l].set(y,t)),m.length&&(n=!0)}}else if(m.length&&(s.removeHighLightPtAll(l,a,m),n=!0),this.decGridNum(s),s.removePt(l,a),c===-2&&this.defaultBlockIndexIdMap[l].delete(a),this.addPt(e,r,t,i,p),m.length){let{block:g,index:y}=this.getInfo(t);g.addHighLightPtAll(l,y,m)}return this.scene.needRender=!0,{oldPt:d,isHighLightPt:n}}filterBlocks(t,e=Ae.ORIGIN){let r=t.getBBox2().transform4(e.getInverseMatrix()),i=this.MIN_WH,n=this.MIN_WH2,s=[];return this.bufGrids.forEach((a,l)=>{let c=i*2**l,h=Math.floor((r.minX-n)/c),u=Math.floor((r.maxX+n)/c),d=Math.floor((r.minY-n)/c),p=Math.floor((r.maxY+n)/c);for(let m=h;m<=u;m++){let g=a.get(m);if(g)for(let y=d;y<=p;y++){let b=g.get(y);b&&s.push(b)}}}),s.push(this.block),s.push(this.defaultBlock),s}draw(t,e,r,i,n,s,a,l,c,h="render",u,d){let p=this.filterBlocks(r,e),m=this.templateBlock;this.scene.renderPtProgram.draw(t,e,r,i,n,p,!1,!1,!1,!1,c,h,m,u,d),this.scene.renderPtProgram.draw(t,e,r,i,n,p,!1,a,l,c,!1,h,m,u,d),this.scene.renderPtProgram.draw(t,e,r,i,n,p,s,!1,!1,!1,!1,h,m,u,d)}drawHighLightPt(t,e,r,i,n,s,a,l,c,h){let u=this.filterBlocks(e),d=this.templateBlock;this.scene.renderHighLightPtProgram.draw(t,e,r,u,i,n,s,a,l,c,h,d)}},got=10,RLe=(o=>(o[o.ID=0]="ID",o[o.LD_POINT_X=1]="LD_POINT_X",o[o.LD_POINT_y=2]="LD_POINT_y",o[o.LU_POINT_X=3]="LU_POINT_X",o[o.LU_POINT_Y=4]="LU_POINT_Y",o[o.RD_POINT_X=5]="RD_POINT_X",o[o.RD_POINT_Y=6]="RD_POINT_Y",o[o.RU_POINT_X=7]="RU_POINT_X",o[o.RU_POINT_Y=8]="RU_POINT_Y",o[o.ORDER=9]="ORDER",o))(RLe||{}),yot=class extends f0{constructor(o,t,e,r,i,n,s,a=1,l=0){super(70,got,RLe),this.scene=o,this.data=this.create(t,e,r,i,n,l,s),this.alpha=a}getData(){return this.data}create(o,t,e,r,i,n=0,s){return s===null?(this.gpuTexture=s,this.bindGroup=null):s&&(this.gpuTexture=s,this.bindGroup=this.scene.textureProgram.createBindGroup(s)),[o+(70<<fa),t.x,t.y,e.x,e.y,r.x,r.y,i.x,i.y,n]}get ldPoint(){return new S(this.data[1],this.data[2])}get luPoint(){return new S(this.data[3],this.data[4])}get rdPoint(){return new S(this.data[5],this.data[6])}get ruPoint(){return new S(this.data[7],this.data[8])}getBaseBBox(){let o=Math.min(this.luPoint.x,this.ldPoint.x,this.ruPoint.x,this.rdPoint.x),t=Math.max(this.luPoint.x,this.ldPoint.x,this.ruPoint.x,this.rdPoint.x),e=Math.min(this.luPoint.y,this.ldPoint.y,this.ruPoint.y,this.rdPoint.y),r=Math.max(this.luPoint.y,this.ldPoint.y,this.ruPoint.y,this.rdPoint.y);return ul.modify(o,t,e,r)}sycnStatus(o,t,e,r,i,n=1,s=0,a){return this.data=this.create(o,t,e,r,i,s,a),this.alpha=n,this}getBBox(o,t){return ul.modify(Math.min(o[t+1],o[t+7]),Math.max(o[t+1],o[t+7]),Math.min(o[t+2],o[t+8]),Math.max(o[t+2],o[t+8]))}},bot=class{constructor(o,t){this.scene=t,this.bitmap=new Cg(4),this.instanceData=o,this.templateInstanceAndIdMap=new Map}add(o){if(this.templateInstanceAndIdMap.get(o))throw new Error("instanceId error");let t=this.bitmap.findEmpty();t===-1&&(this.bitmap=this.bitmap.extSize(this.bitmap.size*2),t=this.bitmap.findEmpty()),this.bitmap.markUsed(t),this.instanceData.set(t,o),this.templateInstanceAndIdMap.set(o,t)}remove(o){let t=this.templateInstanceAndIdMap.get(o);if(t===void 0)throw new Error("InstanceId error");this.instanceData.set(t,-1),this.bitmap.markRemove(t),this.templateInstanceAndIdMap.delete(o)}getData(){return this.instanceData}getMaxTemplateInstanceIndex(){return this.bitmap.getMax()}},iE=class extends x2e{constructor(o,t,e,r,i,n,s=!0,a=!1,l=!1,c=!1){super(e,r,i),this.ignoreForceHighLightEffect=l,this.bboxFac2=new _e,this.hasColorfulPolygon=!1,this.textures=[],this.panelize=!1,this.interPlanes=[this],this.subPlanes=[],this.ptNum=0,this.ptTypeNum=Array(69).fill(0),this.highLightPtNumById=0,this._isColorful=!1,this.visible=!0,this.polygonColorAndGroupIdMap=new Map,this.networkTextColor=ee.WHITE,this.polygonColorAlphaRatio=1,this.alphaOverlay=1,this.templateFacMap=new Map,this.templateInstancePtMap=new Map,this.polygonTemplatePtColorArr=[],this.isUnderGrid=!1,this.deactivateAlphaRatio=1,this.transparentObjs=[],this.renderTexture=!0,this.renderOther=!0,this.parts=[{matrix:Qe.ORIGIN,plane:this}],this.alwaysUpdateBBox=!0,this.dictOutMatrixRenderCfg={},this.originalColor=e,s||(n=!1),this.scene=o,this.isNormal=n,this.panelize=s,this.isHighLight=a,this.isUnderGrid=c,this.underGridError(),this.builder=new nRe(o,s,this),this.templateBboxBuild=$m.create(Float32Array,o.gpu,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,"templateBboxBuild of Plane"),this.templatePtOffsetBuild=$m.create(Float32Array,o.gpu,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.STORAGE,"templatePtOffsetBuild of Plane"),this.customTemplateInstancePtNumBuilder=$m.create(Float32Array,o.gpu,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.STORAGE,"customTemplateInstancePtNumBuilder of Plane"),this.id=t,this.drawTemplateBindGroup=this.createDrawTemplateBindGroup(),this.templatePtIdMap=new Map,this.templateInstance=new bot($m.create(Float32Array,o.gpu,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,"templateInstanceBuild of Plane"),this.scene)}underGridError(){if(this.isUnderGrid&&this.isNormal)throw new Error("Under grid plane is normal")}setNetworkHighLightStatus(o){throw new Error("gpu not supported ")}setNetworkTextColor(o){this.networkTextColor!=o&&(this.networkTextColor=o)}getNetStringColor(){return this.networkTextColor}setPolygonColorAlphaRatio(o){this.polygonColorAlphaRatio!=o&&(this.polygonColorAlphaRatio=o)}setIsColorful(o){this._isColorful!=o&&(this._isColorful=o)}get isColorful(){return this._isColorful}setColor(o){this.isColorful&&(this.originalColor=o),o!==this.color&&(super.setColor(o),this.scene.needRender=!0)}setAlphaOverlay(o){if(this.alphaOverlay==o)return;let t=this.getColor();this.alphaOverlay=o,this.setColor(ee.of6(t,t.alpha*o))}getOriginalColor(){return this.originalColor||this.color}createDynamicBindGroup(o){return this.scene.gpu.createDynamicBindGroup(this.scene.renderPtProgram.renderPtBindGroupLayout,0,this.scene.cameraBuf,1,this.scene.renderPtProgram.uniformsBuf,4,this.scene.colorsBuf,5,this.scene.renderPtProgram.sampler,6,this.scene.char.texture,7,this.scene.staticPolygonInfoBuilder.updateBuf(),8,this.scene.stringInfoBuilder.updateBuf(),9,this.scene.ptGroup.getData().updateBuf(),10,this.scene.renderPtProgram.highLightStencilBuf,11,this.scene.sdfStringLibrary.stringInfoBuilder.updateBuf(),12,this.scene.sdfStringLibrary.getSdfBuffer(),13,this.templatePtOffsetBuild.updateBuf(),14,this.scene.ptTemplate.getTemplateInstanceData().updateBuf(),15,o)}createDrawTemplateBindGroup(){return this.scene.gpu.createDynamicBindGroup(this.scene.renderPtProgram.templateLayout,0,this.scene.renderPtProgram.drawTemplatePipelineUniformsBuf,1,this.scene.cameraBuf,2,this.scene.gpu.linearSampler,3,this.scene.renderPtProgram.templateTarget.colorTexture,4,this.templateBboxBuild.updateBuf(),5,this.templatePtOffsetBuild.updateBuf(),6,this.scene.ptTemplate.getTemplateInstanceData().updateBuf())}addHighLightPt(o,t,e,r=0){let i=this.scene.getColorIndex(e,r);this.builder.addHighLightPt(o,t,i),this.highLightPtNumById++}removeHighLightPt(o,t,e,r=0){let i=this.scene.getColorIndex(e,r),{num:n}=this.builder.removeHighLightPt(o,t,i);this.highLightPtNumById-=n}setHighLightPtNum(o,t,e,r,i=0){let n=this.scene.getColorIndex(r,i);this.builder.setHighLightPtNum(o,t,e,n),this.highLightPtNumById+=e}addHighLightPts(o,t,e,r=0){switch(o[0]){case 1:for(let i=1;i<o.length;i++)this.addHighLightPt(o[i],t,e,r);break;case 0:for(let i=2;i<o.length;i++)this.addHighLightPt(o[i],t,e,r);break;default:throw new Error("addHighLightPts not support")}}removeHighLightPts(o,t,e,r=0){switch(o[0]){case 1:for(let i=1;i<o.length;i++)this.removeHighLightPt(o[i],t,e,r);break;case 0:for(let i=2;i<o.length;i++)this.removeHighLightPt(o[i],t,e,r);break;default:throw new Error("removeHighLightPts not support")}}setHighLightPtsNum(o,t,e,r,i=0){switch(o[0]){case 1:for(let n=1;n<o.length;n++)this.setHighLightPtNum(o[n],t,e,r,i);break;case 0:for(let n=2;n<o.length;n++)this.setHighLightPtNum(o[n],t,e,r,i);break;default:throw new Error("setHighLightPtsNum not support")}}renderHighLightPt(o,t,e,r,i,n,s,a,l=!0){this.builder.drawHighLightPt(o,t,this,e,r,i,n,s,l,a)}updateMatrix(o){super.updateMatrix(o),this.scene.needRender=!0;for(let t of o.values()){let e=Mt.ORIGIN.multiply4(t),r=new Mt(1,0,0).multiply4(t),i=new Mt(0,1,0).multiply4(t);if(e.x!==0||e.y!==0||r.x!==1||r.y!==0||i.x!==0||i.y!==1)throw new Error("oP.x !== 0 || oP.y !== 0 || xP.x !== 1 || xP.y !== 0 || yP.x !== 0 || yP.y !== 1")}}getPtBBox(o,t,e=this.scene.staticPolygonInfoBuilder,r=0,i=this.scene.getFixedPtData()){if(t===void 0&&(t=Ur.getType(o[0])),Ur.isTemplateInstancePtType(t)){let n=this.builder.getTemplatePt(o[1],Ur.getTemplateTypeByTemplateInstanceType(t)),s=Ur.getBBox(n,r,e,i),a=Ur.getTemplateId(n,0,e),l=o[2];return this.scene.ptTemplate.getTemplateInstanceBBox(a,l,s)}else return Ur.getBBox(o,r,e,i)}addPt(o,t=-1){let e=this.scene.staticPolygonInfoBuilder,r=Ur.getType(o[0]),i=this.getPtBBox(o,r,e);Ur.isTemplateOriginPtType(r)&&this.updateTemplateBbox(o,i,e),this.bboxFac2.ext5(i.minX,i.maxX,i.minY,i.maxY),this.ptNum++,this.ptTypeNum[r]++;let n=this.builder.addPt(o,e);if(this.isTemplatePt(t)){let s=this.templatePtIdMap.get(t);s||(s=new Set,this.templatePtIdMap.set(t,s)),s.add(n),this.scene.ptTemplate.forEachInstanceId(t,a=>{this.createTemplateInstancePt(n,a,!0)})}return n}updatePt(o,t,e=-1){this.isTemplatePt(e)&&this.scene.ptTemplate.forEachInstanceId(e,a=>{this.removePt(this.templateInstancePtMap.get(a).get(o))});let r=this.getPtBBox(t);this.bboxFac2.ext5(r.minX,r.maxX,r.minY,r.maxY);let i=Ur.getType(t[0]);this.updateTemplateBbox(t,r);let{oldPt:n,isHighLightPt:s}=this.builder.updatePt(o,t,null,r);if(Ur.isTemplateOriginPtType(i)&&Ur.getTemplateId(n,0,null)!==Ur.getTemplateId(t,0,null))throw new Error("PtTools.getTemplateId(oldPt, 0, null) !== PtTools.getTemplateId(pt, 0, null)");this.isTemplatePt(e)&&this.scene.ptTemplate.forEachInstanceId(e,a=>{this.createTemplateInstancePt(o,a)})}createOrUpdatePt(o,t,e){return this.isExistingPt(t)?(this.updatePt(t,o,e),t):this.addPt(o,e)}removeTexture(o){delete this.textures[o],--this.ptNum===0&&this.setEmpty(),this.ptTypeNum[70]--,this.scene.needRender=!0}removePt(o,t=this.scene.staticPolygonInfoBuilder){let{oldPt:e,isHighLightPt:r,highLightInfo:i}=this.builder.removePt(o);--this.ptNum===0&&this.setEmpty();let n=nRe.getTypeById(o);if(Ur.isTemplateOriginPtType(n)){let s=Ur.getTemplateId(e,0,t);this.isTemplatePt(s)&&(this.templatePtIdMap.get(s).delete(o),this.scene.ptTemplate.forEachInstanceId(s,a=>{let l=this.templateInstancePtMap.get(a);this.removePt(l.get(s)),l.delete(s)}))}return this.ptTypeNum[n]--,{pt:e,isHighLightPt:r,highLightInfo:i}}removePoint(o){this.builder.removePt(o),--this.ptNum===0&&this.setEmpty(),this.ptTypeNum[5]--}removePolygonPt(o){let t=this.scene.staticPolygonInfoBuilder,e,r,i,n;switch(o[0]){case 1:for(let a=1;a<o.length;a++){let{pt:l}=this.removePt(o[a],t);i===void 0&&(i=Ur.getType(l[0])),e===void 0&&(e=Ur.getColorIndex(l,0,this.scene.staticPolygonInfoBuilder)),Ur.isTemplateOriginPtType(i)&&r===void 0&&(r=Ur.getTemplateId(l,0,t)),n===void 0&&(n=Ur.getGroupId(l,0,t))}break;case 0:let s=o[1];this.scene.removeStaticPolygonInfo(s);for(let a=2;a<o.length;a++){let{pt:l}=this.removePt(o[a],t);i===void 0&&(i=Ur.getType(l[0])),e===void 0&&(e=Ur.getColorIndex(l,0,this.scene.staticPolygonInfoBuilder)),Ur.isTemplateOriginPtType(i)&&r===void 0&&(r=Ur.getTemplateId(l,0,t)),n===void 0&&(n=Ur.getGroupId(l,0,t))}break;default:throw new Error("ids error")}this.isTemplatePt(r)&&this.polygonTemplatePtColorArr.forEach((s,a)=>{e==s&&this.polygonTemplatePtColorArr.splice(a,1)}),this.scene.removePolygonGroupId(n)}hiddenPolygonPt(o){switch(o[0]){case 1:for(let t=1;t<o.length;t++)this.hiddenPt(o[t]);break;case 0:for(let t=2;t<o.length;t++)this.hiddenPt(o[t]);break;default:throw new Error("ids error")}}showPolygonPt(o){switch(o[0]){case 1:for(let t=1;t<o.length;t++)this.showPt(o[t]);break;case 0:for(let t=2;t<o.length;t++)this.showPt(o[t]);break;default:throw new Error("ids error")}}createOrUpdateLine(o,t,e,r,i,n,s,a,l,c,h,u,d,p){let m;return this.isTemplatePt(p)?m=this.createOrUpdatePt($we.create(this.id,t,e,r,i,s,this.scene.getColorIndex(n),a,p),o,p):m=this.createOrUpdatePt(b2e.create(this.id,t,e,r,i,s,this.scene.getColorIndex(n),a),o),m}createOrUpdateRectShadowFrame(o,t,e,r,i,n,s,a,l){throw new Error("gpu not supported ")}createOrUpdateRect(o,t,e,r,i,n=0,s,a,l,c,h){let u;return this.isTemplatePt(h)?u=this.createOrUpdatePt(vwe.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l,h),o,h):u=this.createOrUpdatePt(s2e.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l),o),u}createRect(o,t,e,r,i,n){this.createOrUpdateRect(-1,o.leftUpPoint,o.width,o.height,qh.toRadians(o.angle),o.radius,t,e,r,i,n)}createOrUpdateDrcArrow(o,t,e,r,i){return this.createOrUpdatePt(this.scene.drcRenderModel===1?ILe.create(this.id,t,e,r,i):CLe.create(this.id,t,e,r,i),o)}createOrUpdateLineSegment(o,t,e,r,i,n,s,a,l,c){let h;return this.isTemplatePt(c)?h=this.createOrUpdatePt(Zrt.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l,c),o,c):h=this.createOrUpdatePt(e2e.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l),o),h}getArcSweepAngle(o,t,e){return e===le.CCW?t>o?t-o:t-o+pa:t<o?t-o:t-o-pa}isTemplatePt(o){return!!(o&&o!==-1||o===0)}createOrUpdateArc(o,t,e,r,i,n,s,a,l,c,h,u){e<zJ&&(e=zJ),n<0&&(i=i+n,n=-n),i%=pa,i<0&&(i+=pa);let d;return this.isTemplatePt(u)?d=this.createOrUpdatePt(Ewe.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l,u),o,u):d=this.createOrUpdatePt(r2e.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l),o),d}createOrUpdateEllipse(o,t,e,r,i,n,s,a,l,c,h="round",u,d=0,p,m){let g=sk[h],y=this.scene.getColorIndex(l),b=this.scene.getColorIndex(u);return this.createOrUpdatePt(sQ.create(this.id,t,e,r,i,n,s,a,y,-1,g,b,d,p,m),o)}createOrUpdateBezier(o,t,e,r,i,n,s,a,l="round",c,h){let u=sk[l],d=this.scene.getColorIndex(s);return this.createOrUpdatePt(m2e.create(this.id,t,e,r,i,n,d,-1,u,c,h),o)}createOrUpdateCircle(o,t,e,r,i,n,s,a){let l;return this.isTemplatePt(a)?l=this.createOrUpdatePt(iLe.create(this.id,t,e,i,this.scene.getColorIndex(r),n,a),o,a):l=this.createOrUpdatePt(_2e.create(this.id,t,e,i,this.scene.getColorIndex(r),n),o),l}createOrUpdateSemicircle(o,t,e,r,i,n,s,a){let l;return this.isTemplatePt(a)?l=this.createOrUpdatePt(iit.create(this.id,t,e,this.scene.getColorIndex(r),this.scene.getColorIndex(i),n,s,a),o,a):l=this.createOrUpdatePt(n2e.create(this.id,t,e,this.scene.getColorIndex(r),this.scene.getColorIndex(i),n,s),o),l}createOrUpdatePoint(o,t,e,r,i,n,s){return this.createOrUpdatePt(Jbe.create(this.id,t,e,r,this.scene.getColorIndex(i),n,s),o)}createWireFramePts(o,t,e,r,i,n,s){let a=this.isTemplatePt(s);o.forEach(l=>{if(l instanceof q){let c=qh.toRadians(l.sweepAngle),h=qh.toRadians(l.startAngle);c<0&&(h=h+c,c=-c),h%=pa,h<0&&(h+=pa);let u=a?pit:h2e;e.push(this.addPt(u.create(t,l.center,l.rx,h,c,r,i,n,s),s))}else if(l instanceof Mr){let c=l.points(.1),h=a?Wxe:mW;for(let u=0;u<c.length-1;u+=1)e.push(this.addPt(h.create(t,c[u],c[u+1],r,i,n,s),s))}else if(l instanceof M){let c=a?Wxe:mW;e.push(this.addPt(c.create(t,l.start(),l.end(),r,i,n,s),s))}else console.error("Not Support Primitive Type")})}createStaticWireFramePts(o,t,e,r,i){let n=this.isTemplatePt(i);o.forEach(s=>{if(s instanceof q){let a=qh.toRadians(s.sweepAngle),l=qh.toRadians(s.startAngle);a<0&&(l=l+a,a=-a),l%=pa,l<0&&(l+=pa);let c=n?git:p2e;e.push(this.addPt(c.create(t,s.center,s.rx,l,a,r),i))}else if(s instanceof Mr){let a=s.points(.1),l=n?zxe:gW;for(let c=0;c<a.length-1;c+=1)e.push(this.addPt(l.create(t,a[c],a[c+1],r),i))}else if(s instanceof M){let a=n?zxe:gW;e.push(this.addPt(a.create(t,s.start(),s.end(),r),i))}else console.error("Not Support Primitive Type")})}createPolygon0(o,t,e,r,i,n,s,a,l,c=.1){var h,u;this.scene.addPolygonGroupId(a);let d=[],p=this.scene.getColorIndex(e);if(p!==0&&(this.hasColorfulPolygon=!0),a||a==0){let m=this.polygonColorAndGroupIdMap.get(p);m||m==0?Array.isArray(m)?m.includes(a)||m.push(a):m!==a&&(m=[m,a],this.polygonColorAndGroupIdMap.set(p,m)):this.polygonColorAndGroupIdMap.set(p,a)}for(let m of t){if(!((h=m.primitives)!=null&&h.length))continue;o[0]===1?n(m.primitives,this.id,o,s,p,a,l):n(m.primitives,this.id,o,o[1],l);let g=[],y,b,P,T,I,C=(u=m.primitives)==null?void 0:u[m.primitives.length-1].end(),E=()=>{if(y){if(T>0)for(let v=0;v<T;v+=360)o.push(this.addPt(r(this.id,y,b,qh.toRadians(P+v),qh.toRadians(Math.min(T-v,360)),I,C,s,p,a),l));else for(let v=0;v>T;v-=360)o.push(this.addPt(r(this.id,y,b,qh.toRadians(P+v),qh.toRadians(Math.max(T-v,-360)),I,C,s,p,a),l));I.equals(C)||g.push(new M(I,C)),y=null}};if(m.primitives.forEach((v,D)=>{if(v instanceof q&&v.rx===v.ry){if(y){if(b===v.rx&&y.equals(v.center)&&Dv.eq(qh.regularD(P+T),qh.regularD(v.startAngle))){T+=v.sweepAngle,C=v.end();return}E()}y=v.center,b=v.rx,P=v.startAngle,T=v.sweepAngle,v.start().equals(C)||g.push(new M(C,v.start())),I=v.start()}else E(),v.start().equals(C)||g.push(new M(C,v.start())),g.push(v);C=v.end()}),E(),g.length===0)continue;let O=[];for(fe.build2(g).points(c,v=>O.push(v));O.length!==0&&O[0].equals(O[O.length-1]);)O.pop();if(O.length<3)continue;let _=O[0],R=[_];for(let v=1;v<O.length;v++){let D=O[v];_.equals(D)||(R.push(D),_=D)}R.length>=3&&d.push(R)}for(let m of d){let g=m.slice();for(let y=0;y<g.length-2;y+=2){let b=this.addPt(i(this.id,g[y],g[y+1],g[y+2],s,p,a),l);o.push(b),g.push(g[y])}}return this.isTemplatePt(l)&&this.polygonTemplatePtColorArr.push(p),o}createPolygon(o,t,e,r,i,n,s=.1){let a=this.isTemplatePt(n);return this.createPolygon0([1],o,t,(l,c,h,u,d,p,m,g,y)=>a?eLe.create(l,c,h,u,d,p,m,g,y,r,n):E2e.create(l,c,h,u,d,p,m,g,y,r),(l,c,h,u,d,p)=>a?Jwe.create(l,c,h,u,d,p,r,n):I2e.create(l,c,h,u,d,p,r),this.createWireFramePts.bind(this),e,r,n,s)}createStaticPolygon(o,t,e,r,i,n,s,a){let l=this.scene.addStaticPolygonInfo(e,t,r,s,i),c=this.isTemplatePt(s);return this.createPolygon0([0,l],o,t,(h,u,d,p,m,g,y)=>(c?uit:xW).create(h,u,d,p,m,g,y,l),(h,u,d,p)=>(c?cit:vW).create(h,u,d,p,l),this.createStaticWireFramePts.bind(this),e,r,s,a)}createOrUpdateTexture(o,t,e,r,i,n,s,a,l,c,h){if(o==null||o<0){let u=new yot(this.scene,this.id,t,e,r,i,n,a,l);o=this.textures.findIndex(p=>!p),o===-1?(this.textures.push(u),o=this.textures.length-1):this.textures[o]=u;let d=u.getBaseBBox();this.bboxFac2.ext5(d.minX,d.maxX,d.minY,d.maxY),this.scene.needRender=!0,this.ptNum++,this.ptTypeNum[70]++}else{let u=this.textures[o];u.sycnStatus(this.id,t,e,r,i,a,l,n);let d=u.getBaseBBox();this.bboxFac2.ext5(d.minX,d.maxX,d.minY,d.maxY),this.scene.needRender=!0}return o}getPxLength(o,t){let e;if(o.isOrthCamera())e=o.getPxLength();else{let r=this.getBBox(),i=(r?r.center():o.getTarget()).multiply4(t),n=o.getTarget().sub(i).dot(o.getTar2Pos().normalize());e=o.getPxLength()*(n/o.getTar2Pos().length()+1)}return e}isEmpty(){return this.parts.every(({plane:o})=>!o.bboxFac2.valid())}getAllPtBbox(){return this.bboxFac2.valid()?this.bboxFac2.build1():null}getAllRgbRatio(){return this.scene.getForceDeactivateRatio()*this.getRgbRatio()}setEmpty(){this.bboxFac2.clear()}clear(){this.builder.clear(),this.ptNum=0,this.ptTypeNum=Array(69).fill(0),this.setEmpty()}getBBox(){try{let o=Number.NEGATIVE_INFINITY,t=Number.NEGATIVE_INFINITY,e=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;for(let i of this.interPlanes){let n=i.getBBox2ContainsPart();o=Math.max(n.minX,o),e=Math.min(n.maxX,e),t=Math.max(n.minY,t),r=Math.min(n.maxY,r)}return new by(o,t,0,e,r,0)}catch{return null}}drawSelf(o,t,e,r,i,n="render",s,a,l,c,h){if(!(n==="render"&&!r.renderOther))for(let u of this.parts){let d=u.matrix.toMatrix4().multiply4(e),p=u.plane;this.scene.renderPtProgram.templateCamera.setScale(t.getScale(),!1);let m=this.getPxLength(t,d),g=-Ov/2,y=j7/2,b=-g,P=-y,T=0,I=!0;if(this.templateBboxBuild.setArr(new Uint8Array(this.templateBboxBuild.getLength()),0),!this.templateFacMap.size)I=!1;else for(let[C,E]of this.templateFacMap){let O=E.build(),_=O.minX/m-2,R=O.maxY/m+2,v=Math.ceil(O.width()/m)+4,D=Math.ceil(O.height()/m)+4;if(v>Ov){I=!1;break}if(g+v<=b?T=Math.max(T,D):(g=-Ov/2,y-=T,T=D),y-T<P){I=!1;break}let w=(g-_)*m,F=(y-R)*m;this.templatePtOffsetBuild.setArr([w,F],C*Got),this.templateBboxBuild.setArr([_*m,R*m,v*m,D*m],C*GLe),g+=v}this.templatePtOffsetBuild.updateBuf(),this.templateBboxBuild.updateBuf(),I!==this.lastIsRenderTemplateTexture&&(console.log(p.label,I?"\u5207\u6362\u5230\u4F7F\u7528\u6A21\u677F\u7EB9\u7406\u6E32\u67D3":"\u5207\u6362\u5230\u4E0D\u4F7F\u7528\u6A21\u677F\u7EB9\u7406\u6E32\u67D3"),this.lastIsRenderTemplateTexture=I),p.builder.draw(o,d,t,r,i,a,l,c,s,n,I,h),r.renderTexture&&n==="render"&&p.drawTextures(o,d,i,r.getMaterial())}}draw(o,t,e,r,i,n=!0,s=!0,a=!0,l,c=!1){let h=this.outMatrixParamMap.get(e);if(h){if(h.renderI===this.scene.renderI)return;h.renderI=this.scene.renderI}if(this.interPlanes.length===0||!this.isColorful&&(r===2&&this.getMaterial().alpha===0||(r===0||r===1)&&this.getColor().alpha===0)||this.noDrawing)return;let u=this.interPlanes.slice(),d=this.subPlanes.slice(),p=this.dictOutMatrixRenderCfg[e.toString()];if(p)if(p.replacePlane){d=p.listSubPlane;for(let m of p.listInterPlane)m&&u.push(m)}else{for(let m of p.listSubPlane)m&&d.push(m);for(let m of p.listInterPlane)m&&u.push(m)}if(l)this.scene.drawStencilProgram.draw(o,!1,64,128),u=u.filter(m=>m!==l);else if(u.length===1){this.scene.clearStencilValue(64,o.depthStencilTexture.view,"planeDraw");for(let m of d)m.drawSelf(o,t,e,this,r,"drawNotPassStencil",i,n,s,a,c);u[0].drawSelf(o,t,e,this,r,"render",i,n,s,a,c);return}else this.scene.clearStencilValue(0,o.depthStencilTexture.view,"planeDraw"),u.pop().drawSelf(o,t,e,this,r,"drawPassStencil",i,n,s,a,c);for(let m of d)m.drawSelf(o,t,e,this,r,"drawNotPassStencil",i,n,s,a,c);if(u.length===0)this.scene.drawColorUseStencilProgram.render(o,r,e,this.getMaterial(),this.getColor(),this.getBBox());else{for(let m=1;m<u.length;m++)u[m].drawSelf(o,t,e,this,r,"drawInterStencil",i,n,s,a,c),this.scene.drawStencilProgram.draw(o,!0,192,127),this.scene.drawStencilProgram.draw(o,!0,128,128),this.scene.drawStencilProgram.draw(o,!1,64,63);u[0].drawSelf(o,t,e,this,r,"render",i,n,s,a,c)}}drawStencilPlane(o,t,e,r,i,n=!0,s=!0,a=!0,l=!1){this.scene.clearStencilValue(0,o.depthStencilTexture.view,"drawStencilPlane"),this.drawSelf(o,t,e,this,r,"drawPassStencil",i,n,s,a,l)}drawTextures(o,t,e,r){this.textures.forEach(i=>{this.scene.textureProgram.render(o,t,i,e,r)})}createStringPt(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.scene.getColorIndex(a),m=this.scene.addStringInfo(o),{strWidth:g,strHeight:y}=Rv.getStrInfo(o,n,s);return this.isTemplatePt(d)?WJ.create(this.id,t,g,y,e,o.length,m,r,i,u,p,l,c,h,d):ck.create(this.id,t,g,y,e,o.length,m,r,i,u,p,l,c,h)}createScaleStringPt(o,t,e,r,i,n,s,a,l,c){let h=this.scene.getColorIndex(n),u=this.scene.addStringInfo(o),{strWidth:d,strHeight:p}=Rv.getStrInfo(o,r,i);return yLe.create(this.id,t,d,p,e,o.length,u,c,h,s,a,l)}createOrUpdateNetWorkText(o,t,e,r,i,n,s,a,l,c,h,u,d,p){return this.createOrUpdatePt(this.createStringPt(t,e,r,i,n,s,a,l,c,u,d,h,p),o,p)}createOrUpdateScaleString(o,t,e,r,i,n,s,a,l,c,h){return this.createOrUpdatePt(this.createScaleStringPt(t,e,r,i,n,s,a,c,h,l),o)}isExistingPt(o){return o!=null&&o>=0}createTemplateInstancePt(o,t,e=!1){let{type:r,block:i,index:n}=this.builder.getInfo(o);if(r==60){let{level:l,index:c,builder:h}=i.getStringInfo(n,r);n=(c<<pS)+l}e?this.customTemplateInstancePtNumBuilder.get(t)!==0&&(r=Ur.getCustomTemplateInstanceType(Ur.getTemplateInstanceType(r))):r=Ur.getTemplateInstanceType(r);let s=this.addPt(this.createTemplateInstancePtData(r,t,n)),a=this.templateInstancePtMap.get(t);a||(a=new Map,this.templateInstancePtMap.set(t,a)),a.set(o,s)}createOrUpdateDrc(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.scene.getColorIndex(c),p=this.scene.sdfStringLibrary.getIndex(a),m=this.scene.sdfStringLibrary.getIndex(l);return this.createOrUpdatePt(Kbe.create(this.id,t,n,s,e,r,i,p,m,u,d,h),o)}createSdfStringPt(o,t,e,r,i,n,s,a,l,c){let h=this.scene.getColorIndex(s),u,{strIndex:d,fontWidth:p}=this.scene.addSdfStringInfo(o,n,u,c);return RL.create(this.id,d,t,e,p,i,h,a,l)}createOrUpdateNormalString(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I){throw new Error("Sdf text not support")}createOrUpdateNormalStringMatrix(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g){throw new Error("Sdf text not support")}isPanelize(){return this.panelize}setIsUnderGrid(o){this.isUnderGrid!==o&&(this.underGridError(),this.isUnderGrid=o,this.scene.needRender=!0)}getIsUnderGrid(){return this.isUnderGrid}isRender(){return this.scene.getHasGroupForceHighLight()&&this.scene.getForceVisibleHighLightPt()&&!this.ignoreForceHighLightEffect?!0:this.visible}isVisible(){return this.visible}setVisible(o){this.visible=o,this.scene.needRender=!0}createOrUpdateArcSegment(o,t,e,r,i,n,s,a,l,c){return this.createOrUpdateArc(o,t,e,0,r,this.getArcSweepAngle(r,i,n),s,a,l,"round",[],c)}getPtNum(){return this.ptNum}getPtTypeNum(){return this.ptTypeNum}getHighLightPtNum(){return this.highLightPtNumById}hiddenPt(o){this.builder.setPtVisible(o,!1)}showPt(o){this.builder.setPtVisible(o,!0)}hiddenPoint(o){this.builder.setPtVisible(o,!1)}showPoint(o){this.builder.setPtVisible(o,!0)}updateTemplateBbox(o,t,e=this.scene.staticPolygonInfoBuilder,r=Ur.getType(o[0])){if(!Ur.isTemplateOriginPtType(r))return;let i=Ur.getTemplateId(o,0,e);if(this.isTemplatePt(i)){let n=this.templateFacMap.get(i);n||(n=new _e,this.templateFacMap.set(i,n)),n.ext5(t.minX,t.maxX,t.minY,t.maxY)}}setStaticPolygonInfo(o,t){let e=o[1],r=this.scene.staticPolygonInfoBuilder.copy();this.scene.setStaticPolygonInfo(e,t);let i=this.scene.staticPolygonInfoBuilder;for(let n=2;n<o.length;n++){let s=o[n],a=this.builder.getPt(s),l=this.getPtBBox(a,void 0,i);this.builder.updatePt(s,a,i,l),this.bboxFac2.ext5(l.minX,l.maxX,l.minY,l.maxY),this.updateTemplateBbox(a,l,i)}}createTemplateInstancePtData(o,t,e,r,i){switch(o){case 21:return yrt.create(this.id,e,t,r,i);case 22:return brt.create(this.id,e,t,r,i);case 23:return Prt.create(this.id,e,t,r,i);case 24:return Trt.create(this.id,e,t,r,i);case 25:return Irt.create(this.id,e,t,r,i);case 26:return Crt.create(this.id,e,t,r,i);case 27:return Srt.create(this.id,e,t,r,i);case 29:return Ort.create(this.id,e,t,r,i);case 28:return Ert.create(this.id,e,t,r,i);case 31:return Art.create(this.id,e,t,r,i);case 32:return _rt.create(this.id,e,t,r,i);case 33:return vrt.create(this.id,e,t,r,i);case 34:return xrt.create(this.id,e,t,r,i);case 30:return Sv.create(this.id,e,t,r,i);case 35:return Rrt.create(this.id,e,t,r,i);case 36:return Drt.create(this.id,e,t,r,i);case 37:return wrt.create(this.id,e,t,r,i);case 38:return Lrt.create(this.id,e,t,r,i);case 39:return Mrt.create(this.id,e,t,r,i);case 40:return Nrt.create(this.id,e,t,r,i);case 41:return krt.create(this.id,e,t,r,i);case 42:return Brt.create(this.id,e,t,r,i);case 44:return Vrt.create(this.id,e,t,r,i);case 43:return Frt.create(this.id,e,t,r,i);case 46:return Urt.create(this.id,e,t,r,i);case 47:return Hrt.create(this.id,e,t,r,i);case 48:return Wrt.create(this.id,e,t,r,i);case 49:return zrt.create(this.id,e,t,r,i);case 45:return Grt.create(this.id,e,t,r,i);case 50:return Yrt.create(this.id,e,t,r,i);default:throw new Error(`${o},type Error`)}}isCustomTemplateInstancePt(o,t=-1){return o!==0||t!==-1}removeTemplate(o,t){t.forEach(e=>this.removeTemplateInstance(e)),this.templatePtIdMap.get(o).forEach(e=>this.removePt(e)),this.templatePtIdMap.delete(o)}addTemplateInstance(o,t){let e=this.templatePtIdMap.get(o);e&&(e.forEach(r=>{this.createTemplateInstancePt(r,t)}),this.templateInstance.add(t))}updateTemplateInstance(o,t){var e;let r=this.scene.staticPolygonInfoBuilder;(e=this.templateInstancePtMap.get(t))==null||e.forEach(i=>{let n=this.builder.getPt(i),s=this.getPtBBox(n,void 0,r);this.builder.updatePt(i,n,r,s),this.bboxFac2.ext5(s.minX,s.maxX,s.minY,s.maxY)})}removeTemplateInstance(o){var t;(t=this.templateInstancePtMap.get(o))==null||t.forEach(e=>{this.removePt(e)}),this.templateInstancePtMap.delete(o),this.customTemplateInstancePtNumBuilder.set(o,0),this.templateInstance.remove(o)}getTemplatePtIndex(o){let{type:t,block:e,index:r}=this.builder.getInfo(o);if(t==60){let{level:i,index:n,builder:s}=e.getStringInfo(r,t);r=(n<<pS)+i}return r}setTemplateInstancePt(o,t,e,r){let i=this.scene.getColorIndex(e),n=this.templateInstancePtMap.get(t).get(o);if(n===void 0)throw new Error("templateInstanceId error");let s=this.builder.getPt(n),a=this.isCustomTemplateInstancePt(s[3],s[4]),l=this.isCustomTemplateInstancePt(i,r);if(a!==l){let c=this.customTemplateInstancePtNumBuilder.get(t)||0,h=c+(l?1:-1);if(this.customTemplateInstancePtNumBuilder.set(t,h),c===0!=(h===0)){let u;h===0?(u=Ur.getTemplateTypeByCustomInstanceType,this.templateInstance.add(t)):(u=Ur.getCustomTemplateInstanceType,this.templateInstance.remove(t));let d=this.templateInstancePtMap.get(t);d.forEach((p,m)=>{let{pt:g,isHighLightPt:y,highLightInfo:b}=this.removePt(p),P=Ur.getType(g[0]),T=u(P),I=this.addPt(this.createTemplateInstancePtData(T,t,this.getTemplatePtIndex(m),p===n?i:g[3],p===n?r:g[4]));if(y){let{block:C,index:E}=this.builder.getInfo(I);C.addHighLightPtAll(T,E,b)}d.set(m,I)});return}}this.updatePt(this.templateInstancePtMap.get(t).get(o),this.createTemplateInstancePtData(Ur.getType(s[0]),t,this.getTemplatePtIndex(o),i,r))}setTemplateInstancePts(o,t,e,r){switch(o[0]){case 1:for(let i=1;i<o.length;i++)this.setTemplateInstancePt(o[i],t,e,r);break;case 0:for(let i=2;i<o.length;i++)this.setTemplateInstancePt(o[i],t,e,r);break;default:throw new Error("setTemplateInstancePts not support")}}addTemplateHighLightPt(o,t,e,r,i=0){let n=this.templateInstancePtMap.get(t).get(o);if(n===void 0)throw new Error("templateInstanceId is blank");let s=this.scene.getColorIndex(r,i);this.builder.addHighLightPt(n,e,s),this.highLightPtNumById++}setTemplateHighLightPtNum(o,t,e,r,i,n=0){let s=this.templateInstancePtMap.get(t).get(o);if(s===void 0)throw new Error("templateInstanceId is blank");let a=this.scene.getColorIndex(i,n),l=this.builder.setHighLightPtNum(s,e,r,a);this.highLightPtNumById+=r}removeTemplateHighLightPt(o,t,e,r,i=0){let n=this.templateInstancePtMap.get(t).get(o);if(!n)throw new Error("templateInstanceId is blank");let s=this.scene.getColorIndex(r,i),{pt:a,num:l}=this.builder.removeHighLightPt(n,e,s);this.highLightPtNumById-=l}addTemplateHighLightPts(o,t,e,r,i=0){switch(o[0]){case 1:for(let n=1;n<o.length;n++)this.addTemplateHighLightPt(o[n],t,e,r,i);break;case 0:for(let n=2;n<o.length;n++)this.addTemplateHighLightPt(o[n],t,e,r,i);break;default:throw new Error("addHighLightPts not support")}}removeTemplateHighLightPts(o,t,e,r,i=0){switch(o[0]){case 1:for(let n=1;n<o.length;n++)this.removeTemplateHighLightPt(o[n],t,e,r,i);break;case 0:for(let n=2;n<o.length;n++)this.removeTemplateHighLightPt(o[n],t,e,r,i);break;default:throw new Error("removeTemplateHighLightPts not support")}}setTemplateHighLightPtsNum(o,t,e,r,i,n){switch(o[0]){case 1:for(let s=1;s<o.length;s++)this.setTemplateHighLightPtNum(o[s],t,e,r,i,n);break;case 0:for(let s=2;s<o.length;s++)this.setTemplateHighLightPtNum(o[s],t,e,r,i,n);break;default:throw new Error("setHighLightPtsNum not support")}}getPtBboxById(o){let t=this.builder.getPt(o);return this.getPtBBox(t).build()}setRgbRatio(o){o!==this.deactivateAlphaRatio&&(this.deactivateAlphaRatio=o,this.scene.needRender=!0)}getRgbRatio(){return this.deactivateAlphaRatio}setRenderProcess(o=[this],t=[]){this.interPlanes=o.filter(e=>e),this.subPlanes=t.filter(e=>e&&!e.isEmpty())}sortTransparentObjs(){}getIsColorFul(){return this.isColorful}addPart(o,t){this.parts.push({matrix:o,plane:t})}clearParts(){this.parts.length=0}setPolygonAbleInter(o){}setAlwaysUpdateBBox(o){this.alwaysUpdateBBox=o}updateBBox(){try{let o=Number.NEGATIVE_INFINITY,t=Number.NEGATIVE_INFINITY,e=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;for(let i of this.interPlanes){let n=i.getAllPtBbox();o=Math.max(n.minX,o),e=Math.min(n.maxX,e),t=Math.max(n.minY,t),r=Math.min(n.maxY,r)}return this.bBox=new by(o,t,0,e,r,0),this.bBox}catch{return this.bBox=null,this.bBox}}addRenderProcess(o=[this],t=[]){for(let e of o)this.interPlanes.indexOf(e)<=-1&&this.interPlanes.push(e);for(let e of t)this.subPlanes.indexOf(e)<=-1&&this.subPlanes.push(e)}removeRenderProcess(o=[this],t=[]){for(let e of o){let r=this.interPlanes.indexOf(e);r>=0&&this.interPlanes.splice(r,1)}for(let e of t){let r=this.subPlanes.indexOf(e);r>=0&&this.subPlanes.splice(r,1)}}addOutMatrixRenderCfg(o,t){let e=o.getSelfAsOutToChildMatrix();for(let r of e){let i=this.outMatrixParamMap.get(r);i&&(t.visible=i.visible,this.dictOutMatrixRenderCfg[r.toString()]=t)}}removeOutMatrixRenderCfg(o,t){let e=o.getSelfAsOutToChildMatrix();for(let r of e)this.outMatrixParamMap.get(r)&&delete this.dictOutMatrixRenderCfg[r.toString()]}getBBox2ContainsPart(){let o=new _e;for(let t of this.parts){let{plane:e,matrix:r}=t,i=e.getAllPtBbox();i&&o.ext1(i.transform(r))}return o.valid()?o.build():null}getBBox2(){let o,t=this.getBBox();return t&&(o=t.toBBox2()),o}clearCpuMemory(){}getUnPanelBBox(){let o=new _e,{plane:t,matrix:e}=this.parts[0],r=t.getAllPtBbox();return r&&o.ext1(r.transform(e)),o.build()}ableCover(o){let t=new Set(o.interPlanes);for(let e of this.interPlanes)if(!t.has(e))return!1;return!0}isBoard(o){return this.interPlanes.length===1&&this.interPlanes[0].label==="board"&&this.subPlanes.length===0&&o!==1&&(o!==2||this.getMaterial().alpha===1)}hasInterPlane(o){return this.interPlanes.indexOf(o)!==-1}getMutualStencilPlane(o){let t=new Set(this.interPlanes);for(let e of o.interPlanes)if(t.has(e))return e;return null}},Q7=class extends x2e{constructor(o,t,e=null,r=null){super(t,e,r),this.elements=o}clear(){this.elements.decOut()}updateMatrix(o){let t=this.outMatrixParamMap.size;super.updateMatrix(o),t===0&&this.outMatrixParamMap.size!==0&&this.elements.incOut()}setMaterial(o){super.setMaterial(o)}setColor(o){super.setColor(o)}getNeedDrawParamsMap(o,t){let e=new Map;for(let r=t.length-1;r>=0;r--){let i=t[r],n=this.outMatrixParamMap.get(i.matrix);if(n.renderI!==o.renderI){let s=e.get(i.renderMode);s||(s=[],e.set(i.renderMode,s)),s.push(i)}n.renderI=o.renderI}return e}render(o,t,e){for(let r of e.entries()){let[i,n]=r;n.forEach(s=>{o.meshProgramGPU.render(t,o,i,s.matrix,this.elements,this.getMaterial(),this.color)})}}draw(o,t,e){let r=this.getNeedDrawParamsMap(o,e);r.size!==0&&this.render(o,t,r)}getBBox(){return this.elements.getBBox()}};var DLe=new ArrayBuffer(40),ZH=new Float64Array(DLe),Pot=new Int32Array(DLe),fS=class wLe{constructor(t,e,r,i=1,n=1){if(n<0||n>1)throw new Error("alpha must between 0 and 1");this.ambient=t,this.diffuse=e,this.specular=r,this.shininess=J7.positiveOr0(i),this.alpha=n,ZH[0]=t.hashCode(),ZH[1]=e.hashCode(),ZH[2]=r.hashCode(),ZH[3]=i,ZH[4]=n;let s=0;for(let a=0;a<10;a++)s^=Pot[a];this.hashed=s}hashCode(){return this.hashed}equals(t){return t instanceof wLe?t.ambient.equals(this.ambient)&&t.diffuse.equals(this.diffuse)&&t.specular.equals(this.specular)&&t.shininess===this.shininess&&t.alpha===this.alpha:!1}};function Ev(o,t){let e=o.get(t);return e||(e=[],o.set(t,e)),e}var oRe=class{constructor(){this.labelMapIndex={},this.transparentMap=new Map,this.opaqueMap=new Map}add(o,t){let e=t.renderMode,r=e===2||e===1?o.getMaterial().alpha:e===0?o.getColor().alpha:1;if(r===0)return;let i=ebe(this.labelMapIndex,o.label,()=>new Map);Ev(i,o).push(t),r===1?Ev(this.opaqueMap,o).push(t):Ev(this.transparentMap,o).push(t)}addCache(o){Object.entries(o.labelMapIndex).forEach(t=>{let[e,r]=t,i=ebe(this.labelMapIndex,e,()=>new Map);for(let n of r.entries()){let[s,a]=n,l=Ev(i,s);a.forEach(c=>l.push(c))}});for(let t of o.transparentMap.entries()){let[e,r]=t,i=Ev(this.transparentMap,e);r.forEach(n=>i.push(n))}for(let t of o.opaqueMap.entries()){let[e,r]=t,i=Ev(this.opaqueMap,e);r.forEach(n=>i.push(n))}}},x2=class jP{constructor(t=3,e=!1,r){this.drawHighlight=!0,this.outSelfMatrixVisibleMap=new Map,this.contents=new Set,this.containers=new Set,this.planeCache=new Map,this.meshCachesArrMap=new Map,this.position=Mt.ORIGIN,this.scale=new Mt(1,1,1),this.rotation=Mt.ORIGIN,this.addMatrix=Ae.ORIGIN,this.updateFlag=!1,this.visible=!0,this.hidden=!1,this.selfMatrix=this.addMatrix,this.isChange=!1,this.renderMode=t,this.name=r,e&&this.outSelfMatrixVisibleMap.set(Ae.ORIGIN,[new Ae,!0])}clone(t){let e=new jP(3,!1,this.name);return e.setDrawHighlight(this.drawHighlight),e.setPosition(this.position),e.setScale(this.scale),e.setRotation(this.rotation),e.setAddiMatrix(this.addMatrix),e.setRenderMode(this.renderMode),e.setVisible(this.visible),e.setHidden(this.hidden),(t||this.contents).forEach(r=>e.add(r)),e}static cloneAttribute(t,e){e.setPosition(t.position),e.setScale(t.scale),e.setRotation(t.rotation),e.setAddiMatrix(t.addMatrix),e.setRenderMode(t.renderMode),e.setVisible(t.visible),e.setHidden(t.hidden)}clearOutMeshCache(){this.meshCachesArrMap.size!==0&&(this.meshCachesArrMap.clear(),this.containers.forEach(t=>t.clearOutMeshCache()))}setDrawHighlight(t){this.drawHighlight=t,this.clearOutMeshCache()}setRenderMode(t){this.renderMode=t,this.clearOutCache()}isEmpty(){for(let t of this.contents)if(t instanceof jP){if(!t.isEmpty())return!1}else return!1;return!0}setOutMatrixVisible(t,e){let r=this.outSelfMatrixVisibleMap.get(e);r[1]=t,t=t&&this.visible;for(let i of this.contents)i.setOutMatrixVisible(t,r[0])}setVisible(t){if(t!==this.visible){this.visible=t,this.containers.forEach(e=>e.clearOutCache());for(let e of this.outSelfMatrixVisibleMap.values()){let r=e[1]&&this.visible;for(let i of this.contents)i.setOutMatrixVisible(r,e[0])}}}getVisible(){return this.visible}setHidden(t){this.hidden=t}getPosition(){return this.position}getContents(){return this.contents}setPosition(t){return this.position=t,this.markChanged(),this}getScale(){return this.scale}setScale(t){return this.scale=t,this.markChanged(),this}getRotation(){return this.rotation}setRotation(t){return this.rotation=t,this.markChanged(),this}getAddiMatrix(){return this.addMatrix}setAddiMatrix(t){return this.addMatrix=t,this.markChanged(),this}setIsChange(t){this.isChange=t,this.containers.forEach(e=>{e.setIsChange(t)})}getIsChange(){return this.isChange}markChanged(){this.updateFlag=!0,this.clearOutCache()}getMatrix(){return this.updateFlag&&this.update(),this.selfMatrix}getSelfAsOutToChildMatrix(){let t=[];for(let e of this.outSelfMatrixVisibleMap.values())t.push(e[0]);return t}clearOutPlaneCache(){this.planeCache.size!==0&&(this.planeCache.clear(),this.containers.forEach(t=>t.clearOutPlaneCache()))}clearOutCache(){this.clearOutMeshCache(),this.clearOutPlaneCache(),this.setIsChange(!0)}clearInMeshCache(){this.meshCachesArrMap.size!==0&&(this.meshCachesArrMap.clear(),this.contents.forEach(t=>t instanceof jP&&t.clearInMeshCache()))}clearInPlaneCache(){this.planeCache.size!==0&&(this.planeCache.clear(),this.contents.forEach(t=>t instanceof jP&&t.clearInPlaneCache()))}clearInCache(){this.clearInMeshCache(),this.clearInPlaneCache()}add(t){this.contents.add(t),this.clearOutCache();let e=new Map;for(let r of this.outSelfMatrixVisibleMap.values())e.set(new Ae,r[0]);t.updateMatrix(e);for(let r of this.outSelfMatrixVisibleMap.values())t.setOutMatrixVisible(this.visible&&r[1],r[0]);return t instanceof jP&&(t.containers.add(this),t.clearInCache()),t}addItem(t){if(t)return this.add(t)}remove(t){if(!this.contents.has(t))return;this.contents.delete(t),t instanceof jP&&(t.containers.delete(this),t.clearInCache()),this.clearOutCache();let e=new Array;for(let r of this.outSelfMatrixVisibleMap.values())e.push(r[0]);t.removeOutMatrixs(e)}removeOutMatrixs(t){let e=new Array;for(let r of t)e.push(this.outSelfMatrixVisibleMap.get(r)[0]),this.outSelfMatrixVisibleMap.delete(r);for(let r of this.contents)r.removeOutMatrixs(e)}clear(){let t=new Array;for(let e of this.outSelfMatrixVisibleMap.values())t.push(e[0]);for(let e of this.contents)e.removeOutMatrixs(t);this.contents.forEach(e=>{e instanceof jP&&e.containers.delete(this)}),this.clearOutCache(),this.contents.clear()}getBBox(t=!1){if(this.hidden||t&&!this.visible)return null;let e=this.getMatrix(),r=new Xm;for(let i of this.contents){let n=i.getBBox(t);n&&r.ext4(n.transform(e))}return r.isValid()?r.build():null}updateMatrix(t){let e=new Map;for(let r of t.entries()){let[i,n]=r,s=this.getMatrix().multiply4(n),a=!0,l=this.outSelfMatrixVisibleMap.get(i);l?(a=l[1],e.set(l[0],s),this.outSelfMatrixVisibleMap.delete(i)):e.set(new Ae,s),this.outSelfMatrixVisibleMap.set(n,[s,a])}for(let r of this.contents)r.updateMatrix(e)}setSingleColor(t,e=null,r=!1){if(e){let i=this.outSelfMatrixVisibleMap.get(e)[0];for(let n of this.contents)n instanceof jP?(n.setSingleColor(t,i,!0),r&&n.meshCachesArrMap.clear()):n.setSingleColor(t,i)}else for(let i of this.contents)if(i instanceof jP){for(let n of this.outSelfMatrixVisibleMap.values())i.setSingleColor(t,n[0],!0);r&&i.meshCachesArrMap.clear()}else for(let n of this.outSelfMatrixVisibleMap.values())i.setSingleColor(t,n[0]);r||this.clearOutMeshCache()}update(){this.selfMatrix=Ae.ORIGIN.rotateZ(this.rotation.z).rotateX(this.rotation.x).rotateY(this.rotation.y).scale(this.scale.x,this.scale.y,this.scale.z).translate(this.position).multiply4(this.addMatrix),this.updateFlag=!1;let t=new Map;for(let e of this.outSelfMatrixVisibleMap.keys())t.set(e,e);this.updateMatrix(t)}getPlaneMatrixRenderModes(t=3,e=Ae.ORIGIN){if(!this.visible)return[];this.updateFlag&&this.update();let r=Ev(this.planeCache,e),i=r[t];if(i)return i;i=r[t]=[],t!==4&&this.renderMode!==3&&(t=this.renderMode);let n=this.outSelfMatrixVisibleMap.get(e)[0];for(let s of this.contents)if(s instanceof jP)for(let a of s.getPlaneMatrixRenderModes(t,n))i.push(a);else(s instanceof OL||s instanceof iE)&&i.push([s,n,t]);return i}getMeshCache(t=3,e=Ae.ORIGIN,r=void 0){if(!this.visible)return new oRe;this.updateFlag&&this.update();let i=Ev(this.meshCachesArrMap,e),n=urt(i,r?1:0),s=n[t];if(s)return s;s=n[t]=new oRe,t!==4&&this.renderMode!==3&&(t=this.renderMode);let a=this.outSelfMatrixVisibleMap.get(e)[0];for(let l of this.contents)if(l instanceof jP){if(r!==void 0&&l.drawHighlight!==r)continue;s.addCache(l.getMeshCache(t,a,r))}else l instanceof Q7&&s.add(l,{matrix:a,renderMode:t,color:t===0?l.getColor():t===4?l.getSingleColor(a):null});return s}setMeshAlpha(t){Array.from(this.contents).forEach(e=>{if(e instanceof jP){let r=e.clone();this.add(r),this.remove(e),r.setMeshAlpha(t)}else e instanceof Q7&&e.getMaterial()&&e.getMaterial().alpha!=t&&(this.add(new Q7(e.elements,e.getColor(),new fS(e.getMaterial().ambient,e.getMaterial().diffuse,e.getMaterial().specular,e.getMaterial().shininess,t),e.label)),this.remove(e))})}},LLe=class{constructor(){this.backgroundColor=ee.ZERO,this.drawingBackgroundColor=ee.build(0,0,0,1),this.antialias=!1,this._needRenderPanelize=!1,this.renderMode=0,this.origin=S.ORIGIN,this.forceDeactivateRatio=1,this.panelizeInfo={offset:S.ORIGIN,row:1,col:1},this.panelizeMatrix=[],this.highLightColor=[],this._needRender=!1,this._needRenderRuler=!1,this.groupIdStatusMap=new Map,this.drcRenderModel=0,this.drcRenderStyle=0,this.gridParam=new oot,this.rulerBackgroundColor=ee.WHITE,this.rulerStringColor=ee.build(.4,.4,.4,.8),this.forceVisibleHighLightPt=!1,this.fpsCounter=new Array(360).fill(-1e4),this.fpsCountI=0,this.globalHighLightType=0,this.hasGroupForceHighLight=!1,this.drawLineWidthStyle=0,this.fixedPtData=[],this.cameraSet=new Set,this.simpleModeOn=!1,this.groupHighLight=new x2(4,!0,"groupHighLight"),this._currentCoord=!0,this.textSizeCorrectionEnabled=!0,this.textFontFamilyCorrectionEnabled=!0}set needRenderPanelize(o){this._needRenderPanelize!==o&&(this._needRenderPanelize=o,o||(this.panelizeMatrix=[Qe.ORIGIN]),this.updatePlaneArrayPart(this.panelizeMatrix),this.needRender=!0)}get needRenderPanelize(){return this._needRenderPanelize}comparisonAndRecordPtGroupStatus(o,t,e,r=!1,i,n,s,a=0){let l=this.groupIdStatusMap.get(t),c=(l==null?void 0:l.visible)===void 0?!0:l.visible,h=(l==null?void 0:l.doubleRgb)===void 0?!1:l.doubleRgb,u=l==null?void 0:l.highLightGroupId,d=(l==null?void 0:l.isForceHighLight)===void 0?!1:l==null?void 0:l.isForceHighLight,p=(l==null?void 0:l.ptColorIndex)||0,m=(l==null?void 0:l.renderMode)||0;(c!==e||h!==r||u!=i||d!=n||p!=s||m!=a)&&((c!==e||h!==r||p!=s||m!=a)&&o(),this.groupIdStatusMap.set(t,{visible:e,doubleRgb:r,highLightGroupId:i,isForceHighLight:n,ptColorIndex:s,renderMode:a}),this.needRender=!0)}groupStatusQuery(){let o=!1,t=!1;for(let e of this.groupIdStatusMap.values())if(e.highLightGroupId!=null&&(o=!0,e.isForceHighLight)){t=!0;break}return{hasGroupHighLight:o,hasGroupForceHighLight:t}}getPixelRatio(){let o=window.devicePixelRatio;return/android|iphone|symbian|windows phone|ipad|ipod/i.test(navigator.userAgent)&&(o*=window.outerWidth/window.innerWidth),o}fpsCount(){this.fpsCounter[this.fpsCountI]=performance.now(),this.fpsCountI=(this.fpsCountI+1)%this.fpsCounter.length}getFps(){let o=performance.now(),t=0;return this.fpsCounter.forEach(e=>{o-e<1e3&&t++}),t}setHighLightColor(o,t){this.highLightColor[t]=o,this.needRender=!0}setGlobalHighLightType(o){this.globalHighLightType=o,this.needRender=!0}getGlobalHighLightType(){return this.globalHighLightType}getSceneType(){return this.sceneType}setRulerBackgroundColor(o){this.rulerBackgroundColor!==o&&(this.rulerBackgroundColor=o,this._needRender=!0)}setRulerStringColor(o){this.rulerStringColor!==o&&(this.rulerStringColor=o,this._needRender=!0)}getRulerBackgroundColor(){return this.rulerBackgroundColor}getRulerStringColor(){return this.rulerStringColor}getForceVisibleHighLightPt(){return this.forceVisibleHighLightPt}get needRender(){return this._needRender}set needRender(o){this._needRender=o}get needRenderRuler(){return this._needRenderRuler}set needRenderRuler(o){this._needRenderRuler=o}addCamera(o){if(o.setScene(this),If.getInfiniteScaling()&&(o.setMinScale(Number.NEGATIVE_INFINITY),o.setMaxScale(Number.POSITIVE_INFINITY)),this.currentCamera=o,this.cameraSet.add(o),this.cameraSet.size>1)throw new Error("Only one camera is allowed")}setRenderMode(o){this.renderMode=o,this.needRender=!0}getRenderMode(){return this.renderMode}setPanelizeInfo(o=S.ORIGIN,t=1,e=1){this.panelizeInfo.offset=o,this.panelizeInfo.row=t,this.panelizeInfo.col=e,this.panelizeMatrix=[];for(let r=0;r<t;r++)for(let i=0;i<e;i++)this.panelizeMatrix.push(Qe.translate(i*o.x,r*o.y));this.needRenderPanelize&&this.updatePlaneArrayPart(this.panelizeMatrix),this.needRender=!0}setOrigin(o){this.origin=o,this.needRender=!0}getOrigin(){return this.origin}getForceDeactivateRatio(){return this.forceDeactivateRatio}getBgColor(){return this.backgroundColor}getDrawingBgColor(){return this.drawingBackgroundColor}readPanelizeMat(){let o=[];if(!this.needRenderPanelize)return o;let{offset:t,row:e,col:r}=this.panelizeInfo;for(let i=0;i<e;i++)for(let n=0;n<r;n++)i==0&&n==0||o.push(Ae.translate(n*t.x,i*t.y,0));return o}get currentCoord(){return this.gridParam.currentCoord}set currentCoord(o){this.gridParam.currentCoord=o}getAntialias(){return this.antialias}setAntialias(o){this.antialias=o,this.needRender=!0}mouseMoveRenderRuler(){this.needRenderRuler=!0}setDrawLineWidthStyle(o){this.drawLineWidthStyle=o,this.needRender=!0}getDrawLineWidthStyle(){return this.drawLineWidthStyle}setDrcArrowPtStyle(o,t,e,r,i,n,s){this.fixedPtData[1]=t,this.fixedPtData[2]=e,this.fixedPtData[3]=r,this.fixedPtData[4]=i,this.fixedPtData[5]=n,this.fixedPtData[6]=s}getUnderAcceleratePlane(o,t,e){return e.getTar2Pos().z>0?o.filter(r=>{let i=r[0].getBBox().transform(r[1]);return!r[0].getIsUnderGrid()&&i.minZ+i.maxZ<=t}):o.filter(r=>{let i=r[0].getBBox().transform(r[1]);return!r[0].getIsUnderGrid()&&i.minZ+i.maxZ>=t})}getAboveAcceleratePlane(o,t,e){return e.getTar2Pos().z>0?o.filter(r=>{let i=r[0].getBBox().transform(r[1]);return!r[0].getIsUnderGrid()&&i.minZ+i.maxZ>t}):o.filter(r=>{let i=r[0].getBBox().transform(r[1]);return!r[0].getIsUnderGrid()&&i.minZ+i.maxZ<t})}getUnderGridPlane(o){return o.filter(t=>t[0].getIsUnderGrid()&&!t[0].isNormal)}getAboveGridPlane(o){return o.filter(t=>!t[0].getIsUnderGrid())}sortByCameraZ(o,t){if(o.isOrthCamera())o.getTar2Pos().z<0?t.sort((e,r)=>{let i=e[0].getBBox().transform(e[1]),n=r[0].getBBox().transform(r[1]);return n.minZ+n.maxZ-(i.minZ+i.maxZ)}):t.sort((e,r)=>{let i=e[0].getBBox().transform(e[1]),n=r[0].getBBox().transform(r[1]);return i.minZ+i.maxZ-(n.minZ+n.maxZ)});else{let e=o.getZ();t.sort((r,i)=>{let n=r[0].getBBox().transform(r[1]),s=i[0].getBBox().transform(i[1]);return Math.abs(e-(s.minZ+s.maxZ)/2)-Math.abs(e-(n.minZ+n.maxZ)/2)})}}getNormalPlaneLastRenderZ(o,t){let e=t.filter(n=>n[0].isNormal);this.sortByCameraZ(o,e);let r=e[0],i=r[0].getBBox().transform(r[1]);return i.minZ+i.maxZ}setCameraFlip(o){let t=this.measureTooGroup.getPosition().z;o&&t>0||!o&&t<0||this.measureTooGroup.setPosition(new Mt(0,0,-t))}getCanvas(){return this.currentCamera.getCanvas()}getSingleColor(o,t){return ee.RED}getCameraSet(){return this.cameraSet}getCurrentCamera(){return this.currentCamera}turnSimpleModeOnOrOff(o){this.simpleModeOn=o}delCamera(o){this.cameraSet.delete(o),this.needRender=!0}getImageData(o,t,e,r){return null}onGlLost(o){console.error("onGlLost")}get isCartesian(){return this._currentCoord}set isCartesian(o){this._currentCoord=o}setTextSizeCorrectionEnabled(o){this.textSizeCorrectionEnabled=o}getTextSizeCorrectionEnabled(){return this.textSizeCorrectionEnabled}setTextFontFamilyCorrectionEnabled(o){this.textFontFamilyCorrectionEnabled=o}getTextFontFamilyCorrectionEnabled(){return this.textFontFamilyCorrectionEnabled}},MLe=class extends LLe{constructor(){super(...arguments),this.polygonGroupIds=new Map,this.useWireFrameGroup=new Set,this.useColorGroup=new Set,this.polygonUseWireFrameGroup=new Set,this.polygonUseColorGroup=new Set}addPolygonGroupId(o){if(o||o===0){let t=this.polygonGroupIds.get(o);t?this.polygonGroupIds.set(o,t+1):this.polygonGroupIds.set(o,1),this.useWireFrameGroup.has(o)&&this.polygonUseWireFrameGroup.add(o),this.useColorGroup.has(o)&&this.polygonUseColorGroup.add(o)}}removePolygonGroupId(o){(o||o===0)&&this.polygonGroupIds.forEach((t,e)=>{if(e===o){t>1?this.polygonGroupIds.set(o,t-1):(this.polygonGroupIds.delete(o),this.polygonUseWireFrameGroup.delete(o),this.polygonUseColorGroup.delete(o));return}})}getGroupUseWireFramePolygon(){return this.polygonUseWireFrameGroup.size}getGroupUseColorPolygon(){return this.polygonUseColorGroup.size}updateGroupRenderModeRecord(o,t){let e=this.polygonGroupIds.has(o);t===0?(this.useWireFrameGroup.delete(o),e&&(this.polygonUseWireFrameGroup.delete(o),this.polygonUseColorGroup.delete(o))):t===1?(this.useWireFrameGroup.add(o),e&&this.polygonUseWireFrameGroup.add(o)):t===2&&(this.useColorGroup.add(o),e&&this.polygonUseColorGroup.add(o))}},_v={get:function(o,t,e){let r=Reflect.get(o,t,e),i="plane";return e instanceof LLe&&(i="scene"),typeof r=="function"?(...n)=>{let s=gS(),a=performance.now(),l=r.apply(e,n),c=performance.now()-a;return s[i]||(s[i]={}),s[i][t]==null&&(s[i][t]=0),s[i][t]+=c,l}:r}},Tot=class{constructor(){this.color=null,this.leftUpPoint=S.ORIGIN,this.hollowWidth=0,this.hollowHeight=0}setMaskInfo(o,t=S.ORIGIN,e=0,r=0){this.color=o,this.leftUpPoint=t,this.hollowWidth=e,this.hollowHeight=r,this.scene.needRender=!0}clear(){this.color=null,this.leftUpPoint=S.ORIGIN,this.hollowWidth=0,this.hollowHeight=0,this.scene.needRender=!0}},Iot=class extends Tot{constructor(o){super(),this.scene=o}render(o,t){if(!this.color)return;let e=o.getContext();o.setFillStyle(this.color.toCSS());let r=e.canvas.width,i=e.canvas.height;if(e.beginPath(),e.moveTo(0,0),e.lineTo(r,0),e.lineTo(r,i),e.lineTo(0,i),e.closePath(),this.hollowWidth){let n=t.getSampling(),s=t.getScale()*n,a=t.getRenderMatrix(),l=new S(this.leftUpPoint.x,this.leftUpPoint.y).multiply4(a),c=this.hollowWidth*s,h=this.hollowHeight*s;e.moveTo(l.x,l.y),e.lineTo(l.x,l.y+h),e.lineTo(l.x+c,l.y+h),e.lineTo(l.x+c,l.y),e.closePath(),e.fill()}}},JH=8,NLe=class{constructor(o){this.instanceData=o,this.templateBitmap=new Cg(4),this.instanceBitmap=new Cg(4),this.instanceBitmap.addTrimListener(t=>{this.instanceData.trimChunk(t*JH)}),this.templateIdAndTemplateInstanceMap=new Map}createTemplateId(){let o=this.templateBitmap.findEmpty();return o===-1&&(this.templateBitmap=this.templateBitmap.extSize(this.templateBitmap.size*2),o=this.templateBitmap.findEmpty()),this.templateBitmap.markUsed(o),this.templateIdAndTemplateInstanceMap.set(o,new Set),o}removeTemplateId(o){this.templateBitmap.markRemove(o),this.templateIdAndTemplateInstanceMap.get(o).forEach(t=>{this.instanceBitmap.markRemove(t)}),this.templateIdAndTemplateInstanceMap.delete(o)}getTemplateNum(){return this.templateBitmap.getMarked()}addTemplateInstance(o,t){let e=this.instanceBitmap.findEmpty();e===-1&&(this.instanceBitmap=this.instanceBitmap.extSize(this.instanceBitmap.size*2),e=this.instanceBitmap.findEmpty()),this.instanceBitmap.markUsed(e);let r=e*JH,i=t.data;return this.instanceData.setArr([i[0],i[1],i[4],i[5],i[12],i[13]],r),this.instanceData.set(r+6,o),this.instanceData.set(r+7,0),this.templateIdAndTemplateInstanceMap.get(o).add(e),e}removeTemplateInstance(o,t){if(!this.templateBitmap.isUsed(o))throw new Error("templateId does not exist");if(!this.instanceBitmap.isUsed(t))throw new Error("instanceIndex does not exist");this.instanceData.set(t*JH+6,-1),this.instanceBitmap.markRemove(t),this.templateIdAndTemplateInstanceMap.get(o).delete(t)}updateTemplateInstance(o,t,e){if(!this.templateBitmap.isUsed(o))throw new Error("templateId does not exist");if(!this.instanceBitmap.isUsed(t))throw new Error("instanceIndex does not exist");let r=e.data;this.instanceData.setArr([r[0],r[1],r[4],r[5],r[12],r[13],o],t*JH)}getTemplateInstanceData(){return this.instanceData}getMaxTemplateInstanceIndex(){return this.instanceBitmap.getMax()}getTemplateInstanceBBox(o,t,e){if(!this.templateBitmap.isUsed(o))throw new Error("templateId does not exist");let r=t*JH,i=this.instanceData.get(r+0),n=this.instanceData.get(r+1),s=this.instanceData.get(r+2),a=this.instanceData.get(r+3),l=this.instanceData.get(r+4),c=this.instanceData.get(r+5),h=e.minX,u=e.maxY,d=e.maxX,p=e.maxY,m=e.minX,g=e.minY,y=e.maxX,b=e.minY,P=h*i+u*s+l,T=h*n+u*a+c,I=d*i+p*s+l,C=d*n+p*a+c,E=m*i+g*s+l,O=m*n+g*a+c,_=y*i+b*s+l,R=y*n+b*a+c;return ul.modify(Math.min(P,I,E,_),Math.max(P,I,E,_),Math.min(T,C,O,R),Math.max(T,C,O,R))}forEachInstanceId(o,t){return this.templateIdAndTemplateInstanceMap.get(o).forEach(t)}getInstanceIds(o){return this.templateIdAndTemplateInstanceMap.get(o)}},Pbe=Ltt(),yS=Pbe.top||Pbe;try{yS.location&&yS.location.search}catch{yS=null}var Cot="-time-diff",kLe=yS&&Sot();function Sot(){let o=Pbe.PRO_LOG_LEVEL;return o=="trace"||o=="debug"}function Eot(o){return o+Cot}function Oot(o,t){let e=Eot(o);Array.isArray(yS[e])?yS[e].push(t):yS[e]=[t]}function Aot(o,t=3){return+o.toFixed(t)}function YJ(o,t=!1){if(!kLe)return;let e=new Date().getTime();t&&yS[o]||(yS[o]=e)}function jJ(o,t=0){if(!kLe)return;let e=yS[o];if(isNaN(e))return!1;let r=new Date().getTime(),i=Aot((r-e)/1e3);return i>=t&&wtt(o,void 0,`${i}s`),Oot(o,i),delete yS[o],!0}var _ot=class{constructor(o,t,e,r,i){this.pxLength=o,this.manager=t,this.isHighLightManager=e,this.engine=r,this.textureSize=i,this.textureGrid=new Map,this.textureByteSize=this.textureSize**2*4,this.textureLimit=4096/this.textureSize}renderCb(o,t,e,r,i,n){let s="levelTextureRender-time";YJ(s);let a=t.getBBox2();r.forEach(l=>{let c=a.transform4(l.getInverseMatrix()).intersection1(e);if(!c)return;let h=Math.floor(c.minX/this.pxLength/this.textureSize),u=Math.floor(c.maxX/this.pxLength/this.textureSize),d=Math.floor(c.minY/this.pxLength/this.textureSize),p=Math.floor(c.maxY/this.pxLength/this.textureSize);for(let m=h;m<=u;m++){let g=this.textureGrid.get(m);g||(g=new Map,this.textureGrid.set(m,g));for(let y=d;y<=p;y++){let b=g.get(y);if(b&&b.texture){i(l,b.texture);continue}let P=new xv(null,this.textureSize,this.textureSize);P.setScene(o),P.setCameraType(!0,!1),P.setCameraDirect(!0,!1);let T=new ut(m*this.textureSize*this.pxLength,(m+1)*this.textureSize*this.pxLength,y*this.textureSize*this.pxLength,(y+1)*this.textureSize*this.pxLength);P.setTarget(new Mt((T.minX+T.maxX)/2,(T.minY+T.maxY)/2,0),!1),P.setScale(1/this.pxLength,!1);let I=1;n(l,m,y,g,P,T),this.manager.levelTexturesSize+=this.textureByteSize*I}}}),jJ(s,.1)}*updateByLoc(o,t,e,r,i){if(this.getTexture(o,t))return e&&(this.getTexture(o,t).noRecycle=!0),!1;let n=new xv(null,this.textureSize,this.textureSize);n.setScene(r),n.setCameraType(!0,!1),n.setCameraDirect(!0,!1);let s=new ut(o*this.textureSize*this.pxLength,(o+1)*this.textureSize*this.pxLength,t*this.textureSize*this.pxLength,(t+1)*this.textureSize*this.pxLength);n.setTarget(new Mt((s.minX+s.maxX)/2,(s.minY+s.maxY)/2,0),!1),n.setScale(1/this.pxLength,!1);let a=this.updateByCamera(n,o,t,i),l=a.next();for(;!l.done;){let c=yield;if(l=a.next(c),c)return!1}return this.manager.levelTexturesSize+=this.textureByteSize,this.getTexture(o,t).noRecycle=e,!0}getTexture(o,t){var e;return(e=this.textureGrid.get(o))==null?void 0:e.get(t)}addTexture(o,t,e){let r=this.textureGrid.get(o);r||(r=new Map,this.textureGrid.set(o,r)),r.set(t,e)}renderBatchCb(o,t,e,r,i,n){let s="levelTextureRender-time";YJ(s);let a=t.getBBox2();r.forEach(l=>{let c=a.transform4(l.getInverseMatrix()).intersection1(e);if(!c)return;let h=Math.floor(c.minX/this.pxLength/this.textureSize),u=Math.floor(c.maxX/this.pxLength/this.textureSize),d=Math.floor(c.minY/this.pxLength/this.textureSize),p=Math.floor(c.maxY/this.pxLength/this.textureSize);for(let m=h;m<=u;m++){let g=this.textureGrid.get(m);g||(g=new Map,this.textureGrid.set(m,g));for(let y=d;y<=p;y++){let b=g.get(y);if(b&&b.texture){i(l,b.texture);continue}let P=m+1,T=y+1,I=()=>{if(P-m===this.textureLimit||P>u)return!1;let _=!0;for(let R=y;R<T;R++)if(this.getTexture(P,R)){_=!1;break}return _&&P++,_},C=()=>{if(T-y===this.textureLimit||T>p)return!1;let _=!0;for(let R=m;R<P;R++)if(this.getTexture(R,T)){_=!1;break}return _&&T++,_};for(;;)if(P===T){if(!I()&&!C())break}else if(P===T+1){if(!C()&&!I())break}else if(P>T){if(!I())break}else if(!C())break;let E=new xv(null,this.textureSize*(P-m),this.textureSize*(T-y));E.setScene(o),E.setCameraType(!0,!1),E.setCameraDirect(!0,!1),E.setTarget(new Mt((m+P)/2*this.textureSize*this.pxLength,(y+T)/2*this.textureSize*this.pxLength,0),!1),E.setScale(1/this.pxLength,!1),n(E,m,y),this.manager.levelTexturesSize+=this.textureByteSize*(P-m)*(T-y);let O=this.getTexture(m,y);O.texture&&i(l,O.texture)}}}),jJ(s,.1)}update(o){let t=Math.floor(o.minX/this.pxLength/this.textureSize),e=Math.floor(o.maxX/this.pxLength/this.textureSize),r=Math.floor(o.minY/this.pxLength/this.textureSize),i=Math.floor(o.maxY/this.pxLength/this.textureSize);for(let n=t;n<=e;n++){let s=this.textureGrid.get(n);if(s)for(let a=r;a<=i;a++){let l=s.get(a);l&&(l.texture&&(this.destroy(l.texture),this.manager.levelTexturesSize-=this.textureByteSize),s.delete(a))}}}clear(){this.textureGrid.forEach(o=>{o.forEach(t=>{t.texture&&(this.destroy(t.texture),this.manager.levelTexturesSize-=this.textureByteSize)})}),this.textureGrid.clear()}recycle(o,t){o&&t.forEach(e=>{let r=o.transform4(e.getInverseMatrix()),i=Math.floor(r.minX/this.pxLength/this.textureSize),n=Math.floor(r.maxX/this.pxLength/this.textureSize),s=Math.floor(r.minY/this.pxLength/this.textureSize),a=Math.floor(r.maxY/this.pxLength/this.textureSize);for(let l=i;l<=n;l++){let c=this.textureGrid.get(l);if(c)for(let h=s;h<=a;h++){let u=c.get(h);u&&(u.interCanvas=!0)}}}),this.textureGrid.forEach(e=>{e.forEach((r,i)=>{if(r.noRecycle||r.interCanvas){delete r.interCanvas;return}this.destroy(r.texture),this.manager.levelTexturesSize-=this.textureByteSize,e.delete(i)})})}clearTexture(o,t){let e=this.textureGrid.get(o),r=e.get(t);r.texture&&(this.destroy(r.texture),this.manager.levelTexturesSize-=this.textureByteSize),e.delete(t)}},vot=512,xot=512,Rot=class{constructor(o,t,e,r){if(this.getCurBBox=o,this.createLevelTexture=t,this.isHighLightManager=e,this.engine=r,this.minLevel=Number.POSITIVE_INFINITY,this.textureMap=new Map,this._levelTexturesSize=0,r===0)this.textureSize=xot;else{let i=vot;Oy.getTextureSize()&&(i=Oy.getTextureSize()),this.textureSize=i}this.textureByteSize=this.textureSize**2*4}get levelTexturesSize(){return this._levelTexturesSize}set levelTexturesSize(o){If.isEnableLog()&&console.log(`levelTexturesSize${this.isHighLightManager?"(h)":""}`,"==========>",o/this.textureByteSize),this._levelTexturesSize=o}setMinPxLength(o){this.minLevel=Math.min(this.minLevel,Math.floor(Math.log2(o)))}getMinLevel(){return this.minLevel}update(o){this.textureMap.forEach(t=>t.update(o))}getOrInitTexture(o){let t=this.textureMap.get(o);return t||(t=this.createLevelTexture(2**o),this.textureMap.set(o,t)),t}clear(){this.textureMap.forEach(o=>o.clear()),this.textureMap.clear()}recycle(o,t,e){var r;let i=Math.floor(Math.log2(t.getPxLength())),n=t.getBBox2(),s=o+1;for(let a=o-1;a<=s;a++)(r=this.textureMap.get(a))==null||r.recycle(a===i-1?n:a===i?n.extendOfSize(this.textureSize*2**a):a===i+1?n.extendSize(n.width()*2,n.height()*2):null,e)}},Dot=class extends _ot{constructor(o,t,e,r,i){super(o,e,r,0,i),this.pxLength=o,this.planes=t,this.manager=e,this.isHighLightManager=r,this.textureSize=i;let n=document.createElement("canvas");n.width=this.textureSize,n.height=this.textureSize,this.highLightCtx0=new Tf(n.getContext("2d"));let s=document.createElement("canvas");s.width=this.textureSize,s.height=this.textureSize,this.highLightCtx1=new Tf(s.getContext("2d"))}renderHighLight(o,t,e,r,i,n){this.renderCb(o,t,r,i,(s,a)=>{a&&a.render(t,e,s)},(s,a,l,c,h,u)=>{let d={};if(this.isHighLightManager){let p=document.createElement("canvas");p.width=this.textureSize,p.height=this.textureSize;let m=new Tf(p.getContext("2d")),g=document.createElement("canvas");g.width=this.textureSize,g.height=this.textureSize;let y=new Tf(g.getContext("2d"));o.renderHighLightPlane(h,n,m,y,!1,o.drcRenderModel===1,!1,!1),m.getContext().drawImage(g,0,0,m.getContext().canvas.width,m.getContext().canvas.height),d.texture=vL.build(p,u)}c.set(l,d),d.texture&&d.texture.render(t,e,s)})}renderIterator(o,t,e,r,i,n){let s="renderIterator-time";YJ(s),this.renderCbIterator(o,t,r,i,!1,(a,l)=>{l==null||l.render(t,e,a)},(a,l,c,h,u,d,p)=>{let m={},g=Ae.ORIGIN;if(p){let O=document.createElement("canvas");O.width=this.textureSize,O.height=this.textureSize;let _=new Tf(O.getContext("2d")),R=!1;p.forEach(D=>{R=!0,D.render(h,_,g)});let v;if(R){v=vL.build(O,u),m.texture=v,d||v.render(t,e,g);let D=c.get(l);(D==null?void 0:D.texture)===v&&(D.texture=v)}else m.texture=null,v=null;return c.set(l,m),v}let y=document.createElement("canvas");y.width=this.textureSize,y.height=this.textureSize;let b=new Tf(y.getContext("2d")),P=document.createElement("canvas");P.width=this.textureSize,P.height=this.textureSize;let T=new Tf(P.getContext("2d")),I=document.createElement("canvas");I.width=this.textureSize,I.height=this.textureSize;let C=new Tf(I.getContext("2d")),E=!1;return n.forEach(O=>{E=O[0].renderByMatrix(g,h,b,!1,o.drcRenderModel==1,!1,!0,O[2],!0,T,C,!1,!1,O[0].getMaterial(),!1,!0,!0)||E}),E?m.texture=vL.build(y,u):m.texture=null,c.set(l,m),!d&&m.texture&&m.texture.render(t,e,g),m.texture}),jJ(s,.1)}renderCbIterator(o,t,e,r,i,n,s){var a;let l=[];if(r.length==0)return l;let c=t.getBBox2(),h=Math.floor(Math.log2(this.pxLength)),u=this.pxLength*this.textureSize,d=this.manager.templateLevel,p=h==d;for(let m=0;m<r.length;m++){let g=r[m],y=c.transform4(g.getInverseMatrix()).intersection1(e);if(!y)continue;let b=Math.floor(y.minX/u),P=Math.floor(y.maxX/u),T=Math.floor(y.minY/u),I=Math.floor(y.maxY/u);for(let C=b;C<=P;C++){let E=this.textureGrid.get(C);E||(E=new Map,this.textureGrid.set(C,E));for(let O=T;O<=I;O++){let _=(a=E.get(O))==null?void 0:a.texture;if(_){i?l.push(_):n(g,_);continue}let R=new xv(null,this.textureSize,this.textureSize);R.setScene(o),R.setCameraType(!0,!1),R.setCameraDirect(!0,!1);let v=new ut(C*u,(C+1)*u,O*u,(O+1)*u);R.setTarget(new Mt((v.minX+v.maxX)/2,(v.minY+v.maxY)/2,0),!1),R.setScale(1/this.pxLength,!1);let D=0;if(p){let w=s(C,O,E,R,v,i);w&&(l.push(w),D=1)}else{let w=this.manager.getTextureByLevel(d);if(!w)continue;let F=w.renderCbIterator(o,R,e,r,!0,n,s),H=s(C,O,E,R,v,i,F);H&&(l.push(H),D=1)}D>0&&(this.manager.levelTexturesSize+=this.textureByteSize*D)}}}return l}renderIterator0(o,t,e,r,i){let n="renderIterator-time";YJ(n),this.renderCbIterator0(o,t,r,!1,s=>{s==null||s.render(t,e,Ae.ORIGIN)},(s,a,l,c,h,u,d)=>{let p={},m=Ae.ORIGIN;if(d){let E=document.createElement("canvas");E.width=this.textureSize,E.height=this.textureSize;let O=new Tf(E.getContext("2d")),_=!1;d.forEach(v=>{_=!0,v.render(c,O,m)});let R;if(_){R=vL.build(E,h),p.texture=R,u||R.render(t,e,m);let v=l.get(a);(v==null?void 0:v.texture)===R&&(v.texture=R)}else p.texture=null,R=null;return l.set(a,p),R}let g=document.createElement("canvas");g.width=this.textureSize,g.height=this.textureSize;let y=new Tf(g.getContext("2d")),b=document.createElement("canvas");b.width=this.textureSize,b.height=this.textureSize;let P=new Tf(b.getContext("2d")),T=document.createElement("canvas");T.width=this.textureSize,T.height=this.textureSize;let I=new Tf(T.getContext("2d"));o.renderI++;let C=!1;return i.forEach(E=>{C=E[0].render0(E[1],c,y,!1,o.drcRenderModel==1,!1,!0,E[2],!0,P,I,!1,!1,E[0].getMaterial(),E[0].renderTexture,E[0].renderOther)||C}),C?p.texture=vL.build(g,h):p.texture=null,l.set(a,p),!u&&p.texture&&p.texture.render(t,e,m),p.texture}),jJ(n,.1)}renderCbIterator0(o,t,e,r,i,n){var s;let a=[],l=t.getBBox2(),c=Math.floor(Math.log2(this.pxLength)),h=this.pxLength*this.textureSize,u=this.manager.templateLevel,d=c==u,p=l.intersection1(e);if(!p)return;let m=Math.floor(p.minX/h),g=Math.floor(p.maxX/h),y=Math.floor(p.minY/h),b=Math.floor(p.maxY/h);for(let P=m;P<=g;P++){let T=this.textureGrid.get(P);T||(T=new Map,this.textureGrid.set(P,T));for(let I=y;I<=b;I++){let C=(s=T.get(I))==null?void 0:s.texture;if(C){r?a.push(C):i(C);continue}let E=new xv(null,this.textureSize,this.textureSize);E.setScene(o),E.setCameraType(!0,!1),E.setCameraDirect(!0,!1);let O=new ut(P*h,(P+1)*h,I*h,(I+1)*h);E.setTarget(new Mt((O.minX+O.maxX)/2,(O.minY+O.maxY)/2,0),!1),E.setScale(1/this.pxLength,!1);let _=0;if(d){let R=n(P,I,T,E,O,r);R&&(a.push(R),_=1)}else{let R=this.manager.getTextureByLevel(u);if(!R)continue;let v=R.renderCbIterator0(o,E,e,!0,i,n),D=n(P,I,T,E,O,r,null);D&&(a.push(D),_=1),_>0&&(this.manager.levelTexturesSize+=this.textureByteSize*_)}}}return a}destroy(o){o instanceof Promise?o.then(t=>{t.image instanceof ImageBitmap&&t.image.close()}):o&&o.image instanceof ImageBitmap&&o.image.close()}getBBox(o){if(o instanceof Promise)throw new Error("texture instanceof Promise");return o.getBBox()}updateByCamera(o,t,e,r){throw new Error("Method not implemented.")}},wot=2e3,sRe=class extends Rot{constructor(o,t,e=!1){super(()=>{let r=new _e;return this.planes.forEach(i=>{if(!i.isRender()||i.isEmpty())return;let n=i.getBBox2();n&&r.ext1(n)}),r.valid()&&r.build()},r=>new Dot(r,this.planes,this,e,this.textureSize),e,0),this.scene=o,this.planes=t,this.isHighLightManager=e,this.templateLevel=-4,this._notUseTexture=!1,this._forceUseTexture=!1,this._forceUseTexture&&(this.templateLevel=1),e&&(this.templateLevel=Number.NEGATIVE_INFINITY)}isUseTexture(o,t,e=!1){if(t.is3D())return!1;if(this._forceUseTexture)return!0;if(!this._forceUseTexture&&(e||this._notUseTexture))return!1;let r=this.getCurBBox();return!(!r||o<wot||(this.autoResetTemplateLevelByNumber(o,r),!this.getUsingInfoIterator(t,r)))}render(o,t,e,r,i,n){let s=this.getUsingInfoIterator(o,this.getCurBBox());return this.renderIterator(s,o,t,e,r,i,n),!0}autoResetTemplateLevelByNumber(o,t){if(this._forceUseTexture)return;let e=t.width(),r=t.height(),i=2e3,n=500,s=2**this.templateLevel,a=0,l=!1;for(;;){let c=s*this.textureSize,h=Math.ceil(e/c),u=Math.ceil(r/c),d=h*u;if(a=Math.ceil(o/d),d>i||a<n)s*=2,l=!0;else break}if(l){let c=Math.floor(Math.log2(s));this.templateLevel=c,this.clear(),console.info("autoResetTemplateLevel","==========>",`pts(${o}), preNum(${a}), pxLength(${s}), level(${c})`)}}getUsingInfoIterator(o,t){if(!t)return;let e=Math.floor(Math.log2(o.getPxLength()));if(!(e<this.templateLevel)&&(e=Math.min(e,Math.ceil(Math.log2(Math.max(t.width(),t.height())/this.textureSize))),!(e<this.templateLevel)))return{level:e,bbox:t,texture:this.getOrInitTexture(e)}}getTextureByLevel(o){if(!(o<this.templateLevel))return this.getOrInitTexture(o)}renderIterator(o,t,e,r,i,n,s){o&&(this.isHighLightManager?o.texture.renderHighLight(e,t,r,o.bbox,i,n):s?o.texture.renderIterator0(e,t,r,o.bbox,n):o.texture.renderIterator(e,t,r,o.bbox,i,n))}},BLe=class{constructor(o){this.color=o}},FLe=class{constructor(o,t,e=Mt.ORIGIN){this.color=o,this.position=t,this.target=e}direction(){return this.target.sub(this.position)}},bye=2e3,cW=class Tbe extends MLe{constructor(t,e=!1,r){super(),this.planes=[],this.normalPlanes=[],this.colorMap=new OLe,this.colors=[],this.staticPolygonInfoMap=new Cg(32),this.staticPolygonInfoBuilder=new NO(Float32Array),this.stringInfoMap=new Map,this.dashedInfoBuilder=new NO(Float32Array),this.dashedInfoMap=new Map,this.stringInfos=[],this.unit="mil",this.m_dictStateInfo={},this.m_nRecordRenderMode=this.getRenderMode(),this.m_listRecordPanelizeInfo=[],this.renderedPtNum=0,this.hardRenderPlane=[],this.sdfStringInfoMap=new Map,this.sdfStringInfos=[],this.runCapture=!1,this.renderI=0,this.instantiationTime=performance.now();let i=1,n=1;this.sceneType=t,this.useGridAccelerate=!0,this.useProxy=e,bW.includes(t)?this.minWh=yW.getMinRenderGridWH()||2**5:this.minWh=yW.getMinRenderGridWH()||2**3,nwe("cpu"),this.maskCpu=new Iot(this),this.antialiasCanvas=document.createElement("canvas"),this.antialiasCanvas.width=i,this.antialiasCanvas.height=n,this.antialiasContext=new Tf(this.antialiasCanvas.getContext("2d")),this.antialiasCanvas1=document.createElement("canvas"),this.antialiasCanvas1.width=i,this.antialiasCanvas1.height=n,this.antialiasContext1=new Tf(this.antialiasCanvas1.getContext("2d")),this.antialiasHighLightCanvas1=document.createElement("canvas"),this.antialiasHighLightCanvas1.width=i,this.antialiasHighLightCanvas1.height=n,this.antialiasHighLightContext1=new Tf(this.antialiasHighLightCanvas1.getContext("2d")),this.antialiasHighLightCanvas0=document.createElement("canvas"),this.antialiasHighLightCanvas0.width=i,this.antialiasHighLightCanvas0.height=n,this.antialiasHighLightContext0=new Tf(this.antialiasHighLightCanvas0.getContext("2d")),this.m_gridProgramCpu=new lot(this,ee.WHITE),this.ruler=new Xh(this.getSceneType()),this.ptGroup=new swe(new NO(Int32Array)),this.ptTemplate=new NLe(new NO(Float32Array)),this.fillParam=new uot,this.levelTextureManager=new sRe(this,this.normalPlanes,!1),this.highLightLevelTextureManager=new sRe(this,this.normalPlanes,!0),this.group=new x2(3,!0,"scene"),this.highLightGroup0=new x2(3,!1,"highLightGroup0"),this.highLightGroup1=new x2(3,!1,"highLightGroup1"),this.measureTooGroup=new x2(3,!1,"measureTooGroup"),this.highlightPlane0=this.createHighLightPlane(-.2,0),this.highlightPlane1=this.createHighLightPlane(-.1,1),this.measureToolPlane=this.createMeasureToolPlane(),this.ambientLight=new BLe(ee.build(.1,.1,.1)),this.directionalLight=new FLe(ee.build(1,1,1),new Mt(0,0,1)),r&&this.installMessageBus(r)}static build(t,e,r){let i;return e?i=new Proxy(new Tbe(t,e,r),_v):i=new Tbe(t,e,r),i}installMessageBus(t){t.rpcService("/engine/scene/setBackgroundColor",e=>{try{this.modifyBgColor(ee.of5(...e))}catch{this.modifyBgColor(ee.of5("#000000",e[1]))}}),t.rpcService("/engine/scene/setCoordSys",e=>{this.isCartesian=e,this.needRender=!0}),t.rpcService("/engine/scene/setGridType",e=>{this.gridParam.visible=e,this.needRender=!0}),t.rpcService("/engine/scene/setGridPattern",e=>{this.m_gridProgramCpu.modifyModel(e),this.needRender=!0}),t.rpcService("/engine/scene/setGridColor",e=>{this.m_gridProgramCpu.getRectangularProgram().modifyColor(ee.of5(...e)),this.needRender=!0}),t.rpcService("/engine/scene/setCoordinateAxisColor",e=>{this.gridParam.coordinateAxisColor=ee.of5(...e),this.gridParam.coordinateAxisTransparency=1-e[1],this.needRender=!0}),t.rpcService("/engine/scene/setGridDelta",e=>{this.m_gridProgramCpu.getRectangularProgram().setGridX(e[0]),this.m_gridProgramCpu.getRectangularProgram().setGridY(e[0]),this.needRender=!0}),t.rpcService("/engine/scene/setPolarDelta",e=>{this.gridParam.angleDelta=qh.toRadians(e[0]),this.gridParam.radius=e[1],this.needRender=!0}),t.rpcService("/engine/scene/setPolarRadius",e=>{this.gridParam.minRadius=e[0],this.gridParam.maxRadius=e[1],this.needRender=!0}),t.rpcService("/engine/scene/setPolarAngle",e=>{this.gridParam.startAngle=qh.toRadians(e[0]),this.gridParam.endAngle=qh.toRadians(e[1]),this.needRender=!0}),t.rpcService("/engine/scene/setOpenRuler",e=>{this.openRuler=e}),t.rpcService("/engine/scene/setUnit",e=>{this.modifyUnit(e),this.needRender=!0}),t.rpcService("/engine/scene/setRulerBackgroundColor",e=>{this.setRulerBackgroundColor(ee.build(e[0],e[1],e[2],e[3]))}),t.rpcService("/engine/scene/setRulerStringColor",e=>{this.setRulerStringColor(ee.build(e[0],e[1],e[2],e[3]))}),t.rpcService("/engine/scene/setRulerTextColor",e=>{this.setRulerStringColor(ee.build(e[0],e[1],e[2],e[3]))}),t.rpcService("/engine/scene/getRulerBackgroundColor",()=>this.getRulerBackgroundColor()),t.rpcService("/engine/scene/getRulerStringColor",()=>this.getRulerStringColor()),t.rpcService("/engine/scene/getRulerTextColor",()=>this.getRulerStringColor())}createMeasureToolPlane(){let t;return this.getUseProxy()?t=new Proxy(new OL(this,ee.WHITE,"MeasureTool",!1,!1),_v):t=new OL(this,ee.WHITE,"MeasureTool",!1,!1),t.setIsColorful(!0),this.measureTooGroup.add(t),this.measureTooGroup.setPosition(new Mt(0,0,-.1)),this.group.add(this.measureTooGroup),this.planes.push(t),t}getMinWh(){return this.minWh}init(){this.measurePtTool=new _Le(this.measureToolPlane,this.currentCamera,new NO(Float32Array)),this.renderRequestAnimationFrame(),this.gridParam.addUpdateListener(()=>{this.needRender=!0})}getUseGridAccelerate(){return this.useGridAccelerate}getUseProxy(){return this.useProxy}createHighLightPlane(t,e){let r;return this.getUseProxy()?r=new Proxy(new OL(this,ee.DefaultHighLightColor,"highLight",!1,!1,!0),_v):r=new OL(this,ee.DefaultHighLightColor,"highLight",!1,!1,!0),r.setIsColorful(!0),e===0?(this.highLightGroup0.add(r),this.highLightGroup0.setPosition(new Mt(0,0,t)),this.group.add(this.highLightGroup0)):e===1&&(this.highLightGroup1.add(r),this.highLightGroup1.setPosition(new Mt(0,0,t)),this.group.add(this.highLightGroup1)),this.planes.push(r),r}renderRequestAnimationFrame(){this.fpsCount(),this.render(),this.renderRuler(),this.animationId=requestAnimationFrame(()=>this.renderRequestAnimationFrame())}clearAccelerateTexture(){this.levelTextureManager.clear(),this.highLightLevelTextureManager.clear()}setForceVisibleHighLightPt(t){t!=this.forceVisibleHighLightPt&&(this.forceVisibleHighLightPt=t,this.clearAccelerateTexture(),this.needRender=!0)}setForceDeactivateRatio(t){this.forceDeactivateRatio!==t&&(this.forceDeactivateRatio=t,this.clearAccelerateTexture(),this.needRender=!0)}getInfo(){return{engine:"cpu",fps:this.getFps(),ptNum:this.planes.reduce((t,e)=>t+e.getPtNum(),0)}}dispose(){this.animationId&&cancelAnimationFrame(this.animationId)}addCamera(t){super.addCamera(t),this.ctx=new Tf(this.currentCamera.getCanvas().getContext("2d")),this.resize(),this.init()}addCamera0(t){t.setScene(this),this.currentCamera=t,this.cameraSet.add(t)}createPtTemplateId(){return this.ptTemplate.createTemplateId()}removePtTemplateId(t){return this.ptTemplate.removeTemplateId(t)}addTemplateInstance(t,e){return this.ptTemplate.addTemplateInstance(t,e)}removeTemplateInstance(t,e){this.ptTemplate.removeTemplateInstance(t,e)}updateTemplateInstance(t,e,r){this.ptTemplate.updateTemplateInstance(t,e,r)}getHighLightPlane(t){if(t==0)return this.highlightPlane0;if(t==1)return this.highlightPlane1;throw new Error("highLightGroupId is incorrect")}setFillStyleSpacing(t){this.fillParam.setSpacing(t)}addPtGroup(){return this.ptGroup.add()}removePtGroup(t){this.ptGroup.remove(t),this.updateGroupRenderModeRecord(t,0),this.needRender=!0}setPtGroup(t,e,r=!1,i,n,s,a=0){let l=this.getColorIndex(s);this.ptGroup.set(t,e,r,i,n,l,a),this.comparisonAndRecordPtGroupStatus(this.clearAccelerateTexture.bind(this),t,e,r,i,n,l,a),this.updateGroupRenderModeRecord(t,a)}setStateInfo(t,e,r){r&&(t in this.m_dictStateInfo&&this.m_dictStateInfo[t].old===e||(t in this.m_dictStateInfo||(this.m_dictStateInfo[t]={old:void 0,new:e}),this.m_dictStateInfo[t].new=e))}isStateChange(){for(let t of Object.keys(this.m_dictStateInfo))if(this.m_dictStateInfo[t].new!==void 0&&this.m_dictStateInfo[t].old!==this.m_dictStateInfo[t].new)return hW.LogState&&console.warn("\u72B6\u6001\u4E0D\u540C",t,this.m_dictStateInfo[t].old,this.m_dictStateInfo[t].new),!0;return!1}updateStateInfo(){hW.LogState&&console.log("\u66F4\u65B0\u72B6\u6001");for(let t of Object.keys(this.m_dictStateInfo))this.m_dictStateInfo[t].old=this.m_dictStateInfo[t].new,this.m_dictStateInfo[t].new=void 0}getColorIndex(t,e=0,r=!1){bW.includes(this.getSceneType())&&(r=!0);let i;return!t||!r&&t.r+t.g+t.b===0&&t.alpha===1?i=0:i=this.colorMap.computeIfAbsent(t,()=>{let n=this.colorMap.size()+1;return this.colors[n]=t,n}),(i<<1)+e}addStaticPolygonInfo(t,e,r=-1,i){let n=this.staticPolygonInfoMap.findEmpty();n===-1&&(this.staticPolygonInfoMap=this.staticPolygonInfoMap.extSize(this.staticPolygonInfoMap.size*2),n=this.staticPolygonInfoMap.findEmpty()),this.staticPolygonInfoMap.markUsed(n),this.setStaticPolygonInfo(n,i||Ae.ORIGIN);let s=n*Ld+6;return this.staticPolygonInfoBuilder.set(s,t||0),this.staticPolygonInfoBuilder.set(s+1,this.getColorIndex(e)||0),this.staticPolygonInfoBuilder.set(s+2,r),n}addDashedInfo(t){if(t!=null&&t.length){let e=JSON.stringify(t),r=this.dashedInfoMap.get(e);return r!==void 0||(r=this.dashedInfoBuilder.getLength(),this.dashedInfoMap.set(e,r),this.dashedInfoBuilder.pushArr([t.length,...t])),r}else return-1}removeStaticPolygonInfo(t){this.staticPolygonInfoMap.markRemove(t)}setStaticPolygonInfo(t,e){let r=e.data;return this.staticPolygonInfoBuilder.setArr([r[0],r[1],r[4],r[5],r[12],r[13]],t*Ld),t*Ld}addStringInfo(t){let e=this.stringInfoMap.get(t);return e!==void 0||(e=this.stringInfos.length,this.stringInfoMap.set(t,e),this.stringInfos.push(t)),e}addTextInfo(t,e){let r=`${t}$${JSON.stringify(e)}`,i=this.sdfStringInfoMap.get(t);return i!==void 0||(i=this.sdfStringInfos.length,this.sdfStringInfoMap.set(r,i),this.sdfStringInfos.push({value:t,...e})),i}isCoreGraphic(){return!0}get openRuler(){return this._openRuler}set openRuler(t){this._openRuler!=t&&(this._openRuler=t,this._openRuler?(this.ruler=new Xh(this.getSceneType()),this.modifyUnit(this.unit)):delete this.ruler,this.needRender=!0)}getRunCapture(){return this.runCapture}createPlane(t,e,r=null,i=!0,n=!0,s=!1,a=!1){let l;return this.getUseProxy()?l=new Proxy(new OL(this,t,e,i,n,!1,s,a),_v):l=new OL(this,t,e,i,n,!1,s,a),l.setMaterial(r),this.planes.push(l),this.updatePlanePart(this.panelizeMatrix,l),l}renderPlanes(t,e,r,i,n,s,a=!1){t.forEach(l=>{l[0].render(e,r,i,n,l[0].isNormal&&a,s,l[1],l[2])})}renderHighLightPlane(t,e,r,i,n,s,a,l){for(let c=0;c<this.highLightColor.length;c++){if(!this.highLightColor[c])continue;let h;if(c==0)h=r;else if(c==1)h=i;else throw new Error("highLightGroupId is incorrect");e.forEach(u=>{u[0].renderHighLightPt(t,h,c,!(n&&u[0].isNormal),u[0].isNormal?s:!0,a,l)})}this.highlightPlane0.renderHighLightPt(t,r,0,!0,!1,!1,!1),this.highlightPlane1.renderHighLightPt(t,i,1,!0,!1,!1,!1)}renderRuler(){!this.needRender&&this.needRenderRuler&&this.openRuler&&(this.openRuler&&this.ruler.render(this.ctx,this.currentCamera,this.getOrigin(),this.getRulerBackgroundColor(),this.getRulerStringColor()),this.needRenderRuler=!1)}getHasGroupForceHighLight(){return this.hasGroupForceHighLight}render0(t){this.renderI++,this.group.getIsChange()&&(this.clearAccelerateTexture(),this.group.setIsChange(!1)),this.measurePtTool.updateRuler();let e=this.groupStatusQuery(),r=e.hasGroupHighLight;this.hasGroupForceHighLight=e.hasGroupForceHighLight;let i=this.currentCamera.copy();this.antialiasContext.getContext().clearRect(0,0,this.antialiasCanvas.width,this.antialiasCanvas.height),this.antialiasContext1.getContext().clearRect(0,0,this.antialiasCanvas.width,this.antialiasCanvas.height),this.antialiasHighLightContext0.getContext().clearRect(0,0,this.antialiasHighLightCanvas0.width,this.antialiasHighLightCanvas0.height),this.antialiasHighLightContext1.getContext().clearRect(0,0,this.antialiasHighLightCanvas1.width,this.antialiasHighLightCanvas1.height);let n=0;this.planes.forEach(P=>n+=P.getPtNum());let s=[],a=[],l=[],c=[],h=this.getRenderMode(),u=!1;this.group.getPlaneMatrixRenderModes(h).forEach(P=>{let T=P,I=T[0];I.isRender()&&!I.isHighLight&&I.getBBox()&&(s.push(T),I.isNormal&&l.push(T)),!I.isHighLight&&I.getBBox()&&(a.push(T),I.isNormal&&c.push(T)),(I.interPlanes.length!==1||I.subPlanes.length)&&(u=!0)}),this.sortByCameraZ(i,s),this.sortByCameraZ(i,l),this.sortByCameraZ(i,a),this.sortByCameraZ(i,c);let d=this.levelTextureManager.isUseTexture(n,i),p=Number.NEGATIVE_INFINITY;d&&l.length&&(p=this.getNormalPlaneLastRenderZ(i,s),this.renderPlanes(this.getUnderAcceleratePlane(s,p,i),i,this.antialiasContext,this.antialiasHighLightContext0,this.antialiasHighLightContext1,d,d&&r),this.levelTextureManager.render(i,this,this.antialiasContext,[Ae.ORIGIN].concat(this.readPanelizeMat()),l,u)),this.renderPlanes(d?this.getAboveAcceleratePlane(s,p,i):this.getAboveGridPlane(s),i,this.antialiasContext,this.antialiasHighLightContext0,this.antialiasHighLightContext1,d,d&&r),this.renderedPtNum=0;let m=!1;for(let P of this.planes)P.isEmpty()||((P.isHighLight&&P.getPtNum()>0||P.getHighLightPtNumById()>0)&&(m=!0),P.isRender()&&(this.renderedPtNum+=P.renderedPtNum));m&&(d&&this.highLightLevelTextureManager.render(i,this,this.antialiasHighLightContext0,[Ae.ORIGIN],c,!1),this.renderHighLightPlane(i,a,this.antialiasHighLightContext0,this.antialiasHighLightContext1,d,!d||this.drcRenderModel===0,!0,!0));let g=t.getContext();t.setFillStyle(this.backgroundColor.toCSS()),g.fillRect(0,0,g.canvas.width,g.canvas.height),this.renderPlanes(this.getUnderGridPlane(s),i,this.antialiasContext1,this.antialiasHighLightContext0,this.antialiasHighLightContext1,!1,!1),g.drawImage(this.antialiasCanvas1,0,0,g.canvas.width,g.canvas.height);let y=i.getSampling(),b=this.needRender;return i.setSampling(1,!1),this.m_gridProgramCpu.render(t,i),i.setSampling(y,!1),this.needRender=b,g.drawImage(this.antialiasCanvas,0,0,g.canvas.width,g.canvas.height),g.drawImage(this.antialiasHighLightCanvas0,0,0,g.canvas.width,g.canvas.height),g.drawImage(this.antialiasHighLightCanvas1,0,0,g.canvas.width,g.canvas.height),this.maskCpu.render(t,i),this.openRuler&&this.ruler.render(t,i,this.getOrigin(),this.getRulerBackgroundColor(),this.getRulerStringColor()),d}setMask(t,e,r,i){this.maskCpu.setMaskInfo(t,e,r,i)}clearMask(){this.maskCpu.clear()}setAntialias(t,e=this.currentCamera.getWidth(),r=this.currentCamera.getHeight()){super.setAntialias(t),this.setSampling(t?2:1,e,r)}setDrcRenderModel(t){this.drcRenderModel=t,this.clearAccelerateTexture(),this.needRender=!0}setDrcRenderStyle(t){this.drcRenderStyle=t,this.clearAccelerateTexture(),this.needRender=!0}checkNeedUpdateTexture(){let t;this.isStateChange()&&(t="layerChange",this.updateStateInfo());let e=this.getRenderMode();e!==this.m_nRecordRenderMode&&(t=`RenderModeChange ${this.m_nRecordRenderMode} -> ${e}`,this.m_nRecordRenderMode=e);let r=[Ae.ORIGIN,...this.readPanelizeMat()];if(r.length===this.m_listRecordPanelizeInfo.length)for(let i of r){let n=!1;for(let s of this.m_listRecordPanelizeInfo)if(s.equals(i)){n=!0;break}if(!n){t="PanelizeChange";break}}else t="PanelizeChange";this.m_listRecordPanelizeInfo=r,t!==void 0&&(hW.LogTextureChange&&console.warn("\u66F4\u65B0\u7EB9\u7406",t),this.clearAccelerateTexture())}render(t=this.currentCamera){var e,r;if(!this.needRender||!this.currentCamera.isOrthCamera())return;this.needRender=!1,this.checkNeedUpdateTexture();let i=this.currentCamera.getPxLength(),n=this.render0(this.ctx);if(this.renderedPtNum>bye){this.levelTextureManager.setMinPxLength(i),this.highLightLevelTextureManager.setMinPxLength(i);let s=0,a=this.planes.filter(l=>!l.isRender()||l.isNormal?!1:(s+=l.renderedPtNum,!0));if(s>bye){a.sort((c,h)=>c.renderedPtNum-h.renderedPtNum);let l=0;for(let c of a)l+=c.renderedPtNum,!(l<=bye)&&((e=c.levelTextureManager)==null||e.setMinPxLength(i),(r=c.highLightTextureManager)==null||r.setMinPxLength(i))}}if(n!==this.lastUsingTexture&&(console.log(n?"use tex":"not use tex"),this.lastUsingTexture=n),this.instantiationTime&&this.planes.findIndex(s=>s.builder.getPtNum()!==0)!==-1){console.log("init time:",performance.now()-this.instantiationTime),delete this.instantiationTime;let s=0,a=Array(69).fill(0);this.planes.forEach(l=>{s+=l.builder.getPtNum();let c=l.getPtTypeNum();for(let h=0;h<c.length;h++)a[h]+=c[h]}),console.log("ptNum:",s),console.log("\u5404\u7C7B\u578B\u56FE\u5143\u6570\u91CF:",a)}return!0}async getTexture(t){return await createImageBitmap(t)}modifyBgColor(t){this.backgroundColor=t,this.needRender=!0}resizeExceptCanvas(t,e){this.currentCamera.updateSize(t,e);let r=this.getAntialias()?2:1;this.currentCamera.setSampling(r),this.antialiasCanvas.width=t*r,this.antialiasCanvas.height=e*r,this.antialiasContext.reset(),this.antialiasCanvas1.width=t*r,this.antialiasCanvas1.height=e*r,this.antialiasContext1.reset(),this.antialiasHighLightCanvas0.width=t*r,this.antialiasHighLightCanvas0.height=e*r,this.antialiasHighLightContext0.reset(),this.antialiasHighLightCanvas1.width=t*r,this.antialiasHighLightCanvas1.height=e*r,this.antialiasHighLightContext1.reset(),this.needRender=!0}resize(){let t=this.currentCamera.getCanvas(),e=this.getPixelRatio(),r=t.getBoundingClientRect(),i=Math.round(r.width*e),n=Math.round(r.height*e);(i===0||n===0)&&(i=1,n=1),!(t.width===i&&t.height===n)&&(this.currentCamera.updateSize(i,n),t.width=i,t.height=n,this.ctx.reset(),this.resizeExceptCanvas(i,n))}modifyUnit(t){this.openRuler&&this.ruler.scaleRuler.modifyUnit(t),this.unit=t}capture(t,e,r,i,n=1){let s=this.getSampling(),a=this.needRender;this.runCapture=!0;let l=this.currentCamera.getWidth(),c=this.currentCamera.getHeight(),h=document.createElement("canvas");h.width=t,h.height=e;let u=new Tf(h.getContext("2d"));this.setSampling(n,t,e),r(),this.render0(u);let d=u.getContext().getImageData(0,0,t,e);return this.setSampling(s,l,c),i(),this.needRender=a,this.runCapture=!1,d}getCaptureImageData(t,e,r,i,n=!0,s=0){let a,l,c,h,u,d,p;return this.capture(t,e,()=>{p=this.getDrawLineWidthStyle(),this.setDrawLineWidthStyle(s),a=this.openRuler,this.openRuler=!1,l=this.gridParam.visible,d=this.gridParam.getMultiStyle(),this.gridParam.visible=0,this.gridParam.setMultiStyle(2),c=this.getBgColor(),n&&this.modifyBgColor(ee.BLACK),h=this.currentCamera.getTarget(),u=this.currentCamera.getScale(),this.currentCamera.setTarget(new Mt(r.center().x,r.center().y,0)),this.currentCamera.setScale(i)},()=>{this.setDrawLineWidthStyle(p),this.openRuler=a,this.gridParam.visible=l,this.gridParam.setMultiStyle(d),n&&this.modifyBgColor(c),this.currentCamera.setTarget(h),this.currentCamera.setScale(u)})}getCaptureImageData1(t,e,r,i){return this.capture(t,e,r,i)}setDrawingBgColor(t){this.drawingBackgroundColor=t,this.clearAccelerateTexture(),this.needRender=!0}getBBox3(){throw new Error("Method not implemented.")}setDrcArrowPtStyle(t,e,r,i,n,s,a){super.setDrcArrowPtStyle(t,e,r,i,n,s,a),this.fixedPtData[0]=this.getColorIndex(t)}getFixedPtData(){return this.fixedPtData}getMeasurePtTool(){return this.measurePtTool}setSampling(t,e=this.currentCamera.getWidth(),r=this.currentCamera.getHeight()){this.currentCamera.setSampling(t),this.resizeExceptCanvas(e,r)}getSampling(){return this.currentCamera.getSampling()}renderExternal(t=3,e=null){if(e){this.setRenderMode(t);for(let r of this.cameraSet)this.render(r)}}getMaxWH(){return 4096}getCaptureToCanvasInfo(t,e,r){let i=t.copy(new ut(-1,1,-1,1)),n=i.adapt(r),s=n[2]/i.getScale(),a=n[3]/i.getScale(),{pxLength:l,fixedWidth:c,fixedHeight:h}=e;if(l)s/=l,a/=l;else if(c)l=s/c,a*=c/s,s=c;else if(h)l=a/h,s*=h/a,a=h;else throw new Error("\u622A\u56FE\u8BBE\u7F6E\u53C2\u6570\u975E\u6CD5\uFF01");(s>Ah||a>Ah)&&(s>a?(l*=s/Ah,a=Ah*a/s,s=Ah):(l*=a/Ah,s=Ah*s/a,a=Ah));let u=this.getMaxWH(),d=Math.ceil(s/u),p=Math.ceil(a/u),m=Math.floor(s/d),g=Math.floor(a/p);return{width:d*m,height:p*g,scale:1/l}}captureToCanvas(t,e,r,i){let n=Array.from(this.cameraSet);for(let w of n)this.delCamera(w);let s=t.copy(new ut(-1,1,-1,1));this.addCamera0(s);let a=s.adapt(r),l=a[2]/s.getScale(),c=a[3]/s.getScale(),{pxLength:h,fixedWidth:u,fixedHeight:d}=e;if(h)l/=h,c/=h;else if(u)h=l/u,c*=u/l,l=u;else if(d)h=c/d,l*=d/c,c=d;else throw new Error("\u622A\u56FE\u8BBE\u7F6E\u53C2\u6570\u975E\u6CD5\uFF01");(l>Ah||c>Ah)&&(l>c?(h*=l/Ah,c=Ah*c/l,l=Ah):(h*=c/Ah,l=Ah*l/c,c=Ah));let p=i?this.getMaxWH()/8:this.getMaxWH(),m=Math.ceil(l/p),g=Math.ceil(c/p),y=Math.floor(l/m),b=Math.floor(c/g);s.setScale(1/h);let P=document.createElement("canvas");P.width=m*y,P.height=g*b;let T=P.getContext("2d"),I=this.openRuler,C=this.gridParam.visible;this.openRuler=!1,this.gridParam.visible=0;let E=(m-1)/2,O=(g-1)/2,_=r.center(),R=r.toBBox2(),v=R.width()/m,D=R.height()/g;for(let w=0;w<m;w++)for(let F=0;F<g;F++){s.setTarget(new Mt(_.x-(E-w)*v,_.y+(O-F)*D,0),!0);let H=this.capture(y,b,()=>{},()=>{},2);if(i&&i()||(T.putImageData(H,y*w,b*F),i&&i()))return null}this.openRuler=I,this.gridParam.visible=C,this.delCamera(s);for(let w of n)this.addCamera(w);return P}updatePlaneArrayPart(t){for(let e=0;e<this.planes.length;e++){let r=this.planes[e];r.clearParts();for(let i=0;i<t.length;i++)r.isPanelize()?r.addPart(t[i],r):i==0&&r.addPart(Qe.ORIGIN,r)}}updatePlanePart(t,e){if(t.length){e.clearParts();for(let r=0;r<t.length;r++)e.isPanelize()?e.addPart(t[r],e):r==0&&e.addPart(Qe.ORIGIN,e)}}},BL=(o=>(o.Auto="auto",o.WebGPU="webgpu",o.Canvas2D="canvas2d",o))(BL||{}),lQ=(o=>(o[o.PCB=0]="PCB",o[o.SCH=1]="SCH",o[o.FOOTPRINT=2]="FOOTPRINT",o[o.ECAD=3]="ECAD",o[o.SYMBOL=4]="SYMBOL",o[o.DEFAULT=5]="DEFAULT",o))(lQ||{});async function VLe(o,t="auto",e=window.top,r=5,i=!0,n){let s;qbe.value=e,If.init(e),yW.init(e),Oy.init(e);let a=If.useProxy();if(If.useCpuEngine())s=cW.build(r,a,n),console.log("render engine: cpu");else if(If.useGpuEngine())s=await BJ.build(r,i,a,n),console.log("render engine: webgpu");else if(t==="canvas2d")s=cW.build(r,a,n),console.log("render engine: cpu");else if(t==="webgpu")s=await BJ.build(r,i,a,n),console.log("render engine: webgpu");else try{s=await BJ.build(r,i,a,n),console.log("render engine: webgpu")}catch(l){console.warn(l),s=cW.build(r,a,n),console.log("render engine: cpu")}return{scene:s}}var D2e=(o=>(o[o.USE_COLOR=0]="USE_COLOR",o[o.WIREFRAME=1]="WIREFRAME",o[o.USE_MATERIAL=2]="USE_MATERIAL",o[o.RELY_ON_OTHER=3]="RELY_ON_OTHER",o[o.FORCE_TO_USE_SINGLE_COLOR=4]="FORCE_TO_USE_SINGLE_COLOR",o))(D2e||{}),ek=1,m0=(o=>(o[o.FIXED=0]="FIXED",o[o.ZOOM=1]="ZOOM",o))(m0||{}),cQ=(o=>(o[o.CROSS=0]="CROSS",o[o.TRIANGLE=1]="TRIANGLE",o))(cQ||{}),$P=(o=>(o[o.MASK=0]="MASK",o[o.PT=1]="PT",o))($P||{}),Lot=(o=>(o[o.FOLLOW_SCALE=0]="FOLLOW_SCALE",o[o.ALWAYS_ONE_PX=1]="ALWAYS_ONE_PX",o))(Lot||{}),w2e=(o=>(o.BUTT="butt",o.ROUND="round",o.SQUARE="square",o))(w2e||{}),sk={butt:0,round:1,square:2},hQ={0:"butt",1:"round",2:"square"},Mot=(o=>(o[o.None=0]="None",o[o.Solid=1]="Solid",o[o.Grid=2]="Grid",o[o.HorizontalLine=3]="HorizontalLine",o[o.VerticalLine=4]="VerticalLine",o[o.RhombicGrid=5]="RhombicGrid",o[o.LeftSlashLine=6]="LeftSlashLine",o[o.RightSlashLine=7]="RightSlashLine",o))(Mot||{}),Not=(o=>(o[o.NoWrap=0]="NoWrap",o[o.Wrap=1]="Wrap",o))(Not||{}),kot=(o=>(o[o.Left=0]="Left",o[o.Right=1]="Right",o[o.Center=2]="Center",o))(kot||{}),Bot=(o=>(o[o.Top=0]="Top",o[o.Bottom=1]="Bottom",o[o.Middle=2]="Middle",o))(Bot||{}),Fot=(o=>(o[o.HIDE=0]="HIDE",o[o.VISIBLE=1]="VISIBLE",o))(Fot||{}),hW=class{};hW.LogState=!0,hW.LogTextureChange=!0;var Vot=4,bW=[1,3,4],Ov=256,j7=256,Ah=4096,GLe=4,Got=2,Uot=(o=>(o[o.FOLLOW_SCENE=0]="FOLLOW_SCENE",o[o.WIREFRAME=1]="WIREFRAME",o[o.USE_COLOR=2]="USE_COLOR",o))(Uot||{}),PW=class{constructor(o,t,e,r,i){this.gpu=o,this.buffer=o.createBuffer(t,e,r,i),o.buffers.add(this)}get usage(){return this.buffer.usage}getSize(){return this.buffer.size/fs}getBuffer(){return this.buffer}async read(o="f32"){let t;switch(o){case"f32":t=Float32Array;break;case"i32":t=Int32Array;break;case"u32":t=Uint32Array;break}return new t(await this.gpu.readBuffer(this,0,this.getSize()))}destroy(){let o=gS();o.bufferSizeGPU-=this.buffer.size,this.gpu.debugBufferSizeIndex[this.buffer.label]-=this.buffer.size,this.gpu.debugBufferSizeIndex[this.buffer.label]===0&&delete this.gpu.debugBufferSizeIndex[this.buffer.label],this.buffer.destroy(),delete this.buffer,this.gpu.buffers.delete(this)}},LJ=class extends PW{constructor(o,t,e,r){super(o,t,e,!1,r),this.listeners=new Set}static merge(o){let t=l(),e=c(h=>h.gpu),r=c(h=>h.buffer.label),i=c(h=>h.usage);if(!t)return null;let n=e.createDynamicBuffer(t,i,r),s=e.device.createCommandEncoder(),a=0;return o.forEach(h=>{let u=h.getSize();e.copyBufferToBuffer(h,0,n,a,u,s),a+=u}),e.submit(s),n;function l(){let h=0;return o.forEach(u=>h+=u.getSize()),h}function c(h){let u=Array.from(new Set(o.map(h)));if(u.length!==1)throw new Error;return u[0]}}setSize(o){o!==this.getSize()&&this.setBuffer(this.gpu.createBuffer(o,this.buffer.usage,!1,this.buffer.label))}extSize(o){if(o<=this.getSize())return;let t=this.gpu.createBuffer(o,this.buffer.usage,!1,this.buffer.label);this.gpu.copyBufferToBufferGpu(this.buffer,0,t,0,this.getSize()),this.setBuffer(t)}trim(o){if(this.getSize()===o)return;if(this.getSize()<o)throw new Error("this.getSize() < size32");let t=this.gpu.createBuffer(o,this.buffer.usage,!1,this.buffer.label);this.gpu.copyBufferToBufferGpu(this.buffer,0,t,0,o),this.setBuffer(t)}setBuffer(o){let t=gS();t.bufferSizeGPU-=this.buffer.size,this.gpu.debugBufferSizeIndex[this.buffer.label]-=this.buffer.size,this.gpu.debugBufferSizeIndex[this.buffer.label]===0&&delete this.gpu.debugBufferSizeIndex[this.buffer.label],this.buffer.destroy(),this.buffer=o,this.listeners.forEach(e=>e(this.buffer))}setDynamicBuffer(o){this.setBuffer(o.buffer),delete o.buffer}clear(o,t=0,e=this.getSize()-t){o.clearBuffer(this.buffer,t*fs,e*fs)}addListener(o){this.listeners.add(o)}delListener(o){this.listeners.delete(o)}write(o,t,e=0,r){this.gpu.writeBuffer(this,o,t,e,r)}},lW=class{constructor(o,t,e,r){this.memory=o.memoryManager.malloc(t*fs,e,r)}get usage(){return this.memory.getBuffer().usage}getSize(){return this.memory.getSize32()}getMemory(){return this.memory}read(o=0,t=this.getSize()){return this.memory.read(o*fs,t*fs)}free(){this.memory.free()}setSize(o,t=!0){this.memory.setSize(o*fs,t)}clear(o,t=0,e=this.getSize()-t){o.clearBuffer(this.memory.getBuffer(),this.memory.getOffset()+t*fs,e*fs)}write(o,t,e=0,r){this.memory.writeBuffer(o*fs,t,e&&e*fs,r&&r*fs)}toDynamicBuffer(){let o=this.memory.getWebGPU(),t=o.createDynamicBuffer(this.getSize(),this.usage,this.memory.getBuffer().label);return o.copyBufferToBuffer(this,0,t,0,this.getSize()),t}},Pye=2**31,ULe=class{constructor(o,t,e,r,i,n){if(this.listeners=new Set,this.win=gS(),this.gpu=o,this.format=r,this.usage=i,this.isExceedMaxTextureDimension2D(Math.max(t,e)),this.win.textureSizeGPU=(this.win.textureSizeGPU||0)+t*e*4,If.isEnableLog()&&console.log("textureSizeGPU:",this.win.textureSizeGPU/2**20,"M"),this.win.textureSizeGPU>Pye){console.warn(`textureSizeGPU is too large: ${this.win.textureSizeGPU/2**20} M`);debugger}this._texture=o.device.createTexture({size:[t,e],format:r,usage:i,label:n}),this._view=this._texture.createView(),o.textures.add(this)}get texture(){return this._texture}get view(){return this._view}get width(){return this._texture.width}get height(){return this._texture.height}get label(){return this._texture.label}getDepthView(){return this._texture.createView({aspect:"depth-only"})}getStencilView(){return this._texture.createView({aspect:"stencil-only"})}isExceedMaxTextureDimension2D(o){if(o>this.gpu.limits.maxTextureDimension2D)throw new Error("Texture exceeds maxTextureDimension2D")}updateSize(o,t){if(!(o===this.width&&t===this.height)){if(this.isExceedMaxTextureDimension2D(Math.max(o,t)),this.win.textureSizeGPU-=this._texture.width*this._texture.height*4,this._texture.destroy(),this.win.textureSizeGPU+=o*t*4,If.isEnableLog()&&console.log("textureSizeGPU:",this.win.textureSizeGPU/2**20,"M"),this.win.textureSizeGPU>Pye){console.warn(`textureSizeGPU is too large: ${this.win.textureSizeGPU/2**20} M`);debugger}this._texture=this.gpu.device.createTexture({size:[o,t],format:this.format,usage:this.usage,label:this._texture.label}),this._view=this._texture.createView(),this.listeners.forEach(e=>e(this._view))}}extSize(o,t,e,r){let i=this.width+o+e,n=this.height+t+r;if(this.isExceedMaxTextureDimension2D(Math.max(i,n)),this.win.textureSizeGPU+=i*n*4,console.log("textureSizeGPU:",this.win.textureSizeGPU/2**20,"M"),this.win.textureSizeGPU>Pye){console.warn(`textureSizeGPU is too large: ${this.win.textureSizeGPU/2**20} M`);debugger}let s=this.gpu.device.createTexture({size:[i,n],format:this.format,usage:this.usage,label:this._texture.label});this.gpu.run(a=>a.copyTextureToTexture({texture:this._texture},{texture:s,origin:{x:o,y:t}},this._texture)),this.win.textureSizeGPU-=this._texture.width*this._texture.height*4,If.isEnableLog()&&console.log("textureSizeGPU:",this.win.textureSizeGPU/2**20,"M"),this._texture.destroy(),this._texture=s,this._view=this._texture.createView(),this.listeners.forEach(a=>a(this._view))}addListener(o){this.listeners.add(o)}delListener(o){this.listeners.delete(o)}destroy(){this.win.textureSizeGPU-=this._texture.width*this._texture.height*4,console.log("textureSizeGPU:",this.win.textureSizeGPU/2**20,"M"),this._texture.destroy(),delete this._texture,this.gpu.textures.delete(this)}},Hot=class{constructor(o,t,...e){this.bufferListeners=[],this.gpu=o,this.layout=t,this.entries=[];for(let r=1;r<e.length;r+=2){let i=e[r-1],n=e[r];if(typeof i!="number"||typeof n=="number")throw new Error("typeof binding !== 'number' || typeof resource === 'number'");if(n instanceof lW){let s=n.getMemory(),a={buffer:s.getBuffer(),offset:s.getOffset(),size:s.getSize()};this.entries.push({binding:i,resource:a});let l=c=>{if(c.getSize()===0)throw new Error("buffer.size === 0");a.buffer=c.getBuffer(),a.offset=c.getOffset(),a.size=c.getSize(),this.updateBindGroup()};s.addListener(l),this.bufferListeners.push([s,l])}else if(n instanceof PW){let s={buffer:n.getBuffer()};if(this.entries.push({binding:i,resource:s}),n instanceof LJ){let a=l=>{if(l.size===0)throw new Error("buffer.size === 0");s.buffer=l,this.updateBindGroup()};n.addListener(a),this.bufferListeners.push([n,a])}}else if(n instanceof ULe){let s=this.entries.push({binding:i,resource:n.view})-1,a=l=>{this.entries[s].resource=l,this.updateBindGroup()};n.addListener(a),this.bufferListeners.push([n,a])}else this.entries.push({binding:i,resource:n})}this.updateBindGroup()}updateBindGroup(){this.bindGroup=this.gpu.device.createBindGroup({layout:this.layout,entries:this.entries})}getBindGroup(){return this.bindGroup}destroy(){this.bufferListeners.forEach(([o,t])=>o.delListener(t)),delete this.bindGroup}},Wot=class{constructor(o,t,e){this.listeners=new Set,this.allocator=o,this.offset=t,this.size=e}getWebGPU(){return this.allocator.gpu}getAllocator(){return this.allocator}getBuffer(){return this.allocator.getBuffer()}getOffset(){return this.offset}getSize(){return this.size}getSize32(){return this.size/fs}setSize(o,t=!0){this.allocator.gpu.memoryManager.realloc(this,o,t)}update(o,t,e){this.allocator=o,this.offset=t,this.size=e,this.listeners.forEach(r=>r(this))}free(){this.allocator.gpu.memoryManager.free(this)}addListener(o){this.listeners.add(o)}delListener(o){this.listeners.delete(o)}clear(){let o=this.allocator.gpu,t=o.device.createCommandEncoder();t.clearBuffer(this.getBuffer(),this.offset,this.size),o.submit(t)}writeBuffer(o,t,e=0,r){if(r===void 0&&(r=Math.min(this.size-o,t.byteLength-e)),o+r>this.size||e+r>t.byteLength)throw new Error("offset + size > buffer.size || dataOffset + size > data.byteLength");this.allocator.gpu.device.queue.writeBuffer(this.getBuffer(),this.offset+o,t instanceof ArrayBuffer?t:t.buffer,e,r)}async read(o,t){let e=this.getBuffer();if(!(e.usage&GPUBufferUsage.COPY_SRC))throw new Error("!(buffer.usage & GPUBufferUsage.COPY_SRC)");let r=this.allocator.gpu,i=r.device.createBuffer({size:t-o,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST,label:"readBuf"}),n=r.device.createCommandEncoder();n.copyBufferToBuffer(e,this.offset+o,i,0,i.size),r.submit(n),await i.mapAsync(GPUMapMode.READ);let s=i.getMappedRange().slice(0);return i.unmap(),i.destroy(),s}},Ibe=64*2**10,Cbe=256;if(!Number.isInteger(Ibe/Cbe))throw new Error("!Number.isInteger(MIN_BUFFER_SIZE / CHUNK_SIZE)");function uW(o){return Math.ceil(o/Cbe)*Cbe}var zot=class{constructor(o,t,e,r){this.chunks=new Y7,this.memorys=new Set,this.gpu=o;let i=Math.ceil(t/Ibe)*Ibe;this.chunks.add({start:0,size:i}),this.buffer=o.device.createBuffer({size:i,usage:e,label:r}),o.buffers.add(this.buffer);let n=gS();if(n.bufferSizeGPU=(n.bufferSizeGPU||0)+i,o.debugBufferSizeIndex[r]=(o.debugBufferSizeIndex[r]||0)+i,n.bufferSizeGPU>2**30){console.warn(`bufferSizeGPU is too large: ${n.bufferSizeGPU}`);debugger}}forEachChunk(o){let t=this.chunks.listIterator();for(;t.hasNext();)if(o(t.next()))return}getFirstChunk(){return this.chunks.listIterator().next()}useChunk(o,t){if(t=uW(t),t===o.item.size)this.chunks.remove(o);else if(t<o.item.size)o.item.start+=t,o.item.size-=t;else throw new Error("chunkNum > chunk.item.chunkNum")}releaseChunk(o){let t,e,r=this.chunks.listIterator();for(;r.hasNext();){let s=r.next();if(o.start<s.item.start){e=s;break}t=s}let i=t&&t.item.start+t.item.size===o.start,n=e&&o.start+o.size===e.item.start;i&&n?(t.item.size+=o.size+e.item.size,this.chunks.remove(e)):i?t.item.size+=o.size:n?(e.item.size+=o.size,e.item.start=o.start):e?this.chunks.insertBefore(e,o):this.chunks.addLast(o)}getMemorys(){return this.memorys}getBuffer(){return this.buffer}malloc(o,t){let e=new Wot(this,t.item.start,o);return this.memorys.add(e),this.useChunk(t,o),e}transfer(o,t,e,r,i){if(i){let n=this.gpu.device.createCommandEncoder();n.copyBufferToBuffer(this.buffer,o.getOffset(),t.buffer,e.item.start,Math.min(o.getSize(),r)),this.gpu.submit(n)}o.free(),t.memorys.add(o),o.update(t,e.item.start,r),t.useChunk(e,r)}isEmpty(){return this.chunks.size()!==1?!1:this.getFirstChunk().item.size===this.buffer.size}isFull(){return this.chunks.size()===0}getResourceSize(){return this.chunks.size()}free(o){this.memorys.delete(o),this.releaseChunk({start:o.getOffset(),size:uW(o.getSize())})}destroy(){let o=this.buffer,t=gS();t.bufferSizeGPU-=o.size,this.gpu.debugBufferSizeIndex[o.label]-=o.size,o.destroy()}},Yot=class{constructor(o){this.allocatorIndex={},this.gpu=o,window.logMemoryInfo=()=>{let t=0,e=0,r=0;Object.values(this.allocatorIndex).forEach(i=>i.allocators.forEach(n=>{t+=n.getMemorys().size,n.getMemorys().forEach(s=>{e+=s.getSize()}),r+=n.getBuffer().size})),If.isEnableLog()&&(console.log("\u5171\u4EAB\u5185\u5B58\u6570\u91CF:",t),console.log("\u5171\u4EAB\u5185\u5B58\u6240\u9700\u5185\u5B58(\u5355\u4F4D: M):",e/2**20),console.log("\u5171\u4EAB\u5185\u5B58\u5B9E\u9645\u5185\u5B58(\u5355\u4F4D: M):",r/2**20))}}getMinChunk(o,t,e){t=uW(t);let r,i,n=Number.POSITIVE_INFINITY;for(let s of this.allocatorIndex[o].allocators)if(s!==e&&(s.forEachChunk(a=>{let l=a.item.size-t;return l<0||l>=n?!1:(r=a,n=l,i=s,l===0)}),n===0))break;if(!r){let s=new zot(this.gpu,t,this.allocatorIndex[o].usage,o);this.allocatorIndex[o].allocators.add(s),r=s.getFirstChunk(),i=s}return{chunk:r,allocator:i}}malloc(o,t,e){t=t|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;let r=this.allocatorIndex[e];if(r||(this.allocatorIndex[e]=r={allocators:new Set,usage:t}),r.usage!==t)throw new Error("\u540C\u6807\u7B7E\u7684\u7F13\u51B2 usage \u4E0D\u540C");let i=this.getMinChunk(e,o);return i.allocator.malloc(o,i.chunk)}alignMemory(){return!1}realloc(o,t,e){if(t===o.getSize())return;let r=o.getAllocator(),i=uW(t),n=uW(o.getSize());if(i===n){o.update(r,o.getOffset(),t);return}if(i<n){r.releaseChunk({start:o.getOffset()+i,size:n-i}),o.update(r,o.getOffset(),t);return}let s=this.getMinChunk(o.getBuffer().label,t,r);r.transfer(o,s.allocator,s.chunk,t,e)}free(o){let t=o.getAllocator();if(t.free(o),!t.isEmpty())return;let e=t.getBuffer().label;t.destroy(),this.allocatorIndex[e].allocators.delete(t)}},jot=class extends PW{constructor(o,t,e,r){super(o,t.length,e,!0,r),new Uint32Array(this.buffer.getMappedRange()).set(t),this.buffer.unmap()}},HLe=class WLe{constructor(t){this.presentationFormat=navigator.gpu.getPreferredCanvasFormat(),this.memoryManager=new Yot(this),this.tempBufIndex={},this.buffers=new Set,this.textures=new Set,this.debugBufferSizeIndex={},this.device=t,this.coordXOffsetBuf=this.createStaticBuffer(new Uint32Array(1024).map((r,i)=>i*t.limits.maxComputeWorkgroupsPerDimension*t.limits.maxComputeWorkgroupSizeX),GPUBufferUsage.COPY_SRC,"coordXOffsetBuf of WebGPU"),this.groupOffsetXsBuf=this.createStaticBuffer(new Uint32Array(new Array(1024).fill(0).map((r,i)=>i*this.limits.maxComputeWorkgroupsPerDimension)),GPUBufferUsage.COPY_SRC,"groupOffsetXsBuf of WebGPU"),this.numBuf=this.createStaticBuffer(new Uint32Array(1024).map((r,i)=>i),GPUBufferUsage.COPY_SRC,"numBuf of WebGPU"),t.features.has("texture-compression-bc")?this.textureCompression="bc":t.features.has("texture-compression-etc2")?this.textureCompression="etc2":t.features.has("texture-compression-astc")&&(this.textureCompression="astc"),this.linearSampler=t.createSampler({magFilter:"linear",minFilter:"linear"}),this.nearestSampler=t.createSampler({magFilter:"nearest",minFilter:"nearest"}),window.addEventListener("unload",()=>{this.buffers.forEach(r=>r.destroy()),this.textures.forEach(r=>r.destroy())});let e=gS();e.bufferSizeIndex=this.debugBufferSizeIndex,e.getBufferInfo=()=>{let r={},i=0,n=0;this.buffers.forEach(s=>{let a=s instanceof PW?s.getBuffer().size:s.size;r[a]=(r[a]||0)+1,i+=a,n+=Math.ceil(a/65536)*65536}),console.log(r),console.log("size:",i/2**20),console.log("realSize:",n/2**20)},e.getTextureInfo=()=>{this.textures.forEach(r=>{console.log("width:",r.width),console.log("height:",r.height)});for(let r=0;r<20;r++){let i=2**r,n=0,s=0;this.textures.forEach(a=>{n+=a.width*a.height*4,s+=Math.ceil(a.width/i)*i*Math.ceil(a.height/i)*i*4}),console.log("\u5BF9\u9F50\u50CF\u7D20\uFF1A",i),console.log("size:",n/2**20),console.log("realSize:",s/2**20)}}}static async build(){let t=gS();if(!t.navigator.gpu)throw new Error("not support WebGPU!");let e=await t.navigator.gpu.requestAdapter(),r={maxTextureDimension1D:e.limits.maxTextureDimension1D,maxTextureDimension2D:e.limits.maxTextureDimension2D,maxTextureDimension3D:e.limits.maxTextureDimension3D,maxTextureArrayLayers:e.limits.maxTextureArrayLayers,maxBindGroups:e.limits.maxBindGroups,maxBindGroupsPlusVertexBuffers:e.limits.maxBindGroupsPlusVertexBuffers,maxBindingsPerBindGroup:e.limits.maxBindingsPerBindGroup,maxDynamicUniformBuffersPerPipelineLayout:e.limits.maxDynamicUniformBuffersPerPipelineLayout,maxDynamicStorageBuffersPerPipelineLayout:e.limits.maxDynamicStorageBuffersPerPipelineLayout,maxSampledTexturesPerShaderStage:e.limits.maxSampledTexturesPerShaderStage,maxSamplersPerShaderStage:e.limits.maxSamplersPerShaderStage,maxStorageBuffersPerShaderStage:e.limits.maxStorageBuffersPerShaderStage,maxStorageTexturesPerShaderStage:e.limits.maxStorageTexturesPerShaderStage,maxUniformBuffersPerShaderStage:e.limits.maxUniformBuffersPerShaderStage,maxUniformBufferBindingSize:e.limits.maxUniformBufferBindingSize,maxStorageBufferBindingSize:e.limits.maxStorageBufferBindingSize,minUniformBufferOffsetAlignment:e.limits.minUniformBufferOffsetAlignment,minStorageBufferOffsetAlignment:e.limits.minStorageBufferOffsetAlignment,maxVertexBuffers:e.limits.maxVertexBuffers,maxBufferSize:e.limits.maxBufferSize,maxVertexAttributes:e.limits.maxVertexAttributes,maxVertexBufferArrayStride:e.limits.maxVertexBufferArrayStride,maxInterStageShaderComponents:e.limits.maxInterStageShaderComponents,maxInterStageShaderVariables:e.limits.maxInterStageShaderVariables,maxColorAttachments:e.limits.maxColorAttachments,maxColorAttachmentBytesPerSample:e.limits.maxColorAttachmentBytesPerSample,maxComputeWorkgroupStorageSize:e.limits.maxComputeWorkgroupStorageSize,maxComputeInvocationsPerWorkgroup:e.limits.maxComputeInvocationsPerWorkgroup,maxComputeWorkgroupSizeX:e.limits.maxComputeWorkgroupSizeX,maxComputeWorkgroupSizeY:e.limits.maxComputeWorkgroupSizeY,maxComputeWorkgroupSizeZ:e.limits.maxComputeWorkgroupSizeZ,maxComputeWorkgroupsPerDimension:e.limits.maxComputeWorkgroupsPerDimension};for(let n in r)r[n]===void 0&&delete r[n];let i=await e.requestDevice({requiredLimits:r,requiredFeatures:e.features});return If.isEnableLog()&&console.log(i.limits,Array.from(e.features)),i.lost.then(n=>t._WEBGPU_DEVICE_LOST_INFO_=n),i.addEventListener("uncapturederror",n=>{throw n.error.message}),new WLe(i)}get limits(){return this.device.limits}get features(){return this.device.features}createShaderModule(t){return this.device.createShaderModule({code:t})}getTempBuf(t){return t=2**Math.ceil(Math.log2(t)),this.tempBufIndex[t]||(this.tempBufIndex[t]=this.createDynamicBuffer(t,GPUBufferUsage.STORAGE|GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,`tempBuf ${t} of WebGPU`)),this.tempBufIndex[t]}createBuffer(t,e,r,i){let n=gS();if(n.bufferSizeGPU=(n.bufferSizeGPU||0)+t*fs,this.debugBufferSizeIndex[i]=(this.debugBufferSizeIndex[i]||0)+t*fs,n.bufferSizeGPU>2**30){console.warn(`bufferSizeGPU is too large: ${n.bufferSizeGPU}`);debugger}return this.device.createBuffer({size:t*fs,usage:e,mappedAtCreation:r,label:i})}createDynamicBuffer(t,e,r){return new LJ(this,t,e,r)}createDynamicBufferWithData(t,e,r){if(t instanceof Float32Array){let i=new LJ(this,t.length,e,r);return this.writeBuffer(i,0,t),i}if(Array.isArray(t))return this.createDynamicBufferWithData(new Float32Array(t),e,r);if(typeof t=="number")return new LJ(this,t,e,r);throw new TypeError("Invalid data type provided")}createStorageDynamicBuffer(t,e){let r=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC;return this.createDynamicBufferWithData(t,r,e)}createUniformDynamicBuffer(t,e){let r=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC;return this.createDynamicBufferWithData(t,r,e)}createSharedBuffer(t,e,r){return new lW(this,t,e,r)}createStaticBuffer(t,e,r){return new jot(this,t,e,r)}createDynamicTexture(t,e,r,i,n){return new ULe(this,t,e,r,i,n)}createComputePipeline(t,e,r,i="auto",n){return typeof t=="string"&&(t=this.createShaderModule(t)),this.device.createComputePipeline({layout:i,compute:{module:t,entryPoint:e,constants:n},label:r})}async createComputePipelineAsync(t,e,r,i="auto",n){return typeof t=="string"&&(t=this.createShaderModule(t)),await this.device.createComputePipelineAsync({layout:i,compute:{module:t,entryPoint:e,constants:n},label:r})}submit(...t){this.device.queue.submit(t.map(e=>e.finish()))}copyBufferToBufferGpu(t,e,r,i,n,s){if(e+n>t.size/fs||i+n>r.size/fs)throw new Error("sourceOffset32 + size32 > source || destinationOffset32 + size32 > destination");if(s)s.copyBufferToBuffer(t,e*fs,r,i*fs,n*fs);else{let a=this.device.createCommandEncoder();a.copyBufferToBuffer(t,e*fs,r,i*fs,n*fs),this.submit(a)}}copyBufferToBuffer(t,e,r,i,n,s){if(e+n>t.getSize()||i+n>r.getSize())throw new Error("sourceOffset32 + size32 > source.getSize() || destinationOffset32 + size32 > destination.getSize()");let a,l,c,h,u=n*fs;if(t instanceof lW){let d=t.getMemory();a=d.getBuffer(),l=d.getOffset()+e*fs}else a=t.getBuffer(),l=e*fs;if(r instanceof lW){let d=r.getMemory();c=d.getBuffer(),h=d.getOffset()+i*fs}else c=r.getBuffer(),h=i*fs;if(s)s.copyBufferToBuffer(a,l,c,h,u);else{let d=this.device.createCommandEncoder();d.copyBufferToBuffer(a,l,c,h,u),this.submit(d)}}writeBuffer(t,e,r,i=0,n){if(n===void 0&&(n=Math.min(t.getSize()-e,r.byteLength/fs-i)),e+n>t.getSize()||(i+n)*fs>r.byteLength)throw new Error("bufferOffset32 + size32 > buffer.getSize() || (dataOffset32 + size32) * BYTES32 > data.byteLength");this.device.queue.writeBuffer(t.getBuffer(),e*fs,r instanceof ArrayBuffer?r:r.buffer,i*fs,n*fs)}runComputePass(t,e,r,i,n=s=>{if(s!==0)throw new Error("i !== 0")}){let{maxComputeWorkgroupsPerDimension:s,maxComputeWorkgroupSizeX:a}=this.limits,l=Math.ceil(i/a);for(let c=0;c<l;c+=s){n(c/s);let h=t.beginComputePass();h.setPipeline(e),h.setBindGroup(0,r),h.dispatchWorkgroups(Math.min(l-c,s)),h.end()}}run(t){let e=this.device.createCommandEncoder();t(e),this.submit(e)}runComputePassIndirect(t,e,r,i,n=0){let s=t.beginComputePass();s.setPipeline(e),s.setBindGroup(0,r),s.dispatchWorkgroupsIndirect(i.getBuffer(),n),s.end()}createBindGroup(t,e,...r){let i=[];for(let n=1;n<r.length;n+=2){let s=r[n-1],a=r[n];if(typeof s!="number"||typeof a=="number")throw new Error("typeof binding !== 'number' || typeof resource === 'number'");if(a instanceof PW)i.push({binding:s,resource:{buffer:a.getBuffer()}});else if(a instanceof lW){let l=a.getMemory();i.push({binding:s,resource:{buffer:l.getBuffer(),offset:l.getOffset(),size:l.getSize()}})}else i.push({binding:s,resource:a})}return this.device.createBindGroup({layout:e,entries:i,label:t})}createDynamicBindGroup(t,...e){return new Hot(this,t,...e)}clearColorView(t,e,r=e,i=e,n=1){let s=this.device.createCommandEncoder();s.beginRenderPass({colorAttachments:[{view:t,clearValue:{r:e,g:r,b:i,a:n},loadOp:"clear",storeOp:"store"}]}).end(),this.submit(s)}clearDepthView(t,e=0){let r=this.device.createCommandEncoder();r.beginRenderPass({colorAttachments:[],depthStencilAttachment:{view:t,depthClearValue:e,depthLoadOp:"clear",depthStoreOp:"store"}}).end(),this.submit(r)}async readBuffer(t,e=0,r=t.getSize()){if(!(t.usage&GPUBufferUsage.COPY_SRC))throw new Error("!(buffer.usage & GPUBufferUsage.COPY_SRC)");let i=this.createDynamicBuffer(r-e,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST,"readBuf");this.copyBufferToBuffer(t,e,i,0,r-e),await i.getBuffer().mapAsync(GPUMapMode.READ);let n=i.getBuffer().getMappedRange().slice(0);return i.getBuffer().unmap(),i.destroy(),n}},zLe=60;function Xot(o,t){let e=new Float32Array(zLe);e.set(o.getRenderMatrix().data),e.set(o.getViewMatrix().data,16),e.set(o.getInverseMatrix().data,32);let r=o.getPosition();e[48]=r.x,e[49]=r.y,e[50]=r.z,e[51]=o.isOrthCamera()?1:0;let i=o.getTar2Pos().scale(-1);return e[52]=i.x,e[53]=i.y,e[54]=i.z,e[55]=t===Number.NEGATIVE_INFINITY?-1:o.getBorderZ(t),e[56]=o.getPxLength(),e[57]=Mt.X_UNIT_VECTOR.multiply4(o.getRenderMatrix()).x<Mt.ORIGIN.multiply4(o.getRenderMatrix()).x?1:0,e[58]=o.getWidth(),e[59]=o.getHeight(),e}var aRe="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_n : mat4x4 < f32 > , O_ap : vec3 < f32 > , O_aq : vec3 < f32 > , O_ar : vec3 < f32 > , O_as : f32 , O_ad : f32 , O_at : f32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_au : O_ao ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_av : O_a ; @ group ( 0 ) @ binding ( 2 ) var O_aw : sampler ; @ group ( 0 ) @ binding ( 3 ) var O_ax : texture_2d < f32 > ; struct O_ay { @ builtin ( position ) O_az : vec4 < f32 > , @ location ( 0 ) O_ba : vec2 < f32 > , @ location ( 1 ) O_am : vec3 < f32 > , @ location ( 2 ) O_an : vec3 < f32 > , } struct O_bb { @ location ( 0 ) O_bc : vec4 < f32 > , } @ vertex fn v_main ( @ location ( 0 ) O_bd : vec2 < f32 > , @ location ( 1 ) O_ba : vec2 < f32 > , ) -> O_ay { var O_be : O_ay ; O_be . O_az = O_av . O_b * O_au . O_n * vec4 ( O_bd , 0 , 1.0 ) ; if ( O_au . O_ad == 2 ) { let O_n = O_av . O_c * O_au . O_n ; O_be . O_am = mat3x3 ( vec3 ( O_n [ 0 ] . xyz ) , vec3 ( O_n [ 1 ] . xyz ) , vec3 ( O_n [ 2 ] . xyz ) ) * vec3 < f32 > ( 0 , 0 , 1 ) ; let O_e = O_n * vec4 ( O_bd . xy , 0 , 1 ) ; O_be . O_an = - O_e . xyz / O_e . w ; } O_be . O_ba = O_ba ; return O_be ; } @ fragment fn f_main ( @ location ( 0 ) O_ba : vec2 < f32 > , @ location ( 1 ) O_am : vec3 < f32 > , @ location ( 2 ) O_an : vec3 < f32 > , ) -> O_bb { var O_be : O_bb ; if ( O_au . O_ad != 2 ) { var O_bc = textureSample ( O_ax , O_aw , O_ba ) ; O_bc . a *= O_au . O_as ; O_be . O_bc = O_bc ; return O_be ; } let O_bf = vec2 < i32 > ( floor ( O_ba * vec2 < f32 > ( textureDimensions ( O_ax ) ) ) ) ; var O_bc = textureLoad ( O_ax , O_bf , 0 ) ; if ( O_bc . a < 0.01 ) { discard ; } let O_bg : vec3 < f32 > = vec3 ( 0 , 0 , 0 ) ; let O_bh : vec3 < f32 > = vec3 ( O_bc . r , O_bc . g , O_bc . b ) ; let O_bi : vec3 < f32 > = vec3 ( 0 , 0 , 0 ) ; var O_bj = O_bg * O_au . O_ap ; var O_bk = normalize ( O_am ) ; var O_ar = O_au . O_ar ; var O_bl = abs ( dot ( O_bk , O_ar ) ) * O_bh * O_au . O_aq ; var O_bm = - 2.0 * O_bk * dot ( O_ar , O_bk ) + O_ar ; var O_bn = normalize ( O_an ) ; var O_bo = abs ( dot ( O_bm , O_bn ) ) ; var O_bp = O_bi * O_au . O_aq * pow ( O_bo , 300.0 ) * O_au . O_at * 0.1 ; O_be . O_bc = vec4 ( O_bj + O_bl + O_bp , O_au . O_as ) ; return O_be ; } ",lRe=36,qot=class{constructor(o){this.vertexStrideLen=4,this.scene=o;let t=o.gpu;this.gpu=t,this.device=t.device,this.pipeline=this.createPipeline(),this.renderDesc=this.createRenderDesc(),this.uniformBuffer=t.createDynamicBuffer(lRe,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,"uniformBuffer of TextureProgram"),this.vertexBuf=t.createDynamicBuffer(this.vertexStrideLen*6,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,"vertexBuf of TextureProgram")}createPipeline(){return this.device.createRenderPipeline({layout:"auto",vertex:{module:this.gpu.createShaderModule(aRe),entryPoint:"v_main",buffers:[{arrayStride:this.vertexStrideLen*fs,attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:8,format:"float32x2"}]}]},fragment:{module:this.gpu.createShaderModule(aRe),entryPoint:"f_main",targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"},depthStencil:{depthWriteEnabled:!1,depthCompare:"always",format:v2,stencilReadMask:255,stencilBack:{compare:"equal"},stencilFront:{compare:"equal"}}})}createRenderDesc(){return{colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"}}}createBindGroup(o){return this.gpu.createBindGroup("Pt Texture",this.pipeline.getBindGroupLayout(0),0,this.uniformBuffer,1,this.scene.cameraBuf,2,this.gpu.linearSampler,3,o.view)}render(o,t,e,r,i){if(!e.gpuTexture)return;this.renderDesc.colorAttachments[0].view=o.colorTexture.view,this.renderDesc.depthStencilAttachment.view=o.depthStencilTexture.view;let n=new Float32Array(lRe);n.set(t.data),n.set(this.scene.ambientLight.color.getData(),16),n.set(this.scene.directionalLight.color.getData(),20);let s=this.scene.directionalLight.direction();n.set([s.x,s.y,s.z],24),n[27]=e.alpha,n[28]=r,n[29]=i==null?void 0:i.shininess,this.scene.addData(new Uint32Array(n.buffer),this.uniformBuffer),this.scene.addData(new Uint32Array(new Float32Array([e.rdPoint.x,e.rdPoint.y,1,1,e.ldPoint.x,e.ldPoint.y,0,1,e.luPoint.x,e.luPoint.y,0,0,e.ruPoint.x,e.ruPoint.y,1,0,e.rdPoint.x,e.rdPoint.y,1,1,e.luPoint.x,e.luPoint.y,0,0]).buffer),this.vertexBuf);let a=this.scene.commandEncoder.beginRenderPass(this.renderDesc);a.setPipeline(this.pipeline),a.setStencilReference(64),a.setBindGroup(0,e.bindGroup),a.setVertexBuffer(0,this.vertexBuf.getBuffer()),a.draw(6,1,0,0),a.end()}},$ot=class extends Rv{constructor(o){super(),this.gpu=o,this.texture=o.createDynamicTexture(this.canvas.width,this.canvas.height,za,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,"PixelCharGPU")}flush(){if(!this.changed)return;this.changed=!1;let{width:o,height:t}=this.canvas,e=this.context.getImageData(0,0,o,t);this.gpu.device.queue.writeTexture({texture:this.texture.texture},e.data,{bytesPerRow:o*4},[o,t])}},Kot="@ group ( 0 ) @ binding ( 0 ) var O_a : sampler ; @ group ( 0 ) @ binding ( 1 ) var O_b : texture_2d < f32 > ; struct O_c { @ builtin ( position ) O_d : vec4 < f32 > , @ location ( 0 ) O_e : vec2 < f32 > , } @ vertex fn vert ( @ location ( 0 ) O_f : vec2 < f32 > , ) -> O_c { var O_g : O_c ; O_g . O_d = vec4 ( O_f , 0.0 , 1.0 ) ; O_g . O_e = ( O_f + 1.0 ) * 0.5 ; O_g . O_e . y = 1.0 - O_g . O_e . y ; return O_g ; } @ fragment fn frag ( @ location ( 0 ) O_e : vec2 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { return textureSample ( O_b , O_a , O_e ) ; } ",Zot=class{constructor(o){this.m_nSampling=1,this.m_scene=o;let t=o.gpu;this.gpu=t,this.m_device=t.device,this.m_renderDesc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]},this.m_sampler=this.gpu.linearSampler,this.m_posBuf=t.createStaticBuffer(new Uint32Array(new Float32Array([-1,-1,-1,1,1,1,-1,-1,1,1,1,-1]).buffer),GPUBufferUsage.VERTEX,"PosBuf of SSAAGPU"),this.m_nPosBufCount=this.m_posBuf.getSize()/2;let e=t.createShaderModule(Kot);this.m_pipeline=this.m_device.createRenderPipeline({layout:"auto",vertex:{module:e,entryPoint:"vert",buffers:[{arrayStride:2*fs,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:e,entryPoint:"frag",targets:[{format:za,blend:{color:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}}),this.colorTexture=t.createDynamicTexture(1,1,za,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"colorTexture of ScreenAAGPU"),this.highLightColorTexture0=t.createDynamicTexture(1,1,za,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"highLightColorTexture of ScreenAAGPU"),this.highLightColorTexture1=t.createDynamicTexture(1,1,za,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"highLightColorTexture of ScreenAAGPU"),this.clearColorDesc=this.createRenderDesc(this.colorTexture.view),this.clearHighLightColorDesc0=this.createRenderDesc(this.highLightColorTexture0.view),this.clearHighLightColorDesc1=this.createRenderDesc(this.highLightColorTexture1.view),this.colorTexture.addListener(r=>this.clearColorDesc.colorAttachments[0].view=r),this.highLightColorTexture0.addListener(r=>this.clearHighLightColorDesc0.colorAttachments[0].view=r),this.highLightColorTexture1.addListener(r=>this.clearHighLightColorDesc1.colorAttachments[0].view=r),this.m_bindGroup=this.createDynamicBindGroup(this.colorTexture),this.m_bindGroup_highLight0=this.createDynamicBindGroup(this.highLightColorTexture0),this.m_bindGroup_highLight1=this.createDynamicBindGroup(this.highLightColorTexture1)}createRenderDesc(o){return{colorAttachments:[{view:o,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}],label:"renderDesc of ScreenAAGPU"}}createDynamicBindGroup(o){return this.m_scene.gpu.createDynamicBindGroup(this.m_pipeline.getBindGroupLayout(0),0,this.m_sampler,1,o)}clearColor(){this.m_scene.commandEncoder.beginRenderPass(this.clearColorDesc).end(),this.m_scene.commandEncoder.beginRenderPass(this.clearHighLightColorDesc0).end(),this.m_scene.commandEncoder.beginRenderPass(this.clearHighLightColorDesc1).end()}setSampling(o){this.m_nSampling=J7.positive(o)}getSampling(){return this.m_nSampling}renderSSAA(o,t){this.m_renderDesc.colorAttachments[0].view=o;let e=this.m_bindGroup.getBindGroup();t!=null&&(t==0?e=this.m_bindGroup_highLight0.getBindGroup():e=this.m_bindGroup_highLight1.getBindGroup());let r=this.m_scene.commandEncoder.beginRenderPass(this.m_renderDesc);r.setPipeline(this.m_pipeline),r.setBindGroup(0,e),r.setVertexBuffer(0,this.m_posBuf.getBuffer()),r.draw(this.m_nPosBufCount),r.end(),this.m_scene.submitCommandEncoder()}},Jot="struct O_a { O_b : vec4 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec4 < f32 > , O_h : vec4 < f32 > , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_i : O_a ; @ binding ( 1 ) @ group ( 0 ) var < storage , read > O_j : array < vec4 < f32 > > ; override RENDER_HIGHLIGHT_TYPE_SHIFT : f32 ; fn O_k ( O_l : f32 , ) -> u32 { return u32 ( O_l ) >> u32 ( RENDER_HIGHLIGHT_TYPE_SHIFT ) ; } fn O_m ( O_c : u32 , ) -> vec4 < f32 > { var O_b : vec4 < f32 > ; if ( O_c > 0 ) { O_b = O_j [ O_c ] ; if ( O_b . r + O_b . g + O_b . b == 0 ) { O_b . r = O_i . O_g . r ; O_b . g = O_i . O_g . g ; O_b . b = O_i . O_g . b ; } O_b . a *= O_i . O_g . a ; } else { O_b = O_i . O_g ; } return O_b ; } fn O_n ( O_c : f32 , ) -> vec4 < f32 > { var O_b : vec4 < f32 > ; let O_l = O_k ( O_c ) ; if ( O_i . O_e == 0 && O_i . O_d == 1 ) { if ( O_i . O_f == 1 ) { O_b = O_i . O_h ; } else { O_b = O_i . O_g ; } } else { if ( O_i . O_d == 1 ) { O_b = O_m ( O_l ) ; } else { if ( O_l > 0 ) { O_b = O_j [ O_l ] ; if ( O_b . r + O_b . g + O_b . b == 0 ) { O_b = O_i . O_b ; } } else { O_b = O_i . O_b ; } } } return O_b ; } @ vertex fn fullVert ( @ builtin ( vertex_index ) O_o : u32 , ) -> @ builtin ( position ) vec4 < f32 > { var O_p = array < vec2 < f32 > , 6 > ( vec2 < f32 > ( 1.0 , 1.0 ) , vec2 < f32 > ( 1.0 , - 1.0 ) , vec2 < f32 > ( - 1.0 , - 1.0 ) , vec2 < f32 > ( 1.0 , 1.0 ) , vec2 < f32 > ( - 1.0 , - 1.0 ) , vec2 < f32 > ( - 1.0 , 1.0 ) ) ; return vec4 < f32 > ( O_p [ O_o ] , 0.5 , 1.0 ) ; } @ fragment fn fullFrag ( ) -> @ location ( 0 ) vec4 < f32 > { return O_n ( O_i . O_c ) ; } ",Qot="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_ap : vec4 < f32 > , O_i : f32 , O_ad : u32 , O_aq : f32 , O_ar : f32 , O_as : u32 , O_at : f32 , O_au : f32 , O_av : f32 , O_aw : vec4 < f32 > , O_ax : vec4 < f32 > , O_ay : vec4 < f32 > , O_az : f32 , O_ba : f32 , @ align ( 16 ) O_bb : O_ae , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_bc : O_a ; @ binding ( 1 ) @ group ( 0 ) var < uniform > O_bd : O_ao ; @ binding ( 2 ) @ group ( 0 ) var < storage , read > O_be : array < f32 > ; @ binding ( 3 ) @ group ( 0 ) var < storage , read > O_bf : array < O_m > ; @ binding ( 4 ) @ group ( 0 ) var < storage , read > O_bg : array < u32 > ; @ binding ( 5 ) @ group ( 0 ) var O_bh : texture_2d < f32 > ; @ binding ( 6 ) @ group ( 0 ) var O_bi : sampler ; @ binding ( 7 ) @ group ( 0 ) var < storage , read > O_bj : array < f32 > ; @ binding ( 8 ) @ group ( 0 ) var < storage , read > O_bk : array < f32 > ; @ binding ( 9 ) @ group ( 0 ) var < storage , read > O_bl : array < vec4 < f32 > > ; @ binding ( 10 ) @ group ( 0 ) var < storage , read > O_bm : array < O_u > ; @ binding ( 11 ) @ group ( 0 ) var < storage , read > O_bn : array < f32 > ; @ binding ( 12 ) @ group ( 0 ) var < storage , read > O_bo : array < u32 > ; override CIRCLE_PT_LENGTH : i32 ; override ARC_PT_LENGTH : i32 ; override TRIANGLE_PT_LENGTH : i32 ; override RECT_PT_LENGTH : i32 ; override LINE_PT_LENGTH : i32 ; override CUTED_CIRCLE_PT_LENGTH : i32 ; override LINESEGMENT_PT_LENGTH : i32 ; override SEMICIRCLE_PT_LENGTH : i32 ; override STATIC_TRIANGLE_PT_LENGTH : i32 ; override STATIC_CUTED_CIRCLE_PT_LENGTH : i32 ; override MATH_PI : f32 ; override ANTIALIAS_RATIO : f32 ; override DRC_PT_LENGTH : i32 ; override CHAR_WIDTH : f32 ; override CHAR_HEIGHT : f32 ; override CANVAS_WIDTH : f32 ; override CANVAS_HEIGHT : f32 ; override MIN_PX_LENGTH_RATIO : f32 ; override SDF_WIDTH : f32 ; override SDF_HEIGHT : f32 ; override RENDER_HIGHLIGHT_TYPE_SHIFT : f32 ; override STRING_PT_LENGTH : i32 ; override TEMPLATE_INSTANCE_PT_LENGTH : i32 ; override STRING_LEVEL_BITLENGTH : u32 ; override POINT_PT_LENGTH : i32 ; override SCALE_STRING_PT_LENGTH : i32 ; override SCALE_ARROW_PT_LENGTH : i32 ; override FIXED_ARROW_PT_LENGTH : i32 ; override GROUP_DATA_LENGTH : u32 ; override PTGROUP_VISIBLE_SHIFT : u32 ; override PTGROUP_DOUBLERGB_SHIFT : u32 ; override PTGROUP_HIGH_LIGHT_SHIFT : u32 ; override PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT : u32 ; override PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT : u32 ; fn O_bp ( O_p : f32 , ) -> f32 { return f32 ( u32 ( O_p ) & u32 ( RENDER_HIGHLIGHT_TYPE_SHIFT ) ) ; } fn O_bq ( id : i32 , O_p : f32 , ) -> i32 { var O_br = 1 ; if ( id == - 1 ) { O_br = 0 ; } let O_bs = O_bp ( O_p ) ; if ( ( O_bd . O_au == 0 && O_bs == 1 && ( O_bd . O_av == 0 || O_bd . O_az == 1 ) ) ) { O_br = 0 ; } return O_br ; } fn O_bt ( O_p : u32 , ) -> vec4 < f32 > { var O_ap : vec4 < f32 > ; var O_ax = O_bd . O_ax ; if ( O_bd . O_at == 0 && O_bd . O_av == 1 ) { O_ax = O_bd . O_ay ; } if ( O_p > 0 ) { O_ap = O_bl [ O_p ] ; if ( O_ap . r + O_ap . g + O_ap . b == 0 ) { O_ap . r = O_ax . r ; O_ap . g = O_ax . g ; O_ap . b = O_ax . b ; } O_ap . a *= O_ax . a ; } else { O_ap = O_ax ; } return O_ap ; } fn O_bu ( O_p : f32 , O_bv : f32 , O_bw : f32 , O_bx : f32 , ) -> vec4 < f32 > { var O_ap : vec4 < f32 > ; let O_by = O_bz ( O_p ) ; if ( O_bx == 1 ) { O_ap = O_bt ( O_by ) ; } else { if ( O_by > 0 ) { O_ap = O_bl [ O_by ] ; if ( O_ap . r + O_ap . g + O_ap . b == 0 ) { O_ap = O_bd . O_ap ; } } else { O_ap = O_bd . O_ap ; } } O_ap = vec4 ( O_ap . r , O_ap . g , O_ap . b , O_ap . a * O_bv ) ; return O_ap ; } fn O_ca ( O_cb : f32 , O_q : f32 , ) -> f32 { let O_cc = O_cd ( O_q ) ; let O_ac = O_ce ( O_cb , O_cc . O_ac ) ; return O_ac ; } fn O_cf ( O_cb : f32 , O_q : f32 , ) -> f32 { let O_cc = O_cd ( O_q ) ; return O_cc . O_ad ; } fn O_bz ( O_by : f32 , ) -> u32 { return u32 ( O_by ) >> u32 ( RENDER_HIGHLIGHT_TYPE_SHIFT ) ; } fn O_cg ( O_ch : f32 , O_ci : vec2 < f32 > , ) -> vec2 < f32 > { let O_cj = O_bm [ i32 ( O_ch ) ] ; return O_cj . O_n * vec3 ( O_ci , 1.0 ) ; } fn O_ck ( O_cl : vec2 < f32 > , vec2 : vec2 < f32 > , ) -> f32 { return O_cl . x * vec2 . y - O_cl . y * vec2 . x ; } fn O_cm ( O_cn : f32 , ) -> vec4 < f32 > { let O_co = vec4 ( 1.0 , 2.0 , 3.0 , 4.0 ) - O_cn ; let O_cp = O_co * O_co * O_co ; let O_cq = O_cp . x ; let O_cr = O_cp . y - 4.0 * O_cp . x ; let O_cs = O_cp . z - 4.0 * O_cp . y + 6.0 * O_cp . x ; let O_ct = 6.0 - O_cq - O_cr - O_cs ; return vec4 ( O_cq , O_cr , O_cs , O_ct ) * ( 1.0 / 6.0 ) ; } fn O_cu ( O_cv : vec2 < f32 > , O_cw : f32 , O_cx : f32 , O_cy : f32 , ) -> f32 { let size = vec2 < f32 > ( O_cw , O_cx ) ; let O_cz = 1.0 / size ; var O_da = O_cv * size - 0.5 ; let O_db = fract ( O_da ) ; O_da = O_da - O_db ; let O_dc = O_cm ( O_db . x ) ; let O_dd = O_cm ( O_db . y ) ; let O_de = O_da . xxyy + vec4 ( - 0.5 , 1.5 , - 0.5 , 1.5 ) ; let O_cp = vec4 ( O_dc . xz + O_dc . yw , O_dd . xz + O_dd . yw ) ; var O_df = O_de + vec4 ( O_dc . yw , O_dd . yw ) / O_cp ; O_df = O_df * O_cz . xxyy ; let O_dg = O_dh ( O_df . xz , O_cw , O_cx , O_cy ) ; let O_di = O_dh ( O_df . yz , O_cw , O_cx , O_cy ) ; let O_dj = O_dh ( O_df . xw , O_cw , O_cx , O_cy ) ; let O_dk = O_dh ( O_df . yw , O_cw , O_cx , O_cy ) ; let O_dl = O_cp . x / ( O_cp . x + O_cp . y ) ; let O_dm = O_cp . z / ( O_cp . z + O_cp . w ) ; return mix ( mix ( O_dk , O_dj , O_dl ) , mix ( O_di , O_dg , O_dl ) , O_dm ) ; } fn O_dh ( O_cv : vec2 < f32 > , O_cw : f32 , O_cx : f32 , O_cy : f32 , ) -> f32 { let O_k = i32 ( O_cw ) ; let O_l = i32 ( O_cx ) ; let O_dn = O_cv . x * O_cw - 0.5 ; let O_do = O_cv . y * O_cx - 0.5 ; let O_dp = fract ( O_dn ) ; let O_dq = fract ( O_do ) ; let O_df = i32 ( O_cy ) ; let O_dr = i32 ( floor ( O_dn ) ) ; let O_ds = i32 ( floor ( O_do ) ) ; let O_dt = clamp ( O_dr , 0 , O_k - 1 ) ; let O_du = clamp ( O_dr + 1 , 0 , O_k - 1 ) ; let O_dv = clamp ( O_ds , 0 , O_l - 1 ) ; let O_dw = clamp ( O_ds + 1 , 0 , O_l - 1 ) ; let O_dx = O_bk [ O_df + ( O_dv * O_k + O_dt ) ] ; let O_dy = O_bk [ O_df + ( O_dv * O_k + O_du ) ] ; let O_dz = O_bk [ O_df + ( O_dw * O_k + O_dt ) ] ; let O_ea = O_bk [ O_df + ( O_dw * O_k + O_du ) ] ; let O_eb = mix ( O_dx , O_dy , O_dp ) ; let O_ec = mix ( O_dz , O_ea , O_dp ) ; return mix ( O_eb , O_ec , O_dq ) ; } fn O_ed ( O_ee : u32 , O_ef : vec2 < f32 > , O_eg : f32 , O_eh : f32 , O_ei : f32 , O_ej : f32 , O_ek : f32 , ) -> vec2 < f32 > { let O_el = O_ei + O_ej / 2 ; let O_em = vec2 ( cos ( O_el ) , sin ( O_el ) ) ; var O_en = vec2 ( O_em . y , - O_em . x ) ; let O_eo = cos ( O_ej / 2 ) * O_eh - O_ek ; let O_ep = O_em * O_eo ; let O_cq = ( - O_eo + sqrt ( O_eo * O_eo + 8 * O_eg * O_eg ) ) / 2 ; let O_eq = O_em * O_cq ; let tan = sqrt ( O_cq * O_cq - O_eg * O_eg ) / O_eg ; let O_er = O_en * ( ( O_cq - O_eo ) / tan ) ; var O_ci = O_ef ; if ( O_ej < 0 ) { if ( O_ee == 0 ) { O_ci += O_er ; O_ci += O_ep ; } else if ( O_ee == 1 ) { O_ci -= O_er ; O_ci += O_ep ; } else { O_ci += O_eq ; } } else { if ( O_ee == 0 ) { O_ci -= O_er ; O_ci += O_ep ; } else if ( O_ee == 1 ) { O_ci += O_er ; O_ci += O_ep ; } else { O_ci += O_eq ; } } return O_ci ; } fn O_es ( O_ee : u32 , O_ef : vec2 < f32 > , O_eg : f32 , O_ei : f32 , O_ej : f32 , O_et : vec2 < f32 > , O_eu : vec2 < f32 > , ) -> vec2 < f32 > { var O_ci = vec2f ( 0 , 0 ) ; if ( abs ( abs ( O_ej ) - 6.283185307179586 ) <= 1e-8 ) { O_ci = O_ef ; if ( O_ej > 0 ) { if ( O_ee == 0 ) { O_ci . x += O_eg * ( - sqrt ( 3.0 ) ) ; O_ci . y += O_eg * ( - 1.0 ) ; } else if ( O_ee == 1 ) { O_ci . x += O_eg * ( sqrt ( 3.0 ) ) ; O_ci . y += O_eg * ( - 1.0 ) ; } else { O_ci . y += O_eg * ( 2.0 ) ; } } else { if ( O_ee == 0 ) { O_ci . x += O_eg * ( sqrt ( 3.0 ) ) ; O_ci . y += O_eg * ( - 1.0 ) ; } else if ( O_ee == 1 ) { O_ci . x += O_eg * ( - sqrt ( 3.0 ) ) ; O_ci . y += O_eg * ( - 1.0 ) ; } else { O_ci . y += O_eg * ( 2.0 ) ; } } } else { let O_el = O_ei + O_ej / 2 ; let O_em = vec2 ( cos ( O_el ) , sin ( O_el ) ) ; var O_en = normalize ( O_eu - O_et ) ; let O_eo = cos ( O_ej / 2 ) * O_eg ; let O_cq = ( - O_eo + sqrt ( O_eo * O_eo + 8 * O_eg * O_eg ) ) / 2 ; let O_eq = O_em * O_cq ; let tan = sqrt ( O_cq * O_cq - O_eg * O_eg ) / O_eg ; let O_er = O_en * ( ( O_cq - O_eo ) / tan ) - ( O_eu - O_et ) / 2 ; if ( O_ee == 0 ) { O_ci = O_eu + O_er ; } else if ( O_ee == 1 ) { O_ci = O_et - O_er ; } else { O_ci = O_ef + O_eq ; } } return O_ci ; } struct O_ev { O_et : vec2f , O_eu : vec2f , O_en : vec2f , } fn O_ew ( O_et : vec2f , O_eu : vec2f , O_ex : f32 , O_k : f32 , O_ey : f32 , ) -> O_ev { var O_ez : O_ev ; var O_en = normalize ( O_eu - O_et ) ; if ( O_ex == 1 || O_ex == 2 ) { var O_fa : vec2f ; if ( all ( O_et == O_eu ) ) { O_en = vec2 ( 1 , 0 ) ; } O_fa = O_en * max ( O_k , O_ey ) / 2 ; O_ez . O_et = O_et - O_fa ; O_ez . O_eu = O_eu + O_fa ; O_ez . O_en = O_en ; return O_ez ; } O_ez . O_et = O_et ; O_ez . O_eu = O_eu ; O_ez . O_en = O_en ; return O_ez ; } fn O_fb ( O_fc : u32 , ) -> u32 { return O_fc >> PTGROUP_VISIBLE_SHIFT ; } fn O_fd ( O_fc : u32 , ) -> u32 { return ( O_fc >> PTGROUP_DOUBLERGB_SHIFT ) & 1 ; } fn O_fe ( O_fc : u32 , ) -> u32 { return ( O_fc >> PTGROUP_HIGH_LIGHT_SHIFT ) & 1 ; } fn O_ff ( O_fc : u32 , ) -> u32 { return ( O_fc >> PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT ) & 1 ; } fn O_fg ( O_fc : u32 , ) -> u32 { return O_fc & 1 ; } fn O_fh ( O_fc : u32 , ) -> u32 { return O_fc >> PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT ; } fn O_cd ( O_q : f32 , ) -> O_w { var O_ez : O_w ; if ( O_q != - 1 ) { let O_fc = O_bo [ u32 ( O_q ) * GROUP_DATA_LENGTH ] ; O_ez . O_ac = f32 ( O_bo [ u32 ( O_q ) * GROUP_DATA_LENGTH + 1 ] ) ; O_ez . O_y = f32 ( O_fe ( O_fc ) ) ; O_ez . O_x = f32 ( O_fb ( O_fc ) ) ; if ( O_ez . O_y == 1 ) { O_ez . O_z = f32 ( O_ff ( O_fc ) ) ; O_ez . O_ab = f32 ( O_fg ( O_fc ) ) ; } O_ez . O_aa = f32 ( O_fd ( O_fc ) ) ; O_ez . O_ad = f32 ( O_fh ( O_fc ) ) ; } return O_ez ; } fn O_ce ( O_cb : f32 , O_fi : f32 , ) -> f32 { if ( O_bz ( O_cb ) != 0 ) { return O_cb ; } if ( O_bz ( O_fi ) != 0 ) { return O_fi ; } return O_cb ; } fn O_fj ( O_p : f32 , O_fk : f32 , ) -> bool { if ( O_bd . O_ba != O_p || O_fk == 1 ) { return false ; } return true ; } fn O_fl ( O_fk : f32 , O_fm : u32 , ) -> bool { if ( O_fk == 0 ) { if ( O_fm == 1 ) { return true ; } return false ; } if ( O_fk == 1 ) { return true ; } if ( O_fk == 2 ) { return false ; } return false ; } struct O_fn { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_fp : f32 , @ location ( 1 ) @ interpolate ( flat ) r : f32 , @ location ( 2 ) @ interpolate ( flat ) O_ef : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_ei : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fq : f32 , @ location ( 5 ) O_ci : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_p : f32 , @ location ( 7 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 8 ) @ interpolate ( flat ) O_fk : f32 , } fn O_fr ( O_ee : u32 , O_ef : vec2 < f32 > , O_eh : f32 , O_k : f32 , O_ei : f32 , O_ej : f32 , O_ey : f32 , O_q : f32 , ) -> O_fn { var O_ez : O_fn ; O_ez . O_ef = O_ef ; O_ez . O_fq = O_ei + O_ej ; let O_ek = max ( O_k , O_ey ) / 2 ; O_ez . O_fp = O_eh + O_ek ; O_ez . r = O_eh - O_ek ; let O_eg = O_ez . O_fp ; O_ez . O_ci = O_ed ( O_ee , O_ef , O_eg , O_eh , O_ei , O_ej , O_ek ) ; O_ez . O_ei = O_ei ; let O_cc = O_cd ( O_q ) ; O_ez . O_fk = O_cc . O_ad ; return O_ez ; } @ vertex fn arcVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_fn { var O_ez : O_fn ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * ARC_PT_LENGTH ; let O_ef = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eh = O_be [ O_ft + 3 ] ; let O_k = max ( O_be [ O_ft + 4 ] , O_bd . O_i ) ; let O_ei = O_be [ O_ft + 5 ] ; let O_ej = O_be [ O_ft + 6 ] ; let O_fu = O_be [ O_ft + 9 ] ; O_ez = O_fr ( O_ee , O_ef , O_eh , O_k , O_ei , O_ej , O_bd . O_i * MIN_PX_LENGTH_RATIO , O_fu ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 8 ] , O_be [ O_ft + 9 ] ) ; } return O_ez ; } @ vertex fn arcTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_fn { var O_ez : O_fn ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( O_by ) * ( ARC_PT_LENGTH + 1 ) ; let O_ef = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_eh = O_bn [ O_ft + 3 ] ; let O_k = max ( O_bn [ O_ft + 4 ] , O_bd . O_i ) ; let O_ei = O_bn [ O_ft + 5 ] ; let O_ej = O_bn [ O_ft + 6 ] ; let O_fu = O_bn [ O_ft + 9 ] ; O_ez = O_fr ( O_ee , O_ef , O_eh , O_k , O_ei , O_ej , O_bd . O_i * MIN_PX_LENGTH_RATIO , O_fu ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 3 ] , O_be [ O_ft + 9 ] ) ; } return O_ez ; } @ fragment fn arcFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_fp : f32 , @ location ( 1 ) @ interpolate ( flat ) O_eh : f32 , @ location ( 2 ) @ interpolate ( flat ) O_ef : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_ei : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fq : f32 , @ location ( 5 ) O_ci : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_p : f32 , @ location ( 7 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 8 ) @ interpolate ( flat ) O_fk : f32 , ) -> @ location ( 0 ) vec4 < f32 > { let O_fx = length ( O_ci - O_ef ) ; if ( O_fx > O_fp || O_fx < O_eh ) { discard ; } let O_en = O_ci - O_ef ; let O_fy = vec2 ( cos ( O_ei ) , sin ( O_ei ) ) ; let O_fz = O_fy . x * O_en . y - O_fy . y * O_en . x ; let O_ga = vec2 ( cos ( O_fq ) , sin ( O_fq ) ) ; let O_gb = O_ga . x * O_en . y - O_ga . y * O_en . x ; let O_gc = O_fq - O_ei ; let O_gd = O_fl ( O_fk , O_bd . O_ad ) ; if ( ( O_gc < MATH_PI && ( O_fz < 0.0 || O_gb > 0.0 ) ) || ( O_gc >= MATH_PI && ( O_fz < 0.0 && O_gb > 0.0 ) ) ) { let O_ge = ( O_fp - O_eh ) / 2.0 ; let O_eg = ( O_fp + O_eh ) / 2.0 ; let O_gf = O_ef + O_fy * O_eg ; let O_gg = O_ef + O_ga * O_eg ; let O_gh = length ( O_ci - O_gf ) ; let O_gi = length ( O_ci - O_gg ) ; if ( O_gh > O_ge && O_gi > O_ge ) { discard ; } if ( O_gd && ( O_gh < O_ge - O_bd . O_i || O_gi < O_ge - O_bd . O_i ) ) { discard ; } } else if ( O_gd && O_fx < O_fp - O_bd . O_i && O_fx > O_eh + O_bd . O_i ) { discard ; } var O_ap = O_bu ( O_p , 1 , 0 , O_bx ) ; return O_ap ; } struct O_gj { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) r : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fk : f32 , } fn O_gk ( O_ee : u32 , O_ef : vec2 < f32 > , O_eh : f32 , O_ey : f32 , O_i : f32 , O_q : f32 , ) -> O_gj { var O_ez : O_gj ; O_ez . r = max ( O_eh , O_ey / 2 ) ; var O_gl = sqrt ( 3.0 ) ; var O_eg = O_ez . r ; O_eg += O_i * sqrt ( 0.5 ) ; if ( O_ee == 0 ) { O_ez . O_ci = O_ef + vec2 ( - O_eg * O_gl , - O_eg ) ; } else if ( O_ee == 1 ) { O_ez . O_ci = O_ef + vec2 ( O_eg * O_gl , - O_eg ) ; } else { O_ez . O_ci = O_ef + vec2 ( 0 , 2 * O_eg ) ; } let O_cc = O_cd ( O_q ) ; O_ez . O_fk = O_cc . O_ad ; return O_ez ; } @ vertex fn circleVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_gj { var O_ez : O_gj ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * CIRCLE_PT_LENGTH ; let O_ef = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eh = O_be [ O_ft + 3 ] ; let O_fu = O_be [ O_ft + 6 ] ; O_ez = O_gk ( O_ee , O_ef , O_eh , O_bd . O_i * MIN_PX_LENGTH_RATIO , 0 , O_fu ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; O_ez . O_ci -= O_ef ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 5 ] , O_be [ O_ft + 6 ] ) ; } return O_ez ; } @ vertex fn circleTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , @ location ( 2 ) @ interpolate ( flat ) O_fk : f32 , ) -> O_gj { var O_ez : O_gj ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_gm = i32 ( O_by ) * ( CIRCLE_PT_LENGTH + 1 ) ; let O_ef = vec2 ( O_bn [ O_gm + 1 ] , O_bn [ O_gm + 2 ] ) ; let O_eh = O_bn [ O_gm + 3 ] ; let O_fu = O_bn [ O_gm + 6 ] ; O_ez = O_gk ( O_ee , O_ef , O_eh , O_bd . O_i * MIN_PX_LENGTH_RATIO , 0 , O_fu ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; O_ez . O_ci -= O_ef ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_be [ O_fv + 3 ] ; } return O_ez ; } @ fragment fn circleFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_eh : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fk : f32 , ) -> @ location ( 0 ) vec4 < f32 > { let O_gd = O_fl ( O_fk , O_bd . O_ad ) ; if ( length ( O_ci ) > O_eh ) { discard ; } if ( O_gd && length ( O_ci ) < O_eh - O_bd . O_i ) { discard ; } return O_bu ( O_p , 1 , 0 , O_bx ) ; } struct O_gn { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_et : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_eu : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_go : f32 , @ location ( 4 ) @ interpolate ( flat ) O_eg : f32 , @ location ( 5 ) @ interpolate ( flat ) O_gp : f32 , @ location ( 6 ) @ interpolate ( flat ) O_gq : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_gr : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 10 ) @ interpolate ( flat ) O_fk : f32 , } fn O_gs ( O_ee : u32 , O_gt : vec2 < f32 > , O_gu : f32 , O_gv : f32 , O_gc : f32 , O_eg : f32 , O_ey : f32 , O_i : f32 , O_q : f32 , ) -> O_gn { var O_ez : O_gn ; let O_k = max ( O_gu , O_ey ) ; let O_l = max ( O_gv , O_ey ) ; O_ez . O_go = O_l / 2 ; let O_gw = cos ( O_gc ) ; let O_gx = sin ( O_gc ) ; let O_gy = mat2x2 < f32 > ( O_gw , O_gx , - O_gx , O_gw ) ; O_ez . O_et = O_gt + O_gy * vec2 ( 0 , - O_ez . O_go ) ; O_ez . O_eu = O_gt + O_gy * vec2 ( O_k , - O_ez . O_go ) ; let O_en = normalize ( O_ez . O_eu - O_ez . O_et ) ; let O_em = vec2 ( - O_en . y , O_en . x ) ; let O_gq = vec2 ( O_em * O_ez . O_go ) ; let O_gz = O_em * sqrt ( 0.5 ) * O_i ; var O_fa = O_en * sqrt ( 0.5 ) * O_i ; if ( O_ee == 0 || O_ee == 5 ) { O_ez . O_ci = O_ez . O_et - O_gq - O_gz - O_fa ; } else if ( O_ee == 1 ) { O_ez . O_ci = O_ez . O_eu - O_gq - O_gz + O_fa ; } else if ( O_ee == 2 || O_ee == 3 ) { O_ez . O_ci = O_ez . O_eu + O_gq + O_gz + O_fa ; } else if ( O_ee == 4 ) { O_ez . O_ci = O_ez . O_et + O_gq + O_gz - O_fa ; } O_ez . O_gq = O_gq ; O_ez . O_gr = O_en * O_k * 0.5 ; O_ez . O_eg = O_eg ; let O_cc = O_cd ( O_q ) ; O_ez . O_fk = O_cc . O_ad ; return O_ez ; } @ vertex fn rectVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_gn { var O_ez : O_gn ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } O_ez . O_gp = 0 ; let O_ft = id * RECT_PT_LENGTH ; let O_gt = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_gu = O_be [ O_ft + 3 ] ; let O_gv = O_be [ O_ft + 4 ] ; let O_gc = O_be [ O_ft + 5 ] ; let O_eg = O_be [ O_ft + 6 ] ; let O_fu = O_be [ O_ft + 9 ] ; O_ez = O_gs ( O_ee , O_gt , O_gu , O_gv , O_gc , O_eg , O_bd . O_i * MIN_PX_LENGTH_RATIO , O_bd . O_i , O_fu ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 8 ] , O_be [ O_ft + 9 ] ) ; } return O_ez ; } @ vertex fn noBodyRectVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , ) -> O_gn { var O_ez : O_gn ; let O_ft = i32 ( O_fs ) * RECT_PT_LENGTH ; let O_ha = u32 ( O_be [ O_ft ] ) ; if ( O_ha == 0 ) { return O_ez ; } let O_gt = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_gu = O_be [ O_ft + 3 ] ; let O_gv = O_be [ O_ft + 4 ] ; let O_gc = O_be [ O_ft + 5 ] ; let O_eg = O_be [ O_ft + 6 ] ; let O_fu = O_be [ O_ft + 9 ] ; O_ez = O_gs ( O_ee , O_gt , O_gu , O_gv , O_gc , O_eg , O_bd . O_i * MIN_PX_LENGTH_RATIO , O_bd . O_i , O_fu ) ; O_ez . O_p = O_be [ O_ft + 8 ] ; O_ez . O_gp = 1 ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; return O_ez ; } @ vertex fn rectTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_gn { var O_ez : O_gn ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } O_ez . O_gp = 0 ; let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( O_by ) * ( RECT_PT_LENGTH + 1 ) ; let O_gt = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_gu = O_bn [ O_ft + 3 ] ; let O_gv = O_bn [ O_ft + 4 ] ; let O_gc = O_bn [ O_ft + 5 ] ; let O_eg = O_bn [ O_ft + 6 ] ; let O_fu = O_bn [ O_ft + 9 ] ; O_ez = O_gs ( O_ee , O_gt , O_gu , O_gv , O_gc , O_eg , O_bd . O_i * MIN_PX_LENGTH_RATIO , O_bd . O_i , O_fu ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_be [ O_ft + 3 ] ; } return O_ez ; } @ fragment fn rectFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_et : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_eu : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_go : f32 , @ location ( 4 ) @ interpolate ( flat ) O_eg : f32 , @ location ( 5 ) @ interpolate ( flat ) O_gp : f32 , @ location ( 6 ) @ interpolate ( flat ) O_gq : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_gr : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 10 ) @ interpolate ( flat ) O_fk : f32 , ) -> @ location ( 0 ) vec4 < f32 > { var O_bv : f32 = 1 ; var O_en = O_eu - O_et ; let O_hb = length ( O_en ) ; if ( O_hb == 0 ) { O_en = vec2 ( 1 , 0 ) ; } else { O_en = normalize ( O_en ) ; } let O_ef = ( O_et + O_eu ) * 0.5 ; let O_hc = O_ci - O_ef ; let O_cq = abs ( dot ( O_en , O_hc ) ) ; let O_cr = abs ( O_hc . x * O_en . y - O_hc . y * O_en . x ) ; let O_hd = O_hb * 0.5 - O_eg ; let O_he = O_go - O_eg ; let O_gd = O_fl ( O_fk , O_bd . O_ad ) ; if ( O_gd ) { let O_hf = O_cq - O_hd ; let O_hg = O_cr - O_he ; if ( O_cq > O_hd && O_cr > O_he ) { let O_hh = length ( vec2 ( O_hf , O_hg ) ) ; if ( O_hh > O_eg || O_hh < O_eg - O_bd . O_i ) { discard ; } } else { if ( O_hg < O_eg - O_bd . O_i ) { if ( O_hf < O_eg - O_bd . O_i ) { discard ; } } } } else { let O_eh = sqrt ( 1.0 / 2.0 ) * O_bd . O_i ; if ( O_cq > O_hd && O_cr > O_he ) { let O_hf = O_cq - O_hd ; let O_hg = O_cr - O_he ; let O_hh = length ( vec2 ( O_hf , O_hg ) ) ; if ( O_hh > ( O_eg + O_eh ) ) { discard ; } } let O_hi = length ( O_gr ) ; let O_hj = length ( O_gq ) ; let O_hk = O_hi - O_hj ; let O_hl = vec2f ( O_hi - O_eg , O_hj - O_eg ) ; if ( O_eg >= O_eh && O_cq > O_hl . x && O_cr > O_hl . y ) { var distance = length ( vec2 ( O_cq , O_cr ) - O_hl ) ; if ( distance >= O_eg + O_eh ) { discard ; } else if ( distance <= O_eg - O_eh ) { O_bv = 1 ; } else { let O_hm : f32 = MATH_PI * O_eh * O_eh ; let O_hn : f32 = 0 ; let O_ho = acos ( ( O_eg * O_eg + distance * distance - O_eh * O_eh ) / ( 2 * O_eg * distance ) ) ; let O_hp = acos ( ( O_eh * O_eh + distance * distance - O_eg * O_eg ) / ( 2 * O_eh * distance ) ) ; let O_hq = O_ho * O_eg * O_eg ; let O_hr = O_hp * O_eh * O_eh ; let O_hs = O_eg * sin ( O_ho ) * distance ; var O_ht = O_hq + O_hr - O_hs ; O_bv = smoothstep ( O_hn , O_hm , O_ht ) ; } } else { let O_hu = select ( ( O_cr > - O_hk && O_cr + O_hk > O_cq ) , ( O_cq <= O_hk ) || ( O_cq - O_hk < O_cr ) , ( O_hk > 0 ) ) ; let distance = - select ( O_hi - O_cq , O_hj - O_cr , O_hu ) ; if ( distance <= - O_eh ) { O_bv = 1 ; } else { let O_hm : f32 = MATH_PI * O_eh * O_eh ; let O_hn : f32 = 0 ; let O_gc = acos ( abs ( distance ) / O_eh ) ; let O_hv = abs ( O_gc * O_eh * O_eh ) ; let O_hw = sqrt ( O_eh * O_eh - distance * distance ) ; let O_hs = O_hw * abs ( distance ) ; var O_ht = O_hv - O_hs ; if ( distance < 0 ) { O_ht = O_hm - O_ht ; } O_bv = smoothstep ( O_hn , O_hm * ANTIALIAS_RATIO , O_ht ) ; } } } if ( O_gp == 0 ) { return O_bu ( O_p , O_bv , 0 , O_bx ) ; } return O_bu ( O_p , O_bv * 0.5 , 0 , O_bx ) ; } struct O_hx { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_et : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_eu : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_go : f32 , @ location ( 4 ) @ interpolate ( flat ) O_eg : f32 , @ location ( 5 ) @ interpolate ( flat ) O_gq : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_gr : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 9 ) @ interpolate ( flat ) O_fk : f32 , } fn O_hy ( O_ee : u32 , O_et : vec2 < f32 > , O_eu : vec2 < f32 > , O_k : f32 , O_ex : f32 , O_ey : f32 , O_i : f32 , O_q : f32 , ) -> O_hx { var O_ez : O_hx ; let O_hz = O_ew ( O_et , O_eu , O_ex , O_k , O_ey ) ; O_ez . O_et = O_hz . O_et ; O_ez . O_eu = O_hz . O_eu ; let O_en = O_hz . O_en ; O_ez . O_go = max ( O_k , O_ey ) / 2 ; if ( O_ex == 1 ) { O_ez . O_eg = O_ez . O_go ; } let O_em = vec2 ( - O_en . y , O_en . x ) ; let O_gq = vec2 ( O_em * O_ez . O_go ) ; let O_gz = O_em * sqrt ( 0.5 ) * O_i ; var O_fa = O_en * sqrt ( 0.5 ) * O_i ; if ( O_ee == 0 || O_ee == 5 ) { O_ez . O_ci = O_ez . O_et - O_gq - O_gz - O_fa ; } else if ( O_ee == 1 ) { O_ez . O_ci = O_ez . O_eu - O_gq - O_gz + O_fa ; } else if ( O_ee == 2 || O_ee == 3 ) { O_ez . O_ci = O_ez . O_eu + O_gq + O_gz + O_fa ; } else if ( O_ee == 4 ) { O_ez . O_ci = O_ez . O_et + O_gq + O_gz - O_fa ; } O_ez . O_gq = O_gq ; O_ez . O_gr = O_en * length ( O_ez . O_eu - O_ez . O_et ) * 0.5 ; let O_cc = O_cd ( O_q ) ; O_ez . O_fk = O_cc . O_ad ; return O_ez ; } @ vertex fn lineVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_hx { var O_ez : O_hx ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * LINE_PT_LENGTH ; let O_et = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eu = vec2f ( O_be [ O_ft + 3 ] , O_be [ O_ft + 4 ] ) ; let O_k = O_be [ O_ft + 5 ] ; let O_ex = O_be [ O_ft + 9 ] ; let O_fu = O_be [ O_ft + 8 ] ; let O_ey = O_bd . O_i * MIN_PX_LENGTH_RATIO ; O_ez = O_hy ( O_ee , O_et , O_eu , O_k , O_ex , O_ey , O_bd . O_i , O_fu ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 7 ] , O_be [ O_ft + 8 ] ) ; } return O_ez ; } @ vertex fn lineTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_hx { var O_ez : O_hx ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( O_by ) * ( LINE_PT_LENGTH + 1 ) ; let O_et = vec2f ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_eu = vec2f ( O_bn [ O_ft + 3 ] , O_bn [ O_ft + 4 ] ) ; let O_k = O_bn [ O_ft + 5 ] ; let O_ex = O_bn [ O_ft + 9 ] ; let O_ey = O_bd . O_i * MIN_PX_LENGTH_RATIO ; let O_fu = O_bn [ O_ft + 8 ] ; O_ez = O_hy ( O_ee , O_et , O_eu , O_k , O_ex , O_ey , O_bd . O_i , O_fu ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_be [ O_ft + 7 ] ; } return O_ez ; } @ fragment fn lineFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_et : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_eu : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_go : f32 , @ location ( 4 ) @ interpolate ( flat ) O_eg : f32 , @ location ( 5 ) @ interpolate ( flat ) O_gq : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_gr : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 9 ) @ interpolate ( flat ) O_fk : f32 , ) -> @ location ( 0 ) vec4 < f32 > { let O_gd = O_fl ( O_fk , O_bd . O_ad ) ; var O_bv : f32 = 1 ; var O_en = O_eu - O_et ; let O_hb = length ( O_en ) ; if ( O_hb == 0 ) { O_en = vec2 ( 1 , 0 ) ; } else { O_en = normalize ( O_en ) ; } let O_ef = ( O_et + O_eu ) * 0.5 ; let O_hc = O_ci - O_ef ; let O_cq = abs ( dot ( O_en , O_hc ) ) ; let O_cr = abs ( O_hc . x * O_en . y - O_hc . y * O_en . x ) ; let O_hd = O_hb * 0.5 - O_eg ; let O_he = O_go - O_eg ; if ( O_gd ) { let O_hf = O_cq - O_hd ; let O_hg = O_cr - O_he ; if ( O_cq > O_hd && O_cr > O_he ) { let O_hh = length ( vec2 ( O_hf , O_hg ) ) ; if ( O_hh > O_eg || O_hh < O_eg - O_bd . O_i ) { discard ; } } else { if ( O_hg < O_eg - O_bd . O_i ) { if ( O_hf < O_eg - O_bd . O_i ) { discard ; } } } } else { let O_eh = sqrt ( 1.0 / 2.0 ) * O_bd . O_i ; if ( O_cq > O_hd && O_cr > O_he ) { let O_hf = O_cq - O_hd ; let O_hg = O_cr - O_he ; let O_hh = length ( vec2 ( O_hf , O_hg ) ) ; if ( O_hh > ( O_eg + O_eh ) ) { discard ; } } let O_hi = length ( O_gr ) ; let O_hj = length ( O_gq ) ; let O_hk = O_hi - O_hj ; let O_hl = vec2f ( O_hi - O_eg , O_hj - O_eg ) ; if ( O_eg >= O_eh && O_cq > O_hl . x && O_cr > O_hl . y ) { var distance = length ( vec2 ( O_cq , O_cr ) - O_hl ) ; if ( distance >= O_eg + O_eh ) { discard ; } else if ( distance <= O_eg - O_eh ) { O_bv = 1 ; } else { let O_hm : f32 = MATH_PI * O_eh * O_eh ; let O_hn : f32 = 0 ; let O_ho = acos ( ( O_eg * O_eg + distance * distance - O_eh * O_eh ) / ( 2 * O_eg * distance ) ) ; let O_hp = acos ( ( O_eh * O_eh + distance * distance - O_eg * O_eg ) / ( 2 * O_eh * distance ) ) ; let O_hq = O_ho * O_eg * O_eg ; let O_hr = O_hp * O_eh * O_eh ; let O_hs = O_eg * sin ( O_ho ) * distance ; var O_ht = O_hq + O_hr - O_hs ; O_bv = smoothstep ( O_hn , O_hm , O_ht ) ; } } else { let O_hu = select ( ( O_cr > - O_hk && O_cr + O_hk > O_cq ) , ( O_cq <= O_hk ) || ( O_cq - O_hk < O_cr ) , ( O_hk > 0 ) ) ; let distance = - select ( O_hi - O_cq , O_hj - O_cr , O_hu ) ; if ( distance <= - O_eh ) { O_bv = 1 ; } else { let O_hm : f32 = MATH_PI * O_eh * O_eh ; let O_hn : f32 = 0 ; let O_gc = acos ( abs ( distance ) / O_eh ) ; let O_hv = abs ( O_gc * O_eh * O_eh ) ; let O_hw = sqrt ( O_eh * O_eh - distance * distance ) ; let O_hs = O_hw * abs ( distance ) ; var O_ht = O_hv - O_hs ; if ( distance < 0 ) { O_ht = O_hm - O_ht ; } O_bv = smoothstep ( O_hn , O_hm * ANTIALIAS_RATIO , O_ht ) ; } } } return O_bu ( O_p , O_bv , 0 , O_bx ) ; } struct O_ia { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_hh : f32 , @ location ( 1 ) @ interpolate ( flat ) O_ib : f32 , @ location ( 2 ) @ interpolate ( flat ) O_ic : f32 , @ location ( 3 ) @ interpolate ( flat ) O_en : vec2 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_et : vec2 < f32 > , @ location ( 5 ) O_ci : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_gq : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_bx : f32 , } fn O_id ( O_ee : u32 , O_et : vec2 < f32 > , O_eu : vec2 < f32 > , O_ib : f32 , O_ic : f32 , O_i : f32 , ) -> O_ia { var O_ez : O_ia ; var O_ci : vec2 < f32 > ; let O_en = normalize ( O_eu - O_et ) ; let O_em = vec2 ( - O_en . y , O_en . x ) ; let O_gq = O_em * O_i * 0.5 ; if ( O_ee == 0 || O_ee == 5 ) { O_ci = O_et - O_gq ; O_ez . O_hh = 0 ; } else if ( O_ee == 1 ) { O_ci = O_eu - O_gq ; O_ez . O_hh = distance ( O_et , O_eu ) / O_i ; } else if ( O_ee == 2 || O_ee == 3 ) { O_ci = O_eu + O_gq ; O_ez . O_hh = distance ( O_et , O_eu ) / O_i ; } else if ( O_ee == 4 ) { O_ci = O_et + O_gq ; O_ez . O_hh = 0 ; } O_ez . O_et = O_et ; O_ez . O_en = O_en ; O_ez . O_ci = O_ci ; O_ez . O_gq = O_gq ; O_ez . O_ib = O_ib ; O_ez . O_ic = O_ic ; return O_ez ; } @ vertex fn lineSegmentVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_ia { var O_ez : O_ia ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * LINESEGMENT_PT_LENGTH ; let O_et = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eu = vec2 ( O_be [ O_ft + 3 ] , O_be [ O_ft + 4 ] ) ; let O_ib = O_be [ O_ft + 5 ] ; let O_ic = O_be [ O_ft + 6 ] ; O_ez = O_id ( O_ee , O_et , O_eu , O_ib , O_ic , O_bd . O_i ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 8 ] , O_be [ O_ft + 9 ] ) ; } return O_ez ; } @ vertex fn lineSegmentTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_ia { var O_ez : O_ia ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( O_by ) * ( LINESEGMENT_PT_LENGTH + 1 ) ; let O_et = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_eu = vec2 ( O_bn [ O_ft + 3 ] , O_bn [ O_ft + 4 ] ) ; let O_ib = O_bn [ O_ft + 5 ] ; let O_ic = O_bn [ O_ft + 6 ] ; O_ez = O_id ( O_ee , O_et , O_eu , O_ib , O_ic , O_bd . O_i ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_bn [ O_ft + 8 ] ; } return O_ez ; } @ fragment fn lineSegmentFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_hh : f32 , @ location ( 1 ) @ interpolate ( flat ) O_ib : f32 , @ location ( 2 ) @ interpolate ( flat ) O_ic : f32 , @ location ( 3 ) @ interpolate ( flat ) O_en : vec2 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_et : vec2 < f32 > , @ location ( 5 ) O_ci : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_gq : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_bx : f32 , ) -> @ location ( 0 ) vec4 < f32 > { if ( O_hh % O_ib > O_ic ) { discard ; } var O_bv : f32 = 0 ; let O_ie = O_ci - O_et ; let O_hj = length ( O_gq ) ; let O_eh = sqrt ( 1.0 / 2.0 ) * O_bd . O_i ; let distance : f32 = abs ( dot ( O_ie , vec2 ( O_en . y , - O_en . x ) ) ) - O_hj ; if ( distance <= - O_eh ) { O_bv = 1 ; } else { let O_hm : f32 = MATH_PI * O_eh * O_eh ; let O_hn : f32 = 0 ; let O_gc = acos ( abs ( distance ) / O_eh ) ; let O_hv = abs ( O_gc * O_eh * O_eh ) ; let O_hw = sqrt ( O_eh * O_eh - distance * distance ) ; let O_hs = O_hw * abs ( distance ) ; var O_ht = O_hv - O_hs ; if ( distance < 0 ) { O_ht = O_hm - O_ht ; } O_bv = smoothstep ( O_hn , O_hm * ANTIALIAS_RATIO , O_ht ) ; } return O_bu ( O_p , O_bv , 0 , O_bx ) ; } struct O_if { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) r : f32 , @ location ( 2 ) @ interpolate ( flat ) O_ig : f32 , @ location ( 3 ) @ interpolate ( flat ) O_ih : f32 , @ location ( 4 ) @ interpolate ( flat ) O_bx : f32 , } fn O_ii ( O_ee : u32 , O_ef : vec2 < f32 > , O_eh : f32 , O_i : f32 , ) -> O_if { var O_ez : O_if ; O_ez . r = max ( O_eh , O_i / 2 ) ; let O_gl = sqrt ( 3.0 ) ; if ( O_ee == 0 ) { O_ez . O_ci = O_ef + vec2 ( - O_ez . r * O_gl , - O_ez . r ) ; } else if ( O_ee == 1 ) { O_ez . O_ci = O_ef + vec2 ( O_ez . r * O_gl , - O_ez . r ) ; } else { O_ez . O_ci = O_ef + vec2 ( 0 , 2 * O_ez . r ) ; } return O_ez ; } @ vertex fn semicircleVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_if { var O_ez : O_if ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * SEMICIRCLE_PT_LENGTH ; let O_ef = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eh = O_be [ O_ft + 3 ] ; O_ez = O_ii ( O_ee , O_ef , O_eh , O_bd . O_i ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; O_ez . O_ci -= O_ef ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 0 ) { O_ez . O_ig = O_cb ; } else { O_ez . O_ig = O_be [ O_ft + 4 ] ; O_ez . O_ih = O_be [ O_ft + 5 ] ; } O_ez . O_bx = f32 ( O_bx ) ; return O_ez ; } @ vertex fn semicircleTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_if { var O_ez : O_if ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( O_by ) * ( SEMICIRCLE_PT_LENGTH + 1 ) ; let O_ef = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_eh = O_bn [ O_ft + 3 ] ; O_ez = O_ii ( O_ee , O_ef , O_eh , O_bd . O_i ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; O_ez . O_ci -= O_ef ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 0 ) { O_ez . O_ig = O_cb ; } else { O_ez . O_ig = O_bn [ O_ft + 4 ] ; O_ez . O_ih = O_bn [ O_ft + 5 ] ; } O_ez . O_bx = f32 ( O_bx ) ; return O_ez ; } @ fragment fn semicircleFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_eh : f32 , @ location ( 2 ) @ interpolate ( flat ) O_ig : f32 , @ location ( 3 ) @ interpolate ( flat ) O_ih : f32 , @ location ( 4 ) @ interpolate ( flat ) O_bx : f32 , ) -> @ location ( 0 ) vec4 < f32 > { if ( length ( O_ci ) > O_eh ) { discard ; } var O_p = O_ig ; if ( O_bx == 1 ) { O_p = select ( O_ig , O_ih , O_ci . x < 0 ) ; } return O_bu ( O_p , 1 , 0 , O_bx ) ; } struct O_ij { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_p : f32 , @ location ( 1 ) @ interpolate ( flat ) O_ik : f32 , @ location ( 2 ) @ interpolate ( flat ) O_il : f32 , @ location ( 3 ) O_im : vec2 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_ek : f32 , @ location ( 5 ) @ interpolate ( flat ) O_go : f32 , @ location ( 6 ) O_ci : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_ef : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_bx : f32 , } fn O_in ( O_ee : u32 , O_e : vec2 < f32 > , O_k : f32 , O_l : f32 , O_gc : f32 , O_io : f32 , O_ik : f32 , O_il : f32 , O_aq : f32 , O_i : f32 , O_ip : f32 , MATH_PI : f32 , SDF_WIDTH : f32 , SDF_HEIGHT : f32 , ) -> O_ij { var O_ez : O_ij ; O_ez . O_ef = O_e ; var O_iq = 1.0 ; let O_ir = O_l / O_ip ; if ( O_aq == 1 && O_ir > O_io ) { O_iq = O_io / O_ir ; } let O_ek = O_k * 0.5 * O_iq ; let O_go = O_l * 0.5 * O_iq ; O_ez . O_ek = O_ek ; O_ez . O_go = O_go ; var O_ci : vec2 < f32 > ; let O_hj = O_i ; let O_is = O_go / O_ek ; let O_ho = atan ( O_is ) ; let O_hp = ( MATH_PI * 0.5 - O_ho ) * 0.5 ; let O_it : f32 = O_hj / sin ( O_ho ) ; let O_iu : f32 = O_hj / tan ( O_hp ) ; let O_er = 0.25 ; let O_iv = O_ek * 2 ; let O_iw = SDF_HEIGHT / SDF_WIDTH ; var O_cq = O_iv * O_go / ( O_iw * O_go + O_iv ) ; var O_cr = O_iw * O_cq ; let O_ix = O_ek / O_cq ; let O_iy = ( O_go - O_cr * 0.5 ) / O_cr ; if ( O_ee == 0 ) { O_ci = vec2 ( - O_ek - O_hj , - O_go - O_iu ) ; O_ez . O_im = vec2 ( 0 , - O_iy ) ; } else if ( O_ee == 1 ) { O_ci = vec2 ( O_it , 0 ) ; O_ez . O_im = vec2 ( O_ix , 0.5 ) ; } else if ( O_ee == 2 ) { O_ci = vec2 ( - O_ek - O_hj , O_go + O_iu ) ; O_ez . O_im = vec2 ( 0 , 1 + O_iy ) ; } else if ( O_ee == 3 ) { O_ci = vec2 ( O_ek + O_hj , - O_go - O_iu ) ; O_ez . O_im = vec2 ( 1 , - O_iy ) ; } else if ( O_ee == 4 ) { O_ci = vec2 ( O_ek + O_hj , O_go + O_iu ) ; O_ez . O_im = vec2 ( 1 , 1 + O_iy ) ; } else { O_ci = vec2 ( - O_it , 0 ) ; O_ez . O_im = vec2 ( 1 - O_ix , 0.5 ) ; } if ( O_ee < 3 ) { O_ez . O_im . x -= O_er ; } else { O_ez . O_im . x += O_er ; } let cos = cos ( O_gc ) ; let sin = sin ( O_gc ) ; O_ci = mat2x2 ( cos , sin , - sin , cos ) * O_ci ; O_ci += O_e ; O_ez . O_ci = O_ci ; return O_ez ; } @ vertex fn drcVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_ij { var O_ez : O_ij ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } O_ez . O_p = O_cb ; let O_ft = id * DRC_PT_LENGTH ; let O_ik = O_be [ O_ft + 8 ] ; let O_il = O_be [ O_ft + 9 ] ; let O_e = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_k = O_be [ O_ft + 3 ] ; let O_l = O_be [ O_ft + 4 ] ; let O_io = O_be [ O_ft + 7 ] ; let O_gc = O_be [ O_ft + 5 ] ; O_ez = O_in ( O_ee , O_e , O_k , O_l , O_gc , O_io , O_ik , O_il , O_bd . O_aq , O_bd . O_i , O_bc . O_i , MATH_PI , SDF_WIDTH , SDF_HEIGHT ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci . xy , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 12 ] , O_be [ O_ft + 11 ] ) ; } return O_ez ; } @ fragment fn drcFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_p : f32 , @ location ( 1 ) @ interpolate ( flat ) O_ik : f32 , @ location ( 2 ) @ interpolate ( flat ) O_il : f32 , @ location ( 3 ) O_im : vec2 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_ek : f32 , @ location ( 5 ) @ interpolate ( flat ) O_go : f32 , @ location ( 6 ) O_ci : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_ef : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_bx : f32 , ) -> @ location ( 0 ) vec4 < f32 > { var O_bv : f32 = 1 ; let O_i = O_bd . O_i ; let O_is = O_go / O_ek ; let O_iz = atan ( O_is ) ; let O_en = vec2f ( 1.0 , 0 ) ; var O_ja = 1.0 ; if ( dot ( O_en , O_ci - O_ef ) < 0 ) { O_ja = - 1.0 ; } var O_jb = normalize ( vec2f ( O_ja , O_is ) ) ; if ( O_ck ( O_ci - O_ef , O_en ) > 0 ) { O_jb = normalize ( vec2f ( O_ja , - O_is ) ) ; } let O_ie = O_ci - O_ef ; var O_hj = 0.5 * O_i ; if ( O_bd . O_ar == 1 ) { O_hj = 1.5 * O_i ; } let O_eh = sqrt ( 1.0 / 2.0 ) * O_i ; let distance : f32 = abs ( dot ( O_ie , vec2 ( O_jb . y , - O_jb . x ) ) ) - O_hj ; let O_jc = abs ( dot ( O_ie , O_jb ) ) ; if ( distance <= - O_eh ) { O_bv = 1 ; } else { let O_hm : f32 = MATH_PI * O_eh * O_eh ; let O_hn : f32 = 0 ; let O_gc = acos ( abs ( distance ) / O_eh ) ; let O_hv = abs ( O_gc * O_eh * O_eh ) ; let O_hw = sqrt ( O_eh * O_eh - distance * distance ) ; let O_hs = O_hw * abs ( distance ) ; var O_ht = O_hv - O_hs ; if ( distance < 0 ) { O_ht = O_hm - O_ht ; } O_bv = smoothstep ( O_hn , O_hm * ANTIALIAS_RATIO , O_ht ) ; } if ( O_bd . O_ar == 1 ) { if ( O_jc >= ( O_ek ) / cos ( O_iz ) - O_eh ) { discard ; } } else { let O_cq = abs ( dot ( O_en , O_ci - O_ef ) ) ; let O_jd = dot ( O_en , O_ci - O_ef ) ; if ( O_cq >= O_ek - O_i ) { O_bv = 1 ; } let O_ix = O_im . x ; let O_iy = 1 - O_im . y ; if ( O_bv == 0 && ( O_ix > 1 || O_ix < 0 || O_iy > 1 || O_iy < 0 ) ) { discard ; } var O_by : f32 = 0 ; if ( O_jd < 0 ) { O_by = O_bj [ u32 ( O_ik ) ] ; } else if ( O_jd > 0 ) { O_by = O_bj [ u32 ( O_il ) ] ; } let O_dn = clamp ( O_ix , 0 , 1 ) ; let O_do = clamp ( O_iy , 0 , 1 ) ; let O_df = O_by * SDF_WIDTH * SDF_HEIGHT ; let O_cw = SDF_WIDTH ; let O_cx = SDF_HEIGHT ; let O_je : f32 = O_cu ( vec2 ( O_dn , O_do ) , O_cw , O_cx , O_df ) ; let O_jf = fwidth ( O_je ) * 0.7 ; let O_jg = smoothstep ( 0.5 - O_jf , 0.5 + O_jf , O_je ) ; if ( O_bv == 0 ) { O_bv = O_jg ; } } return O_bu ( O_p , O_bv , 0 , O_bx ) ; } struct O_jh { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_im : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_ji : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 4 ) O_ci : vec2 < f32 > , } fn O_jj ( O_ee : u32 , O_e : vec2 < f32 > , O_k : f32 , O_l : f32 , O_gc : f32 , O_jk : f32 , O_ji : f32 , O_io : f32 , O_ip : f32 , O_jl : f32 , O_jm : f32 , O_jn : f32 , O_jo : bool , O_jp : f32 , ) -> O_jh { var O_ez : O_jh ; if ( O_jo && O_jp < O_bc . O_i ) { return O_ez ; } let O_ek = O_k / 2 ; let O_go = O_l / 2 ; O_ez . O_ji = O_ji ; var O_ci : vec2 < f32 > ; if ( O_jl == 0 ) { if ( O_ee == 0 || O_ee == 5 ) { O_ci = vec2 ( - O_ek , - O_go ) ; O_ez . O_im = vec2 ( 0 , 0 ) ; } else if ( O_ee == 1 ) { O_ci = vec2 ( O_ek , - O_go ) ; O_ez . O_im = vec2 ( O_jk , 0 ) ; } else if ( O_ee == 2 || O_ee == 3 ) { O_ci = vec2 ( O_ek , O_go ) ; O_ez . O_im = vec2 ( O_jk , 1 ) ; } else if ( O_ee == 4 ) { O_ci = vec2 ( - O_ek , O_go ) ; O_ez . O_im = vec2 ( 0 , 1 ) ; } } else { if ( O_ee == 0 || O_ee == 5 ) { O_ci = vec2 ( - O_ek , - O_go ) ; O_ez . O_im = vec2 ( O_jk , 0 ) ; } else if ( O_ee == 1 ) { O_ci = vec2 ( O_ek , - O_go ) ; O_ez . O_im = vec2 ( 0 , 0 ) ; } else if ( O_ee == 2 || O_ee == 3 ) { O_ci = vec2 ( O_ek , O_go ) ; O_ez . O_im = vec2 ( 0 , 1 ) ; } else if ( O_ee == 4 ) { O_ci = vec2 ( - O_ek , O_go ) ; O_ez . O_im = vec2 ( O_jk , 1 ) ; } } O_ci . x += O_k * O_jm ; O_ci . y += O_l * O_jn ; if ( O_jo ) { let O_ir = O_l / O_ip ; if ( O_ir > O_io ) { O_ci *= O_io / O_ir ; } } let cos = cos ( O_gc ) ; let sin = sin ( O_gc ) ; O_ci = mat2x2 ( cos , sin , - sin , cos ) * O_ci ; O_ci += O_e ; O_ez . O_ci = O_ci ; return O_ez ; } @ vertex fn stringVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_jh { var O_ez : O_jh ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * STRING_PT_LENGTH ; let O_e = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_k = O_be [ O_ft + 3 ] ; let O_l = O_be [ O_ft + 4 ] ; let O_gc = O_be [ O_ft + 5 ] ; let O_jk = O_be [ O_ft + 6 ] ; let O_ji = O_be [ O_ft + 7 ] ; let O_jp = O_be [ O_ft + 8 ] ; let O_io = O_be [ O_ft + 9 ] ; let O_jm = O_be [ O_ft + 13 ] ; let O_jn = O_be [ O_ft + 14 ] ; O_ez = O_jj ( O_ee , O_e , O_k , O_l , O_gc , O_jk , O_ji , O_io , O_bc . O_i , O_bc . O_j , O_jm , O_jn , true , O_jp ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci . xy , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_be [ O_ft + 11 ] ; } return O_ez ; } @ vertex fn stringTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_jh { var O_ez : O_jh ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_jq = u32 ( O_by ) >> STRING_LEVEL_BITLENGTH ; var O_ft = i32 ( O_jq ) * ( STRING_PT_LENGTH + 1 ) ; let O_e = vec2f ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_k = O_bn [ O_ft + 3 ] ; let O_l = O_bn [ O_ft + 4 ] ; let O_gc = O_bn [ O_ft + 5 ] ; let O_jk = O_bn [ O_ft + 6 ] ; let O_ji = O_bn [ O_ft + 7 ] ; let O_jp = O_bn [ O_ft + 8 ] ; let O_io = O_bn [ O_ft + 9 ] ; let O_jm = O_be [ O_ft + 13 ] ; let O_jn = O_be [ O_ft + 14 ] ; O_ez = O_jj ( O_ee , O_e , O_k , O_l , O_gc , O_jk , O_ji , O_io , O_bc . O_i , O_bc . O_j , O_jm , O_jn , true , O_jp ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 3 ] , O_be [ O_ft + 10 ] ) ; } return O_ez ; } @ fragment fn stringFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_im : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_ji : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_bx : f32 , ) -> @ location ( 0 ) vec4 < f32 > { let O_jr = CHAR_WIDTH + CHAR_HEIGHT / 8.0 ; let O_js = CHAR_HEIGHT + CHAR_HEIGHT / 4.0 ; let O_jt = u32 ( CANVAS_WIDTH / O_jr ) ; let O_by = O_bg [ u32 ( O_ji + O_im . x ) ] ; let O_ju = O_by / O_jt ; let O_jv = O_by % O_jt ; let O_jw = O_jr * f32 ( O_jv ) ; let O_jx = O_js * f32 ( O_ju ) ; let O_jy = O_jw ; let O_jz = O_jx ; let O_ka = O_jy + CHAR_WIDTH ; let O_kb = O_jz + CHAR_HEIGHT ; let O_kc = O_jy / CANVAS_WIDTH ; let O_kd = O_ka / CANVAS_WIDTH ; let O_ke = O_kb / CANVAS_HEIGHT ; let O_kf = O_jz / CANVAS_HEIGHT ; let O_ap = textureSample ( O_bh , O_bi , vec2 ( O_kc + ( O_kd - O_kc ) * ( O_im . x % 1.0 ) , O_ke + ( O_kf - O_ke ) * O_im . y ) ) ; if ( O_ap . r <= 0.1 ) { discard ; } var O_kg : vec4 < f32 > ; if ( O_bx == 1 && O_p < 0.5 ) { O_kg = O_bd . O_aw ; } else { O_kg = O_bu ( O_p , 1 , 1 , O_bx ) ; } return vec4 ( O_kg . rgb , O_kg . a * O_ap . r + 0.1 ) ; } @ vertex fn scaleStringVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_jh { var O_ez : O_jh ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * SCALE_STRING_PT_LENGTH ; let O_e = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_k = O_be [ O_ft + 3 ] ; let O_l = O_be [ O_ft + 4 ] ; let O_gc = O_be [ O_ft + 5 ] ; let O_jk = O_be [ O_ft + 6 ] ; let O_ji = O_be [ O_ft + 7 ] ; let O_jp = O_be [ O_ft + 8 ] ; let O_io = O_be [ O_ft + 9 ] ; let O_jm = O_be [ O_ft + 13 ] ; let O_jn = O_be [ O_ft + 14 ] ; O_ez = O_jj ( O_ee , O_e , O_k , O_l , O_gc , O_jk , O_ji , O_io , O_bc . O_i , O_bc . O_j , O_jm , O_jn , false , 0 ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci . xy , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 11 ] , O_be [ O_ft + 8 ] ) ; } return O_ez ; } struct O_kh { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_ki : f32 , @ location ( 1 ) O_ci : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_bx : f32 , } fn O_kj ( O_ee : u32 , O_ki : f32 , ) -> O_kh { var O_ez : O_kh ; O_ez . O_ki = O_ki ; let O_gl = sqrt ( 3.0 ) ; if ( O_ee == 0 ) { O_ez . O_ci = vec2 ( - O_gl , - 1 ) ; } else if ( O_ee == 1 ) { O_ez . O_ci = vec2 ( O_gl , - 1 ) ; } else { O_ez . O_ci = vec2 ( 0 , 2 ) ; } return O_ez ; } @ vertex fn pointVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kh { var O_ez : O_kh ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * POINT_PT_LENGTH ; let O_ef = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_ki = O_be [ O_ft + 3 ] ; let size = O_be [ O_ft + 4 ] ; let O_eh = size * O_bc . O_i / 4 * O_ki * select ( 0.5 , 1 , O_ki == 1 ) ; O_ez = O_kj ( O_ee , O_ki ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ef + O_ez . O_ci * O_eh , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 6 ] , O_be [ O_ft + 7 ] ) ; } return O_ez ; } @ fragment fn pointFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_ki : f32 , @ location ( 1 ) O_ci : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_bx : f32 , ) -> @ location ( 0 ) vec4 < f32 > { if ( O_ki < 1.25 && dot ( O_ci , O_ci ) > 1 ) { discard ; } return O_bu ( O_p , 1 , 0 , O_bx ) ; } struct O_kk { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_kl : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_km : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_kn : vec2 < f32 > , @ location ( 4 ) O_ci : vec2 < f32 > , } fn O_ko ( id : i32 , O_p : f32 , O_ee : u32 , O_kl : vec2 < f32 > , O_km : vec2 < f32 > , O_kn : vec2 < f32 > , ) -> O_kk { var O_ez : O_kk ; if ( O_bq ( id , O_p ) == 0 || ! O_fj ( O_p , 0 ) ) { return O_ez ; } var O_ci : vec2 < f32 > ; if ( O_ee == 0 ) { O_ci = O_kl ; } else if ( O_ee == 1 ) { O_ci = O_km ; } else { O_ci = O_kn ; } O_ez . O_kl = O_kl ; O_ez . O_km = O_km ; O_ez . O_kn = O_kn ; O_ez . O_ci = O_ci ; return O_ez ; } @ vertex fn triangleVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kk { var O_ez : O_kk ; let O_ft = id * TRIANGLE_PT_LENGTH ; var O_cb = f32 ( O_p ) ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_be [ O_ft + 8 ] , O_be [ O_ft + 9 ] ) ; } var O_kl : vec2 < f32 > = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; var O_km : vec2 < f32 > = vec2 ( O_be [ O_ft + 3 ] , O_be [ O_ft + 4 ] ) ; var O_kn : vec2 < f32 > = vec2 ( O_be [ O_ft + 5 ] , O_be [ O_ft + 6 ] ) ; O_ez = O_ko ( id , O_cb , O_ee , O_kl , O_km , O_kn ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; return O_ez ; } @ vertex fn triangleTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kk { var O_ez : O_kk ; var O_cb = f32 ( O_p ) ; let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_be [ O_fv + 3 ] , O_be [ O_fv + 4 ] ) ; } let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( O_by ) * ( TRIANGLE_PT_LENGTH + 1 ) ; let O_kl : vec2 < f32 > = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_km : vec2 < f32 > = vec2 ( O_bn [ O_ft + 3 ] , O_bn [ O_ft + 4 ] ) ; let O_kn : vec2 < f32 > = vec2 ( O_bn [ O_ft + 5 ] , O_bn [ O_ft + 6 ] ) ; O_ez = O_ko ( id , O_cb , O_ee , O_kl , O_km , O_kn ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; return O_ez ; } @ fragment fn triangleFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_kl : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_km : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_kn : vec2 < f32 > , @ location ( 4 ) O_ci : vec2 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { return O_bd . O_ap ; } @ vertex fn staticTriangleVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kk { var O_ez : O_kk ; let O_ft = id * STATIC_TRIANGLE_PT_LENGTH ; let O_cj = O_bf [ u32 ( O_be [ O_ft + 7 ] ) ] ; var O_cb = f32 ( O_p ) ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_cj . O_p , O_cj . O_q ) ; } let O_kl = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_km = vec2 ( O_be [ O_ft + 3 ] , O_be [ O_ft + 4 ] ) ; let O_kn = vec2 ( O_be [ O_ft + 5 ] , O_be [ O_ft + 6 ] ) ; O_ez = O_ko ( id , O_cb , O_ee , O_kl , O_km , O_kn ) ; let O_fw = O_cj . O_n * vec3 ( O_ez . O_ci , 1 ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; return O_ez ; } @ vertex fn staticTriangleTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kk { var O_ez : O_kk ; let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; var O_cb = f32 ( O_p ) ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_be [ O_fv + 3 ] , O_be [ O_fv + 4 ] ) ; } let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( id ) * STATIC_TRIANGLE_PT_LENGTH ; let O_kl = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_km = vec2 ( O_bn [ O_ft + 3 ] , O_bn [ O_ft + 4 ] ) ; let O_kn = vec2 ( O_bn [ O_ft + 5 ] , O_bn [ O_ft + 6 ] ) ; O_ez = O_ko ( id , O_cb , O_ee , O_kl , O_km , O_kn ) ; let O_cj = O_bf [ u32 ( O_bn [ O_ft + 7 ] ) ] ; var O_ci = O_cj . O_n * vec3 ( O_ez . O_ci , 1 ) ; O_ci = O_cg ( O_ch , O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ci , 0 , 1 ) ; return O_ez ; } struct O_kp { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) r : f32 , @ location ( 1 ) @ interpolate ( flat ) O_ef : vec2 < f32 > , @ location ( 2 ) O_ci : vec2 < f32 > , } fn O_kq ( id : i32 , O_p : f32 , O_ee : u32 , O_ef : vec2 < f32 > , O_eh : f32 , O_ei : f32 , O_ej : f32 , O_et : vec2 < f32 > , O_eu : vec2 < f32 > , ) -> O_kp { var O_ez : O_kp ; if ( O_bq ( id , O_p ) == 0 || ! O_fj ( O_p , 0 ) ) { return O_ez ; } O_ez . O_ci = O_es ( O_ee , O_ef , O_eh , O_ei , O_ej , O_et , O_eu ) ; O_ez . O_ef = O_ef ; O_ez . r = O_eh ; return O_ez ; } @ vertex fn cutedCircleVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kp { var O_ez : O_kp ; let O_ft = id * CUTED_CIRCLE_PT_LENGTH ; var O_cb = f32 ( O_p ) ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_be [ O_ft + 11 ] , O_be [ O_ft + 12 ] ) ; } let O_ef = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eh = O_be [ O_ft + 3 ] ; let O_ei = O_be [ O_ft + 4 ] ; let O_ej = O_be [ O_ft + 5 ] ; let O_et = vec2f ( O_be [ O_ft + 6 ] , O_be [ O_ft + 7 ] ) ; let O_eu = vec2f ( O_be [ O_ft + 8 ] , O_be [ O_ft + 9 ] ) ; O_ez = O_kq ( id , O_cb , O_ee , O_ef , O_eh , O_ei , O_ej , O_et , O_eu ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; return O_ez ; } @ vertex fn cutedCircleTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kp { var O_ez : O_kp ; var O_cb = f32 ( O_p ) ; let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_be [ O_fv + 3 ] , O_be [ O_fv + 4 ] ) ; } let O_by = O_be [ O_fv + 1 ] ; let O_ft = i32 ( O_by ) * ( CUTED_CIRCLE_PT_LENGTH + 1 ) ; let O_ch = O_be [ O_fv + 2 ] ; let O_ef = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_eh = O_bn [ O_ft + 3 ] ; let O_ei = O_bn [ O_ft + 4 ] ; let O_ej = O_bn [ O_ft + 5 ] ; let O_et = vec2f ( O_bn [ O_ft + 6 ] , O_bn [ O_ft + 7 ] ) ; let O_eu = vec2f ( O_bn [ O_ft + 8 ] , O_bn [ O_ft + 9 ] ) ; O_ez = O_kq ( id , O_cb , O_ee , O_ef , O_eh , O_ei , O_ej , O_et , O_eu ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; return O_ez ; } @ fragment fn cutedCircleFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_eh : f32 , @ location ( 1 ) @ interpolate ( flat ) O_ef : vec2 < f32 > , @ location ( 2 ) O_ci : vec2 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { if ( length ( O_ci - O_ef ) > O_eh ) { discard ; } return O_bd . O_ap ; } @ vertex fn staticCutedCircleVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kp { var O_ez : O_kp ; let O_ft = id * STATIC_CUTED_CIRCLE_PT_LENGTH ; let O_cj = O_bf [ u32 ( O_be [ O_ft + 10 ] ) ] ; var O_cb = f32 ( O_p ) ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_cj . O_p , O_cj . O_q ) ; } let O_ef = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eh = O_be [ O_ft + 3 ] ; let O_ei = O_be [ O_ft + 4 ] ; let O_ej = O_be [ O_ft + 5 ] ; let O_et = vec2f ( O_be [ O_ft + 6 ] , O_be [ O_ft + 7 ] ) ; let O_eu = vec2f ( O_be [ O_ft + 8 ] , O_be [ O_ft + 9 ] ) ; O_ez = O_kq ( id , O_cb , O_ee , O_ef , O_eh , O_ei , O_ej , O_et , O_eu ) ; let O_ci = O_cj . O_n * vec3 ( O_ez . O_ci , 1 ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ci , 0 , 1 ) ; return O_ez ; } @ vertex fn staticCutedCircleTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kp { var O_ez : O_kp ; let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; var O_cb = f32 ( O_p ) ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_be [ O_fv + 3 ] , O_be [ O_fv + 4 ] ) ; } let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( id ) * STATIC_CUTED_CIRCLE_PT_LENGTH ; let O_cj = O_bf [ u32 ( O_bn [ O_ft + 10 ] ) ] ; let O_ef = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_eh = O_bn [ O_ft + 3 ] ; let O_ei = O_bn [ O_ft + 4 ] ; let O_ej = O_bn [ O_ft + 5 ] ; let O_et = vec2f ( O_bn [ O_ft + 6 ] , O_bn [ O_ft + 7 ] ) ; let O_eu = vec2f ( O_bn [ O_ft + 8 ] , O_bn [ O_ft + 9 ] ) ; O_ez = O_kq ( id , O_cb , O_ee , O_ef , O_eh , O_ei , O_ej , O_et , O_eu ) ; var O_fw = O_cj . O_n * vec3 ( O_ez . O_ci , 1 ) ; O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; return O_ez ; } struct O_kr { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_p : f32 , @ location ( 2 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 3 ) @ interpolate ( flat ) O_ci : vec2 < f32 > , } fn O_ks ( O_ee : u32 , O_e : vec2 < f32 > , O_gc : f32 , O_q : f32 , O_ey : f32 , O_jo : bool , ) -> O_kr { var O_ez : O_kr ; let O_af = max ( O_bd . O_bb . O_af , O_ey ) ; let O_ag = max ( O_bd . O_bb . O_ag , O_ey ) ; let O_ah = max ( O_bd . O_bb . O_ah , O_ey ) ; let O_ai = max ( O_bd . O_bb . O_ai , O_ey ) ; let O_aj = O_bd . O_bb . O_aj ; O_ez . O_p = O_bd . O_bb . O_p ; var O_ci : vec2 < f32 > ; if ( O_ee == 0 ) { O_ci = vec2f ( 0 , 0 ) ; } else if ( O_ee == 1 ) { O_ci = vec2f ( O_af , - O_ag / 2 ) ; } else if ( O_ee == 2 ) { O_ci = vec2f ( O_af , O_ag / 2 ) ; } else if ( O_ee == 3 || O_ee == 8 ) { O_ci = vec2f ( O_af , O_ai / 2 ) ; } else if ( O_ee == 4 ) { O_ci = vec2f ( O_af + O_ah , O_ai / 2 ) ; } else if ( O_ee == 5 || O_ee == 6 ) { O_ci = vec2f ( O_af + O_ah , - O_ai / 2 ) ; } else if ( O_ee == 7 ) { O_ci = vec2f ( O_af , - O_ai / 2 ) ; } if ( O_jo ) { let O_ir = O_ag / O_bc . O_i ; if ( O_ir > O_aj ) { O_ci *= O_aj / O_ir ; } let O_go = O_ey / 2 ; if ( O_ee == 3 || O_ee == 8 || O_ee == 4 ) { O_ci . y = O_go ; } else if ( O_ee == 5 || O_ee == 6 || O_ee == 7 ) { O_ci . y = - O_go ; } } let cos = cos ( O_gc ) ; let sin = sin ( O_gc ) ; O_ci = mat2x2 ( cos , sin , - sin , cos ) * O_ci ; O_ci += O_e ; O_ez . O_ci = O_ci ; return O_ez ; } @ vertex fn scaleArrowVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kr { var O_ez : O_kr ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * SCALE_ARROW_PT_LENGTH ; let O_e = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_gc = O_be [ O_ft + 3 ] ; let O_q = O_be [ O_ft + 5 ] ; let O_ey = O_bd . O_i * MIN_PX_LENGTH_RATIO ; O_ez = O_ks ( O_ee , O_e , O_gc , O_q , O_ey , false ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci . xy , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_bd . O_bb . O_p , O_be [ O_ft + 5 ] ) ; } return O_ez ; } @ fragment fn scaleArrowFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_p : f32 , @ location ( 2 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 3 ) @ interpolate ( flat ) O_ci : vec2 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { return O_bu ( O_p , 1 , 1 , O_bx ) ; } @ vertex fn fixedArrowVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kr { var O_ez : O_kr ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * FIXED_ARROW_PT_LENGTH ; let O_e = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_gc = O_be [ O_ft + 3 ] ; let O_q = O_be [ O_ft + 5 ] ; let O_ey = O_bd . O_i * MIN_PX_LENGTH_RATIO ; O_ez = O_ks ( O_ee , O_e , O_gc , O_q , O_ey , true ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci . xy , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_bd . O_bb . O_p , O_be [ O_ft + 5 ] ) ; } return O_ez ; } ",cRe=44,hRe=20,est=[0,1,2,15,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,66,67,68],uRe={circleVert:["CIRCLE_PT_LENGTH","MIN_PX_LENGTH_RATIO"],circleFrag:[],arcVert:["ARC_PT_LENGTH","MIN_PX_LENGTH_RATIO"],arcFrag:["MATH_PI"],ellipseVert:["ELLIPSE_PT_LENGTH"],ellipseFrag:[],triangleVert:["TRIANGLE_PT_LENGTH"],rectVert:["RECT_PT_LENGTH","MIN_PX_LENGTH_RATIO"],noBodyRectVert:["RECT_PT_LENGTH","MIN_PX_LENGTH_RATIO"],pointVert:["POINT_PT_LENGTH"],rectFrag:["MATH_PI","ANTIALIAS_RATIO"],lineVert:["LINE_PT_LENGTH","MIN_PX_LENGTH_RATIO"],lineFrag:["MATH_PI","ANTIALIAS_RATIO"],cutedCircleVert:["CUTED_CIRCLE_PT_LENGTH"],lineSegmentVert:["LINESEGMENT_PT_LENGTH"],lineSegmentFrag:["MATH_PI","ANTIALIAS_RATIO"],semicircleVert:["SEMICIRCLE_PT_LENGTH"],semicircleFrag:[],staticTriangleVert:["STATIC_TRIANGLE_PT_LENGTH"],staticCutedCircleVert:["STATIC_CUTED_CIRCLE_PT_LENGTH"],drcVert:["DRC_PT_LENGTH","MATH_PI","SDF_HEIGHT","SDF_WIDTH"],drcFrag:["ANTIALIAS_RATIO","MATH_PI","SDF_HEIGHT","SDF_WIDTH"],stringVert:["STRING_PT_LENGTH"],scaleStringVert:["SCALE_STRING_PT_LENGTH"],stringFrag:["CHAR_HEIGHT","CANVAS_HEIGHT","CHAR_WIDTH","CANVAS_WIDTH"],circleTemplateInstanceVert:["CIRCLE_PT_LENGTH","MIN_PX_LENGTH_RATIO","TEMPLATE_INSTANCE_PT_LENGTH"],triangleTemplateInstanceVert:["TRIANGLE_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH"],stringTemplateInstanceVert:["STRING_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH","STRING_LEVEL_BITLENGTH"],arcTemplateInstanceVert:["ARC_PT_LENGTH","MIN_PX_LENGTH_RATIO","TEMPLATE_INSTANCE_PT_LENGTH"],rectTemplateInstanceVert:["RECT_PT_LENGTH","MIN_PX_LENGTH_RATIO","TEMPLATE_INSTANCE_PT_LENGTH"],lineSegmentTemplateInstanceVert:["LINESEGMENT_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH"],semicircleTemplateInstanceVert:["SEMICIRCLE_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH"],lineTemplateInstanceVert:["LINE_PT_LENGTH","MIN_PX_LENGTH_RATIO","TEMPLATE_INSTANCE_PT_LENGTH"],cutedCircleTemplateInstanceVert:["CUTED_CIRCLE_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH"],staticTriangleTemplateInstanceVert:["STATIC_TRIANGLE_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH"],staticCutedCircleTemplateInstanceVert:["STATIC_CUTED_CIRCLE_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH"],scaleArrowVert:["SCALE_ARROW_PT_LENGTH","MIN_PX_LENGTH_RATIO"],fixedArrowVert:["FIXED_ARROW_PT_LENGTH","MIN_PX_LENGTH_RATIO"]},dRe=[18,11,12,13,14,31,32,33,34,46,47,48,49,16,17,20],tst=class{constructor(o){this.scene=o;let t=o.gpu;this.gpu=t;let e=t.device;this.allConstants={CIRCLE_PT_LENGTH:Ur.getPtLengthByType(0),ARC_PT_LENGTH:Ur.getPtLengthByType(1),ELLIPSE_PT_LENGTH:Ur.getPtLengthByType(16),TRIANGLE_PT_LENGTH:Ur.getPtLengthByType(6),RECT_PT_LENGTH:Ur.getPtLengthByType(2),LINE_PT_LENGTH:Ur.getPtLengthByType(15),CUTED_CIRCLE_PT_LENGTH:Ur.getPtLengthByType(7),LINESEGMENT_PT_LENGTH:Ur.getPtLengthByType(3),SEMICIRCLE_PT_LENGTH:Ur.getPtLengthByType(4),STATIC_TRIANGLE_PT_LENGTH:Ur.getPtLengthByType(8),STATIC_CUTED_CIRCLE_PT_LENGTH:Ur.getPtLengthByType(9),DRC_PT_LENGTH:Ur.getPtLengthByType(19),STRING_PT_LENGTH:Ur.getPtLengthByType(10),SCALE_STRING_PT_LENGTH:Ur.getPtLengthByType(66),POINT_PT_LENGTH:Ur.getPtLengthByType(5),MATH_PI:Math.PI,ANTIALIAS_RATIO:hwe,CHAR_WIDTH:108,CHAR_HEIGHT:200,CANVAS_WIDTH:4e3,CANVAS_HEIGHT:4e3,MIN_PX_LENGTH_RATIO:Xbe,SDF_HEIGHT:xL,SDF_WIDTH:Av,RENDER_HIGHLIGHT_TYPE_SHIFT:ek,TEMPLATE_INSTANCE_PT_LENGTH:Ur.getPtLengthByType(21),STRING_LEVEL_BITLENGTH:pS,SCALE_ARROW_PT_LENGTH:Ur.getPtLengthByType(67),FIXED_ARROW_PT_LENGTH:Ur.getPtLengthByType(68),GROUP_DATA_LENGTH:TI,PTGROUP_VISIBLE_SHIFT:rQ,PTGROUP_DOUBLERGB_SHIFT:oQ,PTGROUP_HIGH_LIGHT_SHIFT:iQ,PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT:nQ,PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT:tQ},this.uniformsBuf=t.createDynamicBuffer(cRe,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"uniformsBuf of RenderHighLightPtProgram"),this.drawFullUniformsBuf=t.createDynamicBuffer(hRe,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"bboxIndexBuf of RenderHighLightPtProgram"),this.desc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"},label:"desc of RenderHighLightPtProgram"},this.clearStencilDesc={colorAttachments:[],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"clear",stencilStoreOp:"store",stencilClearValue:64},label:"clearStencilDesc of RenderHighLightPtProgram"},this.layout=e.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:1,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:2,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:3,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:5,visibility:GPUShaderStage.FRAGMENT,texture:{}},{binding:6,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:7,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:8,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:9,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:10,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:11,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:12,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}}]});let r=e.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:1,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}}]}),i=t.createShaderModule(Qot),n=t.createShaderModule(Jot);this.fullScreenBindGroup=this.gpu.createDynamicBindGroup(r,0,this.drawFullUniformsBuf,1,this.scene.colorsBuf);let s=e.createPipelineLayout({bindGroupLayouts:[this.layout]}),a=(l,c,h,u)=>{let d=[];return est.forEach(p=>{let m=Hs[p],g=`${m}Vert`;if(Ur.isNormalPolygonType(p)){let y=`${HJ(m,p)}Frag`;d[p]=e.createRenderPipeline({layout:s,vertex:{module:i,entryPoint:g,constants:this.getConstants(g),buffers:[{arrayStride:fs*2,attributes:[{shaderLocation:0,offset:0,format:"sint32"},{shaderLocation:1,offset:fs,format:"sint32"}],stepMode:"instance"}]},fragment:{module:i,entryPoint:y,constants:this.getConstants(y),targets:[{format:za,writeMask:0}]},primitive:{topology:"triangle-list"},depthStencil:{format:v2,depthCompare:"always",depthWriteEnabled:!1,stencilReadMask:u,stencilFront:{compare:"not-equal",passOp:"increment-wrap"},stencilBack:{compare:"not-equal",passOp:"decrement-wrap"}},label:`renderHighLightPt ${p} pipeline`})}else{if(dRe.includes(p))return;{let y=`${HJ(m,p)}Frag`;d[p]=e.createRenderPipeline({layout:s,vertex:{module:i,entryPoint:g,constants:this.getConstants(g),buffers:[{arrayStride:2*fs,attributes:[{shaderLocation:0,offset:0,format:"sint32"},{shaderLocation:1,offset:fs,format:"sint32"}],stepMode:"instance"}]},fragment:{module:i,entryPoint:y,constants:this.getConstants(y),targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}},writeMask:l?15:0}]},primitive:{topology:"triangle-list"},depthStencil:{format:v2,depthCompare:"always",depthWriteEnabled:!1,stencilReadMask:c,stencilFront:h,stencilBack:h},label:`renderHighLightPt ${p} pipeline`})}}}),d};this.renderPipelines=a(!0,255,{compare:"always"},127),this.drawFullScreenPipeline=e.createRenderPipeline({layout:e.createPipelineLayout({bindGroupLayouts:[r]}),vertex:{module:n,entryPoint:"fullVert"},fragment:{module:n,entryPoint:"fullFrag",constants:{RENDER_HIGHLIGHT_TYPE_SHIFT:ek},targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"},depthStencil:{format:v2,depthCompare:"always",depthWriteEnabled:!1,stencilReadMask:63,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}}),this.noBodyRectPipeline=e.createRenderPipeline({layout:s,vertex:{module:i,entryPoint:"noBodyRectVert",constants:this.getConstants("noBodyRectVert")},fragment:{module:i,entryPoint:"rectFrag",constants:this.getConstants("rectFrag"),targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}},writeMask:15}]},primitive:{topology:"triangle-list"},depthStencil:{format:v2,depthCompare:"always",depthWriteEnabled:!1,stencilReadMask:255,stencilFront:{compare:"always"},stencilBack:{compare:"always"}}})}getConstants(o){let t={};return["triangleFrag","cutedCircleFrag","noBodyRectVert"].includes(o)||(t.RENDER_HIGHLIGHT_TYPE_SHIFT=this.allConstants.RENDER_HIGHLIGHT_TYPE_SHIFT),t.GROUP_DATA_LENGTH=this.allConstants.GROUP_DATA_LENGTH,o.indexOf("Vert")&&(t.PTGROUP_VISIBLE_SHIFT=this.allConstants.PTGROUP_VISIBLE_SHIFT,t.PTGROUP_DOUBLERGB_SHIFT=this.allConstants.PTGROUP_DOUBLERGB_SHIFT,t.PTGROUP_HIGH_LIGHT_SHIFT=this.allConstants.PTGROUP_HIGH_LIGHT_SHIFT,t.PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT=this.allConstants.PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT,t.PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT=this.allConstants.PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT),uRe[o]&&uRe[o].forEach(e=>{t[e]=this.allConstants[e]}),t}createDynamicBindGroup(o,t){return this.gpu.createDynamicBindGroup(this.layout,0,this.scene.cameraBuf,1,this.uniformsBuf,2,o,3,this.scene.staticPolygonInfoBuilder.updateBuf(),4,this.scene.stringInfoBuilder.updateBuf(),5,this.scene.char.texture,6,this.gpu.linearSampler,7,this.scene.sdfStringLibrary.stringInfoBuilder.updateBuf(),8,this.scene.sdfStringLibrary.getSdfBuffer(),9,this.scene.colorsBuf,10,this.scene.ptTemplate.getTemplateInstanceData().updateBuf(),11,t,12,this.scene.ptGroup.getData().updateBuf())}afterDraw(o,t,e,r,i){let n=new Float32Array(hRe);n.set(this.scene.highLightColor[t].getData()),n[4]=e,n[5]=r,n[6]=i.isColorful?1:0,n[7]=i.scene.getForceVisibleHighLightPt()?1:0;let s=i.getColor(),a=i.getOriginalColor();n.set([s.r,s.g,s.b,s.alpha*i.polygonColorAlphaRatio],8),n.set([a.r,a.g,a.b,a.alpha*i.polygonColorAlphaRatio],12),this.scene.addData(new Uint32Array(n.buffer),this.drawFullUniformsBuf),t==0?this.desc.colorAttachments[0].view=o.highLightColorTexture0.view:this.desc.colorAttachments[0].view=o.highLightColorTexture1.view,this.desc.depthStencilAttachment.view=o.depthStencilTexture.view;let l=this.scene.commandEncoder.beginRenderPass(this.desc);l.setStencilReference(64),l.setPipeline(this.drawFullScreenPipeline),l.setBindGroup(0,this.fullScreenBindGroup.getBindGroup()),l.draw(6),l.end()}getRenderHighLightTypeByColorIndex(o){return o&ek}render(o,t,e,r){Ur.isNormalPolygonType(o)?this.draw0(o,e,0,t,r):this.draw0(o,e,64,t,r)}getPolygonRenderColors(o,t){let e=[t],r=o.polygonColorAndGroupIdMap.get(t);if(!r&&r!==0)return e;let i=this.scene.ptGroup.getData();if(Array.isArray(r))for(let n=0;n<r.length;n+=1){let s=r[n],a=_h.getColorIndex(s,i);e.includes(a)||e.push(a)}else{let n=_h.getColorIndex(r,i);e.includes(n)||e.push(n)}return e}renderNoBodyRect(o,t){let e=this.scene.commandEncoder.beginRenderPass(this.desc);e.setPipeline(this.noBodyRectPipeline),e.setBindGroup(0,o.getBindGroup()),e.setStencilReference(64),e.draw(6,t),e.end(),this.scene.renderPtNum+=t,this.scene.renderPtTypeNum[2]+=t,this.scene.renderVertexNum+=t*6,this.scene.drawTimes++}draw0(o,t,e,r,i){let n=o;Ur.isCustomTemplateInstanceType(o)&&(o=Ur.getTemplateTypeByCustomInstanceType(o));let s=this.scene.commandEncoder.beginRenderPass(this.desc),a=this.renderPipelines;if(!a[o])throw new Error(`pipelines type error${o}`);s.setPipeline(a[o]),s.setBindGroup(0,r.getBindGroup()),s.setStencilReference(e);let l=i.getMemory();s.setVertexBuffer(0,l.getBuffer(),l.getOffset(),l.getSize());let c=UJ(o);s.draw(c,t),s.end(),this.scene.renderPtNum+=t,this.scene.renderPtTypeNum[n]+=t,this.scene.renderVertexNum+=t*c,this.scene.drawTimes++}draw(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.scene.renderPtNum,p=()=>{i==0?this.desc.colorAttachments[0].view=o.highLightColorTexture0.view:this.desc.colorAttachments[0].view=o.highLightColorTexture1.view,this.desc.depthStencilAttachment.view=o.depthStencilTexture.view,this.clearStencilDesc.depthStencilAttachment.view=o.depthStencilTexture.view,this.scene.char.flush(),this.scene.sdfStringLibrary.stringInfoBuilder.updateBuf(),this.scene.ptGroup.getData().updateBuf(),d=this.scene.renderPtNum,this.scene.addData(y,this.uniformsBuf)},m=e.getPxLength(t,Ae.ORIGIN),g=uwe(m,this.scene.getFixedPtData()),y=new Uint32Array(cRe),b=new Float32Array(y.buffer);b.set(this.scene.highLightColor[i].getData()),b[4]=m,y[5]=n;let P=this.scene.drcRenderModel===0;b[6]=P?1:0,b[7]=this.scene.drcRenderStyle===0?1:0,y[8]=0,b[9]=e.isColorful?1:0,b[10]=e.isVisible()?1:0,b[11]=e.scene.getForceVisibleHighLightPt()?1:0,b.set(e.networkTextColor.getData(),12),b.set(e.getColor().getData(),16),b.set(e.getOriginalColor().getData(),20),b[24]=e.ignoreForceHighLightEffect?1:0;let T=this.scene.getFixedPtData();if(b[28]=T[0],b[29]=T[1],b[30]=T[2],b[31]=T[3],b[32]=T[4],b[33]=T[5],b[34]=T[6],p(),e.isHighLight)for(let I of r){let C=I.getBuilders();for(let E=0;E<C.length;E++){if(!C[E])continue;if(E!==2)throw new Error("Highlight Plane data is incorrect");let O=I.getMaxLength(2);if(!O)continue;let _=I.getHighLightBindGroup0(E);this.renderNoBodyRect(_,O)}}else{let I={};r.forEach(E=>{let O=E.getPolygonHighLightIds(i);if(!O)return;let _={};E.getPolygonBuilders().forEach((R,v)=>{R.forEach((D,w)=>{_[v]||(_[v]={}),_[v][w]||(_[v][w]={}),_[v][w]={builder:D,bindGroup:E.getPolygonHighLightBindGroup(v,w,u)}})}),O.forEach((R,v)=>{R.forEach((D,w)=>{let F=this.getRenderHighLightTypeByColorIndex(w),H=w;D.forEach((z,G)=>{F&&(H=v),I[F]||(I[F]={}),I[F][H]||(I[F][H]={}),I[F][H][G]||(I[F][H][G]=[]),I[F][H][G].push({builder:_[v][G].builder,bindGroup:_[v][G].bindGroup,highLightIds:z})})})})});let C=0;if(c){for(let E of Object.keys(I))for(let O of Object.keys(I[E])){C++;let _=I[E][O],R=this.getPolygonRenderColors(e,Number(O));for(let v=0;v<R.length;v++){v!==0&&this.scene.commandEncoder.beginRenderPass(this.clearStencilDesc).end();let D=R[v];b[25]=D,this.scene.addData(y,this.uniformsBuf);for(let w of Object.keys(_)){let F=_[w];for(let H of Object.keys(F)){let z=F[H],G=z.highLightIds,W=G==null?void 0:G.getMaxLength();W&&this.render(Number(w),z.bindGroup,W,G.getData().updateBuf())}}this.afterDraw(o,i,Number(D),Number(E),e)}}for(let E of r){let O=E.getHighLightIds(i);if(O!=null&&O.length){let _=E.getBuilders();for(let R=0;R<_.length;R++){if(Ur.isNormalPolygonType(R)||!E.getMaxLength(R)||dRe.includes(R)||R==19||R===68&&!g)continue;let v=O[R],D=v==null?void 0:v.getMaxLength();if(!D)continue;let w=E.getHighLightBindGroup(R,u);this.render(R,w,D,v.getData().updateBuf())}}}}if(l)for(let E of r){let O=E.getHighLightIds(i,10),_=E.getHighLightIds(i,30);if(!(O!=null&&O.length)&&!(_!=null&&_.length))continue;let R,v;E.drawString(m,(D,w)=>{R=O[w];let F=R==null?void 0:R.getMaxLength();F&&(v=E.getStringHighLightBindGroup(w,D),this.render(10,v,F,R.getData().updateBuf()))}),E.drawTemplateString(m,(D,w)=>{R=_[w];let F=R==null?void 0:R.getMaxLength();F&&(v=E.getTemplateStringHighLightBindGroup(w,D,u),this.render(30,v,F,R.getData().updateBuf()))}),E.drawCustomTemplateString(m,(D,w)=>{R=_[w];let F=R==null?void 0:R.getMaxLength();F&&(v=E.getTemplateStringHighLightBindGroup(w,D,u),this.render(45,v,F,R.getData().updateBuf()))})}if(a)for(let E of r){let O=E.getHighLightIds(i);if(O!=null&&O.length){let _=O[19],R=_==null?void 0:_.getMaxLength();if(!R||!(E!=null&&E.getMaxLength(19))||P&&E.getDrcPxLength()<m)continue;let v=E.getHighLightBindGroup(19,u);this.render(19,v,R,_.getData().updateBuf())}}}}},pRe="@ group ( 0 ) @ binding ( 0 ) var O_a : texture_2d < f32 > ; struct O_b { @ builtin ( position ) O_c : vec4 < f32 > , @ location ( 0 ) O_d : vec2 < f32 > , } @ vertex fn v_main ( @ builtin ( vertex_index ) O_e : u32 , ) -> O_b { var O_f : O_b ; var O_g = array ( vec2f ( - 1.0 , - 1.0 ) , vec2f ( 1.0 , - 1.0 ) , vec2f ( - 1.0 , 1.0 ) , vec2f ( - 1.0 , 1.0 ) , vec2f ( 1.0 , - 1.0 ) , vec2f ( 1.0 , 1.0 ) , ) ; var O_h = array ( vec2f ( 0.0 , 0.0 ) , vec2f ( 1.0 , 0.0 ) , vec2f ( 0.0 , 1.0 ) , vec2f ( 0.0 , 1.0 ) , vec2f ( 1.0 , 0.0 ) , vec2f ( 1.0 , 1.0 ) , ) ; O_f . O_c = vec4f ( O_g [ O_e ] , 0.0 , 1.0 ) ; O_f . O_d = vec2f ( O_h [ O_e ] . x , 1 - O_h [ O_e ] . y ) ; return O_f ; } @ fragment fn f_main ( @ builtin ( position ) O_h : vec4 < f32 > , @ location ( 0 ) O_d : vec2 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { var O_i = textureLoad ( O_a , vec2 < i32 > ( O_h . xy ) , 0 ) ; return O_i ; } ",rst=class{constructor(o){this.scene=o;let t=o.gpu;this.gpu=t,this.device=t.device,this.pipeline=this.createPipeline(),this.renderDesc=this.createRenderDesc(),this.bindGroup0=this.createDynamicBindGroup0(),this.bindGroup1=this.createDynamicBindGroup1()}createPipeline(){return this.device.createRenderPipeline({layout:"auto",vertex:{module:this.gpu.createShaderModule(pRe),entryPoint:"v_main"},fragment:{module:this.gpu.createShaderModule(pRe),entryPoint:"f_main",targets:[{format:za,blend:{color:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}})}createRenderDesc(){return{colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}}createDynamicBindGroup0(){return this.gpu.createDynamicBindGroup(this.pipeline.getBindGroupLayout(0),0,this.scene.highLightColorTexture0)}createDynamicBindGroup1(){return this.gpu.createDynamicBindGroup(this.pipeline.getBindGroupLayout(0),0,this.scene.highLightColorTexture1)}render(o,t){this.renderDesc.colorAttachments[0].view=o;let e=this.scene.commandEncoder.beginRenderPass(this.renderDesc);e.setPipeline(this.pipeline),e.setBindGroup(0,t==0?this.bindGroup0.getBindGroup():this.bindGroup1.getBindGroup()),e.draw(6,1,0,0),e.end(),this.scene.submitCommandEncoder()}},YLe=Symbol("release"),fRe=2**32;function Tye(o,t,e,r){return`${o}-${t}-${e}-${r}`}var ist=class{constructor(o,...t){this.gpu=o,this.size=0,this.texturesIndex={};for(let e of t){let[r,i,n,s,a]=e,l=this.getOrInitTextures(r,i,n,s);for(let c=0;c<a;c++)l.push(this.createTexture(r,i,n,s))}}getOrInitTextures(o,t,e,r){let i=Tye(o,t,e,r);return this.texturesIndex[i]||(this.texturesIndex[i]=[])}createTexture(o,t,e,r){return this.size+=o*t*4,new nst(this,this.gpu.createDynamicTexture(o,t,e,r,"texturePool-"+Tye(o,t,e,r)))}getTexture(o,t,e,r){let i=this.getOrInitTextures(o,t,e,r);return i.length===0?this.createTexture(o,t,e,r):i.pop()}[YLe](o){let{width:t,height:e,format:r,usage:i}=o.texture;this.texturesIndex[Tye(t,e,r,i)].push(o)}recall(){if(this.size<=fRe)return;let o=Object.values(this.texturesIndex),t=o.pop();for(;this.size>fRe&&t;){let e=t.pop();if(e){let r=e.texture;this.size-=r.width*r.height*4,r.destroy()}else t=o.pop()}}},nst=class{constructor(o,t){this.pool=o,this.texture=t}release(){this.pool[YLe](this)}},ost="struct O_a { O_b : mat4x4 < f32 > , O_c : vec4 < f32 > , O_d : vec4 < f32 > , O_e : vec2 < f32 > , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_f : O_a ; struct O_g { @ builtin ( position ) O_h : vec4 < f32 > , @ location ( 0 ) O_e : vec4 < f32 > , @ location ( 1 ) O_i : vec4 < f32 > , } @ vertex fn vert ( @ location ( 0 ) O_e : vec2 < f32 > , ) -> O_g { var O_j : O_g ; O_j . O_h = vec4 ( O_e , 0 , 1 ) ; if ( abs ( O_e . x ) > 1.0 ) { if ( O_e . x > 0.0 ) { O_j . O_h . x = 1.0 - 18.0 * O_f . O_b [ 0 ] [ 0 ] ; } else { O_j . O_h . x = - 1.0 + 18.0 * O_f . O_b [ 0 ] [ 0 ] ; } } else if ( abs ( O_e . y ) > 1.0 ) { if ( O_e . y > 0.0 ) { O_j . O_h . y = 1.0 - 18.0 * O_f . O_b [ 1 ] [ 1 ] ; } else { O_j . O_h . y = - 1.0 + 18.0 * O_f . O_b [ 1 ] [ 1 ] ; } } O_j . O_i = vec4 ( O_j . O_h . xy , 1.0 - 18.0 * O_f . O_b [ 1 ] [ 1 ] , - 1.0 + 18.0 * O_f . O_b [ 0 ] [ 0 ] ) ; let O_k = vec4 ( O_f . O_e , 0 , 1 ) * O_f . O_b ; let O_l = O_f . O_b [ 0 ] [ 0 ] ; let O_m = O_f . O_b [ 1 ] [ 1 ] ; O_j . O_e = vec4 ( O_k . x - O_l , O_k . x + O_l , O_k . y - O_m , O_k . y + O_m ) ; return O_j ; } @ fragment fn frag ( @ builtin ( position ) O_h : vec4 < f32 > , @ location ( 0 ) O_e : vec4 < f32 > , @ location ( 1 ) O_i : vec4 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { return select ( O_f . O_c , O_f . O_d , ( O_i . x >= O_e [ 0 ] && O_i . x <= O_e [ 1 ] && O_i . y > O_i . z ) || ( O_i . y >= O_e [ 2 ] && O_i . y <= O_e [ 3 ] && O_i . x < O_i . w ) ) ; } ",sst="struct O_a { O_b : vec4 < f32 > , O_c : vec2 < f32 > , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_d : O_a ; @ vertex fn vert ( @ location ( 0 ) O_e : f32 , ) -> @ builtin ( position ) vec4 < f32 > { var O_f : vec4 < f32 > = vec4 < f32 > ( - 1.0 , 1.0 , 0.0 , 1.0 ) ; if ( O_e == 1.0 ) { O_f . y = 1.0 - 18.0 * O_d . O_c . y ; } else if ( O_e == 2.0 ) { O_f . x = - 1.0 + 18.0 * O_d . O_c . x ; O_f . y = 1.0 - 18.0 * O_d . O_c . y ; } else if ( O_e == 3.0 ) { O_f . x = - 1.0 + 18.0 * O_d . O_c . x ; } else if ( O_e == 4.0 ) { O_f . y = 1.0 - 18.0 * O_d . O_c . y ; } else if ( O_e == 5.0 ) { O_f . x = - 1.0 + 18.0 * O_d . O_c . x ; } return O_f ; } @ fragment fn frag ( ) -> @ location ( 0 ) vec4 < f32 > { return O_d . O_b ; } ",ast="struct O_a { O_b : mat4x4 < f32 > , O_c : vec4 < f32 > , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_d : O_a ; @ vertex fn vert ( @ location ( 0 ) O_e : vec3 < f32 > , ) -> @ builtin ( position ) vec4 < f32 > { var O_b = O_d . O_b ; if ( O_e . z == 1 ) { O_b [ 0 ] [ 0 ] = 1 ; O_b [ 3 ] [ 0 ] = 0 ; } else { O_b [ 1 ] [ 1 ] = 1 ; O_b [ 3 ] [ 1 ] = 0 ; } return O_b * vec4 ( O_e . xy , 0 , 1 ) ; } @ fragment fn frag ( ) -> @ location ( 0 ) vec4 < f32 > { return O_d . O_c ; } ",lst=Symbol("ruler"),cst=class{constructor(o){this.scale=1,this.ratio=5,this.spacing=2,this.centerSpace=5,this.endSpace=10,this.unit="mil",this.origin=S.ORIGIN,this.size=0,this.unitConversion=new ML,this.ratioScale=1,this.scene=o;let t=o.gpu,e=t.device;this.desc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]},this.backgroundUniformsBuf=t.createDynamicBuffer(28,GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"backgroundUniformsBuf of RulerProgram");let r=18;this.backgroundPosBuf=t.createStaticBuffer(new Uint32Array(new Float32Array([-1,-1,-r,-1,-r,1,-1,-1,-r,1,-1,1,-1,r,1,r,1,1,-1,r,1,1,-1,1]).buffer),GPUBufferUsage.VERTEX,"backgroundPosBuf of RulerProgram"),this.backgroundArrayCount=this.backgroundPosBuf.getSize()/2;let i=t.createShaderModule(ost);this.backgroundPipeline=e.createRenderPipeline({layout:"auto",vertex:{module:i,entryPoint:"vert",buffers:[{arrayStride:2*fs,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:i,entryPoint:"frag",targets:[{format:za}]},primitive:{topology:"triangle-list"}}),this.backgroundBindGroup=t.createBindGroup("ruler background",this.backgroundPipeline.getBindGroupLayout(0),0,this.backgroundUniformsBuf),this.rulerMaskUniformsBuf=t.createDynamicBuffer(8,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,"rulerMaskUniformsBuf of RulerProgram"),this.rulerMaskPosBuf=t.createStaticBuffer(new Uint32Array(new Float32Array([1,2,3,4,5,6]).buffer),GPUBufferUsage.VERTEX,"rulerMaskPosBuf of RulerProgram");let n=t.createShaderModule(sst);this.rulerMaskPipeline=e.createRenderPipeline({label:"Shadow Pipeline",layout:"auto",vertex:{module:n,entryPoint:"vert",buffers:[{arrayStride:1*fs,attributes:[{shaderLocation:0,offset:0,format:"float32"}]}]},fragment:{module:n,entryPoint:"frag",targets:[{format:za}]},primitive:{topology:"triangle-list"}}),this.rulerMaskBindGroup=t.createDynamicBindGroup(this.rulerMaskPipeline.getBindGroupLayout(0),0,this.rulerMaskUniformsBuf),this.scaleUniformsBuf=t.createDynamicBuffer(28,GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"scaleUniformsBuf of RulerProgram"),this.scalePosBuf=t.createDynamicBuffer(1,GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,"scalePosBuf of RulerProgram");let s=t.createShaderModule(ast);this.scalePipeline=e.createRenderPipeline({layout:"auto",vertex:{module:s,entryPoint:"vert",buffers:[{arrayStride:3*fs,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]}]},fragment:{module:s,entryPoint:"frag",targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"line-list"}}),this.scaleBindGroup=t.createDynamicBindGroup(this.scalePipeline.getBindGroupLayout(0),0,this.scaleUniformsBuf),this.strPlane=new iE(o,1,ee.build(0,0,0),void 0,lst,!1,!1),this.builder=$m.create(Float32Array,t,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,"ptsBuf of RulerProgram");let a=$m.create(Float32Array,t,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,"testBuf of RulerProgram");this.bindGroup=this.createDynamicBindGroup(a.updateBuf())}createDynamicBindGroup(o){return this.scene.gpu.createDynamicBindGroup(this.scene.renderPtProgram.renderPtBindGroupLayout,0,this.scene.cameraBuf,1,this.scene.renderPtProgram.uniformsBuf,4,this.scene.colorsBuf,5,this.scene.renderPtProgram.sampler,6,this.scene.char.texture,7,this.scene.staticPolygonInfoBuilder.updateBuf(),8,this.scene.stringInfoBuilder.updateBuf(),9,this.scene.ptGroup.getData().updateBuf(),10,this.scene.renderPtProgram.highLightStencilBuf,11,this.scene.sdfStringLibrary.stringInfoBuilder.updateBuf(),12,this.scene.sdfStringLibrary.getSdfBuffer(),13,this.strPlane.templatePtOffsetBuild.updateBuf(),14,this.scene.ptTemplate.getTemplateInstanceData().updateBuf(),15,o)}updateScaleData(o,t){this.deltaX=1-36/o,this.deltaY=1-36/t;let e=[],r=0,i=0,n=o/2,s=t/2,a=(1-this.deltaY)/2;for(let c=0;c<n;c+=this.spacing)r=this.fillVertical(e,c,a,r,i),i+=1;i=0;for(let c=0;c>-n;c-=this.spacing)r=this.fillVertical(e,c,a,r,i),i+=1;i=0;let l=(1-this.deltaX)/2;for(let c=0;c<s;c+=this.spacing)r=this.fillHorizontal(e,c,l,r,i),i+=1;i=0;for(let c=0;c>-s;c-=this.spacing)r=this.fillHorizontal(e,c,l,r,i),i+=1;this.scalePosBuf.setSize(e.length),this.scalePosBuf.write(0,new Float32Array(e)),this.scaleArrayCount=e.length/3}resize(o,t){o===this.width&&t===this.height||(this.width=o,this.height=t,this.updateScaleData(o,t))}getOrigin(){return this.origin}fillVertical(o,t,e,r,i){let n=i%this.centerSpace,s=i%this.endSpace;return o[r++]=t,o[r++]=this.deltaY,o[r++]=0,o[r++]=t,s==0?o[r++]=this.deltaY+e*2:n==0?o[r++]=this.deltaY+e:o[r++]=this.deltaY+e*.5,o[r++]=0,r}fillHorizontal(o,t,e,r,i){let n=i%this.centerSpace;return i%this.endSpace==0?o[r++]=-this.deltaX-e*2:n==0?o[r++]=-this.deltaX-e:o[r++]=-this.deltaX-e*.5,o[r++]=t,o[r++]=1,o[r++]=-this.deltaX,o[r++]=t,o[r++]=1,r}get spacing10(){return this.spacing*this.ratio*this.scale*10*this.ratioScale}modifyUnit(o){o!=this.unit&&(o!="mil"?this.scale=this.unitConversion.conversion(o,"mil",1)/100:this.scale=1,this.unit=o)}autoScale(o){let t=o.getViewMatrix().multiply4(Ae.scale(o.getScale(),o.getScale(),1)),e=Math.sqrt(t.data[0]*t.data[0]+t.data[1]*t.data[1]),r=0,i=e;for(;;)if(i>=1){if(i=i/10,i<1)break;r++}else if(i=i*10,r--,i>=1)break;let n=e/Math.pow(10,r);n>=1&&n<2?e=e/Math.pow(10,r):n>=2&&n<5?e=e/(2*Math.pow(10,r)):e=e/(5*Math.pow(10,r));let s=this.origin.multiply4(o.getViewMatrix().multiply4(Ae.scale(o.getScale(),o.getScale(),1))),a=this.spacing10*e,l=this.spacing10*e,c=s.x%a,h=s.y%l;return Ae.scale(e*this.ratio*this.scale,e*this.ratio*this.scale,1).translate1(c,h,0).multiply4(o.getProjectMatrix().multiply4(Ae.scale(1/o.getScale(),1/o.getScale(),1))).data}render(o,t,e,r){this.origin=this.scene.gridProgram.origin,this.desc.colorAttachments[0].view=o;let i=t.getScreenPosition();this.scene.updateCameraBuf(t,Number.NEGATIVE_INFINITY);let n=this.scene.getColorIndex(r,void 0,!0);this.updateStrings(t,n);{this.scene.addData(new Uint32Array(new Float32Array(t.getProjectMatrix().multiply4(Ae.scale(1/t.getScale(),1/t.getScale(),1)).data.concat(e.r,e.g,e.b,e.alpha,r.r,r.g,r.b,r.alpha,i.x,i.y)).buffer),this.backgroundUniformsBuf);let s=this.scene.commandEncoder.beginRenderPass(this.desc);s.setPipeline(this.backgroundPipeline),s.setBindGroup(0,this.backgroundBindGroup),s.setVertexBuffer(0,this.backgroundPosBuf.getBuffer()),s.draw(this.backgroundArrayCount),s.end()}{this.scene.addData(new Uint32Array(new Float32Array(this.autoScale(t).concat(r.r,r.g,r.b,r.alpha)).buffer),this.scaleUniformsBuf);let s=this.scene.commandEncoder.beginRenderPass(this.desc);s.setPipeline(this.scalePipeline),s.setBindGroup(0,this.scaleBindGroup.getBindGroup()),s.setVertexBuffer(0,this.scalePosBuf.getBuffer()),s.draw(this.scaleArrayCount),s.end()}this.scene.renderPtProgram.drawString(o,t,this.strPlane,this.builder,this.bindGroup);{this.scene.addData(new Uint32Array(new Float32Array([e.r,e.g,e.b,e.alpha].concat([2/t.getWidth(),2/t.getHeight()])).buffer),this.rulerMaskUniformsBuf);let s=this.scene.commandEncoder.beginRenderPass(this.desc);s.setPipeline(this.rulerMaskPipeline),s.setBindGroup(0,this.rulerMaskBindGroup.getBindGroup()),s.setVertexBuffer(0,this.rulerMaskPosBuf.getBuffer()),s.draw(6),s.end()}}updateStrings(o,t){this.builder.clear();let e=o.getScale(),r=1-18/o.getWidth(),i=1-18/o.getHeight();this.size=15/e;let n=o.getRenderMatrix().inverse(),s=new S(-1,-1).multiply4(n),a=new S(1,1).multiply4(n);this.scene.gridParam.flip&&(s=new S(1,-1).multiply4(n),a=new S(-1,1).multiply4(n)),s=s.sub(this.origin),a=a.sub(this.origin);let l=0,c=e;for(;;)if(c>=1){if(c=c/10,c<1)break;l++}else if(c=c*10,l--,c>=1)break;let h=e/Math.pow(10,l);h>=1&&h<2?e=Math.pow(10,l):h>=2&&h<5?e=2*Math.pow(10,l):e=5*Math.pow(10,l),e=e>500?500:e;let u=this.spacing10/e,d=this.unitConversion.conversion1("mil",this.unit,this.spacing10);d=d/e;let p=Math.max(Math.abs(Math.ceil(s.y/u)),Math.abs(Math.ceil(s.x/u)))*-1*d*10;p=Math.round(p*1e3)/1e3;let m=Rv.getStrInfo(p.toString(),1e10,this.size).strWidth*.9;u<m?(this.ratioScale*=2,u*=2,this.endSpace*=2,this.centerSpace*=2,this.updateScaleData(this.width,this.height)):u/2>m&&this.ratioScale>1&&(this.ratioScale/=2,this.endSpace/=2,this.centerSpace/=2,this.updateScaleData(this.width,this.height));{let g=0,y=0,b=a.x;s.x>0&&(g=Math.ceil(s.x/u),y=g*u);for(let P=y,T=g;P<b;P+=u,T++){let I=new S(P+this.origin.x,0).multiply4(o.getRenderMatrix());this.fillVerticalStrings(I.x,i,d*T*10,n,t)}}{let g=Math.ceil(s.x/u);g>0&&(g=0);let y=g*u,b=a.x;b>0&&(b=0);for(let P=y,T=g;P<b;P+=u,T++){let I=new S(P+this.origin.x,0).multiply4(o.getRenderMatrix());this.fillVerticalStrings(I.x,i,d*T*10,n,t)}}{let g=0,y=0,b=a.y;s.y>0&&(g=Math.ceil(s.y/u),y=g*u);for(let P=y,T=g;P<b;P+=u,T++){let I=new S(0,P+this.origin.y).multiply4(o.getRenderMatrix());this.fillHorizontalStrings(-r,I.y,d*T*10,n,t)}}{let g=Math.ceil(s.y/u);g>0&&(g=0);let y=g*u,b=a.y;b>0&&(b=0);for(let P=y,T=g;P<b;P+=u,T++){let I=new S(0,P+this.origin.y).multiply4(o.getRenderMatrix());this.fillHorizontalStrings(-r,I.y,d*T*10,n,t)}}}fillHorizontalStrings(o,t,e,r,i){e=Math.round(e*1e3)/1e3;let n=new S(o,t).multiply4(r);this.createString(e.toString(),n,II,5,13,1e10,this.size,i)}fillVerticalStrings(o,t,e,r,i){e=Math.round(e*1e3)/1e3;let n=new S(o,t).multiply4(r);this.createString(e.toString(),n,0,5,13,1e10,this.size,i)}createString(o,t,e,r,i,n,s,a){let l=this.scene.addStringInfo(o),{strWidth:c,strHeight:h}=Rv.getStrInfo(o,n,s),u=ck.create(0,t,c*.9,h*.9,e,o.length,l,r,i,-1,a,void 0,.5);this.builder.pushArr(u)}},hst="struct O_a { O_b : mat4x4 < f32 > , O_c : vec4 < f32 > , O_d : vec4 < f32 > , O_e : vec4 < f32 > , O_f : vec2 < f32 > , O_g : vec2 < f32 > , O_h : vec2 < f32 > , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , O_m : f32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_n : O_a ; struct O_o { @ builtin ( position ) O_p : vec4 < f32 > , @ location ( 0 ) O_q : vec4 < f32 > , @ location ( 1 ) O_r : f32 , } fn O_s ( O_t : f32 , ) -> bool { return abs ( O_t ) <= 0.0000001 ; } fn O_u ( O_v : f32 , O_w : f32 , ) -> f32 { return floor ( O_v - O_w * floor ( O_v / O_w ) ) ; } fn O_x ( O_y : f32 , O_z : f32 , ) -> bool { return O_s ( O_u ( round ( O_y / O_z ) , O_n . O_k ) ) ; } @ vertex fn vert ( @ location ( 0 ) O_aa : vec3 < f32 > , ) -> O_o { var O_ab : O_o ; var O_f = O_n . O_f ; var O_b = O_n . O_b ; var O_g = O_n . O_g ; var O_h = O_n . O_h ; var O_c = O_n . O_c ; var O_d = O_n . O_d ; var O_e = O_n . O_e ; var O_j = O_n . O_j ; var O_i = O_n . O_i ; var O_k = O_n . O_k ; var O_ac = O_aa ; var O_p = O_b * vec4 ( O_ac , 1.0 ) ; var O_ad = vec2 ( O_p . xy ) ; var O_ae = O_ad - O_h ; var O_af = false ; var O_ag = false ; var O_ah = O_g . x ; var O_ai = O_g . y ; if ( O_ae . x > 0.0 ) { O_ae . x = - O_ae . x ; } if ( O_ae . y > 0.0 ) { O_ae . y = - O_ae . y ; } if ( O_aa . z == 0.1 ) { O_af = O_s ( O_ae . x ) ; O_ag = O_x ( O_ae . x , O_ah ) ; } else if ( O_aa . z == 0.2 ) { O_af = O_s ( O_ae . y ) ; O_ag = O_x ( O_ae . y , O_ai ) ; } else { O_af = O_s ( O_ae . x ) || O_s ( O_ae . y ) ; O_ag = O_x ( O_ae . x , O_ah ) && O_x ( O_ae . y , O_ai ) ; } if ( O_n . O_m == 0 ) { O_af = false ; } if ( O_aa . z == 0.3 && O_af ) { return O_ab ; } if ( O_n . O_l != 0 ) { if ( O_j != 0.2 && O_j != 0.4 ) { return O_ab ; } if ( O_aa . z != 0.3 || ! O_ag || O_af ) { return O_ab ; } } var O_q : vec4 < f32 > ; var O_r : f32 = 2.0 ; if ( O_j == 0.1 || O_af ) { if ( ! O_af ) { return O_ab ; } O_q = O_e ; } else if ( O_j == 0.2 ) { if ( ! O_ag ) { return O_ab ; } O_q = O_d ; } else if ( O_j == 0.3 ) { O_q = O_c ; } else { if ( O_ag ) { O_q = O_d ; } else { O_q = O_c ; } } if ( O_i == 0.1 ) { O_r = 1.0 ; } O_ab . O_p = O_p ; O_ab . O_q = O_q ; O_ab . O_r = O_r ; return O_ab ; } @ fragment fn frag ( @ builtin ( position ) O_p : vec4 < f32 > , @ location ( 0 ) O_q : vec4 < f32 > , @ location ( 1 ) O_r : f32 , ) -> @ location ( 0 ) vec4 < f32 > { return vec4 ( O_q . xyz , O_q . w * O_r ) ; } ",ust=class{constructor(o,t,e,r){this.vertexSize=3,this.u_origin=new S(0,0),this.templateGridScale=.1,this.scene=o;let i=o.gpu,n=i.device;this.color=new Float32Array([r.r,r.g,r.b,r.alpha]);let s=i.createShaderModule(hst);this.desc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]};let a=4,l=42,c=l%a,h=c==0?l:l+(a-c);this.gridUniformBuffer=i.createDynamicBuffer(h,GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"gridUniformBuffer of GridProgram"),this.gridLinePosBuffer=i.createDynamicBuffer(1,GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,"gridLinePosBuffer of GridProgram"),this.gridPointPosBuffer=i.createDynamicBuffer(1,GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,"gridPointPosBuffer of GridProgram"),this.gridLinePipeline=n.createRenderPipeline({layout:"auto",vertex:{module:s,entryPoint:"vert",buffers:[{arrayStride:3*fs,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]}]},fragment:{module:s,entryPoint:"frag",targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"line-list"}}),this.gridLineBindGroup=i.createBindGroup("Grid Line",this.gridLinePipeline.getBindGroupLayout(0),0,this.gridUniformBuffer),this.gridPointPipeline=n.createRenderPipeline({layout:"auto",vertex:{module:s,entryPoint:"vert",buffers:[{arrayStride:3*fs,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]}]},fragment:{module:s,entryPoint:"frag",targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"point-list"}}),this.gridPointBindGroup=i.createBindGroup("Grid Point",this.gridPointPipeline.getBindGroupLayout(0),0,this.gridUniformBuffer),this.resize(t,e),this.scene.gridParam.attach(this)}get visible(){return this.scene.gridParam.visible}set visible(o){this.scene.gridParam.visible=o}get origin(){return this.scene.getOrigin()}fillVertical(o,t,e,r){return o[r++]=t,o[r++]=-e,o[r++]=.1,o[r++]=t,o[r++]=e,o[r++]=.1,r}fillHorizontal(o,t,e,r){return o[r++]=-e,o[r++]=t,o[r++]=.2,o[r++]=e,o[r++]=t,o[r++]=.2,r}fillPoint(o,t,e,r){return o[r++]=t,o[r++]=e,o[r++]=.3,r}setGridX(o){o>0&&this.scene.gridParam.setGridX(o)}getGridX(){return this.scene.gridParam.getGridX()}setGridY(o){o>0&&this.scene.gridParam.setGridY(o)}getGridY(){return this.scene.gridParam.getGridY()}setSnapX(o){o>0&&this.scene.gridParam.setSnapX(o)}getSnapX(){return this.scene.gridParam.getSnapX()}setSnapY(o){o>0&&this.scene.gridParam.setSnapY(o)}getSnapY(){return this.scene.gridParam.getSnapY()}get pattern(){return this.scene.gridParam.pattern}modifyColor(o,t=o.alpha){this.color=this.colorData(o,t)}colorData(o,t=o.alpha){return new Float32Array([o.r,o.g,o.b,t])}getColor(){return ee.build(this.color[0],this.color[1],this.color[2])}resize(o,t){o===this.width&&t===this.height||(this.width=o,this.height=t,this.flush())}getRenderState(){let o=this.scene.gridParam,t=o.getMultiStyle(),e=!1,r=!1,i=!1,n=!1,s=!1;if(this.visible==0&&t==2)return{showCoor:e,showLine:r,showBoldLine:i,showPoint:n,showBoldPoint:s};e=!0;let a=this.visible==2;return r=a&&o.pattern,n=a&&!o.pattern,i=t==0,s=t==1,{showCoor:e,showLine:r,showBoldLine:i,showPoint:n,showBoldPoint:s}}flush(){let{showCoor:o,showLine:t,showBoldLine:e,showPoint:r,showBoldPoint:i}=this.getRenderState();if(!o)return;let n=new Array;this.lines(n),this.gridLinePosBuffer.setSize(n.length),this.gridLinePosBuffer.write(0,new Float32Array(n)),this.gridLineDrawCount=n.length/this.vertexSize;let s=new Array;this.points(s),this.gridPointPosBuffer.setSize(s.length),this.gridPointPosBuffer.write(0,new Float32Array(s)),this.gridPointDrawCount=s.length/this.vertexSize}lines(o){let t=0,e=this.templateGridScale,r=this.scene.gridParam,i=r.getGridX(),n=r.getGridY(),s=this.width*e*i,a=this.height*e*n;for(let l=0;l<s;l+=i)t=this.fillVertical(o,l,a,t);for(let l=-i;l>-s;l-=i)t=this.fillVertical(o,l,a,t);for(let l=0;l<a;l+=n)t=this.fillHorizontal(o,l,s,t);for(let l=-n;l>-a;l-=n)t=this.fillHorizontal(o,l,s,t)}points(o){let t=0,e=this.templateGridScale,r=this.scene.gridParam,i=r.getGridX(),n=r.getGridY(),s=this.width*e*i,a=this.height*e*n;for(let l=0;l<s;l+=i){for(let c=0;c<a;c+=n)t=this.fillPoint(o,l,c,t);for(let c=-n;c>-a;c-=n)t=this.fillPoint(o,l,c,t)}for(let l=-i;l>-s;l-=i){for(let c=0;c<a;c+=n)t=this.fillPoint(o,l,c,t);for(let c=-n;c>-a;c-=n)t=this.fillPoint(o,l,c,t)}}getListFromArray(o){let t=[];for(let e=0;e<o.length;e++)t[e]=o[e];return t}updateGridParam(o,t,e,r,i){t&&this.modifyColor(t),this.scene.gridParam.updateGridParam(o,e,r,i)}modifyModel(o){this.scene.gridParam.pattern=o}autoScale(o,t){let e=o.getScale(),r=this.scene.gridParam,i=r.getGridX(),n=r.getGridY(),s=parseInt(r.getMultiRatio().toString()),a=s,l=r.getMultiStyle(),c=Math.min(i,n),h=this.templateGridScale*c*2,u=1/(h*e),d=1;for(;u>d;)l==2?d=Math.ceil(u):(d=a>=u?a:a*Math.ceil(u/a),a=1);let p=i*a,m=n*a,g=Math.min(p,m),y=c*e,b=g*e,P=1,T=.5,I=1,C=1,E=2,O=20;if(d==1)P=X(Y(E,O,y),T,I),C=Y(E,O,b);else{let Z=1/h,Q=e/Z;P=X(Y(E,O,c*Z)*Q,T,I),C=Y(E,O,g*(s/a)*Z)*Q,a==1&&(P=0)}let _=this.origin.x,R=this.origin.y,v=o.getPxLength();t==1?_+=v:t==2?R-=v:t==3&&(_+=v,R-=v);let D=Ae.scale(d,d,1).translate1(_,R,0).multiply4(o.getViewMatrix().multiply4(Ae.scale(o.getScale(),o.getScale(),1))),w=d*e,F=S.ORIGIN.multiply4(D),H=i*w,z=n*w,G=F.x-F.x%H,W=F.y-F.y%z,L=o.getProjectMatrix().multiply4(Ae.scale(1/o.getScale(),1/o.getScale(),1));this.u_origin=F.multiply4(L);let B=D.translate1(-G,-W,0).multiply4(L),N=S.ORIGIN.multiply4(B),U=new S(i,n).multiply4(B),k=Math.abs(U.x-N.x),V=Math.abs(U.y-N.y);return{matrix:B,deltaX:k,deltaY:V,multiRatio:a,gridAlphaRatio:P,multiGridAlphaRatio:C};function Y(Z,Q,ae){return ae<=Z?0:ae>=Q?1:(ae-Z)/(Q-Z)}function X(Z,Q,ae){return Math.max(Q,Math.min(ae,Z))}}getRenderColor(o=1){let t=new Array;return this.color.forEach((e,r)=>{r==3&&(e*=o),t.push(e)}),new Float32Array(t)}render0(o,t,e){if(!this.gridLineDrawCount)return;let r=this.scene.gridParam.getMultiStyle();if(this.visible==0&&r==2)return;this.desc.colorAttachments[0].view=o;let i=this.getUniformData(t,e),n=this.getRenderState(),s=[];if(n.showBoldPoint||n.showPoint){i.u_viewState=[this.getViewState(n.showBoldPoint,n.showPoint)],i.u_mode=[.2],s.length=0;for(let a in i)s.push(...i[a]);this.setUniformData(s),this.drawPoints()}i.u_viewState=[this.getViewState(n.showBoldLine,n.showLine)],i.u_mode=[.1],s.length=0;for(let a in i)s.push(...i[a]);this.setUniformData(s),this.drawLines()}render(o,t){this.render0(o,t,0),(this.scene.gridParam.getMultiStyle()===1||Oy.isCloseGridMulAcc())&&(this.render0(o,t,1),this.render0(o,t,2),this.render0(o,t,3))}getUniformData(o,t){let e=this.scene,r=this.scene.gridParam,{matrix:i,multiRatio:n,deltaX:s,deltaY:a,gridAlphaRatio:l,multiGridAlphaRatio:c}=this.autoScale(o,t);return{u_matrix:Array.from(i.data),u_gridColor:this.getListFromArray(this.getRenderColor(l)),u_boldColor:this.getListFromArray(this.colorData(r.multiGridColor,(1-r.multiTransparency)*c)),u_axisColor:this.getListFromArray(this.colorData(r.coordinateAxisColor,1-r.coordinateAxisTransparency)),u_antialias:[.5,e.isCoreGraphic()?0:1],u_deltaSize:[s,a],u_origin:[this.u_origin.x,this.u_origin.y],u_mode:[0],u_viewState:[0],u_gridSize:[n],currentRenderNumber:[t],renderCoordinateAxis:[e.gridParam.renderCoordinateAxis?1:0]}}getViewState(o,t){return o&&t?.4:o?.2:t?.3:.1}setUniformData(o){this.scene.addData(new Uint32Array(new Float32Array(o).buffer),this.gridUniformBuffer)}drawLines(){let o=this.scene.commandEncoder.beginRenderPass(this.desc);o.setPipeline(this.gridLinePipeline),o.setBindGroup(0,this.gridLineBindGroup),o.setVertexBuffer(0,this.gridLinePosBuffer.getBuffer()),o.draw(this.gridLineDrawCount),o.end()}drawPoints(){let o=this.scene.commandEncoder.beginRenderPass(this.desc);o.setPipeline(this.gridPointPipeline),o.setBindGroup(0,this.gridPointBindGroup),o.setVertexBuffer(0,this.gridPointPosBuffer.getBuffer()),o.draw(this.gridPointDrawCount),o.end()}},dst="struct O_a { O_b : f32 , O_c : f32 , O_d : f32 , O_e : f32 , } struct O_f { O_g : mat4x4 < f32 > , O_h : vec2 < f32 > , O_i : vec4 < f32 > , O_j : O_a , O_k : vec2 < f32 > , O_l : vec4 < f32 > , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_m : O_f ; override MATH_PI : f32 ; struct O_n { @ builtin ( position ) O_o : vec4 < f32 > , @ location ( 0 ) O_p : vec2 < f32 > , } fn O_q ( O_r : bool , O_s : f32 , O_t : f32 , ) -> f32 { if ( O_r ) { return O_s ; } else { return O_t ; } } fn O_u ( O_s : f32 , O_t : f32 , ) -> f32 { return O_s - O_t * floor ( O_s / O_t ) ; } fn O_v ( O_w : f32 , ) -> vec2 < f32 > { if ( O_w == 0.5 ) { return vec2 ( 0.15 , 0.4 ) ; } else { return vec2 ( 0.3 , 0.8 ) ; } } fn O_x ( O_y : vec2 < f32 > , ) -> bool { let step = O_m . O_i [ 3 ] ; let O_z = length ( O_y ) - O_m . O_k . x - O_m . O_j . O_b ; let O_aa = O_u ( O_z , step ) ; let O_ab = O_u ( O_z + O_m . O_j . O_b , step ) ; if ( ( abs ( O_aa ) <= O_m . O_j . O_b || abs ( O_ab ) <= O_m . O_j . O_b ) ) { return true ; } else { return false ; } } fn O_ac ( O_y : vec2 < f32 > , ) -> bool { let O_ad = MATH_PI * 2.0 ; let O_z = length ( O_y ) ; let O_ae = atan2 ( O_m . O_j . O_b , O_z ) ; let O_af = O_u ( atan2 ( O_y . y , O_y . x ) + O_ad , O_ad ) ; let O_aa = O_u ( O_af - O_m . O_i [ 1 ] , O_m . O_i [ 0 ] ) ; let O_ab = O_u ( O_af - O_m . O_i [ 1 ] + O_ae , O_m . O_i [ 0 ] ) ; if ( abs ( O_aa ) <= O_ae || abs ( O_ab ) <= O_ae ) { return true ; } else { return false ; } } fn O_ag ( O_y : vec2 < f32 > , ) -> bool { let O_ad = MATH_PI * 2.0 ; let O_z = length ( O_y ) ; let O_ae = atan2 ( O_m . O_j . O_b , O_z ) ; let O_af = O_u ( atan2 ( O_y . y , O_y . x ) + O_ad , O_ad ) ; let O_aa = O_u ( O_af - O_m . O_i [ 1 ] , O_ad ) ; let O_ab = O_u ( O_af - O_m . O_i [ 2 ] , O_ad ) ; let O_ah = O_u ( O_af + O_ae - O_m . O_i [ 1 ] , O_ad ) ; let O_ai = O_u ( O_af + O_ae - O_m . O_i [ 2 ] , O_ad ) ; if ( abs ( O_aa ) <= O_ae || abs ( O_ab ) <= O_ae || abs ( O_ah ) <= O_ae || abs ( O_ai ) <= O_ae ) { return true ; } else { return false ; } } @ vertex fn vert ( @ location ( 0 ) O_aj : vec3 < f32 > , ) -> O_n { var O_ak : O_n ; O_ak . O_p = ( O_m . O_g * vec4 ( O_aj , 1.0 ) ) . xy - O_m . O_h ; O_ak . O_o = vec4 ( O_aj , 1.0 ) ; return O_ak ; } @ fragment fn frag ( @ builtin ( position ) O_o : vec4 < f32 > , @ location ( 0 ) O_p : vec2 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { let O_ad = MATH_PI * 2.0 ; let O_al = normalize ( O_p ) ; let O_am = vec2 ( cos ( O_m . O_i [ 1 ] ) , sin ( O_m . O_i [ 1 ] ) ) ; let O_an = vec2 ( cos ( O_m . O_i [ 2 ] ) , sin ( O_m . O_i [ 2 ] ) ) ; let O_ao = O_am . x * O_al . y - O_am . y * O_al . x ; let O_ap = O_an . x * O_al . y - O_an . y * O_al . x ; let O_af = O_m . O_j . O_c ; let O_z = length ( O_p ) ; if ( O_z < O_m . O_k . x - O_m . O_j . O_b || O_z > O_m . O_k . y + O_m . O_j . O_b ) { discard ; } else if ( ( O_af < MATH_PI && O_ao >= 0.0 && O_ap <= 0.0 ) || ( O_af >= MATH_PI && ( O_ao >= 0.0 || O_ap <= 0.0 ) ) || O_ag ( O_p ) ) { let O_aq = O_m . O_j . O_e ; let O_ar = O_v ( O_m . O_j . O_d ) ; if ( O_aq == 1.0 ) { if ( O_ac ( O_p ) ) { return vec4 ( O_m . O_l . xyz , O_ar . y ) ; } else if ( O_x ( O_p ) ) { return vec4 ( O_m . O_l . xyz , O_ar . x ) ; } else { discard ; } } else { if ( O_ac ( O_p ) && O_x ( O_p ) ) { return vec4 ( O_m . O_l . xyz , O_ar . y ) ; } else { discard ; } } } else { discard ; } return vec4 ( 0 ) ; } ",pst=class{constructor(o,t,e,r){this.scene=o;let i=o.gpu,n=i.device;this.desc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]},this.polarUniformBuffer=i.createDynamicBuffer(36,GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"polarUniformBuffer of GridProgram"),this.polarPosBuffer=i.createStaticBuffer(new Uint32Array(new Float32Array([-1,-1,1,-1,1,1,1,1,-1,1,-1,-1]).buffer),GPUBufferUsage.VERTEX,"polarPosBuffer of RulerProgram"),this.polarDrawCount=this.polarPosBuffer.getSize()/2;let s=n.createShaderModule({code:dst});this.polarPipeline=n.createRenderPipeline({layout:"auto",vertex:{module:s,entryPoint:"vert",buffers:[{arrayStride:2*fs,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:s,entryPoint:"frag",constants:{MATH_PI:Math.PI},targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}}),this.polarBindGroup=i.createBindGroup("polar",this.polarPipeline.getBindGroupLayout(0),0,this.polarUniformBuffer)}get minRadius(){return this.scene.gridParam.minRadius}set minRadius(o){this.scene.gridParam.minRadius=o}get maxRadius(){return this.scene.gridParam.maxRadius}set maxRadius(o){this.scene.gridParam.maxRadius=o}get angleDelta(){return this.scene.gridParam.angleDelta}set angleDelta(o){this.scene.gridParam.angleDelta=o}get radius(){return this.scene.gridParam.radius}set radius(o){this.scene.gridParam.radius=o}get startAngle(){return this.scene.gridParam.startAngle}set startAngle(o){this.scene.gridParam.startAngle=o}get endAngle(){return this.scene.gridParam.endAngle}set endAngle(o){this.scene.gridParam.endAngle=o}get sweepAngle(){return this.scene.gridParam.sweepAngle}getListFromArray(o){let t=[];for(let e=0;e<o.length;e++)t[e]=o[e];return t}getPxRatio(o){let t=o.getWidth(),e=o.getHeight(),r=o.getRenderMatrix(),i=Mt.ORIGIN.multiply4(r);if(t>e){let n=new Mt(0,1,0).multiply4(r);return 2/e/i.sub(n).length()}else{let n=new Mt(1,0,0).multiply4(r);return 2/t/i.sub(n).length()}}getStep(o){let t=10,e=o.getPxLength(),r=this.scene.gridParam.radius/e;if(r<t)for(let i=0;;i++){let n=this.scene.gridParam.radius*Math.pow(5,i);if(r=n/e,!(r<t))return n}return this.scene.gridParam.radius}render(o,t){if(this.scene.gridProgram.visible!=2)return;let e=t.getRenderMatrix().inverse().data,r=this.scene.gridProgram.origin,i=[r.x,r.y],n=[this.scene.gridParam.angleDelta,this.startAngle,this.endAngle,this.getStep(t)],s=[t.getPxLength(),this.sweepAngle,this.scene.getAntialias()?1.5:.5,this.scene.gridProgram.pattern?1:2],a=[this.scene.gridParam.minRadius,this.scene.gridParam.maxRadius],l=this.getListFromArray(this.scene.gridProgram.getRenderColor()),c=new Float32Array(36);c.set(e,0),c.set(i,16),c.set(n,20),c.set(s,24),c.set(a,28),c.set(l,32),this.scene.addData(new Uint32Array(c.buffer),this.polarUniformBuffer),this.desc.colorAttachments[0].view=o;let h=this.scene.commandEncoder.beginRenderPass(this.desc);h.setPipeline(this.polarPipeline),h.setBindGroup(0,this.polarBindGroup),h.setVertexBuffer(0,this.polarPosBuffer.getBuffer()),h.draw(this.polarDrawCount),h.end()}},fst=EDe(XDe()),Sbe=0,mst=1,mRe=1,gRe=100,yRe=204,bRe=205,PRe=0,TRe=1,IRe=2,XJ=3,CRe=4,SRe=5,ERe=6,ORe=7,gst=0,jLe=300,yst=301,ARe=1e3,vv=1001,_Re=1002,wv=1003,tk=1006,XLe=1008,bst=1009,Pst=1014,MJ=1015,ZZ=1016,Tst=1020,Ist=1023,Iye=1026,vRe=1027,qJ=2300,Ebe=2301,Cye=2302,xRe=2400,RRe=2401,DRe=2402,qLe="",dS="srgb",Obe="srgb-linear",wRe="linear",Sye="srgb",w7=7680,LRe=519,MRe=35044,DL=2e3,Abe=2001,uQ=class{addEventListener(o,t){this._listeners===void 0&&(this._listeners={});let e=this._listeners;e[o]===void 0&&(e[o]=[]),e[o].indexOf(t)===-1&&e[o].push(t)}hasEventListener(o,t){if(this._listeners===void 0)return!1;let e=this._listeners;return e[o]!==void 0&&e[o].indexOf(t)!==-1}removeEventListener(o,t){if(this._listeners===void 0)return;let e=this._listeners[o];if(e!==void 0){let r=e.indexOf(t);r!==-1&&e.splice(r,1)}}dispatchEvent(o){if(this._listeners===void 0)return;let t=this._listeners[o.type];if(t!==void 0){o.target=this;let e=t.slice(0);for(let r=0,i=e.length;r<i;r++)e[r].call(this,o);o.target=null}}},Ty=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],Cst=Math.PI/180,fNt=180/Math.PI;function uk(){let o=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Ty[o&255]+Ty[o>>8&255]+Ty[o>>16&255]+Ty[o>>24&255]+"-"+Ty[t&255]+Ty[t>>8&255]+"-"+Ty[t>>16&15|64]+Ty[t>>24&255]+"-"+Ty[e&63|128]+Ty[e>>8&255]+"-"+Ty[e>>16&255]+Ty[e>>24&255]+Ty[r&255]+Ty[r>>8&255]+Ty[r>>16&255]+Ty[r>>24&255]).toLowerCase()}function vl(o,t,e){return Math.max(t,Math.min(e,o))}function Sst(o,t){return(o%t+t)%t}function Eye(o,t,e){return(1-e)*o+e*t}function QH(o,t){switch(t.constructor){case Float32Array:return o;case Uint32Array:return o/4294967295;case Uint16Array:return o/65535;case Uint8Array:return o/255;case Int32Array:return Math.max(o/2147483647,-1);case Int16Array:return Math.max(o/32767,-1);case Int8Array:return Math.max(o/127,-1);default:throw new Error("Invalid component type.")}}function E2(o,t){switch(t.constructor){case Float32Array:return o;case Uint32Array:return Math.round(o*4294967295);case Uint16Array:return Math.round(o*65535);case Uint8Array:return Math.round(o*255);case Int32Array:return Math.round(o*2147483647);case Int16Array:return Math.round(o*32767);case Int8Array:return Math.round(o*127);default:throw new Error("Invalid component type.")}}var En=class $Le{constructor(t=0,e=0){$Le.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,r=this.y,i=t.elements;return this.x=i[0]*e+i[3]*r+i[6],this.y=i[1]*e+i[4]*r+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=vl(this.x,t.x,e.x),this.y=vl(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=vl(this.x,t,e),this.y=vl(this.y,t,e),this}clampLength(t,e){let r=this.length();return this.divideScalar(r||1).multiplyScalar(vl(r,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let r=this.dot(t)/e;return Math.acos(vl(r,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,r=this.y-t.y;return e*e+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let r=Math.cos(e),i=Math.sin(e),n=this.x-t.x,s=this.y-t.y;return this.x=n*r-s*i+t.x,this.y=n*i+s*r+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Ul=class KLe{constructor(t,e,r,i,n,s,a,l,c){KLe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,r,i,n,s,a,l,c)}set(t,e,r,i,n,s,a,l,c){let h=this.elements;return h[0]=t,h[1]=i,h[2]=a,h[3]=e,h[4]=n,h[5]=l,h[6]=r,h[7]=s,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}extractBasis(t,e,r){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let r=t.elements,i=e.elements,n=this.elements,s=r[0],a=r[3],l=r[6],c=r[1],h=r[4],u=r[7],d=r[2],p=r[5],m=r[8],g=i[0],y=i[3],b=i[6],P=i[1],T=i[4],I=i[7],C=i[2],E=i[5],O=i[8];return n[0]=s*g+a*P+l*C,n[3]=s*y+a*T+l*E,n[6]=s*b+a*I+l*O,n[1]=c*g+h*P+u*C,n[4]=c*y+h*T+u*E,n[7]=c*b+h*I+u*O,n[2]=d*g+p*P+m*C,n[5]=d*y+p*T+m*E,n[8]=d*b+p*I+m*O,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],s=t[4],a=t[5],l=t[6],c=t[7],h=t[8];return e*s*h-e*a*c-r*n*h+r*a*l+i*n*c-i*s*l}invert(){let t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],s=t[4],a=t[5],l=t[6],c=t[7],h=t[8],u=h*s-a*c,d=a*l-h*n,p=c*n-s*l,m=e*u+r*d+i*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/m;return t[0]=u*g,t[1]=(i*c-h*r)*g,t[2]=(a*r-i*s)*g,t[3]=d*g,t[4]=(h*e-i*l)*g,t[5]=(i*n-a*e)*g,t[6]=p*g,t[7]=(r*l-c*e)*g,t[8]=(s*e-r*n)*g,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,r,i,n,s,a){let l=Math.cos(n),c=Math.sin(n);return this.set(r*l,r*c,-r*(l*s+c*a)+s+t,-i*c,i*l,-i*(-c*s+l*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(Oye.makeScale(t,e)),this}rotate(t){return this.premultiply(Oye.makeRotation(-t)),this}translate(t,e){return this.premultiply(Oye.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,r,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,r=t.elements;for(let i=0;i<9;i++)if(e[i]!==r[i])return!1;return!0}fromArray(t,e=0){for(let r=0;r<9;r++)this.elements[r]=t[r+e];return this}toArray(t=[],e=0){let r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t}clone(){return new this.constructor().fromArray(this.elements)}},Oye=new Ul;function Est(o){for(let t=o.length-1;t>=0;--t)if(o[t]>=65535)return!0;return!1}function NRe(o){return document.createElementNS("http://www.w3.org/1999/xhtml",o)}var kRe=new Ul().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),BRe=new Ul().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ost(){let o={enabled:!0,workingColorSpace:Obe,spaces:{},convert:function(i,n,s){return this.enabled===!1||n===s||!n||!s||(this.spaces[n].transfer===Sye&&(i.r=BO(i.r),i.g=BO(i.g),i.b=BO(i.b)),this.spaces[n].primaries!==this.spaces[s].primaries&&(i.applyMatrix3(this.spaces[n].toXYZ),i.applyMatrix3(this.spaces[s].fromXYZ)),this.spaces[s].transfer===Sye&&(i.r=rk(i.r),i.g=rk(i.g),i.b=rk(i.b))),i},fromWorkingColorSpace:function(i,n){return this.convert(i,this.workingColorSpace,n)},toWorkingColorSpace:function(i,n){return this.convert(i,n,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===qLe?wRe:this.spaces[i].transfer},getLuminanceCoefficients:function(i,n=this.workingColorSpace){return i.fromArray(this.spaces[n].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,n,s){return i.copy(this.spaces[n].toXYZ).multiply(this.spaces[s].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],r=[.3127,.329];return o.define({[Obe]:{primaries:t,whitePoint:r,transfer:wRe,toXYZ:kRe,fromXYZ:BRe,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:dS},outputColorSpaceConfig:{drawingBufferColorSpace:dS}},[dS]:{primaries:t,whitePoint:r,transfer:Sye,toXYZ:kRe,fromXYZ:BRe,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:dS}}}),o}var lS=Ost();function BO(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function rk(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}var L7,Ast=class{static getDataURL(o){if(/^data:/i.test(o.src)||typeof HTMLCanvasElement>"u")return o.src;let t;if(o instanceof HTMLCanvasElement)t=o;else{L7===void 0&&(L7=NRe("canvas")),L7.width=o.width,L7.height=o.height;let e=L7.getContext("2d");o instanceof ImageData?e.putImageData(o,0,0):e.drawImage(o,0,0,o.width,o.height),t=L7}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",o),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(o){if(typeof HTMLImageElement<"u"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&o instanceof ImageBitmap){let t=NRe("canvas");t.width=o.width,t.height=o.height;let e=t.getContext("2d");e.drawImage(o,0,0,o.width,o.height);let r=e.getImageData(0,0,o.width,o.height),i=r.data;for(let n=0;n<i.length;n++)i[n]=BO(i[n]/255)*255;return e.putImageData(r,0,0),t}else if(o.data){let t=o.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(BO(t[e]/255)*255):t[e]=BO(t[e]);return{data:t,width:o.width,height:o.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),o}},_st=0,vst=class{constructor(o=null){this.isSource=!0,Object.defineProperty(this,"id",{value:_st++}),this.uuid=uk(),this.data=o,this.dataReady=!0,this.version=0}set needsUpdate(o){o===!0&&this.version++}toJSON(o){let t=o===void 0||typeof o=="string";if(!t&&o.images[this.uuid]!==void 0)return o.images[this.uuid];let e={uuid:this.uuid,url:""},r=this.data;if(r!==null){let i;if(Array.isArray(r)){i=[];for(let n=0,s=r.length;n<s;n++)r[n].isDataTexture?i.push(Aye(r[n].image)):i.push(Aye(r[n]))}else i=Aye(r);e.url=i}return t||(o.images[this.uuid]=e),e}};function Aye(o){return typeof HTMLImageElement<"u"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&o instanceof ImageBitmap?Ast.getDataURL(o):o.data?{data:Array.from(o.data),width:o.width,height:o.height,type:o.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var xst=0,VO=class NJ extends uQ{constructor(t=NJ.DEFAULT_IMAGE,e=NJ.DEFAULT_MAPPING,r=vv,i=vv,n=tk,s=XLe,a=Ist,l=bst,c=NJ.DEFAULT_ANISOTROPY,h=qLe){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:xst++}),this.uuid=uk(),this.name="",this.source=new vst(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=n,this.minFilter=s,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new En(0,0),this.repeat=new En(1,1),this.center=new En(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ul,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let r={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),e||(t.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==jLe)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case ARe:t.x=t.x-Math.floor(t.x);break;case vv:t.x=t.x<0?0:1;break;case _Re:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case ARe:t.y=t.y-Math.floor(t.y);break;case vv:t.y=t.y<0?0:1;break;case _Re:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};VO.DEFAULT_IMAGE=null;VO.DEFAULT_MAPPING=jLe;VO.DEFAULT_ANISOTROPY=1;var DW=class ZLe{constructor(t=0,e=0,r=0,i=1){ZLe.prototype.isVector4=!0,this.x=t,this.y=e,this.z=r,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,r=this.y,i=this.z,n=this.w,s=t.elements;return this.x=s[0]*e+s[4]*r+s[8]*i+s[12]*n,this.y=s[1]*e+s[5]*r+s[9]*i+s[13]*n,this.z=s[2]*e+s[6]*r+s[10]*i+s[14]*n,this.w=s[3]*e+s[7]*r+s[11]*i+s[15]*n,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,r,i,n,s=t.elements,a=s[0],l=s[4],c=s[8],h=s[1],u=s[5],d=s[9],p=s[2],m=s[6],g=s[10];if(Math.abs(l-h)<.01&&Math.abs(c-p)<.01&&Math.abs(d-m)<.01){if(Math.abs(l+h)<.1&&Math.abs(c+p)<.1&&Math.abs(d+m)<.1&&Math.abs(a+u+g-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let b=(a+1)/2,P=(u+1)/2,T=(g+1)/2,I=(l+h)/4,C=(c+p)/4,E=(d+m)/4;return b>P&&b>T?b<.01?(r=0,i=.707106781,n=.707106781):(r=Math.sqrt(b),i=I/r,n=C/r):P>T?P<.01?(r=.707106781,i=0,n=.707106781):(i=Math.sqrt(P),r=I/i,n=E/i):T<.01?(r=.707106781,i=.707106781,n=0):(n=Math.sqrt(T),r=C/n,i=E/n),this.set(r,i,n,e),this}let y=Math.sqrt((m-d)*(m-d)+(c-p)*(c-p)+(h-l)*(h-l));return Math.abs(y)<.001&&(y=1),this.x=(m-d)/y,this.y=(c-p)/y,this.z=(h-l)/y,this.w=Math.acos((a+u+g-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=vl(this.x,t.x,e.x),this.y=vl(this.y,t.y,e.y),this.z=vl(this.z,t.z,e.z),this.w=vl(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=vl(this.x,t,e),this.y=vl(this.y,t,e),this.z=vl(this.z,t,e),this.w=vl(this.w,t,e),this}clampLength(t,e){let r=this.length();return this.divideScalar(r||1).multiplyScalar(vl(r,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this.w=t.w+(e.w-t.w)*r,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Rst=class extends VO{constructor(o=null,t=1,e=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:o,width:t,height:e,depth:r},this.magFilter=wv,this.minFilter=wv,this.wrapR=vv,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(o){this.layerUpdates.add(o)}clearLayerUpdates(){this.layerUpdates.clear()}},Dst=class extends VO{constructor(o=null,t=1,e=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:o,width:t,height:e,depth:r},this.magFilter=wv,this.minFilter=wv,this.wrapR=vv,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},kv=class{constructor(o=0,t=0,e=0,r=1){this.isQuaternion=!0,this._x=o,this._y=t,this._z=e,this._w=r}static slerpFlat(o,t,e,r,i,n,s){let a=e[r+0],l=e[r+1],c=e[r+2],h=e[r+3],u=i[n+0],d=i[n+1],p=i[n+2],m=i[n+3];if(s===0){o[t+0]=a,o[t+1]=l,o[t+2]=c,o[t+3]=h;return}if(s===1){o[t+0]=u,o[t+1]=d,o[t+2]=p,o[t+3]=m;return}if(h!==m||a!==u||l!==d||c!==p){let g=1-s,y=a*u+l*d+c*p+h*m,b=y>=0?1:-1,P=1-y*y;if(P>Number.EPSILON){let I=Math.sqrt(P),C=Math.atan2(I,y*b);g=Math.sin(g*C)/I,s=Math.sin(s*C)/I}let T=s*b;if(a=a*g+u*T,l=l*g+d*T,c=c*g+p*T,h=h*g+m*T,g===1-s){let I=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=I,l*=I,c*=I,h*=I}}o[t]=a,o[t+1]=l,o[t+2]=c,o[t+3]=h}static multiplyQuaternionsFlat(o,t,e,r,i,n){let s=e[r],a=e[r+1],l=e[r+2],c=e[r+3],h=i[n],u=i[n+1],d=i[n+2],p=i[n+3];return o[t]=s*p+c*h+a*d-l*u,o[t+1]=a*p+c*u+l*h-s*d,o[t+2]=l*p+c*d+s*u-a*h,o[t+3]=c*p-s*h-a*u-l*d,o}get x(){return this._x}set x(o){this._x=o,this._onChangeCallback()}get y(){return this._y}set y(o){this._y=o,this._onChangeCallback()}get z(){return this._z}set z(o){this._z=o,this._onChangeCallback()}get w(){return this._w}set w(o){this._w=o,this._onChangeCallback()}set(o,t,e,r){return this._x=o,this._y=t,this._z=e,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(o){return this._x=o.x,this._y=o.y,this._z=o.z,this._w=o.w,this._onChangeCallback(),this}setFromEuler(o,t=!0){let e=o._x,r=o._y,i=o._z,n=o._order,s=Math.cos,a=Math.sin,l=s(e/2),c=s(r/2),h=s(i/2),u=a(e/2),d=a(r/2),p=a(i/2);switch(n){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+n)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(o,t){let e=t/2,r=Math.sin(e);return this._x=o.x*r,this._y=o.y*r,this._z=o.z*r,this._w=Math.cos(e),this._onChangeCallback(),this}setFromRotationMatrix(o){let t=o.elements,e=t[0],r=t[4],i=t[8],n=t[1],s=t[5],a=t[9],l=t[2],c=t[6],h=t[10],u=e+s+h;if(u>0){let d=.5/Math.sqrt(u+1);this._w=.25/d,this._x=(c-a)*d,this._y=(i-l)*d,this._z=(n-r)*d}else if(e>s&&e>h){let d=2*Math.sqrt(1+e-s-h);this._w=(c-a)/d,this._x=.25*d,this._y=(r+n)/d,this._z=(i+l)/d}else if(s>h){let d=2*Math.sqrt(1+s-e-h);this._w=(i-l)/d,this._x=(r+n)/d,this._y=.25*d,this._z=(a+c)/d}else{let d=2*Math.sqrt(1+h-e-s);this._w=(n-r)/d,this._x=(i+l)/d,this._y=(a+c)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(o,t){let e=o.dot(t)+1;return e<Number.EPSILON?(e=0,Math.abs(o.x)>Math.abs(o.z)?(this._x=-o.y,this._y=o.x,this._z=0,this._w=e):(this._x=0,this._y=-o.z,this._z=o.y,this._w=e)):(this._x=o.y*t.z-o.z*t.y,this._y=o.z*t.x-o.x*t.z,this._z=o.x*t.y-o.y*t.x,this._w=e),this.normalize()}angleTo(o){return 2*Math.acos(Math.abs(vl(this.dot(o),-1,1)))}rotateTowards(o,t){let e=this.angleTo(o);if(e===0)return this;let r=Math.min(1,t/e);return this.slerp(o,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(o){return this._x*o._x+this._y*o._y+this._z*o._z+this._w*o._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let o=this.length();return o===0?(this._x=0,this._y=0,this._z=0,this._w=1):(o=1/o,this._x=this._x*o,this._y=this._y*o,this._z=this._z*o,this._w=this._w*o),this._onChangeCallback(),this}multiply(o){return this.multiplyQuaternions(this,o)}premultiply(o){return this.multiplyQuaternions(o,this)}multiplyQuaternions(o,t){let e=o._x,r=o._y,i=o._z,n=o._w,s=t._x,a=t._y,l=t._z,c=t._w;return this._x=e*c+n*s+r*l-i*a,this._y=r*c+n*a+i*s-e*l,this._z=i*c+n*l+e*a-r*s,this._w=n*c-e*s-r*a-i*l,this._onChangeCallback(),this}slerp(o,t){if(t===0)return this;if(t===1)return this.copy(o);let e=this._x,r=this._y,i=this._z,n=this._w,s=n*o._w+e*o._x+r*o._y+i*o._z;if(s<0?(this._w=-o._w,this._x=-o._x,this._y=-o._y,this._z=-o._z,s=-s):this.copy(o),s>=1)return this._w=n,this._x=e,this._y=r,this._z=i,this;let a=1-s*s;if(a<=Number.EPSILON){let d=1-t;return this._w=d*n+t*this._w,this._x=d*e+t*this._x,this._y=d*r+t*this._y,this._z=d*i+t*this._z,this.normalize(),this}let l=Math.sqrt(a),c=Math.atan2(l,s),h=Math.sin((1-t)*c)/l,u=Math.sin(t*c)/l;return this._w=n*h+this._w*u,this._x=e*h+this._x*u,this._y=r*h+this._y*u,this._z=i*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(o,t,e){return this.copy(o).slerp(t,e)}random(){let o=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),e=Math.random(),r=Math.sqrt(1-e),i=Math.sqrt(e);return this.set(r*Math.sin(o),r*Math.cos(o),i*Math.sin(t),i*Math.cos(t))}equals(o){return o._x===this._x&&o._y===this._y&&o._z===this._z&&o._w===this._w}fromArray(o,t=0){return this._x=o[t],this._y=o[t+1],this._z=o[t+2],this._w=o[t+3],this._onChangeCallback(),this}toArray(o=[],t=0){return o[t]=this._x,o[t+1]=this._y,o[t+2]=this._z,o[t+3]=this._w,o}fromBufferAttribute(o,t){return this._x=o.getX(t),this._y=o.getY(t),this._z=o.getZ(t),this._w=o.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(o){return this._onChangeCallback=o,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},wt=class JLe{constructor(t=0,e=0,r=0){JLe.prototype.isVector3=!0,this.x=t,this.y=e,this.z=r}set(t,e,r){return r===void 0&&(r=this.z),this.x=t,this.y=e,this.z=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(FRe.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(FRe.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,r=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6]*i,this.y=n[1]*e+n[4]*r+n[7]*i,this.z=n[2]*e+n[5]*r+n[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,r=this.y,i=this.z,n=t.elements,s=1/(n[3]*e+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*e+n[4]*r+n[8]*i+n[12])*s,this.y=(n[1]*e+n[5]*r+n[9]*i+n[13])*s,this.z=(n[2]*e+n[6]*r+n[10]*i+n[14])*s,this}applyQuaternion(t){let e=this.x,r=this.y,i=this.z,n=t.x,s=t.y,a=t.z,l=t.w,c=2*(s*i-a*r),h=2*(a*e-n*i),u=2*(n*r-s*e);return this.x=e+l*c+s*u-a*h,this.y=r+l*h+a*c-n*u,this.z=i+l*u+n*h-s*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,r=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[4]*r+n[8]*i,this.y=n[1]*e+n[5]*r+n[9]*i,this.z=n[2]*e+n[6]*r+n[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=vl(this.x,t.x,e.x),this.y=vl(this.y,t.y,e.y),this.z=vl(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=vl(this.x,t,e),this.y=vl(this.y,t,e),this.z=vl(this.z,t,e),this}clampLength(t,e){let r=this.length();return this.divideScalar(r||1).multiplyScalar(vl(r,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let r=t.x,i=t.y,n=t.z,s=e.x,a=e.y,l=e.z;return this.x=i*l-n*a,this.y=n*s-r*l,this.z=r*a-i*s,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let r=t.dot(this)/e;return this.copy(t).multiplyScalar(r)}projectOnPlane(t){return _ye.copy(this).projectOnVector(t),this.sub(_ye)}reflect(t){return this.sub(_ye.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let r=this.dot(t)/e;return Math.acos(vl(r,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,r){let i=Math.sin(e)*t;return this.x=i*Math.sin(r),this.y=Math.cos(e)*t,this.z=i*Math.cos(r),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,r){return this.x=t*Math.sin(e),this.y=r,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),r=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=r,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,r=Math.sqrt(1-e*e);return this.x=r*Math.cos(t),this.y=e,this.z=r*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},_ye=new wt,FRe=new kv,Bv=class{constructor(o=new wt(1/0,1/0,1/0),t=new wt(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=o,this.max=t}set(o,t){return this.min.copy(o),this.max.copy(t),this}setFromArray(o){this.makeEmpty();for(let t=0,e=o.length;t<e;t+=3)this.expandByPoint(cS.fromArray(o,t));return this}setFromBufferAttribute(o){this.makeEmpty();for(let t=0,e=o.count;t<e;t++)this.expandByPoint(cS.fromBufferAttribute(o,t));return this}setFromPoints(o){this.makeEmpty();for(let t=0,e=o.length;t<e;t++)this.expandByPoint(o[t]);return this}setFromCenterAndSize(o,t){let e=cS.copy(t).multiplyScalar(.5);return this.min.copy(o).sub(e),this.max.copy(o).add(e),this}setFromObject(o,t=!1){return this.makeEmpty(),this.expandByObject(o,t)}clone(){return new this.constructor().copy(this)}copy(o){return this.min.copy(o.min),this.max.copy(o.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(o){return this.isEmpty()?o.set(0,0,0):o.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(o){return this.isEmpty()?o.set(0,0,0):o.subVectors(this.max,this.min)}expandByPoint(o){return this.min.min(o),this.max.max(o),this}expandByVector(o){return this.min.sub(o),this.max.add(o),this}expandByScalar(o){return this.min.addScalar(-o),this.max.addScalar(o),this}expandByObject(o,t=!1){o.updateWorldMatrix(!1,!1);let e=o.geometry;if(e!==void 0){let i=e.getAttribute("position");if(t===!0&&i!==void 0&&o.isInstancedMesh!==!0)for(let n=0,s=i.count;n<s;n++)o.isMesh===!0?o.getVertexPosition(n,cS):cS.fromBufferAttribute(i,n),cS.applyMatrix4(o.matrixWorld),this.expandByPoint(cS);else o.boundingBox!==void 0?(o.boundingBox===null&&o.computeBoundingBox(),JZ.copy(o.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),JZ.copy(e.boundingBox)),JZ.applyMatrix4(o.matrixWorld),this.union(JZ)}let r=o.children;for(let i=0,n=r.length;i<n;i++)this.expandByObject(r[i],t);return this}containsPoint(o){return o.x>=this.min.x&&o.x<=this.max.x&&o.y>=this.min.y&&o.y<=this.max.y&&o.z>=this.min.z&&o.z<=this.max.z}containsBox(o){return this.min.x<=o.min.x&&o.max.x<=this.max.x&&this.min.y<=o.min.y&&o.max.y<=this.max.y&&this.min.z<=o.min.z&&o.max.z<=this.max.z}getParameter(o,t){return t.set((o.x-this.min.x)/(this.max.x-this.min.x),(o.y-this.min.y)/(this.max.y-this.min.y),(o.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(o){return o.max.x>=this.min.x&&o.min.x<=this.max.x&&o.max.y>=this.min.y&&o.min.y<=this.max.y&&o.max.z>=this.min.z&&o.min.z<=this.max.z}intersectsSphere(o){return this.clampPoint(o.center,cS),cS.distanceToSquared(o.center)<=o.radius*o.radius}intersectsPlane(o){let t,e;return o.normal.x>0?(t=o.normal.x*this.min.x,e=o.normal.x*this.max.x):(t=o.normal.x*this.max.x,e=o.normal.x*this.min.x),o.normal.y>0?(t+=o.normal.y*this.min.y,e+=o.normal.y*this.max.y):(t+=o.normal.y*this.max.y,e+=o.normal.y*this.min.y),o.normal.z>0?(t+=o.normal.z*this.min.z,e+=o.normal.z*this.max.z):(t+=o.normal.z*this.max.z,e+=o.normal.z*this.min.z),t<=-o.constant&&e>=-o.constant}intersectsTriangle(o){if(this.isEmpty())return!1;this.getCenter(eW),QZ.subVectors(this.max,eW),M7.subVectors(o.a,eW),N7.subVectors(o.b,eW),k7.subVectors(o.c,eW),yv.subVectors(N7,M7),bv.subVectors(k7,N7),TL.subVectors(M7,k7);let t=[0,-yv.z,yv.y,0,-bv.z,bv.y,0,-TL.z,TL.y,yv.z,0,-yv.x,bv.z,0,-bv.x,TL.z,0,-TL.x,-yv.y,yv.x,0,-bv.y,bv.x,0,-TL.y,TL.x,0];return!vye(t,M7,N7,k7,QZ)||(t=[1,0,0,0,1,0,0,0,1],!vye(t,M7,N7,k7,QZ))?!1:(eJ.crossVectors(yv,bv),t=[eJ.x,eJ.y,eJ.z],vye(t,M7,N7,k7,QZ))}clampPoint(o,t){return t.copy(o).clamp(this.min,this.max)}distanceToPoint(o){return this.clampPoint(o,cS).distanceTo(o)}getBoundingSphere(o){return this.isEmpty()?o.makeEmpty():(this.getCenter(o.center),o.radius=this.getSize(cS).length()*.5),o}intersect(o){return this.min.max(o.min),this.max.min(o.max),this.isEmpty()&&this.makeEmpty(),this}union(o){return this.min.min(o.min),this.max.max(o.max),this}applyMatrix4(o){return this.isEmpty()?this:(_O[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(o),_O[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(o),_O[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(o),_O[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(o),_O[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(o),_O[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(o),_O[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(o),_O[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(o),this.setFromPoints(_O),this)}translate(o){return this.min.add(o),this.max.add(o),this}equals(o){return o.min.equals(this.min)&&o.max.equals(this.max)}},_O=[new wt,new wt,new wt,new wt,new wt,new wt,new wt,new wt],cS=new wt,JZ=new Bv,M7=new wt,N7=new wt,k7=new wt,yv=new wt,bv=new wt,TL=new wt,eW=new wt,QZ=new wt,eJ=new wt,IL=new wt;function vye(o,t,e,r,i){for(let n=0,s=o.length-3;n<=s;n+=3){IL.fromArray(o,n);let a=i.x*Math.abs(IL.x)+i.y*Math.abs(IL.y)+i.z*Math.abs(IL.z),l=t.dot(IL),c=e.dot(IL),h=r.dot(IL);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}var wst=new Bv,tW=new wt,xye=new wt,Fv=class{constructor(o=new wt,t=-1){this.isSphere=!0,this.center=o,this.radius=t}set(o,t){return this.center.copy(o),this.radius=t,this}setFromPoints(o,t){let e=this.center;t!==void 0?e.copy(t):wst.setFromPoints(o).getCenter(e);let r=0;for(let i=0,n=o.length;i<n;i++)r=Math.max(r,e.distanceToSquared(o[i]));return this.radius=Math.sqrt(r),this}copy(o){return this.center.copy(o.center),this.radius=o.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(o){return o.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(o){return o.distanceTo(this.center)-this.radius}intersectsSphere(o){let t=this.radius+o.radius;return o.center.distanceToSquared(this.center)<=t*t}intersectsBox(o){return o.intersectsSphere(this)}intersectsPlane(o){return Math.abs(o.distanceToPoint(this.center))<=this.radius}clampPoint(o,t){let e=this.center.distanceToSquared(o);return t.copy(o),e>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(o){return this.isEmpty()?(o.makeEmpty(),o):(o.set(this.center,this.center),o.expandByScalar(this.radius),o)}applyMatrix4(o){return this.center.applyMatrix4(o),this.radius=this.radius*o.getMaxScaleOnAxis(),this}translate(o){return this.center.add(o),this}expandByPoint(o){if(this.isEmpty())return this.center.copy(o),this.radius=0,this;tW.subVectors(o,this.center);let t=tW.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),r=(e-this.radius)*.5;this.center.addScaledVector(tW,r/e),this.radius+=r}return this}union(o){return o.isEmpty()?this:this.isEmpty()?(this.copy(o),this):(this.center.equals(o.center)===!0?this.radius=Math.max(this.radius,o.radius):(xye.subVectors(o.center,this.center).setLength(o.radius),this.expandByPoint(tW.copy(o.center).add(xye)),this.expandByPoint(tW.copy(o.center).sub(xye))),this)}equals(o){return o.center.equals(this.center)&&o.radius===this.radius}clone(){return new this.constructor().copy(this)}},vO=new wt,Rye=new wt,tJ=new wt,Pv=new wt,Dye=new wt,rJ=new wt,wye=new wt,dQ=class{constructor(o=new wt,t=new wt(0,0,-1)){this.origin=o,this.direction=t}set(o,t){return this.origin.copy(o),this.direction.copy(t),this}copy(o){return this.origin.copy(o.origin),this.direction.copy(o.direction),this}at(o,t){return t.copy(this.origin).addScaledVector(this.direction,o)}lookAt(o){return this.direction.copy(o).sub(this.origin).normalize(),this}recast(o){return this.origin.copy(this.at(o,vO)),this}closestPointToPoint(o,t){t.subVectors(o,this.origin);let e=t.dot(this.direction);return e<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,e)}distanceToPoint(o){return Math.sqrt(this.distanceSqToPoint(o))}distanceSqToPoint(o){let t=vO.subVectors(o,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(o):(vO.copy(this.origin).addScaledVector(this.direction,t),vO.distanceToSquared(o))}distanceSqToSegment(o,t,e,r){Rye.copy(o).add(t).multiplyScalar(.5),tJ.copy(t).sub(o).normalize(),Pv.copy(this.origin).sub(Rye);let i=o.distanceTo(t)*.5,n=-this.direction.dot(tJ),s=Pv.dot(this.direction),a=-Pv.dot(tJ),l=Pv.lengthSq(),c=Math.abs(1-n*n),h,u,d,p;if(c>0)if(h=n*a-s,u=n*s-a,p=i*c,h>=0)if(u>=-p)if(u<=p){let m=1/c;h*=m,u*=m,d=h*(h+n*u+2*s)+u*(n*h+u+2*a)+l}else u=i,h=Math.max(0,-(n*u+s)),d=-h*h+u*(u+2*a)+l;else u=-i,h=Math.max(0,-(n*u+s)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-n*i+s)),u=h>0?-i:Math.min(Math.max(-i,-a),i),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-i,-a),i),d=u*(u+2*a)+l):(h=Math.max(0,-(n*i+s)),u=h>0?i:Math.min(Math.max(-i,-a),i),d=-h*h+u*(u+2*a)+l);else u=n>0?-i:i,h=Math.max(0,-(n*u+s)),d=-h*h+u*(u+2*a)+l;return e&&e.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(Rye).addScaledVector(tJ,u),d}intersectSphere(o,t){vO.subVectors(o.center,this.origin);let e=vO.dot(this.direction),r=vO.dot(vO)-e*e,i=o.radius*o.radius;if(r>i)return null;let n=Math.sqrt(i-r),s=e-n,a=e+n;return a<0?null:s<0?this.at(a,t):this.at(s,t)}intersectsSphere(o){return this.distanceSqToPoint(o.center)<=o.radius*o.radius}distanceToPlane(o){let t=o.normal.dot(this.direction);if(t===0)return o.distanceToPoint(this.origin)===0?0:null;let e=-(this.origin.dot(o.normal)+o.constant)/t;return e>=0?e:null}intersectPlane(o,t){let e=this.distanceToPlane(o);return e===null?null:this.at(e,t)}intersectsPlane(o){let t=o.distanceToPoint(this.origin);return t===0||o.normal.dot(this.direction)*t<0}intersectBox(o,t){let e,r,i,n,s,a,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(e=(o.min.x-u.x)*l,r=(o.max.x-u.x)*l):(e=(o.max.x-u.x)*l,r=(o.min.x-u.x)*l),c>=0?(i=(o.min.y-u.y)*c,n=(o.max.y-u.y)*c):(i=(o.max.y-u.y)*c,n=(o.min.y-u.y)*c),e>n||i>r||((i>e||isNaN(e))&&(e=i),(n<r||isNaN(r))&&(r=n),h>=0?(s=(o.min.z-u.z)*h,a=(o.max.z-u.z)*h):(s=(o.max.z-u.z)*h,a=(o.min.z-u.z)*h),e>a||s>r)||((s>e||e!==e)&&(e=s),(a<r||r!==r)&&(r=a),r<0)?null:this.at(e>=0?e:r,t)}intersectsBox(o){return this.intersectBox(o,vO)!==null}intersectTriangle(o,t,e,r,i){Dye.subVectors(t,o),rJ.subVectors(e,o),wye.crossVectors(Dye,rJ);let n=this.direction.dot(wye),s;if(n>0){if(r)return null;s=1}else if(n<0)s=-1,n=-n;else return null;Pv.subVectors(this.origin,o);let a=s*this.direction.dot(rJ.crossVectors(Pv,rJ));if(a<0)return null;let l=s*this.direction.dot(Dye.cross(Pv));if(l<0||a+l>n)return null;let c=-s*Pv.dot(wye);return c<0?null:this.at(c/n,i)}applyMatrix4(o){return this.origin.applyMatrix4(o),this.direction.transformDirection(o),this}equals(o){return o.origin.equals(this.origin)&&o.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},fh=class _be{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y){_be.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y)}set(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y){let b=this.elements;return b[0]=t,b[4]=e,b[8]=r,b[12]=i,b[1]=n,b[5]=s,b[9]=a,b[13]=l,b[2]=c,b[6]=h,b[10]=u,b[14]=d,b[3]=p,b[7]=m,b[11]=g,b[15]=y,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new _be().fromArray(this.elements)}copy(t){let e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],this}copyPosition(t){let e=this.elements,r=t.elements;return e[12]=r[12],e[13]=r[13],e[14]=r[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,r){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,r=t.elements,i=1/B7.setFromMatrixColumn(t,0).length(),n=1/B7.setFromMatrixColumn(t,1).length(),s=1/B7.setFromMatrixColumn(t,2).length();return e[0]=r[0]*i,e[1]=r[1]*i,e[2]=r[2]*i,e[3]=0,e[4]=r[4]*n,e[5]=r[5]*n,e[6]=r[6]*n,e[7]=0,e[8]=r[8]*s,e[9]=r[9]*s,e[10]=r[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,r=t.x,i=t.y,n=t.z,s=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),h=Math.cos(n),u=Math.sin(n);if(t.order==="XYZ"){let d=s*h,p=s*u,m=a*h,g=a*u;e[0]=l*h,e[4]=-l*u,e[8]=c,e[1]=p+m*c,e[5]=d-g*c,e[9]=-a*l,e[2]=g-d*c,e[6]=m+p*c,e[10]=s*l}else if(t.order==="YXZ"){let d=l*h,p=l*u,m=c*h,g=c*u;e[0]=d+g*a,e[4]=m*a-p,e[8]=s*c,e[1]=s*u,e[5]=s*h,e[9]=-a,e[2]=p*a-m,e[6]=g+d*a,e[10]=s*l}else if(t.order==="ZXY"){let d=l*h,p=l*u,m=c*h,g=c*u;e[0]=d-g*a,e[4]=-s*u,e[8]=m+p*a,e[1]=p+m*a,e[5]=s*h,e[9]=g-d*a,e[2]=-s*c,e[6]=a,e[10]=s*l}else if(t.order==="ZYX"){let d=s*h,p=s*u,m=a*h,g=a*u;e[0]=l*h,e[4]=m*c-p,e[8]=d*c+g,e[1]=l*u,e[5]=g*c+d,e[9]=p*c-m,e[2]=-c,e[6]=a*l,e[10]=s*l}else if(t.order==="YZX"){let d=s*l,p=s*c,m=a*l,g=a*c;e[0]=l*h,e[4]=g-d*u,e[8]=m*u+p,e[1]=u,e[5]=s*h,e[9]=-a*h,e[2]=-c*h,e[6]=p*u+m,e[10]=d-g*u}else if(t.order==="XZY"){let d=s*l,p=s*c,m=a*l,g=a*c;e[0]=l*h,e[4]=-u,e[8]=c*h,e[1]=d*u+g,e[5]=s*h,e[9]=p*u-m,e[2]=m*u-p,e[6]=a*h,e[10]=g*u+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Lst,t,Mst)}lookAt(t,e,r){let i=this.elements;return WP.subVectors(t,e),WP.lengthSq()===0&&(WP.z=1),WP.normalize(),Tv.crossVectors(r,WP),Tv.lengthSq()===0&&(Math.abs(r.z)===1?WP.x+=1e-4:WP.z+=1e-4,WP.normalize(),Tv.crossVectors(r,WP)),Tv.normalize(),iJ.crossVectors(WP,Tv),i[0]=Tv.x,i[4]=iJ.x,i[8]=WP.x,i[1]=Tv.y,i[5]=iJ.y,i[9]=WP.y,i[2]=Tv.z,i[6]=iJ.z,i[10]=WP.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let r=t.elements,i=e.elements,n=this.elements,s=r[0],a=r[4],l=r[8],c=r[12],h=r[1],u=r[5],d=r[9],p=r[13],m=r[2],g=r[6],y=r[10],b=r[14],P=r[3],T=r[7],I=r[11],C=r[15],E=i[0],O=i[4],_=i[8],R=i[12],v=i[1],D=i[5],w=i[9],F=i[13],H=i[2],z=i[6],G=i[10],W=i[14],L=i[3],B=i[7],N=i[11],U=i[15];return n[0]=s*E+a*v+l*H+c*L,n[4]=s*O+a*D+l*z+c*B,n[8]=s*_+a*w+l*G+c*N,n[12]=s*R+a*F+l*W+c*U,n[1]=h*E+u*v+d*H+p*L,n[5]=h*O+u*D+d*z+p*B,n[9]=h*_+u*w+d*G+p*N,n[13]=h*R+u*F+d*W+p*U,n[2]=m*E+g*v+y*H+b*L,n[6]=m*O+g*D+y*z+b*B,n[10]=m*_+g*w+y*G+b*N,n[14]=m*R+g*F+y*W+b*U,n[3]=P*E+T*v+I*H+C*L,n[7]=P*O+T*D+I*z+C*B,n[11]=P*_+T*w+I*G+C*N,n[15]=P*R+T*F+I*W+C*U,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],s=t[1],a=t[5],l=t[9],c=t[13],h=t[2],u=t[6],d=t[10],p=t[14],m=t[3],g=t[7],y=t[11],b=t[15];return m*(+n*l*u-i*c*u-n*a*d+r*c*d+i*a*p-r*l*p)+g*(+e*l*p-e*c*d+n*s*d-i*s*p+i*c*h-n*l*h)+y*(+e*c*u-e*a*p-n*s*u+r*s*p+n*a*h-r*c*h)+b*(-i*a*h-e*l*u+e*a*d+i*s*u-r*s*d+r*l*h)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,r){let i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=r),this}invert(){let t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],s=t[4],a=t[5],l=t[6],c=t[7],h=t[8],u=t[9],d=t[10],p=t[11],m=t[12],g=t[13],y=t[14],b=t[15],P=u*y*c-g*d*c+g*l*p-a*y*p-u*l*b+a*d*b,T=m*d*c-h*y*c-m*l*p+s*y*p+h*l*b-s*d*b,I=h*g*c-m*u*c+m*a*p-s*g*p-h*a*b+s*u*b,C=m*u*l-h*g*l-m*a*d+s*g*d+h*a*y-s*u*y,E=e*P+r*T+i*I+n*C;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let O=1/E;return t[0]=P*O,t[1]=(g*d*n-u*y*n-g*i*p+r*y*p+u*i*b-r*d*b)*O,t[2]=(a*y*n-g*l*n+g*i*c-r*y*c-a*i*b+r*l*b)*O,t[3]=(u*l*n-a*d*n-u*i*c+r*d*c+a*i*p-r*l*p)*O,t[4]=T*O,t[5]=(h*y*n-m*d*n+m*i*p-e*y*p-h*i*b+e*d*b)*O,t[6]=(m*l*n-s*y*n-m*i*c+e*y*c+s*i*b-e*l*b)*O,t[7]=(s*d*n-h*l*n+h*i*c-e*d*c-s*i*p+e*l*p)*O,t[8]=I*O,t[9]=(m*u*n-h*g*n-m*r*p+e*g*p+h*r*b-e*u*b)*O,t[10]=(s*g*n-m*a*n+m*r*c-e*g*c-s*r*b+e*a*b)*O,t[11]=(h*a*n-s*u*n-h*r*c+e*u*c+s*r*p-e*a*p)*O,t[12]=C*O,t[13]=(h*g*i-m*u*i+m*r*d-e*g*d-h*r*y+e*u*y)*O,t[14]=(m*a*i-s*g*i-m*r*l+e*g*l+s*r*y-e*a*y)*O,t[15]=(s*u*i-h*a*i+h*r*l-e*u*l-s*r*d+e*a*d)*O,this}scale(t){let e=this.elements,r=t.x,i=t.y,n=t.z;return e[0]*=r,e[4]*=i,e[8]*=n,e[1]*=r,e[5]*=i,e[9]*=n,e[2]*=r,e[6]*=i,e[10]*=n,e[3]*=r,e[7]*=i,e[11]*=n,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],r=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,r,i))}makeTranslation(t,e,r){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,r,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,-r,0,0,r,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),r=Math.sin(t);return this.set(e,0,r,0,0,1,0,0,-r,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,0,r,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let r=Math.cos(e),i=Math.sin(e),n=1-r,s=t.x,a=t.y,l=t.z,c=n*s,h=n*a;return this.set(c*s+r,c*a-i*l,c*l+i*a,0,c*a+i*l,h*a+r,h*l-i*s,0,c*l-i*a,h*l+i*s,n*l*l+r,0,0,0,0,1),this}makeScale(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1),this}makeShear(t,e,r,i,n,s){return this.set(1,r,n,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,r){let i=this.elements,n=e._x,s=e._y,a=e._z,l=e._w,c=n+n,h=s+s,u=a+a,d=n*c,p=n*h,m=n*u,g=s*h,y=s*u,b=a*u,P=l*c,T=l*h,I=l*u,C=r.x,E=r.y,O=r.z;return i[0]=(1-(g+b))*C,i[1]=(p+I)*C,i[2]=(m-T)*C,i[3]=0,i[4]=(p-I)*E,i[5]=(1-(d+b))*E,i[6]=(y+P)*E,i[7]=0,i[8]=(m+T)*O,i[9]=(y-P)*O,i[10]=(1-(d+g))*O,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,r){let i=this.elements,n=B7.set(i[0],i[1],i[2]).length(),s=B7.set(i[4],i[5],i[6]).length(),a=B7.set(i[8],i[9],i[10]).length();this.determinant()<0&&(n=-n),t.x=i[12],t.y=i[13],t.z=i[14],hS.copy(this);let l=1/n,c=1/s,h=1/a;return hS.elements[0]*=l,hS.elements[1]*=l,hS.elements[2]*=l,hS.elements[4]*=c,hS.elements[5]*=c,hS.elements[6]*=c,hS.elements[8]*=h,hS.elements[9]*=h,hS.elements[10]*=h,e.setFromRotationMatrix(hS),r.x=n,r.y=s,r.z=a,this}makePerspective(t,e,r,i,n,s,a=DL){let l=this.elements,c=2*n/(e-t),h=2*n/(r-i),u=(e+t)/(e-t),d=(r+i)/(r-i),p,m;if(a===DL)p=-(s+n)/(s-n),m=-2*s*n/(s-n);else if(a===Abe)p=-s/(s-n),m=-s*n/(s-n);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,r,i,n,s,a=DL){let l=this.elements,c=1/(e-t),h=1/(r-i),u=1/(s-n),d=(e+t)*c,p=(r+i)*h,m,g;if(a===DL)m=(s+n)*u,g=-2*u;else if(a===Abe)m=n*u,g=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=g,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){let e=this.elements,r=t.elements;for(let i=0;i<16;i++)if(e[i]!==r[i])return!1;return!0}fromArray(t,e=0){for(let r=0;r<16;r++)this.elements[r]=t[r+e];return this}toArray(t=[],e=0){let r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t}},B7=new wt,hS=new fh,Lst=new wt(0,0,0),Mst=new wt(1,1,1),Tv=new wt,iJ=new wt,WP=new wt,VRe=new fh,GRe=new kv,wW=class QLe{constructor(t=0,e=0,r=0,i=QLe.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=r,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,r,i=this._order){return this._x=t,this._y=e,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,r=!0){let i=t.elements,n=i[0],s=i[4],a=i[8],l=i[1],c=i[5],h=i[9],u=i[2],d=i[6],p=i[10];switch(e){case"XYZ":this._y=Math.asin(vl(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-s,n)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-vl(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,n),this._z=0);break;case"ZXY":this._x=Math.asin(vl(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(l,n));break;case"ZYX":this._y=Math.asin(-vl(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,n)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(vl(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,n)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-vl(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,n)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,r===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,r){return VRe.makeRotationFromQuaternion(t),this.setFromRotationMatrix(VRe,e,r)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return GRe.setFromEuler(this),this.setFromQuaternion(GRe,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};wW.DEFAULT_ORDER="XYZ";var Nst=class{constructor(){this.mask=1}set(o){this.mask=(1<<o|0)>>>0}enable(o){this.mask|=1<<o|0}enableAll(){this.mask=-1}toggle(o){this.mask^=1<<o|0}disable(o){this.mask&=~(1<<o|0)}disableAll(){this.mask=0}test(o){return(this.mask&o.mask)!==0}isEnabled(o){return(this.mask&(1<<o|0))!==0}},kst=0,URe=new wt,F7=new kv,xO=new fh,nJ=new wt,rW=new wt,Bst=new wt,Fst=new kv,HRe=new wt(1,0,0),WRe=new wt(0,1,0),zRe=new wt(0,0,1),YRe={type:"added"},Vst={type:"removed"},V7={type:"childadded",child:null},Lye={type:"childremoved",child:null},dk=class kJ extends uQ{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:kst++}),this.uuid=uk(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=kJ.DEFAULT_UP.clone();let t=new wt,e=new wW,r=new kv,i=new wt(1,1,1);function n(){r.setFromEuler(e,!1)}function s(){e.setFromQuaternion(r,void 0,!1)}e._onChange(n),r._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new fh},normalMatrix:{value:new Ul}}),this.matrix=new fh,this.matrixWorld=new fh,this.matrixAutoUpdate=kJ.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=kJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Nst,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return F7.setFromAxisAngle(t,e),this.quaternion.multiply(F7),this}rotateOnWorldAxis(t,e){return F7.setFromAxisAngle(t,e),this.quaternion.premultiply(F7),this}rotateX(t){return this.rotateOnAxis(HRe,t)}rotateY(t){return this.rotateOnAxis(WRe,t)}rotateZ(t){return this.rotateOnAxis(zRe,t)}translateOnAxis(t,e){return URe.copy(t).applyQuaternion(this.quaternion),this.position.add(URe.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(HRe,t)}translateY(t){return this.translateOnAxis(WRe,t)}translateZ(t){return this.translateOnAxis(zRe,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(xO.copy(this.matrixWorld).invert())}lookAt(t,e,r){t.isVector3?nJ.copy(t):nJ.set(t,e,r);let i=this.parent;this.updateWorldMatrix(!0,!1),rW.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?xO.lookAt(rW,nJ,this.up):xO.lookAt(nJ,rW,this.up),this.quaternion.setFromRotationMatrix(xO),i&&(xO.extractRotation(i.matrixWorld),F7.setFromRotationMatrix(xO),this.quaternion.premultiply(F7.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(YRe),V7.child=t,this.dispatchEvent(V7),V7.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Vst),Lye.child=t,this.dispatchEvent(Lye),Lye.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),xO.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),xO.multiply(t.parent.matrixWorld)),t.applyMatrix4(xO),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(YRe),V7.child=t,this.dispatchEvent(V7),V7.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let r=0,i=this.children.length;r<i;r++){let n=this.children[r].getObjectByProperty(t,e);if(n!==void 0)return n}}getObjectsByProperty(t,e,r=[]){this[t]===e&&r.push(this);let i=this.children;for(let n=0,s=i.length;n<s;n++)i[n].getObjectsByProperty(t,e,r);return r}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rW,t,Bst),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rW,Fst,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let r=0,i=e.length;r<i;r++)e[r].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let r=0,i=e.length;r<i;r++)e[r].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let r=0,i=e.length;r<i;r++)e[r].updateMatrixWorld(t)}updateWorldMatrix(t,e){let r=this.parent;if(t===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){let i=this.children;for(let n=0,s=i.length;n<s;n++)i[n].updateWorldMatrix(!1,!0)}}toJSON(t){let e=t===void 0||typeof t=="string",r={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function n(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=n(t.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){let u=l[c];n(t.shapes,u)}else n(t.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(n(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(n(t.materials,this.material[l]));i.material=a}else i.material=n(t.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];i.animations.push(n(t.animations,l))}}if(e){let a=s(t.geometries),l=s(t.materials),c=s(t.textures),h=s(t.images),u=s(t.shapes),d=s(t.skeletons),p=s(t.animations),m=s(t.nodes);a.length>0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),h.length>0&&(r.images=h),u.length>0&&(r.shapes=u),d.length>0&&(r.skeletons=d),p.length>0&&(r.animations=p),m.length>0&&(r.nodes=m)}return r.object=i,r;function s(a){let l=[];for(let c in a){let h=a[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let r=0;r<t.children.length;r++){let i=t.children[r];this.add(i.clone())}return this}};dk.DEFAULT_UP=new wt(0,1,0);dk.DEFAULT_MATRIX_AUTO_UPDATE=!0;dk.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var uS=new wt,RO=new wt,Mye=new wt,DO=new wt,G7=new wt,U7=new wt,jRe=new wt,Nye=new wt,kye=new wt,Bye=new wt,Fye=new DW,Vye=new DW,Gye=new DW,X7=class q7{constructor(t=new wt,e=new wt,r=new wt){this.a=t,this.b=e,this.c=r}static getNormal(t,e,r,i){i.subVectors(r,e),uS.subVectors(t,e),i.cross(uS);let n=i.lengthSq();return n>0?i.multiplyScalar(1/Math.sqrt(n)):i.set(0,0,0)}static getBarycoord(t,e,r,i,n){uS.subVectors(i,e),RO.subVectors(r,e),Mye.subVectors(t,e);let s=uS.dot(uS),a=uS.dot(RO),l=uS.dot(Mye),c=RO.dot(RO),h=RO.dot(Mye),u=s*c-a*a;if(u===0)return n.set(0,0,0),null;let d=1/u,p=(c*l-a*h)*d,m=(s*h-a*l)*d;return n.set(1-p-m,m,p)}static containsPoint(t,e,r,i){return this.getBarycoord(t,e,r,i,DO)===null?!1:DO.x>=0&&DO.y>=0&&DO.x+DO.y<=1}static getInterpolation(t,e,r,i,n,s,a,l){return this.getBarycoord(t,e,r,i,DO)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(n,DO.x),l.addScaledVector(s,DO.y),l.addScaledVector(a,DO.z),l)}static getInterpolatedAttribute(t,e,r,i,n,s){return Fye.setScalar(0),Vye.setScalar(0),Gye.setScalar(0),Fye.fromBufferAttribute(t,e),Vye.fromBufferAttribute(t,r),Gye.fromBufferAttribute(t,i),s.setScalar(0),s.addScaledVector(Fye,n.x),s.addScaledVector(Vye,n.y),s.addScaledVector(Gye,n.z),s}static isFrontFacing(t,e,r,i){return uS.subVectors(r,e),RO.subVectors(t,e),uS.cross(RO).dot(i)<0}set(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this}setFromPointsAndIndices(t,e,r,i){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,r,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,r),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return uS.subVectors(this.c,this.b),RO.subVectors(this.a,this.b),uS.cross(RO).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return q7.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return q7.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,r,i,n){return q7.getInterpolation(t,this.a,this.b,this.c,e,r,i,n)}containsPoint(t){return q7.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return q7.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let r=this.a,i=this.b,n=this.c,s,a;G7.subVectors(i,r),U7.subVectors(n,r),Nye.subVectors(t,r);let l=G7.dot(Nye),c=U7.dot(Nye);if(l<=0&&c<=0)return e.copy(r);kye.subVectors(t,i);let h=G7.dot(kye),u=U7.dot(kye);if(h>=0&&u<=h)return e.copy(i);let d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return s=l/(l-h),e.copy(r).addScaledVector(G7,s);Bye.subVectors(t,n);let p=G7.dot(Bye),m=U7.dot(Bye);if(m>=0&&p<=m)return e.copy(n);let g=p*c-l*m;if(g<=0&&c>=0&&m<=0)return a=c/(c-m),e.copy(r).addScaledVector(U7,a);let y=h*m-p*u;if(y<=0&&u-h>=0&&p-m>=0)return jRe.subVectors(n,i),a=(u-h)/(u-h+(p-m)),e.copy(i).addScaledVector(jRe,a);let b=1/(y+g+d);return s=g*b,a=d*b,e.copy(r).addScaledVector(G7,s).addScaledVector(U7,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},eMe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Iv={h:0,s:0,l:0},oJ={h:0,s:0,l:0};function Uye(o,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?o+(t-o)*6*e:e<1/2?t:e<2/3?o+(t-o)*6*(2/3-e):o}var Cf=class{constructor(o,t,e){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(o,t,e)}set(o,t,e){if(t===void 0&&e===void 0){let r=o;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(o,t,e);return this}setScalar(o){return this.r=o,this.g=o,this.b=o,this}setHex(o,t=dS){return o=Math.floor(o),this.r=(o>>16&255)/255,this.g=(o>>8&255)/255,this.b=(o&255)/255,lS.toWorkingColorSpace(this,t),this}setRGB(o,t,e,r=lS.workingColorSpace){return this.r=o,this.g=t,this.b=e,lS.toWorkingColorSpace(this,r),this}setHSL(o,t,e,r=lS.workingColorSpace){if(o=Sst(o,1),t=vl(t,0,1),e=vl(e,0,1),t===0)this.r=this.g=this.b=e;else{let i=e<=.5?e*(1+t):e+t-e*t,n=2*e-i;this.r=Uye(n,i,o+1/3),this.g=Uye(n,i,o),this.b=Uye(n,i,o-1/3)}return lS.toWorkingColorSpace(this,r),this}setStyle(o,t=dS){function e(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+o+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(o)){let i,n=r[1],s=r[2];switch(n){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return e(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return e(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return e(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+o)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(o)){let i=r[1],n=i.length;if(n===3)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(n===6)return this.setHex(parseInt(i,16),t);console.warn("THREE.Color: Invalid hex color "+o)}else if(o&&o.length>0)return this.setColorName(o,t);return this}setColorName(o,t=dS){let e=eMe[o.toLowerCase()];return e!==void 0?this.setHex(e,t):console.warn("THREE.Color: Unknown color "+o),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(o){return this.r=o.r,this.g=o.g,this.b=o.b,this}copySRGBToLinear(o){return this.r=BO(o.r),this.g=BO(o.g),this.b=BO(o.b),this}copyLinearToSRGB(o){return this.r=rk(o.r),this.g=rk(o.g),this.b=rk(o.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(o=dS){return lS.fromWorkingColorSpace(Iy.copy(this),o),Math.round(vl(Iy.r*255,0,255))*65536+Math.round(vl(Iy.g*255,0,255))*256+Math.round(vl(Iy.b*255,0,255))}getHexString(o=dS){return("000000"+this.getHex(o).toString(16)).slice(-6)}getHSL(o,t=lS.workingColorSpace){lS.fromWorkingColorSpace(Iy.copy(this),t);let e=Iy.r,r=Iy.g,i=Iy.b,n=Math.max(e,r,i),s=Math.min(e,r,i),a,l,c=(s+n)/2;if(s===n)a=0,l=0;else{let h=n-s;switch(l=c<=.5?h/(n+s):h/(2-n-s),n){case e:a=(r-i)/h+(r<i?6:0);break;case r:a=(i-e)/h+2;break;case i:a=(e-r)/h+4;break}a/=6}return o.h=a,o.s=l,o.l=c,o}getRGB(o,t=lS.workingColorSpace){return lS.fromWorkingColorSpace(Iy.copy(this),t),o.r=Iy.r,o.g=Iy.g,o.b=Iy.b,o}getStyle(o=dS){lS.fromWorkingColorSpace(Iy.copy(this),o);let t=Iy.r,e=Iy.g,r=Iy.b;return o!==dS?`color(${o} ${t.toFixed(3)} ${e.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(e*255)},${Math.round(r*255)})`}offsetHSL(o,t,e){return this.getHSL(Iv),this.setHSL(Iv.h+o,Iv.s+t,Iv.l+e)}add(o){return this.r+=o.r,this.g+=o.g,this.b+=o.b,this}addColors(o,t){return this.r=o.r+t.r,this.g=o.g+t.g,this.b=o.b+t.b,this}addScalar(o){return this.r+=o,this.g+=o,this.b+=o,this}sub(o){return this.r=Math.max(0,this.r-o.r),this.g=Math.max(0,this.g-o.g),this.b=Math.max(0,this.b-o.b),this}multiply(o){return this.r*=o.r,this.g*=o.g,this.b*=o.b,this}multiplyScalar(o){return this.r*=o,this.g*=o,this.b*=o,this}lerp(o,t){return this.r+=(o.r-this.r)*t,this.g+=(o.g-this.g)*t,this.b+=(o.b-this.b)*t,this}lerpColors(o,t,e){return this.r=o.r+(t.r-o.r)*e,this.g=o.g+(t.g-o.g)*e,this.b=o.b+(t.b-o.b)*e,this}lerpHSL(o,t){this.getHSL(Iv),o.getHSL(oJ);let e=Eye(Iv.h,oJ.h,t),r=Eye(Iv.s,oJ.s,t),i=Eye(Iv.l,oJ.l,t);return this.setHSL(e,r,i),this}setFromVector3(o){return this.r=o.x,this.g=o.y,this.b=o.z,this}applyMatrix3(o){let t=this.r,e=this.g,r=this.b,i=o.elements;return this.r=i[0]*t+i[3]*e+i[6]*r,this.g=i[1]*t+i[4]*e+i[7]*r,this.b=i[2]*t+i[5]*e+i[8]*r,this}equals(o){return o.r===this.r&&o.g===this.g&&o.b===this.b}fromArray(o,t=0){return this.r=o[t],this.g=o[t+1],this.b=o[t+2],this}toArray(o=[],t=0){return o[t]=this.r,o[t+1]=this.g,o[t+2]=this.b,o}fromBufferAttribute(o,t){return this.r=o.getX(t),this.g=o.getY(t),this.b=o.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Iy=new Cf;Cf.NAMES=eMe;var Gst=0,Ust=class extends uQ{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Gst++}),this.uuid=uk(),this.name="",this.type="Material",this.blending=mRe,this.side=Sbe,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=yRe,this.blendDst=bRe,this.blendEquation=gRe,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Cf(0,0,0),this.blendAlpha=0,this.depthFunc=XJ,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=LRe,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=w7,this.stencilZFail=w7,this.stencilZPass=w7,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(o){this._alphaTest>0!=o>0&&this.version++,this._alphaTest=o}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(o){if(o!==void 0)for(let t in o){let e=o[t];if(e===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(e):r&&r.isVector3&&e&&e.isVector3?r.copy(e):this[t]=e}}toJSON(o){let t=o===void 0||typeof o=="string";t&&(o={textures:{},images:{}});let e={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),this.color&&this.color.isColor&&(e.color=this.color.getHex()),this.roughness!==void 0&&(e.roughness=this.roughness),this.metalness!==void 0&&(e.metalness=this.metalness),this.sheen!==void 0&&(e.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(e.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(e.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(e.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(e.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(e.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(e.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(e.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(e.shininess=this.shininess),this.clearcoat!==void 0&&(e.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(e.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(e.clearcoatMap=this.clearcoatMap.toJSON(o).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(e.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(o).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(e.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(o).uuid,e.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(e.dispersion=this.dispersion),this.iridescence!==void 0&&(e.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(e.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(e.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(e.iridescenceMap=this.iridescenceMap.toJSON(o).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(e.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(o).uuid),this.anisotropy!==void 0&&(e.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(e.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(e.anisotropyMap=this.anisotropyMap.toJSON(o).uuid),this.map&&this.map.isTexture&&(e.map=this.map.toJSON(o).uuid),this.matcap&&this.matcap.isTexture&&(e.matcap=this.matcap.toJSON(o).uuid),this.alphaMap&&this.alphaMap.isTexture&&(e.alphaMap=this.alphaMap.toJSON(o).uuid),this.lightMap&&this.lightMap.isTexture&&(e.lightMap=this.lightMap.toJSON(o).uuid,e.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(e.aoMap=this.aoMap.toJSON(o).uuid,e.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(e.bumpMap=this.bumpMap.toJSON(o).uuid,e.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(e.normalMap=this.normalMap.toJSON(o).uuid,e.normalMapType=this.normalMapType,e.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(e.displacementMap=this.displacementMap.toJSON(o).uuid,e.displacementScale=this.displacementScale,e.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(e.roughnessMap=this.roughnessMap.toJSON(o).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(e.metalnessMap=this.metalnessMap.toJSON(o).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(e.emissiveMap=this.emissiveMap.toJSON(o).uuid),this.specularMap&&this.specularMap.isTexture&&(e.specularMap=this.specularMap.toJSON(o).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(e.specularIntensityMap=this.specularIntensityMap.toJSON(o).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(e.specularColorMap=this.specularColorMap.toJSON(o).uuid),this.envMap&&this.envMap.isTexture&&(e.envMap=this.envMap.toJSON(o).uuid,this.combine!==void 0&&(e.combine=this.combine)),this.envMapRotation!==void 0&&(e.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(e.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(e.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(e.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(e.gradientMap=this.gradientMap.toJSON(o).uuid),this.transmission!==void 0&&(e.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(e.transmissionMap=this.transmissionMap.toJSON(o).uuid),this.thickness!==void 0&&(e.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(e.thicknessMap=this.thicknessMap.toJSON(o).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(e.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(e.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(e.size=this.size),this.shadowSide!==null&&(e.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(e.sizeAttenuation=this.sizeAttenuation),this.blending!==mRe&&(e.blending=this.blending),this.side!==Sbe&&(e.side=this.side),this.vertexColors===!0&&(e.vertexColors=!0),this.opacity<1&&(e.opacity=this.opacity),this.transparent===!0&&(e.transparent=!0),this.blendSrc!==yRe&&(e.blendSrc=this.blendSrc),this.blendDst!==bRe&&(e.blendDst=this.blendDst),this.blendEquation!==gRe&&(e.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(e.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(e.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(e.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(e.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(e.blendAlpha=this.blendAlpha),this.depthFunc!==XJ&&(e.depthFunc=this.depthFunc),this.depthTest===!1&&(e.depthTest=this.depthTest),this.depthWrite===!1&&(e.depthWrite=this.depthWrite),this.colorWrite===!1&&(e.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(e.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==LRe&&(e.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(e.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(e.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==w7&&(e.stencilFail=this.stencilFail),this.stencilZFail!==w7&&(e.stencilZFail=this.stencilZFail),this.stencilZPass!==w7&&(e.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(e.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(e.rotation=this.rotation),this.polygonOffset===!0&&(e.polygonOffset=!0),this.polygonOffsetFactor!==0&&(e.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(e.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(e.linewidth=this.linewidth),this.dashSize!==void 0&&(e.dashSize=this.dashSize),this.gapSize!==void 0&&(e.gapSize=this.gapSize),this.scale!==void 0&&(e.scale=this.scale),this.dithering===!0&&(e.dithering=!0),this.alphaTest>0&&(e.alphaTest=this.alphaTest),this.alphaHash===!0&&(e.alphaHash=!0),this.alphaToCoverage===!0&&(e.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(e.premultipliedAlpha=!0),this.forceSinglePass===!0&&(e.forceSinglePass=!0),this.wireframe===!0&&(e.wireframe=!0),this.wireframeLinewidth>1&&(e.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(e.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(e.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(e.flatShading=!0),this.visible===!1&&(e.visible=!1),this.toneMapped===!1&&(e.toneMapped=!1),this.fog===!1&&(e.fog=!1),Object.keys(this.userData).length>0&&(e.userData=this.userData);function r(i){let n=[];for(let s in i){let a=i[s];delete a.metadata,n.push(a)}return n}if(t){let i=r(o.textures),n=r(o.images);i.length>0&&(e.textures=i),n.length>0&&(e.images=n)}return e}clone(){return new this.constructor().copy(this)}copy(o){this.name=o.name,this.blending=o.blending,this.side=o.side,this.vertexColors=o.vertexColors,this.opacity=o.opacity,this.transparent=o.transparent,this.blendSrc=o.blendSrc,this.blendDst=o.blendDst,this.blendEquation=o.blendEquation,this.blendSrcAlpha=o.blendSrcAlpha,this.blendDstAlpha=o.blendDstAlpha,this.blendEquationAlpha=o.blendEquationAlpha,this.blendColor.copy(o.blendColor),this.blendAlpha=o.blendAlpha,this.depthFunc=o.depthFunc,this.depthTest=o.depthTest,this.depthWrite=o.depthWrite,this.stencilWriteMask=o.stencilWriteMask,this.stencilFunc=o.stencilFunc,this.stencilRef=o.stencilRef,this.stencilFuncMask=o.stencilFuncMask,this.stencilFail=o.stencilFail,this.stencilZFail=o.stencilZFail,this.stencilZPass=o.stencilZPass,this.stencilWrite=o.stencilWrite;let t=o.clippingPlanes,e=null;if(t!==null){let r=t.length;e=new Array(r);for(let i=0;i!==r;++i)e[i]=t[i].clone()}return this.clippingPlanes=e,this.clipIntersection=o.clipIntersection,this.clipShadows=o.clipShadows,this.shadowSide=o.shadowSide,this.colorWrite=o.colorWrite,this.precision=o.precision,this.polygonOffset=o.polygonOffset,this.polygonOffsetFactor=o.polygonOffsetFactor,this.polygonOffsetUnits=o.polygonOffsetUnits,this.dithering=o.dithering,this.alphaTest=o.alphaTest,this.alphaHash=o.alphaHash,this.alphaToCoverage=o.alphaToCoverage,this.premultipliedAlpha=o.premultipliedAlpha,this.forceSinglePass=o.forceSinglePass,this.visible=o.visible,this.toneMapped=o.toneMapped,this.userData=JSON.parse(JSON.stringify(o.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(o){o===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}},Hst=class extends Ust{constructor(o){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Cf(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new wW,this.combine=gst,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(o)}copy(o){return super.copy(o),this.color.copy(o.color),this.map=o.map,this.lightMap=o.lightMap,this.lightMapIntensity=o.lightMapIntensity,this.aoMap=o.aoMap,this.aoMapIntensity=o.aoMapIntensity,this.specularMap=o.specularMap,this.alphaMap=o.alphaMap,this.envMap=o.envMap,this.envMapRotation.copy(o.envMapRotation),this.combine=o.combine,this.reflectivity=o.reflectivity,this.refractionRatio=o.refractionRatio,this.wireframe=o.wireframe,this.wireframeLinewidth=o.wireframeLinewidth,this.wireframeLinecap=o.wireframeLinecap,this.wireframeLinejoin=o.wireframeLinejoin,this.fog=o.fog,this}},kO=Wst();function Wst(){let o=new ArrayBuffer(4),t=new Float32Array(o),e=new Uint32Array(o),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}let n=new Uint32Array(2048),s=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;(c&8388608)===0;)c<<=1,h-=8388608;c&=-8388609,h+=947912704,n[l]=c|h}for(let l=1024;l<2048;++l)n[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)s[l]=l<<23;s[31]=1199570944,s[32]=2147483648;for(let l=33;l<63;++l)s[l]=2147483648+(l-32<<23);s[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:t,uint32View:e,baseTable:r,shiftTable:i,mantissaTable:n,exponentTable:s,offsetTable:a}}function zst(o){Math.abs(o)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),o=vl(o,-65504,65504),kO.floatView[0]=o;let t=kO.uint32View[0],e=t>>23&511;return kO.baseTable[e]+((t&8388607)>>kO.shiftTable[e])}function Yst(o){let t=o>>10;return kO.uint32View[0]=kO.mantissaTable[kO.offsetTable[t]+(o&1023)]+kO.exponentTable[t],kO.floatView[0]}var sJ={toHalfFloat:zst,fromHalfFloat:Yst},em=new wt,aJ=new En,ik=class{constructor(o,t,e=!1){if(Array.isArray(o))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=o,this.itemSize=t,this.count=o!==void 0?o.length/t:0,this.normalized=e,this.usage=MRe,this.updateRanges=[],this.gpuType=MJ,this.version=0}onUploadCallback(){}set needsUpdate(o){o===!0&&this.version++}setUsage(o){return this.usage=o,this}addUpdateRange(o,t){this.updateRanges.push({start:o,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(o){return this.name=o.name,this.array=new o.array.constructor(o.array),this.itemSize=o.itemSize,this.count=o.count,this.normalized=o.normalized,this.usage=o.usage,this.gpuType=o.gpuType,this}copyAt(o,t,e){o*=this.itemSize,e*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[o+r]=t.array[e+r];return this}copyArray(o){return this.array.set(o),this}applyMatrix3(o){if(this.itemSize===2)for(let t=0,e=this.count;t<e;t++)aJ.fromBufferAttribute(this,t),aJ.applyMatrix3(o),this.setXY(t,aJ.x,aJ.y);else if(this.itemSize===3)for(let t=0,e=this.count;t<e;t++)em.fromBufferAttribute(this,t),em.applyMatrix3(o),this.setXYZ(t,em.x,em.y,em.z);return this}applyMatrix4(o){for(let t=0,e=this.count;t<e;t++)em.fromBufferAttribute(this,t),em.applyMatrix4(o),this.setXYZ(t,em.x,em.y,em.z);return this}applyNormalMatrix(o){for(let t=0,e=this.count;t<e;t++)em.fromBufferAttribute(this,t),em.applyNormalMatrix(o),this.setXYZ(t,em.x,em.y,em.z);return this}transformDirection(o){for(let t=0,e=this.count;t<e;t++)em.fromBufferAttribute(this,t),em.transformDirection(o),this.setXYZ(t,em.x,em.y,em.z);return this}set(o,t=0){return this.array.set(o,t),this}getComponent(o,t){let e=this.array[o*this.itemSize+t];return this.normalized&&(e=QH(e,this.array)),e}setComponent(o,t,e){return this.normalized&&(e=E2(e,this.array)),this.array[o*this.itemSize+t]=e,this}getX(o){let t=this.array[o*this.itemSize];return this.normalized&&(t=QH(t,this.array)),t}setX(o,t){return this.normalized&&(t=E2(t,this.array)),this.array[o*this.itemSize]=t,this}getY(o){let t=this.array[o*this.itemSize+1];return this.normalized&&(t=QH(t,this.array)),t}setY(o,t){return this.normalized&&(t=E2(t,this.array)),this.array[o*this.itemSize+1]=t,this}getZ(o){let t=this.array[o*this.itemSize+2];return this.normalized&&(t=QH(t,this.array)),t}setZ(o,t){return this.normalized&&(t=E2(t,this.array)),this.array[o*this.itemSize+2]=t,this}getW(o){let t=this.array[o*this.itemSize+3];return this.normalized&&(t=QH(t,this.array)),t}setW(o,t){return this.normalized&&(t=E2(t,this.array)),this.array[o*this.itemSize+3]=t,this}setXY(o,t,e){return o*=this.itemSize,this.normalized&&(t=E2(t,this.array),e=E2(e,this.array)),this.array[o+0]=t,this.array[o+1]=e,this}setXYZ(o,t,e,r){return o*=this.itemSize,this.normalized&&(t=E2(t,this.array),e=E2(e,this.array),r=E2(r,this.array)),this.array[o+0]=t,this.array[o+1]=e,this.array[o+2]=r,this}setXYZW(o,t,e,r,i){return o*=this.itemSize,this.normalized&&(t=E2(t,this.array),e=E2(e,this.array),r=E2(r,this.array),i=E2(i,this.array)),this.array[o+0]=t,this.array[o+1]=e,this.array[o+2]=r,this.array[o+3]=i,this}onUpload(o){return this.onUploadCallback=o,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let o={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(o.name=this.name),this.usage!==MRe&&(o.usage=this.usage),o}},jst=class extends ik{constructor(o,t,e){super(new Uint16Array(o),t,e)}},Xst=class extends ik{constructor(o,t,e){super(new Uint32Array(o),t,e)}},dl=class extends ik{constructor(o,t,e){super(new Float32Array(o),t,e)}},qst=0,mI=new fh,Hye=new dk,H7=new wt,zP=new Bv,iW=new Bv,Tg=new wt,Ay=class tMe extends uQ{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:qst++}),this.uuid=uk(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Est(t)?Xst:jst)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,r=0){this.groups.push({start:t,count:e,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let r=this.attributes.normal;if(r!==void 0){let n=new Ul().getNormalMatrix(t);r.applyNormalMatrix(n),r.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(t),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return mI.makeRotationFromQuaternion(t),this.applyMatrix4(mI),this}rotateX(t){return mI.makeRotationX(t),this.applyMatrix4(mI),this}rotateY(t){return mI.makeRotationY(t),this.applyMatrix4(mI),this}rotateZ(t){return mI.makeRotationZ(t),this.applyMatrix4(mI),this}translate(t,e,r){return mI.makeTranslation(t,e,r),this.applyMatrix4(mI),this}scale(t,e,r){return mI.makeScale(t,e,r),this.applyMatrix4(mI),this}lookAt(t){return Hye.lookAt(t),Hye.updateMatrix(),this.applyMatrix4(Hye.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(H7).negate(),this.translate(H7.x,H7.y,H7.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let r=[];for(let i=0,n=t.length;i<n;i++){let s=t[i];r.push(s.x,s.y,s.z||0)}this.setAttribute("position",new dl(r,3))}else{let r=Math.min(t.length,e.count);for(let i=0;i<r;i++){let n=t[i];e.setXYZ(i,n.x,n.y,n.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Bv);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new wt(-1/0,-1/0,-1/0),new wt(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let r=0,i=e.length;r<i;r++){let n=e[r];zP.setFromBufferAttribute(n),this.morphTargetsRelative?(Tg.addVectors(this.boundingBox.min,zP.min),this.boundingBox.expandByPoint(Tg),Tg.addVectors(this.boundingBox.max,zP.max),this.boundingBox.expandByPoint(Tg)):(this.boundingBox.expandByPoint(zP.min),this.boundingBox.expandByPoint(zP.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Fv);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new wt,1/0);return}if(t){let r=this.boundingSphere.center;if(zP.setFromBufferAttribute(t),e)for(let n=0,s=e.length;n<s;n++){let a=e[n];iW.setFromBufferAttribute(a),this.morphTargetsRelative?(Tg.addVectors(zP.min,iW.min),zP.expandByPoint(Tg),Tg.addVectors(zP.max,iW.max),zP.expandByPoint(Tg)):(zP.expandByPoint(iW.min),zP.expandByPoint(iW.max))}zP.getCenter(r);let i=0;for(let n=0,s=t.count;n<s;n++)Tg.fromBufferAttribute(t,n),i=Math.max(i,r.distanceToSquared(Tg));if(e)for(let n=0,s=e.length;n<s;n++){let a=e[n],l=this.morphTargetsRelative;for(let c=0,h=a.count;c<h;c++)Tg.fromBufferAttribute(a,c),l&&(H7.fromBufferAttribute(t,c),Tg.add(H7)),i=Math.max(i,r.distanceToSquared(Tg))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let r=e.position,i=e.normal,n=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ik(new Float32Array(4*r.count),4));let s=this.getAttribute("tangent"),a=[],l=[];for(let _=0;_<r.count;_++)a[_]=new wt,l[_]=new wt;let c=new wt,h=new wt,u=new wt,d=new En,p=new En,m=new En,g=new wt,y=new wt;function b(_,R,v){c.fromBufferAttribute(r,_),h.fromBufferAttribute(r,R),u.fromBufferAttribute(r,v),d.fromBufferAttribute(n,_),p.fromBufferAttribute(n,R),m.fromBufferAttribute(n,v),h.sub(c),u.sub(c),p.sub(d),m.sub(d);let D=1/(p.x*m.y-m.x*p.y);isFinite(D)&&(g.copy(h).multiplyScalar(m.y).addScaledVector(u,-p.y).multiplyScalar(D),y.copy(u).multiplyScalar(p.x).addScaledVector(h,-m.x).multiplyScalar(D),a[_].add(g),a[R].add(g),a[v].add(g),l[_].add(y),l[R].add(y),l[v].add(y))}let P=this.groups;P.length===0&&(P=[{start:0,count:t.count}]);for(let _=0,R=P.length;_<R;++_){let v=P[_],D=v.start,w=v.count;for(let F=D,H=D+w;F<H;F+=3)b(t.getX(F+0),t.getX(F+1),t.getX(F+2))}let T=new wt,I=new wt,C=new wt,E=new wt;function O(_){C.fromBufferAttribute(i,_),E.copy(C);let R=a[_];T.copy(R),T.sub(C.multiplyScalar(C.dot(R))).normalize(),I.crossVectors(E,R);let v=I.dot(l[_])<0?-1:1;s.setXYZW(_,T.x,T.y,T.z,v)}for(let _=0,R=P.length;_<R;++_){let v=P[_],D=v.start,w=v.count;for(let F=D,H=D+w;F<H;F+=3)O(t.getX(F+0)),O(t.getX(F+1)),O(t.getX(F+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new ik(new Float32Array(e.count*3),3),this.setAttribute("normal",r);else for(let d=0,p=r.count;d<p;d++)r.setXYZ(d,0,0,0);let i=new wt,n=new wt,s=new wt,a=new wt,l=new wt,c=new wt,h=new wt,u=new wt;if(t)for(let d=0,p=t.count;d<p;d+=3){let m=t.getX(d+0),g=t.getX(d+1),y=t.getX(d+2);i.fromBufferAttribute(e,m),n.fromBufferAttribute(e,g),s.fromBufferAttribute(e,y),h.subVectors(s,n),u.subVectors(i,n),h.cross(u),a.fromBufferAttribute(r,m),l.fromBufferAttribute(r,g),c.fromBufferAttribute(r,y),a.add(h),l.add(h),c.add(h),r.setXYZ(m,a.x,a.y,a.z),r.setXYZ(g,l.x,l.y,l.z),r.setXYZ(y,c.x,c.y,c.z)}else for(let d=0,p=e.count;d<p;d+=3)i.fromBufferAttribute(e,d+0),n.fromBufferAttribute(e,d+1),s.fromBufferAttribute(e,d+2),h.subVectors(s,n),u.subVectors(i,n),h.cross(u),r.setXYZ(d+0,h.x,h.y,h.z),r.setXYZ(d+1,h.x,h.y,h.z),r.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,r=t.count;e<r;e++)Tg.fromBufferAttribute(t,e),Tg.normalize(),t.setXYZ(e,Tg.x,Tg.y,Tg.z)}toNonIndexed(){function t(a,l){let c=a.array,h=a.itemSize,u=a.normalized,d=new c.constructor(l.length*h),p=0,m=0;for(let g=0,y=l.length;g<y;g++){a.isInterleavedBufferAttribute?p=l[g]*a.data.stride+a.offset:p=l[g]*h;for(let b=0;b<h;b++)d[m++]=c[p++]}return new ik(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new tMe,r=this.index.array,i=this.attributes;for(let a in i){let l=i[a],c=t(l,r);e.setAttribute(a,c)}let n=this.morphAttributes;for(let a in n){let l=[],c=n[a];for(let h=0,u=c.length;h<u;h++){let d=c[h],p=t(d,r);l.push(p)}e.morphAttributes[a]=l}e.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let a=0,l=s.length;a<l;a++){let c=s[a];e.addGroup(c.start,c.count,c.materialIndex)}return e}toJSON(){let t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let r=this.attributes;for(let l in r){let c=r[l];t.data.attributes[l]=c.toJSON(t.data)}let i={},n=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],h=[];for(let u=0,d=c.length;u<d;u++){let p=c[u];h.push(p.toJSON(t.data))}h.length>0&&(i[l]=h,n=!0)}n&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));let a=this.boundingSphere;return a!==null&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let r=t.index;r!==null&&this.setIndex(r.clone(e));let i=t.attributes;for(let c in i){let h=i[c];this.setAttribute(c,h.clone(e))}let n=t.morphAttributes;for(let c in n){let h=[],u=n[c];for(let d=0,p=u.length;d<p;d++)h.push(u[d].clone(e));this.morphAttributes[c]=h}this.morphTargetsRelative=t.morphTargetsRelative;let s=t.groups;for(let c=0,h=s.length;c<h;c++){let u=s[c];this.addGroup(u.start,u.count,u.materialIndex)}let a=t.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},XRe=new fh,CL=new dQ,lJ=new Fv,qRe=new wt,cJ=new wt,hJ=new wt,uJ=new wt,Wye=new wt,dJ=new wt,$Re=new wt,pJ=new wt,rMe=class extends dk{constructor(o=new Ay,t=new Hst){super(),this.isMesh=!0,this.type="Mesh",this.geometry=o,this.material=t,this.updateMorphTargets()}copy(o,t){return super.copy(o,t),o.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=o.morphTargetInfluences.slice()),o.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},o.morphTargetDictionary)),this.material=Array.isArray(o.material)?o.material.slice():o.material,this.geometry=o.geometry,this}updateMorphTargets(){let o=this.geometry.morphAttributes,t=Object.keys(o);if(t.length>0){let e=o[t[0]];if(e!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,i=e.length;r<i;r++){let n=e[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=r}}}}getVertexPosition(o,t){let e=this.geometry,r=e.attributes.position,i=e.morphAttributes.position,n=e.morphTargetsRelative;t.fromBufferAttribute(r,o);let s=this.morphTargetInfluences;if(i&&s){dJ.set(0,0,0);for(let a=0,l=i.length;a<l;a++){let c=s[a],h=i[a];c!==0&&(Wye.fromBufferAttribute(h,o),n?dJ.addScaledVector(Wye,c):dJ.addScaledVector(Wye.sub(t),c))}t.add(dJ)}return t}raycast(o,t){let e=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(e.boundingSphere===null&&e.computeBoundingSphere(),lJ.copy(e.boundingSphere),lJ.applyMatrix4(i),CL.copy(o.ray).recast(o.near),!(lJ.containsPoint(CL.origin)===!1&&(CL.intersectSphere(lJ,qRe)===null||CL.origin.distanceToSquared(qRe)>(o.far-o.near)**2))&&(XRe.copy(i).invert(),CL.copy(o.ray).applyMatrix4(XRe),!(e.boundingBox!==null&&CL.intersectsBox(e.boundingBox)===!1)&&this._computeIntersections(o,t,CL)))}_computeIntersections(o,t,e){let r,i=this.geometry,n=this.material,s=i.index,a=i.attributes.position,l=i.attributes.uv,c=i.attributes.uv1,h=i.attributes.normal,u=i.groups,d=i.drawRange;if(s!==null)if(Array.isArray(n))for(let p=0,m=u.length;p<m;p++){let g=u[p],y=n[g.materialIndex],b=Math.max(g.start,d.start),P=Math.min(s.count,Math.min(g.start+g.count,d.start+d.count));for(let T=b,I=P;T<I;T+=3){let C=s.getX(T),E=s.getX(T+1),O=s.getX(T+2);r=fJ(this,y,o,e,l,c,h,C,E,O),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{let p=Math.max(0,d.start),m=Math.min(s.count,d.start+d.count);for(let g=p,y=m;g<y;g+=3){let b=s.getX(g),P=s.getX(g+1),T=s.getX(g+2);r=fJ(this,n,o,e,l,c,h,b,P,T),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(a!==void 0)if(Array.isArray(n))for(let p=0,m=u.length;p<m;p++){let g=u[p],y=n[g.materialIndex],b=Math.max(g.start,d.start),P=Math.min(a.count,Math.min(g.start+g.count,d.start+d.count));for(let T=b,I=P;T<I;T+=3){let C=T,E=T+1,O=T+2;r=fJ(this,y,o,e,l,c,h,C,E,O),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{let p=Math.max(0,d.start),m=Math.min(a.count,d.start+d.count);for(let g=p,y=m;g<y;g+=3){let b=g,P=g+1,T=g+2;r=fJ(this,n,o,e,l,c,h,b,P,T),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}};function $st(o,t,e,r,i,n,s,a){let l;if(t.side===mst?l=r.intersectTriangle(s,n,i,!0,a):l=r.intersectTriangle(i,n,s,t.side===Sbe,a),l===null)return null;pJ.copy(a),pJ.applyMatrix4(o.matrixWorld);let c=e.ray.origin.distanceTo(pJ);return c<e.near||c>e.far?null:{distance:c,point:pJ.clone(),object:o}}function fJ(o,t,e,r,i,n,s,a,l,c){o.getVertexPosition(a,cJ),o.getVertexPosition(l,hJ),o.getVertexPosition(c,uJ);let h=$st(o,t,e,r,cJ,hJ,uJ,$Re);if(h){let u=new wt;X7.getBarycoord($Re,cJ,hJ,uJ,u),i&&(h.uv=X7.getInterpolatedAttribute(i,a,l,c,u,new En)),n&&(h.uv1=X7.getInterpolatedAttribute(n,a,l,c,u,new En)),s&&(h.normal=X7.getInterpolatedAttribute(s,a,l,c,u,new wt),h.normal.dot(r.direction)>0&&h.normal.multiplyScalar(-1));let d={a,b:l,c,normal:new wt,materialIndex:0};X7.getNormal(cJ,hJ,uJ,d.normal),h.face=d,h.barycoord=u}return h}var Kst=class iMe extends Ay{constructor(t=1,e=1,r=1,i=1,n=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:i,heightSegments:n,depthSegments:s};let a=this;i=Math.floor(i),n=Math.floor(n),s=Math.floor(s);let l=[],c=[],h=[],u=[],d=0,p=0;m("z","y","x",-1,-1,r,e,t,s,n,0),m("z","y","x",1,-1,r,e,-t,s,n,1),m("x","z","y",1,1,t,r,e,i,s,2),m("x","z","y",1,-1,t,r,-e,i,s,3),m("x","y","z",1,-1,t,e,r,i,n,4),m("x","y","z",-1,-1,t,e,-r,i,n,5),this.setIndex(l),this.setAttribute("position",new dl(c,3)),this.setAttribute("normal",new dl(h,3)),this.setAttribute("uv",new dl(u,2));function m(g,y,b,P,T,I,C,E,O,_,R){let v=I/O,D=C/_,w=I/2,F=C/2,H=E/2,z=O+1,G=_+1,W=0,L=0,B=new wt;for(let N=0;N<G;N++){let U=N*D-F;for(let k=0;k<z;k++){let V=k*v-w;B[g]=V*P,B[y]=U*T,B[b]=H,c.push(B.x,B.y,B.z),B[g]=0,B[y]=0,B[b]=E>0?1:-1,h.push(B.x,B.y,B.z),u.push(k/O),u.push(1-N/_),W+=1}}for(let N=0;N<_;N++)for(let U=0;U<O;U++){let k=d+U+z*N,V=d+U+z*(N+1),Y=d+(U+1)+z*(N+1),X=d+(U+1)+z*N;l.push(k,V,X),l.push(V,Y,X),L+=6}a.addGroup(p,L,R),p+=L,d+=W}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new iMe(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function Zst(o){let t={};for(let e in o){t[e]={};for(let r in o[e]){let i=o[e][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][r]=null):t[e][r]=i.clone():Array.isArray(i)?t[e][r]=i.slice():t[e][r]=i}}return t}function O2(o){let t={};for(let e=0;e<o.length;e++){let r=Zst(o[e]);for(let i in r)t[i]=r[i]}return t}var nMe=class extends dk{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new fh,this.projectionMatrix=new fh,this.projectionMatrixInverse=new fh,this.coordinateSystem=DL}copy(o,t){return super.copy(o,t),this.matrixWorldInverse.copy(o.matrixWorldInverse),this.projectionMatrix.copy(o.projectionMatrix),this.projectionMatrixInverse.copy(o.projectionMatrixInverse),this.coordinateSystem=o.coordinateSystem,this}getWorldDirection(o){return super.getWorldDirection(o).negate()}updateMatrixWorld(o){super.updateMatrixWorld(o),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(o,t){super.updateWorldMatrix(o,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},mNt=new wt,gNt=new En,yNt=new En,Jst=class extends VO{constructor(o,t,e,r,i,n,s,a,l,c){o=o!==void 0?o:[],t=t!==void 0?t:yst,super(o,t,e,r,i,n,s,a,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(o){this.image=o}},bNt=new wt,PNt=new wt,TNt=new wt,INt=new wt,CNt=new En,SNt=new En,ENt=new fh,ONt=new wt,ANt=new wt,_Nt=new wt,vNt=new En,xNt=new En,RNt=new En,DNt=new wt,wNt=new wt,LNt=new wt,MNt=new DW,NNt=new DW,kNt=new wt,BNt=new fh,FNt=new wt,VNt=new Fv,GNt=new fh,UNt=new dQ,Qst=class extends VO{constructor(o=null,t=1,e=1,r,i,n,s,a,l=wv,c=wv,h,u){super(null,n,s,a,l,c,r,i,h,u),this.isDataTexture=!0,this.image={data:o,width:t,height:e},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},HNt=new fh,WNt=new fh,zNt=new fh,YNt=new fh,jNt=new Bv,XNt=new fh,qNt=new rMe,$Nt=new Fv,zye=new wt,eat=new wt,tat=new Ul,W7=class{constructor(o=new wt(1,0,0),t=0){this.isPlane=!0,this.normal=o,this.constant=t}set(o,t){return this.normal.copy(o),this.constant=t,this}setComponents(o,t,e,r){return this.normal.set(o,t,e),this.constant=r,this}setFromNormalAndCoplanarPoint(o,t){return this.normal.copy(o),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(o,t,e){let r=zye.subVectors(e,t).cross(eat.subVectors(o,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,o),this}copy(o){return this.normal.copy(o.normal),this.constant=o.constant,this}normalize(){let o=1/this.normal.length();return this.normal.multiplyScalar(o),this.constant*=o,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(o){return this.normal.dot(o)+this.constant}distanceToSphere(o){return this.distanceToPoint(o.center)-o.radius}projectPoint(o,t){return t.copy(o).addScaledVector(this.normal,-this.distanceToPoint(o))}intersectLine(o,t){let e=o.delta(zye),r=this.normal.dot(e);if(r===0)return this.distanceToPoint(o.start)===0?t.copy(o.start):null;let i=-(o.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(o.start).addScaledVector(e,i)}intersectsLine(o){let t=this.distanceToPoint(o.start),e=this.distanceToPoint(o.end);return t<0&&e>0||e<0&&t>0}intersectsBox(o){return o.intersectsPlane(this)}intersectsSphere(o){return o.intersectsPlane(this)}coplanarPoint(o){return o.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(o,t){let e=t||tat.getNormalMatrix(o),r=this.coplanarPoint(zye).applyMatrix4(o),i=this.normal.applyMatrix3(e).normalize();return this.constant=-r.dot(i),this}translate(o){return this.constant-=o.dot(this.normal),this}equals(o){return o.normal.equals(this.normal)&&o.constant===this.constant}clone(){return new this.constructor().copy(this)}},SL=new Fv,mJ=new wt,rat=class{constructor(o=new W7,t=new W7,e=new W7,r=new W7,i=new W7,n=new W7){this.planes=[o,t,e,r,i,n]}set(o,t,e,r,i,n){let s=this.planes;return s[0].copy(o),s[1].copy(t),s[2].copy(e),s[3].copy(r),s[4].copy(i),s[5].copy(n),this}copy(o){let t=this.planes;for(let e=0;e<6;e++)t[e].copy(o.planes[e]);return this}setFromProjectionMatrix(o,t=DL){let e=this.planes,r=o.elements,i=r[0],n=r[1],s=r[2],a=r[3],l=r[4],c=r[5],h=r[6],u=r[7],d=r[8],p=r[9],m=r[10],g=r[11],y=r[12],b=r[13],P=r[14],T=r[15];if(e[0].setComponents(a-i,u-l,g-d,T-y).normalize(),e[1].setComponents(a+i,u+l,g+d,T+y).normalize(),e[2].setComponents(a+n,u+c,g+p,T+b).normalize(),e[3].setComponents(a-n,u-c,g-p,T-b).normalize(),e[4].setComponents(a-s,u-h,g-m,T-P).normalize(),t===DL)e[5].setComponents(a+s,u+h,g+m,T+P).normalize();else if(t===Abe)e[5].setComponents(s,h,m,P).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(o){if(o.boundingSphere!==void 0)o.boundingSphere===null&&o.computeBoundingSphere(),SL.copy(o.boundingSphere).applyMatrix4(o.matrixWorld);else{let t=o.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),SL.copy(t.boundingSphere).applyMatrix4(o.matrixWorld)}return this.intersectsSphere(SL)}intersectsSprite(o){return SL.center.set(0,0,0),SL.radius=.7071067811865476,SL.applyMatrix4(o.matrixWorld),this.intersectsSphere(SL)}intersectsSphere(o){let t=this.planes,e=o.center,r=-o.radius;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<r)return!1;return!0}intersectsBox(o){let t=this.planes;for(let e=0;e<6;e++){let r=t[e];if(mJ.x=r.normal.x>0?o.max.x:o.min.x,mJ.y=r.normal.y>0?o.max.y:o.min.y,mJ.z=r.normal.z>0?o.max.z:o.min.z,r.distanceToPoint(mJ)<0)return!1}return!0}containsPoint(o){let t=this.planes;for(let e=0;e<6;e++)if(t[e].distanceToPoint(o)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},iat=class{constructor(){this.index=0,this.pool=[],this.list=[]}push(o,t,e,r){let i=this.pool,n=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});let s=i[this.index];n.push(s),this.index++,s.start=o,s.count=t,s.z=e,s.index=r}reset(){this.list.length=0,this.index=0}},KNt=new fh,ZNt=new Cf(1,1,1),JNt=new rat,QNt=new Bv,e7t=new Fv,t7t=new wt,r7t=new wt,i7t=new wt,n7t=new iat,o7t=new rMe,s7t=new wt,a7t=new wt,l7t=new fh,c7t=new dQ,h7t=new Fv,u7t=new wt,d7t=new wt,p7t=new wt,f7t=new wt,m7t=new fh,g7t=new dQ,y7t=new Fv,b7t=new wt,nat=class extends VO{constructor(o,t,e,r,i,n,s,a,l,c=Iye){if(c!==Iye&&c!==vRe)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");e===void 0&&c===Iye&&(e=Pst),e===void 0&&c===vRe&&(e=Tst),super(null,r,i,n,s,a,c,e,l),this.isDepthTexture=!0,this.image={width:o,height:t},this.magFilter=s!==void 0?s:wv,this.minFilter=a!==void 0?a:wv,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(o){return super.copy(o),this.compareFunction=o.compareFunction,this}toJSON(o){let t=super.toJSON(o);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},oE=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(o,t){let e=this.getUtoTmapping(o);return this.getPoint(e,t)}getPoints(o=5){let t=[];for(let e=0;e<=o;e++)t.push(this.getPoint(e/o));return t}getSpacedPoints(o=5){let t=[];for(let e=0;e<=o;e++)t.push(this.getPointAt(e/o));return t}getLength(){let o=this.getLengths();return o[o.length-1]}getLengths(o=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===o+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],e,r=this.getPoint(0),i=0;t.push(0);for(let n=1;n<=o;n++)e=this.getPoint(n/o),i+=e.distanceTo(r),t.push(i),r=e;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(o,t){let e=this.getLengths(),r=0,i=e.length,n;t?n=t:n=o*e[i-1];let s=0,a=i-1,l;for(;s<=a;)if(r=Math.floor(s+(a-s)/2),l=e[r]-n,l<0)s=r+1;else if(l>0)a=r-1;else{a=r;break}if(r=a,e[r]===n)return r/(i-1);let c=e[r],h=e[r+1]-c,u=(n-c)/h;return(r+u)/(i-1)}getTangent(o,t){let e=o-1e-4,r=o+1e-4;e<0&&(e=0),r>1&&(r=1);let i=this.getPoint(e),n=this.getPoint(r),s=t||(i.isVector2?new En:new wt);return s.copy(n).sub(i).normalize(),s}getTangentAt(o,t){let e=this.getUtoTmapping(o);return this.getTangent(e,t)}computeFrenetFrames(o,t){let e=new wt,r=[],i=[],n=[],s=new wt,a=new fh;for(let d=0;d<=o;d++){let p=d/o;r[d]=this.getTangentAt(p,new wt)}i[0]=new wt,n[0]=new wt;let l=Number.MAX_VALUE,c=Math.abs(r[0].x),h=Math.abs(r[0].y),u=Math.abs(r[0].z);c<=l&&(l=c,e.set(1,0,0)),h<=l&&(l=h,e.set(0,1,0)),u<=l&&e.set(0,0,1),s.crossVectors(r[0],e).normalize(),i[0].crossVectors(r[0],s),n[0].crossVectors(r[0],i[0]);for(let d=1;d<=o;d++){if(i[d]=i[d-1].clone(),n[d]=n[d-1].clone(),s.crossVectors(r[d-1],r[d]),s.length()>Number.EPSILON){s.normalize();let p=Math.acos(vl(r[d-1].dot(r[d]),-1,1));i[d].applyMatrix4(a.makeRotationAxis(s,p))}n[d].crossVectors(r[d],i[d])}if(t===!0){let d=Math.acos(vl(i[0].dot(i[o]),-1,1));d/=o,r[0].dot(s.crossVectors(i[0],i[o]))>0&&(d=-d);for(let p=1;p<=o;p++)i[p].applyMatrix4(a.makeRotationAxis(r[p],d*p)),n[p].crossVectors(r[p],i[p])}return{tangents:r,normals:i,binormals:n}}clone(){return new this.constructor().copy(this)}copy(o){return this.arcLengthDivisions=o.arcLengthDivisions,this}toJSON(){let o={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return o.arcLengthDivisions=this.arcLengthDivisions,o.type=this.type,o}fromJSON(o){return this.arcLengthDivisions=o.arcLengthDivisions,this}},L2e=class extends oE{constructor(o=0,t=0,e=1,r=1,i=0,n=Math.PI*2,s=!1,a=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=o,this.aY=t,this.xRadius=e,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=n,this.aClockwise=s,this.aRotation=a}getPoint(o,t=new En){let e=t,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,n=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(n?i=0:i=r),this.aClockwise===!0&&!n&&(i===r?i=-r:i=i-r);let s=this.aStartAngle+o*i,a=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(this.aRotation!==0){let c=Math.cos(this.aRotation),h=Math.sin(this.aRotation),u=a-this.aX,d=l-this.aY;a=u*c-d*h+this.aX,l=u*h+d*c+this.aY}return e.set(a,l)}copy(o){return super.copy(o),this.aX=o.aX,this.aY=o.aY,this.xRadius=o.xRadius,this.yRadius=o.yRadius,this.aStartAngle=o.aStartAngle,this.aEndAngle=o.aEndAngle,this.aClockwise=o.aClockwise,this.aRotation=o.aRotation,this}toJSON(){let o=super.toJSON();return o.aX=this.aX,o.aY=this.aY,o.xRadius=this.xRadius,o.yRadius=this.yRadius,o.aStartAngle=this.aStartAngle,o.aEndAngle=this.aEndAngle,o.aClockwise=this.aClockwise,o.aRotation=this.aRotation,o}fromJSON(o){return super.fromJSON(o),this.aX=o.aX,this.aY=o.aY,this.xRadius=o.xRadius,this.yRadius=o.yRadius,this.aStartAngle=o.aStartAngle,this.aEndAngle=o.aEndAngle,this.aClockwise=o.aClockwise,this.aRotation=o.aRotation,this}},oat=class extends L2e{constructor(o,t,e,r,i,n){super(o,t,e,e,r,i,n),this.isArcCurve=!0,this.type="ArcCurve"}};function M2e(){let o=0,t=0,e=0,r=0;function i(n,s,a,l){o=n,t=a,e=-3*n+3*s-2*a-l,r=2*n-2*s+a+l}return{initCatmullRom:function(n,s,a,l,c){i(s,a,c*(a-n),c*(l-s))},initNonuniformCatmullRom:function(n,s,a,l,c,h,u){let d=(s-n)/c-(a-n)/(c+h)+(a-s)/h,p=(a-s)/h-(l-s)/(h+u)+(l-a)/u;d*=h,p*=h,i(s,a,d,p)},calc:function(n){let s=n*n,a=s*n;return o+t*n+e*s+r*a}}}var gJ=new wt,Yye=new M2e,jye=new M2e,Xye=new M2e,sat=class extends oE{constructor(o=[],t=!1,e="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=o,this.closed=t,this.curveType=e,this.tension=r}getPoint(o,t=new wt){let e=t,r=this.points,i=r.length,n=(i-(this.closed?0:1))*o,s=Math.floor(n),a=n-s;this.closed?s+=s>0?0:(Math.floor(Math.abs(s)/i)+1)*i:a===0&&s===i-1&&(s=i-2,a=1);let l,c;this.closed||s>0?l=r[(s-1)%i]:(gJ.subVectors(r[0],r[1]).add(r[0]),l=gJ);let h=r[s%i],u=r[(s+1)%i];if(this.closed||s+2<i?c=r[(s+2)%i]:(gJ.subVectors(r[i-1],r[i-2]).add(r[i-1]),c=gJ),this.curveType==="centripetal"||this.curveType==="chordal"){let d=this.curveType==="chordal"?.5:.25,p=Math.pow(l.distanceToSquared(h),d),m=Math.pow(h.distanceToSquared(u),d),g=Math.pow(u.distanceToSquared(c),d);m<1e-4&&(m=1),p<1e-4&&(p=m),g<1e-4&&(g=m),Yye.initNonuniformCatmullRom(l.x,h.x,u.x,c.x,p,m,g),jye.initNonuniformCatmullRom(l.y,h.y,u.y,c.y,p,m,g),Xye.initNonuniformCatmullRom(l.z,h.z,u.z,c.z,p,m,g)}else this.curveType==="catmullrom"&&(Yye.initCatmullRom(l.x,h.x,u.x,c.x,this.tension),jye.initCatmullRom(l.y,h.y,u.y,c.y,this.tension),Xye.initCatmullRom(l.z,h.z,u.z,c.z,this.tension));return e.set(Yye.calc(a),jye.calc(a),Xye.calc(a)),e}copy(o){super.copy(o),this.points=[];for(let t=0,e=o.points.length;t<e;t++){let r=o.points[t];this.points.push(r.clone())}return this.closed=o.closed,this.curveType=o.curveType,this.tension=o.tension,this}toJSON(){let o=super.toJSON();o.points=[];for(let t=0,e=this.points.length;t<e;t++){let r=this.points[t];o.points.push(r.toArray())}return o.closed=this.closed,o.curveType=this.curveType,o.tension=this.tension,o}fromJSON(o){super.fromJSON(o),this.points=[];for(let t=0,e=o.points.length;t<e;t++){let r=o.points[t];this.points.push(new wt().fromArray(r))}return this.closed=o.closed,this.curveType=o.curveType,this.tension=o.tension,this}};function KRe(o,t,e,r,i){let n=(r-t)*.5,s=(i-e)*.5,a=o*o,l=o*a;return(2*e-2*r+n+s)*l+(-3*e+3*r-2*n-s)*a+n*o+e}function aat(o,t){let e=1-o;return e*e*t}function lat(o,t){return 2*(1-o)*o*t}function cat(o,t){return o*o*t}function dW(o,t,e,r){return aat(o,t)+lat(o,e)+cat(o,r)}function hat(o,t){let e=1-o;return e*e*e*t}function uat(o,t){let e=1-o;return 3*e*e*o*t}function dat(o,t){return 3*(1-o)*o*o*t}function pat(o,t){return o*o*o*t}function pW(o,t,e,r,i){return hat(o,t)+uat(o,e)+dat(o,r)+pat(o,i)}var oMe=class extends oE{constructor(o=new En,t=new En,e=new En,r=new En){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=o,this.v1=t,this.v2=e,this.v3=r}getPoint(o,t=new En){let e=t,r=this.v0,i=this.v1,n=this.v2,s=this.v3;return e.set(pW(o,r.x,i.x,n.x,s.x),pW(o,r.y,i.y,n.y,s.y)),e}copy(o){return super.copy(o),this.v0.copy(o.v0),this.v1.copy(o.v1),this.v2.copy(o.v2),this.v3.copy(o.v3),this}toJSON(){let o=super.toJSON();return o.v0=this.v0.toArray(),o.v1=this.v1.toArray(),o.v2=this.v2.toArray(),o.v3=this.v3.toArray(),o}fromJSON(o){return super.fromJSON(o),this.v0.fromArray(o.v0),this.v1.fromArray(o.v1),this.v2.fromArray(o.v2),this.v3.fromArray(o.v3),this}},fat=class extends oE{constructor(o=new wt,t=new wt,e=new wt,r=new wt){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=o,this.v1=t,this.v2=e,this.v3=r}getPoint(o,t=new wt){let e=t,r=this.v0,i=this.v1,n=this.v2,s=this.v3;return e.set(pW(o,r.x,i.x,n.x,s.x),pW(o,r.y,i.y,n.y,s.y),pW(o,r.z,i.z,n.z,s.z)),e}copy(o){return super.copy(o),this.v0.copy(o.v0),this.v1.copy(o.v1),this.v2.copy(o.v2),this.v3.copy(o.v3),this}toJSON(){let o=super.toJSON();return o.v0=this.v0.toArray(),o.v1=this.v1.toArray(),o.v2=this.v2.toArray(),o.v3=this.v3.toArray(),o}fromJSON(o){return super.fromJSON(o),this.v0.fromArray(o.v0),this.v1.fromArray(o.v1),this.v2.fromArray(o.v2),this.v3.fromArray(o.v3),this}},sMe=class extends oE{constructor(o=new En,t=new En){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=o,this.v2=t}getPoint(o,t=new En){let e=t;return o===1?e.copy(this.v2):(e.copy(this.v2).sub(this.v1),e.multiplyScalar(o).add(this.v1)),e}getPointAt(o,t){return this.getPoint(o,t)}getTangent(o,t=new En){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(o,t){return this.getTangent(o,t)}copy(o){return super.copy(o),this.v1.copy(o.v1),this.v2.copy(o.v2),this}toJSON(){let o=super.toJSON();return o.v1=this.v1.toArray(),o.v2=this.v2.toArray(),o}fromJSON(o){return super.fromJSON(o),this.v1.fromArray(o.v1),this.v2.fromArray(o.v2),this}},mat=class extends oE{constructor(o=new wt,t=new wt){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=o,this.v2=t}getPoint(o,t=new wt){let e=t;return o===1?e.copy(this.v2):(e.copy(this.v2).sub(this.v1),e.multiplyScalar(o).add(this.v1)),e}getPointAt(o,t){return this.getPoint(o,t)}getTangent(o,t=new wt){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(o,t){return this.getTangent(o,t)}copy(o){return super.copy(o),this.v1.copy(o.v1),this.v2.copy(o.v2),this}toJSON(){let o=super.toJSON();return o.v1=this.v1.toArray(),o.v2=this.v2.toArray(),o}fromJSON(o){return super.fromJSON(o),this.v1.fromArray(o.v1),this.v2.fromArray(o.v2),this}},aMe=class extends oE{constructor(o=new En,t=new En,e=new En){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=o,this.v1=t,this.v2=e}getPoint(o,t=new En){let e=t,r=this.v0,i=this.v1,n=this.v2;return e.set(dW(o,r.x,i.x,n.x),dW(o,r.y,i.y,n.y)),e}copy(o){return super.copy(o),this.v0.copy(o.v0),this.v1.copy(o.v1),this.v2.copy(o.v2),this}toJSON(){let o=super.toJSON();return o.v0=this.v0.toArray(),o.v1=this.v1.toArray(),o.v2=this.v2.toArray(),o}fromJSON(o){return super.fromJSON(o),this.v0.fromArray(o.v0),this.v1.fromArray(o.v1),this.v2.fromArray(o.v2),this}},lMe=class extends oE{constructor(o=new wt,t=new wt,e=new wt){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=o,this.v1=t,this.v2=e}getPoint(o,t=new wt){let e=t,r=this.v0,i=this.v1,n=this.v2;return e.set(dW(o,r.x,i.x,n.x),dW(o,r.y,i.y,n.y),dW(o,r.z,i.z,n.z)),e}copy(o){return super.copy(o),this.v0.copy(o.v0),this.v1.copy(o.v1),this.v2.copy(o.v2),this}toJSON(){let o=super.toJSON();return o.v0=this.v0.toArray(),o.v1=this.v1.toArray(),o.v2=this.v2.toArray(),o}fromJSON(o){return super.fromJSON(o),this.v0.fromArray(o.v0),this.v1.fromArray(o.v1),this.v2.fromArray(o.v2),this}},cMe=class extends oE{constructor(o=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=o}getPoint(o,t=new En){let e=t,r=this.points,i=(r.length-1)*o,n=Math.floor(i),s=i-n,a=r[n===0?n:n-1],l=r[n],c=r[n>r.length-2?r.length-1:n+1],h=r[n>r.length-3?r.length-1:n+2];return e.set(KRe(s,a.x,l.x,c.x,h.x),KRe(s,a.y,l.y,c.y,h.y)),e}copy(o){super.copy(o),this.points=[];for(let t=0,e=o.points.length;t<e;t++){let r=o.points[t];this.points.push(r.clone())}return this}toJSON(){let o=super.toJSON();o.points=[];for(let t=0,e=this.points.length;t<e;t++){let r=this.points[t];o.points.push(r.toArray())}return o}fromJSON(o){super.fromJSON(o),this.points=[];for(let t=0,e=o.points.length;t<e;t++){let r=o.points[t];this.points.push(new En().fromArray(r))}return this}},$J=Object.freeze({__proto__:null,ArcCurve:oat,CatmullRomCurve3:sat,CubicBezierCurve:oMe,CubicBezierCurve3:fat,EllipseCurve:L2e,LineCurve:sMe,LineCurve3:mat,QuadraticBezierCurve:aMe,QuadraticBezierCurve3:lMe,SplineCurve:cMe}),gat=class extends oE{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(o){this.curves.push(o)}closePath(){let o=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!o.equals(t)){let e=o.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new $J[e](t,o))}return this}getPoint(o,t){let e=o*this.getLength(),r=this.getCurveLengths(),i=0;for(;i<r.length;){if(r[i]>=e){let n=r[i]-e,s=this.curves[i],a=s.getLength(),l=a===0?0:1-n/a;return s.getPointAt(l,t)}i++}return null}getLength(){let o=this.getCurveLengths();return o[o.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let o=[],t=0;for(let e=0,r=this.curves.length;e<r;e++)t+=this.curves[e].getLength(),o.push(t);return this.cacheLengths=o,o}getSpacedPoints(o=40){let t=[];for(let e=0;e<=o;e++)t.push(this.getPoint(e/o));return this.autoClose&&t.push(t[0]),t}getPoints(o=12){let t=[],e;for(let r=0,i=this.curves;r<i.length;r++){let n=i[r],s=n.isEllipseCurve?o*2:n.isLineCurve||n.isLineCurve3?1:n.isSplineCurve?o*n.points.length:o,a=n.getPoints(s);for(let l=0;l<a.length;l++){let c=a[l];e&&e.equals(c)||(t.push(c),e=c)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(o){super.copy(o),this.curves=[];for(let t=0,e=o.curves.length;t<e;t++){let r=o.curves[t];this.curves.push(r.clone())}return this.autoClose=o.autoClose,this}toJSON(){let o=super.toJSON();o.autoClose=this.autoClose,o.curves=[];for(let t=0,e=this.curves.length;t<e;t++){let r=this.curves[t];o.curves.push(r.toJSON())}return o}fromJSON(o){super.fromJSON(o),this.autoClose=o.autoClose,this.curves=[];for(let t=0,e=o.curves.length;t<e;t++){let r=o.curves[t];this.curves.push(new $J[r.type]().fromJSON(r))}return this}},vbe=class extends gat{constructor(o){super(),this.type="Path",this.currentPoint=new En,o&&this.setFromPoints(o)}setFromPoints(o){this.moveTo(o[0].x,o[0].y);for(let t=1,e=o.length;t<e;t++)this.lineTo(o[t].x,o[t].y);return this}moveTo(o,t){return this.currentPoint.set(o,t),this}lineTo(o,t){let e=new sMe(this.currentPoint.clone(),new En(o,t));return this.curves.push(e),this.currentPoint.set(o,t),this}quadraticCurveTo(o,t,e,r){let i=new aMe(this.currentPoint.clone(),new En(o,t),new En(e,r));return this.curves.push(i),this.currentPoint.set(e,r),this}bezierCurveTo(o,t,e,r,i,n){let s=new oMe(this.currentPoint.clone(),new En(o,t),new En(e,r),new En(i,n));return this.curves.push(s),this.currentPoint.set(i,n),this}splineThru(o){let t=[this.currentPoint.clone()].concat(o),e=new cMe(t);return this.curves.push(e),this.currentPoint.copy(o[o.length-1]),this}arc(o,t,e,r,i,n){let s=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(o+s,t+a,e,r,i,n),this}absarc(o,t,e,r,i,n){return this.absellipse(o,t,e,e,r,i,n),this}ellipse(o,t,e,r,i,n,s,a){let l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(o+l,t+c,e,r,i,n,s,a),this}absellipse(o,t,e,r,i,n,s,a){let l=new L2e(o,t,e,r,i,n,s,a);if(this.curves.length>0){let h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);let c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(o){return super.copy(o),this.currentPoint.copy(o.currentPoint),this}toJSON(){let o=super.toJSON();return o.currentPoint=this.currentPoint.toArray(),o}fromJSON(o){return super.fromJSON(o),this.currentPoint.fromArray(o.currentPoint),this}},hMe=class uMe extends Ay{constructor(t=[new En(0,-.5),new En(.5,0),new En(0,.5)],e=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:i},e=Math.floor(e),i=vl(i,0,Math.PI*2);let n=[],s=[],a=[],l=[],c=[],h=1/e,u=new wt,d=new En,p=new wt,m=new wt,g=new wt,y=0,b=0;for(let P=0;P<=t.length-1;P++)switch(P){case 0:y=t[P+1].x-t[P].x,b=t[P+1].y-t[P].y,p.x=b*1,p.y=-y,p.z=b*0,g.copy(p),p.normalize(),l.push(p.x,p.y,p.z);break;case t.length-1:l.push(g.x,g.y,g.z);break;default:y=t[P+1].x-t[P].x,b=t[P+1].y-t[P].y,p.x=b*1,p.y=-y,p.z=b*0,m.copy(p),p.x+=g.x,p.y+=g.y,p.z+=g.z,p.normalize(),l.push(p.x,p.y,p.z),g.copy(m)}for(let P=0;P<=e;P++){let T=r+P*h*i,I=Math.sin(T),C=Math.cos(T);for(let E=0;E<=t.length-1;E++){u.x=t[E].x*I,u.y=t[E].y,u.z=t[E].x*C,s.push(u.x,u.y,u.z),d.x=P/e,d.y=E/(t.length-1),a.push(d.x,d.y);let O=l[3*E+0]*I,_=l[3*E+1],R=l[3*E+0]*C;c.push(O,_,R)}}for(let P=0;P<e;P++)for(let T=0;T<t.length-1;T++){let I=T+P*t.length,C=I,E=I+t.length,O=I+t.length+1,_=I+1;n.push(C,E,_),n.push(O,_,E)}this.setIndex(n),this.setAttribute("position",new dl(s,3)),this.setAttribute("uv",new dl(a,2)),this.setAttribute("normal",new dl(c,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new uMe(t.points,t.segments,t.phiStart,t.phiLength)}},yat=class dMe extends hMe{constructor(t=1,e=1,r=4,i=8){let n=new vbe;n.absarc(0,-e/2,t,Math.PI*1.5,0),n.absarc(0,e/2,t,0,Math.PI*.5),super(n.getPoints(r),i),this.type="CapsuleGeometry",this.parameters={radius:t,length:e,capSegments:r,radialSegments:i}}static fromJSON(t){return new dMe(t.radius,t.length,t.capSegments,t.radialSegments)}},bat=class pMe extends Ay{constructor(t=1,e=32,r=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},e=Math.max(3,e);let n=[],s=[],a=[],l=[],c=new wt,h=new En;s.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let u=0,d=3;u<=e;u++,d+=3){let p=r+u/e*i;c.x=t*Math.cos(p),c.y=t*Math.sin(p),s.push(c.x,c.y,c.z),a.push(0,0,1),h.x=(s[d]/t+1)/2,h.y=(s[d+1]/t+1)/2,l.push(h.x,h.y)}for(let u=1;u<=e;u++)n.push(u,u+1,0);this.setIndex(n),this.setAttribute("position",new dl(s,3)),this.setAttribute("normal",new dl(a,3)),this.setAttribute("uv",new dl(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new pMe(t.radius,t.segments,t.thetaStart,t.thetaLength)}},fMe=class mMe extends Ay{constructor(t=1,e=1,r=1,i=32,n=1,s=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:i,heightSegments:n,openEnded:s,thetaStart:a,thetaLength:l};let c=this;i=Math.floor(i),n=Math.floor(n);let h=[],u=[],d=[],p=[],m=0,g=[],y=r/2,b=0;P(),s===!1&&(t>0&&T(!0),e>0&&T(!1)),this.setIndex(h),this.setAttribute("position",new dl(u,3)),this.setAttribute("normal",new dl(d,3)),this.setAttribute("uv",new dl(p,2));function P(){let I=new wt,C=new wt,E=0,O=(e-t)/r;for(let _=0;_<=n;_++){let R=[],v=_/n,D=v*(e-t)+t;for(let w=0;w<=i;w++){let F=w/i,H=F*l+a,z=Math.sin(H),G=Math.cos(H);C.x=D*z,C.y=-v*r+y,C.z=D*G,u.push(C.x,C.y,C.z),I.set(z,O,G).normalize(),d.push(I.x,I.y,I.z),p.push(F,1-v),R.push(m++)}g.push(R)}for(let _=0;_<i;_++)for(let R=0;R<n;R++){let v=g[R][_],D=g[R+1][_],w=g[R+1][_+1],F=g[R][_+1];(t>0||R!==0)&&(h.push(v,D,F),E+=3),(e>0||R!==n-1)&&(h.push(D,w,F),E+=3)}c.addGroup(b,E,0),b+=E}function T(I){let C=m,E=new En,O=new wt,_=0,R=I===!0?t:e,v=I===!0?1:-1;for(let w=1;w<=i;w++)u.push(0,y*v,0),d.push(0,v,0),p.push(.5,.5),m++;let D=m;for(let w=0;w<=i;w++){let F=w/i*l+a,H=Math.cos(F),z=Math.sin(F);O.x=R*z,O.y=y*v,O.z=R*H,u.push(O.x,O.y,O.z),d.push(0,v,0),E.x=H*.5+.5,E.y=z*.5*v+.5,p.push(E.x,E.y),m++}for(let w=0;w<i;w++){let F=C+w,H=D+w;I===!0?h.push(H,H+1,F):h.push(H+1,H,F),_+=3}c.addGroup(b,_,I===!0?1:2),b+=_}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new mMe(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},Pat=class gMe extends fMe{constructor(t=1,e=1,r=32,i=1,n=!1,s=0,a=Math.PI*2){super(0,t,e,r,i,n,s,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:r,heightSegments:i,openEnded:n,thetaStart:s,thetaLength:a}}static fromJSON(t){return new gMe(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},LW=class yMe extends Ay{constructor(t=[],e=[],r=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:i};let n=[],s=[];a(i),c(r),h(),this.setAttribute("position",new dl(n,3)),this.setAttribute("normal",new dl(n.slice(),3)),this.setAttribute("uv",new dl(s,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(P){let T=new wt,I=new wt,C=new wt;for(let E=0;E<e.length;E+=3)p(e[E+0],T),p(e[E+1],I),p(e[E+2],C),l(T,I,C,P)}function l(P,T,I,C){let E=C+1,O=[];for(let _=0;_<=E;_++){O[_]=[];let R=P.clone().lerp(I,_/E),v=T.clone().lerp(I,_/E),D=E-_;for(let w=0;w<=D;w++)w===0&&_===E?O[_][w]=R:O[_][w]=R.clone().lerp(v,w/D)}for(let _=0;_<E;_++)for(let R=0;R<2*(E-_)-1;R++){let v=Math.floor(R/2);R%2===0?(d(O[_][v+1]),d(O[_+1][v]),d(O[_][v])):(d(O[_][v+1]),d(O[_+1][v+1]),d(O[_+1][v]))}}function c(P){let T=new wt;for(let I=0;I<n.length;I+=3)T.x=n[I+0],T.y=n[I+1],T.z=n[I+2],T.normalize().multiplyScalar(P),n[I+0]=T.x,n[I+1]=T.y,n[I+2]=T.z}function h(){let P=new wt;for(let T=0;T<n.length;T+=3){P.x=n[T+0],P.y=n[T+1],P.z=n[T+2];let I=y(P)/2/Math.PI+.5,C=b(P)/Math.PI+.5;s.push(I,1-C)}m(),u()}function u(){for(let P=0;P<s.length;P+=6){let T=s[P+0],I=s[P+2],C=s[P+4],E=Math.max(T,I,C),O=Math.min(T,I,C);E>.9&&O<.1&&(T<.2&&(s[P+0]+=1),I<.2&&(s[P+2]+=1),C<.2&&(s[P+4]+=1))}}function d(P){n.push(P.x,P.y,P.z)}function p(P,T){let I=P*3;T.x=t[I+0],T.y=t[I+1],T.z=t[I+2]}function m(){let P=new wt,T=new wt,I=new wt,C=new wt,E=new En,O=new En,_=new En;for(let R=0,v=0;R<n.length;R+=9,v+=6){P.set(n[R+0],n[R+1],n[R+2]),T.set(n[R+3],n[R+4],n[R+5]),I.set(n[R+6],n[R+7],n[R+8]),E.set(s[v+0],s[v+1]),O.set(s[v+2],s[v+3]),_.set(s[v+4],s[v+5]),C.copy(P).add(T).add(I).divideScalar(3);let D=y(C);g(E,v+0,P,D),g(O,v+2,T,D),g(_,v+4,I,D)}}function g(P,T,I,C){C<0&&P.x===1&&(s[T]=P.x-1),I.x===0&&I.z===0&&(s[T]=C/2/Math.PI+.5)}function y(P){return Math.atan2(P.z,-P.x)}function b(P){return Math.atan2(-P.y,Math.sqrt(P.x*P.x+P.z*P.z))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new yMe(t.vertices,t.indices,t.radius,t.details)}},Tat=class bMe extends LW{constructor(t=1,e=0){let r=(1+Math.sqrt(5))/2,i=1/r,n=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],s=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(n,s,t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new bMe(t.radius,t.detail)}},yJ=new wt,bJ=new wt,qye=new wt,PJ=new X7,Iat=class extends Ay{constructor(o=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:o,thresholdAngle:t},o!==null){let e=Math.pow(10,4),r=Math.cos(Cst*t),i=o.getIndex(),n=o.getAttribute("position"),s=i?i.count:n.count,a=[0,0,0],l=["a","b","c"],c=new Array(3),h={},u=[];for(let d=0;d<s;d+=3){i?(a[0]=i.getX(d),a[1]=i.getX(d+1),a[2]=i.getX(d+2)):(a[0]=d,a[1]=d+1,a[2]=d+2);let{a:p,b:m,c:g}=PJ;if(p.fromBufferAttribute(n,a[0]),m.fromBufferAttribute(n,a[1]),g.fromBufferAttribute(n,a[2]),PJ.getNormal(qye),c[0]=`${Math.round(p.x*e)},${Math.round(p.y*e)},${Math.round(p.z*e)}`,c[1]=`${Math.round(m.x*e)},${Math.round(m.y*e)},${Math.round(m.z*e)}`,c[2]=`${Math.round(g.x*e)},${Math.round(g.y*e)},${Math.round(g.z*e)}`,!(c[0]===c[1]||c[1]===c[2]||c[2]===c[0]))for(let y=0;y<3;y++){let b=(y+1)%3,P=c[y],T=c[b],I=PJ[l[y]],C=PJ[l[b]],E=`${P}_${T}`,O=`${T}_${P}`;O in h&&h[O]?(qye.dot(h[O].normal)<=r&&(u.push(I.x,I.y,I.z),u.push(C.x,C.y,C.z)),h[O]=null):E in h||(h[E]={index0:a[y],index1:a[b],normal:qye.clone()})}}for(let d in h)if(h[d]){let{index0:p,index1:m}=h[d];yJ.fromBufferAttribute(n,p),bJ.fromBufferAttribute(n,m),u.push(yJ.x,yJ.y,yJ.z),u.push(bJ.x,bJ.y,bJ.z)}this.setAttribute("position",new dl(u,3))}}copy(o){return super.copy(o),this.parameters=Object.assign({},o.parameters),this}},PMe=class extends vbe{constructor(o){super(o),this.uuid=uk(),this.type="Shape",this.holes=[]}getPointsHoles(o){let t=[];for(let e=0,r=this.holes.length;e<r;e++)t[e]=this.holes[e].getPoints(o);return t}extractPoints(o){return{shape:this.getPoints(o),holes:this.getPointsHoles(o)}}copy(o){super.copy(o),this.holes=[];for(let t=0,e=o.holes.length;t<e;t++){let r=o.holes[t];this.holes.push(r.clone())}return this}toJSON(){let o=super.toJSON();o.uuid=this.uuid,o.holes=[];for(let t=0,e=this.holes.length;t<e;t++){let r=this.holes[t];o.holes.push(r.toJSON())}return o}fromJSON(o){super.fromJSON(o),this.uuid=o.uuid,this.holes=[];for(let t=0,e=o.holes.length;t<e;t++){let r=o.holes[t];this.holes.push(new vbe().fromJSON(r))}return this}},Cat={triangulate:function(o,t,e=2){let r=t&&t.length,i=r?t[0]*e:o.length,n=TMe(o,0,i,e,!0),s=[];if(!n||n.next===n.prev)return s;let a,l,c,h,u,d,p;if(r&&(n=_at(o,t,n,e)),o.length>80*e){a=c=o[0],l=h=o[1];for(let m=e;m<i;m+=e)u=o[m],d=o[m+1],u<a&&(a=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=p!==0?32767/p:0}return TW(n,s,e,a,l,p,0),s}};function TMe(o,t,e,r,i){let n,s;if(i===Fat(o,t,e,r)>0)for(n=t;n<e;n+=r)s=ZRe(n,o[n],o[n+1],s);else for(n=e-r;n>=t;n-=r)s=ZRe(n,o[n],o[n+1],s);return s&&pQ(s,s.next)&&(CW(s),s=s.next),s}function LL(o,t){if(!o)return o;t||(t=o);let e=o,r;do if(r=!1,!e.steiner&&(pQ(e,e.next)||p0(e.prev,e,e.next)===0)){if(CW(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function TW(o,t,e,r,i,n,s){if(!o)return;!s&&n&&wat(o,r,i,n);let a=o,l,c;for(;o.prev!==o.next;){if(l=o.prev,c=o.next,n?Eat(o,r,i,n):Sat(o)){t.push(l.i/e|0),t.push(o.i/e|0),t.push(c.i/e|0),CW(o),o=c.next,a=c.next;continue}if(o=c,o===a){s?s===1?(o=Oat(LL(o),t,e),TW(o,t,e,r,i,n,2)):s===2&&Aat(o,t,e,r,i,n):TW(LL(o),t,e,r,i,n,1);break}}}function Sat(o){let t=o.prev,e=o,r=o.next;if(p0(t,e,r)>=0)return!1;let i=t.x,n=e.x,s=r.x,a=t.y,l=e.y,c=r.y,h=i<n?i<s?i:s:n<s?n:s,u=a<l?a<c?a:c:l<c?l:c,d=i>n?i>s?i:s:n>s?n:s,p=a>l?a>c?a:c:l>c?l:c,m=r.next;for(;m!==t;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=p&&Z7(i,a,n,l,s,c,m.x,m.y)&&p0(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Eat(o,t,e,r){let i=o.prev,n=o,s=o.next;if(p0(i,n,s)>=0)return!1;let a=i.x,l=n.x,c=s.x,h=i.y,u=n.y,d=s.y,p=a<l?a<c?a:c:l<c?l:c,m=h<u?h<d?h:d:u<d?u:d,g=a>l?a>c?a:c:l>c?l:c,y=h>u?h>d?h:d:u>d?u:d,b=xbe(p,m,t,e,r),P=xbe(g,y,t,e,r),T=o.prevZ,I=o.nextZ;for(;T&&T.z>=b&&I&&I.z<=P;){if(T.x>=p&&T.x<=g&&T.y>=m&&T.y<=y&&T!==i&&T!==s&&Z7(a,h,l,u,c,d,T.x,T.y)&&p0(T.prev,T,T.next)>=0||(T=T.prevZ,I.x>=p&&I.x<=g&&I.y>=m&&I.y<=y&&I!==i&&I!==s&&Z7(a,h,l,u,c,d,I.x,I.y)&&p0(I.prev,I,I.next)>=0))return!1;I=I.nextZ}for(;T&&T.z>=b;){if(T.x>=p&&T.x<=g&&T.y>=m&&T.y<=y&&T!==i&&T!==s&&Z7(a,h,l,u,c,d,T.x,T.y)&&p0(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;I&&I.z<=P;){if(I.x>=p&&I.x<=g&&I.y>=m&&I.y<=y&&I!==i&&I!==s&&Z7(a,h,l,u,c,d,I.x,I.y)&&p0(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function Oat(o,t,e){let r=o;do{let i=r.prev,n=r.next.next;!pQ(i,n)&&IMe(i,r,r.next,n)&&IW(i,n)&&IW(n,i)&&(t.push(i.i/e|0),t.push(r.i/e|0),t.push(n.i/e|0),CW(r),CW(r.next),r=o=n),r=r.next}while(r!==o);return LL(r)}function Aat(o,t,e,r,i,n){let s=o;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Nat(s,a)){let l=CMe(s,a);s=LL(s,s.next),l=LL(l,l.next),TW(s,t,e,r,i,n,0),TW(l,t,e,r,i,n,0);return}a=a.next}s=s.next}while(s!==o)}function _at(o,t,e,r){let i=[],n,s,a,l,c;for(n=0,s=t.length;n<s;n++)a=t[n]*r,l=n<s-1?t[n+1]*r:o.length,c=TMe(o,a,l,r,!1),c===c.next&&(c.steiner=!0),i.push(Mat(c));for(i.sort(vat),n=0;n<i.length;n++)e=xat(i[n],e);return e}function vat(o,t){return o.x-t.x}function xat(o,t){let e=Rat(o,t);if(!e)return t;let r=CMe(e,o);return LL(r,r.next),LL(e,e.next)}function Rat(o,t){let e=t,r=-1/0,i,n=o.x,s=o.y;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){let d=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=n&&d>r&&(r=d,i=e.x<e.next.x?e:e.next,d===n))return i}e=e.next}while(e!==t);if(!i)return null;let a=i,l=i.x,c=i.y,h=1/0,u;e=i;do n>=e.x&&e.x>=l&&n!==e.x&&Z7(s<c?n:r,s,l,c,s<c?r:n,s,e.x,e.y)&&(u=Math.abs(s-e.y)/(n-e.x),IW(e,o)&&(u<h||u===h&&(e.x>i.x||e.x===i.x&&Dat(i,e)))&&(i=e,h=u)),e=e.next;while(e!==a);return i}function Dat(o,t){return p0(o.prev,o,t.prev)<0&&p0(t.next,o,o.next)<0}function wat(o,t,e,r){let i=o;do i.z===0&&(i.z=xbe(i.x,i.y,t,e,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==o);i.prevZ.nextZ=null,i.prevZ=null,Lat(i)}function Lat(o){let t,e,r,i,n,s,a,l,c=1;do{for(e=o,o=null,n=null,s=0;e;){for(s++,r=e,a=0,t=0;t<c&&(a++,r=r.nextZ,!!r);t++);for(l=c;a>0||l>0&&r;)a!==0&&(l===0||!r||e.z<=r.z)?(i=e,e=e.nextZ,a--):(i=r,r=r.nextZ,l--),n?n.nextZ=i:o=i,i.prevZ=n,n=i;e=r}n.nextZ=null,c*=2}while(s>1);return o}function xbe(o,t,e,r,i){return o=(o-e)*i|0,t=(t-r)*i|0,o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,o|t<<1}function Mat(o){let t=o,e=o;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==o);return e}function Z7(o,t,e,r,i,n,s,a){return(i-s)*(t-a)>=(o-s)*(n-a)&&(o-s)*(r-a)>=(e-s)*(t-a)&&(e-s)*(n-a)>=(i-s)*(r-a)}function Nat(o,t){return o.next.i!==t.i&&o.prev.i!==t.i&&!kat(o,t)&&(IW(o,t)&&IW(t,o)&&Bat(o,t)&&(p0(o.prev,o,t.prev)||p0(o,t.prev,t))||pQ(o,t)&&p0(o.prev,o,o.next)>0&&p0(t.prev,t,t.next)>0)}function p0(o,t,e){return(t.y-o.y)*(e.x-t.x)-(t.x-o.x)*(e.y-t.y)}function pQ(o,t){return o.x===t.x&&o.y===t.y}function IMe(o,t,e,r){let i=IJ(p0(o,t,e)),n=IJ(p0(o,t,r)),s=IJ(p0(e,r,o)),a=IJ(p0(e,r,t));return!!(i!==n&&s!==a||i===0&&TJ(o,e,t)||n===0&&TJ(o,r,t)||s===0&&TJ(e,o,r)||a===0&&TJ(e,t,r))}function TJ(o,t,e){return t.x<=Math.max(o.x,e.x)&&t.x>=Math.min(o.x,e.x)&&t.y<=Math.max(o.y,e.y)&&t.y>=Math.min(o.y,e.y)}function IJ(o){return o>0?1:o<0?-1:0}function kat(o,t){let e=o;do{if(e.i!==o.i&&e.next.i!==o.i&&e.i!==t.i&&e.next.i!==t.i&&IMe(e,e.next,o,t))return!0;e=e.next}while(e!==o);return!1}function IW(o,t){return p0(o.prev,o,o.next)<0?p0(o,t,o.next)>=0&&p0(o,o.prev,t)>=0:p0(o,t,o.prev)<0||p0(o,o.next,t)<0}function Bat(o,t){let e=o,r=!1,i=(o.x+t.x)/2,n=(o.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&i<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==o);return r}function CMe(o,t){let e=new Rbe(o.i,o.x,o.y),r=new Rbe(t.i,t.x,t.y),i=o.next,n=t.prev;return o.next=t,t.prev=o,e.next=i,i.prev=e,r.next=e,e.prev=r,n.next=r,r.prev=n,r}function ZRe(o,t,e,r){let i=new Rbe(o,t,e);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function CW(o){o.next.prev=o.prev,o.prev.next=o.next,o.prevZ&&(o.prevZ.nextZ=o.nextZ),o.nextZ&&(o.nextZ.prevZ=o.prevZ)}function Rbe(o,t,e){this.i=o,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Fat(o,t,e,r){let i=0;for(let n=t,s=e-r;n<e;n+=r)i+=(o[s]-o[n])*(o[n+1]+o[s+1]),s=n;return i}var nk=class SMe{static area(t){let e=t.length,r=0;for(let i=e-1,n=0;n<e;i=n++)r+=t[i].x*t[n].y-t[n].x*t[i].y;return r*.5}static isClockWise(t){return SMe.area(t)<0}static triangulateShape(t,e){let r=[],i=[],n=[];JRe(t),QRe(r,t);let s=t.length;e.forEach(JRe);for(let l=0;l<e.length;l++)i.push(s),s+=e[l].length,QRe(r,e[l]);let a=Cat.triangulate(r,i);for(let l=0;l<a.length;l+=3)n.push(a.slice(l,l+3));return n}};function JRe(o){let t=o.length;t>2&&o[t-1].equals(o[0])&&o.pop()}function QRe(o,t){for(let e=0;e<t.length;e++)o.push(t[e].x),o.push(t[e].y)}var Vat=class EMe extends Ay{constructor(t=new PMe([new En(.5,.5),new En(-.5,.5),new En(-.5,-.5),new En(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];let r=this,i=[],n=[];for(let a=0,l=t.length;a<l;a++){let c=t[a];s(c)}this.setAttribute("position",new dl(i,3)),this.setAttribute("uv",new dl(n,2)),this.computeVertexNormals();function s(a){let l=[],c=e.curveSegments!==void 0?e.curveSegments:12,h=e.steps!==void 0?e.steps:1,u=e.depth!==void 0?e.depth:1,d=e.bevelEnabled!==void 0?e.bevelEnabled:!0,p=e.bevelThickness!==void 0?e.bevelThickness:.2,m=e.bevelSize!==void 0?e.bevelSize:p-.1,g=e.bevelOffset!==void 0?e.bevelOffset:0,y=e.bevelSegments!==void 0?e.bevelSegments:3,b=e.extrudePath,P=e.UVGenerator!==void 0?e.UVGenerator:Gat,T,I=!1,C,E,O,_;b&&(T=b.getSpacedPoints(h),I=!0,d=!1,C=b.computeFrenetFrames(h,!1),E=new wt,O=new wt,_=new wt),d||(y=0,p=0,m=0,g=0);let R=a.extractPoints(c),v=R.shape,D=R.holes;if(!nk.isClockWise(v)){v=v.reverse();for(let se=0,K=D.length;se<K;se++){let me=D[se];nk.isClockWise(me)&&(D[se]=me.reverse())}}let w=nk.triangulateShape(v,D),F=v;for(let se=0,K=D.length;se<K;se++){let me=D[se];v=v.concat(me)}function H(se,K,me){return K||console.error("THREE.ExtrudeGeometry: vec does not exist"),se.clone().addScaledVector(K,me)}let z=v.length,G=w.length;function W(se,K,me){let Oe,Ie,ue,Pe=se.x-K.x,j=se.y-K.y,J=me.x-se.x,oe=me.y-se.y,pe=Pe*Pe+j*j,ge=Pe*oe-j*J;if(Math.abs(ge)>Number.EPSILON){let Se=Math.sqrt(pe),De=Math.sqrt(J*J+oe*oe),tt=K.x-j/Se,Ze=K.y+Pe/Se,Wt=me.x-oe/De,Nr=me.y+J/De,Lr=((Wt-tt)*oe-(Nr-Ze)*J)/(Pe*oe-j*J);Oe=tt+Pe*Lr-se.x,Ie=Ze+j*Lr-se.y;let Dr=Oe*Oe+Ie*Ie;if(Dr<=2)return new En(Oe,Ie);ue=Math.sqrt(Dr/2)}else{let Se=!1;Pe>Number.EPSILON?J>Number.EPSILON&&(Se=!0):Pe<-Number.EPSILON?J<-Number.EPSILON&&(Se=!0):Math.sign(j)===Math.sign(oe)&&(Se=!0),Se?(Oe=-j,Ie=Pe,ue=Math.sqrt(pe)):(Oe=Pe,Ie=j,ue=Math.sqrt(pe/2))}return new En(Oe/ue,Ie/ue)}let L=[];for(let se=0,K=F.length,me=K-1,Oe=se+1;se<K;se++,me++,Oe++)me===K&&(me=0),Oe===K&&(Oe=0),L[se]=W(F[se],F[me],F[Oe]);let B=[],N,U=L.concat();for(let se=0,K=D.length;se<K;se++){let me=D[se];N=[];for(let Oe=0,Ie=me.length,ue=Ie-1,Pe=Oe+1;Oe<Ie;Oe++,ue++,Pe++)ue===Ie&&(ue=0),Pe===Ie&&(Pe=0),N[Oe]=W(me[Oe],me[ue],me[Pe]);B.push(N),U=U.concat(N)}for(let se=0;se<y;se++){let K=se/y,me=p*Math.cos(K*Math.PI/2),Oe=m*Math.sin(K*Math.PI/2)+g;for(let Ie=0,ue=F.length;Ie<ue;Ie++){let Pe=H(F[Ie],L[Ie],Oe);Z(Pe.x,Pe.y,-me)}for(let Ie=0,ue=D.length;Ie<ue;Ie++){let Pe=D[Ie];N=B[Ie];for(let j=0,J=Pe.length;j<J;j++){let oe=H(Pe[j],N[j],Oe);Z(oe.x,oe.y,-me)}}}let k=m+g;for(let se=0;se<z;se++){let K=d?H(v[se],U[se],k):v[se];I?(O.copy(C.normals[0]).multiplyScalar(K.x),E.copy(C.binormals[0]).multiplyScalar(K.y),_.copy(T[0]).add(O).add(E),Z(_.x,_.y,_.z)):Z(K.x,K.y,0)}for(let se=1;se<=h;se++)for(let K=0;K<z;K++){let me=d?H(v[K],U[K],k):v[K];I?(O.copy(C.normals[se]).multiplyScalar(me.x),E.copy(C.binormals[se]).multiplyScalar(me.y),_.copy(T[se]).add(O).add(E),Z(_.x,_.y,_.z)):Z(me.x,me.y,u/h*se)}for(let se=y-1;se>=0;se--){let K=se/y,me=p*Math.cos(K*Math.PI/2),Oe=m*Math.sin(K*Math.PI/2)+g;for(let Ie=0,ue=F.length;Ie<ue;Ie++){let Pe=H(F[Ie],L[Ie],Oe);Z(Pe.x,Pe.y,u+me)}for(let Ie=0,ue=D.length;Ie<ue;Ie++){let Pe=D[Ie];N=B[Ie];for(let j=0,J=Pe.length;j<J;j++){let oe=H(Pe[j],N[j],Oe);I?Z(oe.x,oe.y+T[h-1].y,T[h-1].x+me):Z(oe.x,oe.y,u+me)}}}V(),Y();function V(){let se=i.length/3;if(d){let K=0,me=z*K;for(let Oe=0;Oe<G;Oe++){let Ie=w[Oe];Q(Ie[2]+me,Ie[1]+me,Ie[0]+me)}K=h+y*2,me=z*K;for(let Oe=0;Oe<G;Oe++){let Ie=w[Oe];Q(Ie[0]+me,Ie[1]+me,Ie[2]+me)}}else{for(let K=0;K<G;K++){let me=w[K];Q(me[2],me[1],me[0])}for(let K=0;K<G;K++){let me=w[K];Q(me[0]+z*h,me[1]+z*h,me[2]+z*h)}}r.addGroup(se,i.length/3-se,0)}function Y(){let se=i.length/3,K=0;X(F,K),K+=F.length;for(let me=0,Oe=D.length;me<Oe;me++){let Ie=D[me];X(Ie,K),K+=Ie.length}r.addGroup(se,i.length/3-se,1)}function X(se,K){let me=se.length;for(;--me>=0;){let Oe=me,Ie=me-1;Ie<0&&(Ie=se.length-1);for(let ue=0,Pe=h+y*2;ue<Pe;ue++){let j=z*ue,J=z*(ue+1),oe=K+Oe+j,pe=K+Ie+j,ge=K+Ie+J,Se=K+Oe+J;ae(oe,pe,ge,Se)}}}function Z(se,K,me){l.push(se),l.push(K),l.push(me)}function Q(se,K,me){he(se),he(K),he(me);let Oe=i.length/3,Ie=P.generateTopUV(r,i,Oe-3,Oe-2,Oe-1);re(Ie[0]),re(Ie[1]),re(Ie[2])}function ae(se,K,me,Oe){he(se),he(K),he(Oe),he(K),he(me),he(Oe);let Ie=i.length/3,ue=P.generateSideWallUV(r,i,Ie-6,Ie-3,Ie-2,Ie-1);re(ue[0]),re(ue[1]),re(ue[3]),re(ue[1]),re(ue[2]),re(ue[3])}function he(se){i.push(l[se*3+0]),i.push(l[se*3+1]),i.push(l[se*3+2])}function re(se){n.push(se.x),n.push(se.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes,r=this.parameters.options;return Uat(e,r,t)}static fromJSON(t,e){let r=[];for(let n=0,s=t.shapes.length;n<s;n++){let a=e[t.shapes[n]];r.push(a)}let i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new $J[i.type]().fromJSON(i)),new EMe(r,t.options)}},Gat={generateTopUV:function(o,t,e,r,i){let n=t[e*3],s=t[e*3+1],a=t[r*3],l=t[r*3+1],c=t[i*3],h=t[i*3+1];return[new En(n,s),new En(a,l),new En(c,h)]},generateSideWallUV:function(o,t,e,r,i,n){let s=t[e*3],a=t[e*3+1],l=t[e*3+2],c=t[r*3],h=t[r*3+1],u=t[r*3+2],d=t[i*3],p=t[i*3+1],m=t[i*3+2],g=t[n*3],y=t[n*3+1],b=t[n*3+2];return Math.abs(a-h)<Math.abs(s-c)?[new En(s,1-l),new En(c,1-u),new En(d,1-m),new En(g,1-b)]:[new En(a,1-l),new En(h,1-u),new En(p,1-m),new En(y,1-b)]}};function Uat(o,t,e){if(e.shapes=[],Array.isArray(o))for(let r=0,i=o.length;r<i;r++){let n=o[r];e.shapes.push(n.uuid)}else e.shapes.push(o.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}var Hat=class OMe extends LW{constructor(t=1,e=0){let r=(1+Math.sqrt(5))/2,i=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],n=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,n,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new OMe(t.radius,t.detail)}},Wat=class AMe extends LW{constructor(t=1,e=0){let r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(r,i,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new AMe(t.radius,t.detail)}},zat=class _Me extends Ay{constructor(t=1,e=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i};let n=t/2,s=e/2,a=Math.floor(r),l=Math.floor(i),c=a+1,h=l+1,u=t/a,d=e/l,p=[],m=[],g=[],y=[];for(let b=0;b<h;b++){let P=b*d-s;for(let T=0;T<c;T++){let I=T*u-n;m.push(I,-P,0),g.push(0,0,1),y.push(T/a),y.push(1-b/l)}}for(let b=0;b<l;b++)for(let P=0;P<a;P++){let T=P+c*b,I=P+c*(b+1),C=P+1+c*(b+1),E=P+1+c*b;p.push(T,I,E),p.push(I,C,E)}this.setIndex(p),this.setAttribute("position",new dl(m,3)),this.setAttribute("normal",new dl(g,3)),this.setAttribute("uv",new dl(y,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new _Me(t.width,t.height,t.widthSegments,t.heightSegments)}},Yat=class vMe extends Ay{constructor(t=.5,e=1,r=32,i=1,n=0,s=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:s},r=Math.max(3,r),i=Math.max(1,i);let a=[],l=[],c=[],h=[],u=t,d=(e-t)/i,p=new wt,m=new En;for(let g=0;g<=i;g++){for(let y=0;y<=r;y++){let b=n+y/r*s;p.x=u*Math.cos(b),p.y=u*Math.sin(b),l.push(p.x,p.y,p.z),c.push(0,0,1),m.x=(p.x/e+1)/2,m.y=(p.y/e+1)/2,h.push(m.x,m.y)}u+=d}for(let g=0;g<i;g++){let y=g*(r+1);for(let b=0;b<r;b++){let P=b+y,T=P,I=P+r+1,C=P+r+2,E=P+1;a.push(T,I,E),a.push(I,C,E)}}this.setIndex(a),this.setAttribute("position",new dl(l,3)),this.setAttribute("normal",new dl(c,3)),this.setAttribute("uv",new dl(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new vMe(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}},jat=class xMe extends Ay{constructor(t=new PMe([new En(0,.5),new En(-.5,-.5),new En(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};let r=[],i=[],n=[],s=[],a=0,l=0;if(Array.isArray(t)===!1)c(t);else for(let h=0;h<t.length;h++)c(t[h]),this.addGroup(a,l,h),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new dl(i,3)),this.setAttribute("normal",new dl(n,3)),this.setAttribute("uv",new dl(s,2));function c(h){let u=i.length/3,d=h.extractPoints(e),p=d.shape,m=d.holes;nk.isClockWise(p)===!1&&(p=p.reverse());for(let y=0,b=m.length;y<b;y++){let P=m[y];nk.isClockWise(P)===!0&&(m[y]=P.reverse())}let g=nk.triangulateShape(p,m);for(let y=0,b=m.length;y<b;y++){let P=m[y];p=p.concat(P)}for(let y=0,b=p.length;y<b;y++){let P=p[y];i.push(P.x,P.y,0),n.push(0,0,1),s.push(P.x,P.y)}for(let y=0,b=g.length;y<b;y++){let P=g[y],T=P[0]+u,I=P[1]+u,C=P[2]+u;r.push(T,I,C),l+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes;return Xat(e,t)}static fromJSON(t,e){let r=[];for(let i=0,n=t.shapes.length;i<n;i++){let s=e[t.shapes[i]];r.push(s)}return new xMe(r,t.curveSegments)}};function Xat(o,t){if(t.shapes=[],Array.isArray(o))for(let e=0,r=o.length;e<r;e++){let i=o[e];t.shapes.push(i.uuid)}else t.shapes.push(o.uuid);return t}var qat=class RMe extends Ay{constructor(t=1,e=32,r=16,i=0,n=Math.PI*2,s=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:s,thetaLength:a},e=Math.max(3,Math.floor(e)),r=Math.max(2,Math.floor(r));let l=Math.min(s+a,Math.PI),c=0,h=[],u=new wt,d=new wt,p=[],m=[],g=[],y=[];for(let b=0;b<=r;b++){let P=[],T=b/r,I=0;b===0&&s===0?I=.5/e:b===r&&l===Math.PI&&(I=-.5/e);for(let C=0;C<=e;C++){let E=C/e;u.x=-t*Math.cos(i+E*n)*Math.sin(s+T*a),u.y=t*Math.cos(s+T*a),u.z=t*Math.sin(i+E*n)*Math.sin(s+T*a),m.push(u.x,u.y,u.z),d.copy(u).normalize(),g.push(d.x,d.y,d.z),y.push(E+I,1-T),P.push(c++)}h.push(P)}for(let b=0;b<r;b++)for(let P=0;P<e;P++){let T=h[b][P+1],I=h[b][P],C=h[b+1][P],E=h[b+1][P+1];(b!==0||s>0)&&p.push(T,I,E),(b!==r-1||l<Math.PI)&&p.push(I,C,E)}this.setIndex(p),this.setAttribute("position",new dl(m,3)),this.setAttribute("normal",new dl(g,3)),this.setAttribute("uv",new dl(y,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new RMe(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},$at=class DMe extends LW{constructor(t=1,e=0){let r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(r,i,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new DMe(t.radius,t.detail)}},Kat=class wMe extends Ay{constructor(t=1,e=.4,r=12,i=48,n=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,arc:n},r=Math.floor(r),i=Math.floor(i);let s=[],a=[],l=[],c=[],h=new wt,u=new wt,d=new wt;for(let p=0;p<=r;p++)for(let m=0;m<=i;m++){let g=m/i*n,y=p/r*Math.PI*2;u.x=(t+e*Math.cos(y))*Math.cos(g),u.y=(t+e*Math.cos(y))*Math.sin(g),u.z=e*Math.sin(y),a.push(u.x,u.y,u.z),h.x=t*Math.cos(g),h.y=t*Math.sin(g),d.subVectors(u,h).normalize(),l.push(d.x,d.y,d.z),c.push(m/i),c.push(p/r)}for(let p=1;p<=r;p++)for(let m=1;m<=i;m++){let g=(i+1)*p+m-1,y=(i+1)*(p-1)+m-1,b=(i+1)*(p-1)+m,P=(i+1)*p+m;s.push(g,y,P),s.push(y,b,P)}this.setIndex(s),this.setAttribute("position",new dl(a,3)),this.setAttribute("normal",new dl(l,3)),this.setAttribute("uv",new dl(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new wMe(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},Zat=class LMe extends Ay{constructor(t=1,e=.4,r=64,i=8,n=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:r,radialSegments:i,p:n,q:s},r=Math.floor(r),i=Math.floor(i);let a=[],l=[],c=[],h=[],u=new wt,d=new wt,p=new wt,m=new wt,g=new wt,y=new wt,b=new wt;for(let T=0;T<=r;++T){let I=T/r*n*Math.PI*2;P(I,n,s,t,p),P(I+.01,n,s,t,m),y.subVectors(m,p),b.addVectors(m,p),g.crossVectors(y,b),b.crossVectors(g,y),g.normalize(),b.normalize();for(let C=0;C<=i;++C){let E=C/i*Math.PI*2,O=-e*Math.cos(E),_=e*Math.sin(E);u.x=p.x+(O*b.x+_*g.x),u.y=p.y+(O*b.y+_*g.y),u.z=p.z+(O*b.z+_*g.z),l.push(u.x,u.y,u.z),d.subVectors(u,p).normalize(),c.push(d.x,d.y,d.z),h.push(T/r),h.push(C/i)}}for(let T=1;T<=r;T++)for(let I=1;I<=i;I++){let C=(i+1)*(T-1)+(I-1),E=(i+1)*T+(I-1),O=(i+1)*T+I,_=(i+1)*(T-1)+I;a.push(C,E,_),a.push(E,O,_)}this.setIndex(a),this.setAttribute("position",new dl(l,3)),this.setAttribute("normal",new dl(c,3)),this.setAttribute("uv",new dl(h,2));function P(T,I,C,E,O){let _=Math.cos(T),R=Math.sin(T),v=C/I*T,D=Math.cos(v);O.x=E*(2+D)*.5*_,O.y=E*(2+D)*R*.5,O.z=E*Math.sin(v)*.5}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new LMe(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},Jat=class MMe extends Ay{constructor(t=new lMe(new wt(-1,-1,0),new wt(-1,1,0),new wt(1,1,0)),e=64,r=1,i=8,n=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:r,radialSegments:i,closed:n};let s=t.computeFrenetFrames(e,n);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;let a=new wt,l=new wt,c=new En,h=new wt,u=[],d=[],p=[],m=[];g(),this.setIndex(m),this.setAttribute("position",new dl(u,3)),this.setAttribute("normal",new dl(d,3)),this.setAttribute("uv",new dl(p,2));function g(){for(let T=0;T<e;T++)y(T);y(n===!1?e:0),P(),b()}function y(T){h=t.getPointAt(T/e,h);let I=s.normals[T],C=s.binormals[T];for(let E=0;E<=i;E++){let O=E/i*Math.PI*2,_=Math.sin(O),R=-Math.cos(O);l.x=R*I.x+_*C.x,l.y=R*I.y+_*C.y,l.z=R*I.z+_*C.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=h.x+r*l.x,a.y=h.y+r*l.y,a.z=h.z+r*l.z,u.push(a.x,a.y,a.z)}}function b(){for(let T=1;T<=e;T++)for(let I=1;I<=i;I++){let C=(i+1)*(T-1)+(I-1),E=(i+1)*T+(I-1),O=(i+1)*T+I,_=(i+1)*(T-1)+I;m.push(C,E,_),m.push(E,O,_)}}function P(){for(let T=0;T<=e;T++)for(let I=0;I<=i;I++)c.x=T/e,c.y=I/i,p.push(c.x,c.y)}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new MMe(new $J[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}},Qat=class extends Ay{constructor(o=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:o},o!==null){let t=[],e=new Set,r=new wt,i=new wt;if(o.index!==null){let n=o.attributes.position,s=o.index,a=o.groups;a.length===0&&(a=[{start:0,count:s.count,materialIndex:0}]);for(let l=0,c=a.length;l<c;++l){let h=a[l],u=h.start,d=h.count;for(let p=u,m=u+d;p<m;p+=3)for(let g=0;g<3;g++){let y=s.getX(p+g),b=s.getX(p+(g+1)%3);r.fromBufferAttribute(n,y),i.fromBufferAttribute(n,b),eDe(r,i,e)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}}else{let n=o.attributes.position;for(let s=0,a=n.count/3;s<a;s++)for(let l=0;l<3;l++){let c=3*s+l,h=3*s+(l+1)%3;r.fromBufferAttribute(n,c),i.fromBufferAttribute(n,h),eDe(r,i,e)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}this.setAttribute("position",new dl(t,3))}}copy(o){return super.copy(o),this.parameters=Object.assign({},o.parameters),this}};function eDe(o,t,e){let r=`${o.x},${o.y},${o.z}-${t.x},${t.y},${t.z}`,i=`${t.x},${t.y},${t.z}-${o.x},${o.y},${o.z}`;return e.has(r)===!0||e.has(i)===!0?!1:(e.add(r),e.add(i),!0)}var P7t=Object.freeze({__proto__:null,BoxGeometry:Kst,CapsuleGeometry:yat,CircleGeometry:bat,ConeGeometry:Pat,CylinderGeometry:fMe,DodecahedronGeometry:Tat,EdgesGeometry:Iat,ExtrudeGeometry:Vat,IcosahedronGeometry:Hat,LatheGeometry:hMe,OctahedronGeometry:Wat,PlaneGeometry:zat,PolyhedronGeometry:LW,RingGeometry:Yat,ShapeGeometry:jat,SphereGeometry:qat,TetrahedronGeometry:$at,TorusGeometry:Kat,TorusKnotGeometry:Zat,TubeGeometry:Jat,WireframeGeometry:Qat});function CJ(o,t,e){return!o||!e&&o.constructor===t?o:typeof t.BYTES_PER_ELEMENT=="number"?new t(o):Array.prototype.slice.call(o)}function elt(o){return ArrayBuffer.isView(o)&&!(o instanceof DataView)}var fQ=class{constructor(o,t,e,r){this.parameterPositions=o,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(e),this.sampleValues=t,this.valueSize=e,this.settings=null,this.DefaultSettings_={}}evaluate(o){let t=this.parameterPositions,e=this._cachedIndex,r=t[e],i=t[e-1];e:{t:{let n;r:{i:if(!(o<r)){for(let s=e+2;;){if(r===void 0){if(o<i)break i;return e=t.length,this._cachedIndex=e,this.copySampleValue_(e-1)}if(e===s)break;if(i=r,r=t[++e],o<r)break t}n=t.length;break r}if(!(o>=i)){let s=t[1];o<s&&(e=2,i=s);for(let a=e-2;;){if(i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(e===a)break;if(r=i,i=t[--e-1],o>=i)break t}n=e,e=0;break r}break e}for(;e<n;){let s=e+n>>>1;o<t[s]?n=s:e=s+1}if(r=t[e],i=t[e-1],i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return e=t.length,this._cachedIndex=e,this.copySampleValue_(e-1)}this._cachedIndex=e,this.intervalChanged_(e,i,r)}return this.interpolate_(e,i,o,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(o){let t=this.resultBuffer,e=this.sampleValues,r=this.valueSize,i=o*r;for(let n=0;n!==r;++n)t[n]=e[i+n];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},tlt=class extends fQ{constructor(o,t,e,r){super(o,t,e,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:xRe,endingEnd:xRe}}intervalChanged_(o,t,e){let r=this.parameterPositions,i=o-2,n=o+1,s=r[i],a=r[n];if(s===void 0)switch(this.getSettings_().endingStart){case RRe:i=o,s=2*t-e;break;case DRe:i=r.length-2,s=t+r[i]-r[i+1];break;default:i=o,s=e}if(a===void 0)switch(this.getSettings_().endingEnd){case RRe:n=o,a=2*e-t;break;case DRe:n=1,a=e+r[1]-r[0];break;default:n=o-1,a=t}let l=(e-t)*.5,c=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(a-e),this._offsetPrev=i*c,this._offsetNext=n*c}interpolate_(o,t,e,r){let i=this.resultBuffer,n=this.sampleValues,s=this.valueSize,a=o*s,l=a-s,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(e-t)/(r-t),m=p*p,g=m*p,y=-u*g+2*u*m-u*p,b=(1+u)*g+(-1.5-2*u)*m+(-.5+u)*p+1,P=(-1-d)*g+(1.5+d)*m+.5*p,T=d*g-d*m;for(let I=0;I!==s;++I)i[I]=y*n[c+I]+b*n[l+I]+P*n[a+I]+T*n[h+I];return i}},rlt=class extends fQ{constructor(o,t,e,r){super(o,t,e,r)}interpolate_(o,t,e,r){let i=this.resultBuffer,n=this.sampleValues,s=this.valueSize,a=o*s,l=a-s,c=(e-t)/(r-t),h=1-c;for(let u=0;u!==s;++u)i[u]=n[l+u]*h+n[a+u]*c;return i}},ilt=class extends fQ{constructor(o,t,e,r){super(o,t,e,r)}interpolate_(o){return this.copySampleValue_(o-1)}},GO=class{constructor(o,t,e,r){if(o===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+o);this.name=o,this.times=CJ(t,this.TimeBufferType),this.values=CJ(e,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(o){let t=o.constructor,e;if(t.toJSON!==this.toJSON)e=t.toJSON(o);else{e={name:o.name,times:CJ(o.times,Array),values:CJ(o.values,Array)};let r=o.getInterpolation();r!==o.DefaultInterpolation&&(e.interpolation=r)}return e.type=o.ValueTypeName,e}InterpolantFactoryMethodDiscrete(o){return new ilt(this.times,this.values,this.getValueSize(),o)}InterpolantFactoryMethodLinear(o){return new rlt(this.times,this.values,this.getValueSize(),o)}InterpolantFactoryMethodSmooth(o){return new tlt(this.times,this.values,this.getValueSize(),o)}setInterpolation(o){let t;switch(o){case qJ:t=this.InterpolantFactoryMethodDiscrete;break;case Ebe:t=this.InterpolantFactoryMethodLinear;break;case Cye:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(o!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(e);return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return qJ;case this.InterpolantFactoryMethodLinear:return Ebe;case this.InterpolantFactoryMethodSmooth:return Cye}}getValueSize(){return this.values.length/this.times.length}shift(o){if(o!==0){let t=this.times;for(let e=0,r=t.length;e!==r;++e)t[e]+=o}return this}scale(o){if(o!==1){let t=this.times;for(let e=0,r=t.length;e!==r;++e)t[e]*=o}return this}trim(o,t){let e=this.times,r=e.length,i=0,n=r-1;for(;i!==r&&e[i]<o;)++i;for(;n!==-1&&e[n]>t;)--n;if(++n,i!==0||n!==r){i>=n&&(n=Math.max(n,1),i=n-1);let s=this.getValueSize();this.times=e.slice(i,n),this.values=this.values.slice(i*s,n*s)}return this}validate(){let o=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),o=!1);let e=this.times,r=this.values,i=e.length;i===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),o=!1);let n=null;for(let s=0;s!==i;s++){let a=e[s];if(typeof a=="number"&&isNaN(a)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,s,a),o=!1;break}if(n!==null&&n>a){console.error("THREE.KeyframeTrack: Out of order keys.",this,s,a,n),o=!1;break}n=a}if(r!==void 0&&elt(r))for(let s=0,a=r.length;s!==a;++s){let l=r[s];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,s,l),o=!1;break}}return o}optimize(){let o=this.times.slice(),t=this.values.slice(),e=this.getValueSize(),r=this.getInterpolation()===Cye,i=o.length-1,n=1;for(let s=1;s<i;++s){let a=!1,l=o[s],c=o[s+1];if(l!==c&&(s!==1||l!==o[0]))if(r)a=!0;else{let h=s*e,u=h-e,d=h+e;for(let p=0;p!==e;++p){let m=t[h+p];if(m!==t[u+p]||m!==t[d+p]){a=!0;break}}}if(a){if(s!==n){o[n]=o[s];let h=s*e,u=n*e;for(let d=0;d!==e;++d)t[u+d]=t[h+d]}++n}}if(i>0){o[n]=o[i];for(let s=i*e,a=n*e,l=0;l!==e;++l)t[a+l]=t[s+l];++n}return n!==o.length?(this.times=o.slice(0,n),this.values=t.slice(0,n*e)):(this.times=o,this.values=t),this}clone(){let o=this.times.slice(),t=this.values.slice(),e=this.constructor,r=new e(this.name,o,t);return r.createInterpolant=this.createInterpolant,r}};GO.prototype.TimeBufferType=Float32Array;GO.prototype.ValueBufferType=Float32Array;GO.prototype.DefaultInterpolation=Ebe;var MW=class extends GO{constructor(o,t,e){super(o,t,e)}};MW.prototype.ValueTypeName="bool";MW.prototype.ValueBufferType=Array;MW.prototype.DefaultInterpolation=qJ;MW.prototype.InterpolantFactoryMethodLinear=void 0;MW.prototype.InterpolantFactoryMethodSmooth=void 0;var nlt=class extends GO{};nlt.prototype.ValueTypeName="color";var olt=class extends GO{};olt.prototype.ValueTypeName="number";var slt=class extends fQ{constructor(o,t,e,r){super(o,t,e,r)}interpolate_(o,t,e,r){let i=this.resultBuffer,n=this.sampleValues,s=this.valueSize,a=(e-t)/(r-t),l=o*s;for(let c=l+s;l!==c;l+=4)kv.slerpFlat(i,0,n,l-s,n,l,a);return i}},NMe=class extends GO{InterpolantFactoryMethodLinear(o){return new slt(this.times,this.values,this.getValueSize(),o)}};NMe.prototype.ValueTypeName="quaternion";NMe.prototype.InterpolantFactoryMethodSmooth=void 0;var NW=class extends GO{constructor(o,t,e){super(o,t,e)}};NW.prototype.ValueTypeName="string";NW.prototype.ValueBufferType=Array;NW.prototype.DefaultInterpolation=qJ;NW.prototype.InterpolantFactoryMethodLinear=void 0;NW.prototype.InterpolantFactoryMethodSmooth=void 0;var alt=class extends GO{};alt.prototype.ValueTypeName="vector";var tDe={enabled:!1,files:{},add:function(o,t){this.enabled!==!1&&(this.files[o]=t)},get:function(o){if(this.enabled!==!1)return this.files[o]},remove:function(o){delete this.files[o]},clear:function(){this.files={}}},llt=class{constructor(o,t,e){let r=this,i=!1,n=0,s=0,a,l=[];this.onStart=void 0,this.onLoad=o,this.onProgress=t,this.onError=e,this.itemStart=function(c){s++,i===!1&&r.onStart!==void 0&&r.onStart(c,n,s),i=!0},this.itemEnd=function(c){n++,r.onProgress!==void 0&&r.onProgress(c,n,s),n===s&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(c){r.onError!==void 0&&r.onError(c)},this.resolveURL=function(c){return a?a(c):c},this.setURLModifier=function(c){return a=c,this},this.addHandler=function(c,h){return l.push(c,h),this},this.removeHandler=function(c){let h=l.indexOf(c);return h!==-1&&l.splice(h,2),this},this.getHandler=function(c){for(let h=0,u=l.length;h<u;h+=2){let d=l[h],p=l[h+1];if(d.global&&(d.lastIndex=0),d.test(c))return p}return null}}},clt=new llt,N2e=class{constructor(o){this.manager=o!==void 0?o:clt,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(o,t){let e=this;return new Promise(function(r,i){e.load(o,r,t,i)})}parse(){}setCrossOrigin(o){return this.crossOrigin=o,this}setWithCredentials(o){return this.withCredentials=o,this}setPath(o){return this.path=o,this}setResourcePath(o){return this.resourcePath=o,this}setRequestHeader(o){return this.requestHeader=o,this}};N2e.DEFAULT_MATERIAL_NAME="__DEFAULT";var wO={},hlt=class extends Error{constructor(o,t){super(o),this.response=t}},ult=class extends N2e{constructor(o){super(o)}load(o,t,e,r){o===void 0&&(o=""),this.path!==void 0&&(o=this.path+o),o=this.manager.resolveURL(o);let i=tDe.get(o);if(i!==void 0)return this.manager.itemStart(o),setTimeout(()=>{t&&t(i),this.manager.itemEnd(o)},0),i;if(wO[o]!==void 0){wO[o].push({onLoad:t,onProgress:e,onError:r});return}wO[o]=[],wO[o].push({onLoad:t,onProgress:e,onError:r});let n=new Request(o,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,a=this.responseType;fetch(n).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;let c=wO[o],h=l.body.getReader(),u=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),d=u?parseInt(u):0,p=d!==0,m=0,g=new ReadableStream({start(y){b();function b(){h.read().then(({done:P,value:T})=>{if(P)y.close();else{m+=T.byteLength;let I=new ProgressEvent("progress",{lengthComputable:p,loaded:m,total:d});for(let C=0,E=c.length;C<E;C++){let O=c[C];O.onProgress&&O.onProgress(I)}y.enqueue(T),b()}},P=>{y.error(P)})}}});return new Response(g)}else throw new hlt(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(a){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(c=>new DOMParser().parseFromString(c,s));case"json":return l.json();default:if(s===void 0)return l.text();{let c=/charset="?([^;"\s]*)"?/i.exec(s),h=c&&c[1]?c[1].toLowerCase():void 0,u=new TextDecoder(h);return l.arrayBuffer().then(d=>u.decode(d))}}}).then(l=>{tDe.add(o,l);let c=wO[o];delete wO[o];for(let h=0,u=c.length;h<u;h++){let d=c[h];d.onLoad&&d.onLoad(l)}}).catch(l=>{let c=wO[o];if(c===void 0)throw this.manager.itemError(o),l;delete wO[o];for(let h=0,u=c.length;h<u;h++){let d=c[h];d.onError&&d.onError(l)}this.manager.itemError(o)}).finally(()=>{this.manager.itemEnd(o)}),this.manager.itemStart(o)}setResponseType(o){return this.responseType=o,this}setMimeType(o){return this.mimeType=o,this}},dlt=class extends N2e{constructor(o){super(o)}load(o,t,e,r){let i=this,n=new Qst,s=new ult(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(i.withCredentials),s.load(o,function(a){let l;try{l=i.parse(a)}catch(c){if(r!==void 0)r(c);else{console.error(c);return}}l.image!==void 0?n.image=l.image:l.data!==void 0&&(n.image.width=l.width,n.image.height=l.height,n.image.data=l.data),n.wrapS=l.wrapS!==void 0?l.wrapS:vv,n.wrapT=l.wrapT!==void 0?l.wrapT:vv,n.magFilter=l.magFilter!==void 0?l.magFilter:tk,n.minFilter=l.minFilter!==void 0?l.minFilter:tk,n.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.colorSpace!==void 0&&(n.colorSpace=l.colorSpace),l.flipY!==void 0&&(n.flipY=l.flipY),l.format!==void 0&&(n.format=l.format),l.type!==void 0&&(n.type=l.type),l.mipmaps!==void 0&&(n.mipmaps=l.mipmaps,n.minFilter=XLe),l.mipmapCount===1&&(n.minFilter=tk),l.generateMipmaps!==void 0&&(n.generateMipmaps=l.generateMipmaps),n.needsUpdate=!0,t&&t(n,l)},e,r),n}},T7t=new fh,I7t=new wt,C7t=new wt,S7t=new fh,E7t=new wt,O7t=new wt,plt=class extends nMe{constructor(o=-1,t=1,e=1,r=-1,i=.1,n=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=o,this.right=t,this.top=e,this.bottom=r,this.near=i,this.far=n,this.updateProjectionMatrix()}copy(o,t){return super.copy(o,t),this.left=o.left,this.right=o.right,this.top=o.top,this.bottom=o.bottom,this.near=o.near,this.far=o.far,this.zoom=o.zoom,this.view=o.view===null?null:Object.assign({},o.view),this}setViewOffset(o,t,e,r,i,n){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=o,this.view.fullHeight=t,this.view.offsetX=e,this.view.offsetY=r,this.view.width=i,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let o=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),e=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=e-o,n=e+o,s=r+t,a=r-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=l*this.view.offsetX,n=i+l*this.view.width,s-=c*this.view.offsetY,a=s-c*this.view.height}this.projectionMatrix.makeOrthographic(i,n,s,a,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(o){let t=super.toJSON(o);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},A7t=new fh,_7t=new fh,v7t=new fh,x7t=new wt,R7t=new kv,D7t=new wt,w7t=new wt,L7t=new wt,M7t=new kv,N7t=new wt,k7t=new wt,k2e="\\[\\]\\.:\\/",flt=new RegExp("["+k2e+"]","g"),B2e="[^"+k2e+"]",mlt="[^"+k2e.replace("\\.","")+"]",glt=/((?:WC+[\/:])*)/.source.replace("WC",B2e),ylt=/(WCOD+)?/.source.replace("WCOD",mlt),blt=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",B2e),Plt=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",B2e),Tlt=new RegExp("^"+glt+ylt+blt+Plt+"$"),Ilt=["material","materials","bones","map"],Clt=class{constructor(o,t,e){let r=e||H0.parseTrackName(t);this._targetGroup=o,this._bindings=o.subscribe_(t,r)}getValue(o,t){this.bind();let e=this._targetGroup.nCachedObjects_,r=this._bindings[e];r!==void 0&&r.getValue(o,t)}setValue(o,t){let e=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=e.length;r!==i;++r)e[r].setValue(o,t)}bind(){let o=this._bindings;for(let t=this._targetGroup.nCachedObjects_,e=o.length;t!==e;++t)o[t].bind()}unbind(){let o=this._bindings;for(let t=this._targetGroup.nCachedObjects_,e=o.length;t!==e;++t)o[t].unbind()}},H0=class $7{constructor(t,e,r){this.path=e,this.parsedPath=r||$7.parseTrackName(e),this.node=$7.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,r){return t&&t.isAnimationObjectGroup?new $7.Composite(t,e,r):new $7(t,e,r)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(flt,"")}static parseTrackName(t){let e=Tlt.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let r={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let n=r.nodeName.substring(i+1);Ilt.indexOf(n)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=n)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return r}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let r=t.skeleton.getBoneByName(e);if(r!==void 0)return r}if(t.children){let r=function(n){for(let s=0;s<n.length;s++){let a=n[s];if(a.name===e||a.uuid===e)return a;let l=r(a.children);if(l)return l}return null},i=r(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)t[e++]=r[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)r[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,r=e.objectName,i=e.propertyName,n=e.propertyIndex;if(t||(t=$7.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(r){let c=e.objectIndex;switch(r){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let h=0;h<t.length;h++)if(t[h].name===c){c=h;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[r]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[r]}if(c!==void 0){if(t[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[c]}}let s=t[i];if(s===void 0){let c=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",t);return}let a=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?a=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(n!==void 0){if(i==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[n]!==void 0&&(n=t.morphTargetDictionary[n])}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=n}else s.fromArray!==void 0&&s.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};H0.Composite=Clt;H0.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};H0.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};H0.prototype.GetterByBindingType=[H0.prototype._getValue_direct,H0.prototype._getValue_array,H0.prototype._getValue_arrayElement,H0.prototype._getValue_toArray];H0.prototype.SetterByBindingTypeAndVersioning=[[H0.prototype._setValue_direct,H0.prototype._setValue_direct_setNeedsUpdate,H0.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[H0.prototype._setValue_array,H0.prototype._setValue_array_setNeedsUpdate,H0.prototype._setValue_array_setMatrixWorldNeedsUpdate],[H0.prototype._setValue_arrayElement,H0.prototype._setValue_arrayElement_setNeedsUpdate,H0.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[H0.prototype._setValue_fromArray,H0.prototype._setValue_fromArray_setNeedsUpdate,H0.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var B7t=new Float32Array(1),F7t=new fh,V7t=new En,G7t=new wt,U7t=new wt,H7t=new wt,W7t=new wt,z7t=new fh,Y7t=new fh,j7t=new wt,X7t=new Cf,q7t=new Cf,$7t=new wt,K7t=new wt,Z7t=new wt,J7t=new wt,Q7t=new nMe,ekt=new Bv,tkt=new wt;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"172"}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="172");var Slt=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,Elt=`#ifdef USE_ALPHAHASH
	const float ALPHA_HASH_SCALE = 0.05;
	float hash2D( vec2 value ) {
		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	}
	float hash3D( vec3 value ) {
		return hash2D( vec2( hash2D( value.xy ), value.z ) );
	}
	float getAlphaHashThreshold( vec3 position ) {
		float maxDeriv = max(
			length( dFdx( position.xyz ) ),
			length( dFdy( position.xyz ) )
		);
		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		vec2 pixScales = vec2(
			exp2( floor( log2( pixScale ) ) ),
			exp2( ceil( log2( pixScale ) ) )
		);
		vec2 alpha = vec2(
			hash3D( floor( pixScales.x * position.xyz ) ),
			hash3D( floor( pixScales.y * position.xyz ) )
		);
		float lerpFactor = fract( log2( pixScale ) );
		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		float a = min( lerpFactor, 1.0 - lerpFactor );
		vec3 cases = vec3(
			x * x / ( 2.0 * a * ( 1.0 - a ) ),
			( x - 0.5 * a ) / ( 1.0 - a ),
			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		);
		float threshold = ( x < ( 1.0 - a ) )
			? ( ( x < a ) ? cases.x : cases.y )
			: cases.z;
		return clamp( threshold , 1.0e-6, 1.0 );
	}
#endif`,Olt=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,Alt=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,_lt=`#ifdef USE_ALPHATEST
	#ifdef ALPHA_TO_COVERAGE
	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
	if ( diffuseColor.a == 0.0 ) discard;
	#else
	if ( diffuseColor.a < alphaTest ) discard;
	#endif
#endif`,vlt=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,xlt=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_CLEARCOAT ) 
		clearcoatSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_SHEEN ) 
		sheenSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,Rlt=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,Dlt=`#ifdef USE_BATCHING
	#if ! defined( GL_ANGLE_multi_draw )
	#define gl_DrawID _gl_DrawID
	uniform int _gl_DrawID;
	#endif
	uniform highp sampler2D batchingTexture;
	uniform highp usampler2D batchingIdTexture;
	mat4 getBatchingMatrix( const in float i ) {
		int size = textureSize( batchingTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
	float getIndirectIndex( const in int i ) {
		int size = textureSize( batchingIdTexture, 0 ).x;
		int x = i % size;
		int y = i / size;
		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
	}
#endif
#ifdef USE_BATCHING_COLOR
	uniform sampler2D batchingColorTexture;
	vec3 getBatchingColor( const in float i ) {
		int size = textureSize( batchingColorTexture, 0 ).x;
		int j = int( i );
		int x = j % size;
		int y = j / size;
		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
	}
#endif`,wlt=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,Llt=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,Mlt=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,Nlt=`float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
} // validated`,klt=`#ifdef USE_IRIDESCENCE
	const mat3 XYZ_TO_REC709 = mat3(
		 3.2404542, -0.9692660,  0.0556434,
		-1.5371385,  1.8760108, -0.2040259,
		-0.4985314,  0.0415560,  1.0572252
	);
	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		vec3 sqrtF0 = sqrt( fresnel0 );
		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	}
	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	}
	float IorToFresnel0( float transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	}
	vec3 evalSensitivity( float OPD, vec3 shift ) {
		float phase = 2.0 * PI * OPD * 1.0e-9;
		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
		xyz /= 1.0685e-7;
		vec3 rgb = XYZ_TO_REC709 * xyz;
		return rgb;
	}
	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		vec3 I;
		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		float cosTheta2Sq = 1.0 - sinTheta2Sq;
		if ( cosTheta2Sq < 0.0 ) {
			return vec3( 1.0 );
		}
		float cosTheta2 = sqrt( cosTheta2Sq );
		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		float T121 = 1.0 - R12;
		float phi12 = 0.0;
		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
		float phi21 = PI - phi12;
		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		vec3 phi23 = vec3( 0.0 );
		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		vec3 phi = vec3( phi21 ) + phi23;
		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		vec3 r123 = sqrt( R123 );
		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		vec3 C0 = R12 + Rs;
		I = C0;
		vec3 Cm = Rs - T121;
		for ( int m = 1; m <= 2; ++ m ) {
			Cm *= r123;
			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			I += Cm * Sm;
		}
		return max( I, vec3( 0.0 ) );
	}
#endif`,Blt=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vBumpMapUv );
		vec2 dSTdy = dFdy( vBumpMapUv );
		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,Flt=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#ifdef ALPHA_TO_COVERAGE
		float distanceToPlane, distanceGradient;
		float clipOpacity = 1.0;
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
			distanceGradient = fwidth( distanceToPlane ) / 2.0;
			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			if ( clipOpacity == 0.0 ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			float unionClipOpacity = 1.0;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
				distanceGradient = fwidth( distanceToPlane ) / 2.0;
				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			}
			#pragma unroll_loop_end
			clipOpacity *= 1.0 - unionClipOpacity;
		#endif
		diffuseColor.a *= clipOpacity;
		if ( diffuseColor.a == 0.0 ) discard;
	#else
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			bool clipped = true;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
			}
			#pragma unroll_loop_end
			if ( clipped ) discard;
		#endif
	#endif
#endif`,Vlt=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,Glt=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,Ult=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,Hlt=`#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`,Wlt=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`,zlt=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec3 vColor;
#endif`,Ylt=`#if defined( USE_COLOR_ALPHA )
	vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
	vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.xyz *= instanceColor.xyz;
#endif
#ifdef USE_BATCHING_COLOR
	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
	vColor.xyz *= batchingColor.xyz;
#endif`,jlt=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
	varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,Xlt=`#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x > absDirection.z ) {
			if ( absDirection.x > absDirection.y )
				face = direction.x > 0.0 ? 0.0 : 3.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z > absDirection.y )
				face = direction.z > 0.0 ? 2.0 : 5.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		if ( face > 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		uv.x *= CUBEUV_TEXEL_WIDTH;
		uv.y *= CUBEUV_TEXEL_HEIGHT;
		#ifdef texture2DGradEXT
			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		#else
			return texture2D( envMap, uv ).rgb;
		#endif
	}
	#define cubeUV_r0 1.0
	#define cubeUV_m0 - 2.0
	#define cubeUV_r1 0.8
	#define cubeUV_m1 - 1.0
	#define cubeUV_r4 0.4
	#define cubeUV_m4 2.0
	#define cubeUV_r5 0.305
	#define cubeUV_m5 3.0
	#define cubeUV_r6 0.21
	#define cubeUV_m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness >= cubeUV_r1 ) {
			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
		} else if ( roughness >= cubeUV_r4 ) {
			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
		} else if ( roughness >= cubeUV_r5 ) {
			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
		} else if ( roughness >= cubeUV_r6 ) {
			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`,qlt=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
	vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
	mat3 bm = mat3( batchingMatrix );
	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
	transformedNormal = bm * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = bm * transformedTangent;
	#endif
#endif
#ifdef USE_INSTANCING
	mat3 im = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
	transformedNormal = im * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = im * transformedTangent;
	#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,$lt=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,Klt=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,Zlt=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,Jlt=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,Qlt="gl_FragColor = linearToOutputTexel( gl_FragColor );",ect=`vec4 LinearTransferOETF( in vec4 value ) {
	return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 sRGBTransferOETF( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,tct=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	#else
		vec4 envColor = vec4( 0.0 );
	#endif
	#ifdef ENVMAP_BLENDING_MULTIPLY
		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_MIX )
		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_ADD )
		outgoingLight += envColor.xyz * specularStrength * reflectivity;
	#endif
#endif`,rct=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	uniform mat3 envMapRotation;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	
#endif`,ict=`#ifdef USE_ENVMAP
	uniform float reflectivity;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		varying vec3 vWorldPosition;
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`,nct=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`,oct=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex;
		if ( isOrthographic ) {
			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,sct=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,act=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,lct=`#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,cct=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,hct=`#ifdef USE_GRADIENTMAP
	uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	float dotNL = dot( normal, lightDirection );
	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	#ifdef USE_GRADIENTMAP
		return vec3( texture2D( gradientMap, coord ).r );
	#else
		vec2 fw = fwidth( coord ) * 0.5;
		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
	#endif
}`,uct=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,dct=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,pct=`varying vec3 vViewPosition;
struct LambertMaterial {
	vec3 diffuseColor;
	float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Lambert
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,fct=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
	uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
	if ( cutoffDistance > 0.0 ) {
		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
	}
	return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation > 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,mct=`#ifdef USE_ENVMAP
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	#ifdef USE_ANISOTROPY
		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
			#ifdef ENVMAP_TYPE_CUBE_UV
				vec3 bentNormal = cross( bitangent, viewDir );
				bentNormal = normalize( cross( bentNormal, bitangent ) );
				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
				return getIBLRadiance( viewDir, bentNormal, roughness );
			#else
				return vec3( 0.0 );
			#endif
		}
	#endif
#endif`,gct=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,yct=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,bct=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,Pct=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,Tct=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	material.ior = ior;
	#ifdef USE_SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULAR_COLORMAP
			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
		#endif
		#ifdef USE_SPECULAR_INTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
	material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEEN_COLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
	#ifdef USE_SHEEN_ROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
	#endif
#endif
#ifdef USE_ANISOTROPY
	#ifdef USE_ANISOTROPYMAP
		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
	#else
		vec2 anisotropyV = anisotropyVector;
	#endif
	material.anisotropy = length( anisotropyV );
	if( material.anisotropy == 0.0 ) {
		anisotropyV = vec2( 1.0, 0.0 );
	} else {
		anisotropyV /= material.anisotropy;
		material.anisotropy = saturate( material.anisotropy );
	}
	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,Ict=`struct PhysicalMaterial {
	vec3 diffuseColor;
	float roughness;
	vec3 specularColor;
	float specularF90;
	float dispersion;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
	#ifdef IOR
		float ior;
	#endif
	#ifdef USE_TRANSMISSION
		float transmission;
		float transmissionAlpha;
		float thickness;
		float attenuationDistance;
		vec3 attenuationColor;
	#endif
	#ifdef USE_ANISOTROPY
		float anisotropy;
		float alphaT;
		vec3 anisotropyT;
		vec3 anisotropyB;
	#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
		float v = 0.5 / ( gv + gl );
		return saturate(v);
	}
	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
		float a2 = alphaT * alphaB;
		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
		highp float v2 = dot( v, v );
		float w2 = a2 / v2;
		return RECIPROCAL_PI * a2 * pow2 ( w2 );
	}
#endif
#ifdef USE_CLEARCOAT
	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
		vec3 f0 = material.clearcoatF0;
		float f90 = material.clearcoatF90;
		float roughness = material.clearcoatRoughness;
		float alpha = pow2( roughness );
		vec3 halfDir = normalize( lightDir + viewDir );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float dotNH = saturate( dot( normal, halfDir ) );
		float dotVH = saturate( dot( viewDir, halfDir ) );
		vec3 F = F_Schlick( f0, f90, dotVH );
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
		return F * ( V * D );
	}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 f0 = material.specularColor;
	float f90 = material.specularF90;
	float roughness = material.roughness;
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	#ifdef USE_IRIDESCENCE
		F = mix( F, material.iridescenceFresnel, material.iridescence );
	#endif
	#ifdef USE_ANISOTROPY
		float dotTL = dot( material.anisotropyT, lightDir );
		float dotTV = dot( material.anisotropyT, viewDir );
		float dotTH = dot( material.anisotropyT, halfDir );
		float dotBL = dot( material.anisotropyB, lightDir );
		float dotBV = dot( material.anisotropyB, viewDir );
		float dotBH = dot( material.anisotropyB, halfDir );
		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
	#else
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
	#endif
	return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
	return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
	return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometryNormal;
		vec3 viewDir = geometryViewDir;
		vec3 position = geometryPosition;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
	#endif
	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
	#endif
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
	#else
		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
	#endif
	vec3 totalScattering = singleScattering + multiScattering;
	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
	reflectedLight.indirectSpecular += radiance * singleScattering;
	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,Cct=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
	geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
	float dotNVi = saturate( dot( normal, geometryViewDir ) );
	if ( material.iridescenceThickness == 0.0 ) {
		material.iridescence = 0.0;
	} else {
		material.iridescence = saturate( material.iridescence );
	}
	if ( material.iridescence > 0.0 ) {
		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometryPosition, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometryPosition, directLight );
		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	#if defined( USE_LIGHT_PROBES )
		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	#endif
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,Sct=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getIBLIrradiance( geometryNormal );
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	#ifdef USE_ANISOTROPY
		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	#else
		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	#endif
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,Ect=`#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,Oct=`#if defined( USE_LOGDEPTHBUF )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,Act=`#if defined( USE_LOGDEPTHBUF )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,_ct=`#ifdef USE_LOGDEPTHBUF
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,vct=`#ifdef USE_LOGDEPTHBUF
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,xct=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,Rct=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,Dct=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	#if defined( USE_POINTS_UV )
		vec2 uv = vUv;
	#else
		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
	#endif
#endif
#ifdef USE_MAP
	diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,wct=`#if defined( USE_POINTS_UV )
	varying vec2 vUv;
#else
	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
		uniform mat3 uvTransform;
	#endif
#endif
#ifdef USE_MAP
	uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,Lct=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,Mct=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,Nct=`#ifdef USE_INSTANCING_MORPH
	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
	}
#endif`,kct=`#if defined( USE_MORPHCOLORS )
	vColor *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		#if defined( USE_COLOR_ALPHA )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		#elif defined( USE_COLOR )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,Bct=`#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,Fct=`#ifdef USE_MORPHTARGETS
	#ifndef USE_INSTANCING_MORPH
		uniform float morphTargetBaseInfluence;
		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	#endif
	uniform sampler2DArray morphTargetsTexture;
	uniform ivec2 morphTargetsTextureSize;
	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
		int y = texelIndex / morphTargetsTextureSize.x;
		int x = texelIndex - y * morphTargetsTextureSize.x;
		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
		return texelFetch( morphTargetsTexture, morphUV, 0 );
	}
#endif`,Vct=`#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,Gct=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = dFdx( vViewPosition );
	vec3 fdy = dFdy( vViewPosition );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal *= faceDirection;
	#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
	#ifdef USE_TANGENT
		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn = getTangentFrame( - vViewPosition, normal,
		#if defined( USE_NORMALMAP )
			vNormalMapUv
		#elif defined( USE_CLEARCOAT_NORMALMAP )
			vClearcoatNormalMapUv
		#else
			vUv
		#endif
		);
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn[0] *= faceDirection;
		tbn[1] *= faceDirection;
	#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	#ifdef USE_TANGENT
		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn2[0] *= faceDirection;
		tbn2[1] *= faceDirection;
	#endif
#endif
vec3 nonPerturbedNormal = normal;`,Uct=`#ifdef USE_NORMALMAP_OBJECTSPACE
	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	#ifdef FLIP_SIDED
		normal = - normal;
	#endif
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	mapN.xy *= normalScale;
	normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,Hct=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,Wct=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,zct=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,Yct=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
		vec3 q0 = dFdx( eye_pos.xyz );
		vec3 q1 = dFdy( eye_pos.xyz );
		vec2 st0 = dFdx( uv.st );
		vec2 st1 = dFdy( uv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
		return mat3( T * scale, B * scale, N );
	}
#endif`,jct=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,Xct=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,qct=`#ifdef USE_CLEARCOATMAP
	uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform sampler2D clearcoatNormalMap;
	uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform sampler2D clearcoatRoughnessMap;
#endif`,$ct=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,Kct=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Zct=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
	if( v <= 0.0 )
		return vec4( 0., 0., 0., 0. );
	if( v >= 1.0 )
		return vec4( 1., 1., 1., 1. );
	float vuf;
	float af = modf( v * PackFactors.a, vuf );
	float bf = modf( vuf * ShiftRight8, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
	if( v <= 0.0 )
		return vec3( 0., 0., 0. );
	if( v >= 1.0 )
		return vec3( 1., 1., 1. );
	float vuf;
	float bf = modf( v * PackFactors.b, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
	if( v <= 0.0 )
		return vec2( 0., 0. );
	if( v >= 1.0 )
		return vec2( 1., 1. );
	float vuf;
	float gf = modf( v * 256., vuf );
	return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
	return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return ( near * far ) / ( ( far - near ) * depth - far );
}`,Jct=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,Qct=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
	mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,eht=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,tht=`#ifdef DITHERING
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`,rht=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,iht=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,nht=`#if NUM_SPOT_LIGHT_COORDS > 0
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
	}
	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
		return unpackRGBATo2Half( texture2D( shadow, uv ) );
	}
	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
		float occlusion = 1.0;
		vec2 distribution = texture2DDistribution( shadow, uv );
		float hard_shadow = step( compare , distribution.x );
		if (hard_shadow != 1.0 ) {
			float distance = compare - distribution.x ;
			float variance = max( 0.00000, distribution.y * distribution.y );
			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
		}
		return occlusion;
	}
	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		float shadow = 1.0;
		shadowCoord.xyz /= shadowCoord.w;
		shadowCoord.z += shadowBias;
		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
		if ( frustumTest ) {
		#if defined( SHADOWMAP_TYPE_PCF )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			float dx2 = dx0 / 2.0;
			float dy2 = dy0 / 2.0;
			float dx3 = dx1 / 2.0;
			float dy3 = dy1 / 2.0;
			shadow = (
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 17.0 );
		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx = texelSize.x;
			float dy = texelSize.y;
			vec2 uv = shadowCoord.xy;
			vec2 f = fract( uv * shadowMapSize + 0.5 );
			uv -= f * texelSize;
			shadow = (
				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
						  f.x ),
					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
						  f.x ),
					 f.y )
			) * ( 1.0 / 9.0 );
		#elif defined( SHADOWMAP_TYPE_VSM )
			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
		#else
			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	vec2 cubeToUV( vec3 v, float texelSizeY ) {
		vec3 absV = abs( v );
		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		absV *= scaleToCube;
		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		vec2 planar = v.xy;
		float almostATexel = 1.5 * texelSizeY;
		float almostOne = 1.0 - almostATexel;
		if ( absV.z >= almostOne ) {
			if ( v.z > 0.0 )
				planar.x = 4.0 - v.x;
		} else if ( absV.x >= almostOne ) {
			float signX = sign( v.x );
			planar.x = v.z * signX + 2.0 * signX;
		} else if ( absV.y >= almostOne ) {
			float signY = sign( v.y );
			planar.x = v.x + 2.0 * signY + 2.0;
			planar.y = v.z * signY - 2.0;
		}
		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	}
	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		
		float lightToPositionLength = length( lightToPosition );
		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
			vec3 bd3D = normalize( lightToPosition );
			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
				shadow = (
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
				) * ( 1.0 / 9.0 );
			#else
				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
			#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
#endif`,oht=`#if NUM_SPOT_LIGHT_COORDS > 0
	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,sht=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
	vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
	#if NUM_DIR_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
		shadowWorldPosition = worldPosition;
		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
		#endif
		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
#endif`,aht=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,lht=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,cht=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	mat4 getBoneMatrix( const in float i ) {
		int size = textureSize( boneTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
#endif`,hht=`#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,uht=`#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`,dht=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,pht=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,fht=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,mht=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
	vec3( 1.6605, - 0.1246, - 0.0182 ),
	vec3( - 0.5876, 1.1329, - 0.1006 ),
	vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
	vec3( 0.6274, 0.0691, 0.0164 ),
	vec3( 0.3293, 0.9195, 0.0880 ),
	vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
	vec3 x2 = x * x;
	vec3 x4 = x2 * x2;
	return + 15.5 * x4 * x2
		- 40.14 * x4 * x
		+ 31.96 * x4
		- 6.868 * x2 * x
		+ 0.4298 * x2
		+ 0.1191 * x
		- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
	const mat3 AgXInsetMatrix = mat3(
		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
	);
	const mat3 AgXOutsetMatrix = mat3(
		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
	);
	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
	color *= toneMappingExposure;
	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
	color = AgXInsetMatrix * color;
	color = max( color, 1e-10 );	color = log2( color );
	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
	color = clamp( color, 0.0, 1.0 );
	color = agxDefaultContrastApprox( color );
	color = AgXOutsetMatrix * color;
	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
	color = clamp( color, 0.0, 1.0 );
	return color;
}
vec3 NeutralToneMapping( vec3 color ) {
	const float StartCompression = 0.8 - 0.04;
	const float Desaturation = 0.15;
	color *= toneMappingExposure;
	float x = min( color.r, min( color.g, color.b ) );
	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
	color -= offset;
	float peak = max( color.r, max( color.g, color.b ) );
	if ( peak < StartCompression ) return color;
	float d = 1. - StartCompression;
	float newPeak = 1. - d * d / ( peak + d - StartCompression );
	color *= newPeak / peak;
	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
	return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,ght=`#ifdef USE_TRANSMISSION
	material.transmission = transmission;
	material.transmissionAlpha = 1.0;
	material.thickness = thickness;
	material.attenuationDistance = attenuationDistance;
	material.attenuationColor = attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmitted = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
		material.attenuationColor, material.attenuationDistance );
	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,yht=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	float w0( float a ) {
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
	}
	float w1( float a ) {
		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
	}
	float w2( float a ){
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
	}
	float w3( float a ) {
		return ( 1.0 / 6.0 ) * ( a * a * a );
	}
	float g0( float a ) {
		return w0( a ) + w1( a );
	}
	float g1( float a ) {
		return w2( a ) + w3( a );
	}
	float h0( float a ) {
		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
	}
	float h1( float a ) {
		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
	}
	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
		uv = uv * texelSize.zw + 0.5;
		vec2 iuv = floor( uv );
		vec2 fuv = fract( uv );
		float g0x = g0( fuv.x );
		float g1x = g1( fuv.x );
		float h0x = h0( fuv.x );
		float h1x = h1( fuv.x );
		float h0y = h0( fuv.y );
		float h1y = h1( fuv.y );
		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
	}
	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
		vec2 fLodSizeInv = 1.0 / fLodSize;
		vec2 cLodSizeInv = 1.0 / cLodSize;
		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
		return mix( fSample, cSample, fract( lod ) );
	}
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
	}
	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( isinf( attenuationDistance ) ) {
			return vec3( 1.0 );
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec4 transmittedLight;
		vec3 transmittance;
		#ifdef USE_DISPERSION
			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
			for ( int i = 0; i < 3; i ++ ) {
				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
				vec3 refractedRayExit = position + transmissionRay;
				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
				refractionCoords += 1.0;
				refractionCoords /= 2.0;
				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
				transmittedLight[ i ] = transmissionSample[ i ];
				transmittedLight.a += transmissionSample.a;
				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
			}
			transmittedLight.a /= 3.0;
		#else
			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
			vec3 refractedRayExit = position + transmissionRay;
			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
			refractionCoords += 1.0;
			refractionCoords /= 2.0;
			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
		#endif
		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
	}
#endif`,bht=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,Pht=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	uniform mat3 mapTransform;
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	uniform mat3 alphaMapTransform;
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	uniform mat3 lightMapTransform;
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	uniform mat3 aoMapTransform;
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	uniform mat3 bumpMapTransform;
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	uniform mat3 normalMapTransform;
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
	uniform mat3 displacementMapTransform;
	varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	uniform mat3 emissiveMapTransform;
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	uniform mat3 metalnessMapTransform;
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	uniform mat3 roughnessMapTransform;
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	uniform mat3 anisotropyMapTransform;
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	uniform mat3 clearcoatMapTransform;
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform mat3 clearcoatNormalMapTransform;
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform mat3 clearcoatRoughnessMapTransform;
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	uniform mat3 sheenColorMapTransform;
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	uniform mat3 sheenRoughnessMapTransform;
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	uniform mat3 iridescenceMapTransform;
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform mat3 iridescenceThicknessMapTransform;
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
	uniform mat3 specularMapTransform;
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	uniform mat3 specularColorMapTransform;
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	uniform mat3 specularIntensityMapTransform;
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,Tht=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,Iht=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_BATCHING
		worldPosition = batchingMatrix * worldPosition;
	#endif
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`,Cht=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,Sht=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Eht=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,Oht=`#ifdef ENVMAP_TYPE_CUBE
	uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
	uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	#ifdef ENVMAP_TYPE_CUBE
		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
	#else
		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Aht=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,_ht=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
	gl_FragColor = texColor;
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,vht=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`,xht=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <logdepthbuf_fragment>
	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#elif DEPTH_PACKING == 3202
		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
	#elif DEPTH_PACKING == 3203
		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
	#endif
}`,Rht=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,Dht=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`,wht=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,Lht=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Mht=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,Nht=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,kht=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinbase_vertex>
		#include <skinnormal_vertex>
		#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,Bht=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Fht=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Vht=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_lambert_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Ght=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,Uht=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
	#else
		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Hht=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	vViewPosition = - mvPosition.xyz;
#endif
}`,Wht=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,zht=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Yht=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,jht=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,Xht=`#define STANDARD
#ifdef PHYSICAL
	#define IOR
	#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
	uniform float ior;
#endif
#ifdef USE_SPECULAR
	uniform float specularIntensity;
	uniform vec3 specularColor;
	#ifdef USE_SPECULAR_COLORMAP
		uniform sampler2D specularColorMap;
	#endif
	#ifdef USE_SPECULAR_INTENSITYMAP
		uniform sampler2D specularIntensityMap;
	#endif
#endif
#ifdef USE_CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
	uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEEN_COLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEEN_ROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
#ifdef USE_ANISOTROPY
	uniform vec2 anisotropyVector;
	#ifdef USE_ANISOTROPYMAP
		uniform sampler2D anisotropyMap;
	#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
	#endif
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,qht=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,$ht=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Kht=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
	varying vec2 vUv;
	uniform mat3 uvTransform;
#endif
void main() {
	#ifdef USE_POINTS_UV
		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	#endif
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,Zht=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,Jht=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Qht=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	#include <logdepthbuf_fragment>
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,eut=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix[ 3 ];
	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,tut=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,Ec={alphahash_fragment:Slt,alphahash_pars_fragment:Elt,alphamap_fragment:Olt,alphamap_pars_fragment:Alt,alphatest_fragment:_lt,alphatest_pars_fragment:vlt,aomap_fragment:xlt,aomap_pars_fragment:Rlt,batching_pars_vertex:Dlt,batching_vertex:wlt,begin_vertex:Llt,beginnormal_vertex:Mlt,bsdfs:Nlt,iridescence_fragment:klt,bumpmap_pars_fragment:Blt,clipping_planes_fragment:Flt,clipping_planes_pars_fragment:Vlt,clipping_planes_pars_vertex:Glt,clipping_planes_vertex:Ult,color_fragment:Hlt,color_pars_fragment:Wlt,color_pars_vertex:zlt,color_vertex:Ylt,common:jlt,cube_uv_reflection_fragment:Xlt,defaultnormal_vertex:qlt,displacementmap_pars_vertex:$lt,displacementmap_vertex:Klt,emissivemap_fragment:Zlt,emissivemap_pars_fragment:Jlt,colorspace_fragment:Qlt,colorspace_pars_fragment:ect,envmap_fragment:tct,envmap_common_pars_fragment:rct,envmap_pars_fragment:ict,envmap_pars_vertex:nct,envmap_physical_pars_fragment:mct,envmap_vertex:oct,fog_vertex:sct,fog_pars_vertex:act,fog_fragment:lct,fog_pars_fragment:cct,gradientmap_pars_fragment:hct,lightmap_pars_fragment:uct,lights_lambert_fragment:dct,lights_lambert_pars_fragment:pct,lights_pars_begin:fct,lights_toon_fragment:gct,lights_toon_pars_fragment:yct,lights_phong_fragment:bct,lights_phong_pars_fragment:Pct,lights_physical_fragment:Tct,lights_physical_pars_fragment:Ict,lights_fragment_begin:Cct,lights_fragment_maps:Sct,lights_fragment_end:Ect,logdepthbuf_fragment:Oct,logdepthbuf_pars_fragment:Act,logdepthbuf_pars_vertex:_ct,logdepthbuf_vertex:vct,map_fragment:xct,map_pars_fragment:Rct,map_particle_fragment:Dct,map_particle_pars_fragment:wct,metalnessmap_fragment:Lct,metalnessmap_pars_fragment:Mct,morphinstance_vertex:Nct,morphcolor_vertex:kct,morphnormal_vertex:Bct,morphtarget_pars_vertex:Fct,morphtarget_vertex:Vct,normal_fragment_begin:Gct,normal_fragment_maps:Uct,normal_pars_fragment:Hct,normal_pars_vertex:Wct,normal_vertex:zct,normalmap_pars_fragment:Yct,clearcoat_normal_fragment_begin:jct,clearcoat_normal_fragment_maps:Xct,clearcoat_pars_fragment:qct,iridescence_pars_fragment:$ct,opaque_fragment:Kct,packing:Zct,premultiplied_alpha_fragment:Jct,project_vertex:Qct,dithering_fragment:eht,dithering_pars_fragment:tht,roughnessmap_fragment:rht,roughnessmap_pars_fragment:iht,shadowmap_pars_fragment:nht,shadowmap_pars_vertex:oht,shadowmap_vertex:sht,shadowmask_pars_fragment:aht,skinbase_vertex:lht,skinning_pars_vertex:cht,skinning_vertex:hht,skinnormal_vertex:uht,specularmap_fragment:dht,specularmap_pars_fragment:pht,tonemapping_fragment:fht,tonemapping_pars_fragment:mht,transmission_fragment:ght,transmission_pars_fragment:yht,uv_pars_fragment:bht,uv_pars_vertex:Pht,uv_vertex:Tht,worldpos_vertex:Iht,background_vert:Cht,background_frag:Sht,backgroundCube_vert:Eht,backgroundCube_frag:Oht,cube_vert:Aht,cube_frag:_ht,depth_vert:vht,depth_frag:xht,distanceRGBA_vert:Rht,distanceRGBA_frag:Dht,equirect_vert:wht,equirect_frag:Lht,linedashed_vert:Mht,linedashed_frag:Nht,meshbasic_vert:kht,meshbasic_frag:Bht,meshlambert_vert:Fht,meshlambert_frag:Vht,meshmatcap_vert:Ght,meshmatcap_frag:Uht,meshnormal_vert:Hht,meshnormal_frag:Wht,meshphong_vert:zht,meshphong_frag:Yht,meshphysical_vert:jht,meshphysical_frag:Xht,meshtoon_vert:qht,meshtoon_frag:$ht,points_vert:Kht,points_frag:Zht,shadow_vert:Jht,shadow_frag:Qht,sprite_vert:eut,sprite_frag:tut},zn={common:{diffuse:{value:new Cf(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ul},alphaMap:{value:null},alphaMapTransform:{value:new Ul},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ul}},envmap:{envMap:{value:null},envMapRotation:{value:new Ul},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ul}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ul}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ul},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ul},normalScale:{value:new En(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ul},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ul}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ul}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ul}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Cf(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Cf(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ul},alphaTest:{value:0},uvTransform:{value:new Ul}},sprite:{diffuse:{value:new Cf(16777215)},opacity:{value:1},center:{value:new En(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ul},alphaMap:{value:null},alphaMapTransform:{value:new Ul},alphaTest:{value:0}}},rDe={basic:{uniforms:O2([zn.common,zn.specularmap,zn.envmap,zn.aomap,zn.lightmap,zn.fog]),vertexShader:Ec.meshbasic_vert,fragmentShader:Ec.meshbasic_frag},lambert:{uniforms:O2([zn.common,zn.specularmap,zn.envmap,zn.aomap,zn.lightmap,zn.emissivemap,zn.bumpmap,zn.normalmap,zn.displacementmap,zn.fog,zn.lights,{emissive:{value:new Cf(0)}}]),vertexShader:Ec.meshlambert_vert,fragmentShader:Ec.meshlambert_frag},phong:{uniforms:O2([zn.common,zn.specularmap,zn.envmap,zn.aomap,zn.lightmap,zn.emissivemap,zn.bumpmap,zn.normalmap,zn.displacementmap,zn.fog,zn.lights,{emissive:{value:new Cf(0)},specular:{value:new Cf(1118481)},shininess:{value:30}}]),vertexShader:Ec.meshphong_vert,fragmentShader:Ec.meshphong_frag},standard:{uniforms:O2([zn.common,zn.envmap,zn.aomap,zn.lightmap,zn.emissivemap,zn.bumpmap,zn.normalmap,zn.displacementmap,zn.roughnessmap,zn.metalnessmap,zn.fog,zn.lights,{emissive:{value:new Cf(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ec.meshphysical_vert,fragmentShader:Ec.meshphysical_frag},toon:{uniforms:O2([zn.common,zn.aomap,zn.lightmap,zn.emissivemap,zn.bumpmap,zn.normalmap,zn.displacementmap,zn.gradientmap,zn.fog,zn.lights,{emissive:{value:new Cf(0)}}]),vertexShader:Ec.meshtoon_vert,fragmentShader:Ec.meshtoon_frag},matcap:{uniforms:O2([zn.common,zn.bumpmap,zn.normalmap,zn.displacementmap,zn.fog,{matcap:{value:null}}]),vertexShader:Ec.meshmatcap_vert,fragmentShader:Ec.meshmatcap_frag},points:{uniforms:O2([zn.points,zn.fog]),vertexShader:Ec.points_vert,fragmentShader:Ec.points_frag},dashed:{uniforms:O2([zn.common,zn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ec.linedashed_vert,fragmentShader:Ec.linedashed_frag},depth:{uniforms:O2([zn.common,zn.displacementmap]),vertexShader:Ec.depth_vert,fragmentShader:Ec.depth_frag},normal:{uniforms:O2([zn.common,zn.bumpmap,zn.normalmap,zn.displacementmap,{opacity:{value:1}}]),vertexShader:Ec.meshnormal_vert,fragmentShader:Ec.meshnormal_frag},sprite:{uniforms:O2([zn.sprite,zn.fog]),vertexShader:Ec.sprite_vert,fragmentShader:Ec.sprite_frag},background:{uniforms:{uvTransform:{value:new Ul},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ec.background_vert,fragmentShader:Ec.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ul}},vertexShader:Ec.backgroundCube_vert,fragmentShader:Ec.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ec.cube_vert,fragmentShader:Ec.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ec.equirect_vert,fragmentShader:Ec.equirect_frag},distanceRGBA:{uniforms:O2([zn.common,zn.displacementmap,{referencePosition:{value:new wt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ec.distanceRGBA_vert,fragmentShader:Ec.distanceRGBA_frag},shadow:{uniforms:O2([zn.lights,zn.fog,{color:{value:new Cf(0)},opacity:{value:1}}]),vertexShader:Ec.shadow_vert,fragmentShader:Ec.shadow_frag}};rDe.physical={uniforms:O2([rDe.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ul},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ul},clearcoatNormalScale:{value:new En(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ul},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ul},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ul},sheen:{value:0},sheenColor:{value:new Cf(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ul},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ul},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ul},transmissionSamplerSize:{value:new En},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ul},attenuationDistance:{value:0},attenuationColor:{value:new Cf(0)},specularColor:{value:new Cf(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ul},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ul},anisotropyVector:{value:new En},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ul}}]),vertexShader:Ec.meshphysical_vert,fragmentShader:Ec.meshphysical_frag};var rkt=new wW,ikt=new fh,nkt=new plt,okt=new Cf,_L=(1+Math.sqrt(5))/2,z7=1/_L,skt=[new wt(-_L,z7,0),new wt(_L,z7,0),new wt(-z7,0,_L),new wt(z7,0,_L),new wt(0,_L,-z7),new wt(0,_L,z7),new wt(-1,1,-1),new wt(1,1,-1),new wt(-1,1,1),new wt(1,1,1)],akt=new VO,lkt=new nat(1,1),ckt=new Rst,hkt=new Dst,ukt=new Jst,dkt=new Float32Array(16),pkt=new Float32Array(9),fkt=new Float32Array(4),mkt=new Ul,gkt=new wt,ykt={[PRe]:TRe,[IRe]:ERe,[CRe]:ORe,[XJ]:SRe,[TRe]:PRe,[ERe]:IRe,[ORe]:CRe,[SRe]:XJ},bkt=new wW,Pkt=new fh,rut=class extends dlt{constructor(o){super(o),this.type=ZZ}parse(o){let t=function(g,y){switch(g){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(y||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(y||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(y||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(y||""))}},e=function(g,y,b){y=y||1024;let P=g.pos,T=-1,I=0,C="",E=String.fromCharCode.apply(null,new Uint16Array(g.subarray(P,P+128)));for(;0>(T=E.indexOf(`
`))&&I<y&&P<g.byteLength;)C+=E,I+=E.length,P+=128,E+=String.fromCharCode.apply(null,new Uint16Array(g.subarray(P,P+128)));return-1<T?(b!==!1&&(g.pos+=I+T+1),C+E.slice(0,T)):!1},r=function(g){let y=/^#\?(\S+)/,b=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,P=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,T=/^\s*FORMAT=(\S+)\s*$/,I=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,C={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0},E,O;for((g.pos>=g.byteLength||!(E=e(g)))&&t(1,"no header found"),(O=E.match(y))||t(3,"bad initial token"),C.valid|=1,C.programtype=O[1],C.string+=E+`
`;E=e(g),E!==!1;){if(C.string+=E+`
`,E.charAt(0)==="#"){C.comments+=E+`
`;continue}if((O=E.match(b))&&(C.gamma=parseFloat(O[1])),(O=E.match(P))&&(C.exposure=parseFloat(O[1])),(O=E.match(T))&&(C.valid|=2,C.format=O[1]),(O=E.match(I))&&(C.valid|=4,C.height=parseInt(O[1],10),C.width=parseInt(O[2],10)),C.valid&2&&C.valid&4)break}return C.valid&2||t(3,"missing format specifier"),C.valid&4||t(3,"missing image size specifier"),C},i=function(g,y,b){let P=y;if(P<8||P>32767||g[0]!==2||g[1]!==2||g[2]&128)return new Uint8Array(g);P!==(g[2]<<8|g[3])&&t(3,"wrong scanline width");let T=new Uint8Array(4*y*b);T.length||t(4,"unable to allocate buffer space");let I=0,C=0,E=4*P,O=new Uint8Array(4),_=new Uint8Array(E),R=b;for(;R>0&&C<g.byteLength;){C+4>g.byteLength&&t(1),O[0]=g[C++],O[1]=g[C++],O[2]=g[C++],O[3]=g[C++],(O[0]!=2||O[1]!=2||(O[2]<<8|O[3])!=P)&&t(3,"bad rgbe scanline format");let v=0,D;for(;v<E&&C<g.byteLength;){D=g[C++];let F=D>128;if(F&&(D-=128),(D===0||v+D>E)&&t(3,"bad scanline data"),F){let H=g[C++];for(let z=0;z<D;z++)_[v++]=H}else _.set(g.subarray(C,C+D),v),v+=D,C+=D}let w=P;for(let F=0;F<w;F++){let H=0;T[I]=_[F+H],H+=P,T[I+1]=_[F+H],H+=P,T[I+2]=_[F+H],H+=P,T[I+3]=_[F+H],I+=4}R--}return T},n=function(g,y,b,P){let T=g[y+3],I=Math.pow(2,T-128)/255;b[P+0]=g[y+0]*I,b[P+1]=g[y+1]*I,b[P+2]=g[y+2]*I,b[P+3]=1},s=function(g,y,b,P){let T=g[y+3],I=Math.pow(2,T-128)/255;b[P+0]=sJ.toHalfFloat(Math.min(g[y+0]*I,65504)),b[P+1]=sJ.toHalfFloat(Math.min(g[y+1]*I,65504)),b[P+2]=sJ.toHalfFloat(Math.min(g[y+2]*I,65504)),b[P+3]=sJ.toHalfFloat(1)},a=new Uint8Array(o);a.pos=0;let l=r(a),c=l.width,h=l.height,u=i(a.subarray(a.pos),c,h),d,p,m;switch(this.type){case MJ:m=u.length/4;let g=new Float32Array(m*4);for(let b=0;b<m;b++)n(u,b*4,g,b*4);d=g,p=MJ;break;case ZZ:m=u.length/4;let y=new Uint16Array(m*4);for(let b=0;b<m;b++)s(u,b*4,y,b*4);d=y,p=ZZ;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:c,height:h,data:d,header:l.string,gamma:l.gamma,exposure:l.exposure,type:p}}setDataType(o){return this.type=o,this}load(o,t,e,r){function i(n,s){switch(n.type){case MJ:case ZZ:n.colorSpace=Obe,n.minFilter=tk,n.magFilter=tk,n.generateMipmaps=!1,n.flipY=!0;break}t&&t(n,s)}return super.load(o,i,e,r)}},iut=class kMe{constructor(t){this.gpu=t,this.size={width:4096,height:2048},this.cache=new Map,this.texture=this.gpu.createDynamicTexture(this.size.width,this.size.height,"rgba32float",GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.STORAGE_BINDING,"ambient light texture")}static async build(t,e){let r=new kMe(t);return r.setListen(()=>{}),r.setIntensity(1),r.setRotation(0),r.setColor(ee.WHITE),e?(r.addCache(e),await r.setTexture(e[0].name),r.setUseColor(!1)):r.setUseColor(!0),r}getIsChange(){return this.isChange}getTextureName(){return this.textureName}check(){return this.isChange?(this.isChange=!1,!0):!1}getUser(){return this.textureName===void 0?null:{name:this.textureName,blob:this.cache.get(this.textureName).blob}}getTextureNames(){return Array.from(this.cache).map(t=>({name:t[0],blob:t[1].blob})).map(t=>t.name)}addTexture(t){this.cache.set(t.name,{blob:t})}addCache(t){t.forEach(({name:e,blob:r})=>{this.cache.set(e,{blob:r})})}getCache(){return Array.from(this.cache).map(t=>({name:t[0],blob:t[1].blob}))}getTexture(){return this.texture}setListen(t){this.listen=t}setUseColor(t){this.useColor=t,this.listen(),this.isChange=!0}setIntensity(t){this.intensity=t,this.listen(),this.isChange=!0}setColor(t){this.color=t,this.listen(),this.isChange=!0}getColor(){return this.color}getIntensity(){return this.intensity}isUseColor(){return this.useColor}setRotation(t){this.rotation=t,this.listen(),this.isChange=!0}getRotatoin(){return this.rotation}async setTexture(t){let e=async i=>{let n=await i.arrayBuffer(),s=new rut().parse(n);if(s.width!==this.size.width||s.height!==this.size.height)throw new Error;return a(s.data);function a(c){let h=new Float32Array(c.length);for(let u=0;u<c.length;u++)h[u]=l(c[u]);return h}function l(c){let h=c&32768,u=(c&31744)>>10,d=c&1023;return u===0?d===0?h===0?0:-0:(h===0?1:-1)*Math.pow(2,-14)*(d/Math.pow(2,10)):u===31?d===0?h===0?1/0:-1/0:NaN:(h===0?1:-1)*Math.pow(2,u-15)*(1+d/Math.pow(2,10))}};this.isChange=!0,this.textureName=t;let r=this.cache.get(t);r&&(r.data||(r.data=await e(r.blob)),this.gpu.device.queue.writeTexture({texture:this.texture.texture},r.data,{offset:0,bytesPerRow:this.size.width*16,rowsPerImage:this.size.height},{width:this.size.width,height:this.size.height,depthOrArrayLayers:1}))}};function nut(o){return new Promise(t=>setTimeout(t,o))}function Dbe(o,t){let e=[],r=1,i=Object.values(o);for(let n=0;n<i.length;n++){let s=a=>{if(a instanceof Array&&a.forEach(l=>s(l)),typeof a=="number")r=Math.max(r,1),e.push(a);else if(a instanceof Mt||a instanceof ee){r=Math.max(r,4);for(let l=e.length;l%4!=0;l++)e.push(t);a instanceof ee?e.push(a.r,a.g,a.b):e.push(a.x,a.y,a.z)}else if(typeof a=="boolean")r=Math.max(r,1),e.push(a?1:0);else{let l=Dbe(a,t);r=Math.max(r,l.alignmentRequirement);for(let c=e.length;c%l.alignmentRequirement!=0;c++)e.push(t);l.bufferData.forEach(c=>{e.push(c)})}};s(i[n])}for(let n=e.length;n%r!=0;n++)e.push(t);return{bufferData:e,alignmentRequirement:r}}function R2(o){try{return Dbe(o,0).bufferData}catch{debugger;Dbe(o,0).bufferData}}var out=class{toBufferData(){return R2(this._toWGSLStructure())}},sut=class{constructor(){this.shaderCodes=[],this.isCompiling=!1}addShaderCode(o){if(this.isCompiling)throw new Error("Cannot add shader code while compiling");this.shaderCodes.push(o)}async compileAll(o){if(!(this.isCompiling||!this.shaderCodes)){this.isCompiling=!0,await nut(10);for(let t of this.shaderCodes)if((await o.createShaderModule({code:t}).getCompilationInfo()).messages.length!==0){console.log(this.shaderCodes),await o.createShaderModule({code:t}).getCompilationInfo();debugger}}}},UO=new sut,F2e=class{constructor(o,t=0,e=0,r=1,i=.5,n=ee.WHITE,s=0,a=0,l=1,c=1,h=SJ(),u=SJ(),d=SJ(),p=SJ()){this.color=o,this.metallic=t,this.roughness=e,this.ior=r,this.iorLevel=i,this.clearcoatTintColor=n,this.clearcoatIntensity=s,this.clearcoatRoughness=a,this.clearcoatIor=l,this.normalIntensity=c,this.normalTexture=h,this.metallicTexture=u,this.colorTexture=d,this.roughnessTexture=p}};function SJ(){return{path:void 0,scale:100}}var iDe={encode:o=>JSON.stringify({baseColor:od.encode(o.color),metallic:o.metallic,roughness:o.roughness,ior:o.ior,iorLevel:o.iorLevel,clearcoatTintColor:o.clearcoatTintColor?od.encode(o.clearcoatTintColor):void 0,clearcoatIntensity:o.clearcoatIntensity,clearcoatRoughness:o.clearcoatRoughness,clearcoatIor:o.clearcoatIor,normalIntensity:o.normalIntensity,normalTexture:o.normalTexture,metallicTexture:o.metallicTexture,colorTexture:o.colorTexture,roughnessTexture:o.roughnessTexture}),decode:o=>{let t=JSON.parse(o);return new F2e(od.decode(t.baseColor),t.metallic,t.roughness,t.ior,t.iorLevel,t.clearcoatTintColor?od.decode(t.clearcoatTintColor):void 0,t.clearcoatIntensity,t.clearcoatRoughness,t.clearcoatIor,t.normalIntensity,t.normalTexture,t.metallicTexture,t.colorTexture,t.roughnessTexture)}},od={decode(o){try{let{data:t}=JSON.parse(o);return ee.build(t[0],t[1],t[2],t[3])}catch{return null}},encode(o){return JSON.stringify({data:[o.r,o.g,o.b,o.alpha]})}},_2={decode(o){let{data:t}=JSON.parse(o);return new Mt(t[0],t[1],t[2])},encode(o){return JSON.stringify({data:[o.x,o.y,o.z]})}},nDe={decode(o){let{data:t}=JSON.parse(o);return new by(t[0],t[1],t[2],t[3],t[4],t[5])},encode(o){return JSON.stringify({data:[o.minX,o.minY,o.minZ,o.maxX,o.maxY,o.maxZ]})}},oDe={encode(o){let t={base:yI.encode(o.base),silk:yI.encode(o.silk),copper:yI.encode(o.copper),solder:yI.encode(o.solder),copperOverlapSolder:yI.encode(o.copperOverlapSolder)};return JSON.stringify(t)},decode(o){let t=JSON.parse(o);return{base:yI.decode(t.base),silk:yI.decode(t.silk),copper:yI.decode(t.copper),solder:yI.decode(t.solder),copperOverlapSolder:yI.decode(t.copperOverlapSolder)}}},yI={encode(o){let t={ka:od.encode(o.ambient),kd:od.encode(o.diffuse),ks:od.encode(o.specular)};return JSON.stringify(t)},decode(o){let{ka:t,kd:e,ks:r}=JSON.parse(o);return new fS(od.decode(t),od.decode(e),od.decode(r),1,1)}},BMe={encode:function(o){let t=o.map(([e,r])=>[yI.encode(e),iDe.encode(r)]);return JSON.stringify(t)},decode:function(o){return JSON.parse(o).map(([t,e])=>[yI.decode(t),iDe.decode(e)])}},FMe={encode(o){return JSON.stringify({Ka:od.encode(o.ka),Kd:od.encode(o.kd),Ks:od.encode(o.ks)})},decode(o){let{Ka:t,Kd:e,Ks:r}=JSON.parse(o);return{ka:od.decode(t),kd:od.decode(e),ks:od.decode(r)}}},aut=class wbe{constructor(t,e,r){this._gpu=t,this.camera=e,this.config=r,r?e.setConfig({flangeFocalDistance:0,focalLength:0,apertureSize:0,...r}):this.reset();let i=this._getData();this.buffer=this._gpu.createUniformDynamicBuffer(i,"camera"),this.camera.setMaxScale(1/0),this.camera.setMinScale(0)}static async build(t,e){try{let r=await e.config.text(),i=JSON.parse(r),n={up:_2.decode(i.up),target:_2.decode(i.target),tar2posDir:_2.decode(i.tar2posDir),rotateTarget:_2.decode(i.rotateTarget),cmosSize:i.cmosSize,scale:i.scale};return new wbe(t,e.camera,n)}catch{return new wbe(t,e.camera)}}getRotateTarget(){return this.config?this.config.rotateTarget:this.camera.getTarget()}setObjectByBBox3(t){this.bbox=t,this.camera.setObjectByBBox3(t),this.config||this.camera.adapt(t)}get size(){return{width:this.camera.getWidth(),height:this.camera.getHeight()}}getBlob(t){let e=this.camera.getConfig(),r=JSON.stringify({up:_2.encode(e.up),target:_2.encode(e.target),tar2posDir:_2.encode(e.tar2posDir),scale:e.scale,cmosSize:e.cmosSize,rotateTarget:_2.encode(t)});return new Blob([r])}reset(){this.camera.setConfig({up:new Mt(0,0,1),apertureSize:20,focalLength:19,cmosSize:{width:20,height:20},flangeFocalDistance:30,target:new Mt(0,0,0),tar2posDir:new Mt(1,0,0),scale:1}),this.camera.adapt(this.bbox)}check(){return this.camera.isChangedFromLastRender()?(this._update(),this.camera.rendered(),!0):!1}modifyCilkDirection(t){this._update(t)}_update(t=Mt.ORIGIN){let e=this._getData(t);this.buffer.write(0,new Float32Array(e))}_getData(t=Mt.ORIGIN){let e=this.camera,{origin:r,position:i,right:n,down:s}=e.getViewport(),a={position:i,origin:r,right:n,down:s,cilk_direction:t,aperture_size:e.getApertureSize(),focal_length:e.getFocalLength(),flange_local_distance:e.getFlangeFocalDistance(),px:n.length(),target:e.getTarget()};return R2(a)}},VMe=class{constructor(o,t,e){this.input=e,this.isEmpty()&&(e={bbox:null,bvh:new Float32Array(6).fill(0),pt:new Float32Array(1).fill(0),layerInfo:new Float32Array(8).fill(0),bvhIndex:new Float32Array(8).fill(0),material:Lbe()}),this.bbox=e.bbox,this.bvh=o.createStorageDynamicBuffer(e.bvh,"raytracer pcb model bvh"),this.pt=o.createStorageDynamicBuffer(e.pt,"raytracer pcb model pt"),this.layerInfo=o.createUniformDynamicBuffer(WMe(),"raytracer pcb model layerInfo"),this.bvhIndex=o.createUniformDynamicBuffer(e.bvhIndex,"raytracer pcb model bvhIndex"),this.material=o.createUniformDynamicBuffer(r(e.material,t),"raytracer pcb model material");function r(i,n){let s={base:n.register(i.base),silk:n.register(i.silk),copper:n.register(i.copper),solder:n.register(i.solder),copperOverlapSolder:n.register(i.copperOverlapSolder)},a=R2(s);return new Float32Array(a)}}static destring(o){if(o==="null")return;let t=JSON.parse(o),{bvh:e,bvhIndex:r,pt:i,layerInfo:n}=t,s=nDe.decode(t.bbox),a=oDe.decode(t.material);return{bvh:e,bvhIndex:r,pt:i,layerInfo:n,bbox:s,material:a}}isEmpty(){return this.input===void 0}async tostring(){if(this.isEmpty())return"null";let o=Array.from(await this.bvh.read()),t=Array.from(await this.bvhIndex.read()),e=Array.from(await this.pt.read()),r=Array.from(await this.layerInfo.read()),i=nDe.encode(this.bbox),n=oDe.encode(Lbe());return JSON.stringify({bvh:o,bvhIndex:t,pt:e,layerInfo:r,bbox:i,material:n})}};function Lbe(){return{base:new fS(ee.of2(0,79,155),ee.of2(0,0,0),ee.of2(0,0,0)),silk:new fS(ee.of2(255,255,255),ee.of2(0,0,1),ee.of2(0,0,1)),copper:new fS(ee.of2(197,159,59),ee.of2(0,0,2),ee.of2(0,0,2)),solder:new fS(ee.of2(0,41,101),ee.of2(0,0,3),ee.of2(0,0,3)),copperOverlapSolder:new fS(ee.of2(0,94,186),ee.of2(0,0,4),ee.WHITE)}}function lut(o,t){return o.mordonCode-t.mordonCode}function cut(o,t,e){return o.map(r=>({item:r,mordonCode:e.get(r.bbox.center())})).sort(lut).map(r=>r.item)}function hut(o){let{x:t,y:e}=o;return sDe(t)|sDe(e)<<1}function sDe(o){return o=(o|o<<16)&50331903,o=(o|o<<8)&50393103,o=(o|o<<4)&51130563,o=(o|o<<2)&153391689,o}var Mbe=class extends ut{initMordonCode(o){let t=this.center().sub(o);this._mordonCode=hut(t)}getMordonCode(){if(this._mordonCode===void 0)throw new Error;return this._mordonCode}},uut=class{constructor(o,t){if(o.length===1){this.root=new EJ(o[0]);return}let e=this.getItemsDataOrigin(o),r=o.map(i=>new EJ(i));if(r.length<=t){this.root=new EJ(r);return}for(;;){let i=r.length;if(i===1)break;r.forEach(s=>s.bbox.initMordonCode(e)),r.sort((s,a)=>s.bbox.getMordonCode()-a.bbox.getMordonCode());let n=[];for(let s=0;s<Math.ceil(i/t);s++){let a=s*t,l=a+t>i?i:a+t,c=[];for(let h=a;h<l;h++)c.push(r[h]);if(c.length===0)throw new Error;n.push(new EJ(c))}r=n}this.root=r[0]}itor(o){return this.root.itor(o)}bboxs(){return this.root.bboxs()}initMordonCode(o){let t=this.getItemsDataOrigin(o);o.forEach(e=>e.bbox.initMordonCode(t))}getItemsDataOrigin(o){let t=1/0,e=1/0,r=1/0;return o.forEach(i=>{t=Math.min(t,i.bbox.minX),e=Math.min(e,i.bbox.minY)}),new S(t,e)}},EJ=class{constructor(o){this.items=[],o instanceof Array?(this.items=o,this.bbox=this.buildBBox(o),this.leaf=null):(this.leaf=o.index,this.bbox=o.bbox),this.bbox=new Mbe(this.bbox.minX-.001,this.bbox.maxX+.001,this.bbox.minY-.001,this.bbox.maxY+.001)}buildBBox(o){let t=new _e;o.forEach(r=>t.ext1(r.bbox));let e=t.build();return new Mbe(e.minX,e.maxX,e.minY,e.maxY)}isLeaf(){return this.leaf!==null}itor(o){if(this.isLeaf()){o(this.bbox,[this.leaf]);return}o(this.bbox,this.items.map(t=>t.isLeaf()?t.leaf:t.bbox)),this.items.forEach(t=>{t.isLeaf()||t.itor(o)})}bboxs(){let o=[];return this.itor(t=>{o.push(t)}),o}};function dut(o,t){let e=o.bboxs(),r=new Map;e.forEach((n,s)=>r.set(n,s));let i=[];return o.itor((n,s)=>{i.push(n.minX,n.maxX,n.minY,n.maxY),s.map(a=>a instanceof ut?r.get(a)+1:-a-1).forEach(a=>{i.push(a)});for(let a=0;a<t-s.length;a++)i.push(0)}),i}var put=class{constructor(o,t,e,r){this.maxNodeCapacity=t,this.dep=0;let i=o.map(s=>new aDe(s)),n=new mut(r);for(;i.length>1;){this.dep++,i=cut(i,e,n);let s=[],{length:a}=i;for(let l=0;l<a;l+=t){let c=i.slice(l,l+t);s.push(new aDe(c))}i=s}this.root=i[0]}itor(o){this.root.itor(o)}bboxs(){return this.root.bboxs()}getItemsDataOrigin(o){let t=1/0,e=1/0,r=1/0;return o.forEach(({bbox:i})=>{t=Math.min(t,i.minX),e=Math.min(e,i.minY),r=Math.min(r,i.minZ)}),new Mt(t,e,r)}},aDe=class{constructor(o){this.items=[],Array.isArray(o)?(this.items=o,this.bbox=this.buildBBox(o),this.leaf=null):(this.leaf=o.index,this.bbox=o.bbox),this.bbox=this.expandBBox(this.bbox)}expandBBox(o){return new by(o.minX-.001,o.minY-.001,o.minZ-.001,o.maxX+.001,o.maxY+.001,o.maxZ+.001)}buildBBox(o){let t=new Xm;return o.forEach(e=>t.ext4(e.bbox)),t.build()}isLeaf(){return this.leaf!==null}itor(o){this.isLeaf()||(o(this.bbox,this.items.map(t=>t.isLeaf()?t.leaf:t.bbox)),this.items.forEach(t=>!t.isLeaf()&&t.itor(o)))}bboxs(){let o=[];return this.itor(t=>o.push(t)),o}};function fut(o,t){let e=o.bboxs(),r=new Map;e.forEach((n,s)=>r.set(n,s));let i=[];return o.itor((n,s)=>{i.push(n.minX,n.minY,n.minZ,n.maxX,n.maxY,n.maxZ),s.forEach(a=>{i.push(a instanceof by?r.get(a)*(o.maxNodeCapacity+6)+1:-a-1)}),i.push(...Array(t-s.length).fill(0))}),i}var mut=class{constructor(o){this.bbox=o,this.sizeX=o.maxX-o.minX,this.sizeY=o.maxY-o.minY,this.sizeZ=o.maxZ-o.minZ}get(o){let t=this.normalize(o),e=Math.floor(t.x*127),r=Math.floor(t.y*127),i=Math.floor(t.z*127);return this.interleaveBits(e,r,i)}normalize(o){return new Mt((o.x-this.bbox.minX)/this.sizeX,(o.y-this.bbox.minY)/this.sizeY,(o.z-this.bbox.minZ)/this.sizeZ)}interleaveBits(o,t,e){let r=0;for(let i=0;i<7;i++)r|=(o>>i&1)<<3*i,r|=(t>>i&1)<<3*i+1,r|=(e>>i&1)<<3*i+2;return r}decode(o){let t=0,e=0,r=0;for(let i=0;i<7;i++)t|=(o>>3*i&1)<<i,e|=(o>>3*i+1&1)<<i,r|=(o>>3*i+2&1)<<i;return new Mt(t/127,e/127,r/127)}denormalize(o){return new Mt(o.x*this.sizeX+this.bbox.minX,o.y*this.sizeY+this.bbox.minY,o.z*this.sizeZ+this.bbox.minZ)}getBBox(){return this.bbox}},gut=class GMe{constructor(){this.map=new Map,this._inverse=new Map}static build(t){let e=new GMe;return t.forEach((r,i)=>{e.set(i,r)}),e}get inverse(){return{set:(t,e)=>{this.map.set(e,t),this._inverse.set(t,e)},get:t=>this._inverse.get(t),delete:t=>{this.map.delete(this._inverse.get(t)),this._inverse.delete(t)}}}set(t,e){return this._inverse.set(e,t),this.map.set(t,e)}get(t){return this.map.get(t)}delete(t){this._inverse.delete(this.map.get(t)),this.map.delete(t)}clear(){this.map.clear(),this._inverse.clear()}};function kW(o,t){let e=new Map;return o.forEach((r,i)=>{let n=t(r,i);n!==null&&e.set(i,n)}),e}async function FL(o,t){let e=new Map;for(let r of o.entries()){let i=r[0],n=r[1],s=await t(n,i);s!==null&&e.set(i,s)}return e}function yut(o,t){let e=new Map;return o.forEach(r=>{let i=t(r);i!==null&&e.set(r,i)}),e}var nW;function UMe(){return nW!=null||(nW=new Map([[0,{env:_2e,lable:"CircleEnvGpu"}],[1,{env:r2e,lable:"ArcEnvGpu"}],[2,{env:s2e,lable:"RectEnvGpu"}],[3,{env:e2e,lable:"LineSegmentEnv"}],[4,{env:n2e,lable:"SemicircleEnv"}],[5,{env:Jbe,lable:"PointEnv"}],[6,{env:I2e,lable:"TriangleEnvGpu"}],[7,{env:E2e,lable:"CutedCircleEnvGpu"}],[8,{env:vW,lable:"StaticTriangleEnv"}],[10,{env:ck,lable:"StringEnv"}],[11,{env:mW,lable:"LineWireFrameEnv"}],[12,{env:h2e,lable:"ArcWireFrameEnv"}],[15,{env:b2e,lable:"LineEnvGpu"}],[16,{env:sQ,lable:"EllipseEnv"}],[17,{env:m2e,lable:"BezierEnv"}],[18,{env:RL,lable:"TextGpuEnv"}],[19,{env:Kbe,lable:"DrcEnv"}],[9,{env:xW,lable:"StaticCutedCircleEnv"}],[13,{env:gW,lable:"StaticLineWireFrameEnv"}],[14,{env:p2e,lable:"StaticArcWireFrameEnv"}]])),Array.from(nW.values()).find(o=>o.env===void 0)!==void 0&&(nW=void 0),nW}async function but(o,t){let e=await _ut(o);e=vut(e),e=await xut(e),e=await Aut(e,t),e=await Out(e,t);let r=await Eut(e);r=await Sut(r);let{ptBuffer:i,ptIndexBuffer:n}=Cut(r);if(!i.length)return null;let s=await Tut(i,n,t);return{bvhBuffer:await Iut(s,n),ptBuffer:i,bboxBuffer:s,types:Put(r)}}function Put(o){let t=new Map;for(let[e,r]of o){let i=Dut(e),n=r.length/BW(e);t.set(i,n)}return t}async function Tut(o,t,e){let r=o,i=t,n=[],s=new Float32Array(r);for(let l=0;l<i.length;l++){let c=i[l],h=r[c],u=BW(h),d=[];for(let m=0;m<u;m++)d.push(r[c+m]);let p=Rut(h).createBBox(s,c,e,[]);n.push(p)}let a=[];return n.forEach(l=>a.push(l.minX,l.maxX,l.minY,l.maxY)),new Float32Array(a)}async function Iut(o,t){let e=[];for(let s=0;s<o.length;s+=4){let a=new Mbe(o[s],o[s+1],o[s+2],o[s+3]),l=t[s/4];e.push({bbox:a,index:l})}let r=2,i=new uut(e,r),n=dut(i,r);return new Float32Array(n)}function Cut(o){let t=[],e=0;return o.forEach((r,i)=>{let n=BW(i);if(r.length%n!==0)throw new Error;for(let s=0;s<r.length;s+=n)t.push(e),e+=n}),{ptBuffer:HMe(Array.from(o.values())),ptIndexBuffer:new Float32Array(t)}}async function Sut(o){return await FL(o,async(t,e)=>{let r=t,i=BW(e);for(let n=0;n<r.length;n+=i)r[n]=e;return new Float32Array(r)})}async function Eut(o){return await FL(o,async t=>HMe(t))}async function Out(o,t){let e=await FL(o,async(i,n)=>{if(n!==9)return i;let s=[];for(let a of i){let l=a,c=[];for(let h=0;h<l.length;h+=xW.length){let u=l[h+10]*Ld,d=new Qe([t.get(u),t.get(u+1),0,t.get(u+2),t.get(u+3),0,t.get(u+4),t.get(u+5),1]),p=new S(l[h+1],l[h+2]).multiply3(d),m=new S(l[h+6],l[h+7]).multiply3(d),g=new S(l[h+8],l[h+9]).multiply3(d);c.push(7,p.x,p.y,l[h+3],l[h+4],l[h+5],m.x,m.y,g.x,g.y,0,0,0)}s.push(new Float32Array(c))}return s}),r=e.get(9);if(r){e.delete(9);let i=e.get(7);i?r.forEach(n=>i.push(n)):e.set(7,r)}return e}async function Aut(o,t){let e=await FL(o,async(i,n)=>{if(n!==8)return i;let s=[];for(let a of i){let l=a,c=[];for(let h=0;h<l.length;h+=vW.length){let u=l[h+7]*Ld,d=new Qe([t.get(u),t.get(u+1),0,t.get(u+2),t.get(u+3),0,t.get(u+4),t.get(u+5),1]),p=new S(l[h+1],l[h+2]).multiply3(d),m=new S(l[h+3],l[h+4]).multiply3(d),g=new S(l[h+5],l[h+6]).multiply3(d);c.push(6,p.x,p.y,m.x,m.y,g.x,g.y,0,0,0)}s.push(new Float32Array(c))}return s.length?s:null}),r=e.get(8);if(r){e.delete(8);let i=e.get(6);i?r.forEach(n=>i.push(n)):e.set(6,r)}return e}async function _ut(o){let t=yut(new Array(69).fill(0).map((r,i)=>i),()=>new Array);for(let r of o)if(r instanceof AL)r.getPolygonBuilders().forEach(i=>{for(let[n,s]of i.entries()){if(!s)continue;let a=s.updateBuf();t.get(n).push(a.toDynamicBuffer())}}),r.getBuilders().forEach((i,n)=>{let s=i.updateBuf();t.get(n).push(s.toDynamicBuffer())});else throw new Error;return await FL(t,async(r,i)=>r.length?await e(r):null);async function e(r){let i=[];for(let n of r)i.push(await n.read());return i}}function vut(o){let t=new Set().add(6).add(7).add(15).add(0).add(2).add(1).add(9).add(8);return kW(o,(e,r)=>t.has(r)?e:null)}async function xut(o){return await FL(o,async(t,e)=>{let r=BW(e),i=[];for(let n of t){let s=n.length;s%r===0&&s>=r&&s!==0&&i.push(n)}return i.length?i:null})}function Rut(o){return UMe().get(o).env}function Dut(o){return UMe().get(o).lable}function BW(o){return Ur.getPtLengthByType(o)}function HMe(o){let t=[];return o.forEach(e=>e.forEach(r=>t.push(r))),new Float32Array(t)}async function wut(o){let t=await kut(o),e=await Fut(t),r=await Gut(t),i=WMe(),n=Lbe();return{bbox:e,bvh:r.bvhData,pt:r.ptData,layerInfo:i,bvhIndex:r.bvhIndexMap,material:n}}var Lut=(1.51+.035+.035+.01+.01)*3.93701;function Mut(o){let t=new Set([1,"copper of 1",7,3,5,2,"copper of 2",8,4,6,11]);return o.filter(e=>t.has(e.label))}function Nut(o){o=Mut(o);let t=new Map;return o.forEach(e=>t.set(e.label,e.builder.getAllPtBlock())),o.forEach(e=>{if(e.label===12){let r=e.builder.getAllPtBlock();if(r){let i=t.get(1),n=t.get(2);i?r.forEach(s=>i.push(s)):t.set(1,r),n?r.forEach(s=>n.push(s)):t.set(2,r)}}}),o.forEach(e=>{if(e.label=="copper of 1"){let r=t.get(1);r?e.builder.getAllPtBlock().forEach(i=>r.push(i)):t.set(1,e.builder.getAllPtBlock())}}),o.forEach(e=>{if(e.label==="copper of 2"){let r=t.get(2);r?e.builder.getAllPtBlock().forEach(i=>r.push(i)):t.set(2,e.builder.getAllPtBlock())}}),t}function WMe(){let o=new Mt(0,0,1),t=new Mt(0,0,0),e=o.scale(-1),r=t.sub(o.scale(Lut)),i=.01;t=t.add(o.scale(i)),r=r.add(e.scale(i));let n=R2({"top point":t,"top normal":o,"bottom point":r,"bottom normal":e});return new Float32Array(n)}async function kut(o){let{planeGPU:t,staticPolygonInfoBuilder:e}=o,r=Nut(t);return await FL(r,async(i,n)=>But(e,i,n))}async function But(o,t,e){let r=await but(t,o);return r==null?null:{label:e,...r}}async function Fut(o){let t=Array.from(o.values()).map(r=>r.bboxBuffer),e=await Vut(t);return new by(e.minX,e.minY,-10,e.maxX,e.maxY,10)}async function Vut(o){let t=new _e;for(let e of o){let r=e;for(let i=0;i<r.length;i+=4)t.ext1(new ut(r[i],r[i+1],r[i+2],r[i+3]))}return t.build()}async function Gut(o){let t=[],e=[],r=new Map;for(let[a,{ptBuffer:l,bvhBuffer:c}]of o.entries()){let h=l,u=c,d=t.length/6,p=e.length;for(let m=0;m<u.length;m+=6)[m+4,m+5].forEach(g=>{let y=u[g];y<0?u[g]-=p:y>0&&(u[g]+=d)});u.forEach(m=>t.push(m)),h.forEach(m=>e.push(m)),r.set(a,d)}let i=a=>r.has(a)?r.get(a):-1,n={outline:i(11),silkTop:i(3),solderTop:i(5),copperTop:i(1),silkBottom:i(4),solderBottom:i(6),copperBottom:i(2)},s=R2(n);return{bvhData:new Float32Array(t),ptData:new Float32Array(e),bvhIndexMap:new Float32Array(s)}}var mS={log(o,...t){console.log(o,...t)},time(o){return console.time(o)},timeEnd(o){return console.timeEnd(o)}},zMe=Math.PI,_kt=180/zMe,Uut=zMe/180;function Hut(o){return o*Uut}function YMe(o,t){if(!t)return Array.from(new Set(o));let e=[];for(let r of o)e.find(i=>t(r,i))||e.push(r);return e}var Wut=class{constructor(o){this.current=0,this.lastRenderPercent=-1,this.minUpdateInterval=1e3,this.total=o,this.startTime=Date.now(),this.lastRenderTime=this.startTime,this.render(!0)}update(o){this.current=Math.min(o,this.total),this.shouldRender()&&this.render(),this.current>=this.total&&mS.log("\u2705 \u5B8C\u6210")}increment(o=1){this.update(this.current+o)}shouldRender(){let o=Date.now(),t=this.current/this.total*100,e;this.total>=1e6?e=.01:this.total>=1e4?e=.1:this.total>=1e3?e=.5:e=1;let r=Math.abs(t-this.lastRenderPercent)>=e,i=o-this.lastRenderTime>=this.minUpdateInterval*5,n=this.current===0||this.current>=this.total;return r||i||n}render(o=!1){let t=Date.now();if(!o&&t-this.lastRenderTime<this.minUpdateInterval)return;let e=this.current/this.total*100,r=this.roundPercent(e);if(!o&&r===this.lastRenderPercent)return;let i=20,n=Math.floor(this.current/this.total*i),s="\u2588".repeat(n)+"\u2591".repeat(i-n),a=t-this.startTime,l=` | ${this.formatTime(a)}`;if(this.current>0){let c=a/this.current,h=this.total-this.current,u=c*h;l+=` | ETA: ${this.formatTime(u)}`;let d=this.current/(a/1e3);l+=` | ${d.toFixed(1)}/s`}mS.log(`${s} ${r.toFixed(this.getPrecision())}%${l}`),this.lastRenderPercent=r,this.lastRenderTime=t}roundPercent(o){let t=this.getPrecision(),e=Math.pow(10,t);return Math.round(o*e)/e}getPrecision(){return this.total>=1e6?2:this.total>=1e4?1:0}formatTime(o){let t=Math.floor(o/1e3),e=Math.floor(t/60),r=Math.floor(e/60);return r>0?`${r}h${e%60}m`:e>0?`${e}m${t%60}s`:`${t}s`}};async function $ye(o){try{return await(await fetch(o)).text()}catch{return null}}function jMe(o){let t=o.name;return t.includes(".obj")?"obj":t.includes(".zip")?"zip":t.includes(".csv")?"csv":t.includes(".CUBE")?"cube":t.includes(".txt")?"txt":t.includes(".mlib")?"mlib":null}function lDe(o){return"https://modules.lceda.cn/3dmodel/"+o}function zut(o,t,e){let r=t.sub(o),i=e.sub(o);return r.cross(i).normalize()}function cDe(o){let t="",e="",r=!1;for(let i=0;i<o.length;i++){let n=i+5<o.length&&o[i]+o[i+1]+o[i+2]+o[i+3]+o[i+4]+o[i+5]==="newmtl",s=i-6>=0&&o[i-6]+o[i-5]+o[i-4]+o[i-3]+o[i-2]+o[i-1]+o[i]===`endmtl
`;if(n&&(r=!0),s){r=!1,e+=o[i];continue}r?e+=o[i]:t+=o[i]}return{mtl:e,obj:t}}function Yut(o,t){let e=new Map;return o.forEach(r=>{e.set(r,t(r))}),e}var XMe=class qMe{constructor(t,e){this.gpu=t,this.areas=e,this.buffer=t.createUniformDynamicBuffer(this.getData(),"light soure")}static async build(t,e){let r=await this.createConfig(e),i=new qMe(t,r);return i.setListen(()=>{}),i.setIsOpen(!0),i}static async createConfig(t){if(!t)return s();let e=await t.text(),r=JSON.parse(e);if(i(r))return s();return r.map((a,l)=>({name:a.name?a.name:"a"+l,color:od.decode(a.color),power:a.power,normalize:a.normalize,size:a.size,position:_2.decode(a.position),rotate:_2.decode(a.rotate),hide:a.hide,castShadow:a.castShadow,rayVisibilityDiffuse:a.rayVisibilityDiffuse,rayVisibilityGlossy:a.rayVisibilityGlossy,spread:a.spread}));function i(a){return!!a.find(l=>n(l))}function n(a){return a.name===void 0||a.color===void 0||a.power===void 0||a.normalize===void 0||a.size===void 0||a.position===void 0||a.rotate===void 0||a.hide===void 0||a.castShadow===void 0||a.rayVisibilityDiffuse===void 0||a.rayVisibilityGlossy===void 0||a.spread===void 0}function s(){return[a("a0"),a("a1"),a("a2")];function a(l){return{name:l,color:ee.WHITE,power:10,size:{width:2,height:2},normalize:!1,position:new Mt(0,0,10),rotate:Mt.ORIGIN,hide:!1,castShadow:!0,rayVisibilityDiffuse:!0,rayVisibilityGlossy:!0,spread:180}}}}getBlob(){let t=Array.from(this.areas.values()).map(e=>({name:e.name,color:od.encode(e.color),power:e.power,normalize:e.normalize,size:e.size,position:_2.encode(e.position),rotate:_2.encode(e.rotate),hide:e.hide,castShadow:e.castShadow,rayVisibilityDiffuse:e.rayVisibilityDiffuse,rayVisibilityGlossy:e.rayVisibilityGlossy,spread:e.spread}));return new Blob([JSON.stringify(t)])}get(t){return this.areas.find(e=>e.name===t)}set(t){for(let e=0;e<this.areas.length;e++)if(this.areas[e].name===t.name){this.areas[e]=t,this.isChange=!0;return}throw new Error}getAll(){return this.areas.map(t=>t.name)}setListen(t){this.listen=t}getIsOpen(){return this.isOpen}setIsOpen(t){this.isOpen=t,this.listen()}checkAndUpdate(){return this.isChange?(this.gpu.writeBuffer(this.buffer,0,new Float32Array(this.getData())),this.isChange=!1,!0):!1}getBBox(){return new Xm().build()}getData(){let t=Array.from(this.areas.values()).map(r=>{let i=Mt.X_UNIT_VECTOR,n=Mt.Y_UNIT_VECTOR;return i=i.multiply4(Ae.rotateX(r.rotate.x*Math.PI/180)).normalize(),i=i.multiply4(Ae.rotateY(r.rotate.y*Math.PI/180)).normalize(),i=i.multiply4(Ae.rotateZ(r.rotate.z*Math.PI/180)).normalize(),i=i.scale(r.size.width),n=n.multiply4(Ae.rotateX(r.rotate.x*Math.PI/180)).normalize(),n=n.multiply4(Ae.rotateY(r.rotate.y*Math.PI/180)).normalize(),n=n.multiply4(Ae.rotateZ(r.rotate.z*Math.PI/180)).normalize(),n=n.scale(r.size.height),{hide:r.hide,color:r.color,power:r.power,position:r.position.sub(i.scale(.5)).sub(n.scale(.5)),u:i,v:n,cast_shadow:r.castShadow,diffuse:r.rayVisibilityDiffuse,glossy:r.rayVisibilityGlossy,spread:e(r.spread),normalize:r.normalize}});return R2(t);function e(r){return Hut(r)}}};XMe.maxAreaLights=3;var jut=XMe,$Me=class Nbe{constructor(t,e){this.data=t,this.size=e}static async fromBlob(t){return new Promise((e,r)=>{let i=new Image,n=document.createElement("canvas"),s=n.getContext("2d",{willReadFrequently:!0});if(!s){r(new Error("Canvas 2D context not supported"));return}let a=URL.createObjectURL(t);i.src=a,i.onload=()=>{try{n.width=i.width,n.height=i.height,s.drawImage(i,0,0);let l=s.getImageData(0,0,n.width,n.height).data,c=new Float32Array(l.length);for(let h=0;h<l.length;h++)c[h]=l[h]/255;e(new Nbe(c,{width:n.width,height:n.height}))}catch(l){r(l)}finally{URL.revokeObjectURL(a)}},i.onerror=r})}binarize(){let t=this._calculateColorRatios(),{primary:e,secondary:r}=n(t),i=this._binarizationData(e,r);return new Nbe(i,this.size);function n(s){let a,l=-1,c,h=-1;for(let[u,d]of s.entries())d>l?(a=u,l=d):d>h&&(c=u,h=d);if(l<0||h<0)throw new Error("Insufficient color data for binarization");return{primary:a,secondary:c}}}_binarizationData(t,e){let{data:r}=this,i=new Float32Array(this.data.length);for(let s=0;s<r.length;s+=4){let a=ee.build(r[s],r[s+1],r[s+2],r[s+3]),l=n(a,t),c=n(a,e);i[s/4]=l>c?1:0}return i;function n(s,a){let l=s.r-a.r,c=s.g-a.g,h=s.b-a.b;return l*l+c*c+h*h}}_calculateColorRatios(){let{data:t,size:e}=this,r=new Map;for(let n=0;n<t.length;n+=4){let s=ee.build(t[n],t[n+1],t[n+2],t[n+3]),a=!1;for(let[l,c]of r.entries())if(l.equals(s)){a=!0,r.set(l,c+1);break}a||r.set(s,1)}let i=t.length/4;return kW(r,n=>n/i)}};function Xut(o){switch(o){case"r8unorm":case"r8snorm":case"r8uint":case"r8sint":return 1;case"r16uint":case"r16sint":case"r16float":case"rg8unorm":case"rg8snorm":case"rg8uint":case"rg8sint":return 2;case"r32uint":case"r32sint":case"r32float":case"rg16uint":case"rg16sint":case"rg16float":case"rgba8unorm":case"rgba8unorm-srgb":case"rgba8snorm":case"rgba8uint":case"rgba8sint":case"bgra8unorm":case"bgra8unorm-srgb":case"rgb10a2unorm":case"rg11b10ufloat":return 4;case"rg32uint":case"rg32sint":case"rg32float":case"rgba16uint":case"rgba16sint":case"rgba16float":return 8;case"rgba32uint":case"rgba32sint":case"rgba32float":return 16;case"bc1-rgba-unorm":case"bc1-rgba-unorm-srgb":case"bc4-r-unorm":case"bc4-r-snorm":return 8;case"bc2-rgba-unorm":case"bc2-rgba-unorm-srgb":case"bc3-rgba-unorm":case"bc3-rgba-unorm-srgb":case"bc5-rg-unorm":case"bc5-rg-snorm":case"bc6h-rgb-ufloat":case"bc6h-rgb-float":case"bc7-rgba-unorm":case"bc7-rgba-unorm-srgb":return 16;case"depth16unorm":return 2;case"depth24plus":case"depth24plus-stencil8":return 4;case"depth32float":return 4;default:throw new Error(`Unsupported texture format: ${o}`)}}var qut=class KMe{constructor(t,e,r){this.gpu=t,this.maxUserTextures=e,this.atlas=r,this.cache=new Map}static async build(t,e=7){if(e>t.limits.maxStorageTexturesPerShaderStage)throw new Error(`Exceeds GPU texture limit (max ${t.limits.maxStorageTexturesPerShaderStage})`);let r=await $ut.build(t,e);return new KMe(t,e,r)}clear(){this.atlas.clear(),this.cache.clear()}query(t){if(this.cache.has(t))return this.cache.get(t).id}getTextureNames(t){return Array.from(this.cache).filter(e=>e[1].type===t).map(e=>e[0])}getTexture(t){return Array.from(this.cache).filter(e=>e[1].type===t).map(e=>({name:e[0],blob:e[1].blob}))}create(t){let e=this.atlas.getTextures(),r=e.map((a,l)=>({binding:l,visibility:GPUShaderStage.COMPUTE,texture:{sampleType:"float"}}));r.push({binding:this.maxUserTextures,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}});let i=this.gpu.device.createBindGroupLayout({entries:r}),n=e.map((a,l)=>({binding:l,resource:a.texture.createView()}));n.push({binding:this.maxUserTextures,resource:{buffer:t}});let s=this.gpu.device.createBindGroup({label:"material",layout:i,entries:n});return{layout:i,bindGroup:s}}async add(t,e){if(e instanceof File)return this.add(t,{name:e.name,blob:e});let{name:r,blob:i}=e;if(this.cache.has(r))return this.cache.get(r).id;let n=await this.atlas.add(t,i);return this.cache.set(r,{id:n,type:t,blob:i}),n}},$ut=class ZMe{constructor(t){this.atlas=t}static async build(t,e){let r=[];for(let i=0;i<e;i++)r.push(new Kut(t,i>=3)),await t.device.queue.onSubmittedWorkDone();return new ZMe(r)}clear(){this.atlas.map(t=>t.clear())}getTextures(){return this.atlas.map(t=>t.getTexture())}async add(t,e){let r=0;for(let i of this.atlas)if(i.isFull())r+=i.getCapacity();else return r+=await i.add(t,e),r;throw new Error}},Kut=class{constructor(o,t){this.gpu=o,this.empty=t,this.index=0,this.format="rgba32float",this.size=this.getSize(),this.perRow=Math.floor(this.size.width/Cv.width()),this.capacity=Math.floor(this.perRow*(this.size.height/Cv.height())),this.texture=this.gpu.createDynamicTexture(this.size.width,this.size.height,this.format,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,"mapping texture")}getTexture(){return this.texture}getCapacity(){return this.capacity}clear(){this.index=0}isFull(){return this.empty||this.index===this.getCapacity()}async add(o,t){let e=await Cv.toData(o,t),r=this.index%this.perRow*Cv.width(),i=Math.floor(this.index/this.perRow)*Cv.height();return this.gpu.device.queue.writeTexture({texture:this.texture.texture,origin:{x:r,y:i}},e,{bytesPerRow:Cv.width()*16},[Cv.width(),Cv.height(),1]),this.index++,this.index-1}getSize(){if(this.empty)return{width:1,height:1};let{maxTextureDimension2D:o,maxBufferSize:t}=this.gpu.limits,e=Xut(this.format);return{width:o,height:Math.min(o,2**Math.floor(Math.log2(t/e/o)))}}},Zut=class{constructor(o={width:2048,height:2048}){this.size=o}width(){return this.size.width}height(){return this.size.height}async toData(o,t){let{data:e,size:r}=await $Me.fromBlob(t);if(this.width()!==r.width||this.height()!==r.height)throw new Error(`Invalid texture dimensions: expected ${this.size}, got ${r}`);switch(o){case 0:{let i=new Float32Array(e.length);for(let n=0;n<e.length;n+=4){let s=new Mt(e[n]-.5,e[n+1]-.5,e[n+2]-.5).normalize();i[n]=s.x,i[n+1]=s.y,i[n+2]=s.z}return i}case 1:{let i=new Float32Array(e.length);for(let n=0;n<e.length;n+=4)i[n]=e[n],i[n+1]=e[n+1],i[n+2]=e[n+2];return i}case 2:{let i=new Float32Array(e.length);for(let n=0;n<e.length;n+=4)i[n]=e[n],i[n+1]=e[n+1],i[n+2]=e[n+2];return i}case 3:{let i=new Float32Array(e.length);for(let n=0;n<e.length;n+=4)i[n]=e[n],i[n+1]=e[n+1],i[n+2]=e[n+2];return i}default:throw new Error}}},Cv=new Zut,JMe=class{constructor(o){let t=o.split(`
`),e=new Map,r="";for(let i of t){let n=i.trim();if(n.startsWith("newmtl "))r=n.substring(7).trim(),e.set(r,{Ka:{red:0,green:0,blue:0},Kd:{red:0,green:0,blue:0},Ks:{red:0,green:0,blue:0}});else if(n.startsWith("Ka ")&&r){let[,s,a,l]=n.split(/\s+/).map(Number);e.get(r).Ka={red:s,green:a,blue:l}}else if(n.startsWith("Kd ")&&r){let[,s,a,l]=n.split(/\s+/).map(Number);e.get(r).Kd={red:s,green:a,blue:l}}else if(n.startsWith("Ks ")&&r){let[,s,a,l]=n.split(/\s+/).map(Number);e.get(r).Ks={red:s,green:a,blue:l}}}this.table=e}getMaterialString(){let o="";return this.table.values().forEach(({Ka:e,Kd:r,Ks:i})=>{o+=JSON.stringify({a:t(e),d:t(r),s:t(i)})}),o;function t(e){let r=ee.build(e.red,e.green,e.blue);return od.encode(r)}}createMaterialKaTable(){return kW(this.table,o=>({ka:ee.build(o.Ka.red,o.Ka.green,o.Ka.blue),kd:ee.build(o.Kd.red,o.Kd.green,o.Kd.blue),ks:ee.build(o.Ks.red,o.Ks.green,o.Ks.blue)}))}},Jut=class QMe{static async build(t){let e=await(await fetch(t)).text();return new QMe(e)}constructor(t){let e=t.split(`
`),r={name:"",faces:[],vertexNormals:[],vertices:[]},i="";for(let n of e){let s=n.trim();if(s.startsWith("o "))r.name=s.substring(2).trim();else if(s.startsWith("v ")){let[,a,l,c]=s.split(/\s+/).map(Number);r.vertices.push(new Mt(a,l,c))}else if(s.startsWith("vn ")){let[,a,l,c]=s.split(/\s+/).map(Number);r.vertexNormals.push(new Mt(a,l,c))}else if(!s.startsWith("vt "))if(s.startsWith("f ")){let a=s.substring(2).split(" ").map(l=>{let[c,h,u]=l.split("/").map(d=>parseInt(d,10)-1);return{vertexIndex:c,vertexNormalIndex:u}});r.faces.push({material:i,vertices:a})}else s.startsWith("usemtl ")?i=s.substring(7).trim():s.startsWith("s ")}this.obj=r}deleteFace(t){this.obj.faces=this.obj.faces.filter(e=>!t(e.material))}scaleVertices(t){t&&this.obj.vertices.forEach((e,r)=>{this.obj.vertices[r]=e.scale(t)})}moveVertices(t){t&&this.obj.vertices.forEach((e,r)=>{this.obj.vertices[r]=this.obj.vertices[r].add(new Mt(t.x,0,-t.y))})}updateBBox(){let t=new Xm;this.obj.faces.forEach(e=>{let r=new Xm;r.ext3(this.obj.vertices[e.vertices[0].vertexIndex]),r.ext3(this.obj.vertices[e.vertices[1].vertexIndex]),r.ext3(this.obj.vertices[e.vertices[2].vertexIndex]),e.bbox=r.build(),t.ext4(e.bbox)}),this.bbox=t.build()}resetNormalIndex(t){this.obj.vertexNormals.length?this.obj.faces.forEach(e=>{e.vertices[0].vertexNormalIndex=t(this.obj.vertexNormals[e.vertices[0].vertexNormalIndex]),e.vertices[1].vertexNormalIndex=t(this.obj.vertexNormals[e.vertices[1].vertexNormalIndex]),e.vertices[2].vertexNormalIndex=t(this.obj.vertexNormals[e.vertices[2].vertexNormalIndex])}):this.obj.faces.forEach(e=>{let r=this.obj.vertices[e.vertices[0].vertexIndex],i=this.obj.vertices[e.vertices[1].vertexIndex],n=this.obj.vertices[e.vertices[2].vertexIndex],s=zut(r,i,n);e.vertices[0].vertexNormalIndex=t(s),e.vertices[1].vertexNormalIndex=t(s),e.vertices[2].vertexNormalIndex=t(s)})}resetVertexIndex(t){this.obj.faces.forEach((e,r)=>{e.vertices[0].vertexIndex=t(this.obj.vertices[e.vertices[0].vertexIndex]),e.vertices[1].vertexIndex=t(this.obj.vertices[e.vertices[1].vertexIndex]),e.vertices[2].vertexIndex=t(this.obj.vertices[e.vertices[2].vertexIndex])})}setMaterialIndex(t){this.obj.faces.forEach((e,r)=>{this.obj.faces[r].materialIndex=t(e.material)})}setFaceIndex(t){this.obj.faces.forEach((e,r)=>{this.obj.faces[r].index=t({v0:e.vertices[0].vertexIndex,v1:e.vertices[1].vertexIndex,v2:e.vertices[2].vertexIndex,n0:e.vertices[0].vertexNormalIndex,n1:e.vertices[1].vertexNormalIndex,n2:e.vertices[2].vertexNormalIndex,m:e.materialIndex})})}crateItems(){let t=[];return this.obj.faces.forEach(e=>{t.push({index:e.index,bbox:new by(e.bbox.minX,e.bbox.minY,e.bbox.minZ,e.bbox.maxX,e.bbox.maxY,e.bbox.maxZ)})}),t}getVerticesArr(){let t=[];return this.obj.vertices.forEach(e=>{t.push(e.x,e.y,e.z)}),t}getNoemalsArr(){let t=[];return this.obj.vertexNormals.forEach(e=>{t.push(e.x,e.y,e.z)}),t}putRight(){let t=new Xm;this.obj.vertices.forEach(r=>{t.ext2(r.x,r.y,r.z)}),this.bbox=t.build();let e=this.bbox.center();this.obj.vertices.forEach((r,i)=>{this.obj.vertices[i]=r.sub(e)})}rotate(t){this.obj.vertexNormals.forEach((e,r)=>{let i=new Mt(e.x,e.y,e.z).multiply4(t);this.obj.vertexNormals[r]=i}),this.obj.vertices.forEach((e,r)=>{let i=new Mt(e.x,e.y,e.z).multiply4(t);this.obj.vertices[r]=i})}getMaterilas(){return new Set(this.obj.faces.map(t=>t.material))}},e4e=class kbe{constructor(t,e,r,i,n,s,a,l,c){this.bvh=t,this.face=e,this.vertexAndNormal=r,this.bbox=i,this.capacity=n,this.depth=s,this.input=a,this.gpu=l,this.material=c}static destring(t){let{mtl:e,obj:r,origin:i}=JSON.parse(t);return{mtl:e===void 0?void 0:e,obj:r,origin:i===void 0?void 0:new S(i[0],i[1])}}static async build(t,e,r,i=4){let n=new Qut,{mtl:s,obj:a,origin:l,scale:c}=e,h=new Jut(a),u=edt(h.getMaterilas(),s,r);h.deleteFace(y=>t4e.isPCB(u.get(y).material.ka)),h.scaleVertices(c),h.moveVertices(l),h.updateBBox(),h.resetNormalIndex(y=>n.addNormalOrVetex(y)),h.resetVertexIndex(y=>n.addNormalOrVetex(y)),h.setMaterialIndex(y=>u.get(y).index),h.setFaceIndex(y=>n.addFaceIndex(y));let d=h.crateItems(),p=new put(d,i,new Mt(h.bbox.minX,h.bbox.minY,h.bbox.minZ),h.bbox),m=fut(p,i);n.addBVHData(m);let g=n.createBuffer(t);return new kbe(g.bvh,g.face,g.vertexAndNormal,h.bbox,p.maxNodeCapacity,p.dep,e,t,r)}async update(t,e){let r=await kbe.build(this.gpu,{obj:t,mtl:e},this.material);this.bvh.setDynamicBuffer(r.bvh),this.face.setDynamicBuffer(r.face),this.vertexAndNormal.setDynamicBuffer(r.vertexAndNormal),this.bbox=r.bbox}getBVH(){return this.bvh}getFace(){return this.face}getVertexAndNormal(){return this.vertexAndNormal}getBBox(){return this.bbox}tostring(){let{mtl:t,obj:e,origin:r}=this.input;return JSON.stringify({mtl:t===void 0?void 0:t,obj:e,origin:r==null?void 0:[r.x,r.y]})}},Qut=class{constructor(){this.bvhData=[],this.normalAndVertexData=[],this.faceIndexData=[]}addBVHData(o){o.forEach(t=>this.bvhData.push(t))}addNormalOrVetex(o){return this.normalAndVertexData.push(o.x,o.y,o.z,0),this.normalAndVertexData.length/4-1}addFaceIndex(o){return this.faceIndexData.push(o.v0,o.v1,o.v2,o.n0,o.n1,o.n2,o.m),this.faceIndexData.length/7-1}createBuffer(o){return{bvh:o.createStorageDynamicBuffer(this.bvhData,"obj model bvh"),vertexAndNormal:o.createStorageDynamicBuffer(this.normalAndVertexData,"obj model vertex and normal"),face:o.createStorageDynamicBuffer(this.faceIndexData,"obj model face")}}},t4e=class{static isPCB(o){return Math.abs(o.r-this.pcb.r)<.01&&Math.abs(o.g-this.pcb.g)<.01&&Math.abs(o.b-this.pcb.b)<.01}};t4e.pcb=ee.build(0,.15,.36);function edt(o,t,e){let r=tdt(o,t);return kW(r,i=>{let{ka:n,kd:s,ks:a}=i,l=new fS(n,s,a,1,1);return{index:e.register(l),material:i}})}function tdt(o,t){return t?new JMe(t).createMaterialKaTable():Yut(o,()=>({ka:ee.RED,kd:ee.RED,ks:ee.RED}))}var hDe=class{constructor(o){this._table=o}getUserTextures(){let o=new Set;return this._table.map(t=>t[1]).forEach(t=>{o.add(t.colorTexture.path).add(t.normalTexture.path).add(t.metallicTexture.path).add(t.roughnessTexture.path)}),o}get table(){return this._table}get(o){let t=[];for(let[e,r]of this._table)this._equals(o,e)&&t.push(r);if(t.length===0)return this.add(o);if(t.length===1)return t[0];throw new Error}add(o){let t=new F2e(o.ambient);return this.set(o,t),t}set(o,t){let e=[];for(let r=0;r<this._table.length;r++){let[i,n]=this._table[r];this._equals(o,i)&&e.push({pbr:n,index:r})}if(e.length===0){this._table.push([o,t]);return}if(e.length===1){let r=e[0].index;this._table[r]=[o,t]}throw new Error}modify(o,t){for(let e=0;e<this._table.length;e++)this._table[e][1]===o&&(this._table[e][1]=t)}soureceData(){let o=[];for(let[t,e]of this.table)o.push([t,e]);return BMe.encode(o)}_equals(o,t){return o.ambient.equals(t.ambient)&&o.diffuse.equals(t.diffuse)&&o.specular.equals(t.specular)}},rdt=class{constructor(o,t,e,r,i,n,s,a,l,c,h,u,d,p){this.color=o,this.metallic=t,this.roughness=e,this.ior=r,this.iorLevel=i,this.clearcoatTintColor=n,this.clearcoatIntensity=s,this.clearcoatRoughness=a,this.clearcoatIor=l,this.normalIntensity=c,this.normalTexture=h,this.metallicTexture=u,this.colorTexture=d,this.roughnrssTexture=p}getData(){let o={baseColor:uDe(this.color),metallic:this.metallic,roughness:this.roughness,ior:this.ior,iorLevel:this.iorLevel,clearcoatIntensity:this.clearcoatIntensity,clearcoatRoughness:this.clearcoatRoughness,clearcoatIor:this.clearcoatIor,clearcoatTintColor:uDe(this.clearcoatTintColor),normalIntensity:this.normalIntensity,normalTexture:this.normalTexture.index,normalTextureScale:this.normalTexture.scale,metallicTexture:this.metallicTexture.index,metallicTextureScale:this.metallicTexture.scale,colorTexture:this.colorTexture.index,colorTextureScale:this.colorTexture.scale,roughnrssTexture:this.roughnrssTexture.index,roughnessTextureScacle:this.roughnrssTexture.scale};return R2(o)}};function uDe(o){return new Mt(o.r,o.g,o.b)}var dDe=class r4e{constructor(t,e){this.gpu=t,this.textureRegister=e,this.cache=new gut,this.dirty=!0,this.table=[]}static async build(t,e){let r=await qut.build(t);if(e){for(let i of e.normal)await r.add(0,i);for(let i of e.metallic)await r.add(1,i);for(let i of e.color)await r.add(2,i);for(let i of e.roughness)await r.add(3,i)}return new r4e(t,r)}clear(){this.textureRegister.clear(),this.cache.clear(),this.table.length=0,this.dirty=!0}check(){return this.dirty?(this._updateBuffer(),!0):!1}createPipelineInfo(){this._updateBuffer();let{layout:t,bindGroup:e}=this.textureRegister.create(this.buffer.getBuffer());return{layout:t,bindGroup:e}}modify(t,e){this.dirty=!0;let r=pDe(this.textureRegister,e);this.table[t]={config:e,data:r}}registe(t){let e=pDe(this.textureRegister,t),r=this.table.push({config:t,data:e})-1;return this.cache.set(t,r),r}_updateBuffer(){let t=[];this.table.forEach(e=>{e.data.getData().forEach(r=>{t.push(r)})}),this.buffer?this.gpu.writeBuffer(this.buffer,0,new Float32Array(t)):this.buffer=this.gpu.createStorageDynamicBuffer(t,"material buffer of raytracer."),this.dirty=!1}};function pDe(o,t){return new rdt(t.color,t.metallic,t.roughness,t.ior,t.iorLevel,t.clearcoatTintColor,t.clearcoatIntensity,t.clearcoatRoughness,t.clearcoatIor,t.normalIntensity,e(t.normalTexture),e(t.metallicTexture),e(t.colorTexture),e(t.roughnessTexture));function e(r){let{path:i,scale:n}=r;return{index:o.query(i)!==void 0?o.query(i):-1,scale:n}}}var idt=class Bbe{constructor(t,e,r){this.table=t,this.registrar=e,this.input=r}static async build(t,e){if(e){let r=new hDe(e.table),i=await dDe.build(t,e);return new Bbe(r,i,e)}else{let r=new hDe([]),i=await dDe.build(t);return new Bbe(r,i,e)}}clear(){this.registrar.clear(),this.initPipelineInfo()}get gpu(){return this.registrar.gpu}get bindGroup(){return this._bindGroup}get layout(){return this._layout}getBlob(){return new Blob([this.soureceData()])}soureceData(){return this.table.soureceData()}register(t){let e=this.table.get(t);return this.registrar.registe(e)}getPBR(t){let e=this.registrar.cache.inverse.get(t);if(!e)throw new Error;return e}modify(t,e){this.registrar.modify(t,e);let r=this.getPBR(t);this.registrar.cache.delete(e),this.registrar.cache.set(e,t),this.table.modify(r,e)}initPipelineInfo(){let{layout:t,bindGroup:e}=this.registrar.createPipelineInfo();this._layout=t,this._bindGroup=e}},ndt=class Fbe{constructor(t,e,r){this.texture=t,this.parameter=e,this.input=r}static async build(t,e,r){if(!e){let g=t.createDynamicTexture(1,1,"r32float",GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,"cutting board texture empty."),y=t.createUniformDynamicBuffer(10,"board material");return new Fbe(g,y,e)}let i=(await $Me.fromBlob(e.blob)).binarize(),{data:n,size:s}=i,{width:a,height:l}=s,c=t.createDynamicTexture(a,l,"r32float",GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,"cutting board texture.");t.device.queue.writeTexture({texture:c.texture},n,{bytesPerRow:a*4},[a,l,1]);let h=r.register(new fS(ee.build(.01,.09499999999999964,.06599999999999963),ee.WHITE,ee.WHITE,1,1)),u={silk:r.register(new fS(ee.build(.2499999999999999,.37499999999999967,.06599999999999963),ee.WHITE,ee.WHITE,1,1)),plane:h,width:m(300),height:m(200),cornerRadius:m(5),edgeClearance:m(10),lineBreadth:m(1/2),gridSize:m(10),slikWidth:m(100),slikHeight:m(100)/(c.width/c.height)},d=R2(u),p=t.createUniformDynamicBuffer(d,"board material");return new Fbe(c,p,e);function m(g){return 3.93701*g}}getBlob(t){this.input&&t("log",this.input.blob)}},odt=class{constructor(o,t,e){this._gpu=o,this.material=e,this._isChange=!0,this.color=ee.build(.001,0,0),this.position=new Mt(0,0,100),this.width=100,this.height=100,this.visible=!0,this._materialID=e.register(new fS(this.color,ee.WHITE,ee.WHITE));let r=this._getData();this.hide=!!t,this.buffer=this._gpu.createUniformDynamicBuffer(r,"occluder model")}getVisible(){return this.visible}setVisible(o){this.visible=o,this._isChange=!0}getColor(){return this.color}setColor(o){this.color=o,this.material.modify(this._materialID,new F2e(this.color)),this._isChange=!0}getPosition(){return this.position}setPosition(o){this.position=o,this._isChange=!0}getWidth(){return this.width}setWidth(o){this.width=o,this._isChange=!0}getHeight(){return this.height}setHeight(o){this.height=o,this._isChange=!0}checkAndUpdate(){return this._isChange?(this.buffer.write(0,new Float32Array(this._getData())),this._isChange=!1,!0):!1}_getData(){return R2({position:this.position,width:this.width,height:this.height,materialID:this._materialID,hide:this.hide?1:0,visible:this.visible})}},sdt=class i4e{constructor(t,e,r,i,n,s){this.material=t,this.pcb=e,this.obj=r,this.board=i,this.occluder=n,t.initPipelineInfo(),s.setObjectByBBox3(r.getBBox())}static async build(t,e,r){let i=await idt.build(t,r.material),n=await e4e.build(t,r.obj,i),s=new VMe(t,i,r.pcb),a=await ndt.build(t,r.board,i),l=new odt(t,r.occluder,i);return new i4e(i,s,n,a,l,e)}checkAndUpdate(){return this.material.registrar.check()||this.occluder.checkAndUpdate()}async getBlob(){let t={version:"from pcb",pcb:await this.pcb.tostring(),obj:this.obj.tostring()},e=JSON.stringify(t);return new Blob([e])}};function adt(o){let t={backgroundTexture:o.backgroundTexture,backgroundRotation:o.backgroundRotation,backgroundIntensity:o.backgroundIntensity,backgroundColor:od.encode(o.backgroundColor),backgroundUseColor:o.backgroundUseColor,occluderPosition:_2.encode(o.occluderPosition),occluderWidth:o.occluderWidth,occluderHeight:o.occluderHeight,occluderVisible:o.occluderVisible,rendererMaxSample:o.rendererMaxSample,rendererEnableDenoise:o.rendererEnableDenoise,hideBoard:o.hideBoard,hideOccluder:o.hideOccluder,hidePCB:o.hidePCB,hideOBJ:o.hideOBJ,hideLight:o.hideLight,hideCoordinate:o.hideCoordinate,renderMode:o.renderMode,flangeFocalDistance:o.flangeFocalDistance,apertureSize:o.apertureSize,focalLength:o.focalLength,maxRayBounces:o.maxRayBounces,diffuseMode:o.diffuseMode,occluderColor:od.encode(o.occluderColor),lightIsOpen:o.lightIsOpen,displayDevice:o.displayDevice,viewTransform:o.viewTransform,lutName:o.lutName},e=JSON.stringify(t);return new Blob([e])}async function ldt(o){let t=await o.text(),e=JSON.parse(t);return{backgroundIntensity:e.backgroundIntensity,backgroundTexture:e.backgroundTexture,backgroundRotation:e.backgroundRotation,backgroundColor:od.decode(e.backgroundColor)?od.decode(e.backgroundColor):ee.WHITE,backgroundUseColor:e.backgroundUseColor,occluderColor:od.decode(e.occluderColor)?od.decode(e.occluderColor):ee.WHITE,occluderPosition:e.occluderPosition?_2.decode(e.occluderPosition):void 0,occluderWidth:e.occluderWidth,occluderHeight:e.occluderHeight,occluderVisible:e.occluderVisible,rendererMaxSample:e.rendererMaxSample,rendererEnableDenoise:e.rendererEnableDenoise,hideBoard:e.hideBoard,hideOccluder:e.hideOccluder,hidePCB:e.hidePCB,hideOBJ:e.hideOBJ,hideLight:e.hideLight,hideCoordinate:e.hideCoordinate,renderMode:e.renderMode,flangeFocalDistance:e.flangeFocalDistance,apertureSize:e.apertureSize,focalLength:e.focalLength,maxRayBounces:e.maxRayBounces,diffuseMode:e.diffuseMode,lightIsOpen:e.lightIsOpen,displayDevice:e.displayDevice,viewTransform:e.viewTransform,lutName:e.lutName}}function cdt(o,t){let e={};for(let r of Object.keys(t))o[r]!==t[r]&&(e[r]=t[r]),o[r]instanceof ee&&t[r]instanceof ee&&o[r].equals(t[r])&&(e[r]=void 0);return e}var hdt=class{diff(o){let t=this.last===void 0?o:cdt(this.last,o);return this.last=o,t}},n4e="struct O_a { O_b : vec3 < f32 > , O_c : vec3f , O_d : vec3f , O_e : f32 , O_f : f32 , O_g : f32 , } @ group ( 0 ) @ binding ( 0 ) var < storage , read > O_h : array < O_a > ; @ group ( 0 ) @ binding ( 1 ) var < storage , read_write > O_i : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read_write > O_j : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 3 ) var < storage , read_write > O_k : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 4 ) var < storage , read_write > O_l : array < f32 > ; @ group ( 0 ) @ binding ( 5 ) var < storage , read_write > O_m : array < f32 > ; override Width : u32 ; override Height : u32 ; @ compute @ workgroup_size ( 8 , 8 ) fn main ( @ builtin ( global_invocation_id ) O_n : vec3 < u32 > , ) { if ( O_n . x >= Width || O_n . y >= Height ) { return ; } let O_o = O_n . x + O_n . y * u32 ( Width ) ; let O_p = O_h [ O_o ] ; O_i [ O_o ] = O_p . O_b ; O_j [ O_o ] = O_p . O_c ; O_k [ O_o ] = O_p . O_d ; O_l [ O_o ] = O_p . O_f ; O_m [ O_o ] = O_p . O_g ; } ";UO.addShaderCode(n4e);var udt=class{constructor(o,t,e){this.gpu=o,this.size=t,this.geometry=e,this.initializeBuffer(),this.initializePipeline(),this.initializeBindGroup()}getBuffers(){return this.buffers}run(){let o=this.gpu.device.createCommandEncoder(),t=o.beginComputePass();t.setPipeline(this.pipeline),t.setBindGroup(0,this.bindGroup),t.dispatchWorkgroups(Math.ceil(this.size.width/8),Math.ceil(this.size.height/8)),t.end(),this.gpu.submit(o)}async runAsync(){let o=performance.now();return this.run(),await this.gpu.device.queue.onSubmittedWorkDone(),performance.now()-o}initializeBuffer(){let o=this.size.width*this.size.height;this.buffers={geometry:this.geometry,hdrColor:this.gpu.createStorageDynamicBuffer(o*4,"hdrColor"),position:this.gpu.createStorageDynamicBuffer(o*4,"position"),normal:this.gpu.createStorageDynamicBuffer(o*4,"normal"),depth:this.gpu.createStorageDynamicBuffer(o,"depth"),type:this.gpu.createStorageDynamicBuffer(o,"type")}}initializeBindGroup(){this.bindGroup=this.gpu.createBindGroup("geometry buffer dismantle",this.pipeline.getBindGroupLayout(0),0,this.buffers.geometry,1,this.buffers.hdrColor,2,this.buffers.position,3,this.buffers.normal,4,this.buffers.depth,5,this.buffers.type)}initializePipeline(){this.pipeline=this.gpu.createComputePipeline(n4e,"main","geometry buffer dismantle","auto",{Width:this.size.width,Height:this.size.height})}},o4e="override Image_Width : u32 ; override Image_Height : u32 ; fn O_a ( O_b : vec3 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec3 < f32 > , O_h : vec3 < f32 > , O_i : vec3 < f32 > , ) -> vec3 < f32 > { let O_j = normalize ( O_i ) ; let O_k = normalize ( O_h ) ; let O_l = max ( dot ( O_g , O_k ) , 0.0 ) ; let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; if ( O_l <= 0.0 || O_m <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } let O_n = O_o ( O_b , O_d , O_e , O_f ) ; let O_p = O_q ( O_n , O_m ) ; let O_r = ( 1.0 - O_p ) * ( 1.0 - O_d ) ; let O_s = O_b * O_r * O_t ; let O_u = O_v ( O_b , O_c , O_d , O_e , O_f , O_g , O_j , O_k ) ; return O_s + O_u ; } const O_w : f32 = 2e-10 ; fn O_x ( O_y : f32 , O_z : f32 , ) -> f32 { let O_aa = abs ( O_z ) ; if ( O_aa >= 1.0 - 1e-5 ) { return 0.0 ; } let O_ab = max ( O_aa , 1e-5 ) ; let O_ac = 1.0 / ( O_ab * O_ab ) ; let O_ad = max ( O_ac - 1.0 , 0.0 ) ; let O_ae = O_y * O_ad ; let O_af = sqrt ( 1.0 + O_ae ) ; return 0.5 * ( O_af - 1.0 ) ; } fn O_ag ( O_ah : f32 , O_c : f32 , ) -> f32 { let O_ai = O_c * O_c ; let O_y = O_ai * O_ai ; if ( O_y <= O_w ) { return 0.0 ; } let O_aj = clamp ( O_ah , - 1.0 , 1.0 ) ; let O_ak = min ( O_aj * O_aj , 1.0 ) ; let O_al = 1.0 - O_ak ; let O_am = O_al + O_y * O_ak ; let O_an = O_am * O_am ; return O_y / max ( O_ao * O_an , 1e-10 ) ; } fn O_ap ( O_m : f32 , O_l : f32 , O_c : f32 , ) -> f32 { let O_ai = O_c * O_c ; let O_y = O_ai * O_ai ; if ( O_y <= O_w ) { return 1.0 ; } let O_aq = O_x ( O_y , O_l ) ; let O_ar = O_x ( O_y , O_m ) ; let O_as = 1.0 + O_aq + O_ar ; return 1.0 / max ( O_as , 1e-7 ) ; } fn O_v ( O_b : vec3 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec3 < f32 > , O_j : vec3 < f32 > , O_k : vec3 < f32 > , ) -> vec3 < f32 > { let O_at = O_j + O_k ; let O_au = length ( O_at ) ; if ( O_au < 1e-6 ) { return vec3 < f32 > ( 0.0 ) ; } let O_av = O_at / O_au ; let O_l = max ( dot ( O_g , O_k ) , 0.0 ) ; let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; let O_ah = dot ( O_g , O_av ) ; let O_aw = max ( dot ( O_j , O_av ) , 0.0 ) ; if ( O_l <= 0.0 || O_m <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } if ( O_ah <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } let O_n = O_o ( O_b , O_d , O_e , O_f ) ; let O_p = O_q ( O_n , O_aw ) ; let O_ax = O_ag ( O_ah , O_c ) ; if ( O_ax <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } let O_ay = O_ap ( O_m , O_l , O_c ) ; let O_ai = O_c * O_c ; let O_y = O_ai * O_ai ; let O_aq = O_x ( O_y , O_l ) ; let O_ar = O_x ( O_y , O_m ) ; let O_az = O_ax / max ( O_l , 1e-10 ) * 0.25 ; let O_ba = 1.0 + O_ar + O_aq ; let O_bb = O_p * O_az / max ( O_ba , 1e-10 ) ; return clamp ( O_bb , vec3 < f32 > ( 0.0 ) , vec3 < f32 > ( 1e4 ) ) ; } fn O_bc ( O_b : vec3f , O_bd : vec3f , O_be : vec3f , ) -> O_bf { var O_bg : O_bf ; var O_i : vec3f ; O_i = O_bh ( ) ; O_i = O_bi ( O_i , O_be ) ; if ( dot ( O_i , O_bd ) < 0.0 ) { return O_bg ; } O_bg . O_i = O_i ; O_bg . O_bj = O_b ; return O_bg ; } fn O_bh ( ) -> vec3f { let O_bk = O_bl ( ) ; let O_bm = O_bl ( ) ; let O_bn = sqrt ( O_bk ) ; let O_bo = 2.0 * O_ao * O_bm ; return vec3f ( cos ( O_bo ) * O_bn , sin ( O_bo ) * O_bn , sqrt ( 1.0 - O_bk ) ) ; } fn O_bi ( O_bp : vec3f , O_bq : vec3f , ) -> vec3f { var O_br : vec3f ; if ( abs ( O_bq . z ) > 0.999 ) { O_br = vec3f ( 1.0 , 0.0 , 0.0 ) ; } else { O_br = normalize ( cross ( vec3f ( 0.0 , 0.0 , 1.0 ) , O_bq ) ) ; } let O_bs = cross ( O_bq , O_br ) ; return O_bp . x * O_br + O_bp . y * O_bs + O_bp . z * O_bq ; } fn O_bt ( O_b : vec3 < f32 > , O_bu : vec3 < f32 > , O_h : vec3 < f32 > , ) -> vec3 < f32 > { return O_b * dot ( O_h , O_bu ) ; } fn O_bv ( O_bw : vec3f , O_b : vec3f , O_bx : vec3f , O_by : vec3f , O_c : f32 , ) -> O_bf { var O_bz : vec3f = O_bx ; if ( dot ( - O_bw , O_bz ) < 0.0 ) { O_bz = - O_bz ; } let O_bq = O_ca ( O_bz , O_c * O_c ) ; var O_cb = O_cc ( O_bw , O_bq ) ; if ( dot ( O_cb , O_by ) < 0.0 ) { O_cb = - O_cb ; } let O_cd = O_ce ( max ( dot ( - O_bw , O_bz ) , 0.0 ) , O_b ) ; return O_bf ( O_cb , O_cd ) ; } fn O_ca ( O_bu : vec3 < f32 > , O_c : f32 , ) -> vec3 < f32 > { var O_cf : f32 = O_cg ( O_c ) ; return O_ch ( O_bu , O_cf ) ; } fn O_cg ( O_bn : f32 , ) -> f32 { if ( O_bn > 0.99999 ) { return O_bl ( ) ; } if ( O_bn < 0.00001 ) { return 1.0 ; } let O_ci = O_bn * O_bn ; let O_cj = O_ck ( O_ci , 1.0 ) ; return sqrt ( ( 1.0 - sqrt ( O_ci / O_cj ) ) / ( 1.0 - O_bn ) ) ; } fn O_ch ( O_cl : vec3 < f32 > , O_cf : f32 , ) -> vec3 < f32 > { let O_bu = normalize ( O_cl ) ; if ( O_cf == 1.0 ) { return O_bu ; } var O_cm : vec3 < f32 > ; if abs ( O_bu . x ) < 0.9 { O_cm = cross ( O_bu , vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ) ; } else { O_cm = cross ( O_bu , vec3 < f32 > ( 0.0 , 1.0 , 0.0 ) ) ; } O_cm = normalize ( O_cm ) ; let O_cn = cross ( O_bu , O_cm ) ; let O_co = O_cp ( ) ; let O_bn = O_cf * O_bu + sqrt ( 1.0 - O_cf * O_cf ) * ( cos ( O_co ) * O_cm + sin ( O_co ) * O_cn ) ; return normalize ( O_bn ) ; } const O_ao : f32 = 3.14159265359 ; const O_cq : f32 = 2.718281828459045 ; const O_cr : f32 = O_ao * 2.0 ; const O_cs : f32 = 1.5707963267948966 ; const O_ct : f32 = 0.7853981633974830 ; const O_t : f32 = 0.3183098861837907 ; const O_cu : f32 = 1e-7 ; const O_cv : f32 = 3.402823466e+38 ; const O_cw : u32 = 10 ; const O_cx : bool = true ; const O_cy : f32 = 1.4426950408889634 ; const O_cz : bool = true ; const O_da : u32 = 0 ; const O_db : u32 = 1 ; const O_dc : u32 = 2 ; const O_dd : u32 = 3 ; const O_de : u32 = 0 ; const O_df : u32 = 1 ; const O_dg : u32 = 2 ; const O_dh : u32 = 3 ; const O_di : u32 = 4 ; const O_dj : u32 = 5 ; const O_dk : u32 = 6 ; const O_dl : u32 = 7 ; const O_dm : u32 = 8 ; const O_dn : u32 = 9 ; const O_do : u32 = 10 ; const O_dp : u32 = 11 ; const O_dq : u32 = 12 ; const O_dr : u32 = 13 ; const O_ds : u32 = 14 ; const O_dt : u32 = 15 ; const O_du : u32 = 16 ; const O_dv : u32 = 17 ; const O_dw : u32 = 18 ; const O_dx : u32 = 19 ; const O_dy : u32 = 20 ; const O_dz : u32 = 20 ; const O_ea = 30 ; const O_eb : i32 = 1 ; const O_ec : i32 = 2 ; const O_ed : i32 = 3 ; const O_ee : i32 = 4 ; const O_ef : i32 = 5 ; const O_eg = 6 ; const O_eh : i32 = 3 ; const O_ei : u32 = 0 ; const O_ej : u32 = 1 ; const O_ek : u32 = 2 ; const O_el : u32 = 3 ; const O_em : u32 = 4 ; const O_en = 0 ; const O_eo = 1 ; const O_ep = 2 ; const O_eq = 3 ; const O_er : u32 = 0u ; const O_es : u32 = 1u ; @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_et : array < O_eu > ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_ev : O_ew ; @ group ( 0 ) @ binding ( 2 ) var < uniform > O_ex : O_ey ; @ group ( 0 ) @ binding ( 3 ) var < uniform > O_ez : O_fa ; @ group ( 0 ) @ binding ( 4 ) var < uniform > O_fb : O_fc ; @ group ( 0 ) @ binding ( 5 ) var < uniform > O_fd : O_fe ; @ group ( 0 ) @ binding ( 6 ) var O_ff : texture_2d < f32 > ; @ group ( 0 ) @ binding ( 7 ) var < uniform > O_fg : array < O_fh , 3 > ; @ group ( 1 ) @ binding ( 0 ) var O_fi : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 1 ) var O_fj : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 2 ) var O_fk : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 3 ) var O_fl : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 4 ) var O_fm : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 5 ) var O_fn : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 6 ) var O_fo : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 7 ) var < storage , read > O_fp : array < O_fq > ; @ group ( 2 ) @ binding ( 0 ) var < storage , read > O_fr : array < O_fs > ; @ group ( 2 ) @ binding ( 1 ) var < storage , read > O_ft : array < f32 > ; @ group ( 2 ) @ binding ( 2 ) var < storage , read > O_fu : array < O_fv > ; @ group ( 2 ) @ binding ( 3 ) var < storage , read > O_fw : array < vec3 < f32 > > ; @ group ( 2 ) @ binding ( 4 ) var < storage , read > O_fx : array < O_fy > ; @ group ( 2 ) @ binding ( 5 ) var < storage , read > O_fz : array < f32 > ; @ group ( 2 ) @ binding ( 6 ) var < storage , read_write > O_ga : array < f32 , 3 > ; @ group ( 2 ) @ binding ( 7 ) var < uniform > O_gb : O_gc ; @ group ( 2 ) @ binding ( 8 ) var < uniform > O_gd : O_ge ; @ group ( 3 ) @ binding ( 0 ) var O_gf : texture_2d < f32 > ; @ group ( 3 ) @ binding ( 1 ) var < storage , read_write > O_gg : array < vec2 < f32 > > ; var < private > O_gh : vec2 < u32 > ; var < private > O_gi : u32 ; var < private > O_gj : f32 ; var < private > O_gk : bool = false ; var < private > O_gl : u32 = 0 ; fn O_gm ( O_gn : vec3 < u32 > , ) { O_go ( O_gn ) ; O_gp ( ) ; } fn O_go ( O_gn : vec3 < u32 > , ) { let O_gq = u32 ( O_ev . O_gr ) + O_gn . x ; let O_gs = O_gg [ O_gq ] ; O_gh = vec2 < u32 > ( u32 ( O_gs . x ) , u32 ( O_gs . y ) ) ; O_gi = O_gh . x + O_gh . y * Image_Width ; } @ compute @ workgroup_size ( 64 ) fn main ( @ builtin ( global_invocation_id ) O_gn : vec3 < u32 > , ) { let O_gq = u32 ( O_ev . O_gr ) + O_gn . x ; if ( O_gq >= Image_Width * Image_Height ) { return ; } O_gm ( O_gn ) ; if ( O_gh . x >= Image_Width || O_gh . y >= Image_Height ) { return ; } let O_gt = O_gu ( ) ; let O_gv = O_gw ( O_gt ) ; O_gx ( O_gv , O_gt ) ; } @ compute @ workgroup_size ( 1 , 1 ) fn main_hit ( @ builtin ( global_invocation_id ) O_gn : vec3 < u32 > , ) { O_gm ( O_gn ) ; if ( O_gh . x >= Image_Width || O_gh . y >= Image_Height ) { return ; } let O_gt = O_fs ( O_ex . O_gy , normalize ( O_ex . O_gz ) ) ; let O_ha = O_hb ( O_gt , true , false , false ) ; O_ga [ 0 ] = f32 ( O_ha . O_hc ) ; O_ga [ 1 ] = O_ha . O_hd ; O_ga [ 2 ] = f32 ( O_ha . O_he ) ; } @ compute @ workgroup_size ( 8 , 8 ) fn main_demo ( @ builtin ( global_invocation_id ) O_gn : vec3 < u32 > , ) { if ( O_gn . x >= Image_Width || O_gn . y >= Image_Height ) { return ; } O_gi = O_gn . x + O_gn . y * Image_Width ; O_bl ( ) ; O_bl ( ) ; let O_gt = O_gu ( ) ; let O_ha = O_hb ( O_gt , true , false , false ) ; if ( O_ha . O_hc >= 0 ) { O_hf ( O_fp [ O_ha . O_hc ] . O_b ) ; } } fn O_o ( O_b : vec3f , O_d : f32 , O_e : f32 , O_hg : f32 , ) -> vec3f { if ( O_d >= 1.0 ) { return O_b ; } var O_hh = max ( O_e , 1e-5 ) ; var O_hi = O_hj ( O_hh ) ; if ( abs ( O_hg - 0.5 ) > 1e-5 ) { O_hi *= 2.0 * max ( O_hg , 0.0 ) ; O_hh = O_hk ( O_hi ) ; if ( O_e < 1.0 ) { O_hh = 1.0 / O_hh ; } } let O_hl = vec3f ( O_hi ) ; return mix ( O_hl , O_b , O_d ) ; } fn O_hj ( O_e : f32 , ) -> f32 { let O_hh = max ( O_e , 1e-5 ) ; let O_hm = ( O_hh - 1.0 ) / ( O_hh + 1.0 ) ; return O_hm * O_hm ; } fn O_hk ( O_hi : f32 , ) -> f32 { let O_hn = sqrt ( clamp ( O_hi , 0.0 , 0.99 ) ) ; return ( 1.0 + O_hn ) / ( 1.0 - O_hn ) ; } fn O_q ( O_n : vec3 < f32 > , O_ho : f32 , ) -> vec3 < f32 > { return O_n + ( vec3 < f32 > ( 1.0 ) - O_n ) * pow ( 1.0 - O_ho , 5.0 ) ; } fn O_ce ( O_hp : f32 , O_n : vec3 < f32 > , ) -> vec3 < f32 > { return O_n + ( vec3 < f32 > ( 1.0 ) - O_n ) * pow ( 1.0 - O_hp , 5.0 ) ; } fn O_hq ( O_bn : f32 , O_bo : f32 , ) -> vec2 < f32 > { return vec2 < f32 > ( O_bn * cos ( O_bo ) , O_bn * sin ( O_bo ) ) ; } fn O_hr ( O_hs : vec2 < f32 > , ) -> vec2 < f32 > { let O_ht = 2.0 * O_hs . x - 1.0 ; let O_hu = 2.0 * O_hs . y - 1.0 ; if ( O_ht == 0.0 && O_hu == 0.0 ) { return vec2 < f32 > ( 0.0 ) ; } var O_bn : f32 ; var O_bo : f32 ; if ( O_ht * O_ht > O_hu * O_hu ) { O_bn = O_ht ; O_bo = O_ct * ( O_hu / O_ht ) ; } else { O_bn = O_hu ; O_bo = O_cs - O_ct * ( O_ht / O_hu ) ; } return O_hq ( O_bn , O_bo ) ; } fn O_hv ( O_hw : vec3 < f32 > , O_hx : vec3 < f32 > , O_hs : vec2 < f32 > , ) -> vec3 < f32 > { return O_hw * ( 2.0 * O_hs . x - 1.0 ) + O_hx * ( 2.0 * O_hs . y - 1.0 ) ; } fn O_hy ( O_hw : vec3 < f32 > , O_hx : vec3 < f32 > , O_hs : vec2 < f32 > , ) -> vec3 < f32 > { let O_hz = O_hr ( O_hs ) ; return O_hw * O_hz . x + O_hx * O_hz . y ; } fn O_ia ( O_ht : vec3 < f32 > , O_hu : vec3 < f32 > , ) -> f32 { let O_ib = cross ( O_ht , O_hu ) ; let O_ic = dot ( O_ht , O_hu ) ; return O_id ( O_ib ) / O_ic ; } fn O_ie ( O_if : vec3 < f32 > , O_ig : vec3 < f32 > , O_co : f32 , ) -> vec3 < f32 > { let O_ih = cos ( O_co ) ; let O_ii = sin ( O_co ) ; let O_ij = 1.0 - O_ih ; return vec3 < f32 > ( ( O_ih + O_ij * O_ig . x * O_ig . x ) * O_if . x + ( O_ij * O_ig . x * O_ig . y - O_ig . z * O_ii ) * O_if . y + ( O_ij * O_ig . x * O_ig . z + O_ig . y * O_ii ) * O_if . z , ( O_ij * O_ig . x * O_ig . y + O_ig . z * O_ii ) * O_if . x + ( O_ih + O_ij * O_ig . y * O_ig . y ) * O_if . y + ( O_ij * O_ig . y * O_ig . z - O_ig . x * O_ii ) * O_if . z , ( O_ij * O_ig . x * O_ig . z - O_ig . y * O_ii ) * O_if . x + ( O_ij * O_ig . y * O_ig . z + O_ig . x * O_ii ) * O_if . y + ( O_ih + O_ij * O_ig . z * O_ig . z ) * O_if . z ) ; } fn O_ik ( radians : f32 , ) -> f32 { return radians * 180.0 / O_ao ; } fn O_il ( O_im : f32 , ) -> f32 { return O_im * O_ao / 180.0 ; } fn O_id ( O_cm : vec3 < f32 > , ) -> f32 { return length ( O_cm ) ; } fn O_in ( O_cm : vec3 < f32 > , ) -> f32 { return dot ( O_cm , O_cm ) ; } fn O_io ( O_cm : vec2 < f32 > , ) -> f32 { return dot ( O_cm , O_cm ) ; } fn O_ip ( O_cj : f32 , ) -> f32 { return O_cj * O_cj ; } fn O_iq ( O_cm : vec3 < f32 > , ) -> vec3 < f32 > { return O_cm * O_cm ; } fn O_ir ( O_cm : vec4 < f32 > , ) -> vec4 < f32 > { return O_cm * O_cm ; } fn O_is ( O_cm : vec3 < f32 > , ) -> f32 { return min ( min ( O_cm . x , O_cm . y ) , O_cm . z ) ; } fn O_it ( O_cm : vec4 < f32 > , ) -> f32 { return min ( min ( min ( O_cm . x , O_cm . y ) , O_cm . z ) , O_cm . w ) ; } fn O_iu ( O_cj : f32 , ) -> f32 { return select ( 0.0 , sqrt ( O_cj ) , O_cj > 0.0 ) ; } fn O_iv ( O_cm : vec3 < f32 > , ) -> vec3 < f32 > { let O_iw = O_id ( O_cm ) ; return select ( O_cm , O_cm / O_iw , O_iw > O_cu ) ; } fn O_ix ( O_cm : vec3 < f32 > , ) -> vec4 < f32 > { let O_iw = O_id ( O_cm ) ; let O_iy = select ( O_cm , O_cm / O_iw , O_iw > O_cu ) ; return vec4 < f32 > ( O_iy , O_iw ) ; } fn O_iz ( O_cj : f32 , ) -> f32 { return asin ( clamp ( O_cj , - 1.0 , 1.0 ) ) ; } fn O_ja ( O_ht : f32 , O_hu : f32 , ) -> f32 { return select ( 0.0 , O_ht / O_hu , abs ( O_hu ) > O_cu ) ; } fn O_jb ( O_ht : vec3 < f32 > , O_hu : f32 , ) -> vec3 < f32 > { return select ( vec3 < f32 > ( 0.0 ) , O_ht / O_hu , abs ( O_hu ) > O_cu ) ; } fn O_jc ( O_cj : f32 , O_jd : f32 , ) -> f32 { let O_je = select ( 1.0 , - 1.0 , O_jd < 0.0 ) ; return abs ( O_cj ) * O_je ; } fn O_jf ( O_if : vec2 < f32 > , ) -> vec3 < f32 > { let O_jg = dot ( O_if , O_if ) ; return vec3 < f32 > ( O_if . x , O_if . y , O_iu ( 1.0 - O_jg ) ) ; } fn O_jh ( O_if : vec3 < f32 > , O_ji : vec3 < f32 > , O_jj : vec3 < f32 > , O_jk : vec3 < f32 > , ) -> vec3 < f32 > { return O_if . x * O_ji + O_if . y * O_jj + O_if . z * O_jk ; } fn O_jl ( O_cj : f32 , ) -> f32 { return O_cj * O_cj ; } fn O_jm ( O_cj : f32 , ) -> f32 { return 1.0 / sqrt ( max ( O_cj , 1e-10 ) ) ; } fn O_jn ( O_cm : vec3 < f32 > , ) -> f32 { return ( O_cm . x + O_cm . y + O_cm . z ) / 3.0 ; } struct O_jo { O_jp : f32 , O_jq : f32 , O_jr : f32 , O_js : f32 , O_jt : f32 , O_ju : f32 , } fn O_jv ( O_jw : vec3 < f32 > , O_jx : O_jo , ) -> bool { return ( O_jw . x >= O_jx . O_jp && O_jw . x <= O_jx . O_js ) && ( O_jw . y >= O_jx . O_jq && O_jw . y <= O_jx . O_jt ) && ( O_jw . z >= O_jx . O_jr && O_jw . z <= O_jx . O_ju ) ; } fn O_jy ( O_jx : O_jo , ) -> vec3 < f32 > { let O_if = vec3 < f32 > ( O_jx . O_jp + O_jx . O_js , O_jx . O_jq + O_jx . O_jt , O_jx . O_jr + O_jx . O_ju ) ; return O_if / vec3 < f32 > ( 2.0 ) ; } fn O_jz ( O_gy : vec3 < f32 > , O_ka : f32 , ) -> O_jo { let O_kb = O_ka / 2.0 ; return O_jo ( O_gy . x - O_kb , O_gy . y - O_kb , O_gy . z - O_kb , O_gy . x + O_kb , O_gy . y + O_kb , O_gy . z + O_kb , ) ; } fn O_kc ( O_kd : O_jo , O_jw : vec3 < f32 > , ) -> vec3 < f32 > { let O_ke : f32 = 1e-5 ; if abs ( O_jw . x - O_kd . O_jp ) < O_ke { return vec3 < f32 > ( - 1.0 , 0.0 , 0.0 ) ; } if abs ( O_jw . x - O_kd . O_js ) < O_ke { return vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ; } if abs ( O_jw . y - O_kd . O_jq ) < O_ke { return vec3 < f32 > ( 0.0 , - 1.0 , 0.0 ) ; } if abs ( O_jw . y - O_kd . O_jt ) < O_ke { return vec3 < f32 > ( 0.0 , 1.0 , 0.0 ) ; } if abs ( O_jw . z - O_kd . O_jr ) < O_ke { return vec3 < f32 > ( 0.0 , 0.0 , - 1.0 ) ; } if abs ( O_jw . z - O_kd . O_ju ) < O_ke { return vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) ; } return vec3 < f32 > ( 0.0 , 0.0 , 0.0 ) ; } struct O_kf { O_jp : f32 , O_js : f32 , O_jq : f32 , O_jt : f32 , } fn O_kg ( O_kd : O_kf , O_kh : f32 , ) -> O_kf { return O_kf ( ( O_kd . O_jp + O_kh ) , ( O_kd . O_js - O_kh ) , ( O_kd . O_jq + O_kh ) , ( O_kd . O_jt - O_kh ) ) ; } fn O_ki ( O_kd : O_kf , O_jw : vec2 < f32 > , ) -> bool { let O_kj = O_jw . x >= O_kd . O_jp && O_jw . x <= O_kd . O_js ; let O_kk = O_jw . y >= O_kd . O_jq && O_jw . y <= O_kd . O_jt ; return O_kj && O_kk ; } fn O_kl ( O_km : O_kf , O_kn : O_kf , ) -> bool { let O_ko = O_km . O_jp <= O_kn . O_js && O_km . O_js >= O_kn . O_jp ; let O_kp = O_km . O_jq <= O_kn . O_jt && O_km . O_jt >= O_kn . O_jq ; return O_ko && O_kp ; } struct O_ey { O_gy : vec3 < f32 > , O_kq : vec3 < f32 > , O_kr : vec3 < f32 > , O_ks : vec3 < f32 > , O_gz : vec3 < f32 > , O_kt : f32 , O_ku : f32 , O_kv : f32 , O_kw : f32 , O_kx : vec3 < f32 > , } struct O_fv { O_ky : f32 , O_kz : f32 , O_la : f32 , O_lb : f32 , O_lc : f32 , O_ld : f32 , O_le : f32 , } struct O_eu { O_bb : vec3f , O_gy : vec3f , O_bq : vec3f , O_lf : f32 , O_lg : f32 , O_lh : f32 , } struct O_li { O_hd : f32 , O_bq : vec3 < f32 > , O_lf : O_fq , O_hc : i32 , } fn O_lj ( ) -> O_li { return O_li ( - 1 , O_lk ( ) , O_ll ( ) , - 1 ) ; } struct O_fy { O_jp : f32 , O_js : f32 , O_jq : f32 , O_jt : f32 , O_lm : f32 , O_ln : f32 , } struct O_lo { O_jp : f32 , O_jq : f32 , O_jr : f32 , O_js : f32 , O_jt : f32 , O_ju : f32 , O_lm : f32 , O_ln : f32 , } struct O_fq { O_b : vec3 < f32 > , O_d : f32 , O_c : f32 , O_e : f32 , O_hg : f32 , O_lp : f32 , O_lq : f32 , O_lr : f32 , O_ls : f32 , O_lt : vec3 < f32 > , O_lu : f32 , O_lv : f32 , O_lw : f32 , O_lx : f32 , O_ly : f32 , O_lz : f32 , O_ma : f32 , O_mb : f32 , O_mc : f32 , } fn O_ll ( ) -> O_fq { return O_fq ( vec3f ( 0 ) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , vec3f ( 0 ) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) ; } fn O_md ( O_bn : f32 , O_me : f32 , O_hu : f32 , ) -> O_fq { return O_fq ( vec3f ( O_bn , O_me , O_hu ) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , vec3f ( 0 ) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) ; } struct O_mf { O_mg : vec3f , O_mh : vec3f , O_mi : vec3f , } struct O_mj { O_hd : u32 , O_mk : O_mf , } fn O_ml ( O_mk : O_mf , ) -> vec3f { return cross ( O_mk . O_mh , O_mk . O_mi ) ; } fn O_mm ( O_jw : vec3f , O_mk : O_mf , O_ke : f32 , ) -> bool { let O_bq = O_ml ( O_mk ) ; let O_mn = dot ( O_bq , O_jw - O_mk . O_mg ) ; return abs ( O_mn ) <= O_ke ; } fn O_mo ( O_mp : O_mf , O_mq : O_mf , O_ke : f32 , ) -> bool { let O_lc = O_ml ( O_mp ) ; let O_ld = O_ml ( O_mq ) ; let O_mr = length ( O_lc ) ; let O_ms = length ( O_ld ) ; if ( O_mr < O_ke || O_ms < O_ke ) { return false ; } let O_mt = normalize ( O_lc ) ; let O_mu = normalize ( O_ld ) ; let O_mv = dot ( O_mt , O_mu ) ; if ( abs ( O_mv ) < 1.0 - O_ke ) { return false ; } return O_mm ( O_mq . O_mg , O_mp , O_ke ) ; } fn O_mw ( O_mp : O_mf , O_mq : O_mf , ) -> O_mf { let O_mx = O_mp . O_mg ; let O_my = O_mp . O_mg + O_mp . O_mh ; let O_mz = O_mp . O_mg + O_mp . O_mi ; let O_na = O_mp . O_mg + O_mp . O_mh + O_mp . O_mi ; let O_nb = O_mq . O_mg ; let O_nc = O_mq . O_mg + O_mq . O_mh ; let O_nd = O_mq . O_mg + O_mq . O_mi ; let O_ne = O_mq . O_mg + O_mq . O_mh + O_mq . O_mi ; let O_ml = normalize ( O_ml ( O_mp ) ) ; var O_nf = vec3f ( 1.0 , 0.0 , 0.0 ) ; if ( abs ( dot ( O_ml , O_nf ) ) > 0.9 ) { O_nf = vec3f ( 0.0 , 1.0 , 0.0 ) ; } let O_ng = normalize ( cross ( O_ml , O_nf ) ) ; let O_nh = cross ( O_ml , O_ng ) ; let O_ni = array < vec2f , 4 > ( O_nj ( O_mx , O_mp . O_mg , O_ng , O_nh ) , O_nj ( O_my , O_mp . O_mg , O_ng , O_nh ) , O_nj ( O_mz , O_mp . O_mg , O_ng , O_nh ) , O_nj ( O_na , O_mp . O_mg , O_ng , O_nh ) ) ; let O_nk = array < vec2f , 4 > ( O_nj ( O_nb , O_mp . O_mg , O_ng , O_nh ) , O_nj ( O_nc , O_mp . O_mg , O_ng , O_nh ) , O_nj ( O_nd , O_mp . O_mg , O_ng , O_nh ) , O_nj ( O_ne , O_mp . O_mg , O_ng , O_nh ) ) ; let O_nl = O_nm ( O_ni ) ; let O_nn = O_nm ( O_nk ) ; let O_no = max ( O_nl . x , O_nn . x ) ; let O_np = max ( O_nl . y , O_nn . y ) ; let O_nq = min ( O_nl . z , O_nn . z ) ; let O_nr = min ( O_nl . w , O_nn . w ) ; if ( O_no >= O_nq || O_np >= O_nr ) { return O_mf ( O_mp . O_mg , vec3f ( 0.0 ) , vec3f ( 0.0 ) ) ; } let O_ns = vec2f ( O_no , O_np ) ; let O_nt = vec2f ( O_nq - O_no , O_nr - O_np ) ; let O_nu = O_mp . O_mg + O_ns . x * O_ng + O_ns . y * O_nh ; let O_nv = O_nt . x * O_ng ; let O_nw = O_nt . y * O_nh ; return O_mf ( O_nu , O_nv , O_nw ) ; } fn O_nx ( O_mp : O_mf , O_mq : O_mf , O_ke : f32 , ) -> O_mj { if ( ! O_mo ( O_mp , O_mq , O_ke ) ) { return O_mj ( O_er , O_mp ) ; } let O_ny = O_mw ( O_mp , O_mq ) ; return O_mj ( O_es , O_ny ) ; } fn O_nj ( O_jw : vec3f , O_nz : vec3f , O_ng : vec3f , O_nh : vec3f , ) -> vec2f { let O_oa = O_jw - O_nz ; return vec2f ( dot ( O_oa , O_ng ) , dot ( O_oa , O_nh ) ) ; } fn O_nm ( O_ob : array < vec2f , 4 > , ) -> vec4f { var O_oc = O_ob [ 0 ] ; var O_od = O_ob [ 0 ] ; for ( var O_oe = 1 ; O_oe < 4 ; O_oe ++ ) { O_oc = min ( O_oc , O_ob [ O_oe ] ) ; O_od = max ( O_od , O_ob [ O_oe ] ) ; } return vec4f ( O_oc . x , O_oc . y , O_od . x , O_od . y ) ; } struct O_of { O_gj : f32 , O_og : f32 , O_oh : f32 , O_oi : f32 , O_oj : f32 , O_ok : f32 , O_ol : f32 , O_om : f32 , O_on : f32 , O_oo : f32 , O_op : f32 , O_oq : f32 , } struct O_ew { O_gj : f32 , O_gr : f32 , O_oi : f32 , O_oj : f32 , O_ok : f32 , O_ol : f32 , O_om : f32 , O_on : f32 , O_oo : f32 , O_op : f32 , O_oq : f32 , O_or : f32 , O_os : vec3f , O_ot : f32 , O_ou : f32 , } struct O_gc { O_ov : O_ow , O_ox : O_ow , } struct O_ow { O_jw : vec3 < f32 > , O_bq : vec3 < f32 > , } struct O_fs { O_nz : vec3 < f32 > , O_oy : vec3 < f32 > , } fn O_oz ( ) -> O_fs { return O_fs ( vec3 < f32 > ( 0 ) , vec3 < f32 > ( 0 ) ) ; } fn O_pa ( O_gt : O_fs , O_hd : f32 , ) -> vec3 < f32 > { return O_gt . O_nz + O_hd * O_gt . O_oy ; } struct O_pb { O_hd : f32 , O_bq : vec3 < f32 > , } fn O_pc ( O_gt : O_fs , O_kd : O_jo , ) -> O_pb { let O_pd = vec3 < f32 > ( O_kd . O_jp , O_kd . O_jq , O_kd . O_jr ) ; let O_pe = vec3 < f32 > ( O_kd . O_js , O_kd . O_jt , O_kd . O_ju ) ; let O_pf = 1.0 / O_gt . O_oy ; let sign = vec3 < u32 > ( u32 ( O_pf . x < 0.0 ) , u32 ( O_pf . y < 0.0 ) , u32 ( O_pf . z < 0.0 ) ) ; var O_pg = array < vec3 < f32 > , 2 > ( O_pd , O_pe ) ; var O_ph = ( O_pg [ sign . x ] . x - O_gt . O_nz . x ) * O_pf . x ; var O_pi = ( O_pg [ 1 - sign . x ] . x - O_gt . O_nz . x ) * O_pf . x ; var O_pj = ( O_pg [ sign . y ] . y - O_gt . O_nz . y ) * O_pf . y ; var O_pk = ( O_pg [ 1 - sign . y ] . y - O_gt . O_nz . y ) * O_pf . y ; if ( O_ph > O_pk ) || ( O_pj > O_pi ) { return O_pb ( - 1.0 , vec3 < f32 > ( 0.0 ) ) ; } O_ph = max ( O_ph , O_pj ) ; O_pi = min ( O_pi , O_pk ) ; let O_pl = ( O_pg [ sign . z ] . z - O_gt . O_nz . z ) * O_pf . z ; let O_pm = ( O_pg [ 1 - sign . z ] . z - O_gt . O_nz . z ) * O_pf . z ; if ( O_ph > O_pm ) || ( O_pl > O_pi ) { return O_pb ( - 1.0 , vec3 < f32 > ( 0.0 ) ) ; } O_ph = max ( O_ph , O_pl ) ; O_pi = min ( O_pi , O_pm ) ; if ( O_ph < 0.0 ) { return O_pb ( - 1.0 , vec3 < f32 > ( 0.0 ) ) ; } var O_bq = vec3 < f32 > ( 0.0 ) ; let O_jw = O_gt . O_nz + O_ph * O_gt . O_oy ; let O_pn = 0.001 ; if ( abs ( O_jw . x - O_pd . x ) < O_pn ) { O_bq = vec3 < f32 > ( - 1.0 , 0.0 , 0.0 ) ; } else if ( abs ( O_jw . x - O_pe . x ) < O_pn ) { O_bq = vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ; } else if ( abs ( O_jw . y - O_pd . y ) < O_pn ) { O_bq = vec3 < f32 > ( 0.0 , - 1.0 , 0.0 ) ; } else if ( abs ( O_jw . y - O_pe . y ) < O_pn ) { O_bq = vec3 < f32 > ( 0.0 , 1.0 , 0.0 ) ; } else if ( abs ( O_jw . z - O_pd . z ) < O_pn ) { O_bq = vec3 < f32 > ( 0.0 , 0.0 , - 1.0 ) ; } else if ( abs ( O_jw . z - O_pe . z ) < O_pn ) { O_bq = vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) ; } return O_pb ( O_ph , O_bq ) ; } fn O_cc ( O_po : vec3 < f32 > , O_bq : vec3 < f32 > , ) -> vec3 < f32 > { let O_pp = dot ( O_po , O_bq ) ; return normalize ( O_po - 2.0 * O_pp * O_bq ) ; } fn O_pq ( O_gt : O_fs , O_jx : O_jo , ) -> f32 { if O_jv ( O_gt . O_nz , O_jx ) { return 0.0 ; } var O_pr : f32 = ( O_jx . O_jp - O_gt . O_nz . x ) / O_gt . O_oy . x ; var O_ps : f32 = ( O_jx . O_js - O_gt . O_nz . x ) / O_gt . O_oy . x ; if O_pr > O_ps { let O_pt = O_pr ; O_pr = O_ps ; O_ps = O_pt ; } var O_pu : f32 = ( O_jx . O_jq - O_gt . O_nz . y ) / O_gt . O_oy . y ; var O_pv : f32 = ( O_jx . O_jt - O_gt . O_nz . y ) / O_gt . O_oy . y ; if O_pu > O_pv { let O_pt = O_pu ; O_pu = O_pv ; O_pv = O_pt ; } if ( O_pr > O_pv ) || ( O_pu > O_ps ) { return - 1.0 ; } if O_pu > O_pr { O_pr = O_pu ; } if O_pv < O_ps { O_ps = O_pv ; } var O_pw : f32 = ( O_jx . O_jr - O_gt . O_nz . z ) / O_gt . O_oy . z ; var O_px : f32 = ( O_jx . O_ju - O_gt . O_nz . z ) / O_gt . O_oy . z ; if O_pw > O_px { let O_pt = O_pw ; O_pw = O_px ; O_px = O_pt ; } if ( O_pr > O_px ) || ( O_pw > O_ps ) { return - 1.0 ; } if O_pw > O_pr { O_pr = O_pw ; } if O_px < O_ps { O_ps = O_px ; } if O_pr < 0.0 { if O_ps < 0.0 { return - 1.0 ; } return O_ps ; } return O_pr ; } fn O_py ( O_gt : O_fs , O_pz : vec3 < f32 > , O_mx : vec3 < f32 > , O_my : vec3 < f32 > , O_mz : vec3 < f32 > , ) -> bool { let O_qa = O_qb ( O_pz , O_mx , O_my ) ; let O_qc = O_qb ( O_mx , O_my , O_mz ) ; return O_qd ( O_gt , O_qa ) > 0.0 || O_qd ( O_gt , O_qc ) > 0.0 ; } fn O_qd ( O_gt : O_fs , O_qe : O_qb , ) -> f32 { let O_ke = 0.00000001 ; let O_qf = O_qe . O_kz - O_qe . O_ky ; let O_qg = O_qe . O_la - O_qe . O_ky ; let O_qh = cross ( O_gt . O_oy , O_qg ) ; let O_ht = dot ( O_qf , O_qh ) ; if O_ht > - O_ke && O_ht < O_ke { return - 1.0 ; } let O_qi = 1.0 / O_ht ; let O_qj = O_gt . O_nz - O_qe . O_ky ; let O_cn = O_qi * dot ( O_qj , O_qh ) ; if O_cn < 0.0 || O_cn > 1.0 { return - 1.0 ; } let O_qk = cross ( O_qj , O_qf ) ; let O_cm = O_qi * dot ( O_gt . O_oy , O_qk ) ; if O_cm < 0.0 || O_cn + O_cm > 1.0 { return - 1.0 ; } let O_hd = O_qi * dot ( O_qg , O_qk ) ; if O_hd > O_ke { return O_hd ; } else { return - 1.0 ; } } fn O_ql ( O_gt : O_fs , O_qm : O_qn , ) -> f32 { let O_qo = O_gt . O_nz - O_qm . O_qp ; let O_ht = dot ( O_gt . O_oy , O_gt . O_oy ) ; let O_hu = 2.0 * dot ( O_qo , O_gt . O_oy ) ; let O_qq = dot ( O_qo , O_qo ) - O_qm . O_qr * O_qm . O_qr ; let O_qs = O_hu * O_hu - 4.0 * O_ht * O_qq ; if O_qs < 0.0 { return - 1.0 ; } else { return ( - O_hu - sqrt ( O_qs ) ) / ( 2.0 * O_ht ) ; } } struct O_qt { O_hd : bool , O_jw : vec3 < f32 > , } fn O_qu ( O_gt : O_fs , O_qv : O_ow , ) -> O_qt { let O_hd = O_qw ( O_gt , O_qv ) ; if O_hd < 0.0 { return O_qt ( false , vec3 < f32 > ( 0 ) ) ; } let O_qx = O_gt . O_nz + O_hd * O_gt . O_oy ; return O_qt ( true , O_qx ) ; } struct O_qy { O_hd : f32 , O_jw : vec3 < f32 > , } fn O_qz ( O_gt : O_fs , O_qv : O_ow , ) -> O_qy { let O_hd = O_qw ( O_gt , O_qv ) ; if O_hd < 0.0 { return O_qy ( - 1 , vec3 < f32 > ( 0 ) ) ; } let O_qx = O_gt . O_nz + O_hd * O_gt . O_oy ; return O_qy ( O_hd , O_qx ) ; } fn O_qw ( O_gt : O_fs , O_qv : O_ow , ) -> f32 { let O_jw = O_qv . O_jw ; let O_bq = O_qv . O_bq ; let O_am = dot ( O_gt . O_oy , O_bq ) ; if ( O_ra ( O_gt . O_oy , O_qv . O_bq ) ) { return - 1.0 ; } let O_rb = O_jw - O_gt . O_nz ; let O_hd = dot ( O_rb , O_bq ) / O_am ; return O_hd ; } struct O_rc { O_rd : vec3 < f32 > , O_re : vec3 < f32 > , } fn O_rf ( O_rg : O_rc , O_kd : O_jo , ) -> bool { var O_ph : f32 = 0.0 ; var O_pi : f32 = 1.0 ; let O_iy : vec3 < f32 > = O_rg . O_re - O_rg . O_rd ; for ( var O_oe : i32 = 0 ; O_oe < 3 ; O_oe = O_oe + 1 ) { let O_rh : f32 = 1.0 / O_iy [ O_oe ] ; var O_qa : f32 ; var O_qc : f32 ; if O_oe == 0 { O_qa = ( O_kd . O_jp - O_rg . O_rd . x ) * O_rh ; O_qc = ( O_kd . O_js - O_rg . O_rd . x ) * O_rh ; } else if O_oe == 1 { O_qa = ( O_kd . O_jq - O_rg . O_rd . y ) * O_rh ; O_qc = ( O_kd . O_jt - O_rg . O_rd . y ) * O_rh ; } else { O_qa = ( O_kd . O_jr - O_rg . O_rd . z ) * O_rh ; O_qc = ( O_kd . O_ju - O_rg . O_rd . z ) * O_rh ; } if O_rh < 0.0 { let O_pt : f32 = O_qa ; O_qa = O_qc ; O_qc = O_pt ; } O_ph = max ( O_ph , O_qa ) ; O_pi = min ( O_pi , O_qc ) ; if O_pi <= O_ph { return false ; } } return true ; } struct O_qn { O_qp : vec3 < f32 > , O_qr : f32 , } fn O_ri ( O_qm : O_qn , O_jw : vec3 < f32 > , ) -> vec3 < f32 > { return normalize ( O_jw - O_qm . O_qp ) ; } fn O_rj ( O_po : vec3 < f32 > , O_bq : vec3 < f32 > , ) -> vec3 < f32 > { return O_po - 2.0 * dot ( O_po , O_bq ) * O_bq ; } struct O_qb { O_ky : vec3 < f32 > , O_kz : vec3 < f32 > , O_la : vec3 < f32 > , } ; fn O_rk ( ) -> O_qb { return O_qb ( vec3 < f32 > ( 0 ) , vec3 < f32 > ( 0 ) , vec3 < f32 > ( 0 ) ) ; } fn O_rl ( O_qe : O_qb , ) -> vec3 < f32 > { return normalize ( O_qe . O_ky - O_qe . O_kz ) ; } fn O_rm ( O_if : vec3 < f32 > , O_ht : vec3 < f32 > , O_hu : vec3 < f32 > , O_qq : vec3 < f32 > , ) -> bool { let O_ky = O_qq - O_ht ; let O_kz = O_hu - O_ht ; let O_la = O_if - O_ht ; let O_rn = dot ( O_ky , O_ky ) ; let O_ro = dot ( O_ky , O_kz ) ; let O_rp = dot ( O_ky , O_la ) ; let O_rq = dot ( O_kz , O_kz ) ; let O_rr = dot ( O_kz , O_la ) ; let O_rs = 1.0 / ( O_rn * O_rq - O_ro * O_ro ) ; let O_cn = ( O_rq * O_rp - O_ro * O_rr ) * O_rs ; let O_cm = ( O_rn * O_rr - O_ro * O_rp ) * O_rs ; return ( O_cn >= 0.0 ) && ( O_cm >= 0.0 ) && ( O_cn + O_cm < 1.0 ) ; } fn O_rt ( O_rg : O_rc , O_qe : O_qb , ) -> bool { let O_pz = O_rg . O_rd ; let O_mx = O_rg . O_re ; let O_ht : vec3 < f32 > = O_qe . O_ky ; let O_hu : vec3 < f32 > = O_qe . O_kz ; let O_qq : vec3 < f32 > = O_qe . O_la ; let O_ru = O_hu - O_ht ; let O_rv = O_qq - O_ht ; let O_bu = cross ( O_ru , O_rv ) ; let O_rw = dot ( O_bu , O_ht ) ; let O_hd = ( O_rw - dot ( O_bu , O_pz ) ) / dot ( O_bu , O_mx - O_pz ) ; if O_hd < 0.0 || O_hd > 1.0 { return false ; } let O_if = O_pz + O_hd * ( O_mx - O_pz ) ; return O_rm ( O_if , O_ht , O_hu , O_qq ) ; } fn O_rx ( O_if : vec3 < f32 > , O_ht : vec3 < f32 > , O_hu : vec3 < f32 > , O_qq : vec3 < f32 > , ) -> vec3 < f32 > { let O_ky = O_hu - O_ht ; let O_kz = O_qq - O_ht ; let O_la = O_if - O_ht ; let O_ry = dot ( O_ky , O_ky ) ; let O_rz = dot ( O_ky , O_kz ) ; let O_sa = dot ( O_kz , O_kz ) ; let O_sb = dot ( O_la , O_ky ) ; let O_sc = dot ( O_la , O_kz ) ; let O_am = O_ry * O_sa - O_rz * O_rz ; let O_cm = ( O_sa * O_sb - O_rz * O_sc ) / O_am ; let O_sd = ( O_ry * O_sc - O_rz * O_sb ) / O_am ; let O_cn = 1.0 - O_cm - O_sd ; return vec3 < f32 > ( O_cn , O_cm , O_sd ) ; } fn O_se ( O_qe : O_qb , O_bq : array < vec3 < f32 > , 3 > , O_sf : vec3 < f32 > , ) -> vec3 < f32 > { let O_sg = O_rx ( O_sf , O_qe . O_ky , O_qe . O_kz , O_qe . O_la ) ; return normalize ( O_sg . x * O_bq [ 0 ] + O_sg . y * O_bq [ 1 ] + O_sg . z * O_bq [ 2 ] ) ; } fn O_lk ( ) -> vec3 < f32 > { return vec3 < f32 > ( 0 , 0 , 0 ) ; } fn O_ra ( O_sh : vec3 < f32 > , O_la : vec3 < f32 > , ) -> bool { let O_pp = dot ( O_sh , O_la ) ; let O_si = length ( O_sh ) ; let O_sj = length ( O_la ) ; return ( O_si > 0.0 ) && ( O_sj > 0.0 ) && ( O_pp >= 0.0 ) ; } fn O_sk ( O_ht : vec3 < f32 > , O_hu : vec3 < f32 > , ) -> f32 { let O_pp = dot ( O_ht , O_hu ) ; let O_sl = length ( O_ht ) * length ( O_hu ) ; return O_pp / O_sl ; } fn O_sm ( O_ht : vec3 < f32 > , O_hu : vec3 < f32 > , ) -> bool { let O_oa = 1.0 / 255.0 ; return abs ( O_ht . x - O_hu . x ) < O_oa && abs ( O_ht . y - O_hu . y ) < O_oa && abs ( O_ht . z - O_hu . z ) < O_oa ; } fn O_sn ( O_bu : vec3f , O_cm : vec3f , ) -> f32 { let O_hp = max ( dot ( normalize ( O_bu ) , normalize ( O_cm ) ) , 0.0 ) ; return O_hp ; } fn O_so ( O_bu : vec3f , O_cm : vec3f , ) -> f32 { let dot = O_sn ( O_bu , O_cm ) ; return acos ( dot ) ; } struct O_fa { O_sp : f32 , O_sq : f32 , O_sr : f32 , O_ss : f32 , O_st : f32 , O_su : f32 , O_sv : f32 , } struct O_fc { O_sw : f32 , O_sx : f32 , O_sy : f32 , O_sz : f32 , O_ta : f32 , } struct O_fe { O_qv : f32 , O_sx : f32 , O_ka : f32 , O_tb : f32 , O_tc : f32 , O_td : f32 , O_te : f32 , O_tf : f32 , O_tg : f32 , O_th : f32 , } struct O_bf { O_i : vec3f , O_bj : vec3f , } fn O_ti ( O_tj : vec3 < f32 > , ) -> vec3 < f32 > { var O_tk : vec3 < f32 > = O_tj ; if ( O_tk . x != O_tk . x ) { O_tk . x = 0 ; } if ( O_tk . y != O_tk . y ) { O_tk . y = 0 ; } if ( O_tk . z != O_tk . z ) { O_tk . z = 0 ; } return O_tk ; } fn O_gu ( ) -> O_fs { O_bl ( ) ; O_bl ( ) ; return O_fr [ O_gi ] ; } fn O_tl ( O_if : vec3 < f32 > , O_ht : vec3 < f32 > , O_hu : vec3 < f32 > , O_qq : vec3 < f32 > , ) -> vec3 < f32 > { let O_ky = O_hu - O_ht ; let O_kz = O_qq - O_ht ; let O_la = O_if - O_ht ; let O_ry = dot ( O_ky , O_ky ) ; let O_rz = dot ( O_ky , O_kz ) ; let O_sa = dot ( O_kz , O_kz ) ; let O_sb = dot ( O_la , O_ky ) ; let O_sc = dot ( O_la , O_kz ) ; let O_am = O_ry * O_sa - O_rz * O_rz ; let O_cm = ( O_sa * O_sb - O_rz * O_sc ) / O_am ; let O_sd = ( O_ry * O_sc - O_rz * O_sb ) / O_am ; let O_cn = 1.0 - O_cm - O_sd ; return vec3 < f32 > ( O_cn , O_cm , O_sd ) ; } fn O_tm ( O_qe : O_qb , O_bq : array < vec3 < f32 > , 3 > , O_sf : vec3 < f32 > , ) -> vec3 < f32 > { let O_sg = O_tl ( O_sf , O_qe . O_ky , O_qe . O_kz , O_qe . O_la ) ; return normalize ( O_sg . x * O_bq [ 0 ] + O_sg . y * O_bq [ 1 ] + O_sg . z * O_bq [ 2 ] ) ; } fn O_hf ( O_tk : vec3 < f32 > , ) { if ( O_gk ) { return ; } O_et [ O_gi ] . O_bb = O_ti ( O_tk ) ; O_gk = true ; } fn O_gx ( O_gv : O_tn , O_gt : O_fs , ) { O_hf ( O_gv . O_tk ) ; O_et [ O_gi ] . O_lh = f32 ( O_gv . O_bb ) ; O_et [ O_gi ] . O_bq = O_gv . O_by ; O_et [ O_gi ] . O_gy = O_gv . O_gy ; O_et [ O_gi ] . O_lf = f32 ( O_gv . O_hc ) ; O_et [ O_gi ] . O_lg = length ( O_gv . O_gy - O_gt . O_nz ) ; } fn O_to ( O_tp : vec3 < f32 > , ) { var O_bq = normalize ( O_tp ) ; O_bq = O_bq + vec3 < f32 > ( 1.0 ) ; O_bq = O_bq * 0.5 ; O_hf ( O_bq ) ; } fn O_tq ( ) { O_hf ( vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ) ; } fn O_tr ( ) { O_hf ( vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) ) ; } fn O_ts ( O_tt : u32 , O_tu : u32 , ) { let O_tv = f32 ( O_tt ) / f32 ( O_tu ) ; O_hf ( vec3 < f32 > ( O_tv , O_tv , O_tv ) ) ; } fn O_tw ( O_tk : u32 , ) { let O_qi = 1.0 / f32 ( O_tk + 1 ) ; O_hf ( vec3 < f32 > ( O_qi , O_qi , O_qi ) ) ; } fn O_tx ( O_tk : vec3 < f32 > , ) -> bool { return O_tk . x > 0.0 && O_tk . y > 0.0 && O_tk . z > 0.0 ; } fn O_ty ( O_tj : vec3 < f32 > , ) -> vec3 < f32 > { var O_tk : vec3 < f32 > = O_tj ; let O_tz : f32 = 1.0 / 2.2 ; O_tk . x = pow ( O_tk . x , O_tz ) ; O_tk . y = pow ( O_tk . y , O_tz ) ; O_tk . z = pow ( O_tk . z , O_tz ) ; return O_tk ; } fn O_gp ( ) { let O_ua = O_ev . O_gj ; O_gj = O_ua * ( f32 ( O_gi ) / f32 ( Image_Width * Image_Height ) ) ; O_gj = O_ub ( O_gj ) ; } fn O_bl ( ) -> f32 { let O_uc = O_ud ( O_gj ) ; O_gj = O_uc ; return O_uc ; } fn O_ue ( O_ua : f32 , ) -> f32 { var O_uf = u32 ( O_ua * 1e6 ) ; O_uf ^= O_uf << 13 ; O_uf ^= O_uf >> 17 ; O_uf ^= O_uf << 5 ; return f32 ( O_uf ) * 2.3283064e-10 ; } fn O_ug ( O_ua : f32 , ) -> f32 { var O_ky = u32 ( O_ua * 1e6 ) ; var O_kz = u32 ( O_ua * 1e6 + 1.0 ) ; var O_uh = 0u ; for ( var O_oe = 0u ; O_oe < 4u ; O_oe ++ ) { O_uh += 0x9e3779b9u ; O_ky += ( ( O_kz << 4u ) + 0xa341316cu ) ^ ( O_kz + O_uh ) ^ ( ( O_kz >> 5u ) + 0xc8013ea4u ) ; O_kz += ( ( O_ky << 4u ) + 0xad90777du ) ^ ( O_ky + O_uh ) ^ ( ( O_ky >> 5u ) + 0x7e95761eu ) ; } return f32 ( O_ky ^ O_kz ) / 4294967296.0 ; } fn O_ui ( O_ua : f32 , ) -> f32 { var O_uf = u32 ( O_ua * 1e6 ) ; O_uf = O_uf * 0x53a2f814u + 0x74736975u ; O_uf = ( O_uf ^ ( O_uf >> 16 ) ) * 0x7feb352du ; O_uf = ( O_uf ^ ( O_uf >> 15 ) ) * 0x846ca68bu ; return f32 ( O_uf ^ ( O_uf >> 16 ) ) / 4294967296.0 ; } fn O_ud ( O_ua : f32 , ) -> f32 { let O_ht : f32 = 1664525.0 ; let O_qq : f32 = 1013904223.0 ; let O_le : f32 = 4294967296.0 ; return fract ( ( O_ht * O_ua * 100000.0 + O_qq ) / O_le ) ; } fn O_uj ( O_ua : f32 , ) -> f32 { var O_uf = u32 ( O_ua * 1e6 ) ; O_uf = O_uf * 747796405u + 2891336453u ; let O_uk = ( ( O_uf >> ( ( O_uf >> 28u ) + 4u ) ) ^ O_uf ) * 277803737u ; return f32 ( ( O_uk >> 22u ) ^ O_uk ) / 4294967296.0 ; } fn O_ub ( O_ua : f32 , ) -> f32 { return fract ( sin ( O_ua * 43758.5453 ) * 12345.6789 ) ; } fn O_ul ( ) -> f32 { return 2.0 * O_bl ( ) - 1.0 ; } fn O_cp ( ) -> f32 { return O_ul ( ) * O_ao ; } fn O_ck ( min : f32 , max : f32 , ) -> f32 { return min + ( max - min ) * O_bl ( ) ; } fn O_um ( ) -> vec3 < f32 > { while ( true ) { let O_iy = normalize ( vec3 < f32 > ( O_un ( ) , O_un ( ) , O_un ( ) ) ) ; if ( length ( O_iy ) != 0 ) { return O_iy ; } } return vec3 < f32 > ( 0 ) ; } fn O_un ( ) -> f32 { return sqrt ( - 2 * log ( O_bl ( ) ) ) * cos ( 2 * O_ao * O_bl ( ) ) ; } fn O_gw ( O_gt : O_fs , ) -> O_tn { var O_uo = O_up ( O_gt , true , true , O_gd . O_uq == 1.0 ) ; if ( O_uo . O_bb != O_el ) { return O_uo ; } O_uo . O_tk = O_ur ( O_uo ) ; var O_h = O_gt . O_oy ; var O_bj = vec3f ( 1 ) ; var O_gv = O_uo ; for ( var O_oe = 0 ; O_oe < i32 ( O_ev . O_oi ) ; O_oe += 1 ) { var O_bg : O_us = O_ut ( O_gv . O_b , O_gv . O_c , O_gv . O_d , O_gv . O_e , O_gv . O_hg , O_gv . O_bz , - O_gv . O_bw , vec3f ( O_bl ( ) , O_bl ( ) , O_bl ( ) ) ) ; O_h = O_bg . O_i ; O_bj *= ( O_bg . O_qi / O_bg . O_uu ) ; O_gv = O_up ( O_fs ( O_gv . O_gy + 0.001 * O_h , O_h ) , false , false , false ) ; if ( O_gv . O_bb != O_el ) { O_uo . O_tk += O_gv . O_tk * O_bj ; return O_uo ; } O_uo . O_tk += O_ur ( O_gv ) * O_bj ; } return O_uo ; } fn O_ut ( O_b : vec3 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec3 < f32 > , O_j : vec3 < f32 > , O_hs : vec3 < f32 > , ) -> O_us { let O_uv = O_o ( vec3 < f32 > ( 1.0 ) , O_d , O_e , O_f ) ; let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; let O_p = O_q ( O_uv , O_m ) ; let O_uw = O_jn ( O_p ) * O_d + ( 1.0 - O_d ) * O_f ; let O_ux = 1.0 - O_uw ; if ( O_uw < 1e-5 ) { let O_uy = O_uz ( O_g , O_hs . xy ) ; let O_r = ( 1.0 - O_jn ( O_p ) ) * ( 1.0 - O_d ) ; let O_va = O_b * O_r * O_t ; return O_us ( O_uy . O_i , O_uy . O_uu , O_va ) ; } if ( O_ux < 1e-5 ) { return O_vb ( O_b , O_c , O_d , O_e , O_f , O_g , O_j , O_hs ) ; } if ( O_hs . z < O_uw ) { let O_vc = O_vb ( O_b , O_c , O_d , O_e , O_f , O_g , O_j , O_hs ) ; if ( O_vc . O_uu > 0.0 ) { let O_i = O_vc . O_i ; if ( O_c < 1e-5 ) { let O_n = O_o ( O_b , O_d , O_e , O_f ) ; let O_vd = max ( dot ( O_g , O_i ) , 0.0 ) ; let O_p = O_q ( O_n , O_vd ) ; let O_ve = O_uw ; let O_vf = O_p * O_ve ; return O_us ( O_i , O_ve , O_vf ) ; } let O_vd = max ( dot ( O_g , O_i ) , 0.0 ) ; let O_vg = O_vd * O_t ; let O_vh = O_uw * O_vc . O_uu + O_ux * O_vg ; let O_vi = O_a ( O_b , O_c , O_d , O_e , O_f , O_g , O_i , O_j ) ; return O_us ( O_i , O_vh , O_vi ) ; } } let O_uy = O_uz ( O_g , O_hs . xy ) ; let O_i = O_uy . O_i ; let O_av = normalize ( O_j + O_i ) ; let O_ah = max ( dot ( O_g , O_av ) , 0.0 ) ; let O_aw = max ( dot ( O_j , O_av ) , 0.0 ) ; let O_ax = O_ag ( O_ah , O_c ) ; let O_vj = O_ax * O_ah / max ( 4.0 * O_aw , 1e-10 ) ; let O_vh = O_uw * O_vj + O_ux * O_uy . O_uu ; let O_vi = O_a ( O_b , O_c , O_d , O_e , O_f , O_g , O_i , O_j ) ; return O_us ( O_i , O_vh , O_vi ) ; } fn O_vb ( O_b : vec3 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec3 < f32 > , O_j : vec3 < f32 > , O_hs : vec3 < f32 > , ) -> O_us { if ( O_d < 1e-5 && O_f < 1e-5 ) { return O_us ( vec3 < f32 > ( 0.0 ) , 0.0 , vec3 < f32 > ( 0.0 ) ) ; } if ( O_c < 1e-5 ) { let O_vk = normalize ( O_j ) ; let O_m = max ( dot ( O_g , O_vk ) , 0.0 ) ; if ( O_m <= 0.0 ) { return O_us ( vec3 < f32 > ( 0.0 ) , 0.0 , vec3 < f32 > ( 0.0 ) ) ; } let O_i = 2.0 * O_m * O_g - O_vk ; let O_vl = normalize ( O_i ) ; let O_uu = 1.0 ; let O_qi = O_v ( O_b , O_c , O_d , O_e , O_f , O_g , O_j , O_vl ) ; return O_us ( O_vl , O_uu , O_qi ) ; } let O_ai = O_c * O_c ; let O_vm = O_ai ; let O_vn = O_ai ; var O_ji : vec3 < f32 > ; var O_jj : vec3 < f32 > ; if ( abs ( O_g . z ) < 0.9 ) { O_ji = normalize ( cross ( O_g , vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) ) ) ; } else { O_ji = normalize ( cross ( O_g , vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ) ) ; } O_jj = cross ( O_g , O_ji ) ; let O_vo = vec3 < f32 > ( dot ( O_ji , O_j ) , dot ( O_jj , O_j ) , dot ( O_g , O_j ) ) ; let O_vp = O_vq ( O_vo , O_vm , O_vn , O_hs . xy ) ; let O_av = O_jh ( O_vp , O_ji , O_jj , O_g ) ; let O_aw = max ( dot ( O_j , O_av ) , 0.0 ) ; let O_i = 2.0 * O_aw * O_av - O_j ; let O_vl = normalize ( O_i ) ; let O_vd = dot ( O_g , O_vl ) ; if ( O_vd <= 0.0 ) { return O_us ( vec3 < f32 > ( 0.0 ) , 0.0 , vec3 < f32 > ( 0.0 ) ) ; } let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; let O_ah = max ( dot ( O_g , O_av ) , 0.0 ) ; let O_y = O_ai * O_ai ; let O_ax = O_ag ( O_ah , O_c ) ; let O_uu = O_ax * O_ah / max ( 4.0 * O_aw , 1e-10 ) ; let O_qi = O_v ( O_b , O_c , O_d , O_e , O_f , O_g , O_j , O_vl ) ; return O_us ( O_vl , O_uu , O_qi ) ; } fn O_uz ( O_g : vec3 < f32 > , O_hs : vec2 < f32 > , ) -> O_us { let O_bn = sqrt ( O_hs . x ) ; let O_vr = 2.0 * O_ao * O_hs . y ; let O_cj = O_bn * cos ( O_vr ) ; let O_jd = O_bn * sin ( O_vr ) ; let O_vs = sqrt ( max ( 1.0 - O_cj * O_cj - O_jd * O_jd , 0.0 ) ) ; var O_vt : vec3 < f32 > ; var O_vu : vec3 < f32 > ; if ( abs ( O_g . z ) < 0.9 ) { O_vt = normalize ( cross ( O_g , vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) ) ) ; } else { O_vt = normalize ( cross ( O_g , vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ) ) ; } O_vu = cross ( O_g , O_vt ) ; let O_i = O_cj * O_vt + O_jd * O_vu + O_vs * O_g ; let O_vl = normalize ( O_i ) ; let O_uu = O_vs * O_t ; return O_us ( O_vl , O_uu , vec3 < f32 > ( 0.0 ) ) ; } fn O_ur ( O_gv : O_tn , ) -> vec3f { if ( O_ev . O_ou == 0.0 ) { return vec3f ( ) ; } var O_tk : vec3f ; let O_vv = O_gv . O_gy ; let O_vw = O_gv . O_by ; let O_vx = O_gv . O_bz ; let O_b = O_gv . O_b ; let O_c = O_gv . O_c ; let O_d = O_gv . O_d ; let O_vy = - O_gv . O_bw ; let O_e = O_gv . O_e ; let O_vz = O_gv . O_hg ; for ( var O_oe = 0 ; O_oe < O_eh ; O_oe ++ ) { let O_wa = O_fg [ O_oe ] ; if ( O_wa . O_wb == 1.0 || O_wa . O_wc == 0.0 ) { continue ; } let O_wd = O_we ( O_wa . O_wf ) ; let O_wg = O_wh ( O_wa . O_gy + 0.50 * O_wa . O_cn + 0.5 * O_wa . O_cm , O_wi ( normalize ( O_wa . O_cn ) , normalize ( O_wa . O_cm ) , length ( O_wa . O_cn ) , length ( O_wa . O_cm ) , normalize ( cross ( O_wa . O_cn , O_wa . O_cm ) ) , 1.0 / ( length ( O_wa . O_cn ) * length ( O_wa . O_cm ) ) , O_wd . O_wj , O_wd . O_wk , ) ) ; let O_wl = O_wa . O_tk * O_wa . O_wc ; let O_wm = vec2f ( O_bl ( ) , O_bl ( ) ) ; let O_wn = vec3f ( O_bl ( ) , O_bl ( ) , O_bl ( ) ) ; let O_wo = O_wa . O_wp > 0.0 ; O_tk += O_wq ( O_vv , O_vw , O_vx , O_b , O_c , O_d , O_e , O_vz , O_vy , O_wg , O_wl , O_wm , O_wn , O_wo ) ; } return O_tk ; } fn O_wq ( O_vv : vec3 < f32 > , O_vw : vec3 < f32 > , O_vx : vec3 < f32 > , O_b : vec3 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_vy : vec3 < f32 > , O_wg : O_wh , O_wl : vec3 < f32 > , O_wr : vec2 < f32 > , O_wn : vec3 < f32 > , O_wo : bool , ) -> vec3 < f32 > { var O_bj = vec3 < f32 > ( 0.0 ) ; let O_ws = O_wt ( O_vv , O_vw , O_vx , O_b , O_c , O_d , O_e , O_f , O_vy , O_wg , O_wl , O_wr , O_wo ) ; let O_wu = O_wv ( O_wg , O_vv , O_wg . O_ww , O_wr , true , false ) ; let O_wx = O_wu . O_wy . O_uu ; if ( O_wx > 0.0 && O_wu . O_wz ) { let O_h = O_wu . O_wy . O_ax ; let O_xa = O_xb ( O_c , O_d , O_e , O_f , O_vx , O_h , O_vy ) ; let O_xc = O_xd ( O_wx , O_xa ) ; O_bj += O_ws * O_xc ; } let O_xe = O_xf ( O_c , O_d , O_e , O_f , O_vx , O_vy , O_wn ) ; if ( O_xe . O_uu > 0.0 ) { let O_i = O_xe . O_i ; let O_xg = O_xe . O_uu ; let O_xh = O_a ( O_b , O_c , O_d , O_e , O_f , O_vx , O_i , O_vy ) ; let O_xi = dot ( O_vw , O_i ) ; if ( O_xi > 0.0 ) { let O_xj = O_wg . O_wa . O_iy ; let O_xk = O_wg . O_ww ; let O_xl = O_xk - O_vv ; let O_xm = dot ( O_xl , O_xj ) ; let O_xn = O_xm / max ( dot ( O_i , O_xj ) , 1e-10 ) ; if ( O_xn > 0.0 ) { let O_xo = O_vv + O_i * O_xn ; let O_xp = O_xo - O_xk ; let O_xq = dot ( O_xp , O_wg . O_wa . O_xr ) ; let O_xs = dot ( O_xp , O_wg . O_wa . O_xt ) ; let O_xu = O_wg . O_wa . O_xv * 0.5 ; let O_xw = O_wg . O_wa . O_xx * 0.5 ; let O_xy = ( O_wg . O_wa . O_xz < 0.0 ) ; var O_ya = false ; if ( O_xy ) { let O_yb = O_xq / O_xu ; let O_yc = O_xs / O_xw ; O_ya = ( O_yb * O_yb + O_yc * O_yc <= 1.0 ) ; } else { O_ya = ( abs ( O_xq ) <= O_xu && abs ( O_xs ) <= O_xw ) ; } if ( O_ya ) { var O_uq = true ; if ( O_wo ) { let O_yd = O_vv + O_vw * 0.001 ; O_uq = O_ye ( O_yd , O_i , O_xn - 0.001 ) ; } if ( O_uq ) { let O_yf = O_xo - O_vv ; let O_yg = length ( O_yf ) ; let O_yh = O_yf / max ( O_yg , 1e-10 ) ; let O_yi = O_wv ( O_wg , O_vv , O_xo , vec2 < f32 > ( 0.0 ) , false , false ) ; if ( O_yi . O_wz ) { let O_yj = O_yi . O_wy . O_uu ; if ( O_yj > 0.0 ) { let O_yk = O_wl * O_yi . O_wy . O_yl ; let O_ym = max ( dot ( O_vx , O_i ) , 0.0 ) ; var O_yn : vec3 < f32 > ; if ( O_c < 1e-5 ) { let O_n = O_o ( O_b , O_d , O_e , O_f ) ; let O_yo = max ( dot ( O_vx , O_vy ) , 0.0 ) ; let O_p = O_q ( O_n , O_yo ) ; O_yn = O_yk * O_p * O_ym ; } else { O_yn = ( O_yk * O_xh * O_ym ) / max ( O_xg , 1e-10 ) ; } let O_yp = O_xd ( O_xg , O_yj ) ; O_bj += O_yn * O_yp ; } } } } } } } return clamp ( O_bj , vec3 < f32 > ( 0.0 ) , vec3 < f32 > ( 1e4 ) ) ; } fn O_yq ( O_c : f32 , O_g : vec3 < f32 > , O_j : vec3 < f32 > , O_k : vec3 < f32 > , ) -> f32 { let O_at = O_j + O_k ; let O_au = length ( O_at ) ; if ( O_au < 1e-6 ) { return 0.0 ; } let O_av = O_at / O_au ; let O_l = max ( dot ( O_g , O_k ) , 0.0 ) ; let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; let O_ah = dot ( O_g , O_av ) ; if ( O_l <= 0.0 || O_m <= 0.0 || O_ah <= 0.0 ) { return 0.0 ; } let O_ai = O_c * O_c ; let O_y = O_ai * O_ai ; if ( O_y <= O_w ) { return 0.0 ; } let O_aj = clamp ( O_ah , - 1.0 , 1.0 ) ; let O_ak = min ( O_aj * O_aj , 1.0 ) ; let O_al = 1.0 - O_ak ; let O_am = O_al + O_y * O_ak ; let O_ax = O_y / max ( O_ao * O_am * O_am , 1e-10 ) ; let O_aq = O_x ( O_y , O_l ) ; let O_az = O_ax * 0.25 ; return O_az / max ( O_l * ( 1.0 + O_aq ) , 1e-10 ) ; } fn O_xd ( O_yr : f32 , O_ys : f32 , ) -> f32 { let O_yt = O_yr * O_yr ; let O_yu = O_ys * O_ys ; return O_yt / max ( O_yt + O_yu , 1e-10 ) ; } struct O_us { O_i : vec3 < f32 > , O_uu : f32 , O_qi : vec3 < f32 > , } fn O_xf ( O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec3 < f32 > , O_j : vec3 < f32 > , O_hs : vec3 < f32 > , ) -> O_us { if ( O_d < 1e-5 && O_f < 1e-5 ) { return O_us ( vec3 < f32 > ( 0.0 ) , 0.0 , vec3 < f32 > ( 0.0 ) ) ; } if ( O_c < 1e-5 ) { let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; if ( O_m <= 0.0 ) { return O_us ( vec3 < f32 > ( 0.0 ) , 0.0 , vec3 < f32 > ( 0.0 ) ) ; } let O_i = 2.0 * O_m * O_g - O_j ; let O_vl = normalize ( O_i ) ; let O_uu = 1e10 ; let O_yv = vec3 < f32 > ( 1.0 ) ; let O_qi = O_v ( O_yv , O_c , O_d , O_e , O_f , O_g , O_j , O_vl ) ; return O_us ( O_vl , O_uu , O_qi ) ; } let O_ai = max ( O_c * O_c , 1e-6 ) ; let O_vm = O_ai ; let O_vn = O_ai ; var O_ji : vec3 < f32 > ; var O_jj : vec3 < f32 > ; if ( abs ( O_g . z ) < 0.9 ) { O_ji = normalize ( cross ( O_g , vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) ) ) ; } else { O_ji = normalize ( cross ( O_g , vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ) ) ; } O_jj = cross ( O_g , O_ji ) ; let O_vo = vec3 < f32 > ( dot ( O_ji , O_j ) , dot ( O_jj , O_j ) , dot ( O_g , O_j ) ) ; let O_vp = O_vq ( O_vo , O_vm , O_vn , O_hs . xy ) ; let O_av = O_jh ( O_vp , O_ji , O_jj , O_g ) ; let O_aw = max ( dot ( O_j , O_av ) , 0.0 ) ; let O_i = 2.0 * O_aw * O_av - O_j ; let O_vl = normalize ( O_i ) ; let O_vd = dot ( O_g , O_vl ) ; if ( O_vd <= 0.0 ) { return O_us ( vec3 < f32 > ( 0.0 ) , 0.0 , vec3 < f32 > ( 0.0 ) ) ; } let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; let O_ah = max ( dot ( O_g , O_av ) , 0.0 ) ; let O_y = O_ai * O_ai ; let O_ax = O_ag ( O_ah , O_c ) ; let O_uu = O_ax * O_ah / max ( 4.0 * O_aw , 1e-10 ) ; let O_yv = vec3 < f32 > ( 1.0 ) ; let O_qi = O_v ( O_yv , O_c , O_d , O_e , O_f , O_g , O_j , O_vl ) ; return O_us ( O_vl , O_uu , O_qi ) ; } fn O_vq ( O_h : vec3 < f32 > , O_vm : f32 , O_vn : f32 , O_hs : vec2 < f32 > , ) -> vec3 < f32 > { let O_yw = normalize ( vec3 < f32 > ( O_vm * O_h . x , O_vn * O_h . y , O_h . z ) ) ; let O_yx = O_jl ( O_yw . x ) + O_jl ( O_yw . y ) ; var O_yy : vec3 < f32 > ; var O_yz : vec3 < f32 > ; if ( O_yx > 1e-7 ) { O_yy = vec3 < f32 > ( - O_yw . y , O_yw . x , 0.0 ) * O_jm ( O_yx ) ; O_yz = cross ( O_yw , O_yy ) ; } else { O_yy = vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ; O_yz = vec3 < f32 > ( 0.0 , 1.0 , 0.0 ) ; } let O_hd = O_hr ( O_hs ) ; let O_za = mix ( O_iu ( 1.0 - O_jl ( O_hd . x ) ) , O_hd . y , 0.5 * ( 1.0 + O_yw . z ) ) ; let O_zb = vec2 < f32 > ( O_hd . x , O_za ) ; let O_zc = O_jh ( O_jf ( O_zb ) , O_yy , O_yz , O_yw ) ; return normalize ( vec3 < f32 > ( O_vm * O_zc . x , O_vn * O_zc . y , max ( 0.0 , O_zc . z ) ) ) ; } fn O_wt ( O_vv : vec3 < f32 > , O_vw : vec3 < f32 > , O_vx : vec3 < f32 > , O_b : vec3 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_vy : vec3 < f32 > , O_wg : O_wh , O_wl : vec3 < f32 > , O_wm : vec2 < f32 > , O_wo : bool , ) -> vec3 < f32 > { let O_wu = O_wv ( O_wg , O_vv , O_wg . O_ww , O_wm , true , false ) ; if ( ! O_wu . O_wz || O_wu . O_wy . O_uu <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } let O_zd = O_wu . O_wy . O_ax ; let distance = O_wu . O_wy . O_hd ; let O_uu = O_wu . O_wy . O_uu ; let O_yl = O_wu . O_wy . O_yl ; let O_h = O_zd ; let O_ze = dot ( O_vw , O_h ) ; if ( O_ze <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } if ( O_wo ) { let O_yd = O_vv + O_vw * 0.001 ; if ( ! O_ye ( O_yd , O_h , distance - 0.001 ) ) { return vec3 < f32 > ( 0.0 ) ; } } let O_zf = dot ( O_vx , O_h ) ; if ( O_zf <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } let O_zg = O_wl * O_yl ; let O_qi = O_a ( O_b , O_c , O_d , O_e , O_f , O_vx , O_h , O_vy ) ; let O_bj = ( O_zg * O_qi * O_zf ) / max ( O_uu , 1e-10 ) ; return clamp ( O_bj , vec3 < f32 > ( 0.0 ) , vec3 < f32 > ( 1e4 ) ) ; } fn O_xb ( O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec3 < f32 > , O_h : vec3 < f32 > , O_i : vec3 < f32 > , ) -> f32 { let O_j = normalize ( O_i ) ; let O_k = normalize ( O_h ) ; let O_l = max ( dot ( O_g , O_k ) , 0.0 ) ; let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; if ( O_l <= 0.0 || O_m <= 0.0 ) { return 0.0 ; } let O_uv = O_o ( vec3 < f32 > ( 1.0 ) , O_d , O_e , O_f ) ; let O_p = O_q ( O_uv , O_m ) ; let O_uw = O_jn ( O_p ) * O_d + ( 1.0 - O_d ) * O_f ; let O_ux = 1.0 - O_uw ; let O_vg = O_l * O_t ; let O_av = normalize ( O_j + O_k ) ; let O_ah = max ( dot ( O_g , O_av ) , 0.0 ) ; let O_aw = max ( dot ( O_j , O_av ) , 0.0 ) ; let O_ax = O_ag ( O_ah , O_c ) ; let O_vj = O_ax * O_ah / max ( 4.0 * O_aw , 1e-10 ) ; return O_ux * O_vg + O_uw * O_vj ; } fn O_zh ( O_gt : O_fs , ) -> O_li { let O_ha = O_zi ( O_gt ) ; if ( O_ha . O_hd < 0 ) { return O_lj ( ) ; } var O_hc : i32 ; if ( O_zj ( O_ha . O_jw ) ) { O_hc = i32 ( O_fd . O_sx ) ; } else { O_hc = i32 ( O_fd . O_qv ) ; } let O_lf = O_fp [ O_hc ] ; return O_li ( O_ha . O_hd , vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) , O_lf , O_hc ) ; } fn O_zj ( O_jw : vec2f , ) -> bool { { let O_kb = O_fd . O_ka / 2.0 ; let O_zk = O_fd . O_tb / 2.0 ; let O_zl = vec2f ( O_kb - O_fd . O_td , O_zk - O_fd . O_td ) ; let O_kd = O_kf ( O_zl . x - O_fd . O_tg , O_zl . x , O_zl . y - O_fd . O_th , O_zl . y ) ; if ( O_ki ( O_kd , O_jw ) ) { let O_zm = O_kd . O_js - O_kd . O_jp ; let O_zn = O_kd . O_jt - O_kd . O_jq ; let O_zo = vec2f ( ( O_jw . x - O_kd . O_jp ) / O_zm , 1.0 - ( O_jw . y - O_kd . O_jq ) / O_zn ) ; let O_zp = vec2 < i32 > ( O_zo * vec2 < f32 > ( textureDimensions ( O_gf ) ) ) ; var O_tk = textureLoad ( O_gf , O_zp , 0 ) ; return O_tk . x < 0.5 ; } } { let O_kb = O_fd . O_ka / 2.0 ; let O_zk = O_fd . O_tb / 2.0 ; var O_km = O_kf ( - O_kb , O_kb , - O_zk , O_zk ) ; O_km = O_kg ( O_km , O_fd . O_td ) ; if ( ! O_ki ( O_km , O_jw ) ) { return false ; } } { let O_zq = O_fd . O_tf ; var O_zr : f32 ; if ( O_jw . x < 0 ) { O_zr = ( O_jw . x - ( O_jw . x % O_zq ) ) - O_zq ; } else { O_zr = ( O_jw . x - ( O_jw . x % O_zq ) ) ; } var O_zs : f32 ; if ( O_jw . y < 0 ) { O_zs = ( O_jw . y - ( O_jw . y % O_zq ) ) - O_zq ; } else { O_zs = ( O_jw . y - ( O_jw . y % O_zq ) ) ; } var O_kd = O_kf ( O_zr , O_zr + O_zq , O_zs , O_zs + O_zq ) ; O_kd = O_kg ( O_kd , O_fd . O_te / 2.0 ) ; if ( ! O_ki ( O_kd , O_jw ) ) { return true ; } } return false ; } struct O_zt { O_hd : f32 , O_jw : vec2f , } fn O_zi ( O_gt : O_fs , ) -> O_zt { let O_zu = O_qz ( O_gt , O_zv ( ) ) ; let O_hd = O_zu . O_hd ; let O_zw = O_zu . O_jw . xy ; if ( O_hd < 0 || O_zx ( O_zw ) ) { return O_zt ( - 1 , vec2f ( 0 ) ) ; } else { return O_zt ( O_hd , O_zw ) ; } } fn O_zx ( O_zw : vec2 < f32 > , ) -> bool { let O_zy = vec2 < f32 > ( - O_fd . O_ka / 2.0 , O_fd . O_tb / 2.0 ) ; if ( O_zw . x > O_zy . x + O_fd . O_tc && O_zw . x < O_zy . x + O_fd . O_ka - O_fd . O_tc ) { if ( O_zw . y > O_zy . y - O_fd . O_tb && O_zw . y < O_zy . y ) { return false ; } } if ( O_zw . x > O_zy . x && O_zw . x < O_zy . x + O_fd . O_ka ) { if ( O_zw . y > O_zy . y - O_fd . O_tb + O_fd . O_tc && O_zw . y < O_zy . y - O_fd . O_tc ) { return false ; } } if ( length ( O_zw - ( O_zy + vec2f ( O_fd . O_tc , - O_fd . O_tc ) ) ) < O_fd . O_tc ) { return false ; } if ( length ( O_zw - ( O_zy + vec2f ( O_fd . O_ka - O_fd . O_tc , - O_fd . O_tc ) ) ) < O_fd . O_tc ) { return false ; } if ( length ( O_zw - ( O_zy + vec2f ( O_fd . O_tc , O_fd . O_tc - O_fd . O_tb ) ) ) < O_fd . O_tc ) { return false ; } if ( length ( O_zw - ( O_zy + vec2f ( O_fd . O_ka - O_fd . O_tc , O_fd . O_tc - O_fd . O_tb ) ) ) < O_fd . O_tc ) { return false ; } return true ; } fn O_zv ( ) -> O_ow { return O_ow ( vec3 < f32 > ( 0.0 , 0.0 , O_ft [ 2 ] ) , vec3 < f32 > ( 0.0 , 0.0 , 1.0 , ) ) ; } fn O_zz ( ) -> f32 { return O_ft [ 1 ] ; } fn O_aaa ( O_gt : O_fs , ) -> O_li { var O_lf : O_fq = O_fq ( ) ; var O_hd : f32 = - 1.0 ; let O_bn = 0.001 ; let O_cj = O_aab ( O_gt , vec3f ( ) , vec3 < f32 > ( 1 , 0 , 0 ) , O_bn ) ; if ( O_cj . x != - 1.0 ) { if ( O_cj . y > 0 ) { O_lf = O_md ( 1 , 1 , 0 ) ; } else { O_lf = O_md ( 1 , 1 , 1 ) ; } O_hd = O_cj . x ; } let O_jd = O_aab ( O_gt , vec3f ( ) , vec3 < f32 > ( 0 , 1 , 0 ) , O_bn ) ; if ( O_jd . x != - 1.0 ) { if ( O_jd . y > 0 ) { O_lf = O_md ( 0 , 1 , 0 ) ; } else { O_lf = O_md ( 1 , 1 , 1 ) ; } O_hd = O_jd . x ; } let O_vs = O_aab ( O_gt , vec3f ( ) , vec3 < f32 > ( 0 , 0 , 1 ) , O_bn ) ; if ( O_vs . x != - 1.0 ) { if ( O_vs . y > 0 ) { O_lf = O_md ( 0 , 0 , 1 ) ; } else { O_lf = O_md ( 1 , 1 , 1 ) ; } O_hd = O_vs . x ; } return O_li ( O_hd , vec3f ( ) , O_lf , - 1 ) ; } fn O_aab ( O_gt : O_fs , O_aac : vec3 < f32 > , O_aad : vec3 < f32 > , O_qr : f32 , ) -> vec2f { let O_aae = O_gt . O_nz - O_aac ; let O_aaf = dot ( O_gt . O_oy , O_aad ) ; let O_aag = dot ( O_aae , O_aad ) ; let O_aah = O_gt . O_oy - O_aaf * O_aad ; let O_aai = O_aae - O_aag * O_aad ; let O_ht = dot ( O_aah , O_aah ) ; let O_hu = 2.0 * dot ( O_aai , O_aah ) ; let O_qq = dot ( O_aai , O_aai ) - O_qr * O_qr ; if abs ( O_ht ) < O_cu { let O_aaj = dot ( O_aai , O_aai ) ; if abs ( O_aaj - O_qr * O_qr ) < O_cu * O_qr { let O_aak = dot ( O_aae , O_aad ) ; var O_aal : f32 = 0.5 ; if O_aak > O_cu { O_aal = 1.0 ; } else if O_aak < - O_cu { O_aal = - 1.0 ; } return vec2 ( 0.0 , O_aal ) ; } return vec2 ( - 1.0 , 0.0 ) ; } let O_qs = O_hu * O_hu - 4.0 * O_ht * O_qq ; if O_qs < 0.0 { return vec2 ( - 1.0 , 0.0 ) ; } let O_aam = sqrt ( O_qs ) ; let O_qa = ( - O_hu - O_aam ) / ( 2.0 * O_ht ) ; let O_qc = ( - O_hu + O_aam ) / ( 2.0 * O_ht ) ; var O_aan = f32 ( - 1.0 ) ; if O_qa > O_cu { O_aan = O_qa ; } else if O_qc > O_cu { O_aan = O_qc ; } else { return vec2 ( - 1.0 , 0.0 ) ; } let O_aao = O_gt . O_nz + O_aan * O_gt . O_oy ; let O_aap = O_aao - O_aac ; let O_aaq = dot ( O_aap , O_aad ) ; var O_aal : f32 = 0.5 ; if O_aaq > O_cu { O_aal = 1.0 ; } else if O_aaq < - O_cu { O_aal = - 1.0 ; } return vec2 ( O_aan , O_aal ) ; } fn O_aar ( O_gt : O_fs , ) -> vec3 < f32 > { var O_tk : vec3f ; if ( O_ev . O_ot == 1.0 ) { O_tk = O_ev . O_os ; } else { let O_iy = O_aas ( O_gt . O_oy , O_ev . O_oq ) ; let O_zo = vec2 < f32 > ( 0.5 + atan2 ( - O_iy . y , O_iy . x ) / ( 2.0 * O_ao ) , 0.5 - asin ( O_iy . z ) / O_ao ) ; let O_zp = vec2 < i32 > ( O_zo * vec2 < f32 > ( textureDimensions ( O_ff ) ) ) ; var O_aat = textureLoad ( O_ff , O_zp , 0 ) ; O_tk = vec3 < f32 > ( O_aat . x , O_aat . y , O_aat . z ) ; } return O_tk * O_ev . O_or ; } fn O_aas ( O_aau : vec3 < f32 > , O_aav : f32 , ) -> vec3 < f32 > { let O_aaw = O_aav * 3.14159265359 / 180.0 ; let O_aax = cos ( O_aaw ) ; let O_aay = sin ( O_aaw ) ; let O_aaz = O_aau . x * O_aax - O_aau . y * O_aay ; let O_aba = O_aau . x * O_aay + O_aau . y * O_aax ; let O_abb = O_aau . z ; return vec3 < f32 > ( O_aaz , O_aba , O_abb ) ; } struct O_tn { O_bb : u32 , O_bw : vec3f , O_b : vec3f , O_d : f32 , O_c : f32 , O_e : f32 , O_hg : f32 , O_lp : f32 , O_lq : f32 , O_lr : f32 , O_lt : vec3f , O_by : vec3f , O_bz : vec3f , O_gy : vec3f , O_tk : vec3 < f32 > , O_ho : f32 , O_hc : f32 , } fn O_abc ( ) -> O_tn { let O_cm = vec3 < f32 > ( 0 ) ; return O_tn ( 0 , O_cm , O_cm , 0 , 0 , 0 , 0 , 0 , 0 , 0 , O_cm , O_cm , O_cm , O_cm , O_cm , 0 , 0 ) ; } fn O_up ( O_gt : O_fs , O_abd : bool , O_abe : bool , O_abf : bool , ) -> O_tn { var O_gv = O_abc ( ) ; O_gv . O_bw = O_gt . O_oy ; let O_abg = O_hb ( O_gt , O_abd , O_abe , O_abf ) ; if ( O_abg . O_hd < 0.0 ) { O_gv . O_bb = O_ei ; O_gv . O_tk = O_aar ( O_gt ) ; return O_gv ; } O_gv . O_gy = O_pa ( O_gt , O_abg . O_hd ) ; O_gv . O_by = normalize ( O_abg . O_bq ) ; let O_lf = O_abg . O_lf ; if ( O_abg . O_he == O_eg ) { O_gv . O_bb = O_em ; O_gv . O_tk = O_lf . O_b ; return O_gv ; } if ( O_abg . O_he == O_ef ) { O_gv . O_bb = O_ej ; O_gv . O_tk = O_abh ( ) ; return O_gv ; } O_gv . O_e = O_lf . O_e ; O_gv . O_hg = O_lf . O_hg ; O_gv . O_lp = O_lf . O_lp ; O_gv . O_lq = pow ( O_lf . O_lq , 2.0 ) ; O_gv . O_lr = O_lf . O_lr ; O_gv . O_lt = O_lf . O_lt ; if ( O_lf . O_lv < 0.0 ) { O_gv . O_bz = O_gv . O_by ; } else { O_gv . O_bz = O_abi ( O_gv . O_gy , O_gv . O_by , O_lf . O_lv , O_lf . O_lw , O_lf . O_lu ) ; } if ( O_lf . O_lx < 0.0 ) { O_gv . O_d = O_lf . O_d ; } else { O_gv . O_d = O_abj ( O_gv . O_gy , O_gv . O_by , O_lf . O_lx , O_lf . O_ly ) . x * O_lf . O_d ; } if ( O_lf . O_lz < 0.0 ) { O_gv . O_b = O_abk ( O_lf . O_b ) ; } else { O_gv . O_b = O_abk ( O_abj ( O_gv . O_gy , O_gv . O_by , O_lf . O_lz , O_lf . O_ma ) ) * O_lf . O_b ; } if ( O_lf . O_mb < 0.0 ) { O_gv . O_c = O_lf . O_c ; } else { O_gv . O_c = O_abj ( O_gv . O_gy , O_gv . O_by , O_lf . O_mb , O_lf . O_mc ) . x * O_lf . O_c ; } O_gv . O_ho = O_sn ( O_gv . O_bz , - O_gt . O_oy ) ; O_gv . O_bb = O_el ; return O_gv ; } fn O_abk ( O_tk : vec3f , ) -> vec3f { return select ( pow ( ( O_tk + 0.055 ) / 1.055 , vec3f ( 2.4 ) ) , O_tk / 12.92 , O_tk <= vec3f ( 0.04045 ) ) ; } fn O_abi ( O_gy : vec3 < f32 > , O_abl : vec3 < f32 > , O_abm : f32 , O_abn : f32 , O_wc : f32 , ) -> vec3 < f32 > { var O_abo = normalize ( O_abj ( O_gy , O_abl , O_abm , O_abn ) ) ; O_abo . x = O_abo . x * O_wc ; O_abo . y = O_abo . y * O_wc ; O_abo = normalize ( O_abo ) ; let O_abp = select ( vec3f ( 0.0 , 1.0 , 0.0 ) , vec3f ( 0.0 , 0.0 , 1.0 ) , abs ( O_abl . z ) < 0.999 ) ; let O_br = normalize ( cross ( O_abp , O_abl ) ) ; let O_bs = normalize ( cross ( O_abl , O_br ) ) ; return mat3x3 < f32 > ( O_br , O_bs , O_abl ) * O_abo ; } fn O_abj ( O_gy : vec3 < f32 > , O_bq : vec3 < f32 > , O_abm : f32 , O_abn : f32 , ) -> vec3f { let O_abq = floor ( O_abm / 32.0 ) ; let O_abr = i32 ( O_abm - O_abq * 32 ) ; let O_abs = vec2 < i32 > ( ( O_abr % 8 ) * 2048 , O_abr / 8 * 2048 ) ; let O_abt = O_abu ( O_gy . xy , O_abn ) + O_abs ; let O_abv = O_abu ( O_gy . xz , O_abn ) + O_abs ; let O_abw = O_abu ( O_gy . yz , O_abn ) + O_abs ; var O_abx : vec3 < f32 > ; var O_aby : vec3 < f32 > ; var O_abz : vec3 < f32 > ; if ( O_abq == 0 ) { O_abx = textureLoad ( O_fi , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fi , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fi , O_abw , 0 ) . rgb ; } else if ( O_abq == 1 ) { O_abx = textureLoad ( O_fj , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fj , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fj , O_abw , 0 ) . rgb ; } else if ( O_abq == 2 ) { O_abx = textureLoad ( O_fk , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fk , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fk , O_abw , 0 ) . rgb ; } else if ( O_abq == 3 ) { O_abx = textureLoad ( O_fl , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fl , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fl , O_abw , 0 ) . rgb ; } else if ( O_abq == 4 ) { O_abx = textureLoad ( O_fm , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fm , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fm , O_abw , 0 ) . rgb ; } else if ( O_abq == 5 ) { O_abx = textureLoad ( O_fn , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fn , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fn , O_abw , 0 ) . rgb ; } else if ( O_abq == 6 ) { O_abx = textureLoad ( O_fo , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fo , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fo , O_abw , 0 ) . rgb ; } var O_aca = abs ( O_bq ) ; O_aca = O_aca / ( O_aca . x + O_aca . y + O_aca . z ) ; return O_abx * O_aca . z + O_aby * O_aca . y + O_abz * O_aca . x ; } fn O_abu ( O_gy : vec2f , O_abn : f32 , ) -> vec2 < i32 > { return ( vec2 < i32 > ( round ( O_gy * O_abn ) ) % 2048 + 2048 ) % 2048 ; } struct O_acb { O_he : i32 , O_hd : f32 , O_bq : vec3 < f32 > , O_lf : O_fq , O_hc : i32 , } fn O_hb ( O_gt : O_fs , O_abd : bool , O_abe : bool , O_abf : bool , ) -> O_acb { var O_acc : O_li = O_lj ( ) ; var O_he : i32 = - 1 ; if ( O_ev . O_on == 0.0 ) { let O_acd = O_ace ( O_gt ) ; if O_acd . O_hd > 0.0 && ( O_acc . O_hd < 0.0 || O_acd . O_hd < O_acc . O_hd ) { O_acc = O_acd ; O_he = O_ed ; } } if ( O_ev . O_om == 0.0 ) { let O_acf = O_acg ( O_gt ) ; if O_acf . O_hd > 0.0 && ( O_acc . O_hd < 0.0 || O_acf . O_hd < O_acc . O_hd ) { O_acc = O_acf ; O_he = O_ee ; } } if ( O_ev . O_ok == 0.0 ) { let O_ach = O_zh ( O_gt ) ; if O_ach . O_hd > 0.0 && ( O_acc . O_hd < 0.0 || O_ach . O_hd < O_acc . O_hd ) { O_acc = O_ach ; O_he = O_eb ; } } if ( O_abf && O_ev . O_ol == 0.0 ) { let O_aci = O_acj ( O_gt ) ; if O_aci . O_hd > 0.0 && ( O_acc . O_hd < 0.0 || O_aci . O_hd < O_acc . O_hd ) { O_acc = O_aci ; O_he = O_ec ; } } if ( O_abd && O_ev . O_oo == 0.0 ) { let O_ack = O_acl ( O_gt ) ; if O_ack . O_hd > 0.0 && ( O_acc . O_hd < 0.0 || O_ack . O_hd < O_acc . O_hd ) { O_acc = O_ack ; O_he = O_ef ; } } if ( O_abe && O_ev . O_op == 0.0 ) { let O_acm = O_aaa ( O_gt ) ; if ( O_acm . O_hd > 0.0 && ( O_acc . O_hd < 0.0 || O_acm . O_hd < O_acc . O_hd ) ) { O_acc = O_acm ; O_he = O_eg ; } } return O_acb ( O_he , O_acc . O_hd , O_acc . O_bq , O_acc . O_lf , O_acc . O_hc ) ; } fn O_ye ( O_acn : vec3 < f32 > , O_k : vec3 < f32 > , O_ps : f32 , ) -> bool { let O_gt = O_fs ( O_acn , O_k ) ; let O_ha = O_hb ( O_gt , true , false , true ) ; return O_ha . O_he == O_ef || O_ha . O_hd < 0.00 ; } fn O_acl ( O_gt : O_fs , ) -> O_li { var O_ha = O_pb ( - 1.0 , vec3f ( 0 ) ) ; for ( var O_oe : i32 = 0 ; O_oe < O_eh ; O_oe ++ ) { if ( O_fg [ O_oe ] . O_wb == 1.0 ) { continue ; } let O_bn = O_aco ( O_gt , O_fg [ O_oe ] ) ; if ( O_bn . O_hd > 0 && ( O_ha . O_hd < 0 || O_bn . O_hd < O_ha . O_hd ) ) { O_ha = O_bn ; } } return O_li ( O_ha . O_hd , O_ha . O_bq , O_ll ( ) , - 1 ) ; } fn O_aco ( O_gt : O_fs , O_wg : O_fh , ) -> O_pb { let O_pz = O_wg . O_gy + O_wg . O_cn + O_wg . O_cm ; let O_mx = O_wg . O_gy + O_wg . O_cn ; let O_my = O_wg . O_gy + O_wg . O_cm ; let O_mz = O_wg . O_gy ; var O_hd = - 1.0 ; let O_qa = O_qd ( O_gt , O_qb ( O_pz , O_mx , O_my ) ) ; if ( O_qa > 0.0 && ( O_hd < 0.0 || O_qa < O_hd ) ) { O_hd = O_qa ; } let O_qc = O_qd ( O_gt , O_qb ( O_mx , O_my , O_mz ) ) ; if ( O_qc > 0.0 && ( O_hd < 0.0 || O_qc < O_hd ) ) { O_hd = O_qc ; } return O_pb ( O_hd , normalize ( cross ( O_wg . O_cn , O_wg . O_cm ) ) ) ; } fn O_ace ( O_gt : O_fs , ) -> O_li { var O_acp : i32 = 0 ; var O_acq = array < u32 , O_ea > ( ) ; O_acq [ 0 ] = 0 ; var O_hd = - 1.0 ; var O_bq : vec3 < f32 > ; var O_acr : u32 ; while ( O_acp >= 0 ) { let O_abm = O_acq [ O_acp ] ; O_acp -= 1 ; let O_kd = O_jo ( O_ft [ O_abm ] , O_ft [ O_abm + 1 ] , O_ft [ O_abm + 2 ] , O_ft [ O_abm + 3 ] , O_ft [ O_abm + 4 ] , O_ft [ O_abm + 5 ] ) ; let O_acs = O_pq ( O_gt , O_kd ) ; if ( O_acs < 0.0 || ( O_hd > 0.0 && O_acs > O_hd ) ) { continue ; } for ( var O_oe : u32 = 0 ; O_oe < 4 ; O_oe += 1 ) { var O_act = O_ft [ O_abm + 6 + O_oe ] ; if ( O_act > 0.0 ) { O_acp += 1 ; if ( O_acp >= O_ea ) { O_tq ( ) ; return O_lj ( ) ; } O_acq [ O_acp ] = u32 ( O_act ) - 1 ; } else if ( O_act < 0.0 ) { let O_acu = u32 ( - O_act ) - 1 ; let O_qe = O_acv ( O_acu ) ; let O_acw = O_qd ( O_gt , O_qe ) ; if ( O_acw < 0.0 || ( O_hd > 0.0 && O_acw > O_hd ) ) { continue ; } O_hd = O_acw ; O_acr = O_acu ; O_bq = O_se ( O_qe , O_acx ( O_acu ) , O_pa ( O_gt , O_acw ) ) ; } } } if ( O_hd < 0 ) { return O_lj ( ) ; } let O_hc = i32 ( O_fu [ O_acr ] . O_le ) ; let O_lf = O_fp [ O_hc ] ; return O_li ( O_hd , O_bq , O_lf , O_hc ) ; } fn O_acv ( O_abm : u32 , ) -> O_qb { let O_acy = u32 ( O_fu [ O_abm ] . O_ky ) ; let O_acz = u32 ( O_fu [ O_abm ] . O_kz ) ; let O_ada = u32 ( O_fu [ O_abm ] . O_la ) ; let O_ky = O_fw [ O_acy ] ; let O_kz = O_fw [ O_acz ] ; let O_la = O_fw [ O_ada ] ; return O_qb ( O_ky , O_kz , O_la ) ; } fn O_acx ( O_abm : u32 , ) -> array < vec3 < f32 > , 3 > { let O_adb = u32 ( O_fu [ O_abm ] . O_lb ) ; let O_adc = u32 ( O_fu [ O_abm ] . O_lc ) ; let O_add = u32 ( O_fu [ O_abm ] . O_ld ) ; let O_lb = O_fw [ O_adb ] ; let O_lc = O_fw [ O_adc ] ; let O_ld = O_fw [ O_add ] ; return array < vec3 < f32 > , 3 > ( O_lb , O_lc , O_ld ) ; } struct O_ge { O_gy : vec3f , O_ka : f32 , O_tb : f32 , O_ade : f32 , O_wb : f32 , O_uq : f32 , } fn O_acj ( O_gt : O_fs , ) -> O_li { let O_kb = O_gd . O_ka / 2.0 ; let O_zk = O_gd . O_tb / 2.0 ; let O_mg = O_gd . O_gy ; let O_kd = O_jo ( O_mg . x - O_kb , O_mg . y - O_zk , O_mg . z , O_mg . x + O_kb , O_mg . y + O_zk , O_mg . z + 0.5 ) ; let O_ha = O_pc ( O_gt , O_kd ) ; if ( O_ha . O_hd < 0 ) { return O_lj ( ) ; } let O_hc = i32 ( O_gd . O_ade ) ; let O_lf = O_fp [ O_hc ] ; return O_li ( O_ha . O_hd , O_ha . O_bq , O_lf , O_hc ) ; } fn O_acg ( O_gt : O_fs , ) -> O_li { var O_abg : O_li = O_adf ( O_gt ) ; if ( O_abg . O_hd < 0.0 ) { O_abg = O_adg ( O_gt ) ; } return O_abg ; } fn O_adf ( O_gt : O_fs , ) -> O_li { let O_adh = O_adi ( O_gt , O_gb . O_ov ) ; if ( O_adh . O_hd < 0.0 ) { return O_lj ( ) ; } let O_jw = O_adh . O_jw ; let O_hc = O_adj ( O_jw ) ; let O_lf = O_fp [ O_hc ] ; return O_li ( O_adh . O_hd , O_gb . O_ov . O_bq , O_lf , O_hc ) ; } fn O_adj ( O_jw : vec2 < f32 > , ) -> i32 { if ( O_adk ( O_jw , i32 ( O_ez . O_sq ) ) ) { return i32 ( O_fb . O_sx ) ; } let O_sz = ! O_adk ( O_jw , i32 ( O_ez . O_sr ) ) ; let O_sy = O_adk ( O_jw , i32 ( O_ez . O_ss ) ) ; if ( O_sz ) { if ( O_sy ) { return i32 ( O_fb . O_ta ) ; } else { return i32 ( O_fb . O_sz ) ; } } else { if ( O_sy ) { return i32 ( O_fb . O_sy ) ; } else { return i32 ( O_fb . O_sw ) ; } } } fn O_adg ( O_gt : O_fs , ) -> O_li { let O_adh = O_adi ( O_gt , O_gb . O_ox ) ; if ( O_adh . O_hd < 0.0 ) { return O_lj ( ) ; } let O_jw = O_adh . O_jw ; let O_hc = O_adl ( O_jw ) ; let O_lf = O_fp [ O_hc ] ; return O_li ( O_adh . O_hd , O_gb . O_ox . O_bq , O_lf , O_hc ) ; } fn O_adl ( O_jw : vec2 < f32 > , ) -> i32 { let O_sx = O_adk ( O_jw , i32 ( O_ez . O_st ) ) ; if ( O_sx ) { return i32 ( O_fb . O_sx ) ; } let O_sz = ! O_adk ( O_jw , i32 ( O_ez . O_su ) ) ; let O_sy = O_adk ( O_jw , i32 ( O_ez . O_sv ) ) ; if ( O_sz ) { if ( O_sy ) { return i32 ( O_fb . O_ta ) ; } else { return i32 ( O_fb . O_sz ) ; } } else { if ( O_sy ) { return i32 ( O_fb . O_sy ) ; } else { return i32 ( O_fb . O_sw ) ; } } } fn O_adm ( O_jw : vec3 < f32 > , ) -> vec2 < f32 > { return vec2 < f32 > ( O_jw . x , O_jw . y ) ; } fn O_adn ( ) -> O_kf { let O_ado = O_fx [ u32 ( O_ez . O_sp ) ] ; let O_kd = O_kf ( O_ado . O_jp , O_ado . O_js , O_ado . O_jq , O_ado . O_jt ) ; return O_kg ( O_kd , 1 ) ; } struct O_adp { O_hd : f32 , O_jw : vec2 < f32 > , } fn O_adi ( O_gt : O_fs , O_qv : O_ow , ) -> O_adp { let O_adh = O_qz ( O_gt , O_qv ) ; if ( O_adh . O_hd < 0.0 ) { return O_adp ( - 1.0 , vec2 < f32 > ( 0.0 ) ) ; } let O_adq = O_adm ( O_adh . O_jw ) ; let O_kd = O_adn ( ) ; if ( ! O_ki ( O_kd , O_adq ) ) { return O_adp ( - 1.0 , vec2 < f32 > ( 0.0 ) ) ; } return O_adp ( O_adh . O_hd , O_adq ) ; } fn O_adk ( O_jw : vec2f , O_adr : i32 , ) -> bool { if ( O_adr < 0 ) { return false ; } var O_acq = array < i32 , 22 > ( ) ; O_acq [ 0 ] = i32 ( O_adr ) ; var O_acp : i32 = 1 ; var O_ads : i32 = 0 ; while ( O_acp > 0 ) { let O_abm = O_acq [ O_acp - 1 ] ; O_acp -= 1 ; let O_adt = O_fx [ O_abm ] ; let O_kd = O_kf ( O_adt . O_jp , O_adt . O_js , O_adt . O_jq , O_adt . O_jt ) ; if ( ! O_ki ( O_kd , O_jw ) ) { continue ; } var O_adu = array < i32 , 2 > ( ) ; O_adu [ 0 ] = i32 ( O_adt . O_lm ) ; O_adu [ 1 ] = i32 ( O_adt . O_ln ) ; for ( var O_oe = 0 ; O_oe < 2 ; O_oe += 1 ) { let O_adv = O_adu [ O_oe ] ; if ( O_adv > 0 ) { O_acq [ O_acp ] = O_adv - 1 ; O_acp += 1 ; } else if ( O_adv < 0 ) { let O_adw = - 1 * O_adv - 1 ; let O_ha = O_adx ( O_jw , O_adw ) ; if ( O_ha == O_da ) { return true ; } if ( O_ha == O_dd ) { O_ads -= 1 ; } if ( O_ha == O_dc ) { O_ads += 1 ; } } } } return O_ads != 0 ; } fn O_adx ( O_jw : vec2f , O_adw : i32 , ) -> u32 { let O_ady = i32 ( O_adw ) ; switch u32 ( O_fz [ O_ady ] ) { case O_dt : { let O_adz = O_jw ; var O_aea = vec2 ( O_fz [ O_ady + 1 ] , O_fz [ O_ady + 2 ] ) ; var O_aeb = vec2 ( O_fz [ O_ady + 3 ] , O_fz [ O_ady + 4 ] ) ; var O_iy = normalize ( O_aeb - O_aea ) ; let O_aec = O_fz [ O_ady + 5 ] ; O_aea = O_aea + O_iy * O_aec * 0.5 ; O_aeb = O_aeb - O_iy * O_aec * 0.5 ; if ( ( length ( O_jw - O_aeb ) < ( O_aec / 2.0 ) ) || ( length ( O_jw - O_aea ) < ( O_aec / 2.0 ) ) ) { return O_da ; } let O_oy = O_aeb - O_aea ; let O_aed = dot ( O_oy , O_oy ) ; let O_aee = O_adz - O_aea ; let O_hd = dot ( O_aee , O_oy ) / O_aed ; if ( O_hd < 0.0 || O_hd > 1.0 ) { return O_db ; } let O_aef = O_aea + O_hd * O_oy ; let distance = length ( O_adz - O_aef ) ; if ( distance <= O_aec / 2.0 ) { return O_da ; } else { return O_db ; } } case O_de : { let O_qp = vec2f ( O_fz [ O_ady + 1 ] , O_fz [ O_ady + 2 ] ) ; let O_bn = O_fz [ O_ady + 3 ] ; if ( length ( O_jw - O_qp ) < O_bn ) { return O_da ; } else { return O_db ; } } case O_dg : { let O_aeg : vec2 < f32 > = vec2f ( O_fz [ O_ady + 1 ] , O_fz [ O_ady + 2 ] ) ; let O_ka : f32 = O_fz [ O_ady + 3 ] ; let O_tb : f32 = O_fz [ O_ady + 4 ] ; let O_co : f32 = O_fz [ O_ady + 5 ] ; let O_qr : f32 = O_fz [ O_ady + 6 ] ; if ( O_jw . x > O_aeg . x + O_qr && O_jw . x < O_aeg . x + O_ka - O_qr ) { if ( O_jw . y > O_aeg . y - O_tb && O_jw . y < O_aeg . y ) { return O_da ; } } if ( O_jw . x > O_aeg . x && O_jw . x < O_aeg . x + O_ka ) { if ( O_jw . y > O_aeg . y - O_tb + O_qr && O_jw . y < O_aeg . y - O_qr ) { return O_da ; } } if ( length ( O_jw - ( O_aeg + vec2f ( O_qr , - O_qr ) ) ) < O_qr ) { return O_da ; } if ( length ( O_jw - ( O_aeg + vec2f ( O_ka - O_qr , - O_qr ) ) ) < O_qr ) { return O_da ; } if ( length ( O_jw - ( O_aeg + vec2f ( O_qr , O_qr - O_tb ) ) ) < O_qr ) { return O_da ; } if ( length ( O_jw - ( O_aeg + vec2f ( O_ka - O_qr , O_qr - O_tb ) ) ) < O_qr ) { return O_da ; } return O_db ; } case O_dk : { let O_ky : vec2 < f32 > = vec2f ( O_fz [ O_ady + 1 ] , O_fz [ O_ady + 2 ] ) ; let O_kz : vec2 < f32 > = vec2f ( O_fz [ O_ady + 3 ] , O_fz [ O_ady + 4 ] ) ; let O_la : vec2 < f32 > = vec2f ( O_fz [ O_ady + 5 ] , O_fz [ O_ady + 6 ] ) ; let O_aeh = O_fz [ O_ady + 6 ] ; let O_aei = O_kz - O_ky ; let O_aej = O_la - O_ky ; let O_aek = O_jw - O_ky ; let O_rn = dot ( O_aej , O_aej ) ; let O_ro = dot ( O_aej , O_aei ) ; let O_rp = dot ( O_aej , O_aek ) ; let O_rq = dot ( O_aei , O_aei ) ; let O_rr = dot ( O_aei , O_aek ) ; let O_rs = 1.0 / ( O_rn * O_rq - O_ro * O_ro ) ; let O_cn = ( O_rq * O_rp - O_ro * O_rr ) * O_rs ; let O_cm = ( O_rn * O_rr - O_ro * O_rp ) * O_rs ; if ( ( O_cn >= 0.0 ) && ( O_cm >= 0.0 ) && ( O_cn + O_cm <= 1.0 ) ) { if ( 0.5 * ( O_ky . x * ( O_kz . y - O_la . y ) + O_kz . x * ( O_la . y - O_ky . y ) + O_la . x * ( O_ky . y - O_kz . y ) ) < 0.0 ) { return O_dc ; } else { return O_dd ; } } else { return O_db ; } } case O_dl : { let O_qp = vec2f ( O_fz [ O_ady + 1 ] , O_fz [ O_ady + 2 ] ) ; let O_bn = O_fz [ O_ady + 3 ] ; var O_ael = O_fz [ O_ady + 4 ] ; let O_aem = O_fz [ O_ady + 5 ] ; let O_aen = vec2f ( O_fz [ O_ady + 6 ] , O_fz [ O_ady + 7 ] ) ; let O_aeo = vec2f ( O_fz [ O_ady + 8 ] , O_fz [ O_ady + 9 ] ) ; let O_aep = O_jw . x - O_qp . x ; let O_aeq = O_jw . y - O_qp . y ; let O_aer = O_aep * O_aep + O_aeq * O_aeq ; if ( O_aer > O_bn * O_bn ) { return O_db ; } let O_ky = O_qp ; let O_kz = O_aen ; let O_la = O_aeo ; let O_aei = O_kz - O_ky ; let O_aej = O_la - O_ky ; let O_aek = O_jw - O_ky ; let O_rn = dot ( O_aej , O_aej ) ; let O_ro = dot ( O_aej , O_aei ) ; let O_rp = dot ( O_aej , O_aek ) ; let O_rq = dot ( O_aei , O_aei ) ; let O_rr = dot ( O_aei , O_aek ) ; let O_rs = 1.0 / ( O_rn * O_rq - O_ro * O_ro ) ; let O_cn = ( O_rq * O_rp - O_ro * O_rr ) * O_rs ; let O_cm = ( O_rn * O_rr - O_ro * O_rp ) * O_rs ; if ( ( O_cn >= 0.0 ) && ( O_cm >= 0.0 ) && ( O_cn + O_cm <= 1.0 ) ) { if ( abs ( O_aem ) >= O_ao ) { if ( O_aem > 0.0 ) { return O_dd ; } else { return O_dc ; } } else { return O_db ; } } if ( abs ( O_aem ) >= O_cr ) { if ( O_aem > 0 ) { return O_dd ; } else { return O_dc ; } } O_ael = O_ael % O_cr ; if ( O_ael < 0.0 ) { O_ael = O_ael + O_cr ; } var O_aes = atan2 ( O_aeq , O_aep ) ; if ( O_aes < 0.0 ) { O_aes = O_aes + O_cr ; } var O_aet = O_ael + O_aem ; if ( O_aem >= 0.0 ) { if ( O_aet >= O_cr ) { O_aet = O_aet - O_cr ; } if ( O_aet > O_ael ) { if ( O_aes > O_ael && O_aes < O_aet ) { return O_dd ; } else { return O_db ; } } else { if ( O_aes > O_ael || O_aes < O_aet ) { return O_dd ; } else { return O_db ; } } } else { if ( O_aet < 0.0 ) { O_aet = O_aet + O_cr ; } if ( O_aet < O_ael ) { if ( O_aes > O_ael && O_aes < O_aet ) { return O_dc ; } else { return O_db ; } } else { if ( O_aes < O_ael || O_aes > O_aet ) { return O_dc ; } else { return O_db ; } } } } case O_df : { let O_qp = vec2f ( O_fz [ O_ady + 1 ] , O_fz [ O_ady + 2 ] ) ; let O_qr = O_fz [ O_ady + 3 ] ; let O_ka = O_fz [ O_ady + 4 ] ; var O_ael = O_fz [ O_ady + 5 ] ; let O_aem = O_fz [ O_ady + 6 ] ; let O_aeu = O_ka / 2.0 ; let O_aev = length ( O_jw - O_qp ) ; if ( O_aev < ( O_qr - O_aeu ) || O_aev > ( O_qr + O_aeu ) ) { return O_db ; } var O_aet = O_ael + O_aem ; let O_aen = vec2f ( O_qp . x + cos ( O_ael ) * O_qr , O_qp . y + sin ( O_ael ) * O_qr ) ; let O_aeo = vec2f ( O_qp . x + cos ( O_aet ) * O_qr , O_qp . y + sin ( O_aet ) * O_qr ) ; if ( length ( O_jw - O_aen ) < O_aeu || length ( O_jw - O_aeo ) < O_aeu ) { return O_da ; } O_ael = O_ael % O_cr ; if ( O_ael < 0.0 ) { O_ael = O_ael + O_cr ; } var O_aes = atan2 ( O_jw . y - O_qp . y , O_jw . x - O_qp . x ) ; if ( O_aes < 0.0 ) { O_aes = O_aes + O_cr ; } if ( O_aem >= 0.0 ) { if ( O_aet >= O_cr ) { O_aet = O_aet - O_cr ; } if ( O_aet > O_ael ) { if ( O_aes > O_ael && O_aes < O_aet ) { return O_da ; } else { return O_db ; } } else { if ( O_aes > O_ael || O_aes < O_aet ) { return O_da ; } else { return O_db ; } } } else { if ( O_aet < 0.0 ) { O_aet = O_aet + O_cr ; } if ( O_aet < O_ael ) { if ( O_aes > O_ael && O_aes < O_aet ) { return O_da ; } else { return O_db ; } } else { if ( O_aes < O_ael || O_aes > O_aet ) { return O_da ; } else { return O_db ; } } } } default : { O_hf ( vec3 < f32 > ( 1 , 0 , 0 ) ) ; break ; } } return O_db ; } struct O_fh { O_wb : f32 , O_tk : vec3 < f32 > , O_wc : f32 , O_gy : vec3 < f32 > , O_cn : vec3 < f32 > , O_cm : vec3 < f32 > , O_wp : f32 , O_s : f32 , O_aew : f32 , O_wf : f32 , O_aex : f32 , } fn O_abh ( ) -> vec3 < f32 > { let O_wa = O_aey ( ) ; return O_wa . O_tk * O_wa . O_wc ; } fn O_aey ( ) -> O_fh { var O_abm = i32 ( O_bl ( ) * 3.0 ) ; if ( O_abm >= 3 ) { O_abm = 0 ; } return O_fg [ O_abm ] ; } struct O_wi { O_xr : vec3 < f32 > , O_xt : vec3 < f32 > , O_xv : f32 , O_xx : f32 , O_iy : vec3 < f32 > , O_xz : f32 , O_wj : f32 , O_wk : f32 , } struct O_wh { O_ww : vec3 < f32 > , O_wa : O_wi , } struct O_aez { O_acn : vec3 < f32 > , O_afa : vec3 < f32 > , O_ax : vec3 < f32 > , O_hd : f32 , O_uu : f32 , O_yl : f32 , O_cn : f32 , O_cm : f32 , } struct O_afb { O_wz : bool , O_afc : vec3 < f32 > , O_wy : O_aez , } fn O_afd ( O_wg : O_wi , ) -> bool { return O_wg . O_xz < 0.0 ; } fn O_afe ( O_afa : vec3 < f32 > , O_aff : vec3 < f32 > , O_hd : f32 , ) -> f32 { let O_afg = dot ( O_afa , O_aff ) ; if ( O_afg <= 0.0 ) { return 0.0 ; } return O_hd * O_hd / O_afg ; } fn O_afh ( O_ax : vec3 < f32 > , O_afi : vec3 < f32 > , O_wj : f32 , O_wk : f32 , ) -> f32 { let O_afj = O_ia ( - O_ax , O_afi ) ; if ( O_wj == 0.0 ) { return select ( 0.0 , O_ao , O_afj > 1e-5 ) ; } return max ( ( O_wj - O_afj ) * O_wk , 0.0 ) ; } struct O_afk { O_wz : bool , O_afl : vec3 < f32 > , O_xr : vec3 < f32 > , O_xv : f32 , O_xt : vec3 < f32 > , O_xx : f32 , O_afm : bool , } fn O_afn ( O_acn : vec3 < f32 > , O_afi : vec3 < f32 > , O_afl : vec3 < f32 > , O_xr : vec3 < f32 > , O_xv : f32 , O_xt : vec3 < f32 > , O_xx : f32 , O_wj : f32 , O_afm : bool , ) -> O_afk { let O_hd = dot ( O_afi , O_acn - O_afl ) ; let O_afo = O_acn - O_hd * O_afi ; let O_afp = O_hd * O_wj ; let O_afq = dot ( O_xr , O_afo - O_afl ) ; let O_afr = dot ( O_xt , O_afo - O_afl ) ; var O_bb : O_afk ; O_bb . O_afl = O_afl ; O_bb . O_xr = O_xr ; O_bb . O_xv = O_xv ; O_bb . O_xt = O_xt ; O_bb . O_xx = O_xx ; O_bb . O_afm = O_afm ; let O_afs = ! O_afm && ( O_xv == O_xx ) ; var O_aft = ( O_afp == 0.0 ) ; if ( O_afs && ! O_aft ) { let O_mn = length ( vec2 < f32 > ( O_afq , O_afr ) ) ; let O_bn = O_xv * 0.5 ; if ( O_mn >= O_bn + O_afp ) { O_bb . O_wz = false ; return O_bb ; } O_aft = ( O_mn <= abs ( O_bn - O_afp ) ) && ( O_afp < O_bn ) ; if ( O_mn > abs ( O_bn - O_afp ) ) { let O_afu = O_bn + O_afp - O_mn ; let O_afv = select ( 2.0 * min ( O_bn , O_afp ) , sqrt ( O_ip ( 2.0 * O_afp ) - O_ip ( O_mn + ( O_ip ( O_afp ) - O_ip ( O_bn ) ) / O_mn ) ) , abs ( O_ip ( O_bn ) - O_ip ( O_afp ) ) >= O_ip ( O_mn ) ) ; let O_afw = O_afu * O_afv ; let O_afx = O_ao * O_ip ( O_bn ) ; let O_afy = O_ao * O_ip ( O_afp ) ; if ( O_afw < min ( O_afx , O_afy ) ) { O_bb . O_afm = true ; O_bb . O_xr = O_iv ( O_bb . O_afl - O_afo ) ; O_bb . O_xt = O_ie ( O_bb . O_xr , O_afi , O_cs ) ; O_bb . O_xv = O_afu ; O_bb . O_xx = O_afv ; O_bb . O_afl = 0.5 * ( O_bb . O_afl + O_afo + O_bb . O_xr * ( O_afp - O_bn ) ) ; O_bb . O_wz = true ; return O_bb ; } O_aft = ( O_afy < O_afx ) ; } } else if ( ! O_afs && ! O_aft ) { let O_afz = max ( O_afq - O_afp , - O_bb . O_xv * 0.5 ) ; let O_aga = min ( O_afq + O_afp , O_bb . O_xv * 0.5 ) ; let O_agb = max ( O_afr - O_afp , - O_bb . O_xx * 0.5 ) ; let O_agc = min ( O_afr + O_afp , O_bb . O_xx * 0.5 ) ; if ( O_afz >= O_aga || O_agb >= O_agc ) { O_bb . O_wz = false ; return O_bb ; } let O_agd = O_aga - O_afz ; let O_age = O_agc - O_agb ; let O_afw = O_agd * O_age ; let O_agf = select ( O_cv , O_ao * 0.25 * O_bb . O_xv * O_bb . O_xx , ! O_bb . O_afm ) ; let O_afy = O_ao * O_ip ( O_afp ) ; if ( O_bb . O_afm || O_afw < min ( O_agf , O_afy ) ) { O_bb . O_afm = true ; let O_agg = 0.5 * ( O_afz + O_aga ) ; let O_agh = 0.5 * ( O_agb + O_agc ) ; O_bb . O_xv = O_agd ; O_bb . O_xx = O_age ; O_bb . O_afl = O_bb . O_afl + O_bb . O_xr * O_agg + O_bb . O_xt * O_agh ; O_bb . O_wz = true ; return O_bb ; } O_bb . O_afm = false ; O_aft = ( O_afy < O_agf ) ; } if ( O_aft ) { O_bb . O_afm = false ; O_bb . O_afl = O_bb . O_afl + O_bb . O_xr * O_afq + O_bb . O_xt * O_afr ; O_bb . O_xv = O_afp * 2.0 ; O_bb . O_xx = O_afp * 2.0 ; O_bb . O_wz = true ; return O_bb ; } O_bb . O_wz = true ; return O_bb ; } struct O_agi { O_uu : f32 , O_agj : vec3 < f32 > , } fn O_agk ( O_acn : vec3 < f32 > , O_agj : vec3 < f32 > , O_xr : vec3 < f32 > , O_xv : f32 , O_xt : vec3 < f32 > , O_xx : f32 , O_hs : vec2 < f32 > , O_agl : bool , ) -> O_agi { let O_cj = O_xr ; let O_jd = O_xt ; var O_vs = cross ( O_cj , O_jd ) ; var O_agm = O_agj ; let O_iy = O_agm - O_acn ; var O_agn = dot ( O_iy , O_vs ) ; if ( O_agn > 0.0 ) { O_vs = - O_vs ; O_agn = - O_agn ; } let O_ago = dot ( O_iy , O_cj ) ; let O_agp = dot ( O_iy , O_jd ) ; let O_agq = O_ago - 0.5 * O_xv ; let O_agr = O_ago + 0.5 * O_xv ; let O_ags = O_agp - 0.5 * O_xx ; let O_agt = O_agp + 0.5 * O_xx ; var O_agu = vec4 < f32 > ( - O_ags , O_agr , O_agt , - O_agq ) ; O_agu = O_agu / sqrt ( O_agu * O_agu + vec4 < f32 > ( O_agn * O_agn ) ) ; let O_agv = O_iz ( - O_agu . x * O_agu . y ) ; let O_agw = O_iz ( - O_agu . y * O_agu . z ) ; let O_agx = O_iz ( - O_agu . z * O_agu . w ) ; let O_agy = O_iz ( - O_agu . w * O_agu . x ) ; let O_agz = - ( O_agv + O_agw + O_agx + O_agy ) ; if ( O_agl ) { let O_aha = O_agu . x ; let O_ahb = O_agu . z ; let O_ahc = O_aha * O_aha ; let O_ahd = O_hs . x * O_agz + O_agx + O_agy ; let O_ahe = O_ja ( cos ( O_ahd ) * O_aha + O_ahb , sin ( O_ahd ) ) ; var O_ahf = O_jc ( 1.0 / sqrt ( O_ahe * O_ahe + O_ahc ) , O_ahe ) ; O_ahf = clamp ( O_ahf , - 1.0 , 1.0 ) ; var O_ahg = - ( O_ahf * O_agn ) / max ( sqrt ( 1.0 - O_ahf * O_ahf ) , 1e-7 ) ; O_ahg = clamp ( O_ahg , O_agq , O_agr ) ; let O_ahh = O_ip ( O_ahg ) + O_ip ( O_agn ) ; let O_ahi = O_ags / sqrt ( O_ahh + O_ip ( O_ags ) ) ; let O_ahj = O_agt / sqrt ( O_ahh + O_ip ( O_agt ) ) ; let O_ahk = O_ahi + O_hs . y * ( O_ahj - O_ahi ) ; let O_ahl = O_ahk * O_ahk ; let O_ahm = select ( O_agt , O_ahk * sqrt ( O_ahh / ( 1.0 - O_ahl ) ) , O_ahl < 1.0 - 1e-6 ) ; O_agm = O_acn + O_ahg * O_cj + O_ahm * O_jd + O_agn * O_vs ; } var O_bb : O_agi ; O_bb . O_agj = O_agm ; if ( O_agz < 1e-5 || O_it ( O_ir ( O_agu ) ) > 0.99999 ) { let O_hd = O_id ( O_iy ) ; O_bb . O_uu = O_ja ( - O_hd * O_hd * O_hd , ( O_agn * O_xv * O_xx ) ) ; } else { O_bb . O_uu = 1.0 / O_agz ; } return O_bb ; } fn O_wv ( O_ahn : O_wh , O_aho : vec3 < f32 > , O_ahp : vec3 < f32 > , O_hs : vec2 < f32 > , O_agl : bool , O_ahq : bool , ) -> O_afb { var O_xr = O_ahn . O_wa . O_xr ; var O_xt = O_ahn . O_wa . O_xt ; var O_xv = O_ahn . O_wa . O_xv ; var O_xx = O_ahn . O_wa . O_xx ; let O_afa = - O_ahn . O_wa . O_iy ; let O_xz = abs ( O_ahn . O_wa . O_xz ) ; var O_afm = O_ahn . O_wa . O_xz > 0.0 ; var O_ahr = O_ahp ; var O_wy : O_aez ; O_wy . O_acn = O_ahp ; O_wy . O_afa = O_afa ; O_wy . O_ax = vec3 < f32 > ( 0.0 ) ; O_wy . O_hd = 0.0 ; O_wy . O_uu = 0.0 ; O_wy . O_yl = 0.0 ; O_wy . O_cn = 0.0 ; O_wy . O_cm = 0.0 ; if ( O_ahq ) { if ( O_afm ) { O_ahr = O_ahr + O_hv ( O_xr * ( O_xv * 0.5 ) , O_xt * ( O_xx * 0.5 ) , O_hs ) ; } else { O_ahr = O_ahr + O_hy ( O_xr * ( O_xv * 0.5 ) , O_xt * ( O_xx * 0.5 ) , O_hs ) ; } O_wy . O_uu = O_xz ; } else { if ( O_ahn . O_wa . O_wk > 0.0 ) { let O_ahs = O_afn ( O_aho , O_afa , O_ahr , O_xr , O_xv , O_xt , O_xx , O_ahn . O_wa . O_wj , O_afm ) ; if ( ! O_ahs . O_wz ) { return O_afb ( false , O_ahp , O_wy ) ; } O_ahr = O_ahs . O_afl ; O_xr = O_ahs . O_xr ; O_xv = O_ahs . O_xv ; O_xt = O_ahs . O_xt ; O_xx = O_ahs . O_xx ; O_afm = O_ahs . O_afm ; } if ( O_afm ) { let O_aht = O_agk ( O_aho , O_ahr , O_xr , O_xv , O_xt , O_xx , O_hs , O_agl ) ; O_wy . O_uu = O_aht . O_uu ; O_ahr = O_aht . O_agj ; } else { if ( O_ahn . O_wa . O_wj == 0.0 ) { O_wy . O_uu = 1.0 ; } else { if ( O_agl ) { O_ahr = O_ahr + O_hy ( O_xr * ( O_xv * 0.5 ) , O_xt * ( O_xx * 0.5 ) , O_hs ) ; } O_wy . O_uu = 4.0 * O_t / ( O_xv * O_xx ) ; } } } O_wy . O_acn = O_ahr ; let O_bu = O_ix ( O_wy . O_acn - O_aho ) ; O_wy . O_ax = O_bu . xyz ; O_wy . O_hd = O_bu . w ; O_wy . O_yl = O_t * O_xz ; if ( O_ahn . O_wa . O_wk > 0.0 ) { let O_wf = O_afh ( O_wy . O_ax , O_afa , O_ahn . O_wa . O_wj , O_ahn . O_wa . O_wk ) ; O_wy . O_yl = O_wy . O_yl * O_wf ; } if ( O_ahq || ( ! O_afm && O_ahn . O_wa . O_wj > 0.0 ) ) { O_wy . O_uu = O_wy . O_uu * O_afe ( O_afa , - O_wy . O_ax , O_wy . O_hd ) ; } let O_wz = O_ahq || ( O_wy . O_yl > 0.0 ) ; return O_afb ( O_wz , O_ahr , O_wy ) ; } fn O_ahu ( O_wf : f32 , ) -> f32 { let O_ahv = 0.5 * max ( O_wf , 0.0 ) ; if ( O_ahv <= 0.0 ) { return O_cv ; } let O_wj = select ( O_cv , tan ( O_ahv ) , O_wf < O_ao ) ; if ( O_ahv > 0.05 ) { return 1.0 / ( O_wj - O_ahv ) ; } else { let O_ahw = O_ahv * O_ahv * O_ahv ; return 3.0 / O_ahw ; } } struct O_ahx { O_wj : f32 , O_wk : f32 , } fn O_we ( O_wf : f32 , ) -> O_ahx { let O_ahv = 0.5 * max ( O_wf , 0.0 ) ; var O_bb : O_ahx ; if ( O_ahv <= 0.0 ) { O_bb . O_wj = 0.0 ; O_bb . O_wk = O_cv ; return O_bb ; } O_bb . O_wj = select ( O_cv , tan ( O_ahv ) , O_wf < O_ao ) ; if ( O_ahv > 0.05 ) { O_bb . O_wk = 1.0 / ( O_bb . O_wj - O_ahv ) ; } else { let O_ahw = O_ahv * O_ahv * O_ahv ; O_bb . O_wk = 3.0 / O_ahw ; } return O_bb ; } ";UO.addShaderCode(o4e);var s4e=class Vbe{constructor(t,e,r,i,n,s,a){this.gpu=t,this.camera=e,this.light=r,this.model=i,this.background=n,this.ray=s,this.pixelTool=a,this.parameter=new ddt(t,n,r),this.initBuffers(),this.initLayout(),this.initBind(),this.initPipeline()}static async warm(t,e){mS.time("path tracing warm"),await t.device.queue.onSubmittedWorkDone(),this.cache.set(t,await this.createCache(t,e)),await t.device.queue.onSubmittedWorkDone(),mS.timeEnd("path tracing warm")}static async createCache(t,e){let r=l(t,[["storage","uniform","uniform","uniform","uniform","uniform","float","uniform"],["float","float","float","float","float","float","float","read-only-storage"],["read-only-storage","read-only-storage","read-only-storage","read-only-storage","read-only-storage","read-only-storage","storage","uniform","uniform"],["float","storage"]]),i=await a("main","path tracing pipeline  entrypoint main"),n=await a("main_hit","ray tracing calculation 1"),s=await a("main_demo","ray ");return{layouts:{0:r[0],1:r[1],2:r[2],3:r[3]},pipeline:{pathTracing:i,rayHitQuery:n,directColor:s}};async function a(h,u){let d=t.device.createPipelineLayout({bindGroupLayouts:Object.values(r)}),p={Image_Width:e.width,Image_Height:e.height};return await t.createComputePipelineAsync(o4e,h,u,d,p)}function l(h,u){return u.map(d=>{let p=[];return d.forEach((m,g)=>{let y={binding:g,visibility:GPUShaderStage.COMPUTE},b=c(m);p.push({...y,...b})}),h.device.createBindGroupLayout({entries:p})})}function c(h){switch(h){case"uniform":case"storage":case"read-only-storage":return{buffer:{type:h}};case"float":case"unfilterable-float":case"depth":case"sint":case"uint":return{texture:{sampleType:h}}}}}getParameter(){return this.parameter}getBuffer(){return this.buffers}rebind(){this.initBind()}reset(){let t=this.gpu.device.createCommandEncoder();this.buffers.geometry.clear(t),this.buffers.hdrColor.clear(t),this.buffers.depth.clear(t),this.buffers.position.clear(t),this.gpu.submit(t),this.updateParameter()}run(){this.updateParameter();{let t=this.gpu.device.createCommandEncoder(),e=t.beginComputePass();e.setPipeline(this.pipelines.pathTracing);for(let[r,i]of Object.entries(this.bindGroups))e.setBindGroup(Number(r),i);e.dispatchWorkgroups(this.pixelTool.workgroupInfo.count),e.end(),this.gpu.submit(t)}this.geometryDismantle.run()}async runAsync(){await this.gpu.device.queue.onSubmittedWorkDone();let t=performance.now();return this.run(),await this.gpu.device.queue.onSubmittedWorkDone(),performance.now()-t}async runRayHitQueryAsync(){await this.gpu.device.queue.onSubmittedWorkDone();{let e=this.gpu.device.createCommandEncoder(),r=e.beginComputePass();r.setPipeline(this.pipelines.rayHitQuery);for(let[i,n]of Object.entries(this.bindGroups))r.setBindGroup(Number(i),n);r.dispatchWorkgroups(1),r.end(),this.gpu.submit(e)}await this.gpu.device.queue.onSubmittedWorkDone();let t=await this.buffers.log.read();return{isLight:t[2]===5,...t[1]===-1?{}:{materialIndex:t[0],depth:t[1]}}}runDirectColor(){let t=this.gpu.device.createCommandEncoder(),e=t.beginComputePass();e.setPipeline(this.pipelines.directColor);for(let[r,i]of Object.entries(this.bindGroups))e.setBindGroup(Number(r),i);e.dispatchWorkgroups(Math.ceil(this.getSize().width/8),Math.ceil(this.getSize().height/8)),e.end(),this.gpu.submit(t),this.geometryDismantle.run()}async runDirectColorAsync(){await this.gpu.device.queue.onSubmittedWorkDone();let t=performance.now();return this.runDirectColor(),await this.gpu.device.queue.onSubmittedWorkDone(),performance.now()-t}getSize(){return this.camera.size}updateParameter(){let t=this.pixelTool.pixelStart,e=Math.random();this.parameter.update({pixelStart:t,randomSeed:e})}initPipeline(){this.pipelines=Vbe.cache.get(this.gpu).pipeline}initBuffers(){let t=this.gpu.createStorageDynamicBuffer(this.camera.size.width*this.camera.size.height*4*4,"RayTracerCalculationRenderer image buffer");this.geometryDismantle=new udt(this.gpu,this.camera.size,t),this.buffers={depth:this.geometryDismantle.getBuffers().depth,position:this.geometryDismantle.getBuffers().position,hdrColor:this.geometryDismantle.getBuffers().hdrColor,normal:this.geometryDismantle.getBuffers().normal,type:this.geometryDismantle.getBuffers().type,geometry:t,pixel:this.pixelTool.buffer,log:this.gpu.createDynamicBuffer(3,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,"log buffer")}}initLayout(){this.layouts=Vbe.cache.get(this.gpu).layouts}initBind(){this.bindGroups={0:this.gpu.device.createBindGroup({label:"ray tracing calculation bind group 0",layout:this.layouts[0],entries:[{binding:0,resource:{buffer:this.buffers.geometry.getBuffer()}},{binding:1,resource:{buffer:this.parameter.buffer.getBuffer()}},{binding:2,resource:{buffer:this.camera.buffer.getBuffer()}},{binding:3,resource:{buffer:this.model.pcb.bvhIndex.getBuffer()}},{binding:4,resource:{buffer:this.model.pcb.material.getBuffer()}},{binding:5,resource:{buffer:this.model.board.parameter.getBuffer()}},{binding:6,resource:this.background.texture.view},{binding:7,resource:{buffer:this.light.buffer.getBuffer()}}]}),1:this.model.material.bindGroup,2:this.gpu.device.createBindGroup({label:"ray tracing calculation bind group 2",layout:this.layouts[2],entries:[{binding:0,resource:{buffer:this.ray.getBuffer()}},{binding:1,resource:{buffer:this.model.obj.getBVH().getBuffer()}},{binding:2,resource:{buffer:this.model.obj.getFace().getBuffer()}},{binding:3,resource:{buffer:this.model.obj.getVertexAndNormal().getBuffer()}},{binding:4,resource:{buffer:this.model.pcb.bvh.getBuffer()}},{binding:5,resource:{buffer:this.model.pcb.pt.getBuffer()}},{binding:6,resource:{buffer:this.buffers.log.getBuffer()}},{binding:7,resource:{buffer:this.model.pcb.layerInfo.getBuffer()}},{binding:8,resource:{buffer:this.model.occluder.buffer.getBuffer()}}]}),3:this.gpu.device.createBindGroup({label:"ray tracing calculation bind group 3",layout:this.layouts[3],entries:[{binding:0,resource:this.model.board.texture.view},{binding:1,resource:{buffer:this.buffers.pixel.getBuffer()}}]})}}};s4e.cache=new Map;var V2e=s4e,KJ=class{static get lambert(){return this.cache[0]}static get disney(){return this.cache[1]}static get(o){return this.cache.find(t=>t[0]===o)}static all(){return this.cache.map(o=>o[0])}};KJ.cache=[["lambert",0],["disney",1]];var ddt=class{constructor(o,t,e){this.gpu=o,this._background=t,this._light=e,this._maxRayBounces=1,this._randomSeed=Math.random(),this._pixelStart=0,this._diffuseMode=KJ.disney,this._hideBoard=!1,this._hideOccluder=!1,this._hidePCB=!1,this._hideOBJ=!1,this._hideLight=!1,this._hideCoordinate=!1,this.buffer=this.gpu.createUniformDynamicBuffer(this._getData(),"parameters buffer of raytracer."),this._light.setListen(this._update.bind(this)),this._background.setListen(this._update.bind(this))}get hideCoordinate(){return this._hideCoordinate}set hideCoordinate(o){this._hideCoordinate=o,this._update()}get hideBoard(){return this._hideBoard}set hideBoard(o){this._hideBoard=o,this._update()}get hideOccluder(){return this._hideOccluder}set hideOccluder(o){this._hideOccluder=o,this._update()}get hidePCB(){return this._hidePCB}set hidePCB(o){this._hidePCB=o,this._update()}get hideOBJ(){return this._hideOBJ}set hideOBJ(o){this._hideOBJ=o,this._update()}get hideLight(){return this._hideLight}set hideLight(o){this._hideLight=o,this._update()}get maxRayBounces(){return this._maxRayBounces}set diffuseMode(o){this._diffuseMode=o,this._update()}get diffuseMode(){return this._diffuseMode}setMaxRayBounces(o){this._maxRayBounces=o,this._update()}update(o){let{pixelStart:t,randomSeed:e}=o;this._randomSeed=e,this._pixelStart=t,this._update()}_getData(){let o={random_seed:this._randomSeed,pixelStart:this._pixelStart,max_ray_bounces:this._maxRayBounces,diffuseMode:this._diffuseMode[1],hideBoard:this._hideBoard,hideOccluder:this._hideOccluder,hidePCB:this._hidePCB,hideOBJ:this._hideOBJ,hideLight:this._hideLight,hide_coordinate:this._hideCoordinate,backgroundRotation:this._background.getRotatoin(),backgroundIntensity:this._background.getIntensity(),backgroundColor:this._background.getColor(),backgroundSource:this._background.isUseColor(),lightIsOpen:this._light.getIsOpen()},t=R2(o);return new Float32Array(t)}_update(){this.gpu.writeBuffer(this.buffer,0,new Float32Array(this._getData()))}},pdt="struct O_a { @ builtin ( position ) O_b : vec4 < f32 > , @ location ( 0 ) O_c : vec2f , } const O_d = array < vec4 < f32 > , 6 > ( vec4 ( - 1 , 1 , 0 , 0 ) , vec4 ( - 1 , - 1 , 0 , 1 ) , vec4 ( 1 , - 1 , 1 , 1 ) , vec4 ( - 1 , 1 , 0 , 0 ) , vec4 ( 1 , - 1 , 1 , 1 ) , vec4 ( 1 , 1 , 1 , 0 ) ) ; @ vertex fn vertex_main ( @ builtin ( vertex_index ) O_e : u32 , ) -> O_a { var O_f : O_a ; O_f . O_b = vec4 < f32 > ( O_d [ O_e ] . xy , 0.0 , 1.0 ) ; O_f . O_c = O_d [ O_e ] . zw ; return O_f ; } ",fdt="struct O_a { O_b : f32 , O_c : f32 , O_d : f32 , O_e : f32 , } @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_f : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_g : O_a ; @ fragment fn frag_main ( @ location ( 0 ) O_h : vec2 < f32 > , ) -> @ location ( 0 ) vec4f { var O_i = O_j ( O_h ) ; if ( O_g . O_b == 1.0 ) { O_i = O_k ( O_i ) ; } if ( O_g . O_c == 0.0 ) { O_i = O_l ( O_i ) ; } return vec4f ( O_i , 0 ) ; } fn O_j ( O_h : vec2 < f32 > , ) -> vec3f { let O_m = u32 ( O_h . x * O_g . O_d ) ; let O_n = u32 ( O_h . y * O_g . O_e ) ; let O_o = u32 ( O_m + O_n * u32 ( O_g . O_d ) ) ; return O_f [ O_o ] . rgb ; } fn O_l ( O_i : vec3f , ) -> vec3f { return vec3f ( select ( O_i * 12.92 , 1.055 * pow ( O_i , vec3f ( 1.0 / 2.4 ) ) - 0.055 , O_i > vec3f ( 0.0031308 ) ) ) ; } fn O_k ( O_i : vec3 < f32 > , ) -> vec3 < f32 > { const O_p : f32 = 2.51 ; const O_q : f32 = 0.03 ; const O_r : f32 = 2.43 ; const O_s : f32 = 0.59 ; const O_t : f32 = 0.14 ; let O_m = min ( O_i , vec3 < f32 > ( 10000.0 ) ) ; return min ( ( O_m * ( O_p * O_m + O_q ) ) / ( O_m * ( O_r * O_m + O_s ) + O_t ) , vec3f ( 1.0 ) ) ; } ",mdt=class{constructor(o,t){this.gpu=o,this.size=t,this.displayDevice="sRGB",this.viewTransform="Standard",this.buffer=this.gpu.createUniformDynamicBuffer(this.getData(),"parameters buffer of DrawColorGamma.")}getDisplayDevice(){return this.displayDevice}getViewTransform(){return this.viewTransform}setDisplayDevice(o){this.displayDevice=o,this.update()}setViewTransform(o){this.viewTransform=o,this.update()}getData(){let o={viewTransform:r(this.viewTransform),displayDevice:e(this.displayDevice),width:this.size.width,height:this.size.height},t=R2(o);return new Float32Array(t);function e(i){switch(i){case"sRGB":return 0;case"Display p3":return 1}}function r(i){switch(i){case"Standard":return 0;case"ACES":return 1}}}update(){this.gpu.writeBuffer(this.buffer,0,new Float32Array(this.getData()))}},a4e=class{constructor(o,t,e){this.gpu=o,this.context=t,this.input=e,this.prameter=new mdt(o,t.canvas),this.initializeBuffers(),this.initializePipeline(),this.initializeBindGroup()}get size(){let o=this.context.canvas;return{width:o.clientWidth,height:o.clientHeight}}run(){let o=this.gpu.device.createCommandEncoder(),t=o.beginRenderPass({colorAttachments:[{view:this.context.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]});t.setPipeline(this.pipeline),t.setBindGroup(0,this.bindGroup),t.draw(6,1,0,0),t.end(),this.gpu.submit(o)}async runAsync(){this.run(),await this.gpu.device.queue.onSubmittedWorkDone()}initializeBuffers(){this.buffers={color:this.input,parameter:this.prameter.buffer}}initializeBindGroup(){this.bindGroup=this.gpu.createBindGroup("RaytracerRenderDraw",this.pipeline.getBindGroupLayout(0),0,this.buffers.color,1,this.buffers.parameter)}initializePipeline(){this.pipeline=this.gpu.device.createRenderPipeline({label:"image rendering",layout:"auto",vertex:{module:this.gpu.createShaderModule(pdt),entryPoint:"vertex_main"},fragment:{module:this.gpu.createShaderModule(fdt),entryPoint:"frag_main",targets:[{format:"rgba8unorm"}]},primitive:{topology:"triangle-list"}})}},gdt=class{constructor(){}},G2e=class{constructor(o){this.gpu=o}_submitEncoder(o){if(o===void 0){let t=this.gpu.device.createCommandEncoder();this._submitEncoder(t),this.gpu.submit(t)}else if(o instanceof GPUCommandEncoder){let t=o.beginComputePass();this._submitEncoder(t),t.end()}else o instanceof GPUComputePassEncoder&&this._writePassEncoder(o)}async _submitEncoderAsync(){await this.isGPUBusy(this.gpu);let o=performance.now();return this._submitEncoder(),await this.gpu.device.queue.onSubmittedWorkDone(),performance.now()-o}async isGPUBusy(o){let t=performance.now();return await o.device.queue.onSubmittedWorkDone(),performance.now()-t>1}},l4e="struct O_a { O_b : vec3 < f32 > , O_c : vec3 < f32 > , O_d : vec3 < f32 > , O_e : vec3 < f32 > , O_f : vec3 < f32 > , O_g : f32 , O_h : f32 , O_i : f32 , O_j : f32 , O_k : vec3f , } struct O_l { O_m : f32 , O_n : f32 , } @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_o : array < f32 > ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_p : O_a ; @ group ( 0 ) @ binding ( 2 ) var < uniform > O_q : O_l ; @ group ( 0 ) @ binding ( 3 ) var < storage , read_write > O_r : array < vec2 < f32 > > ; override Image_Width : u32 ; override Image_Height : u32 ; var < private > O_m : f32 ; @ compute @ workgroup_size ( 64 ) fn main ( @ builtin ( global_invocation_id ) O_s : vec3 < u32 > , ) { let O_t = vec2 < u32 > ( u32 ( O_r [ O_s . x + u32 ( O_q . O_n ) ] . x ) , u32 ( O_r [ O_s . x + u32 ( O_q . O_n ) ] . y ) ) ; if ( O_t . x >= Image_Width || O_t . y >= Image_Height ) { return ; } let O_u = O_t . x + O_t . y * Image_Width ; let O_v = Image_Width * Image_Height * 8 - u32 ( O_u ) * 8 ; O_m = f32 ( O_u ) * O_q . O_m ; var O_w = O_p . O_c ; O_w = O_w + ( f32 ( O_t . x ) + O_x ( ) ) * O_p . O_d ; O_w = O_w + ( f32 ( O_t . y ) + O_x ( ) ) * O_p . O_e ; O_o [ O_v ] = O_w . x ; O_o [ O_v + 1 ] = O_w . y ; O_o [ O_v + 2 ] = O_w . z ; O_o [ O_v + 3 ] = 0 ; let O_b = O_p . O_b ; var O_y = normalize ( O_b - O_w ) ; O_o [ O_v + 4 ] = O_y . x ; O_o [ O_v + 5 ] = O_y . y ; O_o [ O_v + 6 ] = O_y . z ; O_o [ O_v + 7 ] = 0 ; } fn O_x ( ) -> f32 { let O_z : f32 = 1664525.0 ; let O_aa : f32 = 1013904223.0 ; let O_ab : f32 = 4294967296.0 ; let O_ac = fract ( ( O_z * O_m + O_aa ) / O_ab ) ; O_m = 100000 * O_ac ; return O_ac ; } ";UO.addShaderCode(l4e);var ydt=class{constructor(o){this._randomSeed=Math.random(),this._pixelCount=1,this._pixelSize=64;let t="ray generator ranfom pixel parmater";this.buffer=o.createUniformDynamicBuffer(this._getData(),t)}get pixelAllSize(){return this._pixelCount*this._pixelSize}update(o){this._randomSeed=Math.random(),this.buffer.write(0,this._getData(o))}_getData(o=0){let t={randomSeed:this._randomSeed,pixelStart:o},e=R2(t);return new Float32Array(e)}},bdt=class extends G2e{constructor(o,t,e){super(o),this._gpu=o,this._camera=t,this._pixel=e,this._parmater=new ydt(o),this._renderCount=0,this._initializeBuffers(),this._initializeLayout(),this._initializePipeline(),this._initializeBindgroup()}get buffer(){return this._buffer}get _maxRenderCount(){return Math.ceil(this._size.width*this._size.height/this._parmater.pixelAllSize)}get _size(){return this._camera.size}run(){let o=this._renderCount*this._parmater.pixelAllSize;this._parmater.update(o),this._submitEncoder(),this._renderCount++,this._renderCount===this._maxRenderCount&&this.reset()}reset(){this._renderCount=0;let o=this._size.width*this._size.height*8;this.buffer.ray.write(0,new Float32Array(new Array(o).fill(0)))}async runAsync(){let o=this._renderCount*this._parmater.pixelAllSize;this._parmater.update(o),await this._submitEncoderAsync(),this._renderCount++,this._renderCount===this._maxRenderCount&&this.reset()}async isEmpty(){let o=await this._buffer.ray.read(),t=Array.from(o).filter(r=>r),e=new Set(t);debugger;return!1}_writePassEncoder(o){o.setPipeline(this._pipeline),o.setBindGroup(0,this._bindGroup),o.dispatchWorkgroups(this._parmater._pixelCount)}_initializeBuffers(){let o=this._size.width*this._size.height*8,t=this._gpu.createStorageDynamicBuffer(o,"ray"),e=this._camera.buffer,r=this._parmater.buffer,i=this._pixel;this._buffer={ray:t,camera:e,parmater:r,pixel:i}}_initializeLayout(){let o=[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}}];this._layout=this.gpu.device.createBindGroupLayout({entries:o})}_initializePipeline(){this._pipeline=this._gpu.createComputePipeline(l4e,"main","ray generate",this.gpu.device.createPipelineLayout({bindGroupLayouts:[this._layout]}),{Image_Width:this._size.width,Image_Height:this._size.height})}_initializeBindgroup(){this._bindGroup=this._gpu.createBindGroup("RaytracerRayGenerateRandom",this._layout,0,this._buffer.ray,1,this._buffer.camera,2,this._buffer.parmater,3,this._buffer.pixel)}},c4e="struct O_a { O_b : vec3 < f32 > , O_c : vec3 < f32 > , O_d : vec3 < f32 > , O_e : vec3 < f32 > , O_f : vec3 < f32 > , O_g : f32 , O_h : f32 , O_i : f32 , O_j : f32 , O_k : vec3f , } @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_l : array < f32 > ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_m : O_a ; @ group ( 0 ) @ binding ( 2 ) var < uniform > O_n : f32 ; override Image_Width : u32 ; override Image_Height : u32 ; var < private > O_o : f32 ; @ compute @ workgroup_size ( 8 , 8 ) fn main ( @ builtin ( global_invocation_id ) O_p : vec3 < u32 > , ) { if ( O_p . x >= Image_Width || O_p . y >= Image_Height ) { return ; } let O_q = O_p . x + O_p . y * Image_Width ; let O_r = Image_Width * Image_Height * 8 - u32 ( O_q ) * 8 - 8 ; O_o = f32 ( O_q ) * O_n ; var O_s = O_m . O_c ; O_s = O_s + ( f32 ( O_p . x ) + O_t ( ) ) * O_m . O_d ; O_s = O_s + ( f32 ( O_p . y ) + O_t ( ) ) * O_m . O_e ; O_l [ O_r ] = O_s . x ; O_l [ O_r + 1 ] = O_s . y ; O_l [ O_r + 2 ] = O_s . z ; O_l [ O_r + 3 ] = 0 ; let O_b = O_m . O_b ; var O_u = normalize ( O_b - O_s ) ; O_l [ O_r + 4 ] = O_u . x ; O_l [ O_r + 5 ] = O_u . y ; O_l [ O_r + 6 ] = O_u . z ; O_l [ O_r + 7 ] = 0 ; } fn O_t ( ) -> f32 { let O_v : f32 = 1664525.0 ; let O_w : f32 = 1013904223.0 ; let O_x : f32 = 4294967296.0 ; let O_y = fract ( ( O_v * O_o + O_w ) / O_x ) ; O_o = 100000 * O_y ; return O_y ; } fn O_z ( O_aa : vec3f , O_ab : vec3f , O_ac : vec3f , O_ad : f32 , ) -> vec3f { let O_ae = 2.0 * 3.1415926 * O_t ( ) ; let O_af = O_t ( ) * O_ad ; let O_ag = O_af * cos ( O_ae ) ; let O_ah = O_af * sin ( O_ae ) ; return O_aa + O_ag * O_ab + O_ah * O_ac ; } ";UO.addShaderCode(c4e);var Pdt=class extends G2e{constructor(o,t){super(o),this._gpu=o,this._camera=t,this._buffer={ray:this._gpu.createStorageDynamicBuffer(this._size.width*this._size.height*8,"ray"),camera:this._camera.buffer,random:this._gpu.createUniformDynamicBuffer(1,"random")};let e=this.gpu.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}}]});this._pipeline=this._gpu.createComputePipeline(c4e,"main","ray generate",this.gpu.device.createPipelineLayout({bindGroupLayouts:[e]}),{Image_Width:this._size.width,Image_Height:this._size.height}),this._bindGroup=this._gpu.createBindGroup("RaytracerRayGenerateRandom",e,0,this._buffer.ray,1,this._buffer.camera,2,this._buffer.random)}get ray(){return this._buffer.ray}get _size(){return this._camera.size}run(){this._buffer.random.write(0,new Float32Array([Math.random()])),this._submitEncoder()}async runAsync(){return this._buffer.random.write(0,new Float32Array([Math.random()])),await this._submitEncoderAsync()}async runTest(){await this.runAsync();let o=await this.ray.read("f32");console.log(o)}_writePassEncoder(o){o.setPipeline(this._pipeline),o.setBindGroup(0,this._bindGroup),o.dispatchWorkgroups(Math.ceil(this._size.width/8),Math.ceil(this._size.height/8))}},h4e="struct O_a { O_b : vec3 < f32 > , O_c : vec3 < f32 > , O_d : vec3 < f32 > , O_e : vec3 < f32 > , O_f : vec3 < f32 > , O_g : f32 , O_h : f32 , O_i : f32 , O_j : f32 , O_k : vec3f , } @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_l : array < f32 > ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_m : O_a ; override Image_Width : u32 ; override Image_Height : u32 ; @ compute @ workgroup_size ( 8 , 8 ) fn main ( @ builtin ( global_invocation_id ) O_n : vec3 < u32 > , ) { if ( O_n . x >= Image_Width || O_n . y >= Image_Height ) { return ; } let O_o = O_n . x + O_n . y * Image_Width ; let O_p = Image_Width * Image_Height * 8 - u32 ( O_o ) * 8 ; var O_q = O_m . O_c ; O_q = O_q + f32 ( O_n . x ) * O_m . O_d ; O_q = O_q + f32 ( O_n . y ) * O_m . O_e ; O_l [ O_p ] = O_q . x ; O_l [ O_p + 1 ] = O_q . y ; O_l [ O_p + 2 ] = O_q . z ; O_l [ O_p + 3 ] = 0 ; let O_b = O_m . O_b ; var O_r = normalize ( O_b - O_q ) ; O_l [ O_p + 4 ] = O_r . x ; O_l [ O_p + 5 ] = O_r . y ; O_l [ O_p + 6 ] = O_r . z ; O_l [ O_p + 7 ] = 0 ; } ";UO.addShaderCode(h4e);var Tdt=class extends G2e{constructor(o,t,e){super(o),this._gpu=o,this._camera=t,this._size=e,this._buffer={ray:this._gpu.createStorageDynamicBuffer(this._size.width*this._size.height*8,"ray"),camera:this._camera.buffer,random:this._gpu.createUniformDynamicBuffer(1,"random")};let r=this.gpu.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}}]});this._pipeline=this._gpu.createComputePipeline(h4e,"main","ray generate",this.gpu.device.createPipelineLayout({bindGroupLayouts:[r]}),{Image_Width:this._size.width,Image_Height:this._size.height}),this._bindGroup=this._gpu.createBindGroup("RaytracerRayGenerateRandom",r,0,this._buffer.ray,1,this._buffer.camera,2,this._buffer.random)}get ray(){return this._buffer.ray}run(){this._buffer.random.write(0,new Float32Array([Math.random()])),this._submitEncoder()}async runAsync(){return this._buffer.random.write(0,new Float32Array([Math.random()])),await this._submitEncoderAsync()}async runTest(){await this.runAsync();let o=await this.ray.read("f32");console.log(o)}_writePassEncoder(o){o.setPipeline(this._pipeline),o.setBindGroup(0,this._bindGroup),o.dispatchWorkgroups(Math.ceil(this._size.width/8),Math.ceil(this._size.height/8))}},u4e=class extends gdt{static std(o,t,e){return new Tdt(o,t,e)}static random(o,t){return new Pdt(o,t)}static random_pixel(o,t,e){return new bdt(o,t,e)}},d4e=class{setEnableDenoise(o){throw new Error("Method not implemented.")}getEnableDenoise(){throw new Error("Method not implemented.")}getMaxSampleCount(){throw new Error("Method not implemented.")}setMaxSampleCount(o){throw new Error("Method not implemented.")}getPathTracing(){throw new Error("Method not implemented.")}getDraw(){throw new Error("Method not implemented.")}getLut(){throw new Error("Method not implemented.")}setReset(){throw new Error("Method not implemented.")}render(){throw new Error("Method not implemented.")}renderAsync(){throw new Error("Method not implemented.")}hitFace(){throw new Error("Method not implemented.")}};function Idt(o,t){let e=[];for(let n=0;n<t.height;n++)for(let s=0;s<t.width;s++){let a=Math.random();e.push({x:s,y:n,z:a})}e.sort((n,s)=>n.z-s.z);let r=e.map(n=>[n.x,n.y]).flat(),i=`width:${t.width}+height:${t.height}.random coordinates buffer.`;return o.createStorageDynamicBuffer(r,i)}function fDe(o){if(o.length===0)return NaN;let t=o.length,e=0;for(let r=0;r<t;r++)e+=o[r];return e/t}var p4e=class{constructor(o,t){this._size=t,this.times=[],this._pixelStart=0,mS.time("buildRandomCoordinatesBuffer"),this.buffer=Idt(o,t),mS.timeEnd("buildRandomCoordinatesBuffer"),this.workgroupInfo={size:64,count:1}}set workgroupCount(o){o=Math.max(1,o),o=Math.min(1024,o),this.workgroupInfo.count=o}get pixelStart(){return this._pixelStart}get workgroupCount(){return this.workgroupInfo.count}get parallelCount(){return this.workgroupInfo.size*this.workgroupInfo.count}get singleSampleRenderCount(){return Math.ceil(this._size.width*this._size.height/this.parallelCount)}newRender(){this._pixelStart=0,this.time=performance.now()}isFinallyRender(){return this._pixelStart+this.parallelCount>=this._size.width*this._size.height}addRenderCount(){if(this._pixelStart+=this.parallelCount,!this.time)this.time=performance.now();else{let o=performance.now()-this.time;this.time=performance.now(),this.times.push(o)}this.times.length>8&&(Cdt(this.times)<100?this.workgroupCount=this.workgroupCount+1:this.workgroupCount=this.workgroupCount-1,this.times.length=0)}reset(){window.location.href.includes("do_not_reset_work_groupcount")||(this.workgroupCount=1),this.times.length=0,this.time=void 0,this._pixelStart=0}async test(){let o=Array.from(await this.buffer.read()),t=[];for(let e=0;e<this.parallelCount;e++)t.push(o[this._pixelStart+e]);console.log(o),console.log(t);debugger}};function Cdt(o){let t=fDe(o),e=o.filter(r=>r<2*t);return fDe(e)}var Sdt=class f4e extends d4e{constructor(t,e,r,i,n,s,a){super(),this.camera=t,this.light=e,this.model=r,this.background=i,this.rayGenerator=n,this.pathTracing=s,this.draw=a}static async build(t,e,r,i,n,s,a){let l=u4e.random(t,e),c=new V2e(t,e,r,i,n,l.ray,new p4e(t,s.canvas)),h=new a4e(t,s,c.getBuffer().hdrColor);return new f4e(e,r,i,n,l,c,h)}async renderAsync(){(this.camera.check()||this.model.checkAndUpdate()||this.light.checkAndUpdate()||this.background.check())&&(await this.rayGenerator.runAsync(),this.pathTracing.reset()),await this.rayGenerator.runAsync(),await this.pathTracing.runDirectColorAsync(),await this.draw.runAsync()}setReset(){}getPathTracing(){return this.pathTracing}},m4e="@ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_a : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 1 ) var < storage , read > O_b : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read > O_c : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 3 ) var < storage , read > O_d : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 4 ) var < storage , read > O_e : array < f32 > ; @ group ( 0 ) @ binding ( 5 ) var < storage , read > O_f : array < f32 > ; override Width : u32 ; override Height : u32 ; @ compute @ workgroup_size ( 8 , 8 ) fn main ( @ builtin ( global_invocation_id ) O_g : vec3 < u32 > , ) { if ( O_g . x >= Width || O_g . y >= Height ) { return ; } let O_h = O_g . x + O_g . y * u32 ( Width ) ; let O_i = O_d [ O_h ] ; let O_j : u32 = 10 ; let O_k : u32 = O_j / 2 ; var O_l : vec3f ; var O_m = 0 ; for ( var O_n : u32 = 0 ; O_n < O_j ; O_n += 1 ) { for ( var O_o : u32 = 0 ; O_o < O_j ; O_o += 1 ) { let O_p = O_g . x + ( O_n - O_k ) ; let O_q = O_g . y + ( O_o - O_k ) ; if ( O_p >= Width ) { continue ; } if ( O_q >= Height ) { continue ; } let O_r = O_p + O_q * Width ; let O_s = O_d [ O_r ] ; if ( dot ( O_s , O_i ) < 0.98 ) { continue ; } O_l += O_b [ O_r ] ; O_m += 1 ; } } O_a [ O_h ] = O_l / f32 ( O_m ) ; } ";UO.addShaderCode(m4e);var Edt=class{constructor(o,t,e,r,i,n,s){this.gpu=o,this.size=t,this.hdrColor=e,this.depth=r,this.position=i,this.normal=n,this.type=s,this.initializeBuffer(),this.initializeLayout(),this.initializeBindGroup(),this.initializePipeline()}getBuffers(){return this.buffers}async run(){let o=this.gpu.device.createCommandEncoder(),t=o.beginComputePass();t.setPipeline(this.pipeline),t.setBindGroup(0,this.bindGroup),t.dispatchWorkgroups(Math.ceil(this.size.width/8),Math.ceil(this.size.height/8)),t.end(),this.gpu.submit(o),await this.gpu.device.queue.onSubmittedWorkDone()}initializePipeline(){this.pipeline=this.gpu.createComputePipeline(m4e,"main","draw pipeline",this.gpu.device.createPipelineLayout({bindGroupLayouts:[this._layout]}),{Width:this.size.width,Height:this.size.height})}initializeBindGroup(){this.bindGroup=this.gpu.createBindGroup("RaytracerRenderDoF",this._layout,0,this.buffers.denoiseHDRColor,1,this.buffers.hdrColor,2,this.buffers.position,3,this.buffers.normal,4,this.buffers.depth,5,this.buffers.type)}initializeLayout(){this._layout=this.gpu.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}},{binding:4,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}},{binding:5,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}]})}initializeBuffer(){this.buffers={hdrColor:this.hdrColor,depth:this.depth,position:this.position,normal:this.normal,type:this.type,denoiseHDRColor:this.gpu.createDynamicBuffer(this.size.height*this.size.width*4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,"denoise hdr color")}}},Gbe="struct O_a { O_b : f32 , O_c : f32 , } @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_d : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 1 ) var < storage , read > O_e : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read_write > O_f : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 3 ) var < storage , read_write > O_g : array < vec2 < f32 > > ; @ group ( 0 ) @ binding ( 4 ) var < uniform > O_h : O_a ; @ group ( 0 ) @ binding ( 5 ) var < storage , read_write > O_i : array < vec3 < f32 > > ; override Width : u32 ; override Height : u32 ; @ compute @ workgroup_size ( 64 ) fn main ( @ builtin ( global_invocation_id ) O_j : vec3 < u32 > , ) { let O_k = u32 ( O_h . O_c ) + O_j . x ; let O_l = O_g [ O_k ] ; let O_m = vec2 < u32 > ( u32 ( O_l . x ) , u32 ( O_l . y ) ) ; if ( O_m . x >= Width || O_m . y >= Height ) { return ; } var O_n = O_m . x + O_m . y * u32 ( Width ) ; O_d [ O_n ] = O_d [ O_n ] + O_e [ O_n ] ; O_f [ O_n ] = O_d [ O_n ] / O_h . O_b ; } @ compute @ workgroup_size ( 8 , 8 ) fn main2 ( @ builtin ( global_invocation_id ) O_j : vec3 < u32 > , ) { if ( O_j . x >= Width || O_j . y >= Height ) { return ; } let O_n = O_j . x + O_j . y * u32 ( Width ) ; O_d [ O_n ] -= O_e [ O_n ] ; O_d [ O_n ] += O_i [ O_n ] ; O_f [ O_n ] = O_d [ O_n ] / O_h . O_b ; } ";UO.addShaderCode(Gbe);var Odt=class{constructor(o,t,e,r,i){this.gpu=o,this.size=t,this.hdrColor=e,this.denoiseHDRColor=r,this.pixelTool=i,this.parmater=new Adt(o),this.initializeLayout(),this.initializeBuffers(),this.initializePipeline(),this.initializeBindGroup()}get buffer(){return this.buffers}async addSimple(o){this.parmater.simpleCount+=1,o&&await this.run2()}reset(){this.parmater.simpleCount=1;let o=this.gpu.device.createCommandEncoder();this.buffers.overlay.clear(o),this.buffers.average.clear(o),this.gpu.submit(o)}run(){this.parmater.pixelStart=this.pixelTool.pixelStart;let o=this.gpu.device.createCommandEncoder(),t=o.beginComputePass();t.setPipeline(this.pipeline),t.setBindGroup(0,this.bindGroup),t.dispatchWorkgroups(this.pixelTool.workgroupInfo.count),t.end(),this.gpu.submit(o)}async run2(){this.parmater.pixelStart=this.pixelTool.pixelStart;let o=this.gpu.device.createCommandEncoder(),t=o.beginComputePass();t.setPipeline(this.pipeline2),t.setBindGroup(0,this.bindGroup),t.dispatchWorkgroups(Math.ceil(this.size.width/8),Math.ceil(this.size.height/8)),t.end(),this.gpu.submit(o),await this.gpu.device.queue.onSubmittedWorkDone()}async runAsync(){this.run(),await this.gpu.device.queue.onSubmittedWorkDone()}_writePassEncoder(o){o.setPipeline(this.pipeline),o.setBindGroup(0,this.bindGroup),o.dispatchWorkgroups(this.pixelTool.workgroupInfo.count)}initializeBuffers(){this.buffers={overlay:this.gpu.createDynamicBuffer(this.size.width*this.size.height*4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,"overlayImageBuffer"),average:this.gpu.createDynamicBuffer(this.size.width*this.size.height*4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,"overlayImageBuffer"),hdrColor:this.hdrColor,pixel:this.pixelTool.buffer,parmater:this.parmater.buffer,denoiseHDRColor:this.denoiseHDRColor}}initializePipeline(){this.pipeline=this.gpu.createComputePipeline(Gbe,"main","draw pipeline",this.gpu.device.createPipelineLayout({bindGroupLayouts:[this.layout]}),{Width:this.size.width,Height:this.size.height}),this.pipeline2=this.gpu.createComputePipeline(Gbe,"main2","draw pipeline",this.gpu.device.createPipelineLayout({bindGroupLayouts:[this.layout]}),{Width:this.size.width,Height:this.size.height})}initializeLayout(){this.layout=this.gpu.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:4,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:5,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}}]})}initializeBindGroup(){this.bindGroup=this.gpu.createBindGroup("RaytracerRenderEquipartition",this.layout,0,this.buffers.overlay,1,this.buffers.hdrColor,2,this.buffers.average,3,this.buffers.pixel,4,this.buffers.parmater,5,this.buffers.denoiseHDRColor)}},Adt=class{constructor(o){this._gpu=o,this._pixelStart=0,this._simpleCount=1}get buffer(){return this._buffer||this._update(),this._buffer}set simpleCount(o){this._simpleCount=o,this._update()}get simpleCount(){return this._simpleCount}set pixelStart(o){this._pixelStart=o,this._update()}_update(){let o={simpleCount:this._simpleCount,pixelStart:this._pixelStart},t=R2(o),e=new Float32Array(t);if(this._buffer)this._buffer.write(0,e);else{let r="ray generator ranfom pixel parmater";this._buffer=this._gpu.createUniformDynamicBuffer(e,r)}}},g4e="struct O_a { O_b : f32 , O_c : f32 , O_d : f32 , O_e : f32 , } @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_f : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 1 ) var O_g : sampler ; @ group ( 0 ) @ binding ( 2 ) var O_h : texture_3d < f32 > ; @ group ( 0 ) @ binding ( 3 ) var < uniform > O_i : O_a ; @ group ( 0 ) @ binding ( 4 ) var < storage , read_write > O_j : array < vec3 < f32 > > ; @ compute @ workgroup_size ( 8 , 8 ) fn main ( @ builtin ( global_invocation_id ) O_k : vec3 < u32 > , ) { if ( O_k . x >= u32 ( O_i . O_b ) || O_k . y >= u32 ( O_i . O_c ) ) { return ; } let O_l = O_k . x + O_k . y * u32 ( O_i . O_b ) ; var O_m = O_f [ O_l ] . rgb ; O_m = clamp ( O_m , vec3f ( 0 ) , vec3f ( 1 ) ) ; if ( O_i . O_e == 1.0 ) { O_j [ O_l ] = O_m ; } else { let O_n = O_m * ( ( O_i . O_d - 1.0 ) / O_i . O_d ) + ( 0.5 / O_i . O_d ) ; let O_o = textureSampleLevel ( O_h , O_g , O_n , 0.0 ) . rgb ; O_j [ O_l ] = O_o ; } } ";UO.addShaderCode(g4e);var _dt=class y4e{constructor(t,e,r,i=64){this.gpu=t,this.input=e,this.context=r,this.size=i,this.cache=new Map,this.parameter=new xdt(t,r.canvas),this.initBuffer(),this.initLayout(),this.initBindGroup(),this.initPipeline()}static async build(t,e,r,i){let n=new y4e(t,e,r);if(i)for(let s of i)await n.add(s);return n}getBuffer(){return this.buffer}size1(){return this.context.canvas}initPipeline(){let t=this.gpu.device.createPipelineLayout({label:"LUT Pipeline Layout",bindGroupLayouts:[this.bindGroupLayout]});this.renderPipeline=this.gpu.createComputePipeline(g4e,"main","geometry buffer dismantle",t)}initBindGroup(){let t=this.gpu.device.createSampler({label:"3D LUT Sampler",minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge"});this.bindGroup=this.gpu.device.createBindGroup({label:"LUT Post-Processing Bind Group",layout:this.bindGroupLayout,entries:[{binding:0,resource:{buffer:this.buffer.input.getBuffer()}},{binding:1,resource:t},{binding:2,resource:this.buffer.lut.createView()},{binding:3,resource:{buffer:this.parameter.buffer.getBuffer()}},{binding:4,resource:{buffer:this.buffer.out.getBuffer()}}]})}initLayout(){this.bindGroupLayout=this.gpu.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,sampler:{type:"filtering"}},{binding:2,visibility:GPUShaderStage.COMPUTE,texture:{sampleType:"float",viewDimension:"3d"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:4,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}}]})}initBuffer(){this.buffer={input:this.input,out:this.gpu.createStorageDynamicBuffer(this.size1().width*this.size1().height*4,""),lut:this.gpu.device.createTexture({label:"3D LUT",dimension:"3d",size:[this.size,this.size,this.size],format:"rgba32float",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,mipLevelCount:1})}}async renderFrame(){let t=this.gpu.device.createCommandEncoder(),e=t.beginComputePass();e.setPipeline(this.renderPipeline),e.setBindGroup(0,this.bindGroup),e.dispatchWorkgroups(Math.ceil(this.size1().width/8),Math.ceil(this.size1().height/8)),e.end(),this.gpu.submit(t),await this.gpu.device.queue.onSubmittedWorkDone()}async add(t){if(jMe(t)!=="cube")throw new Error;this.cache.set(t.name,await vdt(t)),this.use(t.name)}use(t){if(!this.cache.has(t)){this.parameter.setDisable(!0);return}this.parameter.setDisable(!1);let e=this.cache.get(t).data;this.userName=t,this.gpu.device.queue.writeTexture({texture:this.buffer.lut},e,{bytesPerRow:this.size*16,rowsPerImage:this.size},{width:this.size,height:this.size,depthOrArrayLayers:this.size})}getUser(){return this.userName}all(){return Array.from(this.cache.keys())}all2(){return Array.from(this.cache.values()).map(t=>t.file)}};async function vdt(o){let t=(await o.text()).split(`
`),e={size:0,domainMin:[0,0,0],domainMax:[1,1,1],data:new Float32Array,file:o},r=[];for(let s of t){let a=s.trim();if(a.length===0||a.startsWith("#"))continue;let l=a.split(/\s+/);l[0]==="TITLE"?e.title=l[1].replace(/"/g,""):l[0]==="LUT_3D_SIZE"?e.size=parseInt(l[1],10):l[0]==="DOMAIN_MIN"?e.domainMin=[parseFloat(l[1]),parseFloat(l[2]),parseFloat(l[3])]:l[0]==="DOMAIN_MAX"?e.domainMax=[parseFloat(l[1]),parseFloat(l[2]),parseFloat(l[3])]:l.length>=3&&r.push(parseFloat(l[0]),parseFloat(l[1]),parseFloat(l[2]),1)}let i=new Uint8Array(r.length);for(let s=0;s<r.length;s++)i[s]=Math.round(r[s]*255);let n=new Float32Array(r);return e.data=n,e}var xdt=class{constructor(o,t){this.gpu=o,this.size=t,this.disable=!0,this.buffer=this.gpu.createUniformDynamicBuffer(this.getData(),"parameters buffer of DrawColorGamma.")}setDisable(o){this.disable=o,this.updata()}updata(){this.buffer.write(0,this.getData())}getData(){let o={width:this.size.width,height:this.size.height,lutSize:64,disable:this.disable},t=R2(o);return new Float32Array(t)}},Rdt=class b4e extends d4e{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p,m){super(),this.gpu=t,this.camera=e,this.light=r,this.model=i,this.background=n,this.context=s,this.input=a,this.pathTracing=l,this.draw=c,this.rayGenerator=h,this.equipartition=u,this.pixelTool=d,this.denoise=p,this.lut=m,this.needReset=!1,this.sampleCount=0,this.maxSampleCount=10,this.enableDenoise=!1}static async build(t,e,r,i,n,s,a){let l=new p4e(t,e.size),c=u4e.random(t,e),h=new V2e(t,e,r,i,n,c.ray,l),u=new Edt(t,e.size,h.getBuffer().hdrColor,h.getBuffer().depth,h.getBuffer().position,h.getBuffer().normal,h.getBuffer().type),d=new Odt(t,e.size,h.getBuffer().hdrColor,u.getBuffers().denoiseHDRColor,l),p=await _dt.build(t,d.buffer.average,s,a.lut),m=new a4e(t,s,p.getBuffer().out);return new b4e(t,e,r,i,n,s,a,h,m,c,d,l,u,p)}setEnableDenoise(t){this.enableDenoise=t,this.setReset()}getEnableDenoise(){return this.enableDenoise}getMaxSampleCount(){return this.maxSampleCount}setMaxSampleCount(t){this.maxSampleCount=t,this.setReset(),this.setReset()}getPathTracing(){return this.pathTracing}getDraw(){return this.draw}getLut(){return this.lut}setReset(){this.needReset=!0}render(){(this.camera.check()||this.model.checkAndUpdate()||this.background.check()||this.needReset)&&(this.needReset&&(this.needReset=!1),this.rayGenerator.run(),this.pathTracing.reset(),this.equipartition.reset(),this.pixelTool.reset()),this.pathTracing.run(),this.equipartition.run(),this.draw.run(),this.pixelTool.isFinallyRender()?(this.equipartition.addSimple(!1),this.pixelTool.newRender()):this.pixelTool.addRenderCount()}async renderAsync(){if(this.checkReset()&&await this.reset(),this.stopSample()){await new Promise(t=>setTimeout(t,100));return}await this.pathTracing.runAsync(),await this.equipartition.runAsync(),await this.lut.renderFrame(),await this.draw.runAsync(),this.pixelTool.isFinallyRender()?(await this.denoise.run(),await this.equipartition.addSimple(this.enableDenoise),await this.rayGenerator.runAsync(),this.pixelTool.newRender(),console.log(this.sampleCount++)):this.pixelTool.addRenderCount()}async hitFace(){return await this.pathTracing.runRayHitQueryAsync()}stopSample(){return this.sampleCount>this.maxSampleCount}async reset(){this.needReset=!1,this.sampleCount=0,await this.rayGenerator.runAsync(),this.pathTracing.reset(),this.equipartition.reset(),this.pixelTool.reset()}checkReset(){return this.camera.check()||this.model.checkAndUpdate()||this.light.checkAndUpdate()||this.background.check()||this.needReset}},Ddt=class P4e{constructor(t,e){this.raytracer=t,this.raytracerColor=e}static async build(t,e,r,i,n,s,a){return new P4e(await Rdt.build(t,e,r,i,n,s,a),await Sdt.build(t,e,r,i,n,s,a))}getRaytracer(){return this.raytracer}getRaytracerColor(){return this.raytracerColor}};function Kye(o,t){let e=t.getContext("webgpu");return e.configure({device:o.device,format:"rgba8unorm",alphaMode:"opaque"}),e}var Zye=class{constructor(o){this._rendererGroup=o}get renderer(){return this.mode=="color"?this._rendererGroup.getRaytracerColor():this._rendererGroup.getRaytracer()}set renderMode(o){this.mode=o,this.renderer.setReset()}startContinuousSyncRender(){this.renderer.render(),requestAnimationFrame(()=>this.startContinuousSyncRender())}startRenderDeferredAsyncLoop(){this.renderDeferredAsyncLoop(),requestAnimationFrame(()=>this.startRenderDeferredAsyncLoop())}renderDeferredAsyncLoop(){clearTimeout(this._timerId),this.renderer.render(),this._timerId=window.setTimeout(async()=>{for(this._timerId=void 0;!this._timerId;)await this.renderer.renderAsync()},2e3)}async startInfiniteAsyncRender(){for(;;)await this.renderer.renderAsync()}},wdt=EDe(XDe()),U2e=(o=>(o.model="model",o.obj="obj",o.material="material",o.globalParam="global_param",o.areaLight="area_light",o.log="log",o.cMatrix="c_matrix",o.textureNormal="texture_normal",o.textureMetallic="texture_metallic",o.textureColor="texture_color",o.textureRoughness="texture_roughness",o.camera="camera",o.background="background",o.lut="lut",o))(U2e||{});async function Ldt(o){let t=await Mdt(o),e=Ndt(t),r=u=>{let d=e.get(u);return d.length===1?d[0].blob:null},i=await mDe.model(e.get("model")),n=await mDe.material(e.get("material")),s=EL(e.get("log")),a=EL(e.get("texture_normal")),l=EL(e.get("texture_metallic")),c=EL(e.get("texture_color")),h=EL(e.get("texture_roughness"));return{background:EL(e.get("background")),model:i,camera:r("camera"),material:n,globalParam:r("global_param"),log:s,textureNormal:a,textureMetallic:l,textureColor:c,textureRoughness:h,light:r("area_light"),lut:EL(e.get("lut"))}}var mDe=class{static async model(o){if(o.length!==1)throw new Error;let{blob:t}=o[0],e=await t.text(),r=JSON.parse(e);return{text:e,...r}}static async camera(o){if(o.length===0||o===void 0)return null;if(o.length!==1)throw new Error;let{blob:t}=o[0];return{txt:await t.text()}}static async material(o){if(o===void 0||o.length===0)return null;if(o.length!==1)throw new Error;let{blob:t}=o[0];return{data:await t.text()}}};async function Mdt(o){let t=await new wdt.default().loadAsync(o),e=[];t.forEach((i,n)=>{if(n.dir)return;let s=a();if(!s)return;e.push({name:l(),type:s,blob:n.async("blob")});function a(){let c=Object.entries(U2e).map(h=>h[1]);if(c=c.filter(h=>i.includes(h)),c.length!==0){if(c.length===1)return c[0];throw new Error}}function l(){let c="";for(let h=i.length-1;h>=0&&i[h]!=="/";h--)c+=i[h];return c=Array.from(c).reverse().join(""),c}});let r=[];for(let{type:i,name:n,blob:s}of e)r.push({type:i,name:n,blob:await s});return r}function EL(o){return o?{files:o,defaultFile:o[0],fileNames:o.map(t=>t.name)}:void 0}function Ndt(o){let t=new Map;for(let{type:e,name:r,blob:i}of o)t.has(e)?t.get(e).push({name:r,blob:i}):t.set(e,[{name:r,blob:i}]);return t}var kdt=class T4e{constructor(t){this.txt=t}static async build(t){return new T4e(await t.text())}anasync(){this.downloadIds();let t=this.getMtlSources(!0).map(Vdt).flat().flat(),e=[],r=[];for(let n of t){let{a:s,d:a,s:l}=n;s.equals(a)&&l.r===s.r/2&&l.g===s.g/2&&l.b===s.b/2?e.push(n):r.push(n)}let i={unExpect:r,expectRation:e.length/t.length};debugger}anasync2(){}getMtlSources(t=!1){return t?YMe(this.getMtlSources()):JSON.parse(this.txt).map(e=>e[1])}downloadIds(){let t=Fdt.decode(this.txt),e=new Map;t.forEach(s=>{s.materials.forEach(a=>{e.has(a.hash)?e.get(a.hash).add(s.id):e.set(a.hash,new Set().add(s.id))})});let r=kW(e,s=>s.size);t.forEach(s=>s.setWight(r)),t.sort((s,a)=>a.wight-s.wight);let i=t.map(s=>s.id),n=new Blob([JSON.stringify(i)]);FJ.downloadFile("ids.mlib",n)}},Bdt=class{constructor(o,t){this.id=o,this.materials=JSON.parse(t).map(e=>({mtl:FMe.decode(e),hash:e}))}setWight(o){let t=0;this.materials.forEach(e=>{t+=o.get(e.hash)}),this.wight=t}},Fdt={encode:function(o){return JSON.stringify(o.map(t=>JSON.stringify({id:t.id,materila:JSON.stringify(t.materials.map(e=>FMe.encode(e.mtl)))})))},decode:function(o){return JSON.parse(o).map(t=>{let{id:e,materialsSourece:r}=JSON.parse(t);return new Bdt(e,r)})}};function Vdt(o){let t=[""];for(let e=0;e<o.length;e++)o[e]==="}"&&o[e+1]==="{"?(t[t.length-1]+=o[e],t.push("")):t[t.length-1]+=o[e];return t.pop(),t.map(Gdt)}function Gdt(o){let{a:t,d:e,s:r}=JSON.parse(o);return{a:od.decode(t),d:od.decode(e),s:od.decode(r)}}var Udt=class I4e{constructor(t,e){this.gpu=t,this.kitsuneCamera=e,this.diffParam=new hdt,this.ids=[]}static async build(t){await new Promise(r=>setTimeout(r,1e3));let e=await HLe.build();return this.build1(e,t)}static async build1(t,e){return await this.compileShader(t),await this.warmPathTracing(t,{width:e.getWidth(),height:e.getHeight()}),new I4e(t,e)}static async compileShader(t){await UO.compileAll(t.device)}static async warmPathTracing(t,e){await V2e.warm(t,e)}isBuild(){return this.renderer!==void 0}getCameraRotateTarget(){return this.camera.getRotateTarget()}getLight(){return this.light}getModelBBox(){return this.model.obj.getBBox()}getBBox(){let t=this.light.getBBox(),e=this.getModelBBox(),r=new Xm;return r.ext4(t),r.ext4(e),r.build()}render(){this.renderer.getRaytracer().render()}resetCamera(){this.camera.reset()}getTextureList(t){if(!this.isBuild())return[];let e=this.model.material.registrar.textureRegister;switch(t){case"background_texture":return this.background.getTextureNames();case"material_normal_texture":return e.getTextureNames(0);case"material_metallic_texture":return e.getTextureNames(1);case"material_color_texture":return e.getTextureNames(2);case"material_roughness_texture":return e.getTextureNames(3);case"diffuse_mode":return KJ.all();case"area_light_name":return this.light.getAll();case"lut_name":return this.renderer.getRaytracer().getLut().all();case"model_id":return this.ids.slice(0,20);default:throw new Error}}setGlobalParam(t){if(!this.isBuild())return;let e=this.diffParam.diff(t),{backgroundTexture:r,backgroundRotation:i,backgroundIntensity:n,backgroundColor:s,backgroundUseColor:a,occluderPosition:l,occluderWidth:c,occluderHeight:h,occluderColor:u,occluderVisible:d,rendererMaxSample:p,rendererEnableDenoise:m,hideBoard:g,hideOccluder:y,hidePCB:b,hideOBJ:P,hideLight:T,hideCoordinate:I,lightIsOpen:C,displayDevice:E,viewTransform:O,renderMode:_,apertureSize:R,flangeFocalDistance:v,focalLength:D,maxRayBounces:w,diffuseMode:F,lutName:H}=e;m!==void 0&&this.renderer.getRaytracer().setEnableDenoise(m),p!==void 0&&this.renderer.getRaytracer().setMaxSampleCount(p),d!==void 0&&this.model.occluder.setVisible(d),u!==void 0&&this.model.occluder.setColor(u),l!==void 0&&this.model.occluder.setPosition(l),c!==void 0&&this.model.occluder.setWidth(c),h!==void 0&&this.model.occluder.setHeight(h),E!==void 0&&this.renderer.getRaytracer().getDraw().prameter.setDisplayDevice(E),O!==void 0&&this.renderer.getRaytracer().getDraw().prameter.setViewTransform(O),C!==void 0&&this.light.setIsOpen(C),a!==void 0&&this.background.setUseColor(a),s!==void 0&&this.background.setColor(s),n!==void 0&&this.background.setIntensity(n),i!==void 0&&this.background.setRotation(i),r!=null&&this.background.setTexture(r),_!==void 0&&(this.loopRender.renderMode=_),R!==void 0&&this.kitsuneCamera.setApertureSize(R),v!==void 0&&this.kitsuneCamera.setFlangeFocalDistance(v),D!==void 0&&this.kitsuneCamera.setFocalLength(D),w!==void 0&&this.renderer.getRaytracer().getPathTracing().getParameter().setMaxRayBounces(w),F!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().diffuseMode=KJ.get(F),this.renderer.getRaytracer().setReset()),g!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().hideBoard=g),y!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().hideOccluder=y),b!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().hidePCB=b),P!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().hideOBJ=P),T!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().hideLight=T),I!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().hideCoordinate=I),H!==void 0&&this.renderer.getRaytracer().getLut().use(H),this.renderer.getRaytracer().setReset()}getGlobalParam(){return{backgroundTexture:this.background.getTextureName(),backgroundIntensity:this.background.getIntensity(),backgroundRotation:this.background.getRotatoin(),backgroundColor:this.background.getColor(),backgroundUseColor:this.background.isUseColor(),occluderColor:this.model.occluder.getColor(),occluderPosition:this.model.occluder.getPosition(),occluderWidth:this.model.occluder.getWidth(),occluderHeight:this.model.occluder.getHeight(),occluderVisible:this.model.occluder.getVisible(),rendererMaxSample:this.renderer.getRaytracer().getMaxSampleCount(),rendererEnableDenoise:this.renderer.getRaytracer().getEnableDenoise(),hideBoard:this.renderer.getRaytracer().getPathTracing().getParameter().hideBoard,hideOccluder:this.renderer.getRaytracer().getPathTracing().getParameter().hideOccluder,hidePCB:this.renderer.getRaytracer().getPathTracing().getParameter().hidePCB,hideOBJ:this.renderer.getRaytracer().getPathTracing().getParameter().hideOBJ,hideLight:this.renderer.getRaytracer().getPathTracing().getParameter().hideLight,hideCoordinate:this.renderer.getRaytracer().getPathTracing().getParameter().hideCoordinate,renderMode:"pinhole",apertureSize:this.kitsuneCamera.getApertureSize(),flangeFocalDistance:this.kitsuneCamera.getFlangeFocalDistance(),focalLength:this.kitsuneCamera.getFocalLength(),maxRayBounces:this.renderer.getRaytracer().getPathTracing().getParameter().maxRayBounces,diffuseMode:this.renderer.getRaytracer().getPathTracing().getParameter().diffuseMode[0],lightIsOpen:this.light.getIsOpen(),displayDevice:this.renderer.getRaytracer().getDraw().prameter.getDisplayDevice(),viewTransform:this.renderer.getRaytracer().getDraw().prameter.getViewTransform(),lutName:this.renderer.getRaytracer().getLut().getUser()}}setMaterial(t,e){this.model.material.modify(t,e)}async addTextureList(t,e){if(!this.isBuild())return;let r=this.model.material.registrar.textureRegister;switch(t){case"background_texture":return this.background.addTexture(e);case"material_normal_texture":await r.add(0,e);return;case"material_metallic_texture":await r.add(1,e);return;case"material_color_texture":await r.add(2,e);return;case"material_roughness_texture":await r.add(3,e);return;case"lut_name":return await this.renderer.getRaytracer().getLut().add(e);default:throw new Error}}async getZip(t=Mt.ORIGIN){let e=new fst.default;{let r=(n,s)=>{e.file(n+".txt",s)},i=U2e;r(i.camera,this.camera.getBlob(t)),r(i.model,await this.model.getBlob()),r(i.material,this.model.material.getBlob()),r(i.globalParam,adt(this.getGlobalParam())),r(i.areaLight,this.light.getBlob())}{this.renderer.getRaytracer().getLut().all2().forEach(r=>{e.file("lut/"+r.name,r)}),this.background.getCache().forEach(({name:r,blob:i})=>{e.file("background/"+r,i)}),this.model.board.getBlob((r,i)=>{e.file("log/"+r,i)});{let r=this.model.material.registrar.textureRegister,i=this.model.material.table.getUserTextures();r.getTexture(2).filter(({name:n})=>i.has(n)).forEach(({name:n,blob:s})=>{e.file("texture_color/"+n,s)}),r.getTexture(1).filter(({name:n})=>i.has(n)).forEach(({name:n,blob:s})=>{e.file("texture_metallic/"+n,s)}),r.getTexture(0).filter(({name:n})=>i.has(n)).forEach(({name:n,blob:s})=>{e.file("texture_normal/"+n,s)}),r.getTexture(3).filter(({name:n})=>i.has(n)).forEach(({name:n,blob:s})=>{e.file("texture_roughness/"+n,s)})}}return await e.generateAsync({type:"blob"})}async autoFocus(t,e){let r=this.kitsuneCamera.getScreenPointToRay(t,e);this.camera.modifyCilkDirection(r);let{depth:i}=await this.renderer.getRaytracer().hitFace();this.kitsuneCamera.autoFcous(i)}async gitRayHitInfo(t,e){let r=this.kitsuneCamera.getScreenPointToRay(t,e);this.camera.modifyCilkDirection(r);let i=await this.renderer.getRaytracer().hitFace();if(!i.depth)return null;let n=i.materialIndex;return i.depth?{material:this.model.material.getPBR(n),materialId:n,isLightSource:i.isLight}:{material:this.model.material.getPBR(n),materialId:n,isLightSource:i.isLight}}async buildByFile(t){let e=jMe(t);switch(mS.log(`build by ${e} type file.`),e){case"obj":return await this.buildByOBJFile(t);case"zip":return await this.buildByZipFile(t);case"csv":return await this.buildByCSV(t);case"txt":return await this.buildByTxt(t);case"mlib":return await this.buildByMlib(t);default:throw new Error}}async setIDS(t){let e=this.ids[t-1],r=lDe(e),i=await $ye(r),{obj:n,mtl:s}=cDe(i);this.model.material.clear(),await this.model.obj.update(n,s),this.renderer.getRaytracer().getPathTracing().rebind(),this.renderer.getRaytracer().setReset(),this.camera.setObjectByBBox3(this.model.obj.getBBox())}async buildByMlib(t){let e=await t.text(),r=JSON.parse(e);this.ids=r;let i=r[0],n=lDe(i),s=await $ye(n),{obj:a,mtl:l}=cDe(s),c=await h(this.kitsuneCamera,this.gpu);await this.build(c),this.setGlobalParam({hideBoard:!0,hideLight:!0,hidePCB:!0,hideOccluder:!0,lightIsOpen:!1,hideCoordinate:!1}),this.loopRender=new Zye(this.renderer),this.loopRender.renderMode="pinhole",this.loopRender.startInfiniteAsyncRender();async function h(u,d){let p=Kye(d,u.getCanvas());return{gpu:d,context:p,model:{obj:{obj:a,mtl:l}},camera:{camera:u},light:void 0,globalParam:void 0,background:void 0}}}async buildByTxt(t){(await kdt.build(t)).anasync()}async buildByKitsune(t,e){let r={gpu:this.gpu,context:e,model:{pcb:await wut(t.pcb),obj:t.obj},camera:{camera:this.kitsuneCamera},light:void 0,globalParam:void 0,background:void 0};await this.build(r)}async buildByCSV(t){let e=await this.getCSVURLs(t),r=[];for(let n=0,s=e.length,a=new Wut(s);n<s;n++){let l=await $ye(e[n]),c=new JMe(l).getMaterialString();r.push(c),a.increment()}console.log(r.length);let i=Wdt(r);console.log("material",r.length),console.log("dedup material",i.length);debugger}async getCSVURLs(t){let e=await t.text(),r=zdt(e);return r=YMe(r),r.map(i=>"https://modules.lceda.cn/3dmodel/"+i)}async buildByZipFile(t){let e=await r(this.kitsuneCamera,this.gpu);await this.build(e),this.loopRender=new Zye(this.renderer),this.loopRender.renderMode="pinhole",this.loopRender.startInfiniteAsyncRender(),e.globalParam&&this.setGlobalParam(e.globalParam);async function r(i,n){var s;let a=async()=>{let d=VMe.destring(l.model.pcb),p={scale:d?3.93701:void 0,...e4e.destring(l.model.obj)},m=l.log?{blob:l.log.defaultFile.blob,hide:!1}:void 0,g={hide:!0},y={table:BMe.decode(l.material.data),metallic:l.textureMetallic?l.textureMetallic.files:[],normal:l.textureNormal?l.textureNormal.files:[],color:l.textureColor?l.textureColor.files:[],roughness:l.textureRoughness?l.textureRoughness.files:[]};return{pcb:d,obj:p,board:m,occluder:g,material:y}},l=await Ldt(t),c=Kye(n,i.getCanvas()),h=await a(),u=l.light;return{camera:{camera:i,config:l.camera},context:c,gpu:n,model:h,light:u,background:(s=l.background)==null?void 0:s.files,globalParam:l.globalParam?await ldt(l.globalParam):null,lut:l.lut?l.lut.files.map(d=>new File([d.blob],d.name)):[]}}}async buildByOBJFile(t){let e=await r(this.kitsuneCamera,this.gpu);await this.build(e),this.setGlobalParam({hideBoard:!0,hideLight:!0,hidePCB:!0,hideOccluder:!0,lightIsOpen:!1,hideCoordinate:!1}),this.loopRender=new Zye(this.renderer),this.loopRender.renderMode="pinhole",this.loopRender.startInfiniteAsyncRender();async function r(i,n){let s=Kye(n,i.getCanvas());return{gpu:n,context:s,model:{obj:{obj:await t.text()}},camera:{camera:i},light:void 0,globalParam:void 0,background:void 0}}}async build(t){mS.log("init editor scene."),mS.time("init");let{gpu:e,context:r}=t;this.camera=await aut.build(e,t.camera),this.model=await sdt.build(e,this.camera,t.model),this.light=await jut.build(e,t.light),this.background=await iut.build(e,t.background),this.renderer=await Ddt.build(e,this.camera,this.light,this.model,this.background,r,t),mS.log("init over."),mS.timeEnd("init")}};function Hdt(o){let t=new Map;return o.forEach(e=>{t.has(e)?t.set(e,t.get(e)+1):t.set(e,1)}),t}function Wdt(o){let t=Hdt(o);return Array.from(t).sort((e,r)=>r[1]-e[1])}function zdt(o){let t=[],e=/"([^"]*)"/g,r;for(;(r=e.exec(o))!==null;)t.push(r[1]);return t}var gDe="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_n : mat4x4 < f32 > , O_ap : vec4 < f32 > , O_aq : vec3 < f32 > , O_ar : vec3 < f32 > , O_as : vec3 < f32 > , O_at : vec3 < f32 > , O_au : vec3 < f32 > , O_av : vec3 < f32 > , O_aw : f32 , O_ax : f32 , O_ad : f32 , @ align ( 16 ) O_ay : vec3 < f32 > , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_az : O_a ; @ binding ( 1 ) @ group ( 0 ) var < uniform > O_ba : O_ao ; struct O_bb { @ builtin ( position ) O_bc : vec4 < f32 > , @ location ( 0 ) O_am : vec3 < f32 > , @ location ( 1 ) O_an : vec3 < f32 > , } struct O_bd { @ location ( 0 ) O_ap : vec4 < f32 > , } @ vertex fn v_main ( @ builtin ( vertex_index ) O_be : u32 , @ location ( 0 ) O_bf : vec3 < f32 > , @ location ( 1 ) O_am : vec3 < f32 > , ) -> O_bb { var O_bg : O_bb ; if ( O_ba . O_ad == 2 ) { let O_n = O_az . O_c * O_ba . O_n ; O_bg . O_am = mat3x3 ( vec3 ( O_n [ 0 ] . xyz ) , vec3 ( O_n [ 1 ] . xyz ) , vec3 ( O_n [ 2 ] . xyz ) ) * O_am ; let O_e = O_n * vec4 ( O_bf , 1 ) ; O_bg . O_an = - O_e . xyz / O_e . w ; } O_bg . O_bc = O_az . O_b * O_ba . O_n * vec4 ( O_bf , 1 ) ; O_bg . O_bc . x += O_ba . O_ay . x * O_bg . O_bc . w ; O_bg . O_bc . y += O_ba . O_ay . y * O_bg . O_bc . w ; O_bg . O_bc . z += O_ba . O_ay . z * O_bg . O_bc . w ; return O_bg ; } @ fragment fn f_main ( @ location ( 0 ) O_am : vec3 < f32 > , @ location ( 1 ) O_an : vec3 < f32 > , ) -> O_bd { var O_bg : O_bd ; if ( O_ba . O_ad == 0 ) { O_bg . O_ap = O_ba . O_ap ; return O_bg ; } let O_aq : vec3 < f32 > = O_ba . O_aq ; let O_ar : vec3 < f32 > = O_ba . O_ar ; let O_as : vec3 < f32 > = O_ba . O_as ; var O_bh = O_aq * O_ba . O_at ; var O_bi = normalize ( O_am ) ; var O_av = O_ba . O_av ; var O_bj = abs ( dot ( O_bi , O_av ) ) * O_ar * O_ba . O_au ; var O_bk = - 2.0 * O_bi * dot ( O_av , O_bi ) + O_av ; var O_bl = normalize ( O_an ) ; var O_bm = abs ( dot ( O_bk , O_bl ) ) ; var O_bn = O_as * O_ba . O_au * pow ( O_bm , 300.0 ) * O_ba . O_aw * 0.1 ; O_bg . O_ap = vec4 ( O_bh + O_bj + O_bn , O_ba . O_ax ) ; return O_bg ; } ",yDe=56,Ydt=class{constructor(o){this.positionVertexStrideLen=3,this.normalVertexStrideLen=3,this.viewOffsetZ=0,this.scene=o,this.gpu=o.gpu,this.device=o.gpu.device,this.linePipeline=this.createPipeline("line"),this.trianglePipeline=this.createPipeline("triangle"),this.desc=this.createRenderDesc(),this.uniformBuffer=o.gpu.createDynamicBuffer(yDe,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,"uniformBuffer of meshProgramGPU"),this.lineBindGroup=this.createBindGroup("line"),this.triangleBindGroup=this.createBindGroup("triangle")}createPipeline(o){return this.device.createRenderPipeline({layout:"auto",vertex:{module:this.gpu.createShaderModule(gDe),entryPoint:"v_main",buffers:[{arrayStride:this.positionVertexStrideLen*fs,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]},{arrayStride:this.normalVertexStrideLen*fs,attributes:[{shaderLocation:1,offset:0,format:"float32x3"}]}]},fragment:{module:this.gpu.createShaderModule(gDe),entryPoint:"f_main",targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:o==="line"?"line-list":"triangle-list"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:v2}})}createRenderDesc(){return{colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"}}}createBindGroup(o){return this.gpu.createDynamicBindGroup(o==="line"?this.linePipeline.getBindGroupLayout(0):this.trianglePipeline.getBindGroupLayout(0),0,this.scene.cameraBuf,1,this.uniformBuffer)}setViewOffsetZ(o=0){this.viewOffsetZ=o}render(o,t,e,r,i,n,s=ee.BLACK){let a;i instanceof xtt?e===1?a="line":a="triangle":i instanceof vtt&&(a="line"),this.desc.colorAttachments[0].view=o.colorTexture.view,this.desc.depthStencilAttachment.view=o.depthStencilTexture.view;let l=new Float32Array(yDe);if(l.set(r.data),l.set(s.getData(),16),n){l.set(n.ambient.getData(),20),l.set(n.diffuse.getData(),24),l.set(n.specular.getData(),28),l.set(this.scene.ambientLight.color.getData(),32),l.set(this.scene.directionalLight.color.getData(),36);let u=this.scene.directionalLight.direction();l.set([u.x,u.y,u.z],40),l[43]=n.shininess,l[44]=n.alpha}l[45]=e;let c=this.scene.getViewOffset();l.set([c.x,c.y,this.viewOffsetZ],48),this.scene.addData(new Uint32Array(l.buffer),this.uniformBuffer);let h=this.scene.commandEncoder.beginRenderPass(this.desc);h.setPipeline(a==="line"?this.linePipeline:this.trianglePipeline),h.setBindGroup(0,a==="line"?this.lineBindGroup.getBindGroup():this.triangleBindGroup.getBindGroup()),h.setVertexBuffer(0,i.getVertexBuf(t.gpu).getBuffer()),h.setVertexBuffer(1,i.getNormalsBuf(t.gpu).getBuffer()),h.draw(i.vertexNum),h.end()}},bDe="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_n : mat4x4 < f32 > , O_ap : vec4 < f32 > , O_aq : vec3 < f32 > , O_ar : vec3 < f32 > , O_as : vec3 < f32 > , O_at : vec3 < f32 > , O_au : vec3 < f32 > , O_av : vec3 < f32 > , O_aw : f32 , O_ax : f32 , O_ad : f32 , @ align ( 16 ) O_ay : vec3 < f32 > , O_az : vec2 < f32 > , O_k : f32 , O_l : f32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_ba : O_a ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_bb : O_ao ; struct O_bc { @ builtin ( position ) O_bd : vec4 < f32 > , @ location ( 0 ) O_am : vec3 < f32 > , @ location ( 1 ) O_an : vec3 < f32 > , } struct O_be { @ location ( 0 ) O_ap : vec4 < f32 > , } @ vertex fn v_main ( @ builtin ( vertex_index ) O_bf : u32 , ) -> O_bc { var O_bg : O_bc ; var O_bh : vec2f ; let O_bi = O_bb . O_l / 2 ; let O_bj = O_bb . O_az + vec2 ( 0 , - O_bi ) ; let O_bk = O_bb . O_az + vec2 ( O_bb . O_k , - O_bi ) ; let O_bl = normalize ( O_bk - O_bj ) ; let O_bm = vec2 ( - O_bl . y , O_bl . x ) ; let O_bn = O_bm * O_bi ; if ( O_bf == 0 || O_bf == 5 ) { O_bh = O_bj - O_bn ; } else if ( O_bf == 1 ) { O_bh = O_bk - O_bn ; } else if ( O_bf == 2 || O_bf == 3 ) { O_bh = O_bk + O_bn ; } else if ( O_bf == 4 ) { O_bh = O_bb . O_az ; } if ( O_bb . O_ad == 2 ) { let O_n = O_ba . O_c * O_bb . O_n ; O_bg . O_am = mat3x3 ( vec3 ( O_n [ 0 ] . xyz ) , vec3 ( O_n [ 1 ] . xyz ) , vec3 ( O_n [ 2 ] . xyz ) ) * vec3 < f32 > ( 0 , 0 , 1 ) ; let O_e = O_n * vec4 ( O_bh . xy , 0 , 1 ) ; O_bg . O_an = - O_e . xyz / O_e . w ; } O_bg . O_bd = O_ba . O_b * O_bb . O_n * vec4 ( O_bh . xy , 0 , 1 ) ; let O_bo = O_bb . O_ay * O_bg . O_bd . w ; O_bg . O_bd . x += O_bo . x ; O_bg . O_bd . y += O_bo . y ; return O_bg ; } @ fragment fn f_main ( @ location ( 0 ) O_am : vec3 < f32 > , @ location ( 1 ) O_an : vec3 < f32 > , ) -> O_be { var O_bg : O_be ; if ( O_bb . O_ad == 0 ) { O_bg . O_ap = O_bb . O_ap ; return O_bg ; } let O_aq : vec3 < f32 > = O_bb . O_aq ; let O_ar : vec3 < f32 > = O_bb . O_ar ; let O_as : vec3 < f32 > = O_bb . O_as ; var O_bp = O_aq * O_bb . O_at ; var O_bq = normalize ( O_am ) ; var O_av = O_bb . O_av ; var O_br = abs ( dot ( O_bq , O_av ) ) * O_ar * O_bb . O_au ; var O_bs = - 2.0 * O_bq * dot ( O_av , O_bq ) + O_av ; var O_bt = normalize ( O_an ) ; var O_bu = abs ( dot ( O_bs , O_bt ) ) ; var O_bv = O_as * O_bb . O_au * pow ( O_bu , 300.0 ) * O_bb . O_aw * 0.1 ; O_bg . O_ap = vec4 ( O_bp + O_br + O_bv , O_bb . O_ax ) ; return O_bg ; } ",PDe=64,jdt=class{constructor(o){this.scene=o,this.gpu=o.gpu,this.device=o.gpu.device,this.pipeline=this.createPipeline(),this.desc=this.createRenderDesc(),this.uniformBuffer=o.gpu.createDynamicBuffer(PDe,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,"uniformBuffer of drawColorUseStencil"),this.bindGroup=this.createBindGroup()}createPipeline(){return this.device.createRenderPipeline({layout:"auto",vertex:{module:this.gpu.createShaderModule(bDe),entryPoint:"v_main"},fragment:{module:this.gpu.createShaderModule(bDe),entryPoint:"f_main",targets:[{format:za,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"},depthStencil:{depthWriteEnabled:!0,depthCompare:"always",stencilWriteMask:255,stencilReadMask:255,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"},format:v2}})}createRenderDesc(){return{colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"}}}createBindGroup(){return this.gpu.createDynamicBindGroup(this.pipeline.getBindGroupLayout(0),0,this.scene.cameraBuf,1,this.uniformBuffer)}render(o,t,e,r,i=ee.BLACK,n){let s=n.toBBox2();this.desc.colorAttachments[0].view=o.colorTexture.view,this.desc.depthStencilAttachment.view=o.depthStencilTexture.view;let a=new Float32Array(PDe);if(a.set(e.data),a.set(i.getData(),16),r){a.set(r.ambient.getData(),20),a.set(r.diffuse.getData(),24),a.set(r.specular.getData(),28),a.set(this.scene.ambientLight.color.getData(),32),a.set(this.scene.directionalLight.color.getData(),36);let h=this.scene.directionalLight.direction();a.set([h.x,h.y,h.z],40),a[43]=r.shininess,a[44]=r.alpha}a[45]=t;let l=this.scene.getViewOffset();a.set([l.x,l.y],48),a.set([s.UL().x,s.UL().y,s.width(),s.height()],52),this.scene.addData(new Uint32Array(a.buffer),this.uniformBuffer);let c=this.scene.commandEncoder.beginRenderPass(this.desc);c.setStencilReference(64),c.setPipeline(this.pipeline),c.setBindGroup(0,this.bindGroup.getBindGroup()),c.draw(6),c.end()}},Xdt="@ vertex fn fullVert ( @ builtin ( vertex_index ) O_a : u32 , ) -> @ builtin ( position ) vec4 < f32 > { var O_b = array < vec2 < f32 > , 6 > ( vec2 < f32 > ( 1.0 , 1.0 ) , vec2 < f32 > ( 1.0 , - 1.0 ) , vec2 < f32 > ( - 1.0 , - 1.0 ) , vec2 < f32 > ( 1.0 , 1.0 ) , vec2 < f32 > ( - 1.0 , - 1.0 ) , vec2 < f32 > ( - 1.0 , 1.0 ) ) ; return vec4 < f32 > ( O_b [ O_a ] , 0.5 , 1.0 ) ; } @ fragment fn fullFrag ( ) -> @ location ( 0 ) vec4 < f32 > { return vec4 ( 1 , 0 , 0 , 1 ) ; } ",qdt=class{constructor(o){this.equalPipelineIndex={},this.notEqualPipelineIndex={},this.scene=o;let t=o.gpu;this.gpu=t,this.desc={colorAttachments:[],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"}},this.module=this.gpu.createShaderModule(Xdt)}getPipeline(o,t){let e=t?this.equalPipelineIndex:this.notEqualPipelineIndex;return e[o]||(e[o]=this.gpu.device.createRenderPipeline({layout:"auto",vertex:{module:this.module,entryPoint:"fullVert"},primitive:{topology:"triangle-list"},depthStencil:{format:v2,depthWriteEnabled:!1,depthCompare:"always",stencilWriteMask:255,stencilReadMask:o,stencilFront:{compare:t?"equal":"not-equal",passOp:"replace"},stencilBack:{compare:t?"equal":"not-equal",passOp:"replace"}}})),e[o]}draw(o,t,e,r){this.desc.depthStencilAttachment.view=o.depthStencilTexture.view;let i=this.scene.commandEncoder.beginRenderPass(this.desc);i.setPipeline(this.getPipeline(r,t)),i.setStencilReference(e),i.draw(6),i.end()}},OJ=1,TDe,BJ=class Ube extends MLe{constructor(t,e,r,i=!0,n=!1,s){if(super(),this.planeIdBitmap=new Cg(lrt),this.dataU=new Uint32Array(2**20),this.dataOffset=0,this.normalPlanes=[],this.colorMap=new OLe,this.staticPolygonInfoMap=new Cg(32),this.stringInfoMap=new Map,this.sdfStringInfoMap=new Map,this.sdfStringIndexAndNumMap=new Map,this.sdfStringIndexWidthMap=new Map,this.planes=[],this.m_nRecordRenderMode=this.getRenderMode(),this.forceRender=!1,this.numGrids=new Array(R2e).fill(0).map(()=>new Map),this.logFps=!1,this._processDefaultBlockData=!1,this.colors=[],this.isMac=((TDe=navigator.platform)==null?void 0:TDe.toUpperCase().indexOf("MAC"))>=0||navigator.userAgent.indexOf("Macintosh")>=0||navigator.userAgent.indexOf("Mac OS X")>=0,this.isResize=!1,this.renderI=0,this.viewOffset=S.ORIGIN,this.instantiationTime=performance.now(),this.renderPtNum=0,this.renderVertexNum=0,this.drawTimes=0,this.drawTemplateToTargetTimes=0,this.renderPtTypeNum=Array(69).fill(0),this.isWaitingRender=!1,this.gpuTimes=new Float64Array(10),this.cpuTimes=new Float64Array(10),this.gpuTimeI=0,this.cpuTimeI=0,this.renderTimes=0,this.startTime=performance.now(),nwe("gpu"),this.MIN_WH=Oy.getMinRenderGridWH()||2**5,this.commandEncoder=t.device.createCommandEncoder(),this.logFps=Oy.useLogFps(),this.useGridAccelerate=i,this.useProxy=n,this.char=new $ot(t),this.gpu=t,this.texturePool=new ist(t),this.planeIdBitmap.markUsed(0),this.sceneType=r,this.renderColorTexture=t.createDynamicTexture(1,1,za,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"renderTexture of Scene"),this.highLightColorTexture0=t.createDynamicTexture(1,1,za,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"highLightRenderTexture0 of Scene"),this.highLightColorTexture1=t.createDynamicTexture(1,1,za,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"highLightRenderTexture1 of Scene"),this.depthStencilTexture=t.createDynamicTexture(1,1,v2,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING,"depthStencilTexture of Scene"),this.cameraBuf=this.gpu.createDynamicBuffer(zLe,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,"cameraBuf of Scene"),this.dataBuf=this.gpu.createDynamicBuffer(this.dataU.length,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"dataBuf of Scene"),this.colorsBuf=this.gpu.createDynamicBuffer(4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"colorsBuf of Scene"),this.staticPolygonInfoBuilder=$m.create(Float32Array,t,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"staticPolygonInfoBuf of Scene"),this.staticPolygonInfoBuilder.setArr(new Float32Array(Ld),0),this.stringInfoBuilder=$m.create(Uint32Array,t,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"stringInfoBuf of Scene"),this.sdfStringInfoBuilder=$m.create(Float32Array,t,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"sdfStringInfoBuf of Scene"),this.clearCanvasDesc={colorAttachments:[{view:null,clearValue:{r:this.backgroundColor.r,g:this.backgroundColor.g,b:this.backgroundColor.b,a:this.backgroundColor.alpha},loadOp:"clear",storeOp:"store"},{view:null,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"},{view:null,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}],label:"clearCanvasDesc of Scene"},this.clearStencilDesc={colorAttachments:[],depthStencilAttachment:{view:this.depthStencilTexture.view,depthClearValue:0,depthLoadOp:"load",depthStoreOp:"store",stencilClearValue:64,stencilLoadOp:"clear",stencilStoreOp:"store"},label:"clearStencilDesc of Scene"},this.clearDepthStencilDesc={colorAttachments:[],depthStencilAttachment:{view:this.depthStencilTexture.view,depthClearValue:0,depthLoadOp:"clear",depthStoreOp:"store",stencilClearValue:64,stencilLoadOp:"clear",stencilStoreOp:"store"},label:"clearDepthStencilDesc of Scene"},this.depthStencilTexture.addListener(a=>{this.clearStencilDesc.depthStencilAttachment.view=a,this.clearDepthStencilDesc.depthStencilAttachment.view=a}),this.ptGroup=new swe($m.create(Int32Array,t,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.STORAGE,"ptGroup of builder")),this.ptTemplate=new NLe($m.create(Float32Array,t,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX,"PtTemplate Data of builder")),this.sdfStringLibrary=new qtt(this),this.drawStencilProgram=new qdt(this),this.renderPtProgram=new ort(this,e.renderPt),this.renderHighLightPtProgram=new tst(this),this.textureProgram=new qot(this),this.renderColorProgram=new rst(this),this.rulerProgram=new cst(this),this.screenAAProgram=new Zot(this),this.gridProgram=new ust(this,1,1,ee.WHITE),this.polarProgram=new pst(this,1,1,ee.WHITE),srt){let a=document.createElement("button");a.onclick=async()=>{this.render()},a.style.position="absolute",a.innerText="Test",a.style.zIndex="999",a.style.width="200px",a.style.height="50px",a.style.left="50%",document.body.appendChild(a)}this.group=new x2(3,!0,"scene"),this.highLightGroup0=new x2(3,!1,"highLightGroup0"),this.highLightGroup1=new x2(3,!1,"highLightGroup1"),this.measureTooGroup=new x2(3,!1,"measureTooGroup"),this.sceneType===0&&this.sdfStringLibrary.init(),this.highlightPlane0=this.createHighLightPlane(-.2,0),this.highlightPlane1=this.createHighLightPlane(-.1,1),this.measureToolPlane=this.createMeasureToolPlane(),this.ambientLight=new BLe(ee.build(.1,.1,.1)),this.directionalLight=new FLe(ee.build(1,1,1),new Mt(0,0,1)),s&&this.installMessageBus(s),this.meshProgramGPU=new Ydt(this),this.drawColorUseStencilProgram=new jdt(this)}static async build(t,e,r,i){let n=gS();try{let s=await HLe.build(),a=await crt(s),l,c=u=>{l=u.error,s.device.removeEventListener("uncapturederror",c)};s.device.addEventListener("uncapturederror",c);let h;if(r?h=new Proxy(new Ube(s,a,t,e,r,i),_v):h=new Ube(s,a,t,e,r,i),await s.device.queue.onSubmittedWorkDone(),n._WEBGPU_DEVICE_LOST_INFO_&&(l=n._WEBGPU_DEVICE_LOST_INFO_),s.device.removeEventListener("uncapturederror",c),l)throw l;return h}catch(s){throw s}}installMessageBus(t){t.rpcService("/engine/scene/setBackgroundColor",e=>{try{this.modifyBgColor(ee.of5(...e))}catch{this.modifyBgColor(ee.of5("#000000",e[1]))}}),t.rpcService("/engine/scene/setCoordSys",e=>{this.isCartesian=e,this.needRender=!0}),t.rpcService("/engine/scene/setGridType",e=>{this.gridProgram.visible=e,this.needRender=!0}),t.rpcService("/engine/scene/setGridPattern",e=>{this.gridProgram.modifyModel(e),this.needRender=!0}),t.rpcService("/engine/scene/setGridColor",e=>{this.gridProgram.modifyColor(ee.of5(...e)),this.needRender=!0}),t.rpcService("/engine/scene/setCoordinateAxisColor",e=>{this.gridParam.coordinateAxisColor=ee.of5(...e),this.gridParam.coordinateAxisTransparency=1-e[1],this.needRender=!0}),t.rpcService("/engine/scene/setGridDelta",e=>{this.gridProgram.setGridX(e[0]),this.gridProgram.setGridY(e[0]),this.needRender=!0}),t.rpcService("/engine/scene/setPolarDelta",e=>{this.polarProgram.angleDelta=qh.toRadians(e[0]),this.polarProgram.radius=e[1],this.needRender=!0}),t.rpcService("/engine/scene/setPolarRadius",e=>{this.polarProgram.minRadius=e[0],this.polarProgram.maxRadius=e[1],this.needRender=!0}),t.rpcService("/engine/scene/setPolarAngle",e=>{this.polarProgram.startAngle=qh.toRadians(e[0]),this.polarProgram.endAngle=qh.toRadians(e[1]),this.needRender=!0}),t.rpcService("/engine/scene/setOpenRuler",e=>{this.openRuler=e}),t.rpcService("/engine/scene/setUnit",e=>{this.modifyUnit(e),this.needRender=!0}),t.rpcService("/engine/scene/setRulerBackgroundColor",e=>{this.setRulerBackgroundColor(ee.build(e[0],e[1],e[2],e[3]))}),t.rpcService("/engine/scene/setRulerStringColor",e=>{this.setRulerStringColor(ee.build(e[0],e[1],e[2],e[3]))}),t.rpcService("/engine/scene/setRulerTextColor",e=>{this.setRulerStringColor(ee.build(e[0],e[1],e[2],e[3]))}),t.rpcService("/engine/scene/getRulerBackgroundColor",()=>this.getRulerBackgroundColor()),t.rpcService("/engine/scene/getRulerStringColor",()=>this.getRulerStringColor()),t.rpcService("/engine/scene/getRulerTextColor",()=>this.getRulerStringColor())}setFpsLogTime(){this.logFps&&(this.submitCommandEncoder(),this.gpu.device.queue.onSubmittedWorkDone().then(()=>{this.gpuTimes[this.gpuTimeI++]+=performance.now()-this.gpuStart,this.gpuStart=performance.now()}),this.cpuTimes[this.cpuTimeI++]+=performance.now()-this.cpuStart,this.cpuStart=performance.now())}set processDefaultBlockData(t){this._processDefaultBlockData=t}get processDefaultBlockData(){return this._processDefaultBlockData}setMask(t,e,r,i){throw new Error("not support")}clearMask(){throw new Error("not support")}getMinWh(){return this.MIN_WH}init(){this.context=this.currentCamera.getCanvas().getContext("webgpu"),this.context.configure({device:this.gpu.device,format:za,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST}),window.addEventListener("unload",()=>{this.context.unconfigure()}),this.forceRender=Oy.useForceRender(),this.measurePtTool=new _Le(this.measureToolPlane,this.currentCamera,$m.create(Float32Array,this.gpu,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.STORAGE,"measurePtTool of builder")),this.renderRequestAnimationFrame(),this.gridParam.addUpdateListener(()=>{this.needRender=!0})}getUseGridAccelerate(){return this.useGridAccelerate}getUseProxy(){return this.useProxy}createHighLightPlane(t,e){let r=this.planeIdBitmap.findEmpty();this.planeIdBitmap.markUsed(r);let i;return this.getUseProxy()?i=new Proxy(new iE(this,r,ee.DefaultHighLightColor,void 0,"highLight",!1,!0,!0),_v):i=new iE(this,r,ee.DefaultHighLightColor,void 0,"highLight",!1,!0,!0),i.setIsColorful(!0),e===0?(this.highLightGroup0.add(i),this.highLightGroup0.setPosition(new Mt(0,0,t)),this.group.add(this.highLightGroup0)):e===1&&(this.highLightGroup1.add(i),this.highLightGroup1.setPosition(new Mt(0,0,t)),this.group.add(this.highLightGroup1)),this.planes.push(i),i}createMeasureToolPlane(){let t=this.planeIdBitmap.findEmpty();this.planeIdBitmap.markUsed(t);let e;return this.getUseProxy()?e=new Proxy(new iE(this,t,ee.WHITE,void 0,"MeasureTool",!1,!1),_v):e=new iE(this,t,ee.WHITE,void 0,"MeasureTool",!1,!1),e.setIsColorful(!0),this.measureTooGroup.add(e),this.measureTooGroup.setPosition(new Mt(0,0,-.1)),this.group.add(this.measureTooGroup),this.planes.push(e),e}setFillStyleSpacing(t){throw new Error("setFillStyleSpacing not support")}addCamera(t){super.addCamera(t),this.resize(),this.init()}addCamera0(t){t.setScene(this),this.currentCamera=t,this.cameraSet.add(t)}getHighLightPlane(t){if(t==0)return this.highlightPlane0;if(t==1)return this.highlightPlane1;throw new Error("highLightGroupId is incorrect")}addPtGroup(){return this.ptGroup.add()}removePtGroup(t){this.ptGroup.remove(t),this.updateGroupRenderModeRecord(t,0),this.needRender=!0}setPtGroup(t,e,r=!1,i,n=!1,s,a=0){let l=this.getColorIndex(s);this.ptGroup.set(t,e,r,i,n,l,a),this.comparisonAndRecordPtGroupStatus(()=>{},t,e,r,i,n,l,a),this.updateGroupRenderModeRecord(t,a)}createPtTemplateId(){return this.ptTemplate.createTemplateId()}removePtTemplateId(t){let e=this.ptTemplate.getInstanceIds(t);this.planes.forEach(r=>{r.removeTemplate(t,e)}),this.ptTemplate.removeTemplateId(t)}addTemplateInstance(t,e){let r=this.ptTemplate.addTemplateInstance(t,e);return this.planes.forEach(i=>{i.addTemplateInstance(t,r)}),r}removeTemplateInstance(t,e){this.planes.forEach(r=>r.removeTemplateInstance(e)),this.ptTemplate.removeTemplateInstance(t,e)}updateTemplateInstance(t,e,r){this.ptTemplate.updateTemplateInstance(t,e,r),this.planes.forEach(i=>{i.updateTemplateInstance(t,e)})}addStaticPolygonInfo(t,e,r=-1,i=-1,n){let s=this.staticPolygonInfoMap.findEmpty();s===-1&&(this.staticPolygonInfoMap=this.staticPolygonInfoMap.extSize(this.staticPolygonInfoMap.size*2),s=this.staticPolygonInfoMap.findEmpty()),this.staticPolygonInfoMap.markUsed(s);let a=s*Ld;return this.staticPolygonInfoBuilder.setArr(new Array(Ld).fill(0),a),this.setStaticPolygonInfo(s,n||Ae.ORIGIN),this.staticPolygonInfoBuilder.set(a+6,t||0),this.staticPolygonInfoBuilder.set(a+7,this.getColorIndex(e)||0),this.staticPolygonInfoBuilder.set(a+8,r),this.staticPolygonInfoBuilder.set(a+9,i),s}removeStaticPolygonInfo(t){this.staticPolygonInfoMap.markRemove(t)}setStaticPolygonInfo(t,e){let r=e.data;return this.staticPolygonInfoBuilder.setArr([r[0],r[1],r[4],r[5],r[12],r[13]],t*Ld),t*Ld}addStringInfo(t){if(!t)return-1;let e=this.stringInfoMap.get(t);return e!==void 0||(e=this.stringInfoBuilder.getLength(),this.stringInfoMap.set(t,e),this.char.createString(t,r=>this.stringInfoBuilder.push(r))),e}recordSdfNum(t,e,r){if(r){if(t!==e){let i=this.sdfStringIndexAndNumMap.get(t);i?i=i+1:i=1,this.sdfStringIndexAndNumMap.set(t,i);let n=this.sdfStringIndexAndNumMap.get(e)-1;this.sdfStringIndexAndNumMap.set(e,n),n<=0&&this.sdfTool.removeSdfStringInfo(e,!0)}}else{let i=this.sdfStringIndexAndNumMap.get(t);i?i=i+1:i=1,this.sdfStringIndexAndNumMap.set(t,i)}}addSdfStringInfo(t,e,r,i){let n=`${t}$${JSON.stringify(e)}`,s=this.sdfStringInfoMap.get(n);if(s!==void 0){this.recordSdfNum(s,r,i);let d=this.sdfStringIndexWidthMap.get(s);return{strIndex:s,fontWidth:d}}s=this.sdfStringInfoBuilder.getLength(),this.sdfStringInfoMap.set(n,s);let{storageBufIndex:a,offset:l,bufWidth:c,bufHeight:h,fontWidth:u}=this.sdfTool.creatSdfTexture(t,e,s);return this.sdfStringInfoBuilder.pushArr([a,l,c,h]),this.recordSdfNum(s,r,i),this.sdfStringIndexWidthMap.set(s,u),{strIndex:s,fontWidth:u}}getColorIndex(t,e=0,r=!1){let i;return!t||!r&&t.r+t.g+t.b===0&&t.alpha===1?i=0:i=this.colorMap.computeIfAbsent(t,()=>{let n=this.colorMap.size()+1;return n*4>=this.colorsBuf.getSize()&&this.colorsBuf.extSize(this.colorsBuf.getSize()*2),this.colorsBuf.write(n*4,new Float32Array([t.r,t.g,t.b,t.alpha])),this.colors[n]=t,n}),(i<<1)+e}releasePlaneId(t){this.planeIdBitmap.markRemove(t);let e=this.planes.findIndex(r=>r.id===t);this.planes[e].isNormal&&this.normalPlanes.splice(this.normalPlanes.findIndex(r=>r.id===t),1),this.planes.splice(e,1)}addData(t,e,r=0){if(this.dataOffset+t.length>this.dataU.length){if(t.length>this.dataU.length)throw new Error("data.length > this.dataU.length");this.submitCommandEncoder()}this.dataU.set(t,this.dataOffset),this.gpu.copyBufferToBuffer(this.dataBuf,this.dataOffset,e,r,t.length,this.commandEncoder),this.dataOffset+=t.length}submitCommandEncoder(){this.gpu.writeBuffer(this.dataBuf,0,this.dataU,0,this.dataOffset),this.gpu.submit(this.commandEncoder),this.texturePool.recall(),this.dataOffset=0,this.commandEncoder=this.gpu.device.createCommandEncoder()}setSampling(t,e=this.currentCamera.getWidth(),r=this.currentCamera.getHeight()){t>1?this.antialias=!0:this.antialias=!1,this.screenAAProgram.setSampling(t),this.resizeExceptCanvas(e,r)}getSampling(){return this.screenAAProgram.getSampling()}setAntialias(t,e=this.currentCamera.getWidth(),r=this.currentCamera.getHeight()){console.log("\u6297\u952F\u9F7F\u6539\u53D8",`${this.antialias} -> ${t}`),super.setAntialias(t),this.setSampling(t?2:1,e,r)}updateCameraBuf(t,e){this.addData(new Uint32Array(Xot(t,e).buffer),this.cameraBuf)}setDrcRenderModel(t){this.drcRenderModel=t,this.needRender=!0}setDrcRenderStyle(t){this.drcRenderStyle=t,this.needRender=!0}onRenderModeChange(){let t=this.getRenderMode();console.log("\u6E32\u67D3\u6A21\u5F0F\u6539\u53D8",`${this.m_nRecordRenderMode} -> ${t}`),this.m_nRecordRenderMode=t}renderHighLightPlane(t,e,r,i,n,s,a,l,c){c();for(let h=0;h<this.highLightColor.length;h+=1)if(this.highLightColor[h])for(let u of e)u[0].renderHighLightPt(t,r,h,i,n,s,a,l,!0);this.highLightColor[0]&&!this.highlightPlane0.isEmpty()&&this.highlightPlane0.renderHighLightPt(t,r,0,i,n,!1,!1,!0),this.highLightColor[1]&&!this.highlightPlane1.isEmpty()&&this.highlightPlane1.renderHighLightPt(t,r,1,i,n,!1,!1,!0)}getVisibleHighlightAndNormalBBox2(){let t=new _e;return this.normalPlanes.forEach(e=>{!e.isRender()||e.isEmpty()||t.ext1(e.getAllPtBbox())}),this.highlightPlane0.isRender()&&!this.highlightPlane0.isEmpty()&&t.ext1(this.highlightPlane0.getAllPtBbox()),this.highlightPlane1.isRender()&&!this.highlightPlane1.isEmpty()&&t.ext1(this.highlightPlane1.getAllPtBbox()),t.valid()&&t.build()}getHasGroupForceHighLight(){return this.hasGroupForceHighLight}render0(t,e,r){this.renderI++,this.group.getIsChange()&&this.group.setIsChange(!1),this.measurePtTool.updateRuler();let i=this.groupStatusQuery(),n=i.hasGroupHighLight;this.hasGroupForceHighLight=i.hasGroupForceHighLight,this.getRenderMode()!==this.m_nRecordRenderMode&&this.onRenderModeChange(),this.currentCamera.adjustAxis(this.group);let s={colorTexture:this.antialias?this.screenAAProgram.colorTexture:{view:t},highLightColorTexture0:this.antialias?this.screenAAProgram.highLightColorTexture0:{view:e},highLightColorTexture1:this.antialias?this.screenAAProgram.highLightColorTexture1:{view:r},depthStencilTexture:this.depthStencilTexture};this.clearCanvasDesc.colorAttachments[0].view=t,this.clearCanvasDesc.colorAttachments[1].view=e,this.clearCanvasDesc.colorAttachments[2].view=r,this.commandEncoder.beginRenderPass(this.clearCanvasDesc).end(),this.commandEncoder.beginRenderPass(this.clearDepthStencilDesc).end(),this.antialias&&this.screenAAProgram.clearColor();let a=this.currentCamera,l=this.getRenderMode(),c=[],h=this.group.getMeshCache(l);if(this.group.getPlaneMatrixRenderModes(l).forEach(d=>{let p=d,m=p[0];m.getBBox()&&!m.isHighLight&&c.push(p)}),this.sortByCameraZ(a,c),this.setFpsLogTime(),this.updateCameraBuf(a,Number.NEGATIVE_INFINITY),this.staticPolygonInfoBuilder.updateBuf(),this.stringInfoBuilder.updateBuf(),this.ptTemplate.getTemplateInstanceData().updateBuf(),n&&this.renderPtProgram.highLightStencilBuf.clear(this.commandEncoder),this.setFpsLogTime(),this.render1(l,a,s,h,!0),this.setFpsLogTime(),!Oy.isCloseGridRender()&&this.gridParam.renderGrid&&(this.gridParam.currentCoord?this.gridProgram.render(t,a):this.polarProgram.render(t,a)),this.setFpsLogTime(),this.render1(l,a,s,h,!1),this.setFpsLogTime(),n){if(!this.highLightColor.length)return;this.renderPtProgram.afterDraw.renderPolygonHighLightColor(s,this.highLightColor[0],this.highLightColor[1])}this.hasHighLightPt()&&this.renderHighLightPlane(s,c,a,l,Number.POSITIVE_INFINITY,!0,!0,!0,()=>{this.commandEncoder.beginRenderPass(this.clearStencilDesc).end()});let u=h.labelMapIndex.pthSide;if(u){this.meshProgramGPU.setViewOffsetZ(-1e-5);for(let d of u){let[p,m]=d;p.label==="pthSide"&&p.draw(this,s,m)}this.meshProgramGPU.setViewOffsetZ(0)}this.drawMeshes(h,!1,s,a),this.drawMeshes(h,!0,s,a),this.setFpsLogTime(),this.antialias?(this.screenAAProgram.renderSSAA(t),this.screenAAProgram.renderSSAA(t,0),this.screenAAProgram.renderSSAA(t,1)):(this.renderColorProgram.render(t,0),this.renderColorProgram.render(t,1)),this.setFpsLogTime(),this.openRuler&&this.rulerProgram.render(t,a,this.getRulerBackgroundColor(),this.getRulerStringColor()),this.submitCommandEncoder(),this.setFpsLogTime(),a.rendered()}render1(t,e,r,i,n){let s=e.getRenderMatrix(),a=e.getWidth()*this.getSampling(),l=e.getHeight()*this.getSampling(),c=[],h=i.opaqueMap.size+i.transparentMap.size;for(let d in i.labelMapIndex)h+=i.labelMapIndex[d].size;if(!n){let d=i.labelMapIndex.boardSide;if(d)for(let p of d){let[m,g]=p;for(let y of g)c.push([m,y.matrix,y.renderMode])}}this.group.getPlaneMatrixRenderModes(t).forEach(d=>{let p=d,m=p[0];n&&!m.getIsUnderGrid()||!n&&m.getIsUnderGrid()||(m.isRender()&&!m.isHighLight&&m.getBBox()?c.push(p):m.markDrawn(d[1],this.renderI))});let u=[[],[]];if(e.isOrthCamera())c.sort((d,p)=>{let m=d[0].getBBox().transform(d[1]),g=p[0].getBBox().transform(p[1]);return m.minZ+m.maxZ-(g.minZ+g.maxZ)}),e.getTar2Pos().z<0&&c.reverse(),u[0]=c;else{let d=e.getZ();u[0]=c.filter(p=>{let m=p[0].getBBox().transform(p[1]);return m.minZ<=d&&m.maxZ>=d||(m.minZ+m.maxZ)/2>d}),u[1]=c.filter(p=>{let m=p[0].getBBox().transform(p[1]);return m.minZ<=d&&m.maxZ>=d||(m.minZ+m.maxZ)/2<d}),u.forEach(p=>p.sort((m,g)=>{let y=m[0].getBBox().transform(m[1]),b=g[0].getBBox().transform(g[1]);return(b.minZ<=d&&b.maxZ>=d?0:Math.abs((b.minZ+b.maxZ)/2-d))-(y.minZ<=d&&y.maxZ>=d?0:Math.abs((y.minZ+y.maxZ)/2-d))}))}for(let d of u){let p,m;for(let b=d.length-1;b>=0;b--){let[P,T,I]=d[b];if(P instanceof Q7){(I===4||I===2&&P.getMaterial().alpha===1)&&(p=P),e.isOrthCamera()&&e.getTar2Pos().x+e.getTar2Pos().y===0&&(console.log("\u5254\u9664\u6E32\u67D3\u5BF9\u8C61",P.label,"\u6444\u50CF\u673A\u5728\u4FA7\u9762"),P.markDrawn(T,this.renderI),h-=1);continue}let C;if(!e.isOrthCamera()){let E=!0,O=P.getBBox();C=[new Mt(O.minX,O.minY,0),new Mt(O.minX,O.maxY,0),new Mt(O.maxX,O.minY,0),new Mt(O.maxX,O.maxY,0)].map(_=>_.multiply4(T).multiply4(s));for(let _ of C)if(_.z>1||_.z<=0){E=!1;break}if(!E){console.log("\u5254\u9664\u6E32\u67D3\u5BF9\u8C61",P.label,"\u6CA1\u6709\u5728\u89C6\u91CE\u4E2D"),P.markDrawn(T,this.renderI);continue}}if(p){if(p instanceof Q7)console.log("\u5254\u9664\u6E32\u67D3\u5BF9\u8C61",P.label,"\u57FA\u677F\u906E\u6321"),P.markDrawn(T,this.renderI),h-=1;else if(Dv.eq(e.getTar2Pos().z,0)&&(e.isOrthCamera()||Dv.eq(Mt.ORIGIN.multiply4(T).z,e.getTarget().z)))console.log("\u5254\u9664\u6E32\u67D3\u5BF9\u8C61",P.label,"\u6444\u50CF\u673Az\u8F74"),P.markDrawn(T,this.renderI);else if(p.ableCover(P)){let E=p.getBBox(),O=!0,_=[new Mt(E.minX,E.minY,0),new Mt(E.minX,E.maxY,0),new Mt(E.maxX,E.minY,0),new Mt(E.maxX,E.maxY,0)].map(R=>R.multiply4(T).multiply4(s));for(let R=0;R<_.length;R++){let v=_[R],D=m[R];if(Math.abs(v.x-D.x)*a>OJ||Math.abs(v.x-D.x)*l>OJ){O=!1;break}}O?(console.log("\u5254\u9664\u6E32\u67D3\u5BF9\u8C61",P.label,"\u906E\u6321"),P.markDrawn(T,this.renderI)):p=null}}if(!(p instanceof iE)&&P.isBoard(I))if(p=P,C)m=C;else{let E=P.getBBox();m=[new Mt(E.minX,E.minY,0),new Mt(E.minX,E.maxY,0),new Mt(E.maxX,E.minY,0),new Mt(E.maxX,E.maxY,0)].map(O=>O.multiply4(T).multiply4(s))}}let g,y;for(let b=0;b<d.length;b++){let P=function(){let E=g.getBBox(),O=[new Mt(E.minX,E.minY,0),new Mt(E.minX,E.maxY,0),new Mt(E.maxX,E.minY,0),new Mt(E.maxX,E.maxY,0)],_=!0;for(let R of O){let v=R.multiply4(I).multiply4(s),D=R.multiply4(y).multiply4(s);if(Math.abs(v.x-D.x)*a>OJ||Math.abs(v.x-D.x)*l>OJ){_=!1;break}}return _},[T,I,C]=d[b];if(!T.hadDrawn(I,this.renderI)){if(T instanceof Q7){C===2&&T.getMaterial().alpha!==1&&T.draw(this,r,[{matrix:I,renderMode:C,color:null}]);continue}if(C!==1&&(!g||!T.hasInterPlane(g)||!P())){let E,O;for(let _=b+1;_<d.length;_++){let[R,v]=d[_];if(R instanceof iE){E=R,O=v;break}}g=E==null?void 0:E.getMutualStencilPlane(T),g&&(y=O,P()?(y=I,g.drawStencilPlane(r,e,y,C,!0,!0,!0,!0,h>0)):g=null)}T.draw(r,e,I,C,!0,!0,!0,!0,g,h>0),T.lightLayer&&T.lightLayer[1].getVisible()&&!T.lightLayer[0].isEmpty()&&C===2&&(T.lightLayer[0].draw(r,e,I,0,!0,!0,!0,!0,null,h>0),g=null)}}}}drawMeshes(t,e,r,i){if(e){let n=[];for(let s of t.transparentMap.entries()){let[a,l]=s;l.filter(c=>{let h=c.renderMode,u=h===2||h===1?a.getMaterial().alpha:h===0?a.getColor().alpha:1;u!==0&&u!==1&&n.push([a,c])})}n.sort((s,a)=>{let l=s[0].getBBox().transform(s[1].matrix),c=a[0].getBBox().transform(a[1].matrix);return i.getZ()>0?l.minZ+l.maxZ-(c.minZ+c.maxZ):c.minZ+c.maxZ-(l.minZ+l.maxZ)}),n.forEach(s=>{s[0].draw(this,r,[s[1]])})}else for(let n of t.opaqueMap.entries())n[0].draw(this,r,n[1])}resetRenderInfo(){this.renderPtNum=0,this.renderVertexNum=0,this.drawTimes=0,this.drawTemplateToTargetTimes=0,this.renderPtTypeNum=Array(69).fill(0)}getGridInfo(){let t=0,e=0,r=0;return this.numGrids.forEach(i=>{i.forEach(n=>{n.forEach(s=>{t+=s,r=Math.max(r,s)}),e+=n.size})}),{gridNum:e,gridPtNum:t,maxGridPtNum:r}}renderRequestAnimationFrame(){this.fpsCount();let t=this.needRender||this.processDefaultBlockData;this.render(),this.renderRuler(this.currentCamera),!t&&this.gpu.memoryManager.alignMemory()&&(t=!0),this.processDefaultBlockData=!1,this.animationId=requestAnimationFrame(async()=>{if(!this.isMac||this.isResize){this.isResize=!1,this.renderRequestAnimationFrame();return}this.isWaitingRender||(this.isWaitingRender=!0,Oy.macNoOnSubmittedWorkDone()||await this.gpu.device.queue.onSubmittedWorkDone(),this.isWaitingRender=!1,this.renderRequestAnimationFrame())})}setForceVisibleHighLightPt(t){t!=this.forceVisibleHighLightPt&&(this.forceVisibleHighLightPt=t,this.needRender=!0)}setForceDeactivateRatio(t){this.forceDeactivateRatio!==t&&(this.forceDeactivateRatio=t,this.needRender=!0)}getInfo(){return{engine:"webgpu",fps:this.getFps(),ptNum:this.planes.reduce((t,e)=>t+e.getPtNum(),0)}}dispose(){this.animationId&&cancelAnimationFrame(this.animationId)}hasHighLightPt(){for(let t of this.planes)if(!t.isEmpty()){if(t.isHighLight){if(t.getPtNum()>0)return!0}else if(t.getHighLightPtNum()>0)return!0}return!1}render(t=this.currentCamera){if(this.rayTracing){this.rayTracing.render();return}if(!this.needRender&&!this.forceRender&&!Oy.isContinuedRender())return;if(this.needRender=!1,this.resetRenderInfo(),this.gpu.device.queue.onSubmittedWorkDone().then(()=>{this.gpuTimeI=0,this.gpuStart=performance.now()}),this.cpuTimeI=0,this.cpuStart=performance.now(),this.render0(this.renderColorTexture.view,this.highLightColorTexture0.view,this.highLightColorTexture1.view),this.updateCanvasTexture(),this.instantiationTime&&this.planes.findIndex(r=>r.builder.getPtNum()!==0)!==-1){console.log("init time:",performance.now()-this.instantiationTime),delete this.instantiationTime;let r=gS();console.log("bufferSizeGPU:",r.bufferSizeGPU),console.log("bufferSizeIndex:",JSON.stringify(r.bufferSizeIndex)),console.time("grids forEach");let i=this.getGridInfo();console.timeEnd("grids forEach"),console.log(JSON.stringify(i));let n=0,s=Array(69).fill(0),a=0,l=0,c=0,h=0,u=0,d=0,p=0,m=0;this.planes.forEach(g=>{n+=g.getPtNum();let y=g.getPtTypeNum();for(let b=0;b<y.length;b++){let P=y[b];s[b]+=P,m+=P*Ur.getPtLengthByType(b),c+=P*UJ(b),b>=21&&(l+=P,h+=P*UJ(b))}a+=g.templateInstancePtMap.size,g.customTemplateInstancePtNumBuilder.forEach((b,P)=>{u+=b,b!==0&&(d++,p+=g.templateInstancePtMap.get(P).size)})}),console.log("\u56FE\u5143\u603B\u6570:",n),console.log("\u56FE\u5143\u5B57\u8282\u5927\u5C0F:",m*4),console.log("\u5404\u7C7B\u578B\u56FE\u5143\u6570\u91CF:",s),console.log("\u975E\u7F51\u683C\u56FE\u5143\u6570\u91CF:",n-i.gridPtNum),console.log("\u6A21\u677F\u6570\u91CF\uFF1A",this.ptTemplate.getTemplateNum()),console.log("\u6A21\u677F\u5B9E\u4F8B\u6570\u91CF\uFF1A",this.ptTemplate.getMaxTemplateInstanceIndex()+1),console.log("=====\u540E\u7EED\u6A21\u677F\u6307\u6807\u90FD\u662F\u5206\u5C42\u7684====="),console.log("\u6240\u6709\u5C42\u4F7F\u7528\u7684\u6A21\u677F\u5B9E\u4F8B\u6570\u91CF\u603B\u548C\uFF1A",a),console.log("\u6A21\u677F\u5B9E\u4F8B\u56FE\u5143\u603B\u6570\uFF1A",l),console.log("\u6A21\u677F\u7EB9\u7406\u4E2D\u5E73\u5747\u56FE\u5143\u6570\u91CF\uFF1A",l/a),console.log("\u6A21\u677F\u7EB9\u7406\u6E32\u67D3\u65F6\u786C\u6E32\u67D3\u7684\u56FE\u5143\u603B\u6570\uFF1A",n-l+a),console.log("\u6A21\u677F\u7EB9\u7406\u6E32\u67D3\u9876\u70B9\u603B\u6570\uFF1A",c-h+a*6),console.log("\u6A21\u677F\u786C\u6E32\u67D3\u9876\u70B9\u603B\u6570\uFF08\u4E0D\u51C6\u786E\uFF0C\u672A\u6392\u9664\u6A21\u677F\u56FE\u5143\uFF09:",c),console.log("\u81EA\u5B9A\u4E49\u6A21\u677F\u5B9E\u4F8B\u56FE\u5143\u6570\u91CF:",u),console.log("\u81EA\u5B9A\u4E49\u6A21\u677F\u5B9E\u4F8B\u6570\u91CF:",d),console.log("\u81EA\u5B9A\u4E49\u6A21\u677F\u5B9E\u4F8B\u4E2D\u542B\u6709\u7684\u56FE\u5143\u6570\u91CF:",p)}if(this.logFps&&(this.submitCommandEncoder(),this.gpu.device.queue.onSubmittedWorkDone().then(()=>{this.gpuTimes[this.gpuTimeI++]+=performance.now()-this.gpuStart,this.gpuStart=performance.now()}),this.cpuTimes[this.cpuTimeI++]+=performance.now()-this.cpuStart,this.cpuStart=performance.now()),!this.logFps)return;this.renderTimes++;let e=performance.now()-this.startTime;if(e>=1e3){let r=this.renderTimes;this.renderTimes=0,console.log("frame fps:",r/e*1e3,this.currentCamera.getScale()),this.startTime=performance.now(),console.log("virtual cpu fps:",1e3/(this.cpuTimes.reduce((i,n)=>i+n,0)/r)),console.log("cpuTimes:",this.cpuTimes.map(i=>i/r)),this.cpuTimes.fill(0),this.gpu.device.queue.onSubmittedWorkDone().then(()=>{console.log("virtual gpu fps:",1e3/(this.gpuTimes.reduce((i,n)=>i+n,0)/r)),console.log("gpuTimes:",this.gpuTimes.map(i=>i/r)),this.gpuTimes.fill(0)}),console.log("renderPtNum:",this.renderPtNum),console.log("renderPtTypeNum",this.renderPtTypeNum),console.log("renderVertexNum:",this.renderVertexNum),console.log("drawTimes:",this.drawTimes),console.log("drawTemplateToTargetTimes",this.drawTemplateToTargetTimes)}}updateCanvasTexture(){let t=this.gpu.device.createCommandEncoder();t.copyTextureToTexture({texture:this.renderColorTexture.texture},{texture:this.context.getCurrentTexture()},this.renderColorTexture),this.gpu.submit(t)}renderRuler(t){!this.needRender&&this.needRenderRuler&&this.openRuler&&(this.rulerProgram.render(this.renderColorTexture.view,t,this.getRulerBackgroundColor(),this.getRulerStringColor()),this.submitCommandEncoder(),this.updateCanvasTexture(),this.needRenderRuler=!1)}capture(t,e,r,i,n=!1,s=1){var a;let l=this.getSampling(),c=this.currentCamera.getWidth(),h=this.currentCamera.getHeight();n?(this.setSampling(s,t,e),r()):(r(),this.setSampling(s,t,e));let u=this.gpu.createDynamicTexture(t,e,za,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"colorTexture of capture"),d=this.gpu.createDynamicTexture(t,e,za,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"highLightTexture0 of capture"),p=this.gpu.createDynamicTexture(t,e,za,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"highLightTexture1 of capture");this.render0(u.view,d.view,p.view);let m;if((a=window.OffscreenCanvas)!=null&&a.prototype.transferToImageBitmap){let{width:g,height:y}=u,b=new window.OffscreenCanvas(g,y),P=b.getContext("webgpu");P.configure({device:this.gpu.device,format:za,alphaMode:"premultiplied",usage:GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST});let T=this.gpu.device.createCommandEncoder();T.copyTextureToTexture({texture:u.texture},{texture:P.getCurrentTexture()},u),this.gpu.submit(T);let I=b.transferToImageBitmap(),C=document.createElement("canvas");C.width=g,C.height=y;let E=C.getContext("2d");E.drawImage(I,0,0),m=E.getImageData(0,0,g,y),I.close(),P.unconfigure()}else{let{width:g,height:y}=u,b=Math.ceil(g/64)*64,P=this.gpu.createDynamicBuffer(b*y,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST,"buf of saveResult"),T=this.gpu.device.createCommandEncoder();T.copyTextureToBuffer({texture:u.texture},{buffer:P.getBuffer(),bytesPerRow:b*fs,rowsPerImage:y},{width:g,height:y}),this.gpu.submit(T),m=P.getBuffer().mapAsync(GPUMapMode.READ).then(()=>{let I=new Uint8ClampedArray(P.getBuffer().getMappedRange().slice(0));if(P.getBuffer().unmap(),P.destroy(),b===g)return new ImageData(I,g,y);let C=new Uint8ClampedArray(g*y*4);for(let E=0;E<y;E++)C.set(I.slice(E*b*4,(E*b+g)*4),E*g*4);return new ImageData(C,g,y)})}return this.setSampling(l,c,h),i(),u.destroy(),d.destroy(),p.destroy(),m}resizeExceptCanvas(t,e){this.currentCamera.updateSize(t,e),this.rulerProgram.resize(t,e),this.gridProgram.resize(t,e),this.renderColorTexture.updateSize(t,e),this.highLightColorTexture0.updateSize(t,e),this.highLightColorTexture1.updateSize(t,e);let r=this.screenAAProgram.getSampling();t*=r,e*=r,this.screenAAProgram.colorTexture.updateSize(t,e),this.screenAAProgram.highLightColorTexture0.updateSize(t,e),this.screenAAProgram.highLightColorTexture1.updateSize(t,e),this.depthStencilTexture.updateSize(t,e),this.renderPtProgram.updateSize(t,e),this.needRender=!0,this.isResize=!0}resize(){let t=this.currentCamera.getCanvas(),e=this.getPixelRatio(),r=t.getBoundingClientRect(),i=Math.round(r.width*e),n=Math.round(r.height*e);(i===0||n===0)&&(i=1,n=1),!(t.width===i&&t.height===n)&&(t.width=i,t.height=n,this.resizeExceptCanvas(i,n))}isCoreGraphic(){return!0}createPlane(t,e,r=null,i=!0,n=!0,s=!1,a=!1){let l=this.planeIdBitmap.findEmpty();this.planeIdBitmap.markUsed(l);let c;return this.getUseProxy()?c=new Proxy(new iE(this,l,t,void 0,e,i,n,!1,s,a),_v):c=new iE(this,l,t,void 0,e,i,n,!1,s,a),c.setMaterial(r),this.planes.push(c),c.isNormal&&this.normalPlanes.push(c),this.updatePlanePart(this.panelizeMatrix,c),c}modifyUnit(t){this.rulerProgram.modifyUnit(t)}getBackgroundColor(){return this.backgroundColor}set openRuler(t){this._openRuler!==t&&(this._openRuler=t,this.needRender=!0)}get openRuler(){return this._openRuler}getCaptureImageData(t,e,r,i,n=!0,s=0){let a,l,c,h,u,d;return this.capture(t,e,()=>{a=this.openRuler,this.openRuler=!1,l=this.gridParam.visible,d=this.gridParam.getMultiStyle(),this.gridParam.visible=0,this.gridParam.setMultiStyle(2),c=this.getBgColor(),n&&this.modifyBgColor(ee.BLACK),h=this.currentCamera.getTarget(),u=this.currentCamera.getScale(),this.currentCamera.setTarget(new Mt(r.center().x,r.center().y,0)),this.currentCamera.setScale(i)},()=>{this.openRuler=a,this.gridParam.visible=l,this.gridParam.setMultiStyle(d),n&&this.modifyBgColor(c),this.currentCamera.setTarget(h),this.currentCamera.setScale(u)})}async getCaptureImageData1(t,e,r,i){return this.capture(t,e,r,i,!0)}getTexture(t){if(!(t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLImageElement))throw new Error("not support");let e=this.gpu,{width:r,height:i}=t,n=e.createDynamicTexture(r,i,za,GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,"texture of getTexture");if(t instanceof ImageData)this.gpu.device.queue.writeTexture({texture:n.texture},t.data,{bytesPerRow:r*4},[r,i]);else if(t instanceof HTMLCanvasElement){let{width:s,height:a}=t,l=t.getContext("2d").getImageData(0,0,s,a);this.gpu.device.queue.writeTexture({texture:n.texture},l.data,{bytesPerRow:s*4},[s,a])}else if(t instanceof HTMLImageElement){let s=document.createElement("canvas");s.width=t.width,s.height=t.height;let a=s.getContext("2d");a.drawImage(t,0,0,t.width,t.height);let l=a.getImageData(0,0,t.width,t.height);this.gpu.device.queue.writeTexture({texture:n.texture},l.data,{bytesPerRow:r*4},[r,i])}return n}modifyBgColor(t){this.clearCanvasDesc.colorAttachments[0].clearValue={r:t.r,g:t.g,b:t.b,a:t.alpha},this.backgroundColor=t,this.needRender=!0}async initRayTracer(t,e){let r=await Udt.build1(this.gpu,this.currentCamera);await r.buildByKitsune({obj:{mtl:t,obj:e,origin:this.rulerProgram.getOrigin()},pcb:{planeGPU:this.planes,staticPolygonInfoBuilder:this.staticPolygonInfoBuilder}},this.context),FJ.downloadFile("raytracer.zip",await r.getZip()),this.rayTracing=r}setDrawingBgColor(){throw new Error("not support")}getBBox3(){let t=new Xm;return this.planes.forEach(e=>{let r=e.getAllPtBbox();r&&t.ext1(r.minX,r.minY,0,r.maxX,r.maxY,0)}),t.isValid()&&t.build()}setDrcArrowPtStyle(t,e,r,i,n,s,a){super.setDrcArrowPtStyle(t,e,r,i,n,s,a),this.fixedPtData[0]=this.getColorIndex(t)}getFixedPtData(){return this.fixedPtData}getMeasurePtTool(){return this.measurePtTool}renderExternal(t=3,e=null){if(e){this.setRenderMode(t);for(let r of this.cameraSet)this.render(r)}}updatePlaneArrayPart(t){for(let e=0;e<this.planes.length;e++){let r=this.planes[e];r.clearParts();for(let i=0;i<t.length;i++)r.isPanelize()?r.addPart(t[i],r):i==0&&r.addPart(Qe.ORIGIN,r)}}updatePlanePart(t,e){if(t.length){e.clearParts();for(let r=0;r<t.length;r++)e.isPanelize()?e.addPart(t[r],e):r==0&&e.addPart(Qe.ORIGIN,e)}}getMaxWH(){return Math.min(this.gpu.limits.maxTextureDimension2D,Math.floor(Math.sqrt(this.gpu.limits.maxBufferSize/4)/4)*4,4096)}setViewOffset(t,e){this.viewOffset=new S(t,e),this.needRender=!0}getViewOffset(){return this.viewOffset}clearStencilValue(t,e,r){this.commandEncoder.beginRenderPass({colorAttachments:[],depthStencilAttachment:{view:e,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"clear",stencilStoreOp:"store",stencilClearValue:t},label:`clearStencilDesc of ${r}`}).end()}getCaptureToCanvasInfo(t,e,r){let i=t.copy(new ut(-1,1,-1,1)),n=i.adapt(r),s=n[2]/i.getScale(),a=n[3]/i.getScale(),{pxLength:l,fixedWidth:c,fixedHeight:h}=e;if(l)s/=l,a/=l;else if(c)l=s/c,a*=c/s,s=c;else if(h)l=a/h,s*=h/a,a=h;else throw new Error("\u622A\u56FE\u8BBE\u7F6E\u53C2\u6570\u975E\u6CD5\uFF01");(s>Ah||a>Ah)&&(s>a?(l*=s/Ah,a=Ah*a/s,s=Ah):(l*=a/Ah,s=Ah*s/a,a=Ah));let u=this.getMaxWH(),d=Math.ceil(s/u),p=Math.ceil(a/u),m=Math.floor(s/d),g=Math.floor(a/p);return{width:d*m,height:p*g,scale:1/l}}async captureToCanvas(t,e,r,i){let n=Array.from(this.cameraSet);for(let v of n)this.delCamera(v);let s=t.copy(new ut(-1,1,-1,1));this.addCamera0(s);let a=s.adapt(r),l=[a[0]/s.getScale(),a[1]/s.getScale()],c=a[2]/s.getScale(),h=a[3]/s.getScale(),{pxLength:u,fixedWidth:d,fixedHeight:p}=e;if(u)c/=u,h/=u;else if(d)u=c/d,h*=d/c,c=d;else if(p)u=h/p,c*=p/h,h=p;else throw new Error("\u622A\u56FE\u8BBE\u7F6E\u53C2\u6570\u975E\u6CD5\uFF01");(c>Ah||h>Ah)&&(c>h?(u*=c/Ah,h=Ah*h/c,c=Ah):(u*=h/Ah,c=Ah*c/h,h=Ah));let m=i?this.getMaxWH()/8:this.getMaxWH(),g=Math.ceil(c/m),y=Math.ceil(h/m),b=Math.floor(c/g),P=Math.floor(h/y);s.setScale(1/u);let T=document.createElement("canvas");T.width=g*b,T.height=y*P;let I=T.getContext("2d"),C=(g-1)/2,E=(y-1)/2,O=[l[0]/u/b*2,l[1]/u/P*2],_=this.openRuler,R=this.gridProgram.visible;this.openRuler=!1,this.gridProgram.visible=0;for(let v=0;v<g;v++)for(let D=0;D<y;D++){this.setViewOffset((C-v)*2-O[0],(D-E)*2-O[1]);let w=await this.capture(b,P,()=>{},()=>{},!1,2);if(i&&i()||(I.putImageData(w,b*v,P*D),i&&i()))return null}this.setViewOffset(0,0),this.openRuler=_,this.gridProgram.visible=R,this.delCamera(s);for(let v of n)this.addCamera(v);return T}},$dt=class extends out{constructor(o,t,e,r){super(),this.position=o,this.origin=t,this.right=e,this.down=r}_toWGSLStructure(){return{position:this.position,origin:this.origin,right:this.right,down:this.down}}},ZJ=new Mt(-1,1,4).normalize(),IDe=ZJ.cross(new Mt(0,1,0)).cross(ZJ).normalize(),oW=2,CDe=16,xv=class C4e{constructor(t,e=t.width,r=t.height,i,n,s,a,l=.05,c=1e3){this.updateFlag=!0,this.changedFromLastRender=!0,this.isOrth=!1,this.target=Mt.ORIGIN,this.tar2posDir=ZJ,this.up=IDe,this.scale=1,this.center=Mt.ORIGIN,this.radius=1,this.rotatable=!0,this.sampling=1,this.screenPosition=S.ORIGIN,this.cmosSize={width:20,height:20},this.flangeFocalDistance=30,this.changeListeners=[],this.minScale=.05,this.maxScale=1e3,this.needRender=!0,this.axisVisible=!1,n&&(n.maxX!==1||n.minX!==-1||n.maxY!==1||n.minY!==-1)&&console.error("Camera Bbox error"),this.bbox=n,this.messageBus=a,this.updateSize(e,r),this._id=i,this.canvas=t,this.axisGroup=s,this.minScale=l,this.maxScale=c}get id(){return this._id}get tar2pos(){return this.tar2posDir.scale(this.getOriginLength())}getScreenPosition(){return this.screenPosition}getCanvas(){return this.canvas}getSampling(){return this.sampling}getPosition(){return this.target.add(this.tar2pos)}getZ(){return this.target.z+this.tar2pos.z}getOriginLength(){return this.radius*oW}getUp(){return this.up}getRelativePosition(){return new Mt(0,0,this.tar2pos.length())}getTar2Pos(){return this.tar2pos}getTarget(){return this.target}getWidth(){return this.width}getHeight(){return this.height}getPxLength(){return 1/this.scale}getBBox2(){let t=this.getPxLength(),e=this.width/2*t,r=this.height/2*t,{x:i,y:n}=this.target;return new ut(i-e,i+e,n-r,n+r)}getScale(){return this.scale}getBorderZ(t){return this.isOrth?this.scale>t?-1:2:(oW-1)/(oW*(this.scale/t))}getPhotoSize(){let{width:t,height:e}=this;return{width:t,height:e}}getCmosPosition(){return this.getPosition().add(this.tar2pos.normalize().scale(this.getOriginLength()-this.radius))}getFlangeFocalDistance(){return this.flangeFocalDistance}getScreenPointToRay(t,e){t=this.getWidth()-t,e=this.getHeight()-e;let{origin:r,right:i,down:n}=this.getViewport(),s=r.add(i.scale(t)).add(n.scale(e));return this.getPosition().sub(s).normalize()}getSensorDimensions(){let t=this.getPhotoSize().width/this.getPhotoSize().height,e=this.cmosSize.width/this.cmosSize.height;return t>e?{width:this.cmosSize.width,height:this.cmosSize.width/t}:{width:this.cmosSize.height*t,height:this.cmosSize.height}}getApertureSize(){return this.apertureSize}getFocalLength(){return this.focalLength}getConfig(){let{up:t,target:e,tar2posDir:r,apertureSize:i,focalLength:n,flangeFocalDistance:s,cmosSize:a,scale:l}=this;return{up:t,target:e,tar2posDir:r,scale:l,apertureSize:i,focalLength:n,flangeFocalDistance:s,cmosSize:a}}getOrientationFrame(){let t=this.tar2pos.normalize(),e=this.up.cross(t).normalize(),r=t.cross(e).normalize();return{zAxis:t,xAxis:e,yAxis:r}}setCanvas(t){this.canvas=t,this.updateSize(t.width,t.height)}setScreenPosition(t){this.screenPosition=t}setScene(t){this.scene=t}setSampling(t,e=!0){this.sampling=t,this.markChange(e)}setObject(t,e,r=!0){this.center=t,this.radius=e,this.markChange(r)}setObjectByBBox3(t,e=!0){let r=t.center(),i=n()/2;this.setObject(r,i,e);function n(){let s=t.maxX-t.minX,a=t.maxY-t.minY,l=t.maxZ-t.minZ;return Math.sqrt(s*s+a*a+l*l)}}setRotatable(t){this.rotatable=t}setCameraDirect(t,e=!0){this.tar2posDir=new Mt(0,0,t?1:-1),this.up=new Mt(0,1,0),this.scene&&e&&this.scene.setCameraFlip(!t),this.markChange(e)}setCameraType(t,e=!0){this.isOrth=t,this.markChange(e)}setTarget(t,e=!0){this.target=t,this.markChange(e)}setScale(t,e=!0){this.scale=Math.max(t,1e-5),this.markChange(e)}setFlangeFocalDistance(t){this.flangeFocalDistance=t,this.markChange()}setCmosSize(t){this.cmosSize=t,this.markChange()}setApertureSize(t){this.apertureSize=t,this.markChange()}setFocalLength(t){this.focalLength=t,this.markChange()}setConfig(t){let{up:e,target:r,tar2posDir:i,apertureSize:n,focalLength:s,flangeFocalDistance:a,cmosSize:l,scale:c}=t;this.up=e,this.target=r,this.tar2posDir=i.normalize(),this.apertureSize=n,this.focalLength=s,this.flangeFocalDistance=a,this.cmosSize=l,this.scale=c,this.markChange()}isChangedFromLastRender(){return this.changedFromLastRender}isOrthCamera(){return this.isOrth}is2D(){return!this.rotatable&&this.isOrth&&this.tar2pos.x===0&&this.tar2pos.y===0}is3D(){return!this.is2D()}addChangeListener(t){this.changeListeners.push(t),t(this)}copy(t=this.bbox){let e=new C4e(this.canvas,void 0,void 0,void 0,t);return e.axisGroup=this.axisGroup,e.width=this.width,e.height=this.height,e.scene=this.scene,e.isOrth=this.isOrth,e.target=this.target,e.tar2posDir=this.tar2posDir,e.up=this.up,e.scale=this.scale,e.center=this.center,e.radius=this.radius,e.rotatable=this.rotatable,e.updateFlag=this.updateFlag,e.renderMatrix=this.renderMatrix,e.projectMatrix=this.projectMatrix,e.viewMatrix=this.viewMatrix,e.sampling=this.sampling,e.screenPosition=this.screenPosition,e}rendered(){this.changedFromLastRender=!1}reset(){this.rotatable&&(this.tar2posDir=ZJ),this.target=this.center,this.up=IDe,this.scale=1,this.markChange()}updateSize(t,e){this.width=t,this.height=e,this.markChange()}addOffset(t){let{xAxis:e,yAxis:r,zAxis:i}=this.getOrientationFrame();this.target=this.target.add(e.scale(t.x).add(r.scale(t.y)).add(i.scale(t.z))),this.markChange()}addOffset1(t,e){let r=t*-this.getPxLength(),i=e*this.getPxLength();this.addOffset(new Mt(r,i,0))}rotateH(t){if(!this.rotatable)return;let e=this.up.scale(-1);this.tar2posDir=this.tar2pos.rotate(e,t).normalize(),this.markChange()}rotateZ(t,e){this.rotatable&&(this.tar2posDir=this.tar2pos.rotate(Mt.Z_UNIT_VECTOR,t).normalize(),this.up=this.up.rotate(Mt.Z_UNIT_VECTOR,t).normalize(),e&&(this.target=this.target.multiply4(Ae.rotateAxis(Mt.Z_UNIT_VECTOR,t).setOrigin1(e))),this.markChange())}rotateV(t,e){if(!this.rotatable)return;let r=this.tar2pos.cross(this.up);this.up=this.up.rotate(r,t).normalize(),this.tar2posDir=this.tar2pos.rotate(r,t).normalize(),e&&(this.target=this.target.multiply4(Ae.rotateAxis(r,t).setOrigin1(e))),this.markChange()}rotateP(t){this.rotatable&&(this.up=this.up.rotate(this.tar2pos,t).normalize(),this.markChange())}scaleAtPoint(t,e,r){t=this.limitScale(t);let{xAxis:i,yAxis:n}=this.getOrientationFrame(),s=i.scale(e*this.width/2/this.scale).add(n.scale(r*this.height/2/this.scale));this.scale=this.scale*t;let a=i.scale(e*this.width/2/this.scale).add(n.scale(r*this.height/2/this.scale));this.target=this.target.add(s).sub(a),this.markChange()}scaleAtPoint1(t,e,r){let i=e/this.canvas.width*2-1,n=-(r/this.canvas.height*2-1);this.scaleAtPoint(t,i,n)}adapt(t){if(!t)return[0,0,0,0];this.setTarget(t.center());let e=this.getAdaptRenderMatrix(),r=t.getVertexes().map(h=>h.multiply4(e)),i=new _e;for(let h of r)i.ext6(h.x,h.y);let n=i.build1(),s=1/Math.max(-n.minX,n.maxX,-n.minY,n.maxY);this.setScale(this.getScale()*s),n=new ut(n.minX*s,n.maxX*s,n.minY*s,n.maxY*s);let a=this.width,l=this.height,c=n.center();return[c.x*a/2,c.y*l/2,a*n.width()/2,l*n.height()/2]}adapt1(t,e=1){if(!t)return[0,0,0,0];let r=t.width(),i=t.height(),n=this.width/r,s=this.height/i;n<=0&&(n=1),s<=0&&(s=1);let a=Math.min(n,s)*e;this.setTarget(new Mt(t.center().x,t.center().y,0)),this.setScale(a)}autoFcous(t){this.focalLength=t*this.flangeFocalDistance/(t+this.flangeFocalDistance),this.markChange()}getViewMatrix(){return this.update(),this.viewMatrix}getProjectMatrix(){return this.update(),this.projectMatrix}getRenderMatrix(){return this.update(),this.renderMatrix}getAdaptRenderMatrix(){this.updateFlag&&(this.updateViewport(),this.updateViewMatrix());let t=this.updateProjectMatrix(!0);return this.viewMatrix.multiply4(t)}get2dCameraMatrix(){return this.update(),new Ae([this.viewMatrix.data[0],this.viewMatrix.data[1],0,0,this.viewMatrix.data[4],this.viewMatrix.data[5],0,0,0,0,1,0,this.viewMatrix.data[12],this.viewMatrix.data[13],0,1]).scale(this.scale,this.scale,1)}getInverseMatrix(){return this.update(),this.invMatrix}getViewport(){return this.update(),this.viewPort}updateInvMatrix(){let{xAxis:t,yAxis:e,zAxis:r}=this.getOrientationFrame(),i=this.getPosition();this.invMatrix=Ae.translate(-this.width/2,-this.height/2,0).multiply4(Ae.flipX()).scale((this.isOrth?1:(this.getOriginLength()-this.radius)/this.getOriginLength())/this.scale).translate1(0,0,this.isOrth?this.radius:this.radius-this.getOriginLength()).multiply4(new Ae([t.x,t.y,t.z,0,e.x,e.y,e.z,0,r.x,r.y,r.z,0,i.x,i.y,i.z,1]))}updateViewMatrix(){let{xAxis:t,yAxis:e,zAxis:r}=this.getOrientationFrame(),i;if(this.isOrth){let n=this.tar2pos.normalize().scale(this.tar2pos.length()-(this.getOriginLength()-this.radius)-this.radius*CDe*(this.scene instanceof BJ?2:1));i=this.target.add(n)}else i=this.target.add(this.tar2pos);this.viewMatrix=new Ae([t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,-i.dot(t),-i.dot(e),-i.dot(r),1])}updateProjectMatrix(t=!1){let e;if(this.isOrth)this.scene instanceof cW&&!t?e=new Ae([this.scale*this.sampling,0,0,0,0,-this.scale*this.sampling,0,0,0,0,1,0,this.width*this.sampling/2,this.height*this.sampling/2,0,1]):e=new Ae([2/this.width*this.scale,0,0,0,0,2/this.height*this.scale,0,0,0,0,.5/this.radius/CDe,0,0,0,0,1]);else{if(this.scene instanceof cW)throw new Error("not support");e=new Ae([2*this.getOriginLength()*this.scale/this.width,0,0,0,0,2*this.getOriginLength()*this.scale/this.height,0,0,0,0,0,-1,0,0,this.getOriginLength()-this.radius,0])}return e}updateViewport(){let{xAxis:t,yAxis:e}=this.getOrientationFrame(),{width:r,height:i}=this,n=this.scale*(oW/(oW-1));r/=n,i/=n;let s=this.getCmosPosition().sub(t.scale(r/2)).add(e.scale(i/2));this.viewPort=new $dt(this.getPosition(),s,t.scale(r).scale(1/this.getPhotoSize().width),e.scale(-1).scale(i).scale(1/this.getPhotoSize().height))}update(){this.updateFlag&&(this.updateViewport(),this.updateViewMatrix(),this.projectMatrix=this.updateProjectMatrix(),this.renderMatrix=this.viewMatrix.multiply4(this.projectMatrix),this.updateInvMatrix(),this.updateFlag=!1)}markChange(t=!0){this.updateFlag=!0,this.changedFromLastRender=!0,this.scene&&t&&(this.scene.needRender=!0),this.changeListeners.forEach(e=>e(this))}setMaxScale(t){this.maxScale=t}setMinScale(t){this.minScale=t}getMaxScale(){return this.maxScale}getMinScale(){return this.minScale}limitScale(t){let e=this.scale,r=e*t;return r<this.minScale?t=this.minScale/e:r>this.maxScale&&(t=this.maxScale/e),t}setNeedRender(t){this.needRender=t,this.markChange()}getNeedRender(){return this.needRender}setAxisVisible(t){this.axisVisible=t,this.markChange(!0)}adjustAxis(t){var e,r;(e=this.axisGroup)==null||e.setVisible(this.axisVisible),(r=this.axisGroup)==null||r.setAddiMatrix(Ae.translate1(this.target).multiply4(t.getMatrix().getInverseMatrix()))}getOffsetXY(t,e){let r=this.tar2pos,i=this.up.rotate(r,-Math.PI/2).normalize().scale(t);if(i=i.add(this.up.normalize().scale(e)),i.z!==0&&r.z!==0){let n=r.z/i.z;i=i.add(r.scale(-1/n))}return new S(i.x,i.y)}rotateZTo(t){let e=this.rotatable;this.rotatable=!0,this.up=new Mt(0,1,0),this.rotateP(t),this.rotatable=e,this.markChange()}rotateTo(t){let e=this.rotatable;this.rotatable=!0,this.up=new Mt(0,0,1),this.tar2posDir=new Mt(0,-1,0),this.rotateH(t.x),this.rotateV(t.y),this.rotateP(t.z),this.rotatable=e,this.markChange()}setAxisGroup(t){this.axisGroup=t,this.changedFromLastRender=!0}markChange0(){var t;this.updateFlag=!0,this.changedFromLastRender=!0,(t=this.messageBus)==null||t.publish("/engine/camera/update",{id:this.id,scale:this.scale})}getId(){return this.id}isTop(){return this.tar2pos.z>0}};var mQ=class mQ{conversion(t,e,r){if(t===e)return r;if(t[1]==="i"&&e[0]==="m"&&e[1]==="m")return this.mil2mm(r);if(t[0]==="m"&&t[1]==="m"&&e[1]==="i")return this.mm2mil(r);let i=t+2+e;return this[i](r)}conversion1(t,e,r){let i=t+2+e,n=this[i](r);return e=="mil"?Math.round(n*10)/10:Math.round(n*1e3)/1e3}mil2mil(t){return t}mil2mm(t){return t*.0254}mil2cm(t){return t*.00254}mil2inch(t){return t/1e3}mm2mm(t){return t}mm2mil(t){let e=Math.pow(10,5);return Math.round(t*39.37007874015748*e)/e}mm2cm(t){return t/10}mm2inch(t){let e=Math.pow(10,8);return Math.round(t*.03937007874015748*e)/e}cm2mil(t){let e=Math.pow(10,6);return Math.round(t*393.7007874015748*e)/e}cm2mm(t){return t*10}cm2inch(t){let e=Math.pow(10,7);return Math.round(t*.3937007874015748*e)/e}inch2mil(t){return t*1e3}inch2mm(t){return t*25.4}inch2cm(t){return t*2.54}};mQ.ins=new mQ;var ft=mQ;ft.prototype["px(100)2mil"]=o=>o*10;ft.prototype["px(100)2mm"]=o=>o*.254;ft.prototype["mil2px(100)"]=o=>o/10;ft.prototype["mm2px(100)"]=o=>{let t=Math.pow(10,5);return Math.round(o*3.937007874015748*t)/t};function Kdt(o,t,e="px(100)"){return ft.ins.conversion(t,e,o)}function D2(o,t,e=10){return Kdt(o,nye(t),nye(e))}var Zdt=Object.create,f6e=Object.defineProperty,Jdt=Object.getOwnPropertyDescriptor,Qdt=Object.getOwnPropertyNames,ept=Object.getPrototypeOf,tpt=Object.prototype.hasOwnProperty,S4e=(o=>typeof wd<"u"?wd:typeof Proxy<"u"?new Proxy(o,{get:(t,e)=>(typeof wd<"u"?wd:t)[e]}):o)(function(o){if(typeof wd<"u")return wd.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')}),sc=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),rpt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Qdt(t))!tpt.call(o,i)&&i!==e&&f6e(o,i,{get:()=>t[i],enumerable:!(r=Jdt(t,i))||r.enumerable});return o},wk=(o,t,e)=>(e=o!=null?Zdt(ept(o)):{},rpt(t||!o||!o.__esModule?f6e(e,"default",{value:o,enumerable:!0}):e,o)),oz=sc((o,t)=>{"use strict";var e=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,s=(j,J)=>{for(var oe in J)e(j,oe,{get:J[oe],enumerable:!0})},a=(j,J,oe,pe)=>{if(J&&typeof J=="object"||typeof J=="function")for(let ge of i(J))!n.call(j,ge)&&ge!==oe&&e(j,ge,{get:()=>J[ge],enumerable:!(pe=r(J,ge))||pe.enumerable});return j},l=j=>a(e({},"__esModule",{value:!0}),j),c={};s(c,{BroadcastChannelMessageBus:()=>Q,MessageBus:()=>L,MessageBus2:()=>X,MessageBusTask:()=>W,MessageBusTask2:()=>V,WindowMessageBridge:()=>G,WorkerMessageBridge:()=>z,createBroadcastP2PStream:()=>me,createBufferedByteBufferStream:()=>K,createBufferedStream:()=>re,createBufferedStringStream:()=>se,dropP2PStream:()=>Oe,flowRead:()=>Pe,flowWrite:()=>ue}),t.exports=l(c);var h=class{constructor(j=1.5){this.growthFactor=j,this.capacity=10,this.buffer=new Array(this.capacity),this.head=0,this.tail=0,this.count=0}enqueue(j){if(this.count===this.capacity){let J=Math.floor(this.capacity*this.growthFactor);console.log("grow",this.capacity,J);let oe=new Array(J);for(let pe=0;pe<this.count;pe++)oe[pe]=this.buffer[(this.head+pe)%this.capacity];this.buffer=oe,this.head=0,this.tail=this.count,this.capacity=J}this.buffer[this.tail]=j,this.tail=(this.tail+1)%this.capacity,this.count++}dequeue(){if(this.isEmpty())return;let j=this.buffer[this.head];return this.head=(this.head+1)%this.capacity,this.count--,j}peek(){return this.buffer[this.head]}isEmpty(){return this.count===0}clear(){this.buffer.length=0,this.head=0,this.tail=0,this.count=0}},u=new ArrayBuffer(8),d=new Float64Array(u),p=new Uint32Array(u),m=new Uint16Array(u),g=ArrayBuffer;try{g=self.HTMLImageElement||g}catch{}var y=typeof SharedArrayBuffer<"u";function b(j){if(typeof j!="object"||j===null||j instanceof Date||j instanceof ArrayBuffer||y&&j instanceof SharedArrayBuffer||j instanceof Blob||j instanceof FormData||j instanceof Function||j instanceof Uint8ClampedArray||j instanceof g)return j;if(Array.isArray(j))return j.map(b);{let J={};for(let oe in j)Object.hasOwnProperty.call(j,oe)&&(J[oe]=b(j[oe]));return J}}function P(j,J){return T(j,J,()=>[])}function T(j,J,oe){let pe=j[J];return pe!==void 0||(pe=oe(J),j[J]=pe),pe}var I=class{constructor(j){this.maxResources=j,this.idle=new h,this.isClosed=!1,this.resources=j}acquire(j){this.isClosed?Promise.resolve(!1).then(j):this.resources>0?(this.resources--,Promise.resolve(!0).then(j)):this.idle.enqueue(j)}acquireSync(){return new Promise(j=>{this.acquire(j)})}release(){if(!this.isClosed){let j=this.idle.dequeue();j?Promise.resolve(!0).then(j):this.resources++}}close(){if(!this.isClosed)for(this.isClosed=!0;!this.idle.isEmpty();){let j=this.idle.dequeue();Promise.resolve(!1).then(j)}}};function C(){if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis;if(typeof global<"u")return global}function E(j,J){let oe=0,pe=j.length;for(let ge=0;ge<pe;ge++)j[ge]===J&&(j.splice(ge,1),ge--,pe--,oe++);return oe}var O=C(),_=O.WeakRef||(j=>j);function R(j){if(j!=null){if(typeof j=="object")return new _(j);console.error(j,j instanceof Object,typeof j);return}}function v(j){return j==null?void 0:j.deref()}var D="_MSG_BUS_RPC_",w=300*1e3,F=(j=>(j.PUBLISH="publish",j.SUBSCRIBE="subscribe",j.PUSH="push",j.PULL="pull",j))(F||{}),H=class{constructor(j){this.bus=j}processRemoteMessage(j,J){let oe=R(J),pe=j.topic,ge=j.type,Se=j.message;switch(ge){case"pull":this.bus.pull(pe,De=>{this.push(pe,De,v(oe))});break;case"subscribe":this.bus.subscribe(pe,De=>{this.publish(pe,De,v(oe))});break;case"publish":this.bus.publish(pe,Se,this,v(oe));break;case"push":this.bus.push(pe,Se,this,v(oe));break;default:console.debug("unknown message type "+ge)}}rpcCall(j,J,oe,pe=w){let ge=R(oe),Se=new Promise(De=>{let tt=this.bus.uniqueRpcTopic(j);this.publish(j,{message:J,reply:tt},v(ge)),this.bus.pull(tt,(Ze,Wt,Nr)=>{De({message:Ze,bridge:Wt,source:R(Nr)})})});return pe>0?Promise.race([Se,new Promise((De,tt)=>{setTimeout(tt,pe)})]):Se}},z=class extends H{constructor(j,J){super(j),this.worker=J,J.onmessage=oe=>{this.processRemoteMessage(oe.data,void 0)}}publish(j,J){this.postMessage(j,"publish",J)}subscribe(j){this.postMessage(j,"subscribe",null)}push(j,J){this.postMessage(j,"push",J)}pull(j){this.postMessage(j,"pull",null)}rpcCall(j,J,oe=w){return super.rpcCall(j,J,void 0,oe)}postMessage(j,J,oe){let pe={topic:j,type:J,message:oe};this.worker.postMessage(pe)}discard(){this.worker.terminate()}},G=class extends H{constructor(j){super(j),window.addEventListener("message",J=>{this.processRemoteMessage(J.data,J.source)},!1)}publish(j,J,oe){this.postMessage(j,"publish",J,oe)}subscribe(j,J){if(J===window)throw new Error("regist remote subscribe from current window is not permitted");this.postMessage(j,"subscribe",null,J)}push(j,J,oe){this.postMessage(j,"push",J,oe)}pull(j,J){if(J===window)throw new Error("regist remote pull from current window is not permitted");this.postMessage(j,"pull",null,J)}postMessage(j,J,oe,pe){let ge={topic:j,type:J,message:oe};pe&&pe.postMessage(ge,"*")}},W=class{constructor(j){this.isRunning=!0,this.callback=j}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}execute(j,J,oe,pe){try{j=pe?j:b(j),this.callback(j,J,oe)}catch(ge){console.error(ge)}}},L=class{constructor(j=!1){this.subscribed={},this.pulled={},this.pushed={},this.uuid=crypto.randomUUID().replace(/-/g,""),this.rpcTicket=0,this.unsafe=j}uniqueRpcTopic(j){return`${D}-${j}-${this.uuid}-${this.rpcTicket++}`}publish(j,J,oe,pe){let ge=this.subscribed[j];if(ge){let Se;for(let De of ge)De.running()?De.execute(J,oe,pe,this.unsafe):(Se=Se||new Array,Se.push(De));if(Se)for(let De of Se)E(ge,De)}else console.debug("no sub on topic: "+j)}subscribe(j,J){let oe=new W(J);return P(this.subscribed,j).push(oe),oe}push(j,J,oe,pe){let ge=!1,Se=this.pulled[j];if(Se){for(;Se.length>0;){let De=Se.shift();if(De.running()){De.execute(J,oe,pe,this.unsafe),ge=!0;break}}Se.length===0&&delete this.pulled[j]}ge||P(this.pushed,j).push({message:J,bridge:oe,source:R(pe)})}pull(j,J){let oe=new W(J),pe=this.pushed[j];if(pe){let ge=pe.shift();oe.execute(ge.message,ge.bridge,v(ge.source),this.unsafe),pe.length===0&&delete this.pushed[j]}else P(this.pulled,j).push(oe);return oe}pullA(j){return new Promise(J=>{this.pull(j,(oe,pe,ge)=>{J({message:oe,bridge:pe,source:R(ge)})})})}rpcService(j,J){this.subscribe(j,(oe,pe,ge)=>{let{message:Se,reply:De}=oe;try{let tt=J(Se);if(tt instanceof Promise){let Ze=R(ge);tt.then(Wt=>{this.rpcReply(Wt,De,pe,v(Ze))},Wt=>{console.error(Wt),this.rpcReply(void 0,De,pe,v(Ze))})}else this.rpcReply(tt,De,pe,ge)}catch(tt){console.error(tt),this.rpcReply(void 0,De,pe,ge)}})}rpcCall(j,J,oe=w){let pe=new Promise(ge=>{let Se=this.uniqueRpcTopic(j);this.publish(j,{message:J,reply:Se}),this.pull(Se,(De,tt,Ze)=>{ge({message:De,bridge:tt,source:R(Ze)})})});return oe>0?Promise.race([pe,new Promise((ge,Se)=>{setTimeout(Se,oe)})]):pe}rpcReply(j,J,oe,pe){oe?oe.push(J,j,pe):this.push(J,j)}},B="_MSG_BUS_RPC_";function N(j,J){let oe=0,pe=j.length;for(let ge=0;ge<pe;ge++)j[ge]===J&&(j.splice(ge,1),ge--,pe--,oe++);return oe}function U(j,J){return k(j,J,()=>[])}function k(j,J,oe){let pe=j[J];return pe!==void 0||(pe=oe(J),j[J]=pe),pe}var V=class{constructor(j,J){this.callback=j,this.unsafe=J,this.isRunning=!0}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}async execute(j){try{j=this.unsafe?j:b(j),this.callback(j)}catch(J){console.error(J)}}},Y=class{constructor(j=crypto.randomUUID()){this.uuid=j,this.rpcTicket=0}subscribeOnce(j,J){let oe=this.subscribe(j,pe=>{oe.cancel(),J(pe)});return oe}pullA(j){return new Promise(J=>{this.pull(j,J)})}rpcService(j,J){let oe=pe=>{try{let{message:ge,replyTopic:Se}=pe;try{let De=J(ge);De instanceof Promise?De.then(tt=>{this.publish(Se,{success:!0,result:tt})}).catch(tt=>{console.error(tt),this.publish(Se,{success:!1,err:String(tt)})}):this.publish(Se,{success:!0,result:De})}catch(De){this.publish(Se,{success:!1,err:String(De)})}}finally{this.pull(j,oe)}};this.pull(j,oe)}rpcCall(j,J,oe=0){let pe=new Promise((ge,Se)=>{let De=`${B}-${j}-${this.uuid}-${this.rpcTicket++}`;this.subscribeOnce(De,tt=>{tt.success?ge(tt.result):Se(new Error(tt.err))}),this.push(j,{message:J,replyTopic:De})});return oe>0?Promise.race([pe,new Promise((ge,Se)=>{setTimeout(Se,oe)})]):pe}},X=class extends Y{constructor(j=!1){super(),this.unsafe=j,this.subscribed={},this.pulled={},this.pushed={}}publish(j,J){let oe=this.subscribed[j];if(oe){let pe;for(let ge of oe)ge.running()?ge.execute(J):(pe=pe||new Array,pe.push(ge));if(pe)for(let ge of pe)N(oe,ge)}}subscribe(j,J){let oe=new V(J,this.unsafe);return U(this.subscribed,j).push(oe),oe}push(j,J){let oe=!1,pe=this.pulled[j];if(pe){for(;pe.length>0;){let ge=pe.shift();if(ge&&ge.running()){ge.execute(J),oe=!0;break}}pe.length===0&&delete this.pulled[j]}oe||U(this.pushed,j).push(J)}pull(j,J){let oe=new V(J,this.unsafe);return this.repull(j,oe),oe}repull(j,J){let oe=this.pushed[j];if(oe){let pe=oe.shift();pe&&(J.execute(pe),oe.length===0&&delete this.pushed[j])}else U(this.pulled,j).push(J)}},Z=class extends Y{constructor(j=crypto.randomUUID()){super(j),this.subscribed={},this.pushed={},this.pulled={},this.pushCnt=0}publish(j,J){console.debug("BC",this.uuid,"PUBLISH",j,J),this.broadcastPublish(j,J)}subscribe(j,J){console.debug("BC",this.uuid,"SUBSCRIBE",j);let oe=new V(J,!0);return U(this.subscribed,j).push(oe),oe}push(j,J){let oe=this.pushCnt++;console.debug("BC",this.uuid,"PUSH",j,`(${oe})`,J),U(this.pushed,j).push({id:oe,message:J}),this.broadcastPushedHeadMessage(j)}pull(j,J){console.debug("BC",this.uuid,"PULL",j);let oe=new V(J,!0);return U(this.pulled,j).push(oe),this.broadcastWhoHas(j),oe}broadcastPushedHeadMessage(j){let J=this.pushed[j];J&&J[0]&&this.broadcastIHave(j,J[0].id)}onReceivedPublish(j,J,oe){console.debug("BCMSG(",this.uuid,")","from",j,"PUBLISH",J,"message",oe);let pe=this.subscribed[J];if(pe){let ge;for(let Se of pe)Se.running()?Se.execute(oe):(ge=ge||new Array,ge.push(Se));if(ge)for(let Se of ge)N(pe,Se);pe.length===0&&delete this.subscribed[J]}}onReceivedWhoHas(j,J){console.debug("BCMSG(",this.uuid,")","from",j,"WHOHAS",J),this.broadcastPushedHeadMessage(J)}onReceivedIHave(j,J,oe){console.debug("BCMSG(",this.uuid,")","from",j,"IHAVE",J,"id",oe);let pe=this.pulled[J];if(pe){let ge;for(let Se of pe)if(Se.running()){this.broadcastINeed(J,j,oe);break}else ge=ge||new Array,ge.push(Se);if(ge)for(let Se of ge)N(pe,Se);pe.length===0&&delete this.pulled[J]}}onReceivedINeed(j,J,oe,pe){if(console.debug("BCMSG(",this.uuid,")","from",j,"INEED",J,"source",oe,"id",pe),this.uuid===oe){let ge=this.pushed[J];if(ge&&ge[0]&&ge[0].id===pe){let{message:Se}=ge.shift();this.broadcastIGive(J,pe,j,Se),this.broadcastPushedHeadMessage(J),ge.length===0&&delete this.pushed[J]}}}onReceivedIGive(j,J,oe,pe,ge){console.debug("BCMSG(",this.uuid,")","from",j,"IGIVE",J,"id",oe,"target",pe,"message",ge);let Se=this.pulled[J];if(Se&&this.uuid===pe){let De=!1;for(;Se.length>0;){let tt=Se.shift();if(tt.running()){tt.execute(ge),De=!0;break}}De||this.push(J,ge),Se.length===0&&delete this.pulled[J]}}},Q=class extends Z{constructor(j,J=crypto.randomUUID()){super(J),this.bc=new BroadcastChannel(j),this.bc.onmessage=oe=>{this.onMessage(oe.data)}}onMessage(j){let{type:J,uuid:oe,topic:pe}=j;switch(J){case"PUBLISH":{let{message:ge}=j;this.onReceivedPublish(oe,pe,ge);break}case"WHOHAS":{this.onReceivedWhoHas(oe,pe);break}case"IHAVE":{let{id:ge}=j;this.onReceivedIHave(oe,pe,ge);break}case"INEED":{let{source:ge,id:Se}=j;this.onReceivedINeed(oe,pe,ge,Se);break}case"IGIVE":{let{target:ge,id:Se,message:De}=j;this.onReceivedIGive(oe,pe,Se,ge,De);break}default:console.warn("unsupported",j)}}broadcastPublish(j,J){this.post({type:"PUBLISH",uuid:this.uuid,topic:j,message:J})}broadcastWhoHas(j){this.post({type:"WHOHAS",uuid:this.uuid,topic:j})}broadcastIHave(j,J){this.post({type:"IHAVE",uuid:this.uuid,topic:j,id:J})}broadcastINeed(j,J,oe){this.post({type:"INEED",uuid:this.uuid,topic:j,source:J,id:oe})}broadcastIGive(j,J,oe,pe){this.post({type:"IGIVE",uuid:this.uuid,topic:j,id:J,target:oe,message:pe})}post(j){this.bc.postMessage(j),Promise.resolve().then(()=>{this.onMessage(j)})}},ae=Symbol("BLOCKING_QUEUE_RESET"),he=class{constructor(j,J=()=>1){if(this.maxSize=j,this.itemSizeOf=J,this.queue=new h,this.waitingConsumers=new h,this.waitingProducers=new h,this.queueSize=0,this.closePromise=null,this.closeResolve=null,j<=0)throw new Error("Max size must be greater than 0")}enqueue(j){return this.closePromise?!1:this.isFull()?(async()=>{console.debug("queue is full",this.queueSize,this.maxSize);let J=await new Promise(oe=>{this.waitingProducers.enqueue(oe)});return console.debug("queue is not full",this.size(),J),J?(this.innerEnqueue(j),!0):!1})():(this.innerEnqueue(j),!0)}innerEnqueue(j){if(this.waitingConsumers.isEmpty())this.queue.enqueue(j),this.queueSize+=this.itemSizeOf(j),console.debug("queue pushed",j,"size",this.queueSize);else{let J=this.waitingConsumers.dequeue();Promise.resolve(j).then(J),console.debug("queue direct",j,"size",this.queueSize)}}dequeue(){if(this.queue.isEmpty())if(this.closePromise){for(;!this.waitingConsumers.isEmpty();){let j=this.waitingConsumers.dequeue();Promise.resolve(ae).then(j)}return setTimeout(()=>this.closeResolve(),0),ae}else return new Promise(j=>{this.waitingConsumers.enqueue(j)});else{let j=this.queue.dequeue();if(this.queueSize-=this.itemSizeOf(j),!this.waitingProducers.isEmpty()){let J=this.waitingProducers.dequeue();Promise.resolve(!0).then(J)}return j}}size(){return this.queueSize}isEmpty(){return this.queueSize===0}isFull(){return this.queueSize>=this.maxSize}close(){return this.closePromise||(this.closePromise=new Promise(j=>{for(this.closeResolve=j;!this.waitingProducers.isEmpty();){let J=this.waitingProducers.dequeue();Promise.resolve(!1).then(J)}if(this.queueSize===0){for(;!this.waitingConsumers.isEmpty();){let J=this.waitingConsumers.dequeue();Promise.resolve(ae).then(J)}j()}})),this.closePromise}};function re(j,J,oe=Number.MAX_SAFE_INTEGER){let pe=new he(oe,J),ge=new ReadableStream({pull(De){let tt=!0,Ze=(async()=>{let Wt=new Array;do{let Nr=pe.dequeue();if(Nr instanceof Promise){tt=!1;let Lr=await Nr;Lr===ae?De.close():Wt.push(Lr)}else{let Lr=Nr;Lr===ae?De.close():Wt.push(Lr)}}while(pe.size()>0);if(Wt.length>0){let Nr=j(Wt);De.enqueue(Nr)}})();if(!tt)return console.debug("read stream stucked --------------------------------------"),Ze},async cancel(){console.debug("buffered readable cancel"),await pe.close()}}),Se=new WritableStream({write(De,tt){let Ze=!0,Wt=(async()=>{let Nr=pe.enqueue(De);typeof Nr=="boolean"?Nr||tt.error(new Error("Write stream closed")):(Ze=!1,await Nr||tt.error(new Error("Write stream closed")))})();if(!Ze)return console.debug("read stream stucked >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"),Wt},async close(){console.debug("buffered writable closing",pe.size()),await pe.close(),console.debug("buffered writable closed",pe.size())},async abort(){console.debug("buffered writable aborting",pe.size()),await pe.close(),console.debug("buffered writable aborted",pe.size())}});return{readable:ge,writable:Se}}function se(j=Number.MAX_SAFE_INTEGER){return re(J=>J.join(""),J=>J.length,j)}function K(j=Number.MAX_SAFE_INTEGER){return re(J=>{let oe=new Uint8Array(J.reduce((ge,Se)=>ge+Se.byteLength,0)),pe=0;return J.forEach(ge=>{oe.set(ge,pe),pe+=ge.byteLength}),oe},J=>J.byteLength,j)}function me(j){return new Promise((J,oe)=>{let pe=new BroadcastChannel(j),ge=new he(1),Se=new I(1),De=null,tt=!1,Ze=!1,Wt=!1;pe.onmessage=Nr=>{let Lr=Nr.data,{type:Dr}=Lr;if(console.debug("p2p",j,"type",Dr,"data",Dr==="DATA"&&Lr.data),Dr==="DATA")ge.enqueue(Lr.data);else if(Dr==="HI"){if(!De){pe.postMessage({type:"HI"});let Ut=0;De={rs:new ReadableStream({async pull(ar){let Fe=await ge.dequeue();Fe===ae?(await ke(),ar.close()):(ar.enqueue(Fe),pe.postMessage({type:"ACK"}))},cancel(){return ke()}}),ws:new WritableStream({async write(ar,Fe){await Se.acquireSync()?pe.postMessage({type:"DATA",id:Ut++,data:ar}):(Rr(),Fe.error(new Error("Write stream closed")))},close(){Rr()},abort(){Rr()}})},J(De)}}else Dr==="REND"?De?Se.close():Yt("REND1"):Dr==="WEND"?De?ge.close():Yt("WEND1"):Dr==="ACK"&&Se.release();function Rr(){tt||(tt=!0,console.debug(j,"p2p write stream closed"),Se.close(),pe.postMessage({type:"WEND"}),Ze&&(console.debug(j,"p2p channel closed on ws"),pe.close()))}async function ke(){Ze||(Ze=!0,console.debug(j,"p2p read stream closed"),pe.postMessage({type:"REND"}),await ge.close(),tt&&(console.debug(j,"p2p channel closed on rs"),pe.close()))}async function Yt(Ut){Wt||(Wt=!0,console.debug(j,"p2p channel connection released on",Ut),Se.close(),ge.close(),De?(De.rs.locked||(console.debug(j,"p2p unlocked read stream direct cancel"),De.rs.cancel()),De.ws.locked||(console.debug(j,"p2p unlocked write stream direct close"),De.ws.close())):(pe.postMessage({type:"HI"}),pe.close()),oe(new Error("p2p channel connection released")))}},pe.postMessage({type:"HI"})})}function Oe(j){return new Promise(J=>{let oe=new BroadcastChannel(j);oe.onmessage=pe=>{let ge=pe.data,{type:Se}=ge;Se==="HI"&&(oe.postMessage({type:"REND"}),oe.close(),J())},oe.postMessage({type:"REND"})})}async function Ie(j){try{return await me(j)}catch(J){J.message!=="p2p channel connection released"&&console.error(J)}}async function ue(j,J,oe=10*1024*1024,pe=!0){let ge=await Ie(j);if(!ge)return!1;let Se=!1;try{let De,tt=Ze=>{if(!De)if(!pe)De=ge.ws.getWriter();else if(typeof Ze=="string"){let Wt=se(oe);Wt.readable.pipeTo(ge.ws),De=Wt.writable.getWriter()}else{let Wt=K(oe);Wt.readable.pipeTo(ge.ws),De=Wt.writable.getWriter()}return De.write(Ze)};if(Array.isArray(J))for(let Ze of J)await tt(Ze);else await J({write:tt,get desiredSize(){return((De==null?void 0:De.desiredSize)||0)+10}});De&&await De.close(),Se=!0}catch(De){console.error(De)}finally{return ge.rs.cancel(),Se}}async function Pe(j,J){var oe,pe;let ge=await Ie(j);if(ge)try{let Se=ge.rs.getReader();for((oe=J.start)==null?void 0:oe.call(J);;){let{value:De,done:tt}=await Se.read();if(De!==void 0){let Ze;if(J.update instanceof Promise?Ze=await J.update(De):Ze=J.update(De),Ze){await Se.cancel();break}}if(tt){(pe=J.end)==null||pe.call(J);break}}}catch(Se){console.error(Se)}finally{ge.ws.close()}}}),Uc=sc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r():typeof define=="function"&&define.amd?define([],r):e.CryptoJS=r()})(o,function(){var e=e||(function(r,i){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof S4e=="function")try{n=S4e("crypto")}catch{}var s=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||(function(){function T(){}return function(I){var C;return T.prototype=I,C=new T,T.prototype=null,C}})(),l={},c=l.lib={},h=c.Base=(function(){return{extend:function(T){var I=a(this);return T&&I.mixIn(T),(!I.hasOwnProperty("init")||this.init===I.init)&&(I.init=function(){I.$super.init.apply(this,arguments)}),I.init.prototype=I,I.$super=this,I},create:function(){var T=this.extend();return T.init.apply(T,arguments),T},init:function(){},mixIn:function(T){for(var I in T)T.hasOwnProperty(I)&&(this[I]=T[I]);T.hasOwnProperty("toString")&&(this.toString=T.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),u=c.WordArray=h.extend({init:function(T,I){T=this.words=T||[],I!=i?this.sigBytes=I:this.sigBytes=T.length*4},toString:function(T){return(T||p).stringify(this)},concat:function(T){var I=this.words,C=T.words,E=this.sigBytes,O=T.sigBytes;if(this.clamp(),E%4)for(var _=0;_<O;_++){var R=C[_>>>2]>>>24-_%4*8&255;I[E+_>>>2]|=R<<24-(E+_)%4*8}else for(var v=0;v<O;v+=4)I[E+v>>>2]=C[v>>>2];return this.sigBytes+=O,this},clamp:function(){var T=this.words,I=this.sigBytes;T[I>>>2]&=4294967295<<32-I%4*8,T.length=r.ceil(I/4)},clone:function(){var T=h.clone.call(this);return T.words=this.words.slice(0),T},random:function(T){for(var I=[],C=0;C<T;C+=4)I.push(s());return new u.init(I,T)}}),d=l.enc={},p=d.Hex={stringify:function(T){for(var I=T.words,C=T.sigBytes,E=[],O=0;O<C;O++){var _=I[O>>>2]>>>24-O%4*8&255;E.push((_>>>4).toString(16)),E.push((_&15).toString(16))}return E.join("")},parse:function(T){for(var I=T.length,C=[],E=0;E<I;E+=2)C[E>>>3]|=parseInt(T.substr(E,2),16)<<24-E%8*4;return new u.init(C,I/2)}},m=d.Latin1={stringify:function(T){for(var I=T.words,C=T.sigBytes,E=[],O=0;O<C;O++){var _=I[O>>>2]>>>24-O%4*8&255;E.push(String.fromCharCode(_))}return E.join("")},parse:function(T){for(var I=T.length,C=[],E=0;E<I;E++)C[E>>>2]|=(T.charCodeAt(E)&255)<<24-E%4*8;return new u.init(C,I)}},g=d.Utf8={stringify:function(T){try{return decodeURIComponent(escape(m.stringify(T)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(T){return m.parse(unescape(encodeURIComponent(T)))}},y=c.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(T){typeof T=="string"&&(T=g.parse(T)),this._data.concat(T),this._nDataBytes+=T.sigBytes},_process:function(T){var I,C=this._data,E=C.words,O=C.sigBytes,_=this.blockSize,R=_*4,v=O/R;T?v=r.ceil(v):v=r.max((v|0)-this._minBufferSize,0);var D=v*_,w=r.min(D*4,O);if(D){for(var F=0;F<D;F+=_)this._doProcessBlock(E,F);I=E.splice(0,D),C.sigBytes-=w}return new u.init(I,w)},clone:function(){var T=h.clone.call(this);return T._data=this._data.clone(),T},_minBufferSize:0}),b=c.Hasher=y.extend({cfg:h.extend(),init:function(T){this.cfg=this.cfg.extend(T),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(T){return this._append(T),this._process(),this},finalize:function(T){T&&this._append(T);var I=this._doFinalize();return I},blockSize:512/32,_createHelper:function(T){return function(I,C){return new T.init(C).finalize(I)}},_createHmacHelper:function(T){return function(I,C){return new P.HMAC.init(T,C).finalize(I)}}}),P=l.algo={};return l})(Math);return e})}),KQ=sc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Uc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.Base,a=n.WordArray,l=i.x64={},c=l.Word=s.extend({init:function(u,d){this.high=u,this.low=d}}),h=l.WordArray=s.extend({init:function(u,d){u=this.words=u||[],d!=r?this.sigBytes=d:this.sigBytes=u.length*8},toX32:function(){for(var u=this.words,d=u.length,p=[],m=0;m<d;m++){var g=u[m];p.push(g.high),p.push(g.low)}return a.create(p,this.sigBytes)},clone:function(){for(var u=s.clone.call(this),d=u.words=this.words.slice(0),p=d.length,m=0;m<p;m++)d[m]=d[m].clone();return u}})})(),e})}),ipt=sc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Uc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){if(typeof ArrayBuffer=="function"){var r=e,i=r.lib,n=i.WordArray,s=n.init,a=n.init=function(l){if(l instanceof ArrayBuffer&&(l=new Uint8Array(l)),(l instanceof Int8Array||typeof Uint8ClampedArray<"u"&&l instanceof Uint8ClampedArray||l instanceof Int16Array||l instanceof Uint16Array||l instanceof Int32Array||l instanceof Uint32Array||l instanceof Float32Array||l instanceof Float64Array)&&(l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength)),l instanceof Uint8Array){for(var c=l.byteLength,h=[],u=0;u<c;u++)h[u>>>2]|=l[u]<<24-u%4*8;s.call(this,h,c)}else s.apply(this,arguments)};a.prototype=n}})(),e.lib.WordArray})}),npt=sc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Uc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.enc,a=s.Utf16=s.Utf16BE={stringify:function(c){for(var h=c.words,u=c.sigBytes,d=[],p=0;p<u;p+=2){var m=h[p>>>2]>>>16-p%4*8&65535;d.push(String.fromCharCode(m))}return d.join("")},parse:function(c){for(var h=c.length,u=[],d=0;d<h;d++)u[d>>>1]|=c.charCodeAt(d)<<16-d%2*16;return n.create(u,h*2)}};s.Utf16LE={stringify:function(c){for(var h=c.words,u=c.sigBytes,d=[],p=0;p<u;p+=2){var m=l(h[p>>>2]>>>16-p%4*8&65535);d.push(String.fromCharCode(m))}return d.join("")},parse:function(c){for(var h=c.length,u=[],d=0;d<h;d++)u[d>>>1]|=l(c.charCodeAt(d)<<16-d%2*16);return n.create(u,h*2)}};function l(c){return c<<8&4278255360|c>>>8&16711935}})(),e.enc.Utf16})}),qL=sc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Uc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.enc,a=s.Base64={stringify:function(c){var h=c.words,u=c.sigBytes,d=this._map;c.clamp();for(var p=[],m=0;m<u;m+=3)for(var g=h[m>>>2]>>>24-m%4*8&255,y=h[m+1>>>2]>>>24-(m+1)%4*8&255,b=h[m+2>>>2]>>>24-(m+2)%4*8&255,P=g<<16|y<<8|b,T=0;T<4&&m+T*.75<u;T++)p.push(d.charAt(P>>>6*(3-T)&63));var I=d.charAt(64);if(I)for(;p.length%4;)p.push(I);return p.join("")},parse:function(c){var h=c.length,u=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var p=0;p<u.length;p++)d[u.charCodeAt(p)]=p}var m=u.charAt(64);if(m){var g=c.indexOf(m);g!==-1&&(h=g)}return l(c,h,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function l(c,h,u){for(var d=[],p=0,m=0;m<h;m++)if(m%4){var g=u[c.charCodeAt(m-1)]<<m%4*2,y=u[c.charCodeAt(m)]>>>6-m%4*2,b=g|y;d[p>>>2]|=b<<24-p%4*8,p++}return n.create(d,p)}})(),e.enc.Base64})}),opt=sc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Uc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.enc,a=s.Base64url={stringify:function(c,h){h===void 0&&(h=!0);var u=c.words,d=c.sigBytes,p=h?this._safe_map:this._map;c.clamp();for(var m=[],g=0;g<d;g+=3)for(var y=u[g>>>2]>>>24-g%4*8&255,b=u[g+1>>>2]>>>24-(g+1)%4*8&255,P=u[g+2>>>2]>>>24-(g+2)%4*8&255,T=y<<16|b<<8|P,I=0;I<4&&g+I*.75<d;I++)m.push(p.charAt(T>>>6*(3-I)&63));var C=p.charAt(64);if(C)for(;m.length%4;)m.push(C);return m.join("")},parse:function(c,h){h===void 0&&(h=!0);var u=c.length,d=h?this._safe_map:this._map,p=this._reverseMap;if(!p){p=this._reverseMap=[];for(var m=0;m<d.length;m++)p[d.charCodeAt(m)]=m}var g=d.charAt(64);if(g){var y=c.indexOf(g);y!==-1&&(u=y)}return l(c,u,p)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function l(c,h,u){for(var d=[],p=0,m=0;m<h;m++)if(m%4){var g=u[c.charCodeAt(m-1)]<<m%4*2,y=u[c.charCodeAt(m)]>>>6-m%4*2,b=g|y;d[p>>>2]|=b<<24-p%4*8,p++}return n.create(d,p)}})(),e.enc.Base64url})}),$L=sc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Uc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.algo,c=[];(function(){for(var g=0;g<64;g++)c[g]=r.abs(r.sin(g+1))*4294967296|0})();var h=l.MD5=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(g,y){for(var b=0;b<16;b++){var P=y+b,T=g[P];g[P]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}var I=this._hash.words,C=g[y+0],E=g[y+1],O=g[y+2],_=g[y+3],R=g[y+4],v=g[y+5],D=g[y+6],w=g[y+7],F=g[y+8],H=g[y+9],z=g[y+10],G=g[y+11],W=g[y+12],L=g[y+13],B=g[y+14],N=g[y+15],U=I[0],k=I[1],V=I[2],Y=I[3];U=u(U,k,V,Y,C,7,c[0]),Y=u(Y,U,k,V,E,12,c[1]),V=u(V,Y,U,k,O,17,c[2]),k=u(k,V,Y,U,_,22,c[3]),U=u(U,k,V,Y,R,7,c[4]),Y=u(Y,U,k,V,v,12,c[5]),V=u(V,Y,U,k,D,17,c[6]),k=u(k,V,Y,U,w,22,c[7]),U=u(U,k,V,Y,F,7,c[8]),Y=u(Y,U,k,V,H,12,c[9]),V=u(V,Y,U,k,z,17,c[10]),k=u(k,V,Y,U,G,22,c[11]),U=u(U,k,V,Y,W,7,c[12]),Y=u(Y,U,k,V,L,12,c[13]),V=u(V,Y,U,k,B,17,c[14]),k=u(k,V,Y,U,N,22,c[15]),U=d(U,k,V,Y,E,5,c[16]),Y=d(Y,U,k,V,D,9,c[17]),V=d(V,Y,U,k,G,14,c[18]),k=d(k,V,Y,U,C,20,c[19]),U=d(U,k,V,Y,v,5,c[20]),Y=d(Y,U,k,V,z,9,c[21]),V=d(V,Y,U,k,N,14,c[22]),k=d(k,V,Y,U,R,20,c[23]),U=d(U,k,V,Y,H,5,c[24]),Y=d(Y,U,k,V,B,9,c[25]),V=d(V,Y,U,k,_,14,c[26]),k=d(k,V,Y,U,F,20,c[27]),U=d(U,k,V,Y,L,5,c[28]),Y=d(Y,U,k,V,O,9,c[29]),V=d(V,Y,U,k,w,14,c[30]),k=d(k,V,Y,U,W,20,c[31]),U=p(U,k,V,Y,v,4,c[32]),Y=p(Y,U,k,V,F,11,c[33]),V=p(V,Y,U,k,G,16,c[34]),k=p(k,V,Y,U,B,23,c[35]),U=p(U,k,V,Y,E,4,c[36]),Y=p(Y,U,k,V,R,11,c[37]),V=p(V,Y,U,k,w,16,c[38]),k=p(k,V,Y,U,z,23,c[39]),U=p(U,k,V,Y,L,4,c[40]),Y=p(Y,U,k,V,C,11,c[41]),V=p(V,Y,U,k,_,16,c[42]),k=p(k,V,Y,U,D,23,c[43]),U=p(U,k,V,Y,H,4,c[44]),Y=p(Y,U,k,V,W,11,c[45]),V=p(V,Y,U,k,N,16,c[46]),k=p(k,V,Y,U,O,23,c[47]),U=m(U,k,V,Y,C,6,c[48]),Y=m(Y,U,k,V,w,10,c[49]),V=m(V,Y,U,k,B,15,c[50]),k=m(k,V,Y,U,v,21,c[51]),U=m(U,k,V,Y,W,6,c[52]),Y=m(Y,U,k,V,_,10,c[53]),V=m(V,Y,U,k,z,15,c[54]),k=m(k,V,Y,U,E,21,c[55]),U=m(U,k,V,Y,F,6,c[56]),Y=m(Y,U,k,V,N,10,c[57]),V=m(V,Y,U,k,D,15,c[58]),k=m(k,V,Y,U,L,21,c[59]),U=m(U,k,V,Y,R,6,c[60]),Y=m(Y,U,k,V,G,10,c[61]),V=m(V,Y,U,k,O,15,c[62]),k=m(k,V,Y,U,H,21,c[63]),I[0]=I[0]+U|0,I[1]=I[1]+k|0,I[2]=I[2]+V|0,I[3]=I[3]+Y|0},_doFinalize:function(){var g=this._data,y=g.words,b=this._nDataBytes*8,P=g.sigBytes*8;y[P>>>5]|=128<<24-P%32;var T=r.floor(b/4294967296),I=b;y[(P+64>>>9<<4)+15]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,y[(P+64>>>9<<4)+14]=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,g.sigBytes=(y.length+1)*4,this._process();for(var C=this._hash,E=C.words,O=0;O<4;O++){var _=E[O];E[O]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360}return C},clone:function(){var g=a.clone.call(this);return g._hash=this._hash.clone(),g}});function u(g,y,b,P,T,I,C){var E=g+(y&b|~y&P)+T+C;return(E<<I|E>>>32-I)+y}function d(g,y,b,P,T,I,C){var E=g+(y&P|b&~P)+T+C;return(E<<I|E>>>32-I)+y}function p(g,y,b,P,T,I,C){var E=g+(y^b^P)+T+C;return(E<<I|E>>>32-I)+y}function m(g,y,b,P,T,I,C){var E=g+(b^(y|~P))+T+C;return(E<<I|E>>>32-I)+y}i.MD5=a._createHelper(h),i.HmacMD5=a._createHmacHelper(h)})(Math),e.MD5})}),m6e=sc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Uc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.algo,l=[],c=a.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,u){for(var d=this._hash.words,p=d[0],m=d[1],g=d[2],y=d[3],b=d[4],P=0;P<80;P++){if(P<16)l[P]=h[u+P]|0;else{var T=l[P-3]^l[P-8]^l[P-14]^l[P-16];l[P]=T<<1|T>>>31}var I=(p<<5|p>>>27)+b+l[P];P<20?I+=(m&g|~m&y)+1518500249:P<40?I+=(m^g^y)+1859775393:P<60?I+=(m&g|m&y|g&y)-1894007588:I+=(m^g^y)-899497514,b=y,y=g,g=m<<30|m>>>2,m=p,p=I}d[0]=d[0]+p|0,d[1]=d[1]+m|0,d[2]=d[2]+g|0,d[3]=d[3]+y|0,d[4]=d[4]+b|0},_doFinalize:function(){var h=this._data,u=h.words,d=this._nDataBytes*8,p=h.sigBytes*8;return u[p>>>5]|=128<<24-p%32,u[(p+64>>>9<<4)+14]=Math.floor(d/4294967296),u[(p+64>>>9<<4)+15]=d,h.sigBytes=u.length*4,this._process(),this._hash},clone:function(){var h=s.clone.call(this);return h._hash=this._hash.clone(),h}});r.SHA1=s._createHelper(c),r.HmacSHA1=s._createHmacHelper(c)})(),e.SHA1})}),APe=sc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Uc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.algo,c=[],h=[];(function(){function p(b){for(var P=r.sqrt(b),T=2;T<=P;T++)if(!(b%T))return!1;return!0}function m(b){return(b-(b|0))*4294967296|0}for(var g=2,y=0;y<64;)p(g)&&(y<8&&(c[y]=m(r.pow(g,1/2))),h[y]=m(r.pow(g,1/3)),y++),g++})();var u=[],d=l.SHA256=a.extend({_doReset:function(){this._hash=new s.init(c.slice(0))},_doProcessBlock:function(p,m){for(var g=this._hash.words,y=g[0],b=g[1],P=g[2],T=g[3],I=g[4],C=g[5],E=g[6],O=g[7],_=0;_<64;_++){if(_<16)u[_]=p[m+_]|0;else{var R=u[_-15],v=(R<<25|R>>>7)^(R<<14|R>>>18)^R>>>3,D=u[_-2],w=(D<<15|D>>>17)^(D<<13|D>>>19)^D>>>10;u[_]=v+u[_-7]+w+u[_-16]}var F=I&C^~I&E,H=y&b^y&P^b&P,z=(y<<30|y>>>2)^(y<<19|y>>>13)^(y<<10|y>>>22),G=(I<<26|I>>>6)^(I<<21|I>>>11)^(I<<7|I>>>25),W=O+G+F+h[_]+u[_],L=z+H;O=E,E=C,C=I,I=T+W|0,T=P,P=b,b=y,y=W+L|0}g[0]=g[0]+y|0,g[1]=g[1]+b|0,g[2]=g[2]+P|0,g[3]=g[3]+T|0,g[4]=g[4]+I|0,g[5]=g[5]+C|0,g[6]=g[6]+E|0,g[7]=g[7]+O|0},_doFinalize:function(){var p=this._data,m=p.words,g=this._nDataBytes*8,y=p.sigBytes*8;return m[y>>>5]|=128<<24-y%32,m[(y+64>>>9<<4)+14]=r.floor(g/4294967296),m[(y+64>>>9<<4)+15]=g,p.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var p=a.clone.call(this);return p._hash=this._hash.clone(),p}});i.SHA256=a._createHelper(d),i.HmacSHA256=a._createHmacHelper(d)})(Math),e.SHA256})}),spt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),APe()):typeof define=="function"&&define.amd?define(["./core","./sha256"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.algo,a=s.SHA256,l=s.SHA224=a.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=a._doFinalize.call(this);return c.sigBytes-=4,c}});r.SHA224=a._createHelper(l),r.HmacSHA224=a._createHmacHelper(l)})(),e.SHA224})}),g6e=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),KQ()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.Hasher,s=r.x64,a=s.Word,l=s.WordArray,c=r.algo;function h(){return a.create.apply(a,arguments)}var u=[h(1116352408,3609767458),h(1899447441,602891725),h(3049323471,3964484399),h(3921009573,2173295548),h(961987163,4081628472),h(1508970993,3053834265),h(2453635748,2937671579),h(2870763221,3664609560),h(3624381080,2734883394),h(310598401,1164996542),h(607225278,1323610764),h(1426881987,3590304994),h(1925078388,4068182383),h(2162078206,991336113),h(2614888103,633803317),h(3248222580,3479774868),h(3835390401,2666613458),h(4022224774,944711139),h(264347078,2341262773),h(604807628,2007800933),h(770255983,1495990901),h(1249150122,1856431235),h(1555081692,3175218132),h(1996064986,2198950837),h(2554220882,3999719339),h(2821834349,766784016),h(2952996808,2566594879),h(3210313671,3203337956),h(3336571891,1034457026),h(3584528711,2466948901),h(113926993,3758326383),h(338241895,168717936),h(666307205,1188179964),h(773529912,1546045734),h(1294757372,1522805485),h(1396182291,2643833823),h(1695183700,2343527390),h(1986661051,1014477480),h(2177026350,1206759142),h(2456956037,344077627),h(2730485921,1290863460),h(2820302411,3158454273),h(3259730800,3505952657),h(3345764771,106217008),h(3516065817,3606008344),h(3600352804,1432725776),h(4094571909,1467031594),h(275423344,851169720),h(430227734,3100823752),h(506948616,1363258195),h(659060556,3750685593),h(883997877,3785050280),h(958139571,3318307427),h(1322822218,3812723403),h(1537002063,2003034995),h(1747873779,3602036899),h(1955562222,1575990012),h(2024104815,1125592928),h(2227730452,2716904306),h(2361852424,442776044),h(2428436474,593698344),h(2756734187,3733110249),h(3204031479,2999351573),h(3329325298,3815920427),h(3391569614,3928383900),h(3515267271,566280711),h(3940187606,3454069534),h(4118630271,4000239992),h(116418474,1914138554),h(174292421,2731055270),h(289380356,3203993006),h(460393269,320620315),h(685471733,587496836),h(852142971,1086792851),h(1017036298,365543100),h(1126000580,2618297676),h(1288033470,3409855158),h(1501505948,4234509866),h(1607167915,987167468),h(1816402316,1246189591)],d=[];(function(){for(var m=0;m<80;m++)d[m]=h()})();var p=c.SHA512=n.extend({_doReset:function(){this._hash=new l.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(m,g){for(var y=this._hash.words,b=y[0],P=y[1],T=y[2],I=y[3],C=y[4],E=y[5],O=y[6],_=y[7],R=b.high,v=b.low,D=P.high,w=P.low,F=T.high,H=T.low,z=I.high,G=I.low,W=C.high,L=C.low,B=E.high,N=E.low,U=O.high,k=O.low,V=_.high,Y=_.low,X=R,Z=v,Q=D,ae=w,he=F,re=H,se=z,K=G,me=W,Oe=L,Ie=B,ue=N,Pe=U,j=k,J=V,oe=Y,pe=0;pe<80;pe++){var ge,Se,De=d[pe];if(pe<16)Se=De.high=m[g+pe*2]|0,ge=De.low=m[g+pe*2+1]|0;else{var tt=d[pe-15],Ze=tt.high,Wt=tt.low,Nr=(Ze>>>1|Wt<<31)^(Ze>>>8|Wt<<24)^Ze>>>7,Lr=(Wt>>>1|Ze<<31)^(Wt>>>8|Ze<<24)^(Wt>>>7|Ze<<25),Dr=d[pe-2],Rr=Dr.high,ke=Dr.low,Yt=(Rr>>>19|ke<<13)^(Rr<<3|ke>>>29)^Rr>>>6,Ut=(ke>>>19|Rr<<13)^(ke<<3|Rr>>>29)^(ke>>>6|Rr<<26),ar=d[pe-7],Fe=ar.high,it=ar.low,ye=d[pe-16],bt=ye.high,zt=ye.low;ge=Lr+it,Se=Nr+Fe+(ge>>>0<Lr>>>0?1:0),ge=ge+Ut,Se=Se+Yt+(ge>>>0<Ut>>>0?1:0),ge=ge+zt,Se=Se+bt+(ge>>>0<zt>>>0?1:0),De.high=Se,De.low=ge}var de=me&Ie^~me&Pe,qe=Oe&ue^~Oe&j,lt=X&Q^X&he^Q&he,Ne=Z&ae^Z&re^ae&re,et=(X>>>28|Z<<4)^(X<<30|Z>>>2)^(X<<25|Z>>>7),At=(Z>>>28|X<<4)^(Z<<30|X>>>2)^(Z<<25|X>>>7),dr=(me>>>14|Oe<<18)^(me>>>18|Oe<<14)^(me<<23|Oe>>>9),vr=(Oe>>>14|me<<18)^(Oe>>>18|me<<14)^(Oe<<23|me>>>9),Zr=u[pe],xi=Zr.high,Zi=Zr.low,Fi=oe+vr,$i=J+dr+(Fi>>>0<oe>>>0?1:0),Fi=Fi+qe,$i=$i+de+(Fi>>>0<qe>>>0?1:0),Fi=Fi+Zi,$i=$i+xi+(Fi>>>0<Zi>>>0?1:0),Fi=Fi+ge,$i=$i+Se+(Fi>>>0<ge>>>0?1:0),yo=At+Ne,Ha=et+lt+(yo>>>0<At>>>0?1:0);J=Pe,oe=j,Pe=Ie,j=ue,Ie=me,ue=Oe,Oe=K+Fi|0,me=se+$i+(Oe>>>0<K>>>0?1:0)|0,se=he,K=re,he=Q,re=ae,Q=X,ae=Z,Z=Fi+yo|0,X=$i+Ha+(Z>>>0<Fi>>>0?1:0)|0}v=b.low=v+Z,b.high=R+X+(v>>>0<Z>>>0?1:0),w=P.low=w+ae,P.high=D+Q+(w>>>0<ae>>>0?1:0),H=T.low=H+re,T.high=F+he+(H>>>0<re>>>0?1:0),G=I.low=G+K,I.high=z+se+(G>>>0<K>>>0?1:0),L=C.low=L+Oe,C.high=W+me+(L>>>0<Oe>>>0?1:0),N=E.low=N+ue,E.high=B+Ie+(N>>>0<ue>>>0?1:0),k=O.low=k+j,O.high=U+Pe+(k>>>0<j>>>0?1:0),Y=_.low=Y+oe,_.high=V+J+(Y>>>0<oe>>>0?1:0)},_doFinalize:function(){var m=this._data,g=m.words,y=this._nDataBytes*8,b=m.sigBytes*8;g[b>>>5]|=128<<24-b%32,g[(b+128>>>10<<5)+30]=Math.floor(y/4294967296),g[(b+128>>>10<<5)+31]=y,m.sigBytes=g.length*4,this._process();var P=this._hash.toX32();return P},clone:function(){var m=n.clone.call(this);return m._hash=this._hash.clone(),m},blockSize:1024/32});r.SHA512=n._createHelper(p),r.HmacSHA512=n._createHmacHelper(p)})(),e.SHA512})}),apt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),KQ(),g6e()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.x64,n=i.Word,s=i.WordArray,a=r.algo,l=a.SHA512,c=a.SHA384=l.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var h=l._doFinalize.call(this);return h.sigBytes-=16,h}});r.SHA384=l._createHelper(c),r.HmacSHA384=l._createHmacHelper(c)})(),e.SHA384})}),lpt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),KQ()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.x64,c=l.Word,h=i.algo,u=[],d=[],p=[];(function(){for(var y=1,b=0,P=0;P<24;P++){u[y+5*b]=(P+1)*(P+2)/2%64;var T=b%5,I=(2*y+3*b)%5;y=T,b=I}for(var y=0;y<5;y++)for(var b=0;b<5;b++)d[y+5*b]=b+(2*y+3*b)%5*5;for(var C=1,E=0;E<24;E++){for(var O=0,_=0,R=0;R<7;R++){if(C&1){var v=(1<<R)-1;v<32?_^=1<<v:O^=1<<v-32}C&128?C=C<<1^113:C<<=1}p[E]=c.create(O,_)}})();var m=[];(function(){for(var y=0;y<25;y++)m[y]=c.create()})();var g=h.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var y=this._state=[],b=0;b<25;b++)y[b]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(y,b){for(var P=this._state,T=this.blockSize/2,I=0;I<T;I++){var C=y[b+2*I],E=y[b+2*I+1];C=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360,E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360;var O=P[I];O.high^=E,O.low^=C}for(var _=0;_<24;_++){for(var R=0;R<5;R++){for(var v=0,D=0,w=0;w<5;w++){var O=P[R+5*w];v^=O.high,D^=O.low}var F=m[R];F.high=v,F.low=D}for(var R=0;R<5;R++)for(var H=m[(R+4)%5],z=m[(R+1)%5],G=z.high,W=z.low,v=H.high^(G<<1|W>>>31),D=H.low^(W<<1|G>>>31),w=0;w<5;w++){var O=P[R+5*w];O.high^=v,O.low^=D}for(var L=1;L<25;L++){var v,D,O=P[L],B=O.high,N=O.low,U=u[L];U<32?(v=B<<U|N>>>32-U,D=N<<U|B>>>32-U):(v=N<<U-32|B>>>64-U,D=B<<U-32|N>>>64-U);var k=m[d[L]];k.high=v,k.low=D}var V=m[0],Y=P[0];V.high=Y.high,V.low=Y.low;for(var R=0;R<5;R++)for(var w=0;w<5;w++){var L=R+5*w,O=P[L],X=m[L],Z=m[(R+1)%5+5*w],Q=m[(R+2)%5+5*w];O.high=X.high^~Z.high&Q.high,O.low=X.low^~Z.low&Q.low}var O=P[0],ae=p[_];O.high^=ae.high,O.low^=ae.low}},_doFinalize:function(){var y=this._data,b=y.words,P=this._nDataBytes*8,T=y.sigBytes*8,I=this.blockSize*32;b[T>>>5]|=1<<24-T%32,b[(r.ceil((T+1)/I)*I>>>5)-1]|=128,y.sigBytes=b.length*4,this._process();for(var C=this._state,E=this.cfg.outputLength/8,O=E/8,_=[],R=0;R<O;R++){var v=C[R],D=v.high,w=v.low;D=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,w=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,_.push(w),_.push(D)}return new s.init(_,E)},clone:function(){for(var y=a.clone.call(this),b=y._state=this._state.slice(0),P=0;P<25;P++)b[P]=b[P].clone();return y}});i.SHA3=a._createHelper(g),i.HmacSHA3=a._createHmacHelper(g)})(Math),e.SHA3})}),cpt=sc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Uc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.algo,c=s.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),h=s.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),u=s.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),d=s.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),p=s.create([0,1518500249,1859775393,2400959708,2840853838]),m=s.create([1352829926,1548603684,1836072691,2053994217,0]),g=l.RIPEMD160=a.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(E,O){for(var _=0;_<16;_++){var R=O+_,v=E[R];E[R]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360}var D=this._hash.words,w=p.words,F=m.words,H=c.words,z=h.words,G=u.words,W=d.words,L,B,N,U,k,V,Y,X,Z,Q;V=L=D[0],Y=B=D[1],X=N=D[2],Z=U=D[3],Q=k=D[4];for(var ae,_=0;_<80;_+=1)ae=L+E[O+H[_]]|0,_<16?ae+=y(B,N,U)+w[0]:_<32?ae+=b(B,N,U)+w[1]:_<48?ae+=P(B,N,U)+w[2]:_<64?ae+=T(B,N,U)+w[3]:ae+=I(B,N,U)+w[4],ae=ae|0,ae=C(ae,G[_]),ae=ae+k|0,L=k,k=U,U=C(N,10),N=B,B=ae,ae=V+E[O+z[_]]|0,_<16?ae+=I(Y,X,Z)+F[0]:_<32?ae+=T(Y,X,Z)+F[1]:_<48?ae+=P(Y,X,Z)+F[2]:_<64?ae+=b(Y,X,Z)+F[3]:ae+=y(Y,X,Z)+F[4],ae=ae|0,ae=C(ae,W[_]),ae=ae+Q|0,V=Q,Q=Z,Z=C(X,10),X=Y,Y=ae;ae=D[1]+N+Z|0,D[1]=D[2]+U+Q|0,D[2]=D[3]+k+V|0,D[3]=D[4]+L+Y|0,D[4]=D[0]+B+X|0,D[0]=ae},_doFinalize:function(){var E=this._data,O=E.words,_=this._nDataBytes*8,R=E.sigBytes*8;O[R>>>5]|=128<<24-R%32,O[(R+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,E.sigBytes=(O.length+1)*4,this._process();for(var v=this._hash,D=v.words,w=0;w<5;w++){var F=D[w];D[w]=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360}return v},clone:function(){var E=a.clone.call(this);return E._hash=this._hash.clone(),E}});function y(E,O,_){return E^O^_}function b(E,O,_){return E&O|~E&_}function P(E,O,_){return(E|~O)^_}function T(E,O,_){return E&_|O&~_}function I(E,O,_){return E^(O|~_)}function C(E,O){return E<<O|E>>>32-O}i.RIPEMD160=a._createHelper(g),i.HmacRIPEMD160=a._createHmacHelper(g)})(Math),e.RIPEMD160})}),_Pe=sc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Uc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){(function(){var r=e,i=r.lib,n=i.Base,s=r.enc,a=s.Utf8,l=r.algo,c=l.HMAC=n.extend({init:function(h,u){h=this._hasher=new h.init,typeof u=="string"&&(u=a.parse(u));var d=h.blockSize,p=d*4;u.sigBytes>p&&(u=h.finalize(u)),u.clamp();for(var m=this._oKey=u.clone(),g=this._iKey=u.clone(),y=m.words,b=g.words,P=0;P<d;P++)y[P]^=1549556828,b[P]^=909522486;m.sigBytes=g.sigBytes=p,this.reset()},reset:function(){var h=this._hasher;h.reset(),h.update(this._iKey)},update:function(h){return this._hasher.update(h),this},finalize:function(h){var u=this._hasher,d=u.finalize(h);u.reset();var p=u.finalize(this._oKey.clone().concat(d));return p}})})()})}),hpt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),APe(),_Pe()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.Base,s=i.WordArray,a=r.algo,l=a.SHA256,c=a.HMAC,h=a.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:l,iterations:25e4}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,d){for(var p=this.cfg,m=c.create(p.hasher,u),g=s.create(),y=s.create([1]),b=g.words,P=y.words,T=p.keySize,I=p.iterations;b.length<T;){var C=m.update(d).finalize(y);m.reset();for(var E=C.words,O=E.length,_=C,R=1;R<I;R++){_=m.finalize(_),m.reset();for(var v=_.words,D=0;D<O;D++)E[D]^=v[D]}g.concat(C),P[0]++}return g.sigBytes=T*4,g}});r.PBKDF2=function(u,d,p){return h.create(p).compute(u,d)}})(),e.PBKDF2})}),Xv=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),m6e(),_Pe()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.Base,s=i.WordArray,a=r.algo,l=a.MD5,c=a.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:l,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,u){for(var d,p=this.cfg,m=p.hasher.create(),g=s.create(),y=g.words,b=p.keySize,P=p.iterations;y.length<b;){d&&m.update(d),d=m.update(h).finalize(u),m.reset();for(var T=1;T<P;T++)d=m.finalize(d),m.reset();g.concat(d)}return g.sigBytes=b*4,g}});r.EvpKDF=function(h,u,d){return c.create(d).compute(h,u)}})(),e.EvpKDF})}),Ag=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),Xv()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],r):r(e.CryptoJS)})(o,function(e){e.lib.Cipher||(function(r){var i=e,n=i.lib,s=n.Base,a=n.WordArray,l=n.BufferedBlockAlgorithm,c=i.enc,h=c.Utf8,u=c.Base64,d=i.algo,p=d.EvpKDF,m=n.Cipher=l.extend({cfg:s.extend(),createEncryptor:function(F,H){return this.create(this._ENC_XFORM_MODE,F,H)},createDecryptor:function(F,H){return this.create(this._DEC_XFORM_MODE,F,H)},init:function(F,H,z){this.cfg=this.cfg.extend(z),this._xformMode=F,this._key=H,this.reset()},reset:function(){l.reset.call(this),this._doReset()},process:function(F){return this._append(F),this._process()},finalize:function(F){F&&this._append(F);var H=this._doFinalize();return H},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:(function(){function F(H){return typeof H=="string"?w:R}return function(H){return{encrypt:function(z,G,W){return F(G).encrypt(H,z,G,W)},decrypt:function(z,G,W){return F(G).decrypt(H,z,G,W)}}}})()}),g=n.StreamCipher=m.extend({_doFinalize:function(){var F=this._process(!0);return F},blockSize:1}),y=i.mode={},b=n.BlockCipherMode=s.extend({createEncryptor:function(F,H){return this.Encryptor.create(F,H)},createDecryptor:function(F,H){return this.Decryptor.create(F,H)},init:function(F,H){this._cipher=F,this._iv=H}}),P=y.CBC=(function(){var F=b.extend();F.Encryptor=F.extend({processBlock:function(z,G){var W=this._cipher,L=W.blockSize;H.call(this,z,G,L),W.encryptBlock(z,G),this._prevBlock=z.slice(G,G+L)}}),F.Decryptor=F.extend({processBlock:function(z,G){var W=this._cipher,L=W.blockSize,B=z.slice(G,G+L);W.decryptBlock(z,G),H.call(this,z,G,L),this._prevBlock=B}});function H(z,G,W){var L,B=this._iv;B?(L=B,this._iv=r):L=this._prevBlock;for(var N=0;N<W;N++)z[G+N]^=L[N]}return F})(),T=i.pad={},I=T.Pkcs7={pad:function(F,H){for(var z=H*4,G=z-F.sigBytes%z,W=G<<24|G<<16|G<<8|G,L=[],B=0;B<G;B+=4)L.push(W);var N=a.create(L,G);F.concat(N)},unpad:function(F){var H=F.words[F.sigBytes-1>>>2]&255;F.sigBytes-=H}},C=n.BlockCipher=m.extend({cfg:m.cfg.extend({mode:P,padding:I}),reset:function(){var F;m.reset.call(this);var H=this.cfg,z=H.iv,G=H.mode;this._xformMode==this._ENC_XFORM_MODE?F=G.createEncryptor:(F=G.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==F?this._mode.init(this,z&&z.words):(this._mode=F.call(G,this,z&&z.words),this._mode.__creator=F)},_doProcessBlock:function(F,H){this._mode.processBlock(F,H)},_doFinalize:function(){var F,H=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(H.pad(this._data,this.blockSize),F=this._process(!0)):(F=this._process(!0),H.unpad(F)),F},blockSize:128/32}),E=n.CipherParams=s.extend({init:function(F){this.mixIn(F)},toString:function(F){return(F||this.formatter).stringify(this)}}),O=i.format={},_=O.OpenSSL={stringify:function(F){var H,z=F.ciphertext,G=F.salt;return G?H=a.create([1398893684,1701076831]).concat(G).concat(z):H=z,H.toString(u)},parse:function(F){var H,z=u.parse(F),G=z.words;return G[0]==1398893684&&G[1]==1701076831&&(H=a.create(G.slice(2,4)),G.splice(0,4),z.sigBytes-=16),E.create({ciphertext:z,salt:H})}},R=n.SerializableCipher=s.extend({cfg:s.extend({format:_}),encrypt:function(F,H,z,G){G=this.cfg.extend(G);var W=F.createEncryptor(z,G),L=W.finalize(H),B=W.cfg;return E.create({ciphertext:L,key:z,iv:B.iv,algorithm:F,mode:B.mode,padding:B.padding,blockSize:F.blockSize,formatter:G.format})},decrypt:function(F,H,z,G){G=this.cfg.extend(G),H=this._parse(H,G.format);var W=F.createDecryptor(z,G).finalize(H.ciphertext);return W},_parse:function(F,H){return typeof F=="string"?H.parse(F,this):F}}),v=i.kdf={},D=v.OpenSSL={execute:function(F,H,z,G,W){if(G||(G=a.random(64/8)),W)var L=p.create({keySize:H+z,hasher:W}).compute(F,G);else var L=p.create({keySize:H+z}).compute(F,G);var B=a.create(L.words.slice(H),z*4);return L.sigBytes=H*4,E.create({key:L,iv:B,salt:G})}},w=n.PasswordBasedCipher=R.extend({cfg:R.cfg.extend({kdf:D}),encrypt:function(F,H,z,G){G=this.cfg.extend(G);var W=G.kdf.execute(z,F.keySize,F.ivSize,G.salt,G.hasher);G.iv=W.iv;var L=R.encrypt.call(this,F,H,W.key,G);return L.mixIn(W),L},decrypt:function(F,H,z,G){G=this.cfg.extend(G),H=this._parse(H,G.format);var W=G.kdf.execute(z,F.keySize,F.ivSize,H.salt,G.hasher);G.iv=W.iv;var L=R.decrypt.call(this,F,H,W.key,G);return L}})})()})}),upt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),Ag()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.CFB=(function(){var r=e.lib.BlockCipherMode.extend();r.Encryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize;i.call(this,n,s,l,a),this._prevBlock=n.slice(s,s+l)}}),r.Decryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize,c=n.slice(s,s+l);i.call(this,n,s,l,a),this._prevBlock=c}});function i(n,s,a,l){var c,h=this._iv;h?(c=h.slice(0),this._iv=void 0):c=this._prevBlock,l.encryptBlock(c,0);for(var u=0;u<a;u++)n[s+u]^=c[u]}return r})(),e.mode.CFB})}),dpt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),Ag()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.CTR=(function(){var r=e.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize,c=this._iv,h=this._counter;c&&(h=this._counter=c.slice(0),this._iv=void 0);var u=h.slice(0);a.encryptBlock(u,0),h[l-1]=h[l-1]+1|0;for(var d=0;d<l;d++)n[s+d]^=u[d]}});return r.Decryptor=i,r})(),e.mode.CTR})}),ppt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),Ag()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.CTRGladman=(function(){var r=e.lib.BlockCipherMode.extend();function i(a){if((a>>24&255)===255){var l=a>>16&255,c=a>>8&255,h=a&255;l===255?(l=0,c===255?(c=0,h===255?h=0:++h):++c):++l,a=0,a+=l<<16,a+=c<<8,a+=h}else a+=1<<24;return a}function n(a){return(a[0]=i(a[0]))===0&&(a[1]=i(a[1])),a}var s=r.Encryptor=r.extend({processBlock:function(a,l){var c=this._cipher,h=c.blockSize,u=this._iv,d=this._counter;u&&(d=this._counter=u.slice(0),this._iv=void 0),n(d);var p=d.slice(0);c.encryptBlock(p,0);for(var m=0;m<h;m++)a[l+m]^=p[m]}});return r.Decryptor=s,r})(),e.mode.CTRGladman})}),fpt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),Ag()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.OFB=(function(){var r=e.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize,c=this._iv,h=this._keystream;c&&(h=this._keystream=c.slice(0),this._iv=void 0),a.encryptBlock(h,0);for(var u=0;u<l;u++)n[s+u]^=h[u]}});return r.Decryptor=i,r})(),e.mode.OFB})}),mpt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),Ag()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.ECB=(function(){var r=e.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(i,n){this._cipher.encryptBlock(i,n)}}),r.Decryptor=r.extend({processBlock:function(i,n){this._cipher.decryptBlock(i,n)}}),r})(),e.mode.ECB})}),gpt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),Ag()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.AnsiX923={pad:function(r,i){var n=r.sigBytes,s=i*4,a=s-n%s,l=n+a-1;r.clamp(),r.words[l>>>2]|=a<<24-l%4*8,r.sigBytes+=a},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},e.pad.Ansix923})}),ypt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),Ag()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.Iso10126={pad:function(r,i){var n=i*4,s=n-r.sigBytes%n;r.concat(e.lib.WordArray.random(s-1)).concat(e.lib.WordArray.create([s<<24],1))},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},e.pad.Iso10126})}),bpt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),Ag()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.Iso97971={pad:function(r,i){r.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(r,i)},unpad:function(r){e.pad.ZeroPadding.unpad(r),r.sigBytes--}},e.pad.Iso97971})}),Ppt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),Ag()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.ZeroPadding={pad:function(r,i){var n=i*4;r.clamp(),r.sigBytes+=n-(r.sigBytes%n||n)},unpad:function(r){for(var i=r.words,n=r.sigBytes-1,n=r.sigBytes-1;n>=0;n--)if(i[n>>>2]>>>24-n%4*8&255){r.sigBytes=n+1;break}}},e.pad.ZeroPadding})}),Tpt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),Ag()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding})}),Ipt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),Ag()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.CipherParams,a=i.enc,l=a.Hex,c=i.format,h=c.Hex={stringify:function(u){return u.ciphertext.toString(l)},parse:function(u){var d=l.parse(u);return s.create({ciphertext:d})}}})(),e.format.Hex})}),Cpt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),qL(),$L(),Xv(),Ag()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.BlockCipher,s=r.algo,a=[],l=[],c=[],h=[],u=[],d=[],p=[],m=[],g=[],y=[];(function(){for(var T=[],I=0;I<256;I++)I<128?T[I]=I<<1:T[I]=I<<1^283;for(var C=0,E=0,I=0;I<256;I++){var O=E^E<<1^E<<2^E<<3^E<<4;O=O>>>8^O&255^99,a[C]=O,l[O]=C;var _=T[C],R=T[_],v=T[R],D=T[O]*257^O*16843008;c[C]=D<<24|D>>>8,h[C]=D<<16|D>>>16,u[C]=D<<8|D>>>24,d[C]=D;var D=v*16843009^R*65537^_*257^C*16843008;p[O]=D<<24|D>>>8,m[O]=D<<16|D>>>16,g[O]=D<<8|D>>>24,y[O]=D,C?(C=_^T[T[T[v^_]]],E^=T[T[E]]):C=E=1}})();var b=[0,1,2,4,8,16,32,64,128,27,54],P=s.AES=n.extend({_doReset:function(){var T;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var I=this._keyPriorReset=this._key,C=I.words,E=I.sigBytes/4,O=this._nRounds=E+6,_=(O+1)*4,R=this._keySchedule=[],v=0;v<_;v++)v<E?R[v]=C[v]:(T=R[v-1],v%E?E>6&&v%E==4&&(T=a[T>>>24]<<24|a[T>>>16&255]<<16|a[T>>>8&255]<<8|a[T&255]):(T=T<<8|T>>>24,T=a[T>>>24]<<24|a[T>>>16&255]<<16|a[T>>>8&255]<<8|a[T&255],T^=b[v/E|0]<<24),R[v]=R[v-E]^T);for(var D=this._invKeySchedule=[],w=0;w<_;w++){var v=_-w;if(w%4)var T=R[v];else var T=R[v-4];w<4||v<=4?D[w]=T:D[w]=p[a[T>>>24]]^m[a[T>>>16&255]]^g[a[T>>>8&255]]^y[a[T&255]]}}},encryptBlock:function(T,I){this._doCryptBlock(T,I,this._keySchedule,c,h,u,d,a)},decryptBlock:function(T,I){var C=T[I+1];T[I+1]=T[I+3],T[I+3]=C,this._doCryptBlock(T,I,this._invKeySchedule,p,m,g,y,l);var C=T[I+1];T[I+1]=T[I+3],T[I+3]=C},_doCryptBlock:function(T,I,C,E,O,_,R,v){for(var D=this._nRounds,w=T[I]^C[0],F=T[I+1]^C[1],H=T[I+2]^C[2],z=T[I+3]^C[3],G=4,W=1;W<D;W++){var L=E[w>>>24]^O[F>>>16&255]^_[H>>>8&255]^R[z&255]^C[G++],B=E[F>>>24]^O[H>>>16&255]^_[z>>>8&255]^R[w&255]^C[G++],N=E[H>>>24]^O[z>>>16&255]^_[w>>>8&255]^R[F&255]^C[G++],U=E[z>>>24]^O[w>>>16&255]^_[F>>>8&255]^R[H&255]^C[G++];w=L,F=B,H=N,z=U}var L=(v[w>>>24]<<24|v[F>>>16&255]<<16|v[H>>>8&255]<<8|v[z&255])^C[G++],B=(v[F>>>24]<<24|v[H>>>16&255]<<16|v[z>>>8&255]<<8|v[w&255])^C[G++],N=(v[H>>>24]<<24|v[z>>>16&255]<<16|v[w>>>8&255]<<8|v[F&255])^C[G++],U=(v[z>>>24]<<24|v[w>>>16&255]<<16|v[F>>>8&255]<<8|v[H&255])^C[G++];T[I]=L,T[I+1]=B,T[I+2]=N,T[I+3]=U},keySize:256/32});r.AES=n._createHelper(P)})(),e.AES})}),Spt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),qL(),$L(),Xv(),Ag()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=i.BlockCipher,a=r.algo,l=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],d=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],p=a.DES=s.extend({_doReset:function(){for(var b=this._key,P=b.words,T=[],I=0;I<56;I++){var C=l[I]-1;T[I]=P[C>>>5]>>>31-C%32&1}for(var E=this._subKeys=[],O=0;O<16;O++){for(var _=E[O]=[],R=h[O],I=0;I<24;I++)_[I/6|0]|=T[(c[I]-1+R)%28]<<31-I%6,_[4+(I/6|0)]|=T[28+(c[I+24]-1+R)%28]<<31-I%6;_[0]=_[0]<<1|_[0]>>>31;for(var I=1;I<7;I++)_[I]=_[I]>>>(I-1)*4+3;_[7]=_[7]<<5|_[7]>>>27}for(var v=this._invSubKeys=[],I=0;I<16;I++)v[I]=E[15-I]},encryptBlock:function(b,P){this._doCryptBlock(b,P,this._subKeys)},decryptBlock:function(b,P){this._doCryptBlock(b,P,this._invSubKeys)},_doCryptBlock:function(b,P,T){this._lBlock=b[P],this._rBlock=b[P+1],m.call(this,4,252645135),m.call(this,16,65535),g.call(this,2,858993459),g.call(this,8,16711935),m.call(this,1,1431655765);for(var I=0;I<16;I++){for(var C=T[I],E=this._lBlock,O=this._rBlock,_=0,R=0;R<8;R++)_|=u[R][((O^C[R])&d[R])>>>0];this._lBlock=O,this._rBlock=E^_}var v=this._lBlock;this._lBlock=this._rBlock,this._rBlock=v,m.call(this,1,1431655765),g.call(this,8,16711935),g.call(this,2,858993459),m.call(this,16,65535),m.call(this,4,252645135),b[P]=this._lBlock,b[P+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function m(b,P){var T=(this._lBlock>>>b^this._rBlock)&P;this._rBlock^=T,this._lBlock^=T<<b}function g(b,P){var T=(this._rBlock>>>b^this._lBlock)&P;this._lBlock^=T,this._rBlock^=T<<b}r.DES=s._createHelper(p);var y=a.TripleDES=s.extend({_doReset:function(){var b=this._key,P=b.words;if(P.length!==2&&P.length!==4&&P.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var T=P.slice(0,2),I=P.length<4?P.slice(0,2):P.slice(2,4),C=P.length<6?P.slice(0,2):P.slice(4,6);this._des1=p.createEncryptor(n.create(T)),this._des2=p.createEncryptor(n.create(I)),this._des3=p.createEncryptor(n.create(C))},encryptBlock:function(b,P){this._des1.encryptBlock(b,P),this._des2.decryptBlock(b,P),this._des3.encryptBlock(b,P)},decryptBlock:function(b,P){this._des3.decryptBlock(b,P),this._des2.encryptBlock(b,P),this._des1.decryptBlock(b,P)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=s._createHelper(y)})(),e.TripleDES})}),Ept=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),qL(),$L(),Xv(),Ag()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.StreamCipher,s=r.algo,a=s.RC4=n.extend({_doReset:function(){for(var h=this._key,u=h.words,d=h.sigBytes,p=this._S=[],m=0;m<256;m++)p[m]=m;for(var m=0,g=0;m<256;m++){var y=m%d,b=u[y>>>2]>>>24-y%4*8&255;g=(g+p[m]+b)%256;var P=p[m];p[m]=p[g],p[g]=P}this._i=this._j=0},_doProcessBlock:function(h,u){h[u]^=l.call(this)},keySize:256/32,ivSize:0});function l(){for(var h=this._S,u=this._i,d=this._j,p=0,m=0;m<4;m++){u=(u+1)%256,d=(d+h[u])%256;var g=h[u];h[u]=h[d],h[d]=g,p|=h[(h[u]+h[d])%256]<<24-m*8}return this._i=u,this._j=d,p}r.RC4=n._createHelper(a);var c=s.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var h=this.cfg.drop;h>0;h--)l.call(this)}});r.RC4Drop=n._createHelper(c)})(),e.RC4})}),Opt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),qL(),$L(),Xv(),Ag()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.StreamCipher,s=r.algo,a=[],l=[],c=[],h=s.Rabbit=n.extend({_doReset:function(){for(var d=this._key.words,p=this.cfg.iv,m=0;m<4;m++)d[m]=(d[m]<<8|d[m]>>>24)&16711935|(d[m]<<24|d[m]>>>8)&4278255360;var g=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],y=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var m=0;m<4;m++)u.call(this);for(var m=0;m<8;m++)y[m]^=g[m+4&7];if(p){var b=p.words,P=b[0],T=b[1],I=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360,C=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,E=I>>>16|C&4294901760,O=C<<16|I&65535;y[0]^=I,y[1]^=E,y[2]^=C,y[3]^=O,y[4]^=I,y[5]^=E,y[6]^=C,y[7]^=O;for(var m=0;m<4;m++)u.call(this)}},_doProcessBlock:function(d,p){var m=this._X;u.call(this),a[0]=m[0]^m[5]>>>16^m[3]<<16,a[1]=m[2]^m[7]>>>16^m[5]<<16,a[2]=m[4]^m[1]>>>16^m[7]<<16,a[3]=m[6]^m[3]>>>16^m[1]<<16;for(var g=0;g<4;g++)a[g]=(a[g]<<8|a[g]>>>24)&16711935|(a[g]<<24|a[g]>>>8)&4278255360,d[p+g]^=a[g]},blockSize:128/32,ivSize:64/32});function u(){for(var d=this._X,p=this._C,m=0;m<8;m++)l[m]=p[m];p[0]=p[0]+1295307597+this._b|0,p[1]=p[1]+3545052371+(p[0]>>>0<l[0]>>>0?1:0)|0,p[2]=p[2]+886263092+(p[1]>>>0<l[1]>>>0?1:0)|0,p[3]=p[3]+1295307597+(p[2]>>>0<l[2]>>>0?1:0)|0,p[4]=p[4]+3545052371+(p[3]>>>0<l[3]>>>0?1:0)|0,p[5]=p[5]+886263092+(p[4]>>>0<l[4]>>>0?1:0)|0,p[6]=p[6]+1295307597+(p[5]>>>0<l[5]>>>0?1:0)|0,p[7]=p[7]+3545052371+(p[6]>>>0<l[6]>>>0?1:0)|0,this._b=p[7]>>>0<l[7]>>>0?1:0;for(var m=0;m<8;m++){var g=d[m]+p[m],y=g&65535,b=g>>>16,P=((y*y>>>17)+y*b>>>15)+b*b,T=((g&4294901760)*g|0)+((g&65535)*g|0);c[m]=P^T}d[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,d[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,d[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,d[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,d[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,d[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,d[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,d[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.Rabbit=n._createHelper(h)})(),e.Rabbit})}),Apt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),qL(),$L(),Xv(),Ag()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.StreamCipher,s=r.algo,a=[],l=[],c=[],h=s.RabbitLegacy=n.extend({_doReset:function(){var d=this._key.words,p=this.cfg.iv,m=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],g=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var y=0;y<4;y++)u.call(this);for(var y=0;y<8;y++)g[y]^=m[y+4&7];if(p){var b=p.words,P=b[0],T=b[1],I=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360,C=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,E=I>>>16|C&4294901760,O=C<<16|I&65535;g[0]^=I,g[1]^=E,g[2]^=C,g[3]^=O,g[4]^=I,g[5]^=E,g[6]^=C,g[7]^=O;for(var y=0;y<4;y++)u.call(this)}},_doProcessBlock:function(d,p){var m=this._X;u.call(this),a[0]=m[0]^m[5]>>>16^m[3]<<16,a[1]=m[2]^m[7]>>>16^m[5]<<16,a[2]=m[4]^m[1]>>>16^m[7]<<16,a[3]=m[6]^m[3]>>>16^m[1]<<16;for(var g=0;g<4;g++)a[g]=(a[g]<<8|a[g]>>>24)&16711935|(a[g]<<24|a[g]>>>8)&4278255360,d[p+g]^=a[g]},blockSize:128/32,ivSize:64/32});function u(){for(var d=this._X,p=this._C,m=0;m<8;m++)l[m]=p[m];p[0]=p[0]+1295307597+this._b|0,p[1]=p[1]+3545052371+(p[0]>>>0<l[0]>>>0?1:0)|0,p[2]=p[2]+886263092+(p[1]>>>0<l[1]>>>0?1:0)|0,p[3]=p[3]+1295307597+(p[2]>>>0<l[2]>>>0?1:0)|0,p[4]=p[4]+3545052371+(p[3]>>>0<l[3]>>>0?1:0)|0,p[5]=p[5]+886263092+(p[4]>>>0<l[4]>>>0?1:0)|0,p[6]=p[6]+1295307597+(p[5]>>>0<l[5]>>>0?1:0)|0,p[7]=p[7]+3545052371+(p[6]>>>0<l[6]>>>0?1:0)|0,this._b=p[7]>>>0<l[7]>>>0?1:0;for(var m=0;m<8;m++){var g=d[m]+p[m],y=g&65535,b=g>>>16,P=((y*y>>>17)+y*b>>>15)+b*b,T=((g&4294901760)*g|0)+((g&65535)*g|0);c[m]=P^T}d[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,d[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,d[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,d[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,d[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,d[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,d[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,d[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.RabbitLegacy=n._createHelper(h)})(),e.RabbitLegacy})}),_pt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),qL(),$L(),Xv(),Ag()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.BlockCipher,s=r.algo;let a=16,l=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var h={pbox:[],sbox:[]};function u(y,b){let P=b>>24&255,T=b>>16&255,I=b>>8&255,C=b&255,E=y.sbox[0][P]+y.sbox[1][T];return E=E^y.sbox[2][I],E=E+y.sbox[3][C],E}function d(y,b,P){let T=b,I=P,C;for(let E=0;E<a;++E)T=T^y.pbox[E],I=u(y,T)^I,C=T,T=I,I=C;return C=T,T=I,I=C,I=I^y.pbox[a],T=T^y.pbox[a+1],{left:T,right:I}}function p(y,b,P){let T=b,I=P,C;for(let E=a+1;E>1;--E)T=T^y.pbox[E],I=u(y,T)^I,C=T,T=I,I=C;return C=T,T=I,I=C,I=I^y.pbox[1],T=T^y.pbox[0],{left:T,right:I}}function m(y,b,P){for(let O=0;O<4;O++){y.sbox[O]=[];for(let _=0;_<256;_++)y.sbox[O][_]=c[O][_]}let T=0;for(let O=0;O<a+2;O++)y.pbox[O]=l[O]^b[T],T++,T>=P&&(T=0);let I=0,C=0,E=0;for(let O=0;O<a+2;O+=2)E=d(y,I,C),I=E.left,C=E.right,y.pbox[O]=I,y.pbox[O+1]=C;for(let O=0;O<4;O++)for(let _=0;_<256;_+=2)E=d(y,I,C),I=E.left,C=E.right,y.sbox[O][_]=I,y.sbox[O][_+1]=C;return!0}var g=s.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var y=this._keyPriorReset=this._key,b=y.words,P=y.sigBytes/4;m(h,b,P)}},encryptBlock:function(y,b){var P=d(h,y[b],y[b+1]);y[b]=P.left,y[b+1]=P.right},decryptBlock:function(y,b){var P=p(h,y[b],y[b+1]);y[b]=P.left,y[b+1]=P.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=n._createHelper(g)})(),e.Blowfish})}),vpt=sc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Uc(),KQ(),ipt(),npt(),qL(),opt(),$L(),m6e(),APe(),spt(),g6e(),apt(),lpt(),cpt(),_Pe(),hpt(),Xv(),Ag(),upt(),dpt(),ppt(),fpt(),mpt(),gpt(),ypt(),bpt(),Ppt(),Tpt(),Ipt(),Cpt(),Spt(),Ept(),Opt(),Apt(),_pt()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./enc-base64url","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy","./blowfish"],r):e.CryptoJS=r(e.CryptoJS)})(o,function(e){return e})}),xpt=(o=>(o.Device="Device",o.Symbol="Symbol",o.Footprint="Footprint",o.OBJ="OBJ",o.ModelID="3D Model",o.ModelName="3D Model Title",o.OriginModelName="Origin 3D Model Title",o.ModelTransform="3D Model Transform",o.OriginFootprint="Origin Footprint",o))(xpt||{}),Rpt=(o=>(o.DOCHEAD="DOCHEAD",o.EDIT_HEAD="EDIT_HEAD",o.SCH="SCH",o.SCH_PAGE="SCH_PAGE",o.PCB="PCB",o.PANEL="PANEL",o.PANEL_LIB="PANEL_LIB",o.SYMBOL="SYMBOL",o.FOOTPRINT="FOOTPRINT",o.DEVICE="DEVICE",o.BLOB="BLOB",o.INSTANCE="INSTANCE",o.CONFIG="CONFIG",o.BOARD="BOARD",o.FONT="FONT",o.VARIANT="VARIANT",o.COMPONENT_GROUP="COMPONENT_GROUP",o.COMPONENT_GROUP_DATA="COMPONENT_GROUP_DATA",o.SIMULATION="SIMULATION",o))(Rpt||{}),Dpt=(o=>(o.META="META",o.META_SORT="META_SORT",o.META_CREATE="META_CREATE",o.META_MODIFY="META_MODIFY",o.FONT="FONT",o.BLOB="BLOB",o.MAX_NUM="MAX_NUM",o.INSTANCE_ATTR="INSTANCE_ATTR",o.DELETE_DOC="DELETE_DOC",o.META_Z_INDEX="META_Z_INDEX",o.VARIANT_GROUPED="VARIANT_GROUPED",o.GROUP_INDEX="GROUP_INDEX",o.GROUP_DATA="GROUP_DATA",o.RULE_TEMPLATE="RULE_TEMPLATE",o.RULE="RULE",o.RULE_SELECTOR="RULE_SELECTOR",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o.META_PLACEHOLDER="META_PLACEHOLDER",o))(Dpt||{});var y6e=`|
`;function JW(o,t,e){return o.slice(t,e)}function E4e(o,t,e){let r=o.length,i=0;for(;i<r;){let n=o.indexOf(`|
`,i);if(n<0){if(e)return o.substring(i);n=r}let s=JW(o,i,n);try{if(s){let a=s.indexOf("||"),l=a>-1,c=l?JW(s,0,a):s,h=l?JW(s,a+2):"";if(t(c,h,s,l?i+a+2:i)===!1){s=null;break}s=null}}catch(a){console.error(a)}i=n+2}o=null}var wpt=["SYMBOL","FOOTPRINT","BLOB","FONT","PANEL_LIB","DEVICE","BOARD","INSTANCE","CONFIG","VARIANT","COMPONENT_GROUP","COMPONENT_GROUP_DATA"];function QW(o,t){return wpt.includes(t)?t:o}var vPe=class{parseFull(o,t,e){let r=t,i=e,n,s=null;E4e(o,(a,l,c)=>{let h=JSON.parse(a);if(h.type==="EDIT_HEAD")s=JSON.parse(l),this.onEditHead&&this.onEditHead(s);else if(h.type==="DOCHEAD"){let u=JSON.parse(l);i=u.docType,r=u.uuid,n=u.client,u.ticket=h.ticket,this.onDocHead(u,s,c)}else this.onLine(h.id,h.ticket,l,h.type,h.client||n,i,r,h.firstTicket,h.pend,s,h.num,c)}),this.onEnd(),o=null}flowParseFull(o={}){let{cache:t,chunkLength:e=100*1024*1024,idsData:r,history:i}=o,n="",s=null,a,l=null,c=!0,h="",u=0,d=!1,p={},m=t?{}:void 0,g=new Set,y=T=>{m[T]===void 0&&(m[T]=-1),t(T,++m[T],p[T].data.join(`|
`)),p[T].data.length=0,p[T].size=0,p[T].data.push(p[T].head),p[T].size+=p[T].head.length},b=T=>{if(g.add(n),!t)return;let I=QW(n,s);p[I].data.push(T),p[I].size+=(p[I].size?2:0)+T.length,p[I].size+T.length>e&&y(I)},P=(T,I)=>E4e(T,(C,E,O,_)=>{var R,v,D,w,F,H,z,G;let W=JSON.parse(C);if(W.type==="EDIT_HEAD")l=JSON.parse(E),(R=this.onEditHead)==null||R.call(this,l),(v=o.onEditHead)==null||v.call(o,l),d=!0;else if(W.type==="DOCHEAD"){let L=JSON.parse(E);s=L.docType,n=L.uuid,a=L.client,L.ticket=W.ticket,d||(l={uuid:L.uuid,username:(D=L==null?void 0:L.user)==null?void 0:D.username,nickname:(w=L==null?void 0:L.user)==null?void 0:w.nickname,updateTime:L==null?void 0:L.updateTime},(F=o.onEditHead)==null||F.call(o,l),d=!0),this.onDocHead(L,l,O,i);let B=QW(n,s);t&&!p[B]&&(p[B]={size:0,data:[],head:""}),t&&(p[B].head=O),b(O)}else{let L=W.num,B=W.client||a;if(r){let N=(G=(z=(H=r.ids)==null?void 0:H[n])==null?void 0:z[B])==null?void 0:G[W.id];if(!N||N[0]!==W.ticket)return;L=N[1],r.size-=1,delete r.ids[n][B][W.id]}if(i){let N=QW(n,s);t&&(i.dNum=(m==null?void 0:m[N])===void 0?0:(m==null?void 0:m[N])+1),i.start=t?p[N].size+2+C.length+2:u+_,i.size=O.length,W.client&&(i.hClient=!0)}this.onLine(W.id,W.ticket,E,W.type,B,s,n,W.firstTicket,W.pend,l||(i==null?void 0:i.editHead),L,O,i),b(O)}},I);return{start:()=>{c=!0},end:()=>{if(h&&P(h,!1),t)for(let T in p)p[T].size&&p[T].data.length>1&&y(T),p[T]=null;c=!1,h="",n="",n=null,a="",l=null,this.onEnd()},update:T=>{if(!c)throw new Error("\u66F4\u65B0\u524D\u672A\u8C03\u7528 start \u65B9\u6CD5");let I=P(h+T,!0);u=u+h.length+T.length-((I==null?void 0:I.length)||0),h="",I&&(h=I)},docMap:m,getDocIds:()=>Array.from(g)}}parseLine(o,t,e){let r=o.indexOf("||"),i=r!==-1,n=i?JW(o,0,r):o,s=i?JW(o,r+2):"",a=JSON.parse(n);this.onLine(a.id,a.ticket,s,a.type,a.client,e,t,a.firstTicket,a.pend,void 0,a.num,o),o=null}onEditHead(o){}},H2e=new Uint8Array(8);function Jm(){crypto.getRandomValues(H2e);let o="";for(let t=0;t<H2e.length;t++)o+=H2e[t].toString(16).padStart(2,"0");return o}function zv(o,t,e,r,i,n,s,a){let l={docType:o,client:t,uuid:e};return(r||r===0)&&(l.updateTime=r),(i||l.updateTime||l.updateTime===0)&&(l.version=i||String(r)),(a||self!=null&&self.PRO_EDITOR_VERSION)&&(l.editVersion=a||(self==null?void 0:self.PRO_EDITOR_VERSION)),n&&(l.user=n),`${JSON.stringify({type:"DOCHEAD",ticket:s})}||${JSON.stringify(l)}`}function nm(o,t,e,r,i,n,s,a){let l={type:o,ticket:t,id:e};return n!==void 0&&(l.firstTicket=n),s!==void 0&&(l.pend=s),a!==void 0&&(l.num=a),i&&(l.client=i),`${JSON.stringify(l)}||${r}`}var xPe=class extends vPe{constructor(o){super(),this.unique=Jm(),this.maxTicket=0,this.isPendChange=!0,this.isLocalChange=!0,this.cbArr=[],this.tempLocalIds={},this.docMaxTicket={},this.client=o||Jm()}onLine(o,t,e,r,i,n,s,a,l,c,h){this.remoteChange(t,i,s,o,e,r,n,void 0,a,l,c,void 0,void 0,h)}getUnique(){return this.unique}setUnique(o){this.unique=o}setDocMaxTicket(o,t,e){e||(!this.docMaxTicket[o]||this.docMaxTicket[o]<t)&&(this.docMaxTicket[o]=t)}getDocMaxTicket(o){var t;return(t=this.docMaxTicket[o])!=null?t:0}onDocHead(o,t){}onEnd(){}setIsPendChange(o){this.isPendChange=o}getIsPendChange(){return this.isPendChange}getMaxTicket(){return this.maxTicket}setMaxTicket(o,t){o&&(t||this.maxTicket<o)&&(this.maxTicket=o)}setIsLocalChange(o){this.isLocalChange=o}getIsLocalChange(){return this.isLocalChange}revoke(o,t,e,r,i,n,s,a,l,c,h){var u;if(!((u=this.tempLocalIds[o])!=null&&u[t]))return h?h(t,i,e,s,`${r}-1`,o,n,void 0,void 0,!0,c):this.cbArr.forEach(d=>d(o,t,e,s,`${r}-1`,i,void 0,n,void 0,void 0,void 0,c)),!0}getRandomUuid(){return Jm()}getClient(){return this.client}onChange(o){this.cbArr.push(o)}localChange(o,t,e,r,i,n){let s=this.maxTicket+1;return this.tempLocalIds[o]||(this.tempLocalIds[o]={}),this.tempLocalIds[o][t]=[this.getClient(),s],this.remoteChange(s,this.client,o,t,e,r,i,!0,void 0,!0,void 0,this.unique,void 0,n),s}remoteChange(o,t,e,r,i,n,s,a,l,c,h,u,d,p){var m;this.setMaxTicket(o);let g=u===this.unique,y=a||g,b=(!y||y&&this.isLocalChange)&&(!d||d&&this.isPendChange),P=(m=this.tempLocalIds[e])==null?void 0:m[r];!a&&g?P?(b=!1,P[0]===t&&P[1]===o&&delete this.tempLocalIds[e][r]):b=!0:!a&&P&&(P[1]>o||P[1]===o&&P[0]>t?b=!1:delete this.tempLocalIds[e][r]),this.setDocMaxTicket(e,o,c),b&&this.cbArr.forEach(T=>T(e,r,i,n,t,o,l,c,void 0,d,u,p))}},Lpt=class{constructor(o){this.item=o,this.parent=null,this.left=null,this.right=null,this.height=1}getParent(){return this.parent}getLeft(){return this.left}getRight(){return this.right}getHeight(){return this.height}setLeft(o){if(this.left!==null)throw new Error("insert exists left is not permitted");if(o!==null){if(o.parent!==null)throw new Error("insert left with node has parent is not permitted");this.left=o,o.parent=this,this.updateHeight()}}setRight(o){if(this.right!==null)throw new Error("insert exists right is not permitted");if(o!==null){if(o.parent!==null)throw new Error("insert right with node has parent is not permitted");this.right=o,o.parent=this,this.updateHeight()}}removeLeft(){if(this.left===null)return null;{let o=this.left;return o.parent=null,this.left=null,this.updateHeight(),o}}removeRight(){if(this.right===null)return null;{let o=this.right;return o.parent=null,this.right=null,this.updateHeight(),o}}rotateRight(o){let t=this.removeLeft();if(this.setLeft(t.removeRight()),this.parent){let e=this.parent;e.getLeft()===this?(e.removeLeft(),e.setLeft(t)):(e.removeRight(),e.setRight(t)),t.setRight(this)}else t.setRight(this),o(t)}rotateLeft(o){let t=this.removeRight();if(this.setRight(t.removeLeft()),this.parent){let e=this.parent;e.getLeft()===this?(e.removeLeft(),e.setLeft(t)):(e.removeRight(),e.setRight(t)),t.setLeft(this)}else t.setLeft(this),o(t)}updateHeight(){var o,t;let e=this;for(;e!==null;)e.height=Math.max(((o=e.left)==null?void 0:o.height)||0,((t=e.right)==null?void 0:t.height)||0)+1,e=e.parent}},hPe=class{constructor(o){this.comparator=o,this.root=null,this.size=0}balance(o){var t,e;let r=((t=o.getLeft())==null?void 0:t.getHeight())||0,i=((e=o.getRight())==null?void 0:e.getHeight())||0,n=o.getParent();r>i?r-i>1?(o.rotateRight(s=>this.root=s),this.verify()):n!==null?n.getRight()===o&&(o.rotateRight(s=>this.root=s),this.verify()):(o.rotateRight(s=>this.root=s),this.verify()):i>r&&(i-r>1?(o.rotateLeft(s=>this.root=s),this.verify()):n!==null?n.getLeft()===o&&(o.rotateLeft(s=>this.root=s),this.verify()):(o.rotateLeft(s=>this.root=s),this.verify())),n&&this.balance(n)}forwardTraverse(o){let t=new Array(10),e=this.findMin();for(;e;)switch(t.pop()||2){case 1:e.getLeft()!==null?(t.push(2),t.push(1),e=e.getLeft()):t.push(2);break;case 2:if(!o(e.item))return;e.getRight()!==null?(t.push(3),t.push(1),e=e.getRight()):t.push(3);break;case 3:e=e.getParent();break;default:throw new Error("invalid status")}}backwardTraverse(o){let t=new Array(10),e=this.findMax();for(;e;)switch(t.pop()||2){case 1:e.getRight()!==null?(t.push(2),t.push(1),e=e.getRight()):t.push(2);break;case 2:if(!o(e.item))return;e.getLeft()!==null?(t.push(3),t.push(1),e=e.getLeft()):t.push(3);break;case 3:e=e.getParent();break;default:throw new Error("invalid status")}}display(o=this.root,t=new Array,e=0){let r="| ".repeat(e);return o?(t.push(r+`\u25CF(${JSON.stringify(o.item)})
`),this.display(o.getLeft(),t,e+1),this.display(o.getRight(),t,e+1)):t.push(r+`\u2609
`),t}getHeight(){var o;return((o=this.root)==null?void 0:o.getHeight())||0}getSize(){return this.size}insert(o){let t=new Lpt(o);if(this.root===null)return this.root=t,this.size++,!0;{let e=this.root;for(;;){let r=this.comparator(o,e.item);if(r<0){if(e.getLeft()===null)return e.setLeft(t),this.size++,this.verify(),this.balance(e),!0;e=e.getLeft()}else if(r>0){if(e.getRight()===null)return e.setRight(t),this.size++,this.verify(),this.balance(e),!0;e=e.getRight()}else return!1}}}verify(){}remove(o){let t=this.root;for(this.verify();;){if(t===null)return!1;let e=this.comparator(o,t.item);if(e<0)t=t.getLeft();else if(e>0)t=t.getRight();else return this.removeNode(t),this.size--,this.verify(),!0}}removeNode(o){var t,e;let r=o.getParent();if(r===null)o.getLeft()===null&&o.getRight()===null?this.root=null:((((t=o.getLeft())==null?void 0:t.getHeight())||0)>(((e=o.getRight())==null?void 0:e.getHeight())||0)?(o.rotateRight(i=>this.root=i),this.verify()):(o.rotateLeft(i=>this.root=i),this.verify()),this.removeNode(o));else if(r.getLeft()===o){r.removeLeft();let i=this.combineNodes(o.removeLeft(),o.removeRight());r.setLeft(i),this.verify(),this.balance(r)}else{r.removeRight();let i=this.combineNodes(o.removeLeft(),o.removeRight());r.setRight(i),this.verify(),this.balance(r)}}combineNodes(o,t){if(o&&t)if(o.getHeight()>t.getHeight()){let e=this.findMaxChild(o);if(e){let r=e.getParent();return r.removeRight(),r.setRight(e.removeLeft()),e.setLeft(o),e.setRight(t),e}else return o.setRight(t),o}else{let e=this.findMinChild(t);if(e){let r=e.getParent();return r.removeLeft(),r.setLeft(e.removeRight()),e.setLeft(o),e.setRight(t),e}else return t.setLeft(o),t}else return o||t||null}findMax(){let o=this.root;for(;;){let t=o==null?void 0:o.getRight();if(t)o=t;else return o}}findMin(){let o=this.root;for(;;){let t=o==null?void 0:o.getLeft();if(t)o=t;else return o}}findMinChild(o){let t=o;for(;;){if(t.getLeft()===null)return t!==o?t:null;t=t.getLeft()}}findMaxChild(o){let t=o;for(;;){if(t.getRight()===null)return t!==o?t:null;t=t.getRight()}}};var ZQ=/^[a-zA-Z]+(\d+)$/;function O4e(o){let t=o.match(ZQ);return t?Number(t[1]):null}function Nn(o){if(!o||typeof o!="string")return o;let t=o.match(/[a-zA-Z]+\d+/g);return t&&t.length===2&&t.join("")===o?t.join("-"):o}function Gc(o,t){return JSON.stringify([t,o])}function Vv(o){try{let t=JSON.parse(o);return typeof t=="string"?o:t[1]}catch{return o}}function zL(o,t,e){let r=o[t];return r!==void 0||(r=e(t),o[t]=r),r}var Mpt=(o=>(o.META="META",o.CANVAS="CANVAS",o.GROUP="GROUP",o.POLY="POLY",o.STRING="STRING",o.AUX_LINE="AUXLINE",o.DIMENSION="DIMENSION",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o))(Mpt||{}),Npt=(o=>(o.META="META",o.CANVAS="CANVAS",o.LAYER="LAYER",o.LAYER_PHYS="LAYER_PHYS",o.ACTIVE_LAYER="ACTIVE_LAYER",o.PARTITION="PARTITION",o.NET="NET",o.PRIMITIVE="PRIMITIVE",o.GROUP="GROUP",o.SILK_OPTS="SILK_OPTS",o.PREFERENCE="PREFERENCE",o.VIA="VIA",o.PAD="PAD",o.LINE="LINE",o.ARC="ARC",o.OBJ="OBJ",o.EQLEN_GRP="EQLEN_GRP",o.POLY="POLY",o.FILL="FILL",o.LAYER_FILL="LAYER_FILL",o.REGION="REGION",o.POUR="POUR",o.POURED="POURED",o.IMAGE="IMAGE",o.TEARDROP="TEARDROP",o.FPC_FILL="FPC_FILL",o.SHELL="SHELL",o.CREASE="CREASE",o.SHELLCUT="SHELLCUT",o.SHELL_ENTITY="SHELL_ENTITY",o.BOSS="BOSS",o.STRING="STRING",o.ATTR="ATTR",o.DIMENSION="DIMENSION",o.COMPONENT="COMPONENT",o.PAD_NET="PAD_NET",o.RULE_TEMPLATE="RULE_TEMPLATE",o.RULE="RULE",o.RULE_SELECTOR="RULE_SELECTOR",o.PANELIZE="PANELIZE",o.BOARD="BOARD",o.X_SIGNALS_GROUP="X_SIGNAL_GROUP",o.X_SIGNALS="X_SIGNALS",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o))(Npt||{}),kpt=(o=>(o.META="META",o.CANVAS="CANVAS",o.GROUP="GROUP",o.ATTR="ATTR",o.LINE="LINE",o.WIRE="WIRE",o.BUS="BUS",o.TEXT="TEXT",o.POLY="POLY",o.CIRCLE="CIRCLE",o.ARC="ARC",o.BUSENTRY="BUSENTRY",o.RECT="RECT",o.MASK_REGION="MASK_REGION",o.PIN="PIN",o.OBJ="OBJ",o.COMPONENT="COMPONENT",o.PART="PART",o.ELLIPSE="ELLIPSE",o.BEZIER="BEZIER",o.TABLE="TABLE",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o.NG_SETTING="NG_SETTING",o))(kpt||{});function A4e(o,t){return o.ticket===t.ticket?o.client<t.client:o.ticket<t.ticket}var Il=class b6e{static find(t,e){return t.last&&e(t.last)?t.last:t.list?t.list.find(e):null}static getFirstTicket(t){var e,r;if(!t)return 0;if(t.last.dataType==="META"){if(t.last.firstTicket!==void 0)return t.last.firstTicket;let i=t.last.ticket;if(t.list)for(let n=t.list.length-1;n>=0;--n){let s=t.list[n];if(s.firstTicket)return s.firstTicket;i=s.ticket}return i}else{let i=b6e.getHead(t);return(r=(e=i==null?void 0:i.firstTicket)!=null?e:i==null?void 0:i.ticket)!=null?r:0}}static getHead(t){var e;return((e=t==null?void 0:t.list)==null?void 0:e[0])||t.last}static getPreNode(t,e){if(t.last===e)return t.list?t.list[t.list.length-1]:null;let r=t.list.findIndex(i=>i===e);return t.list[r-1]}static remove(t,e){var r;if(t.last===e)t.last=((r=t.list)==null?void 0:r.pop())||null;else if(t.list){let i=t.list.findIndex(n=>n===e);i>-1&&t.list.slice(i,1)}}static getLength(t){let e=0;return t&&(t.last&&(e+=1),t.list&&(e+=t.list.length)),e}static insert(t,e){if(!t.last){t.last=e;return}if(A4e(t.last,e)){let n=t.last;t.last=e,e=n}if(!t.list){t.list=[e];return}let r=0,i=t.list.length;for(;r<i;){let n=Math.floor((r+i)/2);A4e(t.list[n],e)?r=n+1:i=n}t.list.splice(r,0,e)}static preForEach(t,e){if(!(!t.last||e(t.last))&&t.list)for(let r=t.list.length-1;r>=0&&!e(t.list[r]);--r);}static async awaitPreForEach(t,e){if(!t.last)return;let r,i=e(t.last,n=>r=n);if(r===void 0&&await i,!r&&t.list)for(let n=t.list.length-1;n>=0;--n){let s,a=e(t.list[n],l=>s=l);if(s===void 0&&await a,s)break}}},Bpt=["GROUP","POLY","STRING","AUXLINE","DIMENSION"],P6e=["PARTITION","VIA","PAD","LINE","ARC","OBJ","POLY","FILL","REGION","POUR","POURED","IMAGE","TEARDROP","FPC_FILL","SHELL","CREASE","SHELLCUT","SHELL_ENTITY","BOSS","STRING","ATTR","DIMENSION","COMPONENT"],Fpt=["ATTR","WIRE","BUS","TEXT","POLY","CIRCLE","ARC","BUSENTRY","RECT","PIN","OBJ","COMPONENT","PART","ELLIPSE","BEZIER","TABLE","MASK_REGION"],Vpt=["SCH_PAGE","SIMULATION"],_4e=o=>o==="PCB"||o==="FOOTPRINT"?0:1,T6e=o=>o==="PCB"||o==="FOOTPRINT"?P6e:o==="PANEL"||o==="PANEL_LIB"?Bpt:o==="SCH_PAGE"||o==="SYMBOL"||o==="SIMULATION"?Fpt:[];function v4e(o,t,e){var r,i;let n=o.get(t),s=o.get(e),a=Il.getHead(n),l=Il.getHead(s),c=(r=a.firstTicket)!=null?r:a.ticket,h=(i=l.firstTicket)!=null?i:l.ticket,u=a.client,d=l.client;return c===h?u===d?t===e?0:t<e?-1:1:u<d?-1:1:c<h?-1:1}var Gpt=class{constructor(o){this.numSets={},this.orderCbArr=[],this.wDocData=o}orderChange(o){this.orderCbArr.push(o)}setOrderNum(o,t,e,r,i,n){var s,a;let l=r.last.dataType,c=1;if(l==="ELE_PLACEHOLDER"){let m=JSON.parse(r.last.data);l=m.dataType,c=m.max}else if(!((a=(s=T6e(t))==null?void 0:s.includes)!=null&&a.call(s,l)))return;if(c<1)throw new Error("step must be greater than 0");let h=zL(this.numSets[o].orderLists,l,()=>new hPe((m,g)=>v4e(this.wDocData.get(o),m,g))),u=zL(this.numSets[o].maxNum,l,()=>_4e(t)-1),d=this.wDocData.get(o).get(e);if(n&&(h.remove(e),u-=d.step||1),!Il.getLength(d))return;d.num=0,c>1&&(d.step=c),h.insert(e),u+=c;let p=u;h.backwardTraverse(m=>{let g=this.wDocData.get(o).get(m);return g.num=p,i&&m!==e&&this.orderCbArr.forEach(y=>y(o,m,l,g.num)),p-=g.step||1,m!==e}),this.numSets[o].maxNum[l]=u}removeNode(o,t,e){let r=this.wDocData.get(o).get(e);if(r.num===void 0)return;let i=r.last.dataType,n=zL(this.numSets[o].orderLists,i,()=>new hPe((l,c)=>v4e(this.wDocData.get(o),l,c))),s=zL(this.numSets[o].maxNum,i,()=>_4e(t)-1);s-=r.step||1;let a=s;n.backwardTraverse(l=>{if(l===e)return!0;let c=this.wDocData.get(o).get(l);return c.num=a,this.orderCbArr.forEach(h=>h(o,l,i,c.num)),a-=c.step||1,!1}),this.numSets[o].maxNum[i]=s,n.remove(e)}getOrderNum(o,t){var e,r,i;return(i=(r=(e=this.wDocData.get(o))==null?void 0:e.get)==null?void 0:r.call(e,t))==null?void 0:i.num}getMaxNum(o){var t;return((t=this.numSets[o])==null?void 0:t.maxNum)||{}}delete(o){this.numSets[o]&&delete this.numSets[o]}add(o){this.numSets[o]||(this.numSets[o]={orderLists:{},maxNum:{}})}has(o){return!!this.numSets[o]}},Upt=wk(oz()),Hpt=(o=>(o.SOLID="SOLID",o.SHORT_DASH="SHORT_DASH",o.DOT="DOT",o.DOT_DASH="DOT_DASH",o))(Hpt||{}),Wpt=(o=>(o.PRINT="PRINT",o.COVER="COVER",o.PRINT_AND_COVER="PRINT&COVER",o))(Wpt||{}),zpt=(o=>(o.LEFT="LEFT",o.CENTER="CENTER",o.RIGHT="RIGHT",o))(zpt||{}),Ypt=(o=>(o.TOP="TOP",o.MIDDLE="MIDDLE",o.BOTTOM="BOTTOM",o))(Ypt||{}),pl=(o=>(o.LEFT_BOTTOM="LEFT_BOTTOM",o.CENTER_BOTTOM="CENTER_BOTTOM",o.RIGHT_BOTTOM="RIGHT_BOTTOM",o.LEFT_MIDDLE="LEFT_MIDDLE",o.CENTER_MIDDLE="CENTER_MIDDLE",o.RIGHT_MIDDLE="RIGHT_MIDDLE",o.LEFT_TOP="LEFT_TOP",o.CENTER_TOP="CENTER_TOP",o.RIGHT_TOP="RIGHT_TOP",o))(pl||{}),jpt=(o=>(o.NONE="NONE",o.SOLID="SOLID",o.GRID="GRID",o.HORIZONTAL_LINE="HORIZONTAL_LINE",o.VERTICAL_LINE="VERTICAL_LINE",o.RHOMBIC="RHOMBIC",o.LEFT_SLASH_LINE="LEFT_SLASH_LINE",o.RIGHT_SLASH_LINE="RIGHT_SLASH_LINE",o))(jpt||{}),Xpt=(o=>(o.NONE="NONE",o.CLOCK="CLOCK",o.INVERTED="INVERTED",o.INVERTED_CLOCK="INVERTED_CLOCK",o))(Xpt||{}),$O=(o=>(o.NONE="NONE",o.GRID="GRID",o.OUTLETS="OUTLETS",o))($O||{}),QP=(o=>(o.NONE="NONE",o.PUSH="PUSH",o.SURROUND="SURROUND",o.OBSTRUCT="OBSTRUCT",o.SURROUND_AND_PUSH="SURROUND&PUSH",o))(QP||{}),_g=(o=>(o.ELLIPSE="ELLIPSE",o.RECT="RECT",o.OVAL="OVAL",o.POLYGON="POLYGON",o))(_g||{}),KO=(o=>(o.ROUND="ROUND",o.RECT="RECT",o.SLOT="SLOT",o))(KO||{}),Lk=(o=>(o.SOLID="SOLID",o.GRID_LINE="GRID_LINE",o.HORIZONTAL_LINE="HORIZONTAL_LINE",o.VERTICAL_LINE="VERTICAL_LINE",o))(Lk||{}),qv=(o=>(o.ALL="ALL",o.PAD="PAD",o.VIA="VIA",o))(qv||{}),$v=(o=>(o.NONE="NONE",o.SINGLE="SINGLE",o.ALL="ALL",o))($v||{}),Mk=(o=>(o.OPTIMIZA_OPEN="OPTIMIZA_OPEN",o.OPTIMIZA_NONE="OPTIMIZA_NONE",o))(Mk||{}),Kv=(o=>(o.OPTIMIZA_STRONG="OPTIMIZA_STRONG",o.OPTIMIZA_WEAK="OPTIMIZA_WEAK",o.OPTIMIZA_NONE="OPTIMIZA_NONE",o))(Kv||{}),M2=(o=>(o.L45="L45",o.L90="L90",o.L="L",o.R45="R45",o.R90="R90",o.R="R",o))(M2||{}),ZO=(o=>(o.NORMAL="NORMAL",o.BLIND="BLIND",o.SUTURE="SUTURE",o))(ZO||{}),JO=(o=>(o.NORMAL="NORMAL",o.TEST="TEST",o.MARKER="MARKER",o))(JO||{}),QO=(o=>(o.DIVERGENCE="DIVERGENCE",o.DIRECT="DIRECT",o.NON_CONNECT="NON_CONNECT",o))(QO||{}),KL=(o=>(o.DOT="DOT",o.CENTER="CENT",o))(KL||{}),ZL=(o=>(o.NORMAL="NORMAL",o.BOARD_OUTLINE="BOARD_OUTLINE",o))(ZL||{}),N2=(o=>(o.SOLID="SOLID",o.GRID="GRID",o.PLANE="PLANE",o))(N2||{}),Nk=(o=>(o.PROHIBIT="PROHIBIT",o.CONSTRAINT="CONSTRAINT",o))(Nk||{}),eT=(o=>(o.COMPONENT="COMPONENT",o.VIA="VIA",o.TRACK="TRACK",o.FILL="FILL",o.COPPER="COPPER",o.PLANE="PLANE",o))(eT||{}),OI=(o=>(o.PI="Polyimide",o.FR4="FR4",o.STEEL_SHEET="Stainless Steel",o.M3_DOUBLE_SIDED_TAPE="3M Tape",o.EMI_SHIELDING_FILM="EMI Shielding Film",o))(OI||{}),JL=(o=>(o.PUSH_COVER="DRAWER",o.UPPER_LOWER_SHELLS="T&B",o))(JL||{}),dE=(o=>(o.X_AXIS_POSITIVE="X_AXIS_POSITIVE",o.X_AXIS_NEGATIVE="X_AXIS_NEGATIVE",o.Y_AXIS_POSITIVE="Y_AXIS_POSITIVE",o.Y_AXIS_NEGATIVE="Y_AXIS_NEGATIVE",o))(dE||{}),kk=(o=>(o.SLOT="SLOT",o.ENTITY="ENTITY",o))(kk||{}),eA=(o=>(o.AUTO="AUTO",o.UPPER_SHELLS="UPPER_SHELLS",o.LOWER_SHELLS="LOWER_SHELLS",o))(eA||{}),tA=(o=>(o.OUTLINE="OUTLINE",o.SCREW_PILLAR="SCREW_PILLAR",o.ENTITY="ENTITY",o))(tA||{}),AI=(o=>(o.M2="M2",o.M3="M3",o.M4="M4",o.M5="M5",o.M6="M6",o))(AI||{}),qpt=(o=>(o.LENGTH="LENGTH",o.RADIUS="RADIUS",o.ANGLE="ANGLE",o))(qpt||{}),$pt=(o=>(o.MIL="mil",o.INCH="inch",o.CM="cm",o.MM="mm",o))($pt||{}),Mo=(o=>(o.SAFE="SAFE",o.OTHER="OTHER",o.CREEPAGE="CREEPAGE",o.TRACK="TRACK",o.BLIND="BLIND",o.RADIUS="RADIUS",o.PLANE="PLANE",o.COPPER="COPPER",o.PASTE="PASTE",o.SOLDER="SOLDER",o.DIFFER_ENTAIL="DIFFER_ENTAIL",o.NET_LENGTH="NET_LENGTH",o.AUTO_ROUTER="AUTO_ROUTER",o.NET_LENGTH_TOLERANCE="NET_LENGTH_TOLERANCE",o))(Mo||{}),QL=(o=>(o.NORMAL="NORMAL",o.DEFAULT="DEFAULT",o))(QL||{}),eM=(o=>(o.ALL="ALL",o.LAYERED="LAYERED",o))(eM||{}),tM=(o=>(o.DIRECT="DIRECT",o.NON_CONNECT="NON_CONNECT",o))(tM||{}),rA=(o=>(o.FORTY_FIVE="L45",o.NINETY="L90",o.NINETY_ARC="A90",o))(rA||{}),iA=(o=>(o.LESS="LESS",o.MID="MID",o.MORE="MORE",o))(iA||{}),rM=(o=>(o.SPEED_FIRST="SPEED_FIRST",o.COMPLETION_FIRST="COMPLETION_FIRST",o))(rM||{}),Kpt=(o=>(o.DesignRule="DesignRule",o.Board="Board",o.SlotRegion="SlotRegion",o.ProhibitedRegion="ProhibitedRegion",o.ConstraintRegion="ConstraintRegion",o.Component="Component",o.Track="Track",o.TestPoint="TestPoint",o.Pad="Pad",o.Via="Via",o.SutureHole="SutureHole",o.Text="Text",o.ColorfulImage="ColorfulImage",o.Image="Image",o.FPCStiffener="FPCStiffener",o.Dimension="Dimension",o.CopperRegion="CopperRegion",o.FillRegion="Fill Region",o.Line="Line",o.Teardrop="Teardrop",o.D3Shell="D3Shell",o))(Kpt||{}),Zpt=wk(vpt());function Jpt(o,t){return o.fontFamily==t.fontFamily&&t.text==o.text&&Math.abs(o.fontSize-t.fontSize)<1e-5&&o.reverse==t.reverse&&o.expansion==t.expansion&&o.bold==t.bold&&o.italic==t.italic}function JP(o,t,e,r,i,n,s,a){return JSON.stringify([o||"",t||"",e,r,i?1:0,n?1:0,s?1:0,a])}function uPe(o){let t=JSON.parse(o);return{text:t[0],fontFamily:t[1],fontSize:t[2],thickness:t[3],bold:!!t[4],italic:!!t[5],reverse:!!t[6],expansion:t[7]}}function JQ(o){return Zpt.default.SHA256(o).toString()}function FW(o,t,e,r){let i="";return e?r?i=o+":"+t:i=o:r?i=t:i="",i}function Qpt(o,t){if(!o||!o.startsWith("="))return o;o=o.slice(1);let e=/\{([^\}]+)\}/g,r=[],i=[];for(;r=e.exec(o);)i.push(r[1]);for(let n=0;n<i.length;n++){let s=i[n],a=`{${s}!}`;t.has(s)&&(a=t.get(s)),o=o.replace(`{${s}}`,a)}return o}var PS=class{static getInitProps(){return{stringData:{},dData:{},oData:{},attrData:{},cData:{}}}static collectPcb(o,t,e,r,i){e==="STRING"&&(i.stringData[o]||(i.stringData[o]={}),i.stringData[o][t]=r),e==="DIMENSION"&&(i.dData[o]||(i.dData[o]={}),i.dData[o][t]=r),e==="ATTR"&&(i.attrData[o]||(i.attrData[o]={}),i.attrData[o][t]=r),e==="COMPONENT"&&(i.cData[o]||(i.cData[o]={}),i.cData[o][t]=r),e==="OBJ"&&(i.oData[o]||(i.oData[o]={}),i.oData[o][t]=r)}static collectFt(o,t,e,r,i){e==="STRING"&&(i.stringData[o]||(i.stringData[o]={}),i.stringData[o][t]=r),e==="DIMENSION"&&(i.dData[o]||(i.dData[o]={}),i.dData[o][t]=r),e==="ATTR"&&(i.attrData[o]||(i.attrData[o]={}),i.attrData[o][t]=r),e==="OBJ"&&(i.oData[o]||(i.oData[o]={}),i.oData[o][t]=r)}static collectPanel(o,t,e,r,i){e==="POLY"&&(i.oData[o]||(i.oData[o]={}),i.oData[o][t]=r)}static collectSheet(o,t,e,r,i){e==="OBJ"&&(i.oData[o]||(i.oData[o]={}),i.oData[o][t]=r),e==="ATTR"&&(i.attrData[o]||(i.attrData[o]={}),i.attrData[o][t]=r)}static collectSymbol(o,t,e,r,i){e==="OBJ"&&(i.oData[o]||(i.oData[o]={}),i.oData[o][t]=r)}static pcb(o={},t={},e={},r){var i,n,s,a;let l={devices:new Set,symbols:new Set,footprints:new Set,blobs:new Set,fonts:new Set},c={};for(let u in r.oData)for(let d in r.oData[u]){let p=r.oData[u][d];if(!p)continue;let m=JSON.parse(p);m.path&&m.path.startsWith("blob:")&&l.blobs.add(m.path.split("blob:").pop())}for(let u in r.stringData)for(let d in r.stringData[u]){let p=r.stringData[u][d];if(!p)continue;let m=JSON.parse(p);m.fontFamily==="default"||!m.text||l.fonts.add(JP(m.text,m.fontFamily,m.fontSize/10,m.strokeWidth,m.bold,m.italic,m.reverse,m.expansion))}for(let u in r.dData)for(let d in r.dData[u]){let p=r.dData[u][d];if(!p)continue;let m=JSON.parse(p).text;m.fontFamily==="default"||!m.text||l.fonts.add(JP(m.text,m.fontFamily,m.fontSize/10,m.strokeWidth,m.bold,m.italic,m.reverse,m.expansion))}let h={};for(let u in r.attrData)for(let d in r.attrData[u]){let p=r.attrData[u][d];if(!p)continue;let m=JSON.parse(p);h[u]||(h[u]={}),h[u][d]=m,m.key==="Device"&&(c[u]||(c[u]={}),c[u][m.parentId]=m.value)}for(let u in h)for(let d in h[u]){let p=h[u][d];if(!p)continue;let m=p;switch(m.key){case"Device":{m.value&&l.devices.add(m.value);break}case"Symbol":{m.value&&l.symbols.add(m.value);break}case"Footprint":{m.value&&l.footprints.add(m.value);break}}if(m.fontFamily==="default")continue;let g=m.value;if(m.key==="Device"){let y=o[g]||g;g=FW(m.key,y,m.keyVisible,m.valueVisible)}else if(m.key==="Footprint"){let y=t[g]||g;g=FW(m.key,y,m.keyVisible,m.valueVisible)}else if(m.key==="Name"){let y=new Map;if(m.parentId){y.set("ID",m.parentId);let b=(n=(i=r.cData)==null?void 0:i[u])==null?void 0:n[m.parentId];if(b){let P=JSON.parse(b);if(Object.entries(P.attrs).forEach(T=>y.set(T[0],T[1])),(s=c==null?void 0:c[u])!=null&&s[m.parentId]){let T=(a=c==null?void 0:c[u])==null?void 0:a[m.parentId],I=e[T];I&&Object.entries(I).forEach(C=>y.set(C[0],C[1]))}}}g=FW(m.key,Qpt(g,y),m.keyVisible,m.valueVisible)}else g=FW(m.key,g,m.keyVisible,m.valueVisible);g&&l.fonts.add(JP(g,m.fontFamily,m.fontSize/10,m.strokeWidth,m.bold,m.italic,m.reverse,m.expansion))}return l}static footprint(o){let t={blobs:new Set,fonts:new Set};for(let e in o.oData)for(let r in o.oData[e]){let i=o.oData[e][r];if(!i)continue;let n=JSON.parse(i);n.path&&n.path.startsWith("blob:")&&t.blobs.add(n.path.split("blob:").pop())}for(let e in o.stringData)for(let r in o.stringData[e]){let i=o.stringData[e][r];if(!i)continue;let n=JSON.parse(i);n.fontFamily==="default"||!n.text||t.fonts.add(JP(n.text,n.fontFamily,n.fontSize/10,n.strokeWidth,n.bold,n.italic,n.reverse,n.expansion))}for(let e in o.dData)for(let r in o.dData[e]){let i=o.dData[e][r];if(!i)continue;let n=JSON.parse(i).text;n.fontFamily==="default"||!n.text||t.fonts.add(JP(n.text,n.fontFamily,n.fontSize/10,n.strokeWidth,n.bold,n.italic,n.reverse,n.expansion))}for(let e in o.attrData)for(let r in o.attrData[e]){let i=o.attrData[e][r];if(!i)continue;let n=JSON.parse(i);if(n.fontFamily==="default"||!n.value)continue;let s=FW(n.key,n.value,n.keyVisible,n.valueVisible);t.fonts.add(JP(s,n.fontFamily,n.fontSize/10,n.strokeWidth,n.bold,n.italic,n.reverse,n.expansion))}return t}static panel(o){let t={blobs:new Set};for(let e in o.oData)for(let r in o.oData[e]){let i=o.oData[e][r];if(!i)continue;let n=JSON.parse(i);n.fillColor&&n.fillColor.startsWith("blob:")&&t.blobs.add(n.fillColor.split("blob:").pop())}return t}static sheet(o,t){let e={devices:new Set,symbols:new Set,footprints:new Set,blobs:new Set};for(let r in o.oData)for(let i in o.oData[r]){let n=o.oData[r][i];if(!n)continue;let s=JSON.parse(n);s.content&&s.content.startsWith("blob:")&&e.blobs.add(s.content.split("blob:").pop())}for(let r in o.attrData)for(let i in o.attrData[r]){let n=o.attrData[r][i];if(!n)continue;let s=JSON.parse(n);if(s.value)switch(s.key){case"Device":{e.devices.add(s.value);break}case"Symbol":{e.symbols.add(s.value),t&&(t[s.value]=s.parentId);break}case"Footprint":{e.footprints.add(s.value),t&&(t[s.value]=s.parentId);break}}}return{dataSet:e,parentIds:t}}static symbol(o){let t={blobs:new Set};for(let e in o.oData)for(let r in o.oData[e]){let i=o.oData[e][r];if(!i)continue;let n=JSON.parse(i);n.content&&n.content.startsWith("blob:")&&t.blobs.add(n.content.split("blob:").pop())}return t}};function e0t(o,t){return o.ticket===t.ticket?o.client===t.client?o.id===t.id?0:o.id<t.id?-1:1:o.client<t.client?-1:1:o.ticket<t.ticket?-1:1}var I6e=class{constructor(o=1){this.startNum=o,this.orderLists={},this.idOrderLists={},this.cbArr=new Array,this.maxNum={}}orderChange(o){this.cbArr.push(o)}setOrderNum(o,t,e,r,i=1){if(i<1)throw new Error("step must be greater than 0");let n=zL(this.orderLists,t,()=>new hPe(e0t)),s=zL(this.maxNum,t,()=>this.startNum-1),a=zL(this.idOrderLists,t,()=>new Map),l=a.get(o);if(l){if(l.ticket<=e)return;n.remove(l),s-=l.step}let c={id:o,ticket:e,num:0,client:r,step:i};a.set(o,c),n.insert(c),s+=i;let h=s,u=0;n.backwardTraverse(d=>(u++,d.num=h,this.cbArr.forEach(p=>p(d.id,t,d.num)),h-=d.step,d!==c)),this.maxNum[t]=s,u>1e4&&(console.log("------------------ notify --------",c,"height: ",n.getHeight(),"total: ",n.getSize(),"notifies: ",u),console.log("------------------ all --------"))}getOrderNum(o,t){var e,r,i,n;return(n=(i=(r=(e=this.idOrderLists)==null?void 0:e[t])==null?void 0:r.get)==null?void 0:i.call(r,o))==null?void 0:n.num}getMaxNum(o){var t;return((t=this.orderLists[o])==null?void 0:t.getSize())||0}clearNum(){for(let o in this.idOrderLists)this.idOrderLists[o].clear(),delete this.idOrderLists[o];for(let o in this.orderLists)delete this.orderLists[o]}},t0t=class{constructor(o,t=1,e=[]){this.consistencyManager=o,this.startNum=t,this.needOrderType=e,this.initIng=!1,this.allOrderNum={},this.maxNum={},this.consistencyManager.onChange((r,i,n,s,a,l,c,h,u,d,p,m)=>{try{if(this.calculation)if(s==="ELE_PLACEHOLDER"){let g=n?JSON.parse(n):null;g&&this.calculation.setOrderNum(i,g.dataType,c!=null?c:l,a,g.max)}else this.calculation.setOrderNum(i,s,c!=null?c:l,a);this.onParseLine(i,s,n?JSON.parse(n):null,a,l,h,m)}catch(g){console.error(g)}})}initCalculation(){this.calculation=new I6e(this.startNum)}setIsInit(o){this.initIng=o}setNeedNum(o){this.needNum=o}setOrderNum(o,t,e){this.needNum&&this.needOrderType&&this.needOrderType.includes(e)&&t!==void 0&&(this.allOrderNum[o]=t,this.setMaxNum(e,t))}deleteOrderNum(o){delete this.allOrderNum[o]}getOrderNum(o){return this.allOrderNum[o]}setMaxNum(o,t,e){(e||this.maxNum[o]===void 0||this.maxNum[o]<t)&&(this.maxNum[o]=t)}getMaxNum(o){return this.maxNum[o]===void 0&&(this.maxNum[o]=this.startNum-1),++this.maxNum[o]}},r0t=Object.create(null),i0t=class extends xPe{constructor(o){super(o),this.creators={},this.headCbArr=[],this.docHead={},this.historyDocHead={},this.uniqueIds={},this.cacheType=["META","DELETE_DOC","ELE_PLACEHOLDER","META_PLACEHOLDER","VARIANT_GROUPED"],this.docIds=new I6e,this.needDocIdDoctype=["PANEL","PCB","SCH_PAGE","SCH","SIMULATION"],this.historyMap={},this.clearTime=null,this.currentTime=0,this.wDocData=new Map,this.orderTree=new Gpt(this.wDocData)}onLine(o,t,e,r,i,n,s,a,l,c,h,u,d){this.remoteChange(t,i,s,o,e,r,n,void 0,a,l,c,void 0,void 0,void 0,d)}onDocHead(o,t,e,r){r&&o!=null&&o.uuid&&o!=null&&o.updateTime&&(this.historyDocHead[r.uuid]||(this.historyDocHead[r.uuid]={}),(!this.historyDocHead[r.uuid][o.uuid]||this.historyDocHead[r.uuid][o.uuid].updateTime<o.updateTime)&&(this.historyDocHead[r.uuid][o.uuid]=o)),o.updateTime=o.updateTime||(t==null?void 0:t.updateTime),o.user=o.user||{uuid:t==null?void 0:t.uuid,username:t==null?void 0:t.username,nickname:t==null?void 0:t.nickname},this.setMaxTicket(o.ticket),this.docHead[o.uuid]?(!this.docHead[o.uuid].updateTime||this.docHead[o.uuid].updateTime<o.updateTime)&&(this.docHead[o.uuid].client=o.uuid,this.docHead[o.uuid].user=o.user,this.docHead[o.uuid].updateTime=o.updateTime,this.docHead[o.uuid].version=o.version,this.docHead[o.uuid].docType=o.docType,this.docHead[o.uuid].uuid=o.uuid,this.docHead[o.uuid].editVersion=o.editVersion,o.ticket&&o.ticket>this.docHead[o.uuid].ticket&&(this.docHead[o.uuid].ticket=o.ticket)):this.docHead[o.uuid]=o,this.creators[o.uuid]?this.creators[o.uuid].createTime>o.updateTime&&(this.creators[o.uuid].createTime=o.updateTime,this.creators[o.uuid].creator=o.user):this.creators[o.uuid]={createTime:o.updateTime,creator:o.user};for(let i of this.headCbArr)i(o,t)}onHeadChange(o){this.headCbArr.push(o)}setCacheData(o){this.getCache=o}setDoctype(o,t){this.docHead[o]?this.docHead[o].docType=t:this.docHead[o]={docType:t}}getDoctype(o){var t,e;return(e=(t=this.docHead)==null?void 0:t[o])==null?void 0:e.docType}getDataTicket(o,t){var e,r,i,n,s,a;return(a=(s=(n=(i=(r=(e=this.wDocData)==null?void 0:e.get)==null?void 0:r.call(e,o))==null?void 0:i.get)==null?void 0:n.call(i,t))==null?void 0:s.last)==null?void 0:a.ticket}getDataClient(o,t){var e,r,i,n,s,a;return(a=(s=(n=(i=(r=(e=this.wDocData)==null?void 0:e.get)==null?void 0:r.call(e,o))==null?void 0:i.get)==null?void 0:n.call(i,t))==null?void 0:s.last)==null?void 0:a.client}getAtomData(o,t){var e,r,i,n,s;return(s=(n=(i=(r=(e=this.wDocData)==null?void 0:e.get)==null?void 0:r.call(e,o))==null?void 0:i.get)==null?void 0:n.call(i,t))==null?void 0:s.last}getDataSize(o,t){var e,r,i,n;return Il.getLength((n=(i=(r=(e=this.wDocData)==null?void 0:e.get)==null?void 0:r.call(e,o))==null?void 0:i.get)==null?void 0:n.call(i,t))}getFirst(o,t){var e,r,i,n,s;let a=(n=(i=(r=(e=this.wDocData)==null?void 0:e.get)==null?void 0:r.call(e,o))==null?void 0:i.get)==null?void 0:n.call(i,t);return((s=a==null?void 0:a.list)==null?void 0:s[0])||a.last}getFirstTicket(o,t){var e,r;return Il.getFirstTicket((r=(e=this.wDocData.get(o))==null?void 0:e.get)==null?void 0:r.call(e,t))}getAllDataId(o){let t=[],e=o||this.wDocData.keys();for(let r of e){let i={doc:r,ids:[]},n=this.wDocData.get(r);if(n){for(let[s]of n)i.ids.push(s);i.ids.length&&t.push(i)}}return t}clear(){for(let[,o]of this.wDocData)o.clear();this.wDocData.clear(),this.creators={}}isHasData(o){if(o){if(this.uniqueIds[o]){for(let t in this.uniqueIds[o])if(this.uniqueIds[o][t].size)return!0}}else for(let[,t]of this.wDocData)for(let[,,]of t)return!0;return!1}delayClear(o=!0){this.clearTime||(this.clearTime=setTimeout(()=>{if(Date.now()-this.currentTime<5e3)this.clearTime=null,this.delayClear(!1);else{let t=!1;for(let e in this.historyMap)for(let r in this.historyMap[e])for(let i in this.historyMap[e][r])for(let n in this.historyMap[e][r][i])this.historyMap[e][r][i][n].promise?(this.clearTime=null,this.delayClear(!1),t=!0):(this.historyMap[e][r][i][n].cache.end(),this.historyMap[e][r][i][n].cache=null,delete this.historyMap[e][r][i][n]);!t&&(this.clearTime=null)}},5e3)),o&&(this.currentTime=Date.now())}getForeachKeys(o){let t=this.wDocData.keys(),e=[],r=[],i=[],n=[],s=[],a=[],l=[],c=[],h=[];for(let u of t)switch(this.getDoctype(u)){case"DEVICE":e.push(u);break;case"FOOTPRINT":i.push(u);break;case"SYMBOL":r.push(u);break;case"BOARD":n.push(u);break;case"SCH":s.push(u);break;case"SCH_PAGE":a.push(u);break;case"PCB":l.push(u);break;case"FONT":case"BLOB":h.push(u);break;default:c.push(u);break}return[...i,...r,...e,...n,...s,...a,...l,...c,...h]}getLastData(o,t,e){let r=this.wDocData.get(o);if(!r)return;let i=r.get(t);if(!i)return;let n=null;return Il.preForEach(i,s=>!!s.pend==!!e?(n=s,!0):!1),n}revoke(){return!1}getPublishRevoke(o){let t={},e=(n,s,a,l,c,h,u)=>{var d,p,m;let g;u.length&&Il.getLength(c)===u.length&&this.orderTree.has(n)&&(this.orderTree.removeNode(n,this.getDoctype(n),s),g=(m=(p=(d=this.orderTree.numSets)==null?void 0:d[n])==null?void 0:p.maxNum)==null?void 0:m[l.dataType],delete c.num),o&&o(n,s,h||"",a?a.client:l.client,a?a.ticket:l.ticket,l.client,l.ticket,a?a.pend:void 0,a?a.dataType:l.dataType,Il.getFirstTicket(c),g),u.forEach(y=>Il.remove(c,y))},r=(n,s,a,l,c,h)=>{var u;if(!this.getCache||!c||(u=c.data)!=null&&u.length||c.data===""||!c.hId)e(n,s,c,l,a,c==null?void 0:c.data,h);else{let d=c.dNum||0;t[c.hId]||(t[c.hId]={}),t[c.hId][c.hNum]||(t[c.hId][c.hNum]={}),t[c.hId][c.hNum][n]||(t[c.hId][c.hNum][n]=[]),t[c.hId][c.hNum][n][d]||(t[c.hId][c.hNum][n][d]=[]),t[c.hId][c.hNum][n][d].push([s,a,l,c,h])}},i=async(n,s,a,l,c)=>{let h=this.getCache(),u=QW(a,this.getDoctype(a));await h.init(n,s,u,l);for(let d of c){let[p,m,g,y,b]=d;if(m.last===g){let P=h.get(y.start);e(a,p,y,g,m,P,b)}else b.forEach(P=>Il.remove(m,P))}};return{update:r,end:()=>{if(this.getCache){for(let n in t)for(let s in t[n])for(let a in t[n][s])for(let l in t[n][s][a])i(n,s,a,l,t[n][s][a][l]);t=null}}}}handleRevoke(o,t,e,r,i,n){let s=[];Il.preForEach(e,a=>{if(a.pend&&(!i||a.client===i)){if(s.push(a),a===e.last){let l=Il.getPreNode(e,a);if(n)for(;l&&l.pend;)s.push(l),l=Il.getPreNode(e,l);r.update(o,t,e,a,l,s)}else s.forEach(l=>Il.remove(e,l));return!0}return!1}),Il.getLength(e)||this.wDocData.get(o).delete(t)}revokeOne(o,t,e){let r=this.wDocData.get(o);if(!r)return;let i=r.get(t);i&&this.handleRevoke(o,t,i,e)}foreachRevokeAll(o,t=this.getClient()){let e=this.getForeachKeys(),r=this.getPublishRevoke(o);for(let i of e){let n=this.wDocData.get(i);for(let[s,a]of n)this.handleRevoke(i,s,a,r,t,!0)}r.end()}getUniqueDocs(o,t={}){if(!this.uniqueIds[o])return t;for(let e in this.uniqueIds[o]){let r=t[e]||new Set;for(let i of this.uniqueIds[o][e])r.add(i);t[e]=r}return t}revokeByUnique(o,t,e){let r=this.uniqueIds[o];if(r)for(let i in r)this.revokeAll(i,t,Array.from(r[i]),e),r[i].clear()}revokeAll(o,t,e,r){let i=this.wDocData.get(o);if(!i)return;let n=this.getPublishRevoke(r);for(let s of e){let a=i.get(s);a&&this.handleRevoke(o,s,a,n,t)}n.end()}findPreDataByTime(o,t,e,r,i){let n=this.wDocData.get(o);if(!n)return null;let s=n.get(t);if(!s)return null;let a=null,l=0;return Il.preForEach(s,c=>{let h=i(c==null?void 0:c.hId,c==null?void 0:c.hNum);return h&&(h<e||h===e&&c.client<r)&&(a?(h>l||h===l&&c.client>a.client)&&(a=c,l=h):(a=c,l=h)),!1}),a}isFilterData(o,t,e){return!!(!o||t.ignoreType&&t.ignoreType.includes(o.dataType)||t.needType&&!t.needType.includes(o.dataType)||t.isPend&&!o.pend||e&&!t.needDelete&&t.needNum&&o.data==="")}getCanvasIds(o){var t;let e=0,r={},i={},n=[],s=[],a=10*1024*1024,l=0,c=(d,p,m)=>{var g;let y=m.last;if(y.pend||(g=y.data)!=null&&g.length){l+y.data.length>a&&(n.push(s),s=[]);let b=[d,p,y.ticket,y.client,y.dataType,y.data,y.pend];o.needNum&&b.push(m.num),s.push(b);return}r[d][y.client]||(r[d][y.client]={}),r[d][y.client][p]=[y.ticket],o.needNum&&r[d][y.client][p].push(m.num),e+=1},h=d=>{let p=d.last;return!!(o.ignoreType&&o.ignoreType.includes(p.dataType)||p.dataType==="ELE_PLACEHOLDER"||!o.needDelete&&p.data==="")};for(let d of o.doc){let p=(t=this.wDocData)==null?void 0:t.get(d);if(!p)continue;r[d]={};let m=this.getDoctype(d);if(o.needNum&&!["BLOB"].includes(m)&&!this.orderTree.has(d)){this.orderTree.add(d);let g=Array.from(p.keys()).sort((y,b)=>{let P=Il.getHead(p.get(y)),T=Il.getHead(p.get(b)),I=P.firstTicket||P.ticket,C=T.firstTicket||T.ticket;return I===C?P.client>T.client?1:-1:I-C});for(let y of g){let b=p.get(y);b&&(b.num&&(b.num=void 0),this.orderTree.setOrderNum(d,m,y,b,!1),!h(b)&&c(d,y,b))}}else for(let[g,y]of p)h(y)||c(d,g,y);i[d]=this.orderTree.getMaxNum(d)}s.length&&(n.push(s),s=null);let u;return n.length&&(u=Jm(),(0,Upt.flowWrite)(u,async d=>{for(let p of n)await d.write(JSON.stringify(p)),p.length=0;n.length=0},void 0,void 0)),{ids:r,maxNum:i,size:e,channel:u}}async getCacheData(o,t,e,r){var i,n,s,a,l;let c=o.data;if(this.getCache&&o.hId&&o.data===void 0){let h=o.dNum||0,u=QW(t,e);if(!((l=(a=(s=(n=(i=this.historyMap)==null?void 0:i[o.hId])==null?void 0:n[o.hNum])==null?void 0:s[u])==null?void 0:a[h])!=null&&l.cache)){this.historyMap[o.hId]||(this.historyMap[o.hId]={}),this.historyMap[o.hId][o.hNum]||(this.historyMap[o.hId][o.hNum]={}),this.historyMap[o.hId][o.hNum][u]||(this.historyMap[o.hId][o.hNum][u]={}),this.historyMap[o.hId][o.hNum][u][h]||(this.historyMap[o.hId][o.hNum][u][h]={cache:null,promise:null});let d=this.getCache();this.historyMap[o.hId][o.hNum][u][h].cache=d;let p=d.init(o.hId,o.hNum,u,h);this.historyMap[o.hId][o.hNum][u][h].promise=p,await p,delete this.historyMap[o.hId][o.hNum][u][h].promise}this.historyMap[o.hId][o.hNum][u][h].promise&&await this.historyMap[o.hId][o.hNum][u][h].promise,c=this.historyMap[o.hId][o.hNum][u][h].cache.get(o.start)}if(c===void 0)throw new Error(`\u83B7\u53D6\u7F13\u5B58\u6570\u636E\u5931\u8D25: hid=${o.hId}, hNum=${o.hNum}, start=${o.start}, docId=${t}`);r(c)}async compress(o,t,e){var r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v,D,w,F,H,z,G;let{updateTime:W,versions:L,keepClient:B,keepFirst:N,notDocHead:U,isPend:k,user:V}=o,{headTicket:Y,clearDelete:X,needNum:Z,uniqueId:Q,client:ae,extractData:he}=o,{removeBoard:re,eIds:se,notChangePend:K}=o,me=o.docIds||(se?[]:void 0),Oe=X&&!!he;if(Q&&this.uniqueIds[Q]&&(me=Object.keys(this.uniqueIds[Q]),o.docIds&&(me=me.filter(oe=>o.docIds.includes(oe)))),me||(me=this.getForeachKeys(Oe)),se)for(let oe in se)me.some(pe=>pe===oe)||me.push(oe);let Ie,ue;Oe&&(Ie=new Set,ue=new Set);let Pe="",j=async oe=>{if(Pe){let pe=Pe;Pe="",e(pe.length)?await t(pe,!0):t(pe,!0)}e(oe.length)?await t(oe):t(oe)},J=oe=>(Pe&&(oe+=2+Pe.length),e(oe));for(let oe of me){Pe="";let pe=(r=this.wDocData)==null?void 0:r.get(oe);if(!pe){Z&&!["FONT","BLOB"].includes(oe)&&!this.orderTree.has(oe)&&this.orderTree.add(oe);continue}let ge=W||((n=(i=this.docHead)==null?void 0:i[oe])==null?void 0:n.updateTime)||new Date().getTime(),Se=(L==null?void 0:L[oe])||((a=(s=this.docHead)==null?void 0:s[oe])==null?void 0:a.version)||String(ge),De=this.getDoctype(oe);if(X){let Dr=pe.get("DELETE_DOC");if(Dr&&Dr.last.data&&(l=JSON.parse(Dr.last.data))!=null&&l.isDelete){if(Vpt.includes(De)){let Rr=pe.get("META"),ke=Rr?JSON.parse(Rr.last.data):null,Yt=!!ke;if(De==="SCH_PAGE"&&Yt){let Ut=(c=this.wDocData)==null?void 0:c.get(ke.schematic),ar=(u=(h=Ut.get("DELETE_DOC"))==null?void 0:h.last)==null?void 0:u.data;Yt=Ut&&(!ar||ar&&!((d=JSON.parse(ar))!=null&&d.isDelete))}if(Yt){Pe=zv(((m=(p=this.docHead)==null?void 0:p[oe])==null?void 0:m.docType)||this.mainDocType,ae||this.getClient(),oe,ge,Se,V||((y=(g=this.docHead)==null?void 0:g[oe])==null?void 0:y.user),Y||((P=(b=this.docHead)==null?void 0:b[oe])==null?void 0:P.ticket));let Ut=nm("DELETE_DOC",Il.getFirstTicket(Dr),"DELETE_DOC",Dr.last.data);if(J(Ut.length)?await j(Ut):j(Ut),Rr){if(De==="SCH_PAGE"){for(let[Fe,it]of pe)if(it.last.dataType==="META_PLACEHOLDER"&&it.last.data){let ye=nm("META_PLACEHOLDER",Il.getFirstTicket(it),ke.schematic,it.last.data);J(ye.length)?await j(ye):j(ye)}}let ar=nm("META",Il.getFirstTicket(Rr),"META",Rr.last.data);J(ar.length)?await j(ar):j(ar)}}}continue}}let tt;if(oe==="FONT"&&Ie){tt=[];for(let Dr of Ie)tt.push(uPe(Dr))}U||(Pe=zv(((I=(T=this.docHead)==null?void 0:T[oe])==null?void 0:I.docType)||this.mainDocType,ae||this.getClient(),oe,ge,Se,V||((E=(C=this.docHead)==null?void 0:C[oe])==null?void 0:E.user),Y||((_=(O=this.docHead)==null?void 0:O[oe])==null?void 0:_.ticket),Q||(v=(R=this.docHead)==null?void 0:R[oe])==null?void 0:v.editVersion),Q&&this.onDocHead({docType:((w=(D=this.docHead)==null?void 0:D[oe])==null?void 0:w.docType)||this.mainDocType,uuid:oe,client:ae||this.getClient(),updateTime:ge,version:Se,user:V||((H=(F=this.docHead)==null?void 0:F[oe])==null?void 0:H.user),ticket:Y||((G=(z=this.docHead)==null?void 0:z[oe])==null?void 0:G.ticket),editVersion:self==null?void 0:self.PRO_EDITOR_VERSION}));let Ze;if(Q&&(Ze=Array.from(this.uniqueIds[Q][oe]),this.uniqueIds[Q][oe].clear(),delete this.uniqueIds[Q][oe]),se&&se[oe]&&(Ze=se[oe]),Ze||(Ze=Z||X?Array.from(pe.keys()).sort((Dr,Rr)=>{let ke=Il.getHead(pe.get(Dr)),Yt=Il.getHead(pe.get(Rr)),Ut=ke.firstTicket||ke.ticket,ar=Yt.firstTicket||Yt.ticket;return Ut===ar?ke.client>Yt.client?1:-1:Ut-ar}):Array.from(pe.keys())),Z&&!["FONT","BLOB"].includes(De)&&!this.orderTree.has(oe)){this.orderTree.add(oe);for(let Dr of Ze){let Rr=pe.get(Dr);Rr&&(this.isFilterData(Rr.last,o,!1)||(Rr.num&&(Rr.num=void 0),this.orderTree.setOrderNum(oe,De,Dr,Rr,!1)))}}let Wt={},Nr=0,Lr=PS.getInitProps();for(let Dr of Ze){let Rr=pe.get(Dr);if(!Rr)continue;let ke;if(Q?Il.preForEach(Rr,it=>it.unique===Q?(ke=it,delete it.unique,K||(delete it.pend,this.setDocMaxTicket(oe,it.ticket,it.pend),it===Rr.last&&this.cbArr.forEach(ye=>ye(oe,Dr,it.data,it.dataType,it.client,it.ticket,Il.getFirstTicket(Rr),void 0,void 0,!0,void 0))),!0):!1):ke=Rr.last,this.isFilterData(ke,o,!0))continue;if(Oe&&oe==="FONT"&&tt){let it=uPe(Dr);if(!tt.some(ye=>Jpt(it,ye)))continue}if(Oe&&oe==="BLOB"&&!ue.has(Dr))continue;if(k&&ke.pend&&!K&&(delete ke.pend,this.setDocMaxTicket(oe,ke.ticket,!1),this.cbArr.forEach(it=>it(oe,Dr,ke.data,ke.dataType,ke.client,ke.ticket,Il.getFirstTicket(Rr),void 0,void 0,!0,void 0))),X){if(ke.dataType==="ELE_PLACEHOLDER"){let ye=JSON.parse(ke.data);Wt[ye.dataType]===void 0?Wt[ye.dataType]=ye.max:Wt[ye.dataType]+=ye.max;continue}let it=T6e(De);if(it&&it.includes(ke.dataType))if(ke.data!==""){if(Wt[ke.dataType]){let ye={dataType:ke.dataType,max:Wt[ke.dataType]},bt=nm("ELE_PLACEHOLDER",Il.getFirstTicket(Rr)-1,`placeholder${++Nr}`,JSON.stringify(ye));J(bt.length)?await j(bt):j(bt),delete Wt[ke.dataType]}}else{Wt[ke.dataType]===void 0?Wt[ke.dataType]=1:++Wt[ke.dataType];continue}}let Yt,Ut=this.getCacheData(ke,oe,De,it=>Yt=it);if(Yt===void 0&&await Ut,ke.dataType==="META"&&re&&re.includes(oe)&&Yt){let it=JSON.parse(Yt);it.board&&(it.board="",Yt=JSON.stringify(it))}let ar=Il.getFirstTicket(Rr),Fe=nm(ke.dataType,ke.ticket,Dr,Yt,B?ke.client:void 0,N&&ke.ticket!==ar?ar:void 0,void 0,Z?Rr.num:void 0);if(Oe)switch(De){case"PCB":{PS.collectPcb(oe,Dr,ke.dataType,Yt,Lr);break}case"FOOTPRINT":{PS.collectFt(oe,Dr,ke.dataType,Yt,Lr);break}case"PANEL":{PS.collectPanel(oe,Dr,ke.dataType,Yt,Lr);break}case"SYMBOL":{PS.collectSymbol(oe,Dr,ke.dataType,Yt,Lr);break}case"SCH_PAGE":case"SIMULATION":{PS.collectSymbol(oe,Dr,ke.dataType,Yt,Lr);break}default:break}J(Fe.length)?await j(Fe):j(Fe)}if(Z){let Dr=nm("MAX_NUM",1,"MAX_NUM",JSON.stringify(this.orderTree.getMaxNum(oe)));J(Dr.length)?await j(Dr):j(Dr)}if(Oe){let Dr;switch(De){case"PCB":{Dr=PS.pcb(he.deviceNames,he.footprintNames,he.deviceAttrs,Lr);break}case"FOOTPRINT":{Dr=PS.footprint(Lr);break}case"PANEL":{Dr=PS.panel(Lr);break}case"SYMBOL":{Dr=PS.symbol(Lr);break}case"SCH_PAGE":case"SIMULATION":{Dr=PS.sheet(Lr).dataSet;break}default:break}if(Dr!=null&&Dr.fonts)for(let Rr of Dr.fonts)Ie.add(Rr);if(Dr!=null&&Dr.blobs)for(let Rr of Dr.blobs)ue.add(Rr)}}}compressFull(o={}){if(this.getCache)throw new Error("\u6570\u636E\u5DF2\u7F13\u5B58\u5230 cacheStorage, \u4E0D\u5141\u8BB8\u540C\u6B65\u83B7\u53D6");let t=[],e=r=>{t.push(r)};return this.compress(o,e,()=>!1),t.join(`|
`)}async chunkCompressFull(o={}){let{chunkLength:t=20*1024*1024}=o,e=new Array,r=[],i=0,n="",s=l=>this.getCache?i+l>t:!1,a=async(l,c)=>{i+l.length>t&&(r.push(e.join(`|
`)),e.length=0,!c&&e.push(n),i=0),c&&(n=l),e.push(l),i+=l.length+2};return await this.compress(o,a,s),e.length>0&&(r.push(e.join(`|
`)),e.length=0,i=0),this.getCache&&this.delayClear(),r}async createSnap(o,t,e,r,i=20*1024*1024){var n,s,a,l,c,h,u,d,p,m;let g=0,y=new Set;for(let[,O]of this.wDocData){g+=150;for(let[_,R]of O)Il.preForEach(R,v=>{var D;if(v.hId&&o.has(v.hId)){y.add(v.hId);let w=Il.getFirstTicket(R),F=v.ticket!==w&&v.firstTicket!==w?15+w.toString().length:0,H=v.hClient?0:28;return g+=(v.size||((D=v.data)==null?void 0:D.length)||0)+2+F+H,!0}return!1})}if(y.size!==o.size)throw new Error("\u65E0\u6CD5\u521B\u5EFA\u5FEB\u7167\uFF1Ahid \u8282\u70B9\u4E0D\u4E00\u81F4\uFF01\uFF01\uFF01");await t(g);let b=[],P=0,T=!1,I="",C=O=>P+O>i,E=async(O,_)=>{P+O.length>i&&(T=!0,await e(b.join(`|
`)),b.length=0,P=0,!_&&b.push(I)),_&&(I=O),b.push(O),P+=O.length+2};for(let[O,_]of this.wDocData){let R=((s=(n=this.docHead)==null?void 0:n[O])==null?void 0:s.updateTime)||new Date().getTime(),v=((l=(a=this.docHead)==null?void 0:a[O])==null?void 0:l.version)||String(R),D=this.getDoctype(O),w=r(O),F=zv(((h=(c=this.docHead)==null?void 0:c[O])==null?void 0:h.docType)||D,this.getClient(),O,(w==null?void 0:w.updateTime)||R,(w==null?void 0:w.version)||v,(w==null?void 0:w.user)||((d=(u=this.docHead)==null?void 0:u[O])==null?void 0:d.user),(w==null?void 0:w.ticket)||((m=(p=this.docHead)==null?void 0:p[O])==null?void 0:m.ticket));for(let[H,z]of _)await Il.awaitPreForEach(z,async(G,W)=>{if(G.hId&&o.has(G.hId)){F&&(C(F.length)?await E(F,!0):E(F,!0),F="");let L,B=this.getCacheData(G,O,D,k=>L=k);L===void 0&&await B;let N=Il.getFirstTicket(z),U=nm(G.dataType,G.ticket,H,L,G.client,G.ticket!==N?N:void 0);C(U.length)?await E(U):E(U),W(!0)}else W(!1)})}if(b.length>0&&(T=!0,await e(b.join(`|
`)),b.length=0,P=0),!T)throw new Error("\u65E0\u6CD5\u521B\u5EFA\u5FEB\u7167\uFF1A\u672A\u751F\u6210\u4EFB\u4F55\u6570\u636E")}async asyncCompressFull(o={}){let t=[],e=r=>{t.push(r)};return await this.compress(o,e,()=>!1),this.delayClear(),t.join(`|
`)}async flowCompressFull(o){let{writer:t,chunkLength:e=1e7}=o,r=new Array,i=0,n=!1,s=l=>i+l>e,a=async l=>{i+l.length>e&&(n=!0,await t(r.join(`|
`)),r.length=0,r.push(""),i=0),r.push(l),i+=l.length+2};await this.compress(o,a,s),r.length>0&&(n=!0,await t(r.join(`|
`)),r.length=0,i=0),n||await t(""),this.delayClear()}removeCache(o){if(o)for(let t=0;t<o.length;t++)this.wDocData.delete(o[t]);else this.wDocData.clear()}setMainDoctype(o){this.mainDocType=o}onChange(o){this.cbArr.push(o)}localChange(o,t,e,r,i){let n=this.getMaxTicket()+1;return this.remoteChange(n,this.getClient(),o,t,e,r,i,!0,void 0,!0,void 0,this.getUnique()),n}safeString(o){return o&&(o in r0t,o)}remoteChange(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m){var g,y,b,P,T;this.setMaxTicket(o),s&&this.setDoctype(e,s),s=this.getDoctype(e),a=a||u===this.getUnique();let I=(P=(b=(y=(g=this.wDocData)==null?void 0:g.get)==null?void 0:y.call(g,e))==null?void 0:b.get(r))==null?void 0:P.last;u&&(this.uniqueIds[u]||(this.uniqueIds[u]={}),this.uniqueIds[u][e]||(this.uniqueIds[u][e]=new Set),this.uniqueIds[u][e].add(r)),this.wDocData.get(e)||this.wDocData.set(e,new Map),this.wDocData.get(e).has(r)||this.wDocData.get(e).set(r,{last:null});let C=this.wDocData.get(e).get(r),E=I?Il.getFirstTicket(C):null,O=I&&I.ticket===o&&I.client===t&&!!I.pend!=!!c,_=n!=="ELE_PLACEHOLDER"&&n!=="META_PLACEHOLDER"&&(!a||a&&this.getIsLocalChange())&&(!O||O&&this.getIsPendChange()),R=Il.find(C,H=>H.client===t&&H.ticket===o);if(R){this.setDocMaxTicket(e,o,c),m&&(R.hId=m.uuid,R.hNum=m.num,R.start=m.start,m.size&&(R.size=m.size),m.hClient&&(R.hClient=m.hClient),m.dNum&&(R.dNum=m.dNum)),this.getCache&&!this.cacheType.includes(n)&&(T=R.data)!=null&&T.length&&R!=null&&R.hId&&delete R.data,R.pend&&!c&&(delete R.pend,_&&R===C.last&&this.cbArr.forEach(H=>H(e,r,i,n,t,o,Il.getFirstTicket(C),c,void 0,O,u)));return}let v=o;if(c){let H=[];Il.preForEach(C,z=>z.client===t&&z.pend&&z.ticket<o?(H.push(z),!0):!1),H.length&&H.length===Il.getLength(C)&&(v=E||o),H.forEach(z=>{Il.remove(C,z)})}let D={client:t,ticket:v,dataType:n};m&&(D.hId=m.uuid,D.hNum=m.num,D.start=m.start,m.size&&(D.size=m.size),m.hClient&&(D.hClient=m.hClient),m.dNum&&(D.dNum=m.dNum)),(!this.getCache||!D.hId||!i||this.cacheType.includes(n)||c)&&(D.data=c?i:this.safeString(i)),l!==void 0&&(D.firstTicket=l),c!==void 0&&(D.pend=c),u!==void 0&&(D.unique=u);let w=!I||I.ticket<o||I.ticket===o&&I.client<t;Il.insert(C,D);let F=this.getFirstTicket(e,r);if(this.orderTree.has(e)&&(!I||E>F))try{this.orderTree.setOrderNum(e,this.getDoctype(e),r,C,!0,E&&E>F)}catch(H){console.error(H)}if(this.needDocIdDoctype.includes(s)&&(!I||E>F)&&i)if(s==="SCH_PAGE"&&n==="META_PLACEHOLDER"){let H=JSON.parse(i),z=r.split("_"),G=r.split("_")[0],W=z[1]?z[1]:G;this.docIds.setOrderNum(W,G,F,t,H.max)}else if(s==="SCH_PAGE"&&n==="META"){let H=JSON.parse(i);this.docIds.setOrderNum(e,H.schematic,F,t)}else n==="META"&&this.docIds.setOrderNum(e,s,F,t);if(this.setDocMaxTicket(e,v,c),w){let H=Il.getFirstTicket(C);_&&this.cbArr.forEach(z=>z(e,r,i,n,t,o,H,c,void 0,O,u))}}};function C6e(o){switch(o=String(o),o){case"1":return"SAFE";case"2":return"OTHER";case"3":return"TRACK";case"4":return"BLIND";case"5":return"RADIUS";case"6":return"PLANE";case"7":return"COPPER";case"8":return"PASTE";case"9":return"SOLDER";case"10":return"DIFFER_ENTAIL";case"11":return"NET_LENGTH";case"12":return"AUTO_ROUTER";case"13":return"NET_LENGTH_TOLERANCE"}return o}function Ik(o){if(!o)return{};let t=["1","2","3","4","5","6","7","8","9","10","11","12","13"];for(let e of t)if(o.hasOwnProperty(e)){let r=o[e];delete o[e],o[C6e(e)]=r}return o}var x4e=class{constructor(){this.init=!1,this.defaultSafeData=null,this.defaultCopperSpace=null,this.defaultInnerSpace=null,this.copperChangeMap=new Map,this.innerChangeMap=new Map}addDefaultSafeSpaceData(o){this.init=!0,this.defaultSafeData=o}addDefaultCopperSpace(o,t){this.defaultCopperSpace={netClearance:o,boardClearance:t}}addDefaultInnerSpace(o,t){this.defaultInnerSpace={netClearance:o,boardClearance:t}}getNewDefaultData(o,t){if(o&&this.defaultSafeData==null||!o&&this.defaultInnerSpace==null)return null;let e=o?this.copperChangeMap.get(t):this.innerChangeMap.get(t);if(e==null)return null;let{netClearance:r,boardClearance:i}=e,n=this.defaultSafeData.safeSpacing[0].content,s=new Array(n.length);for(let a=0;a<n.length;a++)s[a]=Array.from(n[a]);return this.updateSafeData(s,r,i),s}fixSafeData(o){if(this.defaultCopperSpace!=null)for(let t of o.safeSpacing)this.updateSafeData(t.content,this.defaultCopperSpace.netClearance,this.defaultCopperSpace.netClearance)}updateSafeData(o,t,e){for(let r=0;r<o.length;r++){let i=o[r];for(let n=0;n<i.length;n++)r==7?n==11||n==8?i[n]=e:i[n]=t:n==7&&(r==11||r==8?i[n]=e:i[n]=t)}}addCopper2SafeChangeMap(o,t,e,r,i){this.copperChangeMap.set(o,{name:t,isDefault:e,netClearance:r,boardClearance:i})}addInner2SafeChangeMap(o,t,e,r,i){this.innerChangeMap.set(o,{name:t,isDefault:e,netClearance:r,boardClearance:i})}getSafeName4Copper(o){var t;return(t=this.copperChangeMap.get(o))==null?void 0:t.name}getSafeName4Plane(o){var t;return(t=this.innerChangeMap.get(o))==null?void 0:t.name}getDefaultCopper(){for(let[,o]of this.copperChangeMap)if(o.isDefault)return o.name;return null}getDefaultPlane(){for(let[,o]of this.innerChangeMap)if(o.isDefault)return o.name;return null}};function R4e(o,t){let e=o,r={TWO_LAYERS_BOARD:"JLCPCB Capability(Two Layers Board)",SINGLE_LAYER_BOARD:"JLCPCB Capability(Single Layer Board)",MULTIPLE_LAYERS_BOARD:"JLCPCB Capability(Multiple Layers Board)",HIGH_FREQUENCY_BOARD:"JLCPCB Capability(High Frequency Board)",ALUMINUM_SUBSTRATE_BOARD:"JLCPCB Capability(Aluminum Substrate Board)",COPPER_SUBSTRATE_BOARD:"JLCPCB Capability(Copper Substrate Board)"};if(e.length==8){Object.values(r).includes(t)&&(e[4][0]=11.811,e[5][4]=11.811),e.splice(1,0,e[1].slice(0));for(let n=2;n<e.length;n++)e[n].splice(1,0,e[n][1]);e.push([].concat(e[1][0],e.slice(1).map(n=>n[1])))}e[1].push(e[1][e[1].length-1]),e.splice(3,0,[...e[1]]),e.splice(4,0,[...e[2]]),e[1].pop();for(let n=5;n<e.length;n++)e[n].splice(3,0,e[n][1]),e[n].splice(4,0,e[n][2]);e[3][3]=e[1][1],e[4][3]=e[2][1],e[4][4]=e[2][2];let i=6;e.splice(7,0,new Array(7).fill(i));for(let n=7;n<e.length;n++)e[n].splice(7,0,i);return e}function n0t(o,t){let e=o[0],r=o[1],i=[],n="ALL";if(r instanceof Array){let s=R4e(r,t);i.push({layerId:1,isOpen:!0,content:s})}else{for(let s in r){let a=r[s],l=R4e(a,t);i.push({layerId:+s,isOpen:!0,content:l})}Object.keys(r).length>1&&(n="LAYERED")}return{unit:e,isForAll:n,safeSpacing:i}}function o0t(o){let t=o[0],e=o[1],r=o[2];isNaN(r)&&(r=0);let i=o[3];return isNaN(i)&&(i=11.8),{unit:t,deviceClearance:e,thru2SmdClearance:r,holeClearance:i}}function s0t(o){let t=o[0],e=o[1],r=!0,i=[];if(e instanceof Object)for(let n in e){let s=e[n];i.push({layerId:+n,stroMin:s[0],stroDef:s[1],stroMax:s[2]})}else i.push({layerId:1,stroMin:o[1],stroDef:o[2],stroMax:o[3]});return{unit:t,track:{isOpen:r,content:i}}}function a0t(o){return{unit:o[0],netLenMin:o[1],netLenMax:o[2]}}function l0t(o){return{unit:o[0],netLengthTolerance:o[1]}}function c0t(o){let t=o[0],e=o[1],r=!0,i=[],n=[],s=0;if(e instanceof Object)for(let a in e){let l=e[a],{stroke:c,spacing:h,lenTolerMax:u}=l;i.push({layerId:+a,stroMin:c[0],stroDef:c[1],stroMax:c[2]}),n.push({layerId:+a,spacMin:h[0],spacDef:h[1]}),s=u}else i.push({layerId:1,stroMin:o[1],stroDef:o[2],stroMax:o[3]}),n.push({layerId:1,spacMin:o[4],spacDef:o[5]}),s=o[7];return{unit:t,stroWidth:{isOpen:r,content:i},spacing:{isOpen:r,content:n},differPairLenTolerMax:s}}function h0t(o){let t=new Array;for(let e of o){let r=+e[1],i=+e[2];isNaN(r)||r<=0||isNaN(i)||i<=0||r===i||r===1&&i===2||r===2&&i===1||t.push({name:e[0],staLayerId:r,endLayerId:i,viaSizeRule:e[3]})}return{blinds:{content:t}}}function u0t(o){return{unit:o[0],minRadius:o[1],defRadius:o[2],maxRadius:o[3],minInner:o[4],defInner:o[5],maxInner:o[6]}}function d0t(o){let t=[{layerId:1,connType:vk(o[7]!==void 0?o[7]:o[3]),spoWidth:o[8]!==void 0?o[8]:o[4],spoSpac:o[9]!==void 0?o[9]:o[5],spoAng:o[10]?o[10]:o[6]}];return{unit:o[0],mulPad:{isOpen:!0,content:t}}}function p0t(o){let t=[{layerId:1,connType:vk(o[3]),spoWidth:o[4],spoSpac:o[5],spoAng:o[6]}],e=[{layerId:1,connType:Number(o[7])?"NON_CONNECT":"DIRECT"}],r=[{layerId:1,connType:vk(o[8]!==void 0?o[8]:o[3]),spoWidth:o[9]!==void 0?o[9]:o[4],spoSpac:o[10]!==void 0?o[10]:o[5],spoAng:o[11]?o[11]:o[6]}];return{unit:o[0],sglPad:{isOpen:!0,content:t},mulPad:{isOpen:!0,content:r},track:{isOpen:!0,content:e}}}function f0t(o){return{unit:o[0],padTopExpan:o[1],padBotExpan:o[2],testPointTopExpan:o[3]?o[3]:-1e3,testPointBotExpan:o[4]?o[4]:-1e3}}function m0t(o){return{unit:o[0],padTopExpan:o[1],padBotExpan:o[2],viaTopExpan:o[3],viaBotExpan:o[4],testPointTopExpan:o[5]?o[5]:2,testPointBotExpan:o[6]?o[6]:2}}function g0t(o){function t(i){switch(i=i&&Number(i),i){case 0:return"L45";case 1:return"L90";case 2:return"A90";default:return"L45"}}function e(i){switch(i=i&&Number(i),i){case 0:return"LESS";case 1:return"MID";case 2:return"MORE";default:return"LESS"}}function r(i){switch(i=i&&Number(i),i){case 0:return"SPEED_FIRST";case 1:return"COMPLETION_FIRST";default:return"COMPLETION_FIRST"}}return{routingCorner:t(o[0]),isKeep:!!o[1],viaQuantity:e(o[2]),routingEffectPriority:r(o[3]),layers:o[5],ignoreNets:o[6]}}function vk(o){switch(o=o&&Number(o),o){case 0:return"DIVERGENCE";case 1:return"DIRECT";case 2:return"NON_CONNECT";default:return null}}function y0t(o,t){let e=t;switch(o){case"SAFE":{let r=t;if(r.isForAll=r.isForAll?"LAYERED":"ALL",r.safeSpacing)for(let i of r.safeSpacing)i.isOpen=!!i.isOpen;e=r;break}case"OTHER":break;case"TRACK":{let r=t;r!=null&&r.track&&(r.track.isOpen=!!r.track.isOpen),e=r;break}case"NET_LENGTH":break;case"NET_LENGTH_TOLERANCE":break;case"DIFFER_ENTAIL":{let r=t;r!=null&&r.stroWidth&&(r.stroWidth.isOpen=!!r.stroWidth.isOpen),r!=null&&r.spacing&&(r.spacing.isOpen=!!r.spacing.isOpen),e=r;break}case"BLIND":break;case"RADIUS":break;case"PLANE":{let r=t;if(r!=null&&r.mulPad&&(r.mulPad.isOpen=!!r.mulPad.isOpen),r.mulPad&&r.mulPad.content)for(let i of r.mulPad.content)i.connType=vk(i.connType);e=r;break}case"COPPER":{let r=t;if(r!=null&&r.sglPad&&(r.sglPad.isOpen=!!r.sglPad.isOpen),r!=null&&r.mulPad&&(r.mulPad.isOpen=!!r.mulPad.isOpen),r!=null&&r.track&&(r.track.isOpen=!!r.track.isOpen),r.track&&r.track.content&&(r.track.content=r.track.content.map(i=>(i.connType=Number(i.connType)?"NON_CONNECT":"DIRECT",i))),r.sglPad&&r.sglPad.content)for(let i of r.sglPad.content)i.connType=vk(i.connType);if(r.mulPad&&r.mulPad.content)for(let i of r.mulPad.content)i.connType=vk(i.connType);e=r;break}case"PASTE":break;case"SOLDER":break;case"AUTO_ROUTER":break}return e}function b0t(o,t,e,r,i,n){if(!(r instanceof Array))return y0t(o,r);let s,a=!1;switch(e&&(e==="NORMAL"?a=!1:e==="DEFAULT"&&(a=!0)),o){case"SAFE":{s=n0t(r,n),a&&i.addDefaultSafeSpaceData(s);break}case"OTHER":{s=o0t(r);break}case"TRACK":{s=s0t(r);break}case"NET_LENGTH":{s=a0t(r);break}case"NET_LENGTH_TOLERANCE":{s=l0t(r);break}case"DIFFER_ENTAIL":{s=c0t(r);break}case"BLIND":{s=h0t(r);break}case"RADIUS":{s=u0t(r);break}case"PLANE":{let l=r[1],c=r[2];a&&i.addDefaultInnerSpace(l,c),i.addInner2SafeChangeMap(t,"Plane_"+t,a,l,c),s=d0t(r);break}case"COPPER":{let l=r[1],c=r[2];a&&i.addDefaultCopperSpace(l,c),i.addCopper2SafeChangeMap(t,"Copper_"+t,a,l,c),s=p0t(r);break}case"PASTE":{s=f0t(r);break}case"SOLDER":{s=m0t(r);break}case"AUTO_ROUTER":{s=g0t(r);break}}return s}function P0t(o,t,e,r){if(!r.init)return null;function i(n,s){let a=n?"Copper_":"Plane_",l=["RULE"];l[1]="SAFE",l[2]=a+t,l[3]=0;let c=s.getNewDefaultData(n,t);return c==null?null:(l[4]={unit:s.defaultSafeData.unit,isForAll:"ALL",safeSpacing:[{layerId:1,isOpen:!0,content:c}]},l)}switch(o){case"SAFE":return r.fixSafeData(e),null;case"PLANE":return i(!1,r);case"COPPER":return i(!0,r);default:return null}}function T0t(o,t,e,r){if(!r.init)return{ruleKeyValue:e};let i=o[0],n,s;if(t==4){if(i==="NET_CLASS"||i==="NET"){for(let a in e)String(a)==="COPPER"&&(n={COPPER:r.getSafeName4Copper(e[a])}),String(a)==="PLANE"&&(s={PLANE:r.getSafeName4Plane(e[a])});o[1]==""?(n!=null&&n.COPPER||(n={COPPER:"default"}),s!=null&&s.PLANE||(s={PLANE:"default"})):(n!=null&&n.COPPER||(n={COPPER:r.getDefaultCopper()}),s!=null&&s.PLANE||(s={PLANE:r.getDefaultPlane()}))}}else for(let a in e){if(String(a)==="COPPER"){let l=e[a],c=r.getSafeName4Copper(l);if(c==null&&l=="default"&&(c=r.getDefaultCopper()),c==null)continue;n={COPPER:c}}if(String(a)==="PLANE"){let l=e[a],c=r.getSafeName4Plane(l);if(c==null&&l=="default"&&(c=r.getDefaultPlane()),c==null)continue;s={PLANE:c}}}return{ruleKeyValue:e,copperRuleValue:n,innerPlaneRuleValue:s}}function S6e(o,t){let e=o.length,r=0;for(;r<e;){let i=o.indexOf(`
`,r);i<0&&(i=e);let n=o.substring(r,i);try{if(t(n)===!1)break}catch(s){console.error(s)}r=i+1}}function I0t(o){let t={};return S6e(o,e=>{if(e.startsWith('["PAD"')){let r=JSON.parse(e);t[r[5]]||(t[r[5]]=[]),t[r[5]].push(r[1])}}),t}var C0t=class{parseFull(o){S6e(o,t=>this.onParseLine(JSON.parse(t))),this.onParseEnd()}},E6e=class extends C0t{constructor(o={},t={},e=[],r=[],i=!1){super(),this.deviceName=o,this.footprintName=t,this.footprints=e,this.devices=r,this.footprintIsConnectDevice=i,this.fontCache=[],this.poured={},this.curPartition="",this.eQLenData={},this.eQLenSort=1,this.cache={},this.components={},this.errorIds={},this.dimension={},this.connects={},this.specialColors={},this.reuseBlock={},this.panelize={data:[],stamp:{h:null,v:null},size:{h:null,v:null}},this.layerPhys=0,this.fac=new x4e,this.rules=[],this.ruleSelectors=[],this.ruleTemplateName="",this.layerFill={},this.idsSet=new Set,this.oldId={},this.cachePadNet={},this.creaseIds=[],this.stringId={},this.substrateLayer=new Set,this.layerPhysCache=[],this.randomUuid=0,this.padNumId={},this.componentPadNum={}}getOldId(o){var t;return(t=this.oldId[o])!=null?t:o}handConnect(){for(let o of this.creaseIds)if(this.connects[o])for(let t of this.connects[o])this.connects[t]?this.connects[t].push(o):this.connects[t]=[o]}getConnect(o){return this.connects[o]||[]}transRuleType(o){return C6e(o)}transRuleStatus(o){switch(o=o&&Number(o),o){case 0:return"NORMAL";case 1:return"DEFAULT";default:return"NORMAL"}}transGridType(o){switch(o=o&&Number(o),o){case 0:return"NONE";case 1:return"GRID";case 2:return"OUTLETS";default:return"NONE"}}transLayerStatus(o){o=o&&Number(o);let t=!1,e=!1,r=!1;return o!=null&&!isNaN(o)?(o>=4&&(r=!0,o-=4),o>=2&&(e=!0,o-=2),o===1&&(t=!0)):t=!0,{use:t,show:e,locked:r}}transRoutingMode(o){switch(o=o&&Number(o),o){case 0:return"NONE";case 1:return"PUSH";case 2:return"SURROUND";case 3:return"OBSTRUCT";case 4:return"SURROUND&PUSH";default:return"NONE"}}transPadDef(o){switch(o==null?void 0:o[0]){case"ELLIPSE":return{padType:"ELLIPSE",width:o[1],height:o[2]};case"RECT":return{padType:"RECT",width:o[1],height:o[2],radius:o[3]};case"OVAL":return{padType:"OVAL",width:o[1],height:o[2]};case"POLYGON":case"POLY":return{padType:"POLYGON",path:o[1]};default:return null}}transHoleDef(o){return o?{holeType:o[0],width:o[1],height:o[2]}:null}transPourDef(o){function t(e){switch(e=e&&Number(e),e){case 0:return"GRID_LINE";case 1:return"HORIZONTAL_LINE";case 2:return"VERTICAL_LINE";default:return"GRID_LINE"}}switch(o==null?void 0:o[0]){case"SOLID":return{pourType:"SOLID",fineness:o[1]};case"LINE":return{pourType:t(o[1]),angle:o[2],strokeWidth:o[3],strokeSpacing:o[4]};default:return null}}transUnusedPadRange(o){switch(o=o&&Number(o),o){case 1:return"ALL";case 2:return"PAD";case 3:return"VIA";default:return"VIA"}}transPathOptimization(o){switch(o=o&&Number(o),o){case 0:return"SINGLE";case 1:return"ALL";case 2:return"NONE";default:return"SINGLE"}}transViaType(o){switch(o=o&&Number(o),o){case 0:return"NORMAL";case 1:return"SUTURE";default:return"NORMAL"}}transPadFuncType(o){switch(o=o&&Number(o),o){case 0:return"NORMAL";case 1:return"TEST";case 2:return"MARKER";default:return"NORMAL"}}transPadConnect(o){switch(o=o&&Number(o),o){case 0:return"DIVERGENCE";case 1:return"DIRECT";case 2:return"NON_CONNECT";default:return null}}transFillStyle(o){switch(o=o&&Number(o),o){case 0:return"SOLID";case 1:return"GRID";case 2:return"PLANE";default:return null}}transProhibitType(o){let t=new Set;if(!o)return[];for(let e of o)switch(e=e&&Number(e),e){case 1:t.add("TRACK"),t.add("FILL");break;case 2:t.add("COMPONENT");break;case 3:t.add("VIA");break;case 4:t.add("COPPER"),t.add("PLANE");break;case 5:t.add("TRACK");break;case 6:t.add("FILL");break;case 7:t.add("COPPER");break;case 8:t.add("PLANE");break}return Array.from(t)}transPushCoverDir(o){switch(o=o&&Number(o),o){case 1:return"X_AXIS_POSITIVE";case 2:return"X_AXIS_NEGATIVE";case 4:return"Y_AXIS_POSITIVE";case 8:return"Y_AXIS_NEGATIVE";default:return"X_AXIS_POSITIVE"}}transEntityBelong(o){switch(o=o&&Number(o),o){case 0:return"AUTO";case 1:return"UPPER_SHELLS";case 2:return"LOWER_SHELLS";default:return"AUTO"}}transSlotOption(o){o=o&&Number(o);let t=o;if(!t||t<4)return["OUTLINE","SCREW_PILLAR","ENTITY"];let e=[];return t>=16&&(e.push("ENTITY"),t-=16),t>=8&&(e.push("SCREW_PILLAR"),t-=8),t>=4&&(e.push("OUTLINE"),t-=4),e}transAlignType(o){switch(o=o&&Number(o),o){case 1:return"LEFT_TOP";case 4:return"CENTER_TOP";case 7:return"RIGHT_TOP";case 2:return"LEFT_MIDDLE";case 5:return"CENTER_MIDDLE";case 8:return"RIGHT_MIDDLE";case 3:return"LEFT_BOTTOM";case 6:return"CENTER_BOTTOM";case 9:return"RIGHT_BOTTOM";default:return"LEFT_BOTTOM"}}onParseLine(o){var t;let e=o[0];switch(e){case"DOCTYPE":this.parseDocType(o);break;case"HEAD":this.parseHead(o);break;case"CANVAS":this.parseCanvas(o);break;case"LAYER":this.parseLayer(o);break;case"LAYER_PHYS":this.layerPhysCache.push(o);break;case"ACTIVE_LAYER":this.parseActiveLayer(o);break;case"NET":this.parseNet(o);break;case"PRIMITIVE":this.parsePrimitive(o);break;case"GROUP":this.parseGroup(o);break;case"SILK_OPTS":this.parseSilkOpts(o);break;case"PREFERENCE":this.parsePreference(o);break;case"CONNECT":this.parseConnect(o);break;case"ITEM_ORDER":this.parseItemOrder(o);break;case"PROP":this.parseProp(o);break;case"EQLEN_GRP":this.parseEQLenGrp(o);break;case"EQLEN":this.parseEQLen(o);break;case"FONT":this.parseFont(o);break;case"PAD_NET":{this.cachePadNet[o[1]]||(this.cachePadNet[o[1]]=[]),this.cachePadNet[o[1]].push(o);break}case"REUSE_BLOCK":this.parseReuseBlock(o);break;case"RULE_TEMPLATE":this.parseRuleTemplate(o);break;case"RULE":this.rules.push(o);break;case"RULE_SELECTOR":this.ruleSelectors.push(o);break;case"PANELIZE":this.panelize.data=o;break;case"PANELIZE_STAMP":this.parsePanelizeStamp(o);break;case"PANELIZE_SIDE":this.parsePanelizeSide(o);break;case"POURED":{this.parsePoured(o);break}case"PARTITION":e==="PARTITION"&&(this.curPartition=o[3]?o[1]:"");case"VIA":case"PAD":case"LINE":case"ARC":case"CARC":case"OBJ":case"POLY":case"FILL":if(e==="FILL"&&o[6]===2){this.layerFill[o[4]]||(this.layerFill[o[4]]=[]),this.layerFill[o[4]].push(o);break}case"REGION":case"POUR":case"IMAGE":case"TEARDROP":case"FPC_FILL":case"SHELL":case"CREASE":e==="CREASE"&&this.creaseIds.push(o[1]);case"SHELLCUT":case"SHELL_ENTITY":case"BOSS":case"STRING":if(e==="STRING"&&!/^[a-zA-Z]+\d+$/.test(o[1])){let r=o[1],i=r.split(/([0-9].*)/);if(i.length>=2){let n=i[0],s=i[1];for(let a=0;a<s.length;a++){let l=s.charCodeAt(a);n+=l}r=n}this.stringId[r]=o[1],o[1]=r}case"DIMENSION":case"COMPONENT":{let r=e==="CARC"?"ARC":e,i=O4e(o[1]);this.cache[r]||(this.cache[r]={}),i!==null&&!this.cache[r][i]?this.cache[r][i]={part:this.curPartition,value:o}:(this.errorIds[r]||(this.errorIds[r]=[]),this.errorIds[r].push({part:this.curPartition,value:o})),r==="COMPONENT"&&(this.components[o[1]]||(this.components[o[1]]={attrs:{},footprint:"",device:""}),this.components[o[1]].attrs=o[7]||{}),r==="DIMENSION"&&(this.dimension[o[1]]={attr:[]});break}case"ATTR":{if(this.docType==="PCB"&&!o[3])break;if(o[7]==="Footprint"&&(this.components[o[3]]||(this.components[o[3]]={attrs:{},footprint:"",device:""}),this.components[o[3]].footprint=o[8]),o[7]==="Device"&&(this.components[o[3]]||(this.components[o[3]]={attrs:{},footprint:"",device:""}),this.components[o[3]].device=o[8]),this.dimension[o[1]]){this.dimension[o[1]].attr=o;break}let r=Object.keys(((t=this.cache)==null?void 0:t.COMPONENT)||{}).find(n=>this.cache.COMPONENT[n].value[1]===o[3]);if(r){let n=this.cache.COMPONENT[r];n.attr||(n.attr=[]),n.attr.push({part:this.curPartition,value:o});break}let i=O4e(o[1]);this.cache[e]||(this.cache[e]={}),i!==null&&!this.cache[e][i]?this.cache[e][i]={part:this.curPartition,value:o}:(this.errorIds[e]||(this.errorIds[e]=[]),this.errorIds[e].push({part:this.curPartition,value:o}));break}default:console.warn("can not find hanlder with",o)}}async secondParseLine(o,t,e){let r=o[0];if(this.idsSet.has(o[1])||!o[1]){let i=`randomuuid${++this.randomUuid}`;if(this.oldId[i]=o[1],o[1]=i,e)for(let n of e)n[3]=i}else this.idsSet.add(o[1]);switch(r){case"DOCTYPE":case"HEAD":case"CANVAS":case"LAYER":case"LAYER_PHYS":case"ACTIVE_LAYER":case"NET":case"PRIMITIVE":case"GROUP":case"SILK_OPTS":case"PREFERENCE":case"ITEM_ORDER":case"RULE_TEMPLATE":case"RULE":case"RULE_SELECTOR":case"PANELIZE":case"PANELIZE_STAMP":case"PANELIZE_SIDE":case"CONNECT":case"EQLEN_GRP":case"EQLEN":case"FONT":case"PAD_NET":case"REUSE_BLOCK":case"PROP":break;case"PARTITION":this.parsePartition(o);break;case"VIA":this.parseVia(o);break;case"PAD":this.parsePad(o);break;case"LINE":await this.parseLine(o);break;case"ARC":this.parseArc(o);break;case"CARC":this.parseCArc(o);break;case"OBJ":this.parseObj(o);break;case"POLY":this.parsePoly(o);break;case"FILL":this.parseFill(o);break;case"REGION":this.parseRegion(o);break;case"POUR":this.parsePour(o);break;case"IMAGE":this.parseImage(o);break;case"TEARDROP":this.parseTeardrop(o);break;case"FPC_FILL":this.parseFpcFill(o);break;case"SHELL":this.parseShell(o);break;case"CREASE":this.parseCrease(o);break;case"SHELLCUT":this.parseShellCut(o);break;case"SHELL_ENTITY":this.parseShellEntity(o);break;case"BOSS":this.parseBoss(o);break;case"STRING":this.parseString(o);break;case"ATTR":this.parseAttr(o,t);break;case"DIMENSION":this.parseDimension(o);break;case"COMPONENT":this.parseComponent(o);break;default:console.warn("can not find hanlder with",o)}}onParseEnd(){for(let t of this.layerPhysCache)this.parseLayerPhys(t);this.layerPhysCache=[];for(let t of this.rules)t[1]=this.transRuleType(t[1]),t[3]=this.transRuleStatus(t[3]),t[4]=b0t(t[1],t[2],t[3],t[4],this.fac,this.ruleTemplateName);if(this.fac.init){let t=Array.from(this.rules);for(let e of t){let r=P0t(e[1],e[2],e[4],this.fac);r&&this.rules.push(r)}}for(let t of this.rules)this.parseRule(t);let o={};for(let t of this.ruleSelectors){let e=T0t(t[1],t[2],Ik(t[3]),this.fac),r=JSON.stringify(t[1]);o[r]?(t[2]&&(o[r].ruleOrder=t[2]),e.ruleKeyValue&&(o[r].ruleKeyValue=Object.assign(o[r].ruleKeyValue,e.ruleKeyValue)),(e.copperRuleValue||t[4])&&(o[r].copperValue=e.copperRuleValue||Ik(t[4])),(e.innerPlaneRuleValue||t[5])&&(o[r].innerPlaneValue=e.innerPlaneRuleValue||Ik(t[5]))):o[r]={ruleSelect:t[1],ruleOrder:t[2],ruleKeyValue:e.ruleKeyValue,copperValue:e.copperRuleValue||Ik(t[4])||{},innerPlaneValue:e.innerPlaneRuleValue||Ik(t[5])||{}}}for(let t in o)this.parseRuleSelector(o[t]);this.handConnect(),this.parseEQLenGrpFull(),this.parsePanelize(),this.parseLayerFill();for(let t in this.cache){let e=this.cache[t],r=Object.keys(e).sort((n,s)=>Number(n)-Number(s)),i=-1;for(let n of r){let s=Number(n),a=s-i-1;a>=1&&this.onPHolder(t,a),i=s,this.curPartition=e[s].part,this.secondParseLine(e[s].value,void 0,e[s].attr),e[s].attr&&e[s].attr.forEach(l=>{this.curPartition=l.part,this.secondParseLine(l.value)})}if(this.errorIds[t])for(let n of this.errorIds[t])this.curPartition=n.part,this.secondParseLine(n.value)}this.clearCache()}clearCache(){this.version=void 0,this.docType=void 0,this.curPartition="",this.eQLenData={},this.eQLenSort=1,this.cache={},this.components={},this.errorIds={},this.dimension={},this.connects={},this.specialColors={},this.reuseBlock={},this.panelize.data.length&&(this.panelize.data.length=0,this.panelize.stamp={h:null,v:null},this.panelize.size={h:null,v:null}),this.layerPhys=0,this.fac.init&&(this.fac=new x4e),this.rules=[],this.ruleSelectors=[],this.ruleTemplateName="",this.layerFill={},this.idsSet.clear(),this.oldId={},this.creaseIds.length=0,this.substrateLayer.clear()}fixPolygon(o){if(o[0]=="R"){let t=parseFloat(o[3])/10,e=parseFloat(o[4])/10;o[6]=Math.min(t,e)/2*(parseFloat(o[6])||0)*10}}handleSimplePolygon(o){return!o||this.version>=1.5||this.fixPolygon(o),o}handlePolygon(o){if(this.version<1.5&&o&&o.length){if(!Array.isArray(o[0]))return this.handleSimplePolygon(o);for(let t of o)this.fixPolygon(t)}return o}parseEQLen(o){this.eQLenData[o[1]]?this.eQLenData[o[1]].pads?this.eQLenData[o[1]].pads.push(o[2]):this.eQLenData[o[1]].pads=[o[2]]:this.eQLenData[o[1]]={pads:[o[2]]}}parseEQLenGrp(o){this.eQLenData[o[1]]?(this.eQLenData[o[1]].id=o[1],this.eQLenData[o[1]].name=o[2],this.eQLenData[o[1]].sort=++this.eQLenSort):this.eQLenData[o[1]]={id:o[1],name:o[2],sort:++this.eQLenSort}}parseCanvas(o){this.onCanvas(o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],this.transGridType(o[10]),this.transGridType(o[11]),o[12])}parseDocType(o){this.docType=o[1];let t=parseFloat(o[2]);this.version=t}parseHead(o){}parseLayer(o){let t=o[8];this.version<1.7&&(t=.5);let e=this.transLayerStatus(o[4]),r=Number(o[1]);if(o[2]==="SUBSTRATE"){if(this.substrateLayer.add(r),r<101)return;r<361&&(r=r+260)}this.onLayer(r,o[2],o[3],e.use,e.show,e.locked,o[5],o[6],o[7],t)}parseLayerPhys(o){let t=Number(o[1]);if(t>=101&&t<361&&this.substrateLayer.has(t))t=t+260;else if(t<101&&this.substrateLayer.has(t))return;this.onLayerPhys(t,o[2],o[3],o[4],o[5],!!o[6],++this.layerPhys)}parseActiveLayer(o){this.onActiveLayer(o[1])}parsePartition(o){this.onPartition(o[1],o[2],o[3],this.handlePolygon(o[4]))}parseNet(o){var t,e,r,i;this.onNet(o[1],(t=o[2])!=null?t:null,(e=o[3])!=null?e:null,!!o[4],(r=o[5])!=null?r:null,!!o[6],(i=o[7])!=null?i:null)}parsePrimitive(o){this.onPrimitive(o[1],!!o[2],!!o[3])}parseGroup(o){this.onGroup(o[1],o[2])}parseSilkOpts(o){this.onSilkOpts(o[1],o[2],o[3])}parsePreference(o){this.onPreference(!!o[1],o[2],!!o[3],o[4],o[5],!!o[6],this.transRoutingMode(o[7]),o[8],!!o[9],!!o[10],!!o[11],o[12],o[13],!!o[14],this.transUnusedPadRange(o[15]),o[16],this.transPathOptimization(o[17]),o[18],o[19],o[20])}parseConnect(o){this.connects[o[1]]=o[2]}parseVia(o){var t,e;this.onVia(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],this.transViaType(o[9]),(t=o[10])!=null?t:null,(e=o[11])!=null?e:null,!!o[12],o[13])}parsePad(o){var t,e,r,i,n,s,a,l,c;this.onPad(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],this.transHoleDef(o[9]),this.transPadDef(o[10]),o[11]&&(e=(t=o[11])==null?void 0:t.map(h=>({startLayer:h[0],endLayer:h[1],pad:this.transPadDef(h[2])})))!=null?e:null,o[12],o[13],o[14],!!o[15],this.transPadFuncType(o[16]),(r=o[17])!=null?r:null,(i=o[18])!=null?i:null,(n=o[19])!=null?n:null,(s=o[20])!=null?s:null,!!o[21],this.transPadConnect(o[22]),(a=o[23])!=null?a:null,(l=o[24])!=null?l:null,(c=o[25])!=null?c:null,o[26],this.getConnect(o[1]))}parseLine(o){this.onLine(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],!!o[10])}parseArc(o){this.onArc(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],!!o[11],this.specialColors[this.getOldId(o[1])])}parseCArc(o){this.onCArc(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],!!o[11],this.specialColors[this.getOldId(o[1])])}parseObj(o){this.onObj(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],!!o[10],o[11],!!o[12],this.specialColors[this.getOldId(o[1])])}parseItemOrder(o){this.itemOrder=o[1]}parseProp(o){this.specialColors[o[1]]=o[2]}parseEQLenGrpFull(){for(let o in this.eQLenData){let t=this.eQLenData[o];t.id&&this.onEQLenGrp(t.id,t.name,t.sort,t.pads||[])}this.eQLenData={},this.eQLenSort=1}parsePoly(o){this.onPoly(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.handleSimplePolygon(o[6]),!!o[7],this.specialColors[this.getOldId(o[1])])}parseFill(o){this.onFill(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.transFillStyle(o[6]),this.handlePolygon(o[7]),!!o[8],this.getConnect(o[1]),this.specialColors[this.getOldId(o[1])])}getZIndex1(o){let t=o.match(ZQ);return t!=null&&t.length?t[1]:null}parseLayerFill(){for(let o in this.layerFill){let t=this.layerFill[o];this.onLayerFill(Number(o),{fill:t.map(e=>{let r=this.getZIndex1(e[1]);return{id:e[1],partitionId:this.curPartition||"",groupId:e[2],locked:!!e[8],zIndex:r===null?null:Number(r),netName:e[3],width:e[5],path:this.handlePolygon(e[7]),refs:this.getConnect(e[1]),specialColor:this.specialColors[this.getOldId(e[1])]}})})}}parseRegion(o){let t=o[5],e=t&&t.includes(9)?"CONSTRAINT":"PROHIBIT";t=e?t.filter(r=>r!==9):t,this.onRegion(o[1],this.curPartition||"",o[2],o[3],o[4],this.transProhibitType(t),this.handlePolygon(o[6]),!!o[7],o[8],e)}parsePour(o){let t=o[9];this.version<=1.7&&t&&t[0]==="SOLID"&&t[1]&&(t[1]=8),this.onPour(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],this.handlePolygon(o[8]),this.transPourDef(t),!!o[10],!!o[11]),this.poured[o[1]]&&this.onPoured(o[1],this.poured[o[1]])}parsePoured(o){if(this.version<1.1){if(this.curPourId){let t={id:o[1],strokeWidth:o[2],fill:o[3],path:this.handlePolygon(o[4])};this.poured[this.curPourId]||(this.poured[this.curPourId]={pourFill:[]}),this.poured[this.curPourId].pourFill.push(t)}}else{let t={id:o[1],strokeWidth:o[3],fill:o[4],path:this.handlePolygon(o[5])};this.poured[o[2]]||(this.poured[o[2]]={pourFill:[]}),this.poured[o[2]].pourFill.push(t)}}parseImage(o){this.onImage(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],!!o[9],o[10],!!o[11],this.specialColors[this.getOldId(o[1])])}parseTeardrop(o){let t,e,r;this.version<1.2?(t=o[5],r=o[4]):(t=o[4],e=o[5],r=this.getConnect(o[1])),this.onTeardrop(o[1],this.curPartition||"",o[2],o[3],this.handleSimplePolygon(t),e!=null?e:null,r)}parseFpcFill(o){this.onFpcFill(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.handlePolygon(o[6]),!!o[7])}parseShell(o){let t=o[8];t&&t.Direction&&(t.Direction=this.transPushCoverDir(t.Direction)),this.onShell(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],this.handlePolygon(o[7]),t,!!o[9])}parseCrease(o){this.onCrease(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],!!o[9])}parseShellCut(o){this.onShellCut(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.handlePolygon(o[6]),!!o[7],this.getConnect(o[1]))}parseShellEntity(o){this.onShellEntity(o[1],this.curPartition||"",o[2],o[3],o[4],this.transEntityBelong(o[5]),this.transSlotOption(o[5]),o[6],o[7],this.handlePolygon(o[8]),!!o[9],this.getConnect(o[1]))}parseBoss(o){var t,e,r,i,n,s;this.version<1.4?this.onBoss(o[1],this.curPartition||"",o[2],o[3],o[5],o[6],(t=o[4])!=null?t:null,o[7],null,null,(e=o[8])!=null?e:null,(r=o[9])!=null?r:null,!!o[10]):this.onBoss(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],(i=o[6])!=null?i:null,o[7],o[8],o[9],(n=o[10])!=null?n:null,(s=o[11])!=null?s:null,!!o[12])}parseDimension(o){var t;let e=this.getOldId(o[1]),r=((t=this.dimension[e])==null?void 0:t.attr)||[];if(r.length){let n=this.fontCache.find(s=>s.id&&s.id===this.getOldId(r[1]));this.version<1.6&&n&&(n.text=r[8],n.fontFamily=r[11],n.fontSize=r[12]/10,n.thickness=r[13]/10,n.bold=r[15],n.italic=r[16],n.reverse=r[18],n.expansion=r[19]/10)}let i={groupId:r[2],layerId:r[4],x:r[5],y:r[6],text:r[8],fontFamily:r[11],fontSize:r[12],strokeWidth:r[13],bold:r[14],italic:r[15],origin:r[16],angle:r[17],reverse:r[18],expansion:r[19],mirror:r[20],locked:r[21],zIndex:null,specialColor:this.specialColors[this.getOldId(r[1])]};this.onDimension(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],!!o[7],o[8],!!o[9],i,this.specialColors[this.getOldId(o[1])],r[2]||"")}parseRuleTemplate(o){this.ruleTemplateName=o[1],this.onRuleTemplate(o[1])}parseRule(o){this.onRule(o[1],o[2],o[3],o[4])}parseRuleSelector(o){this.onRuleSelector(o.ruleSelect,o.ruleOrder,o.ruleKeyValue,o.copperValue,o.innerPlaneValue)}parsePanelize(){let o=this.panelize.data;o.length&&this.onPanelize(!!o[1],o[2],o[3],o[4],o[5],!!o[6],this.panelize.stamp.h,this.panelize.stamp.v,this.panelize.size.h,this.panelize.size.v)}parsePanelizeStamp(o){let t={on:!!o[2],stampHoleGroupQuantity:o[3],stampHoleDiameter:o[4],stampHoleQuantityPerGroup:o[5],stampHoleSpacing:o[6]};o[1]?this.panelize.stamp.v=t:this.panelize.stamp.h=t}parsePanelizeSide(o){let t={on:!!o[2],sideHeight:o[3],positionHoleDiameter:o[4],markDiameter:o[5],markExpansion:o[6]};o[1]?this.panelize.size.v=t:this.panelize.size.h=t}parseComponent(o){let t=this.getOldId(o[1]),e=o[7]||{},r=this.reuseBlock[t];if(r&&Object.assign(e,{"Group ID":r[2]||"","Channel ID":r[3]||""}),this.onComponent(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],e,!!o[8],this.specialColors[t],o[9]),this.cachePadNet[t])for(let i of this.cachePadNet[t])this.parsePadNet(i)}parsePadNet(o){let t=this.getOldId(o[1]);if(o[4]===void 0&&this.components[t]){let e=this.components[t].footprint;if(!e){let i=this.components[t].device;e=this.devices.find(n=>n.uuid===i).attributes.Footprint}let r=this.padNumId[e];if(!r){let i=this.footprints.find(n=>n.uuid===e);i&&(this.padNumId[e]=I0t(i==null?void 0:i.dataStr),r=this.padNumId[e])}if(r&&r[o[2]]){this.componentPadNum[t]||(this.componentPadNum[t]={}),this.componentPadNum[t][o[2]]===void 0&&(this.componentPadNum[t][o[2]]=-1);let i=++this.componentPadNum[t][o[2]];o[4]=r[o[2]][i]}else o[4]=o[2]}this.onPadNet(o[1],this.curPartition||"",o[2],o[3],o[4])}parseReuseBlock(o){this.reuseBlock[o[1]]=o}getFontCache(o,t,e,r,i,n,s,a){let l;return this.version<1.6?l=this.fontCache.find(c=>c.id===o):l=this.fontCache.find(c=>e==c.fontFamily&&t==c.text&&r/10==c.fontSize&&!!s==c.reverse&&a==c.expansion&&!!i==c.bold&&!!n==c.italic&&c.path.length>0),{paths:l==null?void 0:l.path,width:l==null?void 0:l.width,height:l==null?void 0:l.height}}getTextValue(o,t,e,r,i){let n="";return o!=""&&t===""&&this.docType!="PCB"&&!i&&o!="Footprint"&&!this.footprintIsConnectDevice&&(t=`<${o}>`),e?r?n=o+":"+t:n=o:r?n=t:n="",n}getFormulaName(o,t){if(!o||!o.startsWith("="))return o;o=o.slice(1);let e=/\{([^\}]+)\}/g,r=[],i=[];for(;r=e.exec(o);)i.push(r[1]);for(let n=0;n<i.length;n++){let s=i[n],a=`{${s}!}`;t.has(s)&&(a=t.get(s)),o=o.replace(`{${s}}`,a)}return o}parseAttr(o,t){let e=o[11],r=o[12];r&&this.version<1.2&&(e=="default"||e=="")&&(r*=1.5);let i=o[7],n=o[8],s=!!o[9],a=!!o[10],l=this.getOldId(o[3]),c=n;if(i==="Device"){let u=this.deviceName[n]||n;c=this.getTextValue(i,u,s,a,l)}else if(i==="Footprint"){let u=this.footprintName[n]||n;c=this.getTextValue(i,u,s,a,l)}else if(i==="Name"){let u=new Map;if(l){let d=this.components[l];if(u.set("ID",l),Object.entries(d.attrs).forEach(p=>u.set(p[0],p[1])),d.device){let p=this.devices.find(m=>m.uuid===d.device);p&&Object.entries(p.attributes).forEach(m=>u.set(m[0],m[1]))}}c=this.getTextValue(i,this.getFormulaName(n,u),s,a,l)}else c=this.getTextValue(i,n,s,a,l);let h=this.fontCache.find(u=>u.id&&u.id===this.getOldId(o[1]));this.version<1.6&&h&&(h.text=c,h.fontFamily=e,h.fontSize=r/10,h.thickness=o[13]/10,h.bold=o[15],h.italic=o[16],h.reverse=o[18],h.expansion=o[19]/10),this.onAttr(o[1],this.curPartition||"",o[2],l,o[4],o[5],o[6],i,n,s,a,e,r,o[13],!!o[14],!!o[15],this.transAlignType(o[16]),o[17],!!o[18],o[19],!!o[20],!!o[21],t,this.specialColors[this.getOldId(o[1])])}parseFont(o){let t;switch(this.version){case 1:case 1.1:t={id:o[1],path:o[2]};break;case 1.2:case 1.3:case 1.4:case 1.5:t={id:o[1],width:o[2],height:o[3],path:o[4]};break;default:t={text:o[1],fontFamily:o[2],fontSize:o[3],thickness:o[4],bold:!!o[5],italic:!!o[6],reverse:!!o[7],expansion:o[8],width:o[9],height:o[10],path:o[11]};break}this.fontCache.push(t)}parseString(o){var t;let[,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P]=o,T=(t=this.stringId[e])!=null?t:e;c&&this.version<1.2&&(l=="default"||l=="")&&(c*=1.5);let I=this.fontCache.find(C=>C.id&&C.id===this.getOldId(T));this.version<1.6&&I&&(I.text=a,I.fontFamily=l,I.fontSize=c/10,I.thickness=h/10,I.bold=u,I.italic=d,I.reverse=g,I.expansion=y/10),this.onString(e,this.curPartition||"",r,i,n,s,a,l,c,h,!!u,!!d,this.transAlignType(p),m,!!g,y,!!b,!!P,this.specialColors[this.getOldId(T)])}},S0t=Object.create,O6e=Object.defineProperty,E0t=Object.getOwnPropertyDescriptor,O0t=Object.getOwnPropertyNames,A0t=Object.getPrototypeOf,_0t=Object.prototype.hasOwnProperty,v0t=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),x0t=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of O0t(t))!_0t.call(o,i)&&i!==e&&O6e(o,i,{get:()=>t[i],enumerable:!(r=E0t(t,i))||r.enumerable});return o},R0t=(o,t,e)=>(e=o!=null?S0t(A0t(o)):{},x0t(t||!o||!o.__esModule?O6e(e,"default",{value:o,enumerable:!0}):e,o)),D0t=v0t((o,t)=>{"use strict";t.exports=e,t.exports.default=e;function e(L,B,N){N=N||2;var U=B&&B.length,k=U?B[0]*N:L.length,V=r(L,0,k,N,!0),Y=[];if(!V||V.next===V.prev)return Y;var X,Z,Q,ae,he,re,se;if(U&&(V=h(L,B,V,N)),L.length>80*N){X=Q=L[0],Z=ae=L[1];for(var K=N;K<k;K+=N)he=L[K],re=L[K+1],he<X&&(X=he),re<Z&&(Z=re),he>Q&&(Q=he),re>ae&&(ae=re);se=Math.max(Q-X,ae-Z),se=se!==0?32767/se:0}return n(V,Y,N,X,Z,se,0),Y}function r(L,B,N,U,k){var V,Y;if(k===W(L,B,N,U)>0)for(V=B;V<N;V+=U)Y=H(V,L[V],L[V+1],Y);else for(V=N-U;V>=B;V-=U)Y=H(V,L[V],L[V+1],Y);return Y&&E(Y,Y.next)&&(z(Y),Y=Y.next),Y}function i(L,B){if(!L)return L;B||(B=L);var N=L,U;do if(U=!1,!N.steiner&&(E(N,N.next)||C(N.prev,N,N.next)===0)){if(z(N),N=B=N.prev,N===N.next)break;U=!0}else N=N.next;while(U||N!==B);return B}function n(L,B,N,U,k,V,Y){if(L){!Y&&V&&g(L,U,k,V);for(var X=L,Z,Q;L.prev!==L.next;){if(Z=L.prev,Q=L.next,V?a(L,U,k,V):s(L)){B.push(Z.i/N|0),B.push(L.i/N|0),B.push(Q.i/N|0),z(L),L=Q.next,X=Q.next;continue}if(L=Q,L===X){Y?Y===1?(L=l(i(L),B,N),n(L,B,N,U,k,V,2)):Y===2&&c(L,B,N,U,k,V):n(i(L),B,N,U,k,V,1);break}}}}function s(L){var B=L.prev,N=L,U=L.next;if(C(B,N,U)>=0)return!1;for(var k=B.x,V=N.x,Y=U.x,X=B.y,Z=N.y,Q=U.y,ae=k<V?k<Y?k:Y:V<Y?V:Y,he=X<Z?X<Q?X:Q:Z<Q?Z:Q,re=k>V?k>Y?k:Y:V>Y?V:Y,se=X>Z?X>Q?X:Q:Z>Q?Z:Q,K=U.next;K!==B;){if(K.x>=ae&&K.x<=re&&K.y>=he&&K.y<=se&&T(k,X,V,Z,Y,Q,K.x,K.y)&&C(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function a(L,B,N,U){var k=L.prev,V=L,Y=L.next;if(C(k,V,Y)>=0)return!1;for(var X=k.x,Z=V.x,Q=Y.x,ae=k.y,he=V.y,re=Y.y,se=X<Z?X<Q?X:Q:Z<Q?Z:Q,K=ae<he?ae<re?ae:re:he<re?he:re,me=X>Z?X>Q?X:Q:Z>Q?Z:Q,Oe=ae>he?ae>re?ae:re:he>re?he:re,Ie=b(se,K,B,N,U),ue=b(me,Oe,B,N,U),Pe=L.prevZ,j=L.nextZ;Pe&&Pe.z>=Ie&&j&&j.z<=ue;){if(Pe.x>=se&&Pe.x<=me&&Pe.y>=K&&Pe.y<=Oe&&Pe!==k&&Pe!==Y&&T(X,ae,Z,he,Q,re,Pe.x,Pe.y)&&C(Pe.prev,Pe,Pe.next)>=0||(Pe=Pe.prevZ,j.x>=se&&j.x<=me&&j.y>=K&&j.y<=Oe&&j!==k&&j!==Y&&T(X,ae,Z,he,Q,re,j.x,j.y)&&C(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;Pe&&Pe.z>=Ie;){if(Pe.x>=se&&Pe.x<=me&&Pe.y>=K&&Pe.y<=Oe&&Pe!==k&&Pe!==Y&&T(X,ae,Z,he,Q,re,Pe.x,Pe.y)&&C(Pe.prev,Pe,Pe.next)>=0)return!1;Pe=Pe.prevZ}for(;j&&j.z<=ue;){if(j.x>=se&&j.x<=me&&j.y>=K&&j.y<=Oe&&j!==k&&j!==Y&&T(X,ae,Z,he,Q,re,j.x,j.y)&&C(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function l(L,B,N){var U=L;do{var k=U.prev,V=U.next.next;!E(k,V)&&O(k,U,U.next,V)&&D(k,V)&&D(V,k)&&(B.push(k.i/N|0),B.push(U.i/N|0),B.push(V.i/N|0),z(U),z(U.next),U=L=V),U=U.next}while(U!==L);return i(U)}function c(L,B,N,U,k,V){var Y=L;do{for(var X=Y.next.next;X!==Y.prev;){if(Y.i!==X.i&&I(Y,X)){var Z=F(Y,X);Y=i(Y,Y.next),Z=i(Z,Z.next),n(Y,B,N,U,k,V,0),n(Z,B,N,U,k,V,0);return}X=X.next}Y=Y.next}while(Y!==L)}function h(L,B,N,U){var k=[],V,Y,X,Z,Q;for(V=0,Y=B.length;V<Y;V++)X=B[V]*U,Z=V<Y-1?B[V+1]*U:L.length,Q=r(L,X,Z,U,!1),Q===Q.next&&(Q.steiner=!0),k.push(P(Q));for(k.sort(u),V=0;V<k.length;V++)N=d(k[V],N);return N}function u(L,B){return L.x-B.x}function d(L,B){var N=p(L,B);if(!N)return B;var U=F(N,L);return i(U,U.next),i(N,N.next)}function p(L,B){var N=B,U=L.x,k=L.y,V=-1/0,Y;do{if(k<=N.y&&k>=N.next.y&&N.next.y!==N.y){var X=N.x+(k-N.y)*(N.next.x-N.x)/(N.next.y-N.y);if(X<=U&&X>V&&(V=X,Y=N.x<N.next.x?N:N.next,X===U))return Y}N=N.next}while(N!==B);if(!Y)return null;var Z=Y,Q=Y.x,ae=Y.y,he=1/0,re;N=Y;do U>=N.x&&N.x>=Q&&U!==N.x&&T(k<ae?U:V,k,Q,ae,k<ae?V:U,k,N.x,N.y)&&(re=Math.abs(k-N.y)/(U-N.x),D(N,L)&&(re<he||re===he&&(N.x>Y.x||N.x===Y.x&&m(Y,N)))&&(Y=N,he=re)),N=N.next;while(N!==Z);return Y}function m(L,B){return C(L.prev,L,B.prev)<0&&C(B.next,L,L.next)<0}function g(L,B,N,U){var k=L;do k.z===0&&(k.z=b(k.x,k.y,B,N,U)),k.prevZ=k.prev,k.nextZ=k.next,k=k.next;while(k!==L);k.prevZ.nextZ=null,k.prevZ=null,y(k)}function y(L){var B,N,U,k,V,Y,X,Z,Q=1;do{for(N=L,L=null,V=null,Y=0;N;){for(Y++,U=N,X=0,B=0;B<Q&&(X++,U=U.nextZ,!!U);B++);for(Z=Q;X>0||Z>0&&U;)X!==0&&(Z===0||!U||N.z<=U.z)?(k=N,N=N.nextZ,X--):(k=U,U=U.nextZ,Z--),V?V.nextZ=k:L=k,k.prevZ=V,V=k;N=U}V.nextZ=null,Q*=2}while(Y>1);return L}function b(L,B,N,U,k){return L=(L-N)*k|0,B=(B-U)*k|0,L=(L|L<<8)&16711935,L=(L|L<<4)&252645135,L=(L|L<<2)&858993459,L=(L|L<<1)&1431655765,B=(B|B<<8)&16711935,B=(B|B<<4)&252645135,B=(B|B<<2)&858993459,B=(B|B<<1)&1431655765,L|B<<1}function P(L){var B=L,N=L;do(B.x<N.x||B.x===N.x&&B.y<N.y)&&(N=B),B=B.next;while(B!==L);return N}function T(L,B,N,U,k,V,Y,X){return(k-Y)*(B-X)>=(L-Y)*(V-X)&&(L-Y)*(U-X)>=(N-Y)*(B-X)&&(N-Y)*(V-X)>=(k-Y)*(U-X)}function I(L,B){return L.next.i!==B.i&&L.prev.i!==B.i&&!v(L,B)&&(D(L,B)&&D(B,L)&&w(L,B)&&(C(L.prev,L,B.prev)||C(L,B.prev,B))||E(L,B)&&C(L.prev,L,L.next)>0&&C(B.prev,B,B.next)>0)}function C(L,B,N){return(B.y-L.y)*(N.x-B.x)-(B.x-L.x)*(N.y-B.y)}function E(L,B){return L.x===B.x&&L.y===B.y}function O(L,B,N,U){var k=R(C(L,B,N)),V=R(C(L,B,U)),Y=R(C(N,U,L)),X=R(C(N,U,B));return!!(k!==V&&Y!==X||k===0&&_(L,N,B)||V===0&&_(L,U,B)||Y===0&&_(N,L,U)||X===0&&_(N,B,U))}function _(L,B,N){return B.x<=Math.max(L.x,N.x)&&B.x>=Math.min(L.x,N.x)&&B.y<=Math.max(L.y,N.y)&&B.y>=Math.min(L.y,N.y)}function R(L){return L>0?1:L<0?-1:0}function v(L,B){var N=L;do{if(N.i!==L.i&&N.next.i!==L.i&&N.i!==B.i&&N.next.i!==B.i&&O(N,N.next,L,B))return!0;N=N.next}while(N!==L);return!1}function D(L,B){return C(L.prev,L,L.next)<0?C(L,B,L.next)>=0&&C(L,L.prev,B)>=0:C(L,B,L.prev)<0||C(L,L.next,B)<0}function w(L,B){var N=L,U=!1,k=(L.x+B.x)/2,V=(L.y+B.y)/2;do N.y>V!=N.next.y>V&&N.next.y!==N.y&&k<(N.next.x-N.x)*(V-N.y)/(N.next.y-N.y)+N.x&&(U=!U),N=N.next;while(N!==L);return U}function F(L,B){var N=new G(L.i,L.x,L.y),U=new G(B.i,B.x,B.y),k=L.next,V=B.prev;return L.next=B,B.prev=L,N.next=k,k.prev=N,U.next=N,N.prev=U,V.next=U,U.prev=V,U}function H(L,B,N,U){var k=new G(L,B,N);return U?(k.next=U.next,k.prev=U,U.next.prev=k,U.next=k):(k.prev=k,k.next=k),k}function z(L){L.next.prev=L.prev,L.prev.next=L.next,L.prevZ&&(L.prevZ.nextZ=L.nextZ),L.nextZ&&(L.nextZ.prevZ=L.prevZ)}function G(L,B,N){this.i=L,this.x=B,this.y=N,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}e.deviation=function(L,B,N,U){var k=B&&B.length,V=k?B[0]*N:L.length,Y=Math.abs(W(L,0,V,N));if(k)for(var X=0,Z=B.length;X<Z;X++){var Q=B[X]*N,ae=X<Z-1?B[X+1]*N:L.length;Y-=Math.abs(W(L,Q,ae,N))}var he=0;for(X=0;X<U.length;X+=3){var re=U[X]*N,se=U[X+1]*N,K=U[X+2]*N;he+=Math.abs((L[re]-L[K])*(L[se+1]-L[re+1])-(L[re]-L[se])*(L[K+1]-L[re+1]))}return Y===0&&he===0?0:Math.abs((he-Y)/Y)};function W(L,B,N,U){for(var k=0,V=B,Y=N-U;V<N;V+=U)k+=(L[Y]-L[V])*(L[V+1]+L[Y+1]),Y=V;return k}e.flatten=function(L){for(var B=L[0][0].length,N={vertices:[],holes:[],dimensions:B},U=0,k=0;k<L.length;k++){for(var V=0;V<L[k].length;V++)for(var Y=0;Y<B;Y++)N.vertices.push(L[k][V][Y]);k>0&&(U+=L[k-1].length,N.holes.push(U))}return N}}),w0t=(o=>(o[o.MIL=1]="MIL",o[o.INCH=1e3]="INCH",o[o.FT=12e3]="FT",o[o.YARD=36e3]="YARD",o[o.MILE=6336e4]="MILE",o[o.KM=3937007874e-2]="KM",o[o.M=39370]="M",o[o.DM=3937]="DM",o[o.CM=393.7]="CM",o[o.MM=39.37]="MM",o[o.UM=.039]="UM",o[o.NM=394e-7]="NM",o[o.PT=13.88888888888889]="PT",o[o.PX72=13.88888888888889]="PX72",o[o.PX96=10.416666666666666]="PX96",o[o.PX100=10]="PX100",o[o.LTSPICE=6.25]="LTSPICE",o[o.PX1=.1]="PX1",o[o.PX001=.001]="PX001",o))(w0t||{}),L0t=(o=>(o.MIL="mil",o.INCH="inch",o.FT="ft",o.YARD="yard",o.MILE="mile",o.KM="km",o.M="m",o.DM="dm",o.CM="cm",o.MM="mm",o.UM="um",o.NM="nm",o.PT="pt",o.PX72="px(72)",o.PX96="px(96)",o.PX100="px(100)",o))(L0t||{}),D4e={mil:1,inch:1e3,ft:12e3,yard:36e3,mile:6336e4,km:3937007874e-2,dm:3937,mm:39.37,um:.039,nm:394e-7,pt:13.88888888888889,"px(72)":13.88888888888889,"px(96)":10.416666666666666,"px(100)":10},dGt=(()=>{let o={};for(let t in D4e)o[D4e[t]]=t;return o})(),gQ,pGt=(gQ=class{constructor(o,t){this.ratio=o/t}wrap(o){return o*this.ratio}static convert(o,t,e){return o*t/e}},gQ.ASIS=new gQ(1,1),gQ),yQ=class{conversion(o,t,e){if(o===t)return e;let r=o+2+t;return this[r](e)}conversion1(o,t,e){let r=o+2+t,i=this[r](e);return t=="mil"?Math.round(i*10)/10:Math.round(i*1e3)/1e3}mil2mil(o){return o}mil2mm(o){return o*.0254}mil2cm(o){return o*.00254}mil2inch(o){return o/1e3}mm2mm(o){return o}mm2mil(o){let t=Math.pow(10,5);return Math.round(o*39.37007874015748*t)/t}mm2cm(o){return o/10}mm2inch(o){let t=Math.pow(10,8);return Math.round(o*.03937007874015748*t)/t}cm2mil(o){let t=Math.pow(10,6);return Math.round(o*393.7007874015748*t)/t}cm2mm(o){return o*10}cm2inch(o){let t=Math.pow(10,7);return Math.round(o*.3937007874015748*t)/t}inch2mil(o){return o*1e3}inch2mm(o){return o*25.4}inch2cm(o){return o*2.54}};yQ.prototype["px(100)2mil"]=o=>o*10,yQ.prototype["px(100)2mm"]=o=>o*.254,yQ.prototype["mil2px(100)"]=o=>o/10,yQ.prototype["mm2px(100)"]=o=>{let t=Math.pow(10,5);return Math.round(o*3.937007874015748*t)/t};var bQ=null,RPe=new ArrayBuffer(8),W2e=new Float64Array(RPe),z2e=new Uint32Array(RPe),w4e=new Uint16Array(RPe),L4e=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!bQ){let o=this.getUrlVars().version;o?bQ="/analyzer/v"+o:bQ="/analyzer"}return bQ}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;W2e[0]=new Date().getTime(),o.push(z2e[1].toString(16)),W2e[0]=Math.random(),o.push(w4e[3].toString(16));let t=w4e[2].toString(16);o.push("4"+t.substr(0,3)),W2e[0]=performance.now();let e=z2e[0].toString(16)+z2e[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},A6e=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(Ok.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(Ok.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(Ok.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(Ok.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},M0t=(o=>(o[o.UNKNOWN=0]="UNKNOWN",o[o.PERCENT=1]="PERCENT",o[o.LEFT_PAD0=2]="LEFT_PAD0",o))(M0t||{}),N0t=/(\.?0+)$/,Ok=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(L4e.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(L4e.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);A6e.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(N0t,"")}},k0t=(o=>(o[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARNING=2]="WARNING",o[o.ERROR=3]="ERROR",o[o.DUMMY=4]="DUMMY",o))(k0t||{});function B0t(o){switch(o){case 0:return"DEBUG";case 1:return"INFO";case 2:return"WARNING";case 3:return"ERROR";case 4:return"DUMMY"}}var F0t=(o,t)=>{o===3?console.error(t):console.log(t)},V0t=(o,t)=>Ok.format("%s %s: %s",new Date,B0t(o),t),pk,QQ=(pk=class{constructor(o,t=F0t,e=V0t){this.debug=!1,this.level=o,this.writer=t,this.fmt=e}static mix(...o){let t=4;for(let e of o)e.level<t&&(t=e.level);return new pk(t,(e,r)=>{for(let i of o)i.write1(e,r)},(e,r)=>r)}wrap(o=null,t=null){let e=o===null?this.fmt:(i,n)=>(n=o(i,n),this.fmt(i,n)),r=t===null?this.writer:(i,n)=>{t(i,n),this.writer(i,n)};return new pk(this.level,r,e)}chain(o){return o.wrap(this.fmt.bind(this),this.writer.bind(this))}include(o){return this.level<=o}write3(o,t,e){this.include(o)&&this.writer(o,this.fmt(o,Ok.format(t,...e)))}write2(o,t){this.include(o)&&(t instanceof Error?this.writer(o,this.fmt(o,t.stack)):this.writer(o,this.fmt(o,t.toString())))}write1(o,t){this.include(o)&&this.writer(o,this.fmt(o,t))}debug3(o,...t){this.write3(0,o,t)}debug2(o){this.write2(0,o)}debug1(o){this.write1(0,o)}info3(o,...t){this.write3(1,o,t)}info2(o){this.write2(1,o)}info1(o){this.write1(1,o)}warning3(o,...t){this.write3(2,o,t)}warning2(o){this.write2(2,o)}warning1(o){this.write1(2,o)}error3(o,...t){this.write3(3,o,t)}error2(o){this.write2(3,o)}error1(o){this.write1(3,o)}},pk.DUMMY=new pk(4),pk),DPe=new ArrayBuffer(8),Y2e=new Float64Array(DPe),j2e=new Uint32Array(DPe),M4e=new Uint16Array(DPe),N4e=ArrayBuffer;try{N4e=self.HTMLImageElement||N4e}catch{}var PQ=null;function jL(o,t,e=0,r=o.length){i(o,null,t,e,r);function i(s,a,l,c,h){let u,d,p,m;if(c<h-1){let g=h-c;if(g>50)a===null&&(a=new Array(g+1)),n(s,a,l,c,(c+h)/2|0,h);else{u=s[c],d=c,p=c,m=h;let y=d+1;for(;y<m;){if(p!=m){if(m=m+-1,l(u,s[m])<=0)continue;s[p]=s[m],p=m;continue}if(l(u,s[y])>=0){d=y,y=d+1;continue}s[p]=s[y],d=y,p=y,y=d+1}s[p]=u,i(s,a,l,c,p),i(s,a,l,p+1,h)}}}function n(s,a,l,c,h,u){i(s,a,l,c,h),i(s,a,l,h,u);for(var d=c,p=h,m=0,g=s[d],y=s[p];d<h&&p<u;){var b=l(g,y);isNaN(b)?(a[m++]=y,y=s[++p]):(b<=0&&(a[m++]=g,g=s[++d]),b>=0&&(a[m++]=y,y=s[++p]))}for(;d<h;d++)a[m++]=s[d];for(;p<u;p++)a[m++]=s[p];for(d=c,p=0;p<m;d++,p++)s[d]=a[p]}}var S1=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!PQ){let o=this.getUrlVars().version;o?PQ="/analyzer/v"+o:PQ="/analyzer"}return PQ}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;Y2e[0]=new Date().getTime(),o.push(j2e[1].toString(16)),Y2e[0]=Math.random(),o.push(M4e[3].toString(16));let t=M4e[2].toString(16);o.push("4"+t.substr(0,3)),Y2e[0]=performance.now();let e=j2e[0].toString(16)+j2e[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},G0t=[1,10,100,1e3],TQ=0,VL=0;function k4e(o,t,e){return TQ=Math.abs(o-t),e>=5&&TQ>1e-5||isNaN(e)&&TQ>1e-8?!1:TQ<1e-13?!0:(VL=Math.min(B4e(o),B4e(t)),VL<10&&(VL=10),isNaN(e)||(VL=Math.min(VL,e)),F4e(o,VL)===F4e(t,VL))}var IQ=0,CQ=0;function B4e(o){return IQ=0,CQ=0,o>0?IQ=o-Math.floor(o):IQ=o-Math.ceil(o),CQ=(IQ.toString()||"").length,CQ>2?CQ-2:0}function F4e(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=G0t[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}var U0t=(o=>(o[o.UNKNOWN=0]="UNKNOWN",o[o.PERCENT=1]="PERCENT",o[o.LEFT_PAD0=2]="LEFT_PAD0",o))(U0t||{}),H0t=/(\.?0+)$/,Ak=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(S1.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(S1.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);Wu.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(H0t,"")}},Wu=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(Ak.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(Ak.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(Ak.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(Ak.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},SQ,Er=(SQ=class{static regular(o){return Math.round(o*this.precision)/this.precision}static eq(o,t){return Math.abs(o-t)<=this.eps}static neq(o,t){return Math.abs(o-t)>this.eps}static less(o,t){return o-t<-this.eps}static lesseq(o,t){return o-t<=this.eps}static greater(o,t){return o-t>this.eps}static greatereq(o,t){return o-t>=-this.eps}static sqrt(o){return Math.abs(o)<=1e-10?0:Math.sqrt(o)}static sortAsc(o,t){return o-t}static sortDesc(o,t){return t-o}},SQ.eps=1e-8,SQ.precision=1e8,SQ);function xk(o,t){GQ(o.iterator(),t)}function GQ(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var W0t=class{constructor(o){this.idx=-1,this.lst=o}hasNext(){return this.idx<this.lst.length-1}next(){if(this.idx<this.lst.length-1)return this.idx++,this.lst[this.idx];throw new Error("bug")}};function dPe(o){return new W0t(o)}var I1,Qo=(I1=class{static toDegrees(o){return o*180/Math.PI}static toRadians(o){return o/180*Math.PI}static regularD(o){return o=o%360,o=o<0?360+o:o,o===360?0:o}static regular(o){return o=o%I1.PIx2,o=o<0?I1.PIx2+o:o,o===I1.PIx2?0:o}static toQuarterBase(o){return I1.regular((o+I1.PI_4)/I1.PI_2*I1.PI_2)}static toQuarterBaseD(o){return I1.regularD(((o+45)/90|0)*90)}static transformD(o,t){return I1.toDegrees(I1.transform(I1.toRadians(o),t))}static transform(o,t){let e=Math.cos(o),r=Math.sin(o),i=new qt(t.data[6],t.data[7]),n=new qt(e,r).multiply3(t);return I1.regular(n.angle(i))}},I1.PIx2=Math.PI*2,I1.PI_2=Math.PI/2,I1.PI_4=Math.PI/4,I1),up=class{static dotProd1(o,t,e,r){return o*e+t*r}static dotProd2(o,t,e,r,i,n){return this.dotProd1(e-o,r-t,i-e,n-r)}static dotProd3(o,t,e){return this.dotProd2(o.x,o.y,t.x,t.y,e.x,e.y)}static crossProd1(o,t,e,r){return o*r-t*e}static crossProd2(o,t,e,r,i,n){return this.crossProd1(e-o,r-t,i-e,n-r)}static crossProd3(o,t,e){return this.crossProd2(o.x,o.y,t.x,t.y,e.x,e.y)}static distance2(o,t,e,r){let i=e-o,n=r-t;return i*i+n*n}static distance1(o,t,e,r){return this.hypot(e-o,r-t)}static distance1p(o,t){return this.distance1(o.x,o.y,t.x,t.y)}static hypot(o,t){if(o=Math.abs(o),t=Math.abs(t),t>o){var e=t;t=o,o=e}if(o===0)return t;var r=t/o;return o*Math.sqrt(1+r*r)}},_6e=new ArrayBuffer(16),V4e=new Float64Array(_6e),EQ=new Int32Array(_6e),oc,qt=(oc=class{static sortByXAsc(o,t){return o.x-t.x}static sortByYAsc(o,t){return o.y-t.y}static sortByXYAsc(o,t){return o.x<t.x?-1:o.x>t.x?1:o.y-t.y}static caculateAngle(o,t){let e=Math.cos(o),r=Math.sin(o),i=e*t.data[0]+r*t.data[4],n=e*t.data[1]+r*t.data[5],s=new oc(i,n).normalize();return Math.atan2(s.y,s.x)}static normal(o,t,e){let r=t.sub(o),i=e.sub(t);return r.cross(i)}static getVector2(o){return new oc(Math.cos(o),Math.sin(o))}static getCrossPoint1(o,t,e,r){if(o.equals1(t)||e.equals1(r)||Er.eq(1,Math.abs(t.sub(o).normalize().dot(r.sub(e).normalize()))))return null;let i=t.y-o.y,n=o.x-t.x,s=t.x*o.y-o.x*t.y,a=r.y-e.y,l=e.x-r.x,c=r.x*e.y-e.x*r.y,h=i*l-a*n;return new oc((c*n-s*l)/h,(s*a-c*i)/h)}static getCrossPoint2(o,t,e,r){return this.getCrossPoint1(o,o.add(t),e,e.add(r))}constructor(o,t){this.x=Wu.normal(o),this.y=Wu.normal(t)}get hashed(){return this._hashed==null&&(V4e[0]=this.x,V4e[1]=this.y,this._hashed=EQ[0]^EQ[1]^EQ[2]^EQ[3]),this._hashed}dot(o){return this.x*o.x+this.y*o.y}length(){return Math.sqrt(this.dot(this))}getCos(){return this.x/this.length()}sub(o){var t=this.x-o.x,e=this.y-o.y;return new oc(t,e)}add(o){var t=this.x+o.x,e=this.y+o.y;return new oc(t,e)}div(o){return new oc(this.x/o,this.y/o)}add1(o,t){return new oc(this.x+o,this.y+t)}mul(o){return new oc(this.x*o,this.y*o)}cross(o){return this.x*o.y-this.y*o.x}getSin(){return this.y/this.length()}angle2(o){let t=this.y-o.y,e=this.x-o.x;return t=Math.abs(t-0)<10**-4?0:t,e=Math.abs(e-0)<10**-4?0:e,Math.atan2(t,e)}angleD2(o){return Qo.toDegrees(this.angle2(o))}angle(o){return Math.atan2(this.y-o.y,this.x-o.x)}angleX(o=oc.ORIGIN){let t=this.angle(o);return t<0&&(t=Math.PI*2+t),t}angleD(o){return Qo.toDegrees(this.angle(o))}distance1(o){let t=o.x-this.x,e=o.y-this.y;return up.hypot(t,e)}distance2(o){let t=o.x-this.x,e=o.y-this.y;return t*t+e*e}rotateD(o,t){return this.rotate(o,Qo.toRadians(t))}rotate(o,t){let e=Math.cos(t),r=Math.sin(t),i=this.x-o.x,n=this.y-o.y,s=i*e+n*-r,a=i*r+n*e;return o.add1(s,a)}multiply3(o){let t=this.x*o.data[0]+this.y*o.data[3]+o.data[6],e=this.x*o.data[1]+this.y*o.data[4]+o.data[7];return new oc(t,e)}multiply4(o){let t=this.x*o.data[0]+this.y*o.data[4]+o.data[12],e=this.x*o.data[1]+this.y*o.data[5]+o.data[13];return new oc(t,e)}hashCode(){return this.hashed}equals(o,t){return o instanceof oc?k4e(o.x,this.x,t)&&k4e(o.y,this.y,t):!1}equals1(o){return o?Er.eq(this.x,o.x)&&Er.eq(this.y,o.y):!1}equals2(o,t){return o instanceof oc?Math.abs(this.x-o.x)<=t&&Math.abs(this.y-o.y)<=t:!1}similarEquals(o,t=.5){return Math.abs(this.x*.1-o.x*.1)<=t&&Math.abs(this.y*.1-o.y*.1)<=t}toString(){return"Vector [X="+this.x+", Y="+this.y+"]"}bbox(){let o=this.x,t=this.y;return new C1(o,o,t,t)}normalize(){if(this.x===0&&this.y===0)return new oc(0,0);let o=this.x/this.length(),t=this.y/this.length();return new oc(o,t)}regular(o=1e-4){let t=Math.round(1/o);return new oc(Math.round(this.x*t)/t,Math.round(this.y*t)/t)}round(o=4){let t=10**(o|0);return new oc(Math.round(this.x*t)/t,Math.round(this.y*t)/t)}mirrorX(o=oc.ORIGIN){return new oc(this.x,2*o.y-this.y)}mirrorY(o=oc.ORIGIN){return new oc(2*o.x-this.x,this.y)}mirrorCenter(o=oc.ORIGIN){return new oc(2*o.x-this.x,2*o.y-this.y)}clone(){return new oc(this.x,this.y)}mirror(o=oc.ORIGIN){return new oc(2*o.x-this.x,2*o.y-this.y)}pointOnRays(o,t){let e=Qo.toRadians(o);return new oc(this.x+Math.cos(e)*t,this.y+Math.sin(e)*t)}pointOnRays2(o,t){let e=o.angle(this);return new oc(this.x+Math.cos(e)*t,this.y+Math.sin(e)*t)}scale(o){return new oc(this.x*o,this.y*o)}},oc.ORIGIN=new oc(0,0),oc.X_UNIT_VECTOR=new oc(1,0),oc.Y_UNIT_VECTOR=new oc(0,1),oc),z0t=(o=>(o[o.LEFT=0]="LEFT",o[o.CENTER=1]="CENTER",o[o.RIGHT=2]="RIGHT",o))(z0t||{}),Y0t=(o=>(o[o.TOP=0]="TOP",o[o.CENTER=1]="CENTER",o[o.BOTTOM=2]="BOTTOM",o))(Y0t||{}),im,HO=(im=class{constructor(o,t){this.horizontal=o,this.vertical=t}},im.LT=new im(0,0),im.LC=new im(0,1),im.LB=new im(0,2),im.CT=new im(1,0),im.CC=new im(1,1),im.CB=new im(1,2),im.RT=new im(2,0),im.RC=new im(2,1),im.RB=new im(2,2),im),j0t=(o=>(o[o.INNER=0]="INNER",o[o.OUTER=1]="OUTER",o[o.SEPARATED=2]="SEPARATED",o[o.INTERSECTED=3]="INTERSECTED",o[o.EQ=4]="EQ",o[o.INSIDE_TOUCHED=5]="INSIDE_TOUCHED",o[o.OUTSIDE_TOUCHED=6]="OUTSIDE_TOUCHED",o))(j0t||{}),L2=class{constructor(){this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY}ext1(o){return this.minX=Math.min(this.minX,o.minX),this.maxX=Math.max(this.maxX,o.maxX),this.minY=Math.min(this.minY,o.minY),this.maxY=Math.max(this.maxY,o.maxY),this}ext2(o){return this.minX=Math.min(this.minX,o.x),this.maxX=Math.max(this.maxX,o.x),this.minY=Math.min(this.minY,o.y),this.maxY=Math.max(this.maxY,o.y),this}ext3(o){for(let t=0;t<o.length;t++){let e=o[t];this.ext2(e)}return this}ext4(o){return xk(o,(t,e)=>(this.ext2(e),!0)),this}ext5(o,t,e,r){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,t),this.minY=Math.min(this.minY,e),this.maxY=Math.max(this.maxY,r),this}ext6(o,t){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,o),this.minY=Math.min(this.minY,t),this.maxY=Math.max(this.maxY,t),this}ext7(o){if(o<0){let t=o*2;if(t<this.minX-this.maxX||t<this.minY-this.maxY)throw new Error("")}return this.minX-=o,this.maxX+=o,this.minY-=o,this.maxY+=o,this}ext8(o){let t=[];for(let e=0;e<o.length;e+=2)t.push(new qt(o[e],o[e+1]));return this.ext3(t)}ext9(o,t,e,r){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,o+e),this.minY=Math.min(this.minY,t),this.maxY=Math.max(this.maxY,t+r),this}ext10({x:o,y:t,width:e,height:r}){return this.ext9(o,t,e,r)}valid(){return isFinite(this.minX)&&isFinite(this.maxX)&&isFinite(this.minY)&&isFinite(this.maxY)}clear(){this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY}build(){return new C1(this.minX,this.maxX,this.minY,this.maxY)}build1(){return this.valid()?new C1(this.minX,this.maxX,this.minY,this.maxY):new C1(0,0,0,0)}},VW=new Float64Array(4),C1=class SI{static extendRect({x:t,y:e,width:r,height:i}){return new SI(t,t+r,e,e+i)}static extend1(t,e){if(t===null)return new SI(e.x,e.x,e.y,e.y);{let r=Math.min(t.minX,e.x),i=Math.max(t.maxX,e.x),n=Math.min(t.minY,e.y),s=Math.max(t.maxY,e.y);return new SI(r,i,n,s)}}static extend2(t,e){if(t){let r=Math.min(t.minX,e.minX),i=Math.max(t.maxX,e.maxX),n=Math.min(t.minY,e.minY),s=Math.max(t.maxY,e.maxY);return new SI(r,i,n,s)}else return e}static extend3(t,e){let r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),n=Math.min(t.y,e.y),s=Math.max(t.y,e.y);return new SI(r,i,n,s)}static extend4(t,e,r){return new SI(t.x-e/2,t.x+e/2,t.y-r/2,t.y+r/2)}constructor(t,e,r,i){if(this.minX=Wu.normal(t),this.maxX=Wu.normal(e),this.minY=Wu.normal(r),this.maxY=Wu.normal(i),t>e||r>i)throw new Error(`min > max is not permitted: [${t}, ${e}, ${r}, ${i}]`)}get data(){return VW[0]=this.minX,VW[1]=this.maxX,VW[2]=this.minY,VW[3]=this.maxY,VW}isContains(t){return this.isContains1(t.x,t.y)}points(){return[this.LL(),this.LR(),this.UR(),this.UL(),this.LL()]}isContains1(t,e){return this.isContainsX(t)&&this.isContainsY(e)}isContains2(t,e){return this.isContainsX1(t)&&this.isContainsY1(e)}isContainsX(t){return t>=this.minX&&t<=this.maxX}isContainsX1(t){return Er.greatereq(t,this.minX)&&Er.lesseq(t,this.maxX)}isContainsY(t){return t>=this.minY&&t<=this.maxY}isContainsY1(t){return Er.greatereq(t,this.minY)&&Er.lesseq(t,this.maxY)}isIntersect(t){return!(this.maxX<t.minX||this.minX>t.maxX||this.maxY<t.minY||this.minY>t.maxY)}extendOfSize(t){return Wu.positiveOr0(this.maxX-this.minX+t*2),Wu.positiveOr0(this.maxY-this.minY+t*2),new SI(this.minX-t,this.maxX+t,this.minY-t,this.maxY+t)}isInside(t){return this.minX>=t.minX&&this.maxX<=t.maxX&&this.minY>=t.minY&&this.maxY<=t.maxY}isContainsBBox(t){return this.maxX>=t.maxX&&this.minX<=t.minX&&this.maxY>=t.maxY&&this.minY<=t.minY}isContainsBBox1(t){return Er.greatereq(this.maxX,t.maxX)&&Er.lesseq(this.minX,t.minX)&&Er.greatereq(this.maxY,t.maxY)&&Er.lesseq(this.minY,t.minY)}intersect(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX);if(e>r)return null;let i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY);return i>n?null:new SI(e,r,i,n)}intersection1(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX);if(Er.greater(e,r))return null;e>r&&(r=e);let i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY);return Er.greater(i,n)?null:(i>n&&(n=i),new SI(e,r,i,n))}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}UL(){return new qt(this.minX,this.maxY)}UR(){return new qt(this.maxX,this.maxY)}LL(){return new qt(this.minX,this.minY)}LR(){return new qt(this.maxX,this.minY)}center(){return new qt(this.maxX-(this.maxX-this.minX)/2,this.maxY-(this.maxY-this.minY)/2)}area(){return this.width()*this.height()}transform(t){let e=new L2;return e.ext2(this.LL().multiply3(t)),e.ext2(this.LR().multiply3(t)),e.ext2(this.UR().multiply3(t)),e.ext2(this.UL().multiply3(t)),e.build()}transform4(t){let e=new L2;return e.ext2(this.LL().multiply4(t)),e.ext2(this.LR().multiply4(t)),e.ext2(this.UR().multiply4(t)),e.ext2(this.UL().multiply4(t)),e.build()}isSeparated(t){if(t==null||t==null)return!1;let e;this.minX>=t.minX?e=this.minX:e=t.minX;let r;if(this.maxX<=t.maxX?r=this.maxX:r=t.maxX,e>r)return!0;{let i;this.minY>=t.minY?i=this.minY:i=t.minY;let n;return this.maxY<=t.maxY?n=this.maxY:n=t.maxY,i>n}}relation(t){let e=0,r=0,i;this.minX>t.minX?(e++,i=this.minX):this.minX===t.minX?i=this.minX:(r++,i=t.minX);let n;if(this.maxX<t.maxX?(e++,n=this.maxX):this.maxX===t.maxX?n=this.maxX:(r++,n=t.maxX),i>n)return 2;{let s;this.minY>t.minY?(e++,s=this.minY):this.minY===t.minY?s=this.minY:(r++,s=t.minY);let a;return this.maxY<t.maxY?(e++,a=this.maxY):this.maxY===t.maxY?a=this.maxY:(r++,a=t.maxY),s>a?2:e===4?0:r===4?1:e===0&&r===0?4:i===n||s===a?6:e!==r?5:3}}zoom(t){let e=this.width(),r=this.height(),i=this.center();return t!=0&&(e/=t/2,r/=t/2),new SI(i.x-e,i.x+e,i.y-e,i.y+e)}toString(){return"BBox [minX="+this.minX+", maxX="+this.maxX+", minY="+this.minY+", maxY="+this.maxY+"]"}equals(t){return this.minY==t.minY&&this.minX==t.minX&&this.maxX==t.maxX&&this.maxY==t.maxY}extendSize(t,e){return Object.is(void 0,e)&&(e=t),SI.extend4(this.center(),this.width()+t,this.height()+e)}positionOnBBox(t,e=0){let r=this.center(),i=this.width()*e/2,n=this.height()*e/2,s=t.x-r.x,a=t.y-r.y;return s>i?a>n?HO.RT:a<-n?HO.RB:HO.RC:s<-i?a>n?HO.LT:a<-n?HO.LB:HO.LC:a>n?HO.CT:a<-n?HO.CB:HO.CC}bbox(){return this}},UQ=class xl{static mul(t,e,r,i,n,s){let a=0,l=0;for(let c=0;c<t;c++){for(let h=0;h<r;h++){let u=h,d=0;for(let p=0;p<e;p++)d+=i[l+p]*n[u],u+=r;s[a++]=d}l+=e}}constructor(t,e,r){this.m=Wu.normal(t),this.n=Wu.normal(e);let i=t*e;if(r.length===i){for(let n=0;n<r.length;n++)Wu.normal(r[n]);this.data=r}else throw new Error("invalid matrix size")}mul(t){if(this.n===t.m){let e=new Array(this.m*t.n);return xl.mul(this.m,this.n,t.n,this.data,t.data,e),new xl(this.m,t.n,e)}else throw new Error("m !== p")}toString(){let t=[];t.push("Matrix ("),t.push(this.m.toString()),t.push(" x "),t.push(this.n.toString()),t.push(")");let e=0;for(let r=0;r<this.m;r++)for(let i=0;i<this.n;i++){let n=this.data[e++].toString();i===0?(t.push(`
`),t.push("	"),t.push(n)):(t.push(", "),t.push(n))}return t.join("")}static on(t,e,r){return t*e+r}initExpandMatrix(t){let e=this.m,r=this.n,i=r*2,n=new Array(e*i);for(let s=0;s<e;s++)for(let a=0;a<i;a++)a<r?n[xl.on(i,s,a)]=t[xl.on(r,s,a)]:a===e+s?n[xl.on(i,s,a)]=1:n[xl.on(i,s,a)]=0;return n}inverseMatrix(t,e,r){for(let i=0;i<e;i++){let n=t[xl.on(r,i,i)];for(let s=0;s<r;s++)t[xl.on(r,i,s)]/=n}return t}getMatrixRank(t,e,r){let i=Math.min(e,r);for(let n=0;n<e;n++){if(t[xl.on(r,n,n)]===0){let s=new Array(r),a;for(a=n;a<e;a++)if(t[xl.on(r,a,n)]!==0){S1.arraycopy(t,xl.on(r,a,0),s,0,r),S1.arraycopy(t,xl.on(r,n,0),t,xl.on(r,a,0),r),S1.arraycopy(s,0,t,xl.on(r,n,0),r);break}a>=e&&(i-=1)}if(!(i<e))for(let s=0;s<e;s++){if(s===n)continue;let a=t[xl.on(r,s,n)]/t[xl.on(r,n,n)];for(let l=0;l<r;l++)t[xl.on(r,s,l)]-=t[xl.on(r,n,l)]*a}}return i}getInverseMatrix(){if(this.m!==this.n)throw new Error("The matrix is an "+this.m+"x"+this.n+" order matrix, non-square matrix, please check!");function t(s){return Er.lesseq(Math.abs(s),0)}let e=this.initExpandMatrix(this.data.slice(0)),r=this.n*2;function i(s,a){for(let l=0;l<r;l++){let c=e[xl.on(r,s,l)];e[xl.on(r,s,l)]=e[xl.on(r,a,l)],e[xl.on(r,a,l)]=c}}for(let s=0;s<this.m;s++){let a=Math.abs(e[xl.on(r,s,s)]),l=s;if(t(e[xl.on(r,s,s)]))for(let h=s+1;h<this.m;h++){if(t(e[xl.on(r,h,s)])){Math.abs(e[xl.on(r,h,s)])>a&&(a=Math.abs(e[xl.on(r,h,s)]),l=h);continue}i(s,h);break}if(t(e[xl.on(r,s,s)])){if(a===0)throw new Error("The matrix is a non-full rank matrix, please check!");console.warn("The matrix may be a non-full rank matrix, please check!"),l!==s&&i(s,l)}let c=1/e[xl.on(r,s,s)];for(let h=0;h<r;h++)e[xl.on(r,s,h)]*=c;for(let h=0;h<this.m;h++){if(s===h)continue;let u=e[xl.on(r,h,s)];for(let d=s;d<r;d++)e[xl.on(r,h,d)]-=e[xl.on(r,s,d)]*u}}let n=[];for(let s=0;s<this.m;s++)for(let a=this.n;a<r;a++)n[xl.on(this.n,s,a-this.n)]=e[xl.on(r,s,a)];return new xl(this.m,this.n,n)}getTransposeMatrix(){let t=new Array(this.data.length);for(let e=0;e<this.m;e++)for(let r=0;r<this.n;r++)t[r*this.n+e]=this.data[e*this.m+r];return new xl(this.n,this.m,t)}hashCode(){let t=0;for(let e of this.data)t+=e;return t}equals(t){return this===t?!0:t===null?!1:t instanceof xl?!(this.m!=t.m||this.n!=t.n||!S1.equals(this.data,t.data)):!1}},X0t=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],sd,v6e=(sd=class extends UQ{static translate(o,t,e){return new sd([1,0,0,0,0,1,0,0,0,0,1,0,o,t,e,1])}static translate1(o){return new sd([1,0,0,0,0,1,0,0,0,0,1,0,o.x,o.y,o.z,1])}static rotateX(o){let t=Math.cos(o),e=Math.sin(o);return new sd([1,0,0,0,0,t,e,0,0,-e,t,0,0,0,0,1])}static rotateY(o){let t=Math.cos(o),e=Math.sin(o);return new sd([t,0,-e,0,0,1,0,0,e,0,t,0,0,0,0,1])}static rotateZ(o){let t=Math.cos(o),e=Math.sin(o);return new sd([t,e,0,0,-e,t,0,0,0,0,1,0,0,0,0,1])}static rotateAxis(o,t){o=o.normalize();let e=o.x,r=o.y,i=o.z,n=Math.sin(t),s=Math.cos(t);return new sd([e*e*(1-s)+s,e*r*(1-s)+i*n,e*i*(1-s)-r*n,0,e*r*(1-s)-i*n,r*r*(1-s)+s,r*i*(1-s)+e*n,0,e*i*(1-s)+r*n,r*i*(1-s)-e*n,i*i*(1-s)+s,0,0,0,0,1])}static scale(o,t=o,e=o){return new sd([o,0,0,0,0,t,0,0,0,0,e,0,0,0,0,1])}static flipX(){return new sd([1,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,1])}static flipY(){return new sd([-1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static rotateZForPoint(o,t){return o.equals1(qt.ORIGIN)?sd.rotateZ(t):sd.translate(-o.x,-o.y,0).rotateZ(t).translate1(o.x,o.y,0)}static getMatrix4(o,t,e,r){let i=Math.cos(t),n=Math.sin(t),s=e*(o.x*i-o.y*n)+r.x,a=o.x*n+o.y*i+r.y,l=[e*i,n,0,0,-n*e,i,0,0,0,0,1,0,s,a,0,1];return new sd(l)}constructor(o=X0t){super(4,4,o)}translate(o){return this.multiply4(sd.translate1(o))}translate1(o,t,e){return this.multiply4(sd.translate(o,t,e))}rotateX(o){return this.multiply4(sd.rotateX(o))}rotateY(o){return this.multiply4(sd.rotateY(o))}rotateZ(o){return this.multiply4(sd.rotateZ(o))}scale(o,t=o,e=o){return this.multiply4(sd.scale(o,t,e))}scale1(o){return this.multiply4(sd.scale(o.x,o.y,o.z))}setOrigin(o,t,e){return sd.translate(-o,-t,-e).multiply4(this).translate1(o,t,e)}setOrigin1(o){return this.setOrigin(o.x,o.y,o.z)}multiply4(o){let t=new Array(16);return UQ.mul(4,4,4,this.data,o.data,t),new sd(t)}getInverseMatrix(){let o=super.getInverseMatrix();return new sd(o.data)}getTransposeMatrix(){let o=super.getTransposeMatrix();return new sd(o.data)}inverse(){let o=this.getInverseMatrix();return new sd(o.data)}toMatrix3(){let o=this.data;return new y0([o[0],o[1],0,o[4],o[5],0,o[12],o[13],1])}},sd.ORIGIN=new sd,sd);function GW(o){return A6e.normal(parseFloat(o))}var q0t=[1,0,0,0,1,0,0,0,1],bu,y0=(bu=class extends UQ{static translate(o,t){return new bu([1,0,0,0,1,0,o,t,1])}static translate1(o){return this.translate(o.x,o.y)}static rotate(o){let t=Math.cos(o),e=Math.sin(o);return new bu([t,e,0,-e,t,0,0,0,1])}static rotateD(o){return this.rotate(Qo.toRadians(o))}static scale(o,t=o){return new bu([o,0,0,0,t,0,0,0,1])}static scale1(o,t){return new bu([o,0,0,0,t,0,0,0,1])}static toDOMMatrix(o){let[t,e,,r,i,,n,s]=o.data;return`matrix(${[t,e,r,i,n,s].join(",")})`}static svgTrasform(o){let t=o.split(" "),e=null;return t.forEach(r=>{r=r.trim();let i=r.trim().replace(")","").split("("),n=i[0],s=i[1].split(",");switch(n){case"translate":let a=GW(s[0]),l=GW(s[1]);e=e?e.translate(a,l):bu.translate(a,l);break;case"rotate":let c=GW(s[0]),h=GW(s[1]),u=GW(s[2]);e=e?e.setOrigin(h,u):bu.translate(h,u),e=e.rotateD(c);break;default:return}}),e}constructor(o=q0t){super(3,3,o);let t=o[0],e=o[3],r=o[1],i=o[4];this.iScale=Math.sqrt(t*t+r*r),this.jScale=Math.sqrt(e*e+i*i)}isMirrored(){return this.det()<0}multiply3(o){let t=new Array(9);return UQ.mul(3,3,3,this.data,o.data,t),new bu(t)}translate(o,t){return this.multiply3(bu.translate(o,t))}translate1(o){return this.multiply3(bu.translate1(o))}scale(o,t=o){return this.multiply3(bu.scale(o,t))}scale1(o,t){return this.multiply3(bu.scale1(o,t))}det(){return this.data[0]*this.data[4]-this.data[3]*this.data[1]}invert(){let o=this.getInverseMatrix();return new bu(o.data)}rotateD(o){return this.multiply3(bu.rotateD(o))}rotate(o){return this.multiply3(bu.rotate(o))}resetOffset(){let o=this.data;return new bu([o[0],o[1],0,o[3],o[4],0,0,0,1])}setOrigin(o,t){return bu.translate(-o,-t).multiply3(this).translate(o,t)}setOrigin1(o){return this.setOrigin(o.x,o.y)}getInverseMatrix(){return new bu(super.getInverseMatrix().data)}getTransposeMatrix(){let o=super.getTransposeMatrix();return new bu(o.data)}toMatrix4(){let o=this.data;return new v6e([o[0],o[1],0,o[2],o[3],o[4],0,o[5],0,0,1,0,o[6],o[7],0,o[8]])}scaleNum(o){return!o||isNaN(o)?o:o*this.iScale}},bu.ORIGIN=new bu,bu.MIRROR_Y=new bu([1,0,0,0,-1,0,0,0,1]),bu.MIRROR_X=new bu([-1,0,0,0,1,0,0,0,1]),bu.ROT_90=new bu([0,1,0,-1,0,0,0,0,1]),bu.ROT_N90=new bu([0,-1,0,1,0,0,0,0,1]),bu),$0t=(o=>(o[o.BUTT=0]="BUTT",o[o.ROUND=1]="ROUND",o[o.SQUARE=2]="SQUARE",o))($0t||{}),K0t=(o=>(o[o.CW=0]="CW",o[o.CCW=1]="CCW",o))(K0t||{}),sz=class{},pPe=class YW{constructor(t,e,r){this.p1=t,this.p2=e,this.p3=r}barycentre(){return YW.barycentre(this.p1,this.p2,this.p3)}incentre(){return YW.incentre(this.p1,this.p2,this.p3)}static barycentre(t,e,r){let i=t.x+e.x+r.x,n=t.y+e.y+r.y;return new qt(i/3,n/3)}static incentre(t,e,r){let i=e.sub(r).length(),n=t.sub(r).length(),s=t.sub(e).length(),a=i+n+s,l=i*t.x+n*e.x+s*r.x,c=i*t.y+n*e.y+s*r.y;return new qt(l/a,c/a)}area(){return YW.area(this.p1,this.p2,this.p3)}static area(t,e,r){return this.area2(t.x,t.y,e.x,e.y,r.x,r.y)/2}static area2(t,e,r,i,n,s){return Math.abs(up.crossProd2(t,e,r,i,n,s))}scale(t,e){let r=y0.translate(-t.x,-t.y).scale(e).translate1(t),i=this.p1.multiply3(r),n=this.p2.multiply3(r),s=this.p3.multiply3(r);return new YW(i,n,s)}scaleOnBarycentre(t){return this.scale(this.barycentre(),t)}scaleOnIncentre(t){return this.scale(this.incentre(),t)}extend(t){let e=this.incentre(),r=this.p1.add(this.p2).sub(e).scale(1/2),i=r.length(),n=qt.ORIGIN.pointOnRays2(r,i+t).length()/i;return this.scaleOnIncentre(n)}container(t){let e=this.p3.sub(this.p1),r=this.p2.sub(this.p1),i=t.sub(this.p1),n=e.dot(e),s=e.dot(r),a=e.dot(i),l=r.dot(r),c=r.dot(i),h=1/(n*l-s*s),u=(l*a-s*c)*h;if(u<0||u>1)return!1;let d=(n*c-s*a)*h;return d<0||d>1?!1:u+d<=1}};function OQ(){return{minDistance:Number.POSITIVE_INFINITY,start:null,end:null}}var SS=class Hv{static getMinDistanceWithoutCross(t,e){let r=OQ();return Hv.minLine(t,e,r),r.minDistance}static getMinDistance(t,e){return EI(t,e)?0:this.getMinDistanceWithoutCross(t,e)}static getMinLineWithCross(t,e){let r=OQ();return Hv.minLine(t,e,r),new Ct(r.start,r.end)}static getMinLine(t,e){return Hv.intersection(t,e)||this.getMinLineWithCross(t,e)}static getMinDistanceFromPoint(t,e){let r=OQ();if(e instanceof Ct)this.point2LineMinLine(r,e,t);else if(e instanceof Ir)this.point2ArcMinDistance(t,e,r);else throw new Error("not support");return r.minDistance}constructor(t,e){if(this.pt1=t,this.pt2=e,this.minline=Hv.intersection(t,e),this.minline)this.minDistance=0;else{let r=OQ();Hv.minLine(t,e,r),this.minline=new Ct(r.start,r.end),this.minDistance=r.minDistance}}getDistance(){return this.minDistance}getLine(){return this.minline}static intersection(t,e){let r=EI(t,e);if(r===0)return;let i=new Array;for(let n=0;n<r;n+=2){let s=new qt(st[n],st[n+1]);i.push(s)}return i.length>1?new Ct(i[0],i[1]):new Ct(i[0],i[0])}static minLine(t,e,r){if(t instanceof Ct&&e instanceof Ct)return this.minDistanceForLines(t,e,r);if(t instanceof Ir&&e instanceof Ct)return this.minDistanceForLineAndArc(t,e,r);if(t instanceof Ct&&e instanceof Ir)return this.minDistanceForLineAndArc(e,t,r);if(t instanceof Ir&&e instanceof Ir)return this.minDistanceForArcs(t,e,r);throw new Error("not support")}static minDistanceForLines(t,e,r){[t.start(),t.end(),e.start(),e.end()].forEach((i,n)=>{n<2?this.point2LineMinLine(r,e,i):this.point2LineMinLine(r,t,i)})}static minDistanceForLineAndArc(t,e,r){this.point2LineMinLine(r,e,t.start()),this.point2LineMinLine(r,e,t.svgEnd);let i=Hv.foot(e,t.center);e.bbox().extendOfSize(1e-8).isContains(i)&&this.point2ArcMinLine(r,t,i),this.point2ArcMinLine(r,t,e.start()),this.point2ArcMinLine(r,t,e.end())}static minDistanceForArcs(t,e,r){this.concentricArc(t,e,r),this.point2ArcMinDistance(e.start(),t,r),this.point2ArcMinDistance(e.svgEnd,t,r),this.point2ArcMinDistance(t.start(),e,r),this.point2ArcMinDistance(t.svgEnd,e,r),(TS(t,e.center)||TS(e,t.center))&&this.shortestLineForArcs(t,e,r)}static minLineForArcAndLine(t,e,r){let i=t.pointOn(r.angleD(t.center)),n=t.pointOn(t.center.angleD(r));this.arcShortestLine(t,e,r,i),this.arcShortestLine(t,e,r,n)}static arcInnerLineFootSegment(t,e,r){let i=r.distance1(t.center);if(i!==0){let n=t.rx*(r.y-t.center.y)/i+t.center.y,s=t.rx*(r.x-t.center.x)/i+t.center.x;i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=new qt(s,n),e.end=r)}else i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=t.start(),e.end=r)}static shortestLineForArcs(t,e,r){let i=t.center.angleD(e.center),n=e.center.angleD(t.center),s=t.pointOn(i),a=t.pointOn(n),l=e.pointOn(i),c=e.pointOn(n);TS(t,s)&&(this.arcShortestLine(e,r,s,l),this.arcShortestLine(e,r,s,c)),TS(t,a)&&(this.arcShortestLine(e,r,a,l),this.arcShortestLine(e,r,a,c)),this.shortestLineForArcs1(t,e,r)}static shortestLineForArcs1(t,e,r){let i=e.start().sub(t.center).normalize(),n=e.end().sub(t.center).normalize(),s=t.start().sub(e.center).normalize(),a=t.end().sub(e.center).normalize(),l=t.center.add(i.mul(t.rx)),c=t.center.add(n.mul(t.rx)),h=e.center.add(s.mul(e.rx)),u=e.center.add(a.mul(e.rx));TS(t,l)&&Er.greater(e.start().distance2(t.center),0)&&this.arcShortestLine(t,r,e.start(),l),TS(t,c)&&Er.greater(e.end().distance2(t.center),0)&&this.arcShortestLine(t,r,e.end(),c),TS(e,h)&&Er.greater(t.start().distance2(e.center),0)&&this.arcShortestLine(e,r,t.start(),h),TS(e,u)&&Er.greater(t.end().distance2(e.center),0)&&this.arcShortestLine(e,r,t.end(),u)}static concentricArc(t,e,r){if(!(t.center.distance1(e.center)<1e-5&&t.rx===e.rx&&t.ry===e.ry))return;let i=t.start().distance1(e.svgEnd);i<r.minDistance&&(r.minDistance=i,r.start=t.start(),r.end=e.svgEnd),i=e.start().distance1(t.svgEnd),i<r.minDistance&&(r.minDistance=i,r.start=e.start(),r.end=t.svgEnd)}static point2ArcMinDistance(t,e,r){if(TS(e,t)){let i=e.pointOn(t.angleD(e.center)),n=e.pointOn(e.center.angleD(t));this.arcShortestLine(e,r,t,i),this.arcShortestLine(e,r,t,n)}else this.minLineSegment(r,e.start(),t),this.minLineSegment(r,e.svgEnd,t)}static point2ArcMinLine(t,e,r){if(TS(e,r)){let i=r.distance1(e.center);i>e.rx||i>e.ry?this.minLineForArcAndLine(e,t,r):this.arcInnerLineFootSegment(e,t,r)}}static point2LineMinLine(t,e,r){let i=Hv.foot(e,r);e.bbox().extendOfSize(1e-8).isContains(i)?this.minLineSegment(t,i,r):(this.minLineSegment(t,e.start(),r),this.minLineSegment(t,e.end(),r))}static minLineSegment(t,e,r){let i=e.distance1(r);i<t.minDistance&&(t.minDistance=i,t.start=e,t.end=r)}static arcShortestLine(t,e,r,i){if(!TS(t,i))return;let n=r.distance1(i);n<e.minDistance&&(e.minDistance=n,e.start=r,e.end=i)}static foot(t,e){if(t.isPoint())return t.start();if(!Er.eq(t.b,0)&&!Er.eq(t.a,0)){let r=t.start(),i=t.direct,n=(e.x-r.x)*i.x+(e.y-r.y)*i.y;return new qt(r.x+i.x*n,r.y+i.y*n)}else return Er.eq(t.b,0)&&!Er.eq(t.a,0)?new qt(t.start().x,e.y):!Er.eq(t.b,0)&&Er.eq(t.a,0)?new qt(e.x,t.start().y):e}};function TS(o,t){if(Er.eq(o.sweepAngle,360))return!0;let e=Qo.regularD(t.angleD(o.center));return o.sweepAngle>0?(Er.less(e,o.startAngle)&&(e+=360),Er.greatereq(o.endAngle(),e)):(Er.greater(e,o.startAngle)&&(e-=360),Er.lesseq(o.endAngle(),e))}var Z0t=[1,10,100,1e3],G4e="http://www.w3.org/2000/svg",U4e="http://www.w3.org/1999/xlink",H4e="http://www.w3.org/XML/1998/namespace",W4e="https://easyeda.com/",fGt=(function(){var o={svg:G4e,xlink:U4e,xml:H4e,c:W4e};return o[G4e]="svg",o[U4e]="xlink",o[H4e]="xml",o[W4e]="c",o})(),g0=(function(){var o={RATLINES:9,MODEL3D:19,ALL:11,TOPSILKLAYER:3,TOPLAYER:1,TOPPASTERLAYER:5,TOPSOLDERLAYER:7,LIBBODY:99,PADSURFACE:100,BOARDOUTLINE:10,DOCUMENT:12,TOPASSEMBLY:13,MECHANICAL:15,TOPCOMPONENT:16,SUBSTRATE:18},t;for(t=21;t<53;t++)o["INNER"+(t-20)]=t;for(o.BOTTOMSILKLAYER=4,o.BOTTOMLAYER=2,o.BOTTOMPASTERLAYER=6,o.BOTTOMSOLDERLAYER=8,o.BOTTOMASSEMBLY=14,o.BOTTOMCOMPONENT=17,t=53;t<85;t++)o["BOARD"+(t-52)]=t;return o})(),mGt=(function(){var o={COPPERAREA:[1,2,21,22,23,24],PLANEZONE:[1,2,21,22,23,24],RECT:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,99],TRACK:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],PAD:[11,1,2],VIA:[11],HOLE:[11],TEXT:[3,4,1,2,7,8,12,13,14,15,21,22,23,24],ARC:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],ELLIPSE:[3,4,12,13,14,15],CIRCLE:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],DIMENSION:[3,4,12,13,14,15],FOOTPRINT:[1,2],SOLIDREGION:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,11,99,100],SVGNODE:[1,2,3,4,7,8,12,13,14,15],PROTRACTOR:[3,4,12,13,14,15],SHEET:[12,13,14,15]};o["3D"]=(function(){for(var i=[16,19,3,7,5,1],n=21;n<52;n++)i.push(n+32,n);return i.push(2,6,8,4,17),i})();var t,e,r;for(t in o)if(o.hasOwnProperty(t)&&(r=o[t],r.indexOf(21)>0&&r.indexOf(25)===-1))for(e=25;e<=52;e++)r.push(e);return o})(),Km=(function(){var o={1:"TopLayer",2:"BottomLayer",3:"TopSilkLayer",4:"BottomSilkLayer",5:"TopPasteMaskLayer",6:"BottomPasteMaskLayer",7:"TopSolderMaskLayer",8:"BottomSolderMaskLayer",9:"Ratlines",10:"BoardOutLine",11:"Multi-Layer",12:"Document",13:"TopAssembly",14:"BottomAssembly",15:"Mechanical",16:"TopComponents",17:"BottomComponents",18:"Substrate",19:"3DModel",99:"ComponentShapeLayer",100:"LeadShapeLayer"},t;for(t=21;t<53;t++)o[t]="Inner"+(t-20);for(t=53;t<85;t++)o[t]="Substrate"+(t-52);return o})(),gGt=(function(){var o=[],t=[];for(var e in g0)if(g0.hasOwnProperty(e)){if(e.match(/^BOARD\d+/))continue;o.push(g0[e])}o.sort(),t.sort();var r={},i,n={21:"#999966",22:"#008000",23:"#00FF00",24:"#BC8E00",25:"#70DBFA",26:"#00CC66",27:"#9966FF",28:"#800080",29:"#008080",30:"#15935F",31:"#000080",32:"#00B400",33:"#2E4756",34:"#99842F",35:"#FFFFAA",36:"#99842F",37:"#2E4756",38:"#3535FF",39:"#8000BC",40:"#43AE5F",41:"#C3ECCE",42:"#728978",43:"#39503F",44:"#0C715D",45:"#5A8A80",46:"#2B937E",47:"#23999D",48:"#45B4E3",49:"#215DA1",50:"#4564D7",51:"#6969E9",52:"#9069E9"};o.forEach(function(a){switch(a){case g0.TOPLAYER:i={name:Km[a],color:"#FF0000",darkColor:"#CC0000",visible:!0,active:!0,config:!0};break;case g0.BOTTOMLAYER:i={name:Km[a],color:"#0000FF",darkColor:"#000080",visible:!0,active:!1,config:!0};break;case g0.TOPSILKLAYER:i={name:Km[a],color:"#FFCC00",darkColor:"#806600",visible:!0,active:!1,config:!0};break;case g0.BOTTOMSILKLAYER:i={name:Km[a],color:"#66CC33",darkColor:"#33661A",visible:!0,active:!1,config:!0};break;case g0.TOPPASTERLAYER:i={name:Km[a],color:"#808080",darkColor:"#666666",visible:!0,active:!1,config:!0};break;case g0.BOTTOMPASTERLAYER:i={name:Km[a],color:"#800000",darkColor:"#660000",visible:!0,active:!1,config:!0};break;case g0.TOPSOLDERLAYER:i={name:Km[a],color:"#800080",darkColor:"#660066",visible:!0,active:!1,transparency:.3,config:!0};break;case g0.BOTTOMSOLDERLAYER:i={name:Km[a],color:"#AA00FF",darkColor:"#8800CC",visible:!0,active:!1,transparency:.3,config:!0};break;case g0.RATLINES:i={name:Km[a],color:"#6464FF",darkColor:"#5050CC",visible:!1,active:!1,config:!0};break;case g0.BOARDOUTLINE:i={name:Km[a],color:"#FF00FF",darkColor:"#CC00CC",visible:!0,active:!1,config:!0};break;case g0.ALL:i={name:Km[a],color:"#C0C0C0",darkColor:"#999999",visible:!0,active:!1,config:!0};break;case g0.DOCUMENT:i={name:Km[a],color:"#FFFFFF",darkColor:"#CCCCCC",visible:!0,active:!1,config:!0};break;case g0.TOPASSEMBLY:i={name:Km[a],color:"#33CC99",darkColor:"#33AA99",visible:!1,active:!1,config:!1};break;case g0.BOTTOMASSEMBLY:i={name:Km[a],color:"#5555FF",darkColor:"#8888FF",visible:!1,active:!1,config:!1};break;case g0.MECHANICAL:i={name:Km[a],color:"#F022F0",darkColor:"#F088F0",visible:!1,active:!1,config:!1};break;case g0.MODEL3D:i={name:Km[a],color:"#66CCFF",visible:!1,active:!1,config:!1};break;case g0.LIBBODY:i={name:Km[a],color:"#00CCCC",visible:!1,active:!1,config:!1};break;case g0.PADSURFACE:i={name:Km[a],color:"#CC9999",visible:!1,active:!1,config:!1};break;default:a>=g0.INNER1&&a<=g0.INNER32?i={name:Km[a],color:n[a],darkColor:s(n[a]),visible:!1,active:!1,config:!1}:i=null;break}i&&(r[a]=i)}),r.Hole={config:!0,name:"Hole",darkColor:"#222222",color:"#222222"},r.DRCError={config:!0,name:"DRCError",color:"#FAD609",darkColor:"#FAD609"};function s(a){if(typeof a!="string"||!a.match(/#?([\da-f]{6})/i))return a;var l=parseInt(RegExp.$1,16),c=.5,h=Math.min(255,Math.round((l>>16)*c)),u=Math.min(255,Math.round((l>>8&255)*c)),d=Math.min(255,Math.round((l&255)*c)),p=((h<<16)+(u<<8)+d).toString(16);return"#"+("00000"+p).substr(-6).toUpperCase()}return r})(),z4e={BLANK:0,SCH:1,PART:2,PCB:3,FOOTPRINT:4,PRJ:5,SUBPART:6,SPICESYMBOL:7,SUBCKT:8,NETLIST:9,WAVEFORM:10,SCHLIB3D:11,PHOTOVIEW:12,SCHMODULE:13,PCBMODULE:14,VIEW3D:15,PCBLIB3D:16,BLOCK_SYMBOL:17,NETFLAG:18,NETPORT:19,SHEET_SYMBOL:20,NONEELEC_SYMBOL:21,SHORT_SYMBOL:22,FOOTPRINTVIEW:23,CNCPRINTVIEW:24,PCB2D:31,PCB3D:32},yGt=(function(){var o={};for(let t in z4e)o[z4e[t]]=t;return o})(),eee=Math.PI*2,HQ=Math.PI/2,bGt=Math.sin(Math.PI/180);function J0t(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=Z0t[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}function x6e(o,t,e){var r=o-t;return e||(e=1e-10),(r>0?r:-r)<e}function Q0t(o,t,e){var r=h(o)&&h(t)&&h(e);if(!r)return console.warn("Bad arguments"),null;var i=t.x-e.x>0?t.x:e.x,n=t.y-e.y>0?t.y:e.y,s=t.x-e.x>0?e.x:t.x,a=t.y-e.y>0?e.y:t.y,l=o.x,c=o.y;return l<=i+.001&&l>=s-.001&&c<=n+.001&&c>=a-.001;function h(u){return u?(u.x=Number(u.x),u.y=Number(u.y),isNaN(u.x)||isNaN(u.y)?(console.warn("Can not convert to Number, NaN found"),!1):!0):(console.warn("Empty input!"),!1)}}function eft(o,t,e,r,i,n){var s=(i-e)*(o-e)+(n-r)*(t-r),a=(i-e)*(i-e)+(n-r)*(n-r),l=s/a,c=e+(i-e)*l,h=r+(n-r)*l;return s<=0?Math.sqrt((o-e)*(o-e)+(t-r)*(t-r)):s>=a?Math.sqrt((o-i)*(o-i)+(t-n)*(t-n)):Math.sqrt((o-c)*(o-c)+(h-t)*(h-t))}function tft(o,t,e){return Q0t(o,t,e)?x6e((o.x-t.x)*(e.y-t.y),(e.x-t.x)*(o.y-t.y),.001):!1}var jW=1e-4,st=new Float64Array(100);function EI(o,t){if(o instanceof Ct&&t instanceof Ct)return hE(o,t);if(o instanceof Ir&&t instanceof Ct)return fPe(o,t);if(o instanceof Ct&&t instanceof Ir)return fPe(t,o);if(o instanceof Ir&&t instanceof Ir)return D6e(o,t);if(o instanceof en&&t instanceof en)return MQ(o,t);if(o instanceof en&&t instanceof Ct)return MQ(o,new en([t.start(),t.end()]));if(o instanceof Ct&&t instanceof en)return MQ(new en([o.start(),o.end()]),t);if(o instanceof en&&t instanceof Ir)return Z4e(t,o);if(o instanceof Ir&&t instanceof en)return Z4e(o,t);throw new Error("not supported operation")}function rft(o,t){let e=o.bbox();if(e.isContainsY1(t)){let r=new Ct(new qt(e.minX-1,t),new qt(e.maxX+1,t));return hE(r,o)>0?1:0}else return 0}function ift(o,t){if(o.rx===o.ry){let e=o.bbox();if(e.isContainsY1(t)){let r=new Ct(new qt(e.minX-1,t),new qt(e.maxX+1,t));return WQ(o,r)>0?1:0}else return 0}else throw new Error("not supported operation")}function Y4e(o,t){let e=o.bbox();return e.isContainsY1(t)&&MQ(new en([new qt(e.minX-1,t),new qt(e.maxX+1,t)]),o)>0?1:0}function j4e(o,t,e){return isFinite(t)&&isFinite(e)?o.isContains2(t,e):!1}function nft(o,t){let e=t.length(),r=up.crossProd3(t.start(),t.end(),o.start())/e,i=up.crossProd3(t.start(),t.end(),o.end())/e;return Math.abs(r)<1e-8||Math.abs(i)<1e-8||r*i<0}function hE(o,t){let e=o.bbox().intersection1(t.bbox());if(!e)return 0;if(o.isPoint())if(t.isPoint()){let r=e.center();return st[0]=r.x,st[1]=r.y,2}else return X4e(t,o,e);else{if(t.isPoint())return X4e(o,t,e);{let r=function(T,I){e.isContains2(T,I)&&(st[P++]=T,st[P++]=I)};if(!nft(o,t))return 0;let i=o.start().x,n=o.start().y,s=o.end().x,a=o.end().y,l=t.start().x,c=t.start().y,h=t.end().x,u=t.end().y,d=t.length(),p=up.crossProd2(i,n,l,c,h,u)/d,m=up.crossProd2(s,a,l,c,h,u)/d;if(p*m>0&&!Er.eq(p,0)&&!Er.eq(m,0))return 0;let g=o.length(),y=up.crossProd2(l,c,i,n,s,a)/g,b=up.crossProd2(h,u,i,n,s,a)/g;if(y*b>0&&!Er.eq(y,0)&&!Er.eq(b,0))return 0;let P=0;if(Er.eq(p,0)&&Er.eq(m,0)){let T=e.UL(),I=e.UR(),C=e.LL(),E=e.LR();if(Er.eq(e.width(),0))Er.eq(e.height(),0)?(st[P++]=T.x,st[P++]=T.y):(st[P++]=T.x,st[P++]=T.y,st[P++]=C.x,st[P++]=C.y);else if(Er.eq(e.height(),0))st[P++]=T.x,st[P++]=T.y,st[P++]=I.x,st[P++]=I.y;else{let O=pPe.area2(T.x,T.y,l,c,h,u),_=pPe.area2(I.x,I.y,l,c,h,u);O<_?(st[P++]=T.x,st[P++]=T.y,st[P++]=E.x,st[P++]=E.y):(st[P++]=I.x,st[P++]=I.y,st[P++]=C.x,st[P++]=C.y)}}else if(Er.eq(p,0))r(i,n);else if(Er.eq(m,0))r(s,a);else{let T=Math.abs(p/(p-m));r(i+(s-i)*T,n+(a-n)*T)}return P}}}function X4e(o,t,e){let r=t.start(),i=t.end(),n=up.crossProd3(o.start(),o.end(),t.start()),s=up.crossProd3(o.start(),o.end(),t.end());if(n*s<0){let a=e.center();return st[0]=a.x,st[1]=a.y,2}else if(Math.abs(n)<Math.abs(s)){if(Er.eq(n/o.length(),0))return st[0]=r.x,st[1]=r.y,2}else if(Er.eq(s/o.length(),0))return st[0]=i.x,st[1]=i.y,2;return 0}function WQ(o,t){let e=o.bbox().intersection1(t.bbox());if(e!=null){e=e.extendOfSize(jW);let r=o.center.x,i=o.center.y,n=o.rx,s=o.rx2,a=t.start().x,l=t.start().y,c=t.end().x,h=t.end().y,u=o.center.distance1(t.start()),d=o.center.distance1(t.end()),p=Er.eq(u,n)?0:u>n?1:-1,m=Er.eq(d,n)?0:d>n?1:-1,g=0;if(p===-1&&m===-1)return 0;if(p===0&&m===0)st[g++]=a,st[g++]=l,st[g++]=c,st[g++]=h;else if(p===1&&m===1){let y=SS.foot(t,o.center),b=y.distance1(o.center);if(Er.greater(b,n))return 0;if(Er.eq(b,n))Er.eq(t.distance2(o.start()),0)?(st[g++]=o.start().x,st[g++]=o.start().y,st[g++]=o.start().x,st[g++]=o.start().y):Er.eq(t.distance2(o.end()),0)?(st[g++]=o.end().x,st[g++]=o.end().y,st[g++]=o.end().x,st[g++]=o.end().y):(st[g++]=y.x,st[g++]=y.y,st[g++]=y.x,st[g++]=y.y);else{g=R6e(r,i,a,l,c,h,g,y);let P=st[g-2],T=st[g-1];g-=2;let I=up.distance1(r,i,P,T);if(Er.eq(I,n))st[g++]=P,st[g++]=T,st[g++]=P,st[g++]=T;else if(I<n)g=Eg(s,r,i,a,l,P,T,g),g=Eg(s,r,i,P,T,c,h,g);else return 0}}else if(p===-1||m===-1)g=Eg(s,r,i,a,l,c,h,g);else{let y=SS.foot(t,o.center),b=y.distance1(o.center);if(Er.eq(b,n)){let P=function(C){return j4e(e,C.x,C.y)&&zp(o,C)},T=o.start(),I=o.end();if(p===0){let C=t.start();if(P(C))return st[g++]=C.x,st[g++]=C.y,st[g++]=C.x,st[g++]=C.y,g;if(P(y))return st[g++]=y.x,st[g++]=y.y,st[g++]=y.x,st[g++]=y.y,g;if(Er.eq(t.distance2(T),0)&&P(T))return st[g++]=T.x,st[g++]=T.y,st[g++]=T.x,st[g++]=T.y,g;if(Er.eq(t.distance2(I),0)&&P(I))return st[g++]=I.x,st[g++]=I.y,st[g++]=I.x,st[g++]=I.y,g;if(u<=n)g=Eg(s,r,i,y.x,y.y,c,h,g),g===2&&(st[g++]=st[0],st[g++]=st[1]);else if(b<n){if(g=Eg(s,r,i,y.x,y.y,c,h,g),g===2&&P(new qt(st[0],st[1])))return st[g++]=st[0],st[g++]=st[1],g;g=Eg(s,r,i,y.x,y.y,a,l,0),g===2&&(st[g++]=st[0],st[g++]=st[1])}}else{let C=t.end();if(P(C))return st[g++]=C.x,st[g++]=C.y,st[g++]=C.x,st[g++]=C.y,g;if(P(y))return st[g++]=y.x,st[g++]=y.y,st[g++]=y.x,st[g++]=y.y,g;if(Er.eq(t.distance2(T),0)&&P(T))return st[g++]=T.x,st[g++]=T.y,st[g++]=T.x,st[g++]=T.y,g;if(Er.eq(t.distance2(I),0)&&P(I))return st[g++]=I.x,st[g++]=I.y,st[g++]=I.x,st[g++]=I.y,g;if(d<=n)g=Eg(s,r,i,y.x,y.y,a,l,g),g===2&&(st[g++]=st[0],st[g++]=st[1]);else if(b<n){if(g=Eg(s,r,i,y.x,y.y,a,l,g),g===2&&P(new qt(st[0],st[1])))return st[g++]=st[0],st[g++]=st[1],g;g=Eg(s,r,i,y.x,y.y,c,h,0),g===2&&(st[g++]=st[0],st[g++]=st[1])}}}else if(p===0){let P=t.start();st[g++]=P.x,st[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=Eg(s,r,i,y.x,y.y,c,h,g))}else{let P=t.end();st[g++]=P.x,st[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=Eg(s,r,i,y.x,y.y,a,l,g))}}if(g>0){let y=0;for(let b=0;b<g;b+=2){let P=st[b],T=st[b+1];isFinite(P)&&isFinite(T)&&j4e(e,P,T)&&zp(o,new qt(P,T))&&(st[y++]=P,st[y++]=T)}return y}else return 0}else return 0}function oft(o,t){if(o.bbox()){let e=o.center.x,r=o.center.y,i=o.rx2,n=t.start().x,s=t.start().y,a=t.end().x,l=t.end().y,c=o.center.distance2(t.start()),h=o.center.distance2(t.end()),u=Er.eq(c,i)?0:c>i?1:-1,d=Er.eq(h,i)?0:h>i?1:-1,p=0;if(u===-1&&d===-1)return 0;if(u===0&&d===0)st[p++]=n,st[p++]=s,st[p++]=a,st[p++]=l;else if(u===1&&d===1){let m=SS.foot(t,o.center),g=m.distance2(o.center);if(Er.greater(g,i))return 0;if(Er.eq(g,i)){let y=m.distance2(o.start()),b=m.distance2(o.end());Er.eq(y,0)?(st[p++]=o.start().x,st[p++]=o.start().y):Er.eq(b,0)?(st[p++]=o.end().x,st[p++]=o.end().y):(st[p++]=m.x,st[p++]=m.y)}else{p=R6e(e,r,n,s,a,l,p,m);let y=st[p-2],b=st[p-1],P=up.distance2(e,r,y,b);if(p-=2,Er.eq(P,i))st[p++]=y,st[p++]=b;else if(P<i)p=Eg(i,e,r,n,s,y,b,p),p=Eg(i,e,r,y,b,a,l,p);else return 0}}else if(u===-1||d===-1)p=Eg(i,e,r,n,s,a,l,p);else{let m=SS.foot(t,o.center);u===0?(st[p++]=t.start().x,st[p++]=t.start().y,Er.neq(m.distance2(t.start()),0)&&(n-m.x)*(a-m.x)+(s-m.y)*(l-m.y)<0&&(p=Eg(i,e,r,m.x,m.y,a,l,p))):(st[p++]=t.end().x,st[p++]=t.end().y,Er.neq(m.distance2(t.end()),0)&&(n-m.x)*(a-m.x)+(s-m.y)*(l-m.y)<0&&(p=Eg(i,e,r,m.x,m.y,n,s,p)))}if(p>0){let m=0;for(let g=0;g<p;g+=2){let y=st[g],b=st[g+1];isFinite(y)&&isFinite(b)&&(st[m++]=y,st[m++]=b)}return m}else return 0}else return 0}function Eg(o,t,e,r,i,n,s,a){if(i==s){let T=o-(i-e)*(i-e);if(Er.greater(T,0)){let I=Math.sqrt(T),C=t-I,E=t+I,O=Math.min(r,n),_=Math.max(r,n);return C>=O&&C<=_&&(st[a++]=C,st[a++]=i),E>=O&&E<=_&&(st[a++]=E,st[a++]=i),a}}let l=up.distance2(r,i,t,e)-o;if(l===0)return st[a++]=r,st[a++]=i,a;let c=up.distance2(n,s,t,e)-o;if(c===0)return st[a++]=n,st[a++]=s,a;let h=r,u=i,d=n,p=s,m=NaN,g=NaN,y=Number.POSITIVE_INFINITY,b=0;for(;y!==0;){b++;let T=Math.max(Math.min(Math.abs(l)/(Math.abs(l)+Math.abs(c)),.75),.25);if(m=h+(d-h)*T,g=u+(p-u)*T,h===m&&u===g||d===m&&p===g){Math.abs(l)>Math.abs(c)?(m=d,g=p,y=c):(m=h,g=u,y=l);break}else y=up.distance2(m,g,t,e)-o,y<0&&l>c||y>0&&l<c?(d=m,p=g,c=y):(h=m,u=g,l=y)}let P=Math.sqrt(o)-up.distance1(m,g,t,e);return(Er.eq(0,y)||Er.eq(0,P))&&(st[a++]=m,st[a++]=g),a}function R6e(o,t,e,r,i,n,s,a){let l=up.dotProd2(e,r,i,n,o,t),c=up.dotProd2(i,n,e,r,o,t);if(l>=0)return st[s++]=i,st[s++]=n,s;if(c>=0)return st[s++]=e,st[s++]=r,s;if(up.crossProd2(e,r,i,n,o,t)==0)return st[s++]=o,st[s++]=t,s;{let h=NaN,u=NaN,d=e,p=r,m=i,g=n,y=up.distance2(e,r,o,t),b=up.distance2(i,n,o,t),P=Number.POSITIVE_INFINITY,T=0;for(;P>0&&(T++,h=d+(m-d)*.5,u=p+(g-p)*.5,!(y==b||d==h&&p==u||m==h&&g==u));){P=up.distance2(h,u,o,t);let I=up.dotProd2(d,p,h,u,o,t);if(I==0)break;I<0?(m=h,g=u,b=P):(d=h,p=u,y=P)}return up.distance2(h,u,o,t)<up.distance2(a.x,a.y,o,t)?(st[s++]=h,st[s++]=u):(st[s++]=a.x,st[s++]=a.y),s}}function fPe(o,t){if(o.rx===o.ry)return WQ(o,t);throw new Error("not supported")}function sft(o,t){if(o.rx===o.ry)return oft(o,t);throw new Error("not supported")}function D6e(o,t){if(o.bbox().intersection1(t.bbox())!=null){if(o.rx===o.ry&&t.rx===t.ry)return aft(o,t);throw new Error("not supported operation")}return 0}function aft(o,t){let e=o.center.x,r=o.center.y,i=t.center.x,n=t.center.y,s=o.rx,a=t.rx,l=o.rx2,c=t.rx2,h=o.center.distance1(t.center),u=Math.abs(s-a),d=s+a;if(Er.greater(h,d)||Er.less(h,u))return 0;if(Er.eq(u+h,0)){let p=0,m;return zp(o,t.start())&&(st[p]=t.start().x,st[p+1]=t.start().y,p+=2,m=t.start()),zp(o,t.end())&&(st[p]=t.end().x,st[p+1]=t.end().y,p+=2,m=t.end()),p===0?(zp(t,o.start())&&(st[p]=o.start().x,st[p+1]=o.start().y,p+=2),zp(t,o.end())&&(st[p]=o.end().x,st[p+1]=o.end().y,p+=2)):p===2&&(!m.equals1(o.start())&&zp(t,o.start())&&(st[p]=o.start().x,st[p+1]=o.start().y,p+=2),!m.equals1(o.end())&&zp(t,o.end())&&(st[p]=o.end().x,st[p+1]=o.end().y,p+=2)),p}else if(Er.eq(h,d)){if(q4e(o,t))return 4;let p=new Ct(o.center,t.center),m=WQ(t,p);return m=$4e(o,m),m!==0?m:(m=WQ(o,p),$4e(t,m))}else if(Er.eq(h,u)){if(q4e(o,t))return 4;if(s>a){let p=(s-a)/s;return st[0]=e+(i-e)/p,st[1]=r+(n-r)/p,K4e(o,t,2)}else{let p=(a-s)/a;return st[0]=i+(e-i)/p,st[1]=n+(r-n)/p,K4e(o,t,2)}}else{let p=(o.center.distance2(t.center)-c+l)/(h*2)/h,m=(i-e)*p+e,g=(n-r)*p+r,y=i-e,b=n-r,P=Math.max(s,a),T,I,C,E;if(Math.abs(y)<Math.abs(b)){let v=y/-b,D=g-v*m;T=m-P,I=v*T+D,C=m+P,E=v*C+D}else{let v=b/-y,D=m-v*g;I=g-P,T=v*I+D,E=g+P,C=v*E+D}let O=Eg(l,e,r,T,I,m,g,0);if(O=Eg(l,e,r,m,g,C,E,O),O!==4)throw new Error("cnt !== 4");let _=new qt(st[0],st[1]),R=new qt(st[2],st[3]);if(zp(o,_)&&zp(t,_))return zp(o,R)&&zp(t,R)?4:Gv(o.start(),t,R,_)?(st[2]=o.start().x,st[3]=o.start().y,4):Gv(o.end(),t,R,_)?(st[2]=o.end().x,st[3]=o.end().y,4):Gv(t.start(),o,R,_)?(st[2]=t.start().x,st[3]=t.start().y,4):Gv(t.end(),o,R,_)?(st[2]=t.end().x,st[3]=t.end().y,4):2;if(zp(o,R)&&zp(t,R))return Gv(o.start(),t,_,R)?(st[0]=o.start().x,st[1]=o.start().y,4):Gv(o.end(),t,_,R)?(st[0]=o.end().x,st[1]=o.end().y,4):Gv(t.start(),o,_,R)?(st[0]=t.start().x,st[1]=t.start().y,4):Gv(t.end(),o,_,R)?(st[0]=t.end().x,st[1]=t.end().y,4):(st[0]=st[2],st[1]=st[3],2);{let v=function(H,z){if(Er.eq(H.distance1(z.center),z.rx)&&zp(z,H)){if(H.distance2(_)<H.distance2(R)){if(D)return;D=!0}else{if(w)return;w=!0}st[F++]=H.x,st[F++]=H.y}},D=!1,w=!1,F=0;return v(o.start(),t),v(o.end(),t),v(t.start(),o),v(t.end(),o),F}}}function Gv(o,t,e,r){return Er.eq(o.distance1(t.center),t.rx)&&zp(t,o)&&o.distance2(e)<o.distance2(r)}function q4e(o,t){return Er.eq(t.start().distance1(o.center),o.rx)&&zp(o,t.start())?(st[0]=t.start().x,st[1]=t.start().y,st[2]=t.start().x,st[3]=t.start().y,!0):Er.eq(t.end().distance1(o.center),o.rx)&&zp(o,t.end())?(st[0]=t.end().x,st[1]=t.end().y,st[2]=t.end().x,st[3]=t.end().y,!0):Er.eq(o.start().distance1(t.center),t.rx)&&zp(t,o.start())?(st[0]=o.start().x,st[1]=o.start().y,st[2]=o.start().x,st[3]=o.start().y,!0):Er.eq(o.end().distance1(t.center),t.rx)&&zp(t,o.end())?(st[0]=o.end().x,st[1]=o.end().y,st[2]=o.end().x,st[3]=o.end().y,!0):!1}function $4e(o,t){if(t===0)return 0;let e=st[0],r=st[1];return zp(o,new qt(e,r))?(st[0]=e,st[1]=r,st[2]=e,st[3]=r,4):0}function K4e(o,t,e){if(e===0)return 0;let r=st[0],i=st[1],n=new qt(r,i);return zp(o,n)&&zp(t,n)?(st[0]=r,st[1]=i,st[2]=r,st[3]=i,4):0}function fk(o,t){return Math.abs(o-t)<=1e-6}function zp(o,t){let e=o.bbox();if(t.x-e.minX>-jW&&t.x-e.maxX<jW&&t.y-e.minY>-jW&&t.y-e.maxY<jW){let r=Qo.regularD(t.angleD(o.center));return fk(r,o.startAngle)||fk(r,o.startAngle+360)||fk(r,o.startAngle-360)||fk(r,o.endAngle())||fk(r,o.endAngle()+360)||fk(r,o.endAngle()-360)?!0:o.sweepAngle>0?(Er.less(r,o.startAngle)&&(r+=360),Er.greatereq(o.endAngle(),r)):(Er.greater(r,o.startAngle)&&(r-=360),Er.lesseq(o.endAngle(),r))}else return!1}function lft(o,t){let e=o[1].x-o[0].x,r=o[1].y-o[0].y,i=t[1].x-t[0].x,n=t[1].y-t[0].y;if(e===0&&i!==0||e!==0&&i===0)return!1;if(e===0&&i===0)return!0;let s=r/e,a=n/i;return x6e(s,a,Math.sin(Math.PI/180))}function cft(o,t,e){var r,i=+t.x,n=+t.y,s=+e.x,a=+e.y,l=+o.x,c=+o.y,h=s-i,u=a-n,d=l-i,p=c-n,m,g,y,b,P,T;return h===0&&u===0?{d:Math.sqrt(d*d+p*p),point:new qt(i,n)}:(r=(d*h+p*u)/(h*h+u*u),r<0?{d:Math.sqrt(d*d+p*p),point:new qt(i,n)}:r>1?(m=l-s,g=c-a,{d:Math.sqrt(m*m+g*g),point:new qt(s,a)}):(P=i+r*h,T=n+r*u,y=l-P,b=c-T,{d:Math.sqrt(y*y+b*b),point:new qt(P,T)}))}function CS(o,t){if(!o||!t||o.length!=t.length)return!1;let e="equals1";return!o.some((r,i)=>{let n=t[i],s=!1;return r&&n&&typeof r=="object"&&typeof n=="object"?typeof r[e]=="function"&&uft(r,n)?s=!r[e].call(r,n):s=!(r===n||r.toString()===n.toString()):typeof r=="number"&&typeof n=="number"?s=!(hft(r,n)||Number.isNaN(r)&&Number.isNaN(n)):s=r!==n,s})}function hft(o,t,e=5){return Math.abs(o-t)*Math.pow(10,e)<1}function uft(o,t){return!o||!t||typeof o!="object"||typeof t!="object"?o===t:o.constructor===t.constructor}var Zs=new Float64Array(100);function MQ(o,t){if(o.bbox().extendOfSize(Er.eps).isSeparated(t.bbox()))return 0;let e=[[o,t]],r=(o.controls.length-1)*(t.controls.length-1)*8,i=0,n=Number.POSITIVE_INFINITY;for(;e.length!==0;){let s=function(G){D=Math.min(D,G),w=Math.max(w,G)},a=function(G,W){let L=hE(G,W);if(L===0)throw new Error("cnt === 0");for(let B=0;B<L;B+=2)s(st[B])};if(i>r){for(let G=i-2;G>=2;G-=2)for(let W=G-2;W>=0;W-=2)if(Er.eq(Zs[G],Zs[W])&&Er.eq(Zs[G+1],Zs[W+1])){Zs[W]=(Zs[G]+Zs[W])/2,Zs[W+1]=(Zs[G+1]+Zs[W+1])/2;for(let L=i-3;L>=G;L--)Zs[L]=Zs[L+2];i-=2;break}if(i>r){i=0;let G=t.start(),W=new Float64Array(8);o.getPercent(G)!==null&&(W[i++]=G.x,W[i++]=G.y);let L=t.end();o.getPercent(L)!==null&&(W[i++]=L.x,W[i++]=L.y);let B=o.start();t.getPercent(B)!==null&&(W[i++]=B.x,W[i++]=B.y);let N=o.end();return t.getPercent(N)!==null&&(W[i++]=N.x,W[i++]=N.y),st.set(W),i}}let[l,c]=e.pop(),h=l.controls,u=c.controls;if(h.length===2&&u.length===2){let G=hE(new Ct(h[0],h[1]),new Ct(u[0],u[1]));for(let W=0;W<G;W++)Zs[i++]=st[W];continue}let d=h[0],p=h[h.length-1];d.equals1(p)&&(p=d.add1(1,0));let m=p.y-d.y,g=d.x-p.x,y=-m*d.x-g*d.y,b=Math.sqrt(1/(m**2+g**2));m*=b,g*=b,y*=b;let P=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(h.forEach(G=>{let W=m*G.x+g*G.y+y;W<P&&(P=W),W>T&&(T=W)}),Er.eq(P,T)){if(c.controls.length===2){let G=hE(new Ct(l.start(),l.end()),new Ct(c.start(),c.end()));for(let W=0;W<G;W++)Zs[i++]=st[W];if(G!==0)continue}l=new en([h[0],h[h.length-1]]),h=l.controls}let I=u.map(G=>{let W=m*G.x+g*G.y+y,L=Math.abs(W);return L<n&&(n=L),W}),C=0;for(let G of I){if(Er.less(G,P))C=C|1;else if(Er.greater(G,T))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let E=0,O=0,_=p.x-d.x,R=p.y-d.y,v=Math.sqrt(1/(_**2+R**2));_*=v,R*=v;for(let G=1;G<h.length;G++){let W=h[G],L=(W.x-d.x)*_+(W.y-d.y)*R;L<E?E=L:L>O&&(O=L)}C=0;for(let G of u){let W=(G.x-d.x)*_+(G.y-d.y)*R;if(Er.less(W,E))C=C|1;else if(Er.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let D=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY;n/=2,n<=Er.eps&&(n=Er.eps),P-=n,T+=n,I.forEach((G,W)=>{G>=P&&G<=T&&s(W/(I.length-1))});let F=new Ct(new qt(0,P),new qt(1,P)),H=new Ct(new qt(0,T),new qt(1,T));for(let G=0;G<I.length-1;G++){let W=new qt(G/(I.length-1),I[G]),L=W.y<P?1:W.y>T?2:3;for(let B=0;B<I.length;B++){let N=new qt(B/(I.length-1),I[B]),U=N.y<P?1:N.y>T?2:3;L!==U&&(L===1?U===2?(a(new Ct(W,N),F),a(new Ct(W,N),H)):a(new Ct(W,N),F):L===2?U===1?(a(new Ct(W,N),F),a(new Ct(W,N),H)):a(new Ct(W,N),H):U===1?a(new Ct(W,N),F):a(new Ct(W,N),H))}}D!==0&&(c=c.clip(D)[1]),w!==1&&(c=c.clip((w-D)/(1-D))[0]);let z=c.bbox();if(Er.eq(z.minX,z.maxX)&&Er.eq(z.minY,z.maxY)){C=0;for(let G of c.controls){let W=(G.x-d.x)*_+(G.y-d.y)*R;if(Er.less(W,E))C=C|1;else if(Er.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C===3){let G=new qt((z.minX+z.maxX)/2,(z.minY+z.maxY)/2);l.getPercent(G)&&(Zs[i++]=G.x,Zs[i++]=G.y)}continue}if(w-D>.8){let[G,W]=c.clip(.5);e.push([G,l]),e.push([W,l])}else e.push([c,l])}for(let s=0;s<i;s++)st[s]=Zs[s];return i}function dft(o,t){if(o.bbox().extendOfSize(Er.eps).isSeparated(t.bbox()))return{cnt:0};let e=[[o,t]],r=(o.controls.length-1)*(t.controls.length-1)*8,i=0,n=Number.POSITIVE_INFINITY;for(;e.length!==0;){let s=function(G){D=Math.min(D,G),w=Math.max(w,G)},a=function(G,W){let L=hE(G,W);if(L===0)throw new Error("cnt === 0");for(let B=0;B<L;B+=2)s(st[B])};if(i>r){for(let G=i-2;G>=2;G-=2)for(let W=G-2;W>=0;W-=2)if(Er.eq(Zs[G],Zs[W])&&Er.eq(Zs[G+1],Zs[W+1])){Zs[W]=(Zs[G]+Zs[W])/2,Zs[W+1]=(Zs[G+1]+Zs[W+1])/2;for(let L=i-3;L>=G;L--)Zs[L]=Zs[L+2];i-=2;break}if(i>r){i=0;let G=new Float64Array(8),W=t.end(),L=0;o.getPercent(W)!==null&&(G[i++]=W.x,G[i++]=W.y,L=2);let B=o.end();return t.getPercent(B)!==null&&(G[i++]=B.x,G[i++]=B.y,L=L===0?1:3),st.set(G),{havOverlap:L,cnt:i}}}let[l,c]=e.pop(),h=l.controls,u=c.controls;if(h.length===2&&u.length===2){let G=hE(new Ct(h[0],h[1]),new Ct(u[0],u[1]));for(let W=0;W<G;W++)Zs[i++]=st[W];continue}let d=h[0],p=h[h.length-1];d.equals1(p)&&(p=d.add1(1,0));let m=p.y-d.y,g=d.x-p.x,y=-m*d.x-g*d.y,b=Math.sqrt(1/(m**2+g**2));m*=b,g*=b,y*=b;let P=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(h.forEach(G=>{let W=m*G.x+g*G.y+y;W<P&&(P=W),W>T&&(T=W)}),Er.eq(P,T)){if(c.controls.length===2){let G=hE(new Ct(l.start(),l.end()),new Ct(c.start(),c.end()));for(let W=0;W<G;W++)Zs[i++]=st[W];if(G!==0)continue}l=new en([h[0],h[h.length-1]]),h=l.controls}let I=u.map(G=>{let W=m*G.x+g*G.y+y,L=Math.abs(W);return L<n&&(n=L),W}),C=0;for(let G of I){if(Er.less(G,P))C=C|1;else if(Er.greater(G,T))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let E=0,O=0,_=p.x-d.x,R=p.y-d.y,v=Math.sqrt(1/(_**2+R**2));_*=v,R*=v;for(let G=1;G<h.length;G++){let W=h[G],L=(W.x-d.x)*_+(W.y-d.y)*R;L<E?E=L:L>O&&(O=L)}C=0;for(let G of u){let W=(G.x-d.x)*_+(G.y-d.y)*R;if(Er.less(W,E))C=C|1;else if(Er.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let D=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY;n/=2,n<=Er.eps&&(n=Er.eps),P-=n,T+=n,I.forEach((G,W)=>{G>=P&&G<=T&&s(W/(I.length-1))});let F=new Ct(new qt(0,P),new qt(1,P)),H=new Ct(new qt(0,T),new qt(1,T));for(let G=0;G<I.length-1;G++){let W=new qt(G/(I.length-1),I[G]),L=W.y<P?1:W.y>T?2:3;for(let B=0;B<I.length;B++){let N=new qt(B/(I.length-1),I[B]),U=N.y<P?1:N.y>T?2:3;L!==U&&(L===1?U===2?(a(new Ct(W,N),F),a(new Ct(W,N),H)):a(new Ct(W,N),F):L===2?U===1?(a(new Ct(W,N),F),a(new Ct(W,N),H)):a(new Ct(W,N),H):U===1?a(new Ct(W,N),F):a(new Ct(W,N),H))}}D!==0&&(c=c.clip(D)[1]),w!==1&&(c=c.clip((w-D)/(1-D))[0]);let z=c.bbox();if(Er.eq(z.minX,z.maxX)&&Er.eq(z.minY,z.maxY)){C=0;for(let G of c.controls){let W=(G.x-d.x)*_+(G.y-d.y)*R;if(Er.less(W,E))C=C|1;else if(Er.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C===3){let G=new qt((z.minX+z.maxX)/2,(z.minY+z.maxY)/2);l.getPercent(G)&&(Zs[i++]=G.x,Zs[i++]=G.y)}continue}if(w-D>.8){let[G,W]=c.clip(.5);e.push([G,l]),e.push([W,l])}else e.push([c,l])}for(let s=0;s<i;s++)st[s]=Zs[s];return{cnt:i}}var pft=class{constructor(o=Er.eps){this.eps=o}eq(o,t){return Math.abs(o-t)<=this.eps}setEps(o){this.eps=o}},UW=new pft;function Z4e(o,t){if(o.bbox().extendOfSize(Er.eps).isSeparated(t.bbox()))return 0;let e=[[o,t]],r=(t.controls.length-1)*16,i=0;for(;e.length!==0;){if(i>r){let s=function(){for(let c=0;c<i;c+=2)for(let h=c+2;h<i;h+=2)if(!(UW.eq(Zs[c],Zs[h])&&UW.eq(Zs[c+1],Zs[h+1]))){l(Zs[h],Zs[h+1],a);break}function l(c,h,u){let d=!1;for(let p=0;p<u.length;p+=2)if(UW.eq(c,u[p])&&UW.eq(h,u[p+1])){d=!0;break}d||u.push(c,h)}},a=[Zs[0],Zs[1]];if(s(),a.length>=100&&(UW.setEps(.001),a=[Zs[0],Zs[1]],s(),a.length>=100))throw new Error("clearSamePoint()");i=a.length,a.forEach((l,c)=>Zs[c]=l)}let n=e.pop();if(n[0]instanceof Ir){let s=function(H){R=Math.min(R,H),v=Math.max(v,H)},a=function(H,z){let G=hE(H,z);if(G===0)throw new Error("cnt === 0");for(let W=0;W<G;W+=2)s(st[W])},[l,c]=n,h=c.controls;if(h.length===2){let H=fPe(l,new Ct(h[0],h[1]));for(let z=0;z<H;z++)Zs[i++]=st[z];continue}let u=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,p,m,g,y,b;if(Math.abs(l.sweepAngle)>359){let H=l.rx;p=l.center.add1(H,0),m=l.center.add1(-H,0),u=-H,d=H,g=0,y=1,b=-l.center.y}else{p=l.start(),m=l.end(),g=m.y-p.y,y=p.x-m.x,b=-g*p.x-y*p.y;let H=Math.sqrt(1/(g**2+y**2));g*=H,y*=H,b*=H;let z=g*l.center.x+y*l.center.y+b;l.isCCW?(d=l.rx+z,u=0):(u=z-l.rx,d=0)}let P=h.map(H=>g*H.x+y*H.y+b),T=0;for(let H of P){if(Er.less(H,u))T=T|1;else if(Er.greater(H,d))T=T|2;else{T=3;break}if(T===3)break}if(T!==3)continue;let I=0,C=0,E=m.x-p.x,O=m.y-p.y,_=Math.sqrt(1/(E**2+O**2));if(E*=_,O*=_,Math.abs(l.sweepAngle)<=180)I=0,C=(m.x-p.x)*E+(m.y-p.y)*O;else throw new Error("not support");T=0;for(let H of h){let z=(H.x-p.x)*E+(H.y-p.y)*O;if(Er.less(z,I))T=T|1;else if(Er.greater(z,C))T=T|2;else{T=3;break}if(T===3)break}if(T!==3)continue;let R=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY;u-=Er.eps,d+=Er.eps,P.forEach((H,z)=>{H>=u&&H<=d&&s(z/(P.length-1))});let D=new Ct(new qt(0,u),new qt(1,u)),w=new Ct(new qt(0,d),new qt(1,d));for(let H=0;H<P.length-1;H++){let z=new qt(H/(P.length-1),P[H]),G=z.y<u?1:z.y>d?2:3;for(let W=0;W<P.length;W++){let L=new qt(W/(P.length-1),P[W]),B=L.y<u?1:L.y>d?2:3;G!==B&&(G===1?B===2?(a(new Ct(z,L),D),a(new Ct(z,L),w)):a(new Ct(z,L),D):G===2?B===1?(a(new Ct(z,L),D),a(new Ct(z,L),w)):a(new Ct(z,L),w):B===1?a(new Ct(z,L),D):a(new Ct(z,L),w))}}R!==0&&(c=c.clip(R)[1]),v!==1&&(c=c.clip((v-R)/(1-R))[0]);let F=c.bbox();if(Er.eq(F.minX,F.maxX)&&Er.eq(F.minY,F.maxY)){T=0;for(let H of c.controls){let z=(H.x-p.x)*E+(H.y-p.y)*O;if(Er.less(z,I))T=T|1;else if(Er.greater(z,C))T=T|2;else{T=3;break}if(T===3)break}T===3&&(Zs[i++]=(F.minX+F.maxX)/2,Zs[i++]=(F.minY+F.maxY)/2);continue}v-R>.8?c.clip(.5).forEach(H=>e.push([H,l])):e.push([c,l])}else{let[s,a]=n;e.push([Ir.build3(a.center,a.startAngle,a.sweepAngle/2,a.rx,a.ry),s]),e.push([Ir.build3(a.center,a.startAngle+a.sweepAngle/2,a.sweepAngle/2,a.rx,a.ry),s])}}for(let n=0;n<i;n++)st[n]=Zs[n];return i}var fft=class{static getSweep(o){if(o.length>2){let t=0,e=o.length;for(let n=0;n<e-1;n++){let s=o[n],a=o[n+1];t+=(a.x+s.x)*(a.y-s.y)}let r=o[0],i=o[e-1];return t+=(r.x+i.x)*(r.y-i.y),t>0}else throw new Error("Unable to determine the direction of rotation!")}static isClose(o){return!!(o.primitives.length>0&&o.primitives[0].start().equals1(o.primitives[o.primitives.length-1].end()))}};function mft(o){let t=o.primitives,e=t[0],r=e instanceof Ir?e.sweepAngle%360:null;if(t.length===1&&e instanceof Ir&&(Er.eq(r,0)||Er.eq(Math.abs(r),360)))return!!e.isCCW;let i=new Array;return o.points(.1,n=>{i.push(n)}),fft.getSweep(i)}var gft=class{static zoomCorner(o,t){let e=new Array,r=new Array,i=new Array;return this.getPanPrimitive(o,e,i,t),this.rearrange(e,i),this.processStart(e,i),this.getResult(e,i,r,t),r.length>0?Ca.build2(r):null}static zoomPolygon(o,t){let e=new Array,r=new Array,i=new Array;return mft(o)&&(o=o.reverse().asClose()),this.getPanPrimitive(o,e,i,t),this.rearrange(e,i),this.processStart(e,i),this.getResult(e,i,r,t),r.length>0?Ca.build2(r):null}static zoomLines(o,t){return this.zoomPolygon(Ca.build2(o.primitives.concat(o.reverse().primitives)),t/2)}static getPanPrimitive(o,t,e,r){let i=o.primitives;for(let n of i){let s=this.panDistance(n,r);s!==void 0&&(t.push(s),e.push(n))}}static rearrange(o,t){let e=o.length,r=0;for(let s=0;s<e;s++){let a=t[s],l=o[s],c=s==e-1?o[0]:o[s+1];if(!(l instanceof Ir&&c instanceof Ir)&&!this.isCW(l.end(),c.start(),a.end())){if(EI(l,c)!=0){r=s==e-1?0:s+1;break}}else{r=s;break}}let i=this.start4Index(t,r),n=this.start4Index(o,r);t.length=0,o.length=0,i.forEach(s=>{t.push(s)}),n.forEach(s=>{o.push(s)})}static processStart(o,t){let e=o.length;if(e>2){let r=o[e-1],i=o[0],n=t[e-1];if(!(r instanceof Ir&&i instanceof Ir)&&!this.isCW(r.end(),i.start(),n.end())){let s=EI(r,i);for(let a=0;a<s;a+=2){let l=new qt(st[a],st[a+1]);o[e-1]=this.generatePrimitive(r,r.start(),l),o[0]=this.generatePrimitive(i,l,i.end())}}}}static getResult(o,t,e,r){let i=o.length;for(let n=0;n<i;n++){let s=t[n],a=n===i-1?t[0]:t[n+1],l=n==i-1?0:n+1,c=l==i-1?t[0]:t[l+1],h=o[n],u=n==i-1?o[0]:o[n+1],d=l==i-1?o[0]:o[l+1];if(!(h instanceof Ir&&u instanceof Ir)&&!this.isCW(h.end(),u.start(),s.end())){let m=this.add(o,e,n,h,u,0);m=this.update(o,e,n,u,m);let g=this.generateArc(a,c,u,d,r);if(m=this.add(o,e,n,h,g,m),m=this.update(o,e,n,g,m),m>0)continue}e.push(h);let p=this.generateArc(s,a,h,u,r);p!==void 0&&e.push(p)}}static generateArc(o,t,e,r,i){if(i>0){let n=o.end(),s=t.start(),a=e.end(),l=r.start();if(a.distance2(l)>1e-8)if(n.equals(s)){let c=a.angleD(n),h=l.angleD(n);return Ir.build2(n,c,h,i,i,0)}else{let c=a.angleD(n),h=l.angleD(n),u=a.angleD(s),d=l.angleD(s),p=Ir.build2(n,c,h,i,i,0),m=Ir.build2(s,u,d,i,i,0);return p.pointOn(p.endAngle()).equals1(l)?p:m.pointOn(m.endAngle()).equals1(l)?m:p}}}static updateNews(o,t,e,r){let i=o.length,n=t==i-1?0:t+1;o[n]=this.generatePrimitive(e,r,e.end())}static add(o,t,e,r,i,n){if(n>0)return n;if(r!=null&&i!=null){let s=EI(r,i);for(let a=0;a<s;a+=2){let l=new qt(st[a],st[a+1]);t.push(this.generatePrimitive(r,r.start(),l)),this.updateNews(o,e,i,l);break}return s}else return 0}static update(o,t,e,r,i){if(i>0)return i;let n=t.length;if(n>0&&r!=null){let s=t[n-1],a=EI(s,r);for(let l=0;l<a;l+=2){let c=new qt(st[l],st[l+1]);t[n-1]=this.generatePrimitive(s,s.start(),c),this.updateNews(o,e,r,c)}return a}else return 0}static generatePrimitive(o,t,e){if(o instanceof Ct)return new Ct(t,e);if(o instanceof Ir){let r=o,i=t.angleD(r.center),n=e.angleD(r.center);return Ir.build2(r.center,i,n,r.rx,r.ry,r.sweep())}else throw new Error("not supported operation")}static start4Index(o,t){let e=o.length,r=new Array;for(let i=t;i<e;i++)r.push(o[i]);for(let i=0;i<t;i++)r.push(o[i]);return r}static isCW(o,t,e){let r=new Ct(e,o),i=new Ct(e,t),n=r.end().x-r.start().x,s=r.end().y-r.start().y,a=i.end().x-i.start().x,l=i.end().y-i.start().y;return!(n*l-s*a>0)}static panDistance(o,t){if(o instanceof Ct){if(o.isPoint())return;{let e=o.panDistance(t);return e.length()>1e-5?e:void 0}}else if(o instanceof Ir){let e=o;if(e.sweepAngle>0){if(e.rx-t<=0||e.ry-t<=0)return}else if(e.sweepAngle<0&&(e.rx+t<=0||e.ry+t<=0))return;return e=e.panDistance(t),e.start().distance1(e.end())>1e-5||Er.eq(Math.abs(e.sweepAngle),360)?e:void 0}else throw new Error("not supported operation")}},uo=.001,O1=uo**2;function kn(o,t){return o.distance2(t)<O1}function uE(o,t){return Math.abs(o-t)<=1e-4}function yft(o,t){if(o instanceof Ct)return new Ct(o.start(),t);if(o instanceof Ir){let e=t.angleD(o.center);return uE(Qo.regularD(o.startAngle),Qo.regularD(e))?Ir.build3(o.center,o.startAngle,0,o.rx,o.ry):Ir.build2(o.center,o.startAngle,e,o.rx,o.ry,o.isCCW?1:0)}else{if(o instanceof en)return o.clip(o.getPercent(t,uo))[0];throw new Error("not supported operation")}}function ES(o,t=Qo.toRadians(o.startAngle)){return o.isCCW?t+=HQ:t-=HQ,new qt(Math.cos(t),Math.sin(t))}function rz(o,t=0){let e=o.controls;if(t===0){let r=e[0],i=e.slice(1).find(n=>!(n.x===r.x&&n.y===r.y));if(!i)throw Error("getTangentBezier(bezier: Bezier, t: number = 0)");return i.sub(r)}else if(t===1){let r=e[e.length-1],i=e.slice(0,-1).reverse().find(n=>!(n.x===r.x&&n.y===r.y));if(!i)throw Error("getTangentBezier(bezier: Bezier, t: number = 0)");return r.sub(i)}if(e.length===3){let[r,i,n]=e;return i.sub(r).mul(2*(1-t)).add(n.sub(i).mul(2*t)).normalize()}else{let[r,i,n,s]=e;return i.sub(r).mul(3*(1-t)**2).add(n.sub(i).mul(6*(1-t)*t)).add(s.sub(n).mul(3*t**2)).normalize()}}function _k(o,t,e){let r=o.slice(1).findIndex(n=>!(n.x===t.x&&n.y===t.y)),i=o[r+1];if(e&&(e.getPercent(i,uo)!==null||new Ct(e.start(),e.end()).distance(i)<=uo)&&(i=o[r+2]),!i)throw Error("getSecondPoint(controls: readonly Vector2[])");return i}function ho(o,t){if(o instanceof Ct)return o.end().sub(o.start()).normalize();if(o instanceof Ir)return(t?ES(o,t.angle(o.center)):ES(o)).normalize();if(o instanceof en)if(o.controls.length===2){let[e,r]=o.controls;if(kn(e,r))throw Error("equalsPP(p0, p1)");return r.sub(e).normalize()}else return(t?rz(o,o.getPercent(t,uo)):rz(o)).normalize();else throw new Error("not support")}function bft(o,t,e){let r=[],i=t**2-4*o*e;if(i>=0){let n=-t/(2*o),s=Math.sqrt(i)/(2*o),a=n+s;if(r.push(a),i>0){let l=n-s;r.push(l)}}return r}function Pft(o,t,e,r,i=0,n=1){let s=[],a=o*Math.pow(i,3)+t*Math.pow(i,2)+e*i+r,l=o*Math.pow(n,3)+t*Math.pow(n,2)+e*n+r,c,h;if(a*l<0)for(;Math.abs(i-n)>uo;)if(c=(i+n)/2,h=o*Math.pow(c,3)+t*Math.pow(c,2)+e*c+r,Math.abs(h)<uo){s.push(c);break}else a*h<0?n=c:l*h<0&&(i=c);else a*l===0&&(a===0&&s.push(i),l===0&&s.push(n));return s}function X2e(o,t,e){if(o instanceof Ct||t.distance2(e)<=O1)return new Ct(t,e);if(o instanceof Ir)return Ir.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?1:0);if(o instanceof en){let r=o.getPercent(t,uo),i=o.getPercent(e,uo);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function mPe(o){return Er.greater(o,0)&&Er.less(o,1)}function zQ(o,t,e,r){let i=o[r]-2*t[r]+e[r],n=t[r]-o[r];if(i===0)return[];let s=-n/i,a=[];return mPe(s)&&a.push(s),a}function YQ(o,t,e,r,i){let n,s,a=-o[i]+3*t[i]-3*e[i]+r[i],l=2*(o[i]-2*t[i]+e[i]),c=t[i]-o[i],h=l**2-4*a*c;if(Er.lesseq(h,0))n=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;else{let d=Math.sqrt(h);n=(-l-d)/(2*a),s=(-l+d)/(2*a);let p=a*2;if(Er.lesseq(n,1)&&Er.greatereq(n,0)){let m=Number.NEGATIVE_INFINITY;for(;Er.neq(n,m);){m=n;let g=p*n+l;n=-(a*n**2+l*n+c-g*n)/g}}if(Er.lesseq(s,1)&&Er.greatereq(s,0)){let m=Number.NEGATIVE_INFINITY;for(;Er.neq(s,m);){m=s;let g=p*s+l;s=-(a*s**2+l*s+c-g*s)/g}}}let u=[];return mPe(s)&&u.push(s),mPe(n)&&u.push(n),u}function w6e(o,t){if(o.controls.length===2){let[a,l]=o.controls;kn(a,l)||t.push(new Ct(a,l));return}let e,r;if(o.controls.length===3){let[a,l,c]=o.controls;e=zQ(a,l,c,"x"),r=zQ(a,l,c,"y")}else{let[a,l,c,h]=o.controls;e=YQ(a,l,c,h,"x"),r=YQ(a,l,c,h,"y")}e.sort((a,l)=>l-a),r.sort((a,l)=>l-a);let i=e.pop()||1,n=r.pop()||1,s=0;for(;i!==1||n!==1;)if(Er.eq(i,n))i=e.pop()||1,n=r.pop()||1;else if(i<n){let[a,l]=o.clip((i-s)/(1-s));s=i,t.push(a),o=l,i=e.pop()||1}else{let[a,l]=o.clip((n-s)/(1-s));s=n,t.push(a),o=l,n=r.pop()||1}t.push(o)}var Tft=1e-5,wPe=1,en=class vy extends sz{constructor(t){if(super(),this._startToEndL=null,t.length<2)throw new Error("Bezier needs at least 2 endpoints");this.controls=t.slice()}get startToEndL(){return this._startToEndL===null&&(this._startToEndL=new Ct(this.start(),this.end())),this._startToEndL}build1(t){let e=[];return xk(t,(r,i)=>(e.push(i),!0)),new vy(e)}start(){return this.controls[0]}end(){return this.controls[this.controls.length-1]}static pointOn(t,e){if(e.length<1)throw new Error("bezier must have at least 1 point");if(e.length===1)return e[0];{let r=new Array(e.length-1);for(let i=1;i<e.length;i++){let n=e[i-1],s=e[i],a=(s.x-n.x)*t,l=(s.y-n.y)*t;r[i-1]=n.add1(a,l)}return vy.pointOn(t,r)}}clip1(t,e,r,i){if(r.push(e[0]),i.push(e[e.length-1]),e.length<2)throw new Error("bezier clip must have at least 2 point");if(e.length===2){let n=e[0],s=e[1],a=(s.x-n.x)*t,l=(s.y-n.y)*t,c=n.add1(a,l);r.push(c),i.push(c)}else{let n=new Array(e.length-1);for(let s=1;s<e.length;s++){let a=e[s-1],l=e[s],c=(l.x-a.x)*t,h=(l.y-a.y)*t;n[s-1]=a.add1(c,h)}this.clip1(t,n,r,i)}}clip(t){let e=[],r=[];return this.clip1(t,this.controls,e,r),[new vy(e),new vy(r.reverse())]}greater(t,e,r){return t-e>r}less(t,e,r){return t-e<-r}eq(t,e,r){return Math.abs(t-e)<=r}eqPP(t,e,r){return!t||!e?!1:this.eq(t.x,e.x,r)&&this.eq(t.y,e.y,r)}isInRange(t,e=Er.eps){let r=this.controls.map(n=>n.y-t.y),i=0;for(let n of r){if(this.less(n,0,e))i=i|1;else if(this.greater(n,0,e))i=i|2;else{i=3;break}if(i===3)break}if(i!==3)return!1;i=0;for(let n of this.controls){let s=n.x-t.x;if(this.less(s,0,e))i=i|1;else if(this.greater(s,0,e))i=i|2;else{i=3;break}if(i===3)break}return i===3}getPercent(t,e=Er.eps){if(!this.isInRange(t,e))return null;let r=Number.POSITIVE_INFINITY,i=[[this,0,1]];for(;i.length!==0;){let n=function(y){h=Math.min(h,y),u=Math.max(u,y)},s=function(y,b){let P=hE(y,b);if(P===0)throw new Error("cnt === 0");for(let T=0;T<P;T+=2)n(st[T])},[a,l,c]=i.pop();if(this.eqPP(a.start(),t,e))return l;if(this.eqPP(a.end(),t,e))return c;let h=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,d=a.controls.map(y=>y.y-t.y);r=d.reduce((y,b)=>{let P=Math.abs(b);return P<y?P:y},r),r/=2,r<=e&&(r=e),d.forEach((y,b)=>{this.eq(y,0,e)&&n(b/(d.length-1))});let p=new Ct(new qt(0,-r),new qt(1,-r)),m=new Ct(new qt(0,r),new qt(1,r));for(let y=0;y<d.length-1;y++){let b=new qt(y/(d.length-1),d[y]),P=this.less(b.y,0,e)?1:this.greater(b.y,0,e)?2:3;for(let T=0;T<d.length;T++){let I=new qt(T/(d.length-1),d[T]),C=this.less(I.y,0,e)?1:this.greater(I.y,0,e)?2:3;P!==C&&(P===1?C===2?(s(new Ct(b,I),p),s(new Ct(b,I),m)):s(new Ct(b,I),p):P===2?C===1?(s(new Ct(b,I),p),s(new Ct(b,I),m)):s(new Ct(b,I),m):C===1?s(new Ct(b,I),p):s(new Ct(b,I),m))}}if(!isFinite(h)){if(Math.max(...d.map(y=>Math.abs(y)))<e*4)return(l+c)/2;continue}if(h!==0&&(a=a.clip(h)[1],l=(c-l)*h+l),u!==1){let y=(u-h)/(1-h);a=a.clip(y)[0],c=(c-l)*y+l}if(!a.isInRange(t,e))continue;let g=a.controls.reduce((y,b)=>y.ext2(b),new L2).build1();if(this.eq(g.minX,g.maxX,e)&&this.eq(g.minY,g.maxY,e))return(l+c)/2;if(u-h>.8){let[y,b]=a.clip(.5);y.isInRange(t,e)?(i.push([y,l,(l+c)/2]),b.isInRange(t,e)&&i.push([b,(l+c)/2,c])):i.push([b,(l+c)/2,c])}else i.push([a,l,c])}return null}toBezier(){return this}toString(){return"Bezier ["+this.controls.join(" ")+"]"}bbox(){return this._bbox||(this._bbox=new L2().ext3(this.points(.1)).build1()),this._bbox}bboxWithControls(){return this._bbox_controls||(this._bbox_controls=new L2().ext3(this.controls).build()),this._bbox_controls}multiply3(t){let e=new Array(this.controls.length);for(let r=0;r<this.controls.length;r++){let i=this.controls[r];e[r]=i.multiply3(t)}return new vy(e)}stroke(t,e,r,i=wPe){let n=gft.zoomLines(Ca.build4(this.points(i)),t);return r===0?n:n.reverse()}points(t){let e=[];return this.getBezierPoints(t,r=>e.push(r)),e}getBezierPoints(t,e){if(this.controls.length===2){e(this.start()),e(this.end());return}let r=[this];for(e(this.start());r.length!==0;){let n=r.pop(),s=new Ct(n.start(),n.end());if(i(n.controls,s)<=t)e(n.end());else{let[a,l]=n.clip(.5);r.push(l,a)}}function i(n,s){let a=s.start(),l=s.end();a.equals1(l)&&(l=a.add1(1,0));let c=l.y-a.y,h=a.x-l.x,u=-c*a.x-h*a.y,d=Math.sqrt(1/(c**2+h**2));c*=d,h*=d,u*=d;let p=n.map(m=>Math.abs(c*m.x+h*m.y+u));return Math.max(...p)}}getBezierPoints3(t,e){if(this.controls.length===2){e(this.start()),e(this.end());return}let r=t*t,i=this.controls[0],n=.5;for(;n>Tft&&!(i.distance2(vy.pointOn(n,this.controls))<=r);n*=.5);let s=Math.ceil(1/n);n=1/s,e(i);let a=0;for(let l=1;l<s;l++)a+=n,e(vy.pointOn(a,this.controls));e(this.end())}getPointsBySlope(t){if(this.controls.length===4)return this.getPointsBySlope4(t);throw new Error("Currently, only 4 control points are supported!")}getPointsBySlope4(t){let[e,r,i,n]=this.controls,s=-3*e.x+9*r.x-9*i.x+3*n.x,a=6*e.x-12*r.x+6*i.x,l=-3*e.x+3*r.x,c=[];if(Number.isFinite(t)){let h=-3*e.y+9*r.y-9*i.y+3*n.y,u=6*e.y-12*r.y+6*i.y,d=-3*e.y+3*r.y,p=h-s*t,m=u-a*t,g=d-l*t,y=-m/(2*p),b=Math.sqrt(m**2-4*p*g)/(2*p),P=y+b;P>=0&&P<=1&&c.push(vy.pointOn(P,this.controls));let T=y-b;T>=0&&T<=1&&c.push(vy.pointOn(T,this.controls))}else{let h=-a/(2*s),u=Math.sqrt(a**2-4*s*l)/(2*s),d=h+u;d>=0&&d<=1&&c.push(vy.pointOn(d,this.controls));let p=h-u;p>=0&&p<=1&&c.push(vy.pointOn(p,this.controls))}return c}buildConverxHull(t=Er.eps){let e=[...this.controls],r=[],i=e[0],n=1;do{let s=e[n%e.length];this.eqPP(i,s,t)||r.push(new Ct(i,s)),i=s,n++}while(i!==e[0]);if(r.length===0)throw Error("buildConverxHull(diff = DoubleKit.eps)");return Ca.build7(r).asClose()}getExtremePoints(t){if(!t)return s(this.controls);let e=t.start(),r=t.end(),i=r.x-e.x,n=r.y-e.y;if(Math.abs(i)<=Er.eps||Math.abs(n)<=Er.eps)return s(this.controls);{let a=n/i;if(this.controls.length===3){e.equals1(r)&&(r=e.add1(1,0));let l=r.y-e.y,c=e.x-r.x,h=-l*e.x-c*e.y,u=Math.sqrt(1/(l**2+c**2));l*=u,c*=u,h*=u;let d=this.controls.map(g=>l*g.x+c*g.y+h),p=d[0]-2*d[1]+d[2],m=d[1]-d[0]-a/2;if(p!==0){let g=-m/p;if(Er.greater(g,0)&&Er.less(g,1))return[vy.pointOn(g,this.controls)]}}else if(this.controls.length===4)return this.getPointsBySlope(a)}return[];function s(a){let l,c;if(a.length===3){let[p,m,g]=a;l=zQ(p,m,g,"x"),c=zQ(p,m,g,"y")}else if(a.length===4){let[p,m,g,y]=a;l=YQ(p,m,g,y,"x"),c=YQ(p,m,g,y,"y")}l.sort((p,m)=>m-p),c.sort((p,m)=>m-p);let h=l.pop()||1,u=c.pop()||1,d=[];for(;h!==1||u!==1;)Er.eq(h,u)?(h=l.pop()||1,u=c.pop()||1):h<u?(d.push(vy.pointOn(h,a)),h=l.pop()||1):(d.push(vy.pointOn(u,a)),u=c.pop()||1);return d}}getToLineMaxDis2(t){let e=this.getExtremePoints(t),r=t.distance2(this.start()),i=t.distance2(this.end()),n=Math.max(r,i);return e.forEach(a=>s(t.distance2(a))),n;function s(a){n=Math.max(n,a)}}getToLineMinAndMaxDis_Controls(t){let e=t.start(),r=t.end();t.start().equals1(t.end())&&(r=e.add1(1,0));let i=r.y-e.y,n=e.x-r.x,s=-i*e.x-n*e.y,a=Math.sqrt(1/(i**2+n**2));i*=a,n*=a,s*=a;let l=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY;return this.controls.forEach(h=>{let u=i*h.x+n*h.y+s;u<l&&(l=u),u>c&&(c=u)}),{minDis:l,maxDis:c}}getPercentInLine(t){let e=[],r=[],i=this.controls,n=t.start(),s=t.end(),a=s.y-n.y,l=n.x-s.x,c=-a*n.x-l*n.y,h=Math.sqrt(1/(a**2+l**2));if(a*=h,l*=h,c*=h,a**2+l**2<=0)return e;if(i.length===3){let[u,d,p]=i,m=a*(u.x-2*d.x+p.x)+l*(u.y-2*d.y+p.y),g=2*(a*(d.x-u.x)+l*(d.y-u.y)),y=a*u.x+l*u.y+c;r=bft(m,g,y)}else if(i.length===4){let[u,d,p,m]=i,g=m.sub(p.mul(3)).add(d.mul(3)).sub(u),y=u.sub(d.mul(2)).add(p).mul(3),b=d.sub(u).mul(3),P=u,T=a*g.x+l*g.y,I=a*y.x+l*y.y,C=a*b.x+l*b.y,E=a*P.x+l*P.y+c,O=Math.sqrt(1/(T**2+I**2));T*=O,I*=O,C*=O,E*=O,r=Pft(T,I,C,E)}else throw Error("not support getBeizerPointInLine");return r.forEach(u=>{u>=0&&u<=1&&e.push(u)}),e}reverse(){return new vy(this.controls.slice().reverse())}},GL,L6e=(GL=class{constructor(){this.textCache=new Map,this.numCache=new Array(20),this.boxCache=new Array(4),this.textOffsetCache=new Array(9),this.BuildLineCache=new Array(7),this.BuildTrackCache=new Array(7),this.BuildViaCache=new Array(11),this.BuildBoxCache=new Array(10),this.BuildArcCache=new Array(10),this.BuildArcTrackCache=new Array(10),this.BuildTextCache=new Array(7),this.BuildPadStyleCache=new Array(4),this.BuildPadCache=new Array(12),this.ARRAY1=new Array(1),this.ARRAY2=new Array(2),this.ARRAY3=new Array(3),this.ARRAY4=new Array(4),this.ARRAY5=new Array(5),this.ARRAY6=new Array(6),this.ARRAY7=new Array(7),this.ARRAY8=new Array(8),this.ARRAY9=new Array(9),this.ARRAY10=new Array(10),this.ARRAY11=new Array(11),this.ARRAY12=new Array(12),this.textOffsetCache[0]=qt.ORIGIN,this.textOffsetCache[1]=new qt(0,-.5),this.textOffsetCache[2]=new qt(0,-1),this.textOffsetCache[3]=new qt(-.5,0),this.textOffsetCache[4]=new qt(-.5,-.5),this.textOffsetCache[5]=new qt(-.5,-1),this.textOffsetCache[6]=new qt(-1,0),this.textOffsetCache[7]=new qt(-1,-.5),this.textOffsetCache[8]=new qt(-1,-1)}static getCache(){return GL.instance==null&&(GL.instance=new GL),GL.instance}},GL.instance=null,GL),Ct=class UL extends sz{constructor(t,e){super(),this._a=null,this._b=null,this._c=null,this.__bbox=null,this._hashed=null,this._direct=null,this._start=t,this._end=e}get a(){return this._a===null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._a}get b(){return this._b===null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._b}get c(){return this._c===null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._c}get hashed(){return this._hashed==null&&(this._hashed=this._hashCode()),this._hashed}get direct(){return this._direct==null&&(this._direct=this._end.sub(this._start).normalize()),this._direct}cutLine(t){if(Er.eq(this.distance(t),0)){let e=new UL(this._start,t);return e._a=this._a,e._b=this._b,e._c=this._c,e}return new UL(this._start,t)}get midPoint(){return this._start.add(this._end).mul(.5)}toBezier(){return new en([this._start,this._end])}_hashCode(){let t=31,e=1;return e=t*e+this._start.hashCode(),e=t*e+this._end.hashCode(),e}start(){return this._start}end(){return this._end}center(){let t=this.start(),e=this.end();return t.add(e).mul(.5)}panDistance(t){let e=this._end.x-this._start.x,r=this._end.y-this._start.y,i=this.length();e=e*t/i,r=-r*t/i;let n=new qt(this._start.x+r,this._start.y+e),s=new qt(this._end.x+r,this._end.y+e);return new UL(n,s)}isPoint(){return this._start.distance2(this._end)<=1e-8}length(){return this._start.distance1(this._end)}toString(){return"Line [start="+this._start+", end="+this._end+"]"}bbox(){if(this.__bbox==null){let t=L6e.getCache().boxCache;t[0]=Math.min(this._start.x,this._end.x),t[1]=Math.max(this._start.x,this._end.x),t[2]=Math.min(this._start.y,this._end.y),t[3]=Math.max(this._start.y,this._end.y),this.__bbox=new C1(t[0],t[1],t[2],t[3])}return this.__bbox}multiply3(t){return new UL(this._start.multiply3(t),this._end.multiply3(t))}hashCode(){return this.hashed}equals(t){let e=t;return this.hashed===e.hashed&&this._start.equals(e._start)&&this._end.equals(e._end)}equals1(t){let e=t;return this.hashed===e.hashed&&this._start.equals1(e._start)&&this._end.equals1(e._end)}equals2(t){let e=[this.start(),this.end()],r=[t.start(),t.end()];return CS(e,r)||CS(e,r.reverse())}stroke(t,e,r){let i,n,s;this._end.x<this._start.x?(n=this._start.x-this._end.x,s=this._start.y-this._end.y,i=this._end):(n=this._end.x-this._start.x,s=this._end.y-this._start.y,i=this._start);let a=Math.sqrt(n*n+s*s),l=t/2,c,h,u;e===2?(h=-l,u=a+l):(h=0,u=a),e===0||e===2?r===0?c=Ca.build5([h,-l,h,l,u,l,u,-l]):c=Ca.build5([h,l,h,-l,u,-l,u,l]):r===0?c=Ca.build2([Ir.build3(new qt(h,0),-90,-180,l,l),Ir.build3(new qt(u,0),90,-180,l,l)]):c=Ca.build2([Ir.build3(new qt(h,0),90,180,l,l),Ir.build3(new qt(u,0),-90,180,l,l)]);let d=Math.atan2(s,n),p=y0.rotate(d).translate1(i);return c.asClose().multiply3(p)}points(t){return[this._start,this._end]}mirrorY(t){return new UL(this.start().mirrorY(t),this.end().mirrorY(t))}reverse(){return new UL(this._end,this._start)}inArea(t,e,r){let i=t.x,n=t.y,s=this._start,a=this._end,l=r==1,c=i-s.x,h=n-s.y,u=i-a.x,d=n-a.y,p=a.x-s.x,m=a.y-s.y,g=new qt(-m,p).normalize(),y=p+g.x*e/2,b=m+g.y*e/2,P=y*y+b*b,T=c*c+h*h,I=u*u+d*d,C=Math.abs(c*m-h*p)/2,E=Math.sqrt(p*p+m*m)*e/4;if(C<=E&&T<=P&&I<=P){if(l)return!0;{let O=new qt(i,n).sub(a).normalize(),_=new qt(i,n).sub(s).normalize(),R=new qt(g.x,g.y).cross(O),v=new qt(g.x,g.y).cross(_);return R>=0&&v<=0}}else if(l){let O=e/2;return T<=O*O?!0:I<=O*O}else return!1}isParallel(t,e=!1){let r=Er.eq(Math.abs(this.direct.cross(t.direct)),0),i=!e||Er.greatereq(this.direct.dot(t.direct),0);return r&&i}distance2(t){return(this.a*t.x+this.b*t.y+this.c)**2/(this.a**2+this.b**2)}distance2ForPP(t){let{x:e,y:r}=t,{x:i,y:n}=this.start(),{x:s,y:a}=this.end();return((e-i)*(a-n)-(r-n)*(s-i))**2/((a-n)**2+(s-i)**2)}distance(t){return Math.abs(this.a*t.x+this.b*t.y+this.c)/Math.sqrt(this.a**2+this.b**2)}};function Ift(o,t=.05){if(o.length<3)return o.slice();let e=o.slice(0,1),r=(n,s,a)=>eft(n.x,n.y,s.x,s.y,a.x,a.y);for(;;){e=o.slice(0,1);for(let n=1;n<o.length-1;n+=2)r(o[n],o[n-1],o[n+1])>t&&e.push(o[n]),e.push(o[n+1]);if(e.at(-1).equals1(o.at(-1))||e.push(o.at(-1)),o.length==e.length)break;o=e}let i=o[o.length-1];return e.push(i),e}var Cft=R0t(D0t()),Sft=class{constructor(){this.fac=new L2,this.length=0,this.box=null,this.pt=null,this.i=0}calcBBox(o){for(this.fac.clear(),this.length=o.length,this.box=null,this.pt=null,this.i=0;this.i<this.length;this.i++)this.pt=o[this.i],this.box=this.pt.bbox(),this.fac.ext1(this.box);return this.fac.build1()}},Eft=new Sft,Ca=class Wp{constructor(t,e){this.__bbox=null,this.primitives=t,this.__bbox=e}static calcBBox(t){return Eft.calcBBox(t)}static build1(t){let e=[],r=null;return GQ(t,(i,n)=>{let s=n.start();return r!==null&&!s.equals(r)&&e.push(new Ct(r,s)),e.push(n),r=n.end(),!0}),e.length===0&&r!=null&&e.push(new Ct(r,r)),new Wp(e)}static build2(t){return Wp.build1(dPe(t))}static build3(t){let e=[],r=null;return GQ(t,(i,n)=>(r!==null&&e.push(new Ct(r,n)),r=n,!0)),new Wp(e)}static build4(t){return this.build3(dPe(t))}static build5(t){let e=[];for(let r=0;r<t.length;r+=2)e.push(new qt(t[r],t[r+1]));return this.build4(e)}static build6(t){return Wp.build4([t.LL(),t.LR(),t.UR(),t.UL(),t.LL()])}static build7(t){return new Wp(t)}static build8(t){let e=new qt(t[0],t[1]),r,i=[],n,s=(a,l)=>a.length==l&&a.every(c=>typeof c=="number");for(let a=2;a<t.length;)switch(typeof t[a]=="string"?n=t[a]:a-=1,n){case"ARC":{let l=t.slice(a+1,a+4);if(!s(l,3))throw new Error("invalid rawData");let c=l[0];r=new qt(l[1],l[2]),i.push(Ir.build5(e,r,c)),e=r,a+=4;break}case"L":{let l=t.slice(a+1,a+3);if(!s(l,2))throw new Error("invalid rawData");r=new qt(l[0],l[1]),i.push(new Ct(e,r)),e=r,a+=3;break}case"C":{let l=t.slice(a+1,a+7);if(!s(l,7))throw new Error("invalid rawData");let c=new qt(l[0],l[1]),h=new qt(l[2],l[3]);r=new qt(l[4],l[5]),i.push(new en([e,c,h,r])),e=r,a+=7;break}default:throw new Error("invalid rawData")}return Wp.build2(i)}static buildBBox(t,e=0){return e===1?Wp.build5([t.minX,t.minY,t.maxX,t.minY,t.maxX,t.maxY,t.minX,t.maxY,t.minX,t.minY]):Wp.build5([t.minX,t.minY,t.minX,t.maxY,t.maxX,t.maxY,t.maxX,t.minY,t.minX,t.minY])}static triangulate(t,e,r=1){if(t.length===1){let l=new Array;t[0].asClose().points2(r,d=>l.push(d));let c,h=l[0],u=[];for(let d=0;d<l.length-2;d+=2){let p=l[d+1],m=l[d+2],g=p.sub(h).normalize().cross(m.sub(h).normalize());if(Er.neq(g,0)){if(c===!0){if(g<0){u.length=0;break}}else if(c===!1){if(g>0){u.length=0;break}}else c=g>0;u.push(h),u.push(p),u.push(m)}l.push(h),h=m}if(u.length!==0){for(let d=0;d<u.length;d+=3)e(u[d],u[d+1],u[d+2]);return}}let i=[],n=[];t.forEach(l=>{i.length!==0&&n.push(i.length/2),l.asClose().points2(r,c=>i.push(c.x,c.y))});let s=Cft.default(i,n),a=[];for(let l=1;l<i.length;l+=2)a.push(new qt(i[l-1],i[l]));for(let l=0;l<s.length;l+=3)e(a[s[l]],a[s[l+1]],a[s[l+2]])}lines(t,e){let r=new Array;this.points(t,n=>r.push(n));let i=r[0];for(let n=1;n<r.length;n++){let s=r[n];e(i),e(s),i=s}}triangles(t,e){Wp.triangulate([this],(...r)=>{r.forEach(i=>e(i))},t)}mirror(){let t=[];return this.primitives.forEach(e=>{if(e instanceof Ct)e=new Ct(e.start().mirror(),e.end().mirror());else if(e instanceof Ir)e=e.mirror();else if(e instanceof en){let r=e.controls.map(i=>i.mirror());e=new en(r)}else throw new Error("bug");t.push(e)}),new Wp(t,this.__bbox)}getPoints(t){let e=[];for(let r of this.primitives)for(let i of r.points(t))e.push(i);return e}round(t=4){let e=this.primitives.slice();for(let r=0;r<e.length;r++){let i=e[r];if(i instanceof Ct){let n=i.start().round(t),s=i.end().round(t);e[r]=new Ct(n,s)}else if(i instanceof en){let n=i.controls.map(s=>s.round(t));e[r]=new en(n)}else if(i instanceof Ir){let n=i.start().round(t),s=i.end().round(t),a=i.sweepAngle;e[r]=Ir.build5(n,s,a)}}return new Wp(e,this.__bbox)}simplify(t=.05){let e=[],r=!1,i=[],n=this.closed();if(this.primitives.length<=1)return Wp.build2(this.primitives);let s=()=>{if(i.length>2){let l=Ift(i,t);for(let c=1;c<l.length;c++)e.push(new Ct(l[c-1],l[c]))}else e.push(new Ct(i[0],i[1]));i.length=0,r=!1};for(let l=0;l<this.primitives.length;l++){let c=this.primitives[l];c instanceof Ct?(r?i.push(c.end()):(i.length=0,i.push(c.start(),c.end()),r=!0),l===this.primitives.length-1&&s()):(r&&s(),e.push(c))}let a=new Wp(e,this.__bbox);return n&&!a.closed()&&(a=a.asClose()),a}hasBackLine(){let{primitives:t}=this,e;for(let r=0;r<t.length;r++){let i=t[r];if(i instanceof Ct){if(i.end().equals1(i.start()))continue;if(e&&(i.end().equals1(e.start())||tft(i.end(),e.start(),e.end())))return!0;e=i}else e=null}return!1}area(t=.1){let e=0,r=this.end();return this.primitives.forEach(i=>{let n=i.start(),s=i.end();if(e+=(n.x+r.x)*(n.y-r.y),i instanceof Ct)e+=(s.x+n.x)*(s.y-n.y);else if(i instanceof Ir)e+=(s.x+n.x)*(s.y-n.y),e+=Math.PI*i.rx2*i.sweepAngle/180-qt.normal(i.center,i.start(),i.end());else if(i instanceof en){let a=n;i.points(t).forEach(l=>{e+=(l.x+a.x)*(l.y-a.y),a=l}),e+=(s.x+a.x)*(s.y-a.y)}r=s}),e/2}closed(t){return this.primitives.length===0?!1:this.start().equals(this.end(),t)}asClose(){let t=this.primitives[0],e=this.primitives[this.primitives.length-1],r=t.start(),i=e.end();if(r.equals(i))return this;{let n=new Array;return S1.addAll(n,this.primitives),n.push(new Ct(i,r)),Wp.build2(n)}}closeEndpoint(){let t=this.primitives[0],e=this.primitives[this.primitives.length-1],r=t.start(),i=e.end();if(r.equals1(i))return this;{let n=new Array;return S1.addAll(n,this.primitives),n.push(new Ct(i,r)),new Wp(n)}}reverse(){let t=new Array(this.primitives.length);for(let e=0,r=this.primitives.length-1;r>=0;e++,r--){let i=this.primitives[r];if(i instanceof Ct)i=new Ct(i.end(),i.start());else if(i instanceof Ir)i=i.exchangeSweep();else if(i instanceof en)i=new en(i.controls.slice().reverse());else throw new Error("bug");t[e]=i}return new Wp(t,this.__bbox)}reverse1(){let t=new Array(this.primitives.length);for(let e=0,r=this.primitives.length-1;r>=0;e++,r--){let i=this.primitives[r];if(i instanceof Ct)i=new Ct(i.end(),i.start());else if(i instanceof Ir)i=i.exchangeSweep1();else if(i instanceof en)i=new en(i.controls.slice().reverse());else throw new Error("bug");t[e]=i}return new Wp(t,this.__bbox)}mirrorY(t){let e=[];return this.primitives.forEach(r=>{if(r instanceof Ct)r=r.mirrorY(t);else if(r instanceof Ir)r=r.mirrorY(t);else if(r instanceof en){let i=r.controls.map(n=>n.mirrorY(t));r=new en(i)}else throw new Error("bug");e.push(r)}),new Wp(e,this.__bbox)}points(t,e){if(this.primitives.length!==0){for(let r=0;r<this.primitives.length-1;r++){let i=this.primitives[r].points(t);i.pop(),i.forEach(n=>e(n))}this.primitives[this.primitives.length-1].points(t).forEach(r=>e(r))}}points1(t,e){if(this.primitives.length===0)return;for(let i=0;i<this.primitives.length-1;i++){let n=this.primitives[i],s=n instanceof Ir?n.points1(t):n.points(t);s.pop(),s.forEach(a=>e(a))}let r=this.primitives[this.primitives.length-1];(r instanceof Ir?r.points1(t):r.points(t)).forEach(i=>e(i))}points2(t,e){if(this.primitives.length===0)return;for(let i=0;i<this.primitives.length-1;i++){let n=this.primitives[i],s=n instanceof Ir?n.points2():n.points(t);s.pop(),s.forEach(a=>e(a))}let r=this.primitives[this.primitives.length-1];(r instanceof Ir?r.points2():r.points(t)).forEach(i=>e(i))}multiply3(t){let e=new Array(this.primitives.length);for(let r=0;r<this.primitives.length;r++)e[r]=this.primitives[r].multiply3(t);return Wp.build7(e)}bbox(){return this.__bbox==null&&(this.__bbox=Wp.calcBBox(this.primitives)),this.__bbox}start(){return this.primitives.length!==0?this.primitives[0].start():null}end(){return this.primitives.length!==0?this.primitives[this.primitives.length-1].end():null}isClose(t){if(this.primitives.length<=1&&!(this.primitives[0]instanceof Ir))return!1;{let e=this.primitives[0],r=this.primitives[this.primitives.length-1];return e.start().equals(r.end(),t)}}isEqual(t){if(t instanceof Wp&&t.primitives.length==this.primitives.length){let e=t.primitives.length;for(let r=0;r<e;r++){let i=t.primitives[r],n=this.primitives[r];if(JSON.stringify(i)!=JSON.stringify(n))return!1}return!0}return!1}equals(t){if(!t)return!1;let e=this.primitives,r=t.primitives;if(e.length!=r.length)return!1;if(t.isClose()){let i=0;for(;i<e.length;){let n=e.slice(i).concat(e.slice(0,i));if(CS(n,r)||CS(n.reverse(),r))return!0;i++}return!1}else return CS(this.primitives,t.primitives)}clone(){return Wp.build2(this.primitives)}putItem(t,e){if(!t)return!1;if(t instanceof Wp)return this.mergePolyline(t,e);let r=this.start();if(!r){this.primitives.push(t),this.__bbox=t.bbox();return}let i=this.end();if(r.equals(i,e))return!1;let n=t.start(),s=t.end(),a=!1,l=!1;if(r.equals(n,e))a=!0,l=!1;else if(r.equals(s,e))a=!1,l=!1;else if(i.equals(n,e))a=!1,l=!0;else if(i.equals(s,e))a=!0,l=!0;else return!1;return l?this.primitives.push(a?t.reverse():t):this.primitives.unshift(a?t.reverse():t),this.__bbox=C1.extend2(this.__bbox,t.bbox()),!0}mergePolyline(t,e,r=0){if(!t)return!1;let i=this.start();if(!i){this.primitives.push(...t.primitives),this.__bbox=t.bbox();return}let n=this.end();if(i.equals(n,e))return!1;let s=t.start(),a=t.end(),l=!1,c=!1;if(i.equals(s,e))l=!0,c=!1;else if(i.equals(a,e))l=!1,c=!1;else if(n.equals(s,e))l=!1,c=!0;else if(n.equals(a,e))l=!0,c=!0;else return!1;let h=l?t.reverse():t;return c?this.primitives.push(...h.primitives):this.primitives.unshift(...h.primitives),this.__bbox=C1.extend2(this.__bbox,t.bbox()),!0}deDuplicationPoint(t){let e=this.primitives[this.primitives.length-1].start(),r=this.primitives[this.primitives.length-1].end(),i=t.primitives[0].start(),n=t.primitives[0].end();if(this.primitives[this.primitives.length-1]instanceof Ct&&t.primitives[0]instanceof Ct&&lft([e,r],[i,n])){this.primitives.pop(),t.primitives.shift();let s=[];s.push(new Ct(e,n)),this.primitives.push(...s)}}getMaxBBoxHeightByVec(t){let e=t.normalize(),r=-1/0,i=1/0;if(this.primitives.forEach(s=>{let a=s.start().dot(e),l=s.end().dot(e);if(n(a),n(l),s instanceof Ir){let c=t.angleD(qt.ORIGIN);if(s.angleIsInArc(c)){let h=s.pointOn(c).dot(e);n(h)}if(s.angleIsInArc(c+180)){let h=s.pointOn(c-180).dot(e);n(h)}}}),r-i<=0)throw new Error("getMaxBBoxHeightByVec");return r-i;function n(s){s>r&&(r=s),s<i&&(i=s)}}getWindingNum(t){let e=this.end(),r=0,{x:i,y:n}=t;for(let a of this.primitives){if(e.y>n?a.bbox().minY>n:a.bbox().maxY<=n){e=a.end();continue}if(a instanceof Ir&&(a.isCCW?Math.floor(a.startAngle/90)+1!==Math.ceil(a.endAngle()/90):Math.ceil(a.startAngle/90)-1!==Math.floor(a.endAngle()/90))){let l=a.startAngle,c=a.endAngle();if(a.sweepAngle>0){let h=90;for(;h<=c;)h>l&&(s(Ir.build3(a.center,l,h-l,a.rx,a.ry)),l=h),h+=90;l<c&&s(Ir.build3(a.center,l,c-l,a.rx,a.ry))}else{let h=270;for(;h>=c;)h<l&&(s(Ir.build3(a.center,l,h-l,a.rx,a.ry)),l=h),h-=90;l>c&&s(Ir.build3(a.center,l,c-l,a.rx,a.ry))}}else if(a instanceof en){let l=[];w6e(a,l),l.forEach(c=>s(c))}else s(a)}return r;function s(a){let l=a.start(),c=a.end();if(e.y>n!=l.y>n&&(e.x>i?l.x>i?r+=l.y>e.y?1:-1:e.y>l.y?(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)<0&&r--:(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)>0&&r++:l.x>i&&(e.y>l.y?(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)<0&&r--:(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)>0&&r++)),l.y>n!=c.y>n){if(l.x>i)if(c.x>i)r+=c.y>l.y?1:-1;else if(a instanceof Ct)l.y>c.y?(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)<0&&r--:(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)>0&&r++;else if(a instanceof Ir){let{center:h,isCCW:u,rx2:d}=a,p=(h.x-i)**2+(h.y-n)**2;l.y>c.y?(u?p>d:p<d)&&r--:(u?p<d:p>d)&&r++}else if(a instanceof en){if(Y4e(a,n)===0)throw new Error("no inters");st[0]>i&&(r+=c.y>l.y?1:-1)}else throw new Error("not support!");else if(c.x>i)if(a instanceof Ct)l.y>c.y?(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)<0&&r--:(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)>0&&r++;else if(a instanceof Ir){let{center:h,isCCW:u,rx2:d}=a,p=(h.x-i)**2+(h.y-n)**2;l.y>c.y?(u?p>d:p<d)&&r--:(u?p<d:p>d)&&r++}else if(a instanceof en){if(Y4e(a,n)===0)throw new Error("no inters");st[0]>i&&(r+=c.y>l.y?1:-1)}else throw new Error("not support!")}e=c}}},AQ=Math.PI*2,PGt=Math.PI/2,TGt=Math.sin(Math.PI/180),Oft=4,Ir=class Zh extends sz{constructor(t,e,r,i,n){super(),this._rx2=null,this._ry2=null,this._svgEnd=null,this._hashed=null,this.__bbox=null,this.rx=t,this.ry=e,this.center=r,this.startAngle=i,this.sweepAngle=n,this._start=qt.ORIGIN,this._end=qt.ORIGIN,this._start=this.pointOn(i),this._end=this.pointOn(i+n)}get hashed(){return this._hashed==null&&(this._hashed=this._hashCode()),this._hashed}hashCode(){return this.hashed}_hashCode(){let t=31,e=1;return e=t*e+new qt(this.rx,this.rx).hashCode(),e=t*e+this.center.hashCode(),e=t*e+new qt(this.startAngle,this.sweepAngle).hashCode(),e}get rx2(){return this._rx2==null&&(this._rx2=this.rx*this.rx),this._rx2}get ry2(){return this._ry2==null&&(this._ry2=this.ry*this.ry),this._ry2}get svgEnd(){return this._svgEnd==null&&(this._svgEnd=this.getSvgEnd(this.startAngle,this.sweepAngle,this._start,this._end)),this._svgEnd}getSvgEnd(t,e,r,i){let n=e>=0?-.01:.01,s=t+e;for(;(e>=0&&s>t||e<0&&s<t)&&r.distance2(i)<2e-4;)n*=2,s+=n,i=this.pointOn(s);return i}static build1(t,e,r,i,n,s){Wu.positive(r),Wu.positive(i);let a=t.equals(e);if(a)return new Zh(r,i,t,0,n?360:0);{let l=t.x,c=-t.y,h=e.x,u=-e.y,d=s===0,p=(l-h)/2,m=(c-u)/2,g=Math.cos(0),y=Math.sin(0),b=g*p+y*m,P=-y*p+g*m;r=Math.abs(r),i=Math.abs(i);let T=r*r,I=i*i,C=b*b,E=P*P,O=n===d?-1:1,_=(T*I-T*E-I*C)/(T*E+I*C);_=_<0?0:_;let R=O*Math.sqrt(_),v=R*(r*P/i),D=R*-(i*b/r),w=(l+h)/2,F=(c+u)/2,H=w+(g*v-y*D),z=F+(y*v+g*D),G=(b-v)/r,W=(P-D)/i,L=(-b-v)/r,B=(-P-D)/i,N,U;U=Math.sqrt(G*G+W*W),N=G,O=W<0?-1:1;let k=Qo.toDegrees(O*Math.acos(N/U));U=Math.sqrt((G*G+W*W)*(L*L+B*B)),N=G*L+W*B,O=G*B-W*L<0?-1:1;let V=N/U,Y;V<-1?Y=Math.acos(-1):V>1?Y=Math.acos(1):Y=Math.acos(V);let X=Qo.toDegrees(O*Y);!d&&X>0?X-=360:d&&X<0&&(X+=360),Wu.normal(k),Wu.normal(X);let Z=p*p/T+m*m/I,Q=t.distance1(e)/2;r<Q&&i<Q&&(r*=Math.sqrt(Z),i*=Math.sqrt(Z));let ae=a?0:Qo.regularD(-k),he=a?n?360:0:-X;return new Zh(r,i,new qt(H,-z),ae,he)}}static build2(t,e,r,i,n,s){Wu.positive(i),Wu.positive(n),Wu.normal(e),Wu.normal(r);let a;return e===r?(e=Qo.regularD(e),r=Qo.regularD(r),a=0):(e=Qo.regularD(e),r=Qo.regularD(r),s===1?r<=e&&(r+=360):r>=e&&(e+=360),a=r-e),new Zh(i,n,t,Qo.regularD(e),a)}static build3(t,e,r,i,n){return Wu.positive(i),Wu.positive(n),Wu.normal(r),new Zh(i,n,t,Qo.regularD(e),r)}static build4(t,e,r,i,n,s){let a=t.angleD(r),l=e.angleD(r);return Zh.build2(r,a,l,i,n,s)}static build5(t,e,r){r=Qo.toRadians(r);let i=e.sub(t),n=new qt(-i.y,i.x).normalize(),s=Math.abs(r)/2,a;if(s!=0)a=i.length()/2/Math.sin(s);else throw new Error("Can't represent circle!!!");let l=n.rotate(qt.ORIGIN,s),c,h;r>0?(c=1,h=e.add(l.scale(a))):(c=0,h=t.sub(l.scale(a)));let u=Qo.toDegrees(t.angle(h)),d=Qo.toDegrees(e.angle(h));return Zh.build2(h,u,d,a,a,c)}static buildCircle(t,e,r=0){return Zh.build2(t,0,360,e,e,r)}start(){return this._start}end(){return this._end}isLarge(){return Math.abs(this.sweepAngle)>180}sweep(){return this.sweepAngle>=0?1:0}get isCCW(){return this.sweepAngle>=0}endAngle(){return this.startAngle+this.sweepAngle}pointOn(t){t=Qo.regularD(t);let e=this.rx,r=this.ry;if(t===0)return this.center.add1(e,0);if(t===90)return this.center.add1(0,r);if(t===180)return this.center.add1(-e,0);if(t===270)return this.center.add1(0,-r);{let i=this.rx2,n=this.ry2,s=Math.tan(Qo.toRadians(t)),a=s*s,l=Math.sqrt(i*n/(i+n/a)),c=Math.sqrt(i*n/(n+i*a));return t>90&&t<270&&(c=-c),t>180&&t<360&&(l=-l),isNaN(c)&&(c=0),isNaN(l)&&(l=0),this.center.add1(c,l)}}exchangeSweep(){return Zh.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,this.rx,this.ry)}exchangeSweepAndStart(){return Zh.build1(this.end(),this.start(),this.rx,this.ry,this.isLarge(),this.sweepAngle>=0?0:1)}exchangeSweep1(){return Zh.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle+.01,this.rx,this.ry)}mirrorY(t){let e=this.start(),r=this.end();return e.equals(r)?Zh.build3(this.center.mirrorY(),0,360,this.rx,this.ry):Zh.build1(e.mirrorY(t),r.mirrorY(t),this.rx,this.ry,this.isLarge(),this.sweepAngle>=0?0:1)}mirror(t=qt.ORIGIN){let e=this.start(),r=this.end();return e.equals(r)?Zh.build3(this.center.mirror(t),0,360,this.rx,this.ry):Zh.build1(e.mirror(t),r.mirror(t),this.rx,this.ry,this.isLarge(),this.sweep())}sectorArea(){return Math.abs(this.sweepAngle)/360*Math.PI*this.rx*this.ry}area(){let t=pPe.area(this.center,this._start,this.pointOn(this.endAngle()));return this.sectorArea()-t}multiply3(t){let e;t.isMirrored()?e=-this.sweepAngle:e=this.sweepAngle;let r;return t.equals(y0.ROT_90)?r=Qo.regularD(this.startAngle+90):t.equals(y0.ROT_N90)?r=Qo.regularD(this.startAngle-90):r=Qo.transformD(this.startAngle,t),Zh.build3(this.center.multiply3(t),r,e,t.iScale*this.rx,t.iScale*this.ry)}angleIsInArc(t){return t=Qo.regularD(t),this.sweepAngle>0?(t<this.startAngle&&(t+=360),this.endAngle()>t):(t>this.startAngle&&(t-=360),this.endAngle()<t)}toBezier(){if(Math.abs(this.sweepAngle)>90)throw new Error("not support!");let t=this.start(),e=this.end(),r=Qo.toRadians(this.sweepAngle)/2,i=4/3*(1-Math.cos(r))/Math.sin(r)*this.rx;return new en([t,t.add(new qt(i,0).multiply3(y0.rotateD(this.startAngle+90))),e.add(new qt(i,0).multiply3(y0.rotateD(this.endAngle()-90))),e])}toBezier2(){let t=[];r(this,90);let e=[];return t.forEach(i=>e.push(i.toBezier())),e;function r(i,n){if(Math.abs(i.sweepAngle)>n){let s=i.sweepAngle/2;r(Zh.build3(i.center,i.startAngle,s,i.rx,i.ry),n),r(Zh.build3(i.center,i.startAngle+s,s,i.rx,i.ry),n)}else t.push(i)}}buildBBox(){let t=L6e.getCache().boxCache,e=this.startAngle+this.sweepAngle;if(t[0]=Math.min(this._start.x,this._end.x),t[1]=Math.max(this._start.x,this._end.x),t[2]=Math.min(this._start.y,this._end.y),t[3]=Math.max(this._start.y,this._end.y),this.sweepAngle>0){let r=0;for(;r<e;){if(r>this.startAngle){let i=this.pointOn(r);t[0]=Math.min(t[0],i.x),t[1]=Math.max(t[1],i.x),t[2]=Math.min(t[2],i.y),t[3]=Math.max(t[3],i.y)}r+=90}}else if(this.sweepAngle<0){let r=360;for(;r>e;){if(r<this.startAngle){let i=this.pointOn(r);t[0]=Math.min(t[0],i.x),t[1]=Math.max(t[1],i.x),t[2]=Math.min(t[2],i.y),t[3]=Math.max(t[3],i.y)}r-=90}}return new C1(t[0],t[1],t[2],t[3])}bbox(){return this.__bbox==null&&(this.__bbox=this.buildBBox()),this.__bbox}length(){return Math.abs(this.rx*this.sweepAngle*Math.PI/180)}toString(){return Ak.format("Arc [start=%s, end=%s, rx=%s, ry=%s, center=%s, startAngle=%s, sweepAngle=%s]",this._start,this._end,this.rx,this.ry,this.center,this.startAngle,this.sweepAngle)}stroke(t,e,r){let i=t/2,n=this.rx+i,s=this.ry+i,a=this.rx-i,l=this.ry-i,c=new y0;a<0&&(a=-a,c=c.multiply3(y0.MIRROR_Y)),l<0&&(l=-l,c=c.multiply3(y0.MIRROR_X)),a===0&&(a=.001),l===0&&(l=.001),c=c.setOrigin1(this.center);let h,u;switch(r===this.sweep()?(h=Zh.build3(this.center,this.startAngle,this.sweepAngle,n,s),u=Zh.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,a,l)):(h=Zh.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,n,s),u=Zh.build3(this.center,this.startAngle,this.sweepAngle,a,l)),u=u.multiply3(c),e){case 1:{let d=r===1?180:-180,p=r===this.sweep()?this.pointOn(this.endAngle()):this.pointOn(this.startAngle),m=r===this.sweep()?this.pointOn(this.startAngle):this.pointOn(this.endAngle()),g=h.pointOn(h.endAngle()).angleD(p),y=u.pointOn(u.endAngle()).angleD(m);return Ca.build2([h,Zh.build3(p,g,d,i,i),u,Zh.build3(m,y,d,i,i)])}default:return Ca.build2([h,u])}}points2(){let t=Math.ceil(Math.abs(this.sweepAngle)/Oft),e=this.sweepAngle/t,r=[this._start];for(let i=1;i<t;i++)r.push(this.pointOn(this.startAngle+e*i));return r.push(this._end),r}points1(t){let e=Math.max(this.rx,this.ry);if(e<=t)return[this.start(),this.svgEnd];let r=(e-t)/e,i=Math.ceil(Math.abs(this.sweepAngle/Qo.toDegrees(Math.acos(r))/2)),n=new Array(i+1),s=this.sweepAngle/i,a=this.startAngle;for(let l=0;l<=i;l++,a+=s)n[l]=this.pointOn(a);return n}points(t){let e=Math.max(this.rx,this.ry);if(t=Math.abs(t),e<=t)return[this.start(),this.svgEnd];t=Math.max(t,e*1e-5),t=Math.min(t,e*(1-Math.SQRT1_2));let r=(e-t)/e,i=Math.ceil(Math.abs(this.sweepAngle/Qo.toDegrees(Math.acos(r))/2));i=Math.max(i,2);let n=new Array(i+1),s=this.sweepAngle/i,a=this.startAngle+s;n[0]=this.start();for(let l=1;l<i;l++,a+=s)n[l]=this.pointOn(a);return n[i]=this.end(),n}panDistance(t){return this.sweepAngle>0?new Zh(this.rx-t,this.ry-t,this.center,this.startAngle,this.sweepAngle):new Zh(this.rx+t,this.ry+t,this.center,this.startAngle,this.sweepAngle)}panDistance1(t){if(this.sweepAngle>0){let e=this.rx-t;return e<0?(e=Math.abs(e),Zh.build3(this.center,this.startAngle-180,this.sweepAngle,e,e)):new Zh(e,e,this.center,this.startAngle,this.sweepAngle)}else{let e=this.rx+t;return e<0?(e=Math.abs(e),Zh.build3(this.center,this.startAngle-180,this.sweepAngle,e,e)):new Zh(e,e,this.center,this.startAngle,this.sweepAngle)}}get bulge(){let t=Math.abs(J0t(this.sweepAngle,3))/180*Math.PI;return Math.tan(t/4)}get midPoint(){let t=Qo.toRadians(this.startAngle),e=Qo.toRadians(this.endAngle()),r=this.sweep(),i=this.center,n=this.rx;if(r==1)if(e>t){let s=(e-t)/2+t;return i.add(new qt(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new qt(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(e+AQ-t)/2+t;return i.add(new qt(Math.cos(s),Math.sin(s)).mul(n))}}else if(e>t){let s=(t+AQ-e)/2+e;return i.add(new qt(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new qt(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(t-e)/2+e;return i.add(new qt(Math.cos(s),Math.sin(s)).mul(n))}}}get svgPathData(){return[{type:"M",values:[this._start.x,this._start.y]},{type:"A",values:[this.rx,this.ry,0,this.isLarge()?1:0,this.isCCW,this._end.x,this._end.y]}]}equals(t){let e=Qo.regularD(this.startAngle),r=Qo.regularD(this.sweepAngle),i=Qo.regularD(t.startAngle),n=Qo.regularD(t.sweepAngle);return CS([this.rx,this.ry,this.center,Math.abs(r)],[t.rx,t.ry,t.center,Math.abs(n)])&&(CS([r,e],[n,i])||CS([Qo.regularD(e+r)],[i]))}equals1(t){let e=Qo.regularD(this.startAngle),r=Qo.regularD(this.sweepAngle),i=Qo.regularD(t.startAngle),n=Qo.regularD(t.sweepAngle);return CS([this.rx,this.ry,this.center,Math.abs(r)],[t.rx,t.ry,t.center,Math.abs(n)])&&(CS([r,e],[n,i])||CS([Qo.regularD(e+r)],[i]))}inArea(t,e){let r=t.x,i=t.y,n=this.center,s=this.rx,a=Qo.toRadians(this.startAngle);this.sweep()==0&&(a=Qo.toRadians(this.endAngle()));let l=Qo.toRadians(this.endAngle());this.sweep()==0&&(l=Qo.toRadians(this.startAngle));let c=s-e/2,h=s+e/2;var u=r-n.x,d=i-n.y,p=Math.atan2(d,u);if(p<0&&(p+=AQ),a<=l&&p>=a&&p<=l||a>l&&(p>=a&&p<=AQ||p>=0&&p<=l)||a==l){var m=Math.sqrt(u*u+d*d);return m<=h&&m>=c}else{var m=(h+c)/2,g=new qt(n.x+Math.cos(a)*m,n.y+Math.sin(a)*m),y=new qt(n.x+Math.cos(l)*m,n.y+Math.sin(l)*m),b=r-g.x,P=i-g.y,T=r-y.x,I=i-y.y;return b*b+P*P<=e*e/4?!0:T*T+I*I<=e*e/4}}isCircle(){return(Er.eq(Math.abs(this.sweepAngle),360)||this._start.equals1(this._end))&&this.rx==this.ry}reverse(){return Zh.build3(this.center,this.endAngle(),-this.sweepAngle,this.rx,this.ry)}getAngle(){let t=Math.PI*2;return this.sweep()==1?(this.endAngle()-this.startAngle+t)%t:(this.startAngle-this.endAngle()+t)%t}isValid(){return this.rx>0&&this.ry>0}},M6e=new ArrayBuffer(24),q2e=new Float64Array(M6e),mk=new Int32Array(M6e),Zm,IGt=(Zm=class{static normal(o,t,e){let r=t.sub(o),i=e.sub(t);return r.cross(i)}constructor(o,t,e){this.x=Wu.normal(o),this.y=Wu.normal(t),this.z=Wu.normal(e),q2e[0]=o,q2e[1]=t,q2e[2]=e,this.hashed=mk[0]^mk[1]^mk[2]^mk[3]^mk[4]^mk[5]}isZeroVector(){return this.x===0&&this.y===0&&this.z===0}hashCode(){return this.hashed}equals(o){return o instanceof Zm?o.x===this.x&&o.y===this.y&&o.z===this.z:!1}cross(o){return new Zm(this.y*o.z-this.z*o.y,this.z*o.x-this.x*o.z,this.x*o.y-this.y*o.x)}dot(o){return this.x*o.x+this.y*o.y+this.z*o.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}normalize(){var o=this.length();return new Zm(this.x/o,this.y/o,this.z/o)}sub(o){return new Zm(this.x-o.x,this.y-o.y,this.z-o.z)}add(o){return new Zm(this.x+o.x,this.y+o.y,this.z+o.z)}scale(o){return new Zm(this.x*o,this.y*o,this.z*o)}neg(){return new Zm(-this.x,-this.y,-this.z)}multiply4(o){var t=this.x*o.data[0]+this.y*o.data[4]+this.z*o.data[8]+o.data[12],e=this.x*o.data[1]+this.y*o.data[5]+this.z*o.data[9]+o.data[13],r=this.x*o.data[2]+this.y*o.data[6]+this.z*o.data[10]+o.data[14],i=this.x*o.data[3]+this.y*o.data[7]+this.z*o.data[11]+o.data[15];return i!=0?new Zm(t/i,e/i,r/i):new Zm(t,e,r)}rotate(o,t){return this.multiply4(v6e.rotateAxis(o,t))}toVector2(){return new qt(this.x,this.y)}},Zm.ORIGIN=new Zm(0,0,0),Zm.X_UNIT_VECTOR=new Zm(1,0,0),Zm.Y_UNIT_VECTOR=new Zm(0,1,0),Zm.Z_UNIT_VECTOR=new Zm(0,0,1),Zm),dp=class Ck{static build(t){return t instanceof Ca?new Ck([new Y0([t])]):t instanceof Y0?new Ck([t]):t}static buildByPolygon(t){return t?new Ck([t]):new Ck([])}static buildByStroke(t,e,r=1,i){return this.buildByPolygon(Y0.buildByStroke(t,e,r,wPe,i))}static buildCircle(t,e){return this.buildByPolygon(Y0.buildCircle(t,e))}static buildRect(t){return this.buildByPolygon(Y0.buildRect(t))}static buildBBox(t){return this.buildByPolygon(Y0.buildBBox(t))}constructor(t){this.items=t.slice()}multiply3(t){return new Ck(this.items.map(e=>e.multiply3(t)))}bbox(){return this._bbox||(this._bbox=this.items.reduce((t,e)=>t.ext1(e.bbox()),new L2).build1()),this._bbox}toPolylineGroups(){return this.items.map(t=>t.toPolylineGroup())}},Kh,Wl=(Kh=class{static isHexFormate(o){return!o||typeof o!="string"?!1:/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(o)}static of1(o){return this.of2(o>>16&255,o>>8&255,o&255)}static of2(o,t,e,r=255){return new Kh(o/255,t/255,e/255,r/255)}static of3(o){o.startsWith("#")&&(o=o.substr(1));let t=o.length;if(t==3)return new Kh(parseInt(o[0],16)/15,parseInt(o[1],16)/15,parseInt(o[2],16)/15);if(t==6)return new Kh(parseInt(o.substr(0,2),16)/255,parseInt(o.substr(2,2),16)/255,parseInt(o.substr(4,2),16)/255);if(t==8)return new Kh(parseInt(o.substr(0,2),16)/255,parseInt(o.substr(2,2),16)/255,parseInt(o.substr(4,2),16)/255,parseInt(o.substr(6,2),16)/255);throw new Error("invalid color string")}static of4(o){let t=parseInt(o.r*255+"").toString(16),e=parseInt(o.g*255+"").toString(16),r=parseInt(o.b*255+"").toString(16);return t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),("#"+t+e+r).toUpperCase()}static of5(o,t){if(o.startsWith("#")&&(o=o.substr(1)),o.length==3)return new Kh(parseInt(o[0],16)/15,parseInt(o[1],16)/15,parseInt(o[2],16)/15,t);if(o.length==6)return new Kh(parseInt(o.substr(0,2),16)/255,parseInt(o.substr(2,2),16)/255,parseInt(o.substr(4,2),16)/255,t);throw new Error("invalid color string")}static of6(o,t){return new Kh(o.r,o.g,o.b,t)}static of7(o){return o==null?null:Kh.of3(o)}constructor(o,t,e,r=1){this.r=Wu.positiveOr0(o),this.g=Wu.positiveOr0(t),this.b=Wu.positiveOr0(e),this.alpha=r}hashCode(){return this.r+this.g+this.b+this.alpha}equals(o,t=!1){let e=this.r===o.r&&this.g===o.g&&this.b===o.b;return t?e:e&&this.alpha===o.alpha}add(o,t,e,r){return new Kh(Math.max(0,Math.min(1,this.r+o)),Math.max(0,Math.min(1,this.g+t)),Math.max(0,Math.min(1,this.b+e)),Math.max(0,Math.min(1,this.alpha+r)))}mul(o){return new Kh(Math.max(0,Math.min(1,this.r*o)),Math.max(0,Math.min(1,this.g*o)),Math.max(0,Math.min(1,this.b*o)),this.alpha)}mul1(o){return new Kh(Math.max(0,this.r*o),Math.max(0,this.g*o),Math.max(0,this.b*o),this.alpha)}getData(){return[this.r,this.g,this.b,this.alpha]}toString(){let o=(this.r*255).toString(16),t=(this.g*255).toString(16),e=(this.b*255).toString(16);return o.length<2&&(o="0"+o),t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),"#"+o.substr(0,2)+t.substr(0,2)+e.substr(0,2)}toString1(){let o=(this.r*255).toString(16),t=(this.g*255).toString(16),e=(this.b*255).toString(16),r=(this.alpha*255).toString(16);return o.length<2&&(o="0"+o),t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),"#"+o.substr(0,2)+t.substr(0,2)+e.substr(0,2)+r.substr(0,2)}toRGBA(){let o=this.r*255,t=this.g*255,e=this.b*255;return[o,t,e,this.alpha]}toRGBAString(){let o=this.r*255,t=this.g*255,e=this.b*255;return`rgba(${o},${t},${e},${this.alpha})`}isWHITE(){return this.r===1&&this.g===1&&this.b===1&&this.alpha===1}},Kh.WHITE=new Kh(1,1,1,1),Kh.BLACK=new Kh(0,0,0,1),Kh.RED=new Kh(1,0,0,1),Kh.GREEN=new Kh(0,1,0,1),Kh.BLUE=new Kh(0,0,1,1),Kh.Gray=Kh.of3("#9966ff"),Kh.Silver=Kh.of3("#D2D2D2"),Kh.Golden=Kh.of3("#DCAA14"),Kh.Pink=Kh.of3("#ffaec9"),Kh),J4e=!1,N6e=class{onRTreeBBox(o){}onResultSide(o){}onOriginSide(o){}onSplitedSide(o){}onDebugSide(o){}onSweep(o,t,e,r,i,n){}onIntersect(o,t,e){}onSegment(o,t,e,r,i,n){}onSegment1(o,t,e){if(J4e){let r=new qt(o.getX(e),e),i=new qt(t.getX(e),e);this.onSegment(r,o.weight,o,i,t.weight,t)}else this.onSegment(o.start,o.weight,o,t.end,t.weight,t)}onSweep1(o,t,e){if(J4e){let r=new qt(o.getX(e),e),i=new qt(t.getX(e),e);this.onSweep(r,o.weight,o,i,t.weight,t)}else this.onSweep(o.start,o.weight,o,t.end,t.weight,t)}},ez=class extends N6e{constructor(o){super(),this.plGrps=new Array,this.debug=o}onPolylineGroup(o,t){this.plGrps.push(o)}},az=class{constructor(o){this.cache={},this.levels=o,this.result=new Array(o),this.weights=new Array(o),this.maxIdx=o-1,this.rule=this.decide.bind(this);let t=1;for(let e=0;e<o;e++)this.weights[e]=t,t*=50}weight(o){return this.weights[o]}decide(o){o=Math.abs(o);let t=this.cache[o];if(t===void 0){let e=o;for(let r=this.maxIdx;r>=0;r--){let i=this.weights[r],n=o/i|0,s=o%i;s>(i/2|0)?(o=i-s,n++):o=s,this.result[r]=n>0}t=this.decide1(this.result),this.cache[e]=t}return t}},Aft=o=>o!==0,_ft=new class extends az{decide1(o){return o[0]||o[1]}}(2),NQ=new class extends az{decide1(o){return o[0]&&!o[1]}}(2),kQ=new class extends az{decide1(o){return o[0]&&o[1]}}(2),$2e=new class extends az{decide1(o){return o[0]&&!o[1]||!o[0]&&o[1]}}(2),vft=(o=>(o[o.UNMARKED=0]="UNMARKED",o[o.INSIDE=1]="INSIDE",o[o.OUTSIDE=2]="OUTSIDE",o[o.INVALID=3]="INVALID",o))(vft||{}),Dk=class Sk{constructor(t,e,r,i,n,s,a){this.inters=[],this.connect=new Array,this.previous=null,this.next=null,this.finalGrp=-1,this.trans=NaN,this.outsideWeight=0,this.insideWeight=0,this.invalidWeight=0,this._confidence=0,this._confidence_y=NaN,this._x=NaN,this._x_y=NaN,this.status=0,this.bo=t,this.shape=e,this.baseWeight=r,i.y>n.y?this.weight=-r:i.y==n.y?this.weight=0:this.weight=r,this.start=i,this.end=n,this.polyGrp=s,this.polyIndex=a,this._bbox=new L2().ext1(e.bbox()).ext2(i).ext2(n).build1(),this.inters.push(i),this.inters.push(n);let l=31,c=1;c=l*c+this.polyGrp,c=l*c+this.polyIndex,this._hashcode=c}static rebuild(t,e,r){if(t instanceof Ct||e.distance2(r)<1e-6)return new Ct(e,r);if(t instanceof Ir){let i=t,n=t.bbox().center().x,s;e.y>r.y?s=n>i.center.x?0:1:s=n>i.center.x?1:0;let a=e.angleD(i.center),l=r.angleD(i.center);return Ir.build2(i.center,a,l,i.rx,i.ry,s)}else throw new Error("not supported operation")}updateBbox(){this._bbox=new L2().ext2(this.start).ext2(this.end).build1()}is(t,e){return t===this.polyGrp&&e===this.polyIndex}confidence(t){if(this._confidence_y!=t){let e=this._bbox.height();if(e!==0)if(Math.abs(t-this._bbox.maxY)>5e-4&&Math.abs(t-this._bbox.minY)>5e-4){let r=1-Math.abs(2*t-this._bbox.maxY-this._bbox.minY)/e;this._confidence=r*1e4|0}else this._confidence=0;else this._confidence=1;this._confidence_y=t}return this._confidence}needCountWeight(){return this.outsideWeight+this.insideWeight+this.invalidWeight<5e3}revokeOutside(t){let e=this.confidence(t);return this.outsideWeight-=e,this.invalidWeight+=e,e}revokeInside(t){let e=this.confidence(t);return this.insideWeight-=e,this.invalidWeight+=e,e}setOutside(t){let e=this.confidence(t);return this.outsideWeight+=e,e}setInside(t){let e=this.confidence(t);return this.insideWeight+=e,e}setInvalid(t){let e=this.confidence(t);return this.invalidWeight+=e,e}prevNot0(){let t=this.previous;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.previous}return null}nextNot0(){let t=this.next;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.next}return null}getX(t){if(this.bo!==null)return(this._x_y!=t||isNaN(this._x))&&(kft(this,t)>0?this._x=st[0]:this._x=NaN,this._x_y=t),this._x;throw new Error("not supported operation")}voteStatus(){return this.outsideWeight>this.insideWeight&&this.outsideWeight>this.invalidWeight?2:this.insideWeight>this.outsideWeight&&this.insideWeight>this.invalidWeight?1:this.invalidWeight>this.outsideWeight&&this.invalidWeight>this.insideWeight?3:0}reverse(t){if(t===2)if(this.start.y>this.end.y){let e=Sk.rebuild(this.shape,this.end,this.start),r=new Sk(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return S1.addAll(r.connect,this.connect),r}else return this;else if(t===1)if(this.start.y<this.end.y){let e=Sk.rebuild(this.shape,this.end,this.start),r=new Sk(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return S1.addAll(r.connect,this.connect),r}else return this;return this}isNeedScan(t){return this.needCountWeight()&&this.confidence(t)>0}hashCode(){return this._hashcode}equals(t){return t instanceof Sk?!(this.polyGrp!==t.polyGrp||this.polyIndex!==t.polyIndex):!1}bbox(){return this._bbox}toString(){return Ak.format("(%d,%d,%d) (%d,%d,%d) %s %s",this.polyGrp,this.polyIndex,this.weight,this.outsideWeight,this.invalidWeight,this.insideWeight,this.start,this.end)}};function xft(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minY+e.maxY)/2,n=(r.minY+r.maxY)/2;return i-n}function Rft(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minX+e.maxX)/2,n=(r.minX+r.maxX)/2;return i-n}var gk=class{constructor(o){if(this.__bbox=null,typeof o<"u")if(o instanceof Array){this.__items=[];for(let t of o)this.add(t)}else this.__items=o,this.__bbox=o.bbox();else this.__items=[]}add(o){if(this.__items instanceof Array)this.__items.push(o),this.__bbox=C1.extend2(this.__bbox,o.bbox());else throw new Error("can't insert multiple item into leaf node")}items(){return this.__items}bbox(){if(this.__bbox!==null)return this.__bbox;throw new Error("bug")}},iz=class{constructor(o){this.changed=!1,this.root=new gk,this.capacity=o,this.capacity2=o*o,this.itemList=[]}size(){return this.itemList.length}items(){return this.flushWhenNeed(),this.itemList}add(o){this.itemList.push(o),this.changed=!0}remove(o){S1.remove(this.itemList,o),this.changed=!0}clear(){this.changed=!1,this.root=new gk,this.itemList.length=0}flushWhenNeed(){if(this.changed){let o=new Array;for(let t of this.itemList)o.push(new gk(t));for(;;){let t=this.organize(o);if(t.length>1)o=t;else break}this.root=new gk(o),this.changed=!1}}organize(o){jL(o,Rft,0,o.length);let t=o.length,e=[];for(let r=0;r<t;)if(r+this.capacity2<=t){let i=r+this.capacity2;jL(o,xft,r,i);for(let n=r;n<i;n+=this.capacity){let s=new gk(o.slice(n,n+this.capacity));e.push(s)}r=r+this.capacity*this.capacity}else{let i=new gk(o.slice(r,r+this.capacity));e.push(i),r=r+this.capacity}return e}search(o){this.flushWhenNeed();let t=[],e=[];for(e.push(this.root);;){let r=e.shift();if(typeof r<"u"){let i=r.items();if(i instanceof Array){for(let n of i)if(!o.isSeparated(n.bbox())){let s=n.items();s instanceof Array?e.push(n):t.push(s)}}else o.isSeparated(r.bbox())||t.push(i)}else break}return t}walker(o){this.flushWhenNeed(),this._walker(this.root,0,o)}_walker(o,t,e){this.flushWhenNeed();let r=o.items();if(r instanceof Array)for(let i of r)this._walker(i,t+1,e);else e(r,t)}bbox(){return this.flushWhenNeed(),this.root.bbox()}};function K2e(o,t){Dft(o.iterator(),t)}function Dft(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var _Q=new Error("list is empty"),vQ=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},wft=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},Lft=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},WL=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw _Q;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw _Q;return this.remove(o),o.item}addLast(o){return this.first===null||this.last===null?(this.first=new vQ(this,o),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new vQ(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw _Q;return this.first.item}getLast(){if(this.last===null)throw _Q;return this.last.item}insertAfter(o,t){let e=new vQ(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new vQ(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new wft(this.first)}listIterator(){return new Lft(this.first)}toArray(){let o=new Array(this.cnt),t=this.first,e=0;for(;t!=null;)o[e]=t.item,t=t.next,e++;return o}};function Z2e(o){throw new Error("")}var xQ=class{constructor(o,t){this.node1=null,this.node2=null,this.key=o,this.value=t}},Mft=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().key}},Nft=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().value}},jQ=class{constructor(){this.innerList=new WL,this.innerMap={}}replace(o,t){o.node1!==null&&(o.node1.set(t),t.node1=o.node1),o.node2!==null&&(o.node2.set(t),t.node2=o.node2)}clear(){this.innerList.clear();for(let o in this.innerMap)delete this.innerMap[o]}put(o,t){let e=o.hashCode(),r=new xQ(o,t),i=this.innerMap[e];if(i===void 0)return r.node1=this.innerList.add(r),this.innerMap[e]=r,null;if(i instanceof xQ){if(i.key.equals(o))return this.innerMap[e]=r,this.replace(i,r),i.value;{r.node1=this.innerList.add(r);let n=new WL;return i.node2=n.add(i),r.node2=n.add(r),this.innerMap[e]=n,null}}if(i instanceof WL){let n=null;return K2e(i,(s,a)=>a.key.equals(o)?(this.replace(a,r),n=a.value,!1):!0),n===null?(r.node1=this.innerList.add(r),r.node2=i.push(r),null):n}return Z2e(i)}get(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof xQ)return e.key.equals(o)?e.value:null;if(e instanceof WL){let r=null;return K2e(e,(i,n)=>n.key.equals(o)?(r=n.value,!1):!0),r}return Z2e(e)}containsKey(o){return this.get(o)!==null}delete(o){o.node1!==null&&o.node1.parent.remove(o.node1),o.node2===null?delete this.innerMap[o.key.hashCode()]:o.node2.parent.remove(o.node2)}remove(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof xQ)return e.key.equals(o)?(this.delete(e),e.value):null;if(e instanceof WL){let r=null;return K2e(e,(i,n)=>n.key.equals(o)?(r=n.value,this.delete(n),!1):!0),r}return Z2e(e)}computeIfAbsent(o,t){let e=this.get(o);if(e===null){let r=t(o);return this.put(o,r),r}else return e}size(){return this.innerList.size()}isEmpty(){return this.innerList.size()===0}keys(){return new Mft(this.innerList.iterator())}values(){return new Nft(this.innerList.iterator())}entries(){return this.innerList.iterator()}},Rk=class{constructor(){this.innerMap=new jQ}add(o){return this.innerMap.put(o,!0)!==!0}remove(o){this.innerMap.remove(o)}contains(o){return this.innerMap.get(o)===!0}iterator(){return this.innerMap.keys()}addAll(o){let t=o.iterator();for(;t.hasNext();)this.add(t.next())}size(){return this.innerMap.size()}clear(){let o=this.iterator();for(;o.hasNext();){let t=o.next();this.remove(t)}}},Q4e=S1.funcCopy(jL);function kft(o,t){let e=0;if(Math.abs(o.start.y-t)<=1e-4)st[e++]=o.start.x;else if(Math.abs(o.end.y-t)<=1e-4)st[e++]=o.end.x;else if(o.shape instanceof Ct)e=rft(o.shape,t);else if(o.shape instanceof Ir)e=ift(o.shape,t);else throw new Error("not supported operation");return e}var BQ=class{constructor(o,t,e,r){this.sides=new Array,this.loader=o,this.loader.bo=this,this.logger=e,this.rule=t,this.event=r}static sortByBBoxMinY(o,t){return o.bbox().minY-t.bbox().minY}static sortByBBoxAreaDesc(o,t){return t.bbox().area()-o.bbox().area()}addPolyline(o,t=1,e=.01,r=!0){for(let i of this.loader.buildGroup(o,t,e,r))this.sides.push(i),this.event.onOriginSide(i)}buildRTree(){let o=new iz(10);for(let t of this.sides)o.add(t);return o}fillValidSides(o,t,e){for(let r of t)isFinite(r.getX(e))&&o.push(r)}getSortedEndpointsLineAsc(o){let t=new Array;for(let i of o)i.needCountWeight()&&(t.push(i.start),t.push(i.end));Q4e(t,qt.sortByYAsc,0,t.length);let e=new Array,r=Number.NEGATIVE_INFINITY;for(let i of t){let n=i.y;n>r&&(e.push(n),r=n)}return e}splitSides(o,t,e){let r=o.start,i=o.end,n=new qt(i.x+(r.x-i.x)*2,i.y+(r.y-i.y)*2);Q4e(o.inters,(a,l)=>a.distance2(n)-l.distance2(n),0,o.inters.length);let s=null;for(let a of o.inters)if(s==null)a.equals(r)&&(s=a);else if(!a.equals(s)){let l=Dk.rebuild(o.shape,s,a);l instanceof Ir&&Math.abs(l.sweepAngle)>190&&(l=new Ct(s,a));let c=new Dk(this,l,o.baseWeight,s,a,o.polyGrp,e++);if(t.push(c),c.updateBbox(),a.equals(i))break;s=a}return e}splitSidesByInters(){let o=new Array;for(let t of this.sides)if(t.polyIndex==0){let e=0,r=null,i=null;do{let n=new Array;e=this.splitSides(t,n,e);for(let s of n)r!=null?(r.next=s,s.previous=r):i=s,r=s,this.event.onSplitedSide(s),o.push(s);if(t.next===null)throw new Error("not supported operation");t=t.next}while(t.polyIndex!==0);i!=null&&r!=null&&(i.previous=r,r.next=i)}this.sides.length=0;for(let t of o)this.sides.push(t)}seekIntersection(){if(this.sides.length>0){let o=this.buildRTree(),t=new Rk;for(let e of this.sides){t.add(e);let r=e.bbox().extendOfSize(1e-5),i=e.shape instanceof Ct;for(let n of o.search(r))if(!t.contains(n)){let s=n.shape instanceof Ct;if(!(i&&s&&e.next!==null&&e.previous!==null&&(e.next.equals(n)||e.previous.equals(n)))){let a=EI(e.shape,n.shape);for(let l=0;l<a;l+=2){let c=new qt(st[l],st[l+1]);e.inters.push(c),n.inters.push(c),this.event.onIntersect(c,e,n)}}}}}}},Bft=class k6e{constructor(t){this.sides=new Rk,this.others=new Rk,this.id=t}add(t){this.sides.add(t),t.finalGrp=this.id;for(let e of t.connect)this.others.add(e)}polyline(){let t=new Array;return xk(this.sides,(e,r)=>(t.push(r.shape),!0)),Ca.build2(t).asClose()}hashCode(){return this.id}equals(t){return t!=null&&t instanceof k6e?this.id===t.id:!1}},B6e=class{constructor(o){this.bo=null,this.sides=new Array,this.polyGrp=0,this.polyIndex=0,this.prevSide=null,this.firstSide=null,this.noWeight0=o}completeGroup(o){this.prevSide!=null&&this.firstSide!=null&&!this.prevSide.end.equals(this.firstSide.start)&&this.addSide(new Ct(this.prevSide.end,this.firstSide.start),o);let t=new Array,e=null,r=null;for(let i of this.sides)(!this.noWeight0||i.weight!==0)&&(e!=null?(e.next=i,i.previous=e):r=i,e=i,t.push(i));return e!=null&&r!=null&&(r.previous=e,e.next=r),this.polyGrp++,this.sides.length=0,this.prevSide=null,this.firstSide=null,this.polyIndex=0,t}buildGroup(o,t,e,r=!0){for(let i of o.primitives)if(i instanceof Ct)this.addSide(i,t);else if(r&&i instanceof Ir&&i.rx===i.ry)this.addArc(i,t);else{let n=null;for(let s of i.points(e))n!=null&&this.addSide(new Ct(n,s),t),n=s}return this.completeGroup(t)}addArc(o,t){let e=o.sweepAngle,r=Qo.regularD(o.startAngle),i=r+e;if(e>0){let n=90;for(;n<=i;)n>r&&(this.addSide(Ir.build3(o.center,r,n-r,o.rx,o.ry),t),r=n),n+=90;r<i&&this.addSide(Ir.build3(o.center,r,i-r,o.rx,o.ry),t)}else if(e<0){let n=270;for(;n>=i;)n<r&&(this.addSide(Ir.build3(o.center,r,n-r,o.rx,o.ry),t),r=n),n-=90;r>i&&this.addSide(Ir.build3(o.center,r,i-r,o.rx,o.ry),t)}}addSide(o,t){if(o.start().equals(o.end()))return;let e=o.start(),r;this.prevSide!=null?(this.prevSide.end.equals(e)||this.addSide(new Ct(this.prevSide.end,e),t),r=new Dk(this.bo,o,t,o.start(),o.end(),this.polyGrp,this.polyIndex++)):(r=new Dk(this.bo,o,t,o.start(),o.end(),this.polyGrp,this.polyIndex++),this.firstSide=r),this.prevSide=r,this.sides.push(r)}},F6e=class{constructor(o,t,e){this.eps=new Array,this.curWeight=0,this.start=null,this.last=null,this.prevStart=null,this.prevEnd=null,this.y=e,this.rule=o,this.bo=t,this.event=t.event}onEp(o){this.tuningWeight(o),this.start===null?this.rule(this.curWeight)?this.in(o):o.setInvalid(this.y):this.rule(this.curWeight)?o.setInvalid(this.y):this.out(o,this.start),this.last!==null&&this.event.onSweep1(this.last,o,this.y),this.last=o}in(o){this.prevEnd!=null&&this.onSameX(o,this.prevEnd)?(this.start=this.prevStart,this.prevStart=null,this.prevEnd.revokeInside(this.y),this.prevEnd=null):(this.start=o,this.start.setOutside(this.y))}out(o,t){if(this.onSameX(t,o))t.revokeOutside(this.y);else{if(o.setInside(this.y)>0&&t.confidence(this.y)>0){let e=t.voteStatus(),r=o.voteStatus();this.isValid(e)&&this.isValid(r)?e==2&&r==1&&(o.connect.push(t),t.connect.push(o)):(o.connect.push(t),t.connect.push(o))}this.event.onSegment1(t,o,this.y),this.eps.push(t),this.eps.push(o),this.prevStart=t,this.prevEnd=o}this.start=null}isValid(o){return o==1||o==2}onSameX(o,t){return o.bbox().isIntersect(t.bbox())&&Er.eq(o.getX(this.y),t.getX(this.y))}tuningWeight(o){this.curWeight+=o.weight;let t=o.nextNot0(),e=o.prevNot0();t!=null&&o.weight===t.weight&&t.trans===this.y&&(this.curWeight-=o.weight),e!=null&&o.weight===e.weight&&e.trans===this.y&&(this.curWeight-=o.weight),o.trans=this.y}},XQ=new Error,e6e=new class extends az{decide1(o){return o[0]&&o[1]}}(2),Fft=new class extends N6e{onPolylineGroup(o,t){throw XQ}onSegment(o,t,e,r,i,n){throw XQ}},Vft=class{constructor(o,t){this.rtree=o,this.level=t}},Gft=class V6e extends BQ{static isIntersect(t,e,r=QQ.DUMMY){let i=new V6e(r),n=i.createGroup1(t.items),s=i.createGroup2(e.items);return n.rtree.itemList.length==0||s.rtree.itemList.length==0?!1:i.isIntersect(n,s)}constructor(t){super(new B6e(!1),e6e.rule,t,Fft)}createGroup1(t){return this.createGroup(t,0)}createGroup2(t){return this.createGroup(t,1)}createGroup(t,e){let r=e6e.weight(e);for(let n of t)this.addPolyline(n,r);let i=this.buildRTree();return this.sides.length=0,new Vft(i,e)}isIntersect(t,e){if(t.level!==e.level){let r=t.rtree.bbox().intersection1(e.rtree.bbox());if(r!==null){try{this.inters(t,e);let i=(r.minY+r.maxY)/2;this.sweep(t,e,i)}catch(i){if(i===XQ)return!0;throw i}return!1}else return!1}else throw new Error("inersection detection should not in same group")}inters(t,e){if(t.rtree.size()>e.rtree.size()){let r=t;t=e,e=r}for(let r of t.rtree.items()){r.trans=NaN;let i=r.bbox().extendOfSize(1e-5);for(let n of e.rtree.search(i))if(n.trans=NaN,EI(r.shape,n.shape)>0)throw XQ}}sweep(t,e,r){let i=C1.extend2(t.rtree.bbox(),e.rtree.bbox()).extendOfSize(1e-5),n=new Array;this.fillValidSides(n,t.rtree.search(i),r),this.fillValidSides(n,e.rtree.search(i),r),jL(n,(a,l)=>a.getX(r)-l.getX(r),0,n.length);let s=new F6e(this.rule,this,r);for(let a of n)s.onEp(a)}},LPe=class WO{constructor(t){this.items=new Array(t.length),S1.arraycopy(t,0,this.items,0,t.length),this.__bbox=this.calcBBox()}static build1(t){let e=[];return GQ(t,(r,i)=>(e.push(i),!0)),new WO(e)}static build2(t){let e=t.map(r=>Ca.build8(r));return new WO(e)}static combinePolylineGroupArr(t){let e=[];for(let r of t)e=e.concat(r.items);return new WO(e)}calcBBox(){let t=new L2;for(let e=0;e<this.items.length;e++)t.ext1(this.items[e].bbox());return t.build1()}multiply3(t){let e=new Array(this.items.length);for(let r=0;r<e.length;r++)e[r]=this.items[r].multiply3(t);return new WO(e)}bbox(){return this.__bbox}asClose(){return this.items.forEach(t=>t.asClose()),this}mirrorY(t){return this.items.forEach(e=>e.mirrorY(t)),this}closeEndpoint(){return this.items.forEach(t=>t.closeEndpoint()),this}get primitives(){return this.items.map(t=>t.primitives).flat(2)}isEqual(t){return t instanceof WO?this.items.every(e=>t.items.some(r=>r.isEqual(e))):!1}getOutMostPolyline(){return this.items.reduce((t,e)=>e.bbox().area()>t.bbox().area()?e:t,this.items[0])}getOutline(){let t=this.items;if(t.length===1)return{outline:t,hole:new Array};let e=new Set,r=new Set;for(let i=0,n=t.length;i<n;i++){let s=t[i];if(!e.has(s)&&!r.has(s)){i+1>=n&&e.add(s);for(let a=i+1;a<n;a++){let l=t[a];if(!e.has(l)&&!r.has(l)){if(!s.bbox().isInside(l.bbox().extendOfSize(1e-4))&&!l.bbox().isInside(s.bbox().extendOfSize(1e-4)))continue;Gft.isIntersect(new WO([s]),new WO([l]))&&(s.bbox().area()>l.bbox().area()?(e.add(s),r.add(l)):(e.add(l),r.add(s)))}}!e.has(s)&&!r.has(s)&&e.add(s)}}return{outline:[...e],hole:[...r]}}round(t=4){let e=this.items.map(r=>r.round(t));return new WO(e)}},Uft=S1.funcCopy(jL),Hft=S1.funcCopy(jL),Wft=S1.funcCopy(jL);function zft(o){return new Array}function Yft(o,t){let e=new ez(!1),r=new tz(o,QQ.DUMMY,e);for(let i of t)r.addPolyline(i);return r.simplify(),e.plGrps}var tz=class extends BQ{constructor(o,t,e){super(new B6e(!1),o,t,e),this.finalSides=new Array,this.sideGroups={},this.vecSides=new Array,this.scanY=NaN,this.curNetIndex=0,this.curIndex=-1,this.scanLines=0}sweep(o,t,e){this.scanY=NaN,this.scanLines=0,Uft(t,BQ.sortByBBoxMinY,0,t.length);let r=new WL;this.curNetIndex=0;let i=Number.POSITIVE_INFINITY;for(let n of o)n>i&&this.scan(r,(i+n)/2,t),i=n;this.getAllMarkPrimitive(e,t),this.logger.debug3("scan %s %d",e,this.scanLines)}simplify(){this.seekIntersection(),this.splitSidesByInters(),this.sweep(this.getSortedEndpointsLineAsc(this.sides),this.sides,!1),this.flipSides(),this.sweep(this.getSortedEndpointsLineAsc(this.vecSides),this.vecSides,!0),this.connectSides(),this.fillResult()}addPolyline(o,t=1,e=.01,r=!0){super.addPolyline(o,t,e,r)}scan(o,t,e){if(this.scanY==t)return;this.scanY=t;let r=!1,i=o.listIterator();for(;i.hasNext();){let n=i.next(),s=n.item;Er.less(s.bbox().maxY,t)?o.remove(n):!r&&s.isNeedScan(t)&&(r=!0)}for(;this.curNetIndex<e.length;){let n=e[this.curNetIndex];if(Er.less(n.bbox().minY,t))Er.greatereq(n.bbox().maxY,t)&&(this.add2AET(o,n),!r&&n.isNeedScan(t)&&(r=!0)),this.curNetIndex++;else break}if(r){this.scanLines++;let n=new F6e(this.rule,this,t),s=o.iterator();for(;s.hasNext();){let a=s.next();n.onEp(a)}}}add2AET(o,t){let e=t.bbox().minX,r=t.bbox().maxX,i=t.bbox().minY,n=t.bbox().maxY,s=o.listIterator(),a=null;for(;s.hasNext();){let l,c=s.next(),h=c.item,u=h.bbox().minX,d=h.bbox().maxX;if(r<=u)l=-1;else if(d<=e)l=1;else{let m=h.bbox().minY,g=h.bbox().maxY,y=Math.max(i,m),b=Math.min(n,g);l=this.compareBySweep(t,h,(y+b)/2)}let p=h.shape;if(p instanceof Ct&&p.length()<.001&&a==null&&l<0){a=c;continue}if(a!=null&&l<0){o.insertBefore(a,t);return}if(l<0){o.insertBefore(c,t);return}else a=null}o.add(t)}getLineAngle(o){let t=o.start().angle(o.end());return t<0&&(t+=Math.PI),t}getArcAngle(o,t){let e=Math.asin((t-o.center.y)/o.rx);return o.startAngle>90&&o.startAngle<270&&(e=-e),e<0&&(e+=Math.PI),(e+Math.PI/2)%Math.PI}compareArcLine(o,t,e){let r=this.getArcAngle(o,e),i=this.getLineAngle(t);return Er.eq(r,i)?-o.sweepAngle:i-r}compareBySweep(o,t,e){let r=o.getX(e);if(!isFinite(r))return 0;let i=t.getX(e);if(!isFinite(i))return 0;if(!Er.eq(r,i))return r-i;if(o.shape instanceof Ct)return t.shape instanceof Ct?this.getLineAngle(t.shape)-this.getLineAngle(o.shape):-this.compareArcLine(t.shape,o.shape,e);if(t.shape instanceof Ct)return this.compareArcLine(o.shape,t.shape,e);{let n=o.shape,s=t.shape,a=this.getArcAngle(n,e),l=this.getArcAngle(s,e);return Er.eq(a,l)?n.sweepAngle*s.sweepAngle<=0?n.sweepAngle<=0?1:-1:n.sweepAngle>0?n.rx-s.rx:s.rx-n.rx:l-a}}getAllMarkPrimitive(o,t){for(let e of t)if(e.status===0&&e.bbox().height()!=0){let r=e.voteStatus();if(r===2||r===1){e.status=r;let i=e.reverse(r);if(o){this.event.onResultSide(i);let n=i.shape.multiply3(y0.ROT_N90),s=i.start.multiply3(y0.ROT_N90),a=i.end.multiply3(y0.ROT_N90);i=new Dk(this,n,i.baseWeight,s,a,i.polyGrp,i.polyIndex)}this.finalSides.push(i),this.event.onResultSide(i)}}}flipSides(){for(let o of this.sides)if(o.polyIndex==0){let t=null,e=null;do{let r=o.shape.multiply3(y0.ROT_90),i=o.start.multiply3(y0.ROT_90),n=o.end.multiply3(y0.ROT_90),s=new Dk(this,r,o.baseWeight,i,n,o.polyGrp,o.polyIndex);if(s.outsideWeight=o.outsideWeight,s.insideWeight=o.insideWeight,s.invalidWeight=o.invalidWeight,s.status=o.status,t!=null?(t.next=s,s.previous=t):e=s,this.vecSides.push(s),this.event.onSplitedSide(s),t=s,o.next!==null)o=o.next;else break}while(o.polyIndex!=0);e!=null&&(e.previous=t,t.next=e)}}canBeEnd(o,t){if(o.size()==1){let e=o.getFirst().shape;if(e instanceof Ir){if(t&&e.rx<=t)return!1}else if(e instanceof Ct&&t&&e.length()<=t)return!1}return!0}connectSides(){let o=new jQ,t=new iz(10);for(let n of this.finalSides)o.computeIfAbsent(n.start,zft).push(n),t.add(n.start);let e=0,r=new Rk,i=new Array;for(let n of this.finalSides)if(!r.contains(n)){let s=new Rk,a=n.start,l=new WL;l.add(n),r.add(n);let c=n.end;for(;l.size()>0;)if(this.isStart(a,c)&&this.canBeEnd(l,.01)){l.size()>1&&this.fillSideGroups(l,e++);break}else{let h=o.get(c),u=this.findNext(r,h);if(u==null&&(c=this.findNeigber(c,s,t,.01),c!==null&&(h=o.get(c),u=this.findNext(r,h))),u!=null)l.add(u),r.add(u),c=u.end;else if(c!=null?s.add(c):(i.length==0&&l.size()>1&&this.logger.warning3("unable to connect at %s",l.getLast()),i.push(l.removeLast())),l.size()>0)c=l.getLast().end;else break}}}fillSideGroups(o,t){let e=new Bft(t);xk(o,(r,i)=>(e.add(i),!0)),this.sideGroups[e.id]=e}isStart(o,t){return o.distance2(t)<=1e-4}findNext(o,t){if(t!=null){for(let e of t)if(!o.contains(e))return e}return null}fillResult(){let o=0,t=new jQ;for(let r in this.sideGroups){let i=this.sideGroups[r];xk(i.sides,(n,s)=>(s.polyGrp!=-2&&t.put(s,s),!0))}let e=new Rk;for(let r in this.sideGroups){let i=this.sideGroups[r];if(e.add(i)){let n=0,s=new Array;for(s.push(i);n<s.length;){let l=s[n],c=new Array;xk(l.others,(u,d)=>{let p=t.get(d);return p!=null&&c.push(p.finalGrp),!0}),Hft(c,S1.sortAsc,0,c.length);let h=l.id;for(let u of c)if(u!=h&&u!=l.id){let d=this.sideGroups[u];e.add(d)&&s.push(d),h=u}n++}let a=new Array;for(let l of s)a.push(l.polyline());Wft(a,BQ.sortByBBoxAreaDesc,0,a.length),this.event.onPolylineGroup(new LPe(a),o++)}}}findNeigber(o,t,e,r){let i=r*r,n=Number.MAX_VALUE,s=null;for(let a of e.search(o.bbox().extendOfSize(r)))if(!t.contains(a)){let l=o.distance2(a);l<n&&(n=l,s=a)}return n<i?s:null}},jft=class{constructor(){this.points=[],this.lines=[],this.arcs=[],this.beziers=[],this.listText=[],this.fonts=[]}addPt(o,t=!0){if(o instanceof Ct)this.lines.push(o);else if(o instanceof Ir)this.arcs.push(o);else if(o instanceof en)this.beziers.push(o);else throw new Error("not support");t&&this.points.push(o.start())}addPoint(o){this.points.push(o)}addText(o,t,e=1,r=.1,i=!0){this.listText.push({pos:o,str:t,size:e,width:r}),i&&this.points.push(o)}addPly(o,t=!0){o.primitives.forEach(e=>this.addPt(e,t))}build(){let o=[],t=[],e=[],r=[],i=[],n=[];return this.points.forEach(s=>o.push(s.x,s.y)),this.lines.forEach(s=>t.push(s.start().x,s.start().y,s.end().x,s.end().y)),this.arcs.forEach(s=>e.push(s.center.x,s.center.y,s.rx,Qo.toRadians(s.startAngle),Qo.toRadians(s.endAngle()),s.sweep())),this.beziers.forEach(s=>{s.controls.forEach(a=>{r.push(a.x,a.y)}),r.push("end")}),this.listText.forEach(s=>i.push(s.pos.x,s.pos.y,s.str,s.width,s.size)),this.fonts.forEach(s=>n.push(s)),{points:o,lines:t,arcs:e,texts:i,beziers:r,fonts:n}}},HW,lz=(HW=class{constructor(o){this.map=new jQ,this.bus=o}initColor(o){return this.map.computeIfAbsent(o,()=>new jft)}draw(){let o={},t=this.map.entries();for(;t.hasNext();){let e=t.next();o[e.key.toString()]=e.value.build()}this.bus.publish("/debug/draw",o)}clear(){this.map.clear()}static init(o){if(!o)throw new Error("bus is undefined!");this.palette=new HW(o)}static initPalette(o){this.palette=o}static getDefaultColor(){for(let o of this.colorBuffersMap)if(o[0]!==null&&o[0])return o[0]=!1,o[1];return this.colorBuffersMap.forEach(o=>{if(o[0]===null){console.log(1);return}o[0]=!0}),this.getDefaultColor()}static clear(){this.palette.clear()}static auto(o,t=this.getDefaultColor()){if(Array.isArray(o))o.forEach(e=>{this.auto(e,t)});else if(o instanceof qt)this.point(o,t);else if(o instanceof C1)this.bbox(o,t);else if(o instanceof sz)this.primitive(o,t);else if(o instanceof Ca)this.polyline(o,t);else if(o instanceof Y0)this.polygon(o,t);else if(o instanceof dp)this.group(o,t);else if(o instanceof LPe)this.auto(o.items,t);else{debugger;throw new Error("No incoming type!")}}static text(o,t,e=.5,r=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");this.palette.initColor(r).addText(o,t,e,e/10),this.palette.draw()}static point(o,t=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let e=this.palette.initColor(t);Array.isArray(o)?o.forEach(r=>{this.point(r,t)}):e.addPoint(o),this.palette.draw()}static bbox(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.bbox(e,t)}):(this.primitive(new Ct(new qt(o.maxX,o.maxY),new qt(o.maxX,o.minY)),t),this.primitive(new Ct(new qt(o.maxX,o.maxY),new qt(o.minX,o.maxY)),t),this.primitive(new Ct(new qt(o.minX,o.minY),new qt(o.maxX,o.minY)),t),this.primitive(new Ct(new qt(o.minX,o.minY),new qt(o.minX,o.maxY)),t))}static primitive(o,t=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let e=this.palette.initColor(t);Array.isArray(o)?o.forEach(r=>{this.primitive(r,t)}):e.addPt(o),this.palette.draw()}static polyline(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.polyline(e,t)}):o.primitives.forEach(e=>{this.primitive(e,t)})}static polygon(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.polygon(e,t)}):o.items.forEach(e=>{this.polyline(e,t)})}static group(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.group(e,t)}):o.items.forEach(e=>{this.polygon(e,t)})}static async begin(){this.t1=performance.now()}static async end(o){console.log(o||"t1:",performance.now()-this.t1)}static async log(o){console.log(o||"==================")}},HW.colorBuffersMap=[[!0,Wl.BLUE],[!0,Wl.GREEN],[!0,Wl.WHITE],[!0,Wl.RED],[!0,Wl.Golden],[!0,Wl.Gray]],HW.t1=0,HW),Xft=0,cz=class gPe{constructor(t,e){this.inters=[],this.shape=t,this.start=t.start(),this.end=t.end(),this.judgeOverlapMap=new Map,e&&(this.id=Xft++)}reverse(){this.shape=this.shape.reverse();let t=this.start;this.start=this.end,this.end=t}getCenterPoint(t=this.end){let{x:e,y:r}=this.start,{x:i,y:n}=t;if(this.shape instanceof Ir){let s=this.shape.rx,a=new qt((e+i)/2,(r+n)/2),l=this.shape.center,c;return a.x!==l.x||a.y!==l.y?(c=a.angle(l),Math.abs(this.shape.sweepAngle)>180&&(c+=c>=0?-180:180)):c=(this.shape.startAngle+this.shape.endAngle())/2,new qt(l.x+Math.cos(c)*s,l.y+Math.sin(c)*s)}else{if(this.shape instanceof Ct)return new qt((e+i)/2,(r+n)/2);if(this.shape instanceof en){let s=this.shape.getPercent(t,uo);return en.pointOn(s/2,this.shape.controls)}else throw Error("not support")}}static finalAngle(t,e,r){let i=t.cross(e)>0,n=Math.acos(Math.min(1,Math.max(-1,t.dot(e)/e.length())));return(r?!i:i)&&(n=eee-n),n}sortInters(){if(this.shape instanceof Ir){let t=this.shape.center,e=this.shape.start().sub(t).normalize(),r=this.shape.isCCW;this.inters.sort((i,n)=>{let s=i.coord.sub(t),a=n.coord.sub(t);return gPe.finalAngle(e,s,r)-gPe.finalAngle(e,a,r)<=0?-1:1})}else if(this.shape instanceof Ct){let t=this.start,e=this.end,r=new qt(e.x+(t.x-e.x)*2,e.y+(t.y-e.y)*2);this.inters.sort((i,n)=>i.coord.distance2(r)-n.coord.distance2(r)<=0?-1:1)}else if(this.shape instanceof en){let t=this.shape;this.inters.sort((e,r)=>t.getPercent(e.coord,uo)-t.getPercent(r.coord,uo)<=0?-1:1)}else throw Error("not support the primitive type");this.inters.forEach((t,e)=>t.setIndex(e))}getStart(){return this.start}getEnd(){return this.end}getShape(){return this.shape}connect(t){this.nextSide=t,t.prevSide=this}static returnPolygonList(t){let e=[];return t.forEach(r=>{let i=[];r.forEach((n,s)=>{let a=[];n.forEach(l=>{a.push(l.shape)}),i.push(Ca.build7(a))}),e.push(new Y0(i))}),e}addInter(t){this.inters.push(t)}static returnPolygonGroup(t){let e=[];return t.forEach(r=>{let i=[];r.forEach((n,s)=>{let a=[];n.forEach(l=>{a.push(l.shape)}),i.push(Ca.build7(a))}),e.push(new Y0(i))}),new dp(e)}static rebuild(t,e,r){let i;if(t instanceof Ct||e.distance2(r)<1e-6)i=new Ct(e,r);else if(t instanceof Ir)i=Ir.build2(t.center,e.angleD(t.center),r.angleD(t.center),t.rx,t.ry,t.isCCW?1:0);else if(t instanceof en){let n=t.getPercent(e,uo),s=t.clip(n)[1];i=s.clip(s.getPercent(r,uo))[0]}else throw new Error("not supported operation");return ho(t,e).dot(ho(i,e))<0?null:i}static returnPolyline(t){return Ca.build7(t.map(e=>e.shape))}bbox(){return this.shape.bbox()}},qft=(o=>(o[o.END1=0]="END1",o[o.END2=1]="END2",o[o.END12=2]="END12",o[o.LEFT1=3]="LEFT1",o[o.LEFT2=4]="LEFT2",o))(qft||{});function E1(o,t,e){if(o instanceof Ir&&t instanceof Ir)return Zft(o,t);if(o instanceof Ir&&t instanceof Ct)return i6e(o,t);if(o instanceof Ct&&t instanceof Ir)return r6e(o,t);if(o instanceof Ct&&t instanceof Ct)return YL(o,t);if(o instanceof en&&t instanceof Ct)return o.controls.length===2||XO(o)?YL(new Ct(o.start(),o.end()),t):G6e(o,t);if(o instanceof Ct&&t instanceof en)return t.controls.length===2||XO(t)?YL(o,new Ct(t.start(),t.end())):yPe(o,t);if(o instanceof Ir&&t instanceof en)return t.controls.length===2||XO(t)?i6e(o,new Ct(t.start(),t.end())):$ft(o,t);if(o instanceof en&&t instanceof Ir)return o.controls.length===2||XO(o)?r6e(new Ct(o.start(),o.end()),t):Kft(o,t);if(o instanceof en&&t instanceof en)return MPe(o,t);throw new Error("not support")}function yk(o,t){return ho(o,t.start()).dot(ho(t,t.start()))<=0?!1:E1(o,t).state<=2}function J2e(o,t){let e=t.getPercent(o.end(),uo);if(e===null)return!1;if(e===0)return!0;let r=t.clip(e)[0],i=o.buildConverxHull(uo),n=r.buildConverxHull(uo),s=c(i),a=c(n);return l(s,a);function l(h,u){let d=new Map([[0,1],[1,0],[2,2],[3,4],[4,3]]),p=h[0],m=u[0];if(!p||!m)throw Error("isAllOverlap(sides1: PackSide[], sides2: PackSide[])");let g=!0;do{let y=p.getShape(),b=m.getShape();if(y instanceof Ct&&b instanceof Ct){let P=g?YL(y,b).state:d.get(YL(b,y).state);if(P===0)p=p.nextSide,g=!1;else if(P===1)m=m.nextSide,g=!0;else if(P===2)p=p.nextSide,m=m.nextSide,g=!0;else return!1}else throw Error("not support")}while(p!==h[0].prevSide&&m!==u[0].prevSide);return!0}function c(h){let u=h.primitives.map(p=>new cz(p)),d=u[u.length-1];return u.forEach(p=>{d.connect(p),d=p}),u}}function t6e(o,t){let e=o.end().distance2(t.center);if(e>(t.rx+uo)**2||e<(t.rx-uo)**2||!(kn(o.end(),t.end())||NPe(t,o.end())))return!1;if(o.center.equals1(t.center))return!0;let r=o.center.distance1(t.center),i=Math.abs(o.rx-t.rx);if(r>Math.min(o.rx,t.rx)){let n=o.center.angleD(t.center);return o.rx>t.rx?!(r+i>uo&&aE(o,n))&&!(r-i>uo&&o.rx+t.rx-r>uo&&aE(o,n+180)):!(r-i>uo&&aE(o,n))&&!(o.rx+t.rx-r>uo&&aE(o,n+180))}else{if(r+i<=uo)return!0;let n=o.rx>t.rx?o.center.angleD(t.center):t.center.angleD(o.center);return aE(o,n)?!1:r-i<=uo?!0:!aE(o,n+180)}}function $ft(o,t){let e=kPe(o,t.start()).toBezier2(),r,i=0;for(let n=e.length;i<n;i++){let s=e[i];if(r=MPe(s,t).state,r!==0)break}return r===2&&i!==e.length-1?{state:1}:{state:r}}function Kft(o,t){let e=t.toBezier2(),r,i=0;for(let n=e.length;i<n;i++){let s=e[i];if(r=MPe(o,s).state,r!==1)break}return r===2&&i!==e.length-1?{state:0}:{state:r}}function MPe(o,t){if(o.controls.length===2||XO(o))return t.controls.length===2||XO(t)?YL(new Ct(o.start(),t.end()),new Ct(t.start(),t.end())):yPe(new Ct(t.start(),o.end()),t);if(t.controls.length===2||XO(t))return G6e(bPe(o,t.start()),new Ct(t.start(),t.end()));let e=bPe(o,t.start());if(XO(e))return yPe(new Ct(t.start(),o.end()),t);let r=J2e(e,t),i=J2e(t,e);if(!r&&!i){let n=dft(e,t);if(n.havOverlap){let s=n.havOverlap!==2,a=n.havOverlap!==1;return qO(o,t,s,a)}else{let s=function(){for(let u=0;u<c;u+=2)st[u]=h[u],st[u+1]=h[u+1]},a,l,c=n.cnt,h=new Array(c).fill(0).map((u,d)=>st[d]);for(let u=0;u<c;u+=2){let d=new qt(st[u],st[u+1]),p=e.getPercent(d,uo),m=t.getPercent(d,uo);if(p===0||m===0)continue;let g=p===1?e:e.clip(p)[0],y=m===1?t:t.clip(m)[0];if(J2e(g,y)){let b=ho(o,d).cross(ho(t,d));if(b===0){a=e.end(),l=t.end();break}return{state:b<0?3:4}}s()}return(!a||!l)&&(a=_k(e.controls,e.controls[0],t),l=_k(t.controls,e.controls[0],e)),{state:a.sub(e.controls[0]).cross(l.sub(e.controls[0]))>0?4:3}}}return qO(o,t,r,i)}function G6e(o,t){let e=bPe(o,t.start());if(XO(e))return YL(new Ct(e.start(),e.end()),t);let r=H6e(e,t),{isIn:i,bezierIsInLeft:n}=U6e(t,e);if(!r&&!i){if(n!==void 0)return{state:n?3:4};let s=null,a=o.getPercent(t.start(),uo)+.01;for(let l=a>1?1:a;l<=1;){let c=en.pointOn(l,o.controls);if(nz(t,c)>O1){s=c;break}l+=.01,l>1&&(l=1)}if(!s)throw Error("!end1 && !end2 not result");return{state:t.direct.cross(s.sub(t.start()))<0?4:3}}return qO(e,t,r,i)}function yPe(o,t){let{isIn:e,bezierIsInLeft:r}=U6e(o,t),i=H6e(t,o);if(!e&&!i){if(r!==void 0)return{state:r?4:3};let n=null;for(let s=.01;s<=1;){let a=en.pointOn(s,t.controls);if(nz(o,a)>O1){n=a;break}s+=.01,s>1&&(s=1)}if(!n)throw Error("!end1 && !end2 not result");return{state:o.direct.cross(n.sub(o.start()))<0?3:4}}return qO(t,o,e,i)}function Zft(o,t){let e=t6e(kPe(o,t.start()),t),r=t6e(t,o);if(!e&&!r){let i=ES(t);if(o.center.sub(t.start()).dot(t.center.sub(t.start()))>0){if(o.rx===t.rx)return o.isCCW?{state:i.dot(o.center.sub(t.center))<0?3:4,exitIsInvalid:!1}:{state:i.dot(o.center.sub(t.center))>0?3:4,exitIsInvalid:!1};let n,s;return o.rx>t.rx?(n=o,s=t):(n=t,s=o),i.dot(s.center.sub(n.center))>0&&s.rx+s.center.distance1(n.center)-n.rx>uo?o.isCCW?{state:o.rx>t.rx?3:4,exitIsInvalid:!1}:{state:o.rx<t.rx?3:4,exitIsInvalid:!1}:o.isCCW?{state:o.rx<t.rx?3:4,exitIsInvalid:!0}:{state:o.rx>t.rx?3:4,exitIsInvalid:!0}}else return o.rx+t.rx-o.center.distance1(t.center)>uo&&i.dot(o.center.sub(t.center))>0?{state:t.isCCW?3:4,exitIsInvalid:!1}:{state:o.isCCW?3:4,exitIsInvalid:!0}}return qO(o,t,e,r)}function r6e(o,t){let e=SS.foot(o,t.center),r=o.end().distance2(t.center),i=o.end().sub(o.start()),n=(t.rx-uo)**2,s=r<=(t.rx+uo)**2&&r>=n&&(i.dot(e.sub(t.start()))<=0||o.start().distance2(o.end())<=o.start().distance2(e)||e.distance2(t.center)>=n)&&(kn(o.end(),t.end())||NPe(t,o.end())),a=W6e(t,o);if(!s&&!a){let l=o.distance2(t.center);return l<=O1?{state:i.cross(ES(t))>0?4:3}:i.dot(e.sub(t.start()))>=0&&(r<n||o.start().distance2(t.center)<n||l<n)?{state:i.cross(t.center.sub(o.start()))<0?4:3}:{state:i.cross(t.center.sub(o.start()))>0?4:3}}return qO(t,o,s,a)}function aE(o,t){return t=Qo.regularD(t),o.sweepAngle>0?(t<o.startAngle&&(t+=360),o.endAngle()>t):(t>o.startAngle&&(t-=360),o.endAngle()<t)}function NPe(o,t){return kn(o.end(),t)||kn(o.start(),t)||aE(o,t.angleD(o.center))}function U6e(o,t){let e=o.panDistance(uo),r=o.panDistance(-uo),i=n6e(t,e),n=n6e(t,r);if(!i.length&&!n.length)return{isIn:t.getPercent(o.end(),uo)!==null};let s=[...i,...n].sort((h,u)=>h.t-u.t),a=new Ct(r.start(),e.start()),l=[];for(let h=0,u=s.length;h<u;h++){let d=s[h];if(l.push(d),a.distance(d.interP)>o.length()+uo)break;if(l.length===2){let p=(l[1].t*10+l.shift().t*10)/20,m=en.pointOn(p,t.controls);if(o.distance2(m)>O1)return{isIn:!1,bezierIsInLeft:o.direct.cross(m.sub(o.start()))>0}}}let c=l.length?a.distance(l[0].interP)>=o.length()+uo:!0;return{isIn:c,bezierIsInLeft:c?void 0:o.direct.cross(l[0].interP.sub(o.start()))>0}}function H6e(o,t){if(nz(t,o.end())>O1||o.getToLineMaxDis2(t)>O1)return!1;let e=Qft(t,O1);return o.getToLineMaxDis2(e)<=(t.length()+uo)**2}function W6e(o,t){let e=t.end().angleD(t.start()),r=Jft(t,o.end());if(r>O1)return!1;if(aE(o,e+90)){if(SS.foot(t,o.center).distance1(o.pointOn(e+90))>o.rx)return!1;r=Math.max(r,(o.rx-t.distance(o.center))**2)}if(aE(o,e-90)){if(SS.foot(t,o.center).distance1(o.pointOn(e-90))>o.rx)return!1;r=Math.max(r,(o.rx-t.distance(o.center))**2)}return r<=O1&&(kn(o.end(),t.end())||PPe(t,o.end()))}var z6e=(uo*2)**2;function kPe(o,t){if(kn(o.end(),t))return Ir.build3(o.center,o.endAngle(),0,o.rx,o.ry);if(o.start().distance2(t)<z6e)return o;let e=Qo.regularD(t.angleD(o.center));if(!aE(o,e))throw new Error("!angleIsInArc(arc, angle)");return Ir.build2(o.center,e,o.endAngle(),o.rx,o.ry,o.isCCW?1:0)}function bPe(o,t){if(kn(o.end(),t))return new en([t,t]);if(o.start().distance2(t)<z6e)return o;let e=o.getPercent(t,uo);if(e===null)throw new Error("!cutBezier(bezier: Bezier, p: Vector2)");return o.clip(e)[1]}function i6e(o,t){let e=W6e(kPe(o,t.start()),t),r=t.end().distance2(o.center),i=t.end().sub(t.start()),n=SS.foot(t,o.center),s=(o.rx-uo)**2,a=r<=(o.rx+uo)**2&&r>=s&&(i.dot(n.sub(t.start()))<=0||t.start().distance2(t.end())<=t.start().distance2(n)||n.distance2(o.center)>=s)&&(kn(o.end(),t.end())||NPe(o,t.end()));if(!e&&!a){let l=t.distance2(o.center);return l<=O1?{state:i.cross(ES(o,t.start().angle(o.center)))>0?3:4}:i.dot(n.sub(t.start()))>=0&&(r<s||t.start().distance2(o.center)<s||l<s)?{state:i.cross(o.center.sub(t.start()))>0?4:3}:{state:i.cross(o.center.sub(t.start()))<0?4:3}}return qO(t,o,e,a)}function YL(o,t){if(kn(o.end(),t.end()))return qO(o,t,!0,!0);let e=nz(t,o.end())<=O1&&PPe(t,o.end()),r=nz(o,t.end())<=O1&&PPe(o,t.end());if(!e&&!r){let i=o.direct.x===0&&o.direct.y===0,n=t.direct.x===0&&t.direct.y===0;if(i&&n)throw Error("2LineAllIsPoint");return i?{state:t.direct.cross(o.end().sub(t.start()))>0?3:4}:{state:o.end().sub(o.start()).cross(t.end().sub(o.start()))>0?4:3}}return qO(o,t,e,r)}function PPe(o,t){return SS.foot(o,t).distance2(o.start())<o.end().distance2(o.start())}function qO(o,t,e,r){if(e)return r?kn(o.end(),t.end())?{state:2}:{state:0}:{state:0};if(r)return{state:1};throw new Error("!end1 && !end2")}function nz(o,t){return(o.a*t.x+o.b*t.y+o.c)**2/(o.a**2+o.b**2)}function Jft(o,t){return Math.min(o.distance2(t),SS.foot(o,t).distance2(t))}function Qft(o,t){let e=o.panDistance(t),r=o.panDistance(-t);return new Ct(r.start(),e.start())}function XO(o){let t=o.start(),e=o.end();t.equals1(e)&&(e=t.add1(1,0));let r=e.y-t.y,i=t.x-e.x,n=-r*t.x-i*t.y,s=Math.sqrt(1/(r**2+i**2));r*=s,i*=s,n*=s;let a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;return o.controls.forEach(c=>{let h=r*c.x+i*c.y+n;h<a&&(a=h),h>l&&(l=h)}),uE(a,l)}function n6e(o,t){let e=EI(o,t),r=[],i=new Array(e).fill(0).map((s,a)=>st[a]);for(let s=0;s<e;s+=2){let a=new qt(st[s],st[s+1]),l=o.getPercent(a);r.push({interP:a,t:l}),n()}function n(){for(let s=0;s<e;s+=2)st[s]=i[s],st[s+1]=i[s+1]}return r}var sE=.01,emt=270;function jv(o){let t=sE**2,e=o.end(),r=[],i=[];for(let p=0,m=o.primitives.length;p<m;p++){let g=function(v,D){return v instanceof Ct&&D instanceof Ct&&Math.abs(v.direct.cross(D.direct))<Er.eps&&v.direct.dot(D.direct)>0||v instanceof Ir&&D instanceof Ir&&Math.abs(v.rx-D.rx)<=Er.eps&&v.center.distance2(D.center)<Er.eps&&v.isCCW===D.isCCW},y=function(v){if(KP(v,sE))i.push(null);else{if(v instanceof Ct)i.push(v);else if(v instanceof Ir&&v.rx===v.ry)u(v,i);else if(v instanceof en){let D=[];w6e(v,D),D.forEach(w=>{let F=w.start(),H=w.end();h(F,H)||i.push(w)})}else throw new Error("not support!");e=I}},b=function(v){if(v instanceof Ct)return v.direct.x===0&&v.direct.y===0;if(v instanceof Ir)return v.sweepAngle===0;if(v instanceof en){let D=new Set(v.controls.map(F=>F.x)),w=new Set(v.controls.map(F=>F.y));return D.size===1&&w.size===1}else throw new Error("not support")},P=o.primitives[p],T=P.start(),I=P.end();if(b(P))continue;h(e,T)||(i.push(new Ct(e,T)),e=T);let C=(p+1)%m,E=o.primitives[C];for(;g(P,E)&&(C=(C+1)%m,E=o.primitives[C],E!==P););if(C===(p+1)%m){y(P);continue}if(E===P){if(!(P instanceof Ir)){if(Math.abs(o.area(.1))<t)return null;throw new Error("simplifyPolyline not support")}let v=P instanceof Ir?P.isCCW:o.area(.1)>0;i.length=0;let D=v?180:-180;i.push(Ir.build3(P.center,P.startAngle,D,P.rx,P.ry),Ir.build3(P.center,P.startAngle+D,D,P.rx,P.ry));break}let O=(()=>{if(P instanceof Ct)return(v,D)=>{let w=new Ct(v,D);return KP(w,sE)?null:[w]};if(P instanceof Ir)return(v,D)=>{let w;if(v.equals1(D)?w=Ir.build3(P.center,P.startAngle,P.sweep()===1?360:-360,P.rx,P.ry):w=Ir.build4(v,D,P.center,P.rx,P.ry,P.sweep()),KP(w,sE))return null;let F=w.pointOn(w.startAngle+w.sweepAngle/2),H=Ir.build4(w.start(),F,P.center,P.rx,P.ry,P.sweep()),z=Ir.build4(F,w.end(),P.center,P.rx,P.ry,P.sweep());return KP(H,sE)||KP(z,sE)?[w]:[H,z]};throw new Error("not support")})(),_=C===0;if(C<p&&!_&&(_=!O(o.primitives[0].start(),o.primitives[C-1].end()),!_)){let v=O(P.start(),o.primitives[m-1].end());if(v)i.push(...v);else{let D=O(P.start(),i[0].end());if(D.length===1)i[0]=D[0];else if(D.length===2)i[0]=D[1],i.push(D[0]);else throw new Error("!!!generatorPt")}break}p=C===0?m-1:C-1,E=o.primitives[p];let R=O(P.start(),E.end());if(R?(R.forEach(v=>i.push(v)),e=E.end()):y(null),_)break}let n=i.length;if(i.forEach((p,m)=>{if(p)r.push(p);else{let g,y;m===n-1&&(g=r[0],y=r[r.length-1]);let b=(m+1)%n;if(g=g!=null?g:i[b],g){let P=m,T=!1;for(;y=y!=null?y:i[(--P+n)%n],y!==g;)if(y){T=!0;break}if(T){if(g.start().equals1(y.end()))return;if(ho(y,y.end()).dot(ho(g,g.start()))<0){if(!h(y.end(),g.start())){let O=new Ct(y.end(),g.start());r.push(O);return}let{rebuildPrevPt:I,rebuildNextPt:C,rebuildLinkLine:E}=o6e(i[(P-1+n)%n],y,new Ct(y.end(),g.start()),g,i[(m+2)%n]);I&&C&&(I!==y?(i[(P+n)%n]=I,r[r.length-1]&&(r[r.length-1]=I)):C!==g&&(i[(m+1)%n]=C,r[0]===g&&(r[0]=C)),E&&r.push(E))}}}}}),r.length===0)return null;h(e,r[0].start())||r.push(new Ct(e,r[0].start()));let s=r[r.length-1];if(r.length===1)return s instanceof Ir?Ca.build7([Ir.build2(s.center,0,180,s.rx,s.ry,s.sweep()),Ir.build2(s.center,180,360,s.rx,s.ry,s.sweep())]):s instanceof en?Ca.build7(s.clip(.5)):null;let a=r.map(p=>new tmt(p)),l=a[a.length-1];for(a.forEach(p=>{p.connect(l),l=p});!l.isVisited;){let p=function(){l.next.connect(g),l=l.next,l.isConnected=!1,l.isVisited=!1},m=function(){l.connect(g.prev),l.isConnected=!1},g=l.prev;if(l===g)break;let y=l.pt,b=g.pt,P=b.end();if(!l.isConnected&&!P.equals(y.start())){let T=function(C){l.isConnected=!0,l.pt=y=C,l.next.isVisited=!1},I=function(C){l.isConnected=!0,g.pt=C,g.isVisited=!1,l=g};if(y instanceof Ct)if(h(P,y.end())){p();continue}else T(new Ct(P,y.end()));else if(b instanceof Ct){h(b.start(),y.start())?m():I(new Ct(b.start(),y.start()));continue}else if(y instanceof en)if(h(P,y.end())&&!(y.controls.length!==2&&y.getToLineMaxDis2(y.startToEndL)>=t)){p();continue}else T(new en([P,...y.controls.slice(1)]));else if(b instanceof en)h(b.start(),y.start())&&!(b.controls.length!==2&&b.getToLineMaxDis2(b.startToEndL)>=t)?m():I(new en([...b.controls.slice(0,-1),y.start()]));else if(y instanceof Ir&&b instanceof Ir)if(Math.abs(Math.abs(y.sweepAngle)-180)<Math.abs(Math.abs(b.sweepAngle)-180)){let C=Ir.build5(P,y.end(),y.sweepAngle);if(h(C.start(),C.end())&&!(C.rx>=sE&&Math.abs(C.sweepAngle)>180)){p();continue}else T(C)}else{let C=Ir.build5(b.start(),y.start(),b.sweepAngle);h(C.start(),C.end())&&!(C.rx>=sE&&Math.abs(C.sweepAngle)>180)?m():I(C);continue}else throw new Error("not support")}if(ho(y,y.start()).dot(ho(b,b.end()))<0){let T=function(E,O,_,R,v,D){if(l.next===g){l=null;return}let{rebuildLinkLine:w,rebuildPrevPt:F,rebuildNextPt:H}=o6e(E,O,_,R,v);F&&H&&(F!==O&&(g.prev.pt=F),H!==R&&(l.next.pt=H),w?D.pt=w:p())},I=function(){l.next===g?l=null:(l.next.connect(g.prev),l=l.next,l.isConnected=!1,l.isVisited=!1)},C=E1(b.reverse(),y).state;if(C===0){let E=s6e(y,b.start(),y.end());if(d(E)){let O=g.prev.pt,_=l.next.pt;if(ho(_,_.start()).dot(ho(O,O.end()))>=0){if(I(),!l)break;continue}if(T(g.prev.prev.pt,O,E instanceof Ct?E:new Ct(E.start(),E.end()),_,l.next.next.pt,l),!l)break}else l.pt=E;m();continue}else if(C===1){let E=s6e(b,b.start(),y.end());if(d(E)){let O=g.prev.pt,_=l.next.pt;if(ho(_,_.start()).dot(ho(O,O.end()))>=0){if(I(),!l)break;continue}if(T(g.prev.prev.pt,O,E instanceof Ct?E:new Ct(E.start(),E.end()),_,l.next.next.pt,g),!l)break}else g.pt=E;p();continue}else if(C===2){if(I(),!l)break;continue}}l.isVisited=!0,l=l.next}if(!l)return null;r.length=0;let c=l;for(r.push(l.pt),l=l.next;l!==c;)r.push(l.pt),l=l.next;if(r.length===1){let p=r[0];return p instanceof Ir?(h(p.start(),p.end())?r[0]=Ir.buildCircle(p.center,p.rx,p.sweep()):r.push(new Ct(p.end(),p.start())),Ca.build7(r)):p instanceof en?(h(p.start(),p.end())||r.push(new Ct(p.end(),p.start())),Ca.build7(r)):null}if(o=Ca.build7(r),Math.abs(o.area(.1))<t)return null;return o;function h(p,m){return p.distance2(m)<t}function u(p,m){if(Math.abs(p.sweepAngle)>emt){let g=p.sweepAngle/2;u(Ir.build3(p.center,p.startAngle,g,p.rx,p.ry),m),u(Ir.build3(p.center,p.startAngle+g,g,p.rx,p.ry),m)}else m.push(p)}function d(p){return p.start().distance2(p.end())<t&&!(p instanceof Ir&&p.rx>=sE&&Math.abs(p.sweepAngle)>180||p instanceof en&&p.controls.length!==2&&p.getToLineMaxDis2(new Ct(p.start().add1(1,0),p.end()))>=t)}}function KP(o,t){if(!o)return!0;let e=o.start(),r=o.end();if(e.distance2(r)<t**2)if(o instanceof Ir){if(!(o.rx>=t&&Math.abs(o.sweepAngle)>180))return!0}else if(o instanceof en){if(!(o.controls.length!==2&&o.getToLineMaxDis2(new Ct(o.start().add1(1,0),o.end()))>=t))return!0}else return!0;return!1}function bk(o){if(o.direct.x===0&&o.direct.y===0)throw Error("getEndOfExtendLine(line: Line, distance: number)");let t=Math.abs(sE-o.length())+Er.eps,e={x:o.direct.normalize().x*t,y:o.direct.normalize().y*t},r=o.end();return new qt(r.x+e.x,r.y+e.y)}function o6e(o,t,e,r,i){if(!o)s();else if(!i)a();else{let l=ho(o,o.end()),c=ho(t,o.end()),h=l.dot(c);if(h>=0)s();else{let u=ho(r,r.end()),d=ho(i,r.end()),p=u.dot(d);if(p>=0)a();else if(uE(h,-1)&&uE(p,-1)){let m=e.center();n(m),e=null}else h>p?s():a()}}function n(l){let c;if(t instanceof Ct)c=new Ct(t.start(),l);else if(t instanceof en)c=new en([...t.controls.slice(0,-1),l]);else if(t instanceof Ir)c=Ir.build5(t.start(),l,t.sweepAngle);else throw new Error("not supported");t=KP(c,uo)?null:c;let h;if(r instanceof Ct)h=new Ct(l,r.end());else if(r instanceof en)h=new en([l,...r.controls.slice(1)]);else if(r instanceof Ir)h=Ir.build5(l,r.end(),r.sweepAngle);else throw new Error("supported");r=KP(h,uo)?null:h}function s(){if(t instanceof Ct){let l=bk(e.reverse());e=new Ct(l,e.end());let c=new Ct(t.start(),l);t=KP(c,uo)?null:c}else if(t instanceof en){let l=bk(e.reverse());e=new Ct(l,e.end());let c=new en([...t.controls.slice(0,-1),l]);t=KP(c,uo)?null:c}else if(t instanceof Ir){let l=bk(e.reverse());e=new Ct(l,e.end());let c=Ir.build5(t.start(),l,t.sweepAngle);t=KP(c,uo)?null:c}else throw new Error("not supported")}function a(){if(r instanceof Ct){let l=bk(e);e=new Ct(e.start(),l);let c=new Ct(l,r.end());r=KP(c,uo)?null:c}else if(r instanceof en){let l=bk(e);e=new Ct(e.start(),l);let c=new en([l,...r.controls.slice(1)]);r=KP(c,uo)?null:c}else if(r instanceof Ir){let l=bk(e);e=new Ct(e.start(),l);let c=Ir.build5(l,r.end(),r.sweepAngle);r=KP(c,uo)?null:c}else throw new Error("not supported")}return{rebuildPrevPt:t,rebuildNextPt:r,rebuildLinkLine:e}}function s6e(o,t,e){if(o instanceof Ct||t.distance2(e)<=O1)return new Ct(t,e);if(o instanceof Ir)return Ir.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?1:0);if(o instanceof en){let r=o.getPercent(t,uo),i=o.getPercent(e,uo);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}var tmt=class{constructor(o){this.pt=o}connect(o){this.prev=o,o.next=this}};function qQ(o){let t=hz(),e;if(o instanceof Ca){let r=jv(o);if(r===null)return null;e=r}else if(o instanceof Y0){let r=o.items.map(i=>qQ(i)).filter(i=>i!==null);if(r.length===0)return null;e=new Y0(r)}else{let r=o.items.map(i=>qQ(i)).filter(i=>i!==null);if(r.length===0)return null;e=new dp(r)}return cE.preprocessPolyline+=Wv(t),e}var cE={addDocShapes2RTree:0,getPour:0,prepare:0,getSinglePourLayerPolyline:0,combindOutlines:0,mergeSameNet:0,run:0,end:0,deSelfIntersection:0,changeDirect:0,extend:0,preprocessPolyline:0,runBoolean:0,IntersectionSeeker:0,BooleanTools:0,totalBool:0};function hz(){return{timeIndex:Object.assign({},cE),start:performance.now()}}function a6e(o){return Object.values(o).reduce((t,e)=>t+e,0)}function Wv(o){return performance.now()-o.start-(a6e(cE)-a6e(o.timeIndex))}function om(o,t,e,r){let i=Wl.RED,n=Wl.Golden;function s(){if(!r)return;let d=r.initColor(Wl.Golden);d.addPt(a),d.addPoint(a.end()),r.initColor(Wl.RED).addPt(l),r.draw();debugger}let a=o.getShape(),l=e?t.getShape():t.getShape().reverse(),c=ho(a,l.start()),h=ho(l),u=c.cross(h);if(uE(u,0))if(a instanceof Ct)if(l instanceof Ct){if(Er.eq(u,0)&&(c.dot(h)>0?!kn(a.end(),l.start()):!kn(a.start(),l.start())))throw s(),new Error("line and line");return u<0}else{if(l instanceof Ir)return c.cross(l.center.sub(a.start()))<0;if(l instanceof en){let d=l.getExtremePoints(a),p=d.length?d[0]:_k(l.controls,a.start());return c.cross(p.sub(a.start()))<0}else throw new Error("not support")}else if(a instanceof Ir){if(l instanceof Ct)return a.isCCW;if(l instanceof Ir){if(l.center.equals1(a.center)&&(c.dot(h)>0?!kn(a.end(),l.start())&&a.end().sub(l.start()).dot(h)>0:!kn(a.start(),l.start())&&a.start().sub(l.start()).dot(h)>0))throw s(),new Error("arc and arc");return l.rx>=a.rx||l.center.distance2(a.center)>a.rx2?a.isCCW:!a.isCCW}else throw new Error("not support")}else if(a instanceof en)if(l instanceof Ct){let d=a.getPercent(l.start(),uo),p=a.clip(d)[1],m=p.getExtremePoints(l);return(m.length?m[0]:_k(p.controls,l.start())).sub(l.start()).cross(h)<0}else if(l instanceof en){let d=a.getPercent(l.start(),uo),p=a.clip(d)[1],m=p.getExtremePoints(new Ct(l.start(),l.end())),g=l.getExtremePoints(new Ct(p.start(),p.end())),y=m.length?m[0]:_k(p.controls,l.start()),b=g.length?g[0]:_k(l.controls,l.start()),P=y.sub(l.start()),T=b.sub(l.start());return P.cross(T)<0}else throw Error("not support");else throw new Error("not support");else return u<0}function XL(o,t,e,r,i){let n=o.getShape(),s=t.getShape(),a=n instanceof Ir?ES(n,Qo.toRadians(n.endAngle())):n instanceof en?rz(n,1):n.end().sub(n.start()).normalize(),l=ho(s),c=a.dot(l);if(uE(c,-1))return om(o,t,!0,i)?om(o,e,r,i)&&om(t,e,r,i):om(o,e,r,i)||om(t,e,r,i);{let h=a.scale(-1).angle(qt.ORIGIN),u=l.angle(qt.ORIGIN);h>u&&(h-=eee);let d=(h+u)/2,p=new qt(Math.cos(d),Math.sin(d)),m=r?e.getShape():e.getShape().reverse(),g=ho(m);return p.cross(g)<0?om(o,e,r,i):om(t,e,r,i)}}function Q2e(o,t,e,r,i){let n=o.getShape(),s=t.getShape(),a=n instanceof Ir?ES(n,Qo.toRadians(n.endAngle())):n instanceof en?rz(n,1):n.end().sub(n.start()).normalize(),l=ho(s),c=a.dot(l);if(uE(c,-1))return om(o,t,!0,i)?om(o,e,r,i)&&om(t,e,r,i):om(o,e,r,i)||om(t,e,r,i);{let h=a.scale(-1).angle(qt.ORIGIN),u=l.angle(qt.ORIGIN);h>u&&(h-=eee);let d=(h+u)/2,p=new qt(Math.cos(d),Math.sin(d)),m=r?e.getShape():e.getShape().reverse(),g=ho(m);if(p.cross(g)<0){let y=a.dot(g)<0,b=E1(y?o.getShape().reverse():o.getShape(),m).state;return b!==3&&b!==4?om(o,e,r,i):b===(y?4:3)}else{let y=l.dot(g)<0,b=E1(y?t.getShape().reverse():t.getShape(),m).state;return b!==3&&b!==4?om(t,e,r,i):b===(y?4:3)}}}var rmt=(o=>(o[o.NOT_IN=0]="NOT_IN",o[o.IS_IN=1]="IS_IN",o[o.IS_OVERLAP=2]="IS_OVERLAP",o))(rmt||{}),imt=(o=>(o[o.AllClear=0]="AllClear",o[o.MapClear=1]="MapClear",o))(imt||{}),lE,Yv=!1;function ZP(o,t,e,r,i,n,s,a=e.side===t,l=!0,c){return lE=i,Yv=n,Y6e(j6e(o,t,l,c,s,e,a,r),e,a,r,0)}function zO(o,t,e,r,i,n,s,a=r.side===e){lE=i,Yv=n;let l=X6e(o,t,e,new Map,r,a,s),c=l instanceof Array?-1:1;return Y6e(l,r,a,s,c)}function Y6e(o,t,e,r,i){for(;o instanceof Array;)i++,o.length===4?o=X6e(...o,t,e,r):o=j6e(...o,t,e,r);return{...o,existOverlap:i>0}}function j6e(o,t,e,r,i,n,s,a){if($Q===-1){a.initColor(Wl.RED).addPt(o.getShape()),a.initColor(Wl.Golden).addPt(t.getShape()),a.draw();debugger}let l=o.getShape(),c=s?t.getShape().reverse():t.getShape(),h=(l instanceof Ir?ES(l,e?c.start().angle(l.center):r?Qo.toRadians(l.endAngle()):void 0):l instanceof en?ho(l,e?c.start():r?l.end():l.start()):l.end().sub(l.start())).normalize(),u=(c instanceof Ir?ES(c,e?void 0:(r?l.end():l.start()).angle(c.center)):c instanceof en?ho(c,e?void 0:r?l.end():l.start()):c.end().sub(c.start())).normalize();if(r===void 0){let m=h.dot(u);if(r=m<0,uE(m,0))return{state:om(o,t,!s,a)?1:0,inter:YO(o,t,n,s,e,r,i)}}else if(r?h.dot(u)>0:h.dot(u)<0)if(e){let m,g=!0;if(l instanceof Ct&&kn(SS.foot(l,c.start()),r?l.end():l.start()))g=!1;else if(l instanceof Ir||l instanceof en){let y=r?l.reverse():l,b=E1(c,yft(y,c.start()).reverse()).state;(b===1||b===2)&&(g=!1)}if(g){let y=!r;m=E1(y?l.reverse():l,c,a).state===(y?4:3)?1:0}else r?m=XL(o,o.nextSide,t,!s,a)?1:0:m=XL(o.prevSide,o,t,!s,a)?1:0;return{state:m,inter:YO(o,t,n,s,e,r,i)}}else return r?{state:om(o,o.nextSide,!0,a)?0:1,inter:YO(o,t,n,s,e,r,i),isReversed:!0}:{state:om(o.prevSide,o,!0,a)?0:1,inter:YO(o,t,n,s,e,r,i),isReversed:!0};let d,p=new Map([[3,4],[4,3],[0,1],[1,0],[2,2]]);if(e)if(o.judgeOverlapMap.has(t)&&!Yv){let m=o.judgeOverlapMap.get(t);d=r?p.get(m.state):m.state}else d=E1(r?l.reverse():l,c).state,(d===3||d===4)&&o.judgeOverlapMap.set(t,{state:r?p.get(d):d});else{if(t.judgeOverlapMap.has(o)&&!Yv){let m=t.judgeOverlapMap.get(o);d=s?p.get(m.state):m.state}else d=E1(c,r?l.reverse():l).state,(d===3||d===4)&&t.judgeOverlapMap.set(o,{state:s?p.get(d):d});d=p.get(d)}if(d===1||d===2){let m=s?t.prevSide:t,g=m.inters,y=m.getEnd();for(let b=g.length-1;b>=0;b--){let P=g[b];if(!(m.getShape()instanceof en)&&!kn(y,P.coord))break;if(P===n)return{state:2,inter:YO(o,t,n,s,e,r,i)}}}if(d===3||d===4)return{state:d===(r?4:3)?1:0,inter:YO(o,t,n,s,e,r,i)};if(i.has(o)?i.get(o).mapSideList.push(t):i.set(o,{sideIsReversed:r,mapSideList:[t]}),i.has(t)?i.get(t).mapSideList.push(o):i.set(t,{sideIsReversed:s,mapSideList:[o]}),d===2)return r?[o.prevSide,o,s?t.prevSide:t.nextSide,i]:[o,o.nextSide,s?t.prevSide:t.nextSide,i];if(d===0)return[r?o.prevSide:o.nextSide,t,!1,r,i];if(d===1)return[o,s?t.prevSide:t.nextSide,!0,r,i];throw Error("not support")}function YO(o,t,e,r,i,n,s){if(Yv)return null;let a=o.getShape(),l=r?t.getShape().reverse():t.getShape(),c=r;if(!i){let p=t;t=o,o=p,r=n,e=e.getBindedInter()}let h=p=>!(i?n:c)&&kn(p,o.prevSide.getEnd())?o.prevSide:o;if(r){let p=t.inters;for(let m=0;m<p.length;m++){let g=p[m];if(g.isInvalid&&n===void 0)continue;if(g===e&&kn(l.start(),e.coord))return i?g:g.getBindedInter();let y=g.getBindedInter().side,b=h(g.coord);if(y===b&&u(g))return d(g)}for(;;){t=t.nextSide;let m=t.inters;for(let g=0;g<m.length;g++){let y=m[g];if(y===e)return i?y:y.getBindedInter();if(s.has(t)){let b=y.getBindedInter().side;if(s.get(t).mapSideList.includes(b)||kn(y.coord,b.getEnd())&&s.get(t).mapSideList.includes(b.nextSide))return d(y);if(s.has(b)){let P=t.getShape().reverse(),T=ho(P,y.coord).dot(ho(b.getShape(),y.coord))<0,I=T?b.getShape().reverse():b.getShape(),C=E1(P,T?X2e(I,y.coord,I.end()):X2e(I,I.start(),y.coord)).state;if(C===1||C===2)return d(y)}else s.has(b.nextSide)}else if(y.side===e.side&&u(y))return d(y)}}}else{let p=t.inters;for(let m=p.length-1;m>=0;m--){let g=p[m];if(g.isInvalid&&n===void 0)continue;if(g===e&&kn(l.start(),e.coord))return i?g:g.getBindedInter();let y=g.getBindedInter().side,b=h(g.coord);if(y===b&&u(g))return d(g)}for(;;){t=t.prevSide;let m=t.inters;for(let g=m.length-1;g>=0;g--){let y=m[g];if(y===e)return i?y:y.getBindedInter();if(s.has(t)){let b=y.getBindedInter().side;if(s.get(t).mapSideList.includes(b)||kn(y.coord,y.getBindedInter().side.getEnd())&&s.get(t).mapSideList.includes(b.nextSide))return d(y);if(!s.has(b)&&s.has(b.prevSide)){let P=t.getShape().reverse(),T=ho(P,y.coord).dot(ho(b.getShape(),y.coord))<0;if(s.has(b.prevSide)){let I=T?b.getShape().reverse():b.getShape(),C=E1(t.getShape(),X2e(I,y.coord,I.end())).state;if(C===1||C===2)return d(y)}}}else if(y.side===e.side&&u(y))return d(y)}}}function u(p){if(p.isInvalid||p.getBindedInter().side!==(kn(p.coord,o.prevSide.getEnd())?o.prevSide:o))return!1;let m;if(i){if(kn(p.coord,l.start()))return!0;m=E1(n?a.reverse():a,g(l)).state}else{if(kn(p.coord,n?a.end():a.start()))return!0;m=E1(l,g(n?a.reverse():a)).state}return m===2||m===1;function g(y){if(y instanceof Ct)return kn(p.coord,y.end())?y:y.cutLine(p.coord);if(y instanceof Ir)return Ir.build2(y.center,y.startAngle,p.coord.angleD(y.center),y.rx,y.ry,y.isCCW?1:0);if(y instanceof en)return y.clip(y.getPercent(p.coord,uo))[0];throw new Error("not supported operation")}}function d(p){let m=e.getBindedInter(),g=e.side,y=m.side,b=e===p,P=e;if(r){let T=e.getIndex()-1;for(;g;){let I=g.inters;for(;T>=0;T--)if(e=I[T],e===p){b||(e.setIsInvalid(),e.isDealed(),P=e),g=null;break}else if(lE===0)!e.isInvalid&&(!kn(e.coord,p.coord)||e.side===p.side&&e.getBindedInter().side===p.getBindedInter().side)&&(e.setIsInvalid(),e.isDealed(),P=e);else if(lE===1){if(e.isInvalid)continue;let C=e.getBindedInter().side;s.has(g)&&s.get(g).mapSideList.includes(C)&&(e.setIsInvalid(),e.isDealed(),P=e)}g=g==null?void 0:g.prevSide,T=(g==null?void 0:g.inters.length)-1}}else{let T=e.getIndex()+1;for(;g;){let I=g.inters;for(;T<I.length;T++){e=I[T];let C=e.getBindedInter();if(e===p){b||(e.setIsInvalid(),e.isDealed(),P=e),g=null;break}else if(lE===0)!e.isInvalid&&(!kn(e.coord,p.coord)||g===p.side&&(kn(C.side.getEnd(),e.coord)?C.side.nextSide:C.side)===p.getBindedInter().side)&&(e.setIsInvalid(),e.isDealed(),P=e);else if(lE===1){let E=C.side;s.has(g)&&s.get(g).mapSideList.includes(E)&&(e.setIsInvalid(),e.isDealed(),P=e)}}g=g==null?void 0:g.nextSide,T=0}}if(lE===0&&!kn(m.coord,p.coord))if(i?s.has(y)?s.get(y).sideIsReversed:n:c){let T=m.getIndex()-1;for(;y;){let I=s.has(y),C=y.inters;for(;T>=0;T--){if(m=C[T],m===p.getBindedInter()){y=null;break}m.isInvalid||!I||(!kn(m.coord,p.getBindedInter().coord)||m.side===p.side&&m.getBindedInter().side===p.getBindedInter().side)&&(m.setIsInvalid(),m.isDealed())}y=y==null?void 0:y.prevSide,T=(y==null?void 0:y.inters.length)-1}}else{let T=m.getIndex()+1;for(;y;){let I=y.inters,C=s.has(y);for(;T<I.length;T++){if(m=I[T],m===p.getBindedInter()){y=null;break}let E=kn(y.getEnd(),m.coord)?s.has(y.nextSide):!1;m.isInvalid||!(C||E)||(!kn(m.coord,p.getBindedInter().coord)||m.side===p.side&&m.getBindedInter().side===p.getBindedInter().side)&&(m.setIsInvalid(),m.isDealed())}y=y==null?void 0:y.nextSide,T=0}}return i?P:P.getBindedInter()}}function X6e(o,t,e,r,i,n,s){let a=o.getShape(),l=t.getShape(),c=n?e.getShape().reverse():e.getShape(),h=(a instanceof Ir?ES(a,c.start().angle(a.center)):a instanceof en?ho(a,c.start()):a.end().sub(a.start())).normalize(),u=(l instanceof Ir?ES(l,c.start().angle(l.center)):l instanceof en?ho(l,c.start()):l.end().sub(l.start())).normalize(),d=h.dot(u);if(uE(d,-1)){let p=n?e.getShape().reverse():e.getShape(),m=ho(p).normalize(),g=h.add(u.scale(-1)).normalize().dot(m),y=E1(a.reverse(),l,s).state;if(g>-.9&&(y===3||y===4))return{state:y===4?0:1,inter:YO(t,e,i,n,!0,!1,r)};let b=ZP(o,e,i,s,lE,Yv,r.size===0?new Map:r,n);return b.state===2?b:y===4?b.state===0||b.inter!==i?b:ZP(t,e,i,s,lE,Yv,r.size===0?new Map:r,n):b.state===1||b.inter!==i?b:ZP(t,e,i,s,lE,Yv,r.size===0?new Map:r,n)}else{let p=h.scale(-1).angle(qt.ORIGIN),m=u.angle(qt.ORIGIN);p>m&&(p-=eee);let g=(p+m)/2,y=new qt(Math.cos(g),Math.sin(g)),b=ho(c).normalize(),P=b.angle(qt.ORIGIN),T=p<P&&P<m&&a instanceof Ct&&l instanceof Ct&&c instanceof Ct;if(y.cross(b)<=0){if(h.scale(-1).dot(b)<0){let I;return i.coord.equals1(c.start())?I=ho(a,i.coord).dot(ho(c,i.coord))<0:c instanceof Ct&&(I=ho(a,a.end()).dot(c.direct)<0),{state:XL(o,t,e,!n,s)?1:0,inter:YO(o,e,i,n,!0,I,r)}}return T&&a.distance2(c.start())>O1?[t,e,!0,void 0,r]:[o,e,!0,void 0,r]}else return u.dot(b)<=0?{state:XL(o,t,e,!n,s)?1:0,inter:YO(t,e,i,n,!0,void 0,r)}:T&&l.distance2(c.start())>O1?[o,e,!0,void 0,r]:[t,e,!0,void 0,r]}}var $Q=0;function nmt(o,t,e,r){let i=t.getBindedInter(),n=t.side,s=i.side,a=n.getShape(),l=s.getShape();if(r&&($Q++,$Q===-1)){r.initColor(Wl.RED).addPt(a),r.initColor(Wl.Golden).addPt(l),r.draw();debugger}let c=0,h=!1;if(o===-1){let O=zO(n,n.nextSide,s,i,c,h,r),_=O.state!==0;if(O.state===2){let v=ho(a,t.coord).add(ho(n.nextSide.getShape(),t.coord)).normalize(),D=ho(l,t.coord).add(ho(s.nextSide.getShape(),t.coord)).normalize();return E(_,v.dot(D)>0)}let R=zO(n,n.nextSide,s.nextSide,i,c,h,r);return O.state!==R.state?(C(O,R),1):E(_,O.state!==zO(s,s.nextSide,n,t,c,!0,r).state,O.inter,R.inter)}if(o===1){let O=ZP(n,s,i,r,c,h,new Map),_=O.state!==0;if(O.state===2)return E(_,ho(a,t.coord).dot(ho(l,t.coord))>0);let R;if(O.isReversed&&O.existOverlap&&kn(O.inter.coord,s.getEnd())&&O.inter.getBindedInter().side!==n){let w=O.inter.getBindedInter().side;if(w===n.nextSide)R={state:XL(n,w,s.nextSide,!0,r)?1:0,inter:i};else if(w===n.prevSide){if(R={state:XL(w,n,s.nextSide,!0,r)?1:0,inter:O.inter},O.state===R.state&&t!==O.inter){let F=ho(l,t.coord),H=ho(s.nextSide.getShape(),t.coord),z=ho(w.getShape(),t.coord);return E(_,F.add(H).dot(z)>0,O.inter,R.inter)}}else R=ZP(n,s.nextSide,i,r,c,h,new Map)}else R=ZP(n,s.nextSide,i,r,c,h,new Map);if(O.state!==R.state)return C(O,R),1;let v=ho(l,t.coord),D=ho(s.nextSide.getShape(),t.coord);if(uE(v.dot(D),-1)){let w=om(s,s.nextSide,!0,r);return E(_,O.state!==ZP(s.nextSide,n,t,r,c,!0,new Map,w?!_:_,!1).state,O.inter,R.inter)}else{let w=ho(a,t.coord);return E(_,v.add(D).dot(w)>0,O.inter,R.inter)}}if(!(a instanceof en||l instanceof en))return 1;let u=ho(a,t.coord),d=ho(l,t.coord),p,m;if(l instanceof Ct)p=new Ct(t.coord,l.start()),m=new Ct(t.coord,l.end());else if(l instanceof Ir){let O=t.coord.angleD(l.center);p=Ir.build2(l.center,O,l.startAngle,l.rx,l.ry,l.isCCW?0:1),m=Ir.build2(l.center,O,l.endAngle(),l.rx,l.ry,l.isCCW?1:0)}else if(l instanceof en){let O=l.getPercent(t.coord,uo);[p,m]=l.clip(O),p=p.reverse()}else throw new Error("not support");let g=u.dot(d)>0,y,b;g?(y=E1(a.reverse(),p).state,b=E1(a,m).state):(y=E1(a,p).state,b=E1(a.reverse(),m).state);let P;y===0?P=ZP(g?n.prevSide:n.nextSide,s,i,r,c,h,new Map,!0,!1,g):y===1?P=ZP(n,s.prevSide,i,r,c,h,new Map,!0,!0,g):y===2?g?P=zO(n.prevSide,n,s.prevSide,i,c,h,r,!0):P=zO(n,n.nextSide,s.prevSide,i,c,h,r,!0):g?y===3?P={inter:i,state:0}:P={inter:i,state:1}:y===3?P={inter:i,state:1}:P={inter:i,state:0};let T=P.state!==0;if(P.state===2)return E(T,g);let I;if(b===0?I=ZP(g?n.nextSide:n.prevSide,s,i,r,c,h,new Map,!1,!1,!g):b===1?I=ZP(n,s.nextSide,i,r,c,h,new Map,!1,!0,!g):b===2?g?I=zO(n,n.nextSide,s.nextSide,i,c,h,r,!1):I=zO(n.prevSide,n,s.nextSide,i,c,h,r,!1):g?b===3?I={inter:i,state:1}:I={inter:i,state:0}:b===3?I={inter:i,state:0}:I={inter:i,state:1},P.state===I.state)return P.inter===I.inter?(t.setIsInvalid(),0):E(T,g,P.inter,I.inter);return C(P,I),1;function C(O,_){let R=O.state!==0;if(O.inter===_.inter){t.setOutToIn(R);return}else Pk(O.inter,_.inter,!0),Pk(_.inter,O.inter,!1);let v=[];if(o===-1){let w=ho(a,t.coord),F=ho(n.nextSide.getShape(),t.coord),H=ho(l,t.coord),z=ho(s.nextSide.getShape(),t.coord);v.push(w.dot(H)),v.push(w.dot(z)),v.push(F.dot(H)),v.push(F.dot(z))}else{let w=ho(a,t.coord);v.push(ho(l,t.coord).dot(w)),v.push(ho(s.nextSide.getShape(),t.coord).dot(w))}if(v.reduce((w,F)=>Math.abs(w)>Math.abs(F)?w:F,0)>0)if(e===1||e===0||e===2||e===3)t.setOutToIn(R);else throw new Error("not support");else if(e===1)D(!R);else if(e===0||e===2||e===3)D(R);else throw new Error("not support");function D(w){t.setIsInvalid();let F=(w?O:_).inter;delete F.isInvalid,delete F.getBindedInter().isInvalid,F.setOutToIn(!R)}}function E(O,_,R,v){if(R===v){if(t.side.outline.inters.find(F=>!F.isInvalid&&F!==t&&kn(F.coord,t.coord)))return t.setIsInvalid(),0;let D=new jO(t.coord,n,r),w=new jO(t.coord,s,r);return D.bind(w),_?n.inters.splice(t.getIndex(),0,D):n.inters.splice(t.getIndex()+1,0,D),s.inters.splice(t.getBindedInter().getIndex(),0,w),D.setOutToIn(O),t.setOutToIn(!O),D.isDealed(),n.inters.forEach((F,H)=>F.setIndex(H)),s.inters.forEach((F,H)=>F.setIndex(H)),2}else{let D=function(){let w=R.getBindedInter(),F=v.getBindedInter();delete R.isInvalid,delete w.isInvalid,delete v.isInvalid,delete F.isInvalid,R.setOutToIn(!O),v.setOutToIn(O),Pk(R,v,!0),Pk(v,R,!1),Pk(w,F,_),Pk(F,w,!_)};if(t.setIsInvalid(),_){if(e===1||e===0||e===2||e===3)return D(),2;throw new Error("not support")}else{if(e===1)return O?0:(D(),2);if(e===0||e===2||e===3)return O?(D(),2):0;throw new Error("not support")}}}}function Pk(o,t,e){let{judge:r,changeNum:i}=s(),n=o.getIndex();for(let a=n+i,l=o.side.inters;r(a);a+=i){if(l[a].isInvalid)continue;if(!kn(l[a].coord,o.coord))break;l[a].setIndex(n),l[n].setIndex(a);let c=l[a];l[a]=l[n],l[n]=c,n=a}function s(){let a=o.side===t.side;if(e){let l=a?t.getIndex():o.side.inters.length;return{judge:c=>c<l,changeNum:1}}else{let l=a?t.getIndex()+1:0;return{judge:c=>c>=l,changeNum:-1}}}}var l6e=0,jO=class{constructor(o,t,e){this.id=l6e++,this.coord=o,this.side=t,e&&(this.id=l6e++,this.drawDebug=e);let r=new L2;r.ext2(o),this._bbox=r.build1()}bbox(){return this._bbox}resetVisitStatus(){this.visited=!1,this.bindedInter.visited=!1}isDealed(){this.dealed=!0,this.getBindedInter().dealed=!0}setOutToIn(o){this.outToIn=o,this.bindedInter.outToIn=!o}setIsInvalid(){this.isInvalid=!0,this.getBindedInter().isInvalid=!0}getBindedInter(){return this.bindedInter}bind(o){this.bindedInter=o,o.bindedInter=this}setIndex(o){this.index=o}isSorted(){return this.index!==void 0}getIndex(){return this.index}getVisited(){return this.visited}visitSelf(){this.visited=!0}visit(){this.visited=!0,this.bindedInter.visited=!0}getPrevPoint(){let o=this.getIndex(),t=this.side.getStart();return o&&(t=this.side.inters[o-1].coord),t}getTangent(){let o=this.side.getShape();if(o instanceof Ct)return o.end().sub(o.start());if(o instanceof Ir){let t=this.coord.angle(o.center);return o.isCCW?t+=HQ:t-=HQ,new qt(Math.cos(t),Math.sin(t))}else{if(o instanceof en)return rz(o,o.getPercent(this.coord,uo));throw new Error("not support")}}findStartInter(){return this.outToIn===void 0?this.getTangent().cross(this.bindedInter.getTangent())>0?this:this.bindedInter:this.outToIn?this:this.bindedInter}run(){let o=[],t=this,e;if(this.drawDebug){ePe++;let r=ePe===-1,i=this.drawDebug.initColor(Wl.RED);if(r){this.drawDebug.draw();debugger}e=n=>{if(o.push(n),r){i.addPt(o[o.length-1]),this.drawDebug.draw();debugger}}}else e=r=>o.push(r);for(;!t.visited;){let r=function(a,l){if(Er.eq(a.distance2(l),0))return;let c=cz.rebuild(n.getShape(),a,l);if(!c)return!0;e(c)};t.visit();let i=t.getIndex(),n=t.side,s=n.inters[i+1];for(;s!=null&&s.isInvalid;)s=n.inters[s.getIndex()+1];if(s)r(t.coord,s.coord),t=s.bindedInter;else{let a=r(t.coord,n.getEnd()),l=t.coord;for(n=n.nextSide,t=null;;){for(let c of n.inters)if(!c.isInvalid){t=c.bindedInter;break}if(t)break;a?(r(l,n.getEnd()),a=!1):e(n.getShape()),n=n.nextSide}a?(Er.eq(l.distance2(t.coord),0)?r(l,n.getEnd()):r(l,t.coord),a=!1):Er.eq(n.getEnd().distance2(t.coord),0)?e(n.getShape()):r(n.getStart(),t.coord)}}if(t!==this)throw this.drawDebug&&console.log(JSON.stringify({runId:ePe,handleId:$Q,boolId:qW})),new Error("inter !== this");return jv(Ca.build7(o))}},ePe=0,tPe=class TPe{constructor(t,e,r,i,n){this.inters=[],this.allInterIsInvalid=!0,this.isVisit=!1,this.sides=t,this.isGroup1=r,this.isOutside=i,this.finalIsOutside=i,this.polyline=e,n&&(this.polygon=n),t.forEach(s=>s.outline=this)}static build(t,e,r,i,n){let s=t.primitives.map(l=>new cz(l,i)),a=s[s.length-1];return s.forEach(l=>{a.connect(l),a=l}),n?new TPe(s,t,e,r,n):new TPe(s,t,e,r)}setFinalIsOutSide(t){this.finalIsOutside=t}startAndEndIsSameOutsideFlag(){return this.isOutside===this.finalIsOutside}get hasInter(){return!!this.interOutlines}isAllInterIsInvalid(){return this.allInterIsInvalid}setAllInterIsInvalidToFalse(){this.allInterIsInvalid=!1}resetVisited(){this.isVisit=!1}intersect(t,e){if(!(t.interOutlines&&t.interOutlines===this.interOutlines))if(t.interOutlines)if(this.interOutlines){let r,i;this.interOutlines.length>t.interOutlines.length?(r=this.interOutlines,i=t.interOutlines):(r=t.interOutlines,i=this.interOutlines),i.forEach(n=>{r.push(n),n.interOutlines=r}),e.delete(i)}else t.interOutlines.push(this),this.interOutlines=t.interOutlines;else this.interOutlines?(this.interOutlines.push(t),t.interOutlines=this.interOutlines):(t.interOutlines=this.interOutlines=[this,t],e.add(this.interOutlines))}isContain(t){if(!this.polyline.bbox().extendOfSize(uo).isContainsBBox(t.polyline.bbox()))return!1;let e=t.polyline.primitives[0].start();if(t.hasInter&&t.isAllInterIsInvalid()){let r=t.inters[0];r.getBindedInter().side.outline!==this?e=r.side.getCenterPoint():e=r.side.getCenterPoint(r.coord)}return!!this.polyline.getWindingNum(e)}isInternally(t){return!!this.polyline.getWindingNum(t)}isEqual(t){return this.polyline===t.polyline}bbox(){return this.polyline.bbox()}reverse(){this.sides.reverse();let t=this.sides[this.sides.length-1];this.sides.forEach(e=>{e.reverse(),t.connect(e),t=e})}returnPolyline(){let t=this.sides.map(r=>r.getShape()),e=this.polyline.primitives;if(this.sides.length===e.length){let r=new Set(e);if(!t.some(i=>!r.has(i)))return this.polyline}return Ca.build7(t)}};function c6e(o,t,e){let r=[];return o.forEach(i=>i.forEach(n=>{if(n.hasInter&&!n.isAllInterIsInvalid())return;let s=n.bbox(),a=t.search(s.extendOfSize(uo)).filter(l=>l.bbox().extendOfSize(uo).isContainsBBox(s)).sort((l,c)=>l.bbox().area()-c.bbox().area());for(let l of a)if(l.isContain(n)){let c=e(!n.isOutside,l.isOutside),h=e(n.isOutside,l.isOutside);c!==h&&(r.push(n),n.setFinalIsOutSide(!c));return}e(n.isOutside,!1)!==e(!n.isOutside,!1)&&r.push(n)})),r}function omt(o,t,e){let r;switch(e){case 0:r=(a,l)=>a&&l;break;case 1:r=(a,l)=>a||l;break;case 2:r=(a,l)=>a&&!l;break;case 3:r=(a,l)=>a&&!l||!a&&l;break;default:throw Error("not support the rule")}let i=new iz(10),n=new iz(10);o.forEach(a=>a.forEach(l=>i.add(l))),t.forEach(a=>a.forEach(l=>n.add(l)));let s=c6e(o,n,r);return c6e(t,i,(a,l)=>r(l,a)).forEach(a=>s.push(a)),s}var smt=class{constructor(o){this.roots=[],this.nodes=o.sort((t,e)=>t.bbox().minX-e.bbox().minX).map(t=>new amt(t)),this.nodes.forEach((t,e)=>{t.visit()&&(this.roots.push(t),this.build(e))})}build(o){let t=this.nodes[o];for(let e=o+1,r=this.nodes.length;e<r;e++){let i=this.nodes[e];if(t.key.bbox().maxX<i.key.bbox().minX)break;i.getIsVisit()||t.isContain(i)&&(i.visit(),t.addChild(i),this.build(e))}}getPolygons(){let o=[];return this.roots.forEach(t=>t.getPolygons().forEach(e=>o.push(e))),o}},amt=class{constructor(o){this.children=[],this.isVisit=!1,this.key=o}getIsVisit(){return this.isVisit}isContain(o){return this.key.isContain(o.key)}addChild(o){this.children.push(o)}getPolygons(){let o=[];return this.getPolylineList(o),o.map(t=>{let e=t[0].polygon;if(e&&e.items.length===t.length){let r=t.map(n=>n.returnPolyline()),i=new Set(e.items);return r.some(n=>!i.has(n))?new Y0(r):e}else return new Y0(t.map(r=>r.returnPolyline()))})}getPolylineList(o,t){t?(t.push(this.key),t=null):(t=[this.key],o.push(t)),this.children.forEach(e=>e.getPolylineList(o,t))}visit(){return this.isVisit?!1:(this.isVisit=!0,!0)}};function h6e(o){let t="";return o.items.forEach((e,r)=>{let i="$";if(e.items.forEach((n,s)=>{let a="[";if(n.primitives.forEach((l,c)=>{let h="";if(l instanceof Ct)h=`Line,${l.start().x},${l.start().y},${l.end().x},${l.end().y}`;else if(l instanceof Ir)h=`Arc,${l.center.x},${l.center.y},${l.startAngle},${l.sweepAngle},${l.rx}`;else if(l instanceof en)h=`Bezier,${l.controls.map(u=>`${u.x},${u.y}`).join(",")}`;else throw new Error("not supported");if(c===n.primitives.length-1){a+=`${h}]`;return}a+=`${h},`}),s===e.items.length-1){i+=`${a}$`;return}i+=`${a}_`}),r===o.items.length-1){t+=`${i}`;return}t+=`${i}^`}),console.log(t),t}function u6e(o){let t=o.split("^"),e=[];return t.forEach(i=>{let n=/\$(.*?)\$/,s=i.match(n)[1].split("_"),a=[];s.forEach(c=>{let h=/\[(.*?)\]/,u=c.match(h)[1].split(","),d=[],p=[];for(let g=0;g<u.length;g++){let y=u[g];if(y==="Line"||y==="Arc"||y==="Bezier"){if(d.length){let b=r(d);p.push(b),d.length=0}d.push(y);continue}d.push(Number(y))}d.length&&(p.push(r(d)),d.length=0);let m=Ca.build7(p);a.push(m)});let l=new Y0(a);e.push(l)}),new dp(e);function r(i){let n=i[0];if(n==="Line")return new Ct(new qt(i[1],i[2]),new qt(i[3],i[4]));if(n==="Arc")return Ir.build3(new qt(i[1],i[2]),i[3],i[4],i[5],i[5]);if(n==="Bezier"){let s=[];for(let a=1;a<i.length;a+=2)s.push(new qt(i[a],i[a+1]));return new en(s)}else throw new Error("not support")}}var lmt=class{constructor(o=1){this.group1Str="$[Line,20193.777980000017,4122.200439600661,20193.77082,4211.848760073709,Arc,20193.972672902382,4211.8487570980205,179.99915535323618,-89.99540000050294,0.2018529024026465,Line,20193.972659672283,4212.050609999989,20193.972660393258,4212.039610000013,Arc,20193.97217289501,4211.848257065248,89.85403133887164,89.99540000041924,0.19135355574930143,Line,20193.78082,4211.848759926291,20193.78897999998,4122.200440479205,Line,20193.78897999998,4122.200440479205,20193.777980000017,4122.200439600661]$",this.group2Str="$[Arc,20209.72784128151,4122.2007625157785,258.46768032837986,-75.66780748375947,4.138846238512183,Line,20205.593935808283,4121.998590004101,20193.97982992629,4121.998600000001,Arc,20193.97983290198,4122.2004529023825,269.9991553532362,-89.99540000050297,0.20185290240401074,Arc,20193.782979999996,4122.20044,180.00375535340328,-180.0000000000027,0.004999999999025513,Arc,20193.979332869207,4122.200952909754,180.15347936671733,89.99540000008247,0.19135355575111057,Line,20193.97983008845,4122.009599999999,20205.603694309226,4122.003828485546,Arc,20209.733142304296,4122.194577876843,182.64475341258483,75.73379999998886,4.133851239977064,Line,20208.900400396684,4118.145470939558,20208.902599535475,4118.156248870184,Arc,20206.972515961093,4108.700057667588,78.46393309088245,-78.46759999998636,9.65115405866796,Arc,20216.618669999996,4108.69944,359.99996825446135,-180,0.004999999999200412,Arc,20206.973015966745,4108.699445349495,359.99996822365375,78.46759999998409,9.640654033253735]$^$[Line,20193.997796883676,4095.399470032799,20205.596133314026,4095.4013992171836,Arc,20209.72470159858,4095.1923799234505,177.10172964919312,-75.64935037184974,4.133855965730166,Arc,20209.73000213952,4095.198565517174,101.5415133143569,75.7293000000185,4.128850963459707,Line,20205.605834328744,4095.395161923586,20193.997203529463,4095.389485743675,Arc,20193.994588809255,4095.197684525904,89.21896662213764,4.544099999999517,0.19181903946188483,Arc,20193.981499796217,4095.1977402038,89.85034659953621,89.9999999995926,0.19135044893494071,Arc,20193.78515,4095.19824,0,-180,0.005,Arc,20193.98200016982,4095.1982398301675,179.99995179248322,-89.99999999974185,0.20185016982129908,Arc,20193.981986624152,4095.198185381971,89.9961078637802,-4.487285276547311,0.2019046184835962]$",this.rule=o}getGroup1(){return u6e(this.group1Str)}getGroup2(){return u6e(this.group2Str)}},rPe=new QQ(2),XW=class{getUnion(o,t=!0){return t&&(o=o.map(e=>this.asSameSweep([e])[0])),Yft(Aft,o)}asSameSweep(o){let t=0;return o.forEach(e=>t+=e.area(.01)),t>0?o.map(e=>e.reverse()):o}getSubtraction(o,t){let e=new ez(!1),r=new tz(NQ.rule,rPe,e);for(let i of o){let n=NQ.weight(0);r.addPolyline(i,n)}for(let i of t){let n=NQ.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}getIntersection(o,t){let e=new ez(!1),r=new tz(kQ.rule,rPe,e);for(let i of o){let n=kQ.weight(0);r.addPolyline(i,n)}for(let i of t){let n=kQ.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}getMutuallyExclusive(o,t){let e=new ez(!1),r=new tz($2e.rule,rPe,e);for(let i of o){let n=$2e.weight(0);r.addPolyline(i,n)}for(let i of t){let n=$2e.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}},qW=0,iPe=!1;function $W(o,t,e,r,i){let n=hz(),s=[],a=[],l=[],c=new Set,h;if(i){if(h=new lz(i),qW++,iPe){debugger;iPe=!1;let I=new lmt;$W(I.rule,I.getGroup1(),I.getGroup2(),r,i)}if(qW===-1||iPe){console.table({rule:o,group1:h6e(t),group2:h6e(e)}),h.clear();let I=h.initColor(Wl.GREEN),C=h.initColor(Wl.WHITE),E=h.initColor(Wl.BLUE),O=h.initColor(Wl.Gray);t.items.forEach(_=>_.items.forEach((R,v)=>{v>0?C.addPly(R):I.addPly(R)})),e.items.forEach(_=>_.items.forEach((R,v)=>{v>0?O.addPly(R):E.addPly(R)})),h.draw();debugger}}let u=t.items.length!==0&&e.items.length!==0?t.bbox().extendOfSize(uo).intersection1(e.bbox().extendOfSize(uo)):null;if(u){let I=[],C=[];switch(o){case 0:{for(let E of t.items)E.bbox().isIntersect(u)&&I.push(E);for(let E of e.items)E.bbox().isIntersect(u)&&C.push(E);break}case 1:case 3:{for(let E of t.items)E.bbox().isIntersect(u)?I.push(E):s.push(E);for(let E of e.items)E.bbox().isIntersect(u)?C.push(E):s.push(E);break}case 2:{for(let E of t.items)E.bbox().isIntersect(u)?I.push(E):s.push(E);for(let E of e.items)E.bbox().isIntersect(u)&&C.push(E);break}default:throw new Error("not support")}I.length!==t.items.length&&(t=new dp(I)),C.length!==e.items.length&&(e=new dp(C))}else{switch(o){case 0:break;case 1:case 3:{t.items.forEach(I=>s.push(I)),e.items.forEach(I=>s.push(I));break}case 2:{t.items.forEach(I=>s.push(I));break}default:throw new Error("not support")}t=new dp([]),e=new dp([])}P(t,a,!0),P(e,l,!1);let d=o===2||o===3?(I,C)=>kn(I.getEnd(),C)?I.nextSide:I:(I,C)=>kn(I.prevSide.getEnd(),C)?I.prevSide:I,p=(I,C,E)=>{if(kn(I.getEnd(),E)){if(I.inters.findIndex(O=>O.getBindedInter().side===C&&kn(O.coord,I.getEnd()))===-1)return new jO(E,I,h)}else return new jO(E,I,h)},m=o===2||o===3?(I,C,E)=>{if(kn(I.getStart(),E)){if(I.inters.findIndex(O=>O.getBindedInter().side===C&&kn(O.coord,I.getStart()))===-1)return new jO(E,I,h)}else return new jO(E,I,h)}:p;r.seek(t,e,(I,C,E,O,_,R)=>{let v=a[I][C],D=l[O][_],w=v.sides[E],F=D.sides[R],H=EI(w.getShape(),F.getShape());if((w.getShape()instanceof en||F.getShape()instanceof en)&&H>=4){if(w.getShape()instanceof Ir||F.getShape()instanceof Ir){let G=function(L,B){let N=!1;for(let U=0;U<B.length;U+=2)kn(new qt(B[U],B[U+1]),L)&&(N=!0);N||B.push(L.x,L.y)},W=[st[0],st[1]];for(let L=0;L<H;L+=2){let B=new qt(st[L],st[L+1]);for(let N=L+2;N<H;N+=2){let U=new qt(st[N],st[N+1]);if(!kn(B,U)){G(U,W);break}}}H=W.length,W.forEach((L,B)=>st[B]=L)}else for(let G=H-2;G>=2;G-=2)for(let W=G-2;W>=0;W-=2)if(kn(new qt(st[G],st[G+1]),new qt(st[W],st[W+1]))){st[W]=(st[G]+st[W])/2,st[W+1]=(st[G+1]+st[W+1])/2;for(let L=H-3;L>=G;L--)st[L]=st[L+2];H-=2;break}}let z=0;if(H===4){let G=function(B){return kn(w.getEnd(),B)||kn(w.prevSide.getEnd(),B)||kn(F.prevSide.getEnd(),B)||kn(F.getEnd(),B)},W=new qt(st[0],st[1]),L=()=>{let B=new jO(W,w,h),N=new jO(W,F,h);B.bind(N),B.setIsInvalid(),B.isDealed(),v.inters.push(B),D.inters.push(N)};if(st[0]===st[2]&&st[1]===st[3])if(G(W))z=2;else{L();return}}for(;z<H;z+=2){let G=new qt(st[z],st[z+1]),W=w,L=F;if(kn(W.prevSide.getEnd(),G)&&(W=W.prevSide),L=d(L,G),w!==W&&F!==L){let N=o===2||o===3?F.getEnd():L.getEnd();W.getEnd().distance1(G)<N.distance1(G)?(G=W.getEnd(),kn(N,G)||(L=F)):(G=N,kn(W.getEnd(),G)||(W=w))}let B=p(W,L,G);if(B){let N=m(L,W,G);N&&(W.addInter(B),v.inters.push(B),L.addInter(N),D.inters.push(N),B.bind(N),v.intersect(D,c))}}return H},i);let g=T(),y=omt(a,l,o);y.forEach(I=>!I.startAndEndIsSameOutsideFlag()&&I.reverse()),new smt(g.concat(y)).getPolygons().forEach(I=>s.push(I));let b=new dp(s);if(h){if(qW===-1){let I=h.initColor(Wl.RED),C=h.initColor(Wl.Golden);s.forEach(E=>{I.addPly(E.items[0]),E.items.slice(1).forEach(O=>C.addPly(O))}),h.draw();debugger;throw new Error}b.id=qW}return cE.BooleanTools+=Wv(n),b;function P(I,C,E){I.items.forEach(O=>{let _=[];_.push(tPe.build(O.items[0],E,!0,h,O)),O.items.slice(1).forEach(R=>{_.push(tPe.build(R,E,!1,h))}),C.push(_)})}function T(){let I=[];return c.forEach(E=>{o===2||o===3?E.forEach(_=>{_.isGroup1||_.reverse(),_.sides.forEach(R=>R.sortInters())}):E.forEach(_=>_.sides.forEach(R=>R.sortInters())),E.map(_=>_.sides.filter(R=>R.inters.length)).flat(2).sort((_,R)=>{let v=_.inters,D=R.inters,w=kn(v[v.length-1].coord,_.getEnd()),F=kn(D[D.length-1].coord,R.getEnd());if(w&&F){let H=0,z=0;for(let G=v.length-2;G>=0&&kn(v[G].coord,_.getEnd());G--)H++;for(let G=D.length-2;G>=0&&kn(D[G].coord,R.getEnd());G--)z++;return z-H}else return w?-1:1}).forEach(_=>{_.inters.forEach(R=>{if(R.dealed)return;let v=R.side,D=R.getBindedInter().side,w;kn(v.getEnd(),R.coord)&&kn(D.getEnd(),R.coord)?w=-1:kn(v.getEnd(),R.coord)?(w=1,R=R.getBindedInter()):kn(D.getEnd(),R.coord)&&(w=1);let F=nmt(w,R,o,h);R.isDealed(),F&&(v.outline.setAllInterIsInvalidToFalse(),D.outline.setAllInterIsInvalidToFalse())})}),O(E),o===3&&(E.forEach(_=>{_.reverse(),_.sides.forEach(R=>{R.sortInters(),R.inters.forEach(v=>{v.resetVisitStatus()})})}),O(E));function O(_){_.forEach(R=>{R.inters.forEach(v=>{if(v.isInvalid||v.getVisited())return;let D=v.findStartInter(),w=C(o)?D.run():D.getBindedInter().run(),F=R.polyline.primitives;if(w){if(F.length===w.primitives.length){let H=new Set(F);if(!w.primitives.some(z=>!H.has(z))){I.push(R);return}}I.push(tPe.build(w,!0,!0,h))}})})}}),I;function C(E){switch(E){case 0:case 2:case 3:return!0;case 1:return!1;default:throw Error("not support the rule")}}}}var RQ=/\bstablilizetion\b/.test(self.location.href)||!0,DQ={intersect(o,t,e,r){try{return $W(0,o,t,e,r)}catch(i){if(RQ){let n=new XW().getIntersection(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new dp(n.map(s=>new Y0(s.items)))}throw i}},union(o,t,e,r){try{return $W(1,o,t,e,r)}catch(i){if(RQ){let n=new XW,s=o.items.map(l=>l.items.map(c=>c)).flat(2);t.items.forEach(l=>l.items.forEach(c=>s.push(c)));let a=n.getUnion(s);return new dp(a.map(l=>new Y0(l.items)))}throw i}},diff(o,t,e,r){try{return $W(2,o,t,e,r)}catch(i){if(RQ){let n=new XW().getSubtraction(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new dp(n.map(s=>new Y0(s.items)))}throw i}},xor(o,t,e,r){try{return $W(3,o,t,e,r)}catch(i){if(RQ){let n=new XW().getMutuallyExclusive(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new dp(n.map(s=>new Y0(s.items)))}throw i}}},cmt=class extends tz{constructor(o,t,e,r,i,n){super(o.rule,QQ.DUMMY,t),this.sideGroup1=[],this.sideGroup2=[],this.group1=e,this.group2=r,this.seeker=i,this.addGroup(e,o.weight(0),this.sideGroup1),this.addGroup(r,o.weight(1),this.sideGroup2),this.bus=n}addGroup(o,t,e){if(!o)debugger;o.items.forEach(r=>{let i=[];r.items.forEach(n=>{let s=this.sides.length;this.addPolyline(n,t),i.push(this.sides.slice(s))}),e.push(i)})}seekIntersection(){this.seeker.seek(this.group1,this.group2,(o,t,e,r,i,n)=>{let s=this.sideGroup1[o][t][e],a=this.sideGroup2[r][i][n],l=EI(s.shape,a.shape);for(let c=0;c<l;c+=2){let h=new qt(st[c],st[c+1]);s.inters.push(h),a.inters.push(h),this.event.onIntersect(h,s,a)}return l},this.bus)}},hmt=class extends ez{constructor(o){super(!!o),o&&(this.drawDebug=new lz(o),this.blueDrawing=this.drawDebug.initColor(Wl.BLUE),this.greenDrawing=this.drawDebug.initColor(Wl.GREEN),this.redDrawing=this.drawDebug.initColor(Wl.RED))}onOriginSide(o){super.onOriginSide(o),this.debug&&this.blueDrawing.addPt(o.shape)}onPolylineGroup(o,t){super.onPolylineGroup(o,t),this.debug&&o.items.forEach(e=>this.greenDrawing.addPly(e))}draw(){this.drawDebug.draw()}};function nPe(o,t,e,r,i){let n=hz(),s=new hmt(i);new cmt(o,s,t,e,r,i).simplify();let a=[];s.plGrps.forEach(c=>{let h=c.items.map(u=>qQ(u));h[0]&&a.push(new Y0(h.filter(u=>u)))});let l=new dp(a);return cE.BooleanTools+=Wv(n),l}var oPe=!0,WW={intersect(o,t,e,r){try{return DQ.intersect(o,t,e,r)}catch(i){if(oPe)throw i;return console.error(i),nPe(kQ,o,t,e,r)}},union(o,t,e,r){try{return DQ.union(o,t,e,r)}catch(i){if(oPe)throw i;return console.error(i),nPe(_ft,o,t,e,r)}},diff(o,t,e,r){try{return DQ.diff(o,t,e,r)}catch(i){if(oPe)throw i;return console.error(i),nPe(NQ,o,t,e,r)}},xor(o,t,e,r){return DQ.xor(o,t,e,r)}},umt=class{init(o){}seek(o,t,e,r){let i=o.bbox().extendOfSize(5e-6).intersection1(t.bbox().extendOfSize(5e-6));if(!i)return;let n=hz(),s=[];for(let d=0,p=o.items.length;d<p;d++){let m=o.items[d];if(i.isIntersect(m.bbox()))for(let g=0,y=m.items.length;g<y;g++){let b=m.items[g];if(i.isIntersect(b.bbox()))for(let P=0,T=b.primitives.length;P<T;P++){let I=b.primitives[P].bbox();i.isIntersect(I)&&s.push({bbox:I,polygonIndex:d,polylineIndex:g,ptIndex:P})}}}let a=s.length;if(a===0){cE.IntersectionSeeker+=Wv(n);return}let l=[];for(let d=0,p=t.items.length;d<p;d++){let m=t.items[d];if(i.isIntersect(m.bbox()))for(let g=0,y=m.items.length;g<y;g++){let b=m.items[g];if(i.isIntersect(b.bbox()))for(let P=0,T=b.primitives.length;P<T;P++){let I=b.primitives[P].bbox();i.isIntersect(I)&&l.push({bbox:I,polygonIndex:d,polylineIndex:g,ptIndex:P})}}}let c=l.length;if(c===0){cE.IntersectionSeeker+=Wv(n);return}if(a<5||c<5){for(let d=0,p=s.length;d<p;d++)for(let m=0,g=l.length;m<g;m++)if(s[d].bbox.isIntersect(l[m].bbox.extendOfSize(1e-5))){let y=s[d],b=l[m];e(y.polygonIndex,y.polylineIndex,y.ptIndex,b.polygonIndex,b.polylineIndex,b.ptIndex)}cE.IntersectionSeeker+=Wv(n);return}s.sort((d,p)=>d.bbox.minX-p.bbox.minX),l.sort((d,p)=>d.bbox.minX-p.bbox.minX);let h=0,u=0;for(;h<a&&u<c;)if(s[h].bbox.minX<l[u].bbox.minX){let d=s[h],p=d.bbox;for(let m=u;m<c;m++){let g=l[m],y=g.bbox;if(y.minX>p.maxX+1e-5)break;(p.minY<y.minY?y.minY:p.minY)<(p.maxY<y.maxY?p.maxY:y.maxY)+1e-5&&e(d.polygonIndex,d.polylineIndex,d.ptIndex,g.polygonIndex,g.polylineIndex,g.ptIndex)}h++}else{let d=l[u],p=d.bbox;for(let m=h;m<a;m++){let g=s[m],y=g.bbox;if(y.minX>p.maxX+1e-5)break;(y.minY<p.minY?p.minY:y.minY)<(y.maxY<p.maxY?y.maxY:p.maxY)+1e-5&&e(g.polygonIndex,g.polylineIndex,g.ptIndex,d.polygonIndex,d.polylineIndex,d.ptIndex)}u++}cE.IntersectionSeeker+=Wv(n)}},_y,Og=(_y=class{static getDebug(){return _y.drawDebug||(_y.drawDebug=new lz(_y.curBus)),_y.drawDebug}static getDrawing(o=Wl.GREEN){return this.getDebug().initColor(o)}static clearDrawing(){_y.getDebug().clear()}static drawText(o,t,e=Wl.GREEN){_y.getDrawing(e).addText(o,t,1.5,.1,!0)}static drawBBox(o,t=Wl.GREEN){if(!o)return;let e=_y.getDrawing(t),r=new Ct(o.UL(),o.UR()),i=new Ct(o.UR(),o.LR()),n=new Ct(o.LR(),o.LL()),s=new Ct(o.LL(),o.UL());e.addPt(r),e.addPt(i),e.addPt(n),e.addPt(s)}static drawPolyType(o,t){let e=_y.getDrawing(t);if(o instanceof Ca)e.addPly(o);else if(o instanceof Y0)for(let r of o.items)r instanceof Ca?e.addPly(r):this.drawPolyType(r,t);else if(o instanceof dp)for(let r of o.items)this.drawPolyType(r,t)}static translate(o){switch(o){case 0:return"\u2229";case 2:return"-";case 1:return"U";case 3:return"X";default:break}}},_y.UseRunArrange=!0,_y.UseOptimizeSplit=!0,_y.LocalBestThread=4,_y.HandleDiff=!0,_y.OcTreeSplitStep=4,_y.PrintStart=new qt(150,-200),_y),zW=class IPe{static getPolyTypeLine(t){let e=[];if(t instanceof Ca)for(let r of t.primitives)e.push(r);else if(t instanceof Y0)for(let r of t.items)if(r instanceof Ca)for(let i of r.primitives)e.push(i);else{let i=this.getPolyTypeLine(r);for(let n of i)e.push(n)}else if(t instanceof dp)for(let r of t.items){let i=this.getPolyTypeLine(r);for(let n of i)e.push(n)}return e}static getPolyTypePolyLine(t){let e=[];if(t instanceof Ca)e.push(t);else if(t instanceof Y0)for(let r of t.items)if(r instanceof Ca)e.push(r);else{let i=this.getPolyTypePolyLine(r);for(let n of i)e.push(n)}else if(t instanceof dp)for(let r of t.items){let i=this.getPolyTypePolyLine(r);for(let n of i)e.push(n)}return e}static getListBBox(t){if(t.length<=0)return;let e=new L2;for(let r of t){let i=IPe.getSingleBBox(r);e.ext1(i)}return e.build1()}static getSingleBBox(t){if(t instanceof Array){let e=new L2,r=IPe.getListBBox(t.slice(1));return e.ext1(r),e.build1()}else return t.bbox()}static doDrawRule(t,e=Og.PrintStart){if(t.length<2)return[e,e,e];let r=5,i=10,n=t[0],s=Og.translate(n),a=[],l=e.y,c=e.x,h=e.x;e=e.add(new qt(0,-i));for(let p=1;p<t.length;p++){let m=t[p];if(m instanceof Array){e=e.add(new qt(r,0));let g=this.doDrawRule(m,e);a.push(g[0]),g[1].x<=c&&(c=g[1].x),g[2].x>=h&&(h=g[2].x),e=new qt(g[2].x+r,e.y)}else a.push(e.clone()),e.x<=c&&(c=e.x),e.x>=h&&(h=e.x),Og.drawText(e,m.name),e=e.add(new qt(r,0))}let u=0;for(let p of a)u+=p.x;let d=new qt(u/a.length,e.y+i);Og.drawText(d,"N:"+s);for(let p of a){let m=new Ct(p,d),g=new Array;g.push(m);let y=Ca.build1(dPe(g));Og.drawPolyType(y,Wl.GREEN)}return[d,new qt(c,l),new qt(h,l)]}static drawRule(t,e=Og.PrintStart,r=!1,i){Og.clearDrawing(),this.doDrawRule(t,e),r&&this.doDrawRulePolygon(t,i),Og.getDebug().draw()}static doDrawRulePolygon(t,e){let r=t[0];for(let i=1;i<t.length;i++){let n=t[i];if(n instanceof Array)this.doDrawRulePolygon(n,e);else{let s=e;r===2&&i===1&&(s=Wl.RED),n.name&&Og.drawText(n.bbox().UL(),n.name,s),Og.drawPolyType(n,s)}}}static IsCenterBBoxPointInPolygonType(t,e){let r=t.center();for(let i of e.items)if(i.getOutMostPolyline().getWindingNum(r))return!0;return!1}static KeepBBoxPolygonGroup(t,e){let r=e.bbox().intersection1(t);if(!r)return!1;for(let i of e.items)if(i.bbox().isIntersect(r)){for(let n of i.items)if(n.bbox().isIntersect(r)){for(let s of n.primitives)if(r.isIntersect(s.bbox()))return!0}}return!!this.IsCenterBBoxPointInPolygonType(t,e)}},dmt=class Ek{static createNode(t,e,r){let i=t.UL(),n=t.width()/e,s=t.height()/e,a=~~(r/e),l=r-a*e,c=i.x+l*n,h=i.y-(a+1)*s,u=c+n,d=h+s;return new C1(c,u,h,d)}static ocTreeSplitNode(t,e,r,i,n=2){if(t.length<=r)return t;let s=[],a=n**2,l=new Array(a),c=new Array(a);for(let p=0;p<a;p++)l[p]=new Array(t.length),c[p]=0;let h=e.UL(),u=e.width()/n,d=e.height()/n;for(let p of t){let m=i(p).center(),g=~~((m.x-h.x)/u),y=~~((h.y-m.y)/d)*n+g;try{l[y][c[y]]=p,c[y]+=1}catch{s.push(p)}}for(let p=0;p<l.length;p++){let m=c[p];if(m<=0)continue;let g=l[p].slice(0,m);if(g.length===t.length)return t;let y=Ek.createNode(e,n,p),b=Ek.ocTreeSplitNode(g,y,r,i,n);if(b.length===t.length)return t;s.push(b)}return s}static ocTreeSplitNodeMinIntersect(t,e,r,i){let n=[];if(t.length<=r)return t;let s=3,a=e.LL(),l=e.UR(),c=e.width()/(s+1),h=e.height()/(s+1),u=-(2**32),d=[],p=[];for(let m=1;m<=s;m++)for(let g=1;g<=s;g++){let y=a.x+c*m,b=a.y+h*g,P=[[],[],[],[]],T=new Array(4),I=new Array(4);I[0]=new C1(a.x,y,b,l.y),I[1]=new C1(y,l.x,b,l.y),I[2]=new C1(a.x,y,a.y,b),I[3]=new C1(y,l.x,a.y,b);for(let _ of t){let R=i(_).center(),v=-1,D=-1;R.x===y?v=Math.random()>=.5?1:-1:R.x>y?v=1:R.x<y&&(v=-1),R.y===b?D=Math.random()>=.5?1:-1:R.y>b?D=1:R.y<b&&(D=-1),v===1&&D===1?P[1].push(_):v===1&&D===-1?P[3].push(_):v===-1&&D===-1?P[2].push(_):v===-1&&D===1&&P[0].push(_)}for(let _=0;_<4;_++){let R=P[_];if(R.length<=0)continue;let v=new L2;for(let D of R)v.ext1(i(D));T[_]=v.build1()}let C=0,E=0;for(let _ of T)_&&(C+=_.area());E=C;let O=(_,R)=>{if(!T[_]||!T[R])return 0;let v=T[_].intersection1(T[R]);return v?v.area():0};E-=O(0,1),E-=O(0,2),E-=O(0,3),E-=O(1,2),E-=O(1,3),E-=O(2,3),E/C>=u&&(d=P,p=I)}for(let m=0;m<d.length;m++){let g=d[m];if(g.length<=0)continue;let y=p[m],b;if(g.length===t.length?b=Ek.ocTreeSplitNode(g,y,r,i):b=Ek.ocTreeSplitNodeMinIntersect(g,y,r,i),b.length===t.length)return t;n.push(b)}return n}static ocTreeSplit(t,e,r,i){return Ek.ocTreeSplitNode(t,e,r,i,Og.OcTreeSplitStep)}},pmt=class q6e{static simplifyRules(t,e){return Og.UseOptimizeSplit&&(t=this.optimizeSplit(t,e)),t}static OcTreeOptimizeSplit(t){let e=t[0];if(e!==1||t.length<=Og.LocalBestThread+1)return t;let r=t.slice(1),i=new Array(r.length);for(let c=1;c<t.length;c++)i[c-1]=c;let n=zW.getListBBox(r),s=dmt.ocTreeSplit(i,n,Og.LocalBestThread,c=>{let h=t[c];return zW.getSingleBBox(h)}),a=(c,h)=>{if(!(c.length<=0))for(let u of c)if(Array.isArray(u)){let d=[h[0]];a(u,d),h.push(d)}else{let d=t[u];h.push(d)}},l=[e];return a(s,l),l}static optimizeSplit(t,e){let r=t[0];if(r===2){if(Og.HandleDiff){let n=t[1],s;if(Array.isArray(n)){let a=this.optimizeSplit(n,e);if(a.length<=1)return[2];s=CPe(a,e)}else s=CPe([2,n],e);if(t.length>3){let a;a=[1];for(let l=2;l<t.length;l++){let c=t[l];if(Array.isArray(c)){let h=zW.getListBBox([...c.slice(1)]);zW.KeepBBoxPolygonGroup(h,s)&&a.push(c)}else zW.KeepBBoxPolygonGroup(c.bbox(),s)&&a.push(c)}return a.length<=1?[2,s]:(a=this.optimizeSplit(a,e),a.length>1?[2,s,...a.slice(1)]:[2,s])}else{let a=t[2];if(Array.isArray(a)&&a[0]===1&&a.length>2){let l=a.slice(1);return this.optimizeSplit([2,s,...l],e)}}}else if(t.slice(1).length>2){let n=t[1],s=t.slice(2),a=this.optimizeSplit([1,...s],e);return a.length>1?[2,n,...a.slice(1)]:n}}else if(r===1){if(t.length-1>Og.LocalBestThread){let n=!1;for(let s=1;s<t.length;s++){let a=t[s];if(!Array.isArray(a)){n=!0;break}}n&&(t=q6e.OcTreeOptimizeSplit(t))}}else if(r===0&&t.length<=2)return[0];let i=[r];for(let n=1;n<t.length;n++){let s=t[n];if(Array.isArray(s)){let a=this.optimizeSplit(s,e);if(a.length<=1)continue;i.push(a)}else i.push(s)}return i}},fmt=(o=>(o[o.INTERSECT=0]="INTERSECT",o[o.UNION=1]="UNION",o[o.DIFF=2]="DIFF",o[o.XOR=3]="XOR",o))(fmt||{});function KW(o){let t=o[0],e=[t];switch(t){case 0:for(let i=1;i<o.length;i++){let n=o[i];if(Array.isArray(n)&&(n=KW(n),!n))return null;e.push(n)}break;case 1:case 3:for(let i=1;i<o.length;i++){let n=o[i];Array.isArray(n)&&(n=KW(n),!n)||e.push(n)}break;case 2:let r=o[1];if(Array.isArray(r)&&(r=KW(r)),!r)return null;e.push(r);for(let i=2;i<o.length;i++){let n=o[i];Array.isArray(n)&&(n=KW(n),!n)||e.push(n)}break;default:throw new Error("not support boolean rule!")}return e.length===1?null:e}function sPe(o,t,e){return Array.isArray(o)?$6e(o,t,e):o}function aPe(o,t,e,r,i=!0){if(i)for(;o.length>1;){let n,s=[];for(o.length%2===1?(s.push(o[0]),n=1):n=0;n<o.length;n+=2)s.push(t(o[n],o[n+1],e,r));o=s}else for(;o.length>1;){if(o.length===2)return t(o[0],o[1],e,r);o=[t(o[0],o[1],e,r),...o.slice(2)]}return o[0]}function $6e(o,t,e,r=!0){let i=new Array(o.length-1);for(let n=1;n<o.length;n++)i[n-1]=sPe(o[n],t,e);switch(o[0]){case 0:return aPe(i,WW.intersect,t,e);case 1:return aPe(i,WW.union,t,e);case 2:let n=aPe(i.slice(1),WW.union,t,e);return n?WW.diff(i[0],n,t,e):i[0];case 3:let s=sPe(o[1],t,e);for(let a=2;a<o.length;a++)s=WW.xor(s,sPe(o[a],t,e),t,e);return s;default:throw new Error("not support boolean rule! "+o[0])}}function K6e(o){let t=[o[0]];for(let e=1;e<o.length;e++){let r=o[e];if(Array.isArray(r)){let i=K6e(r);Array.isArray(i)?i.length>1&&t.push(i):t.push(i)}else{let i=qQ(r);i!==null&&t.push(dp.build(i))}}return t}function mmt(o,t){Og.curBus=t,o=K6e(o);let e;return Og.UseRunArrange?e=pmt.simplifyRules(o,t):e=KW(o),e.length<=1?new dp([]):CPe(e,t)}function CPe(o,t,e=!0){if(!o||o.length===1)return new dp([]);let r=o,i=new umt,n=[];function s(a){for(let l=1;l<a.length;l++){let c=a[l];Array.isArray(c)?s(c):n.push(c)}}return s(r),i.init(n),$6e(r,i,t,e)}var wQ=new Error("list is empty"),LQ=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},gmt=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},ymt=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},bmt=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw wQ;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw wQ;return this.remove(o),o.item}addLast(o){if(this.first===null||this.last===null){let t=new LQ(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new LQ(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw wQ;return this.first.item}getLast(){if(this.last===null)throw wQ;return this.last.item}insertAfter(o,t){let e=new LQ(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new LQ(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new gmt(this.first)}listIterator(){return new ymt(this.first)}toArray(){let o=new Array,t=this.first;for(;t!=null;)o.push(t.item),t=t.next;return o}},FQ=class{constructor(o){this.inters=[],o&&(this.inters=o)}addInter(o){this.inters.push(o),o.group=this}findInter(o){let t=this.inters.find(e=>kn(e.coord,o.coord));return t&&this.inters.find(e=>e.side===o.side)&&o.visitSelf(),t}getOutInter(o){let t=this.inters.filter(e=>!e.getVisited());if(t.length!==0)return t.length===1?t[0]:t.reduce((e,r)=>{if(!e||e.side.getShape()===o)return r;if(r.side.getShape()===o)return e;let i=e.coord,n=ho(o,i),s=ho(e.side.getShape(),i),a=ho(r.side.getShape(),i);return n.dot(s)>n.dot(a)?e:r},void 0)}getEntryInter(){}},lPe=0;function Z6e(o,t){let e=o.primitives[0];if(o.primitives.length===1&&e instanceof Ir&&Math.abs(e.sweepAngle)===360)return[o];let r=hz();lPe++;let i,n=_mt(o);if(n.length===0)return[];let s=Imt(n);if(lPe===-1){i=new lz(t);let h=i.initColor(Wl.BLUE);n.forEach(d=>h.addPt(d.getShape()));let u=i.initColor(Wl.GREEN);s.forEach(d=>u.addPoint(d.coord)),i.draw();debugger;throw new Error}if(s.length===0)return[Ca.build7(n.map(h=>h.getShape()))];Cmt(s);let a=[],l=!1;try{Omt(s,i)}catch(h){h.customType==="IS_OVERLAP"?(l=!0,a=new XW().getUnion([o]).map(u=>u.items).flat(2)):console.error(h)}if(l)return a;let c=Emt(s);if(!c.length)return[Ca.build7(n.map(h=>h.getShape()))];if(a=Pmt(c,i),a.length===0)return console.warn("=====deSelfIntersection=====",lPe),[];if(i)throw a.forEach(h=>{i.initColor(Wl.WHITE).addPly(h),i.draw();debugger}),new Error;return cE.deSelfIntersection+=Wv(r),a}function Pmt(o,t){let e=[];return o.forEach(r=>{let i=r;r.inters.forEach(n=>{if(n.getVisited())return;let s=[],a=[],l;if(t){debugger;let h=t.initColor(Wl.RED);l=u=>{s.push(u),h.addPt(s[s.length-1]),t.draw();debugger}}else l=h=>s.push(h);do{let h=function(g,y){Er.eq(g.distance2(y),0)||l(J6e(p.getShape(),g,y))},u=a.findIndex(g=>g===n.group);if(u!==-1){let g=s.findIndex(P=>P===n.group),y=s.splice(g).filter(P=>!(P instanceof FQ));if(y.length){let P=jv(Ca.build7(y));P&&e.push(P)}let b=s.filter(P=>!(P instanceof FQ));if(n=a[u].getOutInter(b[b.length-1]),a.splice(u),!n)throw Error("interGroup not hav inter!!!2");continue}n.visitSelf(),a.push(n.group),s.push(n.group);let d=n.getIndex(),p=n.side,m=p.inters[d+1];for(;m!=null&&m.isInvalid||m&&m.group===n.group;)m=p.inters[m.getIndex()+1];if(m){h(n.coord,m.coord);let g=m.getBindedInter();if(n=g.getVisited()?g.group.getOutInter(g.side.getShape()):g,!n){if(m.group===i)break;throw new Error("interGroup not hav inter!!!3")}}else{for(h(n.coord,p.getEnd()),p=p.nextSide,n=null;;){for(let g of p.inters)if(!g.isInvalid){let y=g.group.getOutInter(p.getShape());if(!y){if(g.group===i){n=g;break}else if(g.getBindedInter().group===i){n=g.getBindedInter();break}continue}n=y;break}if(n)break;l(p.getShape()),p=p.nextSide}Er.eq(p.getEnd().distance2(n.coord),0)?l(p.getShape()):h(p.getStart(),n.coord)}}while(n.group!==i);let c=jv(Ca.build7(s.filter(h=>!(h instanceof FQ))));c&&e.push(c)})}),e}function Tmt(o){return{next(){return o.hasNext()?{value:o.next()}:{done:!0,value:void 0}},[Symbol.iterator](){return this}}}function Imt(o){let t=[],e=new bmt;for(let r of o.slice().sort((i,n)=>i.bbox().minY-n.bbox().minY)){for(let i of Tmt(e.listIterator())){let n=i.item;if(n.bbox().maxY<r.bbox().minY)e.remove(i);else{let s=function(d,p){let m=new jO(p,d,null);return d.inters.push(m),t.push(m),m},a=function(d,p){let m=d.getEnd(),g=new qt(st[0],st[1]),y=new qt(st[2],st[3]),b=m.distance2(g)>m.distance2(y)?g:y,P=d.prevSide;s(kn(P.getEnd(),b)?P:d,b).bind(s(p,b))},l=n.getShape(),c=r.getShape(),h=EI(l,c),u=h===4&&st[0]===st[2]&&st[1]===st[3];if(u&&(h-=2),n.nextSide===r)n.prevSide!==r&&h===4&&a(n,r);else if(n.prevSide===r)h===4&&a(r,n);else if(h!==0){let d=function(m,g){let y=m.prevSide;return s(kn(y.getEnd(),g)?y:m,g)},p=new qt(st[0],st[1]);if(u&&!kn(p,n.prevSide.getEnd())&&!kn(p,r.prevSide.getEnd())&&ho(l,p).dot(ho(c,p))>0)continue;for(let m=0;m<h;m+=2){let g=new qt(st[m],st[m+1]);d(n,g).bind(d(r,g))}}}}e.add(r)}return t.forEach(r=>{r.getIndex()===void 0&&r.side.sortInters()}),t}function Cmt(o){o.forEach(t=>{let e=t.side.getEnd();if(t.isInvalid||!kn(t.coord,e))return;let r=t.side.inters,i=t.getBindedInter().side;for(let n=r.length-1;n>=0;n--){let s=r[n];if(!kn(s.coord,e))break;s!==t&&s.getBindedInter().side===i&&s.setIsInvalid()}})}function Smt(o){let t=new iz(10);return o.forEach(e=>{e.isInvalid||t.add(e)}),t}function Emt(o){let t=[],e=Smt(o);return o.forEach(r=>{if(r.isInvalid||r.group)return;let i=e.search(r.bbox().extendOfSize(Er.eps)).filter(n=>!n.group);if(i.length){let n=new Set,s=new FQ(i);i.forEach(a=>{a.group=s,n.has(a.side)&&a.visitSelf(),n.add(a.side)}),t.push(s)}}),t}function Omt(o,t){o.forEach(e=>{if(e.isInvalid||e.dealed)return;let r=e.side,i=e.getBindedInter().side,n;kn(r.getEnd(),e.coord)&&kn(i.getEnd(),e.coord)?n=-1:kn(r.getEnd(),e.coord)?r.nextSide!==i&&(n=1,e=e.getBindedInter()):kn(i.getEnd(),e.coord)&&i.nextSide!==r&&(n=1),Amt(n,e,t),e.isDealed()})}function Amt(o,t,e){let r=t.getBindedInter(),i=t.side,n=r.side,s=i.getShape(),a=n.getShape(),l=1,c=!1;if(o===-1){if(yk(s.reverse(),a.reverse())||yk(i.nextSide.getShape(),n.nextSide.getShape())){let u=zO(i,i.nextSide,n,r,l,c,e);if(u.state===2){let p=new Error("info1.state === InState.IS_OVERLAP");throw p.customType="IS_OVERLAP",p}let d=zO(i,i.nextSide,n.nextSide,r,l,c,e);u.state===d.state&&h(u,d)}else if(!(yk(s.reverse(),n.nextSide.getShape())||yk(i.nextSide.getShape(),a.reverse()))){let u=Q2e(i,i.nextSide,n,!1,e);u===Q2e(i,i.nextSide,n.nextSide,!0,e)&&u!==Q2e(n,n.nextSide,i.nextSide,!0,e)&&t.setIsInvalid()}}else if(o===1){let u=function(d,p){return ho(d,p.start()).dot(ho(p,p.start()))>0};if(yk(s.reverse(),a.reverse())||yk(s,n.nextSide.getShape())){let d=ZP(i,n,r,e,l,c,new Map);if(d.state===2){let m=new Error("info1.state === InState.IS_OVERLAP");throw m.customType="IS_OVERLAP",m}let p=ZP(i,n.nextSide,r,e,l,c,new Map);d.state===p.state&&h(d,p)}else if(u(s.reverse(),a.reverse())&&u(s,n.nextSide.getShape())){let d=om(i,n,!1,e);d===om(i,n.nextSide,!0,e)&&d!==XL(n,n.nextSide,new cz(J6e(s,t.coord,s.end()),e),!0,e)&&t.setIsInvalid()}}function h(u,d){u.inter.setIsInvalid(),d.inter.setIsInvalid(),t.setIsInvalid()}}function J6e(o,t,e){if(o instanceof Ct||t.distance2(e)<1e-6)return new Ct(t,e);if(o instanceof Ir)return Ir.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.sweep());if(o instanceof en){let r=o.getPercent(t,uo),i=o.getPercent(e,uo);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function _mt(o){let t=jv(o);if(!t)return[];let e=t.primitives.map(i=>new cz(i,null)),r=e[e.length-1];return e.forEach(i=>{r.connect(i),r=i}),e}var Tk,vmt=(Tk=class{static clearData(o){this.originalPrimitive=[],this.offsetPrimitive=[],this.rawOffsetPrimitive=[],this.offsetDistance=0,this.testI++,this.testI===0?this.drawDebug=new lz(o):delete this.drawDebug}static createRawOffsetEdge(){if(this.drawDebug){let o=this.drawDebug.initColor(Wl.WHITE);this.originalPrimitive.forEach(t=>o.addPt(t)),this.drawDebug.draw();debugger}for(let o=0;o<this.originalPrimitive.length;o+=1){let t=this.originalPrimitive[o];this.offsetPrimitive.push({index:o,offsetEdge:this.createOffsetEdge(t)})}if(this.drawDebug){let o=this.drawDebug.initColor(Wl.Golden);this.offsetPrimitive.forEach(t=>o.addPt(t.offsetEdge)),this.drawDebug.draw();debugger}if(this.offsetPrimitive.length>1)for(let o=0;o<this.offsetPrimitive.length;o+=1)if(o===this.offsetPrimitive.length-1){this.connectPrimitive(this.offsetPrimitive[o],this.offsetPrimitive[0]);let t=this.rawOffsetPrimitive[0],e;t instanceof Ir?e=Ir.build4(this.offsetPrimitive[0].offsetEdge.start(),t.end(),t.center,t.rx,t.ry,t.sweep()):e=new Ct(this.offsetPrimitive[0].offsetEdge.start(),t.end()),this.rawOffsetPrimitive.shift(),this.rawOffsetPrimitive.unshift(e)}else this.connectPrimitive(this.offsetPrimitive[o],this.offsetPrimitive[o+1]);else this.rawOffsetPrimitive=[]}static createCirclePrimitive(o,t){let e=o.width()*.5,r=o.height()*.5,i=Math.sqrt(e**2+r**2)+t;return[Ir.buildCircle(o.center(),i)]}static getExtendPolyLine(o,t,e=!0,r){var i,n;if(!((i=o==null?void 0:o.primitives)!=null&&i.length))return[];let s=jv(o);if(!((n=s==null?void 0:s.primitives)!=null&&n.length)){if(this.isExpansion){let l=[1],c=t*2;o.primitives.forEach(u=>l.push(u.stroke(c,1,0)));let h=mmt(l,r);if(h.items.length!==1)throw new Error("group.items.length !== 1 ");return[h.items[0].items[0]]}return[]}if(o=s,this.clearData(r),this.originalPrimitive=o.primitives,this.isExpansion=t>0,this.offsetDistance=t,this.createRawOffsetEdge(),this.drawDebug){let l=this.drawDebug.initColor(Wl.BLUE);this.rawOffsetPrimitive.forEach(c=>l.addPt(c)),this.drawDebug.draw();debugger}let a=e?this.createClippingEdge(r):[Ca.build2(this.rawOffsetPrimitive)];if(this.drawDebug){let l=this.drawDebug.initColor(Wl.RED);a.forEach(c=>l.addPly(c)),this.drawDebug.draw();debugger}if(a.length&&(!this.isExpansion||this.isExpansion&&a.length>1)&&(a=this.getValidityPrimitive(a)),this.drawDebug){let l=this.drawDebug.initColor(Wl.GREEN);a.forEach(c=>l.addPly(c)),this.drawDebug.draw();debugger;throw new Error}return a}static getValidityPrimitive(o){let t=[],e=Math.abs(this.offsetDistance);for(let r=0;r<o.length;r+=1){let i=!0,n=o[r].primitives;e:for(let s=0;s<n.length;s+=1){let a=n[s],l;if(a instanceof Ir)l=a.midPoint;else if(a instanceof Ct)l=a.start();else throw new Error("not support!");for(let c=0;c<this.originalPrimitive.length;c+=1){let h=this.originalPrimitive[c],u;if(h instanceof Ir?u=this.pointArcClosest(l,h):u=cft(l,h.start(),h.end()).d,e-u>.01){i=!1;break e}}}i&&t.push(o[r])}return t}static getInters(o){let t=[];for(let e=0;e<o;e+=2)t.push(new qt(st[e],st[e+1]));return t}static pointArcClosest(o,t){let e=t.center;if(o.equals1(t.center))return t.rx;if(t.inArea(o,0)){let n=o.sub(e);return Math.abs(n.length()-t.rx)}let r=o.distance2(t.start()),i=o.distance2(t.end());return Er.less(r,i)?Math.sqrt(r):Math.sqrt(i)}static createClippingEdge(o){let t=[],e=[],r=Z6e(Ca.build2(this.rawOffsetPrimitive),o);r.forEach(n=>{let s=n.area(.01);t.push(s)});let i=Math.min(...t.filter(n=>n<0));for(let n=0;n<t.length;n+=1){let s=t[n];Er.eq(s,0)||(!this.isExpansion&&s<0||this.isExpansion&&(s<0&&t[n]===i||s>0))&&e.push(r[n])}return e}static createOffsetEdge(o){if(o instanceof Ir)return o.panDistance1(this.offsetDistance);if(o instanceof Ct)return o.panDistance(this.offsetDistance);throw new Error("not support!")}static connectPrimitive(o,t){o.offsetEdge instanceof Ct&&t.offsetEdge instanceof Ct?this.lineToLineConnect(o,t):o.offsetEdge instanceof Ir&&t.offsetEdge instanceof Ir?this.arcToArcConnect(o,t):o.offsetEdge instanceof Ct&&t.offsetEdge instanceof Ir?this.lineToArcConnect(o,t):this.arcToLineConnect(o,t)}static isFalseIntersection(o){return o>1||o<0}static lineToLineConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=t.index,n=this.originalPrimitive[i].start();if(e.isParallel(r))e.bbox().intersection1(r.bbox())?this.rawOffsetPrimitive.push(e):this.lineToLineUseArcToConnect(n,e,r);else{let s=this.getLineToLineT(e,r),a=s[0],l=s[1];if(this.isFalseIntersection(a)||this.isFalseIntersection(l))a>1&&this.isFalseIntersection(l)?this.lineToLineUseArcToConnect(n,e,r):this.useLineToConnect(e,r);else if(!this.isFalseIntersection(a)&&!this.isFalseIntersection(l)){let c=e.end().sub(e.start()),h=e.start().add(c.mul(a)),u=new Ct(e.start(),h);this.rawOffsetPrimitive.push(u);let d=new Ct(h,r.end());this.updateNextOffsetPrimitive(i,d)}}}static updateNextOffsetPrimitive(o,t){this.offsetPrimitive[o].offsetEdge=t}static useLineToConnect(o,t){this.rawOffsetPrimitive.push(o);let e=new Ct(o.end(),t.start());this.rawOffsetPrimitive.push(e)}static lineToLineUseArcToConnect(o,t,e){let r=this.getSweep(o,t),i=this.getSweepAngel(t.end(),e.start(),o,r);if(i===0){this.useLineToConnect(t,e);return}this.rawOffsetPrimitive.push(t);let n=Ir.build5(t.end(),e.start(),i);this.rawOffsetPrimitive.push(n)}static getSweep(o,t,e){let r=null,i=e||e===0?this.originalPrimitive[e]:t;if(i instanceof Ir){let n=i.center.sub(i.end()).normalize();i.isCCW?r=new qt(n.y,-n.x):r=new qt(-n.y,n.x)}else r=t.end().sub(t.start()).normalize();return o.sub(t.end()).normalize().cross(r)>0?0:1}static getLineToLineT(o,t){let e=o.end().sub(o.start()),r=t.end().sub(t.start()),i=e.cross(r),n=t.start().sub(o.start()),s=o.start().sub(t.start()),a=n.cross(r)/i,l=s.cross(e)/-i;return[a,l]}static lineToArcConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.getLineJoinArcScalarAndIntersectionNum(e,r),a=this.originalPrimitive[n].start();if(s.intersectionNum===0)this.lineAndArcUseArcConnect(a,e,r,i);else if(s.intersectionNum===1){let l=s.points[0];this.lineAndArcConnectionDetail(e,r,s.t[0],l,a,i,n)}else if(s.intersectionNum===2){let l=s.points[0],c=s.points[1],h=l.distance2(a),u=c.distance2(a);this.lineAndArcConnectionDetail(e,r,h<u?s.t[0]:s.t[1],h<u?l:c,a,i,n)}}static lineAndArcConnectionDetail(o,t,e,r,i,n,s){let a=this.isTrueArcIntersection(t,r);if(!this.isFalseIntersection(e)&&a){let l=new Ct(o.start(),r);this.rawOffsetPrimitive.push(l);let c;!t.center.equals1(r)||t.sweepAngle>1e-4?(c=Ir.build4(r,t.end(),t.center,t.rx,t.ry,t.sweep()),c instanceof Ir&&c.sweepAngle===0&&(c=new Ct(c.start(),c.end()))):c=new Ct(t.center,r),this.updateNextOffsetPrimitive(s,c)}else a?this.useLineToConnect(o,t):this.lineAndArcUseArcConnect(i,o,t,n)}static lineAndArcUseArcConnect(o,t,e,r){let i=this.getSweep(o,t,r),n=this.getSweepAngel(t.end(),e.start(),o,i);if(n===0){this.useLineToConnect(t,e);return}let s=Ir.build5(t.end(),e.start(),n);this.rawOffsetPrimitive.push(t),this.rawOffsetPrimitive.push(s)}static arcToLineConnectionDetail(o,t,e,r,i,n,s){let a=this.isTrueArcIntersection(o,r);if(!this.isFalseIntersection(e)&&a){let l;o.center.equals1(r)?l=new Ct(o.center,r):Math.abs(o.sweepAngle)<1e-4?l=new Ct(o.start(),r):(l=Ir.build4(o.start(),r,o.center,o.rx,o.ry,o.sweep()),l instanceof Ir&&l.sweepAngle===0&&(l=new Ct(l.start(),l.end()))),this.rawOffsetPrimitive.push(l);let c=new Ct(r,t.end());this.updateNextOffsetPrimitive(s,c)}else a?this.useLineToConnect(o,t):this.lineAndArcUseArcConnect(i,o,t,n)}static isTrueArcIntersection(o,t){return zp(o,t)}static getSweepAngel(o,t,e,r){let i=o.angleD(e),n=t.angleD(e),s;return i===n?s=0:(i=Qo.regularD(i),n=Qo.regularD(n),r===1?n<=i&&(n+=360):n>=i&&(i+=360),s=n-i),s}static getLineJoinArcScalarAndIntersectionNum(o,t){let e={t:[],intersectionNum:0,points:[]},r=sft(t,o);if(r){e.intersectionNum=r/2;for(let i=0;i<r-1;i+=2){let n=new qt(st[i],st[i+1]);e.points.push(n),n.sub(o.start()).x<1e-4||n.sub(o.start()).y<1e-4?e.t.push(0):e.t.push(n.sub(o.start()).x/o.end().sub(o.start()).x)}}else e.intersectionNum=0;return e}static arcToLineConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.getLineJoinArcScalarAndIntersectionNum(r,e),a=this.originalPrimitive[n].start();if(s.intersectionNum===0)this.lineAndArcUseArcConnect(a,e,r,i);else if(s.intersectionNum===1){let l=s.points[0];this.arcToLineConnectionDetail(e,r,s.t[0],l,a,i,n)}else if(s.intersectionNum===2){let l=s.points[0],c=s.points[1],h=l.distance2(a),u=c.distance2(a);this.arcToLineConnectionDetail(e,r,h<u?s.t[0]:s.t[1],h<u?l:c,a,i,n)}}static rxChangeStatus(o){return o===1?!this.isExpansion:this.isExpansion}static arcToArcConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=D6e(e,r);if(i){let n=this.getInters(i),s;if(n.length===2){let c=this.originalPrimitive[t.index].start(),h=n[0],u=n[1],d=h.distance2(c),p=u.distance2(c);d<p?s=h:s=u}else s=n[0];let a,l;s.equals1(e.center)?a=new Ct(e.center,s):Math.abs(e.sweepAngle)<1e-4?a=new Ct(e.start(),s):(a=Ir.build4(e.start(),s,e.center,e.rx,e.ry,e.sweep()),a instanceof Ir&&a.sweepAngle===0&&(a=new Ct(a.start(),a.end()))),this.rawOffsetPrimitive.push(a),s.equals1(r.center)?l=new Ct(s,r.center):Math.abs(r.sweepAngle)<1e-4?l=new Ct(s,r.end()):(l=Ir.build4(s,r.end(),r.center,r.rx,r.ry,r.sweep()),l instanceof Ir&&l.sweepAngle===0&&(l=new Ct(l.start(),l.end()))),this.updateNextOffsetPrimitive(t.index,l)}else{let n=this.originalPrimitive[o.index],s=this.originalPrimitive[t.index],a=this.rxChangeStatus(n.sweep()),l=this.rxChangeStatus(s.sweep()),c=this.originalPrimitive[t.index].start(),h=this.getSweep(c,e,o.index),u=Math.abs(this.offsetDistance),d=Ir.build2(c,a?n.endAngle():n.endAngle()+180,l?s.startAngle:s.startAngle+180,u,u,h);this.rawOffsetPrimitive.push(e),this.rawOffsetPrimitive.push(d)}}},Tk.originalPrimitive=[],Tk.offsetPrimitive=[],Tk.rawOffsetPrimitive=[],Tk.testI=0,Tk),xmt=class ZW extends sz{constructor(t,e,r,i,n,s){if(super(),e<0||r<0)throw new Error("The width and height of rect can't be less than 0!");this.leftUpPoint=t,this.width=e,this.height=r,this.angle=i,this.isCCW=n,this.radius=Math.min(Math.max(s,0),e/2,r/2)}get radiusRatio(){return this.radius/Math.min(this.width,this.height)}start(){return this.leftUpPoint.add(new qt(this.radius,0).multiply3(y0.rotateD(this.angle)))}end(){return this.start()}getLeftPoint(){return this.leftUpPoint.add(new qt(0,-this.height/2).multiply3(y0.rotateD(this.angle)))}getRightPoint(){return this.leftUpPoint.add(new qt(this.width,-this.height/2).multiply3(y0.rotateD(this.angle)))}extend(t){return new ZW(this.leftUpPoint.add(new qt(-t,t).rotateD(qt.ORIGIN,this.angle)),this.width+t*2,this.height+t*2,this.angle,this.isCCW,this.radius+t)}bbox(){let t=y0.rotateD(this.angle),{leftUpPoint:e,width:r,height:i,radius:n}=this,s=e.add(new qt(n,-n).multiply3(t)),a=e.add(new qt(n,n-i).multiply3(t)),l=e.add(new qt(r-n,-n).multiply3(t)),c=e.add(new qt(r-n,n-i).multiply3(t));return new C1(Math.min(s.x,a.x,l.x,c.x)-n,Math.max(s.x,a.x,l.x,c.x)+n,Math.min(s.y,a.y,l.y,c.y)-n,Math.max(s.y,a.y,l.y,c.y)+n)}toPolyline(){let t=[],{leftUpPoint:e,width:r,height:i,radius:n}=this;if(n===0){let a=qt.ORIGIN,l=new qt(r,0),c=new qt(r,-i),h=new qt(0,-i);t.push(new Ct(a,l),new Ct(l,c),new Ct(c,h),new Ct(h,a))}else{let a=new qt(0,-n),l=new qt(n,0),c=new qt(r-n,0),h=new qt(r,-n),u=new qt(r,n-i),d=new qt(r-n,-i),p=new qt(n,-i),m=new qt(0,n-i);t.push(Ir.build1(a,l,n,n,!1,0),new Ct(l,c),Ir.build1(c,h,n,n,!1,0),new Ct(h,u),Ir.build1(u,d,n,n,!1,0),new Ct(d,p),Ir.build1(p,m,n,n,!1,0),new Ct(m,a))}t=t.filter(a=>!a.start().equals1(a.end())),this.isCCW&&(t.forEach((a,l)=>t[l]=a.reverse()),t.reverse());let s=y0.rotateD(this.angle).translate1(e);return Ca.build2(t.map(a=>a.multiply3(s)))}center(){return this.leftUpPoint.add1(this.width/2,this.height/2).rotateD(this.leftUpPoint,this.angle)}multiply3(t){let e=this.leftUpPoint.multiply3(t),r=new qt(this.width,0).multiply3(y0.rotateD(this.angle)).multiply3(t),i=new qt(0,-this.height).multiply3(y0.rotateD(this.angle)).multiply3(t);return t.isMirrored()?new ZW(e,i.length(),r.length(),i.angleD(qt.ORIGIN),this.isCCW===1?0:1,this.radius*r.length()/this.width):new ZW(e,r.length(),i.length(),r.angleD(qt.ORIGIN),this.isCCW,this.radius*r.length()/this.width)}reverse(){return new ZW(this.leftUpPoint,this.width,this.height,this.angle,this.isCCW===1?0:1,this.radius)}stroke(t,e,r){let i=this.stroke1(t,e,r);if(i.length===1)return i[0];{let[n,s]=i;return Ca.build2(n.primitives.concat(new Ct(n.primitives[0].start(),s.primitives[0].start()),s.primitives,new Ct(s.primitives[0].start(),n.primitives[0].start())))}}stroke1(t,e,r){let i=r===this.isCCW?this:this.reverse(),n=t/2,s=Math.min(i.width,i.height)/2,a=i.extend(n).toPolyline();return s<=n?[a]:[a,i.extend(-n).toPolyline().reverse()]}points(t){let e=this.toPolyline(),r=[];return e.points(t,i=>r.push(i)),r}toBezier(){throw new Error("Method not implemented.")}},Rmt=.01,Y0=class IS{static simplify(t){return t=jv(t),t?new IS([t]):null}static buildByStroke(t,e,r=1,i=wPe,n){if(t instanceof Ir&&(t.rx<e/2+Rmt||Math.abs(t.sweepAngle)>180&&Er.lesseq(t.start().distance1(t.end()),e))){let a=Z6e(t.stroke(e,r,0),n);if(a.length===0)return null;if(a.length===1)return new IS(a);let l=[null],c=Number.POSITIVE_INFINITY;return a.forEach(h=>{let u=h.area(.1);u<0?u<c&&(l[0]=h,c=u):l.push(h)}),new IS(l)}else if(t instanceof xmt){let a=t.stroke1(e,r,0).map(l=>jv(l));return a[0]?a[1]?new IS(a):new IS([a[0]]):null}let s=t.stroke(e,r,0,i);return s?this.simplify(s):null}static buildCircle(t,e){return this.simplify(Ca.build7([Ir.buildCircle(t,e,0)]))}static buildRect(t){return this.simplify(t.toPolyline())}static buildBBox(t){return this.simplify(Ca.buildBBox(t,0))}constructor(t){this.items=t.slice()}multiply3(t){return new IS(this.items.map(e=>e.multiply3(t)))}bbox(){return this.items[0].bbox()}isEqual(t){return t instanceof IS?this.items.every(e=>t.items.some(r=>r.isEqual(e))):!1}getOutMostPolyline(){return this.items[0]}extend(t,e){if(this.items.length!==1)throw new Error("this.items.length !== 1");if(t===0)return new dp([this]);let r=this.items[0],i=[];for(let h of r.primitives)if(h instanceof Ct)i.push(h);else if(h instanceof Ir&&h.rx===h.ry)s(h);else if(h instanceof en)n(h);else throw new Error("not support!");r=Ca.build7(i);function n(h){let u=h.points(.1);for(let d=0;d<u.length-1;d++){let p=u[d],m=u[d+1];i.push(new Ct(p,m))}}function s(h){if(Math.abs(h.sweepAngle)>270){let u=h.sweepAngle/2;s(Ir.build3(h.center,h.startAngle,u,h.rx,h.ry)),s(Ir.build3(h.center,h.startAngle+u,u,h.rx,h.ry))}else i.push(h)}let a=[],l=[];vmt.getExtendPolyLine(r,t,!0,e).forEach(h=>{(h.area(.1)>0?l:a).push(h)});let c;if(a.length===1)l.forEach(h=>a.push(h)),c=new dp([new IS(a)]);else if(a.length===0)console.warn("outlines.length === 0"),c=new dp([]);else if(l.length===0)c=new dp(a.map(h=>new IS([h])));else{let h=a.map(u=>[u]);l.forEach(u=>{let d=[],p=u.bbox();if(h.forEach(m=>{m[0].bbox().isContainsBBox1(p)&&d.push(m)}),d.length===1)d[0].push(u);else{if(d.length===0)throw new Error("inPlsArr.length === 0");for(let m of d.sort((g,y)=>g[0].bbox().area()-y[0].bbox().area()))if(m[0].getWindingNum(u.start())===-1){m.push(u);break}}}),c=new dp(h.map(u=>new IS(u)))}return c}toPolylineGroup(){return new LPe(this.items)}},Dmt=(o=>(o[o.POLYGON=1]="POLYGON",o[o.POLYLINE=2]="POLYLINE",o[o.LINE=3]="LINE",o[o.ARC=4]="ARC",o[o.BEZIER2=5]="BEZIER2",o[o.BEZIER3=6]="BEZIER3",o[o.BOOLEAN_OUTPUT=7]="BOOLEAN_OUTPUT",o[o.BOOLEAN_INTERSECTION=8]="BOOLEAN_INTERSECTION",o[o.BOOLEAN_UNION=9]="BOOLEAN_UNION",o[o.BOOLEAN_DIFF=10]="BOOLEAN_DIFF",o[o.BOOLEAN_RESULT=11]="BOOLEAN_RESULT",o[o.LINES=12]="LINES",o[o.ARCS=13]="ARCS",o[o.BEZIER2S=14]="BEZIER2S",o[o.BEZIER3S=15]="BEZIER3S",o[o.CIRCLE_CW=16]="CIRCLE_CW",o[o.CIRCLE_CCW=17]="CIRCLE_CCW",o[o.POLYGON_GROUP=18]="POLYGON_GROUP",o))(Dmt||{});var cPe=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}},wmt=/(\.?0+)$/,SPe=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 100:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(cPe.lpad((n|0).toString(10),"0",u)),r=0;else return l}else return l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(cPe.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(cPe.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static fmtNumber(o){return o.toFixed(5).replace(wmt,"")}};function Lmt(o){switch(o){case 0:return"DEBUG";case 1:return"INFO";case 2:return"WARNING";case 3:return"ERROR";case 4:return"DUMMY"}}var Mmt=(o,t)=>{o===3?console.error(...t):o===2?console.warn(...t):console.log(...t)},Nmt=(o,t)=>[Lmt(o)].concat(t),d6e=class EPe{static mix(...t){return new EPe(0,(e,r)=>{for(let i of t)i.write(e,r)},(e,r)=>r)}constructor(t,e=Mmt,r=Nmt){this.level=t,this.writer=e,this.fmt=r}setLevel(t){this.level=t}prepend(t=null,e=null){let r=t===null?this.fmt:(n,s)=>(s=t(n,s),this.fmt(n,s)),i=e===null?this.writer:(n,s)=>{e(n,s),this.writer(n,s)};return new EPe(this.level,i,r)}chain(t){return t.prepend(this.fmt.bind(this),this.writer.bind(this))}include(t){return this.level<=t}formatWrite(t,e,r){this.include(t)&&this.writer(t,this.fmt(t,[SPe.format(e,...r)]))}write(t,e){this.include(t)&&this.writer(t,this.fmt(t,e))}write3(t,e,r){this.include(t)&&this.writer(t,this.fmt(t,[SPe.format(e,...r)]))}debug3(t,...e){this.write3(0,t,e)}warning3(t,...e){this.write3(2,t,e)}debugFmt(t,...e){this.formatWrite(0,t,e)}debug(...t){this.write(0,t)}infoFmt(t,...e){this.formatWrite(1,t,e)}info(...t){this.write(1,t)}warningFmt(t,...e){this.formatWrite(2,t,e)}warning(...t){this.write(2,t)}errorFmt(t,...e){this.formatWrite(3,t,e)}error(...t){this.write(3,t)}};d6e.DUMMY=new d6e(4);var CGt=String.fromCharCode;var kmt=(o=>(o[o.UNKNOW=0]="UNKNOW",o[o.NUMBER_INTEGER=1]="NUMBER_INTEGER",o[o.NUMBER_DECIMAL=2]="NUMBER_DECIMAL",o[o.NUMBER_E=3]="NUMBER_E",o[o.NUMBER_E_SIGNED=4]="NUMBER_E_SIGNED",o))(kmt||{}),Bmt=(o=>(o[o.UNKNOW=0]="UNKNOW",o[o.MOVE_X=1]="MOVE_X",o[o.MOVE_Y=2]="MOVE_Y",o[o.LINE_X=3]="LINE_X",o[o.LINE_Y=4]="LINE_Y",o[o.HORIZONTAL_X=5]="HORIZONTAL_X",o[o.VERTICAL_Y=6]="VERTICAL_Y",o[o.CUBIC_BEZIER_X1=7]="CUBIC_BEZIER_X1",o[o.CUBIC_BEZIER_Y1=8]="CUBIC_BEZIER_Y1",o[o.CUBIC_BEZIER_X2=9]="CUBIC_BEZIER_X2",o[o.CUBIC_BEZIER_Y2=10]="CUBIC_BEZIER_Y2",o[o.CUBIC_BEZIER_X=11]="CUBIC_BEZIER_X",o[o.CUBIC_BEZIER_Y=12]="CUBIC_BEZIER_Y",o[o.ARC_RX=13]="ARC_RX",o[o.ARC_RY=14]="ARC_RY",o[o.ARC_ROTATION=15]="ARC_ROTATION",o[o.ARC_LARGE=16]="ARC_LARGE",o[o.ARC_SWEEP=17]="ARC_SWEEP",o[o.ARC_X=18]="ARC_X",o[o.ARC_Y=19]="ARC_Y",o[o.SMOOTH_CUBIC_BEZIER_X2=20]="SMOOTH_CUBIC_BEZIER_X2",o[o.SMOOTH_CUBIC_BEZIER_Y2=21]="SMOOTH_CUBIC_BEZIER_Y2",o[o.SMOOTH_CUBIC_BEZIER_X=22]="SMOOTH_CUBIC_BEZIER_X",o[o.SMOOTH_CUBIC_BEZIER_Y=23]="SMOOTH_CUBIC_BEZIER_Y",o[o.QUADRATIC_BEZIER_X1=24]="QUADRATIC_BEZIER_X1",o[o.QUADRATIC_BEZIER_Y1=25]="QUADRATIC_BEZIER_Y1",o[o.QUADRATIC_BEZIER_X=26]="QUADRATIC_BEZIER_X",o[o.QUADRATIC_BEZIER_Y=27]="QUADRATIC_BEZIER_Y",o))(Bmt||{});var SGt=SPe.fmtNumber;var BPe=class{constructor(){}editHead(o,t){let e={uuid:o.uuid,nickname:o.nickname,username:o.username,updateTime:t};return`${JSON.stringify({type:"EDIT_HEAD"})}||${JSON.stringify(e)}`}head(o){return zv(this.doctype,o.client,o.doc,o.updateTime,o.version||String(o.updateTime),o.user,o.ticket)}creator(o,t){let e=typeof t=="string"?t:JSON.stringify(t);return nm("META_CREATE",o,"META_CREATE",e)}modifier(o,t){let e=typeof t=="string"?t:JSON.stringify(t);return nm("META_MODIFY",o,"META_MODIFY",e)}delete(o,t){let e=t||JSON.stringify({isDelete:!0});return nm("DELETE_DOC",o,"DELETE_DOC",e)}},Q6e=class extends BPe{constructor(){super(...arguments),this.doctype="BLOB"}buildStr(o,t,e){let r=typeof e=="string"?e:JSON.stringify(this.buildData(e));return nm("BLOB",o,t,r)}buildData(o){return{filename:o.filename,content:o.content}}},e5e=class extends BPe{meta(o,t,e){let r=typeof t=="string"?t:JSON.stringify(this.metaData(t));return nm("META",o,"META",r,void 0,e)}},t5e=class extends e5e{constructor(){super(...arguments),this.doctype="BOARD"}metaData(o){return{title:o.title,zIndex:o.zIndex}}};var r5e=class{constructor(){}encodeString(o,t){return{id:o,dataType:"STRING",data:JSON.stringify(t)}}encodeAttr(o,t){return{id:o,dataType:"ATTR",data:JSON.stringify(t)}}encodePadNet(o){let t=JSON.stringify(["PAD_NET",o.componentId,o.padNum,o.padId||""]),e={...o};return delete e.componentId,delete e.padNum,delete e.padId,{id:t,dataType:"PAD_NET",data:JSON.stringify(e)}}encodeComponent(o,t){return{id:o,dataType:"COMPONENT",data:JSON.stringify(t)}}encodePanelize(o){return{id:"PANELIZE",dataType:"PANELIZE",data:JSON.stringify(o)}}encodeRuleSelector(o){let t=JSON.stringify(["RULE_SELECTOR",o.ruleSelect]),e={...o};return delete e.ruleSelect,{id:t,dataType:"RULE_SELECTOR",data:JSON.stringify(e)}}encodeRule(o){let t=JSON.stringify(["RULE",o.ruleType,o.ruleName]),e={...o};return delete e.ruleType,delete e.ruleName,{id:t,dataType:"RULE",data:JSON.stringify(e)}}encodeRuleTemplate(o){return{id:"RULE_TEMPLATE",dataType:"RULE_TEMPLATE",data:JSON.stringify(o)}}encodeDimension(o,t){return{id:o,dataType:"DIMENSION",data:JSON.stringify(t)}}encodeBoss(o,t){return{id:o,dataType:"BOSS",data:JSON.stringify(t)}}encodeShellEntity(o,t){return{id:o,dataType:"SHELL_ENTITY",data:JSON.stringify(t)}}encodeShellCut(o,t){return{id:o,dataType:"SHELLCUT",data:JSON.stringify(t)}}encodeCrease(o,t){return{id:o,dataType:"CREASE",data:JSON.stringify(t)}}encodeShell(o,t){return{id:o,dataType:"SHELL",data:JSON.stringify(t)}}encodeFpcFill(o,t){return{id:o,dataType:"FPC_FILL",data:JSON.stringify(t)}}encodeTeardrop(o,t){return{id:o,dataType:"TEARDROP",data:JSON.stringify(t)}}encodeImage(o,t){return{id:o,dataType:"IMAGE",data:JSON.stringify(t)}}encodePoured(o,t){return{id:Gc(o,"POURED"),dataType:"POURED",data:JSON.stringify(t)}}encodePour(o,t){return{id:o,dataType:"POUR",data:JSON.stringify(t)}}encodeRegion(o,t){return{id:o,dataType:"REGION",data:JSON.stringify(t)}}encodeFill(o,t){return{id:o,dataType:"FILL",data:JSON.stringify(t)}}encodeLayerFill(o,t){return{id:Gc(o,"LAYER_FILL"),dataType:"LAYER_FILL",data:JSON.stringify(t)}}encodePoly(o,t){return{id:o,dataType:"POLY",data:JSON.stringify(t)}}encodeEQLenGrp(o,t){return{id:o,dataType:"EQLEN_GRP",data:JSON.stringify(t)}}encodeObj(o,t){return{id:o,dataType:"OBJ",data:JSON.stringify(t)}}encodeArc(o,t){return{id:o,dataType:"ARC",data:JSON.stringify(t)}}encodeLine(o,t){return{id:o,dataType:"LINE",data:JSON.stringify(t)}}encodePad(o,t){return{id:o,dataType:"PAD",data:JSON.stringify(t)}}encodeVia(o,t){return{id:o,dataType:"VIA",data:JSON.stringify(t)}}encodePreference(o){return{id:"PREFERENCE",dataType:"PREFERENCE",data:JSON.stringify(o)}}encodeSilkOpts(o,t){return{id:Gc(o,"SILK_OPTS"),dataType:"SILK_OPTS",data:JSON.stringify(t)}}encodeGroup(o,t){return{id:o,dataType:"GROUP",data:JSON.stringify(t)}}encodePrimitive(o,t){return{id:Gc(o,"PRIMITIVE"),dataType:"PRIMITIVE",data:JSON.stringify(t)}}encodeNet(o,t){return{id:Gc(o,"NET"),dataType:"NET",data:JSON.stringify(t)}}encodePartition(o,t){return{id:o,dataType:"PARTITION",data:JSON.stringify(t)}}encodeActiveLayer(o){return{id:"ACTIVE_LAYER",dataType:"ACTIVE_LAYER",data:JSON.stringify(o)}}encodeLayerPhys(o,t){return{id:Gc(o,"LAYER_PHYS"),dataType:"LAYER_PHYS",data:JSON.stringify(t)}}encodeLayer(o,t){return{id:Gc(o,"LAYER"),dataType:"LAYER",data:JSON.stringify(t)}}encodeCanvas(o){return{id:"CANVAS",dataType:"CANVAS",data:JSON.stringify(o)}}},i5e=class{constructor(){}encodeString(o,t){return{id:o,dataType:"STRING",data:JSON.stringify(t)}}encodeAttr(o,t){return{id:o,dataType:"ATTR",data:JSON.stringify(t)}}encodePanelize(o){return{id:"PANELIZE",dataType:"PANELIZE",data:JSON.stringify(o)}}encodeRuleSelector(o){let t=JSON.stringify(["RULE_SELECTOR",o.ruleSelect]),e={...o};return delete e.ruleSelect,{id:t,dataType:"RULE_SELECTOR",data:JSON.stringify(e)}}encodeRule(o){let t=JSON.stringify(["RULE",o.ruleType,o.ruleName]),e={...o};return delete e.ruleType,delete e.ruleName,{id:t,dataType:"RULE",data:JSON.stringify(e)}}encodeRuleTemplate(o){return{id:"RULE_TEMPLATE",dataType:"RULE_TEMPLATE",data:JSON.stringify(o)}}encodeDimension(o,t){return{id:o,dataType:"DIMENSION",data:JSON.stringify(t)}}encodeBoss(o,t){return{id:o,dataType:"BOSS",data:JSON.stringify(t)}}encodeShellEntity(o,t){return{id:o,dataType:"SHELL_ENTITY",data:JSON.stringify(t)}}encodeShellCut(o,t){return{id:o,dataType:"SHELLCUT",data:JSON.stringify(t)}}encodeCrease(o,t){return{id:o,dataType:"CREASE",data:JSON.stringify(t)}}encodeShell(o,t){return{id:o,dataType:"SHELL",data:JSON.stringify(t)}}encodeFpcFill(o,t){return{id:o,dataType:"FPC_FILL",data:JSON.stringify(t)}}encodeTeardrop(o,t){return{id:o,dataType:"TEARDROP",data:JSON.stringify(t)}}encodeImage(o,t){return{id:o,dataType:"IMAGE",data:JSON.stringify(t)}}encodePoured(o,t){return{id:Gc(o,"POURED"),dataType:"POURED",data:JSON.stringify(t)}}encodePour(o,t){return{id:o,dataType:"POUR",data:JSON.stringify(t)}}encodeRegion(o,t){return{id:o,dataType:"REGION",data:JSON.stringify(t)}}encodeFill(o,t){return{id:o,dataType:"FILL",data:JSON.stringify(t)}}encodeLayerFill(o,t){return{id:Gc(o,"LAYER_FILL"),dataType:"LAYER_FILL",data:JSON.stringify(t)}}encodePoly(o,t){return{id:o,dataType:"POLY",data:JSON.stringify(t)}}encodeEQLenGrp(o,t){return{id:o,dataType:"EQLEN_GRP",data:JSON.stringify(t)}}encodeObj(o,t){return{id:o,dataType:"OBJ",data:JSON.stringify(t)}}encodeArc(o,t){return{id:o,dataType:"ARC",data:JSON.stringify(t)}}encodeLine(o,t){return{id:o,dataType:"LINE",data:JSON.stringify(t)}}encodePad(o,t){return{id:o,dataType:"PAD",data:JSON.stringify(t)}}encodeVia(o,t){return{id:o,dataType:"VIA",data:JSON.stringify(t)}}encodePreference(o){return{id:"PREFERENCE",dataType:"PREFERENCE",data:JSON.stringify(o)}}encodeSilkOpts(o,t){return{id:Gc(o,"SILK_OPTS"),dataType:"SILK_OPTS",data:JSON.stringify(t)}}encodeGroup(o,t){return{id:o,dataType:"GROUP",data:JSON.stringify(t)}}encodePrimitive(o,t){return{id:Gc(o,"PRIMITIVE"),dataType:"PRIMITIVE",data:JSON.stringify(t)}}encodeNet(o,t){return{id:Gc(o,"NET"),dataType:"NET",data:JSON.stringify(t)}}encodeActiveLayer(o){return{id:"ACTIVE_LAYER",dataType:"ACTIVE_LAYER",data:JSON.stringify(o)}}encodeLayerPhys(o,t){return{id:Gc(o,"LAYER_PHYS"),dataType:"LAYER_PHYS",data:JSON.stringify(t)}}encodeLayer(o,t){return{id:Gc(o,"LAYER"),dataType:"LAYER",data:JSON.stringify(t)}}encodeCanvas(o){return{id:"CANVAS",dataType:"CANVAS",data:JSON.stringify(o)}}},n5e=class extends E6e{constructor(o=!1){super(void 0,void 0,void 0,void 0,o),this.encode=new i5e,this.maxTicket=0,this.blobEncode=new Q6e,this.blobData=[],this.encodeData="",this.placeholder=0}handleData(o){this.encodeData?this.encodeData=this.encodeData+`|
`+nm(o.dataType,++this.maxTicket,o.id,o.data):this.encodeData=nm(o.dataType,++this.maxTicket,o.id,o.data)}getZIndex(o){let t=o.match(ZQ);return t!=null&&t.length?t[1]:null}onPHolder(o,t){let e={dataType:o,max:t};this.handleData({id:`placeholder${++this.placeholder}`,dataType:"ELE_PLACEHOLDER",data:JSON.stringify(e)})}onLayerFill(o,t){this.handleData(this.encode.encodeLayerFill(o,t))}onString(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P){let T=this.getZIndex(o);this.handleData(this.encode.encodeString(Nn(o),{groupId:e,layerId:r,x:i,y:n,text:s,fontFamily:a,fontSize:l,strokeWidth:c,bold:h,italic:u,origin:d,angle:p,reverse:m,expansion:g,mirror:y,locked:b,zIndex:T===null?null:Number(T),specialColor:P}))}onAttr(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O){let _=this.getZIndex(o);_&&E&&(_=_+"."+String(E)),this.handleData(this.encode.encodeAttr(Nn(o),{groupId:e,parentId:r,layerId:i,x:n,y:s,key:a,value:l,keyVisible:c,valueVisible:h,fontFamily:u,fontSize:d,strokeWidth:p,bold:m,italic:g,origin:y,angle:b,reverse:P,expansion:T,mirror:I,locked:C,zIndex:_===null?null:Number(_),specialColor:O}))}onPadNet(o,t,e,r,i){}onComponent(o,t,e,r,i,n,s,a,l){}onPanelize(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodePanelize({on:o,row:t,column:e,rowSpacing:r,columnSpacing:i,onlyOutline:n,horizontalStamp:s,verticalStamp:a,horizontalSize:l,verticalSize:c}))}onRuleSelector(o,t,e,r,i){this.handleData(this.encode.encodeRuleSelector({ruleSelect:o,ruleOrder:t,ruleKeyValue:e,copperValue:r,innerPlaneValue:i}))}onRule(o,t,e,r){this.handleData(this.encode.encodeRule({ruleType:o,ruleName:t,ruleState:e,ruleContext:r}))}onRuleTemplate(o){this.handleData(this.encode.encodeRuleTemplate({name:o}))}onDimension(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeDimension(Nn(o),{type:e,layerId:r,unit:i,strokeWidth:n,precision:s,textFollow:a,coords:l,locked:c,zIndex:p===null?null:Number(p),text:h,specialColor:u,groupId:d}))}onBoss(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeBoss(Nn(o),{groupId:e,layerId:r,centerX:i,centerY:n,specification:s,depth:a,thickness:l,holeDiameter:c,counterBore:h?{height:h[0],diameter:h[1]}:null,stiffener:u?{topWidth:u[0],bottomWidth:u[1],height:u[2],stiffThickness:u[3]}:null,locked:d,zIndex:p===null?null:Number(p)}))}onShellEntity(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.getZIndex(o),p={groupId:e,layerId:r,type:i?"ENTITY":"SLOT",depth:a,strokeWidth:l,path:c,locked:h,zIndex:d===null?null:Number(d),refs:u};p.type==="ENTITY"&&(p.entityBelong=n),p.type==="SLOT"&&(p.slotOptions=s),this.handleData(this.encode.encodeShellEntity(Nn(o),p))}onShellCut(o,t,e,r,i,n,s,a,l){let c=this.getZIndex(o);this.handleData(this.encode.encodeShellCut(Nn(o),{groupId:e,layerId:r,depth:i,strokeWidth:n,path:s,locked:a,zIndex:c===null?null:Number(c),refs:l}))}onCrease(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o);this.handleData(this.encode.encodeCrease(Nn(o),{groupId:e,layerId:r,startX:i,startY:n,endX:s,endY:a,angle:l,locked:c,zIndex:h===null?null:Number(h)}))}onShell(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o),u={groupId:e,shellType:r,shellHeight:i,pcbHeight:n,strokeWidth:s,path:a,thickness:l.Thickness,locked:c,zIndex:h===null?null:Number(h)};r==="DRAWER"&&(u.direction=l.Direction),r==="T&B"&&(u.bottomHeight=l.BottomHeight,u.topInnerHeight=l.TopInnerHeight,u.bottomInnerHeight=l.BottomInnerHeight),this.handleData(this.encode.encodeShell(Nn(o),u))}onFpcFill(o,t,e,r,i,n,s,a){let l=this.getZIndex(o);this.handleData(this.encode.encodeFpcFill(Nn(o),{groupId:e,layerId:r,material:i,thickness:n,path:s,locked:a,zIndex:l===null?null:Number(l)}))}onTeardrop(o,t,e,r,i,n,s){this.handleData(this.encode.encodeTeardrop(Nn(o),{netName:e,layerId:r,path:i,groupId:n,refs:s,locked:!1}))}onImage(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeImage(Nn(o),{groupId:e,layerId:r,startX:i,startY:n,width:s,height:a,angle:l,mirror:c,path:h,locked:u,zIndex:p===null?null:Number(p),specialColor:d}))}onPoured(o,t){this.handleData(this.encode.encodePoured(Nn(o),t))}onPour(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.getZIndex(o);this.handleData(this.encode.encodePour(Nn(o),{groupId:e,netName:r,layerId:i,width:n,name:s,order:a,path:l,pourType:c,keepIsland:h,locked:u,zIndex:d===null?null:Number(d)}))}onRegion(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o);this.handleData(this.encode.encodeRegion(Nn(o),{groupId:e,layerId:r,width:i,prohibitType:n,path:s,locked:a,zIndex:h===null?null:Number(h),name:l,regionType:c}))}onFill(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeFill(Nn(o),{groupId:e,netName:r,layerId:i,width:n,fillStyle:s,path:a,locked:l,zIndex:u===null?null:Number(u),isBridgingCopper:!1,networkList:[],refs:c,specialColor:h}))}onPoly(o,t,e,r,i,n,s,a,l){let c=this.getZIndex(o);this.handleData(this.encode.encodePoly(Nn(o),{groupId:e,netName:r,layerId:i,width:n,path:s,locked:a,zIndex:c===null?null:Number(c),specialColor:l,polyType:i==11?"BOARD_OUTLINE":"NORMAL"}))}onEQLenGrp(o,t,e,r){this.handleData(this.encode.encodeEQLenGrp(Nn(o),{name:t,sort:e,pads:r}))}onObj(o,t,e,r,i,n,s,a,l,c,h,u,d,p){if(u.startsWith("data:")){let g=JQ(u);this.blobData.push(this.blobEncode.buildStr(1,g,{filename:i,content:u})),u=`blob:${g}`}let m=this.getZIndex(o);this.handleData(this.encode.encodeObj(Nn(o),{groupId:e,layerId:r,fileName:i,startX:n,startY:s,width:a,height:l,angle:c,mirror:h,path:u,locked:d,zIndex:m===null?null:Number(m),specialColor:p}))}onArc(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeArc(Nn(o),{groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,angle:c,width:h,locked:u,zIndex:p===null?null:Number(p),arcType:"DOT",specialColor:d}))}onCArc(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeArc(Nn(o),{groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,angle:c,width:h,locked:u,zIndex:p===null?null:Number(p),arcType:"CENT",specialColor:d}))}onLine(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeLine(Nn(o),{groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,width:c,locked:h,zIndex:u===null?null:Number(u)}))}onPad(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v){let D=this.getZIndex(o);this.handleData(this.encode.encodePad(Nn(o),{groupId:e,netName:r,layerId:i,num:n,centerX:s,centerY:a,padAngle:l,hole:c,defaultPad:h,specialPad:u,padOffsetX:d,padOffsetY:p,relativeAngle:m,plated:g,padType:y,topSolderExpansion:b,bottomSolderExpansion:P,topPasteExpansion:T,bottomPasteExpansion:I,locked:C,zIndex:D===null?null:Number(D),connectMode:E,spokeSpace:O,spokeWidth:_,spokeAngle:R,unusedInnerLayers:v,padLen:0}))}onVia(o,t,e,r,i,n,s,a,l,c,h,u,d,p){let m=this.getZIndex(o);this.handleData(this.encode.encodeVia(Nn(o),{groupId:e,netName:r,ruleName:i,centerX:n,centerY:s,holeDiameter:a,viaDiameter:l,viaType:c,topSolderExpansion:h,bottomSolderExpansion:u,locked:d,zIndex:m===null?null:Number(m),unusedInnerLayers:p}))}onPreference(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T){this.handleData(this.encode.encodePreference({startTrackWidthFollowLast:o,lastTrackWidth:t,startViaSizeFollowLast:e,lastViaInnerDiameter:r,lastViaDiameter:i,snap:n,routingMode:s,routingCorner:a,removeLoop:l,rotatingObject:c,trackFollow:h,stretchTrackMinCorner:u,preferenceConfig:d,realTimeUpdateUnusedLayers:p,unusedPadRange:m,pushVia:g,pathOptimization4BePushed:y,currentPathOptimization4BePushed:b,removeCircuitsContainingVias:P,removeAntenna:T}))}onSilkOpts(o,t,e){this.handleData(this.encode.encodeSilkOpts(o,{defaultColor:t,baseColor:e}))}onGroup(o,t){this.handleData(this.encode.encodeGroup(o,{groupName:t}))}onPrimitive(o,t,e){this.handleData(this.encode.encodePrimitive(o,{display:t,pick:e}))}onNet(o,t,e,r,i,n,s){this.handleData(this.encode.encodeNet(o,{netType:t,specialColor:e,retLine:r,differentialName:i,isPositiveNet:n,equalLengthGroupName:s}))}onPartition(o,t,e,r){}onActiveLayer(o){this.handleData(this.encode.encodeActiveLayer({layerId:o}))}onLayerPhys(o,t,e,r,i,n,s){this.handleData(this.encode.encodeLayerPhys(o,{material:t,thickness:e,permittivity:r,lossTangent:i,isKeepIsland:n,zIndex:s}))}onLayer(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodeLayer(o,{layerType:t,layerName:e,use:r,show:i,locked:n,activeColor:s,activateTransparency:a,inactiveColor:l,inactiveTransparency:c}))}onCanvas(o,t,e,r,i,n,s,a,l,c,h,u){this.handleData(this.encode.encodeCanvas({originX:o,originY:t,unit:e,gridXSize:r,gridYSize:i,snapXSize:n,snapYSize:s,altSnapXSize:a,altSnapYSize:l,gridType:c,multiGridType:h,multiGridRatio:u,highlightValue:.5}))}},Fmt=class extends E6e{constructor(o=[],t=[]){let e={};o.forEach(i=>e[i.uuid]=i.display_title||i.title);let r={};t.forEach(i=>r[i.uuid]=i.display_title||i.title),super(r,e,o,t),this.encode=new r5e,this.maxTicket=0,this.blobEncode=new Q6e,this.blobData=[],this.encodeData="",this.placeholder=0}handleData(o){this.encodeData?this.encodeData=this.encodeData+`|
`+nm(o.dataType,++this.maxTicket,o.id,o.data):this.encodeData=nm(o.dataType,++this.maxTicket,o.id,o.data)}getZIndex(o){let t=o.match(ZQ);return t!=null&&t.length?t[1]:null}onPHolder(o,t){let e={dataType:o,max:t};this.handleData({id:`placeholder${++this.placeholder}`,dataType:"ELE_PLACEHOLDER",data:JSON.stringify(e)})}onLayerFill(o,t){this.handleData(this.encode.encodeLayerFill(o,t))}onString(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P){let T=this.getZIndex(o);this.handleData(this.encode.encodeString(Nn(o),{partitionId:Nn(t),groupId:e,layerId:r,x:i,y:n,text:s,fontFamily:a,fontSize:l,strokeWidth:c,bold:h,italic:u,origin:d,angle:p,reverse:m,expansion:g,mirror:y,locked:b,zIndex:T===null?null:Number(T),specialColor:P}))}onAttr(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O){let _=this.getZIndex(o);_&&E&&(_=_+"."+String(E)),this.handleData(this.encode.encodeAttr(Nn(o),{partitionId:Nn(t),groupId:e,parentId:Nn(r),layerId:i,x:n,y:s,key:a,value:l,keyVisible:c,valueVisible:h,fontFamily:u,fontSize:d,strokeWidth:p,bold:m,italic:g,origin:y,angle:b,reverse:P,expansion:T,mirror:I,locked:C,zIndex:_===null?null:Number(_),specialColor:O}))}onPadNet(o,t,e,r,i){this.handleData(this.encode.encodePadNet({partitionId:Nn(t),componentId:Nn(o),padNum:e,padNet:r,padId:Nn(i),padLen:0}))}onComponent(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeComponent(Nn(o),{partitionId:Nn(t),groupId:e,layerId:r,x:i,y:n,angle:s,attrs:a,locked:l,zIndex:u===null?null:Number(u),specialColor:c,layerIdReplacements:h}))}onPanelize(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodePanelize({on:o,row:t,column:e,rowSpacing:r,columnSpacing:i,onlyOutline:n,horizontalStamp:s,verticalStamp:a,horizontalSize:l,verticalSize:c}))}onRuleSelector(o,t,e,r,i){this.handleData(this.encode.encodeRuleSelector({ruleSelect:o,ruleOrder:t,ruleKeyValue:e,copperValue:r,innerPlaneValue:i}))}onRule(o,t,e,r){this.handleData(this.encode.encodeRule({ruleType:o,ruleName:t,ruleState:e,ruleContext:r}))}onRuleTemplate(o){this.handleData(this.encode.encodeRuleTemplate({name:o}))}onDimension(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeDimension(Nn(o),{partitionId:Nn(t),type:e,layerId:r,unit:i,strokeWidth:n,precision:s,textFollow:a,coords:l,locked:c,zIndex:p===null?null:Number(p),text:h,specialColor:u,groupId:d}))}onBoss(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeBoss(Nn(o),{partitionId:Nn(t),groupId:e,layerId:r,centerX:i,centerY:n,specification:s,depth:a,thickness:l,holeDiameter:c,counterBore:h?{height:h[0],diameter:h[1]}:null,stiffener:u?{topWidth:u[0],bottomWidth:u[1],height:u[2],stiffThickness:u[3]}:null,locked:d,zIndex:p===null?null:Number(p)}))}onShellEntity(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.getZIndex(o),p={groupId:e,layerId:r,type:i?"ENTITY":"SLOT",depth:a,strokeWidth:l,path:c,locked:h,zIndex:d===null?null:Number(d),refs:u};p.type==="ENTITY"&&(p.entityBelong=n),p.type==="SLOT"&&(p.slotOptions=s),this.handleData(this.encode.encodeShellEntity(Nn(o),p))}onShellCut(o,t,e,r,i,n,s,a,l){let c=this.getZIndex(o);this.handleData(this.encode.encodeShellCut(Nn(o),{partitionId:Nn(t),groupId:e,layerId:r,depth:i,strokeWidth:n,path:s,locked:a,zIndex:c===null?null:Number(c),refs:l}))}onCrease(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o);this.handleData(this.encode.encodeCrease(Nn(o),{partitionId:Nn(t),groupId:e,layerId:r,startX:i,startY:n,endX:s,endY:a,angle:l,locked:c,zIndex:h===null?null:Number(h)}))}onShell(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o),u={groupId:e,shellType:r,shellHeight:i,pcbHeight:n,strokeWidth:s,path:a,thickness:l.Thickness,locked:c,zIndex:h===null?null:Number(h)};r==="DRAWER"&&(u.direction=l.Direction),r==="T&B"&&(u.bottomHeight=l.BottomHeight,u.topInnerHeight=l.TopInnerHeight,u.bottomInnerHeight=l.BottomInnerHeight),this.handleData(this.encode.encodeShell(Nn(o),u))}onFpcFill(o,t,e,r,i,n,s,a){let l=this.getZIndex(o);this.handleData(this.encode.encodeFpcFill(Nn(o),{partitionId:Nn(t),groupId:e,layerId:r,material:i,thickness:n,path:s,locked:a,zIndex:l===null?null:Number(l)}))}onTeardrop(o,t,e,r,i,n,s){this.handleData(this.encode.encodeTeardrop(Nn(o),{partitionId:Nn(t),netName:e,layerId:r,path:i,groupId:n,refs:s,locked:!1}))}onImage(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeImage(Nn(o),{partitionId:Nn(t),groupId:e,layerId:r,startX:i,startY:n,width:s,height:a,angle:l,mirror:c,path:h,locked:u,zIndex:p===null?null:Number(p),specialColor:d}))}onPoured(o,t){this.handleData(this.encode.encodePoured(Nn(o),t))}onPour(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.getZIndex(o);this.handleData(this.encode.encodePour(Nn(o),{partitionId:Nn(t),groupId:e,netName:r,layerId:i,width:n,name:s,order:a,path:l,pourType:c,keepIsland:h,locked:u,zIndex:d===null?null:Number(d)}))}onRegion(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o);this.handleData(this.encode.encodeRegion(Nn(o),{partitionId:Nn(t),groupId:e,layerId:r,width:i,prohibitType:n,path:s,locked:a,zIndex:h===null?null:Number(h),name:l,regionType:c}))}onFill(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeFill(Nn(o),{partitionId:Nn(t),groupId:e,netName:r,layerId:i,width:n,fillStyle:s,path:a,locked:l,zIndex:u===null?null:Number(u),isBridgingCopper:!1,networkList:[],refs:c,specialColor:h}))}onPoly(o,t,e,r,i,n,s,a,l){let c=this.getZIndex(o);this.handleData(this.encode.encodePoly(Nn(o),{partitionId:Nn(t),groupId:e,netName:r,layerId:i,width:n,path:s,locked:a,zIndex:c===null?null:Number(c),specialColor:l,polyType:i==11?"BOARD_OUTLINE":"NORMAL"}))}onEQLenGrp(o,t,e,r){this.handleData(this.encode.encodeEQLenGrp(Nn(o),{name:t,sort:e,pads:r}))}onObj(o,t,e,r,i,n,s,a,l,c,h,u,d,p){if(u.startsWith("data:")){let g=JQ(u);this.blobData.push(this.blobEncode.buildStr(1,g,{filename:i,content:u})),u=`blob:${g}`}let m=this.getZIndex(o);this.handleData(this.encode.encodeObj(Nn(o),{partitionId:Nn(t),groupId:e,layerId:r,fileName:i,startX:n,startY:s,width:a,height:l,angle:c,mirror:h,path:u,locked:d,zIndex:m===null?null:Number(m),specialColor:p}))}onArc(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeArc(Nn(o),{partitionId:Nn(t),groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,angle:c,width:h,locked:u,zIndex:p===null?null:Number(p),arcType:"DOT",specialColor:d}))}onCArc(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeArc(Nn(o),{partitionId:Nn(t),groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,angle:c,width:h,locked:u,zIndex:p===null?null:Number(p),arcType:"CENT",specialColor:d}))}onLine(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeLine(Nn(o),{partitionId:Nn(t),groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,width:c,locked:h,zIndex:u===null?null:Number(u)}))}onPad(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v){let D=this.getZIndex(o);this.handleData(this.encode.encodePad(Nn(o),{partitionId:Nn(t),groupId:e,netName:r,layerId:i,num:n,centerX:s,centerY:a,padAngle:l,hole:c,defaultPad:h,specialPad:u,padOffsetX:d,padOffsetY:p,relativeAngle:m,plated:g,padType:y,topSolderExpansion:b,bottomSolderExpansion:P,topPasteExpansion:T,bottomPasteExpansion:I,locked:C,zIndex:D===null?null:Number(D),connectMode:E,spokeSpace:O,spokeWidth:_,spokeAngle:R,unusedInnerLayers:v,padLen:0}))}onVia(o,t,e,r,i,n,s,a,l,c,h,u,d,p){let m=this.getZIndex(o);this.handleData(this.encode.encodeVia(Nn(o),{partitionId:Nn(t),groupId:e,netName:r,ruleName:i,centerX:n,centerY:s,holeDiameter:a,viaDiameter:l,viaType:c,topSolderExpansion:h,bottomSolderExpansion:u,locked:d,zIndex:m===null?null:Number(m),unusedInnerLayers:p}))}onPreference(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T){this.handleData(this.encode.encodePreference({startTrackWidthFollowLast:o,lastTrackWidth:t,startViaSizeFollowLast:e,lastViaInnerDiameter:r,lastViaDiameter:i,snap:n,routingMode:s,routingCorner:a,removeLoop:l,rotatingObject:c,trackFollow:h,stretchTrackMinCorner:u,preferenceConfig:d,realTimeUpdateUnusedLayers:p,unusedPadRange:m,pushVia:g,pathOptimization4BePushed:y,currentPathOptimization4BePushed:b,removeCircuitsContainingVias:P,removeAntenna:T}))}onSilkOpts(o,t,e){this.handleData(this.encode.encodeSilkOpts(o,{defaultColor:t,baseColor:e}))}onGroup(o,t){this.handleData(this.encode.encodeGroup(o,{groupName:t}))}onPrimitive(o,t,e){this.handleData(this.encode.encodePrimitive(o,{display:t,pick:e}))}onNet(o,t,e,r,i,n,s){this.handleData(this.encode.encodeNet(o,{netType:t,specialColor:e,retLine:r,differentialName:i,isPositiveNet:n,equalLengthGroupName:s}))}onPartition(o,t,e,r){this.handleData(this.encode.encodePartition(Nn(o),{name:t,fileUuid:e,path:r}))}onActiveLayer(o){this.handleData(this.encode.encodeActiveLayer({layerId:o}))}onLayerPhys(o,t,e,r,i,n,s){this.handleData(this.encode.encodeLayerPhys(o,{material:t,thickness:e,permittivity:r,lossTangent:i,isKeepIsland:n,zIndex:s}))}onLayer(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodeLayer(o,{layerType:t,layerName:e,use:r,show:i,locked:n,activeColor:s,activateTransparency:a,inactiveColor:l,inactiveTransparency:c}))}onCanvas(o,t,e,r,i,n,s,a,l,c,h,u){this.handleData(this.encode.encodeCanvas({originX:o,originY:t,unit:e,gridXSize:r,gridYSize:i,snapXSize:n,snapYSize:s,altSnapXSize:a,altSnapYSize:l,gridType:c,multiGridType:h,multiGridRatio:u,highlightValue:.5}))}};function uz(o,t,e,r,i,n,s=new Date().getTime(),a=String(s),l){var c,h;let u=Jm(),d=t.split(`

`),p=d.filter(b=>!b.startsWith('["DOCTYPE","PCB"')),m=d.filter(b=>b.startsWith('["DOCTYPE","PCB"'))[0],g="";for(let b=0;b<p.length;b++){let P=new n5e;P.parseFull(p[b]);let T=P.metaData;i.push({uuid:T.uuid,title:T.title,dataStr:p[b]});let I=zv("FOOTPRINT",u,T.uuid,s,a,l);if(I=I+`|
`+nm("META",1,"META",JSON.stringify({source:T.source,version:T.version,title:(c=T==null?void 0:T.title)==null?void 0:c.replace(/[A-Z]+/g,C=>C.toLowerCase()),display_title:T.title,description:T.description||"",custom_tags:T.custom_tags||"",tags:T.tags||{},docType:4})),P.blobData.length&&(I=I+`|
`+P.blobEncode.head({doc:"BLOB",client:u,updateTime:s,version:a,user:l})+`|
`+P.blobData.join(`|
`)),P.fontCache.length){let C=new OPe,E=C.head({doc:"FONT",client:Jm(),updateTime:s,version:a,user:l});for(let O of P.fontCache){let _=JP(O.text,O.fontFamily,O.fontSize,O.thickness,O.bold,O.italic,O.reverse,O.expansion),R=C.buildStr(1,_,O);E=E+`|
`+R}I=E+`|
`+I}P.encodeData&&(I=I+`|
`+P.encodeData),g=g?I+`|
`+g:I}let y=new Fmt(i,n);g?g=g+`|
`+zv("PCB",u,o,s,a,l):g=zv("PCB",u,o,s,a,l),y.parseFull(e.join(`
`));for(let b=0;b<r.length;b++){let P=r[b];y.curPourId=(h=P.path.split("_"))==null?void 0:h[1],y.parseFull(P.dataStr)}if(y.parseFull(m),y.encodeData&&(g=g+`|
`+y.encodeData),y.blobData.length&&(g=g+`|
`+y.blobEncode.head({doc:"BLOB",client:u,updateTime:s,version:a,user:l})+`|
`+y.blobData.join(`|
`)),y.fontCache.length){let b=new OPe,P=b.head({doc:"FONT",client:Jm(),updateTime:s,version:a,user:l});for(let T of y.fontCache){let I=JP(T.text,T.fontFamily,T.fontSize,T.thickness,T.bold,T.italic,T.reverse,T.expansion),C=b.buildStr(1,I,T);P=P+`|
`+C}g=P+`|
`+g}return g}function o5e(o,t,e,r=new Date().getTime(),i=String(r),n){let s=new n5e(e),a="",l=Jm();if(a=zv("FOOTPRINT",l,o,r,i,n),s.parseFull(t),s.encodeData&&(a=a+`|
`+s.encodeData),s.blobData.length&&(a=a+`|
`+s.blobEncode.head({doc:"BLOB",client:l,updateTime:r,version:i,user:n})+`|
`+s.blobData.join(`|
`)),s.fontCache.length){let c=new OPe,h=c.head({doc:"FONT",client:l,updateTime:r,version:i,user:n});for(let u of s.fontCache){let d=JP(u.text,u.fontFamily,u.fontSize,u.thickness,u.bold,u.italic,u.reverse,u.expansion),p=c.buildStr(1,d,u);h=h+`|
`+p}a=h+`|
`+a}return a}var Vmt=class extends e5e{canvas(o){let{client:t,ticket:e,data:r,id:i,dataType:n,firstTicket:s,pend:a}=o;return nm(n,e,i,r,t,s,a)}};var s5e=class extends Vmt{constructor(){super(...arguments),this.doctype="PCB"}metaData(o){return{title:o.title,parent:o.parent,source:o.source,board:o.board,zIndex:o.zIndex||null}}transform(o){let{doc:t,dataStr:e,fonts:r,coppers:i,footprints:n,devices:s,updateTime:a,version:l,user:c}=o;return uz(t,e,r,i,n,s,a,l,c)}};var OPe=class extends BPe{constructor(){super(...arguments),this.doctype="FONT"}buildStr(o,t,e){let r=typeof e=="string"?e:JSON.stringify(this.buildData(e));return nm("FONT",o,t,r)}buildData(o){return{width:o.width,height:o.height,path:o.path}}};var Gmt=class extends t0t{constructor(o){let t=o||new xPe;super(t,0,P6e),this.cacheNum=null}onParseLine(o,t,e,r,i,n,s){switch(this.setOrderNum(o,s,t),this.cacheNum=s,t){case"MAX_NUM":if(e)for(let l in e)this.setMaxNum(l,e[l]);break;case"BLOB":e?this.onBlob(o,r,i,e,n):this.onDelBlob(o,r,i,n);break;case"FONT":this.parseFont(o,e,r,i,n);break;case"META":e&&this.parseDetail(e,r,i,n);break;case"ELE_PLACEHOLDER":break;case"CANVAS":e&&this.parseCanvas(e,r,i,n);break;case"BOARD":e?this.parseBoard(e,r,i,n):this.onDelBoard(r,i,n);break;case"LAYER":{let l=Vv(o);e?this.parseLayer(l,e,r,i,n):this.onDelLayer(l,r,i,n);break}case"LAYER_PHYS":{let l=Vv(o);e?this.parseLayerPhys(l,e,r,i,n):this.onDelLayerPhys(l,r,i,n);break}case"ACTIVE_LAYER":e&&this.parseActiveLayer(o,e,r,i,n);break;case"PARTITION":e?this.parsePartition(o,e,r,i,n):this.onDelPartition(o,r,i,n);break;case"NET":{let l=Vv(o);e?this.parseNet(l,e,r,i,n):this.onDelNet(l,r,i,n);break}case"PRIMITIVE":{let l=Vv(o);e?this.parsePrimitive(l,e,r,i,n):this.onDelPrimitive(l,r,i,n);break}case"GROUP":e?this.parseGroup(o,e,r,i,n):this.onDelGroup(o,r,i,n);break;case"X_SIGNAL_GROUP":e?this.parseXSignalsGroup(o,e,r,i,n):this.onDelXSignalsGroup(o,r,i,n);break;case"X_SIGNALS":e?this.parseXSignals(o,e,r,i,n):this.onDelXSignals(o,r,i,n);break;case"SILK_OPTS":{let l=Vv(o);e?this.parseSilkOpts(l,e,r,i,n):this.onDelSilkOpts(l,r,i,n);break}case"PREFERENCE":e&&this.parsePreference(o,e,r,i,n);break;case"VIA":e?this.parseVia(o,e,r,i,n):this.onDelVia(o,r,i,n);break;case"PAD":e?this.parsePad(o,e,r,i,n):this.onDelPad(o,r,i,n);break;case"LINE":e?this.parseLine(o,e,r,i,n):this.onDelLine(o,r,i,n);break;case"ARC":e?this.parseArc(o,e,r,i,n):this.onDelArc(o,r,i,n);break;case"OBJ":e?this.parseObj(o,e,r,i,n):this.onDelObj(o,r,i,n);break;case"EQLEN_GRP":e?this.parseEQLenGrp(o,e,r,i,n):this.onDelEQLenGrp(o,r,i,n);break;case"POLY":e?this.parsePoly(o,e,r,i,n):this.onDelPoly(o,r,i,n);break;case"FILL":e?this.parseFill(o,e,r,i,n):this.onDelFill(o,r,i,n);break;case"LAYER_FILL":let a=Vv(o);e?this.parseLayerFill(a,e,r,i,n):this.onDelLayerFill(a,r,i,n);break;case"REGION":e?this.parseRegion(o,e,r,i,n):this.onDelRegion(o,r,i,n);break;case"POUR":e?this.parsePour(o,e,r,i,n):this.onDelPour(o,r,i,n);break;case"POURED":{o=Vv(o),e?this.parsePoured(o,e,r,i,n):this.onDelPoured(o,r,i,n);break}case"IMAGE":e?this.parseImage(o,e,r,i,n):this.onDelImage(o,r,i,n);break;case"TEARDROP":e?this.parseTeardrop(o,e,r,i,n):this.onDelTeardrop(o,r,i,n);break;case"FPC_FILL":e?this.parseFpcFill(o,e,r,i,n):this.onDelFpcFill(o,r,i,n);break;case"SHELL":e?this.parseShell(o,e,r,i,n):this.onDelShell(o,r,i,n);break;case"CREASE":e?this.parseCrease(o,e,r,i,n):this.onDelCrease(o,r,i,n);break;case"SHELLCUT":e?this.parseShellCut(o,e,r,i,n):this.onDelShellCut(o,r,i,n);break;case"SHELL_ENTITY":e?this.parseShellEntity(o,e,r,i,n):this.onDelShellEntity(o,r,i,n);break;case"BOSS":e?this.parseBoss(o,e,r,i,n):this.onDelBoss(o,r,i,n);break;case"STRING":e?this.parseString(o,e,r,i,n):this.onDelString(o,r,i,n);break;case"ATTR":e?this.parseAttr(o,e,r,i,n):this.onDelAttr(o,r,i,n);break;case"DIMENSION":e?this.parseDimension(o,e,r,i,n):this.onDelDimension(o,r,i,n);break;case"COMPONENT":e?this.parseComponent(o,e,r,i,n):this.onDelComponent(o,r,i,n);break;case"PAD_NET":{let l=JSON.parse(o);e?(e.componentId=l[1],e.padNum=l[2],e.padId=l[3],this.parsePadNet(e,r,i,n)):this.onDelPadNet(l[1],l[2],l[3]||"",r,i,n);break}case"RULE_TEMPLATE":e&&this.parseRuleTemplate(o,e,r,i,n);break;case"RULE":{let l=JSON.parse(o);e?(e.ruleType=l[1],e.ruleName=l[2],this.parseRule(e,r,i,n)):this.onDelRule(l[1],l[2],r,i,n);break}case"RULE_SELECTOR":{let l=JSON.parse(o);e?(e.ruleSelect=l[1],this.parseRuleSelector(e,r,i,n)):this.onDelRuleSelector(l[1],r,i,n);break}case"PANELIZE":e?this.parsePanelize(o,e,r,i,n):this.onDelPanelize(r,i,n);break;default:console.warn("can not find hanlder with",e,r,i)}this.cacheNum=null}onOrderNum(o,t,e){switch(this.setOrderNum(o,e,t),t){case"PARTITION":this.onPartitionNum&&this.onPartitionNum(o,e);break;case"VIA":this.onViaNum&&this.onViaNum(o,e);break;case"PAD":this.onPadNum&&this.onPadNum(o,e);break;case"LINE":this.onLineNum&&this.onLineNum(o,e);break;case"ARC":this.onArcNum&&this.onArcNum(o,e);break;case"OBJ":this.onObjNum&&this.onObjNum(o,e);break;case"POLY":this.onPolyNum&&this.onPolyNum(o,e);break;case"FILL":this.onFillNum&&this.onFillNum(o,e);break;case"REGION":this.onRegionNum&&this.onRegionNum(o,e);break;case"POUR":this.onPourNum&&this.onPourNum(o,e);break;case"POURED":let r=Vv(o);this.onPouredNum&&this.onPouredNum(r,e);break;case"IMAGE":this.onImageNum&&this.onImageNum(o,e);break;case"TEARDROP":this.onTeardropNum&&this.onTeardropNum(o,e);break;case"FPC_FILL":this.onFpcFillNum&&this.onFpcFillNum(o,e);break;case"SHELL":this.onShellNum&&this.onShellNum(o,e);break;case"CREASE":this.onCreaseNum&&this.onCreaseNum(o,e);break;case"SHELLCUT":this.onShellCutNum&&this.onShellCutNum(o,e);break;case"SHELL_ENTITY":this.onShellEntityNum&&this.onShellEntityNum(o,e);break;case"BOSS":this.onBossNum&&this.onBossNum(o,e);break;case"STRING":this.onStringNum&&this.onStringNum(o,e);break;case"ATTR":this.onAttrNum&&this.onAttrNum(o,e);break;case"DIMENSION":this.onDimensionNum&&this.onDimensionNum(o,e);break;case"COMPONENT":this.onComponentNum&&this.onComponentNum(o,e);break}}onParseEnd(){}parseCanvas(o,t,e,r){this.onCanvas(t,e,o,r)}parseBoard(o,t,e,r){this.onBoard(o,t,e,r)}parseDetail(o,t,e,r){this.onDocDetail(t,e,o,r)}parseFont(o,t,e,r,i){let n=uPe(o);t?this.onFont(e,r,Object.assign(t,n),i):this.onDelFont(n,e,r,i)}parseLayer(o,t,e,r,i){this.onLayer(o,e,r,t,i)}parseLayerPhys(o,t,e,r,i){this.onLayerPhys(o,e,r,t,i)}parseActiveLayer(o,t,e,r,i){this.onActiveLayer(e,r,t,i)}parsePartition(o,t,e,r,i){this.onPartition(o,this.cacheNum,e,r,t,i)}parseNet(o,t,e,r,i){this.onNet(o,e,r,t,i)}parsePrimitive(o,t,e,r,i){this.onPrimitive(o,e,r,t,i)}parseGroup(o,t,e,r,i){this.onGroup(o,e,r,t,i)}parseXSignalsGroup(o,t,e,r,i){this.onXSignalsGroup(o,t,e,r,i)}parseXSignals(o,t,e,r,i){this.onXSignals(o,t,e,r,i)}parseSilkOpts(o,t,e,r,i){this.onSilkOpts(o,e,r,t,i)}parsePreference(o,t,e,r,i){this.onPreference(e,r,t,i)}parseVia(o,t,e,r,i){this.onVia(o,this.cacheNum,e,r,t,i)}parsePad(o,t,e,r,i){this.onPad(o,this.cacheNum,e,r,t,i)}parseLine(o,t,e,r,i){this.onLine(o,this.cacheNum,e,r,t,i)}parseArc(o,t,e,r,i){this.onArc(o,this.cacheNum,e,r,t,i)}parseObj(o,t,e,r,i){this.onObj(o,this.cacheNum,e,r,t,i)}parseEQLenGrp(o,t,e,r,i){this.onEQLenGrp(o,e,r,t,i)}parsePoly(o,t,e,r,i){this.onPoly(o,this.cacheNum,e,r,t,i)}parseFill(o,t,e,r,i){t.fillStyle!=="PLANE"&&this.onFill(o,this.cacheNum,e,r,t,i)}parseLayerFill(o,t,e,r,i){this.onLayerFill(o,e,r,t,i)}parseRegion(o,t,e,r,i){this.onRegion(o,this.cacheNum,e,r,t,i)}parsePour(o,t,e,r,i){this.onPour(o,this.cacheNum,e,r,t,i)}parsePoured(o,t,e,r,i){let n=t;Array.isArray(t)&&(n={pourFill:t}),n.pourFill&&this.onPoured(o,this.cacheNum,e,r,n,i)}parseImage(o,t,e,r,i){this.onImage(o,this.cacheNum,e,r,t,i)}parseTeardrop(o,t,e,r,i){this.onTeardrop(o,this.cacheNum,e,r,t,i)}parseFpcFill(o,t,e,r,i){this.onFpcFill(o,this.cacheNum,e,r,t,i)}parseShell(o,t,e,r,i){this.onShell(o,this.cacheNum,e,r,t,i)}parseCrease(o,t,e,r,i){this.onCrease(o,this.cacheNum,e,r,t,i)}parseShellCut(o,t,e,r,i){this.onShellCut(o,this.cacheNum,e,r,t,i)}parseShellEntity(o,t,e,r,i){this.onShellEntity(o,this.cacheNum,e,r,t,i)}parseBoss(o,t,e,r,i){this.onBoss(o,this.cacheNum,e,r,t,i)}parseDimension(o,t,e,r,i){this.onDimension(o,this.cacheNum,e,r,t,i)}parseRuleTemplate(o,t,e,r,i){this.onRuleTemplate(e,r,t,i)}parseRule(o,t,e,r){this.onRule(t,e,o,r)}parseRuleSelector(o,t,e,r){if(o.ruleKeyValue&&(o.ruleKeyValue=Ik(o.ruleKeyValue)),o.copperValue&&o.copperValue.hasOwnProperty("7")){let i=o.copperValue[7];delete o.copperValue[7],o.copperValue.COPPER=i}if(o.innerPlaneValue&&o.innerPlaneValue.hasOwnProperty("6")){let i=o.innerPlaneValue[6];delete o.innerPlaneValue[6],o.innerPlaneValue.PLANE=i}this.onRuleSelector(t,e,o,r)}parsePanelize(o,t,e,r,i){this.onPanelize(e,r,t,i)}parseComponent(o,t,e,r,i){this.onComponent(o,this.cacheNum,e,r,t,i)}parsePadNet(o,t,e,r){this.onPadNet(t,e,o,r)}parseAttr(o,t,e,r,i){this.onAttr(o,this.cacheNum,e,r,t,i)}parseString(o,t,e,r,i){this.onString(o,this.cacheNum,e,r,t,i)}};var Umt=(o=>(o.UNIVERSAL="UNIVERSAL",o))(Umt||{}),Hmt=(o=>(o.SINGLE="SINGLE",o.MULTIPLE="MULTIPLE",o))(Hmt||{}),Wmt=(o=>(o.NONE="NONE",o.NAME="NAME",o.NUMBER="NUMBER",o))(Wmt||{}),zmt=(o=>(o.NONE="NONE",o.ZONE="ZONE",o))(zmt||{});var Ymt=wk(oz());function j0(){return self.EDITOR_TOP||self}function VQ(o){return self[o]=self[o]||new Ymt.BroadcastChannelMessageBus(o)}var HL=(o,t)=>{let e=/{([^}]*)}/gim,r=[...new Set(o.match(e))];for(let i=0;i<r.length;i++){let n=r[i],s=n.substring(1,n.length-1);t[s]&&(o=o.replace(n,t[s]))}return o};var jmt=wk(oz()),Jh={getTime:"/pro-mgr/serverTime/now",getUserL:"/pro-ui/loginUser/get",subMaxTick:"/pro-mgr/project/ticket",subBlob:"/pro-mgr/canvas/BLOB/update",subFont:"/pro-mgr/canvas/FONT/update",subRevoke:"/pro-mgr/{uuid}/revoke",pushPend:"/pro-mgr/worker/batchPendData",pushSync:"/pro-mgr/dataWorker/sync",pushRevoke:"/pro-mgr/worker/revoke",pullASync:"/pro-mgr/dataWorker/sync/{id}",personDestroy:"/mgr/libWorker/destroy",projectUpdate:"/pro-mgr/canvas/{uuid}/update",personUpdate:"/mgr/libWorker/component/{uuid}/update",personSave:"/mgr/libWorker/save",projectSave:"/mgr/projectWorker/setCanvas",canSavePend:"/mgr/projectWorker/canSavePend",hasSaveData:"/mgr/check/hasSaveData"},Xmt={projectUpdate:Jh.projectUpdate,personUpdate:Jh.personUpdate,projectCanSave:Jh.canSavePend,getProject:"/mgr/projectWorker/footprint/getCanvas",getPerson:"/mgr/libWorker/getFootprint",unwatch:"/mgr/projectWorker/footprint/unwatchCanvas"},qmt={projectUpdate:Jh.projectUpdate,projectCanSave:Jh.canSavePend,getProject:"/mgr/projectWorker/pcb/getCanvas",unwatch:"/mgr/projectWorker/pcb/unwatchCanvas"},EGt={projectUpdate:Jh.projectUpdate,projectCanSave:Jh.canSavePend,getProject:"/mgr/projectWorker/sheet/getCanvas",unwatch:"/mgr/projectWorker/sheet/unwatchCanvas"},OGt={projectUpdate:Jh.projectUpdate,getProject:"/mgr/projectWorker/schematic/getCanvas",unwatch:"/mgr/projectWorker/schematic/unwatchCanvas"},AGt={projectUpdate:Jh.projectUpdate,projectCanSave:Jh.canSavePend,getProject:"/mgr/projectWorker/simulation/getCanvas",unwatch:"/mgr/projectWorker/simulation/unwatchCanvas"},_Gt={projectUpdate:Jh.projectUpdate,personUpdate:Jh.personUpdate,projectCanSave:Jh.canSavePend,getProject:"/mgr/projectWorker/symbol/getCanvasOnCompiler",getPerson:"/mgr/libWorker/getSymbol",unwatch:"/mgr/projectWorker/symbol/unwatchCanvas"},vGt={projectUpdate:Jh.projectUpdate,personUpdate:Jh.personUpdate,projectCanSave:Jh.canSavePend,getProject:"/mgr/projectWorker/panel/getCanvas",getPerson:"/mgr/libWorker/getPanelLib",unwatch:"/mgr/projectWorker/panel/unwatchCanvas"},$mt={projectUpdate:"/pro-mgr/device/{uuid}/update",getProject:"/mgr/projectWorker/device/getByCompiler",getPerson:"/mgr/libWorker/getDevice",unwatch:"/mgr/projectWorker/device/unwatch"};var w2={send:"/pro-mgr/notify/send",sendMsg:"/document/sendMsg/cooperation",unwatch:"/document/unwatch/cooperation",watch:"/document/watch/cooperation",message:"/pro-mgr/notify/message/{path}/{uuid}/cooperation",established:"/pro-mgr/notify/message/ws/established",getWsId:"/pro-mgr/notify/getWsId",disconnect:"/pro-mgr/notify/message/ws/disconnect"},FPe=class{constructor(o=!0){this._lockerTicket=0,this.isPull=!1,this.compiler={},this.order={SYMBOL:1,FOOTPRINT:2,DEVICE:3,SCH_PAGE:4,PCB:5},this._locker=o?++this._lockerTicket:0}getOrder(o){return this.order[o]||6}publish(){if(!this.isPull){this.isPull=!0,this._temporaryUnlock=this._locker;try{let o=Object.keys(this.compiler).sort((e,r)=>this.getOrder(e)-this.getOrder(r)),t=!1;for(let e of o){for(let[,r]of this.compiler[e])if(t=r.publish(),t)break;if(t)break}}finally{this._temporaryUnlock=0,this.isPull=!1}}}canPush(){return!this._locker||this._locker===this._temporaryUnlock}addCompiler(o){this.compiler[o.headType]||(this.compiler[o.headType]=new Map),this.compiler[o.headType].set(o.uniqueId,o)}removeCompiler(o){var t,e,r;(r=(e=(t=this.compiler)==null?void 0:t[o.headType])==null?void 0:e.delete)==null||r.call(e,o.uniqueId)}pull(){if(!this._locker)throw Error("\u4E0D\u5141\u8BB8\u5728\u975E pause \u72B6\u6001\u4E0B\u62C9\u53D6\u6570\u636E");this.publish()}resume(){this._locker=0,this.publish()}pause(){this._locker=++this._lockerTicket}dispose(){for(let o in this.compiler)this.compiler[o].clear();this.compiler=null}},Uv={publish:"publish",destroy:"destroy",init:"init",selected:"selected"},Kmt=class{constructor(o,t,e,r=(s=>(s=j0())==null?void 0:s._TAB_ID_)(),i,n){this.uuid=o,this.path=t,this.user=e,this.windowId=r,this.initIds={},this.sub=[];var s;this.wsBus=n||VQ(`/${this.windowId}/notify`),this.dataBus=i||this.wsBus,this._client=(s=j0())==null?void 0:s._WS_ID_}get client(){return this._client}watch(){this.dataBus.publish(w2.send,{topic:w2.watch,uuid:this.uuid,path:this.path})}initPublish(){var o;this.dataBus.publish(w2.send,{topic:w2.sendMsg,uuid:this.uuid,path:this.path,msg:{type:Uv.publish,user:this.user,client:this.client,data:((o=this.getSelect)==null?void 0:o.call(this))||""}})}async init(){if(!this.isInit){if(this.sub.push(this.wsBus.subscribe(w2.established,o=>{this._client=o,this.watch(),this.initPublish()})),!this.client){let o=await this.wsBus.rpcCall(w2.getWsId);if(!o||this.client)return;this._client=o}this.watch(),this.sub.push(this.wsBus.subscribe(w2.disconnect,o=>{this.initIds[o]&&this.onDestroy(this.initIds[o],o)})),this.sub.push(this.dataBus.subscribe(HL(w2.message,{uuid:this.uuid,path:this.path}),o=>{if(o.type===1)o.connectId&&this.initIds[o.connectId]&&this.onDestroy(this.initIds[o.connectId],o.connectId);else if(o.msg){let t=o.msg;if(t.client===this.client)return;switch(t.type){case Uv.destroy:this.onDestroy(t.userId,t.client),delete this.initIds[t.client];break;case Uv.init:this.initIds[t.client]||(this.initIds[t.client]=t.user.uuid,this.onSelected(t.user,t.client,t.data||""));break;case Uv.selected:this.onSelected(t.user,t.client,t.data||"");break;case Uv.publish:this.dataBus.publish(w2.send,{topic:w2.sendMsg,uuid:this.uuid,path:this.path,msg:{type:Uv.init,user:this.user,client:this.client,data:this.getSelect()||""}}),this.initIds[t.client]=t.user.uuid,this.onSelected(t.user,t.client,t.data||"");break;default:break}}})),this.initPublish(),this.isInit=!0}}publishSelected(o,t){this.dataBus.publish(w2.send,{topic:w2.sendMsg,uuid:this.uuid,path:this.path,msg:{type:Uv.selected,user:this.user,client:this.client,data:o}}),t&&this.onSelected(this.user,this.client,o)}destroy(){if(this.isInit){this.isInit=!1,this.dataBus.publish(w2.send,{topic:w2.unwatch,uuid:this.uuid,path:this.path,msg:{type:Uv.destroy,userId:this.user.uuid,client:this.client}});for(let o of this.sub)o.cancel();this.sub=[],this.initIds={}}}},p6e=class extends Kmt{constructor(o,t,e,r,i,n,s,a){super(o,t,a,e,i,n),this.channel=r,this.selectedProps=s,this.cache=new Map,this.deleteCache=new Map}rePublish(){var o,t,e,r;if(this.channel.canPush()){for(let[i,n]of this.cache)(t=(o=this.selectedProps)==null?void 0:o.onSelect)==null||t.call(o,n.user,i,n.data);for(let[i,n]of this.deleteCache)(r=(e=this.selectedProps)==null?void 0:e.onQuit)==null||r.call(e,n,i)}}getSelect(){var o,t;return((t=(o=this.selectedProps)==null?void 0:o.getSelect)==null?void 0:t.call(o))||""}onSelected(o,t,e){var r,i;this.channel.canPush()?!this.deleteCache.has(t)&&this.cache.set(t,{user:o,data:e}):(i=(r=this.selectedProps)==null?void 0:r.onSelect)==null||i.call(r,o,t,e)}onDestroy(o,t){var e,r;this.channel.canPush()?(this.deleteCache.set(t,o),this.cache.delete(t)):(r=(e=this.selectedProps)==null?void 0:e.onQuit)==null||r.call(e,o,t)}dispose(){this.destroy(),this.cache.clear(),this.deleteCache.clear()}publishSelected(o,t){super.publishSelected(o,t)}},a5e=class{constructor(o,t,e,r=(b=>(b=j0())==null?void 0:b._TAB_ID_)(),i=new FPe,n=null,s,a,l,c,h,u,d,p,m,g,y){this.uuid=o,this.path=t,this.isProject=e,this.windowId=r,this.channel=i,this.consistencyManager=n,this.selectedProps=l,this.setInit=c,this.onDocDetail=h,this.onUpdate=u,this.handleInit=d,this.onDelete=p,this.publishCache=m,this.onOrderNm=g,this.setMaxNum=y,this.isInit=!1,this.canSave=!0,this.sub=[],this.isInitIng=!1,this.cache={},this.deleteCache=new Map,this.pendTimer=null,this.pendPromise=null,this.pendCache={},this.pendCacheLength=0,this.wsBus=VQ(`/${r}/notify`),n||(this._unique=Jm()),this._headType=s,this.busTopic=a}get uniqueId(){return this._unique||this.consistencyManager.getUnique()}get headType(){return this._headType}setIsInitIng(o){var t;(t=this.setInit)==null||t.call(this,o),this.isInitIng=o}consoleDebug(...o){console.debug("[lc-protocol]",this._headType,this.uuid,...o)}publishLine(o,t,e,r,i,n=this.uuid,s,a,l,c,h){if(this.channel.canPush())return this.consistencyManager.remoteChange(t,i,n,o,e,r,void 0,void 0,void 0,s,void 0,a,l,h),!1;this.cache[n]||(this.cache[n]=new Map);let u=this.cache[n].get(o);return(c||!u||u.ticket<t||u.ticket===t&&(u.client<i||u.client===i&&!!u.pend!=!!s))&&this.cache[n].set(o,{client:i,ticket:t,dataType:r,data:e,pend:s,unique:a,pChange:u?void 0:l,num:h}),!0}onDocHead(){}onEnd(){}setDocType(o,t){o===this.uuid&&(this._headType=t)}setBusTopic(o){this.busTopic=o}publish(){var o,t,e;if(this.publishCache)return this.publishCache();let r=!1;for(let[i,n]of this.deleteCache){if(this.channel.canPush()){(o=this.onDelete)==null||o.call(this,n),delete this.cache[i];continue}r=!0;break}if(r)return r;for(let i in this.cache){let n=this.cache[i].keys();for(let s of n){let a=this.cache[i].get(s);if(r=this.publishLine(s,a.ticket,a.data,a.dataType,a.client,i,a.pend,a.unique,a.pChange,!1,a.num),r)break;this.cache[i].delete(s)}if(r)break}return(e=(t=this.selectManager)==null?void 0:t.rePublish)==null||e.call(t),r}publishSelected(o,t){this.selectManager.publishSelected(o,t)}clear(){var o,t;for(let e of this.sub)e.cancel();this.sub.length=0,this.cache={},this.deleteCache.clear(),this.setIsInitIng(!1),this.channel.removeCompiler(this),(t=(o=this.selectManager)==null?void 0:o.dispose)==null||t.call(o),this.selectManager=null,this.isInit=!1,this.setIsInitIng(!1)}async init(o=!0,t=!0,e=!0,r,i,n,s){try{if(this.isInit)return{success:!0};if(this.isInitIng)throw new Error("\u6B63\u5728\u521D\u59CB\u5316\u4E2D");return this.isProject?await this.initProject(o,t,e,r,n,s):await this.initLib(e,r,i,n,s)}catch(a){throw this.clear(),new Error(`${this._headType}+'Compiler' ${this.uuid} init false: ${(a==null?void 0:a.message)||a||""}`,{cause:a})}finally{this.isInitIng=!1}}async flowRead(o){let t=this.consistencyManager.flowParseFull(),e=t.update,r=this;t.update=i=>{if(r.isDestroy)return!0;e(i)},await(0,jmt.flowRead)(o,t)}pushOnLine(o,t){if(this.consistencyManager)for(let e of o)this.publishLine(e[0],e[1],e[2],e[3],e[4],t,e[5],e[6],e[7],!1,e[8])}async initProject(o,t,e,r,i,n){if(this.setIsInitIng(!0),this.channel.addCompiler(this),this.dataBus=VQ(`/${this.windowId}/project/${this.path}`),i&&this.sub.push(this.dataBus.subscribe(`/pro-mgr/${this.uuid}/number/update`,l=>{if(this.onOrderNm)for(let c of l)this.onOrderNm(c[0],c[1],c[2])})),e&&this.busTopic.projectUpdate&&this.sub.push(this.dataBus.subscribe(HL(this.busTopic.projectUpdate,{uuid:this.uuid}),l=>{this.onUpdate?this.onUpdate(l):this.pushOnLine(l,this.uuid)})),e&&this.busTopic.projectCanSave&&this.sub.push(this.dataBus.subscribe(this.busTopic.projectCanSave,l=>{this.canSave=l})),e&&this.busTopic.subDelete&&this.sub.push(this.dataBus.subscribe(this.busTopic.subDelete,l=>{var c;this.channel.canPush()?(c=this.onDelete)==null||c.call(this,l):this.deleteCache.set(l[0],l)})),e&&this.consistencyManager&&this.sub.push(this.dataBus.subscribe(Jh.subMaxTick,l=>{this.consistencyManager.setMaxTicket(l.ticket,l.force)})),e&&t&&this.sub.push(this.dataBus.subscribe(Jh.subBlob,l=>{this.pushOnLine(l,"BLOB")})),e&&o&&this.sub.push(this.dataBus.subscribe(Jh.subFont,l=>{this.pushOnLine(l,"FONT")})),e&&this.consistencyManager&&this.sub.push(this.dataBus.subscribe(HL(Jh.subRevoke,{uuid:this.uuid}),l=>this.revoke(l))),!this.busTopic.getProject)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01");this.isDestroy=!1;let s={doc:[this.uuid],watch:e,needNum:i,needDelete:n};t&&s.doc.push("BLOB"),o&&s.doc.push("FONT");let a=await this.dataBus.rpcCall(this.busTopic.getProject,s);if(this.isWatch=e,!this.isDestroy){if(!a.success)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01",a);if(this.canSave=!(a!=null&&a.readOnly),this.consoleDebug("init",a.result),a.maxTicket&&this.consistencyManager&&this.consistencyManager.setMaxTicket(a.maxTicket),a.data&&this.onDocDetail&&this.onDocDetail(a.client||Jm(),0,a.data,!1),a.channel&&await this.flowRead(a.channel),!this.isDestroy){if(this.handleInit?this.handleInit(a):a.result&&this.consistencyManager&&this.consistencyManager.parseFull(a.result,this.uuid,this._headType),r){let l=this.user=this.user||a.user||await this.wsBus.rpcCall(Jh.getUserL);this.selectManager=new p6e(this.uuid,this.path,this.windowId,this.channel,this.dataBus,this.wsBus,this.selectedProps,l),await this.selectManager.init()}return this.isInit=!0,this.setIsInitIng(!1),{success:!0}}}}async initLib(o,t,e,r,i){if(this.setIsInitIng(!0),this.channel.addCompiler(this),this.dataBus=VQ(`/${this.windowId}/libWorker`),!this.busTopic.getPerson)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01");let n=e?Jm():"";this.isDestroy=!1;let s=await this.dataBus.rpcCall(this.busTopic.getPerson,{uuid:this.uuid,path:this.path,watch:o,channel:n,needNum:r,needDelete:i});if(this.isWatch=o,this.isDestroy)return;if(!s.success)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01",s);this.consoleDebug("init",s.dataStr);let a=s.data||s.result;if(a&&this.onDocDetail&&this.onDocDetail(s.client||Jm(),0,a,!1),r&&this.sub.push(this.dataBus.subscribe(`/pro-mgr/${this.uuid}/number/update`,l=>{if(this.onOrderNm)for(let c of l)this.onOrderNm(c[0],c[1],c[2])})),o&&this.busTopic.personUpdate&&this.sub.push(this.dataBus.subscribe(HL(this.busTopic.personUpdate,{uuid:this.uuid}),l=>{this.pushOnLine(l,this.uuid)})),o&&this.sub.push(this.dataBus.subscribe(HL(HL(Jh.subRevoke,{uuid:this.uuid}),{uuid:this.uuid}),l=>this.revoke(l))),n&&await this.flowRead(n),!this.isDestroy){if(s.dataStr&&this.consistencyManager&&this.consistencyManager.parseFull(s.dataStr),t){let l=this.user=this.user||s.user||await this.wsBus.rpcCall(Jh.getUserL);this.selectManager=new p6e(this.uuid,this.path,this.windowId,this.channel,this.wsBus,this.wsBus,this.selectedProps,l),await this.selectManager.init()}return this.isInit=!0,this.setIsInitIng(!1),{success:!0}}}revoke(o){for(let t of o)this.consistencyManager&&this.consistencyManager.revoke(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],(...e)=>this.publishLine(...e)),t[10]&&this.setMaxNum&&this.setMaxNum(t[6],t[10],t[1])}cachePendData(o,t,e,r,i,n){if(this.pendCache[o]||(this.pendCache[o]={type:n,pend:[]}),this.pendCache[o].pend.push([t,e,i,r]),this.pendCacheLength+=r.length+1,this.pendCacheLength>1e7&&this.publishPendData(),!this.pendTimer){let s;this.pendPromise=new Promise(a=>s=a),this.pendTimer=setTimeout(()=>{this.publishPendData(),s&&s(),this.pendTimer=null},0)}}publishPendData(){if(this.pendCacheLength){this.dataBus.publish(Jh.pushPend,[this.pendCache,this.consistencyManager.getClient(),this.uniqueId,this.uuid]);for(let o in this.pendCache)this.pendCache[o].pend.length=0;this.pendCache={},this.pendCacheLength=0}}localChange(o,t,e,r=this.uuid,i,n){if(!this.isInit||!this.canSave||!this.consistencyManager)return 0;if(t&&!t.startsWith("{"))return console.error("\u4E0A\u4F20\u7684\u683C\u5F0F\u4E0D\u6B63\u786E",o,e,t),0;let s=this.consistencyManager.localChange(r,o,t,e,i,n);return this.cachePendData(r,o,s,t,e,i||this.headType),s}async sync(){if(!this.isInit)throw new Error("\u6570\u636E\u672A\u521D\u59CB\u5316\uFF0C\u65E0\u6CD5\u540C\u6B65");let o=Jm();this.dataBus.publish(Jh.pushSync,o),await this.dataBus.pullA(HL(Jh.pullASync,{id:o}))}async destroy(){return this.isDestroy?{success:!1}:(this.consistencyManager&&this.dataBus&&(this.pendPromise&&await this.pendPromise,this.dataBus.publish(Jh.pushRevoke,[this.uuid,this.uniqueId,this.consistencyManager.getClient()])),this.clear(),this.isDestroy=!0,this.isWatch&&this.dataBus&&!this.isProject&&this.dataBus.publish(Jh.personDestroy,{uuid:this.uuid,path:this.path}),this.isWatch&&this.dataBus&&this.busTopic.unwatch&&this.dataBus.publish(this.busTopic.unwatch,this.uuid),this.isWatch=!1,{success:!0})}async save(o=[this.uuid,"BLOB","FONT"]){try{if(!this.isInit)throw new Error("\u6570\u636E\u672A\u521D\u59CB\u5316\uFF0C\u65E0\u6CD5\u4FDD\u5B58");if(!this.consistencyManager)throw new Error("\u65E0\u6CD5\u652F\u6301\u4FDD\u5B58");let t=this.isProject?Jh.projectSave:Jh.personSave;if(!t)throw new Error("\u65E0\u6CD5\u652F\u6301\u4FDD\u5B58");this.pendPromise&&await this.pendPromise;let e=await this.dataBus.rpcCall(t,{uuid:this.uuid,path:this.path,docIds:o,uniqueId:this.uniqueId,client:this.consistencyManager.getClient()});return this.consoleDebug("save",e),e}catch(t){throw new Error(`${this._headType}+'Compiler' ${this.uuid} \u4FDD\u5B58\u5931\u8D25: ${(t==null?void 0:t.message)||t||""}`,{cause:t})}}async getBlob(o){return this.dataBus.rpcCall("/mgr/projectWorker/blob/getBlob",o)}async getFont(o,t,e,r,i,n,s,a){let l={text:o,fontFamily:t,fontSize:e,thickness:r,bold:i,italic:n,reverse:s,expansion:a},c=await this.dataBus.rpcCall("/mgr/projectWorker/font/get",l);return c.success?{success:!0,result:Object.assign(l,JSON.parse(c.result))}:c}async checkSave(){return this.pendPromise&&await this.pendPromise,await this.dataBus.rpcCall(Jh.hasSaveData,{uuid:this.uuid,uniqueId:this.uniqueId})}};var Zmt=(o=>(o.DIFFERENTIAL_PAIR="DIFFERENTIAL_PAIR",o.NET_CLASS="NET_CLASS",o.EQL_NET_GRP="EQL_NET_GRP",o))(Zmt||{});var Jmt=class{constructor(o,t,e){this.uuid=o,this.maxTicket=0,this.encodeConsistency=new i0t(e),this.encodeConsistency.setDoctype(o,t),this.encodeConsistency.setDoctype("BLOB","BLOB"),this.encodeConsistency.setDoctype("FONT","FONT")}setFlowWriter(o){this.write=o}localChange(o,t,e,r=this.uuid){let i,n=typeof t=="string"?t:JSON.stringify(t);return this.write?(i=++this.maxTicket,this.write(r,this.encodeConsistency.getDoctype(r),nm(e,i,o,n))):i=this.encodeConsistency.localChange(r,o,n,e),i}getDataStr(o=!0){return this.encodeConsistency.compressFull({notDocHead:!o})}removeDataStr(){this.encodeConsistency.removeCache()}uploadBlob(o,t){let e=JQ(t),r={filename:o,content:t};return{success:!0,ticket:this.localChange(e,JSON.stringify(r),"BLOB","BLOB"),hash:e}}deleteBlob(o){return{success:!0,ticket:this.localChange(o,"","BLOB","BLOB")}}};var Qmt=class extends Jmt{constructor(o,t,e){super(o,t,e),this.uuid=o}uploadFont(o){let{text:t,fontFamily:e,fontSize:r,thickness:i,bold:n,italic:s,reverse:a,expansion:l,width:c,height:h,path:u}=o,d={width:c,height:h,path:u},p=JP(t,e,r,i,n,s,a,l);return{success:!0,ticket:this.localChange(p,JSON.stringify(d),"FONT","FONT")}}deleteFont(o){let{text:t,fontFamily:e,fontSize:r,thickness:i,bold:n,italic:s,reverse:a,expansion:l}=o,c=JP(t,e,r,i,n,s,a,l);return{success:!0,ticket:this.localChange(c,"","FONT","FONT")}}uploadString(o,t){return{success:!0,ticket:this.localChange(o,t,"STRING")}}deleteString(o){return{success:!0,ticket:this.localChange(o,"","STRING")}}uploadAttr(o,t){return{success:!0,ticket:this.localChange(o,t,"ATTR")}}deleteAttr(o){return{success:!0,ticket:this.localChange(o,"","ATTR")}}uploadPanelize(o){return{success:!0,ticket:this.localChange("PANELIZE",o,"PANELIZE")}}deletePanelize(){return{success:!0,ticket:this.localChange("PANELIZE","","PANELIZE")}}uploadRuleSelector(o){let t=JSON.stringify(["RULE_SELECTOR",o.ruleSelect]),e={...o};return delete e.ruleSelect,{success:!0,ticket:this.localChange(t,e,"RULE_SELECTOR")}}deleteRuleSelector(o){return{success:!0,ticket:this.localChange(JSON.stringify(["RULE_SELECTOR",o]),"","RULE_SELECTOR")}}uploadRule(o){let t=JSON.stringify(["RULE",o.ruleType,o.ruleName]),e={...o};return delete e.ruleType,delete e.ruleName,{success:!0,ticket:this.localChange(t,e,"RULE")}}deleteRule(o,t){return{success:!0,ticket:this.localChange(JSON.stringify(["RULE",o,t]),"","RULE")}}uploadRuleTemplate(o){return{success:!0,ticket:this.localChange("RULE_TEMPLATE",o,"RULE_TEMPLATE")}}uploadDimension(o,t){return{success:!0,ticket:this.localChange(o,t,"DIMENSION")}}deleteDimension(o){return{success:!0,ticket:this.localChange(o,"","DIMENSION")}}uploadBoss(o,t){return{success:!0,ticket:this.localChange(o,t,"BOSS")}}deleteBoss(o){return{success:!0,ticket:this.localChange(o,"","BOSS")}}uploadShellEntity(o,t){return{success:!0,ticket:this.localChange(o,t,"SHELL_ENTITY")}}deleteShellEntity(o){return{success:!0,ticket:this.localChange(o,"","SHELL_ENTITY")}}uploadShellCut(o,t){return{success:!0,ticket:this.localChange(o,t,"SHELLCUT")}}deleteShellCut(o){return{success:!0,ticket:this.localChange(o,"","SHELLCUT")}}uploadCrease(o,t){return{success:!0,ticket:this.localChange(o,t,"CREASE")}}deleteCrease(o){return{success:!0,ticket:this.localChange(o,"","CREASE")}}uploadShell(o,t){return{success:!0,ticket:this.localChange(o,t,"SHELL")}}deleteShell(o){return{success:!0,ticket:this.localChange(o,"","SHELL")}}uploadFpcFill(o,t){return{success:!0,ticket:this.localChange(o,t,"FPC_FILL")}}deleteFpcFill(o){return{success:!0,ticket:this.localChange(o,"","FPC_FILL")}}uploadTeardrop(o,t){return{success:!0,ticket:this.localChange(o,t,"TEARDROP")}}deleteTeardrop(o){return{success:!0,ticket:this.localChange(o,"","TEARDROP")}}uploadImage(o,t){return{success:!0,ticket:this.localChange(o,t,"IMAGE")}}deleteImage(o){return{success:!0,ticket:this.localChange(o,"","IMAGE")}}uploadPoured(o,t){return{success:!0,ticket:this.localChange(Gc(o,"POURED"),t,"POURED")}}deletePoured(o){return{success:!0,ticket:this.localChange(Gc(o,"POURED"),"","POURED")}}uploadPour(o,t){return{success:!0,ticket:this.localChange(o,t,"POUR")}}deletePour(o){return{success:!0,ticket:this.localChange(o,"","POUR")}}uploadRegion(o,t){return{success:!0,ticket:this.localChange(o,t,"REGION")}}deleteRegion(o){return{success:!0,ticket:this.localChange(o,"","REGION")}}uploadFill(o,t){return{success:!0,ticket:this.localChange(o,t,"FILL")}}deleteFill(o){return{success:!0,ticket:this.localChange(o,"","FILL")}}uploadLayerFill(o,t){return{success:!0,ticket:this.localChange(Gc(o,"LAYER_FILL"),t,"LAYER_FILL")}}deleteLayerFill(o){return{success:!0,ticket:this.localChange(Gc(o,"LAYER_FILL"),"","LAYER_FILL")}}uploadPoly(o,t){return{success:!0,ticket:this.localChange(o,t,"POLY")}}deletePoly(o){return{success:!0,ticket:this.localChange(o,"","POLY")}}uploadEQLenGrp(o,t){return{success:!0,ticket:this.localChange(o,t,"EQLEN_GRP")}}deleteEQLenGrp(o){return{success:!0,ticket:this.localChange(o,"","EQLEN_GRP")}}uploadObj(o,t){return{success:!0,ticket:this.localChange(o,t,"OBJ")}}deleteObj(o){return{success:!0,ticket:this.localChange(o,"","OBJ")}}uploadArc(o,t){return{success:!0,ticket:this.localChange(o,t,"ARC")}}deleteArc(o){return{success:!0,ticket:this.localChange(o,"","ARC")}}uploadLine(o,t){return{success:!0,ticket:this.localChange(o,t,"LINE")}}deleteLine(o){return{success:!0,ticket:this.localChange(o,"","LINE")}}uploadPad(o,t){return{success:!0,ticket:this.localChange(o,t,"PAD")}}deletePad(o){return{success:!0,ticket:this.localChange(o,"","PAD")}}uploadVia(o,t){return{success:!0,ticket:this.localChange(o,t,"VIA")}}deleteVia(o){return{success:!0,ticket:this.localChange(o,"","VIA")}}uploadPreference(o){return{success:!0,ticket:this.localChange("PREFERENCE",o,"PREFERENCE")}}uploadSilkOpts(o,t){return{success:!0,ticket:this.localChange(Gc(o,"SILK_OPTS"),t,"SILK_OPTS")}}deleteSilkOpts(o){return{success:!0,ticket:this.localChange(Gc(o,"SILK_OPTS"),"","SILK_OPTS")}}uploadGroup(o,t){return{success:!0,ticket:this.localChange(o,t,"GROUP")}}deleteGroup(o){return{success:!0,ticket:this.localChange(o,"","GROUP")}}uploadXSignalsGroup(o,t){return{success:!0,ticket:this.localChange(o,t,"X_SIGNAL_GROUP")}}deleteXSignalsGroup(o){return{success:!0,ticket:this.localChange(o,"","X_SIGNAL_GROUP")}}uploadXSignals(o,t){return{success:!0,ticket:this.localChange(o,t,"X_SIGNALS")}}deleteXSignals(o){return{success:!0,ticket:this.localChange(o,"","X_SIGNALS")}}uploadPrimitive(o,t){return{success:!0,ticket:this.localChange(Gc(o,"PRIMITIVE"),t,"PRIMITIVE")}}deletePrimitive(o){return{success:!0,ticket:this.localChange(Gc(o,"PRIMITIVE"),"","PRIMITIVE")}}uploadNet(o,t){return{success:!0,ticket:this.localChange(Gc(o,"NET"),t,"NET")}}deleteNet(o){return{success:!0,ticket:this.localChange(Gc(o,"NET"),"","NET")}}uploadPartition(o,t){return{success:!0,ticket:this.localChange(o,t,"PARTITION")}}deletePartition(o){return{success:!0,ticket:this.localChange(o,"","PARTITION")}}uploadActiveLayer(o){return{success:!0,ticket:this.localChange("ACTIVE_LAYER",o,"ACTIVE_LAYER")}}uploadLayerPhys(o,t){return{success:!0,ticket:this.localChange(Gc(o,"LAYER_PHYS"),t,"LAYER_PHYS")}}deleteLayerPhys(o){return{success:!0,ticket:this.localChange(Gc(o,"LAYER_PHYS"),"","LAYER_PHYS")}}uploadLayer(o,t){return{success:!0,ticket:this.localChange(Gc(o,"LAYER"),t,"LAYER")}}deleteLayer(o){return{success:!0,ticket:this.localChange(Gc(o,"LAYER"),"","LAYER")}}uploadCanvas(o){return{success:!0,ticket:this.localChange("CANVAS",o,"CANVAS")}}uploadBoard(o){return{success:!0,ticket:this.localChange("BOARD",o,"BOARD")}}deleteBoard(){return{success:!0,ticket:this.localChange("BOARD","","BOARD")}}},Bk=class extends Qmt{constructor(o,t){super(o,"PCB",t)}uploadPadNet(o){let t=JSON.stringify(["PAD_NET",o.componentId,o.padNum,o.padId||""]),e={...o};return delete e.componentId,delete e.padNum,delete e.padId,{success:!0,ticket:this.localChange(t,e,"PAD_NET")}}deletePadNet(o,t,e){return{success:!0,ticket:this.localChange(JSON.stringify(["PAD_NET",o,t,e||""]),"","PAD_NET")}}uploadComponent(o,t){return{success:!0,ticket:this.localChange(o,t,"COMPONENT")}}deleteComponent(o){return{success:!0,ticket:this.localChange(o,"","COMPONENT")}}};var xGt=wk(oz()),RGt=wk(oz());var l5e=class extends Gmt{constructor(o,t,e,r,i,n,s,a=(l=>(l=j0())==null?void 0:l._TAB_ID_)()){let l=new xPe(a);super(l),this.isProject=e,this.encode=n,this.base=new a5e(o,t,e,a,r,l,i,i==="PCB"?qmt:Xmt,s,(...c)=>this.setIsInit(...c),(...c)=>this.onDocDetail(...c),void 0,void 0,void 0,void 0,(c,h,u)=>this.onOrderNum(c,h,u),(c,h,u)=>{this.setMaxNum(c,h,!!u),u&&this.deleteOrderNum(u)})}get dataBus(){return this.base.dataBus}set dataBus(o){this.base.dataBus=o}async init(o=!0,t=!0,e=!0,r,i=!0,n){return this.setNeedNum(i),this.base.init(o,t,e,r,!0,i,n)}async sync(){return this.base.sync()}async destroy(){return this.base.destroy()}async save(){return this.base.save()}checkSave(){return this.base.checkSave()}publishSelected(o,t){this.base.publishSelected(o,t)}uploadBlob(o,t){let e=JQ(t),r={filename:o,content:t};return{success:!0,ticket:this.localChange({id:e,data:JSON.stringify(r),dataType:"BLOB"},"BLOB","BLOB"),hash:e}}deleteBlob(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"BLOB"},"BLOB","BLOB")}}uploadFont(o){let{text:t,fontFamily:e,fontSize:r,thickness:i,bold:n,italic:s,reverse:a,expansion:l,width:c,height:h,path:u}=o,d={width:c,height:h,path:u},p=JP(t,e,r,i,n,s,a,l);return{success:!0,ticket:this.localChange({id:p,data:JSON.stringify(d),dataType:"FONT"},"FONT","FONT")}}deleteFont(o){let{text:t,fontFamily:e,fontSize:r,thickness:i,bold:n,italic:s,reverse:a,expansion:l}=o,c=JP(t,e,r,i,n,s,a,l);return{success:!0,ticket:this.localChange({id:c,data:"",dataType:"FONT"},"FONT","FONT")}}async updateFootprint(o){return this.isProject?this.dataBus.rpcCall("/mgr/projectWorker/footprint/update",o):{success:!1,message:"compiler \u6682\u4E0D\u652F\u6301\u4E2A\u4EBA\u5E93\u76F4\u63A5\u4FEE\u6539\u5C01\u88C5\u4FE1\u606F"}}async generateTemplate(o,t){return this.isProject?this.dataBus.rpcCall("/mgr/projectWorker/footprint/generateTemplate",{custom:o,renameKey:t}):{success:!1,message:"compiler \u6682\u4E0D\u652F\u6301\u4E2A\u4EBA\u5E93\u8C03\u7528\u8BE5\u63A5\u53E3"}}localChange(o,t=this.base.uuid,e){var r,i;let n=this.getOrderNum(o.id);return(i=(r=this.needOrderType)==null?void 0:r.includes)!=null&&i.call(r,o.dataType)&&n===void 0&&(n=this.getMaxNum(o.dataType),this.setOrderNum(o.id,n,o.dataType),this.onOrderNum(o.id,o.dataType,n)),this.base.localChange(o.id,o.data,o.dataType,t,e,n)}uploadString(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeString(o,t))}}deleteString(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"STRING"})}}uploadAttr(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeAttr(o,t))}}deleteAttr(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"ATTR"})}}uploadPanelize(o){return{success:!0,ticket:this.localChange(this.encode.encodePanelize(o))}}deletePanelize(){return{success:!0,ticket:this.localChange({id:"PANELIZE",data:"",dataType:"PANELIZE"})}}uploadRuleSelector(o){return{success:!0,ticket:this.localChange(this.encode.encodeRuleSelector(o))}}deleteRuleSelector(o){return{success:!0,ticket:this.localChange({id:JSON.stringify(["RULE_SELECTOR",o]),data:"",dataType:"RULE_SELECTOR"})}}uploadRule(o){return{success:!0,ticket:this.localChange(this.encode.encodeRule(o))}}deleteRule(o,t){return{success:!0,ticket:this.localChange({id:JSON.stringify(["RULE",o,t]),data:"",dataType:"RULE"})}}uploadRuleTemplate(o){return{success:!0,ticket:this.localChange(this.encode.encodeRuleTemplate(o))}}uploadDimension(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeDimension(o,t))}}deleteDimension(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"DIMENSION"})}}uploadBoss(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeBoss(o,t))}}deleteBoss(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"BOSS"})}}uploadShellEntity(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeShellEntity(o,t))}}deleteShellEntity(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"SHELL_ENTITY"})}}uploadShellCut(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeShellCut(o,t))}}deleteShellCut(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"SHELLCUT"})}}uploadCrease(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeCrease(o,t))}}deleteCrease(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"CREASE"})}}uploadShell(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeShell(o,t))}}deleteShell(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"SHELL"})}}uploadFpcFill(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeFpcFill(o,t))}}deleteFpcFill(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"FPC_FILL"})}}uploadTeardrop(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeTeardrop(o,t))}}deleteTeardrop(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"TEARDROP"})}}uploadImage(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeImage(o,t))}}deleteImage(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"IMAGE"})}}uploadPoured(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePoured(o,t))}}deletePoured(o){return{success:!0,ticket:this.localChange({id:Gc(o,"POURED"),data:"",dataType:"POURED"})}}uploadPour(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePour(o,t))}}deletePour(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"POUR"})}}uploadRegion(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeRegion(o,t))}}deleteRegion(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"REGION"})}}uploadFill(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeFill(o,t))}}deleteFill(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"FILL"})}}uploadLayerFill(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLayerFill(o,t))}}deleteLayerFill(o){return{success:!0,ticket:this.localChange({id:Gc(o,"LAYER_FILL"),data:"",dataType:"LAYER_FILL"})}}uploadPoly(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePoly(o,t))}}deletePoly(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"POLY"})}}uploadEQLenGrp(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeEQLenGrp(o,t))}}deleteEQLenGrp(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"EQLEN_GRP"})}}uploadObj(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeObj(o,t))}}deleteObj(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"OBJ"})}}uploadArc(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeArc(o,t))}}deleteArc(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"ARC"})}}uploadLine(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLine(o,t))}}deleteLine(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"LINE"})}}uploadPad(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePad(o,t))}}deletePad(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"PAD"})}}uploadVia(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeVia(o,t))}}deleteVia(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"VIA"})}}uploadPreference(o){return{success:!0,ticket:this.localChange(this.encode.encodePreference(o))}}uploadSilkOpts(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeSilkOpts(o,t))}}deleteSilkOpts(o){return{success:!0,ticket:this.localChange({id:Gc(o,"SILK_OPTS"),data:"",dataType:"SILK_OPTS"})}}uploadGroup(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeGroup(o,t))}}deleteGroup(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"GROUP"})}}uploadPrimitive(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePrimitive(o,t))}}deletePrimitive(o){return{success:!0,ticket:this.localChange({id:Gc(o,"PRIMITIVE"),data:"",dataType:"PRIMITIVE"})}}uploadNet(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeNet(o,t))}}deleteNet(o){return{success:!0,ticket:this.localChange({id:Gc(o,"NET"),data:"",dataType:"NET"})}}uploadActiveLayer(o){return{success:!0,ticket:this.localChange(this.encode.encodeActiveLayer(o))}}uploadLayerPhys(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLayerPhys(o,t))}}deleteLayerPhys(o){return{success:!0,ticket:this.localChange({id:Gc(o,"LAYER_PHYS"),data:"",dataType:"LAYER_PHYS"})}}uploadLayer(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLayer(o,t))}}deleteLayer(o){return{success:!0,ticket:this.localChange({id:Gc(o,"LAYER"),data:"",dataType:"LAYER"})}}uploadCanvas(o){return{success:!0,ticket:this.localChange(this.encode.encodeCanvas(o))}}uploadBoard(o){return{success:!0,ticket:this.localChange({id:"BOARD",data:JSON.stringify(o),dataType:"BOARD"})}}deleteBoard(){return{success:!0,ticket:this.localChange({id:"BOARD",data:"",dataType:"BOARD"})}}uploadXSignalsGroup(o,t){return{success:!0,ticket:this.localChange({id:o,data:JSON.stringify(t),dataType:"X_SIGNAL_GROUP"})}}deleteXSignalsGroup(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"X_SIGNAL_GROUP"})}}uploadXSignals(o,t){return{success:!0,ticket:this.localChange({id:o,data:JSON.stringify(t),dataType:"X_SIGNALS"})}}deleteXSignals(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"X_SIGNALS"})}}},dz=class extends l5e{constructor(o,t,e,r){let i=new r5e;super(o,t,!0,e,"PCB",i,{getSelect:()=>{var n;return(n=this.canvasSelected)==null?void 0:n.call(this)},onSelect:(...n)=>{var s;return(s=this.onSelectChange)==null?void 0:s.call(this,n[0],n[1],n[2])},onQuit:(...n)=>{var s;return(s=this.onSelectQuit)==null?void 0:s.call(this,n[0],n[1])}},r),this.uuid=o,this.project=t,this.windowId=r,this.encoder=i}async customFootprint(o,t){return this.dataBus.rpcCall("/mgr/projectWorker/footprint/clone",{uuid:o,source:t})}async footprintIsExist(o){var t;return(t=await this.dataBus.rpcCall("/mgr/projectWorker/footprint/isExist",o))==null?void 0:t.result}uploadPadNet(o){return{success:!0,ticket:this.localChange(this.encoder.encodePadNet(o))}}deletePadNet(o,t,e){return{success:!0,ticket:this.localChange({id:JSON.stringify(["PAD_NET",o,t,e||""]),data:"",dataType:"PAD_NET"})}}uploadComponent(o,t){return{success:!0,ticket:this.localChange(this.encoder.encodeComponent(o,t))}}deleteComponent(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"COMPONENT"})}}uploadPartition(o,t){return{success:!0,ticket:this.localChange(this.encoder.encodePartition(o,t))}}deletePartition(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"PARTITION"})}}},c5e=class extends l5e{constructor(o,t,e,r,i=(n=>(n=j0())==null?void 0:n._TAB_ID_)()){super(o,t,e,r,"FOOTPRINT",new i5e,{getSelect:()=>{var n;return(n=this.canvasSelected)==null?void 0:n.call(this)},onSelect:(...n)=>{var s;return(s=this.onSelectChange)==null?void 0:s.call(this,n[0],n[1],n[2])},onQuit:(...n)=>{var s;return(s=this.onSelectQuit)==null?void 0:s.call(this,n[0],n[1])}},i),this.uuid=o,this.path=t,this.isProject=e,this.windowId=i}onComponent(){}onComponentNum(){}onDelComponent(){}onPadNet(){}onDelPadNet(){}};var h5e=class{constructor(o,t,e,r,i=(n=>(n=j0())==null?void 0:n._TAB_ID_)()){this.uuid=o,this.path=t,this.isProject=e,this.windowId=i,this.cache=null;let n=s=>(s||(s=this.cache),this.base.channel.canPush()?(s&&this.onDocDetail(s[0],s[1],s[2]),this.cache=null,!1):(this.cache=s,!0));this.base=new a5e(o,t,e,i,r,void 0,"DEVICE",$mt,void 0,void 0,(...s)=>this.onDocDetail(s[0],s[1],s[2]),n,s=>this.onDocDetail(s.client,s.ticket,s.result),void 0,n)}async init(o=!0){return this.base.init(!1,!1,o,!1)}async sync(){return this.base.sync()}async destroy(){let o=await this.base.destroy();return o.success&&(this.cache=null),o}};var tee=class{};var ree=class extends tee{constructor(){super(...arguments);this.errorLayerData=new Set;this.errorLayerPhyData=new Set}clear(){this.errorLayerData.clear(),this.errorLayerPhyData.clear()}deleteLayerId(e){this.errorLayerData.delete(e)}deleteLayerPhyId(e){this.errorLayerPhyData.delete(e)}fix(e,r){let i=new Map,n=new Map,s=new Map;for(let l of e)i.set(l.layerId,l),l.getType()=="SUBSTRATE"&&s.set(l.layerId,l);for(let l of r)n.set(l.layerId,l);let a=260;for(let[l,c]of s)if(l>=101&&l<361){this.errorLayerData.add(l),this.errorLayerPhyData.add(l);let h=l+a;if(s.has(h))i.delete(l),n.delete(l);else{c.layerId=h;let u=n.get(l);u!=null&&(u.layerId=h)}}e.length=0,r.length=0;for(let[,l]of i)e.push(l);for(let[,l]of n)r.push(l)}};var Fk=class{constructor(){this.layerPhyFix=new ree}};var Pu=class extends dz{constructor(e,r,i,n){super(e,r,i,n);this.hasSynced=new Map;this.initFinished=!1;this.mgr=new Fk}onXSignalsGroup(e,r,i,n,s){throw new Error("Method not implemented.")}onDelXSignalsGroup(e,r,i,n){throw new Error("Method not implemented.")}onXSignals(e,r,i,n,s){throw new Error("Method not implemented.")}onDelXSignals(e,r,i,n){throw new Error("Method not implemented.")}getSelectHandle(){return this.selectHandle}setSelectHandle(e){this.selectHandle=e}getDocDetail(){return this.docDetail}canvasSelected(){var e;return(e=this.selectHandle)==null?void 0:e.getSelect()}onSelectChange(e,r,i){var n;(n=this.selectHandle)==null||n.onSelected(e,r,i)}onSelectQuit(e,r){var i;(i=this.selectHandle)==null||i.onDestroy(e,r)}setHandle(e,r){this.handle!=null&&!r&&this.handle.destory(),this.handle=e,this.handle.setClient(this.consistencyManager.getClient())}destroy(){return new Promise(e=>{super.destroy().then(r=>{this.handle=null,e(r)})})}setTicket(e=this.consistencyManager.getMaxTicket()+1){this.handle.setTicket(e)}getHandle(){return this.handle}onBoard(e,r,i,n){this.handle.onBoard(e,r,i,n)}onDelBoard(e,r,i){this.handle.onDelBoard(e,r,i)}onLayerFill(e,r,i,n,s){this.handle.onLayerFill(e,r,i,n,s)}onDelLayerFill(e,r,i,n){this.handle.onDelLayerFill(e,r,i,n)}onBlob(e,r,i,n,s){this.handle.onBlob(e,r,i,n,s)}onDelBlob(e,r,i,n){this.handle.onDelBlob(e,r,i,n)}onFont(e,r,i,n){this.handle.onFont(e,r,i,n)}onDelFont(e,r,i,n){this.handle.onDelFont(e,r,i,n)}onString(e,r,i,n,s,a){this.handle.onString(e,r,i,n,s,a)}onDelString(e,r,i,n){this.handle.onDelString(e,r,i,n)}onAttr(e,r,i,n,s,a){this.handle.onAttr(e,r,i,n,s,a)}onDelAttr(e,r,i,n){this.handle.onDelAttr(e,r,i,n)}onPadNet(e,r,i,n){this.handle.onPadNet(e,r,i,n)}onDelPadNet(e,r,i,n,s,a){this.handle.onDelPadNet(e,r,n,i,s,a)}onComponent(e,r,i,n,s,a){this.handle.onComponent(e,r,i,n,s,a)}onDelComponent(e,r,i,n){this.handle.onDelComponent(e,r,i,n)}onPanelize(e,r,i,n){this.handle.onPanelize(e,r,i,n)}onDelPanelize(e,r,i){this.handle.onDelPanelize(e,r,i)}onRuleSelector(e,r,i,n){this.handle.onRuleSelector(e,r,i,n)}onDelRuleSelector(e,r,i,n){this.handle.onDelRuleSelector(e,r,i,n)}onRule(e,r,i,n){this.handle.onRule(e,r,i,n)}onDelRule(e,r,i,n,s){this.handle.onDelRule(e,r,i,n,s)}onRuleTemplate(e,r,i,n){this.handle.onRuleTemplate(e,r,i,n)}onDimension(e,r,i,n,s,a){this.handle.onDimension(e,r,i,n,s,a)}onDelDimension(e,r,i,n){this.handle.onDelDimension(e,r,i,n)}onBoss(e,r,i,n,s,a){this.handle.onBoss(e,r,i,n,s,a)}onDelBoss(e,r,i,n){this.handle.onDelBoss(e,r,i,n)}onShellEntity(e,r,i,n,s,a){this.handle.onShellEntity(e,r,i,n,s,a)}onDelShellEntity(e,r,i,n){this.handle.onDelShellEntity(e,r,i,n)}onShellCut(e,r,i,n,s,a){this.handle.onShellCut(e,r,i,n,s,a)}onDelShellCut(e,r,i,n){this.handle.onDelShellCut(e,r,i,n)}onCrease(e,r,i,n,s,a){this.handle.onCrease(e,r,i,n,s,a)}onDelCrease(e,r,i,n){this.handle.onDelCrease(e,r,i,n)}onShell(e,r,i,n,s,a){this.handle.onShell(e,r,i,n,s,a)}onDelShell(e,r,i,n){this.handle.onDelShell(e,r,i,n)}onFpcFill(e,r,i,n,s,a){this.handle.onFpcFill(e,r,i,n,s,a)}onDelFpcFill(e,r,i,n){this.handle.onDelFpcFill(e,r,i,n)}onTeardrop(e,r,i,n,s,a){this.handle.onTeardrop(e,r,i,n,s,a)}onDelTeardrop(e,r,i,n){this.handle.onDelTeardrop(e,r,i,n)}onImage(e,r,i,n,s,a){this.handle.onImage(e,r,i,n,s,a)}onDelImage(e,r,i,n){this.handle.onDelImage(e,r,i,n)}onPoured(e,r,i,n,s,a){this.handle.onPoured(e,r,i,n,s,a)}onDelPoured(e,r,i,n){this.handle.onDelPoured(e,r,i,n)}onPour(e,r,i,n,s,a){this.handle.onPour(e,r,i,n,s,a)}onDelPour(e,r,i,n){this.handle.onDelPour(e,r,i,n)}onRegion(e,r,i,n,s,a){this.handle.onRegion(e,r,i,n,s,a)}onDelRegion(e,r,i,n){this.handle.onDelRegion(e,r,i,n)}onFill(e,r,i,n,s,a){s.fillStyle!=N2.PLANE&&this.handle.onFill(e,r,i,n,s,a)}onDelFill(e,r,i,n){this.handle.onDelFill(e,r,i,n)}onPoly(e,r,i,n,s,a){this.handle.onPoly(e,r,i,n,s,a)}onDelPoly(e,r,i,n){this.handle.onDelPoly(e,r,i,n)}onEQLenGrp(e,r,i,n,s){this.handle.onEQLenGrp(e,r,i,n,s)}onDelEQLenGrp(e,r,i,n){this.handle.onDelEQLenGrp(e,r,i,n)}onObj(e,r,i,n,s,a){this.handle.onObj(e,r,i,n,s,a)}onDelObj(e,r,i,n){this.handle.onDelObj(e,r,i,n)}onArc(e,r,i,n,s,a){this.handle.onArc(e,r,i,n,s,a)}onDelArc(e,r,i,n){this.handle.onDelArc(e,r,i,n)}onLine(e,r,i,n,s,a){this.initFinished&&this.hasSynced.set(e,n),this.handle.onLine(e,r,i,n,s,a)}onDelLine(e,r,i,n){this.handle.onDelLine(e,r,i,n)}onPad(e,r,i,n,s,a){this.handle.onPad(e,r,i,n,s,a)}onDelPad(e,r,i,n){this.handle.onDelPad(e,r,i,n)}onVia(e,r,i,n,s,a){this.handle.onVia(e,r,i,n,s,a)}onDelVia(e,r,i,n){this.handle.onDelVia(e,r,i,n)}onPreference(e,r,i,n){this.handle.onPreference(e,r,i,n)}onSilkOpts(e,r,i,n,s){this.handle.onSilkOpts(e,r,i,n,s)}onDelSilkOpts(e,r,i,n){this.handle.onDelSilkOpts(e,r,i,n)}onGroup(e,r,i,n,s){this.handle.onGroup(e,r,i,n,s)}onDelGroup(e,r,i,n){this.handle.onDelGroup(e,r,i,n)}onPrimitive(e,r,i,n,s){this.handle.onPrimitive(e,r,i,n,s)}onDelPrimitive(e,r,i,n){this.handle.onDelPrimitive(e,r,i,n)}onNet(e,r,i,n,s){this.handle.onNet(e,r,i,n,s)}onDelNet(e,r,i,n){this.handle.onDelNet(e,r,i,n)}onPartition(e,r,i,n,s,a){this.handle.onPartition(e,r,i,n,s,a)}onDelPartition(e,r,i,n){this.handle.onDelPartition(e,r,i,n)}onActiveLayer(e,r,i,n){this.handle.onActiveLayer(e,r,i,n)}onLayerPhys(e,r,i,n,s){this.handle.onLayerPhys(e,r,i,n,s)}onDelLayerPhys(e,r,i,n){this.mgr.layerPhyFix.deleteLayerPhyId(e),this.handle.onDelLayerPhys(e,r,i,n)}onLayer(e,r,i,n,s){this.handle.onLayer(e,r,i,n,s)}onDelLayer(e,r,i,n){this.mgr.layerPhyFix.deleteLayerId(e),this.handle.onDelLayer(e,r,i,n)}onCanvas(e,r,i,n){this.handle.onCanvas(e,r,i,n)}onDocDetail(e,r,i,n){this.docDetail=i,this.handle.onDocDetail(e,r,i,n)}onStringNum(e,r){this.handle.onStringNum(e,r)}onAttrNum(e,r){this.handle.onAttrNum(e,r)}onComponentNum(e,r){this.handle.onComponentNum(e,r)}onDimensionNum(e,r){this.handle.onDimensionNum(e,r)}onBossNum(e,r){this.handle.onBossNum(e,r)}onShellEntityNum(e,r){this.handle.onShellEntityNum(e,r)}onShellCutNum(e,r){this.handle.onShellCutNum(e,r)}onCreaseNum(e,r){this.handle.onCreaseNum(e,r)}onShellNum(e,r){this.handle.onShellNum(e,r)}onFpcFillNum(e,r){this.handle.onFpcFillNum(e,r)}onTeardropNum(e,r){this.handle.onTeardropNum(e,r)}onImageNum(e,r){this.handle.onImageNum(e,r)}onPouredNum(e,r){this.handle.onPouredNum(e,r)}onPourNum(e,r){this.handle.onPourNum(e,r)}onRegionNum(e,r){this.handle.onRegionNum(e,r)}onFillNum(e,r){this.handle.onFillNum(e,r)}onPolyNum(e,r){this.handle.onPolyNum(e,r)}onObjNum(e,r){this.handle.onObjNum(e,r)}onArcNum(e,r){this.handle.onArcNum(e,r)}onLineNum(e,r){this.handle.onLineNum(e,r)}onPadNum(e,r){this.handle.onPadNum(e,r)}onViaNum(e,r){this.handle.onViaNum(e,r)}onPartitionNum(e,r){this.handle.onPartitionNum(e,r)}uploadRuleSelector(e){return e.ruleSelect.length==0?{success:!1,message:"rule selector data error."}:super.uploadRuleSelector(e)}};var OS=class extends c5e{constructor(e,r,i,n=x.getInstance().currOpenProjectId===r){super(e,r,n,i,void 0);this.mgr=new Fk}onXSignalsGroup(e,r,i,n,s){throw new Error("Method not implemented.")}onDelXSignalsGroup(e,r,i,n){throw new Error("Method not implemented.")}onXSignals(e,r,i,n,s){throw new Error("Method not implemented.")}onDelXSignals(e,r,i,n){throw new Error("Method not implemented.")}getDocDetail(){return this.docDetail}canvasSelected(){var e;return(e=this.selectHandle)==null?void 0:e.getSelect()}onSelectChange(e,r,i){var n;(n=this.selectHandle)==null||n.onSelected(e,r,i)}onSelectQuit(e,r){var i;(i=this.selectHandle)==null||i.onDestroy(e,r)}getHandle(){return this.handle}setHandle(e){this.handle!=null&&this.handle.destory(),this.handle=e,this.handle.setClient(this.consistencyManager.getClient())}destroy(){return this.handle=null,super.destroy()}setTicket(){this.handle.setTicket(this.consistencyManager.getMaxTicket()+1)}onLayerFill(e,r,i,n,s){this.handle.onLayerFill(e,r,i,n,s)}onDelLayerFill(e,r,i,n){this.handle.onDelLayerFill(e,r,i,n)}onBlob(e,r,i,n,s){this.handle.onBlob(e,r,i,n,s)}onDelBlob(e,r,i,n){this.handle.onDelBlob(e,r,i,n)}onFont(e,r,i,n){this.handle.onFont(e,r,i,n)}onDelFont(e,r,i,n){this.handle.onDelFont(e,r,i,n)}onGroup(e,r,i,n,s){this.handle.onGroup(e,r,i,n,s)}onDelGroup(e,r,i,n){this.handle.onDelGroup(e,r,i,n)}onString(e,r,i,n,s,a){this.handle.onString(e,r,i,n,s,a)}onDelString(e,r,i,n){this.handle.onDelString(e,r,i,n)}onAttr(e,r,i,n,s,a){this.handle.onAttr(e,r,i,n,s,a)}onDelAttr(e,r,i,n){this.handle.onDelAttr(e,r,i,n)}onPanelize(e,r,i,n){this.handle.onPanelize(e,r,i,n)}onDelPanelize(e,r,i){this.handle.onDelPanelize(e,r,i)}onRuleSelector(e,r,i,n){this.handle.onRuleSelector(e,r,i,n)}onDelRuleSelector(e,r,i,n){this.handle.onDelRuleSelector(e,r,i,n)}onRule(e,r,i,n){this.handle.onRule(e,r,i,n)}onDelRule(e,r,i,n,s){this.handle.onDelRule(e,r,i,n,s)}onRuleTemplate(e,r,i,n){this.handle.onRuleTemplate(e,r,i,n)}onDimension(e,r,i,n,s,a){this.handle.onDimension(e,r,i,n,s,a)}onDelDimension(e,r,i,n){this.handle.onDelDimension(e,r,i,n)}onBoss(e,r,i,n,s,a){this.handle.onBoss(e,r,i,n,s,a)}onDelBoss(e,r,i,n){this.handle.onDelBoss(e,r,i,n)}onShellEntity(e,r,i,n,s,a){this.handle.onShellEntity(e,r,i,n,s,a)}onDelShellEntity(e,r,i,n){this.handle.onDelShellEntity(e,r,i,n)}onShellCut(e,r,i,n,s,a){this.handle.onShellCut(e,r,i,n,s,a)}onDelShellCut(e,r,i,n){this.handle.onDelShellCut(e,r,i,n)}onCrease(e,r,i,n,s,a){this.handle.onCrease(e,r,i,n,s,a)}onDelCrease(e,r,i,n){this.handle.onDelCrease(e,r,i,n)}onShell(e,r,i,n,s,a){this.handle.onShell(e,r,i,n,s,a)}onDelShell(e,r,i,n){this.handle.onDelShell(e,r,i,n)}onFpcFill(e,r,i,n,s,a){this.handle.onFpcFill(e,r,i,n,s,a)}onDelFpcFill(e,r,i,n){this.handle.onDelFpcFill(e,r,i,n)}onTeardrop(e,r,i,n,s,a){let l={...s,width:.2,fillStyle:N2.SOLID,path:[s.path],locked:!1,zIndex:0};this.handle.onFill(e,r,i,n,l,a)}onDelTeardrop(e,r,i,n){this.handle.onDelTeardrop(e,r,i,n)}onImage(e,r,i,n,s,a){this.handle.onImage(e,r,i,n,s,a)}onDelImage(e,r,i,n){this.handle.onDelImage(e,r,i,n)}onPoured(e,r,i,n,s,a){this.handle.onPoured(e,r,i,n,s,a)}onDelPoured(e,r,i,n){this.handle.onDelPoured(e,r,i,n)}onPour(e,r,i,n,s,a){this.handle.onPour(e,r,i,n,s,a)}onDelPour(e,r,i,n){this.handle.onDelPour(e,r,i,n)}onRegion(e,r,i,n,s,a){this.handle.onRegion(e,r,i,n,s,a)}onDelRegion(e,r,i,n){this.handle.onDelRegion(e,r,i,n)}onFill(e,r,i,n,s,a){this.handle.onFill(e,r,i,n,s,a)}onDelFill(e,r,i,n){this.handle.onDelFill(e,r,i,n)}onPoly(e,r,i,n,s,a){this.handle.onPoly(e,r,i,n,s,a)}onDelPoly(e,r,i,n){this.handle.onDelPoly(e,r,i,n)}onEQLenGrp(e,r,i,n,s){this.handle.onEQLenGrp(e,r,i,n,s)}onDelEQLenGrp(e,r,i,n){this.handle.onDelEQLenGrp(e,r,i,n)}onObj(e,r,i,n,s,a){this.handle.onObj(e,r,i,n,s,a)}onDelObj(e,r,i,n){this.handle.onDelObj(e,r,i,n)}onArc(e,r,i,n,s,a){this.handle.onArc(e,r,i,n,s,a)}onDelArc(e,r,i,n){this.handle.onDelArc(e,r,i,n)}onLine(e,r,i,n,s,a){this.handle.onLine(e,r,i,n,s,a)}onDelLine(e,r,i,n){this.handle.onDelLine(e,r,i,n)}onPad(e,r,i,n,s,a){this.handle.onPad(e,r,i,n,s,a)}onDelPad(e,r,i,n){this.handle.onDelPad(e,r,i,n)}onVia(e,r,i,n,s,a){this.handle.onVia(e,r,i,n,s,a)}onDelVia(e,r,i,n){this.handle.onDelVia(e,r,i,n)}onPreference(e,r,i,n){this.handle.onPreference(e,r,i,n)}onSilkOpts(e,r,i,n,s){this.handle.onSilkOpts(e,r,i,n,s)}onDelSilkOpts(e,r,i,n){this.handle.onDelSilkOpts(e,r,i,n)}onPrimitive(e,r,i,n,s){this.handle.onPrimitive(e,r,i,n,s)}onDelPrimitive(e,r,i,n){this.handle.onDelPrimitive(e,r,i,n)}onNet(e,r,i,n,s){this.handle.onNet(e,r,i,n,s)}onDelNet(e,r,i,n){this.handle.onDelNet(e,r,i,n)}onPartition(e,r,i,n,s,a){this.handle.onPartition(e,r,i,n,s,a)}onDelPartition(e,r,i,n){this.handle.onDelPartition(e,r,i,n)}onActiveLayer(e,r,i,n){this.handle.onActiveLayer(e,r,i,n)}onLayerPhys(e,r,i,n,s){this.handle.onLayerPhys(e,r,i,n,s)}onDelLayerPhys(e,r,i,n){this.mgr.layerPhyFix.deleteLayerPhyId(e),this.handle.onDelLayerPhys(e,r,i,n)}onLayer(e,r,i,n,s){this.mgr.layerPhyFix.deleteLayerId(e),this.handle.onLayer(e,r,i,n,s)}onDelLayer(e,r,i,n){this.handle.onDelLayer(e,r,i,n)}onCanvas(e,r,i,n){this.handle.onCanvas(e,r,i,n)}onDocDetail(e,r,i,n){this.docDetail=i,this.handle.onDocDetail(e,r,i,n)}onBoard(e,r,i,n){this.handle.onBoard(e,r,i,n)}onDelBoard(e,r,i){this.handle.onDelBoard(e,r,i)}onStringNum(e,r){this.handle.onStringNum(e,r)}onAttrNum(e,r){this.handle.onAttrNum(e,r)}onDimensionNum(e,r){this.handle.onDimensionNum(e,r)}onBossNum(e,r){this.handle.onBossNum(e,r)}onShellEntityNum(e,r){this.handle.onShellEntityNum(e,r)}onShellCutNum(e,r){this.handle.onShellCutNum(e,r)}onCreaseNum(e,r){this.handle.onCreaseNum(e,r)}onShellNum(e,r){this.handle.onShellNum(e,r)}onFpcFillNum(e,r){this.handle.onFpcFillNum(e,r)}onTeardropNum(e,r){this.handle.onTeardropNum(e,r)}onImageNum(e,r){this.handle.onImageNum(e,r)}onPouredNum(e,r){this.handle.onPouredNum(e,r)}onPourNum(e,r){this.handle.onPourNum(e,r)}onRegionNum(e,r){this.handle.onRegionNum(e,r)}onFillNum(e,r){this.handle.onFillNum(e,r)}onPolyNum(e,r){this.handle.onPolyNum(e,r)}onObjNum(e,r){this.handle.onObjNum(e,r)}onArcNum(e,r){this.handle.onArcNum(e,r)}onLineNum(e,r){this.handle.onLineNum(e,r)}onPadNum(e,r){this.handle.onPadNum(e,r)}onViaNum(e,r){this.handle.onViaNum(e,r)}onPartitionNum(e,r){this.handle.onPartitionNum(e,r)}uploadRuleSelector(e){return e.ruleSelect.length==0?{success:!1,message:"rule selector data error."}:super.uploadRuleSelector(e)}};var Vr=Math.PI*2,Tu=Math.PI,es=Math.PI/2,Rl=Math.sin(Math.PI/180);var Qc=.003937,ur="e",nA=5e4,oA=5e4;var pz=class pz{constructor(){this.param=null;this._visible=T1.SHOW;this._flip=!1;this._currentCoord=!0;this._gridColor=ee.WHITE;this._transparency=.3;this._multiGridColor=ee.WHITE;this._multiTransparency=.55;this._coordinateAxisColor=ee.WHITE;this._coordinateAxisTransparency=1;this._stepX=.5;this._stepY=.5;this._snapX=.5;this._snapY=.5;this._pattern=!0;this._multiRatio=5;this._multiStyle=bS.None;this._angleDelta=Math.PI/4;this._startAngle=0;this._endAngle=Vr;this._step=39.37;this._minRadius=3.937;this._maxRadius=393.7;this._renderGrid=!0}static getInstance(){return this.ins==null&&(this.ins=new pz),this.ins}modify(t,e,r,i,n){this._stepX=t,this._stepY=e,this._snapX=r,this._snapY=i,this._pattern=n,this.param!=null&&this.param.modify(t,e,r,i,n)}attach(t){this.param=t,this.param!=null&&(this.param.visible=this._visible,this.param.flip=this._flip,this.param.currentCoord=this._currentCoord,this.param.gridColor=this._gridColor,this.param.transparency=this._transparency,this.param.multiGridColor=this._multiGridColor,this.param.multiTransparency=this._multiTransparency,this.param.coordinateAxisColor=this._coordinateAxisColor,this.param.coordinateAxisTransparency=this._coordinateAxisTransparency,this.param.modify(this._stepX,this._stepY,this._snapX,this._snapY,this._pattern),this.param.setMultiRatio(this._multiRatio),this.param.setMultiStyle(this._multiStyle),this.param.angleDelta=this._angleDelta,this.param.startAngle=this._startAngle,this.param.endAngle=this._endAngle,this.param.radius=this._step,this.param.minRadius=this._minRadius,this.param.maxRadius=this._maxRadius)}set visible(t){this._visible=t,this.param!=null&&(this.param.visible=t)}get visible(){var t;return((t=this.param)==null?void 0:t.visible)||this._visible}set renderGrid(t){this._renderGrid=t,this.param!=null&&(this.param.renderGrid=t)}get renderGrid(){var t;return((t=this.param)==null?void 0:t.renderGrid)||this._renderGrid}get flip(){var t;return((t=this.param)==null?void 0:t.flip)||this._flip}set flip(t){this._flip=t,this.param!=null&&(this.param.flip=t)}get gridColor(){var t;return((t=this.param)==null?void 0:t.gridColor)||this._gridColor}set gridColor(t){this._gridColor=t,this.param!=null&&(this.param.gridColor=t)}get currentCoord(){var t;return((t=this.param)==null?void 0:t.currentCoord)||this._currentCoord}set currentCoord(t){this._currentCoord=t,this.param!=null&&(this.param.currentCoord=t)}get minRadius(){var t;return((t=this.param)==null?void 0:t.minRadius)||this._minRadius}set minRadius(t){this._minRadius=t,this.param!=null&&(this.param.minRadius=t)}get maxRadius(){var t;return((t=this.param)==null?void 0:t.maxRadius)||this._maxRadius}set maxRadius(t){this._maxRadius=t,this.param!=null&&(this.param.maxRadius=t)}get angleDelta(){var t;return((t=this.param)==null?void 0:t.angleDelta)||this._angleDelta}set angleDelta(t){this._angleDelta=t,this.param!=null&&(this.param.angleDelta=t)}get radius(){var t;return((t=this.param)==null?void 0:t.radius)||this._step}set radius(t){this._step=t,this.param!=null&&(this.param.radius=t)}get startAngle(){var t;return((t=this.param)==null?void 0:t.startAngle)||this._startAngle}set startAngle(t){t%=Vr,t<0&&(t+=Vr),this._startAngle=t,this.param!=null&&(this.param.startAngle=t)}get endAngle(){var t;return((t=this.param)==null?void 0:t.endAngle)||this._endAngle}set endAngle(t){this._endAngle=t,this.param!=null&&(this.param.endAngle=t)}get sweepAngle(){var e;let t=(e=this.param)==null?void 0:e.sweepAngle;return t==null?this.endAngle>this.startAngle?this.endAngle-this.startAngle:this.endAngle-this.startAngle+Vr:t}updateGridParam(t,e,r,i){let n=t?T1.SHOW:T1.ONLYAXIS;this._stepX=e,this._stepY=r,t!==void 0&&(this.visible=n),i!==void 0&&(this._pattern=i),this.param!=null&&this.param.updateGridParam(t,e,r,i)}setGridX(t){t>0&&(this._stepX=t),this.param!=null&&this.param.setGridX(t)}getGridX(){var t;return((t=this.param)==null?void 0:t.getGridX())||this._stepX}setGridY(t){t>0&&(this._stepY=t),this.param!=null&&this.param.setGridY(t)}getGridY(){var t;return((t=this.param)==null?void 0:t.getGridY())||this._stepY}getMultiRatio(){var t;return((t=this.param)==null?void 0:t.getMultiRatio())||this._multiRatio}setMultiRatio(t){t>=1&&(this._multiRatio=t),this.param!=null&&this.param.setMultiRatio(t)}getMultiStyle(){var t;return((t=this.param)==null?void 0:t.getMultiStyle())||this._multiStyle}setMultiStyle(t){this._multiStyle=t,this.param!=null&&this.param.setMultiStyle(t)}setSnapX(t){t>0&&(this._snapX=t),this.param!=null&&this.param.setSnapX(t)}getSnapX(){var t;return((t=this.param)==null?void 0:t.getSnapX())||this._snapX}setSnapY(t){t>0&&(this._snapY=t),this.param!=null&&this.param.setSnapY(t)}getSnapY(){var t;return((t=this.param)==null?void 0:t.getSnapY())||this._snapY}get pattern(){var t;return((t=this.param)==null?void 0:t.pattern)||this._pattern}set pattern(t){this._pattern=t,this.param!=null&&(this.param.pattern=t)}get transparency(){var t;return((t=this.param)==null?void 0:t.transparency)||this._transparency}set transparency(t){this._transparency=t,this.param!=null&&(this.param.transparency=t)}get multiGridColor(){var t;return((t=this.param)==null?void 0:t.multiGridColor)||this._multiGridColor}set multiGridColor(t){this._multiGridColor=t,this.param!=null&&(this.param.multiGridColor=t)}get multiTransparency(){var t;return((t=this.param)==null?void 0:t.multiTransparency)||this._multiTransparency}set multiTransparency(t){this._multiTransparency=t,this.param!=null&&(this.param.multiTransparency=t)}get coordinateAxisColor(){var t;return((t=this.param)==null?void 0:t.coordinateAxisColor)||this._coordinateAxisColor}set coordinateAxisColor(t){this._coordinateAxisColor=t,this.param!=null&&(this.param.coordinateAxisColor=t)}get coordinateAxisTransparency(){var t;return((t=this.param)==null?void 0:t.coordinateAxisTransparency)||this._coordinateAxisTransparency}set coordinateAxisTransparency(t){this._coordinateAxisTransparency=t,this.param!=null&&(this.param.coordinateAxisTransparency=t)}};pz.scenes=[],pz.ins=null;var St=pz;var _I=class _I{constructor(){this._isConcurrentStrictMode=!1;this._isReadOnlyMode=!1;this._origin=S.ORIGIN;this._doctype=0;this._id="";this._tabId="";this._isactive=!1;this._owner=null;this._customerCode=void 0;this._clientOnlineService=void 0;this._unit="mil";this.scenes=new Array(0);this._footprintIsConnectDevice=!1;this._editorVersion="";this._projectTitle="";this._importFlag=0;this._source="";this._envFlag=null;this.partitionId="";this.name="";this.currOpenProjectId=void 0;this.currVersionUUid=void 0;this._compiler=null;this._altGridSize={GridX:{number:5,unit:this.unit},GridY:{number:5,unit:this.unit}};this._gridType="grid";this._multiType="none";this._multiRatio=5;this._forceDeactive=!1;this._forceValue=.5;this.highLightModeIsDark=!0;this._forceVisibleHighLightPt=!1;this._forceVisibleRange=!1;this._backgroundColor=ee.build(0,0,0,1);this._openRuler=!1;this._rulerBackgroundColor=null;this._rulerStringColor=null;this.antialias=!1;this._needRenderPanelize=!1;this._renderMode=D2e.USE_COLOR;this.time=new Date().getTime();this.num=Math.floor(Math.random()*100);this._panelizeParam={success:!1,on:!1,row:1,column:1,offset:new S(0,0),onlyOutline:!0};this._coreRenderingEngine="auto";this._isPreview=!1;this.compilerChannel=new FPe;this._isHistoryMode=!1;this.workerName="";this.needNum=!0}static getInstance(){return _I.env==null&&(_I.env=new _I),_I.env}get isPreview(){return this._isPreview}set isPreview(t){this._isPreview=t,t&&(this.openRuler=!1)}get isHistoryMode(){return this._isHistoryMode}set isHistoryMode(t){this._isHistoryMode=t}get compiler(){return this._compiler==null&&(this._doctype==4?this._compiler=new OS(this._id,this.projectId,this.compilerChannel,void 0):this._doctype==3?(this._compiler=new Pu(this._id,this.projectId,this.compilerChannel,void 0),this._compiler.consistencyManager.setIsLocalChange(!1),this._compiler.consistencyManager.setIsPendChange(!1)):(this._compiler=new Pu(this._id,this.projectId,this.compilerChannel,void 0),this._compiler.consistencyManager.setIsLocalChange(!1),this._compiler.consistencyManager.setIsPendChange(!1))),this._compiler}get channel(){return(this.time+this.num).toString()}async resetCompiler(){this._compiler&&(await this._compiler.destroy(),this._compiler=null)}modify(t,e,r,i,n,s,a,l){this.doctype=t,this.id=e,this.tabId=r,this.isactive=i,this.owner=n,this.customerCode=s,this.name=a,this.origin=l}get gridType(){return this._gridType}set gridType(t){if(t!=null&&this._gridType!=t&&St.getInstance().visible!=T1.NOTSHOW)switch(this._gridType=t,t){case"grid":St.getInstance().pattern=!0,St.getInstance().visible=T1.SHOW;break;case"outlets":St.getInstance().pattern=!1,St.getInstance().visible=T1.SHOW;break;case"none":St.getInstance().visible=T1.ONLYAXIS;break}}get altGridSize(){return this._altGridSize}set altGridSize(t){this._altGridSize=t}getAltGridSize(){let t=this._altGridSize.GridX,e=this._altGridSize.GridY,r=t.number/10,i=e.number/10,n=new ft;return _I.getInstance().unit=="mil"?t.unit!=_I.getInstance().unit&&(r=n.conversion(t.unit,_I.getInstance().unit,r),i=n.conversion(e.unit,_I.getInstance().unit,i)):t.unit==_I.getInstance().unit&&(r=n.conversion(t.unit,"mil",r),i=n.conversion(e.unit,"mil",i)),{snapX:r,snapY:i}}set forceValue(t){this._forceDeactive&&this._forceValue!=t&&this.updateForceDeactivateRatio(t,this._forceDeactive),this._forceValue=t}get forceValue(){return this._forceValue}set forceDeactive(t){this._forceDeactive=t,this.updateForceDeactivateRatio(this._forceValue,t)}updateForceDeactivateRatio(t,e){t=t>.99?.99:t;for(let r of this.scenes)r.setForceDeactivateRatio(e?t:1)}set forceVisibleHighLightPt(t){this._forceVisibleHighLightPt=t,this.forceVisible()}set forceVisibleHighRange(t){this._forceVisibleRange!=t&&(this._forceVisibleRange=t,this.forceVisible())}get forceVisibleHighRange(){return this._forceVisibleRange}forceVisible(){let t=this._forceVisibleRange&&this._forceVisibleHighLightPt;for(let e of this.scenes)e.setForceVisibleHighLightPt(t)}setHighLightMode(t){if(this.highLightModeIsDark!=t){for(let e of this.scenes)e.setGlobalHighLightType(t?$P.PT:$P.MASK);this.highLightModeIsDark=t}}get forceVisibleHighLightPt(){return this._forceVisibleHighLightPt}get forceDeactive(){return this._forceDeactive}get projectTitle(){return this._projectTitle}set projectTitle(t){this._projectTitle=t||""}get editorVersion(){return this._editorVersion}set editorVersion(t){this._editorVersion=t||""}get isReadOnlyMode(){return this._isReadOnlyMode}set isReadOnlyMode(t){this._isReadOnlyMode=t}get isConcurrentStrictMode(){return this._isConcurrentStrictMode}set isConcurrentStrictMode(t){this._isConcurrentStrictMode=t}get importFlag(){return this._importFlag}set importFlag(t){this._importFlag=t||0}get source(){return this._source}set source(t){this._source=t||""}get envFlag(){return this._envFlag}set envFlag(t){this._envFlag=t}get multiType(){return this._multiType}set multiType(t){let e=St.getInstance();if(this._multiType!=t&&e.visible!=T1.NOTSHOW)switch(this._multiType=t,t){case"grid":e.setMultiStyle(bS.Line);break;case"outlets":e.setMultiStyle(bS.Point);break;case"none":e.setMultiStyle(bS.None);break}}get multiRatio(){return this._multiRatio}set multiRatio(t){let e=St.getInstance();this._multiRatio!=t&&(this._multiRatio=t,e.setMultiRatio(t))}get unit(){return this._unit}set unit(t){this._unit=t;for(let e of this.scenes)e.modifyUnit(t)}get projectId(){let t=this._tabId.split("@");return t.length>=2?t[1]:""}getRatio(){for(let t of this.scenes)return(t==null?void 0:t.getPixelRatio())||1;return 1}attachScene(t){return!this.scenes.includes(t)&&t!=null&&(this.scenes.push(t),t.modifyUnit(this._unit),t.modifyBgColor(this._backgroundColor),t.resize(),t.setAntialias(this.antialias),t.openRuler=this._openRuler,this._rulerBackgroundColor&&t.setRulerBackgroundColor(this._rulerBackgroundColor),this._rulerStringColor&&t.setRulerStringColor(this._rulerStringColor),t.needRenderPanelize=this._needRenderPanelize,t.setRenderMode(this._renderMode),t.group.setRenderMode(this._renderMode),this._panelizeParam.success&&!this._panelizeParam.onlyOutline?t.setPanelizeInfo(this._panelizeParam.offset,this._panelizeParam.row,this._panelizeParam.column):t.setPanelizeInfo(),t.setForceVisibleHighLightPt(this._forceVisibleRange&&this._forceVisibleHighLightPt),t.setGlobalHighLightType(this.highLightModeIsDark?$P.PT:$P.MASK)),!0}getBgColor(){return this._backgroundColor}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t;for(let e of this.scenes)e.modifyBgColor(t)}get rulerBackgroundColor(){return this._rulerBackgroundColor}set rulerBackgroundColor(t){if(this._rulerBackgroundColor=t,t!=null)for(let e of this.scenes)e.setRulerBackgroundColor(t)}get rulerStringColor(){return this._rulerStringColor}set rulerStringColor(t){if(this._rulerStringColor=t,t!=null)for(let e of this.scenes)e.setRulerStringColor(t)}resize(t,e){for(let r of this.scenes)r.resize()}get openRuler(){return this._openRuler}set openRuler(t){this._openRuler=t;for(let e of this.scenes)e.openRuler=t}get needRenderPanelize(){return this._needRenderPanelize}set needRenderPanelize(t){this._needRenderPanelize=t;for(let e of this.scenes)e.needRenderPanelize=t}get renderMode(){return this._renderMode}set renderMode(t){this._renderMode=t;for(let e of this.scenes)e.setRenderMode(t),e.group.setRenderMode(t)}getAntialias(){return this.antialias}setAntialias(t){this.antialias=t;for(let e of this.scenes)e.setAntialias(t)}get origin(){return this._origin}set origin(t){this._origin=t,this.scenes.forEach(e=>{e.setOrigin(this._origin)})}get customerCode(){return this._customerCode}set customerCode(t){this._customerCode=t}get owner(){return this._owner}set owner(t){this._owner=t}get clientOnlineService(){return this._clientOnlineService}set clientOnlineService(t){this._clientOnlineService=t}get doctype(){return this._isPreview&&(this._doctype==4||this._doctype==3)?23:this._doctype}set doctype(t){this._doctype=t}get id(){return this._id}set id(t){this._id=t}get tabId(){return this._tabId}set tabId(t){this._tabId=t}get isactive(){return this._isactive}set isactive(t){this._isactive=t}get footprintIsConnectDevice(){return this._footprintIsConnectDevice}set footprintIsConnectDevice(t){this._footprintIsConnectDevice=t}get panelizeParam(){return this._panelizeParam}set panelizeParam(t){this._panelizeParam=t,this.scenes.forEach(e=>{this._panelizeParam.success&&!this._panelizeParam.onlyOutline?e.setPanelizeInfo(this._panelizeParam.offset,this._panelizeParam.row,this._panelizeParam.column):e.setPanelizeInfo()})}get coreRenderingEngine(){return this._coreRenderingEngine}set coreRenderingEngine(t){typeof t<"u"&&this._coreRenderingEngine!=t&&(this._coreRenderingEngine=t)}getSceneBbox(){let t=new Xm;return this.scenes.forEach(e=>{t.ext4(e.getBBox3())}),t.build()}};_I.env=null;var x=_I;var nM=null,VPe=12e3;function Ni(){return nM||(nM=new xv(null,1920,1080),nM.setCameraDirect(!0),nM.setCameraType(!0),nM.setRotatable(!1),nM.setObject(Mt.ORIGIN,VPe)),nM}function vI(o,t,e){!o||!t||(o.adapt1(t,e),egt(o))}function egt(o){if(!o)return;let t=o.getScale(),e=o.getMinScale();t<e&&o.setMinScale(t)}var Ya={useWebgl:!1,multiThreadingOnOpen:!1,rebuildingRatlineInWorker:!1,needFlushService:!1,modelIsBuilt:!1,controllerIsBuilt:!1,engineHighlightReady:!0};var tgt=Object.create,qTe=Object.defineProperty,rgt=Object.getOwnPropertyDescriptor,igt=Object.getOwnPropertyNames,ngt=Object.getPrototypeOf,ogt=Object.prototype.hasOwnProperty,Vk=(o=>typeof wd<"u"?wd:typeof Proxy<"u"?new Proxy(o,{get:(t,e)=>(typeof wd<"u"?wd:t)[e]}):o)(function(o){if(typeof wd<"u")return wd.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')}),sgt=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),agt=(o,t)=>{for(var e in t)qTe(o,e,{get:t[e],enumerable:!0})},lgt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of igt(t))!ogt.call(o,i)&&i!==e&&qTe(o,i,{get:()=>t[i],enumerable:!(r=rgt(t,i))||r.enumerable});return o},Wz=(o,t,e)=>(e=o!=null?tgt(ngt(o)):{},lgt(t||!o||!o.__esModule?qTe(e,"default",{value:o,enumerable:!0}):e,o)),zz=sgt((o,t)=>{"use strict";var e=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,s=(j,J)=>{for(var oe in J)e(j,oe,{get:J[oe],enumerable:!0})},a=(j,J,oe,pe)=>{if(J&&typeof J=="object"||typeof J=="function")for(let ge of i(J))!n.call(j,ge)&&ge!==oe&&e(j,ge,{get:()=>J[ge],enumerable:!(pe=r(J,ge))||pe.enumerable});return j},l=j=>a(e({},"__esModule",{value:!0}),j),c={};s(c,{BroadcastChannelMessageBus:()=>Q,MessageBus:()=>L,MessageBus2:()=>X,MessageBusTask:()=>W,MessageBusTask2:()=>V,WindowMessageBridge:()=>G,WorkerMessageBridge:()=>z,createBroadcastP2PStream:()=>me,createBufferedByteBufferStream:()=>K,createBufferedStream:()=>re,createBufferedStringStream:()=>se,dropP2PStream:()=>Oe,flowRead:()=>Pe,flowWrite:()=>ue}),t.exports=l(c);var h=class{constructor(j=1.5){this.growthFactor=j,this.capacity=10,this.buffer=new Array(this.capacity),this.head=0,this.tail=0,this.count=0}enqueue(j){if(this.count===this.capacity){let J=Math.floor(this.capacity*this.growthFactor);console.log("grow",this.capacity,J);let oe=new Array(J);for(let pe=0;pe<this.count;pe++)oe[pe]=this.buffer[(this.head+pe)%this.capacity];this.buffer=oe,this.head=0,this.tail=this.count,this.capacity=J}this.buffer[this.tail]=j,this.tail=(this.tail+1)%this.capacity,this.count++}dequeue(){if(this.isEmpty())return;let j=this.buffer[this.head];return this.head=(this.head+1)%this.capacity,this.count--,j}peek(){return this.buffer[this.head]}isEmpty(){return this.count===0}clear(){this.buffer.length=0,this.head=0,this.tail=0,this.count=0}},u=new ArrayBuffer(8),d=new Float64Array(u),p=new Uint32Array(u),m=new Uint16Array(u),g=ArrayBuffer;try{g=self.HTMLImageElement||g}catch{}var y=typeof SharedArrayBuffer<"u";function b(j){if(typeof j!="object"||j===null||j instanceof Date||j instanceof ArrayBuffer||y&&j instanceof SharedArrayBuffer||j instanceof Blob||j instanceof FormData||j instanceof Function||j instanceof Uint8ClampedArray||j instanceof g)return j;if(Array.isArray(j))return j.map(b);{let J={};for(let oe in j)Object.hasOwnProperty.call(j,oe)&&(J[oe]=b(j[oe]));return J}}function P(j,J){return T(j,J,()=>[])}function T(j,J,oe){let pe=j[J];return pe!==void 0||(pe=oe(J),j[J]=pe),pe}var I=class{constructor(j){this.maxResources=j,this.idle=new h,this.isClosed=!1,this.resources=j}acquire(j){this.isClosed?Promise.resolve(!1).then(j):this.resources>0?(this.resources--,Promise.resolve(!0).then(j)):this.idle.enqueue(j)}acquireSync(){return new Promise(j=>{this.acquire(j)})}release(){if(!this.isClosed){let j=this.idle.dequeue();j?Promise.resolve(!0).then(j):this.resources++}}close(){if(!this.isClosed)for(this.isClosed=!0;!this.idle.isEmpty();){let j=this.idle.dequeue();Promise.resolve(!1).then(j)}}};function C(){if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis;if(typeof global<"u")return global}function E(j,J){let oe=0,pe=j.length;for(let ge=0;ge<pe;ge++)j[ge]===J&&(j.splice(ge,1),ge--,pe--,oe++);return oe}var O=C(),_=O.WeakRef||(j=>j);function R(j){if(j!=null){if(typeof j=="object")return new _(j);console.error(j,j instanceof Object,typeof j);return}}function v(j){return j==null?void 0:j.deref()}var D="_MSG_BUS_RPC_",w=300*1e3,F=(j=>(j.PUBLISH="publish",j.SUBSCRIBE="subscribe",j.PUSH="push",j.PULL="pull",j))(F||{}),H=class{constructor(j){this.bus=j}processRemoteMessage(j,J){let oe=R(J),pe=j.topic,ge=j.type,Se=j.message;switch(ge){case"pull":this.bus.pull(pe,De=>{this.push(pe,De,v(oe))});break;case"subscribe":this.bus.subscribe(pe,De=>{this.publish(pe,De,v(oe))});break;case"publish":this.bus.publish(pe,Se,this,v(oe));break;case"push":this.bus.push(pe,Se,this,v(oe));break;default:console.debug("unknown message type "+ge)}}rpcCall(j,J,oe,pe=w){let ge=R(oe),Se=new Promise(De=>{let tt=this.bus.uniqueRpcTopic(j);this.publish(j,{message:J,reply:tt},v(ge)),this.bus.pull(tt,(Ze,Wt,Nr)=>{De({message:Ze,bridge:Wt,source:R(Nr)})})});return pe>0?Promise.race([Se,new Promise((De,tt)=>{setTimeout(tt,pe)})]):Se}},z=class extends H{constructor(j,J){super(j),this.worker=J,J.onmessage=oe=>{this.processRemoteMessage(oe.data,void 0)}}publish(j,J){this.postMessage(j,"publish",J)}subscribe(j){this.postMessage(j,"subscribe",null)}push(j,J){this.postMessage(j,"push",J)}pull(j){this.postMessage(j,"pull",null)}rpcCall(j,J,oe=w){return super.rpcCall(j,J,void 0,oe)}postMessage(j,J,oe){let pe={topic:j,type:J,message:oe};this.worker.postMessage(pe)}discard(){this.worker.terminate()}},G=class extends H{constructor(j){super(j),window.addEventListener("message",J=>{this.processRemoteMessage(J.data,J.source)},!1)}publish(j,J,oe){this.postMessage(j,"publish",J,oe)}subscribe(j,J){if(J===window)throw new Error("regist remote subscribe from current window is not permitted");this.postMessage(j,"subscribe",null,J)}push(j,J,oe){this.postMessage(j,"push",J,oe)}pull(j,J){if(J===window)throw new Error("regist remote pull from current window is not permitted");this.postMessage(j,"pull",null,J)}postMessage(j,J,oe,pe){let ge={topic:j,type:J,message:oe};pe&&pe.postMessage(ge,"*")}},W=class{constructor(j){this.isRunning=!0,this.callback=j}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}execute(j,J,oe,pe){try{j=pe?j:b(j),this.callback(j,J,oe)}catch(ge){console.error(ge)}}},L=class{constructor(j=!1){this.subscribed={},this.pulled={},this.pushed={},this.uuid=crypto.randomUUID().replace(/-/g,""),this.rpcTicket=0,this.unsafe=j}uniqueRpcTopic(j){return`${D}-${j}-${this.uuid}-${this.rpcTicket++}`}publish(j,J,oe,pe){let ge=this.subscribed[j];if(ge){let Se;for(let De of ge)De.running()?De.execute(J,oe,pe,this.unsafe):(Se=Se||new Array,Se.push(De));if(Se)for(let De of Se)E(ge,De)}else console.debug("no sub on topic: "+j)}subscribe(j,J){let oe=new W(J);return P(this.subscribed,j).push(oe),oe}push(j,J,oe,pe){let ge=!1,Se=this.pulled[j];if(Se){for(;Se.length>0;){let De=Se.shift();if(De.running()){De.execute(J,oe,pe,this.unsafe),ge=!0;break}}Se.length===0&&delete this.pulled[j]}ge||P(this.pushed,j).push({message:J,bridge:oe,source:R(pe)})}pull(j,J){let oe=new W(J),pe=this.pushed[j];if(pe){let ge=pe.shift();oe.execute(ge.message,ge.bridge,v(ge.source),this.unsafe),pe.length===0&&delete this.pushed[j]}else P(this.pulled,j).push(oe);return oe}pullA(j){return new Promise(J=>{this.pull(j,(oe,pe,ge)=>{J({message:oe,bridge:pe,source:R(ge)})})})}rpcService(j,J){this.subscribe(j,(oe,pe,ge)=>{let{message:Se,reply:De}=oe;try{let tt=J(Se);if(tt instanceof Promise){let Ze=R(ge);tt.then(Wt=>{this.rpcReply(Wt,De,pe,v(Ze))},Wt=>{console.error(Wt),this.rpcReply(void 0,De,pe,v(Ze))})}else this.rpcReply(tt,De,pe,ge)}catch(tt){console.error(tt),this.rpcReply(void 0,De,pe,ge)}})}rpcCall(j,J,oe=w){let pe=new Promise(ge=>{let Se=this.uniqueRpcTopic(j);this.publish(j,{message:J,reply:Se}),this.pull(Se,(De,tt,Ze)=>{ge({message:De,bridge:tt,source:R(Ze)})})});return oe>0?Promise.race([pe,new Promise((ge,Se)=>{setTimeout(Se,oe)})]):pe}rpcReply(j,J,oe,pe){oe?oe.push(J,j,pe):this.push(J,j)}},B="_MSG_BUS_RPC_";function N(j,J){let oe=0,pe=j.length;for(let ge=0;ge<pe;ge++)j[ge]===J&&(j.splice(ge,1),ge--,pe--,oe++);return oe}function U(j,J){return k(j,J,()=>[])}function k(j,J,oe){let pe=j[J];return pe!==void 0||(pe=oe(J),j[J]=pe),pe}var V=class{constructor(j,J){this.callback=j,this.unsafe=J,this.isRunning=!0}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}async execute(j){try{j=this.unsafe?j:b(j),this.callback(j)}catch(J){console.error(J)}}},Y=class{constructor(j=crypto.randomUUID()){this.uuid=j,this.rpcTicket=0}subscribeOnce(j,J){let oe=this.subscribe(j,pe=>{oe.cancel(),J(pe)});return oe}pullA(j){return new Promise(J=>{this.pull(j,J)})}rpcService(j,J){let oe=pe=>{try{let{message:ge,replyTopic:Se}=pe;try{let De=J(ge);De instanceof Promise?De.then(tt=>{this.publish(Se,{success:!0,result:tt})}).catch(tt=>{console.error(tt),this.publish(Se,{success:!1,err:String(tt)})}):this.publish(Se,{success:!0,result:De})}catch(De){this.publish(Se,{success:!1,err:String(De)})}}finally{this.pull(j,oe)}};this.pull(j,oe)}rpcCall(j,J,oe=0){let pe=new Promise((ge,Se)=>{let De=`${B}-${j}-${this.uuid}-${this.rpcTicket++}`;this.subscribeOnce(De,tt=>{tt.success?ge(tt.result):Se(new Error(tt.err))}),this.push(j,{message:J,replyTopic:De})});return oe>0?Promise.race([pe,new Promise((ge,Se)=>{setTimeout(Se,oe)})]):pe}},X=class extends Y{constructor(j=!1){super(),this.unsafe=j,this.subscribed={},this.pulled={},this.pushed={}}publish(j,J){let oe=this.subscribed[j];if(oe){let pe;for(let ge of oe)ge.running()?ge.execute(J):(pe=pe||new Array,pe.push(ge));if(pe)for(let ge of pe)N(oe,ge)}}subscribe(j,J){let oe=new V(J,this.unsafe);return U(this.subscribed,j).push(oe),oe}push(j,J){let oe=!1,pe=this.pulled[j];if(pe){for(;pe.length>0;){let ge=pe.shift();if(ge&&ge.running()){ge.execute(J),oe=!0;break}}pe.length===0&&delete this.pulled[j]}oe||U(this.pushed,j).push(J)}pull(j,J){let oe=new V(J,this.unsafe);return this.repull(j,oe),oe}repull(j,J){let oe=this.pushed[j];if(oe){let pe=oe.shift();pe&&(J.execute(pe),oe.length===0&&delete this.pushed[j])}else U(this.pulled,j).push(J)}},Z=class extends Y{constructor(j=crypto.randomUUID()){super(j),this.subscribed={},this.pushed={},this.pulled={},this.pushCnt=0}publish(j,J){console.debug("BC",this.uuid,"PUBLISH",j,J),this.broadcastPublish(j,J)}subscribe(j,J){console.debug("BC",this.uuid,"SUBSCRIBE",j);let oe=new V(J,!0);return U(this.subscribed,j).push(oe),oe}push(j,J){let oe=this.pushCnt++;console.debug("BC",this.uuid,"PUSH",j,`(${oe})`,J),U(this.pushed,j).push({id:oe,message:J}),this.broadcastPushedHeadMessage(j)}pull(j,J){console.debug("BC",this.uuid,"PULL",j);let oe=new V(J,!0);return U(this.pulled,j).push(oe),this.broadcastWhoHas(j),oe}broadcastPushedHeadMessage(j){let J=this.pushed[j];J&&J[0]&&this.broadcastIHave(j,J[0].id)}onReceivedPublish(j,J,oe){console.debug("BCMSG(",this.uuid,")","from",j,"PUBLISH",J,"message",oe);let pe=this.subscribed[J];if(pe){let ge;for(let Se of pe)Se.running()?Se.execute(oe):(ge=ge||new Array,ge.push(Se));if(ge)for(let Se of ge)N(pe,Se);pe.length===0&&delete this.subscribed[J]}}onReceivedWhoHas(j,J){console.debug("BCMSG(",this.uuid,")","from",j,"WHOHAS",J),this.broadcastPushedHeadMessage(J)}onReceivedIHave(j,J,oe){console.debug("BCMSG(",this.uuid,")","from",j,"IHAVE",J,"id",oe);let pe=this.pulled[J];if(pe){let ge;for(let Se of pe)if(Se.running()){this.broadcastINeed(J,j,oe);break}else ge=ge||new Array,ge.push(Se);if(ge)for(let Se of ge)N(pe,Se);pe.length===0&&delete this.pulled[J]}}onReceivedINeed(j,J,oe,pe){if(console.debug("BCMSG(",this.uuid,")","from",j,"INEED",J,"source",oe,"id",pe),this.uuid===oe){let ge=this.pushed[J];if(ge&&ge[0]&&ge[0].id===pe){let{message:Se}=ge.shift();this.broadcastIGive(J,pe,j,Se),this.broadcastPushedHeadMessage(J),ge.length===0&&delete this.pushed[J]}}}onReceivedIGive(j,J,oe,pe,ge){console.debug("BCMSG(",this.uuid,")","from",j,"IGIVE",J,"id",oe,"target",pe,"message",ge);let Se=this.pulled[J];if(Se&&this.uuid===pe){let De=!1;for(;Se.length>0;){let tt=Se.shift();if(tt.running()){tt.execute(ge),De=!0;break}}De||this.push(J,ge),Se.length===0&&delete this.pulled[J]}}},Q=class extends Z{constructor(j,J=crypto.randomUUID()){super(J),this.bc=new BroadcastChannel(j),this.bc.onmessage=oe=>{this.onMessage(oe.data)}}onMessage(j){let{type:J,uuid:oe,topic:pe}=j;switch(J){case"PUBLISH":{let{message:ge}=j;this.onReceivedPublish(oe,pe,ge);break}case"WHOHAS":{this.onReceivedWhoHas(oe,pe);break}case"IHAVE":{let{id:ge}=j;this.onReceivedIHave(oe,pe,ge);break}case"INEED":{let{source:ge,id:Se}=j;this.onReceivedINeed(oe,pe,ge,Se);break}case"IGIVE":{let{target:ge,id:Se,message:De}=j;this.onReceivedIGive(oe,pe,Se,ge,De);break}default:console.warn("unsupported",j)}}broadcastPublish(j,J){this.post({type:"PUBLISH",uuid:this.uuid,topic:j,message:J})}broadcastWhoHas(j){this.post({type:"WHOHAS",uuid:this.uuid,topic:j})}broadcastIHave(j,J){this.post({type:"IHAVE",uuid:this.uuid,topic:j,id:J})}broadcastINeed(j,J,oe){this.post({type:"INEED",uuid:this.uuid,topic:j,source:J,id:oe})}broadcastIGive(j,J,oe,pe){this.post({type:"IGIVE",uuid:this.uuid,topic:j,id:J,target:oe,message:pe})}post(j){this.bc.postMessage(j),Promise.resolve().then(()=>{this.onMessage(j)})}},ae=Symbol("BLOCKING_QUEUE_RESET"),he=class{constructor(j,J=()=>1){if(this.maxSize=j,this.itemSizeOf=J,this.queue=new h,this.waitingConsumers=new h,this.waitingProducers=new h,this.queueSize=0,this.closePromise=null,this.closeResolve=null,j<=0)throw new Error("Max size must be greater than 0")}enqueue(j){return this.closePromise?!1:this.isFull()?(async()=>{console.debug("queue is full",this.queueSize,this.maxSize);let J=await new Promise(oe=>{this.waitingProducers.enqueue(oe)});return console.debug("queue is not full",this.size(),J),J?(this.innerEnqueue(j),!0):!1})():(this.innerEnqueue(j),!0)}innerEnqueue(j){if(this.waitingConsumers.isEmpty())this.queue.enqueue(j),this.queueSize+=this.itemSizeOf(j),console.debug("queue pushed",j,"size",this.queueSize);else{let J=this.waitingConsumers.dequeue();Promise.resolve(j).then(J),console.debug("queue direct",j,"size",this.queueSize)}}dequeue(){if(this.queue.isEmpty())if(this.closePromise){for(;!this.waitingConsumers.isEmpty();){let j=this.waitingConsumers.dequeue();Promise.resolve(ae).then(j)}return setTimeout(()=>this.closeResolve(),0),ae}else return new Promise(j=>{this.waitingConsumers.enqueue(j)});else{let j=this.queue.dequeue();if(this.queueSize-=this.itemSizeOf(j),!this.waitingProducers.isEmpty()){let J=this.waitingProducers.dequeue();Promise.resolve(!0).then(J)}return j}}size(){return this.queueSize}isEmpty(){return this.queueSize===0}isFull(){return this.queueSize>=this.maxSize}close(){return this.closePromise||(this.closePromise=new Promise(j=>{for(this.closeResolve=j;!this.waitingProducers.isEmpty();){let J=this.waitingProducers.dequeue();Promise.resolve(!1).then(J)}if(this.queueSize===0){for(;!this.waitingConsumers.isEmpty();){let J=this.waitingConsumers.dequeue();Promise.resolve(ae).then(J)}j()}})),this.closePromise}};function re(j,J,oe=Number.MAX_SAFE_INTEGER){let pe=new he(oe,J),ge=new ReadableStream({pull(De){let tt=!0,Ze=(async()=>{let Wt=new Array;do{let Nr=pe.dequeue();if(Nr instanceof Promise){tt=!1;let Lr=await Nr;Lr===ae?De.close():Wt.push(Lr)}else{let Lr=Nr;Lr===ae?De.close():Wt.push(Lr)}}while(pe.size()>0);if(Wt.length>0){let Nr=j(Wt);De.enqueue(Nr)}})();if(!tt)return console.debug("read stream stucked --------------------------------------"),Ze},async cancel(){console.debug("buffered readable cancel"),await pe.close()}}),Se=new WritableStream({write(De,tt){let Ze=!0,Wt=(async()=>{let Nr=pe.enqueue(De);typeof Nr=="boolean"?Nr||tt.error(new Error("Write stream closed")):(Ze=!1,await Nr||tt.error(new Error("Write stream closed")))})();if(!Ze)return console.debug("read stream stucked >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"),Wt},async close(){console.debug("buffered writable closing",pe.size()),await pe.close(),console.debug("buffered writable closed",pe.size())},async abort(){console.debug("buffered writable aborting",pe.size()),await pe.close(),console.debug("buffered writable aborted",pe.size())}});return{readable:ge,writable:Se}}function se(j=Number.MAX_SAFE_INTEGER){return re(J=>J.join(""),J=>J.length,j)}function K(j=Number.MAX_SAFE_INTEGER){return re(J=>{let oe=new Uint8Array(J.reduce((ge,Se)=>ge+Se.byteLength,0)),pe=0;return J.forEach(ge=>{oe.set(ge,pe),pe+=ge.byteLength}),oe},J=>J.byteLength,j)}function me(j){return new Promise((J,oe)=>{let pe=new BroadcastChannel(j),ge=new he(1),Se=new I(1),De=null,tt=!1,Ze=!1,Wt=!1;pe.onmessage=Nr=>{let Lr=Nr.data,{type:Dr}=Lr;if(console.debug("p2p",j,"type",Dr,"data",Dr==="DATA"&&Lr.data),Dr==="DATA")ge.enqueue(Lr.data);else if(Dr==="HI"){if(!De){pe.postMessage({type:"HI"});let Ut=0;De={rs:new ReadableStream({async pull(ar){let Fe=await ge.dequeue();Fe===ae?(await ke(),ar.close()):(ar.enqueue(Fe),pe.postMessage({type:"ACK"}))},cancel(){return ke()}}),ws:new WritableStream({async write(ar,Fe){await Se.acquireSync()?pe.postMessage({type:"DATA",id:Ut++,data:ar}):(Rr(),Fe.error(new Error("Write stream closed")))},close(){Rr()},abort(){Rr()}})},J(De)}}else Dr==="REND"?De?Se.close():Yt("REND1"):Dr==="WEND"?De?ge.close():Yt("WEND1"):Dr==="ACK"&&Se.release();function Rr(){tt||(tt=!0,console.debug(j,"p2p write stream closed"),Se.close(),pe.postMessage({type:"WEND"}),Ze&&(console.debug(j,"p2p channel closed on ws"),pe.close()))}async function ke(){Ze||(Ze=!0,console.debug(j,"p2p read stream closed"),pe.postMessage({type:"REND"}),await ge.close(),tt&&(console.debug(j,"p2p channel closed on rs"),pe.close()))}async function Yt(Ut){Wt||(Wt=!0,console.debug(j,"p2p channel connection released on",Ut),Se.close(),ge.close(),De?(De.rs.locked||(console.debug(j,"p2p unlocked read stream direct cancel"),De.rs.cancel()),De.ws.locked||(console.debug(j,"p2p unlocked write stream direct close"),De.ws.close())):(pe.postMessage({type:"HI"}),pe.close()),oe(new Error("p2p channel connection released")))}},pe.postMessage({type:"HI"})})}function Oe(j){return new Promise(J=>{let oe=new BroadcastChannel(j);oe.onmessage=pe=>{let ge=pe.data,{type:Se}=ge;Se==="HI"&&(oe.postMessage({type:"REND"}),oe.close(),J())},oe.postMessage({type:"REND"})})}async function Ie(j){try{return await me(j)}catch(J){J.message!=="p2p channel connection released"&&console.error(J)}}async function ue(j,J,oe=10*1024*1024,pe=!0){let ge=await Ie(j);if(!ge)return!1;let Se=!1;try{let De,tt=Ze=>{if(!De)if(!pe)De=ge.ws.getWriter();else if(typeof Ze=="string"){let Wt=se(oe);Wt.readable.pipeTo(ge.ws),De=Wt.writable.getWriter()}else{let Wt=K(oe);Wt.readable.pipeTo(ge.ws),De=Wt.writable.getWriter()}return De.write(Ze)};if(Array.isArray(J))for(let Ze of J)await tt(Ze);else await J({write:tt,get desiredSize(){return((De==null?void 0:De.desiredSize)||0)+10}});De&&await De.close(),Se=!0}catch(De){console.error(De)}finally{return ge.rs.cancel(),Se}}async function Pe(j,J){var oe,pe;let ge=await Ie(j);if(ge)try{let Se=ge.rs.getReader();for((oe=J.start)==null?void 0:oe.call(J);;){let{value:De,done:tt}=await Se.read();if(De!==void 0){let Ze;if(J.update instanceof Promise?Ze=await J.update(De):Ze=J.update(De),Ze){await Se.cancel();break}}if(tt){(pe=J.end)==null||pe.call(J);break}}}catch(Se){console.error(Se)}finally{ge.ws.close()}}}),cgt={UNAUTHORIZED:"Not logged in yet, please log in and try again",LOGIN_FAIL:"The login status is invalid",PERMISSION_DENIED:"No permission or project does not exist",PERMISSION_DENIED1:"No permission",PRJ_NOT_EXIST:"No permission or project does not exist",ERROR_PATH:"No permission or project does not exist",PROJECT_NOT_FOUND:"The project was not found",PERMISSION_DENIED_PARAMS:"No permission to operate {type}",DATA_NOT_FOUND:"Data not found",PARAMS_DATA_NOT_FOUND:"The {type} data was not found",REQUEST_PARAM_ILLEGAL:"Parameter error",REQUEST_PARAM_ILLEGAL1:"Parameter error",REQUEST_PARAMS_ILLEGAL2:"The {type} parameter request is incorrect",REQUEST_PARAMS_NOT_NULL:"The {type} parameter of the request cannot be empty",REQUEST_PARAMS_NOT_ALL_NULL:"The {type} parameter of the request cannot be empty simultaneously",REQUEST_PARAMS_MUST_ARRAY:"The request parameter {type} must be an array",REQUEST_PARAMS_MUST_STRING:"The request parameter {type} must be a string",REQUEST_PARAMS_MUST_NUMBER:"The request parameter {type} must be a number",REQUEST_PARAMS_MUST_NUMBER_ARRAY:"The request parameter {type} must be a numeric array",REQUEST_PARAMS_MUST_STRING_ARRAY:"The request parameter {type} must be a string array",REQUEST_PARAMS_LENGTH_ERROR:"The length of the request parameter {type} is incorrect",REQUEST_PARAMS_TYPE_ERROR:"The request parameter {type} is of incorrect type",ILLEGAL_NAME:'The name is illegal and contains illegal characters such as /:*?"<>|',ILLEGAL_NAME1:'The name is illegal and contains illegal characters such as /:*?"<>|',ILLEGAL_NAME_ZH:"The name cannot contain Chinese characters",UUID_ERROR:"uuid error",DUPLICATE_DATA:"Duplicate title",DUPLICATE_DATA1:"Library duplicate name",DUPLICATE_DATA_PARAMS:"{type} Duplicate data",UPLOAD_LIMIT:"Document {documentName} size over 15MB, it is too big to save in the server, please modify and then try again.",MORE_THAN_LIMIT:"Exceed the maximum limit",FILE_MORE_THAN_LIMIT:"Exceed the maximum upload limit of {type}",PARAMS_MORE_THAN_LIMIT:"Exceed the maximum upload limit of the parameter {type}",IMAGE_MORE_THAN_LIMIT_PARAMS:"The picture exceeds the maximum upload limit",FILE_MORE_THAN_LIMIT_PARAMS:"The file exceeds the maximum upload limit",END_MUST_AFTER_START:"The start time cannot be later than the end time",FILE_READ_ONLY:"The project file eprj or library file elib property was set as read only, please enable the read only property at File Manager and try again, and contact with support",FILE_READ_ONLY1:"The project file eprj or library file elib property was set as read only, please enable the read only property at File Manager and try again, and contact with support",DATA_NOT_EXIST:"document {documentName} not exists",REQUEST_PARAMS_TIME_ERROR:"The time request parameter is incorrect",FILES_PATH_NOT_FOUND:"The file address cannot be found",FILES_DATA_NOT_FOUND:"The file data cannot be found",FILES_TYPE_ERROR:"File type error",FILES_TYPE_MUST_BE_ONE:"The file type must be {type}",SET_WATERMARK_FAIL:"Watermark setting failed",MYSQL_CRUD_ERROR:"{type} data execution failed. Please contact technical support for resolution",PARAMS_JSON_FAILED:"{type} data parsing failed",MYSQL_ERROR:"Database operation anomaly",NOT_FOUND:"The request does not exist",PRJ_NAME_EXISTS:"The name of the project already exists",BACKUP_NAME_EXISTS:"Backup Name already exists",TITLE_ILLEGAL_LEN:"The {documentName} length must be 1~128 bytes!",LIB_NOT_EXIST:"The component library does not exist",CONFIG_API_URLS_ERROR:"Real-time prices and inventory are not enabled. Please contact the administrator",ONE_CLICK_ORDER_NOT_OPEN:"The order placement function is not enabled. Please contact the administrator",MATERIAL_NOT_OPEN:"The material warehouse is not open. Please contact the administrator",SNAPSHOT_DEPTH_LIMIT:"There is a snapshot near the latest node or the snapshot has been applied for",OCR_SYMBOL_URL_ERROR:"The OCR request address is not configured",USER_DATA_NOT_FOUND:"The user does not exist",USER_DISABLE_ERROR:"The account has been deactivated",USER_EXISTS_LOGIN_ERROR:"The user has logged in elsewhere",USER_UNAUTHORIZED_MODULES_ERROR:"This account has not authorized the module",USER_UNAUTHORIZED_ACCESS_ERROR:"Access type error",ADMIN_NOT_CHANGE_PASSWORD:"The super administrator cannot reset the password",SAME_PASSWORD_NEW_PASSWORD:"The original password is the same as the new one",USER_ONLINE_REGISTRATION_FAILED:"The registration of the user online failed",USER_PASSWORD_CAN_NOT_DEFAULT:"The default password cannot be used",USER_BEFORE_PASSWORD_ERROR:"The original password is incorrect",USER_PASSWORD_LENGTH_ERROR:"The password length is 8 to 255 characters",ORG_ROLE_NOT_CREATE:"System roles cannot be created. Please make the necessary modifications",ORG_ROLE_NAME_DUPLICATE:"The character name already exists. Please modify it",ORG_ROLE_ORIGIN_ERROR:"Unknown character source {message}",ORG_ROLE_NOT_DEFAULT:"This character is not a preset one and cannot be operated",ADMIN_ROLE_NOT_CHANGE:"Administrator privileges do not allow for modification",ADMIN_NOT_CHANGE_STATUS:"The admin account cannot change its status",PROJECT_ARCHIVED:"The project has been locked",PROJECT_UUID_NULL:"The project uuid cannot be empty",PROJECT_UUID_ERROR:"uuid error or the project uuid already exists",PROJECT_OR_TEAM_UUID_ERROR:"The project uuid is incorrect or the team uuid already exists",PROJECT_NOT_PERSON_ERROR:"Personal projects are not allowed to be created",PROJECT_DUPLICATE_NAME:"Duplicate title",ANNOTATION_HAS_BE_FOUND:"The annotation has been created",ANNOTATION_NOT_FOUND:"The annotation block does not exist",ANNOTATION_CREATE_ERROR:"The annotation block creation failed",ANNOTATION_UPDATE_ERROR:"The update of the annotation block failed",ANNOTATION_DELETE_ERROR:"The annotation failed to be deleted",PROJECT_DUPLICATE_PATH:"The same path cannot be created",TEAM_NOT_FOUND:"The team does not exist",TEAM_UUID_NULL:"The team uuid cannot be empty",TEAM_FOLDER_ERROR:"The parent folder does not exist or does not belong to the current team",TEAM_FOLDER_UUID_ERROR:"The folder uuid is incorrect or the project uuid already exists",TEAM_URL_DUPLICATE:"Team link repetition",TEAM_CAN_NOT_DELETE:"There are still projects in the team. Please transfer or delete them first",COMPONENT_UUID_NULL:"The uuid of a component cannot be empty",COMPONENT_DATA_NOT_FOUND:"The component library data does not exist",COMPONENT_NAME_DUPLICATE:"Component libraries cannot have the same name",COMPONENT_TYPE_ERROR:"Library type error",DELETE_SON_CATEGORY:"The subcategories need to be deleted first",LICENSE:"License not found",START_TIME:"The start time of the license is incorrect",END_TIME:"The end time of the license is incorrect",PROJECT_LIMIT:"Number of projects created exceeds the limit",USER_LIMIT:"The maximum number of accounts has been reached",ONLINE_NUMBER_LIMIT:"The maximum number of online users has been reached",LIMIT_PCB:"The PCB authorization quota has been reached and the addition failed",LIMIT_SCH:"The schematic authorization number is full, and the addition failed",LIMIT_PANEL:"The panel authorization number is full and the addition failed",TIME_ERROR:"If the system time is incorrect, please restart the server or fix the system time. After fixing, the private service needs to be restarted",LICENSE_ERROR:"Authorization error",LICENSE_TYPE_ERROR:"The type of authorized application is incorrect",LICENSE_ORIGIN_ERROR:"Unknown authorized application {type}",BRANCH_DATA_NOT_FOUND:"There is no engineering branch",PARENT_UUID_ERROR:"parent uuid error",BRANCH_MUST_AFTER_NODE:"The branch must be after the node",BRANCH_NAME_ERROR:"Incorrect branch name",BRANCH_NAME_DUPLICATE:"The branch name already exists",BRANCH_UUID_ERROR:"The branch uuid is incorrect",BRANCH_NODE_SET_ERROR:"Nodes cannot be set as default branches or marked as master",BRANCH_DELETE_MAIN_ERROR:"Nodes or branches on the main branch cannot be deleted",BRANCH_CHECK_OUT_ERROR:"There are documents that have been checked out",DOCUMENT_UUID_ERROR:"The document uuid is incorrect",UPDATE_FAILED:"Update failed",INNER_API_KEY_ERROR:"The ApiKey of the internal interface of the server is incorrect",BRANCH_MORE_THAN_LIMIT:"The version exceeds the maximum limit",WORKSPACE_API_ERROR:"The workspace request response is abnormal"},hgt={UNAUTHORIZED:"\u5C1A\u672A\u767B\u5F55\uFF0C\u8BF7\u767B\u5F55\u540E\u518D\u8BD5",LOGIN_FAIL:"\u767B\u5F55\u72B6\u6001\u5F02\u5E38",PERMISSION_DENIED:"\u6CA1\u6709\u6743\u9650\u6216\u5DE5\u7A0B\u4E0D\u5B58\u5728",PERMISSION_DENIED1:"\u6CA1\u6709\u6743\u9650",PRJ_NOT_EXIST:"\u6CA1\u6709\u6743\u9650\u6216\u5DE5\u7A0B\u4E0D\u5B58\u5728",ERROR_PATH:"\u6CA1\u6709\u6743\u9650\u6216\u5DE5\u7A0B\u4E0D\u5B58\u5728",PROJECT_NOT_FOUND:"\u5DE5\u7A0B\u672A\u627E\u5230",PERMISSION_DENIED_PARAMS:"\u6CA1\u6709\u6743\u9650\u64CD\u4F5C{type}",DATA_NOT_FOUND:"\u6570\u636E\u672A\u627E\u5230",PARAMS_DATA_NOT_FOUND:"{type}\u6570\u636E\u672A\u627E\u5230",REQUEST_PARAM_ILLEGAL:"\u53C2\u6570\u9519\u8BEF",REQUEST_PARAM_ILLEGAL1:"\u53C2\u6570\u9519\u8BEF",REQUEST_PARAMS_ILLEGAL2:"\u8BF7\u6C42{type}\u53C2\u6570\u9519\u8BEF",REQUEST_PARAMS_NOT_NULL:"\u8BF7\u6C42{type}\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A",REQUEST_PARAMS_NOT_ALL_NULL:"\u8BF7\u6C42{type}\u53C2\u6570\u4E0D\u80FD\u540C\u65F6\u4E3A\u7A7A",REQUEST_PARAMS_MUST_ARRAY:"\u8BF7\u6C42\u53C2\u6570{type}\u5FC5\u987B\u662F\u6570\u7EC4",REQUEST_PARAMS_MUST_STRING:"\u8BF7\u6C42\u53C2\u6570{type}\u5FC5\u987B\u662F\u5B57\u7B26\u4E32",REQUEST_PARAMS_MUST_NUMBER:"\u8BF7\u6C42\u53C2\u6570{type}\u5FC5\u987B\u662F\u6570\u5B57",REQUEST_PARAMS_MUST_NUMBER_ARRAY:"\u8BF7\u6C42\u53C2\u6570{type}\u5FC5\u987B\u662F\u6570\u5B57\u6570\u7EC4",REQUEST_PARAMS_MUST_STRING_ARRAY:"\u8BF7\u6C42\u53C2\u6570{type}\u5FC5\u987B\u662F\u5B57\u7B26\u4E32\u6570\u7EC4",REQUEST_PARAMS_LENGTH_ERROR:"\u8BF7\u6C42\u53C2\u6570{type}\u957F\u5EA6\u9519\u8BEF",REQUEST_PARAMS_TYPE_ERROR:"\u8BF7\u6C42\u53C2\u6570{type}\u7C7B\u578B\u9519\u8BEF",ILLEGAL_NAME:'\u540D\u79F0\u975E\u6CD5, \u5305\u542B /:*?"<>| \u7B49\u975E\u6CD5\u5B57\u7B26',ILLEGAL_NAME1:'\u540D\u79F0\u975E\u6CD5, \u5305\u542B /:*?"<>| \u7B49\u975E\u6CD5\u5B57\u7B26',ILLEGAL_NAME_ZH:"\u540D\u79F0\u4E0D\u80FD\u5305\u542B\u4E2D\u6587",UUID_ERROR:"uuid \u9519\u8BEF",DUPLICATE_DATA:"\u6807\u9898\u5DF2\u5B58\u5728",DUPLICATE_DATA1:"\u5E93\u91CD\u540D",DUPLICATE_DATA_PARAMS:"{type}\u91CD\u590D\u6570\u636E",UPLOAD_LIMIT:"\u6587\u6863 {documentName} \u8D85\u8FC715MB\uFF0C\u5BFC\u81F4\u65E0\u6CD5\u6B63\u5E38\u4FDD\u5B58\uFF0C\u8BF7\u4FEE\u6539\u540E\u518D\u5BFC\u5165",MORE_THAN_LIMIT:"\u8D85\u8FC7\u6700\u5927\u9650\u5236",FILE_MORE_THAN_LIMIT:"\u8D85\u8FC7{type}\u6700\u5927\u4E0A\u4F20\u9650\u5236",PARAMS_MORE_THAN_LIMIT:"\u8D85\u8FC7\u53C2\u6570{type}\u7684\u6700\u5927\u4E0A\u4F20\u9650\u5236",IMAGE_MORE_THAN_LIMIT_PARAMS:"\u56FE\u7247\u8D85\u8FC7\u6700\u5927\u4E0A\u4F20\u9650\u5236",FILE_MORE_THAN_LIMIT_PARAMS:"\u6587\u4EF6\u8D85\u8FC7\u6700\u5927\u4E0A\u4F20\u9650\u5236",END_MUST_AFTER_START:"\u5F00\u59CB\u65F6\u95F4\u4E0D\u80FD\u665A\u4E8E\u7ED3\u675F\u65F6\u95F4",FILE_READ_ONLY:"\u5DE5\u7A0B\u6587\u4EF6eprj\u6216\u5E93\u6587\u4EF6elib\u5C5E\u6027\u53D8\u4E3A\u53EA\u8BFB\uFF0C\u8BF7\u5728\u8D44\u6E90\u7BA1\u7406\u5668\u53D6\u6D88\u53EA\u8BFB\u540E\u518D\u8BD5\uFF0C\u5E76\u8054\u7CFB\u6280\u672F\u652F\u6301",FILE_READ_ONLY1:"\u5DE5\u7A0B\u6587\u4EF6eprj\u6216\u5E93\u6587\u4EF6elib\u5C5E\u6027\u53D8\u4E3A\u53EA\u8BFB\uFF0C\u8BF7\u5728\u8D44\u6E90\u7BA1\u7406\u5668\u53D6\u6D88\u53EA\u8BFB\u540E\u518D\u8BD5\uFF0C\u5E76\u8054\u7CFB\u6280\u672F\u652F\u6301",DATA_NOT_EXIST:"\u6587\u6863{documentName}\u4E0D\u5B58\u5728",REQUEST_PARAMS_TIME_ERROR:"\u65F6\u95F4\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF",FILES_PATH_NOT_FOUND:"\u627E\u4E0D\u5230\u6587\u4EF6\u5730\u5740",FILES_DATA_NOT_FOUND:"\u627E\u4E0D\u5230\u6587\u4EF6\u6570\u636E",FILES_TYPE_ERROR:"\u6587\u4EF6\u7C7B\u578B\u9519\u8BEF",FILES_TYPE_MUST_BE_ONE:"\u6587\u4EF6\u7C7B\u578B\u5FC5\u987B\u4E3A{type}",SET_WATERMARK_FAIL:"\u6C34\u5370\u8BBE\u7F6E\u5931\u8D25",MYSQL_CRUD_ERROR:"{type}\u6570\u636E\u6267\u884C\u5931\u8D25, \u8BF7\u8054\u7CFB\u6280\u672F\u652F\u6301\u89E3\u51B3",PARAMS_JSON_FAILED:"{type}\u6570\u636E\u89E3\u6790\u5931\u8D25",MYSQL_ERROR:"\u6570\u636E\u5E93\u64CD\u4F5C\u5F02\u5E38",NOT_FOUND:"\u8BF7\u6C42\u4E0D\u5B58\u5728",PRJ_NAME_EXISTS:"\u5DE5\u7A0B\u540D\u79F0\u5DF2\u5B58\u5728",BACKUP_NAME_EXISTS:"\u5907\u4EFD\u540D\u79F0\u5DF2\u5B58\u5728",TITLE_ILLEGAL_LEN:"{documentName}\u957F\u5EA6\u5FC5\u987B\u4E3A1~128\u5B57\u7B26\u957F\u5EA6\uFF01",LIB_NOT_EXIST:"\u5143\u4EF6\u5E93\u4E0D\u5B58\u5728",CONFIG_API_URLS_ERROR:"\u5B9E\u65F6\u4EF7\u683C\u548C\u5E93\u5B58\u672A\u5F00\u542F, \u8BF7\u8054\u7CFB\u7BA1\u7406\u5458",ONE_CLICK_ORDER_NOT_OPEN:"\u4E00\u4EF6\u4E0B\u5355\u529F\u80FD\u672A\u5F00\u542F, \u8BF7\u8054\u7CFB\u7BA1\u7406\u5458",MATERIAL_NOT_OPEN:"\u7269\u6599\u5E93\u672A\u5F00\u542F, \u8BF7\u8054\u7CFB\u7BA1\u7406\u5458",SNAPSHOT_DEPTH_LIMIT:"\u6700\u65B0\u8282\u70B9\u9644\u8FD1\u5B58\u5728\u5FEB\u7167\u6216\u5FEB\u7167\u5DF2\u88AB\u7533\u8BF7",OCR_SYMBOL_URL_ERROR:"OCR\u8BF7\u6C42\u5730\u5740\u672A\u914D\u7F6E",USER_DATA_NOT_FOUND:"\u7528\u6237\u4E0D\u5B58\u5728",USER_DISABLE_ERROR:"\u8D26\u53F7\u5DF2\u505C\u7528",USER_EXISTS_LOGIN_ERROR:"\u7528\u6237\u5DF2\u5728\u522B\u7684\u5730\u65B9\u767B\u5F55",USER_UNAUTHORIZED_MODULES_ERROR:"\u8BE5\u8D26\u53F7\u672A\u6388\u6743\u6A21\u5757",USER_UNAUTHORIZED_ACCESS_ERROR:"\u8BBF\u95EE\u7C7B\u578B\u9519\u8BEF",ADMIN_NOT_CHANGE_PASSWORD:"\u8D85\u7EA7\u7BA1\u7406\u5458\u65E0\u6CD5\u91CD\u7F6E\u5BC6\u7801",SAME_PASSWORD_NEW_PASSWORD:"\u539F\u5BC6\u7801\u8DDF\u65B0\u5BC6\u7801\u76F8\u540C",USER_ONLINE_REGISTRATION_FAILED:"\u767B\u8BB0\u7528\u6237\u5728\u7EBF\u5931\u8D25",USER_PASSWORD_CAN_NOT_DEFAULT:"\u4E0D\u80FD\u4F7F\u7528\u9ED8\u8BA4\u5BC6\u7801",USER_BEFORE_PASSWORD_ERROR:"\u539F\u5BC6\u7801\u9519\u8BEF",USER_PASSWORD_LENGTH_ERROR:"\u5BC6\u7801\u957F\u5EA6\u4E3A8-255\u4F4D",ORG_ROLE_NOT_CREATE:"\u4E0D\u80FD\u521B\u5EFA\u7CFB\u7EDF\u89D2\u8272, \u8BF7\u4FEE\u6539",ORG_ROLE_NAME_DUPLICATE:"\u89D2\u8272\u540D\u79F0\u5DF2\u5B58\u5728, \u8BF7\u4FEE\u6539",ORG_ROLE_ORIGIN_ERROR:"\u672A\u77E5\u7684\u89D2\u8272\u6765\u6E90{message}",ORG_ROLE_NOT_DEFAULT:"\u8BE5\u89D2\u8272\u4E0D\u662F\u9884\u8BBE\u89D2\u8272, \u4E0D\u80FD\u64CD\u4F5C",ADMIN_ROLE_NOT_CHANGE:"\u7BA1\u7406\u5458\u6743\u9650\u4E0D\u5141\u8BB8\u4FEE\u6539",ADMIN_NOT_CHANGE_STATUS:"admin\u8D26\u53F7\u4E0D\u80FD\u66F4\u6539\u72B6\u6001",PROJECT_ARCHIVED:"\u5DE5\u7A0B\u5DF2\u88AB\u9501\u5B9A",PROJECT_UUID_NULL:"\u5DE5\u7A0Buuid\u4E0D\u80FD\u4E3A\u7A7A",PROJECT_UUID_ERROR:"uuid\u9519\u8BEF\u6216\u8005\u5DE5\u7A0Buuid\u5DF2\u5B58\u5728",PROJECT_OR_TEAM_UUID_ERROR:"\u5DE5\u7A0Buuid\u9519\u8BEF\u6216\u8005\u5DF2\u5B58\u5728\u56E2\u961Fuuid",PROJECT_NOT_PERSON_ERROR:"\u4E0D\u5141\u8BB8\u521B\u5EFA\u4E2A\u4EBA\u5DE5\u7A0B",PROJECT_DUPLICATE_NAME:"\u6807\u9898\u5DF2\u5B58\u5728",ANNOTATION_HAS_BE_FOUND:"\u6279\u6CE8\u5DF2\u521B\u5EFA",ANNOTATION_NOT_FOUND:"\u6279\u6CE8\u5757\u4E0D\u5B58\u5728",ANNOTATION_CREATE_ERROR:"\u6279\u6CE8\u5757\u521B\u5EFA\u5931\u8D25",ANNOTATION_UPDATE_ERROR:"\u66F4\u65B0\u6279\u6CE8\u5757\u5931\u8D25",ANNOTATION_DELETE_ERROR:"\u6279\u6CE8\u6761\u5220\u9664\u5931\u8D25",PROJECT_DUPLICATE_PATH:"\u4E0D\u80FD\u521B\u5EFA\u76F8\u540C\u7684\u8DEF\u5F84",TEAM_NOT_FOUND:"\u56E2\u961F\u4E0D\u5B58\u5728",TEAM_UUID_NULL:"\u56E2\u961Fuuid\u4E0D\u80FD\u4E3A\u7A7A",TEAM_FOLDER_ERROR:"\u7236\u6587\u4EF6\u5939\u4E0D\u5B58\u5728\u6216\u4E0D\u5C5E\u4E8E\u5F53\u524D\u56E2\u961F",TEAM_FOLDER_UUID_ERROR:"\u6587\u4EF6\u5939uuid\u9519\u8BEF\u6216\u8005\u5DE5\u7A0Buuid\u5DF2\u5B58\u5728",TEAM_URL_DUPLICATE:"\u56E2\u961F\u94FE\u63A5\u91CD\u590D",TEAM_CAN_NOT_DELETE:"\u56E2\u961F\u4ECD\u5B58\u5728\u5DE5\u7A0B, \u8BF7\u5148\u8F6C\u79FB\u6216\u8005\u5220\u9664",COMPONENT_UUID_NULL:"\u5143\u4EF6uuid\u4E0D\u80FD\u4E3A\u7A7A",COMPONENT_DATA_NOT_FOUND:"\u5143\u4EF6\u5E93\u6570\u636E\u4E0D\u5B58\u5728",COMPONENT_NAME_DUPLICATE:"\u5143\u4EF6\u5E93\u4E0D\u80FD\u91CD\u540D",COMPONENT_TYPE_ERROR:"\u5E93\u7C7B\u578B\u9519\u8BEF",DELETE_SON_CATEGORY:"\u9700\u8981\u5148\u5220\u9664\u5B50\u7C7B\u522B",LICENSE:"\u672A\u627E\u5230\u8BB8\u53EF\u8BC1",START_TIME:"\u8BB8\u53EF\u8BC1\u5F00\u59CB\u65F6\u95F4\u9519\u8BEF",END_TIME:"\u8BB8\u53EF\u8BC1\u7ED3\u675F\u65F6\u95F4\u9519\u8BEF",PROJECT_LIMIT:"\u521B\u5EFA\u7684\u9879\u76EE\u6570\u91CF\u8D85\u8FC7\u9650\u5236",USER_LIMIT:"\u5DF2\u8FBE\u5230\u6700\u5927\u8D26\u53F7\u6570",ONLINE_NUMBER_LIMIT:"\u5DF2\u8FBE\u5230\u6700\u5927\u5728\u7EBF\u6570",LIMIT_PCB:"PCB\u6388\u6743\u6570\u5DF2\u6EE1, \u6DFB\u52A0\u5931\u8D25",LIMIT_SCH:"\u539F\u7406\u56FE\u6388\u6743\u6570\u5DF2\u6EE1, \u6DFB\u52A0\u5931\u8D25",LIMIT_PANEL:"\u9762\u677F\u6388\u6743\u6570\u5DF2\u6EE1, \u6DFB\u52A0\u5931\u8D25",TIME_ERROR:"\u7CFB\u7EDF\u65F6\u95F4\u9519\u8BEF\u8BF7\u91CD\u542F\u670D\u52A1\u5668\u6216\u4FEE\u590D\u7CFB\u7EDF\u65F6\u95F4, \u4FEE\u590D\u540E\u9700\u8981\u91CD\u542F\u79C1\u6709\u5316\u670D\u52A1",LICENSE_ERROR:"\u6388\u6743\u9519\u8BEF",LICENSE_TYPE_ERROR:"\u6388\u6743\u5E94\u7528\u7C7B\u578B\u9519\u8BEF",LICENSE_ORIGIN_ERROR:"\u672A\u77E5\u7684\u6388\u6743\u5E94\u7528{type}",BRANCH_DATA_NOT_FOUND:"\u5DE5\u7A0B\u5206\u652F\u4E0D\u5B58\u5728",PARENT_UUID_ERROR:"\u7236\u7EA7uuid\u9519\u8BEF",BRANCH_MUST_AFTER_NODE:"\u5206\u652F\u5FC5\u987B\u5728\u8282\u70B9\u540E",BRANCH_NAME_ERROR:"\u5206\u652F\u540D\u9519\u8BEF",BRANCH_NAME_DUPLICATE:"\u5206\u652F\u540D\u5DF2\u5B58\u5728",BRANCH_UUID_ERROR:"\u5206\u652Fuuid\u9519\u8BEF",BRANCH_NODE_SET_ERROR:"\u8282\u70B9\u4E0D\u80FD\u8BBE\u7F6E\u4E3A\u9ED8\u8BA4\u5206\u652F\u6216\u6807\u8BB0\u4E3Amaster",BRANCH_DELETE_MAIN_ERROR:"\u4E0D\u80FD\u5220\u9664\u4E3B\u5206\u652F\u4E0A\u7684\u8282\u70B9\u6216\u5206\u652F",BRANCH_CHECK_OUT_ERROR:"\u5B58\u5728\u6587\u6863\u5DF2\u7B7E\u51FA",DOCUMENT_UUID_ERROR:"\u6587\u6863uuid\u9519\u8BEF",UPDATE_FAILED:"\u66F4\u65B0\u5931\u8D25",INNER_API_KEY_ERROR:"\u670D\u52A1\u7AEF\u5185\u90E8\u63A5\u53E3 ApiKey \u9519\u8BEF",BRANCH_MORE_THAN_LIMIT:"\u7248\u672C\u8D85\u8FC7\u6700\u5927\u9650\u5236",WORKSPACE_API_ERROR:"\u5DE5\u4F5C\u533A\u8BF7\u6C42\u54CD\u5E94\u5F02\u5E38"},d5e={codeEN:cgt,codeCN:hgt},yNe=class bNe{static load(){typeof d5e=="object"&&(bNe.cache=d5e)}static match(t,e,r){if(!this.cache||!this.cache[t])return;let i=this.cache[t][e];if(r&&Object.prototype.toString.call(r)==="[object Object]")for(let n in r){let s=r[n];i=i.replace(`{${n}}`,s)}return i}};yNe.cache={};var PTe=yNe;function ugt(){console.log("common init----------------"),PTe.load()}function tT(o,t){throw new Error(`invalid format state on (${t}) of ${o}`)}function dgt(o,...t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l);switch(r){case 0:c==="%"?r=1:e.push(c);break;case 1:switch(c){case"d":n=t[i++],typeof n=="number"?(e.push(n.toFixed(0)),r=0):tT(o,l);break;case"f":n=t[i++],typeof n=="number"?(e.push(n.toString()),r=0):tT(o,l);break;case"x":n=t[i++],typeof n=="number"?(e.push((n|0).toString(16)),r=0):tT(o,l);break;case"X":n=t[i++],typeof n=="number"?(e.push((n|0).toString(16).toUpperCase()),r=0):tT(o,l);break;case"s":case"c":n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case"0":s=l+1,a=-1,r=2;break;case"%":e.push("%"),r=0;break;default:tT(o,l)}break;case 2:switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":a=l;break;case"d":if(a>=s){let h=parseInt(o.substring(s,a+1));n=t[i++],typeof n=="number"?(e.push((n|0).toString(10).padStart(h,"0")),r=0):tT(o,l)}else tT(o,l);break;case"x":if(a>=s){let h=parseInt(o.substring(s,a+1));n=t[i++],typeof n=="number"?(e.push((n|0).toString(16).padStart(h,"0")),r=0):tT(o,l)}else tT(o,l);break;case"X":if(a>=s){let h=parseInt(o.substring(s,a+1));n=t[i++],typeof n=="number"?(e.push((n|0).toString(16).toUpperCase().padStart(h,"0")),r=0):tT(o,l)}else tT(o,l);break;default:tT(o,l)}break;default:tT(o,l)}}return e.join("")}function PNe(o){let t="";try{let e=/.*\\(.*)$/.exec(o);e&&e[1]&&typeof e[1]=="string"&&(t=e[1])}catch(e){console.error("Query Folder Name Error:",e)}return t}function TNe(o,t){let e=Math.max(o.length,t.length);for(let r=0;r<e;r++){let i=o[r],n=t[r],s=0;if(typeof i=="string"&&typeof n=="string")s=i.localeCompare(n);else if(typeof i=="number"&&typeof n=="number")s=i-n;else{if(typeof i=="number"&&typeof n=="string")return-1;if(typeof i=="string"&&typeof n=="number")return 1;if(i===void 0&&n!==void 0)return-1;if(i!==void 0&&n===void 0)return 1}if(s!==0)return s}return 0}function TTe(o){let t=/\d+/g,e=new Array,r=0;for(;;){let i=t.exec(o);if(i)r<i.index&&e.push(o.substring(r,i.index)),r=i.index+i[0].length,e.push(parseInt(i[0]));else break}return e.push(o),e}function pgt(o,t,e,r){var i,n;let s=[],a=[],l=[];for(let u=0,d=o.length;u<d;u++){s[u]=u;let p;if(Array.isArray(t)){let m="";for(let g=0;g<t.length;g++)if(Object.hasOwnProperty.call(o[u],t[g])){m=o[u][t[g]];break}}else p=t?o[u][t]||((n=(i=o[u])==null?void 0:i[r])==null?void 0:n[t])||"":o[u];if(a[u]=String(p).toUpperCase().match(/\D+|\d+(?:\.\d+)?/g),l[u]=[],a[u])for(let m=0;m<a[u].length;m++)l[u][m]=a[u][m].match(/\d/)?1:2}let c=function(u,d){let p=a[u],m=a[d],g=l[u],y=l[d];if(!p||!m)return e?p==m?0:p?-1:1:p==m?0:p?1:-1;let b=Math.max(p.length,m.length);for(let P=0;P<b;P++){if(e)if(p[P])if(m[P]){if(p[P]!=m[P])return g[P]!=y[P]?g[P]==1?1:-1:g[P]==1?m[P]-p[P]:p[P]<m[P]?1:-1}else return-1;else return 1;if(p[P])if(m[P]){if(p[P]!=m[P])return g[P]!=y[P]?g[P]==1?-1:1:g[P]==1?p[P]-m[P]:p[P]<m[P]?-1:1}else return 1;else return-1}return 0};s.sort(c);let h=[];for(let u=0;u<o.length;u++)h[u]=o[s[u]];return h}function fgt(o,t,e){let r=[],i=[],n=[],s=[o,t];for(let a=0,l=s.length;a<l;a++){r[a]=a;let c=s[a];if(i[a]=String(c).toUpperCase().match(/\D+|\d+(?:\.\d+)?/g),n[a]=[],i[a])for(let h=0;h<i[a].length;h++)n[a][h]=i[a][h].match(/\d/)?1:2}return(function(a,l){let c=i[a],h=i[l],u=n[a],d=n[l];if(!c||!h)return e?c==h?0:c?-1:1:c==h?0:c?1:-1;let p=Math.max(c.length,h.length);for(let m=0;m<p;m++){if(e)if(c[m])if(h[m]){if(c[m]!=h[m])return u[m]!=d[m]?u[m]==1?1:-1:u[m]==1?h[m]-c[m]:c[m]<h[m]?1:-1}else return-1;else return 1;if(c[m])if(h[m]){if(c[m]!=h[m])return u[m]!=d[m]?u[m]==1?-1:1:u[m]==1?c[m]-h[m]:c[m]<h[m]?-1:1}else return 1;else return-1}return 0})(r[0],r[1])}function tte(o,t){let e=!1;for(let r in t)if(Object.hasOwnProperty.call(t,r)&&o.indexOf(r)!==-1){e=!0;break}return e}function mgt(o,t=""){return o.sort((r,i)=>TNe(TTe(e(r)),TTe(e(i)))),o;function e(r){if(!r)return r;let i;if(Array.isArray(t)){let n="";for(let s=0;s<t.length;s++)if(Object.hasOwnProperty.call(r,t[s])){n=r[t[s]];break}}else i=r[t]||r;return i}}function ggt(o,t,e=1){var r,i,n,s;let a=(r=o.match(/^\D+/))==null?void 0:r[0],l=(i=o.match(/\d+$/))==null?void 0:i[0],c=(n=t.match(/^\D+/))==null?void 0:n[0],h=(s=t.match(/\d+$/))==null?void 0:s[0];return a&&c?a!==c?e===1?a.localeCompare(c):c.localeCompare(a):l!==h?+l>+h?1*e:-1*e:0:a?-1*e:c?1*e:0}function ygt(o){return new Promise(t=>{setTimeout(t,o)})}var SYt=Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map(o=>o.charCodeAt(0));function bgt(){try{if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis}catch{return null}}function $(){return self.EDITOR_TOP||self}var eh=(o,t)=>{let e=/{([^}]*)}/gim,r=[...new Set(o.match(e))];for(let i=0;i<r.length;i++){let n=r[i],s=n.substring(1,n.length-1);t[s]&&(o=o.replace(n,t[s]))}return o};function Pgt(o,t,e){t=t||1,e=e||32;var r="",i=t,n=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];o&&(i=Math.round(Math.random()*(e-t))+t);for(var s=0;s<i;s++){let a=Math.round(Math.random()*(n.length-1));r+=n[a]}return r}function Tgt(o){try{return JSON.parse(o)}catch{return console.error(`ParseJSON failed:
`+o),null}}var Igt=(o=>(o[o.TRACE=0]="TRACE",o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR",o[o.DUMMY=5]="DUMMY",o))(Igt||{}),Cgt=(o,t)=>{switch(o){case 4:console.error(...t);break;case 3:console.warn(...t);break;case 2:console.info(...t);break;default:console.log(...t)}},Sgt=(o,t)=>t,Egt=class Iz{constructor(t,e=Cgt,r=Sgt){this.level=t,this.writer=e,this.formatter=r}wrap(t){return new Iz(this.level,this.writer,(e,r)=>(r=this.formatter(e,r),t(e,r)))}inject(t){return new Iz(this.level,this.writer,(e,r)=>(r=t(e,r),this.formatter(e,r)))}shadow(...t){return new Iz(this.level,(e,r)=>{this.writer(e,r);for(let i of t)i(e,r)},this.formatter)}mix(...t){return new Iz(0,(e,r)=>{this.process(e,r);for(let i of t)i.process(e,r)},(e,r)=>r)}process(t,e){this.level<=t&&this.writer(t,this.formatter(t,e))}process1(t,e,r){this.level<=t&&this.writer(t,this.formatter(t,[dgt(e,...r)]))}trace(...t){this.process(0,t)}trace1(t,...e){this.process1(0,t,e)}debug(...t){this.process(1,t)}debug1(t,...e){this.process1(1,t,e)}info(...t){this.process(2,t)}info1(t,...e){this.process1(2,t,e)}warn(...t){this.process(3,t)}warn1(t,...e){this.process1(3,t,e)}error(...t){this.process(4,t)}error1(t,...e){this.process1(4,t,e)}},EYt=new Egt(5),OYt=Date.now()-performance.now(),INe=new ArrayBuffer(10),AYt=new Float64Array(INe,0,1),_Yt=new Uint8Array(INe);var $Te={};agt($Te,{HAS_PANEL:()=>jgt,HAS_PCB:()=>Ygt,HAS_SCH:()=>zgt,HAS_SIM:()=>Xgt,IS_CLIENT:()=>DS,IS_CLIENT_HALF_OFFLINE:()=>Mz,IS_CLIENT_NOT_ONLINE:()=>Fgt,IS_CLIENT_OFFLINE:()=>ENe,IS_CLIENT_ONLINE:()=>Bee,IS_DEV:()=>vgt,IS_EASYEDA:()=>SNe,IS_EASYEDA_CLIENT:()=>Bgt,IS_ECAD:()=>xgt,IS_ENTERPRISE_CLIENT:()=>Rgt,IS_HALF_OFFLINE:()=>ite,IS_LCEDA:()=>CNe,IS_LCEDA_CLIENT:()=>kgt,IS_OFFLINE:()=>nte,IS_ONLINE:()=>rte,IS_PCBLUXSHARE:()=>Dgt,IS_PRIVATE:()=>Yz,PRO_EDITOR_MODE:()=>Vgt,PRO_EDITOR_MODES:()=>hm,SSO_EXTERNAL_IDENTITY_DOMAIN:()=>Lgt,SSO_EXTERNAL_PERMISSION_DOMAIN:()=>Mgt,SSO_EXTERNAL_PERMISSION_MANAGED_DOMAIN:()=>Ngt,SSO_IDENTITY_CONNECT:()=>wgt});var Ogt=(o=>(o.ruler="ruler",o.un_ruler="un_ruler",o))(Ogt||{}),Agt=(o=>(o[o.HOME=-1]="HOME",o[o.BLANKTAB=0]="BLANKTAB",o[o.SCH=1]="SCH",o[o.PART=2]="PART",o[o.PCB=3]="PCB",o[o.FOOTPRINT=4]="FOOTPRINT",o[o.PRJ=5]="PRJ",o[o.SUBPART=6]="SUBPART",o[o.NGSPICE_MODEL=7]="NGSPICE_MODEL",o[o.NGSPICE=8]="NGSPICE",o[o.SIMULIDE=9]="SIMULIDE",o[o.WAVEFORM=10]="WAVEFORM",o[o.SCHLIB3D=11]="SCHLIB3D",o[o.PHOTOVIEW=12]="PHOTOVIEW",o[o.SCHMODULE=13]="SCHMODULE",o[o.PCBMODULE=14]="PCBMODULE",o[o.VIEW3D=15]="VIEW3D",o[o.PCBLIB3D=16]="PCBLIB3D",o[o.BLOCK_SYMBOL=17]="BLOCK_SYMBOL",o[o.NETFLAG=18]="NETFLAG",o[o.NETPORT=19]="NETPORT",o[o.SHEET_SYMBOL=20]="SHEET_SYMBOL",o[o.NONEELEC_SYMBOL=21]="NONEELEC_SYMBOL",o[o.SHORT_SYMBOL=22]="SHORT_SYMBOL",o[o.FOOTPRINTVIEW=23]="FOOTPRINTVIEW",o[o.CNCPRINTVIEW=24]="CNCPRINTVIEW",o[o.OFF_PAGE_CONNECTOR=25]="OFF_PAGE_CONNECTOR",o[o.PANEL=26]="PANEL",o[o.PANEL3D=27]="PANEL3D",o[o.DEVICE=28]="DEVICE",o[o.PANEL_LIB=29]="PANEL_LIB",o[o.ASSEMBLY_VARIANT=30]="ASSEMBLY_VARIANT",o[o.DIFF_PAIRS_FLAG=31]="DIFF_PAIRS_FLAG",o[o.SIMULIDE_MODEL=32]="SIMULIDE_MODEL",o))(Agt||{}),_gt=(o=>(o.SCH="SCH",o.PCB="PCB",o.PANEL="PANEL",o.SIM="SIM",o))(_gt||{}),p5e=bgt(),hm=String((p5e==null?void 0:p5e.PRO_EDITOR_MODE)||"LCEDA").split("-"),vgt=hm.indexOf("DEVPRO")>=0,DS=hm.indexOf("CLIENT")>=0,CNe=hm.indexOf("LCEDA")>=0,SNe=hm.indexOf("EASYEDA")>=0,Yz=hm.indexOf("PRIVATE")>=0,rte=hm.indexOf("ONLINE")>=0,ite=hm.indexOf("HALF_OFFLINE")>=0,nte=hm.indexOf("OFFLINE")>=0,xgt=hm.indexOf("ECAD")>=0,Rgt=hm.indexOf("ENTERPRISE")>=0,Dgt=hm.indexOf("PCB_LUXSHARE")>=0,wgt=hm.indexOf("SSO_IDENTITY_CONNECT")>=0,Lgt=hm.indexOf("SSO_EXTERNAL_IDENTITY_DOMAIN")>=0,Mgt=hm.indexOf("SSO_EXTERNAL_PERMISSION_DOMAIN")>=0,Ngt=hm.indexOf("SSO_EXTERNAL_PERMISSION_MANAGED_DOMAIN")>=0,kgt=DS&&CNe,Bgt=DS&&SNe,Mz=DS&&ite,Fgt=DS&&!rte,ENe=DS&&nte,Bee=DS&&rte,Vgt=DS?rte?"ONLINE":ite?"HALF_OFFLINE":nte?"OFFLINE":"":"",Ggt=hm.indexOf("SCH")>=0,Ugt=hm.indexOf("PCB")>=0,Hgt=hm.indexOf("PANEL")>=0,Wgt=hm.indexOf("SIM")>=0,zgt=Ggt,Ygt=Ugt,jgt=Hgt,Xgt=Wgt,KTe=(o=>(o.PROJECT_BACKUPS_MANUAL="Backup Project Manually",o.PROJECT_BACKUPS_AUTO="Backup Project Automatically",o.DELETE_BACKUPS="Delete Backup",o.SAVE="Save",o.CREATE_SHEET="New Page",o.DELETE_SHEET="Delete Page",o.RENAME_SHEET="Rename Page",o.SIGNED_SHEET="Check Out Page",o.SIGNIN_SHEET="Check In Page",o.CLEAR_SIGNED="Clear Check Out",o.PROJECT_LOCK="Lock Project",o.PROJECT_UNLOCK="Unlock Project",o.PROJECT_OPEN="Open Project",o.PROJECT_CLOSE="Close Project",o.DOCUMENT_PASTE="Paste Document",o.DOCUMENT_PASTE_ACROSS_PROJECT="Paste Document Across Projects",o.SCHEMATIC_PASTE="Paste Schematic",o.SCHEMATIC_PASTE_ACROSS_PROJECT="Paste Schematic Across Projects",o.PRIMITIVE_PASTE_ACROSS_PROJECT="Paste Elements Across Projects",o.PROJECT_SAVEAS_REMOTE="Save Project to Cloud",o.PROJECT_SAVEAS_LOCAL="Save Project to Local",o.LIBRARY_SAVEAS_LOCAL="Save Library to Local",o.DOCUMENT_SAVEAS_REMOTE="Save Document to Cloud",o.DOCUMENT_SAVEAS_LOCAL="Save Document to Local",o.CBB_SAVEAS_REMOTE="Save Reuse Module to Cloud",o.CBB_SAVEAS_LOCAL="Save Reuse Module to Local",o.SVG_EXPORT="Export SVG",o.PNG_EXPORT="Export PNG",o.PDF_EXPORT="Export PDF",o.BOM_EXPORT="Export BOM",o.PRINT="Print",o.GERBER_EXPORT="Export Gerber",o.COORDINATE_EXPORT="Export Pick and Place File",o.D3FILE_EXPORT="Export 3D File",o.D3SHELLFILE_EXPORT="Export 3D Shell File",o.TESTPOINT_REPORT_EXPORT="Export Test Point Report",o.DXF_EXPORT="Export DXF",o.ODBPLUSS_EXPORT="Export ODB++",o.AD_EXPORT="Export Altium Designer",o.DEVICE_REPLACE="Replace Device",o.FOOTPRINT_REPLACE="Replace Footprint",o.D3MODEL_REPLACE="Replace 3D Model",o.PROJECTLIB_UPDATE="Update Project Library",o.REPLACE="Find and Replace",o.TRACK_BATCH_RENAME="Rename Wires in Batch",o.SHEET_BATCH_RENAME="Rename Pages in Batch",o.NET_CREATED_AUTO="Automatic Network Generation",o.DESIGNATOR_ALLOCATION="Annotate Designator",o.UNIQUE_ID_RESET="Reset Unique ID",o.NET_TABLE_EXPORT="Export Netlist",o.REFRESH_PCB_BY_SCH="Update Schematic to PCB",o.REFRESH_SCH_BY_PCB="Update PCB to Schematic",o.CLEAR_DESIGNATOR="Clear Designator",o.UPDATE_PORT_BY_MODULE_SYMBOL="Update Ports from Module Symbol",o.DESIGN_RULE="Set Design Rules",o.NET_CLASS="Set Network Class",o.EQUAL_LENGTH_GROUP="Set Equal Length Group",o.DIFFERENTIAL_PAIR="Set Differential Pair",o))(KTe||{}),lM=class tx{constructor(t,e=crypto.randomUUID()){this.fileName=t,this.uuid=e,this._params=new URLSearchParams,this._aTarget=document.createElement("a"),this._params.append("uuid",e),this._params.append("fileName",t)}static get URL_VERSION(){var t;try{let e=location.host,r="/";return((t=new RegExp(`${e}(/[\\w|.]+)${r}`).exec(location.href))==null?void 0:t[1])||""}catch{return""}}static getOpenedStream(t){return this._openedInstances.get(t)}get createURL(){return`${tx.CREATE_URL}?${this._params}`}get writeURL(){return`${tx.WRITE_URL}?${this._params}`}get closeURL(){return`${tx.CLOSE_URL}?${this._params}`}get cancelURL(){return`${tx.CANCEL_URL}?${this._params}`}async create(){this._aTarget.href=this.createURL,this._aTarget.click(),this._aTarget.remove(),tx._openedInstances.set(this.uuid,this),await ygt(100)}async write(t){await(await fetch(this.writeURL,{method:"post",body:t})).json()}async close(){await fetch(this.closeURL,{method:"post"}),tx._openedInstances.delete(this.uuid)}async cancel(){await fetch(this.cancelURL,{method:"post"}),tx._openedInstances.delete(this.uuid)}};lM.CREATE_URL=`${lM.URL_VERSION}/sw/download/stream/create`,lM.WRITE_URL="/sw/download/stream/write",lM.CLOSE_URL="/sw/download/stream/close",lM.CANCEL_URL="/sw/download/stream/cancel",lM._openedInstances=new Map;var fB=lM;var qgt=Object.create,ONe=Object.defineProperty,$gt=Object.getOwnPropertyDescriptor,Kgt=Object.getOwnPropertyNames,Zgt=Object.getPrototypeOf,Jgt=Object.prototype.hasOwnProperty,f5e=(o=>typeof Vk<"u"?Vk:typeof Proxy<"u"?new Proxy(o,{get:(t,e)=>(typeof Vk<"u"?Vk:t)[e]}):o)(function(o){if(typeof Vk<"u")return Vk.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')}),cc=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),Qgt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Kgt(t))!Jgt.call(o,i)&&i!==e&&ONe(o,i,{get:()=>t[i],enumerable:!(r=$gt(t,i))||r.enumerable});return o},mB=(o,t,e)=>(e=o!=null?qgt(Zgt(o)):{},Qgt(t||!o||!o.__esModule?ONe(e,"default",{value:o,enumerable:!0}):e,o)),jz=cc((o,t)=>{"use strict";var e=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,s=(j,J)=>{for(var oe in J)e(j,oe,{get:J[oe],enumerable:!0})},a=(j,J,oe,pe)=>{if(J&&typeof J=="object"||typeof J=="function")for(let ge of i(J))!n.call(j,ge)&&ge!==oe&&e(j,ge,{get:()=>J[ge],enumerable:!(pe=r(J,ge))||pe.enumerable});return j},l=j=>a(e({},"__esModule",{value:!0}),j),c={};s(c,{BroadcastChannelMessageBus:()=>Q,MessageBus:()=>L,MessageBus2:()=>X,MessageBusTask:()=>W,MessageBusTask2:()=>V,WindowMessageBridge:()=>G,WorkerMessageBridge:()=>z,createBroadcastP2PStream:()=>me,createBufferedByteBufferStream:()=>K,createBufferedStream:()=>re,createBufferedStringStream:()=>se,dropP2PStream:()=>Oe,flowRead:()=>Pe,flowWrite:()=>ue}),t.exports=l(c);var h=class{constructor(j=1.5){this.growthFactor=j,this.capacity=10,this.buffer=new Array(this.capacity),this.head=0,this.tail=0,this.count=0}enqueue(j){if(this.count===this.capacity){let J=Math.floor(this.capacity*this.growthFactor);console.log("grow",this.capacity,J);let oe=new Array(J);for(let pe=0;pe<this.count;pe++)oe[pe]=this.buffer[(this.head+pe)%this.capacity];this.buffer=oe,this.head=0,this.tail=this.count,this.capacity=J}this.buffer[this.tail]=j,this.tail=(this.tail+1)%this.capacity,this.count++}dequeue(){if(this.isEmpty())return;let j=this.buffer[this.head];return this.head=(this.head+1)%this.capacity,this.count--,j}peek(){return this.buffer[this.head]}isEmpty(){return this.count===0}clear(){this.buffer.length=0,this.head=0,this.tail=0,this.count=0}},u=new ArrayBuffer(8),d=new Float64Array(u),p=new Uint32Array(u),m=new Uint16Array(u),g=ArrayBuffer;try{g=self.HTMLImageElement||g}catch{}var y=typeof SharedArrayBuffer<"u";function b(j){if(typeof j!="object"||j===null||j instanceof Date||j instanceof ArrayBuffer||y&&j instanceof SharedArrayBuffer||j instanceof Blob||j instanceof FormData||j instanceof Function||j instanceof Uint8ClampedArray||j instanceof g)return j;if(Array.isArray(j))return j.map(b);{let J={};for(let oe in j)Object.hasOwnProperty.call(j,oe)&&(J[oe]=b(j[oe]));return J}}function P(j,J){return T(j,J,()=>[])}function T(j,J,oe){let pe=j[J];return pe!==void 0||(pe=oe(J),j[J]=pe),pe}var I=class{constructor(j){this.maxResources=j,this.idle=new h,this.isClosed=!1,this.resources=j}acquire(j){this.isClosed?Promise.resolve(!1).then(j):this.resources>0?(this.resources--,Promise.resolve(!0).then(j)):this.idle.enqueue(j)}acquireSync(){return new Promise(j=>{this.acquire(j)})}release(){if(!this.isClosed){let j=this.idle.dequeue();j?Promise.resolve(!0).then(j):this.resources++}}close(){if(!this.isClosed)for(this.isClosed=!0;!this.idle.isEmpty();){let j=this.idle.dequeue();Promise.resolve(!1).then(j)}}};function C(){if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis;if(typeof global<"u")return global}function E(j,J){let oe=0,pe=j.length;for(let ge=0;ge<pe;ge++)j[ge]===J&&(j.splice(ge,1),ge--,pe--,oe++);return oe}var O=C(),_=O.WeakRef||(j=>j);function R(j){if(j!=null){if(typeof j=="object")return new _(j);console.error(j,j instanceof Object,typeof j);return}}function v(j){return j==null?void 0:j.deref()}var D="_MSG_BUS_RPC_",w=300*1e3,F=(j=>(j.PUBLISH="publish",j.SUBSCRIBE="subscribe",j.PUSH="push",j.PULL="pull",j))(F||{}),H=class{constructor(j){this.bus=j}processRemoteMessage(j,J){let oe=R(J),pe=j.topic,ge=j.type,Se=j.message;switch(ge){case"pull":this.bus.pull(pe,De=>{this.push(pe,De,v(oe))});break;case"subscribe":this.bus.subscribe(pe,De=>{this.publish(pe,De,v(oe))});break;case"publish":this.bus.publish(pe,Se,this,v(oe));break;case"push":this.bus.push(pe,Se,this,v(oe));break;default:console.debug("unknown message type "+ge)}}rpcCall(j,J,oe,pe=w){let ge=R(oe),Se=new Promise(De=>{let tt=this.bus.uniqueRpcTopic(j);this.publish(j,{message:J,reply:tt},v(ge)),this.bus.pull(tt,(Ze,Wt,Nr)=>{De({message:Ze,bridge:Wt,source:R(Nr)})})});return pe>0?Promise.race([Se,new Promise((De,tt)=>{setTimeout(tt,pe)})]):Se}},z=class extends H{constructor(j,J){super(j),this.worker=J,J.onmessage=oe=>{this.processRemoteMessage(oe.data,void 0)}}publish(j,J){this.postMessage(j,"publish",J)}subscribe(j){this.postMessage(j,"subscribe",null)}push(j,J){this.postMessage(j,"push",J)}pull(j){this.postMessage(j,"pull",null)}rpcCall(j,J,oe=w){return super.rpcCall(j,J,void 0,oe)}postMessage(j,J,oe){let pe={topic:j,type:J,message:oe};this.worker.postMessage(pe)}discard(){this.worker.terminate()}},G=class extends H{constructor(j){super(j),window.addEventListener("message",J=>{this.processRemoteMessage(J.data,J.source)},!1)}publish(j,J,oe){this.postMessage(j,"publish",J,oe)}subscribe(j,J){if(J===window)throw new Error("regist remote subscribe from current window is not permitted");this.postMessage(j,"subscribe",null,J)}push(j,J,oe){this.postMessage(j,"push",J,oe)}pull(j,J){if(J===window)throw new Error("regist remote pull from current window is not permitted");this.postMessage(j,"pull",null,J)}postMessage(j,J,oe,pe){let ge={topic:j,type:J,message:oe};pe&&pe.postMessage(ge,"*")}},W=class{constructor(j){this.isRunning=!0,this.callback=j}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}execute(j,J,oe,pe){try{j=pe?j:b(j),this.callback(j,J,oe)}catch(ge){console.error(ge)}}},L=class{constructor(j=!1){this.subscribed={},this.pulled={},this.pushed={},this.uuid=crypto.randomUUID().replace(/-/g,""),this.rpcTicket=0,this.unsafe=j}uniqueRpcTopic(j){return`${D}-${j}-${this.uuid}-${this.rpcTicket++}`}publish(j,J,oe,pe){let ge=this.subscribed[j];if(ge){let Se;for(let De of ge)De.running()?De.execute(J,oe,pe,this.unsafe):(Se=Se||new Array,Se.push(De));if(Se)for(let De of Se)E(ge,De)}else console.debug("no sub on topic: "+j)}subscribe(j,J){let oe=new W(J);return P(this.subscribed,j).push(oe),oe}push(j,J,oe,pe){let ge=!1,Se=this.pulled[j];if(Se){for(;Se.length>0;){let De=Se.shift();if(De.running()){De.execute(J,oe,pe,this.unsafe),ge=!0;break}}Se.length===0&&delete this.pulled[j]}ge||P(this.pushed,j).push({message:J,bridge:oe,source:R(pe)})}pull(j,J){let oe=new W(J),pe=this.pushed[j];if(pe){let ge=pe.shift();oe.execute(ge.message,ge.bridge,v(ge.source),this.unsafe),pe.length===0&&delete this.pushed[j]}else P(this.pulled,j).push(oe);return oe}pullA(j){return new Promise(J=>{this.pull(j,(oe,pe,ge)=>{J({message:oe,bridge:pe,source:R(ge)})})})}rpcService(j,J){this.subscribe(j,(oe,pe,ge)=>{let{message:Se,reply:De}=oe;try{let tt=J(Se);if(tt instanceof Promise){let Ze=R(ge);tt.then(Wt=>{this.rpcReply(Wt,De,pe,v(Ze))},Wt=>{console.error(Wt),this.rpcReply(void 0,De,pe,v(Ze))})}else this.rpcReply(tt,De,pe,ge)}catch(tt){console.error(tt),this.rpcReply(void 0,De,pe,ge)}})}rpcCall(j,J,oe=w){let pe=new Promise(ge=>{let Se=this.uniqueRpcTopic(j);this.publish(j,{message:J,reply:Se}),this.pull(Se,(De,tt,Ze)=>{ge({message:De,bridge:tt,source:R(Ze)})})});return oe>0?Promise.race([pe,new Promise((ge,Se)=>{setTimeout(Se,oe)})]):pe}rpcReply(j,J,oe,pe){oe?oe.push(J,j,pe):this.push(J,j)}},B="_MSG_BUS_RPC_";function N(j,J){let oe=0,pe=j.length;for(let ge=0;ge<pe;ge++)j[ge]===J&&(j.splice(ge,1),ge--,pe--,oe++);return oe}function U(j,J){return k(j,J,()=>[])}function k(j,J,oe){let pe=j[J];return pe!==void 0||(pe=oe(J),j[J]=pe),pe}var V=class{constructor(j,J){this.callback=j,this.unsafe=J,this.isRunning=!0}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}async execute(j){try{j=this.unsafe?j:b(j),this.callback(j)}catch(J){console.error(J)}}},Y=class{constructor(j=crypto.randomUUID()){this.uuid=j,this.rpcTicket=0}subscribeOnce(j,J){let oe=this.subscribe(j,pe=>{oe.cancel(),J(pe)});return oe}pullA(j){return new Promise(J=>{this.pull(j,J)})}rpcService(j,J){let oe=pe=>{try{let{message:ge,replyTopic:Se}=pe;try{let De=J(ge);De instanceof Promise?De.then(tt=>{this.publish(Se,{success:!0,result:tt})}).catch(tt=>{console.error(tt),this.publish(Se,{success:!1,err:String(tt)})}):this.publish(Se,{success:!0,result:De})}catch(De){this.publish(Se,{success:!1,err:String(De)})}}finally{this.pull(j,oe)}};this.pull(j,oe)}rpcCall(j,J,oe=0){let pe=new Promise((ge,Se)=>{let De=`${B}-${j}-${this.uuid}-${this.rpcTicket++}`;this.subscribeOnce(De,tt=>{tt.success?ge(tt.result):Se(new Error(tt.err))}),this.push(j,{message:J,replyTopic:De})});return oe>0?Promise.race([pe,new Promise((ge,Se)=>{setTimeout(Se,oe)})]):pe}},X=class extends Y{constructor(j=!1){super(),this.unsafe=j,this.subscribed={},this.pulled={},this.pushed={}}publish(j,J){let oe=this.subscribed[j];if(oe){let pe;for(let ge of oe)ge.running()?ge.execute(J):(pe=pe||new Array,pe.push(ge));if(pe)for(let ge of pe)N(oe,ge)}}subscribe(j,J){let oe=new V(J,this.unsafe);return U(this.subscribed,j).push(oe),oe}push(j,J){let oe=!1,pe=this.pulled[j];if(pe){for(;pe.length>0;){let ge=pe.shift();if(ge&&ge.running()){ge.execute(J),oe=!0;break}}pe.length===0&&delete this.pulled[j]}oe||U(this.pushed,j).push(J)}pull(j,J){let oe=new V(J,this.unsafe);return this.repull(j,oe),oe}repull(j,J){let oe=this.pushed[j];if(oe){let pe=oe.shift();pe&&(J.execute(pe),oe.length===0&&delete this.pushed[j])}else U(this.pulled,j).push(J)}},Z=class extends Y{constructor(j=crypto.randomUUID()){super(j),this.subscribed={},this.pushed={},this.pulled={},this.pushCnt=0}publish(j,J){console.debug("BC",this.uuid,"PUBLISH",j,J),this.broadcastPublish(j,J)}subscribe(j,J){console.debug("BC",this.uuid,"SUBSCRIBE",j);let oe=new V(J,!0);return U(this.subscribed,j).push(oe),oe}push(j,J){let oe=this.pushCnt++;console.debug("BC",this.uuid,"PUSH",j,`(${oe})`,J),U(this.pushed,j).push({id:oe,message:J}),this.broadcastPushedHeadMessage(j)}pull(j,J){console.debug("BC",this.uuid,"PULL",j);let oe=new V(J,!0);return U(this.pulled,j).push(oe),this.broadcastWhoHas(j),oe}broadcastPushedHeadMessage(j){let J=this.pushed[j];J&&J[0]&&this.broadcastIHave(j,J[0].id)}onReceivedPublish(j,J,oe){console.debug("BCMSG(",this.uuid,")","from",j,"PUBLISH",J,"message",oe);let pe=this.subscribed[J];if(pe){let ge;for(let Se of pe)Se.running()?Se.execute(oe):(ge=ge||new Array,ge.push(Se));if(ge)for(let Se of ge)N(pe,Se);pe.length===0&&delete this.subscribed[J]}}onReceivedWhoHas(j,J){console.debug("BCMSG(",this.uuid,")","from",j,"WHOHAS",J),this.broadcastPushedHeadMessage(J)}onReceivedIHave(j,J,oe){console.debug("BCMSG(",this.uuid,")","from",j,"IHAVE",J,"id",oe);let pe=this.pulled[J];if(pe){let ge;for(let Se of pe)if(Se.running()){this.broadcastINeed(J,j,oe);break}else ge=ge||new Array,ge.push(Se);if(ge)for(let Se of ge)N(pe,Se);pe.length===0&&delete this.pulled[J]}}onReceivedINeed(j,J,oe,pe){if(console.debug("BCMSG(",this.uuid,")","from",j,"INEED",J,"source",oe,"id",pe),this.uuid===oe){let ge=this.pushed[J];if(ge&&ge[0]&&ge[0].id===pe){let{message:Se}=ge.shift();this.broadcastIGive(J,pe,j,Se),this.broadcastPushedHeadMessage(J),ge.length===0&&delete this.pushed[J]}}}onReceivedIGive(j,J,oe,pe,ge){console.debug("BCMSG(",this.uuid,")","from",j,"IGIVE",J,"id",oe,"target",pe,"message",ge);let Se=this.pulled[J];if(Se&&this.uuid===pe){let De=!1;for(;Se.length>0;){let tt=Se.shift();if(tt.running()){tt.execute(ge),De=!0;break}}De||this.push(J,ge),Se.length===0&&delete this.pulled[J]}}},Q=class extends Z{constructor(j,J=crypto.randomUUID()){super(J),this.bc=new BroadcastChannel(j),this.bc.onmessage=oe=>{this.onMessage(oe.data)}}onMessage(j){let{type:J,uuid:oe,topic:pe}=j;switch(J){case"PUBLISH":{let{message:ge}=j;this.onReceivedPublish(oe,pe,ge);break}case"WHOHAS":{this.onReceivedWhoHas(oe,pe);break}case"IHAVE":{let{id:ge}=j;this.onReceivedIHave(oe,pe,ge);break}case"INEED":{let{source:ge,id:Se}=j;this.onReceivedINeed(oe,pe,ge,Se);break}case"IGIVE":{let{target:ge,id:Se,message:De}=j;this.onReceivedIGive(oe,pe,Se,ge,De);break}default:console.warn("unsupported",j)}}broadcastPublish(j,J){this.post({type:"PUBLISH",uuid:this.uuid,topic:j,message:J})}broadcastWhoHas(j){this.post({type:"WHOHAS",uuid:this.uuid,topic:j})}broadcastIHave(j,J){this.post({type:"IHAVE",uuid:this.uuid,topic:j,id:J})}broadcastINeed(j,J,oe){this.post({type:"INEED",uuid:this.uuid,topic:j,source:J,id:oe})}broadcastIGive(j,J,oe,pe){this.post({type:"IGIVE",uuid:this.uuid,topic:j,id:J,target:oe,message:pe})}post(j){this.bc.postMessage(j),Promise.resolve().then(()=>{this.onMessage(j)})}},ae=Symbol("BLOCKING_QUEUE_RESET"),he=class{constructor(j,J=()=>1){if(this.maxSize=j,this.itemSizeOf=J,this.queue=new h,this.waitingConsumers=new h,this.waitingProducers=new h,this.queueSize=0,this.closePromise=null,this.closeResolve=null,j<=0)throw new Error("Max size must be greater than 0")}enqueue(j){return this.closePromise?!1:this.isFull()?(async()=>{console.debug("queue is full",this.queueSize,this.maxSize);let J=await new Promise(oe=>{this.waitingProducers.enqueue(oe)});return console.debug("queue is not full",this.size(),J),J?(this.innerEnqueue(j),!0):!1})():(this.innerEnqueue(j),!0)}innerEnqueue(j){if(this.waitingConsumers.isEmpty())this.queue.enqueue(j),this.queueSize+=this.itemSizeOf(j),console.debug("queue pushed",j,"size",this.queueSize);else{let J=this.waitingConsumers.dequeue();Promise.resolve(j).then(J),console.debug("queue direct",j,"size",this.queueSize)}}dequeue(){if(this.queue.isEmpty())if(this.closePromise){for(;!this.waitingConsumers.isEmpty();){let j=this.waitingConsumers.dequeue();Promise.resolve(ae).then(j)}return setTimeout(()=>this.closeResolve(),0),ae}else return new Promise(j=>{this.waitingConsumers.enqueue(j)});else{let j=this.queue.dequeue();if(this.queueSize-=this.itemSizeOf(j),!this.waitingProducers.isEmpty()){let J=this.waitingProducers.dequeue();Promise.resolve(!0).then(J)}return j}}size(){return this.queueSize}isEmpty(){return this.queueSize===0}isFull(){return this.queueSize>=this.maxSize}close(){return this.closePromise||(this.closePromise=new Promise(j=>{for(this.closeResolve=j;!this.waitingProducers.isEmpty();){let J=this.waitingProducers.dequeue();Promise.resolve(!1).then(J)}if(this.queueSize===0){for(;!this.waitingConsumers.isEmpty();){let J=this.waitingConsumers.dequeue();Promise.resolve(ae).then(J)}j()}})),this.closePromise}};function re(j,J,oe=Number.MAX_SAFE_INTEGER){let pe=new he(oe,J),ge=new ReadableStream({pull(De){let tt=!0,Ze=(async()=>{let Wt=new Array;do{let Nr=pe.dequeue();if(Nr instanceof Promise){tt=!1;let Lr=await Nr;Lr===ae?De.close():Wt.push(Lr)}else{let Lr=Nr;Lr===ae?De.close():Wt.push(Lr)}}while(pe.size()>0);if(Wt.length>0){let Nr=j(Wt);De.enqueue(Nr)}})();if(!tt)return console.debug("read stream stucked --------------------------------------"),Ze},async cancel(){console.debug("buffered readable cancel"),await pe.close()}}),Se=new WritableStream({write(De,tt){let Ze=!0,Wt=(async()=>{let Nr=pe.enqueue(De);typeof Nr=="boolean"?Nr||tt.error(new Error("Write stream closed")):(Ze=!1,await Nr||tt.error(new Error("Write stream closed")))})();if(!Ze)return console.debug("read stream stucked >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"),Wt},async close(){console.debug("buffered writable closing",pe.size()),await pe.close(),console.debug("buffered writable closed",pe.size())},async abort(){console.debug("buffered writable aborting",pe.size()),await pe.close(),console.debug("buffered writable aborted",pe.size())}});return{readable:ge,writable:Se}}function se(j=Number.MAX_SAFE_INTEGER){return re(J=>J.join(""),J=>J.length,j)}function K(j=Number.MAX_SAFE_INTEGER){return re(J=>{let oe=new Uint8Array(J.reduce((ge,Se)=>ge+Se.byteLength,0)),pe=0;return J.forEach(ge=>{oe.set(ge,pe),pe+=ge.byteLength}),oe},J=>J.byteLength,j)}function me(j){return new Promise((J,oe)=>{let pe=new BroadcastChannel(j),ge=new he(1),Se=new I(1),De=null,tt=!1,Ze=!1,Wt=!1;pe.onmessage=Nr=>{let Lr=Nr.data,{type:Dr}=Lr;if(console.debug("p2p",j,"type",Dr,"data",Dr==="DATA"&&Lr.data),Dr==="DATA")ge.enqueue(Lr.data);else if(Dr==="HI"){if(!De){pe.postMessage({type:"HI"});let Ut=0;De={rs:new ReadableStream({async pull(ar){let Fe=await ge.dequeue();Fe===ae?(await ke(),ar.close()):(ar.enqueue(Fe),pe.postMessage({type:"ACK"}))},cancel(){return ke()}}),ws:new WritableStream({async write(ar,Fe){await Se.acquireSync()?pe.postMessage({type:"DATA",id:Ut++,data:ar}):(Rr(),Fe.error(new Error("Write stream closed")))},close(){Rr()},abort(){Rr()}})},J(De)}}else Dr==="REND"?De?Se.close():Yt("REND1"):Dr==="WEND"?De?ge.close():Yt("WEND1"):Dr==="ACK"&&Se.release();function Rr(){tt||(tt=!0,console.debug(j,"p2p write stream closed"),Se.close(),pe.postMessage({type:"WEND"}),Ze&&(console.debug(j,"p2p channel closed on ws"),pe.close()))}async function ke(){Ze||(Ze=!0,console.debug(j,"p2p read stream closed"),pe.postMessage({type:"REND"}),await ge.close(),tt&&(console.debug(j,"p2p channel closed on rs"),pe.close()))}async function Yt(Ut){Wt||(Wt=!0,console.debug(j,"p2p channel connection released on",Ut),Se.close(),ge.close(),De?(De.rs.locked||(console.debug(j,"p2p unlocked read stream direct cancel"),De.rs.cancel()),De.ws.locked||(console.debug(j,"p2p unlocked write stream direct close"),De.ws.close())):(pe.postMessage({type:"HI"}),pe.close()),oe(new Error("p2p channel connection released")))}},pe.postMessage({type:"HI"})})}function Oe(j){return new Promise(J=>{let oe=new BroadcastChannel(j);oe.onmessage=pe=>{let ge=pe.data,{type:Se}=ge;Se==="HI"&&(oe.postMessage({type:"REND"}),oe.close(),J())},oe.postMessage({type:"REND"})})}async function Ie(j){try{return await me(j)}catch(J){J.message!=="p2p channel connection released"&&console.error(J)}}async function ue(j,J,oe=10*1024*1024,pe=!0){let ge=await Ie(j);if(!ge)return!1;let Se=!1;try{let De,tt=Ze=>{if(!De)if(!pe)De=ge.ws.getWriter();else if(typeof Ze=="string"){let Wt=se(oe);Wt.readable.pipeTo(ge.ws),De=Wt.writable.getWriter()}else{let Wt=K(oe);Wt.readable.pipeTo(ge.ws),De=Wt.writable.getWriter()}return De.write(Ze)};if(Array.isArray(J))for(let Ze of J)await tt(Ze);else await J({write:tt,get desiredSize(){return((De==null?void 0:De.desiredSize)||0)+10}});De&&await De.close(),Se=!0}catch(De){console.error(De)}finally{return ge.rs.cancel(),Se}}async function Pe(j,J){var oe,pe;let ge=await Ie(j);if(ge)try{let Se=ge.rs.getReader();for((oe=J.start)==null?void 0:oe.call(J);;){let{value:De,done:tt}=await Se.read();if(De!==void 0){let Ze;if(J.update instanceof Promise?Ze=await J.update(De):Ze=J.update(De),Ze){await Se.cancel();break}}if(tt){(pe=J.end)==null||pe.call(J);break}}}catch(Se){console.error(Se)}finally{ge.ws.close()}}}),Hc=cc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r():typeof define=="function"&&define.amd?define([],r):e.CryptoJS=r()})(o,function(){var e=e||(function(r,i){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof f5e=="function")try{n=f5e("crypto")}catch{}var s=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||(function(){function T(){}return function(I){var C;return T.prototype=I,C=new T,T.prototype=null,C}})(),l={},c=l.lib={},h=c.Base=(function(){return{extend:function(T){var I=a(this);return T&&I.mixIn(T),(!I.hasOwnProperty("init")||this.init===I.init)&&(I.init=function(){I.$super.init.apply(this,arguments)}),I.init.prototype=I,I.$super=this,I},create:function(){var T=this.extend();return T.init.apply(T,arguments),T},init:function(){},mixIn:function(T){for(var I in T)T.hasOwnProperty(I)&&(this[I]=T[I]);T.hasOwnProperty("toString")&&(this.toString=T.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),u=c.WordArray=h.extend({init:function(T,I){T=this.words=T||[],I!=i?this.sigBytes=I:this.sigBytes=T.length*4},toString:function(T){return(T||p).stringify(this)},concat:function(T){var I=this.words,C=T.words,E=this.sigBytes,O=T.sigBytes;if(this.clamp(),E%4)for(var _=0;_<O;_++){var R=C[_>>>2]>>>24-_%4*8&255;I[E+_>>>2]|=R<<24-(E+_)%4*8}else for(var v=0;v<O;v+=4)I[E+v>>>2]=C[v>>>2];return this.sigBytes+=O,this},clamp:function(){var T=this.words,I=this.sigBytes;T[I>>>2]&=4294967295<<32-I%4*8,T.length=r.ceil(I/4)},clone:function(){var T=h.clone.call(this);return T.words=this.words.slice(0),T},random:function(T){for(var I=[],C=0;C<T;C+=4)I.push(s());return new u.init(I,T)}}),d=l.enc={},p=d.Hex={stringify:function(T){for(var I=T.words,C=T.sigBytes,E=[],O=0;O<C;O++){var _=I[O>>>2]>>>24-O%4*8&255;E.push((_>>>4).toString(16)),E.push((_&15).toString(16))}return E.join("")},parse:function(T){for(var I=T.length,C=[],E=0;E<I;E+=2)C[E>>>3]|=parseInt(T.substr(E,2),16)<<24-E%8*4;return new u.init(C,I/2)}},m=d.Latin1={stringify:function(T){for(var I=T.words,C=T.sigBytes,E=[],O=0;O<C;O++){var _=I[O>>>2]>>>24-O%4*8&255;E.push(String.fromCharCode(_))}return E.join("")},parse:function(T){for(var I=T.length,C=[],E=0;E<I;E++)C[E>>>2]|=(T.charCodeAt(E)&255)<<24-E%4*8;return new u.init(C,I)}},g=d.Utf8={stringify:function(T){try{return decodeURIComponent(escape(m.stringify(T)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(T){return m.parse(unescape(encodeURIComponent(T)))}},y=c.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(T){typeof T=="string"&&(T=g.parse(T)),this._data.concat(T),this._nDataBytes+=T.sigBytes},_process:function(T){var I,C=this._data,E=C.words,O=C.sigBytes,_=this.blockSize,R=_*4,v=O/R;T?v=r.ceil(v):v=r.max((v|0)-this._minBufferSize,0);var D=v*_,w=r.min(D*4,O);if(D){for(var F=0;F<D;F+=_)this._doProcessBlock(E,F);I=E.splice(0,D),C.sigBytes-=w}return new u.init(I,w)},clone:function(){var T=h.clone.call(this);return T._data=this._data.clone(),T},_minBufferSize:0}),b=c.Hasher=y.extend({cfg:h.extend(),init:function(T){this.cfg=this.cfg.extend(T),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(T){return this._append(T),this._process(),this},finalize:function(T){T&&this._append(T);var I=this._doFinalize();return I},blockSize:512/32,_createHelper:function(T){return function(I,C){return new T.init(C).finalize(I)}},_createHmacHelper:function(T){return function(I,C){return new P.HMAC.init(T,C).finalize(I)}}}),P=l.algo={};return l})(Math);return e})}),ote=cc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Hc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.Base,a=n.WordArray,l=i.x64={},c=l.Word=s.extend({init:function(u,d){this.high=u,this.low=d}}),h=l.WordArray=s.extend({init:function(u,d){u=this.words=u||[],d!=r?this.sigBytes=d:this.sigBytes=u.length*8},toX32:function(){for(var u=this.words,d=u.length,p=[],m=0;m<d;m++){var g=u[m];p.push(g.high),p.push(g.low)}return a.create(p,this.sigBytes)},clone:function(){for(var u=s.clone.call(this),d=u.words=this.words.slice(0),p=d.length,m=0;m<p;m++)d[m]=d[m].clone();return u}})})(),e})}),e1t=cc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Hc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){if(typeof ArrayBuffer=="function"){var r=e,i=r.lib,n=i.WordArray,s=n.init,a=n.init=function(l){if(l instanceof ArrayBuffer&&(l=new Uint8Array(l)),(l instanceof Int8Array||typeof Uint8ClampedArray<"u"&&l instanceof Uint8ClampedArray||l instanceof Int16Array||l instanceof Uint16Array||l instanceof Int32Array||l instanceof Uint32Array||l instanceof Float32Array||l instanceof Float64Array)&&(l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength)),l instanceof Uint8Array){for(var c=l.byteLength,h=[],u=0;u<c;u++)h[u>>>2]|=l[u]<<24-u%4*8;s.call(this,h,c)}else s.apply(this,arguments)};a.prototype=n}})(),e.lib.WordArray})}),t1t=cc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Hc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.enc,a=s.Utf16=s.Utf16BE={stringify:function(c){for(var h=c.words,u=c.sigBytes,d=[],p=0;p<u;p+=2){var m=h[p>>>2]>>>16-p%4*8&65535;d.push(String.fromCharCode(m))}return d.join("")},parse:function(c){for(var h=c.length,u=[],d=0;d<h;d++)u[d>>>1]|=c.charCodeAt(d)<<16-d%2*16;return n.create(u,h*2)}};s.Utf16LE={stringify:function(c){for(var h=c.words,u=c.sigBytes,d=[],p=0;p<u;p+=2){var m=l(h[p>>>2]>>>16-p%4*8&65535);d.push(String.fromCharCode(m))}return d.join("")},parse:function(c){for(var h=c.length,u=[],d=0;d<h;d++)u[d>>>1]|=l(c.charCodeAt(d)<<16-d%2*16);return n.create(u,h*2)}};function l(c){return c<<8&4278255360|c>>>8&16711935}})(),e.enc.Utf16})}),TM=cc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Hc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.enc,a=s.Base64={stringify:function(c){var h=c.words,u=c.sigBytes,d=this._map;c.clamp();for(var p=[],m=0;m<u;m+=3)for(var g=h[m>>>2]>>>24-m%4*8&255,y=h[m+1>>>2]>>>24-(m+1)%4*8&255,b=h[m+2>>>2]>>>24-(m+2)%4*8&255,P=g<<16|y<<8|b,T=0;T<4&&m+T*.75<u;T++)p.push(d.charAt(P>>>6*(3-T)&63));var I=d.charAt(64);if(I)for(;p.length%4;)p.push(I);return p.join("")},parse:function(c){var h=c.length,u=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var p=0;p<u.length;p++)d[u.charCodeAt(p)]=p}var m=u.charAt(64);if(m){var g=c.indexOf(m);g!==-1&&(h=g)}return l(c,h,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function l(c,h,u){for(var d=[],p=0,m=0;m<h;m++)if(m%4){var g=u[c.charCodeAt(m-1)]<<m%4*2,y=u[c.charCodeAt(m)]>>>6-m%4*2,b=g|y;d[p>>>2]|=b<<24-p%4*8,p++}return n.create(d,p)}})(),e.enc.Base64})}),r1t=cc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Hc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.enc,a=s.Base64url={stringify:function(c,h){h===void 0&&(h=!0);var u=c.words,d=c.sigBytes,p=h?this._safe_map:this._map;c.clamp();for(var m=[],g=0;g<d;g+=3)for(var y=u[g>>>2]>>>24-g%4*8&255,b=u[g+1>>>2]>>>24-(g+1)%4*8&255,P=u[g+2>>>2]>>>24-(g+2)%4*8&255,T=y<<16|b<<8|P,I=0;I<4&&g+I*.75<d;I++)m.push(p.charAt(T>>>6*(3-I)&63));var C=p.charAt(64);if(C)for(;m.length%4;)m.push(C);return m.join("")},parse:function(c,h){h===void 0&&(h=!0);var u=c.length,d=h?this._safe_map:this._map,p=this._reverseMap;if(!p){p=this._reverseMap=[];for(var m=0;m<d.length;m++)p[d.charCodeAt(m)]=m}var g=d.charAt(64);if(g){var y=c.indexOf(g);y!==-1&&(u=y)}return l(c,u,p)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function l(c,h,u){for(var d=[],p=0,m=0;m<h;m++)if(m%4){var g=u[c.charCodeAt(m-1)]<<m%4*2,y=u[c.charCodeAt(m)]>>>6-m%4*2,b=g|y;d[p>>>2]|=b<<24-p%4*8,p++}return n.create(d,p)}})(),e.enc.Base64url})}),IM=cc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Hc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.algo,c=[];(function(){for(var g=0;g<64;g++)c[g]=r.abs(r.sin(g+1))*4294967296|0})();var h=l.MD5=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(g,y){for(var b=0;b<16;b++){var P=y+b,T=g[P];g[P]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}var I=this._hash.words,C=g[y+0],E=g[y+1],O=g[y+2],_=g[y+3],R=g[y+4],v=g[y+5],D=g[y+6],w=g[y+7],F=g[y+8],H=g[y+9],z=g[y+10],G=g[y+11],W=g[y+12],L=g[y+13],B=g[y+14],N=g[y+15],U=I[0],k=I[1],V=I[2],Y=I[3];U=u(U,k,V,Y,C,7,c[0]),Y=u(Y,U,k,V,E,12,c[1]),V=u(V,Y,U,k,O,17,c[2]),k=u(k,V,Y,U,_,22,c[3]),U=u(U,k,V,Y,R,7,c[4]),Y=u(Y,U,k,V,v,12,c[5]),V=u(V,Y,U,k,D,17,c[6]),k=u(k,V,Y,U,w,22,c[7]),U=u(U,k,V,Y,F,7,c[8]),Y=u(Y,U,k,V,H,12,c[9]),V=u(V,Y,U,k,z,17,c[10]),k=u(k,V,Y,U,G,22,c[11]),U=u(U,k,V,Y,W,7,c[12]),Y=u(Y,U,k,V,L,12,c[13]),V=u(V,Y,U,k,B,17,c[14]),k=u(k,V,Y,U,N,22,c[15]),U=d(U,k,V,Y,E,5,c[16]),Y=d(Y,U,k,V,D,9,c[17]),V=d(V,Y,U,k,G,14,c[18]),k=d(k,V,Y,U,C,20,c[19]),U=d(U,k,V,Y,v,5,c[20]),Y=d(Y,U,k,V,z,9,c[21]),V=d(V,Y,U,k,N,14,c[22]),k=d(k,V,Y,U,R,20,c[23]),U=d(U,k,V,Y,H,5,c[24]),Y=d(Y,U,k,V,B,9,c[25]),V=d(V,Y,U,k,_,14,c[26]),k=d(k,V,Y,U,F,20,c[27]),U=d(U,k,V,Y,L,5,c[28]),Y=d(Y,U,k,V,O,9,c[29]),V=d(V,Y,U,k,w,14,c[30]),k=d(k,V,Y,U,W,20,c[31]),U=p(U,k,V,Y,v,4,c[32]),Y=p(Y,U,k,V,F,11,c[33]),V=p(V,Y,U,k,G,16,c[34]),k=p(k,V,Y,U,B,23,c[35]),U=p(U,k,V,Y,E,4,c[36]),Y=p(Y,U,k,V,R,11,c[37]),V=p(V,Y,U,k,w,16,c[38]),k=p(k,V,Y,U,z,23,c[39]),U=p(U,k,V,Y,L,4,c[40]),Y=p(Y,U,k,V,C,11,c[41]),V=p(V,Y,U,k,_,16,c[42]),k=p(k,V,Y,U,D,23,c[43]),U=p(U,k,V,Y,H,4,c[44]),Y=p(Y,U,k,V,W,11,c[45]),V=p(V,Y,U,k,N,16,c[46]),k=p(k,V,Y,U,O,23,c[47]),U=m(U,k,V,Y,C,6,c[48]),Y=m(Y,U,k,V,w,10,c[49]),V=m(V,Y,U,k,B,15,c[50]),k=m(k,V,Y,U,v,21,c[51]),U=m(U,k,V,Y,W,6,c[52]),Y=m(Y,U,k,V,_,10,c[53]),V=m(V,Y,U,k,z,15,c[54]),k=m(k,V,Y,U,E,21,c[55]),U=m(U,k,V,Y,F,6,c[56]),Y=m(Y,U,k,V,N,10,c[57]),V=m(V,Y,U,k,D,15,c[58]),k=m(k,V,Y,U,L,21,c[59]),U=m(U,k,V,Y,R,6,c[60]),Y=m(Y,U,k,V,G,10,c[61]),V=m(V,Y,U,k,O,15,c[62]),k=m(k,V,Y,U,H,21,c[63]),I[0]=I[0]+U|0,I[1]=I[1]+k|0,I[2]=I[2]+V|0,I[3]=I[3]+Y|0},_doFinalize:function(){var g=this._data,y=g.words,b=this._nDataBytes*8,P=g.sigBytes*8;y[P>>>5]|=128<<24-P%32;var T=r.floor(b/4294967296),I=b;y[(P+64>>>9<<4)+15]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,y[(P+64>>>9<<4)+14]=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,g.sigBytes=(y.length+1)*4,this._process();for(var C=this._hash,E=C.words,O=0;O<4;O++){var _=E[O];E[O]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360}return C},clone:function(){var g=a.clone.call(this);return g._hash=this._hash.clone(),g}});function u(g,y,b,P,T,I,C){var E=g+(y&b|~y&P)+T+C;return(E<<I|E>>>32-I)+y}function d(g,y,b,P,T,I,C){var E=g+(y&P|b&~P)+T+C;return(E<<I|E>>>32-I)+y}function p(g,y,b,P,T,I,C){var E=g+(y^b^P)+T+C;return(E<<I|E>>>32-I)+y}function m(g,y,b,P,T,I,C){var E=g+(b^(y|~P))+T+C;return(E<<I|E>>>32-I)+y}i.MD5=a._createHelper(h),i.HmacMD5=a._createHmacHelper(h)})(Math),e.MD5})}),ANe=cc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Hc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.algo,l=[],c=a.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,u){for(var d=this._hash.words,p=d[0],m=d[1],g=d[2],y=d[3],b=d[4],P=0;P<80;P++){if(P<16)l[P]=h[u+P]|0;else{var T=l[P-3]^l[P-8]^l[P-14]^l[P-16];l[P]=T<<1|T>>>31}var I=(p<<5|p>>>27)+b+l[P];P<20?I+=(m&g|~m&y)+1518500249:P<40?I+=(m^g^y)+1859775393:P<60?I+=(m&g|m&y|g&y)-1894007588:I+=(m^g^y)-899497514,b=y,y=g,g=m<<30|m>>>2,m=p,p=I}d[0]=d[0]+p|0,d[1]=d[1]+m|0,d[2]=d[2]+g|0,d[3]=d[3]+y|0,d[4]=d[4]+b|0},_doFinalize:function(){var h=this._data,u=h.words,d=this._nDataBytes*8,p=h.sigBytes*8;return u[p>>>5]|=128<<24-p%32,u[(p+64>>>9<<4)+14]=Math.floor(d/4294967296),u[(p+64>>>9<<4)+15]=d,h.sigBytes=u.length*4,this._process(),this._hash},clone:function(){var h=s.clone.call(this);return h._hash=this._hash.clone(),h}});r.SHA1=s._createHelper(c),r.HmacSHA1=s._createHmacHelper(c)})(),e.SHA1})}),ZTe=cc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Hc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.algo,c=[],h=[];(function(){function p(b){for(var P=r.sqrt(b),T=2;T<=P;T++)if(!(b%T))return!1;return!0}function m(b){return(b-(b|0))*4294967296|0}for(var g=2,y=0;y<64;)p(g)&&(y<8&&(c[y]=m(r.pow(g,1/2))),h[y]=m(r.pow(g,1/3)),y++),g++})();var u=[],d=l.SHA256=a.extend({_doReset:function(){this._hash=new s.init(c.slice(0))},_doProcessBlock:function(p,m){for(var g=this._hash.words,y=g[0],b=g[1],P=g[2],T=g[3],I=g[4],C=g[5],E=g[6],O=g[7],_=0;_<64;_++){if(_<16)u[_]=p[m+_]|0;else{var R=u[_-15],v=(R<<25|R>>>7)^(R<<14|R>>>18)^R>>>3,D=u[_-2],w=(D<<15|D>>>17)^(D<<13|D>>>19)^D>>>10;u[_]=v+u[_-7]+w+u[_-16]}var F=I&C^~I&E,H=y&b^y&P^b&P,z=(y<<30|y>>>2)^(y<<19|y>>>13)^(y<<10|y>>>22),G=(I<<26|I>>>6)^(I<<21|I>>>11)^(I<<7|I>>>25),W=O+G+F+h[_]+u[_],L=z+H;O=E,E=C,C=I,I=T+W|0,T=P,P=b,b=y,y=W+L|0}g[0]=g[0]+y|0,g[1]=g[1]+b|0,g[2]=g[2]+P|0,g[3]=g[3]+T|0,g[4]=g[4]+I|0,g[5]=g[5]+C|0,g[6]=g[6]+E|0,g[7]=g[7]+O|0},_doFinalize:function(){var p=this._data,m=p.words,g=this._nDataBytes*8,y=p.sigBytes*8;return m[y>>>5]|=128<<24-y%32,m[(y+64>>>9<<4)+14]=r.floor(g/4294967296),m[(y+64>>>9<<4)+15]=g,p.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var p=a.clone.call(this);return p._hash=this._hash.clone(),p}});i.SHA256=a._createHelper(d),i.HmacSHA256=a._createHmacHelper(d)})(Math),e.SHA256})}),i1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),ZTe()):typeof define=="function"&&define.amd?define(["./core","./sha256"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.algo,a=s.SHA256,l=s.SHA224=a.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=a._doFinalize.call(this);return c.sigBytes-=4,c}});r.SHA224=a._createHelper(l),r.HmacSHA224=a._createHmacHelper(l)})(),e.SHA224})}),_Ne=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),ote()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.Hasher,s=r.x64,a=s.Word,l=s.WordArray,c=r.algo;function h(){return a.create.apply(a,arguments)}var u=[h(1116352408,3609767458),h(1899447441,602891725),h(3049323471,3964484399),h(3921009573,2173295548),h(961987163,4081628472),h(1508970993,3053834265),h(2453635748,2937671579),h(2870763221,3664609560),h(3624381080,2734883394),h(310598401,1164996542),h(607225278,1323610764),h(1426881987,3590304994),h(1925078388,4068182383),h(2162078206,991336113),h(2614888103,633803317),h(3248222580,3479774868),h(3835390401,2666613458),h(4022224774,944711139),h(264347078,2341262773),h(604807628,2007800933),h(770255983,1495990901),h(1249150122,1856431235),h(1555081692,3175218132),h(1996064986,2198950837),h(2554220882,3999719339),h(2821834349,766784016),h(2952996808,2566594879),h(3210313671,3203337956),h(3336571891,1034457026),h(3584528711,2466948901),h(113926993,3758326383),h(338241895,168717936),h(666307205,1188179964),h(773529912,1546045734),h(1294757372,1522805485),h(1396182291,2643833823),h(1695183700,2343527390),h(1986661051,1014477480),h(2177026350,1206759142),h(2456956037,344077627),h(2730485921,1290863460),h(2820302411,3158454273),h(3259730800,3505952657),h(3345764771,106217008),h(3516065817,3606008344),h(3600352804,1432725776),h(4094571909,1467031594),h(275423344,851169720),h(430227734,3100823752),h(506948616,1363258195),h(659060556,3750685593),h(883997877,3785050280),h(958139571,3318307427),h(1322822218,3812723403),h(1537002063,2003034995),h(1747873779,3602036899),h(1955562222,1575990012),h(2024104815,1125592928),h(2227730452,2716904306),h(2361852424,442776044),h(2428436474,593698344),h(2756734187,3733110249),h(3204031479,2999351573),h(3329325298,3815920427),h(3391569614,3928383900),h(3515267271,566280711),h(3940187606,3454069534),h(4118630271,4000239992),h(116418474,1914138554),h(174292421,2731055270),h(289380356,3203993006),h(460393269,320620315),h(685471733,587496836),h(852142971,1086792851),h(1017036298,365543100),h(1126000580,2618297676),h(1288033470,3409855158),h(1501505948,4234509866),h(1607167915,987167468),h(1816402316,1246189591)],d=[];(function(){for(var m=0;m<80;m++)d[m]=h()})();var p=c.SHA512=n.extend({_doReset:function(){this._hash=new l.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(m,g){for(var y=this._hash.words,b=y[0],P=y[1],T=y[2],I=y[3],C=y[4],E=y[5],O=y[6],_=y[7],R=b.high,v=b.low,D=P.high,w=P.low,F=T.high,H=T.low,z=I.high,G=I.low,W=C.high,L=C.low,B=E.high,N=E.low,U=O.high,k=O.low,V=_.high,Y=_.low,X=R,Z=v,Q=D,ae=w,he=F,re=H,se=z,K=G,me=W,Oe=L,Ie=B,ue=N,Pe=U,j=k,J=V,oe=Y,pe=0;pe<80;pe++){var ge,Se,De=d[pe];if(pe<16)Se=De.high=m[g+pe*2]|0,ge=De.low=m[g+pe*2+1]|0;else{var tt=d[pe-15],Ze=tt.high,Wt=tt.low,Nr=(Ze>>>1|Wt<<31)^(Ze>>>8|Wt<<24)^Ze>>>7,Lr=(Wt>>>1|Ze<<31)^(Wt>>>8|Ze<<24)^(Wt>>>7|Ze<<25),Dr=d[pe-2],Rr=Dr.high,ke=Dr.low,Yt=(Rr>>>19|ke<<13)^(Rr<<3|ke>>>29)^Rr>>>6,Ut=(ke>>>19|Rr<<13)^(ke<<3|Rr>>>29)^(ke>>>6|Rr<<26),ar=d[pe-7],Fe=ar.high,it=ar.low,ye=d[pe-16],bt=ye.high,zt=ye.low;ge=Lr+it,Se=Nr+Fe+(ge>>>0<Lr>>>0?1:0),ge=ge+Ut,Se=Se+Yt+(ge>>>0<Ut>>>0?1:0),ge=ge+zt,Se=Se+bt+(ge>>>0<zt>>>0?1:0),De.high=Se,De.low=ge}var de=me&Ie^~me&Pe,qe=Oe&ue^~Oe&j,lt=X&Q^X&he^Q&he,Ne=Z&ae^Z&re^ae&re,et=(X>>>28|Z<<4)^(X<<30|Z>>>2)^(X<<25|Z>>>7),At=(Z>>>28|X<<4)^(Z<<30|X>>>2)^(Z<<25|X>>>7),dr=(me>>>14|Oe<<18)^(me>>>18|Oe<<14)^(me<<23|Oe>>>9),vr=(Oe>>>14|me<<18)^(Oe>>>18|me<<14)^(Oe<<23|me>>>9),Zr=u[pe],xi=Zr.high,Zi=Zr.low,Fi=oe+vr,$i=J+dr+(Fi>>>0<oe>>>0?1:0),Fi=Fi+qe,$i=$i+de+(Fi>>>0<qe>>>0?1:0),Fi=Fi+Zi,$i=$i+xi+(Fi>>>0<Zi>>>0?1:0),Fi=Fi+ge,$i=$i+Se+(Fi>>>0<ge>>>0?1:0),yo=At+Ne,Ha=et+lt+(yo>>>0<At>>>0?1:0);J=Pe,oe=j,Pe=Ie,j=ue,Ie=me,ue=Oe,Oe=K+Fi|0,me=se+$i+(Oe>>>0<K>>>0?1:0)|0,se=he,K=re,he=Q,re=ae,Q=X,ae=Z,Z=Fi+yo|0,X=$i+Ha+(Z>>>0<Fi>>>0?1:0)|0}v=b.low=v+Z,b.high=R+X+(v>>>0<Z>>>0?1:0),w=P.low=w+ae,P.high=D+Q+(w>>>0<ae>>>0?1:0),H=T.low=H+re,T.high=F+he+(H>>>0<re>>>0?1:0),G=I.low=G+K,I.high=z+se+(G>>>0<K>>>0?1:0),L=C.low=L+Oe,C.high=W+me+(L>>>0<Oe>>>0?1:0),N=E.low=N+ue,E.high=B+Ie+(N>>>0<ue>>>0?1:0),k=O.low=k+j,O.high=U+Pe+(k>>>0<j>>>0?1:0),Y=_.low=Y+oe,_.high=V+J+(Y>>>0<oe>>>0?1:0)},_doFinalize:function(){var m=this._data,g=m.words,y=this._nDataBytes*8,b=m.sigBytes*8;g[b>>>5]|=128<<24-b%32,g[(b+128>>>10<<5)+30]=Math.floor(y/4294967296),g[(b+128>>>10<<5)+31]=y,m.sigBytes=g.length*4,this._process();var P=this._hash.toX32();return P},clone:function(){var m=n.clone.call(this);return m._hash=this._hash.clone(),m},blockSize:1024/32});r.SHA512=n._createHelper(p),r.HmacSHA512=n._createHmacHelper(p)})(),e.SHA512})}),n1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),ote(),_Ne()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.x64,n=i.Word,s=i.WordArray,a=r.algo,l=a.SHA512,c=a.SHA384=l.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var h=l._doFinalize.call(this);return h.sigBytes-=16,h}});r.SHA384=l._createHelper(c),r.HmacSHA384=l._createHmacHelper(c)})(),e.SHA384})}),o1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),ote()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.x64,c=l.Word,h=i.algo,u=[],d=[],p=[];(function(){for(var y=1,b=0,P=0;P<24;P++){u[y+5*b]=(P+1)*(P+2)/2%64;var T=b%5,I=(2*y+3*b)%5;y=T,b=I}for(var y=0;y<5;y++)for(var b=0;b<5;b++)d[y+5*b]=b+(2*y+3*b)%5*5;for(var C=1,E=0;E<24;E++){for(var O=0,_=0,R=0;R<7;R++){if(C&1){var v=(1<<R)-1;v<32?_^=1<<v:O^=1<<v-32}C&128?C=C<<1^113:C<<=1}p[E]=c.create(O,_)}})();var m=[];(function(){for(var y=0;y<25;y++)m[y]=c.create()})();var g=h.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var y=this._state=[],b=0;b<25;b++)y[b]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(y,b){for(var P=this._state,T=this.blockSize/2,I=0;I<T;I++){var C=y[b+2*I],E=y[b+2*I+1];C=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360,E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360;var O=P[I];O.high^=E,O.low^=C}for(var _=0;_<24;_++){for(var R=0;R<5;R++){for(var v=0,D=0,w=0;w<5;w++){var O=P[R+5*w];v^=O.high,D^=O.low}var F=m[R];F.high=v,F.low=D}for(var R=0;R<5;R++)for(var H=m[(R+4)%5],z=m[(R+1)%5],G=z.high,W=z.low,v=H.high^(G<<1|W>>>31),D=H.low^(W<<1|G>>>31),w=0;w<5;w++){var O=P[R+5*w];O.high^=v,O.low^=D}for(var L=1;L<25;L++){var v,D,O=P[L],B=O.high,N=O.low,U=u[L];U<32?(v=B<<U|N>>>32-U,D=N<<U|B>>>32-U):(v=N<<U-32|B>>>64-U,D=B<<U-32|N>>>64-U);var k=m[d[L]];k.high=v,k.low=D}var V=m[0],Y=P[0];V.high=Y.high,V.low=Y.low;for(var R=0;R<5;R++)for(var w=0;w<5;w++){var L=R+5*w,O=P[L],X=m[L],Z=m[(R+1)%5+5*w],Q=m[(R+2)%5+5*w];O.high=X.high^~Z.high&Q.high,O.low=X.low^~Z.low&Q.low}var O=P[0],ae=p[_];O.high^=ae.high,O.low^=ae.low}},_doFinalize:function(){var y=this._data,b=y.words,P=this._nDataBytes*8,T=y.sigBytes*8,I=this.blockSize*32;b[T>>>5]|=1<<24-T%32,b[(r.ceil((T+1)/I)*I>>>5)-1]|=128,y.sigBytes=b.length*4,this._process();for(var C=this._state,E=this.cfg.outputLength/8,O=E/8,_=[],R=0;R<O;R++){var v=C[R],D=v.high,w=v.low;D=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,w=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,_.push(w),_.push(D)}return new s.init(_,E)},clone:function(){for(var y=a.clone.call(this),b=y._state=this._state.slice(0),P=0;P<25;P++)b[P]=b[P].clone();return y}});i.SHA3=a._createHelper(g),i.HmacSHA3=a._createHmacHelper(g)})(Math),e.SHA3})}),s1t=cc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Hc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.algo,c=s.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),h=s.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),u=s.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),d=s.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),p=s.create([0,1518500249,1859775393,2400959708,2840853838]),m=s.create([1352829926,1548603684,1836072691,2053994217,0]),g=l.RIPEMD160=a.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(E,O){for(var _=0;_<16;_++){var R=O+_,v=E[R];E[R]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360}var D=this._hash.words,w=p.words,F=m.words,H=c.words,z=h.words,G=u.words,W=d.words,L,B,N,U,k,V,Y,X,Z,Q;V=L=D[0],Y=B=D[1],X=N=D[2],Z=U=D[3],Q=k=D[4];for(var ae,_=0;_<80;_+=1)ae=L+E[O+H[_]]|0,_<16?ae+=y(B,N,U)+w[0]:_<32?ae+=b(B,N,U)+w[1]:_<48?ae+=P(B,N,U)+w[2]:_<64?ae+=T(B,N,U)+w[3]:ae+=I(B,N,U)+w[4],ae=ae|0,ae=C(ae,G[_]),ae=ae+k|0,L=k,k=U,U=C(N,10),N=B,B=ae,ae=V+E[O+z[_]]|0,_<16?ae+=I(Y,X,Z)+F[0]:_<32?ae+=T(Y,X,Z)+F[1]:_<48?ae+=P(Y,X,Z)+F[2]:_<64?ae+=b(Y,X,Z)+F[3]:ae+=y(Y,X,Z)+F[4],ae=ae|0,ae=C(ae,W[_]),ae=ae+Q|0,V=Q,Q=Z,Z=C(X,10),X=Y,Y=ae;ae=D[1]+N+Z|0,D[1]=D[2]+U+Q|0,D[2]=D[3]+k+V|0,D[3]=D[4]+L+Y|0,D[4]=D[0]+B+X|0,D[0]=ae},_doFinalize:function(){var E=this._data,O=E.words,_=this._nDataBytes*8,R=E.sigBytes*8;O[R>>>5]|=128<<24-R%32,O[(R+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,E.sigBytes=(O.length+1)*4,this._process();for(var v=this._hash,D=v.words,w=0;w<5;w++){var F=D[w];D[w]=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360}return v},clone:function(){var E=a.clone.call(this);return E._hash=this._hash.clone(),E}});function y(E,O,_){return E^O^_}function b(E,O,_){return E&O|~E&_}function P(E,O,_){return(E|~O)^_}function T(E,O,_){return E&_|O&~_}function I(E,O,_){return E^(O|~_)}function C(E,O){return E<<O|E>>>32-O}i.RIPEMD160=a._createHelper(g),i.HmacRIPEMD160=a._createHmacHelper(g)})(Math),e.RIPEMD160})}),JTe=cc((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(Hc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){(function(){var r=e,i=r.lib,n=i.Base,s=r.enc,a=s.Utf8,l=r.algo,c=l.HMAC=n.extend({init:function(h,u){h=this._hasher=new h.init,typeof u=="string"&&(u=a.parse(u));var d=h.blockSize,p=d*4;u.sigBytes>p&&(u=h.finalize(u)),u.clamp();for(var m=this._oKey=u.clone(),g=this._iKey=u.clone(),y=m.words,b=g.words,P=0;P<d;P++)y[P]^=1549556828,b[P]^=909522486;m.sigBytes=g.sigBytes=p,this.reset()},reset:function(){var h=this._hasher;h.reset(),h.update(this._iKey)},update:function(h){return this._hasher.update(h),this},finalize:function(h){var u=this._hasher,d=u.finalize(h);u.reset();var p=u.finalize(this._oKey.clone().concat(d));return p}})})()})}),a1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),ZTe(),JTe()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.Base,s=i.WordArray,a=r.algo,l=a.SHA256,c=a.HMAC,h=a.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:l,iterations:25e4}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,d){for(var p=this.cfg,m=c.create(p.hasher,u),g=s.create(),y=s.create([1]),b=g.words,P=y.words,T=p.keySize,I=p.iterations;b.length<T;){var C=m.update(d).finalize(y);m.reset();for(var E=C.words,O=E.length,_=C,R=1;R<I;R++){_=m.finalize(_),m.reset();for(var v=_.words,D=0;D<O;D++)E[D]^=v[D]}g.concat(C),P[0]++}return g.sigBytes=T*4,g}});r.PBKDF2=function(u,d,p){return h.create(p).compute(u,d)}})(),e.PBKDF2})}),ux=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),ANe(),JTe()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.Base,s=i.WordArray,a=r.algo,l=a.MD5,c=a.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:l,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,u){for(var d,p=this.cfg,m=p.hasher.create(),g=s.create(),y=g.words,b=p.keySize,P=p.iterations;y.length<b;){d&&m.update(d),d=m.update(h).finalize(u),m.reset();for(var T=1;T<P;T++)d=m.finalize(d),m.reset();g.concat(d)}return g.sigBytes=b*4,g}});r.EvpKDF=function(h,u,d){return c.create(d).compute(h,u)}})(),e.EvpKDF})}),wg=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),ux()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],r):r(e.CryptoJS)})(o,function(e){e.lib.Cipher||(function(r){var i=e,n=i.lib,s=n.Base,a=n.WordArray,l=n.BufferedBlockAlgorithm,c=i.enc,h=c.Utf8,u=c.Base64,d=i.algo,p=d.EvpKDF,m=n.Cipher=l.extend({cfg:s.extend(),createEncryptor:function(F,H){return this.create(this._ENC_XFORM_MODE,F,H)},createDecryptor:function(F,H){return this.create(this._DEC_XFORM_MODE,F,H)},init:function(F,H,z){this.cfg=this.cfg.extend(z),this._xformMode=F,this._key=H,this.reset()},reset:function(){l.reset.call(this),this._doReset()},process:function(F){return this._append(F),this._process()},finalize:function(F){F&&this._append(F);var H=this._doFinalize();return H},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:(function(){function F(H){return typeof H=="string"?w:R}return function(H){return{encrypt:function(z,G,W){return F(G).encrypt(H,z,G,W)},decrypt:function(z,G,W){return F(G).decrypt(H,z,G,W)}}}})()}),g=n.StreamCipher=m.extend({_doFinalize:function(){var F=this._process(!0);return F},blockSize:1}),y=i.mode={},b=n.BlockCipherMode=s.extend({createEncryptor:function(F,H){return this.Encryptor.create(F,H)},createDecryptor:function(F,H){return this.Decryptor.create(F,H)},init:function(F,H){this._cipher=F,this._iv=H}}),P=y.CBC=(function(){var F=b.extend();F.Encryptor=F.extend({processBlock:function(z,G){var W=this._cipher,L=W.blockSize;H.call(this,z,G,L),W.encryptBlock(z,G),this._prevBlock=z.slice(G,G+L)}}),F.Decryptor=F.extend({processBlock:function(z,G){var W=this._cipher,L=W.blockSize,B=z.slice(G,G+L);W.decryptBlock(z,G),H.call(this,z,G,L),this._prevBlock=B}});function H(z,G,W){var L,B=this._iv;B?(L=B,this._iv=r):L=this._prevBlock;for(var N=0;N<W;N++)z[G+N]^=L[N]}return F})(),T=i.pad={},I=T.Pkcs7={pad:function(F,H){for(var z=H*4,G=z-F.sigBytes%z,W=G<<24|G<<16|G<<8|G,L=[],B=0;B<G;B+=4)L.push(W);var N=a.create(L,G);F.concat(N)},unpad:function(F){var H=F.words[F.sigBytes-1>>>2]&255;F.sigBytes-=H}},C=n.BlockCipher=m.extend({cfg:m.cfg.extend({mode:P,padding:I}),reset:function(){var F;m.reset.call(this);var H=this.cfg,z=H.iv,G=H.mode;this._xformMode==this._ENC_XFORM_MODE?F=G.createEncryptor:(F=G.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==F?this._mode.init(this,z&&z.words):(this._mode=F.call(G,this,z&&z.words),this._mode.__creator=F)},_doProcessBlock:function(F,H){this._mode.processBlock(F,H)},_doFinalize:function(){var F,H=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(H.pad(this._data,this.blockSize),F=this._process(!0)):(F=this._process(!0),H.unpad(F)),F},blockSize:128/32}),E=n.CipherParams=s.extend({init:function(F){this.mixIn(F)},toString:function(F){return(F||this.formatter).stringify(this)}}),O=i.format={},_=O.OpenSSL={stringify:function(F){var H,z=F.ciphertext,G=F.salt;return G?H=a.create([1398893684,1701076831]).concat(G).concat(z):H=z,H.toString(u)},parse:function(F){var H,z=u.parse(F),G=z.words;return G[0]==1398893684&&G[1]==1701076831&&(H=a.create(G.slice(2,4)),G.splice(0,4),z.sigBytes-=16),E.create({ciphertext:z,salt:H})}},R=n.SerializableCipher=s.extend({cfg:s.extend({format:_}),encrypt:function(F,H,z,G){G=this.cfg.extend(G);var W=F.createEncryptor(z,G),L=W.finalize(H),B=W.cfg;return E.create({ciphertext:L,key:z,iv:B.iv,algorithm:F,mode:B.mode,padding:B.padding,blockSize:F.blockSize,formatter:G.format})},decrypt:function(F,H,z,G){G=this.cfg.extend(G),H=this._parse(H,G.format);var W=F.createDecryptor(z,G).finalize(H.ciphertext);return W},_parse:function(F,H){return typeof F=="string"?H.parse(F,this):F}}),v=i.kdf={},D=v.OpenSSL={execute:function(F,H,z,G,W){if(G||(G=a.random(64/8)),W)var L=p.create({keySize:H+z,hasher:W}).compute(F,G);else var L=p.create({keySize:H+z}).compute(F,G);var B=a.create(L.words.slice(H),z*4);return L.sigBytes=H*4,E.create({key:L,iv:B,salt:G})}},w=n.PasswordBasedCipher=R.extend({cfg:R.cfg.extend({kdf:D}),encrypt:function(F,H,z,G){G=this.cfg.extend(G);var W=G.kdf.execute(z,F.keySize,F.ivSize,G.salt,G.hasher);G.iv=W.iv;var L=R.encrypt.call(this,F,H,W.key,G);return L.mixIn(W),L},decrypt:function(F,H,z,G){G=this.cfg.extend(G),H=this._parse(H,G.format);var W=G.kdf.execute(z,F.keySize,F.ivSize,H.salt,G.hasher);G.iv=W.iv;var L=R.decrypt.call(this,F,H,W.key,G);return L}})})()})}),l1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),wg()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.CFB=(function(){var r=e.lib.BlockCipherMode.extend();r.Encryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize;i.call(this,n,s,l,a),this._prevBlock=n.slice(s,s+l)}}),r.Decryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize,c=n.slice(s,s+l);i.call(this,n,s,l,a),this._prevBlock=c}});function i(n,s,a,l){var c,h=this._iv;h?(c=h.slice(0),this._iv=void 0):c=this._prevBlock,l.encryptBlock(c,0);for(var u=0;u<a;u++)n[s+u]^=c[u]}return r})(),e.mode.CFB})}),c1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),wg()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.CTR=(function(){var r=e.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize,c=this._iv,h=this._counter;c&&(h=this._counter=c.slice(0),this._iv=void 0);var u=h.slice(0);a.encryptBlock(u,0),h[l-1]=h[l-1]+1|0;for(var d=0;d<l;d++)n[s+d]^=u[d]}});return r.Decryptor=i,r})(),e.mode.CTR})}),h1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),wg()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.CTRGladman=(function(){var r=e.lib.BlockCipherMode.extend();function i(a){if((a>>24&255)===255){var l=a>>16&255,c=a>>8&255,h=a&255;l===255?(l=0,c===255?(c=0,h===255?h=0:++h):++c):++l,a=0,a+=l<<16,a+=c<<8,a+=h}else a+=1<<24;return a}function n(a){return(a[0]=i(a[0]))===0&&(a[1]=i(a[1])),a}var s=r.Encryptor=r.extend({processBlock:function(a,l){var c=this._cipher,h=c.blockSize,u=this._iv,d=this._counter;u&&(d=this._counter=u.slice(0),this._iv=void 0),n(d);var p=d.slice(0);c.encryptBlock(p,0);for(var m=0;m<h;m++)a[l+m]^=p[m]}});return r.Decryptor=s,r})(),e.mode.CTRGladman})}),u1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),wg()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.OFB=(function(){var r=e.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize,c=this._iv,h=this._keystream;c&&(h=this._keystream=c.slice(0),this._iv=void 0),a.encryptBlock(h,0);for(var u=0;u<l;u++)n[s+u]^=h[u]}});return r.Decryptor=i,r})(),e.mode.OFB})}),d1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),wg()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.ECB=(function(){var r=e.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(i,n){this._cipher.encryptBlock(i,n)}}),r.Decryptor=r.extend({processBlock:function(i,n){this._cipher.decryptBlock(i,n)}}),r})(),e.mode.ECB})}),p1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),wg()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.AnsiX923={pad:function(r,i){var n=r.sigBytes,s=i*4,a=s-n%s,l=n+a-1;r.clamp(),r.words[l>>>2]|=a<<24-l%4*8,r.sigBytes+=a},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},e.pad.Ansix923})}),f1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),wg()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.Iso10126={pad:function(r,i){var n=i*4,s=n-r.sigBytes%n;r.concat(e.lib.WordArray.random(s-1)).concat(e.lib.WordArray.create([s<<24],1))},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},e.pad.Iso10126})}),m1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),wg()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.Iso97971={pad:function(r,i){r.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(r,i)},unpad:function(r){e.pad.ZeroPadding.unpad(r),r.sigBytes--}},e.pad.Iso97971})}),g1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),wg()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.ZeroPadding={pad:function(r,i){var n=i*4;r.clamp(),r.sigBytes+=n-(r.sigBytes%n||n)},unpad:function(r){for(var i=r.words,n=r.sigBytes-1,n=r.sigBytes-1;n>=0;n--)if(i[n>>>2]>>>24-n%4*8&255){r.sigBytes=n+1;break}}},e.pad.ZeroPadding})}),y1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),wg()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding})}),b1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),wg()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.CipherParams,a=i.enc,l=a.Hex,c=i.format,h=c.Hex={stringify:function(u){return u.ciphertext.toString(l)},parse:function(u){var d=l.parse(u);return s.create({ciphertext:d})}}})(),e.format.Hex})}),P1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),TM(),IM(),ux(),wg()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.BlockCipher,s=r.algo,a=[],l=[],c=[],h=[],u=[],d=[],p=[],m=[],g=[],y=[];(function(){for(var T=[],I=0;I<256;I++)I<128?T[I]=I<<1:T[I]=I<<1^283;for(var C=0,E=0,I=0;I<256;I++){var O=E^E<<1^E<<2^E<<3^E<<4;O=O>>>8^O&255^99,a[C]=O,l[O]=C;var _=T[C],R=T[_],v=T[R],D=T[O]*257^O*16843008;c[C]=D<<24|D>>>8,h[C]=D<<16|D>>>16,u[C]=D<<8|D>>>24,d[C]=D;var D=v*16843009^R*65537^_*257^C*16843008;p[O]=D<<24|D>>>8,m[O]=D<<16|D>>>16,g[O]=D<<8|D>>>24,y[O]=D,C?(C=_^T[T[T[v^_]]],E^=T[T[E]]):C=E=1}})();var b=[0,1,2,4,8,16,32,64,128,27,54],P=s.AES=n.extend({_doReset:function(){var T;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var I=this._keyPriorReset=this._key,C=I.words,E=I.sigBytes/4,O=this._nRounds=E+6,_=(O+1)*4,R=this._keySchedule=[],v=0;v<_;v++)v<E?R[v]=C[v]:(T=R[v-1],v%E?E>6&&v%E==4&&(T=a[T>>>24]<<24|a[T>>>16&255]<<16|a[T>>>8&255]<<8|a[T&255]):(T=T<<8|T>>>24,T=a[T>>>24]<<24|a[T>>>16&255]<<16|a[T>>>8&255]<<8|a[T&255],T^=b[v/E|0]<<24),R[v]=R[v-E]^T);for(var D=this._invKeySchedule=[],w=0;w<_;w++){var v=_-w;if(w%4)var T=R[v];else var T=R[v-4];w<4||v<=4?D[w]=T:D[w]=p[a[T>>>24]]^m[a[T>>>16&255]]^g[a[T>>>8&255]]^y[a[T&255]]}}},encryptBlock:function(T,I){this._doCryptBlock(T,I,this._keySchedule,c,h,u,d,a)},decryptBlock:function(T,I){var C=T[I+1];T[I+1]=T[I+3],T[I+3]=C,this._doCryptBlock(T,I,this._invKeySchedule,p,m,g,y,l);var C=T[I+1];T[I+1]=T[I+3],T[I+3]=C},_doCryptBlock:function(T,I,C,E,O,_,R,v){for(var D=this._nRounds,w=T[I]^C[0],F=T[I+1]^C[1],H=T[I+2]^C[2],z=T[I+3]^C[3],G=4,W=1;W<D;W++){var L=E[w>>>24]^O[F>>>16&255]^_[H>>>8&255]^R[z&255]^C[G++],B=E[F>>>24]^O[H>>>16&255]^_[z>>>8&255]^R[w&255]^C[G++],N=E[H>>>24]^O[z>>>16&255]^_[w>>>8&255]^R[F&255]^C[G++],U=E[z>>>24]^O[w>>>16&255]^_[F>>>8&255]^R[H&255]^C[G++];w=L,F=B,H=N,z=U}var L=(v[w>>>24]<<24|v[F>>>16&255]<<16|v[H>>>8&255]<<8|v[z&255])^C[G++],B=(v[F>>>24]<<24|v[H>>>16&255]<<16|v[z>>>8&255]<<8|v[w&255])^C[G++],N=(v[H>>>24]<<24|v[z>>>16&255]<<16|v[w>>>8&255]<<8|v[F&255])^C[G++],U=(v[z>>>24]<<24|v[w>>>16&255]<<16|v[F>>>8&255]<<8|v[H&255])^C[G++];T[I]=L,T[I+1]=B,T[I+2]=N,T[I+3]=U},keySize:256/32});r.AES=n._createHelper(P)})(),e.AES})}),T1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),TM(),IM(),ux(),wg()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=i.BlockCipher,a=r.algo,l=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],d=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],p=a.DES=s.extend({_doReset:function(){for(var b=this._key,P=b.words,T=[],I=0;I<56;I++){var C=l[I]-1;T[I]=P[C>>>5]>>>31-C%32&1}for(var E=this._subKeys=[],O=0;O<16;O++){for(var _=E[O]=[],R=h[O],I=0;I<24;I++)_[I/6|0]|=T[(c[I]-1+R)%28]<<31-I%6,_[4+(I/6|0)]|=T[28+(c[I+24]-1+R)%28]<<31-I%6;_[0]=_[0]<<1|_[0]>>>31;for(var I=1;I<7;I++)_[I]=_[I]>>>(I-1)*4+3;_[7]=_[7]<<5|_[7]>>>27}for(var v=this._invSubKeys=[],I=0;I<16;I++)v[I]=E[15-I]},encryptBlock:function(b,P){this._doCryptBlock(b,P,this._subKeys)},decryptBlock:function(b,P){this._doCryptBlock(b,P,this._invSubKeys)},_doCryptBlock:function(b,P,T){this._lBlock=b[P],this._rBlock=b[P+1],m.call(this,4,252645135),m.call(this,16,65535),g.call(this,2,858993459),g.call(this,8,16711935),m.call(this,1,1431655765);for(var I=0;I<16;I++){for(var C=T[I],E=this._lBlock,O=this._rBlock,_=0,R=0;R<8;R++)_|=u[R][((O^C[R])&d[R])>>>0];this._lBlock=O,this._rBlock=E^_}var v=this._lBlock;this._lBlock=this._rBlock,this._rBlock=v,m.call(this,1,1431655765),g.call(this,8,16711935),g.call(this,2,858993459),m.call(this,16,65535),m.call(this,4,252645135),b[P]=this._lBlock,b[P+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function m(b,P){var T=(this._lBlock>>>b^this._rBlock)&P;this._rBlock^=T,this._lBlock^=T<<b}function g(b,P){var T=(this._rBlock>>>b^this._lBlock)&P;this._lBlock^=T,this._rBlock^=T<<b}r.DES=s._createHelper(p);var y=a.TripleDES=s.extend({_doReset:function(){var b=this._key,P=b.words;if(P.length!==2&&P.length!==4&&P.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var T=P.slice(0,2),I=P.length<4?P.slice(0,2):P.slice(2,4),C=P.length<6?P.slice(0,2):P.slice(4,6);this._des1=p.createEncryptor(n.create(T)),this._des2=p.createEncryptor(n.create(I)),this._des3=p.createEncryptor(n.create(C))},encryptBlock:function(b,P){this._des1.encryptBlock(b,P),this._des2.decryptBlock(b,P),this._des3.encryptBlock(b,P)},decryptBlock:function(b,P){this._des3.decryptBlock(b,P),this._des2.encryptBlock(b,P),this._des1.decryptBlock(b,P)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=s._createHelper(y)})(),e.TripleDES})}),I1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),TM(),IM(),ux(),wg()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.StreamCipher,s=r.algo,a=s.RC4=n.extend({_doReset:function(){for(var h=this._key,u=h.words,d=h.sigBytes,p=this._S=[],m=0;m<256;m++)p[m]=m;for(var m=0,g=0;m<256;m++){var y=m%d,b=u[y>>>2]>>>24-y%4*8&255;g=(g+p[m]+b)%256;var P=p[m];p[m]=p[g],p[g]=P}this._i=this._j=0},_doProcessBlock:function(h,u){h[u]^=l.call(this)},keySize:256/32,ivSize:0});function l(){for(var h=this._S,u=this._i,d=this._j,p=0,m=0;m<4;m++){u=(u+1)%256,d=(d+h[u])%256;var g=h[u];h[u]=h[d],h[d]=g,p|=h[(h[u]+h[d])%256]<<24-m*8}return this._i=u,this._j=d,p}r.RC4=n._createHelper(a);var c=s.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var h=this.cfg.drop;h>0;h--)l.call(this)}});r.RC4Drop=n._createHelper(c)})(),e.RC4})}),C1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),TM(),IM(),ux(),wg()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.StreamCipher,s=r.algo,a=[],l=[],c=[],h=s.Rabbit=n.extend({_doReset:function(){for(var d=this._key.words,p=this.cfg.iv,m=0;m<4;m++)d[m]=(d[m]<<8|d[m]>>>24)&16711935|(d[m]<<24|d[m]>>>8)&4278255360;var g=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],y=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var m=0;m<4;m++)u.call(this);for(var m=0;m<8;m++)y[m]^=g[m+4&7];if(p){var b=p.words,P=b[0],T=b[1],I=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360,C=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,E=I>>>16|C&4294901760,O=C<<16|I&65535;y[0]^=I,y[1]^=E,y[2]^=C,y[3]^=O,y[4]^=I,y[5]^=E,y[6]^=C,y[7]^=O;for(var m=0;m<4;m++)u.call(this)}},_doProcessBlock:function(d,p){var m=this._X;u.call(this),a[0]=m[0]^m[5]>>>16^m[3]<<16,a[1]=m[2]^m[7]>>>16^m[5]<<16,a[2]=m[4]^m[1]>>>16^m[7]<<16,a[3]=m[6]^m[3]>>>16^m[1]<<16;for(var g=0;g<4;g++)a[g]=(a[g]<<8|a[g]>>>24)&16711935|(a[g]<<24|a[g]>>>8)&4278255360,d[p+g]^=a[g]},blockSize:128/32,ivSize:64/32});function u(){for(var d=this._X,p=this._C,m=0;m<8;m++)l[m]=p[m];p[0]=p[0]+1295307597+this._b|0,p[1]=p[1]+3545052371+(p[0]>>>0<l[0]>>>0?1:0)|0,p[2]=p[2]+886263092+(p[1]>>>0<l[1]>>>0?1:0)|0,p[3]=p[3]+1295307597+(p[2]>>>0<l[2]>>>0?1:0)|0,p[4]=p[4]+3545052371+(p[3]>>>0<l[3]>>>0?1:0)|0,p[5]=p[5]+886263092+(p[4]>>>0<l[4]>>>0?1:0)|0,p[6]=p[6]+1295307597+(p[5]>>>0<l[5]>>>0?1:0)|0,p[7]=p[7]+3545052371+(p[6]>>>0<l[6]>>>0?1:0)|0,this._b=p[7]>>>0<l[7]>>>0?1:0;for(var m=0;m<8;m++){var g=d[m]+p[m],y=g&65535,b=g>>>16,P=((y*y>>>17)+y*b>>>15)+b*b,T=((g&4294901760)*g|0)+((g&65535)*g|0);c[m]=P^T}d[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,d[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,d[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,d[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,d[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,d[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,d[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,d[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.Rabbit=n._createHelper(h)})(),e.Rabbit})}),S1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),TM(),IM(),ux(),wg()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.StreamCipher,s=r.algo,a=[],l=[],c=[],h=s.RabbitLegacy=n.extend({_doReset:function(){var d=this._key.words,p=this.cfg.iv,m=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],g=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var y=0;y<4;y++)u.call(this);for(var y=0;y<8;y++)g[y]^=m[y+4&7];if(p){var b=p.words,P=b[0],T=b[1],I=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360,C=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,E=I>>>16|C&4294901760,O=C<<16|I&65535;g[0]^=I,g[1]^=E,g[2]^=C,g[3]^=O,g[4]^=I,g[5]^=E,g[6]^=C,g[7]^=O;for(var y=0;y<4;y++)u.call(this)}},_doProcessBlock:function(d,p){var m=this._X;u.call(this),a[0]=m[0]^m[5]>>>16^m[3]<<16,a[1]=m[2]^m[7]>>>16^m[5]<<16,a[2]=m[4]^m[1]>>>16^m[7]<<16,a[3]=m[6]^m[3]>>>16^m[1]<<16;for(var g=0;g<4;g++)a[g]=(a[g]<<8|a[g]>>>24)&16711935|(a[g]<<24|a[g]>>>8)&4278255360,d[p+g]^=a[g]},blockSize:128/32,ivSize:64/32});function u(){for(var d=this._X,p=this._C,m=0;m<8;m++)l[m]=p[m];p[0]=p[0]+1295307597+this._b|0,p[1]=p[1]+3545052371+(p[0]>>>0<l[0]>>>0?1:0)|0,p[2]=p[2]+886263092+(p[1]>>>0<l[1]>>>0?1:0)|0,p[3]=p[3]+1295307597+(p[2]>>>0<l[2]>>>0?1:0)|0,p[4]=p[4]+3545052371+(p[3]>>>0<l[3]>>>0?1:0)|0,p[5]=p[5]+886263092+(p[4]>>>0<l[4]>>>0?1:0)|0,p[6]=p[6]+1295307597+(p[5]>>>0<l[5]>>>0?1:0)|0,p[7]=p[7]+3545052371+(p[6]>>>0<l[6]>>>0?1:0)|0,this._b=p[7]>>>0<l[7]>>>0?1:0;for(var m=0;m<8;m++){var g=d[m]+p[m],y=g&65535,b=g>>>16,P=((y*y>>>17)+y*b>>>15)+b*b,T=((g&4294901760)*g|0)+((g&65535)*g|0);c[m]=P^T}d[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,d[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,d[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,d[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,d[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,d[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,d[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,d[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.RabbitLegacy=n._createHelper(h)})(),e.RabbitLegacy})}),E1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),TM(),IM(),ux(),wg()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.BlockCipher,s=r.algo;let a=16,l=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var h={pbox:[],sbox:[]};function u(y,b){let P=b>>24&255,T=b>>16&255,I=b>>8&255,C=b&255,E=y.sbox[0][P]+y.sbox[1][T];return E=E^y.sbox[2][I],E=E+y.sbox[3][C],E}function d(y,b,P){let T=b,I=P,C;for(let E=0;E<a;++E)T=T^y.pbox[E],I=u(y,T)^I,C=T,T=I,I=C;return C=T,T=I,I=C,I=I^y.pbox[a],T=T^y.pbox[a+1],{left:T,right:I}}function p(y,b,P){let T=b,I=P,C;for(let E=a+1;E>1;--E)T=T^y.pbox[E],I=u(y,T)^I,C=T,T=I,I=C;return C=T,T=I,I=C,I=I^y.pbox[1],T=T^y.pbox[0],{left:T,right:I}}function m(y,b,P){for(let O=0;O<4;O++){y.sbox[O]=[];for(let _=0;_<256;_++)y.sbox[O][_]=c[O][_]}let T=0;for(let O=0;O<a+2;O++)y.pbox[O]=l[O]^b[T],T++,T>=P&&(T=0);let I=0,C=0,E=0;for(let O=0;O<a+2;O+=2)E=d(y,I,C),I=E.left,C=E.right,y.pbox[O]=I,y.pbox[O+1]=C;for(let O=0;O<4;O++)for(let _=0;_<256;_+=2)E=d(y,I,C),I=E.left,C=E.right,y.sbox[O][_]=I,y.sbox[O][_+1]=C;return!0}var g=s.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var y=this._keyPriorReset=this._key,b=y.words,P=y.sigBytes/4;m(h,b,P)}},encryptBlock:function(y,b){var P=d(h,y[b],y[b+1]);y[b]=P.left,y[b+1]=P.right},decryptBlock:function(y,b){var P=p(h,y[b],y[b+1]);y[b]=P.left,y[b+1]=P.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=n._createHelper(g)})(),e.Blowfish})}),O1t=cc((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(Hc(),ote(),e1t(),t1t(),TM(),r1t(),IM(),ANe(),ZTe(),i1t(),_Ne(),n1t(),o1t(),s1t(),JTe(),a1t(),ux(),wg(),l1t(),c1t(),h1t(),u1t(),d1t(),p1t(),f1t(),m1t(),g1t(),y1t(),b1t(),P1t(),T1t(),I1t(),C1t(),S1t(),E1t()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./enc-base64url","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy","./blowfish"],r):e.CryptoJS=r(e.CryptoJS)})(o,function(e){return e})}),A1t=(o=>(o.Device="Device",o.Symbol="Symbol",o.Footprint="Footprint",o.OBJ="OBJ",o.ModelID="3D Model",o.ModelName="3D Model Title",o.OriginModelName="Origin 3D Model Title",o.ModelTransform="3D Model Transform",o.OriginFootprint="Origin Footprint",o))(A1t||{}),Rz=(o=>(o.DOCHEAD="DOCHEAD",o.EDIT_HEAD="EDIT_HEAD",o.SCH="SCH",o.SCH_PAGE="SCH_PAGE",o.PCB="PCB",o.PANEL="PANEL",o.PANEL_LIB="PANEL_LIB",o.SYMBOL="SYMBOL",o.FOOTPRINT="FOOTPRINT",o.DEVICE="DEVICE",o.BLOB="BLOB",o.INSTANCE="INSTANCE",o.CONFIG="CONFIG",o.BOARD="BOARD",o.FONT="FONT",o.VARIANT="VARIANT",o.COMPONENT_GROUP="COMPONENT_GROUP",o.COMPONENT_GROUP_DATA="COMPONENT_GROUP_DATA",o.SIMULATION="SIMULATION",o))(Rz||{}),_1t=(o=>(o.META="META",o.META_SORT="META_SORT",o.META_CREATE="META_CREATE",o.META_MODIFY="META_MODIFY",o.FONT="FONT",o.BLOB="BLOB",o.MAX_NUM="MAX_NUM",o.INSTANCE_ATTR="INSTANCE_ATTR",o.DELETE_DOC="DELETE_DOC",o.META_Z_INDEX="META_Z_INDEX",o.VARIANT_GROUPED="VARIANT_GROUPED",o.GROUP_INDEX="GROUP_INDEX",o.GROUP_DATA="GROUP_DATA",o.RULE_TEMPLATE="RULE_TEMPLATE",o.RULE="RULE",o.RULE_SELECTOR="RULE_SELECTOR",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o.META_PLACEHOLDER="META_PLACEHOLDER",o))(_1t||{});function Dz(o,t,e){return o.slice(t,e)}function Fee(o,t,e){let r=o.length,i=0;for(;i<r;){let n=o.indexOf(`|
`,i);if(n<0){if(e)return o.substring(i);n=r}let s=Dz(o,i,n);try{if(s){let a=s.indexOf("||"),l=a>-1,c=l?Dz(s,0,a):s,h=l?Dz(s,a+2):"";if(t(c,h,s,l?i+a+2:i)===!1){s=null;break}s=null}}catch(a){console.error(a)}i=n+2}o=null}var v1t=["SYMBOL","FOOTPRINT","BLOB","FONT","PANEL_LIB","DEVICE","BOARD","INSTANCE","CONFIG","VARIANT","COMPONENT_GROUP","COMPONENT_GROUP_DATA"];function GPe(o,t){return v1t.includes(t)?t:o}var x1t=class{parseFull(o,t,e){let r=t,i=e,n,s=null;Fee(o,(a,l,c)=>{let h=JSON.parse(a);if(h.type==="EDIT_HEAD")s=JSON.parse(l),this.onEditHead&&this.onEditHead(s);else if(h.type==="DOCHEAD"){let u=JSON.parse(l);i=u.docType,r=u.uuid,n=u.client,u.ticket=h.ticket,this.onDocHead(u,s,c)}else this.onLine(h.id,h.ticket,l,h.type,h.client||n,i,r,h.firstTicket,h.pend,s,h.num,c)}),this.onEnd(),o=null}flowParseFull(o={}){let{cache:t,chunkLength:e=100*1024*1024,idsData:r,history:i}=o,n="",s=null,a,l=null,c=!0,h="",u=0,d=!1,p={},m=t?{}:void 0,g=new Set,y=T=>{m[T]===void 0&&(m[T]=-1),t(T,++m[T],p[T].data.join(`|
`)),p[T].data.length=0,p[T].size=0,p[T].data.push(p[T].head),p[T].size+=p[T].head.length},b=T=>{if(g.add(n),!t)return;let I=GPe(n,s);p[I].data.push(T),p[I].size+=(p[I].size?2:0)+T.length,p[I].size+T.length>e&&y(I)},P=(T,I)=>Fee(T,(C,E,O,_)=>{var R,v,D,w,F,H,z,G;let W=JSON.parse(C);if(W.type==="EDIT_HEAD")l=JSON.parse(E),(R=this.onEditHead)==null||R.call(this,l),(v=o.onEditHead)==null||v.call(o,l),d=!0;else if(W.type==="DOCHEAD"){let L=JSON.parse(E);s=L.docType,n=L.uuid,a=L.client,L.ticket=W.ticket,d||(l={uuid:L.uuid,username:(D=L==null?void 0:L.user)==null?void 0:D.username,nickname:(w=L==null?void 0:L.user)==null?void 0:w.nickname,updateTime:L==null?void 0:L.updateTime},(F=o.onEditHead)==null||F.call(o,l),d=!0),this.onDocHead(L,l,O);let B=GPe(n,s);t&&!p[B]&&(p[B]={size:0,data:[],head:""}),t&&(p[B].head=O),b(O)}else{let L=W.num,B=W.client||a;if(r){let N=(G=(z=(H=r.ids)==null?void 0:H[n])==null?void 0:z[B])==null?void 0:G[W.id];if(!N||N[0]!==W.ticket)return;L=N[1],r.size-=1,delete r.ids[n][B][W.id]}if(i){let N=GPe(n,s);t&&(i.dNum=(m==null?void 0:m[N])===void 0?0:(m==null?void 0:m[N])+1),i.start=t?p[N].size+2+C.length+2:u+_}this.onLine(W.id,W.ticket,E,W.type,B,s,n,W.firstTicket,W.pend,l||(i==null?void 0:i.editHead),L,O,i),b(O)}},I);return{start:()=>{c=!0},end:()=>{if(h&&P(h,!1),t)for(let T in p)p[T].size&&p[T].data.length>1&&y(T),p[T]=null;c=!1,h="",n="",n=null,a="",l=null,this.onEnd()},update:T=>{if(!c)throw new Error("\u66F4\u65B0\u524D\u672A\u8C03\u7528 start \u65B9\u6CD5");let I=P(h+T,!0);u=u+h.length+T.length-((I==null?void 0:I.length)||0),h="",I&&(h=I)},docMap:m,getDocIds:()=>Array.from(g)}}parseLine(o,t,e){let r=o.indexOf("||"),i=r!==-1,n=i?Dz(o,0,r):o,s=i?Dz(o,r+2):"",a=JSON.parse(n);this.onLine(a.id,a.ticket,s,a.type,a.client,e,t,a.firstTicket,a.pend,void 0,a.num,o),o=null}onEditHead(o){}},UPe=new Uint8Array(8);function DI(){crypto.getRandomValues(UPe);let o="";for(let t=0;t<UPe.length;t++)o+=UPe[t].toString(16).padStart(2,"0");return o}function pM(o,t,e,r,i,n,s){let a={docType:o,client:t,uuid:e};return(r||r===0)&&(a.updateTime=r),(i||a.updateTime||a.updateTime===0)&&(a.version=i||String(r)),n&&(a.user=n),`${JSON.stringify({type:"DOCHEAD",ticket:s})}||${JSON.stringify(a)}`}function F2(o,t,e,r,i,n,s,a){let l={type:o,ticket:t,id:e};return n!==void 0&&(l.firstTicket=n),s!==void 0&&(l.pend=s),a!==void 0&&(l.num=a),i&&(l.client=i),`${JSON.stringify(l)}||${r}`}var vNe=class extends x1t{constructor(o){super(),this.unique=DI(),this.maxTicket=0,this.isPendChange=!0,this.isLocalChange=!0,this.cbArr=[],this.tempLocalIds={},this.docMaxTicket={},this.client=o||DI()}onLine(o,t,e,r,i,n,s,a,l,c,h){this.remoteChange(t,i,s,o,e,r,n,void 0,a,l,c,void 0,void 0,h)}getUnique(){return this.unique}setUnique(o){this.unique=o}setDocMaxTicket(o,t,e){e||(!this.docMaxTicket[o]||this.docMaxTicket[o]<t)&&(this.docMaxTicket[o]=t)}getDocMaxTicket(o){var t;return(t=this.docMaxTicket[o])!=null?t:0}onDocHead(o,t){}onEnd(){}setIsPendChange(o){this.isPendChange=o}getIsPendChange(){return this.isPendChange}getMaxTicket(){return this.maxTicket}setMaxTicket(o,t){o&&(t||this.maxTicket<o)&&(this.maxTicket=o)}setIsLocalChange(o){this.isLocalChange=o}getIsLocalChange(){return this.isLocalChange}revoke(o,t,e,r,i,n,s,a,l,c,h){var u;if(!((u=this.tempLocalIds[o])!=null&&u[t]))return h?h(t,i,e,s,`${r}-1`,o,n,void 0,void 0,!0,c):this.cbArr.forEach(d=>d(o,t,e,s,`${r}-1`,i,void 0,n,void 0,void 0,void 0,c)),!0}getRandomUuid(){return DI()}getClient(){return this.client}onChange(o){this.cbArr.push(o)}localChange(o,t,e,r,i,n){let s=this.maxTicket+1;return this.tempLocalIds[o]||(this.tempLocalIds[o]={}),this.tempLocalIds[o][t]=[this.getClient(),s],this.remoteChange(s,this.client,o,t,e,r,i,!0,void 0,!0,void 0,this.unique,void 0,n),s}remoteChange(o,t,e,r,i,n,s,a,l,c,h,u,d,p){var m;this.setMaxTicket(o);let g=u===this.unique,y=a||g,b=(!y||y&&this.isLocalChange)&&(!d||d&&this.isPendChange),P=(m=this.tempLocalIds[e])==null?void 0:m[r];!a&&g?P?(b=!1,P[0]===t&&P[1]===o&&delete this.tempLocalIds[e][r]):b=!0:!a&&P&&(P[1]>o||P[1]===o&&P[0]>t?b=!1:delete this.tempLocalIds[e][r]),this.setDocMaxTicket(e,o,c),b&&this.cbArr.forEach(T=>T(e,r,i,n,t,o,l,c,void 0,d,u,p))}},R1t=class{constructor(o){this.item=o,this.parent=null,this.left=null,this.right=null,this.height=1}getParent(){return this.parent}getLeft(){return this.left}getRight(){return this.right}getHeight(){return this.height}setLeft(o){if(this.left!==null)throw new Error("insert exists left is not permitted");if(o!==null){if(o.parent!==null)throw new Error("insert left with node has parent is not permitted");this.left=o,o.parent=this,this.updateHeight()}}setRight(o){if(this.right!==null)throw new Error("insert exists right is not permitted");if(o!==null){if(o.parent!==null)throw new Error("insert right with node has parent is not permitted");this.right=o,o.parent=this,this.updateHeight()}}removeLeft(){if(this.left===null)return null;{let o=this.left;return o.parent=null,this.left=null,this.updateHeight(),o}}removeRight(){if(this.right===null)return null;{let o=this.right;return o.parent=null,this.right=null,this.updateHeight(),o}}rotateRight(o){let t=this.removeLeft();if(this.setLeft(t.removeRight()),this.parent){let e=this.parent;e.getLeft()===this?(e.removeLeft(),e.setLeft(t)):(e.removeRight(),e.setRight(t)),t.setRight(this)}else t.setRight(this),o(t)}rotateLeft(o){let t=this.removeRight();if(this.setRight(t.removeLeft()),this.parent){let e=this.parent;e.getLeft()===this?(e.removeLeft(),e.setLeft(t)):(e.removeRight(),e.setRight(t)),t.setLeft(this)}else t.setLeft(this),o(t)}updateHeight(){var o,t;let e=this;for(;e!==null;)e.height=Math.max(((o=e.left)==null?void 0:o.height)||0,((t=e.right)==null?void 0:t.height)||0)+1,e=e.parent}},D1t=class{constructor(o){this.comparator=o,this.root=null,this.minNode=null,this.maxNode=null,this.size=0}balance(o){var t,e;let r=((t=o.getLeft())==null?void 0:t.getHeight())||0,i=((e=o.getRight())==null?void 0:e.getHeight())||0,n=o.getParent();r>i?r-i>1?(o.rotateRight(s=>this.root=s),this.verify()):n!==null?n.getRight()===o&&(o.rotateRight(s=>this.root=s),this.verify()):(o.rotateRight(s=>this.root=s),this.verify()):i>r&&(i-r>1?(o.rotateLeft(s=>this.root=s),this.verify()):n!==null?n.getLeft()===o&&(o.rotateLeft(s=>this.root=s),this.verify()):(o.rotateLeft(s=>this.root=s),this.verify())),n&&this.balance(n)}forwardTraverse(o){let t=new Array(10),e=this.minNode;for(;e;)switch(t.pop()||2){case 1:e.getLeft()!==null?(t.push(2),t.push(1),e=e.getLeft()):t.push(2);break;case 2:if(!o(e.item))return;e.getRight()!==null?(t.push(3),t.push(1),e=e.getRight()):t.push(3);break;case 3:e=e.getParent();break;default:throw new Error("invalid status")}}backwardTraverse(o){let t=new Array(10),e=this.maxNode;for(;e;)switch(t.pop()||2){case 1:e.getRight()!==null?(t.push(2),t.push(1),e=e.getRight()):t.push(2);break;case 2:if(!o(e.item))return;e.getLeft()!==null?(t.push(3),t.push(1),e=e.getLeft()):t.push(3);break;case 3:e=e.getParent();break;default:throw new Error("invalid status")}}display(o=this.root,t=new Array,e=0){let r="| ".repeat(e);return t.push(r+`\u25CF(${o.item})
`),o.getLeft()?this.display(o.getLeft(),t,e+1):t.push(r+`| \u2609
`),o.getRight()?this.display(o.getRight(),t,e+1):t.push(r+`| \u2609
`),t}getHeight(){var o;return((o=this.root)==null?void 0:o.getHeight())||0}getSize(){return this.size}updateMinMax(o){this.minNode?this.comparator(o.item,this.minNode.item)<0&&(this.minNode=o):this.minNode=o,this.maxNode?this.comparator(o.item,this.maxNode.item)>0&&(this.maxNode=o):this.maxNode=o}insert(o){let t=new R1t(o);if(this.root===null)return this.root=t,this.size++,this.updateMinMax(t),!0;{let e=this.root;for(;;){let r=this.comparator(o,e.item);if(r<0){if(e.getLeft()===null)return e.setLeft(t),this.size++,this.updateMinMax(t),this.verify(),this.balance(e),!0;e=e.getLeft()}else if(r>0){if(e.getRight()===null)return e.setRight(t),this.size++,this.updateMinMax(t),this.verify(),this.balance(e),!0;e=e.getRight()}else return!1}}}verify(){}remove(o){let t=this.root;for(this.verify();;){if(t===null)return!1;let e=this.comparator(o,t.item);if(e<0)t=t.getLeft();else if(e>0)t=t.getRight();else return this.minNode===t&&(t.getRight()?this.minNode=this.findMinChild(t.getRight()):this.minNode=t.getParent()),this.maxNode===t&&(t.getLeft()?this.maxNode=this.findMaxChild(t.getLeft()):this.maxNode=t.getParent()),this.removeNode(t),this.size--,this.verify(),!0}}removeNode(o){var t,e;let r=o.getParent();if(r===null)o.getLeft()===null&&o.getRight()===null?(this.root=null,this.minNode=null,this.maxNode=null):((((t=o.getLeft())==null?void 0:t.getHeight())||0)>(((e=o.getRight())==null?void 0:e.getHeight())||0)?(o.rotateRight(i=>this.root=i),this.verify()):(o.rotateLeft(i=>this.root=i),this.verify()),this.removeNode(o));else if(r.getLeft()===o){r.removeLeft();let i=this.combineNodes(o.removeLeft(),o.removeRight());r.setLeft(i),this.verify(),this.balance(r)}else{r.removeRight();let i=this.combineNodes(o.removeLeft(),o.removeRight());r.setRight(i),this.verify(),this.balance(r)}}combineNodes(o,t){if(o&&t)if(o.getHeight()>t.getHeight()){let e=this.findMaxChild(o);if(e){let r=e.getParent();return r.removeRight(),r.setRight(e.removeLeft()),e.setLeft(o),e.setRight(t),e}else return o.setRight(t),o}else{let e=this.findMinChild(t);if(e){let r=e.getParent();return r.removeLeft(),r.setLeft(e.removeRight()),e.setLeft(o),e.setRight(t),e}else return t.setLeft(o),t}else return o||t||null}findMinChild(o){let t=o;for(;;){if(t.getLeft()===null)return t!==o?t:null;t=t.getLeft()}}findMaxChild(o){let t=o;for(;;){if(t.getRight()===null)return t!==o?t:null;t=t.getRight()}}};var QTe=/^[a-zA-Z]+(\d+)$/;function Nz(o){let t=o.match(QTe);return t?Number(t[1]):null}function zl(o){if(!o||typeof o!="string")return o;let t=o.match(/[a-zA-Z]+\d+/g);return t&&t.length===2&&t.join("")===o?t.join("-"):o}function vg(o){return o&&typeof o=="number"&&!isNaN(o)?-o:o}function w1t(o,t){let e=[];for(let r=0;r<o.length;r+=2){let i={x:o[r],y:t?vg(o[r+1]):o[r+1]};e.push(i)}return e}function B2(o,t){return JSON.stringify([t,o])}function Jv(o){try{let t=JSON.parse(o);return typeof t=="string"?o:t[1]}catch{return o}}function HPe(o,t,e){let r=o[t];return r!==void 0||(r=e(t),o[t]=r),r}var L1t=(o=>(o.META="META",o.CANVAS="CANVAS",o.GROUP="GROUP",o.POLY="POLY",o.STRING="STRING",o.AUX_LINE="AUXLINE",o.DIMENSION="DIMENSION",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o))(L1t||{}),M1t=(o=>(o.META="META",o.CANVAS="CANVAS",o.LAYER="LAYER",o.LAYER_PHYS="LAYER_PHYS",o.ACTIVE_LAYER="ACTIVE_LAYER",o.PARTITION="PARTITION",o.NET="NET",o.PRIMITIVE="PRIMITIVE",o.GROUP="GROUP",o.SILK_OPTS="SILK_OPTS",o.PREFERENCE="PREFERENCE",o.VIA="VIA",o.PAD="PAD",o.LINE="LINE",o.ARC="ARC",o.OBJ="OBJ",o.EQLEN_GRP="EQLEN_GRP",o.POLY="POLY",o.FILL="FILL",o.LAYER_FILL="LAYER_FILL",o.REGION="REGION",o.POUR="POUR",o.POURED="POURED",o.IMAGE="IMAGE",o.TEARDROP="TEARDROP",o.FPC_FILL="FPC_FILL",o.SHELL="SHELL",o.CREASE="CREASE",o.SHELLCUT="SHELLCUT",o.SHELL_ENTITY="SHELL_ENTITY",o.BOSS="BOSS",o.STRING="STRING",o.ATTR="ATTR",o.DIMENSION="DIMENSION",o.COMPONENT="COMPONENT",o.PAD_NET="PAD_NET",o.RULE_TEMPLATE="RULE_TEMPLATE",o.RULE="RULE",o.RULE_SELECTOR="RULE_SELECTOR",o.PANELIZE="PANELIZE",o.BOARD="BOARD",o.X_SIGNALS_GROUP="X_SIGNAL_GROUP",o.X_SIGNALS="X_SIGNALS",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o))(M1t||{}),N1t=(o=>(o.META="META",o.CANVAS="CANVAS",o.GROUP="GROUP",o.ATTR="ATTR",o.LINE="LINE",o.WIRE="WIRE",o.BUS="BUS",o.TEXT="TEXT",o.POLY="POLY",o.CIRCLE="CIRCLE",o.ARC="ARC",o.BUSENTRY="BUSENTRY",o.RECT="RECT",o.MASK_REGION="MASK_REGION",o.PIN="PIN",o.OBJ="OBJ",o.COMPONENT="COMPONENT",o.PART="PART",o.ELLIPSE="ELLIPSE",o.BEZIER="BEZIER",o.TABLE="TABLE",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o.NG_SETTING="NG_SETTING",o))(N1t||{}),k1t=["PARTITION","VIA","PAD","LINE","ARC","OBJ","POLY","FILL","REGION","POUR","POURED","IMAGE","TEARDROP","FPC_FILL","SHELL","CREASE","SHELLCUT","SHELL_ENTITY","BOSS","STRING","ATTR","DIMENSION","COMPONENT"],vYt=mB(jz()),B1t=(o=>(o.SOLID="SOLID",o.SHORT_DASH="SHORT_DASH",o.DOT="DOT",o.DOT_DASH="DOT_DASH",o))(B1t||{}),F1t=(o=>(o.PRINT="PRINT",o.COVER="COVER",o.PRINT_AND_COVER="PRINT&COVER",o))(F1t||{}),V1t=(o=>(o.LEFT="LEFT",o.CENTER="CENTER",o.RIGHT="RIGHT",o))(V1t||{}),G1t=(o=>(o.TOP="TOP",o.MIDDLE="MIDDLE",o.BOTTOM="BOTTOM",o))(G1t||{}),U1t=(o=>(o.LEFT_BOTTOM="LEFT_BOTTOM",o.CENTER_BOTTOM="CENTER_BOTTOM",o.RIGHT_BOTTOM="RIGHT_BOTTOM",o.LEFT_MIDDLE="LEFT_MIDDLE",o.CENTER_MIDDLE="CENTER_MIDDLE",o.RIGHT_MIDDLE="RIGHT_MIDDLE",o.LEFT_TOP="LEFT_TOP",o.CENTER_TOP="CENTER_TOP",o.RIGHT_TOP="RIGHT_TOP",o))(U1t||{}),H1t=(o=>(o.NONE="NONE",o.SOLID="SOLID",o.GRID="GRID",o.HORIZONTAL_LINE="HORIZONTAL_LINE",o.VERTICAL_LINE="VERTICAL_LINE",o.RHOMBIC="RHOMBIC",o.LEFT_SLASH_LINE="LEFT_SLASH_LINE",o.RIGHT_SLASH_LINE="RIGHT_SLASH_LINE",o))(H1t||{}),W1t=(o=>(o.NONE="NONE",o.CLOCK="CLOCK",o.INVERTED="INVERTED",o.INVERTED_CLOCK="INVERTED_CLOCK",o))(W1t||{}),z1t=(o=>(o.NONE="NONE",o.GRID="GRID",o.OUTLETS="OUTLETS",o))(z1t||{}),Y1t=(o=>(o.NONE="NONE",o.PUSH="PUSH",o.SURROUND="SURROUND",o.OBSTRUCT="OBSTRUCT",o.SURROUND_AND_PUSH="SURROUND&PUSH",o))(Y1t||{}),j1t=(o=>(o.ELLIPSE="ELLIPSE",o.RECT="RECT",o.OVAL="OVAL",o.POLYGON="POLYGON",o))(j1t||{}),X1t=(o=>(o.ROUND="ROUND",o.RECT="RECT",o.SLOT="SLOT",o))(X1t||{}),q1t=(o=>(o.SOLID="SOLID",o.GRID_LINE="GRID_LINE",o.HORIZONTAL_LINE="HORIZONTAL_LINE",o.VERTICAL_LINE="VERTICAL_LINE",o))(q1t||{}),$1t=(o=>(o.ALL="ALL",o.PAD="PAD",o.VIA="VIA",o))($1t||{}),K1t=(o=>(o.NONE="NONE",o.SINGLE="SINGLE",o.ALL="ALL",o))(K1t||{}),Z1t=(o=>(o.OPTIMIZA_OPEN="OPTIMIZA_OPEN",o.OPTIMIZA_NONE="OPTIMIZA_NONE",o))(Z1t||{}),J1t=(o=>(o.OPTIMIZA_STRONG="OPTIMIZA_STRONG",o.OPTIMIZA_WEAK="OPTIMIZA_WEAK",o.OPTIMIZA_NONE="OPTIMIZA_NONE",o))(J1t||{}),Q1t=(o=>(o.L45="L45",o.L90="L90",o.L="L",o.R45="R45",o.R90="R90",o.R="R",o))(Q1t||{}),eyt=(o=>(o.NORMAL="NORMAL",o.BLIND="BLIND",o.SUTURE="SUTURE",o))(eyt||{}),tyt=(o=>(o.NORMAL="NORMAL",o.TEST="TEST",o.MARKER="MARKER",o))(tyt||{}),ryt=(o=>(o.DIVERGENCE="DIVERGENCE",o.DIRECT="DIRECT",o.NON_CONNECT="NON_CONNECT",o))(ryt||{}),iyt=(o=>(o.DOT="DOT",o.CENTER="CENT",o))(iyt||{}),nyt=(o=>(o.NORMAL="NORMAL",o.BOARD_OUTLINE="BOARD_OUTLINE",o))(nyt||{}),oyt=(o=>(o.SOLID="SOLID",o.GRID="GRID",o.PLANE="PLANE",o))(oyt||{}),syt=(o=>(o.PROHIBIT="PROHIBIT",o.CONSTRAINT="CONSTRAINT",o))(syt||{}),ayt=(o=>(o.COMPONENT="COMPONENT",o.VIA="VIA",o.TRACK="TRACK",o.FILL="FILL",o.COPPER="COPPER",o.PLANE="PLANE",o))(ayt||{}),lyt=(o=>(o.PI="Polyimide",o.FR4="FR4",o.STEEL_SHEET="Stainless Steel",o.M3_DOUBLE_SIDED_TAPE="3M Tape",o.EMI_SHIELDING_FILM="EMI Shielding Film",o))(lyt||{}),cyt=(o=>(o.PUSH_COVER="DRAWER",o.UPPER_LOWER_SHELLS="T&B",o))(cyt||{}),hyt=(o=>(o.X_AXIS_POSITIVE="X_AXIS_POSITIVE",o.X_AXIS_NEGATIVE="X_AXIS_NEGATIVE",o.Y_AXIS_POSITIVE="Y_AXIS_POSITIVE",o.Y_AXIS_NEGATIVE="Y_AXIS_NEGATIVE",o))(hyt||{}),uyt=(o=>(o.SLOT="SLOT",o.ENTITY="ENTITY",o))(uyt||{}),dyt=(o=>(o.AUTO="AUTO",o.UPPER_SHELLS="UPPER_SHELLS",o.LOWER_SHELLS="LOWER_SHELLS",o))(dyt||{}),pyt=(o=>(o.OUTLINE="OUTLINE",o.SCREW_PILLAR="SCREW_PILLAR",o.ENTITY="ENTITY",o))(pyt||{}),fyt=(o=>(o.M2="M2",o.M3="M3",o.M4="M4",o.M5="M5",o.M6="M6",o))(fyt||{}),myt=(o=>(o.LENGTH="LENGTH",o.RADIUS="RADIUS",o.ANGLE="ANGLE",o))(myt||{}),gyt=(o=>(o.MIL="mil",o.INCH="inch",o.CM="cm",o.MM="mm",o))(gyt||{}),yyt=(o=>(o.SAFE="SAFE",o.OTHER="OTHER",o.TRACK="TRACK",o.BLIND="BLIND",o.RADIUS="RADIUS",o.PLANE="PLANE",o.COPPER="COPPER",o.PASTE="PASTE",o.SOLDER="SOLDER",o.DIFFER_ENTAIL="DIFFER_ENTAIL",o.NET_LENGTH="NET_LENGTH",o.AUTO_ROUTER="AUTO_ROUTER",o.NET_LENGTH_TOLERANCE="NET_LENGTH_TOLERANCE",o))(yyt||{}),byt=(o=>(o.NORMAL="NORMAL",o.DEFAULT="DEFAULT",o))(byt||{}),Pyt=(o=>(o.ALL="ALL",o.LAYERED="LAYERED",o))(Pyt||{}),Tyt=(o=>(o.DIRECT="DIRECT",o.NON_CONNECT="NON_CONNECT",o))(Tyt||{}),Iyt=(o=>(o.FORTY_FIVE="L45",o.NINETY="L90",o.NINETY_ARC="A90",o))(Iyt||{}),Cyt=(o=>(o.LESS="LESS",o.MID="MID",o.MORE="MORE",o))(Cyt||{}),Syt=(o=>(o.SPEED_FIRST="SPEED_FIRST",o.COMPLETION_FIRST="COMPLETION_FIRST",o))(Syt||{}),Eyt=(o=>(o.DesignRule="DesignRule",o.Board="Board",o.SlotRegion="SlotRegion",o.ProhibitedRegion="ProhibitedRegion",o.ConstraintRegion="ConstraintRegion",o.Component="Component",o.Track="Track",o.TestPoint="TestPoint",o.Pad="Pad",o.Via="Via",o.SutureHole="SutureHole",o.Text="Text",o.ColorfulImage="ColorfulImage",o.Image="Image",o.FPCStiffener="FPCStiffener",o.Dimension="Dimension",o.CopperRegion="CopperRegion",o.FillRegion="Fill Region",o.Line="Line",o.Teardrop="Teardrop",o.D3Shell="D3Shell",o))(Eyt||{}),Oyt=mB(O1t());function ITe(o,t,e,r,i,n,s,a){return JSON.stringify([o||"",t||"",e,r,i?1:0,n?1:0,s?1:0,a])}function Ayt(o){let t=JSON.parse(o);return{text:t[0],fontFamily:t[1],fontSize:t[2],thickness:t[3],bold:!!t[4],italic:!!t[5],reverse:!!t[6],expansion:t[7]}}function ste(o){return Oyt.default.SHA256(o).toString()}function _yt(o,t){let e=[],r=[],i={};Fee(o,(c,h)=>{let u=JSON.parse(c);if(u.type==="DOCHEAD"||u.type==="META"||u.type==="META_CREATE"||u.type==="META_MODIFY"||u.type==="ELE_PLACEHOLDER"||u.type==="ELE_PLACEHOLDER"||u.type==="ELE_PLACEHOLDER")return;let{id:d}=u;i[d]=Object.assign(u,{data:h})});let n={};Fee(t,(c,h="")=>{let u=JSON.parse(c);if(u.type==="BLOB")e.push(c+"||"+h);else if(u.type==="FONT")r.push(c+"||"+h);else{if(u.type==="DOCHEAD"||u.type==="META_MODIFY")return;let{id:d}=u;n[d]=Object.assign(u,{data:h})}});let s={},a={},l={};for(let c in i)if(!n.hasOwnProperty(c))a[c]=i[c];else{let{ticket:h}=i[c],{type:u,data:d,client:p}=n[c];s[c]={type:u,ticket:h,data:d,client:p},delete n[c]}for(let c in n){let{type:h,data:u,ticket:d,client:p}=n[c];l[c]={type:h,data:u,ticket:d,client:p}}return{delete:a,cover:s,add:l,blobs:e,fonts:r}}function WPe(o,t,e){let{docType:r,uuid:i,client:n,updateTime:s,version:a,user:l,ticket:c}=e,h=[pM(r,n,i,s,a,l,c)],{delete:u,cover:d,add:p,blobs:m,fonts:g}=_yt(o,t);for(let y in u){let{ticket:b,type:P,client:T}=u[y];h.push(F2(P,b+1,y,"",T))}for(let y in d){let{type:b,ticket:P,data:T,client:I}=d[y];h.push(F2(b,P+1,y,T,I))}for(let y in p){let{type:b,ticket:P,data:T,client:I}=p[y];h.push(F2(b,P,y,T,I))}return m.length&&(h.push(pM("BLOB",n,"BLOB",s,a,l,c)),h=h.concat(m)),g.length&&(h.push(pM("FONT",n,"FONT",s,a,l,c)),h=h.concat(g)),h.join(`|
`)}function vyt(o,t){return o.ticket===t.ticket?o.client===t.client?o.id===t.id?0:o.id<t.id?-1:1:o.client<t.client?-1:1:o.ticket<t.ticket?-1:1}var xyt=class{constructor(o=1){this.startNum=o,this.orderLists={},this.idOrderLists={},this.cbArr=new Array,this.maxNum={}}orderChange(o){this.cbArr.push(o)}setOrderNum(o,t,e,r,i=1){if(i<1)throw new Error("step must be greater than 0");let n=HPe(this.orderLists,t,()=>new D1t(vyt)),s=HPe(this.maxNum,t,()=>this.startNum-1),a=HPe(this.idOrderLists,t,()=>new Map),l=a.get(o);if(l){if(l.ticket<=e)return;n.remove(l),s-=l.step}let c={id:o,ticket:e,num:0,client:r,step:i};a.set(o,c),n.insert(c),s+=i;let h=s,u=0;n.backwardTraverse(d=>(u++,d.num=h,this.cbArr.forEach(p=>p(d.id,t,d.num)),h-=d.step,d!==c)),this.maxNum[t]=s,u>1e4&&(console.log("------------------ notify --------",c,"height: ",n.getHeight(),"total: ",n.getSize(),"notifies: ",u),console.log("------------------ all --------"))}getOrderNum(o,t){var e,r,i,n;return(n=(i=(r=(e=this.idOrderLists)==null?void 0:e[t])==null?void 0:r.get)==null?void 0:i.call(r,o))==null?void 0:n.num}getMaxNum(o){var t;return((t=this.orderLists[o])==null?void 0:t.getSize())||0}clearNum(){for(let o in this.idOrderLists)this.idOrderLists[o].clear(),delete this.idOrderLists[o];for(let o in this.orderLists)delete this.orderLists[o]}},Ryt=class{constructor(o,t=1,e=[]){this.consistencyManager=o,this.startNum=t,this.needOrderType=e,this.initIng=!1,this.allOrderNum={},this.maxNum={},this.consistencyManager.onChange((r,i,n,s,a,l,c,h,u,d,p,m)=>{try{if(this.calculation)if(s==="ELE_PLACEHOLDER"){let g=n?JSON.parse(n):null;g&&this.calculation.setOrderNum(i,g.dataType,c!=null?c:l,a,g.max)}else this.calculation.setOrderNum(i,s,c!=null?c:l,a);this.onParseLine(i,s,n?JSON.parse(n):null,a,l,h,m)}catch(g){console.error(g)}})}initCalculation(){this.calculation=new xyt(this.startNum)}setIsInit(o){this.initIng=o}setNeedNum(o){this.needNum=o}setOrderNum(o,t,e){this.needNum&&this.needOrderType&&this.needOrderType.includes(e)&&t!==void 0&&(this.allOrderNum[o]=t,this.setMaxNum(e,t))}deleteOrderNum(o){delete this.allOrderNum[o]}getOrderNum(o){return this.allOrderNum[o]}setMaxNum(o,t,e){(e||this.maxNum[o]===void 0||this.maxNum[o]<t)&&(this.maxNum[o]=t)}getMaxNum(o){return this.maxNum[o]===void 0&&(this.maxNum[o]=this.startNum-1),++this.maxNum[o]}};function xNe(o){switch(o=String(o),o){case"1":return"SAFE";case"2":return"OTHER";case"3":return"TRACK";case"4":return"BLIND";case"5":return"RADIUS";case"6":return"PLANE";case"7":return"COPPER";case"8":return"PASTE";case"9":return"SOLDER";case"10":return"DIFFER_ENTAIL";case"11":return"NET_LENGTH";case"12":return"AUTO_ROUTER";case"13":return"NET_LENGTH_TOLERANCE"}return o}function $k(o){if(!o)return{};let t=["1","2","3","4","5","6","7","8","9","10","11","12","13"];for(let e of t)if(o.hasOwnProperty(e)){let r=o[e];delete o[e],o[xNe(e)]=r}return o}var m5e=class{constructor(){this.init=!1,this.defaultSafeData=null,this.defaultCopperSpace=null,this.defaultInnerSpace=null,this.copperChangeMap=new Map,this.innerChangeMap=new Map}addDefaultSafeSpaceData(o){this.init=!0,this.defaultSafeData=o}addDefaultCopperSpace(o,t){this.defaultCopperSpace={netClearance:o,boardClearance:t}}addDefaultInnerSpace(o,t){this.defaultInnerSpace={netClearance:o,boardClearance:t}}getNewDefaultData(o,t){if(o&&this.defaultSafeData==null||!o&&this.defaultInnerSpace==null)return null;let e=o?this.copperChangeMap.get(t):this.innerChangeMap.get(t);if(e==null)return null;let{netClearance:r,boardClearance:i}=e,n=this.defaultSafeData.safeSpacing[0].content,s=new Array(n.length);for(let a=0;a<n.length;a++)s[a]=Array.from(n[a]);return this.updateSafeData(s,r,i),s}fixSafeData(o){if(this.defaultCopperSpace!=null)for(let t of o.safeSpacing)this.updateSafeData(t.content,this.defaultCopperSpace.netClearance,this.defaultCopperSpace.netClearance)}updateSafeData(o,t,e){for(let r=0;r<o.length;r++){let i=o[r];for(let n=0;n<i.length;n++)r==7?n==11||n==8?i[n]=e:i[n]=t:n==7&&(r==11||r==8?i[n]=e:i[n]=t)}}addCopper2SafeChangeMap(o,t,e,r,i){this.copperChangeMap.set(o,{name:t,isDefault:e,netClearance:r,boardClearance:i})}addInner2SafeChangeMap(o,t,e,r,i){this.innerChangeMap.set(o,{name:t,isDefault:e,netClearance:r,boardClearance:i})}getSafeName4Copper(o){var t;return(t=this.copperChangeMap.get(o))==null?void 0:t.name}getSafeName4Plane(o){var t;return(t=this.innerChangeMap.get(o))==null?void 0:t.name}getDefaultCopper(){for(let[,o]of this.copperChangeMap)if(o.isDefault)return o.name;return null}getDefaultPlane(){for(let[,o]of this.innerChangeMap)if(o.isDefault)return o.name;return null}};function g5e(o,t){let e=o,r={TWO_LAYERS_BOARD:"JLCPCB Capability(Two Layers Board)",SINGLE_LAYER_BOARD:"JLCPCB Capability(Single Layer Board)",MULTIPLE_LAYERS_BOARD:"JLCPCB Capability(Multiple Layers Board)",HIGH_FREQUENCY_BOARD:"JLCPCB Capability(High Frequency Board)",ALUMINUM_SUBSTRATE_BOARD:"JLCPCB Capability(Aluminum Substrate Board)",COPPER_SUBSTRATE_BOARD:"JLCPCB Capability(Copper Substrate Board)"};if(e.length==8){Object.values(r).includes(t)&&(e[4][0]=11.811,e[5][4]=11.811),e.splice(1,0,e[1].slice(0));for(let n=2;n<e.length;n++)e[n].splice(1,0,e[n][1]);e.push([].concat(e[1][0],e.slice(1).map(n=>n[1])))}e[1].push(e[1][e[1].length-1]),e.splice(3,0,[...e[1]]),e.splice(4,0,[...e[2]]),e[1].pop();for(let n=5;n<e.length;n++)e[n].splice(3,0,e[n][1]),e[n].splice(4,0,e[n][2]);e[3][3]=e[1][1],e[4][3]=e[2][1],e[4][4]=e[2][2];let i=6;e.splice(7,0,new Array(7).fill(i));for(let n=7;n<e.length;n++)e[n].splice(7,0,i);return e}function Dyt(o,t){let e=o[0],r=o[1],i=[],n="ALL";if(r instanceof Array){let s=g5e(r,t);i.push({layerId:1,isOpen:!0,content:s})}else{for(let s in r){let a=r[s],l=g5e(a,t);i.push({layerId:+s,isOpen:!0,content:l})}Object.keys(r).length>1&&(n="LAYERED")}return{unit:e,isForAll:n,safeSpacing:i}}function wyt(o){let t=o[0],e=o[1],r=o[2];isNaN(r)&&(r=0);let i=o[3];return isNaN(i)&&(i=11.8),{unit:t,deviceClearance:e,thru2SmdClearance:r,holeClearance:i}}function Lyt(o){let t=o[0],e=o[1],r=!0,i=[];if(e instanceof Object)for(let n in e){let s=e[n];i.push({layerId:+n,stroMin:s[0],stroDef:s[1],stroMax:s[2]})}else i.push({layerId:1,stroMin:o[1],stroDef:o[2],stroMax:o[3]});return{unit:t,track:{isOpen:r,content:i}}}function Myt(o){return{unit:o[0],netLenMin:o[1],netLenMax:o[2]}}function Nyt(o){return{unit:o[0],netLengthTolerance:o[1]}}function kyt(o){let t=o[0],e=o[1],r=!0,i=[],n=[],s=0;if(e instanceof Object)for(let a in e){let l=e[a],{stroke:c,spacing:h,lenTolerMax:u}=l;i.push({layerId:+a,stroMin:c[0],stroDef:c[1],stroMax:c[2]}),n.push({layerId:+a,spacMin:h[0],spacDef:h[1]}),s=u}else i.push({layerId:1,stroMin:o[1],stroDef:o[2],stroMax:o[3]}),n.push({layerId:1,spacMin:o[4],spacDef:o[5]}),s=o[7];return{unit:t,stroWidth:{isOpen:r,content:i},spacing:{isOpen:r,content:n},differPairLenTolerMax:s}}function Byt(o){let t=new Array;for(let e of o){let r=+e[1],i=+e[2];isNaN(r)||r<=0||isNaN(i)||i<=0||r===i||r===1&&i===2||r===2&&i===1||t.push({name:e[0],staLayerId:r,endLayerId:i,viaSizeRule:e[3]})}return{blinds:{content:t}}}function Fyt(o){return{unit:o[0],minRadius:o[1],defRadius:o[2],maxRadius:o[3],minInner:o[4],defInner:o[5],maxInner:o[6]}}function Vyt(o){let t=[{layerId:1,connType:aB(o[7]!==void 0?o[7]:o[3]),spoWidth:o[8]!==void 0?o[8]:o[4],spoSpac:o[9]!==void 0?o[9]:o[5],spoAng:o[10]?o[10]:o[6]}];return{unit:o[0],mulPad:{isOpen:!0,content:t}}}function Gyt(o){let t=[{layerId:1,connType:aB(o[3]),spoWidth:o[4],spoSpac:o[5],spoAng:o[6]}],e=[{layerId:1,connType:Number(o[7])?"NON_CONNECT":"DIRECT"}],r=[{layerId:1,connType:aB(o[8]!==void 0?o[8]:o[3]),spoWidth:o[9]!==void 0?o[9]:o[4],spoSpac:o[10]!==void 0?o[10]:o[5],spoAng:o[11]?o[11]:o[6]}];return{unit:o[0],sglPad:{isOpen:!0,content:t},mulPad:{isOpen:!0,content:r},track:{isOpen:!0,content:e}}}function Uyt(o){return{unit:o[0],padTopExpan:o[1],padBotExpan:o[2],testPointTopExpan:o[3]?o[3]:-1e3,testPointBotExpan:o[4]?o[4]:-1e3}}function Hyt(o){return{unit:o[0],padTopExpan:o[1],padBotExpan:o[2],viaTopExpan:o[3],viaBotExpan:o[4],testPointTopExpan:o[5]?o[5]:2,testPointBotExpan:o[6]?o[6]:2}}function Wyt(o){function t(i){switch(i=i&&Number(i),i){case 0:return"L45";case 1:return"L90";case 2:return"A90";default:return"L45"}}function e(i){switch(i=i&&Number(i),i){case 0:return"LESS";case 1:return"MID";case 2:return"MORE";default:return"LESS"}}function r(i){switch(i=i&&Number(i),i){case 0:return"SPEED_FIRST";case 1:return"COMPLETION_FIRST";default:return"COMPLETION_FIRST"}}return{routingCorner:t(o[0]),isKeep:!!o[1],viaQuantity:e(o[2]),routingEffectPriority:r(o[3]),layers:o[5],ignoreNets:o[6]}}function aB(o){switch(o=o&&Number(o),o){case 0:return"DIVERGENCE";case 1:return"DIRECT";case 2:return"NON_CONNECT";default:return null}}function zyt(o,t){let e=t;switch(o){case"SAFE":{let r=t;if(r.isForAll=r.isForAll?"LAYERED":"ALL",r.safeSpacing)for(let i of r.safeSpacing)i.isOpen=!!i.isOpen;e=r;break}case"OTHER":break;case"TRACK":{let r=t;r!=null&&r.track&&(r.track.isOpen=!!r.track.isOpen),e=r;break}case"NET_LENGTH":break;case"NET_LENGTH_TOLERANCE":break;case"DIFFER_ENTAIL":{let r=t;r!=null&&r.stroWidth&&(r.stroWidth.isOpen=!!r.stroWidth.isOpen),r!=null&&r.spacing&&(r.spacing.isOpen=!!r.spacing.isOpen),e=r;break}case"BLIND":break;case"RADIUS":break;case"PLANE":{let r=t;if(r!=null&&r.mulPad&&(r.mulPad.isOpen=!!r.mulPad.isOpen),r.mulPad&&r.mulPad.content)for(let i of r.mulPad.content)i.connType=aB(i.connType);e=r;break}case"COPPER":{let r=t;if(r!=null&&r.sglPad&&(r.sglPad.isOpen=!!r.sglPad.isOpen),r!=null&&r.mulPad&&(r.mulPad.isOpen=!!r.mulPad.isOpen),r!=null&&r.track&&(r.track.isOpen=!!r.track.isOpen),r.track&&r.track.content&&(r.track.content=r.track.content.map(i=>(i.connType=Number(i.connType)?"NON_CONNECT":"DIRECT",i))),r.sglPad&&r.sglPad.content)for(let i of r.sglPad.content)i.connType=aB(i.connType);if(r.mulPad&&r.mulPad.content)for(let i of r.mulPad.content)i.connType=aB(i.connType);e=r;break}case"PASTE":break;case"SOLDER":break;case"AUTO_ROUTER":break}return e}function Yyt(o,t,e,r,i,n){if(!(r instanceof Array))return zyt(o,r);let s,a=!1;switch(e&&(e==="NORMAL"?a=!1:e==="DEFAULT"&&(a=!0)),o){case"SAFE":{s=Dyt(r,n),a&&i.addDefaultSafeSpaceData(s);break}case"OTHER":{s=wyt(r);break}case"TRACK":{s=Lyt(r);break}case"NET_LENGTH":{s=Myt(r);break}case"NET_LENGTH_TOLERANCE":{s=Nyt(r);break}case"DIFFER_ENTAIL":{s=kyt(r);break}case"BLIND":{s=Byt(r);break}case"RADIUS":{s=Fyt(r);break}case"PLANE":{let l=r[1],c=r[2];a&&i.addDefaultInnerSpace(l,c),i.addInner2SafeChangeMap(t,"Plane_"+t,a,l,c),s=Vyt(r);break}case"COPPER":{let l=r[1],c=r[2];a&&i.addDefaultCopperSpace(l,c),i.addCopper2SafeChangeMap(t,"Copper_"+t,a,l,c),s=Gyt(r);break}case"PASTE":{s=Uyt(r);break}case"SOLDER":{s=Hyt(r);break}case"AUTO_ROUTER":{s=Wyt(r);break}}return s}function jyt(o,t,e,r){if(!r.init)return null;function i(n,s){let a=n?"Copper_":"Plane_",l=["RULE"];l[1]="SAFE",l[2]=a+t,l[3]=0;let c=s.getNewDefaultData(n,t);return c==null?null:(l[4]={unit:s.defaultSafeData.unit,isForAll:"ALL",safeSpacing:[{layerId:1,isOpen:!0,content:c}]},l)}switch(o){case"SAFE":return r.fixSafeData(e),null;case"PLANE":return i(!1,r);case"COPPER":return i(!0,r);default:return null}}function Xyt(o,t,e,r){if(!r.init)return{ruleKeyValue:e};let i=o[0],n,s;if(t==4){if(i==="NET_CLASS"||i==="NET"){for(let a in e)String(a)==="COPPER"&&(n={COPPER:r.getSafeName4Copper(e[a])}),String(a)==="PLANE"&&(s={PLANE:r.getSafeName4Plane(e[a])});o[1]==""?(n!=null&&n.COPPER||(n={COPPER:"default"}),s!=null&&s.PLANE||(s={PLANE:"default"})):(n!=null&&n.COPPER||(n={COPPER:r.getDefaultCopper()}),s!=null&&s.PLANE||(s={PLANE:r.getDefaultPlane()}))}}else for(let a in e){if(String(a)==="COPPER"){let l=e[a],c=r.getSafeName4Copper(l);if(c==null&&l=="default"&&(c=r.getDefaultCopper()),c==null)continue;n={COPPER:c}}if(String(a)==="PLANE"){let l=e[a],c=r.getSafeName4Plane(l);if(c==null&&l=="default"&&(c=r.getDefaultPlane()),c==null)continue;s={PLANE:c}}}return{ruleKeyValue:e,copperRuleValue:n,innerPlaneRuleValue:s}}function RNe(o,t){let e=o.length,r=0;for(;r<e;){let i=o.indexOf(`
`,r);i<0&&(i=e);let n=o.substring(r,i);try{if(t(n)===!1)break}catch(s){console.error(s)}r=i+1}}function qyt(o){let t={};return RNe(o,e=>{if(e.startsWith('["PAD"')){let r=JSON.parse(e);t[r[5]]||(t[r[5]]=[]),t[r[5]].push(r[1])}}),t}var eIe=class{parseFull(o){RNe(o,t=>this.onParseLine(JSON.parse(t))),this.onParseEnd()}},$yt=class extends eIe{constructor(o={},t={},e=[],r=[],i=!1){super(),this.deviceName=o,this.footprintName=t,this.footprints=e,this.devices=r,this.footprintIsConnectDevice=i,this.fontCache=[],this.poured={},this.curPartition="",this.eQLenData={},this.eQLenSort=1,this.cache={},this.components={},this.errorIds={},this.dimension={},this.connects={},this.specialColors={},this.reuseBlock={},this.panelize={data:[],stamp:{h:null,v:null},size:{h:null,v:null}},this.layerPhys=0,this.fac=new m5e,this.rules=[],this.ruleSelectors=[],this.ruleTemplateName="",this.layerFill={},this.idsSet=new Set,this.oldId={},this.cachePadNet={},this.creaseIds=[],this.stringId={},this.substrateLayer=new Set,this.layerPhysCache=[],this.randomUuid=0,this.padNumId={},this.componentPadNum={}}getOldId(o){var t;return(t=this.oldId[o])!=null?t:o}handConnect(){for(let o of this.creaseIds)if(this.connects[o])for(let t of this.connects[o])this.connects[t]?this.connects[t].push(o):this.connects[t]=[o]}getConnect(o){return this.connects[o]||[]}transRuleType(o){return xNe(o)}transRuleStatus(o){switch(o=o&&Number(o),o){case 0:return"NORMAL";case 1:return"DEFAULT";default:return"NORMAL"}}transGridType(o){switch(o=o&&Number(o),o){case 0:return"NONE";case 1:return"GRID";case 2:return"OUTLETS";default:return"NONE"}}transLayerStatus(o){o=o&&Number(o);let t=!1,e=!1,r=!1;return o!=null&&!isNaN(o)?(o>=4&&(r=!0,o-=4),o>=2&&(e=!0,o-=2),o===1&&(t=!0)):t=!0,{use:t,show:e,locked:r}}transRoutingMode(o){switch(o=o&&Number(o),o){case 0:return"NONE";case 1:return"PUSH";case 2:return"SURROUND";case 3:return"OBSTRUCT";case 4:return"SURROUND&PUSH";default:return"NONE"}}transPadDef(o){switch(o==null?void 0:o[0]){case"ELLIPSE":return{padType:"ELLIPSE",width:o[1],height:o[2]};case"RECT":return{padType:"RECT",width:o[1],height:o[2],radius:o[3]};case"OVAL":return{padType:"OVAL",width:o[1],height:o[2]};case"POLYGON":case"POLY":return{padType:"POLYGON",path:o[1]};default:return null}}transHoleDef(o){return o?{holeType:o[0],width:o[1],height:o[2]}:null}transPourDef(o){function t(e){switch(e=e&&Number(e),e){case 0:return"GRID_LINE";case 1:return"HORIZONTAL_LINE";case 2:return"VERTICAL_LINE";default:return"GRID_LINE"}}switch(o==null?void 0:o[0]){case"SOLID":return{pourType:"SOLID",fineness:o[1]};case"LINE":return{pourType:t(o[1]),angle:o[2],strokeWidth:o[3],strokeSpacing:o[4]};default:return null}}transUnusedPadRange(o){switch(o=o&&Number(o),o){case 1:return"ALL";case 2:return"PAD";case 3:return"VIA";default:return"VIA"}}transPathOptimization(o){switch(o=o&&Number(o),o){case 0:return"SINGLE";case 1:return"ALL";case 2:return"NONE";default:return"SINGLE"}}transViaType(o){switch(o=o&&Number(o),o){case 0:return"NORMAL";case 1:return"SUTURE";default:return"NORMAL"}}transPadFuncType(o){switch(o=o&&Number(o),o){case 0:return"NORMAL";case 1:return"TEST";case 2:return"MARKER";default:return"NORMAL"}}transPadConnect(o){switch(o=o&&Number(o),o){case 0:return"DIVERGENCE";case 1:return"DIRECT";case 2:return"NON_CONNECT";default:return null}}transFillStyle(o){switch(o=o&&Number(o),o){case 0:return"SOLID";case 1:return"GRID";case 2:return"PLANE";default:return null}}transProhibitType(o){let t=new Set;if(!o)return[];for(let e of o)switch(e=e&&Number(e),e){case 1:t.add("TRACK"),t.add("FILL");break;case 2:t.add("COMPONENT");break;case 3:t.add("VIA");break;case 4:t.add("COPPER"),t.add("PLANE");break;case 5:t.add("TRACK");break;case 6:t.add("FILL");break;case 7:t.add("COPPER");break;case 8:t.add("PLANE");break}return Array.from(t)}transPushCoverDir(o){switch(o=o&&Number(o),o){case 1:return"X_AXIS_POSITIVE";case 2:return"X_AXIS_NEGATIVE";case 4:return"Y_AXIS_POSITIVE";case 8:return"Y_AXIS_NEGATIVE";default:return"X_AXIS_POSITIVE"}}transEntityBelong(o){switch(o=o&&Number(o),o){case 0:return"AUTO";case 1:return"UPPER_SHELLS";case 2:return"LOWER_SHELLS";default:return"AUTO"}}transSlotOption(o){o=o&&Number(o);let t=o;if(!t||t<4)return["OUTLINE","SCREW_PILLAR","ENTITY"];let e=[];return t>=16&&(e.push("ENTITY"),t-=16),t>=8&&(e.push("SCREW_PILLAR"),t-=8),t>=4&&(e.push("OUTLINE"),t-=4),e}transAlignType(o){switch(o=o&&Number(o),o){case 1:return"LEFT_TOP";case 4:return"CENTER_TOP";case 7:return"RIGHT_TOP";case 2:return"LEFT_MIDDLE";case 5:return"CENTER_MIDDLE";case 8:return"RIGHT_MIDDLE";case 3:return"LEFT_BOTTOM";case 6:return"CENTER_BOTTOM";case 9:return"RIGHT_BOTTOM";default:return"LEFT_BOTTOM"}}onParseLine(o){var t;let e=o[0];switch(e){case"DOCTYPE":this.parseDocType(o);break;case"HEAD":this.parseHead(o);break;case"CANVAS":this.parseCanvas(o);break;case"LAYER":this.parseLayer(o);break;case"LAYER_PHYS":this.layerPhysCache.push(o);break;case"ACTIVE_LAYER":this.parseActiveLayer(o);break;case"NET":this.parseNet(o);break;case"PRIMITIVE":this.parsePrimitive(o);break;case"GROUP":this.parseGroup(o);break;case"SILK_OPTS":this.parseSilkOpts(o);break;case"PREFERENCE":this.parsePreference(o);break;case"CONNECT":this.parseConnect(o);break;case"ITEM_ORDER":this.parseItemOrder(o);break;case"PROP":this.parseProp(o);break;case"EQLEN_GRP":this.parseEQLenGrp(o);break;case"EQLEN":this.parseEQLen(o);break;case"FONT":this.parseFont(o);break;case"PAD_NET":{this.cachePadNet[o[1]]||(this.cachePadNet[o[1]]=[]),this.cachePadNet[o[1]].push(o);break}case"REUSE_BLOCK":this.parseReuseBlock(o);break;case"RULE_TEMPLATE":this.parseRuleTemplate(o);break;case"RULE":this.rules.push(o);break;case"RULE_SELECTOR":this.ruleSelectors.push(o);break;case"PANELIZE":this.panelize.data=o;break;case"PANELIZE_STAMP":this.parsePanelizeStamp(o);break;case"PANELIZE_SIDE":this.parsePanelizeSide(o);break;case"POURED":{this.parsePoured(o);break}case"PARTITION":e==="PARTITION"&&(this.curPartition=o[3]?o[1]:"");case"VIA":case"PAD":case"LINE":case"ARC":case"CARC":case"OBJ":case"POLY":case"FILL":if(e==="FILL"&&o[6]===2){this.layerFill[o[4]]||(this.layerFill[o[4]]=[]),this.layerFill[o[4]].push(o);break}case"REGION":case"POUR":case"IMAGE":case"TEARDROP":case"FPC_FILL":case"SHELL":case"CREASE":e==="CREASE"&&this.creaseIds.push(o[1]);case"SHELLCUT":case"SHELL_ENTITY":case"BOSS":case"STRING":if(e==="STRING"&&!/^[a-zA-Z]+\d+$/.test(o[1])){let r=o[1],i=r.split(/([0-9].*)/);if(i.length>=2){let n=i[0],s=i[1];for(let a=0;a<s.length;a++){let l=s.charCodeAt(a);n+=l}r=n}this.stringId[r]=o[1],o[1]=r}case"DIMENSION":case"COMPONENT":{let r=e==="CARC"?"ARC":e,i=Nz(o[1]);this.cache[r]||(this.cache[r]={}),i!==null&&!this.cache[r][i]?this.cache[r][i]={part:this.curPartition,value:o}:(this.errorIds[r]||(this.errorIds[r]=[]),this.errorIds[r].push({part:this.curPartition,value:o})),r==="COMPONENT"&&(this.components[o[1]]||(this.components[o[1]]={attrs:{},footprint:"",device:""}),this.components[o[1]].attrs=o[7]||{}),r==="DIMENSION"&&(this.dimension[o[1]]={attr:[]});break}case"ATTR":{if(this.docType==="PCB"&&!o[3])break;if(o[7]==="Footprint"&&(this.components[o[3]]||(this.components[o[3]]={attrs:{},footprint:"",device:""}),this.components[o[3]].footprint=o[8]),o[7]==="Device"&&(this.components[o[3]]||(this.components[o[3]]={attrs:{},footprint:"",device:""}),this.components[o[3]].device=o[8]),this.dimension[o[1]]){this.dimension[o[1]].attr=o;break}let r=Object.keys(((t=this.cache)==null?void 0:t.COMPONENT)||{}).find(n=>this.cache.COMPONENT[n].value[1]===o[3]);if(r){let n=this.cache.COMPONENT[r];n.attr||(n.attr=[]),n.attr.push({part:this.curPartition,value:o});break}let i=Nz(o[1]);this.cache[e]||(this.cache[e]={}),i!==null&&!this.cache[e][i]?this.cache[e][i]={part:this.curPartition,value:o}:(this.errorIds[e]||(this.errorIds[e]=[]),this.errorIds[e].push({part:this.curPartition,value:o}));break}default:console.warn("can not find hanlder with",o)}}async secondParseLine(o,t,e){let r=o[0];if(this.idsSet.has(o[1])||!o[1]){let i=`randomuuid${++this.randomUuid}`;if(this.oldId[i]=o[1],o[1]=i,e)for(let n of e)n[3]=i}else this.idsSet.add(o[1]);switch(r){case"DOCTYPE":case"HEAD":case"CANVAS":case"LAYER":case"LAYER_PHYS":case"ACTIVE_LAYER":case"NET":case"PRIMITIVE":case"GROUP":case"SILK_OPTS":case"PREFERENCE":case"ITEM_ORDER":case"RULE_TEMPLATE":case"RULE":case"RULE_SELECTOR":case"PANELIZE":case"PANELIZE_STAMP":case"PANELIZE_SIDE":case"CONNECT":case"EQLEN_GRP":case"EQLEN":case"FONT":case"PAD_NET":case"REUSE_BLOCK":case"PROP":break;case"PARTITION":this.parsePartition(o);break;case"VIA":this.parseVia(o);break;case"PAD":this.parsePad(o);break;case"LINE":await this.parseLine(o);break;case"ARC":this.parseArc(o);break;case"CARC":this.parseCArc(o);break;case"OBJ":this.parseObj(o);break;case"POLY":this.parsePoly(o);break;case"FILL":this.parseFill(o);break;case"REGION":this.parseRegion(o);break;case"POUR":this.parsePour(o);break;case"IMAGE":this.parseImage(o);break;case"TEARDROP":this.parseTeardrop(o);break;case"FPC_FILL":this.parseFpcFill(o);break;case"SHELL":this.parseShell(o);break;case"CREASE":this.parseCrease(o);break;case"SHELLCUT":this.parseShellCut(o);break;case"SHELL_ENTITY":this.parseShellEntity(o);break;case"BOSS":this.parseBoss(o);break;case"STRING":this.parseString(o);break;case"ATTR":this.parseAttr(o,t);break;case"DIMENSION":this.parseDimension(o);break;case"COMPONENT":this.parseComponent(o);break;default:console.warn("can not find hanlder with",o)}}onParseEnd(){for(let t of this.layerPhysCache)this.parseLayerPhys(t);this.layerPhysCache=[];for(let t of this.rules)t[1]=this.transRuleType(t[1]),t[3]=this.transRuleStatus(t[3]),t[4]=Yyt(t[1],t[2],t[3],t[4],this.fac,this.ruleTemplateName);if(this.fac.init){let t=Array.from(this.rules);for(let e of t){let r=jyt(e[1],e[2],e[4],this.fac);r&&this.rules.push(r)}}for(let t of this.rules)this.parseRule(t);let o={};for(let t of this.ruleSelectors){let e=Xyt(t[1],t[2],$k(t[3]),this.fac),r=JSON.stringify(t[1]);o[r]?(t[2]&&(o[r].ruleOrder=t[2]),e.ruleKeyValue&&(o[r].ruleKeyValue=Object.assign(o[r].ruleKeyValue,e.ruleKeyValue)),(e.copperRuleValue||t[4])&&(o[r].copperValue=e.copperRuleValue||$k(t[4])),(e.innerPlaneRuleValue||t[5])&&(o[r].innerPlaneValue=e.innerPlaneRuleValue||$k(t[5]))):o[r]={ruleSelect:t[1],ruleOrder:t[2],ruleKeyValue:e.ruleKeyValue,copperValue:e.copperRuleValue||$k(t[4])||{},innerPlaneValue:e.innerPlaneRuleValue||$k(t[5])||{}}}for(let t in o)this.parseRuleSelector(o[t]);this.handConnect(),this.parseEQLenGrpFull(),this.parsePanelize(),this.parseLayerFill();for(let t in this.cache){let e=this.cache[t],r=Object.keys(e).sort((n,s)=>Number(n)-Number(s)),i=-1;for(let n of r){let s=Number(n),a=s-i-1;a>=1&&this.onPHolder(t,a),i=s,this.curPartition=e[s].part,this.secondParseLine(e[s].value,void 0,e[s].attr),e[s].attr&&e[s].attr.forEach(l=>{this.curPartition=l.part,this.secondParseLine(l.value)})}if(this.errorIds[t])for(let n of this.errorIds[t])this.curPartition=n.part,this.secondParseLine(n.value)}this.clearCache()}clearCache(){this.version=void 0,this.docType=void 0,this.curPartition="",this.eQLenData={},this.eQLenSort=1,this.cache={},this.components={},this.errorIds={},this.dimension={},this.connects={},this.specialColors={},this.reuseBlock={},this.panelize.data.length&&(this.panelize.data.length=0,this.panelize.stamp={h:null,v:null},this.panelize.size={h:null,v:null}),this.layerPhys=0,this.fac.init&&(this.fac=new m5e),this.rules=[],this.ruleSelectors=[],this.ruleTemplateName="",this.layerFill={},this.idsSet.clear(),this.oldId={},this.creaseIds.length=0,this.substrateLayer.clear()}fixPolygon(o){if(o[0]=="R"){let t=parseFloat(o[3])/10,e=parseFloat(o[4])/10;o[6]=Math.min(t,e)/2*(parseFloat(o[6])||0)*10}}handleSimplePolygon(o){return!o||this.version>=1.5||this.fixPolygon(o),o}handlePolygon(o){if(this.version<1.5&&o&&o.length){if(!Array.isArray(o[0]))return this.handleSimplePolygon(o);for(let t of o)this.fixPolygon(t)}return o}parseEQLen(o){this.eQLenData[o[1]]?this.eQLenData[o[1]].pads?this.eQLenData[o[1]].pads.push(o[2]):this.eQLenData[o[1]].pads=[o[2]]:this.eQLenData[o[1]]={pads:[o[2]]}}parseEQLenGrp(o){this.eQLenData[o[1]]?(this.eQLenData[o[1]].id=o[1],this.eQLenData[o[1]].name=o[2],this.eQLenData[o[1]].sort=++this.eQLenSort):this.eQLenData[o[1]]={id:o[1],name:o[2],sort:++this.eQLenSort}}parseCanvas(o){this.onCanvas(o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],this.transGridType(o[10]),this.transGridType(o[11]),o[12])}parseDocType(o){this.docType=o[1];let t=parseFloat(o[2]);this.version=t}parseHead(o){}parseLayer(o){let t=o[8];this.version<1.7&&(t=.5);let e=this.transLayerStatus(o[4]),r=Number(o[1]);if(o[2]==="SUBSTRATE"){if(this.substrateLayer.add(r),r<101)return;r<361&&(r=r+260)}this.onLayer(r,o[2],o[3],e.use,e.show,e.locked,o[5],o[6],o[7],t)}parseLayerPhys(o){let t=Number(o[1]);if(t>=101&&t<361&&this.substrateLayer.has(t))t=t+260;else if(t<101&&this.substrateLayer.has(t))return;this.onLayerPhys(t,o[2],o[3],o[4],o[5],!!o[6],++this.layerPhys)}parseActiveLayer(o){this.onActiveLayer(o[1])}parsePartition(o){this.onPartition(o[1],o[2],o[3],this.handlePolygon(o[4]))}parseNet(o){var t,e,r,i;this.onNet(o[1],(t=o[2])!=null?t:null,(e=o[3])!=null?e:null,!!o[4],(r=o[5])!=null?r:null,!!o[6],(i=o[7])!=null?i:null)}parsePrimitive(o){this.onPrimitive(o[1],!!o[2],!!o[3])}parseGroup(o){this.onGroup(o[1],o[2])}parseSilkOpts(o){this.onSilkOpts(o[1],o[2],o[3])}parsePreference(o){this.onPreference(!!o[1],o[2],!!o[3],o[4],o[5],!!o[6],this.transRoutingMode(o[7]),o[8],!!o[9],!!o[10],!!o[11],o[12],o[13],!!o[14],this.transUnusedPadRange(o[15]),o[16],this.transPathOptimization(o[17]),o[18],o[19],o[20])}parseConnect(o){this.connects[o[1]]=o[2]}parseVia(o){var t,e;this.onVia(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],this.transViaType(o[9]),(t=o[10])!=null?t:null,(e=o[11])!=null?e:null,!!o[12],o[13])}parsePad(o){var t,e,r,i,n,s,a,l,c;this.onPad(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],this.transHoleDef(o[9]),this.transPadDef(o[10]),o[11]&&(e=(t=o[11])==null?void 0:t.map(h=>({startLayer:h[0],endLayer:h[1],pad:this.transPadDef(h[2])})))!=null?e:null,o[12],o[13],o[14],!!o[15],this.transPadFuncType(o[16]),(r=o[17])!=null?r:null,(i=o[18])!=null?i:null,(n=o[19])!=null?n:null,(s=o[20])!=null?s:null,!!o[21],this.transPadConnect(o[22]),(a=o[23])!=null?a:null,(l=o[24])!=null?l:null,(c=o[25])!=null?c:null,o[26],this.getConnect(o[1]))}parseLine(o){this.onLine(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],!!o[10])}parseArc(o){this.onArc(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],!!o[11],this.specialColors[this.getOldId(o[1])])}parseCArc(o){this.onCArc(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],!!o[11],this.specialColors[this.getOldId(o[1])])}parseObj(o){this.onObj(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],!!o[10],o[11],!!o[12],this.specialColors[this.getOldId(o[1])])}parseItemOrder(o){this.itemOrder=o[1]}parseProp(o){this.specialColors[o[1]]=o[2]}parseEQLenGrpFull(){for(let o in this.eQLenData){let t=this.eQLenData[o];t.id&&this.onEQLenGrp(t.id,t.name,t.sort,t.pads||[])}this.eQLenData={},this.eQLenSort=1}parsePoly(o){this.onPoly(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.handleSimplePolygon(o[6]),!!o[7],this.specialColors[this.getOldId(o[1])])}parseFill(o){this.onFill(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.transFillStyle(o[6]),this.handlePolygon(o[7]),!!o[8],this.getConnect(o[1]),this.specialColors[this.getOldId(o[1])])}getZIndex1(o){let t=o.match(QTe);return t!=null&&t.length?t[1]:null}parseLayerFill(){for(let o in this.layerFill){let t=this.layerFill[o];this.onLayerFill(Number(o),{fill:t.map(e=>{let r=this.getZIndex1(e[1]);return{id:e[1],partitionId:this.curPartition||"",groupId:e[2],locked:!!e[8],zIndex:r===null?null:Number(r),netName:e[3],width:e[5],path:this.handlePolygon(e[7]),refs:this.getConnect(e[1]),specialColor:this.specialColors[this.getOldId(e[1])]}})})}}parseRegion(o){let t=o[5],e=t&&t.includes(9)?"CONSTRAINT":"PROHIBIT";t=e?t.filter(r=>r!==9):t,this.onRegion(o[1],this.curPartition||"",o[2],o[3],o[4],this.transProhibitType(t),this.handlePolygon(o[6]),!!o[7],o[8],e)}parsePour(o){let t=o[9];this.version<=1.7&&t&&t[0]==="SOLID"&&t[1]&&(t[1]=8),this.onPour(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],this.handlePolygon(o[8]),this.transPourDef(t),!!o[10],!!o[11]),this.poured[o[1]]&&this.onPoured(o[1],this.poured[o[1]])}parsePoured(o){if(this.version<1.1){if(this.curPourId){let t={id:o[1],strokeWidth:o[2],fill:o[3],path:this.handlePolygon(o[4])};this.poured[this.curPourId]||(this.poured[this.curPourId]={pourFill:[]}),this.poured[this.curPourId].pourFill.push(t)}}else{let t={id:o[1],strokeWidth:o[3],fill:o[4],path:this.handlePolygon(o[5])};this.poured[o[2]]||(this.poured[o[2]]={pourFill:[]}),this.poured[o[2]].pourFill.push(t)}}parseImage(o){this.onImage(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],!!o[9],o[10],!!o[11],this.specialColors[this.getOldId(o[1])])}parseTeardrop(o){let t,e,r;this.version<1.2?(t=o[5],r=o[4]):(t=o[4],e=o[5],r=this.getConnect(o[1])),this.onTeardrop(o[1],this.curPartition||"",o[2],o[3],this.handleSimplePolygon(t),e!=null?e:null,r)}parseFpcFill(o){this.onFpcFill(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.handlePolygon(o[6]),!!o[7])}parseShell(o){let t=o[8];t&&t.Direction&&(t.Direction=this.transPushCoverDir(t.Direction)),this.onShell(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],this.handlePolygon(o[7]),t,!!o[9])}parseCrease(o){this.onCrease(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],!!o[9])}parseShellCut(o){this.onShellCut(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.handlePolygon(o[6]),!!o[7],this.getConnect(o[1]))}parseShellEntity(o){this.onShellEntity(o[1],this.curPartition||"",o[2],o[3],o[4],this.transEntityBelong(o[5]),this.transSlotOption(o[5]),o[6],o[7],this.handlePolygon(o[8]),!!o[9],this.getConnect(o[1]))}parseBoss(o){var t,e,r,i,n,s;this.version<1.4?this.onBoss(o[1],this.curPartition||"",o[2],o[3],o[5],o[6],(t=o[4])!=null?t:null,o[7],null,null,(e=o[8])!=null?e:null,(r=o[9])!=null?r:null,!!o[10]):this.onBoss(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],(i=o[6])!=null?i:null,o[7],o[8],o[9],(n=o[10])!=null?n:null,(s=o[11])!=null?s:null,!!o[12])}parseDimension(o){var t;let e=this.getOldId(o[1]),r=((t=this.dimension[e])==null?void 0:t.attr)||[];if(r.length){let n=this.fontCache.find(s=>s.id&&s.id===this.getOldId(r[1]));this.version<1.6&&n&&(n.text=r[8],n.fontFamily=r[11],n.fontSize=r[12]/10,n.thickness=r[13]/10,n.bold=r[15],n.italic=r[16],n.reverse=r[18],n.expansion=r[19]/10)}let i={groupId:r[2],layerId:r[4],x:r[5],y:r[6],text:r[8],fontFamily:r[11],fontSize:r[12],strokeWidth:r[13],bold:r[14],italic:r[15],origin:r[16],angle:r[17],reverse:r[18],expansion:r[19],mirror:r[20],locked:r[21],zIndex:null,specialColor:this.specialColors[this.getOldId(r[1])]};this.onDimension(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],!!o[7],o[8],!!o[9],i,this.specialColors[this.getOldId(o[1])],r[2]||"")}parseRuleTemplate(o){this.ruleTemplateName=o[1],this.onRuleTemplate(o[1])}parseRule(o){this.onRule(o[1],o[2],o[3],o[4])}parseRuleSelector(o){this.onRuleSelector(o.ruleSelect,o.ruleOrder,o.ruleKeyValue,o.copperValue,o.innerPlaneValue)}parsePanelize(){let o=this.panelize.data;o.length&&this.onPanelize(!!o[1],o[2],o[3],o[4],o[5],!!o[6],this.panelize.stamp.h,this.panelize.stamp.v,this.panelize.size.h,this.panelize.size.v)}parsePanelizeStamp(o){let t={on:!!o[2],stampHoleGroupQuantity:o[3],stampHoleDiameter:o[4],stampHoleQuantityPerGroup:o[5],stampHoleSpacing:o[6]};o[1]?this.panelize.stamp.v=t:this.panelize.stamp.h=t}parsePanelizeSide(o){let t={on:!!o[2],sideHeight:o[3],positionHoleDiameter:o[4],markDiameter:o[5],markExpansion:o[6]};o[1]?this.panelize.size.v=t:this.panelize.size.h=t}parseComponent(o){let t=this.getOldId(o[1]),e=o[7]||{},r=this.reuseBlock[t];if(r&&Object.assign(e,{"Group ID":r[2]||"","Channel ID":r[3]||""}),this.onComponent(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],e,!!o[8],this.specialColors[t]),this.cachePadNet[t])for(let i of this.cachePadNet[t])this.parsePadNet(i)}parsePadNet(o){let t=this.getOldId(o[1]);if(o[4]===void 0&&this.components[t]){let e=this.components[t].footprint;if(!e){let i=this.components[t].device;e=this.devices.find(n=>n.uuid===i).attributes.Footprint}let r=this.padNumId[e];if(!r){let i=this.footprints.find(n=>n.uuid===e);i&&(this.padNumId[e]=qyt(i==null?void 0:i.dataStr),r=this.padNumId[e])}if(r&&r[o[2]]){this.componentPadNum[t]||(this.componentPadNum[t]={}),this.componentPadNum[t][o[2]]===void 0&&(this.componentPadNum[t][o[2]]=-1);let i=++this.componentPadNum[t][o[2]];o[4]=r[o[2]][i]}else o[4]=o[2]}this.onPadNet(o[1],this.curPartition||"",o[2],o[3],o[4])}parseReuseBlock(o){this.reuseBlock[o[1]]=o}getFontCache(o,t,e,r,i,n,s,a){let l;return this.version<1.6?l=this.fontCache.find(c=>c.id===o):l=this.fontCache.find(c=>e==c.fontFamily&&t==c.text&&r/10==c.fontSize&&!!s==c.reverse&&a==c.expansion&&!!i==c.bold&&!!n==c.italic&&c.path.length>0),{paths:l==null?void 0:l.path,width:l==null?void 0:l.width,height:l==null?void 0:l.height}}getTextValue(o,t,e,r,i){let n="";return o!=""&&t===""&&this.docType!="PCB"&&!i&&o!="Footprint"&&!this.footprintIsConnectDevice&&(t=`<${o}>`),e?r?n=o+":"+t:n=o:r?n=t:n="",n}getFormulaName(o,t){if(!o||!o.startsWith("="))return o;o=o.slice(1);let e=/\{([^\}]+)\}/g,r=[],i=[];for(;r=e.exec(o);)i.push(r[1]);for(let n=0;n<i.length;n++){let s=i[n],a=`{${s}!}`;t.has(s)&&(a=t.get(s)),o=o.replace(`{${s}}`,a)}return o}parseAttr(o,t){let e=o[11],r=o[12];r&&this.version<1.2&&(e=="default"||e=="")&&(r*=1.5);let i=o[7],n=o[8],s=!!o[9],a=!!o[10],l=this.getOldId(o[3]),c=n;if(i==="Device"){let u=this.deviceName[n]||n;c=this.getTextValue(i,u,s,a,l)}else if(i==="Footprint"){let u=this.footprintName[n]||n;c=this.getTextValue(i,u,s,a,l)}else if(i==="Name"){let u=new Map;if(l){let d=this.components[l];if(u.set("ID",l),Object.entries(d.attrs).forEach(p=>u.set(p[0],p[1])),d.device){let p=this.devices.find(m=>m.uuid===d.device);p&&Object.entries(p.attributes).forEach(m=>u.set(m[0],m[1]))}}c=this.getTextValue(i,this.getFormulaName(n,u),s,a,l)}else c=this.getTextValue(i,n,s,a,l);let h=this.fontCache.find(u=>u.id&&u.id===this.getOldId(o[1]));this.version<1.6&&h&&(h.text=c,h.fontFamily=e,h.fontSize=r/10,h.thickness=o[13]/10,h.bold=o[15],h.italic=o[16],h.reverse=o[18],h.expansion=o[19]/10),this.onAttr(o[1],this.curPartition||"",o[2],l,o[4],o[5],o[6],i,n,s,a,e,r,o[13],!!o[14],!!o[15],this.transAlignType(o[16]),o[17],!!o[18],o[19],!!o[20],!!o[21],t,this.specialColors[this.getOldId(o[1])])}parseFont(o){let t;switch(this.version){case 1:case 1.1:t={id:o[1],path:o[2]};break;case 1.2:case 1.3:case 1.4:case 1.5:t={id:o[1],width:o[2],height:o[3],path:o[4]};break;default:t={text:o[1],fontFamily:o[2],fontSize:o[3],thickness:o[4],bold:!!o[5],italic:!!o[6],reverse:!!o[7],expansion:o[8],width:o[9],height:o[10],path:o[11]};break}this.fontCache.push(t)}parseString(o){var t;let[,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P]=o,T=(t=this.stringId[e])!=null?t:e;c&&this.version<1.2&&(l=="default"||l=="")&&(c*=1.5);let I=this.fontCache.find(C=>C.id&&C.id===this.getOldId(T));this.version<1.6&&I&&(I.text=a,I.fontFamily=l,I.fontSize=c/10,I.thickness=h/10,I.bold=u,I.italic=d,I.reverse=g,I.expansion=y/10),this.onString(e,this.curPartition||"",r,i,n,s,a,l,c,h,!!u,!!d,this.transAlignType(p),m,!!g,y,!!b,!!P,this.specialColors[this.getOldId(T)])}},Kyt=Object.create,DNe=Object.defineProperty,Zyt=Object.getOwnPropertyDescriptor,Jyt=Object.getOwnPropertyNames,Qyt=Object.getPrototypeOf,ebt=Object.prototype.hasOwnProperty,tbt=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),rbt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Jyt(t))!ebt.call(o,i)&&i!==e&&DNe(o,i,{get:()=>t[i],enumerable:!(r=Zyt(t,i))||r.enumerable});return o},ibt=(o,t,e)=>(e=o!=null?Kyt(Qyt(o)):{},rbt(t||!o||!o.__esModule?DNe(e,"default",{value:o,enumerable:!0}):e,o)),nbt=tbt((o,t)=>{"use strict";t.exports=e,t.exports.default=e;function e(L,B,N){N=N||2;var U=B&&B.length,k=U?B[0]*N:L.length,V=r(L,0,k,N,!0),Y=[];if(!V||V.next===V.prev)return Y;var X,Z,Q,ae,he,re,se;if(U&&(V=h(L,B,V,N)),L.length>80*N){X=Q=L[0],Z=ae=L[1];for(var K=N;K<k;K+=N)he=L[K],re=L[K+1],he<X&&(X=he),re<Z&&(Z=re),he>Q&&(Q=he),re>ae&&(ae=re);se=Math.max(Q-X,ae-Z),se=se!==0?32767/se:0}return n(V,Y,N,X,Z,se,0),Y}function r(L,B,N,U,k){var V,Y;if(k===W(L,B,N,U)>0)for(V=B;V<N;V+=U)Y=H(V,L[V],L[V+1],Y);else for(V=N-U;V>=B;V-=U)Y=H(V,L[V],L[V+1],Y);return Y&&E(Y,Y.next)&&(z(Y),Y=Y.next),Y}function i(L,B){if(!L)return L;B||(B=L);var N=L,U;do if(U=!1,!N.steiner&&(E(N,N.next)||C(N.prev,N,N.next)===0)){if(z(N),N=B=N.prev,N===N.next)break;U=!0}else N=N.next;while(U||N!==B);return B}function n(L,B,N,U,k,V,Y){if(L){!Y&&V&&g(L,U,k,V);for(var X=L,Z,Q;L.prev!==L.next;){if(Z=L.prev,Q=L.next,V?a(L,U,k,V):s(L)){B.push(Z.i/N|0),B.push(L.i/N|0),B.push(Q.i/N|0),z(L),L=Q.next,X=Q.next;continue}if(L=Q,L===X){Y?Y===1?(L=l(i(L),B,N),n(L,B,N,U,k,V,2)):Y===2&&c(L,B,N,U,k,V):n(i(L),B,N,U,k,V,1);break}}}}function s(L){var B=L.prev,N=L,U=L.next;if(C(B,N,U)>=0)return!1;for(var k=B.x,V=N.x,Y=U.x,X=B.y,Z=N.y,Q=U.y,ae=k<V?k<Y?k:Y:V<Y?V:Y,he=X<Z?X<Q?X:Q:Z<Q?Z:Q,re=k>V?k>Y?k:Y:V>Y?V:Y,se=X>Z?X>Q?X:Q:Z>Q?Z:Q,K=U.next;K!==B;){if(K.x>=ae&&K.x<=re&&K.y>=he&&K.y<=se&&T(k,X,V,Z,Y,Q,K.x,K.y)&&C(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function a(L,B,N,U){var k=L.prev,V=L,Y=L.next;if(C(k,V,Y)>=0)return!1;for(var X=k.x,Z=V.x,Q=Y.x,ae=k.y,he=V.y,re=Y.y,se=X<Z?X<Q?X:Q:Z<Q?Z:Q,K=ae<he?ae<re?ae:re:he<re?he:re,me=X>Z?X>Q?X:Q:Z>Q?Z:Q,Oe=ae>he?ae>re?ae:re:he>re?he:re,Ie=b(se,K,B,N,U),ue=b(me,Oe,B,N,U),Pe=L.prevZ,j=L.nextZ;Pe&&Pe.z>=Ie&&j&&j.z<=ue;){if(Pe.x>=se&&Pe.x<=me&&Pe.y>=K&&Pe.y<=Oe&&Pe!==k&&Pe!==Y&&T(X,ae,Z,he,Q,re,Pe.x,Pe.y)&&C(Pe.prev,Pe,Pe.next)>=0||(Pe=Pe.prevZ,j.x>=se&&j.x<=me&&j.y>=K&&j.y<=Oe&&j!==k&&j!==Y&&T(X,ae,Z,he,Q,re,j.x,j.y)&&C(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;Pe&&Pe.z>=Ie;){if(Pe.x>=se&&Pe.x<=me&&Pe.y>=K&&Pe.y<=Oe&&Pe!==k&&Pe!==Y&&T(X,ae,Z,he,Q,re,Pe.x,Pe.y)&&C(Pe.prev,Pe,Pe.next)>=0)return!1;Pe=Pe.prevZ}for(;j&&j.z<=ue;){if(j.x>=se&&j.x<=me&&j.y>=K&&j.y<=Oe&&j!==k&&j!==Y&&T(X,ae,Z,he,Q,re,j.x,j.y)&&C(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function l(L,B,N){var U=L;do{var k=U.prev,V=U.next.next;!E(k,V)&&O(k,U,U.next,V)&&D(k,V)&&D(V,k)&&(B.push(k.i/N|0),B.push(U.i/N|0),B.push(V.i/N|0),z(U),z(U.next),U=L=V),U=U.next}while(U!==L);return i(U)}function c(L,B,N,U,k,V){var Y=L;do{for(var X=Y.next.next;X!==Y.prev;){if(Y.i!==X.i&&I(Y,X)){var Z=F(Y,X);Y=i(Y,Y.next),Z=i(Z,Z.next),n(Y,B,N,U,k,V,0),n(Z,B,N,U,k,V,0);return}X=X.next}Y=Y.next}while(Y!==L)}function h(L,B,N,U){var k=[],V,Y,X,Z,Q;for(V=0,Y=B.length;V<Y;V++)X=B[V]*U,Z=V<Y-1?B[V+1]*U:L.length,Q=r(L,X,Z,U,!1),Q===Q.next&&(Q.steiner=!0),k.push(P(Q));for(k.sort(u),V=0;V<k.length;V++)N=d(k[V],N);return N}function u(L,B){return L.x-B.x}function d(L,B){var N=p(L,B);if(!N)return B;var U=F(N,L);return i(U,U.next),i(N,N.next)}function p(L,B){var N=B,U=L.x,k=L.y,V=-1/0,Y;do{if(k<=N.y&&k>=N.next.y&&N.next.y!==N.y){var X=N.x+(k-N.y)*(N.next.x-N.x)/(N.next.y-N.y);if(X<=U&&X>V&&(V=X,Y=N.x<N.next.x?N:N.next,X===U))return Y}N=N.next}while(N!==B);if(!Y)return null;var Z=Y,Q=Y.x,ae=Y.y,he=1/0,re;N=Y;do U>=N.x&&N.x>=Q&&U!==N.x&&T(k<ae?U:V,k,Q,ae,k<ae?V:U,k,N.x,N.y)&&(re=Math.abs(k-N.y)/(U-N.x),D(N,L)&&(re<he||re===he&&(N.x>Y.x||N.x===Y.x&&m(Y,N)))&&(Y=N,he=re)),N=N.next;while(N!==Z);return Y}function m(L,B){return C(L.prev,L,B.prev)<0&&C(B.next,L,L.next)<0}function g(L,B,N,U){var k=L;do k.z===0&&(k.z=b(k.x,k.y,B,N,U)),k.prevZ=k.prev,k.nextZ=k.next,k=k.next;while(k!==L);k.prevZ.nextZ=null,k.prevZ=null,y(k)}function y(L){var B,N,U,k,V,Y,X,Z,Q=1;do{for(N=L,L=null,V=null,Y=0;N;){for(Y++,U=N,X=0,B=0;B<Q&&(X++,U=U.nextZ,!!U);B++);for(Z=Q;X>0||Z>0&&U;)X!==0&&(Z===0||!U||N.z<=U.z)?(k=N,N=N.nextZ,X--):(k=U,U=U.nextZ,Z--),V?V.nextZ=k:L=k,k.prevZ=V,V=k;N=U}V.nextZ=null,Q*=2}while(Y>1);return L}function b(L,B,N,U,k){return L=(L-N)*k|0,B=(B-U)*k|0,L=(L|L<<8)&16711935,L=(L|L<<4)&252645135,L=(L|L<<2)&858993459,L=(L|L<<1)&1431655765,B=(B|B<<8)&16711935,B=(B|B<<4)&252645135,B=(B|B<<2)&858993459,B=(B|B<<1)&1431655765,L|B<<1}function P(L){var B=L,N=L;do(B.x<N.x||B.x===N.x&&B.y<N.y)&&(N=B),B=B.next;while(B!==L);return N}function T(L,B,N,U,k,V,Y,X){return(k-Y)*(B-X)>=(L-Y)*(V-X)&&(L-Y)*(U-X)>=(N-Y)*(B-X)&&(N-Y)*(V-X)>=(k-Y)*(U-X)}function I(L,B){return L.next.i!==B.i&&L.prev.i!==B.i&&!v(L,B)&&(D(L,B)&&D(B,L)&&w(L,B)&&(C(L.prev,L,B.prev)||C(L,B.prev,B))||E(L,B)&&C(L.prev,L,L.next)>0&&C(B.prev,B,B.next)>0)}function C(L,B,N){return(B.y-L.y)*(N.x-B.x)-(B.x-L.x)*(N.y-B.y)}function E(L,B){return L.x===B.x&&L.y===B.y}function O(L,B,N,U){var k=R(C(L,B,N)),V=R(C(L,B,U)),Y=R(C(N,U,L)),X=R(C(N,U,B));return!!(k!==V&&Y!==X||k===0&&_(L,N,B)||V===0&&_(L,U,B)||Y===0&&_(N,L,U)||X===0&&_(N,B,U))}function _(L,B,N){return B.x<=Math.max(L.x,N.x)&&B.x>=Math.min(L.x,N.x)&&B.y<=Math.max(L.y,N.y)&&B.y>=Math.min(L.y,N.y)}function R(L){return L>0?1:L<0?-1:0}function v(L,B){var N=L;do{if(N.i!==L.i&&N.next.i!==L.i&&N.i!==B.i&&N.next.i!==B.i&&O(N,N.next,L,B))return!0;N=N.next}while(N!==L);return!1}function D(L,B){return C(L.prev,L,L.next)<0?C(L,B,L.next)>=0&&C(L,L.prev,B)>=0:C(L,B,L.prev)<0||C(L,L.next,B)<0}function w(L,B){var N=L,U=!1,k=(L.x+B.x)/2,V=(L.y+B.y)/2;do N.y>V!=N.next.y>V&&N.next.y!==N.y&&k<(N.next.x-N.x)*(V-N.y)/(N.next.y-N.y)+N.x&&(U=!U),N=N.next;while(N!==L);return U}function F(L,B){var N=new G(L.i,L.x,L.y),U=new G(B.i,B.x,B.y),k=L.next,V=B.prev;return L.next=B,B.prev=L,N.next=k,k.prev=N,U.next=N,N.prev=U,V.next=U,U.prev=V,U}function H(L,B,N,U){var k=new G(L,B,N);return U?(k.next=U.next,k.prev=U,U.next.prev=k,U.next=k):(k.prev=k,k.next=k),k}function z(L){L.next.prev=L.prev,L.prev.next=L.next,L.prevZ&&(L.prevZ.nextZ=L.nextZ),L.nextZ&&(L.nextZ.prevZ=L.prevZ)}function G(L,B,N){this.i=L,this.x=B,this.y=N,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}e.deviation=function(L,B,N,U){var k=B&&B.length,V=k?B[0]*N:L.length,Y=Math.abs(W(L,0,V,N));if(k)for(var X=0,Z=B.length;X<Z;X++){var Q=B[X]*N,ae=X<Z-1?B[X+1]*N:L.length;Y-=Math.abs(W(L,Q,ae,N))}var he=0;for(X=0;X<U.length;X+=3){var re=U[X]*N,se=U[X+1]*N,K=U[X+2]*N;he+=Math.abs((L[re]-L[K])*(L[se+1]-L[re+1])-(L[re]-L[se])*(L[K+1]-L[re+1]))}return Y===0&&he===0?0:Math.abs((he-Y)/Y)};function W(L,B,N,U){for(var k=0,V=B,Y=N-U;V<N;V+=U)k+=(L[Y]-L[V])*(L[V+1]+L[Y+1]),Y=V;return k}e.flatten=function(L){for(var B=L[0][0].length,N={vertices:[],holes:[],dimensions:B},U=0,k=0;k<L.length;k++){for(var V=0;V<L[k].length;V++)for(var Y=0;Y<B;Y++)N.vertices.push(L[k][V][Y]);k>0&&(U+=L[k-1].length,N.holes.push(U))}return N}}),obt=(o=>(o[o.MIL=1]="MIL",o[o.INCH=1e3]="INCH",o[o.FT=12e3]="FT",o[o.YARD=36e3]="YARD",o[o.MILE=6336e4]="MILE",o[o.KM=3937007874e-2]="KM",o[o.M=39370]="M",o[o.DM=3937]="DM",o[o.CM=393.7]="CM",o[o.MM=39.37]="MM",o[o.UM=.039]="UM",o[o.NM=394e-7]="NM",o[o.PT=13.88888888888889]="PT",o[o.PX72=13.88888888888889]="PX72",o[o.PX96=10.416666666666666]="PX96",o[o.PX100=10]="PX100",o[o.LTSPICE=6.25]="LTSPICE",o[o.PX1=.1]="PX1",o[o.PX001=.001]="PX001",o))(obt||{}),sbt=(o=>(o.MIL="mil",o.INCH="inch",o.FT="ft",o.YARD="yard",o.MILE="mile",o.KM="km",o.M="m",o.DM="dm",o.CM="cm",o.MM="mm",o.UM="um",o.NM="nm",o.PT="pt",o.PX72="px(72)",o.PX96="px(96)",o.PX100="px(100)",o))(sbt||{}),y5e={mil:1,inch:1e3,ft:12e3,yard:36e3,mile:6336e4,km:3937007874e-2,dm:3937,mm:39.37,um:.039,nm:394e-7,pt:13.88888888888889,"px(72)":13.88888888888889,"px(96)":10.416666666666666,"px(100)":10},xYt=(()=>{let o={};for(let t in y5e)o[y5e[t]]=t;return o})(),iee,RYt=(iee=class{constructor(o,t){this.ratio=o/t}wrap(o){return o*this.ratio}static convert(o,t,e){return o*t/e}},iee.ASIS=new iee(1,1),iee),nee=class{conversion(o,t,e){if(o===t)return e;let r=o+2+t;return this[r](e)}conversion1(o,t,e){let r=o+2+t,i=this[r](e);return t=="mil"?Math.round(i*10)/10:Math.round(i*1e3)/1e3}mil2mil(o){return o}mil2mm(o){return o*.0254}mil2cm(o){return o*.00254}mil2inch(o){return o/1e3}mm2mm(o){return o}mm2mil(o){let t=Math.pow(10,5);return Math.round(o*39.37007874015748*t)/t}mm2cm(o){return o/10}mm2inch(o){let t=Math.pow(10,8);return Math.round(o*.03937007874015748*t)/t}cm2mil(o){let t=Math.pow(10,6);return Math.round(o*393.7007874015748*t)/t}cm2mm(o){return o*10}cm2inch(o){let t=Math.pow(10,7);return Math.round(o*.3937007874015748*t)/t}inch2mil(o){return o*1e3}inch2mm(o){return o*25.4}inch2cm(o){return o*2.54}};nee.prototype["px(100)2mil"]=o=>o*10,nee.prototype["px(100)2mm"]=o=>o*.254,nee.prototype["mil2px(100)"]=o=>o/10,nee.prototype["mm2px(100)"]=o=>{let t=Math.pow(10,5);return Math.round(o*3.937007874015748*t)/t};var oee=null,tIe=new ArrayBuffer(8),zPe=new Float64Array(tIe),YPe=new Uint32Array(tIe),b5e=new Uint16Array(tIe),P5e=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!oee){let o=this.getUrlVars().version;o?oee="/analyzer/v"+o:oee="/analyzer"}return oee}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;zPe[0]=new Date().getTime(),o.push(YPe[1].toString(16)),zPe[0]=Math.random(),o.push(b5e[3].toString(16));let t=b5e[2].toString(16);o.push("4"+t.substr(0,3)),zPe[0]=performance.now();let e=YPe[0].toString(16)+YPe[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},wNe=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(rB.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(rB.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(rB.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(rB.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},abt=(o=>(o[o.UNKNOWN=0]="UNKNOWN",o[o.PERCENT=1]="PERCENT",o[o.LEFT_PAD0=2]="LEFT_PAD0",o))(abt||{}),lbt=/(\.?0+)$/,rB=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(P5e.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(P5e.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);wNe.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(lbt,"")}},cbt=(o=>(o[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARNING=2]="WARNING",o[o.ERROR=3]="ERROR",o[o.DUMMY=4]="DUMMY",o))(cbt||{});function hbt(o){switch(o){case 0:return"DEBUG";case 1:return"INFO";case 2:return"WARNING";case 3:return"ERROR";case 4:return"DUMMY"}}var ubt=(o,t)=>{o===3?console.error(t):console.log(t)},dbt=(o,t)=>rB.format("%s %s: %s",new Date,hbt(o),t),Gk,ate=(Gk=class{constructor(o,t=ubt,e=dbt){this.debug=!1,this.level=o,this.writer=t,this.fmt=e}static mix(...o){let t=4;for(let e of o)e.level<t&&(t=e.level);return new Gk(t,(e,r)=>{for(let i of o)i.write1(e,r)},(e,r)=>r)}wrap(o=null,t=null){let e=o===null?this.fmt:(i,n)=>(n=o(i,n),this.fmt(i,n)),r=t===null?this.writer:(i,n)=>{t(i,n),this.writer(i,n)};return new Gk(this.level,r,e)}chain(o){return o.wrap(this.fmt.bind(this),this.writer.bind(this))}include(o){return this.level<=o}write3(o,t,e){this.include(o)&&this.writer(o,this.fmt(o,rB.format(t,...e)))}write2(o,t){this.include(o)&&(t instanceof Error?this.writer(o,this.fmt(o,t.stack)):this.writer(o,this.fmt(o,t.toString())))}write1(o,t){this.include(o)&&this.writer(o,this.fmt(o,t))}debug3(o,...t){this.write3(0,o,t)}debug2(o){this.write2(0,o)}debug1(o){this.write1(0,o)}info3(o,...t){this.write3(1,o,t)}info2(o){this.write2(1,o)}info1(o){this.write1(1,o)}warning3(o,...t){this.write3(2,o,t)}warning2(o){this.write2(2,o)}warning1(o){this.write1(2,o)}error3(o,...t){this.write3(3,o,t)}error2(o){this.write2(3,o)}error1(o){this.write1(3,o)}},Gk.DUMMY=new Gk(4),Gk),rIe=new ArrayBuffer(8),jPe=new Float64Array(rIe),XPe=new Uint32Array(rIe),T5e=new Uint16Array(rIe),I5e=ArrayBuffer;try{I5e=self.HTMLImageElement||I5e}catch{}var see=null;function yM(o,t,e=0,r=o.length){i(o,null,t,e,r);function i(s,a,l,c,h){let u,d,p,m;if(c<h-1){let g=h-c;if(g>50)a===null&&(a=new Array(g+1)),n(s,a,l,c,(c+h)/2|0,h);else{u=s[c],d=c,p=c,m=h;let y=d+1;for(;y<m;){if(p!=m){if(m=m+-1,l(u,s[m])<=0)continue;s[p]=s[m],p=m;continue}if(l(u,s[y])>=0){d=y,y=d+1;continue}s[p]=s[y],d=y,p=y,y=d+1}s[p]=u,i(s,a,l,c,p),i(s,a,l,p+1,h)}}}function n(s,a,l,c,h,u){i(s,a,l,c,h),i(s,a,l,h,u);for(var d=c,p=h,m=0,g=s[d],y=s[p];d<h&&p<u;){var b=l(g,y);isNaN(b)?(a[m++]=y,y=s[++p]):(b<=0&&(a[m++]=g,g=s[++d]),b>=0&&(a[m++]=y,y=s[++p]))}for(;d<h;d++)a[m++]=s[d];for(;p<u;p++)a[m++]=s[p];for(d=c,p=0;p<m;d++,p++)s[d]=a[p]}}var v1=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!see){let o=this.getUrlVars().version;o?see="/analyzer/v"+o:see="/analyzer"}return see}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;jPe[0]=new Date().getTime(),o.push(XPe[1].toString(16)),jPe[0]=Math.random(),o.push(T5e[3].toString(16));let t=T5e[2].toString(16);o.push("4"+t.substr(0,3)),jPe[0]=performance.now();let e=XPe[0].toString(16)+XPe[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},pbt=[1,10,100,1e3],aee=0,oM=0;function C5e(o,t,e){return aee=Math.abs(o-t),e>=5&&aee>1e-5||isNaN(e)&&aee>1e-8?!1:aee<1e-13?!0:(oM=Math.min(S5e(o),S5e(t)),oM<10&&(oM=10),isNaN(e)||(oM=Math.min(oM,e)),E5e(o,oM)===E5e(t,oM))}var lee=0,cee=0;function S5e(o){return lee=0,cee=0,o>0?lee=o-Math.floor(o):lee=o-Math.ceil(o),cee=(lee.toString()||"").length,cee>2?cee-2:0}function E5e(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=pbt[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}var fbt=(o=>(o[o.UNKNOWN=0]="UNKNOWN",o[o.PERCENT=1]="PERCENT",o[o.LEFT_PAD0=2]="LEFT_PAD0",o))(fbt||{}),mbt=/(\.?0+)$/,iB=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(v1.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(v1.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);zu.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(mbt,"")}},zu=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(iB.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(iB.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(iB.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(iB.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},hee,Or=(hee=class{static regular(o){return Math.round(o*this.precision)/this.precision}static eq(o,t){return Math.abs(o-t)<=this.eps}static neq(o,t){return Math.abs(o-t)>this.eps}static less(o,t){return o-t<-this.eps}static lesseq(o,t){return o-t<=this.eps}static greater(o,t){return o-t>this.eps}static greatereq(o,t){return o-t>=-this.eps}static sqrt(o){return Math.abs(o)<=1e-10?0:Math.sqrt(o)}static sortAsc(o,t){return o-t}static sortDesc(o,t){return t-o}},hee.eps=1e-8,hee.precision=1e8,hee);function lB(o,t){Vee(o.iterator(),t)}function Vee(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var gbt=class{constructor(o){this.idx=-1,this.lst=o}hasNext(){return this.idx<this.lst.length-1}next(){if(this.idx<this.lst.length-1)return this.idx++,this.lst[this.idx];throw new Error("bug")}};function CTe(o){return new gbt(o)}var A1,ts=(A1=class{static toDegrees(o){return o*180/Math.PI}static toRadians(o){return o/180*Math.PI}static regularD(o){return o=o%360,o=o<0?360+o:o,o===360?0:o}static regular(o){return o=o%A1.PIx2,o=o<0?A1.PIx2+o:o,o===A1.PIx2?0:o}static toQuarterBase(o){return A1.regular((o+A1.PI_4)/A1.PI_2*A1.PI_2)}static toQuarterBaseD(o){return A1.regularD(((o+45)/90|0)*90)}static transformD(o,t){return A1.toDegrees(A1.transform(A1.toRadians(o),t))}static transform(o,t){let e=Math.cos(o),r=Math.sin(o),i=new Ft(t.data[6],t.data[7]),n=new Ft(e,r).multiply3(t);return A1.regular(n.angle(i))}},A1.PIx2=Math.PI*2,A1.PI_2=Math.PI/2,A1.PI_4=Math.PI/4,A1),pp=class{static dotProd1(o,t,e,r){return o*e+t*r}static dotProd2(o,t,e,r,i,n){return this.dotProd1(e-o,r-t,i-e,n-r)}static dotProd3(o,t,e){return this.dotProd2(o.x,o.y,t.x,t.y,e.x,e.y)}static crossProd1(o,t,e,r){return o*r-t*e}static crossProd2(o,t,e,r,i,n){return this.crossProd1(e-o,r-t,i-e,n-r)}static crossProd3(o,t,e){return this.crossProd2(o.x,o.y,t.x,t.y,e.x,e.y)}static distance2(o,t,e,r){let i=e-o,n=r-t;return i*i+n*n}static distance1(o,t,e,r){return this.hypot(e-o,r-t)}static distance1p(o,t){return this.distance1(o.x,o.y,t.x,t.y)}static hypot(o,t){if(o=Math.abs(o),t=Math.abs(t),t>o){var e=t;t=o,o=e}if(o===0)return t;var r=t/o;return o*Math.sqrt(1+r*r)}},LNe=new ArrayBuffer(16),O5e=new Float64Array(LNe),uee=new Int32Array(LNe),ac,Ft=(ac=class{static sortByXAsc(o,t){return o.x-t.x}static sortByYAsc(o,t){return o.y-t.y}static sortByXYAsc(o,t){return o.x<t.x?-1:o.x>t.x?1:o.y-t.y}static caculateAngle(o,t){let e=Math.cos(o),r=Math.sin(o),i=e*t.data[0]+r*t.data[4],n=e*t.data[1]+r*t.data[5],s=new ac(i,n).normalize();return Math.atan2(s.y,s.x)}static normal(o,t,e){let r=t.sub(o),i=e.sub(t);return r.cross(i)}static getVector2(o){return new ac(Math.cos(o),Math.sin(o))}static getCrossPoint1(o,t,e,r){if(o.equals1(t)||e.equals1(r)||Or.eq(1,Math.abs(t.sub(o).normalize().dot(r.sub(e).normalize()))))return null;let i=t.y-o.y,n=o.x-t.x,s=t.x*o.y-o.x*t.y,a=r.y-e.y,l=e.x-r.x,c=r.x*e.y-e.x*r.y,h=i*l-a*n;return new ac((c*n-s*l)/h,(s*a-c*i)/h)}static getCrossPoint2(o,t,e,r){return this.getCrossPoint1(o,o.add(t),e,e.add(r))}constructor(o,t){this.x=zu.normal(o),this.y=zu.normal(t)}get hashed(){return this._hashed==null&&(O5e[0]=this.x,O5e[1]=this.y,this._hashed=uee[0]^uee[1]^uee[2]^uee[3]),this._hashed}dot(o){return this.x*o.x+this.y*o.y}length(){return Math.sqrt(this.dot(this))}getCos(){return this.x/this.length()}sub(o){var t=this.x-o.x,e=this.y-o.y;return new ac(t,e)}add(o){var t=this.x+o.x,e=this.y+o.y;return new ac(t,e)}div(o){return new ac(this.x/o,this.y/o)}add1(o,t){return new ac(this.x+o,this.y+t)}mul(o){return new ac(this.x*o,this.y*o)}cross(o){return this.x*o.y-this.y*o.x}getSin(){return this.y/this.length()}angle2(o){let t=this.y-o.y,e=this.x-o.x;return t=Math.abs(t-0)<10**-4?0:t,e=Math.abs(e-0)<10**-4?0:e,Math.atan2(t,e)}angleD2(o){return ts.toDegrees(this.angle2(o))}angle(o){return Math.atan2(this.y-o.y,this.x-o.x)}angleX(o=ac.ORIGIN){let t=this.angle(o);return t<0&&(t=Math.PI*2+t),t}angleD(o){return ts.toDegrees(this.angle(o))}distance1(o){let t=o.x-this.x,e=o.y-this.y;return pp.hypot(t,e)}distance2(o){let t=o.x-this.x,e=o.y-this.y;return t*t+e*e}rotateD(o,t){return this.rotate(o,ts.toRadians(t))}rotate(o,t){let e=Math.cos(t),r=Math.sin(t),i=this.x-o.x,n=this.y-o.y,s=i*e+n*-r,a=i*r+n*e;return o.add1(s,a)}multiply3(o){let t=this.x*o.data[0]+this.y*o.data[3]+o.data[6],e=this.x*o.data[1]+this.y*o.data[4]+o.data[7];return new ac(t,e)}multiply4(o){let t=this.x*o.data[0]+this.y*o.data[4]+o.data[12],e=this.x*o.data[1]+this.y*o.data[5]+o.data[13];return new ac(t,e)}hashCode(){return this.hashed}equals(o,t){return o instanceof ac?C5e(o.x,this.x,t)&&C5e(o.y,this.y,t):!1}equals1(o){return o?Or.eq(this.x,o.x)&&Or.eq(this.y,o.y):!1}equals2(o,t){return o instanceof ac?Math.abs(this.x-o.x)<=t&&Math.abs(this.y-o.y)<=t:!1}similarEquals(o,t=.5){return Math.abs(this.x*.1-o.x*.1)<=t&&Math.abs(this.y*.1-o.y*.1)<=t}toString(){return"Vector [X="+this.x+", Y="+this.y+"]"}bbox(){let o=this.x,t=this.y;return new _1(o,o,t,t)}normalize(){if(this.x===0&&this.y===0)return new ac(0,0);let o=this.x/this.length(),t=this.y/this.length();return new ac(o,t)}regular(o=1e-4){let t=Math.round(1/o);return new ac(Math.round(this.x*t)/t,Math.round(this.y*t)/t)}round(o=4){let t=10**(o|0);return new ac(Math.round(this.x*t)/t,Math.round(this.y*t)/t)}mirrorX(o=ac.ORIGIN){return new ac(this.x,2*o.y-this.y)}mirrorY(o=ac.ORIGIN){return new ac(2*o.x-this.x,this.y)}mirrorCenter(o=ac.ORIGIN){return new ac(2*o.x-this.x,2*o.y-this.y)}clone(){return new ac(this.x,this.y)}mirror(o=ac.ORIGIN){return new ac(2*o.x-this.x,2*o.y-this.y)}pointOnRays(o,t){let e=ts.toRadians(o);return new ac(this.x+Math.cos(e)*t,this.y+Math.sin(e)*t)}pointOnRays2(o,t){let e=o.angle(this);return new ac(this.x+Math.cos(e)*t,this.y+Math.sin(e)*t)}scale(o){return new ac(this.x*o,this.y*o)}},ac.ORIGIN=new ac(0,0),ac.X_UNIT_VECTOR=new ac(1,0),ac.Y_UNIT_VECTOR=new ac(0,1),ac),ybt=(o=>(o[o.LEFT=0]="LEFT",o[o.CENTER=1]="CENTER",o[o.RIGHT=2]="RIGHT",o))(ybt||{}),bbt=(o=>(o[o.TOP=0]="TOP",o[o.CENTER=1]="CENTER",o[o.BOTTOM=2]="BOTTOM",o))(bbt||{}),sm,sA=(sm=class{constructor(o,t){this.horizontal=o,this.vertical=t}},sm.LT=new sm(0,0),sm.LC=new sm(0,1),sm.LB=new sm(0,2),sm.CT=new sm(1,0),sm.CC=new sm(1,1),sm.CB=new sm(1,2),sm.RT=new sm(2,0),sm.RC=new sm(2,1),sm.RB=new sm(2,2),sm),Pbt=(o=>(o[o.INNER=0]="INNER",o[o.OUTER=1]="OUTER",o[o.SEPARATED=2]="SEPARATED",o[o.INTERSECTED=3]="INTERSECTED",o[o.EQ=4]="EQ",o[o.INSIDE_TOUCHED=5]="INSIDE_TOUCHED",o[o.OUTSIDE_TOUCHED=6]="OUTSIDE_TOUCHED",o))(Pbt||{}),Bb=class{constructor(){this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY}ext1(o){return this.minX=Math.min(this.minX,o.minX),this.maxX=Math.max(this.maxX,o.maxX),this.minY=Math.min(this.minY,o.minY),this.maxY=Math.max(this.maxY,o.maxY),this}ext2(o){return this.minX=Math.min(this.minX,o.x),this.maxX=Math.max(this.maxX,o.x),this.minY=Math.min(this.minY,o.y),this.maxY=Math.max(this.maxY,o.y),this}ext3(o){for(let t=0;t<o.length;t++){let e=o[t];this.ext2(e)}return this}ext4(o){return lB(o,(t,e)=>(this.ext2(e),!0)),this}ext5(o,t,e,r){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,t),this.minY=Math.min(this.minY,e),this.maxY=Math.max(this.maxY,r),this}ext6(o,t){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,o),this.minY=Math.min(this.minY,t),this.maxY=Math.max(this.maxY,t),this}ext7(o){if(o<0){let t=o*2;if(t<this.minX-this.maxX||t<this.minY-this.maxY)throw new Error("")}return this.minX-=o,this.maxX+=o,this.minY-=o,this.maxY+=o,this}ext8(o){let t=[];for(let e=0;e<o.length;e+=2)t.push(new Ft(o[e],o[e+1]));return this.ext3(t)}ext9(o,t,e,r){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,o+e),this.minY=Math.min(this.minY,t),this.maxY=Math.max(this.maxY,t+r),this}ext10({x:o,y:t,width:e,height:r}){return this.ext9(o,t,e,r)}valid(){return isFinite(this.minX)&&isFinite(this.maxX)&&isFinite(this.minY)&&isFinite(this.maxY)}clear(){this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY}build(){return new _1(this.minX,this.maxX,this.minY,this.maxY)}build1(){return this.valid()?new _1(this.minX,this.maxX,this.minY,this.maxY):new _1(0,0,0,0)}},fz=new Float64Array(4),_1=class xI{static extendRect({x:t,y:e,width:r,height:i}){return new xI(t,t+r,e,e+i)}static extend1(t,e){if(t===null)return new xI(e.x,e.x,e.y,e.y);{let r=Math.min(t.minX,e.x),i=Math.max(t.maxX,e.x),n=Math.min(t.minY,e.y),s=Math.max(t.maxY,e.y);return new xI(r,i,n,s)}}static extend2(t,e){if(t){let r=Math.min(t.minX,e.minX),i=Math.max(t.maxX,e.maxX),n=Math.min(t.minY,e.minY),s=Math.max(t.maxY,e.maxY);return new xI(r,i,n,s)}else return e}static extend3(t,e){let r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),n=Math.min(t.y,e.y),s=Math.max(t.y,e.y);return new xI(r,i,n,s)}static extend4(t,e,r){return new xI(t.x-e/2,t.x+e/2,t.y-r/2,t.y+r/2)}constructor(t,e,r,i){if(this.minX=zu.normal(t),this.maxX=zu.normal(e),this.minY=zu.normal(r),this.maxY=zu.normal(i),t>e||r>i)throw new Error(`min > max is not permitted: [${t}, ${e}, ${r}, ${i}]`)}get data(){return fz[0]=this.minX,fz[1]=this.maxX,fz[2]=this.minY,fz[3]=this.maxY,fz}isContains(t){return this.isContains1(t.x,t.y)}points(){return[this.LL(),this.LR(),this.UR(),this.UL(),this.LL()]}isContains1(t,e){return this.isContainsX(t)&&this.isContainsY(e)}isContains2(t,e){return this.isContainsX1(t)&&this.isContainsY1(e)}isContainsX(t){return t>=this.minX&&t<=this.maxX}isContainsX1(t){return Or.greatereq(t,this.minX)&&Or.lesseq(t,this.maxX)}isContainsY(t){return t>=this.minY&&t<=this.maxY}isContainsY1(t){return Or.greatereq(t,this.minY)&&Or.lesseq(t,this.maxY)}isIntersect(t){return!(this.maxX<t.minX||this.minX>t.maxX||this.maxY<t.minY||this.minY>t.maxY)}extendOfSize(t){return zu.positiveOr0(this.maxX-this.minX+t*2),zu.positiveOr0(this.maxY-this.minY+t*2),new xI(this.minX-t,this.maxX+t,this.minY-t,this.maxY+t)}isInside(t){return this.minX>=t.minX&&this.maxX<=t.maxX&&this.minY>=t.minY&&this.maxY<=t.maxY}isContainsBBox(t){return this.maxX>=t.maxX&&this.minX<=t.minX&&this.maxY>=t.maxY&&this.minY<=t.minY}isContainsBBox1(t){return Or.greatereq(this.maxX,t.maxX)&&Or.lesseq(this.minX,t.minX)&&Or.greatereq(this.maxY,t.maxY)&&Or.lesseq(this.minY,t.minY)}intersect(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX);if(e>r)return null;let i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY);return i>n?null:new xI(e,r,i,n)}intersection1(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX);if(Or.greater(e,r))return null;e>r&&(r=e);let i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY);return Or.greater(i,n)?null:(i>n&&(n=i),new xI(e,r,i,n))}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}UL(){return new Ft(this.minX,this.maxY)}UR(){return new Ft(this.maxX,this.maxY)}LL(){return new Ft(this.minX,this.minY)}LR(){return new Ft(this.maxX,this.minY)}center(){return new Ft(this.maxX-(this.maxX-this.minX)/2,this.maxY-(this.maxY-this.minY)/2)}area(){return this.width()*this.height()}transform(t){let e=new Bb;return e.ext2(this.LL().multiply3(t)),e.ext2(this.LR().multiply3(t)),e.ext2(this.UR().multiply3(t)),e.ext2(this.UL().multiply3(t)),e.build()}transform4(t){let e=new Bb;return e.ext2(this.LL().multiply4(t)),e.ext2(this.LR().multiply4(t)),e.ext2(this.UR().multiply4(t)),e.ext2(this.UL().multiply4(t)),e.build()}isSeparated(t){if(t==null||t==null)return!1;let e;this.minX>=t.minX?e=this.minX:e=t.minX;let r;if(this.maxX<=t.maxX?r=this.maxX:r=t.maxX,e>r)return!0;{let i;this.minY>=t.minY?i=this.minY:i=t.minY;let n;return this.maxY<=t.maxY?n=this.maxY:n=t.maxY,i>n}}relation(t){let e=0,r=0,i;this.minX>t.minX?(e++,i=this.minX):this.minX===t.minX?i=this.minX:(r++,i=t.minX);let n;if(this.maxX<t.maxX?(e++,n=this.maxX):this.maxX===t.maxX?n=this.maxX:(r++,n=t.maxX),i>n)return 2;{let s;this.minY>t.minY?(e++,s=this.minY):this.minY===t.minY?s=this.minY:(r++,s=t.minY);let a;return this.maxY<t.maxY?(e++,a=this.maxY):this.maxY===t.maxY?a=this.maxY:(r++,a=t.maxY),s>a?2:e===4?0:r===4?1:e===0&&r===0?4:i===n||s===a?6:e!==r?5:3}}zoom(t){let e=this.width(),r=this.height(),i=this.center();return t!=0&&(e/=t/2,r/=t/2),new xI(i.x-e,i.x+e,i.y-e,i.y+e)}toString(){return"BBox [minX="+this.minX+", maxX="+this.maxX+", minY="+this.minY+", maxY="+this.maxY+"]"}equals(t){return this.minY==t.minY&&this.minX==t.minX&&this.maxX==t.maxX&&this.maxY==t.maxY}extendSize(t,e){return Object.is(void 0,e)&&(e=t),xI.extend4(this.center(),this.width()+t,this.height()+e)}positionOnBBox(t,e=0){let r=this.center(),i=this.width()*e/2,n=this.height()*e/2,s=t.x-r.x,a=t.y-r.y;return s>i?a>n?sA.RT:a<-n?sA.RB:sA.RC:s<-i?a>n?sA.LT:a<-n?sA.LB:sA.LC:a>n?sA.CT:a<-n?sA.CB:sA.CC}bbox(){return this}},Gee=class Dl{static mul(t,e,r,i,n,s){let a=0,l=0;for(let c=0;c<t;c++){for(let h=0;h<r;h++){let u=h,d=0;for(let p=0;p<e;p++)d+=i[l+p]*n[u],u+=r;s[a++]=d}l+=e}}constructor(t,e,r){this.m=zu.normal(t),this.n=zu.normal(e);let i=t*e;if(r.length===i){for(let n=0;n<r.length;n++)zu.normal(r[n]);this.data=r}else throw new Error("invalid matrix size")}mul(t){if(this.n===t.m){let e=new Array(this.m*t.n);return Dl.mul(this.m,this.n,t.n,this.data,t.data,e),new Dl(this.m,t.n,e)}else throw new Error("m !== p")}toString(){let t=[];t.push("Matrix ("),t.push(this.m.toString()),t.push(" x "),t.push(this.n.toString()),t.push(")");let e=0;for(let r=0;r<this.m;r++)for(let i=0;i<this.n;i++){let n=this.data[e++].toString();i===0?(t.push(`
`),t.push("	"),t.push(n)):(t.push(", "),t.push(n))}return t.join("")}static on(t,e,r){return t*e+r}initExpandMatrix(t){let e=this.m,r=this.n,i=r*2,n=new Array(e*i);for(let s=0;s<e;s++)for(let a=0;a<i;a++)a<r?n[Dl.on(i,s,a)]=t[Dl.on(r,s,a)]:a===e+s?n[Dl.on(i,s,a)]=1:n[Dl.on(i,s,a)]=0;return n}inverseMatrix(t,e,r){for(let i=0;i<e;i++){let n=t[Dl.on(r,i,i)];for(let s=0;s<r;s++)t[Dl.on(r,i,s)]/=n}return t}getMatrixRank(t,e,r){let i=Math.min(e,r);for(let n=0;n<e;n++){if(t[Dl.on(r,n,n)]===0){let s=new Array(r),a;for(a=n;a<e;a++)if(t[Dl.on(r,a,n)]!==0){v1.arraycopy(t,Dl.on(r,a,0),s,0,r),v1.arraycopy(t,Dl.on(r,n,0),t,Dl.on(r,a,0),r),v1.arraycopy(s,0,t,Dl.on(r,n,0),r);break}a>=e&&(i-=1)}if(!(i<e))for(let s=0;s<e;s++){if(s===n)continue;let a=t[Dl.on(r,s,n)]/t[Dl.on(r,n,n)];for(let l=0;l<r;l++)t[Dl.on(r,s,l)]-=t[Dl.on(r,n,l)]*a}}return i}getInverseMatrix(){if(this.m!==this.n)throw new Error("The matrix is an "+this.m+"x"+this.n+" order matrix, non-square matrix, please check!");function t(s){return Or.lesseq(Math.abs(s),0)}let e=this.initExpandMatrix(this.data.slice(0)),r=this.n*2;function i(s,a){for(let l=0;l<r;l++){let c=e[Dl.on(r,s,l)];e[Dl.on(r,s,l)]=e[Dl.on(r,a,l)],e[Dl.on(r,a,l)]=c}}for(let s=0;s<this.m;s++){let a=Math.abs(e[Dl.on(r,s,s)]),l=s;if(t(e[Dl.on(r,s,s)]))for(let h=s+1;h<this.m;h++){if(t(e[Dl.on(r,h,s)])){Math.abs(e[Dl.on(r,h,s)])>a&&(a=Math.abs(e[Dl.on(r,h,s)]),l=h);continue}i(s,h);break}if(t(e[Dl.on(r,s,s)])){if(a===0)throw new Error("The matrix is a non-full rank matrix, please check!");console.warn("The matrix may be a non-full rank matrix, please check!"),l!==s&&i(s,l)}let c=1/e[Dl.on(r,s,s)];for(let h=0;h<r;h++)e[Dl.on(r,s,h)]*=c;for(let h=0;h<this.m;h++){if(s===h)continue;let u=e[Dl.on(r,h,s)];for(let d=s;d<r;d++)e[Dl.on(r,h,d)]-=e[Dl.on(r,s,d)]*u}}let n=[];for(let s=0;s<this.m;s++)for(let a=this.n;a<r;a++)n[Dl.on(this.n,s,a-this.n)]=e[Dl.on(r,s,a)];return new Dl(this.m,this.n,n)}getTransposeMatrix(){let t=new Array(this.data.length);for(let e=0;e<this.m;e++)for(let r=0;r<this.n;r++)t[r*this.n+e]=this.data[e*this.m+r];return new Dl(this.n,this.m,t)}hashCode(){let t=0;for(let e of this.data)t+=e;return t}equals(t){return this===t?!0:t===null?!1:t instanceof Dl?!(this.m!=t.m||this.n!=t.n||!v1.equals(this.data,t.data)):!1}},Tbt=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],ad,MNe=(ad=class extends Gee{static translate(o,t,e){return new ad([1,0,0,0,0,1,0,0,0,0,1,0,o,t,e,1])}static translate1(o){return new ad([1,0,0,0,0,1,0,0,0,0,1,0,o.x,o.y,o.z,1])}static rotateX(o){let t=Math.cos(o),e=Math.sin(o);return new ad([1,0,0,0,0,t,e,0,0,-e,t,0,0,0,0,1])}static rotateY(o){let t=Math.cos(o),e=Math.sin(o);return new ad([t,0,-e,0,0,1,0,0,e,0,t,0,0,0,0,1])}static rotateZ(o){let t=Math.cos(o),e=Math.sin(o);return new ad([t,e,0,0,-e,t,0,0,0,0,1,0,0,0,0,1])}static rotateAxis(o,t){o=o.normalize();let e=o.x,r=o.y,i=o.z,n=Math.sin(t),s=Math.cos(t);return new ad([e*e*(1-s)+s,e*r*(1-s)+i*n,e*i*(1-s)-r*n,0,e*r*(1-s)-i*n,r*r*(1-s)+s,r*i*(1-s)+e*n,0,e*i*(1-s)+r*n,r*i*(1-s)-e*n,i*i*(1-s)+s,0,0,0,0,1])}static scale(o,t=o,e=o){return new ad([o,0,0,0,0,t,0,0,0,0,e,0,0,0,0,1])}static flipX(){return new ad([1,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,1])}static flipY(){return new ad([-1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static rotateZForPoint(o,t){return o.equals1(Ft.ORIGIN)?ad.rotateZ(t):ad.translate(-o.x,-o.y,0).rotateZ(t).translate1(o.x,o.y,0)}static getMatrix4(o,t,e,r){let i=Math.cos(t),n=Math.sin(t),s=e*(o.x*i-o.y*n)+r.x,a=o.x*n+o.y*i+r.y,l=[e*i,n,0,0,-n*e,i,0,0,0,0,1,0,s,a,0,1];return new ad(l)}constructor(o=Tbt){super(4,4,o)}translate(o){return this.multiply4(ad.translate1(o))}translate1(o,t,e){return this.multiply4(ad.translate(o,t,e))}rotateX(o){return this.multiply4(ad.rotateX(o))}rotateY(o){return this.multiply4(ad.rotateY(o))}rotateZ(o){return this.multiply4(ad.rotateZ(o))}scale(o,t=o,e=o){return this.multiply4(ad.scale(o,t,e))}scale1(o){return this.multiply4(ad.scale(o.x,o.y,o.z))}setOrigin(o,t,e){return ad.translate(-o,-t,-e).multiply4(this).translate1(o,t,e)}setOrigin1(o){return this.setOrigin(o.x,o.y,o.z)}multiply4(o){let t=new Array(16);return Gee.mul(4,4,4,this.data,o.data,t),new ad(t)}getInverseMatrix(){let o=super.getInverseMatrix();return new ad(o.data)}getTransposeMatrix(){let o=super.getTransposeMatrix();return new ad(o.data)}inverse(){let o=this.getInverseMatrix();return new ad(o.data)}toMatrix3(){let o=this.data;return new Oc([o[0],o[1],0,o[4],o[5],0,o[12],o[13],1])}},ad.ORIGIN=new ad,ad);function mz(o){return wNe.normal(parseFloat(o))}var Ibt=[1,0,0,0,1,0,0,0,1],Iu,Oc=(Iu=class extends Gee{static translate(o,t){return new Iu([1,0,0,0,1,0,o,t,1])}static translate1(o){return this.translate(o.x,o.y)}static rotate(o){let t=Math.cos(o),e=Math.sin(o);return new Iu([t,e,0,-e,t,0,0,0,1])}static rotateD(o){return this.rotate(ts.toRadians(o))}static scale(o,t=o){return new Iu([o,0,0,0,t,0,0,0,1])}static scale1(o,t){return new Iu([o,0,0,0,t,0,0,0,1])}static toDOMMatrix(o){let[t,e,,r,i,,n,s]=o.data;return`matrix(${[t,e,r,i,n,s].join(",")})`}static svgTrasform(o){let t=o.split(" "),e=null;return t.forEach(r=>{r=r.trim();let i=r.trim().replace(")","").split("("),n=i[0],s=i[1].split(",");switch(n){case"translate":let a=mz(s[0]),l=mz(s[1]);e=e?e.translate(a,l):Iu.translate(a,l);break;case"rotate":let c=mz(s[0]),h=mz(s[1]),u=mz(s[2]);e=e?e.setOrigin(h,u):Iu.translate(h,u),e=e.rotateD(c);break;default:return}}),e}constructor(o=Ibt){super(3,3,o);let t=o[0],e=o[3],r=o[1],i=o[4];this.iScale=Math.sqrt(t*t+r*r),this.jScale=Math.sqrt(e*e+i*i)}isMirrored(){return this.det()<0}multiply3(o){let t=new Array(9);return Gee.mul(3,3,3,this.data,o.data,t),new Iu(t)}translate(o,t){return this.multiply3(Iu.translate(o,t))}translate1(o){return this.multiply3(Iu.translate1(o))}scale(o,t=o){return this.multiply3(Iu.scale(o,t))}scale1(o,t){return this.multiply3(Iu.scale1(o,t))}det(){return this.data[0]*this.data[4]-this.data[3]*this.data[1]}invert(){let o=this.getInverseMatrix();return new Iu(o.data)}rotateD(o){return this.multiply3(Iu.rotateD(o))}rotate(o){return this.multiply3(Iu.rotate(o))}resetOffset(){let o=this.data;return new Iu([o[0],o[1],0,o[3],o[4],0,0,0,1])}setOrigin(o,t){return Iu.translate(-o,-t).multiply3(this).translate(o,t)}setOrigin1(o){return this.setOrigin(o.x,o.y)}getInverseMatrix(){return new Iu(super.getInverseMatrix().data)}getTransposeMatrix(){let o=super.getTransposeMatrix();return new Iu(o.data)}toMatrix4(){let o=this.data;return new MNe([o[0],o[1],0,o[2],o[3],o[4],0,o[5],0,0,1,0,o[6],o[7],0,o[8]])}scaleNum(o){return!o||isNaN(o)?o:o*this.iScale}},Iu.ORIGIN=new Iu,Iu.MIRROR_Y=new Iu([1,0,0,0,-1,0,0,0,1]),Iu.MIRROR_X=new Iu([-1,0,0,0,1,0,0,0,1]),Iu.ROT_90=new Iu([0,1,0,-1,0,0,0,0,1]),Iu.ROT_N90=new Iu([0,-1,0,1,0,0,0,0,1]),Iu),Cbt=(o=>(o[o.BUTT=0]="BUTT",o[o.ROUND=1]="ROUND",o[o.SQUARE=2]="SQUARE",o))(Cbt||{}),ix=(o=>(o[o.CW=0]="CW",o[o.CCW=1]="CCW",o))(ix||{}),Xz=class{},STe=class Cz{constructor(t,e,r){this.p1=t,this.p2=e,this.p3=r}barycentre(){return Cz.barycentre(this.p1,this.p2,this.p3)}incentre(){return Cz.incentre(this.p1,this.p2,this.p3)}static barycentre(t,e,r){let i=t.x+e.x+r.x,n=t.y+e.y+r.y;return new Ft(i/3,n/3)}static incentre(t,e,r){let i=e.sub(r).length(),n=t.sub(r).length(),s=t.sub(e).length(),a=i+n+s,l=i*t.x+n*e.x+s*r.x,c=i*t.y+n*e.y+s*r.y;return new Ft(l/a,c/a)}area(){return Cz.area(this.p1,this.p2,this.p3)}static area(t,e,r){return this.area2(t.x,t.y,e.x,e.y,r.x,r.y)/2}static area2(t,e,r,i,n,s){return Math.abs(pp.crossProd2(t,e,r,i,n,s))}scale(t,e){let r=Oc.translate(-t.x,-t.y).scale(e).translate1(t),i=this.p1.multiply3(r),n=this.p2.multiply3(r),s=this.p3.multiply3(r);return new Cz(i,n,s)}scaleOnBarycentre(t){return this.scale(this.barycentre(),t)}scaleOnIncentre(t){return this.scale(this.incentre(),t)}extend(t){let e=this.incentre(),r=this.p1.add(this.p2).sub(e).scale(1/2),i=r.length(),n=Ft.ORIGIN.pointOnRays2(r,i+t).length()/i;return this.scaleOnIncentre(n)}container(t){let e=this.p3.sub(this.p1),r=this.p2.sub(this.p1),i=t.sub(this.p1),n=e.dot(e),s=e.dot(r),a=e.dot(i),l=r.dot(r),c=r.dot(i),h=1/(n*l-s*s),u=(l*a-s*c)*h;if(u<0||u>1)return!1;let d=(n*c-s*a)*h;return d<0||d>1?!1:u+d<=1}};function dee(){return{minDistance:Number.POSITIVE_INFINITY,start:null,end:null}}var wS=class rx{static getMinDistanceWithoutCross(t,e){let r=dee();return rx.minLine(t,e,r),r.minDistance}static getMinDistance(t,e){return wI(t,e)?0:this.getMinDistanceWithoutCross(t,e)}static getMinLineWithCross(t,e){let r=dee();return rx.minLine(t,e,r),new Pt(r.start,r.end)}static getMinLine(t,e){return rx.intersection(t,e)||this.getMinLineWithCross(t,e)}static getMinDistanceFromPoint(t,e){let r=dee();if(e instanceof Pt)this.point2LineMinLine(r,e,t);else if(e instanceof br)this.point2ArcMinDistance(t,e,r);else throw new Error("not support");return r.minDistance}constructor(t,e){if(this.pt1=t,this.pt2=e,this.minline=rx.intersection(t,e),this.minline)this.minDistance=0;else{let r=dee();rx.minLine(t,e,r),this.minline=new Pt(r.start,r.end),this.minDistance=r.minDistance}}getDistance(){return this.minDistance}getLine(){return this.minline}static intersection(t,e){let r=wI(t,e);if(r===0)return;let i=new Array;for(let n=0;n<r;n+=2){let s=new Ft(at[n],at[n+1]);i.push(s)}return i.length>1?new Pt(i[0],i[1]):new Pt(i[0],i[0])}static minLine(t,e,r){if(t instanceof Pt&&e instanceof Pt)return this.minDistanceForLines(t,e,r);if(t instanceof br&&e instanceof Pt)return this.minDistanceForLineAndArc(t,e,r);if(t instanceof Pt&&e instanceof br)return this.minDistanceForLineAndArc(e,t,r);if(t instanceof br&&e instanceof br)return this.minDistanceForArcs(t,e,r);throw new Error("not support")}static minDistanceForLines(t,e,r){[t.start(),t.end(),e.start(),e.end()].forEach((i,n)=>{n<2?this.point2LineMinLine(r,e,i):this.point2LineMinLine(r,t,i)})}static minDistanceForLineAndArc(t,e,r){this.point2LineMinLine(r,e,t.start()),this.point2LineMinLine(r,e,t.svgEnd);let i=rx.foot(e,t.center);e.bbox().extendOfSize(1e-8).isContains(i)&&this.point2ArcMinLine(r,t,i),this.point2ArcMinLine(r,t,e.start()),this.point2ArcMinLine(r,t,e.end())}static minDistanceForArcs(t,e,r){this.concentricArc(t,e,r),this.point2ArcMinDistance(e.start(),t,r),this.point2ArcMinDistance(e.svgEnd,t,r),this.point2ArcMinDistance(t.start(),e,r),this.point2ArcMinDistance(t.svgEnd,e,r),(AS(t,e.center)||AS(e,t.center))&&this.shortestLineForArcs(t,e,r)}static minLineForArcAndLine(t,e,r){let i=t.pointOn(r.angleD(t.center)),n=t.pointOn(t.center.angleD(r));this.arcShortestLine(t,e,r,i),this.arcShortestLine(t,e,r,n)}static arcInnerLineFootSegment(t,e,r){let i=r.distance1(t.center);if(i!==0){let n=t.rx*(r.y-t.center.y)/i+t.center.y,s=t.rx*(r.x-t.center.x)/i+t.center.x;i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=new Ft(s,n),e.end=r)}else i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=t.start(),e.end=r)}static shortestLineForArcs(t,e,r){let i=t.center.angleD(e.center),n=e.center.angleD(t.center),s=t.pointOn(i),a=t.pointOn(n),l=e.pointOn(i),c=e.pointOn(n);AS(t,s)&&(this.arcShortestLine(e,r,s,l),this.arcShortestLine(e,r,s,c)),AS(t,a)&&(this.arcShortestLine(e,r,a,l),this.arcShortestLine(e,r,a,c)),this.shortestLineForArcs1(t,e,r)}static shortestLineForArcs1(t,e,r){let i=e.start().sub(t.center).normalize(),n=e.end().sub(t.center).normalize(),s=t.start().sub(e.center).normalize(),a=t.end().sub(e.center).normalize(),l=t.center.add(i.mul(t.rx)),c=t.center.add(n.mul(t.rx)),h=e.center.add(s.mul(e.rx)),u=e.center.add(a.mul(e.rx));AS(t,l)&&Or.greater(e.start().distance2(t.center),0)&&this.arcShortestLine(t,r,e.start(),l),AS(t,c)&&Or.greater(e.end().distance2(t.center),0)&&this.arcShortestLine(t,r,e.end(),c),AS(e,h)&&Or.greater(t.start().distance2(e.center),0)&&this.arcShortestLine(e,r,t.start(),h),AS(e,u)&&Or.greater(t.end().distance2(e.center),0)&&this.arcShortestLine(e,r,t.end(),u)}static concentricArc(t,e,r){if(!(t.center.distance1(e.center)<1e-5&&t.rx===e.rx&&t.ry===e.ry))return;let i=t.start().distance1(e.svgEnd);i<r.minDistance&&(r.minDistance=i,r.start=t.start(),r.end=e.svgEnd),i=e.start().distance1(t.svgEnd),i<r.minDistance&&(r.minDistance=i,r.start=e.start(),r.end=t.svgEnd)}static point2ArcMinDistance(t,e,r){if(AS(e,t)){let i=e.pointOn(t.angleD(e.center)),n=e.pointOn(e.center.angleD(t));this.arcShortestLine(e,r,t,i),this.arcShortestLine(e,r,t,n)}else this.minLineSegment(r,e.start(),t),this.minLineSegment(r,e.svgEnd,t)}static point2ArcMinLine(t,e,r){if(AS(e,r)){let i=r.distance1(e.center);i>e.rx||i>e.ry?this.minLineForArcAndLine(e,t,r):this.arcInnerLineFootSegment(e,t,r)}}static point2LineMinLine(t,e,r){let i=rx.foot(e,r);e.bbox().extendOfSize(1e-8).isContains(i)?this.minLineSegment(t,i,r):(this.minLineSegment(t,e.start(),r),this.minLineSegment(t,e.end(),r))}static minLineSegment(t,e,r){let i=e.distance1(r);i<t.minDistance&&(t.minDistance=i,t.start=e,t.end=r)}static arcShortestLine(t,e,r,i){if(!AS(t,i))return;let n=r.distance1(i);n<e.minDistance&&(e.minDistance=n,e.start=r,e.end=i)}static foot(t,e){if(t.isPoint())return t.start();if(!Or.eq(t.b,0)&&!Or.eq(t.a,0)){let r=t.start(),i=t.direct,n=(e.x-r.x)*i.x+(e.y-r.y)*i.y;return new Ft(r.x+i.x*n,r.y+i.y*n)}else return Or.eq(t.b,0)&&!Or.eq(t.a,0)?new Ft(t.start().x,e.y):!Or.eq(t.b,0)&&Or.eq(t.a,0)?new Ft(e.x,t.start().y):e}};function AS(o,t){if(Or.eq(o.sweepAngle,360))return!0;let e=ts.regularD(t.angleD(o.center));return o.sweepAngle>0?(Or.less(e,o.startAngle)&&(e+=360),Or.greatereq(o.endAngle(),e)):(Or.greater(e,o.startAngle)&&(e-=360),Or.lesseq(o.endAngle(),e))}var Sbt=[1,10,100,1e3],A5e="http://www.w3.org/2000/svg",_5e="http://www.w3.org/1999/xlink",v5e="http://www.w3.org/XML/1998/namespace",x5e="https://easyeda.com/",DYt=(function(){var o={svg:A5e,xlink:_5e,xml:v5e,c:x5e};return o[A5e]="svg",o[_5e]="xlink",o[v5e]="xml",o[x5e]="c",o})(),b0=(function(){var o={RATLINES:9,MODEL3D:19,ALL:11,TOPSILKLAYER:3,TOPLAYER:1,TOPPASTERLAYER:5,TOPSOLDERLAYER:7,LIBBODY:99,PADSURFACE:100,BOARDOUTLINE:10,DOCUMENT:12,TOPASSEMBLY:13,MECHANICAL:15,TOPCOMPONENT:16,SUBSTRATE:18},t;for(t=21;t<53;t++)o["INNER"+(t-20)]=t;for(o.BOTTOMSILKLAYER=4,o.BOTTOMLAYER=2,o.BOTTOMPASTERLAYER=6,o.BOTTOMSOLDERLAYER=8,o.BOTTOMASSEMBLY=14,o.BOTTOMCOMPONENT=17,t=53;t<85;t++)o["BOARD"+(t-52)]=t;return o})(),wYt=(function(){var o={COPPERAREA:[1,2,21,22,23,24],PLANEZONE:[1,2,21,22,23,24],RECT:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,99],TRACK:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],PAD:[11,1,2],VIA:[11],HOLE:[11],TEXT:[3,4,1,2,7,8,12,13,14,15,21,22,23,24],ARC:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],ELLIPSE:[3,4,12,13,14,15],CIRCLE:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],DIMENSION:[3,4,12,13,14,15],FOOTPRINT:[1,2],SOLIDREGION:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,11,99,100],SVGNODE:[1,2,3,4,7,8,12,13,14,15],PROTRACTOR:[3,4,12,13,14,15],SHEET:[12,13,14,15]};o["3D"]=(function(){for(var i=[16,19,3,7,5,1],n=21;n<52;n++)i.push(n+32,n);return i.push(2,6,8,4,17),i})();var t,e,r;for(t in o)if(o.hasOwnProperty(t)&&(r=o[t],r.indexOf(21)>0&&r.indexOf(25)===-1))for(e=25;e<=52;e++)r.push(e);return o})(),Qm=(function(){var o={1:"TopLayer",2:"BottomLayer",3:"TopSilkLayer",4:"BottomSilkLayer",5:"TopPasteMaskLayer",6:"BottomPasteMaskLayer",7:"TopSolderMaskLayer",8:"BottomSolderMaskLayer",9:"Ratlines",10:"BoardOutLine",11:"Multi-Layer",12:"Document",13:"TopAssembly",14:"BottomAssembly",15:"Mechanical",16:"TopComponents",17:"BottomComponents",18:"Substrate",19:"3DModel",99:"ComponentShapeLayer",100:"LeadShapeLayer"},t;for(t=21;t<53;t++)o[t]="Inner"+(t-20);for(t=53;t<85;t++)o[t]="Substrate"+(t-52);return o})(),LYt=(function(){var o=[],t=[];for(var e in b0)if(b0.hasOwnProperty(e)){if(e.match(/^BOARD\d+/))continue;o.push(b0[e])}o.sort(),t.sort();var r={},i,n={21:"#999966",22:"#008000",23:"#00FF00",24:"#BC8E00",25:"#70DBFA",26:"#00CC66",27:"#9966FF",28:"#800080",29:"#008080",30:"#15935F",31:"#000080",32:"#00B400",33:"#2E4756",34:"#99842F",35:"#FFFFAA",36:"#99842F",37:"#2E4756",38:"#3535FF",39:"#8000BC",40:"#43AE5F",41:"#C3ECCE",42:"#728978",43:"#39503F",44:"#0C715D",45:"#5A8A80",46:"#2B937E",47:"#23999D",48:"#45B4E3",49:"#215DA1",50:"#4564D7",51:"#6969E9",52:"#9069E9"};o.forEach(function(a){switch(a){case b0.TOPLAYER:i={name:Qm[a],color:"#FF0000",darkColor:"#CC0000",visible:!0,active:!0,config:!0};break;case b0.BOTTOMLAYER:i={name:Qm[a],color:"#0000FF",darkColor:"#000080",visible:!0,active:!1,config:!0};break;case b0.TOPSILKLAYER:i={name:Qm[a],color:"#FFCC00",darkColor:"#806600",visible:!0,active:!1,config:!0};break;case b0.BOTTOMSILKLAYER:i={name:Qm[a],color:"#66CC33",darkColor:"#33661A",visible:!0,active:!1,config:!0};break;case b0.TOPPASTERLAYER:i={name:Qm[a],color:"#808080",darkColor:"#666666",visible:!0,active:!1,config:!0};break;case b0.BOTTOMPASTERLAYER:i={name:Qm[a],color:"#800000",darkColor:"#660000",visible:!0,active:!1,config:!0};break;case b0.TOPSOLDERLAYER:i={name:Qm[a],color:"#800080",darkColor:"#660066",visible:!0,active:!1,transparency:.3,config:!0};break;case b0.BOTTOMSOLDERLAYER:i={name:Qm[a],color:"#AA00FF",darkColor:"#8800CC",visible:!0,active:!1,transparency:.3,config:!0};break;case b0.RATLINES:i={name:Qm[a],color:"#6464FF",darkColor:"#5050CC",visible:!1,active:!1,config:!0};break;case b0.BOARDOUTLINE:i={name:Qm[a],color:"#FF00FF",darkColor:"#CC00CC",visible:!0,active:!1,config:!0};break;case b0.ALL:i={name:Qm[a],color:"#C0C0C0",darkColor:"#999999",visible:!0,active:!1,config:!0};break;case b0.DOCUMENT:i={name:Qm[a],color:"#FFFFFF",darkColor:"#CCCCCC",visible:!0,active:!1,config:!0};break;case b0.TOPASSEMBLY:i={name:Qm[a],color:"#33CC99",darkColor:"#33AA99",visible:!1,active:!1,config:!1};break;case b0.BOTTOMASSEMBLY:i={name:Qm[a],color:"#5555FF",darkColor:"#8888FF",visible:!1,active:!1,config:!1};break;case b0.MECHANICAL:i={name:Qm[a],color:"#F022F0",darkColor:"#F088F0",visible:!1,active:!1,config:!1};break;case b0.MODEL3D:i={name:Qm[a],color:"#66CCFF",visible:!1,active:!1,config:!1};break;case b0.LIBBODY:i={name:Qm[a],color:"#00CCCC",visible:!1,active:!1,config:!1};break;case b0.PADSURFACE:i={name:Qm[a],color:"#CC9999",visible:!1,active:!1,config:!1};break;default:a>=b0.INNER1&&a<=b0.INNER32?i={name:Qm[a],color:n[a],darkColor:s(n[a]),visible:!1,active:!1,config:!1}:i=null;break}i&&(r[a]=i)}),r.Hole={config:!0,name:"Hole",darkColor:"#222222",color:"#222222"},r.DRCError={config:!0,name:"DRCError",color:"#FAD609",darkColor:"#FAD609"};function s(a){if(typeof a!="string"||!a.match(/#?([\da-f]{6})/i))return a;var l=parseInt(RegExp.$1,16),c=.5,h=Math.min(255,Math.round((l>>16)*c)),u=Math.min(255,Math.round((l>>8&255)*c)),d=Math.min(255,Math.round((l&255)*c)),p=((h<<16)+(u<<8)+d).toString(16);return"#"+("00000"+p).substr(-6).toUpperCase()}return r})(),R5e={BLANK:0,SCH:1,PART:2,PCB:3,FOOTPRINT:4,PRJ:5,SUBPART:6,SPICESYMBOL:7,SUBCKT:8,NETLIST:9,WAVEFORM:10,SCHLIB3D:11,PHOTOVIEW:12,SCHMODULE:13,PCBMODULE:14,VIEW3D:15,PCBLIB3D:16,BLOCK_SYMBOL:17,NETFLAG:18,NETPORT:19,SHEET_SYMBOL:20,NONEELEC_SYMBOL:21,SHORT_SYMBOL:22,FOOTPRINTVIEW:23,CNCPRINTVIEW:24,PCB2D:31,PCB3D:32},MYt=(function(){var o={};for(let t in R5e)o[R5e[t]]=t;return o})(),lte=Math.PI*2,Uee=Math.PI/2,NYt=Math.sin(Math.PI/180);function Ebt(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=Sbt[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}function NNe(o,t,e){var r=o-t;return e||(e=1e-10),(r>0?r:-r)<e}function Obt(o,t,e){var r=h(o)&&h(t)&&h(e);if(!r)return console.warn("Bad arguments"),null;var i=t.x-e.x>0?t.x:e.x,n=t.y-e.y>0?t.y:e.y,s=t.x-e.x>0?e.x:t.x,a=t.y-e.y>0?e.y:t.y,l=o.x,c=o.y;return l<=i+.001&&l>=s-.001&&c<=n+.001&&c>=a-.001;function h(u){return u?(u.x=Number(u.x),u.y=Number(u.y),isNaN(u.x)||isNaN(u.y)?(console.warn("Can not convert to Number, NaN found"),!1):!0):(console.warn("Empty input!"),!1)}}function Abt(o,t,e,r,i,n){var s=(i-e)*(o-e)+(n-r)*(t-r),a=(i-e)*(i-e)+(n-r)*(n-r),l=s/a,c=e+(i-e)*l,h=r+(n-r)*l;return s<=0?Math.sqrt((o-e)*(o-e)+(t-r)*(t-r)):s>=a?Math.sqrt((o-i)*(o-i)+(t-n)*(t-n)):Math.sqrt((o-c)*(o-c)+(h-t)*(h-t))}function _bt(o,t,e){return Obt(o,t,e)?NNe((o.x-t.x)*(e.y-t.y),(e.x-t.x)*(o.y-t.y),.001):!1}var Sz=1e-4,at=new Float64Array(100);function wI(o,t){if(o instanceof Pt&&t instanceof Pt)return bE(o,t);if(o instanceof br&&t instanceof Pt)return ETe(o,t);if(o instanceof Pt&&t instanceof br)return ETe(t,o);if(o instanceof br&&t instanceof br)return BNe(o,t);if(o instanceof Xi&&t instanceof Xi)return _ee(o,t);if(o instanceof Xi&&t instanceof Pt)return _ee(o,new Xi([t.start(),t.end()]));if(o instanceof Pt&&t instanceof Xi)return _ee(new Xi([o.start(),o.end()]),t);if(o instanceof Xi&&t instanceof br)return B5e(t,o);if(o instanceof br&&t instanceof Xi)return B5e(o,t);throw new Error("not supported operation")}function vbt(o,t){let e=o.bbox();if(e.isContainsY1(t)){let r=new Pt(new Ft(e.minX-1,t),new Ft(e.maxX+1,t));return bE(r,o)>0?1:0}else return 0}function xbt(o,t){if(o.rx===o.ry){let e=o.bbox();if(e.isContainsY1(t)){let r=new Pt(new Ft(e.minX-1,t),new Ft(e.maxX+1,t));return Hee(o,r)>0?1:0}else return 0}else throw new Error("not supported operation")}function D5e(o,t){let e=o.bbox();return e.isContainsY1(t)&&_ee(new Xi([new Ft(e.minX-1,t),new Ft(e.maxX+1,t)]),o)>0?1:0}function w5e(o,t,e){return isFinite(t)&&isFinite(e)?o.isContains2(t,e):!1}function Rbt(o,t){let e=t.length(),r=pp.crossProd3(t.start(),t.end(),o.start())/e,i=pp.crossProd3(t.start(),t.end(),o.end())/e;return Math.abs(r)<1e-8||Math.abs(i)<1e-8||r*i<0}function bE(o,t){let e=o.bbox().intersection1(t.bbox());if(!e)return 0;if(o.isPoint())if(t.isPoint()){let r=e.center();return at[0]=r.x,at[1]=r.y,2}else return L5e(t,o,e);else{if(t.isPoint())return L5e(o,t,e);{let r=function(T,I){e.isContains2(T,I)&&(at[P++]=T,at[P++]=I)};if(!Rbt(o,t))return 0;let i=o.start().x,n=o.start().y,s=o.end().x,a=o.end().y,l=t.start().x,c=t.start().y,h=t.end().x,u=t.end().y,d=t.length(),p=pp.crossProd2(i,n,l,c,h,u)/d,m=pp.crossProd2(s,a,l,c,h,u)/d;if(p*m>0&&!Or.eq(p,0)&&!Or.eq(m,0))return 0;let g=o.length(),y=pp.crossProd2(l,c,i,n,s,a)/g,b=pp.crossProd2(h,u,i,n,s,a)/g;if(y*b>0&&!Or.eq(y,0)&&!Or.eq(b,0))return 0;let P=0;if(Or.eq(p,0)&&Or.eq(m,0)){let T=e.UL(),I=e.UR(),C=e.LL(),E=e.LR();if(Or.eq(e.width(),0))Or.eq(e.height(),0)?(at[P++]=T.x,at[P++]=T.y):(at[P++]=T.x,at[P++]=T.y,at[P++]=C.x,at[P++]=C.y);else if(Or.eq(e.height(),0))at[P++]=T.x,at[P++]=T.y,at[P++]=I.x,at[P++]=I.y;else{let O=STe.area2(T.x,T.y,l,c,h,u),_=STe.area2(I.x,I.y,l,c,h,u);O<_?(at[P++]=T.x,at[P++]=T.y,at[P++]=E.x,at[P++]=E.y):(at[P++]=I.x,at[P++]=I.y,at[P++]=C.x,at[P++]=C.y)}}else if(Or.eq(p,0))r(i,n);else if(Or.eq(m,0))r(s,a);else{let T=Math.abs(p/(p-m));r(i+(s-i)*T,n+(a-n)*T)}return P}}}function L5e(o,t,e){let r=t.start(),i=t.end(),n=pp.crossProd3(o.start(),o.end(),t.start()),s=pp.crossProd3(o.start(),o.end(),t.end());if(n*s<0){let a=e.center();return at[0]=a.x,at[1]=a.y,2}else if(Math.abs(n)<Math.abs(s)){if(Or.eq(n/o.length(),0))return at[0]=r.x,at[1]=r.y,2}else if(Or.eq(s/o.length(),0))return at[0]=i.x,at[1]=i.y,2;return 0}function Hee(o,t){let e=o.bbox().intersection1(t.bbox());if(e!=null){e=e.extendOfSize(Sz);let r=o.center.x,i=o.center.y,n=o.rx,s=o.rx2,a=t.start().x,l=t.start().y,c=t.end().x,h=t.end().y,u=o.center.distance1(t.start()),d=o.center.distance1(t.end()),p=Or.eq(u,n)?0:u>n?1:-1,m=Or.eq(d,n)?0:d>n?1:-1,g=0;if(p===-1&&m===-1)return 0;if(p===0&&m===0)at[g++]=a,at[g++]=l,at[g++]=c,at[g++]=h;else if(p===1&&m===1){let y=wS.foot(t,o.center),b=y.distance1(o.center);if(Or.greater(b,n))return 0;if(Or.eq(b,n))Or.eq(t.distance2(o.start()),0)?(at[g++]=o.start().x,at[g++]=o.start().y,at[g++]=o.start().x,at[g++]=o.start().y):Or.eq(t.distance2(o.end()),0)?(at[g++]=o.end().x,at[g++]=o.end().y,at[g++]=o.end().x,at[g++]=o.end().y):(at[g++]=y.x,at[g++]=y.y,at[g++]=y.x,at[g++]=y.y);else{g=kNe(r,i,a,l,c,h,g,y);let P=at[g-2],T=at[g-1];g-=2;let I=pp.distance1(r,i,P,T);if(Or.eq(I,n))at[g++]=P,at[g++]=T,at[g++]=P,at[g++]=T;else if(I<n)g=xg(s,r,i,a,l,P,T,g),g=xg(s,r,i,P,T,c,h,g);else return 0}}else if(p===-1||m===-1)g=xg(s,r,i,a,l,c,h,g);else{let y=wS.foot(t,o.center),b=y.distance1(o.center);if(Or.eq(b,n)){let P=function(C){return w5e(e,C.x,C.y)&&jp(o,C)},T=o.start(),I=o.end();if(p===0){let C=t.start();if(P(C))return at[g++]=C.x,at[g++]=C.y,at[g++]=C.x,at[g++]=C.y,g;if(P(y))return at[g++]=y.x,at[g++]=y.y,at[g++]=y.x,at[g++]=y.y,g;if(Or.eq(t.distance2(T),0)&&P(T))return at[g++]=T.x,at[g++]=T.y,at[g++]=T.x,at[g++]=T.y,g;if(Or.eq(t.distance2(I),0)&&P(I))return at[g++]=I.x,at[g++]=I.y,at[g++]=I.x,at[g++]=I.y,g;if(u<=n)g=xg(s,r,i,y.x,y.y,c,h,g),g===2&&(at[g++]=at[0],at[g++]=at[1]);else if(b<n){if(g=xg(s,r,i,y.x,y.y,c,h,g),g===2&&P(new Ft(at[0],at[1])))return at[g++]=at[0],at[g++]=at[1],g;g=xg(s,r,i,y.x,y.y,a,l,0),g===2&&(at[g++]=at[0],at[g++]=at[1])}}else{let C=t.end();if(P(C))return at[g++]=C.x,at[g++]=C.y,at[g++]=C.x,at[g++]=C.y,g;if(P(y))return at[g++]=y.x,at[g++]=y.y,at[g++]=y.x,at[g++]=y.y,g;if(Or.eq(t.distance2(T),0)&&P(T))return at[g++]=T.x,at[g++]=T.y,at[g++]=T.x,at[g++]=T.y,g;if(Or.eq(t.distance2(I),0)&&P(I))return at[g++]=I.x,at[g++]=I.y,at[g++]=I.x,at[g++]=I.y,g;if(d<=n)g=xg(s,r,i,y.x,y.y,a,l,g),g===2&&(at[g++]=at[0],at[g++]=at[1]);else if(b<n){if(g=xg(s,r,i,y.x,y.y,a,l,g),g===2&&P(new Ft(at[0],at[1])))return at[g++]=at[0],at[g++]=at[1],g;g=xg(s,r,i,y.x,y.y,c,h,0),g===2&&(at[g++]=at[0],at[g++]=at[1])}}}else if(p===0){let P=t.start();at[g++]=P.x,at[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=xg(s,r,i,y.x,y.y,c,h,g))}else{let P=t.end();at[g++]=P.x,at[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=xg(s,r,i,y.x,y.y,a,l,g))}}if(g>0){let y=0;for(let b=0;b<g;b+=2){let P=at[b],T=at[b+1];isFinite(P)&&isFinite(T)&&w5e(e,P,T)&&jp(o,new Ft(P,T))&&(at[y++]=P,at[y++]=T)}return y}else return 0}else return 0}function Dbt(o,t){if(o.bbox()){let e=o.center.x,r=o.center.y,i=o.rx2,n=t.start().x,s=t.start().y,a=t.end().x,l=t.end().y,c=o.center.distance2(t.start()),h=o.center.distance2(t.end()),u=Or.eq(c,i)?0:c>i?1:-1,d=Or.eq(h,i)?0:h>i?1:-1,p=0;if(u===-1&&d===-1)return 0;if(u===0&&d===0)at[p++]=n,at[p++]=s,at[p++]=a,at[p++]=l;else if(u===1&&d===1){let m=wS.foot(t,o.center),g=m.distance2(o.center);if(Or.greater(g,i))return 0;if(Or.eq(g,i)){let y=m.distance2(o.start()),b=m.distance2(o.end());Or.eq(y,0)?(at[p++]=o.start().x,at[p++]=o.start().y):Or.eq(b,0)?(at[p++]=o.end().x,at[p++]=o.end().y):(at[p++]=m.x,at[p++]=m.y)}else{p=kNe(e,r,n,s,a,l,p,m);let y=at[p-2],b=at[p-1],P=pp.distance2(e,r,y,b);if(p-=2,Or.eq(P,i))at[p++]=y,at[p++]=b;else if(P<i)p=xg(i,e,r,n,s,y,b,p),p=xg(i,e,r,y,b,a,l,p);else return 0}}else if(u===-1||d===-1)p=xg(i,e,r,n,s,a,l,p);else{let m=wS.foot(t,o.center);u===0?(at[p++]=t.start().x,at[p++]=t.start().y,Or.neq(m.distance2(t.start()),0)&&(n-m.x)*(a-m.x)+(s-m.y)*(l-m.y)<0&&(p=xg(i,e,r,m.x,m.y,a,l,p))):(at[p++]=t.end().x,at[p++]=t.end().y,Or.neq(m.distance2(t.end()),0)&&(n-m.x)*(a-m.x)+(s-m.y)*(l-m.y)<0&&(p=xg(i,e,r,m.x,m.y,n,s,p)))}if(p>0){let m=0;for(let g=0;g<p;g+=2){let y=at[g],b=at[g+1];isFinite(y)&&isFinite(b)&&(at[m++]=y,at[m++]=b)}return m}else return 0}else return 0}function xg(o,t,e,r,i,n,s,a){if(i==s){let T=o-(i-e)*(i-e);if(Or.greater(T,0)){let I=Math.sqrt(T),C=t-I,E=t+I,O=Math.min(r,n),_=Math.max(r,n);return C>=O&&C<=_&&(at[a++]=C,at[a++]=i),E>=O&&E<=_&&(at[a++]=E,at[a++]=i),a}}let l=pp.distance2(r,i,t,e)-o;if(l===0)return at[a++]=r,at[a++]=i,a;let c=pp.distance2(n,s,t,e)-o;if(c===0)return at[a++]=n,at[a++]=s,a;let h=r,u=i,d=n,p=s,m=NaN,g=NaN,y=Number.POSITIVE_INFINITY,b=0;for(;y!==0;){b++;let T=Math.max(Math.min(Math.abs(l)/(Math.abs(l)+Math.abs(c)),.75),.25);if(m=h+(d-h)*T,g=u+(p-u)*T,h===m&&u===g||d===m&&p===g){Math.abs(l)>Math.abs(c)?(m=d,g=p,y=c):(m=h,g=u,y=l);break}else y=pp.distance2(m,g,t,e)-o,y<0&&l>c||y>0&&l<c?(d=m,p=g,c=y):(h=m,u=g,l=y)}let P=Math.sqrt(o)-pp.distance1(m,g,t,e);return(Or.eq(0,y)||Or.eq(0,P))&&(at[a++]=m,at[a++]=g),a}function kNe(o,t,e,r,i,n,s,a){let l=pp.dotProd2(e,r,i,n,o,t),c=pp.dotProd2(i,n,e,r,o,t);if(l>=0)return at[s++]=i,at[s++]=n,s;if(c>=0)return at[s++]=e,at[s++]=r,s;if(pp.crossProd2(e,r,i,n,o,t)==0)return at[s++]=o,at[s++]=t,s;{let h=NaN,u=NaN,d=e,p=r,m=i,g=n,y=pp.distance2(e,r,o,t),b=pp.distance2(i,n,o,t),P=Number.POSITIVE_INFINITY,T=0;for(;P>0&&(T++,h=d+(m-d)*.5,u=p+(g-p)*.5,!(y==b||d==h&&p==u||m==h&&g==u));){P=pp.distance2(h,u,o,t);let I=pp.dotProd2(d,p,h,u,o,t);if(I==0)break;I<0?(m=h,g=u,b=P):(d=h,p=u,y=P)}return pp.distance2(h,u,o,t)<pp.distance2(a.x,a.y,o,t)?(at[s++]=h,at[s++]=u):(at[s++]=a.x,at[s++]=a.y),s}}function ETe(o,t){if(o.rx===o.ry)return Hee(o,t);throw new Error("not supported")}function wbt(o,t){if(o.rx===o.ry)return Dbt(o,t);throw new Error("not supported")}function BNe(o,t){if(o.bbox().intersection1(t.bbox())!=null){if(o.rx===o.ry&&t.rx===t.ry)return Lbt(o,t);throw new Error("not supported operation")}return 0}function Lbt(o,t){let e=o.center.x,r=o.center.y,i=t.center.x,n=t.center.y,s=o.rx,a=t.rx,l=o.rx2,c=t.rx2,h=o.center.distance1(t.center),u=Math.abs(s-a),d=s+a;if(Or.greater(h,d)||Or.less(h,u))return 0;if(Or.eq(u+h,0)){let p=0,m;return jp(o,t.start())&&(at[p]=t.start().x,at[p+1]=t.start().y,p+=2,m=t.start()),jp(o,t.end())&&(at[p]=t.end().x,at[p+1]=t.end().y,p+=2,m=t.end()),p===0?(jp(t,o.start())&&(at[p]=o.start().x,at[p+1]=o.start().y,p+=2),jp(t,o.end())&&(at[p]=o.end().x,at[p+1]=o.end().y,p+=2)):p===2&&(!m.equals1(o.start())&&jp(t,o.start())&&(at[p]=o.start().x,at[p+1]=o.start().y,p+=2),!m.equals1(o.end())&&jp(t,o.end())&&(at[p]=o.end().x,at[p+1]=o.end().y,p+=2)),p}else if(Or.eq(h,d)){if(M5e(o,t))return 4;let p=new Pt(o.center,t.center),m=Hee(t,p);return m=N5e(o,m),m!==0?m:(m=Hee(o,p),N5e(t,m))}else if(Or.eq(h,u)){if(M5e(o,t))return 4;if(s>a){let p=(s-a)/s;return at[0]=e+(i-e)/p,at[1]=r+(n-r)/p,k5e(o,t,2)}else{let p=(a-s)/a;return at[0]=i+(e-i)/p,at[1]=n+(r-n)/p,k5e(o,t,2)}}else{let p=(o.center.distance2(t.center)-c+l)/(h*2)/h,m=(i-e)*p+e,g=(n-r)*p+r,y=i-e,b=n-r,P=Math.max(s,a),T,I,C,E;if(Math.abs(y)<Math.abs(b)){let v=y/-b,D=g-v*m;T=m-P,I=v*T+D,C=m+P,E=v*C+D}else{let v=b/-y,D=m-v*g;I=g-P,T=v*I+D,E=g+P,C=v*E+D}let O=xg(l,e,r,T,I,m,g,0);if(O=xg(l,e,r,m,g,C,E,O),O!==4)throw new Error("cnt !== 4");let _=new Ft(at[0],at[1]),R=new Ft(at[2],at[3]);if(jp(o,_)&&jp(t,_))return jp(o,R)&&jp(t,R)?4:Qv(o.start(),t,R,_)?(at[2]=o.start().x,at[3]=o.start().y,4):Qv(o.end(),t,R,_)?(at[2]=o.end().x,at[3]=o.end().y,4):Qv(t.start(),o,R,_)?(at[2]=t.start().x,at[3]=t.start().y,4):Qv(t.end(),o,R,_)?(at[2]=t.end().x,at[3]=t.end().y,4):2;if(jp(o,R)&&jp(t,R))return Qv(o.start(),t,_,R)?(at[0]=o.start().x,at[1]=o.start().y,4):Qv(o.end(),t,_,R)?(at[0]=o.end().x,at[1]=o.end().y,4):Qv(t.start(),o,_,R)?(at[0]=t.start().x,at[1]=t.start().y,4):Qv(t.end(),o,_,R)?(at[0]=t.end().x,at[1]=t.end().y,4):(at[0]=at[2],at[1]=at[3],2);{let v=function(H,z){if(Or.eq(H.distance1(z.center),z.rx)&&jp(z,H)){if(H.distance2(_)<H.distance2(R)){if(D)return;D=!0}else{if(w)return;w=!0}at[F++]=H.x,at[F++]=H.y}},D=!1,w=!1,F=0;return v(o.start(),t),v(o.end(),t),v(t.start(),o),v(t.end(),o),F}}}function Qv(o,t,e,r){return Or.eq(o.distance1(t.center),t.rx)&&jp(t,o)&&o.distance2(e)<o.distance2(r)}function M5e(o,t){return Or.eq(t.start().distance1(o.center),o.rx)&&jp(o,t.start())?(at[0]=t.start().x,at[1]=t.start().y,at[2]=t.start().x,at[3]=t.start().y,!0):Or.eq(t.end().distance1(o.center),o.rx)&&jp(o,t.end())?(at[0]=t.end().x,at[1]=t.end().y,at[2]=t.end().x,at[3]=t.end().y,!0):Or.eq(o.start().distance1(t.center),t.rx)&&jp(t,o.start())?(at[0]=o.start().x,at[1]=o.start().y,at[2]=o.start().x,at[3]=o.start().y,!0):Or.eq(o.end().distance1(t.center),t.rx)&&jp(t,o.end())?(at[0]=o.end().x,at[1]=o.end().y,at[2]=o.end().x,at[3]=o.end().y,!0):!1}function N5e(o,t){if(t===0)return 0;let e=at[0],r=at[1];return jp(o,new Ft(e,r))?(at[0]=e,at[1]=r,at[2]=e,at[3]=r,4):0}function k5e(o,t,e){if(e===0)return 0;let r=at[0],i=at[1],n=new Ft(r,i);return jp(o,n)&&jp(t,n)?(at[0]=r,at[1]=i,at[2]=r,at[3]=i,4):0}function Uk(o,t){return Math.abs(o-t)<=1e-6}function jp(o,t){let e=o.bbox();if(t.x-e.minX>-Sz&&t.x-e.maxX<Sz&&t.y-e.minY>-Sz&&t.y-e.maxY<Sz){let r=ts.regularD(t.angleD(o.center));return Uk(r,o.startAngle)||Uk(r,o.startAngle+360)||Uk(r,o.startAngle-360)||Uk(r,o.endAngle())||Uk(r,o.endAngle()+360)||Uk(r,o.endAngle()-360)?!0:o.sweepAngle>0?(Or.less(r,o.startAngle)&&(r+=360),Or.greatereq(o.endAngle(),r)):(Or.greater(r,o.startAngle)&&(r-=360),Or.lesseq(o.endAngle(),r))}else return!1}function Mbt(o,t){let e=o[1].x-o[0].x,r=o[1].y-o[0].y,i=t[1].x-t[0].x,n=t[1].y-t[0].y;if(e===0&&i!==0||e!==0&&i===0)return!1;if(e===0&&i===0)return!0;let s=r/e,a=n/i;return NNe(s,a,Math.sin(Math.PI/180))}function Nbt(o,t,e){var r,i=+t.x,n=+t.y,s=+e.x,a=+e.y,l=+o.x,c=+o.y,h=s-i,u=a-n,d=l-i,p=c-n,m,g,y,b,P,T;return h===0&&u===0?{d:Math.sqrt(d*d+p*p),point:new Ft(i,n)}:(r=(d*h+p*u)/(h*h+u*u),r<0?{d:Math.sqrt(d*d+p*p),point:new Ft(i,n)}:r>1?(m=l-s,g=c-a,{d:Math.sqrt(m*m+g*g),point:new Ft(s,a)}):(P=i+r*h,T=n+r*u,y=l-P,b=c-T,{d:Math.sqrt(y*y+b*b),point:new Ft(P,T)}))}function RS(o,t){if(!o||!t||o.length!=t.length)return!1;let e="equals1";return!o.some((r,i)=>{let n=t[i],s=!1;return r&&n&&typeof r=="object"&&typeof n=="object"?typeof r[e]=="function"&&Bbt(r,n)?s=!r[e].call(r,n):s=!(r===n||r.toString()===n.toString()):typeof r=="number"&&typeof n=="number"?s=!(kbt(r,n)||Number.isNaN(r)&&Number.isNaN(n)):s=r!==n,s})}function kbt(o,t,e=5){return Math.abs(o-t)*Math.pow(10,e)<1}function Bbt(o,t){return!o||!t||typeof o!="object"||typeof t!="object"?o===t:o.constructor===t.constructor}var Js=new Float64Array(100);function _ee(o,t){if(o.bbox().extendOfSize(Or.eps).isSeparated(t.bbox()))return 0;let e=[[o,t]],r=(o.controls.length-1)*(t.controls.length-1)*8,i=0,n=Number.POSITIVE_INFINITY;for(;e.length!==0;){let s=function(G){D=Math.min(D,G),w=Math.max(w,G)},a=function(G,W){let L=bE(G,W);if(L===0)throw new Error("cnt === 0");for(let B=0;B<L;B+=2)s(at[B])};if(i>r){for(let G=i-2;G>=2;G-=2)for(let W=G-2;W>=0;W-=2)if(Or.eq(Js[G],Js[W])&&Or.eq(Js[G+1],Js[W+1])){Js[W]=(Js[G]+Js[W])/2,Js[W+1]=(Js[G+1]+Js[W+1])/2;for(let L=i-3;L>=G;L--)Js[L]=Js[L+2];i-=2;break}if(i>r){i=0;let G=t.start(),W=new Float64Array(8);o.getPercent(G)!==null&&(W[i++]=G.x,W[i++]=G.y);let L=t.end();o.getPercent(L)!==null&&(W[i++]=L.x,W[i++]=L.y);let B=o.start();t.getPercent(B)!==null&&(W[i++]=B.x,W[i++]=B.y);let N=o.end();return t.getPercent(N)!==null&&(W[i++]=N.x,W[i++]=N.y),at.set(W),i}}let[l,c]=e.pop(),h=l.controls,u=c.controls;if(h.length===2&&u.length===2){let G=bE(new Pt(h[0],h[1]),new Pt(u[0],u[1]));for(let W=0;W<G;W++)Js[i++]=at[W];continue}let d=h[0],p=h[h.length-1];d.equals1(p)&&(p=d.add1(1,0));let m=p.y-d.y,g=d.x-p.x,y=-m*d.x-g*d.y,b=Math.sqrt(1/(m**2+g**2));m*=b,g*=b,y*=b;let P=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(h.forEach(G=>{let W=m*G.x+g*G.y+y;W<P&&(P=W),W>T&&(T=W)}),Or.eq(P,T)){if(c.controls.length===2){let G=bE(new Pt(l.start(),l.end()),new Pt(c.start(),c.end()));for(let W=0;W<G;W++)Js[i++]=at[W];if(G!==0)continue}l=new Xi([h[0],h[h.length-1]]),h=l.controls}let I=u.map(G=>{let W=m*G.x+g*G.y+y,L=Math.abs(W);return L<n&&(n=L),W}),C=0;for(let G of I){if(Or.less(G,P))C=C|1;else if(Or.greater(G,T))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let E=0,O=0,_=p.x-d.x,R=p.y-d.y,v=Math.sqrt(1/(_**2+R**2));_*=v,R*=v;for(let G=1;G<h.length;G++){let W=h[G],L=(W.x-d.x)*_+(W.y-d.y)*R;L<E?E=L:L>O&&(O=L)}C=0;for(let G of u){let W=(G.x-d.x)*_+(G.y-d.y)*R;if(Or.less(W,E))C=C|1;else if(Or.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let D=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY;n/=2,n<=Or.eps&&(n=Or.eps),P-=n,T+=n,I.forEach((G,W)=>{G>=P&&G<=T&&s(W/(I.length-1))});let F=new Pt(new Ft(0,P),new Ft(1,P)),H=new Pt(new Ft(0,T),new Ft(1,T));for(let G=0;G<I.length-1;G++){let W=new Ft(G/(I.length-1),I[G]),L=W.y<P?1:W.y>T?2:3;for(let B=0;B<I.length;B++){let N=new Ft(B/(I.length-1),I[B]),U=N.y<P?1:N.y>T?2:3;L!==U&&(L===1?U===2?(a(new Pt(W,N),F),a(new Pt(W,N),H)):a(new Pt(W,N),F):L===2?U===1?(a(new Pt(W,N),F),a(new Pt(W,N),H)):a(new Pt(W,N),H):U===1?a(new Pt(W,N),F):a(new Pt(W,N),H))}}D!==0&&(c=c.clip(D)[1]),w!==1&&(c=c.clip((w-D)/(1-D))[0]);let z=c.bbox();if(Or.eq(z.minX,z.maxX)&&Or.eq(z.minY,z.maxY)){C=0;for(let G of c.controls){let W=(G.x-d.x)*_+(G.y-d.y)*R;if(Or.less(W,E))C=C|1;else if(Or.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C===3){let G=new Ft((z.minX+z.maxX)/2,(z.minY+z.maxY)/2);l.getPercent(G)&&(Js[i++]=G.x,Js[i++]=G.y)}continue}if(w-D>.8){let[G,W]=c.clip(.5);e.push([G,l]),e.push([W,l])}else e.push([c,l])}for(let s=0;s<i;s++)at[s]=Js[s];return i}function Fbt(o,t){if(o.bbox().extendOfSize(Or.eps).isSeparated(t.bbox()))return{cnt:0};let e=[[o,t]],r=(o.controls.length-1)*(t.controls.length-1)*8,i=0,n=Number.POSITIVE_INFINITY;for(;e.length!==0;){let s=function(G){D=Math.min(D,G),w=Math.max(w,G)},a=function(G,W){let L=bE(G,W);if(L===0)throw new Error("cnt === 0");for(let B=0;B<L;B+=2)s(at[B])};if(i>r){for(let G=i-2;G>=2;G-=2)for(let W=G-2;W>=0;W-=2)if(Or.eq(Js[G],Js[W])&&Or.eq(Js[G+1],Js[W+1])){Js[W]=(Js[G]+Js[W])/2,Js[W+1]=(Js[G+1]+Js[W+1])/2;for(let L=i-3;L>=G;L--)Js[L]=Js[L+2];i-=2;break}if(i>r){i=0;let G=new Float64Array(8),W=t.end(),L=0;o.getPercent(W)!==null&&(G[i++]=W.x,G[i++]=W.y,L=2);let B=o.end();return t.getPercent(B)!==null&&(G[i++]=B.x,G[i++]=B.y,L=L===0?1:3),at.set(G),{havOverlap:L,cnt:i}}}let[l,c]=e.pop(),h=l.controls,u=c.controls;if(h.length===2&&u.length===2){let G=bE(new Pt(h[0],h[1]),new Pt(u[0],u[1]));for(let W=0;W<G;W++)Js[i++]=at[W];continue}let d=h[0],p=h[h.length-1];d.equals1(p)&&(p=d.add1(1,0));let m=p.y-d.y,g=d.x-p.x,y=-m*d.x-g*d.y,b=Math.sqrt(1/(m**2+g**2));m*=b,g*=b,y*=b;let P=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(h.forEach(G=>{let W=m*G.x+g*G.y+y;W<P&&(P=W),W>T&&(T=W)}),Or.eq(P,T)){if(c.controls.length===2){let G=bE(new Pt(l.start(),l.end()),new Pt(c.start(),c.end()));for(let W=0;W<G;W++)Js[i++]=at[W];if(G!==0)continue}l=new Xi([h[0],h[h.length-1]]),h=l.controls}let I=u.map(G=>{let W=m*G.x+g*G.y+y,L=Math.abs(W);return L<n&&(n=L),W}),C=0;for(let G of I){if(Or.less(G,P))C=C|1;else if(Or.greater(G,T))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let E=0,O=0,_=p.x-d.x,R=p.y-d.y,v=Math.sqrt(1/(_**2+R**2));_*=v,R*=v;for(let G=1;G<h.length;G++){let W=h[G],L=(W.x-d.x)*_+(W.y-d.y)*R;L<E?E=L:L>O&&(O=L)}C=0;for(let G of u){let W=(G.x-d.x)*_+(G.y-d.y)*R;if(Or.less(W,E))C=C|1;else if(Or.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let D=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY;n/=2,n<=Or.eps&&(n=Or.eps),P-=n,T+=n,I.forEach((G,W)=>{G>=P&&G<=T&&s(W/(I.length-1))});let F=new Pt(new Ft(0,P),new Ft(1,P)),H=new Pt(new Ft(0,T),new Ft(1,T));for(let G=0;G<I.length-1;G++){let W=new Ft(G/(I.length-1),I[G]),L=W.y<P?1:W.y>T?2:3;for(let B=0;B<I.length;B++){let N=new Ft(B/(I.length-1),I[B]),U=N.y<P?1:N.y>T?2:3;L!==U&&(L===1?U===2?(a(new Pt(W,N),F),a(new Pt(W,N),H)):a(new Pt(W,N),F):L===2?U===1?(a(new Pt(W,N),F),a(new Pt(W,N),H)):a(new Pt(W,N),H):U===1?a(new Pt(W,N),F):a(new Pt(W,N),H))}}D!==0&&(c=c.clip(D)[1]),w!==1&&(c=c.clip((w-D)/(1-D))[0]);let z=c.bbox();if(Or.eq(z.minX,z.maxX)&&Or.eq(z.minY,z.maxY)){C=0;for(let G of c.controls){let W=(G.x-d.x)*_+(G.y-d.y)*R;if(Or.less(W,E))C=C|1;else if(Or.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C===3){let G=new Ft((z.minX+z.maxX)/2,(z.minY+z.maxY)/2);l.getPercent(G)&&(Js[i++]=G.x,Js[i++]=G.y)}continue}if(w-D>.8){let[G,W]=c.clip(.5);e.push([G,l]),e.push([W,l])}else e.push([c,l])}for(let s=0;s<i;s++)at[s]=Js[s];return{cnt:i}}var Vbt=class{constructor(o=Or.eps){this.eps=o}eq(o,t){return Math.abs(o-t)<=this.eps}setEps(o){this.eps=o}},gz=new Vbt;function B5e(o,t){if(o.bbox().extendOfSize(Or.eps).isSeparated(t.bbox()))return 0;let e=[[o,t]],r=(t.controls.length-1)*16,i=0;for(;e.length!==0;){if(i>r){let s=function(){for(let c=0;c<i;c+=2)for(let h=c+2;h<i;h+=2)if(!(gz.eq(Js[c],Js[h])&&gz.eq(Js[c+1],Js[h+1]))){l(Js[h],Js[h+1],a);break}function l(c,h,u){let d=!1;for(let p=0;p<u.length;p+=2)if(gz.eq(c,u[p])&&gz.eq(h,u[p+1])){d=!0;break}d||u.push(c,h)}},a=[Js[0],Js[1]];if(s(),a.length>=100&&(gz.setEps(.001),a=[Js[0],Js[1]],s(),a.length>=100))throw new Error("clearSamePoint()");i=a.length,a.forEach((l,c)=>Js[c]=l)}let n=e.pop();if(n[0]instanceof br){let s=function(H){R=Math.min(R,H),v=Math.max(v,H)},a=function(H,z){let G=bE(H,z);if(G===0)throw new Error("cnt === 0");for(let W=0;W<G;W+=2)s(at[W])},[l,c]=n,h=c.controls;if(h.length===2){let H=ETe(l,new Pt(h[0],h[1]));for(let z=0;z<H;z++)Js[i++]=at[z];continue}let u=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,p,m,g,y,b;if(Math.abs(l.sweepAngle)>359){let H=l.rx;p=l.center.add1(H,0),m=l.center.add1(-H,0),u=-H,d=H,g=0,y=1,b=-l.center.y}else{p=l.start(),m=l.end(),g=m.y-p.y,y=p.x-m.x,b=-g*p.x-y*p.y;let H=Math.sqrt(1/(g**2+y**2));g*=H,y*=H,b*=H;let z=g*l.center.x+y*l.center.y+b;l.isCCW?(d=l.rx+z,u=0):(u=z-l.rx,d=0)}let P=h.map(H=>g*H.x+y*H.y+b),T=0;for(let H of P){if(Or.less(H,u))T=T|1;else if(Or.greater(H,d))T=T|2;else{T=3;break}if(T===3)break}if(T!==3)continue;let I=0,C=0,E=m.x-p.x,O=m.y-p.y,_=Math.sqrt(1/(E**2+O**2));if(E*=_,O*=_,Math.abs(l.sweepAngle)<=180)I=0,C=(m.x-p.x)*E+(m.y-p.y)*O;else throw new Error("not support");T=0;for(let H of h){let z=(H.x-p.x)*E+(H.y-p.y)*O;if(Or.less(z,I))T=T|1;else if(Or.greater(z,C))T=T|2;else{T=3;break}if(T===3)break}if(T!==3)continue;let R=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY;u-=Or.eps,d+=Or.eps,P.forEach((H,z)=>{H>=u&&H<=d&&s(z/(P.length-1))});let D=new Pt(new Ft(0,u),new Ft(1,u)),w=new Pt(new Ft(0,d),new Ft(1,d));for(let H=0;H<P.length-1;H++){let z=new Ft(H/(P.length-1),P[H]),G=z.y<u?1:z.y>d?2:3;for(let W=0;W<P.length;W++){let L=new Ft(W/(P.length-1),P[W]),B=L.y<u?1:L.y>d?2:3;G!==B&&(G===1?B===2?(a(new Pt(z,L),D),a(new Pt(z,L),w)):a(new Pt(z,L),D):G===2?B===1?(a(new Pt(z,L),D),a(new Pt(z,L),w)):a(new Pt(z,L),w):B===1?a(new Pt(z,L),D):a(new Pt(z,L),w))}}R!==0&&(c=c.clip(R)[1]),v!==1&&(c=c.clip((v-R)/(1-R))[0]);let F=c.bbox();if(Or.eq(F.minX,F.maxX)&&Or.eq(F.minY,F.maxY)){T=0;for(let H of c.controls){let z=(H.x-p.x)*E+(H.y-p.y)*O;if(Or.less(z,I))T=T|1;else if(Or.greater(z,C))T=T|2;else{T=3;break}if(T===3)break}T===3&&(Js[i++]=(F.minX+F.maxX)/2,Js[i++]=(F.minY+F.maxY)/2);continue}v-R>.8?c.clip(.5).forEach(H=>e.push([H,l])):e.push([c,l])}else{let[s,a]=n;e.push([br.build3(a.center,a.startAngle,a.sweepAngle/2,a.rx,a.ry),s]),e.push([br.build3(a.center,a.startAngle+a.sweepAngle/2,a.sweepAngle/2,a.rx,a.ry),s])}}for(let n=0;n<i;n++)at[n]=Js[n];return i}var Gbt=class{static getSweep(o){if(o.length>2){let t=0,e=o.length;for(let n=0;n<e-1;n++){let s=o[n],a=o[n+1];t+=(a.x+s.x)*(a.y-s.y)}let r=o[0],i=o[e-1];return t+=(r.x+i.x)*(r.y-i.y),t>0}else throw new Error("Unable to determine the direction of rotation!")}static isClose(o){return!!(o.primitives.length>0&&o.primitives[0].start().equals1(o.primitives[o.primitives.length-1].end()))}};function Ubt(o){let t=o.primitives,e=t[0],r=e instanceof br?e.sweepAngle%360:null;if(t.length===1&&e instanceof br&&(Or.eq(r,0)||Or.eq(Math.abs(r),360)))return!!e.isCCW;let i=new Array;return o.points(.1,n=>{i.push(n)}),Gbt.getSweep(i)}var Hbt=class{static zoomCorner(o,t){let e=new Array,r=new Array,i=new Array;return this.getPanPrimitive(o,e,i,t),this.rearrange(e,i),this.processStart(e,i),this.getResult(e,i,r,t),r.length>0?ma.build2(r):null}static zoomPolygon(o,t){let e=new Array,r=new Array,i=new Array;return Ubt(o)&&(o=o.reverse().asClose()),this.getPanPrimitive(o,e,i,t),this.rearrange(e,i),this.processStart(e,i),this.getResult(e,i,r,t),r.length>0?ma.build2(r):null}static zoomLines(o,t){return this.zoomPolygon(ma.build2(o.primitives.concat(o.reverse().primitives)),t/2)}static getPanPrimitive(o,t,e,r){let i=o.primitives;for(let n of i){let s=this.panDistance(n,r);s!==void 0&&(t.push(s),e.push(n))}}static rearrange(o,t){let e=o.length,r=0;for(let s=0;s<e;s++){let a=t[s],l=o[s],c=s==e-1?o[0]:o[s+1];if(!(l instanceof br&&c instanceof br)&&!this.isCW(l.end(),c.start(),a.end())){if(wI(l,c)!=0){r=s==e-1?0:s+1;break}}else{r=s;break}}let i=this.start4Index(t,r),n=this.start4Index(o,r);t.length=0,o.length=0,i.forEach(s=>{t.push(s)}),n.forEach(s=>{o.push(s)})}static processStart(o,t){let e=o.length;if(e>2){let r=o[e-1],i=o[0],n=t[e-1];if(!(r instanceof br&&i instanceof br)&&!this.isCW(r.end(),i.start(),n.end())){let s=wI(r,i);for(let a=0;a<s;a+=2){let l=new Ft(at[a],at[a+1]);o[e-1]=this.generatePrimitive(r,r.start(),l),o[0]=this.generatePrimitive(i,l,i.end())}}}}static getResult(o,t,e,r){let i=o.length;for(let n=0;n<i;n++){let s=t[n],a=n===i-1?t[0]:t[n+1],l=n==i-1?0:n+1,c=l==i-1?t[0]:t[l+1],h=o[n],u=n==i-1?o[0]:o[n+1],d=l==i-1?o[0]:o[l+1];if(!(h instanceof br&&u instanceof br)&&!this.isCW(h.end(),u.start(),s.end())){let m=this.add(o,e,n,h,u,0);m=this.update(o,e,n,u,m);let g=this.generateArc(a,c,u,d,r);if(m=this.add(o,e,n,h,g,m),m=this.update(o,e,n,g,m),m>0)continue}e.push(h);let p=this.generateArc(s,a,h,u,r);p!==void 0&&e.push(p)}}static generateArc(o,t,e,r,i){if(i>0){let n=o.end(),s=t.start(),a=e.end(),l=r.start();if(a.distance2(l)>1e-8)if(n.equals(s)){let c=a.angleD(n),h=l.angleD(n);return br.build2(n,c,h,i,i,0)}else{let c=a.angleD(n),h=l.angleD(n),u=a.angleD(s),d=l.angleD(s),p=br.build2(n,c,h,i,i,0),m=br.build2(s,u,d,i,i,0);return p.pointOn(p.endAngle()).equals1(l)?p:m.pointOn(m.endAngle()).equals1(l)?m:p}}}static updateNews(o,t,e,r){let i=o.length,n=t==i-1?0:t+1;o[n]=this.generatePrimitive(e,r,e.end())}static add(o,t,e,r,i,n){if(n>0)return n;if(r!=null&&i!=null){let s=wI(r,i);for(let a=0;a<s;a+=2){let l=new Ft(at[a],at[a+1]);t.push(this.generatePrimitive(r,r.start(),l)),this.updateNews(o,e,i,l);break}return s}else return 0}static update(o,t,e,r,i){if(i>0)return i;let n=t.length;if(n>0&&r!=null){let s=t[n-1],a=wI(s,r);for(let l=0;l<a;l+=2){let c=new Ft(at[l],at[l+1]);t[n-1]=this.generatePrimitive(s,s.start(),c),this.updateNews(o,e,r,c)}return a}else return 0}static generatePrimitive(o,t,e){if(o instanceof Pt)return new Pt(t,e);if(o instanceof br){let r=o,i=t.angleD(r.center),n=e.angleD(r.center);return br.build2(r.center,i,n,r.rx,r.ry,r.sweep())}else throw new Error("not supported operation")}static start4Index(o,t){let e=o.length,r=new Array;for(let i=t;i<e;i++)r.push(o[i]);for(let i=0;i<t;i++)r.push(o[i]);return r}static isCW(o,t,e){let r=new Pt(e,o),i=new Pt(e,t),n=r.end().x-r.start().x,s=r.end().y-r.start().y,a=i.end().x-i.start().x,l=i.end().y-i.start().y;return!(n*l-s*a>0)}static panDistance(o,t){if(o instanceof Pt){if(o.isPoint())return;{let e=o.panDistance(t);return e.length()>1e-5?e:void 0}}else if(o instanceof br){let e=o;if(e.sweepAngle>0){if(e.rx-t<=0||e.ry-t<=0)return}else if(e.sweepAngle<0&&(e.rx+t<=0||e.ry+t<=0))return;return e=e.panDistance(t),e.start().distance1(e.end())>1e-5||Or.eq(Math.abs(e.sweepAngle),360)?e:void 0}else throw new Error("not supported operation")}},fo=.001,R1=fo**2;function Bn(o,t){return o.distance2(t)<R1}function TE(o,t){return Math.abs(o-t)<=1e-4}function Wbt(o,t){if(o instanceof Pt)return new Pt(o.start(),t);if(o instanceof br){let e=t.angleD(o.center);return TE(ts.regularD(o.startAngle),ts.regularD(e))?br.build3(o.center,o.startAngle,0,o.rx,o.ry):br.build2(o.center,o.startAngle,e,o.rx,o.ry,o.isCCW?1:0)}else{if(o instanceof Xi)return o.clip(o.getPercent(t,fo))[0];throw new Error("not supported operation")}}function LS(o,t=ts.toRadians(o.startAngle)){return o.isCCW?t+=Uee:t-=Uee,new Ft(Math.cos(t),Math.sin(t))}function kz(o,t=0){let e=o.controls;if(t===0){let r=e[0],i=e.slice(1).find(n=>!(n.x===r.x&&n.y===r.y));if(!i)throw Error("getTangentBezier(bezier: Bezier, t: number = 0)");return i.sub(r)}else if(t===1){let r=e[e.length-1],i=e.slice(0,-1).reverse().find(n=>!(n.x===r.x&&n.y===r.y));if(!i)throw Error("getTangentBezier(bezier: Bezier, t: number = 0)");return r.sub(i)}if(e.length===3){let[r,i,n]=e;return i.sub(r).mul(2*(1-t)).add(n.sub(i).mul(2*t)).normalize()}else{let[r,i,n,s]=e;return i.sub(r).mul(3*(1-t)**2).add(n.sub(i).mul(6*(1-t)*t)).add(s.sub(n).mul(3*t**2)).normalize()}}function nB(o,t,e){let r=o.slice(1).findIndex(n=>!(n.x===t.x&&n.y===t.y)),i=o[r+1];if(e&&(e.getPercent(i,fo)!==null||new Pt(e.start(),e.end()).distance(i)<=fo)&&(i=o[r+2]),!i)throw Error("getSecondPoint(controls: readonly Vector2[])");return i}function po(o,t){if(o instanceof Pt)return o.end().sub(o.start()).normalize();if(o instanceof br)return(t?LS(o,t.angle(o.center)):LS(o)).normalize();if(o instanceof Xi)if(o.controls.length===2){let[e,r]=o.controls;if(Bn(e,r))throw Error("equalsPP(p0, p1)");return r.sub(e).normalize()}else return(t?kz(o,o.getPercent(t,fo)):kz(o)).normalize();else throw new Error("not support")}function zbt(o,t,e){let r=[],i=t**2-4*o*e;if(i>=0){let n=-t/(2*o),s=Math.sqrt(i)/(2*o),a=n+s;if(r.push(a),i>0){let l=n-s;r.push(l)}}return r}function Ybt(o,t,e,r,i=0,n=1){let s=[],a=o*Math.pow(i,3)+t*Math.pow(i,2)+e*i+r,l=o*Math.pow(n,3)+t*Math.pow(n,2)+e*n+r,c,h;if(a*l<0)for(;Math.abs(i-n)>fo;)if(c=(i+n)/2,h=o*Math.pow(c,3)+t*Math.pow(c,2)+e*c+r,Math.abs(h)<fo){s.push(c);break}else a*h<0?n=c:l*h<0&&(i=c);else a*l===0&&(a===0&&s.push(i),l===0&&s.push(n));return s}function qPe(o,t,e){if(o instanceof Pt||t.distance2(e)<=R1)return new Pt(t,e);if(o instanceof br)return br.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?1:0);if(o instanceof Xi){let r=o.getPercent(t,fo),i=o.getPercent(e,fo);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function OTe(o){return Or.greater(o,0)&&Or.less(o,1)}function Wee(o,t,e,r){let i=o[r]-2*t[r]+e[r],n=t[r]-o[r];if(i===0)return[];let s=-n/i,a=[];return OTe(s)&&a.push(s),a}function zee(o,t,e,r,i){let n,s,a=-o[i]+3*t[i]-3*e[i]+r[i],l=2*(o[i]-2*t[i]+e[i]),c=t[i]-o[i],h=l**2-4*a*c;if(Or.lesseq(h,0))n=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;else{let d=Math.sqrt(h);n=(-l-d)/(2*a),s=(-l+d)/(2*a);let p=a*2;if(Or.lesseq(n,1)&&Or.greatereq(n,0)){let m=Number.NEGATIVE_INFINITY;for(;Or.neq(n,m);){m=n;let g=p*n+l;n=-(a*n**2+l*n+c-g*n)/g}}if(Or.lesseq(s,1)&&Or.greatereq(s,0)){let m=Number.NEGATIVE_INFINITY;for(;Or.neq(s,m);){m=s;let g=p*s+l;s=-(a*s**2+l*s+c-g*s)/g}}}let u=[];return OTe(s)&&u.push(s),OTe(n)&&u.push(n),u}function FNe(o,t){if(o.controls.length===2){let[a,l]=o.controls;Bn(a,l)||t.push(new Pt(a,l));return}let e,r;if(o.controls.length===3){let[a,l,c]=o.controls;e=Wee(a,l,c,"x"),r=Wee(a,l,c,"y")}else{let[a,l,c,h]=o.controls;e=zee(a,l,c,h,"x"),r=zee(a,l,c,h,"y")}e.sort((a,l)=>l-a),r.sort((a,l)=>l-a);let i=e.pop()||1,n=r.pop()||1,s=0;for(;i!==1||n!==1;)if(Or.eq(i,n))i=e.pop()||1,n=r.pop()||1;else if(i<n){let[a,l]=o.clip((i-s)/(1-s));s=i,t.push(a),o=l,i=e.pop()||1}else{let[a,l]=o.clip((n-s)/(1-s));s=n,t.push(a),o=l,n=r.pop()||1}t.push(o)}var jbt=1e-5,iIe=1,Xi=class Ry extends Xz{constructor(t){if(super(),this._startToEndL=null,t.length<2)throw new Error("Bezier needs at least 2 endpoints");this.controls=t.slice()}get startToEndL(){return this._startToEndL===null&&(this._startToEndL=new Pt(this.start(),this.end())),this._startToEndL}build1(t){let e=[];return lB(t,(r,i)=>(e.push(i),!0)),new Ry(e)}start(){return this.controls[0]}end(){return this.controls[this.controls.length-1]}static pointOn(t,e){if(e.length<1)throw new Error("bezier must have at least 1 point");if(e.length===1)return e[0];{let r=new Array(e.length-1);for(let i=1;i<e.length;i++){let n=e[i-1],s=e[i],a=(s.x-n.x)*t,l=(s.y-n.y)*t;r[i-1]=n.add1(a,l)}return Ry.pointOn(t,r)}}clip1(t,e,r,i){if(r.push(e[0]),i.push(e[e.length-1]),e.length<2)throw new Error("bezier clip must have at least 2 point");if(e.length===2){let n=e[0],s=e[1],a=(s.x-n.x)*t,l=(s.y-n.y)*t,c=n.add1(a,l);r.push(c),i.push(c)}else{let n=new Array(e.length-1);for(let s=1;s<e.length;s++){let a=e[s-1],l=e[s],c=(l.x-a.x)*t,h=(l.y-a.y)*t;n[s-1]=a.add1(c,h)}this.clip1(t,n,r,i)}}clip(t){let e=[],r=[];return this.clip1(t,this.controls,e,r),[new Ry(e),new Ry(r.reverse())]}greater(t,e,r){return t-e>r}less(t,e,r){return t-e<-r}eq(t,e,r){return Math.abs(t-e)<=r}eqPP(t,e,r){return!t||!e?!1:this.eq(t.x,e.x,r)&&this.eq(t.y,e.y,r)}isInRange(t,e=Or.eps){let r=this.controls.map(n=>n.y-t.y),i=0;for(let n of r){if(this.less(n,0,e))i=i|1;else if(this.greater(n,0,e))i=i|2;else{i=3;break}if(i===3)break}if(i!==3)return!1;i=0;for(let n of this.controls){let s=n.x-t.x;if(this.less(s,0,e))i=i|1;else if(this.greater(s,0,e))i=i|2;else{i=3;break}if(i===3)break}return i===3}getPercent(t,e=Or.eps){if(!this.isInRange(t,e))return null;let r=Number.POSITIVE_INFINITY,i=[[this,0,1]];for(;i.length!==0;){let n=function(y){h=Math.min(h,y),u=Math.max(u,y)},s=function(y,b){let P=bE(y,b);if(P===0)throw new Error("cnt === 0");for(let T=0;T<P;T+=2)n(at[T])},[a,l,c]=i.pop();if(this.eqPP(a.start(),t,e))return l;if(this.eqPP(a.end(),t,e))return c;let h=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,d=a.controls.map(y=>y.y-t.y);r=d.reduce((y,b)=>{let P=Math.abs(b);return P<y?P:y},r),r/=2,r<=e&&(r=e),d.forEach((y,b)=>{this.eq(y,0,e)&&n(b/(d.length-1))});let p=new Pt(new Ft(0,-r),new Ft(1,-r)),m=new Pt(new Ft(0,r),new Ft(1,r));for(let y=0;y<d.length-1;y++){let b=new Ft(y/(d.length-1),d[y]),P=this.less(b.y,0,e)?1:this.greater(b.y,0,e)?2:3;for(let T=0;T<d.length;T++){let I=new Ft(T/(d.length-1),d[T]),C=this.less(I.y,0,e)?1:this.greater(I.y,0,e)?2:3;P!==C&&(P===1?C===2?(s(new Pt(b,I),p),s(new Pt(b,I),m)):s(new Pt(b,I),p):P===2?C===1?(s(new Pt(b,I),p),s(new Pt(b,I),m)):s(new Pt(b,I),m):C===1?s(new Pt(b,I),p):s(new Pt(b,I),m))}}if(!isFinite(h)){if(Math.max(...d.map(y=>Math.abs(y)))<e*4)return(l+c)/2;continue}if(h!==0&&(a=a.clip(h)[1],l=(c-l)*h+l),u!==1){let y=(u-h)/(1-h);a=a.clip(y)[0],c=(c-l)*y+l}if(!a.isInRange(t,e))continue;let g=a.controls.reduce((y,b)=>y.ext2(b),new Bb).build1();if(this.eq(g.minX,g.maxX,e)&&this.eq(g.minY,g.maxY,e))return(l+c)/2;if(u-h>.8){let[y,b]=a.clip(.5);y.isInRange(t,e)?(i.push([y,l,(l+c)/2]),b.isInRange(t,e)&&i.push([b,(l+c)/2,c])):i.push([b,(l+c)/2,c])}else i.push([a,l,c])}return null}toBezier(){return this}toString(){return"Bezier ["+this.controls.join(" ")+"]"}bbox(){return this._bbox||(this._bbox=new Bb().ext3(this.points(.1)).build1()),this._bbox}bboxWithControls(){return this._bbox_controls||(this._bbox_controls=new Bb().ext3(this.controls).build()),this._bbox_controls}multiply3(t){let e=new Array(this.controls.length);for(let r=0;r<this.controls.length;r++){let i=this.controls[r];e[r]=i.multiply3(t)}return new Ry(e)}stroke(t,e,r,i=iIe){let n=Hbt.zoomLines(ma.build4(this.points(i)),t);return r===0?n:n.reverse()}points(t){let e=[];return this.getBezierPoints(t,r=>e.push(r)),e}getBezierPoints(t,e){if(this.controls.length===2){e(this.start()),e(this.end());return}let r=[this];for(e(this.start());r.length!==0;){let n=r.pop(),s=new Pt(n.start(),n.end());if(i(n.controls,s)<=t)e(n.end());else{let[a,l]=n.clip(.5);r.push(l,a)}}function i(n,s){let a=s.start(),l=s.end();a.equals1(l)&&(l=a.add1(1,0));let c=l.y-a.y,h=a.x-l.x,u=-c*a.x-h*a.y,d=Math.sqrt(1/(c**2+h**2));c*=d,h*=d,u*=d;let p=n.map(m=>Math.abs(c*m.x+h*m.y+u));return Math.max(...p)}}getBezierPoints3(t,e){if(this.controls.length===2){e(this.start()),e(this.end());return}let r=t*t,i=this.controls[0],n=.5;for(;n>jbt&&!(i.distance2(Ry.pointOn(n,this.controls))<=r);n*=.5);let s=Math.ceil(1/n);n=1/s,e(i);let a=0;for(let l=1;l<s;l++)a+=n,e(Ry.pointOn(a,this.controls));e(this.end())}getPointsBySlope(t){if(this.controls.length===4)return this.getPointsBySlope4(t);throw new Error("Currently, only 4 control points are supported!")}getPointsBySlope4(t){let[e,r,i,n]=this.controls,s=-3*e.x+9*r.x-9*i.x+3*n.x,a=6*e.x-12*r.x+6*i.x,l=-3*e.x+3*r.x,c=[];if(Number.isFinite(t)){let h=-3*e.y+9*r.y-9*i.y+3*n.y,u=6*e.y-12*r.y+6*i.y,d=-3*e.y+3*r.y,p=h-s*t,m=u-a*t,g=d-l*t,y=-m/(2*p),b=Math.sqrt(m**2-4*p*g)/(2*p),P=y+b;P>=0&&P<=1&&c.push(Ry.pointOn(P,this.controls));let T=y-b;T>=0&&T<=1&&c.push(Ry.pointOn(T,this.controls))}else{let h=-a/(2*s),u=Math.sqrt(a**2-4*s*l)/(2*s),d=h+u;d>=0&&d<=1&&c.push(Ry.pointOn(d,this.controls));let p=h-u;p>=0&&p<=1&&c.push(Ry.pointOn(p,this.controls))}return c}buildConverxHull(t=Or.eps){let e=[...this.controls],r=[],i=e[0],n=1;do{let s=e[n%e.length];this.eqPP(i,s,t)||r.push(new Pt(i,s)),i=s,n++}while(i!==e[0]);if(r.length===0)throw Error("buildConverxHull(diff = DoubleKit.eps)");return ma.build7(r).asClose()}getExtremePoints(t){if(!t)return s(this.controls);let e=t.start(),r=t.end(),i=r.x-e.x,n=r.y-e.y;if(Math.abs(i)<=Or.eps||Math.abs(n)<=Or.eps)return s(this.controls);{let a=n/i;if(this.controls.length===3){e.equals1(r)&&(r=e.add1(1,0));let l=r.y-e.y,c=e.x-r.x,h=-l*e.x-c*e.y,u=Math.sqrt(1/(l**2+c**2));l*=u,c*=u,h*=u;let d=this.controls.map(g=>l*g.x+c*g.y+h),p=d[0]-2*d[1]+d[2],m=d[1]-d[0]-a/2;if(p!==0){let g=-m/p;if(Or.greater(g,0)&&Or.less(g,1))return[Ry.pointOn(g,this.controls)]}}else if(this.controls.length===4)return this.getPointsBySlope(a)}return[];function s(a){let l,c;if(a.length===3){let[p,m,g]=a;l=Wee(p,m,g,"x"),c=Wee(p,m,g,"y")}else if(a.length===4){let[p,m,g,y]=a;l=zee(p,m,g,y,"x"),c=zee(p,m,g,y,"y")}l.sort((p,m)=>m-p),c.sort((p,m)=>m-p);let h=l.pop()||1,u=c.pop()||1,d=[];for(;h!==1||u!==1;)Or.eq(h,u)?(h=l.pop()||1,u=c.pop()||1):h<u?(d.push(Ry.pointOn(h,a)),h=l.pop()||1):(d.push(Ry.pointOn(u,a)),u=c.pop()||1);return d}}getToLineMaxDis2(t){let e=this.getExtremePoints(t),r=t.distance2(this.start()),i=t.distance2(this.end()),n=Math.max(r,i);return e.forEach(a=>s(t.distance2(a))),n;function s(a){n=Math.max(n,a)}}getToLineMinAndMaxDis_Controls(t){let e=t.start(),r=t.end();t.start().equals1(t.end())&&(r=e.add1(1,0));let i=r.y-e.y,n=e.x-r.x,s=-i*e.x-n*e.y,a=Math.sqrt(1/(i**2+n**2));i*=a,n*=a,s*=a;let l=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY;return this.controls.forEach(h=>{let u=i*h.x+n*h.y+s;u<l&&(l=u),u>c&&(c=u)}),{minDis:l,maxDis:c}}getPercentInLine(t){let e=[],r=[],i=this.controls,n=t.start(),s=t.end(),a=s.y-n.y,l=n.x-s.x,c=-a*n.x-l*n.y,h=Math.sqrt(1/(a**2+l**2));if(a*=h,l*=h,c*=h,a**2+l**2<=0)return e;if(i.length===3){let[u,d,p]=i,m=a*(u.x-2*d.x+p.x)+l*(u.y-2*d.y+p.y),g=2*(a*(d.x-u.x)+l*(d.y-u.y)),y=a*u.x+l*u.y+c;r=zbt(m,g,y)}else if(i.length===4){let[u,d,p,m]=i,g=m.sub(p.mul(3)).add(d.mul(3)).sub(u),y=u.sub(d.mul(2)).add(p).mul(3),b=d.sub(u).mul(3),P=u,T=a*g.x+l*g.y,I=a*y.x+l*y.y,C=a*b.x+l*b.y,E=a*P.x+l*P.y+c,O=Math.sqrt(1/(T**2+I**2));T*=O,I*=O,C*=O,E*=O,r=Ybt(T,I,C,E)}else throw Error("not support getBeizerPointInLine");return r.forEach(u=>{u>=0&&u<=1&&e.push(u)}),e}reverse(){return new Ry(this.controls.slice().reverse())}},sM,VNe=(sM=class{constructor(){this.textCache=new Map,this.numCache=new Array(20),this.boxCache=new Array(4),this.textOffsetCache=new Array(9),this.BuildLineCache=new Array(7),this.BuildTrackCache=new Array(7),this.BuildViaCache=new Array(11),this.BuildBoxCache=new Array(10),this.BuildArcCache=new Array(10),this.BuildArcTrackCache=new Array(10),this.BuildTextCache=new Array(7),this.BuildPadStyleCache=new Array(4),this.BuildPadCache=new Array(12),this.ARRAY1=new Array(1),this.ARRAY2=new Array(2),this.ARRAY3=new Array(3),this.ARRAY4=new Array(4),this.ARRAY5=new Array(5),this.ARRAY6=new Array(6),this.ARRAY7=new Array(7),this.ARRAY8=new Array(8),this.ARRAY9=new Array(9),this.ARRAY10=new Array(10),this.ARRAY11=new Array(11),this.ARRAY12=new Array(12),this.textOffsetCache[0]=Ft.ORIGIN,this.textOffsetCache[1]=new Ft(0,-.5),this.textOffsetCache[2]=new Ft(0,-1),this.textOffsetCache[3]=new Ft(-.5,0),this.textOffsetCache[4]=new Ft(-.5,-.5),this.textOffsetCache[5]=new Ft(-.5,-1),this.textOffsetCache[6]=new Ft(-1,0),this.textOffsetCache[7]=new Ft(-1,-.5),this.textOffsetCache[8]=new Ft(-1,-1)}static getCache(){return sM.instance==null&&(sM.instance=new sM),sM.instance}},sM.instance=null,sM),Pt=class cM extends Xz{constructor(t,e){super(),this._a=null,this._b=null,this._c=null,this.__bbox=null,this._hashed=null,this._direct=null,this._start=t,this._end=e}get a(){return this._a===null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._a}get b(){return this._b===null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._b}get c(){return this._c===null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._c}get hashed(){return this._hashed==null&&(this._hashed=this._hashCode()),this._hashed}get direct(){return this._direct==null&&(this._direct=this._end.sub(this._start).normalize()),this._direct}cutLine(t){if(Or.eq(this.distance(t),0)){let e=new cM(this._start,t);return e._a=this._a,e._b=this._b,e._c=this._c,e}return new cM(this._start,t)}get midPoint(){return this._start.add(this._end).mul(.5)}toBezier(){return new Xi([this._start,this._end])}_hashCode(){let t=31,e=1;return e=t*e+this._start.hashCode(),e=t*e+this._end.hashCode(),e}start(){return this._start}end(){return this._end}center(){let t=this.start(),e=this.end();return t.add(e).mul(.5)}panDistance(t){let e=this._end.x-this._start.x,r=this._end.y-this._start.y,i=this.length();e=e*t/i,r=-r*t/i;let n=new Ft(this._start.x+r,this._start.y+e),s=new Ft(this._end.x+r,this._end.y+e);return new cM(n,s)}isPoint(){return this._start.distance2(this._end)<=1e-8}length(){return this._start.distance1(this._end)}toString(){return"Line [start="+this._start+", end="+this._end+"]"}bbox(){if(this.__bbox==null){let t=VNe.getCache().boxCache;t[0]=Math.min(this._start.x,this._end.x),t[1]=Math.max(this._start.x,this._end.x),t[2]=Math.min(this._start.y,this._end.y),t[3]=Math.max(this._start.y,this._end.y),this.__bbox=new _1(t[0],t[1],t[2],t[3])}return this.__bbox}multiply3(t){return new cM(this._start.multiply3(t),this._end.multiply3(t))}hashCode(){return this.hashed}equals(t){let e=t;return this.hashed===e.hashed&&this._start.equals(e._start)&&this._end.equals(e._end)}equals1(t){let e=t;return this.hashed===e.hashed&&this._start.equals1(e._start)&&this._end.equals1(e._end)}equals2(t){let e=[this.start(),this.end()],r=[t.start(),t.end()];return RS(e,r)||RS(e,r.reverse())}stroke(t,e,r){let i,n,s;this._end.x<this._start.x?(n=this._start.x-this._end.x,s=this._start.y-this._end.y,i=this._end):(n=this._end.x-this._start.x,s=this._end.y-this._start.y,i=this._start);let a=Math.sqrt(n*n+s*s),l=t/2,c,h,u;e===2?(h=-l,u=a+l):(h=0,u=a),e===0||e===2?r===0?c=ma.build5([h,-l,h,l,u,l,u,-l]):c=ma.build5([h,l,h,-l,u,-l,u,l]):r===0?c=ma.build2([br.build3(new Ft(h,0),-90,-180,l,l),br.build3(new Ft(u,0),90,-180,l,l)]):c=ma.build2([br.build3(new Ft(h,0),90,180,l,l),br.build3(new Ft(u,0),-90,180,l,l)]);let d=Math.atan2(s,n),p=Oc.rotate(d).translate1(i);return c.asClose().multiply3(p)}points(t){return[this._start,this._end]}mirrorY(t){return new cM(this.start().mirrorY(t),this.end().mirrorY(t))}reverse(){return new cM(this._end,this._start)}inArea(t,e,r){let i=t.x,n=t.y,s=this._start,a=this._end,l=r==1,c=i-s.x,h=n-s.y,u=i-a.x,d=n-a.y,p=a.x-s.x,m=a.y-s.y,g=new Ft(-m,p).normalize(),y=p+g.x*e/2,b=m+g.y*e/2,P=y*y+b*b,T=c*c+h*h,I=u*u+d*d,C=Math.abs(c*m-h*p)/2,E=Math.sqrt(p*p+m*m)*e/4;if(C<=E&&T<=P&&I<=P){if(l)return!0;{let O=new Ft(i,n).sub(a).normalize(),_=new Ft(i,n).sub(s).normalize(),R=new Ft(g.x,g.y).cross(O),v=new Ft(g.x,g.y).cross(_);return R>=0&&v<=0}}else if(l){let O=e/2;return T<=O*O?!0:I<=O*O}else return!1}isParallel(t,e=!1){let r=Or.eq(Math.abs(this.direct.cross(t.direct)),0),i=!e||Or.greatereq(this.direct.dot(t.direct),0);return r&&i}distance2(t){return(this.a*t.x+this.b*t.y+this.c)**2/(this.a**2+this.b**2)}distance2ForPP(t){let{x:e,y:r}=t,{x:i,y:n}=this.start(),{x:s,y:a}=this.end();return((e-i)*(a-n)-(r-n)*(s-i))**2/((a-n)**2+(s-i)**2)}distance(t){return Math.abs(this.a*t.x+this.b*t.y+this.c)/Math.sqrt(this.a**2+this.b**2)}};function Xbt(o,t=.05){if(o.length<3)return o.slice();let e=o.slice(0,1),r=(n,s,a)=>Abt(n.x,n.y,s.x,s.y,a.x,a.y);for(;;){e=o.slice(0,1);for(let n=1;n<o.length-1;n+=2)r(o[n],o[n-1],o[n+1])>t&&e.push(o[n]),e.push(o[n+1]);if(e.at(-1).equals1(o.at(-1))||e.push(o.at(-1)),o.length==e.length)break;o=e}let i=o[o.length-1];return e.push(i),e}var qbt=ibt(nbt()),$bt=class{constructor(){this.fac=new Bb,this.length=0,this.box=null,this.pt=null,this.i=0}calcBBox(o){for(this.fac.clear(),this.length=o.length,this.box=null,this.pt=null,this.i=0;this.i<this.length;this.i++)this.pt=o[this.i],this.box=this.pt.bbox(),this.fac.ext1(this.box);return this.fac.build1()}},Kbt=new $bt,ma=class Yp{constructor(t,e){this.__bbox=null,this.primitives=t,this.__bbox=e}static calcBBox(t){return Kbt.calcBBox(t)}static build1(t){let e=[],r=null;return Vee(t,(i,n)=>{let s=n.start();return r!==null&&!s.equals(r)&&e.push(new Pt(r,s)),e.push(n),r=n.end(),!0}),e.length===0&&r!=null&&e.push(new Pt(r,r)),new Yp(e)}static build2(t){return Yp.build1(CTe(t))}static build3(t){let e=[],r=null;return Vee(t,(i,n)=>(r!==null&&e.push(new Pt(r,n)),r=n,!0)),new Yp(e)}static build4(t){return this.build3(CTe(t))}static build5(t){let e=[];for(let r=0;r<t.length;r+=2)e.push(new Ft(t[r],t[r+1]));return this.build4(e)}static build6(t){return Yp.build4([t.LL(),t.LR(),t.UR(),t.UL(),t.LL()])}static build7(t){return new Yp(t)}static build8(t){let e=new Ft(t[0],t[1]),r,i=[],n,s=(a,l)=>a.length==l&&a.every(c=>typeof c=="number");for(let a=2;a<t.length;)switch(typeof t[a]=="string"?n=t[a]:a-=1,n){case"ARC":{let l=t.slice(a+1,a+4);if(!s(l,3))throw new Error("invalid rawData");let c=l[0];r=new Ft(l[1],l[2]),i.push(br.build5(e,r,c)),e=r,a+=4;break}case"L":{let l=t.slice(a+1,a+3);if(!s(l,2))throw new Error("invalid rawData");r=new Ft(l[0],l[1]),i.push(new Pt(e,r)),e=r,a+=3;break}case"C":{let l=t.slice(a+1,a+7);if(!s(l,7))throw new Error("invalid rawData");let c=new Ft(l[0],l[1]),h=new Ft(l[2],l[3]);r=new Ft(l[4],l[5]),i.push(new Xi([e,c,h,r])),e=r,a+=7;break}default:throw new Error("invalid rawData")}return Yp.build2(i)}static buildBBox(t,e=0){return e===1?Yp.build5([t.minX,t.minY,t.maxX,t.minY,t.maxX,t.maxY,t.minX,t.maxY,t.minX,t.minY]):Yp.build5([t.minX,t.minY,t.minX,t.maxY,t.maxX,t.maxY,t.maxX,t.minY,t.minX,t.minY])}static triangulate(t,e,r=1){if(t.length===1){let l=new Array;t[0].asClose().points2(r,d=>l.push(d));let c,h=l[0],u=[];for(let d=0;d<l.length-2;d+=2){let p=l[d+1],m=l[d+2],g=p.sub(h).normalize().cross(m.sub(h).normalize());if(Or.neq(g,0)){if(c===!0){if(g<0){u.length=0;break}}else if(c===!1){if(g>0){u.length=0;break}}else c=g>0;u.push(h),u.push(p),u.push(m)}l.push(h),h=m}if(u.length!==0){for(let d=0;d<u.length;d+=3)e(u[d],u[d+1],u[d+2]);return}}let i=[],n=[];t.forEach(l=>{i.length!==0&&n.push(i.length/2),l.asClose().points2(r,c=>i.push(c.x,c.y))});let s=qbt.default(i,n),a=[];for(let l=1;l<i.length;l+=2)a.push(new Ft(i[l-1],i[l]));for(let l=0;l<s.length;l+=3)e(a[s[l]],a[s[l+1]],a[s[l+2]])}lines(t,e){let r=new Array;this.points(t,n=>r.push(n));let i=r[0];for(let n=1;n<r.length;n++){let s=r[n];e(i),e(s),i=s}}triangles(t,e){Yp.triangulate([this],(...r)=>{r.forEach(i=>e(i))},t)}mirror(){let t=[];return this.primitives.forEach(e=>{if(e instanceof Pt)e=new Pt(e.start().mirror(),e.end().mirror());else if(e instanceof br)e=e.mirror();else if(e instanceof Xi){let r=e.controls.map(i=>i.mirror());e=new Xi(r)}else throw new Error("bug");t.push(e)}),new Yp(t,this.__bbox)}getPoints(t){let e=[];for(let r of this.primitives)for(let i of r.points(t))e.push(i);return e}round(t=4){let e=this.primitives.slice();for(let r=0;r<e.length;r++){let i=e[r];if(i instanceof Pt){let n=i.start().round(t),s=i.end().round(t);e[r]=new Pt(n,s)}else if(i instanceof Xi){let n=i.controls.map(s=>s.round(t));e[r]=new Xi(n)}else if(i instanceof br){let n=i.start().round(t),s=i.end().round(t),a=i.sweepAngle;e[r]=br.build5(n,s,a)}}return new Yp(e,this.__bbox)}simplify(t=.05){let e=[],r=!1,i=[],n=this.closed();if(this.primitives.length<=1)return Yp.build2(this.primitives);let s=()=>{if(i.length>2){let l=Xbt(i,t);for(let c=1;c<l.length;c++)e.push(new Pt(l[c-1],l[c]))}else e.push(new Pt(i[0],i[1]));i.length=0,r=!1};for(let l=0;l<this.primitives.length;l++){let c=this.primitives[l];c instanceof Pt?(r?i.push(c.end()):(i.length=0,i.push(c.start(),c.end()),r=!0),l===this.primitives.length-1&&s()):(r&&s(),e.push(c))}let a=new Yp(e,this.__bbox);return n&&!a.closed()&&(a=a.asClose()),a}hasBackLine(){let{primitives:t}=this,e;for(let r=0;r<t.length;r++){let i=t[r];if(i instanceof Pt){if(i.end().equals1(i.start()))continue;if(e&&(i.end().equals1(e.start())||_bt(i.end(),e.start(),e.end())))return!0;e=i}else e=null}return!1}area(t=.1){let e=0,r=this.end();return this.primitives.forEach(i=>{let n=i.start(),s=i.end();if(e+=(n.x+r.x)*(n.y-r.y),i instanceof Pt)e+=(s.x+n.x)*(s.y-n.y);else if(i instanceof br)e+=(s.x+n.x)*(s.y-n.y),e+=Math.PI*i.rx2*i.sweepAngle/180-Ft.normal(i.center,i.start(),i.end());else if(i instanceof Xi){let a=n;i.points(t).forEach(l=>{e+=(l.x+a.x)*(l.y-a.y),a=l}),e+=(s.x+a.x)*(s.y-a.y)}r=s}),e/2}closed(t){return this.primitives.length===0?!1:this.start().equals(this.end(),t)}asClose(){let t=this.primitives[0],e=this.primitives[this.primitives.length-1],r=t.start(),i=e.end();if(r.equals(i))return this;{let n=new Array;return v1.addAll(n,this.primitives),n.push(new Pt(i,r)),Yp.build2(n)}}closeEndpoint(){let t=this.primitives[0],e=this.primitives[this.primitives.length-1],r=t.start(),i=e.end();if(r.equals1(i))return this;{let n=new Array;return v1.addAll(n,this.primitives),n.push(new Pt(i,r)),new Yp(n)}}reverse(){let t=new Array(this.primitives.length);for(let e=0,r=this.primitives.length-1;r>=0;e++,r--){let i=this.primitives[r];if(i instanceof Pt)i=new Pt(i.end(),i.start());else if(i instanceof br)i=i.exchangeSweep();else if(i instanceof Xi)i=new Xi(i.controls.slice().reverse());else throw new Error("bug");t[e]=i}return new Yp(t,this.__bbox)}reverse1(){let t=new Array(this.primitives.length);for(let e=0,r=this.primitives.length-1;r>=0;e++,r--){let i=this.primitives[r];if(i instanceof Pt)i=new Pt(i.end(),i.start());else if(i instanceof br)i=i.exchangeSweep1();else if(i instanceof Xi)i=new Xi(i.controls.slice().reverse());else throw new Error("bug");t[e]=i}return new Yp(t,this.__bbox)}mirrorY(t){let e=[];return this.primitives.forEach(r=>{if(r instanceof Pt)r=r.mirrorY(t);else if(r instanceof br)r=r.mirrorY(t);else if(r instanceof Xi){let i=r.controls.map(n=>n.mirrorY(t));r=new Xi(i)}else throw new Error("bug");e.push(r)}),new Yp(e,this.__bbox)}points(t,e){if(this.primitives.length!==0){for(let r=0;r<this.primitives.length-1;r++){let i=this.primitives[r].points(t);i.pop(),i.forEach(n=>e(n))}this.primitives[this.primitives.length-1].points(t).forEach(r=>e(r))}}points1(t,e){if(this.primitives.length===0)return;for(let i=0;i<this.primitives.length-1;i++){let n=this.primitives[i],s=n instanceof br?n.points1(t):n.points(t);s.pop(),s.forEach(a=>e(a))}let r=this.primitives[this.primitives.length-1];(r instanceof br?r.points1(t):r.points(t)).forEach(i=>e(i))}points2(t,e){if(this.primitives.length===0)return;for(let i=0;i<this.primitives.length-1;i++){let n=this.primitives[i],s=n instanceof br?n.points2():n.points(t);s.pop(),s.forEach(a=>e(a))}let r=this.primitives[this.primitives.length-1];(r instanceof br?r.points2():r.points(t)).forEach(i=>e(i))}multiply3(t){let e=new Array(this.primitives.length);for(let r=0;r<this.primitives.length;r++)e[r]=this.primitives[r].multiply3(t);return Yp.build7(e)}bbox(){return this.__bbox==null&&(this.__bbox=Yp.calcBBox(this.primitives)),this.__bbox}start(){return this.primitives.length!==0?this.primitives[0].start():null}end(){return this.primitives.length!==0?this.primitives[this.primitives.length-1].end():null}isClose(t){if(this.primitives.length<=1&&!(this.primitives[0]instanceof br))return!1;{let e=this.primitives[0],r=this.primitives[this.primitives.length-1];return e.start().equals(r.end(),t)}}isEqual(t){if(t instanceof Yp&&t.primitives.length==this.primitives.length){let e=t.primitives.length;for(let r=0;r<e;r++){let i=t.primitives[r],n=this.primitives[r];if(JSON.stringify(i)!=JSON.stringify(n))return!1}return!0}return!1}equals(t){if(!t)return!1;let e=this.primitives,r=t.primitives;if(e.length!=r.length)return!1;if(t.isClose()){let i=0;for(;i<e.length;){let n=e.slice(i).concat(e.slice(0,i));if(RS(n,r)||RS(n.reverse(),r))return!0;i++}return!1}else return RS(this.primitives,t.primitives)}clone(){return Yp.build2(this.primitives)}putItem(t,e){if(!t)return!1;if(t instanceof Yp)return this.mergePolyline(t,e);let r=this.start();if(!r){this.primitives.push(t),this.__bbox=t.bbox();return}let i=this.end();if(r.equals(i,e))return!1;let n=t.start(),s=t.end(),a=!1,l=!1;if(r.equals(n,e))a=!0,l=!1;else if(r.equals(s,e))a=!1,l=!1;else if(i.equals(n,e))a=!1,l=!0;else if(i.equals(s,e))a=!0,l=!0;else return!1;return l?this.primitives.push(a?t.reverse():t):this.primitives.unshift(a?t.reverse():t),this.__bbox=_1.extend2(this.__bbox,t.bbox()),!0}mergePolyline(t,e,r=0){if(!t)return!1;let i=this.start();if(!i){this.primitives.push(...t.primitives),this.__bbox=t.bbox();return}let n=this.end();if(i.equals(n,e))return!1;let s=t.start(),a=t.end(),l=!1,c=!1;if(i.equals(s,e))l=!0,c=!1;else if(i.equals(a,e))l=!1,c=!1;else if(n.equals(s,e))l=!1,c=!0;else if(n.equals(a,e))l=!0,c=!0;else return!1;let h=l?t.reverse():t;return c?this.primitives.push(...h.primitives):this.primitives.unshift(...h.primitives),this.__bbox=_1.extend2(this.__bbox,t.bbox()),!0}deDuplicationPoint(t){let e=this.primitives[this.primitives.length-1].start(),r=this.primitives[this.primitives.length-1].end(),i=t.primitives[0].start(),n=t.primitives[0].end();if(this.primitives[this.primitives.length-1]instanceof Pt&&t.primitives[0]instanceof Pt&&Mbt([e,r],[i,n])){this.primitives.pop(),t.primitives.shift();let s=[];s.push(new Pt(e,n)),this.primitives.push(...s)}}getMaxBBoxHeightByVec(t){let e=t.normalize(),r=-1/0,i=1/0;if(this.primitives.forEach(s=>{let a=s.start().dot(e),l=s.end().dot(e);if(n(a),n(l),s instanceof br){let c=t.angleD(Ft.ORIGIN);if(s.angleIsInArc(c)){let h=s.pointOn(c).dot(e);n(h)}if(s.angleIsInArc(c+180)){let h=s.pointOn(c-180).dot(e);n(h)}}}),r-i<=0)throw new Error("getMaxBBoxHeightByVec");return r-i;function n(s){s>r&&(r=s),s<i&&(i=s)}}getWindingNum(t){let e=this.end(),r=0,{x:i,y:n}=t;for(let a of this.primitives){if(e.y>n?a.bbox().minY>n:a.bbox().maxY<=n){e=a.end();continue}if(a instanceof br&&(a.isCCW?Math.floor(a.startAngle/90)+1!==Math.ceil(a.endAngle()/90):Math.ceil(a.startAngle/90)-1!==Math.floor(a.endAngle()/90))){let l=a.startAngle,c=a.endAngle();if(a.sweepAngle>0){let h=90;for(;h<=c;)h>l&&(s(br.build3(a.center,l,h-l,a.rx,a.ry)),l=h),h+=90;l<c&&s(br.build3(a.center,l,c-l,a.rx,a.ry))}else{let h=270;for(;h>=c;)h<l&&(s(br.build3(a.center,l,h-l,a.rx,a.ry)),l=h),h-=90;l>c&&s(br.build3(a.center,l,c-l,a.rx,a.ry))}}else if(a instanceof Xi){let l=[];FNe(a,l),l.forEach(c=>s(c))}else s(a)}return r;function s(a){let l=a.start(),c=a.end();if(e.y>n!=l.y>n&&(e.x>i?l.x>i?r+=l.y>e.y?1:-1:e.y>l.y?(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)<0&&r--:(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)>0&&r++:l.x>i&&(e.y>l.y?(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)<0&&r--:(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)>0&&r++)),l.y>n!=c.y>n){if(l.x>i)if(c.x>i)r+=c.y>l.y?1:-1;else if(a instanceof Pt)l.y>c.y?(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)<0&&r--:(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)>0&&r++;else if(a instanceof br){let{center:h,isCCW:u,rx2:d}=a,p=(h.x-i)**2+(h.y-n)**2;l.y>c.y?(u?p>d:p<d)&&r--:(u?p<d:p>d)&&r++}else if(a instanceof Xi){if(D5e(a,n)===0)throw new Error("no inters");at[0]>i&&(r+=c.y>l.y?1:-1)}else throw new Error("not support!");else if(c.x>i)if(a instanceof Pt)l.y>c.y?(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)<0&&r--:(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)>0&&r++;else if(a instanceof br){let{center:h,isCCW:u,rx2:d}=a,p=(h.x-i)**2+(h.y-n)**2;l.y>c.y?(u?p>d:p<d)&&r--:(u?p<d:p>d)&&r++}else if(a instanceof Xi){if(D5e(a,n)===0)throw new Error("no inters");at[0]>i&&(r+=c.y>l.y?1:-1)}else throw new Error("not support!")}e=c}}},pee=Math.PI*2,kYt=Math.PI/2,BYt=Math.sin(Math.PI/180),Zbt=4,br=class eu extends Xz{constructor(t,e,r,i,n){super(),this._rx2=null,this._ry2=null,this._svgEnd=null,this._hashed=null,this.__bbox=null,this.rx=t,this.ry=e,this.center=r,this.startAngle=i,this.sweepAngle=n,this._start=Ft.ORIGIN,this._end=Ft.ORIGIN,this._start=this.pointOn(i),this._end=this.pointOn(i+n)}get hashed(){return this._hashed==null&&(this._hashed=this._hashCode()),this._hashed}hashCode(){return this.hashed}_hashCode(){let t=31,e=1;return e=t*e+new Ft(this.rx,this.rx).hashCode(),e=t*e+this.center.hashCode(),e=t*e+new Ft(this.startAngle,this.sweepAngle).hashCode(),e}get rx2(){return this._rx2==null&&(this._rx2=this.rx*this.rx),this._rx2}get ry2(){return this._ry2==null&&(this._ry2=this.ry*this.ry),this._ry2}get svgEnd(){return this._svgEnd==null&&(this._svgEnd=this.getSvgEnd(this.startAngle,this.sweepAngle,this._start,this._end)),this._svgEnd}getSvgEnd(t,e,r,i){let n=e>=0?-.01:.01,s=t+e;for(;(e>=0&&s>t||e<0&&s<t)&&r.distance2(i)<2e-4;)n*=2,s+=n,i=this.pointOn(s);return i}static build1(t,e,r,i,n,s){zu.positive(r),zu.positive(i);let a=t.equals(e);if(a)return new eu(r,i,t,0,n?360:0);{let l=t.x,c=-t.y,h=e.x,u=-e.y,d=s===0,p=(l-h)/2,m=(c-u)/2,g=Math.cos(0),y=Math.sin(0),b=g*p+y*m,P=-y*p+g*m;r=Math.abs(r),i=Math.abs(i);let T=r*r,I=i*i,C=b*b,E=P*P,O=n===d?-1:1,_=(T*I-T*E-I*C)/(T*E+I*C);_=_<0?0:_;let R=O*Math.sqrt(_),v=R*(r*P/i),D=R*-(i*b/r),w=(l+h)/2,F=(c+u)/2,H=w+(g*v-y*D),z=F+(y*v+g*D),G=(b-v)/r,W=(P-D)/i,L=(-b-v)/r,B=(-P-D)/i,N,U;U=Math.sqrt(G*G+W*W),N=G,O=W<0?-1:1;let k=ts.toDegrees(O*Math.acos(N/U));U=Math.sqrt((G*G+W*W)*(L*L+B*B)),N=G*L+W*B,O=G*B-W*L<0?-1:1;let V=N/U,Y;V<-1?Y=Math.acos(-1):V>1?Y=Math.acos(1):Y=Math.acos(V);let X=ts.toDegrees(O*Y);!d&&X>0?X-=360:d&&X<0&&(X+=360),zu.normal(k),zu.normal(X);let Z=p*p/T+m*m/I,Q=t.distance1(e)/2;r<Q&&i<Q&&(r*=Math.sqrt(Z),i*=Math.sqrt(Z));let ae=a?0:ts.regularD(-k),he=a?n?360:0:-X;return new eu(r,i,new Ft(H,-z),ae,he)}}static build2(t,e,r,i,n,s){zu.positive(i),zu.positive(n),zu.normal(e),zu.normal(r);let a;return e===r?(e=ts.regularD(e),r=ts.regularD(r),a=0):(e=ts.regularD(e),r=ts.regularD(r),s===1?r<=e&&(r+=360):r>=e&&(e+=360),a=r-e),new eu(i,n,t,ts.regularD(e),a)}static build3(t,e,r,i,n){return zu.positive(i),zu.positive(n),zu.normal(r),new eu(i,n,t,ts.regularD(e),r)}static build4(t,e,r,i,n,s){let a=t.angleD(r),l=e.angleD(r);return eu.build2(r,a,l,i,n,s)}static build5(t,e,r){r=ts.toRadians(r);let i=e.sub(t),n=new Ft(-i.y,i.x).normalize(),s=Math.abs(r)/2,a;if(s!=0)a=i.length()/2/Math.sin(s);else throw new Error("Can't represent circle!!!");let l=n.rotate(Ft.ORIGIN,s),c,h;r>0?(c=1,h=e.add(l.scale(a))):(c=0,h=t.sub(l.scale(a)));let u=ts.toDegrees(t.angle(h)),d=ts.toDegrees(e.angle(h));return eu.build2(h,u,d,a,a,c)}static buildCircle(t,e,r=0){return eu.build2(t,0,360,e,e,r)}start(){return this._start}end(){return this._end}isLarge(){return Math.abs(this.sweepAngle)>180}sweep(){return this.sweepAngle>=0?1:0}get isCCW(){return this.sweepAngle>=0}endAngle(){return this.startAngle+this.sweepAngle}pointOn(t){t=ts.regularD(t);let e=this.rx,r=this.ry;if(t===0)return this.center.add1(e,0);if(t===90)return this.center.add1(0,r);if(t===180)return this.center.add1(-e,0);if(t===270)return this.center.add1(0,-r);{let i=this.rx2,n=this.ry2,s=Math.tan(ts.toRadians(t)),a=s*s,l=Math.sqrt(i*n/(i+n/a)),c=Math.sqrt(i*n/(n+i*a));return t>90&&t<270&&(c=-c),t>180&&t<360&&(l=-l),isNaN(c)&&(c=0),isNaN(l)&&(l=0),this.center.add1(c,l)}}exchangeSweep(){return eu.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,this.rx,this.ry)}exchangeSweepAndStart(){return eu.build1(this.end(),this.start(),this.rx,this.ry,this.isLarge(),this.sweepAngle>=0?0:1)}exchangeSweep1(){return eu.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle+.01,this.rx,this.ry)}mirrorY(t){let e=this.start(),r=this.end();return e.equals(r)?eu.build3(this.center.mirrorY(),0,360,this.rx,this.ry):eu.build1(e.mirrorY(t),r.mirrorY(t),this.rx,this.ry,this.isLarge(),this.sweepAngle>=0?0:1)}mirror(t=Ft.ORIGIN){let e=this.start(),r=this.end();return e.equals(r)?eu.build3(this.center.mirror(t),0,360,this.rx,this.ry):eu.build1(e.mirror(t),r.mirror(t),this.rx,this.ry,this.isLarge(),this.sweep())}sectorArea(){return Math.abs(this.sweepAngle)/360*Math.PI*this.rx*this.ry}area(){let t=STe.area(this.center,this._start,this.pointOn(this.endAngle()));return this.sectorArea()-t}multiply3(t){let e;t.isMirrored()?e=-this.sweepAngle:e=this.sweepAngle;let r;return t.equals(Oc.ROT_90)?r=ts.regularD(this.startAngle+90):t.equals(Oc.ROT_N90)?r=ts.regularD(this.startAngle-90):r=ts.transformD(this.startAngle,t),eu.build3(this.center.multiply3(t),r,e,t.iScale*this.rx,t.iScale*this.ry)}angleIsInArc(t){return t=ts.regularD(t),this.sweepAngle>0?(t<this.startAngle&&(t+=360),this.endAngle()>t):(t>this.startAngle&&(t-=360),this.endAngle()<t)}toBezier(){if(Math.abs(this.sweepAngle)>90)throw new Error("not support!");let t=this.start(),e=this.end(),r=ts.toRadians(this.sweepAngle)/2,i=4/3*(1-Math.cos(r))/Math.sin(r)*this.rx;return new Xi([t,t.add(new Ft(i,0).multiply3(Oc.rotateD(this.startAngle+90))),e.add(new Ft(i,0).multiply3(Oc.rotateD(this.endAngle()-90))),e])}toBezier2(){let t=[];r(this,90);let e=[];return t.forEach(i=>e.push(i.toBezier())),e;function r(i,n){if(Math.abs(i.sweepAngle)>n){let s=i.sweepAngle/2;r(eu.build3(i.center,i.startAngle,s,i.rx,i.ry),n),r(eu.build3(i.center,i.startAngle+s,s,i.rx,i.ry),n)}else t.push(i)}}buildBBox(){let t=VNe.getCache().boxCache,e=this.startAngle+this.sweepAngle;if(t[0]=Math.min(this._start.x,this._end.x),t[1]=Math.max(this._start.x,this._end.x),t[2]=Math.min(this._start.y,this._end.y),t[3]=Math.max(this._start.y,this._end.y),this.sweepAngle>0){let r=0;for(;r<e;){if(r>this.startAngle){let i=this.pointOn(r);t[0]=Math.min(t[0],i.x),t[1]=Math.max(t[1],i.x),t[2]=Math.min(t[2],i.y),t[3]=Math.max(t[3],i.y)}r+=90}}else if(this.sweepAngle<0){let r=360;for(;r>e;){if(r<this.startAngle){let i=this.pointOn(r);t[0]=Math.min(t[0],i.x),t[1]=Math.max(t[1],i.x),t[2]=Math.min(t[2],i.y),t[3]=Math.max(t[3],i.y)}r-=90}}return new _1(t[0],t[1],t[2],t[3])}bbox(){return this.__bbox==null&&(this.__bbox=this.buildBBox()),this.__bbox}length(){return Math.abs(this.rx*this.sweepAngle*Math.PI/180)}toString(){return iB.format("Arc [start=%s, end=%s, rx=%s, ry=%s, center=%s, startAngle=%s, sweepAngle=%s]",this._start,this._end,this.rx,this.ry,this.center,this.startAngle,this.sweepAngle)}stroke(t,e,r){let i=t/2,n=this.rx+i,s=this.ry+i,a=this.rx-i,l=this.ry-i,c=new Oc;a<0&&(a=-a,c=c.multiply3(Oc.MIRROR_Y)),l<0&&(l=-l,c=c.multiply3(Oc.MIRROR_X)),a===0&&(a=.001),l===0&&(l=.001),c=c.setOrigin1(this.center);let h,u;switch(r===this.sweep()?(h=eu.build3(this.center,this.startAngle,this.sweepAngle,n,s),u=eu.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,a,l)):(h=eu.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,n,s),u=eu.build3(this.center,this.startAngle,this.sweepAngle,a,l)),u=u.multiply3(c),e){case 1:{let d=r===1?180:-180,p=r===this.sweep()?this.pointOn(this.endAngle()):this.pointOn(this.startAngle),m=r===this.sweep()?this.pointOn(this.startAngle):this.pointOn(this.endAngle()),g=h.pointOn(h.endAngle()).angleD(p),y=u.pointOn(u.endAngle()).angleD(m);return ma.build2([h,eu.build3(p,g,d,i,i),u,eu.build3(m,y,d,i,i)])}default:return ma.build2([h,u])}}points2(){let t=Math.ceil(Math.abs(this.sweepAngle)/Zbt),e=this.sweepAngle/t,r=[this._start];for(let i=1;i<t;i++)r.push(this.pointOn(this.startAngle+e*i));return r.push(this._end),r}points1(t){let e=Math.max(this.rx,this.ry);if(e<=t)return[this.start(),this.svgEnd];let r=(e-t)/e,i=Math.ceil(Math.abs(this.sweepAngle/ts.toDegrees(Math.acos(r))/2)),n=new Array(i+1),s=this.sweepAngle/i,a=this.startAngle;for(let l=0;l<=i;l++,a+=s)n[l]=this.pointOn(a);return n}points(t){let e=Math.max(this.rx,this.ry);if(t=Math.abs(t),e<=t)return[this.start(),this.svgEnd];t=Math.max(t,e*1e-5),t=Math.min(t,e*(1-Math.SQRT1_2));let r=(e-t)/e,i=Math.ceil(Math.abs(this.sweepAngle/ts.toDegrees(Math.acos(r))/2));i=Math.max(i,2);let n=new Array(i+1),s=this.sweepAngle/i,a=this.startAngle+s;n[0]=this.start();for(let l=1;l<i;l++,a+=s)n[l]=this.pointOn(a);return n[i]=this.end(),n}panDistance(t){return this.sweepAngle>0?new eu(this.rx-t,this.ry-t,this.center,this.startAngle,this.sweepAngle):new eu(this.rx+t,this.ry+t,this.center,this.startAngle,this.sweepAngle)}panDistance1(t){if(this.sweepAngle>0){let e=this.rx-t;return e<0?(e=Math.abs(e),eu.build3(this.center,this.startAngle-180,this.sweepAngle,e,e)):new eu(e,e,this.center,this.startAngle,this.sweepAngle)}else{let e=this.rx+t;return e<0?(e=Math.abs(e),eu.build3(this.center,this.startAngle-180,this.sweepAngle,e,e)):new eu(e,e,this.center,this.startAngle,this.sweepAngle)}}get bulge(){let t=Math.abs(Ebt(this.sweepAngle,3))/180*Math.PI;return Math.tan(t/4)}get midPoint(){let t=ts.toRadians(this.startAngle),e=ts.toRadians(this.endAngle()),r=this.sweep(),i=this.center,n=this.rx;if(r==1)if(e>t){let s=(e-t)/2+t;return i.add(new Ft(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new Ft(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(e+pee-t)/2+t;return i.add(new Ft(Math.cos(s),Math.sin(s)).mul(n))}}else if(e>t){let s=(t+pee-e)/2+e;return i.add(new Ft(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new Ft(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(t-e)/2+e;return i.add(new Ft(Math.cos(s),Math.sin(s)).mul(n))}}}get svgPathData(){return[{type:"M",values:[this._start.x,this._start.y]},{type:"A",values:[this.rx,this.ry,0,this.isLarge()?1:0,this.isCCW,this._end.x,this._end.y]}]}equals(t){let e=ts.regularD(this.startAngle),r=ts.regularD(this.sweepAngle),i=ts.regularD(t.startAngle),n=ts.regularD(t.sweepAngle);return RS([this.rx,this.ry,this.center,Math.abs(r)],[t.rx,t.ry,t.center,Math.abs(n)])&&(RS([r,e],[n,i])||RS([ts.regularD(e+r)],[i]))}equals1(t){let e=ts.regularD(this.startAngle),r=ts.regularD(this.sweepAngle),i=ts.regularD(t.startAngle),n=ts.regularD(t.sweepAngle);return RS([this.rx,this.ry,this.center,Math.abs(r)],[t.rx,t.ry,t.center,Math.abs(n)])&&(RS([r,e],[n,i])||RS([ts.regularD(e+r)],[i]))}inArea(t,e){let r=t.x,i=t.y,n=this.center,s=this.rx,a=ts.toRadians(this.startAngle);this.sweep()==0&&(a=ts.toRadians(this.endAngle()));let l=ts.toRadians(this.endAngle());this.sweep()==0&&(l=ts.toRadians(this.startAngle));let c=s-e/2,h=s+e/2;var u=r-n.x,d=i-n.y,p=Math.atan2(d,u);if(p<0&&(p+=pee),a<=l&&p>=a&&p<=l||a>l&&(p>=a&&p<=pee||p>=0&&p<=l)||a==l){var m=Math.sqrt(u*u+d*d);return m<=h&&m>=c}else{var m=(h+c)/2,g=new Ft(n.x+Math.cos(a)*m,n.y+Math.sin(a)*m),y=new Ft(n.x+Math.cos(l)*m,n.y+Math.sin(l)*m),b=r-g.x,P=i-g.y,T=r-y.x,I=i-y.y;return b*b+P*P<=e*e/4?!0:T*T+I*I<=e*e/4}}isCircle(){return(Or.eq(Math.abs(this.sweepAngle),360)||this._start.equals1(this._end))&&this.rx==this.ry}reverse(){return eu.build3(this.center,this.endAngle(),-this.sweepAngle,this.rx,this.ry)}getAngle(){let t=Math.PI*2;return this.sweep()==1?(this.endAngle()-this.startAngle+t)%t:(this.startAngle-this.endAngle()+t)%t}isValid(){return this.rx>0&&this.ry>0}},GNe=new ArrayBuffer(24),$Pe=new Float64Array(GNe),Hk=new Int32Array(GNe),eg,FYt=(eg=class{static normal(o,t,e){let r=t.sub(o),i=e.sub(t);return r.cross(i)}constructor(o,t,e){this.x=zu.normal(o),this.y=zu.normal(t),this.z=zu.normal(e),$Pe[0]=o,$Pe[1]=t,$Pe[2]=e,this.hashed=Hk[0]^Hk[1]^Hk[2]^Hk[3]^Hk[4]^Hk[5]}isZeroVector(){return this.x===0&&this.y===0&&this.z===0}hashCode(){return this.hashed}equals(o){return o instanceof eg?o.x===this.x&&o.y===this.y&&o.z===this.z:!1}cross(o){return new eg(this.y*o.z-this.z*o.y,this.z*o.x-this.x*o.z,this.x*o.y-this.y*o.x)}dot(o){return this.x*o.x+this.y*o.y+this.z*o.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}normalize(){var o=this.length();return new eg(this.x/o,this.y/o,this.z/o)}sub(o){return new eg(this.x-o.x,this.y-o.y,this.z-o.z)}add(o){return new eg(this.x+o.x,this.y+o.y,this.z+o.z)}scale(o){return new eg(this.x*o,this.y*o,this.z*o)}neg(){return new eg(-this.x,-this.y,-this.z)}multiply4(o){var t=this.x*o.data[0]+this.y*o.data[4]+this.z*o.data[8]+o.data[12],e=this.x*o.data[1]+this.y*o.data[5]+this.z*o.data[9]+o.data[13],r=this.x*o.data[2]+this.y*o.data[6]+this.z*o.data[10]+o.data[14],i=this.x*o.data[3]+this.y*o.data[7]+this.z*o.data[11]+o.data[15];return i!=0?new eg(t/i,e/i,r/i):new eg(t,e,r)}rotate(o,t){return this.multiply4(MNe.rotateAxis(o,t))}toVector2(){return new Ft(this.x,this.y)}},eg.ORIGIN=new eg(0,0,0),eg.X_UNIT_VECTOR=new eg(1,0,0),eg.Y_UNIT_VECTOR=new eg(0,1,0),eg.Z_UNIT_VECTOR=new eg(0,0,1),eg),fp=class Kk{static build(t){return t instanceof ma?new Kk([new X0([t])]):t instanceof X0?new Kk([t]):t}static buildByPolygon(t){return t?new Kk([t]):new Kk([])}static buildByStroke(t,e,r=1,i){return this.buildByPolygon(X0.buildByStroke(t,e,r,iIe,i))}static buildCircle(t,e){return this.buildByPolygon(X0.buildCircle(t,e))}static buildRect(t){return this.buildByPolygon(X0.buildRect(t))}static buildBBox(t){return this.buildByPolygon(X0.buildBBox(t))}constructor(t){this.items=t.slice()}multiply3(t){return new Kk(this.items.map(e=>e.multiply3(t)))}bbox(){return this._bbox||(this._bbox=this.items.reduce((t,e)=>t.ext1(e.bbox()),new Bb).build1()),this._bbox}toPolylineGroups(){return this.items.map(t=>t.toPolylineGroup())}},Qh,Yl=(Qh=class{static isHexFormate(o){return!o||typeof o!="string"?!1:/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(o)}static of1(o){return this.of2(o>>16&255,o>>8&255,o&255)}static of2(o,t,e,r=255){return new Qh(o/255,t/255,e/255,r/255)}static of3(o){o.startsWith("#")&&(o=o.substr(1));let t=o.length;if(t==3)return new Qh(parseInt(o[0],16)/15,parseInt(o[1],16)/15,parseInt(o[2],16)/15);if(t==6)return new Qh(parseInt(o.substr(0,2),16)/255,parseInt(o.substr(2,2),16)/255,parseInt(o.substr(4,2),16)/255);if(t==8)return new Qh(parseInt(o.substr(0,2),16)/255,parseInt(o.substr(2,2),16)/255,parseInt(o.substr(4,2),16)/255,parseInt(o.substr(6,2),16)/255);throw new Error("invalid color string")}static of4(o){let t=parseInt(o.r*255+"").toString(16),e=parseInt(o.g*255+"").toString(16),r=parseInt(o.b*255+"").toString(16);return t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),("#"+t+e+r).toUpperCase()}static of5(o,t){if(o.startsWith("#")&&(o=o.substr(1)),o.length==3)return new Qh(parseInt(o[0],16)/15,parseInt(o[1],16)/15,parseInt(o[2],16)/15,t);if(o.length==6)return new Qh(parseInt(o.substr(0,2),16)/255,parseInt(o.substr(2,2),16)/255,parseInt(o.substr(4,2),16)/255,t);throw new Error("invalid color string")}static of6(o,t){return new Qh(o.r,o.g,o.b,t)}static of7(o){return o==null?null:Qh.of3(o)}constructor(o,t,e,r=1){this.r=zu.positiveOr0(o),this.g=zu.positiveOr0(t),this.b=zu.positiveOr0(e),this.alpha=r}hashCode(){return this.r+this.g+this.b+this.alpha}equals(o,t=!1){let e=this.r===o.r&&this.g===o.g&&this.b===o.b;return t?e:e&&this.alpha===o.alpha}add(o,t,e,r){return new Qh(Math.max(0,Math.min(1,this.r+o)),Math.max(0,Math.min(1,this.g+t)),Math.max(0,Math.min(1,this.b+e)),Math.max(0,Math.min(1,this.alpha+r)))}mul(o){return new Qh(Math.max(0,Math.min(1,this.r*o)),Math.max(0,Math.min(1,this.g*o)),Math.max(0,Math.min(1,this.b*o)),this.alpha)}mul1(o){return new Qh(Math.max(0,this.r*o),Math.max(0,this.g*o),Math.max(0,this.b*o),this.alpha)}getData(){return[this.r,this.g,this.b,this.alpha]}toString(){let o=(this.r*255).toString(16),t=(this.g*255).toString(16),e=(this.b*255).toString(16);return o.length<2&&(o="0"+o),t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),"#"+o.substr(0,2)+t.substr(0,2)+e.substr(0,2)}toString1(){let o=(this.r*255).toString(16),t=(this.g*255).toString(16),e=(this.b*255).toString(16),r=(this.alpha*255).toString(16);return o.length<2&&(o="0"+o),t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),"#"+o.substr(0,2)+t.substr(0,2)+e.substr(0,2)+r.substr(0,2)}toRGBA(){let o=this.r*255,t=this.g*255,e=this.b*255;return[o,t,e,this.alpha]}toRGBAString(){let o=this.r*255,t=this.g*255,e=this.b*255;return`rgba(${o},${t},${e},${this.alpha})`}isWHITE(){return this.r===1&&this.g===1&&this.b===1&&this.alpha===1}},Qh.WHITE=new Qh(1,1,1,1),Qh.BLACK=new Qh(0,0,0,1),Qh.RED=new Qh(1,0,0,1),Qh.GREEN=new Qh(0,1,0,1),Qh.BLUE=new Qh(0,0,1,1),Qh.Gray=Qh.of3("#9966ff"),Qh.Silver=Qh.of3("#D2D2D2"),Qh.Golden=Qh.of3("#DCAA14"),Qh.Pink=Qh.of3("#ffaec9"),Qh),F5e=!1,UNe=class{onRTreeBBox(o){}onResultSide(o){}onOriginSide(o){}onSplitedSide(o){}onDebugSide(o){}onSweep(o,t,e,r,i,n){}onIntersect(o,t,e){}onSegment(o,t,e,r,i,n){}onSegment1(o,t,e){if(F5e){let r=new Ft(o.getX(e),e),i=new Ft(t.getX(e),e);this.onSegment(r,o.weight,o,i,t.weight,t)}else this.onSegment(o.start,o.weight,o,t.end,t.weight,t)}onSweep1(o,t,e){if(F5e){let r=new Ft(o.getX(e),e),i=new Ft(t.getX(e),e);this.onSweep(r,o.weight,o,i,t.weight,t)}else this.onSweep(o.start,o.weight,o,t.end,t.weight,t)}},wz=class extends UNe{constructor(o){super(),this.plGrps=new Array,this.debug=o}onPolylineGroup(o,t){this.plGrps.push(o)}},qz=class{constructor(o){this.cache={},this.levels=o,this.result=new Array(o),this.weights=new Array(o),this.maxIdx=o-1,this.rule=this.decide.bind(this);let t=1;for(let e=0;e<o;e++)this.weights[e]=t,t*=50}weight(o){return this.weights[o]}decide(o){o=Math.abs(o);let t=this.cache[o];if(t===void 0){let e=o;for(let r=this.maxIdx;r>=0;r--){let i=this.weights[r],n=o/i|0,s=o%i;s>(i/2|0)?(o=i-s,n++):o=s,this.result[r]=n>0}t=this.decide1(this.result),this.cache[e]=t}return t}},Jbt=o=>o!==0,Qbt=new class extends qz{decide1(o){return o[0]||o[1]}}(2),vee=new class extends qz{decide1(o){return o[0]&&!o[1]}}(2),xee=new class extends qz{decide1(o){return o[0]&&o[1]}}(2),KPe=new class extends qz{decide1(o){return o[0]&&!o[1]||!o[0]&&o[1]}}(2),e2t=(o=>(o[o.UNMARKED=0]="UNMARKED",o[o.INSIDE=1]="INSIDE",o[o.OUTSIDE=2]="OUTSIDE",o[o.INVALID=3]="INVALID",o))(e2t||{}),dB=class Zk{constructor(t,e,r,i,n,s,a){this.inters=[],this.connect=new Array,this.previous=null,this.next=null,this.finalGrp=-1,this.trans=NaN,this.outsideWeight=0,this.insideWeight=0,this.invalidWeight=0,this._confidence=0,this._confidence_y=NaN,this._x=NaN,this._x_y=NaN,this.status=0,this.bo=t,this.shape=e,this.baseWeight=r,i.y>n.y?this.weight=-r:i.y==n.y?this.weight=0:this.weight=r,this.start=i,this.end=n,this.polyGrp=s,this.polyIndex=a,this._bbox=new Bb().ext1(e.bbox()).ext2(i).ext2(n).build1(),this.inters.push(i),this.inters.push(n);let l=31,c=1;c=l*c+this.polyGrp,c=l*c+this.polyIndex,this._hashcode=c}static rebuild(t,e,r){if(t instanceof Pt||e.distance2(r)<1e-6)return new Pt(e,r);if(t instanceof br){let i=t,n=t.bbox().center().x,s;e.y>r.y?s=n>i.center.x?0:1:s=n>i.center.x?1:0;let a=e.angleD(i.center),l=r.angleD(i.center);return br.build2(i.center,a,l,i.rx,i.ry,s)}else throw new Error("not supported operation")}updateBbox(){this._bbox=new Bb().ext2(this.start).ext2(this.end).build1()}is(t,e){return t===this.polyGrp&&e===this.polyIndex}confidence(t){if(this._confidence_y!=t){let e=this._bbox.height();if(e!==0)if(Math.abs(t-this._bbox.maxY)>5e-4&&Math.abs(t-this._bbox.minY)>5e-4){let r=1-Math.abs(2*t-this._bbox.maxY-this._bbox.minY)/e;this._confidence=r*1e4|0}else this._confidence=0;else this._confidence=1;this._confidence_y=t}return this._confidence}needCountWeight(){return this.outsideWeight+this.insideWeight+this.invalidWeight<5e3}revokeOutside(t){let e=this.confidence(t);return this.outsideWeight-=e,this.invalidWeight+=e,e}revokeInside(t){let e=this.confidence(t);return this.insideWeight-=e,this.invalidWeight+=e,e}setOutside(t){let e=this.confidence(t);return this.outsideWeight+=e,e}setInside(t){let e=this.confidence(t);return this.insideWeight+=e,e}setInvalid(t){let e=this.confidence(t);return this.invalidWeight+=e,e}prevNot0(){let t=this.previous;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.previous}return null}nextNot0(){let t=this.next;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.next}return null}getX(t){if(this.bo!==null)return(this._x_y!=t||isNaN(this._x))&&(l2t(this,t)>0?this._x=at[0]:this._x=NaN,this._x_y=t),this._x;throw new Error("not supported operation")}voteStatus(){return this.outsideWeight>this.insideWeight&&this.outsideWeight>this.invalidWeight?2:this.insideWeight>this.outsideWeight&&this.insideWeight>this.invalidWeight?1:this.invalidWeight>this.outsideWeight&&this.invalidWeight>this.insideWeight?3:0}reverse(t){if(t===2)if(this.start.y>this.end.y){let e=Zk.rebuild(this.shape,this.end,this.start),r=new Zk(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return v1.addAll(r.connect,this.connect),r}else return this;else if(t===1)if(this.start.y<this.end.y){let e=Zk.rebuild(this.shape,this.end,this.start),r=new Zk(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return v1.addAll(r.connect,this.connect),r}else return this;return this}isNeedScan(t){return this.needCountWeight()&&this.confidence(t)>0}hashCode(){return this._hashcode}equals(t){return t instanceof Zk?!(this.polyGrp!==t.polyGrp||this.polyIndex!==t.polyIndex):!1}bbox(){return this._bbox}toString(){return iB.format("(%d,%d,%d) (%d,%d,%d) %s %s",this.polyGrp,this.polyIndex,this.weight,this.outsideWeight,this.invalidWeight,this.insideWeight,this.start,this.end)}};function t2t(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minY+e.maxY)/2,n=(r.minY+r.maxY)/2;return i-n}function r2t(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minX+e.maxX)/2,n=(r.minX+r.maxX)/2;return i-n}var Wk=class{constructor(o){if(this.__bbox=null,typeof o<"u")if(o instanceof Array){this.__items=[];for(let t of o)this.add(t)}else this.__items=o,this.__bbox=o.bbox();else this.__items=[]}add(o){if(this.__items instanceof Array)this.__items.push(o),this.__bbox=_1.extend2(this.__bbox,o.bbox());else throw new Error("can't insert multiple item into leaf node")}items(){return this.__items}bbox(){if(this.__bbox!==null)return this.__bbox;throw new Error("bug")}},Bz=class{constructor(o){this.changed=!1,this.root=new Wk,this.capacity=o,this.capacity2=o*o,this.itemList=[]}size(){return this.itemList.length}items(){return this.flushWhenNeed(),this.itemList}add(o){this.itemList.push(o),this.changed=!0}remove(o){v1.remove(this.itemList,o),this.changed=!0}clear(){this.changed=!1,this.root=new Wk,this.itemList.length=0}flushWhenNeed(){if(this.changed){let o=new Array;for(let t of this.itemList)o.push(new Wk(t));for(;;){let t=this.organize(o);if(t.length>1)o=t;else break}this.root=new Wk(o),this.changed=!1}}organize(o){yM(o,r2t,0,o.length);let t=o.length,e=[];for(let r=0;r<t;)if(r+this.capacity2<=t){let i=r+this.capacity2;yM(o,t2t,r,i);for(let n=r;n<i;n+=this.capacity){let s=new Wk(o.slice(n,n+this.capacity));e.push(s)}r=r+this.capacity*this.capacity}else{let i=new Wk(o.slice(r,r+this.capacity));e.push(i),r=r+this.capacity}return e}search(o){this.flushWhenNeed();let t=[],e=[];for(e.push(this.root);;){let r=e.shift();if(typeof r<"u"){let i=r.items();if(i instanceof Array){for(let n of i)if(!o.isSeparated(n.bbox())){let s=n.items();s instanceof Array?e.push(n):t.push(s)}}else o.isSeparated(r.bbox())||t.push(i)}else break}return t}walker(o){this.flushWhenNeed(),this._walker(this.root,0,o)}_walker(o,t,e){this.flushWhenNeed();let r=o.items();if(r instanceof Array)for(let i of r)this._walker(i,t+1,e);else e(r,t)}bbox(){return this.flushWhenNeed(),this.root.bbox()}};function ZPe(o,t){i2t(o.iterator(),t)}function i2t(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var fee=new Error("list is empty"),mee=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},n2t=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},o2t=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},dM=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw fee;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw fee;return this.remove(o),o.item}addLast(o){return this.first===null||this.last===null?(this.first=new mee(this,o),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new mee(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw fee;return this.first.item}getLast(){if(this.last===null)throw fee;return this.last.item}insertAfter(o,t){let e=new mee(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new mee(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new n2t(this.first)}listIterator(){return new o2t(this.first)}toArray(){let o=new Array(this.cnt),t=this.first,e=0;for(;t!=null;)o[e]=t.item,t=t.next,e++;return o}};function JPe(o){throw new Error("")}var gee=class{constructor(o,t){this.node1=null,this.node2=null,this.key=o,this.value=t}},s2t=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().key}},a2t=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().value}},Yee=class{constructor(){this.innerList=new dM,this.innerMap={}}replace(o,t){o.node1!==null&&(o.node1.set(t),t.node1=o.node1),o.node2!==null&&(o.node2.set(t),t.node2=o.node2)}clear(){this.innerList.clear();for(let o in this.innerMap)delete this.innerMap[o]}put(o,t){let e=o.hashCode(),r=new gee(o,t),i=this.innerMap[e];if(i===void 0)return r.node1=this.innerList.add(r),this.innerMap[e]=r,null;if(i instanceof gee){if(i.key.equals(o))return this.innerMap[e]=r,this.replace(i,r),i.value;{r.node1=this.innerList.add(r);let n=new dM;return i.node2=n.add(i),r.node2=n.add(r),this.innerMap[e]=n,null}}if(i instanceof dM){let n=null;return ZPe(i,(s,a)=>a.key.equals(o)?(this.replace(a,r),n=a.value,!1):!0),n===null?(r.node1=this.innerList.add(r),r.node2=i.push(r),null):n}return JPe(i)}get(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof gee)return e.key.equals(o)?e.value:null;if(e instanceof dM){let r=null;return ZPe(e,(i,n)=>n.key.equals(o)?(r=n.value,!1):!0),r}return JPe(e)}containsKey(o){return this.get(o)!==null}delete(o){o.node1!==null&&o.node1.parent.remove(o.node1),o.node2===null?delete this.innerMap[o.key.hashCode()]:o.node2.parent.remove(o.node2)}remove(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof gee)return e.key.equals(o)?(this.delete(e),e.value):null;if(e instanceof dM){let r=null;return ZPe(e,(i,n)=>n.key.equals(o)?(r=n.value,this.delete(n),!1):!0),r}return JPe(e)}computeIfAbsent(o,t){let e=this.get(o);if(e===null){let r=t(o);return this.put(o,r),r}else return e}size(){return this.innerList.size()}isEmpty(){return this.innerList.size()===0}keys(){return new s2t(this.innerList.iterator())}values(){return new a2t(this.innerList.iterator())}entries(){return this.innerList.iterator()}},cB=class{constructor(){this.innerMap=new Yee}add(o){return this.innerMap.put(o,!0)!==!0}remove(o){this.innerMap.remove(o)}contains(o){return this.innerMap.get(o)===!0}iterator(){return this.innerMap.keys()}addAll(o){let t=o.iterator();for(;t.hasNext();)this.add(t.next())}size(){return this.innerMap.size()}clear(){let o=this.iterator();for(;o.hasNext();){let t=o.next();this.remove(t)}}},V5e=v1.funcCopy(yM);function l2t(o,t){let e=0;if(Math.abs(o.start.y-t)<=1e-4)at[e++]=o.start.x;else if(Math.abs(o.end.y-t)<=1e-4)at[e++]=o.end.x;else if(o.shape instanceof Pt)e=vbt(o.shape,t);else if(o.shape instanceof br)e=xbt(o.shape,t);else throw new Error("not supported operation");return e}var Ree=class{constructor(o,t,e,r){this.sides=new Array,this.loader=o,this.loader.bo=this,this.logger=e,this.rule=t,this.event=r}static sortByBBoxMinY(o,t){return o.bbox().minY-t.bbox().minY}static sortByBBoxAreaDesc(o,t){return t.bbox().area()-o.bbox().area()}addPolyline(o,t=1,e=.01,r=!0){for(let i of this.loader.buildGroup(o,t,e,r))this.sides.push(i),this.event.onOriginSide(i)}buildRTree(){let o=new Bz(10);for(let t of this.sides)o.add(t);return o}fillValidSides(o,t,e){for(let r of t)isFinite(r.getX(e))&&o.push(r)}getSortedEndpointsLineAsc(o){let t=new Array;for(let i of o)i.needCountWeight()&&(t.push(i.start),t.push(i.end));V5e(t,Ft.sortByYAsc,0,t.length);let e=new Array,r=Number.NEGATIVE_INFINITY;for(let i of t){let n=i.y;n>r&&(e.push(n),r=n)}return e}splitSides(o,t,e){let r=o.start,i=o.end,n=new Ft(i.x+(r.x-i.x)*2,i.y+(r.y-i.y)*2);V5e(o.inters,(a,l)=>a.distance2(n)-l.distance2(n),0,o.inters.length);let s=null;for(let a of o.inters)if(s==null)a.equals(r)&&(s=a);else if(!a.equals(s)){let l=dB.rebuild(o.shape,s,a);l instanceof br&&Math.abs(l.sweepAngle)>190&&(l=new Pt(s,a));let c=new dB(this,l,o.baseWeight,s,a,o.polyGrp,e++);if(t.push(c),c.updateBbox(),a.equals(i))break;s=a}return e}splitSidesByInters(){let o=new Array;for(let t of this.sides)if(t.polyIndex==0){let e=0,r=null,i=null;do{let n=new Array;e=this.splitSides(t,n,e);for(let s of n)r!=null?(r.next=s,s.previous=r):i=s,r=s,this.event.onSplitedSide(s),o.push(s);if(t.next===null)throw new Error("not supported operation");t=t.next}while(t.polyIndex!==0);i!=null&&r!=null&&(i.previous=r,r.next=i)}this.sides.length=0;for(let t of o)this.sides.push(t)}seekIntersection(){if(this.sides.length>0){let o=this.buildRTree(),t=new cB;for(let e of this.sides){t.add(e);let r=e.bbox().extendOfSize(1e-5),i=e.shape instanceof Pt;for(let n of o.search(r))if(!t.contains(n)){let s=n.shape instanceof Pt;if(!(i&&s&&e.next!==null&&e.previous!==null&&(e.next.equals(n)||e.previous.equals(n)))){let a=wI(e.shape,n.shape);for(let l=0;l<a;l+=2){let c=new Ft(at[l],at[l+1]);e.inters.push(c),n.inters.push(c),this.event.onIntersect(c,e,n)}}}}}}},c2t=class HNe{constructor(t){this.sides=new cB,this.others=new cB,this.id=t}add(t){this.sides.add(t),t.finalGrp=this.id;for(let e of t.connect)this.others.add(e)}polyline(){let t=new Array;return lB(this.sides,(e,r)=>(t.push(r.shape),!0)),ma.build2(t).asClose()}hashCode(){return this.id}equals(t){return t!=null&&t instanceof HNe?this.id===t.id:!1}},WNe=class{constructor(o){this.bo=null,this.sides=new Array,this.polyGrp=0,this.polyIndex=0,this.prevSide=null,this.firstSide=null,this.noWeight0=o}completeGroup(o){this.prevSide!=null&&this.firstSide!=null&&!this.prevSide.end.equals(this.firstSide.start)&&this.addSide(new Pt(this.prevSide.end,this.firstSide.start),o);let t=new Array,e=null,r=null;for(let i of this.sides)(!this.noWeight0||i.weight!==0)&&(e!=null?(e.next=i,i.previous=e):r=i,e=i,t.push(i));return e!=null&&r!=null&&(r.previous=e,e.next=r),this.polyGrp++,this.sides.length=0,this.prevSide=null,this.firstSide=null,this.polyIndex=0,t}buildGroup(o,t,e,r=!0){for(let i of o.primitives)if(i instanceof Pt)this.addSide(i,t);else if(r&&i instanceof br&&i.rx===i.ry)this.addArc(i,t);else{let n=null;for(let s of i.points(e))n!=null&&this.addSide(new Pt(n,s),t),n=s}return this.completeGroup(t)}addArc(o,t){let e=o.sweepAngle,r=ts.regularD(o.startAngle),i=r+e;if(e>0){let n=90;for(;n<=i;)n>r&&(this.addSide(br.build3(o.center,r,n-r,o.rx,o.ry),t),r=n),n+=90;r<i&&this.addSide(br.build3(o.center,r,i-r,o.rx,o.ry),t)}else if(e<0){let n=270;for(;n>=i;)n<r&&(this.addSide(br.build3(o.center,r,n-r,o.rx,o.ry),t),r=n),n-=90;r>i&&this.addSide(br.build3(o.center,r,i-r,o.rx,o.ry),t)}}addSide(o,t){if(o.start().equals(o.end()))return;let e=o.start(),r;this.prevSide!=null?(this.prevSide.end.equals(e)||this.addSide(new Pt(this.prevSide.end,e),t),r=new dB(this.bo,o,t,o.start(),o.end(),this.polyGrp,this.polyIndex++)):(r=new dB(this.bo,o,t,o.start(),o.end(),this.polyGrp,this.polyIndex++),this.firstSide=r),this.prevSide=r,this.sides.push(r)}},zNe=class{constructor(o,t,e){this.eps=new Array,this.curWeight=0,this.start=null,this.last=null,this.prevStart=null,this.prevEnd=null,this.y=e,this.rule=o,this.bo=t,this.event=t.event}onEp(o){this.tuningWeight(o),this.start===null?this.rule(this.curWeight)?this.in(o):o.setInvalid(this.y):this.rule(this.curWeight)?o.setInvalid(this.y):this.out(o,this.start),this.last!==null&&this.event.onSweep1(this.last,o,this.y),this.last=o}in(o){this.prevEnd!=null&&this.onSameX(o,this.prevEnd)?(this.start=this.prevStart,this.prevStart=null,this.prevEnd.revokeInside(this.y),this.prevEnd=null):(this.start=o,this.start.setOutside(this.y))}out(o,t){if(this.onSameX(t,o))t.revokeOutside(this.y);else{if(o.setInside(this.y)>0&&t.confidence(this.y)>0){let e=t.voteStatus(),r=o.voteStatus();this.isValid(e)&&this.isValid(r)?e==2&&r==1&&(o.connect.push(t),t.connect.push(o)):(o.connect.push(t),t.connect.push(o))}this.event.onSegment1(t,o,this.y),this.eps.push(t),this.eps.push(o),this.prevStart=t,this.prevEnd=o}this.start=null}isValid(o){return o==1||o==2}onSameX(o,t){return o.bbox().isIntersect(t.bbox())&&Or.eq(o.getX(this.y),t.getX(this.y))}tuningWeight(o){this.curWeight+=o.weight;let t=o.nextNot0(),e=o.prevNot0();t!=null&&o.weight===t.weight&&t.trans===this.y&&(this.curWeight-=o.weight),e!=null&&o.weight===e.weight&&e.trans===this.y&&(this.curWeight-=o.weight),o.trans=this.y}},jee=new Error,G5e=new class extends qz{decide1(o){return o[0]&&o[1]}}(2),h2t=new class extends UNe{onPolylineGroup(o,t){throw jee}onSegment(o,t,e,r,i,n){throw jee}},u2t=class{constructor(o,t){this.rtree=o,this.level=t}},d2t=class YNe extends Ree{static isIntersect(t,e,r=ate.DUMMY){let i=new YNe(r),n=i.createGroup1(t.items),s=i.createGroup2(e.items);return n.rtree.itemList.length==0||s.rtree.itemList.length==0?!1:i.isIntersect(n,s)}constructor(t){super(new WNe(!1),G5e.rule,t,h2t)}createGroup1(t){return this.createGroup(t,0)}createGroup2(t){return this.createGroup(t,1)}createGroup(t,e){let r=G5e.weight(e);for(let n of t)this.addPolyline(n,r);let i=this.buildRTree();return this.sides.length=0,new u2t(i,e)}isIntersect(t,e){if(t.level!==e.level){let r=t.rtree.bbox().intersection1(e.rtree.bbox());if(r!==null){try{this.inters(t,e);let i=(r.minY+r.maxY)/2;this.sweep(t,e,i)}catch(i){if(i===jee)return!0;throw i}return!1}else return!1}else throw new Error("inersection detection should not in same group")}inters(t,e){if(t.rtree.size()>e.rtree.size()){let r=t;t=e,e=r}for(let r of t.rtree.items()){r.trans=NaN;let i=r.bbox().extendOfSize(1e-5);for(let n of e.rtree.search(i))if(n.trans=NaN,wI(r.shape,n.shape)>0)throw jee}}sweep(t,e,r){let i=_1.extend2(t.rtree.bbox(),e.rtree.bbox()).extendOfSize(1e-5),n=new Array;this.fillValidSides(n,t.rtree.search(i),r),this.fillValidSides(n,e.rtree.search(i),r),yM(n,(a,l)=>a.getX(r)-l.getX(r),0,n.length);let s=new zNe(this.rule,this,r);for(let a of n)s.onEp(a)}},nIe=class cA{constructor(t){this.items=new Array(t.length),v1.arraycopy(t,0,this.items,0,t.length),this.__bbox=this.calcBBox()}static build1(t){let e=[];return Vee(t,(r,i)=>(e.push(i),!0)),new cA(e)}static build2(t){let e=t.map(r=>ma.build8(r));return new cA(e)}static combinePolylineGroupArr(t){let e=[];for(let r of t)e=e.concat(r.items);return new cA(e)}calcBBox(){let t=new Bb;for(let e=0;e<this.items.length;e++)t.ext1(this.items[e].bbox());return t.build1()}multiply3(t){let e=new Array(this.items.length);for(let r=0;r<e.length;r++)e[r]=this.items[r].multiply3(t);return new cA(e)}bbox(){return this.__bbox}asClose(){return this.items.forEach(t=>t.asClose()),this}mirrorY(t){return this.items.forEach(e=>e.mirrorY(t)),this}closeEndpoint(){return this.items.forEach(t=>t.closeEndpoint()),this}get primitives(){return this.items.map(t=>t.primitives).flat(2)}isEqual(t){return t instanceof cA?this.items.every(e=>t.items.some(r=>r.isEqual(e))):!1}getOutMostPolyline(){return this.items.reduce((t,e)=>e.bbox().area()>t.bbox().area()?e:t,this.items[0])}getOutline(){let t=this.items;if(t.length===1)return{outline:t,hole:new Array};let e=new Set,r=new Set;for(let i=0,n=t.length;i<n;i++){let s=t[i];if(!e.has(s)&&!r.has(s)){i+1>=n&&e.add(s);for(let a=i+1;a<n;a++){let l=t[a];if(!e.has(l)&&!r.has(l)){if(!s.bbox().isInside(l.bbox().extendOfSize(1e-4))&&!l.bbox().isInside(s.bbox().extendOfSize(1e-4)))continue;d2t.isIntersect(new cA([s]),new cA([l]))&&(s.bbox().area()>l.bbox().area()?(e.add(s),r.add(l)):(e.add(l),r.add(s)))}}!e.has(s)&&!r.has(s)&&e.add(s)}}return{outline:[...e],hole:[...r]}}round(t=4){let e=this.items.map(r=>r.round(t));return new cA(e)}},p2t=v1.funcCopy(yM),f2t=v1.funcCopy(yM),m2t=v1.funcCopy(yM);function g2t(o){return new Array}function y2t(o,t){let e=new wz(!1),r=new Lz(o,ate.DUMMY,e);for(let i of t)r.addPolyline(i);return r.simplify(),e.plGrps}var Lz=class extends Ree{constructor(o,t,e){super(new WNe(!1),o,t,e),this.finalSides=new Array,this.sideGroups={},this.vecSides=new Array,this.scanY=NaN,this.curNetIndex=0,this.curIndex=-1,this.scanLines=0}sweep(o,t,e){this.scanY=NaN,this.scanLines=0,p2t(t,Ree.sortByBBoxMinY,0,t.length);let r=new dM;this.curNetIndex=0;let i=Number.POSITIVE_INFINITY;for(let n of o)n>i&&this.scan(r,(i+n)/2,t),i=n;this.getAllMarkPrimitive(e,t),this.logger.debug3("scan %s %d",e,this.scanLines)}simplify(){this.seekIntersection(),this.splitSidesByInters(),this.sweep(this.getSortedEndpointsLineAsc(this.sides),this.sides,!1),this.flipSides(),this.sweep(this.getSortedEndpointsLineAsc(this.vecSides),this.vecSides,!0),this.connectSides(),this.fillResult()}addPolyline(o,t=1,e=.01,r=!0){super.addPolyline(o,t,e,r)}scan(o,t,e){if(this.scanY==t)return;this.scanY=t;let r=!1,i=o.listIterator();for(;i.hasNext();){let n=i.next(),s=n.item;Or.less(s.bbox().maxY,t)?o.remove(n):!r&&s.isNeedScan(t)&&(r=!0)}for(;this.curNetIndex<e.length;){let n=e[this.curNetIndex];if(Or.less(n.bbox().minY,t))Or.greatereq(n.bbox().maxY,t)&&(this.add2AET(o,n),!r&&n.isNeedScan(t)&&(r=!0)),this.curNetIndex++;else break}if(r){this.scanLines++;let n=new zNe(this.rule,this,t),s=o.iterator();for(;s.hasNext();){let a=s.next();n.onEp(a)}}}add2AET(o,t){let e=t.bbox().minX,r=t.bbox().maxX,i=t.bbox().minY,n=t.bbox().maxY,s=o.listIterator(),a=null;for(;s.hasNext();){let l,c=s.next(),h=c.item,u=h.bbox().minX,d=h.bbox().maxX;if(r<=u)l=-1;else if(d<=e)l=1;else{let m=h.bbox().minY,g=h.bbox().maxY,y=Math.max(i,m),b=Math.min(n,g);l=this.compareBySweep(t,h,(y+b)/2)}let p=h.shape;if(p instanceof Pt&&p.length()<.001&&a==null&&l<0){a=c;continue}if(a!=null&&l<0){o.insertBefore(a,t);return}if(l<0){o.insertBefore(c,t);return}else a=null}o.add(t)}getLineAngle(o){let t=o.start().angle(o.end());return t<0&&(t+=Math.PI),t}getArcAngle(o,t){let e=Math.asin((t-o.center.y)/o.rx);return o.startAngle>90&&o.startAngle<270&&(e=-e),e<0&&(e+=Math.PI),(e+Math.PI/2)%Math.PI}compareArcLine(o,t,e){let r=this.getArcAngle(o,e),i=this.getLineAngle(t);return Or.eq(r,i)?-o.sweepAngle:i-r}compareBySweep(o,t,e){let r=o.getX(e);if(!isFinite(r))return 0;let i=t.getX(e);if(!isFinite(i))return 0;if(!Or.eq(r,i))return r-i;if(o.shape instanceof Pt)return t.shape instanceof Pt?this.getLineAngle(t.shape)-this.getLineAngle(o.shape):-this.compareArcLine(t.shape,o.shape,e);if(t.shape instanceof Pt)return this.compareArcLine(o.shape,t.shape,e);{let n=o.shape,s=t.shape,a=this.getArcAngle(n,e),l=this.getArcAngle(s,e);return Or.eq(a,l)?n.sweepAngle*s.sweepAngle<=0?n.sweepAngle<=0?1:-1:n.sweepAngle>0?n.rx-s.rx:s.rx-n.rx:l-a}}getAllMarkPrimitive(o,t){for(let e of t)if(e.status===0&&e.bbox().height()!=0){let r=e.voteStatus();if(r===2||r===1){e.status=r;let i=e.reverse(r);if(o){this.event.onResultSide(i);let n=i.shape.multiply3(Oc.ROT_N90),s=i.start.multiply3(Oc.ROT_N90),a=i.end.multiply3(Oc.ROT_N90);i=new dB(this,n,i.baseWeight,s,a,i.polyGrp,i.polyIndex)}this.finalSides.push(i),this.event.onResultSide(i)}}}flipSides(){for(let o of this.sides)if(o.polyIndex==0){let t=null,e=null;do{let r=o.shape.multiply3(Oc.ROT_90),i=o.start.multiply3(Oc.ROT_90),n=o.end.multiply3(Oc.ROT_90),s=new dB(this,r,o.baseWeight,i,n,o.polyGrp,o.polyIndex);if(s.outsideWeight=o.outsideWeight,s.insideWeight=o.insideWeight,s.invalidWeight=o.invalidWeight,s.status=o.status,t!=null?(t.next=s,s.previous=t):e=s,this.vecSides.push(s),this.event.onSplitedSide(s),t=s,o.next!==null)o=o.next;else break}while(o.polyIndex!=0);e!=null&&(e.previous=t,t.next=e)}}canBeEnd(o,t){if(o.size()==1){let e=o.getFirst().shape;if(e instanceof br){if(t&&e.rx<=t)return!1}else if(e instanceof Pt&&t&&e.length()<=t)return!1}return!0}connectSides(){let o=new Yee,t=new Bz(10);for(let n of this.finalSides)o.computeIfAbsent(n.start,g2t).push(n),t.add(n.start);let e=0,r=new cB,i=new Array;for(let n of this.finalSides)if(!r.contains(n)){let s=new cB,a=n.start,l=new dM;l.add(n),r.add(n);let c=n.end;for(;l.size()>0;)if(this.isStart(a,c)&&this.canBeEnd(l,.01)){l.size()>1&&this.fillSideGroups(l,e++);break}else{let h=o.get(c),u=this.findNext(r,h);if(u==null&&(c=this.findNeigber(c,s,t,.01),c!==null&&(h=o.get(c),u=this.findNext(r,h))),u!=null)l.add(u),r.add(u),c=u.end;else if(c!=null?s.add(c):(i.length==0&&l.size()>1&&this.logger.warning3("unable to connect at %s",l.getLast()),i.push(l.removeLast())),l.size()>0)c=l.getLast().end;else break}}}fillSideGroups(o,t){let e=new c2t(t);lB(o,(r,i)=>(e.add(i),!0)),this.sideGroups[e.id]=e}isStart(o,t){return o.distance2(t)<=1e-4}findNext(o,t){if(t!=null){for(let e of t)if(!o.contains(e))return e}return null}fillResult(){let o=0,t=new Yee;for(let r in this.sideGroups){let i=this.sideGroups[r];lB(i.sides,(n,s)=>(s.polyGrp!=-2&&t.put(s,s),!0))}let e=new cB;for(let r in this.sideGroups){let i=this.sideGroups[r];if(e.add(i)){let n=0,s=new Array;for(s.push(i);n<s.length;){let l=s[n],c=new Array;lB(l.others,(u,d)=>{let p=t.get(d);return p!=null&&c.push(p.finalGrp),!0}),f2t(c,v1.sortAsc,0,c.length);let h=l.id;for(let u of c)if(u!=h&&u!=l.id){let d=this.sideGroups[u];e.add(d)&&s.push(d),h=u}n++}let a=new Array;for(let l of s)a.push(l.polyline());m2t(a,Ree.sortByBBoxAreaDesc,0,a.length),this.event.onPolylineGroup(new nIe(a),o++)}}}findNeigber(o,t,e,r){let i=r*r,n=Number.MAX_VALUE,s=null;for(let a of e.search(o.bbox().extendOfSize(r)))if(!t.contains(a)){let l=o.distance2(a);l<n&&(n=l,s=a)}return n<i?s:null}},b2t=class{constructor(){this.points=[],this.lines=[],this.arcs=[],this.beziers=[],this.listText=[],this.fonts=[]}addPt(o,t=!0){if(o instanceof Pt)this.lines.push(o);else if(o instanceof br)this.arcs.push(o);else if(o instanceof Xi)this.beziers.push(o);else throw new Error("not support");t&&this.points.push(o.start())}addPoint(o){this.points.push(o)}addText(o,t,e=1,r=.1,i=!0){this.listText.push({pos:o,str:t,size:e,width:r}),i&&this.points.push(o)}addPly(o,t=!0){o.primitives.forEach(e=>this.addPt(e,t))}build(){let o=[],t=[],e=[],r=[],i=[],n=[];return this.points.forEach(s=>o.push(s.x,s.y)),this.lines.forEach(s=>t.push(s.start().x,s.start().y,s.end().x,s.end().y)),this.arcs.forEach(s=>e.push(s.center.x,s.center.y,s.rx,ts.toRadians(s.startAngle),ts.toRadians(s.endAngle()),s.sweep())),this.beziers.forEach(s=>{s.controls.forEach(a=>{r.push(a.x,a.y)}),r.push("end")}),this.listText.forEach(s=>i.push(s.pos.x,s.pos.y,s.str,s.width,s.size)),this.fonts.forEach(s=>n.push(s)),{points:o,lines:t,arcs:e,texts:i,beziers:r,fonts:n}}},yz,$z=(yz=class{constructor(o){this.map=new Yee,this.bus=o}initColor(o){return this.map.computeIfAbsent(o,()=>new b2t)}draw(){let o={},t=this.map.entries();for(;t.hasNext();){let e=t.next();o[e.key.toString()]=e.value.build()}this.bus.publish("/debug/draw",o)}clear(){this.map.clear()}static init(o){if(!o)throw new Error("bus is undefined!");this.palette=new yz(o)}static initPalette(o){this.palette=o}static getDefaultColor(){for(let o of this.colorBuffersMap)if(o[0]!==null&&o[0])return o[0]=!1,o[1];return this.colorBuffersMap.forEach(o=>{if(o[0]===null){console.log(1);return}o[0]=!0}),this.getDefaultColor()}static clear(){this.palette.clear()}static auto(o,t=this.getDefaultColor()){if(Array.isArray(o))o.forEach(e=>{this.auto(e,t)});else if(o instanceof Ft)this.point(o,t);else if(o instanceof _1)this.bbox(o,t);else if(o instanceof Xz)this.primitive(o,t);else if(o instanceof ma)this.polyline(o,t);else if(o instanceof X0)this.polygon(o,t);else if(o instanceof fp)this.group(o,t);else if(o instanceof nIe)this.auto(o.items,t);else{debugger;throw new Error("No incoming type!")}}static text(o,t,e=.5,r=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");this.palette.initColor(r).addText(o,t,e,e/10),this.palette.draw()}static point(o,t=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let e=this.palette.initColor(t);Array.isArray(o)?o.forEach(r=>{this.point(r,t)}):e.addPoint(o),this.palette.draw()}static bbox(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.bbox(e,t)}):(this.primitive(new Pt(new Ft(o.maxX,o.maxY),new Ft(o.maxX,o.minY)),t),this.primitive(new Pt(new Ft(o.maxX,o.maxY),new Ft(o.minX,o.maxY)),t),this.primitive(new Pt(new Ft(o.minX,o.minY),new Ft(o.maxX,o.minY)),t),this.primitive(new Pt(new Ft(o.minX,o.minY),new Ft(o.minX,o.maxY)),t))}static primitive(o,t=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let e=this.palette.initColor(t);Array.isArray(o)?o.forEach(r=>{this.primitive(r,t)}):e.addPt(o),this.palette.draw()}static polyline(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.polyline(e,t)}):o.primitives.forEach(e=>{this.primitive(e,t)})}static polygon(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.polygon(e,t)}):o.items.forEach(e=>{this.polyline(e,t)})}static group(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.group(e,t)}):o.items.forEach(e=>{this.polygon(e,t)})}static async begin(){this.t1=performance.now()}static async end(o){console.log(o||"t1:",performance.now()-this.t1)}static async log(o){console.log(o||"==================")}},yz.colorBuffersMap=[[!0,Yl.BLUE],[!0,Yl.GREEN],[!0,Yl.WHITE],[!0,Yl.RED],[!0,Yl.Golden],[!0,Yl.Gray]],yz.t1=0,yz),P2t=0,Kz=class ATe{constructor(t,e){this.inters=[],this.shape=t,this.start=t.start(),this.end=t.end(),this.judgeOverlapMap=new Map,e&&(this.id=P2t++)}reverse(){this.shape=this.shape.reverse();let t=this.start;this.start=this.end,this.end=t}getCenterPoint(t=this.end){let{x:e,y:r}=this.start,{x:i,y:n}=t;if(this.shape instanceof br){let s=this.shape.rx,a=new Ft((e+i)/2,(r+n)/2),l=this.shape.center,c;return a.x!==l.x||a.y!==l.y?(c=a.angle(l),Math.abs(this.shape.sweepAngle)>180&&(c+=c>=0?-180:180)):c=(this.shape.startAngle+this.shape.endAngle())/2,new Ft(l.x+Math.cos(c)*s,l.y+Math.sin(c)*s)}else{if(this.shape instanceof Pt)return new Ft((e+i)/2,(r+n)/2);if(this.shape instanceof Xi){let s=this.shape.getPercent(t,fo);return Xi.pointOn(s/2,this.shape.controls)}else throw Error("not support")}}static finalAngle(t,e,r){let i=t.cross(e)>0,n=Math.acos(Math.min(1,Math.max(-1,t.dot(e)/e.length())));return(r?!i:i)&&(n=lte-n),n}sortInters(){if(this.shape instanceof br){let t=this.shape.center,e=this.shape.start().sub(t).normalize(),r=this.shape.isCCW;this.inters.sort((i,n)=>{let s=i.coord.sub(t),a=n.coord.sub(t);return ATe.finalAngle(e,s,r)-ATe.finalAngle(e,a,r)<=0?-1:1})}else if(this.shape instanceof Pt){let t=this.start,e=this.end,r=new Ft(e.x+(t.x-e.x)*2,e.y+(t.y-e.y)*2);this.inters.sort((i,n)=>i.coord.distance2(r)-n.coord.distance2(r)<=0?-1:1)}else if(this.shape instanceof Xi){let t=this.shape;this.inters.sort((e,r)=>t.getPercent(e.coord,fo)-t.getPercent(r.coord,fo)<=0?-1:1)}else throw Error("not support the primitive type");this.inters.forEach((t,e)=>t.setIndex(e))}getStart(){return this.start}getEnd(){return this.end}getShape(){return this.shape}connect(t){this.nextSide=t,t.prevSide=this}static returnPolygonList(t){let e=[];return t.forEach(r=>{let i=[];r.forEach((n,s)=>{let a=[];n.forEach(l=>{a.push(l.shape)}),i.push(ma.build7(a))}),e.push(new X0(i))}),e}addInter(t){this.inters.push(t)}static returnPolygonGroup(t){let e=[];return t.forEach(r=>{let i=[];r.forEach((n,s)=>{let a=[];n.forEach(l=>{a.push(l.shape)}),i.push(ma.build7(a))}),e.push(new X0(i))}),new fp(e)}static rebuild(t,e,r){let i;if(t instanceof Pt||e.distance2(r)<1e-6)i=new Pt(e,r);else if(t instanceof br)i=br.build2(t.center,e.angleD(t.center),r.angleD(t.center),t.rx,t.ry,t.isCCW?1:0);else if(t instanceof Xi){let n=t.getPercent(e,fo),s=t.clip(n)[1];i=s.clip(s.getPercent(r,fo))[0]}else throw new Error("not supported operation");return po(t,e).dot(po(i,e))<0?null:i}static returnPolyline(t){return ma.build7(t.map(e=>e.shape))}bbox(){return this.shape.bbox()}},T2t=(o=>(o[o.END1=0]="END1",o[o.END2=1]="END2",o[o.END12=2]="END12",o[o.LEFT1=3]="LEFT1",o[o.LEFT2=4]="LEFT2",o))(T2t||{});function x1(o,t,e){if(o instanceof br&&t instanceof br)return S2t(o,t);if(o instanceof br&&t instanceof Pt)return W5e(o,t);if(o instanceof Pt&&t instanceof br)return H5e(o,t);if(o instanceof Pt&&t instanceof Pt)return fM(o,t);if(o instanceof Xi&&t instanceof Pt)return o.controls.length===2||pA(o)?fM(new Pt(o.start(),o.end()),t):jNe(o,t);if(o instanceof Pt&&t instanceof Xi)return t.controls.length===2||pA(t)?fM(o,new Pt(t.start(),t.end())):_Te(o,t);if(o instanceof br&&t instanceof Xi)return t.controls.length===2||pA(t)?W5e(o,new Pt(t.start(),t.end())):I2t(o,t);if(o instanceof Xi&&t instanceof br)return o.controls.length===2||pA(o)?H5e(new Pt(o.start(),o.end()),t):C2t(o,t);if(o instanceof Xi&&t instanceof Xi)return oIe(o,t);throw new Error("not support")}function zk(o,t){return po(o,t.start()).dot(po(t,t.start()))<=0?!1:x1(o,t).state<=2}function QPe(o,t){let e=t.getPercent(o.end(),fo);if(e===null)return!1;if(e===0)return!0;let r=t.clip(e)[0],i=o.buildConverxHull(fo),n=r.buildConverxHull(fo),s=c(i),a=c(n);return l(s,a);function l(h,u){let d=new Map([[0,1],[1,0],[2,2],[3,4],[4,3]]),p=h[0],m=u[0];if(!p||!m)throw Error("isAllOverlap(sides1: PackSide[], sides2: PackSide[])");let g=!0;do{let y=p.getShape(),b=m.getShape();if(y instanceof Pt&&b instanceof Pt){let P=g?fM(y,b).state:d.get(fM(b,y).state);if(P===0)p=p.nextSide,g=!1;else if(P===1)m=m.nextSide,g=!0;else if(P===2)p=p.nextSide,m=m.nextSide,g=!0;else return!1}else throw Error("not support")}while(p!==h[0].prevSide&&m!==u[0].prevSide);return!0}function c(h){let u=h.primitives.map(p=>new Kz(p)),d=u[u.length-1];return u.forEach(p=>{d.connect(p),d=p}),u}}function U5e(o,t){let e=o.end().distance2(t.center);if(e>(t.rx+fo)**2||e<(t.rx-fo)**2||!(Bn(o.end(),t.end())||sIe(t,o.end())))return!1;if(o.center.equals1(t.center))return!0;let r=o.center.distance1(t.center),i=Math.abs(o.rx-t.rx);if(r>Math.min(o.rx,t.rx)){let n=o.center.angleD(t.center);return o.rx>t.rx?!(r+i>fo&&mE(o,n))&&!(r-i>fo&&o.rx+t.rx-r>fo&&mE(o,n+180)):!(r-i>fo&&mE(o,n))&&!(o.rx+t.rx-r>fo&&mE(o,n+180))}else{if(r+i<=fo)return!0;let n=o.rx>t.rx?o.center.angleD(t.center):t.center.angleD(o.center);return mE(o,n)?!1:r-i<=fo?!0:!mE(o,n+180)}}function I2t(o,t){let e=aIe(o,t.start()).toBezier2(),r,i=0;for(let n=e.length;i<n;i++){let s=e[i];if(r=oIe(s,t).state,r!==0)break}return r===2&&i!==e.length-1?{state:1}:{state:r}}function C2t(o,t){let e=t.toBezier2(),r,i=0;for(let n=e.length;i<n;i++){let s=e[i];if(r=oIe(o,s).state,r!==1)break}return r===2&&i!==e.length-1?{state:0}:{state:r}}function oIe(o,t){if(o.controls.length===2||pA(o))return t.controls.length===2||pA(t)?fM(new Pt(o.start(),t.end()),new Pt(t.start(),t.end())):_Te(new Pt(t.start(),o.end()),t);if(t.controls.length===2||pA(t))return jNe(vTe(o,t.start()),new Pt(t.start(),t.end()));let e=vTe(o,t.start());if(pA(e))return _Te(new Pt(t.start(),o.end()),t);let r=QPe(e,t),i=QPe(t,e);if(!r&&!i){let n=Fbt(e,t);if(n.havOverlap){let s=n.havOverlap!==2,a=n.havOverlap!==1;return mA(o,t,s,a)}else{let s=function(){for(let u=0;u<c;u+=2)at[u]=h[u],at[u+1]=h[u+1]},a,l,c=n.cnt,h=new Array(c).fill(0).map((u,d)=>at[d]);for(let u=0;u<c;u+=2){let d=new Ft(at[u],at[u+1]),p=e.getPercent(d,fo),m=t.getPercent(d,fo);if(p===0||m===0)continue;let g=p===1?e:e.clip(p)[0],y=m===1?t:t.clip(m)[0];if(QPe(g,y)){let b=po(o,d).cross(po(t,d));if(b===0){a=e.end(),l=t.end();break}return{state:b<0?3:4}}s()}return(!a||!l)&&(a=nB(e.controls,e.controls[0],t),l=nB(t.controls,e.controls[0],e)),{state:a.sub(e.controls[0]).cross(l.sub(e.controls[0]))>0?4:3}}}return mA(o,t,r,i)}function jNe(o,t){let e=vTe(o,t.start());if(pA(e))return fM(new Pt(e.start(),e.end()),t);let r=qNe(e,t),{isIn:i,bezierIsInLeft:n}=XNe(t,e);if(!r&&!i){if(n!==void 0)return{state:n?3:4};let s=null,a=o.getPercent(t.start(),fo)+.01;for(let l=a>1?1:a;l<=1;){let c=Xi.pointOn(l,o.controls);if(Fz(t,c)>R1){s=c;break}l+=.01,l>1&&(l=1)}if(!s)throw Error("!end1 && !end2 not result");return{state:t.direct.cross(s.sub(t.start()))<0?4:3}}return mA(e,t,r,i)}function _Te(o,t){let{isIn:e,bezierIsInLeft:r}=XNe(o,t),i=qNe(t,o);if(!e&&!i){if(r!==void 0)return{state:r?4:3};let n=null;for(let s=.01;s<=1;){let a=Xi.pointOn(s,t.controls);if(Fz(o,a)>R1){n=a;break}s+=.01,s>1&&(s=1)}if(!n)throw Error("!end1 && !end2 not result");return{state:o.direct.cross(n.sub(o.start()))<0?3:4}}return mA(t,o,e,i)}function S2t(o,t){let e=U5e(aIe(o,t.start()),t),r=U5e(t,o);if(!e&&!r){let i=LS(t);if(o.center.sub(t.start()).dot(t.center.sub(t.start()))>0){if(o.rx===t.rx)return o.isCCW?{state:i.dot(o.center.sub(t.center))<0?3:4,exitIsInvalid:!1}:{state:i.dot(o.center.sub(t.center))>0?3:4,exitIsInvalid:!1};let n,s;return o.rx>t.rx?(n=o,s=t):(n=t,s=o),i.dot(s.center.sub(n.center))>0&&s.rx+s.center.distance1(n.center)-n.rx>fo?o.isCCW?{state:o.rx>t.rx?3:4,exitIsInvalid:!1}:{state:o.rx<t.rx?3:4,exitIsInvalid:!1}:o.isCCW?{state:o.rx<t.rx?3:4,exitIsInvalid:!0}:{state:o.rx>t.rx?3:4,exitIsInvalid:!0}}else return o.rx+t.rx-o.center.distance1(t.center)>fo&&i.dot(o.center.sub(t.center))>0?{state:t.isCCW?3:4,exitIsInvalid:!1}:{state:o.isCCW?3:4,exitIsInvalid:!0}}return mA(o,t,e,r)}function H5e(o,t){let e=wS.foot(o,t.center),r=o.end().distance2(t.center),i=o.end().sub(o.start()),n=(t.rx-fo)**2,s=r<=(t.rx+fo)**2&&r>=n&&(i.dot(e.sub(t.start()))<=0||o.start().distance2(o.end())<=o.start().distance2(e)||e.distance2(t.center)>=n)&&(Bn(o.end(),t.end())||sIe(t,o.end())),a=$Ne(t,o);if(!s&&!a){let l=o.distance2(t.center);return l<=R1?{state:i.cross(LS(t))>0?4:3}:i.dot(e.sub(t.start()))>=0&&(r<n||o.start().distance2(t.center)<n||l<n)?{state:i.cross(t.center.sub(o.start()))<0?4:3}:{state:i.cross(t.center.sub(o.start()))>0?4:3}}return mA(t,o,s,a)}function mE(o,t){return t=ts.regularD(t),o.sweepAngle>0?(t<o.startAngle&&(t+=360),o.endAngle()>t):(t>o.startAngle&&(t-=360),o.endAngle()<t)}function sIe(o,t){return Bn(o.end(),t)||Bn(o.start(),t)||mE(o,t.angleD(o.center))}function XNe(o,t){let e=o.panDistance(fo),r=o.panDistance(-fo),i=z5e(t,e),n=z5e(t,r);if(!i.length&&!n.length)return{isIn:t.getPercent(o.end(),fo)!==null};let s=[...i,...n].sort((h,u)=>h.t-u.t),a=new Pt(r.start(),e.start()),l=[];for(let h=0,u=s.length;h<u;h++){let d=s[h];if(l.push(d),a.distance(d.interP)>o.length()+fo)break;if(l.length===2){let p=(l[1].t*10+l.shift().t*10)/20,m=Xi.pointOn(p,t.controls);if(o.distance2(m)>R1)return{isIn:!1,bezierIsInLeft:o.direct.cross(m.sub(o.start()))>0}}}let c=l.length?a.distance(l[0].interP)>=o.length()+fo:!0;return{isIn:c,bezierIsInLeft:c?void 0:o.direct.cross(l[0].interP.sub(o.start()))>0}}function qNe(o,t){if(Fz(t,o.end())>R1||o.getToLineMaxDis2(t)>R1)return!1;let e=O2t(t,R1);return o.getToLineMaxDis2(e)<=(t.length()+fo)**2}function $Ne(o,t){let e=t.end().angleD(t.start()),r=E2t(t,o.end());if(r>R1)return!1;if(mE(o,e+90)){if(wS.foot(t,o.center).distance1(o.pointOn(e+90))>o.rx)return!1;r=Math.max(r,(o.rx-t.distance(o.center))**2)}if(mE(o,e-90)){if(wS.foot(t,o.center).distance1(o.pointOn(e-90))>o.rx)return!1;r=Math.max(r,(o.rx-t.distance(o.center))**2)}return r<=R1&&(Bn(o.end(),t.end())||xTe(t,o.end()))}var KNe=(fo*2)**2;function aIe(o,t){if(Bn(o.end(),t))return br.build3(o.center,o.endAngle(),0,o.rx,o.ry);if(o.start().distance2(t)<KNe)return o;let e=ts.regularD(t.angleD(o.center));if(!mE(o,e))throw new Error("!angleIsInArc(arc, angle)");return br.build2(o.center,e,o.endAngle(),o.rx,o.ry,o.isCCW?1:0)}function vTe(o,t){if(Bn(o.end(),t))return new Xi([t,t]);if(o.start().distance2(t)<KNe)return o;let e=o.getPercent(t,fo);if(e===null)throw new Error("!cutBezier(bezier: Bezier, p: Vector2)");return o.clip(e)[1]}function W5e(o,t){let e=$Ne(aIe(o,t.start()),t),r=t.end().distance2(o.center),i=t.end().sub(t.start()),n=wS.foot(t,o.center),s=(o.rx-fo)**2,a=r<=(o.rx+fo)**2&&r>=s&&(i.dot(n.sub(t.start()))<=0||t.start().distance2(t.end())<=t.start().distance2(n)||n.distance2(o.center)>=s)&&(Bn(o.end(),t.end())||sIe(o,t.end()));if(!e&&!a){let l=t.distance2(o.center);return l<=R1?{state:i.cross(LS(o,t.start().angle(o.center)))>0?3:4}:i.dot(n.sub(t.start()))>=0&&(r<s||t.start().distance2(o.center)<s||l<s)?{state:i.cross(o.center.sub(t.start()))>0?4:3}:{state:i.cross(o.center.sub(t.start()))<0?4:3}}return mA(t,o,e,a)}function fM(o,t){if(Bn(o.end(),t.end()))return mA(o,t,!0,!0);let e=Fz(t,o.end())<=R1&&xTe(t,o.end()),r=Fz(o,t.end())<=R1&&xTe(o,t.end());if(!e&&!r){let i=o.direct.x===0&&o.direct.y===0,n=t.direct.x===0&&t.direct.y===0;if(i&&n)throw Error("2LineAllIsPoint");return i?{state:t.direct.cross(o.end().sub(t.start()))>0?3:4}:{state:o.end().sub(o.start()).cross(t.end().sub(o.start()))>0?4:3}}return mA(o,t,e,r)}function xTe(o,t){return wS.foot(o,t).distance2(o.start())<o.end().distance2(o.start())}function mA(o,t,e,r){if(e)return r?Bn(o.end(),t.end())?{state:2}:{state:0}:{state:0};if(r)return{state:1};throw new Error("!end1 && !end2")}function Fz(o,t){return(o.a*t.x+o.b*t.y+o.c)**2/(o.a**2+o.b**2)}function E2t(o,t){return Math.min(o.distance2(t),wS.foot(o,t).distance2(t))}function O2t(o,t){let e=o.panDistance(t),r=o.panDistance(-t);return new Pt(r.start(),e.start())}function pA(o){let t=o.start(),e=o.end();t.equals1(e)&&(e=t.add1(1,0));let r=e.y-t.y,i=t.x-e.x,n=-r*t.x-i*t.y,s=Math.sqrt(1/(r**2+i**2));r*=s,i*=s,n*=s;let a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;return o.controls.forEach(c=>{let h=r*c.x+i*c.y+n;h<a&&(a=h),h>l&&(l=h)}),TE(a,l)}function z5e(o,t){let e=wI(o,t),r=[],i=new Array(e).fill(0).map((s,a)=>at[a]);for(let s=0;s<e;s+=2){let a=new Ft(at[s],at[s+1]),l=o.getPercent(a);r.push({interP:a,t:l}),n()}function n(){for(let s=0;s<e;s+=2)at[s]=i[s],at[s+1]=i[s+1]}return r}var pE=.01,A2t=270;function lx(o){let t=pE**2,e=o.end(),r=[],i=[];for(let p=0,m=o.primitives.length;p<m;p++){let g=function(v,D){return v instanceof Pt&&D instanceof Pt&&Math.abs(v.direct.cross(D.direct))<Or.eps&&v.direct.dot(D.direct)>0||v instanceof br&&D instanceof br&&Math.abs(v.rx-D.rx)<=Or.eps&&v.center.distance2(D.center)<Or.eps&&v.isCCW===D.isCCW},y=function(v){if(iT(v,pE))i.push(null);else{if(v instanceof Pt)i.push(v);else if(v instanceof br&&v.rx===v.ry)u(v,i);else if(v instanceof Xi){let D=[];FNe(v,D),D.forEach(w=>{let F=w.start(),H=w.end();h(F,H)||i.push(w)})}else throw new Error("not support!");e=I}},b=function(v){if(v instanceof Pt)return v.direct.x===0&&v.direct.y===0;if(v instanceof br)return v.sweepAngle===0;if(v instanceof Xi){let D=new Set(v.controls.map(F=>F.x)),w=new Set(v.controls.map(F=>F.y));return D.size===1&&w.size===1}else throw new Error("not support")},P=o.primitives[p],T=P.start(),I=P.end();if(b(P))continue;h(e,T)||(i.push(new Pt(e,T)),e=T);let C=(p+1)%m,E=o.primitives[C];for(;g(P,E)&&(C=(C+1)%m,E=o.primitives[C],E!==P););if(C===(p+1)%m){y(P);continue}if(E===P){if(!(P instanceof br)){if(Math.abs(o.area(.1))<t)return null;throw new Error("simplifyPolyline not support")}let v=P instanceof br?P.isCCW:o.area(.1)>0;i.length=0;let D=v?180:-180;i.push(br.build3(P.center,P.startAngle,D,P.rx,P.ry),br.build3(P.center,P.startAngle+D,D,P.rx,P.ry));break}let O=(()=>{if(P instanceof Pt)return(v,D)=>{let w=new Pt(v,D);return iT(w,pE)?null:[w]};if(P instanceof br)return(v,D)=>{let w;if(v.equals1(D)?w=br.build3(P.center,P.startAngle,P.sweep()===1?360:-360,P.rx,P.ry):w=br.build4(v,D,P.center,P.rx,P.ry,P.sweep()),iT(w,pE))return null;let F=w.pointOn(w.startAngle+w.sweepAngle/2),H=br.build4(w.start(),F,P.center,P.rx,P.ry,P.sweep()),z=br.build4(F,w.end(),P.center,P.rx,P.ry,P.sweep());return iT(H,pE)||iT(z,pE)?[w]:[H,z]};throw new Error("not support")})(),_=C===0;if(C<p&&!_&&(_=!O(o.primitives[0].start(),o.primitives[C-1].end()),!_)){let v=O(P.start(),o.primitives[m-1].end());if(v)i.push(...v);else{let D=O(P.start(),i[0].end());if(D.length===1)i[0]=D[0];else if(D.length===2)i[0]=D[1],i.push(D[0]);else throw new Error("!!!generatorPt")}break}p=C===0?m-1:C-1,E=o.primitives[p];let R=O(P.start(),E.end());if(R?(R.forEach(v=>i.push(v)),e=E.end()):y(null),_)break}let n=i.length;if(i.forEach((p,m)=>{if(p)r.push(p);else{let g,y;m===n-1&&(g=r[0],y=r[r.length-1]);let b=(m+1)%n;if(g=g!=null?g:i[b],g){let P=m,T=!1;for(;y=y!=null?y:i[(--P+n)%n],y!==g;)if(y){T=!0;break}if(T){if(g.start().equals1(y.end()))return;if(po(y,y.end()).dot(po(g,g.start()))<0){if(!h(y.end(),g.start())){let O=new Pt(y.end(),g.start());r.push(O);return}let{rebuildPrevPt:I,rebuildNextPt:C,rebuildLinkLine:E}=Y5e(i[(P-1+n)%n],y,new Pt(y.end(),g.start()),g,i[(m+2)%n]);I&&C&&(I!==y?(i[(P+n)%n]=I,r[r.length-1]&&(r[r.length-1]=I)):C!==g&&(i[(m+1)%n]=C,r[0]===g&&(r[0]=C)),E&&r.push(E))}}}}}),r.length===0)return null;h(e,r[0].start())||r.push(new Pt(e,r[0].start()));let s=r[r.length-1];if(r.length===1)return s instanceof br?ma.build7([br.build2(s.center,0,180,s.rx,s.ry,s.sweep()),br.build2(s.center,180,360,s.rx,s.ry,s.sweep())]):s instanceof Xi?ma.build7(s.clip(.5)):null;let a=r.map(p=>new _2t(p)),l=a[a.length-1];for(a.forEach(p=>{p.connect(l),l=p});!l.isVisited;){let p=function(){l.next.connect(g),l=l.next,l.isConnected=!1,l.isVisited=!1},m=function(){l.connect(g.prev),l.isConnected=!1},g=l.prev;if(l===g)break;let y=l.pt,b=g.pt,P=b.end();if(!l.isConnected&&!P.equals(y.start())){let T=function(C){l.isConnected=!0,l.pt=y=C,l.next.isVisited=!1},I=function(C){l.isConnected=!0,g.pt=C,g.isVisited=!1,l=g};if(y instanceof Pt)if(h(P,y.end())){p();continue}else T(new Pt(P,y.end()));else if(b instanceof Pt){h(b.start(),y.start())?m():I(new Pt(b.start(),y.start()));continue}else if(y instanceof Xi)if(h(P,y.end())&&!(y.controls.length!==2&&y.getToLineMaxDis2(y.startToEndL)>=t)){p();continue}else T(new Xi([P,...y.controls.slice(1)]));else if(b instanceof Xi)h(b.start(),y.start())&&!(b.controls.length!==2&&b.getToLineMaxDis2(b.startToEndL)>=t)?m():I(new Xi([...b.controls.slice(0,-1),y.start()]));else if(y instanceof br&&b instanceof br)if(Math.abs(Math.abs(y.sweepAngle)-180)<Math.abs(Math.abs(b.sweepAngle)-180)){let C=br.build5(P,y.end(),y.sweepAngle);if(h(C.start(),C.end())&&!(C.rx>=pE&&Math.abs(C.sweepAngle)>180)){p();continue}else T(C)}else{let C=br.build5(b.start(),y.start(),b.sweepAngle);h(C.start(),C.end())&&!(C.rx>=pE&&Math.abs(C.sweepAngle)>180)?m():I(C);continue}else throw new Error("not support")}if(po(y,y.start()).dot(po(b,b.end()))<0){let T=function(E,O,_,R,v,D){if(l.next===g){l=null;return}let{rebuildLinkLine:w,rebuildPrevPt:F,rebuildNextPt:H}=Y5e(E,O,_,R,v);F&&H&&(F!==O&&(g.prev.pt=F),H!==R&&(l.next.pt=H),w?D.pt=w:p())},I=function(){l.next===g?l=null:(l.next.connect(g.prev),l=l.next,l.isConnected=!1,l.isVisited=!1)},C=x1(b.reverse(),y).state;if(C===0){let E=j5e(y,b.start(),y.end());if(d(E)){let O=g.prev.pt,_=l.next.pt;if(po(_,_.start()).dot(po(O,O.end()))>=0){if(I(),!l)break;continue}if(T(g.prev.prev.pt,O,E instanceof Pt?E:new Pt(E.start(),E.end()),_,l.next.next.pt,l),!l)break}else l.pt=E;m();continue}else if(C===1){let E=j5e(b,b.start(),y.end());if(d(E)){let O=g.prev.pt,_=l.next.pt;if(po(_,_.start()).dot(po(O,O.end()))>=0){if(I(),!l)break;continue}if(T(g.prev.prev.pt,O,E instanceof Pt?E:new Pt(E.start(),E.end()),_,l.next.next.pt,g),!l)break}else g.pt=E;p();continue}else if(C===2){if(I(),!l)break;continue}}l.isVisited=!0,l=l.next}if(!l)return null;r.length=0;let c=l;for(r.push(l.pt),l=l.next;l!==c;)r.push(l.pt),l=l.next;if(r.length===1){let p=r[0];return p instanceof br?(h(p.start(),p.end())?r[0]=br.buildCircle(p.center,p.rx,p.sweep()):r.push(new Pt(p.end(),p.start())),ma.build7(r)):p instanceof Xi?(h(p.start(),p.end())||r.push(new Pt(p.end(),p.start())),ma.build7(r)):null}if(o=ma.build7(r),Math.abs(o.area(.1))<t)return null;return o;function h(p,m){return p.distance2(m)<t}function u(p,m){if(Math.abs(p.sweepAngle)>A2t){let g=p.sweepAngle/2;u(br.build3(p.center,p.startAngle,g,p.rx,p.ry),m),u(br.build3(p.center,p.startAngle+g,g,p.rx,p.ry),m)}else m.push(p)}function d(p){return p.start().distance2(p.end())<t&&!(p instanceof br&&p.rx>=pE&&Math.abs(p.sweepAngle)>180||p instanceof Xi&&p.controls.length!==2&&p.getToLineMaxDis2(new Pt(p.start().add1(1,0),p.end()))>=t)}}function iT(o,t){if(!o)return!0;let e=o.start(),r=o.end();if(e.distance2(r)<t**2)if(o instanceof br){if(!(o.rx>=t&&Math.abs(o.sweepAngle)>180))return!0}else if(o instanceof Xi){if(!(o.controls.length!==2&&o.getToLineMaxDis2(new Pt(o.start().add1(1,0),o.end()))>=t))return!0}else return!0;return!1}function Yk(o){if(o.direct.x===0&&o.direct.y===0)throw Error("getEndOfExtendLine(line: Line, distance: number)");let t=Math.abs(pE-o.length())+Or.eps,e={x:o.direct.normalize().x*t,y:o.direct.normalize().y*t},r=o.end();return new Ft(r.x+e.x,r.y+e.y)}function Y5e(o,t,e,r,i){if(!o)s();else if(!i)a();else{let l=po(o,o.end()),c=po(t,o.end()),h=l.dot(c);if(h>=0)s();else{let u=po(r,r.end()),d=po(i,r.end()),p=u.dot(d);if(p>=0)a();else if(TE(h,-1)&&TE(p,-1)){let m=e.center();n(m),e=null}else h>p?s():a()}}function n(l){let c;if(t instanceof Pt)c=new Pt(t.start(),l);else if(t instanceof Xi)c=new Xi([...t.controls.slice(0,-1),l]);else if(t instanceof br)c=br.build5(t.start(),l,t.sweepAngle);else throw new Error("not supported");t=iT(c,fo)?null:c;let h;if(r instanceof Pt)h=new Pt(l,r.end());else if(r instanceof Xi)h=new Xi([l,...r.controls.slice(1)]);else if(r instanceof br)h=br.build5(l,r.end(),r.sweepAngle);else throw new Error("supported");r=iT(h,fo)?null:h}function s(){if(t instanceof Pt){let l=Yk(e.reverse());e=new Pt(l,e.end());let c=new Pt(t.start(),l);t=iT(c,fo)?null:c}else if(t instanceof Xi){let l=Yk(e.reverse());e=new Pt(l,e.end());let c=new Xi([...t.controls.slice(0,-1),l]);t=iT(c,fo)?null:c}else if(t instanceof br){let l=Yk(e.reverse());e=new Pt(l,e.end());let c=br.build5(t.start(),l,t.sweepAngle);t=iT(c,fo)?null:c}else throw new Error("not supported")}function a(){if(r instanceof Pt){let l=Yk(e);e=new Pt(e.start(),l);let c=new Pt(l,r.end());r=iT(c,fo)?null:c}else if(r instanceof Xi){let l=Yk(e);e=new Pt(e.start(),l);let c=new Xi([l,...r.controls.slice(1)]);r=iT(c,fo)?null:c}else if(r instanceof br){let l=Yk(e);e=new Pt(e.start(),l);let c=br.build5(l,r.end(),r.sweepAngle);r=iT(c,fo)?null:c}else throw new Error("not supported")}return{rebuildPrevPt:t,rebuildNextPt:r,rebuildLinkLine:e}}function j5e(o,t,e){if(o instanceof Pt||t.distance2(e)<=R1)return new Pt(t,e);if(o instanceof br)return br.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?1:0);if(o instanceof Xi){let r=o.getPercent(t,fo),i=o.getPercent(e,fo);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}var _2t=class{constructor(o){this.pt=o}connect(o){this.prev=o,o.next=this}};function Xee(o){let t=Zz(),e;if(o instanceof ma){let r=lx(o);if(r===null)return null;e=r}else if(o instanceof X0){let r=o.items.map(i=>Xee(i)).filter(i=>i!==null);if(r.length===0)return null;e=new X0(r)}else{let r=o.items.map(i=>Xee(i)).filter(i=>i!==null);if(r.length===0)return null;e=new fp(r)}return yE.preprocessPolyline+=nx(t),e}var yE={addDocShapes2RTree:0,getPour:0,prepare:0,getSinglePourLayerPolyline:0,combindOutlines:0,mergeSameNet:0,run:0,end:0,deSelfIntersection:0,changeDirect:0,extend:0,preprocessPolyline:0,runBoolean:0,IntersectionSeeker:0,BooleanTools:0,totalBool:0};function Zz(){return{timeIndex:Object.assign({},yE),start:performance.now()}}function X5e(o){return Object.values(o).reduce((t,e)=>t+e,0)}function nx(o){return performance.now()-o.start-(X5e(yE)-X5e(o.timeIndex))}function cm(o,t,e,r){let i=Yl.RED,n=Yl.Golden;function s(){if(!r)return;let d=r.initColor(Yl.Golden);d.addPt(a),d.addPoint(a.end()),r.initColor(Yl.RED).addPt(l),r.draw();debugger}let a=o.getShape(),l=e?t.getShape():t.getShape().reverse(),c=po(a,l.start()),h=po(l),u=c.cross(h);if(TE(u,0))if(a instanceof Pt)if(l instanceof Pt){if(Or.eq(u,0)&&(c.dot(h)>0?!Bn(a.end(),l.start()):!Bn(a.start(),l.start())))throw s(),new Error("line and line");return u<0}else{if(l instanceof br)return c.cross(l.center.sub(a.start()))<0;if(l instanceof Xi){let d=l.getExtremePoints(a),p=d.length?d[0]:nB(l.controls,a.start());return c.cross(p.sub(a.start()))<0}else throw new Error("not support")}else if(a instanceof br){if(l instanceof Pt)return a.isCCW;if(l instanceof br){if(l.center.equals1(a.center)&&(c.dot(h)>0?!Bn(a.end(),l.start())&&a.end().sub(l.start()).dot(h)>0:!Bn(a.start(),l.start())&&a.start().sub(l.start()).dot(h)>0))throw s(),new Error("arc and arc");return l.rx>=a.rx||l.center.distance2(a.center)>a.rx2?a.isCCW:!a.isCCW}else throw new Error("not support")}else if(a instanceof Xi)if(l instanceof Pt){let d=a.getPercent(l.start(),fo),p=a.clip(d)[1],m=p.getExtremePoints(l);return(m.length?m[0]:nB(p.controls,l.start())).sub(l.start()).cross(h)<0}else if(l instanceof Xi){let d=a.getPercent(l.start(),fo),p=a.clip(d)[1],m=p.getExtremePoints(new Pt(l.start(),l.end())),g=l.getExtremePoints(new Pt(p.start(),p.end())),y=m.length?m[0]:nB(p.controls,l.start()),b=g.length?g[0]:nB(l.controls,l.start()),P=y.sub(l.start()),T=b.sub(l.start());return P.cross(T)<0}else throw Error("not support");else throw new Error("not support");else return u<0}function bM(o,t,e,r,i){let n=o.getShape(),s=t.getShape(),a=n instanceof br?LS(n,ts.toRadians(n.endAngle())):n instanceof Xi?kz(n,1):n.end().sub(n.start()).normalize(),l=po(s),c=a.dot(l);if(TE(c,-1))return cm(o,t,!0,i)?cm(o,e,r,i)&&cm(t,e,r,i):cm(o,e,r,i)||cm(t,e,r,i);{let h=a.scale(-1).angle(Ft.ORIGIN),u=l.angle(Ft.ORIGIN);h>u&&(h-=lte);let d=(h+u)/2,p=new Ft(Math.cos(d),Math.sin(d)),m=r?e.getShape():e.getShape().reverse(),g=po(m);return p.cross(g)<0?cm(o,e,r,i):cm(t,e,r,i)}}function eTe(o,t,e,r,i){let n=o.getShape(),s=t.getShape(),a=n instanceof br?LS(n,ts.toRadians(n.endAngle())):n instanceof Xi?kz(n,1):n.end().sub(n.start()).normalize(),l=po(s),c=a.dot(l);if(TE(c,-1))return cm(o,t,!0,i)?cm(o,e,r,i)&&cm(t,e,r,i):cm(o,e,r,i)||cm(t,e,r,i);{let h=a.scale(-1).angle(Ft.ORIGIN),u=l.angle(Ft.ORIGIN);h>u&&(h-=lte);let d=(h+u)/2,p=new Ft(Math.cos(d),Math.sin(d)),m=r?e.getShape():e.getShape().reverse(),g=po(m);if(p.cross(g)<0){let y=a.dot(g)<0,b=x1(y?o.getShape().reverse():o.getShape(),m).state;return b!==3&&b!==4?cm(o,e,r,i):b===(y?4:3)}else{let y=l.dot(g)<0,b=x1(y?t.getShape().reverse():t.getShape(),m).state;return b!==3&&b!==4?cm(t,e,r,i):b===(y?4:3)}}}var v2t=(o=>(o[o.NOT_IN=0]="NOT_IN",o[o.IS_IN=1]="IS_IN",o[o.IS_OVERLAP=2]="IS_OVERLAP",o))(v2t||{}),x2t=(o=>(o[o.AllClear=0]="AllClear",o[o.MapClear=1]="MapClear",o))(x2t||{}),gE,sx=!1;function nT(o,t,e,r,i,n,s,a=e.side===t,l=!0,c){return gE=i,sx=n,ZNe(JNe(o,t,l,c,s,e,a,r),e,a,r,0)}function hA(o,t,e,r,i,n,s,a=r.side===e){gE=i,sx=n;let l=QNe(o,t,e,new Map,r,a,s),c=l instanceof Array?-1:1;return ZNe(l,r,a,s,c)}function ZNe(o,t,e,r,i){for(;o instanceof Array;)i++,o.length===4?o=QNe(...o,t,e,r):o=JNe(...o,t,e,r);return{...o,existOverlap:i>0}}function JNe(o,t,e,r,i,n,s,a){if(qee===-1){a.initColor(Yl.RED).addPt(o.getShape()),a.initColor(Yl.Golden).addPt(t.getShape()),a.draw();debugger}let l=o.getShape(),c=s?t.getShape().reverse():t.getShape(),h=(l instanceof br?LS(l,e?c.start().angle(l.center):r?ts.toRadians(l.endAngle()):void 0):l instanceof Xi?po(l,e?c.start():r?l.end():l.start()):l.end().sub(l.start())).normalize(),u=(c instanceof br?LS(c,e?void 0:(r?l.end():l.start()).angle(c.center)):c instanceof Xi?po(c,e?void 0:r?l.end():l.start()):c.end().sub(c.start())).normalize();if(r===void 0){let m=h.dot(u);if(r=m<0,TE(m,0))return{state:cm(o,t,!s,a)?1:0,inter:uA(o,t,n,s,e,r,i)}}else if(r?h.dot(u)>0:h.dot(u)<0)if(e){let m,g=!0;if(l instanceof Pt&&Bn(wS.foot(l,c.start()),r?l.end():l.start()))g=!1;else if(l instanceof br||l instanceof Xi){let y=r?l.reverse():l,b=x1(c,Wbt(y,c.start()).reverse()).state;(b===1||b===2)&&(g=!1)}if(g){let y=!r;m=x1(y?l.reverse():l,c,a).state===(y?4:3)?1:0}else r?m=bM(o,o.nextSide,t,!s,a)?1:0:m=bM(o.prevSide,o,t,!s,a)?1:0;return{state:m,inter:uA(o,t,n,s,e,r,i)}}else return r?{state:cm(o,o.nextSide,!0,a)?0:1,inter:uA(o,t,n,s,e,r,i),isReversed:!0}:{state:cm(o.prevSide,o,!0,a)?0:1,inter:uA(o,t,n,s,e,r,i),isReversed:!0};let d,p=new Map([[3,4],[4,3],[0,1],[1,0],[2,2]]);if(e)if(o.judgeOverlapMap.has(t)&&!sx){let m=o.judgeOverlapMap.get(t);d=r?p.get(m.state):m.state}else d=x1(r?l.reverse():l,c).state,(d===3||d===4)&&o.judgeOverlapMap.set(t,{state:r?p.get(d):d});else{if(t.judgeOverlapMap.has(o)&&!sx){let m=t.judgeOverlapMap.get(o);d=s?p.get(m.state):m.state}else d=x1(c,r?l.reverse():l).state,(d===3||d===4)&&t.judgeOverlapMap.set(o,{state:s?p.get(d):d});d=p.get(d)}if(d===1||d===2){let m=s?t.prevSide:t,g=m.inters,y=m.getEnd();for(let b=g.length-1;b>=0;b--){let P=g[b];if(!(m.getShape()instanceof Xi)&&!Bn(y,P.coord))break;if(P===n)return{state:2,inter:uA(o,t,n,s,e,r,i)}}}if(d===3||d===4)return{state:d===(r?4:3)?1:0,inter:uA(o,t,n,s,e,r,i)};if(i.has(o)?i.get(o).mapSideList.push(t):i.set(o,{sideIsReversed:r,mapSideList:[t]}),i.has(t)?i.get(t).mapSideList.push(o):i.set(t,{sideIsReversed:s,mapSideList:[o]}),d===2)return r?[o.prevSide,o,s?t.prevSide:t.nextSide,i]:[o,o.nextSide,s?t.prevSide:t.nextSide,i];if(d===0)return[r?o.prevSide:o.nextSide,t,!1,r,i];if(d===1)return[o,s?t.prevSide:t.nextSide,!0,r,i];throw Error("not support")}function uA(o,t,e,r,i,n,s){if(sx)return null;let a=o.getShape(),l=r?t.getShape().reverse():t.getShape(),c=r;if(!i){let p=t;t=o,o=p,r=n,e=e.getBindedInter()}let h=p=>!(i?n:c)&&Bn(p,o.prevSide.getEnd())?o.prevSide:o;if(r){let p=t.inters;for(let m=0;m<p.length;m++){let g=p[m];if(g.isInvalid&&n===void 0)continue;if(g===e&&Bn(l.start(),e.coord))return i?g:g.getBindedInter();let y=g.getBindedInter().side,b=h(g.coord);if(y===b&&u(g))return d(g)}for(;;){t=t.nextSide;let m=t.inters;for(let g=0;g<m.length;g++){let y=m[g];if(y===e)return i?y:y.getBindedInter();if(s.has(t)){let b=y.getBindedInter().side;if(s.get(t).mapSideList.includes(b)||Bn(y.coord,b.getEnd())&&s.get(t).mapSideList.includes(b.nextSide))return d(y);if(s.has(b)){let P=t.getShape().reverse(),T=po(P,y.coord).dot(po(b.getShape(),y.coord))<0,I=T?b.getShape().reverse():b.getShape(),C=x1(P,T?qPe(I,y.coord,I.end()):qPe(I,I.start(),y.coord)).state;if(C===1||C===2)return d(y)}else s.has(b.nextSide)}else if(y.side===e.side&&u(y))return d(y)}}}else{let p=t.inters;for(let m=p.length-1;m>=0;m--){let g=p[m];if(g.isInvalid&&n===void 0)continue;if(g===e&&Bn(l.start(),e.coord))return i?g:g.getBindedInter();let y=g.getBindedInter().side,b=h(g.coord);if(y===b&&u(g))return d(g)}for(;;){t=t.prevSide;let m=t.inters;for(let g=m.length-1;g>=0;g--){let y=m[g];if(y===e)return i?y:y.getBindedInter();if(s.has(t)){let b=y.getBindedInter().side;if(s.get(t).mapSideList.includes(b)||Bn(y.coord,y.getBindedInter().side.getEnd())&&s.get(t).mapSideList.includes(b.nextSide))return d(y);if(!s.has(b)&&s.has(b.prevSide)){let P=t.getShape().reverse(),T=po(P,y.coord).dot(po(b.getShape(),y.coord))<0;if(s.has(b.prevSide)){let I=T?b.getShape().reverse():b.getShape(),C=x1(t.getShape(),qPe(I,y.coord,I.end())).state;if(C===1||C===2)return d(y)}}}else if(y.side===e.side&&u(y))return d(y)}}}function u(p){if(p.isInvalid||p.getBindedInter().side!==(Bn(p.coord,o.prevSide.getEnd())?o.prevSide:o))return!1;let m;if(i){if(Bn(p.coord,l.start()))return!0;m=x1(n?a.reverse():a,g(l)).state}else{if(Bn(p.coord,n?a.end():a.start()))return!0;m=x1(l,g(n?a.reverse():a)).state}return m===2||m===1;function g(y){if(y instanceof Pt)return Bn(p.coord,y.end())?y:y.cutLine(p.coord);if(y instanceof br)return br.build2(y.center,y.startAngle,p.coord.angleD(y.center),y.rx,y.ry,y.isCCW?1:0);if(y instanceof Xi)return y.clip(y.getPercent(p.coord,fo))[0];throw new Error("not supported operation")}}function d(p){let m=e.getBindedInter(),g=e.side,y=m.side,b=e===p,P=e;if(r){let T=e.getIndex()-1;for(;g;){let I=g.inters;for(;T>=0;T--)if(e=I[T],e===p){b||(e.setIsInvalid(),e.isDealed(),P=e),g=null;break}else if(gE===0)!e.isInvalid&&(!Bn(e.coord,p.coord)||e.side===p.side&&e.getBindedInter().side===p.getBindedInter().side)&&(e.setIsInvalid(),e.isDealed(),P=e);else if(gE===1){if(e.isInvalid)continue;let C=e.getBindedInter().side;s.has(g)&&s.get(g).mapSideList.includes(C)&&(e.setIsInvalid(),e.isDealed(),P=e)}g=g==null?void 0:g.prevSide,T=(g==null?void 0:g.inters.length)-1}}else{let T=e.getIndex()+1;for(;g;){let I=g.inters;for(;T<I.length;T++){e=I[T];let C=e.getBindedInter();if(e===p){b||(e.setIsInvalid(),e.isDealed(),P=e),g=null;break}else if(gE===0)!e.isInvalid&&(!Bn(e.coord,p.coord)||g===p.side&&(Bn(C.side.getEnd(),e.coord)?C.side.nextSide:C.side)===p.getBindedInter().side)&&(e.setIsInvalid(),e.isDealed(),P=e);else if(gE===1){let E=C.side;s.has(g)&&s.get(g).mapSideList.includes(E)&&(e.setIsInvalid(),e.isDealed(),P=e)}}g=g==null?void 0:g.nextSide,T=0}}if(gE===0&&!Bn(m.coord,p.coord))if(i?s.has(y)?s.get(y).sideIsReversed:n:c){let T=m.getIndex()-1;for(;y;){let I=s.has(y),C=y.inters;for(;T>=0;T--){if(m=C[T],m===p.getBindedInter()){y=null;break}m.isInvalid||!I||(!Bn(m.coord,p.getBindedInter().coord)||m.side===p.side&&m.getBindedInter().side===p.getBindedInter().side)&&(m.setIsInvalid(),m.isDealed())}y=y==null?void 0:y.prevSide,T=(y==null?void 0:y.inters.length)-1}}else{let T=m.getIndex()+1;for(;y;){let I=y.inters,C=s.has(y);for(;T<I.length;T++){if(m=I[T],m===p.getBindedInter()){y=null;break}let E=Bn(y.getEnd(),m.coord)?s.has(y.nextSide):!1;m.isInvalid||!(C||E)||(!Bn(m.coord,p.getBindedInter().coord)||m.side===p.side&&m.getBindedInter().side===p.getBindedInter().side)&&(m.setIsInvalid(),m.isDealed())}y=y==null?void 0:y.nextSide,T=0}}return i?P:P.getBindedInter()}}function QNe(o,t,e,r,i,n,s){let a=o.getShape(),l=t.getShape(),c=n?e.getShape().reverse():e.getShape(),h=(a instanceof br?LS(a,c.start().angle(a.center)):a instanceof Xi?po(a,c.start()):a.end().sub(a.start())).normalize(),u=(l instanceof br?LS(l,c.start().angle(l.center)):l instanceof Xi?po(l,c.start()):l.end().sub(l.start())).normalize(),d=h.dot(u);if(TE(d,-1)){let p=n?e.getShape().reverse():e.getShape(),m=po(p).normalize(),g=h.add(u.scale(-1)).normalize().dot(m),y=x1(a.reverse(),l,s).state;if(g>-.9&&(y===3||y===4))return{state:y===4?0:1,inter:uA(t,e,i,n,!0,!1,r)};let b=nT(o,e,i,s,gE,sx,r.size===0?new Map:r,n);return b.state===2?b:y===4?b.state===0||b.inter!==i?b:nT(t,e,i,s,gE,sx,r.size===0?new Map:r,n):b.state===1||b.inter!==i?b:nT(t,e,i,s,gE,sx,r.size===0?new Map:r,n)}else{let p=h.scale(-1).angle(Ft.ORIGIN),m=u.angle(Ft.ORIGIN);p>m&&(p-=lte);let g=(p+m)/2,y=new Ft(Math.cos(g),Math.sin(g)),b=po(c).normalize(),P=b.angle(Ft.ORIGIN),T=p<P&&P<m&&a instanceof Pt&&l instanceof Pt&&c instanceof Pt;if(y.cross(b)<=0){if(h.scale(-1).dot(b)<0){let I;return i.coord.equals1(c.start())?I=po(a,i.coord).dot(po(c,i.coord))<0:c instanceof Pt&&(I=po(a,a.end()).dot(c.direct)<0),{state:bM(o,t,e,!n,s)?1:0,inter:uA(o,e,i,n,!0,I,r)}}return T&&a.distance2(c.start())>R1?[t,e,!0,void 0,r]:[o,e,!0,void 0,r]}else return u.dot(b)<=0?{state:bM(o,t,e,!n,s)?1:0,inter:uA(t,e,i,n,!0,void 0,r)}:T&&l.distance2(c.start())>R1?[o,e,!0,void 0,r]:[t,e,!0,void 0,r]}}var qee=0;function R2t(o,t,e,r){let i=t.getBindedInter(),n=t.side,s=i.side,a=n.getShape(),l=s.getShape();if(r&&(qee++,qee===-1)){r.initColor(Yl.RED).addPt(a),r.initColor(Yl.Golden).addPt(l),r.draw();debugger}let c=0,h=!1;if(o===-1){let O=hA(n,n.nextSide,s,i,c,h,r),_=O.state!==0;if(O.state===2){let v=po(a,t.coord).add(po(n.nextSide.getShape(),t.coord)).normalize(),D=po(l,t.coord).add(po(s.nextSide.getShape(),t.coord)).normalize();return E(_,v.dot(D)>0)}let R=hA(n,n.nextSide,s.nextSide,i,c,h,r);return O.state!==R.state?(C(O,R),1):E(_,O.state!==hA(s,s.nextSide,n,t,c,!0,r).state,O.inter,R.inter)}if(o===1){let O=nT(n,s,i,r,c,h,new Map),_=O.state!==0;if(O.state===2)return E(_,po(a,t.coord).dot(po(l,t.coord))>0);let R;if(O.isReversed&&O.existOverlap&&Bn(O.inter.coord,s.getEnd())&&O.inter.getBindedInter().side!==n){let w=O.inter.getBindedInter().side;if(w===n.nextSide)R={state:bM(n,w,s.nextSide,!0,r)?1:0,inter:i};else if(w===n.prevSide){if(R={state:bM(w,n,s.nextSide,!0,r)?1:0,inter:O.inter},O.state===R.state&&t!==O.inter){let F=po(l,t.coord),H=po(s.nextSide.getShape(),t.coord),z=po(w.getShape(),t.coord);return E(_,F.add(H).dot(z)>0,O.inter,R.inter)}}else R=nT(n,s.nextSide,i,r,c,h,new Map)}else R=nT(n,s.nextSide,i,r,c,h,new Map);if(O.state!==R.state)return C(O,R),1;let v=po(l,t.coord),D=po(s.nextSide.getShape(),t.coord);if(TE(v.dot(D),-1)){let w=cm(s,s.nextSide,!0,r);return E(_,O.state!==nT(s.nextSide,n,t,r,c,!0,new Map,w?!_:_,!1).state,O.inter,R.inter)}else{let w=po(a,t.coord);return E(_,v.add(D).dot(w)>0,O.inter,R.inter)}}if(!(a instanceof Xi||l instanceof Xi))return 1;let u=po(a,t.coord),d=po(l,t.coord),p,m;if(l instanceof Pt)p=new Pt(t.coord,l.start()),m=new Pt(t.coord,l.end());else if(l instanceof br){let O=t.coord.angleD(l.center);p=br.build2(l.center,O,l.startAngle,l.rx,l.ry,l.isCCW?0:1),m=br.build2(l.center,O,l.endAngle(),l.rx,l.ry,l.isCCW?1:0)}else if(l instanceof Xi){let O=l.getPercent(t.coord,fo);[p,m]=l.clip(O),p=p.reverse()}else throw new Error("not support");let g=u.dot(d)>0,y,b;g?(y=x1(a.reverse(),p).state,b=x1(a,m).state):(y=x1(a,p).state,b=x1(a.reverse(),m).state);let P;y===0?P=nT(g?n.prevSide:n.nextSide,s,i,r,c,h,new Map,!0,!1,g):y===1?P=nT(n,s.prevSide,i,r,c,h,new Map,!0,!0,g):y===2?g?P=hA(n.prevSide,n,s.prevSide,i,c,h,r,!0):P=hA(n,n.nextSide,s.prevSide,i,c,h,r,!0):g?y===3?P={inter:i,state:0}:P={inter:i,state:1}:y===3?P={inter:i,state:1}:P={inter:i,state:0};let T=P.state!==0;if(P.state===2)return E(T,g);let I;if(b===0?I=nT(g?n.nextSide:n.prevSide,s,i,r,c,h,new Map,!1,!1,!g):b===1?I=nT(n,s.nextSide,i,r,c,h,new Map,!1,!0,!g):b===2?g?I=hA(n,n.nextSide,s.nextSide,i,c,h,r,!1):I=hA(n.prevSide,n,s.nextSide,i,c,h,r,!1):g?b===3?I={inter:i,state:1}:I={inter:i,state:0}:b===3?I={inter:i,state:0}:I={inter:i,state:1},P.state===I.state)return P.inter===I.inter?(t.setIsInvalid(),0):E(T,g,P.inter,I.inter);return C(P,I),1;function C(O,_){let R=O.state!==0;if(O.inter===_.inter){t.setOutToIn(R);return}else jk(O.inter,_.inter,!0),jk(_.inter,O.inter,!1);let v=[];if(o===-1){let w=po(a,t.coord),F=po(n.nextSide.getShape(),t.coord),H=po(l,t.coord),z=po(s.nextSide.getShape(),t.coord);v.push(w.dot(H)),v.push(w.dot(z)),v.push(F.dot(H)),v.push(F.dot(z))}else{let w=po(a,t.coord);v.push(po(l,t.coord).dot(w)),v.push(po(s.nextSide.getShape(),t.coord).dot(w))}if(v.reduce((w,F)=>Math.abs(w)>Math.abs(F)?w:F,0)>0)if(e===1||e===0||e===2||e===3)t.setOutToIn(R);else throw new Error("not support");else if(e===1)D(!R);else if(e===0||e===2||e===3)D(R);else throw new Error("not support");function D(w){t.setIsInvalid();let F=(w?O:_).inter;delete F.isInvalid,delete F.getBindedInter().isInvalid,F.setOutToIn(!R)}}function E(O,_,R,v){if(R===v){if(t.side.outline.inters.find(F=>!F.isInvalid&&F!==t&&Bn(F.coord,t.coord)))return t.setIsInvalid(),0;let D=new dA(t.coord,n,r),w=new dA(t.coord,s,r);return D.bind(w),_?n.inters.splice(t.getIndex(),0,D):n.inters.splice(t.getIndex()+1,0,D),s.inters.splice(t.getBindedInter().getIndex(),0,w),D.setOutToIn(O),t.setOutToIn(!O),D.isDealed(),n.inters.forEach((F,H)=>F.setIndex(H)),s.inters.forEach((F,H)=>F.setIndex(H)),2}else{let D=function(){let w=R.getBindedInter(),F=v.getBindedInter();delete R.isInvalid,delete w.isInvalid,delete v.isInvalid,delete F.isInvalid,R.setOutToIn(!O),v.setOutToIn(O),jk(R,v,!0),jk(v,R,!1),jk(w,F,_),jk(F,w,!_)};if(t.setIsInvalid(),_){if(e===1||e===0||e===2||e===3)return D(),2;throw new Error("not support")}else{if(e===1)return O?0:(D(),2);if(e===0||e===2||e===3)return O?(D(),2):0;throw new Error("not support")}}}}function jk(o,t,e){let{judge:r,changeNum:i}=s(),n=o.getIndex();for(let a=n+i,l=o.side.inters;r(a);a+=i){if(l[a].isInvalid)continue;if(!Bn(l[a].coord,o.coord))break;l[a].setIndex(n),l[n].setIndex(a);let c=l[a];l[a]=l[n],l[n]=c,n=a}function s(){let a=o.side===t.side;if(e){let l=a?t.getIndex():o.side.inters.length;return{judge:c=>c<l,changeNum:1}}else{let l=a?t.getIndex()+1:0;return{judge:c=>c>=l,changeNum:-1}}}}var q5e=0,dA=class{constructor(o,t,e){this.id=q5e++,this.coord=o,this.side=t,e&&(this.id=q5e++,this.drawDebug=e);let r=new Bb;r.ext2(o),this._bbox=r.build1()}bbox(){return this._bbox}resetVisitStatus(){this.visited=!1,this.bindedInter.visited=!1}isDealed(){this.dealed=!0,this.getBindedInter().dealed=!0}setOutToIn(o){this.outToIn=o,this.bindedInter.outToIn=!o}setIsInvalid(){this.isInvalid=!0,this.getBindedInter().isInvalid=!0}getBindedInter(){return this.bindedInter}bind(o){this.bindedInter=o,o.bindedInter=this}setIndex(o){this.index=o}isSorted(){return this.index!==void 0}getIndex(){return this.index}getVisited(){return this.visited}visitSelf(){this.visited=!0}visit(){this.visited=!0,this.bindedInter.visited=!0}getPrevPoint(){let o=this.getIndex(),t=this.side.getStart();return o&&(t=this.side.inters[o-1].coord),t}getTangent(){let o=this.side.getShape();if(o instanceof Pt)return o.end().sub(o.start());if(o instanceof br){let t=this.coord.angle(o.center);return o.isCCW?t+=Uee:t-=Uee,new Ft(Math.cos(t),Math.sin(t))}else{if(o instanceof Xi)return kz(o,o.getPercent(this.coord,fo));throw new Error("not support")}}findStartInter(){return this.outToIn===void 0?this.getTangent().cross(this.bindedInter.getTangent())>0?this:this.bindedInter:this.outToIn?this:this.bindedInter}run(){let o=[],t=this,e;if(this.drawDebug){tTe++;let r=tTe===-1,i=this.drawDebug.initColor(Yl.RED);if(r){this.drawDebug.draw();debugger}e=n=>{if(o.push(n),r){i.addPt(o[o.length-1]),this.drawDebug.draw();debugger}}}else e=r=>o.push(r);for(;!t.visited;){let r=function(a,l){if(Or.eq(a.distance2(l),0))return;let c=Kz.rebuild(n.getShape(),a,l);if(!c)return!0;e(c)};t.visit();let i=t.getIndex(),n=t.side,s=n.inters[i+1];for(;s!=null&&s.isInvalid;)s=n.inters[s.getIndex()+1];if(s)r(t.coord,s.coord),t=s.bindedInter;else{let a=r(t.coord,n.getEnd()),l=t.coord;for(n=n.nextSide,t=null;;){for(let c of n.inters)if(!c.isInvalid){t=c.bindedInter;break}if(t)break;a?(r(l,n.getEnd()),a=!1):e(n.getShape()),n=n.nextSide}a?(Or.eq(l.distance2(t.coord),0)?r(l,n.getEnd()):r(l,t.coord),a=!1):Or.eq(n.getEnd().distance2(t.coord),0)?e(n.getShape()):r(n.getStart(),t.coord)}}if(t!==this)throw this.drawDebug&&console.log(JSON.stringify({runId:tTe,handleId:qee,boolId:Oz})),new Error("inter !== this");return lx(ma.build7(o))}},tTe=0,rTe=class RTe{constructor(t,e,r,i,n){this.inters=[],this.allInterIsInvalid=!0,this.isVisit=!1,this.sides=t,this.isGroup1=r,this.isOutside=i,this.finalIsOutside=i,this.polyline=e,n&&(this.polygon=n),t.forEach(s=>s.outline=this)}static build(t,e,r,i,n){let s=t.primitives.map(l=>new Kz(l,i)),a=s[s.length-1];return s.forEach(l=>{a.connect(l),a=l}),n?new RTe(s,t,e,r,n):new RTe(s,t,e,r)}setFinalIsOutSide(t){this.finalIsOutside=t}startAndEndIsSameOutsideFlag(){return this.isOutside===this.finalIsOutside}get hasInter(){return!!this.interOutlines}isAllInterIsInvalid(){return this.allInterIsInvalid}setAllInterIsInvalidToFalse(){this.allInterIsInvalid=!1}resetVisited(){this.isVisit=!1}intersect(t,e){if(!(t.interOutlines&&t.interOutlines===this.interOutlines))if(t.interOutlines)if(this.interOutlines){let r,i;this.interOutlines.length>t.interOutlines.length?(r=this.interOutlines,i=t.interOutlines):(r=t.interOutlines,i=this.interOutlines),i.forEach(n=>{r.push(n),n.interOutlines=r}),e.delete(i)}else t.interOutlines.push(this),this.interOutlines=t.interOutlines;else this.interOutlines?(this.interOutlines.push(t),t.interOutlines=this.interOutlines):(t.interOutlines=this.interOutlines=[this,t],e.add(this.interOutlines))}isContain(t){if(!this.polyline.bbox().extendOfSize(fo).isContainsBBox(t.polyline.bbox()))return!1;let e=t.polyline.primitives[0].start();if(t.hasInter&&t.isAllInterIsInvalid()){let r=t.inters[0];r.getBindedInter().side.outline!==this?e=r.side.getCenterPoint():e=r.side.getCenterPoint(r.coord)}return!!this.polyline.getWindingNum(e)}isInternally(t){return!!this.polyline.getWindingNum(t)}isEqual(t){return this.polyline===t.polyline}bbox(){return this.polyline.bbox()}reverse(){this.sides.reverse();let t=this.sides[this.sides.length-1];this.sides.forEach(e=>{e.reverse(),t.connect(e),t=e})}returnPolyline(){let t=this.sides.map(r=>r.getShape()),e=this.polyline.primitives;if(this.sides.length===e.length){let r=new Set(e);if(!t.some(i=>!r.has(i)))return this.polyline}return ma.build7(t)}};function $5e(o,t,e){let r=[];return o.forEach(i=>i.forEach(n=>{if(n.hasInter&&!n.isAllInterIsInvalid())return;let s=n.bbox(),a=t.search(s.extendOfSize(fo)).filter(l=>l.bbox().extendOfSize(fo).isContainsBBox(s)).sort((l,c)=>l.bbox().area()-c.bbox().area());for(let l of a)if(l.isContain(n)){let c=e(!n.isOutside,l.isOutside),h=e(n.isOutside,l.isOutside);c!==h&&(r.push(n),n.setFinalIsOutSide(!c));return}e(n.isOutside,!1)!==e(!n.isOutside,!1)&&r.push(n)})),r}function D2t(o,t,e){let r;switch(e){case 0:r=(a,l)=>a&&l;break;case 1:r=(a,l)=>a||l;break;case 2:r=(a,l)=>a&&!l;break;case 3:r=(a,l)=>a&&!l||!a&&l;break;default:throw Error("not support the rule")}let i=new Bz(10),n=new Bz(10);o.forEach(a=>a.forEach(l=>i.add(l))),t.forEach(a=>a.forEach(l=>n.add(l)));let s=$5e(o,n,r);return $5e(t,i,(a,l)=>r(l,a)).forEach(a=>s.push(a)),s}var w2t=class{constructor(o){this.roots=[],this.nodes=o.sort((t,e)=>t.bbox().minX-e.bbox().minX).map(t=>new L2t(t)),this.nodes.forEach((t,e)=>{t.visit()&&(this.roots.push(t),this.build(e))})}build(o){let t=this.nodes[o];for(let e=o+1,r=this.nodes.length;e<r;e++){let i=this.nodes[e];if(t.key.bbox().maxX<i.key.bbox().minX)break;i.getIsVisit()||t.isContain(i)&&(i.visit(),t.addChild(i),this.build(e))}}getPolygons(){let o=[];return this.roots.forEach(t=>t.getPolygons().forEach(e=>o.push(e))),o}},L2t=class{constructor(o){this.children=[],this.isVisit=!1,this.key=o}getIsVisit(){return this.isVisit}isContain(o){return this.key.isContain(o.key)}addChild(o){this.children.push(o)}getPolygons(){let o=[];return this.getPolylineList(o),o.map(t=>{let e=t[0].polygon;if(e&&e.items.length===t.length){let r=t.map(n=>n.returnPolyline()),i=new Set(e.items);return r.some(n=>!i.has(n))?new X0(r):e}else return new X0(t.map(r=>r.returnPolyline()))})}getPolylineList(o,t){t?(t.push(this.key),t=null):(t=[this.key],o.push(t)),this.children.forEach(e=>e.getPolylineList(o,t))}visit(){return this.isVisit?!1:(this.isVisit=!0,!0)}};function K5e(o){let t="";return o.items.forEach((e,r)=>{let i="$";if(e.items.forEach((n,s)=>{let a="[";if(n.primitives.forEach((l,c)=>{let h="";if(l instanceof Pt)h=`Line,${l.start().x},${l.start().y},${l.end().x},${l.end().y}`;else if(l instanceof br)h=`Arc,${l.center.x},${l.center.y},${l.startAngle},${l.sweepAngle},${l.rx}`;else if(l instanceof Xi)h=`Bezier,${l.controls.map(u=>`${u.x},${u.y}`).join(",")}`;else throw new Error("not supported");if(c===n.primitives.length-1){a+=`${h}]`;return}a+=`${h},`}),s===e.items.length-1){i+=`${a}$`;return}i+=`${a}_`}),r===o.items.length-1){t+=`${i}`;return}t+=`${i}^`}),console.log(t),t}function Z5e(o){let t=o.split("^"),e=[];return t.forEach(i=>{let n=/\$(.*?)\$/,s=i.match(n)[1].split("_"),a=[];s.forEach(c=>{let h=/\[(.*?)\]/,u=c.match(h)[1].split(","),d=[],p=[];for(let g=0;g<u.length;g++){let y=u[g];if(y==="Line"||y==="Arc"||y==="Bezier"){if(d.length){let b=r(d);p.push(b),d.length=0}d.push(y);continue}d.push(Number(y))}d.length&&(p.push(r(d)),d.length=0);let m=ma.build7(p);a.push(m)});let l=new X0(a);e.push(l)}),new fp(e);function r(i){let n=i[0];if(n==="Line")return new Pt(new Ft(i[1],i[2]),new Ft(i[3],i[4]));if(n==="Arc")return br.build3(new Ft(i[1],i[2]),i[3],i[4],i[5],i[5]);if(n==="Bezier"){let s=[];for(let a=1;a<i.length;a+=2)s.push(new Ft(i[a],i[a+1]));return new Xi(s)}else throw new Error("not support")}}var M2t=class{constructor(o=1){this.group1Str="$[Line,20193.777980000017,4122.200439600661,20193.77082,4211.848760073709,Arc,20193.972672902382,4211.8487570980205,179.99915535323618,-89.99540000050294,0.2018529024026465,Line,20193.972659672283,4212.050609999989,20193.972660393258,4212.039610000013,Arc,20193.97217289501,4211.848257065248,89.85403133887164,89.99540000041924,0.19135355574930143,Line,20193.78082,4211.848759926291,20193.78897999998,4122.200440479205,Line,20193.78897999998,4122.200440479205,20193.777980000017,4122.200439600661]$",this.group2Str="$[Arc,20209.72784128151,4122.2007625157785,258.46768032837986,-75.66780748375947,4.138846238512183,Line,20205.593935808283,4121.998590004101,20193.97982992629,4121.998600000001,Arc,20193.97983290198,4122.2004529023825,269.9991553532362,-89.99540000050297,0.20185290240401074,Arc,20193.782979999996,4122.20044,180.00375535340328,-180.0000000000027,0.004999999999025513,Arc,20193.979332869207,4122.200952909754,180.15347936671733,89.99540000008247,0.19135355575111057,Line,20193.97983008845,4122.009599999999,20205.603694309226,4122.003828485546,Arc,20209.733142304296,4122.194577876843,182.64475341258483,75.73379999998886,4.133851239977064,Line,20208.900400396684,4118.145470939558,20208.902599535475,4118.156248870184,Arc,20206.972515961093,4108.700057667588,78.46393309088245,-78.46759999998636,9.65115405866796,Arc,20216.618669999996,4108.69944,359.99996825446135,-180,0.004999999999200412,Arc,20206.973015966745,4108.699445349495,359.99996822365375,78.46759999998409,9.640654033253735]$^$[Line,20193.997796883676,4095.399470032799,20205.596133314026,4095.4013992171836,Arc,20209.72470159858,4095.1923799234505,177.10172964919312,-75.64935037184974,4.133855965730166,Arc,20209.73000213952,4095.198565517174,101.5415133143569,75.7293000000185,4.128850963459707,Line,20205.605834328744,4095.395161923586,20193.997203529463,4095.389485743675,Arc,20193.994588809255,4095.197684525904,89.21896662213764,4.544099999999517,0.19181903946188483,Arc,20193.981499796217,4095.1977402038,89.85034659953621,89.9999999995926,0.19135044893494071,Arc,20193.78515,4095.19824,0,-180,0.005,Arc,20193.98200016982,4095.1982398301675,179.99995179248322,-89.99999999974185,0.20185016982129908,Arc,20193.981986624152,4095.198185381971,89.9961078637802,-4.487285276547311,0.2019046184835962]$",this.rule=o}getGroup1(){return Z5e(this.group1Str)}getGroup2(){return Z5e(this.group2Str)}},iTe=new ate(2),Ez=class{getUnion(o,t=!0){return t&&(o=o.map(e=>this.asSameSweep([e])[0])),y2t(Jbt,o)}asSameSweep(o){let t=0;return o.forEach(e=>t+=e.area(.01)),t>0?o.map(e=>e.reverse()):o}getSubtraction(o,t){let e=new wz(!1),r=new Lz(vee.rule,iTe,e);for(let i of o){let n=vee.weight(0);r.addPolyline(i,n)}for(let i of t){let n=vee.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}getIntersection(o,t){let e=new wz(!1),r=new Lz(xee.rule,iTe,e);for(let i of o){let n=xee.weight(0);r.addPolyline(i,n)}for(let i of t){let n=xee.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}getMutuallyExclusive(o,t){let e=new wz(!1),r=new Lz(KPe.rule,iTe,e);for(let i of o){let n=KPe.weight(0);r.addPolyline(i,n)}for(let i of t){let n=KPe.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}},Oz=0,nTe=!1;function Az(o,t,e,r,i){let n=Zz(),s=[],a=[],l=[],c=new Set,h;if(i){if(h=new $z(i),Oz++,nTe){debugger;nTe=!1;let I=new M2t;Az(I.rule,I.getGroup1(),I.getGroup2(),r,i)}if(Oz===-1||nTe){console.table({rule:o,group1:K5e(t),group2:K5e(e)}),h.clear();let I=h.initColor(Yl.GREEN),C=h.initColor(Yl.WHITE),E=h.initColor(Yl.BLUE),O=h.initColor(Yl.Gray);t.items.forEach(_=>_.items.forEach((R,v)=>{v>0?C.addPly(R):I.addPly(R)})),e.items.forEach(_=>_.items.forEach((R,v)=>{v>0?O.addPly(R):E.addPly(R)})),h.draw();debugger}}let u=t.items.length!==0&&e.items.length!==0?t.bbox().extendOfSize(fo).intersection1(e.bbox().extendOfSize(fo)):null;if(u){let I=[],C=[];switch(o){case 0:{for(let E of t.items)E.bbox().isIntersect(u)&&I.push(E);for(let E of e.items)E.bbox().isIntersect(u)&&C.push(E);break}case 1:case 3:{for(let E of t.items)E.bbox().isIntersect(u)?I.push(E):s.push(E);for(let E of e.items)E.bbox().isIntersect(u)?C.push(E):s.push(E);break}case 2:{for(let E of t.items)E.bbox().isIntersect(u)?I.push(E):s.push(E);for(let E of e.items)E.bbox().isIntersect(u)&&C.push(E);break}default:throw new Error("not support")}I.length!==t.items.length&&(t=new fp(I)),C.length!==e.items.length&&(e=new fp(C))}else{switch(o){case 0:break;case 1:case 3:{t.items.forEach(I=>s.push(I)),e.items.forEach(I=>s.push(I));break}case 2:{t.items.forEach(I=>s.push(I));break}default:throw new Error("not support")}t=new fp([]),e=new fp([])}P(t,a,!0),P(e,l,!1);let d=o===2||o===3?(I,C)=>Bn(I.getEnd(),C)?I.nextSide:I:(I,C)=>Bn(I.prevSide.getEnd(),C)?I.prevSide:I,p=(I,C,E)=>{if(Bn(I.getEnd(),E)){if(I.inters.findIndex(O=>O.getBindedInter().side===C&&Bn(O.coord,I.getEnd()))===-1)return new dA(E,I,h)}else return new dA(E,I,h)},m=o===2||o===3?(I,C,E)=>{if(Bn(I.getStart(),E)){if(I.inters.findIndex(O=>O.getBindedInter().side===C&&Bn(O.coord,I.getStart()))===-1)return new dA(E,I,h)}else return new dA(E,I,h)}:p;r.seek(t,e,(I,C,E,O,_,R)=>{let v=a[I][C],D=l[O][_],w=v.sides[E],F=D.sides[R],H=wI(w.getShape(),F.getShape());if((w.getShape()instanceof Xi||F.getShape()instanceof Xi)&&H>=4){if(w.getShape()instanceof br||F.getShape()instanceof br){let G=function(L,B){let N=!1;for(let U=0;U<B.length;U+=2)Bn(new Ft(B[U],B[U+1]),L)&&(N=!0);N||B.push(L.x,L.y)},W=[at[0],at[1]];for(let L=0;L<H;L+=2){let B=new Ft(at[L],at[L+1]);for(let N=L+2;N<H;N+=2){let U=new Ft(at[N],at[N+1]);if(!Bn(B,U)){G(U,W);break}}}H=W.length,W.forEach((L,B)=>at[B]=L)}else for(let G=H-2;G>=2;G-=2)for(let W=G-2;W>=0;W-=2)if(Bn(new Ft(at[G],at[G+1]),new Ft(at[W],at[W+1]))){at[W]=(at[G]+at[W])/2,at[W+1]=(at[G+1]+at[W+1])/2;for(let L=H-3;L>=G;L--)at[L]=at[L+2];H-=2;break}}let z=0;if(H===4){let G=function(B){return Bn(w.getEnd(),B)||Bn(w.prevSide.getEnd(),B)||Bn(F.prevSide.getEnd(),B)||Bn(F.getEnd(),B)},W=new Ft(at[0],at[1]),L=()=>{let B=new dA(W,w,h),N=new dA(W,F,h);B.bind(N),B.setIsInvalid(),B.isDealed(),v.inters.push(B),D.inters.push(N)};if(at[0]===at[2]&&at[1]===at[3])if(G(W))z=2;else{L();return}}for(;z<H;z+=2){let G=new Ft(at[z],at[z+1]),W=w,L=F;if(Bn(W.prevSide.getEnd(),G)&&(W=W.prevSide),L=d(L,G),w!==W&&F!==L){let N=o===2||o===3?F.getEnd():L.getEnd();W.getEnd().distance1(G)<N.distance1(G)?(G=W.getEnd(),Bn(N,G)||(L=F)):(G=N,Bn(W.getEnd(),G)||(W=w))}let B=p(W,L,G);if(B){let N=m(L,W,G);N&&(W.addInter(B),v.inters.push(B),L.addInter(N),D.inters.push(N),B.bind(N),v.intersect(D,c))}}return H},i);let g=T(),y=D2t(a,l,o);y.forEach(I=>!I.startAndEndIsSameOutsideFlag()&&I.reverse()),new w2t(g.concat(y)).getPolygons().forEach(I=>s.push(I));let b=new fp(s);if(h){if(Oz===-1){let I=h.initColor(Yl.RED),C=h.initColor(Yl.Golden);s.forEach(E=>{I.addPly(E.items[0]),E.items.slice(1).forEach(O=>C.addPly(O))}),h.draw();debugger;throw new Error}b.id=Oz}return yE.BooleanTools+=nx(n),b;function P(I,C,E){I.items.forEach(O=>{let _=[];_.push(rTe.build(O.items[0],E,!0,h,O)),O.items.slice(1).forEach(R=>{_.push(rTe.build(R,E,!1,h))}),C.push(_)})}function T(){let I=[];return c.forEach(E=>{o===2||o===3?E.forEach(_=>{_.isGroup1||_.reverse(),_.sides.forEach(R=>R.sortInters())}):E.forEach(_=>_.sides.forEach(R=>R.sortInters())),E.map(_=>_.sides.filter(R=>R.inters.length)).flat(2).sort((_,R)=>{let v=_.inters,D=R.inters,w=Bn(v[v.length-1].coord,_.getEnd()),F=Bn(D[D.length-1].coord,R.getEnd());if(w&&F){let H=0,z=0;for(let G=v.length-2;G>=0&&Bn(v[G].coord,_.getEnd());G--)H++;for(let G=D.length-2;G>=0&&Bn(D[G].coord,R.getEnd());G--)z++;return z-H}else return w?-1:1}).forEach(_=>{_.inters.forEach(R=>{if(R.dealed)return;let v=R.side,D=R.getBindedInter().side,w;Bn(v.getEnd(),R.coord)&&Bn(D.getEnd(),R.coord)?w=-1:Bn(v.getEnd(),R.coord)?(w=1,R=R.getBindedInter()):Bn(D.getEnd(),R.coord)&&(w=1);let F=R2t(w,R,o,h);R.isDealed(),F&&(v.outline.setAllInterIsInvalidToFalse(),D.outline.setAllInterIsInvalidToFalse())})}),O(E),o===3&&(E.forEach(_=>{_.reverse(),_.sides.forEach(R=>{R.sortInters(),R.inters.forEach(v=>{v.resetVisitStatus()})})}),O(E));function O(_){_.forEach(R=>{R.inters.forEach(v=>{if(v.isInvalid||v.getVisited())return;let D=v.findStartInter(),w=C(o)?D.run():D.getBindedInter().run(),F=R.polyline.primitives;if(w){if(F.length===w.primitives.length){let H=new Set(F);if(!w.primitives.some(z=>!H.has(z))){I.push(R);return}}I.push(rTe.build(w,!0,!0,h))}})})}}),I;function C(E){switch(E){case 0:case 2:case 3:return!0;case 1:return!1;default:throw Error("not support the rule")}}}}var yee=/\bstablilizetion\b/.test(self.location.href)||!0,bee={intersect(o,t,e,r){try{return Az(0,o,t,e,r)}catch(i){if(yee){let n=new Ez().getIntersection(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new fp(n.map(s=>new X0(s.items)))}throw i}},union(o,t,e,r){try{return Az(1,o,t,e,r)}catch(i){if(yee){let n=new Ez,s=o.items.map(l=>l.items.map(c=>c)).flat(2);t.items.forEach(l=>l.items.forEach(c=>s.push(c)));let a=n.getUnion(s);return new fp(a.map(l=>new X0(l.items)))}throw i}},diff(o,t,e,r){try{return Az(2,o,t,e,r)}catch(i){if(yee){let n=new Ez().getSubtraction(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new fp(n.map(s=>new X0(s.items)))}throw i}},xor(o,t,e,r){try{return Az(3,o,t,e,r)}catch(i){if(yee){let n=new Ez().getMutuallyExclusive(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new fp(n.map(s=>new X0(s.items)))}throw i}}},N2t=class extends Lz{constructor(o,t,e,r,i,n){super(o.rule,ate.DUMMY,t),this.sideGroup1=[],this.sideGroup2=[],this.group1=e,this.group2=r,this.seeker=i,this.addGroup(e,o.weight(0),this.sideGroup1),this.addGroup(r,o.weight(1),this.sideGroup2),this.bus=n}addGroup(o,t,e){if(!o)debugger;o.items.forEach(r=>{let i=[];r.items.forEach(n=>{let s=this.sides.length;this.addPolyline(n,t),i.push(this.sides.slice(s))}),e.push(i)})}seekIntersection(){this.seeker.seek(this.group1,this.group2,(o,t,e,r,i,n)=>{let s=this.sideGroup1[o][t][e],a=this.sideGroup2[r][i][n],l=wI(s.shape,a.shape);for(let c=0;c<l;c+=2){let h=new Ft(at[c],at[c+1]);s.inters.push(h),a.inters.push(h),this.event.onIntersect(h,s,a)}return l},this.bus)}},k2t=class extends wz{constructor(o){super(!!o),o&&(this.drawDebug=new $z(o),this.blueDrawing=this.drawDebug.initColor(Yl.BLUE),this.greenDrawing=this.drawDebug.initColor(Yl.GREEN),this.redDrawing=this.drawDebug.initColor(Yl.RED))}onOriginSide(o){super.onOriginSide(o),this.debug&&this.blueDrawing.addPt(o.shape)}onPolylineGroup(o,t){super.onPolylineGroup(o,t),this.debug&&o.items.forEach(e=>this.greenDrawing.addPly(e))}draw(){this.drawDebug.draw()}};function oTe(o,t,e,r,i){let n=Zz(),s=new k2t(i);new N2t(o,s,t,e,r,i).simplify();let a=[];s.plGrps.forEach(c=>{let h=c.items.map(u=>Xee(u));h[0]&&a.push(new X0(h.filter(u=>u)))});let l=new fp(a);return yE.BooleanTools+=nx(n),l}var sTe=!0,bz={intersect(o,t,e,r){try{return bee.intersect(o,t,e,r)}catch(i){if(sTe)throw i;return console.error(i),oTe(xee,o,t,e,r)}},union(o,t,e,r){try{return bee.union(o,t,e,r)}catch(i){if(sTe)throw i;return console.error(i),oTe(Qbt,o,t,e,r)}},diff(o,t,e,r){try{return bee.diff(o,t,e,r)}catch(i){if(sTe)throw i;return console.error(i),oTe(vee,o,t,e,r)}},xor(o,t,e,r){return bee.xor(o,t,e,r)}},B2t=class{init(o){}seek(o,t,e,r){let i=o.bbox().extendOfSize(5e-6).intersection1(t.bbox().extendOfSize(5e-6));if(!i)return;let n=Zz(),s=[];for(let d=0,p=o.items.length;d<p;d++){let m=o.items[d];if(i.isIntersect(m.bbox()))for(let g=0,y=m.items.length;g<y;g++){let b=m.items[g];if(i.isIntersect(b.bbox()))for(let P=0,T=b.primitives.length;P<T;P++){let I=b.primitives[P].bbox();i.isIntersect(I)&&s.push({bbox:I,polygonIndex:d,polylineIndex:g,ptIndex:P})}}}let a=s.length;if(a===0){yE.IntersectionSeeker+=nx(n);return}let l=[];for(let d=0,p=t.items.length;d<p;d++){let m=t.items[d];if(i.isIntersect(m.bbox()))for(let g=0,y=m.items.length;g<y;g++){let b=m.items[g];if(i.isIntersect(b.bbox()))for(let P=0,T=b.primitives.length;P<T;P++){let I=b.primitives[P].bbox();i.isIntersect(I)&&l.push({bbox:I,polygonIndex:d,polylineIndex:g,ptIndex:P})}}}let c=l.length;if(c===0){yE.IntersectionSeeker+=nx(n);return}if(a<5||c<5){for(let d=0,p=s.length;d<p;d++)for(let m=0,g=l.length;m<g;m++)if(s[d].bbox.isIntersect(l[m].bbox.extendOfSize(1e-5))){let y=s[d],b=l[m];e(y.polygonIndex,y.polylineIndex,y.ptIndex,b.polygonIndex,b.polylineIndex,b.ptIndex)}yE.IntersectionSeeker+=nx(n);return}s.sort((d,p)=>d.bbox.minX-p.bbox.minX),l.sort((d,p)=>d.bbox.minX-p.bbox.minX);let h=0,u=0;for(;h<a&&u<c;)if(s[h].bbox.minX<l[u].bbox.minX){let d=s[h],p=d.bbox;for(let m=u;m<c;m++){let g=l[m],y=g.bbox;if(y.minX>p.maxX+1e-5)break;(p.minY<y.minY?y.minY:p.minY)<(p.maxY<y.maxY?p.maxY:y.maxY)+1e-5&&e(d.polygonIndex,d.polylineIndex,d.ptIndex,g.polygonIndex,g.polylineIndex,g.ptIndex)}h++}else{let d=l[u],p=d.bbox;for(let m=h;m<a;m++){let g=s[m],y=g.bbox;if(y.minX>p.maxX+1e-5)break;(y.minY<p.minY?p.minY:y.minY)<(y.maxY<p.maxY?y.maxY:p.maxY)+1e-5&&e(g.polygonIndex,g.polylineIndex,g.ptIndex,d.polygonIndex,d.polylineIndex,d.ptIndex)}u++}yE.IntersectionSeeker+=nx(n)}},xy,Rg=(xy=class{static getDebug(){return xy.drawDebug||(xy.drawDebug=new $z(xy.curBus)),xy.drawDebug}static getDrawing(o=Yl.GREEN){return this.getDebug().initColor(o)}static clearDrawing(){xy.getDebug().clear()}static drawText(o,t,e=Yl.GREEN){xy.getDrawing(e).addText(o,t,1.5,.1,!0)}static drawBBox(o,t=Yl.GREEN){if(!o)return;let e=xy.getDrawing(t),r=new Pt(o.UL(),o.UR()),i=new Pt(o.UR(),o.LR()),n=new Pt(o.LR(),o.LL()),s=new Pt(o.LL(),o.UL());e.addPt(r),e.addPt(i),e.addPt(n),e.addPt(s)}static drawPolyType(o,t){let e=xy.getDrawing(t);if(o instanceof ma)e.addPly(o);else if(o instanceof X0)for(let r of o.items)r instanceof ma?e.addPly(r):this.drawPolyType(r,t);else if(o instanceof fp)for(let r of o.items)this.drawPolyType(r,t)}static translate(o){switch(o){case 0:return"\u2229";case 2:return"-";case 1:return"U";case 3:return"X";default:break}}},xy.UseRunArrange=!0,xy.UseOptimizeSplit=!0,xy.LocalBestThread=4,xy.HandleDiff=!0,xy.OcTreeSplitStep=4,xy.PrintStart=new Ft(150,-200),xy),Pz=class DTe{static getPolyTypeLine(t){let e=[];if(t instanceof ma)for(let r of t.primitives)e.push(r);else if(t instanceof X0)for(let r of t.items)if(r instanceof ma)for(let i of r.primitives)e.push(i);else{let i=this.getPolyTypeLine(r);for(let n of i)e.push(n)}else if(t instanceof fp)for(let r of t.items){let i=this.getPolyTypeLine(r);for(let n of i)e.push(n)}return e}static getPolyTypePolyLine(t){let e=[];if(t instanceof ma)e.push(t);else if(t instanceof X0)for(let r of t.items)if(r instanceof ma)e.push(r);else{let i=this.getPolyTypePolyLine(r);for(let n of i)e.push(n)}else if(t instanceof fp)for(let r of t.items){let i=this.getPolyTypePolyLine(r);for(let n of i)e.push(n)}return e}static getListBBox(t){if(t.length<=0)return;let e=new Bb;for(let r of t){let i=DTe.getSingleBBox(r);e.ext1(i)}return e.build1()}static getSingleBBox(t){if(t instanceof Array){let e=new Bb,r=DTe.getListBBox(t.slice(1));return e.ext1(r),e.build1()}else return t.bbox()}static doDrawRule(t,e=Rg.PrintStart){if(t.length<2)return[e,e,e];let r=5,i=10,n=t[0],s=Rg.translate(n),a=[],l=e.y,c=e.x,h=e.x;e=e.add(new Ft(0,-i));for(let p=1;p<t.length;p++){let m=t[p];if(m instanceof Array){e=e.add(new Ft(r,0));let g=this.doDrawRule(m,e);a.push(g[0]),g[1].x<=c&&(c=g[1].x),g[2].x>=h&&(h=g[2].x),e=new Ft(g[2].x+r,e.y)}else a.push(e.clone()),e.x<=c&&(c=e.x),e.x>=h&&(h=e.x),Rg.drawText(e,m.name),e=e.add(new Ft(r,0))}let u=0;for(let p of a)u+=p.x;let d=new Ft(u/a.length,e.y+i);Rg.drawText(d,"N:"+s);for(let p of a){let m=new Pt(p,d),g=new Array;g.push(m);let y=ma.build1(CTe(g));Rg.drawPolyType(y,Yl.GREEN)}return[d,new Ft(c,l),new Ft(h,l)]}static drawRule(t,e=Rg.PrintStart,r=!1,i){Rg.clearDrawing(),this.doDrawRule(t,e),r&&this.doDrawRulePolygon(t,i),Rg.getDebug().draw()}static doDrawRulePolygon(t,e){let r=t[0];for(let i=1;i<t.length;i++){let n=t[i];if(n instanceof Array)this.doDrawRulePolygon(n,e);else{let s=e;r===2&&i===1&&(s=Yl.RED),n.name&&Rg.drawText(n.bbox().UL(),n.name,s),Rg.drawPolyType(n,s)}}}static IsCenterBBoxPointInPolygonType(t,e){let r=t.center();for(let i of e.items)if(i.getOutMostPolyline().getWindingNum(r))return!0;return!1}static KeepBBoxPolygonGroup(t,e){let r=e.bbox().intersection1(t);if(!r)return!1;for(let i of e.items)if(i.bbox().isIntersect(r)){for(let n of i.items)if(n.bbox().isIntersect(r)){for(let s of n.primitives)if(r.isIntersect(s.bbox()))return!0}}return!!this.IsCenterBBoxPointInPolygonType(t,e)}},F2t=class Jk{static createNode(t,e,r){let i=t.UL(),n=t.width()/e,s=t.height()/e,a=~~(r/e),l=r-a*e,c=i.x+l*n,h=i.y-(a+1)*s,u=c+n,d=h+s;return new _1(c,u,h,d)}static ocTreeSplitNode(t,e,r,i,n=2){if(t.length<=r)return t;let s=[],a=n**2,l=new Array(a),c=new Array(a);for(let p=0;p<a;p++)l[p]=new Array(t.length),c[p]=0;let h=e.UL(),u=e.width()/n,d=e.height()/n;for(let p of t){let m=i(p).center(),g=~~((m.x-h.x)/u),y=~~((h.y-m.y)/d)*n+g;try{l[y][c[y]]=p,c[y]+=1}catch{s.push(p)}}for(let p=0;p<l.length;p++){let m=c[p];if(m<=0)continue;let g=l[p].slice(0,m);if(g.length===t.length)return t;let y=Jk.createNode(e,n,p),b=Jk.ocTreeSplitNode(g,y,r,i,n);if(b.length===t.length)return t;s.push(b)}return s}static ocTreeSplitNodeMinIntersect(t,e,r,i){let n=[];if(t.length<=r)return t;let s=3,a=e.LL(),l=e.UR(),c=e.width()/(s+1),h=e.height()/(s+1),u=-(2**32),d=[],p=[];for(let m=1;m<=s;m++)for(let g=1;g<=s;g++){let y=a.x+c*m,b=a.y+h*g,P=[[],[],[],[]],T=new Array(4),I=new Array(4);I[0]=new _1(a.x,y,b,l.y),I[1]=new _1(y,l.x,b,l.y),I[2]=new _1(a.x,y,a.y,b),I[3]=new _1(y,l.x,a.y,b);for(let _ of t){let R=i(_).center(),v=-1,D=-1;R.x===y?v=Math.random()>=.5?1:-1:R.x>y?v=1:R.x<y&&(v=-1),R.y===b?D=Math.random()>=.5?1:-1:R.y>b?D=1:R.y<b&&(D=-1),v===1&&D===1?P[1].push(_):v===1&&D===-1?P[3].push(_):v===-1&&D===-1?P[2].push(_):v===-1&&D===1&&P[0].push(_)}for(let _=0;_<4;_++){let R=P[_];if(R.length<=0)continue;let v=new Bb;for(let D of R)v.ext1(i(D));T[_]=v.build1()}let C=0,E=0;for(let _ of T)_&&(C+=_.area());E=C;let O=(_,R)=>{if(!T[_]||!T[R])return 0;let v=T[_].intersection1(T[R]);return v?v.area():0};E-=O(0,1),E-=O(0,2),E-=O(0,3),E-=O(1,2),E-=O(1,3),E-=O(2,3),E/C>=u&&(d=P,p=I)}for(let m=0;m<d.length;m++){let g=d[m];if(g.length<=0)continue;let y=p[m],b;if(g.length===t.length?b=Jk.ocTreeSplitNode(g,y,r,i):b=Jk.ocTreeSplitNodeMinIntersect(g,y,r,i),b.length===t.length)return t;n.push(b)}return n}static ocTreeSplit(t,e,r,i){return Jk.ocTreeSplitNode(t,e,r,i,Rg.OcTreeSplitStep)}},V2t=class e7e{static simplifyRules(t,e){return Rg.UseOptimizeSplit&&(t=this.optimizeSplit(t,e)),t}static OcTreeOptimizeSplit(t){let e=t[0];if(e!==1||t.length<=Rg.LocalBestThread+1)return t;let r=t.slice(1),i=new Array(r.length);for(let c=1;c<t.length;c++)i[c-1]=c;let n=Pz.getListBBox(r),s=F2t.ocTreeSplit(i,n,Rg.LocalBestThread,c=>{let h=t[c];return Pz.getSingleBBox(h)}),a=(c,h)=>{if(!(c.length<=0))for(let u of c)if(Array.isArray(u)){let d=[h[0]];a(u,d),h.push(d)}else{let d=t[u];h.push(d)}},l=[e];return a(s,l),l}static optimizeSplit(t,e){let r=t[0];if(r===2){if(Rg.HandleDiff){let n=t[1],s;if(Array.isArray(n)){let a=this.optimizeSplit(n,e);if(a.length<=1)return[2];s=wTe(a,e)}else s=wTe([2,n],e);if(t.length>3){let a;a=[1];for(let l=2;l<t.length;l++){let c=t[l];if(Array.isArray(c)){let h=Pz.getListBBox([...c.slice(1)]);Pz.KeepBBoxPolygonGroup(h,s)&&a.push(c)}else Pz.KeepBBoxPolygonGroup(c.bbox(),s)&&a.push(c)}return a.length<=1?[2,s]:(a=this.optimizeSplit(a,e),a.length>1?[2,s,...a.slice(1)]:[2,s])}else{let a=t[2];if(Array.isArray(a)&&a[0]===1&&a.length>2){let l=a.slice(1);return this.optimizeSplit([2,s,...l],e)}}}else if(t.slice(1).length>2){let n=t[1],s=t.slice(2),a=this.optimizeSplit([1,...s],e);return a.length>1?[2,n,...a.slice(1)]:n}}else if(r===1){if(t.length-1>Rg.LocalBestThread){let n=!1;for(let s=1;s<t.length;s++){let a=t[s];if(!Array.isArray(a)){n=!0;break}}n&&(t=e7e.OcTreeOptimizeSplit(t))}}else if(r===0&&t.length<=2)return[0];let i=[r];for(let n=1;n<t.length;n++){let s=t[n];if(Array.isArray(s)){let a=this.optimizeSplit(s,e);if(a.length<=1)continue;i.push(a)}else i.push(s)}return i}},G2t=(o=>(o[o.INTERSECT=0]="INTERSECT",o[o.UNION=1]="UNION",o[o.DIFF=2]="DIFF",o[o.XOR=3]="XOR",o))(G2t||{});function _z(o){let t=o[0],e=[t];switch(t){case 0:for(let i=1;i<o.length;i++){let n=o[i];if(Array.isArray(n)&&(n=_z(n),!n))return null;e.push(n)}break;case 1:case 3:for(let i=1;i<o.length;i++){let n=o[i];Array.isArray(n)&&(n=_z(n),!n)||e.push(n)}break;case 2:let r=o[1];if(Array.isArray(r)&&(r=_z(r)),!r)return null;e.push(r);for(let i=2;i<o.length;i++){let n=o[i];Array.isArray(n)&&(n=_z(n),!n)||e.push(n)}break;default:throw new Error("not support boolean rule!")}return e.length===1?null:e}function aTe(o,t,e){return Array.isArray(o)?t7e(o,t,e):o}function lTe(o,t,e,r,i=!0){if(i)for(;o.length>1;){let n,s=[];for(o.length%2===1?(s.push(o[0]),n=1):n=0;n<o.length;n+=2)s.push(t(o[n],o[n+1],e,r));o=s}else for(;o.length>1;){if(o.length===2)return t(o[0],o[1],e,r);o=[t(o[0],o[1],e,r),...o.slice(2)]}return o[0]}function t7e(o,t,e,r=!0){let i=new Array(o.length-1);for(let n=1;n<o.length;n++)i[n-1]=aTe(o[n],t,e);switch(o[0]){case 0:return lTe(i,bz.intersect,t,e);case 1:return lTe(i,bz.union,t,e);case 2:let n=lTe(i.slice(1),bz.union,t,e);return n?bz.diff(i[0],n,t,e):i[0];case 3:let s=aTe(o[1],t,e);for(let a=2;a<o.length;a++)s=bz.xor(s,aTe(o[a],t,e),t,e);return s;default:throw new Error("not support boolean rule! "+o[0])}}function r7e(o){let t=[o[0]];for(let e=1;e<o.length;e++){let r=o[e];if(Array.isArray(r)){let i=r7e(r);Array.isArray(i)?i.length>1&&t.push(i):t.push(i)}else{let i=Xee(r);i!==null&&t.push(fp.build(i))}}return t}function U2t(o,t){Rg.curBus=t,o=r7e(o);let e;return Rg.UseRunArrange?e=V2t.simplifyRules(o,t):e=_z(o),e.length<=1?new fp([]):wTe(e,t)}function wTe(o,t,e=!0){if(!o||o.length===1)return new fp([]);let r=o,i=new B2t,n=[];function s(a){for(let l=1;l<a.length;l++){let c=a[l];Array.isArray(c)?s(c):n.push(c)}}return s(r),i.init(n),t7e(r,i,t,e)}var Pee=new Error("list is empty"),Tee=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},H2t=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},W2t=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},z2t=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw Pee;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw Pee;return this.remove(o),o.item}addLast(o){if(this.first===null||this.last===null){let t=new Tee(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new Tee(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw Pee;return this.first.item}getLast(){if(this.last===null)throw Pee;return this.last.item}insertAfter(o,t){let e=new Tee(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new Tee(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new H2t(this.first)}listIterator(){return new W2t(this.first)}toArray(){let o=new Array,t=this.first;for(;t!=null;)o.push(t.item),t=t.next;return o}},Dee=class{constructor(o){this.inters=[],o&&(this.inters=o)}addInter(o){this.inters.push(o),o.group=this}findInter(o){let t=this.inters.find(e=>Bn(e.coord,o.coord));return t&&this.inters.find(e=>e.side===o.side)&&o.visitSelf(),t}getOutInter(o){let t=this.inters.filter(e=>!e.getVisited());if(t.length!==0)return t.length===1?t[0]:t.reduce((e,r)=>{if(!e||e.side.getShape()===o)return r;if(r.side.getShape()===o)return e;let i=e.coord,n=po(o,i),s=po(e.side.getShape(),i),a=po(r.side.getShape(),i);return n.dot(s)>n.dot(a)?e:r},void 0)}getEntryInter(){}},cTe=0;function i7e(o,t){let e=o.primitives[0];if(o.primitives.length===1&&e instanceof br&&Math.abs(e.sweepAngle)===360)return[o];let r=Zz();cTe++;let i,n=Q2t(o);if(n.length===0)return[];let s=X2t(n);if(cTe===-1){i=new $z(t);let h=i.initColor(Yl.BLUE);n.forEach(d=>h.addPt(d.getShape()));let u=i.initColor(Yl.GREEN);s.forEach(d=>u.addPoint(d.coord)),i.draw();debugger;throw new Error}if(s.length===0)return[ma.build7(n.map(h=>h.getShape()))];q2t(s);let a=[],l=!1;try{Z2t(s,i)}catch(h){h.customType==="IS_OVERLAP"?(l=!0,a=new Ez().getUnion([o]).map(u=>u.items).flat(2)):console.error(h)}if(l)return a;let c=K2t(s);if(!c.length)return[ma.build7(n.map(h=>h.getShape()))];if(a=Y2t(c,i),a.length===0)return console.warn("=====deSelfIntersection=====",cTe),[];if(i)throw a.forEach(h=>{i.initColor(Yl.WHITE).addPly(h),i.draw();debugger}),new Error;return yE.deSelfIntersection+=nx(r),a}function Y2t(o,t){let e=[];return o.forEach(r=>{let i=r;r.inters.forEach(n=>{if(n.getVisited())return;let s=[],a=[],l;if(t){debugger;let h=t.initColor(Yl.RED);l=u=>{s.push(u),h.addPt(s[s.length-1]),t.draw();debugger}}else l=h=>s.push(h);do{let h=function(g,y){Or.eq(g.distance2(y),0)||l(n7e(p.getShape(),g,y))},u=a.findIndex(g=>g===n.group);if(u!==-1){let g=s.findIndex(P=>P===n.group),y=s.splice(g).filter(P=>!(P instanceof Dee));if(y.length){let P=lx(ma.build7(y));P&&e.push(P)}let b=s.filter(P=>!(P instanceof Dee));if(n=a[u].getOutInter(b[b.length-1]),a.splice(u),!n)throw Error("interGroup not hav inter!!!2");continue}n.visitSelf(),a.push(n.group),s.push(n.group);let d=n.getIndex(),p=n.side,m=p.inters[d+1];for(;m!=null&&m.isInvalid||m&&m.group===n.group;)m=p.inters[m.getIndex()+1];if(m){h(n.coord,m.coord);let g=m.getBindedInter();if(n=g.getVisited()?g.group.getOutInter(g.side.getShape()):g,!n){if(m.group===i)break;throw new Error("interGroup not hav inter!!!3")}}else{for(h(n.coord,p.getEnd()),p=p.nextSide,n=null;;){for(let g of p.inters)if(!g.isInvalid){let y=g.group.getOutInter(p.getShape());if(!y){if(g.group===i){n=g;break}else if(g.getBindedInter().group===i){n=g.getBindedInter();break}continue}n=y;break}if(n)break;l(p.getShape()),p=p.nextSide}Or.eq(p.getEnd().distance2(n.coord),0)?l(p.getShape()):h(p.getStart(),n.coord)}}while(n.group!==i);let c=lx(ma.build7(s.filter(h=>!(h instanceof Dee))));c&&e.push(c)})}),e}function j2t(o){return{next(){return o.hasNext()?{value:o.next()}:{done:!0,value:void 0}},[Symbol.iterator](){return this}}}function X2t(o){let t=[],e=new z2t;for(let r of o.slice().sort((i,n)=>i.bbox().minY-n.bbox().minY)){for(let i of j2t(e.listIterator())){let n=i.item;if(n.bbox().maxY<r.bbox().minY)e.remove(i);else{let s=function(d,p){let m=new dA(p,d,null);return d.inters.push(m),t.push(m),m},a=function(d,p){let m=d.getEnd(),g=new Ft(at[0],at[1]),y=new Ft(at[2],at[3]),b=m.distance2(g)>m.distance2(y)?g:y,P=d.prevSide;s(Bn(P.getEnd(),b)?P:d,b).bind(s(p,b))},l=n.getShape(),c=r.getShape(),h=wI(l,c),u=h===4&&at[0]===at[2]&&at[1]===at[3];if(u&&(h-=2),n.nextSide===r)n.prevSide!==r&&h===4&&a(n,r);else if(n.prevSide===r)h===4&&a(r,n);else if(h!==0){let d=function(m,g){let y=m.prevSide;return s(Bn(y.getEnd(),g)?y:m,g)},p=new Ft(at[0],at[1]);if(u&&!Bn(p,n.prevSide.getEnd())&&!Bn(p,r.prevSide.getEnd())&&po(l,p).dot(po(c,p))>0)continue;for(let m=0;m<h;m+=2){let g=new Ft(at[m],at[m+1]);d(n,g).bind(d(r,g))}}}}e.add(r)}return t.forEach(r=>{r.getIndex()===void 0&&r.side.sortInters()}),t}function q2t(o){o.forEach(t=>{let e=t.side.getEnd();if(t.isInvalid||!Bn(t.coord,e))return;let r=t.side.inters,i=t.getBindedInter().side;for(let n=r.length-1;n>=0;n--){let s=r[n];if(!Bn(s.coord,e))break;s!==t&&s.getBindedInter().side===i&&s.setIsInvalid()}})}function $2t(o){let t=new Bz(10);return o.forEach(e=>{e.isInvalid||t.add(e)}),t}function K2t(o){let t=[],e=$2t(o);return o.forEach(r=>{if(r.isInvalid||r.group)return;let i=e.search(r.bbox().extendOfSize(Or.eps)).filter(n=>!n.group);if(i.length){let n=new Set,s=new Dee(i);i.forEach(a=>{a.group=s,n.has(a.side)&&a.visitSelf(),n.add(a.side)}),t.push(s)}}),t}function Z2t(o,t){o.forEach(e=>{if(e.isInvalid||e.dealed)return;let r=e.side,i=e.getBindedInter().side,n;Bn(r.getEnd(),e.coord)&&Bn(i.getEnd(),e.coord)?n=-1:Bn(r.getEnd(),e.coord)?r.nextSide!==i&&(n=1,e=e.getBindedInter()):Bn(i.getEnd(),e.coord)&&i.nextSide!==r&&(n=1),J2t(n,e,t),e.isDealed()})}function J2t(o,t,e){let r=t.getBindedInter(),i=t.side,n=r.side,s=i.getShape(),a=n.getShape(),l=1,c=!1;if(o===-1){if(zk(s.reverse(),a.reverse())||zk(i.nextSide.getShape(),n.nextSide.getShape())){let u=hA(i,i.nextSide,n,r,l,c,e);if(u.state===2){let p=new Error("info1.state === InState.IS_OVERLAP");throw p.customType="IS_OVERLAP",p}let d=hA(i,i.nextSide,n.nextSide,r,l,c,e);u.state===d.state&&h(u,d)}else if(!(zk(s.reverse(),n.nextSide.getShape())||zk(i.nextSide.getShape(),a.reverse()))){let u=eTe(i,i.nextSide,n,!1,e);u===eTe(i,i.nextSide,n.nextSide,!0,e)&&u!==eTe(n,n.nextSide,i.nextSide,!0,e)&&t.setIsInvalid()}}else if(o===1){let u=function(d,p){return po(d,p.start()).dot(po(p,p.start()))>0};if(zk(s.reverse(),a.reverse())||zk(s,n.nextSide.getShape())){let d=nT(i,n,r,e,l,c,new Map);if(d.state===2){let m=new Error("info1.state === InState.IS_OVERLAP");throw m.customType="IS_OVERLAP",m}let p=nT(i,n.nextSide,r,e,l,c,new Map);d.state===p.state&&h(d,p)}else if(u(s.reverse(),a.reverse())&&u(s,n.nextSide.getShape())){let d=cm(i,n,!1,e);d===cm(i,n.nextSide,!0,e)&&d!==bM(n,n.nextSide,new Kz(n7e(s,t.coord,s.end()),e),!0,e)&&t.setIsInvalid()}}function h(u,d){u.inter.setIsInvalid(),d.inter.setIsInvalid(),t.setIsInvalid()}}function n7e(o,t,e){if(o instanceof Pt||t.distance2(e)<1e-6)return new Pt(t,e);if(o instanceof br)return br.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.sweep());if(o instanceof Xi){let r=o.getPercent(t,fo),i=o.getPercent(e,fo);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function Q2t(o){let t=lx(o);if(!t)return[];let e=t.primitives.map(i=>new Kz(i,null)),r=e[e.length-1];return e.forEach(i=>{r.connect(i),r=i}),e}var Xk,ePt=(Xk=class{static clearData(o){this.originalPrimitive=[],this.offsetPrimitive=[],this.rawOffsetPrimitive=[],this.offsetDistance=0,this.testI++,this.testI===0?this.drawDebug=new $z(o):delete this.drawDebug}static createRawOffsetEdge(){if(this.drawDebug){let o=this.drawDebug.initColor(Yl.WHITE);this.originalPrimitive.forEach(t=>o.addPt(t)),this.drawDebug.draw();debugger}for(let o=0;o<this.originalPrimitive.length;o+=1){let t=this.originalPrimitive[o];this.offsetPrimitive.push({index:o,offsetEdge:this.createOffsetEdge(t)})}if(this.drawDebug){let o=this.drawDebug.initColor(Yl.Golden);this.offsetPrimitive.forEach(t=>o.addPt(t.offsetEdge)),this.drawDebug.draw();debugger}if(this.offsetPrimitive.length>1)for(let o=0;o<this.offsetPrimitive.length;o+=1)if(o===this.offsetPrimitive.length-1){this.connectPrimitive(this.offsetPrimitive[o],this.offsetPrimitive[0]);let t=this.rawOffsetPrimitive[0],e;t instanceof br?e=br.build4(this.offsetPrimitive[0].offsetEdge.start(),t.end(),t.center,t.rx,t.ry,t.sweep()):e=new Pt(this.offsetPrimitive[0].offsetEdge.start(),t.end()),this.rawOffsetPrimitive.shift(),this.rawOffsetPrimitive.unshift(e)}else this.connectPrimitive(this.offsetPrimitive[o],this.offsetPrimitive[o+1]);else this.rawOffsetPrimitive=[]}static createCirclePrimitive(o,t){let e=o.width()*.5,r=o.height()*.5,i=Math.sqrt(e**2+r**2)+t;return[br.buildCircle(o.center(),i)]}static getExtendPolyLine(o,t,e=!0,r){var i,n;if(!((i=o==null?void 0:o.primitives)!=null&&i.length))return[];let s=lx(o);if(!((n=s==null?void 0:s.primitives)!=null&&n.length)){if(this.isExpansion){let l=[1],c=t*2;o.primitives.forEach(u=>l.push(u.stroke(c,1,0)));let h=U2t(l,r);if(h.items.length!==1)throw new Error("group.items.length !== 1 ");return[h.items[0].items[0]]}return[]}if(o=s,this.clearData(r),this.originalPrimitive=o.primitives,this.isExpansion=t>0,this.offsetDistance=t,this.createRawOffsetEdge(),this.drawDebug){let l=this.drawDebug.initColor(Yl.BLUE);this.rawOffsetPrimitive.forEach(c=>l.addPt(c)),this.drawDebug.draw();debugger}let a=e?this.createClippingEdge(r):[ma.build2(this.rawOffsetPrimitive)];if(this.drawDebug){let l=this.drawDebug.initColor(Yl.RED);a.forEach(c=>l.addPly(c)),this.drawDebug.draw();debugger}if(a.length&&(!this.isExpansion||this.isExpansion&&a.length>1)&&(a=this.getValidityPrimitive(a)),this.drawDebug){let l=this.drawDebug.initColor(Yl.GREEN);a.forEach(c=>l.addPly(c)),this.drawDebug.draw();debugger;throw new Error}return a}static getValidityPrimitive(o){let t=[],e=Math.abs(this.offsetDistance);for(let r=0;r<o.length;r+=1){let i=!0,n=o[r].primitives;e:for(let s=0;s<n.length;s+=1){let a=n[s],l;if(a instanceof br)l=a.midPoint;else if(a instanceof Pt)l=a.start();else throw new Error("not support!");for(let c=0;c<this.originalPrimitive.length;c+=1){let h=this.originalPrimitive[c],u;if(h instanceof br?u=this.pointArcClosest(l,h):u=Nbt(l,h.start(),h.end()).d,e-u>.01){i=!1;break e}}}i&&t.push(o[r])}return t}static getInters(o){let t=[];for(let e=0;e<o;e+=2)t.push(new Ft(at[e],at[e+1]));return t}static pointArcClosest(o,t){let e=t.center;if(o.equals1(t.center))return t.rx;if(t.inArea(o,0)){let n=o.sub(e);return Math.abs(n.length()-t.rx)}let r=o.distance2(t.start()),i=o.distance2(t.end());return Or.less(r,i)?Math.sqrt(r):Math.sqrt(i)}static createClippingEdge(o){let t=[],e=[],r=i7e(ma.build2(this.rawOffsetPrimitive),o);r.forEach(n=>{let s=n.area(.01);t.push(s)});let i=Math.min(...t.filter(n=>n<0));for(let n=0;n<t.length;n+=1){let s=t[n];Or.eq(s,0)||(!this.isExpansion&&s<0||this.isExpansion&&(s<0&&t[n]===i||s>0))&&e.push(r[n])}return e}static createOffsetEdge(o){if(o instanceof br)return o.panDistance1(this.offsetDistance);if(o instanceof Pt)return o.panDistance(this.offsetDistance);throw new Error("not support!")}static connectPrimitive(o,t){o.offsetEdge instanceof Pt&&t.offsetEdge instanceof Pt?this.lineToLineConnect(o,t):o.offsetEdge instanceof br&&t.offsetEdge instanceof br?this.arcToArcConnect(o,t):o.offsetEdge instanceof Pt&&t.offsetEdge instanceof br?this.lineToArcConnect(o,t):this.arcToLineConnect(o,t)}static isFalseIntersection(o){return o>1||o<0}static lineToLineConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=t.index,n=this.originalPrimitive[i].start();if(e.isParallel(r))e.bbox().intersection1(r.bbox())?this.rawOffsetPrimitive.push(e):this.lineToLineUseArcToConnect(n,e,r);else{let s=this.getLineToLineT(e,r),a=s[0],l=s[1];if(this.isFalseIntersection(a)||this.isFalseIntersection(l))a>1&&this.isFalseIntersection(l)?this.lineToLineUseArcToConnect(n,e,r):this.useLineToConnect(e,r);else if(!this.isFalseIntersection(a)&&!this.isFalseIntersection(l)){let c=e.end().sub(e.start()),h=e.start().add(c.mul(a)),u=new Pt(e.start(),h);this.rawOffsetPrimitive.push(u);let d=new Pt(h,r.end());this.updateNextOffsetPrimitive(i,d)}}}static updateNextOffsetPrimitive(o,t){this.offsetPrimitive[o].offsetEdge=t}static useLineToConnect(o,t){this.rawOffsetPrimitive.push(o);let e=new Pt(o.end(),t.start());this.rawOffsetPrimitive.push(e)}static lineToLineUseArcToConnect(o,t,e){let r=this.getSweep(o,t),i=this.getSweepAngel(t.end(),e.start(),o,r);if(i===0){this.useLineToConnect(t,e);return}this.rawOffsetPrimitive.push(t);let n=br.build5(t.end(),e.start(),i);this.rawOffsetPrimitive.push(n)}static getSweep(o,t,e){let r=null,i=e||e===0?this.originalPrimitive[e]:t;if(i instanceof br){let n=i.center.sub(i.end()).normalize();i.isCCW?r=new Ft(n.y,-n.x):r=new Ft(-n.y,n.x)}else r=t.end().sub(t.start()).normalize();return o.sub(t.end()).normalize().cross(r)>0?0:1}static getLineToLineT(o,t){let e=o.end().sub(o.start()),r=t.end().sub(t.start()),i=e.cross(r),n=t.start().sub(o.start()),s=o.start().sub(t.start()),a=n.cross(r)/i,l=s.cross(e)/-i;return[a,l]}static lineToArcConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.getLineJoinArcScalarAndIntersectionNum(e,r),a=this.originalPrimitive[n].start();if(s.intersectionNum===0)this.lineAndArcUseArcConnect(a,e,r,i);else if(s.intersectionNum===1){let l=s.points[0];this.lineAndArcConnectionDetail(e,r,s.t[0],l,a,i,n)}else if(s.intersectionNum===2){let l=s.points[0],c=s.points[1],h=l.distance2(a),u=c.distance2(a);this.lineAndArcConnectionDetail(e,r,h<u?s.t[0]:s.t[1],h<u?l:c,a,i,n)}}static lineAndArcConnectionDetail(o,t,e,r,i,n,s){let a=this.isTrueArcIntersection(t,r);if(!this.isFalseIntersection(e)&&a){let l=new Pt(o.start(),r);this.rawOffsetPrimitive.push(l);let c;!t.center.equals1(r)||t.sweepAngle>1e-4?(c=br.build4(r,t.end(),t.center,t.rx,t.ry,t.sweep()),c instanceof br&&c.sweepAngle===0&&(c=new Pt(c.start(),c.end()))):c=new Pt(t.center,r),this.updateNextOffsetPrimitive(s,c)}else a?this.useLineToConnect(o,t):this.lineAndArcUseArcConnect(i,o,t,n)}static lineAndArcUseArcConnect(o,t,e,r){let i=this.getSweep(o,t,r),n=this.getSweepAngel(t.end(),e.start(),o,i);if(n===0){this.useLineToConnect(t,e);return}let s=br.build5(t.end(),e.start(),n);this.rawOffsetPrimitive.push(t),this.rawOffsetPrimitive.push(s)}static arcToLineConnectionDetail(o,t,e,r,i,n,s){let a=this.isTrueArcIntersection(o,r);if(!this.isFalseIntersection(e)&&a){let l;o.center.equals1(r)?l=new Pt(o.center,r):Math.abs(o.sweepAngle)<1e-4?l=new Pt(o.start(),r):(l=br.build4(o.start(),r,o.center,o.rx,o.ry,o.sweep()),l instanceof br&&l.sweepAngle===0&&(l=new Pt(l.start(),l.end()))),this.rawOffsetPrimitive.push(l);let c=new Pt(r,t.end());this.updateNextOffsetPrimitive(s,c)}else a?this.useLineToConnect(o,t):this.lineAndArcUseArcConnect(i,o,t,n)}static isTrueArcIntersection(o,t){return jp(o,t)}static getSweepAngel(o,t,e,r){let i=o.angleD(e),n=t.angleD(e),s;return i===n?s=0:(i=ts.regularD(i),n=ts.regularD(n),r===1?n<=i&&(n+=360):n>=i&&(i+=360),s=n-i),s}static getLineJoinArcScalarAndIntersectionNum(o,t){let e={t:[],intersectionNum:0,points:[]},r=wbt(t,o);if(r){e.intersectionNum=r/2;for(let i=0;i<r-1;i+=2){let n=new Ft(at[i],at[i+1]);e.points.push(n),n.sub(o.start()).x<1e-4||n.sub(o.start()).y<1e-4?e.t.push(0):e.t.push(n.sub(o.start()).x/o.end().sub(o.start()).x)}}else e.intersectionNum=0;return e}static arcToLineConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.getLineJoinArcScalarAndIntersectionNum(r,e),a=this.originalPrimitive[n].start();if(s.intersectionNum===0)this.lineAndArcUseArcConnect(a,e,r,i);else if(s.intersectionNum===1){let l=s.points[0];this.arcToLineConnectionDetail(e,r,s.t[0],l,a,i,n)}else if(s.intersectionNum===2){let l=s.points[0],c=s.points[1],h=l.distance2(a),u=c.distance2(a);this.arcToLineConnectionDetail(e,r,h<u?s.t[0]:s.t[1],h<u?l:c,a,i,n)}}static rxChangeStatus(o){return o===1?!this.isExpansion:this.isExpansion}static arcToArcConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=BNe(e,r);if(i){let n=this.getInters(i),s;if(n.length===2){let c=this.originalPrimitive[t.index].start(),h=n[0],u=n[1],d=h.distance2(c),p=u.distance2(c);d<p?s=h:s=u}else s=n[0];let a,l;s.equals1(e.center)?a=new Pt(e.center,s):Math.abs(e.sweepAngle)<1e-4?a=new Pt(e.start(),s):(a=br.build4(e.start(),s,e.center,e.rx,e.ry,e.sweep()),a instanceof br&&a.sweepAngle===0&&(a=new Pt(a.start(),a.end()))),this.rawOffsetPrimitive.push(a),s.equals1(r.center)?l=new Pt(s,r.center):Math.abs(r.sweepAngle)<1e-4?l=new Pt(s,r.end()):(l=br.build4(s,r.end(),r.center,r.rx,r.ry,r.sweep()),l instanceof br&&l.sweepAngle===0&&(l=new Pt(l.start(),l.end()))),this.updateNextOffsetPrimitive(t.index,l)}else{let n=this.originalPrimitive[o.index],s=this.originalPrimitive[t.index],a=this.rxChangeStatus(n.sweep()),l=this.rxChangeStatus(s.sweep()),c=this.originalPrimitive[t.index].start(),h=this.getSweep(c,e,o.index),u=Math.abs(this.offsetDistance),d=br.build2(c,a?n.endAngle():n.endAngle()+180,l?s.startAngle:s.startAngle+180,u,u,h);this.rawOffsetPrimitive.push(e),this.rawOffsetPrimitive.push(d)}}},Xk.originalPrimitive=[],Xk.offsetPrimitive=[],Xk.rawOffsetPrimitive=[],Xk.testI=0,Xk),tPt=class vz extends Xz{constructor(t,e,r,i,n,s){if(super(),e<0||r<0)throw new Error("The width and height of rect can't be less than 0!");this.leftUpPoint=t,this.width=e,this.height=r,this.angle=i,this.isCCW=n,this.radius=Math.min(Math.max(s,0),e/2,r/2)}get radiusRatio(){return this.radius/Math.min(this.width,this.height)}start(){return this.leftUpPoint.add(new Ft(this.radius,0).multiply3(Oc.rotateD(this.angle)))}end(){return this.start()}getLeftPoint(){return this.leftUpPoint.add(new Ft(0,-this.height/2).multiply3(Oc.rotateD(this.angle)))}getRightPoint(){return this.leftUpPoint.add(new Ft(this.width,-this.height/2).multiply3(Oc.rotateD(this.angle)))}extend(t){return new vz(this.leftUpPoint.add(new Ft(-t,t).rotateD(Ft.ORIGIN,this.angle)),this.width+t*2,this.height+t*2,this.angle,this.isCCW,this.radius+t)}bbox(){let t=Oc.rotateD(this.angle),{leftUpPoint:e,width:r,height:i,radius:n}=this,s=e.add(new Ft(n,-n).multiply3(t)),a=e.add(new Ft(n,n-i).multiply3(t)),l=e.add(new Ft(r-n,-n).multiply3(t)),c=e.add(new Ft(r-n,n-i).multiply3(t));return new _1(Math.min(s.x,a.x,l.x,c.x)-n,Math.max(s.x,a.x,l.x,c.x)+n,Math.min(s.y,a.y,l.y,c.y)-n,Math.max(s.y,a.y,l.y,c.y)+n)}toPolyline(){let t=[],{leftUpPoint:e,width:r,height:i,radius:n}=this;if(n===0){let a=Ft.ORIGIN,l=new Ft(r,0),c=new Ft(r,-i),h=new Ft(0,-i);t.push(new Pt(a,l),new Pt(l,c),new Pt(c,h),new Pt(h,a))}else{let a=new Ft(0,-n),l=new Ft(n,0),c=new Ft(r-n,0),h=new Ft(r,-n),u=new Ft(r,n-i),d=new Ft(r-n,-i),p=new Ft(n,-i),m=new Ft(0,n-i);t.push(br.build1(a,l,n,n,!1,0),new Pt(l,c),br.build1(c,h,n,n,!1,0),new Pt(h,u),br.build1(u,d,n,n,!1,0),new Pt(d,p),br.build1(p,m,n,n,!1,0),new Pt(m,a))}t=t.filter(a=>!a.start().equals1(a.end())),this.isCCW&&(t.forEach((a,l)=>t[l]=a.reverse()),t.reverse());let s=Oc.rotateD(this.angle).translate1(e);return ma.build2(t.map(a=>a.multiply3(s)))}center(){return this.leftUpPoint.add1(this.width/2,this.height/2).rotateD(this.leftUpPoint,this.angle)}multiply3(t){let e=this.leftUpPoint.multiply3(t),r=new Ft(this.width,0).multiply3(Oc.rotateD(this.angle)).multiply3(t),i=new Ft(0,-this.height).multiply3(Oc.rotateD(this.angle)).multiply3(t);return t.isMirrored()?new vz(e,i.length(),r.length(),i.angleD(Ft.ORIGIN),this.isCCW===1?0:1,this.radius*r.length()/this.width):new vz(e,r.length(),i.length(),r.angleD(Ft.ORIGIN),this.isCCW,this.radius*r.length()/this.width)}reverse(){return new vz(this.leftUpPoint,this.width,this.height,this.angle,this.isCCW===1?0:1,this.radius)}stroke(t,e,r){let i=this.stroke1(t,e,r);if(i.length===1)return i[0];{let[n,s]=i;return ma.build2(n.primitives.concat(new Pt(n.primitives[0].start(),s.primitives[0].start()),s.primitives,new Pt(s.primitives[0].start(),n.primitives[0].start())))}}stroke1(t,e,r){let i=r===this.isCCW?this:this.reverse(),n=t/2,s=Math.min(i.width,i.height)/2,a=i.extend(n).toPolyline();return s<=n?[a]:[a,i.extend(-n).toPolyline().reverse()]}points(t){let e=this.toPolyline(),r=[];return e.points(t,i=>r.push(i)),r}toBezier(){throw new Error("Method not implemented.")}},rPt=.01,X0=class vS{static simplify(t){return t=lx(t),t?new vS([t]):null}static buildByStroke(t,e,r=1,i=iIe,n){if(t instanceof br&&(t.rx<e/2+rPt||Math.abs(t.sweepAngle)>180&&Or.lesseq(t.start().distance1(t.end()),e))){let a=i7e(t.stroke(e,r,0),n);if(a.length===0)return null;if(a.length===1)return new vS(a);let l=[null],c=Number.POSITIVE_INFINITY;return a.forEach(h=>{let u=h.area(.1);u<0?u<c&&(l[0]=h,c=u):l.push(h)}),new vS(l)}else if(t instanceof tPt){let a=t.stroke1(e,r,0).map(l=>lx(l));return a[0]?a[1]?new vS(a):new vS([a[0]]):null}let s=t.stroke(e,r,0,i);return s?this.simplify(s):null}static buildCircle(t,e){return this.simplify(ma.build7([br.buildCircle(t,e,0)]))}static buildRect(t){return this.simplify(t.toPolyline())}static buildBBox(t){return this.simplify(ma.buildBBox(t,0))}constructor(t){this.items=t.slice()}multiply3(t){return new vS(this.items.map(e=>e.multiply3(t)))}bbox(){return this.items[0].bbox()}isEqual(t){return t instanceof vS?this.items.every(e=>t.items.some(r=>r.isEqual(e))):!1}getOutMostPolyline(){return this.items[0]}extend(t,e){if(this.items.length!==1)throw new Error("this.items.length !== 1");if(t===0)return new fp([this]);let r=this.items[0],i=[];for(let h of r.primitives)if(h instanceof Pt)i.push(h);else if(h instanceof br&&h.rx===h.ry)s(h);else if(h instanceof Xi)n(h);else throw new Error("not support!");r=ma.build7(i);function n(h){let u=h.points(.1);for(let d=0;d<u.length-1;d++){let p=u[d],m=u[d+1];i.push(new Pt(p,m))}}function s(h){if(Math.abs(h.sweepAngle)>270){let u=h.sweepAngle/2;s(br.build3(h.center,h.startAngle,u,h.rx,h.ry)),s(br.build3(h.center,h.startAngle+u,u,h.rx,h.ry))}else i.push(h)}let a=[],l=[];ePt.getExtendPolyLine(r,t,!0,e).forEach(h=>{(h.area(.1)>0?l:a).push(h)});let c;if(a.length===1)l.forEach(h=>a.push(h)),c=new fp([new vS(a)]);else if(a.length===0)console.warn("outlines.length === 0"),c=new fp([]);else if(l.length===0)c=new fp(a.map(h=>new vS([h])));else{let h=a.map(u=>[u]);l.forEach(u=>{let d=[],p=u.bbox();if(h.forEach(m=>{m[0].bbox().isContainsBBox1(p)&&d.push(m)}),d.length===1)d[0].push(u);else{if(d.length===0)throw new Error("inPlsArr.length === 0");for(let m of d.sort((g,y)=>g[0].bbox().area()-y[0].bbox().area()))if(m[0].getWindingNum(u.start())===-1){m.push(u);break}}}),c=new fp(h.map(u=>new vS(u)))}return c}toPolylineGroup(){return new nIe(this.items)}},iPt=(o=>(o[o.POLYGON=1]="POLYGON",o[o.POLYLINE=2]="POLYLINE",o[o.LINE=3]="LINE",o[o.ARC=4]="ARC",o[o.BEZIER2=5]="BEZIER2",o[o.BEZIER3=6]="BEZIER3",o[o.BOOLEAN_OUTPUT=7]="BOOLEAN_OUTPUT",o[o.BOOLEAN_INTERSECTION=8]="BOOLEAN_INTERSECTION",o[o.BOOLEAN_UNION=9]="BOOLEAN_UNION",o[o.BOOLEAN_DIFF=10]="BOOLEAN_DIFF",o[o.BOOLEAN_RESULT=11]="BOOLEAN_RESULT",o[o.LINES=12]="LINES",o[o.ARCS=13]="ARCS",o[o.BEZIER2S=14]="BEZIER2S",o[o.BEZIER3S=15]="BEZIER3S",o[o.CIRCLE_CW=16]="CIRCLE_CW",o[o.CIRCLE_CCW=17]="CIRCLE_CCW",o[o.POLYGON_GROUP=18]="POLYGON_GROUP",o))(iPt||{}),nPt=class{constructor(o){this.idx=-1,this.lst=o}hasNext(){return this.idx<this.lst.length-1}next(){if(this.idx<this.lst.length-1)return this.idx++,this.lst[this.idx];throw new Error("bug")}};function oPt(o){return new nPt(o)}function sPt(o){return o===32||o===9||o===13||o===10}var aPt=class{constructor(){this._line=1,this._col=0}line(){return this._line}col(){return this._col}_feed(o){return o===10?(this._col=0,this._line++):this._col++,this.feed(o)}parse(o){let t=o.length;for(let e=0;e<t;e++){let r=o.charCodeAt(e);if(!this._feed(r))return this}return this.finish(),this}},hTe=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}},lPt=/(\.?0+)$/,LTe=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 100:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(hTe.lpad((n|0).toString(10),"0",u)),r=0;else return l}else return l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(hTe.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(hTe.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static fmtNumber(o){return o.toFixed(5).replace(lPt,"")}};function cPt(o){switch(o){case 0:return"DEBUG";case 1:return"INFO";case 2:return"WARNING";case 3:return"ERROR";case 4:return"DUMMY"}}var hPt=(o,t)=>{o===3?console.error(...t):o===2?console.warn(...t):console.log(...t)},uPt=(o,t)=>[cPt(o)].concat(t),MTe=class NTe{static mix(...t){return new NTe(0,(e,r)=>{for(let i of t)i.write(e,r)},(e,r)=>r)}constructor(t,e=hPt,r=uPt){this.level=t,this.writer=e,this.fmt=r}setLevel(t){this.level=t}prepend(t=null,e=null){let r=t===null?this.fmt:(n,s)=>(s=t(n,s),this.fmt(n,s)),i=e===null?this.writer:(n,s)=>{e(n,s),this.writer(n,s)};return new NTe(this.level,i,r)}chain(t){return t.prepend(this.fmt.bind(this),this.writer.bind(this))}include(t){return this.level<=t}formatWrite(t,e,r){this.include(t)&&this.writer(t,this.fmt(t,[LTe.format(e,...r)]))}write(t,e){this.include(t)&&this.writer(t,this.fmt(t,e))}write3(t,e,r){this.include(t)&&this.writer(t,this.fmt(t,[LTe.format(e,...r)]))}debug3(t,...e){this.write3(0,t,e)}warning3(t,...e){this.write3(2,t,e)}debugFmt(t,...e){this.formatWrite(0,t,e)}debug(...t){this.write(0,t)}infoFmt(t,...e){this.formatWrite(1,t,e)}info(...t){this.write(1,t)}warningFmt(t,...e){this.formatWrite(2,t,e)}warning(...t){this.write(2,t)}errorFmt(t,...e){this.formatWrite(3,t,e)}error(...t){this.write(3,t)}};MTe.DUMMY=new MTe(4);var dPt=MTe,uTe=500,J5e=String.fromCharCode,pPt=class{constructor(){this.buffer=new Array}size(){return this.buffer.length}isEOF(){return!1}write(o){return this.buffer.push(o),1}writen1(o){return this.writen2(o,0,o.length)}writen2(o,t,e){let r=this.buffer;for(let i=0,n=t;i<e;i++,n++)r.push(o[n]);return e}writeAsync(o,t){t(this.write(o))}writenAsync1(o,t){t(this.writen1(o))}writenAsync2(o,t,e,r){r(this.writen2(o,t,e))}writeStr(o){let t=o.length,e=new Array(t);for(let r=0;r<t;r++)e[r]=o.charCodeAt(r);return this.writen1(e)}clear(){this.buffer.length=0}toString(){let o=this.buffer,t=o.length;if(t<=uTe)return J5e.apply(null,o);{let e=new Array;for(let r=0;r<o.length;r+=uTe){let i=Math.min(t-r,uTe),n=J5e.apply(null,o.slice(r,r+i));e.push(n)}return e.join("")}}},o7e=(o=>(o[o.UNKNOW=0]="UNKNOW",o[o.NUMBER_INTEGER=1]="NUMBER_INTEGER",o[o.NUMBER_DECIMAL=2]="NUMBER_DECIMAL",o[o.NUMBER_E=3]="NUMBER_E",o[o.NUMBER_E_SIGNED=4]="NUMBER_E_SIGNED",o))(o7e||{}),s7e=(o=>(o[o.UNKNOW=0]="UNKNOW",o[o.MOVE_X=1]="MOVE_X",o[o.MOVE_Y=2]="MOVE_Y",o[o.LINE_X=3]="LINE_X",o[o.LINE_Y=4]="LINE_Y",o[o.HORIZONTAL_X=5]="HORIZONTAL_X",o[o.VERTICAL_Y=6]="VERTICAL_Y",o[o.CUBIC_BEZIER_X1=7]="CUBIC_BEZIER_X1",o[o.CUBIC_BEZIER_Y1=8]="CUBIC_BEZIER_Y1",o[o.CUBIC_BEZIER_X2=9]="CUBIC_BEZIER_X2",o[o.CUBIC_BEZIER_Y2=10]="CUBIC_BEZIER_Y2",o[o.CUBIC_BEZIER_X=11]="CUBIC_BEZIER_X",o[o.CUBIC_BEZIER_Y=12]="CUBIC_BEZIER_Y",o[o.ARC_RX=13]="ARC_RX",o[o.ARC_RY=14]="ARC_RY",o[o.ARC_ROTATION=15]="ARC_ROTATION",o[o.ARC_LARGE=16]="ARC_LARGE",o[o.ARC_SWEEP=17]="ARC_SWEEP",o[o.ARC_X=18]="ARC_X",o[o.ARC_Y=19]="ARC_Y",o[o.SMOOTH_CUBIC_BEZIER_X2=20]="SMOOTH_CUBIC_BEZIER_X2",o[o.SMOOTH_CUBIC_BEZIER_Y2=21]="SMOOTH_CUBIC_BEZIER_Y2",o[o.SMOOTH_CUBIC_BEZIER_X=22]="SMOOTH_CUBIC_BEZIER_X",o[o.SMOOTH_CUBIC_BEZIER_Y=23]="SMOOTH_CUBIC_BEZIER_Y",o[o.QUADRATIC_BEZIER_X1=24]="QUADRATIC_BEZIER_X1",o[o.QUADRATIC_BEZIER_Y1=25]="QUADRATIC_BEZIER_Y1",o[o.QUADRATIC_BEZIER_X=26]="QUADRATIC_BEZIER_X",o[o.QUADRATIC_BEZIER_Y=27]="QUADRATIC_BEZIER_Y",o))(s7e||{});function fPt(o){return 97<=o&&o<=122||65<=o&&o<=90}function am(o){let t=parseFloat(o);if(isFinite(t))return t;throw new Error("expect number")}var Q5e=class extends aPt{constructor(o,t=!0,e=dPt.DUMMY){super(),this.buffer=new pPt,this.group=new Array,this.subPartStart=Ft.ORIGIN,this.curPoint=Ft.ORIGIN,this.lexState=0,this.parseState=0,this.isAbsolute=!1,this.isLargeArc=!1,this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.x=Number.NaN,this.y=Number.NaN,this.rx=Number.NaN,this.ry=Number.NaN,this.rotation=Number.NaN,this.sweep=ix.CCW,this.prevBezierCtrl2=null,this.logger=e,this.cb=o,this.yAxis=t?-1:1}on(o){return this.cb(o)}feed(o){switch(this.logger.include(0)&&this.logger.debug3("L: %c(%s)|%s",o,String.fromCharCode(o),o7e[this.lexState]),this.lexState){case 0:return sPt(o)?!0:48<=o&&o<=57||o===45||o===43?(this.pushBuffer(o),this.lexState=1,!0):o===46?(this.pushBuffer(o),this.lexState=2,!0):fPt(o)?this.feedS(String.fromCharCode(o)):(this.logger.warning3("unknow letter %c",o),!0);case 1:return 48<=o&&o<=57?(this.pushBuffer(o),!0):o===46?(this.pushBuffer(o),this.lexState=2,!0):o===101||o===69?(this.pushBuffer(o),this.lexState=3,!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(o)):!1;case 2:return 48<=o&&o<=57?(this.pushBuffer(o),!0):o===101||o===69?(this.pushBuffer(o),this.lexState=3,!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(o)):!1;case 3:return 48<=o&&o<=57?(this.pushBuffer(o),!0):o===45||o===43?(this.pushBuffer(o),this.lexState=4,!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(o)):!1;case 4:return 48<=o&&o<=57?(this.pushBuffer(o),!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(o)):!1;default:return!0}}finish(){this.feed(32),this.tryNotify()}feedS(o){switch(this.logger.include(0)&&this.logger.debug3("P: %s|%s|%s|%s",o,s7e[this.parseState],this.curPoint,this.subPartStart),this.parseState){case 0:switch(o){case"M":this.isAbsolute=!0,this.parseState=1;break;case"m":this.isAbsolute=!1,this.parseState=1;break;case"L":this.isAbsolute=!0,this.parseState=3;break;case"l":this.isAbsolute=!1,this.parseState=3;break;case"H":this.isAbsolute=!0,this.parseState=5;break;case"h":this.isAbsolute=!1,this.parseState=5;break;case"V":this.isAbsolute=!0,this.parseState=6;break;case"v":this.isAbsolute=!1,this.parseState=6;break;case"z":case"Z":{this.group.push(new Pt(this.curPoint,this.subPartStart));let r=this.tryNotify();return this.curPoint=this.subPartStart,r}case"C":this.isAbsolute=!0,this.parseState=7;break;case"c":this.isAbsolute=!1,this.parseState=7;break;case"S":this.isAbsolute=!0,this.parseState=20;break;case"s":this.isAbsolute=!1,this.parseState=20;break;case"A":this.isAbsolute=!0,this.parseState=13;break;case"a":this.isAbsolute=!1,this.parseState=13;break;case"Q":this.isAbsolute=!0,this.parseState=24;break;case"q":this.isAbsolute=!1,this.parseState=24;break;default:this.logger.warning3("unknow %s",o)}return!0;case 1:let t=this.tryNotify();return this.x=am(o),this.parseState=2,t;case 2:{this.y=this.yAxis*am(o);let r;return this.isAbsolute?r=new Ft(this.x,this.y):r=this.curPoint.add1(this.x,this.y),this.curPoint=r,this.subPartStart=r,this.parseState=3,!0}case 3:return this.x=parseFloat(o),isFinite(this.x)?(this.parseState=4,!0):(this.parseState=0,this.feedS(o));case 4:{this.y=this.yAxis*am(o);let r;return this.isAbsolute?r=new Ft(this.x,this.y):r=this.curPoint.add1(this.x,this.y),this.group.push(new Pt(this.curPoint,r)),this.curPoint=r,this.parseState=3,!0}case 5:if(this.x=parseFloat(o),isFinite(this.x)){let r;return this.isAbsolute?r=new Ft(this.x,this.curPoint.y):r=this.curPoint.add1(this.x,0),this.group.push(new Pt(this.curPoint,r)),this.curPoint=r,!0}else return this.parseState=0,this.feedS(o);case 6:if(this.y=parseFloat(o),isFinite(this.y)){this.y=this.yAxis*this.y;let r;return this.isAbsolute?r=new Ft(this.curPoint.x,this.y):r=this.curPoint.add1(0,this.y),this.group.push(new Pt(this.curPoint,r)),this.curPoint=r,!0}else return this.parseState=0,this.feedS(o);case 7:let e=parseFloat(o);return isFinite(e)?(this.x1=e,this.parseState=8,!0):(o!=="s"&&o!=="S"&&(this.prevBezierCtrl2=null),this.parseState=0,this.feedS(o));case 8:return this.y1=this.yAxis*am(o),this.parseState=9,!0;case 9:return this.x2=am(o),this.parseState=10,!0;case 10:return this.y2=this.yAxis*am(o),this.parseState=11,!0;case 11:return this.x=am(o),this.parseState=12,!0;case 12:{this.y=this.yAxis*am(o);let r,i,n;return this.isAbsolute?(r=new Ft(this.x1,this.y1),i=new Ft(this.x2,this.y2),n=new Ft(this.x,this.y)):(r=this.curPoint.add1(this.x1,this.y1),i=this.curPoint.add1(this.x2,this.y2),n=this.curPoint.add1(this.x,this.y)),this.prevBezierCtrl2=i,this.group.push(new Xi([this.curPoint,r,i,n])),this.curPoint=n,this.parseState=7,!0}case 13:return this.rx=parseFloat(o),isFinite(this.rx)?(this.parseState=14,!0):(this.parseState=0,this.feedS(o));case 14:return this.ry=am(o),this.parseState=15,!0;case 15:return this.rotation=am(o),this.parseState=16,!0;case 16:return this.isLargeArc=am(o)===1,this.parseState=17,!0;case 17:return this.sweep=am(o)===1?ix.CW:ix.CCW,this.parseState=18,!0;case 18:return this.x=am(o),this.parseState=19,!0;case 19:{this.y=this.yAxis*am(o);let r;return this.isAbsolute?r=new Ft(this.x,this.y):r=this.curPoint.add1(this.x,this.y),this.rx&&this.ry&&this.group.push(br.build1(this.curPoint,r,this.rx,this.ry,this.isLargeArc,this.sweep)),this.curPoint=r,this.parseState=13,!0}case 20:return this.x2=parseFloat(o),isFinite(this.x2)?(this.parseState=21,!0):(o!=="s"&&o!=="S"&&(this.prevBezierCtrl2=null),this.parseState=0,this.feedS(o));case 21:return this.y2=this.yAxis*am(o),this.parseState=22,!0;case 22:return this.x=am(o),this.parseState=23,!0;case 23:{this.y=this.yAxis*am(o);let r,i;this.isAbsolute?(r=new Ft(this.x2,this.y2),i=new Ft(this.x,this.y)):(r=this.curPoint.add1(this.x2,this.y2),i=this.curPoint.add1(this.x,this.y));let n;return this.prevBezierCtrl2?n=this.curPoint.add(this.curPoint.sub(this.prevBezierCtrl2)):n=this.curPoint,this.prevBezierCtrl2=r,this.group.push(new Xi([this.curPoint,n,r,i])),this.curPoint=i,this.parseState=20,!0}case 24:return this.x1=parseFloat(o),isFinite(this.x1)?(this.parseState=25,!0):(o!=="s"&&o!=="S"&&(this.prevBezierCtrl2=null),this.parseState=0,this.feedS(o));case 25:return this.y1=this.yAxis*am(o),this.parseState=26,!0;case 26:return this.x=am(o),this.parseState=27,!0;case 27:{this.y=this.yAxis*am(o);let r,i;return this.isAbsolute?(r=new Ft(this.x1,this.y1),i=new Ft(this.x,this.y)):(r=this.curPoint.add1(this.x1,this.y1),i=this.curPoint.add1(this.x,this.y)),this.prevBezierCtrl2=r,this.group.push(new Xi([this.curPoint,r,i])),this.curPoint=i,this.parseState=24,!0}default:return this.logger.warning3("unsupported parse state %s",this.parseState),!0}}pushBuffer(o){this.buffer.write(o)}getCleanBuffer(){let o=this.buffer.toString();return this.buffer.clear(),o}tryNotify(){if(this.group.length===0)return!0;{let o=ma.build1(oPt(this.group));return this.group.length=0,this.on(o)}}onException(o){throw o}},VYt=LTe.fmtNumber,eNe=class{constructor(o=!0){this.buffer=new Array,this.state=0,this.prev=null,this.yAxis=o?-1:1}encPl(o){for(let t of o.primitives)this.encPt(t);return this}encPt(o){if(o instanceof Pt)this.encLine1(o);else if(o instanceof br)this.encArc(o);else if(o instanceof Xi)this.encBezier(o);else throw new Error("");return this}encBezier(o){if(o.controls.length===3){let t=o.controls[0],e=o.controls[1],r=o.controls[2];this.state===0?this.buffer.push("M",t.x,this.yAxis*t.y,"Q",e.x,this.yAxis*e.y,r.x,this.yAxis*r.y):t.equals1(this.prev)?this.state!==4?this.buffer.push("Q",e.x,this.yAxis*e.y,r.x,this.yAxis*r.y):this.buffer.push(e.x,this.yAxis*e.y,r.x,this.yAxis*r.y):this.buffer.push("L",t.x,this.yAxis*t.y,"Q",e.x,this.yAxis*e.y,r.x,this.yAxis*r.y),this.prev=r,this.state=4}else if(o.controls.length===4){let t=o.controls[0],e=o.controls[1],r=o.controls[2],i=o.controls[3];this.state===0?this.buffer.push("M",t.x,this.yAxis*t.y,"C",e.x,this.yAxis*e.y,r.x,this.yAxis*r.y,i.x,this.yAxis*i.y):t.equals1(this.prev)?this.state!==3?this.buffer.push("C",e.x,this.yAxis*e.y,r.x,this.yAxis*r.y,i.x,this.yAxis*i.y):this.buffer.push(e.x,this.yAxis*e.y,r.x,this.yAxis*r.y,i.x,this.yAxis*i.y):this.buffer.push("L",t.x,this.yAxis*t.y,"C",e.x,this.yAxis*e.y,r.x,this.yAxis*r.y,i.x,this.yAxis*i.y),this.prev=i,this.state=3}else throw new Error("only bezier has 3 or 4 control points supported");return this}encArc(o){let t=o.svgEnd;return this.state===0?this.buffer.push("M",o.start().x,this.yAxis*o.start().y,"A",o.rx,o.ry,0,o.isLarge()?1:0,o.sweep()===ix.CCW?0:1,t.x,this.yAxis*t.y):o.start().equals1(this.prev)?this.state!==2?this.buffer.push("A",o.rx,o.ry,0,o.isLarge()?1:0,o.sweep()===ix.CCW?0:1,t.x,this.yAxis*t.y):this.buffer.push(o.rx,o.ry,0,o.isLarge()?1:0,o.sweep()===ix.CCW?0:1,t.x,this.yAxis*t.y):this.buffer.push("L",o.start().x,this.yAxis*o.start().y,"A",o.rx,o.ry,0,o.isLarge()?1:0,o.sweep()===ix.CCW?0:1,t.x,this.yAxis*t.y),this.prev=t,this.state=2,this}encLine1(o){return this.encLine2(o.start(),o.end()),this}encLine2(o,t){return this.state===0?this.buffer.push("M",o.x,this.yAxis*o.y,"L",t.x,this.yAxis*t.y):(this.state!==1&&this.buffer.push("L"),o.equals1(this.prev)?this.buffer.push(t.x,this.yAxis*t.y):this.buffer.push(o.x,this.yAxis*o.y,t.x,this.yAxis*t.y)),this.prev=t,this.state=1,this}close(o){return this.state!==0&&(o&&this.buffer.push("Z"),this.state=0,this.prev=null),this}fixNumber(o=4){return this.buffer.forEach((t,e,r)=>{typeof t=="number"&&(t|0)!==t&&(r[e]=+t.toFixed(o))}),this}toString(){return this.buffer.join(" ")}toArray(){return this.buffer}},mPt=class extends eIe{constructor(){super(),this.lockConfig=[],this.hideConfig=[],this.invisibleConfig=[],this.coverConfig={},this.commentConfig={},this.trnCtrlConfig={},this.transformConfig={},this.fontCache={},this.cache={},this.zIndex=0,this.zIndexMap=new Map}onParseLine(o){let t=o[0];switch(t){case"DOCTYPE":this.parseDocType(o);break;case"HEAD":this.parseHead(o);break;case"LOCK":this.parseLock(o);break;case"HIDE":this.parseHide(o);break;case"INVISIBLE":this.parseInvisible(o);break;case"COVER":this.parseCover(o);break;case"TRN_CTRL":this.parseTrnCtrl(o);break;case"COMMENT":this.parseComment(o);break;case"FONT_CACHE":this.parseFontCache(o);break;case"TRANSFORM":this.parseTransform(o);break;case"GROUP":{let e=o[1];this.cache[t]||(this.cache[t]={errorIds:[]}),e!==null&&!this.cache[t][e]?this.cache[t][e]=o:this.cache[t].errorIds.push(o);break}case"POLY":case"STRING":case"AUXLINE":case"DIMENSION":{this.zIndexMap.set(o[1],++this.zIndex);let e=Nz(o[1]);this.cache[t]||(this.cache[t]={errorIds:[]}),e!==null&&!this.cache[t][e]?this.cache[t][e]=o:this.cache[t].errorIds.push(o);break}default:console.warn("can not find hanlder with",o)}}getZIndex(o){var t;return(t=this.zIndexMap.get(o))!=null?t:null}secondParseLine(o){switch(o[0]){case"GROUP":this.parseGroup(o);break;case"POLY":this.parsePoly(o);break;case"STRING":this.parseString(o);break;case"AUXLINE":this.parseAuxLine(o);break;case"DIMENSION":this.parseDimension(o);break}}onParseEnd(){for(let o in this.cache){let t=this.cache[o],e=Object.keys(t).sort((i,n)=>Number(i)-Number(n)),r=0;for(let i of e){if(i==="errorIds")continue;let n=Number(i),s=n-r-1;s>=1&&this.onPHolder(o,s),r=n,this.secondParseLine(t[n])}t.errorIds.forEach(i=>this.secondParseLine(i))}this.clearCache()}clearCache(){this.lockConfig=[],this.hideConfig=[],this.invisibleConfig=[],this.coverConfig={},this.commentConfig={},this.trnCtrlConfig={},this.transformConfig={},this.fontCache={},this.cache={},this.version=void 0}parseDocType(o){this.version=Number(o[2])}parseHead(o){this.version<2&&o[1]&&o[1].print==="AHead Side"&&(o[1].print="Ahead Side"),this.onCanvas(o[1])}parseGroup(o){this.onGroup(o[1],o[2],o[3],!!o[4],!!o[5])}parseLock(o){this.lockConfig.push(...o[1])}parseHide(o){this.hideConfig.push(...o[1])}parseInvisible(o){this.invisibleConfig.push(...o[1])}parseCover(o){this.coverConfig[o[1]]=o[2]}parseTrnCtrl(o){this.trnCtrlConfig[o[1]]={scope:o[2],trans_print:o[3],trans_white:o[4]}}parseComment(o){this.commentConfig[o[1]]=o[2]}matrix2svg(o){let[t,e,r,i,n,s,a,l,c]=o.data;return[t,e,i,n,a,l]}encPath(o){let t=new Array;return new Q5e(e=>(t.push(new eNe(!0).encPl(e).toArray().slice(1)),!0),!0).parse(o),t}parseRect(o){var t,e,r,i,n,s,a,l;let[,c,,h,u,d,p,m,g,,,y,b]=o,P=y[0],T=P[1],I=-P[2],C=P[1]+P[3],E=-P[2]+P[4],O=P[5],_=P[6],R=+P[7],v=+P[8],D=Oc.scale(C-T,E-I).rotateD(-R);v&&(D=D.multiply3(Oc.MIRROR_X)),D=D.translate(T,I),D=this.matrix2svg(D),D=this.encMatrix(D),this.onPoly(c,0,h,-R,u,d,p,m,g,!0,[["R",0,0,1,1,O,_,0,0]],!0,!0,this.lockConfig.some(w=>w===o[1]),this.hideConfig.some(w=>w===o[1]),this.invisibleConfig.some(w=>w===o[1]),h===1?1:(t=this.coverConfig[o[1]])!=null?t:null,b||((e=this.commentConfig[o[1]])!=null?e:null),h===2?3:(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,h===2?g:(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,h===2?1-g:(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,D!=null?D:null)}parseObj(o){var t,e,r,i,n,s,a,l;let[,c,,h,u,d,p,m,g,,,y,b]=o,[P,T,I,C,E,O,_,R,v]=y[0],D=Oc.rotateD(R);v&&(D=D.multiply3(Oc.MIRROR_X));let w;v?w=new Pt(new Ft(0,0),new Ft(0,-E)).multiply3(D):w=new Pt(new Ft(0,0),new Ft(C,0)).multiply3(D);let F=w.end().angleD(w.start()),H=v===1;C=v===1?E:C,E=v===1?C:E;let z=Oc.scale(C,E).rotateD(-F);H&&(z=z.multiply3(Oc.MIRROR_X)),z=z.translate(T,-I),z=this.matrix2svg(z),z=this.encMatrix(z),this.onPoly(c,0,h,-F,u,d,p,m,g,!0,[["R",0,0,1,1,0,0,0,0]],!1,!1,this.lockConfig.some(G=>G===o[1]),this.hideConfig.some(G=>G===o[1]),this.invisibleConfig.some(G=>G===o[1]),h===1?1:(t=this.coverConfig[o[1]])!=null?t:null,b||((e=this.commentConfig[o[1]])!=null?e:null),h===2?3:(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,h===2?g:(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,h===2?1-g:(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,z!=null?z:null)}parseEllipse(o){var t,e,r,i,n,s,a,l;let[,c,,h,u,d,p,m,g,,,y,b]=o,P=y[0],T=P[1],I=-P[2],C=P[3],E=P[4],O=+P[5],_=+P[6],R=Oc.scale(C,E).rotateD(-O);_&&(R=R.multiply3(Oc.MIRROR_X)),R=R.translate(T,I),R=this.matrix2svg(R),R=this.encMatrix(R),this.onPoly(c,0,h,-O,u,d,p,m,g,!0,[["ELLIPSE",0,0,1,1,0,0]],!0,!0,this.lockConfig.some(v=>v===o[1]),this.hideConfig.some(v=>v===o[1]),this.invisibleConfig.some(v=>v===o[1]),h===1?1:(t=this.coverConfig[o[1]])!=null?t:null,b||((e=this.commentConfig[o[1]])!=null?e:null),h===2?3:(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,h===2?g:(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,h===2?1-g:(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,R!=null?R:null)}parsePolyGroup(o){var t,e,r,i,n,s,a,l;let[,c,,h,u,d,p,m,g,,,y,b]=o,P=!0,T=!0,I=this.decMultiPoly(y).d;this.onPoly(c,0,h,0,u,d,p,m,g,!0,this.encPath(I),P,T,this.lockConfig.some(C=>C===o[1]),this.hideConfig.some(C=>C===o[1]),this.invisibleConfig.some(C=>C===o[1]),h===1?1:(t=this.coverConfig[o[1]])!=null?t:null,b||((e=this.commentConfig[o[1]])!=null?e:null),h===2?3:(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,h===2?g:(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,h===2?1-g:(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,null)}parsePoly(o){var t,e,r,i,n,s,a,l,c,h;if(this.version<2)if(o[11].length===1)switch(o[11][0][0]){case"R":{let u=o[7];return u.startsWith("data:")||u.startsWith("blob:")?this.parseObj(o):this.parseRect(o)}case"ELLIPSE":return this.parseEllipse(o);default:return this.parsePolyGroup(o)}else return this.parsePolyGroup(o);else this.onPoly(o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],o[11],!!(o[12]||o[12]===void 0),!!(o[13]||o[13]===void 0),this.lockConfig.some(u=>u===o[1]),this.hideConfig.some(u=>u===o[1]),this.invisibleConfig.some(u=>u===o[1]),(t=this.coverConfig[o[1]])!=null?t:null,(e=this.commentConfig[o[1]])!=null?e:null,(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,(h=(c=this.transformConfig[o[1]])==null?void 0:c.matrix)!=null?h:null)}decMultiPoly(o){let t=new Bb,e=o.map(r=>{let i="";return new Q5e(n=>(t.ext1(n.bbox()),i=new eNe().encPl(n).toString(),!1),!1).parse("M"+r.join(" ")),i}).join(" ");return{bbox:t.build(),d:e}}encMatrix(o){let[t,e,r,i,n,s]=o,a=new Oc([t,e,0,r,i,0,n,s,1]);a=Oc.MIRROR_Y.multiply3(a).multiply3(Oc.MIRROR_Y);let[l,c,h,u,d,p,m,g,y]=a.data;return[l,u,m,c,d,g]}parseString(o){var t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T;if(this.version<2){let[,I,C,E,O,_,R,v,D,w,F,H,z,G,W,L,B,N,U,k]=o;_=vg(_);let V=D;v=v===1,z=z===1,G=G===1,W=W===1;let Y=-(L[15]/3|0)+2,X=L%3;U=U||1,k=k||1;let Z=this.fontCache[o[1]],{bbox:Q,d:ae}=this.decMultiPoly(Z),he=Q.width(),re=Q.height();re=re||0,he=he||0;let se=0;switch(X){case 1:se=-he/2;break;case 2:se=-he;break}let K=0;switch(Y){case 1:K=re/2;break;case 0:K=re;break}let me=Oc.translate(se,K).scale(U,k).rotateD(-R);v&&(me=me.multiply3(Oc.MIRROR_X)),me=me.translate(O,_);let Oe=this.matrix2svg(me),Ie=this.encMatrix(Oe);this.onString(I,C,E,R,V,w,F,H,z,G,W,((-Y||0)+2)*3+(X||0),B,N,this.lockConfig.some(ue=>ue===o[1]),this.hideConfig.some(ue=>ue===o[1]),this.invisibleConfig.some(ue=>ue===o[1]),E===1?1:(t=this.coverConfig[o[1]])!=null?t:null,(e=this.commentConfig[o[1]])!=null?e:null,E===2?3:(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,E===2?N:(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,E===2?1-N:(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,Ie,!!Ie,this.encPath(ae))}else this.onString(o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9]===1,o[10]===1,o[11]===1,o[12],o[13],o[14],this.lockConfig.some(I=>I===o[1]),this.hideConfig.some(I=>I===o[1]),this.invisibleConfig.some(I=>I===o[1]),(c=this.coverConfig[o[1]])!=null?c:null,(h=this.commentConfig[o[1]])!=null?h:null,(d=(u=this.trnCtrlConfig[o[1]])==null?void 0:u.scope)!=null?d:null,(m=(p=this.trnCtrlConfig[o[1]])==null?void 0:p.trans_print)!=null?m:null,(y=(g=this.trnCtrlConfig[o[1]])==null?void 0:g.trans_white)!=null?y:null,(P=(b=this.transformConfig[o[1]])==null?void 0:b.matrix)!=null?P:null,!!((T=this.transformConfig[o[1]])!=null&&T.matrix),this.fontCache[o[1]])}parseFontCache(o){this.fontCache[o[1]]=o[2]}parseDimension(o){var t,e,r,i,n,s,a,l,c,h,u,d;this.onDimension(o[1],o[2],o[3],(t=o[4])!=null?t:null,o[5],o[6],o[7],o[8],this.lockConfig.some(p=>p===o[1]),this.hideConfig.some(p=>p===o[1]),this.invisibleConfig.some(p=>p===o[1]),(e=this.coverConfig[o[1]])!=null?e:null,(r=this.commentConfig[o[1]])!=null?r:null,(n=(i=this.trnCtrlConfig[o[1]])==null?void 0:i.scope)!=null?n:null,(a=(s=this.trnCtrlConfig[o[1]])==null?void 0:s.trans_print)!=null?a:null,(c=(l=this.trnCtrlConfig[o[1]])==null?void 0:l.trans_white)!=null?c:null,(u=(h=this.transformConfig[o[1]])==null?void 0:h.matrix)!=null?u:null,!!((d=this.transformConfig[o[1]])!=null&&d.matrix))}parseTransform(o){this.transformConfig[o[1]]={matrix:o[2],strokes:!!o[3]}}parseAuxLine(o){var t,e,r,i,n,s,a,l,c,h,u;this.onAuxLine(o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],this.lockConfig.some(d=>d===o[1]),this.hideConfig.some(d=>d===o[1]),this.invisibleConfig.some(d=>d===o[1]),(t=this.coverConfig[o[1]])!=null?t:null,(e=this.commentConfig[o[1]])!=null?e:null,(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,(h=(c=this.transformConfig[o[1]])==null?void 0:c.matrix)!=null?h:null,!!((u=this.transformConfig[o[1]])!=null&&u.matrix))}},gPt=class extends eIe{constructor(o={},t=[]){super(),this.symbolPartIds=o,this.device=t,this.defaultPartId="pid8a0e77bacb214e",this.curPart="",this.onlyPart="",this.partIdMap={},this.fontStyleIndex={},this.lineStyleIndex={},this.groupIndex={},this.zIndex=0,this.zIndexMap=new Map,this.cache={},this.errorIds={},this.tableCell={},this.hasPart=!1,this.components={},this.busEntryMap={},this.defaultLineStyle={strokeColor:null,strokeStyle:null,fillColor:null,strokeWidth:null,fillStyle:null},this.defaultFontStyle={color:null,fillColor:null,fontFamily:null,fontSize:null,strikeout:null,underline:null,italic:null,fontWeight:null,hAlign:null,vAlign:null}}getZIndex(o){var t;return(t=this.zIndexMap.get(o))!=null?t:null}transPinAttrKey(o){switch(o){case"NUMBER":{o="Pin Number";break}case"NAME":{o="Pin Name";break}}return o}transFontStyle(o){return{color:o.color,fillColor:o.fillColor,fontFamily:o.fontFamily,fontSize:o.fontSize,strikeout:o.strikeout,underline:o.underline,italic:o.italic,fontWeight:o.fontWeight,align:this.transAlign(o.vAlign,o.hAlign)}}transTableFontStyle(o){return{color:o.color,fillColor:o.fillColor,fontFamily:o.fontFamily,fontSize:o.fontSize,strikeout:o.strikeout,underline:o.underline,italic:o.italic,fontWeight:o.fontWeight,vAlign:this.transVAlign(o.vAlign),hAlign:this.transHAlign(o.hAlign)}}transVAlign(o){switch(o=o&&Number(o),o){case 0:return"TOP";case 1:return"MIDDLE";case 2:return"BOTTOM";default:return null}}transHAlign(o){switch(o=o&&Number(o),o){case 0:return"LEFT";case 1:return"CENTER";case 2:return"RIGHT";default:return null}}transAlign(o,t){if(o=o&&Number(o),t=t&&Number(t),t===0)switch(o){case 0:return"LEFT_TOP";case 1:return"LEFT_MIDDLE";case 2:return"LEFT_BOTTOM";default:return"LEFT_BOTTOM"}if(t===1)switch(o){case 0:return"CENTER_TOP";case 1:return"CENTER_MIDDLE";case 2:return"CENTER_BOTTOM";default:return"CENTER_BOTTOM"}if(t===2)switch(o){case 0:return"RIGHT_TOP";case 1:return"RIGHT_MIDDLE";case 2:return"RIGHT_BOTTOM";default:return"RIGHT_BOTTOM"}switch(o){case 0:return"LEFT_TOP";case 1:return"LEFT_MIDDLE";case 2:return"LEFT_BOTTOM";default:return null}}transStrokeStyle(o){switch(o=o&&Number(o),o){case 0:return"SOLID";case 1:return"SHORT_DASH";case 2:return"DOT";case 3:return"DOT_DASH";default:return null}}transFillStyle(o){switch(o=o&&Number(o),o){case 0:return"NONE";case 1:return"SOLID";case 2:return"GRID";case 3:return"HORIZONTAL_LINE";case 4:return"VERTICAL_LINE";case 5:return"RHOMBIC";case 6:return"LEFT_SLASH_LINE";case 7:return"RIGHT_SLASH_LINE";default:return null}}transPinShape(o){switch(o=o&&Number(o),o){case 0:return"NONE";case 1:return"CLOCK";case 2:return"INVERTED";case 3:return"INVERTED_CLOCK";default:return"NONE"}}onParseLine(o){var t,e;let r=o[0];switch(r){case"DOCTYPE":this.parseDocType(o);break;case"HEAD":this.parseHead(o);break;case"GROUP":this.parseGroup(o);break;case"FONTSTYLE":this.parseFontStyle(o);break;case"LINESTYLE":this.parseLineStyle(o);break;case"TERM":break;case"PART":this.hasPart=!0,this.parsePart(o);break;case"TABEL_CELL":this.parseTableCell(o);break;case"BUSENTRY":{this.parseBusEntry(o);break}case"WIRE":case"BUS":case"TEXT":case"POLY":case"CIRCLE":case"ARC":case"RECT":case"PIN":case"OBJ":case"COMPONENT":case"ELLIPSE":case"BEZIER":case"TABLE":{this.zIndexMap.set(o[1],++this.zIndex);let i=Nz(o[1]);this.cache[r]||(this.cache[r]={}),i!==null&&!this.cache[r][i]?this.cache[r][i]={part:this.curPart,value:o}:(this.errorIds[r]||(this.errorIds[r]=[]),this.errorIds[r].push({part:this.curPart,value:o}));break}case"ATTR":{this.zIndexMap.set(o[1],++this.zIndex),o[3]==="Symbol"&&(this.components[o[2]]||(this.components[o[2]]={symbol:"",device:""}),this.components[o[2]].symbol=o[4]),o[3]==="Device"&&(this.components[o[3]]||(this.components[o[3]]={symbol:"",device:""}),this.components[o[3]].device=o[4]);let i=Object.keys(((t=this.cache)==null?void 0:t.COMPONENT)||{}).find(a=>this.cache.COMPONENT[a].value[1]===o[2]);if(i){let a=this.cache.COMPONENT[i];a.attr||(a.attr=[]),a.attr.push({part:this.curPart,value:o});break}let n=Object.keys(((e=this.cache)==null?void 0:e.PIN)||{}).find(a=>this.cache.PIN[a].value[1]===o[2]);if(n){let a=this.cache.PIN[n];a.attr||(a.attr=[]),a.attr.push({part:this.curPart,value:o});break}let s=Nz(o[1]);this.cache[r]||(this.cache[r]={}),s!==null&&!(this.cache[r][s]&&this.cache[r][s].value[1]!==o[1])?this.cache[r][s]||(this.cache[r][s]={part:this.curPart,value:o}):(this.errorIds[r]||(this.errorIds[r]=[]),this.errorIds[r].push({part:this.curPart,value:o}));break}default:console.warn("can not find hanlder with",o)}}secondParseLine(o){switch(o[0]){case"DOCTYPE":case"HEAD":case"GROUP":case"FONTSTYLE":case"LINESTYLE":break;case"ATTR":this.parseAttr(o);break;case"WIRE":this.parseWire(o);break;case"BUS":this.parseBus(o);break;case"TEXT":this.parseText(o);break;case"POLY":this.parsePoly(o);break;case"CIRCLE":this.parseCircle(o);break;case"ARC":this.parseArc(o);break;case"BUSENTRY":break;case"RECT":this.parseRect(o);break;case"PIN":this.parsePin(o);break;case"OBJ":this.parseObj(o);break;case"COMPONENT":this.parseComponent(o);break;case"ELLIPSE":this.parseEllipse(o);break;case"BEZIER":this.parseBezier(o);break;case"TABLE":this.parseTable(o);break;case"TABEL_CELL":break}}onParseEnd(){this.docType==="SYMBOL"&&!this.hasPart&&(this.curPart=this.defaultPartId,this.onlyPart=this.curPart,this.partIdMap[""]=this.curPart,this.onPart(this.curPart,{title:""}));for(let o in this.cache){let t=this.cache[o],e=Object.keys(t).sort((i,n)=>Number(i)-Number(n)),r=0;for(let i of e){let n=Number(i),s=n-r-1;s>=1&&this.onPHolder(o,s),r=n,this.curPart=this.hasPart?t[n].part||this.onlyPart:this.curPart,this.secondParseLine(t[n].value),t[n].attr&&t[n].attr.forEach(a=>{this.curPart=this.hasPart?a.part||this.onlyPart:this.curPart,this.secondParseLine(a.value)})}if(this.errorIds[o])for(let i of this.errorIds[o])this.curPart=this.hasPart?i.part||this.onlyPart:this.curPart,this.secondParseLine(i.value)}this.clearCache()}clearCache(){this.fontStyleIndex={},this.lineStyleIndex={},this.groupIndex={},this.cache={},this.errorIds={},this.curPart="",this.components={},this.tableCell={},this.hasPart=!1,this.version=void 0,this.docType=void 0}parseDocType(o){this.docType=o[1];let t=parseFloat(o[2]);this.version=t}parseHead(o){this.onCanvas(o[1])}parseFontStyle(o){this.fontStyleIndex[o[1]]={color:o[3]===""?"none":o[3],fillColor:o[2],fontFamily:o[4],fontSize:typeof o[5]=="number"?o[5]:null,strikeout:o[9]===null?null:o[9]===1,underline:o[8]===null?null:o[8]===1,italic:o[6]===null?null:o[6]===1,fontWeight:o[7]===null?null:o[7]===1,vAlign:o[10],hAlign:o[11]}}parseLineStyle(o){this.lineStyleIndex[o[1]]={strokeColor:o[2],strokeStyle:this.transStrokeStyle(o[3]),fillColor:o[4]===""?"none":o[4],strokeWidth:o[5],fillStyle:this.transFillStyle(o[6])}}getGroupId(o){let t=this;for(let e in t.groupIndex){let r=t.groupIndex[e];if(r!=null&&r.includes(o))return e}return""}parseBezier(o){let t=this.lineStyleIndex[o[3]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=this.getGroupId(o[1]);for(let r=0;r<o[2].length;r+=2)o[2][r+1]=vg(o[2][r+1]);this.onBezier(o[1],this.curPart,e,!!o[4],o[2],t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parseGroup(o){this.groupIndex[o[1]]=o[4]||[],this.onGroup(o[1],o[2]||"",o[3]||"")}parseBus(o){let t=this.lineStyleIndex[o[3]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=o[2]||[],r=this.getGroupId(o[1]);this.onBus(o[1],this.curPart,r,!!o[4],e,t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle,this.busEntryMap[o[1]]||{})}parseWire(o){let t=this.lineStyleIndex[o[3]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=o[2]||[],r=this.getGroupId(o[1]);this.onWire(o[1],this.curPart,r,!!o[4],e,t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parseText(o){let t=this.fontStyleIndex[o[6]];t||(t=this.defaultFontStyle,console.warn("font not found",o));let e=this.transFontStyle(t),r=this.getGroupId(o[1]);this.onText(o[1],this.curPart,r,!!o[7],o[2],o[3],o[4],o[5],e.color,e.fillColor,e.fontFamily,e.fontSize,e.strikeout,e.underline,e.italic,e.fontWeight,e.align)}parsePoly(o){let t=this.lineStyleIndex[o[4]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=this.getGroupId(o[1]);this.onPoly(o[1],this.curPart,e,!!o[5],o[2]||[],!!o[3],t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parseCircle(o){let t=this.lineStyleIndex[o[5]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=this.getGroupId(o[1]);this.onCircle(o[1],this.curPart,e,!!o[6],o[2],o[3],o[4],t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parseArc(o){let t=this.lineStyleIndex[o[8]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=this.getGroupId(o[1]);this.onArc(o[1],this.curPart,e,!!o[9],o[2],o[3],o[4],o[5],o[6],o[7],t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parseBusEntry(o){let t=o[2],e={groupId:this.getGroupId(o[1]),locked:!1,zIndex:++this.zIndex,order:o[3],pointX:o[4],pointY:vg(o[5]),rotation:o[6]};this.busEntryMap[t]||(this.busEntryMap[t]={}),this.busEntryMap[t][o[1]]=e}parseRect(o){let t=this.lineStyleIndex[o[9]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=this.getGroupId(o[1]);this.onRect(o[1],this.curPart,e,!!o[10],o[2],o[3],o[4],o[5],o[6],o[7],o[8],t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parsePin(o){let t=this.getGroupId(o[1]);this.onPin(o[1],this.curPart,t,!!o[10],!!o[2],o[3],o[4],o[5],o[6],o[7],o[8],this.transPinShape(o[9]))}parseObj(o){let t=this.getGroupId(o[1]);this.version>=1.1?this.onObj(o[1],this.curPart,t,!!o[10],o[2],o[3],o[4],o[5],o[6],o[7],!!o[8],o[9]):this.onObj(o[1],this.curPart,t,!!o[10],o[2],o[4],o[5],o[6],o[7],o[8],!1,`data:${o[3]},${o[9]}`)}parseComponent(o){var t,e,r;let i=this.getGroupId(o[1]),n=o[2],s=this.components[o[1]];if(s){if(s.symbol){let a=this.symbolPartIds[s.symbol];a&&(n=a[o[2]]||o[2]||a[(t=Object.keys(a))==null?void 0:t[0]]||"")}else if(s.device){let a=this.device.find(c=>c.uuid===s.device),l=a?this.symbolPartIds[(e=a==null?void 0:a.attributes)==null?void 0:e.Symbol]:null;l&&(n=l[o[2]]||o[2]||l[(r=Object.keys(l))==null?void 0:r[0]]||"")}}this.onComponent(o[1],!!o[8],n,i,o[3],o[4],o[5],o[6]===1,o[7])}parseEllipse(o){let t=this.lineStyleIndex[o[7]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=this.getGroupId(o[1]);this.onEllipse(o[1],this.curPart,e,!!o[8],o[2],o[3],o[4],o[5],o[6],t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parseTable(o){let t=this.getGroupId(o[1]);this.onTable(o[1],this.curPart,t,o[2],o[3],o[4],o[5],o[6],o[7],o[8],this.tableCell[o[1]]||[])}parseTableCell(o){let t=this.lineStyleIndex[o[8]],e=this.lineStyleIndex[o[9]],r=this.lineStyleIndex[o[10]],i=this.lineStyleIndex[o[11]],n=this.fontStyleIndex[o[12]],s=Object.assign({},n);s.color=n.fillColor,s.fillColor=n.color,(!t||!e||!r||!i||!s)&&console.warn("style not found",o);let a={id:o[1],value:o[3],rowIndex:o[4],columnIndex:o[5],rowSpan:o[6],colSpan:o[7],topStyle:t||this.defaultLineStyle,rightStyle:e||this.defaultLineStyle,bottomStyle:r||this.defaultLineStyle,leftStyle:i||this.defaultLineStyle,fontStyle:this.transTableFontStyle(s||this.defaultFontStyle),lineHeight:o[13],zIndex:++this.zIndex};this.tableCell[o[2]]||(this.tableCell[o[2]]=[]),this.tableCell[o[2]].push(a)}parseAttr(o){let t=this.fontStyleIndex[o[10]];t||(t=this.defaultFontStyle,console.warn("fontStyle not found",o));let e=this.transFontStyle(t),r=this.getGroupId(o[1]);this.onAttr(o[1],this.curPart,r,!!o[11],o[2]||"",this.transPinAttrKey(String(o[3])),o[4],o[5]===null?null:!!o[5],o[6]===null?null:!!o[6],o[7]!==null?o[7]:null,o[8]!==null?o[8]:null,o[9],e.color,e.fillColor,e.fontFamily,e.fontSize,e.strikeout,e.underline,e.italic,e.fontWeight,e.align)}parsePart(o){this.curPart=o[1]||this.defaultPartId,this.onlyPart=this.curPart,this.partIdMap[o[1]]=this.curPart;let t=Object.assign(o[2]||{},{title:o[1]||""});this.onPart(this.curPart,t)}},yPt=class{constructor(){}encodeCanvas(o){return{id:"CANVAS",dataType:"CANVAS",data:JSON.stringify(o)}}encodeGroup(o,t){return{id:o,dataType:"GROUP",data:JSON.stringify(t)}}encodeAuxLine(o,t){return{id:o,dataType:"AUXLINE",data:JSON.stringify(t)}}encodeDimension(o,t){return{id:o,dataType:"DIMENSION",data:JSON.stringify(t)}}encodeString(o,t){return{id:o,dataType:"STRING",data:JSON.stringify(t)}}encodePoly(o,t){return{id:o,dataType:"POLY",data:JSON.stringify(t)}}},a7e=class{constructor(){}editHead(o,t){let e={uuid:o.uuid,nickname:o.nickname,username:o.username,updateTime:t};return`${JSON.stringify({type:"EDIT_HEAD"})}||${JSON.stringify(e)}`}head(o){return pM(this.doctype,o.client,o.doc,o.updateTime,o.version||String(o.updateTime),o.user,o.ticket)}creator(o,t){let e=typeof t=="string"?t:JSON.stringify(t);return F2("META_CREATE",o,"META_CREATE",e)}modifier(o,t){let e=typeof t=="string"?t:JSON.stringify(t);return F2("META_MODIFY",o,"META_MODIFY",e)}delete(o,t){let e=t||JSON.stringify({isDelete:!0});return F2("DELETE_DOC",o,"DELETE_DOC",e)}},lIe=class extends a7e{constructor(){super(...arguments),this.doctype="BLOB"}buildStr(o,t,e){let r=typeof e=="string"?e:JSON.stringify(this.buildData(e));return F2("BLOB",o,t,r)}buildData(o){return{filename:o.filename,content:o.content}}};var l7e=class{constructor(){}encodeString(o,t){return{id:o,dataType:"STRING",data:JSON.stringify(t)}}encodeAttr(o,t){return{id:o,dataType:"ATTR",data:JSON.stringify(t)}}encodePanelize(o){return{id:"PANELIZE",dataType:"PANELIZE",data:JSON.stringify(o)}}encodeRuleSelector(o){let t=JSON.stringify(["RULE_SELECTOR",o.ruleSelect]),e={...o};return delete e.ruleSelect,{id:t,dataType:"RULE_SELECTOR",data:JSON.stringify(e)}}encodeRule(o){let t=JSON.stringify(["RULE",o.ruleType,o.ruleName]),e={...o};return delete e.ruleType,delete e.ruleName,{id:t,dataType:"RULE",data:JSON.stringify(e)}}encodeRuleTemplate(o){return{id:"RULE_TEMPLATE",dataType:"RULE_TEMPLATE",data:JSON.stringify(o)}}encodeDimension(o,t){return{id:o,dataType:"DIMENSION",data:JSON.stringify(t)}}encodeBoss(o,t){return{id:o,dataType:"BOSS",data:JSON.stringify(t)}}encodeShellEntity(o,t){return{id:o,dataType:"SHELL_ENTITY",data:JSON.stringify(t)}}encodeShellCut(o,t){return{id:o,dataType:"SHELLCUT",data:JSON.stringify(t)}}encodeCrease(o,t){return{id:o,dataType:"CREASE",data:JSON.stringify(t)}}encodeShell(o,t){return{id:o,dataType:"SHELL",data:JSON.stringify(t)}}encodeFpcFill(o,t){return{id:o,dataType:"FPC_FILL",data:JSON.stringify(t)}}encodeTeardrop(o,t){return{id:o,dataType:"TEARDROP",data:JSON.stringify(t)}}encodeImage(o,t){return{id:o,dataType:"IMAGE",data:JSON.stringify(t)}}encodePoured(o,t){return{id:B2(o,"POURED"),dataType:"POURED",data:JSON.stringify(t)}}encodePour(o,t){return{id:o,dataType:"POUR",data:JSON.stringify(t)}}encodeRegion(o,t){return{id:o,dataType:"REGION",data:JSON.stringify(t)}}encodeFill(o,t){return{id:o,dataType:"FILL",data:JSON.stringify(t)}}encodeLayerFill(o,t){return{id:B2(o,"LAYER_FILL"),dataType:"LAYER_FILL",data:JSON.stringify(t)}}encodePoly(o,t){return{id:o,dataType:"POLY",data:JSON.stringify(t)}}encodeEQLenGrp(o,t){return{id:o,dataType:"EQLEN_GRP",data:JSON.stringify(t)}}encodeObj(o,t){return{id:o,dataType:"OBJ",data:JSON.stringify(t)}}encodeArc(o,t){return{id:o,dataType:"ARC",data:JSON.stringify(t)}}encodeLine(o,t){return{id:o,dataType:"LINE",data:JSON.stringify(t)}}encodePad(o,t){return{id:o,dataType:"PAD",data:JSON.stringify(t)}}encodeVia(o,t){return{id:o,dataType:"VIA",data:JSON.stringify(t)}}encodePreference(o){return{id:"PREFERENCE",dataType:"PREFERENCE",data:JSON.stringify(o)}}encodeSilkOpts(o,t){return{id:B2(o,"SILK_OPTS"),dataType:"SILK_OPTS",data:JSON.stringify(t)}}encodeGroup(o,t){return{id:o,dataType:"GROUP",data:JSON.stringify(t)}}encodePrimitive(o,t){return{id:B2(o,"PRIMITIVE"),dataType:"PRIMITIVE",data:JSON.stringify(t)}}encodeNet(o,t){return{id:B2(o,"NET"),dataType:"NET",data:JSON.stringify(t)}}encodeActiveLayer(o){return{id:"ACTIVE_LAYER",dataType:"ACTIVE_LAYER",data:JSON.stringify(o)}}encodeLayerPhys(o,t){return{id:B2(o,"LAYER_PHYS"),dataType:"LAYER_PHYS",data:JSON.stringify(t)}}encodeLayer(o,t){return{id:B2(o,"LAYER"),dataType:"LAYER",data:JSON.stringify(t)}}encodeCanvas(o){return{id:"CANVAS",dataType:"CANVAS",data:JSON.stringify(o)}}},bPt=class extends $yt{constructor(o=!1){super(void 0,void 0,void 0,void 0,o),this.encode=new l7e,this.maxTicket=0,this.blobEncode=new lIe,this.blobData=[],this.encodeData="",this.placeholder=0}handleData(o){this.encodeData?this.encodeData=this.encodeData+`|
`+F2(o.dataType,++this.maxTicket,o.id,o.data):this.encodeData=F2(o.dataType,++this.maxTicket,o.id,o.data)}getZIndex(o){let t=o.match(QTe);return t!=null&&t.length?t[1]:null}onPHolder(o,t){let e={dataType:o,max:t};this.handleData({id:`placeholder${++this.placeholder}`,dataType:"ELE_PLACEHOLDER",data:JSON.stringify(e)})}onLayerFill(o,t){this.handleData(this.encode.encodeLayerFill(o,t))}onString(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P){let T=this.getZIndex(o);this.handleData(this.encode.encodeString(zl(o),{groupId:e,layerId:r,x:i,y:n,text:s,fontFamily:a,fontSize:l,strokeWidth:c,bold:h,italic:u,origin:d,angle:p,reverse:m,expansion:g,mirror:y,locked:b,zIndex:T===null?null:Number(T),specialColor:P}))}onAttr(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O){let _=this.getZIndex(o);_&&E&&(_=_+"."+String(E)),this.handleData(this.encode.encodeAttr(zl(o),{groupId:e,parentId:r,layerId:i,x:n,y:s,key:a,value:l,keyVisible:c,valueVisible:h,fontFamily:u,fontSize:d,strokeWidth:p,bold:m,italic:g,origin:y,angle:b,reverse:P,expansion:T,mirror:I,locked:C,zIndex:_===null?null:Number(_),specialColor:O}))}onPadNet(o,t,e,r,i){}onComponent(o,t,e,r,i,n,s,a,l){}onPanelize(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodePanelize({on:o,row:t,column:e,rowSpacing:r,columnSpacing:i,onlyOutline:n,horizontalStamp:s,verticalStamp:a,horizontalSize:l,verticalSize:c}))}onRuleSelector(o,t,e,r,i){this.handleData(this.encode.encodeRuleSelector({ruleSelect:o,ruleOrder:t,ruleKeyValue:e,copperValue:r,innerPlaneValue:i}))}onRule(o,t,e,r){this.handleData(this.encode.encodeRule({ruleType:o,ruleName:t,ruleState:e,ruleContext:r}))}onRuleTemplate(o){this.handleData(this.encode.encodeRuleTemplate({name:o}))}onDimension(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeDimension(zl(o),{type:e,layerId:r,unit:i,strokeWidth:n,precision:s,textFollow:a,coords:l,locked:c,zIndex:p===null?null:Number(p),text:h,specialColor:u,groupId:d}))}onBoss(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeBoss(zl(o),{groupId:e,layerId:r,centerX:i,centerY:n,specification:s,depth:a,thickness:l,holeDiameter:c,counterBore:h?{height:h[0],diameter:h[1]}:null,stiffener:u?{topWidth:u[0],bottomWidth:u[1],height:u[2],stiffThickness:u[3]}:null,locked:d,zIndex:p===null?null:Number(p)}))}onShellEntity(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.getZIndex(o),p={groupId:e,layerId:r,type:i?"ENTITY":"SLOT",depth:a,strokeWidth:l,path:c,locked:h,zIndex:d===null?null:Number(d),refs:u};p.type==="ENTITY"&&(p.entityBelong=n),p.type==="SLOT"&&(p.slotOptions=s),this.handleData(this.encode.encodeShellEntity(zl(o),p))}onShellCut(o,t,e,r,i,n,s,a,l){let c=this.getZIndex(o);this.handleData(this.encode.encodeShellCut(zl(o),{groupId:e,layerId:r,depth:i,strokeWidth:n,path:s,locked:a,zIndex:c===null?null:Number(c),refs:l}))}onCrease(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o);this.handleData(this.encode.encodeCrease(zl(o),{groupId:e,layerId:r,startX:i,startY:n,endX:s,endY:a,angle:l,locked:c,zIndex:h===null?null:Number(h)}))}onShell(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o),u={groupId:e,shellType:r,shellHeight:i,pcbHeight:n,strokeWidth:s,path:a,thickness:l.Thickness,locked:c,zIndex:h===null?null:Number(h)};r==="DRAWER"&&(u.direction=l.Direction),r==="T&B"&&(u.bottomHeight=l.BottomHeight,u.topInnerHeight=l.TopInnerHeight,u.bottomInnerHeight=l.BottomInnerHeight),this.handleData(this.encode.encodeShell(zl(o),u))}onFpcFill(o,t,e,r,i,n,s,a){let l=this.getZIndex(o);this.handleData(this.encode.encodeFpcFill(zl(o),{groupId:e,layerId:r,material:i,thickness:n,path:s,locked:a,zIndex:l===null?null:Number(l)}))}onTeardrop(o,t,e,r,i,n,s){this.handleData(this.encode.encodeTeardrop(zl(o),{netName:e,layerId:r,path:i,groupId:n,refs:s,locked:!1}))}onImage(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeImage(zl(o),{groupId:e,layerId:r,startX:i,startY:n,width:s,height:a,angle:l,mirror:c,path:h,locked:u,zIndex:p===null?null:Number(p),specialColor:d}))}onPoured(o,t){this.handleData(this.encode.encodePoured(zl(o),t))}onPour(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.getZIndex(o);this.handleData(this.encode.encodePour(zl(o),{groupId:e,netName:r,layerId:i,width:n,name:s,order:a,path:l,pourType:c,keepIsland:h,locked:u,zIndex:d===null?null:Number(d)}))}onRegion(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o);this.handleData(this.encode.encodeRegion(zl(o),{groupId:e,layerId:r,width:i,prohibitType:n,path:s,locked:a,zIndex:h===null?null:Number(h),name:l,regionType:c}))}onFill(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeFill(zl(o),{groupId:e,netName:r,layerId:i,width:n,fillStyle:s,path:a,locked:l,zIndex:u===null?null:Number(u),isBridgingCopper:!1,networkList:[],refs:c,specialColor:h}))}onPoly(o,t,e,r,i,n,s,a,l){let c=this.getZIndex(o);this.handleData(this.encode.encodePoly(zl(o),{groupId:e,netName:r,layerId:i,width:n,path:s,locked:a,zIndex:c===null?null:Number(c),specialColor:l,polyType:i==11?"BOARD_OUTLINE":"NORMAL"}))}onEQLenGrp(o,t,e,r){this.handleData(this.encode.encodeEQLenGrp(zl(o),{name:t,sort:e,pads:r}))}onObj(o,t,e,r,i,n,s,a,l,c,h,u,d,p){if(u.startsWith("data:")){let g=ste(u);this.blobData.push(this.blobEncode.buildStr(1,g,{filename:i,content:u})),u=`blob:${g}`}let m=this.getZIndex(o);this.handleData(this.encode.encodeObj(zl(o),{groupId:e,layerId:r,fileName:i,startX:n,startY:s,width:a,height:l,angle:c,mirror:h,path:u,locked:d,zIndex:m===null?null:Number(m),specialColor:p}))}onArc(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeArc(zl(o),{groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,angle:c,width:h,locked:u,zIndex:p===null?null:Number(p),arcType:"DOT",specialColor:d}))}onCArc(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeArc(zl(o),{groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,angle:c,width:h,locked:u,zIndex:p===null?null:Number(p),arcType:"CENT",specialColor:d}))}onLine(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeLine(zl(o),{groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,width:c,locked:h,zIndex:u===null?null:Number(u)}))}onPad(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v){let D=this.getZIndex(o);this.handleData(this.encode.encodePad(zl(o),{groupId:e,netName:r,layerId:i,num:n,centerX:s,centerY:a,padAngle:l,hole:c,defaultPad:h,specialPad:u,padOffsetX:d,padOffsetY:p,relativeAngle:m,plated:g,padType:y,topSolderExpansion:b,bottomSolderExpansion:P,topPasteExpansion:T,bottomPasteExpansion:I,locked:C,zIndex:D===null?null:Number(D),connectMode:E,spokeSpace:O,spokeWidth:_,spokeAngle:R,unusedInnerLayers:v,padLen:0}))}onVia(o,t,e,r,i,n,s,a,l,c,h,u,d,p){let m=this.getZIndex(o);this.handleData(this.encode.encodeVia(zl(o),{groupId:e,netName:r,ruleName:i,centerX:n,centerY:s,holeDiameter:a,viaDiameter:l,viaType:c,topSolderExpansion:h,bottomSolderExpansion:u,locked:d,zIndex:m===null?null:Number(m),unusedInnerLayers:p}))}onPreference(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T){this.handleData(this.encode.encodePreference({startTrackWidthFollowLast:o,lastTrackWidth:t,startViaSizeFollowLast:e,lastViaInnerDiameter:r,lastViaDiameter:i,snap:n,routingMode:s,routingCorner:a,removeLoop:l,rotatingObject:c,trackFollow:h,stretchTrackMinCorner:u,preferenceConfig:d,realTimeUpdateUnusedLayers:p,unusedPadRange:m,pushVia:g,pathOptimization4BePushed:y,currentPathOptimization4BePushed:b,removeCircuitsContainingVias:P,removeAntenna:T}))}onSilkOpts(o,t,e){this.handleData(this.encode.encodeSilkOpts(o,{defaultColor:t,baseColor:e}))}onGroup(o,t){this.handleData(this.encode.encodeGroup(o,{groupName:t}))}onPrimitive(o,t,e){this.handleData(this.encode.encodePrimitive(o,{display:t,pick:e}))}onNet(o,t,e,r,i,n,s){this.handleData(this.encode.encodeNet(o,{netType:t,specialColor:e,retLine:r,differentialName:i,isPositiveNet:n,equalLengthGroupName:s}))}onPartition(o,t,e,r){}onActiveLayer(o){this.handleData(this.encode.encodeActiveLayer({layerId:o}))}onLayerPhys(o,t,e,r,i,n,s){this.handleData(this.encode.encodeLayerPhys(o,{material:t,thickness:e,permittivity:r,lossTangent:i,isKeepIsland:n,zIndex:s}))}onLayer(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodeLayer(o,{layerType:t,layerName:e,use:r,show:i,locked:n,activeColor:s,activateTransparency:a,inactiveColor:l,inactiveTransparency:c}))}onCanvas(o,t,e,r,i,n,s,a,l,c,h,u){this.handleData(this.encode.encodeCanvas({originX:o,originY:t,unit:e,gridXSize:r,gridYSize:i,snapXSize:n,snapYSize:s,altSnapXSize:a,altSnapYSize:l,gridType:c,multiGridType:h,multiGridRatio:u,highlightValue:.5}))}};function PPt(o,t,e,r=new Date().getTime(),i=String(r),n){let s=new bPt(e),a="",l=DI();if(a=pM("FOOTPRINT",l,o,r,i,n),s.parseFull(t),s.encodeData&&(a=a+`|
`+s.encodeData),s.blobData.length&&(a=a+`|
`+s.blobEncode.head({doc:"BLOB",client:l,updateTime:r,version:i,user:n})+`|
`+s.blobData.join(`|
`)),s.fontCache.length){let c=new SPt,h=c.head({doc:"FONT",client:l,updateTime:r,version:i,user:n});for(let u of s.fontCache){let d=ITe(u.text,u.fontFamily,u.fontSize,u.thickness,u.bold,u.italic,u.reverse,u.expansion),p=c.buildStr(1,d,u);h=h+`|
`+p}a=h+`|
`+a}return a}var TPt=class{constructor(){}encodePart(o,t){return{id:o,dataType:"PART",data:JSON.stringify(t)}}encodeCanvas(o){return{id:"CANVAS",dataType:"CANVAS",data:JSON.stringify(o)}}encodeAttr(o,t){return{id:o,dataType:"ATTR",data:JSON.stringify(t)}}encodeTable(o,t){return{id:o,dataType:"TABLE",data:JSON.stringify(t)}}encodeEllipse(o,t){return{id:o,dataType:"ELLIPSE",data:JSON.stringify(t)}}encodeObj(o,t){return{id:o,dataType:"OBJ",data:JSON.stringify(t)}}encodePin(o,t){return{id:o,dataType:"PIN",data:JSON.stringify(t)}}encodeRect(o,t){return{id:o,dataType:"RECT",data:JSON.stringify(t)}}encodeArc(o,t){return{id:o,dataType:"ARC",data:JSON.stringify(t)}}encodeCircle(o,t){return{id:o,dataType:"CIRCLE",data:JSON.stringify(t)}}encodePoly(o,t){return{id:o,dataType:"POLY",data:JSON.stringify(t)}}encodeText(o,t){return{id:o,dataType:"TEXT",data:JSON.stringify(t)}}encodeBezier(o,t){return{id:o,dataType:"BEZIER",data:JSON.stringify(t)}}encodeGroup(o,t){return{id:o,dataType:"GROUP",data:JSON.stringify(t)}}},IPt=class extends gPt{constructor(){super(),this.encode=new TPt,this.maxTicket=0,this.blobEncode=new lIe,this.blobData=[],this.encodeData="",this.placeholder=0}handleData(o){this.encodeData?this.encodeData=this.encodeData+`|
`+F2(o.dataType,++this.maxTicket,o.id,o.data):this.encodeData=F2(o.dataType,++this.maxTicket,o.id,o.data)}onPHolder(o,t){let e={dataType:o,max:t};this.handleData({id:`placeholder${++this.placeholder}`,dataType:"ELE_PLACEHOLDER",data:JSON.stringify(e)})}onPart(o,t){this.handleData(this.encode.encodePart(o,t||{}))}onAttr(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I){this.handleData(this.encode.encodeAttr(zl(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),parentId:i,key:n,value:s,keyVisible:a,valueVisible:l,x:c,y:vg(h),rotation:u,color:d,fillColor:p,fontFamily:m,fontSize:g,strikeout:y,underline:b,italic:P,fontWeight:T,align:I,version:"2.0"}))}onTable(o,t,e,r,i,n,s,a,l,c,h){this.handleData(this.encode.encodeTable(zl(o),{partId:t,groupId:e,startX:r,startY:vg(i),rowSizes:n,colSizes:s,rowLocked:a,colLocked:l,rotation:c,tableCell:h,zIndex:this.getZIndex(o)}))}onEllipse(o,t,e,r,i,n,s,a,l,c,h,u,d,p){this.handleData(this.encode.encodeEllipse(zl(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),centerX:i,centerY:vg(n),radiusX:s,radiusY:vg(a),rotation:l,strokeColor:c,strokeStyle:h,fillColor:u,strokeWidth:d,fillStyle:p}))}onComponent(){}onObj(o,t,e,r,i,n,s,a,l,c,h,u){if(u.startsWith("data:")){let d=ste(u);this.blobData.push(this.blobEncode.buildStr(1,d,{filename:"",content:u})),u=`blob:${d}`}this.handleData(this.encode.encodeObj(zl(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),fileName:i,startX:n,startY:vg(s),width:a,height:l,rotation:c,isMirror:h,content:u}))}onPin(o,t,e,r,i,n,s,a,l,c,h,u){this.handleData(this.encode.encodePin(zl(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),display:i,x:s,y:vg(a),length:l,rotation:c,color:h,pinShape:u}))}onRect(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g){this.handleData(this.encode.encodeRect(zl(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),dotX1:i,dotY1:vg(n),dotX2:s,dotY2:vg(a),radiusX:l,radiusY:c,rotation:h,strokeColor:u,strokeStyle:d,fillColor:p,strokeWidth:m,fillStyle:g}))}onArc(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m){this.handleData(this.encode.encodeArc(zl(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),startX:i,startY:vg(n),referX:s,referY:vg(a),endX:l,endY:vg(c),strokeColor:h,strokeStyle:u,fillColor:d,strokeWidth:p,fillStyle:m}))}onCircle(o,t,e,r,i,n,s,a,l,c,h,u){this.handleData(this.encode.encodeCircle(zl(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),centerX:i,centerY:vg(n),radius:s,strokeColor:a,strokeStyle:l,fillColor:c,strokeWidth:h,fillStyle:u}))}onPoly(o,t,e,r,i,n,s,a,l,c,h){this.handleData(this.encode.encodePoly(zl(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),points:w1t(i,!0),closed:n,strokeColor:s,strokeStyle:a,fillColor:l,strokeWidth:c,fillStyle:h}))}onText(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y){this.handleData(this.encode.encodeText(zl(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),x:i,y:vg(n),rotation:s,value:a,color:l,fillColor:c,fontFamily:h,fontSize:u,strikeout:d,underline:p,italic:m,fontWeight:g,align:y,version:"2.0"}))}onCanvas(o){this.handleData(this.encode.encodeCanvas({originX:o.originX,originY:vg(o.originY)}))}onBezier(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodeBezier(zl(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),controls:i,strokeColor:n,strokeStyle:s,fillColor:a,strokeWidth:l,fillStyle:c}))}onGroup(o,t,e){this.handleData(this.encode.encodeGroup(String(o),{parentId:t,title:e}))}onBus(){}onWire(){}};function CPt(o,t,e=new Date().getTime(),r=String(e),i){let n=new IPt,s="";n.parseFull(t);let a=DI();n.encodeData&&(s=pM("SYMBOL",a,o,e,r,i)+`|
`+n.encodeData),s&&n.blobData.length&&(s=s+`|
`+n.blobEncode.head({doc:"BLOB",client:a,updateTime:e,version:r,user:i})+`|
`+n.blobData.join(`|
`));let l=n.partIdMap;return n.partIdMap={},{dataStr:s,partIdMap:l}}var SPt=class extends a7e{constructor(){super(...arguments),this.doctype="FONT"}buildStr(o,t,e){let r=typeof e=="string"?e:JSON.stringify(this.buildData(e));return F2("FONT",o,t,r)}buildData(o){return{width:o.width,height:o.height,path:o.path}}};var EPt=class extends mPt{constructor(){super(),this.encode=new yPt,this.maxTicket=0,this.blobEncode=new lIe,this.blobData=[],this.encodeData="",this.placeholder=0}handleData(o){this.encodeData?this.encodeData=this.encodeData+`|
`+F2(o.dataType,++this.maxTicket,o.id,o.data):this.encodeData=F2(o.dataType,++this.maxTicket,o.id,o.data)}onPHolder(o,t){let e={dataType:o,max:t};this.handleData({id:`placeholder${++this.placeholder}`,dataType:"ELE_PLACEHOLDER",data:JSON.stringify(e)})}strokeStyleType(o){switch(o=o&&Number(o),o){case 0:return"SOLID";case 1:return"SHORT_DASH";case 2:return"DOT";case 3:return"DOT_DASH";default:return null}}transScopeType(o){switch(o=o&&Number(o),o){case 1:return"PRINT";case 2:return"COVER";case 3:return"PRINT&COVER";default:return null}}transAlignType(o){switch(o=o&&Number(o),o){case 0:return"LEFT_BOTTOM";case 1:return"CENTER_BOTTOM";case 2:return"RIGHT_BOTTOM";case 3:return"LEFT_MIDDLE";case 4:return"CENTER_MIDDLE";case 5:return"RIGHT_MIDDLE";case 6:return"LEFT_TOP";case 7:return"CENTER_TOP";case 8:return"RIGHT_TOP";default:return null}}onAuxLine(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T){this.handleData(this.encode.encodeAuxLine(zl(o),{groupId:t?`e${t}`:"",layer:e,x:r,y:i,rotation:n,strokeWidth:s,strokeStyle:this.strokeStyleType(a),color:l,length:c,locked:h,zIndex:this.getZIndex(o),visible:!d,cover:p,name:m}))}onDimension(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b){this.handleData(this.encode.encodeDimension(zl(o),{layer:t,dimensionType:e,unit:r,strokeWidth:i,accuracy:n,controlDot:s,relationIds:a,locked:l,zIndex:this.getZIndex(o),valid:!c,visible:!h,cover:u,name:d,rotation:0}))}onString(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_){this.handleData(this.encode.encodeString(zl(o),{groupId:t?`e${t}`:"",layer:e,rotation:r,value:i,fontFamily:n,fontSize:s,fontWeight:a,italic:l,underline:c,strikeout:h,align:this.transAlignType(u),strokeColor:d,opacity:p,locked:m,zIndex:this.getZIndex(o),valid:!g,visible:!y,cover:b,transScope:this.transScopeType(T),transPrint:I,transWhite:C,matrix:E,strokes:O,path:_,name:P}))}onPoly(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C){if(typeof a=="string"&&a.startsWith("data:")){let E=ste(a);this.blobData.push(this.blobEncode.buildStr(1,E,{filename:"",content:a})),a=`blob:${E}`}this.handleData(this.encode.encodePoly(zl(o),{groupId:t?`e${t}`:"",layer:e,rotation:r,strokeWidth:i,strokeStyle:this.strokeStyleType(n),strokeColor:s,fillColor:a,opacity:l,autoClose:c,ploys:h,displayFill:u,displayStroke:d,locked:p,zIndex:this.getZIndex(o),valid:!m,visible:!g,cover:y,transScope:this.transScopeType(P),transPrint:T,transWhite:I,matrix:C,name:b}))}onGroup(o,t,e,r,i){this.handleData(this.encode.encodeGroup(`e${o}`,{parentId:t?`e${t}`:"",title:e,visible:r,locked:i}))}onCanvas(o){this.handleData(this.encode.encodeCanvas(o))}};function OPt(o,t,e,r=new Date().getTime(),i=String(r),n){let s=new EPt,a="";s.parseFull(t);let l=DI();return s.encodeData&&(a=pM(e,l,o,r,i,n)+`|
`+s.encodeData),a&&s.blobData.length&&(a=a+`|
`+s.blobEncode.head({doc:"BLOB",client:l,updateTime:r,version:i,user:n})+`|
`+s.blobData.join(`|
`)),a}var c7e=class extends Ryt{constructor(o){let t=o||new vNe;super(t,0,k1t),this.cacheNum=null}onParseLine(o,t,e,r,i,n,s){switch(this.setOrderNum(o,s,t),this.cacheNum=s,t){case"MAX_NUM":if(e)for(let l in e)this.setMaxNum(l,e[l]);break;case"BLOB":e?this.onBlob(o,r,i,e,n):this.onDelBlob(o,r,i,n);break;case"FONT":this.parseFont(o,e,r,i,n);break;case"META":e&&this.parseDetail(e,r,i,n);break;case"ELE_PLACEHOLDER":break;case"CANVAS":e&&this.parseCanvas(e,r,i,n);break;case"BOARD":e?this.parseBoard(e,r,i,n):this.onDelBoard(r,i,n);break;case"LAYER":{let l=Jv(o);e?this.parseLayer(l,e,r,i,n):this.onDelLayer(l,r,i,n);break}case"LAYER_PHYS":{let l=Jv(o);e?this.parseLayerPhys(l,e,r,i,n):this.onDelLayerPhys(l,r,i,n);break}case"ACTIVE_LAYER":e&&this.parseActiveLayer(o,e,r,i,n);break;case"PARTITION":e?this.parsePartition(o,e,r,i,n):this.onDelPartition(o,r,i,n);break;case"NET":{let l=Jv(o);e?this.parseNet(l,e,r,i,n):this.onDelNet(l,r,i,n);break}case"PRIMITIVE":{let l=Jv(o);e?this.parsePrimitive(l,e,r,i,n):this.onDelPrimitive(l,r,i,n);break}case"GROUP":e?this.parseGroup(o,e,r,i,n):this.onDelGroup(o,r,i,n);break;case"X_SIGNAL_GROUP":e?this.parseXSignalsGroup(o,e,r,i,n):this.onDelXSignalsGroup(o,r,i,n);break;case"X_SIGNALS":e?this.parseXSignals(o,e,r,i,n):this.onDelXSignals(o,r,i,n);break;case"SILK_OPTS":{let l=Jv(o);e?this.parseSilkOpts(l,e,r,i,n):this.onDelSilkOpts(l,r,i,n);break}case"PREFERENCE":e&&this.parsePreference(o,e,r,i,n);break;case"VIA":e?this.parseVia(o,e,r,i,n):this.onDelVia(o,r,i,n);break;case"PAD":e?this.parsePad(o,e,r,i,n):this.onDelPad(o,r,i,n);break;case"LINE":e?this.parseLine(o,e,r,i,n):this.onDelLine(o,r,i,n);break;case"ARC":e?this.parseArc(o,e,r,i,n):this.onDelArc(o,r,i,n);break;case"OBJ":e?this.parseObj(o,e,r,i,n):this.onDelObj(o,r,i,n);break;case"EQLEN_GRP":e?this.parseEQLenGrp(o,e,r,i,n):this.onDelEQLenGrp(o,r,i,n);break;case"POLY":e?this.parsePoly(o,e,r,i,n):this.onDelPoly(o,r,i,n);break;case"FILL":e?this.parseFill(o,e,r,i,n):this.onDelFill(o,r,i,n);break;case"LAYER_FILL":let a=Jv(o);e?this.parseLayerFill(a,e,r,i,n):this.onDelLayerFill(a,r,i,n);break;case"REGION":e?this.parseRegion(o,e,r,i,n):this.onDelRegion(o,r,i,n);break;case"POUR":e?this.parsePour(o,e,r,i,n):this.onDelPour(o,r,i,n);break;case"POURED":{o=Jv(o),e?this.parsePoured(o,e,r,i,n):this.onDelPoured(o,r,i,n);break}case"IMAGE":e?this.parseImage(o,e,r,i,n):this.onDelImage(o,r,i,n);break;case"TEARDROP":e?this.parseTeardrop(o,e,r,i,n):this.onDelTeardrop(o,r,i,n);break;case"FPC_FILL":e?this.parseFpcFill(o,e,r,i,n):this.onDelFpcFill(o,r,i,n);break;case"SHELL":e?this.parseShell(o,e,r,i,n):this.onDelShell(o,r,i,n);break;case"CREASE":e?this.parseCrease(o,e,r,i,n):this.onDelCrease(o,r,i,n);break;case"SHELLCUT":e?this.parseShellCut(o,e,r,i,n):this.onDelShellCut(o,r,i,n);break;case"SHELL_ENTITY":e?this.parseShellEntity(o,e,r,i,n):this.onDelShellEntity(o,r,i,n);break;case"BOSS":e?this.parseBoss(o,e,r,i,n):this.onDelBoss(o,r,i,n);break;case"STRING":e?this.parseString(o,e,r,i,n):this.onDelString(o,r,i,n);break;case"ATTR":e?this.parseAttr(o,e,r,i,n):this.onDelAttr(o,r,i,n);break;case"DIMENSION":e?this.parseDimension(o,e,r,i,n):this.onDelDimension(o,r,i,n);break;case"COMPONENT":e?this.parseComponent(o,e,r,i,n):this.onDelComponent(o,r,i,n);break;case"PAD_NET":{let l=JSON.parse(o);e?(e.componentId=l[1],e.padNum=l[2],e.padId=l[3],this.parsePadNet(e,r,i,n)):this.onDelPadNet(l[1],l[2],l[3]||"",r,i,n);break}case"RULE_TEMPLATE":e&&this.parseRuleTemplate(o,e,r,i,n);break;case"RULE":{let l=JSON.parse(o);e?(e.ruleType=l[1],e.ruleName=l[2],this.parseRule(e,r,i,n)):this.onDelRule(l[1],l[2],r,i,n);break}case"RULE_SELECTOR":{let l=JSON.parse(o);e?(e.ruleSelect=l[1],this.parseRuleSelector(e,r,i,n)):this.onDelRuleSelector(l[1],r,i,n);break}case"PANELIZE":e?this.parsePanelize(o,e,r,i,n):this.onDelPanelize(r,i,n);break;default:console.warn("can not find hanlder with",e,r,i)}this.cacheNum=null}onOrderNum(o,t,e){switch(this.setOrderNum(o,e,t),t){case"PARTITION":this.onPartitionNum&&this.onPartitionNum(o,e);break;case"VIA":this.onViaNum&&this.onViaNum(o,e);break;case"PAD":this.onPadNum&&this.onPadNum(o,e);break;case"LINE":this.onLineNum&&this.onLineNum(o,e);break;case"ARC":this.onArcNum&&this.onArcNum(o,e);break;case"OBJ":this.onObjNum&&this.onObjNum(o,e);break;case"POLY":this.onPolyNum&&this.onPolyNum(o,e);break;case"FILL":this.onFillNum&&this.onFillNum(o,e);break;case"REGION":this.onRegionNum&&this.onRegionNum(o,e);break;case"POUR":this.onPourNum&&this.onPourNum(o,e);break;case"POURED":let r=Jv(o);this.onPouredNum&&this.onPouredNum(r,e);break;case"IMAGE":this.onImageNum&&this.onImageNum(o,e);break;case"TEARDROP":this.onTeardropNum&&this.onTeardropNum(o,e);break;case"FPC_FILL":this.onFpcFillNum&&this.onFpcFillNum(o,e);break;case"SHELL":this.onShellNum&&this.onShellNum(o,e);break;case"CREASE":this.onCreaseNum&&this.onCreaseNum(o,e);break;case"SHELLCUT":this.onShellCutNum&&this.onShellCutNum(o,e);break;case"SHELL_ENTITY":this.onShellEntityNum&&this.onShellEntityNum(o,e);break;case"BOSS":this.onBossNum&&this.onBossNum(o,e);break;case"STRING":this.onStringNum&&this.onStringNum(o,e);break;case"ATTR":this.onAttrNum&&this.onAttrNum(o,e);break;case"DIMENSION":this.onDimensionNum&&this.onDimensionNum(o,e);break;case"COMPONENT":this.onComponentNum&&this.onComponentNum(o,e);break}}onParseEnd(){}parseCanvas(o,t,e,r){this.onCanvas(t,e,o,r)}parseBoard(o,t,e,r){this.onBoard(o,t,e,r)}parseDetail(o,t,e,r){this.onDocDetail(t,e,o,r)}parseFont(o,t,e,r,i){let n=Ayt(o);t?this.onFont(e,r,Object.assign(t,n),i):this.onDelFont(n,e,r,i)}parseLayer(o,t,e,r,i){this.onLayer(o,e,r,t,i)}parseLayerPhys(o,t,e,r,i){this.onLayerPhys(o,e,r,t,i)}parseActiveLayer(o,t,e,r,i){this.onActiveLayer(e,r,t,i)}parsePartition(o,t,e,r,i){this.onPartition(o,this.cacheNum,e,r,t,i)}parseNet(o,t,e,r,i){this.onNet(o,e,r,t,i)}parsePrimitive(o,t,e,r,i){this.onPrimitive(o,e,r,t,i)}parseGroup(o,t,e,r,i){this.onGroup(o,e,r,t,i)}parseXSignalsGroup(o,t,e,r,i){this.onXSignalsGroup(o,t,e,r,i)}parseXSignals(o,t,e,r,i){this.onXSignals(o,t,e,r,i)}parseSilkOpts(o,t,e,r,i){this.onSilkOpts(o,e,r,t,i)}parsePreference(o,t,e,r,i){this.onPreference(e,r,t,i)}parseVia(o,t,e,r,i){this.onVia(o,this.cacheNum,e,r,t,i)}parsePad(o,t,e,r,i){this.onPad(o,this.cacheNum,e,r,t,i)}parseLine(o,t,e,r,i){this.onLine(o,this.cacheNum,e,r,t,i)}parseArc(o,t,e,r,i){this.onArc(o,this.cacheNum,e,r,t,i)}parseObj(o,t,e,r,i){this.onObj(o,this.cacheNum,e,r,t,i)}parseEQLenGrp(o,t,e,r,i){this.onEQLenGrp(o,e,r,t,i)}parsePoly(o,t,e,r,i){this.onPoly(o,this.cacheNum,e,r,t,i)}parseFill(o,t,e,r,i){t.fillStyle!=="PLANE"&&this.onFill(o,this.cacheNum,e,r,t,i)}parseLayerFill(o,t,e,r,i){this.onLayerFill(o,e,r,t,i)}parseRegion(o,t,e,r,i){this.onRegion(o,this.cacheNum,e,r,t,i)}parsePour(o,t,e,r,i){this.onPour(o,this.cacheNum,e,r,t,i)}parsePoured(o,t,e,r,i){let n=t;Array.isArray(t)&&(n={pourFill:t}),n.pourFill&&this.onPoured(o,this.cacheNum,e,r,n,i)}parseImage(o,t,e,r,i){this.onImage(o,this.cacheNum,e,r,t,i)}parseTeardrop(o,t,e,r,i){this.onTeardrop(o,this.cacheNum,e,r,t,i)}parseFpcFill(o,t,e,r,i){this.onFpcFill(o,this.cacheNum,e,r,t,i)}parseShell(o,t,e,r,i){this.onShell(o,this.cacheNum,e,r,t,i)}parseCrease(o,t,e,r,i){this.onCrease(o,this.cacheNum,e,r,t,i)}parseShellCut(o,t,e,r,i){this.onShellCut(o,this.cacheNum,e,r,t,i)}parseShellEntity(o,t,e,r,i){this.onShellEntity(o,this.cacheNum,e,r,t,i)}parseBoss(o,t,e,r,i){this.onBoss(o,this.cacheNum,e,r,t,i)}parseDimension(o,t,e,r,i){this.onDimension(o,this.cacheNum,e,r,t,i)}parseRuleTemplate(o,t,e,r,i){this.onRuleTemplate(e,r,t,i)}parseRule(o,t,e,r){this.onRule(t,e,o,r)}parseRuleSelector(o,t,e,r){if(o.ruleKeyValue&&(o.ruleKeyValue=$k(o.ruleKeyValue)),o.copperValue&&o.copperValue.hasOwnProperty("7")){let i=o.copperValue[7];delete o.copperValue[7],o.copperValue.COPPER=i}if(o.innerPlaneValue&&o.innerPlaneValue.hasOwnProperty("6")){let i=o.innerPlaneValue[6];delete o.innerPlaneValue[6],o.innerPlaneValue.PLANE=i}this.onRuleSelector(t,e,o,r)}parsePanelize(o,t,e,r,i){this.onPanelize(e,r,t,i)}parseComponent(o,t,e,r,i){this.onComponent(o,this.cacheNum,e,r,t,i)}parsePadNet(o,t,e,r){this.onPadNet(t,e,o,r)}parseAttr(o,t,e,r,i){this.onAttr(o,this.cacheNum,e,r,t,i)}parseString(o,t,e,r,i){this.onString(o,this.cacheNum,e,r,t,i)}},APt=(o=>(o.UNIVERSAL="UNIVERSAL",o))(APt||{}),_Pt=(o=>(o.SINGLE="SINGLE",o.MULTIPLE="MULTIPLE",o))(_Pt||{}),vPt=(o=>(o.NONE="NONE",o.NAME="NAME",o.NUMBER="NUMBER",o))(vPt||{}),xPt=(o=>(o.NONE="NONE",o.ZONE="ZONE",o))(xPt||{}),RPt=mB(jz());function Vz(){return self.EDITOR_TOP||self}function hB(o){return self[o]=self[o]||new RPt.BroadcastChannelMessageBus(o)}var hM=(o,t)=>{let e=/{([^}]*)}/gim,r=[...new Set(o.match(e))];for(let i=0;i<r.length;i++){let n=r[i],s=n.substring(1,n.length-1);t[s]&&(o=o.replace(n,t[s]))}return o},DPt=mB(jz()),tu={getTime:"/pro-mgr/serverTime/now",getUserL:"/pro-ui/loginUser/get",subMaxTick:"/pro-mgr/project/ticket",subBlob:"/pro-mgr/canvas/BLOB/update",subFont:"/pro-mgr/canvas/FONT/update",subRevoke:"/pro-mgr/{uuid}/revoke",pushPend:"/pro-mgr/worker/batchPendData",pushSync:"/pro-mgr/dataWorker/sync",pushRevoke:"/pro-mgr/worker/revoke",pullASync:"/pro-mgr/dataWorker/sync/{id}",personDestroy:"/mgr/libWorker/destroy",projectUpdate:"/pro-mgr/canvas/{uuid}/update",personUpdate:"/mgr/libWorker/component/{uuid}/update",personSave:"/mgr/libWorker/save",projectSave:"/mgr/projectWorker/setCanvas",canSavePend:"/mgr/projectWorker/canSavePend",hasSaveData:"/mgr/check/hasSaveData"},wPt={projectUpdate:tu.projectUpdate,personUpdate:tu.personUpdate,projectCanSave:tu.canSavePend,getProject:"/mgr/projectWorker/footprint/getCanvas",getPerson:"/mgr/libWorker/getFootprint",unwatch:"/mgr/projectWorker/footprint/unwatchCanvas"},LPt={projectUpdate:tu.projectUpdate,projectCanSave:tu.canSavePend,getProject:"/mgr/projectWorker/pcb/getCanvas",unwatch:"/mgr/projectWorker/pcb/unwatchCanvas"},GYt={projectUpdate:tu.projectUpdate,projectCanSave:tu.canSavePend,getProject:"/mgr/projectWorker/sheet/getCanvas",unwatch:"/mgr/projectWorker/sheet/unwatchCanvas"},UYt={projectUpdate:tu.projectUpdate,getProject:"/mgr/projectWorker/schematic/getCanvas",unwatch:"/mgr/projectWorker/schematic/unwatchCanvas"},HYt={projectUpdate:tu.projectUpdate,projectCanSave:tu.canSavePend,getProject:"/mgr/projectWorker/simulation/getCanvas",unwatch:"/mgr/projectWorker/simulation/unwatchCanvas"},WYt={projectUpdate:tu.projectUpdate,personUpdate:tu.personUpdate,projectCanSave:tu.canSavePend,getProject:"/mgr/projectWorker/symbol/getCanvasOnCompiler",getPerson:"/mgr/libWorker/getSymbol",unwatch:"/mgr/projectWorker/symbol/unwatchCanvas"},zYt={projectUpdate:tu.projectUpdate,personUpdate:tu.personUpdate,projectCanSave:tu.canSavePend,getProject:"/mgr/projectWorker/panel/getCanvas",getPerson:"/mgr/libWorker/getPanelLib",unwatch:"/mgr/projectWorker/panel/unwatchCanvas"},k2={send:"/pro-mgr/notify/send",sendMsg:"/document/sendMsg/cooperation",unwatch:"/document/unwatch/cooperation",watch:"/document/watch/cooperation",message:"/pro-mgr/notify/message/{path}/{uuid}/cooperation",established:"/pro-mgr/notify/message/ws/established",getWsId:"/pro-mgr/notify/getWsId",disconnect:"/pro-mgr/notify/message/ws/disconnect"},cIe=class{constructor(o=!0){this._lockerTicket=0,this.isPull=!1,this.compiler={},this.order={SYMBOL:1,FOOTPRINT:2,DEVICE:3,SCH_PAGE:4,PCB:5},this._locker=o?++this._lockerTicket:0}getOrder(o){return this.order[o]||6}publish(){if(!this.isPull){this.isPull=!0,this._temporaryUnlock=this._locker;try{let o=Object.keys(this.compiler).sort((e,r)=>this.getOrder(e)-this.getOrder(r)),t=!1;for(let e of o){for(let[,r]of this.compiler[e])if(t=r.publish(),t)break;if(t)break}}finally{this._temporaryUnlock=0,this.isPull=!1}}}canPush(){return!this._locker||this._locker===this._temporaryUnlock}addCompiler(o){this.compiler[o.headType]||(this.compiler[o.headType]=new Map),this.compiler[o.headType].set(o.uniqueId,o)}removeCompiler(o){var t,e,r;(r=(e=(t=this.compiler)==null?void 0:t[o.headType])==null?void 0:e.delete)==null||r.call(e,o.uniqueId)}pull(){if(!this._locker)throw Error("\u4E0D\u5141\u8BB8\u5728\u975E pause \u72B6\u6001\u4E0B\u62C9\u53D6\u6570\u636E");this.publish()}resume(){this._locker=0,this.publish()}pause(){this._locker=++this._lockerTicket}dispose(){for(let o in this.compiler)this.compiler[o].clear();this.compiler=null}},ex={publish:"publish",destroy:"destroy",init:"init",selected:"selected"},MPt=class{constructor(o,t,e,r=(s=>(s=Vz())==null?void 0:s._TAB_ID_)(),i,n){this.uuid=o,this.path=t,this.user=e,this.windowId=r,this.initIds={},this.sub=[];var s;this.wsBus=n||hB(`/${this.windowId}/notify`),this.dataBus=i||this.wsBus,this._client=(s=Vz())==null?void 0:s._WS_ID_}get client(){return this._client}watch(){this.dataBus.publish(k2.send,{topic:k2.watch,uuid:this.uuid,path:this.path})}initPublish(){var o;this.dataBus.publish(k2.send,{topic:k2.sendMsg,uuid:this.uuid,path:this.path,msg:{type:ex.publish,user:this.user,client:this.client,data:((o=this.getSelect)==null?void 0:o.call(this))||""}})}async init(){if(!this.isInit){if(this.sub.push(this.wsBus.subscribe(k2.established,o=>{this._client=o,this.watch(),this.initPublish()})),!this.client){let o=await this.wsBus.rpcCall(k2.getWsId);if(!o||this.client)return;this._client=o}this.watch(),this.sub.push(this.wsBus.subscribe(k2.disconnect,o=>{this.initIds[o]&&this.onDestroy(this.initIds[o],o)})),this.sub.push(this.dataBus.subscribe(hM(k2.message,{uuid:this.uuid,path:this.path}),o=>{if(o.type===1)o.connectId&&this.initIds[o.connectId]&&this.onDestroy(this.initIds[o.connectId],o.connectId);else if(o.msg){let t=o.msg;if(t.client===this.client)return;switch(t.type){case ex.destroy:this.onDestroy(t.userId,t.client),delete this.initIds[t.client];break;case ex.init:this.initIds[t.client]||(this.initIds[t.client]=t.user.uuid,this.onSelected(t.user,t.client,t.data||""));break;case ex.selected:this.onSelected(t.user,t.client,t.data||"");break;case ex.publish:this.dataBus.publish(k2.send,{topic:k2.sendMsg,uuid:this.uuid,path:this.path,msg:{type:ex.init,user:this.user,client:this.client,data:this.getSelect()||""}}),this.initIds[t.client]=t.user.uuid,this.onSelected(t.user,t.client,t.data||"");break;default:break}}})),this.initPublish(),this.isInit=!0}}publishSelected(o,t){this.dataBus.publish(k2.send,{topic:k2.sendMsg,uuid:this.uuid,path:this.path,msg:{type:ex.selected,user:this.user,client:this.client,data:o}}),t&&this.onSelected(this.user,this.client,o)}destroy(){if(this.isInit){this.isInit=!1,this.dataBus.publish(k2.send,{topic:k2.unwatch,uuid:this.uuid,path:this.path,msg:{type:ex.destroy,userId:this.user.uuid,client:this.client}});for(let o of this.sub)o.cancel();this.sub=[],this.initIds={}}}},tNe=class extends MPt{constructor(o,t,e,r,i,n,s,a){super(o,t,a,e,i,n),this.channel=r,this.selectedProps=s,this.cache=new Map,this.deleteCache=new Map}rePublish(){var o,t,e,r;if(this.channel.canPush()){for(let[i,n]of this.cache)(t=(o=this.selectedProps)==null?void 0:o.onSelect)==null||t.call(o,n.user,i,n.data);for(let[i,n]of this.deleteCache)(r=(e=this.selectedProps)==null?void 0:e.onQuit)==null||r.call(e,n,i)}}getSelect(){var o,t;return((t=(o=this.selectedProps)==null?void 0:o.getSelect)==null?void 0:t.call(o))||""}onSelected(o,t,e){var r,i;this.channel.canPush()?!this.deleteCache.has(t)&&this.cache.set(t,{user:o,data:e}):(i=(r=this.selectedProps)==null?void 0:r.onSelect)==null||i.call(r,o,t,e)}onDestroy(o,t){var e,r;this.channel.canPush()?(this.deleteCache.set(t,o),this.cache.delete(t)):(r=(e=this.selectedProps)==null?void 0:e.onQuit)==null||r.call(e,o,t)}dispose(){this.destroy(),this.cache.clear(),this.deleteCache.clear()}publishSelected(o,t){super.publishSelected(o,t)}},NPt=class{constructor(o,t,e,r=(b=>(b=Vz())==null?void 0:b._TAB_ID_)(),i=new cIe,n=null,s,a,l,c,h,u,d,p,m,g,y){this.uuid=o,this.path=t,this.isProject=e,this.windowId=r,this.channel=i,this.consistencyManager=n,this.selectedProps=l,this.setInit=c,this.onDocDetail=h,this.onUpdate=u,this.handleInit=d,this.onDelete=p,this.publishCache=m,this.onOrderNm=g,this.setMaxNum=y,this.isInit=!1,this.canSave=!0,this.sub=[],this.isInitIng=!1,this.cache={},this.deleteCache=new Map,this.pendTimer=null,this.pendCache={},this.pendCacheLength=0,this.wsBus=hB(`/${r}/notify`),n||(this._unique=DI()),this._headType=s,this.busTopic=a}get uniqueId(){return this._unique||this.consistencyManager.getUnique()}get headType(){return this._headType}setIsInitIng(o){var t;(t=this.setInit)==null||t.call(this,o),this.isInitIng=o}consoleDebug(...o){console.debug("[lc-protocol]",this._headType,this.uuid,...o)}publishLine(o,t,e,r,i,n=this.uuid,s,a,l,c,h){if(this.channel.canPush())return this.consistencyManager.remoteChange(t,i,n,o,e,r,void 0,void 0,void 0,s,void 0,a,l,h),!1;this.cache[n]||(this.cache[n]=new Map);let u=this.cache[n].get(o);return(c||!u||u.ticket<t||u.ticket===t&&(u.client<i||u.client===i&&!!u.pend!=!!s))&&this.cache[n].set(o,{client:i,ticket:t,dataType:r,data:e,pend:s,unique:a,pChange:u?void 0:l,num:h}),!0}onDocHead(){}onEnd(){}setDocType(o,t){o===this.uuid&&(this._headType=t)}setBusTopic(o){this.busTopic=o}publish(){var o,t,e;if(this.publishCache)return this.publishCache();let r=!1;for(let[i,n]of this.deleteCache){if(this.channel.canPush()){(o=this.onDelete)==null||o.call(this,n),delete this.cache[i];continue}r=!0;break}if(r)return r;for(let i in this.cache){let n=this.cache[i].keys();for(let s of n){let a=this.cache[i].get(s);if(r=this.publishLine(s,a.ticket,a.data,a.dataType,a.client,i,a.pend,a.unique,a.pChange,!1,a.num),r)break;this.cache[i].delete(s)}if(r)break}return(e=(t=this.selectManager)==null?void 0:t.rePublish)==null||e.call(t),r}publishSelected(o,t){this.selectManager.publishSelected(o,t)}clear(){var o,t;for(let e of this.sub)e.cancel();this.sub.length=0,this.cache={},this.deleteCache.clear(),this.setIsInitIng(!1),this.channel.removeCompiler(this),(t=(o=this.selectManager)==null?void 0:o.dispose)==null||t.call(o),this.selectManager=null,this.isInit=!1,this.setIsInitIng(!1)}async init(o=!0,t=!0,e=!0,r,i,n,s){try{if(this.isInit)return{success:!0};if(this.isInitIng)throw new Error("\u6B63\u5728\u521D\u59CB\u5316\u4E2D");return this.isProject?await this.initProject(o,t,e,r,n,s):await this.initLib(e,r,i,n,s)}catch(a){throw this.clear(),new Error(`${this._headType}+'Compiler' ${this.uuid} init false: ${(a==null?void 0:a.message)||a||""}`,{cause:a})}finally{this.isInitIng=!1}}async flowRead(o){let t=this.consistencyManager.flowParseFull(),e=t.update,r=this;t.update=i=>{if(r.isDestroy)return!0;e(i)},await(0,DPt.flowRead)(o,t)}pushOnLine(o,t){if(this.consistencyManager)for(let e of o)this.publishLine(e[0],e[1],e[2],e[3],e[4],t,e[5],e[6],e[7],!1,e[8])}async initProject(o,t,e,r,i,n){if(this.setIsInitIng(!0),this.channel.addCompiler(this),this.dataBus=hB(`/${this.windowId}/project/${this.path}`),i&&this.sub.push(this.dataBus.subscribe(`/pro-mgr/${this.uuid}/number/update`,l=>{if(this.onOrderNm)for(let c of l)this.onOrderNm(c[0],c[1],c[2])})),e&&this.busTopic.projectUpdate&&this.sub.push(this.dataBus.subscribe(hM(this.busTopic.projectUpdate,{uuid:this.uuid}),l=>{this.onUpdate?this.onUpdate(l):this.pushOnLine(l,this.uuid)})),e&&this.busTopic.projectCanSave&&this.sub.push(this.dataBus.subscribe(this.busTopic.projectCanSave,l=>{this.canSave=l})),e&&this.busTopic.subDelete&&this.sub.push(this.dataBus.subscribe(this.busTopic.subDelete,l=>{var c;this.channel.canPush()?(c=this.onDelete)==null||c.call(this,l):this.deleteCache.set(l[0],l)})),e&&this.consistencyManager&&this.sub.push(this.dataBus.subscribe(tu.subMaxTick,l=>{this.consistencyManager.setMaxTicket(l.ticket,l.force)})),e&&t&&this.sub.push(this.dataBus.subscribe(tu.subBlob,l=>{this.pushOnLine(l,"BLOB")})),e&&o&&this.sub.push(this.dataBus.subscribe(tu.subFont,l=>{this.pushOnLine(l,"FONT")})),e&&this.consistencyManager&&this.sub.push(this.dataBus.subscribe(hM(tu.subRevoke,{uuid:this.uuid}),l=>this.revoke(l))),!this.busTopic.getProject)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01");this.isDestroy=!1;let s={doc:[this.uuid],watch:e,needNum:i,needDelete:n};t&&s.doc.push("BLOB"),o&&s.doc.push("FONT");let a=await this.dataBus.rpcCall(this.busTopic.getProject,s);if(this.isWatch=e,!this.isDestroy){if(!a.success)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01",a);if(this.canSave=!(a!=null&&a.readOnly),this.consoleDebug("init",a.result),a.maxTicket&&this.consistencyManager&&this.consistencyManager.setMaxTicket(a.maxTicket),a.data&&this.onDocDetail&&this.onDocDetail(a.client||DI(),0,a.data,!1),a.channel&&await this.flowRead(a.channel),!this.isDestroy){if(this.handleInit?this.handleInit(a):a.result&&this.consistencyManager&&this.consistencyManager.parseFull(a.result,this.uuid,this._headType),r){let l=this.user=this.user||a.user||await this.wsBus.rpcCall(tu.getUserL);this.selectManager=new tNe(this.uuid,this.path,this.windowId,this.channel,this.dataBus,this.wsBus,this.selectedProps,l),await this.selectManager.init()}return this.isInit=!0,this.setIsInitIng(!1),{success:!0}}}}async initLib(o,t,e,r,i){if(this.setIsInitIng(!0),this.channel.addCompiler(this),this.dataBus=hB(`/${this.windowId}/libWorker`),!this.busTopic.getPerson)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01");let n=e?DI():"";this.isDestroy=!1;let s=await this.dataBus.rpcCall(this.busTopic.getPerson,{uuid:this.uuid,path:this.path,watch:o,channel:n,needNum:r,needDelete:i});if(this.isWatch=o,this.isDestroy)return;if(!s.success)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01",s);this.consoleDebug("init",s.dataStr);let a=s.data||s.result;if(a&&this.onDocDetail&&this.onDocDetail(s.client||DI(),0,a,!1),r&&this.sub.push(this.dataBus.subscribe(`/pro-mgr/${this.uuid}/number/update`,l=>{if(this.onOrderNm)for(let c of l)this.onOrderNm(c[0],c[1],c[2])})),o&&this.busTopic.personUpdate&&this.sub.push(this.dataBus.subscribe(hM(this.busTopic.personUpdate,{uuid:this.uuid}),l=>{this.pushOnLine(l,this.uuid)})),o&&this.sub.push(this.dataBus.subscribe(hM(hM(tu.subRevoke,{uuid:this.uuid}),{uuid:this.uuid}),l=>this.revoke(l))),n&&await this.flowRead(n),!this.isDestroy){if(s.dataStr&&this.consistencyManager&&this.consistencyManager.parseFull(s.dataStr),t){let l=this.user=this.user||s.user||await this.wsBus.rpcCall(tu.getUserL);this.selectManager=new tNe(this.uuid,this.path,this.windowId,this.channel,this.wsBus,this.wsBus,this.selectedProps,l),await this.selectManager.init()}return this.isInit=!0,this.setIsInitIng(!1),{success:!0}}}revoke(o){for(let t of o)this.consistencyManager&&this.consistencyManager.revoke(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],(...e)=>this.publishLine(...e)),t[10]&&this.setMaxNum&&this.setMaxNum(t[6],t[10],t[1])}cachePendData(o,t,e,r,i,n){this.pendCache[o]||(this.pendCache[o]={type:n,pend:[]}),this.pendCache[o].pend.push([t,e,i,r]),this.pendCacheLength+=r.length+1,this.pendCacheLength>1e7&&this.publishPendData(),this.pendTimer||(this.pendTimer=setTimeout(()=>{this.publishPendData(),this.pendTimer=null},0))}publishPendData(){if(this.pendCacheLength){this.dataBus.publish(tu.pushPend,[this.pendCache,this.consistencyManager.getClient(),this.uniqueId,this.uuid]);for(let o in this.pendCache)this.pendCache[o].pend.length=0;this.pendCache={},this.pendCacheLength=0}}localChange(o,t,e,r=this.uuid,i,n){if(!this.isInit||!this.canSave||!this.consistencyManager)return 0;if(t&&!t.startsWith("{"))return console.error("\u4E0A\u4F20\u7684\u683C\u5F0F\u4E0D\u6B63\u786E",o,e,t),0;let s=this.consistencyManager.localChange(r,o,t,e,i,n);return this.cachePendData(r,o,s,t,e,i||this.headType),s}async sync(){if(!this.isInit)throw new Error("\u6570\u636E\u672A\u521D\u59CB\u5316\uFF0C\u65E0\u6CD5\u540C\u6B65");let o=DI();this.dataBus.publish(tu.pushSync,o),await this.dataBus.pullA(hM(tu.pullASync,{id:o}))}async destroy(){return this.isDestroy?{success:!1}:(this.consistencyManager&&this.dataBus&&this.dataBus.publish(tu.pushRevoke,[this.uuid,this.uniqueId,this.consistencyManager.getClient()]),this.clear(),this.isDestroy=!0,this.isWatch&&this.dataBus&&!this.isProject&&this.dataBus.publish(tu.personDestroy,{uuid:this.uuid,path:this.path}),this.isWatch&&this.dataBus&&this.busTopic.unwatch&&this.dataBus.publish(this.busTopic.unwatch,this.uuid),this.isWatch=!1,{success:!0})}async save(o=[this.uuid,"BLOB","FONT"]){try{if(!this.isInit)throw new Error("\u6570\u636E\u672A\u521D\u59CB\u5316\uFF0C\u65E0\u6CD5\u4FDD\u5B58");if(!this.consistencyManager)throw new Error("\u65E0\u6CD5\u652F\u6301\u4FDD\u5B58");let t=this.isProject?tu.projectSave:tu.personSave;if(!t)throw new Error("\u65E0\u6CD5\u652F\u6301\u4FDD\u5B58");let e=await this.dataBus.rpcCall(t,{uuid:this.uuid,path:this.path,docIds:o,uniqueId:this.uniqueId,client:this.consistencyManager.getClient()});return this.consoleDebug("save",e),e}catch(t){throw new Error(`${this._headType}+'Compiler' ${this.uuid} \u4FDD\u5B58\u5931\u8D25: ${(t==null?void 0:t.message)||t||""}`,{cause:t})}}async getBlob(o){return this.dataBus.rpcCall("/mgr/projectWorker/blob/getBlob",o)}async getFont(o,t,e,r,i,n,s,a){let l={text:o,fontFamily:t,fontSize:e,thickness:r,bold:i,italic:n,reverse:s,expansion:a},c=await this.dataBus.rpcCall("/mgr/projectWorker/font/get",l);return c.success?{success:!0,result:Object.assign(l,JSON.parse(c.result))}:c}async checkSave(){return await this.dataBus.rpcCall(tu.hasSaveData,{uuid:this.uuid,uniqueId:this.uniqueId})}},kPt=(o=>(o.DIFFERENTIAL_PAIR="DIFFERENTIAL_PAIR",o.NET_CLASS="NET_CLASS",o.EQL_NET_GRP="EQL_NET_GRP",o))(kPt||{}),BPt=class extends c7e{constructor(o){super(o)}onComponent(){}onComponentNum(){}onDelComponent(){}onPadNet(){}onDelPadNet(){}};var YYt=mB(jz()),jYt=mB(jz());var FPt=class extends c7e{constructor(o,t,e,r,i,n,s,a=(l=>(l=Vz())==null?void 0:l._TAB_ID_)()){let l=new vNe(a);super(l),this.isProject=e,this.encode=n,this.base=new NPt(o,t,e,a,r,l,i,i==="PCB"?LPt:wPt,s,(...c)=>this.setIsInit(...c),(...c)=>this.onDocDetail(...c),void 0,void 0,void 0,void 0,(c,h,u)=>this.onOrderNum(c,h,u),(c,h,u)=>{this.setMaxNum(c,h,!!u),u&&this.deleteOrderNum(u)})}get dataBus(){return this.base.dataBus}set dataBus(o){this.base.dataBus=o}async init(o=!0,t=!0,e=!0,r,i=!0,n){return this.setNeedNum(i),this.base.init(o,t,e,r,!0,i,n)}async sync(){return this.base.sync()}async destroy(){return this.base.destroy()}async save(){return this.base.save()}checkSave(){return this.base.checkSave()}publishSelected(o,t){this.base.publishSelected(o,t)}uploadBlob(o,t){let e=ste(t),r={filename:o,content:t};return{success:!0,ticket:this.localChange({id:e,data:JSON.stringify(r),dataType:"BLOB"},"BLOB","BLOB"),hash:e}}deleteBlob(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"BLOB"},"BLOB","BLOB")}}uploadFont(o){let{text:t,fontFamily:e,fontSize:r,thickness:i,bold:n,italic:s,reverse:a,expansion:l,width:c,height:h,path:u}=o,d={width:c,height:h,path:u},p=ITe(t,e,r,i,n,s,a,l);return{success:!0,ticket:this.localChange({id:p,data:JSON.stringify(d),dataType:"FONT"},"FONT","FONT")}}deleteFont(o){let{text:t,fontFamily:e,fontSize:r,thickness:i,bold:n,italic:s,reverse:a,expansion:l}=o,c=ITe(t,e,r,i,n,s,a,l);return{success:!0,ticket:this.localChange({id:c,data:"",dataType:"FONT"},"FONT","FONT")}}async updateFootprint(o){return this.isProject?this.dataBus.rpcCall("/mgr/projectWorker/footprint/update",o):{success:!1,message:"compiler \u6682\u4E0D\u652F\u6301\u4E2A\u4EBA\u5E93\u76F4\u63A5\u4FEE\u6539\u5C01\u88C5\u4FE1\u606F"}}async generateTemplate(o,t){return this.isProject?this.dataBus.rpcCall("/mgr/projectWorker/footprint/generateTemplate",{custom:o,renameKey:t}):{success:!1,message:"compiler \u6682\u4E0D\u652F\u6301\u4E2A\u4EBA\u5E93\u8C03\u7528\u8BE5\u63A5\u53E3"}}localChange(o,t=this.base.uuid,e){var r,i;let n=this.getOrderNum(o.id);return(i=(r=this.needOrderType)==null?void 0:r.includes)!=null&&i.call(r,o.dataType)&&n===void 0&&(n=this.getMaxNum(o.dataType),this.setOrderNum(o.id,n,o.dataType),this.onOrderNum(o.id,o.dataType,n)),this.base.localChange(o.id,o.data,o.dataType,t,e,n)}uploadString(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeString(o,t))}}deleteString(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"STRING"})}}uploadAttr(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeAttr(o,t))}}deleteAttr(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"ATTR"})}}uploadPanelize(o){return{success:!0,ticket:this.localChange(this.encode.encodePanelize(o))}}deletePanelize(){return{success:!0,ticket:this.localChange({id:"PANELIZE",data:"",dataType:"PANELIZE"})}}uploadRuleSelector(o){return{success:!0,ticket:this.localChange(this.encode.encodeRuleSelector(o))}}deleteRuleSelector(o){return{success:!0,ticket:this.localChange({id:JSON.stringify(["RULE_SELECTOR",o]),data:"",dataType:"RULE_SELECTOR"})}}uploadRule(o){return{success:!0,ticket:this.localChange(this.encode.encodeRule(o))}}deleteRule(o,t){return{success:!0,ticket:this.localChange({id:JSON.stringify(["RULE",o,t]),data:"",dataType:"RULE"})}}uploadRuleTemplate(o){return{success:!0,ticket:this.localChange(this.encode.encodeRuleTemplate(o))}}uploadDimension(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeDimension(o,t))}}deleteDimension(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"DIMENSION"})}}uploadBoss(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeBoss(o,t))}}deleteBoss(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"BOSS"})}}uploadShellEntity(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeShellEntity(o,t))}}deleteShellEntity(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"SHELL_ENTITY"})}}uploadShellCut(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeShellCut(o,t))}}deleteShellCut(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"SHELLCUT"})}}uploadCrease(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeCrease(o,t))}}deleteCrease(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"CREASE"})}}uploadShell(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeShell(o,t))}}deleteShell(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"SHELL"})}}uploadFpcFill(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeFpcFill(o,t))}}deleteFpcFill(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"FPC_FILL"})}}uploadTeardrop(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeTeardrop(o,t))}}deleteTeardrop(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"TEARDROP"})}}uploadImage(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeImage(o,t))}}deleteImage(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"IMAGE"})}}uploadPoured(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePoured(o,t))}}deletePoured(o){return{success:!0,ticket:this.localChange({id:B2(o,"POURED"),data:"",dataType:"POURED"})}}uploadPour(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePour(o,t))}}deletePour(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"POUR"})}}uploadRegion(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeRegion(o,t))}}deleteRegion(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"REGION"})}}uploadFill(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeFill(o,t))}}deleteFill(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"FILL"})}}uploadLayerFill(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLayerFill(o,t))}}deleteLayerFill(o){return{success:!0,ticket:this.localChange({id:B2(o,"LAYER_FILL"),data:"",dataType:"LAYER_FILL"})}}uploadPoly(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePoly(o,t))}}deletePoly(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"POLY"})}}uploadEQLenGrp(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeEQLenGrp(o,t))}}deleteEQLenGrp(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"EQLEN_GRP"})}}uploadObj(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeObj(o,t))}}deleteObj(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"OBJ"})}}uploadArc(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeArc(o,t))}}deleteArc(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"ARC"})}}uploadLine(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLine(o,t))}}deleteLine(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"LINE"})}}uploadPad(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePad(o,t))}}deletePad(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"PAD"})}}uploadVia(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeVia(o,t))}}deleteVia(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"VIA"})}}uploadPreference(o){return{success:!0,ticket:this.localChange(this.encode.encodePreference(o))}}uploadSilkOpts(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeSilkOpts(o,t))}}deleteSilkOpts(o){return{success:!0,ticket:this.localChange({id:B2(o,"SILK_OPTS"),data:"",dataType:"SILK_OPTS"})}}uploadGroup(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeGroup(o,t))}}deleteGroup(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"GROUP"})}}uploadPrimitive(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePrimitive(o,t))}}deletePrimitive(o){return{success:!0,ticket:this.localChange({id:B2(o,"PRIMITIVE"),data:"",dataType:"PRIMITIVE"})}}uploadNet(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeNet(o,t))}}deleteNet(o){return{success:!0,ticket:this.localChange({id:B2(o,"NET"),data:"",dataType:"NET"})}}uploadActiveLayer(o){return{success:!0,ticket:this.localChange(this.encode.encodeActiveLayer(o))}}uploadLayerPhys(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLayerPhys(o,t))}}deleteLayerPhys(o){return{success:!0,ticket:this.localChange({id:B2(o,"LAYER_PHYS"),data:"",dataType:"LAYER_PHYS"})}}uploadLayer(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLayer(o,t))}}deleteLayer(o){return{success:!0,ticket:this.localChange({id:B2(o,"LAYER"),data:"",dataType:"LAYER"})}}uploadCanvas(o){return{success:!0,ticket:this.localChange(this.encode.encodeCanvas(o))}}uploadBoard(o){return{success:!0,ticket:this.localChange({id:"BOARD",data:JSON.stringify(o),dataType:"BOARD"})}}deleteBoard(){return{success:!0,ticket:this.localChange({id:"BOARD",data:"",dataType:"BOARD"})}}uploadXSignalsGroup(o,t){return{success:!0,ticket:this.localChange({id:o,data:JSON.stringify(t),dataType:"X_SIGNAL_GROUP"})}}deleteXSignalsGroup(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"X_SIGNAL_GROUP"})}}uploadXSignals(o,t){return{success:!0,ticket:this.localChange({id:o,data:JSON.stringify(t),dataType:"X_SIGNALS"})}}deleteXSignals(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"X_SIGNALS"})}}},h7e=class extends FPt{constructor(o,t,e,r,i=(n=>(n=Vz())==null?void 0:n._TAB_ID_)()){super(o,t,e,r,"FOOTPRINT",new l7e,{getSelect:()=>{var n;return(n=this.canvasSelected)==null?void 0:n.call(this)},onSelect:(...n)=>{var s;return(s=this.onSelectChange)==null?void 0:s.call(this,n[0],n[1],n[2])},onQuit:(...n)=>{var s;return(s=this.onSelectQuit)==null?void 0:s.call(this,n[0],n[1])}},i),this.uuid=o,this.path=t,this.isProject=e,this.windowId=i}onComponent(){}onComponentNum(){}onDelComponent(){}onPadNet(){}onDelPadNet(){}},VPt=class extends BPt{constructor(){super(...arguments),this.data={}}onXSignalsGroup(o,t,e,r,i){}onDelXSignalsGroup(o,t,e,r){}onXSignals(o,t,e,r,i){}onDelXSignals(o,t,e,r){}onBoard(o,t,e,r){}onDelBoard(o,t,e){}onLayerFill(o,t,e,r,i){}onDelLayerFill(o,t,e,r){}onBlob(o,t,e,r,i){}onDelBlob(o,t,e,r){}onFont(o,t,e,r){}onDelFont(o,t,e,r){}onString(o,t,e,r,i,n){this.data[o]=i}onDelString(o,t,e,r){delete this.data[o]}onStringNum(o,t){}onAttr(o,t,e,r,i,n){this.data[o]=i}onDelAttr(o,t,e,r){delete this.data[o]}onAttrNum(o,t){}onPanelizeSide(o,t,e,r){}onDelPanelizeSide(o,t,e,r){}onPanelizeStamp(o,t,e,r){}onDelPanelizeStamp(o,t,e,r){}onPanelize(o,t,e,r){}onDelPanelize(o,t,e){}onRuleSelector(o,t,e,r){}onDelRuleSelector(o,t,e,r){}onRule(o,t,e,r){}onDelRule(o,t,e,r,i){}onRuleTemplate(o,t,e,r){}onDimension(o,t,e,r,i,n){this.data[o]=i}onDelDimension(o,t,e,r){delete this.data[o]}onDimensionNum(o,t){}onBoss(o,t,e,r,i,n){this.data[o]=i}onDelBoss(o,t,e,r){delete this.data[o]}onBossNum(o,t){}onShellEntity(o,t,e,r,i,n){this.data[o]=i}onDelShellEntity(o,t,e,r){}onShellEntityNum(o,t){}onShellCut(o,t,e,r,i,n){this.data[o]=i}onDelShellCut(o,t,e,r){delete this.data[o]}onShellCutNum(o,t){}onCrease(o,t,e,r,i,n){this.data[o]=i}onDelCrease(o,t,e,r){delete this.data[o]}onCreaseNum(o,t){}onShell(o,t,e,r,i,n){this.data[o]=i}onDelShell(o,t,e,r){delete this.data[o]}onShellNum(o,t){}onFpcFill(o,t,e,r,i,n){this.data[o]=i}onDelFpcFill(o,t,e,r){delete this.data[o]}onFpcFillNum(o,t){}onTeardrop(o,t,e,r,i,n){this.data[o]=i}onDelTeardrop(o,t,e,r){delete this.data[o]}onTeardropNum(o,t){}onImage(o,t,e,r,i,n){this.data[o]=i}onDelImage(o,t,e,r){delete this.data[o]}onImageNum(o,t){}onPoured(o,t,e,r,i,n){this.data[o]=i}onDelPoured(o,t,e,r){delete this.data[o]}onPouredNum(o,t){}onPour(o,t,e,r,i,n){this.data[o]=i}onDelPour(o,t,e,r){delete this.data[o]}onPourNum(o,t){}onRegion(o,t,e,r,i,n){this.data[o]=i}onDelRegion(o,t,e,r){delete this.data[o]}onRegionNum(o,t){}onFill(o,t,e,r,i,n){this.data[o]=i}onDelFill(o,t,e,r){delete this.data[o]}onFillNum(o,t){}onPoly(o,t,e,r,i,n){this.data[o]=i}onDelPoly(o,t,e,r){delete this.data[o]}onPolyNum(o,t){}onEQLenGrp(o,t,e,r,i){this.data[o]=r}onDelEQLenGrp(o,t,e,r){delete this.data[o]}onDelProp(o,t,e,r){delete this.data[o]}onObj(o,t,e,r,i,n){this.data[o]=i}onDelObj(o,t,e,r){delete this.data[o]}onObjNum(o,t){}onArc(o,t,e,r,i,n){this.data[o]=i}onDelArc(o,t,e,r){delete this.data[o]}onArcNum(o,t){}onCArc(o,t,e,r,i,n){this.data[o]=i}onDelCArc(o,t,e,r){delete this.data[o]}onCArcNum(o,t){}onLine(o,t,e,r,i,n){this.data[o]=i}onDelLine(o,t,e,r){delete this.data[o]}onLineNum(o,t){}onPad(o,t,e,r,i,n){this.data[o]=i}onDelPad(o,t,e,r){delete this.data[o]}onPadNum(o,t){}onVia(o,t,e,r,i,n){this.data[o]=i}onDelVia(o,t,e,r){delete this.data[o]}onViaNum(o,t){}onDelConnect(o,t,e,r){}onPreference(o,t,e,r){}onSilkOpts(o,t,e,r,i){this.data[o]=r}onDelSilkOpts(o,t,e,r){delete this.data[o]}onGroup(o,t,e,r,i){this.data[o]=r}onDelGroup(o,t,e,r){delete this.data[o]}onPrimitive(o,t,e,r,i){}onDelPrimitive(o,t,e,r){}onNet(o,t,e,r,i){}onDelNet(o,t,e,r){}onPartition(o,t,e,r,i,n){this.data[o]=i}onDelPartition(o,t,e,r){delete this.data[o]}onPartitionNum(o,t){}onEditorMeta(o,t,e,r){}onDocDetail(o,t,e,r){}onActiveLayer(o,t,e,r){}onLayerPhys(o,t,e,r,i){this.data[o]=r}onDelLayerPhys(o,t,e,r){delete this.data[o]}onLayer(o,t,e,r,i){this.data[o]=r}onDelLayer(o,t,e,r){}onCanvas(o,t,e,r){}},GPt=class extends h7e{onXSignalsGroup(o,t,e,r,i){}onDelXSignalsGroup(o,t,e,r){}onXSignals(o,t,e,r,i){}onDelXSignals(o,t,e,r){}onBoard(o,t,e,r){}onDelBoard(o,t,e){}onLayerFill(o,t,e,r,i){}onDelLayerFill(o,t,e,r){}constructor(o,t,e,r){super(o,t,e,new cIe,r)}canvasSelected(){return""}onSelectChange(o,t,e){}onSelectQuit(o,t){}async getByDataType(o){let t="";if(this.isProject?(this.dataBus=this.dataBus||hB(`/${this.windowId}/project/${this.path}`),t=await this.dataBus.rpcCall("/mgr/projectWorker/getDataByType",{doc:this.uuid,dataType:o})):(this.dataBus=this.dataBus||hB(`/${this.windowId}/libWorker`),t=await this.dataBus.rpcCall("/mgr/libWorker/getDataByType",{uuid:this.uuid,path:this.path,dataType:o,docType:"FOOTPRINT"})),!t)return{};let e=new VPt;return e.consistencyManager.parseFull(t,this.uuid,"FOOTPRINT"),e.data}async getPads(){return this.getByDataType("PAD")}onBlob(o,t,e,r,i){}onDelBlob(o,t,e,r){}onFont(o,t,e,r){}onDelFont(o,t,e,r){}onString(o,t,e,r,i,n){}onDelString(o,t,e,r){}onStringNum(o,t){}onAttr(o,t,e,r,i,n){}onDelAttr(o,t,e,r){}onAttrNum(o,t){}onPanelizeSide(o,t,e,r){}onDelPanelizeSide(o,t,e,r){}onPanelizeStamp(o,t,e,r){}onDelPanelizeStamp(o,t,e,r){}onPanelize(o,t,e,r){}onDelPanelize(o,t,e){}onRuleSelector(o,t,e,r){}onDelRuleSelector(o,t,e,r){}onRule(o,t,e,r){}onDelRule(o,t,e,r,i){}onRuleTemplate(o,t,e,r){}onDimension(o,t,e,r,i,n){}onDelDimension(o,t,e,r){}onDimensionNum(o,t){}onBoss(o,t,e,r,i,n){}onDelBoss(o,t,e,r){}onBossNum(o,t){}onShellEntity(o,t,e,r,i,n){}onDelShellEntity(o,t,e,r){}onShellEntityNum(o,t){}onShellCut(o,t,e,r,i,n){}onDelShellCut(o,t,e,r){}onShellCutNum(o,t){}onCrease(o,t,e,r,i,n){}onDelCrease(o,t,e,r){}onCreaseNum(o,t){}onShell(o,t,e,r,i,n){}onDelShell(o,t,e,r){}onShellNum(o,t){}onFpcFill(o,t,e,r,i,n){}onDelFpcFill(o,t,e,r){}onFpcFillNum(o,t){}onTeardrop(o,t,e,r,i,n){}onDelTeardrop(o,t,e,r){}onTeardropNum(o,t){}onImage(o,t,e,r,i,n){}onDelImage(o,t,e,r){}onImageNum(o,t){}onPoured(o,t,e,r,i,n){}onDelPoured(o,t,e,r){}onPouredNum(o,t){}onPour(o,t,e,r,i,n){}onDelPour(o,t,e,r){}onPourNum(o,t){}onRegion(o,t,e,r,i,n){}onDelRegion(o,t,e,r){}onRegionNum(o,t){}onFill(o,t,e,r,i,n){}onDelFill(o,t,e,r){}onFillNum(o,t){}onPoly(o,t,e,r,i,n){}onDelPoly(o,t,e,r){}onPolyNum(o,t){}onEQLenGrp(o,t,e,r,i){}onDelEQLenGrp(o,t,e,r){}onDelProp(o,t,e,r){}onObj(o,t,e,r,i,n){}onDelObj(o,t,e,r){}onObjNum(o,t){}onArc(o,t,e,r,i,n){}onDelArc(o,t,e,r){}onArcNum(o,t){}onCArc(o,t,e,r,i,n){}onDelCArc(o,t,e,r){}onCArcNum(o,t){}onLine(o,t,e,r,i,n){}onDelLine(o,t,e,r){}onLineNum(o,t){}onPad(o,t,e,r,i,n){}onDelPad(o,t,e,r){}onPadNum(o,t){}onVia(o,t,e,r,i,n){}onDelVia(o,t,e,r){}onViaNum(o,t){}onDelConnect(o,t,e,r){}onPreference(o,t,e,r){}onSilkOpts(o,t,e,r,i){}onDelSilkOpts(o,t,e,r){}onGroup(o,t,e,r,i){}onDelGroup(o,t,e,r){}onPrimitive(o,t,e,r,i){}onDelPrimitive(o,t,e,r){}onNet(o,t,e,r,i){}onDelNet(o,t,e,r){}onPartition(o,t,e,r,i,n){}onDelPartition(o,t,e,r){}onPartitionNum(o,t){}onEditorMeta(o,t,e,r){}onDocDetail(o,t,e,r){}onActiveLayer(o,t,e,r){}onLayerPhys(o,t,e,r,i){}onDelLayerPhys(o,t,e,r){}onLayer(o,t,e,r,i){}onDelLayer(o,t,e,r){}onCanvas(o,t,e,r){}},u7e=(o=>(o.LIST="/pro-mgr/api/project/list",o.CREATE="/pro-mgr/api/project/create",o.GET="/pro-mgr/api/project/get",o.UPDATE="/pro-mgr/api/project/update",o.DELETE="/pro-mgr/api/project/delete",o.TICKET="/pro-mgr/api/project/ticket",o.TICKET1="/pro-mgr/api/project/ticket1",o.BACKUP_LIST="/pro-mgr/api/project/backupList",o.BACKUP="/pro-mgr/api/project/backup",o.GET_BACKUP="/pro-mgr/api/project/getBackup",o.DELETE_BACKUP="/pro-mgr/api/project/deleteBackup",o.ARCHIVE="/pro-mgr/api/project/archive",o.CREATE_BOARD="/pro-mgr/api/project/createBoards",o.STAR="/pro-mgr/api/project/star",o.UNSTAR="/pro-mgr/api/project/unstar",o.GET_PROFILE="/pro-mgr/api/project/getProfile",o))(u7e||{}),d7e=(o=>(o.LIST="/pro-mgr/api/branch/list",o.GET="/pro-mgr/api/branch/get",o.CREATE="/pro-mgr/api/branch/create",o.UPDATE="/pro-mgr/api/branch/update",o.DELETE="/pro-mgr/api/branch/delete",o))(d7e||{}),p7e=(o=>(o.LIST="/pro-mgr/api/schematic/list",o.CREATE="/pro-mgr/api/schematic/create",o.UPLOAD="/pro-mgr/api/schematic/upload",o.DELETE="/pro-mgr/api/schematic/delete",o.UPDATE="/pro-mgr/api/schematic/update",o))(p7e||{}),f7e=(o=>(o.LIST="/pro-mgr/api/document/list",o.SEARCH_LIST="/pro-mgr/api/document/searchList",o.CREATE="/pro-mgr/api/document/create",o.UPLOAD="/pro-mgr/api/document/upload",o.UPDATE="/pro-mgr/api/document/update",o.BATCH_UPDATE="/pro-mgr/api/document/batchUpdate",o.DELETE="/pro-mgr/api/document/delete",o.GET="/pro-mgr/api/document/get",o.GET_BY_SID="/pro-mgr/api/document/getBySid",o.MOVE="/pro-mgr/api/document/move",o.CHECK_IN="/pro-mgr/api/document/checkIn",o.CHECK_OUT="/pro-mgr/api/document/checkOut",o.GET_CHECK="/pro-mgr/api/document/getCheck",o.DELETE_PCB_RELATED="/pro-mgr/api/document/deletePcbRelated",o))(f7e||{}),m7e=(o=>(o.LIST="/pro-mgr/api/device/list",o.SEARCH_LIST="/pro-mgr/api/device/searchList",o.CREATE="/pro-mgr/api/device/create",o.UPLOAD="/pro-mgr/api/device/upload",o.UPDATE="/pro-mgr/api/device/update",o.BATCH_UPDATE="/pro-mgr/api/device/batchUpdate",o.GET="/pro-mgr/api/device/get",o.SEARCH_BY_USERS_AND_TITLES="/pro-mgr/api/device/searchByUsersAndTitles",o.GET_ATTR_VALUES="/pro-mgr/api/device/getAttributeValues",o.GET_ATTR_KEYS="/pro-mgr/api/device/getAttrKeys",o.DELETE="/pro-mgr/api/device/delete",o.STAR="/pro-mgr/api/device/star",o.UNSTAR="/pro-mgr/api/device/unstar",o.PLACE="/pro-mgr/api/device/place",o))(m7e||{}),g7e=(o=>(o.LIST="/pro-mgr/api/component/list",o.SEARCH_LIST="/pro-mgr/api/component/searchList",o.CREATE="/pro-mgr/api/component/create",o.UPLOAD="/pro-mgr/api/component/upload",o.UPDATE="/pro-mgr/api/component/update",o.BATCH_UPDATE="/pro-mgr/api/component/batchUpdate",o.DELETE="/pro-mgr/api/component/delete",o.GET="/pro-mgr/api/component/get",o.SEARCH_BY_USERS_AND_TITLES="/pro-mgr/api/component/searchByUsersAndTitles",o.STAR="/pro-mgr/api/component/star",o.UNSTAR="/pro-mgr/api/component/unstar",o.GET_HISTORY="/pro-mgr/api/component/getHistory",o.SET_HISTORY="/pro-mgr/api/component/setHistory",o.GET_HISTORY_DATA="/pro-mgr/api/component/getHistoryData",o))(g7e||{}),y7e=(o=>(o.LIST="/pro-mgr/api/tag/list",o.CREATE="/pro-mgr/api/tag/create",o.UPDATE="/pro-mgr/api/tag/update",o.DELETE="/pro-mgr/api/tag/delete",o))(y7e||{}),b7e=(o=>(o.SEARCH_LIST="/pro-mgr/api/copper/searchList",o.SET="/pro-mgr/api/copper/set",o.DELETE="/pro-mgr/api/copper/delete",o))(b7e||{}),P7e=(o=>(o.SEARCH_LIST="/pro-mgr/api/font/searchList",o.SET="/pro-mgr/api/font/set",o.DELETE="/pro-mgr/api/font/delete",o))(P7e||{}),T7e=(o=>(o.SEARCH_LIST="/pro-mgr/api/blob/searchList",o.SET="/pro-mgr/api/blob/set",o))(T7e||{}),I7e=(o=>(o.LIST="/pro-mgr/api/attr/list",o.SEARCH_LIST="/pro-mgr/api/attr/searchList",o.CREATE="/pro-mgr/api/attr/create",o.UPLOAD="/pro-mgr/api/attr/upload",o.DELETE="/pro-mgr/api/attr/delete",o.TICKET="/pro-mgr/api/attr/ticket",o))(I7e||{}),C7e=(o=>(o.GET_BACKUP="/pro-mgr/api/client/getBackup",o.GET_LIBS="/pro-mgr/api/client/getLibs",o.CREATE_LIB="/pro-mgr/api/client/createLib",o.CREATE_PROJECT="/pro-mgr/api/client/createProject",o.OPEN_PROJECT="/pro-mgr/api/client/openProject",o.DELETE_PROJECT="/pro-mgr/api/client/deleteProject",o.COPY_PROJECT="/pro-mgr/api/client/copyProject",o.CLOSE_PROJECT="/pro-mgr/api/client/closeProject",o.GET_PROJECT_PATHS="/pro-mgr/api/client/getProjectPaths",o.SELECT_PATH="/pro-mgr/api/client/selectPath",o.OPEN_DIALOG="/pro-mgr/api/client/openDialog",o.SELECT_DIR="/pro-mgr/api/client/selectDir",o.SELECT_FILE="/pro-mgr/api/client/selectFile",o.EXPORT_FILE="/pro-mgr/api/client/exportFile",o.CACHE_LIST="/pro-mgr/api/client/cacheList",o.GET_CACHE="/pro-mgr/api/client/getCache",o.SET_CACHE="/pro-mgr/api/client/setCache",o.DELETE_CACHE="/pro-mgr/api/client/deleteCache",o.PROJECT_HISTORY="/pro-mgr/api/client/projectHistory",o.DELETE_HISTORY="/pro-mgr/api/client/deletHistory",o.IS_EXIST_KV_CACHE="/pro-mgr/api/client/isExistKVCache",o.OPEN_URL="/pro-mgr/api/client/openURL",o))(C7e||{}),S7e=(o=>(o.LOG="/pro-mgr/api/other/log",o.COMPONENT_LOG="/pro-mgr/api/other/componentLog",o.TEAMS="/pro-mgr/api/other/teams",o.GET_EDITOR_VERSION="/pro-mgr/api/other/getEditorVersion",o.SET_EDITOR_VERSION="/pro-mgr/api/other/setEditorVersion",o))(S7e||{}),gA={PROJECT:u7e,BRANCH:d7e,SCHEMATIC:p7e,DOCUMENT:f7e,DEVICE:m7e,COMPONENT:g7e,TAG:y7e,COPPER:b7e,FONT:P7e,BLOB:T7e,ATTR:I7e,CLIENT:C7e,OTHER:S7e},Iee=Wz(zz()),xz={bus:void 0,get messageBus(){if(xz.bus===void 0)if(typeof window<"u"){let o=$();o._MSG_BUS_=o._MSG_BUS_||new Iee.MessageBus,xz.bus=o._MSG_BUS_}else self._WORKER_BUS_=self._WORKER_BUS_||new Iee.WorkerMessageBridge(new Iee.MessageBus,self),xz.bus=self._WORKER_BUS_;return xz.bus},get messageBus2(){return self._MSG_BUS2_=self._MSG_BUS2_||new Iee.MessageBus2},loginedUserUuid:void 0},mn=xz,UPt=(o=>(o[o.COMPONENT=2]="COMPONENT",o[o.NET_FLAG=18]="NET_FLAG",o[o.NET_PORT=19]="NET_PORT",o[o.DRAWING=20]="DRAWING",o[o.NON_ELECTRICAL=21]="NON_ELECTRICAL",o[o.SHORT_CIRCUIT_FLAG=22]="SHORT_CIRCUIT_FLAG",o[o.BLOCK_SYMBOL=17]="BLOCK_SYMBOL",o))(UPt||{}),HPt=(o=>(o.SYMBOL="S",o.FOOTPRINT="F",o.PRODUCT="P",o.MODEL_3D="3D",o))(HPt||{}),WPt=(o=>(o.BOTTOM_COMPONENT_LIB="BOTTOM_COMPONENT_LIB",o.DIALOG="DIALOG",o))(WPt||{}),zPt=["S","F","P","3D"],YPt=["F","3D"],jPt=(o=>(o.ZIP=".zip",o.PRJ=".epro",o.PRJ2=".epro2",o.EPRU=".epru",o.SCH=".esch",o.PCB=".epcb",o.PANEL=".epan",o.PANEL_LIB=".epanl",o.SYMBOL=".esym",o.FOOTPRINT=".efoo",o.INSTANCE=".eins",o.COPPER=".ecop",o.BLOB=".eblob",o.FONT=".efon",o.ELIBZ=".elibz",o.ELIBZ2=".elibz2",o.ELIBU=".elibu",o.IMAGE=".webp",o))(jPt||{}),ax="|",XPt=/^[^|]+(\|[^|]+)?$/,qPt=(o=>(o.Board="Board",o.Schematic="Schematic",o.Sheet="Sheet",o.Simulation="Simulation",o.Pcb="Pcb",o.Panel="Panel",o.SchCanvas="SchCanvas",o.PcbCanvas="PcbCanvas",o.PanelCanvas="PanelCanvas",o.SimulationCanvas="SimulationCanvas",o))(qPt||{}),$Pt=(o=>(o.Device="Device",o.Symbol="Symbol",o.Footprint="Footprint",o))($Pt||{}),rNe=[{value:"",text:"All"},{value:2,text:"Component"},{value:20,text:{content:"symbolType",value:"Drawing",options:null}},{value:18,text:"Net Flag"},{value:19,text:"Net Port"},{value:25,text:"Off Page Connector"},{value:31,text:"Differential Pairs Flag"},{value:21,text:{content:"symbolType",value:"Non-Electronic Flag",options:null}},{value:22,text:"Short Flag"}],iNe=[{value:"",text:"All"},{value:2,text:"Component Symbol"},{value:20,text:"Drawing Symbol"},{value:18,text:"Netflag Symbol"},{value:19,text:"Netport Symbol"},{value:25,text:"Off Page Connector Symbol"},{value:31,text:"Differential Pairs Flag Symbol"},{value:21,text:"Non-Electronic Symbol"},{value:22,text:"Short Flag"}],KPt=["S"],ZPt=["S"],JPt=["S"],QPt=["3D"],eTt={footprint:YPt,device:zPt,symbol:KPt,model3D:QPt,panelLib:ZPt,cbb:JPt,modelSimLib:[]},tTt=(o=>(o.eprj=".eprj",o.eprj_backup=".eprj_backup",o.eprj2=".eprj2",o))(tTt||{});async function rTt(o){let t=new TextEncoder().encode(o),e=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join("")}var E7e=[2,20,18,19,21,22,17,25,31];function $ee(o){return o&&E7e.indexOf(o)>=0}function O7e(o){return E7e.indexOf(o)>=0&&o!==17}function iTt(o){return o===""?!1:!!(o&&XPt.test(o))}var nTt=async o=>{let{keys:t,values:e}=A7e(o);return await rTt([...t,...e].sort().join(""))},A7e=o=>{let t=new Set,e=new Set;for(let r in o){let i=o[r];if(t.add(r),Array.isArray(i))e.add(JSON.stringify(i.sort()));else if(Object.prototype.toString.call(i)==="[object Object]"){let{keys:n,values:s}=A7e(i);t=new Set([...t,...n]),e=new Set([...e,...s])}else e.add(JSON.stringify(i))}return{keys:t,values:e}};function nNe(o){let{uuid:t,path:e}=o;return t?t+(e?`${ax}${e}`:""):void 0}function oTt(o){let{source:t,path:e}=o;return t+(e?`${ax}${e}`:"")}async function dTe(o,t){if(t)return t;let{updateTime:e}=o;return e?String(e):await nTt(o)}async function sTt(o){let{data:t,force:e=!0,defalut:r}=o,{source:i,version:n}=t;i?(iTt(i)||(t.source=nNe(t)),i.includes(ax)||(t.source=oTt(t)),n?n==="1"&&(t.version=await dTe(t)):t.version=await dTe(t,r)):e&&(t.source=nNe(t),t.version=await dTe(t,r))}function _7e(){let o=navigator.userLanguage||navigator.language;return o&&o.includes("zh")?"zh-cn":"en"}function pTe(o){let{tags:t,custom_tags:e="[]"}=o;if(e==="[object Object]"&&(e=""),(!e||typeof e!="string"||e==="[]")&&t){if(Array.isArray(t)&&t.length)e=JSON.stringify(t);else if(Object.prototype.toString.call(t)==="[object Object]"){let r=_7e()==="en",i=[];if(t.parent_tag){let{name:n,name_cn:s}=t.parent_tag;if(r&&n?i.push(n):!r&&s?i.push(s):n&&i.push(n),t.child_tag){let{name:a,name_cn:l}=t.child_tag;r&&a?i.push(a):!r&&l?i.push(l):a&&i.push(a)}}e=JSON.stringify(i)}}return o.custom_tags=e,o.custom_tags}function D1(o){return String(o).length===13?Number(o):String(o).length===10?Number(o)*1e3:Number(o)}function gB(o){var t;return o.path||o.project_uuid||((t=o.owner)==null?void 0:t.uuid)}var aTt=Wz(zz()),v7e=(o=>o)(v7e||{}),x7e=(o=>(o.GET="/PrjDB/project/getData",o.UPDATE="/PrjDB/project/updateData",o.COUNT_DOC="/PrjDB/project/countDoc",o.GET_HISTORY_NODE="/PrjDB/project/getHistoricalNodes",o.GET_HISTORY_UPDATETIME="/PrjDB/project/getHistoryUpdatetime",o.GET_HISTORY_PROJECT="/PrjDB/project/getHistoricalProject",o.START_BATCH_UPLOAD="/PrjDB/project/startBatchUpload",o.END_BATCH_UPLOAD="/PrjDB/project/endBatchUpload",o.AWAIT_UPLOAD_END="/PrjDB/project/awaitUploadEnd",o.GET_MAX_TICKET="/PrjDB/project/getMaxTicket",o.GET_DOC_MAX_TICKET="/PrjDB/project/getDocMaxTicket",o.SAVE_PEND_DATA="/PrjDB/project/savePendData",o.REVOKE_PEND_DATA="/PrjDB/project/revokePendData",o.GET_CLIENT="/PrjDB/project/getClient",o.GET_BRANCH_DATA="/PrjDB/project/getBranchData",o.HISTORIES="/PrjDB/project/histories",o.COMPRESS="/PrjDB/project/compress",o.FLOW_WRITE="/PrjDB/project/flowWrite",o.GET_RELATED="/PrjDB/project/getRelated",o))(x7e||{}),R7e=(o=>(o.GET="/PrjDB/config/getData",o.UPDATE="/PrjDB/config/updateData",o))(R7e||{}),D7e=(o=>(o.GET="/PrjDB/board/getData",o.ADD="/PrjDB/board/addData",o.UPDATE="/PrjDB/board/updateData",o.DELETE="/PrjDB/board/deleteData",o.GET_ALL_KV="/PrjDB/board/getAllKVData",o.GET_ALL_ARR="/PrjDB/board/getAllArrData",o.TRY_RENAME="/PrjDB/board/tryRename",o.IS_RENAME="/PrjDB/board/isRename",o.BATCH_DELETE="/PrjDB/board/batchDelete",o.GET_BIND_KEYS="/PrjDB/board/getBindKeys",o))(D7e||{}),w7e=(o=>(o.GET="/PrjDB/schematic/getData",o.GET_BY_NAME="/PrjDB/schematic/getDataByName",o.TRY_RENAME="/PrjDB/schematic/tryRename",o.UPDATE_IN_LOCAL="/PrjDB/schematic/updateDataInLocal",o.ADD="/PrjDB/schematic/addData",o.UPDATE="/PrjDB/schematic/updateData",o.DEL="/PrjDB/schematic/delData",o.GET_ALL_KV="/PrjDB/schematic/getAllKVDatas",o.GET_UUID_BY_NAME="/PrjDB/schematic/getIdByName",o.GET_NAME_BY_UUID="/PrjDB/schematic/getNameById",o.GET_DISPLAY_NAME_BY_UUID="/PrjDB/schematic/getDisplayNameById",o.GET_ALL_ARR="/PrjDB/schematic/getAllArrDatas",o.GET_BY_SOURCE_VERSION="/PrjDB/schematic/getDataBySourceAndVersion",o.GET_LAST="/PrjDB/schematic/getLastData",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/schematic/getAllArrDatasBySource",o.IS_RENAME="/PrjDB/schematic/isRename",o.BATCH_DELETE="/PrjDB/schematic/batchDelete",o))(w7e||{}),L7e=(o=>(o.ADD="/PrjDB/sheet/addData",o.DEL="/PrjDB/sheet/delData",o.UPDATE="/PrjDB/sheet/updateData",o.UPDATE_LOTS="/PrjDB/sheet/updateLotDatas",o.GET_ALL_KV="/PrjDB/sheet/getAllKVDatas",o.GET="/PrjDB/sheet/getData",o.GET_ALL_ARR="/PrjDB/sheet/getAllArrDatas",o.GET_LOTS_ARR="/PrjDB/sheet/getLotsArrDatas",o.GET_CANVAS="/PrjDB/sheet/getCanvas",o.SET_CANVAS="/PrjDB/sheet/setCanvas",o.WATCH_CANVAS_UPDATE="/PrjDB/sheet/watchCanvas",o.UNWATCH_CANVAS_UPDATE="/PrjDB/sheet/unwatchCanvas",o.GET_BY_SOURCE_VERSION="/PrjDB/sheet/getDataBySourceAndVersion",o.GET_LAST="/PrjDB/sheet/getLastData",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/sheet/getAllArrDatasBySource",o.TRY_RENAME="/PrjDB/sheet/tryRename",o.IS_RENAME="/PrjDB/sheet/isRename",o.BATCH_DELETE="/PrjDB/sheet/batchDelete",o.GET_ALL_KEYS="/PrjDB/sheet/getAllPrimaryKeys",o))(L7e||{}),M7e=(o=>(o.ADD="/PrjDB/simulation/addData",o.DEL="/PrjDB/simulation/delData",o.UPDATE="/PrjDB/simulation/updateData",o.UPDATE_LOTS="/PrjDB/simulation/updateLotDatas",o.GET_ALL_KV="/PrjDB/simulation/getAllKVDatas",o.GET="/PrjDB/simulation/getData",o.GET_ALL_ARR="/PrjDB/simulation/getAllArrDatas",o.GET_LOTS_ARR="/PrjDB/simulation/getLotsArrDatas",o.GET_CANVAS="/PrjDB/simulation/getCanvas",o.SET_CANVAS="/PrjDB/simulation/setCanvas",o.WATCH_CANVAS_UPDATE="/PrjDB/simulation/watchCanvas",o.UNWATCH_CANVAS_UPDATE="/PrjDB/simulation/unwatchCanvas",o.GET_BY_SOURCE_VERSION="/PrjDB/simulation/getDataBySourceAndVersion",o.GET_LAST="/PrjDB/simulation/getLastData",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/simulation/getAllArrDatasBySource",o.TRY_RENAME="/PrjDB/simulation/tryRename",o.IS_RENAME="/PrjDB/simulation/isRename",o.BATCH_DELETE="/PrjDB/simulation/batchDelete",o.GET_ALL_KEYS="/PrjDB/simulation/getAllPrimaryKeys",o))(M7e||{}),N7e=(o=>(o.GET="/PrjDB/pcb/getData",o.GET_BY_TITLE="/PrjDB/pcb/getDataByTitle",o.GET_UUID_BY_TITLE="/PrjDB/pcb/getIdByTitle",o.ADD="/PrjDB/pcb/addData",o.DEL="/PrjDB/pcb/delData",o.CREATE_SUB="/PrjDB/pcb/createSub",o.UPDATE_SUB="/PrjDB/pcb/updateSubInherit",o.UPDATE="/PrjDB/pcb/updateData",o.UPDATE_LOTS="/PrjDB/pcb/updateLotDatas",o.GET_ALL_KV="/PrjDB/pcb/getAllKVDatas",o.GET_ALL_ARR="/PrjDB/pcb/getAllArrDatas",o.GET_CANVAS="/PrjDB/pcb/getCanvas",o.SET_CANVAS="/PrjDB/pcb/setCanvas",o.WATCH_CANVAS_UPDATE="/PrjDB/pcb/watchCanvas",o.UNWATCH_CANVAS_UPDATE="/PrjDB/pcb/unwatchCanvas",o.GET_BY_SOURCE_VERSION="/PrjDB/pcb/getDataBySourceAndVersion",o.GET_LAST="/PrjDB/pcb/getLastData",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/pcb/getAllArrDatasBySource",o.TRY_RENAME="/PrjDB/pcb/tryRename",o.IS_RENAME="/PrjDB/pcb/isRename",o.BATCH_DELETE="/PrjDB/pcb/batchDelete",o.GET_ALL_KEYS="/PrjDB/pcb/getAllPrimaryKeys",o))(N7e||{}),k7e=(o=>(o.GET="/PrjDB/panel/getData",o.ADD="/PrjDB/panel/addData",o.DEL="/PrjDB/panel/delData",o.UPDATE="/PrjDB/panel/updateData",o.UPDATE_LOTS="/PrjDB/panel/updateLotDatas",o.GET_ALL_KV="/PrjDB/panel/getAllKVDatas",o.GET_ALL_ARR="/PrjDB/panel/getAllArrDatas",o.GET_CANVAS="/PrjDB/panel/getCanvas",o.SET_CANVAS="/PrjDB/panel/setCanvas",o.WATCH_CANVAS_UPDATE="/PrjDB/panel/watchCanvas",o.UNWATCH_CANVAS_UPDATE="/PrjDB/panel/unwatchCanvas",o.TRY_RENAME="/PrjDB/panel/tryRename",o.IS_RENAME="/PrjDB/panel/isRename",o.BATCH_DELETE="/PrjDB/panel/batchDelete",o.GET_ALL_KEYS="/PrjDB/panel/getAllPrimaryKeys",o))(k7e||{}),B7e=(o=>(o.GET_BY_TITLE="/PrjDB/symbol/getDataByTitle",o.GET="/PrjDB/symbol/getData",o.ADD="/PrjDB/symbol/addData",o.CREATE="/PrjDB/symbol/createData",o.COVER="/PrjDB/symbol/coverData",o.CLONE="/PrjDB/symbol/cloneData",o.DEL="/PrjDB/symbol/delData",o.UPDATE="/PrjDB/symbol/updateData",o.GET_UUIDS_BY_TITLE="/PrjDB/symbol/getIdsByTitle",o.GET_TITLE_BY_UUID="/PrjDB/symbol/getTitleById",o.GET_ALL_KV="/PrjDB/symbol/getAllKVDatas",o.GET_BY_SOURCE_VERSION="/PrjDB/symbol/getDataBySourceAndVersion",o.GET_COMPARE_TICKET="/PrjDB/symbol/getDataCompareTicket",o.GET_LAST="/PrjDB/symbol/getLastData",o.IS_EXIST="/PrjDB/symbol/isExist",o.GET_ALL_KEYS="/PrjDB/symbol/getAllPrimaryKeys",o.GET_TYPE_KEYS="/PrjDB/symbol/getTypePrimaryKeys",o.GET_ALL_ARR="/PrjDB/symbol/getAllArrDatas",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/symbol/getAllArrDatasBySource",o.GET_KEYS_BY_SOURCE="/PrjDB/symbol/getKeysBySource",o.GET_ALL_ARR_BY_TYPE="/PrjDB/symbol/getTypeDatas",o.GET_STR="/PrjDB/symbol/getStr",o.GET_CANVAS="/PrjDB/symbol/getCanvas",o.SET_CANVAS="/PrjDB/symbol/setCanvas",o.WATCH_CANVAS_UPDATE="/PrjDB/symbol/watchCanvas",o.UNWATCH_CANVAS_UPDATE="/PrjDB/symbol/unwatchCanvas",o.TRY_RENAME="/PrjDB/symbol/tryRename",o.WITH_ORIGINS="/PrjDB/symbol/withOrigins",o.IS_RENAME="/PrjDB/symbol/isRename",o.IS_CHANGE="/PrjDB/symbol/isChange",o.BATCH_DELETE="/PrjDB/symbol/batchDelete",o.GET_LIST="/PrjDB/symbol/getList",o))(B7e||{}),F7e=(o=>(o.GET_BY_TITLE="/PrjDB/footprint/getDataByTitle",o.GET="/PrjDB/footprint/getData",o.IS_EXIST="/PrjDB/footprint/isExist",o.ADD="/PrjDB/footprint/addData",o.CREATE="/PrjDB/footprint/createData",o.COVER="/PrjDB/footprint/coverData",o.CLONE="/PrjDB/footprint/cloneData",o.DEL="/PrjDB/footprint/delData",o.GET_ALL_KV="/PrjDB/footprint/getAllKVDatas",o.UPDATE="/PrjDB/footprint/updateData",o.UPDATE_IN_LOCAL="/PrjDB/footprint/updateDataInLocal",o.GET_TITLE_BY_UUID="/PrjDB/footprint/getTitleById",o.GET_BY_SOURCE_VERSION="/PrjDB/footprint/getDataBySourceAndVersion",o.GET_COMPARE_TICKET="/PrjDB/footprint/getDataCompareTicket",o.GET_LAST="/PrjDB/footprint/getLastData",o.GET_ALL_KEYS="/PrjDB/footprint/getAllPrimaryKeys",o.GET_ALL_ARR="/PrjDB/footprint/getAllArrDatas",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/footprint/getAllArrDatasBySource",o.GET_KEYS_BY_SOURCE="/PrjDB/footprint/getKeysBySource",o.GET_ALL_ARR_BY_PCB_UUID="/PrjDB/footprint/getAllArrDatasByPcbId",o.GET_KEYS_BY_PCB_UUID="/PrjDB/footprint/getKeysByPcbId",o.GET_STR="/PrjDB/footprint/getStr",o.GET_CANVAS="/PrjDB/footprint/getCanvas",o.SET_CANVAS="/PrjDB/footprint/setCanvas",o.WATCH_CANVAS_UPDATE="/PrjDB/footprint/watchCanvas",o.UNWATCH_CANVAS_UPDATE="/PrjDB/footprint/unwatchCanvas",o.TRY_RENAME="/PrjDB/footprint/tryRename",o.WITH_ORIGINS="/PrjDB/footprint/withOrigins",o.IS_CHANGE="/PrjDB/footprint/isChange",o.IS_RENAME="/PrjDB/footprint/isRename",o.BATCH_DELETE="/PrjDB/footprint/batchDelete",o.GET_LIST="/PrjDB/footprint/getList",o))(F7e||{}),V7e=(o=>(o.GET="/PrjDB/device/getData",o.GET_ATTRIBUTES_KEYS="/PrjDB/device/getDeviceAttributesKeys",o.GET_ATTRIBUTES_VALUES="/PrjDB/device/getDeviceAttributesValues",o.GET_BY_TITLE="/PrjDB/device/getDataByTitle",o.ADD="/PrjDB/device/addData",o.CREATE="/PrjDB/device/createData",o.DEL="/PrjDB/device/delData",o.GET_ALL_KV="/PrjDB/device/getAllKVDatas",o.UPDATE="/PrjDB/device/updateData",o.GET_TITLE_BY_UUID="/PrjDB/device/getTitleById",o.GET_SYMBOL_UUID="/PrjDB/device/getSymbolIdById",o.GET_BY_SOURCE_VERSION="/PrjDB/device/getDataBySourceAndVersion",o.GET_LAST="/PrjDB/device/getLastData",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/device/getAllArrDatasBySource",o.GET_KEYS_BY_SOURCE="/PrjDB/device/getKeysBySource",o.GET_COMPARE_TICKET="/PrjDB/device/getDataCompareTicket",o.IS_EXIST="/PrjDB/device/isExist",o.GET_ALL_KEYS="/PrjDB/device/getAllPrimaryKeys",o.GET_ALL_ARR="/PrjDB/device/getAllArrDatas",o.GET_ALL_ARR_BY_SYMBOL_UUID="/PrjDB/device/getAllArrDatasBySymbolId",o.GET_ALL_ARR_BY_FOOTPRINT_UUID="/PrjDB/device/getAllArrDatasByfootprintId",o.TRY_RENAME="/PrjDB/device/tryRename",o.BIND_SYMBOL="/PrjDB/device/bindSymbol",o.BIND_fOOTPRINT="/PrjDB/device/bindFootprint",o.WITH_ORIGINS="/PrjDB/device/withOrigins",o.IS_CHANGE="/PrjDB/device/isChange",o.IS_RENAME="/PrjDB/device/isRename",o.BATCH_DELETE="/PrjDB/device/batchDelete",o.GET_LIST="/PrjDB/device/getList",o))(V7e||{}),G7e=(o=>(o.GET="/PrjDB/attr/getData",o.UPDATE="/PrjDB/attr/updateData",o.BATCH_UPDATE="/PrjDB/attr/batchUpdateData",o.ADD="/PrjDB/attr/addData",o.DEL="/PrjDB/attr/delData",o.GET_ALL_KV="/PrjDB/attr/getAllKVDatas",o.GET_ALL_ARR="/PrjDB/attr/getAllArrDatas",o.GET_ALL_ARR_BY_HASH="/PrjDB/attr/getAllArrDatasByHash",o.BATCH_DELETE="/PrjDB/attr/batchDelete",o))(G7e||{}),U7e=(o=>(o.GET="/PrjDB/blob/getData",o.ADD="/PrjDB/blob/addData",o.DEL="/PrjDB/blob/delData",o.GET_ALL_ARR="/PrjDB/blob/getAllArrDatas",o.BATCH_DELETE="/PrjDB/blob/batchDelete",o))(U7e||{}),H7e=(o=>(o.GET="/PrjDB/copper/getData",o.ADD="/PrjDB/copper/addData",o.DEL_LOTS="/PrjDB/copper/delLotDatas",o.DEL="/PrjDB/copper/delData",o.GET_ALL_KEYS="/PrjDB/copper/getAllPrimaryKeys",o.UPDATE="/PrjDB/copper/updateData",o.GET_ALL_ARR="/PrjDB/copper/getAllArrDatas",o.GET_ALL_ARR_BY_PCB_UUID="/PrjDB/copper/getAllArrDatasByPcbId",o.GET_ALL_KEYS_BY_PCB_UUID="/PrjDB/copper/getAllArrKeysByPcbId",o))(H7e||{}),W7e=(o=>(o.GET="/PrjDB/font/getData",o.ADD="/PrjDB/font/addData",o.DEL_LOTS="/PrjDB/font/delLotDatas",o.DEL="/PrjDB/font/delData",o.GET_ALL_KEYS="/PrjDB/font/getAllPrimaryKeys",o.UPDATE="/PrjDB/font/updateData",o.GET_ALL_ARR="/PrjDB/font/getAllArrDatas",o.GET_ALL_ARR_BY_PCB_UUID="/PrjDB/font/getAllArrDatasByPcbId",o.GET_ALL_KEYS_BY_PCB_UUID="/PrjDB/font/getAllArrKeysByPcbId",o))(W7e||{}),z7e=(o=>(o.BATCH_ADD="/PrjDB/variant/batchAddVariant",o.ADD="/PrjDB/variant/addData",o.DELETE="/PrjDB/variant/deleteData",o.BATCH_DELETE="/PrjDB/variant/batchDeleteData",o.BATCH_RESTORE="/PrjDB/variant/batchRestoreData",o.GET="/PrjDB/variant/getData",o.GET_ALL_ARR_BY_SID="/PrjDB/variant/getAllArrDatasBySid",o.UPDATE_TITLE="/PrjDB/variant/updateTitle",o.UPDATE_NOT_GROUPED="/PrjDB/variant/updateNotGrouped",o.BATCH_UPDATE_SORT="/PrjDB/variant/batchUpdateZIndex",o))(z7e||{}),Y7e=(o=>(o.BATCH_ADD="/PrjDB/componentGroup/batchAddData",o.ADD="/PrjDB/componentGroup/addData",o.DELETE="/PrjDB/componentGroup/deleteData",o.BATCH_DELETE="/PrjDB/componentGroup/batchDeleteData",o.BATCH_RESTORE="/PrjDB/componentGroup/batchRestoreData",o.GET="/PrjDB/componentGroup/getData",o.GET_ALL_ARR_BY_SID="/PrjDB/componentGroup/getAllArrDatasBySid",o.GET_ATTR_DATA="/PrjDB/componentGroup/getComponentGroupData",o.UPDATE_TITLE="/PrjDB/componentGroup/updateTitle",o.BATCH_UPDATE_SORT="/PrjDB/componentGroup/batchUpdateZIndex",o.BATCH_UPLOAD_VARIANT_INDEX="/PrjDB/componentGroup/batchUploadGroupSortInVariant",o.BATCH_DELETE_VARIANT_INDEX="/PrjDB/componentGroup/batchDeleteGroupSortInVariant",o.UPLOAD_ATTR_DATA="/PrjDB/componentGroup/uploadComponentGroupData",o.BATCH_DELETE_ATTR_DATA="/PrjDB/componentGroup/batchDeleteComponentGroupData",o))(Y7e||{}),us={VARIANT:z7e,COMPONENT_GROUP:Y7e,COMMON:v7e,PROJECT:x7e,CONFIG:R7e,BOARD:D7e,SCHEMATIC:w7e,SHEET:L7e,SIMULATION:M7e,PCB:N7e,PANEL:k7e,SYMBOL:B7e,FOOTPRINT:F7e,DEVICE:V7e,ATTR:G7e,BLOB:U7e,COPPER:H7e,FONT:W7e};function CM(o){return!o.data}function lTt(o){return!!(o.path&&o.uuid&&o.docType&&o.isProject!==void 0&&Object.keys(o).length===4)}async function dx(o){let{origin:t,target:e}=o;if(e.isProject){let r={uuid:e.uuid,data:t,overwriteCanvas:CM(t)};if(e.docType===4)return{success:(await mn.messageBus.rpcCall(us.FOOTPRINT.COVER,[r,e.path])).message.success};if($ee(e.docType))return{success:(await mn.messageBus.rpcCall(us.SYMBOL.COVER,[r,e.path])).message.success};throw new Error("Api call error!")}else{let r=await gNe.getProLibSource(t);if(r.success===!1)return{success:!1,code:r.code,message:r.message};let i=r.result,n=await gNe.getProLibSource(e);if(n.success===!1)return{success:!1,code:n.code,message:n.message};let s=n.result,a=DI(),l;if(e.docType===4)l=WPe(s,i,{docType:Rz.FOOTPRINT,uuid:e.uuid,client:a});else if(e.docType===29)l=WPe(s,i,{docType:Rz.PANEL_LIB,uuid:e.uuid,client:a});else if($ee(e.docType))l=WPe(s,i,{docType:Rz.SYMBOL,uuid:e.uuid,client:a});else throw new Error("Api call error!");let c={path:e.path,uuid:e.uuid,dataStr:l},{message:h}=await mn.messageBus.rpcCall(gA.COMPONENT.SET_HISTORY,c);return h.success===!1?{success:!1,code:h.code,message:h.message}:{success:!0}}}function hIe(o){return self[o]=self[o]||new aTt.BroadcastChannelMessageBus(o)}async function cTt(o){let t=$();return hIe(`/${t._TAB_ID_}/notify`).rpcCall("/pro-ui/libSource/getProLibSource",o)}var hTt=(o=>(o.OPEN="/pro-mgr/project/open",o.CLOSE="/pro-mgr/project/close",o.TEMP_OPEN="/pro-mgr/project/tempOpen",o.TEMP_OPEN_BY_STRING="/pro-mgr/project/tempOpenByString",o.TEMP_CLOSE="/pro-mgr/project/tempClose",o.ON_OPENED="/pro-mgr/project/onOpened",o.ON_TEMP_OPENED="/pro-mgr/project/onTempOpened",o.BEFORE_CLOSE="/pro-mgr/project/beforeClose",o.ON_CLOSED="/pro-mgr/project/onClosed",o.ON_TEMP_CLOSED="/pro-mgr/project/onTempClosed",o.ON_FAILED="/pro-mgr/project/onFailed",o.GET_RECENT_PROJECT_LIST="/pro-mgr/getRecentPrjList",o.UPDATE_PROJECT="/pro-mgr/updateProject",o.DEL_PROJECT="/pro-mgr/deleteProject",o.HAS="/pro-mgr/hasProject",o))(hTt||{}),uTt=(o=>(o.SYSTEM="system",o.INTERNAL="Internal",o.PERSONAL="personal",o.PROJECT="project",o.STAR="star",o.TEAMS="teams",o.USER="user",o.CLIENT="client",o.PUBLIC="public",o.OSHWHUB="oshwhub",o.EXTEND="extend",o))(uTt||{}),dTt=(o=>(o.DEVICE="device",o.SYMBOL="symbol",o.FOOTPRINT="footprint",o.CBB="cbb",o.MODEL3D="model3D",o.PANEL_LIB="panelLib",o.MODEL_SIM_LIB="modelSimLib",o))(dTt||{}),uIe={D3Model:{client3DModelList:"api/client/steps"}},Ai=class{};Ai.CANVAS_UNIT_MM="mm",Ai.CANVAS_UNIT_MIL="mil",Ai.HEX_BLACK_COLOR="#000000",Ai.HEX_WHITE_COLOR="#FFFFFF",Ai.HEX_RED_COLOR="#FF0000",Ai.HEX_GREEN_COLOR="#00FF00",Ai.HEX_BLUE_COLOR="#0000FF",Ai.HEX_GRAY_COLOR1="#F1F1F1",Ai.HEX_GRAY_COLOR2="#EFEFEF",Ai.HEX_GRAY_COLOR3="#999999",Ai.HEX_GRAY_COLOR4="#666666",Ai.HEX_GRAY_COLOR5="#333333",Ai.HEX_GRAY_COLOR6="#CCCCCC",Ai.DEFAULT_PAGESIZE=50,Ai.SYMBOLTYPE_ITEM_ALL_VALUE="@all",Ai.SYMBOLTYPE_ITEM_ALL_TITLE="All",Ai.D3MVIEW_DEFAULT_TRANSFORM="0, 0, 0, 0, 0, 0, 0, 0, 0",Ai.DEVICE_INDEX_TAG="$_",Ai.DEVICE_SPLIT_TAG="@_",Ai.LIB_SPLIT_TAG="#_",Ai.CATEGORY_ITEM_ALL_VALUE="@all",Ai.CATEGORY_ITEM_ALL_TITLE="All",Ai.FAVORITELIB_UUID="star",Ai.SYSTEMLIB_UUID="0819f05c4eef4c71ace90d822a990e87",Ai.SYSTEMLIB_UUID_ALIAS="lcsc",Ai.USERLIB_ALIAS="mine",Ai.PUBLICLIB_ALIAS="user",Ai.STD_PUBLIC_LIB_UUID="stdPublic",Ai.RECENT_LIB_UUID="recent",Ai.INTERNAL_LIB_ALIAS="Internal",Ai.PERSIONAL_WORKSPACE="Personal",Ai.EDU_WORKSPACE="6d84b27f18f540b6a31c4d657314ab13",Ai.EDA_TEST_WORKSPACE="407ec92f2a2f4275bf08cbebf64f5e08",Ai.LIB_SYSTEM_KEY="system",Ai.LIB_PROJECT_KEY="project",Ai.LIB_PERSONAL_KEY="personal",Ai.LIB_PUBLIC_KEY="public",Ai.LIB_INTERNAL_KEY="Internal",Ai.LIB_FAVORITE_KEY="favorite",Ai.LIB_TEMAS_KEY="teams",Ai.API=uIe,Ai.ERR_CODE={NORMAL:-1,DUP_NAME:-9001};var oNe={},pTt=(function(o,t,e,r,i){var n=new Worker(oNe[t]||(oNe[t]=URL.createObjectURL(new Blob([o+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return n.onmessage=function(s){var a=s.data,l=a.$e$;if(l){var c=new Error(l[0]);c.code=l[1],c.stack=l[2],i(c,null)}else i(null,a)},n.postMessage(e,r),n}),Ac=Uint8Array,kb=Uint16Array,Jz=Int32Array,yB=new Ac([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bB=new Ac([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Gz=new Ac([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),j7e=function(o,t){for(var e=new kb(31),r=0;r<31;++r)e[r]=t+=1<<o[r-1];for(var i=new Jz(e[30]),r=1;r<30;++r)for(var n=e[r];n<e[r+1];++n)i[n]=n-e[r]<<5|r;return{b:e,r:i}},X7e=j7e(yB,2),dIe=X7e.b,Kee=X7e.r;dIe[28]=258,Kee[258]=28;var q7e=j7e(bB,0),$7e=q7e.b,kTe=q7e.r,Uz=new kb(32768);for(ru=0;ru<32768;++ru)aA=(ru&43690)>>1|(ru&21845)<<1,aA=(aA&52428)>>2|(aA&13107)<<2,aA=(aA&61680)>>4|(aA&3855)<<4,Uz[ru]=((aA&65280)>>8|(aA&255)<<8)>>1;var aA,ru,LI=(function(o,t,e){for(var r=o.length,i=0,n=new kb(t);i<r;++i)o[i]&&++n[o[i]-1];var s=new kb(t);for(i=1;i<t;++i)s[i]=s[i-1]+n[i-1]<<1;var a;if(e){a=new kb(1<<t);var l=15-t;for(i=0;i<r;++i)if(o[i])for(var c=i<<4|o[i],h=t-o[i],u=s[o[i]-1]++<<h,d=u|(1<<h)-1;u<=d;++u)a[Uz[u]>>l]=c}else for(a=new kb(r),i=0;i<r;++i)o[i]&&(a[i]=Uz[s[o[i]-1]++]>>15-o[i]);return a}),yA=new Ac(288);for(ru=0;ru<144;++ru)yA[ru]=8;var ru;for(ru=144;ru<256;++ru)yA[ru]=9;var ru;for(ru=256;ru<280;++ru)yA[ru]=7;var ru;for(ru=280;ru<288;++ru)yA[ru]=8;var ru,pB=new Ac(32);for(ru=0;ru<32;++ru)pB[ru]=5;var ru,K7e=LI(yA,9,0),Z7e=LI(yA,9,1),J7e=LI(pB,5,0),Q7e=LI(pB,5,1),wee=function(o){for(var t=o[0],e=1;e<o.length;++e)o[e]>t&&(t=o[e]);return t},RI=function(o,t,e){var r=t/8|0;return(o[r]|o[r+1]<<8)>>(t&7)&e},Lee=function(o,t){var e=t/8|0;return(o[e]|o[e+1]<<8|o[e+2]<<16)>>(t&7)},PB=function(o){return(o+7)/8|0},PE=function(o,t,e){return(t==null||t<0)&&(t=0),(e==null||e>o.length)&&(e=o.length),new Ac(o.subarray(t,e))},eke=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ja=function(o,t,e){var r=new Error(t||eke[o]);if(r.code=o,Error.captureStackTrace&&Error.captureStackTrace(r,ja),!e)throw r;return r},cte=function(o,t,e,r){var i=o.length,n=r?r.length:0;if(!i||t.f&&!t.l)return e||new Ac(0);var s=!e,a=s||t.i!=2,l=t.i;s&&(e=new Ac(i*3));var c=function(se){var K=e.length;if(se>K){var me=new Ac(Math.max(K*2,se));me.set(e),e=me}},h=t.f||0,u=t.p||0,d=t.b||0,p=t.l,m=t.d,g=t.m,y=t.n,b=i*8;do{if(!p){h=RI(o,u,1);var P=RI(o,u+1,3);if(u+=3,P)if(P==1)p=Z7e,m=Q7e,g=9,y=5;else if(P==2){var T=RI(o,u,31)+257,I=RI(o,u+10,15)+4,C=T+RI(o,u+5,31)+1;u+=14;for(var E=new Ac(C),O=new Ac(19),_=0;_<I;++_)O[Gz[_]]=RI(o,u+_*3,7);u+=I*3;for(var R=wee(O),v=(1<<R)-1,D=LI(O,R,1),_=0;_<C;){var w=D[RI(o,u,v)];u+=w&15;var F=w>>4;if(F<16)E[_++]=F;else{var H=0,z=0;for(F==16?(z=3+RI(o,u,3),u+=2,H=E[_-1]):F==17?(z=3+RI(o,u,7),u+=3):F==18&&(z=11+RI(o,u,127),u+=7);z--;)E[_++]=H}}var G=E.subarray(0,T),W=E.subarray(T);g=wee(G),y=wee(W),p=LI(G,g,1),m=LI(W,y,1)}else ja(1);else{var F=PB(u)+4,L=o[F-4]|o[F-3]<<8,B=F+L;if(B>i){l&&ja(0);break}a&&c(d+L),e.set(o.subarray(F,B),d),t.b=d+=L,t.p=u=B*8,t.f=h;continue}if(u>b){l&&ja(0);break}}a&&c(d+131072);for(var N=(1<<g)-1,U=(1<<y)-1,k=u;;k=u){var H=p[Lee(o,u)&N],V=H>>4;if(u+=H&15,u>b){l&&ja(0);break}if(H||ja(2),V<256)e[d++]=V;else if(V==256){k=u,p=null;break}else{var Y=V-254;if(V>264){var _=V-257,X=yB[_];Y=RI(o,u,(1<<X)-1)+dIe[_],u+=X}var Z=m[Lee(o,u)&U],Q=Z>>4;Z||ja(3),u+=Z&15;var W=$7e[Q];if(Q>3){var X=bB[Q];W+=Lee(o,u)&(1<<X)-1,u+=X}if(u>b){l&&ja(0);break}a&&c(d+131072);var ae=d+Y;if(d<W){var he=n-W,re=Math.min(W,ae);for(he+d<0&&ja(3);d<re;++d)e[d]=r[he+d]}for(;d<ae;++d)e[d]=e[d-W]}}t.l=p,t.p=k,t.b=d,t.f=h,p&&(h=1,t.m=g,t.d=m,t.n=y)}while(!h);return d!=e.length&&s?PE(e,0,d):e.subarray(0,d)},fE=function(o,t,e){e<<=t&7;var r=t/8|0;o[r]|=e,o[r+1]|=e>>8},Qk=function(o,t,e){e<<=t&7;var r=t/8|0;o[r]|=e,o[r+1]|=e>>8,o[r+2]|=e>>16},Mee=function(o,t){for(var e=[],r=0;r<o.length;++r)o[r]&&e.push({s:r,f:o[r]});var i=e.length,n=e.slice();if(!i)return{t:ox,l:0};if(i==1){var s=new Ac(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(C,E){return C.f-E.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],c=0,h=1,u=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=i-1;)a=e[e[c].f<e[u].f?c++:u++],l=e[c!=h&&e[c].f<e[u].f?c++:u++],e[h++]={s:-1,f:a.f+l.f,l:a,r:l};for(var d=n[0].s,r=1;r<i;++r)n[r].s>d&&(d=n[r].s);var p=new kb(d+1),m=Zee(e[h-1],p,0);if(m>t){var r=0,g=0,y=m-t,b=1<<y;for(n.sort(function(E,O){return p[O.s]-p[E.s]||E.f-O.f});r<i;++r){var P=n[r].s;if(p[P]>t)g+=b-(1<<m-p[P]),p[P]=t;else break}for(g>>=y;g>0;){var T=n[r].s;p[T]<t?g-=1<<t-p[T]++-1:++r}for(;r>=0&&g;--r){var I=n[r].s;p[I]==t&&(--p[I],++g)}m=t}return{t:new Ac(p),l:m}},Zee=function(o,t,e){return o.s==-1?Math.max(Zee(o.l,t,e+1),Zee(o.r,t,e+1)):t[o.s]=e},BTe=function(o){for(var t=o.length;t&&!o[--t];);for(var e=new kb(++t),r=0,i=o[0],n=1,s=function(l){e[r++]=l},a=1;a<=t;++a)if(o[a]==i&&a!=t)++n;else{if(!i&&n>2){for(;n>138;n-=138)s(32754);n>2&&(s(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(s(i),--n;n>6;n-=6)s(8304);n>2&&(s(n-3<<5|8208),n=0)}for(;n--;)s(i);n=1,i=o[a]}return{c:e.subarray(0,r),n:t}},eB=function(o,t){for(var e=0,r=0;r<t.length;++r)e+=o[r]*t[r];return e},pIe=function(o,t,e){var r=e.length,i=PB(t+2);o[i]=r&255,o[i+1]=r>>8,o[i+2]=o[i]^255,o[i+3]=o[i+1]^255;for(var n=0;n<r;++n)o[i+n+4]=e[n];return(i+4+r)*8},FTe=function(o,t,e,r,i,n,s,a,l,c,h){fE(t,h++,e),++i[256];for(var u=Mee(i,15),d=u.t,p=u.l,m=Mee(n,15),g=m.t,y=m.l,b=BTe(d),P=b.c,T=b.n,I=BTe(g),C=I.c,E=I.n,O=new kb(19),_=0;_<P.length;++_)++O[P[_]&31];for(var _=0;_<C.length;++_)++O[C[_]&31];for(var R=Mee(O,7),v=R.t,D=R.l,w=19;w>4&&!v[Gz[w-1]];--w);var F=c+5<<3,H=eB(i,yA)+eB(n,pB)+s,z=eB(i,d)+eB(n,g)+s+14+3*w+eB(O,v)+2*O[16]+3*O[17]+7*O[18];if(l>=0&&F<=H&&F<=z)return pIe(t,h,o.subarray(l,l+c));var G,W,L,B;if(fE(t,h,1+(z<H)),h+=2,z<H){G=LI(d,p,0),W=d,L=LI(g,y,0),B=g;var N=LI(v,D,0);fE(t,h,T-257),fE(t,h+5,E-1),fE(t,h+10,w-4),h+=14;for(var _=0;_<w;++_)fE(t,h+3*_,v[Gz[_]]);h+=3*w;for(var U=[P,C],k=0;k<2;++k)for(var V=U[k],_=0;_<V.length;++_){var Y=V[_]&31;fE(t,h,N[Y]),h+=v[Y],Y>15&&(fE(t,h,V[_]>>5&127),h+=V[_]>>12)}}else G=K7e,W=yA,L=J7e,B=pB;for(var _=0;_<a;++_){var X=r[_];if(X>255){var Y=X>>18&31;Qk(t,h,G[Y+257]),h+=W[Y+257],Y>7&&(fE(t,h,X>>23&31),h+=yB[Y]);var Z=X&31;Qk(t,h,L[Z]),h+=B[Z],Z>3&&(Qk(t,h,X>>5&8191),h+=bB[Z])}else Qk(t,h,G[X]),h+=W[X]}return Qk(t,h,G[256]),h+W[256]},tke=new Jz([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ox=new Ac(0),rke=function(o,t,e,r,i,n){var s=n.z||o.length,a=new Ac(r+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(r,a.length-i),c=n.l,h=(n.r||0)&7;if(t){h&&(l[0]=n.r>>3);for(var u=tke[t-1],d=u>>13,p=u&8191,m=(1<<e)-1,g=n.p||new kb(32768),y=n.h||new kb(m+1),b=Math.ceil(e/3),P=2*b,T=function(Oe){return(o[Oe]^o[Oe+1]<<b^o[Oe+2]<<P)&m},I=new Jz(25e3),C=new kb(288),E=new kb(32),O=0,_=0,R=n.i||0,v=0,D=n.w||0,w=0;R+2<s;++R){var F=T(R),H=R&32767,z=y[F];if(g[H]=z,y[F]=H,D<=R){var G=s-R;if((O>7e3||v>24576)&&(G>423||!c)){h=FTe(o,l,0,I,C,E,_,v,w,R-w,h),v=O=_=0,w=R;for(var W=0;W<286;++W)C[W]=0;for(var W=0;W<30;++W)E[W]=0}var L=2,B=0,N=p,U=H-z&32767;if(G>2&&F==T(R-U))for(var k=Math.min(d,G)-1,V=Math.min(32767,R),Y=Math.min(258,G);U<=V&&--N&&H!=z;){if(o[R+L]==o[R+L-U]){for(var X=0;X<Y&&o[R+X]==o[R+X-U];++X);if(X>L){if(L=X,B=U,X>k)break;for(var Z=Math.min(U,X-2),Q=0,W=0;W<Z;++W){var ae=R-U+W&32767,he=g[ae],re=ae-he&32767;re>Q&&(Q=re,z=ae)}}}H=z,z=g[H],U+=H-z&32767}if(B){I[v++]=268435456|Kee[L]<<18|kTe[B];var se=Kee[L]&31,K=kTe[B]&31;_+=yB[se]+bB[K],++C[257+se],++E[K],D=R+L,++O}else I[v++]=o[R],++C[o[R]]}}for(R=Math.max(R,D);R<s;++R)I[v++]=o[R],++C[o[R]];h=FTe(o,l,c,I,C,E,_,v,w,R-w,h),c||(n.r=h&7|l[h/8|0]<<3,h-=7,n.h=y,n.p=g,n.i=R,n.w=D)}else{for(var R=n.w||0;R<s+c;R+=65535){var me=R+65535;me>=s&&(l[h/8|0]=c,me=s),h=pIe(l,h+1,o.subarray(R,me))}n.i=s}return PE(a,0,r+PB(h)+i)},fTt=(function(){for(var o=new Int32Array(256),t=0;t<256;++t){for(var e=t,r=9;--r;)e=(e&1&&-306674912)^e>>>1;o[t]=e}return o})(),fIe=function(){var o=-1;return{p:function(t){for(var e=o,r=0;r<t.length;++r)e=fTt[e&255^t[r]]^e>>>8;o=e},d:function(){return~o}}},ike=function(){var o=1,t=0;return{p:function(e){for(var r=o,i=t,n=e.length|0,s=0;s!=n;){for(var a=Math.min(s+2655,n);s<a;++s)i+=r+=e[s];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}o=r,t=i},d:function(){return o%=65521,t%=65521,(o&255)<<24|(o&65280)<<8|(t&255)<<8|t>>8}}},TB=function(o,t,e,r,i){if(!i&&(i={l:1},t.dictionary)){var n=t.dictionary.subarray(-32768),s=new Ac(n.length+o.length);s.set(n),s.set(o,n.length),o=s,i.w=n.length}return rke(o,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(o.length)))*1.5):20:12+t.mem,e,r,i)},nke=function(o,t){var e={};for(var r in o)e[r]=o[r];for(var r in t)e[r]=t[r];return e},sNe=function(o,t,e){for(var r=o(),i=o.toString(),n=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),s=0;s<r.length;++s){var a=r[s],l=n[s];if(typeof a=="function"){t+=";"+l+"=";var c=a.toString();if(a.prototype)if(c.indexOf("[native code]")!=-1){var h=c.indexOf(" ",8)+1;t+=c.slice(h,c.indexOf("(",h))}else{t+=c;for(var u in a.prototype)t+=";"+l+".prototype."+u+"="+a.prototype[u].toString()}else t+=c}else e[l]=a}return t},Cee=[],mTt=function(o){var t=[];for(var e in o)o[e].buffer&&t.push((o[e]=new o[e].constructor(o[e])).buffer);return t},gTt=function(o,t,e,r){if(!Cee[e]){for(var i="",n={},s=o.length-1,a=0;a<s;++a)i=sNe(o[a],i,n);Cee[e]={c:sNe(o[s],i,n),e:n}}var l=nke({},Cee[e].e);return pTt(Cee[e].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",e,l,mTt(l),r)},mIe=function(){return[Ac,kb,Jz,yB,bB,Gz,dIe,$7e,Z7e,Q7e,Uz,eke,LI,wee,RI,Lee,PB,PE,ja,cte,ETt,oke,TTt]},yTt=function(){return[Ac,kb,Jz,yB,bB,Gz,Kee,kTe,K7e,yA,J7e,pB,Uz,tke,ox,LI,fE,Qk,Mee,Zee,BTe,eB,pIe,FTe,PB,PE,rke,TB,STt,oke]},bTt=function(){return[gIe,ake]},PTt=function(){return[cke]},oke=function(o){return postMessage(o,[o.buffer])},TTt=function(o){return o&&{out:o.size&&new Ac(o.size),dictionary:o.dictionary}},cx=function(o){return o.ondata=function(t,e){return postMessage([t,e],[t.buffer])},function(t){t.data.length?(o.push(t.data[0],t.data[1]),postMessage([t.data[0].length])):o.flush()}},hte=function(o,t,e,r,i,n,s){var a,l=gTt(o,r,i,function(c,h){c?(l.terminate(),t.ondata.call(t,c)):Array.isArray(h)?h.length==1?(t.queuedSize-=h[0],t.ondrain&&t.ondrain(h[0])):(h[1]&&l.terminate(),t.ondata.call(t,c,h[0],h[1])):s(h)});l.postMessage(e),t.queuedSize=0,t.push=function(c,h){t.ondata||ja(5),a&&t.ondata(ja(4,0,1),null,!!h),t.queuedSize+=c.length,l.postMessage([c,a=h],[c.buffer])},t.terminate=function(){l.terminate()},n&&(t.flush=function(){l.postMessage([])})},oB=function(o,t){return o[t]|o[t+1]<<8},sB=function(o,t){return(o[t]|o[t+1]<<8|o[t+2]<<16|o[t+3]<<24)>>>0},fTe=function(o,t){return sB(o,t)+sB(o,t+4)*4294967296},ld=function(o,t,e){for(;e;++t)o[t]=e,e>>>=8},ske=function(o,t){var e=t.filename;if(o[0]=31,o[1]=139,o[2]=8,o[8]=t.level<2?4:t.level==9?2:0,o[9]=3,t.mtime!=0&&ld(o,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),e){o[3]=8;for(var r=0;r<=e.length;++r)o[r+10]=e.charCodeAt(r)}},gIe=function(o){(o[0]!=31||o[1]!=139||o[2]!=8)&&ja(6,"invalid gzip data");var t=o[3],e=10;t&4&&(e+=(o[10]|o[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!o[e++]);return e+(t&2)},ake=function(o){var t=o.length;return(o[t-4]|o[t-3]<<8|o[t-2]<<16|o[t-1]<<24)>>>0},lke=function(o){return 10+(o.filename?o.filename.length+1:0)},ITt=function(o,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(o[0]=120,o[1]=r<<6|(t.dictionary&&32),o[1]|=31-(o[0]<<8|o[1])%31,t.dictionary){var i=ike();i.p(t.dictionary),ld(o,2,i.d())}},cke=function(o,t){return((o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31)&&ja(6,"invalid zlib data"),(o[1]>>5&1)==+!t&&ja(6,"invalid zlib data: "+(o[1]&32?"need":"unexpected")+" dictionary"),(o[1]>>3&4)+2};function Qz(o,t){return typeof o=="function"&&(t=o,o={}),this.ondata=t,o}var fA=(function(){function o(t,e){if(typeof t=="function"&&(e=t,t={}),this.ondata=e,this.o=t||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new Ac(98304),this.o.dictionary){var r=this.o.dictionary.subarray(-32768);this.b.set(r,32768-r.length),this.s.i=32768-r.length}}return o.prototype.p=function(t,e){this.ondata(TB(t,this.o,0,0,this.s),e)},o.prototype.push=function(t,e){this.ondata||ja(5),this.s.l&&ja(4);var r=t.length+this.s.z;if(r>this.b.length){if(r>2*this.b.length-32768){var i=new Ac(r&-32768);i.set(this.b.subarray(0,this.s.z)),this.b=i}var n=this.b.length-this.s.z;this.b.set(t.subarray(0,n),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(t.subarray(n),32768),this.s.z=t.length-n+32768,this.s.i=32766,this.s.w=32768}else this.b.set(t,this.s.z),this.s.z+=t.length;this.s.l=e&1,(this.s.z>this.s.w+8191||e)&&(this.p(this.b,e||!1),this.s.w=this.s.i,this.s.i-=2)},o.prototype.flush=function(){this.ondata||ja(5),this.s.l&&ja(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},o})(),CTt=(function(){function o(t,e){hte([yTt,function(){return[cx,fA]}],this,Qz.call(this,t,e),function(r){var i=new fA(r.data);onmessage=cx(i)},6,1)}return o})();function STt(o,t){return TB(o,t||{},0,0)}var oT=(function(){function o(t,e){typeof t=="function"&&(e=t,t={}),this.ondata=e;var r=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:r?r.length:0},this.o=new Ac(32768),this.p=new Ac(0),r&&this.o.set(r)}return o.prototype.e=function(t){if(this.ondata||ja(5),this.d&&ja(4),!this.p.length)this.p=t;else if(t.length){var e=new Ac(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length),this.p=e}},o.prototype.c=function(t){this.s.i=+(this.d=t||!1);var e=this.s.b,r=cte(this.p,this.s,this.o);this.ondata(PE(r,e,this.s.b),this.d),this.o=PE(r,this.s.b-32768),this.s.b=this.o.length,this.p=PE(this.p,this.s.p/8|0),this.s.p&=7},o.prototype.push=function(t,e){this.e(t),this.c(e)},o})(),hke=(function(){function o(t,e){hte([mIe,function(){return[cx,oT]}],this,Qz.call(this,t,e),function(r){var i=new oT(r.data);onmessage=cx(i)},7,0)}return o})();function ETt(o,t){return cte(o,{i:2},t&&t.out,t&&t.dictionary)}var XYt=(function(){function o(t,e){this.c=fIe(),this.l=0,this.v=1,fA.call(this,t,e)}return o.prototype.push=function(t,e){this.c.p(t),this.l+=t.length,fA.prototype.push.call(this,t,e)},o.prototype.p=function(t,e){var r=TB(t,this.o,this.v&&lke(this.o),e&&8,this.s);this.v&&(ske(r,this.o),this.v=0),e&&(ld(r,r.length-8,this.c.d()),ld(r,r.length-4,this.l)),this.ondata(r,e)},o.prototype.flush=function(){fA.prototype.flush.call(this)},o})();function mTe(o,t){t||(t={});var e=fIe(),r=o.length;e.p(o);var i=TB(o,t,lke(t),8),n=i.length;return ske(i,t),ld(i,n-8,e.d()),ld(i,n-4,r),i}var VTe=(function(){function o(t,e){this.v=1,this.r=0,oT.call(this,t,e)}return o.prototype.push=function(t,e){if(oT.prototype.e.call(this,t),this.r+=t.length,this.v){var r=this.p.subarray(this.v-1),i=r.length>3?gIe(r):4;if(i>r.length){if(!e)return}else this.v>1&&this.onmember&&this.onmember(this.r-r.length);this.p=r.subarray(i),this.v=0}oT.prototype.c.call(this,e),this.s.f&&!this.s.l&&!e&&(this.v=PB(this.s.p)+9,this.s={i:0},this.o=new Ac(0),this.push(new Ac(0),e))},o})(),OTt=(function(){function o(t,e){var r=this;hte([mIe,bTt,function(){return[cx,oT,VTe]}],this,Qz.call(this,t,e),function(i){var n=new VTe(i.data);n.onmember=function(s){return postMessage(s)},onmessage=cx(n)},9,0,function(i){return r.onmember&&r.onmember(i)})}return o})();function ATt(o,t){var e=gIe(o);return e+8>o.length&&ja(6,"invalid gzip data"),cte(o.subarray(e,-8),{i:2},t&&t.out||new Ac(ake(o)),t&&t.dictionary)}var qYt=(function(){function o(t,e){this.c=ike(),this.v=1,fA.call(this,t,e)}return o.prototype.push=function(t,e){this.c.p(t),fA.prototype.push.call(this,t,e)},o.prototype.p=function(t,e){var r=TB(t,this.o,this.v&&(this.o.dictionary?6:2),e&&4,this.s);this.v&&(ITt(r,this.o),this.v=0),e&&ld(r,r.length-4,this.c.d()),this.ondata(r,e)},o.prototype.flush=function(){fA.prototype.flush.call(this)},o})(),GTe=(function(){function o(t,e){oT.call(this,t,e),this.v=t&&t.dictionary?2:1}return o.prototype.push=function(t,e){if(oT.prototype.e.call(this,t),this.v){if(this.p.length<6&&!e)return;this.p=this.p.subarray(cke(this.p,this.v-1)),this.v=0}e&&(this.p.length<4&&ja(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),oT.prototype.c.call(this,e)},o})(),_Tt=(function(){function o(t,e){hte([mIe,PTt,function(){return[cx,oT,GTe]}],this,Qz.call(this,t,e),function(r){var i=new GTe(r.data);onmessage=cx(i)},11,0)}return o})(),aNe=(function(){function o(t,e){this.o=Qz.call(this,t,e)||{},this.G=VTe,this.I=oT,this.Z=GTe}return o.prototype.i=function(){var t=this;this.s.ondata=function(e,r){t.ondata(e,r)}},o.prototype.push=function(t,e){if(this.ondata||ja(5),this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var r=new Ac(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length)}else this.p=t;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,e),this.p=null)}},o})(),$Yt=(function(){function o(t,e){aNe.call(this,t,e),this.queuedSize=0,this.G=OTt,this.I=hke,this.Z=_Tt}return o.prototype.i=function(){var t=this;this.s.ondata=function(e,r,i){t.ondata(e,r,i)},this.s.ondrain=function(e){t.queuedSize-=e,t.ondrain&&t.ondrain(e)}},o.prototype.push=function(t,e){this.queuedSize+=t.length,aNe.prototype.push.call(this,t,e)},o})();var lNe=typeof TextEncoder<"u"&&new TextEncoder,UTe=typeof TextDecoder<"u"&&new TextDecoder,uke=0;try{UTe.decode(ox,{stream:!0}),uke=1}catch{}var dke=function(o){for(var t="",e=0;;){var r=o[e++],i=(r>127)+(r>223)+(r>239);if(e+i>o.length)return{s:t,r:PE(o,e-1)};i?i==3?(r=((r&15)<<18|(o[e++]&63)<<12|(o[e++]&63)<<6|o[e++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|o[e++]&63):t+=String.fromCharCode((r&15)<<12|(o[e++]&63)<<6|o[e++]&63):t+=String.fromCharCode(r)}},KYt=(function(){function o(t){this.ondata=t,uke?this.t=new TextDecoder:this.p=ox}return o.prototype.push=function(t,e){if(this.ondata||ja(5),e=!!e,this.t){this.ondata(this.t.decode(t,{stream:!0}),e),e&&(this.t.decode().length&&ja(8),this.t=null);return}this.p||ja(4);var r=new Ac(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length);var i=dke(r),n=i.s,s=i.r;e?(s.length&&ja(8),this.p=null):this.p=s,this.ondata(n,e)},o})(),ZYt=(function(){function o(t){this.ondata=t}return o.prototype.push=function(t,e){this.ondata||ja(5),this.d&&ja(4),this.ondata(HTe(t),this.d=e||!1)},o})();function HTe(o,t){if(t){for(var e=new Ac(o.length),r=0;r<o.length;++r)e[r]=o.charCodeAt(r);return e}if(lNe)return lNe.encode(o);for(var i=o.length,n=new Ac(o.length+(o.length>>1)),s=0,a=function(u){n[s++]=u},r=0;r<i;++r){if(s+5>n.length){var l=new Ac(s+8+(i-r<<1));l.set(n),n=l}var c=o.charCodeAt(r);c<128||t?a(c):c<2048?(a(192|c>>6),a(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|o.charCodeAt(++r)&1023,a(240|c>>18),a(128|c>>12&63),a(128|c>>6&63),a(128|c&63)):(a(224|c>>12),a(128|c>>6&63),a(128|c&63))}return PE(n,0,s)}function vTt(o,t){if(t){for(var e="",r=0;r<o.length;r+=16384)e+=String.fromCharCode.apply(null,o.subarray(r,r+16384));return e}else{if(UTe)return UTe.decode(o);var i=dke(o),n=i.s,e=i.r;return e.length&&ja(8),n}}var pke=function(o){return o==1?3:o<6?2:o==9?1:0},xTt=function(o,t){for(;oB(o,t)!=1;t+=4+oB(o,t+2));return[fTe(o,t+12),fTe(o,t+4),fTe(o,t+20)]},Nee=function(o){var t=0;if(o)for(var e in o){var r=o[e].length;r>65535&&ja(9),t+=r+4}return t},cNe=function(o,t,e,r,i,n,s,a){var l=r.length,c=e.extra,h=a&&a.length,u=Nee(c);ld(o,t,s!=null?33639248:67324752),t+=4,s!=null&&(o[t++]=20,o[t++]=e.os),o[t]=20,t+=2,o[t++]=e.flag<<1|(n<0&&8),o[t++]=i&&8,o[t++]=e.compression&255,o[t++]=e.compression>>8;var d=new Date(e.mtime==null?Date.now():e.mtime),p=d.getFullYear()-1980;if((p<0||p>119)&&ja(10),ld(o,t,p<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),t+=4,n!=-1&&(ld(o,t,e.crc),ld(o,t+4,n<0?-n-2:n),ld(o,t+8,e.size)),ld(o,t+12,l),ld(o,t+14,u),t+=16,s!=null&&(ld(o,t,h),ld(o,t+6,e.attrs),ld(o,t+10,s),t+=14),o.set(r,t),t+=l,u)for(var m in c){var g=c[m],y=g.length;ld(o,t,+m),ld(o,t+2,y),o.set(g,t+4),t+=4+y}return h&&(o.set(a,t),t+=h),t},RTt=function(o,t,e,r,i){ld(o,t,101010256),ld(o,t+8,e),ld(o,t+10,e),ld(o,t+12,r),ld(o,t+16,i)},Jee=(function(){function o(t){this.filename=t,this.c=fIe(),this.size=0,this.compression=0}return o.prototype.process=function(t,e){this.ondata(null,t,e)},o.prototype.push=function(t,e){this.ondata||ja(5),this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},o})(),JYt=(function(){function o(t,e){var r=this;e||(e={}),Jee.call(this,t),this.d=new fA(e,function(i,n){r.ondata(null,i,n)}),this.compression=8,this.flag=pke(e.level)}return o.prototype.process=function(t,e){try{this.d.push(t,e)}catch(r){this.ondata(r,null,e)}},o.prototype.push=function(t,e){Jee.prototype.push.call(this,t,e)},o})(),QYt=(function(){function o(t,e){var r=this;e||(e={}),Jee.call(this,t),this.d=new CTt(e,function(i,n,s){r.ondata(i,n,s)}),this.compression=8,this.flag=pke(e.level),this.terminate=this.d.terminate}return o.prototype.process=function(t,e){this.d.push(t,e)},o.prototype.push=function(t,e){Jee.prototype.push.call(this,t,e)},o})(),ejt=(function(){function o(t){this.ondata=t,this.u=[],this.d=1}return o.prototype.add=function(t){var e=this;if(this.ondata||ja(5),this.d&2)this.ondata(ja(4+(this.d&1)*8,0,1),null,!1);else{var r=HTe(t.filename),i=r.length,n=t.comment,s=n&&HTe(n),a=i!=t.filename.length||s&&n.length!=s.length,l=i+Nee(t.extra)+30;i>65535&&this.ondata(ja(11,0,1),null,!1);var c=new Ac(l);cNe(c,0,t,r,a,-1);var h=[c],u=function(){for(var y=0,b=h;y<b.length;y++){var P=b[y];e.ondata(null,P,!1)}h=[]},d=this.d;this.d=0;var p=this.u.length,m=nke(t,{f:r,u:a,o:s,t:function(){t.terminate&&t.terminate()},r:function(){if(u(),d){var y=e.u[p+1];y?y.r():e.d=1}d=1}}),g=0;t.ondata=function(y,b,P){if(y)e.ondata(y,b,P),e.terminate();else if(g+=b.length,h.push(b),P){var T=new Ac(16);ld(T,0,134695760),ld(T,4,t.crc),ld(T,8,g),ld(T,12,t.size),h.push(T),m.c=g,m.b=l+g+16,m.crc=t.crc,m.size=t.size,d&&m.r(),d=1}else d&&u()},this.u.push(m)}},o.prototype.end=function(){var t=this;if(this.d&2){this.ondata(ja(4+(this.d&1)*8,0,1),null,!0);return}this.d?this.e():this.u.push({r:function(){t.d&1&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3},o.prototype.e=function(){for(var t=0,e=0,r=0,i=0,n=this.u;i<n.length;i++){var s=n[i];r+=46+s.f.length+Nee(s.extra)+(s.o?s.o.length:0)}for(var a=new Ac(r+22),l=0,c=this.u;l<c.length;l++){var s=c[l];cNe(a,t,s,s.f,s.u,-s.c-2,e,s.o),t+=46+s.f.length+Nee(s.extra)+(s.o?s.o.length:0),e+=s.b}RTt(a,t,this.u.length,r,e),this.ondata(null,a,!0),this.d=2},o.prototype.terminate=function(){for(var t=0,e=this.u;t<e.length;t++){var r=e[t];r.t()}this.d=2},o})();var DTt=(function(){function o(){}return o.prototype.push=function(t,e){this.ondata(null,t,e)},o.compression=0,o})(),tjt=(function(){function o(){var t=this;this.i=new oT(function(e,r){t.ondata(null,e,r)})}return o.prototype.push=function(t,e){try{this.i.push(t,e)}catch(r){this.ondata(r,null,e)}},o.compression=8,o})(),rjt=(function(){function o(t,e){var r=this;e<32e4?this.i=new oT(function(i,n){r.ondata(null,i,n)}):(this.i=new hke(function(i,n,s){r.ondata(i,n,s)}),this.terminate=this.i.terminate)}return o.prototype.push=function(t,e){this.i.terminate&&(t=PE(t,0)),this.i.push(t,e)},o.compression=8,o})(),ijt=(function(){function o(t){this.onfile=t,this.k=[],this.o={0:DTt},this.p=ox}return o.prototype.push=function(t,e){var r=this;if(this.onfile||ja(5),this.p||ja(4),this.c>0){var i=Math.min(this.c,t.length),n=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(n,!this.c):this.k[0].push(n),t=t.subarray(i),t.length)return this.push(t,e)}else{var s=0,a=0,l=void 0,c=void 0;this.p.length?t.length?(c=new Ac(this.p.length+t.length),c.set(this.p),c.set(t,this.p.length)):c=this.p:c=t;for(var h=c.length,u=this.c,d=u&&this.d,p=function(){var b,P=sB(c,a);if(P==67324752){s=1,l=a,m.d=null,m.c=0;var T=oB(c,a+6),I=oB(c,a+8),C=T&2048,E=T&8,O=oB(c,a+26),_=oB(c,a+28);if(h>a+30+O+_){var R=[];m.k.unshift(R),s=2;var v=sB(c,a+18),D=sB(c,a+22),w=vTt(c.subarray(a+30,a+=30+O),!C);v==4294967295?(b=E?[-2]:xTt(c,a),v=b[0],D=b[1]):E&&(v=-1),a+=_,m.c=v;var F,H={name:w,compression:I,start:function(){if(H.ondata||ja(5),!v)H.ondata(null,ox,!0);else{var z=r.o[I];z||H.ondata(ja(14,"unknown compression type "+I,1),null,!1),F=v<0?new z(w):new z(w,v,D),F.ondata=function(B,N,U){H.ondata(B,N,U)};for(var G=0,W=R;G<W.length;G++){var L=W[G];F.push(L,!1)}r.k[0]==R&&r.c?r.d=F:F.push(ox,!0)}},terminate:function(){F&&F.terminate&&F.terminate()}};v>=0&&(H.size=v,H.originalSize=D),m.onfile(H)}return"break"}else if(u){if(P==134695760)return l=a+=12+(u==-2&&8),s=3,m.c=0,"break";if(P==33639248)return l=a-=4,s=3,m.c=0,"break"}},m=this;a<h-4;++a){var g=p();if(g==="break")break}if(this.p=ox,u<0){var y=s?c.subarray(0,l-12-(u==-2&&8)-(sB(c,l-16)==134695760&&4)):c.subarray(0,a);d?d.push(y,!!s):this.k[+(s==2)].push(y)}if(s&2)return this.push(c.subarray(a),e);this.p=c.subarray(a)}e&&(this.c&&ja(13),this.p=null)},o.prototype.register=function(t){this.o[t.compression]=t},o})(),wTt=(o=>(o[o.UNAUTHORIZED=401]="UNAUTHORIZED",o[o.LOGIN_FAIL=402]="LOGIN_FAIL",o[o.PERMISSION_DENIED=422]="PERMISSION_DENIED",o[o.PERMISSION_DENIED1=1111111]="PERMISSION_DENIED1",o[o.PERMISSION_DENIED_PARAMS=1111112]="PERMISSION_DENIED_PARAMS",o[o.DATA_NOT_FOUND=1111113]="DATA_NOT_FOUND",o[o.PARAMS_DATA_NOT_FOUND=1111114]="PARAMS_DATA_NOT_FOUND",o[o.REQUEST_PARAM_ILLEGAL=42222]="REQUEST_PARAM_ILLEGAL",o[o.REQUEST_PARAM_ILLEGAL1=1111115]="REQUEST_PARAM_ILLEGAL1",o[o.REQUEST_PARAMS_ILLEGAL2=1111116]="REQUEST_PARAMS_ILLEGAL2",o[o.REQUEST_PARAMS_NOT_NULL=1111117]="REQUEST_PARAMS_NOT_NULL",o[o.REQUEST_PARAMS_NOT_ALL_NULL=1111118]="REQUEST_PARAMS_NOT_ALL_NULL",o[o.REQUEST_PARAMS_MUST_ARRAY=1111119]="REQUEST_PARAMS_MUST_ARRAY",o[o.REQUEST_PARAMS_MUST_STRING=1111120]="REQUEST_PARAMS_MUST_STRING",o[o.REQUEST_PARAMS_MUST_NUMBER=1111121]="REQUEST_PARAMS_MUST_NUMBER",o[o.REQUEST_PARAMS_MUST_NUMBER_ARRAY=1111122]="REQUEST_PARAMS_MUST_NUMBER_ARRAY",o[o.REQUEST_PARAMS_MUST_STRING_ARRAY=1111123]="REQUEST_PARAMS_MUST_STRING_ARRAY",o[o.REQUEST_PARAMS_LENGTH_ERROR=1111124]="REQUEST_PARAMS_LENGTH_ERROR",o[o.REQUEST_PARAMS_TYPE_ERROR=1111125]="REQUEST_PARAMS_TYPE_ERROR",o[o.ILLEGAL_NAME=2001]="ILLEGAL_NAME",o[o.ILLEGAL_NAME1=1111126]="ILLEGAL_NAME1",o[o.ILLEGAL_NAME_ZH=1111128]="ILLEGAL_NAME_ZH",o[o.UUID_ERROR=1111127]="UUID_ERROR",o[o.DUPLICATE_DATA=1000001]="DUPLICATE_DATA",o[o.DUPLICATE_DATA1=11e3]="DUPLICATE_DATA1",o[o.DUPLICATE_DATA_PARAMS=1000017]="DUPLICATE_DATA_PARAMS",o[o.UPLOAD_LIMIT=10034]="UPLOAD_LIMIT",o[o.MORE_THAN_LIMIT=1000003]="MORE_THAN_LIMIT",o[o.FILE_MORE_THAN_LIMIT=1000004]="FILE_MORE_THAN_LIMIT",o[o.PARAMS_MORE_THAN_LIMIT=1000005]="PARAMS_MORE_THAN_LIMIT",o[o.IMAGE_MORE_THAN_LIMIT_PARAMS=1000006]="IMAGE_MORE_THAN_LIMIT_PARAMS",o[o.FILE_MORE_THAN_LIMIT_PARAMS=1000007]="FILE_MORE_THAN_LIMIT_PARAMS",o[o.END_MUST_AFTER_START=1000019]="END_MUST_AFTER_START",o[o.REQUEST_PARAMS_TIME_ERROR=1000009]="REQUEST_PARAMS_TIME_ERROR",o[o.FILES_PATH_NOT_FOUND=1000018]="FILES_PATH_NOT_FOUND",o[o.FILES_DATA_NOT_FOUND=1000011]="FILES_DATA_NOT_FOUND",o[o.FILES_TYPE_ERROR=1000012]="FILES_TYPE_ERROR",o[o.FILES_TYPE_MUST_BE_ONE=1000013]="FILES_TYPE_MUST_BE_ONE",o[o.SET_WATERMARK_FAIL=1000014]="SET_WATERMARK_FAIL",o[o.MYSQL_CRUD_ERROR=1000015]="MYSQL_CRUD_ERROR",o[o.PARAMS_JSON_FAILED=1000016]="PARAMS_JSON_FAILED",o[o.MYSQL_ERROR=3000001]="MYSQL_ERROR",o[o.NOT_FOUND=404]="NOT_FOUND",o[o.PRJ_NAME_EXISTS=2002]="PRJ_NAME_EXISTS",o[o.BACKUP_NAME_EXISTS=3002]="BACKUP_NAME_EXISTS",o[o.PRJ_NOT_EXIST=2000001]="PRJ_NOT_EXIST",o[o.ERROR_PATH=4000002]="ERROR_PATH",o[o.PROJECT_NOT_FOUND=6000001]="PROJECT_NOT_FOUND",o[o.TITLE_ILLEGAL_LEN=2003]="TITLE_ILLEGAL_LEN",o[o.FILE_READ_ONLY=1000002]="FILE_READ_ONLY",o[o.FILE_READ_ONLY1=1000008]="FILE_READ_ONLY1",o[o.DATA_NOT_EXIST=1000010]="DATA_NOT_EXIST",o[o.LIB_NOT_EXIST=2000001]="LIB_NOT_EXIST",o[o.CONFIG_API_URLS_ERROR=3001001]="CONFIG_API_URLS_ERROR",o[o.ONE_CLICK_ORDER_NOT_OPEN=3001002]="ONE_CLICK_ORDER_NOT_OPEN",o[o.MATERIAL_NOT_OPEN=3001003]="MATERIAL_NOT_OPEN",o[o.SNAPSHOT_DEPTH_LIMIT=3001004]="SNAPSHOT_DEPTH_LIMIT",o[o.OCR_SYMBOL_URL_ERROR=3001005]="OCR_SYMBOL_URL_ERROR",o[o.USER_DATA_NOT_FOUND=4000001]="USER_DATA_NOT_FOUND",o[o.USER_DISABLE_ERROR=4000012]="USER_DISABLE_ERROR",o[o.USER_EXISTS_LOGIN_ERROR=4000003]="USER_EXISTS_LOGIN_ERROR",o[o.USER_UNAUTHORIZED_MODULES_ERROR=4000004]="USER_UNAUTHORIZED_MODULES_ERROR",o[o.USER_UNAUTHORIZED_ACCESS_ERROR=4000005]="USER_UNAUTHORIZED_ACCESS_ERROR",o[o.ADMIN_NOT_CHANGE_PASSWORD=4000006]="ADMIN_NOT_CHANGE_PASSWORD",o[o.SAME_PASSWORD_NEW_PASSWORD=4000007]="SAME_PASSWORD_NEW_PASSWORD",o[o.USER_ONLINE_REGISTRATION_FAILED=4000008]="USER_ONLINE_REGISTRATION_FAILED",o[o.USER_PASSWORD_CAN_NOT_DEFAULT=4000009]="USER_PASSWORD_CAN_NOT_DEFAULT",o[o.USER_BEFORE_PASSWORD_ERROR=4000010]="USER_BEFORE_PASSWORD_ERROR",o[o.USER_PASSWORD_LENGTH_ERROR=4000011]="USER_PASSWORD_LENGTH_ERROR",o[o.ORG_ROLE_NOT_CREATE=5000001]="ORG_ROLE_NOT_CREATE",o[o.ORG_ROLE_NAME_DUPLICATE=5000002]="ORG_ROLE_NAME_DUPLICATE",o[o.ORG_ROLE_ORIGIN_ERROR=5000003]="ORG_ROLE_ORIGIN_ERROR",o[o.ORG_ROLE_NOT_DEFAULT=5000004]="ORG_ROLE_NOT_DEFAULT",o[o.ADMIN_ROLE_NOT_CHANGE=5000005]="ADMIN_ROLE_NOT_CHANGE",o[o.ADMIN_NOT_CHANGE_STATUS=5000006]="ADMIN_NOT_CHANGE_STATUS",o[o.PROJECT_ARCHIVED=6000002]="PROJECT_ARCHIVED",o[o.PROJECT_UUID_NULL=6000003]="PROJECT_UUID_NULL",o[o.PROJECT_UUID_ERROR=6000004]="PROJECT_UUID_ERROR",o[o.PROJECT_OR_TEAM_UUID_ERROR=6000005]="PROJECT_OR_TEAM_UUID_ERROR",o[o.PROJECT_NOT_PERSON_ERROR=6000006]="PROJECT_NOT_PERSON_ERROR",o[o.PROJECT_DUPLICATE_NAME=6000007]="PROJECT_DUPLICATE_NAME",o[o.ANNOTATION_HAS_BE_FOUND=6000008]="ANNOTATION_HAS_BE_FOUND",o[o.ANNOTATION_NOT_FOUND=6000009]="ANNOTATION_NOT_FOUND",o[o.ANNOTATION_CREATE_ERROR=6000010]="ANNOTATION_CREATE_ERROR",o[o.ANNOTATION_UPDATE_ERROR=6000011]="ANNOTATION_UPDATE_ERROR",o[o.ANNOTATION_DELETE_ERROR=6000012]="ANNOTATION_DELETE_ERROR",o[o.PROJECT_DUPLICATE_PATH=6000013]="PROJECT_DUPLICATE_PATH",o[o.TEAM_NOT_FOUND=7000001]="TEAM_NOT_FOUND",o[o.TEAM_UUID_NULL=7000002]="TEAM_UUID_NULL",o[o.TEAM_FOLDER_ERROR=7000003]="TEAM_FOLDER_ERROR",o[o.TEAM_FOLDER_DEEP_ERROR=7000004]="TEAM_FOLDER_DEEP_ERROR",o[o.TEAM_FOLDER_UUID_ERROR=7000005]="TEAM_FOLDER_UUID_ERROR",o[o.TEAM_URL_DUPLICATE=7000006]="TEAM_URL_DUPLICATE",o[o.TEAM_CAN_NOT_DELETE=7000007]="TEAM_CAN_NOT_DELETE",o[o.COMPONENT_UUID_NULL=8000001]="COMPONENT_UUID_NULL",o[o.COMPONENT_DATA_NOT_FOUND=8000002]="COMPONENT_DATA_NOT_FOUND",o[o.COMPONENT_NAME_DUPLICATE=8000003]="COMPONENT_NAME_DUPLICATE",o[o.COMPONENT_TYPE_ERROR=8000004]="COMPONENT_TYPE_ERROR",o[o.DELETE_SON_CATEGORY=8001001]="DELETE_SON_CATEGORY",o[o.LICENSE=9000001]="LICENSE",o[o.START_TIME=9000002]="START_TIME",o[o.END_TIME=9000003]="END_TIME",o[o.PROJECT_LIMIT=9000004]="PROJECT_LIMIT",o[o.USER_LIMIT=9000005]="USER_LIMIT",o[o.ONLINE_NUMBER_LIMIT=9000006]="ONLINE_NUMBER_LIMIT",o[o.COMPANY_CODE=9000007]="COMPANY_CODE",o[o.LIMIT_PCB=9000008]="LIMIT_PCB",o[o.LIMIT_SCH=9000009]="LIMIT_SCH",o[o.LIMIT_PANEL=9000011]="LIMIT_PANEL",o[o.TIME_ERROR=9000010]="TIME_ERROR",o[o.LICENSE_ERROR=9000012]="LICENSE_ERROR",o[o.LICENSE_TYPE_ERROR=9000013]="LICENSE_TYPE_ERROR",o[o.LICENSE_ORIGIN_ERROR=9000014]="LICENSE_ORIGIN_ERROR",o[o.BRANCH_DATA_NOT_FOUND=11000001]="BRANCH_DATA_NOT_FOUND",o[o.PARENT_UUID_ERROR=11000002]="PARENT_UUID_ERROR",o[o.BRANCH_MUST_AFTER_NODE=11000003]="BRANCH_MUST_AFTER_NODE",o[o.BRANCH_NAME_ERROR=11000004]="BRANCH_NAME_ERROR",o[o.BRANCH_NAME_DUPLICATE=11000005]="BRANCH_NAME_DUPLICATE",o[o.BRANCH_UUID_ERROR=11000006]="BRANCH_UUID_ERROR",o[o.BRANCH_NODE_SET_ERROR=11000007]="BRANCH_NODE_SET_ERROR",o[o.BRANCH_DELETE_MAIN_ERROR=11000008]="BRANCH_DELETE_MAIN_ERROR",o[o.BRANCH_CHECK_OUT_ERROR=11000009]="BRANCH_CHECK_OUT_ERROR",o[o.DOCUMENT_UUID_ERROR=12000001]="DOCUMENT_UUID_ERROR",o[o.UPDATE_FAILED=12000002]="UPDATE_FAILED",o[o.INNER_API_KEY_ERROR=1000020]="INNER_API_KEY_ERROR",o[o.BRANCH_MORE_THAN_LIMIT=11000010]="BRANCH_MORE_THAN_LIMIT",o[o.WORKSPACE_API_ERROR=1000021]="WORKSPACE_API_ERROR",o))(wTt||{}),LTt=(o=>(o[o.DB_INIT_ERROR=0]="DB_INIT_ERROR",o[o.PRJ_NOT_EXIST=1]="PRJ_NOT_EXIST",o[o.NET_ERROR=2]="NET_ERROR",o[o.IS_OPENING=3]="IS_OPENING",o[o.NOT_LOGGED_IN=4]="NOT_LOGGED_IN",o[o.HAS_UNSAVED=5]="HAS_UNSAVED",o[o.DIFF_TICKET=6]="DIFF_TICKET",o))(LTt||{});function mM(o,t={}){if(!o)return"";let{proCode:e,code:r,message:i}=o;switch(e||r){case 401:return ni("UNAUTHORIZED");case 402:return ni("LOGIN_FAIL");case 422:return ni("PERMISSION_DENIED");case 1111111:return ni("PERMISSION_DENIED1");case 2000001:return ni("PRJ_NOT_EXIST");case 4000002:return ni("ERROR_PATH");case 6000001:return ni("PROJECT_NOT_FOUND");case 1111112:return ni("PERMISSION_DENIED_PARAMS",{type:i});case 1111113:return ni("DATA_NOT_FOUND");case 1111114:return ni("PARAMS_DATA_NOT_FOUND",{type:i});case 42222:return ni("REQUEST_PARAM_ILLEGAL");case 1111115:return ni("REQUEST_PARAM_ILLEGAL1");case 1111116:return ni("REQUEST_PARAMS_ILLEGAL2",{type:i});case 1111117:return ni("REQUEST_PARAMS_NOT_NULL",{type:i});case 1111118:return ni("REQUEST_PARAMS_NOT_ALL_NULL",{type:i});case 1111119:return ni("REQUEST_PARAMS_MUST_ARRAY",{type:i});case 1111120:return ni("REQUEST_PARAMS_MUST_STRING",{type:i});case 1111121:return ni("REQUEST_PARAMS_MUST_NUMBER",{type:i});case 1111122:return ni("REQUEST_PARAMS_MUST_NUMBER_ARRAY",{type:i});case 1111123:return ni("REQUEST_PARAMS_MUST_STRING_ARRAY",{type:i});case 1111124:return ni("REQUEST_PARAMS_LENGTH_ERROR",{type:i});case 1111125:return ni("REQUEST_PARAMS_TYPE_ERROR",{type:i});case 2001:return ni("ILLEGAL_NAME");case 1111126:return ni("ILLEGAL_NAME1");case 1111128:return ni("ILLEGAL_NAME_ZH");case 1111127:return ni("UUID_ERROR");case 1000001:return ni("DUPLICATE_DATA");case 11e3:return ni("DUPLICATE_DATA1");case 1000017:return ni("DUPLICATE_DATA_PARAMS",{type:i});case 10034:return ni("UPLOAD_LIMIT");case 1000003:return ni("MORE_THAN_LIMIT");case 1000004:return ni("FILE_MORE_THAN_LIMIT",{type:i});case 1000005:return ni("PARAMS_MORE_THAN_LIMIT",{type:i});case 1000006:return ni("IMAGE_MORE_THAN_LIMIT_PARAMS");case 1000007:return ni("FILE_MORE_THAN_LIMIT_PARAMS");case 1000019:return ni("END_MUST_AFTER_START");case 1000002:return ni("FILE_READ_ONLY");case 1000008:return ni("FILE_READ_ONLY1");case 1000010:return ni("DATA_NOT_EXIST",{documentName:t.documentName});case 1000009:return ni("REQUEST_PARAMS_TIME_ERROR");case 1000018:return ni("FILES_PATH_NOT_FOUND");case 1000011:return ni("FILES_DATA_NOT_FOUND");case 1000012:return ni("FILES_TYPE_ERROR");case 1000013:return ni("FILES_TYPE_MUST_BE_ONE",{type:i});case 1000014:return ni("SET_WATERMARK_FAIL");case 1000015:return ni("MYSQL_CRUD_ERROR",{type:i});case 1000016:return ni("PARAMS_JSON_FAILED",{type:i});case 3000001:return ni("MYSQL_ERROR");case 404:return ni("NOT_FOUND");case 2002:return ni("PRJ_NAME_EXISTS");case 3002:return ni("BACKUP_NAME_EXISTS");case 2003:return ni("TITLE_ILLEGAL_LEN",{documentName:t.documentName});case 2000001:return ni("LIB_NOT_EXIST");case 3001001:return ni("CONFIG_API_URLS_ERROR");case 3001002:return ni("ONE_CLICK_ORDER_NOT_OPEN");case 3001003:return ni("MATERIAL_NOT_OPEN");case 3001004:return ni("SNAPSHOT_DEPTH_LIMIT");case 3001005:return ni("OCR_SYMBOL_URL_ERROR");case 4000001:return ni("USER_DATA_NOT_FOUND");case 4000012:return ni("USER_DISABLE_ERROR");case 4000003:return ni("USER_EXISTS_LOGIN_ERROR");case 4000004:return ni("USER_UNAUTHORIZED_MODULES_ERROR");case 4000005:return ni("USER_UNAUTHORIZED_ACCESS_ERROR");case 4000006:return ni("ADMIN_NOT_CHANGE_PASSWORD");case 4000007:return ni("SAME_PASSWORD_NEW_PASSWORD");case 4000008:return ni("USER_ONLINE_REGISTRATION_FAILED");case 4000009:return ni("USER_PASSWORD_CAN_NOT_DEFAULT");case 4000010:return ni("USER_BEFORE_PASSWORD_ERROR");case 4000011:return ni("USER_PASSWORD_LENGTH_ERROR");case 5000001:return ni("ORG_ROLE_NOT_CREATE");case 5000002:return ni("ORG_ROLE_NAME_DUPLICATE");case 5000003:return ni("ORG_ROLE_ORIGIN_ERROR",{message:i});case 5000004:return ni("ORG_ROLE_NOT_DEFAULT");case 5000005:return ni("ADMIN_ROLE_NOT_CHANGE");case 5000006:return ni("ADMIN_NOT_CHANGE_STATUS");case 6000002:return ni("PROJECT_ARCHIVED");case 6000003:return ni("PROJECT_UUID_NULL");case 6000004:return ni("PROJECT_UUID_ERROR");case 6000005:return ni("PROJECT_OR_TEAM_UUID_ERROR");case 6000006:return ni("PROJECT_NOT_PERSON_ERROR");case 6000007:return ni("PROJECT_DUPLICATE_NAME");case 6000008:return ni("ANNOTATION_HAS_BE_FOUND");case 6000009:return ni("ANNOTATION_NOT_FOUND");case 6000010:return ni("ANNOTATION_CREATE_ERROR");case 6000011:return ni("ANNOTATION_UPDATE_ERROR");case 6000012:return ni("ANNOTATION_DELETE_ERROR");case 6000013:return ni("PROJECT_DUPLICATE_PATH");case 7000001:return ni("TEAM_NOT_FOUND");case 7000002:return ni("TEAM_UUID_NULL");case 7000003:return ni("TEAM_FOLDER_ERROR");case 7000004:return ni("TEAM_FOLDER_DEEP_ERROR");case 7000005:return ni("TEAM_FOLDER_UUID_ERROR");case 7000006:return ni("TEAM_URL_DUPLICATE");case 7000007:return ni("TEAM_CAN_NOT_DELETE");case 8000001:return ni("COMPONENT_UUID_NULL");case 8000002:return ni("COMPONENT_DATA_NOT_FOUND");case 8000003:return ni("COMPONENT_NAME_DUPLICATE");case 8000004:return ni("COMPONENT_TYPE_ERROR");case 8001001:return ni("DELETE_SON_CATEGORY");case 9000001:return ni("LICENSE");case 9000002:return ni("START_TIME");case 9000003:return ni("END_TIME");case 9000004:return ni("PROJECT_LIMIT");case 9000005:return ni("USER_LIMIT");case 9000006:return ni("ONLINE_NUMBER_LIMIT");case 9000007:return ni("COMPANY_CODE");case 9000008:return ni("LIMIT_PCB");case 9000009:return ni("LIMIT_SCH");case 9000011:return ni("LIMIT_PANEL");case 9000010:return ni("TIME_ERROR");case 9000012:return ni("LICENSE_ERROR");case 9000013:return ni("LICENSE_TYPE_ERROR");case 9000014:return ni("LICENSE_ORIGIN_ERROR",{type:i});case 11000001:return ni("BRANCH_DATA_NOT_FOUND");case 11000002:return ni("PARENT_UUID_ERROR");case 11000003:return ni("BRANCH_MUST_AFTER_NODE");case 11000004:return ni("BRANCH_NAME_ERROR");case 11000005:return ni("BRANCH_NAME_DUPLICATE");case 11000006:return ni("BRANCH_UUID_ERROR");case 11000007:return ni("BRANCH_NODE_SET_ERROR");case 11000008:return ni("BRANCH_DELETE_MAIN_ERROR");case 11000009:return ni("BRANCH_CHECK_OUT_ERROR");case 12000001:return ni("DOCUMENT_UUID_ERROR");case 12000002:return ni("UPDATE_FAILED");case 1000020:return ni("INNER_API_KEY_ERROR");case 11000010:return ni("BRANCH_MORE_THAN_LIMIT");case 1000021:return ni("WORKSPACE_API_ERROR")}return i}function ni(o,t){return _7e()==="zh-cn"?PTe.match("codeCN",o,t)||"":PTe.match("codeEN",o,t)||""}function sT(o){return o===422||o===1111111||o===6000002}function MI(o){return o===1000001||o===11e3||o===8000003}var MTt=class{static blobToUint8Array(o){return new Promise((t,e)=>{let r=new FileReader;r.onload=()=>{r.result instanceof ArrayBuffer?t(new Uint8Array(r.result)):e(new Error("FileReader result is not an ArrayBuffer"))},r.onerror=()=>e(r.error),r.readAsArrayBuffer(o)})}static bufferToString(o,t="utf-8"){return new TextDecoder(t).decode(o)}},NTt=(o=>(o.IsActive="/pro-ui/liveness/monitor/isActive",o))(NTt||{});async function kTt(){var o;if(!Yz)return!0;let t=!1,e=$();return typeof window>"u"&&e._TAB_ID_?t=await hIe(`/${e._TAB_ID_}/notify`).rpcCall("/pro-ui/liveness/monitor/isActive"):t=(o=await mn.messageBus.rpcCall("/pro-ui/liveness/monitor/isActive"))==null?void 0:o.message,t?!0:(console.error("[\u7F16\u8F91\u5668\u5904\u4E8E\u5931\u6D3B\u72B6\u6001, \u8BF7\u68B3\u7406\u903B\u8F91, \u4E0D\u8981\u53D1\u9001\u4E0D\u5FC5\u8981\u7684\u8BF7\u6C42!!!]"),!1)}var BTt=(o=>(o.Text="text/plain;charset=UTF-8",o.Json="application/json",o.Form="application/x-www-form-urlencoded;charset=UTF-8",o.FormData="multipart/form-data",o))(BTt||{}),FTt=(o=>(o.ContentType="Content-Type",o.Editorversion="Editor-Version",o))(FTt||{}),VTt=(o=>(o.Json="json",o.Blob="blob",o))(VTt||{});async function Jn(o,t,e={},r={},i=!1){if(!await GTt())throw new Error("\u975E\u6CD5\u8BF7\u6C42!!!");return await UTt(o,t,e,r,i)}async function GTt(){return await kTt()}async function UTt(o,t,e={},r={},i=!1){return new Promise(async(n,s)=>{let a=0,l=3,c=async()=>{try{var h;o=o||"GET",HTt(o,e,r),h=e,r=r;let u=WTt(o,t,h,r);h=u.params,t=u.url;let d=new XMLHttpRequest;r.withCredentials!==void 0&&(d.withCredentials=r.withCredentials),r.responseType!==void 0&&(d.responseType=r.responseType),d.open(o,t,!0),zTt(d,o,r,i),h=await YTt(d,o,t,h,r);let p=!1,m=()=>{if(!p)if(p=!0,d.status===200)try{if(r.responseType==="blob")n(d.response);else{let g=JSON.parse(d.responseText);g.success===!1&&(g.message=mM(g)||g.message),n(g)}}catch(g){console.warn("catch ajax error...",g),n({success:!1,message:"Network Error!"})}else if(d.status===429)if(a<l){let g=d.getResponseHeader("Retry-After"),y=g?parseInt(g)*1e3:6e4;console.warn(`Too Many Requests, retry after ${y/1e3}s...`,d.status),a++,setTimeout(()=>{p=!1,c()},y)}else console.warn("Too Many Requests, max retry exceeded",d.status),n({success:!1,code:d.status,message:"\u8BF7\u6C42\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"});else d.status===404?(console.warn("catch ajax error...",d.status),n({success:!1,code:d.status,message:"Network Error!"})):d.status===500?(console.warn("catch ajax error...",d.status),n({success:!1,code:d.status,message:"Network Error!"})):(console.warn("catch ajax error...",d.status),n({success:!1,code:d.status,message:"Network Error!"}))};if(d.onreadystatechange=function(){d.readyState===4&&m()},d.onerror=function(g){p||(console.warn("catch ajax error...",g),n({success:!1,message:"Network Error!"}))},d.ontimeout=function(){p||(p=!0,console.warn("ajax timeout..."),n({success:!1,message:"\u8BF7\u6C42\u8D85\u65F6"}))},d.onabort=function(){p||(p=!0,console.warn("ajax aborted..."),n({success:!1,message:"\u8BF7\u6C42\u5DF2\u53D6\u6D88"}))},h instanceof Uint8Array){let g=new Blob([h]);d.send(g)}else d.send(h)}catch(u){console.warn("catch ajax error...",u),n({success:!1,message:"Network Error!"})}};await c()})}function HTt(o,t,e={}){var r;if(o.toLowerCase()!=="get"&&!(t instanceof FormData)&&typeof t!="string"&&(e==null?void 0:e.contentType)!==!1&&!((r=e==null?void 0:e.headers)!=null&&r["Content-Type"])&&(e=e||{},e.headers=Object.assign(e.headers||{},{"Content-Type":"application/json"})),e.headers){let i={};for(let n in e.headers){let s=e.headers[n];i[n]=s}e.headers=i}}function hNe(o,t=50){return typeof o!="string"?!1:o.length*2>t*1024*1024}function WTt(o,t,e,r={}){var i;let n,s,a,l=[],c=r.headers,h=!1;if(e instanceof FormData)n=e;else if(typeof e=="string")n=e;else if((i=c==null?void 0:c["Content-Type"])!=null&&i.includes("application/json")){if(typeof e=="object"&&e!==null){for(let p in e)if(hNe(e[p])){h=!0;break}}if(h){let p=new FormData;for(let m in e){let g=e[m];hNe(g)?p.append(m,new Blob([g],{type:"text/plain"})):p.append(m,typeof g=="object"?JSON.stringify(g):g)}n=p,r.headers&&(r.headers["Content-Type"]="multipart/form-data")}else n=JSON.stringify(e)}else{for(s in e)if(a=e[s],a instanceof Array)for(let p=0;p<a.length;p++){let m=a[p];l.push(encodeURIComponent(`${s}[]`)+"="+encodeURIComponent(m))}else if(Object.prototype.toString.call(a)==="[object Object]")for(let p in a){let m=a[p];l.push(encodeURIComponent(`${s}[${p}]`)+"="+(m?encodeURIComponent(m):""))}else l.push(encodeURIComponent(s)+"="+encodeURIComponent(a));n=l.join("&"),o==="GET"&&n&&typeof n=="string"&&r.searchParams===!0&&(t=t+"?"+n,n={})}let u=/{[a-zA-Z]+}/gim,d=[...new Set(t.match(u))];for(let p of d){let m=p.substring(1,p.length-1);t=t.replace(p,e[m]||"")}return{params:n,url:t}}function zTt(o,t,e={},r=!1){let i=e.headers;if(i){for(let n in i){let s=i[n];o.setRequestHeader(encodeURI(n),encodeURI(s))}e.contentType!==!1&&!i["Content-Type"]&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8")}else e.contentType!==!1&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");o.setRequestHeader("Editor-Version",self.PRO_EDITOR_VERSION||"");try{if(!r&&!i.path)throw new Error("Missing path")}catch(n){console.error(n)}if(self.document){let n=t.toUpperCase();if(n!=="GET"&&n!=="HEAD"){let s=/XSRF-TOKEN=(\S+);?/.exec(document.cookie);s&&o.setRequestHeader("X-XSRF-TOKEN",decodeURIComponent(s[1]))}}}var gTe=1e4;async function YTt(o,t,e,r,i={}){if(t.match(/post/i)&&e.startsWith("/")&&!e.startsWith("/servicecenter/")&&typeof r=="string"&&r.length>=gTe&&(r=mTe(new TextEncoder().encode(r),{level:1}),o.setRequestHeader("Content-Encoding","gzip")),t.match(/post/i)&&e.startsWith("/")&&!e.startsWith("/servicecenter/")&&r instanceof FormData&&i.gzipFormData===!0){let n=new Set;r.forEach((s,a)=>{n.add(a)});for(let s of n){let a=r.get(s);if(typeof a=="string"&&a.length>=gTe){let l=new Blob([mTe(new TextEncoder().encode(a),{level:1})]);r.set(s,l)}else if(a instanceof Blob&&a.size>=gTe){let l=new Blob([mTe(await MTt.blobToUint8Array(a),{level:9})]);r.set(s,l,a.name)}}o.setRequestHeader("Content-Encoding","gzip")}return r}async function fke(o,t,e,r){if(!r||!e){let s=`invalid parameters ${r}|${e}.`;return{code:Ai.ERR_CODE.NORMAL,success:!1,msg:s,message:s,result:null}}let i=await Jn("POST",t?eh(qn.DEVICE.DELETE,{uuid:r}):eh(qn.COMPONENT.DELETE,{uuid:r}),{},{headers:{"Content-Type":"application/json",path:e}});if(i.code===0&&i.success)return{code:0,success:!0,msg:"",message:"",result:{componentId:r}};let n=i.message||i.msg||"Request Error.";return{...i,msg:n,message:n,result:{componentId:r}}}async function jTt(o,t,e){if(o){let h="operations not currently supported.";return{code:Ai.ERR_CODE.NORMAL,success:!1,msg:h,message:h,result:null}}let r={code:0,success:!0,result:{devices:{succeed:[],failed:[]},symbols:{succeed:[],failed:[]},footprints:{succeed:[],failed:[]},d3models:{succeed:[],failed:[]},cbbs:{succeed:[],failed:[]},panels:{succeed:[],failed:[]}},msg:"",message:""},i=await qk(o,!0,t,e.devices||[]);r.result.devices={...i.result};let n=await qk(o,!1,t,e.symbols||[]);r.result.symbols={...n.result};let s=await qk(o,!1,t,e.footprints||[]);r.result.footprints={...s.result};let a=await qk(o,!1,t,e.d3models||[]);r.result.d3models={...a.result};let l=await qk(o,!1,t,e.cbbs||[]);r.result.cbbs={...l.result};let c=await qk(o,!1,t,e.panels||[]);return r.result.panels={...c.result},r}async function qk(o,t,e,r){let i=[],n=[];for(let s=0;s<r.length;s++){let a=await fke(o,t,e,r[s]);if(a.code===0&&a.success){i.push(r[s]);continue}i.push(r[s])}return{code:0,success:!0,result:{succeed:i,failed:n},msg:"",message:""}}function mke(o){if(!o)return[];if(o instanceof Array)return o;let t=[];return o!=null&&o.parent_tag&&o!=null&&o.parent_tag.uuid&&t.push(o==null?void 0:o.parent_tag.uuid),o!=null&&o.child_tag&&o!=null&&o.child_tag.uuid&&t.push(o==null?void 0:o.child_tag.uuid),t}function px(o){if(!o)return[];if(o instanceof Array)return o;let t=[];return o!=null&&o.parent_tag&&o!=null&&o.parent_tag.name&&t.push(o==null?void 0:o.parent_tag.name),o!=null&&o.child_tag&&o!=null&&o.child_tag.name&&t.push(o==null?void 0:o.child_tag.name),t}function eY(o,t=!1){return o?t?uNe(o):o.indexOf("@")>=0?XTt(o):o.indexOf("_")>=0?qTt(o):uNe(o):{componentTitleOrId:void 0,path:void 0,isLocaleFilenameMode:!1}}function uNe(o){let t={componentTitleOrId:void 0,path:void 0,isLocaleFilenameMode:!1};if(!/\|/i.test(o))return t.isLocaleFilenameMode=!1,t.componentTitleOrId=o,t;let e=o.split("|");return t.componentTitleOrId=e[0],t.path=e[1],/\./.test(e[0])?(t.isLocaleFilenameMode=!0,t):(t.isLocaleFilenameMode=!1,t)}function XTt(o){let t={componentTitleOrId:void 0,path:void 0,isLocaleFilenameMode:!1};if(!/\@/i.test(o))return t.isLocaleFilenameMode=!1,t.componentTitleOrId=o,t;let e=o.split("@");return t.componentTitleOrId=e[0],t.path=e[1],/\./.test(e[0])?(t.isLocaleFilenameMode=!0,t):(t.isLocaleFilenameMode=!1,t)}function qTt(o){let t={componentTitleOrId:void 0,path:void 0,isLocaleFilenameMode:!1};if(!/_/i.test(o))return t.isLocaleFilenameMode=!1,t.componentTitleOrId=o,t;let e=o.split("_");return t.componentTitleOrId=e[0],t.path=e[1],/\./.test(e[0])?(t.isLocaleFilenameMode=!0,t):(t.isLocaleFilenameMode=!1,t)}async function yIe(o,t){let e=eY(o,!0),r=e.path||t,i={code:Ai.ERR_CODE.NORMAL,success:!0,result:null,msg:""};return i.result={createTime:0,created_at:"",creator:null,dataStr:JSON.stringify({model:`${e.componentTitleOrId}|${r}`,unit:"mm"}),display_title:e.componentTitleOrId||"-",uuid:`${e.componentTitleOrId}|${r}`||"",path:r,description:"",docType:16,modifier:null,owner:null,source:"",tags:{child_tag:[],parent_tag:[]},title:e.componentTitleOrId||"",updateTime:0,updated_at:"",version:"",public:void 0},i}var $Tt=class{constructor(){if(!crypto||!crypto.subtle)throw new Error("\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301crypto api");this.tool=crypto.subtle}},KTt=class extends $Tt{constructor(){super(),this.keyBuffer=null,this.key=null,this.iv=null}async init(o){try{return this.keyBuffer=o.key,this.key=await this.setKey(this.keyBuffer),this.iv=await this.setIV(o.iv),this}catch{throw new Error(`invalid key or iv! ${o}`)}}setKey(o){if(o instanceof ArrayBuffer)return this.tool.importKey("raw",o,"AES-GCM",!0,["encrypt","decrypt"]);throw new Error(`invalid key! ${o}`)}setIV(o){if(o instanceof ArrayBuffer)return o;throw new Error(`invalid iv! ${o}`)}encrypt(o){return this.tool.encrypt({name:"AES-GCM",iv:this.iv},this.key,o)}decrypt(o){return this.tool.decrypt({name:"AES-GCM",iv:this.iv},this.key,o)}decrypt2(o){return this.tool.decrypt({name:"AES-GCM",iv:this.iv,tagLength:128},this.key,o)}getKey(){return this.keyBuffer}getIV(){return this.iv}};function dNe(o){let t=o.match(/[\da-f]{2}/gi);return t?new Uint8Array(t.map(function(e){return parseInt(e,16)})).buffer:null}function ZTt(o,t="utf-8"){var e=new TextDecoder(t);return e.decode(o)}async function tY(o){try{if(o.dataStrId){let t=new Headers;t.append("Content-Type","text/plain;charset=UTF-8");let e=await(await fetch(o.dataStrId,{method:"GET",redirect:"error",headers:t})).arrayBuffer();if(e){let r=await JTt(o,e);return ZTt(r)}}else if(o.dataStr)return o.dataStr;return null}catch(t){throw new Error("fetch\u5931\u8D25!!!"+t)}}async function JTt(o,t){let e=new KTt;try{let{key:r,iv:i}=o;if(t&&i&&r){let n=dNe(r),s=dNe(i);await e.init({key:n,iv:s});let a=await e.decrypt(t);return ATt(new Uint8Array(a))}else throw new Error(`\u6570\u636E\u89E3\u5BC6\u5931\u8D25!!!\u6570\u636E\u4E0D\u6B63\u786E:data:${t},key:${r},iv:${i}`)}catch(r){throw new Error("\u6570\u636E\u89E3\u5BC6\u5931\u8D25!!!"+r)}}var gke=(o=>(o.LIST="/api/projects",o.CBB_LIST="/api/cbbProject",o.CREATE="/api/v4/projects/add",o.GET="/api/v4/projects/{uuid}",o.UPDATE="/api/projects/{uuid}/update",o.DELETE="/api/v4/projects/{uuid}/delete",o.TICKET="/api/projects/{uuid}/ticket",o.BACKUP_LIST="/api/backups",o.BACKUP="/api/backups",o.OPERATE_BACKUP="/api/backups/{uuid}",o.ARCHIVE="/api/backups/archive",o.CREATE_BOARD="/api/projects/{uuid}/boards",o.STAR="/api/projects/{uuid}/star",o.UNSTAR="/api/projects/{uuid}/unstar",o.CREATE_DRAFT="/api/v4/projects/{project_uuid}/draft-history",o.UPLOAD_DRAFT="/api/v4/projects/{project_uuid}/draft-history/{draft_uuid}",o.STRUCTURE="/api/v4/projects/{project_uuid}/branches/{branch_uuid}/structures",o.UPDATE_IMAGES="/api/v4/projects/{projectUuid}/branches/{branchUuid}/thumbs",o.DELETE_IMAGES="/api/v4/projects/{projectUuid}/branches/{branchUuid}/thumbs/{thumbUuid}",o.GET_IMAGES="/api/v4/projects/{projectUuid}/branches/{branchUuid}/thumbs",o))(gke||{}),yke=(o=>(o.CREATE="/api/v4/projects/{project_uuid}/branches",o.LIST="/api/v4/projects/{project_uuid}/branches",o.GET="/api/v4/projects/{project_uuid}/branches/{branch_uuid}",o.UPDATE="/api/v4/projects/{project_uuid}/branches/{branch_uuid}",o.DELETE="/api/v4/projects/{project_uuid}/branches/{branch_uuid}",o))(yke||{}),bke=(o=>(o.APPLY="/api/v4/snapshots/apply",o.CREATE="/api/v4/snapshots/create",o.GET="/api/v4/projects/branches/histories?path={path}&project={project}&branch={branch}&history={history}&limit={limit}",o.UPLOAD="/api/v4/snapshots/upload-signatures",o.CONFIRM="/api/v4/snapshots/upload-confirm",o))(bke||{}),Pke=(o=>(o.SET="/api/v4/projects/{project_uuid}/branches/{branch_uuid}/histories",o.GET="/api/v4/projects/{project_uuid}/branches/{branch_uuid}/histories/{history_uuid}",o))(Pke||{}),Tke=(o=>(o.SET="/api/v4/components/{uuid}/histories",o.GET="/api/v4/components/{uuid}/histories/{historyUuid}",o))(Tke||{}),Ike=(o=>(o.LIST="/api/schematic/lists",o.CREATE="/api/schematic/create",o.UPLOAD="/api/schematic/upload",o.DELETE="/api/schematic/{uuid}/delete",o.UPDATE="/api/schematic/{uuid}/update",o.UPDATE_SORT="/api/schematic/{uuid}/update_sort",o.UPDATE_SORT1="/api/v2/documents/updateSorts",o))(Ike||{}),Cke=(o=>(o.LIST="/api/v2/documents/lists",o.CREATE="/api/v2/documents/create",o.UPLOAD="/api/v2/documents/upload",o.UPDATE="/api/v2/documents/{uuid}/update",o.UPDATE_CANVAS="/api/v2/documents/{uuid}/update_canvas",o.BATCH_UPDATE="/api/v2/documents/updateMany",o.DELETE="/api/v2/documents/{uuid}/delete",o.GET="/api/v2/documents/{uuid}",o.GET_BY_TITLE="/api/v2/documents/searchByName",o.GET_BY_SID="/api/v2/schematic/{schematicUuid}/documents",o.MOVE="/api/v2/documents/{uuid}/sort",o.CHECK_IN="/api/v4/documents/checkin/{project}/{branch}",o.CHECK_OUT="/api/v4/documents/checkout/{project}/{branch}",o.GET_CHECK="/api/v4/documents/checkout/{project}/{branch}",o.DELETE_PCB_RELATED="/api/v2/deleteCopperFontComponents",o))(Cke||{}),Ske=(o=>(o.LIST="/api/v2/devices",o.SEARCH_LIST="/api/devices/search",o.CREATE="/api/devices",o.UPLOAD="/api/devices/upload",o.UPDATE="/api/devices/{uuid}",o.BATCH_UPDATE="/api/devices/updateMany",o.GET="/api/v2/devices/{uuid}",o.GET_ATTR_VALUE="/api/devices/attributes",o.GET_ATTR_KEYS="/api/devices/attributeKeys",o.GET_BY_USER_AND_TITLE="/api/v2/devices/searchByUserUuidAndTitle",o.BATCH_GET="/api/devices/searchByIds",o.DELETE="/api/v4/devices/{uuid}/delete",o.STAR="/api/devices/{uuid}/star",o.UNSTAR="/api/devices/{uuid}/unstar",o.PLACE="/api/v2/upload",o))(Ske||{}),Eke=(o=>(o.LIST="/api/v2/components",o.SEARCH_LIST="/api/v2/components/search",o.CREATE="/api/v2/components/add",o.UPLOAD="/api/v2/components/upload",o.UPDATE="/api/v2/components/{uuid}/update",o.UPDATE_CANVAS="/api/v2/components/{uuid}/update_canvas",o.BATCH_UPDATE="/api/v2/components/updateMany",o.DELETE="/api/v4/components/{uuid}/delete",o.GET="/api/v2/components/{uuid}",o.GET_BY_TITLE="/api/v2/searchByTitles",o.GET_BY_DOC_UUID="/api/v2/components/searchByPcbId",o.GET_BY_USER_AND_TITLE="/api/v2/components/searchByUserUuidAndTitle",o.GET_BY_C="/api/searchProductByCode",o.BATCH_GET="/api/v2/components/searchByIds",o.STAR="/api/v2/components/{uuid}/star",o.UNSTAR="/api/v2/components/{uuid}/unstar",o.UPLOAD_3DMODEL="/api/3dmodel/upload",o))(Eke||{}),Oke=(o=>(o.LIST="/api/categories",o.CREATE="/api/categories",o.DELETE="/api/categories/{uuid}/delete",o.UPDATE="/api/categories/{uuid}",o.DEVICE_CATE="/api/open/deviceCate",o))(Oke||{}),Ake=(o=>(o.SEARCH_LIST="/api/coppers/search",o.SEARCH_BY_PCB_UUID="/api/coppers/searchByPcbId",o.SET="/api/coppers/upload",o.DELETE="/api/coppers/delete",o))(Ake||{}),_ke=(o=>(o.SEARCH_LIST="/api/textpath/search",o.SEARCH_BY_PCB_UUID="/api/textpath/searchByPcbId",o.SET="/api/textpath/upload",o.DELETE="/api/textpath/delete",o))(_ke||{}),vke=(o=>(o.SEARCH_LIST="/api/v2/resources/search",o.SET="/api/v2/resources/upload",o))(vke||{}),xke=(o=>(o.LIST="/api/projects/projectUuid/attributes",o.SEARCH_LIST="/api/block_symbol_attributes/search",o.CREATE="/api/block_symbol_attributes",o.UPLOAD="/api/block_symbol_attributes/upload",o.DELETE="/api/block_symbol_attributes/delete",o.TICKET="/api/block_symbol_attributes/tickets",o))(xke||{}),Rke=(o=>(o.GET_BACKUP="/api/backups/{name}",o.GET_COMPONENT="/api/v2/components/clientSearch",o.GET_DEVICE="/api/devices/clientSearch",o.GET_LIBS="/api/client/libraryPaths",o.CREATE_LIB="/api/client/createPath",o.CREATE_PROJECT="/api/client/createProject",o.OPEN_PROJECT="/api/client/openProject",o.CLOSE_PROJECT="/api/client/closeProject",o.COPY_PROJECT="/api/client/copyProject",o.DELETE_PROJECT="/api/client/deleteProject",o.GET_PROJECT_PATHS="/api/client/projectPaths",o.SELECT_PATH_ON_OFFLINE="/api/fileDialog/saveFile",o.SELECT_PATH_ON_LINE="app://api/fileDialog/saveFile",o.OPEN_DIALOG="/api/fileDialog/openPath",o.SELECT_DIR_ON_OFFLINE="/api/fileDialog/dirtory",o.SELECT_DIR_ON_LINE="app://api/client/openDir",o.SELECT_FILE="/api/fileDialog/file",o.EXPORT_FILE_ON_OFFLINE="/api/client/uploadFile",o.EXPORT_FILE_ON_LINE="app://api/client/uploadFile",o.GET_PRJ_CACHE_LIST="/api/client/tmpBackupList",o.OPERATE_PRJ_CACHE="/api/client/tmpBackup",o.CREATE_PRJ_CACHE_ONLINE="/api/client/tmpBackup/create",o.DELETE_PRJ_CACHE_ONLINE="/api/client/tmpBackup/delete",o.GET_RECENT_PROJECT="/api/client/projectHistory",o.DELETE_RECENT_PROJECT="/api/client/projectHistory/delete",o.SET_KV_CACHE="/api/client/setEditorCache",o.GET_KV_CACHE="/api/client/getEditorCache",o.IS_EXIST_KV_CACHE="/api/client/existEditorCache",o.SEARCH_SCHEMATIC_BY_NAME="/api/schematic/searchByName",o.OPEN_URL="app://api/system/openURL",o.FIND_3DMODEL="/api/client/model/find",o))(Rke||{}),Dke=(o=>(o.LOG="/api/v3/editor_log/upload",o.COMPONENT_LOG="/api/v4/componentLogs",o.TEAMS="/api/teams",o.GET_EDITOR_VERSION="/api/editor/version",o.SET_EDITOR_VERSION="/api/editor/changeVersion",o.ONLINE="/api/userStatistics/registerOnline",o))(Dke||{}),qn={PROJECT:gke,BRANCH:yke,SNAPSHOT:bke,PROJECT_HISTORY:Pke,COMPONENT_HISTORY:Tke,SCHEMATIC:Ike,DOCUMENT:Cke,DEVICE:Ske,COMPONENT:Eke,TAG:Oke,COPPER:Ake,FONT:_ke,BLOB:vke,ATTR:xke,CLIENT:Rke,OTHER:Dke};function hx(o=new Date,t="yyyy-MM-dd HH:ii:ss"){if(Number.isNaN(o.getTime()))return"-";let e={"M+":o.getMonth()+1,"d+":o.getDate(),"H+":o.getHours(),"h+":o.getHours(),"i+":o.getMinutes(),"s+":o.getSeconds(),"q+":Math.floor((o.getMonth()+3)/3),S:o.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(o.getFullYear()+"").substr(4-RegExp.$1.length)));for(let r in e)new RegExp("("+r+")").test(t)&&(t=t.replace(RegExp.$1,RegExp.$1.length==1?e[r]:("00"+e[r]).substr((""+e[r]).length)));return t}function QTt(o,t){function e(h){return h>=10?String(h):"0"+h}o instanceof Date?o.getTime().toString().length>13&&(o=new Date(o.getTime()/1e3)):Number.isNaN(Number(o))||o.toString().length>13&&(o=new Date(Number(o)/1e3));let r=new Date(o);if(Number.isNaN(r.getTime()))return"-";let i=r.getFullYear(),n=e(r.getMonth()+1),s=e(r.getDate()),a=e(r.getHours()),l=e(r.getMinutes()),c=e(r.getSeconds());return t==="downProject"?i+"-"+n+"-"+s:t==="migrateStandardProject"?i+"-"+n+"-"+s+"_"+a+"-"+l+"-"+c:t==="y-m-d"||t==="yyyy-MM-dd"?i+"-"+n+"-"+s:t==="y-m-d_h-m-s"?`${i}-${n}-${s}_${a}-${l}-${c}`:i+"-"+n+"-"+s+" "+a+":"+l+":"+c}function bIe(o,t,e){let r=new Date().getTime(),i=hx(new Date(r)),n={avatar:"",nickname:"",username:"",uuid:""},s=o+(e?`|${e}`:"");return{createTime:r,created_at:i,creator:{...n},dataStr:JSON.stringify({model:s,unit:"mm"}),description:"",display_title:t,docType:16,modifier:{...n},owner:{...n},path:e,public:!1,source:"",std_uuid:"",tags:{child_tag:[],parent_tag:[]},ticket:0,title:t,type:0,updateTime:r,updated_at:i,uuid:o,version:""}}async function wke(o){return o?new Promise((t,e)=>{window.fetch(`https://modules.lceda.cn/3dmodel/${o}`,{method:"GET"}).then(async r=>{let i=await r.blob();t({code:0,success:!0,result:i,message:""})}).catch(async r=>{t({code:r?r.code:-9,success:!1,result:null,message:"fetch 3D model file failed."})})}):{code:-1,success:!1,result:null,message:"missing uuid or path or detail data."}}async function rY(o,t=Ai.SYSTEMLIB_UUID,e){if(!o)return null;let r=null,i=eY(o,!0),n=i.path||t;if(i.isLocaleFilenameMode)return r=(await yIe(i.componentTitleOrId,n)).result,r;let s=await Jn("GET",eh(qn.COMPONENT.GET,{uuid:i.componentTitleOrId}),{},{headers:{"Content-Type":"application/json",path:n||void 0}});if(s.code===0&&s.success&&typeof s.result=="object"&&(r=s.result),r&&!r.dataStr)try{let a=await tY(r);r.dataStr=a}catch(a){console.error(a)}if(!r&&o&&e){let a=await wke(o);a.success&&a.result instanceof Blob&&(r=bIe(o,e,n))}return r}var eIt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree,this.getFile=o.getDetail}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n,totalPage:s}=t;return{count:e,page:r,pageSize:i,totalPage:s,lists:n.map(a=>this.extendLib.transformer.transformCbbListItem(a))}}async getTransformedDetail(o){return await this.getDetail(o)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},tIt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getSupportedSymbolTypes=o.getSupportedSymbolTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n,totalPage:s}=t;for(let a of n)await this.setItem3DModelTitle(a);return{count:e,page:r,pageSize:i,totalPage:s,lists:n.map(a=>this.extendLib.transformer.transformDeviceListItem(a))}}async setItem3DModelTitle(o){var t,e;let r=(t=o.attributes)==null?void 0:t["3D Model"];if(o.attributes&&r&&!((e=o.attributes)!=null&&e["3D Model Title"])){let[i,n=this.extendLib.id]=r.split("|")||[],s=await iu.getD3Model({uuid:i,path:n,isProject:!1});o.attributes["3D Model Title"]=s.title||s.display_title,o.attributes["3D Model"]=r.includes("|")?r:[i,n].join("|")}}async getTransformedDetail(o,t){let e=await this.getDetail(o,t);return await this.setItem3DModelTitle(e),this.extendLib.transformer.transformDeviceListItem(e)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},rIt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n=[],totalPage:s}=t,a=[];for(let l of n)a.push(await this.extendLib.transformer.transformFootprintListItem(l));return{count:e,page:r,pageSize:i,totalPage:s,lists:a}}async getTransformedDetail(o,t){let e=await this.getDetail(o,t);return await this.extendLib.transformer.transformFootprintListItem(e)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},iIt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n=[],totalPage:s}=t,a=[];for(let l of n)a.push(await this.extendLib.transformer.transformModel3DListItem(l));return{count:e,page:r,pageSize:i,totalPage:s,lists:a}}async getTransformedDetail(o,t){let e=await this.getDetail(o,t);return await this.extendLib.transformer.transformModel3DListItem(e)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},nIt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n=[],totalPage:s}=t,a=[];for(let l of n)a.push(await this.extendLib.transformer.transformPanelLibListItem(l));return{count:e,page:r,pageSize:i,totalPage:s,lists:a}}async getTransformedDetail(o,t){let e=await this.getDetail(o,t);return await this.extendLib.transformer.transformPanelLibListItem(e)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},oIt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n=[],totalPage:s}=t,a=[];for(let l of n)a.push(await this.extendLib.transformer.transformSimModelListItem(l));return{count:e,page:r,pageSize:i,totalPage:s,lists:a}}async getTransformedDetail(o,t){let e=await this.getDetail(o,t);return await this.extendLib.transformer.transformSimModelListItem(e)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},sIt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getSupportedSymbolTypes=o.getSupportedSymbolTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n,totalPage:s}=t,a=[];for(let l of n)a.push(await this.extendLib.transformer.transformSymbolListItem(l));return{count:e,page:r,pageSize:i,totalPage:s,lists:a}}async getTransformedDetail(o,t){let e=await this.getDetail(o,t);return await this.extendLib.transformer.transformSymbolListItem(e)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},aIt=class{constructor(o){this.extendLib=o}transformTime(o=Date.now()){return o.toString().length>13?o/1e3:o}transformTimeStr(o=Date.now()){let t=this.transformTime(o);return hx(new Date(t*1e3))}transformTags(o){let{primaryClassificationName:t,primaryClassificationUuid:e,secondaryClassificationName:r,secondaryClassificationUuid:i}=o||{};return{parent_tag:t?{uuid:e,name:t}:void 0,child_tag:r?{uuid:i,name:r}:void 0}}transformCategory(o,t){var e,r;let i=(e=o.uuid)!=null?e:crypto.randomUUID();return{id:i,title:o.name,titleAdditional:o.name_cn,children:(r=o.children)==null?void 0:r.map(n=>this.transformCategory(n,i)),parentId:t}}transformDeviceListItem(o){var t,e,r,i,n,s,a,l,c,h;return o.edaFormatedData?o.edaFormatedData:{title:o.name||"",description:o.description||"",images:[],uuid:o.uuid||this.extendLib.getDefaultItemId(),path:this.extendLib.id,source:"",version:"",ticket:0,updateTime:this.transformTime(o.updateTime),createTime:this.transformTime(o.createTime||o.updateTime),display_title:o.name||"",creator:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},attributes:{...(t=o.attributes)!=null?t:{},Footprint:((e=o.footprint)==null?void 0:e.uuid)||"",Symbol:((r=o.symbol)==null?void 0:r.uuid)||"",Value:o.value||((i=o.attributes)==null?void 0:i.value)||"","Supplier Part":o.supplierPart||((n=o.attributes)==null?void 0:n.supplierPart)||"",Manufacturer:o.manufacturer||((s=o.attributes)==null?void 0:s.manufacturer)||"",Description:o.description||((a=o.attributes)==null?void 0:a.description)||""},symbol:o.symbol?{display_title:o.symbol.name||"",title:((l=o.symbol.name)==null?void 0:l.toLocaleLowerCase())||"",docType:+o.symbol.symbolType,path:this.extendLib.id,uuid:o.symbol.uuid,description:void 0,version:void 0,ticket:void 0,updateTime:void 0,createTime:void 0,creator:void 0,modifier:void 0,owner:void 0,tags:void 0,source:void 0,has_device:void 0,dataStr:void 0,dataStrId:void 0}:void 0,footprint:o.footprint?{display_title:o.footprint.name||"",title:((c=o.footprint.name)==null?void 0:c.toLocaleLowerCase())||"",docType:4,path:this.extendLib.id,uuid:o.footprint.uuid,description:void 0,version:void 0,ticket:void 0,updateTime:void 0,createTime:void 0,creator:void 0,modifier:void 0,owner:void 0,tags:void 0,source:void 0,has_device:void 0,dataStr:void 0,dataStrId:void 0}:void 0,tags:this.transformTags(o.classification),symbol_type:(h=o.symbol)==null?void 0:h.symbolType}}async transformSymbolListItem(o){var t,e,r,i,n,s,a,l,c,h;return o.edaFormatedData?o.edaFormatedData:{docType:o.symbolType,uuid:o.uuid||this.extendLib.getDefaultItemId(),title:o.name||"",description:o.description||"",path:this.extendLib.id,source:"",version:(t=o.version)!=null?t:"",ticket:0,updateTime:this.transformTime(o.updateTime),createTime:this.transformTime(o.createTime||o.updateTime),display_title:o.name||"",creator:o.creator?{nickname:(e=o.creator.name)!=null?e:"",username:(r=o.creator.name)!=null?r:"",uuid:(i=o.creator.uuid)!=null?i:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:o.modifier?{nickname:(n=o.modifier.name)!=null?n:"",username:(s=o.modifier.name)!=null?s:"",uuid:(a=o.modifier.uuid)!=null?a:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:o.owner?{nickname:(l=o.owner.name)!=null?l:"",username:(c=o.owner.name)!=null?c:"",uuid:(h=o.owner.uuid)!=null?h:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},dataStr:o.data instanceof Blob?await o.data.text():o.data,tags:this.transformTags(o.classification)}}async transformFootprintListItem(o){var t,e,r,i,n,s,a,l,c,h;return o.edaFormatedData?o.edaFormatedData:{docType:4,uuid:o.uuid||this.extendLib.getDefaultItemId(),title:o.name||"",description:o.description||"",path:this.extendLib.id,source:"",version:(t=o.version)!=null?t:"",ticket:0,updateTime:this.transformTime(o.updateTime),createTime:this.transformTime(o.createTime||o.updateTime),display_title:o.name||"",creator:o.creator?{nickname:(e=o.creator.name)!=null?e:"",username:(r=o.creator.name)!=null?r:"",uuid:(i=o.creator.uuid)!=null?i:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:o.modifier?{nickname:(n=o.modifier.name)!=null?n:"",username:(s=o.modifier.name)!=null?s:"",uuid:(a=o.modifier.uuid)!=null?a:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:o.owner?{nickname:(l=o.owner.name)!=null?l:"",username:(c=o.owner.name)!=null?c:"",uuid:(h=o.owner.uuid)!=null?h:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},dataStr:o.data instanceof Blob?await o.data.text():o.data,tags:this.transformTags(o.classification)}}async transformPanelLibListItem(o){var t,e,r,i,n,s,a,l,c;return o.edaFormatedData?o.edaFormatedData:{...o.edaFormatedData,docType:29,uuid:o.uuid||this.extendLib.getDefaultItemId(),title:o.name||"",description:o.description||"",path:this.extendLib.id,ticket:0,updateTime:this.transformTime(o.updateTime),createTime:this.transformTime(o.createTime||o.updateTime),display_title:o.name||"",creator:o.creator?{nickname:(t=o.creator.name)!=null?t:"",username:(e=o.creator.name)!=null?e:"",uuid:(r=o.creator.uuid)!=null?r:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:o.modifier?{nickname:(i=o.modifier.name)!=null?i:"",username:(n=o.modifier.name)!=null?n:"",uuid:(s=o.modifier.uuid)!=null?s:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:o.owner?{nickname:(a=o.owner.name)!=null?a:"",username:(l=o.owner.name)!=null?l:"",uuid:(c=o.owner.uuid)!=null?c:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},tags:this.transformTags(o.classification)}}async transformModel3DListItem(o){var t,e,r,i,n,s,a,l,c;return o.edaFormatedData?o.edaFormatedData:{...o.edaFormatedData,uuid:o.uuid||this.extendLib.getDefaultItemId(),title:o.name||"",docType:16,description:o.description||"",path:this.extendLib.id,ticket:0,updateTime:this.transformTime(o.updateTime),createTime:this.transformTime(o.createTime||o.updateTime),display_title:o.name||"",creator:o.creator?{nickname:(t=o.creator.name)!=null?t:"",username:(e=o.creator.name)!=null?e:"",uuid:(r=o.creator.uuid)!=null?r:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:o.modifier?{nickname:(i=o.modifier.name)!=null?i:"",username:(n=o.modifier.name)!=null?n:"",uuid:(s=o.modifier.uuid)!=null?s:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:o.owner?{nickname:(a=o.owner.name)!=null?a:"",username:(l=o.owner.name)!=null?l:"",uuid:(c=o.owner.uuid)!=null?c:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},tags:this.transformTags(o.classification)}}async transformSimModelListItem(o){var t,e,r,i,n,s,a,l,c;return o.edaFormatedData?o.edaFormatedData:{...o.edaFormatedData,uuid:o.uuid||this.extendLib.getDefaultItemId(),title:o.name||"",path:this.extendLib.id,ticket:0,updateTime:this.transformTime(o.updateTime),createTime:this.transformTime(o.createTime||o.updateTime),display_title:o.name||"",creator:o.creator?{nickname:(t=o.creator.name)!=null?t:"",username:(e=o.creator.name)!=null?e:"",uuid:(r=o.creator.uuid)!=null?r:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:o.modifier?{nickname:(i=o.modifier.name)!=null?i:"",username:(n=o.modifier.name)!=null?n:"",uuid:(s=o.modifier.uuid)!=null?s:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:o.owner?{nickname:(a=o.owner.name)!=null?a:"",username:(l=o.owner.name)!=null?l:"",uuid:(c=o.owner.uuid)!=null?c:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},tags:this.transformTags(o.classification)}}transformCbbListItem(o){var t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v,D,w,F,H,z,G,W,L,B,N,U;return o.edaFormatedData?o.edaFormatedData:{cbb_project:!0,content:(t=o.description)!=null?t:"",creator:o.creator?{avatar:"",nickname:(e=o.creator.name)!=null?e:"",username:(r=o.creator.name)!=null?r:"",uuid:(i=o.creator.uuid)!=null?i:""}:{avatar:"",nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:o.modifier?{nickname:(n=o.modifier.name)!=null?n:"",username:(s=o.modifier.name)!=null?s:"",uuid:(a=o.modifier.uuid)!=null?a:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:o.owner?{avatar:"",team:!1,nickname:(l=o.owner.name)!=null?l:"",username:(c=o.owner.name)!=null?c:"",uuid:(h=o.owner.uuid)!=null?h:""}:{avatar:"",team:!1,nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},name:o.name,path:this.extendLib.id,block_symbol:(d=(u=o.blockSymbols)==null?void 0:u.map(k=>{var V;return{uuid:k.uuid,display_title:k.name,docType:17,project_uuid:(V=o.uuid)!=null?V:o.name,title:k.name.toLocaleLowerCase()}}))!=null?d:[],schematics:(m=(p=o.schematics)==null?void 0:p.map(k=>{var V,Y;let X=(Y=(V=o.sheets)==null?void 0:V.filter(Z=>Z.belongSchematicUuid===k.uuid).map(Z=>({uuid:Z.uuid,ticket:0})))!=null?Y:[];return{create_at:this.transformTimeStr(k.createTime||k.updateTime),createtime:this.transformTime(k.createTime||k.updateTime),display_name:k.name,name:k.name.toLocaleLowerCase(),project_uuid:o.uuid,sheet_count:X.length,sort:X,ticket:0,update_at:this.transformTimeStr(k.updateTime),uuid:k.uuid,updateTime:this.transformTime(k.updateTime)}}))!=null?m:[],pcb:(y=(g=o.pcbs)==null?void 0:g.map(k=>{var V,Y,X,Z,Q,ae,he,re,se,K,me;return{description:(V=k.description)!=null?V:"",display_title:k.name,docType:3,project_uuid:(Y=o.uuid)!=null?Y:"",thumb:k.thumb,title:k.name.toLocaleLowerCase(),updateTime:this.transformTime(k.updateTime),uuid:k.uuid,creator:k.creator?{avatar:"",nickname:(Z=(X=k.creator)==null?void 0:X.name)!=null?Z:"",username:(ae=(Q=k.creator)==null?void 0:Q.name)!=null?ae:"",uuid:(re=(he=k.creator)==null?void 0:he.uuid)!=null?re:""}:{avatar:"",nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:k.modifier?{nickname:(se=k==null?void 0:k.modifier.name)!=null?se:"",username:(K=k==null?void 0:k.modifier.name)!=null?K:"",uuid:(me=k==null?void 0:k.modifier.uuid)!=null?me:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id}}}))!=null?y:[],schs:(P=(b=o.sheets)==null?void 0:b.map(k=>{var V,Y,X,Z,Q,ae,he,re;return{description:(V=k.description)!=null?V:"",display_title:k.name,docType:1,project_uuid:(Y=o.uuid)!=null?Y:"",schematic_uuid:k.belongSchematicUuid,thumb:k.thumb,title:k.name.toLocaleLowerCase(),updateTime:this.transformTime(k.updateTime),uuid:k.uuid,creator:k.creator?{avatar:"",nickname:(X=k==null?void 0:k.creator.name)!=null?X:"",username:(Z=k==null?void 0:k.creator.name)!=null?Z:"",uuid:(Q=k==null?void 0:k.creator.uuid)!=null?Q:""}:{avatar:"",nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:k!=null&&k.modifier?{nickname:(ae=k==null?void 0:k.modifier.name)!=null?ae:"",username:(he=k==null?void 0:k.modifier.name)!=null?he:"",uuid:(re=k==null?void 0:k.modifier.uuid)!=null?re:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id}}}))!=null?P:[],tags:{parent_tag:{name:(I=(T=o.classification)==null?void 0:T.primaryClassificationName)!=null?I:"",name_cn:(E=(C=o.classification)==null?void 0:C.primaryClassificationName)!=null?E:"",title:(_=(O=o.classification)==null?void 0:O.primaryClassificationName)!=null?_:"",uuid:(v=(R=o.classification)==null?void 0:R.primaryClassificationUuid)!=null?v:""},child_tag:{name:(w=(D=o.classification)==null?void 0:D.secondaryClassificationName)!=null?w:"",name_cn:(H=(F=o.classification)==null?void 0:F.secondaryClassificationName)!=null?H:"",title:(G=(z=o.classification)==null?void 0:z.secondaryClassificationName)!=null?G:"",uuid:(L=(W=o.classification)==null?void 0:W.secondaryClassificationUuid)!=null?L:""}},updated_at:this.transformTimeStr(o.updateTime),uuid:(B=o.uuid)!=null?B:o.name,boards:(U=(N=o.boards)==null?void 0:N.map(k=>({name:k.name,pcb:k.pcbUuid,sch:k.schUuid})))!=null?U:[]}}},lIt=class Lke{constructor(t){this.transformer=new aIt(this),this.id=t.id,this.isVisible=e=>t.isVisible?t.isVisible(e)&&this.isInTab(e.tabName):this.isInTab(e.tabName),this.title=t.title,this.position=t.position,t.device&&(this.device=new tIt(t.device,this)),t.symbol&&(this.symbol=new sIt(t.symbol,this)),t.footprint&&(this.footprint=new rIt(t.footprint,this)),t.panelLib&&(this.panelLib=new nIt(t.panelLib,this)),t.cbb&&(this.cbb=new eIt(t.cbb,this)),t.model3D&&(this.model3D=new iIt(t.model3D,this)),t.modelSimLib&&(this.modelSimLib=new oIt(t.modelSimLib,this))}static async set(t){var e,r,i,n,s,a,l,c,h,u;let d=new Lke(t);return d._deviceSupportedSymbolTypes=await((r=(e=t.device)==null?void 0:e.getSupportedSymbolTypes)==null?void 0:r.call(e)),d._symbolSupportedSymbolTypes=await((n=(i=t.symbol)==null?void 0:i.getSupportedSymbolTypes)==null?void 0:n.call(i)),d._deviceSupportedPreviewTypes=await((a=(s=t.device)==null?void 0:s.getSupportedPriviewTypes)==null?void 0:a.call(s)),d._footprintSupportedPreviewTypes=await((c=(l=t.footprint)==null?void 0:l.getSupportedPriviewTypes)==null?void 0:c.call(l)),d._panelLibSupportedPreviewTypes=await((u=(h=t.panelLib)==null?void 0:h.getSupportedPriviewTypes)==null?void 0:u.call(h)),d}getDefaultItemId(){return crypto.randomUUID().replace("-","")}getLibraryFunctionsClassInTab(t){switch(t){case"cbb":return this==null?void 0:this.cbb;case"device":return this==null?void 0:this.device;case"symbol":return this==null?void 0:this.symbol;case"footprint":return this==null?void 0:this.footprint;case"panelLib":return this==null?void 0:this.panelLib;case"model3D":return this==null?void 0:this.model3D;case"modelSimLib":return this==null?void 0:this.modelSimLib;default:return null}}isInTab(t){return!!this.getLibraryFunctionsClassInTab(t)}isHasCategoryTreeInTab(t){let e=this.getLibraryFunctionsClassInTab(t);return!!(e!=null&&e.getClassificationTree)}async getAmountByWd(t,e){var r;let i=this.getLibraryFunctionsClassInTab(t),n=await(i==null?void 0:i.getList({page:1,pageSize:1,query:{wd:e}}));return(r=n==null?void 0:n.count)!=null?r:0}getTabByCategoryType(t){switch(t){case 1:return"cbb";case 3:return"device";case 2:return"symbol";case 4:return"footprint";default:return null}}async getClassificationTreeInTab(t){var e;return this.isHasCategoryTreeInTab(t)?await((e=this.getLibraryFunctionsClassInTab(t))==null?void 0:e.getClassificationTree()):null}async getCategoryTreeDataItemsInTab(t){let e=await this.getClassificationTreeInTab(t);return e==null?void 0:e.map(r=>this.transformer.transformCategory(r))}async getClassificationTreeByCategoryType(t){let e=this.getTabByCategoryType(t);return e&&this.getClassificationTreeInTab(e)}async getCategoryTreeDataItemsByCategoryType(t){let e=this.getTabByCategoryType(t);return e&&this.getCategoryTreeDataItemsInTab(e)}getSelectTypeListInTab(t){let e=[];if(t==="device"){let r=this._deviceSupportedSymbolTypes;e=r?rNe.filter(i=>r.includes(Number(i.value))||!i.value):rNe}else if(t==="symbol"){let r=this._symbolSupportedSymbolTypes;e=r?iNe.filter(i=>r.includes(Number(i.value))||!i.value):iNe}return e.length>2?e:[]}getPreviewTypesInTab(t){let e=eTt[t];return t==="device"&&this._deviceSupportedPreviewTypes?e=e.filter(r=>{var i;return(i=this._deviceSupportedPreviewTypes)==null?void 0:i.includes(r)}):t==="footprint"&&this._footprintSupportedPreviewTypes&&(e=e.filter(r=>{var i;return(i=this._footprintSupportedPreviewTypes)==null?void 0:i.includes(r)})),e}async getListInTab(t,e){var r;return await((r=this.getLibraryFunctionsClassInTab(t))==null?void 0:r.getList(e))}async getTransformedListInTab(t,e){var r;return await((r=this.getLibraryFunctionsClassInTab(t))==null?void 0:r.getTransformedList(e))}async getDetailInTab(t,e,r){var i;return await((i=this.getLibraryFunctionsClassInTab(t))==null?void 0:i.getDetail(e,r))}async getTransformedDetailInTab(t,e,r){var i;return await((i=this.getLibraryFunctionsClassInTab(t))==null?void 0:i.getTransformedDetail(e,r))}},cIt=class{constructor(o=10){this._runingCount=0,this._handleCount=0,this._queue=[],this._results=[],this._windowSize=o,this._finishCallback=null,this._taskStartCallback=null,this._taskEndCallback=null}pushTask(o){this._queue.push(o)}setFinishCallback(o){this._finishCallback=o}setTaskStartCallback(o){this._taskStartCallback=o}setTaskEndCallback(o){this._taskEndCallback=o}next(){for(;this._runingCount<this._windowSize&&this._queue.length>0;){this._runingCount+=1,this._handleCount+=1;let o=this._handleCount-1,t=this._queue.shift();this._taskStartCallback&&this._taskStartCallback(o),t(o).then(e=>{this._results.push(e)}).catch(e=>{this._results.push(e)}).finally(()=>{this._runingCount-=1,this._taskEndCallback&&this._taskEndCallback(this._results[this._results.length-1]),this.next()})}this._runingCount<=0&&this._finishCallback&&this._finishCallback(this._results)}},PIe=class{onString(o,t,e){}onAttr(o,t,e){}onGroup(o,t,e,r,i){}onDelGroup(o,t,e,r){}onDelString(o,t,e,r){}onDelAttr(o,t,e,r){}onPanelizeSide(o,t,e,r){}onDelPanelizeSide(o,t,e,r){}onPanelizeStamp(o,t,e,r){}onDelPanelizeStamp(o,t,e,r){}onPanelize(o,t,e,r){}onDelPanelize(o,t,e){}onRuleSelector(o,t,e,r){}onDelRuleSelector(o,t,e,r){}onRule(o,t,e,r){}onDelRule(o,t,e,r,i){}onRuleTemplate(o,t,e,r){}onDimension(o,t,e,r,i,n){}onDelDimension(o,t,e,r){}onBoss(o,t,e,r,i,n){}onDelBoss(o,t,e,r){}onShellEntity(o,t,e,r,i,n){}onDelShellEntity(o,t,e,r){}onShellCut(o,t,e,r,i,n){}onDelShellCut(o,t,e,r){}onCrease(o,t,e,r,i,n){}onDelCrease(o,t,e,r){}onShell(o,t,e,r,i,n){}onDelShell(o,t,e,r){}onFpcFill(o,t,e,r,i,n){}onDelFpcFill(o,t,e,r){}onTeardrop(o,t,e,r,i,n){}onDelTeardrop(o,t,e,r){}onImage(o,t,e,r,i,n){}onDelImage(o,t,e,r){}onPoured(o,t,e,r,i,n){}onDelPoured(o,t,e,r){}onPour(o,t,e,r,i,n){}onDelPour(o,t,e,r){}onRegion(o,t,e,r,i,n){}onDelRegion(o,t,e,r){}onFill(o,t,e,r,i,n){}onDelFill(o,t,e,r){}onPoly(o,t,e,r,i,n){}onDelPoly(o,t,e,r){}onEQLenGrp(o,t,e,r,i){}onDelEQLenGrp(o,t,e,r){}onDelProp(o,t,e,r){}onObj(o,t,e,r,i,n){}onDelObj(o,t,e,r){}onArc(o,t,e,r,i,n){}onDelArc(o,t,e,r){}onCArc(o,t,e,r,i,n){}onDelCArc(o,t,e,r){}onLine(o,t,e,r,i,n){}onDelLine(o,t,e,r){}onPad(o,t,e,r,i,n){}onDelPad(o,t,e,r){}onVia(o,t,e,r,i,n){}onDelVia(o,t,e,r){}onDelConnect(o,t,e,r){}onPreference(o,t,e,r){}onSilkOpts(o,t,e,r,i){}onDelSilkOpts(o,t,e,r){}onPrimitive(o,t,e,r,i){}onDelPrimitive(o,t,e,r){}onNet(o,t,e,r,i){}onDelNet(o,t,e,r){}onPartition(o,t,e,r,i,n){}onDelPartition(o,t,e,r){}onActiveLayer(o,t,e,r){}onLayerPhys(o,t,e,r,i){}onDelLayerPhys(o,t,e,r){}onLayer(o,t,e,r,i){}onDelLayer(o,t,e,r){}onCanvas(o,t,e,r){}onDocDetail(o,t,e,r){}onStringNum(o,t){}onAttrNum(o,t){}onDimensionNum(o,t){}onBossNum(o,t){}onShellEntityNum(o,t){}onShellCutNum(o,t){}onCreaseNum(o,t){}onShellNum(o,t){}onFpcFillNum(o,t){}onTeardropNum(o,t){}onImageNum(o,t){}onPouredNum(o,t){}onPourNum(o,t){}onRegionNum(o,t){}onFillNum(o,t){}onPolyNum(o,t){}onObjNum(o,t){}onArcNum(o,t){}onCArcNum(o,t){}onLineNum(o,t){}onPadNum(o,t){}onViaNum(o,t){}onPartitionNum(o,t){}},hIt=class extends PIe{constructor(o){super(),this.source={},this._action=o}get action(){return this._action}getSource(){return this.source}onString(o,t,e){this.source[o]=t}onAttr(o,t,e){e||(this.action&&this.action(o,t),this.source[o]=t)}onDimension(o,t,e,r,i,n){this.source[o]=i}onBoss(o,t,e,r,i,n){this.source[o]=i}onShellEntity(o,t,e,r,i,n){this.source[o]=i}onShellCut(o,t,e,r,i,n){this.source[o]=i}onCrease(o,t,e,r,i,n){this.source[o]=i}onShell(o,t,e,r,i,n){this.source[o]=i}onFpcFill(o,t,e,r,i,n){this.source[o]=i}onTeardrop(o,t,e,r,i,n){this.source[o]=i}onImage(o,t,e,r,i,n){this.source[o]=i}onPoured(o,t,e,r,i,n){this.source[o]=i}onPour(o,t,e,r,i,n){this.source[o]=i}onRegion(o,t,e,r,i,n){this.source[o]=i}onFill(o,t,e,r,i,n){this.source[o]=i}onPoly(o,t,e,r,i,n){this.source[o]=i}onObj(o,t,e,r,i,n){this.source[o]=i}onArc(o,t,e,r,i,n){this.source[o]=i}onCArc(o,t,e,r,i,n){this.source[o]=i}onLine(o,t,e,r,i,n){this.source[o]=i}onPad(o,t,e,r,i,n){this.source[o]=i}onVia(o,t,e,r,i,n){this.source[o]=i}},Mke=class extends h7e{onXSignalsGroup(o,t,e,r,i){}onDelXSignalsGroup(o,t,e,r){}onXSignals(o,t,e,r,i){}onDelXSignals(o,t,e,r){}onBoard(o,t,e,r){}onDelBoard(o,t,e){}constructor(o,t,e){super(o,t,e,new cIe(!1)),this._compilerHandler=null}async init(o=!1,t=!1,e=!1,r=!1){if(!this.uuid)debugger;return super.init(o,t,e,r)}onBlob(o,t,e,r,i){}onDelBlob(o,t,e,r){}onFont(o,t,e,r){}onDelFont(o,t,e,r){}canvasSelected(){return""}onSelectChange(o,t,e){}onSelectQuit(o,t){}onLayerFill(o,t,e,r,i){}onDelLayerFill(o,t,e,r){}setHandler(o){this._compilerHandler=o}onGroup(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onGroup(o,t,e,r,i)}onDelGroup(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelGroup(o,t,e,r)}onString(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onString(o,i,n)}onDelString(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelString(o,t,e,r)}onAttr(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onAttr(o,i,n)}onDelAttr(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelAttr(o,t,e,r)}onPanelizeSide(o,t,e,r){this._compilerHandler&&this._compilerHandler.onPanelizeSide(o,t,e,r)}onDelPanelizeSide(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPanelizeSide(o,t,e,r)}onPanelizeStamp(o,t,e,r){this._compilerHandler&&this._compilerHandler.onPanelizeStamp(o,t,e,r)}onDelPanelizeStamp(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPanelizeStamp(o,t,e,r)}onPanelize(o,t,e,r){this._compilerHandler&&this._compilerHandler.onPanelize(o,t,e,r)}onDelPanelize(o,t,e){this._compilerHandler&&this._compilerHandler.onDelPanelize(o,t,e)}onRuleSelector(o,t,e,r){this._compilerHandler&&this._compilerHandler.onRuleSelector(o,t,e,r)}onDelRuleSelector(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelRuleSelector(o,t,e,r)}onRule(o,t,e,r){this._compilerHandler&&this._compilerHandler.onRule(o,t,e,r)}onDelRule(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onDelRule(o,t,e,r,i)}onRuleTemplate(o,t,e,r){this._compilerHandler&&this._compilerHandler.onRuleTemplate(o,t,e,r)}onDimension(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onDimension(o,t,e,r,i,n)}onDelDimension(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelDimension(o,t,e,r)}onBoss(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onBoss(o,t,e,r,i,n)}onDelBoss(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelBoss(o,t,e,r)}onShellEntity(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onShellEntity(o,t,e,r,i,n)}onDelShellEntity(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelShellEntity(o,t,e,r)}onShellCut(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onShellCut(o,t,e,r,i,n)}onDelShellCut(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelShellCut(o,t,e,r)}onCrease(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onCrease(o,t,e,r,i,n)}onDelCrease(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelCrease(o,t,e,r)}onShell(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onShell(o,t,e,r,i,n)}onDelShell(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelShell(o,t,e,r)}onFpcFill(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onFpcFill(o,t,e,r,i,n)}onDelFpcFill(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelFpcFill(o,t,e,r)}onTeardrop(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onTeardrop(o,t,e,r,i,n)}onDelTeardrop(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelTeardrop(o,t,e,r)}onImage(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onImage(o,t,e,r,i,n)}onDelImage(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelImage(o,t,e,r)}onPoured(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onPoured(o,t,e,r,i,n)}onDelPoured(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPoured(o,t,e,r)}onPour(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onPour(o,t,e,r,i,n)}onDelPour(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPour(o,t,e,r)}onRegion(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onRegion(o,t,e,r,i,n)}onDelRegion(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelRegion(o,t,e,r)}onFill(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onFill(o,t,e,r,i,n)}onDelFill(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelFill(o,t,e,r)}onPoly(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onPoly(o,t,e,r,i,n)}onDelPoly(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPoly(o,t,e,r)}onEQLenGrp(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onEQLenGrp(o,t,e,r,i)}onDelEQLenGrp(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelEQLenGrp(o,t,e,r)}onDelProp(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelProp(o,t,e,r)}onObj(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onObj(o,t,e,r,i,n)}onDelObj(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelObj(o,t,e,r)}onArc(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onArc(o,t,e,r,i,n)}onDelArc(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelArc(o,t,e,r)}onCArc(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onCArc(o,t,e,r,i,n)}onDelCArc(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelCArc(o,t,e,r)}onLine(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onLine(o,t,e,r,i,n)}onDelLine(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelLine(o,t,e,r)}onPad(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onPad(o,t,e,r,i,n)}onDelPad(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPad(o,t,e,r)}onVia(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onVia(o,t,e,r,i,n)}onDelVia(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelVia(o,t,e,r)}onDelConnect(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelConnect(o,t,e,r)}onPreference(o,t,e,r){this._compilerHandler&&this._compilerHandler.onPreference(o,t,e,r)}onSilkOpts(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onSilkOpts(o,t,e,r,i)}onDelSilkOpts(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelSilkOpts(o,t,e,r)}onPrimitive(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onPrimitive(o,t,e,r,i)}onDelPrimitive(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPrimitive(o,t,e,r)}onNet(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onNet(o,t,e,r,i)}onDelNet(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelNet(o,t,e,r)}onPartition(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onPartition(o,t,e,r,i,n)}onDelPartition(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPartition(o,t,e,r)}onActiveLayer(o,t,e,r){this._compilerHandler&&this._compilerHandler.onActiveLayer(o,t,e,r)}onLayerPhys(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onLayerPhys(o,t,e,r,i)}onDelLayerPhys(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelLayerPhys(o,t,e,r)}onLayer(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onLayer(o,t,e,r,i)}onDelLayer(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelLayer(o,t,e,r)}onCanvas(o,t,e,r){this._compilerHandler&&this._compilerHandler.onCanvas(o,t,e,r)}onDocDetail(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDocDetail(o,t,e,r)}onStringNum(o,t){this._compilerHandler&&this._compilerHandler.onStringNum(o,t)}onAttrNum(o,t){this._compilerHandler&&this._compilerHandler.onAttrNum(o,t)}onDimensionNum(o,t){this._compilerHandler&&this._compilerHandler.onDimensionNum(o,t)}onBossNum(o,t){this._compilerHandler&&this._compilerHandler.onBossNum(o,t)}onShellEntityNum(o,t){this._compilerHandler&&this._compilerHandler.onShellEntityNum(o,t)}onShellCutNum(o,t){this._compilerHandler&&this._compilerHandler.onShellCutNum(o,t)}onCreaseNum(o,t){this._compilerHandler&&this._compilerHandler.onCreaseNum(o,t)}onShellNum(o,t){this._compilerHandler&&this._compilerHandler.onShellNum(o,t)}onFpcFillNum(o,t){this._compilerHandler&&this._compilerHandler.onFpcFillNum(o,t)}onTeardropNum(o,t){this._compilerHandler&&this._compilerHandler.onTeardropNum(o,t)}onImageNum(o,t){this._compilerHandler&&this._compilerHandler.onImageNum(o,t)}onPouredNum(o,t){this._compilerHandler&&this._compilerHandler.onPouredNum(o,t)}onPourNum(o,t){this._compilerHandler&&this._compilerHandler.onPourNum(o,t)}onRegionNum(o,t){this._compilerHandler&&this._compilerHandler.onRegionNum(o,t)}onFillNum(o,t){this._compilerHandler&&this._compilerHandler.onFillNum(o,t)}onPolyNum(o,t){this._compilerHandler&&this._compilerHandler.onPolyNum(o,t)}onObjNum(o,t){this._compilerHandler&&this._compilerHandler.onObjNum(o,t)}onArcNum(o,t){this._compilerHandler&&this._compilerHandler.onArcNum(o,t)}onCArcNum(o,t){this._compilerHandler&&this._compilerHandler.onCArcNum(o,t)}onLineNum(o,t){this._compilerHandler&&this._compilerHandler.onLineNum(o,t)}onPadNum(o,t){this._compilerHandler&&this._compilerHandler.onPadNum(o,t)}onViaNum(o,t){this._compilerHandler&&this._compilerHandler.onViaNum(o,t)}onPartitionNum(o,t){this._compilerHandler&&this._compilerHandler.onPartitionNum(o,t)}};function uIt(o,t){let e=0;return function(...r){let i=new Date().getTime();i-e>t&&(o.apply(this,r),e=i)}}function dIt(o,t,e){let r,i,n,s,a,l,c=0,h=!1,u=!1,d=!0;if(typeof o!="function")throw new TypeError("Expected a function");t=Number(t)||0,typeof e=="object"&&(h=!!e.leading,u="maxWait"in e,n=u?Math.max(Number(e.maxWait)||0,t):n,d="trailing"in e?!!e.trailing:d);function p(E){let O=r,_=i;return r=i=void 0,c=E,s=o.apply(_,O),s}function m(E){return c=E,a=window.setTimeout(b,t),h?p(E):s}function g(E){let O=E-l,_=E-c,R=t-O;return u?Math.min(R,n-_):R}function y(E){let O=E-l,_=E-c;return l===void 0||O>=t||O<0||u&&_>=n}function b(){let E=Date.now();if(y(E))return P(E);a=window.setTimeout(b,g(E))}function P(E){return a=void 0,d&&r?p(E):(r=i=void 0,s)}function T(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function I(){return a===void 0?s:P(Date.now())}function C(){let E=Date.now(),O=y(E);if(r=arguments,i=this,l=E,O){if(a===void 0)return m(l);if(u)return a=window.setTimeout(b,t),p(l)}return a===void 0&&(a=window.setTimeout(b,t)),s}return C.cancel=T,C.flush=I,C}var PM=new Map;PM.set("<","&lt;");PM.set(">","&gt;");PM.set('"',"&quot;");PM.set("'","&apos;");PM.set("&","&amp;");function Nke(o){if(typeof o!="string")return o;if(o==null)return"";function t(e){return PM.get(e)}return o==null?"":tte(o,PM)?(o+"").replace(/[<>'"&]/g,t):o}var SM=new Map;SM.set("&lt;","<");SM.set("&gt;",">");SM.set("&quot;",'"');SM.set("&apos;","'");SM.set("&amp;","&");SM.set("&#039;","'");function pIt(o){if(typeof o!="string")return o;if(o==null)return"";let t={"&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'","&amp;":"&","&#039;":"'"};function e(r){return SM.get(r)}return tte(o,t)?(o+"").replace(/&([^;]+);/g,e):o}var iY=new Map;iY.set("~","&#126;");iY.set("^","&#94;");iY.set("#@$","&#35;&#64;&#36;");iY.set("`","&#96;");function fIt(o){if(typeof o!="string")return o;if(o==null)return"";let t={"~":"&#126;","^":"&#94;","#@$":"&#35;&#64;&#36;","`":"&#96;"};function e(r){return iY.get(r)}return tte(o,t)?o.replace(/(\~|\^|#@\$|\`)/g,e):o}function WTe(o){if(typeof o!="object"||o===null||o===void 0)return o;if(Array.isArray(o))return o.map(WTe);{let t={};for(let e in o)Object.hasOwnProperty.call(o,e)&&(t[e]=WTe(o[e]));return t}}function zTe(o){if(typeof o!="object"||o===null||o instanceof Date)return typeof o=="string"&&o.includes("<")&&(o=Nke(o)),o;if(Array.isArray(o))return o.map(zTe);{let t={};for(let e in o)o.hasOwnProperty(e)&&(t[e]=zTe(o[e]));return t}}function mIt(o,t){let e="",r="";for(let i=0;i<o.length;i++)String(o[i])&&(r+=o[i]+"	");r=r.slice(0,-1),e+=r+`\r
`;for(let i=0;i<t.length;i++){r="";for(let n=0;n<o.length;n++)r+='"'+(typeof t[i][n]<"u"?t[i][n]:"")+'"	';r=r.slice(0,r.length-1),e+=r+`\r
`}return e}function gIt(o,t={targetType:"blob"}){let{targetType:e,width:r,height:i}=t,n=new Image(r,i);return new Promise((s,a)=>{n.onload=function(){let l=document.createElement("canvas"),c=l.getContext("2d");switch(l.width=n.width,l.height=n.height,c.drawImage(n,0,0,n.width,n.height),e){case"dataURL":{s(l.toDataURL());break}case"blob":default:{l.toBlob(h=>{s(h)});break}}},n.onerror=l=>{a(l)},n.src=o})}async function yIt(o,t={}){return new Promise((e,r)=>{try{let{targetType:i="blob",imageType:n="image/png"}=t,s=document.createElement("canvas"),a=s.getContext("2d");switch(s.width=o.width,s.height=o.height,a.putImageData(o,0,0),i){case"dataURL":{e(s.toDataURL(n));break}case"blob":default:{s.toBlob(l=>{e(l)},n);break}}}catch(i){r(i)}})}function Dy(o=[],t,e){if(!o||!o.length||!t)return{index:-1,data:null};let r={index:-1,data:null};for(let i=0;i<o.length;i++)if(typeof o[i]=="object"&&o[i][t]===e){r.data=o[i],r.index=i;break}return r}function bIt(o=[],t,e){if(!o||!o.length||!t)return{indexs:[],datas:[]};let r={indexs:[],datas:[]};for(let i=0;i<o.length;i++)typeof o[i]=="object"&&o[i][t]===e&&(r.datas.push(o[i]),r.indexs.push(i));return r}var PIt=class extends PIe{constructor(o){super(),this._action=o}get action(){return this._action}onAttr(o,t,e){e||this.action(t.key,t.value)}};async function TIt(o,t,e,r=!0){let i={initResponse:null,d3modelItem:null,d3modelItemName:void 0,d3modelItemTransform:void 0,d3modelItemPath:void 0,d3modelItemId:void 0,compiler:null},n=new Map;return new Promise(async s=>{let a=new Mke(o,t,e);i.compiler=a,a.setHandler(new PIt(async(l,c)=>{if(typeof c<"u"&&n.set(l,c),n.has("3D Model")&&n.has("3D Model Title")&&n.has("3D Model Transform")){i.d3modelItemId=n.get("3D Model"),i.d3modelItemName=n.get("3D Model Title"),i.d3modelItemTransform=n.get("3D Model Transform");let h=eY(i.d3modelItemId,!0);i.d3modelItemPath=h.path}})),i.initResponse=await a.init().catch(l=>({message:l.message,success:!1})),i.d3modelItemId&&r&&(i.d3modelItem=await rY(i.d3modelItemId)),i.compiler.destroy(),n.clear(),s(i)})}async function IIt(o,t){let e={padList:[]};return new Promise(async r=>{try{let i=new GPt(o,t,!0),n=await i.getPads()||{},s=Object.keys(n);for(let a=0;a<s.length;a++)e.padList.push({...n[s[a]]});i.destroy(),r(e)}catch{r(e)}})}function CIt(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);let r=[1,10,100,1e3][t]||Math.pow(10,t)||10;if(e){let i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),i+o}else return Math.round(o*r+1e-10)/r}function SIt(o,t){typeof o=="string"&&(o=parseFloat(o));let e=Math.pow(10,t);return Math.round(o*e)/e}var EIt={conversion(o,t,e){let r=o+2+t;return this[r](e)},conversion1(o,t,e){let r=o+2+t,i=this[r](e);return t=="mil"?Math.round(i*10)/10:Math.round(i*1e3)/1e3},mil2mil(o){return o},mil2mm(o){return o*.0254},mil2cm(o){return o*.00254},mil2inch(o){return o/1e3},mm2mm(o){return o},mm2mil(o){let t=Math.pow(10,5);return Math.round(o*39.37007874015748*t)/t},mm2cm(o){return o/10},mm2inch(o){let t=Math.pow(10,8);return Math.round(o*.03937007874015748*t)/t},cm2mil(o){let t=Math.pow(10,6);return Math.round(o*3.937007874015748*t)/t},cm2mm(o){return o*10},cm2inch(o){let t=Math.pow(10,7);return Math.round(o*.3937007874015748*t)/t},inch2mil(o){return o*1e3},inch2mm(o){return o*25.4},inch2cm(o){return o*2.54}};function OIt(o,t,e){var r=o-t;return e||(e=1e-10),(r>0?r:-r)<e}function AIt(o){return o<0?(360+o%360)%360:o>=360?o%360:o}function kke(o,t,e,r){var i=o-e,n=t-r;return i*i+n*n}function _It(o,t,e,r){return Math.sqrt(kke(o,t,e,r))}function vIt(o,t,e,r){var i=e-o,n=r-t,s=Math.atan2(n,i);return s=s<0?s+Math.PI+Math.PI:s,s}function xIt(o){return Bke(o)&&Object.keys(o).length===0}function Bke(o){return Object.prototype.toString.call(o).slice(8,-1)==="Object"}function RIt(o){return Fke(o)||Vke(o)}function Fke(o){return Object.prototype.toString.call(o).slice(8,-1)==="AsyncFunction"}function Vke(o){return Object.prototype.toString.call(o).slice(8,-1)==="Function"}var lc=class{};lc.unitConversion=EIt,lc.ConcurrencyTaskQueue=cIt,lc.FootprintCompilerInstance=Mke,lc.FootprintCompilerHandlerProxy=PIe,lc.FootprintCompilerAttr=hIt,lc.createCSVString=mIt,lc.svg2png=gIt,lc.imageData2NewImage=yIt,lc.htmlEncode=Nke,lc.htmlDecode=pIt,lc.strEncode=fIt,lc.isEmptyObj=xIt,lc.isPlainObject=Bke,lc.isFn=RIt,lc.isAsyncFunction=Fke,lc.isNormalFunction=Vke,lc.formatDate=hx,lc.formatDate2=QTt,lc.deepClone=WTe,lc.deepCloneWithHtmlEncode=zTe,lc.naturalSortComparator=TNe,lc.naturalSortSplitor=TTe,lc.naturalSort=pgt,lc.naturalStrSort=fgt,lc.naturalSort1=mgt,lc.naturalCompare=ggt,lc.isObjKeyInStr=tte,lc.throttle=uIt,lc.debounce=dIt,lc.findList=Dy,lc.findListAll=bIt,lc.randomString=Pgt,lc.parseJSON=Tgt,lc.splitComponentId2FolderAndFilenameMixin=eY,lc.getFootprintPadInfo=IIt,lc.getFootprint3DInfo=TIt;var aM=class{};aM.toFixed=CIt,aM.toFixed1=SIt,aM.floatEqual=OIt,aM.fixAngle=AIt,aM.getDistance=_It,aM.getDistance2=kke,aM.getAngleByDot=vIt;var Gke=class YTe{constructor(){this._changeCbs=new Set,this._map=new Map,this._debounceNotify=lc.debounce(()=>{this._notify()},50)}static get context(){return $()}static getInstance(){var t;return(t=this.context.extendLibManager)!=null?t:this.context.extendLibManager=new YTe}_notify(){for(let t of this._changeCbs)t()}onChange(t){this._changeCbs.add(t)}offChange(t){this._changeCbs.delete(t)}_getLibId(t){return`${YTe.LIB_ID_PREFFIX}${t}`}async addLibWithId(t){this._map.set(t.id,await lIt.set(t)),this._debounceNotify()}async addLib(t){let e=this._getLibId(t.title);return await this.addLibWithId({...t,id:e}),e}deleteLib(t){return this._debounceNotify(),this._map.delete(t)}hasLib(t){return this._map.has(t)}getLib(t){return this._map.get(t)}getLibs(){return Array.from(this._map.values())}updateLibTitle(t,e){let r=this._map.get(t);r&&(r.title=e,this._debounceNotify())}updateLibPosition(t,e){let r=this._map.get(t);r&&(r.position=e,this._debounceNotify())}};Gke.LIB_ID_PREFFIX="extend_lib_";var P0=Gke,TIe=class{},DIt=(o=>(o.PROJECT_DOCUMENT_LOCKED="PROJECT_DOCUMENT_LOCKED",o.PROJECT_DOCUMENT_UPDATE_REJECT="PROJECT_DOCUMENT_UPDATE_REJECT",o.NOSYMBOL_ON_TARGETPATH_BY_DEVICE_BOUND="NOSYMBOL_ON_TARGETPATH_BY_DEVICE_BOUND",o.NOFOOTPRINT_ON_TARGETPATH_BY_DEVICE_BOUND="NOFOOTPRINT_ON_TARGETPATH_BY_DEVICE_BOUND",o.DEVICE_ATTRIBUTES_ERROR="DEVICE_ATTRIBUTES_ERROR",o.DEVICE_DESCRIPTION_ERROR="DEVICE_DESCRIPTION_ERROR",o.SYMBOL_DESCRIPTION_ERROR="SYMBOL_DESCRIPTION_ERROR",o.FOOTPRINT_DESCRIPTION_ERROR="FOOTPRINT_DESCRIPTION_ERROR",o.D3MODEL_DESCRIPTION_ERROR="D3MODEL_DESCRIPTION_ERROR",o.DEVICE_NAMA_ERROR="DEVICE_NAMA_ERROR",o.SYMBOL_NAMA_ERROR="SYMBOL_NAMA_ERROR",o.FOOTPRINT_NAMA_ERROR="FOOTPRINT_NAMA_ERROR",o.PANEL_LIB_NAMA_ERROR="PANEL_LIB_NAMA_ERROR",o.D3MODEL_NAMA_ERROR="D3MODEL_NAMA_ERROR",o.SIM_MODEL_NAMA_ERROR="SIM_MODEL_NAMA_ERROR",o.DEVICE_SAME_NAMA_EXISTS="DEVICE_SAME_NAMA_EXISTS",o.SYMBOL_SAME_NAMA_EXISTS="SYMBOL_SAME_NAMA_EXISTS",o.FOOTPRINT_SAME_NAMA_EXISTS="FOOTPRINT_SAME_NAMA_EXISTS",o.D3MODEL_SAME_NAMA_EXISTS="D3MODEL_SAME_NAMA_EXISTS",o.SIM_MODEL_SAME_NAMA_EXISTS="SIM_MODEL_SAME_NAMA_EXISTS",o.PANELLIB_SAME_NAMA_EXISTS="PANELLIB_SAME_NAMA_EXISTS",o.PARAMETER_VERIFICATION="PARAMETER_VERIFICATION",o.RESULT_VERIFICATION="RESULT_VERIFICATION",o.GET_DEVICE="GET_DEVICE",o.GET_DEVICE_ATTRIBUTES_KEYS="GET_DEVICE_ATTRIBUTES_KEYS",o.GET_DEVICE_ATTRIBUTES_VALUES="GET_DEVICE_ATTRIBUTES_VALUES",o.GET_DEVICE_NOT_FOUND="GET_DEVICE_NOT_FOUND",o.GET_DEVICE_LIST="GET_DEVICE_LIST",o.GET_DEVICE_SEARCH_LIST="GET_DEVICE_SEARCH_LIST",o.GET_DEVICE_SEARCH_UUIDS="GET_DEVICE_SEARCH_UUIDS",o.STAR_DEVICE="STAR_DEVICE",o.UNSTAR_DEVICE="UNSTAR_DEVICE",o.GET_SYMBOL="GET_SYMBOL",o.GET_SYMBOL_NOT_FOUND="GET_SYMBOL_NOT_FOUND",o.GET_SYMBOL_LIST="GET_SYMBOL_LIST",o.GET_SYMBOL_SEARCH_LIST="GET_SYMBOL_SEARCH_LIST",o.GET_SYMBOL_SEARCH_UUIDS="GET_SYMBOL_SEARCH_UUIDS",o.STAR_SYMBOL="STAR_SYMBOL",o.UNSTAR_SYMBOL="UNSTAR_SYMBOL",o.GET_FOOTPRINT="GET_FOOTPRINT",o.GET_FOOTPRINT_NOT_FOUND="GET_FOOTPRINT_NOT_FOUND",o.GET_FOOTPRINT_LIST="GET_FOOTPRINT_LIST",o.GET_FOOTPRINT_SEARCH_LIST="GET_FOOTPRINT_SEARCH_LIST",o.GET_FOOTPRINT_SEARCH_UUIDS="GET_FOOTPRINT_SEARCH_UUIDS",o.STAR_FOOTPRINT="STAR_FOOTPRINT",o.UNSTAR_FOOTPRINT="UNSTAR_FOOTPRINT",o.GET_PANEL_LIB="GET_PANEL_LIB",o.GET_PANEL_LIB_LIST="GET_PANEL_LIB_LIST",o.GET_PANEL_LIB_NOT_FOUND="GET_PANEL_LIB_NOT_FOUND",o.GET_PANEL_LIB_SEARCH_LIST="GET_PANEL_LIB_SEARCH_LIST",o.GET_PANEL_LIB_SEARCH_UUIDS="GET_PANEL_LIB_SEARCH_UUIDS",o.STAR_PANEL_LIB="STAR_PANEL_LIB",o.UNSTAR_PANEL_LIB="UNSTAR_PANEL_LIB",o.GET_D3MODEL="GET_D3MODEL",o.GET_D3MODEL_NOT_FOUND="GET_D3MODEL_NOT_FOUND",o.GET_D3MODEL_LIST="GET_D3MODEL_LIST",o.GET_D3MODEL_SEARCH_LIST="GET_D3MODEL_SEARCH_LIST",o.GET_D3MODEL_SEARCH_UUIDS="GET_D3MODEL_SEARCH_UUIDS",o.GET_SIM_MODEL="GET_SIM_MODEL",o.GET_SIM_NOT_FOUND="GET_SIM_NOT_FOUND",o.GET_SIM_MODEL_LIST="GET_SIM_MODEL_LIST",o.GET_SIM_MODEL_SEARCH_LIST="GET_SIM_MODEL_SEARCH_LIST",o.GET_SIM_MODEL_SEARCH_UUIDS="GET_SIM_MODEL_SEARCH_UUIDS",o.CROSS_BIND="CROSS_BIND",o.CROSS_BIND_EXIT="CROSS_BIND_EXIT",o.IMPORT_EXIST_PROJECT="IMPORT_EXIST_PROJECT",o.CREATE_PROJECT="CREATE_PROJECT",o.CREATE_DEVICE="CREATE_DEVICE",o.CREATE_DEVICE_PERMISSIONS="CREATE_DEVICE_PERMISSIONS",o.CREATE_DEVICE_GET_ORIGIN="CREATE_DEVICE_GET_ORIGIN",o.CREATE_SYMBOL="CREATE_SYMBOL",o.CREATE_SYMBOL_PERMISSIONS="CREATE_SYMBOL_PERMISSIONS",o.CREATE_SYMBOL_GET_ORIGIN="CREATE_SYMBOL_GET_ORIGIN",o.CREATE_SYMBOL_MIGRATE_CANVAS_ERROR="CREATE_SYMBOL_MIGRATE_CANVAS_ERROR",o.CREATE_FOOTPRINT="CREATE_FOOTPRINT",o.CREATE_FOOTPRINT_PERMISSIONS="CREATE_FOOTPRINT_PERMISSIONS",o.CREATE_FOOTPRINT_GET_ORIGIN="CREATE_FOOTPRINT_GET_ORIGIN",o.CREATE_FOOTPRINT_MIGRATE_CANVAS_ERROR="CREATE_FOOTPRINT_MIGRATE_CANVAS_ERROR",o.CREATE_D3MODEL="CREATE_D3MODEL",o.CREATE_D3MODEL_PERMISSIONS="CREATE_D3MODEL_PERMISSIONS",o.CREATE_PANEL_LIB="CREATE_PANEL_LIB",o.CREATE_PANEL_LIB_PERMISSIONS="CREATE_PANEL_LIB_PERMISSIONS",o.CREATE_PANEL_LIB_MIGRATE_CANVAS_ERROR="CREATE_PANEL_LIB_MIGRATE_CANVAS_ERROR",o.CREATE_SIM_MODEL="CREATE_SIM_MODEL",o.CREATE_SIM_MODEL_PERMISSIONS="CREATE_SIM_MODEL_PERMISSIONS",o.CREATE_SIM_MODEL_MIGRATE_CANVAS_ERROR="CREATE_SIM_MODEL_MIGRATE_CANVAS_ERROR",o.UPDATE_DEVICE="UPDATE_DEVICE",o.UPDATE_DEVICE_ATTRIBUTES="UPDATE_DEVICE_ATTRIBUTES",o.UPDATE_DEVICE_PERMISSIONS="CREATE_DEVICE_PERMISSIONS",o.UPDATE_SYMBOL="UPDATE_SYMBOL",o.UPDATE_SYMBOL_MIGRATE_CANVAS_ERROR="UPDATE_SYMBOL_MIGRATE_CANVAS_ERROR",o.UPDATE_SYMBOL_PERMISSIONS="UPDATE_SYMBOL_PERMISSIONS",o.UPDATE_FOOTPRINT="UPDATE_FOOTPRINT",o.UPDATE_FOOTPRINT_MIGRATE_CANVAS_ERROR="UPDATE_FOOTPRINT_MIGRATE_CANVAS_ERROR",o.UPDATE_FOOTPRINT_PERMISSIONS="UPDATE_FOOTPRINT_PERMISSIONS",o.UPDATE_D3MODEL="UPDATE_D3MODEL",o.UPDATE_D3MODEL_PERMISSIONS="UPDATE_D3MODEL_PERMISSIONS",o.UPDATE_SIM_MODEL="UPDATE_SIM_MODEL",o.UPDATE_SIM_MODEL_PERMISSIONS="UPDATE_SIM_MODEL_PERMISSIONS",o.UPDATE_PANEL_LIB="UPDATE_PANEL_LIB",o.UPDATE_PANEL_LIB_MIGRATE_CANVAS_ERROR="UPDATE_PANEL_LIB_MIGRATE_CANVAS_ERROR",o.UPDATE_PANEL_LIB_PERMISSIONS="UPDATE_PANEL_LIB_PERMISSIONS",o.DELETE_DEVICE="DELETE_DEVICE",o.DELETE_SYMBOL="DELETE_SYMBOL",o.DELETE_FOOTPRINT="DELETE_FOOTPRINT",o.DELETE_PANEL_LIB="DELETE_PANEL_LIB",o.DELETE_SIM_MODEL="DELETE_SIM_MODEL",o.DELETE_3DMODEL="DELETE_3DMODEL",o))(DIt||{}),gt=class{constructor(o,t=""){this._message=t,this._action=o}get message(){return this._message}set message(o){this._message=o}get action(){return this._action}set action(o){this._action=o}toJSON(){return{message:this.message,action:this.action}}};function Dg(o,t){let e=Object.keys(t);for(let r=0;r<e.length;r++)tSt.indexOf(e[r])<=-1||(e[r]==="title"&&"display_title"in o&&t.title&&(o.display_title=String(t.title),o.title=String(t.title).toLocaleLowerCase()),o[e[r]]=t[e[r]])}function nY(o,t){return o[t]}function Uke(o){let t=o.trim();if(!t||t.length<=0||t.length>128){let e="The title length must be between 1~128 characters!";throw new gt("DEVICE_NAMA_ERROR",e)}}function Hke(o){let t=o.trim();if(!t||t.length<=0||t.length>128){let e="The title length must be between 1~128 characters!";throw new gt("SYMBOL_NAMA_ERROR",e)}}function Wke(o){let t=o.trim();if(!t||t.length<=0||t.length>128){let e="The title length must be between 1~128 characters!";throw new gt("FOOTPRINT_NAMA_ERROR",e)}}function zke(o){let t=o.trim();if(!t||t.length<=0||t.length>128){let e="The title length must be between 1~128 characters!";throw new gt("PANEL_LIB_NAMA_ERROR",e)}}function Yke(o){let t=o.trim();if(!t||t.length<=0||t.length>128){let e="The title length must be between 1~128 characters!";throw new gt("D3MODEL_NAMA_ERROR",e)}}function jke(o){let t=o.trim();if(!t||t.length<=0||t.length>128){let e="The title length must be between 1~128 characters!";throw new gt("SIM_MODEL_NAMA_ERROR",e)}}async function uB(o,t){let e=[],r=[],i=async a=>{let{message:l}=await mn.messageBus.rpcCall(gA.TAG.CREATE,a);return l},n=null;try{for(let a=0;a<o.length;a++){let l=await i({...o[a],path:o[a].user_uuid});if(l.code===0&&l.success){let h={...l,message:"",result:{...o[a],path:o[a].user_uuid,...l.result[0]}};e.push(h),t&&t(h,a);continue}let c={...l,result:{...o[a]}};r.push(c)}return{code:0,success:!0,result:{successList:e,failList:r},message:""}}catch(a){n=a}let s=n?n.msg||n.message:"Add Categories Batch Error";return{code:n?n.code:Ai.ERR_CODE.NORMAL,success:!1,result:null,message:s}}function Tz(o=0,t=Number.MAX_SAFE_INTEGER){return Math.floor(Math.random()*(t-o+1))+o}function Hz(o=36){let t=[],e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let r=0;r<o;r++)t[r]=e.substr(Math.floor(Math.random()*16),1);return t[14]&&(t[14]=String(Tz(1,9))),t[19]&&(t[19]=e.substr(+t[19]&3|8,1)),t[8]&&(t[8]=String(Tz(1,9))),t[13]&&(t[13]=String(Tz(1,9))),t[18]&&(t[18]=String(Tz(1,9))),t[23]&&(t[23]=String(Tz(1,9))),t.join("")}function pNe(o,t=!0){return(e,r)=>{let i=e[o],n=r[o];return typeof i<"u"&&typeof n<"u"?t?i-n:n-i:0}}var wIt=0;async function oY(o,t,e,r,i=!0,n,s){let a=null,l="requestid"+ ++wIt;n&&n(l);let c={user_uuid:o,path:t,type:e};r!==void 0&&(c.bindTypes=r),s&&s(c);try{if(P0.getInstance().hasLib(o))return await LIt(o,e,i);let u=await Jn("GET",qn.TAG.LIST,c,{headers:{path:t},searchParams:!0});if(u.success)return{...u,result:await IIe(u.result,i)}}catch(u){a=u,console.error("Fetch Category List Error",u)}let h=a?a.msg||a.message:void 0;return{code:a?a.code:Ai.ERR_CODE.NORMAL,success:!1,result:null,msg:h||"Fetch Category List Error"}}async function LIt(o,t,e){var r;let i=[];for(let n of t){let s=await((r=P0.getInstance().getLib(o))==null?void 0:r.getCategoryTreeDataItemsByCategoryType(n));s&&i.push(s)}return{code:0,success:!0,result:await IIe(i.flat().map(n=>({uuid:n.id,parent_uuid:n.parentId,user_uuid:o,type:void 0,order_no:void 0,name_cn:void 0,name:n.title,created_at:n.created_at,updated_at:n.updated_at,title:n.title})),e)}}async function MIt(o=!0){let t=null;try{let r=await Jn("POST",qn.TAG.DEVICE_CATE);if(r.success)return{...r,result:await IIe(r.result,o)}}catch(r){t=r,console.error("Fetch Category List Error",r)}let e=t?t.msg||t.message:void 0;return{code:t?t.code:Ai.ERR_CODE.NORMAL,success:!1,result:null,msg:e||"Fetch Category List Error"}}async function IIe(o,t=!0){let e=[],r=[],i=[],n={},s={};o.forEach(u=>{u.name&&(s[u.name]=u.name_cn||u.name)});let a=o.filter(u=>!u.parent_uuid),l=o.filter(u=>!!u.parent_uuid),c=[],h={};if(a.forEach((u,d)=>{c.push(u.uuid),i.push({name:u.name,name_cn:u.name_cn,title:u.name,titleAdditional:u.name_cn||u.name,disableTranslate:u.name_cn===""?!0:u.name_cn===u.name,id:u.uuid,children:[],order_no:+u.order_no||0,parentId:void 0,created_at:u.created_at,updated_at:u.updated_at}),n[u.uuid]=d}),l.forEach(u=>{c.push(u.uuid);let d=n[u.parent_uuid];if(typeof d<"u"&&i[d]){let p=i[d];p.children.push({name:u.name,name_cn:u.name_cn,title:u.name,titleAdditional:u.name_cn||u.name,disableTranslate:u.name_cn===""?!0:u.name_cn===u.name,id:u.uuid,order_no:+u.order_no||0,children:[],parentId:p.id,created_at:u.created_at,updated_at:u.updated_at})}h[u.uuid]=u.parent_uuid}),i.sort(pNe("order_no")),i.forEach(u=>{u.children.length>1&&u.children.sort(pNe("order_no"))}),i.forEach(u=>{e.push({...u})}),t){let u=(await mn.messageBus.rpcCall("I18nTranslateService",{str:Ai.CATEGORY_ITEM_ALL_TITLE})).message;e.unshift({title:Ai.CATEGORY_ITEM_ALL_TITLE,titleAdditional:u||Ai.CATEGORY_ITEM_ALL_TITLE,id:Ai.CATEGORY_ITEM_ALL_VALUE,order_no:Number.MAX_SAFE_INTEGER,disableTranslate:!1,children:[],parentId:void 0}),r.push(Ai.CATEGORY_ITEM_ALL_VALUE)}return{languageHashtable:s,treeData:e,selectedIds:r,categoryIds:c,childCategory2ParentCategoryMap:h,sourceCategoryList:o}}async function gM(o){let{categories:t,type:e,uuid:r}=o,i=await oY(r,r,e),n=i.result?i.result.treeData:[],s=[],a=[],l=[],c=[];for(let m=0;m<t.length;m++){let{parentName:g,childName:y,parent_order_no:b,child_order_no:P}=t[m];if(g){let T=Dy(n,"title",g);if(T.index>=0){if(s.push({name:T.data.title,type:e,user_uuid:r,order_no:T.data.order_no,parent_uuid:void 0,uuid:T.data.id}),y){let E=Dy(T.data.children,"title",y);if(E.index>=0){a.push({name:E.data.title,type:e,user_uuid:r,order_no:E.data.order_no,parent_uuid:T.data.id,uuid:E.data.id});continue}c.push({name:y,type:e,user_uuid:r,order_no:m+1,parent_uuid:T.data.id,uuid:void 0});continue}continue}let I=Hz(),C=Hz();l.push({name:g,type:e,user_uuid:r,order_no:typeof b<"u"?b:m+1,parent_uuid:void 0,uuid:I}),y&&c.push({name:y,type:e,user_uuid:r,order_no:typeof P<"u"?P:m+1,parent_uuid:I,uuid:C})}}let h=[];if(l.length){let m=await uB(l,(g,y)=>{l[y].__remoteId=g.result.uuid});h=m.result?m.result.successList.map(g=>g.result):[]}let u=[];if(c.length){for(let g=0;g<c.length;g++){let y=Dy(l,"uuid",c[g].parent_uuid);y.index>=0&&y.data.__remoteId&&(c[g].parent_uuid=y.data.__remoteId)}let m=await uB(c);u=m.result?m.result.successList.map(g=>g.result):[]}let d=h.concat(s),p=u.concat(a);return{allParentCreated:d,allChildCreated:p}}async function CIe(o){let{uuid:t,path:e,types:r,names:i}=o;return new Promise(async(n,s)=>{let a=await oY(t,e,r,void 0,!1);if(a.code!==0){n({...a,code:Ai.ERR_CODE.NORMAL,success:!1,result:null});return}let l={detail:[],arguments:o},{treeData:c}=a.result;for(let h=0;h<i.length;h++){let u=i[h].primary,d=i[h].secondary,p={primary:{name:u,name_cn:"",uuid:"",exist:!1,undefine:!1},secondary:{name:d,name_cn:"",uuid:"",exist:!1,undefine:!1}};if(typeof u>"u"){p.primary.exist=!1,p.primary.undefine=!0;continue}let m=Dy(c,"title",u);if(m.index<=-1){p.primary.exist=!1,p.secondary.exist=!1,l.detail.push(p);continue}if(p.primary.exist=!0,p.primary.uuid=m.data.id,p.primary.name_cn=m.data.titleAdditional||u,typeof d>"u"){p.secondary.exist=!1,p.secondary.undefine=!0,l.detail.push(p);continue}let g=Dy(m.data.children,"title",d);if(g.index<=-1){p.secondary.exist=!1,l.detail.push(p);continue}p.secondary.exist=!0,p.secondary.uuid=g.data.id,p.secondary.name_cn=g.data.titleAdditional||d,l.detail.push(p)}n({code:0,success:!0,result:l})})}function NIt(o){let t=new Map,e=[];for(let r of o)(!t.has(r.primary)||t.get(r.primary)!==r.secondary)&&(t.set(r.primary,r.secondary),e.push(r));return e}async function Xke(o){try{let{uuid:t,path:e,types:r,names:i}=o,n={primary:i[0],secondary:i[1]},s=await CIe({uuid:t,path:e,types:r,names:[n]});if(!s.success)return{success:!1,code:s.code,message:s.message,result:null};let a=[],{detail:l}=s.result;if(l[0]){let{primary:c,secondary:h}=l[0];c!=null&&c.uuid&&a.push(c==null?void 0:c.uuid),h!=null&&h.uuid&&a.push(h==null?void 0:h.uuid)}return{success:!0,code:0,result:a}}catch(t){return{success:!1,code:Ai.ERR_CODE.NORMAL,message:t.message,result:null}}}async function kIt(o,t,e,r=!1){let i=await CIe(o),n=[],s=[],a=[],l=[],c=[];if(!r&&i.success&&i.result.detail.length){let u=new Map,d=new Map,p=new Map;i.result.detail.forEach((m,g)=>{(m.primary.name||m.primary.name_cn)&&!m.primary.exist&&!u.has(m.primary.name||m.primary.name_cn)&&(u.set(m.primary.name||m.primary.name_cn,!0),n.push({name:m.primary.name||m.primary.name_cn,type:t,user_uuid:e,order_no:0})),(m.primary.name||m.primary.name_cn)&&!m.primary.exist&&(m.secondary.name||m.secondary.name_cn)&&!m.secondary.exist&&d.get(m.secondary.name||m.secondary.name_cn)!==(m.primary.name||m.primary.name_cn)?(d.set(m.secondary.name||m.secondary.name_cn,m.primary.name||m.primary.name_cn),s.push({name:m.secondary.name||m.secondary.name_cn,type:t,user_uuid:e,uuid:m.secondary.uuid,order_no:0,parent_uuid:m.primary.uuid,parent_title:m.primary.name||m.primary.name_cn})):m.primary.exist&&(m.secondary.name||m.secondary.name_cn)&&!m.secondary.exist&&d.get(m.secondary.name||m.secondary.name_cn)!==(m.primary.name||m.primary.name_cn)&&(d.set(m.secondary.name||m.secondary.name_cn,m.primary.name||m.primary.name_cn),s.push({name:m.secondary.name||m.secondary.name_cn,type:t,user_uuid:e,uuid:m.secondary.uuid,order_no:0,parent_uuid:m.primary.uuid,parent_title:m.primary.name||m.primary.name_cn})),m.primary.exist&&!p.has(m.primary.uuid)&&(p.set(m.primary.uuid,m.primary.name||m.primary.name_cn),c.push({title:m.primary.name||m.primary.name_cn,uuid:m.primary.uuid,parent_uuid:""})),m.secondary.exist&&!p.has(m.secondary.uuid)&&(p.set(m.secondary.uuid,m.secondary.name||m.secondary.name_cn),c.push({title:m.secondary.name||m.secondary.name_cn,uuid:m.secondary.uuid,parent_uuid:m.primary.uuid}))})}if(!r&&n.length){let u=await uB(n);if(u.success&&u.result.successList.length&&(a=u.result.successList.map(d=>d.result),s.forEach(d=>{a.forEach(p=>{!d.parent_uuid&&d.parent_title===p.name&&(d.parent_uuid=p.uuid)})})),s.length){let d=await uB(s);d.success&&d.result.successList.length&&(l=d.result.successList.map(p=>p.result))}}else if(!r&&s.length){let u=await uB(s);u.success&&u.result.successList.length&&(l=u.result.successList.map(d=>d.result))}let h=[];return h=a.map(u=>({uuid:u.uuid,title:u.name,name:u.name,parent_uuid:u.parent_uuid})),h=h.concat(l.map(u=>({uuid:u.uuid,parent_uuid:u.parent_uuid,title:u.name,name:u.name}))),h=h.concat(c),h}async function BIt(o,t){let e=[],r=[],i=async a=>{let{message:l}=await mn.messageBus.rpcCall(gA.TAG.DELETE,a);return l},n=null;try{for(let a=0;a<o.length;a++){let l=await i({...o[a],path:o[a].user_uuid});if(l.code===0&&l.success){let h={...l,message:"",result:{...o[a],path:o[a].user_uuid,...l.result[0]}};e.push(h),t&&t(h,a);continue}let c={...l,result:{...o[a]}};r.push(c)}return{code:0,success:!0,result:{successList:e,failList:r},message:""}}catch(a){n=a}let s=n?n.msg||n.message:"Del Categories Batch Error";return{code:n?n.code:Ai.ERR_CODE.NORMAL,success:!1,result:null,message:s}}async function FIt(o){let{uuid:t,path:e,types:r,ids:i}=o;return new Promise(async(n,s)=>{let a=await oY(t,e,r,void 0,!1);if(a.code!==0){n({...a,code:Ai.ERR_CODE.NORMAL,success:!1,result:null});return}let l={detail:[],arguments:o},{treeData:c}=a.result;for(let h=0;h<i.length;h++){let u=i[h].primary,d=i[h].secondary,p={primary:{name:"",name_cn:"string",uuid:u,exist:!1,undefine:!1},secondary:{name:"",name_cn:"string",uuid:d,exist:!1,undefine:!1}};if(typeof u>"u"){p.primary.exist=!1,p.primary.undefine=!0;continue}let m=Dy(c,"id",u);if(m.index<=-1){p.primary.exist=!1,p.secondary.exist=!1,l.detail.push(p);continue}if(p.primary.exist=!0,p.primary.name=m.data.title,p.primary.name_cn=m.data.titleAdditional||p.primary.name,typeof d>"u"){p.secondary.exist=!1,p.secondary.undefine=!0;continue}let g=Dy(m.data.children,"id",d);if(g.index<=-1){p.secondary.exist=!1,l.detail.push(p);continue}p.secondary.exist=!0,p.secondary.name=g.data.title,p.secondary.name_cn=g.data.titleAdditional||p.secondary.name,l.detail.push(p)}n({code:0,success:!0,result:l})})}var VIt=class{constructor(){this._actuatorMap=new Map}clearAll(){this._actuatorMap.clear()}async addActuator(o,t,e,r){let i=o.filter(u=>!!u),n=`${i[0]}_${t[0]||0}_${e}_${r}`,s=`${i[0]}_${i[1]}_${t[1]||t[0]||0}_${e}_${r}`;if(!i[1]){if(this._actuatorMap.has(n))return this._actuatorMap.get(n);let u=new Promise(async(d,p)=>{let m=await gM({categories:[{parentName:i[0],parent_order_no:t[0]||0}],type:[r],uuid:e});d({uuids:m.allParentCreated.map(g=>g.uuid),titles:m.allParentCreated.map(g=>g.name)}),this._actuatorMap.delete(n)});return this._actuatorMap.set(n,u),u}let a=this._actuatorMap.get(n);a||(a=new Promise(async(u,d)=>{let p=await gM({categories:[{parentName:i[0],parent_order_no:t[0]||0}],type:[r],uuid:e});u({uuids:p.allParentCreated.map(m=>m.uuid),titles:p.allParentCreated.map(m=>m.name)}),this._actuatorMap.delete(n)}),this._actuatorMap.set(n,a));let l=await a,c=this._actuatorMap.get(s);c||(c=new Promise(async(u,d)=>{let p=await gM({categories:[{parentName:i[0],childName:i[1],parent_order_no:t[0]||0,child_order_no:t[1]||t[0]||0}],type:[r],uuid:e});u({uuids:p.allChildCreated.map(m=>m.uuid),titles:p.allChildCreated.map(m=>m.name)}),this._actuatorMap.delete(s)}),this._actuatorMap.set(s,c));let h=await c;return{uuids:[l.uuids[0],h.uuids[0]],titles:[l.titles[0],h.titles[0]]}}};async function GIt(o,t){let e=[],r=[],i=async a=>{let{message:l}=await mn.messageBus.rpcCall(gA.TAG.UPDATE,a);return l},n=null;try{for(let a=0;a<o.length;a++){let l=await i({...o[a],path:o[a].user_uuid});if(l.code===0&&l.success){let h={...l,message:"",result:{...o[a],path:o[a].user_uuid,...l.result[0]}};e.push(h),t&&t(h,a);continue}let c={...l,result:{...o[a]}};r.push(c)}return{code:0,success:!0,result:{successList:e,failList:r},message:""}}catch(a){n=a}let s=n?n.msg||n.message:"Update Categories Batch Error";return{code:n?n.code:Ai.ERR_CODE.NORMAL,success:!1,result:null,message:s}}var lm=class{};lm.categoryAddtition=new VIt,lm.fetchCategoryList=oY,lm.fetchInternalCategoryList=MIt,lm.addCategoriesBatch=uB,lm.deleteCategoriesBatch=BIt,lm.updateCategoriesBatch=GIt,lm.addCategoriesBatchByNameArray=gM,lm.queryCategoryBatchByNames=CIe,lm.queryCategoryBatchByIds=FIt,lm.formatRepeatCategoryArr=NIt,lm.bindAndCreateCategory=kIt,lm.getCategoryNamesByTags=PA;async function PA(o,t,e){if(!o)return[];if(o instanceof Array)return o;let r=px(o);if(r=r.filter(c=>!!c),!r.length)return[];let i=(await mn.messageBus.rpcCall("LocaleCurrFetch",{})).message||"en",n=await oY(t,t,e),s=n.result?n.result.sourceCategoryList:[],a=typeof r[1]<"u",l=[];for(let c=0;c<s.length;c++)if(s[c].name===r[0]||s[c].name_cn===r[0]){l.push(i=="en"?s[c].name:s[c].name_cn||s[c].name);break}if(a){for(let c=0;c<s.length;c++)if(s[c].name===r[1]||s[c].name_cn===r[1]){l.push(i=="en"?s[c].name:s[c].name_cn||s[c].name);break}}return l}async function qke(o,t,e){let r=null,i=null,n=[],s=[],a=!1,l,c;if(o)if("data"in o)r=o.data,r.tags&&(r.tags instanceof Array?s=r.tags:s=px(r.tags));else{if(!o.uuid||!o.path)throw new gt("PARAMETER_VERIFICATION","missing 3d-model uuid or path data.");l=o.uuid,c=o.path,i=await iu.getD3Model({isProject:o.isProject,uuid:o.uuid,path:o.path}),i&&(i.title=i.display_title,s=await PA(i.tags,o.path,[5]))}if(!e){let h=await lm.categoryAddtition.addActuator(s,[0],t,5);n=h.uuids,s=h.titles}return{d3modelItemOriginUuid:l,d3modelItemOriginPath:c,d3modelItemIn:r,d3modelItemOut:i,d3modelTagIds:n,d3modelTagTitles:s}}function IB(o){return o?{uuid:o.uuid,nickname:o.nickname,username:o.username}:{}}function UIt(o){return Array.isArray(o)?o:o?[o]:[]}function CB(o){return o?{uuid:o.uuid,nickname:o.nickname,username:o.username}:{}}function SB(o){return o?{uuid:o.uuid,nickname:o.nickname,username:o.username}:{}}function $ke(o,t){return{title:t.title,description:t.description,images:UIt(t.images),attributes:t.attributes,uuid:t.uuid,path:gB(t)||o,ticket:t.ticket,updateTime:D1(t.updateTime),createTime:D1(t.createTime),display_title:t.display_title,creator:IB(t.creator),modifier:CB(t.modifier),owner:SB(t.owner),symbol_type:t.symbol_type}}function fx(o,t){return{...$ke(o,t),isFavorite:t.isFavorite,tags:t.tags,produce_code:t.produce_code}}function See(o,t){return{...$ke(o,t),custom_tags:t.custom_tags,source:t.source,version:t.version}}function Kke(o,t){return{title:t.title,description:t.description,docType:t.docType,path:gB(t)||o,uuid:t.uuid,ticket:t.ticket,updateTime:D1(t.updateTime),createTime:D1(t.createTime),display_title:t.display_title,creator:IB(t.creator),modifier:CB(t.modifier),owner:SB(t.owner)}}function IE(o,t){return{...Kke(o,t),tags:t.tags,has_device:t.has_device,history_uuid:t.history_uuid,key:t.key,iv:t.iv,dataStrId:t.dataStrId,dataStr:t.dataStr,isFavorite:t.isFavorite}}function yTe(o,t){return{...Kke(o,t),custom_tags:t.custom_tags,source:t.source,version:t.version}}function Zke(o,t){return{title:t.title,description:t.description,docType:t.docType,uuid:t.uuid,path:gB(t)||o,ticket:t.ticket,updateTime:D1(t.updateTime),createTime:D1(t.createTime),display_title:t.display_title,creator:IB(t.creator),modifier:CB(t.modifier),owner:SB(t.owner)}}function CE(o,t){return{...Zke(o,t),tags:t.tags,has_device:t.has_device,history_uuid:t.history_uuid,key:t.key,iv:t.iv,dataStrId:t.dataStrId,dataStr:t.dataStr,isFavorite:t.isFavorite}}function bTe(o,t){return{...Zke(o,t),custom_tags:t.custom_tags,source:t.source,version:t.version}}async function EB(o,t){return{title:t.title,description:t.description,path:gB(t)||o,docType:t.docType,uuid:t.uuid,ticket:t.ticket,updateTime:D1(t.updateTime),createTime:D1(t.createTime),display_title:t.display_title,creator:IB(t.creator),modifier:CB(t.modifier),owner:SB(t.owner),tags:t.tags,dataStrId:t.dataStrId,dataStr:await tY(t)}}function EM(o,t){return{title:t.title,description:t.description,path:gB(t)||o,docType:t.docType,uuid:t.uuid,ticket:t.ticket,updateTime:D1(t.updateTime),createTime:D1(t.createTime),display_title:t.display_title,creator:IB(t.creator),modifier:CB(t.modifier),owner:SB(t.owner),tags:t.tags,history_uuid:t.history_uuid,key:t.key,iv:t.iv,dataStr:t.dataStr,dataStrId:t.dataStrId,isFavorite:t.isFavorite}}async function OM(o,t){return{title:t.title,path:gB(t)||o,docType:t.docType,uuid:t.uuid,ticket:t.ticket,updateTime:D1(t.updateTime),createTime:D1(t.createTime),display_title:t.display_title,creator:IB(t.creator),modifier:CB(t.modifier),owner:SB(t.owner),tags:t.tags,history_uuid:t.history_uuid,key:t.key,iv:t.iv,dataStrId:t.dataStrId,dataStr:await tY(t)}}async function HIt(o){let{d3modelItemIn:t,d3modelItemOut:e,d3modelTagIds:r,d3modelTagTitles:i}=await qke(o.d3model,o.path,o.isProject),n=t||e;if(!n)throw new gt("PARAMETER_VERIFICATION","missing 3d-model data.");Yke(n.title),"path"in o.d3model&&o.d3model.override&&Dg(n,o.d3model.override);let s=await Jn("POST",qn.COMPONENT.CREATE,{...n,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success){let l=s.result;return await EB(o.path,l)}let a=s.message||s.msg||"Request Error.";throw MI(s.code)?new gt("D3MODEL_SAME_NAMA_EXISTS",a):sT(s.code)?new gt("CREATE_D3MODEL_PERMISSIONS",a):new gt("CREATE_D3MODEL",a)}async function Qee(o=!1,t,e,r,i,n){let s=t.toLocaleLowerCase(),a=n?!!n.forceAsSymbol:!1,l=[];try{if(a||r&&[2,18,19,20,21,22,25,31,7,32,6].indexOf(r)>=0){let c={isProject:o,path:e,titles:[s],docType:r};l=(await iu.getSymbolSearchList(c))[s]||[]}if(r===28){let c={isProject:o,path:e,titles:[s]};l=(await iu.getDeviceSearchList(c))[s]||[]}if(r===4){let c={isProject:o,path:e,titles:[s]};l=(await iu.getFootprintSearchList(c))[s]||[]}return r===16&&(l=(await iu.getD3ModelSearchList({isProject:o,uid:e,path:e,page:1,pageSize:void 0,wd:s})).lists),{code:0,success:!0,result:l,message:""}}catch(c){return console.error(c),{code:-1,success:!1,result:[],message:c instanceof gt?`${String(c.action)}|${String(c.message)}`:c.message||"QueryComponentsByTitle call error."}}}function fNe(o,t){return o.path==t}function mNe(o){try{let t=JSON.parse(o);return{parentName:t[0],childName:t[1]}}catch{return{parentName:"",childName:""}}}function WIt(o){let t={};return t["device-owner"]=o.userIdSelected,t["device-lib"]=o.userIdSelected,t["footprint-name"]=o.footprintItem?o.footprintItem.display_title:"",t["symbol-name"]=o.symbolItem?o.symbolItem.display_title:"",t["new-symbol"]=o.isNeedCreateSymbolAndAssocia,t}function Jke(o,t){typeof o.footprintItemId<"u"&&(t.Footprint=o.footprintItemId),typeof o.symbolItemId<"u"&&(t.Symbol=o.symbolItemId)}async function Qke(o,t){let e=WIt(o),r=o.footprintItem,i=o.symbolItem,n={},s=async(T,I)=>{let C="",E="",O=!1,_=t==="zh-hans",R=T.parent_tag,v=T.child_tag;if(R&&R.uuid&&(O=!0,C=_&&R.name_cn||R.name),O&&v&&v.uuid){let D=_&&v.name_cn||v.name;C+=`:${D}`}if(C){let D=C.split(":")[0],w=C.split(":")[1],F=await gM({categories:w?[{parentName:D,childName:w}]:[{parentName:D}],type:[+I],uuid:e["device-owner"]}),H=F.allParentCreated[0]?F.allParentCreated[0].uuid:void 0,z=F.allChildCreated[0]?F.allChildCreated[0].uuid:void 0;H&&(E=z?[H,z]:[H])}return E},a={"file-owner":e["device-owner"],"file-name":e["footprint-name"],"file-describe":"","file-category":await s((r==null?void 0:r.tags)||{},4),"file-lib":e["device-lib"],"file-customTags":[]};if(r&&r!=null&&r.custom_tags&&!(a!=null&&a["file-category"])){let{parentName:T,childName:I}=mNe(r.custom_tags);if(T){let C=await gM({categories:I?[{parentName:T,childName:I}]:[{parentName:T}],type:[4],uuid:e["device-owner"]}),E=C.allParentCreated[0]?C.allParentCreated[0].uuid:void 0,O=C.allChildCreated[0]?C.allChildCreated[0].uuid:void 0;E&&(a["file-customTags"]=O?[E,O]:[E])}}let l={"file-owner":e["device-owner"],"file-name":e["symbol-name"],"file-describe":"","file-category":await s((i==null?void 0:i.tags)||{},2),"file-lib":e["device-lib"],"file-customTags":[]};if(i&&i!=null&&i.custom_tags&&!l["file-category"]){let{parentName:T,childName:I}=mNe(i.custom_tags);if(T){let C=await gM({categories:I?[{parentName:T,childName:I}]:[{parentName:T}],type:[4],uuid:e["device-owner"]}),E=C.allParentCreated[0]?C.allParentCreated[0].uuid:void 0,O=C.allChildCreated[0]?C.allChildCreated[0].uuid:void 0;E&&(l["file-customTags"]=O?[E,O]:[E])}}let c,h,u,d,p=!1,m=!1,g=!1;async function y(){if(e["footprint-name"])if(fNe(r,e["device-owner"]||e["device-lib"]))u=r,c=null;else{let T=await Qee(!1,a["file-name"],e["device-lib"],4);T.result.length<=0||(m=!0,u=r,c=T.result)}else u=null,c=null}async function b(){if(!e["new-symbol"]&&e["symbol-name"]&&i)if(fNe(i,e["device-owner"]||e["device-lib"]))d=i,h=null;else{let T=await Qee(!1,l["file-name"],e["device-lib"],i.docType);T.result.length<=0||(p=!0,h=T.result,d=i)}else d=null,h=null}await y(),await b();let P={isNeedConfirm:!1,updateCache:n,formData:e,newFootPrint:c,oldFootPrint:u,newSymbol:h,oldSymbol:d,confirmRes:o};return!p&&!m&&!g?(P.isNeedConfirm=!1,P):(P.isNeedConfirm=!0,P)}async function SIe(o,t,e,r){let i=null,n=null,s=[],a=[],l=!1,c,h;if(o)if("data"in o)o.data&&(i=o.data,i.tags&&(i.tags instanceof Array?a=i.tags:a=px(i.tags)));else{if(!o.uuid||!o.path)throw new gt("PARAMETER_VERIFICATION","missing footprint uuid or path data.");c=o.uuid,h=o.path,n=await iu.getFootprint({isProject:o.isProject,uuid:o.uuid,path:o.path}),n&&(n.title=n.display_title,r&&Array.isArray(r)?a=r:a=await PA(n.tags,o.path,[4]))}if(!e){let u=await lm.categoryAddtition.addActuator(a,[0],t,4);s=u.uuids,a=u.titles}return{footprintItemOriginUuid:c,footprintItemOriginPath:h,footprintItemIn:i,footprintItemOut:n,footprintTagIds:s,footprintTagTitles:a}}async function EIe(o,t,e,r){let i=null,n=null,s=[],a=[],l=!1,c,h;if(o)if("data"in o)o.data&&(i=o.data,i.tags&&(i.tags instanceof Array?a=i.tags:a=px(i.tags)));else{if(!o.uuid||!o.path)throw new gt("PARAMETER_VERIFICATION","missing symbol uuid or path data.");c=o.uuid,h=o.path,n=await iu.getSymbol({isProject:o.isProject,uuid:o.uuid,path:o.path}),n&&(n.title=n.display_title,r&&Array.isArray(r)?a=r:a=await PA(n.tags,o.path,[2])),l=o.isProject}if(!e){let u=await lm.categoryAddtition.addActuator(a,[0],t,2);s=u.uuids,a=u.titles}return{symbolItemOriginUuid:c,symbolItemOriginPath:h,symbolItemIn:i,symbolItemOut:n,symbolTagIds:s,symbolTagTitles:a}}async function eBe(o,t,e,r){let i=null,n=null,s=[],a=[],l=!1;if(o)if("data"in o)o.data&&(i=o.data,i.tags&&(i.tags instanceof Array?a=i.tags:a=px(i.tags)));else{if(!o.uuid||!o.path)throw new gt("PARAMETER_VERIFICATION","missing device uuid or path data.");n=await iu.getDevice({isProject:o.isProject,uuid:o.uuid,path:o.path}),n&&(n.title=n.display_title,r&&Array.isArray(r)?a=r:a=await PA(n.tags,o.path,[3])),l=o.isProject}if(!e){let c=await lm.categoryAddtition.addActuator(a,[0],t,3);s=c.uuids,a=c.titles}return{deviceItemIn:i,deviceItemOut:n,deviceTagIds:s,deviceTagTitles:a,isDeviceFromProject:l}}async function tBe(o,t,e,r,i,n){let s=null,a=null,l=[],c=[],h,u;if(o){let{symbolItemIn:d,symbolItemOut:p,symbolTagIds:m,symbolTagTitles:g,symbolItemOriginUuid:y,symbolItemOriginPath:b}=await EIe(o,e,r,"path"in o&&o.override&&Array.isArray(o.override.tags)?o.override.tags:void 0);s=d,a=p,l=m,c=g,h=y,u=b}else if(i)if(n){let d=await iu.getSymbol({isProject:t,uuid:i,path:n});if(h=i,u=n,d){d.title=d.display_title,a=d,c=await PA(d.tags,n,[2]);let p=await lm.categoryAddtition.addActuator(c,[0],e,2);l=p.uuids,c=p.titles}}else{let d=null;try{d=await iu.getSymbol({isProject:t,uuid:i,path:e}),h=i,u=e}catch(p){d=null,h=i,u=e,console.warn(p)}d||console.warn("[NOSYMBOL_ON_TARGETPATH_BY_DEVICE_BOUND]: the symbol bound to this device does not exist in the target library.")}return{symbolItemOriginUuid:h,symbolItemOriginPath:u,symbolItemIn:s,symbolItemOut:a,symbolTagIds:l,symbolTagTitles:c}}async function rBe(o,t,e,r,i,n){let s=null,a=null,l=[],c=[],h,u;if(o){let{footprintItemIn:d,footprintItemOut:p,footprintTagIds:m,footprintTagTitles:g,footprintItemOriginUuid:y,footprintItemOriginPath:b}=await SIe(o,e,r,"path"in o&&o.override&&Array.isArray(o.override.tags)?o.override.tags:void 0);s=d,a=p,l=m,c=g,h=y,u=b}else if(i)if(n){let d=await iu.getFootprint({isProject:t,uuid:i,path:n});if(h=i,u=n,d){d.title=d.display_title,a=d,c=await PA(d.tags,n,[4]);let p=await lm.categoryAddtition.addActuator(c,[0],e,4);l=p.uuids,c=p.titles}}else{let d=null;try{d=await iu.getFootprint({isProject:t,uuid:i,path:e}),h=i,u=e}catch(p){d=null,h=i,u=e,console.warn(p)}d||console.warn("[NOFOOTPRINT_ON_TARGETPATH_BY_DEVICE_BOUND]: the footprint bound to this device does not exist in the target library.")}return{footprintItemOriginUuid:h,footprintItemOriginPath:u,footprintItemIn:s,footprintItemOut:a,footprintTagIds:l,footprintTagTitles:c}}async function iBe(o,t,e,r,i,n){if(!r)return;let s=null;if("data"in r)i.title&&(s=await iu.createSymbol({isProject:o,path:t,symbol:{data:{...i,tags:n},ignoreDuplicateNameCheck:r.ignoreDuplicateNameCheck}})),e.attributes&&s&&typeof s=="object"&&(e.attributes.Symbol=s.uuid);else{r.override&&Dg(i,r.override);try{s=await iu.getSymbol({isProject:o,path:t,uuid:r.uuid})}catch{s=null}if(s&&typeof s=="object")e.attributes&&(e.attributes.Symbol=s.uuid);else if(i.title&&(s=await iu.createSymbol({isProject:o,path:t,symbol:{data:{...i,tags:n},ignoreDuplicateNameCheck:r.ignoreDuplicateNameCheck}})),e.attributes&&s&&typeof s=="object"){e.attributes.Symbol=s.uuid;let a=await dx({origin:{docType:i.docType,isProject:r.isProject,uuid:r.uuid,path:r.path},target:{docType:s.docType,isProject:o,uuid:s.uuid,path:s.path}});if(!a.success)throw new gt("CREATE_SYMBOL_MIGRATE_CANVAS_ERROR",a.message||"migrate canvas error.")}}}async function nBe(o,t,e,r,i,n){if(!r)return;let s=null;if("data"in r)i.title&&(s=await iu.createFootprint({isProject:o,path:t,footprint:{data:{...i,tags:n}}})),e.attributes&&s&&typeof s=="object"&&(e.attributes.Footprint=s.uuid);else{r.override&&Dg(i,r.override);try{s=await iu.getFootprint({isProject:o,path:t,uuid:r.uuid})}catch{s=null}if(s&&typeof s=="object")e.attributes&&(e.attributes.Footprint=s.uuid);else if(i.title&&(s=await iu.createFootprint({isProject:o,path:t,footprint:{data:{...i,tags:n}}})),e.attributes&&s&&typeof s=="object"){e.attributes.Footprint=s.uuid;let a=await dx({origin:{docType:i.docType,isProject:r.isProject,uuid:r.uuid,path:r.path},target:{docType:s.docType,isProject:o,uuid:s.uuid,path:s.path}});if(!a.success)throw new gt("CREATE_FOOTPRINT_MIGRATE_CANVAS_ERROR",a.message||"migrate canvas error.")}}}async function zIt(o){let{deviceItemIn:t,deviceItemOut:e,deviceTagIds:r,deviceTagTitles:i,isDeviceFromProject:n}=await eBe(o.device,o.path,o.isProject,"path"in o.device&&o.device.override&&Array.isArray(o.device.override.tags)?o.device.override.tags:void 0),s=t||e;if(!s)throw new gt("PARAMETER_VERIFICATION","missing device data.");s.title=o.device&&"path"in o.device&&o.device.override&&nY(o.device.override,"title")||s.title,Uke(s.title);let{symbolItemIn:a,symbolItemOut:l,symbolTagIds:c,symbolTagTitles:h,symbolItemOriginUuid:u,symbolItemOriginPath:d}=await tBe(o.symbol,n,o.path,o.isProject,s.attributes?s.attributes.Symbol:void 0,"data"in o.device?void 0:o.device.path),p=a||l,m=!!(o.symbol&&"data"in o.symbol);s.attributes&&l&&typeof l=="object"&&(s.attributes.Symbol=l.uuid),o.symbol&&"path"in o.symbol&&o.symbol.override&&Dg(p,o.symbol.override);let{footprintItemIn:g,footprintItemOut:y,footprintTagIds:b,footprintTagTitles:P,footprintItemOriginUuid:T,footprintItemOriginPath:I}=await rBe(o.footprint,n,o.path,o.isProject,s.attributes?s.attributes.Footprint:void 0,"data"in o.device?void 0:o.device.path),C=g||y;o.footprint&&"path"in o.footprint&&o.footprint.override&&Dg(C,o.footprint.override),s.attributes&&y&&typeof y=="object"&&(s.attributes.Footprint=y.uuid);let E=!1,O=!1,_=await Qke({symbolItem:p,footprintItem:C,userIdSelected:o.path,isNeedCreateSymbolAndAssocia:m},void 0);if(_.isNeedConfirm){let D=(await mn.messageBus.rpcCall("OpenSameNameSaveAsDlgService",{..._},31536e8)).message;if(!D){let w="an exception occurred while executing the cross-bind program.";throw new gt("CROSS_BIND",w)}if(D.action==="cancel"||D.action==="close"){let w="quit operate while executing the cross-bind program.";throw new gt("CROSS_BIND_EXIT",w)}_.updateCache=D.data,s.attributes&&Object.keys(_.updateCache).length&&(_.updateCache.symbolItemId&&(E=!0),_.updateCache.footprintItemId&&(O=!0),Jke(_.updateCache,s.attributes))}!E&&p&&await iBe(o.isProject,o.path,s,o.symbol,p,h),!O&&C&&await nBe(o.isProject,o.path,s,o.footprint,C,P),"path"in o.device&&o.device.override&&(delete o.device.override.tags,Dg(s,o.device.override));let R=await Jn("POST",qn.DEVICE.CREATE,{...s,tags:r,owner:o.path,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(R.code===0&&R.success){let D=R.result;return fx(o.path,D)}let v=R.message||R.msg||"Request Error.";throw MI(R.code)?new gt("DEVICE_SAME_NAMA_EXISTS",v):sT(R.code)?new gt("CREATE_DEVICE_PERMISSIONS",v):new gt("CREATE_DEVICE",v)}async function YIt(o){let{footprintItemIn:t,footprintItemOut:e,footprintTagIds:r,footprintTagTitles:i}=await SIe(o.footprint,o.path,o.isProject,"path"in o.footprint&&o.footprint.override&&Array.isArray(o.footprint.override.tags)?o.footprint.override.tags:void 0),n=t||e;if(!n)throw new gt("PARAMETER_VERIFICATION","missing footprint data.");n.title="path"in o.footprint&&o.footprint.override&&nY(o.footprint.override,"title")||n.title,Wke(n.title),"path"in o.footprint&&o.footprint.override&&(delete o.footprint.override.tags,Dg(n,o.footprint.override));let s=await Jn("POST",qn.COMPONENT.CREATE,{title:n.title,tags:r,docType:n.docType||4,description:n.description,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success){let l=s.result;if(!("data"in o.footprint)&&o.footprint.uuid&&o.footprint.path){let c=await dx({origin:{docType:n.docType,isProject:!!o.footprint.isProject,uuid:o.footprint.uuid,path:o.footprint.path},target:{docType:l.docType,isProject:!1,uuid:l.uuid,path:l.path}});if(!c.success)throw new gt("CREATE_FOOTPRINT_MIGRATE_CANVAS_ERROR",c.message||"migrate canvas error.")}return CE(o.path,l)}let a=s.message||s.msg||"Request Error.";throw MI(s.code)?new gt("FOOTPRINT_SAME_NAMA_EXISTS",a):sT(s.code)?new gt("CREATE_FOOTPRINT_PERMISSIONS",a):new gt("CREATE_FOOTPRINT",a)}async function oBe(o,t,e,r){let i=null,n=null,s=[],a=[],l=!1,c,h;if(o)if("data"in o)i=o.data,i.tags&&(i.tags instanceof Array?a=i.tags:a=px(i.tags));else{if(!o.uuid||!o.path)throw new gt("PARAMETER_VERIFICATION","missing simModel uuid or path data.");c=o.uuid,h=o.path,n=await iu.getSimModel({isProject:o.isProject,uuid:o.uuid,path:o.path}),n&&(n.title=n.display_title,r&&Array.isArray(r)?a=r:a=await PA(n.tags,o.path,[6]))}if(!e){let u=await lm.categoryAddtition.addActuator(a,[0],t,6);s=u.uuids,a=u.titles}return{simModelItemOriginUuid:c,simModelItemOriginPath:h,simModelItemIn:i,simModelItemOut:n,simModelTagIds:s,simModelTagTitles:a}}async function jIt(o){let{simModelItemIn:t,simModelItemOut:e,simModelTagIds:r,simModelTagTitles:i}=await oBe(o.simModel,o.path,o.isProject,"path"in o.simModel&&o.simModel.override&&Array.isArray(o.simModel.override.tags)?o.simModel.override.tags:void 0),n=t||e;if(!n)throw new gt("PARAMETER_VERIFICATION","missing sim-model data.");n.title="path"in o.simModel&&o.simModel.override&&nY(o.simModel.override,"title")||n.title,jke(n.title),"path"in o.simModel&&o.simModel.override&&(delete o.simModel.override.tags,Dg(n,o.simModel.override));let s=await Jn("POST",qn.COMPONENT.CREATE,{...n,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success){let l=s.result;return await OM(o.path,l)}let a=s.message||s.msg||"Request Error.";throw MI(s.code)?new gt("SIM_MODEL_SAME_NAMA_EXISTS",a):sT(s.code)?new gt("CREATE_SIM_MODEL_PERMISSIONS",a):new gt("CREATE_SIM_MODEL",a)}async function XIt(o){let{symbolItemIn:t,symbolItemOut:e,symbolTagIds:r,symbolTagTitles:i}=await EIe(o.symbol,o.path,o.isProject,"path"in o.symbol&&o.symbol.override&&Array.isArray(o.symbol.override.tags)?o.symbol.override.tags:void 0),n=t||e;if(!n)throw new gt("PARAMETER_VERIFICATION","missing symbol data.");n.title="path"in o.symbol&&o.symbol.override&&nY(o.symbol.override,"title")||n.title,Hke(n.title),"path"in o.symbol&&o.symbol.override&&(delete o.symbol.override.tags,Dg(n,o.symbol.override));let s=await Jn("POST",qn.COMPONENT.CREATE,{title:n.title,tags:r,docType:n.docType,description:n.description,owner:o.path,ignoreDuplicateNameCheck:o.symbol.ignoreDuplicateNameCheck},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success){let l=s.result;if(!("data"in o.symbol)&&o.symbol.uuid&&o.symbol.path){let c=await dx({origin:{docType:n.docType,isProject:!!o.symbol.isProject,uuid:o.symbol.uuid,path:o.symbol.path},target:{docType:l.docType,isProject:!1,uuid:l.uuid,path:l.path}});if(!c.success)throw new gt("CREATE_SYMBOL_MIGRATE_CANVAS_ERROR",c.message||"migrate canvas error.")}return IE(o.path,l)}let a=s.message||s.msg||"Request Error.";throw MI(s.code)?new gt("SYMBOL_SAME_NAMA_EXISTS",a):sT(s.code)?new gt("CREATE_SYMBOL_PERMISSIONS",a):new gt("CREATE_SYMBOL",a)}async function qIt(o){let t=await Jn("GET",eh(qn.DEVICE.GET,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result;if(typeof r.path<"u"&&r.path!==o.path)throw new gt("GET_DEVICE_NOT_FOUND","data not found");return fx(o.path,r)}let e=t.message||t.msg||"Request Error.";throw new gt("GET_DEVICE",e)}async function $It(o){let t=await Jn("GET",eh(qn.COMPONENT.GET,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result;if(typeof r.path<"u"&&r.path!==o.path)throw new gt("GET_FOOTPRINT_NOT_FOUND","data not found");return CE(o.path,r)}let e=t.message||t.msg||"Request Error.";throw new gt("GET_FOOTPRINT",e)}async function KIt(o){let t=await Jn("GET",eh(qn.COMPONENT.GET,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result;return await OM(o.path,r)}let e=t.message||t.msg||"Request Error.";throw new gt("GET_SIM_MODEL",e)}function MS(o={}){let t={},e=Object.keys(o);for(let r=0;r<e.length;r++)e[r]===""||String(e[r])==="undefined"||typeof o[e[r]]>"u"||o[e[r]]==null||(t[e[r]]=o[e[r]]);return t}async function ZIt(o){let t=await Jn("GET",qn.COMPONENT.LIST,{...MS(o.query||{}),path:o.path,uid:o.uid,page:o.page,pageSize:o.pageSize,docType:o.docType,tag:o.tags||[]},{headers:{path:o.path},searchParams:!0});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result,i=[];for(let n of r.lists)i.push(await OM(o.path,n));return{count:r.count,page:r.page,pageSize:r.pageSize,totalPage:r.totalPage,lists:i}}let e=t.message||t.msg||"Request Error.";throw new gt("GET_SIM_MODEL_LIST",e)}async function JIt(o){let t=await Jn("GET",eh(qn.COMPONENT.GET,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result;if(typeof r.path<"u"&&r.path!==o.path)throw new gt("GET_SYMBOL_NOT_FOUND","data not found");return IE(o.path,r)}let e=t.message||t.msg||"Request Error.";throw new gt("GET_SYMBOL",e)}async function QIt(o){let{deviceItemIn:t,deviceItemOut:e,deviceTagIds:r,deviceTagTitles:i,isDeviceFromProject:n}=await eBe(o.device,o.path,o.isProject,"path"in o.device&&o.device.override&&Array.isArray(o.device.override.tags)?o.device.override.tags:void 0),s=t||e;if(!s)throw new gt("PARAMETER_VERIFICATION","missing device data.");s.title!==void 0&&Uke(s.title);let{symbolItemIn:a,symbolItemOut:l,symbolTagIds:c,symbolTagTitles:h,symbolItemOriginUuid:u,symbolItemOriginPath:d}=await tBe(o.symbol,n,o.path,o.isProject,s.attributes?s.attributes.Symbol:void 0,"data"in o.device?void 0:o.device.path),p=a||l,m=!!(o.symbol&&"data"in o.symbol);o.symbol&&"path"in o.symbol&&o.symbol.override&&Dg(p,o.symbol.override),s.attributes&&l&&typeof l=="object"&&(s.attributes.Symbol=l.uuid);let{footprintItemIn:g,footprintItemOut:y,footprintTagIds:b,footprintTagTitles:P,footprintItemOriginUuid:T,footprintItemOriginPath:I}=await rBe(o.footprint,n,o.path,o.isProject,s.attributes?s.attributes.Footprint:void 0,"data"in o.device?void 0:o.device.path),C=g||y;o.footprint&&"path"in o.footprint&&o.footprint.override&&Dg(C,o.footprint.override),s.attributes&&y&&typeof y=="object"&&(s.attributes.Footprint=y.uuid);let E=!1,O=!1,_=await Qke({symbolItem:p,footprintItem:C,userIdSelected:o.path,isNeedCreateSymbolAndAssocia:m},void 0);if(_.isNeedConfirm){let D=(await mn.messageBus.rpcCall("OpenSameNameSaveAsDlgService",{..._},31536e8)).message;if(!D){let w="an exception occurred while executing the cross-bind program.";throw new gt("CROSS_BIND",w)}if(D.action==="cancel"||D.action==="close"){let w="quit operate while executing the cross-bind program.";throw new gt("CROSS_BIND_EXIT",w)}_.updateCache=D.data,s.attributes&&Object.keys(_.updateCache).length&&(_.updateCache.symbolItemId&&(E=!0),_.updateCache.footprintItemId&&(O=!0),Jke(_.updateCache,s.attributes))}!E&&p&&await iBe(o.isProject,o.path,s,o.symbol,p,h),!O&&C&&await nBe(o.isProject,o.path,s,o.footprint,C,P),"path"in o.device&&o.device.override&&(delete o.device.override.tags,Dg(s,o.device.override));let R=await Jn("POST",eh(qn.DEVICE.UPDATE,{uuid:o.uuid}),{...s,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(R.code===0&&R.success&&R.result){let D=R.result;return fx(o.path,D)}let v=R.message||R.msg||"Request Error.";throw MI(R.code)?new gt("DEVICE_SAME_NAMA_EXISTS",v):sT(R.code)?new gt("CREATE_DEVICE_PERMISSIONS",v):new gt("UPDATE_DEVICE",v)}async function eCt(o){let{footprintItemIn:t,footprintItemOut:e,footprintTagIds:r,footprintTagTitles:i}=await SIe(o.footprint,o.path,o.isProject,"path"in o.footprint&&o.footprint.override&&Array.isArray(o.footprint.override.tags)?o.footprint.override.tags:void 0),n=t||e;if(!n)throw new gt("PARAMETER_VERIFICATION","missing footprint data.");n.title!==void 0&&Wke(n.title),"path"in o.footprint&&o.footprint.override&&(delete o.footprint.override.tags,Dg(n,o.footprint.override));let s=await Jn("POST",eh(qn.COMPONENT.UPDATE,{uuid:o.uuid}),{title:n.title,tags:r,docType:n.docType||4,description:n.description,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success&&typeof s.result=="object"){let l=s.result;if(!("data"in o.footprint)&&o.footprint.uuid&&o.footprint.path){let c=await dx({origin:{docType:n.docType,isProject:o.footprint.isProject,uuid:o.footprint.uuid,path:o.footprint.path},target:{docType:l.docType,isProject:o.isProject,uuid:o.uuid,path:o.path}});if(!c.success)throw new gt("UPDATE_FOOTPRINT_MIGRATE_CANVAS_ERROR",c.message||"migrate canvas error.")}return CE(o.path,l)}let a=s.message||s.msg||"Request Error.";throw MI(s.code)?new gt("FOOTPRINT_SAME_NAMA_EXISTS",a):sT(s.code)?new gt("UPDATE_FOOTPRINT_PERMISSIONS",a):new gt("UPDATE_FOOTPRINT",a)}async function tCt(o){let{simModelItemIn:t,simModelItemOut:e,simModelTagIds:r,simModelTagTitles:i}=await oBe(o.simModel,o.path,o.isProject,"path"in o.simModel&&o.simModel.override&&Array.isArray(o.simModel.override.tags)?o.simModel.override.tags:void 0),n=t||e;if(!n)throw new gt("PARAMETER_VERIFICATION","missing simModel data.");n.title!==void 0&&jke(n.title),"path"in o.simModel&&o.simModel.override&&(delete o.simModel.override.tags,Dg(n,o.simModel.override));let s=await Jn("POST",eh(qn.COMPONENT.UPDATE,{uuid:o.uuid}),{...n,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!s.success){let l=s.message||s.msg||"Request Error.";throw new gt("UPDATE_SIM_MODEL",l)}if(n.dataStr){let l=await Jn("POST",eh(qn.COMPONENT.UPDATE_CANVAS,{uuid:o.uuid}),{...n,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!l.success){let c=l.message||l.msg||"Request Error.";throw new gt("UPDATE_SIM_MODEL",c)}}if(s.code===0&&s.success&&typeof s.result=="object"){let l=s.result;return await OM(o.path,l)}let a=s.message||s.msg||"Request Error.";throw MI(s.code)?new gt("SIM_MODEL_SAME_NAMA_EXISTS",a):sT(s.code)?new gt("UPDATE_SIM_MODEL_PERMISSIONS",a):new gt("UPDATE_SYMBOL",a)}async function rCt(o){let{symbolItemIn:t,symbolItemOut:e,symbolTagIds:r,symbolTagTitles:i}=await EIe(o.symbol,o.path,o.isProject,"path"in o.symbol&&o.symbol.override&&Array.isArray(o.symbol.override.tags)?o.symbol.override.tags:void 0),n=t||e;if(!n)throw new gt("PARAMETER_VERIFICATION","missing symbol data.");n.title!==void 0&&Hke(n.title),"path"in o.symbol&&o.symbol.override&&(delete o.symbol.override.tags,Dg(n,o.symbol.override));let s=await Jn("POST",eh(qn.COMPONENT.UPDATE,{uuid:o.uuid}),{title:n.title,tags:r,docType:n.docType,description:n.description,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success&&typeof s.result=="object"){let l=s.result;if(!("data"in o.symbol)&&o.symbol.uuid&&o.symbol.path){let c=await dx({origin:{docType:n.docType,isProject:o.symbol.isProject,uuid:o.symbol.uuid,path:o.symbol.path},target:{docType:l.docType,isProject:o.isProject,uuid:o.uuid,path:o.path}});if(!c.success)throw new gt("UPDATE_SYMBOL_MIGRATE_CANVAS_ERROR",c.message||"migrate canvas error.")}return IE(o.path,l)}let a=s.message||s.msg||"Request Error.";throw MI(s.code)?new gt("SYMBOL_SAME_NAMA_EXISTS",a):sT(s.code)?new gt("UPDATE_SYMBOL_PERMISSIONS",a):new gt("UPDATE_SYMBOL",a)}async function iCt(o){let t=await Jn("GET",qn.COMPONENT.LIST,{...o.query||{},path:o.path,uid:o.uid,page:o.page,pageSize:o.pageSize,docType:[16],tag:o.tags||[]},{headers:{path:o.path},searchParams:!0});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result,i=[];for(let n of r.lists)i.push(await EB(o.path,n));return{count:r.count,page:r.page,pageSize:r.pageSize,totalPage:r.totalPage,lists:i}}let e=t.message||t.msg||"Request Error.";throw new gt("GET_D3MODEL_LIST",e)}async function nCt(o){let t=await Jn("GET",qn.COMPONENT.LIST,{...MS(o.query||{}),path:o.path,uid:o.uid,page:o.page,pageSize:o.pageSize,docType:[4],tag:o.tags||[]},{headers:{path:o.path},searchParams:!0});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result,i=[];for(let n of r.lists)i.push(CE(o.path,n));return{count:r.count,page:r.page,pageSize:r.pageSize,totalPage:r.totalPage,lists:i}}let e=t.message||t.msg||"Request Error.";throw new gt("GET_FOOTPRINT_LIST",e)}async function oCt(o){let t=await Jn("GET",qn.COMPONENT.LIST,{...MS(o.query||{}),path:o.path,uid:o.uid,page:o.page,pageSize:o.pageSize,docType:o.docType,tag:o.tags||[]},{headers:{path:o.path},searchParams:!0});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result,i=[];for(let n of r.lists)i.push(IE(o.path,n));return{count:r.count,page:r.page,pageSize:r.pageSize,totalPage:r.totalPage,lists:i}}let e=t.message||t.msg||"Request Error.";throw new gt("GET_SYMBOL_LIST",e)}async function sCt(o){var t,e;let r=await Jn("GET",qn.DEVICE.LIST,{...MS(o.query||{}),path:o.path,uid:o.uid,page:o.page,pageSize:o.pageSize,tag:o.tags||[]},{headers:{path:o.path},searchParams:!0});if(r.code===0&&r.success&&typeof r.result=="object"){let n=r.result,s=[];for(let a of n.lists){let l=fx(o.path,a);o.withPackage&&(t=a.symbol_info)!=null&&t.uuid&&(l.symbol=IE(o.path,a.symbol_info)),o.withPackage&&(e=a.footprint_info)!=null&&e.uuid&&(l.footprint=CE(o.path,a.footprint_info)),s.push(l)}return{count:n.count,page:n.page,pageSize:n.pageSize,totalPage:n.totalPage,lists:s}}let i=r.message||r.msg||"Request Error.";throw new gt("GET_DEVICE_LIST",i)}async function aCt(o){return o.titles?await lCt(o):o.uuids?await cCt(o):await hCt(o)}async function lCt(o){var t,e;let{path:r,titles:i,user_uuids:n}=o,s=await Jn("POST",qn.DEVICE.GET_BY_USER_AND_TITLE,{type:"device",titles:i,user_uuids:n||[r],path:r},{headers:{"Content-Type":"application/json",path:r}});if(s.code===0&&s.success&&s.result){let l={};for(let c in s.result){l[c]=[];let h=s.result[c];for(let u of h){let d=fx(r,u);o.withPackage&&(t=u.symbol_info)!=null&&t.uuid&&(d.symbol=IE(r,u.symbol_info)),o.withPackage&&(e=u.footprint_info)!=null&&e.uuid&&(d.footprint=CE(r,u.footprint_info)),l[c].push(d)}}return l}let a=s.message||s.msg||"Request Error.";throw new gt("GET_DEVICE_SEARCH_LIST",a)}async function cCt(o){let{path:t,uuids:e}=o,r=await Jn("POST",qn.DEVICE.BATCH_GET,{uuids:e},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n=[];for(let s of r.result){let a=fx(t,s);n.push(a)}return n}let i=r.message||r.msg||"Request Error.";throw new gt("GET_DEVICE_SEARCH_UUIDS",i)}async function hCt(o){var t,e;let{path:r,query:i={},uid:n,page:s,pageSize:a,tags:l=[],wd:c}=o,h=await Jn("POST",qn.DEVICE.SEARCH_LIST,{...MS(i),path:r,uid:n,page:s,pageSize:a,tag:l,wd:c},{headers:{path:r},searchParams:!0});if(h.code===0&&h.success&&typeof h.result=="object"){let d=h.result,p=[],m=Object.keys(d.lists);for(let g=0;g<m.length;g++){let y=d.lists[m[g]];if(Array.isArray(y)&&y.length)for(let b=0;b<y.length;b++){let P=y[b],T=fx(r,P);o.withPackage&&(t=P.symbol_info)!=null&&t.uuid&&(T.symbol=IE(r,P.symbol_info)),o.withPackage&&(e=P.footprint_info)!=null&&e.uuid&&(T.footprint=CE(r,P.footprint_info)),p.push(T)}}return{count:d.count,page:d.page,pageSize:d.pageSize,totalPage:d.totalPage,lists:p,facets:d.facets}}let u=h.message||h.msg||"Request Error.";throw new gt("GET_DEVICE_SEARCH_LIST",u)}async function uCt(o){return o.titles?await dCt(o):o.uuids?await pCt(o):await fCt(o)}async function dCt(o){let{path:t,titles:e,docType:r,user_uuids:i}=o,n=await Jn("POST",qn.COMPONENT.GET_BY_USER_AND_TITLE,{docType:r,titles:e,user_uuids:i||[t],path:t},{headers:{"Content-Type":"application/json",path:t}});if(n.code===0&&n.success&&n.result){let a={};for(let l in n.result){a[l]=[];let c=n.result[l];for(let h of c){let u=IE(t,h);a[l].push(u)}}return a}let s=n.message||n.msg||"Request Error.";throw new gt("GET_SYMBOL_SEARCH_LIST",s)}async function pCt(o){let{path:t,uuids:e}=o,r=await Jn("POST",qn.COMPONENT.BATCH_GET,{uuids:e},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n=[];for(let s of r.result){let a=IE(t,s);n.push(a)}return n}let i=r.message||r.msg||"Request Error.";throw new gt("GET_SYMBOL_SEARCH_UUIDS",i)}async function fCt(o){let{path:t,query:e,uid:r,page:i,pageSize:n,tags:s=[],wd:a,docType:l}=o,c=await Jn("POST",qn.COMPONENT.SEARCH_LIST,{...MS(e||{}),path:t,uid:r,page:i,pageSize:n,docType:l,tag:s,wd:a},{headers:{path:t},searchParams:!0});if(c.code===0&&c.success&&typeof c.result=="object"){let u=c.result,d=[],p=Object.keys(u.lists);for(let m=0;m<p.length;m++){let g=u.lists[p[m]];if(Array.isArray(g)&&g.length)for(let y=0;y<g.length;y++){let b=g[y],P=IE(t,b);d.push(P)}}return{count:u.count,page:u.page,pageSize:u.pageSize,totalPage:u.totalPage,lists:d,facets:u.facets}}let h=c.message||c.msg||"Request Error.";throw new gt("GET_SYMBOL_SEARCH_LIST",h)}async function mCt(o){return o.titles?await gCt(o):o.uuids?await yCt(o):await bCt(o)}async function gCt(o){let{path:t,titles:e,user_uuids:r}=o,i=await Jn("POST",qn.COMPONENT.GET_BY_USER_AND_TITLE,{docType:4,titles:e,user_uuids:r||[t],path:t},{headers:{"Content-Type":"application/json",path:t}});if(i.code===0&&i.success&&i.result){let s={};for(let a in i.result){s[a]=[];let l=i.result[a];for(let c of l){let h=CE(t,c);s[a].push(h)}}return s}let n=i.message||i.msg||"Request Error.";throw new gt("GET_FOOTPRINT_SEARCH_LIST",n)}async function yCt(o){let{path:t,uuids:e}=o,r=await Jn("POST",qn.COMPONENT.BATCH_GET,{uuids:e},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n=[];for(let s of r.result){let a=CE(t,s);n.push(a)}return n}let i=r.message||r.msg||"Request Error.";throw new gt("GET_FOOTPRINT_SEARCH_UUIDS",i)}async function bCt(o){let{path:t,query:e={},uid:r,page:i,pageSize:n,tags:s=[],wd:a}=o,l=await Jn("POST",qn.COMPONENT.SEARCH_LIST,{...MS(e),path:t,uid:r,page:i,pageSize:n,docType:[4],tag:s,wd:a},{headers:{path:t},searchParams:!0});if(l.code===0&&l.success&&typeof l.result=="object"){let h=l.result,u=[],d=Object.keys(h.lists);for(let p=0;p<d.length;p++){let m=h.lists[d[p]];if(Array.isArray(m)&&m.length)for(let g=0;g<m.length;g++){let y=m[g],b=CE(t,y);u.push(b)}}return{count:h.count,page:h.page,pageSize:h.pageSize,totalPage:h.totalPage,lists:u,facets:h.facets}}let c=l.message||l.msg||"Request Error.";throw new gt("GET_FOOTPRINT_SEARCH_LIST",c)}async function PCt(o){return o.titles?await TCt(o):o.uuids?await ICt(o):await CCt(o)}async function TCt(o){let{path:t,docType:e,titles:r}=o,i=await Jn("POST",qn.COMPONENT.GET_BY_USER_AND_TITLE,{docType:e,titles:r,user_uuids:[t],path:t},{headers:{"Content-Type":"application/json",path:t}});if(i.code===0&&i.success&&i.result){let s={};for(let a in i.result){s[a]=[];let l=i.result[a];for(let c of l){let h=await OM(o.path,c);s[a].push(h)}}return s}let n=i.message||i.msg||"Request Error.";throw new gt("GET_SIM_MODEL_SEARCH_LIST",n)}async function ICt(o){let{path:t,uuids:e}=o,r=await Jn("POST",qn.COMPONENT.BATCH_GET,{uuids:e},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n=[];for(let s of r.result){let a=await OM(t,s);n.push(a)}return n}let i=r.message||r.msg||"Request Error.";throw new gt("GET_SIM_MODEL_SEARCH_UUIDS",i)}async function CCt(o){let{path:t,query:e={},uid:r,page:i,pageSize:n,docType:s,tags:a=[],wd:l}=o,c=await Jn("POST",qn.COMPONENT.SEARCH_LIST,{...MS(e),path:t,uid:r,page:i,pageSize:n,docType:s,tag:a,wd:l},{headers:{path:t},searchParams:!0});if(c.code===0&&c.success&&typeof c.result=="object"){let u=c.result,d=[],p=Object.keys(u.lists);for(let m=0;m<p.length;m++){let g=u.lists[p[m]];if(Array.isArray(g)&&g.length)for(let y=0;y<g.length;y++){let b=g[y];d.push(await OM(o.path,b))}}return{count:u.count,page:u.page,pageSize:u.pageSize,totalPage:u.totalPage,lists:d,facets:u.facets}}let h=c.message||c.msg||"Request Error.";throw new gt("GET_SIM_MODEL_SEARCH_LIST",h)}async function SCt(o){if(o.attributes.Symbol){let n=await iu.getSymbol({isProject:o.isProject,uuid:o.attributes.Symbol,path:o.path})}if(o.attributes.Footprint){let n=await iu.getFootprint({isProject:o.isProject,uuid:o.attributes.Footprint,path:o.path})}let t=await iu.getDevice({isProject:o.isProject,uuid:o.uuid,path:o.path}),e=Object.keys(o.attributes||{});for(let n=0;n<e.length;n++)t.attributes[e[n]]=o.attributes[e[n]];let r=await Jn("POST",eh(qn.DEVICE.UPDATE,{uuid:o.uuid}),{...t,title:t.display_title||t.title,tags:t.tags?mke(t.tags):[],owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(r.code===0&&r.success&&r.result){let n=r.result;return fx(o.path,n)}let i=r.message||r.msg||"Request Error.";throw sT(r.code)?new gt("CREATE_DEVICE_PERMISSIONS",i):new gt("UPDATE_DEVICE_ATTRIBUTES",i)}async function ECt(o){return o.titles?await OCt(o):o.uuids?await ACt(o):await _Ct(o)}async function OCt(o){let{path:t,titles:e,user_uuids:r}=o;if(ENe||Mz&&t!==Ai.SYSTEMLIB_UUID){let i=await Jn("POST",qn.CLIENT.FIND_3DMODEL,{titles:e},{headers:{"Content-Type":"application/json",path:t}});if(i.code===0&&i.success&&i.result){let s={};for(let a in i.result){s[a]=[];let l=i.result[a];for(let c of l){let h={fileName:c.fileName,path:c.path,lib:c.lib};s[a].push(h)}}return s}let n=i.message||i.msg||"Request Error.";throw new gt("GET_D3MODEL_SEARCH_LIST",n)}else{let i=await Jn("POST",qn.COMPONENT.GET_BY_USER_AND_TITLE,{docType:16,titles:e,user_uuids:r||[t],path:t},{headers:{"Content-Type":"application/json",path:t}});if(i.code===0&&i.success&&i.result){let s={};for(let a in i.result){s[a]=[];let l=i.result[a];for(let c of l){let h=await EB(o.path,c);s[a].push(h)}}return s}let n=i.message||i.msg||"Request Error.";throw new gt("GET_D3MODEL_SEARCH_LIST",n)}}async function ACt(o){let{path:t,uuids:e}=o,r=await Jn("POST",qn.COMPONENT.BATCH_GET,{uuids:e},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n=[];for(let s of r.result){let a=await EB(t,s);n.push(a)}return n}let i=r.message||r.msg||"Request Error.";throw new gt("GET_D3MODEL_SEARCH_UUIDS",i)}async function _Ct(o){let{path:t,query:e={},uid:r,page:i,pageSize:n,tags:s=[],wd:a}=o,l=await Jn("POST",qn.COMPONENT.SEARCH_LIST,{...MS(e),path:t,uid:r,page:i,pageSize:n,docType:[16],tag:s,wd:a},{headers:{path:t},searchParams:!0});if(l.code===0&&l.success&&typeof l.result=="object"){let h=l.result,u=[],d=Object.keys(h.lists);for(let p=0;p<d.length;p++){let m=h.lists[d[p]];if(Array.isArray(m)&&m.length)for(let g=0;g<m.length;g++){let y=m[g];u.push(await EB(o.path,y))}}return{count:h.count,page:h.page,pageSize:h.pageSize,totalPage:h.totalPage,lists:u,facets:h.facets}}let c=l.message||l.msg||"Request Error.";throw new gt("GET_D3MODEL_SEARCH_LIST",c)}async function vCt(o){return o.titles?await xCt(o):o.uuids?await RCt(o):await DCt(o)}async function xCt(o){let{path:t,titles:e}=o,r=await Jn("POST",qn.COMPONENT.GET_BY_USER_AND_TITLE,{docType:29,titles:e,user_uuids:[t],path:t},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n={};for(let s in r.result){n[s]=[];let a=r.result[s];for(let l of a){let c=EM(o.path,l);n[s].push(c)}}return n}let i=r.message||r.msg||"Request Error.";throw new gt("GET_PANEL_LIB_SEARCH_LIST",i)}async function RCt(o){let{path:t,uuids:e}=o,r=await Jn("POST",qn.COMPONENT.BATCH_GET,{uuids:e},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n=[];for(let s of r.result){let a=EM(t,s);n.push(a)}return n}let i=r.message||r.msg||"Request Error.";throw new gt("GET_PANEL_LIB_SEARCH_UUIDS",i)}async function DCt(o){let{path:t,query:e={},uid:r,page:i,pageSize:n,tags:s=[],wd:a}=o,l=await Jn("POST",qn.COMPONENT.SEARCH_LIST,{...MS(e),path:t,uid:r,page:i,pageSize:n,docType:[29],tag:s,wd:a},{headers:{path:t},searchParams:!0});if(l.code===0&&l.success&&typeof l.result=="object"){let h=l.result,u=[],d=Object.keys(h.lists);for(let p=0;p<d.length;p++){let m=h.lists[d[p]];if(Array.isArray(m)&&m.length)for(let g=0;g<m.length;g++){let y=m[g];u.push(EM(o.path,y))}}return{count:h.count,page:h.page,pageSize:h.pageSize,totalPage:h.totalPage,lists:u,facets:h.facets}}let c=l.message||l.msg||"Request Error.";throw new gt("GET_PANEL_LIB_SEARCH_LIST",c)}async function wCt(o){let t=await Jn("GET",eh(qn.COMPONENT.GET,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result;if(typeof r.path<"u"&&r.path!==o.path)throw new gt("GET_PANEL_LIB_NOT_FOUND","data not found");return EM(o.path,r)}let e=t.message||t.msg||"Request Error.";throw new gt("GET_PANEL_LIB",e)}async function sBe(o,t,e,r){let i=null,n=null,s=[],a=[],l=!1,c,h;if(o)if("data"in o)i=o.data,i.tags&&(i.tags instanceof Array?a=i.tags:a=px(i.tags));else{if(!o.uuid||!o.path)throw new gt("PARAMETER_VERIFICATION","missing panelLib uuid or path data.");c=o.uuid,h=o.path,n=await iu.getPanelLib({isProject:o.isProject,uuid:o.uuid,path:o.path}),n&&(n.title=n.display_title,r&&Array.isArray(r)?a=r:a=await PA(n.tags,o.path,[29]))}if(!e){let u=await lm.categoryAddtition.addActuator(a,[0],t,29);s=u.uuids,a=u.titles}return{panelLibItemOriginUuid:c,panelLibItemOriginPath:h,panelLibItemIn:i,panelLibItemOut:n,panelLibTagIds:s,panelLibTagTitles:a}}async function LCt(o){let{panelLibItemIn:t,panelLibItemOut:e,panelLibTagIds:r,panelLibTagTitles:i}=await sBe(o.panelLib,o.path,o.isProject,"path"in o.panelLib&&o.panelLib.override&&Array.isArray(o.panelLib.override.tags)?o.panelLib.override.tags:void 0),n=t||e;if(!n)throw new gt("PARAMETER_VERIFICATION","missing panelLib data.");n.title="path"in o.panelLib&&o.panelLib.override&&nY(o.panelLib.override,"title")||n.title,zke(n.title),"path"in o.panelLib&&o.panelLib.override&&(delete o.panelLib.override.tags,Dg(n,o.panelLib.override));let s=await Jn("POST",qn.COMPONENT.CREATE,{title:n.title,tags:r,docType:n.docType||29,description:n.description,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success){let l=s.result;if(!("data"in o.panelLib)&&o.panelLib.uuid&&o.panelLib.path){let c=await dx({origin:{docType:n.docType,isProject:!!o.panelLib.isProject,uuid:o.panelLib.uuid,path:o.panelLib.path},target:{docType:l.docType,isProject:!1,uuid:l.uuid,path:l.path}});if(!c.success)throw new gt("CREATE_PANEL_LIB_MIGRATE_CANVAS_ERROR",c.message||"migrate canvas error.")}return EM(o.path,l)}let a=s.message||s.msg||"Request Error.";throw MI(s.code)?new gt("PANELLIB_SAME_NAMA_EXISTS",a):sT(s.code)?new gt("CREATE_PANEL_LIB_PERMISSIONS",a):new gt("CREATE_PANEL_LIB",a)}async function MCt(o){let{panelLibItemIn:t,panelLibItemOut:e,panelLibTagIds:r,panelLibTagTitles:i}=await sBe(o.panelLib,o.path,o.isProject,"path"in o.panelLib&&o.panelLib.override&&Array.isArray(o.panelLib.override.tags)?o.panelLib.override.tags:void 0),n=t||e;if(!n)throw new gt("PARAMETER_VERIFICATION","missing panelLib data.");n.title!==void 0&&zke(n.title),"path"in o.panelLib&&o.panelLib.override&&(delete o.panelLib.override.tags,Dg(n,o.panelLib.override));let s=await Jn("POST",eh(qn.COMPONENT.UPDATE,{uuid:o.uuid}),{title:n.title,tags:r,docType:29,description:n.description,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success&&typeof s.result=="object"){let l=s.result;if(!("data"in o.panelLib)&&o.panelLib.uuid&&o.panelLib.path){let c=await dx({origin:{docType:n.docType,isProject:o.panelLib.isProject,uuid:o.panelLib.uuid,path:o.panelLib.path},target:{docType:l.docType,isProject:o.isProject,uuid:o.uuid,path:o.path}});if(!c.success)throw new gt("UPDATE_PANEL_LIB_MIGRATE_CANVAS_ERROR",c.message||"migrate canvas error.")}return EM(o.path,l)}let a=s.message||s.msg||"Request Error.";throw MI(s.code)?new gt("PANELLIB_SAME_NAMA_EXISTS",a):sT(s.code)?new gt("UPDATE_PANEL_LIB_PERMISSIONS",a):new gt("UPDATE_PANEL_LIB",a)}async function NCt(o){let t=await Jn("GET",qn.COMPONENT.LIST,{...MS(o.query||{}),path:o.path,uid:o.uid,page:o.page,pageSize:o.pageSize,docType:[29],tag:o.tags||[]},{headers:{path:o.path},searchParams:!0});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result,i=[];for(let n of r.lists)i.push(EM(o.path,n));return{count:r.count,page:r.page,pageSize:r.pageSize,totalPage:r.totalPage,lists:i}}let e=t.message||t.msg||"Request Error.";throw new gt("GET_PANEL_LIB_LIST",e)}async function kCt(o){let{d3modelItemIn:t,d3modelItemOut:e,d3modelTagIds:r,d3modelTagTitles:i}=await qke(o.d3model,o.path,o.isProject),n=t||e;if(!n)throw new gt("PARAMETER_VERIFICATION","missing d3Model data.");n.title!==void 0&&Yke(n.title),"path"in o.d3model&&o.d3model.override&&Dg(n,o.d3model.override);let s=await Jn("POST",eh(qn.COMPONENT.UPDATE,{uuid:o.uuid}),{...n,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!s.success){let l=s.message||s.msg||"Request Error.";throw new gt("UPDATE_D3MODEL",l)}if(n.dataStr){let l=await Jn("POST",eh(qn.COMPONENT.UPDATE_CANVAS,{uuid:o.uuid}),{...n,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!l.success){let c=l.message||l.msg||"Request Error.";throw new gt("UPDATE_D3MODEL",c)}}if(s.code===0&&s.success&&typeof s.result=="object"){let l=s.result;return await EB(o.path,l)}let a=s.message||s.msg||"Request Error.";throw MI(s.code)?new gt("D3MODEL_SAME_NAMA_EXISTS",a):sT(s.code)?new gt("UPDATE_D3MODEL_PERMISSIONS",a):new gt("UPDATE_SYMBOL",a)}async function BCt(o){let t={uid:o.uid,path:o.path};if(o.tags){let{result:i}=await Xke({uuid:o.uid,path:o.path,types:[3],names:o.tags});t.tag=i}let e=await Jn("POST",qn.DEVICE.GET_ATTR_KEYS,t,{headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",path:o.path}});if(e.code===0&&e.success&&typeof e.result=="object")return e.result;let r=e.message||e.msg||"Request Error.";throw new gt("GET_DEVICE_ATTRIBUTES_KEYS",r)}async function FCt(o){let t={uid:o.uid,path:o.path,key:o.key};if(o.tags){let{result:i}=await Xke({uuid:o.uid,path:o.path,types:[3],names:o.tags});t.tag=i}let e=await Jn("POST",qn.DEVICE.GET_ATTR_VALUE,t,{headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",path:o.path}});if(e.code===0&&e.success&&typeof e.result=="object")return e.result;let r=e.message||e.msg||"Request Error.";throw new gt("GET_DEVICE_ATTRIBUTES_VALUES",r)}var VCt=class extends TIe{async getDevice(o){return await qIt(o)}async getDeviceAttributesKeys(o){return await BCt(o)}async getDeviceAttributesValues(o){return FCt(o)}async getSymbol(o){return await JIt(o)}async getFootprint(o){return await $It(o)}async getPanelLib(o){return await wCt(o)}async getD3Model(o){return await rY(o.uuid,o.path)}async getSimModel(o){return await KIt(o)}async getDeviceList(o){return await sCt(o)}async getSymbolList(o){return await oCt(o)}async getFootprintList(o){return await nCt(o)}async getPanelLibList(o){return await NCt(o)}async getD3ModelList(o){return await iCt(o)}async getSimModelList(o){return ZIt(o)}async getDeviceSearchList(o){return await aCt(o)}async getSymbolSearchList(o){return await uCt(o)}async getFootprintSearchList(o){return await mCt(o)}async getPanelLibSearchList(o){return await vCt(o)}async getD3ModelSearchList(o){return await ECt(o)}async getSimModelSearchList(o){return PCt(o)}async createDevice(o){return await zIt(o)}async createSymbol(o){return await XIt(o)}async createFootprint(o){return await YIt(o)}async createD3Model(o){return await HIt(o)}async createPanelLib(o){return await LCt(o)}async createSimModel(o){return await jIt(o)}async updateDevice(o){return await QIt(o)}async updateDeviceAttributes(o){return await SCt(o)}async updateSymbol(o){return await rCt(o)}async updateFootprint(o){return await eCt(o)}async updatePanelLib(o){return await MCt(o)}async updateD3Model(o){return await kCt(o)}async updateSimModel(o){return await tCt(o)}async deleteDevice(o){let t=await Jn("POST",eh(qn.DEVICE.DELETE,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("DELETE_DEVICE",e)}}async deleteSymbol(o){let t=await Jn("POST",eh(qn.COMPONENT.DELETE,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("DELETE_SYMBOL",e)}}async deleteFootprint(o){let t=await Jn("POST",eh(qn.COMPONENT.DELETE,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("DELETE_FOOTPRINT",e)}}async deletePanelLib(o){let t=await Jn("POST",eh(qn.COMPONENT.DELETE,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("DELETE_PANEL_LIB",e)}}async deleteSimModel(o){let t=await Jn("POST",eh(qn.COMPONENT.DELETE,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("DELETE_SIM_MODEL",e)}}async delete3DModel(o){let t=await Jn("POST",eh(qn.COMPONENT.DELETE,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("DELETE_3DMODEL",e)}}async starDevice(o){let t=await Jn("POST",eh(qn.DEVICE.STAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("STAR_DEVICE",e)}}async starSymbol(o){let t=await Jn("POST",eh(qn.COMPONENT.STAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("STAR_SYMBOL",e)}}async starFootprint(o){let t=await Jn("POST",eh(qn.COMPONENT.STAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("STAR_FOOTPRINT",e)}}async starPanelLib(o){let t=await Jn("POST",eh(qn.COMPONENT.STAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("STAR_PANEL_LIB",e)}}async unstarDevice(o){let t=await Jn("POST",eh(qn.DEVICE.UNSTAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("UNSTAR_DEVICE",e)}}async unstarSymbol(o){let t=await Jn("POST",eh(qn.COMPONENT.UNSTAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("UNSTAR_SYMBOL",e)}}async unstarFootprint(o){let t=await Jn("POST",eh(qn.COMPONENT.UNSTAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("UNSTAR_FOOTPRINT",e)}}async unstarPanelLib(o){let t=await Jn("POST",eh(qn.COMPONENT.UNSTAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new gt("UNSTAR_PANEL_LIB",e)}}},bA=class{static diffVersionDevice(o){let t=Object.keys(o);if(!t||!t.length)return;let e=[];for(let r of t)e.push(...o[r].map(i=>({device:i})));mn.messageBus.publish("logI18nLogView1",{type:"warn",msg:["Devices have not been added to the project library, project library has devices with different versions from the same source,",{text:"It is recommended to update the project library:",call:{cmd:"updateComponent",args:{uuids:e,needTipModal:!1}}},t.join("\u3001")],onlyTranslateText:!0})}static diffVersionSymbol(o){let t=Object.keys(o);if(!t||!t.length)return;let e=[];for(let r of t)e.push(...o[r].map(i=>({symbol:i})));mn.messageBus.publish("logI18nLogView1",{type:"warn",msg:["Symbols have not been added to the project library, project library has symbols with different versions from the same source,",{text:"It is recommended to update the project library:",call:{cmd:"updateComponent",args:{uuids:e,needTipModal:!1}}},t.join("\u3001")],onlyTranslateText:!0})}static diffVersionFootprint(o){let t=Object.keys(o);if(!t||!t.length)return;let e=[];for(let r of t)e.push(...o[r].map(i=>({footprint:i})));mn.messageBus.publish("logI18nLogView1",{type:"warn",msg:["Footprints have not been added to the project library, project library has footprints with different versions from the same source,",{text:"It is recommended to update the project library:",call:{cmd:"updateComponent",args:{uuids:e,needTipModal:!1}}},t.join("\u3001")],onlyTranslateText:!0})}static sameVersionDevice(o){}static sameVersionSymbol(o){}static sameVersionFootprint(o){}static renamedDevice(o){mn.messageBus.publish("logI18nLogView",{type:"warn",msg:["Devices are automatically renamed when they are added to the project library :",o.join("\u3001")]})}static renamedSymbol(o){mn.messageBus.publish("logI18nLogView",{type:"warn",msg:["Symbols are automatically renamed when they are added to the project library :",o.join("\u3001")]})}static renamedFootprint(o){mn.messageBus.publish("logI18nLogView",{type:"warn",msg:["Footprints are automatically renamed when they are added to the project library :",o.join("\u3001")]})}},GCt=class{constructor(o){let{renameKey:t=!0}=o;this.renameKey=t}async rename(o,...t){if(await this.hack(o,...t))return{success:!0};let e=(await mn.messageBus.rpcCall("allowDuplicateNames",...t)).message;return this.renameKey||!e?this.renaming(o,...t):e?{success:!0}:this.isRename(o,...t)}async hack(o,...t){return!1}},UCt=class extends GCt{constructor(o){let{matchKey:t=!0,byUUID:e=!1,byVersion:r=!1,bySource:i=!1}=o;super(o),this.matchKey=t,this.byUUID=e,this.byVersion=r,this.bySource=i}async match(o){if(this.matchKey)return this.matching(o)}},OIe=class extends UCt{constructor(o){let{path:t,data:e,printLog:r=!0}=o;super(o),this.origin={},this.path=t,this.data=e,this.printLog=r}async onAdd(o){let t=JSON.parse(JSON.stringify(o));return t.path||(t.path=this.path),await sTt({data:t}),pTe(t),t.project_uuid=t.path=this.path,t}async onUpdate(o){let t=JSON.parse(JSON.stringify(o));return pTe(t),t}async getTemplate(o,t={}){let{uuid:e,path:r,updateTime:i}=o,n=`${e}${ax}${r}`,s=i==null?void 0:i.toString(),a=Object.assign(o,{path:r,source:n,version:s},t);return pTe(a),a}},aBe=class extends OIe{async getOrigin(){var o;let{path:t,uuid:e,isProject:r}=this.data;if(CM(this.data)){let{override:i}=this.data;if(i&&i.attributes)throw new gt("CREATE_DEVICE_GET_ORIGIN","Api call error!");if(r){let{message:n}=await mn.messageBus.rpcCall("/pro-mgr/hasProject",[t]);if(n){let s=[e,t],a=(await mn.messageBus.rpcCall(us.DEVICE.GET,s)).message;if(a){let l=Object.assign(a,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(l,i)}else throw new gt("CREATE_DEVICE_GET_ORIGIN","Device details data does not exist")}else throw new gt("CREATE_DEVICE_GET_ORIGIN","Get project library data source Project is not open!")}else if(P0.getInstance().hasLib(t)){let n=P0.getInstance().getLib(t),s=await((o=n==null?void 0:n.device)==null?void 0:o.getTransformedDetail(e));if(s){let a=Object.assign(s,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(a,i)}else throw new gt("CREATE_DEVICE_GET_ORIGIN","Device details data does not exist")}else{let n={path:t,uuid:e},{message:s}=await mn.messageBus.rpcCall(gA.DEVICE.GET,n);if(s.success){let a=s.result,l=Object.assign(a,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(l,i)}else throw new gt("CREATE_DEVICE_GET_ORIGIN",s.message||"Device details data does not exist")}}else{let i=this.data.data,n=Object.assign(i,{isProject:r});this.origin=await this.onHandle(n)}return{success:!0,result:this.origin}}async renaming(o){let t=o.display_title||o.title,e=[t,this.path],r=(await mn.messageBus.rpcCall(us.DEVICE.TRY_RENAME,e)).message;return r&&(o.display_title=o.title=r),this.printLog&&t!==r&&bA.renamedDevice([t]),{success:!0}}},HCt=class extends aBe{onHandle(o){return this.onAdd(o)}async matching(o){if(this.byUUID){let t=[o.uuid,this.path],e=await(await mn.messageBus.rpcCall(us.DEVICE.GET,t)).message;if(o.ticket&&e!=null&&e.ticket&&(e==null?void 0:e.ticket)===o.ticket)return e}if(o.source){if(this.byVersion){let t=[o.source,o.version,this.path],e=(await mn.messageBus.rpcCall(us.DEVICE.GET_BY_SOURCE_VERSION,t)).message;return this.printLog&&e&&bA.sameVersionDevice([o.display_title||o.title]),e}if(this.bySource){let t=[o.source,this.path],e=(await mn.messageBus.rpcCall(us.DEVICE.GET_LAST,t)).message;return this.printLog&&e&&bA.diffVersionDevice({[e.display_title||e.title]:[e.uuid]}),e}}}async isRename(o){let t=[o.display_title||o.title,this.path];if((await mn.messageBus.rpcCall(us.DEVICE.IS_RENAME,t)).message)throw new gt("DEVICE_SAME_NAMA_EXISTS","Device duplicate name");return{success:!0}}async start(){let o=await this.getOrigin();if(!o.success)throw new gt("CREATE_DEVICE",o.message||"Creation of the device failed!");let t,e;if(this.origin){let r=await this.match(this.origin);if(r)t={success:!0,result:r};else{let i=await this.rename(this.origin,{path:this.path});if(!i.success)throw new gt("CREATE_DEVICE",i.message||"Creation of the device failed!");e=this.origin}}return{success:!0,result:{respond:t,addData:e}}}},lBe=class extends OIe{async getOrigin(){var o;let{path:t,uuid:e,isProject:r}=this.data;if(CM(this.data)){let{override:i}=this.data;if(r){let{message:n}=await mn.messageBus.rpcCall("/pro-mgr/hasProject",[t]);if(n){let s=[e,t],a=(await mn.messageBus.rpcCall(us.FOOTPRINT.GET,s)).message;if(a){let l=Object.assign(a,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(l,i)}else throw new gt("CREATE_FOOTPRINT_GET_ORIGIN","Footprint details data does not exist")}else throw new gt("CREATE_FOOTPRINT_GET_ORIGIN","Get project library data source Project is not open!")}else if(P0.getInstance().hasLib(t)){let n=P0.getInstance().getLib(t),s=await((o=n==null?void 0:n.footprint)==null?void 0:o.getTransformedDetail(e));if(s){let a=Object.assign(s,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(a,i)}else throw new gt("CREATE_FOOTPRINT_GET_ORIGIN","Footprint details data does not exist")}else{let n={path:t,uuid:e},{message:s}=await mn.messageBus.rpcCall(gA.COMPONENT.GET,n);if(s.success){let a=s.result,l=Object.assign(a,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(l,i)}else throw new gt("CREATE_FOOTPRINT_GET_ORIGIN",s.message||"Footprint details data does not exist")}}else{let i=this.data.data,n=Object.assign(i,{isProject:r});this.origin=await this.onHandle(n)}return{success:!0,result:this.origin}}async renaming(o){let t=o.display_title||o.title,e=[t,this.path],r=(await mn.messageBus.rpcCall(us.FOOTPRINT.TRY_RENAME,e)).message;return r&&(o.display_title=o.title=r),this.printLog&&t!==r&&bA.renamedFootprint([t]),{success:!0}}},AIe=class extends lBe{onHandle(o){return this.onAdd(o)}async matching(o){if(this.byUUID){let t=[o.uuid,this.path],e=(await mn.messageBus.rpcCall(us.FOOTPRINT.GET,t)).message;if(o.ticket&&e!=null&&e.ticket&&(e==null?void 0:e.ticket)===o.ticket)return e}if(o.source){if(this.byVersion){let t=[o.source,o.version,this.path],e=(await mn.messageBus.rpcCall(us.FOOTPRINT.GET_BY_SOURCE_VERSION,t)).message;return this.printLog&&e&&bA.sameVersionFootprint([o.display_title||o.title]),e}if(this.bySource){let t=[o.source,this.path],e=(await mn.messageBus.rpcCall(us.FOOTPRINT.GET_LAST,t)).message;return this.printLog&&e&&bA.diffVersionFootprint({[e.display_title||e.title]:[e.uuid]}),e}}}async isRename(o){let t=[o.display_title||o.title,this.path];if((await mn.messageBus.rpcCall(us.FOOTPRINT.IS_RENAME,t)).message)throw new gt("CREATE_FOOTPRINT","Library duplicate name");return{success:!0}}async start(){let o=await this.getOrigin();if(!o.success)throw new gt("CREATE_FOOTPRINT",o.message||"Creation of the footprint failed!");let t,e;if(this.origin){let r=await this.match(this.origin);if(r)t={success:!0,result:r};else{let i=await this.rename(this.origin,{path:this.path});if(!i.success)throw new gt("CREATE_FOOTPRINT",i.message||"Creation of the footprint failed!");e=this.origin}}return{success:!0,result:{respond:t,addData:e}}}},cBe=class extends OIe{async getOrigin(){var o;let{path:t,uuid:e,isProject:r}=this.data;if(CM(this.data)){let{override:i}=this.data;if(r){let{message:n}=await mn.messageBus.rpcCall("/pro-mgr/hasProject",[t]);if(n){let s=[e,t],a=(await mn.messageBus.rpcCall(us.SYMBOL.GET,s)).message;if(a){let l=Object.assign(a,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(l,i)}else throw new gt("CREATE_SYMBOL_GET_ORIGIN","Symbol details data does not exist")}else throw new gt("CREATE_SYMBOL_GET_ORIGIN","Get project library data source Project is not open!")}else if(P0.getInstance().hasLib(t)){let n=P0.getInstance().getLib(t),s=await((o=n==null?void 0:n.symbol)==null?void 0:o.getTransformedDetail(e));if(s){let a=Object.assign(s,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(a,i)}else throw new gt("CREATE_SYMBOL_GET_ORIGIN","Symbol details data does not exist")}else{let n={path:t,uuid:e},{message:s}=await mn.messageBus.rpcCall(gA.COMPONENT.GET,n);if(s.success){let a=s.result,l=Object.assign(a,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(l,i)}else throw new gt("CREATE_SYMBOL_GET_ORIGIN",s.message||"Symbol details data does not exist")}}else{let i=this.data.data,n=Object.assign(i,{isProject:r});this.origin=await this.onHandle(n)}return{success:!0,result:this.origin}}async renaming(o){let t=o.display_title||o.title,e=[t,this.path],r=(await mn.messageBus.rpcCall(us.SYMBOL.TRY_RENAME,e)).message;return r&&(o.display_title=o.title=r),this.printLog&&t!==r&&bA.renamedSymbol([t]),{success:!0}}},_Ie=class extends cBe{onHandle(o){return this.onAdd(o)}async matching(o){if(this.byUUID){let t=[o.uuid,this.path],e=(await mn.messageBus.rpcCall(us.SYMBOL.GET,t)).message;if(o.ticket&&e!=null&&e.ticket&&(e==null?void 0:e.ticket)===o.ticket)return e}if(o.source){if(this.byVersion){let t=[o.source,o.version,this.path],e=(await mn.messageBus.rpcCall(us.SYMBOL.GET_BY_SOURCE_VERSION,t)).message;return this.printLog&&e&&bA.sameVersionSymbol([o.display_title||o.title]),e}if(this.bySource){let t=[o.source,this.path],e=(await mn.messageBus.rpcCall(us.SYMBOL.GET_LAST,t)).message;return this.printLog&&e&&bA.diffVersionSymbol({[e.display_title||e.title]:[e.uuid]}),e}}}async hack(o){let{docType:t}=o;return t===17}async isRename(o){let t=[o.display_title||o.title,this.path];if((await mn.messageBus.rpcCall(us.SYMBOL.IS_RENAME,t)).message)throw new gt("CREATE_SYMBOL","Library duplicate name");return{success:!0}}async start(){let o=await this.getOrigin();if(!o.success)throw new gt("CREATE_SYMBOL",o.message||"Creation of the symbol failed!");let t,e;if(this.origin){let r=await this.match(this.origin);if(r)t={success:!0,result:r};else{let i=await this.rename(this.origin,{path:this.path});if(!i.success)throw new gt("CREATE_SYMBOL",i.message||"Creation of the symbol failed!");e=this.origin}}return{success:!0,result:{respond:t,addData:e}}}},OB=class{constructor(o){this.path=o}async check(){let{message:{hasPermission:o,errMsg:t}}=await mn.messageBus.rpcCall("canAddLib",[this.path]);if(!o)throw new gt("CREATE_DEVICE_PERMISSIONS",t||"You don't have permission!");return{success:!0}}},WCt=class extends OB{constructor(o){let{path:t,data:e,options:r={}}=o,{matchKey:i=!0,byUUID:n=!0,byVersion:s=!0,bySource:a=!1,renameKey:l=!1}=r;super(t),this.addData={},this.result={device:null,symbol:null,footprint:null},this.data=e,this.matchKey=i,this.byUUID=n,this.byVersion=s,this.bySource=a,this.renameKey=l}async start(){var o,t,e,r,i,n,s,a,l,c,h,u;try{await this.check(),await this.onbefore();let d={path:this.path,matchKey:this.matchKey,byUUID:this.byUUID,byVersion:this.byVersion,bySource:this.bySource,renameKey:this.renameKey};if(this.data.device){let g={...d,data:this.data.device},y=await new HCt(g).start();if(y.success===!1)throw new gt("CREATE_DEVICE",y.message||"Creation of the device failed!");let{respond:b,addData:P}=y.result;if(this.result.device=b,P&&(this.addData.device=P),this.getBind(),!this.addData.device&&(o=this.result.device)!=null&&o.success&&(t=this.result.device)!=null&&t.result){let{attributes:T}=this.result.device.result,{Symbol:I,Footprint:C}=T,E=I&&(await mn.messageBus.rpcCall(us.SYMBOL.GET,[I,this.path])).message,O=C&&(await mn.messageBus.rpcCall(us.FOOTPRINT.GET,[C,this.path])).message;this.result.symbol={success:!0,result:E},this.result.footprint={success:!0,result:O}}}if(this.data.symbol){let g={...d,data:this.data.symbol},y=await new _Ie(g).start();if(y.success===!1&&y.code===404){if(this.addData.device){this.addData.device.attributes.Symbol="";let{display_title:b,title:P}=this.addData.device,T=b||P;mn.messageBus.publish("logI18nLogView",{type:"warn",msg:["The following devices lose bound symbol data!",T]})}}else{if(y.success===!1)throw new gt("CREATE_DEVICE",y.message||"Creation of the device failed!");{let{respond:b,addData:P}=y.result;if(this.result.symbol=b,P&&(this.addData.symbol=P),this.addData.device&&(e=this.result.symbol)!=null&&e.success&&(r=this.result.symbol)!=null&&r.result)this.addData.device.attributes.Symbol=this.result.symbol.result.uuid;else if((i=this.addData.device)!=null&&i.attributes.Symbol&&(n=this.result.symbol)!=null&&n.success&&!((s=this.result.symbol)!=null&&s.result)&&!this.addData.symbol){let T="The symbol associated with the device does not exist!";throw new gt("CREATE_DEVICE",T)}}}}if(this.data.footprint){let g={...d,data:this.data.footprint},y=await new AIe(g).start();if(y.success===!1&&y.code===404){if(this.addData.device){this.addData.device.attributes.Footprint="";let{display_title:b,title:P}=this.addData.device,T=b||P;mn.messageBus.publish("logI18nLogView",{type:"warn",msg:["The following devices lose bound footprint data!",T]})}}else{if(y.success===!1)throw new gt("CREATE_DEVICE",y.message||"Creation of the device failed!");{let{respond:b,addData:P}=y.result;if(this.result.footprint=b,P&&(this.addData.footprint=P),this.addData.device&&(a=this.result.footprint)!=null&&a.success&&(l=this.result.footprint)!=null&&l.result)this.addData.device.attributes.Footprint=this.result.footprint.result.uuid;else if((c=this.addData.device)!=null&&c.attributes.Footprint&&(h=this.result.footprint)!=null&&h.success&&!((u=this.result.footprint)!=null&&u.result)&&!this.addData.footprint){let T="The footprint associated with the device does not exist!";throw new gt("CREATE_DEVICE",T)}}}}let p=await this.create();if(!p.success)throw new gt("CREATE_DEVICE",p.message||"Creation of the device failed!");let m=await this.updateBind();if(!m.success)throw new gt("CREATE_DEVICE",m.message||"Creation of the device failed!");if(!this.result)throw new gt("CREATE_DEVICE","Project library device added failed!");return await this.onsuccess(this.result),{success:!0,result:this.result}}catch(d){throw new gt("CREATE_DEVICE",d.message||"Creation of the device failed!")}}getBind(){if(this.addData.device){let{attributes:o}=this.addData.device,{Symbol:t,Footprint:e}=o,{isProject:r}=this.data.device;if(r===void 0)!this.data.symbol&&t&&(this.data.symbol={isProject:!0,path:this.path,uuid:t}),!this.data.footprint&&e&&(this.data.footprint={isProject:!0,path:this.path,uuid:e});else{let[i,n]=this.addData.device.source.split(ax);!this.data.symbol&&t&&(this.data.symbol={isProject:r,path:n,uuid:t}),!this.data.footprint&&e&&(this.data.footprint={isProject:r,path:n,uuid:e})}}}onbeforeCreate(){var o,t,e,r;if((o=this.addData.symbol)!=null&&o.docType&&!O7e((t=this.addData.symbol)==null?void 0:t.docType))throw new gt("CREATE_DEVICE","invalid symbol docType");if((e=this.addData.footprint)!=null&&e.docType&&((r=this.addData.footprint)==null?void 0:r.docType)!==4)throw new gt("CREATE_DEVICE","invalid footprint docType");if(this.addData.footprint&&(this.addData.footprint.isConnectDevice=!0),this.addData.device&&this.addData.device.attributes["3D Model"]){let i=this.addData.device.attributes["3D Model"];i.includes(ax)||(this.addData.device.attributes["3D Model"]=`${i}${ax}${this.addData.device.path}`)}return{success:!0}}async create(){if(Object.keys(this.addData).length>0){this.onbeforeCreate();let o=[this.addData,this.path],{message:t}=await mn.messageBus.rpcCall(us.DEVICE.CREATE,o);if(!t.success)throw new gt("CREATE_DEVICE",t.message||"Creation of the device failed!");let{device:e,symbol:r,footprint:i}=t.result;e&&(this.result.device={success:!0,result:e}),r&&(this.result.symbol={success:!0,result:r}),i&&(this.result.footprint={success:!0,result:i})}return{success:!0}}async updateBind(){let{device:o,symbol:t,footprint:e}=this.result,r=o!=null&&o.success?o==null?void 0:o.result:null,i=t!=null&&t.success?t==null?void 0:t.result:null,n=e!=null&&e.success?e==null?void 0:e.result:null;if(r){let s=!1;if(i!=null&&i.uuid&&r.attributes.Symbol&&i.uuid!==r.attributes.Symbol&&(r.attributes.Symbol=i.uuid,s=!0),n!=null&&n.uuid&&r.attributes.Footprint&&n.uuid!==r.attributes.Footprint&&(r.attributes.Footprint=n.uuid,s=!0),s){let a=(await mn.messageBus.rpcCall(us.DEVICE.UPDATE,[r,this.path])).message;this.result.device={success:!!a,result:a}}}return{success:!0}}async onbefore(){}async onsuccess(o){o.symbol&&!o.symbol.success&&(o.symbol.message=mM(o.symbol)||o.symbol.message),o.footprint&&!o.footprint.success&&(o.footprint.message=mM(o.footprint)||o.footprint.message),o.device&&!o.device.success&&(o.device.message=mM(o.device)||o.device.message)}},zCt=class extends aBe{constructor(o,t){super(t),this.uuid=o}onHandle(o){return this.onUpdate(o)}matching(o){throw new Error("Method not implemented.")}async isRename(o){return{success:!0}}async start(){let o=await this.getOrigin();if(!o.success)throw new gt("UPDATE_DEVICE",o.message||"Update of the device failed!");if(!this.origin)throw new gt("UPDATE_DEVICE","Device details data does not exist");let t=this.origin.display_title||this.origin.title,e=[{uuid:this.uuid,title:t},this.path];if((await mn.messageBus.rpcCall(us.DEVICE.IS_CHANGE,e)).message){let r=await this.rename(this.origin,{path:this.path});if(!r.success)throw new gt("UPDATE_DEVICE",r.message||"Update of the device failed!")}return{success:!0,result:this.origin}}},YCt=class extends OB{constructor(o){let{path:t,uuid:e,data:r,options:i={}}=o,{matchKey:n=!0,byUUID:s=!0,bySource:a=!0,byVersion:l=!1,renameKey:c=!1}=i;super(t),this.addData={},this.map={},this.result={device:null,symbol:null,footprint:null,map:{}},this.uuid=e,this.data=r,this.matchKey=n,this.byUUID=s,this.bySource=a,this.byVersion=l,this.renameKey=c}async start(){var o,t,e,r,i,n,s,a,l,c;try{await this.check(),await this.onbefore();let h={path:this.path,matchKey:this.matchKey,byUUID:this.byUUID,bySource:this.bySource,byVersion:this.byVersion,renameKey:this.renameKey};if(this.data.device){let p={...h,data:this.data.device},m=await new zCt(this.uuid,p).start();if(m.success){let g=m.result;g&&(this.updateData=g),this.getBind()}else throw new gt("UPDATE_DEVICE",m.message||"Update of the device failed!")}if(this.data.symbol){let p={...h,data:this.data.symbol,renameKey:this.renameKey,printLog:!1},m=await new _Ie(p).start();if(!m.success)throw new gt("UPDATE_DEVICE",m.message||"Update of the device failed!");let{respond:g,addData:y}=m.result;if(this.result.symbol=g,y&&(this.addData.symbol=y),this.updateData&&this.addData.symbol)this.updateData.attributes.Symbol=this.addData.symbol.uuid;else if(this.updateData&&(o=this.result.symbol)!=null&&o.success&&this.result.symbol.result)this.updateData.attributes.Symbol=this.result.symbol.result.uuid;else if((t=this.updateData)!=null&&t.attributes.Symbol&&(e=this.result.symbol)!=null&&e.success&&!((r=this.result.symbol)!=null&&r.result)&&!this.addData.symbol){let b="The symbol associated with the device does not exist!";throw new gt("UPDATE_DEVICE",b)}}if(this.data.footprint){let p={...h,data:this.data.footprint,renameKey:this.renameKey,printLog:!1},m=await new AIe(p).start();if(!m.success)throw new gt("UPDATE_DEVICE",m.message||"Update of the device failed!");let{respond:g,addData:y}=m.result;if(this.result.footprint=g,y&&(this.addData.footprint=y),this.updateData&&this.addData.footprint)this.updateData.attributes.Footprint=this.addData.footprint.uuid;else if(this.updateData&&(i=this.result.footprint)!=null&&i.success&&this.result.footprint.result)this.updateData.attributes.Footprint=this.result.footprint.result.uuid;else if((n=this.updateData)!=null&&n.attributes.Footprint&&(s=this.result.footprint)!=null&&s.success&&!((a=this.result.footprint)!=null&&a.result)&&!this.addData.footprint){let b="The footprint associated with the device does not exist!";throw new gt("UPDATE_DEVICE",b)}}let u=await this.create();if(!u.success)throw new gt("UPDATE_DEVICE",u.message||"Update of the device failed!");let d=await this.update();if(!d.success)throw new gt("UPDATE_DEVICE",d.message||"Update of the device failed!");if(!this.result){let p={text:"Failed to update project library device {title}!",args:{title:((l=this.updateData)==null?void 0:l.display_title)||((c=this.updateData)==null?void 0:c.title)||""}};throw new gt("UPDATE_DEVICE",p)}return await this.onsuccess(this.result),{success:!0,result:Object.assign(this.result,{map:this.map})}}catch(h){throw new gt("UPDATE_DEVICE",h.message||"Update of the device failed!")}}getBind(){if(this.updateData){let{attributes:o}=this.updateData,{Symbol:t,Footprint:e}=o||{},{isProject:r}=this.data.device;if(r===void 0)!this.data.symbol&&t&&(this.data.symbol={isProject:!0,path:this.path,uuid:t}),!this.data.footprint&&e&&(this.data.footprint={isProject:!0,path:this.path,uuid:e});else{let[i,n]=this.updateData.source.split(ax);!this.data.symbol&&t&&(this.data.symbol={isProject:r,path:n,uuid:t}),!this.data.footprint&&e&&(this.data.footprint={isProject:r,path:n,uuid:e})}}}onbeforeCreate(){var o,t,e,r;if((o=this.addData.symbol)!=null&&o.docType&&!O7e((t=this.addData.symbol)==null?void 0:t.docType))throw new gt("UPDATE_DEVICE","invalid symbol docType");if((e=this.addData.footprint)!=null&&e.docType&&((r=this.addData.footprint)==null?void 0:r.docType)!==4)throw new gt("UPDATE_DEVICE","invalid footprint docType");return this.addData.footprint&&(this.addData.footprint.isConnectDevice=!0),{success:!0}}async create(){let{symbol:o,footprint:t}=this.addData;if(this.onbeforeCreate(),o){let e=(await mn.messageBus.rpcCall(us.SYMBOL.CREATE,[o,this.path])).message;if(!e.success)throw new gt("UPDATE_DEVICE",e.message||"Project library symbol added failed!");let r=e.result;this.result.symbol={success:!0,result:r},this.map[o.uuid]=r.uuid}if(t){let e=(await mn.messageBus.rpcCall(us.FOOTPRINT.CREATE,[t,this.path])).message;if(!e.success)throw new gt("UPDATE_DEVICE",e.message||"Project library footprint added failed!");let r=e.result;this.result.footprint={success:!0,result:r},this.map[t.uuid]=r.uuid}return{success:!0}}async update(){var o,t,e;let r=this.updateData;if(r){(o=this.result.symbol)!=null&&o.success&&this.result.symbol.result&&(r.attributes.Symbol=(t=this.result.symbol)==null?void 0:t.result.uuid),(e=this.result.footprint)!=null&&e.success&&this.result.footprint.result&&(r.attributes.Footprint=this.result.footprint.result.uuid);let i=[{...r,uuid:this.uuid,keepVersion:this.keepVersion},this.path],n=(await mn.messageBus.rpcCall(us.DEVICE.UPDATE,i)).message;if(!n){let s=r.display_title||r.title||"";throw new gt("UPDATE_DEVICE",`Update of the device failed! title: ${s}`)}this.result.device={success:!0,result:n}}return{success:!0}}async onbefore(){CM(this.data.device)?(this.onlyIdentity=!0,this.keepVersion=!0):(this.onlyIdentity=!1,this.keepVersion=!1)}async onsuccess(o){o.symbol&&!o.symbol.success&&(o.symbol.message=mM(o.symbol)||o.symbol.message),o.footprint&&!o.footprint.success&&(o.footprint.message=mM(o.footprint)||o.footprint.message),o.device&&!o.device.success&&(o.device.message=mM(o.device)||o.device.message)}},jCt=class extends OB{constructor(o){let{path:t,data:e,options:r={}}=o,{matchKey:i=!0,byUUID:n=!0,byVersion:s=!0,bySource:a=!1,renameKey:l=!1}=r;super(t),this.data=e,this.byUUID=n,this.byVersion=s,this.bySource=a,this.renameKey=l,this.matchKey=i}async start(){await this.check(),await this.onbefore();let o={path:this.path,byUUID:this.byUUID,byVersion:this.byVersion,bySource:this.bySource,renameKey:this.renameKey,matchKey:this.matchKey},t=await new _Ie({...o,data:this.data}).start();if(!t.success)throw new gt("CREATE_SYMBOL",t.message||"Project library symbol added failed!");let{addData:e,respond:r}=t.result;if(r&&!r.success)throw new gt("CREATE_SYMBOL",r.message||"Project library symbol added failed!");if(r&&r.success)this.result=r.result;else if(e){let i=(await mn.messageBus.rpcCall(us.SYMBOL.CREATE,[e,this.path])).message;if(!i.success)throw new gt("CREATE_SYMBOL","Project library symbol added failed!");this.result=i.result}if(!this.result)throw new gt("CREATE_SYMBOL","Project library symbol added failed!");return await this.onsuccess(this.result),{success:!0,result:this.result}}async onbefore(){}async onsuccess(o){}},XCt=class extends OB{constructor(o){let{path:t,data:e,options:r={}}=o,{matchKey:i=!0,byUUID:n=!0,byVersion:s=!0,bySource:a=!1,renameKey:l=!1}=r;super(t),this.data=e,this.byUUID=n,this.byVersion=s,this.bySource=a,this.renameKey=l,this.matchKey=i}async start(){await this.check(),await this.onbefore();let o={path:this.path,byUUID:this.byUUID,byVersion:this.byVersion,bySource:this.bySource,renameKey:this.renameKey,matchKey:this.matchKey},t=await new AIe({...o,data:this.data}).start();if(!t.success)throw new gt("CREATE_FOOTPRINT",t.message||"Creation of the footprint failed!");let{addData:e,respond:r}=t.result;if(r&&!r.success)throw new gt("CREATE_FOOTPRINT",r.message||"Creation of the footprint failed!");if(r&&r.success)this.result=r.result;else if(e){let i=(await mn.messageBus.rpcCall(us.FOOTPRINT.CREATE,[e,this.path])).message;if(!i.success)throw new gt("CREATE_FOOTPRINT","Project library footprint added failed!");this.result=i.result}if(!this.result)throw new gt("CREATE_FOOTPRINT","Project library footprint added failed!");return await this.onsuccess(this.result),{success:!0,result:this.result}}async onbefore(){}async onsuccess(o){}},qCt=class extends cBe{constructor(o,t){super(t),this.uuid=o}onHandle(o){return this.onUpdate(o)}matching(o){throw new Error("Method not implemented.")}async hack(o){let{docType:t}=o;return t===17}async isRename(o){return{success:!0}}async start(){let o=await this.getOrigin();if(!o.success)throw new gt("UPDATE_SYMBOL",o.message||"Update of the symbol failed!");if(!this.origin)throw new gt("UPDATE_SYMBOL","Symbol details data does not exist");let t=this.origin.display_title||this.origin.title,e=[{uuid:this.uuid,title:t},this.path];if((await mn.messageBus.rpcCall(us.SYMBOL.IS_CHANGE,e)).message){let r=await this.rename(this.origin,{path:this.path});if(!r.success)throw new gt("UPDATE_SYMBOL",r.message||"Update of the symbol failed!")}return{success:!0,result:this.origin}}},$Ct=class extends OB{constructor(o){let{path:t,uuid:e,data:r,options:i={}}=o,{matchKey:n=!0,byUUID:s=!0,bySource:a=!0,byVersion:l=!1,renameKey:c=!1}=i;super(t),this.uuid=e,this.data=r,this.matchKey=n,this.byUUID=s,this.bySource=a,this.byVersion=l,this.renameKey=c}async start(){var o,t;await this.check(),await this.onbefore();let e={path:this.path,matchKey:this.matchKey,byUUID:this.byUUID,bySource:this.bySource,byVersion:this.byVersion,renameKey:this.renameKey,data:this.data},r=await new qCt(this.uuid,e).start();if(!r.success)throw new gt("UPDATE_SYMBOL",r.message||"Update of the symbol failed!");this.updateData=r.result;let i={uuid:this.uuid,data:this.updateData,overwriteCanvas:this.onlyIdentity,keepVersion:this.keepVersion},n=(await mn.messageBus.rpcCall(us.SYMBOL.COVER,[i,this.path])).message;if(!n.success)throw new gt("UPDATE_SYMBOL",n.message||"Update of the symbol failed!");if(this.result=n.result,!this.result){let s=((o=this.updateData)==null?void 0:o.display_title)||((t=this.updateData)==null?void 0:t.title)||"",a="Failed to update project library symbol {title}!";throw new gt("UPDATE_SYMBOL",{text:a,args:{title:s}})}return await this.onsuccess(this.result),{success:!0,result:this.result}}async onbefore(){CM(this.data)?(this.onlyIdentity=!0,this.keepVersion=!0):(this.onlyIdentity=!1,this.keepVersion=!1)}async onsuccess(o){}},KCt=class extends lBe{constructor(o,t){super(t),this.uuid=o}onHandle(o){return this.onUpdate(o)}matching(o){throw new Error("Method not implemented.")}async isRename(o){return{success:!0}}async start(){let o=await this.getOrigin();if(!o.success)throw new gt("UPDATE_FOOTPRINT",o.message||"Update of the footprint failed!");if(!this.origin)throw new gt("UPDATE_FOOTPRINT","Footprint details data does not exist");let t=this.origin.display_title||this.origin.title,e=[{uuid:this.uuid,title:t},this.path];if((await mn.messageBus.rpcCall(us.FOOTPRINT.IS_CHANGE,e)).message){let r=await this.rename(this.origin,{path:this.path});if(!r.success)throw new gt("UPDATE_FOOTPRINT",r.message||"Update of the footprint failed!")}return{success:!0,result:this.origin}}},ZCt=class extends OB{constructor(o){let{path:t,uuid:e,data:r,options:i={}}=o,{matchKey:n=!0,byUUID:s=!0,bySource:a=!0,byVersion:l=!1,renameKey:c=!1}=i;super(t),this.uuid=e,this.data=r,this.matchKey=n,this.byUUID=s,this.bySource=a,this.byVersion=l,this.renameKey=c}async start(){var o,t;await this.check(),await this.onbefore();let e={path:this.path,matchKey:this.matchKey,byUUID:this.byUUID,bySource:this.bySource,byVersion:this.byVersion,renameKey:this.renameKey,data:this.data},r=await new KCt(this.uuid,e).start();if(!r.success)throw new gt("UPDATE_FOOTPRINT",r.message||"Update of the footprint failed!");this.updateData=r.result;let i={uuid:this.uuid,data:this.updateData,overwriteCanvas:this.onlyIdentity,keepVersion:this.keepVersion},n=(await mn.messageBus.rpcCall(us.FOOTPRINT.COVER,[i,this.path])).message;if(!n.success)throw new gt("UPDATE_FOOTPRINT",n.message||"Update of the footprint failed!");if(this.result=n.result,!this.result){let s={text:"Failed to update project library footprint {title}!",args:{title:((o=this.updateData)==null?void 0:o.display_title)||((t=this.updateData)==null?void 0:t.title)||""}};throw new gt("UPDATE_FOOTPRINT",s)}return await this.onsuccess(this.result),{success:!0,result:this.result}}async onbefore(){CM(this.data)?(this.onlyIdentity=!0,this.keepVersion=!0):(this.onlyIdentity=!1,this.keepVersion=!1)}async onsuccess(o){}},JCt=class extends TIe{async getDevice(o){let t=[o.uuid,o.path],{message:e}=await mn.messageBus.rpcCall(us.DEVICE.GET,t);if(!e)throw new gt("GET_DEVICE","Device details data does not exist");return See(o.path,e)}async getDeviceAttributesKeys(o){let{message:t}=await mn.messageBus.rpcCall(us.DEVICE.GET_ATTRIBUTES_KEYS,o);if(!t.success)throw new gt("GET_DEVICE_ATTRIBUTES_KEYS",t.message);return t.result}async getDeviceAttributesValues(o){let{message:t}=await mn.messageBus.rpcCall(us.DEVICE.GET_ATTRIBUTES_VALUES,o);if(!t.success)throw new gt("GET_DEVICE_ATTRIBUTES_VALUES",t.message);return t.result}async getSymbol(o){let t=[o.uuid,o.path],{message:e}=await mn.messageBus.rpcCall(us.SYMBOL.GET,t);if(!e)throw new gt("GET_SYMBOL","Symbol details data does not exist");return yTe(o.path,e)}async getFootprint(o){let t=[o.uuid,o.path],{message:e}=await mn.messageBus.rpcCall(us.FOOTPRINT.GET,t);if(!e)throw new gt("GET_FOOTPRINT","Footprint details data does not exist");return bTe(o.path,e)}async createDevice(o){let{path:t,device:e,symbol:r,footprint:i}=o,n={path:t,data:{device:e,symbol:r,footprint:i}},s=await new WCt(n).start();if(!s.success)throw new gt("CREATE_DEVICE",s.message);let a=s.result.device;if(!(a!=null&&a.success))throw new gt("CREATE_DEVICE",a==null?void 0:a.message);let l=a.result;return See(o.path,l)}async createSymbol(o){let{path:t,symbol:e}=o,r={path:t,data:e},i=await new jCt(r).start();if(!i.success)throw new gt("CREATE_SYMBOL",i.message);let n=i.result;return yTe(o.path,n)}async createFootprint(o){let{path:t,footprint:e}=o,r={path:t,data:e},i=await new XCt(r).start();if(!i.success)throw new gt("CREATE_FOOTPRINT",i.message);let n=i.result;return bTe(o.path,n)}async updateDevice(o){let{uuid:t,path:e,device:r,symbol:i,footprint:n}=o,s={path:e,uuid:t,data:{device:r,symbol:i,footprint:n}},a=await new YCt(s).start();if(!a.success)throw new gt("UPDATE_DEVICE",a.message);let l=a.result.device;if(!(l!=null&&l.success))throw new gt("CREATE_DEVICE",l==null?void 0:l.message);let c=l.result;return See(o.path,c)}async updateDeviceAttributes(o){let t=(await mn.messageBus.rpcCall(us.DEVICE.UPDATE,[o,o.path])).message;if(!t)throw new gt("UPDATE_DEVICE_ATTRIBUTES",t.message);return See(o.path,t)}async updateSymbol(o){let{uuid:t,path:e,symbol:r}=o,i={path:e,uuid:t,data:r},n=await new $Ct(i).start();if(!n.success)throw new gt("UPDATE_SYMBOL",n.message);let s=n.result;return yTe(o.path,s)}async updateFootprint(o){let{uuid:t,path:e,footprint:r}=o,i={path:e,uuid:t,data:r},n=await new ZCt(i).start();if(!n.success)throw new gt("UPDATE_FOOTPRINT",n.message);let s=n.result;return bTe(o.path,s)}async deleteDevice(o){if(!(await mn.messageBus.rpcCall(us.DEVICE.DEL,[o.uuid,o.path])).message)throw new gt("DELETE_DEVICE","delete failed!")}async deleteSymbol(o){if(!(await mn.messageBus.rpcCall(us.SYMBOL.DEL,[o.uuid,o.path])).message)throw new gt("DELETE_SYMBOL","delete failed!")}async deleteFootprint(o){if(!(await mn.messageBus.rpcCall(us.FOOTPRINT.DEL,[o.uuid,o.path])).message)throw new gt("DELETE_FOOTPRINT","delete failed!")}async getDeviceList(o){let t=(await mn.messageBus.rpcCall(us.DEVICE.GET_LIST,o)).message;if(!t.success)throw new gt("GET_DEVICE_LIST",t.message);return t.result}async getDeviceSearchList(o){let t=(await mn.messageBus.rpcCall(us.DEVICE.GET_LIST,o)).message;if(!t.success)throw new gt("GET_DEVICE_LIST",t.message);return t.result}async getSymbolList(o){let t=(await mn.messageBus.rpcCall(us.SYMBOL.GET_LIST,o)).message;if(!t.success)throw new gt("GET_SYMBOL_LIST",t.message);return t.result}async getSymbolSearchList(o){let t=(await mn.messageBus.rpcCall(us.SYMBOL.GET_LIST,o)).message;if(!t.success)throw new gt("GET_SYMBOL_LIST",t.message);return t.result}async getFootprintList(o){let t=(await mn.messageBus.rpcCall(us.FOOTPRINT.GET_LIST,o)).message;if(!t.success)throw new gt("GET_FOOTPRINT_LIST",t.message);return t.result}async getFootprintSearchList(o){let t=(await mn.messageBus.rpcCall(us.FOOTPRINT.GET_LIST,o)).message;if(!t.success)throw new gt("GET_FOOTPRINT_LIST",t.message);return t.result}},QCt=class extends TIe{constructor(){super(...arguments),this._normalErrorMsg="Request Error.",this._extendLibManager=P0.getInstance()}async getDevice(o){var t;let e=await((t=this._extendLibManager.getLib(o.path))==null?void 0:t.getTransformedDetailInTab("device",o.uuid,o.path));if(e)return e;throw new gt("GET_DEVICE",this._normalErrorMsg)}async getSymbol(o){var t;let e=await((t=this._extendLibManager.getLib(o.path))==null?void 0:t.getTransformedDetailInTab("symbol",o.uuid,o.path));if(e)return e;throw new gt("GET_SYMBOL",this._normalErrorMsg)}async getFootprint(o){var t;let e=await((t=this._extendLibManager.getLib(o.path))==null?void 0:t.getTransformedDetailInTab("footprint",o.uuid,o.path));if(e)return e;throw new gt("GET_FOOTPRINT",this._normalErrorMsg)}async getModel3D(o){var t;let e=await((t=this._extendLibManager.getLib(o.path))==null?void 0:t.getTransformedDetailInTab("model3D",o.uuid,o.path));if(e)return e;throw new gt("GET_D3MODEL",this._normalErrorMsg)}async getDeviceList(o){var t,e,r,i,n,s,a,l;let c=await((l=this._extendLibManager.getLib(o.path))==null?void 0:l.getTransformedListInTab("device",{query:{attributes:(e=(t=o.query)==null?void 0:t.attributes)!=null?e:{},symbolType:(r=o.query)==null?void 0:r.symbol_type,classification:{primaryClassificationUuid:(n=(i=o.tags)==null?void 0:i[0])!=null?n:"",secondaryClassificationUuid:(a=(s=o.tags)==null?void 0:s[1])!=null?a:""}},page:o.page,pageSize:o.pageSize}));if(c)return c;throw new gt("GET_DEVICE_LIST",this._normalErrorMsg)}async getSymbolList(o){var t,e,r,i,n,s;let a=await((s=this._extendLibManager.getLib(o.path))==null?void 0:s.getTransformedListInTab("symbol",{query:{symbolType:(t=o.docType)==null?void 0:t[0],classification:{primaryClassificationUuid:(r=(e=o.tags)==null?void 0:e[0])!=null?r:"",secondaryClassificationUuid:(n=(i=o.tags)==null?void 0:i[1])!=null?n:""}},page:o.page,pageSize:o.pageSize}));if(a)return a;throw new gt("GET_SYMBOL_LIST",this._normalErrorMsg)}async getFootprintList(o){var t,e,r,i,n;let s=await((n=this._extendLibManager.getLib(o.path))==null?void 0:n.getTransformedListInTab("footprint",{query:{classification:{primaryClassificationUuid:(e=(t=o.tags)==null?void 0:t[0])!=null?e:"",secondaryClassificationUuid:(i=(r=o.tags)==null?void 0:r[1])!=null?i:""}},page:o.page,pageSize:o.pageSize}));if(s)return s;throw new gt("GET_FOOTPRINT_LIST",this._normalErrorMsg)}async getD3ModelSearchList1(o){var t,e,r;let{path:i,wd:n,query:s,tags:a,page:l,pageSize:c}=o,h=await((r=this._extendLibManager.getLib(i))==null?void 0:r.getTransformedListInTab("model3D",{query:{wd:n,classification:{primaryClassificationUuid:(t=a==null?void 0:a[0])!=null?t:"",secondaryClassificationUuid:(e=a==null?void 0:a[1])!=null?e:""}},page:l,pageSize:c}));if(h)return{...h,facets:{[i]:h.count}};throw new gt("GET_D3MODEL_LIST",this._normalErrorMsg)}async getD3ModelSearchList2(o){var t;let{path:e,titles:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("model3D",{query:{listByTitles:r},page:1,pageSize:1e8}));if(i)return i.lists.reduce((n,s)=>((n[s.display_title]||(n[s.display_title]=[])).push(s),n),{});throw new gt("GET_D3MODEL_LIST",this._normalErrorMsg)}async getD3ModelSearchList3(o){var t;let{path:e,uuids:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("model3D",{query:{listByUuids:r},page:1,pageSize:1e8}));if(i)return i.lists;throw new gt("GET_D3MODEL_LIST",this._normalErrorMsg)}async getD3ModelSearchList(o){return o.titles?await this.getD3ModelSearchList2(o):o.uuids?await this.getD3ModelSearchList3(o):await this.getD3ModelSearchList1(o)}async getDeviceSearchList1(o){var t,e,r,i;let{path:n,wd:s,query:a,tags:l,page:c,pageSize:h}=o,u=await((i=this._extendLibManager.getLib(n))==null?void 0:i.getTransformedListInTab("device",{query:{wd:s,attributes:(t=a==null?void 0:a.attributes)!=null?t:{},symbolType:a==null?void 0:a.symbol_type,classification:{primaryClassificationUuid:(e=l==null?void 0:l[0])!=null?e:"",secondaryClassificationUuid:(r=l==null?void 0:l[1])!=null?r:""}},page:c,pageSize:h}));if(u)return{...u,facets:{[n]:u.count}};throw new gt("GET_DEVICE_LIST",this._normalErrorMsg)}async getDeviceSearchList2(o){var t;let{path:e,titles:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("device",{query:{listByTitles:r},page:1,pageSize:1e8}));if(i)return i.lists.reduce((n,s)=>((n[s.display_title]||(n[s.display_title]=[])).push(s),n),{});throw new gt("GET_DEVICE_LIST",this._normalErrorMsg)}async getDeviceSearchList3(o){var t;let{path:e,uuids:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("device",{query:{listByUuids:r},page:1,pageSize:1e8}));if(i)return i.lists;throw new gt("GET_DEVICE_LIST",this._normalErrorMsg)}async getDeviceSearchList(o){return o.titles?await this.getDeviceSearchList2(o):o.uuids?await this.getDeviceSearchList3(o):await this.getDeviceSearchList1(o)}async getSymbolSearchList1(o){var t,e,r,i;let{path:n,wd:s,query:a,tags:l,page:c,pageSize:h}=o,u=await((i=this._extendLibManager.getLib(n))==null?void 0:i.getTransformedListInTab("symbol",{query:{wd:s,symbolType:(t=o.docType)==null?void 0:t[0],classification:{primaryClassificationUuid:(e=l==null?void 0:l[0])!=null?e:"",secondaryClassificationUuid:(r=l==null?void 0:l[1])!=null?r:""}},page:c,pageSize:h}));if(u)return{...u,facets:{[n]:u.count}};throw new gt("GET_DEVICE_LIST",this._normalErrorMsg)}async getSymbolSearchList2(o){var t;let{path:e,titles:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("symbol",{query:{listByTitles:r},page:1,pageSize:1e8}));if(i)return i.lists.reduce((n,s)=>((n[s.display_title]||(n[s.display_title]=[])).push(s),n),{});throw new gt("GET_DEVICE_LIST",this._normalErrorMsg)}async getSymbolSearchList3(o){var t;let{path:e,uuids:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("symbol",{query:{listByUuids:r},page:1,pageSize:1e8}));if(i)return i.lists;throw new gt("GET_DEVICE_LIST",this._normalErrorMsg)}async getSymbolSearchList(o){return o.titles?await this.getSymbolSearchList2(o):o.uuids?await this.getSymbolSearchList3(o):await this.getSymbolSearchList1(o)}async getFootprintSearchList1(o){var t,e,r;let{path:i,wd:n,query:s,tags:a,page:l,pageSize:c}=o,h=await((r=this._extendLibManager.getLib(i))==null?void 0:r.getTransformedListInTab("footprint",{query:{wd:n,classification:{primaryClassificationUuid:(t=a==null?void 0:a[0])!=null?t:"",secondaryClassificationUuid:(e=a==null?void 0:a[1])!=null?e:""}},page:l,pageSize:c}));if(h)return{...h,facets:{[i]:h.count}};throw new gt("GET_DEVICE_LIST",this._normalErrorMsg)}async getFootprintSearchList2(o){var t;let{path:e,titles:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("footprint",{query:{listByTitles:r},page:1,pageSize:1e8}));if(i)return i.lists.reduce((n,s)=>((n[s.display_title]||(n[s.display_title]=[])).push(s),n),{});throw new gt("GET_DEVICE_LIST",this._normalErrorMsg)}async getFootprintSearchList3(o){var t;let{path:e,uuids:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("footprint",{query:{listByUuids:r},page:1,pageSize:1e8}));if(i)return i.lists;throw new gt("GET_DEVICE_LIST",this._normalErrorMsg)}async getFootprintSearchList(o){return o.titles?await this.getFootprintSearchList2(o):o.uuids?await this.getFootprintSearchList3(o):await this.getFootprintSearchList1(o)}createDevice(o){throw new gt("CREATE_DEVICE","Not Supported.")}createSymbol(o){throw new gt("GET_SYMBOL","Not Supported.")}createFootprint(o){throw new gt("CREATE_FOOTPRINT","Not Supported.")}updateDevice(o){throw new gt("UPDATE_DEVICE","Not Supported.")}updateSymbol(o){throw new gt("GET_SYMBOL","Not Supported.")}updateFootprint(o){throw new gt("GET_SYMBOL","Not Supported.")}deleteDevice(o){throw new gt("GET_SYMBOL","Not Supported.")}deleteSymbol(o){throw new gt("GET_SYMBOL","Not Supported.")}deleteFootprint(o){throw new gt("GET_SYMBOL","Not Supported.")}},eSt=(o=>(o[o.CBB=1]="CBB",o[o.SYMBOL=2]="SYMBOL",o[o.DEVICE=3]="DEVICE",o[o.FOOTPRINT=4]="FOOTPRINT",o[o.MODEL3D=5]="MODEL3D",o[o.MODELSIM=6]="MODELSIM",o[o.PANEL_LIB=29]="PANEL_LIB",o))(eSt||{}),tSt=["title","description","tags","images"],aa=new VCt,Sf=new JCt,_S=new QCt,iu=class{static getDevice(o){return P0.getInstance().hasLib(o.path)?_S.getDevice(o):o.isProject?Sf.getDevice(o):aa.getDevice(o)}static getDeviceAttributesKeys(o){return o.isProject?Sf.getDeviceAttributesKeys(o):aa.getDeviceAttributesKeys(o)}static getDeviceAttributesValues(o){return o.isProject?Sf.getDeviceAttributesValues(o):aa.getDeviceAttributesValues(o)}static getSymbol(o){return P0.getInstance().hasLib(o.path)?_S.getSymbol(o):o.isProject?Sf.getSymbol(o):aa.getSymbol(o)}static getFootprint(o){return P0.getInstance().hasLib(o.path)?_S.getFootprint(o):o.isProject?Sf.getFootprint(o):aa.getFootprint(o)}static getPanelLib(o){if(o.isProject)throw new gt("GET_PANEL_LIB","Api call error!");return aa.getPanelLib(o)}static getD3Model(o){return P0.getInstance().hasLib(o.path)?_S.getModel3D(o):o.isProject?null:aa.getD3Model(o)}static getSimModel(o){if(o.isProject)throw new gt("GET_SIM_MODEL","Api call error!");return aa.getSimModel(o)}static getDeviceList(o){return P0.getInstance().hasLib(o.path)?_S.getDeviceList(o):o.isProject?Sf.getDeviceList(o):aa.getDeviceList(o)}static getSymbolList(o){return P0.getInstance().hasLib(o.path)?_S.getSymbolList(o):o.isProject?Sf.getSymbolList(o):aa.getSymbolList(o)}static getFootprintList(o){return P0.getInstance().hasLib(o.path)?_S.getFootprintList(o):o.isProject?Sf.getFootprintList(o):aa.getFootprintList(o)}static getPanelLibList(o){if(o.isProject)throw new gt("GET_D3MODEL_LIST","Api call error!");return aa.getPanelLibList(o)}static getD3ModelList(o){if(o.isProject)throw new gt("GET_D3MODEL_LIST","Api call error!");return aa.getD3ModelList(o)}static getSimModelList(o){if(o.isProject)throw new gt("GET_SIM_MODEL_LIST","Api call error!");return aa.getSimModelList(o)}static getDeviceSearchList(o){return P0.getInstance().hasLib(o.path)?_S.getDeviceSearchList(o):o.isProject?Sf.getDeviceSearchList(o):aa.getDeviceSearchList(o)}static getSymbolSearchList(o){return P0.getInstance().hasLib(o.path)?_S.getSymbolSearchList(o):o.isProject?Sf.getSymbolSearchList(o):aa.getSymbolSearchList(o)}static getFootprintSearchList(o){return P0.getInstance().hasLib(o.path)?_S.getFootprintSearchList(o):o.isProject?Sf.getFootprintSearchList(o):aa.getFootprintSearchList(o)}static getPanelLibSearchList(o){if(o.isProject)throw new gt("GET_PANEL_LIB_SEARCH_LIST","Api call error!");return aa.getPanelLibSearchList(o)}static getD3ModelSearchList(o){if(o.isProject)throw new gt("GET_D3MODEL_SEARCH_LIST","Api call error!");return P0.getInstance().hasLib(o.path)?_S.getD3ModelSearchList(o):aa.getD3ModelSearchList(o)}static getSimModelSearchList(o){if(o.isProject)throw new gt("GET_SIM_MODEL_SEARCH_LIST","Api call error!");return aa.getSimModelSearchList(o)}static createDevice(o){return o.isProject?Sf.createDevice(o):aa.createDevice(o)}static createSymbol(o){return o.isProject?Sf.createSymbol(o):aa.createSymbol(o)}static createFootprint(o){return o.isProject?Sf.createFootprint(o):aa.createFootprint(o)}static createD3Model(o){return o.isProject?null:aa.createD3Model(o)}static createPanelLib(o){if(o.isProject)throw new gt("CREATE_PANEL_LIB","Api call error!");return aa.createPanelLib(o)}static createSimModel(o){if(o.isProject)throw new gt("CREATE_SIM_MODEL","Api call error!");return aa.createSimModel(o)}static updateDevice(o){return o.isProject?Sf.updateDevice(o):aa.updateDevice(o)}static updateDeviceAttributes(o){return o.isProject?Sf.updateDeviceAttributes(o):aa.updateDeviceAttributes(o)}static updateSymbol(o){return o.isProject?Sf.updateSymbol(o):aa.updateSymbol(o)}static updateFootprint(o){return o.isProject?Sf.updateFootprint(o):aa.updateFootprint(o)}static updatePanelLib(o){if(o.isProject)throw new gt("UPDATE_PANEL_LIB","Api call error!");return aa.updatePanelLib(o)}static updateD3Model(o){if(o.isProject)throw new gt("UPDATE_D3MODEL","Api call error!");return aa.updateD3Model(o)}static updateSimModel(o){if(o.isProject)throw new gt("UPDATE_SIM_MODEL","Api call error!");return aa.updateSimModel(o)}static deleteDevice(o){return o.isProject?Sf.deleteDevice(o):aa.deleteDevice(o)}static deleteSymbol(o){return o.isProject?Sf.deleteSymbol(o):aa.deleteSymbol(o)}static deleteFootprint(o){return o.isProject?Sf.deleteFootprint(o):aa.deleteFootprint(o)}static deletePanelLib(o){if(o.isProject)throw new gt("DELETE_PANEL_LIB","Api call error!");return aa.deletePanelLib(o)}static deleteSimModel(o){if(o.isProject)throw new gt("DELETE_SIM_MODEL","Api call error!");return aa.deleteSimModel(o)}static deleteD3Model(o){if(o.isProject)throw new gt("DELETE_3DMODEL","Api call error!");return aa.delete3DModel(o)}static starDevice(o){if(o.isProject)throw new gt("STAR_DEVICE","Api call error!");return aa.starDevice(o)}static starSymbol(o){if(o.isProject)throw new gt("STAR_SYMBOL","Api call error!");return aa.starSymbol(o)}static starFootprint(o){if(o.isProject)throw new gt("STAR_FOOTPRINT","Api call error!");return aa.starFootprint(o)}static starPanelLib(o){if(o.isProject)throw new gt("STAR_PANEL_LIB","Api call error!");return aa.starPanelLib(o)}static unstarDevice(o){if(o.isProject)throw new gt("UNSTAR_DEVICE","Api call error!");return aa.unstarDevice(o)}static unstarSymbol(o){if(o.isProject)throw new gt("UNSTAR_SYMBOL","Api call error!");return aa.unstarSymbol(o)}static unstarFootprint(o){if(o.isProject)throw new gt("UNSTAR_FOOTPRINT","Api call error!");return aa.unstarFootprint(o)}static unstarPanelLib(o){if(o.isProject)throw new gt("UNSTAR_PANEL_LIB","Api call error!");return aa.unstarPanelLib(o)}};async function hBe(o,t,e,r={}){r.eachProcessHook&&r.eachProcessHook(.01);let i=e||Ai.SYSTEMLIB_UUID,n=null;if(t)try{n=await iu.getDevice({isProject:o,path:e,uuid:t})}catch(h){console.warn(h)}r.eachProcessHook&&r.eachProcessHook(.25);let s=null,a={Footprint:!1,symbol:!1,d3DModel:!1};if(n){let h=(n.attributes||{}).Symbol;if(h){try{s=await iu.getSymbol({isProject:o,path:e,uuid:h})}catch(u){console.warn(u)}s||(a.symbol=!0)}}r.eachProcessHook&&r.eachProcessHook(.5);let l=null;if(n){let h=(n.attributes||{}).Footprint;if(h){try{l=await iu.getFootprint({isProject:o,path:e,uuid:h})}catch(u){console.warn(u)}l||(a.Footprint=!0)}}r.eachProcessHook&&r.eachProcessHook(.75);let c=null;if(n){let h=n.attributes||{},u=h["3D Model"],d=h["3D Model Title"],p=eY(u,!0),m=p.path||Ai.SYSTEMLIB_UUID||i;if(P0.getInstance().hasLib(p.path||i)?c=await iu.getD3Model({uuid:p.componentTitleOrId,path:p.path,isProject:!1}):p.componentTitleOrId&&(p.isLocaleFilenameMode?c=(await yIe(p.componentTitleOrId,m)).result:c=await rY(p.componentTitleOrId,m)),!c&&u&&d){if(r.isCheckD3ModelFileExist){let g=await wke(u);g.success&&g.result instanceof Blob?a.d3DModel=!1:a.d3DModel=!0}else a.d3DModel=!0;c=bIe(u,d,p.path)}}return r.eachProcessHook&&r.eachProcessHook(1),{setPath:i,deviceItem:n,symbolItem:s,footprintItem:l,d3modelItem:c,hasIdButNotFound:a}}async function rSt(o=!1,t,e,r,i){let n=i?!!i.forceAsSymbol:!1,s=i?!!i.ignoreDoctypeCheck:!1,a=i?!!i.isDevice:!1,l=i?!!i.isCheckD3ModelFileExist:!1;if(!s){if(r===28){let u=i?!!i.attachedDeviceBindingExtra:!1,d=i?i.eachProcessHook:null;try{let p=null;return u?p=await hBe(o,t,e,{eachProcessHook:d,isCheckD3ModelFileExist:l}):p=await iu.getDevice({isProject:o,path:e,uuid:t}),{code:0,success:!0,result:p,message:""}}catch(p){return{code:-1,success:!1,result:null,message:p.message.toString()}}}if(r===4)try{return{code:0,success:!0,result:await iu.getFootprint({isProject:o,path:e,uuid:t}),message:""}}catch(u){return{code:-1,success:!1,result:null,message:u.message.toString()}}if(n||r&&[2,18,19,20,21,22,25,31,7,32,6].indexOf(r)>=0)try{return{code:0,success:!0,result:await iu.getSymbol({isProject:o,path:e,uuid:t}),message:""}}catch(u){return{code:-1,success:!1,result:null,message:u.message.toString()}}if(r===16)try{return{code:0,success:!0,result:await rY(t,e),message:""}}catch(u){return{code:-1,success:!1,result:null,message:u.message.toString()}}}let c=await Jn("GET",a?eh(qn.DEVICE.GET,{uuid:t}):eh(qn.COMPONENT.GET,{uuid:t}),{uuid:t,path:e},{headers:{"Content-Type":"application/json",path:e}});if(c.code===0&&c.success&&typeof c.result=="object")return{code:0,success:!0,result:c.result,message:""};let h=c.message||c.msg||"Request Error.";return{code:c.code||-1,success:!1,result:null,message:h}}function jTe(o,t){let e=o.owner||{},r=typeof o.updated_at=="string"?o.updated_at:typeof o.updated_at=="number"?hx(new Date(o.updated_at)):"",i=typeof o.updateTime=="string"?o.updateTime:typeof o.updateTime=="number"?hx(new Date(D1(o.updateTime))):"";return{...o,$id:String(t),numberIndex:t+1,ownerBelong:e.username,updateTimeString:r||i}}function iSt(o,t,e){let r=[];for(let i=0;i<o.length;i++){let n=o[i][t]?o[i][t].toLocaleLowerCase():"",s=e?e.toLocaleLowerCase():"";n.indexOf(s)>=0&&r.push(o[i])}return r}async function nSt(o,t,e,r){let i=await new Promise(s=>{fetch(uIe.D3Model.client3DModelList+`?step_path=${o}`,{method:"GET"}).then(a=>{a.json().then(l=>{if(l){s(l);return}s(null)})})}),n={code:0,success:!0,result:{count:0,page:1,pageSize:r,totalPage:1,lists:[]},msg:""};return i&&i.success?(n.result.lists=(i.result||[]).map((s,a)=>{let l=hx(new Date(s.mtime*1e3)),c={uuid:`${s.fileName}|${t}`,rowFileTag:`${s.fileName}|${t}`,path:t,display_title:s.fileName,description:"",docType:16,isFavorite:!1,modifier:null,owner:null,tags:{child_tag:[],parent_tag:[]},title:s.fileName,updateTime:D1(s.mtime),updated_at:l,createTime:D1(s.mtime),created_at:l,creator:null,dataStr:"",public:void 0,type:16};return{...jTe(c,a)}}),n.result.count=i.result.length):(n.code=Ai.ERR_CODE.NORMAL,n.success=!1,n.msg=i.message||"Fetch local 3D model list error."),n}async function oSt(o,t,e,r,i){let n={};for(let c=0;c<t.length;c++){let h=t[c].id,u=await new Promise(d=>{fetch(uIe.D3Model.client3DModelList+`?step_path=${h}`,{method:"GET"}).then(p=>{p.json().then(m=>{if(m){d(m);return}d(null)})})});if(u&&u.success){n[h]={list:u.result.map((d,p)=>jTe(d,p))};continue}n[h]=null}let s={},a={},l={count:0};for(let c=0;c<t.length;c++){let h=t[c].id;if(n[h]){let u=iSt(n[h].list,"fileName",r);if(!u.length){s[h]=0,a[h]=[];continue}s[h]=u.length,a[h]=u.map((d,p)=>{let m=hx(new Date(d.mtime*1e3)),g={uuid:`${d.fileName}|${d.path}`,path:d.path,rowFileTag:`${d.fileName}|${d.path}`,display_title:d.fileName,description:"",docType:16,isFavorite:!1,modifier:null,owner:null,tags:{child_tag:[],parent_tag:[]},title:d.fileName,updateTime:D1(d.mtime),updated_at:m,createTime:D1(d.mtime),created_at:m,creator:null,dataStr:"",public:void 0,source:void 0,std_uuid:void 0,ticket:0,type:16};return{...jTe(g,p)}}),l.count++;continue}s[h]=0,a[h]=[]}return{code:0,success:!0,result:{count:l.count,facets:s,lists:a[o]||[],uid:o,wd:r,page:1,pageSize:i,totalPage:1},msg:""}}function uBe(o){let t=null;return t=vIe(o.title),!t.success||(t=dBe(o.description),!t.success)?t:{code:0,success:!0,message:"",key:"",result:null}}function sSt(o){let t=null;return t=vIe(o.name),!t.success||(t=aSt(o.type),!t.success)||(t=lSt(o.model),!t.success)?t:{code:0,success:!0,message:"",key:"",result:null}}function vIe(o){let t={code:0,success:!0,message:"",key:"",result:null};return(!o||o.length<=0||o.length>128)&&(t.code=Ai.ERR_CODE.NORMAL,t.success=!1,t.message="The title length must be between 1~128 characters!"),t}function dBe(o){let t={code:0,success:!0,message:"",key:"",result:null};return o&&o.length>255&&(t.code=Ai.ERR_CODE.NORMAL,t.success=!1,t.message="Description should be no more than 255 letters"),t}function aSt(o){let t={code:0,success:!0,message:"",key:"",result:null};return o||(t.code=Ai.ERR_CODE.NORMAL,t.success=!1,t.message="The 3D model type is incorrect!"),t}function lSt(o){let t={code:0,success:!0,message:"",key:"",result:null};return o||(t.code=Ai.ERR_CODE.NORMAL,t.success=!1,t.message="The 3D model is incorrect!"),t}async function cSt(o,t,e,r){if(!t||!e||!r)return{code:-1,success:!1,result:null,message:"missing uuid or path or detail data."};let i=uBe({title:r.title,description:r.description});if(!i.success)return{code:i.code,success:!1,result:null,message:i.message};let n=await Jn("POST",eh(qn.COMPONENT.UPDATE,{uuid:t}),{...r,owner:e},{headers:{"Content-Type":"application/json",path:e}});if(n.code===0&&n.success&&typeof n.result=="object")return{code:0,success:!0,result:n.result,message:""};let s=n.message||n.msg||"Request Error.";return{code:n.code||-1,success:!1,result:null,message:s}}async function hSt(o){let t=sSt(o);if(!t.success)return{code:t.code,success:!1,message:t.message};let e=new FormData;o.content&&e.append("src",new Blob([o.content]),o.name),e.append("mesh",new Blob([o.model]),"model.obj");let r=await Jn("POST",qn.COMPONENT.UPLOAD_3DMODEL,e,{contentType:!1,gzipFormData:!0},!0);if(r.success)return{success:!0,result:r.result};let i=r.message||r.msg||"Request Error.";return{success:!1,code:r.code,message:i}}var xS=class{};xS.createDefaultD3modelItem=bIe,xS.fetchD3ModelItemHandle=rY,xS.updateD3ModelItem=cSt,xS.uploadD3ModelItem=hSt,xS.d3modelInfoVerify=uBe,xS.d3modelInfoTitleVerify=vIe,xS.d3modelInfoDescriptionVerify=dBe,xS.fetchD3ModelListOnLocaleFolder=nSt,xS.fetchD3ModelListBySearchOnLocaleFolder=oSt,xS.fetchD3ModelItemOnLocaleFolder=yIe;function uSt(o,t=void 0){let e=null;if(e=pBe(o.title),!e.success||(e=fBe(o.description),!e.success)||(e=mBe(o.attributes),!e.success))return e;let r={code:0,success:!0,message:"",key:"",result:null};return typeof t<"u"&&(t.length<=0||t.length>128)&&(r.code=Ai.ERR_CODE.NORMAL,r.success=!1,r.message="The title length must be between 1~128 characters!"),r}function pBe(o){let t={code:0,success:!0,message:"",key:"",result:null};return(!o||o.length<=0||o.length>128)&&(t.code=Ai.ERR_CODE.NORMAL,t.success=!1,t.message="The title length must be between 1~128 characters!"),t}function fBe(o){let t={code:0,success:!0,message:"",key:"",result:null};return o&&o.length>255&&(t.code=Ai.ERR_CODE.NORMAL,t.success=!1,t.message="Description should be no more than 255 letters"),t}function mBe(o){let t={code:0,success:!0,message:"",key:"",result:null},e=Object.keys(o);for(let r=0;r<e.length;r++){let i=e[r],n=o[i];if(typeof n=="string"&&n.trim().length>255)return t.code=Ai.ERR_CODE.NORMAL,t.message="{0} should be no more than 255 letters",t.key=i,t}return t}var tB=class{};tB.deviceInfoVerify=uSt,tB.deviceInfoTitleVerify=pBe,tB.deviceInfoDescriptionVerify=fBe,tB.deviceInfoAttributesVerify=mBe,tB.fetchDeviceItem=hBe;function dSt(){return[["DOCTYPE","FOOTPRINT",""],["HEAD",{editorVersion:"dev",importFlag:0}],["CANVAS",0,0,"mm",5,5,5,5,5,5,2,2,5]].map(o=>JSON.stringify(o)).join(`
`)}function pSt(o="",t="",e=""){let r=t||"[Empty Footprint Component Item]",i=new Date().getTime(),n=hx(new Date(i)),s={avatar:"",nickname:"",username:"",uuid:""};return{$emptyItem:!0,createTime:i,created_at:n,creator:{...s},dataStr:o,description:"",display_title:r,docType:4,modifier:{...s},owner:{...s},path:Ai.SYSTEMLIB_UUID,public:!1,source:"",std_uuid:"",tags:{child_tag:null,parent_tag:null},ticket:0,title:r,type:0,updateTime:i,updated_at:n,uuid:e||"",version:""}}function fSt(o){let t=null;return t=mSt(o.title),t.success?{code:0,success:!0,message:"",key:void 0,result:null}:t}function mSt(o){let t={code:0,success:!0,message:"",key:void 0,result:null};return(!o||o.length<=0||o.length>128)&&(t.code=Ai.ERR_CODE.NORMAL,t.success=!1,t.message="The title length must be between 1~128 characters!"),t}var kee=class{};kee.footprintInfoVerify=fSt,kee.createEmptyFootprintItem=pSt,kee.createEmptyFootprintDataStr=dSt;function gSt(o){let t=null;return t=ySt(o.title),!t.success||(t=bSt(o.docType),!t.success)?t:{code:0,success:!0,message:"",key:void 0,result:null}}function ySt(o){let t={code:0,success:!0,message:"",key:void 0,result:null};return(!o||o.length<=0||o.length>128)&&(t.code=Ai.ERR_CODE.NORMAL,t.success=!1,t.message="The title length must be between 1~128 characters!"),t}function bSt(o){let t={code:0,success:!0,message:"",key:void 0,result:null};return(typeof o>"u"||!o)&&(t.code=Ai.ERR_CODE.NORMAL,t.success=!1,t.message="Document data abnormality"),t}var gBe=class{};gBe.symbolInfoVerify=gSt;async function PSt(o=!1,t,e,r,i=[]){let n={isDuplicate:!1,path:r,uuids:[]},s=e.toLocaleLowerCase(),a=await Qee(o,s,r,t,mn.loginedUserUuid);if(a.success&&a.result&&a.result.length){let l=[];for(let c=0;c<a.result.length;c++){if(i.indexOf(a.result[c].uuid)>=0)continue;let h=(a.result[c].title||a.result[c].display_title).toLocaleLowerCase();if(s===h&&a.result[c].path===r){if(typeof t>"u"||t===28){l.push(a.result[c]);continue}if(typeof a.result[c].docType>"u"){l.push(a.result[c]);continue}if(a.result[c].docType===t){l.push(a.result[c]);continue}}}for(let c=0;c<l.length;c++)n.uuids.push(l[c].uuid);n.isDuplicate=!!n.uuids.length}return n}var yBe=(o=>(o.UNZIP="/pro-mgr/unzip",o.EXTRACT="/pro-mgr/unzip/extract",o.FLOW="/pro-mgr/unzip/flow",o.PARSE="/pro-mgr/unzip/parse",o.CHECK="/pro-mgr/unzip/check",o.GET_PROJECT_IN_CLOUD="/pro-mgr/getProjectInCloud",o.GET_PROJECT_IN_LOCAL="/pro-mgr/getProjectInLocal",o.GET_PROJECT_BY_IN_LOCAL="/pro-mgr/getProjectByInLocal",o.EXPORT_ZIP="/pro-mgr/export/zip",o.EXPORT_DOCUMENT="/pro-mgr/export/document",o.EXPORT_DEVICE="/pro-mgr/export/lib/device",o.EXPORT_SYMBOL="/pro-mgr/export/lib/symbol",o.EXPORT_FOOTPRIN="/pro-mgr/export/lib/footprint",o.EXPORT_PANEL_LIB="/pro-mgr/export/lib/panelLib",o.DOWNLOAD_PROJECT="/pro-mgr/export/download/project",o.DOWNLOAD_CBB="/pro-mgr/export/download/cbb",o.DOWNLOAD_DOCUMENT="/pro-mgr/export/download/document",o.BACKUP="/pro-mgr/backup",o.ARCHIVE="/pro-mgr/archive",o.LOAD_FILE="/pro-mgr/loadFile",o.CONVERT_PROJECT="/pro-mgr/convertProject/start",o.CONVERT_PROJECT_FLOWWIRTE="/pro-mgr/convertProject/flowWrite",o.CONVERT_PROJECT_FLOWREAD="/pro-mgr/convertProject/flowRead",o.IMPORT_NEW_PROJECT="/pro-mgr/importNewProject",o.PROJECT_AS_CLOUD="/pro-mgr/projectAsCloud",o.CBB_AS_CLOUD="/pro-mgr/cbbAsCloud",o.DOCUMENT_AS_CLOUD="/pro-mgr/documentAsCloud",o.COMPONENT_AS_CLOUD="/pro-mgr/componentAsCloud",o.IMPORT_TARGET_PROJECT="/pro-mgr/importTargetProject",o.UPDATE_BLOCK_SYMBOL_CONNECT="/pro-mgr/updateBlockSymbolConnect",o.IMPORT_SYMBOLS="/pro-mgr/importSymbols",o.IMPORT_FOOTPRINTS="/pro-mgr/importFootprints",o.IMPORT_DEVICES="/pro-mgr/importDevices",o.COPY_BOARD="/pro-mgr/copyBoards",o.COPY_SCHEMATIC="/pro-mgr/copySchematics",o.COPY_PAGE="/pro-mgr/copyPages",o.COPY_SIMULATION_CANVAS="/pro-mgr/copySimulationCanvas",o.COPY_SCH_CANVAS="/pro-mgr/copySchCanvas",o.COPY_PCB_CANVAS="/pro-mgr/copyPcbCanvas",o.COPY_PANEL_CANVAS="/pro-mgr/copyPanelCanvas",o.PASTE_BOARD="/pro-mgr/pasteBoards",o.PASTE_SCHEMATIC="/pro-mgr/pasteSchematics",o.PASTE_PAGE="/pro-mgr/pastePages",o.PASTE_SCH_TOP="/pro-mgr/pasteSchTop",o.PASTE_PCB="/pro-mgr/pastePcb",o.PASTE_PANEL="/pro-mgr/pastePanel",o.PASTE_SIMULATION="/pro-mgr/pasteSimulation",o.PASTE_SCH_BOTTOM="/pro-mgr/pasteSchBottom",o.BUILD_EXPORT="/pro-mgr/buildExport",o.BUILD_TARGET="/pro-mgr/buildTarget",o.PARSE_PROJECT="/pro-mgr/parseProject",o.COMPARE_LOCAL="/pro-mgr/compare/local",o.COMPARE_CLOUD="/pro-mgr/compare/cloud",o.COMPARE_DESTORY="/pro-mgr/compare/destory",o.UPDATE_REUSE_BLOCK="/pro-mgr/updateReuseBlock",o))(yBe||{});async function bBe(){let o=await new Promise(t=>{fetch("/api/client/config",{method:"GET"}).then(e=>{e.json().then(r=>{t(r)})})});if(o&&o.success&&o.result){let t=o.result,e=t.projectDir instanceof Array?t.projectDir:[t.projectDir];return{basePath:t.appBaseDir,cbbPath:t.reuseBlock,libPath:t.systemLib,projectPath:e,onlinePrjBackupPath:t.appOnlineBackupDir,appBaseDir:t.appBaseDir,autoCheckVersionUpdate:!!t.checkUpdate,activation:t.activation,appTmpBackupDir:t.appTmpBackupDir,cacheDir:t.cacheDir,proxy:t.proxy,log:t.log}}else return null}function ute(o,t){let e=[],r=[];Yz?r=o:t&&t.length?r=t:r=o;let i=null;return r.forEach(n=>{n.uuid===Ai.SYSTEMLIB_UUID?i={title:n.nickname,id:n.uuid,key:Ai.LIB_SYSTEM_KEY}:e.push({title:n.nickname,id:n.uuid,key:Ai.LIB_PERSONAL_KEY})}),i&&e.unshift(i),e}async function dte(o,t){let e=ute(o,t)||[],r=[],i=null;return e.forEach((n,s)=>{n.id===Ai.SYSTEMLIB_UUID?i=s:r.push({title:n.title,id:n.id,key:n.key})}),(i||i===0)&&r.splice(0,0,{title:e[i].title,id:e[i].id,key:e[i].key}),r.splice(1,0,{title:"Project",id:"",key:Ai.LIB_PROJECT_KEY}),[...r]}async function TSt(o,t){let e=await bBe();if(!e)return await dte(o,t);let r=ute(o,t),i=Dy(r,"id",Ai.SYSTEMLIB_UUID),n=[];i.index>=0&&n.splice(0,0,{...i.data});let{projectPath:s,cbbPath:a,libPath:l=[],onlinePrjBackupPath:c,autoCheckVersionUpdate:h}=e;return l.forEach(u=>{n.push({title:PNe(u),id:u,key:u})}),n.splice(1,0,{title:"Project",id:"",key:Ai.LIB_PROJECT_KEY}),[...n]}function ISt(o,t,e,r){let i=[],n=[],s={},a=[];return o.forEach(l=>{switch(l.titleAdditional=l.title,l.title){case"Project":{if(!r||!e||!e.uuid)return;l.id=e.uuid,a.push(e.uuid);break}default:}l.id||(l.id="@"+Hz(new Date().getTime())),typeof s[l.id]<"u"?(s[l.id]+=1,l.id=l.id+Ai.LIB_SPLIT_TAG+s[l.id]):s[l.id]=0,t&&t.indexOf(l.id)>=0&&n.push(l.id),i.push(l)}),{treeData:i,projectsIds:a,selectedIds:n}}async function PBe(o,t){let e=ute(o,t)||[],r=[],i=null;return e.forEach((n,s)=>{n.id===Ai.SYSTEMLIB_UUID?i=s:r.push({title:n.title,id:n.id,key:n.key})}),(i||i===0)&&r.splice(0,0,{title:e[i].title,id:e[i].id,key:e[i].key}),r.splice(1,0,{title:"Project",id:"",key:Ai.LIB_PROJECT_KEY}),[...r]}async function CSt(o,t){let e=await bBe();if(!e)return await dte(o,t);let r=[],{projectPath:i,cbbPath:n,libPath:s=[],onlinePrjBackupPath:a,autoCheckVersionUpdate:l}=e;return s.forEach(c=>{r.push({title:PNe(c),id:c,key:c})}),r.splice(1,0,{title:"Project",id:"",key:Ai.LIB_PROJECT_KEY}),[...r]}function SSt(o,t,e,r){let i=[],n=[],s={},a=[];return o.forEach(l=>{switch(l.titleAdditional=l.title,l.title){case"Project":{if(!r||!e||!e.uuid)return;l.id=e.uuid,a.push(e.uuid);break}default:}l.id||(l.id="@"+Hz(new Date().getTime())),typeof s[l.id]<"u"?(s[l.id]+=1,l.id=l.id+Ai.LIB_SPLIT_TAG+s[l.id]):s[l.id]=0,t&&t.indexOf(l.id)>=0&&n.push(l.id),i.push(l)}),{treeData:i,projectsIds:a,selectedIds:n}}function TBe(o,t){let e=[],r=[];return Yz?r=o:t&&t.length?r=t:r=o,r.forEach(i=>{e.push({title:i.nickname,id:i.uuid,key:Ai.LIB_TEMAS_KEY})}),e}async function ete(o,t){let e=TBe(o,t);return[{title:"System",id:Ai.SYSTEMLIB_UUID,key:Ai.LIB_SYSTEM_KEY},{title:"Project",id:"",key:Ai.LIB_PROJECT_KEY},{title:"Personal",id:"",key:Ai.LIB_PERSONAL_KEY},{title:"Favorite",id:Ai.FAVORITELIB_UUID,key:Ai.LIB_FAVORITE_KEY},...e]}function IBe(o,t,e,r,i){let n=[],s=[],a={},l=[];return o.forEach(c=>{switch(c.title){case"Project":{if(!i||!r||!r.uuid)return;c.id=r.uuid,l.push(r.uuid);break}case"Personal":{if(!e||!e.uuid)return;c.id=e.uuid;break}case"Public":{c.id=Ai.PUBLICLIB_ALIAS;break}default:}c.id||(c.id="@"+Hz(new Date().getTime())),typeof a[c.id]<"u"?(a[c.id]+=1,c.id=c.id+Ai.LIB_SPLIT_TAG+a[c.id]):a[c.id]=0,t&&t.indexOf(c.id)>=0&&s.push(c.id),n.push(c)}),{treeData:n,projectsIds:l,selectedIds:s}}async function XTe(o,t){return await ete(o,t)}function ESt(o,t,e,r,i){return IBe(o,t,e,r,i)}function CBe(o,t,e,r,i,n,s){if(!DS){let l=IBe(o,e,r,i,typeof n<"u"?!!n:s);return Eee(l,t),Oee(l)}if(Bee){let l=ESt(o,e,r,i,typeof n<"u"?!!n:s);return Eee(l,t),Oee(l)}if(Mz){let l=ISt(o,e,i,typeof n<"u"?!!n:s);return Eee(l,t),Oee(l)}let a=SSt(o,e,i,typeof n<"u"?!!n:s);return Eee(a,t),Oee(a)}function Eee(o,t){let e=Dy(o.treeData,"key",Ai.LIB_SYSTEM_KEY);e.index>=0&&o.treeData.splice(e.index,1);let r=Dy(o.treeData,"key",Ai.LIB_PERSONAL_KEY);r.index>=0&&o.treeData.splice(r.index,1);let i=Dy(o.treeData,"key","project");i.index>=0&&o.treeData.splice(i.index,1);let n=Dy(o.treeData,"key",Ai.LIB_FAVORITE_KEY);n.index>=0&&o.treeData.splice(n.index,1);let s=Dy(o.treeData,"key","selected");s.index>=0&&o.treeData.splice(s.index,1);let a=Dy(o.treeData,"key","oshwhub");a.index>=0&&o.treeData.splice(a.index,1),o.treeData.sort((l,c)=>(l.title||"").localeCompare(c.title||"")),n.index>=0&&o.treeData.unshift(n.data),i.index>=0&&o.treeData.unshift(i.data),t==="Personal"?Yz||r.index>=0&&o.treeData.unshift(r.data):o.selectedIds=o.selectedIds.filter(l=>{var c;return l!==((c=r==null?void 0:r.data)==null?void 0:c.id)}),a.index>=0&&o.treeData.unshift(a.data),e.index>=0&&o.treeData.unshift(e.data),s.index>=0&&o.treeData.push(s.data)}function Oee(o){return o.selectedIds.length?o.selectedIds:o.selectedIds.push(o.treeData[0].id),o}async function OSt(o,t,e,r,i,n,s,a,l=!0,c=!0,h=!0){let u={username:n.username,uuid:n.uuid},{projectId:d,title:p,isCBB:m}=i,g={uuid:d,title:p,isCBB:m},y=await SBe(t,s,a,o,e,l),b=CBe(y,r,[],u,g,!l),P=[];for(let T=0;T<b.treeData.length;T++){let I=b.treeData[T];I.id===Ai.SYSTEMLIB_UUID&&c||I.id===Ai.FAVORITELIB_UUID&&h||(ite||nte||I.key===Ai.LIB_PERSONAL_KEY&&(I.title=I.titleAdditional=u.username),I.title&&P.push(I))}return P}var ASt=(o=>(o.Normal="Normal",o.D3Model="D3Model",o.AssociateDeviceDialog="associateDeviceDialog",o.Cbb="Cbb",o))(ASt||{}),lA=class{};lA.createInitLibList=SBe,lA.createFixLibList=OSt,lA.filterInitLibList=CBe,lA.fetchTeamsLibsFromGVars=TBe,lA.fetchClientTeamsLibsFromGVars=ute,lA.createSourceLibListByWebMode=ete,lA.createSourceLibListByOnlineClientMode=XTe,lA.createSourceLibListByOfflineClientMode=PBe,lA.createSourceLibListByHalfofflineClientMode=dte;async function SBe(o,t,e,r,i,n){let s=[];return o==="Normal"?DS?Bee?(s=await XTe(t,e),n&&Aee(s),s):Mz?(s=await dte(t,e),n&&Aee(s),s):(s=await PBe(t,e),n&&Aee(s),s):(s=await ete(t,e),n&&Aee(s),s):o==="D3Model"?DS?Bee?(s=await XTe(t,e),s):Mz?(s=await TSt(t,e),s):(s=await CSt(t,e),s):(s=await ete(t,e),s):[]}function Aee(o){let t=Dy(o,"key",Ai.LIB_PROJECT_KEY);t.index>=0&&o.splice(t.index,1)}var njt=Wz(zz());var ojt=Wz(zz());var sjt=Wz(zz());var rT=class{};rT.D3Model=xS,rT.Device=tB,rT.Footprint=kee,rT.Symbol=gBe,rT.deleteComponentItem=fke,rT.deleteComponents=jTt,rT.fetchComponentItem=rSt,rT.queryComponentsByTitle=Qee,rT.pickUpComponentTags2Ids=mke,rT.pickUpComponentTags2Names=px,rT.getDataStrById=tY,rT.duplicateNameDetection=PSt;var gNe=class uM{static async getOldLibByNet(t){try{let{dataStrId:e,dataStr:r}=t;return e||r?{success:!0,result:await tY(t)||""}:{success:!1,message:"Failed to obtain the source code of the existing component library!"}}catch(e){return{success:!1,message:e.message}}}static transform(t,e){let{uuid:r,docType:i}=e,n="";if(i===4){let s=e.isConnectDevice;n=PPt(r,t,s)}else i===29?n=OPt(r,t,Rz.PANEL_LIB):$ee(i)&&(n=CPt(r,t).dataStr);return n}static async getOtherLibByNet(t){try{let{isProject:e,uuid:r,path:i,docType:n}=t;if(lTt(t)){let c={ignoreDoctypeCheck:!0},h=(await rT.fetchComponentItem(e,r,i,n,c)).result;t=Object.assign(t,h)}let{history_uuid:s,dataStrId:a,dataStr:l}=t;if(s){let c={path:i,uuid:r,historyUuid:s},h=(await mn.messageBus.rpcCall(gA.COMPONENT.GET_HISTORY,c)).message;if(!h.success){let u=["Conversion component format failed!",h.message];return{success:!1,code:h.code,message:u}}return{success:!0,result:(await mn.messageBus.rpcCall(gA.COMPONENT.GET_HISTORY_DATA,[h.result])).message}}else if(a||l){let c=await uM.getOldLibByNet(t);if(!c.success){let d=["Conversion component format failed!",c.message];return{success:!1,code:c.code,message:d}}let h=c.result,u=uM.transform(h,t);return u?{success:!0,result:u}:{success:!1,message:["Conversion component format failed!","Illegal docType!"]}}else return{success:!0,result:""}}catch(e){return{success:!1,message:e.message}}}static async getOtherLibByWorker(t){try{let e=$();return{success:!0,result:await hIe(`/${e._TAB_ID_}/libWorker`).rpcCall("/mgr/libWorker/getDataByType",t)}}catch(e){return{success:!1,message:e.message}}}static async getProjectLibByWorker(t){try{let{path:e,uuid:r,docType:i}=t,{message:n}=await mn.messageBus.rpcCall("/pro-mgr/hasProject",[e]);return n?i===4?{success:!0,result:(await mn.messageBus.rpcCall(us.FOOTPRINT.GET_STR,[r,e])).message||""}:$ee(i)?{success:!0,result:(await mn.messageBus.rpcCall(us.SYMBOL.GET_STR,[r,e])).message||""}:{success:!1,message:"Api call error! The api does not exist!"}:{success:!1,message:"Get project library data source Project is not open!"}}catch(e){return{success:!1,message:e.message}}}static async getExtendLib(t){var e,r;let{path:i,uuid:n,docType:s}=t,a=P0.getInstance().getLib(i),l;if(s===4?l=await((e=a==null?void 0:a.footprint)==null?void 0:e.getTransformedDetail(n)):l=await((r=a==null?void 0:a.symbol)==null?void 0:r.getTransformedDetail(n)),!(l!=null&&l.dataStr))return{success:!1,message:["Conversion component format failed!","Failed to obtain the source code of the existing component library!"]};let c;return l.dataStr.trim().startsWith("[")?c=uM.transform(l.dataStr,t):c=l.dataStr,c?{success:!0,result:c}:{success:!1,message:["Conversion component format failed!","Illegal docType!"]}}static async getProLibSource(t){if(typeof window>"u")return await cTt(t);try{let{isProject:e,path:r}=t;return P0.getInstance().hasLib(r)?uM.getExtendLib(t):e?uM.getProjectLibByWorker(t):uM.getOtherLibByWorker(t)}catch(e){return{success:!1,message:e.message}}}},EBe=(o=>(o.INIT_DB="/CommonDB/initDB",o))(EBe||{}),OBe=(o=>(o.GET="/CommonDB/project/getData",o.GET_ALL="/CommonDB/project/getAllArrData",o))(OBe||{}),ABe=(o=>(o.GET="/CommonDB/copyAndPaste/getData",o.SET="/CommonDB/copyAndPaste/setData",o.IS_EXIST="/CommonDB/copyAndPaste/isExist",o.GET_DATA_FROM_PCB_CANVAS="/CommonDB/copyAndPaste/getDataFromPcbCanvas",o))(ABe||{}),_Be=(o=>(o.GET="/CommonDB/copyAndPasteTableCell/getData",o.SET="/CommonDB/copyAndPasteTableCell/setData",o.IS_EXIST="/CommonDB/copyAndPasteTableCell/isExist",o))(_Be||{}),vBe=(o=>(o.SET="/CommonDB/log/setData",o.DEL="/CommonDB/log/delData",o.DEL_LOTS="/CommonDB/log/delLotsData",o.GET_ALL="/CommonDB/log/getAllArrData",o))(vBe||{}),xBe=(o=>(o.SET="/CommonDB/Component/log/setData",o.DEL="/CommonDB/Component/log/delData",o.DEL_LOTS="/CommonDB/Component/log/delLotsData",o.GET_ALL="/CommonDB/Component/log/getAllArrData",o))(xBe||{}),RBe=(o=>(o.SET="/CommonDB/basicLibraryList/addData",o.GET="/CommonDB/basicLibraryList/getData",o.IS_EXIST="/CommonDB/basicLibraryList/isExist",o))(RBe||{}),DBe=(o=>(o.SET="/CommonDB/clipBoard/addData",o.GET="/CommonDB/clipBoard/getData",o.IS_EXIST="/CommonDB/clipBoard/isExist",o))(DBe||{}),wBe=(o=>(o.GET="/CommonDB/lockPrj/getData",o.READ_WRITE="/CommonDB/lockPrj/readwriteData",o))(wBe||{}),LBe=(o=>(o.GET="/CommonDB/prjCache/getData",o.SET="/CommonDB/prjCache/addData",o.DEL="/CommonDB/prjCache/delData",o.DEL_LOTS="/CommonDB/prjCache/delLotsData",o.GET_INDEXS="/CommonDB/prjCache/getAllIndexs",o.GET_COUNT="/CommonDB/prjCache/getCount",o.GET_EARLIEST="/CommonDB/prjCache/getEarliest",o))(LBe||{}),xIe={COMMON:EBe,PROJECT:OBe,COPYANDPASTE:ABe,COPYANDPASTE_TABLE_CELL:_Be,LOG:vBe,COMPONENT_LOG:xBe,LIB:RBe,CLIP_BOARD:DBe,LOCK_PROJECT:wBe,PROJECT_CACHE:LBe},_St=(o=>(o.CREATE="/pro-mg/cbb/create",o.DRAW="/pro-mg/cbb/draw",o.GET_EXPORT="/pro-mg/cbb/getExport",o.GET_TARGET="/pro-mg/cbb/getTarget",o.LIST="/pro-mg/cbb/list",o.SEARCH="/pro-mg/cbb/search",o.PLACE="/pro-mg/cbb/place",o))(_St||{}),vSt=(o=>(o.GET="/pro-mg/thumb/get",o.UPLOAD="/pro-mg/thumb/upload",o.DELETE="/pro-mg/thumb/delete",o.LIST="/pro-mg/thumb/list",o))(vSt||{}),xSt=(o=>(o.CREATE="/pro-mgr/new/cloud/create",o.PROJECT="/pro-mgr/new/cloud/project",o.BOARD="/pro-mgr/new/cloud/board",o.SCHEMATIC="/pro-mgr/new/cloud/schematic",o.SHEET="/pro-mgr/new/cloud/sheet",o.SIMULATION="/pro-mgr/new/cloud/simulation",o.PCB="/pro-mgr/new/cloud/pcb",o.PANEL="/pro-mgr/new/cloud/panel",o))(xSt||{}),RSt=(o=>(o.BOARD="/pro-mgr/new/local/board",o.SCHEMATIC="/pro-mgr/new/local/schematic",o.SHEET="/pro-mgr/new/local/sheet",o.SIMULATION="/pro-mgr/new/local/simulation",o.PCB="/pro-mgr/new/local/pcb",o.PANEL="/pro-mgr/new/local/panel",o))(RSt||{});var DSt=(o=>(o.FORCE="/pro-mgr/project/updateData/force",o.SUSPEND="/pro-mgr/project/updateData/suspend",o.RESUME="/pro-mgr/project/updateData/resume",o.GET="/pro-mgr/project/updateData/getLastest",o.IS_PUBLIC="/pro-mgr/project/updateData/isPublic",o.UPDATE_TEAM="/pro-mgr/project/updateData/updateTeam",o))(DSt||{}),wSt=(o=>(o.UPDATE="/pro-mgr/project/updateData/schematic/update",o.GET="/pro-mgr/project/updateData/schematic/getData",o.MAP="/pro-mgr/project/updateData/schematic/map",o.NOTIFY="/pro-mgr/project/updateData/schematic/notify",o))(wSt||{}),LSt=(o=>(o.UPDATE="/pro-mgr/project/updateData/sheet/update",o.GET="/pro-mgr/project/updateData/sheet/getData",o.MAP="/pro-mgr/project/updateData/sheet/map",o.NOTIFY="/pro-mgr/project/updateData/sheet/notify",o))(LSt||{}),MSt=(o=>(o.UPDATE="/pro-mgr/project/updateData/pcb/update",o.GET="/pro-mgr/project/updateData/pcb/getData",o.MAP="/pro-mgr/project/updateData/pcb/map",o.NOTIFY="/pro-mgr/project/updateData/pcb/notify",o))(MSt||{}),NSt=(o=>(o.UPDATE="/pro-mgr/project/updateData/blockSymbol/update",o.GET="/pro-mgr/project/updateData/blockSymbol/getData",o.MAP="/pro-mgr/project/updateData/blockSymbol/map",o.NOTIFY="/pro-mgr/project/updateData/blockSymbol/notify",o))(NSt||{}),kSt=(o=>(o.UPDATE="/pro-mgr/project/updateData/symbol/update",o.GET="/pro-mgr/project/updateData/symbol/getData",o.MAP="/pro-mgr/project/updateData/symbol/map",o.NOTIFY="/pro-mgr/project/updateData/symbol/notify",o))(kSt||{}),BSt=(o=>(o.UPDATE="/pro-mgr/project/updateData/footprint/update",o.GET="/pro-mgr/project/updateData/footprint/getData",o.MAP="/pro-mgr/project/updateData/footprint/map",o.NOTIFY="/pro-mgr/project/updateData/footprint/notify",o))(BSt||{}),FSt=(o=>(o.UPDATE="/pro-mgr/project/updateData/device/update",o.GET="/pro-mgr/project/updateData/device/getData",o.MAP="/pro-mgr/project/updateData/device/map",o.NOTIFY="/pro-mgr/project/updateData/device/notify",o))(FSt||{});var VSt=(o=>(o.PROGRESS="/pro-ui/progressUpdate",o.OPENED_PROJECT="/pro-ui/project/openedProject",o.HAS_UNSAVED="/pro-ui/project/hasUnsaved",o.OPEN="/pro-ui/project/open",o.CLOSE="/pro-ui/project/close",o.ON_OPENED="/pro-ui/project/onOpened",o.ON_FAILED="/pro-mgr/project/onFailed",o.ON_CLOSED="/pro-ui/project/onClosed",o.ADD_HASH="/pro-ui/hash/add/id",o.REMOVE_HASH="/pro-ui/hash/remove/id",o))(VSt||{}),GSt=(o=>(o.ON_UPDATE="/pro-mgr/project/project/onUpdate",o.UPLOAD_FAILED="/pro-mgr/project/upload/onfailed",o))(GSt||{}),USt=(o=>(o.ON_UPDATE="/pro-mgr/project/config/onUpdate",o))(USt||{}),HSt=(o=>(o.ON_ADD="/pro-mgr/project/board/onAdd",o.ON_DELETE="/pro-mgr/project/board/onDelete",o.ON_UPDATE="/pro-mgr/project/board/onUpdate",o))(HSt||{}),WSt=(o=>(o.ON_ADD="/pro-mgr/project/schematic/onAdd",o.ON_DELETE="/pro-mgr/project/schematic/onDelete",o.ON_UPDATE="/pro-mgr/project/schematic/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/schematic/onUpdateTime",o))(WSt||{}),zSt=(o=>(o.ON_ADD="/pro-mgr/project/sheet/onAdd",o.ON_DELETE="/pro-mgr/project/sheet/onDelete",o.ON_UPDATE="/pro-mgr/project/sheet/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/sheet/onUpdateTime",o))(zSt||{}),YSt=(o=>(o.ON_ADD="/pro-mgr/project/pcb/onAdd",o.ON_DELETE="/pro-mgr/project/pcb/onDelete",o.ON_UPDATE="/pro-mgr/project/pcb/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/pcb/onUpdateTime",o))(YSt||{}),jSt=(o=>(o.ON_ADD="/pro-mgr/project/panel/onAdd",o.ON_DELETE="/pro-mgr/project/panel/onDelete",o.ON_UPDATE="/pro-mgr/project/panel/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/panel/onUpdateTime",o))(jSt||{}),XSt=(o=>(o.ON_ADD="/pro-mgr/project/simulation/onAdd",o.ON_DELETE="/pro-mgr/project/simulation/onDelete",o.ON_UPDATE="/pro-mgr/project/simulation/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/simulation/onUpdateTime",o))(XSt||{}),qSt=(o=>(o.ON_ADD="/pro-mgr/project/device/onAdd",o.ON_DELETE="/pro-mgr/project/device/onDelete",o.ON_UPDATE="/pro-mgr/project/device/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/device/onUpdateTime",o))(qSt||{}),$St=(o=>(o.ON_ADD="/pro-mgr/project/symbol/onAdd",o.ON_DELETE="/pro-mgr/project/symbol/onDelete",o.ON_UPDATE="/pro-mgr/project/symbol/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/symbol/onUpdateTime",o))($St||{}),KSt=(o=>(o.ON_ADD="/pro-mgr/project/footprint/onAdd",o.ON_DELETE="/pro-mgr/project/footprint/onDelete",o.ON_UPDATE="/pro-mgr/project/footprint/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/footprint/onUpdateTime",o))(KSt||{}),ZSt=(o=>(o.ON_ADD="/pro-mgr/project/attr/onAdd",o.ON_DELETE="/pro-mgr/project/attr/onDelete",o.ON_UPDATE="/pro-mgr/project/attr/onUpdate",o))(ZSt||{}),JSt=(o=>(o.ON_ADD="/pro-mgr/project/blob/onAdd",o.ON_DELETE="/pro-mgr/project/blob/onDelete",o.ON_UPDATE="/pro-mgr/project/blob/onUpdate",o))(JSt||{}),QSt=(o=>(o.ON_ADD="/pro-mgr/project/variant/onAdd",o.ON_DELETE="/pro-mgr/project/variant/onDelete",o.ON_UPDATE_TITLE="/pro-mgr/project/variant/onUpdatetitle",o.ON_UPDATE_NOT_GROUPED="/pro-mgr/project/variant/onUpdateNotGrouped",o.ON_UPDATE_ZINDEX="/pro-mgr/project/variant/onUpdateZIndex",o.ON_ADD_COMPONENT_GROUP="/pro-mgr/project/variant/onAddComponentGroup",o.ON_DELETE_COMPONENT_GROUP="/pro-mgr/project/variant/onDeleteComponentGroup",o.ON_UPDATE_COMPONENT_GROUP_TITLE="/pro-mgr/project/variant/onUpdateComponentGroupTitle",o.ON_UPDATE_COMPONENT_GROUP_ZINDEX="/pro-mgr/project/variant/onUpdateComponentGroupZIndex",o.ON_UPLOAD_COMPONENT_GROUP_INDEX_IN_VARIANT="/pro-mgr/project/variant/onUploadComponentGroupZIndexInVariant",o.ON_DELETE_COMPONENT_GROUP_INDEX_IN_VARIANT="/pro-mgr/project/variant/onDeleteComponentGroupZIndexInVariant",o.ON_UPLOAD_COMPONENT_GROUP_DATA="/pro-mgr/project/variant/onUploadComponentGroupData",o.ON_DELETE_COMPONENT_GROUP_DATA="/pro-mgr/project/variant/onDeleteComponentGroupData",o))(QSt||{});var ajt=new Error("list is empty");var e9t=(o=>(o.ALL_VALUE="@all",o.ALL_TITLE="All",o.ComponentSymbol="2",o.NetflagSymbol="18",o.NetportSymbol="19",o.DrawingSymbol="20",o.NonElectronicSymbol="21",o.OffPageConnectorSymbol="25",o.DiffPairsFlagSymbol="31",o))(e9t||{});var t9t=class{};t9t.syncLoginedUserInfo=o=>{mn.loginedUserUuid=o.uuid};var r9t=(o=>(o.PROJECT="project.json",o.DEVICE="device.json",o.SYMBOL="symbol.json",o.FOOTPRINT="footprint.json",o.PANEL_LIB="panel-lib.json",o.PROJECT2="project2.json",o.DEVICE2="device2.json",o.SYMBOL2="symbol2.json",o.FOOTPRINT2="footprint2.json",o.PANEL_LIB2="panel-lib2.json",o))(r9t||{});ugt();var pte=class{constructor(t){this.renderPerFrame=!window["META-PANELIZE-ENV"]&&/\brenderPerFrame\b/.test($().location.search);this.updateFrame=!0;this.canvas=t,ie.subscribe("updateFrame",e=>{this.updateFrame=!0,e==="mousemove"&&this._scene&&this._scene.mouseMoveRenderRuler()}),ie.subscribe("maskUpdateFrame",()=>{this.updateFrame=!1})}async initScene(t){if(this._scene)throw new Error("initScene cannot be called multiple times!");let{scene:e}=await VLe(this.canvas,this.getRenderEngine(),$(),t===3?lQ.PCB:lQ.DEFAULT);Ya.useWebgl=!window["META-PANELIZE-ENV"]&&/\bglEngine\b/.test($().location.search),this._scene=e;let r=Ni();r.setCanvas(this.canvas),this._scene.addCamera(r),x.getInstance().attachScene(this._scene),St.getInstance().attach(this._scene.gridParam)}get scene(){return this._scene}getRenderEngine(){if(navigator.userAgent.includes("Firefox"))return BL.Canvas2D;switch(x.getInstance().coreRenderingEngine){case"auto":return BL.Auto;case"webgpu":return BL.WebGPU;case"canvas2d":return BL.Canvas2D;default:return BL.Auto}}renderFrame(){(this.updateFrame||this.renderPerFrame)&&this._scene&&(this.updateFrame=!1,ie.publish("updateModify",""),Ya.useWebgl&&this._scene.render())}};var ne=class{static regular(t){return Math.round(t*this.precision)/this.precision}static eq(t,e){return Math.abs(t-e)<=this.eps}static neq(t,e){return Math.abs(t-e)>this.eps}static less(t,e){return t-e<-this.eps}static lesseq(t,e){return t-e<this.eps}static greater(t,e){return t-e>this.eps}static greatereq(t,e){return t-e>-this.eps}static sqrt(t){return Math.abs(t)<=1e-10?0:Math.sqrt(t)}static sortAsc(t,e){return t-e}static sortDesc(t,e){return e-t}};ne.eps=1e-8,ne.precision=1e8;var AB=class{static getSweep(t){if(t.length>2){let e=0,r=t.length;for(let s=0;s<r-1;s++){let a=t[s],l=t[s+1];e+=(l.x+a.x)*(l.y-a.y)}let i=t[0],n=t[r-1];return e+=(i.x+n.x)*(i.y-n.y),e>0}else throw console.error(t),new Error("Unable to determine the direction of rotation!")}static isClose(t){return!!(t.primitives.length>0&&t.primitives[0].start().equals1(t.primitives[t.primitives.length-1].end()))}};function vh(o){let t=o.primitives,e=t[0],r=e instanceof q?e.sweepAngle%360:null;if(t.length===1&&e instanceof q&&(ne.eq(r,0)||ne.eq(Math.abs(r),360)))return!!e.isCCW;let i=new Array;return o.points(.1,n=>{i.push(n)}),AB.getSweep(i)}var MBe="3.2.131",NBe="05/06/2026";var TA={ui_instance:!1,ui_module:!0,messageBus:void 0,windowBridge:void 0,pcbMessageBus:void 0,moveRocord:void 0,moveRocordNext:void 0,selectBox1:void 0,gControlDots:void 0,gRotateHelper:void 0,gControlRects:void 0,gControlLines:void 0,gCopperAreaOutlineCushions:void 0,gPanelizedOutlines:void 0,gPanelizedOutlinesOverG1:void 0,gCanvas:void 0,Canvas:void 0,doctype:void 0,cmdToken:void 0,gZoom:1,currZoom:100,jsonMgr:void 0,svgRoot:void 0,activeElement:void 0,helperCursor:void 0,showControlDots:void 0,_RotateCache:{},moveAction:void 0,localStorageDisabled:void 0,data3D:void 0,defaultImage:{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA1MCA0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB4PSIxIiB5PSIxIiB3aWR0aD0iNDgiIGhlaWdodD0iMzgiIGZpbGw9IiNGRkYiIHN0cm9rZT0iI0NDQyIgc3Ryb2tlLXdpZHRoPSIyIi8+PHBvbHlsaW5lIHBvaW50cz0iMS41LDIzLDE2LDEzLDM0LDI2LDQ4LjUsMjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0NDQyIgc3Ryb2tlLXdpZHRoPSIyIi8+PGNpcmNsZSBjeD0iMzUiIGN5PSIxMiIgcj0iNCIgZmlsbD0iI0NDQyIgc3Ryb2tlPSJub25lIi8+PC9zdmc+",width:50,height:40},worker:void 0,tearDropWorker:null,notCheckPrefix:void 0,drawing:void 0,loading:void 0,userAvatar:void 0,loginHandle:void 0,isMouseOnEditFrame:!1,isOn3dView:void 0,terminalWorker:void 0,hoverCache:void 0,contextmenuDisableOnce:void 0,pcbNetTextVisible:void 0,gRecover:void 0,gNets:void 0,updateNetTextTimer:void 0,netTextCharWidth:void 0,helperCursorConfig:{},rotateParts:void 0,waveFormObj:void 0,setCanvas:void 0,preMgr:void 0,sheetMgr:void 0,findShape:void 0,moveSelectedObjs:void 0,rotateSelectedObjs:void 0,vectorEffectSupported:void 0,modifyText:void 0,prjData:void 0,importChanges:void 0,DragAction:void 0,DragAction2:void 0,DragAction3:void 0,Draw:void 0,toggleTrackWidthPanel:void 0,arrowKeyMove:void 0,importShape:void 0,zoom:void 0,getCanvas:void 0,moveSelectedObjsTo:void 0,bringSelectedObjsToFront:void 0,sendSelectedObjsToBack:void 0,getComponents:void 0,isDragging:void 0,groupSymbol:void 0,cutSelectedObjs:void 0,copySelectedObjs:void 0,pasteFromGlobalClipboard:void 0,pasteFromClipboardAfterCloseRatline:void 0,cloneObjects:void 0,flipSelectedObjects:void 0,attrpanelApply:void 0,attrpanelGetData:void 0,deletePathNode:void 0,dragMoveSwitch:void 0,dragMoveCheck:void 0,dragMoveEndHandlerForPaste:void 0,importJsonCache:void 0,fixedDecimal:!1,decimalPlaces:2,decimalPlacesShow:2,schDecimalPlaces:2,schDecimalPlacesShow:2,pcbDecimalPlaces:4,pcbDecimalPlacesShow:3,pcbServersFonts:["NotoSerifCJKsc-Medium","NotoSansCJKjp-DemiLight"],pcbFontsRegExp:/[^!"\\#\$%&'`\(\)\*\+,\-\.\/a-zA-z0-9:<;\=\?>@\[\]\^_\{\|\}~°\s\t\r\n]/,checkNotificationInterval:12e4,checkUpdateInterval:36e5,saveFileTimeout:3e5,autoSaveMaxCount:1e3,autoSaveMaxBackupLevel:10,autoGzipAjaxPostSize:1e4,cooperationSites:["elektroda","amobbs","allaboutcircuits","diyaudio","hifidiy","edaboard"],cushionShape:null,cushionShapeFor:null,fileOperationAPI:"/EditorBridge/fileOperation",svgFileAPI:"/EditorBridge/svgFile",treeDataAPI:"/EditorBridge/treeData",anonymousPid:"441bd07389f646ac82c8d1dbc45a6021",version:"V"+MBe,buildDate:NBe,lcscUUID:"0819f05c4eef4c71ace90d822a990e87",easyedaUUID:"4251c6ae97414f38bb1d929da02c4173",ignoreConfirmClose:!1,globalVariableCookieData:{},teams:[],networkWarn:"Network Error! Please check your network and try again!",updatePcbFileInfo:[],multiSelect:!1,copperNetRelation:{},isSaving:!1,pasteCount:0,pasteFrom:null,canvasStrTolerance:10,logTypes:{BOM_EXPORT:1,BOM_LCSC:2,GERBER_DOWNLOAD:3,GERBER_JLC:4},apis:{model:{upload:"/api/3dmodel/upload"}},deleteObjs:void 0,currentProject:{projectId:void 0,title:void 0},blockSymbolAttr:void 0,selectableObjMap:{SCH:{symbol:!0,wire:!0,pin:!1,name:!0,property:!0,text:!0,arc:!0,rect:!0,circle:!0,polyline:!0,table:!0,sheet:!0},SYMBOL:{pin:!0,name:!0,property:!0,text:!0,arc:!0,rect:!0,circle:!0,polyline:!0}},importFileDataStr:void 0,profileSetting:null,defaultFont:null,batchExportInfo:null,extensionApiMessageBus2:void 0},eKt=(function(){try{var o=location.hostname;return o.indexOf("lceda")>-1?"lceda":(o.indexOf("easyeda")>-1,"easyeda")}catch{}})(),kBe=(function(){try{var o=location.hostname,t=o.split(".");return t.length>2?t.length===3&&(t[0]==="www"||t[0]==="alpha")?"online":"dev":"online"}catch{}})();var Sa={unRebuildCopperWhenOpening:!1,unRebuildRatline:!1,unRefreshViews:!1,unRefreshScene:!1,unAmountCounts:!0,generateGerberUnEncryption:!1,colorSilkCreateUseCoordinate:!1,colorSilkCreateUseMarkPoints:!1};if(kBe=="online"&&location&&location.hostname!="localhost")for(let o in Sa)Sa[o]=!1;var sY=class{constructor(t,e,r,i,n=!1,s=!1,a){this.layerGroup=a;this.id=0;this.syncViewStatus=null;let l=this.useTexture(i);this.group=new x2(void 0,!1,i),this.plane=t.createPlane(r,i,null,l,this.isPanelize(e,i),n,s),this.group.setPosition(new Mt(0,0,-e)),this.group.add(this.plane),this.layerGroup.add(this.group),this.funCreateNoPanelizePlane=()=>{let c=t.createPlane(r,i,null,l,!1,n);return this.panelizePlaneGroup=new x2(void 0,!1,i),this.panelizePlaneGroup.add(c),this.panelizePlaneGroup.setPosition(new Mt(0,0,-e)),this.layerGroup.add(this.panelizePlaneGroup),c}}setSyncViewStatusCb(t){this.syncViewStatus=t}useTexture(t){return![57,1002,1006].includes(t)}getCreateNoPanelizePlane(){return this.noPanelizePlane||(this.noPanelizePlane=this.funCreateNoPanelizePlane(),this.syncViewStatus!=null&&this.syncViewStatus()),this.noPanelizePlane}isPanelize(t,e){return!(t===1||[53,54,55].includes(e))}getId(){return this.id++}getEngineGroupId(t){if(t)return bn.getInstance().getEngineGroupId(t)}addPolygon(t,e,r){return Sa.unRefreshScene?[]:(t.primitives.length>1&&vh(t)&&(t=t.reverse().asClose()),this.plane.createPolygon([t],e,void 0,r))}addStaticPolygon(t,e,r){return Sa.unRefreshScene?[]:this.plane.createStaticPolygon(t,e,void 0,r)}};var _B=class{constructor(t=3){this.state=3;this.state=t}getValue(t){return(this.state>>t&1)==1}setValue(t,e){let r=1<<t;e?this.state=this.state|r:this.state=this.state&(15^r)}};var vB=class o extends _B{static build(t,e,r,i=!0,n=!1){let a=new o(0);return a.used=t,a.visible=e,a.status=r,a.isColorful=i,a.isPlane=n,a}constructor(t){super(t)}get used(){return this.getValue(0)}set used(t){this.setValue(0,t)}get visible(){return this.getValue(1)}set visible(t){this.setValue(1,t)}get status(){return this.getValue(2)}set status(t){this.setValue(2,t)}get isColorful(){return this.getValue(3)}set isColorful(t){this.setValue(3,t)}get isPlane(){return this.getValue(4)}set isPlane(t){this.setValue(4,t)}};var BBe=ee.of3("#999999"),fte=class{constructor(t,e,r,i,n,s,a=!1,l=!1,c,h){this.layerGroup=c;this._copperLayer=null;this._layer=null;this.ignoreForceHighLight=!1;this._isUnderGrid=!1;this.scene=t,this.layerId=e,this._order=r,this._isUnderGrid=l,this._activeColor=i,this._deactiveColor=n,this._stats=s,this.ignoreForceHighLight=a,this._copperOrder=h}get order(){return this._order}set order(t){var r,i,n;this._order=t;let e=St.getInstance().flip;(r=this._layer)==null||r.group.setPosition(new Mt(0,0,e?t:-t)),(n=(i=this._layer)==null?void 0:i.panelizePlaneGroup)==null||n.setPosition(new Mt(0,0,e?t:-t))}get copperOrder(){return this._copperOrder}set copperOrder(t){var r,i,n;this._copperOrder=t;let e=St.getInstance().flip;(r=this._copperLayer)==null||r.group.setPosition(new Mt(0,0,e?t:-t)),(n=(i=this._copperLayer)==null?void 0:i.panelizePlaneGroup)==null||n.setPosition(new Mt(0,0,e?t:-t))}set isUnderGrid(t){var e;this._isUnderGrid=t,(e=this._layer)==null||e.plane.setIsUnderGrid(this._isUnderGrid)}get isUnderGrid(){return this._isUnderGrid}get activeColor(){return this._activeColor}set activeColor(t){this._activeColor=t}get deactiveColor(){return this._deactiveColor}set deactiveColor(t){this._deactiveColor=t}get status(){return this._stats}set status(t){let e=this._stats!=t;this._stats=t,(e||this._stats.used)&&(this.syncStatus(this.layer,this._stats.state),this.syncStatus(this.copperLayer,this._stats.state))}get layer(){return this._layer==null&&(this._layer=new sY(this.scene,this._order,this._activeColor,this.layerId,this.ignoreForceHighLight,this._isUnderGrid,this.layerGroup),this._layer.setSyncViewStatusCb(()=>{this.syncStatus(this._layer,this._stats.state)}),this.syncStatus(this._layer,this._stats.state)),this._layer}get copperLayer(){return this._copperLayer==null&&(this.layerId==2||this.layerId==1)&&(this._copperOrder==null&&(this._copperOrder=this._order),this._copperLayer=new sY(this.scene,this._copperOrder,this._activeColor,this.layerId,this.ignoreForceHighLight,this._isUnderGrid,this.layerGroup),this._copperLayer.setSyncViewStatusCb(()=>{this.syncStatus(this._copperLayer,this._stats.state)}),this.syncStatus(this._copperLayer,this._stats.state)),this._copperLayer}setDeactiveAlpha(t,e){if(t==null)return;let r=e?1:this.getDeactiveColorAlpha();t.setRgbRatio(r)}syncStatus(t,e){var r,i,n,s,a,l,c;if(t!=null){let h=new vB(e);t.plane.setIsColorful(h.isColorful),(r=t.noPanelizePlane)==null||r.setIsColorful(h.isColorful),h.isColorful?(t.plane.setColor(this.getColorByStatus(h.status)),(l=t.noPanelizePlane)==null||l.setColor(this.getColorByStatus(h.status)),this.setDeactiveAlpha(t.plane,h.status),this.setDeactiveAlpha(t.noPanelizePlane,h.status)):(t.plane.setIsColorful(!0),(i=t.noPanelizePlane)==null||i.setIsColorful(!0),t.plane.setColor(this.getColorByStatus(h.status)),this.setDeactiveAlpha(t.plane,h.status),(n=t.noPanelizePlane)==null||n.setColor(this.getColorByStatus(h.status)),this.setDeactiveAlpha(t.noPanelizePlane,h.status),t.plane.setIsColorful(!1),(s=t.noPanelizePlane)==null||s.setIsColorful(!1),t.plane.setColor(BBe),(a=t.noPanelizePlane)==null||a.setColor(BBe)),this.setNetworkColor(t),this.setPlane(t,h.isPlane),t.plane.setVisible(h.visible),(c=t.noPanelizePlane)==null||c.setVisible(h.visible)}}getColorByStatus(t){return this.activeColor}getDeactiveColorAlpha(){return this.scene.getForceDeactivateRatio()<1?1:this._deactiveColor.alpha}setNetworkColor(t){let e=ee.build(1,1,1,.6);this.layerId==1001?e=t.plane.getColor():this.layerId==1003?e=ee.build(.2,.4,.8,1):this.scene.getAntialias()&&(e=ee.build(1,1,1,.8)),t.plane.setNetworkTextColor(e)}setPlane(t,e){e?t.plane.setPolygonColorAlphaRatio(.65):t.plane.setPolygonColorAlphaRatio(1)}clear(){var t,e,r,i;(t=this._layer)==null||t.plane.clear(),(e=this._layer)==null||e.setSyncViewStatusCb(null),(r=this._copperLayer)==null||r.plane.clear(),(i=this._copperLayer)==null||i.setSyncViewStatusCb(null)}};var Cu=class{constructor(t,e=null){this.id=-1;this.layerId=t,e!=null&&(this._removeCb=e)}setRemoveCb(t){this._removeCb=t}get layer(){return bn.getInstance().getLayer(this.layerId).layer}getHighLightPlane(t){if(!Ya.useWebgl)return bn.getInstance().getHighLightPlane(t)}get plane(){return this.layer.plane}isValidId(){return this.id>=0}resetId(){this.id=-1}getPlane(t){var e,r;return(r=(e=bn.getInstance().getLayer(t))==null?void 0:e.layer)==null?void 0:r.plane}forceVisibleHighLight(t){Ya.engineHighlightReady&&this.isValidId()&&(t?(this.lastHighLightForce||this.plane.addHighLightPt(this.id,0,null,$P.PT),this.lastHighLightForce=!0):this.lastHighLightForce&&(this.plane.removeHighLightPt(this.id,0,null,this.lastHighLightForce?$P.PT:$P.MASK),delete this.lastHighLightForce))}highlight(t,e,r){if(Ya.engineHighlightReady&&this.isValidId()){let i=this.plane;t?i.addHighLightPt(this.id,e,r):i.removeHighLightPt(this.id,e,r)}}forceVisibleHighLights(t,e){Ya.engineHighlightReady&&this.isValidId()&&(e?(this.lastHighLightForce||this.plane.addHighLightPts(t,0,null,$P.PT),this.lastHighLightForce=!0):this.lastHighLightForce&&(this.plane.removeHighLightPts(t,0,null,this.lastHighLightForce?$P.PT:$P.MASK),delete this.lastHighLightForce))}highlights(t,e,r,i){Ya.engineHighlightReady&&t&&t.length>0&&(e?this.plane.addHighLightPts(t,r,i):this.plane.removeHighLightPts(t,r,i))}removeEngineGroup(t){if(t)return bn.getInstance().removeEngineGroup(t)}setEngineGroupVisible(t,e){if(t)return bn.getInstance().setEngineGroupVisible(t,e)}remove(...t){this.isValidId()&&(this._removeCb&&(this._removeCb(),this.plane.removeHighLightPt(this.id)),this.lastHighLightForce=null,this.plane.removePt(this.id)),this.resetId()}hidden(){this.isValidId()&&this.plane.hiddenPt(this.id)}show(){this.isValidId()&&this.plane.showPt(this.id)}};var fl=class extends Cu{constructor(t,e=null,r){super(t,e),r!=null&&(this.canPanelize=r)}get layer(){if(this.layerId<0){let t=bn.getInstance().getLayer(Math.abs(this.layerId));return t.copperLayer?t.copperLayer:t.layer}return bn.getInstance().getLayer(this.layerId).layer}get plane(){return this.canPanelize==null?this.layer.plane:this.layer.getCreateNoPanelizePlane()}getArcSweepAngle(t,e,r){let i=Math.PI*2;return r===le.CCW?e>t?e-t:e-t+i:e<t?e-t:e-t-i}visible(t,e,r,i,n,s,a,l,c){this.layerId!=t&&this.remove(),!Sa.unRefreshScene&&(this.layerId=t,this.id=this.plane.createOrUpdateArc(this.id,e,r,i,n,this.getArcSweepAngle(n,s,a),l,void 0,c))}getId(){return this.id}getBBox(){return this.plane.getPtBboxById(this.id)}},Lg=class extends fl{};var Wc=12,zc=30,jl=class extends Cu{constructor(t,e=null){super(t,e)}getId(){return this.id}visible(t,e,r,i,n,s,a,l,c,h=null){if(this.layerId!=t&&this.isValidId()){let u=this.plane;this.forceVisibleHighLight(!1),u.removePt(this.id),this.resetId()}this.layerId=t,!Sa.unRefreshScene&&(this.id=this.plane.createOrUpdateNetWorkText(this.id,e,r,i,n,s,a,l,c,void 0,h))}getBBox(){return this.plane.getPtBboxById(this.id)}createMaskView(t){}};function Ef(o,t){return o?o.hasOwnProperty(t):!1}function FBe(o,t){let e;for(let r in t)if(Ef(t,r)&&o.indexOf(r)!==-1){e=!0;break}return e}function Ls(o){if(typeof o!="object"||o===null||o instanceof Date||o instanceof ArrayBuffer)return o;if(Array.isArray(o))return o.map(Ls);{let t={};for(let e in o)o.hasOwnProperty(e)&&(t[e]=Ls(o[e]));return t}}function gte(o,t){if(!o||o=="#")return null;try{return(t||document).querySelector(o)}catch{return null}}function Pd(o,t){let e=[],r=[],i=[];for(let c=0,h=o.length;c<h;c++){e[c]=c;let u=(t?o[c][t]||"":o[c]).toString();if(r[c]=u.toUpperCase().match(/\D+|\d+(?:\.\d+)?/g),i[c]=[],r[c])for(let d=0;d<r[c].length;d++)i[c][d]=r[c][d].match(/\d/)?1:2}let a=function(c,h){let u=r[c],d=r[h],p=i[c],m=i[h];if(!u||!d)return u==d?0:u?1:-1;for(let g=0;g<Math.min(u.length,d.length);g++)if(u[g]!=d[g])return p[g]==1&&m[g]==1?Number(u[g])-Number(d[g]):p[g]!=1&&m[g]!=1?u[g].localeCompare(d[g]):p[g]==1?-1:1;return u.length-d.length};e.sort(a);let l=[];for(let c=0;c<o.length;c++)l[c]=o[e[c]];return l}function mx(o,t){let e=[],r=[];for(let h=0,u=o.length;h<u;h++){e[h]=h;let d=(t?o[h][t]||"":o[h]).toString();r[h]=d.toUpperCase().match(/\D+|\d+(?:\.\d+)?/g)}let i,n,s,a,l=function(h,u){if(i=r[h],n=r[u],!i||!n)return i==n?0:i?1:-1;for(let d=0;d<Math.min(i.length,n.length);d++)if(i[d]!=n[d])return s=Number(i[d]),a=Number(n[d]),!isNaN(s)&&!isNaN(a)?s-a:isNaN(s)&&isNaN(a)?i[d].localeCompare(n[d]):isNaN(s)?1:-1;return i.length-n.length};e.sort(l);let c=new Array(o.length);for(let h=0;h<o.length;h++)c[h]=o[e[h]];return c}function AM(o,t){let e=[],r=[],i=[];for(let n of o){let s=t?n[t]||"":n;s=="None"?i.push(n):(s.startsWith("$")?r:e).push(n)}return[].concat(Pd(e,t),Pd(r,t),i)}function RIe(o){if(typeof o!="string")return o;if(o==null)return"";let t={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&apos;","&":"&amp;","&#039;":"'"};function e(r){return t[r]}return o==null?"":FBe(o,t)?(o+"").replace(/[<>'"&]/g,e):o}function VBe(o){if(typeof o!="string")return o;if(o==null)return"";let t={"&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'","&amp;":"&","&#039;":"'"};function e(r){return t[r]}return FBe(o,t)?(o+"").replace(/&([^;]+);/g,e):o}function cr(o=0){return Jm()}function yte(o){function t(c){return c>=10?c:"0"+c}let e=new Date(o),r=e.getFullYear(),i=t(e.getMonth()+1),n=t(e.getDate()),s=t(e.getHours()),a=t(e.getMinutes()),l=t(e.getSeconds());return r+"-"+i+"-"+n+" "+s+":"+a+":"+l}function DIe(o,t){if(!o||Object.prototype.toString.call(o)!="[object Date]")return"";let e={"M+":o.getMonth()+1,"d+":o.getDate(),"h+":o.getHours(),"m+":o.getMinutes(),"s+":o.getSeconds(),S:o.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(/y+/,i=>(o.getFullYear()+"").slice(i.length==2?-2:0))),/(Z+)/.test(t)&&(t=t.replace(/Z+/,i=>r(o,i.length==1?":":"")));for(let i of Object.keys(e)){let n=new RegExp(i);n.test(t)&&(t=t.replace(n,s=>s.length==1?e[i]:("00"+e[i]).slice(-2)))}return t;function r(i,n){let s=-Math.round(i.getTimezoneOffset()/15)*15,a=~~(s/60),l=~~s%60,c="+";return s<0&&(c="-"),c+("00"+a).slice(-2)+n+("00"+l).slice(-2)}}function Fn(o,t){if(Array.isArray(o)){for(let e=0,r=o.length;e<r;e++)if(t(void 0,o[e],e)===!1)return}else{let e=0;for(let r in o)if(o.hasOwnProperty(r)){let i=o[r];if(t(r,i,e)===!1)return;e++}}}async function aY(o,t){if(Array.isArray(o)){for(let e=0,r=o.length;e<r;e++)if(await t(void 0,o[e],e)===!1)return}else{let e=0;for(let r in o)if(o.hasOwnProperty(r)){let i=o[r];if(await t(r,i,e)===!1)return;e++}}}function GBe(o,t){return"#"+o.map(e=>(e=parseInt(t?Number(e)*255:e).toString(16).toUpperCase(),e.length===1?"0"+e:e)).join("")}function wIe(o,t){let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);if(e){let r=e.slice(1,4).map(i=>parseInt(i,16));return t?r.map(i=>+i/255):r}}function wy(o,t){return gx(o,t,()=>[])}function LIe(o,t){return gx(o,t,()=>({}))}function gx(o,t,e){let r=o[t];return r!==void 0||(r=e(t),o[t]=r),r}function bte(o,t){if(!o||!o.length)return;let e=o.indexOf(t);if(!(e<0))return o.splice(e,1),t}function i9t(o,t=1,e=!1){if(!/^\d+$/.test(o)||!Number.isSafeInteger(t))return o;let r=BigInt(o),i=BigInt(Math.round(t)),n=r+i;if(n<0)return n.toString();if(e){let s=n.toString();return s.length>o.length?s:s.padStart(o.length,"0")}return n.toString()}function n9t(o,t="_",e=!0){if(!o)return t+"1";let r=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`${r(t)}(\\d+)$`),n=o.match(i);if(n){let s=i9t(n[1],1,e);return o.replace(i,t+s)}else return o+t+"1"}function UBe(o,t,e,r="_",i=!0){t=t||[],e&&(t=t.map(n=>n.toLowerCase()));do o=n9t(o,r,i);while(t.includes(e?o.toLowerCase():o));return t.push(o),o}function Fb(o,t){let e={same:[],more:[],less:[]};return o.forEach(r=>{t.includes(r)?e.same.push(r):e.less.push(r)}),t.forEach(r=>{o.includes(r)?!e.same.includes(r)&&e.same.push(r):e.more.push(r)}),e}function lY(o,t,e,r){let i=o[t];if(o[t])i=r(o,t,i),o[t]=i;else return i=e(t),o[t]=i,i}function MIe(o,t){var r=parseFloat(o);if(isNaN(r))return!1;let e=Math.pow(10,t);var r=Math.round(o*e)/e,i=r.toString(),n=i.indexOf(".");for(n<0&&(n=i.length,i+=".");i.length<=n+t;)i+="0";return i}function HBe(o){let t=null;return()=>(t===null&&(t=o()),t)}function WBe(o){let t=o.length,e,r;for(;t;)r=Math.floor(Math.random()*t--),e=o[t],o[t]=o[r],o[r]=e;return o}function zBe(o){return Object.prototype.toString.call(o).slice(8,-1).toLowerCase()==="object"}function cY(o,t={}){let e=document.createElement("span");if(e.classList.add("i18n"),e.innerHTML=RIe(o),t){let{context:r,attr:i,params:n}=t;r&&e.setAttribute("data-i18n-context",r),i&&e.setAttribute("data-i18n-attr",i),n&&Fn(n,(s,a)=>{e.setAttribute(`i18n-params-${s}`,a+"")})}return e.outerHTML}function Pte(o,t=""){if(!o)return"A";let e=o.charCodeAt(o.length-1),r="";do e===90?(o=Pte(o.slice(0,o.length-1),t)+"A",r="A"):r=String.fromCharCode(e+1),e=r.charCodeAt(0);while(t.includes(r));return o.slice(0,o.length-1)+r}var YBe=/^([A-Z]+)(\d+)$/;function hY(o){return new Promise(t=>{setTimeout(t,o)})}function w1(o,t){try{o.push(...t)}catch{o=o.concat(t)}return o}function Tte(o,t,e=!1){if(o.length!==t.length)return!1;if(e){let r=new Set(o),i=new Set(t);if(r.size!==i.size)return!1;for(let n of r)if(!i.has(n))return!1;return!0}else{for(let r=0;r<o.length;r++)if(o[r]!==t[r])return!1;return!0}}function NIe(o){let t=n=>/^rgba?\(\s*\d{1,3}\s*(?:,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:\d*\.?\d+|\d+%)\s*)?)?\)$/.test(n)||/^rgba?\(\s*\d{1,3}\s+\d{1,3}\s+\d{1,3}\s*(?:\/\s*(?:\d*\.?\d+|\d+%)\s*)?\)$/.test(n),e=n=>/^hsla?\(\s*\d{1,3}\s*(?:,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*(?:\d*\.?\d+|\d+%)\s*)?)?\)$/.test(n)||/^hsla?\(\s*\d{1,3}\s+\d{1,3}%\s+\d{1,3}%\s*(?:\/\s*(?:\d*\.?\d+|\d+%)\s*)?\)$/.test(n),r=n=>{let a=/^rgba?\(\s*(\d{1,3})\s*(?:,\s*|\s+)(\d{1,3})\s*(?:,\s*|\s+)(\d{1,3})\s*(?:,\s*(\d*\.?\d+|\d+%)\s*|\/\s*(\d*\.?\d+|\d+%)\s*)?\)$/.exec(n);if(!a)throw new Error("Invalid RGBA or RGB string");let l=parseInt(a[1],10)/255,c=parseInt(a[2],10)/255,h=parseInt(a[3],10)/255,u=1;return a[4]!==void 0?u=a[4].endsWith("%")?parseFloat(a[4])/100:parseFloat(a[4]):a[5]!==void 0&&(u=a[5].endsWith("%")?parseFloat(a[5])/100:parseFloat(a[5])),[l,c,h,u]},i=n=>{let a=/^hsla?\(\s*(\d{1,3})\s*(?:,\s*|\s+)(\d{1,3})%\s*(?:,\s*|\s+)(\d{1,3})%\s*(?:,\s*(\d*\.?\d+|\d+%)\s*|\/\s*(\d*\.?\d+|\d+%)\s*)?\)$/.exec(n);if(!a)throw new Error("Invalid HSLA or HSL string");let l=parseInt(a[1],10)/360,c=parseInt(a[2],10)/100,h=parseInt(a[3],10)/100,u=1;a[4]!==void 0?u=a[4].endsWith("%")?parseFloat(a[4])/100:parseFloat(a[4]):a[5]!==void 0&&(u=a[5].endsWith("%")?parseFloat(a[5])/100:parseFloat(a[5]));let d=(1-Math.abs(2*h-1))*c,p=d*(1-Math.abs(l*6%2-1)),m=h-d/2,g=0,y=0,b=0;return 0<=l&&l<.16666666666666666?(g=d,y=p,b=0):.16666666666666666<=l&&l<.3333333333333333?(g=p,y=d,b=0):.3333333333333333<=l&&l<.5?(g=0,y=d,b=p):.5<=l&&l<.6666666666666666?(g=0,y=p,b=d):.6666666666666666<=l&&l<.8333333333333334?(g=p,y=0,b=d):.8333333333333334<=l&&l<=1&&(g=d,y=0,b=p),g=g+m,y=y+m,b=b+m,[g,y,b,u]};if(t(o)){let n=r(o);return ee.build(n[0],n[1],n[2],n[3])}else if(e(o)){let n=i(o);return ee.build(n[0],n[1],n[2],n[3])}else{if(ee.isHexFormate(o))return ee.of3(o);throw new Error("Invalid color string")}}function jBe(o){return Object.is(o,void 0)||Object.is(o,"")||Object.is(o,null)}function XBe(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(isNaN(t))return o;if(t<=0||!o&&!e)return Math.round(o);let i=[1,10,100,1e3][t]||Math.pow(10,t)||10;if(e){let n=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*i)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(n+o)}else return Math.round(o*i+1e-10)/i}function q0(o){let t="";if(o.replace)for(let s in o.replace)t+=` i18n-params-${s}="${o.replace[s]}"`;Object.is(o.openTab,void 0)&&(o.openTab=!0);let e=o.openTab?1:2,r=[],i=[];if(Array.isArray(o.message))o.message.forEach(s=>{if(typeof s=="string")r.push(s),i.push(`<span class="i18n">${s}</span>`);else if(s.attr||s.call){let a=s.i18nContext?`data-i18n-context="${s.i18nContext}"`:"",l="";(s.i18n||a)&&(l=`<span class="i18n" ${a}>${s.text}</span>`,delete s.i18n,delete s.i18nContext),r.push(s),l?i.push(Object.assign({},s,{text:l})):i.push(s)}else{r.push(s.text);let a=s.i18nContext?`data-i18n-context="${s.i18nContext}"`:"";i.push(s.i18n||a?`<span class="i18n" ${a}>${s.text}</span>`:s.text)}});else{let s=o.i18nContext?`data-i18n-context="${o.i18nContext}"`:"";r.push({value:o.message,options:o.replace}),i.push(`<span class="i18n" ${s} ${t}>${o.message}</span>`)}let n={type:o.type||"error",msg:i,tabType:void 0};ie.publish("ui/toastMsg",{type:o.type||"error",msg:o.shortMsg||r,bottomBarMsg:n},$())}function $0(o,t={},...e){o||(o=""),t=Object.assign({color:"#75de75","font-style":"italic","background-color":"#333",padding:"2px","font-size":"16px"},t),o.includes("%c")||(o="%c "+o),console.log(o,JSON.stringify(t).replace(/[\"\{\}]/g,"").replace(/,/g,";"),...e)}var xB=new Set,o9t={"data/model/ArcModel":[36,228],"data/model/LineModel":[36,220],"data/model/PolygonModel":[52,444],"data/model/ArcTrackModel":[48,252],"data/model/TrackModel":[48,224],"data/model/TextModel":[100,5256],"data/model/PadModel":[104,1688],"data/model/ViaModel":[80,264],"data/model/ComponentModel":[104,356],"editor/common/PCBRTreeItem":[24,24],"editor/shape/PcbArc":[44,44],"editor/shape/PcbLine":[44,44],"editor/shape/PcbPolygon":[64,77],"editor/shape/ArcTrack":[52,84],"editor/shape/Track":[52,84],"editor/shape/PcbText":[40,52],"editor/shape/Pad":[48,48],"editor/shape/PolygonPad":[52,52],"editor/shape/Via":[48,48],"editor/shape/Component":[52,112],"view/pcb/ArcView":[24,76],"view/pcb/LineView":[28,72],"view/pcb/PolygonView":[36,36],"view/pcb/ArcTrackView":[20,72],"view/pcb/TrackView":[20,68],"view/pcb/TextView":[24,1524],"view/pcb/PadView":[24,108],"view/pcb/PolygonPadView":[28,528],"view/pcb/ViaView":[28,152],"view/pcb/ComponentView":[16,156]},kIe=hI(),yx=kIe.top||kIe,qBe=yx&&s9t()&&!Sa.unAmountCounts;function s9t(){let o=kIe.PRO_LOG_LEVEL;return o=="trace"||o=="debug"}function jo(o){qBe&&yx&&(isNaN(yx[o])?(yx[o]=1,xB.add(o)):yx[o]+=1)}function $Be(){xB.forEach(o=>{delete yx[o]}),xB.clear()}function BIe(){if(!qBe||xB.size==0)return;let o=0,t=0,e={};Pd(Array.from(xB)).forEach(r=>{let i=yx[r]||0,[n,s]=o9t[r]||[0,0],a=n>0,l=+(n*i/1e6).toFixed(2),c=+(s*i/1e6).toFixed(2);o+=i,t+=a?c:0,e[r]={amount:i,"pre(B)":a?[n,s].join(", "):"-","totalSelf(M)":a?l:"-","totalRetained(M)":a?c:"-"},delete yx[r]}),xB.clear(),$0("CountsAmount",{color:"#ffff00"},o,`${t.toFixed(2)}M`),console.table(e)}var EE=class{constructor(t=1){this.netDefaultColor=new Map;this.customColor=new Map;this.ratio=t,this.alpha=1,this.defaultColor=ee.of6(ee.BLACK,this.alpha*this.ratio)}getAlpha(){return this.alpha}getColor(t,e){return this.customColor.get(t)||this.netDefaultColor.get(e)||this.defaultColor}setCustomColor(t,e){this.setColor(this.customColor,t,e)}getCustomColor(t){return this.customColor.get(t)}setNetColor(t,e){this.setColor(this.netDefaultColor,t,e)}setShapeAlpha(t){this.alpha=t,this.defaultColor=ee.of6(this.defaultColor,this.alpha*this.ratio),this.modifyAlpha(this.netDefaultColor),this.modifyAlpha(this.customColor)}modifyAlpha(t){for(let[e,r]of t)t.set(e,ee.of6(r,this.alpha*this.ratio))}setColor(t,e,r){r==null?t.delete(e):t.set(e,ee.of6(r,r.alpha*this.alpha*this.ratio))}};var uY=class extends EE{constructor(e=1,r=!1){super(e);this.selectNetDefaultColor=new Map;this.selectCustomColor=new Map;this.selectNetSingleDefaultColor=new Map;this.selectSingleCustomColor=new Map;this.needSelectColor=!1;this.hasSingle=!1;this.selectRatio=1,this.selectDefaultColor=this.defaultColor,this.selectSingleDefaultColor=this.defaultColor,this.hasSingle=r,this.update()}selectOpen(){return this.needSelectColor}update(){this.needSelectColor=this.alpha!=0&&this.selectRatio!=1}getSelectAlpha(e=!1){return this.getNoSelectColor(e)?1:this.selectRatio*.5}getColor(e,r,i=!1,n=!0){return this.getNoSelectColor(i)?super.getColor(e,r):n?this.selectCustomColor.get(e)||this.selectNetDefaultColor.get(r)||this.selectDefaultColor:this.selectSingleCustomColor.get(e)||this.selectNetSingleDefaultColor.get(r)||this.selectSingleDefaultColor}setCustomColor(e,r){super.setCustomColor(e,r),this.needSelectColor&&(this.setSelectColor(this.selectCustomColor,e,r),this.hasSingle&&this.setSelectColor(this.selectSingleCustomColor,e,r,!1))}getCustomColor(e,r=!1,i=!0){return this.getNoSelectColor(r)?super.getCustomColor(e):i?this.selectCustomColor.get(e):this.selectSingleCustomColor.get(e)}setNetColor(e,r){super.setNetColor(e,r),this.needSelectColor&&(this.setSelectColor(this.selectNetDefaultColor,e,r),this.hasSingle&&this.setSelectColor(this.selectNetSingleDefaultColor,e,r,!1))}getNoSelectColor(e=!1){return e==!1||this.needSelectColor==!1}setShapeAlpha(e){if(!isNaN(e)){let r=e!=this.alpha;super.setShapeAlpha(e),r&&this.updateSelect()}this.update()}setSelectAlpha(e){isNaN(e)||this.selectRatio!=e&&(this.selectRatio=e,this.updateSelect()),this.update()}updateSelect(){this.selectRatio==1?this.clearSelect():(this.selectDefaultColor=ee.of6(this.selectDefaultColor,this.getColorAlpha()),this.modifySelectAlpha(this.selectNetDefaultColor),this.modifySelectAlpha(this.selectCustomColor),this.hasSingle&&(this.selectSingleDefaultColor=ee.of6(this.selectDefaultColor,this.getColorAlpha(!1)),this.modifySelectAlpha(this.selectNetDefaultColor,!1),this.modifySelectAlpha(this.selectCustomColor,!1)),this.update())}getColorAlpha(e=!0){return e?this.alpha*this.ratio*this.selectRatio*.5:this.alpha*this.ratio*this.selectRatio}clearSelect(){this.selectNetDefaultColor.clear(),this.selectCustomColor.clear()}modifySelectAlpha(e,r=!0){for(let[i,n]of e)e.set(i,ee.of6(n,this.getColorAlpha(r)))}setSelectColor(e,r,i,n=!0){i==null?e.delete(r):e.set(r,ee.of6(i,this.getColorAlpha(n)))}};var _M=class _M{constructor(){this.padConfig=new uY(void 0,!0);this.viaConfig=new uY;this.trackConfig=new EE;this.textConfig=new EE;this.readonlyPadConfig=new EE(.5);this.readonlyViaConfig=new EE(.5);this.readonlyTrackConfig=new EE(.5)}static getInstance(){return _M.ins==null&&(_M.ins=new _M),_M.ins}selectOpen(){return this.padConfig.selectOpen()}doAction(t,e){this.padConfig.setNetColor(t,e),this.viaConfig.setNetColor(t,e),this.trackConfig.setNetColor(t,e),this.readonlyPadConfig.setNetColor(t,e),this.readonlyViaConfig.setNetColor(t,e),this.readonlyTrackConfig.setNetColor(t,e)}};_M.ins=null;var Oo=_M;var vM=class vM{constructor(){this._padShowNet=!0;this._padShowNum=!0;this._trackShowNet=!0;this._viaShowNet=!0;this._viaShowPair=!0}static getInstance(){return vM.config==null&&(vM.config=new vM),vM.config}get padShowNet(){return this._padShowNet}set padShowNet(t){this._padShowNet=t}get padShowNum(){return this._padShowNum}set padShowNum(t){this._padShowNum=t}get trackShowNet(){return this._trackShowNet}set trackShowNet(t){this._trackShowNet=t}get viaShowPair(){return this._viaShowPair}set viaShowPair(t){this._viaShowPair=t}get viaShowNet(){return this._viaShowNet}set viaShowNet(t){this._viaShowNet=t}};vM.config=null;var ga=vM;var Xo=class{get highLightType(){var t;return(t=this._viewDataModel)==null?void 0:t.highLightType}get lastHighLightColor(){return this._lastHighLightColor||ee.BLACK}set lastHighLightColor(t){this._lastHighLightColor=t}get manualHighLight(){var t;return(t=this._viewDataModel)==null?void 0:t.manualHighLight}get manualHighLightModified(){var t;return(t=this._viewDataModel)==null?void 0:t.manualHighLightModified}get layerModified(){var t;return(t=this._viewDataModel)==null?void 0:t.layerModified}get shapeModified(){var t;return(t=this._viewDataModel)==null?void 0:t.shapeModified}get netModified(){var t;return(t=this._viewDataModel)==null?void 0:t.netModified}resetHighLightState(){this.lastHighLightType=null}get highlightColor(){var t;return(t=this._viewDataModel)==null?void 0:t.highlightColor}get viewGroupId(){return this.engineGroupId}getEngineGroupId(t){if(t)return bn.getInstance().getEngineGroupId(t)}get viewGroupIdModified(){var t;return(t=this._viewDataModel)==null?void 0:t.viewGroupIdModified}get forceUpdateMask(){var t;return(t=this._viewDataModel)==null?void 0:t.forceUpdateMask}mainMaskHighLightColor(t,e,r,i){!t||!e&&this.lastHighLightType==r||(this.lastHighLightType!=null&&t.highlight(!1,this.lastHighLightType,this.lastHighLightColor),r!=null&&t.highlight(!0,r,i),this.lastHighLightType=r,this.lastHighLightColor=i)}mainsMaskHighLightColor(t,e,r,i){if(t!=null&&t.length&&!(!e&&this.lastHighLightType==r)){if(this.lastHighLightType!=null)for(let s of t)s.highlight(!1,this.lastHighLightType,this.lastHighLightColor);if(r!=null)for(let s of t)s.highlight(!0,r,i);this.lastHighLightType=r,this.lastHighLightColor=i}}isWebglEnv(){return Ya.useWebgl}setDataModel(t){this._viewDataModel=t}getDataModel(){return this._viewDataModel}modify(t,e,...r){this.setDataModel(t)}remove(){}};var dY=class o extends Xo{constructor(){super(),jo("view/pcb/ArcTrackView")}get highLightType(){var t;return(t=o._viewDataModel)==null?void 0:t.highLightType}get manualHighLight(){var t;return(t=o._viewDataModel)==null?void 0:t.manualHighLight}get manualHighLightModified(){var t;return(t=o._viewDataModel)==null?void 0:t.manualHighLightModified}get layerModified(){var t;return(t=o._viewDataModel)==null?void 0:t.layerModified}get shapeModified(){var t;return(t=o._viewDataModel)==null?void 0:t.shapeModified}get netModified(){var t;return(t=o._viewDataModel)==null?void 0:t.netModified}get highlightColor(){var t;return(t=o._viewDataModel)==null?void 0:t.highlightColor}get viewGroupIdModified(){var t;return(t=o._viewDataModel)==null?void 0:t.viewGroupIdModified}get forceUpdateMask(){var t;return(t=o._viewDataModel)==null?void 0:t.forceUpdateMask}get layerId(){var t;return(t=o._viewDataModel)==null?void 0:t.layerId}get net(){var t;return(t=o._viewDataModel)==null?void 0:t.net}get showNet(){return o._viewDataModel.showNet}get width(){var t;return(t=o._viewDataModel)==null?void 0:t.width}get shouldShowNet(){return ga.getInstance().trackShowNet}get color(){return o._viewDataModel.partition==x.getInstance().partitionId?Oo.getInstance().trackConfig.getColor(o._viewDataModel.globalIndex,this.showNet):Oo.getInstance().readonlyTrackConfig.getColor(o._viewDataModel.globalIndex,this.showNet)}get center(){var t;return(t=o._viewDataModel)==null?void 0:t.center}get radius(){var t;return(t=o._viewDataModel)==null?void 0:t.radius}get startAngle(){var t;return(t=o._viewDataModel)==null?void 0:t.startAngle}get endAngle(){var t;return(t=o._viewDataModel)==null?void 0:t.endAngle}get sweep(){var t;return(t=o._viewDataModel)==null?void 0:t.sweep}get midPoint(){let t=this.startAngle,e=this.endAngle,r=this.sweep,i=this.center,n=this.radius;if(r==le.CCW)if(e>t){let s=(e-t)/2+t;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(e+Vr-t)/2+t;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}}else if(e>t){let s=(t+Vr-e)/2+e;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(t-e)/2+e;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}}}get length(){let t=0;return this.sweep==le.CCW?t=(this.endAngle-this.startAngle+Vr)%Vr:t=(this.startAngle-this.endAngle+Vr)%Vr,t*this.radius}getAngle(){let t=this.midPoint.sub(this.center).normalize(),e=Math.atan2(t.x,-t.y);return e<-es?e+=Math.PI:e>es&&(e-=Math.PI),e}mainVisible(){let t=this.layerId,e=this.color,r=!1,i=!this.main||!1;if(this.main)this.layerModified&&(this.mainRemove(),i=!0);else{let n=this.resetHighLightState;this.main=new Lg(t,n),i=!0}i||(i=this.shapeModified),(i||this.viewGroupIdModified||!e.equals(this._lastLineColor))&&(i=!0,this._lastLineColor=e),this.shouldShowNet&&this.showNet?(r=!this.netView||i||this.netModified,this.netView||(this.netView=new jl(t),r=!0),r&&(r=!0)):this.removeNetView(),this.show(i,r,e),this.netView&&this.netView.forceVisibleHighLight(this.manualHighLight),this.main.forceVisibleHighLight(this.manualHighLight)}show(t,e,r){if(t||e){let{layerId:i,showNet:n,center:s,radius:a,width:l,startAngle:c,endAngle:h,sweep:u,engineGroupId:d}=this;t&&this.main.visible(i,s,a,l,c,h,u,r,d),e&&this.netView.visible(i,n,this.midPoint,this.getAngle(),Wc,zc,this.length,l,void 0,this.viewGroupId)}}maskVisible(t,e=!1){if(!this.main)return;let r=this.highlightColor||this.color;if(this.isWebglEnv()){if(t){let i=this.highlightColor||this.color;this.mask||(this.mask=new fl(1002)),this.mask.visible(1002,this.center,this.radius,this.width,this.startAngle,this.endAngle,this.sweep,i,null)}else this.mask&&(this.mask.remove(),delete this.mask);return}this.mainMaskHighLightColor(this.main,e,t?this.highLightType:null,r)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask)}modify(t,e){switch(o._viewDataModel=t,e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){var t;this.maskVisible(!1,!0),(t=this.main)==null||t.remove()}removeNetView(){this.netView&&(this.netView.remove(),delete this.netView)}remove(){this.mainRemove(),this.removeNetView()}};var Ly=class extends Cu{visible(t,e,r,i,n,s,a,l){this.layerId!=t&&this.remove(),this.layerId=t,a=a==null?ee.BLACK:a,!Sa.unRefreshScene&&(this.id=this.plane.createOrUpdateArcSegment(this.id,e,r,i,n,s,a,void 0,l))}},OE=class extends Ly{};var NI=class extends Xo{get lineColor(){var t;return((t=this._viewDataModel)==null?void 0:t.lineColor)||ee.WHITE}get lineSolid(){return this._lineSolid==null?!0:this._lineSolid}set lineSolid(t){this._lineSolid==null&&t||(this._lineSolid=t)}get isPixel(){var t;return((t=this._viewDataModel)==null?void 0:t.isPixel)||!1}lineType(t,e=.01){return this.isPixel||t<e?"lineSegment":"line"}modify(t,e){super.modify(t,e),this.lineSolid=t.lineSolid}};var pY=class extends NI{constructor(){super(),jo("view/pcb/ArcView")}get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get center(){var t;return(t=this._viewDataModel)==null?void 0:t.center}get radius(){var t;return(t=this._viewDataModel)==null?void 0:t.radius}get startAngle(){var t;return(t=this._viewDataModel)==null?void 0:t.startAngle}get endAngle(){var t;return(t=this._viewDataModel)==null?void 0:t.endAngle}get sweep(){var t;return(t=this._viewDataModel)==null?void 0:t.sweep}get width(){var t;return(t=this._viewDataModel)==null?void 0:t.width}get length(){var t;return(t=this._viewDataModel)==null?void 0:t.length}get color(){var t;return(t=this._viewDataModel)==null?void 0:t.color}lineTypeChanged(t){return t=="lineSegment"?this.main&&this.main instanceof fl:this.main&&this.main instanceof Ly}shapeVisible(t,e,r){t&&(t instanceof fl?t.visible(e,this.center,this.radius,this.width,this.startAngle,this.endAngle,this.sweep,r,this.viewGroupId):t.visible(e,this.center,this.radius,this.startAngle,this.endAngle,this.sweep,r,this.viewGroupId))}mainVisible(){let t=this.layerId,e=!1;this.main&&this.layerModified&&(this.mainRemove(),e=!0);let r=this.lineType(this.width);if(!this.main||this.lineTypeChanged(r)){if(this.mainRemove(),r=="line"){let s=this.resetHighLightState;this.main=new Lg(t,s)}else{let s=this.resetHighLightState;this.main=new OE(t,s)}e=!0}let i=this.lineColor,n=!i.equals(this._lastLineColor);e||(e=this.shapeModified||this.viewGroupIdModified||n),e&&(this.shapeVisible(this.main,this.layerId,this.lineColor),this._lastLineColor=i),this.main.forceVisibleHighLight(this.manualHighLight)}maskVisible(t,e=!1){var i;if(!this.main)return;let r=this.highlightColor||this.color;if(this.isWebglEnv()){if(!t){this._mask&&(this._mask.remove(),delete this._mask);return}(this.shapeModified||!this._mask)&&((i=this._mask)==null||i.remove(),this.lineType(this.width)=="line"?this._mask=new fl(1002):this._mask=new Ly(1002)),this.shapeVisible(this._mask,1002,r);return}this.mainMaskHighLightColor(this.main,e,t?this.highLightType:null,r)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask)}modify(t,e){super.modify(t,e);let{lineSolid:r}=t;if(this.lineSolid=r,this.radius==0||this.length==0){this.mainRemove();return}switch(e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){var t;this.maskVisible(!1,!0),(t=this.main)==null||t.remove()}remove(){this.mainRemove()}};var ya=class extends Cu{constructor(t,e=null,r){super(t,e),r!=null&&(this.canPanelize=r)}get plane(){return this.canPanelize==null?this.layer.plane:this.layer.getCreateNoPanelizePlane()}visible(t,e,r,i,n){this.layerId!=t&&this.remove(),this.layerId=t,!Sa.unRefreshScene&&(this.id=this.plane.createOrUpdateCircle(this.id,e,r,i,void 0,n))}},AE=class extends ya{};var Ite=class extends Cu{visible(t,e,r,i,n,s){this.layerId!=t&&this.remove(),this.layerId=t,!Sa.unRefreshScene&&(this.id=this.plane.createOrUpdateSemicircle(this.id,e,r,i,n,void 0,s))}};var fY=class extends Xo{constructor(){super(...arguments);this.hole=new Ite(47);this.cushions=[new ya(12)]}get wireViewGroupId(){var e;return this.getEngineGroupId((e=this._viewDataModel)==null?void 0:e.wireViewGroupId)}get net(){var e;return(e=this._viewDataModel)==null?void 0:e.net}get center(){var e;return(e=this._viewDataModel)==null?void 0:e.center}get radius(){var e;return(e=this._viewDataModel)==null?void 0:e.radius}get holeRadius(){var e;return(e=this._viewDataModel)==null?void 0:e.holeRadius}get startLayerId(){var e;return(e=this._viewDataModel)==null?void 0:e.startLayer}get endLayerId(){var e;return(e=this._viewDataModel)==null?void 0:e.endLayer}get topExpansion(){var r;return[this.startLayerId,this.endLayerId].includes(1)?(r=this._viewDataModel)==null?void 0:r.topExpansion:-1e3}get bottomExpansion(){var r;return[this.startLayerId,this.endLayerId].includes(2)?(r=this._viewDataModel)==null?void 0:r.bottomExpansion:-1e3}get color(){return this._viewDataModel.partition==x.getInstance().partitionId?Oo.getInstance().viaConfig.getColor(this._viewDataModel.globalIndex,this._viewDataModel.net):Oo.getInstance().readonlyViaConfig.getColor(this._viewDataModel.globalIndex,this._viewDataModel.net)}get showNet(){return ga.getInstance().viaShowNet}get layerPairStr(){var e;return(e=this._viewDataModel)==null?void 0:e.layerPairStr}get highlightByComponent(){var e;return(e=this._viewDataModel)==null?void 0:e.highlightByComponent}get usedLayers(){var e;return(e=this._viewDataModel)==null?void 0:e.usedLayers}get allLayers(){var e;return(e=this._viewDataModel)==null?void 0:e.allLayers}get unusedInnerLayers(){var e;return(e=this._viewDataModel)==null?void 0:e.unusedInnerLayers}get radiusModified(){var e;return(e=this._viewDataModel)==null?void 0:e.radiusModified}get holeRadiusModified(){var e;return(e=this._viewDataModel)==null?void 0:e.holeRadiusModified}get topExpansionModified(){var e;return(e=this._viewDataModel)==null?void 0:e.topExpansionModified}get bottomExpansionModified(){var e;return(e=this._viewDataModel)==null?void 0:e.bottomExpansionModified}get holeViewGroupId(){var e;return(e=this._viewDataModel)==null?void 0:e.holeViewGroupId}getFontPosition(e,r){return e!=""&&r!=""?1:e!=""&&r==""?2:e==""&&r!=""?2:3}createNetAndLayerPairView(){let e=47,r=this.showNet?this.net:"",i=this.layerPairStr,n=!1;if(r?this._netView||(this._netView=new jl(e),n=!0):this.removeNetView(),i?this._layerPair||(this._layerPair=new jl(e)):this.removeLayerPairView(),!this._netView&&!this._layerPair)return;let a=this.shapeModified||this.holeRadiusModified||this.radiusModified||this.netModified||n,l=a||this._lastLayerPairStr!=i;if(!(a||l)){this._netView&&this._netView.forceVisibleHighLight(this.manualHighLight),this._layerPair&&this._layerPair.forceVisibleHighLight(this.manualHighLight);return}let c=this.wireViewGroupId,h=this.center,u=0,d=this.radius*2,p=this.holeRadius*2,m=this.getFontPosition(r,i),g=h,y=h;if(m==1){let b=p*.25;g=new S(h.x,h.y-b),y=new S(h.x,h.y+b),p*=.5}this._netView&&a&&this._netView.visible(e,r,g,u,Wc,zc,d,p,null,c),this._netView&&this._netView.forceVisibleHighLight(this.manualHighLight),this._layerPair&&l&&(this._layerPair.visible(e,i,y,u,Wc,zc,d,p,null,c),this._lastLayerPairStr=i),this._layerPair&&this._layerPair.forceVisibleHighLight(this.manualHighLight)}cushionVisible(){var s;let e=this.unusedInnerLayers.length>0?this.usedLayers:[12],r=this.shapeModified||this.radiusModified||this.viewGroupIdModified,i=this.color;if(r||(r=e.toString()!=((s=this._lastCushionLayerIds)==null?void 0:s.toString())||!i.equals(this._lastColor)),!r){for(let a=0;a<Math.max(this.cushions.length,e.length);a++)this.cushions[a]&&this.cushions[a].forceVisibleHighLight(this.manualHighLight);return}let n=this.wireViewGroupId;for(let a=0;a<Math.max(this.cushions.length,e.length);a++){if(!e[a]){this.removeLastMaskShape(this.cushions[a]);continue}this.cushions[a]||(this.cushions[a]=new ya(e[a])),this.cushions[a].visible(e[a],this.center,this.radius,this.color,n),this.cushions[a].forceVisibleHighLight(this.manualHighLight)}this.cushions.length=e.length,this._lastCushionLayerIds=e,this._lastColor=i}mainVisible(){this.createNetAndLayerPairView();let e=this.shapeModified||this.radiusModified||this.viewGroupIdModified,r=e||this.topExpansionModified,i=this.topExpansion+this.radius,n=this.wireViewGroupId;i>0?(this._expansionTop||(this._expansionTop=new ya(5),r=!0),r&&this._expansionTop.visible(5,this.center,i,ee.BLACK,n),this._expansionTop.forceVisibleHighLight(this.manualHighLight)):this.removeExpansionTop(),this.cushionVisible();let s=e||this.bottomExpansionModified,a=this.bottomExpansion+this.radius;a>0?(this._expansionBot||(this._expansionBot=new ya(6),s=!0),s&&this._expansionBot.visible(6,this.center,a,ee.BLACK,n),this._expansionBot.forceVisibleHighLight(this.manualHighLight)):this.removeExpansionBot();let l=e||this.holeRadiusModified,c=bn.getInstance().getLayer(this.startLayerId).activeColor,h=bn.getInstance().getLayer(this.endLayerId).activeColor;if(l||(l=!c.equals(this._lastStartColor)||!h.equals(this._lastEndColor)),l){let p=this.getEngineGroupId(this.holeViewGroupId);this.hole.visible(47,this.center,this.holeRadius,c,h,p),this._lastStartColor=c,this._lastEndColor=h}this.hole.forceVisibleHighLight(this.manualHighLight);let u=12,d=!1;if(!this.maskShape){let p=this.resetHighLightState;this.maskShape=new AE(u,p),d=!0}(d||e||r||s)&&this.maskShape.visible(u,this.center,this.radius+this.getMaxExpansion(),ee.of6(ee.BLACK,1e-6),this.viewGroupId)}getMaxExpansion(){return Math.max(0,this.topExpansion,this.bottomExpansion)}maskVisible(e,r=!1){if(!this.maskShape)return;if(this.isWebglEnv()){let n=this.highlightColor||ee.BLACK;if(!e){this._mask&&(this._mask.remove(),delete this._mask);return}let s=Math.max(this.radius,this.holeRadius)+Math.max(this.topExpansion,this.bottomExpansion,0);this._mask||(this._mask=new ya(1002)),this._mask.visible(1002,this.center,s,n,null);return}let i=this.forceUpdateMask?this.highlightColor:ee.of6(ee.BLACK,1e-6);this.mainMaskHighLightColor(this.maskShape,r,e?this.highLightType:null,i)}removeLastMaskShape(e){e&&e.remove()}componentMaskVisible(e){e&&this.highlightByComponent?(this._maskByComponent||(this._maskByComponent=new ya(1002)),this._maskByComponent.visible(1002,this.center,this.radius+Math.max(this.topExpansion,this.bottomExpansion,0),ee.BLACK,null)):this._maskByComponent&&(this._maskByComponent.remove(),delete this._maskByComponent)}visible(){this.maskVisible(!1,!0),this.mainVisible(),this.componentMaskVisible()}highlight(){this.maskVisible(!1,!0),this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask),this.componentMaskVisible()}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.maskVisible(!1,!0),this.removeLastMaskShape(this.hole),this.cushions.forEach(e=>this.removeLastMaskShape(e)),this.removeExpansionTop(),this.removeExpansionBot(),this.removeNetView(),this.removeLayerPairView(),this.removeMaskShape()}removeNetView(){this._netView&&(this._netView.remove(),delete this._netView)}removeLayerPairView(){this._layerPair&&(this._layerPair.remove(),delete this._layerPair)}removeExpansionTop(){this._expansionTop&&(this.removeLastMaskShape(this._expansionTop),delete this._expansionTop)}removeExpansionBot(){this._expansionBot&&(this.removeLastMaskShape(this._expansionBot),delete this._expansionBot)}removeMaskShape(){this.maskShape&&(this.maskShape.remove(),delete this.maskShape)}};var xM=118.11,V2=.1/10,qo=new ft().conversion("mm","mil",1)/10,SJt=3.6*qo,EJt={M2:7.874,M3:11.811,M4:15.748,M5:19.685,M6:23.622},Ste=90,OJt=new Di(39.37,10).ratio,Tx={M2:{holeDiameterWithoutSpigot:1.8*qo,holeDiameterWithSpigot:2.2*qo,topStiffWidth:3*qo,botStiffWidth:5*qo,topStiffDistance:2*qo,stiffThickness:1.2*qo,screwheadHeight:2.5*qo,screwheadDiameter:4*qo,thickness:1.27*qo},M3:{holeDiameterWithoutSpigot:2.8*qo,holeDiameterWithSpigot:3.2*qo,topStiffWidth:3*qo,botStiffWidth:5*qo,topStiffDistance:2*qo,stiffThickness:1.2*qo,screwheadHeight:3.2*qo,screwheadDiameter:5.8*qo,thickness:1.27*qo},M4:{holeDiameterWithoutSpigot:3.8*qo,holeDiameterWithSpigot:4.2*qo,topStiffWidth:3*qo,botStiffWidth:5*qo,topStiffDistance:2*qo,stiffThickness:1.5*qo,screwheadHeight:4.2*qo,screwheadDiameter:7.5*qo,thickness:1.27*qo},M5:{holeDiameterWithoutSpigot:4.8*qo,holeDiameterWithSpigot:5.2*qo,topStiffWidth:3*qo,botStiffWidth:6*qo,topStiffDistance:3*qo,stiffThickness:1.5*qo,screwheadHeight:5.2*qo,screwheadDiameter:9*qo,thickness:1.27*qo},M6:{holeDiameterWithoutSpigot:5.8*qo,holeDiameterWithSpigot:6.2*qo,topStiffWidth:3*qo,botStiffWidth:6*qo,topStiffDistance:3*qo,stiffThickness:2*qo,screwheadHeight:6.2*qo,screwheadDiameter:10.5*qo,thickness:1.27*qo}};var mY=class{updatePropsBySpecification(t,e,r,i){let n=Tx[e];if(e!=="Custom"&&n){let s=this.specificationToProps(n,t.height,i);t.thickness=s.thickness,t.holeDiameter=s.holeDiameter,r?t.stiffenerProps=s.stiffenerProps:t.stiffenerProps=null,i?t.counterboreProps=s.counterboreProps:t.counterboreProps=null}}specificationToProps(t,e,r){return{thickness:t.thickness,holeDiameter:r?t.holeDiameterWithSpigot:t.holeDiameterWithoutSpigot,counterboreProps:{height:t.screwheadHeight,diameter:t.screwheadDiameter},stiffenerProps:{topWidth:t.topStiffWidth,bottomWidth:t.botStiffWidth,height:e-t.topStiffDistance,stiffThickness:t.stiffThickness}}}getSpecificationByFuzzyMatch(t){let{needCounterbore:e,holeDiameter:r,height:i}=t,n,s=Number.MAX_VALUE,a=Tx;return Object.keys(a).map(l=>{let{holeDiameterWithSpigot:c,holeDiameterWithoutSpigot:h}=a[l],d=Math.abs((e?c:h)-r);d<s&&(s=d,n=l)}),this.specificationToProps(Tx[n],i,e)}getScrewPillarSize(t){let{holeDiameter:e,counterboreProps:r,stiffenerProps:i}=t,n=e/2,s=n;r&&(s=r.diameter/2);let a=0,l=0;return i&&(a=Math.max(i.topWidth,i.bottomWidth)+n,l=i.stiffThickness),{innerRadius:n,outerRadius:s,stiffToCenterLength:a,stiffStrokeWidth:l}}},aT=new mY;var Ws=class extends Cu{constructor(t,e=null,r){super(t,e),r!=null&&(this.canPanelize=r)}get plane(){return this.canPanelize==null?this.layer.plane:this.layer.getCreateNoPanelizePlane()}getPlane(){let t=this._highLightType;return isNaN(t)?this.plane:this.getHighLightPlane(t)}get layer(){if(this.layerId<0){let t=bn.getInstance().getLayer(Math.abs(this.layerId));return t.copperLayer?t.copperLayer:t.layer}return bn.getInstance().getLayer(this.layerId).layer}visible(t,e,r,i,n,s,a){(this.layerId!=t||!isNaN(a)&&this._highLightType!=a)&&this.remove(),!Sa.unRefreshScene&&(this.layerId=t,this._highLightType!=a&&(this._highLightType=a),this.id=this.getPlane().createOrUpdateLine(this.id,e,r,i,w2e.ROUND,n,void 0,s))}remove(){this.isValidId()&&(this._removeCb&&(this._removeCb(),this.plane.removeHighLightPt(this.id),this.lastHighLightForce=null),this.getPlane().removePt(this.id)),this.resetId()}getBBox(){return this.plane.getPtBboxById(this.id)}getId(){return this.id}},Nd=class extends Ws{};var Yc=class extends Cu{visible(t,e,r,i,n,s,a,l){this.layerId!=t&&this.remove(),this.layerId=t,a=a==null?ee.BLACK:a,!Sa.unRefreshScene&&(this.id=this.plane.createOrUpdateLineSegment(this.id,e,r,i,n,s,a,void 0,l))}},Ix=class extends Yc{};var kd=class o{constructor(){this.groupID=null;this.watcher=null}setWatcher(t){this.watcher=t}setGroupID(t){this.groupID=t}clone(){return new o}toJSON(){return{}}};var Ete=.1/10,K0=class o extends kd{constructor(e,r,i,n,s){super();this._pushCoverDir=1;this._topInnerHeight=new ft().conversion("mm","mil",0)/10;this._bottomInnerHeight=new ft().conversion("mm","mil",0)/10;this._type=e,this._shellHeight=r,this._isDftSubstrateHeight=i===0,this._botShellHeight=n===0?r*2/3:n,this._botShellHeight=Math.max(this._botShellHeight,Ete);let a={shellHeight:r,botShellHeight:this._botShellHeight},l=this.getDefaultSubstrateHeight(e,a);this._substrateHeight=i===0?l:i,this._isDftBotShellHeight=n===0,this._shellThickness=s,this._topShellHeight=this._shellHeight-this._botShellHeight}getDefaultSubstrateHeight(e,r){let i=new ft().conversion("mm","mil",2)/10,{shellHeight:n,botShellHeight:s}=r;return e==="T&B"&&typeof s=="number"?s-i:e==="DRAWER"&&typeof n=="number"?n*2/3-i:0}get type(){return this._type}set type(e){let r=this._type;if(this._type=e,r==="DRAWER"&&e==="T&B"&&(isNaN(this._botShellHeight)||this._botShellHeight<Ete||this._botShellHeight>this.shellHeight)){let i=this.shellHeight*2/3;this._botShellHeight=Math.max(i,Ete)}}get shellHeight(){return this._shellHeight}set shellHeight(e){if(this._shellHeight=e,this._isDftSubstrateHeight){let r={shellHeight:e,botShellHeight:e*2/3},i=this.getDefaultSubstrateHeight(this.type,r);this._substrateHeight=i}if(this._isDftBotShellHeight){let r=e*2/3;this._botShellHeight=Math.max(r,Ete)}this._topShellHeight=this._shellHeight-this._botShellHeight,this._topInnerHeight>0&&(this._topInnerHeight=this.getTopInnerHeight(this._topInnerHeight,this._botShellHeight,this._shellThickness),this._bottomInnerHeight=0),this._bottomInnerHeight>0&&(this._bottomInnerHeight=this.getBottomInnerHeight(this._bottomInnerHeight,this._topShellHeight,this._shellThickness),this._topInnerHeight=0)}getTopInnerHeight(e,r,i){let n=r-i;return n<0?e:e<0?0:e>n?n:e}getBottomInnerHeight(e,r,i){let n=r-i;return n<0?e:e<0?0:e>n?n:e}get substrateHeight(){return this._substrateHeight}set substrateHeight(e){this._substrateHeight=e,this._isDftSubstrateHeight=!1}get botShellHeight(){return this._botShellHeight}set botShellHeight(e){this._botShellHeight=e,this._topShellHeight=this._shellHeight-e,this._isDftBotShellHeight=!1,this.topInnerHeight>0&&(this.topInnerHeight=this.getTopInnerHeight(this.topInnerHeight,this._botShellHeight,this._shellThickness)),this.bottomInnerHeight>0&&(this.bottomInnerHeight=this.getBottomInnerHeight(this.bottomInnerHeight,this._topShellHeight,this._shellThickness))}get topShellHeight(){return this._topShellHeight}set topShellHeight(e){this._topShellHeight=e,this._botShellHeight=this._shellHeight-e,this.topInnerHeight>0&&(this.topInnerHeight=this.getTopInnerHeight(this.topInnerHeight,this._botShellHeight,this._shellThickness)),this.bottomInnerHeight>0&&(this.bottomInnerHeight=this.getBottomInnerHeight(this.bottomInnerHeight,this._topShellHeight,this._shellThickness))}get pushCoverDir(){return this._pushCoverDir}set pushCoverDir(e){this._pushCoverDir=e}get topInnerHeight(){return this._topInnerHeight}set topInnerHeight(e){e<0||(this._topInnerHeight=this.getTopInnerHeight(e,this.botShellHeight,this.shellThickness),this._topInnerHeight>0&&(this._bottomInnerHeight=0))}get bottomInnerHeight(){return this._bottomInnerHeight}set bottomInnerHeight(e){e<0||(this._bottomInnerHeight=this.getBottomInnerHeight(e,this._topShellHeight,this._shellThickness),this._bottomInnerHeight>0&&(this._topInnerHeight=0))}get shellThickness(){return this._shellThickness}set shellThickness(e){this._shellThickness=e,this._topInnerHeight>0&&(this._topInnerHeight=this.getTopInnerHeight(this._topInnerHeight,this._botShellHeight,this._shellThickness),this._bottomInnerHeight=0),this._bottomInnerHeight>0&&(this._bottomInnerHeight=this.getBottomInnerHeight(this._bottomInnerHeight,this._topShellHeight,this._shellThickness),this._topInnerHeight=0)}get isDftBotShellHeight(){return this._isDftBotShellHeight}get isDftSubstrateHeight(){return this._isDftSubstrateHeight}getAttrs(){let[e,r,i,n,s]=[this._shellThickness,this.botShellHeight,this.topInnerHeight,this.bottomInnerHeight,this.pushCoverDir];switch(this._type){case"DRAWER":return{Thickness:e,Direction:s};case"T&B":return{Thickness:e,BottomHeight:r,TopInnerHeight:i,BottomInnerHeight:n}}}getShowType(){switch(this.type){case"DRAWER":return"Push cover";case"T&B":return"Upper and lower shell"}}toJSON(){return{type:this.type,botShellHeight:this.botShellHeight,isDftBotShellHeight:this.isDftBotShellHeight,isDftSubstrateHeight:this.isDftSubstrateHeight,shellHeight:this.shellHeight,shellThickness:this.shellThickness,substrateHeight:this.substrateHeight,pushCoverDir:this.pushCoverDir,topInnerHeight:this.topInnerHeight,bottomInnerHeight:this.bottomInnerHeight}}clone(){return new o(this.type,this.shellHeight,this.substrateHeight,this.botShellHeight,this.shellThickness)}};var Ote=null,GIe=new ArrayBuffer(8),FIe=new Float64Array(GIe),VIe=new Uint32Array(GIe),KBe=new Uint16Array(GIe);function xr(o,t,e=0,r=o.length){i(o,null,t,e,r);function i(s,a,l,c,h){let u,d,p,m;if(c<h-1){let g=h-c;if(g>50)a===null&&(a=new Array(g+1)),n(s,a,l,c,(c+h)/2|0,h);else{u=s[c],d=c,p=c,m=h;let y=d+1;for(;y<m;){if(p!=m){if(m=m+-1,l(u,s[m])<=0)continue;s[p]=s[m],p=m;continue}if(l(u,s[y])>=0){d=y,y=d+1;continue}s[p]=s[y],d=y,p=y,y=d+1}s[p]=u,i(s,a,l,c,p),i(s,a,l,p+1,h)}}}function n(s,a,l,c,h,u){i(s,a,l,c,h),i(s,a,l,h,u);for(var d=c,p=h,m=0,g=s[d],y=s[p];d<h&&p<u;){var b=l(g,y);isNaN(b)?(a[m++]=y,y=s[++p]):(b<=0&&(a[m++]=g,g=s[++d]),b>=0&&(a[m++]=y,y=s[++p]))}for(;d<h;d++)a[m++]=s[d];for(;p<u;p++)a[m++]=s[p];for(d=c,p=0;p<m;d++,p++)s[d]=a[p]}}var Re=class{static repeat(t,e){let r=new Array(e);for(;e-- >0;)r[e]=t;return r.join("")}static lpad(t,e,r){let i=r-t.length;return i>0?this.repeat(e,i)+t:t}static rpad(t,e,r){let i=r-t.length;return i>0?t+this.repeat(e,i):t}static strHashcode(t){if(t.length>0){let e=0;for(let r=0;r<t.length;r++)e=31*e+t.charCodeAt(r)|0;return e}else return 0}static arraycopy(t,e,r,i,n){if(t.length>=e+n&&r.length>=i+n)for(;n-- >0;)r[i++]=t[e++];else throw new Error("arraycopy out of range")}static undefAsNull(t){return null}static reverse(t,e){for(let r=0,i=t.length-1;i>=0;r++,i--)e[r]=t[i];return e}static sortAsc(t,e){return t-e}static xmlDecode(t){let e=t.length,r=new Array,i=-1;for(let n=0;n<e;n++){let s=t.charAt(n);if(i>=0){if(s===";"){let a=t.substring(i+1,n);switch(a){case"lt":r.push("<");break;case"gt":r.push(">");break;case"quot":r.push('"');break;case"apos":r.push("'");break;case"amp":r.push("&");break;default:if(a.charAt(0)==="#"){let l=parseInt(a.substring(1));r.push(String.fromCharCode(l))}else r.push("&"+a+";")}i=-1}}else s==="&"?i=n:r.push(s)}return i>=0&&r.push(t.substring(i)),r.join("")}static queryItem(t,e,r){let i={index:-1,data:null};for(let n=0;n<t.length;n++){let s=t[n];if(s[e]===r)return i.index=n,i.data=s,i}return i}static addAll(t,e){for(let r of e)t.push(r)}static addAllSet(t,e){for(let r of e)t.add(r)}static contains(t,e){for(let r of t)if(r.equals(e))return!0;return!1}static equals(t,e){if(t.length==e.length){for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}else return!1}static remove(t,e){let r=0,i=t.length;for(let n=0;n<i;n++)t[n]===e&&(t.splice(n,1),n--,i--,r++);return r}static getUrlVars(){for(var t={},e=location.href.slice(location.href.indexOf("?")+1).split("&"),r=0;r<e.length;r++){var i=e[r].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}static prefix(){if(!Ote){let t=this.getUrlVars().version;t?Ote="/analyzer/v"+t:Ote="/analyzer"}return Ote}static add2objS(t,e,r){if(e in t)return t[e];{let i=r(e);return t[e]=i,i}}static downloadFile(t,e){let r=document.createElement("a"),i=URL.createObjectURL(e);r.download=t,r.href=i,r.click(),URL.revokeObjectURL(i)}static uuid(){let t=new Array;FIe[0]=new Date().getTime(),t.push(VIe[1].toString(16)),FIe[0]=Math.random(),t.push(KBe[3].toString(16));let e=KBe[2].toString(16);t.push("4"+e.substr(0,3)),FIe[0]=performance.now();let r=VIe[0].toString(16)+VIe[1].toString(16);return t.push("0"+r.substr(0,3)),t.push(r.substr(3)),t.join("-")}static funcCopy(t){return(0,eval)("("+t.toString()+")")}static NVL(...t){for(let e of t)if(e!==null)return e;return null}static isSingle(t){return Array.from(new Set(t)).length===t.length}},a9t=[1,10,100,1e3];function xh(o){return typeof o=="number"&&!isNaN(o)}function lT(o){return new ft().conversion("mm","mil",o)}function JBe(o,t,e){if(xh(t)&&xh(t)&&t>e)throw new Error("error params: min > max");return xh(t)&&o<t?{check:!1,value:t}:xh(e)&&o>e?{check:!1,value:e}:{check:!0,value:o}}var Ate=0,RM=0;function xte(o,t,e){return Ate=Math.abs(o-t),e>=5&&Ate>1e-5||isNaN(e)&&Ate>1e-8?!1:Ate<1e-13?!0:(RM=Math.min(ZBe(o),ZBe(t)),RM<10&&(RM=10),isNaN(e)||(RM=Math.min(RM,e)),ka(o,RM)===ka(t,RM))}var _te=0,vte=0;function ZBe(o){return _te=0,vte=0,o>0?_te=o-Math.floor(o):_te=o-Math.ceil(o),vte=(_te.toString()||"").length,vte>2?vte-2:0}function ka(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=a9t[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}function Rte(o,t){let e=new Set;for(let r of o)e.add(r);for(let r of t)e.add(r);return e}var eQt=.1/10,um=class o extends kd{constructor(e,r){super();this._stiffenerProps=null;this._counterboreProps=null;this._height=r,this._specification=e}get specification(){return this._specification}set specification(e){if(e!=="Custom"){let{needCounterbore:r,needStiffener:i}=this;aT.updatePropsBySpecification(this,e,i,r)}this._specification=e,this.syncLatestData()}syncLatestData(){var e;(e=this.watcher)==null||e.syncLatestData(this)}get height(){return this._height}set height(e){this._height=e,this.syncLatestData()}get holeDiameter(){return this._holeDiameter}set holeDiameter(e){e!==this._holeDiameter&&(this._holeDiameter=e,this.syncLatestData())}get thickness(){return this._thickness}set thickness(e){e!==this._thickness&&(this._thickness=e,this.syncLatestData())}get stiffenerProps(){return this._stiffenerProps?{...this._stiffenerProps}:null}set stiffenerProps(e){this._stiffenerProps=e?{...e}:null,this.syncLatestData()}updateStiffenerProps(e){let r=this._stiffenerProps;r&&(xh(e.topWidth)&&e.topWidth!==r.topWidth&&(r.topWidth=e.topWidth),xh(e.bottomWidth)&&e.bottomWidth!==r.bottomWidth&&(r.bottomWidth=e.bottomWidth),xh(e.height)&&e.height!==r.height&&(r.height=e.height),xh(e.stiffThickness)&&e.stiffThickness!==r.stiffThickness&&(r.stiffThickness=e.stiffThickness))}get counterboreProps(){return this._counterboreProps?{...this._counterboreProps}:null}set counterboreProps(e){this._counterboreProps=e?{...e}:null,this.syncLatestData()}updateCounterboreProps(e){let r=this._counterboreProps;r&&(xh(e.height)&&e.height!==r.height&&(r.height=e.height),xh(e.diameter)&&e.diameter!==r.diameter&&(r.diameter=e.diameter))}get needStiffener(){return!!this.stiffenerProps}set needStiffener(e){if(e){if(!this.needStiffener){let r=aT.getSpecificationByFuzzyMatch(this);this.stiffenerProps=r.stiffenerProps}}else this.stiffenerProps=null;this.syncLatestData()}get needCounterbore(){return!!this.counterboreProps}set needCounterbore(e){if(this.specification!=="Custom"){let r=Tx[this.specification];if(e!==this.needCounterbore&&r){let i=aT.specificationToProps(r,this.height,e);this.holeDiameter=i.holeDiameter}}if(e){if(!this.needCounterbore){let r=aT.getSpecificationByFuzzyMatch(this);this.counterboreProps=r.counterboreProps}}else this.counterboreProps=null;this.syncLatestData()}toJSON(){return{height:this.height,specification:this.specification,holeDiameter:this.holeDiameter,thickness:this.thickness,counterboreProps:this.counterboreProps,stiffenerProps:this.stiffenerProps}}clone(){let e=new o(this.specification,this.height);return e.holeDiameter=this.holeDiameter,e.thickness=this.thickness,e.counterboreProps=this.counterboreProps?{...this.counterboreProps}:null,e.stiffenerProps=this.stiffenerProps?{...this.stiffenerProps}:null,e}getParameters(){}};var l9t=[48,49,50,51],DM=class extends NI{constructor(){super(...arguments);this.filling=new Array(0)}get type(){var e;return(e=this._viewDataModel)==null?void 0:e.type}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get center(){var e;return(e=this._viewDataModel)==null?void 0:e.center}get radius(){var e;return(e=this._viewDataModel)==null?void 0:e.radius}get strokeWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.strokeWidth}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}get partitionName(){var e;return(e=this._viewDataModel)==null?void 0:e.partitionName}get constrainName(){return this._constrainName}set constrainName(e){this._constrainName=e}get fillColor(){return this._fillColor}set fillColor(e){this._fillColor=e}get fpcMaterial(){return this._fpcMaterial}set fpcMaterial(e){this._fpcMaterial=e}get fpcThickness(){return this._fpcThickness}set fpcThickness(e){this._fpcThickness=e}get component(){var e;return(e=this._viewDataModel)==null?void 0:e.component}shapeVisible(e,r,i){e&&(e instanceof fl?e.visible(r,this.center,this.radius,this.strokeWidth,0,Vr,le.CCW,i,this.viewGroupId):e.visible(r,this.center,this.radius,0,Vr,le.CCW,i,this.viewGroupId))}removeFill(){for(let e of this.filling)e.remove();this.holeBaseNetRemove(),this.fpcBaseNetRemove(),this.filling.length=0}fill(){var r;let e=this.filling==null||this.filling.length==0;switch(this.type){case"Board Outline":break;case"Fill Region":this.filling.length==0&&this.filling.push(this.fillRegion(this.layerId));break;case"FPC Stiffener":this.filling.length==0&&(this.filling=this.fillFPC(this.layerId));break;case"Slot Region":this.filling.length==0&&this.filling.push(this.fillRegion(47));break;case"Prohibited Region":this.filling.length==0&&(this.filling=this.fillGrid());break;case"Constraint Region":this.filling.length==0&&(this.filling=this.fillConstraint(this.layerId));break;case"Partition":{this.filling.forEach(i=>{i.remove&&i.remove()}),this.filling=this.fillPartition(this.layerId);break}case"Line":break;case"Copper Region":break;case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":this.filling.length==0&&this.filling.push(this.fillRegion(this.layerId));break;case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":this.filling.length==0&&this.filling.push(this.fillRegion(this.layerId));break;case"3D Shell - Screw Pillar":{this.filling.length==0&&(this.filling=this.fillScrewPillar());break}case"3D Shell - Outline":{this.filling.length==0&&(this.filling=this.fillCircleOutline());break}case"Board":{this.filling.length==0&&(this.filling=[this.fillRegion(this.layerId)]);break}}(e&&this.manualHighLight||this.manualHighLightModified)&&((r=this.filling)==null||r.forEach(i=>{i.forceVisibleHighLight(this.manualHighLight)}),this._fpcNameBaseNet&&this._fpcNameBaseNet.forceVisibleHighLight(this.manualHighLight),this._fpcNumberBaseNet&&this._fpcNumberBaseNet.forceVisibleHighLight(this.manualHighLight),this._holeBaseNet&&this._holeBaseNet.forceVisibleHighLight(this.manualHighLight))}fillRegion(e){let r=new ya(e);return r.visible(e,this.center,this.radius,this.fillColor,this.viewGroupId),r}fillScrewPillar(){let e=new Array,r=this.component;if(r instanceof um){let i=aT.getScrewPillarSize(r),{innerRadius:n,stiffToCenterLength:s,stiffStrokeWidth:a}=i,l=this.customFillRegion(this.layerId,n);if(e.push(l),s>0&&a>0){let c=new S(this.center.x,this.center.y+s),h=new S(this.center.x,this.center.y-s),u=new Ws(this.layerId);u.visible(this.layerId,c,h,a,ee.WHITE,this.viewGroupId,void 0);let d=new S(this.center.x-s,this.center.y),p=new S(this.center.x+s,this.center.y),m=new Ws(this.layerId);m.visible(this.layerId,d,p,a,ee.WHITE,this.viewGroupId,void 0),e.push(u,m)}}return e}fillGrid(){let e=this.fillColor||ee.Gray,r=new Array,i=this.center.add(new S(-1,1).mul(this.radius*Math.sqrt(2)/2)),n=this.center.add(new S(1,-1).mul(this.radius*Math.sqrt(2)/2)),s=i.y-i.x,a=n.y-n.x,l=this.radius*2,c=Math.max(1,Math.min(6,l));for(s-=c;s>a;s-=c){let m=2*(s-this.center.y-this.center.x),g=this.center.x*this.center.x-this.radius*this.radius+(s-this.center.y)*(s-this.center.y),y=Math.sqrt(m*m-8*g),b=(-m+y)/4,P=(-m-y)/4,T=b+s,I=P+s,C=new Yc(this.layerId);C.visible(this.layerId,new S(b,T),new S(P,I),!0,0,0,e,this.viewGroupId),r.push(C)}let h=this.center.add(new S(1,1).mul(this.radius*Math.sqrt(2)/2)),u=this.center.add(new S(-1,-1).mul(this.radius*Math.sqrt(2)/2)),d=h.y+h.x,p=u.y+u.x;for(d-=c;d>p;d-=c){let m=2*(this.center.y-d-this.center.x),g=this.center.x*this.center.x-this.radius*this.radius+(this.center.y-d)*(this.center.y-d),y=Math.sqrt(m*m-8*g),b=(-m+y)/4,P=(-m-y)/4,T=-b+d,I=-P+d,C=new Yc(this.layerId);C.visible(this.layerId,new S(b,T),new S(P,I),!0,0,0,e,this.viewGroupId),r.push(C)}return r}fillConstraint(e){let r=[];return r.push(this.fillRegion(e)),this.holeBaseNetVisible(),r}fillPartition(e){let r=[];return r.push(this.fillRegion(e)),this.holeBaseNetVisible(!0,e),r}fillFPC(e){let r=[];return r.push(this.fillRegion(e)),this.fpcMaterial&&this.fpcBaseNetVisible(),r}fillCircleOutline(){if(this.component instanceof K0){let e=this.component;if(!e||e.topInnerHeight<=0&&e.bottomInnerHeight<=0)return[];let r=bn.getInstance().getLayer(54),i=bn.getInstance().getLayer(55),n=e.topInnerHeight>0?r.activeColor:i.activeColor,l=this.strokeWidth/2+5.90551/2+.3937,c=new fl(this.layerId);return c.visible(this.layerId,this.center,this.radius-l,l,0,Vr,le.CCW,n,this.viewGroupId),[c]}return[]}customFillRegion(e,r){let i=new ya(e);return i.visible(e,this.center,r,this.fillColor,this.viewGroupId),i}mainVisible(){let e=this.lineColor,r=this.lineSolid,{layerId:i,lineSolid:n}=this._viewDataModel,s=!this.main||this.layerModified||this.shapeModified||this.viewGroupIdModified||!e.equals(this._lastLineColor);if(this.main==null||n!=r){if(this.mainRemove(),n){let a=this.resetHighLightState;this.main=new Lg(i,a)}else{let a=this.resetHighLightState;this.main=new OE(i,a)}this.lineSolid=n}s&&(this.shapeVisible(this.main,this.layerId,e),this._lastLineColor=e),this.main.forceVisibleHighLight(this.manualHighLight)}maskVisible(e,r,i=!1){this.circleMaskVisible(e,i),this.fillMaskVisible(r)}circleMaskVisible(e,r=!1){if(!this.main)return;let i=this.highlightColor||ee.BLACK;if(this.isWebglEnv()){if(!e){this._mask&&(this._mask.remove(),delete this._mask);return}this._mask||(this._mask=new fl(1002)),this._mask.visible(1002,this.center,this.radius,this.strokeWidth,0,Vr,le.CCW,i,this.viewGroupId);return}this.mainMaskHighLightColor(this.main,r,e?this.highLightType:null,i)}fillMaskVisible(e){if(e=e&&!["Line","Board Outline","3D Shell - Outline"].includes(this.type)&&!l9t.includes(this.layerId),!e){this._fillMask&&(this._fillMask.remove(),delete this._fillMask);return}let r=this.highlightColor||ee.BLACK;this._fillMask||(this._fillMask=new ya(1002)),this._fillMask.visible(1002,this.center,this.radius,r,this.viewGroupId)}visible(){this.maskVisible(!1,!1),this.mainVisible(),this.fill()}highlight(){this.mainVisible(),this.removeFill(),this.maskVisible(!0,!0,this.forceUpdateMask)}visibleMain(){this.mainVisible(),this.removeFill(),this.maskVisible(!0,!1)}modify(e,r){let i=this.fillColor,n=this.constrainName||"",s=this.fpcMaterial||"",a=this.fpcThickness||"";super.modify(e,r);let{fillColor:l,constrainName:c,fpcMaterial:h,fpcThickness:u}=e;switch(this.fillColor=l,this.constrainName=c||void 0,this.fpcMaterial=h||void 0,this.fpcThickness=u||void 0,(this.layerModified||this.shapeModified||this.viewGroupIdModified||!l.equals(i)||c!=n||h!=s||u!=a)&&(this.removeFill(),this.layerModified&&this.mainRemove()),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}case"Not Show Fill":{this.visibleMain();break}default:break}}holeBaseNetVisible(e=!1,r=47){if(e)this._holeBaseNet&&this._holeBaseNet.remove();else if(this._holeBaseNet)return;let i="";switch(this.type){case"Constraint Region":i=this.constrainName;break;case"Partition":i=this.lineColor.alpha===0?"":this.partitionName;break;default:break}if(!i||!bn.getInstance().getLayer(this.layerId).status.visible)return;let n=r||47,s=this.center,a=this.radius*2,l=a;this._holeBaseNet||(this._holeBaseNet=new jl(n)),this._holeBaseNet.visible(n,i,s,0,10,15,a*.75,l)}holeBaseNetRemove(){this._holeBaseNet&&(this._holeBaseNet.remove(),delete this._holeBaseNet)}fpcBaseNetVisible(){let e=this.fpcMaterial,r=this.fpcThickness;if(!e||!bn.getInstance().getLayer(this.layerId).status.visible)return;let i=this.center,n=this.radius*2,s=n,a=1003,l=i.add1(0,.25*s),c=i.add1(0,-.25*s);this._fpcNameBaseNet||(this._fpcNameBaseNet=new jl(a)),this._fpcNumberBaseNet||(this._fpcNumberBaseNet=new jl(a)),this._fpcNameBaseNet.visible(a,e,l,0,Wc,zc,n*.75,s,void 0,void 0),this._fpcNumberBaseNet.visible(a,`${r}mm`,c,0,Wc,zc,n*.75,s,void 0,void 0)}fpcBaseNetRemove(){this._fpcNameBaseNet&&(this._fpcNameBaseNet.remove(),delete this._fpcNameBaseNet),this._fpcNumberBaseNet&&(this._fpcNumberBaseNet.remove(),delete this._fpcNumberBaseNet)}mainRemove(){var e;this.circleMaskVisible(!1,!0),(e=this.main)==null||e.remove(),this.main=null}remove(){var e;this.maskVisible(!1,!1,!0),(e=this.main)==null||e.remove(),this.removeFill()}};var gY=class extends Xo{constructor(){super(),jo("view/pcb/ComponentView")}get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get position(){var t;return(t=this._viewDataModel)==null?void 0:t.position}get leftLow(){var t;return(t=this._viewDataModel)==null?void 0:t.leftLow}get leftUp(){var t;return(t=this._viewDataModel)==null?void 0:t.leftUp}get rightUp(){var t;return(t=this._viewDataModel)==null?void 0:t.rightUp}get rightLow(){var t;return(t=this._viewDataModel)==null?void 0:t.rightLow}get update(){var t;return(t=this._viewDataModel)==null?void 0:t.updateView}showUpdateBox(){if(!this.updateBox){this.updateBox=[];for(let r=0;r<4;r++)this.updateBox.push(new Yc(1002))}let t=0,e=[this.leftLow,this.rightLow,this.rightUp,this.leftUp,this.leftLow];for(let r of this.updateBox)r.visible(1002,e[t],e[t+1],!0,0,0,ee.Gray,this.viewGroupId),t++}removeUpdateBox(){this.updateBox&&(this.updateBox.forEach(t=>{t.remove()}),delete this.updateBox)}showSelectBox(t){if(!this.selectBox){this.selectBox=[];for(let i=0;i<4;i++)this.selectBox.push(new Yc(1002))}let e=[this.leftLow,this.rightLow,this.rightUp,this.leftUp,this.leftLow],r=0;for(let i of this.selectBox)i.visible(1002,e[r],e[r+1],!1,3,2,t,this.viewGroupId),r++}removeSelectBox(){this.selectBox&&(this.selectBox.forEach(t=>{t.remove()}),delete this.selectBox)}showMask(t){this.mask||(this.mask=[new Yc(1002),new Yc(1002)]);let e=new S(2.5,0),r=new S(0,2.5);this.mask[0].visible(1002,this.position.add(e),this.position.sub(e),!0,0,0,t,this.viewGroupId),this.mask[1].visible(1002,this.position.add(r),this.position.sub(r),!0,0,0,t,this.viewGroupId)}removeMask(){this.mask&&(this.mask.forEach(t=>{t.remove()}),delete this.mask)}visible(){this.update?this.showUpdateBox():this.removeUpdateBox(),this.removeSelectBox(),this.removeMask()}highlight(){let t=this.highlightColor||ee.BLACK;this.update?this.showUpdateBox():this.removeUpdateBox(),this.showSelectBox(t),this.showMask(t)}modify(t,e){switch(super.modify(t,e),e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.removeMask(),this.removeUpdateBox(),this.removeSelectBox()}};function QBe(){return[{value:"solid",text:"Solid"},{value:"45grid",text:"Grid 45\xB0"},{value:"90grid",text:"Grid 90\xB0"}]}var NS=class extends Cu{constructor(e,r=null,i){super(e,r);this.ids=new Array(0);i!=null&&(this.canPanelize=i)}get layer(){if(this.layerId<0){let e=bn.getInstance().getLayer(Math.abs(this.layerId));return e.copperLayer?e.copperLayer:e.layer}return bn.getInstance().getLayer(this.layerId).layer}get plane(){return this.canPanelize==null?this.layer.plane:this.layer.getCreateNoPanelizePlane()}hidden(){this.isValidId()&&this.plane.hiddenPolygonPt(this.ids)}show(){this.isValidId()&&this.plane.showPolygonPt(this.ids)}visible(e,r,i,n){this.layerId!=e&&this.remove(),!Sa.unRefreshScene&&(this.layerId=e,this.ids=this.layer.addStaticPolygon(r,i,n))}setMatrix(e){this.plane.setStaticPolygonInfo(this.ids,e)}isValidId(){return this.ids.length>=0}resetId(){this.ids=[]}forceVisibleHighLight(e){this.forceVisibleHighLights(this.ids,e)}highlight(e,r,i){this.highlights(this.ids,e,r,i)}remove(){var e;this.isValidId()&&((e=this._removeCb)==null||e.call(this),this.plane.removeHighLightPts(this.ids),this.plane.removePolygonPt(this.ids),this.lastHighLightForce=null),this.resetId()}},Dte=class extends NS{};var yY=class extends Xo{constructor(){super(...arguments);this.copper=new Array(0)}get layerId(){var r;let e=(r=this._viewDataModel)==null?void 0:r.layerId;return e==1||e==2?-e:e}get style(){var e;return(e=this._viewDataModel)==null?void 0:e.viewStyle}get pls(){var e;return(e=this._viewDataModel)==null?void 0:e.pls}get gridLineWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.gridLineWidth}get optimization(){var e;return(e=this._viewDataModel)==null?void 0:e.optimization}get viewColor(){var e;return(e=this._viewDataModel)==null?void 0:e.viewColor}get isPlaneZone(){var e;return(e=this._viewDataModel)==null?void 0:e.isPlaneZone}get optimizationWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.optimizationWidth}removeShapes(e,r){if(r.length===0)return;let i=bn.getInstance().getLayer(Math.abs(e)),s=(i.copperLayer?i.copperLayer:i.layer).plane;for(let a of r)Array.isArray(a)?s.removePolygonPt(a):a.remove();r.length=0}createShapes(e,r,i=!1){let n=new Array;if(this.style=="solid"){let s=this.resetHighLightState,a=this.pls,l=i?new Dte(e,s):new NS(e);if(l.visible(e,a,r,this.engineGroupId),n.push(l),this.optimization){let{optimizationWidth:c,viewGroupId:h}=this;for(let u of a)for(let d of u.primitives)if(d instanceof M){let p=i?new Nd(e,s):new Ws(e,void 0);p.visible(e,d.start(),d.end(),c,r,h,void 0),n.push(p)}else if(d instanceof q){let p=i?new Lg(e,s):new fl(e);p.visible(e,d.center,d.rx,c,d.startAngle/180*Math.PI,d.endAngle()/180*Math.PI,d.sweep(),r,h),n.push(p)}}}else if(this.style=="90grid"||this.style=="45grid"){let s=this.resetHighLightState,{gridLineWidth:a,viewGroupId:l}=this;for(let c of this.pls)for(let h of c.primitives)if(h instanceof M){let u=i?new Nd(e,s):new Ws(e);u.visible(e,h.start(),h.end(),a,r,l,void 0),n.push(u)}else if(h instanceof q){let u=i?new Lg(e,s):new fl(e);u.visible(e,h.center,h.rx,a,h.startAngle/180*Math.PI,h.endAngle()/180*Math.PI,h.sweep(),r,l),n.push(u)}}return n}mainVisible(){let e=this._color||this.viewColor,r=this.copper.length==0||this.shapeModified;return r&&this.remove(),r&&(this.copper=this.createShapes(this.layerId,e,!0),this._copperLayerId=this.layerId),(r&&this.manualHighLight||this.manualHighLightModified)&&this.copper.forEach(i=>{i.forceVisibleHighLight(this.manualHighLight)}),r}maskVisible(e,r=!1){if(this.isWebglEnv()){if(!e){this.mask&&(this.removeShapes(1002,this.mask),delete this.mask);return}this.mask=this.createShapes(1002,this.highlightColor||ee.BLACK);return}if(this.copper.length==0)return;let i=this.highlightColor||ee.BLACK,n=e?this.highLightType:null;this.mainsMaskHighLightColor(this.copper,r,n,i)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){let e=this.mainVisible();this.maskVisible(!0,e||this.forceUpdateMask)}modify(e,r){super.modify(e,r);let i=this.viewColor,n=this._color;switch((!n||!i.equals(n))&&(n=this._color=i,this.remove()),this.isPlaneZone&&!n.equals(ee.BLACK)&&n.alpha==1&&(n=ee.of6(n,.65),this._color=n),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}hasCopper(){return this.copper!=null&&this.copper.length>0}remove(){this.maskVisible(!1,!0),this.removeShapes(this._copperLayerId||this.layerId,this.copper)}};function RB(o,t,e,r){let i=t.sub(o).normalize(),n=o.distance1(t);if(n>=e+6){let s=t.angle(o),a=(n-e)/2;return s>-es&&s<es?o.add(i.mul(a)):t.add(i.mul(-a))}else{i.length()==0&&(i=new S(1,0));let s=t.angle(o),a=o.add(t).mul(.5);if(s>-es&&s<es){let l=new S(-i.y,i.x);return a.add(l.mul(r).add(i.mul(-e/2)))}else{let l=new S(i.y,-i.x);return a.add(l.mul(r).add(i.mul(e/2)))}}}function DB(o,t,e,r,i,n,s,a){let l=kS(o,t,e,r,(n==null?void 0:n.box.width)||0,s,a),c=new _e;for(let h of l)c.ext1(h.bbox());return c.ext7(i/2),c.ext1(n.bbox),c.build1()}function wB(o,t,e,r,i,n,s){let a=kS(o,t,e,r,0,n,s),l=new _e;for(let c of a)l.ext1(c.bbox());return l.ext7(i/2),l.build1()}function kS(o,t,e,r,i,n,s){let a=Ae.rotateZ(Math.PI/12),l=Ae.rotateZ(-Math.PI/12),c=new Array,h=o.distance1(t);if(o.equals(t)){let u=new S(1,0),d=u.multiply4(a).mul(s),p=u.multiply4(l).mul(s),m=new M(o,o.add(d)),g=new M(o,o.add(p)),y=new M(t,t.sub(p)),b=new M(t,t.sub(d));c.push(m,g,y,b)}else{let u=t.sub(o).normalize();if(o.equals(e)&&t.equals(r)){let p=new S(-u.y,u.x).mul(n),m=p.add(o),g=p.add(t),y=new M(m,o),b=new M(g,t),P=u.multiply4(a).mul(s),T=u.multiply4(l).mul(s),I=new M(o,o.add(P)),C=new M(o,o.add(T)),E=new M(t,t.sub(T)),O=new M(t,t.sub(P));if(c.push(y,b,I,C,E,O),h>=i+6){let _=(h-i)/2,R=new M(o,o.add(u.mul(_))),v=new M(t.sub(u.mul(_)),t);c.push(R,v)}else{let _=new M(o,t);c.push(_)}}else{let d=o.sub(e).normalize().mul(n),p=t.sub(r).normalize().mul(n);d.length()<=0&&(d=p),p.length()<=0&&(p=d);let m=new M(e,o.add(d)),g=new M(r,t.add(p)),y=u.multiply4(a).mul(s),b=u.multiply4(l).mul(s),P=new M(o,o.add(y)),T=new M(o,o.add(b)),I=new M(t,t.sub(b)),C=new M(t,t.sub(y));if(c.push(m,g,P,T,I,C),h>=i+6){let E=(h-i)/2,O=new M(o,o.add(u.mul(E))),_=new M(t.sub(u.mul(E)),t);c.push(O,_)}else{let E=new M(o,t);c.push(E)}}}return c}var Z0=class extends Cu{constructor(t,e=null,r){super(t,e),r!=null&&(this.canPanelize=r)}get plane(){return this.canPanelize==null?this.layer.plane:this.layer.getCreateNoPanelizePlane()}getPlane(){let t=this._highLightType;return isNaN(t)?this.plane:this.getHighLightPlane(t)}get layer(){return bn.getInstance().getLayer(this.layerId).layer}visible(t,e,r,i,n,s,a,l,c){(this.layerId!=t||!isNaN(c)&&this._highLightType!=c)&&this.remove(),!Sa.unRefreshScene&&(this.layerId=t,this._highLightType!=c&&(this._highLightType=c),this.id=this.getPlane().createOrUpdateRect(this.id,e,r,i,n,s,a,void 0,l))}remove(){this.isValidId()&&(this._removeCb&&(this._removeCb(),this.plane.removeHighLightPt(this.id),this.lastHighLightForce=null),this.getPlane().removePt(this.id)),this.resetId()}},wte=class extends Z0{};var UIe=ee.of6(ee.BLACK,.5),cT=class extends Xo{constructor(e){super();this.main=new Array;e!=null&&(this.canPanelize=e),jo("view/pcb/TextView")}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get strokeWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.strokeWidth}get path(){var e;return(e=this._viewDataModel)==null?void 0:e.path}get matrix(){var e;return(e=this._viewDataModel)==null?void 0:e.matrix}get width(){var e;return(e=this._viewDataModel)==null?void 0:e.width}get height(){var e;return(e=this._viewDataModel)==null?void 0:e.height}get color(){return this._viewDataModel.partition==x.getInstance().partitionId?Oo.getInstance().textConfig.getCustomColor(this._viewDataModel.globalIndex)||ee.BLACK:UIe}get outlineModified(){var e;return(e=this._viewDataModel)==null?void 0:e.outlineModified}mainVisible(){let e=this.layerModified||this.outlineModified;if(e){this.maskVisible(!1);for(let i of this.main)i.remove();this.main.length=0}let r=this.color;if(this.main.length==0){let i=this.layerId,n=this.strokeWidth,s=this.matrix.toMatrix3(),a=this.engineGroupId,l=this.resetHighLightState;for(let c of this.path)for(let h of c.primitives)if(h=h.multiply3(s),h instanceof M){let u=new Nd(i,l,this.canPanelize);u.visible(i,h.start(),h.end(),n,r,a,void 0),this.main.push(u)}else if(h instanceof q){let u=new Lg(i,l,this.canPanelize);u.visible(i,h.center.clone(),h.rx,n,h.startAngle/180*Math.PI,h.endAngle()/180*Math.PI,h.sweep(),r,a),this.main.push(u)}}else{if(e||(e=this.shapeModified||!r.equals(this._lastColor)),!e){this.manualHighLightModified&&this.main.forEach(c=>{c.forceVisibleHighLight(this.manualHighLight)});return}let i=this.layerId,n=this.strokeWidth,s=this.matrix.toMatrix3(),a=this.engineGroupId,l=0;for(let c of this.path)for(let h of c.primitives){if(h=h.multiply3(s),h instanceof M){let u=this.main[l];u instanceof Ws&&u.visible(i,h.start().clone(),h.end().clone(),n,r,a,void 0)}else if(h instanceof q){let u=this.main[l];u instanceof fl&&u.visible(i,h.center.clone(),h.rx,n,h.startAngle/180*Math.PI,h.endAngle()/180*Math.PI,h.sweep(),r,a)}l++}}this._lastColor=r,this.main.forEach(i=>{i.forceVisibleHighLight(this.manualHighLight)})}maskVisible(e){if(!e){this.mask&&(this.mask.remove(),delete this.mask);return}let r=this.highlightColor||ee.BLACK;this.mask||(this.mask=new Z0(1002));let i=this._viewDataModel.box,n=i.isFlipX()?i.leftLow:i.leftUp,s=i.width,a=i.height,l=i.rotation;this.mask.visible(1002,n,s,a,l,0,r,null,this.highLightType)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0)}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}hidden(){var e;(e=this.mask)==null||e.hidden();for(let r of this.main)r.hidden()}show(){var e;(e=this.mask)==null||e.show();for(let r of this.main)r.show()}remove(){this.maskVisible(!1);for(let e of this.main)e.remove();this.main.length=0}};var bY=class extends Xo{constructor(){super(...arguments);this.shape=new Array(0);this.text=new cT}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get start(){var e;return(e=this._viewDataModel)==null?void 0:e.start}get end(){var e;return(e=this._viewDataModel)==null?void 0:e.end}get left(){var e;return(e=this._viewDataModel)==null?void 0:e.left}get right(){var e;return(e=this._viewDataModel)==null?void 0:e.right}get strokeWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.strokeWidth}get textPath(){var e;return(e=this._viewDataModel)==null?void 0:e.textPath}get textMatrix(){var e;return(e=this._viewDataModel)==null?void 0:e.textMatrix}get width(){var e;return(e=this._viewDataModel)==null?void 0:e.viewWidth}get height(){var e;return(e=this._viewDataModel)==null?void 0:e.viewHeight}get lineLen(){var e;return(e=this._viewDataModel)==null?void 0:e.lineLen}get arrLineLen(){var e;return(e=this._viewDataModel)==null?void 0:e.arrLineLen}get dimensionIsSelect(){var e;return(e=this._viewDataModel)==null?void 0:e.dimensionIsSelect}get viewHeight(){var e;return(e=this._viewDataModel)==null?void 0:e.viewHeight}get viewWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.viewWidth}get leftCenter(){var e;return(e=this._viewDataModel)==null?void 0:e.leftCenter}get leftRadius(){var e;return(e=this._viewDataModel)==null?void 0:e.leftRadius}get rightCenter(){var e;return(e=this._viewDataModel)==null?void 0:e.rightCenter}get rightRadius(){var e;return(e=this._viewDataModel)==null?void 0:e.rightRadius}get outlineModified(){var e;return(e=this._viewDataModel)==null?void 0:e.outlineModified}shapeVisible(e,r){let i=this.highlightColor||ee.RED,n=this.dimensionIsSelect?i:ee.BLACK;if(!(e.length==0||this.layerModified||this.shapeModified||this.viewGroupIdModified||!n.equals(this._lastColor))){e.forEach(c=>{c.forceVisibleHighLight(this.manualHighLight)});return}this._lastColor=n;let a=this.strokeWidth,l=kS(this.start,this.end,this.left,this.right,this.text.width,this.lineLen,this.arrLineLen);if(e.length==0){let c=this.resetHighLightState;for(let h of l){let u=new Nd(r,c);u.visible(r,h.start(),h.end(),a,n,this.viewGroupId,void 0),e.push(u)}}else{let c=0,h=-1,u=this.resetHighLightState;for(let p of l){let m=e[c];m==null&&(m=new Nd(r,u),e.push(m),h==-1&&(h=c)),m.visible(r,p.start(),p.end(),a,n,this.viewGroupId,void 0),c++}h!=-1&&this.maskVisible(!1,!0,this.shape.slice(0,h));let d=e.splice(c,e.length-c);for(let p of d)p.remove()}e.forEach(c=>{c.forceVisibleHighLight(this.manualHighLight)})}textVisible(e){let{layerId:r,strokeWidth:i,textPath:n,textMatrix:s,dimensionIsSelect:a=!1,highlightColor:l,viewHeight:c,viewWidth:h}=this,u=this._viewDataModel.box;Oo.getInstance().textConfig.setCustomColor(this._viewDataModel.globalIndex,a?l:null),this.text.modify({partition:this._viewDataModel.partition,globalIndex:this._viewDataModel.globalIndex,layerId:r,box:u,strokeWidth:i,path:n,matrix:s,width:h,height:c,highLightType:this.highLightType,highlightColor:l,layerModified:this.layerModified,outlineModified:this.outlineModified,shapeModified:this.shapeModified,manualHighLight:this.manualHighLight,manualHighLightModified:this.manualHighLightModified},e)}smartVisible(){let{layerId:e,leftCenter:r,leftRadius:i,rightCenter:n,rightRadius:s}=this;if(this._dimensionType=="smartDimension"){this._leftSpot||(this._leftSpot=new ya(e)),this._rightSpot||(this._rightSpot=new ya(e));let a=ee.build(.7,.7,0,.7);this._leftSpot.visible(e,r,i,a,this.viewGroupId),this._rightSpot.visible(e,n,s,a,this.viewGroupId)}else this._leftSpot&&(this._leftSpot.remove(),delete this._leftSpot),this._rightSpot&&(this._rightSpot.remove(),delete this._rightSpot);this._leftSpot&&this._leftSpot.forceVisibleHighLight(this.manualHighLight),this._rightSpot&&this._rightSpot.forceVisibleHighLight(this.manualHighLight)}mainVisible(e){this.layerModified&&this.mainRemove(),this.textVisible(e),this.shapeVisible(this.shape,this.layerId),this.smartVisible()}maskVisible(e,r=!1,i){if(this.isWebglEnv()){if(!e){this._mask&&(this._mask.forEach(s=>s.remove()),delete this._mask);return}this._mask||(this._mask=[]),this.shapeVisible(this._mask,1002);return}let n=this.highlightColor;this.mainsMaskHighLightColor(i||this.shape,r,e?this.highLightType:null,n)}visible(){this.maskVisible(!1),this.mainVisible("Only Main")}highlight(){this.mainVisible("Main And Highlight"),this.maskVisible(!0,this.forceUpdateMask)}modify(e,r){super.modify(e,r);let{Type:i}=e;switch(this._dimensionType=i,r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){this.maskVisible(!1,!0);for(let e of this.shape)e.remove();this.shape.length=0}remove(){this.mainRemove(),this.text.remove(),this.removeLeftSpot(),this.removeRightSpot()}removeLeftSpot(){this._leftSpot&&(this._leftSpot.remove(),delete this._leftSpot)}removeRightSpot(){this._rightSpot&&(this._rightSpot.remove(),delete this._rightSpot)}};var PY=class extends Xo{constructor(){super(...arguments);this.shape=null}get strokeWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.strokeWidth}get path(){var e;return(e=this._viewDataModel)==null?void 0:e.path}get matrix(){var e;return(e=this._viewDataModel)==null?void 0:e.matrix}get width(){var e;return(e=this._viewDataModel)==null?void 0:e.width}get height(){var e;return(e=this._viewDataModel)==null?void 0:e.height}get color(){return this._viewDataModel.partition==x.getInstance().partitionId?ee.BLACK:UIe}get outlineModified(){var e;return(e=this._viewDataModel)==null?void 0:e.outlineModified}get layer(){return bn.getInstance().getLayer(this.layerId).layer}get plane(){return this.layer.plane}mainVisible(){let e=this.shapeModified;this.shape||(this.shape&&this.shape.remove(),this.shape=new NS(this.layerId),this.shape.visible(this.layerId,this.path,this.color,this.viewGroupId),e=!0),e&&this.shape.setMatrix(this.matrix),this.manualHighLightModified&&this.shape.ids.length&&this.shape.forceVisibleHighLight(this.manualHighLight)}maskVisible(e){if(!e){this._mask&&(this._mask.remove(),delete this._mask);return}this._mask||(this._mask=new Z0(1002));let r=this.highlightColor||ee.BLACK,i=this._viewDataModel.box,n=i.isFlipX()?i.leftLow:i.leftUp,s=i.rotation,a=i.width,l=i.height;this._mask.visible(1002,n,a,l,s,0,r,this.viewGroupId,this.highLightType),this._lastColor=this.color}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0)}modify(e,r){let i=this.layerId;super.modify(e,r);let{layerId:n}=e;switch(this.shape&&(i!=n||this.outlineModified||!this.color.equals(this._lastColor))&&(this.maskVisible(!1),this.shape.remove(),this.shape=null),this.layerId=n,r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.maskVisible(!1),this.shape&&this.shape.remove(),this.shape=null}};var TY=class extends Xo{constructor(){super(...arguments);this.shape=null}get path(){var e;return(e=this._viewDataModel)==null?void 0:e.path}get matrix(){var e;return(e=this._viewDataModel)==null?void 0:e.matrix}get leftLow(){var e;return(e=this._viewDataModel)==null?void 0:e.leftLow}get leftUp(){var e;return(e=this._viewDataModel)==null?void 0:e.leftUp}get rightUp(){var e;return(e=this._viewDataModel)==null?void 0:e.rightUp}get rightLow(){var e;return(e=this._viewDataModel)==null?void 0:e.rightLow}get templateModified(){var e;return(e=this._viewDataModel)==null?void 0:e.templateModified}get layer(){return bn.getInstance().getLayer(this.layerId).layer}get plane(){return this.layer.plane}get lineColor(){var e;return((e=this._viewDataModel)==null?void 0:e.lineColor)||ee.BLACK}mainVisible(){this.layerId||(this.layerId=this._viewDataModel.layerId);let e=this.shapeModified;this.shape&&(this.layerModified||this.templateModified)&&(this.maskVisible(!1),this.shape.remove(),this.shape=null,this.layerId=this._viewDataModel.layerId,e=!0),this.shape||(this.shape=new NS(this.layerId),this.shape.visible(this.layerId,this.path,this.lineColor,this.viewGroupId),e=!0),this.manualHighLightModified&&this.shape&&this.shape.forceVisibleHighLight(this.manualHighLight),e&&this.shape.setMatrix(this.matrix)}maskVisible(e){if(!e){this._mask&&(this._mask.remove(),delete this._mask);return}this._mask||(this._mask=new Z0(1002));let r=this.highlightColor||ee.BLACK,i=this._viewDataModel.box,n=i.isFlipX()?i.leftLow:i.leftUp,s=i.width,a=i.height,l=i.rotation;this._mask.visible(1002,n,s,a,l,0,r,this.viewGroupId,this.highLightType)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0)}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.maskVisible(!1),this.shape.remove(),this.shape=null}};var IY=class extends NI{constructor(){super(),jo("view/pcb/LineView")}get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get start(){var t;return(t=this._viewDataModel)==null?void 0:t.start}get end(){var t;return(t=this._viewDataModel)==null?void 0:t.end}get width(){var t;return(t=this._viewDataModel)==null?void 0:t.width}get color(){var t;return(t=this._viewDataModel)==null?void 0:t.color}lineTypeChanged(t){return t=="lineSegment"?this.main&&this.main instanceof Ws:this.main&&this.main instanceof Yc}shapeVisible(t,e,r){t&&(t instanceof Yc?t.visible(e,this.start,this.end,this.lineSolid,3,2,r,this.viewGroupId):t.visible(e,this.start,this.end,this.width,r,this.viewGroupId,void 0))}mainVisible(){let t=this.layerId,e=!1;this.main&&this.layerModified&&(this.mainRemove(),e=!0);let r=this.lineType(this.width);if(!this.main||this.lineTypeChanged(r)){this.mainRemove();let n=this.resetHighLightState;r=="line"?this.main=new Nd(t,n):this.main=new Ix(t,n),e=!0}let i=this.lineColor;e||(e=this.shapeModified||this.viewGroupIdModified||!i.equals(this._lastColor)),e&&(this.shapeVisible(this.main,this.layerId,i),this._lastColor=i),this.main.forceVisibleHighLight(this.manualHighLight)}maskVisible(t,e=!1){if(!this.main)return;let r=this.highlightColor||ee.BLACK;if(this.isWebglEnv()){if(!t){this._mask&&(this._mask.remove(),delete this._mask);return}let i=this.lineType(this.width);(!this._mask||this._mask&&i=="lineSegment"&&this._mask instanceof Ws)&&(this._mask&&this._mask.remove(),i=="line"?this._mask=new Ws(1002):this._mask=new Yc(1002)),this.shapeVisible(this._mask,1002,r);return}this.mainMaskHighLightColor(this.main,e,t?this.highLightType:null,r)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask)}modify(t,e){if(super.modify(t,e),this.start.equals(this.end)){this.remove();return}switch(e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){var t;this.maskVisible(!1,!0),(t=this.main)==null||t.remove()}remove(){this.mainRemove()}};var LB=class{constructor(t){this.lastHighLightColor=ee.BLACK;this._parentView=t}get width(){return this._viewDataModel.holeRadius*2}get height(){return this._viewDataModel.holeLength}get type(){return this._viewDataModel.holeShape}get holeShape(){var t;return(t=this._viewDataModel)==null?void 0:t.holeShape}get holeLength(){var t;return(t=this._viewDataModel)==null?void 0:t.holeLength}get holeRadius(){var t;return(t=this._viewDataModel)==null?void 0:t.holeRadius}get holeRotation(){var t;return(t=this._viewDataModel)==null?void 0:t.holeRotation}get holeOffset(){var t;return(t=this._viewDataModel)==null?void 0:t.holeOffset}get viewGroupId(){var t;return(t=this._parentView)==null?void 0:t.viewGroupId}get viewGroupIdModified(){var t;return(t=this._parentView)==null?void 0:t.viewGroupIdModified}get manualHighLightModified(){return this._parentView.manualHighLightModified}get manualHighLight(){return this._parentView.manualHighLight}get forceUpdateMask(){return this._parentView.forceUpdateMask}get highLightType(){var t;return(t=this._parentView)==null?void 0:t.highLightType}get holeModified(){var t;return(t=this._parentView)==null?void 0:t.holeModified}isWebglEnv(){return Ya.useWebgl}get shapeModified(){return this._parentView.holeModified||this._parentView.shapeModified}shapeVisible(t,e,r,i=!1){let n=this.width/2,s=Ae.rotateZ(this.holeRotation).translate1(this.holeOffset.x,this.holeOffset.y,0).rotateZ(this._parentView.rotation).translate1(this._parentView.center.x,this._parentView.center.y,0),a=S.ORIGIN.multiply4(s),l=this.shapeModified||i&&!this.shape,c=!i||l||this.holeModified||!r.equals(this._lastColor)||this._parentView.viewGroupIdModified;if(this.type=="ROUND"){let h=new ya(e);if(t instanceof ya?h=t:t&&(t.remove(),c=!0),c)return h.visible(e,a,n,r,this._parentView.viewGroupId),i&&(this._lastColor=r),h}else if(this.type=="RECT"){let h=new Z0(e);if(t instanceof Z0?h=t:t&&(t.remove(),c=!0),c){let u=new S(-n,this.width/2).multiply4(s),d=new S(-n,0).multiply4(s),m=new S(n,0).multiply4(s).angle(d);return h.visible(e,u,n*2,this.width,m,0,r,this._parentView.viewGroupId),i&&(this._lastColor=r),h}}else{let h=this.height-this.width;if(h>1e-4){let u=new S(-h/2,0).multiply4(s),d=new S(h/2,0).multiply4(s),p=new Ws(e);if(t instanceof Ws?p=t:t&&(t.remove(),c=!0),c)return p.visible(e,u,d,this.width,r,this._parentView.viewGroupId),i&&(this._lastColor=r),p}else{let u=new ya(e);if(t instanceof ya?u=t:t&&(t.remove(),c=!0),c)return u.visible(e,a,n,r,this._parentView.viewGroupId),i&&(this._lastColor=r),u}}}mainVisible(t,e){let r=this.shapeVisible(this.shape,t,e,!0);r&&(this.shape=r),this.shape&&this.shape.forceVisibleHighLight(this.manualHighLight)}maskVisible(t,e=!1){if(!this.shape)return;let r=this._parentView.highlightColor||ee.BLACK;if(this.isWebglEnv()){if(!t){this._mask&&(this._mask.remove(),delete this._mask);return}let n=this._parentView.highlightColor||ee.BLACK;this._mask=this.shapeVisible(this._mask,1002,n);return}let i=this.resetHighLightState;this.shape.setRemoveCb(i),this.mainMaskHighLightColor(this.shape,e,t?this.highLightType:null,r)}componentMaskVisible(t,e){t&&e?this._maskByComponent=this.shapeVisible(this._maskByComponent,1002,ee.BLACK):this._maskByComponent&&(this._maskByComponent.remove(),delete this._maskByComponent)}visible(t,e,r){this.maskVisible(!1),this.mainVisible(t,e),this.componentMaskVisible(!0,r)}highlight(t,e,r){this.mainVisible(t,e),this.maskVisible(!0,this.forceUpdateMask),this.componentMaskVisible(!0,r)}modify(t,e,r,i,n){switch(this._viewDataModel=t,this.holeModified&&this.shape&&this.mainRemove(),e){case"Only Main":{this.visible(r,i,n);break}case"Main And Highlight":{this.highlight(r,i,n);break}default:break}}mainRemove(){var t;this.maskVisible(!1,!0),(t=this.shape)==null||t.remove(),delete this.shape}remove(){this.mainRemove(),this.componentMaskVisible(!1,!1)}resetHighLightState(){this.lastHighLightType=null}mainMaskHighLightColor(t,e,r,i){!t||!e&&this.lastHighLightType==r||(this.lastHighLightType!=null&&t.highlight(!1,this.lastHighLightType,this.lastHighLightColor),r!=null&&t.highlight(!0,r,i),this.lastHighLightType=r,this.lastHighLightColor=i)}};function G2(o){return o==1||o==3||o==5||o==7||o==9||o==58}function ms(o){return o==2||o==4||o==6||o==8||o==10||o==59}function Mg(o){return o==2?1:o==4?3:o==6?5:o==8?7:o==10?9:o==1?2:o==3?4:o==5?6:o==7?8:o==9?10:o==58?59:o==59?58:o}function gs(o){return o==="SIGNAL"||o==="TOP"?!0:o==="BOTTOM"}function Rh(o){return o==="PLANE"}function Lte(o){return["TOP","BOTTOM","PLANE","SIGNAL"].includes(o)}function e8e(o){return o==="DRILL_DRAWING"}function Ms(o){return(o|0)===o&&o>=15&&o<=46}function mp(o){return(o|0)===o&&(o>=15&&o<=46||o==1||o==2||o==12)}function IA(o){return[49,50,51].includes(o)}function _E(o){return[48,49,50,51].includes(o)}function Cx(o){return[49,50,51,52].includes(o)}function vE(o){return[51,50].includes(o)}function ba(o){return[53,54,55].includes(o)}function Mte(o){return o==50||o==51||o==48||o==49}function gr(o){return 12==o}function U2(o){return 11==o}function Nte(o){return 14===o}function Io(o){return 1==o}function _c(o){return[58,59].includes(o)}function Sx(o){return 2==o}var Dh=class o{constructor(t){t!=null&&(this.canPanelize=t)}isWebglEnv(){return Ya.useWebgl}get originLayer(){return o._parentView.layerId}get center(){return o._parentView.center}get rotation(){return o._parentView.rotation}get color(){return o._parentView.color}get manualHighLightModified(){return o._parentView.manualHighLightModified}get manualHighLight(){return o._parentView.manualHighLight}get forceUpdateMask(){return o._parentView.forceUpdateMask}get highlightColor(){return o._parentView.highlightColor}get topSolderExpansion(){return o._parentView.topSolderExpansion}get bottomSolderExpansion(){return o._parentView.bottomSolderExpansion}get highlightByComponent(){return o._parentView.highlightByComponent}get shapeModified(){switch(this._singlePadType){case 0:return o._parentView.topModified;case 2:return o._parentView.bottom;default:return o._parentView.innerModified}}get solderModified(){switch(this._singlePadType){case 0:return this.topSolderExpansionModified;case 2:return this.bottomSolderExpansionModified;default:return!1}}get pasteExpansionModified(){return o._parentView.pasteExpansionModified}get topSolderExpansionModified(){return o._parentView.topSolderExpansionModified}get bottomSolderExpansionModified(){return o._parentView.bottomSolderExpansionModified}get isInner(){return this._singlePadType==1}get isTop(){return this._singlePadType==0}get isBot(){return this._singlePadType==2}get solderExpansion(){return this.isTop?o._parentView.topSolderExpansion:this.isInner?-1e3:o._parentView.bottomSolderExpansion}get pasteExpansion(){return this.isInner?-1e3:o._parentView.pasteExpansion}get viewGroupId(){var t;return(t=o._parentView)==null?void 0:t.viewGroupId}get wireViewGroupId(){var t;return(t=o._parentView)==null?void 0:t.wireViewGroupId}get viewGroupIdModified(){var t;return(t=o._parentView)==null?void 0:t.viewGroupIdModified}get highLightType(){var t;return(t=o._parentView)==null?void 0:t.highLightType}generate(t,e,r,i,n,s,a,l,c,h,u){switch(e){case"ELLIPSE":{let p;return t instanceof ya?p=t:(this.removeLastMaskShape(t),p=u?new AE(a,u,this.canPanelize):new ya(a,null,this.canPanelize)),p.visible(a,r,n/2,c,h),p}case"OVAL":{let p=Math.abs(n-s);if(n>s&&p>1e-4){let m=(n-s)/2,g=new S(-m,0).rotate(S.ORIGIN,i).add(r),y=new S(m,0).rotate(S.ORIGIN,i).add(r),b;return t instanceof Ws?b=t:(this.removeLastMaskShape(t),b=u?new Nd(a,u,this.canPanelize):new Ws(a,null,this.canPanelize)),b.visible(a,g,y,s,c,h),b}else if(n<s&&p>1e-4){let m=(s-n)/2,g=new S(0,-m).rotate(S.ORIGIN,i).add(r),y=new S(0,m).rotate(S.ORIGIN,i).add(r),b;return t instanceof Ws?b=t:(this.removeLastMaskShape(t),b=u?new Nd(a,u,this.canPanelize):new Ws(a,null,this.canPanelize)),b.visible(a,g,y,n,c,h),b}else{let m;return t instanceof ya?m=t:(this.removeLastMaskShape(t),m=u?new AE(a,u,this.canPanelize):new ya(a,null,this.canPanelize)),m.visible(a,r,n/2,c,h),m}}case"RECT":{let p=n/2,m;t instanceof Z0?m=t:(this.removeLastMaskShape(t),m=u?new wte(a,u,this.canPanelize):new Z0(a,null,this.canPanelize));let g=new S(-p,s/2).rotate(S.ORIGIN,i).add(r),y=Math.min(p,s/2)*l;return m.visible(a,g,n,s,i,y,c,h),m}}let d;return t instanceof ya?d=t:(this.removeLastMaskShape(t),d=u?new AE(a,u,this.canPanelize):new ya(a,null,this.canPanelize)),d.visible(a,r,n/2,c,h),d}getMaxExpansion(){return Math.max(0,this.solderExpansion,gr(this.originLayer)?0:this.pasteExpansion)}getExpansionRatio(t,e,r,i){let n=Math.min(e,r)/2,s=n*t+i;return Math.max(0,s/(n+i))}mainVisible(t,e,r){var E;let{type:i,width:n,height:s,ratio:a}=r,l=this.color,c=ee.of6(ee.BLACK,l.alpha),h=l.alpha!=((E=this._lastPadColor)==null?void 0:E.alpha),u=!this._pad||this.shapeModified||this.viewGroupIdModified,d=this.viewGroupId,p=this.wireViewGroupId,m=this.isTop?5:6,g=this.isTop?7:8,y=this.originLayer;(u||!l.equals(this._lastPadColor))&&(this._pad=this.generate(this._pad,i,t,e,n,s,this._singlePadLayerId,a,l,p),this._lastPadColor=l),this._pad.forceVisibleHighLight(this.manualHighLight);let P=this.solderExpansion;if(this._singlePadType!=1&&(u||h||!this._solder||this.solderModified)){let O=n+P*2,_=s+P*2;O>0&&_>0?this._solder=this.generate(this._solder,i,t,e,O,_,m,this.getExpansionRatio(a,n,s,P),c,p):this.removeSolder()}this._solder&&this._solder.forceVisibleHighLight(this.manualHighLight);let I=this.pasteExpansion;if(this._singlePadType!=1&&(u||h||!this._paste||this.pasteExpansionModified)){let O=n+I*2,_=s+I*2;O>0&&_>0&&!gr(y)?this._paste=this.generate(this._paste,i,t,e,O,_,g,this.getExpansionRatio(a,n,s,I),c,p):this.removePaste()}this._paste&&this._paste.forceVisibleHighLight(this.manualHighLight)}removeLastMaskShape(t){t&&t.remove()}createMask(t,e,r,i){let{type:n,width:s,height:a,ratio:l}=i,c=Math.max(0,this.solderExpansion,gr(this.originLayer)?0:this.pasteExpansion),h=s+c*2,u=a+c*2,d=ee.BLACK;return this.generate(t,n,e,r,h,u,1002,this.getExpansionRatio(l,s,a,c),d,null)}visible(t){let{center:e,rotation:r}=this;this.mainVisible(e,r,t)}modify(t,e,r,i,n){o._parentView=t;let s=this._singlePadLayerId;this._singlePadLayerId=i,Object.is(n,void 0)&&(n=i==1?0:i==2?2:1),this._singlePadType=n,i!=s&&this.mainRemove(),this.visible(e)}hidden(){var t,e,r,i;(t=this._pad)==null||t.hidden(),(e=this._mask)==null||e.hidden(),(r=this._solder)==null||r.hidden(),(i=this._paste)==null||i.hidden()}show(){var t,e,r,i;(t=this._pad)==null||t.show(),(e=this._mask)==null||e.show(),(r=this._solder)==null||r.show(),(i=this._paste)==null||i.show()}removePad(){this._pad&&(this.removeLastMaskShape(this._pad),delete this._pad)}removeSolder(){this._solder&&(this.removeLastMaskShape(this._solder),delete this._solder)}removePaste(){this._paste&&(this.removeLastMaskShape(this._paste),delete this._paste)}mainRemove(){this.removePad(),this.removeSolder(),this.removePaste()}remove(){this.mainRemove()}};function r8e(o){return o=(o+Math.PI)%Vr-Math.PI,o<=-es?o+=Math.PI:o>=es&&(o-=Math.PI),o}var MB=class extends Dh{constructor(){super(...arguments);this.lastHighLightColor=ee.BLACK}isWebglEnv(){return Ya.useWebgl}get originLayer(){return Dh._parentView.layerId}get center(){return Dh._parentView.center}get rotation(){return Dh._parentView.rotation}get color(){return Dh._parentView.color}get manualHighLightModified(){return Dh._parentView.manualHighLightModified}get manualHighLight(){return Dh._parentView.manualHighLight}get forceUpdateMask(){return Dh._parentView.forceUpdateMask}get highlightColor(){return Dh._parentView.highlightColor}get highlightMaskColor(){return Dh._parentView.highlightMaskColor}get topSolderExpansion(){return Dh._parentView.topSolderExpansion}get bottomSolderExpansion(){return Dh._parentView.bottomSolderExpansion}get highlightByComponent(){return Dh._parentView.highlightByComponent}get shapeModified(){switch(this._singlePadType){case 0:return Dh._parentView.topModified;case 2:return Dh._parentView.bottom;default:return Dh._parentView.innerModified}}get solderModified(){switch(this._singlePadType){case 0:return this.topSolderExpansionModified;case 2:return this.bottomSolderExpansionModified;default:return!1}}get pasteExpansionModified(){return Dh._parentView.pasteExpansionModified}get topSolderExpansionModified(){return Dh._parentView.topSolderExpansionModified}get bottomSolderExpansionModified(){return Dh._parentView.bottomSolderExpansionModified}get isInner(){return this._singlePadType==1}get isTop(){return this._singlePadType==0}get isBot(){return this._singlePadType==2}get solderExpansion(){return this.isTop?Dh._parentView.topSolderExpansion:this.isInner?-1e3:Dh._parentView.bottomSolderExpansion}get pasteExpansion(){return this.isInner?-1e3:Dh._parentView.pasteExpansion}get viewGroupId(){var e;return(e=Dh._parentView)==null?void 0:e.viewGroupId}get wireViewGroupId(){var e;return(e=Dh._parentView)==null?void 0:e.wireViewGroupId}get viewGroupIdModified(){var e;return(e=Dh._parentView)==null?void 0:e.viewGroupIdModified}get highLightType(){var e;return(e=Dh._parentView)==null?void 0:e.highLightType}getMaxExpansion(){return Math.max(0,this.solderExpansion,gr(this.originLayer)?0:this.pasteExpansion)}getExpansionRatio(e,r,i,n){let s=Math.min(r,i)/2,a=s*e+n;return Math.max(0,a/(s+n))}mainVisible(e,r,i){var O;let{type:n,width:s,height:a,ratio:l}=i,c=this.color,h=ee.of6(ee.BLACK,c.alpha),u=c.alpha!=((O=this._lastPadColor)==null?void 0:O.alpha),d=!this._pad||this.shapeModified||this.viewGroupIdModified,p=this.viewGroupId,m=this.wireViewGroupId,g=this.isTop?5:6,y=this.isTop?7:8,b=this.originLayer,P=d||!c.equals(this._lastPadColor);P&&(this._pad=this.generate(this._pad,n,e,r,s,a,this._singlePadLayerId,l,c,m),this._lastPadColor=c),this._pad.forceVisibleHighLight(this.manualHighLight);let T=this.solderExpansion,I=this._singlePadType!=1&&(d||u||!this._solder||this.solderModified);if(I){let _=s+T*2,R=a+T*2;_>0&&R>0?this._solder=this.generate(this._solder,n,e,r,_,R,g,this.getExpansionRatio(l,s,a,T),h,m):this.removeSolder()}this._solder&&this._solder.forceVisibleHighLight(this.manualHighLight);let C=this.pasteExpansion,E=this._singlePadType!=1&&(d||u||!this._paste||this.pasteExpansionModified);if(E){let _=s+C*2,R=a+C*2;_>0&&R>0&&!gr(b)?this._paste=this.generate(this._paste,n,e,r,_,R,y,this.getExpansionRatio(l,s,a,C),h,m):this.removePaste()}if(this._paste&&this._paste.forceVisibleHighLight(this.manualHighLight),!this.maskShape||P||I||E){let _=this.getMaxExpansion(),R=_*2,v=s+R,D=a+R;this.maskVisible(i,!1,e,r,!0);let w=this.resetHighLightState;this.maskShape=this.generate(this.maskShape,n,e,r,v,D,1002,this.getExpansionRatio(l,s,a,_),ee.of6(ee.BLACK,1e-6),p,w)}}resetHighLightState(){this.lastHighLightType=null}maskVisible(e,r,i,n,s=!1){if(!this.maskShape)return;if(this.isWebglEnv()){r?this._mask=this.createMask(this._mask,i,n,e):this._mask&&(this._mask.remove(),delete this._mask);return}let a=this.highlightColor;this.mainMaskHighLightColor(this.maskShape,s,r?this.highLightType:null,a)}removeLastMaskShape(e){e&&e.remove()}componentMaskVisible(e,r,i,n){e&&this.highlightByComponent?this._maskByComponent=this.createMask(this._maskByComponent,r,i,n):this._maskByComponent&&(this._maskByComponent.remove(),delete this._maskByComponent)}createMask(e,r,i,n){let{type:s,width:a,height:l,ratio:c}=n,h=Math.max(0,this.solderExpansion,gr(this.originLayer)?0:this.pasteExpansion),u=a+h*2,d=l+h*2,p=this.highlightMaskColor||ee.BLACK;return this.generate(e,s,r,i,u,d,1002,this.getExpansionRatio(c,a,l,h),p,null)}visible(e){let{center:r,rotation:i}=this;this.maskVisible(e,!1,r,i),this.mainVisible(r,i,e),this.componentMaskVisible(!0,r,i,e)}highlight(e){let{center:r,rotation:i}=this;this.mainVisible(r,i,e),this.maskVisible(e,!0,r,i,this.forceUpdateMask),this.componentMaskVisible(!0,r,i,e)}modify(e,r,i,n,s){Dh._parentView=e;let a=this._singlePadLayerId;this._singlePadLayerId=n,Object.is(s,void 0)&&(s=n==1?0:n==2?2:1),this._singlePadType=s,n!=a&&this.mainRemove(),i=="Main And Highlight"?this.highlight(r):this.visible(r)}hidden(){var e,r,i,n,s,a;(e=this._pad)==null||e.hidden(),(r=this._mask)==null||r.hidden(),(i=this._solder)==null||i.hidden(),(n=this._paste)==null||n.hidden(),(s=this._maskByComponent)==null||s.hidden(),(a=this.maskShape)==null||a.hidden()}show(){var e,r,i,n,s,a;(e=this._pad)==null||e.show(),(r=this._mask)==null||r.show(),(i=this._solder)==null||i.show(),(n=this._paste)==null||n.show(),(s=this._maskByComponent)==null||s.show(),(a=this.maskShape)==null||a.show()}removePad(){this._pad&&(this.removeLastMaskShape(this._pad),delete this._pad)}removeSolder(){this._solder&&(this.removeLastMaskShape(this._solder),delete this._solder)}removePaste(){this._paste&&(this.removeLastMaskShape(this._paste),delete this._paste)}removeMaskShape(){this.maskShape&&(this.maskShape.remove(),delete this.maskShape)}mainRemove(){this.maskVisible(null,!1,null,null,!0),this.removePad(),this.removeSolder(),this.removePaste(),this.removeMaskShape()}remove(){this.mainRemove(),this.componentMaskVisible(!1,null,null,null),this.removeMaskShape()}mainMaskHighLightColor(e,r,i,n){!e||!r&&this.lastHighLightType==i||(this.lastHighLightType!=null&&e.highlight(!1,this.lastHighLightType,this.lastHighLightColor),i!=null&&e.highlight(!0,i,n),this.lastHighLightType=i,this.lastHighLightColor=n)}};var CY=class o extends Xo{constructor(){super(),jo("view/pcb/PadView")}get highLightType(){var t;return(t=o._viewDataModel)==null?void 0:t.highLightType}get manualHighLight(){var t;return(t=o._viewDataModel)==null?void 0:t.manualHighLight}get manualHighLightModified(){var t;return(t=o._viewDataModel)==null?void 0:t.manualHighLightModified}get layerModified(){var t;return(t=o._viewDataModel)==null?void 0:t.layerModified}get shapeModified(){var t;return(t=o._viewDataModel)==null?void 0:t.shapeModified}get highlightMaskColor(){var t;return(t=o._viewDataModel)==null?void 0:t.highlightMaskColor}get netModified(){var t;return(t=o._viewDataModel)==null?void 0:t.netModified}get highlightColor(){var t;return(t=o._viewDataModel)==null?void 0:t.highlightColor}get wireViewGroupId(){var t;return this.getEngineGroupId((t=o._viewDataModel)==null?void 0:t.wireViewGroupId)}get viewGroupIdModified(){var t;return(t=o._viewDataModel)==null?void 0:t.viewGroupIdModified}get forceUpdateMask(){var t;return(t=o._viewDataModel)==null?void 0:t.forceUpdateMask}get layerId(){var t;return(t=o._viewDataModel)==null?void 0:t.layerId}get type(){var t;return(t=o._viewDataModel)==null?void 0:t.type}get center(){var t;return(t=o._viewDataModel)==null?void 0:t.center}get rotation(){var t;return(t=o._viewDataModel)==null?void 0:t.rotation}get pasteExpansion(){var t;return(t=o._viewDataModel)==null?void 0:t.pasteExpansion}get topSolderExpansion(){var t;return(t=o._viewDataModel)==null?void 0:t.topSolderExpansion}get bottomSolderExpansion(){var t;return(t=o._viewDataModel)==null?void 0:t.bottomSolderExpansion}get hole(){var t;return(t=o._viewDataModel)==null?void 0:t.hole}get color(){return o._viewDataModel.partition==x.getInstance().partitionId?Oo.getInstance().padConfig.getColor(o._viewDataModel.globalIndex,o._viewDataModel.net,o._viewDataModel.selectItem,o._viewDataModel.layerId==12):Oo.getInstance().readonlyPadConfig.getColor(o._viewDataModel.globalIndex,o._viewDataModel.net)}get highlightByComponent(){var t;return(t=o._viewDataModel)==null?void 0:t.highlightByComponent}get usedLayers(){var t;return(t=o._viewDataModel)==null?void 0:t.usedLayers}get holeColor(){var t;return(t=o._viewDataModel)==null?void 0:t.holeColor}get pasteExpansionModified(){var t;return(t=o._viewDataModel)==null?void 0:t.pasteExpansionModified}get topSolderExpansionModified(){var t;return(t=o._viewDataModel)==null?void 0:t.topSolderExpansionModified}get bottomSolderExpansionModified(){var t;return(t=o._viewDataModel)==null?void 0:t.bottomSolderExpansionModified}get numModified(){var t;return(t=o._viewDataModel)==null?void 0:t.numModified}get topModified(){var t;return((t=o._viewDataModel)==null?void 0:t.topModified)||o._viewDataModel.shapeModified||o._viewDataModel.topSolderExpansionModified||o._viewDataModel.pasteExpansionModified}get bottomModified(){var t;return((t=o._viewDataModel)==null?void 0:t.bottomModified)||o._viewDataModel.shapeModified||o._viewDataModel.bottomSolderExpansionModified||o._viewDataModel.pasteExpansionModified}get innerModified(){var t;return((t=o._viewDataModel)==null?void 0:t.innerModified)||o._viewDataModel.shapeModified}get holeModified(){var t;return(t=o._viewDataModel)==null?void 0:t.holeModified}get net(){var t;return(t=o._viewDataModel)==null?void 0:t.showNet}get num(){var t;return(t=o._viewDataModel)==null?void 0:t.num}get top(){var t;return(t=o._viewDataModel)==null?void 0:t.top}get bottom(){var t;return(t=o._viewDataModel)==null?void 0:t.bottom}get inner(){var t;return(t=o._viewDataModel)==null?void 0:t.inner}get padShowNet(){return ga.getInstance().padShowNet}get showNum(){return ga.getInstance().padShowNum}modifyInnerViews(t,e,r){let i=e?r.filter(n=>![1,2].includes(n)):[this.layerId];this.innerViews||(this.innerViews=[]);for(let n=0;n<Math.max(this.innerViews.length,i.length);n++){if(!i[n]){this.innerViews[n].remove();continue}this.innerViews[n]=this.generate(this.innerViews[n],this.inner,i[n],1,t)}i.length>0?this.innerViews.length=i.length:delete this.innerViews}getFontPosition(t,e){return this.padShowNet||(t=""),this.showNum||(e=""),t!=""&&e!=""?1:t!=""&&e==""?2:t==""&&e!=""?2:3}getFontHigh(){var t,e;return this.layerId==2?(t=this.bottom)==null?void 0:t.height:(e=this.top)==null?void 0:e.height}getFontWidth(){var t,e;return this.layerId==2?(t=this.bottom)==null?void 0:t.width:(e=this.top)==null?void 0:e.width}isCircle(){return this.layerId==2?this.bottom.type=="ELLIPSE":this.top.type=="ELLIPSE"}getNetLayerId(){return this.layerId==12?47:this.layerId}createNetAndNumberView(){if(!this.shapeModified&&!this.netModified&&!this.numModified&&!this.layerModified){let{net:y,num:b}=this,P=this.padShowNet&&y,T=this.showNum&&b;if(P&&T){if(this.netView!=null&&this.numView!=null){this.manualHighLightModified&&(this.netView.forceVisibleHighLight(this.manualHighLight),this.numView.forceVisibleHighLight(this.manualHighLight));return}}else if(P&&!T){if(this.netView!=null&&this.numView==null){this.manualHighLightModified&&this.netView.forceVisibleHighLight(this.manualHighLight);return}}else if(!P&&T){if(this.netView==null&&this.numView!=null){this.manualHighLightModified&&this.numView.forceVisibleHighLight(this.manualHighLight);return}}else if(this.netView==null&&this.numView==null)return}let{net:t,num:e,wireViewGroupId:r}=this,i=this.getNetLayerId();if(this.padShowNet&&t?this.netView||(this.netView=new jl(i)):this.removeNetView(),this.showNum&&e?this.numView||(this.numView=new jl(i)):this.removeNumView(),!this.netView&&!this.numView)return;let{rotation:n,center:s}=this,a=this.getFontPosition(t,e),l=new S(Math.cos(n),Math.sin(n));this.isCircle()&&(l=new S(1,0));let c=new S(-l.y,l.x),h=Math.atan2(l.y,l.x);(h<-es||h>es)&&(c=new S(l.y,-l.x)),h<0&&(l=l.mul(-1));let u=s,d=s,p=this.getFontHigh(),m=this.getFontWidth();if(a==1)if(m>=p){let y=c.mul(p*.25);u=s.sub(y),d=s.add(y),p*=.5}else{let y=l.mul(m*.25);u=s.sub(y),d=this.center.add(y),m*=.5}let g=n;m==p||this.isCircle()?g=0:(m<p&&(g+=es),g=r8e(g)),this.netView&&(m>=p?this.netView.visible(i,t,u,g,Wc,zc,m,p,void 0,r):this.netView.visible(i,t,u,g,Wc,zc,p,m,void 0,r)),this.numView&&(m>=p?this.numView.visible(i,e,d,g,Wc,zc,m,p,void 0,r):this.numView.visible(i,e,d,g,Wc,zc,p,m,void 0,r)),this.netView&&this.netView.forceVisibleHighLight(this.manualHighLight),this.numView&&this.numView.forceVisibleHighLight(this.manualHighLight)}generate(t,e,r,i,n){let s=this.layerId,a=!1;return s==1||s==12?a=r==1||i==0:s==2&&(a=r==2||i==2),t?a&&!(t instanceof MB)&&(t.remove(),t=new MB):a?t=new MB:t=new Dh,t.modify(this,e,n,r,i),t}visible(t){this.refreshShapeViews(t)}highlight(t){this.refreshShapeViews(t)}refreshShapeViews(t,e){e!=null&&(this.grayIndex=e);let r=this.usedLayers,i=r.length>0||this.type==2||this.grayIndex!=0;this.top?this.topView=this.generate(this.topView,this.top,i?1:this.layerId,0,t):this.removeTopView(),this.inner?this.modifyInnerViews(t,i,r):this.removeInnerViews(),this.bottom?this.bottomView=this.generate(this.bottomView,this.bottom,i?2:this.layerId,2,t):this.removeBottomView(),this.hole!=null?(this.holeView||(this.holeView=new LB(this)),this.holeView.modify(this.hole,t,47,this.holeColor,this.highlightByComponent)):this.removeHoleView()}modify(t,e){switch(o._viewDataModel=t,this.grayIndex=t.grayIndex,this.createNetAndNumberView(),e){case"Only Main":{this.visible(e);break}case"Main And Highlight":{this.highlight(e);break}default:break}}remove(){this.removeTopView(),this.removeInnerViews(),this.removeBottomView(),this.removeHoleView(),this.removeNetView(),this.removeNumView()}removeTopView(){this.topView&&(this.topView.remove(),delete this.topView)}removeInnerViews(){this.innerViews&&(this.innerViews.forEach(t=>t.remove()),delete this.innerViews)}removeBottomView(){this.bottomView&&(this.bottomView.remove(),delete this.bottomView)}removeHoleView(){this.holeView&&(this.holeView.remove(),delete this.holeView)}removeNetView(){this.netView&&(this.netView.remove(),delete this.netView)}removeNumView(){this.numView&&(this.numView.remove(),delete this.numView)}};var kte=class extends Cu{visible(t,e,r,i,n,s,a=.5){if(this.layerId!=t&&this.remove(),this.layerId=t,!Sa.unRefreshScene)if(this.isValidId())this.plane.createOrUpdateTexture(this.id,r,i,n,s,void 0,void 0,a);else{let l=bn.getInstance().getLayer(t).layer.plane.scene.getTexture(e);this.id=this.plane.createOrUpdateTexture(-1,r,i,n,s,l,[],a)}}remove(){this.isValidId()&&(this._removeCb&&(this._removeCb(),this.plane.removeHighLightPt(this.id),this.lastHighLightForce=null),this.plane.removeTexture(this.id)),this.resetId()}};var SY=class extends Xo{constructor(){super(...arguments);this._lastAlpha=0}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get source(){var e;return(e=this._viewDataModel)==null?void 0:e.source}get leftDown(){var e;return(e=this._viewDataModel)==null?void 0:e.leftDown}get leftUp(){var e;return(e=this._viewDataModel)==null?void 0:e.leftUp}get rightDown(){var e;return(e=this._viewDataModel)==null?void 0:e.rightDown}get rightUp(){var e;return(e=this._viewDataModel)==null?void 0:e.rightUp}get alpha(){var e;return(e=this._viewDataModel)==null?void 0:e.alpha}get hashIdModified(){var e;return(e=this._viewDataModel)==null?void 0:e.hashIdModified}mainVisible(){var i;let e=!1;(this.layerModified||this.hashIdModified)&&(this.maskVisible(!1),(i=this.main)==null||i.remove(),e=!0),this.main||(this.main=new kte(this.layerId),e=!0);let r=this.alpha;e||(e=this.layerModified||this.shapeModified||this.hashIdModified||this._lastAlpha!=r),this._lastAlpha=r,e&&this.main.visible(this.layerId,this.source,this.leftDown,this.leftUp,this.rightDown,this.rightUp,r)}maskVisible(e){if(!e){this._mask&&(this._mask.remove(),delete this._mask);return}this._mask||(this._mask=new Z0(1002));let r=this.highlightColor||ee.BLACK,i=this._viewDataModel.box,n=i.isFlipX()?i.leftLow:i.leftUp,s=i.width,a=i.height,l=i.rotation;this._mask.visible(1002,n,s,a,l,0,r,null,this.highLightType)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0)}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){var e;this.maskVisible(!1),(e=this.main)==null||e.remove()}};var c9t=/(\.?0+)$/,Td=class{static format(t,...e){return this.format1(t,e)}static format1(t,e){let r=this._format(t,e);if(typeof r=="string")return r;throw new Error(this.format("Invalid state on (%d) %s",r,t))}static _format(t,e){let r=[],i=0,n=0,s,a=0,l=0;for(let c=0;c<t.length;c++){let h=t.charAt(c),u=h.charCodeAt(0);switch(i){case 0:u===37?i=1:r.push(h);break;case 1:switch(u){case 100:if(s=e[n++],typeof s=="number")r.push(s.toFixed(0)),i=0;else return c;break;case 102:if(s=e[n++],typeof s=="number")r.push(s.toString()),i=0;else return c;break;case 120:if(s=e[n++],typeof s=="number")r.push((s|0).toString(16)),i=0;else return c;break;case 88:if(s=e[n++],typeof s=="number")r.push((s|0).toString(16).toUpperCase()),i=0;else return c;break;case 115:case 99:s=e[n++],r.push(s===null?"null":s.toString()),i=0;break;case 48:a=c+1,l=-1,i=2;break;case 37:r.push("%"),i=0;break;default:return c}break;case 2:switch(u){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:l=c;break;case 120:if(l>=a){let d=parseInt(t.substring(a,l+1));if(s=e[n++],typeof s=="number")r.push(Re.lpad((s|0).toString(16),"0",d)),i=0;else return c}else return c;break;case 88:if(l>=a){let d=parseInt(t.substring(a,l+1));if(s=e[n++],typeof s=="number")r.push(Re.lpad((s|0).toString(16).toUpperCase(),"0",d)),i=0;else return c}else return c;break;default:return c}break;default:return c}}return r.join("")}static startsWith(t,e){return t.length>=e.length?t.substring(0,e.length)===e:!1}static endsWith(t,e){return t.length>=e.length?t.substring(t.length-e.length)===e:!1}static split(t,e){let r=new Array,i=0;for(;;){let n=t.exec(e);if(n!==null){let s=t.lastIndex-n[0].length;r.push(e.substring(i,s)),i=t.lastIndex}else{let s=e.substring(i);an.nullOrEmpty(s)||r.push(s);break}}return r}static fmtNumber(t){return t.toFixed(5).replace(c9t,"")}};var an=class{static rgb(t){if(0<=t&&t<=255)return t;throw new Error(Td.format("RGB should not nagative and not over 255(0xFF): %X",t))}static normal(t){if(isFinite(t))return t;throw new Error(Td.format("%f is not permitted",t))}static positiveOr0(t){if(t>=0)return t;throw new Error(Td.format("%f must >= 0",t))}static positive(t){if(t>0)return t;throw new Error(Td.format("%f must > 0",t))}static notnull(t){if(t!=null)return t;throw new Error("invalid null value")}static mustnull(t){if(t===null)return null;throw new Error("value must be null")}static notEmpty(t){if(t==null||t.length===0)throw new Error("invalid empty string");return t}static nullOrEmpty(t){return t==null||t.length===0}static notNullOrUndef(t){if(t!=null)return t;throw new Error("null or undefined is not permitted")}};var Yu=class Yu{static isTop(t){switch(t){case 4:case 3:case 2:case 1:return!0;default:return!1}}static isBot(t){switch(t){case 7:case 8:case 9:case 10:return!0;default:return!1}}constructor(t,e){this._resetLayer(t,e)}_resetLayer(t,e){switch(this.type=t,t){case 5:case 13:case 6:this.order=an.positive(e);break;default:if(e===0)this.order=e;else throw new Error(Td.format("layer type %s order must eq 0, not %d",t,e))}this.setHash()}setHash(){this.hashed=32*(32+this.type)+this.order}hashCode(){return this.hashed}toString(){return"PcbLayer [type="+this.type+", order="+this.order+"]"}equals(t){return t instanceof Yu?this.type===t.type&&this.order===t.order:!1}};Yu.MULTI=new Yu(0,0),Yu.TOP_SILK=new Yu(1,0),Yu.TOP_SOLDER_MASK=new Yu(2,0),Yu.TOP_PASTE=new Yu(3,0),Yu.TOP_COPPER=new Yu(4,0),Yu.BOT_COPPER=new Yu(7,0),Yu.BOT_PASTE=new Yu(8,0),Yu.BOT_SOLDER_MASK=new Yu(9,0),Yu.BOT_SILK=new Yu(10,0),Yu.OUTLINE=new Yu(11,0),Yu.DOCUMENT=new Yu(12,0),Yu.RATELINE=new Yu(14,0),Yu.OTHER=new Yu(16,0);var $r=Yu;var i8e=!1,NB=class{onRTreeBBox(t){}onResultSide(t){}onOriginSide(t){}onSplitedSide(t){}onDebugSide(t){}onSweep(t,e,r,i,n,s){}onIntersect(t,e,r){}onSegment(t,e,r,i,n,s){}onSegment1(t,e,r){if(i8e){let i=new S(t.getX(r),r),n=new S(e.getX(r),r);this.onSegment(i,t.weight,t,n,e.weight,e)}else this.onSegment(t.start,t.weight,t,e.end,e.weight,e)}onSweep1(t,e,r){if(i8e){let i=new S(t.getX(r),r),n=new S(e.getX(r),r);this.onSweep(i,t.weight,t,n,e.weight,e)}else this.onSweep(t.start,t.weight,t,e.end,e.weight,e)}};var Pa=class{constructor(t,e,r){this.id=t,this.net=e,this.layer=r}};var CA=class o extends Pa{constructor(t,e,r,i,n,s){super(s||"",t,e),this.kind=r,this.outlines=i,this.__bbox=this._bbox(),this.targets=n}multiply3(t){return new o(this.net,this.layer,this.kind,this.outlines.multiply3(t),this.targets)}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outlines:null}};var Ns=class o extends Pa{constructor(t,e,r,i,n,s){super(s||"",t,e),this.start=r,this.end=i,this.width=an.normal(n),this.__bbox=this._bbox()}multiply3(t){return new o(this.net,this.layer,this.start.multiply3(t),this.end.multiply3(t),t.iScale*this.width,this.id)}reverse(){return new o(this.net,this.layer,this.end,this.start,this.width,this.id)}bbox(){return this.__bbox}_bbox(){let t=this.width/2;return new _e().ext2(this.start.add1(t,t)).ext2(this.start.add1(-t,-t)).ext2(this.end.add1(t,t)).ext2(this.end.add1(-t,-t)).build1()}shape(t,e){return this.layer.equals(t)?new M(this.start,this.end).stroke(this.width+e*2,kr.ROUND,le.CW):null}};var kB=class o extends Pa{constructor(t,e,r,i,n){super("",t,e),this.arc=r,this.width=i,this.keepout=n}multiply3(t){return new o(this.net,this.layer,this.arc.multiply3(t),t.iScale*this.width,this.keepout)}bbox(){return this.arc.bbox()}shape(t,e){return this.layer.equals(t)?this.arc.stroke(this.width+e*2,kr.ROUND,le.CW):null}};var L1=class L1{static toDegrees(t){return t*180/Math.PI}static toRadians(t){return t/180*Math.PI}static regularD(t){return t=t%360,t=t<0?360+t:t,t===360?0:t}static regular(t){return t=t%L1.PIx2,t=t<0?L1.PIx2+t:t,t===L1.PIx2?0:t}static toQuarterBase(t){return L1.regular((t+L1.PI_4)/L1.PI_2*L1.PI_2)}static toQuarterBaseD(t){return L1.regularD(((t+45)/90|0)*90)}static transformD(t,e){return L1.toDegrees(L1.transform(L1.toRadians(t),e))}static transform(t,e){let r=Math.cos(t),i=Math.sin(t),n=new S(e.data[6],e.data[7]),s=new S(r,i).multiply3(e);return L1.regular(s.angle(n))}};L1.PIx2=Math.PI*2,L1.PI_2=Math.PI/2,L1.PI_4=Math.PI/4;var Ht=L1;var BS=class o extends Pa{constructor(t,e,r,i,n,s,a){super("",t,e),this.location=r,this.rotation=an.normal(i),this.text=n,this.font=s,this.mirror=a,this.__bbox=this._bbox()}multiply3(t){return new o(this.net,this.layer,this.location.multiply3(t),Ht.transformD(this.rotation,t),this.text,this.font.transform(t),this.mirror)}bbox(){return this.__bbox}_bbox(){let t=this.font.size*this.text.length/2,e=this.rotation;this.mirror&&(e+=180);let r=this.location,i=this.location.add1(t,this.font.size);if(e%360===0)return new _e().ext2(r).ext2(i).build1();{let n=this.location.add1(t,0),s=this.location.add1(0,this.font.size),a=Qe.rotateD(e).setOrigin1(this.location);return new _e().ext2(r.multiply3(a)).ext2(i.multiply3(a)).ext2(n.multiply3(a)).ext2(s.multiply3(a)).build1()}}shape(t,e){return null}};var Ex=class o{constructor(t,e,r,i=!1,n=!1){this.familly=t,this.size=e,this.weight=r,this.italic=i,this.bold=n}transform(t){return new o(this.familly,t.iScale*this.size,t.iScale*this.weight,this.italic,this.bold)}hashCode(){return Re.strHashcode(this.familly)^this.size^this.weight}equals(t){return this===t?!0:t==null?!1:t instanceof o?!(this.familly!==t.familly||this.size!==t.size||this.weight!==t.weight||this.italic!==t.italic||this.bold!==t.bold):!1}};var n8e=new BS("",$r.DOCUMENT,S.ORIGIN,0,"",new Ex("",0,0),!1),HIe=class o{constructor(){this.layer=null;this.location=null;this.orientation=Number.NaN;this.pattern=null;this.showDesignator=!1;this.showComment=!1;this.designator=null;this.comment=null;this.shapes=[]}clone(t){let e=new o;e.layer=t.layer,e.location=t.location,e.orientation=t.orientation,e.pattern=t.pattern,e.uniqueId=t.uniqueId,e.showDesignator=t.showDesignator,e.showComment=t.showComment,e.designator=t.designator,e.comment=t.comment;for(let r of t.shapes)e.shapes.push(r);return e}asContainer(){return this.orientation=0,this.pattern="",this.showDesignator=!1,this.showComment=!1,this.designator=n8e,this.comment=n8e,this}build(){return new EY(this)}},EY=class extends Pa{constructor(t){if(super(t.id||"","",an.notnull(t.layer)),this.uniqueId=t.uniqueId||t.id,this.location=an.notnull(t.location),this.orientation=an.normal(t.orientation),this.pattern=an.notnull(t.pattern),this.showDesignator=t.showDesignator,this.showComment=t.showComment,this.designator=an.notnull(t.designator),this.comment=an.notnull(t.comment),this.props=t.props,t.shapes.length==0)throw new Error("no shape in component ");this.shapes=t.shapes.slice(0),this.__bbox=this._bbox()}multiply3(t){let e=new HIe;e.layer=this.layer,e.props=this.props,e.location=this.location.multiply3(t),e.orientation=Ht.transformD(this.orientation,t),e.pattern=this.pattern,e.id=this.id,e.uniqueId=this.uniqueId,e.showDesignator=this.showDesignator,e.showComment=this.showComment,e.designator=this.designator.multiply3(t),e.comment=this.comment.multiply3(t);for(let r of this.shapes)e.shapes.push(r.multiply3(t));return e.build()}bbox(){return this.__bbox}_bbox(){let t=new _e;for(let e of this.shapes)t.ext1(e.bbox());return this.showDesignator&&t.ext1(this.designator.bbox()),this.showComment&&t.ext1(this.comment.bbox()),t.build1()}shape(t,e){throw new Error("unsupported operation")}};var Bte=class{constructor(t,e,r){this.sourceName=t,this.contributor=e,this.scale=r}};function kI(o,t){zIe(o.iterator(),t)}function zIe(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var WIe=class{constructor(t){this.idx=-1;this.lst=t}hasNext(){return this.idx<this.lst.length-1}next(){if(this.idx<this.lst.length-1)return this.idx++,this.lst[this.idx];throw new Error("bug")}};function Fte(o){return new WIe(o)}var Vte=class{constructor(){this.inner=new Array}contains(t){for(let e of this.inner)if(e.equals(t))return!0;return!1}add(t){this.contains(t)||this.inner.push(t)}addAll1(t){this.addAll2(t.iterator())}addAll2(t){zIe(t,(e,r)=>(this.add(r),!0))}array(){return this.inner}size(){return this.inner.length}isEmpty(){return this.inner.length===0}iterator(){return Fte(this.inner)}};var Gte=class{constructor(){this.sourceName=null;this.contributor=null;this.scale=Number.NaN;this.location=null;this.rules={};this.shapes=[];this.layerStack=new Vte;this.layerInfos={};this.ruleCache=null;this.ruleNetCache=null;this.ruleOptions={}}build(){return new YIe(this)}addLayerOrder(...t){if(t!==null)for(let e=0;e<t.length;e++){let r=an.notnull(t[e]);if(this.layerStack.contains(r))throw new Error(Td.format("duplicate layer %s",r));this.layerStack.add(r)}}getRules(t){return this.rules[t]||(this.rules[t]=[]),this.rules[t]}},YIe=class extends Bte{constructor(e){super(an.notnull(e.sourceName),an.notnull(e.contributor),e.scale);this.ruleCache=null;this.ruleNetCache=null;this.ruleOptions={};this.rules=e.rules,this.shapes=e.shapes.slice(0),this.layerStack=e.layerStack.array().slice(0),this.layerInfos=e.layerInfos||{},this.ruleCache=e.ruleCache,this.ruleNetCache=e.ruleNetCache,this.ruleOptions=e.ruleOptions}components(){let e={},r=[];for(let i of this.shapes)i instanceof EY&&(i.pattern in e||(e[i.pattern]=!0,r.push(i)));return r}};var h9t=!1,u9t=!0,d9t=!1,p9t=!1,f9t=!0,m9t=!0,g9t=!0,y9t=!0,b9t=new $r(5,1),P9t=new $r(5,2),T9t=new $r(5,3),I9t=new $r(5,4),C9t=new $r(5,5),S9t=new $r(5,6),BB=class extends NB{constructor(e){super();this.shapes=[];this.debug=e}display(){let e=new Gte;return e.contributor="",e.sourceName="",e.scale=10,Re.addAll(e.shapes,this.shapes),e.build()}onPolylineGroup(e,r){if(this.debug)for(let i of e.items)this.debug1(C9t,r.toString(),i)}onRTreeBBox(e){if(this.debug&&h9t)for(let r of fe.build4([e.LL(),e.UL(),e.UR(),e.LR(),e.LL()]).primitives)this.debug2($r.TOP_SILK,"",r,.003)}onSegment(e,r,i,n,s,a){if(this.debug&&u9t){let l=Td.format("SG (%d,%d,%d) : (%d,%d,%d) : %s : %s",i.polyGrp,i.polyIndex,r,a.polyGrp,a.polyIndex,s,e,n);this.debug2($r.BOT_COPPER,l,new M(e,n),.003)}}onIntersect(e,r,i){if(this.debug&&p9t){let n=Td.format("%d,%d:%d,%d:%s",r.polyGrp,r.polyIndex,i.polyGrp,i.polyIndex,e);this.debug2(P9t,n,new M(e.add1(-.01,0),e.add1(.01,0)),.01)}}onResultSide(e){this.debug&&f9t&&this.debug2(I9t,e.toString(),e.shape,.003)}onOriginSide(e){this.debug&&m9t&&this.debug2($r.TOP_COPPER,e.toString(),e.shape,.003)}onSplitedSide(e){this.debug&&g9t&&this.debug2(T9t,e.toString(),e.shape,.003)}onDebugSide(e){this.debug&&y9t&&this.debug2(S9t,e.toString(),e.shape,.003)}onSweep(e,r,i,n,s,a){if(this.debug&&d9t){let l=Td.format("SW (%d,%d,%d) : (%d,%d,%d) : %s : %s",i.polyGrp,i.polyIndex,r,a.polyGrp,a.polyIndex,s,e,n);this.debug2(b9t,l,new M(e,n),.003)}}debug1(e,r,...i){for(let n of i)this.shapes.push(new CA(r,e,0,n))}debug2(e,r,i,n){i instanceof M?this.shapes.push(new Ns(r,e,i.start(),i.end(),n)):i instanceof q?this.shapes.push(new kB(r,e,i,n,!1)):this.debug1(e,r,i.stroke(n,kr.BUTT,le.CW))}};var Of=class{static dotProd1(t,e,r,i){return t*r+e*i}static dotProd2(t,e,r,i,n,s){return this.dotProd1(r-t,i-e,n-r,s-i)}static dotProd3(t,e,r){return this.dotProd2(t.x,t.y,e.x,e.y,r.x,r.y)}static crossProd1(t,e,r,i){return t*i-e*r}static crossProd2(t,e,r,i,n,s){return this.crossProd1(r-t,i-e,n-r,s-i)}static crossProd3(t,e,r){return this.crossProd2(t.x,t.y,e.x,e.y,r.x,r.y)}static distance2(t,e,r,i){let n=r-t,s=i-e;return n*n+s*s}static distance1(t,e,r,i){return this.hypot(r-t,i-e)}static distance1p(t,e){return this.distance1(t.x,t.y,e.x,e.y)}static hypot(t,e){if(t=Math.abs(t),e=Math.abs(e),e>t){var r=e;e=t,t=r}if(t===0)return e;var i=e/t;return t*Math.sqrt(1+i*i)}};var c8e=[1,10,100,1e3],o8e="http://www.w3.org/2000/svg",s8e="http://www.w3.org/1999/xlink",a8e="http://www.w3.org/XML/1998/namespace",l8e="https://easyeda.com/",EA=(function(){var o={svg:o8e,xlink:s8e,xml:a8e,c:l8e};return o[o8e]="svg",o[s8e]="xlink",o[a8e]="xml",o[l8e]="c",o})();var gp=(function(){var o={RATLINES:9,MODEL3D:19,ALL:11,TOPSILKLAYER:3,TOPLAYER:1,TOPPASTERLAYER:5,TOPSOLDERLAYER:7,LIBBODY:99,PADSURFACE:100,BOARDOUTLINE:10,DOCUMENT:12,TOPASSEMBLY:13,MECHANICAL:15,TOPCOMPONENT:16,SUBSTRATE:18},t;for(t=21;t<53;t++)o["INNER"+(t-20)]=t;for(o.BOTTOMSILKLAYER=4,o.BOTTOMLAYER=2,o.BOTTOMPASTERLAYER=6,o.BOTTOMSOLDERLAYER=8,o.BOTTOMASSEMBLY=14,o.BOTTOMCOMPONENT=17,t=53;t<85;t++)o["BOARD"+(t-52)]=t;return o})(),Wir=(function(){var o={COPPERAREA:[1,2,21,22,23,24],PLANEZONE:[1,2,21,22,23,24],RECT:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,99],TRACK:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],PAD:[11,1,2],VIA:[11],HOLE:[11],TEXT:[3,4,1,2,7,8,12,13,14,15,21,22,23,24],ARC:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],ELLIPSE:[3,4,12,13,14,15],CIRCLE:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],DIMENSION:[3,4,12,13,14,15],FOOTPRINT:[1,2],SOLIDREGION:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,11,99,100],SVGNODE:[1,2,3,4,7,8,12,13,14,15],PROTRACTOR:[3,4,12,13,14,15],SHEET:[12,13,14,15]};o["3D"]=(function(){for(var i=[16,19,3,7,5,1],n=21;n<52;n++)i.push(n+32,n);return i.push(2,6,8,4,17),i})();var t,e,r;for(t in o)if(o.hasOwnProperty(t)&&(r=o[t],r.indexOf(21)>0&&r.indexOf(25)===-1))for(e=25;e<=52;e++)r.push(e);return o})(),tg=(function(){var o={1:"TopLayer",2:"BottomLayer",3:"TopSilkLayer",4:"BottomSilkLayer",5:"TopPasteMaskLayer",6:"BottomPasteMaskLayer",7:"TopSolderMaskLayer",8:"BottomSolderMaskLayer",9:"Ratlines",10:"BoardOutLine",11:"Multi-Layer",12:"Document",13:"TopAssembly",14:"BottomAssembly",15:"Mechanical",16:"TopComponents",17:"BottomComponents",18:"Substrate",19:"3DModel",99:"ComponentShapeLayer",100:"LeadShapeLayer"},t;for(t=21;t<53;t++)o[t]="Inner"+(t-20);for(t=53;t<85;t++)o[t]="Substrate"+(t-52);return o})(),zir=(function(){var o=[],t=[];for(var e in gp)if(gp.hasOwnProperty(e)){if(e.match(/^BOARD\d+/))continue;o.push(gp[e])}o.sort(),t.sort();var r={},i,n={21:"#999966",22:"#008000",23:"#00FF00",24:"#BC8E00",25:"#70DBFA",26:"#00CC66",27:"#9966FF",28:"#800080",29:"#008080",30:"#15935F",31:"#000080",32:"#00B400",33:"#2E4756",34:"#99842F",35:"#FFFFAA",36:"#99842F",37:"#2E4756",38:"#3535FF",39:"#8000BC",40:"#43AE5F",41:"#C3ECCE",42:"#728978",43:"#39503F",44:"#0C715D",45:"#5A8A80",46:"#2B937E",47:"#23999D",48:"#45B4E3",49:"#215DA1",50:"#4564D7",51:"#6969E9",52:"#9069E9"};o.forEach(function(a){switch(a){case gp.TOPLAYER:i={name:tg[a],color:"#FF0000",darkColor:"#CC0000",visible:!0,active:!0,config:!0};break;case gp.BOTTOMLAYER:i={name:tg[a],color:"#0000FF",darkColor:"#000080",visible:!0,active:!1,config:!0};break;case gp.TOPSILKLAYER:i={name:tg[a],color:"#FFCC00",darkColor:"#806600",visible:!0,active:!1,config:!0};break;case gp.BOTTOMSILKLAYER:i={name:tg[a],color:"#66CC33",darkColor:"#33661A",visible:!0,active:!1,config:!0};break;case gp.TOPPASTERLAYER:i={name:tg[a],color:"#808080",darkColor:"#666666",visible:!0,active:!1,config:!0};break;case gp.BOTTOMPASTERLAYER:i={name:tg[a],color:"#800000",darkColor:"#660000",visible:!0,active:!1,config:!0};break;case gp.TOPSOLDERLAYER:i={name:tg[a],color:"#800080",darkColor:"#660066",visible:!0,active:!1,transparency:.3,config:!0};break;case gp.BOTTOMSOLDERLAYER:i={name:tg[a],color:"#AA00FF",darkColor:"#8800CC",visible:!0,active:!1,transparency:.3,config:!0};break;case gp.RATLINES:i={name:tg[a],color:"#6464FF",darkColor:"#5050CC",visible:!1,active:!1,config:!0};break;case gp.BOARDOUTLINE:i={name:tg[a],color:"#FF00FF",darkColor:"#CC00CC",visible:!0,active:!1,config:!0};break;case gp.ALL:i={name:tg[a],color:"#C0C0C0",darkColor:"#999999",visible:!0,active:!1,config:!0};break;case gp.DOCUMENT:i={name:tg[a],color:"#FFFFFF",darkColor:"#CCCCCC",visible:!0,active:!1,config:!0};break;case gp.TOPASSEMBLY:i={name:tg[a],color:"#33CC99",darkColor:"#33AA99",visible:!1,active:!1,config:!1};break;case gp.BOTTOMASSEMBLY:i={name:tg[a],color:"#5555FF",darkColor:"#8888FF",visible:!1,active:!1,config:!1};break;case gp.MECHANICAL:i={name:tg[a],color:"#F022F0",darkColor:"#F088F0",visible:!1,active:!1,config:!1};break;case gp.MODEL3D:i={name:tg[a],color:"#66CCFF",visible:!1,active:!1,config:!1};break;case gp.LIBBODY:i={name:tg[a],color:"#00CCCC",visible:!1,active:!1,config:!1};break;case gp.PADSURFACE:i={name:tg[a],color:"#CC9999",visible:!1,active:!1,config:!1};break;default:a>=gp.INNER1&&a<=gp.INNER32?i={name:tg[a],color:n[a],darkColor:s(n[a]),visible:!1,active:!1,config:!1}:i=null;break}i&&(r[a]=i)}),r.Hole={config:!0,name:"Hole",darkColor:"#222222",color:"#222222"},r.DRCError={config:!0,name:"DRCError",color:"#FAD609",darkColor:"#FAD609"};function s(a){if(typeof a!="string"||!a.match(/#?([\da-f]{6})/i))return a;var l=parseInt(RegExp.$1,16),c=.5,h=Math.min(255,Math.round((l>>16)*c)),u=Math.min(255,Math.round((l>>8&255)*c)),d=Math.min(255,Math.round((l&255)*c)),p=((h<<16)+(u<<8)+d).toString(16);return"#"+("00000"+p).substr(-6).toUpperCase()}return r})(),bi={BLANK:0,SCH:1,PART:2,PCB:3,FOOTPRINT:4,PRJ:5,SUBPART:6,SPICESYMBOL:7,SUBCKT:8,NETLIST:9,WAVEFORM:10,SCHLIB3D:11,PHOTOVIEW:12,SCHMODULE:13,PCBMODULE:14,VIEW3D:15,PCBLIB3D:16,BLOCK_SYMBOL:17,NETFLAG:18,NETPORT:19,SHEET_SYMBOL:20,NONEELEC_SYMBOL:21,SHORT_SYMBOL:22,FOOTPRINTVIEW:23,PCB2D:31,PCB3D:32},Yir=(function(){var o={};for(let t in bi)o[bi[t]]=t;return o})(),tn={PRJ:"1",BOARDS:"2",BOARD:"3",BLOCKS:"4",BLOCK:"5",SCH:"6",SHEET:"7",SYMBOLS:"8",SYMBOL:"9",NETS:"10",NET:"11",WIRE:"13",BLOCK_SYMBOL:"12",BUS:"14",SYMBOLCOLLECT:"15",NETCLASS:"16",NETCOLLECT:"17",NETTREENODE:"18",REUSEBLOCKS:"19",REUSEBLOCK:"20",NETPORTS:"23",NETPORT:"24",NETFLAGS:"25",NETFLAG:"26",SHORTSYMBOLS:"27",SHORTSYMBOL:"28",NONEELECSYMBOLS:"29",NONEELECSYMBOL:"30",PRIMITIVES:"31",PRIMITIVE:"32",PCB:"101",ALLNETROOT:"106",ObjectRoot:"objectRoot",Object:"object",TrackNet:"trackNet",TestPadNet:"testPadNet",CopperLayer:"copperLayer",Copper:"copper",Group:"group",ComponentClassification:"componentClassification",Nets:"nets",Net:"net",NetClasses:"netClasses",NetClass:"netClass",RatlineNets:"ratlineNets",RatlineNet:"ratlineNet",Ratline:"ratline",Differentials:"differentials",Differential:"differential",EqualLengthGroups:"equalLengthGroups",EqualLengthGroup:"equalLengthGroup",PadsPairGroups:"PadsPairGroups",PadsPairGroup:"padsPairGroup",PadsPair:"padsPair",NetComponents:"netComponents",layerPair:"layerpair",Radiuse:"radiuse",Errors:"errors",ErrorType:"errorType",ErrorObjType:"errorObjType"};var u8e=Math.PI*2,jIe=Math.PI/2,XIe=Math.sin(Math.PI/180);function on(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=c8e[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}function h8e(o){let t=0;o>0?t=o-Math.floor(o):t=o-Math.ceil(o);let e=(t.toString()||"").length;return e>2?e-2:0}function Ox(o,t,e){if(e>=5&&Math.abs(o-t)>1e-5)return!1;let r=Math.min(h8e(o),h8e(t));return r<10&&(r=10),isNaN(e)||(r=Math.min(r,e)),on(o,r)===on(t,r)}function Ute(o,t,e,r){var i=o.x,n=o.y,s=t.x,a=t.y,l=e.x,c=e.y,h=s-i,u=a-n,d=h*h+u*u,p=((l-i)*h+(c-n)*u)/d;if((p>1||p<0)&&r)return null;var m=i+p*h,g=n+p*u;return{x:m,y:g}}function Hte(o,t,e,r){function i(g,y){return g.x==y.x&&g.y==y.y}var n=i(o,e)||i(o,r)?o:i(t,e)||i(t,r)?t:null;if(n)return{x:n.x,y:n.y};var s,a,l,c,h,u,d,p,m;return s=t.x-o.x,a=t.y-o.y,l=r.x-e.x,c=r.y-e.y,d=l*a-c*s,d===0?!1:(p=e.x-o.x,m=e.y-o.y,u=(s*m-a*p)/d,h=(l*m-c*p)/d,u>=0&&u<=1&&h>=0&&h<=1?{x:o.x+h*s,y:o.y+h*a}:!1)}function d8e(o,t,e){var r,i=+t.x,n=+t.y,s=+e.x,a=+e.y,l=+o.x,c=+o.y,h=s-i,u=a-n,d=l-i,p=c-n,m,g,y,b,P,T;return h===0&&u===0?{d:Math.sqrt(d*d+p*p),point:{x:i,y:n}}:(r=(d*h+p*u)/(h*h+u*u),r<0?{d:Math.sqrt(d*d+p*p),point:{x:i,y:n}}:r>1?(m=l-s,g=c-a,{d:Math.sqrt(m*m+g*g),point:{x:s,y:a}}):(P=i+r*h,T=n+r*u,y=l-P,b=c-T,{d:Math.sqrt(y*y+b*b),point:{x:P,y:T}}))}function wM(o,t,e,r){var i=e-o,n=r-t,s=Math.atan2(n,i);return s=s<0?s+Math.PI+Math.PI:s,s}function Wte(o){return o<0?(360+o%360)%360:o>=360?o%360:o}function H2(o,t,e){var r=o-t;return e||(e=1e-10),(r>0?r:-r)<e}function OY(o){if(!o.length)return[];for(var t=[],e={},r=0;r<o.length;r++){var i=typeof o[r]+o[r];e[i]||(t.push(o[r]),e[i]=!0)}return t}function LM(o,t,e,r,i,n){var s=(i-e)*(o-e)+(n-r)*(t-r),a=(i-e)*(i-e)+(n-r)*(n-r),l=s/a,c=e+(i-e)*l,h=r+(n-r)*l;return s<=0?Math.sqrt((o-e)*(o-e)+(t-r)*(t-r)):s>=a?Math.sqrt((o-i)*(o-i)+(t-n)*(t-n)):Math.sqrt((o-c)*(o-c)+(h-t)*(h-t))}var AY=1e-4,Ee=new Float64Array(100);function Tt(o,t){if(o instanceof M&&t instanceof M)return xE(o,t);if(o instanceof q&&t instanceof M)return jte(o,t);if(o instanceof M&&t instanceof q)return jte(t,o);if(o instanceof q&&t instanceof q)return O9t(o,t);throw new Error("not supported operation")}function VB(o,t){let e=o.primitives,r=t.primitives,i=e.length>r.length?r:e,n=e.length>r.length?e:r,s=!1;return i.some(a=>(n.some(l=>(s=Tt(a,l)>0,s)),s)),s}function y8e(o,t){let e=o.bbox();if(e.isContainsY1(t)){let r=new M(new S(e.minX-1,t),new S(e.maxX+1,t));return xE(r,o)>0?1:0}else return 0}function b8e(o,t){if(o.rx===o.ry){let e=o.bbox();if(e.isContainsY1(t)){let r=new M(new S(e.minX-1,t),new S(e.maxX+1,t));return Yte(o,r)>0?1:0}else return 0}else throw new Error("not supported operation")}function p8e(o,t,e){return isFinite(t)&&isFinite(e)?o.isContains2(t,e):!1}function qIe(o,t){let e=o.bbox().intersection1(t.bbox());if(e!=null){let r=Of.crossProd3(t.start(),t.end(),o.start()),i=Of.crossProd3(t.start(),t.end(),o.end());return Math.abs(r)<1e-8||Math.abs(i)<1e-8||r*i<0?e:null}else return null}function xE(o,t){if(o.isPoint())return uT(t,o.start());if(t.isPoint())return uT(o,t.start());{let e=qIe(o,t);if(e!=null){let P=function(T,I){e.isContains2(T,I)&&(Ee[b++]=T,Ee[b++]=I)},r=o.start().x,i=o.start().y,n=o.end().x,s=o.end().y,a=t.start().x,l=t.start().y,c=t.end().x,h=t.end().y,u=t.length(),d=Of.crossProd2(r,i,a,l,c,h)/u,p=Of.crossProd2(n,s,a,l,c,h)/u;if(d*p>0&&!ne.eq(d,0)&&!ne.eq(p,0))return 0;let m=o.length(),g=Of.crossProd2(a,l,r,i,n,s)/m,y=Of.crossProd2(c,h,r,i,n,s)/m;if(g*y>0&&!ne.eq(g,0)&&!ne.eq(y,0))return 0;let b=0;if(ne.eq(d,0)&&ne.eq(p,0)){let T=e.UL(),I=e.UR(),C=e.LL(),E=e.LR();if(ne.eq(e.width(),0))ne.eq(e.height(),0)?(Ee[b++]=T.x,Ee[b++]=T.y):(Ee[b++]=T.x,Ee[b++]=T.y,Ee[b++]=C.x,Ee[b++]=C.y);else if(ne.eq(e.height(),0))Ee[b++]=T.x,Ee[b++]=T.y,Ee[b++]=I.x,Ee[b++]=I.y;else{let O=CO.area2(T.x,T.y,a,l,c,h),_=CO.area2(I.x,I.y,a,l,c,h);O<_?(Ee[b++]=T.x,Ee[b++]=T.y,Ee[b++]=E.x,Ee[b++]=E.y):(Ee[b++]=I.x,Ee[b++]=I.y,Ee[b++]=C.x,Ee[b++]=C.y)}}else if(ne.eq(d,0))P(r,i);else if(ne.eq(p,0))P(n,s);else{let T=Math.abs(d/(d-p));P(r+(n-r)*T,i+(s-i)*T)}return b}else return 0}}function uT(o,t){return o.bbox().extendOfSize(1e-8).isContains(t)?o.isPoint()?t.equals1(o.start())?(Ee[0]=t.x,Ee[1]=t.y,2):0:ne.eq(CO.area2(o.start().x,o.start().y,o.end().x,o.end().y,t.x,t.y),0)?(Ee[0]=t.x,Ee[1]=t.y,2):0:0}function _Y(o,t,e,r=.5){let i=_9t(o,t,e);i.d<=r&&(o=i.point);let n=t.distance1(e),s=t.distance1(o),a=e.distance1(o);return!!H2(s+a,n,.001)}function Yte(o,t){let e=o.bbox().intersection1(t.bbox());if(e!=null){e=e.extendOfSize(AY);let r=o.center.x,i=o.center.y,n=o.rx,s=o.rx2,a=t.start().x,l=t.start().y,c=t.end().x,h=t.end().y,u=o.center.distance1(t.start()),d=o.center.distance1(t.end()),p=ne.eq(u,n)?0:u>n?1:-1,m=ne.eq(d,n)?0:d>n?1:-1,g=0;if(p===-1&&m===-1)return 0;if(p===0&&m===0)Ee[g++]=a,Ee[g++]=l,Ee[g++]=c,Ee[g++]=h;else if(p===1&&m===1){let y=ir.foot(t,o.center),b=y.distance1(o.center);if(ne.greater(b,n))return 0;if(ne.eq(b,n))ne.eq(t.distance2(o.start()),0)?(Ee[g++]=o.start().x,Ee[g++]=o.start().y,Ee[g++]=o.start().x,Ee[g++]=o.start().y):ne.eq(t.distance2(o.end()),0)?(Ee[g++]=o.end().x,Ee[g++]=o.end().y,Ee[g++]=o.end().x,Ee[g++]=o.end().y):(Ee[g++]=y.x,Ee[g++]=y.y,Ee[g++]=y.x,Ee[g++]=y.y);else{g=E9t(r,i,a,l,c,h,g);let P=Ee[g-2],T=Ee[g-1],I=Of.distance1(r,i,P,T);if(g-=2,ne.eq(I,n))Ee[g++]=P,Ee[g++]=T;else if(I<n)g=hT(s,r,i,a,l,P,T,g),g=hT(s,r,i,P,T,c,h,g);else return 0}}else if(p===-1||m===-1)g=hT(s,r,i,a,l,c,h,g);else{let y=ir.foot(t,o.center),b=y.distance1(o.center);if(ne.eq(b,n)){let P=function(T){return p8e(e,T.x,T.y)&&to(o,T)};if(p===0){let T=t.start();if(P(T))return Ee[g++]=T.x,Ee[g++]=T.y,Ee[g++]=T.x,Ee[g++]=T.y,g;if(P(y))return Ee[g++]=y.x,Ee[g++]=y.y,Ee[g++]=y.x,Ee[g++]=y.y,g;if(u<=n)g=hT(s,r,i,y.x,y.y,c,h,g),g===2&&(Ee[g++]=Ee[0],Ee[g++]=Ee[1]);else if(b<n){if(g=hT(s,r,i,y.x,y.y,c,h,g),g===2&&P(new S(Ee[0],Ee[1])))return Ee[g++]=Ee[0],Ee[g++]=Ee[1],g;g=hT(s,r,i,y.x,y.y,a,l,0),g===2&&(Ee[g++]=Ee[0],Ee[g++]=Ee[1])}}else{let T=t.end();if(P(T))return Ee[g++]=T.x,Ee[g++]=T.y,Ee[g++]=T.x,Ee[g++]=T.y,g;if(P(y))return Ee[g++]=y.x,Ee[g++]=y.y,Ee[g++]=y.x,Ee[g++]=y.y,g;if(d<=n)g=hT(s,r,i,y.x,y.y,a,l,g),g===2&&(Ee[g++]=Ee[0],Ee[g++]=Ee[1]);else if(b<n){if(g=hT(s,r,i,y.x,y.y,a,l,g),g===2&&P(new S(Ee[0],Ee[1])))return Ee[g++]=Ee[0],Ee[g++]=Ee[1],g;g=hT(s,r,i,y.x,y.y,c,h,0),g===2&&(Ee[g++]=Ee[0],Ee[g++]=Ee[1])}}}else if(p===0){let P=t.start();Ee[g++]=P.x,Ee[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=hT(s,r,i,y.x,y.y,c,h,g))}else{let P=t.end();Ee[g++]=P.x,Ee[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=hT(s,r,i,y.x,y.y,a,l,g))}}if(g>0){let y=0;for(let b=0;b<g;b+=2){let P=Ee[b],T=Ee[b+1];isFinite(P)&&isFinite(T)&&p8e(e,P,T)&&to(o,new S(P,T))&&(Ee[y++]=P,Ee[y++]=T)}return y}else return 0}else return 0}function hT(o,t,e,r,i,n,s,a){if(i==s){let T=o-(i-e)*(i-e);if(ne.greater(T,0)){let I=Math.sqrt(T),C=t-I,E=t+I,O=Math.min(r,n),_=Math.max(r,n);return C>=O&&C<=_&&(Ee[a++]=C,Ee[a++]=i),E>=O&&E<=_&&(Ee[a++]=E,Ee[a++]=i),a}}let l=Of.distance2(r,i,t,e)-o;if(l==0)return Ee[a++]=r,Ee[a++]=i,a;let c=Of.distance2(n,s,t,e)-o;if(c==0)return Ee[a++]=n,Ee[a++]=s,a;let h=r,u=i,d=n,p=s,m=NaN,g=NaN,y=Number.POSITIVE_INFINITY,b=0;for(;y!==0;){b++;let T=Math.max(Math.min(Math.abs(l)/(Math.abs(l)+Math.abs(c)),.75),.25);if(m=h+(d-h)*T,g=u+(p-u)*T,h===m&&u===g||d===m&&p===g){Math.abs(l)>Math.abs(c)?(m=d,g=p,y=c):(m=h,g=u,y=l);break}else y=Of.distance2(m,g,t,e)-o,y<0&&l>c||y>0&&l<c?(d=m,p=g,c=y):(h=m,u=g,l=y)}let P=Math.sqrt(o)-Of.distance1(m,g,t,e);return(ne.eq(0,y)||ne.eq(0,P))&&(Ee[a++]=m,Ee[a++]=g),a}function E9t(o,t,e,r,i,n,s){if(Of.crossProd2(e,r,i,n,o,t)==0){let l=Of.dotProd2(e,r,i,n,o,t),c=Of.dotProd2(i,n,e,r,o,t);return l<0&&c<0?(Ee[s++]=o,Ee[s++]=t,s):l>=0?(Ee[s++]=i,Ee[s++]=n,s):(Ee[s++]=e,Ee[s++]=r,s)}else{let l=NaN,c=NaN,h=e,u=r,d=i,p=n,m=Of.distance2(e,r,o,t),g=Of.distance2(i,n,o,t),y=Number.POSITIVE_INFINITY,b=0;for(;y>0&&(b++,l=h+(d-h)*.5,c=u+(p-u)*.5,!(m==g||h==l&&u==c||d==l&&p==c));){y=Of.distance2(l,c,o,t);let P=Of.dotProd2(h,u,l,c,o,t);if(P==0)break;P<0?(d=l,p=c,g=y):(h=l,u=c,m=y)}return Ee[s++]=l,Ee[s++]=c,s}}function jte(o,t){if(o.rx===o.ry)return Yte(o,t);throw new Error("not supported")}function O9t(o,t){if(o.bbox().intersection1(t.bbox())!=null){if(o.rx===o.ry&&t.rx===t.ry)return A9t(o,t);throw new Error("not supported operation")}return 0}function A9t(o,t){let e=o.center.x,r=o.center.y,i=t.center.x,n=t.center.y,s=o.rx,a=t.rx,l=o.rx2,c=t.rx2,h=o.center.distance1(t.center),u=Math.abs(s-a),d=s+a;if(ne.greater(h,d)||ne.less(h,u))return 0;if(ne.eq(u+h,0)){let p=0,m;return to(o,t.start())&&(Ee[p]=t.start().x,Ee[p+1]=t.start().y,p+=2,m=t.start()),to(o,t.end())&&(Ee[p]=t.end().x,Ee[p+1]=t.end().y,p+=2,m=t.end()),p===0?(to(t,o.start())&&(Ee[p]=o.start().x,Ee[p+1]=o.start().y,p+=2),to(t,o.end())&&(Ee[p]=o.end().x,Ee[p+1]=o.end().y,p+=2)):p===2&&(!m.equals1(o.start())&&to(t,o.start())&&(Ee[p]=o.start().x,Ee[p+1]=o.start().y,p+=2),!m.equals1(o.end())&&to(t,o.end())&&(Ee[p]=o.end().x,Ee[p+1]=o.end().y,p+=2)),p}else if(ne.eq(h,d)){if(f8e(o,t))return 4;let p=new M(o.center,t.center),m=Yte(t,p);return m=m8e(o,m),m!==0?m:(m=Yte(o,p),m8e(t,m))}else if(ne.eq(h,u)){if(f8e(o,t))return 4;if(s>a){let p=(s-a)/s;return Ee[0]=e+(i-e)/p,Ee[1]=r+(n-r)/p,g8e(o,t,2)}else{let p=(a-s)/a;return Ee[0]=i+(e-i)/p,Ee[1]=n+(r-n)/p,g8e(o,t,2)}}else{let m=(o.center.distance2(t.center)-c+l)/(h*2)/h,g=(i-e)*m+e,y=(n-r)*m+r,b=i-e,P=n-r,T=Math.max(s,a),I,C,E,O;if(Math.abs(b)<Math.abs(P)){let D=b/-P,w=y-D*g;I=g-T,C=D*I+w,E=g+T,O=D*E+w}else{let D=P/-b,w=g-D*y;C=y-T,I=D*C+w,O=y+T,E=D*O+w}let _=hT(l,e,r,I,C,g,y,0);if(_=hT(l,e,r,g,y,E,O,_),_!==4)throw new Error("cnt !== 4");let R=new S(Ee[0],Ee[1]),v=new S(Ee[2],Ee[3]);if(to(o,R)&&to(t,R))return to(o,v)&&to(t,v)?4:My(o.start(),t,v,R)?(Ee[2]=o.start().x,Ee[3]=o.start().y,4):My(o.end(),t,v,R)?(Ee[2]=o.end().x,Ee[3]=o.end().y,4):My(t.start(),o,v,R)?(Ee[2]=t.start().x,Ee[3]=t.start().y,4):My(t.end(),o,v,R)?(Ee[2]=t.end().x,Ee[3]=t.end().y,4):My(o.start(),t,R,v)?(Ee[0]=o.start().x,Ee[1]=o.start().y,2):My(o.end(),t,R,v)?(Ee[0]=o.end().x,Ee[1]=o.end().y,2):My(t.start(),o,R,v)?(Ee[0]=t.start().x,Ee[1]=t.start().y,2):(My(t.end(),o,R,v)&&(Ee[0]=t.end().x,Ee[1]=t.end().y),2);if(to(o,v)&&to(t,v))return My(o.start(),t,R,v)?(Ee[0]=o.start().x,Ee[1]=o.start().y,4):My(o.end(),t,R,v)?(Ee[0]=o.end().x,Ee[1]=o.end().y,4):My(t.start(),o,R,v)?(Ee[0]=t.start().x,Ee[1]=t.start().y,4):My(t.end(),o,R,v)?(Ee[0]=t.end().x,Ee[1]=t.end().y,4):My(o.start(),t,v,R)?(Ee[0]=o.start().x,Ee[1]=o.start().y,2):My(o.end(),t,v,R)?(Ee[0]=o.end().x,Ee[1]=o.end().y,2):My(t.start(),o,v,R)?(Ee[0]=t.start().x,Ee[1]=t.start().y,2):My(t.end(),o,v,R)?(Ee[0]=t.end().x,Ee[1]=t.end().y,2):(Ee[0]=Ee[2],Ee[1]=Ee[3],2);{let H=function(z,G){if(ne.eq(z.distance1(G.center),G.rx)&&to(G,z)){if(z.distance2(R)<z.distance2(v)){if(D)return;D=!0}else{if(w)return;w=!0}Ee[F++]=z.x,Ee[F++]=z.y}},D=!1,w=!1,F=0;return H(o.start(),t),H(o.end(),t),H(t.start(),o),H(t.end(),o),F}}}function My(o,t,e,r){return ne.eq(o.distance1(t.center),t.rx)&&to(t,o)&&o.distance2(e)<o.distance2(r)}function f8e(o,t){return ne.eq(t.start().distance1(o.center),o.rx)&&to(o,t.start())?(Ee[0]=t.start().x,Ee[1]=t.start().y,Ee[2]=t.start().x,Ee[3]=t.start().y,!0):ne.eq(t.end().distance1(o.center),o.rx)&&to(o,t.end())?(Ee[0]=t.end().x,Ee[1]=t.end().y,Ee[2]=t.end().x,Ee[3]=t.end().y,!0):ne.eq(o.start().distance1(t.center),t.rx)&&to(t,o.start())?(Ee[0]=o.start().x,Ee[1]=o.start().y,Ee[2]=o.start().x,Ee[3]=o.start().y,!0):ne.eq(o.end().distance1(t.center),t.rx)&&to(t,o.end())?(Ee[0]=o.end().x,Ee[1]=o.end().y,Ee[2]=o.end().x,Ee[3]=o.end().y,!0):!1}function m8e(o,t){if(t===0)return 0;let e=Ee[0],r=Ee[1];return to(o,new S(e,r))?(Ee[0]=e,Ee[1]=r,Ee[2]=e,Ee[3]=r,4):0}function g8e(o,t,e){if(e===0)return 0;let r=Ee[0],i=Ee[1],n=new S(r,i);return to(o,n)&&to(t,n)?(Ee[0]=r,Ee[1]=i,Ee[2]=r,Ee[3]=i,4):0}function FB(o,t){return Math.abs(o-t)<=1e-6}function to(o,t){let e=o.bbox();if(t.x-e.minX>-AY&&t.x-e.maxX<AY&&t.y-e.minY>-AY&&t.y-e.maxY<AY){let r=Ht.regularD(t.angleD(o.center));return FB(r,o.startAngle)||FB(r,o.startAngle+360)||FB(r,o.startAngle-360)||FB(r,o.endAngle())||FB(r,o.endAngle()+360)||FB(r,o.endAngle()-360)?!0:o.sweepAngle>0?(ne.less(r,o.startAngle)&&(r+=360),ne.greatereq(o.endAngle(),r)):(ne.greater(r,o.startAngle)&&(r-=360),ne.lesseq(o.endAngle(),r))}else return!1}function Ax(o,t){return t.primitives.some(e=>_Y(o,e.start(),e.end()))}function OA(o,t,e,r=.001){let i=zte(o[1].x-o[0].x,r),n=zte(o[1].y-o[0].y,r),s=zte(t[1].x-t[0].x,r),a=zte(t[1].y-t[0].y,r);if(i===0&&s!==0||i!==0&&s===0)return!1;if(i===0&&s===0)return!0;let l=n/i,c=a/s,h=e?Math.PI*e:Math.PI;return H2(l,c,Math.sin(h/180))}function zte(o,t=1e-8){return o>0&&o<t||o<0&&o>-t?0:o}function _9t(o,t,e){var r,i=+t.x,n=+t.y,s=+e.x,a=+e.y,l=+o.x,c=+o.y,h=s-i,u=a-n,d=l-i,p=c-n,m,g,y,b,P,T;return h===0&&u===0?{d:Math.sqrt(d*d+p*p),point:new S(i,n)}:(r=(d*h+p*u)/(h*h+u*u),r<0?{d:Math.sqrt(d*d+p*p),point:new S(i,n)}:r>1?(m=l-s,g=c-a,{d:Math.sqrt(m*m+g*g),point:new S(s,a)}):(P=i+r*h,T=n+r*u,y=l-P,b=c-T,{d:Math.sqrt(y*y+b*b),point:new S(P,T)}))}function Xte(o,t,e,r){function i(g,y,b){return g instanceof S&&y instanceof S?Math.abs(g.x-y.x)<=b&&Math.abs(g.y-y.y)<=b:!1}var n=i(o,e,.5)||i(o,r,.5)?o:i(t,e,.5)||i(t,r,.5)?t:null;if(n)return!1;var s,a,l,c,h,u,d,p,m;return s=t.x-o.x,a=t.y-o.y,l=r.x-e.x,c=r.y-e.y,d=l*a-c*s,d===0?!1:(p=e.x-o.x,m=e.y-o.y,u=(s*m-a*p)/d,h=(l*m-c*p)/d,u>=0&&u<=1&&h>=0&&h<=1?new S(o.x+h*s,o.y+h*a):!1)}function P8e(o,t,e=5){return Math.abs(o-t)*Math.pow(10,e)<1}function Vb(o,t,e,r){var i=t.y-o.y,n=o.x-t.x,s=i*o.x+n*o.y,a=r.y-e.y,l=e.x-r.x,c=a*e.x+l*e.y,h=i*l-a*n;if(h==0)return null;var u=(l*s-n*c)/h,d=(i*c-a*s)/h;return new S(u,d)}var FS=class o{constructor(t,e,r,i,n,s,a){this.inters=[];this.connect=new Array;this.previous=null;this.next=null;this.finalGrp=-1;this.trans=NaN;this.outsideWeight=0;this.insideWeight=0;this.invalidWeight=0;this._confidence=0;this._confidence_y=NaN;this._x=NaN;this._x_y=NaN;this.status=0;this.bo=t,this.shape=e,this.baseWeight=r,i.y>n.y?this.weight=-r:i.y==n.y?this.weight=0:this.weight=r,this.start=i,this.end=n,this.polyGrp=s,this.polyIndex=a,this._bbox=new _e().ext1(e.bbox()).ext2(i).ext2(n).build1(),this.inters.push(i),this.inters.push(n);let l=31,c=1;c=l*c+this.polyGrp,c=l*c+this.polyIndex,this._hashcode=c}static rebuild(t,e,r){if(t instanceof M||e.distance2(r)<1e-6)return new M(e,r);if(t instanceof q){let i=t,n=t.bbox().center().x,s;e.y>r.y?s=n>i.center.x?le.CW:le.CCW:s=n>i.center.x?le.CCW:le.CW;let a=e.angleD(i.center),l=r.angleD(i.center);return q.build2(i.center,a,l,i.rx,i.ry,s)}else throw new Error("not supported operation")}setWeight(t){this.baseWeight=t,this.start.y>this.end.y?this.weight=-t:this.start.y==this.end.y?this.weight=0:this.weight=t,this.connect.length=0,this.finalGrp=-1,this.trans=NaN,this.outsideWeight=0,this.insideWeight=0,this.invalidWeight=0,this._confidence=0,this._confidence_y=NaN,this._x=NaN,this._x_y=NaN,this.status=0}updateBbox(){this._bbox=new _e().ext2(this.start).ext2(this.end).build1()}is(t,e){return t===this.polyGrp&&e===this.polyIndex}confidence(t){if(this._confidence_y!=t){let e=this._bbox.height();if(e!==0)if(Math.abs(t-this._bbox.maxY)>5e-4&&Math.abs(t-this._bbox.minY)>5e-4){let r=1-Math.abs(2*t-this._bbox.maxY-this._bbox.minY)/e;this._confidence=r*1e4|0}else this._confidence=0;else this._confidence=1;this._confidence_y=t}return this._confidence}needCountWeight(){return this.outsideWeight+this.insideWeight+this.invalidWeight<5e3}revokeOutside(t){let e=this.confidence(t);return this.outsideWeight-=e,this.invalidWeight+=e,e}revokeInside(t){let e=this.confidence(t);return this.insideWeight-=e,this.invalidWeight+=e,e}setOutside(t){let e=this.confidence(t);return this.outsideWeight+=e,e}setInside(t){let e=this.confidence(t);return this.insideWeight+=e,e}setInvalid(t){let e=this.confidence(t);return this.invalidWeight+=e,e}prevNot0(){let t=this.previous;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.previous}return null}nextNot0(){let t=this.next;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.next}return null}getX(t){if(this.bo!==null)return(this._x_y!=t||isNaN(this._x))&&(T8e(this,t)>0?this._x=Ee[0]:this._x=NaN,this._x_y=t),this._x;throw new Error("not supported operation")}voteStatus(){return this.outsideWeight>this.insideWeight&&this.outsideWeight>this.invalidWeight?2:this.insideWeight>this.outsideWeight&&this.insideWeight>this.invalidWeight?1:this.invalidWeight>this.outsideWeight&&this.invalidWeight>this.insideWeight?3:0}reverse(t){if(t===2)if(this.start.y>this.end.y){let e=o.rebuild(this.shape,this.end,this.start),r=new o(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return Re.addAll(r.connect,this.connect),r}else return this;else if(t===1)if(this.start.y<this.end.y){let e=o.rebuild(this.shape,this.end,this.start),r=new o(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return Re.addAll(r.connect,this.connect),r}else return this;return this}isNeedScan(t){return this.needCountWeight()&&this.confidence(t)>0}hashCode(){return this._hashcode}equals(t){return t instanceof o?!(this.polyGrp!==t.polyGrp||this.polyIndex!==t.polyIndex):!1}bbox(){return this._bbox}toString(){return Td.format("(%d,%d,%d) (%d,%d,%d) %s %s",this.polyGrp,this.polyIndex,this.weight,this.outsideWeight,this.invalidWeight,this.insideWeight,this.start,this.end)}};function $Ie(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minY+e.maxY)/2,n=(r.minY+r.maxY)/2;return i-n}function KIe(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minX+e.maxX)/2,n=(r.minX+r.maxX)/2;return i-n}var Gb=class{constructor(t){this.__bbox=null;if(typeof t<"u")if(t instanceof Array){this.__items=[];for(let e of t)this.add(e)}else this.__items=t,this.__bbox=t.bbox();else this.__items=[]}add(t){if(this.__items instanceof Array)this.__items.push(t),this.__bbox=ut.extend2(this.__bbox,t.bbox());else throw new Error("can't insert multiple item into leaf node")}items(){return this.__items}bbox(){if(this.__bbox!==null)return this.__bbox;throw new Error("bug")}},nn=class{constructor(t){this.changed=!1;this.root=new Gb,this.capacity=t,this.capacity2=t*t,this.itemList=[]}size(){return this.itemList.length}items(){return this.flushWhenNeed(),this.itemList}add(t){this.itemList.push(t),this.changed=!0}remove(t){Re.remove(this.itemList,t),this.changed=!0}clear(){this.changed=!1,this.root=new Gb,this.itemList.length=0}flushWhenNeed(){if(this.changed){let t=new Array;for(let e of this.itemList)t.push(new Gb(e));for(;;){let e=this.organize(t);if(e.length>1)t=e;else break}this.root=new Gb(t),this.changed=!1}}organize(t){xr(t,KIe,0,t.length);let e=t.length,r=[];for(let i=0;i<e;)if(i+this.capacity2<=e){let n=i+this.capacity2;xr(t,$Ie,i,n);for(let s=i;s<n;s+=this.capacity){let a=new Gb(t.slice(s,s+this.capacity));r.push(a)}i=i+this.capacity*this.capacity}else{let n=new Gb(t.slice(i,i+this.capacity));r.push(n),i=i+this.capacity}return r}search(t){this.flushWhenNeed();let e=[],r=[];if(this.itemList.length==0||this.root!=null&&t.isSeparated(this.root.bbox()))return e;for(r.push(this.root);;){let i=r.shift();if(typeof i<"u"){let n=i.items();if(n instanceof Array){for(let s of n)if(!t.isSeparated(s.bbox())){let a=s.items();a instanceof Array?s.bbox().isInside(t)?this.add2Result(s,e):r.push(s):e.push(a)}}else t.isSeparated(i.bbox())||e.push(n)}else break}return e}add2Result(t,e,r){if(t!==void 0){let i=t.items();if(i instanceof Array)for(let n of i)this.add2Result(n,e,r);else(!r||r(i))&&e.push(i)}}conditionQuery(t,e){this.flushWhenNeed();let r=[];if(this.itemList.length==0||this.root!=null&&t.isSeparated(this.root.bbox()))return!1;for(r.push(this.root);;){let i=r.shift();if(typeof i<"u"){let n=i.items();if(n instanceof Array){for(let s of n)if(!t.isSeparated(s.bbox())){let a=s.items();if(a instanceof Array)r.push(s);else if(e(a))return!0}}else if(!t.isSeparated(i.bbox())&&e(n))return!0}else break}return!1}walker(t){this.flushWhenNeed(),this._walker(this.root,0,t)}_walker(t,e,r){this.flushWhenNeed();let i=t.items();if(i instanceof Array)for(let n of i)this._walker(n,e+1,r);else r(i,e)}bbox(){return this.flushWhenNeed(),this.root.bbox()}};var qte=new Error("list is empty"),RE=class{constructor(t,e){this.prev=null;this.next=null;this.parent=t,this.item=e}insertAfter(t){t.next=this.next,this.next=t,t.prev=this,t.next!==null&&(t.next.prev=t)}insertBefore(t){t.prev=this.prev,this.prev=t,t.next=this,t.prev!==null&&(t.prev.next=t)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(t){this.item=t}},ZIe=class{constructor(t){this._next=t}hasNext(){return this._next!==null}next(){let t=this._next;if(t!==null)return this._next=t.next,t.item;throw new Error("iterator is null")}},JIe=class{constructor(t){this._next=t}hasNext(){return this._next!==null}next(){let t=this._next;if(t!==null)return this._next=t.next,t;throw new Error("iterator is null")}},On=class{constructor(){this.first=null;this.last=null;this.cnt=0}getFirstNode(){return this.last}getLastNode(){return this.last}add(t){return this.addLast(t)}push(t){return this.addLast(t)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let t=this.first;if(t===null)throw qte;return this.remove(t),t.item}removeLast(){let t=this.last;if(t===null)throw qte;return this.remove(t),t.item}addLast(t){return this.first===null||this.last===null?(this.first=new RE(this,t),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,t)}addFirst(t){if(this.first===null||this.last===null){let e=new RE(this,t);return this.first=e,this.last=e,this.cnt++,e}else return this.insertBefore(this.first,t)}getFirst(){if(this.first===null)throw qte;return this.first.item}getLast(){if(this.last===null)throw qte;return this.last.item}insertAfter(t,e){let r=new RE(this,e);return t.insertAfter(r),t===this.last&&(this.last=r),this.cnt++,r}insertBefore(t,e){let r=new RE(this,e);return t.insertBefore(r),t===this.first&&(this.first=r),this.cnt++,r}remove(t){t.remove(),t===this.first&&(this.first=t.next),t===this.last&&(this.last=t.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new ZIe(this.first)}listIterator(){return new JIe(this.first)}toArray(){let t=new Array(this.cnt),e=this.first,r=0;for(;e!=null&&(t[r]=e.item,e=e.next,r++,!(e==this.first||r==this.cnt)););return t}};function $te(o){throw new Error("")}var GB=class{constructor(t,e){this.node1=null;this.node2=null;this.key=t,this.value=e}},QIe=class{constructor(t){this.itors=t}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().key}},eCe=class{constructor(t){this.itors=t}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().value}},Bd=class{constructor(){this.innerList=new On;this.innerMap=new Map}replace(t,e){t.node1!==null&&(t.node1.set(e),e.node1=t.node1),t.node2!==null&&(t.node2.set(e),e.node2=t.node2)}clear(){this.innerList.clear(),this.innerMap.clear()}put(t,e){let r=t.hashCode(),i=new GB(t,e),n=this.innerMap.get(r);if(n===void 0)return i.node1=this.innerList.add(i),this.innerMap.set(r,i),null;if(n instanceof GB){if(n.key.equals(t))return this.innerMap.set(r,i),this.replace(n,i),n.value;{i.node1=this.innerList.add(i);let s=new On;return n.node2=s.add(n),i.node2=s.add(i),this.innerMap.set(r,s),null}}if(n instanceof On){let s=null;return kI(n,(a,l)=>l.key.equals(t)?(this.replace(l,i),s=l.value,!1):!0),s===null?(i.node1=this.innerList.add(i),i.node2=n.push(i),null):s}return $te(n)}get(t){let e=t.hashCode(),r=this.innerMap.get(e);if(r===void 0)return null;if(r instanceof GB)return r.key.equals(t)?r.value:null;if(r instanceof On){let i=null;return kI(r,(n,s)=>s.key.equals(t)?(i=s.value,!1):!0),i}return $te(r)}containsKey(t){return this.get(t)!==null}delete(t){t.node1!==null&&t.node1.parent.remove(t.node1),t.node2===null?this.innerMap.delete(t.key.hashCode()):t.node2.parent.remove(t.node2)}remove(t){let e=t.hashCode(),r=this.innerMap.get(e);if(r===void 0)return null;if(r instanceof GB)return r.key.equals(t)?(this.delete(r),r.value):null;if(r instanceof On){let i=null;return kI(r,(n,s)=>s.key.equals(t)?(i=s.value,this.delete(s),!1):!0),i}return $te(r)}computeIfAbsent(t,e){let r=this.get(t);if(r===null){let i=e(t);return this.put(t,i),i}else return r}size(){return this.innerList.size()}isEmpty(){return this.innerList.size()===0}keys(){return new QIe(this.innerList.iterator())}values(){return new eCe(this.innerList.iterator())}entries(){return this.innerList.iterator()}};var Ba=class{constructor(){this.innerMap=new Bd}add(t){return this.innerMap.put(t,!0)!==!0}remove(t){this.innerMap.remove(t)}contains(t){return this.innerMap.get(t)===!0}iterator(){return this.innerMap.keys()}addAll(t){let e=t.iterator();for(;e.hasNext();)this.add(e.next())}size(){return this.innerMap.size()}clear(){let t=this.iterator();for(;t.hasNext();){let e=t.next();this.remove(e)}}};var I8e=Re.funcCopy(xr);function T8e(o,t){let e=0;if(Math.abs(o.start.y-t)<=1e-4)Ee[e++]=o.start.x;else if(Math.abs(o.end.y-t)<=1e-4)Ee[e++]=o.end.x;else if(o.shape instanceof M)e=y8e(o.shape,t);else if(o.shape instanceof q)e=b8e(o.shape,t);else throw new Error("not supported operation");return e}var DE=class{constructor(t,e,r,i){this.sides=new Array;this.loader=t,this.loader.bo=this,this.logger=r,this.rule=e,this.event=i}static sortByBBoxMinY(t,e){return t.bbox().minY-e.bbox().minY}static sortByBBoxAreaDesc(t,e){return e.bbox().area()-t.bbox().area()}addPolyline(t,e=1,r=.01,i=!0){for(let n of this.loader.buildGroup(t,e,r,i))this.sides.push(n),this.event.onOriginSide(n)}buildRTree(){let t=new nn(10);for(let e of this.sides)t.add(e);return t}fillValidSides(t,e,r){for(let i of e)i.bbox().isContainsY1(r)&&isFinite(i.getX(r))&&t.push(i)}getSortedEndpointsLineAsc(t){let e=new Array;for(let n of t)n.needCountWeight()&&(e.push(n.start),e.push(n.end));I8e(e,S.sortByYAsc,0,e.length);let r=new Array,i=Number.NEGATIVE_INFINITY;for(let n of e){let s=n.y;s>i&&(r.push(s),i=s)}return r}splitSides(t,e,r){let i=t.start,n=t.end,s=new S(n.x+(i.x-n.x)*2,n.y+(i.y-n.y)*2);I8e(t.inters,(l,c)=>l.distance2(s)-c.distance2(s),0,t.inters.length);let a=null;for(let l of t.inters)if(a==null)l.equals(i)&&(a=l);else if(!l.equals(a)){let c=FS.rebuild(t.shape,a,l);c instanceof q&&Math.abs(c.sweepAngle)>190&&(c=new M(a,l));let h=new FS(this,c,t.baseWeight,a,l,t.polyGrp,r++);if(e.push(h),h.updateBbox(),l.equals(n))break;a=l}return r}splitSidesByInters(){let t=new Array;for(let e of this.sides)if(e.polyIndex==0){let r=0,i=null,n=null;do{let s=new Array;r=this.splitSides(e,s,r);for(let a of s)i!=null?(i.next=a,a.previous=i):n=a,i=a,this.event.onSplitedSide(a),t.push(a);if(e.next===null)throw new Error("not supported operation");e=e.next}while(e.polyIndex!==0);n!=null&&i!=null&&(n.previous=i,i.next=n)}this.sides.length=0;for(let e of t)this.sides.push(e)}seekIntersection(){if(this.sides.length>0){let t=this.buildRTree(),e=new Ba;for(let r of this.sides){e.add(r);let i=r.bbox().extendOfSize(1e-5),n=r.shape instanceof M;for(let s of t.search(i))if(!e.contains(s)){let a=s.shape instanceof M;if(!(n&&a&&r.next!==null&&r.previous!==null&&(r.next.equals(s)||r.previous.equals(s)))){let l=Tt(r.shape,s.shape);for(let c=0;c<l;c+=2){let h=new S(Ee[c],Ee[c+1]);r.inters.push(h),s.inters.push(h),this.event.onIntersect(h,r,s)}}}}}}};var AA=class{constructor(t){this.cache={};this.levels=t,this.result=new Array(t),this.weights=new Array(t),this.maxIdx=t-1,this.rule=this.decide.bind(this);let e=1;for(let r=0;r<t;r++)this.weights[r]=e,e*=50}weight(t){return this.weights[t]}decide(t){t=Math.abs(t);let e=this.cache[t];if(e===void 0){let r=t;for(let i=this.maxIdx;i>=0;i--){let n=this.weights[i],s=t/n|0,a=t%n;a>(n/2|0)?(t=n-a,s++):t=a,this.result[i]=s>0}e=this.decide1(this.result),this.cache[r]=e}return e}};var _A=o=>o!==0,C8e=o=>o>0;var vY=new class extends AA{decide1(t){return t[0]||t[1]}}(2),Kte=new class extends AA{decide1(t){return t[0]&&!t[1]}}(2),jnr=new class extends AA{decide1(t){return t[0]&&t[1]}}(2),qnr=new class extends AA{decide1(t){return t[0]&&!t[1]||!t[0]&&t[1]}}(2);var _x=class{constructor(t){this.bo=null;this.sides=new Array;this.polyGrp=0;this.polyIndex=0;this.prevSide=null;this.firstSide=null;this.noWeight0=t}completeGroup(t){this.prevSide!=null&&this.firstSide!=null&&!this.prevSide.end.equals(this.firstSide.start)&&this.addSide(new M(this.prevSide.end,this.firstSide.start),t);let e=new Array,r=null,i=null;for(let n of this.sides)(!this.noWeight0||n.weight!==0)&&(r!=null?(r.next=n,n.previous=r):i=n,r=n,e.push(n));return r!=null&&i!=null&&(i.previous=r,r.next=i),this.polyGrp++,this.sides.length=0,this.prevSide=null,this.firstSide=null,this.polyIndex=0,e}buildGroup(t,e,r,i=!0){for(let n of t.primitives)if(n instanceof M)this.addSide(n,e);else if(i&&n instanceof q&&n.rx===n.ry)this.addArc(n,e);else{let s=null;for(let a of n.points(r))s!=null&&this.addSide(new M(s,a),e),s=a}return this.completeGroup(e)}addArc(t,e){let r=t.sweepAngle,i=Ht.regularD(t.startAngle),n=i+r;if(r>0){let s=90;for(;s<=n;)s>i&&(this.addSide(q.build3(t.center,i,s-i,t.rx,t.ry),e),i=s),s+=90;i<n&&this.addSide(q.build3(t.center,i,n-i,t.rx,t.ry),e)}else if(r<0){let s=270;for(;s>=n;)s<i&&(this.addSide(q.build3(t.center,i,s-i,t.rx,t.ry),e),i=s),s-=90;i>n&&this.addSide(q.build3(t.center,i,n-i,t.rx,t.ry),e)}}addSide(t,e){if(t.start().equals(t.end()))return;let r=t.start(),i;this.prevSide!=null?(this.prevSide.end.equals(r)||this.addSide(new M(this.prevSide.end,r),e),i=new FS(this.bo,t,e,t.start(),t.end(),this.polyGrp,this.polyIndex++)):(i=new FS(this.bo,t,e,t.start(),t.end(),this.polyGrp,this.polyIndex++),this.firstSide=i),this.prevSide=i,this.sides.push(i)}};var vx=class{constructor(t,e,r){this.eps=new Array;this.curWeight=0;this.start=null;this.last=null;this.prevStart=null;this.prevEnd=null;this.y=r,this.rule=t,this.bo=e,this.event=e.event}onEp(t){this.tuningWeight(t),this.start===null?this.rule(this.curWeight)?this.in(t):t.setInvalid(this.y):this.rule(this.curWeight)?t.setInvalid(this.y):this.out(t,this.start),this.last!==null&&this.event.onSweep1(this.last,t,this.y),this.last=t}in(t){this.prevEnd!=null&&this.onSameX(t,this.prevEnd)?(this.start=this.prevStart,this.prevStart=null,this.prevEnd.revokeInside(this.y),this.prevEnd=null):(this.start=t,this.start.setOutside(this.y))}out(t,e){if(this.onSameX(e,t))e.revokeOutside(this.y);else{if(t.setInside(this.y)>0&&e.confidence(this.y)>0){let r=e.voteStatus(),i=t.voteStatus();this.isValid(r)&&this.isValid(i)?r==2&&i==1&&(t.connect.push(e),e.connect.push(t)):(t.connect.push(e),e.connect.push(t))}this.event.onSegment1(e,t,this.y),this.eps.push(e),this.eps.push(t),this.prevStart=e,this.prevEnd=t}this.start=null}isValid(t){return t==1||t==2}onSameX(t,e){return t.bbox().isIntersect(e.bbox())&&ne.eq(t.getX(this.y),e.getX(this.y))}tuningWeight(t){this.curWeight+=t.weight;let e=t.nextNot0(),r=t.prevNot0();e!=null&&t.weight===e.weight&&e.trans===this.y&&(this.curWeight-=t.weight),r!=null&&t.weight===r.weight&&r.trans===this.y&&(this.curWeight-=t.weight),t.trans=this.y}};var tCe=class extends BB{constructor(e){super(e);this.segments=new Array;this.y=NaN}onSegment(e,r,i,n,s,a){e=new S(i.getX(this.y),this.y),n=new S(a.getX(this.y),this.y),super.onSegment(e,r,i,n,s,a),this.segments.push(new M(e,n))}},wE=class extends DE{constructor(e){super(new _x(!0),_A,e,new tCe(!1));this.rtree=null;this.collector=this.event}addPolyline(e,r=1){super.addPolyline(e,r)}scan(e,r){this.rtree===null&&(this.rtree=this.buildRTree()),this.collector.y=e;let i=r.bbox().extendOfSize(1e-5),n=new Array;this.fillValidSides(n,this.rtree.search(i),e),xr(n,(l,c)=>l.getX(e)-c.getX(e),0,n.length);let s=new vx(this.rule,this,e);for(let l of n)s.onEp(l);let a=new Array;return Re.addAll(a,this.collector.segments),this.collector.segments.length=0,a}};function x9t(o){switch(o){case 0:return"DEBUG";case 1:return"INFO";case 2:return"WARNING";case 3:return"ERROR";case 4:return"DUMMY"}}var R9t=(o,t)=>{o===3?console.error(t):console.log(t)},D9t=(o,t)=>Td.format("%s %s: %s",new Date,x9t(o),t),UB=class UB{constructor(t,e=R9t,r=D9t){this.debug=!1;this.level=t,this.writer=e,this.fmt=r}static mix(...t){let e=4;for(let r of t)r.level<e&&(e=r.level);return new UB(e,(r,i)=>{for(let n of t)n.write1(r,i)},(r,i)=>i)}wrap(t=null,e=null){let r=t===null?this.fmt:(n,s)=>(s=t(n,s),this.fmt(n,s)),i=e===null?this.writer:(n,s)=>{e(n,s),this.writer(n,s)};return new UB(this.level,i,r)}chain(t){return t.wrap(this.fmt.bind(this),this.writer.bind(this))}include(t){return this.level<=t}write3(t,e,r){this.include(t)&&this.writer(t,this.fmt(t,Td.format(e,...r)))}write2(t,e){this.include(t)&&(e instanceof Error?this.writer(t,this.fmt(t,e.stack)):this.writer(t,this.fmt(t,e.toString())))}write1(t,e){this.include(t)&&this.writer(t,this.fmt(t,e))}debug3(t,...e){this.write3(0,t,e)}debug2(t){this.write2(0,t)}debug1(t){this.write1(0,t)}info3(t,...e){this.write3(1,t,e)}info2(t){this.write2(1,t)}info1(t){this.write1(1,t)}warning3(t,...e){this.write3(2,t,e)}warning2(t){this.write2(2,t)}warning1(t){this.write1(2,t)}error3(t,...e){this.write3(3,t,e)}error2(t){this.write2(3,t)}error1(t){this.write1(3,t)}};UB.DUMMY=new UB(4);var Gi=UB;function vA(o){let t=Qe.rotate(Math.PI/4),e=Qe.rotate(-Math.PI/4),r=o.multiply3(t),i=o.multiply3(e),n=o.bbox(),s=n.width(),a=n.height(),l=Math.max(1,Math.min(6,s)),c=Math.max(1,Math.min(6,a));o.primitives.length>4&&(s<10&&(l=1),a<10&&(c=1));let h=r.bbox(),u=i.bbox(),d=new Array,p=new wE(new Gi(1));p.addPolyline(r);for(let b=h.minY;b<=h.maxY;b+=l){let P=new M(new S(h.minX,b),new S(h.maxX,b));Re.addAll(d,p.scan(b,P))}let m=new Array,g=new wE(new Gi(1));g.addPolyline(i);for(let b=u.minY;b<=u.maxY;b+=c){let P=new M(new S(u.minX,b),new S(u.maxX,b));Re.addAll(m,g.scan(b,P))}let y=new Array;for(let b of d){let P=b.multiply3(e);y.push(P)}for(let b of m){let P=b.multiply3(t);y.push(P)}return y}var BI=class{constructor(t){this.center=new S(0,0);this.high=0;this.shapes=t,this.calcu()}calcu(){let e=this.shapes.bbox().center(),r=new Array;this.shapes.primitives.forEach(s=>{s instanceof M?this.calcuLine(s,e,r):this.calcuArc(s,e,r)}),xr(r,(s,a)=>a-s,0,r.length);let i=new Set,n=8;if(r.forEach(s=>{i.add(this.toFix(s,n))}),r=Array.from(i),r.length>1){this.center=new S(e.x,(r[0]+r[1])/2);let s=this.shapes instanceof Gt&&this.shapes.items.length>1;this.high=s?r[0]-r[1]:r[0]-r[r.length-1]}else this.center=e;this.optimization()}toFix(t,e=1){let r=Math.pow(10,e);return Math.round(t*r)/r}optimization(){if(this.high==0){let t=this.shapes.bbox();this.high=t.height(),this.center.equals(S.ORIGIN)&&(this.center=t.center())}}calcuLine(t,e,r){t.bbox().isContainsX(e.x)&&(t.isPoint()?r.push(t.start().y):t.b!=0&&r.push(-(t.a*e.x+t.c)/t.b))}calcuArc(t,e,r){let i=t.bbox();if(i.isContainsX(e.x)){let s=t.rx2-(e.x-t.center.x)*(e.x-t.center.x);if(s>=0){let a=Math.sqrt(s);i.isContainsY(t.center.y-a)&&r.push(t.center.y-a),i.isContainsY(t.center.y+a)&&r.push(t.center.y+a)}}}};var Zte=class o{constructor(t){this.sides=new Ba;this.others=new Ba;this.id=t}add(t){this.sides.add(t),t.finalGrp=this.id;for(let e of t.connect)this.others.add(e)}polyline(){let t=new Array;return kI(this.sides,(e,r)=>(t.push(r.shape),!0)),fe.build2(t).asClose()}hashCode(){return this.id}equals(t){return t!=null&&t instanceof o?this.id===t.id:!1}};var dT=class extends BB{constructor(e){super(e);this.plGrps=new Array}onPolylineGroup(e,r){super.onPolylineGroup(e,r),this.plGrps.push(e)}};var w9t=Re.funcCopy(xr),L9t=Re.funcCopy(xr),M9t=Re.funcCopy(xr);function N9t(o){return new Array}function xY(o,t){let e=new dT(!1),r=new FI(o,Gi.DUMMY,e);for(let i of t)r.addPolyline(i);return r.simplify(),e.plGrps}function Af(o,t){o=o.asClose();let e=xY(_A,[o]),r=[];for(let i of e)Re.addAll(r,i.items);if(t>0){for(let i of o.primitives)i instanceof M&&i.length()<1e-4||r.push(i.stroke(t*2,kr.ROUND,le.CW));return xY(_A,r)}else if(t<0){t=-t;for(let i of o.primitives)r.push(i.stroke(t*2,kr.ROUND,le.CCW));return xY(C8e,r)}else return e}var FI=class extends DE{constructor(e,r,i){super(new _x(!1),e,r,i);this.finalSides=new Array;this.sideGroups={};this.vecSides=new Array;this.scanY=NaN;this.curNetIndex=0;this.curIndex=-1;this.scanLines=0}sweep(e,r,i){this.scanY=NaN,this.scanLines=0,w9t(r,DE.sortByBBoxMinY,0,r.length);let n=new On;this.curNetIndex=0;let s=Number.POSITIVE_INFINITY;for(let a of e)a>s&&this.scan(n,(s+a)/2,r),s=a;this.getAllMarkPrimitive(i,r),this.logger.debug3("scan %s %d",i,this.scanLines)}simplify(){this.seekIntersection(),this.splitSidesByInters(),this.sweep(this.getSortedEndpointsLineAsc(this.sides),this.sides,!1),this.flipSides(),this.sweep(this.getSortedEndpointsLineAsc(this.vecSides),this.vecSides,!0),this.connectSides(),this.fillResult()}addPolyline(e,r=1,i=.01,n=!0){super.addPolyline(e,r,i,n)}scan(e,r,i){if(this.scanY==r)return;this.scanY=r;let n=!1,s=e.listIterator();for(;s.hasNext();){let a=s.next(),l=a.item;ne.less(l.bbox().maxY,r)?e.remove(a):!n&&l.isNeedScan(r)&&(n=!0)}for(;this.curNetIndex<i.length;){let a=i[this.curNetIndex];if(ne.less(a.bbox().minY,r))ne.greatereq(a.bbox().maxY,r)&&(this.add2AET(e,a),!n&&a.isNeedScan(r)&&(n=!0)),this.curNetIndex++;else break}if(n){this.scanLines++;let a=new vx(this.rule,this,r),l=e.iterator();for(;l.hasNext();){let c=l.next();a.onEp(c)}}}add2AET(e,r){let i=r.bbox().minX,n=r.bbox().maxX,s=r.bbox().minY,a=r.bbox().maxY,l=e.listIterator(),c=null;for(;l.hasNext();){let h,u=l.next(),d=u.item,p=d.bbox().minX,m=d.bbox().maxX;if(n<=p)h=-1;else if(m<=i)h=1;else{let y=d.bbox().minY,b=d.bbox().maxY,P=Math.max(s,y),T=Math.min(a,b);h=this.compareBySweep(r,d,(P+T)/2)}let g=d.shape;if(g instanceof M&&g.length()<.001&&c==null&&h<0){c=u;continue}if(c!=null&&h<0){e.insertBefore(c,r);return}if(h<0){e.insertBefore(u,r);return}else c=null}e.add(r)}getLineAngle(e){let r=e.start().angle(e.end());return r<0&&(r+=Math.PI),r}getArcAngle(e,r){let i=Math.asin((r-e.center.y)/e.rx);return e.startAngle>90&&e.startAngle<270&&(i=-i),i<0&&(i+=Math.PI),(i+Math.PI/2)%Math.PI}compareArcLine(e,r,i){let n=this.getArcAngle(e,i),s=this.getLineAngle(r);return ne.eq(n,s)?-e.sweepAngle:s-n}compareBySweep(e,r,i){let n=e.getX(i);if(!isFinite(n))return 0;let s=r.getX(i);if(!isFinite(s))return 0;if(!ne.eq(n,s))return n-s;if(e.shape instanceof M)return r.shape instanceof M?this.getLineAngle(r.shape)-this.getLineAngle(e.shape):-this.compareArcLine(r.shape,e.shape,i);if(r.shape instanceof M)return this.compareArcLine(e.shape,r.shape,i);{let a=e.shape,l=r.shape,c=this.getArcAngle(a,i),h=this.getArcAngle(l,i);return ne.eq(c,h)?a.sweepAngle*l.sweepAngle<=0?a.sweepAngle<=0?1:-1:a.sweepAngle>0?a.rx-l.rx:l.rx-a.rx:h-c}}getAllMarkPrimitive(e,r){for(let i of r)if(i.status===0&&i.bbox().height()!=0){let n=i.voteStatus();if(n===2||n===1){i.status=n;let s=i.reverse(n);if(e){this.event.onResultSide(s);let a=s.shape.multiply3(Qe.ROT_N90),l=s.start.multiply3(Qe.ROT_N90),c=s.end.multiply3(Qe.ROT_N90);s=new FS(this,a,s.baseWeight,l,c,s.polyGrp,s.polyIndex)}this.finalSides.push(s),this.event.onResultSide(s)}}}flipSides(){for(let e of this.sides)if(e.polyIndex==0){let r=null,i=null;do{let n=e.shape.multiply3(Qe.ROT_90),s=e.start.multiply3(Qe.ROT_90),a=e.end.multiply3(Qe.ROT_90),l=new FS(this,n,e.baseWeight,s,a,e.polyGrp,e.polyIndex);if(l.outsideWeight=e.outsideWeight,l.insideWeight=e.insideWeight,l.invalidWeight=e.invalidWeight,l.status=e.status,r!=null?(r.next=l,l.previous=r):i=l,this.vecSides.push(l),this.event.onSplitedSide(l),r=l,e.next!==null)e=e.next;else break}while(e.polyIndex!=0);i!=null&&(i.previous=r,r.next=i)}}canBeEnd(e,r){if(e.size()==1){let i=e.getFirst().shape;if(i instanceof q){if(r&&i.rx<=r)return!1}else if(i instanceof M&&r&&i.length()<=r)return!1}return!0}connectSides(){let e=new Bd,r=new nn(10);for(let a of this.finalSides)e.computeIfAbsent(a.start,N9t).push(a),r.add(a.start);let i=0,n=new Ba,s=new Array;for(let a of this.finalSides)if(!n.contains(a)){let l=new Ba,c=a.start,h=new On;h.add(a),n.add(a);let u=a.end;for(;h.size()>0;)if(this.isStart(c,u)&&this.canBeEnd(h,.01)){h.size()>1&&this.fillSideGroups(h,i++);break}else{let d=e.get(u),p=this.findNext(n,d,h);if(p==null&&(u=this.findNeigber(u,l,r,.01),u!==null&&(d=e.get(u),p=this.findNext(n,d,h))),p!=null)h.add(p),n.add(p),u=p.end;else if(u!=null?l.add(u):(s.length==0&&h.size()>1&&this.logger.warning3("unable to connect at %s",h.getLast()),s.push(h.removeLast())),h.size()>0)u=h.getLast().end;else break}}}fillSideGroups(e,r){let i=new Zte(r);kI(e,(n,s)=>(i.add(s),!0)),this.sideGroups[i.id]=i}isStart(e,r){return e.distance2(r)<=1e-4}findNext(e,r,i){if(r!=null){let n=null,s=null;for(let a of r)if(!e.contains(a)){let l=this.getDirect(a);if(n==null&&s==null)n=a,s=l;else{let c=s.cross(l);if(ne.greater(c,0))n=a,s=l;else if(ne.eq(c,0)&&i.size()>0){let h=i.getLast(),u=this.getDirect(h,!0),d=u.cross(l),p=u.cross(s);d<p&&(n=a,s=l)}}}return n}return null}getDirect(e,r=!1){let i=e.shape;if(i instanceof M)return i.direct;if(i instanceof q){let s=(r?i.end():i.start()).sub(i.center).normalize();return i.sweep()==le.CCW?new S(-s.y,s.x):new S(s.y,-s.x)}else return new S(1,0)}fillResult(){let e=0,r=new Bd;for(let n in this.sideGroups){let s=this.sideGroups[n];kI(s.sides,(a,l)=>(l.polyGrp!=-2&&r.put(l,l),!0))}let i=new Ba;for(let n in this.sideGroups){let s=this.sideGroups[n];if(i.add(s)){let a=0,l=new Array;for(l.push(s);a<l.length;){let h=l[a],u=new Array;kI(h.others,(p,m)=>{let g=r.get(m);return g!=null&&u.push(g.finalGrp),!0}),L9t(u,Re.sortAsc,0,u.length);let d=h.id;for(let p of u)if(p!=d&&p!=h.id){let m=this.sideGroups[p];i.add(m)&&l.push(m),d=p}a++}let c=new Array;for(let h of l)c.push(h.polyline());M9t(c,DE.sortByBBoxAreaDesc,0,c.length),this.event.onPolylineGroup(new Gt(c),e++)}}}findNeigber(e,r,i,n){let s=n*n,a=Number.MAX_VALUE,l=null;for(let c of i.search(e.bbox().extendOfSize(n)))if(!r.contains(c)){let h=e.distance2(c);h<a&&(a=h,l=c)}return a<s?l:null}};function Fd(o){if(o instanceof M)return o.length();if(o instanceof q){let t=Ht.toRadians(o.sweepAngle);return Math.abs(o.rx*t)}}function Xa(o,t,e,r,i){r===0&&i!=null&&(r=10/i);let{x:n,y:s}=o,a=n-t.x,l=s-t.y,c=n-e.x,h=s-e.y,u=e.x-t.x,d=e.y-t.y,p=new S(-d,u).normalize(),m=u+p.x*r/2,g=d+p.y*r/2,y=m*m+g*g,b=a*a+l*l,P=c*c+h*h,T=Math.abs(a*d-l*u)/2,C=Math.sqrt(u*u+d*d)*r/4;if(T<=C&&b<=y&&P<=y)return!0;{let E=r/2;return b<=E*E?!0:P<=E*E}}function Ng(o,t,e,r,i=le.CW){let n=t.sub(o).normalize(),s=new S(-n.y,n.x),a=Math.min(o.distance1(t),e)/2*r,l=s.mul((e-a*2)/2),c=n.mul(a),h=s.mul(a),u=o.add(l),d=o.sub(l),p=t.add(l),m=t.sub(l),g=u.add(c),y=d.add(c),b=p.sub(c),P=m.sub(c),T=g.add(h),I=b.add(h),C=y.sub(h),E=P.sub(h);if(i==le.CCW){let O=new M(u,d),_=new M(C,E),R=new M(m,p),v=new M(I,T),D=new Array;if(a>0){let w=q.build1(d,C,a,a,!1,le.CCW),F=q.build1(E,m,a,a,!1,le.CCW),H=q.build1(p,I,a,a,!1,le.CCW),z=q.build1(T,u,a,a,!1,le.CCW);for(let G of[O,w,_,F,R,H,v,z])G!=null&&Fd(G)>0&&D.push(G)}else for(let w of[O,_,R,v])w!=null&&Fd(w)>0&&D.push(w);return fe.build2(D).asClose()}else{let O=new M(d,u),_=new M(T,I),R=new M(p,m),v=new M(E,C),D=new Array;if(a>0){let w=q.build1(u,T,a,a,!1,le.CW),F=q.build1(I,p,a,a,!1,le.CW),H=q.build1(m,E,a,a,!1,le.CW),z=q.build1(C,d,a,a,!1,le.CW);for(let G of[O,w,_,F,R,H,v,z])G!=null&&Fd(G)>0&&D.push(G)}else for(let w of[O,_,R,v])w!=null&&Fd(w)>0&&D.push(w);return fe.build2(D)}}function S8e(o,t,e,r,i,n,s){let a=t.sub(o).normalize(),l=new S(-a.y,a.x),c=Math.min(o.distance1(t),e)/2*r,h=l.mul((e-c*2)/2),u=a.mul(c),d=l.mul(c),p=o.add(h),m=o.sub(h),g=t.add(h),y=t.sub(h),b=p.add(u),P=m.add(u),T=g.sub(u),I=y.sub(u),C=b.add(d),E=T.add(d),O=P.sub(d),_=I.sub(d),R=new M(m,p),v=new M(C,E),D=new M(g,y),w=new M(_,O),F=0;for(let H of[R,v,D,w]){if(H!=null&&Fd(H)>0&&Xa(n,H.start(),H.end(),i,s))return F*2;F++}return null}var yp=Math.PI*2;var LE=Math.PI/2,Jte=Math.PI/4,ysr=Math.sin(Math.PI/180);function pT(o){return o=o%yp,o<=-LE?o+=Math.PI:o>=LE&&(o-=Math.PI),o}function W2(o){return o/Math.PI*180}function VS(o){return o==null?Qc:o<=Qc?Qc:o}function bo(o){return o>Qc?o:Qc}function Qte(o){return o=o%yp,o<=-LE?o+=Math.PI:o>=LE&&(o-=Math.PI),o}function mh(o){return o/180*Math.PI}function MM(o){return o*180/Math.PI}function E8e(o){return o/180*Math.PI}function xe(o,t=1){let e=Math.pow(10,t);return Math.round(o*e+1e-10)/e}function rCe(o,t){var n,s;let e=Math.min((n=o.toString().split(".")[1])==null?void 0:n.length,(s=t.toString().split(".")[1])==null?void 0:s.length),r=o.toFixed(e+1),i=t.toFixed(e+1);return xe(+r)==xe(+i)}function uc(o,t=3){return xe((o%360+360)%360,t)}var th=class{constructor(t){this.eps=1e-8;this.precision=1e8;this.precision=t,this.eps=t}regular(t){return Math.round(t*this.precision)/this.precision}eq(t,e){return Math.abs(t-e)<=this.eps}neq(t,e){return Math.abs(t-e)>this.eps}less(t,e){return t-e<-this.eps}lesseq(t,e){return t-e<this.eps}greater(t,e){return t-e>this.eps}greatereq(t,e){return t-e>-this.eps}};var iCe=class{constructor(t,e,r){this._start=null;this._previous=null;this.next=null;this.interInStart=!1;this.intersInEnd=!1;this.othersIntersCount=0;this.shape=t,this.group=e,this.index=r,this._end=t.end()}reset(){this.interInStart=!1,this.intersInEnd=!1,this.othersIntersCount=0}set previous(t){this._previous=t,this.previous!=null&&(this._start=this.previous.shape.end())}get previous(){return this._previous}get start(){return this._start}get end(){return this._end}getNext(){let t=null,e=this.intersInEnd,r=this.next;for(;e&&r!=this;)if(r.interInStart){t=r;break}else r=r.next;return t}getStartDirect(){if(this.shape instanceof M)return this.shape.direct;if(this.shape instanceof q){let t=Math.abs((this.shape.startAngle+360)%360);return this.interInStart&&this.othersIntersCount==0&&(t=xe(t,1)),this.shape.sweep()==le.CCW?ne.greatereq(t,90)&&ne.less(t,270)?new S(0,-1):new S(0,1):ne.greater(t,90)&&ne.lesseq(t,270)?new S(0,1):new S(0,-1)}else return null}getEndDirect(){if(this.shape instanceof M)return this.shape.direct;if(this.shape instanceof q){let t=Math.abs((this.shape.endAngle()+360)%360);return this.intersInEnd&&this.othersIntersCount==0&&(t=xe(t,1)),this.shape.sweep()==le.CCW?ne.greater(t,90)&&ne.lesseq(t,270)?new S(0,-1):new S(0,1):ne.greatereq(t,90)&&ne.less(t,270)?new S(0,1):new S(0,-1)}else return null}},rh=class{constructor(){this.horizontal=new S(1,0)}pointInPolyline(t,e){if(!e.bbox().isContains(t))return!1;for(let n of e.primitives)if(this.inEdge(t,n))return!0;if(!this.isClose(e))return!1;let i=[];return e.points(.1,n=>{i.push(n)}),this.isSelect(t.x,t.y,i)}inEdge(t,e,r){let i=r?new th(r):ne,n=r||1e-8,s=e.bbox().extendOfSize(n);if(!s.isContains2(t.x,t.y))return!1;if(e instanceof M){let l=ir.foot(e,t).distance1(t);return i.eq(l,0)?s.isContains2(t.x,t.y):!1}else if(e instanceof q){let a=t.distance1(e.center);return i.eq(a,e.rx)?bf(e,t):!1}return!1}isSelect(t,e,r){let i=!1;for(let a=0,l=r.length-1;a<l;a++){let c=r[a],h=r[a+1];if(t==c.x&&e==c.y||t==h.x&&e==h.y)return!0;if(c.y<e&&h.y>=e||c.y>=e&&h.y<e){let u=c.x+(e-c.y)*(h.x-c.x)/(h.y-c.y);if(t==u)return!0;u>t&&(i=!i)}}let n=r[r.length-1],s=r[0];if(t==n.x&&e==n.y||t==s.x&&e==s.y)return!0;if(n.y<e&&s.y>=e||n.y>=e&&s.y<e){let a=n.x+(e-n.y)*(s.x-n.x)/(s.y-n.y);if(t==a)return!0;a>t&&(i=!i)}return i}isClose(t){return t.primitives.length>0&&t.primitives[0].start().distance2(t.primitives[t.primitives.length-1].end())<1e-8}map2Sides(t,e){let r=new Array,i=[];t.points(.1,a=>{i.push(a)}),t=fe.build4(i),t=t.closeEndpoint();let n=0,s=null;for(let a of t.primitives){let l=new iCe(a,e,n);s!=null&&(s.next=l,l.previous=s),r.push(l),s=l,n++}return r[r.length-1].next=r[0],r[0].previous=r[r.length-1],r}inEdge4Polyline(t,e,r){for(let i of e.primitives)if(this.inEdge(t,i,r))return!0;return!1}inPrimitive(t,e,r){return!!this.inEdge(t,e,r)}inPolyline(t,e,r=0,i=!1,n){let{x:s,y:a}=t;if(!(n?e.bbox().extendOfSize(n):e.bbox()).isContains1(s,a))return!1;if(!i){for(let c of e.primitives)if(this.inPrimitive(t,c,n))return!0}return!!e.getWindingNum(t)}inPolygon(t,e){let r=!1;for(let i of e)this.inPolyline(t,i)&&(r=!r);return r}},ere=class{inPolyline(t,e,r=0){let i=e.bbox(),{x:n,y:s}=t;return i.isContains1(n,s)?!!e.getWindingNum(t):!1}inPolygon(t,e){let r=!1;for(let i of e)this.inPolyline(t,i)&&(r=!r);return r}},Jr=new rh;function M1(o,t,e){return t.distance1(o)<=e}var VI=class{constructor(t,e,r,i,n){this.type=t,this.width=VS(e),this.height=VS(r),this.ratio=i,this.pl=n}getStrokePolyline(t,e,r,i){if(i===le.CW)try{return fe.build2([q.build3(t,-90,-180,r,r),q.build3(e,90,-180,r,r)])}catch(n){console.error(n)}else return fe.build2([q.build3(t,90,180,r,r),q.build3(e,-90,180,r,r)])}getStrokePolyline1(t,e,r,i){return i===le.CW?fe.build2([q.build3(t,0,-180,r,r),q.build3(e,180,-180,r,r)]):fe.build2([q.build3(t,180,180,r,r),q.build3(e,0,180,r,r)])}inShape(t,e,r,i,n){let s=n==null?1:n.getScale();switch(this.type){case"ELLIPSE":return M1(new S(t,e),r,this.width/2);case"OVAL":{let a=Ae.rotateZForPoint(r,i);if(this.width>this.height){let l=(this.width-this.height)/2,c=r.add1(-l,0).multiply4(a),h=r.add1(l,0).multiply4(a);return Xa(new S(t,e),c,h,this.height,s)}else if(this.height>this.width){let l=(this.height-this.width)/2,c=r.add1(0,-l).multiply4(a),h=r.add1(0,l).multiply4(a);return Xa(new S(t,e),c,h,this.width,s)}else{let l=this.width/2;return M1(new S(t,e),r,l)}}case"RECT":{let a=Ae.rotateZForPoint(r,-i),l=new S(t,e).multiply4(a),c=this.width/2,h=this.height/2,u=Math.min(c,h)*this.ratio,d=r.add1(-c,h),p=r.add1(-c,-h),m=r.add1(c,h),g=r.add1(c,-h),y=p.add1(u,u),b=g.add1(-u,u),P=m.add1(-u,-u),T=d.add1(u,-u);if(new ut(p.x,m.x,p.y,m.y).isContains(l)){if(l.x<y.x){if(l.y<y.y)return l.distance1(y)<=u;if(l.y>T.y)return l.distance1(T)<=u}if(l.x>b.x){if(l.y<b.y)return l.distance1(b)<=u;if(l.y>P.y)return l.distance1(P)<=u}return!0}else return!1}default:return Jr.inPolygon(new S(t,e),[this.pl])}}clone(){let t=this.pl;return this.pl!=null&&(t=t.clone()),$o.getStyle(this.type,this.width,this.height,this.ratio,t)}getShape(t,e,r){let{width:i,height:n,type:s}=this,a;switch(s){case"ELLIPSE":{let l=i/2+t;if(l<=0)return null;a=fe.build2([q.build2(e,0,360,l,l,le.CW)]);break}case"OVAL":{let l=Ae.getMatrix4(e.mul(-1),r,1,e);if(i>n){let c=(i-n)/2,h=n+t*2;if(h<=0)return null;a=this.getStrokePolyline(e.add(new S(-c,0)),e.add(new S(c,0)),h/2,le.CW)}else if(i<n){let c=(n-i)/2,h=i+t*2;if(h<=0)return null;a=this.getStrokePolyline1(e.add(new S(0,-c)),e.add(new S(0,c)),h/2,le.CW)}else{let c=i/2+t;if(c<=0)return null;a=fe.build2([q.build2(e,0,360,c,c,le.CW)])}a=a.multiply3(l.toMatrix3());break}case"RECT":{let l=Ae.getMatrix4(e.mul(-1),r,1,e),c=i/2+t;if(c<=0)return null;let h=n+t*2;if(h<=0)return null;a=Ng(e.add(new S(-c,0)),e.add(new S(c,0)),h,this.ratio),a=a.multiply3(l.toMatrix3());break}case"POLYGON":{a=this.pl,t!=0&&(a=NM(a,t));break}}return a==null?void 0:a.asClose()}remove(){}isSimilarTo(t){return this.type==t.type&&this.width==t.width&&this.height==t.height&&this.ratio==t.ratio&&this.type!="POLYGON"}};var nCe=class{constructor(){this.padStylePool=new Map}getPadStyleByType(t,e){return t==="ELLIPSE"?this.getStyle(t,e.width,e.width,e.ratio,e.pl):this.getStyle(t,e.width,e.height,e.ratio,e.pl)}getPadStyleByWidth(t,e){return e.type==="ELLIPSE"?this.getStyle(e.type,t,t,e.ratio,e.pl):this.getStyle(e.type,t,e.height,e.ratio,e.pl)}getPadStyleByHeight(t,e){return e.type==="ELLIPSE"?this.getStyle(e.type,t,t,e.ratio,e.pl):this.getStyle(e.type,e.width,t,e.ratio,e.pl)}getPadStyleByRatio(t,e){return this.getStyle(e.type,e.width,e.height,t,e.pl)}getPadStyleByPl(t,e){return this.getStyle(e.type,e.width,e.height,e.ratio,t)}getStyle(t,e,r,i,n){let s=this.generateStyleId({type:t,width:e,height:r,ratio:i,pl:n});if(this.padStylePool.has(s))return this.padStylePool.get(s);{let a=new VI(t,e,r,i,n);return this.padStylePool.set(s,a),a}}generateStyleId(t){let{type:e,width:r,height:i,ratio:n,pl:s}=t;return s?`${e}_${r}_${i}_${n}_${JSON.stringify(s)}`:`${e}_${r}_${i}_${n}`}},$o=new nCe;function O8e(o,t,e,r,i,n,s){let a=new _e;switch(i){case"ROUND":{let l=s.add(o);return a.ext2(l).ext7(r),a.build1()}case"SLOT":{let l=(e-r*2)/2,c=Ae.getMatrix4(S.ORIGIN,n+t,1,s.add(o)),h=new S(-l,0).multiply4(c),u=new S(l,0).multiply4(c);return a.ext2(h).ext2(u).ext7(r),a.build1()}case"RECT":{let l=s.add(o),c=n+t,h=Ae.getMatrix4(S.ORIGIN,c,1,l);return new ut(-e/2,e/2,-r,r).transform(h.toMatrix3())}default:throw new Error("this hole style is not supported !!!")}}var xx=class{constructor(t,e,r,i,n){let s=VS(e*2);t=VS(t),r=="ROUND"&&(t=s),s>t&&(t=s),e=s/2,this.holeLength=t,this.holeRadius=e,this.holeShape=r,this.holeRotation=i,this.holeOffset=n}getHolebbox(t,e){return O8e(t,e,this.holeLength,this.holeRadius,this.holeShape,this.holeRotation,this.holeOffset)}inShape(t,e,r,i,n){let s=n==null?1:n.getScale();switch(this.holeShape){case"ROUND":{let a=this.holeOffset.add(r);return M1(new S(t,e),a,this.holeRadius)}case"SLOT":{let a=(this.holeLength-this.holeRadius*2)/2,l=Ae.rotateZ(this.holeRotation+i).translate1(this.holeOffset.x+r.x,r.y+this.holeOffset.y,0),c=new S(-a,0).multiply4(l),h=new S(a,0).multiply4(l);return Xa(new S(t,e),c,h,this.holeRadius,s)}case"RECT":{let a=this.holeOffset.add(r),l=this.holeRotation+i,c=Ae.rotateZForPoint(a,-l),h=this.holeLength/2;return new ut(a.x-h,a.x+h,a.y-this.holeRadius,a.y+this.holeRadius).isContains(a.multiply4(c))}default:throw new Error("this hole style is not supported !!!")}}getShape(t,e,r){let i=Ae.rotateZ(this.holeRotation).translate1(this.holeOffset.x,this.holeOffset.y,0).rotateZ(r).translate1(e.x,e.y,0),n=S.ORIGIN,s;if(this.holeShape=="ROUND")s=fe.build2([q.build2(n,0,-360,this.holeRadius+t,this.holeRadius+t,le.CW)]);else if(this.holeShape=="RECT"){let a=this.holeRadius*2+t*2,l=n.add1(-this.holeRadius-t,0),c=n.add1(this.holeRadius+t,0);s=new M(l,c).stroke(a,kr.BUTT,le.CW).asClose()}else{let a=this.holeLength-this.holeRadius*2,l=n.add1(-a/2,0),c=n.add1(a/2,0);s=new M(l,c).stroke(this.holeRadius*2+t*2,kr.ROUND,le.CW).asClose()}return s.multiply3(i.toMatrix3())}clone(){return vc.getHoleStyle(this.holeLength,this.holeRadius,this.holeShape,this.holeRotation,this.holeOffset)}remove(){}};var oCe=class{constructor(){this.holePool=new Map}getHoleStyleByLength(t,e){return this.getHoleStyle(t,e.holeRadius,e.holeShape,e.holeRotation,e.holeOffset)}getHoleStyleByRadius(t,e){return this.getHoleStyle(e.holeLength,t,e.holeShape,e.holeRotation,e.holeOffset)}getHoleStyleByShape(t,e){return this.getHoleStyle(e.holeLength,e.holeRadius,t,e.holeRotation,e.holeOffset)}getHoleStyleByRotation(t,e){return this.getHoleStyle(e.holeLength,e.holeRadius,e.holeShape,t,e.holeOffset)}getHoleStyleByOffset(t,e){return this.getHoleStyle(e.holeLength,e.holeRadius,e.holeShape,e.holeRotation,t)}getHoleStyle(t,e,r,i,n){if(t==null||e==null||r==null||i==null||n==null)return null;let s=this.generateStyleId({holeLength:t,holeRadius:e,holeShape:r,holeRotation:i,holeOffset:n});if(this.holePool.has(s))return this.holePool.get(s)||null;{let a=new xx(t,e,r,i,n);return this.holePool.set(s,a),a}}generateStyleId(t){let{holeLength:e,holeRadius:r,holeShape:i,holeRotation:n,holeOffset:s}=t;return`${i}_${e}_${r}_${n}_${s.x}_${s.y}`}},vc=new oCe;var T0=class{static _getCode(t){return t<0&&(t=0),this.code=1,this.code=this.code<<t,this.code}static _has(t,e){return(e&t)>0}static _add(t,e){return this._has(t,e)||(t+=e),t}static isVisible(t){return(t&7)==1}static setVisible(t){return this.isVisible(t)||(t=(t>>3<<3)+1),t}static isHidden(t){return(t&7)==0}static setHidden(t){return this.isHidden(t)||(t=t>>3<<3),t}static isSelect(t){return(t&7)==3}static setSelect(t){return this.isSelect(t)||(t=(t>>3<<3)+3),t}static isHover(t){return(t&7)==5}static setHover(t){return this.isHover(t)||(t=(t>>3<<3)+5),t}static _remove(t,e){return this._has(t,e)&&(t-=e),t}static _updateCodeState(t,e,r){return r?this._add(t,e):this._remove(t,e)}static has(t,e){return this._has(t,this._getCode(e))}static add(t,e){return this._add(t,this._getCode(e))}static remove(t,e){return this._remove(t,this._getCode(e))}static update(t,e,r){return this._updateCodeState(t,this._getCode(e),r)}};T0.code=1;var ME=class{constructor(){this._dataState=0}hasDataState(t){return T0.has(this._dataState,t)}setDataState(t,e){this._dataState=T0.update(this._dataState,t,e)}setHidden(){this._dataState=T0.setHidden(this._dataState)}setVisible(){this._dataState=T0.setVisible(this._dataState)}setSelect(){this._dataState=T0.setSelect(this._dataState)}setHover(){this._dataState=T0.setHover(this._dataState)}};var z2=class extends ME{get zIndex(){return this._zIndex||-1}set zIndex(t){this._zIndex=t}get number(){return this._number!=null?this._number:-1}set number(t){this._number=t}get globalIndex(){return this._globalIndex}set globalIndex(t){this._globalIndex=t}get partition(){return this._partition||""}set partition(t){t==""&&this._partition==null||(this._partition=t)}get layerModified(){return this.hasDataState(3)}set layerModified(t){t&&(this.layerOrBoxModified=!0),this.setDataState(3,t)}get layerOrBoxModified(){return this.hasDataState(6)}set layerOrBoxModified(t){this.setDataState(6,t)}get shapeModified(){return this.hasDataState(5)}set shapeModified(t){this.setDataState(5,t)}get netModified(){return this.hasDataState(4)}set netModified(t){this.setDataState(4,t)}getParent(){return this._parent}setParent(t){this._parent=t}getGroupID(){return this._groupID||void 0}setGroupID(t){t?this._groupID=t:delete this._groupID}rotateFor(t,e){let r=Ae.rotateZForPoint(t,e);this.transform(r)}remove(){}update4Childs(){}};var ki=class extends z2{get refreshBBox(){return this.hasDataState(1)}set refreshBBox(t){t&&(this.layerOrBoxModified=!0),this.setDataState(1,t)}get stateWatcher(){return this._stateWatcher}get isEmpty(){return this.hasDataState(2)}set isEmpty(t){t&&(this.layerOrBoxModified=!0),this.setDataState(2,t)}constructor(t){super(),this.setModelWatcher(t)}get center(){return S.ORIGIN}setModelWatcher(t){this._stateWatcher=t}resetDataState(){let t=this.isEmpty,e=this.refreshBBox,r=this.layerOrBoxModified;this._dataState=0,this.isEmpty=t,this.refreshBBox=e,this.layerOrBoxModified=r}updateShapeData(){this._parent!=null&&this._parent.update4Childs(),this.refreshBBox=!0,this.shapeModified=!0,this.watchBBoxModify()}watchBBoxModify(){this._stateWatcher&&this._stateWatcher.setBBoxModify&&this._stateWatcher.setBBoxModify()}watchLayerIdModify(t){this._stateWatcher&&this._stateWatcher.setLayerModify&&this._stateWatcher.setLayerModify(t)}recycle(){this.isEmpty=!0,this.watchBBoxModify(),super.remove(),this._stateWatcher=void 0}remove(){this.recycle()}inOutline(t,e){return this.inShape(t.x,t.y,e)}buildBBox(){return this.isEmpty?null:(this.refreshBBox?(this._bbox=this.updateBox(),this.refreshBBox=!1):this._bbox||(this._bbox=this.bbox||this.updateBox()),this._bbox)}getMathGraphics(t,e){let r=this.buildBBox();if(r!=null){let i=new Array,n=new M(r.LL(),r.LR()),s=new M(r.LR(),r.UR()),a=new M(r.UR(),r.UL()),l=new M(r.UL(),r.LL());return i.push(n),i.push(s),i.push(a),i.push(l),fe.build2(i)}else return null}};var sCe=class{constructor(){this.padRulePool=new Map}getPadRuleByconnectMode(t,e){return this.getPadRule(t,e.lineClearance,e.lineWidth,e.lineAngle)}getPadRuleBylineClearance(t,e){return this.getPadRule(e.connectMode,t,e.lineWidth,e.lineAngle)}getPadRuleBylineWidth(t,e){return this.getPadRule(e.connectMode,e.lineClearance,t,e.lineAngle)}getPadRuleBylineAngle(t,e){return this.getPadRule(e.connectMode,e.lineClearance,e.lineWidth,t)}getPadRule(t,e,r,i){let n=this.generateId({connectMode:t,lineAngle:i,lineClearance:e,lineWidth:r}),s=this.padRulePool.get(n);return s!=null||(t===0?s=new _f(t,e,r,i):s=new _f(t),this.padRulePool.set(n,s)),s}generateId(t){let{connectMode:e,lineAngle:r,lineClearance:i,lineWidth:n}=t;return e===0?`${e}_${r}_${i}_${n}`:`${e}`}},Su=new sCe;var _f=class{static buildByJson(t){if(t)return t.connectMode===0?Su.getPadRule(t.connectMode,t.lineClearance,t.lineWidth,t.lineAngle):Su.getPadRule(t.connectMode)}constructor(t,e,r,i){this.connectMode=t,t===0&&(this.lineClearance=e,this.lineWidth=r,this.lineAngle=i)}toJSON(){return{lineAngle:this.lineAngle,lineWidth:this.lineWidth,lineClearance:this.lineClearance,connectMode:this.connectMode}}clone(){return this.connectMode===0?Su.getPadRule(this.connectMode,this.lineClearance,this.lineWidth,this.lineAngle):Su.getPadRule(this.connectMode)}};var NE=class{static compress(t){if(!t)return 0;let e=0;for(let r of t)e+=1<<r-15;return e}static decompress(t){let e=[];for(let r=0;r<31;r++)t>>r&1&&e.push(r+15);return e}};var wi=class{constructor(){this.map=new Map;this._last=void 0}getItem(t){return this.map.get(t)}getAllItem(){let t=new Array(this.map.size),e=this.map.values(),r=0;for(let i of e)t[r]=i,r++;return t}iterator(t){this.map.forEach((e,r)=>{t(e,r)})}iteratorBreakable(t){for(let[e,r]of this.map)if(t(r,e)===!1)break}get itemsCount(){return this.map.size}recycle(){this.map.clear()}deleteById(t){this.map.delete(t)}};var Y2=class{constructor(t){this._name=t}get name(){return this._name}set name(t){this._name=t}};var j2=class extends Y2{constructor(){super(...arguments);this._safeSpacing="default";this._trackPhysics="default";this._creepageSpacing="default";this._differentialPhysics="default";this._netLengthPhysics="default";this._netLengthTolerancePhysics=null;this._targetNet=null;this._blindViaPhysics="default";this._radiusPhysics="default";this._innerPlane="default";this._copperPlane="default";this._solderExpansion="default";this._pasteExpansion="default";this._safeCopperPlane=null;this._safeInnerPlane=null}get safeSpacing(){return this._safeSpacing}set safeSpacing(e){this._safeSpacing=e}get creepageSpacing(){return this._creepageSpacing}set creepageSpacing(e){this._creepageSpacing=e}get trackPhysics(){return this._trackPhysics}set trackPhysics(e){this._trackPhysics=e}get netLengthPhysics(){return this._netLengthPhysics}set netLengthPhysics(e){this._netLengthPhysics=e}get netLengthTolerancePhysics(){return this._netLengthTolerancePhysics}set netLengthTolerancePhysics(e){this._netLengthTolerancePhysics=e}get targetNet(){return this._targetNet}set targetNet(e){this._targetNet=e}get differentialPhysics(){return this._differentialPhysics}set differentialPhysics(e){this._differentialPhysics=e}get blindViaPhysics(){return this._blindViaPhysics}set blindViaPhysics(e){this._blindViaPhysics=e}get radiusPhysics(){return this._radiusPhysics}set radiusPhysics(e){this._radiusPhysics=e}get innerPlane(){return this._innerPlane}set innerPlane(e){this._innerPlane=e}get copperPlane(){return this._copperPlane}set copperPlane(e){this._copperPlane=e}get safeInnerPlane(){return this._safeInnerPlane}set safeInnerPlane(e){this._safeInnerPlane=e}get safeCopperPlane(){return this._safeCopperPlane}set safeCopperPlane(e){this._safeCopperPlane=e}get solderExpansion(){return this._solderExpansion}set solderExpansion(e){this._solderExpansion=e}get pasteExpansion(){return this._pasteExpansion}set pasteExpansion(e){this._pasteExpansion=e}};var kM=class kM{constructor(){this.actions=new Array}static getInstance(){return kM.ins==null&&(kM.ins=new kM),kM.ins}attach(t){this.actions.push(t)}sycnColor(t,e){for(let r of this.actions)r.doAction(t,e)}};kM.ins=null;var BM=kM;var bp=class o extends j2{constructor(e,r="default",i="default",n="default",s="default",a=null,l="default",c="default",h="default",u="default",d="default",p="default",m=null,g=null,y=null,b=!0,P=null,T="default"){super(e);this._netClassName=null;this._equalLengthGroupName=null;this._netDifferentialName=null;this._showRatline=!0;this._color=null;this._safeSpacing=r,this._trackPhysics=i,this._differentialPhysics=n,this._netLengthPhysics=s,this._netLengthTolerancePhysics=a,this._blindViaPhysics=l,this._radiusPhysics=c,this._innerPlane=h,this._copperPlane=u,this._solderExpansion=d,this._pasteExpansion=p,this._netClassName=m,this._equalLengthGroupName=g,this._netDifferentialName=y,this._showRatline=b,this._color=P,this._creepageSpacing=T,BM.getInstance().sycnColor(this.name,P)}hasNet(e){return this.name!=null&&this.name==e}get color(){return this._color}set color(e){this._color=e,BM.getInstance().sycnColor(this.name,e)}get showRatline(){return this._showRatline}set showRatline(e){this._showRatline=e}get netLengthPhysics(){return this._netLengthPhysics}set netLengthPhysics(e){this._netLengthPhysics=e,this.equalLengthGroup!=null&&(this.equalLengthGroup.netLengthPhysics=e)}get netLengthTolerancePhysics(){return this._netLengthTolerancePhysics}set netLengthTolerancePhysics(e){this._netLengthTolerancePhysics=e,this.equalLengthGroup!=null&&(this.equalLengthGroup.netLengthTolerancePhysics=e)}get netClass(){return te.getInstance().getNetClass(this._netClassName)}set netClass(e){e!=null?this._netClassName=e.name:this._netClassName=null}get equalLengthGroup(){return te.getInstance().getEqualLengthGroup(this._equalLengthGroupName)}set equalLengthGroup(e){e!=null?this._equalLengthGroupName=e.name:this._equalLengthGroupName=null}get differentialPhysics(){return this._differentialPhysics}set differentialPhysics(e){this._differentialPhysics=e,this.netDifferential!=null&&(this.netDifferential.differentialPhysics=e)}get netDifferentialName(){return this._netDifferentialName}get netDifferential(){return te.getInstance().getNetDifferential(this._netDifferentialName)}set netDifferential(e){e!=null?this._netDifferentialName=e.name:this._netDifferentialName=null}get isPositiveNet(){return this.netDifferential!=null?this.netDifferential.positiveNet==this:!1}remove(){this.netClass!=null&&this.netClass.removeNetwork(this._name),this.equalLengthGroup!=null&&this.equalLengthGroup.removeNetwork(this._name)}clone(){return new o(this.name,this._safeSpacing,this._trackPhysics,this._differentialPhysics,this._netLengthPhysics,this.netLengthTolerancePhysics,this._blindViaPhysics,this._radiusPhysics,this._innerPlane,this._copperPlane,this._solderExpansion,this._pasteExpansion,this._netClassName,this._equalLengthGroupName,this._netDifferentialName,this._showRatline,this._color,this._creepageSpacing)}toJSON(){return{name:this.name,safeSpacing:this._safeSpacing,trackPhysics:this._trackPhysics,differentialPhysics:this._differentialPhysics,netLengthPhysics:this._netLengthPhysics,netLengthTolerancePhysics:this._netLengthTolerancePhysics,blindViaPhysics:this._blindViaPhysics,radiusPhysics:this._radiusPhysics,innerPlane:this._innerPlane,copperPlane:this._copperPlane,solderExpansion:this._solderExpansion,pasteExpansion:this._pasteExpansion,netClassName:this._netClassName,equalLengthGroupName:this._equalLengthGroupName,netDifferentialName:this._netDifferentialName,targetNet:this._targetNet,creepageSpacing:this._creepageSpacing}}};var Eu=class o extends j2{constructor(e,r="default",i="default",n="default",s="default",a=null,l="default",c="default",h="default",u="default",d="default",p="default",m="default",g=new Set){super(e);this._nets=new Set;this.update(r,i,n,s,a,l,c,h,u,d,p,m,g)}getNets(){return this._nets}update(e="default",r="default",i="default",n="default",s=null,a="default",l="default",c="default",h="default",u="default",d="default",p="default",m=new Set){this._safeSpacing=e,this._trackPhysics=r,this._differentialPhysics=i,this._netLengthPhysics=n,this._netLengthTolerancePhysics=s,this._blindViaPhysics=a,this._radiusPhysics=l,this._innerPlane=c,this._copperPlane=h,this._solderExpansion=u,this._pasteExpansion=d,this._creepageSpacing=p,this._nets.clear(),Re.addAllSet(this._nets,m)}hasNet(e){return this._nets.has(e)}addNetwork(e){this._nets.add(e.name),e.netClass=this}getNet(e){return this._nets.has(e)?te.getInstance().getNet(e):null}removeNetwork(e){if(this._nets.has(e)){let r=te.getInstance().getNet(e);r!=null&&r.netClass===this&&(r.netClass=null),this._nets.delete(e),e==this.targetNet&&(this.targetNet=null)}}getAllNets(){let e=new Array;for(let r of this._nets){let i=te.getInstance().getNet(r);e.push(i)}return e}remove(){for(let e of this._nets){let r=te.getInstance().getNet(e);r!=null&&r.netClass===this&&(r.netClass=null)}this._nets.clear()}clone(){let e=new o(this._name,this._safeSpacing,this._trackPhysics,this._differentialPhysics,this._netLengthPhysics,this._netLengthTolerancePhysics,this._blindViaPhysics,this._radiusPhysics,this._innerPlane,this._copperPlane,this._solderExpansion,this._pasteExpansion,this._creepageSpacing,new Set(this._nets));return e._targetNet=this._targetNet,e}toJSON(){return{name:this.name,safeSpacing:this._safeSpacing,trackPhysics:this._trackPhysics,differentialPhysics:this._differentialPhysics,netLengthPhysics:this._netLengthPhysics,netLengthTolerancePhysics:this._netLengthTolerancePhysics,blindViaPhysics:this._blindViaPhysics,radiusPhysics:this._radiusPhysics,innerPlane:this._innerPlane,copperPlane:this._copperPlane,solderExpansion:this._solderExpansion,pasteExpansion:this._pasteExpansion,targetNet:this._targetNet,creepageSpacing:this._creepageSpacing,nets:new Set(this._nets)}}};var Vd=class o extends j2{constructor(e,r="default",i="default",n="default",s="default",a=null,l="default",c="default",h="default",u="default",d="default",p="default",m="default",g=new Set){super(e);this._nets=new Set;this.update(r,i,n,s,a,l,c,h,u,d,p,m,g)}update(e="default",r="default",i="default",n="default",s=null,a="default",l="default",c="default",h="default",u="default",d="default",p="default",m=new Set){this._safeSpacing=e,this._trackPhysics=r,this._differentialPhysics=i,this._netLengthPhysics=n,this._netLengthTolerancePhysics=s,this._blindViaPhysics=a,this._radiusPhysics=l,this._innerPlane=c,this._copperPlane=h,this._solderExpansion=u,this._pasteExpansion=d,this._creepageSpacing=p,this._nets.clear(),Re.addAllSet(this._nets,m)}hasNet(e){return this._nets.has(e)}getNet(e){return this._nets.has(e)?te.getInstance().getNet(e):null}addNetwork(e){this._nets.add(e.name)}removeNetwork(e){if(this._nets.has(e)){let r=te.getInstance().getNet(e);r!=null&&r.equalLengthGroup===this&&(r.equalLengthGroup=null),this._nets.delete(e),e==this.targetNet&&(this.targetNet=null)}}getAllNetIds(){return Array.from(this._nets)}getAllNets(){let e=new Array;for(let r of this._nets){let i=te.getInstance().getNet(r);i!=null&&e.push(i)}return e}remove(){for(let e of this._nets){let r=te.getInstance().getNet(e);r!=null&&r.equalLengthGroup===this&&(r.equalLengthGroup=null)}this._nets.clear()}addEqualLengthGroup(e){this._nets.add(e.name),e.equalLengthGroup=this}getEqualLengthGroup(e){}getNets(){return this._nets}deleteNet(e){return this._nets.delete(e)}clone(){let e=new o(this._name,this._safeSpacing,this._trackPhysics,this._differentialPhysics,this._netLengthPhysics,this._netLengthTolerancePhysics,this._blindViaPhysics,this._radiusPhysics,this._innerPlane,this._copperPlane,this._solderExpansion,this._pasteExpansion,this._creepageSpacing,new Set(this._nets));return e._targetNet=this._targetNet,e}toJSON(){return{name:this.name,safeSpacing:this._safeSpacing,trackPhysics:this._trackPhysics,differentialPhysics:this._differentialPhysics,netLengthPhysics:this._netLengthPhysics,netLengthTolerancePhysics:this._netLengthTolerancePhysics,blindViaPhysics:this._blindViaPhysics,radiusPhysics:this._radiusPhysics,innerPlane:this._innerPlane,copperPlane:this._copperPlane,solderExpansion:this._solderExpansion,pasteExpansion:this._pasteExpansion,nets:new Set(this._nets),targetNet:this._targetNet,creepageSpacing:this._creepageSpacing}}};var kg=class o{constructor(t,e,r,i){this._ruleName=null;this._safeCopperPlane=null;this._safeInnerPlane=null;this._creepageRule=null;this._net1Type=t,this._net1=e,this._net2Type=r,this._net2=i}get ruleName(){return this._ruleName}set ruleName(t){this._ruleName=t}get creepageRule(){return this._creepageRule}set creepageRule(t){this._creepageRule=t}getNet(t,e){switch(t){case"net":return te.getInstance().getNet(e);case"netClass":return te.getInstance().getNetClass(e);case"equalLengthGroup":return te.getInstance().getEqualLengthGroup(e);default:return null}}get net1(){return this.getNet(this._net1Type,this._net1)}get net2(){return this.getNet(this._net2Type,this._net2)}get safeInnerPlane(){return this._safeInnerPlane}set safeInnerPlane(t){this._safeInnerPlane=t}get safeCopperPlane(){return this._safeCopperPlane}set safeCopperPlane(t){this._safeCopperPlane=t}getNets(t){if(t instanceof bp)return[t.name];if(t instanceof Eu||t instanceof Vd){let e=t.getAllNets(),r=[];return e.forEach(i=>{r.push(i.name)}),r}return[]}equals(t){if(this.net1==t.net1&&this._net1Type==t._net1Type&&this.net2==t.net2&&this._net2Type==t._net2Type||this.net1==t.net2&&this._net1Type==t._net2Type&&this.net2==t.net1&&this._net2Type==t._net1Type)return!0}clone(){let t=new o(this._net1Type,this._net1,this._net2Type,this._net2);return t._ruleName=this._ruleName,t._safeCopperPlane=this._safeCopperPlane,t._safeInnerPlane=this._safeInnerPlane,t._creepageRule=this._creepageRule,t}};var tre=class o extends Y2{constructor(){super(...arguments);this.rule=new Array;this.cacheRuleMap=new Array}addRule(e){this.rule.push(e)}deltetRule4Net(e){this.deleteRule(this.rule,e)}getRule(e,r){for(let i of this.rule)if(i._net1==e&&i._net2==r||i._net1==r&&i._net2==e)return i;return null}getRuleWithType(e,r,i,n){for(let s of this.rule)if(s._net1Type===e&&s._net1===r&&s._net2Type===i&&s._net2===n||s._net1Type===i&&s._net1===n&&s._net2Type===e&&s._net2===r)return s;return null}deleteRule4(e,r){let i=this.rule.findIndex(n=>n._net1==e&&n._net2==r||n._net1==r&&n._net2==e);if(i>-1){let n=this.rule[i];this.cacheRuleMap.push({net1Type:n._net1Type,net1:n._net1,net2Type:n._net2Type,net2:n._net2,ruleName:n.ruleName,creepageRule:n.creepageRule,safeCopperPlane:n.safeCopperPlane,safeInnerPlane:n.safeInnerPlane}),this.rule.splice(i,1)}}deleteRuleWithType(e,r,i,n){let s=this.rule.findIndex(a=>a._net1Type===e&&a._net1===r&&a._net2Type===i&&a._net2===n||a._net1Type===i&&a._net1===n&&a._net2Type===e&&a._net2===r);if(s>-1){let a=this.rule[s];this.cacheRuleMap.push({net1Type:a._net1Type,net1:a._net1,net2Type:a._net2Type,net2:a._net2,ruleName:a.ruleName,creepageRule:a.creepageRule,safeCopperPlane:a.safeCopperPlane,safeInnerPlane:a.safeInnerPlane}),this.rule.splice(s,1)}}rebuild(e){if(this.cacheRuleMap.length){for(let r of this.cacheRuleMap){let{net1Type:i,net1:n,net2Type:s,net2:a,ruleName:l,creepageRule:c,safeCopperPlane:h,safeInnerPlane:u}=r;if(n==e.name||a==e.name){let d=this.getRule(n,a);d||(d=new kg(i,n,s,a),this.addRule(d)),d.ruleName=l,d.creepageRule=c,d.safeCopperPlane=h,d.safeInnerPlane=u}}this.cacheRuleMap.length=0}}deleteRule(e,r){let i=Array.from(e);for(let n of i)if(n.net1==r||n.net2==r){let s=e.indexOf(n);s>=0&&(this.cacheRuleMap.push({net1Type:n._net1Type,net1:n._net1,net2Type:n._net2Type,net2:n._net2,ruleName:n.ruleName,creepageRule:n.creepageRule,safeCopperPlane:n.safeCopperPlane,safeInnerPlane:n.safeInnerPlane}),e.splice(s,1))}}clone(){let e=new o(this._name);for(let r of this.rule)e.addRule(r.clone());return e}};var xA=class{constructor(t,e,r,i,n,s=!0,a=-1){this._isKeepIsland=!0;this.zIndex=-1;this._layerId=t,this._thickness=r,this._permittivity=i,this._lossTangent=n,this._material=e,this._isKeepIsland=s,this.zIndex=a}get layerId(){return this._layerId}get material(){return this._material}set material(t){this._material=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get permittivity(){return this._permittivity}set permittivity(t){this._permittivity=t}get lossTangent(){return this._lossTangent}set lossTangent(t){this._lossTangent=t}get layerName(){return $e.getInstance().getLayer(this.layerId).name}get layerType(){return $e.getInstance().getLayer(this.layerId).type}get isKeepIsland(){return this._isKeepIsland}set isKeepIsland(t){this._isKeepIsland=t}modify(t,e,r,i,n=!0,s=-1){this._thickness=e,this._permittivity=r,this._lossTangent=i,this._material=t,this._isKeepIsland=n,this.zIndex=s}};var vf=class o extends _B{static build(t,e,r){let i=new o;return i.config=t,i.visible=e,i.locked=r,i}constructor(t=6){super(t)}get config(){return this.getValue(0)}set config(t){this.setValue(0,t)}get visible(){return this.getValue(1)}set visible(t){this.setValue(1,t)}get locked(){return this.getValue(2)}set locked(t){this.setValue(2,t)}};var RA=class o{constructor(t,e,r,i,n,s){this._temporaryActiveColor=void 0;this.layerId=t,this.type=e,this.hashed=t,this.name=r,this.status=i,this._activeColor=n,this.deactiveColor=s}get config(){return this.status.config}set config(t){this.status.config=t}get visible(){return this.status.visible}set visible(t){this.status.visible=t}get locked(){return this.status.locked}set locked(t){this.status.locked=t}get state(){return this.status.state}get activeColor(){return this._temporaryActiveColor||this._activeColor}setActiveColor(t,e){e?this._temporaryActiveColor=t:this._activeColor=t}get realActiveColor(){return this._activeColor}hashCode(){return this.hashed}equals(t){return t instanceof o?this.layerId===t.layerId:!1}};var aCe=[10066278,32768,65280,12357120,7396346,52326,10053375,8388736,32896,1413983,128,46080,3032918,10060847,16777130,10060847,3032918,3487231,8388796,4435551,12840142,7506296,3756095,815453,5933696,2855806,2333085,4568291,2186657,4547799,6908393,9464297],k9t=(function(){let o=[],t=aCe.reverse();for(let e=71;e<=270;e++){let r=(e-71)%aCe.length;o.push({layerId:e,type:"CUSTOM",name:`Custom${e-71+1}`,order:1e3+e,activeColor:ee.of1(t[r]),deactiveColor:ee.of1(t[r]).mul(.5),active:!1,layerStatus:0})}return o})(),_8e=(function(){let o=[],t=aCe.reverse();for(let e=101;e<=270;e++)o.push({layerId:e,type:"CUSTOM",name:`Custom${e-70}`,order:1e3+e,activeColor:ee.of1(t[e-71]),deactiveColor:ee.of1(t[e-71]).mul(.5),active:!1,layerStatus:0});return o})(),Bg=[{layerId:1,type:"TOP",name:"Top Layer",order:24,activeColor:ee.of1(16711680),deactiveColor:ee.of1(16711680).mul(.5),active:!0,layerStatus:1},{layerId:2,type:"BOTTOM",name:"Bottom Layer",order:39,activeColor:ee.of1(255),deactiveColor:ee.of1(255).mul(.5),active:!1,layerStatus:1},{layerId:3,type:"TOP_SILK",name:"Top Silkscreen Layer",order:21,activeColor:ee.of1(16763904),deactiveColor:ee.of1(16763904).mul(.5),active:!1,layerStatus:1},{layerId:4,type:"BOT_SILK",name:"Bottom Silkscreen Layer",order:36,activeColor:ee.of1(6736947),deactiveColor:ee.of1(6736947).mul(.5),active:!1,layerStatus:1},{layerId:5,type:"TOP_SOLDER_MASK",name:"Top Solder Mask Layer",order:27,activeColor:ee.of5("#800080",.7),deactiveColor:ee.of1(8388736).mul(.5),active:!1,layerStatus:1},{layerId:6,type:"BOT_SOLDER_MASK",name:"Bottom Solder Mask Layer",order:42,activeColor:ee.of5("#aa00ff",.7),deactiveColor:ee.of1(11141375).mul(.5),active:!1,layerStatus:1},{layerId:7,type:"TOP_PASTE_MASK",name:"Top Paste Mask Layer",order:30,activeColor:ee.of1(8421504),deactiveColor:ee.of1(8421504).mul(.5),active:!1,layerStatus:1},{layerId:8,type:"BOT_PASTE_MASK",name:"Bottom Paste Mask Layer",order:45,activeColor:ee.of1(8388608),deactiveColor:ee.of1(8388608).mul(.5),active:!1,layerStatus:1},{layerId:9,type:"TOP_ASSEMBLY",name:"Top Assembly Layer",order:33,activeColor:ee.of1(3394713),deactiveColor:ee.of1(3394713).mul(.5),active:!1,layerStatus:1},{layerId:10,type:"BOT_ASSEMBLY",name:"Bottom Assembly Layer",order:48,activeColor:ee.of1(5592575),deactiveColor:ee.of1(5592575).mul(.5),active:!1,layerStatus:1},{layerId:11,type:"OUTLINE",name:"Board Outline Layer",order:147,activeColor:ee.of1(16711935),deactiveColor:ee.of1(16711935).mul(.5),active:!1,layerStatus:1},{layerId:12,type:"MULTI",name:"Multi-Layer",order:8,activeColor:ee.of1(12632256),deactiveColor:ee.of1(12632256).mul(.5),active:!1,layerStatus:1},{layerId:13,type:"DOCUMENT",name:"Document Layer",order:150,activeColor:ee.of1(16777215),deactiveColor:ee.of1(16777215).mul(.5),active:!1,layerStatus:1},{layerId:14,type:"MECHANICAL",name:"Mechanical Layer",order:153,activeColor:ee.of1(15737584),deactiveColor:ee.of1(15737584).mul(.5),active:!1,layerStatus:1},{layerId:15,type:"SIGNAL",name:"Inner1",order:51,activeColor:ee.of1(10066278),deactiveColor:ee.of1(10066278).mul(.5),active:!1,layerStatus:0},{layerId:16,type:"SIGNAL",name:"Inner2",order:54,activeColor:ee.of1(32768),deactiveColor:ee.of1(32768).mul(.5),active:!1,layerStatus:0},{layerId:17,type:"SIGNAL",name:"Inner3",order:57,activeColor:ee.of1(65280),deactiveColor:ee.of1(65280).mul(.5),active:!1,layerStatus:0},{layerId:18,type:"SIGNAL",name:"Inner4",order:60,activeColor:ee.of1(12357120),deactiveColor:ee.of1(12357120).mul(.5),active:!1,layerStatus:0},{layerId:19,type:"SIGNAL",name:"Inner5",order:63,activeColor:ee.of1(7396346),deactiveColor:ee.of1(7396346).mul(.5),active:!1,layerStatus:0},{layerId:20,type:"SIGNAL",name:"Inner6",order:66,activeColor:ee.of1(52326),deactiveColor:ee.of1(52326).mul(.5),active:!1,layerStatus:0},{layerId:21,type:"SIGNAL",name:"Inner7",order:69,activeColor:ee.of1(10053375),deactiveColor:ee.of1(10053375).mul(.5),active:!1,layerStatus:0},{layerId:22,type:"SIGNAL",name:"Inner8",order:72,activeColor:ee.of1(8388736),deactiveColor:ee.of1(8388736).mul(.5),active:!1,layerStatus:0},{layerId:23,type:"SIGNAL",name:"Inner9",order:75,activeColor:ee.of1(32896),deactiveColor:ee.of1(32896).mul(.5),active:!1,layerStatus:0},{layerId:24,type:"SIGNAL",name:"Inner10",order:79,activeColor:ee.of1(1413983),deactiveColor:ee.of1(1413983).mul(.5),active:!1,layerStatus:0},{layerId:25,type:"SIGNAL",name:"Inner11",order:81,activeColor:ee.of1(128),deactiveColor:ee.of1(128).mul(.5),active:!1,layerStatus:0},{layerId:26,type:"SIGNAL",name:"Inner12",order:84,activeColor:ee.of1(46080),deactiveColor:ee.of1(46080).mul(.5),active:!1,layerStatus:0},{layerId:27,type:"SIGNAL",name:"Inner13",order:87,activeColor:ee.of1(3032918),deactiveColor:ee.of1(3032918).mul(.5),active:!1,layerStatus:0},{layerId:28,type:"SIGNAL",name:"Inner14",order:90,activeColor:ee.of1(10060847),deactiveColor:ee.of1(10060847).mul(.5),active:!1,layerStatus:0},{layerId:29,type:"SIGNAL",name:"Inner15",order:93,activeColor:ee.of1(16777130),deactiveColor:ee.of1(16777130).mul(.5),active:!1,layerStatus:0},{layerId:30,type:"SIGNAL",name:"Inner16",order:96,activeColor:ee.of1(10060847),deactiveColor:ee.of1(10060847).mul(.5),active:!1,layerStatus:0},{layerId:31,type:"SIGNAL",name:"Inner17",order:99,activeColor:ee.of1(3032918),deactiveColor:ee.of1(3032918).mul(.5),active:!1,layerStatus:0},{layerId:32,type:"SIGNAL",name:"Inner18",order:102,activeColor:ee.of1(3487231),deactiveColor:ee.of1(3487231).mul(.5),active:!1,layerStatus:0},{layerId:33,type:"SIGNAL",name:"Inner19",order:105,activeColor:ee.of1(8388796),deactiveColor:ee.of1(8388796).mul(.5),active:!1,layerStatus:0},{layerId:34,type:"SIGNAL",name:"Inner20",order:108,activeColor:ee.of1(4435551),deactiveColor:ee.of1(4435551).mul(.5),active:!1,layerStatus:0},{layerId:35,type:"SIGNAL",name:"Inner21",order:111,activeColor:ee.of1(12840142),deactiveColor:ee.of1(12840142).mul(.5),active:!1,layerStatus:0},{layerId:36,type:"SIGNAL",name:"Inner22",order:114,activeColor:ee.of1(7506296),deactiveColor:ee.of1(7506296).mul(.5),active:!1,layerStatus:0},{layerId:37,type:"SIGNAL",name:"Inner23",order:117,activeColor:ee.of1(3756095),deactiveColor:ee.of1(3756095).mul(.5),active:!1,layerStatus:0},{layerId:38,type:"SIGNAL",name:"Inner24",order:120,activeColor:ee.of1(815453),deactiveColor:ee.of1(815453).mul(.5),active:!1,layerStatus:0},{layerId:39,type:"SIGNAL",name:"Inner25",order:123,activeColor:ee.of1(5933696),deactiveColor:ee.of1(5933696).mul(.5),active:!1,layerStatus:0},{layerId:40,type:"SIGNAL",name:"Inner26",order:126,activeColor:ee.of1(2855806),deactiveColor:ee.of1(2855806).mul(.5),active:!1,layerStatus:0},{layerId:41,type:"SIGNAL",name:"Inner27",order:129,activeColor:ee.of1(2333085),deactiveColor:ee.of1(2333085).mul(.5),active:!1,layerStatus:0},{layerId:42,type:"SIGNAL",name:"Inner28",order:132,activeColor:ee.of1(4568291),deactiveColor:ee.of1(4568291).mul(.5),active:!1,layerStatus:0},{layerId:43,type:"SIGNAL",name:"Inner29",order:135,activeColor:ee.of1(2186657),deactiveColor:ee.of1(2186657).mul(.5),active:!1,layerStatus:0},{layerId:44,type:"SIGNAL",name:"Inner30",order:138,activeColor:ee.of1(4547799),deactiveColor:ee.of1(4547799).mul(.5),active:!1,layerStatus:0},{layerId:45,type:"SIGNAL",name:"Inner31",order:141,activeColor:ee.of1(6908393),deactiveColor:ee.of1(6908393).mul(.5),active:!1,layerStatus:0},{layerId:46,type:"SIGNAL",name:"Inner32",order:144,activeColor:ee.of1(9464297),deactiveColor:ee.of1(9464297).mul(.5),active:!1,layerStatus:0},{layerId:47,type:"HOLE",name:"Hole Layer",order:6,activeColor:ee.of1(2236962),deactiveColor:ee.of1(2236962).mul(.5),active:!1,layerStatus:1},{layerId:48,type:"COMPONENT_SHAPE",name:"Component Shape Layer",order:200,activeColor:ee.of1(52428),deactiveColor:ee.of1(52428).mul(.5),active:!1,layerStatus:2},{layerId:49,type:"COMPONENT_MARKING",name:"Component Marking Layer",order:203,activeColor:ee.of1(6750156),deactiveColor:ee.of1(6750156).mul(.5),active:!1,layerStatus:2},{layerId:50,type:"PIN_SOLDERING",name:"Pin Soldering Layer",order:206,activeColor:ee.of1(13408665),deactiveColor:ee.of1(13408665).mul(.5),active:!1,layerStatus:2},{layerId:51,type:"PIN_FLOATING",name:"Pin Floating Layer",order:209,activeColor:ee.of1(16751103),deactiveColor:ee.of1(16751103).mul(.5),active:!1,layerStatus:2},{layerId:52,type:"COMPONENT_MODEL",name:"Component Model Layer",order:212,activeColor:ee.of1(16777215),deactiveColor:ee.of1(16777215).mul(.5),active:!1,layerStatus:0},{layerId:53,type:"3D_SHELL_OUTLINE",name:"3D Shell Outline Layer",order:10215,activeColor:ee.of1(6750105),deactiveColor:ee.of1(6750105).mul(.5),active:!1,layerStatus:1},{layerId:54,type:"3D_SHELL_TOP",name:"3D Shell Top Layer",order:10218,activeColor:ee.of1(16764159),deactiveColor:ee.of1(16764159).mul(.5),active:!1,layerStatus:1},{layerId:55,type:"3D_SHELL_BOTTOM",name:"3D Shell Bottom Layer",order:10221,activeColor:ee.of1(26316),deactiveColor:ee.of1(26316).mul(.5),active:!1,layerStatus:1},{layerId:56,type:"DRILL_DRAWING",name:"Drill Drawing Layer",order:222,activeColor:ee.of1(32896),deactiveColor:ee.of1(32896).mul(.5),active:!1,layerStatus:1},{layerId:57,type:"OTHER",name:"Ratline Layer",order:2,activeColor:ee.of1(6579455),deactiveColor:ee.of1(6579455).mul(.5),active:!1,layerStatus:1},{layerId:58,type:"TOP_STIFFENER",name:"Top Stiffener Layer",order:35,activeColor:ee.of1(15656550),deactiveColor:ee.of1(15656550).mul(.5),active:!1,layerStatus:0},{layerId:59,type:"BOTTOM_STIFFENER",name:"Bottom Stiffener Layer",order:50,activeColor:ee.of1(13434624),deactiveColor:ee.of1(13434624).mul(.5),active:!1,layerStatus:0},...k9t],DY=(()=>{let o={};return Bg.forEach(t=>{o[t.layerId]=t.name.replaceAll(" ","")}),o})(),DA=[48,49,50,51,52],FM=[52,53,54,55,56],lCe={1:24,2:39,3:21,4:36,7:30,8:45,5:27,6:42,11:147,12:8,13:150,9:33,58:35,10:48,59:50,14:153,15:51,16:54,17:57,18:60,19:63,20:66,21:69,22:72,23:75,24:78,25:81,26:84,27:87,28:90,29:93,30:96,31:99,32:102,33:105,34:108,35:111,36:114,37:117,38:120,39:123,40:126,41:129,42:132,43:135,44:138,45:141,46:144,47:6,48:200,49:203,50:206,51:209,52:212,53:10215,54:10218,55:10221,57:2};var v8e=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,47,48,49,50,51,53,54,55,56,57];var VM=class VM extends wi{constructor(){super();this.map=new Map;this._deactiveAlpha=.5;this.activeLayer=0;this._layerPhys=new Map;this.helpLayerMask={};this.initLayer()}static getInstance(){return VM.manager==null&&(VM.manager=new VM),VM.manager}get deactiveAlpha(){return this._deactiveAlpha}set deactiveAlpha(e){this._deactiveAlpha=e;for(let[,r]of this.map)r.deactiveColor=ee.of6(r.deactiveColor,this._deactiveAlpha)}hasInner(){var e;return(e=this.map.get(15))==null?void 0:e.config}initLayer(){for(let e of Bg){let r=e.layerStatus,i=vf.build(e.layerStatus!=0,r==1,!1);this.addLayer(e.layerId,e.type,e.name,i,e.activeColor,e.deactiveColor)}}getLayerPhys(){let e=Array.from(this._layerPhys.values());return e.sort((r,i)=>r.zIndex-i.zIndex),e}addLayerPhyModel(e){this._layerPhys.set(e.layerId,e)}addLayerPhy(e,r,i,n,s,a,l){let c=new xA(e,r,i,n,s,a,l);return this._layerPhys.set(e,c),c}modifyLayerPhy(e,r,i,n,s,a,l){let c=this._layerPhys.get(e);return c!=null?c.modify(r,i,n,s,a,l):(c=new xA(e,r,i,n,s,a,l),this._layerPhys.set(e,c)),c}deleteLayerPhy(e){this._layerPhys.delete(e)}getLayerPhy(e){return this._layerPhys.get(e)}getfilterPhyLayers(){let e={};for(let[r,i]of this.map)i.type=="SUBSTRATE"?this.getLayerPhy(i.layerId)!=null&&(e[r]=i):e[r]=i;return e}addLayer(e,r,i,n,s,a){let l=new RA(e,r,i,n,s,a);return this.map.set(e,l),l}addHelpLayer(e,r,i,n,s,a){let l=new RA(e,r,i,n,s,a);return this.helpLayerMask[e]=l,l}getHelpLayer(e){return this.helpLayerMask[e]}getAllHelpLayer(){return Object.keys(this.helpLayerMask)}modifyLayer(e,r,i,n,s,a){let l=this.map.get(e);return l==null?this.addLayer(e,r,i,n,s,a):(l.type=r,l.name=i,l.config=n.config,l.visible=n.visible,l.locked=n.locked,l.setActiveColor(s),l.deactiveColor=a,l)}getLayer(e){return this.map.get(e)}getUseLayer(){let e=new Array;for(let[r,i]of this.map)i.config&&e.push(i);return e}setLayer(e){let r=e.layerId;this.map.set(r,e)}getAllCopperLayer(){let e=new Array;for(let[r,i]of this.map)i.config&&Lte(i.type)&&e.push(i);return e}getAllCopperLayerIds(){return this.getAllCopperLayer().map(e=>e.layerId)}getAllSignalLayers(){return this.getAllCopperLayer().filter(e=>gs(e.type))}getAllSignalLayerIds(){return this.getAllSignalLayers().map(e=>e.layerId)}getAllPlaneLayer(){let e=new Array;for(let[r,i]of this.map)i.config&&Rh(i.type)&&e.push(i);return e}isValidLayer(e){var r;return Ms(e)?((r=this.map.get(e))==null?void 0:r.config)||!1:!0}isSignalLayer(e){let r=this.map.get(e);return r!=null&&r.config&&gs(r.type)}isCustomLayer(e,r=!1){let i=this.map.get(e);return i!=null&&"CUSTOM"==i.type&&(!r||i.config)}getSingleLayerId4Order(){let e=new Array;e.push(1);for(let r=15;r<=46;r++){let i=this.map.get(r);i!=null&&i.config&&gs(i.type)&&e.push(r)}return e.push(2),e}getAllCopperLayerId4Order(){let e=new Array;e.push(1);for(let r=15;r<=46;r++){let i=this.map.get(r);i!=null&&i.config&&e.push(r)}return e.push(2),e}getAllPlaneLayerIds(){return this.getAllPlaneLayer().map(e=>e.layerId)}recycle(){this.map.clear(),this._layerPhys.clear()}};VM.manager=null;var $e=VM;var rre=class{constructor(t,e){this.used=new Set;this.resetState(t,e)}resetState(t,e){this.state=0,this.mask=0,t==1?(this.mask=1,this.init4Inner(15,e)):t==2?(this.mask=2,this.init4Inner(e,this.getLastInner())):e==1?(this.mask=1,this.init4Inner(15,t)):e==2?(this.mask=2,this.init4Inner(t,this.getLastInner())):t>e?this.init4Inner(e,t):this.init4Inner(t,e)}getLastInner(){let t=$e.getInstance().getAllCopperLayer(),e=null;for(let r of t)Ms(r.layerId)&&r.layerId>e&&(e=r.layerId);return e}init4Inner(t,e){for(let r=t-15;r<=e-15;r++)this.state=this.state|1<<r}setVisible(t,e){e?t==1?this.mask=this.mask|1:t==2?this.mask=this.mask|2:this.state=this.state|1<<t-15:t==1?this.mask=this.mask&16777214:t==2?this.mask=this.mask&16777213:this.state=this.state&(16777215^1<<t-15)}isVisible(){return this.mask!=0||this.state!=0}};function wY(o,t,e,r,i){let n=new _e;n.ext2(t).ext7(Math.max(o,e));let s=Math.max(r,i);return s>0&&n.ext7(s),n.build1()}function Ub(o,t,e,r){switch(t){case 1:{if(e===o||r===o)return!0;{let i=Math.min(e,r),n=Math.max(e,r);if(i==1){if(o!=2&&o<n)return!0}else if(i==2){if(o!=1&&o>n)return!0}else if(n==1){if(o!=2&&o<i)return!0}else if(n==2){if(o!=1&&o>i)return!0}else if(o!=1&&o!=2&&o>i&&o<n)return!0}return!1}default:return!0}}function GM(o){let t,e=te.getInstance();if(o.name==="")t=e.getRadiusPhysicsByNet(o.net);else{let n=e.getDefaultBlindPhysics().getBlindViaContentByName(o.name);t=e.getRadiusPhysicsByName(n.viaSizeRule)}let r=xe(o.model.radius*2,2),i=xe(o.model.holeRadius*2,2);(r>xe(t.maxRadius*2,2)||r<xe(t.minRadius*2,2))&&(o.model.radius=t.defalutRadius),(i>xe(t.maxInner*2,2)||i<xe(t.minInner*2,2))&&(o.model.holeRadius=t.defalutInner)}var x8e={UNIT_NAME:"mm"},fT=1,N1=class{constructor(t,e){this.referenceLayer=fT;this._name=t,this._isDefault=e}get unit(){return x8e.UNIT_NAME}set unit(t){t&&(x8e.UNIT_NAME=t)}getValue(t,e){if(e==null)return t.get(this.referenceLayer);{let r=t.get(e);return r==null&&(r=t.get(this.referenceLayer)),r}}get name(){return this._name}set name(t){this._name=t}get isDefault(){return this._isDefault}set isDefault(t){this._isDefault=t}};var X2=class extends N1{},HB=class o{constructor(t,e,r){this._minValue=t,this._defaultValue=e,this._maxValue=r}static build(t,e,r){return new o(t,e,r)}get minValue(){return this._minValue}set minValue(t){this._minValue=t}get defaultValue(){return this._defaultValue}set defaultValue(t){this._defaultValue=t}get maxValue(){return this._maxValue}set maxValue(t){this._maxValue=t}toJSON(){return{minValue:this.minValue,defaultValue:this.defaultValue,maxValue:this.maxValue}}clone(){return new o(this.minValue,this.defaultValue,this.maxValue)}};var B9t=0,ire=class o{constructor(t,e,r,i,n){this._name=t,this._startLayer=e,this._endLayer=r,this._viaSizeRule=n||"",this._used=i,this.status=new rre(this.startLayer,this.endLayer),this.key="blind"+B9t++}static build(t,e,r,i=!1){return new o(t,e,r,i)}get name(){return this._name}set name(t){this._name=t}get startLayer(){return this._startLayer}set startLayer(t){this._startLayer=t}get endLayer(){return this._endLayer}set endLayer(t){this._endLayer=t}isContains(t){return Ub(t,1,this.startLayer,this.endLayer)}get viaSizeRule(){return this._viaSizeRule}set viaSizeRule(t){this._viaSizeRule=t}get used(){return this._used}set used(t){this._used=t}clone(){return new o(this.name,this.startLayer,this.endLayer,this.used)}getMenu(){return{name:this._name,cmd:this._name,tips:""}}},Rx=class o extends X2{constructor(){super(...arguments);this.blindVias=new Array;this.map=new Map}static build(e,r){return new o(e,r)}getBlindVia(e){for(let r of this.blindVias)if(r.name===e)return r;return null}addBlind(e,r,i,n){let s=new ire(e,r,i,!1,n);return this.blindVias.push(s),this.map.set(s.key,s),s}get data(){let e=new Array;for(let r of this.blindVias)e.push({name:r.name,startLayer:r.startLayer,endLayer:r.endLayer,used:r.used,key:r.key,viaSizeRule:r.viaSizeRule});return e}set data(e){let r=new Array;for(let i of e){let n=i.name,s=parseInt(i.startLayer),a=parseInt(i.endLayer),l=i.viaSizeRule;if(s==1){if(a==2||s==a)continue}else if(s==2){if(a==1||s==a)continue}else if(s==a)continue;let c=this.map.get(i.key);c==null?c=new ire(n,s,a,!1,l):(c.name=n,c.startLayer=s,c.endLayer=a,c.viaSizeRule=l),r.push(c)}this.blindVias.length=0,this.blindVias=r,this.map.clear();for(let i of r)this.map.set(i.key,i)}getBlindViaContentByName(e){for(let r of this.blindVias)if(r.name===e)return{name:r.name,staLayerId:r.startLayer,endLayerId:r.endLayer,viaSizeRule:r.viaSizeRule};return null}getAllVias(){return Array.from(this.blindVias)}getContainsLayerVias(e){let r=new Set;return this.blindVias.forEach(i=>{i.isContains(e)&&r.add(i)}),r}getFirst(){return this.blindVias.length>0?this.blindVias[0]:null}getOptions(){let e=new Array;for(let r of this.blindVias){let i={value:r.name,text:r.name,startLayerId:r.startLayer,endLayerId:r.endLayer,viaSizeRule:r.viaSizeRule};e.push(i)}return e}clone(){let e=new o(this.name,this.isDefault);return e.data=this.data,e}};var WB=class{constructor(t,e,r,i,n){this._type=t,this._connectMode=e,this._lineClearance=r,this._lineWidth=i,this._lineAngle=n}get type(){return this._type}get connectMode(){return this._connectMode}set connectMode(t){this._connectMode=t}get lineClearance(){return this._lineClearance}set lineClearance(t){this._lineClearance=t}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t}get lineAngle(){return this._lineAngle}set lineAngle(t){this._lineAngle=t}get PadConnectRule(){return{connectMode:this.connectMode,lineClearance:this.lineClearance,lineWidth:this.lineWidth,lineAngle:this.lineAngle}}set PadConnectRule(t){this.connectMode=t.connectMode,this.lineClearance=t.lineClearance,this.lineWidth=t.lineWidth,this.lineAngle=t.lineAngle}equals(t){return this._type==t._type&&this._connectMode==t._connectMode&&this._lineClearance==t._lineClearance&&this._lineWidth==t._lineWidth&&this._lineAngle==t._lineAngle}},GS=class extends N1{};GS.defUnitName="mil",GS.defPadConnectRule={connectMode:0,lineClearance:1,lineWidth:1,lineAngle:LE};var qa=class{constructor(t,e){this.tableData=t,this.layerStatus=e}hasStatus(t){return"status"in t}build(t){let e=new Map;if(this.tableData instanceof Map)for(let[r,i]of this.tableData){let n=t(i);this.layerStatus&&this.layerStatus.has(r)&&this.hasStatus(n)&&(n.status=this.layerStatus.get(r)),e.set(r,n)}else{let r=t(this.tableData);this.layerStatus&&this.layerStatus.has(fT)&&this.hasStatus(r)&&(r.status=this.layerStatus.get(fT)),e.set(fT,r)}return e}};var cCe=class{constructor(t){this._trackConnect=t}get trackConnect(){return this._trackConnect}set trackConnect(t){this._trackConnect=t}},V9t=new Map([[0,1],[1,1],[2,1]]),zB=class zB extends GS{constructor(e,r,i,n,s,a){super(e,r);this.layerStatus=new Map;this.layerStatus=i,this.singleLayerPadModel=this.createLayeredPadModel(n,0),this.multiLayerPadModel=this.createLayeredPadModel(s,1),this.trackConnectModel=this.createTrackConnectModel(a)}static build(e,r=!1,i=V9t,n=new qa(GS.defPadConnectRule),s=new qa(GS.defPadConnectRule),a=new qa(zB.defTrackConnect)){return new zB(e,r,i,n,s,a)}createLayeredPadModel(e,r){return e.build(i=>new WB(r,i.connectMode,i.lineClearance,i.lineWidth,i.lineAngle))}createTrackConnectModel(e){return e.build(r=>new cCe(r))}getTable(e,r){let i;switch(e){case 0:i=this.singleLayerPadModel;break;case 1:i=this.multiLayerPadModel;break;case 2:i=this.trackConnectModel;break}return this.getValue(i,r)}overWriteTables(e,r){switch(r){case 0:this.singleLayerPadModel=this.createLayeredPadModel(e,r);break;case 1:this.multiLayerPadModel=this.createLayeredPadModel(e,r);break;case 2:this.trackConnectModel=this.createTrackConnectModel(e);break}}getLayerStatus(e){return this.layerStatus.get(e)||0}setLayerStatus(e,r){this.layerStatus.set(e,r)}getTrackConnect(e){return this.getTable(2,e).trackConnect}setTrackConnect(e,r){this.getTable(2,r).trackConnect=e}getSingleConnectMode(e){return this.getTable(0,e).connectMode}setSingleConnectMode(e,r){this.getTable(0,r).connectMode=e}getSingleLineClearance(e){return this.getTable(0,e).lineClearance}setSingleLineClearance(e,r){this.getTable(0,r).lineClearance=e}getSingleLineWidth(e){return this.getTable(0,e).lineWidth}setSingleLineWidth(e,r){this.getTable(0,r).lineWidth=e}getSingleLineAngle(e){return this.getTable(0,e).lineAngle}setSingleLineAngle(e,r){this.getTable(0,r).lineAngle=e}getMultiConnectMode(e){return this.getTable(1,e).connectMode}setMultiConnectMode(e,r){this.getTable(1,r).connectMode=e}getMultiLineClearance(e){return this.getTable(1,e).lineClearance}setMultiLineClearance(e,r){this.getTable(1,r).lineClearance=e}getMultiLineWidth(e){return this.getTable(1,e).lineWidth}setMultiLineWidth(e,r){this.getTable(1,r).lineWidth=e}getMultiLineAngle(e){return this.getTable(1,e).lineAngle}setMultiLineAngle(e,r){this.getTable(1,r).lineAngle=e}getSinglePadConnectRule(e){let r=this.getTable(0,e);return r?{connectMode:r.connectMode,lineClearance:r.lineClearance,lineWidth:r.lineWidth,lineAngle:r.lineAngle}:void 0}setSinglePadConnectRule(e,r){let i=this.getTable(0,r);i&&(i.connectMode=e.connectMode,i.lineClearance=e.lineClearance,i.lineWidth=e.lineWidth,i.lineAngle=e.lineAngle)}getMultiPadConnectRule(e){let r=this.getTable(1,e);return r?{connectMode:r.connectMode,lineClearance:r.lineClearance,lineWidth:r.lineWidth,lineAngle:r.lineAngle}:void 0}setMultiPadConnectRule(e,r){let i=this.getTable(1,r);i&&(i.connectMode=e.connectMode,i.lineClearance=e.lineClearance,i.lineWidth=e.lineWidth,i.lineAngle=e.lineAngle)}toJSON(){let e=(r,i)=>{let n=new Map;return i.forEach((s,a)=>{r!==2?n.set(a,s.PadConnectRule):n.set(a,s.trackConnect)}),{status:this.getLayerStatus(r),tables:n}};return{singleLayerPadModel:e(0,this.singleLayerPadModel),multiLayerPadModel:e(1,this.multiLayerPadModel),trackConnectModel:e(2,this.trackConnectModel)}}clone(){let{singleLayerPadModel:e,multiLayerPadModel:r,trackConnectModel:i}=this.toJSON();return zB.build(this.name,this.isDefault,new Map(this.layerStatus),new qa(e.tables||this.getSinglePadConnectRule()),new qa(r.tables||this.getMultiPadConnectRule()),new qa(i.tables||this.getTrackConnect()))}};zB.defTrackConnect=0;var Dx=zB;var G9t=new Map([[0,1],[1,1]]),Hb=class o extends X2{constructor(e,r,i,n,s,a){super(e,r);this.layerStatus=new Map;this.strokeWidthTables=new Map;this.diffPairSpacingTables=new Map;this.layerStatus=i,this.strokeWidthTables=this.createTables(n),this.diffPairSpacingTables=this.createTables(s),this._differentialPairLenTolerMax=a}static build(e,r,i=G9t,n=new qa({minValue:.5,defaultValue:1,maxValue:10}),s=new qa({minValue:.6,defaultValue:.6,maxValue:5}),a=1){return new o(e,r,i,n,s,a)}createTables(e){return e.build(r=>new HB(r.minValue,r.defaultValue,r.maxValue))}getTable(e,r){let i=e===0?this.strokeWidthTables:this.diffPairSpacingTables;if(r==null)return i.get(this.referenceLayer);{let n=i.get(r);return n==null&&(n=i.get(this.referenceLayer)),n}}overWriteTables(e,r){switch(e){case 0:this.strokeWidthTables=this.createTables(r);break;case 1:this.diffPairSpacingTables=this.createTables(r);break}}getLayerStatus(e){return this.layerStatus.get(e)}setLayerStatus(e,r){this.layerStatus.set(e,r)}getStrokeWidthMin(e){return this.getTable(0,e).minValue}setStrokeWidthMin(e,r){this.getTable(0,r).minValue=e}getStrokeWidthDefault(e){return this.getTable(0,e).defaultValue}setStrokeWidthDefault(e,r){this.getTable(0,r).defaultValue=e}getStrokeWidthMax(e){return this.getTable(0,e).maxValue}setStrokeWidthMax(e,r){this.getTable(0,r).maxValue=e}getDifferentialPairSpacingMin(e){return this.getTable(1,e).minValue}setDifferentialPairSpacingMin(e,r){this.getTable(1,r).minValue=e}getDifferentialPairSpacingDefault(e){return this.getTable(1,e).defaultValue}setDifferentialPairSpacingDefault(e,r){this.getTable(1,r).defaultValue=e}getDifferentialPairSpacingMax(e){return this.getTable(1,e).maxValue}setDifferentialPairSpacingMax(e,r){this.getTable(1,r).maxValue=e}get differentialPairLenTolerMax(){return this._differentialPairLenTolerMax}set differentialPairLenTolerMax(e){this._differentialPairLenTolerMax=e}getMaxClearanceFromTables(e){let r=0;for(let[,i]of this.diffPairSpacingTables){let n=e(i);n>r&&(r=n)}return r}getMaxSpacingMin(e){return e?this.getDifferentialPairSpacingMin(e):this.getMaxClearanceFromTables(r=>r.minValue)}toJSON(){let e=(r,i)=>{let n=new Map;return i.forEach((s,a)=>{n.set(a,s.toJSON())}),{status:this.getLayerStatus(r),tables:n}};return{strokeWidthTables:e(0,this.strokeWidthTables),diffPairSpacingTables:e(1,this.diffPairSpacingTables)}}clone(){let{strokeWidthTables:e,diffPairSpacingTables:r}=this.toJSON();return new o(this.name,this.isDefault,new Map(this.layerStatus),new qa(e.tables),new qa(r.tables),this.differentialPairLenTolerMax)}};var wx=class o extends GS{constructor(e,r,i,n){super(e,r);this.layerStatus=1;this.layerStatus=i,this.multiLayerPadModel=this.createTables(n)}static build(e,r=!1,i=1,n=new qa(GS.defPadConnectRule)){return new o(e,r,i,n)}createTables(e){return e.build(r=>new WB(1,r.connectMode,r.lineClearance,r.lineWidth,r.lineAngle))}getTable(e){var r;return(r=this.multiLayerPadModel.get(e))!=null?r:this.multiLayerPadModel.get(this.referenceLayer)}overWriteTables(e){this.multiLayerPadModel=this.createTables(e)}getLayerStatus(){return this.layerStatus}setLayerStatus(e){this.layerStatus=e}getMultiConnectMode(e){return this.getTable(e).connectMode}setMultiConnectMode(e,r){this.getTable(r).connectMode=e}getMultiLineClearance(e){return this.getTable(e).lineClearance}setMultiLineClearance(e,r){this.getTable(r).lineClearance=e}getMultiLineWidth(e){return this.getTable(e).lineWidth}setMultiLineWidth(e,r){this.getTable(r).lineWidth=e}getMultiLineAngle(e){return this.getTable(e).lineAngle}setMultiLineAngle(e,r){this.getTable(r).lineAngle=e}getMultiPadConnectRule(e){let r=this.getTable(e);return r?{connectMode:r.connectMode,lineClearance:r.lineClearance,lineWidth:r.lineWidth,lineAngle:r.lineAngle}:void 0}setMultiPadConnectRule(e,r){let i=this.getTable(r);i&&(i.connectMode=e.connectMode,i.lineClearance=e.lineClearance,i.lineWidth=e.lineWidth,i.lineAngle=e.lineAngle)}toJSON(){let e=new Map;return this.multiLayerPadModel.forEach((r,i)=>{e.set(i,r.PadConnectRule)}),{status:this.layerStatus,tables:e}}clone(){let e=this.toJSON().tables;return o.build(this.name,this.isDefault,this.layerStatus,new qa(e||this.getMultiPadConnectRule()))}};var q2=class o extends Y2{constructor(e,r=null,i=null,n="default"){super(e);this._positiveNet=null;this._negativeNet=null;this._differentialPhysics=null;this._positiveNet=r,this._negativeNet=i,this._differentialPhysics=n}hasNet(e){return this._positiveNet!=null&&this._positiveNet==e||this._negativeNet!=null&&this._negativeNet==e}get positiveNet(){return te.getInstance().getNet(this._positiveNet)}set positiveNet(e){this._positiveNet=e==null?void 0:e.name}get negativeNet(){return te.getInstance().getNet(this._negativeNet)}set negativeNet(e){this._negativeNet=e==null?void 0:e.name}get differentialPhysics(){return this._differentialPhysics}set differentialPhysics(e){this._differentialPhysics=e}getNets(){return[this._positiveNet,this._negativeNet]}addNetDifferential(e){e.netDifferential=this}removeNetDifferential(e){this._positiveNet==e&&this.positiveNet!=null&&(this.positiveNet.netDifferential=null,this.positiveNet=null),this._negativeNet==e&&this.negativeNet!=null&&(this.negativeNet.netDifferential=null,this.negativeNet=null)}getAllNets(){let e=new Array;return this.positiveNet!=null&&e.push(this.positiveNet),this.negativeNet!=null&&e.push(this.negativeNet),e}remove(){this.removeNetDifferential(this._positiveNet),this.removeNetDifferential(this._negativeNet)}fillPositiveNet(e){this._positiveNet=e==null?void 0:e.name,this.addNetDifferential(e)}fillNegativeNet(e){this._negativeNet=e==null?void 0:e.name,this.addNetDifferential(e)}clone(){return new o(this._name,this._positiveNet,this._negativeNet,this._differentialPhysics)}toJSON(){return{name:this._name,positiveNet:this._positiveNet,negativeNet:this._negativeNet,differentialPhysics:this._differentialPhysics}}};var Lx=class o extends X2{constructor(t,e,r,i){super(t,e),this._netLengthMin=r,this._netLengthMax=i}static build(t,e,r,i){return new o(t,e,r,i)}get netLengthMin(){return this._netLengthMin}set netLengthMin(t){this._netLengthMin=t}get netLengthMax(){return this._netLengthMax}set netLengthMax(t){this._netLengthMax=t}clone(){return new o(this.name,this.isDefault,this.netLengthMin,this.netLengthMax)}};var Mx=class o extends X2{constructor(t,e,r,i){super(t,e),this._netLengthTolerance=r,this._targetNet=i}static build(t,e,r,i){return new o(t,e,r,i)}get netLengthTolerance(){return this._netLengthTolerance}set netLengthTolerance(t){this._netLengthTolerance=t}get targetNet(){return this._targetNet}set targetNet(t){this._targetNet=t}clone(){return new o(this.name,this.isDefault,this.netLengthTolerance,this.targetNet)}};var Nx=class extends N1{};function BE(o,t){return t=t||TA,on(o,t.decimalPlacesShow,t.fixedDecimal)}function Id(o,t){return t=t&&typeof t.decimalPlaces=="number"?t:TA,on(o,t.decimalPlaces)}function uCe(...o){var t=0,e=o.length,r,i=!1;if(e<1)return{};for(typeof o[0]=="boolean"?(i=o[0],r=o[1],t=1):typeof o[e-1]=="boolean"?(i=o[e-1],r=o[0],e--):r=o[0],(!r||typeof r!="object"&&typeof r!="function")&&(r={});t<e;t++){var n=o[t];if(n&&typeof n=="object"){if(n==r)continue;for(var s in n)Ef(n,s)&&(i&&n[s]&&typeof n[s]=="object"?r[s]=uCe({},n[s]):r[s]=n[s])}}return r}function kx(o=[],t,e){if(!o||!o.length||!t)return{index:-1,data:null};let r={index:-1,data:null};for(let i=0;i<o.length;i++)if(typeof o[i]=="object"&&o[i][t]===e){r.data=o[i],r.index=i;break}return r}function LY(o){return/^(pixel|mil|mm|inch)$/i.test(o)}function Bs(o,t,e){if(t==e)return o*1;if(typeof o=="string"){if(!isNaN(+o))return+o;arguments.length==2&&(e=t,t=o.replace(/^[-+.\d\s]+/,""),o=o.replace(/[^-+.\d\s]+$/,"")),o=+o}if(typeof o!="number"||!isFinite(o))throw Error("Invalid value for unit convert");if(t=t.toLowerCase(),e=e.toLowerCase(),t=="cm"?(t="mm",o*=10):t=="px"&&(t="pixel"),e=="cm"?(e="mm",o*=.1):e=="px"&&(e="pixel"),t==e)return o*1;if(!LY(t)||!LY(e))throw Error("Not supported unit convert "+t+" to "+e);switch(t+"2"+e){case"mil2pixel":return o*.1;case"mil2mm":return o*.0254;case"mil2inch":return o*.001;case"mm2pixel":return o/.254;case"mm2mil":return o/.0254;case"mm2inch":return o/25.4;case"pixel2mil":return o*10;case"pixel2mm":return o*.254;case"pixel2inch":return o*.01;case"inch2pixel":return o*100;case"inch2mil":return o*1e3;case"inch2mm":return o*25.4;default:break}throw Error("Not supported unit convert "+t+" to "+e)}function la(o,t,e){let r=e||t,i;!isNaN(+o)&&e==null?i=Bs(o,"mil",t)*10:i=Bs(o,t,e);let n=r=="mil"?1:3;return BE(i,{decimalPlacesShow:n})+r}function dCe(o,t,e){let r=e||t,i;!isNaN(+o)&&e==null?i=Bs(o,"mil",t)*10:i=Bs(o,t,e);let n=r=="mil"?1:3;return BE(i,{decimalPlacesShow:n})}var Wb=class o extends Nx{constructor(t,e=!1,r,i,n){super(t,e),this._device2Device=r,this._thru2SMD=i,this._hole2Hole=n}static build(t,e=!1){return new o(t,e,0,0,Bs(.3,"mm","mil")/10)}get clearances(){return[this._device2Device,this._thru2SMD,this._hole2Hole]}set clearances(t){this._device2Device=t[0],this._thru2SMD=t[1],this._hole2Hole=t[2]}get deviceClearance(){return this._device2Device}get thru2SmdClearance(){return this._thru2SMD>=0?this._thru2SMD:0}get holeClearance(){return this._hole2Hole>=0?this._hole2Hole:.69}clone(){return new o(this.name,this.isDefault,this._device2Device,this._thru2SMD,this._hole2Hole)}};var Bx=class extends N1{};var Fx=class o extends Bx{constructor(t,e=!1,r=0,i=0,n=-100,s=-100){super(t,e),this._padTopExpansion=r,this._padBottomExpansion=i,this._testPointTopExpansion=n,this._testPointBottomExpansion=s}static build(t,e=!1,r=0,i=0,n=-100,s=-100){return new o(t,e,r,i,n,s)}get padTopExpansion(){return this._padTopExpansion}set padTopExpansion(t){this._padTopExpansion=t}get padBottomExpansion(){return this._padBottomExpansion}set padBottomExpansion(t){this._padBottomExpansion=t}get testPointTopExpansion(){return this._testPointTopExpansion}set testPointTopExpansion(t){this._testPointTopExpansion=t}get testPointBottomExpansion(){return this._testPointBottomExpansion}set testPointBottomExpansion(t){this._testPointBottomExpansion=t}clone(){return new o(this.name,this.isDefault,this.padTopExpansion,this.padBottomExpansion,this.testPointTopExpansion,this.testPointBottomExpansion)}};var Vx=class o extends X2{constructor(t,e=!1,r=lT(.025),i=lT(.0305),n=lT(.5),s=lT(.015),a=lT(.01525),l=lT(.3)){super(t,e),this._minRadius=r,this._defaultRadius=i,this._maxRadius=n,this._minInner=s,this._defaultInner=a,this._maxInner=l}static build(t,e=!1,r=lT(.025),i=lT(.0305),n=lT(.5),s=lT(.015),a=lT(.01525),l=lT(.3)){return new o(t,e,r,i,n,s,a,l)}get minRadius(){return this._minRadius}set minRadius(t){this._minRadius=t}get defalutRadius(){return this._defaultRadius}set defalutRadius(t){this._defaultRadius=t}get maxRadius(){return this._maxRadius}set maxRadius(t){this._maxRadius=t}get minInner(){return this._minInner}set minInner(t){this._minInner=t}get defalutInner(){return this._defaultInner}set defalutInner(t){this._defaultInner=t}get maxInner(){return this._maxInner}set maxInner(t){this._maxInner=t}clone(){return new o(this.name,this.isDefault,this.minRadius,this.defalutRadius,this.maxRadius,this.minInner,this.defalutInner,this.maxInner)}};var UI=class o extends Y2{constructor(e,r=null,i=null){super(e);this._regionType="region";this._safeClearance=null;this._otherClearance=null;this._creepageClearance=null;this._track=null;this._diff=null;this._radius=null;this._innerPlane=null;this._copperPlane=null;this._safeCopperPlane=null;this._safeInnerPlane=null;this._innerPlane=r,this._copperPlane=i}static build(e,r="region"){let i=new o(e);return i._regionType=r,i}get regionType(){return this._regionType}get safeClearance(){return this._safeClearance}set safeClearance(e){this._safeClearance=e}get otherClearance(){return this._otherClearance}set otherClearance(e){this._otherClearance=e}get creepageClearance(){return this._creepageClearance}set creepageClearance(e){this._creepageClearance=e}get track(){return this._track}set track(e){this._track=e}get diff(){return this._diff}set diff(e){this._diff=e}get radius(){return this._radius}set radius(e){this._radius=e}get innerPlane(){return this._innerPlane}set innerPlane(e){this._innerPlane=e}get copperPlane(){return this._copperPlane}set copperPlane(e){this._copperPlane=e}get safeInnerPlane(){return this._safeInnerPlane}set safeInnerPlane(e){this._safeInnerPlane=e}get safeCopperPlane(){return this._safeCopperPlane}set safeCopperPlane(e){this._safeCopperPlane=e}toJSON(){return{safeClearance:this.safeClearance,safeCopperPlane:this.safeCopperPlane,safeInnerPlane:this.safeInnerPlane,otherClearance:this.otherClearance,creepageClearance:this.creepageClearance,track:this.track,diff:this.diff,radius:this.radius,innerPlane:this.innerPlane,copperPlane:this.copperPlane}}clone(){let e=new o(this._name,this._innerPlane,this._copperPlane);return e._regionType=this._regionType,e._safeClearance=this._safeClearance,e._otherClearance=this._otherClearance,e._creepageClearance=this._creepageClearance,e._track=this._track,e._diff=this._diff,e._radius=this._radius,e._safeCopperPlane=this._safeCopperPlane,e._safeInnerPlane=this._safeInnerPlane,e}};var U9t=[.6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.6,.6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.6,.6,.6,-1,-1,-1,-1,-1,-1,-1,-1,-1,.6,.6,.6,.6,-1,-1,-1,-1,-1,-1,-1,-1,.6,.6,.6,.6,.6,-1,-1,-1,-1,-1,-1,-1,.6,.6,.6,.6,.6,.6,-1,-1,-1,-1,-1,-1,.6,.6,.6,.6,.6,.6,.6,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1.18,.6,.6,.6,.6,.6,.6,1,.6,-1,-1,-1,.6,.6,.6,.6,.6,.6,.6,1,1.18,.6,-1,-1,.6,.6,.6,.6,.6,.6,.6,1,.6,.6,.6,-1,1.18,1.18,1.18,1.18,1.18,1.18,1.18,1,1.18,1.18,1.18,-1,.6929,.6929,.6929,.6929,.6929,.6929,.6929,1,.6929,.6929,.6929,.6929],H9t=[0,1,2,3,4,5,6,7,8,9,10,11],kY=[0,1,2,3,4,5,6,7,8,9,10,11,12],MY=13,pCe=12,W9t=12,z9t=H9t,Y9t=kY,NY=class o{constructor(t=U9t){this.status=1;this._data=Array.from(t)}getPosition(t,e){return t*W9t+e}get data(){let t=new Array;for(let e=0;e<MY;e++){let r=new Array;for(let i=0;i<pCe&&i<=e;i++)e>=11&&i>=e||r.push(this._data[this.getPosition(e,i)]);t.push(r)}return t}setData(t){this._data=Array.from(t)}modifyClearance(t,e,r){this._data[this.getPosition(t,e)]=Math.abs(r)}modifyAllClearance(t){for(let e=0;e<MY;e++)for(let r=0;r<pCe&&r<=e;r++)e>=11&&r>=e||this.modifyClearance(e,r,t(e,r))}getClearance(t,e){return t>=e?this._data[this.getPosition(t,e)]||0:this._data[this.getPosition(e,t)]||0}getMaxClearance(){let t=0;for(let e=0;e<MY;e++)for(let r=0;r<pCe&&r<=e;r++){let i=this._data[this.getPosition(e,r)];i>t&&(t=i)}return t}getItemMaxClearance(t,e){let r=0;for(let i=0;i<MY;i++){if(e&&!e.includes(i))continue;let n=this.getClearance(i,t);r=Math.max(r,n)}return r}getItemsMaxClearance(t,e){let r=0;for(let i=0;i<MY;i++)e&&!e.includes(i)||t.forEach(n=>{let s=this.getClearance(i,n);r=Math.max(r,s)});return r}clone(){let t=Array.from(this._data);return new o(t)}},R8e=new Set([8,11,12]),HI=class o extends Nx{constructor(e,r,i,n){super(e,r);this.tables=new Map;this._status=i,this.overWriteTables(n)}static build(e,r=!1,i=0,n){return new o(e,r,i,n)}overWriteTables(e){e?e.build(i=>{let n=new NY;return n.modifyAllClearance((s,a)=>i[s][a]),n}).forEach((i,n)=>{this.tables.set(n,i)}):this.tables.set(this.referenceLayer,new NY)}get status(){return this._status}set status(e){this._status=e}getLabel(e){switch(e){case 0:return"Track";case 1:return"SMD Pad";case 2:return"TH Pad";case 3:return"SMD Test Point";case 4:return"TH Test Point";case 5:return"Via";case 6:return"Fill Region/Teardrop";case 7:return"Copper/Plane Zone";case 8:return"Slot Region";case 9:return"Line";case 10:return"Text/Image";case 11:return"Board Outline";case 12:return"Hole";default:return}}getRowLabel(){let e=new Array;for(let r of z9t){let i=this.getLabel(r);i!=null&&e.push(i)}return e}getColLabel(){let e=new Array;for(let r of Y9t){let i=this.getLabel(r);i!=null&&e.push(i)}return e}getTable(e){return this.status==1?this.getValue(this.tables,e):this.tables.get(this.referenceLayer)}addTable(e,r,i=(n,s,a)=>n[s][a]/10){let n=(a,l)=>i(e,a,l),s=new NY;return s.modifyAllClearance(n),this.tables.set(r,s)}deleteTable(e){return this.tables.delete(e)}getData(e){return this.getTable(e).data}setData(e,r){this.getTable(r).setData(e)}getLayerStatus(e){return this.getTable(e).status}setLayerStatus(e,r){this.getTable(e).status=r}getAllLayerStates(){let e=new Map;return this.tables.forEach((r,i)=>{e.set(i,r.status)}),e}getClearance(e,r,i=this.referenceLayer){return R8e.has(e)&&R8e.has(r)?this.getMaxClearanceFromTables(s=>s.getClearance(e,r)):(e=[13,14].includes(e)?7:e,r=[13,14].includes(r)?7:r,this.getTable(i).getClearance(e,r))}modifyClearance(e,r,i,n){this.getTable(n).modifyClearance(e,r,i)}modifyAllClearance(e,r){this.getTable(r).modifyAllClearance(e)}getMaxClearanceFromTables(e){let r=0;for(let[,i]of this.tables){let n=e(i);n>r&&(r=n)}return r}getMaxClearance(e){return e?this.getTable(e).getMaxClearance():this.getMaxClearanceFromTables(r=>r.getMaxClearance())}getItemMaxClearance(e,r,i){return i?this.getTable(i).getItemMaxClearance(e,r):this.getMaxClearanceFromTables(n=>n.getItemMaxClearance(e,r))}getItemsMaxClearance(e,r,i){return i?this.getTable(i).getItemsMaxClearance(e,r):this.getMaxClearanceFromTables(n=>n.getItemsMaxClearance(e,r))}toJSON(){let e=new Map;if(this.status===0){let r=this.getTable(this.referenceLayer);e.set(this.referenceLayer,{layerState:r.status,table:r.data})}else this.tables.forEach((r,i)=>{e.set(i,{layerState:r.status,table:r.data})});return e}clone(){let e=new Map;this.tables.forEach((i,n)=>{e.set(n,i.clone().data)});let r=new qa(e,this.getAllLayerStates());return new o(this.name,this.isDefault,this.status,r)}};var Gx=class o extends Bx{constructor(t,e=!1,r=.2,i=.2,n=.2,s=.2,a=-100,l=-100){super(t,e),this._padTopExpansion=r,this._padBottomExpansion=i,this._testPointTopExpansion=n,this._testPointBottomExpansion=s,this._viaTopExpansion=a,this._viaBottomExpansion=l}static build(t,e=!1,r=.2,i=.2,n=.2,s=.2,a=-100,l=-100){return new o(t,e,r,i,n,s,a,l)}get padTopExpansion(){return this._padTopExpansion}set padTopExpansion(t){this._padTopExpansion=t}get padBottomExpansion(){return this._padBottomExpansion}set padBottomExpansion(t){this._padBottomExpansion=t}get testPointTopExpansion(){return this._testPointTopExpansion}set testPointTopExpansion(t){this._testPointTopExpansion=t}get testPointBottomExpansion(){return this._testPointBottomExpansion}set testPointBottomExpansion(t){this._testPointBottomExpansion=t}get viaTopExpansion(){return this._viaTopExpansion}set viaTopExpansion(t){this._viaTopExpansion=t}get viaBottomExpansion(){return this._viaBottomExpansion}set viaBottomExpansion(t){this._viaBottomExpansion=t}clone(){return new o(this.name,this.isDefault,this.padTopExpansion,this.padBottomExpansion,this.testPointTopExpansion,this.testPointBottomExpansion,this.viaTopExpansion,this.viaBottomExpansion)}};var Ux=class o extends X2{constructor(e,r,i,n){super(e,r);this.tables=new Map;this.layerStatus=1;this.layerStatus=i,this.tables=this.createTables(n)}static build(e,r=!1,i=1,n=new qa({minValue:.5,defaultValue:1,maxValue:10})){return new o(e,r,i,n)}createTables(e){return e.build(r=>new HB(r.minValue,r.defaultValue,r.maxValue))}getTable(e){return this.getValue(this.tables,e)}getAllLayerCodes(){return Array.from(this.tables.keys())}overWriteTables(e){this.tables=this.createTables(e)}getLayerStatus(){return this.layerStatus}setLayerStatus(e){this.layerStatus=e}getMinWidth(e){return this.getTable(e).minValue}setMinWidth(e,r){this.getTable(r).minValue=e}getDefaultWidth(e){return this.getTable(e).defaultValue}setDefaultWidth(e,r){this.getTable(r).defaultValue=e}getMaxWidth(e){return this.getTable(e).maxValue}setMaxWidth(e,r){this.getTable(r).maxValue=e}toJSON(){let e=new Map;return this.tables.forEach((r,i)=>{e.set(i,r.toJSON())}),e}iterateTable(e){for(let[r,i]of this.tables)if(e(i,r))return!0;return!1}clone(){let e=this.toJSON();return new o(this.name,this.isDefault,this.layerStatus,new qa(e))}};var D8e={routingRange:0,routingCorner:0,isKeep:!0,viaQuatity:0,routingEffectPriority:1,routingNetPriority:0,layers:[1,2,12],ignoreNets:[]};var Hx=class o extends N1{constructor(t,e,r,i,n,s,a,l,c=!1){super(t,c),this.layers=e,this.ignoreNets=r,this._routingCorner=i,this._isKeep=n,this._viaQuatity=s,this._routingEffectPriority=a,this._routingNetPriority=l}static build(t,e,r,i,n,s,a,l,c=!1){return new o(t,e,r,i,n,s,a,l,c)}get routingCorner(){return this._routingCorner}set routingCorner(t){this._routingCorner=t}get isKeep(){return this._isKeep}set isKeep(t){this._isKeep=t}get viaQuatity(){return this._viaQuatity}set viaQuatity(t){this._viaQuatity=t}get routingEffectPriority(){return this._routingEffectPriority}set routingEffectPriority(t){this._routingEffectPriority=t}get routingNetPriority(){return this._routingNetPriority}set routingNetPriority(t){this._routingNetPriority=t}get config(){return{routingRange:0,layers:this.layers,ignoreNets:this.ignoreNets,routingCorner:this.routingCorner,isKeep:this.isKeep,viaQuatity:this.viaQuatity,routingEffectPriority:this.routingEffectPriority,routingNetPriority:this.routingNetPriority}}updateConfig(t){Object.assign(this,t)}clone(){return new o(this.name,Array.from(this.layers),Array.from(this.ignoreNets),this.routingCorner,this.isKeep,this.viaQuatity,this.routingEffectPriority,this.routingNetPriority,this.isDefault)}};var rg=class o{constructor(t,e){this._pad1=t,this._pad2=e}static createPadItemJSON(t,e,r,i,n=""){return{id:i||"",isDissociate:t,designator:e,number:r,nets:[],belongDeiviceId:n}}static createPadItemShowTitle(t){return t.isDissociate?t.text:t.designator?`${t.designator}:${t.number}`:t.belongDeiviceId?`${t.belongDeiviceId}:${t.number}`:t.text}get pad1Title(){return this._pad1}get pad2Title(){return this._pad2}get parent(){return this._parent}get pad1(){return this.createPadItemJSON(this._pad1)}get pad2(){return this.createPadItemJSON(this._pad2)}createPadItemJSON(t){if(t==null)return null;let e="",r="",i=!0,n="";return t.indexOf(":")>=0?(e=t.split(":")[0],r=t.split(":")[1],i=!1):n=t,o.createPadItemJSON(i,e,r,n)}set parent(t){this._parent=t}toJSON(){return{pad1:this.pad1,pad2:this.pad2}}clone(){return new o(this._pad1,this._pad2)}};var WI=class o extends Y2{constructor(t,e=[],r=t+cr()){super(t),this._number=r,this._details=e,this.details.forEach(i=>{i.parent=this})}static build(t){return new o(t)}get groupName(){return this._name}set groupName(t){this._name=t}get details(){return this._details}set details(t){this._details=t}get groupColor(){return this._groupColor}set groupColor(t){this._groupColor=t}get number(){return this._number}set number(t){this._number=t}deletePadsPairGroupDetailItemByPairName(t,e="-"){let r=-1;for(let i=0;i<this.details.length;i++){let n=rg.createPadItemShowTitle(this.details[i].pad1),s=rg.createPadItemShowTitle(this.details[i].pad2);if(`${n}${e}${s}`===t){r=i;break}}if(r<=-1)return!1;this.details.splice(r,1)}updatePadsPairGroupDetails(t){return this.details=t,this.details.forEach(e=>{e.parent=this}),this.details}toJSON_ofDeatails(){let t=[];return this.details.forEach(e=>{t.push({pad1:e.toJSON().pad1,pad2:e.toJSON().pad2})}),t}clone(){let t=this._details.length,e=new Array(this._details.length);for(let r=0;r<t;r++)e[r]=this._details[r].clone();return new o(this.groupName,e,this._number)}};function Wx(o,t,e=!1){return o===13||t===13?13:o===14||t===14?14:e?t:o}var BY=class BY{constructor(){this._operation="Default"}static getInstance(){return BY._context}set(t){this._operation=t}get(){return this._operation}};BY._context=new BY;var ky=BY;var FY=class FY{constructor(){this.strategys=new Array}static getInstance(){return FY.dispatcher}subscript(t){this.strategys.push(t)}dispatcher(t){for(let e of this.strategys)e.supports(t)&&e.execute(t)}};FY.dispatcher=new FY;var jB=FY;var VY=class VY{static getInstance(){return VY._pub}constructor(){}publish(t,e){jB.getInstance().dispatcher({data:e,action:t,operation:ky.getInstance().get()})}};VY._pub=new VY;var Xp=VY;var zI=class o extends Nx{constructor(t,e,r,i){super(t,e),this._creepageDistance=r,this._ignoreLayer=i}static build(t,e){return new o(t,e,Bs(0,"mm","mil")/10,!0)}get creepageDistance(){return this._creepageDistance>=0?this._creepageDistance:0}set creepageDistance(t){this._creepageDistance=t}get ignoreLayer(){return this._ignoreLayer}set ignoreLayer(t){this._ignoreLayer=t}clone(){return new o(this.name,this.isDefault,this._creepageDistance,this._ignoreLayer)}};var L8e=["BetweenNetRule","CustomPlaneRule","NetRule"],Ro=class Ro extends wi{constructor(){super();this.safeSpacings=new Map;this.otherSpacings=new Map;this.creepageSpacings=new Map;this.trackPhysics=new Map;this.netLengthPhysics=new Map;this.netLengthTolerancePhysics=new Map;this.differentialPhysics=new Map;this.blindViaPhysics=new Map;this.radiusPhysics=new Map;this.innerPlanes=new Map;this.copperPlanes=new Map;this.solderExpansions=new Map;this.pasteExpansions=new Map;this.nets=new Map;this.netClass=new Map;this.netDifferentials=new Map;this.regionSelectors=new Map;this.autoRouters=new Map;this.equalLengthGroups=new Map;this.padsPairGroups=new Map;this.betweenNetRule=new tre("");this.ruleTemplateName="";this.cacheNetModel=new Map;this.defaultRuleMap=new Map;this.max=null}static getInstance(){return Ro.manager==null&&(Ro.manager=new Ro),Ro.manager}correctRuleData(){let e=Qc,r=Ro.getInstance().getAllTrackPhysics(),i=n=>{n.minValue=Math.max(n.minValue,e),n.maxValue=Math.max(n.maxValue,e),n.defaultValue=Math.max(n.defaultValue,n.minValue),n.defaultValue=Math.min(n.defaultValue,n.maxValue)};for(let n of r){let s=n.toJSON();for(let[,a]of s)i(a)}}correctDefault(){let e=(I,C)=>{if(!I||!I.size)return;let E=Array.from(I),O=E.filter(_=>_==null?void 0:_.isDefault);if(O.length>1){O.slice(1).forEach(_=>{_.isDefault=!1});return}O.length===0&&(E[0].isDefault=!0)},r="Common";if(Ro.getInstance().getDefaultSafeSpacing()==null){let I=Ro.getInstance().getAllSafeSpacing();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=Ro.getInstance().addSafeSpacing("safeClearance");C.isDefault=!0}}if(Ro.getInstance().getDefaultOtherSpacing()==null){let I=Ro.getInstance().getAllOtherSpacing();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=Ro.getInstance().addOtherSpacing("otherClearance");C.isDefault=!0}}if(Ro.getInstance().getDefaultCreepageSpacing()==null){let I=Ro.getInstance().getAllCreepageSpacing();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=Ro.getInstance().addCreepageSpacing("creepage");C.isDefault=!0}}if(Ro.getInstance().getDefaultTrackPhysics()==null){let I=Ro.getInstance().getAllTrackPhysics();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=Ro.getInstance().addTrackPhysics("trackWidth");C.isDefault=!0}}if(Ro.getInstance().getDefaultNetLengthPhysics()==null){let I=Ro.getInstance().getAllNetLengthPhysics();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=Ro.getInstance().addNetLengthPhysics("netLength");C.isDefault=!0}}if(Ro.getInstance().getDefaultNetLengthTolerancePhysics()==null){let I=Ro.getInstance().getAllNetLengthTolerancePhysics();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=Ro.getInstance().addNetLengthTolerancePhysics("netLengthTolerance");C.isDefault=!0}}if(Ro.getInstance().getDefaultDifferentialPhysics()==null){let I=Ro.getInstance().getAllDifferentialPhysics();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=Ro.getInstance().addDifferentialPhysics("differentialPair");C.isDefault=!0}}if(Ro.getInstance().getDefaultBlindPhysics()==null){let I=Ro.getInstance().getAllBlindPhysics();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=Ro.getInstance().addBlindPhysics("blindVia");C.isDefault=!0}}if(Ro.getInstance().getDefaultRadiusPhysics()==null){let I=Ro.getInstance().getAllRadiusPhysics();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=Ro.getInstance().addRadiusPhysics("viaSize");C.isDefault=!0}}let p=Ro.getInstance().getDefaultInnerPlane();if(p==null){let I=Ro.getInstance().getAllInnerPlane();if(I.size>0)for(let C of I){C.isDefault=!0;break}else p=Ro.getInstance().addInnerPlane("innerPlane"),p.isDefault=!0}let m=Ro.getInstance().getDefaultCopperPlane();if(m==null){let I=Ro.getInstance().getAllCopperPlane();if(I.size>0)for(let C of I){C.isDefault=!0;break}else m=Ro.getInstance().addCopperPlane("copperRegion"),m.isDefault=!0}if(Ro.getInstance().getDefaultSolderExpansion()==null){let I=Ro.getInstance().getAllSolderExpansion();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=Ro.getInstance().addSolderExpansion("solderMaskExpansion");C.isDefault=!0}}if(Ro.getInstance().getDefaultPasteExpansion()==null){let I=Ro.getInstance().getAllPasteExpansion();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=Ro.getInstance().addPasteExpansion("pasteMaskExpansion");C.isDefault=!0}}e(Ro.getInstance().getAllSafeSpacing(),"safe"),e(Ro.getInstance().getAllOtherSpacing(),"other"),e(Ro.getInstance().getAllTrackPhysics(),"track"),e(Ro.getInstance().getAllNetLengthPhysics(),"netLength"),e(Ro.getInstance().getAllNetLengthTolerancePhysics(),"netLengthTolerance"),e(Ro.getInstance().getAllDifferentialPhysics(),"differential"),e(Ro.getInstance().getAllBlindPhysics(),"blind"),e(Ro.getInstance().getAllRadiusPhysics(),"radius"),e(Ro.getInstance().getAllInnerPlane(),"inner"),e(Ro.getInstance().getAllCopperPlane(),"copper"),e(Ro.getInstance().getAllSolderExpansion(),"solder"),e(Ro.getInstance().getAllPasteExpansion(),"paste"),this.getDefaultAutoRouter()==null&&(this.addAutoRouter(r).isDefault=!0);let P=Ro.getInstance().getAllNetDifferentials(),T=new Array;for(let I of P)(I.negativeNet==null||I.positiveNet==null)&&T.push(I.name);Ro.getInstance().deleteNetDifferential(T)}correctRegion(){this.getAllRegions().forEach(r=>{r.copperPlane!=null&&(this.getCopperPlane(r.copperPlane)||this.addCopperPlane(r.copperPlane)),r.innerPlane!=null&&(this.getInnerPlane(r.innerPlane)||this.addInnerPlane(r.innerPlane))})}addAutoRouter(e,r){let i=Object.assign({},D8e,r),n=Hx.build(e,i.layers,i.ignoreNets,i.routingCorner,i.isKeep,i.viaQuatity,i.routingEffectPriority,i.routingNetPriority);return this.autoRouters.set(e,n),n}addSafeSpacing(e,r,i,n){let s=HI.build(e,r,i,n);return this.safeSpacings.set(e,s),s}addOtherSpacing(e){let r=Wb.build(e);return this.otherSpacings.set(e,r),r}addCreepageSpacing(e,r){let i=zI.build(e,r);return this.creepageSpacings.set(e,i),i}addTrackPhysics(e,r,i,n){let s=Ux.build(e,r,i,n);return this.trackPhysics.set(e,s),s}addDifferentialPhysics(e,r,i,n,s,a){let l=Hb.build(e,r||!1,i,n,s,a);return this.differentialPhysics.set(e,l),l}addNetLengthPhysics(e,r=!1,i=0,n=0){let s=Lx.build(e,r,i,n);return this.netLengthPhysics.set(e,s),s}addNetLengthTolerancePhysics(e,r=!1,i=100,n=null){let s=Mx.build(e,r,i,n);return this.netLengthTolerancePhysics.set(e,s),s}addBlindPhysics(e){let r=Rx.build(e,!1);return this.blindViaPhysics.set(e,r),r}addRadiusPhysics(e){let r=Vx.build(e);return this.radiusPhysics.set(e,r),r}addInnerPlane(e,r,i,n){let s=wx.build(e,r,i,n);return this.innerPlanes.set(e,s),s}addCopperPlane(e,r,i,n,s,a){let l=Dx.build(e,r,i,n,s,a);return this.copperPlanes.set(e,l),l}addSolderExpansion(e){let r=Gx.build(e);return this.solderExpansions.set(e,r),r}addPasteExpansion(e){let r=Fx.build(e);return this.pasteExpansions.set(e,r),r}addNet(e){if(e==null)return null;e=e==null?void 0:e.toUpperCase();let r=this.nets.get(e);return r==null&&(r=new bp(e),this.nets.set(e,r),this.cacheNetModel.get(e)&&this.rebuild(this.cacheNetModel.get(e))),r}addRegionSelector(e){let r=this.regionSelectors.get(e);return r==null&&(r=UI.build(e),this.regionSelectors.set(e,r)),r}addRegionSelectorByRuleModel(e,r){this.regionSelectors.set(e,r)}addConstraintSelector(e){let r=this.regionSelectors.get(e);return r==null&&(r=UI.build(e,"constraint"),this.regionSelectors.set(e,r),r.safeClearance=null,r.otherClearance=null,r.creepageClearance=null,r.track=null,r.diff=null,r.radius=null,r.innerPlane=null,r.copperPlane=null),r}updateRegionSelector(e,r,i=!1){let n=this.getRegion(e);if(n==null||r==null){n!=null&&i&&Xp.getInstance().publish("modify",n);return}let s=[],{safeClearance:a,safeCopperPlane:l,safeInnerPlane:c,otherClearance:h,track:u,diff:d,radius:p,innerPlane:m,copperPlane:g,creepageClearance:y}=r;if(r.safeClearance!==void 0&&(!a||!this.getSafeSpacing(a)?(n.safeClearance=null,a&&s.push({type:"Safe Spacing",name:a})):n.safeClearance=a),r.safeCopperPlane!==void 0){let b=l;(b==""||!b)&&(b=null),n.safeCopperPlane=b}if(r.safeInnerPlane!==void 0){let b=c;(b==""||!b)&&(b=null),n.safeInnerPlane=b}return r.otherClearance!==void 0&&(!h||!this.getOtherSpacing(h)?(n.otherClearance=null,h&&s.push({type:"Other Spacing",name:h})):n.otherClearance=h),r.creepageClearance!==void 0&&(!y||!this.getCreepageSpacing(y)?(n.creepageClearance=null,y&&s.push({type:"Creepage Distance",name:y})):n.creepageClearance=y),r.track!==void 0&&(!u||!this.getTrackPhysics(u)?(n.track=null,u&&s.push({type:"Track",name:u})):n.track=u),r.diff!==void 0&&(!d||!this.getDifferentialPhysics(d)?(n.diff=null,d&&s.push({type:"Differential Pair",name:d})):n.diff=d),r.radius!==void 0&&(!p||!this.getRadiusPhysics(p)?(n.radius=null,p&&s.push({type:"Via Size",name:p})):n.radius=p),r.innerPlane!==void 0&&(!m||!this.getInnerPlane(m)?(n.innerPlane=null,m&&s.push({type:"Plane Zone",name:m})):n.innerPlane=m),r.copperPlane!==void 0&&(!g||!this.getCopperPlane(g)?(n.copperPlane=null,g&&s.push({type:"Copper Zone",name:g})):n.copperPlane=g),i&&Xp.getInstance().publish("modify",n),s}addNetClass(e,r){let i;return r?i=r:i=new Eu(e),this.netClass.set(e,i),i}addNetDifferential(e,r,i,n){let s=new q2(e);if(this.netDifferentials.set(e,s),r){let a=this.getNet(r);a&&s.fillPositiveNet(a)}if(i){let a=this.getNet(i);a&&s.fillNegativeNet(a)}return n&&(s.differentialPhysics=n),s}addEqualLengthGroup(e,r){let i;return r?i=r:i=new Vd(e),this.equalLengthGroups.set(e,i),i}getSafeSpacing(e){return this.getRule(this.safeSpacings,e)}getNetClearance(e){let r=this.getDefaultSafeSpacing();return r==null&&(this.correctDefault(),r=this.getDefaultSafeSpacing()),r.getData(e)[0][0]}getOtherSpacing(e){return this.getRule(this.otherSpacings,e)}getCreepageSpacing(e){return this.getRule(this.creepageSpacings,e)}getTrackPhysics(e){return this.getRule(this.trackPhysics,e)}getTrackWidth(e){let r=this.getDefaultTrackPhysics();return r==null&&(this.correctDefault(),r=this.getDefaultTrackPhysics()),r.getDefaultWidth(e)}getDifferentialPhysics(e){return this.getRule(this.differentialPhysics,e)}getNetLengthPhysics(e){return this.getRule(this.netLengthPhysics,e)}getNetLengthTolerancePhysics(e){return e?this.getRule(this.netLengthTolerancePhysics,e):null}getBlindPhysics(e){return this.getRule(this.blindViaPhysics,e)}getRadiusPhysics(e){return this.getRule(this.radiusPhysics,e)}getViaDiameter(){let e=this.getDefaultRadiusPhysics();return e==null&&(this.correctDefault(),e=this.getDefaultRadiusPhysics()),e.defalutRadius*2}getViaHoleD(){let e=this.getDefaultRadiusPhysics();return e==null&&(this.correctDefault(),e=this.getDefaultRadiusPhysics()),e.defalutInner*2}getInnerPlane(e){return this.getRule(this.innerPlanes,e)}getCopperPlane(e){return this.getRule(this.copperPlanes,e)}getSolderExpansion(e){return this.getRule(this.solderExpansions,e)}getPasteExpansion(e){return this.getRule(this.pasteExpansions,e)}getMaxSafe(e){if(this.max==null){let r=this.getDefaultSafeSpacing();r==null&&(this.correctDefault(),r=this.getDefaultSafeSpacing()),this.max=r.getMaxClearance(e);for(let[,i]of this.safeSpacings){let n=i.getMaxClearance(e);n>this.max&&(this.max=n)}this.max=Math.max(this.max,this.getMaxDiffPair(e))}return this.max}getMaxSafeTrack(e){let r=0,i=this.getDefaultSafeSpacing();i==null&&(this.correctDefault(),i=this.getDefaultSafeSpacing()),r=i.getItemMaxClearance(0,void 0,e);for(let[,n]of this.safeSpacings){let s=n.getItemMaxClearance(0,void 0,e);s>r&&(r=s)}return r=Math.max(r,this.getMaxDiffPair(e)),r}getMaxDiffPair(e){let r=0;for(let[,i]of this.differentialPhysics)r=Math.max(i.getMaxSpacingMin(e),r);return r}getItemMaxClearance(e,r){switch(e){case 12:{let n=0;for(let[,s]of this.otherSpacings)n=Math.max(n,s.holeClearance);for(let[,s]of this.safeSpacings){let a=s.getItemMaxClearance(e);n=Math.max(n,a)}return n}case 16:{let n=0;for(let[,s]of this.otherSpacings)n=Math.max(n,s.deviceClearance,s.thru2SmdClearance);return n}case 15:return 0;case 0:{let n=0;for(let[,s]of this.safeSpacings){let a=s.getItemMaxClearance(e,void 0,r);n=Math.max(n,a)}return n}case 13:case 14:case 7:{let n=0;for(let[,s]of this.safeSpacings){let a=s.getItemMaxClearance(7,void 0,r);n=Math.max(n,a)}return n}default:let i=0;for(let[,n]of this.safeSpacings){let s=n.getItemMaxClearance(e,void 0,r);i=Math.max(i,s)}return i}}getModelPairMaxClearance(e,r,i,n){let s=0,a=u=>{s=Math.max(s,u)},l=u=>u===2||u===4||u===5,c=r===16&&i===16,h=r===2&&i===16||r===16&&i===2;if(c||h)for(let[,u]of this.otherSpacings)c?a(u.deviceClearance):h&&a(u.thru2SmdClearance);else{let u=l(r),d=l(i),p=Array.from(new Set([r,u?12:r])),m=Array.from(new Set([i,d?12:i]));if(u||d||r==8||i==8){for(let y of e.safeSpacing){let b=y.getItemsMaxClearance(p,m,n);a(b)}if(u&&d)for(let[,y]of this.otherSpacings)a(y.holeClearance)}else{for(let y of e.safeSpacing){let b=y.getItemMaxClearance(r,[i],n);a(b)}if(r===0&&i===0)for(let y of e.diffPair){let b=y.getDifferentialPairSpacingMin(n);a(b)}}}return s}getNet(e){return this.getRuleSelector(this.nets,e)}getSpecctraNetClass(e=1){let r=[];for(let[i,n]of this.nets)r.push({net:i,width:this.getTrackPhysics(n.trackPhysics).getDefaultWidth(e),clearance:this.getSafeSpacing(n.safeSpacing).getData(e)[0][0],viaHoleD:this.getRadiusPhysics(n.radiusPhysics).defalutInner*2,viaHoleDiameter:this.getRadiusPhysics(n.radiusPhysics).defalutRadius*2});return r}getNetClass(e){return this.netClass.get(e)}getNetDifferential(e){return this.netDifferentials.get(e)}getRegion(e){return this.regionSelectors.get(e)}getAutoRouter(e){return this.autoRouters.get(e)}getEqualLengthGroup(e){return this.equalLengthGroups.get(e)}deleteSafeSpacing(e){this._last=this.safeSpacings.get(e),this._last!=null&&(this.safeSpacings.delete(e),this.defaultRuleMap.clear())}deleteOtherSpacing(e){this._last=this.otherSpacings.get(e),this._last!=null&&this.otherSpacings.delete(e)}deleteCreepageSpacing(e){this._last=this.creepageSpacings.get(e),this._last!=null&&this.creepageSpacings.delete(e)}deleteTrackPhysics(e){this._last=this.trackPhysics.get(e),this._last!=null&&this.trackPhysics.delete(e)}deleteDifferentialPhysics(e){this._last=this.differentialPhysics.get(e),this._last!=null&&this.differentialPhysics.delete(e)}deleteNetLengthPhysics(e){this._last=this.netLengthPhysics.get(e),this._last!=null&&this.netLengthPhysics.delete(e)}deleteNetLengthTolerancePhysics(e){this._last=this.netLengthTolerancePhysics.get(e),this._last!=null&&this.netLengthTolerancePhysics.delete(e)}deleteBlindPhysics(e){this._last=this.blindViaPhysics.get(e),this._last!=null&&this.blindViaPhysics.delete(e)}deleteRadiusPhysics(e){this._last=this.radiusPhysics.get(e),this._last!=null&&this.radiusPhysics.delete(e)}deleteInnerPlane(e){this._last=this.innerPlanes.get(e),this._last!=null&&this.innerPlanes.delete(e)}deleteCopperPlane(e){if(this._last=this.copperPlanes.get(e),this._last!=null){for(let[,r]of this.nets)r.copperPlane==this._last.name&&(r.copperPlane="default");for(let r of this.getAllCopperPlaneRegions())r.copperPlane==this._last.name&&(r.copperPlane="default");this.copperPlanes.delete(e)}}deleteSolderExpansion(e){this._last=this.solderExpansions.get(e),this._last!=null&&this.solderExpansions.delete(e)}deletePasteExpansion(e){this._last=this.pasteExpansions.get(e),this._last!=null&&this.pasteExpansions.delete(e)}deleteAutoRouter(e){this._last=this.autoRouters.get(e),this._last!=null&&this.autoRouters.delete(e)}deleteNet(e,r=!0){let i=this.nets.get(e);if(i==null)return;let n=i.netDifferential,s=i.netClass,a=i.equalLengthGroup;if(r){let l={name:i.name,safeSpacing:i.safeSpacing,trackPhysics:i.trackPhysics,differentailPhysics:i.differentialPhysics,netLengthPhysics:i.netLengthPhysics,netLengthTolerancePhysics:i.netLengthTolerancePhysics,blindViaPhysics:i.blindViaPhysics,radiusPhysics:i.radiusPhysics,innerPlane:i.innerPlane,copperPlane:i.copperPlane,solderExpansion:i.solderExpansion,pasteExpansion:i.pasteExpansion,showRatline:i.showRatline,color:i.color,creepageSpacing:i.creepageSpacing};this.cacheNetModel.set(e,l),n!=null&&(this.cacheNetModel.get(e).netDifferentail={name:n.name,positiveNet:n.positiveNet.name,negativeNet:n.negativeNet.name,differentailPhysics:n.differentialPhysics},n.remove(),this.netDifferentials.delete(n.name)),s!=null&&(this.cacheNetModel.get(e).netClass={name:s.name,safeSpacing:s.safeSpacing,trackPhysics:s.trackPhysics,differentialPhysics:s.differentialPhysics,netLengthPhysics:s.netLengthPhysics,netLengthTolerancePhysics:s.netLengthTolerancePhysics,blindViaPhysics:s.blindViaPhysics,radiusPhysics:s.radiusPhysics,innerPlane:s.innerPlane,copperPlane:s.copperPlane,solderExpansion:s.solderExpansion,pasteExpansion:s.pasteExpansion,creepageSpacing:s.creepageSpacing,nets:new Set(s.getNets())}),a!=null&&(this.cacheNetModel.get(e).equalLengthGroup={name:a.name,netLengthPhysics:a.netLengthPhysics,netLengthTolerancePhysics:i.netLengthTolerancePhysics,targetNet:i.equalLengthGroup.targetNet,nets:new Set(i.equalLengthGroup.getNets())})}for(let l of this.betweenNetRule.rule)if(l.net1===i||l.net2===i){x.getInstance().compiler.deleteRuleSelector([this.getRuleSelect(l.net1),this.getRuleSelect(l.net2)]);break}this.betweenNetRule.deltetRule4Net(i),i!=null&&i.remove(),this.nets.delete(e),x.getInstance().compiler.deleteRuleSelector(["NET",e]),r&&(s&&s.getAllNets().length==0&&this.deleteNetClass(s.name),a&&a.getAllNets().length==0&&this.deleteEqualLengthGroup(a.name))}rebuild(e){if(this.nets.get(e.name)){let{name:r,safeSpacing:i,trackPhysics:n,differentialPhysics:s,netLengthPhysics:a,netLengthTolerancePhysics:l,blindViaPhysics:c,radiusPhysics:h,innerPlane:u,copperPlane:d,solderExpansion:p,pasteExpansion:m,netClassName:g,equalLengthGroupName:y,netDifferentialName:b,showRatline:P,color:T,creepageSpacing:I}=e,C=new bp(r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I);if(this.betweenNetRule.rebuild(C),this.nets.set(r,C),e.netDifferentail){let{name:E,positiveNet:O,negativeNet:_,differentailPhysics:R}=e.netDifferentail;if(!this.getNet(O)){let v=new bp(O);this.nets.set(O,v)}if(!this.getNet(_)){let v=new bp(_);this.nets.set(_,v)}this.addNetDifferential(E,O,_,R)}if(e.netClass){let{name:E,safeSpacing:O,trackPhysics:_,differentailPhysics:R,netLengthTolerancePhysics:v,netLengthPhysics:D,blindViaPhysics:w,radiusPhysics:F,innerPlane:H,copperPlane:z,solderExpansion:G,pasteExpansion:W,nets:L,creepageSpacing:B}=e.netClass,N=new Eu(E,O,_,R,D,v,w,F,H,z,G,W,L,B);this.netClass.set(E,N),this.nets.get(e.name).netClass=N,this.betweenNetRule.rebuild(N)}if(e.equalLengthGroup){let{name:E,netLengthPhysics:O,nets:_,netLengthTolerancePhysics:R,targetNet:v}=e.equalLengthGroup,D=new Vd(E,O,_);D.netLengthTolerancePhysics=R,D.targetNet=v,this.equalLengthGroups.set(E,D),this.nets.get(e.name).equalLengthGroup=D}return this.cacheNetModel.delete(e.name),C}}deleteNetClass(e){let r=this.netClass.get(e);r!=null&&(r.getAllNets().forEach(i=>{i.safeSpacing="default",i.trackPhysics="default",i.blindViaPhysics="default",i.radiusPhysics="default",i.innerPlane="default",i.copperPlane="default",i.solderExpansion="default",i.pasteExpansion="default",i.creepageSpacing="default"}),this.betweenNetRule.deltetRule4Net(r),r!=null&&r.remove(),this.netClass.delete(e)),x.getInstance().compiler.deleteRuleSelector(["NET_CLASS",r.name])}deleteNetDifferential(e){e.forEach(r=>{let i=this.netDifferentials.get(r);i!=null&&(i.getAllNets().forEach(s=>s.differentialPhysics="default"),i.remove(),this.netDifferentials.delete(r)),x.getInstance().compiler.deleteRuleSelector(["DIFF_PAIR",i.name])})}deleteRegion(e){this.regionSelectors.delete(e)}deleteEqualLengthGroup(e){let r=this.equalLengthGroups.get(e);return r!=null&&(r.getAllNets().forEach(i=>{i.netLengthPhysics="default",i.netLengthTolerancePhysics=null}),r.remove()),x.getInstance().compiler.deleteRuleSelector(["EQ_LEN_GRP",r.name]),this.equalLengthGroups.delete(e)}deletePadsPairGroup(e){this.padsPairGroups.delete(e)}getDefaultSafeSpacing(){return this.getDefault(this.safeSpacings)}getDefaultOtherSpacing(){return this.getDefault(this.otherSpacings)}getDefaultCreepageSpacing(){return this.getDefault(this.creepageSpacings)}getDefaultTrackPhysics(){return this.getDefault(this.trackPhysics)}getDefaultDifferentialPhysics(){return this.getDefault(this.differentialPhysics)}getDefaultNetLengthPhysics(){return this.getDefault(this.netLengthPhysics)}getDefaultNetLengthTolerancePhysics(){return this.getDefault(this.netLengthTolerancePhysics)}getDefaultBlindPhysics(){return this.getDefault(this.blindViaPhysics)}getDefaultRadiusPhysics(){return this.getDefault(this.radiusPhysics)}getDefaultInnerPlane(){return this.getDefault(this.innerPlanes)}getDefaultCopperPlane(){return this.getDefault(this.copperPlanes)}getDefaultSolderExpansion(){return this.getDefault(this.solderExpansions)}getDefaultPasteExpansion(){return this.getDefault(this.pasteExpansions)}getDefaultAutoRouter(){return this.getDefault(this.autoRouters)}getAllSafeSpacing(){return this.getAll(this.safeSpacings)}getAllOtherSpacing(){return this.getAll(this.otherSpacings)}getAllCreepageSpacing(){return this.getAll(this.creepageSpacings)}getAllTrackPhysics(){return this.getAll(this.trackPhysics)}getAllDifferentialPhysics(){return this.getAll(this.differentialPhysics)}getAllNetLengthPhysics(){return this.getAll(this.netLengthPhysics)}getAllNetLengthTolerancePhysics(){return this.getAll(this.netLengthTolerancePhysics)}getAllBlindPhysics(){return this.getAll(this.blindViaPhysics)}getAllRadiusPhysics(){return this.getAll(this.radiusPhysics)}getAllInnerPlane(){return this.getAll(this.innerPlanes)}getAllCopperPlane(){return this.getAll(this.copperPlanes)}getAllSolderExpansion(){return this.getAll(this.solderExpansions)}getAllPasteExpansion(){return this.getAll(this.pasteExpansions)}getAllNets(){let e=new Set;for(let[,r]of this.nets)e.add(r);return e}getAllRegions(){let e=new Set;for(let[,r]of this.regionSelectors)e.add(r);return e}getAllCopperPlaneRegions(){let e=new Set;for(let[,r]of this.regionSelectors)r.regionType==="region"&&e.add(r);return e}getAllConstraintRegions(){let e=new Set;for(let[,r]of this.regionSelectors)r.regionType==="constraint"&&e.add(r);return e}getNoDifferentail(){let e=new Set;for(let[,r]of this.nets)r.netDifferential==null&&e.add(r);return e}getAllNetClass(){return this.getAllSelector(this.netClass)}getAllEqualLengthGroups(){return this.getAllSelector(this.equalLengthGroups)}getAllNetDifferentials(){return this.getAllSelector(this.netDifferentials)}getAllAutoRouterRules(){return this.getAll(this.autoRouters)}getAll(e){let r=new Set;for(let[,i]of e)r.add(i);return r}getAllSelector(e){let r=new Set;for(let[,i]of e)r.add(i);return r}getDefault(e){if(e==this.safeSpacings){let r=this.defaultRuleMap.get("safe");if(r&&r!==null)return r;for(let[,i]of e)if(i.isDefault)return this.defaultRuleMap.set("safe",i),i}for(let[,r]of e)if(r.isDefault)return r}getRule(e,r){return!r||r=="default"?(e.size==0&&this.correctDefault(),this.getDefault(e)):e.get(r)}getRuleSelector(e,r){if(r!=null)return e.get(r==null?void 0:r.toUpperCase())}renameNetClass(e,r){let i=this.netClass.get(e);i!=null&&(i.name=r,this.netClass.set(r,i),e!==r&&(this.netClass.delete(e),x.getInstance().compiler.deleteRuleSelector(["NET_CLASS",e]))),this.renameBetweenNetRule(this.betweenNetRule.rule,e,r)}renameBetweenNetRule(e,r,i){for(let n of e)n.net1 instanceof Eu&&n.net1.name==r&&(n.net1.name=i),n.net2 instanceof Eu&&n.net2.name==r&&(n.net2.name=i)}renameEqualLengthGroup(e,r){let i=this.equalLengthGroups.get(e);i!=null&&(i.name=r,this.equalLengthGroups.set(r,i),e!==r&&(this.equalLengthGroups.delete(e),x.getInstance().compiler.deleteRuleSelector(["EQ_LEN_GRP",e])))}renameNetDifferential(e,r,i,n){this.netDifferentials.get(e)!=null&&(this.deleteNetDifferential([e]),x.getInstance().compiler.deleteRuleSelector(["DIFF_PAIR",e])),this.addNetDifferential(r,i,n)}getBetweenNetRuleByNet(e,r,i,n,s=fT){return this.betweenNetRule.rule.length==0?null:this.getSafeRuleByNets(e,r,i,n,s)}getCreepageBetweenNetRuleByNet(e,r,i,n,s=fT){return this.betweenNetRule.rule.length==0?null:this.getCreepageRuleByNets(e,r,i,n,s)}getSafeRuleByNets(e,r,i,n,s){let a=this.getBetweenNetRule(this.betweenNetRule.rule,i,n),l,c=e==13||r==13,h=e==14||r==14;for(let u of a){let d;c&&u.safeCopperPlane?d=this.getSafeSpacing(u.safeCopperPlane):h&&u.safeInnerPlane&&(d=this.getSafeSpacing(u.safeInnerPlane));let p=u.ruleName;!d&&p&&(d=this.getSafeSpacing(p)),(l==null||d&&l.getClearance(e,r,s)<d.getClearance(e,r,s))&&(l=d)}return l}getCreepageRuleByNets(e,r,i,n,s){let a=this.getBetweenNetRule(this.betweenNetRule.rule,i,n),l;for(let c of a){let h=c.creepageRule;if(!h)continue;let u=this.getCreepageSpacing(h);(l==null||u&&l.creepageDistance<u.creepageDistance)&&(l=u)}return l}getBetweenNetRule(e,r,i){let n=new Array;for(let s of e)s.net1==null||s.net2==null||(s.net1.hasNet(r)&&s.net2.hasNet(i)||s.net1.hasNet(i)&&s.net2.hasNet(r))&&n.push(s);return n}getRuleByID(e,r){let i=this.getRegion(e);if(!i)return;let n={13:i.safeCopperPlane||i.safeClearance,14:i.safeInnerPlane||i.safeClearance};return n[r]?this.getSafeSpacing(n[r]):void 0}getRuleByNet(e,r,i){switch(r){case 0:return this.getSafeSpacingByNet(e,i);case 1:return this.getOtherSpacingByNet(e);case 2:return this.getCreepageSpacingByNet(e);case 3:return this.getTrackPhysicsByNet(e);case 4:return this.getNetLengthPhysicsByNet(e);case 5:return this.getNetLengthTolerancePhysicsByNet(e);case 6:return this.getDifferentialPhysicsByNet(e);case 7:return this.getBlindPhysicsByNet(e);case 8:return this.getRadiusPhysicsByNet(e);case 9:return this.getInnerPlaneByNet(e);case 10:return this.getCopperPlaneByNet(e);case 11:return this.getPasteExpansionByNet(e);case 12:return this.getSolderExpansionByNet(e)}}getDefaultRule(e){switch(e){case 0:return this.getDefaultSafeSpacing();case 1:return this.getDefaultOtherSpacing();case 2:return this.getDefaultCreepageSpacing();case 3:return this.getDefaultTrackPhysics();case 6:return this.getDefaultDifferentialPhysics();case 7:return this.getDefaultBlindPhysics();case 8:return this.getDefaultRadiusPhysics();case 9:return this.getDefaultInnerPlane();case 10:return this.getDefaultCopperPlane();case 11:return this.getDefaultPasteExpansion();case 12:return this.getDefaultSolderExpansion();default:throw new Error("Get default rule fail,Input rule type error!!!")}}getSafeSpacingByNet(e,r){let i=this.getNet(e),n;return r==13&&(i!=null&&i.safeCopperPlane)?n=this.getSafeSpacing(i.safeCopperPlane):r==14&&(i!=null&&i.safeInnerPlane)&&(n=this.getSafeSpacing(i.safeInnerPlane)),!n&&(i!=null&&i.safeSpacing)&&(n=this.getSafeSpacing(i.safeSpacing)),n||this.getDefaultSafeSpacing()}getOtherSpacingByNet(e){return this.getDefaultOtherSpacing()}getCreepageSpacingByNet(e){let r=this.getNet(e);return this.getCreepageSpacing(r==null?void 0:r.creepageSpacing)}getTrackPhysicsByNet(e){let r=this.getNet(e);return this.getTrackPhysics(r==null?void 0:r.trackPhysics)}getNetLengthPhysicsByNet(e){let r=this.getNet(e);return this.getNetLengthPhysics(r==null?void 0:r.netLengthPhysics)}getNetLengthTolerancePhysicsByNet(e){let r=this.getNet(e);return this.getNetLengthTolerancePhysics(r==null?void 0:r.netLengthTolerancePhysics)}getDifferentialPhysicsByNet(e){var i;let r=this.getNet(e);return this.getDifferentialPhysics((i=r==null?void 0:r.netDifferential)==null?void 0:i.differentialPhysics)}getBlindPhysicsByNet(e){let r=this.getNet(e);return this.getBlindPhysics(r==null?void 0:r.blindViaPhysics)}getRadiusPhysicsByName(e){return this.getRadiusPhysics(e)}getRadiusPhysicsByNet(e){let r=this.getNet(e);return this.getRadiusPhysics(r==null?void 0:r.radiusPhysics)}getInnerPlaneByNet(e){let r=this.getNet(e);return this.getInnerPlane(r==null?void 0:r.innerPlane)}getCopperPlaneByNet(e){let r=this.getNet(e);return this.getCopperPlane(r==null?void 0:r.copperPlane)}getSolderExpansionByNet(e){let r=this.getNet(e);return this.getSolderExpansion(r==null?void 0:r.solderExpansion)}getPasteExpansionByNet(e){let r=this.getNet(e);return this.getPasteExpansion(r==null?void 0:r.pasteExpansion)}isDiffPair(e,r){var i;if(e!=null&&r!=null&&e!=r){let n=this.getNet(e);if(n!=null&&n.netDifferentialName!=null&&((i=n.netDifferential)!=null&&i.hasNet(r)))return!0}return!1}getSafeClearanceByOrder(e,r,i,n){switch(i){case"BetweenNetRule":{if(this.betweenNetRule.rule.length==0)return null;if(e.net!=null&&r.net!=null){let s=this.getSafeRuleByNets(e.shapeType,r.shapeType,e.net,r.net,n);if(s!=null)return s.getClearance(e.shapeType,r.shapeType,n)}return null}case"CustomPlaneRule":{if(e.shapeType==0&&r.shapeType==0&&this.isDiffPair(e.net,r.net)){let a=this.getDifferentialPhysicsByNet(e.net);if(a!=null)return a.getMaxSpacingMin(n)}let s=this.getSafeRuleByOrder(e,r,"CustomPlaneRule",n);return s?s.getClearance(e.shapeType,r.shapeType,n):null}case"NetRule":{let s=this.getSafeSpacingByNet(e.net,Wx(e.shapeType,r.shapeType)),a=this.getSafeSpacingByNet(r.net,Wx(e.shapeType,r.shapeType,!0));return Math.max(s.getClearance(e.shapeType,r.shapeType,n),a.getClearance(e.shapeType,r.shapeType,n))}default:{let s=this.getDefaultSafeSpacing();return s==null&&(this.correctDefault(),s=this.getDefaultSafeSpacing()),s.getClearance(e.shapeType,r.shapeType,n)}}}sortRulesByClearance(e,r,i,n){return xr(e,(s,a)=>a.getClearance(r,i,n)-s.getClearance(r,i,n),0,e.length),e[0]}getSafeRuleByOrder(e,r,i,n,s){let a=this.getRule4Order(e,r,i,0,n,s);if(a.length>0){let l=e.shapeType,c=r.shapeType;return this.sortRulesByClearance(a,l,c,n),a[0]}}getSafeRule(e,r,i){let n=["BetweenNetRule","NetRule"],s=this.getDefaultSafeSpacing(),a=i||By(e.layerId,r.layerId);for(let l of n){let c=this.getSafeRuleByOrder(e,r,l,a);if(c)return c}return s}isBridgeCopperRuleItem(e){return e&&"isBridgingCopper"in e&&e.isBridgingCopper&&Array.isArray(e.nets)}getSafeClearance(e,r,i){let n=null,s=i||By(e.layerId,r.layerId),a=this.isBridgeCopperRuleItem(e),l=this.isBridgeCopperRuleItem(r),c=a?e.nets.length==0?[""]:e.nets:[e.net],h=l?r.nets.length==0?[""]:r.nets:[r.net],u=new Set,d=[];if(a||l){for(let m of L8e)if(!(m=="BetweenNetRule"&&a&&l)){for(let g of c)for(let y of h){if(g===y||g==null||y==null)continue;let b=`${g}-${y}`,P=`${y}-${g}`;if(!u.has(b)){let T=this.getSafeRuleByOrder(e,r,m,i,[g,y]);T&&(d.push(T),["BetweenNetRule","CustomPlaneRule"].includes(m)&&(u.add(b),u.add(P)))}}if(u.size>2&&u.size/2===c.length*h.length)break}if(d.length>0)return this.sortRulesByClearance(d,e.shapeType,r.shapeType,s).getClearance(e.shapeType,r.shapeType,s)}else for(let m of L8e)if(n=this.getSafeClearanceByOrder(e,r,m,s),n!=null)return n;let p=this.getDefaultSafeSpacing();return p==null&&(this.correctDefault(),p=this.getDefaultSafeSpacing()),p.getClearance(e.shapeType,r.shapeType,s)}getRule4Order(e,r,i,n,s,a){let l=new Array,c=e.shapeType,h=r.shapeType,u=a&&a[0]||e.net,d=a&&a[1]||r.net,p=s||By(e.layerId,r.layerId);switch(i){case"BetweenNetRule":{if(n==0){if(u!=null&&d!=null){let m=this.getBetweenNetRuleByNet(c,h,u,d,p);m!=null&&l.push(m)}}else if(n==2&&u!=d){let m=this.getCreepageBetweenNetRuleByNet(c,h,u,d,p);m!=null&&l.push(m)}return l}case"CustomPlaneRule":{let m=c==13?this.getRuleByID(e.id,c):void 0,g=h==13?this.getRuleByID(r.id,h):void 0;if(n==0&&c==13&&h==13){if(m!=null&&g!=null)l.push(m),l.push(g);else if(m!=null&&g==null){l.push(m);let y=this.getRuleByNet(d,n,h);y!=null&&l.push(y)}else if(m==null&&g!=null){let y=this.getRuleByNet(u,n,c);y!=null&&l.push(y),l.push(g)}}else m!=null&&l.push(m),g!=null&&l.push(g);return l}case"NetRule":{let m=function(g,y,b){let P=y.getRuleByNet(g,n,b);P!=null&&l.push(P)};return n==0?u!=null&&d!=null?(m(u,this,Wx(c,h)),m(d,this,Wx(c,h,!0))):u!=null&&d==null?m(u,this,c):u==null&&d!=null?m(d,this,h):l.push(this.getDefaultRule(n)):(u!=null&&m(u,this,c),d!=null&&m(d,this,h)),l}default:return l.push(this.getDefaultRule(n)),l}}addPadsPairGroup(e,r=[]){let i=new WI(e,r);return this.padsPairGroups.set(e,i),i}getAllCopperPlanesRules(){return this.copperPlanes}getPadsPairGroupItemByGroupName(e){return this.padsPairGroups.get(e)}getAllPadsPairGroups(){return this.getAllSelector(this.padsPairGroups)}getAllPadsPairGroupsInstances(){let e=new Array;for(let[,r]of this.padsPairGroups)e.push(r);return e}getRuleTemplateName(){return this.ruleTemplateName}setRuleTemplateName(e){this.ruleTemplateName=e}setSpecialColor(e,r){if(e!=null){let i=this.getNet(e);i&&(r==null||r.equals(ee.BLACK)?i.color=null:i.color=r)}}recycleAll(){this.safeSpacings.clear(),this.otherSpacings.clear(),this.trackPhysics.clear(),this.netLengthPhysics.clear(),this.differentialPhysics.clear(),this.blindViaPhysics.clear(),this.radiusPhysics.clear(),this.innerPlanes.clear(),this.copperPlanes.clear(),this.solderExpansions.clear(),this.pasteExpansions.clear(),this.creepageSpacings.clear()}deleteAll(){this.safeSpacings.clear(),this.otherSpacings.clear(),this.trackPhysics.clear(),this.creepageSpacings.clear(),this.netLengthPhysics.clear(),this.differentialPhysics.clear(),this.blindViaPhysics.clear(),this.radiusPhysics.clear(),this.innerPlanes.clear(),this.copperPlanes.clear(),this.solderExpansions.clear(),this.pasteExpansions.clear(),this.defaultRuleMap.clear()}recycle(){this.deleteAll(),this.deleteAllRuleSelector()}deleteAllRuleSelector(){this.nets.clear(),this.netClass.clear(),this.netDifferentials.clear(),this.regionSelectors.clear(),this.autoRouters.clear(),this.equalLengthGroups.clear(),this.padsPairGroups.clear(),this.betweenNetRule.rule.length=0}getRuleSelect(e){return e instanceof Eu?["NET_CLASS",e.name]:e instanceof Vd?["EQ_LEN_GRP",e.name]:e instanceof bp?["NET",e.name]:[]}};Ro.manager=null;var te=Ro;function By(o,t){let e=n=>n===12||n===11,r=e(o),i=e(t);return r&&i?12:(r||i)&&r?t:o}var XB=class{constructor(t,e,r){this.expansionType=t,this.topExpansion=e,this.bottomExpansion=r}cloneToCustom(){return I0.getViaExpansion(2,this.topExpansion,this.bottomExpansion)}clone(){return this.expansionType==1?this:this.cloneToCustom()}};var mCe=class{constructor(){this.viaExpansionPool=new Map}getExpansionByexpansionType(t,e){return this.getViaExpansion(t,e.topExpansion,e.bottomExpansion)}getExpansionByTopExpansion(t,e){return this.getViaExpansion(e.expansionType,t,e.bottomExpansion)}getExpansionByBottomExpansion(t,e){return this.getViaExpansion(e.expansionType,e.topExpansion,t)}getViaExpansion(t,e,r){let i=this.generateExpansionId({expansionType:t,topExpansion:e,bottomExpansion:r}),n=this.viaExpansionPool.get(i);if(n!=null)return n;{let s=new XB(t,e,r);return this.viaExpansionPool.set(i,s),s}}generateExpansionId(t){let{expansionType:e,topExpansion:r,bottomExpansion:i}=t;return`${e}_${r}_${i}`}},I0=new mCe;var qB=class{constructor(t,e,r,i){this.expansionType=t,this.pasteExpansion=e,this.topSolderExpansion=r,this.bottomSolderExpansion=i}cloneToCustom(){return ju.getPadExpansion(2,this.pasteExpansion,this.topSolderExpansion,this.bottomSolderExpansion)}clone(){return this.expansionType==1?this:this.cloneToCustom()}};var gCe=class{constructor(){this.padExpansionPool=new Map}getExpansionByexpansionType(t,e){return this.getPadExpansion(t,e.pasteExpansion,e.topSolderExpansion,e.bottomSolderExpansion)}getExpansionByPasteExpansion(t,e){return this.getPadExpansion(e.expansionType,t,e.topSolderExpansion,e.bottomSolderExpansion)}getExpansionByTopSolderExpansion(t,e){return this.getPadExpansion(e.expansionType,e.pasteExpansion,t,e.bottomSolderExpansion)}getExpansionByBottomSolderExpansion(t,e){return this.getPadExpansion(e.expansionType,e.pasteExpansion,e.topSolderExpansion,t)}getPadExpansion(t,e,r,i){let n=this.generateExpansionId({expansionType:t,pasteExpansion:e,topSolderExpansion:r,bottomSolderExpansion:i}),s=this.padExpansionPool.get(n);return s!=null||(s=new qB(t,e,r,i),this.padExpansionPool.set(n,s)),s}generateExpansionId(t){let{expansionType:e,pasteExpansion:r,topSolderExpansion:i,bottomSolderExpansion:n}=t;return`${e}_${r}_${i}_${n}`}},ju=new gCe;function bCe(o,t){let e;return o.layerId==2?o.isTestPad?e=t.testPointBottomExpansion:e=t.padBottomExpansion:o.isTestPad?e=t.testPointTopExpansion:e=t.padTopExpansion,e}var GY="",FE,yCe;function C0(o){if(o.modelType=="Pad"){if(o.expansionType==1){if(GY=o.net,FE=te.getInstance().getSolderExpansionByNet(GY),yCe=te.getInstance().getPasteExpansionByNet(GY),yCe){let t=bCe(o,yCe);o.pasteExpansion!=t&&(o.pasteExpansion=t)}if(FE){let t=o.isTestPad?FE.testPointTopExpansion:FE.padTopExpansion,e=o.isTestPad?FE.testPointBottomExpansion:FE.padBottomExpansion,r=ju.getPadExpansion(o.expansionType,o.pasteExpansion,t,e);o.padExpansion!=r&&(o.padExpansion=r)}}}else if(o.expansionType===1&&(GY=o.net,FE=te.getInstance().getSolderExpansionByNet(GY),FE)){let t=I0.getViaExpansion(o.expansionType,FE.viaTopExpansion,FE.viaBottomExpansion);o.viaExpansion!=t&&(o.viaExpansion=t)}}var Je=class extends ki{constructor(){super(...arguments);this.modelType="Pad";this._attrsMap={}}get attrsMap(){return this._attrsMap}addATTRMap(e,r){this._attrsMap[e]=r}modifyATTRMap(e,r){this._attrsMap[e]=r}deleteATTRMap(e){delete this._attrsMap[e]}clearMap(){this._attrsMap={}}get numModified(){return this.hasDataState(10)}set numModified(e){this.setDataState(10,e)}get globalIndex(){return this._globalIndex}set globalIndex(e){this._globalIndex=e}get isTestPad(){return this.padType==1}set isTestPad(e){e?this.padType=1:this.padType=0}get topModified(){return this.hasDataState(12)}set topModified(e){this.setDataState(12,e)}get bottomModified(){return this.hasDataState(13)}set bottomModified(e){this.setDataState(13,e)}get innerModified(){return this.hasDataState(14)}set innerModified(e){this.setDataState(14,e)}get holeModified(){return this.hasDataState(15)}set holeModified(e){this.setDataState(15,e)}get holeShape(){var e;return(e=this.hole)==null?void 0:e.holeShape}set holeShape(e){this.hole&&e!=null&&(this.hole=vc.getHoleStyleByShape(e,this.hole),this.updateShapeData())}get holeLength(){var e;return(e=this.hole)==null?void 0:e.holeLength}set holeLength(e){if(this.hole&&e!=null){e=bo(e);let r=this.hole.holeRadius*2;e<r&&(e=r),this.hole=vc.getHoleStyleByLength(e,this.hole),this.updateShapeData()}}get holeOffset(){var e;return((e=this.hole)==null?void 0:e.holeOffset)||S.ORIGIN}set holeOffset(e){this.hole&&(this.hole=vc.getHoleStyleByOffset(e,this.hole),this.updateShapeData())}get holeRotation(){if(this.hole)return this.hole.holeRotation%Vr}set holeRotation(e){this.hole&&e!=null&&(this.hole=vc.getHoleStyleByRotation(e,this.hole),this.updateShapeData())}get holeRadius(){if(this.hole)return this.hole.holeRadius}set holeRadius(e){if(this.hole&&e!=null){let r=bo(e*2);r>this.hole.holeLength&&(this.holeLength=r),e=r/2,this.hole=vc.getHoleStyleByRadius(e,this.hole),this.updateShapeData()}}get expansionType(){return this.padExpansion.expansionType}set expansionType(e){this.padExpansion.expansionType!=e&&(this.padExpansion=ju.getExpansionByexpansionType(e,this.padExpansion))}get pasteExpansion(){return this.padExpansion.pasteExpansion}set pasteExpansion(e){this.padExpansion.pasteExpansion!=e&&(this.padExpansion=ju.getExpansionByPasteExpansion(e,this.padExpansion),this.updateShapeData(),this.pasteExpansionModified=!0)}get pasteExpansionModified(){return this.hasDataState(7)}set pasteExpansionModified(e){this.setDataState(7,e)}get topSolderExpansion(){return this.padExpansion.topSolderExpansion}set topSolderExpansion(e){this.padExpansion.topSolderExpansion!=e&&(this.padExpansion=ju.getExpansionByTopSolderExpansion(e,this.padExpansion),this.updateShapeData(),this.topSolderExpansionModified=!0)}get topSolderExpansionModified(){return this.hasDataState(8)}set topSolderExpansionModified(e){this.setDataState(8,e)}get bottomSolderExpansion(){return this.padExpansion.bottomSolderExpansion}set bottomSolderExpansion(e){this.padExpansion.bottomSolderExpansion!=e&&(this.padExpansion=ju.getExpansionByBottomSolderExpansion(e,this.padExpansion),this.updateShapeData(),this.bottomSolderExpansionModified=!0)}get bottomSolderExpansionModified(){return this.hasDataState(9)}set bottomSolderExpansionModified(e){this.setDataState(9,e)}get padStyle(){return this.layerId==1?this.top:this.layerId==2?this.bottom:this.inner}updateShapeData(e){this._parent!=null&&this._parent.update4Childs(),this.refreshBBox=!0,e==null?this.shapeModified=this.shapeModified||!1:this.shapeModified=this.shapeModified||e,this.watchBBoxModify()}};var US=class o extends Je{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T=null,I=0,C,E,O){super(),this._globalIndex=t,this._layerId=e,this._type=r,this._center=n,this._rotation=s,this._plated=m,this._padExpansion=ju.getPadExpansion(c,h,u,d),this._unusedInnerLayers=p,this._locked=a,this._padType=I,this._bbox=C||VE(e,n,s,g,y,b,P,0,0,0),this._padLen=E,this._attrsMap=O||{},this.update(i,l,g,y,b,P,T,!0),jo("data/model/PadModel")}get padLen(){return this._padLen||0}set padLen(t){this._padLen=t}get net(){var t;return(t=this._net)==null?void 0:t.toUpperCase()}get showNet(){return this._net}set net(t){this._net!=t&&(this._parent!=null&&this._parent instanceof ki&&this._parent.modelType=="Component"&&this._parent.setNet(this._num,this.globalIndex,t),this._net=t.toString(),this.netModified=!0)}get num(){return this._num}set num(t){this._num!=t&&(this._num=t,this.numModified=!0)}get globalIndex(){return this._globalIndex}set globalIndex(t){this._globalIndex=t}get padType(){return this._padType}set padType(t){this._padType!=t&&(this._padType=t)}get isTestPad(){return this.padType==1}set isTestPad(t){t?this._padType=1:this._padType=0}get padRule(){return this._padRule}set padRule(t){this._padRule!=t&&(this._padRule=t)}get padExpansion(){return this._padExpansion}set padExpansion(t){this._padExpansion!=t&&(this.checkExpansionModify(t),this._padExpansion=t)}get pads(){return[this.top,this.bottom,this.inner].filter(t=>t!=null)}get polygonPl(){return this.top!=null?this.top.pl:this.bottom!=null?this.bottom.pl:this.inner!=null?this.inner.pl:null}get top(){return this._top}set top(t){this._top!=t&&(this._top=t,this.updateShapeData(),this.topModified=!0)}get bottom(){return this._bottom}set bottom(t){this._bottom!=t&&(this._bottom=t,this.updateShapeData(),this.bottomModified=!0)}get inner(){return this._inner}set inner(t){this._inner!=t&&(this._inner=t,this.updateShapeData(),this.innerModified=!0)}get hole(){return this._hole}set hole(t){this._hole!=t&&(this._hole=t,this.updateShapeData(),this.holeModified=!0)}get plated(){return this._plated}set plated(t){this._plated!=t&&(this._plated=t)}get unusedInnerLayers(){return this._unusedInnerLayers}set unusedInnerLayers(t){this._unusedInnerLayers.toString()!=t.toString()&&(this._unusedInnerLayers=t,this.updateShapeData(!0))}get layerId(){return this._layerId}set layerId(t){let e=this.layerId;if(e!=t){switch(this.watchLayerIdModify(e),this._layerId=t,e){case 1:{if(this._top==null)throw new Error("Pad style Error!!!");if(t==2)this._bottom=this._top,this.bottomModified=!0,C0(this),this.expansionType===2&&(this.bottomSolderExpansion=this.topSolderExpansion),this._top=null,this.topModified=!0;else{this._bottom=this._top.clone(),this._inner=this._top.clone();let r=Math.min(this._top.height,this._top.width)*.3;this._hole=vc.getHoleStyle(r,r,"ROUND",0,S.ORIGIN),this.bottomModified=!0,this.innerModified=!0,this.holeModified=!0}break}case 2:{if(this._bottom==null)throw new Error("Pad style Error!!!");if(t==1)this._top=this._bottom,this.topModified=!0,C0(this),this.expansionType===2&&(this.topSolderExpansion=this.bottomSolderExpansion),this._bottom=null,this.bottomModified=!0;else{this._top=this._bottom.clone(),this.topModified=!0,this._inner=this._bottom.clone();let r=Math.min(this._bottom.height,this._bottom.width)*.3;this._hole=vc.getHoleStyle(r,r,"ROUND",0,S.ORIGIN),this.innerModified=!0,this.holeModified=!0}break}default:t==1?(this._bottom=null,this._inner=null,this._hole=null,this.bottomModified=!0,this.innerModified=!0,this.holeModified=!0):t==2?(this._top=null,this._inner=null,this._hole=null,this.topModified=!0,this.innerModified=!0,this.holeModified=!0):(this._top=null,this._bottom=null,this._hole=null,this.topModified=!0,this.bottomModified=!0,this.holeModified=!0),this.type=1}this.updateShapeData(),this.layerModified=!0}}get type(){return this._type}set type(t){if(this.type!=t&&this.layerId==12){let r=this._top||this._bottom||this._inner;r&&(this._top&&(this._top=r.clone(),this.topModified=!0,this.updateShapeData()),this._bottom&&(this._bottom=r.clone(),this.bottomModified=!0,this.updateShapeData()),this._inner&&(this._inner=r.clone(),this.innerModified=!0,this.updateShapeData()))}this._type!=t&&(this._type=t,this.updateShapeData())}get center(){return this._center}set center(t){this._center!=t&&(this._center=t,this.updateShapeData(!0))}get rotation(){return this._rotation}set rotation(t){this._rotation!=t&&(this._rotation=Math.abs(t)<1e-8?0:t,this.updateShapeData(!0))}get expansionType(){return this._padExpansion.expansionType}set expansionType(t){this._padExpansion.expansionType!=t&&(this._padExpansion=ju.getExpansionByexpansionType(t,this._padExpansion))}get pasteExpansion(){return this._padExpansion.pasteExpansion}set pasteExpansion(t){this._padExpansion.pasteExpansion!=t&&(this._padExpansion=ju.getExpansionByPasteExpansion(t,this._padExpansion),this.updateShapeData(),this.pasteExpansionModified=!0)}get topSolderExpansion(){return this._padExpansion.topSolderExpansion}set topSolderExpansion(t){this._padExpansion.topSolderExpansion!=t&&(this._padExpansion=ju.getExpansionByTopSolderExpansion(t,this._padExpansion),this.updateShapeData(),this.topSolderExpansionModified=!0)}get bottomSolderExpansion(){return this._padExpansion.bottomSolderExpansion}set bottomSolderExpansion(t){this._padExpansion.bottomSolderExpansion!=t&&(this._padExpansion=ju.getExpansionByBottomSolderExpansion(t,this._padExpansion),this.updateShapeData(),this.bottomSolderExpansionModified=!0)}get bbox(){return this._bbox}get locked(){return this._locked}set locked(t){this._locked=t}get padStyle(){return this.layerId==1?this.top:this.layerId==2?this.bottom:this.inner}transformPl(t){let e=t.toMatrix3();if(this._top!=null&&this._top.type==="POLYGON"&&this._top.pl!=null){let r=this._top.pl.multiply3(e);r.area()>0&&(r=r.reverse()),this._top=$o.getPadStyleByPl(r,this._top),this.topModified=!0}if(this._bottom!=null&&this._bottom.type==="POLYGON"&&this._bottom.pl!=null){let r=this._bottom.pl.multiply3(e);r.area()>0&&(r=r.reverse()),this._bottom=$o.getPadStyleByPl(r,this._bottom),this.bottomModified=!0}if(this._inner!=null&&this._inner.type==="POLYGON"&&this._inner.pl!=null){let r=this._inner.pl.multiply3(e);r.area()>0&&(r=r.reverse()),this._inner=$o.getPadStyleByPl(r,this._inner),this.innerModified=!0}}update(t,e,r,i,n,s,a=null,l=!1){let c=this._layerId;c===1?(an.notnull(r),an.mustnull(n),an.mustnull(i),an.mustnull(s)):c===2?(an.mustnull(r),an.mustnull(n),an.notnull(i),an.mustnull(s)):c===12?(an.notnull(r),an.notnull(n),an.notnull(i),an.notnull(s)):(an.mustnull(r),an.notnull(n),an.mustnull(i),an.mustnull(s)),this.num=t,this.net=e||"",this.top=r,this.bottom=i,this.inner=n,this.hole=s,this.padRule=a,!(l&&this._bbox)&&this.updateBox()}getExpansionRatio(t,e,r,i){let n=Math.min(e,r)/2,s=n*t+i;return s>0?Math.max(s/(n+i),0):0}isPolygon(){return this.top!=null?this.top.type=="POLYGON":this.bottom!=null?this.bottom.type=="POLYGON":!1}oppositeLayer(){if(this.layerId==12){let t=this._top;this._top=this._bottom,this._bottom=t,this.topModified=!0,this.bottomModified=!0,this.padExpansion=ju.getPadExpansion(this.padExpansion.expansionType,this.padExpansion.pasteExpansion,this.padExpansion.bottomSolderExpansion,this.padExpansion.topSolderExpansion)}}getOneInnerInUse(){for(let t=15;t<=46;t++)if(!this.isUnuseLayer(t))return t;return null}isUnuseLayer(t){if(t>46)return!1;let e=1<<t-15;return(NE.compress(this._unusedInnerLayers)&e)!==0}flip(t){let e=this.center,r=this.rotation,i=e.multiply4(t),n=(Math.PI-r)%Vr;if(this.center=i,this.rotation=n,this.transformPl(t),this.hole){let s=Ae.rotateZ(this.hole.holeRotation).translate1(this.hole.holeOffset.x,this.hole.holeOffset.y,0).rotateZ(r).translate1(e.x,e.y,0),l=S.ORIGIN.multiply4(s).multiply4(t).multiply4(Ae.translate(-i.x,-i.y,0).rotateZ(-n)),c=(Math.PI-this.hole.holeRotation)%Vr;this.hole=vc.getHoleStyle(this.holeLength,this.holeRadius,this.holeShape,c,l)}}rotateFor(t,e){let r=Ae.rotateZForPoint(t,e);this.transform(r)}transform(t){this.rotation=S.caculateAngle(this.rotation,t)%Vr,this.center=this.center.multiply4(t),this.transformPl(t)}remove(){var t,e,r,i;(t=this._top)==null||t.remove(),(e=this._bottom)==null||e.remove(),(r=this._inner)==null||r.remove(),(i=this._hole)==null||i.remove(),super.remove()}inShape(t,e,r){switch(this.layerId){case 1:return this._top!=null&&this._top.inShape(t,e,this.center,this.rotation,r);case 2:return this._bottom!=null&&this._bottom.inShape(t,e,this.center,this.rotation,r);default:return this._top!=null&&this._top.inShape(t,e,this.center,this.rotation,r)||this._bottom!=null&&this._bottom.inShape(t,e,this.center,this.rotation,r)||$e.getInstance().hasInner()&&this._inner!=null&&this._inner.inShape(t,e,this.center,this.rotation,r)?!0:this._hole!=null&&this._hole.inShape(t,e,this.center,this.rotation,r)}}updateBox(){return this._bbox=VE(this.layerId,this.center,this.rotation,this.top,this.bottom,this.inner,this.hole,0,0,0),this._bbox}getPad(t){let e=[1,7,5],r=[2,8,6];return e.includes(t)?this.top:r.includes(t)?this.bottom:this.inner}getBBox(t){let{pasteExpansion:e,topSolderExpansion:r,bottomSolderExpansion:i}=this;return t&&(e=0,r=0,i=0),VE(this.layerId,this.center,this.rotation,this.top,this.bottom,this.inner,this.hole,e,r,i)}getFileGraphics(t,e,r){if(this.isEmpty)return null;if(t==12){let i=[];r=r||[1,2,15];for(let n of r){let s=this.getMathGraphics(n,e);s!=null&&i.push(s)}return i}else{let i=this.getMathGraphics(t,e);return i==null?null:[i]}}getMathGraphics(t=this.layerId,e=0){if(this.isEmpty||this.isUnuseLayer(t))return null;if(t==1){if(this._top!=null)return this._top.getShape(e,this.center,this.rotation)}else if(t==2){if(this._bottom!=null)return this._bottom.getShape(e,this.center,this.rotation)}else if(t==12||47===t){if(this._hole!=null)return this._hole.getShape(e,this.center,this.rotation)}else if(6==t){if(this._bottom!=null)return this._bottom.getShape(e+this.bottomSolderExpansion,this.center,this.rotation)}else if(8==t){if(this._bottom!=null)return this._bottom.getShape(e+this.pasteExpansion,this.center,this.rotation)}else if(5==t){if(this._top!=null)return this._top.getShape(e+this.topSolderExpansion,this.center,this.rotation)}else if(7==t){if(this._top!=null)return this._top.getShape(e+this.pasteExpansion,this.center,this.rotation)}else if(this._inner!=null)return this._inner.getShape(e,this.center,this.rotation);return null}cloneLayer(t,e,r,i,n,s){let a=e||null,l=r||null,c=i||null,h=n||null,u=s&&s instanceof _f?s.clone():this._padRule?this._padRule.clone():null;return new o(this.globalIndex,t,this._type,this._num,this._center,this._rotation,this._locked,this.showNet,this._padExpansion.expansionType,this._padExpansion.pasteExpansion,this._padExpansion.topSolderExpansion,this._padExpansion.bottomSolderExpansion,this._unusedInnerLayers,this._plated,a,l,c,h,u,this._padType,this._bbox)}clone(t,e,r,i,n){this.refreshBBox&&this.updateBox();let s=t&&t instanceof VI?t.clone():this._top?this._top.clone():null,a=e&&e instanceof VI?e.clone():this._bottom?this._bottom.clone():null,l=r&&r instanceof VI?r.clone():this._inner?this._inner.clone():null,c=i&&i instanceof xx?i.clone():this._hole?this._hole.clone():null,h=n&&n instanceof _f?n.clone():this._padRule?this._padRule.clone():null,u={...this.attrsMap},d=new o(this.globalIndex,this._layerId,this._type,this._num,this._center,this._rotation,this._locked,this.showNet,this._padExpansion.expansionType,this._padExpansion.pasteExpansion,this._padExpansion.topSolderExpansion,this._padExpansion.bottomSolderExpansion,this._unusedInnerLayers,this._plated,s,a,l,c,h,this._padType,this._bbox,this._padLen,u);return d.number=this.number,d.zIndex=this.zIndex,d}multiply3(t){let e=t.toMatrix3(),r=this.getMathGraphics();return r==null?null:r.multiply3(e)}isSimilarTo(t){let e=this.layerId==t.layerId&&this.plated==t.plated&&this.rotation==t.rotation&&this.pasteExpansion==t.pasteExpansion&&this.topSolderExpansion==t.topSolderExpansion&&this.bottomSolderExpansion==t.bottomSolderExpansion&&this.holeShape==t.holeShape&&this.holeLength==t.holeLength&&this.holeOffset==t.holeOffset&&this.holeRadius==t.holeRadius&&this.holeRotation==t.holeRotation;if(!e)return!1;if(this.layerId==1)return e&&(this.top==t.top||this.top!=null&&t.top!=null&&this.top.isSimilarTo(t.top));if(this.layerId==2)return e&&(this.bottom==t.bottom||this.bottom!=null&&t.bottom!=null&&this.bottom.isSimilarTo(t.bottom));if(this.layerId==12){let r=this.top,i=t.top,n=this.bottom,s=t.bottom;return e=e&&(r==i||r!=null&&i!=null&&r.isSimilarTo(i)),e=e&&(n==s||n!=null&&s!=null&&n.isSimilarTo(s)),e}else return!1}checkExpansionModify(t){this._padExpansion.topSolderExpansion!=t.topSolderExpansion&&(this.topSolderExpansionModified=!0,this.updateShapeData()),this._padExpansion.pasteExpansion!=t.pasteExpansion&&(this.pasteExpansionModified=!0,this.updateShapeData()),this._padExpansion.bottomSolderExpansion!=t.bottomSolderExpansion&&(this.bottomSolderExpansionModified=!0,this.updateShapeData())}};var HS=class o extends Je{constructor(e,r){super();this._parent=void 0;this._flip=!1;this._globalIndex=e,this._model=r,this._layerId=r.layerId,this.position=r.center,this._rotation=r.rotation,this.scaleX=1,this._net=r.net,this._number=r.number,this._bbox=r.bbox}get attrsMap(){if(!this._attrsMap||!Object.keys(this._attrsMap).length)return this._model.attrsMap;{let e={...this._model.attrsMap};for(let r in this._attrsMap){let i=this._attrsMap[r];e[r]=i}return e}}get number(){return this.model.number}set number(e){this._number=e}get model(){return this._model}reset4Model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.center,this._rotation=e.rotation,this._type=void 0,this._plated=void 0,this._padExpansion=void 0,this._unusedInnerLayers=void 0,this._locked=void 0,this._padType=void 0,this._num=void 0,this._padRule=void 0,this._top=void 0,this._bottom=void 0,this._inner=void 0,this._hole=void 0,this._padLen=void 0,this._attrsMap={},this.scaleX=1}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.center,this._rotation=e.rotation}get padLen(){return this._padLen==null?this.model.padLen:this._padLen}set padLen(e){this._padLen=e}get net(){var e;return((e=this._net)==null?void 0:e.toUpperCase())||""}get showNet(){return this._net}set net(e){this._net!=e&&(this._parent!=null&&this._parent instanceof ki&&this._parent.modelType=="Component"&&this._parent.setNet(this._num,this.globalIndex,e),this._net=e.toString(),this.netModified=!0)}get num(){return this._num==null?this.model.num:this._num}set num(e){this._num!=e&&(this._num=e,this.numModified=!0)}get globalIndex(){return this._globalIndex}set globalIndex(e){this._globalIndex=e}get padType(){return this._padType===void 0?this.model.padType:this._padType}set padType(e){this._padType!=e&&(this._padType=e)}get isTestPad(){return this.padType==1}set isTestPad(e){e?this._padType=1:this._padType=0}get padRule(){return this._padRule===void 0?this.model.padRule:this._padRule}set padRule(e){this._padRule!==e&&(this._padRule=e)}get padExpansion(){return this._padExpansion===void 0?this.model.padExpansion:this._padExpansion}set padExpansion(e){this.padExpansion!=e&&(this.checkExpansionModify(e),this._padExpansion=e)}get pads(){return[this.top,this.bottom,this.inner].filter(e=>e!=null)}get polygonPl(){let e;return this.top!=null?(e=this.getTemplatePl(this.top.pl,this.getPolygonMatrix()),e.area()>0&&(e=e.reverse()),e):this.bottom!=null?(e=this.getTemplatePl(this.bottom.pl,this.getPolygonMatrix()),e.area()>0&&(e=e.reverse()),e):this.inner!=null?(e=this.getTemplatePl(this.inner.pl,this.getPolygonMatrix()),e.area()>0&&(e=e.reverse()),e):null}getTemplatePl(e,r){return e==null?null:e.multiply3(r.toMatrix3())}get top(){return this._top==null?this._layerId==this.model.layerId?this._layerId==12?this._flip?this.model.bottom:this.model.top:this.model.top:this.model.bottom:this._top}set top(e){this._top!=e&&(this._top=e,this.updateShapeData(),this.topModified=!0)}get bottom(){return this._bottom==null?this._layerId==this.model.layerId?this._layerId==12?this._flip?this.model.top:this.model.bottom:this.model.bottom:this.model.top:this._bottom}set bottom(e){this._bottom!=e&&(this._bottom=e,this.updateShapeData(),this.bottomModified=!0)}get inner(){return this._inner||this.model.inner}set inner(e){this._inner!=e&&(this._inner=e,this.updateShapeData(),this.innerModified=!0)}get hole(){return this._hole||this.model.hole}set hole(e){this._hole!=e&&(this._hole=e,this.updateShapeData(),this.holeModified=!0)}get holeShape(){var e;return((e=this.hole)==null?void 0:e.holeShape)||this.model.holeShape}set holeShape(e){this.hole&&e!=null&&(this.hole=vc.getHoleStyleByShape(e,this.hole),this.updateShapeData())}get holeLength(){var e;return((e=this.hole)==null?void 0:e.holeLength)||this.model.holeLength}set holeLength(e){if(this.hole&&e!=null){e=bo(e);let r=this.hole.holeRadius*2;e<r&&(e=r),this.hole=vc.getHoleStyleByLength(e,this.hole),this.updateShapeData()}}get holeOffset(){var e;return((e=this.hole)==null?void 0:e.holeOffset)||this.model.holeOffset}set holeOffset(e){this.hole&&(this.hole=vc.getHoleStyleByOffset(e,this.hole),this.updateShapeData())}get holeRotation(){return this.hole?this.hole.holeRotation%yp:this.model.holeRotation}set holeRotation(e){this.hole&&e!=null&&(this.hole=vc.getHoleStyleByRotation(e,this.hole),this.updateShapeData())}get holeRadius(){return this.hole?this.hole.holeRadius:this.model.holeRadius}set holeRadius(e){if(this.hole&&e!=null){let r=bo(e*2);r>this.hole.holeLength&&(this.holeLength=r),e=r/2,this.hole=vc.getHoleStyleByRadius(e,this.hole),this.updateShapeData()}}get plated(){return this._plated==null?this.model.plated:this._plated}set plated(e){this._plated!=e&&(this._plated=e)}get unusedInnerLayers(){return this._unusedInnerLayers||this.model.unusedInnerLayers}set unusedInnerLayers(e){this.unusedInnerLayers.toString()!=e.toString()&&(this._unusedInnerLayers=e,this.updateShapeData(!0))}get layerId(){return this._layerId}set layerId(e){let r=this.layerId;if(r!=e){switch(this.watchLayerIdModify(r),this._layerId=e,r){case 1:{if(e==2)this._top!=null&&(this._bottom=this._top,this._top=null),this.bottomModified=!0,C0(this),this.expansionType===2&&(this._padExpansion!=null?this.bottomSolderExpansion=this.topSolderExpansion:this.bottomSolderExpansionModified=!0),this.topModified=!0;else{if(this._top==null&&(r==this.model.layerId?this._top=this.model.top:this.model.layerId===12?this._top=this._flip?this.model.bottom:this.model.top:this._top=this.model.bottom),this._top==null)throw new Error("Pad style Error!!!");this._bottom=this._top.clone(),this._inner=this._top.clone();let i=Math.min(this._top.height,this._top.width)*.3;this._hole=vc.getHoleStyle(i,i,"ROUND",0,S.ORIGIN),this.bottomModified=!0,this.innerModified=!0,this.holeModified=!0}break}case 2:{if(e==1)this._bottom!=null&&(this._top=this._bottom,this._bottom=null),this.topModified=!0,C0(this),this.expansionType===2&&(this._padExpansion!=null?this.topSolderExpansion=this.bottomSolderExpansion:this.topSolderExpansionModified=!0),this.bottomModified=!0;else{if(this._bottom==null&&(r==this.model.layerId?this._bottom=this.model.bottom:this.model.layerId===12?this._bottom=this._flip?this.model.top:this.model.bottom:this._bottom=this.model.top),this._bottom==null)throw new Error("Pad style Error!!!");this._top=this._bottom.clone(),this.topModified=!0,this._inner=this._bottom.clone();let i=Math.min(this._bottom.height,this._bottom.width)*.3;this._hole=vc.getHoleStyle(i,i,"ROUND",0,S.ORIGIN),this.innerModified=!0,this.holeModified=!0}break}default:e==1?(this._top==null&&(this._top=this.model.top),this._bottom=null,this._inner=null,this._hole=null,this.bottomModified=!0,this.innerModified=!0,this.holeModified=!0):e==2?(this._bottom==null&&(this._bottom=this.model.bottom),this._top=null,this._inner=null,this._hole=null,this.topModified=!0,this.innerModified=!0,this.holeModified=!0):(this._inner==null&&(this._inner=this.model.inner),this._top=null,this._bottom=null,this._hole=null,this.topModified=!0,this.bottomModified=!0,this.holeModified=!0),this.type=1}this.updateShapeData(),this.layerModified=!0}}get type(){return this._type||this.model.type}set type(e){if(this.type!=e&&this.layerId==12){let i=this.top||this.bottom||this.inner;i&&(this._top&&(this._top=i.clone(),this.topModified=!0,this.updateShapeData()),this._bottom&&(this._bottom=i.clone(),this.bottomModified=!0,this.updateShapeData()),this._inner&&(this._inner=i.clone(),this.innerModified=!0,this.updateShapeData()))}this._type!=e&&(this._type=e,this.updateShapeData())}get center(){return this.position}set center(e){this.position!=e&&(this.position=e,this.updateShapeData(!0))}get rotation(){return this._rotation}set rotation(e){this._rotation!=e&&(this._rotation=Math.abs(e)<1e-8?0:e,this.updateShapeData(!0))}get expansionType(){return this._padExpansion?this._padExpansion.expansionType:this.model.expansionType}set expansionType(e){this.expansionType!=e&&(this._padExpansion=ju.getExpansionByexpansionType(e,this.padExpansion))}get pasteExpansion(){return this._padExpansion?this._padExpansion.pasteExpansion:this.model.pasteExpansion}set pasteExpansion(e){this.pasteExpansion!=e&&(this._padExpansion=ju.getExpansionByPasteExpansion(e,this.padExpansion),this.updateShapeData(),this.pasteExpansionModified=!0)}get topSolderExpansion(){return this._padExpansion?this._padExpansion.topSolderExpansion:this._layerId==this.model.layerId?this._layerId==12?this._flip?this.model.bottomSolderExpansion:this.model.topSolderExpansion:this.model.topSolderExpansion:this.model.bottomSolderExpansion}set topSolderExpansion(e){this.topSolderExpansion!=e&&(this._padExpansion=ju.getExpansionByTopSolderExpansion(e,this.padExpansion),this.updateShapeData(),this.topSolderExpansionModified=!0)}get bottomSolderExpansion(){return this._padExpansion?this._padExpansion.bottomSolderExpansion:this._layerId==this.model.layerId?this._layerId==12?this._flip?this.model.topSolderExpansion:this.model.bottomSolderExpansion:this.model.bottomSolderExpansion:this.model.topSolderExpansion}set bottomSolderExpansion(e){this.bottomSolderExpansion!=e&&(this._padExpansion=ju.getExpansionByBottomSolderExpansion(e,this.padExpansion),this.updateShapeData(),this.bottomSolderExpansionModified=!0)}get bbox(){return this._bbox}get locked(){return this._locked||this.model.locked}set locked(e){this._locked=e}get padStyle(){return this.layerId==1?this.top:this.layerId==2?this.bottom:this.inner}getPolygonMatrix(){return Ae.getMatrix4(this.model.center.mul(-1),-this.model.rotation,1,S.ORIGIN).multiply4(this.getMatrix())}getMatrix(){return Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position)}transformPl(e){let r=e.data[0]*e.data[5]-e.data[1]*e.data[4]>0?1:-1;this.scaleX!=r&&(this._rotation=(Math.PI-this._rotation)%yp),this.rotation=S.caculateAngle(this.rotation,e)%yp,this.center=this.center.multiply4(e),this.scaleX=r,this.updateShapeData()}update(e,r,i,n,s,a,l=null,c=!1){!(c&&this._bbox)&&this.updateBox()}getExpansionRatio(e,r,i,n){let s=Math.min(r,i)/2,a=s*e+n;return a>0?Math.max(a/(s+n),0):0}isPolygon(){return this.model.isPolygon()}oppositeLayer(){this.layerId==12&&(this._flip=!this._flip)}getOneInnerInUse(){for(let e=15;e<=46;e++)if(!this.isUnuseLayer(e))return e;return null}isUnuseLayer(e){if(e>46)return!1;let r=1<<e-15;return(NE.compress(this.unusedInnerLayers)&r)!==0}flip(e){let r=new S(this.scaleX*Math.cos(this.rotation),Math.sin(this.rotation)),i=e.data[0]*e.data[5]-e.data[1]*e.data[4]>0?1:-1;this.scaleX*=i;let n=r.x*e.data[0]+r.y*e.data[4],s=r.x*e.data[1]+r.y*e.data[5],a=new S(n*this.scaleX,s),l=this.center,c=this.rotation,h=l.multiply4(e),u=a.angle(S.ORIGIN);if(this.center=h,this.rotation=u,this.hole){let d=Ae.rotateZ(this.hole.holeRotation).translate1(this.hole.holeOffset.x,this.hole.holeOffset.y,0).rotateZ(c).translate1(l.x,l.y,0),m=S.ORIGIN.multiply4(d).multiply4(e).multiply4(Ae.translate(-h.x,-h.y,0).rotateZ(-u)),g=(Math.PI-this.hole.holeRotation)%yp;this.hole=vc.getHoleStyle(this.holeLength,this.holeRadius,this.holeShape,g,m)}this.updateShapeData()}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}transform(e){(e.data[0]*e.data[5]-e.data[1]*e.data[4]>0?1:-1)!=1&&(this._rotation=(Math.PI-this._rotation)%yp),this.rotation=this.isPolygon()?(this._rotation+this.scaleX*S.caculateAngle(0,e))%yp:S.caculateAngle(this.rotation,e)%yp,this.center=this.center.multiply4(e),this.updateShapeData(!0)}inShape(e,r,i){if(this.isPolygon()){let n=this.polygonPl;return n!=null?Jr.inPolygon(new S(e,r),[n]):!1}switch(this.layerId){case 1:return this.top!=null&&this.top.inShape(e,r,this.center,this.rotation,i);case 2:return this.bottom!=null&&this.bottom.inShape(e,r,this.center,this.rotation,i);default:return this.top!=null&&this.top.inShape(e,r,this.center,this.rotation,i)||this.bottom!=null&&this.bottom.inShape(e,r,this.center,this.rotation,i)||$e.getInstance().hasInner()&&this.inner!=null&&this.inner.inShape(e,r,this.center,this.rotation,i)?!0:this.hole!=null&&this.hole.inShape(e,r,this.center,this.rotation,i)}}updateBox(){if(this.isPolygon()){let e=this.polygonPl;if(e==null)throw new Error("polygon pad style error !!!!");this._bbox=M8e(this.layerId,this.center,this.rotation,this.hole,0,0,0,e.bbox())}else this._bbox=VE(this.layerId,this.center,this.rotation,this.top,this.bottom,this.inner,this.hole,0,0,0);return this._bbox}getPad(e){let r=[1,7,5],i=[2,8,6];return r.includes(e)?this.top:i.includes(e)?this.bottom:this.inner}getBBox(e){let{pasteExpansion:r,topSolderExpansion:i,bottomSolderExpansion:n}=this;return e&&(r=0,i=0,n=0),VE(this.layerId,this.center,this.rotation,this.top,this.bottom,this.inner,this.hole,r,i,n)}getFileGraphics(e,r,i){if(this.isEmpty)return null;if(e==12){let n=[];i=i||[1,2,15];for(let s of i){let a=this.getMathGraphics(s,r);a!=null&&n.push(a)}return n}else{let n=this.getMathGraphics(e,r);return n!=null?[n]:null}}getMathGraphics(e=this.layerId,r=0){if(this.isEmpty||this.isUnuseLayer(e))return null;if(e==1){if(this.top!=null)return Fg(this,this.top,r)}else if(e==2){if(this.bottom!=null)return Fg(this,this.bottom,r)}else if(e==12||47===e){if(this.hole!=null)return this.hole.getShape(r,this.center,this.rotation)}else if(6==e){if(this.bottom!=null)return Fg(this,this.bottom,r+this.bottomSolderExpansion)}else if(8==e){if(this.bottom!=null)return Fg(this,this.bottom,r+this.pasteExpansion)}else if(5==e){if(this.top!=null)return Fg(this,this.top,r+this.topSolderExpansion)}else if(7==e){if(this.top!=null)return Fg(this,this.top,r+this.pasteExpansion)}else if(this.inner!=null)return Fg(this,this.inner,r);return null}cloneLayer(e,r,i,n,s,a){let l=r||null,c=i||null,h=n||null,u=s||null,d=a&&a instanceof _f?a.clone():this._padRule?this._padRule.clone():null;return new US(this.globalIndex,e,this.type,this.num,this.position,this.rotation,this.locked,this.showNet,this.padExpansion.expansionType,this.padExpansion.pasteExpansion,this.padExpansion.topSolderExpansion,this.padExpansion.bottomSolderExpansion,this.unusedInnerLayers,this.plated,l,c,h,u,d,this.padType,this._bbox)}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this.model);e._layerId=this._layerId,e.position=this.position,e.net=this._net,e.scaleX=this.scaleX,e._rotation=this._rotation,e._flip=this._flip,this._type!=null&&(e._type=this._type),this._plated!=null&&(e._plated=this._plated),this._padExpansion!=null&&(e._padExpansion=this._padExpansion),this._unusedInnerLayers!=null&&(e._unusedInnerLayers=this._unusedInnerLayers),this._locked!=null&&(e._locked=this._locked),this._padType!=null&&(e._padType=this._padType),this._num!=null&&(e._num=this._num),this._padRule!=null&&(e._padRule=this._padRule),this._top!=null&&(e._top=this._top),this._bottom!=null&&(e._bottom=this._bottom),this._inner!=null&&(e._inner=this._inner),this._hole!=null&&(e._hole=this._hole),this._padLen!=null&&(e._padLen=this._padLen);let r={...this.attrsMap};return e._attrsMap=r,e}multiply3(e){let r=e.toMatrix3(),i=this.getMathGraphics();return i==null?null:i.multiply3(r)}isSimilarTo(e){let r=this.layerId==e.layerId&&this.plated==e.plated&&this.rotation==e.rotation&&this.pasteExpansion==e.pasteExpansion&&this.topSolderExpansion==e.topSolderExpansion&&this.bottomSolderExpansion==e.bottomSolderExpansion&&this.holeShape==e.holeShape&&this.holeLength==e.holeLength&&this.holeOffset==e.holeOffset&&this.holeRadius==e.holeRadius&&this.holeRotation==e.holeRotation;if(!r)return!1;if(this.layerId==1)return r&&(this.top==e.top||this.top!=null&&e.top!=null&&this.top.isSimilarTo(e.top));if(this.layerId==2)return r&&(this.bottom==e.bottom||this.bottom!=null&&e.bottom!=null&&this.bottom.isSimilarTo(e.bottom));if(this.layerId==12){let i=this.top,n=e.top,s=this.bottom,a=e.bottom;return r=r&&(i==n||i!=null&&n!=null&&i.isSimilarTo(n)),r=r&&(s==a||s!=null&&a!=null&&s.isSimilarTo(a)),r}else return!1}checkExpansionModify(e){this.padExpansion.topSolderExpansion!=e.topSolderExpansion&&(this.topSolderExpansionModified=!0,this.updateShapeData()),this.padExpansion.pasteExpansion!=e.pasteExpansion&&(this.pasteExpansionModified=!0,this.updateShapeData()),this.padExpansion.bottomSolderExpansion!=e.bottomSolderExpansion&&(this.bottomSolderExpansionModified=!0,this.updateShapeData())}};function j9t(o,t,e,r,i,n,s){let a=new _e;switch(e){case"ELLIPSE":return a.ext2(o).ext7(Math.min(r,i)/2),a.build1();case"OVAL":{let l=Ae.getMatrix4(o.mul(-1),t,1,o);if(r>i){let c=(r-i)/2,h=i/2,u=o.add1(-c,0).multiply4(l),d=o.add1(c,0).multiply4(l);return a.ext2(u).ext2(d).ext7(h),a.build1()}else{let c=(i-r)/2,h=r/2,u=o.add1(0,-c).multiply4(l),d=o.add1(0,c).multiply4(l);return a.ext2(u).ext2(d).ext7(h),a.build1()}}case"RECT":{let l=r/2,c=i/2,h=n*Math.min(l,c),u=Ae.getMatrix4(o.mul(-1),t,1,o),d=new S(o.x-l,o.y+c),p=new S(o.x-l,o.y-c),m=new S(o.x+l,o.y+c),g=new S(o.x+l,o.y-c),y=p.add1(h,h).multiply4(u),b=g.add1(-h,h).multiply4(u),P=m.add1(-h,-h).multiply4(u),T=d.add1(h,-h).multiply4(u),I=new _e;return I.ext2(y).ext2(b).ext2(P).ext2(T).ext7(h),I.build1()}case"POLYGON":{if(s==null)throw new Error("Polygon pad style error!!!");return s.bbox()}default:throw new Error("this pad style is not supported !!!")}}function $B(o,t,e){return j9t(o,t,e.type,e.width,e.height,e.ratio,e.pl)}function M8e(o,t,e,r,i,n,s,a){switch(o){case 1:{let l=Math.max(i,n);return l>0?a.extendOfSize(l):a}case 2:{let l=Math.max(i,s);return l>0?a.extendOfSize(l):a}case 12:{if(r==null)throw new Error("Pad style Error!!!");let l=new _e,c=Math.max(i,n),h=Math.max(i,s);return l.ext1(a.extendOfSize(c>0?c:0)).ext1(a.extendOfSize(h>0?h:0)).ext1(r.getHolebbox(t,e)),l.build1()}default:return a}}function VE(o,t,e,r,i,n,s,a,l,c){switch(o){case 1:{if(r==null)throw new Error("Pad style Error!!!");let h=$B(t,e,r),u=Math.max(a,l);return u>0?h.extendOfSize(u):h}case 2:{if(i==null)throw new Error("Pad style Error!!!");let h=$B(t,e,i),u=Math.max(a,c);return u>0?h.extendOfSize(u):h}case 12:{if(r==null||i==null||n==null||s==null)throw new Error("Pad style Error!!!");let h=new _e,u=$B(t,e,r),d=Math.max(a,l),p=$B(t,e,i),m=Math.max(a,c);return h.ext1(u.extendOfSize(d>0?d:0)).ext1(p.extendOfSize(m>0?m:0)).ext1($B(t,e,n)).ext1(s.getHolebbox(t,e)),h.build1()}default:if(n==null)throw new Error("Pad style Error!!!");return $B(t,e,n)}}function NM(o,t){if(t==0)return o;let e=(r,i)=>i.bbox().area()-r.bbox().area();if(t>=0){let r=gy.getExtendPolyLine(o,t,!1);return xr(r,e),r[0]}else{let r=o.bbox();if(Math.abs(t)>r.width()||Math.abs(t)>r.height())return null;let i=Af(o,t);if(xr(i,e,0,i.length),i.length>0){let n=i[0].items;for(let s of n)return s}return null}}function N8e(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P){let T=null,I=null,C=null,E=null;return t===1?T=$o.getStyle(e,r,i,n,null):t===2?I=$o.getStyle(s,a,l,c,null):(T=$o.getStyle(e,r,i,n,null),I=$o.getStyle(s,a,l,c,null),C=$o.getStyle(h,u,d,p,null),E=vc.getHoleStyle(m,g,y,b,P)),{top:T,bottom:I,inner:C,hole:E}}function k8e(o,t,e,r,i,n,s,a){let l=null,c=null,h=null,u=null,d=a;d.area()>0&&(d=d.reverse());let p=$o.getStyle("POLYGON",-1,-1,-1,d);return t===1?l=p:t===2?c=p:(l=p,c=p.clone(),h=p.clone(),u=vc.getHoleStyle(e,r,i,n,s)),{top:l,bottom:c,inner:h,hole:u}}function Fg(o,t,e){if(o instanceof HS)if(t.type=="POLYGON"){let r=t.getShape(e,o.center,o.rotation);return(r==null?void 0:r.multiply3(o.getPolygonMatrix().toMatrix3()))||null}else return t.getShape(e,o.center,o.rotation);else return t.getShape(e,o.center,o.rotation)}var KB=class extends Cu{constructor(e,r=null,i){super(e,r);this.ids=new Array(0);i!=null&&(this.canPanelize=i)}get layer(){return bn.getInstance().getLayer(this.layerId).layer}get plane(){return this.canPanelize==null?this.layer.plane:this.layer.getCreateNoPanelizePlane()}hidden(){this.isValidId()&&this.plane.hiddenPolygonPt(this.ids)}show(){this.isValidId()&&this.plane.showPolygonPt(this.ids)}visible(e,r,i,n){this.layerId!=e&&this.remove(),!Sa.unRefreshScene&&(this.layerId=e,this.ids=this.layer.addPolygon(r,i,n))}isValidId(){return this.ids.length>=0}resetId(){this.ids=[]}forceVisibleHighLight(e){this.forceVisibleHighLights(this.ids,e)}highlight(e,r,i){this.highlights(this.ids,e,r,i)}remove(){var e;this.isValidId()&&((e=this._removeCb)==null||e.call(this),this.plane.removeHighLightPts(this.ids),this.plane.removePolygonPt(this.ids),this.lastHighLightForce=null),this.resetId()}};var UY=class o extends Xo{constructor(){super();this.path=new Array(0);this.pathIndex=new Array(0);this.padsLayer=new Array(0);jo("view/pcb/PolygonPadView")}get highLightType(){var e;return(e=o._viewDataModel)==null?void 0:e.highLightType}get manualHighLight(){var e;return(e=o._viewDataModel)==null?void 0:e.manualHighLight}get manualHighLightModified(){var e;return(e=o._viewDataModel)==null?void 0:e.manualHighLightModified}get layerModified(){var e;return(e=o._viewDataModel)==null?void 0:e.layerModified}get shapeModified(){var e;return(e=o._viewDataModel)==null?void 0:e.shapeModified}get netModified(){var e;return(e=o._viewDataModel)==null?void 0:e.netModified}get highlightColor(){var e;return(e=o._viewDataModel)==null?void 0:e.highlightColor}get highlightMaskColor(){var e;return(e=o._viewDataModel)==null?void 0:e.highlightMaskColor}get viewGroupIdModified(){var e;return(e=o._viewDataModel)==null?void 0:e.viewGroupIdModified}get forceUpdateMask(){var e;return(e=o._viewDataModel)==null?void 0:e.forceUpdateMask}get layerId(){var e;return(e=o._viewDataModel)==null?void 0:e.layerId}get type(){var e;return(e=o._viewDataModel)==null?void 0:e.type}get center(){var e;return(e=o._viewDataModel)==null?void 0:e.center}get rotation(){var e;return(e=o._viewDataModel)==null?void 0:e.rotation}get pasteExpansion(){var e;return(e=o._viewDataModel)==null?void 0:e.pasteExpansion}get topSolderExpansion(){var e;return(e=o._viewDataModel)==null?void 0:e.topSolderExpansion}get bottomSolderExpansion(){var e;return(e=o._viewDataModel)==null?void 0:e.bottomSolderExpansion}get hole(){var e;return(e=o._viewDataModel)==null?void 0:e.hole}get color(){return o._viewDataModel.partition==x.getInstance().partitionId?Oo.getInstance().padConfig.getColor(o._viewDataModel.globalIndex,o._viewDataModel.net,o._viewDataModel.selectItem,o._viewDataModel.layerId==12):Oo.getInstance().readonlyPadConfig.getColor(o._viewDataModel.globalIndex,o._viewDataModel.net)}get highlightByComponent(){var e;return(e=o._viewDataModel)==null?void 0:e.highlightByComponent}get usedLayers(){var e;return(e=o._viewDataModel)==null?void 0:e.usedLayers}get holeColor(){var e;return(e=o._viewDataModel)==null?void 0:e.holeColor}get wireViewGroupId(){var e;return this.getEngineGroupId((e=o._viewDataModel)==null?void 0:e.wireViewGroupId)}get pasteExpansionModified(){var e;return(e=o._viewDataModel)==null?void 0:e.pasteExpansionModified}get topSolderExpansionModified(){var e;return(e=o._viewDataModel)==null?void 0:e.topSolderExpansionModified}get bottomSolderExpansionModified(){var e;return(e=o._viewDataModel)==null?void 0:e.bottomSolderExpansionModified}get numModified(){var e;return(e=o._viewDataModel)==null?void 0:e.numModified}get topModified(){var e;return((e=o._viewDataModel)==null?void 0:e.topModified)||o._viewDataModel.shapeModified||o._viewDataModel.topSolderExpansionModified||o._viewDataModel.pasteExpansionModified}get bottomModified(){var e;return((e=o._viewDataModel)==null?void 0:e.bottomModified)||o._viewDataModel.shapeModified||o._viewDataModel.bottomSolderExpansionModified||o._viewDataModel.pasteExpansionModified}get innerModified(){var e;return((e=o._viewDataModel)==null?void 0:e.innerModified)||o._viewDataModel.shapeModified}get holeModified(){var e;return(e=o._viewDataModel)==null?void 0:e.holeModified}get shapes(){var e;return(e=o._viewDataModel)==null?void 0:e.shapes}get padShowNet(){return ga.getInstance().padShowNet}get showNum(){return ga.getInstance().padShowNum}get net(){var e;return(e=o._viewDataModel)==null?void 0:e.showNet}get num(){var e;return(e=o._viewDataModel)==null?void 0:e.num}get fillState(){var e;return(e=o._viewDataModel)==null?void 0:e.fillState}get showLayers(){let e=this.usedLayers,r=e.length>0||this.type==2||this.grayIndex!=0;return this.layerId==12&&r?e.filter(i=>![1,2].includes(i)):[this.layerId]}getFontPosition(e,r){return e!=""&&r!=""?1:e!=""&&r==""?2:e==""&&r!=""?2:3}getNetLayerId(){return gr(this.layerId)?47:this.layerId}createNetAndNumberView(){if(this.padShowNet&&this.net?this.netView||(this.netView=new jl(this.layerId)):this.removeNetView(),this.showNum&&this.num?this.numView||(this.numView=new jl(this.layerId)):this.removeNumView(),!this.netView&&!this.numView)return;let e=Qe.translate(-this.center.x,-this.center.y).rotate(-this.rotation),r=this.shapes.multiply3(e),i=new BI(r),n=this.getFontPosition(this.net,this.num),s=new S(Math.cos(this.rotation),Math.sin(this.rotation)),a=new S(-s.y,s.x),l=Math.atan2(s.y,s.x);(l<-es||l>es)&&(a=new S(s.y,-s.x)),l<0&&(s=s.mul(-1));let c=this.center,h=this.center,u=i.high,d=r.bbox().width();n==1&&(d>=u?(c=this.center.sub(a.mul(u*.25)),h=this.center.add(a.mul(u*.25)),u*=.5):(c=this.center.sub(s.mul(d*.25)),h=this.center.add(s.mul(d*.25)),d*=.5));let p=this.rotation;d<u&&(p+=es),p=Qte(p);let m=this.getNetLayerId(),g=this.wireViewGroupId;this.netView&&(d>=u?this.netView.visible(m,this.net,c,p,Wc,zc,d,u,void 0,g):this.netView.visible(m,this.net,c,p,Wc,zc,u,d,void 0,g)),this.numView&&(d>=u?this.numView.visible(m,this.num,h,p,Wc,zc,d,u,void 0,g):this.numView.visible(m,this.num,h,p,Wc,zc,u,d,void 0,g)),this.netView&&this.netView.forceVisibleHighLight(this.manualHighLight),this.numView&&this.numView.forceVisibleHighLight(this.manualHighLight)}updateFill(){let e=this.layerModified||this.shapeModified||this.path.length==0;this.getFillShowState(this.layerId,this.fillState).showFill?e&&this.removeFill("Not Show Fill"):this.removeFill("Not Show Fill")}getPolylineMap(e=!1){let{layerId:r,shapes:i,pasteExpansion:n,topSolderExpansion:s,bottomSolderExpansion:a,fillState:l}=o._viewDataModel,c=this.path.length==0,h=this.layerModified||this.shapeModified||c||e,u=h||this.pasteExpansionModified,d=h||this.topSolderExpansionModified,p=h||this.bottomSolderExpansionModified,m=this.getFillShowState(r,l),g,y,b,P,T=new Map;return m.showTopPaste?(u||!this.topPaste)&&(g=T.get(n)||this.getExpansion(i,n),T.set(n,g),this.removeTopPaste()):(g=null,this.removeTopPaste()),m.showBottomPaste?(u||!this.bottomPaste)&&(y=T.get(n)||this.getExpansion(i,n),T.set(n,y),this.removeBottomPaste()):(y=null,this.removeBottomPaste()),m.showTopSolder?(d||!this.topSolder)&&(b=T.get(s)||this.getExpansion(i,s),T.set(s,b),this.removeTopSolder()):(b=null,this.removeTopSolder()),m.showBottomSolder?(p||!this.bottomSolder)&&(P=T.get(s)||this.getExpansion(i,a),this.removeBottomSolder()):(P=null,this.removeBottomSolder()),{topPasteShapes:g,bottomPasteShapes:y,topSolderShapes:b,bottomSolderShapes:P}}getFillShowState(e,r){let i=!1,n=!1,s=!1,a=!1,l=!1;return r===1?{showFill:i,showTopSolder:n,showTopPaste:s,showBottomSolder:a,showBottomPaste:l}:(i=!0,e==1?(n=!0,s=!0):e==2?(a=!0,l=!0):(n=!0,a=!0),{showFill:i,showTopSolder:n,showTopPaste:s,showBottomSolder:a,showBottomPaste:l})}addPolygon(e,r,i,n){if(r.primitives.length>0){let s=new KB(e);return s.visible(e,r,i,n),s}}getExpansion(e,r){return NM(e,r)}fillEach(e,r=!1){let i=this.showLayers;if(r||this.pathIndex.length!=i.length||this.padsLayer.length!=i.length||i.toString()!=this._lastLayerIds.toString()||this.viewGroupIdModified)this._lastLayerIds=i;else{if(this.manualHighLightModified)for(let a=0;a<Math.max(this.pathIndex.length,i.length);a++)i[a]&&this.pathIndex[a]&&this.pathIndex[a].forceVisibleHighLight(this.manualHighLight);return}let s=this.wireViewGroupId;for(let a=0;a<Math.max(this.pathIndex.length,i.length);a++)this.pathIndex[a]&&this.pathIndex[a].remove(),i[a]&&(this.pathIndex[a]=this.addPolygon(i[a],this.shapes,e,s),this.padsLayer[a]=i[a]);if(this.pathIndex.length=i.length,this.padsLayer.length=i.length,this.manualHighLightModified||this.manualHighLight)for(let a=0;a<Math.max(this.pathIndex.length,i.length);a++)i[a]&&this.pathIndex[a]&&this.pathIndex[a].forceVisibleHighLight(this.manualHighLight)}createMask(e,r,i=ee.BLACK,n=null){if(this.fillState===1){this.removeFill("Not Show Fill");return}e!=null&&e.remove();let{pasteExpansion:s,topSolderExpansion:a,bottomSolderExpansion:l}=this,{topPasteShapes:c,bottomPasteShapes:h,topSolderShapes:u,bottomSolderShapes:d}=r,p=this.shapes;!(c||h)&&this.topPaste&&(c=this.getExpansion(p,s)),!u&&this.topSolder&&(u=this.getExpansion(p,a)),!d&&this.bottomSolder&&(d=this.getExpansion(p,l));let m=0;return(c||h)&&(m=Math.max(m,s)),u&&(m=Math.max(m,a)),d&&(m=Math.max(m,l)),m===0?this.addPolygon(1002,p,i,n):(c||h)&&m===s?this.addPolygon(1002,c||h,i,n):u&&m===a?this.addPolygon(1002,u,i,n):d&&m===l?this.addPolygon(1002,d,i,n):this.addPolygon(1002,p,i,n)}drawPath(e,r,i,n,s){if(e.length==0){for(let a of r.primitives)if(a instanceof M){let l=new Yc(i);l.visible(i,a.start(),a.end(),!0,0,0,n,s),e.push(l)}else if(a instanceof q){let l=new Ly(i);l.visible(i,a.center,a.rx,a.startAngle/180*Math.PI,a.endAngle()/180*Math.PI,a.sweep(),n,s),e.push(l)}}else{let a=0;for(let c of r.primitives){let h=e[a];c instanceof M?(h==null?(h=new Yc(i),e.push(h)):h instanceof Yc||(h.remove(),h=new Yc(i),e.splice(a,1,h)),h.visible(i,c.start(),c.end(),!0,0,0,n,s)):c instanceof q&&(h==null?(h=new Ly(i),e.push(h)):h instanceof Ly||(h.remove(),h=new Ly(i),e.splice(a,1,h)),h.visible(i,c.center,c.rx,c.startAngle/180*Math.PI,c.endAngle()/180*Math.PI,c.sweep(),n,s)),a++}let l=e.splice(a,e.length-a);for(let c of l)c.remove()}}createExtendsPolygon(e=ee.BLACK,r=!1){let i=this.getPolylineMap(r),{topPasteShapes:n,bottomPasteShapes:s,topSolderShapes:a,bottomSolderShapes:l}=i,c=this.wireViewGroupId;return!this.topSolder&&a!=null&&(this.topSolder=this.addPolygon(5,a,e,c)),!this.topPaste&&n!=null&&(this.topPaste=this.addPolygon(7,n,e,c)),!this.bottomSolder&&l!=null&&(this.bottomSolder=this.addPolygon(6,l,e,c)),!this.bottomPaste&&s!=null&&(this.bottomPaste=this.addPolygon(8,s,e,c)),i}removeFill(e){this.maskVisible(!1,!0);for(let r=0;r<this.pathIndex.length;r++)this.pathIndex[r]&&this.pathIndex[r].remove();this.pathIndex.length=0,this.padsLayer.length=0,this.removeTopSolder(),this.removeTopPaste(),this.removeBottomSolder(),this.removeBottomPaste(),this.componentMaskVisible(!1,e)}mainVisible(e,r){r!=null&&(this.grayIndex=r);let i=this.color,n=!i.equals(this._lastColor);n&&(this._lastColor=i),(this.layerModified||n||this.path.length==0||this.shapeModified||this.viewGroupIdModified)&&this.drawPath(this.path,this.shapes,this.layerId,i,null);let a=this.createExtendsPolygon(i,n);this.fillEach(i,n),this.holeVisible(e),this.maskVisible(!1,!0),this.maskShapes=this.createMask(this.maskShapes,a,ee.of6(ee.BLACK,1e-6),this.viewGroupId);let l=this.resetHighLightState;return this.maskShapes.setRemoveCb(l),this.manualHighLightModified&&this.path.forEach(c=>{c.forceVisibleHighLight(this.manualHighLight)}),a}maskVisible(e,r=!1,i){if(!this.maskShapes)return;let n=this.highlightColor||this.color;if(this.isWebglEnv()){e?this.mask=this.createMask(this.mask,i,n):this.mask&&(this.mask.remove(),delete this.mask);return}this.mainMaskHighLightColor(this.maskShapes,r,e?this.highLightType:null,n)}componentMaskVisible(e,r,i){e&&this.highlightByComponent?r!="Main And Highlight"&&(this.maskByComponent=this.createMask(this.maskByComponent,i,this.highlightMaskColor)):this.maskByComponent&&(this.maskByComponent.remove(),delete this.maskByComponent)}holeVisible(e){if(this.hole!=null){let{holeColor:r=ee.BLACK}=this;this.holeView||(this.holeView=new LB(this)),this.holeView.modify(this.hole,e,47,r,this.highlightByComponent)}else this.removeHoleView()}visible(e){this.maskVisible(!1,!1);let r=this.mainVisible("Only Main",e);return this.componentMaskVisible(!0,"Only Main",r),r}highlight(){let e=this.mainVisible("Main And Highlight");return this.maskVisible(!0,this.forceUpdateMask,e),this.componentMaskVisible(!0,"Main And Highlight",e),e}refreshShapeViews(e,r){return e?this.highlight():this.visible(r)}modify(e,r){let{grayIndex:i}=e;switch(o._viewDataModel=e,this.updateFill(),this.grayIndex=i,this.createNetAndNumberView(),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.removeFill("Not Show Fill");for(let e of this.path)e.remove();this.path.length=0,this.removeHoleView(),this.removeNetView(),this.removeNumView(),this.removeMaskShape()}removeHoleView(){this.holeView&&(this.holeView.remove(),delete this.holeView)}removeNetView(){this.netView&&(this.netView.remove(),delete this.netView)}removeNumView(){this.numView&&(this.numView.remove(),delete this.numView)}removeTopSolder(){this.topSolder&&(this.topSolder.remove(),delete this.topSolder)}removeTopPaste(){this.topPaste&&(this.topPaste.remove(),delete this.topPaste)}removeBottomSolder(){this.bottomSolder&&(this.bottomSolder.remove(),delete this.bottomSolder)}removeBottomPaste(){this.bottomPaste&&(this.bottomPaste.remove(),delete this.bottomPaste)}removeMaskShape(){this.maskShapes&&(this.maskShapes.remove(),delete this.maskShapes)}};var ore=Math.PI*2;function dn(o,t){if(o.length==0)return o;if(t instanceof M){let e=t.start();xr(o,(r,i)=>r.distance2(e)-i.distance2(e),0,o.length)}else{let e=t.center,r=t.start().sub(e).normalize(),i=t.sweep();xr(o,(n,s)=>{let a=n.sub(e).normalize(),l=s.sub(e).normalize(),c=sre(r.dot(a)),h=sre(r.dot(l)),u=r.cross(a),d=r.cross(l),p=Math.acos(c),m=Math.acos(h);return(i==le.CCW&&ne.less(u,0)||i==le.CW&&ne.greater(u,0))&&(p=ore-p),(i==le.CCW&&ne.less(d,0)||i==le.CW&&ne.greater(d,0))&&(m=ore-m),p-m},0,o.length),t.start().equals(t.end())&&o.push(t.end())}return o}function sre(o){return o>1?1:o<-1?-1:o}function TCe(o){return o/180*Math.PI}function J0(o,t){if(o.length==0)return o;if(t instanceof M){let e=t.start();xr(o,(r,i)=>r.point.distance2(e)-i.point.distance2(e),0,o.length)}else{let e=t.center,r=t.start().sub(e).normalize(),i=t.sweep();xr(o,(n,s)=>{let a=n.point.sub(e).normalize(),l=s.point.sub(e).normalize(),c=sre(r.dot(a)),h=sre(r.dot(l)),u=r.cross(a),d=r.cross(l),p=Math.acos(c),m=Math.acos(h);return(i==le.CCW&&ne.less(u,0)||i==le.CW&&ne.greater(u,0))&&(p=ore-p),(i==le.CCW&&ne.less(d,0)||i==le.CW&&ne.greater(d,0))&&(m=ore-m),p-m},0,o.length)}return o}var X9t=[48,49,50,51],zx=class extends NI{constructor(){super();this.lastHighlightMap={};jo("view/pcb/PolygonView")}get type(){var e;return(e=this._viewDataModel)==null?void 0:e.type}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get outline(){var e;return(e=this._viewDataModel)==null?void 0:e.outline}get strokeWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.strokeWidth}get fillColor(){return this._fillColor}set fillColor(e){this._fillColor=e}get constrainName(){return this._constrainName}set constrainName(e){e==""?this._constrainName!=null&&(this._constrainName=e):this._constrainName!=e&&(this._constrainName=e)}get fpcMaterial(){return this._fpcMaterial}set fpcMaterial(e){e==""?this._fpcMaterial!=null&&(this._fpcMaterial=e):this._fpcMaterial!=e&&(this._fpcMaterial=e)}get fpcThickness(){return this._fpcThickness}set fpcThickness(e){e==""?this._fpcThickness!=null&&(this._fpcThickness=e):this._fpcThickness!=e&&(this._fpcThickness=e)}get partitionName(){var e;return(e=this._viewDataModel)==null?void 0:e.partitionName}get component(){var e;return(e=this._viewDataModel)==null?void 0:e.component}get fillState(){var e;return(e=this._viewDataModel)==null?void 0:e.fillState}get childrenModified(){var e;return(e=this._viewDataModel)==null?void 0:e.childrenModified}removeMask(){this._mask&&(this._mask.remove(),delete this._mask)}removeFill(){if(this.filling){for(let e of this.filling)e.remove();delete this.filling}this.holeBaseNetRemove(),this.fpcBaseNetRemove()}fill(){var i,n;let e=this.fillColor,r=this.filling==null;switch(this.type){case"Board Outline":break;case"Fill Region":case"TearDrop":this.filling||(this.filling=[this.fillRegion(this.layerId,e)]);break;case"FPC Stiffener":{this.filling||(this.filling=this.fillFPC(this.layerId,e));break}case"Slot Region":this.filling||(this.filling=[this.fillRegion(47,e)]);break;case"Prohibited Region":this.filling||(this.filling=this.fillGrid());break;case"Constraint Region":{this.filling||(this.filling=this.fillConstraint(this.layerId,e));break}case"Partition":{this.removeFill(),this.filling||(this.filling=this.fillPartition(this.layerId,e));break}case"Line":break;case"Copper Region":break;case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":this.filling||(this.filling=[this.fillRegion(this.layerId,e)]);break;case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":this.filling||(this.filling=[this.fillRegion(this.layerId,e)]);break;case"3D Shell - Side Datum Line":{(i=this.filling)==null||i.forEach(s=>{s.remove()}),this.filling=this.fillStyle();break}case"3D Shell - Outline":{this.filling||(this.filling=this.fillPolygonOutline());break}case"Board":{this.filling||(this.filling=[this.fillRegion(this.layerId,e)]);break}}(r&&this.manualHighLight||this.manualHighLightModified)&&((n=this.filling)==null||n.forEach(s=>{s.forceVisibleHighLight(this.manualHighLight)}),this._fpcNameBaseNet&&this._fpcNameBaseNet.forceVisibleHighLight(this.manualHighLight),this._fpcNumberBaseNet&&this._fpcNumberBaseNet.forceVisibleHighLight(this.manualHighLight),this._holeBaseNet&&this._holeBaseNet.forceVisibleHighLight(this.manualHighLight))}fillRegion(e,r){let i=this.outline;if(i instanceof Gt){let n=new NS(e);return n.visible(e,i.items,r,this.viewGroupId),n}else{let n=new KB(e);return n.visible(e,i,r,this.viewGroupId),n}}fillGrid(){let e=this.outline instanceof Gt?this.outline.items[0]:this.outline,r=vA(e),i=new Array;for(let n of r){let s=new Yc(this.layerId);s.visible(this.layerId,n.start(),n.end(),!0,0,0,this.fillColor,this.viewGroupId),i.push(s)}return i}fillConstraint(e,r){let i=[];return i.push(this.fillRegion(e,r)),this.holeBaseNetVisible(),i}fillPartition(e,r){let i=[];return i.push(this.fillRegion(e,r)),this.holeBaseNetVisible(!0,e),i}fillFPC(e,r){let i=[];return i.push(this.fillRegion(e,r)),this.fpcMaterial&&this.fpcBaseNetVisible(),i}fillStyle(){let e=new Array;if(this.type=="3D Shell - Side Datum Line"){let r=this.outline.primitives[0];if(this.outline.primitives.length==1&&r instanceof M){let i=r.direct,n=1.9685,s=3,a=r.end();for(let c=0;c<s;c++){let h=a,u=h.add(i.mul(n)),d=new Ws(this.layerId);d.visible(this.layerId,h,u,this.strokeWidth,ee.WHITE,this.viewGroupId,void 0),e.push(d),a=u.add(i.mul(n))}let l=r.start();for(let c=0;c<s;c++){let h=l,u=h.sub(i.mul(n)),d=new Ws(this.layerId);d.visible(this.layerId,h,u,this.strokeWidth,ee.WHITE,this.viewGroupId,void 0),e.push(d),l=u.sub(i.mul(n))}}}return e}fillPolygonOutline(){if(this.component instanceof K0){let e=this.component;if(!e||e.topInnerHeight<=0&&e.bottomInnerHeight<=0)return[];let r=bn.getInstance().getLayer(54),i=bn.getInstance().getLayer(55),n=e.topInnerHeight>0?r.activeColor:i.activeColor,s=.3937,a=5.90551,l=this.strokeWidth/2+a/2+s,c=Af(this.outline,-l),h=new Array;if(c.length>0)for(let u of c){let d=u.items;for(let p of d)for(let m of p.primitives){let g;m instanceof M?(g=new Ws(this.layerId),g.visible(this.layerId,m.start(),m.end(),a,n,this.viewGroupId,void 0)):m instanceof q&&(g=new fl(this.layerId),g.visible(this.layerId,m.center,m.rx,a,TCe(m.startAngle),TCe(m.endAngle()),m.sweep(),n,this.viewGroupId)),h.push(g)}}return h}return[]}mainVisible(){let e=this.lineColor,r=this.layerModified||this.viewGroupIdModified||this._lastLineColor!=e&&!e.equals(this._lastLineColor);this._lastLineColor=e;let{layerId:i,strokeWidth:n,viewGroupId:s,manualHighLight:a,manualHighLightModified:l}=this,c=this.getAllChildIds(),h=0;for(let u of this._viewDataModel.childrens)if(Array.isArray(u))for(let d of u){let p=this.visibleChild(d,i,d.modelType,this._lineType,n,e,s,r);c.delete(d.globalIndex),l&&p.forceVisibleHighLight(a),h++}else{let d=this.visibleChild(u,i,u.modelType,this._lineType,n,e,s,r);c.delete(u.globalIndex),l&&d.forceVisibleHighLight(a),h++}for(let u of c){let d=this.getChild(u);delete this.lastHighlightMap[u],d.remove(),this.deleteChild(u)}if(h>100&&!(this.mains instanceof Map)){let u=new Map;for(let d in this.mains)u.set(d,this.mains[d]);this.mains=u}}getAllChildIds(){return this.mains instanceof Map?new Set(this.mains.keys()):new Set(Object.keys(this.mains))}getChild(e){return this.mains instanceof Map?this.mains.get(e):this.mains[e]}setChild(e,r){this.mains instanceof Map?this.mains.set(e,r):this.mains[e]=r}deleteChild(e){this.mains instanceof Map?this.mains.delete(e):delete this.mains[e]}clearChilds(){if(this.mains!=null)if(this.mains instanceof Map)this.mains.forEach(e=>e.remove()),this.mains.clear(),this.mains=null;else{for(let e in this.mains)this.mains[e].remove();this.mains=null}}visibleChild(e,r,i,n,s,a,l,c){let{line:h,match:u}=this.getMain(e.globalIndex,r,i,n);if(c=c||!u||e.shapeModified,c)switch(i){case"Line":{this.visibleLine(h,e,r,s,a,l);break}case"Arc":{this.visibleArc(h,e,r,s,a,l);break}}return h}getMain(e,r,i,n){let s=this.getChild(e),a=!0;return s==null?a=!1:i=="Line"?n=="line"?a=s instanceof Ws:a=s instanceof Yc:n=="line"?a=s instanceof fl:a=s instanceof Ly,a||(i=="Line"?n=="line"?s=new Ws(r):s=new Yc(r):n=="line"?s=new fl(r):s=new Ly(r),this.setChild(e,s)),{line:s,match:a}}visibleLine(e,r,i,n,s,a){e&&(e instanceof Yc?e.visible(i,r.start,r.end,this.lineSolid,3,2,s,a):e.visible(i,r.start,r.end,n,s,a,void 0))}visibleArc(e,r,i,n,s,a){e&&(e instanceof fl?e.visible(i,r.center,r.radius,n,r.startAngle,r.endAngle,r.sweep,s,a):e.visible(i,r.center,r.radius,r.startAngle,r.endAngle,r.sweep,s,a))}visible(){let e=this.mains==null||Object.keys(this.mains).length==0;this.maskVisible(!1),this.mainVisible(),this.type==="Partition"?this.fill():this.fillState==0?this.fill():this.removeFill(),e&&this.maskVisible(!1),this.removeMask()}highlight(){this.mainVisible(),this.removeFill();let e=this.highlightColor||ee.BLACK;this.fillState==0?this.type!="Line"&&this.type!="Board Outline"&&this.type!="3D Shell - Outline"&&this.type!="3D Shell - Side Datum Line"&&(this.removeMask(),this._mask=this.fillRegion(1002,e)):this.removeMask(),this.maskVisible(!0,this.forceUpdateMask,e)}visibleMain(){this.mainVisible(),this.removeFill();let e=this.highlightColor||ee.BLACK;this.maskVisible(!0,this.forceUpdateMask,e)}modify(e,r){let i=this.fillColor,n=this.constrainName||"",s=this.fpcMaterial||"",a=this.fpcThickness||"";super.modify(e,r);let{lineSolid:l,fillColor:c,constrainName:h,fpcMaterial:u,fpcThickness:d}=e;this.lineSolid=l,this.fillColor=c,this.constrainName=h||void 0,this.fpcMaterial=u||void 0,this.fpcThickness=d||void 0;let p=this._lineType;switch(this._lineType=this.lineType(e.strokeWidth),this.initChild(),(this.layerModified||p!=this._lineType)&&this.removePoly(),(this.layerModified||this.shapeModified||this.childrenModified||this.viewGroupIdModified||!c.equals(i)||h!=n||u!=s||d!=a)&&(this.removeMask(),this.removeFill()),this.initChild(),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}case"Not Show Fill":{this.visibleMain();break}default:break}X9t.includes(this.layerId)&&this.removeMask()}initChild(){this.mains==null&&(this.mains={})}removePoly(){this.maskVisible(!1,!0),this.clearChilds()}maskVisible(e,r=!1,i){e=r?e:!0;for(let n of this._viewDataModel.childrens)if(Array.isArray(n))for(let s of n){let a=this.getChild(s.globalIndex);s.isHighLight&&e?this.mainMaskHighLightColor(a,r,this.getHighLightType(s),i,s.globalIndex):this.mainMaskHighLightColor(a,r,e?this.highLightType:null,i,s.globalIndex)}else{let s=this.getChild(n.globalIndex);n.isHighLight&&e?this.mainMaskHighLightColor(s,r,this.getHighLightType(n),i,n.globalIndex):this.mainMaskHighLightColor(s,r,e?this.highLightType:null,i,n.globalIndex)}}getHighLightType(e){return e.highLightBySelect?1:e.highLightByHover?0:null}mainMaskHighLightColor(e,r,i,n,s){let a=this.lastHighlightMap[s];!e||!r&&(a==null?void 0:a[0])==i||(a!=null&&e.highlight(!1,a[0],a[1]),i!=null&&e.highlight(!0,i,n),i==null?delete this.lastHighlightMap[s]:this.lastHighlightMap[s]=[i,n])}holeBaseNetVisible(e=!1,r=47){var h;if(e)(h=this._holeBaseNet)==null||h.remove();else if(this._holeBaseNet)return;let i="";switch(this.type){case"Constraint Region":i=this.constrainName;break;case"Partition":i=this.lineColor.alpha===0?"":this.partitionName;break;default:break}if(!i||!bn.getInstance().getLayer(this.layerId).status.visible)return;let n=r||47,s=new BI(this.outline),a=s.center,l=this.outline.bbox().width(),c=s.high;this._holeBaseNet||(this._holeBaseNet=new jl(n)),this._holeBaseNet.visible(n,i,a,0,10,15,l*.65,c)}holeBaseNetRemove(){this._holeBaseNet&&(this._holeBaseNet.remove(),delete this._holeBaseNet)}fpcBaseNetVisible(){let e=this.fpcMaterial,r=this.fpcThickness;if(!e||!bn.getInstance().getLayer(this.layerId).status.visible)return;let i=new BI(this.outline),n=i.center,s=this.outline.bbox().width(),a=i.high,l=n.add1(0,.25*a),c=n.add1(0,-.25*a),h=1003;this._fpcNameBaseNet||(this._fpcNameBaseNet=new jl(h)),this._fpcNumberBaseNet||(this._fpcNumberBaseNet=new jl(h)),this._fpcNameBaseNet.visible(h,e,l,0,Wc,zc,s*.65,a),this._fpcNumberBaseNet.visible(h,`${r}mm`,c,0,Wc,zc,s*.65,a)}fpcBaseNetRemove(){this._fpcNameBaseNet&&(this._fpcNameBaseNet.remove(),delete this._fpcNameBaseNet),this._fpcNumberBaseNet&&(this._fpcNumberBaseNet.remove(),delete this._fpcNumberBaseNet)}remove(){this.removePoly(),this.removeMask(),this.removeFill()}};var HY=class extends Xo{get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get strokeWidth(){var t;return(t=this._viewDataModel)==null?void 0:t.strokeWidth}get center(){var t;return(t=this._viewDataModel)==null?void 0:t.center}get start(){var t;return(t=this._viewDataModel)==null?void 0:t.start}get end(){var t;return(t=this._viewDataModel)==null?void 0:t.end}get textPath(){var t;return(t=this._viewDataModel)==null?void 0:t.textPath}get textMatrix(){var t;return(t=this._viewDataModel)==null?void 0:t.textMatrix}get width(){var t;return(t=this._viewDataModel)==null?void 0:t.viewWidth}get height(){var t;return(t=this._viewDataModel)==null?void 0:t.viewHeight}get outlineModified(){var t;return(t=this._viewDataModel)==null?void 0:t.outlineModified}getData(){let t=this.start.sub(this.center),e=this.end.sub(this.center),r=Math.atan2(t.y,t.x),i=Math.atan2(e.y,e.x);r==i&&(i+=1e-8);let s=t.cross(e)>=0?le.CCW:le.CW,l=new S(this.width,this.height).multiply4(this.textMatrix).add1(ms(this.layerId)?-1:1,0),c=this.strokeWidth/2+.1;return{startAngle:r,endAngle:i,sweep:s,textAngleCenter:l,textAngleRadius:c}}mainVisible(t,e){e||(e=this.getData());let{startAngle:r,endAngle:i,sweep:n,textAngleCenter:s,textAngleRadius:a}=e,{layerId:l}=this,c=!1;this.text||(c=!0,this.text=new cT);let h=this.resetHighLightState;this.startEdge||(c=!0,this.startEdge=new Nd(l,h)),this.endEdge||(this.endEdge=new Nd(l,h)),this.angleArc||(this.angleArc=new Lg(l,h)),this.textAngle||(this.textAngle=new Lg(l,h)),this.layerModified&&this.mainRemove();let{start:u,end:d,center:p,strokeWidth:m,textPath:g,textMatrix:y,width:b,height:P,viewGroupId:T}=this,I=ee.BLACK,C=this._viewDataModel.box;if(this.text.modify({partition:this._viewDataModel.partition,globalIndex:this._viewDataModel.globalIndex,layerId:l,box:C,strokeWidth:m,path:g,matrix:y,width:b,height:P,layerModified:this.layerModified,outlineModified:this.outlineModified,highLightType:this.highLightType,highlightColor:this.highlightColor,shapeModified:this.shapeModified,manualHighLight:this.manualHighLight,manualHighLightModified:this.manualHighLightModified},t),c||(c=this.layerModified||this.shapeModified||this.viewGroupIdModified),this.textAngle.visible(l,s,a,m/2,0,Vr,le.CCW,I,T),!c){this.highlightModify();return}this.startEdge.visible(l,p,u,m,I,T,void 0),this.endEdge.visible(l,p,d,m,I,T,void 0),this.angleArc.visible(l,p,10,m,r,i,n,I,T),this.highlightModify()}highlightModify(){this.manualHighLightModified&&(this.textAngle.forceVisibleHighLight(this.manualHighLight),this.startEdge.forceVisibleHighLight(this.manualHighLight),this.endEdge.forceVisibleHighLight(this.manualHighLight),this.angleArc.forceVisibleHighLight(this.manualHighLight))}maskVisible(t,e=!1,r){let i=this.highlightColor||ee.BLACK;if(this.isWebglEnv()){if(!t){this._startEdgeMask&&(this._startEdgeMask.remove(),delete this._startEdgeMask),this._endEdgeMask&&(this._endEdgeMask.remove(),delete this._endEdgeMask),this._angleArcMask&&(this._angleArcMask.remove(),delete this._angleArcMask),this._textAngleMask&&(this._textAngleMask.remove(),delete this._textAngleMask);return}let n=1002;r||(r=this.getData());let{startAngle:s,endAngle:a,sweep:l,textAngleCenter:c,textAngleRadius:h}=r;this._startEdgeMask||(this._startEdgeMask=new Ws(n)),this._endEdgeMask||(this._endEdgeMask=new Ws(n)),this._angleArcMask||(this._angleArcMask=new fl(n)),this._textAngleMask||(this._textAngleMask=new fl(n)),this._startEdgeMask.visible(1002,this.center,this.start,this.strokeWidth,i,null),this._endEdgeMask.visible(1002,this.center,this.end,this.strokeWidth,i,null),this._angleArcMask.visible(1002,this.center,10,this.strokeWidth,s,a,l,i,null),this._textAngleMask.visible(1002,c,h,this.strokeWidth/2,0,Vr,l,i,null);return}this.mainsMaskHighLightColor([this.startEdge,this.endEdge,this.angleArc,this.textAngle],e,t?this.highLightType:null,i)}visible(){let t=this.getData();this.mainVisible("Only Main",t),this.maskVisible(!1,!1,t)}highlight(){let t=this.getData();this.mainVisible("Main And Highlight",t),this.maskVisible(!0,this.forceUpdateMask,t)}modify(t,e){switch(super.modify(t,e),e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){var t,e,r,i;this.maskVisible(!1,!0),(t=this.startEdge)==null||t.remove(),(e=this.endEdge)==null||e.remove(),(r=this.angleArc)==null||r.remove(),(i=this.textAngle)==null||i.remove()}remove(){var t;this.mainRemove(),(t=this.text)==null||t.remove()}};var WY=class extends Xo{get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get start(){var t;return(t=this._viewDataModel)==null?void 0:t.start}get end(){var t;return(t=this._viewDataModel)==null?void 0:t.end}get strokeWidth(){var t;return(t=this._viewDataModel)==null?void 0:t.strokeWidth}get textPath(){var t;return(t=this._viewDataModel)==null?void 0:t.textPath}get textMatrix(){var t;return(t=this._viewDataModel)==null?void 0:t.textMatrix}get width(){var t;return(t=this._viewDataModel)==null?void 0:t.viewWidth}get height(){var t;return(t=this._viewDataModel)==null?void 0:t.viewHeight}get outlineModified(){var t;return(t=this._viewDataModel)==null?void 0:t.outlineModified}getData(){let t=this.end.sub(this.start).normalize(),e=Ae.rotateZ(Math.PI/4),r=Ae.rotateZ(-Math.PI/4),i=t.multiply4(e).mul(3),n=t.multiply4(r).mul(3);return{v1:i,v2:n}}mainVisible(t,e){let{layerId:r}=this;e||(e=this.getData());let{v1:i,v2:n}=e,s=!1;if(this.text||(this.text=new cT,s=!0),this.lines)this.layerModified&&(this.mainRemove(),s=!0);else{let m=this.resetHighLightState;this.lines=[new Nd(r,m),new Nd(r,m),new Nd(r,m)],s=!0}let a=this._viewDataModel.box;if(this.text.modify({partition:this._viewDataModel.partition,globalIndex:this._viewDataModel.globalIndex,layerId:r,box:a,strokeWidth:this.strokeWidth,path:this.textPath,matrix:this.textMatrix,width:this.width,height:this.height,highLightType:this.highLightType,highlightColor:this.highlightColor,layerModified:this.layerModified,shapeModified:this.shapeModified,outlineModified:this.outlineModified,manualHighLight:this.manualHighLight,manualHighLightModified:this.manualHighLightModified},t),!(s||this.layerModified||this.shapeModified||this.viewGroupIdModified)){this.highlightModify();return}let{start:c,end:h,strokeWidth:u,viewGroupId:d}=this,p=ee.BLACK;this.lines[0].visible(r,c,h,u,p,d,void 0),this.lines[1].visible(r,h,h.sub(n),u,p,d,void 0),this.lines[2].visible(r,h,h.sub(i),u,p,d,void 0),this.highlightModify()}highlightModify(){this.manualHighLightModified&&this.lines.forEach(t=>{t.forceVisibleHighLight(this.manualHighLight)})}maskVisible(t,e=!1,r){let i=this.highlightColor||ee.BLACK;if(this.isWebglEnv()){if(!t){this.masks&&(this.masks.forEach(a=>a.remove()),delete this.masks);return}r||(r=this.getData());let{v1:n,v2:s}=r;this.masks||(this.masks=[new Ws(1002),new Ws(1002),new Ws(1002)]),this.masks[0].visible(1002,this.start,this.end,this.strokeWidth,i,null),this.masks[1].visible(1002,this.end,this.end.sub(s),this.strokeWidth,i,null),this.masks[2].visible(1002,this.end,this.end.sub(n),this.strokeWidth,i,null);return}this.mainsMaskHighLightColor(this.lines,e,t?this.highLightType:null,i)}visible(){let t=this.getData();this.mainVisible("Only Main",t),this.maskVisible(!1,!1,t)}highlight(){let t=this.getData();this.mainVisible("Main And Highlight",t),this.maskVisible(!0,this.forceUpdateMask,t)}modify(t,e){switch(super.modify(t,e),e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){this.maskVisible(!1,!0);for(let t of this.lines)t.remove()}remove(){var t;this.mainRemove(),(t=this.text)==null||t.remove()}};var zY=class extends Xo{constructor(){super()}get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get start(){var t;return(t=this._viewDataModel)==null?void 0:t.start}get end(){var t;return(t=this._viewDataModel)==null?void 0:t.end}get color(){var t;return(t=this._viewDataModel)==null?void 0:t.color}mainVisible(){let t=!1;if(this.line)this.layerModified&&(this.mainRemove(),t=!0);else{let r=this.resetHighLightState;this.line=new Ix(this.layerId,r),t=!0}let e=this.color;t||(t=this.layerModified||this.shapeModified||this.viewGroupIdModified||!e.equals(this._lastColor)),t&&(this.line.visible(this.layerId,this.start,this.end,!0,0,0,e,this.viewGroupId),this._lastColor=e),this.manualHighLightModified&&this.line.forceVisibleHighLight(this.manualHighLight)}maskVisible(t,e=!1){if(this.line){if(this.isWebglEnv()){if(!t){this._mask&&(this._mask.remove(),delete this._mask);return}let r=this.highlightColor||ee.BLACK;this._mask||(this._mask=new Yc(1002)),this._mask.visible(1002,this.start,this.end,!0,0,0,r,null);return}this.mainMaskHighLightColor(this.line,e,t?this.highLightType:null)}}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask)}modify(t,e){switch(super.modify(t,e),e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){this.maskVisible(!1,!0),this.line.remove()}remove(){this.mainRemove()}};var q9t=[48,49,50,51],WM=class extends NI{constructor(){super(...arguments);this.lines=new Array;this.layers=[]}get type(){var e;return(e=this._viewDataModel)==null?void 0:e.type}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get leftLow(){var e;return(e=this._viewDataModel)==null?void 0:e.leftLow}get leftUp(){var e;return(e=this._viewDataModel)==null?void 0:e.leftUp}get rightUp(){var e;return(e=this._viewDataModel)==null?void 0:e.rightUp}get rightLow(){var e;return(e=this._viewDataModel)==null?void 0:e.rightLow}get radius(){var e;return(e=this._viewDataModel)==null?void 0:e.radius}get strokeWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.strokeWidth}get viewColor(){var e;return(e=this._viewDataModel)==null?void 0:e.viewColor}get constrainName(){return this._constrainName}set constrainName(e){this._constrainName=e}get fillColor(){return this._fillColor}set fillColor(e){this._fillColor=e}get fpcMaterial(){return this._fpcMaterial}set fpcMaterial(e){this._fpcMaterial=e}get fpcThickness(){return this._fpcThickness}set fpcThickness(e){this._fpcThickness=e}get partitionName(){var e;return(e=this._viewDataModel)==null?void 0:e.partitionName}get component(){var e;return(e=this._viewDataModel)==null?void 0:e.component}get outline(){let e=this.leftLow.add(this.leftUp).mul(.5),r=this.rightLow.add(this.rightUp).mul(.5),i=this.leftLow.distance1(this.leftUp),n=this.leftLow.distance1(this.rightLow),s=this.radius*2/Math.min(i,n);return Ng(e,r,i,s)}drawRect(e,r,i,n){let s=this.rightLow.sub(this.leftLow).normalize(),a=this.leftUp.sub(this.leftLow).normalize(),l=this.leftLow.add(s.mul(this.radius)),c=this.rightLow.add(s.mul(-this.radius)),h=this.rightLow.add(a.mul(this.radius)),u=this.rightUp.add(a.mul(-this.radius)),d=this.rightUp.add(s.mul(-this.radius)),p=this.leftUp.add(s.mul(this.radius)),m=this.leftUp.add(a.mul(-this.radius)),g=this.leftLow.add(a.mul(this.radius)),y=[g,m,p,d,u,h,c,l],b=0;for(let R of r)R instanceof Ws?R.visible(e,y[b],y[b+1],this.strokeWidth,n,this.viewGroupId,void 0):R.visible(e,y[b],y[b+1],this.lineSolid,3,2,n,this.viewGroupId),b+=2;if(!i)return;let P=l.add(a.mul(this.radius)),T=m.add(s.mul(this.radius)),I=d.add(a.mul(-this.radius)),C=h.add(s.mul(-this.radius)),E=[P,T,I,C],O=[l,g,m,p,d,u,h,c],_=0;for(let R of i){let v=E[_],D=O[_*2].angle(v),w=O[_*2+1].angle(v);R instanceof fl?R.visible(e,v,this.radius,this.strokeWidth,D,w,le.CW,n,this.viewGroupId):R.visible(e,v,this.radius,D,w,le.CW,n,this.viewGroupId),_++}}removeRect(){this.rectMasksVisible(!1,!0),this.lines.forEach(e=>e.remove()),this.lines.length=0,this.corners&&(this.corners.forEach(e=>e.remove()),delete this.corners)}rectMasksVisible(e,r=!1,i){var s,a;if(this.isWebglEnv()){if(!e){(s=this._lineMasks)==null||s.forEach(c=>c.remove()),delete this._lineMasks,(a=this._cornerMasks)==null||a.forEach(c=>c.remove()),delete this._cornerMasks;return}let l=1002;if(!this._lineMasks){this._lineMasks=[];for(let c=0;c<4;c++)this._lineMasks.push(new Ws(l))}if(this.radius>0&&!this._cornerMasks){this._cornerMasks=[];for(let c=0;c<4;c++)this._cornerMasks.push(new fl(l))}this.drawRect(l,this._lineMasks,this._cornerMasks,i);return}let n=this._viewDataModel.selectChildId;if(this._lastSelectChildId==n)if(n!=null){let l=this.lines[n/2];this.mainsMaskHighLightColor([l],r,e?this.highLightType:null,i)}else this.mainsMaskHighLightColor([].concat(this.lines,this.corners||[]),r,e?this.highLightType:null,i);else{if(this._lastSelectChildId!=null){let l=this.lines[this._lastSelectChildId/2];this.mainsMaskHighLightColor([l],r,null,i),this._lastSelectChildId=void 0}else this.mainsMaskHighLightColor([].concat(this.lines,this.corners||[]),r,null,i);if(n==null)this.mainsMaskHighLightColor([].concat(this.lines,this.corners||[]),r,e?this.highLightType:null,i);else if(e){let l=this.lines[n/2];this.mainsMaskHighLightColor([l],r,e?this.highLightType:null,i),this._lastSelectChildId=n}else this.mainsMaskHighLightColor([].concat(this.lines,this.corners||[]),r,e?this.highLightType:null,i)}}removeAnnotationLines(){this.annotationLines&&(Fn(this.annotationLines,(e,r)=>{r.forEach(i=>i.remove())}),delete this.annotationLines)}fill(){var i;let e=this.fillColor,r=this.filling==null;switch(this.type){case"Board Outline":break;case"Fill Region":(!this.filling||this.filling.length==0)&&(this.filling=[],this.filling.push(this.fillRegion(this.layerId,e)));break;case"FPC Stiffener":(!this.filling||this.filling.length==0)&&(this.filling=this.fillFPC(this.layerId,e));break;case"Slot Region":(!this.filling||this.filling.length==0)&&(this.filling=[],this.filling.push(this.fillRegion(47,e)));break;case"Prohibited Region":(!this.filling||this.filling.length==0)&&(this.filling=this.fillGrid(e));break;case"Constraint Region":(!this.filling||this.filling.length==0)&&(this.filling=this.fillConstraint(this.layerId,e));break;case"Partition":{this.removeFill(),this.filling=this.fillPartition(this.layerId,e);break}case"Line":break;case"Copper Region":break;case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":(!this.filling||this.filling.length==0)&&(this.filling=[],this.filling.push(this.fillRegion(this.layerId,e)));break;case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":(!this.filling||this.filling.length==0)&&(this.filling=[],this.filling.push(this.fillRegion(this.layerId,e)));break;case"3D Shell - Outline":{(!this.filling||this.filling.length==0)&&(this.filling=this.fillCircleOutline());break}case"Board":{this.filling||(this.filling=[this.fillRegion(this.layerId,e)]);break}}(r&&this.manualHighLight||this.manualHighLightModified)&&((i=this.filling)==null||i.forEach(n=>{n.forceVisibleHighLight(this.manualHighLight)}),this._fpcNameBaseNet&&this._fpcNameBaseNet.forceVisibleHighLight(this.manualHighLight),this._fpcNumberBaseNet&&this._fpcNumberBaseNet.forceVisibleHighLight(this.manualHighLight),this._holeBaseNet&&this._holeBaseNet.forceVisibleHighLight(this.manualHighLight))}removeFill(){this.fillMasksVisible(!1),this.filling&&(this.filling.forEach(e=>e.remove()),delete this.filling),this.holeBaseNetRemove(),this.fpcBaseNetRemove()}fillMasksVisible(e,r){var i;if(!e){(i=this._fillMask)==null||i.remove(),delete this._fillMask;return}this._fillMask||(this._fillMask=new Z0(1002)),this._fillMask.visible(1002,this.leftUp,this._viewDataModel.width,this._viewDataModel.height,this._viewDataModel.rotation,this._viewDataModel.radius,r,this.viewGroupId)}fillRegion(e,r){let i=new Z0(e);return i.visible(e,this.leftUp,this._viewDataModel.width,this._viewDataModel.height,this._viewDataModel.rotation,this._viewDataModel.radius,r,this.viewGroupId,void 0),i}fillGrid(e=ee.Gray){let r=vA(this.outline),i=new Array;for(let n of r){let s=new Yc(this.layerId);s.visible(this.layerId,n.start(),n.end(),!0,0,0,e,this.viewGroupId),i.push(s)}return i}fillConstraint(e,r){let i=[];return i.push(this.fillRegion(e,r)),this.holeBaseNetVisible(),i}fillPartition(e,r){let i=[];return i.push(this.fillRegion(e,r)),this.holeBaseNetVisible(!0,e),i}fillFPC(e,r){let i=[];return i.push(this.fillRegion(e,r)),this.fpcMaterial&&this.fpcBaseNetVisible(),i}fillCircleOutline(){if(this.component instanceof K0){let e=this.component;if(!e||e.topInnerHeight<=0&&e.bottomInnerHeight<=0)return[];let r=bn.getInstance().getLayer(54),i=bn.getInstance().getLayer(55),n=e.topInnerHeight>0?r.activeColor:i.activeColor,s=.3937,a=5.90551,l=this.strokeWidth/2+a/2+s,c=Af(this.outline,-l),h=new Array;if(c.length>0)for(let u of c){let d=u.items;for(let p of d)for(let m of p.primitives){let g;m instanceof M?(g=new Ws(this.layerId),g.visible(this.layerId,m.start(),m.end(),a,n,this.viewGroupId,void 0)):m instanceof q&&(g=new fl(this.layerId),g.visible(this.layerId,m.center,m.rx,a,mh(m.startAngle),mh(m.endAngle()),m.sweep(),n,this.viewGroupId)),h.push(g)}}return h}return[]}lineTypeChanged(e){if(this.lines.length>0)return e=="lineSegment"?this.lines[0]instanceof Ws:this.lines[0]instanceof Yc}mainVisible(){let e=this.lineColor;if(this._needModify||this.layerModified||this.shapeModified||this.viewGroupIdModified||!e.equals(this._lastLineColor))if(delete this._needModify,this._lastLineColor=e,this.type=="Annotation"){if(!this.annotationLines)return;this.layers.forEach(i=>{this.drawRect(i,this.annotationLines[i],this.corners,e)})}else this.drawRect(this.layerId,this.lines,this.corners,e)}hightItem(){var e,r;(this.manualHighLightModified||this._needModify&&this.manualHighLight)&&((e=this.lines)==null||e.forEach(i=>{i.forceVisibleHighLight(this.manualHighLight)}),(r=this.corners)==null||r.forEach(i=>{i.forceVisibleHighLight(this.manualHighLight)}),this.annotationLines&&this.layers.forEach(i=>{let n=this.annotationLines[i];n==null||n.forEach(s=>{s.forceVisibleHighLight(this.manualHighLight)})}))}maskVisible(e,r,i=!1,n){this.rectMasksVisible(e,i,n),this.fillMasksVisible(r,n)}visible(){this.maskVisible(!1,!1),this.mainVisible(),this.fill()}highlight(){this.mainVisible(),this.removeFill();let e=this.highlightColor||ee.BLACK,r=!["Line","Board Outline","3D Shell - Outline"].includes(this.type);this.maskVisible(!0,r,this.forceUpdateMask,e)}visibleMain(){this.mainVisible(),this.removeFill(),this.maskVisible(!0,!1,!1)}modify(e,r){var I;let i=this.fillColor,n=this.constrainName||"",s=this.fpcMaterial||"",a=this.fpcThickness||"";super.modify(e,r);let{layerId:l,lineSolid:c,radius:h,strokeWidth:u,fillColor:d,constrainName:p,fpcMaterial:m,fpcThickness:g,layers:y}=e;this.lineSolid=c,this.fillColor=d,this.constrainName=p||void 0,this.fpcMaterial=m||void 0,this.fpcThickness=g||void 0;let b=this.layers;this.layers=y;let P=this.lineType(u);(this.layerModified||this.lineTypeChanged(P))&&this.removeRect();let T=!1;if(this.type=="Annotation"){let C={};for(let _ of b)C[_]=!0;let E=[],O=[];Fn(y,(_,R)=>{if(!C[R]){E.push(R);return}delete C[R]}),Fn(C,_=>{O.push(Number(_))}),this.annotationLines||(this.annotationLines={}),E.forEach(_=>{let R=this.annotationLines[_]=new Array;for(let v=0;v<4;v++)P==="line"?R.push(new Ws(_)):R.push(new Yc(_));T=!0}),O.forEach(_=>{this.annotationLines[_].forEach(v=>{v.remove()})})}else{let C=this.resetHighLightState;if(this.lines.length==0){for(let E=0;E<4;E++)P=="line"?this.lines.push(new Nd(l,C)):this.lines.push(new Ix(l,C));T=!0}if(h>0&&(this.corners||(this.corners=[]),this.corners.length==0)){this.maskVisible(!1,!1);for(let E=0;E<4;E++)P=="line"?this.corners.push(new Lg(l,C)):this.corners.push(new OE(l,C));T=!0}}switch(this._needModify=T,(this.shapeModified||this.layerModified||this.viewGroupIdModified||!d.equals(i)||p!=n||m!=s||g!=a)&&this.removeFill(),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}case"Not Show Fill":{this.visibleMain();break}default:break}q9t.includes(this.layerId)&&((I=this._fillMask)==null||I.remove()),this.hightItem()}holeBaseNetVisible(e=!1,r=47){if(e)this._holeBaseNet&&this._holeBaseNet.remove();else if(this._holeBaseNet)return;let i="";switch(this.type){case"Constraint Region":i=this.constrainName;break;case"Partition":i=this.lineColor.alpha===0?"":this.partitionName;break;default:break}if(!i||!bn.getInstance().getLayer(this.layerId).status.visible)return;let n=r||47,s=this.leftLow.add(this.rightUp).mul(.5),a=this.leftLow.distance1(this.rightLow),l=this.leftLow.distance1(this.leftUp);this._holeBaseNet||(this._holeBaseNet=new jl(n)),this._holeBaseNet.visible(n,i,s,0,10,15,a*.75,l)}holeBaseNetRemove(){this._holeBaseNet&&(this._holeBaseNet.remove(),delete this._holeBaseNet)}fpcBaseNetVisible(){let e=this.fpcMaterial,r=this.fpcThickness;if(!e||!bn.getInstance().getLayer(this.layerId).status.visible)return;let i=this.leftLow.add(this.rightUp).mul(.5),n=this.leftLow.distance1(this.rightLow),s=this.leftLow.distance1(this.leftUp),a=i.add1(0,.25*s),l=i.add1(0,-.25*s),c=1003;this._fpcNameBaseNet||(this._fpcNameBaseNet=new jl(c)),this._fpcNumberBaseNet||(this._fpcNumberBaseNet=new jl(c)),this._fpcNameBaseNet.visible(c,e,a,0,Wc,zc,n*.75,s),this._fpcNumberBaseNet.visible(c,`${r}mm`,l,0,Wc,zc,n*.75,s)}fpcBaseNetRemove(){this._fpcNameBaseNet&&(this._fpcNameBaseNet.remove(),delete this._fpcNameBaseNet),this._fpcNumberBaseNet&&(this._fpcNumberBaseNet.remove(),delete this._fpcNumberBaseNet)}remove(){this.removeRect(),this.removeAnnotationLines(),this.removeFill()}};var YY=class extends Xo{get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get bbox(){var t;return(t=this._viewDataModel)==null?void 0:t.bbox}get color(){var t;return(t=this._viewDataModel)==null?void 0:t.color}get spotSize(){var t;return(t=this._viewDataModel)==null?void 0:t.spotSize}getAllShapes(){return[this.leftLow,this.rightLow,this.leftUp,this.rightUp,this.center,this.leftLine,this.rightLine,this.topLine,this.bottomLine]}circleVisible(t,e,r,i=this.spotSize,n=this.color){return t=t||new ya(e),t.visible(e,r,i,n,this.viewGroupId),t.forceVisibleHighLight(this.manualHighLight),t}lineSegmentVisible(t,e,r,i,n=!1,s=6,a=4,l=this.color){return t=t||new Yc(e),t.visible(e,r,i,n,s,a,l,this.viewGroupId),t.forceVisibleHighLight(this.manualHighLight),t}mainVisible(){let{bbox:t,layerId:e}=this;this.leftLow=this.circleVisible(this.leftLow,e,t.LL()),this.rightLow=this.circleVisible(this.rightLow,e,t.LR()),this.leftUp=this.circleVisible(this.leftUp,e,t.UL()),this.rightUp=this.circleVisible(this.rightUp,e,t.UR()),this.center=this.circleVisible(this.center,e,t.center()),this.leftLine=this.lineSegmentVisible(this.leftLine,e,t.LL(),t.UL()),this.rightLine=this.lineSegmentVisible(this.rightLine,e,t.LR(),t.UR()),this.topLine=this.lineSegmentVisible(this.topLine,e,t.UR(),t.UL()),this.bottomLine=this.lineSegmentVisible(this.bottomLine,e,t.LR(),t.LL())}visible(){this.mainVisible()}highlight(){this.mainVisible()}modify(t,e){switch(super.modify(t,e),e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.getAllShapes().forEach(t=>t.remove())}};var jY=class o extends Xo{constructor(){super(),jo("view/pcb/TrackView")}get highLightType(){var t;return(t=o._viewDataModel)==null?void 0:t.highLightType}get manualHighLight(){var t;return(t=o._viewDataModel)==null?void 0:t.manualHighLight}get manualHighLightModified(){var t;return(t=o._viewDataModel)==null?void 0:t.manualHighLightModified}get layerModified(){var t;return(t=o._viewDataModel)==null?void 0:t.layerModified}get shapeModified(){var t;return(t=o._viewDataModel)==null?void 0:t.shapeModified}get netModified(){var t;return(t=o._viewDataModel)==null?void 0:t.netModified}get highlightColor(){var t;return(t=o._viewDataModel)==null?void 0:t.highlightColor}get viewGroupIdModified(){var t;return(t=o._viewDataModel)==null?void 0:t.viewGroupIdModified}get forceUpdateMask(){var t;return(t=o._viewDataModel)==null?void 0:t.forceUpdateMask}get layerId(){var t;return(t=o._viewDataModel)==null?void 0:t.layerId}get net(){var t;return(t=o._viewDataModel)==null?void 0:t.net}get showNet(){return o._viewDataModel.showNet}get width(){var t;return(t=o._viewDataModel)==null?void 0:t.width}get shouldShowNet(){return ga.getInstance().trackShowNet}get color(){return o._viewDataModel.partition==x.getInstance().partitionId?Oo.getInstance().trackConfig.getColor(o._viewDataModel.globalIndex,this.showNet):Oo.getInstance().readonlyTrackConfig.getColor(o._viewDataModel.globalIndex,this.showNet)}get start(){var t;return(t=o._viewDataModel)==null?void 0:t.start}get end(){var t;return(t=o._viewDataModel)==null?void 0:t.end}mainVisible(){let t=this.layerId,e=this.color,r=!1,i=!this.line||!1;if(this.line)this.layerModified&&(this.mainRemove(),i=!0);else{let n=this.resetHighLightState;this.line=new Nd(t,n),i=!0}i||(i=this.shapeModified),(i||this.viewGroupIdModified||!e.equals(this._lastColor))&&(i=!0,this._lastColor=e),this.shouldShowNet&&this.showNet?(r=!this.netView||i||this.netModified,this.netView||(this.netView=new jl(t),r=!0),r&&(r=!0)):this.removeNetView(),this.show(i,r,e),this.netView&&this.netView.forceVisibleHighLight(this.manualHighLight),this.line.forceVisibleHighLight(this.manualHighLight)}show(t,e,r){if(t||e){let{layerId:i,start:n,end:s,width:a,showNet:l,engineGroupId:c}=this;t&&this.line.visible(i,n,s,a,r,c,void 0),e&&this.netView.visible(i,l,n.add(s).mul(.5),pT(s.angle(n)),Wc,zc,s.distance1(n),a,void 0,c)}}maskVisible(t,e=!1){if(!this.line)return;let r=this.highlightColor||Oo.getInstance().trackConfig.getColor(o._viewDataModel.globalIndex,this.showNet);if(this.isWebglEnv()){t?(this.mask||(this.mask=new Ws(1002)),this.mask.visible(1002,this.start,this.end,this.width,r,null)):this.mask&&(this.mask.remove(),delete this.mask);return}this.mainMaskHighLightColor(this.line,e,t?this.highLightType:null,r)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask)}modify(t,e){switch(o._viewDataModel=t,e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}removeNetView(){this.netView&&(this.netView.remove(),delete this.netView)}mainRemove(){var t;this.maskVisible(!1,!0),(t=this.line)==null||t.remove()}remove(){this.mainRemove(),this.removeNetView()}};var XY=class extends Xo{constructor(){super();this.cushions=[new ya(12)];this.hole=new ya(47);jo("view/pcb/ViaView")}get wireViewGroupId(){var e;return this.getEngineGroupId((e=this._viewDataModel)==null?void 0:e.wireViewGroupId)}get net(){var e;return(e=this._viewDataModel)==null?void 0:e.showNet}get center(){var e;return(e=this._viewDataModel)==null?void 0:e.center}get radius(){var e;return(e=this._viewDataModel)==null?void 0:e.radius}get holeRadius(){var e;return(e=this._viewDataModel)==null?void 0:e.holeRadius}get topExpansion(){var e;return(e=this._viewDataModel)==null?void 0:e.topExpansion}get bottomExpansion(){var e;return(e=this._viewDataModel)==null?void 0:e.bottomExpansion}get color(){return this._viewDataModel.partition==x.getInstance().partitionId?Oo.getInstance().viaConfig.getColor(this._viewDataModel.globalIndex,this._viewDataModel.net,this._viewDataModel.selectItem):Oo.getInstance().readonlyViaConfig.getColor(this._viewDataModel.globalIndex,this._viewDataModel.net)}get showNet(){return ga.getInstance().viaShowNet}get layerPairStr(){var e;return(e=this._viewDataModel)==null?void 0:e.layerPairStr}get highlightByComponent(){var e;return(e=this._viewDataModel)==null?void 0:e.highlightByComponent}get usedLayers(){var e;return(e=this._viewDataModel)==null?void 0:e.usedLayers}get unusedInnerLayers(){var e;return(e=this._viewDataModel)==null?void 0:e.unusedInnerLayers}get allLayers(){var e;return(e=this._viewDataModel)==null?void 0:e.allLayers}get holeColor(){var e;return(e=this._viewDataModel)==null?void 0:e.holeColor}get radiusModified(){var e;return(e=this._viewDataModel)==null?void 0:e.radiusModified}get holeRadiusModified(){var e;return(e=this._viewDataModel)==null?void 0:e.holeRadiusModified}get topExpansionModified(){var e;return(e=this._viewDataModel)==null?void 0:e.topExpansionModified}get bottomExpansionModified(){var e;return(e=this._viewDataModel)==null?void 0:e.bottomExpansionModified}get holeViewGroupId(){var e;return(e=this._viewDataModel)==null?void 0:e.holeViewGroupId}cushionVisible(){var s;let e=this.unusedInnerLayers.length>0?this.usedLayers:this.grayIndex!=0?this.allLayers:[12],r=this.shapeModified||this.radiusModified||this.viewGroupIdModified,i=this.color;if(r||(r=e.toString()!=((s=this._lastCushionLayerIds)==null?void 0:s.toString())||!i.equals(this._lastColor)),!r){for(let a=0;a<Math.max(this.cushions.length,e.length);a++)this.cushions[a]&&this.cushions[a].forceVisibleHighLight(this.manualHighLight);return}let n=this.wireViewGroupId;for(let a=0;a<Math.max(this.cushions.length,e.length);a++){if(!e[a]){this.removeLastMaskShape(this.cushions[a]);continue}this.cushions[a]||(this.cushions[a]=new ya(e[a])),this.cushions[a].visible(e[a],this.center,this.radius,this.color,n),this.cushions[a].forceVisibleHighLight(this.manualHighLight)}this.cushions.length=e.length,this._lastCushionLayerIds=e,this._lastColor=i}mainVisible(e){e!=null&&(this.grayIndex=e);let r=this.shapeModified||this.radiusModified||this.holeRadiusModified||this.viewGroupIdModified,i=ee.BLACK,n=this.getEngineGroupId(this.holeViewGroupId),s=this.holeColor||ee.BLACK,a=r;a||(a=!s.equals(this._lastHoleColor)),a&&(this.hole.visible(47,this.center,this.holeRadius,s,n),this._lastHoleColor=s),this.hole.forceVisibleHighLight(this.manualHighLight),this.cushionVisible();let l=this.viewGroupId,c=this.wireViewGroupId,h=r||this.topExpansionModified,u=this.topExpansion+this.radius;u>0?(this.expansionTop||(this.expansionTop=new ya(5),h=!0),h&&this.expansionTop.visible(5,this.center,u,i,c),this.expansionTop.forceVisibleHighLight(this.manualHighLight)):this.removeExpansionTop();let d=r||this.bottomExpansionModified,p=this.bottomExpansion+this.radius;p>0?(this.expansionBom||(this.expansionBom=new ya(6),d=!0),d&&this.expansionBom.visible(6,this.center,p,i,c),this.expansionBom.forceVisibleHighLight(this.manualHighLight)):this.removeExpansionBom();let m=1002,g=!1;if(!this.maskShape){let y=this.resetHighLightState;this.maskShape=new AE(m,y),g=!0}(g||r||h||d)&&this.maskShape.visible(m,this.center,this.radius+this.getMaxExpansion(),ee.of6(ee.BLACK,1e-6),l)}getMaxExpansion(){return Math.max(0,this.topExpansion,this.bottomExpansion)}maskVisible(e,r=!1){if(!this.maskShape)return;let i=this.highlightColor||ee.BLACK;if(this.isWebglEnv()){if(!e){this.mask&&(this.mask.remove(),delete this.mask);return}this.mask||(this.mask=new ya(1002)),this.mask.visible(1002,this.center,Math.max(this.radius,this.holeRadius)+Math.max(this.topExpansion,this.bottomExpansion,0),i,this.viewGroupId);return}this.mainMaskHighLightColor(this.maskShape,r,e?this.highLightType:null,i)}removeLastMaskShape(e){e&&e.remove()}componentMaskVisible(e){if(e=e&&this.highlightByComponent,!e){this.maskByComponent&&(this.maskByComponent.remove(),delete this.maskByComponent);return}let r=this.highlightColor||ee.BLACK;this.maskByComponent||(this.maskByComponent=new ya(1002)),this.maskByComponent.visible(1002,this.center,this.radius+Math.max(this.topExpansion,this.bottomExpansion,0),r,this.viewGroupId)}visible(e){this.refreshShapeViews(!1,e)}highlight(){this.refreshShapeViews(!0)}createNetAndLayerPairView(){if(!this.shapeModified&&!this.netModified){if(this.showNet&&this.net){if(this.netView!=null&&this.layerPair!=null){this.manualHighLightModified&&(this.netView.forceVisibleHighLight(this.manualHighLight),this.layerPair.forceVisibleHighLight(this.manualHighLight));return}}else if(this.netView==null&&this.layerPair!=null){this.manualHighLightModified&&this.layerPair.forceVisibleHighLight(this.manualHighLight);return}}let e=47,r=this.showNet?this.net:"",i=this.layerPairStr;if(r?this.netView||(this.netView=new jl(e)):this.removeNetView(),i?this.layerPair||(this.layerPair=new jl(e)):this.removeLayerPairView(),!this.netView&&!this.layerPair)return;let n=this.wireViewGroupId,s=this.center,a=0,l=this.radius*2,c=this.holeRadius*2,h=this.getFontPosition(r,i),u=s,d=s;if(h==1){let p=c*.25;u=new S(s.x,s.y-p),d=new S(s.x,s.y+p),c*=.5}this.netView&&this.netView.visible(e,r,u,a,Wc,zc,l,c,void 0,n),this.layerPair&&this.layerPair.visible(e,i,d,a,Wc,zc,l,c,void 0,n)}getFontPosition(e,r){return e!=""&&r!=""?1:e!=""&&r==""?2:e==""&&r!=""?2:3}refreshShapeViews(e,r){this.maskVisible(!1,!0),this.mainVisible(r),this.maskVisible(e,this.forceUpdateMask),this.componentMaskVisible(!0)}modify(e,r){let{grayIndex:i}=e;switch(super.modify(e,r),this.grayIndex=i,this.createNetAndLayerPairView(),this.netView&&this.netView.forceVisibleHighLight(this.manualHighLight),this.layerPair&&this.layerPair.forceVisibleHighLight(this.manualHighLight),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}removeMaskShape(){this.maskShape&&(this.maskShape.remove(),delete this.maskShape)}remove(){this.maskVisible(!1,!0),this.componentMaskVisible(!1),this.removeLastMaskShape(this.hole),this.cushions.forEach(e=>this.removeLastMaskShape(e)),this.removeExpansionTop(),this.removeExpansionBom(),this.removeNetView(),this.removeLayerPairView(),this.removeMaskShape()}removeNetView(){this.netView&&(this.netView.remove(),delete this.netView)}removeLayerPairView(){this.layerPair&&(this.layerPair.remove(),delete this.layerPair)}removeExpansionTop(){this.expansionTop&&(this.removeLastMaskShape(this.expansionTop),delete this.expansionTop)}removeExpansionBom(){this.expansionBom&&(this.removeLastMaskShape(this.expansionBom),delete this.expansionBom)}};var qY=class extends Xo{constructor(){super(...arguments);this.lines=Array();this.arcs=Array();this.circles=Array();this.pads=Array();this.holes=Array();this.fillings=Array();this.texts=Array();this.rects=Array()}visible(){this.lines.forEach(e=>e.show()),this.arcs.forEach(e=>e.show()),this.circles.forEach(e=>e.show()),this.holes.forEach(e=>e.show()),this.pads.forEach(e=>e.show()),this.texts.forEach(e=>e.show()),this.rects.forEach(e=>e.show())}highlight(){}modify(e,r){super.modify(e,r);let{layerId:i,lines:n,arcs:s,pads:a,circles:l,holes:c,texts:h,polygons:u,rects:d,highlightColor:p=ee.BLACK}=e;this.layerId=i,this._state=r,this.lines.forEach(m=>m.remove()),this.lines.length=0,this.arcs.forEach(m=>m.remove()),this.arcs.length=0,this.pads.forEach(m=>m.remove()),this.pads.length=0,this.circles.forEach(m=>m.remove()),this.circles.length=0,this.holes.forEach(m=>m.remove()),this.holes.length=0,this.texts.forEach(m=>m.remove()),this.texts.length=0,this.rects.forEach(m=>m.remove()),this.rects.length=0,this.removeFill(),this.lines=n.map(m=>{let{layerId:g,start:y,end:b,width:P}=m,T=new Ws(g,null,!1);return this._state=="Only Main"&&T.visible(g,y,b,P,p,this.viewGroupId,void 0),T}),this.arcs=s.map(m=>{let{layerId:g,center:y,radius:b,width:P,startAngle:T,endAngle:I,sweep:C}=m,E=new fl(g,null,!1);return this._state=="Only Main"&&E.visible(g,y,b,P,T,I,C,p,this.viewGroupId),E}),this.pads=a.reduce((m,g)=>{let{layerId:y,center:b,width:P,height:T,solderExpansion:I}=g,C=new ya(y,null,!1),E=y==1?5:6,O=new ya(E,null,!1),_=y==1?7:8,R=new ya(_,null,!1);return this._state=="Only Main"&&(C.visible(y,b,P/2,p,this.viewGroupId),O.visible(E,b,P/2+I,p,this.viewGroupId),R.visible(_,b,P/2,p,this.viewGroupId)),m.push(C,O,R),m},new Array),this.circles=l.reduce((m,g)=>{let{layerId:y,center:b,strokeWidth:P,radius:T}=g,I=new fl(y,null,!1);return this._state=="Only Main"&&I.visible(y,b,T,P,0,Math.PI*2,le.CCW,p,this.viewGroupId),m.push(I),m},[]),this.holes=c.reduce((m,g)=>{let{layerId:y,center:b,radius:P}=g,T=new ya(47,null,!1),I=new fl(y,null,!1);return this._state=="Only Main"&&(T.visible(47,b,P,p,this.viewGroupId),I.visible(y,b,P,.1,0,Math.PI*2,le.CCW,p,this.viewGroupId)),m.push(T,I),m},[]),this.rects=d.reduce((m,g)=>{let{layerId:y,start:b,rotation:P,width:T,height:I,strokeWidth:C}=g,E=Math.min(g.radius,T/2,I/2),O=new Z0(y,null,!1);O.visible(47,b,T,I,P,E,p,this.viewGroupId,void 0),m.push(O);let _=b.add1(E,0),R=b.add1(T-E,0),v=b.add1(T,-E),D=b.add1(T,-I+E),w=b.add1(T-E,-I),F=b.add1(E,-I),H=b.add1(0,-I+E),z=b.add1(0,-E),G=[_,R,v,D,w,F,H,z];for(let W=0;W<G.length;W+=2){let L=G[W].rotate(b,P),B=G[W+1].rotate(b,P),N=new Ws(y,null,!1);N.visible(y,L,B,C,p,this.viewGroupId,void 0),this.lines.push(N)}if(E>0){let W=b.add1(E,-E),L=b.add1(T-E,-E),B=b.add1(T-E,-I+E),N=b.add1(E,-I+E),U=[W,L,B,N];for(let k=0;k<U.length;k++){let V=new fl(y,null,!1),Y=Math.PI-Math.PI/2*k+P,X=Y-Math.PI/2,Z=U[k].rotate(b,P);V.visible(y,Z,E,C,Y,X,le.CW,p,this.viewGroupId),this.arcs.push(V)}}return m},[]),this.fillings=u.reduce((m,g)=>{let{layerId:y,strokeWidth:b,outline:P}=g;if(this._state=="Only Main"){if(P instanceof Gt){let I=bn.getInstance().getLayer(47).layer.addStaticPolygon(P.items,p,this.viewGroupId);m.push([47,I])}else{let I=bn.getInstance().getLayer(47).layer.addPolygon(P,p,this.viewGroupId);m.push([47,I])}(P instanceof Gt?P.items:[P]).forEach(I=>{I.primitives.forEach(C=>{if(C instanceof q){let E=new fl(y,null,!1);this._state=="Only Main"&&E.visible(y,C.center,C.rx,b,Ht.toRadians(C.startAngle),Ht.toRadians(C.endAngle()),C.sweep(),p,this.viewGroupId),this.arcs.push(E)}else if(C instanceof M){let E=new Ws(y,null,!1);this._state=="Only Main"&&E.visible(y,C.start(),C.end(),b,p,this.viewGroupId),this.lines.push(E)}})})}return m},[]),this.texts=h.map(m=>{let{layerId:g,width:y,height:b,strokeWidth:P,matrix:T,path:I,box:C}=m,E=new cT(!1);return this._state=="Only Main"&&E.modify({partition:"",layerId:g,box:C,width:y,height:b,strokeWidth:P,matrix:T,path:I,highLightType:this.highLightType,highlightColor:p,layerModified:!1,shapeModified:!0,outlineModified:!0},r),E})}hidden(){this.lines.forEach(e=>e.hidden()),this.arcs.forEach(e=>e.hidden()),this.circles.forEach(e=>e.hidden()),this.holes.forEach(e=>e.hidden()),this.pads.forEach(e=>e.hidden()),this.texts.forEach(e=>e.hidden()),this.rects.forEach(e=>e.hidden()),this.removeFill()}remove(){this.lines.forEach(e=>{e!=null&&e.remove()}),this.arcs.forEach(e=>{e!=null&&e.remove()}),this.pads.forEach(e=>{e!=null&&e.remove()}),this.circles.forEach(e=>{e!=null&&e.remove()}),this.holes.forEach(e=>{e!=null&&e.remove()}),this.texts.forEach(e=>{e!=null&&e.remove()}),this.rects.forEach(e=>{e!=null&&e.remove()}),this.removeFill()}removeFill(){for(let e of this.fillings)bn.getInstance().getLayer(e[0]).layer.plane.removePolygonPt(e[1]);this.fillings.length=0}};var $Y=class extends Xo{constructor(){super(...arguments);this.lines=new Array(0)}get layerId(){return this._layerId}set layerId(e){this._layerId=e}get segments(){var e;return(e=this._viewDataModel)==null?void 0:e.segments}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}get isSolid(){var e;return(e=this._viewDataModel)==null?void 0:e.isSolid}get gap(){return this._viewDataModel.gap}get len(){return this._viewDataModel.len}createLine(e,r,i){let n=r[e];return n==null&&(n=new Yc(i),r.push(n)),n}shapesVisible(e,r=this.color,i=this.layerId){let n=this.segments.length;if(n<e.length){let s=e.splice(n,e.length-n);for(let a of s)a.remove();s.length=0}for(let s=0;s<n;s++){let a=this.createLine(s,e,i),l=this.segments[s],c=this.gap||2,h=this.len||3;this.isSolid?a.visible(i,l[0],l[1],!0,0,0,r,this.viewGroupId):a.visible(i,l[0],l[1],!1,h,c,r,this.viewGroupId),a.forceVisibleHighLight(this.manualHighLight)}}mainVisible(){this.shapesVisible(this.lines)}maskVisible(e,r=!1){let i=this.highlightColor||this.color;if(this.isWebglEnv()){if(!e){this._mask&&(this._mask.forEach(n=>n.remove()),delete this._mask);return}this._mask||(this._mask=[]),this.shapesVisible(this._mask,i,1002);return}this.mainsMaskHighLightColor(this.lines,r,e?this.highLightType:null,i)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask)}modify(e,r){let i=this.layerId;super.modify(e,r);let{layerId:n}=e;switch(this.layerId=n,n!=i&&this.mainRemove(),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){if(this.maskVisible(!1,!0),this.lines.length>0){for(let e of this.lines)e.remove();this.lines.length=0}}remove(){this.mainRemove()}};var KY=class extends Cu{get plane(){return this.layer.plane}visible(t,e,r,i,n,s){this.layerId!=t&&this.remove(),this.layerId=t,!Sa.unRefreshScene&&(this.id=this.plane.createOrUpdatePoint(this.id,e,r,i,n,void 0,s))}};var ZY=class extends Xo{constructor(){super(...arguments);this.main=new KY(1002,this.resetHighLightState)}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get position(){var e;return(e=this._viewDataModel)==null?void 0:e.position}get isTriangle(){var e;return(e=this._viewDataModel)==null?void 0:e.isTriangle}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}get colorModified(){var e;return(e=this._viewDataModel)==null?void 0:e.colorModified}mainVisible(){(this.shapeModified||this.colorModified)&&(this.main.visible(1002,this.position,16,this.isTriangle,this.color,this.viewGroupId),this.main.forceVisibleHighLight(this.manualHighLight))}maskVisible(e,r=!1){if(this.main){if(this.isWebglEnv()){if(!e){this._mask&&(this._mask.remove(),delete this._mask);return}this._mask||(this._mask=new KY(1002));let i=this.highlightColor||this.color;this._mask.visible(1002,this.position,16,this.isTriangle,i,null);return}this.mainMaskHighLightColor(this.main,r,e?this.highLightType:null)}}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0)}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){var e;this.maskVisible(!1,!0),(e=this.main)==null||e.remove()}remove(){this.mainRemove()}};var JY=class extends Xo{constructor(){super(...arguments);this.main=null}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get fonts(){var e;return(e=this._viewDataModel)==null?void 0:e.fonts}get position(){var e;return(e=this._viewDataModel)==null?void 0:e.position}get angle(){var e;return(e=this._viewDataModel)==null?void 0:e.angle}get limitMin(){var e;return(e=this._viewDataModel)==null?void 0:e.limitMin}get limitMax(){var e;return(e=this._viewDataModel)==null?void 0:e.limitMax}get fontWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.fontWidth}get fontHeight(){var e;return(e=this._viewDataModel)==null?void 0:e.fontHeight}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}mainVisible(){let e=this.layerId;this.main||(this.main=new jl(e)),this.main.visible(e,this.fonts,this.position,this.angle,this.limitMin,this.limitMax,this.fontWidth,this.fontHeight,this.color,this.viewGroupId)}visible(){this.mainVisible()}highlight(){this.mainVisible()}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.main.remove()}};var QY=class extends Xo{get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get center(){var t;return(t=this._viewDataModel)==null?void 0:t.center}get radius(){var t;return(t=this._viewDataModel)==null?void 0:t.radius}get startAngle(){var t;return(t=this._viewDataModel)==null?void 0:t.startAngle}get endAngle(){var t;return(t=this._viewDataModel)==null?void 0:t.endAngle}get sweep(){var t;return(t=this._viewDataModel)==null?void 0:t.sweep}get width(){var t;return(t=this._viewDataModel)==null?void 0:t.width}get color(){var t;return(t=this._viewDataModel)==null?void 0:t.color}mainVisible(){let t=this.layerId,e=!1;if(this.main)this.layerModified&&(this.remove(),e=!0);else{let i=this.resetHighLightState;this.main=new OE(t,i),e=!0}let r=this.color;e||(e=this.shapeModified||this.viewGroupIdModified||!r.equals(this._lastLineColor)),e&&(this.main.visible(this.layerId,this.center,this.radius,this.startAngle,this.endAngle,this.sweep,this.color,this.viewGroupId),this._lastLineColor=r),this.main.forceVisibleHighLight(this.manualHighLight)}maskVisible(t,e=!1){if(this.main){if(this.isWebglEnv()){if(t){let r=this.highlightColor||this.color;this.mask||(this.mask=new Ly(1002)),this.mask.visible(this.layerId,this.center,this.radius,this.startAngle,this.endAngle,this.sweep,r,null)}else this.mask&&(this.mask.remove(),delete this.mask);return}this.mainMaskHighLightColor(this.main,e,t?this.highLightType:null)}}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0)}modify(t,e){switch(super.modify(t,e),e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){var t;this.maskVisible(!1,!0),(t=this.main)==null||t.remove()}};var are=class extends Xo{constructor(){super(...arguments);this.shape=null}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get center(){var e;return(e=this._viewDataModel)==null?void 0:e.center}get radius(){var e;return(e=this._viewDataModel)==null?void 0:e.radius}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}mainVisible(){let e=!1;this.shape?this.layerModified&&(this.shape.remove(),e=!0):(this.shape=new ya(this.layerId),e=!0);let r=this.color;e||(e=this.layerModified||this.shapeModified||this.viewGroupIdModified||!r.equals(this._lastColor)),e&&(this.shape.visible(this.layerId,this.center,this.radius,r,this.viewGroupId),this._lastColor=r),this.shape.forceVisibleHighLight(this.manualHighLight)}visible(){this.mainVisible()}highlight(){this.mainVisible()}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){var e;(e=this.shape)==null||e.remove()}};var Ou=class{};var so=class extends Ou{constructor(){super(...arguments);this.groupId=void 0;this.groupName=null;this.number=-1}hasConnectChange(){return!1}getConnnectChangeCommand(){return[]}getAction(){return this.action}isDelete(e=!1){let r=!1;return(e&&this.action=="add"||!e&&this.action=="delete")&&(r=!0),r}updateFilterStatus(e){e.updateFilterVisible=!0,e.visible()}deleteGroupID(e){if(this.groupId=e.getGroupID(),this.groupName=this.groupId==null?null:kt.getGroupNameByGroupId(this.groupId),this.groupId!=null&&this.action=="delete"){let r=kt.getItem(this.groupId);r!=null&&r.deleteItem(e)}}addGroupID(e){if(this.groupId!=null){let r=kt.getItem(this.groupId);r==null?r=kt.rebuild(this.groupId,[e],this.groupName):r.addItem(e)}}modifyGroupID(e){let r=e.getGroupID();this.groupId!=r&&(r&&kt.getItem(r)&&kt.removeFromCombination([e],r),this.addGroupID(e)),this.groupId=r}undo(){let e=this.getItem();this.action==="add"?(e!=null||e=="ignore")&&this.remove():this.action==="modify"?(e!=null||e=="ignore")&&this.modify():this.action==="delete"&&(e==null||e=="ignore")&&this.rebuild()}redo(){let e=this.getItem();this.action==="add"?(e==null||e=="ignore")&&this.rebuild():this.action==="modify"?(e!=null||e=="ignore")&&this.modify():this.action==="delete"&&(e!=null||e=="ignore")&&this.remove()}};var mT=class extends so{constructor(t,e){super(),this.gId=t.globalIndex,this.data=e=="add"?void 0:t.toJSON(),this.action=e,this.deleteGroupID(t)}rebuild(){let{globalIndex:t,partition:e,layerId:r,start:i,end:n,height:s,width:a,locked:l,leftPoint:c,rightPoint:h,leftSpotSize:u,rightSpotSize:d,silkColor:p}=this.data,m=p?ee.of3(p):null,g=new S(i.x,i.y),y=new S(n.x,n.y),b=new S(c.x,c.y),P=new S(h.x,h.y),T=wh.rebuild(t,r,g,y,b,P,s,a,l,u,d);return T.updateText(),T.partition=e,A.publish("hasModifyPcbItem",T),this.addGroupID(T),T.silkColor=m,this.updateFilterStatus(T),this.data=void 0,T}getItem(){return"ignore"}remove(){let t=wh.getItem(this.gId);this.data=t.toJSON(),t.remove(),A.publish("delete",t),A.publish("hasModifyPcbItem",t)}modify(){let{globalIndex:t,layerId:e,start:r,end:i,height:n,width:s,unit:a,locked:l,leftPoint:c,rightPoint:h,silkColor:u}=this.data,d=u?ee.of3(u):null,p=new S(r.x,r.y),m=new S(i.x,i.y),g=new S(c.x,c.y),y=new S(h.x,h.y),b=wh.getItem(this.gId),P=b.toJSON();b.globalIndex!=t,!b.left.equals(g)&&!b.right.equals(y)&&!b.start.equals(p)&&!b.end.equals(m)?(b.left=g,b.right=y,b.modifyDimension(p,m)):(b.start.equals(p)||(b.start=p,b.updateText()),b.end.equals(m)||(b.end=m,b.updateText()),b.left.equals(g)||(b.left=g),b.right.equals(y)||(b.right=y)),b.height!=n&&(b.height=n),b.unit!=x.getInstance().unit&&(b.unit=x.getInstance().unit,b.precision=x.getInstance().unit=="mil"?1:3),b.locked!=l&&(b.locked=l),d||(b.silkColor=void 0),d&&b.silkColor!=d&&!b.silkColor.equals(d)&&(b.silkColor=d),b.updateText(),this.modifyGroupID(b),this.data=P,A.publish("hasModifyPcbItem",b)}upload(t){}updateData(){}};var GE=class extends ki{constructor(){super();this.injectedBBoxes=[];this._bbox=new ut(0,0,0,0)}injectedBBox(e){this.injectedBBoxes.push(...e)}get bbox(){if(!this.injectedBBoxes||!this.injectedBBoxes.length)return this._bbox||new ut(0,0,0,0);let e=new _e;for(let r of this.injectedBBoxes)e.ext1(r);return e.build()}clearInjectedBBox(){this.injectedBBoxes=[]}};function Yx(o,t=10,e=30,r=null){let i=Ni().getScale();if(!(ce.pcbConfig.drcErrorZoom==="keepConstantSize"))return o;let s=o.height()*i,a=o.width()*i;if(t>0&&(s<t||a<t))return null;let c=Math.min(Math.max(s,t),e)/s,h=o.width()*c,u=o.height()*c,d=o.center(),p=r?r.sub(d).mul(1-c):new S(0,0),m=d.add(p);return new ut(m.x-h/2,m.x+h/2,m.y-u/2,m.y+u/2)}var $9t=3.937,K9t=3.937,Z9t=28,J9t=28,ej=class extends GE{constructor(e,r,i,n,s,a=new Array,l=ee.of3("#FFCC00"),c=1001){super();this.modelType="DRCResult";this.globalIndex=e,this._name=r,this._layerId=c,this._referenceLayerIds=a,this._position=i,this._errType=n,this._color=l,this._locked=!1,this._rectWidth=s==="followObjectScaling"?$9t:Z9t,this._rectHeight=s==="followObjectScaling"?K9t:J9t}get name(){return this._name}set name(e){this._name!==e&&(this._name=e)}get locked(){return this._locked}set locked(e){this._locked!==e&&(this._locked=e)}get layerId(){return this._layerId}set layerId(e){this._layerId!==e&&(this._layerId=e,this.layerModified=!0)}get referenceLayerIds(){return this._referenceLayerIds}set referenceLayerIds(e){this._referenceLayerIds=e}get position(){return this._position}set position(e){(this._position.x!==e.x||this._position.y!==e.y)&&(this._position=e)}get errType(){return this._errType}set errType(e){this._errType!==e&&(this._errType=e)}get color(){return this._color}set color(e){(this._color.r!==e.r||this._color.g!==e.g||this._color.b!==e.b||this._color.alpha!==e.alpha)&&(this._color=e)}get rectWidth(){return this._rectWidth}get rectHeight(){return this._rectHeight}loadViewGroupId(){this.referenceLayerIds&&this.layerId==1001&&(this._viewGroupId=Au.generateViewGroupId(this))}get viewGroupId(){return this._viewGroupId}inShape(e,r){if(ce.pcbConfig.drcErrorZoom==="followObjectScaling")return this.bbox.isContains(new S(e,r));{let i=Yx(this.bbox);return i?i.isContains(new S(e,r)):!1}}updateBox(){return this.bbox}transform(e){}clone(){return null}};var zM=class zM extends wi{static getInstance(){return zM.instance==null&&(zM.instance=new zM),zM.instance}updateCache(t){this.map.set(t.globalIndex,t)}addItem(t,e,r,i,n,s,a=ee.of3("#FFCC00"),l=1001){let c=new ej(t,e,r,i,n,s,a,l);return this.updateCache(c),c}deleteItem(t){t instanceof ej&&this.map.delete(t.globalIndex)}};zM.instance=null;var ZB=zM;var Fy=class Fy{static getStringPath(t){let e,r,i,n;if(!t)return"";var s="",a="";if(typeof t=="object"&&(s=t.text,!s))return"";t&&(i=+t.fontSize,n=+t.fontWidth,e=t.x,r=t.y),Fy.setFontHeight(i),i=Fy.getFontHeight();let l,c=e;for(let h=0,u=s.length;h<u;h++){if(s[h]==" "){e+=Fy.getSapceWidth();continue}if(s[h]==`
`){e=c,r+=Math.max(+i+n,+i);continue}l=Fy.getCharInfo(s[h],e,r),a+=l[0],e+=l[1]+n+i*.15}return a}static setFontHeight(t){Fy.height=+t}static getFontHeight(){return Fy.height||4.5}static getCharInfo(t,e,r){function i(u,d,p,m,g){let y="",b=u.length;for(let P=0;P<b;P++){let T=u[P].split(" "),I=0,C=T.length;for(;I<C;I+=2)T[I]=on(p+d*+T[I],2),T[I+1]=on(m+d*(+T[I+1]-16),2);let E="M "+T[0]+" "+T[1];for(I=2;I<C;I++)I%2===0&&(E+="L"),E+=T[I]+" ";y+=E}return y}if(Fy.fontPath[t]){var n=Fy.fontPath[t].path,s=Fy.getPathBBox(n),a=Math.abs(s.R-s.L),l=Math.abs(s.T-s.B);l===0&&(l=1);var c=Fy.getFontHeight()/32;a=a*c;var h=i(n,c,e,r,l);return[h,a]}else return["",0]}static getPathBBox(t){for(var e=t.length,r={L:9999,T:-9999,R:-9999,B:9999},i,n,s=0;s<e;s++){for(var a=t[s].split(" "),l=0,c=a.length;l<c;l+=2)i=+a[l],n=+a[l+1],r.L>i&&(r.L=i),r.T<n&&(r.T=n),r.R<i&&(r.R=i),r.B>n&&(r.B=n);a=null}return r}static getSapceWidth(){return Fy.height*.7}static everyCharHasDefaultFontPath(t){let e=t.toString().replace(/\s/g,"").split("");for(let r of e)if(Fy.fontPath[r]==null)return!1;return!0}};Fy._fontsCache={},Fy.fontPath={"!":{path:["1 -12 1 2","1 7 0 8 1 9 2 8 1 7"]},'"':{path:["0 -12 0 -5","8 -12 8 -5"]},"#":{path:["8 -16 1 16","14 -16 7 16","1 -3 15 -3","0 3 14 3"]},$:{path:["7 -16 7 13","14 -9 12 -11 9 -12 5 -12 2 -11 0 -9 0 -7 1 -5 2 -4 4 -3 10 -1 12 0 13 1 14 3 14 6 12 8 9 9 5 9 2 8 0 6"]},"%":{path:["18 -12 0 9","5 -12 7 -10 7 -8 6 -6 4 -5 2 -5 0 -7 0 -9 1 -11 3 -12 5 -12 7 -11 10 -10 13 -10 16 -11 18 -12","14 2 12 3 11 5 11 7 13 9 15 9 17 8 18 6 18 4 16 2 14 2"]},"&":{path:["20 -3 20 -4 19 -5 18 -5 17 -4 16 -2 14 3 12 6 10 8 8 9 4 9 2 8 1 7 0 5 0 3 1 1 2 0 9 -4 10 -5 11 -7 11 -9 10 -11 8 -12 6 -11 5 -9 5 -7 6 -4 8 -1 13 6 15 8 17 9 19 9 20 8 20 7"]},"'":{path:["2 -15 2 -9"]},"`":{path:["2 -15 4 -9"]},"(":{path:["7 -16 5 -14 3 -11 1 -7 0 -2 0 2 1 7 3 11 5 14 7 16"]},")":{path:["0 -16 2 -14 4 -11 6 -7 7 -2 7 2 6 7 4 11 2 14 0 16"]},"*":{path:["5 -6 5 6","0 -3 10 3","10 -3 0 3"]},"+":{path:["9 -9 9 9","0 0 18 0"]},",":{path:["2 5 1 6 0 5 1 4 2 5 2 7 0 9"]},"-":{path:["0 0 18 0"]},".":{path:["1 4 0 5 1 6 2 5 1 4"]},"/":{path:["18 -16 0 16"]},0:{path:["6 -12 3 -11 1 -8 0 -3 0 0 1 5 3 8 6 9 8 9 11 8 13 5 14 0 14 -3 13 -8 11 -11 8 -12 6 -12"]},1:{path:["0 -8 2 -9 5 -12 5 9"]},2:{path:["1 -7 1 -8 2 -10 3 -11 5 -12 9 -12 11 -11 12 -10 13 -8 13 -6 12 -4 10 -1 0 9 14 9"]},3:{path:["2 -12 13 -12 7 -4 10 -4 12 -3 13 -2 14 1 14 3 13 6 11 8 8 9 5 9 2 8 1 7 0 5"]},4:{path:["10 -12 0 2 15 2","10 -12 10 9"]},5:{path:["12 -12 2 -12 1 -3 2 -4 5 -5 8 -5 11 -4 13 -2 14 1 14 3 13 6 11 8 8 9 5 9 2 8 1 7 0 5"]},6:{path:["12 -9 11 -11 8 -12 6 -12 3 -11 1 -8 0 -3 0 2 1 6 3 8 6 9 7 9 10 8 12 6 13 3 13 2 12 -1 10 -3 7 -4 6 -4 3 -3 1 -1 0 2"]},7:{path:["14 -12 4 9","0 -12 14 -12"]},8:{path:["5 -12 2 -11 1 -9 1 -7 2 -5 4 -4 8 -3 11 -2 13 0 14 2 14 5 13 7 12 8 9 9 5 9 2 8 1 7 0 5 0 2 1 0 3 -2 6 -3 10 -4 12 -5 13 -7 13 -9 12 -11 9 -12 5 -12"]},9:{path:["13 -5 12 -2 10 0 7 1 6 1 3 0 1 -2 0 -5 0 -6 1 -9 3 -11 6 -12 7 -12 10 -11 12 -9 13 -5 13 0 12 5 10 8 7 9 5 9 2 8 1 6"]},":":{path:["1 -3 0 -2 1 -1 2 -2 1 -3","1 4 0 5 1 6 2 5 1 4"]},";":{path:["1 -3 0 -2 1 -1 2 -2 1 -3","2 5 1 6 0 5 1 4 2 5 2 7 0 9"]},"<":{path:["16 -9 0 0 16 9"]},"=":{path:["0 -3 18 -3","0 3 18 3"]},">":{path:["0 -9 16 0 0 9"]},"?":{path:["0 -7 0 -8 1 -10 2 -11 4 -12 8 -12 10 -11 11 -10 12 -8 12 -6 11 -4 10 -3 6 -1 6 2","6 7 5 8 6 9 7 8 6 7"]},"@":{path:["15 -4 14 -6 12 -7 9 -7 7 -6 6 -5 5 -2 5 1 6 3 8 4 11 4 13 3 14 1","9 -7 7 -5 6 -2 6 1 7 3 8 4","15 -7 14 1 14 3 16 4 18 4 20 2 21 -1 21 -3 20 -6 19 -8 17 -10 15 -11 12 -12 9 -12 6 -11 4 -10 2 -8 1 -6 0 -3 0 0 1 3 2 5 4 7 6 8 9 9 12 9 15 8 17 7 18 6","16 -7 15 1 15 3 16 4"]},A:{path:["8 -12 0 9","8 -12 16 9","3 2 13 2"]},B:{path:["0 -12 0 9","0 -12 9 -12 12 -11 13 -10 14 -8 14 -6 13 -4 12 -3 9 -2","0 -2 9 -2 12 -1 13 0 14 2 14 5 13 7 12 8 9 9 0 9"]},C:{path:["15 -7 14 -9 12 -11 10 -12 6 -12 4 -11 2 -9 1 -7 0 -4 0 1 1 4 2 6 4 8 6 9 10 9 12 8 14 6 15 4"]},D:{path:["0 -12 0 9","0 -12 7 -12 10 -11 12 -9 13 -7 14 -4 14 1 13 4 12 6 10 8 7 9 0 9"]},E:{path:["0 -12 0 9","0 -12 13 -12","0 -2 8 -2","0 9 13 9"]},F:{path:["0 -12 0 9","0 -12 13 -12","0 -2 8 -2"]},G:{path:["15 -7 14 -9 12 -11 10 -12 6 -12 4 -11 2 -9 1 -7 0 -4 0 1 1 4 2 6 4 8 6 9 10 9 12 8 14 6 15 4 15 1","10 1 15 1"]},H:{path:["0 -12 0 9","14 -12 14 9","0 -2 14 -2"]},I:{path:["0 -12 0 9"]},J:{path:["10 -12 10 4 9 7 8 8 6 9 4 9 2 8 1 7 0 4 0 2"]},K:{path:["0 -12 0 9","14 -12 0 2","5 -3 14 9"]},L:{path:["0 -12 0 9","0 9 12 9"]},M:{path:["0 -12 0 9","0 -12 8 9","16 -12 8 9","16 -12 16 9"]},N:{path:["0 -12 0 9","0 -12 14 9","14 -12 14 9"]},O:{path:["6 -12 4 -11 2 -9 1 -7 0 -4 0 1 1 4 2 6 4 8 6 9 10 9 12 8 14 6 15 4 16 1 16 -4 15 -7 14 -9 12 -11 10 -12 6 -12"]},P:{path:["0 -12 0 9","0 -12 9 -12 12 -11 13 -10 14 -8 14 -5 13 -3 12 -2 9 -1 0 -1"]},Q:{path:["6 -12 4 -11 2 -9 1 -7 0 -4 0 1 1 4 2 6 4 8 6 9 10 9 12 8 14 6 15 4 16 1 16 -4 15 -7 14 -9 12 -11 10 -12 6 -12","9 5 15 11"]},R:{path:["0 -12 0 9","0 -12 9 -12 12 -11 13 -10 14 -8 14 -6 13 -4 12 -3 9 -2 0 -2","7 -2 14 9"]},S:{path:["14 -9 12 -11 9 -12 5 -12 2 -11 0 -9 0 -7 1 -5 2 -4 4 -3 10 -1 12 0 13 1 14 3 14 6 12 8 9 9 5 9 2 8 0 6"]},T:{path:["7 -12 7 9","0 -12 14 -12"]},U:{path:["0 -12 0 3 1 6 3 8 6 9 8 9 11 8 13 6 14 3 14 -12"]},V:{path:["0 -12 8 9","16 -12 8 9"]},W:{path:["0 -12 5 9","10 -12 5 9","10 -12 15 9","20 -12 15 9"]},X:{path:["0 -12 14 9","14 -12 0 9"]},Y:{path:["0 -12 8 -2 8 9","16 -12 8 -2"]},Z:{path:["14 -12 0 9","0 -12 14 -12","0 9 14 9"]},"[":{path:["0 -16 0 16","1 -16 1 16","0 -16 7 -16","0 16 7 16"]},"\\":{path:["0 -12 14 12"]},"]":{path:["6 -16 6 16","7 -16 7 16","0 -16 7 -16","0 16 7 16"]},"^":{path:["8 -14 0 0","8 -14 16 0"]},_:{path:["0 16 18 16"]},a:{path:["12 -5 12 9","12 -2 10 -4 8 -5 5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6"]},b:{path:["0 -12 0 9","0 -2 2 -4 4 -5 7 -5 9 -4 11 -2 12 1 12 3 11 6 9 8 7 9 4 9 2 8 0 6"]},c:{path:["12 -2 10 -4 8 -5 5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6"]},d:{path:["12 -12 12 9","12 -2 10 -4 8 -5 5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6"]},e:{path:["0 1 12 1 12 -1 11 -3 10 -4 8 -5 5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6"]},f:{path:["8 -12 6 -12 4 -11 3 -8 3 9","0 -5 7 -5"]},g:{path:["12 -5 12 11 11 14 10 15 8 16 5 16 3 15","12 -2 10 -4 8 -5 5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6"]},h:{path:["0 -12 0 9","0 -1 3 -4 5 -5 8 -5 10 -4 11 -1 11 9"]},i:{path:["0 -12 1 -11 2 -12 1 -13 0 -12","1 -5 1 9"]},j:{path:["4 -12 5 -11 6 -12 5 -13 4 -12","5 -5 5 12 4 15 2 16 0 16"]},k:{path:["0 -12 0 9","10 -5 0 5","4 1 11 9"]},l:{path:["0 -12 0 9"]},m:{path:["0 -5 0 9","0 -1 3 -4 5 -5 8 -5 10 -4 11 -1 11 9","11 -1 14 -4 16 -5 19 -5 21 -4 22 -1 22 9"]},n:{path:["0 -5 0 9","0 -1 3 -4 5 -5 8 -5 10 -4 11 -1 11 9"]},o:{path:["5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6 13 3 13 1 12 -2 10 -4 8 -5 5 -5"]},p:{path:["0 -5 0 16","0 -2 2 -4 4 -5 7 -5 9 -4 11 -2 12 1 12 3 11 6 9 8 7 9 4 9 2 8 0 6"]},q:{path:["12 -5 12 16","12 -2 10 -4 8 -5 5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6"]},r:{path:["0 -5 0 9","0 1 1 -2 3 -4 5 -5 8 -5"]},s:{path:["11 -2 10 -4 7 -5 4 -5 1 -4 0 -2 1 0 3 1 8 2 10 3 11 5 11 6 10 8 7 9 4 9 1 8 0 6"]},t:{path:["3 -12 3 5 4 8 6 9 8 9","0 -5 7 -5"]},u:{path:["0 -5 0 5 1 8 3 9 6 9 8 8 11 5","11 -5 11 9"]},v:{path:["0 -5 6 9","12 -5 6 9"]},w:{path:["0 -5 4 9","8 -5 4 9","8 -5 12 9","16 -5 12 9"]},x:{path:["0 -5 11 9","11 -5 0 9"]},y:{path:["1 -5 7 9","13 -5 7 9 5 13 3 15 1 16 0 16"]},z:{path:["11 -5 0 9","0 -5 11 -5","0 9 11 9"]},"{":{path:["5 -16 3 -15 2 -14 1 -12 1 -10 2 -8 3 -7 4 -5 4 -3 2 -1","3 -15 2 -13 2 -11 3 -9 4 -8 5 -6 5 -4 4 -2 0 0 4 2 5 4 5 6 4 8 3 9 2 11 2 13 3 15","2 1 4 3 4 5 3 7 2 8 1 10 1 12 2 14 3 15 5 16"]},"|":{path:["0 -16 0 16"]},"}":{path:["0 -16 2 -15 3 -14 4 -12 4 -10 3 -8 2 -7 1 -5 1 -3 3 -1","2 -15 3 -13 3 -11 2 -9 1 -8 0 -6 0 -4 1 -2 5 0 1 2 0 4 0 6 1 8 2 9 3 11 3 13 2 15","3 1 1 3 1 5 2 7 3 8 4 10 4 12 3 14 2 15 0 16"]},"~":{path:["0 3 0 1 1 -2 3 -3 5 -3 7 -2 11 1 13 2 15 2 17 1 18 -1","0 1 1 -1 3 -2 5 -2 7 -1 11 2 13 3 15 3 17 2 18 -1 18 -3"]},"\xB0":{path:["3 -11 0 -8 3 -5 6 -8 3 -11"]},\u03A9:{path:["0 9 7 9 5 6 3 3 2 0 2 -3 3 -6 4 -8 6 -10 8 -11 12 -11 14 -10 16 -8 17 -6 18 -3 18 0 17 3 15 6 13 9 20 9"]},\u03BC:{path:["0 14 1 4 1 -6 1 4 2 7 4 8 6 8 8 7 10 4 10 -6 10 6 11 8 12 9"]}};var Vy=Fy;var YM=class YM{constructor(){this.textCache=new Map;this.numCache=new Array(20);this.boxCache=new Array(4);this.textOffsetCache=new Array(9);this.BuildLineCache=new Array(7);this.BuildTrackCache=new Array(7);this.BuildViaCache=new Array(11);this.BuildBoxCache=new Array(10);this.BuildArcCache=new Array(10);this.BuildArcTrackCache=new Array(10);this.BuildTextCache=new Array(7);this.BuildPadStyleCache=new Array(4);this.BuildPadCache=new Array(12);this.ARRAY1=new Array(1);this.ARRAY2=new Array(2);this.ARRAY3=new Array(3);this.ARRAY4=new Array(4);this.ARRAY5=new Array(5);this.ARRAY6=new Array(6);this.ARRAY7=new Array(7);this.ARRAY8=new Array(8);this.ARRAY9=new Array(9);this.ARRAY10=new Array(10);this.ARRAY11=new Array(11);this.ARRAY12=new Array(12);this.textOffsetCache[0]=S.ORIGIN,this.textOffsetCache[1]=new S(0,-.5),this.textOffsetCache[2]=new S(0,-1),this.textOffsetCache[3]=new S(-.5,0),this.textOffsetCache[4]=new S(-.5,-.5),this.textOffsetCache[5]=new S(-.5,-1),this.textOffsetCache[6]=new S(-1,0),this.textOffsetCache[7]=new S(-1,-.5),this.textOffsetCache[8]=new S(-1,-1)}static getCache(){return YM.instance==null&&(YM.instance=new YM),YM.instance}};YM.instance=null;var wA=YM;var gT=class gT{static setFontHeight(t){gT.height=+t}static getFontHeight(){return gT.height||4.5}static getCharInfo(t,e,r){function i(u,d,p,m,g){let y="",b=u.length;for(let P=0;P<b;P++){let T=u[P].split(" "),I=0,C=T.length;for(;I<C;I+=2)T[I]=on(p+d*+T[I],2),T[I+1]=on(m+d*(+T[I+1]-16),2);let E="M "+T[0]+" "+T[1];for(I=2;I<C;I++)I%2===0&&(E+="L"),E+=T[I]+" ";y+=E}return y}if(gT.fontPath[t]){var n=gT.fontPath[t].path,s=gT.getPathBBox(n),a=Math.abs(s.R-s.L),l=Math.abs(s.T-s.B);l===0&&(l=1);var c=gT.getFontHeight()/32;a=a*c;var h=i(n,c,e,r,l);return[h,a]}else return["",0]}static getPathBBox(t){for(var e=t.length,r={L:9999,T:-9999,R:-9999,B:9999},i,n,s=0;s<e;s++){for(var a=t[s].split(" "),l=0,c=a.length;l<c;l+=2)i=+a[l],n=+a[l+1],r.L>i&&(r.L=i),r.T<n&&(r.T=n),r.R<i&&(r.R=i),r.B>n&&(r.B=n);a=null}return r}static getSpaceWidth(t){return 31.9936876*t}static everyCharHasDefaultFontPath(t){let e=t.toString().replace(/\s/g,"").split("");for(let r of e)if(gT.fontPath[r]==null)return!1;return!0}static getSpacing(t){return gT.spacing[t]||10.66}};gT._fontsCache={},gT.fontPath={"!":{path:["0 16.001000000000005 0 10.668000000000003","0 5.335000000000004 0 -21.33"]},'"':{path:["21.332 -5.330999999999998 26.665000000000003 -10.663999999999998","26.665000000000003 -10.663999999999998 26.665000000000003 -21.33","0 -5.330999999999998 5.333 -10.663999999999998","5.333 -10.663999999999998 5.333 -21.33"]},"#":{path:["5.333 15.998000000000001 5.333 5.332000000000001","5.333 5.332000000000001 5.333 -5.334","5.333 -5.334 5.333 -16","0 -5.334 5.333 -5.334","5.333 -5.334 15.999 -5.334","15.999 -5.334 21.332 -5.334","0 5.332000000000001 5.333 5.332000000000001","5.333 5.332000000000001 15.999 5.332000000000001","15.999 5.332000000000001 21.332 5.332000000000001","15.999 15.998000000000001 15.999 5.332000000000001","15.999 5.332000000000001 15.999 -5.334","15.999 -5.334 15.999 -16"]},$:{path:["0 10.665000000000003 5.333 15.998000000000001","15.999 15.998000000000001 21.332 10.665000000000003","21.332 10.665000000000003 21.332 5.332000000000001","15.999 -0.0009999999999994458 21.332 5.332000000000001","0 -5.334 5.333 -0.0009999999999994458","0 -5.334 0 -10.667","0 -10.667 5.333 -16","15.999 -16 21.332 -10.667","5.333 15.998000000000001 10.666 15.998000000000001","10.666 15.998000000000001 15.999 15.998000000000001","5.333 -16 10.666 -16","10.666 -16 15.999 -16","5.333 -0.0009999999999994458 10.666 -0.0009999999999994458","10.666 -0.0009999999999994458 15.999 -0.0009999999999994458","10.666 15.998000000000001 10.666 -0.0009999999999994458","10.666 -0.0009999999999994458 10.666 -16"]},"%":{path:["21.332 16.001000000000005 21.332 10.668000000000003","21.332 16.001000000000005 26.665000000000003 16.001000000000005","26.665000000000003 16.001000000000005 26.665000000000003 10.668000000000003","21.332 10.668000000000003 26.665000000000003 10.668000000000003","0 10.668000000000003 26.665000000000003 -15.996999999999998","0 -15.996999999999998 0 -21.33","0 -15.996999999999998 5.333 -15.996999999999998","5.333 -15.996999999999998 5.333 -21.33","0 -21.33 5.333 -21.33"]},"&":{path:["15.999 10.665000000000003 21.332 15.998000000000001","15.999 5.332000000000001 21.332 -0.0009999999999994458","10.666 -0.0009999999999994458 15.999 5.332000000000001","15.999 10.665000000000003 15.999 5.332000000000001","15.999 10.665000000000003 10.666 15.998000000000001","10.666 15.998000000000001 5.333 15.998000000000001","5.333 15.998000000000001 0 10.665000000000003","0 10.665000000000003 0 5.332000000000001","0 5.332000000000001 5.333 -0.0009999999999994458","5.333 -16 0 -10.667","0 -10.667 0 -5.334","0 -5.334 5.333 -0.0009999999999994458","10.666 -0.0009999999999994458 15.999 -5.334","15.999 -5.334 15.999 -10.667","15.999 -10.667 10.666 -16","10.666 -16 5.333 -16","5.333 -0.0009999999999994458 10.666 -0.0009999999999994458"]},"'":{path:["0 -5.330999999999998 5.333 -10.663999999999998","5.333 -10.663999999999998 5.333 -21.33"]},"`":{path:["0 -10.66 10.666 0.006000000000000227"]},"(":{path:["0 5.332000000000001 10.666 15.998000000000001","0 5.332000000000001 0 -5.334","0 -5.334 10.666 -16"]},")":{path:["0 15.998000000000001 10.666 5.332000000000001","10.666 5.332000000000001 10.666 -5.334","0 -16 10.666 -5.334"]},"*":{path:["10.666 10.672 10.666 0.006000000000000227","10.666 0.006000000000000227 10.666 -10.66","0 0.006000000000000227 10.666 0.006000000000000227","10.666 0.006000000000000227 21.332 0.006000000000000227","0 10.672 10.666 0.006000000000000227","10.666 0.006000000000000227 21.332 -10.66","0 -10.66 10.666 0.006000000000000227","10.666 0.006000000000000227 21.332 10.672"]},"+":{path:["0 0.006000000000000227 10.666 0.006000000000000227","10.666 0.006000000000000227 21.332 0.006000000000000227","10.666 10.672 10.666 0.006000000000000227","10.666 0.006000000000000227 10.666 -10.66"]},",":{path:["0 26.669 10.666 16.003","10.666 16.003 10.666 10.67","5.333 10.67 10.666 10.67","5.333 16.003 5.333 10.67","5.333 16.003 10.666 16.003"]},"-":{path:["0 0 21.332 0"]},".":{path:["0 15.993 0 10.66","0 15.993 5.333 15.993","5.333 15.993 5.333 10.66","0 10.66 5.333 10.66"]},"/":{path:["0 15.992 21.332 -5.34"]},0:{path:["0 -10.667 5.333 -16","0 10.665000000000003 0 -10.667","0 10.665000000000003 5.333 15.998000000000001","5.333 15.998000000000001 15.999 15.998000000000001","15.999 15.998000000000001 21.332 10.665000000000003","21.332 10.665000000000003 21.332 -10.667","15.999 -16 21.332 -10.667","5.333 -16 15.999 -16"]},1:{path:["5.333 15.999166666666667 5.333 -15.998833333333332","0 -10.665833333333332 5.333 -15.998833333333332","0 15.999166666666667 5.333 15.999166666666667","5.333 15.999166666666667 10.666 15.999166666666667"]},2:{path:["0 15.998000000000001 21.332 15.998000000000001","0 15.998000000000001 21.332 -5.334","21.332 -5.334 21.332 -10.667","15.999 -16 21.332 -10.667","5.333 -16 15.999 -16","0 -10.667 5.333 -16"]},3:{path:["10.666 -0.0009999999999994458 15.999 -0.0009999999999994458","0 10.665000000000003 5.333 15.998000000000001","5.333 15.998000000000001 15.999 15.998000000000001","15.999 15.998000000000001 21.332 10.665000000000003","21.332 10.665000000000003 21.332 5.332000000000001","15.999 -0.0009999999999994458 21.332 5.332000000000001","15.999 -0.0009999999999994458 21.332 -5.334","21.332 -5.334 21.332 -10.667","15.999 -16 21.332 -10.667","5.333 -16 15.999 -16","0 -10.667 5.333 -16"]},4:{path:["0 -0.0009999999999994458 15.999 -16","0 -0.0009999999999994458 15.999 -0.0009999999999994458","15.999 -0.0009999999999994458 21.332 -0.0009999999999994458","15.999 15.998000000000001 15.999 -0.0009999999999994458","15.999 -0.0009999999999994458 15.999 -16"]},5:{path:["0 10.665000000000003 5.333 15.998000000000001","5.333 15.998000000000001 15.999 15.998000000000001","15.999 15.998000000000001 21.332 10.665000000000003","21.332 10.665000000000003 21.332 -0.0009999999999994458","15.999 -5.334 21.332 -0.0009999999999994458","10.666 -5.334 15.999 -5.334","0 -0.0009999999999994458 0 -16","0 -16 21.332 -16","0 -0.0009999999999994458 10.666 -5.334"]},6:{path:["0 -0.0009999999999994458 15.999 -0.0009999999999994458","15.999 -0.0009999999999994458 21.332 5.332000000000001","21.332 10.665000000000003 21.332 5.332000000000001","15.999 15.998000000000001 21.332 10.665000000000003","5.333 15.998000000000001 15.999 15.998000000000001","0 10.665000000000003 5.333 15.998000000000001","0 10.665000000000003 0 -0.0009999999999994458","0 -0.0009999999999994458 10.666 -10.667","21.332 -16 10.666 -10.667"]},7:{path:["0 15.998000000000001 0 10.665000000000003","0 10.665000000000003 21.332 -10.667","21.332 -10.667 21.332 -16","0 -16 21.332 -16"]},8:{path:["15.999 -0.0009999999999994458 21.332 5.332000000000001","21.332 10.665000000000003 21.332 5.332000000000001","15.999 15.998000000000001 21.332 10.665000000000003","5.333 15.998000000000001 15.999 15.998000000000001","0 10.665000000000003 5.333 15.998000000000001","0 10.665000000000003 0 5.332000000000001","0 5.332000000000001 5.333 -0.0009999999999994458","0 -10.667 5.333 -16","0 -5.334 0 -10.667","0 -5.334 5.333 -0.0009999999999994458","5.333 -0.0009999999999994458 15.999 -0.0009999999999994458","15.999 -0.0009999999999994458 21.332 -5.334","21.332 -5.334 21.332 -10.667","15.999 -16 21.332 -10.667","5.333 -16 15.999 -16"]},9:{path:["0 10.665000000000003 5.333 15.998000000000001","5.333 15.998000000000001 15.999 15.998000000000001","15.999 15.998000000000001 21.332 10.665000000000003","15.999 -16 21.332 -10.667","5.333 -16 15.999 -16","0 -10.667 5.333 -16","0 -5.334 0 -10.667","0 -5.334 5.333 -0.0009999999999994458","5.333 -0.0009999999999994458 21.332 -0.0009999999999994458","21.332 10.665000000000003 21.332 -0.0009999999999994458","21.332 -0.0009999999999994458 21.332 -10.667"]},":":{path:["0 15.992 0 10.659","0 15.992 5.333 15.992","5.333 15.992 5.333 10.659","0 10.659 5.333 10.659","0 -0.006999999999999673 0 -5.34","0 -0.006999999999999673 5.333 -0.006999999999999673","5.333 -0.006999999999999673 5.333 -5.34","0 -5.34 5.333 -5.34"]},";":{path:["0 21.325000000000003 5.333 15.992","5.333 15.992 5.333 10.659","0 10.659 5.333 10.659","0 15.992 0 10.659","0 15.992 5.333 15.992","0 -0.006999999999999673 0 -5.34","0 -0.006999999999999673 5.333 -0.006999999999999673","5.333 -0.006999999999999673 5.333 -5.34","0 -5.34 5.333 -5.34"]},"<":{path:["0 -0.0009999999999994458 15.999 15.998000000000001","0 -0.0009999999999994458 15.999 -16"]},"=":{path:["0 5.3260000000000005 21.332 5.3260000000000005","0 -5.34 21.332 -5.34"]},">":{path:["0 15.998000000000001 15.999 -0.0009999999999994458","0 -16 15.999 -0.0009999999999994458"]},"?":{path:["10.666 15.998000000000001 10.666 10.665000000000003","10.666 5.332000000000001 21.332 -5.334","21.332 -5.334 21.332 -10.667","15.999 -16 21.332 -10.667","5.333 -16 15.999 -16","0 -10.667 5.333 -16"]},"@":{path:["5.333 15.998000000000001 21.332 15.998000000000001","0 10.665000000000003 5.333 15.998000000000001","0 10.665000000000003 0 -10.667","0 -10.667 5.333 -16","5.333 -16 15.999 -16","15.999 -16 21.332 -10.667","21.332 -0.0009999999999994458 21.332 -10.667","15.999 5.332000000000001 21.332 -0.0009999999999994458","10.666 5.332000000000001 15.999 5.332000000000001","10.666 5.332000000000001 10.666 -0.0009999999999994458","10.666 -0.0009999999999994458 15.999 -0.0009999999999994458","15.999 5.332000000000001 15.999 -0.0009999999999994458"]},A:{path:["0 0 21.333333333333332 0","10.666666666666666 -16 21.333333333333332 -5.333333333333334","0 -5.333333333333334 10.666666666666666 -16","0 16 0 0","0 0 0 -5.333333333333334","21.333333333333332 16 21.333333333333332 0","21.333333333333332 0 21.333333333333332 -5.333333333333334"]},B:{path:["0 0.003010249999999104 15.977769749999998 0.003010249999999104","15.986834999999997 -15.9889795 21.32306775 -10.652746750000002","0 -15.9889795 15.986834999999997 -15.9889795","21.32306775 -5.328067750000001 21.32306775 -10.652746750000002","15.990389999999998 0.004609999999999559 21.32306775 -5.328067750000001","21.329289 10.663210999999997 21.329289 5.343508999999997","15.997499999999999 15.994999999999997 21.329289 10.663210999999997","0 15.994999999999997 15.997499999999999 15.994999999999997","0 15.994999999999997 0 0.003010249999999104","0 0.003010249999999104 0 -15.9889795","15.983279999999999 -0.002500000000001279 15.990389999999998 0.004609999999999559","15.990389999999998 0.004609999999999559 21.329289 5.343508999999997"]},C:{path:["15.997499999999999 15.994999999999997 21.33 10.662499999999998","5.3325 15.994999999999997 15.997499999999999 15.994999999999997","0 10.662499999999998 5.3325 15.994999999999997","0 10.662499999999998 0 -10.6675","0 -10.6675 5.3325 -16","5.3325 -16 15.997499999999999 -16","15.997499999999999 -16 21.33 -10.6675"]},D:{path:["0 -16 15.976218999999999 -16","0 16.003999999999998 0 -16","0 16.003999999999998 16.002 16.003999999999998","15.976218999999999 -16 21.325687599999995 -10.650531400000002","21.325687599999995 10.680312399999998 21.325687599999995 -10.650531400000002","16.002 16.003999999999998 21.325687599999995 10.680312399999998"]},E:{path:["0 -0.002500000000001279 10.665 -0.002500000000001279","0 15.994999999999997 21.33 15.994999999999997","0 -16 21.33 -16","0 15.994999999999997 0 -0.002500000000001279","0 -0.002500000000001279 0 -16"]},F:{path:["0.0015997499999999998 0.0051432499999997106 10.660022999999999 0.0051432499999997106","0 -16 21.33 -16","0 15.994999999999997 0 -16"]},G:{path:["15.997499999999999 -16 21.33 -10.6675","5.3325 -16 15.997499999999999 -16","0 -10.6675 5.3325 -16","0 10.662499999999998 0 -10.6675","0 10.662499999999998 5.3325 15.994999999999997","5.3325 15.994999999999997 15.997499999999999 15.994999999999997","15.997499999999999 15.994999999999997 21.33 10.662499999999998","21.33 10.662499999999998 21.33 -0.002500000000001279","10.665 -0.002500000000001279 21.33 -0.002500000000001279"]},H:{path:["0 -0.002500000000001279 21.33 -0.002500000000001279","0 15.994999999999997 0 -0.002500000000001279","0 -0.002500000000001279 0 -16","21.33 15.994999999999997 21.33 -0.002500000000001279","21.33 -0.002500000000001279 21.33 -16"]},I:{path:["5.3325 15.994999999999997 5.3325 -16","0 -16 5.3325 -16","5.3325 -16 10.665 -16","0 15.994999999999997 5.3325 15.994999999999997","5.3325 15.994999999999997 10.665 15.994999999999997"]},J:{path:["0 10.662499999999998 5.3325 15.994999999999997","5.3325 15.994999999999997 10.665 15.994999999999997","10.665 15.994999999999997 15.997499999999999 10.662499999999998","15.997499999999999 10.662499999999998 15.997499999999999 -16","10.665 -16 15.997499999999999 -16","15.997499999999999 -16 21.33 -16"]},K:{path:["5.3325 -0.002500000000001279 21.33 15.994999999999997","0 15.994999999999997 0 5.329999999999998","0 5.329999999999998 0 -16","0 5.329999999999998 5.3325 -0.002500000000001279","5.3325 -0.002500000000001279 21.33 -16"]},L:{path:["0 15.994999999999997 21.33 15.994999999999997","0 15.994999999999997 0 -16"]},M:{path:["21.33 15.994999999999997 21.33 -16","10.665 -5.335000000000001 21.33 -16","0 -16 10.665 -5.335000000000001","0 15.994999999999997 0 -16"]},N:{path:["21.33 15.994999999999997 21.33 -16","0 -16 21.33 15.994999999999997","0 15.994999999999997 0 -16"]},O:{path:["0 -10.6675 5.3325 -16","0 10.662499999999998 0 -10.6675","0 10.662499999999998 5.3325 15.994999999999997","5.3325 15.994999999999997 15.997499999999999 15.994999999999997","15.997499999999999 15.994999999999997 21.33 10.662499999999998","21.33 10.662499999999998 21.33 -10.6675","15.997499999999999 -16 21.33 -10.6675","5.3325 -16 15.997499999999999 -16"]},P:{path:["0 5.329999999999998 15.997499999999999 5.329999999999998","15.997499999999999 5.329999999999998 21.33 -0.002500000000001279","21.33 -0.002500000000001279 21.33 -10.6675","15.997499999999999 -16 21.33 -10.6675","0 -16 15.997499999999999 -16","0 15.994999999999997 0 5.329999999999998","0 5.329999999999998 0 -16"]},Q:{path:["0 -10.6675 5.3325 -16","0 10.662499999999998 0 -10.6675","0 10.662499999999998 5.3325 15.994999999999997","5.3325 15.994999999999997 15.997499999999999 15.994999999999997","21.33 10.662499999999998 21.33 -10.6675","15.997499999999999 -16 21.33 -10.6675","5.3325 -16 15.997499999999999 -16","15.997499999999999 15.994999999999997 18.663749999999997 13.32875","18.663749999999997 13.32875 21.33 10.662499999999998","10.665 5.329999999999998 18.663749999999997 13.32875","18.663749999999997 13.32875 21.33 15.994999999999997"]},R:{path:["10.665 5.329999999999998 21.33 15.994999999999997","15.997499999999999 5.329999999999998 21.33 -0.002500000000001279","21.33 -0.002500000000001279 21.33 -10.6675","15.997499999999999 -16 21.33 -10.6675","0 -16 15.997499999999999 -16","0 15.994999999999997 0 5.329999999999998","0 5.329999999999998 0 -16","0 5.329999999999998 10.665 5.329999999999998","10.665 5.329999999999998 15.997499999999999 5.329999999999998"]},S:{path:["0 10.665000000000003 5.333 15.998000000000001","5.333 15.998000000000001 15.999 15.998000000000001","15.999 15.998000000000001 21.332 10.665000000000003","21.332 10.665000000000003 21.332 5.332000000000001","15.999 -0.0009999999999994458 21.332 5.332000000000001","5.333 -0.0009999999999994458 15.999 -0.0009999999999994458","0 -5.334 5.333 -0.0009999999999994458","0 -5.334 0 -10.667","0 -10.667 5.333 -16","5.333 -16 15.999 -16","15.999 -16 21.332 -10.667"]},T:{path:["10.666 15.998000000000001 10.666 -16","0 -16 21.332 -16"]},U:{path:["21.332 10.665000000000003 21.332 -16","15.999 15.998000000000001 21.332 10.665000000000003","5.333 15.998000000000001 15.999 15.998000000000001","0 10.665000000000003 5.333 15.998000000000001","0 10.665000000000003 0 -16"]},V:{path:["21.332 5.332000000000001 21.332 -16","10.666 15.998000000000001 21.332 5.332000000000001","0 5.332000000000001 10.666 15.998000000000001","0 5.332000000000001 0 -16"]},W:{path:["21.332 15.998000000000001 21.332 -16","10.666 5.332000000000001 21.332 15.998000000000001","0 15.998000000000001 10.666 5.332000000000001","0 15.998000000000001 0 -16"]},X:{path:["0 -16 21.332 15.998000000000001","21.332 -16 0 15.998000000000001"]},Y:{path:["10.666 -0.0009999999999994458 21.332 -10.667","0 -10.667 10.666 -0.0009999999999994458","10.666 15.998000000000001 10.666 -0.0009999999999994458","21.332 -10.667 21.332 -16","0 -10.667 0 -16"]},Z:{path:["0 15.994999999999997 21.33 15.994999999999997","0 15.994999999999997 0 10.662499999999998","0 10.662499999999998 21.33 -10.6675","21.33 -10.6675 21.33 -16","0 -16 21.33 -16"]},"[":{path:["10.666 15.998000000000001 0 15.998000000000001","0 15.998000000000001 0 -16","0 -16 10.666 -16"]},"\\":{path:["0 -5.33 21.332 16.002000000000002"]},"]":{path:["0 15.998000000000001 10.666 15.998000000000001","10.666 15.998000000000001 10.666 -16","0 -16 10.666 -16"]},"^":{path:["10.666 -10.67 21.332 -0.0039999999999995595","0 -0.0039999999999995595 10.666 -10.67"]},_:{path:["0 21.333666666666666 21.332 21.333666666666666"]},a:{path:["5.333 5.3260000000000005 21.332 5.3260000000000005","0 10.659 5.333 5.3260000000000005","0 10.659 5.333 15.992","5.333 15.992 21.332 15.992","15.999 -5.34 21.332 -0.006999999999999673","5.333 -5.34 15.999 -5.34","21.332 15.992 21.332 5.3260000000000005","21.332 5.3260000000000005 21.332 -0.006999999999999673"]},b:{path:["0 -5.334 15.999 -5.334","15.999 -5.334 21.332 -0.0009999999999994458","21.332 10.665000000000003 21.332 -0.0009999999999994458","15.999 15.998000000000001 21.332 10.665000000000003","0 15.998000000000001 15.999 15.998000000000001","0 15.998000000000001 0 -5.334","0 -5.334 0 -16"]},c:{path:["5.333 15.992 21.332 15.992","0 10.659 5.333 15.992","0 10.659 0 -0.006999999999999673","0 -0.006999999999999673 5.333 -5.34","5.333 -5.34 21.332 -5.34"]},d:{path:["5.333 -5.334 21.332 -5.334","0 -0.0009999999999994458 5.333 -5.334","0 10.665000000000003 0 -0.0009999999999994458","0 10.665000000000003 5.333 15.998000000000001","5.333 15.998000000000001 21.332 15.998000000000001","21.332 15.998000000000001 21.332 -5.334","21.332 -5.334 21.332 -16"]},e:{path:["5.333 15.992 15.999 15.992","0 10.659 5.333 15.992","0 -0.006999999999999673 5.333 -5.34","5.333 -5.34 15.999 -5.34","15.999 -5.34 21.332 -0.006999999999999673","21.332 5.3260000000000005 21.332 -0.006999999999999673","0 5.3260000000000005 21.332 5.3260000000000005","0 10.659 0 5.3260000000000005","0 5.3260000000000005 0 -0.006999999999999673"]},f:{path:["5.333 -10.667 10.666 -16","0 -0.0009999999999994458 5.333 -0.0009999999999994458","5.333 -0.0009999999999994458 10.666 -0.0009999999999994458","5.333 15.998000000000001 5.333 -0.0009999999999994458","5.333 -0.0009999999999994458 5.333 -10.667"]},g:{path:["10.666 26.666833333333336 15.999 26.666833333333336","15.999 26.666833333333336 21.332 21.333833333333335","5.333 -5.331166666666666 21.332 -5.331166666666666","0 0.0018333333333337976 5.333 -5.331166666666666","0 10.667833333333334 0 0.0018333333333337976","0 10.667833333333334 5.333 16.000833333333336","5.333 16.000833333333336 21.332 16.000833333333336","21.332 21.333833333333335 21.332 16.000833333333336","21.332 16.000833333333336 21.332 -5.331166666666666"]},h:{path:["21.332 15.998000000000001 21.332 -0.0009999999999994458","15.999 -5.334 21.332 -0.0009999999999994458","5.333 -5.334 15.999 -5.334","0 -0.0009999999999994458 5.333 -5.334","0 15.998000000000001 0 -0.0009999999999994458","0 -0.0009999999999994458 0 -16"]},i:{path:["5.333 15.998000000000001 5.333 -5.334","0 -5.334 5.333 -5.334","5.333 -16 5.333 -16","0 15.998000000000001 5.333 15.998000000000001","5.333 15.998000000000001 10.666 15.998000000000001"]},j:{path:["0 26.664 5.333 26.664","5.333 26.664 10.666 21.331000000000003","10.666 21.331000000000003 10.666 -5.334","10.666 -16 10.666 -16"]},k:{path:["0 15.998000000000001 0 -16","0 5.332000000000001 15.999 -5.334","0 5.332000000000001 15.999 15.998000000000001"]},l:{path:["5.333 15.998000000000001 5.333 -16","0 -16 5.333 -16","0 15.998000000000001 5.333 15.998000000000001","5.333 15.998000000000001 10.666 15.998000000000001"]},m:{path:["10.666 15.992 10.666 -0.006999999999999673","21.332 15.992 21.332 -0.006999999999999673","15.999 -5.34 21.332 -0.006999999999999673","10.666 -0.006999999999999673 15.999 -5.34","5.333 -5.34 10.666 -0.006999999999999673","0 -5.34 5.333 -5.34","0 15.992 0 -5.34"]},n:{path:["15.999 -5.34 0 -5.34","0 -5.34 0 15.992","21.332 -0.006999999999999673 15.999 -5.34","21.332 15.992 21.332 -0.006999999999999673"]},o:{path:["0 -0.006999999999999673 5.333 -5.34","0 10.659 0 -0.006999999999999673","0 10.659 5.333 15.992","5.333 15.992 15.999 15.992","15.999 15.992 21.332 10.659","21.332 10.659 21.332 -0.006999999999999673","15.999 -5.34 21.332 -0.006999999999999673","5.333 -5.34 15.999 -5.34"]},p:{path:["0 15.992 15.999 15.992","15.999 15.992 21.332 10.659","21.332 10.659 21.332 -0.006999999999999673","15.999 -5.34 21.332 -0.006999999999999673","0 -5.34 15.999 -5.34","0 26.658 0 15.992","0 15.992 0 -5.34"]},q:{path:["5.333 15.992 21.332 15.992","0 10.659 5.333 15.992","0 10.659 0 -0.006999999999999673","0 -0.006999999999999673 5.333 -5.34","5.333 -5.34 21.332 -5.34","21.332 26.658 21.332 15.992","21.332 15.992 21.332 -5.34"]},r:{path:["0 5.3260000000000005 10.666 -5.34","10.666 -5.34 15.999 -5.34","0 15.992 0 5.3260000000000005","0 5.3260000000000005 0 -5.34"]},s:{path:["0 15.992 15.999 15.992","15.999 15.992 21.332 10.659","15.999 5.3260000000000005 21.332 10.659","5.333 5.3260000000000005 15.999 5.3260000000000005","0 -0.006999999999999673 5.333 5.3260000000000005","0 -0.006999999999999673 5.333 -5.34","5.333 -5.34 21.332 -5.34"]},t:{path:["10.666 16.005000000000003 5.333 10.672","0 -5.327 5.333 -5.327","5.333 -5.327 10.666 -5.327","5.333 10.672 5.333 -5.327","5.333 -5.327 5.333 -10.66"]},u:{path:["21.332 15.992 21.332 -5.34","5.333 15.992 21.332 15.992","0 10.659 5.333 15.992","0 10.659 0 -5.34"]},v:{path:["10.666 15.992 0 -5.34","10.666 15.992 21.332 -5.34"]},w:{path:["21.332 10.659 21.332 -5.34","15.999 15.992 21.332 10.659","10.666 10.659 15.999 15.992","5.333 15.992 10.666 10.659","0 10.659 5.333 15.992","0 10.659 0 -5.34"]},x:{path:["0 15.992 10.666 5.3260000000000005","10.666 5.3260000000000005 21.332 -5.34","0 -5.34 10.666 5.3260000000000005","10.666 5.3260000000000005 21.332 15.992"]},y:{path:["10.666 26.658 15.999 26.658","15.999 26.658 21.332 21.325000000000003","5.333 15.992 21.332 15.992","0 10.659 5.333 15.992","0 10.659 0 -5.34","21.332 21.325000000000003 21.332 15.992","21.332 15.992 21.332 -5.34"]},z:{path:["0 15.992 21.332 15.992","0 15.992 21.332 -5.34","0 -5.34 21.332 -5.34"]},"{":{path:["10.666 15.998000000000001 15.999 15.998000000000001","5.333 10.665000000000003 10.666 15.998000000000001","5.333 10.665000000000003 5.333 5.332000000000001","0 -0.0009999999999994458 5.333 5.332000000000001","0 -0.0009999999999994458 5.333 -5.334","5.333 -5.334 5.333 -10.667","5.333 -10.667 10.666 -16","10.666 -16 15.999 -16"]},"|":{path:["0 -16 0 16"]},"}":{path:["0 15.998000000000001 5.333 15.998000000000001","5.333 15.998000000000001 10.666 10.665000000000003","10.666 10.665000000000003 10.666 5.332000000000001","10.666 5.332000000000001 15.999 -0.0009999999999994458","10.666 -5.334 15.999 -0.0009999999999994458","10.666 -5.334 10.666 -10.667","5.333 -16 10.666 -10.667","0 -16 5.333 -16"]},"~":{path:["15.999 -15.996999999999998 21.332 -21.33","5.333 -15.996999999999998 15.999 -15.996999999999998","0 -10.663999999999998 5.333 -15.996999999999998"]},"\xB0":{path:["3 -11 0 -8 3 -5 6 -8 3 -11"]},\u03A9:{path:["0 9 7 9 5 6 3 3 2 0 2 -3 3 -6 4 -8 6 -10 8 -11 12 -11 14 -10 16 -8 17 -6 18 -3 18 0 17 3 15 6 13 9 20 9"]},\u03BC:{path:["0 14 1 4 1 -6 1 4 2 7 4 8 6 8 8 7 10 4 10 -6 10 6 11 8 12 9"]}},gT.spacing={1:15.99,I:15.99,f:15.99,i:15.99,k:15.99,l:15.99,r:15.99,t:15.99,"(":15.99,")":15.99,"[":15.99,"]":15.99,"'":15.99,"{":15.99,"}":15.99,'"':15.99,"|":15.99,"<":15.99,"?":15.99,j:21.32,"`":21.32,";":21.32,",":21.32,".":21.32,":":21.32};var JB=gT;var yT=class yT{static setFontHeight(t){yT.height=+t}static getFontHeight(){return yT.height||4.5}static getCharInfo(t,e,r){function i(u,d,p,m,g){let y="",b=u.length;for(let P=0;P<b;P++){let T=u[P].split(" "),I=0,C=T.length;for(;I<C;I+=2)T[I]=on(p+d*T[I],2),T[I+1]=on(m+d*(+T[I+1]-16),2);let E="M "+T[0]+" "+T[1];for(I=2;I<C;I++)I%2===0&&(E+="L"),E+=T[I]+" ";y+=E}return y}if(yT.fontPath[t]){var n=yT.fontPath[t].path,s=yT.getPathBBox(n),a=Math.abs(s.R-s.L),l=Math.abs(s.T-s.B);l===0&&(l=1);var c=yT.getFontHeight()/32;a=a*c;var h=i(n,c,e,r,l);return[h,a]}else return["",0]}static getPathBBox(t){for(var e=t.length,r={L:9999,T:-9999,R:-9999,B:9999},i,n,s=0;s<e;s++){for(var a=t[s].split(" "),l=0,c=a.length;l<c;l+=2)i=+a[l],n=+a[l+1],r.L>i&&(r.L=i),r.T<n&&(r.T=n),r.R<i&&(r.R=i),r.B>n&&(r.B=n);a=null}return r}static getSpaceWidth(t){return 28.797554799999986*t}static everyCharHasDefaultFontPath(t){let e=t.toString().replace(/\s/g,"").split("");for(let r of e)if(yT.fontPath[r]==null)return!1;return!0}static getSpacing(t){return yT.spacing[t]||10.66}};yT._fontsCache={},yT.fontPath={0:{path:["12.190145800000046 -15.998443799999961 15.237282200000013 -14.474697800000012","15.237282200000013 -14.474697800000012 16.760139200000022 -12.95201859999996","16.760139200000022 -12.95201859999996 18.284240799999964 -9.9038154","18.284240799999964 -9.9038154 19.80798679999999 -2.284907599999981","19.80798679999999 2.2861525999999905 19.80798679999999 -2.284907599999981","18.289040239959657 9.88035361823414 19.80798679999999 2.2861525999999905","15.236926600000022 14.475053800000008 16.76137900652654 12.950245545572814","12.189434599999963 15.998622000000001 15.236926600000022 14.475053800000008","6.0948062 14.474876000000052 9.141586999999989 15.998622000000001","4.5710601999999705 12.951307800000059 6.0948062 14.474876000000052","3.0476698000000138 9.904526999999984 4.5710601999999705 12.951307800000059","1.5237460000000291 2.2861525999999905 3.0476698000000138 9.904526999999984","1.5237460000000291 2.2861525999999905 1.5237460000000291 -2.2859743999999544","1.5237460000000291 -2.2859743999999544 3.0473142000000224 -9.9038154","3.0473142000000224 -9.9038154 4.571415799999962 -12.951485200000011","4.571415799999962 -12.951485200000011 6.0953396000000275 -14.474875599999969","6.0953396000000275 -14.474875599999969 9.14265379999997 -15.998443799999961","4.5710601999999705 -14.474342199999942 9.14265379999997 -15.998443799999961","1.5242793999999762 -9.9038154 4.5710601999999705 -14.474342199999942","0 -2.285263199999971 1.5242793999999762 -9.9038154","0 2.2859748000000355 0 -2.285263199999971","0 2.2859748000000355 1.523568199999993 9.9038158","1.523568199999993 9.9038158 4.5710601999999705 14.475053800000008","4.5710601999999705 14.475053800000008 9.141586999999996 15.998622000000001","9.141586999999996 15.998622000000001 12.189434599999963 15.998622000000001","16.762934294775164 14.448991354225557 19.806564400000028 9.908260800000017","19.806564400000028 9.908260800000017 21.331554999999984 2.2863304000000273","21.331554999999984 2.2863304000000273 21.331554999999984 -2.285263199999971","19.808342399999983 -9.903281999999972 21.331554999999984 -2.285263199999971","16.760850400000006 -14.474697800000012 19.808342399999983 -9.903281999999972","12.190145800000035 -15.998443799999961 16.760850400000006 -14.474697800000012","9.14265379999997 -15.998443799999961 12.190145800000035 -15.998443799999961","16.76137900652654 12.950245545572814 18.289040239959657 9.880353618234139","12.189434599999963 15.998622000000001 16.762934294775164 14.448991354225557"]},1:{path:["6.094272799999972 15.920034399999999 6.094272799999972 14.42366959999997","6.094272799999972 14.42366959999997 6.094272799999972 -14.553107599999947","0 15.920034399999999 13.712825 15.920034399999999","7.6180188000000015 15.920034399999999 7.6180188000000015 -16.076675799999965","3.0467807999999943 -11.505971199999994 7.6180188000000015 -16.076675799999972","0 -9.982402999999998 3.0467807999999943 -11.505971199999994"]},2:{path:["13.713536199999984 -15.998443799999961 18.284240800000045 -14.474342199999942","18.284240800000045 -14.474342199999942 19.8076312 -12.951307399999976","19.8076312 -12.951307399999976 21.331732800000022 -9.903459800000007","21.331732800000022 -6.856679000000014 21.331732800000022 -9.903459800000007","19.808342399999983 -3.8091869999999552 21.331732800000022 -6.856679000000014","15.238171200000032 -0.7624061999999618 19.808342399999983 -3.8091869999999552","7.619441200000049 2.285085800000015 15.238171200000032 -0.7624061999999618","4.571415800000043 11.427206200000038 12.189434600000045 15.998622000000001","12.189434600000045 15.998622000000001 18.284240800000045 15.998622000000001","18.284240800000045 15.998622000000001 19.808342399999983 14.474164799999988","19.808342399999983 14.474164799999988 21.331554999999977 11.42756180000004","21.331554999999984 11.427561800000033 21.331554999999984 8.380069800000053","19.80674219999998 12.951841200000006 21.331554999999984 11.427561800000033","16.760139200000022 14.474876000000052 19.80674219999998 12.951841200000006","12.189079000000053 14.474876000000052 16.760139200000022 14.474876000000052","4.571415800000043 11.427206200000038 12.189079000000053 14.474876000000052","1.524101600000021 11.427206200000038 4.571415800000043 11.427206200000038","0.0003555999999915911 12.950418862233152 1.524101600000021 11.427206200000038","0.0003555999999915911 15.997910800000017 0.0003555999999915911 11.426673856114697","0.0003555999999915911 11.426673856114697 1.5239237999999846 6.856501600000059","1.5239237999999846 6.856501600000059 4.570526800000024 3.8102542000000117","4.570526800000024 3.8102542000000117 7.619441200000049 2.285085800000015","7.619441200000049 2.285085800000015 13.714247400000048 -0.7627617999999536","13.714247400000048 -0.7627617999999536 18.2844186 -3.8097203999999856","18.2844186 -3.8097203999999856 19.80905360000005 -6.856145599999987","19.80905360000005 -6.856145599999987 19.80905360000005 -9.902570799999989","18.284063000000007 -12.951307399999976 19.80905360000005 -9.902570799999989","16.76031699999998 -14.474875599999969 18.284063000000007 -12.951307399999976","13.713536199999984 -15.998443799999961 16.76031699999998 -14.474875599999969","7.616241297864937 -15.998443799999961 13.713536199999984 -15.998443799999961","3.0476698000000138 -14.47523119999996 7.616241297864936 -15.998443799999961","1.523568199999993 -12.951307399999976 3.0476698000000138 -14.47523119999996","0 -9.9038154 1.523568199999993 -12.951307399999976","0 -8.38095839999999 0 -9.9038154","0 -8.38095839999999 1.5237460000000294 -6.8563233999999404","1.5237460000000294 -6.8563233999999404 3.0474919999999774 -8.380069399999972","1.5244572000000125 -9.9038154 3.0474919999999774 -8.380069399999972"]},3:{path:["13.713358400000029 -15.998443800000043 16.76067259999997 -14.47487560000005","16.76067259999997 -14.47487560000005 18.284952000000025 -11.427383600000073","18.284952000000025 -6.856145600000069 18.284952000000025 -11.427383600000073","16.761028199999963 -3.809187000000037 18.284952000000025 -6.856145600000069","13.71406960000001 -2.2854410000000076 16.761028199999963 -3.809187000000037","18.28552830822789 0.7626274066353762 19.80798679999999 5.333288999999977","19.80798679999999 9.904704799999939 19.80798679999999 5.333288999999977","18.284952000000025 12.951307799999979 19.80798679999999 9.904704799999939","16.76067259999997 14.475053799999927 18.284952000000025 12.951307799999979","13.713180599999992 15.998622000000001 16.76067259999997 14.475053799999927","1.5237460000000294 9.904349199999949 3.0474919999999774 8.380069799999973","1.5237460000000294 6.85596819999995 3.0474919999999774 8.380069799999973","0 8.379714199999981 1.5237460000000294 6.85596819999995","0 9.903282399999974 0 8.379714199999981","0 9.903282399999974 1.5233904000000378 12.950596599999995","1.5233904000000378 12.950596599999995 3.0478475999999692 14.475053799999927","3.0478475999999692 14.475053799999927 7.619441199999967 15.998622000000001","7.619441199999967 15.998622000000001 13.713180599999992 15.998622000000001","13.713180599999992 15.998622000000001 18.284952000000025 14.474342599999943","18.284952000000025 14.474342599999943 19.80816460000003 12.950952199999987","19.80816460000003 12.950952199999987 21.331910599999976 9.9038158","21.331910599999976 9.9038158 21.331910599999976 5.333111199999941","19.807809000000038 2.285085799999935 21.331910599999976 5.333111199999941","16.76156159999999 -0.7615172000000232 19.807809000000038 2.285085799999935","13.71406960000001 -2.2854410000000076 16.76156159999999 -0.7615172000000232","9.142476000000013 -2.2854410000000076 13.71406960000001 -2.2854410000000076","13.71406960000001 -2.2854410000000076 18.28477419999999 -3.809187000000037","18.28477419999999 -3.809187000000037 19.80798679999999 -6.856501200000061","19.80798679999999 -6.856501200000061 19.80798679999999 -11.427561400000027","18.284063000000007 -14.475053400000004 19.80798679999999 -11.427561400000027","13.713358400000029 -15.998443800000043 18.284063000000007 -14.475053400000004","7.618552200000028 -15.998443800000043 13.713358400000029 -15.998443800000043","3.0473142000000224 -14.474697800000012 7.618552200000028 -15.998443800000043","1.5244572000000125 -12.952018600000041 3.0473142000000224 -14.474697800000012","0.000533400000027814 -9.903993200000038 1.5244572000000125 -12.952018600000041","0.000533400000027814 -8.379892841909214 0.000533400000027814 -9.903993200000038","0.000533400000027814 -8.379892841909214 1.5242793999999762 -6.856679000000014","1.5242793999999762 -6.856679000000014 3.0478475999999692 -8.380069400000053","1.5239237999999846 -9.903637600000046 3.0478475999999692 -8.380069400000053"]},4:{path:["0 6.854190199999993 24.379047000000043 6.854190199999993","0 6.854190199999993 16.760494800000014 -16.000933000000064","16.760494800000014 15.996132799999979 16.760494800000014 -16.00093300000006","15.236748800000067 15.996132799999979 15.236748800000067 -12.953618800000044","10.666399799999999 15.996132799999979 21.331555000000066 15.996132799999979"]},5:{path:["0.00906779999998771 9.913633794155809 0.00906779999998771 8.390425400000044","0.00906779999998771 -0.7511615999999515 3.0565597999999654 -15.988621599999918","0.00906779999998771 -0.7511615999999515 3.0565597999999654 -3.7986536000000104","0.00906779999998771 9.913633794155809 1.533347199999964 12.961485600000014","0.00906779999998771 8.390425400000044 1.5329915999999724 6.866501600000059","1.5329915999999724 6.866501600000059 3.0569154000000376 8.390425400000044","1.5329915999999724 9.914349200000029 3.0569154000000376 8.390425400000044","1.533347199999964 12.961485600000014 3.0569154000000376 14.485053800000008","2.75177503999997 -14.464697799999934 10.673867399999983 -14.464697799999934","3.0565597999999654 -15.988621599999918 18.292775200000005 -15.988621599999918","3.0565597999999654 -3.7986536000000104 7.627086599999989 -5.32275520000003","3.0569154000000376 14.485053800000008 7.628153399999964 16.008622000000003","7.627086599999989 -5.32275520000003 12.201880599999992 -5.32275520000003","7.628153399999964 16.008622000000003 12.198324599999996 16.008622000000003","10.673867399999983 -14.464697799999934 18.292775200000005 -15.988621599999918","12.198324599999996 16.008622000000003 15.246350000000001 14.484164799999988","12.198324599999996 16.008622000000003 16.76974040000004 14.485053800000008","12.201880599999939 -5.3227552000000475 15.245460999999981 -3.799542600000029","12.201880599999992 -5.32275520000003 16.769562600000004 -3.7991869999999555","15.245460999999981 -3.799542600000029 18.29348639999999 -0.7515172000000232","15.246350000000001 14.484164799999988 18.293574477761666 11.436940322238323","16.769562600000004 -3.7991869999999555 19.816876800000024 -0.7518727999999333","16.76974040000004 14.485053800000008 19.816876800000024 11.437917400000021","18.29348639999999 -0.7515172000000232 19.816876800000024 3.819365200000073","18.293574477761666 11.436940322238323 19.816876800000024 6.866501600000059","19.816876800000024 6.866501600000059 19.816876800000024 3.819365200000073","19.816876800000024 -0.7518727999999333 21.340622799999974 3.819187400000036","19.816876800000024 11.437917400000021 21.340622799999974 6.86685720000005","21.340622799999974 6.86685720000005 21.340622799999974 3.819187400000036"]},6:{path:["6.095161799999992 14.475587200000035 9.141586999999996 15.998622000000001","3.0476698000000138 11.427917400000021 6.095161799999992 14.475587200000035","1.523568199999993 6.856501599999978 3.0476698000000138 11.427917400000021","1.523568199999993 6.856501599999978 1.523568199999993 -2.285085400000016","1.523568199999993 -2.285085400000016 3.047136399999986 -8.37971379999998","3.047136399999986 -8.37971379999998 4.570704599999979 -11.426672400000008","4.570704599999979 -11.426672400000008 7.618729999999984 -14.47523119999996","7.618729999999984 -14.47523119999996 10.666399799999999 -15.998977199999988","12.189256800000008 15.998622000000001 15.237282200000013 14.474698200000017","15.237282200000013 14.474698200000017 18.283707400000015 11.428450799999968","18.283707400000015 11.428450799999968 19.807808999999956 6.856501599999978","19.807808999999956 6.856501599999978 19.807808999999956 5.333111200000022","18.284063000000007 0.7615176000000226 19.807808999999956 5.333111200000022","15.237104399999977 -2.285263199999971 18.284063000000007 0.7615176000000226","12.189968000000006 -3.8091870000000334 15.237104399999977 -2.285263199999971","1.523568199999993 5.333644599999885 3.0474919999999774 0.7618732000000144","3.0474919999999774 0.7618732000000144 6.094272799999972 -2.284551999999989","6.094272799999972 -2.284551999999989 10.666044200000007 -3.809187000000037","10.666044200000007 -3.809187000000037 12.189967999999991 -3.809187000000037","12.189967999999991 -3.809187000000037 16.75942799999996 -2.286507799999983","16.75942799999996 -2.286507799999983 19.8076312 0.7613397999999858","19.8076312 0.7613397999999858 21.331732800000022 5.332933399999985","21.331732800000022 6.855790399999995 21.331732800000022 5.332933399999985","19.807275600000008 11.428450799999968 21.331732800000022 6.855790399999995","16.76031699999998 14.475231599999963 19.807275600000008 11.428450799999968","12.189256800000008 15.998622000000001 16.76031699999998 14.475231599999963","9.141586999999994 15.998622000000001 12.189256800000008 15.998622000000001","4.571238000000007 14.4754094 9.141586999999994 15.998622000000001","1.5239237999999846 11.428273000000013 4.571238000000007 14.4754094","0 6.857390599999998 1.5239237999999846 11.428273000000013","0 6.857390599999998 0 -2.284907599999981","0 -2.284907599999981 1.5239237999999846 -8.380602799999998","1.5239237999999846 -8.380602799999998 3.0473142000000224 -11.427383599999992","3.0473142000000224 -11.427383599999992 6.095161799999992 -14.474875599999969","6.095161799999992 -14.474875599999969 10.666399799999999 -15.998977199999988","15.236926600000022 -15.998977199999988 18.284063000000007 -14.475053400000004","10.666399799999999 -15.998977199999988 15.236926600000022 -15.998977199999988","18.284063000000007 -14.475053400000004 19.80816460000003 -11.427205800000035","19.80816460000003 -9.904170999999991 19.80816460000003 -11.427205800000035","18.284063000000007 -8.380069399999972 19.80816460000003 -9.904170999999991","16.760494800000014 -9.903637599999964 18.284063000000007 -8.380069399999972","16.760494800000014 -9.903637599999964 18.285129799999982 -11.428450399999967"]},7:{path:["1.5241016000000207 -12.951662999999968 4.571593599999998 -14.475053400000004","4.571593599999998 -14.475053400000004 7.618729999999984 -14.475053400000004","7.618729999999984 -14.475053400000004 15.237459999999974 -11.427561400000062","9.142298200000058 15.998444200000046 9.142298200000058 8.379536400000024","9.142298200000058 8.379536400000024 10.666222000000042 3.8086540000000095","10.666222000000042 3.8086540000000095 12.189256800000008 0.7620509999999694","12.189256800000008 0.7620509999999694 19.807809000000038 -6.8565011999999825","10.665866400000052 15.998622000000001 10.665866400000052 8.380247600000008","10.665866400000052 8.380247600000008 12.189434600000045 3.8093651999999913","12.189434600000045 3.8093651999999913 13.71371400000002 0.7611620000000308","13.71371400000002 0.7611620000000308 19.807809000000038 -6.85650119999999","19.80780900000004 -6.856501199999993 21.33137720000003 -11.42827260000001","21.33137720000003 -11.42827260000001 21.33137720000003 -15.998443799999961","19.807809000000038 -12.95112960000002 21.33137720000003 -15.998443799999961","18.284240800000045 -11.427561400000027 19.807809000000038 -12.95112960000002","15.237460000000032 -11.427561400000027 18.284240800000045 -11.427561400000027","7.618907800000021 -15.998621599999996 15.237460000000029 -11.427561400000027","4.571415800000043 -15.998621599999996 7.618907800000021 -15.998621599999996","1.5241016000000207 -12.951662999999968 4.571415800000043 -15.998621599999996","0 -9.904170999999998 1.5241016000000207 -12.951662999999968","0 -6.856856799999971 0 -15.998621599999996"]},8:{path:["0 3.809542999999948 1.523568199999993 0.7622288000000061","1.523568199999993 0.7622288000000061 3.0474919999999774 -0.7620506000000518","1.5242793999999762 9.904882206453763 1.5242793999999762 3.8079421783217047","1.5242793999999762 9.904882206453763 3.047136399999986 12.950418799999959","3.047136399999986 12.950418799999959 4.57194919999999 14.475053800000008","4.57194919999999 14.475053800000008 7.618552200000029 15.998622000000001","1.5242793999999762 3.8079421783217047 3.0480254000000055 0.7599173999999387","3.0480254000000055 0.7599173999999387 4.575860799999979 -0.7648954000000643","4.575860799999979 -0.7648954000000643 7.618552200000029 -2.2856188000000444","18.28495200000003 12.950241000000004 19.80816460000003 9.90274887546099","16.75978360000003 14.475053800000008 18.28495200000003 12.950241000000004","13.713180599999992 15.998622000000001 16.75978360000003 14.475053800000008","16.759961399999987 -0.7624062000000418 18.284063000000007 0.7618731999999344","13.713358400000029 -2.2856188000000444 16.759961399999987 -0.7624062000000418","13.713358400000029 -2.2856188000000444 18.284063000000007 -0.7622284000000068","18.284063000000007 -0.7622284000000068 19.80816460000003 0.7625843999999979","21.331554999999984 9.904171399999992 21.331554999999984 3.809542999999948","19.808697999999975 12.950063199999967 21.331554999999984 9.904171399999992","18.28352959999998 14.475053800000008 19.808697999999975 12.950063199999967","13.713180599999992 15.998622000000001 18.28352959999998 14.475053800000008","7.618552200000029 15.998622000000001 13.713180599999992 15.998622000000001","3.047136399999986 14.474698199999935 7.618552200000029 15.998622000000001","1.5241016000000207 12.95166339999997 3.047136399999986 14.474698199999935","0 9.9038158 1.5241016000000207 12.95166339999997","0 9.9038158 0 3.809542999999948","3.0474919999999774 -0.7620506000000518 7.618552200000029 -2.2856188000000444","13.713713999999985 -15.998621599999996 16.76031699999998 -14.475408999999996","16.76031699999998 -14.475408999999996 18.284240799999964 -11.427205800000035","18.284240799999964 -6.8573901999999975 18.284240799999964 -11.427205800000035","16.76067259999997 -3.809364799999994 18.284240799999964 -6.8573901999999975","13.713358400000029 -2.2856188000000444 16.76067259999997 -3.809364799999994","4.5710601999999705 -3.809364799999994 7.618552200000051 -2.2856188000000444","3.0474919999999774 -6.857034600000006 4.5710601999999705 -3.809364799999994","3.0474919999999774 -6.857034600000006 3.0474919999999774 -11.427561400000027","3.0474919999999774 -11.427561400000027 4.571771400000035 -14.475408999999996","4.571771400000035 -14.475408999999996 7.618374399999992 -15.998621599999996","3.0474919999999774 -14.47487560000005 7.618374399999992 -15.998621599999996","1.5233904000000376 -11.427917000000019 3.0474919999999774 -14.47487560000005","1.5233904000000376 -6.8573901999999975 1.5233904000000376 -11.427917000000019","1.5233904000000376 -6.8573901999999975 3.047136399999986 -3.809364799999994","3.047136399999986 -3.809364799999994 7.618552200000029 -2.2856188000000444","7.618552200000029 -2.2856188000000444 13.713358400000029 -2.2856188000000444","13.713358400000029 -2.2856188000000444 18.2844186 -3.8097204000000637","18.2844186 -3.8097204000000637 19.807809000000038 -6.857034600000006","19.807809000000038 -6.857034600000006 19.807809000000038 -11.427917000000019","18.2844186 -14.47487560000005 19.807809000000038 -11.427917000000019","13.71371400000002 -15.998621599999996 18.2844186 -14.47487560000005","7.618374399999992 -15.998621599999996 13.71371400000002 -15.998621599999996","19.80816460000003 0.7625843999999979 21.331554999999984 3.809542999999948","18.284063000000007 0.7618731999999344 19.80816460000003 3.8090095999999996","19.80816460000003 9.90274887546099 19.80816460000003 3.8090095999999996"]},9:{path:["6.094983999999996 2.2861525999999905 9.142298199999976 3.809543000000028","3.047136399999986 -0.7616949999999783 6.094983999999996 2.2861525999999905","1.5239237999999846 -5.332577399999995 3.047136399999986 -0.7616949999999783","1.5239237999999846 -5.332577399999995 1.5239237999999846 -6.856501199999979","1.5239237999999846 -6.856501199999979 3.0474919999999774 -11.427561399999945","3.0474919999999774 -11.427561399999945 6.094272800000012 -14.474342199999942","6.094272800000012 -14.474342199999942 9.14247599999997 -15.99808819999997","10.666044200000007 15.998622000000001 13.713358400000029 14.474876000000052","13.713358400000029 14.474876000000052 16.76067259999997 11.427206200000038","16.76067259999997 11.427206200000038 18.283885199999972 8.3806032","18.283885199999972 8.3806032 19.807808999999956 2.283485600000013","19.807808999999956 2.283485600000013 19.807808999999956 -5.333457457212486","19.807808999999956 -5.333457457212486 19.807808999999956 -6.856145599999987","18.284063000000007 -11.427028 19.807808999999956 -6.856145599999987","15.236393199999995 -14.474697800000012 18.284063000000007 -11.427028","12.189612399999932 -15.998088199999994 15.236393199999995 -14.474697800000012","18.28495200000003 -0.7616949999999783 19.807808999999956 -5.333457457212486","15.236393199999995 2.2857969999999987 18.28495200000003 -0.7616949999999783","10.665510799999979 3.809543000000028 15.236393199999995 2.2857969999999987","9.142298199999978 3.809543000000028 10.665510799999979 3.809543000000028","4.571238000000007 2.2861525999999905 9.14229819999998 3.809543000000028","1.5237459999999887 -0.7608059999999597 4.571238000000007 2.2861525999999905","0 -5.334177599999997 1.5237459999999887 -0.7608059999999597","0 -5.334177599999997 0 -6.856679000000014","0 -6.856679000000014 1.5237459999999887 -11.427561399999945","1.5237459999999887 -11.427561399999945 4.5708824000000154 -14.474697800000012","4.5708824000000154 -14.474697800000012 9.142476000000059 -15.99808819999997","3.0474919999999774 11.42756180000003 4.571060200000011 9.904171399999992","3.047314199999982 8.380247600000008 4.571060200000011 9.904171399999992","1.5233903999999971 9.904171399999992 3.047314199999982 8.380247600000008","1.5233903999999971 11.427562152038233 1.5233903999999971 9.904171399999992","1.5233903999999971 11.427562152038233 3.04695859999999 14.474876000000052","3.04695859999999 14.474876000000052 6.0948062 15.998622000000001","6.0948062 15.998622000000001 10.666044200000007 15.998622000000001","10.666044200000007 15.998622000000001 15.236926600000022 14.474698200000017","15.236926600000022 14.474698200000017 18.284596400000037 11.426495000000056","18.284596400000037 11.426495000000056 19.80798679999999 8.379714199999981","19.80798679999999 8.379714199999981 21.33137720000003 2.2859748000000355","21.33137720000003 2.2859748000000355 21.33137720000003 -6.856501199999979","19.807808999999956 -11.427028 21.33137720000003 -6.856501199999979","9.142476000000059 -15.99808819999997 12.1896124 -15.99808819999997","12.189612400000007 -15.99808819999997 16.760850400000006 -14.474342199999942","16.760850400000006 -14.474342199999942 19.807808999999956 -11.427028"]},"!":{path:["0.0013461887890558622 -12.931154977577993 1.5249906000000402 -15.978443799999962","0.0013461887890558694 -12.931154977577993 1.5249906000000402 5.352755600000029","0.0014224000000472188 14.495053800000008 1.5249906000000402 12.971485600000014","0.0014224000000472188 14.495053800000008 1.5249906000000402 16.018622","1.524812800000004 -3.7890092000000024 1.524812800000004 -12.931307399999977","1.5249906000000402 16.018622 3.048558800000033 14.495053800000008","1.5249906000000402 12.971485600000014 3.048558800000033 14.495053800000008","1.5249906000000402 5.352755600000029 3.0487366000000695 -12.93077399999995","1.5249906000000402 -15.978443799999962 3.0487366000000695 -12.93077399999995"]},'"':{path:["0 -5.351733599999992 3.0473141999999416 -16.017066600000017","0 -5.351733599999992 1.5237459999999483 -16.01724439999997","9.599066399999968 -5.351377999999983 12.646380599999993 -16.016711000000026","9.599066399999968 -5.351377999999983 11.122812399999999 -16.016711000000026"]},"#":{path:["0 9.894749000000024 21.330843800000004 9.894749000000024","1.5244572000000125 0.7528064000000398 22.854767600000066 0.7528064000000398","10.665333000000023 26.654888200000048 21.33013260000002 -16.006977199999987","1.5221458000000265 26.658622 12.197613400000012 -15.991330799999957"]},$:{path:["7.618374399999992 22.103622 7.618374399999992 -22.083233999999997","13.713180599999992 22.10308859999997 13.713180599999992 -22.084834200000003","18.284240800000003 2.2958130000000025 21.331377199999988 5.3429493999999895","15.235682000000011 0.7713557999999914 18.284240800000003 2.2958130000000025","6.093383799999993 -2.276314000000024 15.235682000000011 0.7713557999999914","3.0476698000000138 -3.7989931999999946 6.093383799999993 -2.276314000000024","1.5237459999999887 -5.323094800000014 3.0476698000000138 -3.7989931999999946","0 -8.370053400000003 1.5237459999999887 -5.323094800000014","1.523568199999993 11.437577799999993 3.047314200000021 9.913831800000006","1.5237459999999887 8.390263599999972 3.047314200000021 9.913831800000006","0 9.9140096 1.5237459999999887 8.390263599999972","0 11.437399999999998 0 9.9140096","0 11.437399999999998 3.047492000000018 14.484891999999975","3.047492000000018 14.484891999999975 7.618196599999998 16.00846019999997","7.618196599999998 16.00846019999997 13.713350447746311 16.00846019999997","13.713350447746313 16.00846019999997 18.284240800000003 14.484180799999992","18.284240800000003 14.484180799999992 21.331377199999988 11.437044400000007","21.331377199999988 11.437044400000007 21.331377199999988 5.3429493999999895","19.807808999999995 2.2956351999999676 21.331377199999988 5.3429493999999895","18.284596399999995 0.772066999999975 19.807808999999995 2.2956351999999676","15.237282200000013 -0.7518568000000094 18.284596399999995 0.772066999999975","6.095161799999992 -3.799171000000033 15.237282200000013 -0.7518568000000094","3.047136399999986 -5.322917000000018 6.095161799999992 -3.799171000000033","0 -8.370053400000003 3.047136399999986 -5.322917000000018","0 -8.370053400000003 0 -11.41772320000002","0 -11.41772320000002 3.047136399999986 -14.464859600000006","3.047136399999986 -14.464859600000006 7.6180188000000015 -15.988783400000033","7.6180188000000015 -15.988783400000033 13.713001559534877 -15.988783400000033","13.713001559534884 -15.988783400000033 18.28388520000001 -14.465037400000002","18.28388520000001 -14.465037400000002 21.331199399999996 -11.41772320000002","21.331199399999996 -9.89397720000003 21.331199399999996 -11.41772320000002","19.807808999999995 -8.370586799999991 21.331199399999996 -9.89397720000003","18.284240800000003 -9.894155000000026 19.807808999999995 -8.370586799999991","18.284240800000003 -9.894155000000026 19.807808999999995 -11.41772320000002"]},"%":{path:["18.2844186 6.8656126000000395 21.327998999999988 5.34275560000003","16.76031699999998 9.913993600000037 18.2844186 6.8656126000000395","16.76031699999998 9.913993600000037 16.76031699999998 9.913993600000037","16.76031699999998 12.959174200000028 16.76031699999998 9.913993600000037","16.76031699999998 12.959174200000028 19.80976479999995 16.008622","19.80976479999995 16.008622 22.854767599999988 16.008622","22.854767599999988 16.008622 25.902970800000027 14.484520400000061","25.902970800000027 14.484520400000061 27.42618340000003 11.437028400000003","27.42618340000003 11.437028400000003 27.42618340000003 8.390069800000052","24.378869200000008 5.34275560000003 27.42618340000003 8.390069800000052","21.327998999999988 5.34275560000003 24.378869200000008 5.34275560000003","7.618552200000029 -15.988621599999997 10.665688600000015 -12.94148519999993","10.665688600000015 -9.893104199999938 10.665688600000015 -12.94148519999993","9.142298199999978 -6.8466789999999325 10.665688600000015 -9.893104199999938","6.094450600000008 -5.322755199999948 9.142298199999978 -6.8466789999999325","0 -8.370069399999972 3.0476698000000138 -5.322755199999948","3.0476698000000138 -5.322755199999948 6.094450600000008 -5.322755199999948","6.094450600000008 -5.322755199999948 6.094450600000008 -5.322755199999948","0 -8.370069399999972 0 -11.414534477606418","0 -11.414534477606418 1.5226791999999736 -14.464519999999977","1.5226791999999736 -14.464519999999977 4.571415799999962 -15.988621599999997","0.0012446000000109962 16.006666200000005 27.42618340000003 -15.988443799999962","24.379046999999964 -14.465053400000004 27.426183400000024 -15.988443799999962","19.8076312 -12.94148519999993 24.379046999999964 -14.465053400000004","15.236215399999958 -12.94148519999993 19.8076312 -12.94148519999993","10.665333000000023 -14.46523119999996 15.236215399999958 -12.94148519999993","7.618552200000029 -15.988621599999997 10.665333000000023 -14.46523119999996","4.571415799999962 -15.988621599999997 7.618552200000029 -15.988621599999997"]},"&":{path:["21.331732800000022 14.484875999999971 25.90243740000001 16.008622000000006","18.2844186 11.437917400000021 21.331732800000022 14.484875999999971","7.618196600000037 -3.799720399999986 18.2844186 11.437917400000021","6.094628400000045 -8.370247199999993 7.618196600000037 -3.799720399999986","28.950640600000042 14.48452039999998 28.950640600000042 12.960596599999995","27.426539000000023 16.008622 28.950640600000042 14.48452039999998","25.9024374 16.008622 27.426539000000023 16.008622","22.85334520000002 14.48327579999997 25.9024374 16.008622","19.811365000000034 11.442540199999993 22.85334520000002 14.48327579999997","7.618552200000029 -5.323110800000022 19.811365000000034 11.442540199999993","6.094628400000045 -8.370247200000007 7.618552200000029 -5.323110800000022","6.094628400000045 -8.370247200000007 6.094628400000045 -11.417917000000019","6.094628400000045 -11.417917000000019 7.617485399999973 -14.464697800000012","7.617485399999973 -14.464697800000012 10.665688600000015 -15.988799400000035","3.0473142000000224 14.484698200000016 6.0948062 16.00826640000001","1.5237460000000291 11.437739599999984 3.0473142000000224 14.484698200000016","1.5237460000000291 11.437739599999984 1.5237460000000291 6.866145999999986","1.5237460000000291 6.866145999999986 3.046069600000011 3.8204319999999665","3.046069600000011 3.8204319999999665 6.094095000000016 0.772406599999961","25.901370600000025 -2.275441000000008 27.425472200000048 -3.799542600000029","25.901370600000025 -2.275441000000008 27.42565 -0.7511616000000316","27.42565 -0.7511616000000316 28.949751600000024 -2.275263199999971","28.949751600000024 -2.275263199999971 28.949751600000024 -3.799364799999994","27.426005599999993 -5.323110800000022 28.949751600000024 -3.799364799999994","25.90368200000001 -5.323110800000022 27.426005599999993 -5.323110800000022","24.378158000000024 -3.797586800000035 25.90368200000001 -5.323110800000022","22.85156719999998 -0.7410269999999883 24.378158000000024 -3.797586800000035","19.807453400000046 6.866323800000022 22.85156719999998 -0.7410269999999883","16.760494800000014 11.437206200000038 19.807453400000046 6.866323800000022","13.713358400000029 14.48452039999998 16.760494800000014 11.437206200000038","10.665510799999979 16.00826640000001 13.713358400000029 14.48452039999998","6.0948062 16.00826640000001 10.665510799999979 16.00826640000001","1.523568199999993 14.484164799999988 6.0948062 16.00826640000001","0 11.437383999999994 1.523568199999993 14.484164799999988","0 11.437383999999994 0 6.866323800000022","0 6.866323800000022 1.5257018000000233 3.817587200000034","1.5257018000000233 3.817587200000034 6.094094999997853 0.7724066000014034","6.094095000000016 0.772406599999961 10.668533400000028 -2.278463599999977","10.668533400000028 -2.278463599999977 13.713002800000037 -5.32275520000003","13.713002800000037 -5.32275520000003 15.236748799999985 -8.370247200000007","15.236748799999985 -8.370247200000007 15.236748799999985 -11.417383599999992","13.713180599999992 -14.464875599999969 15.236748799999985 -11.417383599999992","10.665688600000015 -15.988799400000035 13.713180599999992 -14.464875599999969"]},"'":{path:["0 -5.351378 1.5237459999999483 -16.01688879999998","0 -5.351378 3.0473141999999416 -16.016711000000026"]},"`":{path:["0 -8.380124000000029 1.5233904000000376 -9.903514400000066","0 -8.380124000000029 1.5237460000000291 -6.856377999999999","0.00017780000003622264 -15.998142800000032 1.523568199999993 -14.474752399999993","1.523568199999993 -14.474752399999993 3.0469586000000306 -11.427793800000043","1.5237460000000291 -6.856377999999999 3.0469586000000306 -8.3795906","3.0469586000000306 -8.3795906 3.0469586000000306 -11.427793800000043"]},"(":{path:["4.570704599999979 -12.95075140000002 7.618196599999997 -19.046091000000008","3.047136399999986 -8.379691200000007 4.570704599999979 -12.95075140000002","1.5237459999999887 -0.7625613999999867 3.047136399999986 -8.379691200000007","1.5237459999999887 5.332600400000002 1.5237459999999887 -0.7625613999999867","1.5237459999999887 5.332600400000002 3.047136399999986 12.949907999999981","3.047136399999986 12.949907999999981 4.571237999999966 17.52185720000001","4.571237999999966 17.52185720000001 7.618196599999997 23.616129999999984","7.618196599999997 23.616129999999984 10.665688599999974 26.663622","4.570882399999975 19.04524760000001 7.618196599999996 23.616129999999984","1.5237459999999887 12.951508199999983 4.570882399999975 19.04524760000001","0 5.3320670000000145 1.5237459999999887 12.951508199999983","0 5.3320670000000145 0 -0.7614946000000113","0 -0.7614946000000113 1.523568199999993 -8.380580199999986","1.523568199999993 -8.380580199999986 4.571237999999966 -14.475386399999987","4.571237999999966 -14.475386399999987 7.618196599999999 -19.046091000000008","7.618196600000005 -19.046091000000022 10.665688599999974 -22.093760800000023"]},")":{path:["3.0480254000000055 -19.04591320000001 6.0948062 -12.951284800000007","6.0948062 -12.951284800000007 7.618907800000021 -8.377735400000017","7.618907800000021 -8.377735400000017 9.141942600000027 -0.7623835999999908","9.141942600000027 5.332778199999998 9.141942600000027 -0.7623835999999908","7.617841000000006 12.952397200000002 9.141942600000027 5.332778199999998","6.094628400000004 17.522035000000006 7.617841000000006 12.952397200000002","3.0471364207661926 23.61666333772206 6.094628400000004 17.522035000000006","0.0001777999999957956 26.663622 3.0474919792399064 23.616130010386698","3.047491979239907 23.616130010386698 6.0948062 19.04524760000001","6.0948062 19.04524760000001 9.142120400000023 12.950263599999973","9.142120400000023 12.950263599999973 10.665688600000015 5.332422600000006","10.665688600000015 5.332422600000006 10.665688600000015 -0.7623835999999908","9.141942600000027 -8.380935800000021 10.665688600000015 -0.7623835999999908","6.094984000000036 -14.474675200000004 9.141942600000027 -8.380935800000021","3.0480254000000055 -19.04591320000001 6.094984000000036 -14.474675200000004","0 -22.093760800000023 3.0480254000000055 -19.04591320000001"]},"*":{path:["0 11.422739599999984 15.237282200000013 2.280441399999927","0.0005334000000278139 2.280796999999999 15.237282200000013 11.422739599999984","7.618729999999984 15.993622 7.618729999999984 -2.2902632000000525"]},"+":{path:["0 2.2954414000000067 27.425116600000056 2.2954414000000067","13.711758200000027 16.008622 13.711758200000027 -11.418628200000002"]},",":{path:["0 22.088622 1.5241016000000207 20.564520399999978","0.0000889000000181067 14.470336499999945 1.5237460000000291 12.946679400000015","0.00008890000001811618 14.470336499999945 1.5239237999999846 15.994171399999992","1.5237460000000291 12.946679400000015 3.0473142000000224 14.470247600000008","1.5241016000000207 20.564520399999978 3.0473142000000224 17.517917400000023","3.0473142000000224 17.517917400000023 3.0473142000000224 14.470247600000008"]},"-":{path:["0 2.284622 27.439162800000005 2.284622"]},".":{path:["0 14.479698199999977 1.523923800000025 12.955952199999988","0 14.479698199999977 1.523923800000025 16.003622","1.523923800000025 16.003622 3.0478476000000096 14.479698199999977","1.523923800000025 12.955952199999988 3.0478476000000096 14.479698199999977"]},"/":{path:["0 16.018622 31.9972436 -15.978621599999997","0 16.018622 3.0473142000000224 16.018622","3.0473142000000224 16.018622 35.04455780000002 -15.978621599999997","31.9972436 -15.978621599999997 35.04455780000002 -15.978621599999997"]},":":{path:["0 14.479698199999977 1.523923800000025 12.956129999999984","0 14.479698199999977 1.523923800000025 16.003622","1.523923800000025 16.003622 3.0476698000000138 14.479875999999972","1.523923800000025 12.956129999999984 3.0476698000000138 14.479875999999972","0.0001777999999957956 -3.804186999999997 1.523923800000025 -5.327933000000025","0.0001777999999957956 -3.804186999999997 1.523923800000025 -2.280441000000007","1.523923800000025 -2.280441000000007 3.0476698000000138 -3.804186999999997","1.523923800000025 -5.327933000000025 3.0476698000000138 -3.804186999999997"]},";":{path:["0 22.088622 1.5241016000000207 20.564520399999978","0.0000889000000181161 14.470336499999945 1.5237460000000291 12.946679400000015","0.00008890000001812551 14.470336499999945 1.5239237999999846 15.994171399999992","0.0008890000000194051 -3.8134598000000075 1.5239237999999846 -5.337561400000027","0.0008890000000194051 -3.8134598000000075 1.5241016000000207 -2.2902472000000067","1.5237460000000291 12.946679400000015 3.0473142000000224 14.470247600000008","1.5239237999999846 -5.337561400000027 3.0476698000000124 -3.8138153999999993","1.5241016000000207 20.564520399999978 3.0473142000000224 17.517917400000023","1.5241016000000207 -2.2902472000000067 3.047669800000011 -3.8138153999999993","3.0473142000000224 17.517917400000023 3.0473142000000224 14.470247600000008"]},"<":{path:["0 2.2906192000000036 24.379047000000003 16.003622","0 2.2906192000000036 24.378869200000008 -11.422383599999991"]},"=":{path:["0 6.858622 27.426716799999976 6.858622","0.0005334000000278139 -2.2831427999999505 27.42689460000001 -2.2831427999999505"]},">":{path:["0 16.003622 24.378513600000016 2.2907969999999995","0 -11.422028 24.378513600000016 2.2907969999999995"]},"?":{path:["0 -8.385069400000054 1.5237460000000291 -6.861323400000022","0 -8.385069400000054 0 -9.908637600000047","0 -9.908637600000047 1.5233903999999567 -12.955596199999993","1.5233903999999567 -12.955596199999993 3.0473142000000224 -14.47952000000006","1.5237460000000291 -9.9088154 3.0474919999999774 -8.385069400000054","1.5237460000000291 -6.861323400000022 3.0474919999999774 -8.385069400000054","3.0473142000000224 -14.47952000000006 6.094633862840461 -16.003621599999995","6.094633862840461 -16.003621599999995 10.666221999999962 -16.003621599999995","7.618374399999992 14.46987599999997 9.142120400000023 15.993622","7.618374399999992 14.46987599999997 9.141942599999986 12.946129999999942","9.141942599999986 12.946129999999942 10.66586639999997 14.46987599999997","9.142120400000023 0.756784646861166 15.23657100000003 -2.2902632000000525","9.142120400000023 5.327755599999949 9.142120400000023 0.756784646861166","9.142120400000023 15.993622 10.66586639999997 14.46987599999997","10.666221999999937 -16.003621600000006 15.237459999999968 -14.479697800000013","10.666221999999951 -16.003621600000002 13.712113800000019 -14.480408999999996","12.18925662217202 -0.7666947402491352 15.23709971109142 -3.8148888216356456","13.712113800000019 -14.480408999999996 15.236037600000003 -12.956485200000012","15.236037600000003 -12.956485200000012 16.760494800000014 -9.908459800000008","15.23657100000003 -2.2902632000000525 16.760139200000022 -3.813831400000045","15.237099711091417 -3.8148888216356385 16.760494800000014 -6.861856800000052","15.237459999999968 -14.479697800000013 16.760139200000022 -12.957018600000042","16.760139200000022 -12.957018600000042 18.284063000000007 -9.90934880000003","16.760139200000022 -3.813831400000045 18.284063000000007 -6.861679000000014","16.760494800000014 -6.861856800000052 16.760494800000014 -9.908459800000008","18.284063000000007 -6.861679000000014 18.284063000000007 -9.90934880000003"]},"@":{path:["25.902259599999965 12.951307799999979 27.426005599999993 11.427739599999985","22.854234199999958 14.475231599999963 25.902259599999965 12.951307799999979","18.284596399999955 15.998622000000001 22.854234199999958 14.475231599999963","13.713002799999957 15.998622000000001 18.284596399999955 15.998622000000001","9.142120399999941 14.474698200000017 13.713002799999957 15.998622000000001","6.0948062 12.951485600000014 9.142120399999941 14.474698200000017","3.0476698000000138 9.904171399999992 6.0948062 12.951485600000014","1.5239237999999846 6.857035000000006 3.0476698000000138 9.904171399999992","0 2.285619199999962 1.5239237999999846 6.857035000000006","0 2.285619199999962 0 -2.284729800000024","0 -2.284729800000024 1.5233903999999567 -6.856145599999987","1.5233903999999567 -6.856145599999987 3.0476698000000138 -9.904170999999991","3.0476698000000138 -9.904170999999991 6.0948062 -12.951307400000058","6.0948062 -12.951307400000058 9.143009399999961 -14.475053400000004","9.143009399999961 -14.475053400000004 13.713180599999992 -15.998443800000043","9.142120399999941 6.856501599999978 12.189434599999966 8.380425399999964","7.618552199999948 3.8090095999999996 9.142120399999941 6.856501599999978","7.618552199999948 3.8090095999999996 7.618552199999948 -0.7624062000000418","7.618552199999948 -0.7624062000000418 9.142298199999978 -5.33275520000003","9.142298199999978 -5.33275520000003 10.666221999999962 -6.856679000000014","10.666221999999962 -6.856679000000014 13.713358399999947 -8.380069400000053","21.331554999999984 -6.856501200000061 22.855301000000015 -3.80865360000001","18.284063000000007 -8.380069400000053 21.331554999999984 -6.856501200000061","13.713358399999947 -8.380069400000053 18.284063000000007 -8.380069400000053","10.665688599999934 -5.33275520000003 13.713358399999947 -8.380069400000053","9.142120399999941 -0.7611616000000314 10.665688599999934 -5.33275520000003","9.142120399999941 3.8086540000000095 9.142120399999941 -0.7611616000000314","9.142120399999941 3.8086540000000095 10.66586639999997 6.856857199999969","10.66586639999997 6.856857199999969 12.189434599999963 8.380425399999964","12.189434599999963 8.380425399999964 16.76031699999998 8.380425399999964","16.76031699999998 8.380425399999964 19.807453399999964 6.857390599999998","19.807453399999964 6.857390599999998 21.33137719999995 3.809542999999948","21.33137719999995 3.809542999999948 22.85494539999994 -8.379358199999988","21.33137719999995 6.856501599999978 21.33137719999995 3.809542999999948","21.33137719999995 6.856501599999978 24.378691399999973 8.380247600000008","22.85512319999998 3.809720799999983 24.378869200000008 -8.380780600000037","22.85512319999998 6.856679400000014 22.85512319999998 3.809720799999983","22.85512319999998 6.856679400000014 24.378691399999973 8.380247600000008","24.378691399999973 8.380247600000008 27.42618339999995 8.380247600000008","27.42618339999995 8.380247600000008 30.47278639999999 5.334177999999996","30.47278639999999 5.334177999999996 31.997065799999966 0.7624065999999612","31.997065799999966 0.7624065999999612 31.997065799999966 -2.2852632000000526","30.47385319999996 -6.856145599999987 31.997065799999966 -2.2852632000000526","28.949751599999942 -9.9038154 30.47385319999996 -6.856145599999987","25.902615199999957 -12.95112960000002 28.949751599999942 -9.9038154","22.853522999999974 -14.475231200000042 25.902615199999957 -12.95112960000002","18.284596399999955 -15.998443800000043 22.853522999999974 -14.475231200000042","13.713180599999992 -15.998443800000043 18.284596399999955 -15.998443800000043"]},A:{path:["18.306821400000036 15.992043199999944 27.426005599999993 15.992754400000006","13.712647200000045 -11.427383800000003 22.855182140789015 15.992397924072641","6.094696129663703 6.850278399999994 19.806939524461992 6.850278399999994","0 15.992754400000006 9.141764800000031 15.992754400000006","3.047254931357366 15.992754400000006 13.712825 -16.00448919999999","13.712825 -16.00448919999999 24.378612177625072 15.992516735516578"]},B:{path:["18.270584389385025 16.00376340194918 21.331554999999906 14.472742400000023","0.0016002000000025875 15.99737739999999 18.290289015363342 15.997199535991482","18.290289015363346 15.997199535991482 22.8576124 14.47576499999999","22.8576124 14.47576499999999 24.381002800000037 12.949885400000012","24.381002800000037 12.949885400000012 25.901726200000017 9.908083539668437","25.901726200000017 9.908083539668437 25.901726200000017 5.3315110000000185","24.378157999999942 2.2840190000000415 25.901726200000017 5.3315110000000185","22.853878600000048 0.7604508000000472 24.378157999999942 2.2840190000000415","18.28370739999991 -0.7634729999999497 22.853878600000048 0.7604508000000472","18.28370739999994 -0.7634729999999337 22.85458980000003 -2.2872189999999666","22.85458980000003 -2.2872189999999666 24.37833579999998 -3.811142799999949","24.37833579999998 -3.811142799999949 25.902081799999927 -6.86023500000001","25.901904000000055 -9.905593399999958 25.902081799999927 -6.86023500000001","24.378869199999926 -12.95201859999996 25.901904000000055 -9.905593399999958","22.854234199999958 -14.476653600000006 24.378869199999926 -12.95201859999996","18.28352959999998 -16.000043999999964 22.854234199999958 -14.476653600000006","0 -16.000043999999964 18.28352959999998 -16.000043999999964","4.5703490029639955 -16.000043999999964 4.570882414079176 15.997332962104048","6.09391719999998 15.997318150048631 6.09391719999998 -16.00004399999996","6.09391719999998 -0.7634729999999372 18.283707399999937 -0.7634729999999372","18.28352959999998 -16.000043999999964 21.331021599999957 -14.476297999999936","21.33102159999996 -14.476297999999936 22.854767599999906 -12.952374199999952","22.854767599999906 -12.952374199999952 24.37833579999998 -9.90417062638345","24.37833579999998 -6.858101399999981 24.37833579999998 -9.90417062638345","22.854767599999906 -3.811142799999949 24.37833579999998 -6.858101399999981","21.330843799999922 -2.2872189999999666 22.854767599999906 -3.811142799999949","18.283707399999937 -0.7634729999999372 21.330843799999922 -2.2872189999999666","18.283707399999937 -0.7634729999999372 21.331199399999996 0.760628600000004","21.331199399999996 0.760628600000004 22.854767599999906 2.2843746000000333","22.854767599999906 2.2843746000000333 24.378157999999942 5.332222200000002","24.37708978640151 9.907024971344184 24.378157999999942 5.332222200000002","22.857434599999966 12.950241000000004 24.37708978640151 9.907024971344185","20.562196263333856 15.240397825550149 22.857434599999966 12.950241000000004"]},C:{path:["7.618729999999903 14.475053800000008 10.665688600000006 15.998622","4.571415800000043 11.425250399999964 7.618729999999903 14.475053800000008","3.055315200000035 8.397849799999955 4.571415800000043 11.425250399999964","1.5244571999999315 3.8145213999999914 3.055315200000035 8.397849799999955","1.5235681999999122 -3.80260839999999 1.5244571999999315 3.8145213999999914","1.5235681999999122 -3.80260839999999 3.047136399999986 -8.379891600000015","3.047136399999986 -8.379891600000015 4.575149599999995 -11.428094800000054","4.575149599999995 -11.428094800000054 7.619085599999976 -14.47487560000005","7.619085599999976 -14.47487560000005 10.664977400000003 -15.998443800000043","21.336177800000037 11.422583399999986 22.85458980000003 8.380780999999955","18.28495200000003 14.47452039999998 21.336177800000037 11.422583399999986","13.71887019999994 15.996843999999962 18.28495200000003 14.47452039999998","10.665688600000012 15.998622000000001 13.71887019999994 15.996843999999962","6.098006599999924 14.466874999999959 10.665688600000012 15.998622000000001","3.0466030000000393 11.42116099999994 6.098006599999924 14.466874999999959","1.51858980000003 8.380780999999955 3.0466030000000393 11.42116099999994","0 3.812032199999969 1.51858980000003 8.380780999999955","0 3.812032199999969 0.005333999999954722 -3.8369238000000294","0.005333999999954722 -3.8369238000000294 1.5235681999999122 -8.381491800000017","1.5235681999999122 -8.381491800000017 3.04571400000002 -11.426316800000016","3.04571400000002 -11.426316800000016 6.094806199999919 -14.47487560000005","6.094806199999919 -14.47487560000005 10.664977400000073 -15.998443800000043","10.664977400000073 -15.998443800000043 13.713536199999984 -15.998443800000043","13.713536199999984 -15.998443800000043 18.283885199999972 -14.475231200000042","18.283885199999972 -14.475231200000042 21.331554999999906 -11.428094800000054","21.331554999999906 -11.428094800000054 22.85512319999998 -15.998088200000051","21.331554999999906 -11.428094800000054 22.85547880000005 -6.857034600000006","22.85512319999998 -15.998088200000051 22.85547880000005 -6.857034600000006"]},D:{path:["0 -15.992553199999923 15.236571000000003 -15.992553199999923","0.0003555999999915912 16.00451260000004 15.236748799999985 16.00451260000004","4.5710601999999705 16.00451260000004 4.5710601999999705 -15.992553199999923","6.094450600000008 16.00451260000004 6.094450600000008 -15.992553199999927","15.236571000000005 -15.992553199999923 19.807275600000008 -14.468984999999927","15.236571000000025 -15.992553199999923 18.28352959999998 -14.469162799999966","15.236748799999983 16.004512600000044 18.28477419999999 14.480588800000056","15.236748799999988 16.00451260000004 19.807809000000038 14.48041100000002","18.28352959999998 -14.469162799999966 21.33137720000003 -11.42149299999995","18.28477419999999 14.480588800000056 21.33102160000004 11.434341400000008","19.807275600000008 -14.468984999999927 22.85458980000003 -11.421670799999989","19.807809000000038 14.48041100000002 22.855301000000015 11.432919000000043","21.33102160000004 11.434341400000008 22.855301000000015 8.385427000000066","21.33137720000003 -11.42149299999995 22.854767599999988 -8.374356599999969","22.85458980000003 -11.421670799999989 24.379935999999983 -8.372400799999975","22.854767599999988 -8.374356599999969 24.378513600000016 -3.802407399999977","22.855301000000015 8.385427000000066 24.378513600000016 3.8159670000000148","22.855301000000015 11.432919000000043 24.378691399999973 8.386316000000003","24.378513600000016 3.8159670000000148 24.378513600000016 -3.802407399999977","24.378691399999973 8.386316000000003 25.9024374 3.8147224000000044","24.379935999999983 -8.372400799999975 25.9024374 -3.8033038401951966","25.9024374 3.8147224000000044 25.9024374 -3.8033038401951966"]},E:{path:["6.098185581001718 15.989376399999976 6.1022728176978545 -16.00800034100042","4.577817118643815 15.989376399999976 4.5840395675023045 -16.008055688353792","15.243683000000024 5.3245767999999805 15.243683000000024 -6.86450219999999","6.1003264417921 -0.7705850000000112 15.243683000000024 -0.7705850000000112","22.862086964209652 15.989376399999976 24.382958600000034 6.8428110000000215","24.382958600000034 15.989376399999976 24.382958600000034 6.8428110000000215","0.011734800000045925 15.989376399999976 24.382958600000034 15.989376399999976","22.861725978033487 -16.0073893733667 24.3859812 -6.8661023999999955","24.3859812 -6.8661023999999955 24.38615900000004 -16.007333799999994","0 -16.008222800000013 24.386159000000042 -16.007333799999994"]},F:{path:["15.236393199999995 5.331130399999945 15.236393199999995 -6.857415199999998","6.094628400000045 -0.7617200000000608 15.236393199999995 -0.7617200000000608","0 15.997530199999945 10.6731562 15.997530199999945","6.094628400000045 15.997530199999945 6.094628400000045 -15.999357800000062","4.566970800000027 15.997530199999945 4.566970800000027 -15.999357800000066","22.854379561370333 -15.999357800000062 24.37869140000005 -6.852792400000027","24.37869140000005 -6.852792400000027 24.37869140000005 -15.999357800000062","0.00017780000003622264 -15.999357800000062 24.37869140000005 -15.999357800000062"]},G:{path:["7.620508000000023 14.477009600000002 10.66551080000006 15.998088599999972","4.571238000000007 11.42756179999995 7.620508000000023 14.477009600000002","3.0499811999999995 8.391982399999973 4.571238000000007 11.42756179999995","1.5232126000000015 3.808298399999936 3.0499811999999995 8.391982399999973","1.5232126000000015 3.808298399999936 1.523568199999993 -3.8098982000000206","1.523568199999993 -3.8098982000000206 3.044113800000017 -8.374202000000071","3.044113800000017 -8.374202000000071 4.569104400000057 -11.426494600000051","4.569104400000057 -11.426494600000051 7.618196600000037 -14.475231200000042","7.618196600000037 -14.475231200000042 10.664799599999988 -15.998977200000066","22.855123200000058 15.998622000000001 22.855123200000058 3.808653999999928","21.331910600000057 15.997555199999946 21.331910600000057 3.808653999999928","16.76102820000004 3.808653999999928 27.426361199999985 3.808653999999928","18.284240800000045 14.474342599999943 21.331910600000057 11.427206168883401","13.713180599999992 15.998088599999972 18.284240800000045 14.474342599999943","10.66551080000006 15.998088599999972 13.713180599999992 15.998088599999972","6.0948062 14.47452039999998 10.66551080000006 15.998088599999972","3.0480254000000055 11.428272999999933 6.0948062 14.47452039999998","22.855123200000058 -6.857034600000006 22.855123200000058 -15.998266000000008","21.331554999999984 -11.427561400000027 22.855123200000058 -6.857034600000006","21.331554999999984 -11.427561400000027 22.855123200000058 -15.998266000000008","18.2844186 -14.475409000000077 21.331554999999984 -11.427561400000027","13.713358400000029 -15.99897720000007 18.2844186 -14.475409000000077","10.664799599999995 -15.99897720000007 13.713358400000029 -15.99897720000007","6.0948062 -14.475409000000077 10.664799600000004 -15.99897720000007","3.0466030000000393 -11.427561400000027 6.0948062 -14.475409000000077","1.5244572000000125 -8.38273640000003 3.0466030000000393 -11.427561400000027","0 -3.8098982000000206 1.5244572000000125 -8.38273640000003","0 3.8093652414837305 0 -3.8098982000000206","0 3.8093652414837305 1.524279400000057 8.38184779999993","1.524279400000057 8.38184779999993 3.0480254000000055 11.428272999999933"]},H:{path:["25.902259600000047 15.977684800000004 25.902259600000047 -16.020981200000044","0.00017780000003622264 -16.020981200000044 10.663554999999985 -16.020981200000044","4.570704599999979 15.976084600000002 4.570704599999979 -16.020981200000044","0 15.976084600000002 10.673867399999983 15.976084600000002","6.094450600000008 15.976084600000002 6.094450600000008 -16.020981200000044","6.094450600000008 -0.7845880000000491 24.378513600000016 -0.7845880000000491","19.80816460000003 -16.020981200000044 30.474386599999992 -16.020981200000044","24.378513600000016 15.977684800000004 24.378513600000016 -16.020981200000044","19.784339400000025 15.977684800000004 30.468163600000018 15.977684800000004"]},I:{path:["6.094628400000045 16.003821399999993 6.094628400000045 -15.9934222","0.003911599999988358 16.003821399999993 10.66462180000004 16.003821399999993","4.5708824000000154 16.003821399999993 4.5708824000000154 -15.993422200000007","0 -15.993422200000007 10.651642400000064 -15.993422200000007"]},J:{path:["7.618730000000065 16.008622 10.665688600000015 14.485231600000043","10.665688600000015 14.485231600000043 12.189434599999963 9.914349200000029","12.189434599999963 9.914349200000029 12.189434599999963 -15.988266000000008","1.5239237999999846 9.913993600000037 3.0474920000000583 8.3906032","1.522323599999982 6.867924000000025 3.0474920000000583 8.3906032","0 8.390247600000007 1.522323599999982 6.867924000000025","0 11.437739599999984 0 8.390247600000007","0 11.437739599999984 1.5233904000000376 14.485053800000008","1.5233904000000376 14.485053800000008 4.570348999999988 16.008622","4.570348999999988 16.008622 7.618730000000065 16.008622","7.618730000000065 16.008622 9.143720599999943 14.476341600000012","9.143720599999943 14.476341600000012 10.665688600000015 9.922883599999988","10.665688600000015 9.922883599999988 10.665688600000015 -15.988266000000008","6.095161799999992 -15.988266000000008 16.760139200000022 -15.988266000000008"]},K:{path:["13.713002800000037 -2.2864645999999897 25.90190406223669 15.99795400000001","19.806208799999954 15.99795400000001 28.945840000000036 15.99795400000001","12.189057106551541 -2.2863196346695 24.37869133087971 15.997954000000012","6.094272799999972 3.808519372872059 25.901726200000017 -15.999111799999953","19.812965200000036 -15.999111799999953 28.949751600000024 -15.999111799999953","6.094272799999972 15.99795400000001 6.094272799999972 -15.999467399999945","0.0008890000000194051 15.99795400000001 10.665155200000068 15.99795400000001","4.5707046000000595 15.99795400000001 4.5707046000000595 -15.999467399999938","0 -15.999467399999945 10.664977400000032 -15.999467399999945"]},L:{path:["21.33096215369546 15.999376399999976 22.854411999999996 6.857611599999945","22.854411999999996 15.999376399999976 22.854411999999996 6.857611599999945","0.00231139999998577 15.999376399999976 22.854411999999996 15.999376399999976","6.093917200000061 15.999376399999976 6.093917200000061 -15.997867200000021","4.570348999999988 15.999376399999976 4.570348999999988 -15.997867200000021","0 -15.997867200000021 10.664977400000032 -15.997867200000021"]},M:{path:["0.007823199999976715 15.988175000000039 9.141942599999904 15.988175000000039","4.570526799999862 15.988175000000039 4.570526799999862 -16.00800179999998","27.424938799999858 15.988886200000023 27.424938799999858 -16.008535200000004","21.33173279999994 15.988886200000023 31.997421399999954 15.988886200000023","25.902259599999965 15.988886200000023 25.902259599999965 -16.00853520000002","25.902259599999965 -16.00853520000001 31.9963545999999 -16.00853520000001","15.236393199999913 15.989063999999978 25.902259599999965 -16.00853520000001","4.57076386534923 -16.00800179999998 15.236393199999913 15.989063999999978","6.094450600000008 -16.00800179999998 15.236393199999913 11.418181600000043","0 -16.00800179999998 6.094450600000008 -16.00800179999998"]},N:{path:["4.570882399999935 16.00613280000006 4.570882399999935 -15.991110799999936","0.00017779999987451448 16.00613280000006 9.141586999999994 16.00613280000006","19.808342399999905 -15.990932999999982 28.94975159999986 -15.990932999999982","24.37833579999998 16.00702180000008 24.37833579999998 -15.990932999999982","6.094450599999846 -12.943974399999954 24.37833579999998 16.00702180000008","6.094806199999919 -15.99111079999994 24.37833579999998 12.95528226121576","0 -15.99111079999994 6.094806199999919 -15.99111079999994"]},O:{path:["13.713002800000037 16.008622 16.76067259999997 14.484698200000016","16.76067259999997 14.484698200000016 19.80816460000003 11.436850600000046","19.80816460000003 11.436850600000046 21.331199399999996 8.39149220000002","21.331199399999996 8.39149220000002 22.855301000000015 2.2956192000000435","22.85512319999998 -2.275085399999936 22.855301000000015 2.2956192000000435","21.33137720000003 -8.370247200000007 22.85512319999998 -2.275085399999936","19.807808999999956 -11.417561399999945 21.33137720000003 -8.370247200000007","16.760850400000006 -14.464519999999977 19.807808999999956 -11.417561399999945","13.714069600000093 -15.988621599999997 16.760850400000006 -14.464519999999977","10.665688600000015 -15.988621599999997 13.714069600000093 -15.988621599999997","13.714069600000093 -15.988621599999997 18.284063000000007 -14.464875599999969","18.284063000000007 -14.464875599999969 21.331555000000066 -11.417383599999992","21.331555000000066 -11.417383599999992 22.855301000000015 -8.36971379999998","22.855301000000015 -8.36971379999998 24.37886920000009 -2.275263199999971","24.37886920000009 2.296508200000062 24.37886920000009 -2.275263199999971","22.85494539999994 8.39149220000002 24.37886920000009 2.296508200000062","21.33173279999994 11.437206200000038 22.85494539999994 8.39149220000002","18.28441860000008 14.484698200000016 21.33173279999994 11.437206200000038","13.713002800000037 16.008622 18.28441860000008 14.484698200000016","10.665866400000052 16.008622 13.713002800000037 16.008622","6.094983999999955 14.485053800000008 10.665866400000057 16.008622000000003","3.0482032000000414 11.438095200000058 6.094983999999955 14.485053800000008","1.5233904000000376 8.38971420000006 3.0482032000000414 11.438095200000058","0 2.2954414000000067 1.5233904000000376 8.38971420000006","0 2.2954414000000067 0.0005333999999469598 -2.2882425999999487","0.0005333999999469598 -2.2882425999999487 1.5237459999999483 -8.370247200000007","1.5237459999999483 -8.370247200000007 3.0476698000000946 -11.417916999999937","3.0476698000000946 -11.417916999999937 6.094628400000045 -14.464697799999934","6.094628400000045 -14.464697799999934 10.665688600000017 -15.988621599999997","7.618196599999957 -14.464875599999969 10.665688600000012 -15.988621599999997","4.571238000000007 -11.417916999999937 7.618196599999957 -14.464875599999969","3.04695859999995 -8.369358199999988 4.571238000000007 -11.417916999999937","1.5232126000000015 -2.2738408000000057 3.04695859999995 -8.369358199999988","1.5232126000000015 -2.2738408000000057 1.5239237999999846 2.2940190000000413","1.5239237999999846 2.2940190000000413 3.047136399999986 8.389536400000026","3.047136399999986 8.389536400000026 4.572127000000026 11.439873200000015","4.572127000000026 11.439873200000015 7.618196599999957 14.484520400000061","7.618196599999957 14.484520400000061 10.66586640000006 16.008622000000006"]},P:{path:["18.284063000000007 0.7607000000000372 21.330843799999922 -0.7619792000000185","21.330843799999922 -0.7619792000000185 22.855656599999925 -2.2867919999999415","22.855656599999925 -2.2867919999999415 24.378869199999926 -5.334817399999947","24.378869199999926 -5.334817399999947 24.3792248 -9.9039218","22.85583439999996 -12.951591600000016 24.3792248 -9.9039218","21.332799599999998 -14.4755154 22.85583439999996 -12.951591600000016","18.28761899999997 -15.999616999999938 21.332799599999998 -14.4755154","0.0007111999999831824 15.997448800000022 10.66586639999989 15.997448800000022","4.5710601999999705 15.997448800000022 4.5710601999999705 -15.999616999999946","6.094806199999919 15.997448800000022 6.094806199999919 -15.999616999999946","6.094806199999919 0.7607000000000372 18.284063000000007 0.7607000000000372","18.284063000000007 0.7607000000000372 22.855656599999925 -0.7632237999999489","22.855656599999925 -0.7632237999999489 24.3792248 -2.2873253999999683","24.3792248 -2.2873253999999683 25.902259599999965 -5.33766219999996","25.902259599999965 -5.33766219999996 25.902259599999965 -9.905522000000003","24.378157999999942 -12.952836199999945 25.902259599999965 -9.905522000000003","22.854767599999906 -14.476048799999946 24.378157999999942 -12.952836199999945","18.28761899999993 -15.999616999999938 22.854767599999906 -14.476048799999946","0 -15.999616999999938 18.28761899999993 -15.999616999999938"]},Q:{path:["16.76120600000008 11.432565599999998 18.2853076000001 22.095764999999993","18.2853076000001 22.095764999999993 19.80816460000003 23.618622000000002","19.80816460000003 23.618622000000002 22.85512319999998 23.618622000000002","22.85512319999998 23.618622000000002 24.379046999999954 20.57112999999996","24.379046999999964 20.57112999999995 24.379046999999964 19.04756179999995","22.856190000000034 22.095587199999954 24.379046999999964 20.57112999999995","21.331555000000066 22.095587199999954 22.856190000000034 22.095587199999954","19.807453400000046 20.571485599999935 21.331555000000066 22.095587199999954","18.284596400000115 17.525060399999933 19.807453400000046 20.571485599999935","16.76120600000008 11.432565599999998 18.284596400000115 17.525060399999933","15.236571000000112 8.381517599999944 16.76120600000008 11.432565599999998","12.189790200000036 6.858304999999941 15.236571000000112 8.381517599999944","10.665510799999979 6.858304999999941 12.189790200000036 6.858304999999941","7.618907800000102 8.381339799999987 10.665510799999979 6.858304999999941","6.095517400000064 11.4290096 7.618907800000102 8.381339799999987","6.095517400000064 12.953377899999955 6.095517400000064 11.4290096","13.71673659999999 -15.997351600000066 16.76031700000006 -14.473250000000043","16.76031700000006 -14.473250000000043 19.80798679999999 -11.426113600000054","19.80798679999999 -11.426113600000054 21.331199399999996 -8.379155000000026","21.331199399999996 -8.379155000000026 22.85512319999998 -2.2939500000000415","22.85512319999998 2.2870669999999365 22.85512319999998 -2.2939500000000415","21.332088400000014 8.380628599999923 22.85512319999998 2.2870669999999365","19.80763120000008 11.4290096 21.332088400000014 8.380628599999923","16.76031700000006 14.47650159999998 19.80763120000008 11.4290096","13.712825000000024 16.00024759999992 16.76031700000006 14.47650159999998","7.619441200000049 14.476679399999934 10.665688600000015 16.000247599999927","4.571593600000079 11.430076399999976 7.619441200000049 14.476679399999934","3.0474920000000583 8.381873199999935 4.571593600000079 11.430076399999976","1.5239237999999846 2.2931121999999533 3.0474920000000583 8.381873199999935","1.5239237999999846 2.2931121999999533 1.526057400000096 -2.2866602000000142","1.526057400000096 -2.2866602000000142 3.0473142000000224 -8.378266000000007","3.0473142000000224 -8.378266000000007 4.570882400000096 -11.425935800000019","4.570882400000096 -11.425935800000019 7.618730000000065 -14.473427799999996","7.618730000000065 -14.473427799999996 10.666221999999928 -15.997351600000066","6.094628400000045 -14.472894400000051 10.666221999999967 -15.997351600000066","3.0473142000000224 -11.425758000000062 6.094628400000045 -14.472894400000051","1.5235682000000739 -8.378266000000007 3.0473142000000224 -11.425758000000062","0 -2.2841710000000717 1.5235682000000739 -8.378266000000007","0 -2.2841710000000717 0.0003556000000724453 2.2876003999999632","0.0003556000000724453 2.2876003999999632 1.5219680000000713 8.377250399999962","1.5219680000000713 8.377250399999962 3.0478475999999692 11.429720799999984","3.0478475999999692 11.429720799999984 6.094095000000097 14.476323799999943","6.094095000000097 14.476323799999943 10.665688600000015 16.000247599999927","10.665688600000015 16.000247599999927 13.712825 16.000247599999927","13.712825 16.000247599999927 18.284596400000115 14.47650159999998","18.284596400000115 14.47650159999998 21.331555000000066 11.4290096","21.331555000000066 11.4290096 22.854945400000105 8.382228799999925","22.854945400000105 8.382228799999925 24.37869140000005 2.286355799999953","24.37869140000005 2.286355799999953 24.37869140000005 -2.2839932000000367","22.85565660000009 -8.377554800000024 24.37869140000005 -2.2839932000000367","21.331199399999996 -11.42629140000001 22.85565660000009 -8.377554800000024","18.283885199999972 -14.473427799999996 21.331199399999996 -11.42629140000001","13.71673659999999 -15.997351600000066 18.283885199999972 -14.473427799999996","10.666221999999967 -15.997351600000066 13.71673659999999 -15.997351600000066"]},R:{path:["0 16.01625239999999 10.66337720000003 16.01625239999999","4.5710601999999705 16.01625239999999 4.5710601999999705 -15.980991200000009","6.094983999999955 16.01625239999999 6.094983999999955 -15.980991200000009","16.76209499999994 0.7811038000000057 18.283885199999972 2.302004999999939","18.283885199999972 2.302004999999939 22.854767599999906 12.968226999999983","22.854767599999906 12.968226999999983 24.379402600000034 14.492684199999996","24.379402600000034 14.492684199999996 25.9024374 14.492684199999996","25.9024374 14.492684199999996 27.426361199999995 12.96893819999995","27.426361199999985 12.968938199999966 27.426361199999985 11.444836599999945","25.903148599999984 16.016963599999972 27.426361199999985 12.968938199999965","22.855656599999925 16.016963599999972 25.903148599999984 16.016963599999972","21.33173279999994 14.492328600000004 22.855656599999925 16.016963599999972","18.2851297999999 3.828062399999954 21.33173279999994 14.492328600000004","16.76209499999994 0.7811038000000057 18.2851297999999 3.828062399999954","13.712647614742208 -0.7440645999999909 16.76209499999994 0.7811038000000057","18.284240800000045 -0.7440645999999909 21.332088400000014 -2.268166200000012","21.332088400000014 -2.268166200000012 22.855301000000015 -3.7913788000000146","22.855301000000015 -3.7913788000000146 24.378869199999926 -6.839582000000053","24.378869199999926 -6.839582000000053 24.378869199999926 -9.886185000000012","22.85583439999996 -12.93314360000004 24.378869199999926 -9.886185000000012","21.331554999999906 -14.457245200000063 22.85583439999996 -12.93314360000004","18.289752600000085 -15.980991200000009 21.331554999999906 -14.457245200000063","6.094983999999955 -0.7440645999999909 18.284240800000045 -0.7440645999999909","18.284240800000045 -0.7440645999999909 22.85583439999996 -2.268166200000012","22.85583439999996 -2.268166200000012 24.379402600000034 -3.7919122000000414","24.379402600000034 -3.7919122000000414 25.902615200000035 -6.839048600000027","25.9024374 -9.886718400000039 25.902615200000035 -6.839048600000027","24.378869199999926 -12.933676999999989 25.9024374 -9.886718400000039","22.855301000000015 -14.457245200000063 24.378869199999926 -12.933676999999989","18.289752600000064 -15.980991200000009 22.855301000000015 -14.457245200000063","0.005689600000027167 -15.980991200000009 18.289752600000067 -15.980991200000009"]},S:{path:["18.283529600000062 2.285085800000015 21.33262179999996 5.3334668000000125","15.238348999999989 0.7622288000000061 18.283529600000062 2.285085800000015","6.0953396000000275 -2.2854409999999277 15.238348999999989 0.7622288000000061","3.0478475999999692 -3.8091869999999552 6.0953396000000275 -2.2854409999999277","1.5232126000000015 -5.33435539999995 3.0478475999999692 -3.8091869999999552","0.0003556000000724453 -8.380247199999921 1.5232126000000015 -5.33435539999995","0 15.996132800000058 1.5239237999999846 11.427206200000038","0 15.996132800000058 0 6.85561260000004","0 6.85561260000004 1.5239237999999846 11.427206200000038","1.5239237999999846 11.427206200000038 4.570882400000096 14.474698200000017","4.570882400000096 14.474698200000017 9.142120399999941 15.998622000000001","9.142120399999941 15.998622000000001 13.713002800000037 15.998622000000001","13.713002800000037 15.998622000000001 18.285129800000064 14.4754094","18.285129800000064 14.4754094 21.33262179999996 11.427917400000021","21.33262179999996 11.427917400000021 21.33262179999996 5.3334668000000125","19.80816460000003 2.285441400000007 21.33262179999996 5.3334668000000125","18.283707400000097 0.7613398000000675 19.80816460000003 2.285441400000007","15.241371599999956 -0.7606282000000046 18.283707400000097 0.7613398000000675","6.095517400000064 -3.809009200000002 15.241371599999956 -0.7606282000000046","3.047136399999986 -5.333466399999931 6.095517400000064 -3.809009200000002","0.0003556000000724453 -8.380247199999928 3.047136399999986 -5.333466399999931","0.0003556000000724453 -8.380247199999928 0.0003556000000724453 -11.427561399999945","0.0003556000000724453 -11.427561399999945 3.0476698000000946 -14.475053399999926","3.0476698000000946 -14.475053399999926 7.6144628000000045 -15.998621599999996","7.6144628000000045 -15.998621599999996 12.189434599999963 -15.998621599999996","12.189434599999963 -15.998621599999996 16.76067259999997 -14.475408999999996","16.76067259999997 -14.475408999999996 19.80798679999999 -11.427739199999984","19.80798679999999 -11.427739199999984 21.33173279999994 -15.997732599999978","19.80798679999999 -11.427739199999984 21.33173279999994 -6.8563233999999404","21.33173279999994 -6.8563233999999404 21.33173279999994 -15.997732599999978"]},T:{path:["6.09391719999998 15.995066000000005 16.76031699999998 15.995066000000005","10.665688600000015 15.995066000000005 10.665688600000015 -16.001999800000043","12.189434600000045 15.995066000000005 12.189434600000045 -16.00199980000004","21.331407174250895 -16.00199980000004 22.855656600000007 -6.859346000000073","22.855656600000007 -6.859346000000073 22.855656600000007 -16.00199980000004","0 -16.00199980000004 22.855656600000007 -16.00199980000004","0 -6.859346000000073 1.5235090992012212 -16.00199980000004","0 -6.859346000000073 0 -16.00199980000004"]},U:{path:["0 -15.998621599999996 10.67226719999998 -15.998621599999996","21.32550980000005 -15.998621599999996 30.47278639999999 -15.998621599999996","4.570171200000032 6.856146000000067 4.570171200000032 -15.998621599999996","4.570171200000032 6.856146000000067 6.094272800000053 11.427917400000021","6.094272800000053 11.427917400000021 9.141053600000047 14.474698200000017","9.141053600000047 14.474698200000017 13.712825 15.998622000000001","13.712825 15.998622000000001 16.759250200000004 15.998622000000001","16.759250200000004 15.998622000000001 21.32888800000001 14.474698200000017","21.32888800000001 14.474698200000017 24.378513600000016 11.426672800000011","24.378513600000016 11.426672800000011 25.901370600000025 6.857035000000006","25.901370600000025 6.857035000000006 25.901370600000025 -15.998621599999996","6.09391719999998 6.857035000000006 6.09391719999998 -15.998621599999996","6.09391719999998 6.857035000000006 7.616952000000026 11.42631720000002","7.616952000000026 11.42631720000002 10.665155199999987 14.47452040000006","10.665155199999987 14.47452040000006 13.712825 15.998622000000001"]},V:{path:["18.28317399999999 -15.998621599999996 27.42565 -15.998621599999996","0 -15.998621599999996 9.141409200000039 -15.998621599999996","3.0466030000000393 -15.998621599999996 13.712469400000009 15.998622000000001","13.712469400000009 15.998622000000001 24.37827652016316 -15.998621599999996","4.5707046000000595 -15.998621599999996 13.712291600000054 11.42756180000003"]},W:{path:["18.284240800000045 -16.00235539999995 22.854767600000066 8.377047200000003","6.094272800000054 -16.001822000000004 10.665688600000015 8.378647400000006","22.854945400000023 15.995243800000038 28.949523018627335 -16.001822000000004","16.76031700000006 -16.001999799999957 22.854945400000023 15.99524380000004","10.66462180000004 15.998622000000001 16.76031700000006 -16.001999799999957","0 -16.001822000000004 10.665333000000023 -16.001822000000004","24.37833580000006 -16.001822000000004 33.52063400000004 -16.001822000000004","4.568503164948301 -16.001822000000004 10.66462180000004 15.998622000000001"]},X:{path:["0 -16.023157999999984 9.142476000000014 -16.023157999999984","18.283885199999972 -16.023157999999984 27.42618340000003 -16.023157999999984","3.048380999999997 -16.023157999999984 22.85568199943541 15.973196599999996","4.571881475457717 -16.023157999999984 24.38073060955467 15.973196599999996","3.047788303694577 15.973196599999996 24.378158000000024 -16.023157999999984","0.0012446000000109962 15.973196599999996 9.142298199999978 15.973196599999996","18.284240800000045 15.973196599999996 27.42618340000003 15.973196599999996"]},Y:{path:["15.236215399999958 0.5894071999999699 25.90230818231723 -16.170554200000016","0 -16.170554200000016 9.141409199999957 -16.170554200000016","19.80674219999998 -16.170554200000016 28.949573799999985 -16.170554200000016","4.570704599999983 -16.170554200000016 15.236215399999958 0.5894071999999699","15.236215399999958 15.826511600000028 15.236215399999958 0.5894071999999699","3.047233395022224 -16.170554200000016 13.712825 0.5899405999999967","13.712825 15.826511600000028 13.712825 0.5899406000000003","9.142476000000014 15.826511600000028 19.807808999999956 15.826511600000028"]},Z:{path:["0 15.990798800000023 19.807783583490043 -16.00626700000002","19.807840749814783 15.990963901111472 21.33137720000003 6.849745199999976","21.33137720000003 15.990976599999978 21.33137720000003 6.849745199999973","0 -6.863968800000048 0 -16.00626700000002","0 -6.863968800000048 1.5239235340857213 -16.00626700000002","0 -16.00626700000002 21.33137720000003 -16.00626700000002","1.5237635274907482 15.990811500781252 21.33137720000003 -16.00626700000002","0 15.990798800000023 21.33137720000003 15.990976599999978"]},"[":{path:["0 26.65577719999999 10.665866400000011 26.65577719999999","0 26.65577719999999 0 -22.101783399999984","0 -22.101783399999984 10.664799599999995 -22.101783399999984","1.5237459999999887 26.65577719999999 1.5237459999999887 -22.101783399999984"]},"\\":{path:["0.02009140000004706 -15.994445799999987 32.01733499999997 16.00279780000001","0.02009140000004706 -15.994445799999987 3.0675833999999473 -15.994445799999987","3.0675833999999473 -15.994445799999987 35.06482700000002 16.002797800000007","32.01733499999997 16.00279780000001 35.06482700000003 16.00279780000001"]},"]":{path:["0 26.65382139999999 10.665688600000015 26.65382139999999","0.0007111999999831824 -22.103739199999985 10.665688600000015 -22.103739199999985","9.142120399999982 26.65382139999999 9.142120399999982 -22.103739199999985","10.665688600000015 26.65382139999999 10.665688600000015 -22.103739199999985"]},"^":{path:["-6.938893903907228e-18 -8.381824056927275 12.187657943122021 -14.475564399999985","0 -8.381824056927275 12.187835743122056 -15.999132599999975","12.187657943122021 -14.475564399999985 24.376558236082147 -8.381025639195748","12.187835743122056 -15.999132599999978 24.376558236082147 -8.381025639195748"]},_:{path:["1.52 26.658622 27.422259599999965 26.658622"]},a:{path:["1.5233904000000376 14.47576499999999 6.095339600000025 15.998444199999964","0 11.428095199999976 1.5233904000000376 14.47576499999999","0 11.428095199999976 0 8.380425399999964","0 8.380425399999964 1.5233904000000376 5.3334668000000125","1.5233904000000376 5.3334668000000125 6.094272800000051 3.809543000000028","15.236393199999995 2.2859748000000355 16.760139200000022 0.7622288000000079","6.094272800000054 3.809543000000028 15.236393199999995 2.2859748000000355","3.0467807999999943 5.333644599999968 6.094272800000056 3.809543000000028","1.5233904000000376 8.380958799999991 3.0467807999999943 5.333644599999968","1.5233904000000376 11.42756180000003 1.5233904000000376 8.380958799999991","1.5233904000000376 11.42756180000003 3.047136399999986 14.4754094","3.047136399999986 14.4754094 6.0953396000000275 15.998444199999964","6.0953396000000275 15.998444199999964 10.663910600000056 15.998444199999964","10.663910600000056 15.998444199999964 13.713536199999984 14.475231599999963","13.713536199999984 14.475231599999963 16.760139200000022 11.427739599999985","18.28317399999999 14.474698200000017 21.33102160000004 15.998622000000001","16.760139200000022 11.427739599999985 18.28317399999999 14.474698200000017","16.760139200000022 11.427739599999985 16.760139200000022 -2.284907599999981","16.760139200000022 -2.284907599999981 18.283707400000015 0.7618732000000144","18.283707400000015 11.428628600000005 18.283707400000015 0.7618732000000126","18.283707400000015 11.428628600000005 19.8076312 14.475231599999963","19.8076312 14.475231599999963 21.33102160000004 15.998622000000001","21.33102160000004 15.998622000000001 22.855123200000058 15.998622000000001","15.236393199999995 -3.8088313999999635 16.760139200000022 -2.284907599999981","12.189434600000045 -5.332577399999995 15.236393199999995 -3.8088313999999635","6.0948062 -5.332577399999995 12.189434600000045 -5.332577399999995","3.0474920000000583 -3.809187000000037 6.0948062 -5.332577399999995","1.523568199999993 -2.284907599999981 3.0474920000000583 -3.809187000000037","1.523568199999993 -0.7615172000000232 1.523568199999993 -2.284907599999981","1.523568199999993 -0.7615172000000232 3.0469586000000306 -0.7615172000000232","3.0469586000000306 -0.7615172000000232 3.0469586000000306 -2.284551999999989"]},b:{path:["15.23657100000003 15.998444199999964 18.284240800000045 14.475053800000008","18.284240800000045 14.475053800000008 21.331199399999996 11.427739599999985","21.331199399999996 11.427739599999985 22.854945400000023 6.85596819999995","22.854945400000023 6.85596819999995 22.854945400000023 3.8093651999999913","21.33137720000003 -0.7624062000000418 22.854945400000023 3.8093651999999913","18.283529600000062 -3.8095426000000288 21.33137720000003 -0.7624062000000418","15.23657100000003 -5.333288600000056 18.283529600000062 -3.8095426000000288","6.094628400000045 11.427384310984138 9.141586999999994 14.474698200000017","9.141586999999994 14.474698200000017 12.189079000000053 15.998444199999964","12.189079000000053 15.998444199999964 15.23657100000003 15.998444199999964","15.23657100000003 15.998444199999964 19.827544800000016 14.457985000000008","19.827544800000016 14.457985000000008 22.85458980000003 11.42756179999995","22.85458980000003 11.42756179999995 24.37869140000005 6.853479000000009","24.37869140000005 6.853479000000009 24.379047000000043 3.809542999999948","22.855301000000015 -0.7620506000000518 24.379047000000043 3.809542999999948","19.807453400000046 -3.8095426000000288 22.855301000000015 -0.7620506000000518","15.23657100000003 -5.333288600000056 19.807453400000046 -3.8095426000000288","12.189256800000008 -5.333288600000056 15.23657100000003 -5.333288600000056","9.142476000000014 -3.8098982000000206 12.189256800000008 -5.333288600000056","6.094628400000045 -0.7622284000000139 9.142476000000014 -3.8098982000000206","4.5708824000000154 15.998088599999972 4.5708824000000154 -15.999155000000027","6.094628400000045 15.998622000000001 6.094628400000045 -15.999155000000027","0 -15.999155000000027 6.094628400000045 -15.999155000000027"]},c:{path:["6.094984000000036 14.474875999999972 9.141053599999966 15.998622000000001","3.0474919999999774 11.427028400000003 6.094984000000036 14.474875999999972","1.5239237999999846 6.856679400000014 3.0474919999999774 11.427028400000003","1.5239237999999846 6.856679400000014 1.5239237999999846 3.809898599999938","1.5239237999999846 3.809898599999938 3.0482031999999606 -0.7624062000000418","3.0482031999999606 -0.7624062000000418 6.09391719999998 -3.80865360000001","6.09391719999998 -3.80865360000001 9.141409200000039 -5.3329330000000645","16.761205999999998 14.47452039999998 19.808342399999983 11.427206199999958","12.1896124 15.998622000000001 16.761205999999998 14.47452039999998","9.141053599999966 15.998622000000001 12.1896124 15.998622000000001","4.5710601999999705 14.474698199999935 9.141053599999966 15.998622000000001","1.5239237999999846 11.427739599999985 4.5710601999999705 14.474698199999935","0 6.856501599999978 1.5239237999999846 11.427739599999985","0 6.856501599999978 0 3.8093651999999913","0 3.8093651999999913 1.5239237999999846 -0.761872800000015","1.5239237999999846 -0.761872800000015 4.571771400000035 -3.809364799999994","4.571771400000035 -3.809364799999994 9.141409200000039 -5.3329330000000645","9.141409200000039 -5.3329330000000645 13.713180599999992 -5.3329330000000645","13.713180599999992 -5.3329330000000645 16.77258519999997 -3.7976300000000265","16.77258519999997 -3.7976300000000265 19.808342399999983 -0.761872800000015","19.808342399999983 0.7615175999999426 19.808342399999983 -0.761872800000015","18.283351800000023 2.28401899999996 19.808342399999983 0.7615175999999426","16.760139200000022 0.7622288000000061 18.283351800000023 2.28401899999996","16.760139200000022 0.7622288000000061 18.284240799999964 -0.7609837999999947"]},d:{path:["3.048203199999961 11.42880639999996 6.095161799999991 14.474875999999972","13.713180599999992 -15.998799400000035 19.807809000000038 -15.998799400000035","19.807809000000038 15.998622000000001 19.807809000000038 -15.998799400000035","18.284418600000002 15.998622000000001 18.284418600000002 -15.998799400000038","18.284418600000002 15.998622000000001 24.379046999999964 15.998622000000001","15.236926600000022 -3.809364799999994 18.284418600000002 -0.7627618000000336","12.188190000000032 -5.333288600000056 15.236926600000022 -3.809364799999994","9.141942599999986 -5.333288600000056 12.188190000000032 -5.333288600000056","4.570348999999987 -3.809009200000002 9.141942599999984 -5.333288600000056","1.5242793999999762 -0.76169500000006 4.570348999999987 -3.809009200000002","0 3.809542999999948 1.5242793999999762 -0.76169500000006","0 6.8712587510966685 0 3.809542999999948","0 6.8712587510966685 1.5165452245802642 11.420717506355789","1.5165452245802638 11.420717506355787 4.571415799999962 14.475231599999963","4.571415799999962 14.475231599999963 9.142653799999971 15.998622000000001","9.14265379999997 15.998622000000001 12.189434599999963 15.998622000000001","12.189434599999963 15.998622000000001 15.236215400000038 14.4754094","15.236215400000038 14.4754094 18.284418600000002 11.427383328432791","6.095161799999991 -3.8097203999999856 9.141942599999988 -5.333288600000056","3.048203199999961 -0.7625839999999986 6.095161799999991 -3.8097203999999856","1.5239237999999844 3.8104319999999667 3.048203199999961 -0.7625839999999986","1.5239237999999844 6.871770281141385 1.5239237999999844 3.8104319999999667","1.5239237999999844 6.871770281141385 3.048203199999961 11.42880639999996","6.095161799999991 14.474875999999972 9.14265379999997 15.998622000000001"]},e:{path:["6.095695200000019 14.47576499999999 9.142831600000003 15.998622000000001","3.048558800000033 11.43307359999994 6.095695200000019 14.47576499999999","1.5239237999999846 6.856323799999942 3.048558800000033 11.43307359999994","1.5239237999999846 6.856323799999942 1.5239237999999846 3.8091873999999564","1.5239237999999846 3.8091873999999564 3.0476698000000138 -0.7622284000000068","3.0476698000000138 -0.7622284000000068 6.093205999999997 -3.8079424000000266","6.093205999999997 -3.8079424000000266 9.141942599999991 -5.33275520000003","16.76138380000002 -3.8088314000000594 18.284240800000045 -0.761872800000015","18.284240800000045 3.8091873999999564 18.284240800000045 -0.761872800000015","1.5239237999999846 3.8091873999999564 19.80798679999999 3.8091873999999564","16.76067259999997 14.474875999999972 19.807809000000038 11.42756179999995","12.189256800000008 15.998622000000001 16.76067259999997 14.474875999999972","9.142831600000004 15.998622000000001 12.189256800000008 15.998622000000001","4.571593599999998 14.475053800000008 9.142831600000004 15.998622000000001","1.5241016000000207 11.427917399999941 4.571593599999998 14.475053800000008","0 6.857035000000006 1.5241016000000207 11.427917399999941","0 6.857035000000006 0.0003555999999915912 3.8090095999999996","0.0003555999999915912 3.8090095999999996 1.5244572000000125 -0.7625839999999986","1.5244572000000125 -0.7625839999999986 4.570348999999988 -3.809009200000002","4.570348999999988 -3.809009200000002 9.141942599999986 -5.33275520000003","9.141942599999986 -5.33275520000003 13.713891799999976 -5.33275520000003","13.713891799999976 -5.33275520000003 16.761383800000033 -3.808831400000045","16.761383800000033 -3.808831400000045 18.284596400000037 -2.2849076000000608","18.284596400000037 -2.2849076000000608 19.80798679999999 0.7611619999999508","19.80798679999999 3.8091873999999564 19.80798679999999 0.7611619999999508"]},f:{path:["0 15.987420599999982 10.665688600000015 15.987420599999982","0.0005334000000278139 -5.344312199999958 12.189256800000008 -5.344312199999958","7.618196600000037 -14.486610400000014 9.141764800000031 -16.00875619999996","6.094272799999972 -11.43858500000001 7.618196600000037 -14.486610400000014","6.094272799999972 15.987420599999982 6.094272799999972 -11.43858500000001","4.570704599999979 15.987420599999982 4.570704599999979 -11.438940600000002","4.570704599999979 -11.438940600000002 6.094095000000016 -14.486254800000022","6.094095000000016 -14.486254800000022 9.141764800000031 -16.00875619999996","12.188190000000032 -16.00875619999996 13.712647199999966 -14.484299000000028","9.141764800000031 -16.00875619999996 12.188190000000032 -16.00875619999996","10.665333000000023 -12.962864399999987 12.189434600000045 -14.48643259999998","10.665333000000023 -12.962864399999987 12.187834400000042 -11.437695999999988","12.187834400000042 -11.437695999999988 13.712647199999966 -12.962508799999995","13.712647199999966 -12.962508799999995 13.712647199999966 -14.484299000000028"]},g:{path:["19.8076312 19.050603199999998 21.33102160000004 20.573282399999975","15.23657100000003 17.526679399999935 19.8076312 19.050603199999998","7.618196600000037 17.526679399999935 15.23657100000003 17.526679399999935","3.047136400000067 16.00275559999995 7.618196600000037 17.526679399999935","1.5237460000000325 12.956152599999996 3.047136400000067 16.00275559999995","1.5233904000000376 17.527212799999962 6.0951618000000725 16.003111199999942","0 20.57470479999994 1.5233904000000376 17.527212799999962","0 22.09720619999996 0 20.57470479999994","0 22.09720619999996 1.5235682000000739 25.1454094","16.76031700000006 5.337778199999997 16.76031700000006 -0.7573837868518485","15.237815600000062 -3.8039866000000213 16.76031700000006 -0.7573837868518485","15.237815599999971 -3.803986600000064 16.760139200000022 -2.2805962000000743","12.189256800000008 -5.328088200000051 15.237815599999971 -3.803986600000064","9.142476000000014 -5.328088200000051 12.189256800000008 -5.328088200000051","6.094450600000008 -3.80434220000002 9.142476000000014 -5.328088200000051","4.571060200000051 -0.757205800000035 6.094450600000008 -3.80434220000002","4.571060200000051 5.337778199999997 4.571060200000051 -0.757205800000035","4.571060200000051 5.337778199999997 6.0948062 8.384914599999984","6.0948062 8.384914599999984 9.14265380000005 9.90830499999994","9.14265380000005 9.90830499999994 12.189968000000071 9.90830499999994","12.189968000000071 9.90830499999994 15.234551801262542 8.385746638332348","15.23710440000006 8.380647399999923 16.761205999999998 6.855478999999926","16.761205999999998 6.855478999999926 18.283885200000054 3.80976499999999","18.283885200000054 3.80976499999999 18.284418008721815 0.7665391838921298","16.760139200000022 -2.2805962000000743 18.284418008721815 0.7665391838921298","16.760139200000022 -2.2805962000000743 18.284240800000045 -3.805053400000004","18.284240800000063 -3.805053400000004 21.33137720000003 -5.328799400000035","18.284240800000063 -3.805053400000004 21.33137720000003 -3.805053400000004","21.33137720000003 -3.805053400000004 21.33137720000003 -5.328799400000035","15.23710440000006 8.380647399999923 16.76031700000006 5.337778199999997","4.571415800000043 -2.281307400000058 6.094450600000008 -3.80434220000002","3.0476698000000138 0.7665401999999926 4.571415800000043 -2.281307400000058","3.0476698000000138 3.813320999999986 3.0476698000000138 0.7665401999999926","3.0476698000000138 3.813320999999986 4.571415800000043 6.861524199999947","4.571415800000043 6.861524199999947 6.0948062 8.384914599999984","3.047136400000067 8.384736799999947 4.571415800000043 6.861524199999947","1.5237460000000291 11.432228799999924 3.047136400000067 8.384736799999947","1.5237460000000291 12.95615259999999 1.5237460000000291 11.432228799999924","1.5237460000000291 12.95615259999999 3.0476698000000138 14.480076399999975","3.0476698000000138 14.480076399999975 7.617841000000046 16.003111199999942","7.617841000000046 16.003111199999942 15.237104400000058 16.003111199999942","15.237104400000058 16.003111199999942 19.807986800000073 17.527034999999927","19.807986800000073 17.527034999999927 21.33102160000004 20.573282399999975","21.33102160000004 20.573282399999975 21.33137720000003 22.09756179999995","19.80816460000003 25.14505379999993 21.33137720000003 22.097561799999948","15.238349000000069 26.668622 19.80816460000003 25.14505379999993","6.0951618000000725 26.668622 15.238349000000069 26.668622","1.5235682000000739 25.1454094 6.0951618000000725 26.668622"]},h:{path:["0 -16.00107260000001 6.094450600000008 -16.00107260000001","0.00017779999995536856 15.99617099999999 10.66586639999997 15.99617099999999","4.5708824000000154 15.99617099999999 4.5708824000000154 -16.00107260000001","6.094450600000008 15.99617099999999 6.094450600000008 -16.00107260000001","6.094450600000008 -0.7641459999999884 9.141586999999994 -3.811282399999979","9.141586999999994 -3.811282399999979 13.713180599999992 -5.335206199999964","13.713180599999992 -5.335206199999964 16.760494800000014 -5.335206199999964","16.760139200000022 15.99617099999999 27.425827799999958 15.99617099999999","16.760494800000014 -5.335206199999964 21.331021599999957 -3.811637999999971","16.760494800000014 -5.335206199999964 19.807808999999956 -3.811460200000014","19.807808999999956 -3.811460200000014 21.331554999999984 -0.7637904000000002","21.331021599999957 -3.811637999999971 22.854945400000023 -0.7645015999999838","21.331554999999984 15.99617099999999 21.331554999999984 -0.763790400000002","22.854945400000023 15.99617099999999 22.854945400000023 -0.7645015999999838"]},i:{path:["0.0010667999999747736 15.99616100000002 10.666933200000026 15.99616100000002","4.571771400000035 15.99616100000002 4.571771400000035 -5.335749599999955","6.096050800000011 15.99616100000002 6.096050800000011 -5.335749599999955","0 -5.335749599999955 6.096050800000011 -5.335749599999955","3.0482032000000414 -14.477514399999984 4.572127000000026 -16.000904799999944","3.0482032000000414 -14.477514399999984 4.572304799999982 -12.954123999999949","4.572304799999982 -12.954123999999949 6.095339600000022 -14.477514399999992","4.572127000000026 -16.000904799999944 6.095339600000022 -14.477514399999992"]},j:{path:["0 23.61130780000006 1.5237460000000287 22.08756180000003","0 25.134698200000017 0 23.61130780000006","0 25.134698200000017 1.5239238000000654 26.658622","1.5235682000000739 25.135231600000044 3.0474920000000583 23.61130780000006","1.523746000000029 22.08756180000003 3.0474920000000583 23.61130780000006","1.5239238000000654 26.658622 4.570704600000061 26.658622","3.0476698000000138 -5.338443799999961 9.141764800000031 -5.338443799999961","4.5707046000000595 26.658622 6.0948062 25.134698200000017","4.570704600000061 26.658622 7.618196600000037 25.135587200000035","6.094628400000045 -14.48038639999995 7.618374400000073 -16.004132399999975","6.094628400000045 -14.48038639999995 7.618196600000037 -12.956818199999951","6.0948062 25.134698200000017 7.618374400000073 22.08756179999995","7.618196600000037 25.135587200000035 9.141764800000031 22.090584399999997","7.618196600000037 -12.956818199999951 9.141942600000066 -14.480564199999982","7.618374400000073 22.08756179999995 7.618374400000073 -5.338443799999968","7.618374400000073 -16.004132399999975 9.141942600000066 -14.480564199999982","9.141764800000031 22.090584399999997 9.141764800000031 -5.338443799999961"]},k:{path:["13.713180599999992 3.8118825999999757 22.855789957780456 16.00131720000002","16.76013919999994 16.00131720000002 25.902081799999927 16.00131720000002","12.190044189851468 3.8119842101484878 21.331777595758144 16.00131720000002","6.095339599999947 9.906688799999976 21.331910599999976 -5.3298821999999735","16.759605799999996 -5.3298821999999735 25.902615199999957 -5.3298821999999735","0.001777999999957956 16.001139399999985 10.66586639999997 16.001139399999985","4.571593599999998 16.001139399999985 4.571593599999998 -15.995748600000029","6.095339599999947 16.001139399999985 6.095339599999947 -15.995748600000022","0 -15.995748600000022 6.095339599999947 -15.995748600000022"]},l:{path:["0 -15.995748600000022 6.095339599999947 -15.995748600000022","6.095339599999947 16.001139399999985 6.095339599999947 -15.995748600000022","4.571593599999998 16.001139399999985 4.571593599999998 -15.995748600000022","0.001777999999957956 16.001139399999985 10.66586639999997 16.001139399999985"]},m:{path:["0 -5.324822400000011 6.094272800000053 -5.324822400000011","6.094272800000053 16.00655480000002 6.094272800000053 -5.324822400000011","4.570349000000069 16.00655480000002 4.570349000000069 -5.3248224000000075","0.0010668000000556277 16.00655480000002 10.664799599999995 16.00655480000002","16.75942800000004 16.00655480000002 27.425116600000056 16.00655480000002","33.52010060000001 16.00655480000002 44.18561140000007 16.00655480000002","13.712647200000045 -5.325000200000046 16.760139200000022 -5.325000200000046","30.472608600000033 -5.325000200000046 33.520456200000005 -5.325000200000046","6.094272800000053 -0.7539400207479954 9.141942600000066 -3.8014319999999717","9.141942600000066 -3.8014319999999717 13.712647200000045 -5.325000200000046","16.760139200000022 -5.325000200000046 21.329954800000063 -3.8012542000000185","21.329954800000063 -3.8012542000000185 22.854411999999996 -0.7535844000000029","22.854411999999996 16.00655480000002 22.854411999999996 -0.7535844000000029","22.854411999999996 -0.7535844000000029 25.90208180000001 -3.8012542000000185","25.90208180000001 -3.8012542000000185 30.472608600000033 -5.325000200000046","33.520456200000005 -5.325000200000046 38.09098300000002 -3.8012542000000185","38.09098300000002 -3.8012542000000185 39.61490680000001 -0.7548290000000151","39.61490680000001 16.00655480000002 39.61490680000001 -0.7548290000000151","38.09098300000002 16.00655480000002 38.09098300000002 -0.7537622000000397","36.56759260000007 -3.8014319999999717 38.09098300000002 -0.7537622000000397","33.520456200000005 -5.325000200000046 36.56759260000007 -3.8014319999999717","16.760139200000022 -5.325000200000046 19.807275600000008 -3.8008986000000267","19.807275600000008 -3.8008986000000267 21.330843800000004 -0.7542955999999865","21.330843800000004 16.00655480000002 21.330843800000004 -0.7542955999999865"]},n:{path:["16.75942799999996 -5.327014199999985 19.80727559999993 -3.8039794000000224","13.713002675533733 -5.327014199999985 16.75942799999996 -5.327014199999985","0 -5.327014199999985 6.094450599999927 -5.327014199999985","6.094450599999927 16.00418520000001 6.094450599999927 -5.327014199999985","0.0012445999999301423 16.00418520000001 10.666221999999962 16.00418520000001","16.760494799999933 16.00418520000001 27.42653899999994 16.00418520000001","22.854767599999988 16.00418520000001 22.854767599999988 -0.7557761999999784","21.331021599999957 -3.803623799999949 22.854767599999988 -0.7557761999999784","16.75942799999996 -5.327014199999985 21.331021599999957 -3.803623799999949","21.330843800000004 16.00418520000001 21.330843800000004 -0.7552427999999516","19.80727559999993 -3.8039794000000224 21.330843800000004 -0.7552427999999516","6.094450599999927 -0.7559540000000204 9.14176479999995 -3.803445999999992","9.14176479999995 -3.803445999999992 13.713002675533733 -5.327014199999985","4.570704599999979 16.00418520000001 4.570704599999979 -5.327014199999985"]},o:{path:["12.18961240000001 -5.143110800000022 15.236393199999995 -3.6193647999999943","15.236393199999995 -3.6193647999999943 18.2844186 -0.5715172000000237","18.2844186 -0.5715172000000237 19.807453400000046 3.999187400000036","19.807453400000046 7.047568400000033 19.807453400000046 3.999187400000036","18.2844186 11.61756180000003 19.807453400000046 7.047568400000033","15.236393199999995 14.665587200000035 18.2844186 11.61756180000003","12.188723400000061 16.188622 15.236393199999995 14.665587200000035","6.094095000000016 14.664164799999988 9.142120400000023 16.188622","3.0474920000000583 11.61756180000003 6.094095000000016 14.664164799999988","1.523568199999993 7.046323800000022 3.0474920000000583 11.61756180000003","1.523568199999993 7.046323800000022 1.523568199999993 3.9997207999999826","1.523568199999993 3.9997207999999826 3.0474920000000583 -0.5718728000000155","3.0474920000000583 -0.5718728000000155 6.0948062 -3.6191870000000375","6.0948062 -3.6191870000000375 9.142120400000023 -5.143110800000022","4.571593599999998 -3.619720399999986 9.142120400000023 -5.143110800000022","1.5237460000000291 -0.5718728000000155 4.571593599999998 -3.619720399999986","0 3.999187400000036 1.5237460000000291 -0.5718728000000155","0 7.046679400000014 0 3.999187400000036","0 7.046679400000014 1.5237460000000291 11.617917400000021","1.5237460000000291 11.617917400000021 4.571593599999998 14.665053800000008","4.571593599999998 14.665053800000008 9.142120400000023 16.188622","9.142120400000023 16.188622 12.188723400000061 16.188622","12.188723400000061 16.188622 16.76102820000004 14.664698200000016","16.76102820000004 14.664698200000016 19.80816460000003 11.616494999999974","19.80816460000003 11.616494999999974 21.331732800000022 7.046145999999986","21.331732800000022 7.046145999999986 21.331732800000022 4.000076399999974","19.80816460000003 -0.5715172000000237 21.331732800000022 4.000076399999974","16.76031700000006 -3.6190092000000025 19.80816460000003 -0.5715172000000237","12.1896124 -5.143110800000022 16.76031700000006 -3.6190092000000025","9.142120400000023 -5.143110800000022 12.1896124 -5.143110800000022"]},p:{path:["4.570348999999988 26.66452260000001 4.570348999999988 -5.333076599999982","0 -5.333076599999982 6.093917200000061 -5.333076599999982","6.093917200000061 26.66452260000001 6.093917200000061 -5.333076599999982","0.00640080000001035 26.66452260000001 10.665155199999987 26.66452260000001","6.093917200000061 11.42741820000003 9.140698000000056 14.474199000000025","9.140698000000056 14.474199000000025 12.188901200000016 15.998478400000002","12.188901200000016 15.998478400000002 15.236393199999995 15.998478400000002","15.236393199999995 15.998478400000002 19.807275600000008 14.47437679999998","19.807275600000008 14.47437679999998 22.854767599999988 11.427062599999958","22.854767599999988 11.427062599999958 24.37833580000006 6.8574247999999525","24.37833580000006 6.8574247999999525 24.37833580000006 3.808688199999965","22.85458980000003 -0.7609496000000373 24.37833580000006 3.808688199999965","19.807097800000054 -3.809330600000033 22.85458980000003 -0.7609496000000373","15.236037600000023 -5.332898800000015 19.807097800000054 -3.809330600000033","12.188901200000016 -5.3328988000000255 15.236037600000003 -5.3328988000000255","9.142298200000058 -3.8098639999999815 12.188901200000016 -5.3328988000000255","6.093917200000061 -0.7614830000000641 9.142298200000058 -3.8098639999999815","15.236393199999995 15.998478400000002 18.283885200000054 14.47437679999998","18.283885200000054 14.47437679999998 21.330843800000004 11.427595999999987","21.330843800000004 11.427595999999987 22.854411999999996 6.857780400000026","22.854411999999996 6.857780400000026 22.854411999999996 3.8095771999999837","21.330666000000047 -0.762194199999966 22.854411999999996 3.8095771999999837","18.283529600000062 -3.809330600000033 21.330666000000047 -0.762194199999966","15.236037600000003 -5.3328988000000255 18.283529600000062 -3.809330600000033"]},q:{path:["6.094983999999955 -3.808974999999961 9.142298199999978 -5.332720999999989","3.0474919999999774 -0.7618385999999759 6.094983999999955 -3.808974999999961","1.5241015999999399 3.8097550000000204 3.0474919999999774 -0.7618385999999759","1.5241015999999399 6.856535800000014 1.5241015999999399 3.8097550000000204","1.5241015999999399 6.856535800000014 3.0474919999999774 11.427773800000022","3.0474919999999774 11.427773800000022 6.0956951999999385 14.475799200000028","6.0956951999999385 14.475799200000028 9.142831599999925 15.99901180000003","15.237104399999977 14.475088000000044 18.284240799999964 11.427775617533953","12.1896124 15.99901180000003 15.237104399999977 14.475088000000044","9.142831599999925 15.99901180000003 12.1896124 15.99901180000003","4.571415799999962 14.475443600000036 9.142831599999923 15.99901180000003","1.5242793999999762 11.428840599999997 4.571415799999962 14.475443600000036","0 6.857602599999989 1.5242793999999762 11.428840599999997","0 6.857602599999989 0 3.8099327999999772","0 3.8099327999999772 1.5242793999999762 -0.7618385999999759","1.5242793999999762 -0.7618385999999759 4.571771399999954 -3.809152799999996","4.571771399999954 -3.809152799999996 9.14229819999998 -5.332720999999989","9.14229819999998 -5.332720999999989 12.1896124 -5.332720999999989","12.1896124 -5.332720999999989 15.237459999999968 -3.8086193999999693","15.237459999999968 -3.8086193999999693 18.284240799999964 -0.7613051999999456","18.284240799999964 26.66452260000001 18.284240799999964 -5.332187599999962","13.713891799999976 26.66452260000001 24.378157999999942 26.66452260000001","19.80798679999999 26.66452260000001 19.80798679999999 -5.332720999999989"]},r:{path:["0 -5.334360399999937 6.094095000000016 -5.334360399999937","6.094095000000016 15.997016800000013 6.094095000000016 -5.334360399999937","4.570348999999988 15.997016800000013 4.570348999999988 -5.334360399999937","0 15.997016800000013 10.665155199999987 15.997016800000013","6.094095000000016 3.8075822000000485 7.61766320000001 -0.7629445999999742","7.61766320000001 -0.7629445999999742 10.665155199999987 -3.810792199999945","10.665155199999987 -3.810792199999945 13.712113800000019 -5.334182599999981","13.712113800000019 -5.334182599999981 18.283351800000023 -5.334360399999937","18.283351800000023 -5.334360399999937 19.80692000000002 -3.8109699999999798","19.80692000000002 -2.2906021999999915 19.80692000000002 -3.8109699999999798","18.280329199999976 -0.7640113999999496 19.80692000000002 -2.2906021999999915","16.759250200000004 -2.2868683999999586 18.280329199999976 -0.7640113999999496","16.759250200000004 -2.2868683999999586 18.283351800000023 -3.810614399999988"]},s:{path:["15.237282200000013 6.856679400000014 16.76067259999997 8.379892000000016","12.1896124 5.333111200000022 15.237282200000013 6.856679400000014","4.572126999999945 2.2861525999999905 12.1896124 5.333111200000022","1.5239237999999846 0.7620509999999694 4.572126999999945 2.2861525999999905","0.00017779999995536856 -0.7616949999999783 1.5239237999999846 0.7620509999999694","0 15.998622000000001 1.5239237999999846 12.951485600000014","0 15.998622000000001 0 9.903637999999965","0 9.903637999999965 1.5239237999999846 12.951485600000014","1.5239237999999846 12.951485600000014 3.0482031999999606 14.475231599999963","3.0482031999999606 14.475231599999963 6.095161799999992 15.998622000000001","6.095161799999992 15.998622000000001 12.189434599999963 15.998622000000001","12.189434599999963 15.998622000000001 15.237282200000013 14.474342600000025","15.237282200000013 14.474342600000025 16.76067259999997 12.950952199999987","16.76067259999997 12.950952199999987 16.76067259999997 8.379892000000016","15.237637800000005 8.3806032 16.76067259999997 9.90398998400735","12.189967999999991 6.856857199999969 15.237637800000005 8.3806032","4.572304799999982 3.80989860000002 12.189967999999991 6.856857199999969","1.5237459999999483 2.285619199999962 4.572304799999982 3.80989860000002","0.00017779999995536856 0.7620509999999694 1.5237459999999483 2.285619199999962","0.00017779999995536856 0.7620509999999694 0.00017779999995536856 -2.2854410000000076","0.00017779999995536856 -2.2854410000000076 1.5241016000000207 -3.809187000000037","1.5241016000000207 -3.809187000000037 4.571415799999962 -5.332577399999995","4.571415799999962 -5.332577399999995 10.665510799999979 -5.332577399999995","10.665510799999979 -5.332577399999995 13.713358399999947 -3.809187000000037","13.713358399999947 -3.809187000000037 15.23657099999995 -2.285974400000036","15.23657099999995 -2.285974400000036 16.76067259999997 -5.33275520000003","15.23657099999995 -2.285974400000036 16.76067259999997 0.7616953999999776","16.76067259999997 0.7616953999999776 16.76067259999997 -5.33275520000003"]},t:{path:["0 -5.332932999999986 12.187656600000006 -5.332932999999986","6.093383799999953 14.475231599999963 9.141231400000002 15.998622000000001","4.570171199999951 9.904526999999984 6.093383799999953 14.475231599999963","4.570171199999951 9.904526999999984 4.570171199999951 -15.998799400000035","15.235148599999983 14.474875999999972 16.75889459999993 11.427739599999985","12.188012199999998 15.998622000000001 15.235148599999983 14.474875999999972","9.141231400000002 15.998622000000001 12.188012199999998 15.998622000000001","7.617129799999982 14.4754094 9.141231400000002 15.998622000000001","6.093383799999953 9.903993599999957 7.617129799999982 14.4754094","6.093383799999953 9.903993599999957 6.093383799999953 -15.998799400000035","4.570171199999951 -15.998799400000035 6.093383799999953 -15.998799400000035"]},u:{path:["0 -5.333110800000021 6.094450600000008 -5.333110800000021","16.760139200000022 -5.333110800000021 22.854945400000023 -5.333110800000021","22.854945400000023 15.99826640000001 22.854945400000023 -5.333110800000021","21.33102160000004 15.99826640000001 27.426005599999993 15.99826640000001","21.33102160000004 15.99826640000001 21.33102160000004 -5.333110800000018","6.094450600000008 11.427028400000003 6.094450600000008 -5.333110800000021","6.094450600000008 11.427028400000003 7.618374399999992 14.475053800000008","7.618374399999992 14.475053800000008 10.666399799999999 15.998622000000001","10.666399799999999 15.998622000000001 13.712647199999966 15.998622000000001","13.712647199999966 15.998622000000001 18.28352959999998 14.474698199999935","18.28352959999998 14.474698199999935 21.33102160000004 11.427561302773196","4.5708824000000154 11.427383999999993 4.5708824000000154 -5.333110800000021","4.5708824000000154 11.427383999999993 6.095161799999992 14.474698199999935","6.095161799999992 14.474698199999935 10.666399799999999 15.998622000000001"]},v:{path:["4.570882399999975 -5.340044999999979 12.189612399999959 12.946329400000016","3.046247400000007 -5.340044999999979 12.18885030331606 15.991450925997786","0 -5.340044999999979 9.14176479999999 -5.340044999999979","15.234259600000003 -5.336844599999974 24.376557799999983 -5.336844599999974","12.18885030331606 15.991450925997786 21.329421399999994 -5.336844599999974"]},w:{path:["0 -5.332221800000003 10.664977399999952 -5.332221800000003","24.37780239999995 -5.332221800000003 33.52063399999996 -5.332221800000003","4.570095002964017 -5.332221800000003 10.664799599999995 15.998622000000001","10.664799599999995 15.998622000000001 16.759783599999952 -5.332577400000076","16.759783599999952 -5.332577400000076 22.854234199999958 15.998622000000001","22.854234199999958 15.998622000000001 28.948938797035936 -5.332221800000003","6.094628399999964 -5.332221800000003 10.664799599999995 11.427028399999921","18.283351800000023 -5.332399600000038 22.854411999999996 11.428095199999976"]},x:{path:["0 -5.338978200000003 9.142120400000023 -5.338978200000003","15.236037600000003 -5.338978200000003 24.378513600000016 -5.338978200000003","3.047136399999986 -5.338978200000003 19.807186755564814 15.992398999999946","4.5710601999999705 -5.338978200000003 21.33111059259718 15.992398999999946","3.0467808044452034 15.992398999999946 21.330843800000004 -5.338978200000003","0.00017780000003622264 15.992398999999946 9.141764800000031 15.992398999999946","15.235859800000046 15.992398999999946 24.378513600000016 15.992398999999946"]},y:{path:["0.00017780000003622264 -5.33964519999998 9.142298200000058 -5.33964519999998","15.23657100000003 -5.33964519999998 24.378513600000016 -5.33964519999998","3.047136399999986 -5.33964519999998 12.1896124 15.99244320000003","9.14265380000005 22.085827000000066 12.1896124 15.99244320000003","6.095161799999992 25.133674600000035 9.14265380000005 22.085827000000066","3.046958351299797 26.65795400000001 6.095161799999992 25.133674600000035","1.5239237999999846 23.610462000000034 3.0476698000000138 25.134030200000026","0 25.134030200000026 1.5239237999999846 23.610462000000034","0 25.134030200000026 1.5235706720194575 26.65795400000001","1.5235706720194575 26.65795400000001 3.046958351299797 26.65795400000001","12.1896124 15.99244320000003 21.331199399999996 -5.33964519999998","4.570986117819258 -5.33964519999998 12.189967999999991 12.946195800000064"]},z:{path:["0 0.7512052000000242 1.5238783955838133 -5.343600999999975","0 0.7512052000000242 0 -5.343600999999975","0.00017780000003622383 15.98795400000001 16.76057104190339 -5.343600999999975","0.00017780000003622383 15.98795400000001 18.283707400000015 15.98795400000001","16.760361405925995 15.98795400000001 18.283707400000015 9.894214599999986","18.283707400000015 15.98795400000001 18.283707400000015 9.894214599999986","1.5239490920815293 15.98795400000001 18.284240800000045 -5.343600999999975","0 -5.343600999999975 18.284240800000045 -5.343600999999975"]},"{":{path:["3.0473141999999416 -17.527522799999936 4.5707045999999725 -20.575192599999944","3.0473141999999416 -14.480919799999974 3.0473141999999416 -17.527522799999936","3.0473141999999416 -14.480919799999974 4.570882399999935 -11.433249999999958","4.570882399999935 -11.433249999999958 6.094272799999972 -9.909859600000004","6.094272799999972 -9.909859600000004 7.618196599999957 -6.8618342000000005","7.618196599999957 -3.8154089999999954 7.618196599999957 -6.8618342000000005","6.0948062 -0.7675613999999449 7.618196599999957 -3.8154089999999954","3.047669799999954 0.7556512000000382 6.0948062 -0.7675613999999449","3.0459807363089517 3.8025209363090227 6.094450599999927 6.850990799999998","6.094450599999927 9.898127200000067 6.094450599999927 6.850990799999998","4.5712379999999255 12.94490800000006 6.094450599999927 9.898127200000067","3.0480253999999247 14.467587200000034 4.5712379999999255 12.94490800000006","1.523568199999993 17.516323800000023 3.0480253999999247 14.467587200000034","1.523568199999993 20.563638000000047 1.523568199999993 17.516323800000023","1.523568199999993 20.563638000000047 3.0474919999999774 23.611130000000024","3.0474919999999774 23.611130000000024 4.570882399999935 25.134698200000017","4.570882399999935 25.134698200000017 7.618196599999957 26.658622","3.047669799999933 22.08667280000001 4.570882399999935 25.134698200000017","3.047669799999933 22.08667280000001 3.047669799999933 19.04184780000001","3.047669799999933 19.04184780000001 4.570171199999951 15.993289000000058","4.570171199999951 15.993289000000058 6.094450599999927 14.469187400000036","6.094450599999927 14.469187400000036 7.618196599999957 11.420806400000039","7.618196599999957 11.420806400000039 7.618196599999957 8.373136600000025","6.094450599999927 5.326711400000022 7.618196599999957 8.373136600000025","0 2.2795750000000368 6.094450599999927 5.326711400000022","0 2.2795750000000368 3.0476697999999374 0.7556512000000524","3.0476697999999325 0.7556512000000559 6.094450599999927 -2.291129599999941","6.094450599999927 -2.291129599999941 6.094450599999927 -5.338977199999988","4.570882399999935 -8.385935799999938 6.094450599999927 -5.338977199999988","3.047136399999986 -9.909148399999943 4.570882399999935 -8.385935799999938","1.5233903999999567 -12.957351599999981 3.047136399999986 -9.909148399999943","1.5233903999999567 -12.957351599999981 1.5233903999999567 -16.004310200000013","1.5233903999999567 -16.004310200000013 3.046425199999922 -19.050913199999968","3.046425199999922 -19.050913199999968 4.570704599999972 -20.575192599999944","4.5707045999999725 -20.575192599999944 7.618552199999948 -22.099294199999967"]},"|":{path:["0 25.138622 0 -22.09554820000002"]},"}":{path:["3.053892799999988 -20.569836999999996 4.577283199999985 -17.52216719999998","4.577283199999985 -14.475741834180443 4.577283199999985 -17.52216719999998","3.0535371999999965 -11.428072200000006 4.577283199999985 -14.475741834180443","1.5297911999999672 -9.903792799999987 3.0535371999999965 -11.428072200000006","0.006222999999974127 -6.856478599999964 1.5297911999999672 -9.903792799999987","0.006222999999974127 -3.809697799999972 0.006222999999974127 -6.856478599999964","0.006222999999974127 -3.809697799999972 1.5294355999999756 -0.7618502000000031","1.5297911999999672 6.856346400000033 4.577816703752094 3.808320896247901","1.5297911999999672 9.903127200000027 1.5297911999999672 6.856346400000033","1.5297911999999672 9.903127200000027 3.0533594000000006 12.950619200000004","3.0533594000000006 12.950619200000004 4.577460999999981 14.474720800000025","4.577460999999981 14.474720800000025 6.1008513999999785 17.522035000000006","6.1008513999999785 20.56934920000003 6.1008513999999785 17.522035000000006","4.577460999999981 23.616485600000015 6.1008513999999785 20.56934920000003","3.0535371999999974 25.14076500000003 4.577460999999981 23.616485600000015","0.006756400000001941 26.663622 3.0535371999999974 25.14076500000003","3.053537199999997 25.14076500000003 4.577283199999985 22.09256180000003","4.577283199999985 22.09256180000003 4.577283199999985 19.04525041800855","3.053714999999992 15.998289000000018 4.577283199999985 19.04525041800855","1.5301467999999991 14.474720800000025 3.053714999999992 15.998289000000018","0.006222999999974127 11.427406600000003 1.5301467999999991 14.474720800000025","0.006222999999974127 11.427406600000003 0.006222999999974127 8.379381200000077","0.006222999999974127 8.379381200000077 1.5296133999999713 5.332600400000002","1.5296133999999713 5.332600400000002 7.624241799999977 2.2849306000000293","1.5294355999999756 -0.7618502000000031 7.624241799999975 2.2849306000000293","1.5299690000000032 -2.2861295999999793 4.578438573295234 0.7623399732952496","1.5299690000000032 -2.2861295999999793 1.5299690000000032 -5.333442135244523","1.5299690000000032 -5.333442135244523 3.053714999999992 -8.380757999999982","3.053714999999992 -8.380757999999982 4.577105399999989 -9.904148399999979","4.577105399999989 -9.904148399999979 6.1008513999999785 -12.951818199999995","6.1008513999999785 -12.951818199999995 6.1008513999999785 -15.999660012880891","4.577105399999989 -19.046624399999995 6.1008513999999785 -15.999660012880891","3.053892799999988 -20.569836999999996 4.577105399999989 -19.046624399999995","0.006578599999965718 -22.093582999999985 3.053892799999988 -20.569836999999996"]},"~":{path:["13.712647200000049 -8.376555799999952 19.8076312 -11.423514399999984","7.618374399999992 -12.947082599999977 13.712647200000049 -8.376555799999952","0 -8.376377999999999 7.618374399999992 -12.947082599999977"]},"\xB0":{path:["3 -11 0 -8 3 -5 6 -8 3 -11"]},\u03A9:{path:["0 9 7 9 5 6 3 3 2 0 2 -3 3 -6 4 -8 6 -10 8 -11 12 -11 14 -10 16 -8 17 -6 18 -3 18 0 17 3 15 6 13 9 20 9"]},\u03BC:{path:["0 14 1 4 1 -6 1 4 2 7 4 8 6 8 8 7 10 4 10 -6 10 6 11 8 12 9"]}},yT.spacing={A:4.114291999999978,B:4.266311000000059,C:4.571238000000008,D:4.266666599999979,E:4.418685599999975,F:4.418507799999929,G:4.113580799999994,H:3.8090094000000363,I:5.790057000000019,J:5.180558600000012,K:3.9612061999999924,L:4.570882400000016,M:3.6569904000000406,N:3.961739600000044,O:4.41886339999985,P:4.266310999999973,Q:4.419041200000095,R:4.113580799999909,S:4.72343479999995,T:4.570882400000187,U:3.8091871999999967,V:4.113936399999943,W:3.5042602000000898,X:4.113936399999943,Y:3.961028400000032,Z:4.723434800000177,a:4.570526800000024,b:4.41886340000001,c:4.875809400000044,d:4.41868560000006,e:4.876165000000029,f:5.48530779999998,g:4.72325699999999,h:4.114114199999932,i:5.789701399999927,j:5.941898199999969,k:4.266133199999956,l:5.789701400000013,m:2.437815799999953,n:4.1139364,o:4.723612599999967,p:4.418685600000003,q:4.418863400000021,r:4.876165000000071,s:5.180736400000001,t:5.180203000000006,u:4.113580799999909,v:4.4190411999998105,w:3.50443800000005,x:4.419574600000033,y:4.418507800000043,z:5.0278284000000895,0:4.723790400000038,1:5.485307800000022,2:4.723434799999964,3:4.723612599999996,4:4.418329999999983,5:4.72343479999995,6:4.72343479999995,7:4.723257000000018,8:4.72325700000001,9:4.723257000000018,"`":6.55210780000002,"!":6.552819000000005,"@":3.6569904000000406,"#":4.5714157999999685,$:4.72361260000001,"%":4.113936399999986,"^":4.418863399999992,"&":3.9615617999999984,"*":5.332755399999996,"(":5.789701399999927,")":5.790234799999966,_:4.114114200000017,"+":4.11411419999996,"-":4.114114200000017,"=":4.1139364,"[":5.789879200000087,"]":5.789879200000087,"{":6.094628400000033,"}":5.028006199999936,"?":5.028361799999991,";":6.551396600000038,"'":6.551396599999958,"\\":1.9806919999999764,":":6.551752200000038,'"':6.551752200000024,"|":6.5515744000000495,",":6.8566792000000305,".":6.551929999999857,"<":4.418329999999984,">":4.41815220000003,"/":-.785};var lre=yT;var bT=class bT{static setFontHeight(t){bT.height=+t}static getFontHeight(){return bT.height||4.5}static getCharInfo(t,e,r){function i(u,d,p,m,g){let y="",b=u.length;for(let P=0;P<b;P++){let T=u[P].split(" "),I=0,C=T.length;for(;I<C;I+=2)T[I]=on(p+d*T[I],2),T[I+1]=on(m+d*(+T[I+1]-16),2);let E="M "+T[0]+" "+T[1];for(I=2;I<C;I++)I%2===0&&(E+="L"),E+=T[I]+" ";y+=E}return y}if(bT.fontPath[t]){var n=bT.fontPath[t].path,s=bT.getPathBBox(n),a=Math.abs(s.R-s.L),l=Math.abs(s.T-s.B);l===0&&(l=1);var c=bT.getFontHeight()/32;a=a*c;var h=i(n,c,e,r,l);return[h,a]}else return["",0]}static getPathBBox(t){for(var e=t.length,r={L:9999,T:-9999,R:-9999,B:9999},i,n,s=0;s<e;s++){for(var a=t[s].split(" "),l=0,c=a.length;l<c;l+=2)i=+a[l],n=+a[l+1],r.L>i&&(r.L=i),r.T<n&&(r.T=n),r.R<i&&(r.R=i),r.B>n&&(r.B=n);a=null}return r}static getSpaceWidth(t){return 25.140742199999984*t}static everyCharHasDefaultFontPath(t){let e=t.toString().replace(/\s/g,"").split("");for(let r of e)if(bT.fontPath[r]==null)return!1;return!0}static getSpacing(t){return bT.spacing[t]||10.66}};bT._fontsCache={},bT.fontPath={0:{path:["16.760417913433997 -14.469723706878161 19.808164599999948 -9.89792639999998","19.808164599999948 -9.89792639999998 21.331554999999984 -2.28026319999997","4.571238000000007 -14.469697800000011 9.14176479999995 -15.993266000000007","1.5239237999999846 -9.898459800000007 4.571238000000007 -14.469697800000011","0 -2.27990759999998 1.5239237999999846 -9.898459800000007","0 2.290085800000016 0 -2.27990759999998","0 2.290085800000016 1.5237459999999483 9.908993599999956","1.5237459999999483 9.908993599999956 4.571415799999962 14.480231599999964","4.571415799999962 14.480231599999964 9.14176479999995 16.003622","9.14176479999995 16.003622 12.191212600000002 16.003622","12.191212600000002 16.003622 16.76013919999994 14.480942800000028","16.76013919999994 14.480942800000028 19.80798679999999 9.908637999999964","19.80798679999999 9.908637999999964 21.331554999999984 2.291508199999983","21.331554999999984 2.291508199999983 21.331554999999984 -2.28026319999997","12.190145799999947 -15.993266000000007 16.760417913433997 -14.469723706878161","9.14176479999995 -15.993266000000007 12.190145799999947 -15.993266000000007"]},1:{path:["7.6180188000000015 16.003622 7.6180188000000015 -15.994155000000026","3.0466029999999984 -11.422739199999983 7.6180188000000015 -15.994155000000026","0 -9.89917099999999 3.0466029999999984 -11.422739199999983"]},2:{path:["0 16.003622 21.33137720000003 16.003622","0 16.003622 15.236926600000022 0.7666954000000192","15.236926600000022 0.7666954000000192 18.28388520000001 -3.8036536000000094","18.28388520000001 -3.8036536000000094 19.8076312 -6.851323399999982","19.8076312 -6.851323399999982 19.8076312 -9.898637600000002","18.2844186 -12.945596199999992 19.8076312 -9.898637600000002","16.760494800000014 -14.469519999999976 18.2844186 -12.945596199999992","13.713358400000029 -15.993088200000011 16.760494800000014 -14.469519999999976","7.618379515807792 -15.993088200000011 13.713358400000029 -15.993088200000011","4.571060200000011 -14.469164399999984 7.618379515807792 -15.993088200000011","3.0473142000000224 -12.945418399999996 4.571060200000011 -14.469164399999984","1.523568199999993 -9.898459800000007 3.0473142000000224 -12.945418399999996","1.523568199999993 -8.374891599999975 1.523568199999993 -9.898459800000007"]},3:{path:["0 9.908638000000007 1.523923800000025 12.956485600000015","1.523923800000025 12.956485600000015 3.0473142000000224 14.479876000000013","3.0473142000000224 14.479876000000013 7.618907800000021 16.003622","7.618907800000021 16.003622 12.189790200000036 16.003622","12.189790200000036 16.003622 16.760850400000006 14.479520400000021","16.760850400000006 14.479520400000021 19.80816460000003 11.4322062","19.80816460000003 11.4322062 21.331555000000026 6.861679400000015","21.331555000000026 6.861679400000015 21.331555000000026 3.814365199999992","19.80816460000003 -0.7566949999999775 21.331555000000026 3.814365199999992","18.284596400000037 -2.280263200000011 19.80816460000003 -0.7566949999999775","15.236748800000026 -3.804186999999997 18.284596400000037 -2.280263200000011","10.666044200000007 -3.804186999999997 15.236748800000026 -3.804186999999997","10.666044200000007 -3.804186999999997 19.807986800000034 -15.993621599999996","3.0478476000000096 -15.993621599999996 19.80798680000003 -15.993621599999996"]},4:{path:["0 5.338466800000013 22.855301000000015 5.338466800000013","0 5.338466800000013 15.236926600000022 -15.99291039999997","15.236926600000022 16.003622 15.236926600000022 -15.99291039999997"]},5:{path:["0 9.90934920000003 1.5239237999999846 12.956485600000015","1.5239237999999846 12.956485600000015 3.0476698000000138 14.480231600000003","3.0476698000000138 14.480231600000003 7.618729999999984 16.003622","7.618729999999984 16.003622 12.189434600000004 16.003622","12.189434600000004 16.003622 16.760494800000014 14.479520400000021","16.760494800000014 14.479520400000021 19.8076312 11.432384000000035","19.8076312 11.432384000000035 21.331199399999996 6.860968200000031","21.331199399999996 6.860968200000031 21.331199399999996 3.813831800000006","19.807453400000004 -0.7570505999999693 21.331199399999996 3.813831800000006","16.760494800000014 -3.804009200000001 19.807453400000004 -0.7570505999999693","12.189434600000004 -5.32775519999999 16.760494800000014 -3.804009200000001","7.618196599999997 -5.32775519999999 12.189434600000004 -5.32775519999999","3.047136399999986 -3.804364799999993 7.618196599999997 -5.32775519999999","1.5237459999999887 -2.2809743999999945 3.047136399999986 -3.804364799999993","1.5237459999999887 -2.2809743999999945 3.0473142000000224 -15.993621599999996","3.0473142000000224 -15.993621599999996 18.284596399999995 -15.993621599999996"]},6:{path:["0 5.337577800000035 1.523568199999993 0.767051000000011","1.523568199999993 0.767051000000011 4.5710602000000105 -2.280440999999966","4.5710602000000105 -2.280440999999966 9.14176479999999 -3.804186999999997","9.14176479999999 -3.804186999999997 10.665155199999987 -3.804186999999997","10.665155199999987 -3.804186999999997 15.236748799999985 -2.280440999999966","15.236748799999985 -2.280440999999966 18.283885200000014 0.7666954000000192","18.283885200000014 0.7666954000000192 19.807631200000003 5.338644600000009","19.807631200000003 6.861679400000015 19.807631200000003 5.338644600000009","18.284240800000006 11.432384000000035 19.807631200000003 6.861679400000015","15.236748799999985 14.479876000000013 18.284240800000006 11.432384000000035","10.665155199999987 16.003622 15.236748799999985 14.479876000000013","9.142120399999982 16.003622 10.665155199999987 16.003622","4.570882400000015 14.48005380000001 9.142120399999982 16.003622","1.523568199999993 11.432739600000026 4.570882400000015 14.48005380000001","0 5.337577800000035 1.523568199999993 11.432739600000026","0 5.337577800000035 0 -2.281328388894039","0 -2.281328388894039 1.523568199999993 -9.898815399999998","1.523568199999993 -9.898815399999998 4.570882400000015 -14.469875599999968","4.570882400000015 -14.469875599999968 9.141942599999986 -15.993621599999996","9.141942599999986 -15.993621599999996 12.18872339999998 -15.993621599999996","12.18872339999998 -15.993621599999996 16.760317000000022 -14.469875599999968","16.760317000000022 -14.469875599999968 18.28406300000001 -11.422561399999987"]},7:{path:["6.0948062 16.003622 21.331199399999996 -15.993265999999965","0 -15.993265999999965 21.331199399999996 -15.993265999999965"]},8:{path:["13.71371400000002 -15.993621599999996 18.283885200000014 -14.47058679999999","18.283885200000014 -14.47058679999999 19.807453400000007 -11.422917000000018","19.807453400000007 -8.375247200000006 19.807453400000007 -11.422917000000018","18.28406300000001 -5.328110800000021 19.807453400000007 -8.375247200000006","15.235504200000015 -3.8038314000000053 18.28406300000001 -5.328110800000021","9.142653800000009 -2.2807965999999986 15.235504200000015 -3.8038314000000053","4.570526799999984 -0.7563393999999857 9.142653800000009 -2.2807965999999986","1.523568199999993 2.2906192000000036 4.570526799999984 -0.7563393999999857","0 5.338289000000017 1.523568199999993 2.2906192000000036","0 9.909169724787748 0 5.338289000000017","0 9.909169724787748 1.5237459999999887 12.956129999999984","1.5237459999999887 12.956129999999984 3.047492000000018 14.479876000000013","3.047492000000018 14.479876000000013 7.618552199999989 16.003622","7.618552199999989 16.003622 13.712113800000017 16.003622","13.712113800000017 16.003622 18.284240800000006 14.479876000000013","18.284240800000006 14.479876000000013 19.80727560000001 12.95666340000001","19.80727560000001 12.95666340000001 21.330843800000004 9.908282400000015","21.330843800000004 9.908282400000015 21.330843800000004 5.337222200000003","19.807631200000003 2.289907999999981 21.330843800000004 5.337222200000003","16.760494800000018 -0.757228400000006 19.807631200000003 2.289907999999981","12.19001988606628 -2.280427430203538 16.760494800000018 -0.757228400000006","6.0948062 -3.804186999999997 12.190019886066274 -2.28042743020354","3.047492000000018 -5.32775519999999 6.0948062 -3.804186999999997","1.5233903999999971 -8.375425000000002 3.047492000000018 -5.32775519999999","1.5233903999999971 -8.375425000000002 1.5233903999999971 -11.422384405459395","1.5233903999999971 -11.422384405459395 3.047136399999986 -14.470053400000003","3.047136399999986 -14.470053400000003 7.618552199999989 -15.993621599999996","7.618552199999989 -15.993621599999996 13.71371400000002 -15.993621599999996"]},9:{path:["4.5710601999999705 -14.475209600000005 9.141942599999986 -15.998777799999997","1.5237459999999887 -11.42789540000002 4.5710601999999705 -14.475209600000005","0 -6.856301800000027 1.5237459999999887 -11.42789540000002","0 -5.3338004000000065 0 -6.856301800000027","0 -5.3338004000000065 1.5242793999999762 -0.7618512000000184","1.5242793999999762 -0.7618512000000184 4.571415800000002 2.2852852000000095","4.571415800000002 2.2852852000000095 9.1430094 3.808853400000002","9.1430094 3.808853400000002 10.667099802593173 3.808853400000002","10.667099802593174 3.808853400000002 15.23692659999998 2.2851073999999727","15.23692659999998 2.2851073999999727 18.2844186 -0.7623846000000043","18.2844186 -0.7623846000000043 19.807555292421778 -5.33392792193264","1.523568199999993 11.427761199999983 3.0474919999999774 14.474719800000013","3.0474919999999774 14.474719800000013 7.61890779999998 15.998288000000006","7.61890779999998 15.998288000000006 10.665685499558217 15.998288000000006","10.665685499558217 15.998288000000006 15.237104399999977 14.474186399999986","15.237104399999977 14.474186399999986 18.284240800000003 9.902948399999978","18.284240800000003 9.902948399999978 19.807808999999995 2.2851073999999727","19.807808999999995 2.2851073999999727 19.807808999999995 -5.332912973451355","18.284240800000003 -11.42789540000002 19.807808999999995 -5.332912973451359","15.23746000000001 -14.474498400000021 18.284240800000003 -11.42789540000002","10.665688599999974 -15.998777799999997 15.23746000000001 -14.474498400000021","9.141942599999986 -15.998777799999997 10.665688599999974 -15.998777799999997"]},"!":{path:["0 14.48005380000001 1.523568199999993 12.956485599999935","0 14.48005380000001 1.523568199999993 16.003622","1.523568199999993 16.003622 3.047136399999986 14.480053800000007","1.523568199999993 12.956485599999935 3.047136399999986 14.480053800000007","1.523568199999993 5.3384667999999325 1.523568199999993 -15.993443800000042"]},'"':{path:["10.056368000000031 -6.846733599999993 11.579402799999997 -8.369412799999965","11.579402799999997 -8.369412799999965 13.103504400000018 -11.417260399999975","13.103504400000018 -11.417260399999975 13.103504400000018 -14.465107999999985","11.579936200000024 -15.98867619999998 13.103504400000018 -14.465107999999985","10.05601240000004 -14.464752399999993 11.579936200000024 -15.98867619999998","10.05601240000004 -14.464752399999993 11.579758399999989 -12.941006400000004","0 -14.464574599999997 1.5233903999999971 -12.941361999999994","0 -14.464574599999997 1.523568199999993 -15.988142799999991","1.523568199999993 -15.988142799999991 3.0473142000000224 -14.46439679999996","3.0473142000000224 -11.417261642053806 3.0473142000000224 -14.46439679999996","1.5228573106943262 -8.369235310694286 3.0473142000000224 -11.417261642053806","0 -6.846378000000001 1.5228573106943262 -8.369235310694286"]},"#":{path:["0 9.894749000000024 21.330843800000004 9.894749000000024","1.5244572000000125 0.7528064000000398 22.854767600000066 0.7528064000000398","10.665333000000023 26.654888200000048 21.33013260000002 -16.006977199999987","1.5221458000000265 26.658622 12.197613400000012 -15.991330799999957"]},$:{path:["7.618374399999992 22.103622 7.618374399999992 -22.083233999999997","13.713180599999992 22.10308859999997 13.713180599999992 -22.084834200000003","18.284240800000003 2.2958130000000025 21.331377199999988 5.3429493999999895","15.235682000000011 0.7713557999999914 18.284240800000003 2.2958130000000025","6.093383799999993 -2.276314000000024 15.235682000000011 0.7713557999999914","3.0476698000000138 -3.7989931999999946 6.093383799999993 -2.276314000000024","1.5237459999999887 -5.323094800000014 3.0476698000000138 -3.7989931999999946","0 -8.370053400000003 1.5237459999999887 -5.323094800000014","1.523568199999993 11.437577799999993 3.047314200000021 9.913831800000006","1.5237459999999887 8.390263599999972 3.047314200000021 9.913831800000006","0 9.9140096 1.5237459999999887 8.390263599999972","0 11.437399999999998 0 9.9140096","0 11.437399999999998 3.047492000000018 14.484891999999975","3.047492000000018 14.484891999999975 7.618196599999998 16.00846019999997","7.618196599999998 16.00846019999997 13.713350447746311 16.00846019999997","13.713350447746313 16.00846019999997 18.284240800000003 14.484180799999992","18.284240800000003 14.484180799999992 21.331377199999988 11.437044400000007","21.331377199999988 11.437044400000007 21.331377199999988 5.3429493999999895","19.807808999999995 2.2956351999999676 21.331377199999988 5.3429493999999895","18.284596399999995 0.772066999999975 19.807808999999995 2.2956351999999676","15.237282200000013 -0.7518568000000094 18.284596399999995 0.772066999999975","6.095161799999992 -3.799171000000033 15.237282200000013 -0.7518568000000094","3.047136399999986 -5.322917000000018 6.095161799999992 -3.799171000000033","0 -8.370053400000003 3.047136399999986 -5.322917000000018","0 -8.370053400000003 0 -11.41772320000002","0 -11.41772320000002 3.047136399999986 -14.464859600000006","3.047136399999986 -14.464859600000006 7.6180188000000015 -15.988783400000033","7.6180188000000015 -15.988783400000033 13.713001559534877 -15.988783400000033","13.713001559534884 -15.988783400000033 18.28388520000001 -14.465037400000002","18.28388520000001 -14.465037400000002 21.331199399999996 -11.41772320000002","21.331199399999996 -9.89397720000003 21.331199399999996 -11.41772320000002","19.807808999999995 -8.370586799999991 21.331199399999996 -9.89397720000003","18.284240800000003 -9.894155000000026 19.807808999999995 -8.370586799999991","18.284240800000003 -9.894155000000026 19.807808999999995 -11.41772320000002"]},"%":{path:["18.2844186 6.8656126000000395 21.327998999999988 5.34275560000003","16.76031699999998 9.913993600000037 18.2844186 6.8656126000000395","16.76031699999998 9.913993600000037 16.76031699999998 9.913993600000037","16.76031699999998 12.959174200000028 16.76031699999998 9.913993600000037","16.76031699999998 12.959174200000028 19.80976479999995 16.008622","19.80976479999995 16.008622 22.854767599999988 16.008622","22.854767599999988 16.008622 25.902970800000027 14.484520400000061","25.902970800000027 14.484520400000061 27.42618340000003 11.437028400000003","27.42618340000003 11.437028400000003 27.42618340000003 8.390069800000052","24.378869200000008 5.34275560000003 27.42618340000003 8.390069800000052","21.327998999999988 5.34275560000003 24.378869200000008 5.34275560000003","7.618552200000029 -15.988621599999997 10.665688600000015 -12.94148519999993","10.665688600000015 -9.893104199999938 10.665688600000015 -12.94148519999993","9.142298199999978 -6.8466789999999325 10.665688600000015 -9.893104199999938","6.094450600000008 -5.322755199999948 9.142298199999978 -6.8466789999999325","0 -8.370069399999972 3.0476698000000138 -5.322755199999948","3.0476698000000138 -5.322755199999948 6.094450600000008 -5.322755199999948","6.094450600000008 -5.322755199999948 6.094450600000008 -5.322755199999948","0 -8.370069399999972 0 -11.414534477606418","0 -11.414534477606418 1.5226791999999736 -14.464519999999977","1.5226791999999736 -14.464519999999977 4.571415799999962 -15.988621599999997","0.0012446000000109962 16.006666200000005 27.42618340000003 -15.988443799999962","24.379046999999964 -14.465053400000004 27.426183400000024 -15.988443799999962","19.8076312 -12.94148519999993 24.379046999999964 -14.465053400000004","15.236215399999958 -12.94148519999993 19.8076312 -12.94148519999993","10.665333000000023 -14.46523119999996 15.236215399999958 -12.94148519999993","7.618552200000029 -15.988621599999997 10.665333000000023 -14.46523119999996","4.571415799999962 -15.988621599999997 7.618552200000029 -15.988621599999997"]},"&":{path:["21.331732800000022 14.484875999999971 25.90243740000001 16.008622000000006","18.2844186 11.437917400000021 21.331732800000022 14.484875999999971","7.618196600000037 -3.799720399999986 18.2844186 11.437917400000021","6.094628400000045 -8.370247199999993 7.618196600000037 -3.799720399999986","28.950640600000042 14.48452039999998 28.950640600000042 12.960596599999995","27.426539000000023 16.008622 28.950640600000042 14.48452039999998","25.9024374 16.008622 27.426539000000023 16.008622","22.85334520000002 14.48327579999997 25.9024374 16.008622","19.811365000000034 11.442540199999993 22.85334520000002 14.48327579999997","7.618552200000029 -5.323110800000022 19.811365000000034 11.442540199999993","6.094628400000045 -8.370247200000007 7.618552200000029 -5.323110800000022","6.094628400000045 -8.370247200000007 6.094628400000045 -11.417917000000019","6.094628400000045 -11.417917000000019 7.617485399999973 -14.464697800000012","7.617485399999973 -14.464697800000012 10.665688600000015 -15.988799400000035","3.0473142000000224 14.484698200000016 6.0948062 16.00826640000001","1.5237460000000291 11.437739599999984 3.0473142000000224 14.484698200000016","1.5237460000000291 11.437739599999984 1.5237460000000291 6.866145999999986","1.5237460000000291 6.866145999999986 3.046069600000011 3.8204319999999665","3.046069600000011 3.8204319999999665 6.094095000000016 0.772406599999961","25.901370600000025 -2.275441000000008 27.425472200000048 -3.799542600000029","25.901370600000025 -2.275441000000008 27.42565 -0.7511616000000316","27.42565 -0.7511616000000316 28.949751600000024 -2.275263199999971","28.949751600000024 -2.275263199999971 28.949751600000024 -3.799364799999994","27.426005599999993 -5.323110800000022 28.949751600000024 -3.799364799999994","25.90368200000001 -5.323110800000022 27.426005599999993 -5.323110800000022","24.378158000000024 -3.797586800000035 25.90368200000001 -5.323110800000022","22.85156719999998 -0.7410269999999883 24.378158000000024 -3.797586800000035","19.807453400000046 6.866323800000022 22.85156719999998 -0.7410269999999883","16.760494800000014 11.437206200000038 19.807453400000046 6.866323800000022","13.713358400000029 14.48452039999998 16.760494800000014 11.437206200000038","10.665510799999979 16.00826640000001 13.713358400000029 14.48452039999998","6.0948062 16.00826640000001 10.665510799999979 16.00826640000001","1.523568199999993 14.484164799999988 6.0948062 16.00826640000001","0 11.437383999999994 1.523568199999993 14.484164799999988","0 11.437383999999994 0 6.866323800000022","0 6.866323800000022 1.5257018000000233 3.817587200000034","1.5257018000000233 3.817587200000034 6.094094999997853 0.7724066000014034","6.094095000000016 0.772406599999961 10.668533400000028 -2.278463599999977","10.668533400000028 -2.278463599999977 13.713002800000037 -5.32275520000003","13.713002800000037 -5.32275520000003 15.236748799999985 -8.370247200000007","15.236748799999985 -8.370247200000007 15.236748799999985 -11.417383599999992","13.713180599999992 -14.464875599999969 15.236748799999985 -11.417383599999992","10.665688600000015 -15.988799400000035 13.713180599999992 -14.464875599999969"]},"'":{path:["0 -6.846378000000001 1.5239237999999846 -8.370301800000025","1.5239237999999846 -8.370301800000025 3.0473142000000224 -11.417616000000006","3.0473142000000224 -11.417616000000006 3.0473142000000224 -14.46493020000003","1.5237460000000291 -15.988498400000022 3.0473142000000224 -14.46493020000003","2.7522019189376156e-16 -14.464752400000034 1.5237460000000291 -15.988498400000022","1.375940368856182e-16 -14.464752400000034 1.5233904000000376 -12.941006400000004"]},"`":{path:["1.5315692000000058 -9.903336600000028 3.054959599999963 -8.37994619999999","1.5313913999999698 -6.856377999999999 3.054959599999963 -8.379946199999992","0.007645400000021346 -8.380124000000027 1.5313913999999698 -6.856377999999999","0.007645400000021346 -8.380124000000027 0.007645400000021346 -11.427259512341902","0.007645400000021346 -11.427259512341903 1.5313913999999698 -14.474574600000036","1.5313913999999698 -14.474574600000036 3.055315199999954 -15.998854000000012"]},"(":{path:["4.570704599999979 -12.95075140000002 7.618196599999997 -19.046091000000008","3.047136399999986 -8.379691200000007 4.570704599999979 -12.95075140000002","1.5237459999999887 -0.7625613999999867 3.047136399999986 -8.379691200000007","1.5237459999999887 5.332600400000002 1.5237459999999887 -0.7625613999999867","1.5237459999999887 5.332600400000002 3.047136399999986 12.949907999999981","3.047136399999986 12.949907999999981 4.571237999999966 17.52185720000001","4.571237999999966 17.52185720000001 7.618196599999997 23.616129999999984","7.618196599999997 23.616129999999984 10.665688599999974 26.663622","4.570882399999975 19.04524760000001 7.618196599999996 23.616129999999984","1.5237459999999887 12.951508199999983 4.570882399999975 19.04524760000001","0 5.3320670000000145 1.5237459999999887 12.951508199999983","0 5.3320670000000145 0 -0.7614946000000113","0 -0.7614946000000113 1.523568199999993 -8.380580199999986","1.523568199999993 -8.380580199999986 4.571237999999966 -14.475386399999987","4.571237999999966 -14.475386399999987 7.618196599999999 -19.046091000000008","7.618196600000005 -19.046091000000022 10.665688599999974 -22.093760800000023"]},")":{path:["3.0480254000000055 -19.04591320000001 6.0948062 -12.951284800000007","6.0948062 -12.951284800000007 7.618907800000021 -8.377735400000017","7.618907800000021 -8.377735400000017 9.141942600000027 -0.7623835999999908","9.141942600000027 5.332778199999998 9.141942600000027 -0.7623835999999908","7.617841000000006 12.952397200000002 9.141942600000027 5.332778199999998","6.094628400000004 17.522035000000006 7.617841000000006 12.952397200000002","3.0471364207661926 23.61666333772206 6.094628400000004 17.522035000000006","0.0001777999999957956 26.663622 3.0474919792399064 23.616130010386698","3.047491979239907 23.616130010386698 6.0948062 19.04524760000001","6.0948062 19.04524760000001 9.142120400000023 12.950263599999973","9.142120400000023 12.950263599999973 10.665688600000015 5.332422600000006","10.665688600000015 5.332422600000006 10.665688600000015 -0.7623835999999908","9.141942600000027 -8.380935800000021 10.665688600000015 -0.7623835999999908","6.094984000000036 -14.474675200000004 9.141942600000027 -8.380935800000021","3.0480254000000055 -19.04591320000001 6.094984000000036 -14.474675200000004","0 -22.093760800000023 3.0480254000000055 -19.04591320000001"]},"*":{path:["0 -2.2853046000000203 15.247950200000004 -11.437559600000005","0.0037338000000329886 -11.430447600000011 15.241904999999985 -2.2869048000000225","7.622285999999981 2.2836220000000007 7.622285999999981 -15.999196399999997"]},"+":{path:["0 2.2954414000000067 27.425116600000056 2.2954414000000067","13.711758200000027 16.008622 13.711758200000027 -11.418628200000002"]},",":{path:["0 22.088622 1.5239238000000654 20.564164799999986","1.5239238000000654 20.564164799999986 3.047136400000067 17.51756180000003","3.047136400000067 17.51756180000003 3.047136400000067 14.4706032","0 14.4706032 1.5235682000000739 12.947035000000007","0 14.4706032 1.5235682000000745 15.994171399999992","1.523568200000074 15.994171399999992 3.047136400000067 14.4706032","1.5235682000000739 12.947035000000007 3.047136400000067 14.4706032"]},"-":{path:["0 2.284622 27.439162800000005 2.284622"]},".":{path:["0 14.479698199999977 1.523923800000025 12.955952199999988","0 14.479698199999977 1.523923800000025 16.003622","1.523923800000025 16.003622 3.0478476000000096 14.479698199999977","1.523923800000025 12.955952199999988 3.0478476000000096 14.479698199999977"]},"/":{path:["0 20.563622 21.3310216 -16.00379279999999"]},":":{path:["0 14.479698199999977 1.523923800000025 12.956129999999984","0 14.479698199999977 1.523923800000025 16.003622","1.523923800000025 16.003622 3.0476698000000138 14.479875999999972","1.523923800000025 12.956129999999984 3.0476698000000138 14.479875999999972","0.0001777999999957956 -3.804186999999997 1.523923800000025 -5.327933000000025","0.0001777999999957956 -3.804186999999997 1.523923800000025 -2.280441000000007","1.523923800000025 -2.280441000000007 3.0476698000000138 -3.804186999999997","1.523923800000025 -5.327933000000025 3.0476698000000138 -3.804186999999997"]},";":{path:["0.0005333999999873868 22.103622 1.5241015999999803 20.580053799999966","1.5241015999999803 20.580053799999966 3.0474919999999774 17.533095199999977","3.0474919999999774 17.533095199999977 3.0474919999999774 14.485425399999963","1.5239237999999846 12.961857199999969 3.0474919999999774 14.485425399999963","2.75188085013597e-16 14.485780999999996 1.5239237999999846 12.961857199999969","1.3759404250680035e-16 14.485780999999996 1.5237459999999887 16.009526999999984","1.5237459999999887 16.009526999999984 3.0474919999999774 14.485425399999963","0.00017779999999814104 -3.7982820000000146 1.5239237999999846 -5.3220279999999995","0.0001777999999981411 -3.7982820000000146 1.5239237999999846 -2.2745360000000225","1.5239237999999846 -2.2745360000000225 3.0476697999999733 -3.7982820000000146","1.5239237999999846 -5.3220279999999995 3.0476697999999733 -3.7982820000000146"]},"<":{path:["0 2.2906192000000036 24.379047000000003 16.003622","0 2.2906192000000036 24.378869200000008 -11.422383599999991"]},"=":{path:["0 6.858622 27.426716799999976 6.858622","0.0005334000000278139 -2.2831427999999505 27.42689460000001 -2.2831427999999505"]},">":{path:["0 16.003622 24.378513600000016 2.2907969999999995","0 -11.422028 24.378513600000016 2.2907969999999995"]},"?":{path:["7.618196599999997 14.479698200000017 9.142120399999982 12.956130000000023","7.618196599999997 14.479698200000017 9.142120399999982 16.003622","9.142120399999982 16.003622 10.66586639999997 14.479876000000013","9.142120399999982 12.956130000000023 10.66586639999997 14.479876000000013","9.141942599999986 5.337755600000031 9.141942599999986 0.7667835621225088","9.141942599999986 0.7667835621225088 15.23692659999998 -2.2811521999999904","15.23692659999998 -2.2811521999999904 16.760850400000006 -3.8050759999999766","16.760850400000006 -3.8050759999999766 18.284063000000007 -6.85185679999997","18.284063000000007 -6.85185679999997 18.284063000000007 -9.898815399999998","16.760494799999975 -12.946307399999975 18.284063000000007 -9.898815399999998","15.23692659999998 -14.469875599999968 16.760494799999975 -12.946307399999975","12.1896124 -15.993621599999996 15.23692659999998 -14.469875599999968","6.094628400000004 -15.993621599999996 12.1896124 -15.993621599999996","3.047136399999986 -14.469875599999968 6.094628400000004 -15.993621599999996","1.5233903999999971 -12.94612959999998 3.047136399999986 -14.469875599999968","0 -9.898815399999998 1.5233903999999971 -12.94612959999998","0 -8.375247200000006 0 -9.898815399999998"]},"@":{path:["25.902259599999965 12.951307799999979 27.426005599999993 11.427739599999985","22.854234199999958 14.475231599999963 25.902259599999965 12.951307799999979","18.284596399999955 15.998622000000001 22.854234199999958 14.475231599999963","13.713002799999957 15.998622000000001 18.284596399999955 15.998622000000001","9.142120399999941 14.474698200000017 13.713002799999957 15.998622000000001","6.0948062 12.951485600000014 9.142120399999941 14.474698200000017","3.0476698000000138 9.904171399999992 6.0948062 12.951485600000014","1.5239237999999846 6.857035000000006 3.0476698000000138 9.904171399999992","0 2.285619199999962 1.5239237999999846 6.857035000000006","0 2.285619199999962 0 -2.284729800000024","0 -2.284729800000024 1.5233903999999567 -6.856145599999987","1.5233903999999567 -6.856145599999987 3.0476698000000138 -9.904170999999991","3.0476698000000138 -9.904170999999991 6.0948062 -12.951307400000058","6.0948062 -12.951307400000058 9.143009399999961 -14.475053400000004","9.143009399999961 -14.475053400000004 13.713180599999992 -15.998443800000043","9.142120399999941 6.856501599999978 12.189434599999966 8.380425399999964","7.618552199999948 3.8090095999999996 9.142120399999941 6.856501599999978","7.618552199999948 3.8090095999999996 7.618552199999948 -0.7624062000000418","7.618552199999948 -0.7624062000000418 9.142298199999978 -5.33275520000003","9.142298199999978 -5.33275520000003 10.666221999999962 -6.856679000000014","10.666221999999962 -6.856679000000014 13.713358399999947 -8.380069400000053","21.331554999999984 -6.856501200000061 22.855301000000015 -3.80865360000001","18.284063000000007 -8.380069400000053 21.331554999999984 -6.856501200000061","13.713358399999947 -8.380069400000053 18.284063000000007 -8.380069400000053","10.665688599999934 -5.33275520000003 13.713358399999947 -8.380069400000053","9.142120399999941 -0.7611616000000314 10.665688599999934 -5.33275520000003","9.142120399999941 3.8086540000000095 9.142120399999941 -0.7611616000000314","9.142120399999941 3.8086540000000095 10.66586639999997 6.856857199999969","10.66586639999997 6.856857199999969 12.189434599999963 8.380425399999964","12.189434599999963 8.380425399999964 16.76031699999998 8.380425399999964","16.76031699999998 8.380425399999964 19.807453399999964 6.857390599999998","19.807453399999964 6.857390599999998 21.33137719999995 3.809542999999948","21.33137719999995 3.809542999999948 22.85494539999994 -8.379358199999988","21.33137719999995 6.856501599999978 21.33137719999995 3.809542999999948","21.33137719999995 6.856501599999978 24.378691399999973 8.380247600000008","22.85512319999998 3.809720799999983 24.378869200000008 -8.380780600000037","22.85512319999998 6.856679400000014 22.85512319999998 3.809720799999983","22.85512319999998 6.856679400000014 24.378691399999973 8.380247600000008","24.378691399999973 8.380247600000008 27.42618339999995 8.380247600000008","27.42618339999995 8.380247600000008 30.47278639999999 5.334177999999996","30.47278639999999 5.334177999999996 31.997065799999966 0.7624065999999612","31.997065799999966 0.7624065999999612 31.997065799999966 -2.2852632000000526","30.47385319999996 -6.856145599999987 31.997065799999966 -2.2852632000000526","28.949751599999942 -9.9038154 30.47385319999996 -6.856145599999987","25.902615199999957 -12.95112960000002 28.949751599999942 -9.9038154","22.853522999999974 -14.475231200000042 25.902615199999957 -12.95112960000002","18.284596399999955 -15.998443800000043 22.853522999999974 -14.475231200000042","13.713180599999992 -15.998443800000043 18.284596399999955 -15.998443800000043"]},A:{path:["4.571415799999962 5.332577799999993 19.8076312 5.332577799999993","12.189434599999963 -15.99879939999995 24.379046999999964 15.998622000000001","0 15.99826640000001 12.189434599999963 -15.998799399999953"]},B:{path:["0 15.997266000000003 13.714425200000003 15.997266000000003","13.714425200000003 15.997266000000003 18.284596400000034 14.473342199999937","18.284596400000034 14.473342199999937 19.80798679999999 12.949951799999981","19.80798679999999 12.949951799999981 21.331555000000066 9.902459800000004","21.331555000000066 9.902459800000004 21.331555000000066 5.331577399999988","19.80816460000003 2.284618799999958 21.331555000000066 5.331577399999988","18.284952000000025 0.7608727999999285 19.80816460000003 2.284618799999958","13.713536200000064 -0.7630510000000559 18.284952000000025 0.7608727999999285","0 -0.7630510000000559 13.713536200000064 -0.7630510000000559","13.713536200000064 -0.7630510000000559 18.284952000000025 -2.2869748000000403","18.284952000000025 -2.2869748000000403 19.807453400000046 -3.8094762000000593","19.807453400000046 -3.8094762000000593 21.33226620000005 -6.857501600000063","21.33226620000005 -6.857501600000063 21.33226620000005 -9.90499360000004","19.8076312 -12.952663400000052 21.33226620000005 -9.90499360000004","18.284063000000007 -14.476231600000048 19.8076312 -12.952663400000052","13.713180599999992 -16.000155400000033 18.284063000000007 -14.476231600000048","0 -16.000155400000033 13.713180599999992 -16.000155400000033","0 15.997266000000003 0 -16.000155400000033"]},C:{path:["21.331199399999996 11.427739599999985 22.855123200000058 8.380425400000044","18.283707400000015 14.475231600000043 21.331199399999996 11.427739599999985","15.237104400000058 15.998622000000001 18.283707400000015 14.475231600000043","9.141942599999986 15.998622000000001 15.237104400000058 15.998622000000001","6.095161799999992 14.475231600000043 9.141942599999986 15.998622000000001","3.0473142000000224 11.42756180000003 6.095161799999992 14.475231600000043","1.5237460000000291 8.3806032 3.0473142000000224 11.42756180000003","0 3.8093651999999913 1.5237460000000291 8.3806032","0 3.8093651999999913 0 -3.8084757999999717","0 -3.8084757999999717 1.5237460000000291 -8.380424999999963","1.5237460000000291 -8.380424999999963 3.0474920000000583 -11.427561399999945","3.0474920000000583 -11.427561399999945 6.094628400000045 -14.474697800000012","6.094628400000045 -14.474697800000012 9.142298200000058 -15.998621599999996","9.142298200000058 -15.998621599999996 15.236926600000022 -15.998621599999996","15.236926600000022 -15.998621599999996 18.284240800000045 -14.474697800000012","18.284240800000045 -14.474697800000012 21.331732800000022 -11.426850199999965","21.331732800000022 -11.426850199999965 22.854945400000023 -8.379891600000015"]},D:{path:["0 15.998622000000001 0 -15.998621600000003","0 15.998622000000001 10.66551080000006 15.998622000000001","10.66551080000006 15.998622000000001 15.236393199999995 14.474164799999988","15.236393199999995 14.474164799999988 18.285129800000064 11.425428199999999","18.285129800000064 11.425428199999999 19.807631200000003 8.380425399999964","19.807631200000003 8.380425399999964 21.331199399999996 3.8086540000000095","21.331199399999996 3.8086540000000095 21.331199399999996 -3.8100760000000555","19.809231400000005 -8.377580200000029 21.331199399999996 -3.8100760000000555","18.283885200000054 -11.428094800000054 19.809231400000005 -8.377580200000029","15.237104400000058 -14.47487560000005 18.283885200000054 -11.428094800000054","10.666044200000007 -15.998621599999996 15.237104400000058 -14.47487560000005","0 -15.998621599999996 10.666044200000007 -15.998621599999996"]},E:{path:["0 -0.7568728000000142 12.189434599999963 -0.7568728000000142","0 16.003622 19.808875800000013 16.003622","0 16.003622 0 -15.993443800000042","0 -15.993443800000042 19.80798679999999 -15.993443800000042"]},F:{path:["0 -0.757228400000006 12.188723399999981 -0.757228400000006","0 16.003622 0 -15.993799399999952","0 -15.993799399999952 19.807631200000003 -15.993799399999952"]},G:{path:["15.236748799999985 3.814365199999992 22.85512319999998 3.814365199999992","22.85512319999998 8.3856032 22.85512319999998 3.814365199999992","21.331554999999984 11.433095200000059 22.85512319999998 8.3856032","18.28477419999999 14.479876000000052 21.331554999999984 11.433095200000059","15.236748799999985 16.003622 18.28477419999999 14.479876000000052","6.094628400000004 14.48005380000001 9.142476000000014 16.003622","9.142476000000014 16.003622 15.236748799999985 16.003622","3.046425200000003 11.431139400000065 6.094628400000004 14.48005380000001","1.523568199999993 8.385425400000045 3.046425200000003 11.431139400000065","0 3.8148986000000207 1.523568199999993 8.385425400000045","0 3.8148986000000207 0 -3.804009200000001","0 -3.804009200000001 1.5237459999999887 -8.375247200000006","1.5237459999999887 -8.375247200000006 3.048380999999997 -11.423450399999966","3.048380999999997 -11.423450399999966 6.095161799999992 -14.469875599999968","6.095161799999992 -14.469875599999968 9.142298199999978 -15.99344379999996","9.142298199999978 -15.99344379999996 15.236215399999999 -15.99344379999996","15.236215399999999 -15.99344379999996 18.283707399999976 -14.470053400000003","18.283707399999976 -14.470053400000003 21.3310216 -11.423272599999928","21.3310216 -11.423272599999928 22.85512319999998 -8.375424999999963"]},H:{path:["0 -0.7568727999999325 21.33137720000003 -0.7568727999999325","21.33137720000003 16.003622 21.33137720000003 -15.992554799999942","0 16.003622 0 -15.993088199999969"]},I:{path:["0 16.003622 0 -15.994155000000026"]},J:{path:["0 8.385069799999972 0 5.338111200000022","0 8.385069799999972 1.5244572000000125 12.957018999999962","1.5244572000000125 12.957018999999962 3.0478475999999692 14.480231599999964","3.0478475999999692 14.480231599999964 6.095339599999947 16.003622","6.095339599999947 16.003622 9.142298199999978 16.003622","9.142298199999978 16.003622 12.190501400000018 14.478986999999952","12.190501400000018 14.478986999999952 13.713002799999957 12.95630779999998","13.713002799999957 12.95630779999998 15.236748799999985 8.385425399999964","15.236748799999985 8.385425399999964 15.236748799999985 -15.992732599999977"]},K:{path:["7.618557644362181 -2.2804337407328195 21.33137720000003 16.003622","0 5.337933399999986 21.331554999999984 -15.993088199999969","0 16.003266400000008 0 -15.99344379999996"]},L:{path:["0 16.003622 18.284240800000045 16.003622","0 16.003622 0 -15.993977199999987"]},M:{path:["12.189468441542692 15.983464102892793 24.378869200000008 -16.013535200000014","24.378869200000008 15.983530600000032 24.378869200000008 -16.013535200000014","0 -16.013001799999984 12.189468441542692 15.983464102892798","0 15.983886200000024 0 -16.013001799999984"]},N:{path:["21.331732800000022 15.953749238347944 21.331732800000022 -16.04393899999998","0 -16.04376120000002 21.331732800000022 15.953749238347942","0 15.95277119999999 0 -16.04376120000002"]},O:{path:["6.094095000000016 -14.469164399999984 9.142831600000004 -15.993621599999996","3.0469586000000306 -11.422028 6.094095000000016 -14.469164399999984","1.5237460000000291 -8.375602799999998 3.0469586000000306 -11.422028","0 -3.8038314000000053 1.5237460000000291 -8.375602799999998","0 3.814720799999984 0 -3.8038314000000053","0 3.814720799999984 1.5232126000000015 8.384536399999984","1.5232126000000015 8.384536399999984 3.0480254000000055 11.433273000000014","3.0480254000000055 11.433273000000014 6.094450600000008 14.479876000000013","6.094450600000008 14.479876000000013 9.142476000000014 16.003622","9.142476000000014 16.003622 15.23657100000003 16.003622","15.23657100000003 16.003622 18.284240800000003 14.479698200000017","18.284240800000003 14.479698200000017 21.331555000000026 11.432561799999991","21.331555000000026 11.432561799999991 22.855301000000015 8.384892000000017","22.855301000000015 8.384892000000017 24.378869200000008 3.8150764000000166","24.378869200000008 3.8150764000000166 24.378869200000008 -3.804186999999997","22.854767600000027 -8.375780599999993 24.378869200000008 -3.804186999999997","21.331732800000022 -11.422561399999987 22.854767600000027 -8.375780599999993","18.284774200000033 -14.469520000000015 21.331732800000022 -11.422561399999987","15.236926600000022 -15.993621599999996 18.284774200000033 -14.469520000000015","9.142831600000004 -15.993621599999996 15.236926600000022 -15.993621599999996"]},P:{path:["0 0.7665176000000233 13.712647200000005 0.7665176000000233","13.712647200000005 0.7665176000000233 18.284240800000003 -0.7570506000000101","18.284240800000003 -0.7570506000000101 19.80798680000003 -2.2813299999999863","19.80798680000003 -2.2813299999999863 21.331377200000027 -5.328466400000012","21.331377200000027 -5.328466400000012 21.331377200000027 -9.89917099999999","19.808520200000018 -12.945773999999988 21.331377200000027 -9.89917099999999","18.284240800000003 -14.470053400000003 19.808520200000018 -12.945773999999988","13.71371400000002 -15.993799399999991 18.284240800000003 -14.470053400000003","6.938893903907228e-18 -15.993799399999991 13.71371400000002 -15.993799399999991","6.938893903907228e-18 16.003622 6.938893903907228e-18 -15.993799399999991"]},Q:{path:["13.713358400000029 9.911145999999988 22.855656600000007 19.053622","6.0948062 -14.468078800000011 9.14265379999997 -15.991469200000008","3.0469586000000306 -11.41934220000002 6.0948062 -14.468078800000011","1.5233903999999567 -8.371850200000004 3.0469586000000306 -11.41934220000002","8.673617379884035e-19 -3.8018568000000093 1.5233903999999567 -8.371850200000004","8.673617379884035e-19 3.81634129011747 8.673617379884035e-19 -3.8018568000000093","0 3.81634129011747 1.5232126000000015 8.38651099999998","1.5232126000000015 8.38651099999998 3.0471363999999856 11.434536399999985","3.0471363999999856 11.434536399999985 6.094450600000008 14.482028399999962","6.094450600000008 14.482028399999962 9.142476000000014 16.005596599999997","9.142476000000014 16.005596599999997 15.23781559999996 16.005596599999997","15.23781559999996 16.005596599999997 18.284063000000007 14.4822062","18.284063000000007 14.4822062 21.331554999999987 11.434536399999985","21.331554999999987 11.434536399999985 22.854945400000023 8.388288999999977","22.854945400000023 8.388288999999977 24.378691399999973 3.8163397999999864","24.378691399999973 3.8163397999999864 24.378691399999973 -3.802212400000001","22.855301000000015 -8.372739200000023 24.378691399999973 -3.802212400000001","21.33137720000003 -11.420409000000038 22.855301000000015 -8.372739200000023","18.282818399999996 -14.468434400000003 21.33137720000003 -11.420409000000038","15.236926600000022 -15.991469200000008 18.282818399999996 -14.468434400000003","9.14265379999997 -15.991469200000008 15.236926600000022 -15.991469200000008"]},R:{path:["10.665866400000013 -0.7579396000000287 21.331910600000015 16.003622","0 16.00237739999999 0 -15.99486620000001","0 -0.7579396000000287 13.712647200000005 -0.7579396000000287","13.712647200000005 -0.7579396000000287 18.284063000000007 -2.281685600000017","18.284063000000007 -2.281685600000017 19.808164600000026 -3.80614280000003","19.808164600000026 -3.80614280000003 21.331555000000023 -6.853634800000007","21.331555000000023 -6.853634800000007 21.331555000000023 -9.899526600000025","19.807453400000004 -12.947374200000029 21.331555000000023 -9.899526600000025","18.28352960000002 -14.471298000000017 19.807453400000004 -12.947374200000029","13.713536200000025 -15.99486620000001 18.28352960000002 -14.471298000000017","0 -15.99486620000001 13.713536200000025 -15.99486620000001"]},S:{path:["13.713180599999992 16.003622 18.284418600000002 14.479698199999977","18.285129799999982 -14.469520000000015 21.331732799999983 -11.422383599999991","13.712469399999968 -15.993621599999996 18.285129799999982 -14.469520000000015","7.619263399999972 -15.993621599999996 13.712469399999968 -15.993621599999996","3.0474032084707825 -14.469786591124029 7.619263399999972 -15.993621599999996","0.00017779999999579556 -11.422206400325992 3.047403208470784 -14.469786591124029","0.00017779999999579556 -8.374713800000018 0.00017779999999579556 -11.422206400325992","0.00017779999999579556 -8.374713800000018 1.5246349999999678 -5.327044000000006","1.5246349999999678 -5.327044000000006 3.048025400000005 -3.8038314000000053","3.048025400000005 -3.8038314000000053 6.094272799999972 -2.2809743999999945","6.094272799999972 -2.2809743999999945 15.237459999999968 0.7670509999999702","15.237459999999968 0.7670509999999702 18.284951999999986 2.2906192000000036","18.284951999999986 2.2906192000000036 19.808520199999982 3.8141873999999962","19.808520199999982 3.8141873999999962 21.331732799999983 6.861323799999983","21.331732799999983 11.432383999999995 21.331732799999983 6.861323799999983","18.284418600000002 14.479698199999977 21.331732799999983 11.432383999999995","7.618552199999989 16.003622 13.713180599999992 16.003622","3.0474919999999774 14.48005380000001 7.618552199999989 16.003622","0 11.432561799999991 3.0474919999999774 14.48005380000001"]},T:{path:["10.66586639999997 16.003622 10.66586639999997 -15.993621599999992","0 -15.993621599999996 21.331554999999984 -15.993621599999996"]},U:{path:["21.331377199999988 6.861679400000015 21.331377199999988 -15.9934438","19.807453399999964 11.433273000000014 21.331377199999988 6.861679400000015","16.760494799999975 14.480231600000003 19.807453399999964 11.433273000000014","12.189434599999963 16.003622 16.760494799999975 14.480231600000003","9.141942599999986 16.003622 12.189434599999963 16.003622","4.5710601999999705 14.479876000000013 9.141942599999986 16.003622","1.5239237999999846 11.432739599999985 4.5710601999999705 14.479876000000013","0 6.861323799999983 1.5239237999999846 11.432739599999985","0 6.861323799999983 0 -15.993621599999996"]},V:{path:["12.189434599999963 16.003622 24.379046999999964 -15.993621599999996","0 -15.992910399999973 12.189434599999963 16.003622"]},W:{path:["22.854945399999984 16.003622 30.473319799999974 -15.993088200000011","15.236748800000026 -15.9934438 22.854945399999984 16.003622","7.618196599999997 16.00326639999997 15.236748800000026 -15.9934438","0 -15.993266000000007 7.618196599999997 16.00326639999997"]},X:{path:["0.0001777999999957956 16.003088600000012 21.331377199999988 -15.9934438","0 -15.993088200000011 21.3310216 16.003622"]},Y:{path:["12.1896124 -0.757228400000006 24.3792248 -15.993977199999987","12.1896124 16.003622 12.1896124 -0.757228400000006","0 -15.993799399999991 12.1896124 -0.757228400000006"]},Z:{path:["0 15.997043400000036 21.331436442301374 15.997043400000036","0 15.997043400000036 21.33161424230137 -16.000200199999966","0.0005926423013725259 -16.000200199999966 21.33161424230137 -16.000200199999966"]},"[":{path:["0 17.52048840000001 7.618196599999997 17.52048840000001","0 17.52048840000001 0 -12.952831399999926","0 -12.952831399999926 7.618196599999997 -12.952831399999926","1.523568199999993 17.52048840000001 1.523568199999993 -12.952831399999926"]},"\\":{path:["0 -15.993970599999983 21.331199399999996 20.573622"]},"]":{path:["6.094628400000004 17.52048840000001 6.094628400000004 -12.95247579999997","7.618374399999992 17.52048840000001 -0.0001777999999958979 17.52048840000001","7.618374399999992 17.52048840000001 7.618374399999992 -12.95247579999997","7.618374399999992 -12.95247579999997 0 -12.95247579999997"]},"^":{path:["12.188040872554353 -11.43098812999583 19.80568200000002 -5.336733600000027","4.57 -5.336378 12.188040872554353 -11.43098812999583","12.187930081181365 -12.954485518818636 19.805682 -5.336733600000041","4.57 -5.336378 12.187930081181365 -12.954485518818636"]},_:{path:["0 26.658622 24.378513600000016 26.658622"]},a:{path:["15.23746000000001 -3.8038314000000444 18.284063000000007 -0.7570506829726522","12.189434600000004 -5.327933000000064 15.23746000000001 -3.8038314000000444","7.618196599999997 -5.327933000000064 12.189434600000004 -5.327933000000064","4.5708824000000154 -3.804364800000071 7.618196599999997 -5.327933000000064","1.5237460000000291 -0.757228400000006 4.5708824000000154 -3.804364800000071","0 3.814365199999992 1.5237460000000291 -0.757228400000006","0 6.861145999999987 0 3.814365199999992","0 6.861145999999987 1.5241016000000207 11.43256179999995","1.5241016000000207 11.43256179999995 4.571593599999998 14.480053799999927","4.571593599999998 14.480053799999927 7.618730000000025 16.003622","7.618730000000025 16.003622 12.189079000000012 16.003622","12.189079000000012 16.003622 15.237282200000013 14.479342599999944","15.237282200000013 14.479342599999944 18.284063000000007 11.432206199999959","18.284063000000007 16.00326639999993 18.284063000000007 -5.327933000000064"]},b:{path:["0 11.432739599999985 3.047136399999986 14.479875999999972","3.047136399999986 14.479875999999972 6.095161799999992 16.003622","6.095161799999992 16.003622 10.66551080000002 16.003622","10.66551080000002 16.003622 13.712825 14.480587199999956","13.712825 14.480587199999956 16.760494800000014 11.432917400000022","16.760494800000014 11.432917400000022 18.284063000000007 6.861145999999987","18.284063000000007 6.861145999999987 18.284063000000007 3.814365199999992","16.760494800000014 -0.757050600000051 18.284063000000007 3.814365199999992","13.712825 -3.804364799999993 16.760494800000014 -0.757050600000051","10.665688600000015 -5.327755200000029 13.712825 -3.804364799999993","6.095161799999992 -5.327755200000029 10.665688600000015 -5.327755200000029","0 -0.7566950000000183 3.047136399999986 -3.8038314000000444","3.047136399999986 -3.8038314000000444 6.095161799999992 -5.327755200000029","0 16.003444199999965 0 -15.992732599999977"]},c:{path:["15.236037600000003 14.480231599999964 18.283707400000015 11.43256179999995","12.188901200000016 16.003622 15.236037600000003 14.480231599999964","7.618552200000029 16.003622 12.188901200000016 16.003622","4.570526800000024 14.479342599999944 7.618552200000029 16.003622","1.5233903999999971 11.432206199999959 4.570526800000024 14.479342599999944","0 6.861323799999942 1.5233903999999971 11.432206199999959","0 6.861323799999942 0 3.8136539999999286","0 3.8136539999999286 1.523923800000025 -0.757050600000051","1.523923800000025 -0.757050600000051 4.5708824000000154 -3.804009200000001","4.5708824000000154 -3.804009200000001 7.618552200000029 -5.327933000000064","7.618552200000029 -5.327933000000064 12.189790199999996 -5.327933000000064","12.189790199999996 -5.327933000000064 15.236926600000022 -3.8038314000000444","15.236926600000022 -3.8038314000000444 18.284063000000007 -0.7566950000000592"]},d:{path:["15.237282200000013 14.479698200000017 18.284240800000003 11.432739600000067","12.189079000000012 16.003622 15.237282200000013 14.479698200000017","7.618374400000033 16.003622 12.189079000000012 16.003622","4.5708824000000154 14.480231600000044 7.618374400000033 16.003622","1.5237460000000291 11.433095200000059 4.5708824000000154 14.480231600000044","0 6.86150160000006 1.5237460000000291 11.433095200000059","0 6.86150160000006 0 3.8148986000000207","0 3.8148986000000207 1.5233903999999971 -0.7566949999999775","1.5233903999999971 -0.7566949999999775 4.570526800000024 -3.8038313999999627","4.570526800000024 -3.8038313999999627 7.618907800000021 -5.327755199999947","15.23746000000001 -3.8038313999999627 18.284240800000003 -0.7570505999999693","12.189256800000008 -5.327755199999947 15.23746000000001 -3.8038313999999627","7.618907800000021 -5.327755199999947 12.189256800000008 -5.327755199999947","18.284240800000003 16.003622 18.284240800000003 -15.993621599999996"]},e:{path:["4.571060200000011 -3.8038314000000053 7.618196599999997 -5.327755200000029","1.523568199999993 -0.7563394000000265 4.571060200000011 -3.8038314000000053","8.422627534000469e-16 3.8141873999999962 1.523568199999993 -0.7563394000000265","15.236748799999985 14.479875999999972 18.28388520000001 11.432739599999985","12.189434600000004 16.003622 15.236748799999985 14.479875999999972","4.571060200000011 14.479698199999977 7.616240800000003 16.003622","7.616240800000003 16.003622 12.189434600000004 16.003622","1.523568199999993 11.4322062 4.571060200000011 14.479698199999977","0 6.862034999999966 1.523568199999993 11.4322062","0 6.862034999999966 0 3.8141873999999962","1.402594689482959e-31 3.8141873999999962 18.284240800000003 3.8141873999999962","16.760850400000006 -2.280263200000011 18.284240800000003 0.7672287999999661","18.284240800000003 3.8141873999999962 18.284240800000003 0.7672287999999661","15.236926600000022 -3.804187000000036 16.760850400000006 -2.280263200000011","12.1896124 -5.327755200000029 15.236926600000022 -3.804187000000036","7.618196599999997 -5.327755200000029 12.1896124 -5.327755200000029"]},f:{path:["0 -5.327933000000025 10.665688599999974 -5.327933000000025","4.571237999999966 16.003622 4.571237999999966 -9.898993199999994","4.571237999999966 -9.898993199999994 6.094628399999964 -14.469875600000007","6.094628399999964 -14.469875600000007 9.142831599999965 -15.993799399999991","9.142831599999965 -15.993799399999991 12.1896124 -15.993799399999991"]},g:{path:["15.236926600000022 14.4740096 18.28388520000001 11.42705099999997","12.189434600000004 15.997577799999995 15.236926600000022 14.4740096","7.618374399999992 15.997577799999995 12.189434600000004 15.997577799999995","4.570526799999983 14.473831800000006 7.618374399999992 15.997577799999995","1.5237459999999887 11.427051000000011 4.570526799999983 14.473831800000006","0 6.855813000000003 1.5237459999999887 11.427051000000011","0 6.855813000000003 0 3.8090322000000096","0 3.8090322000000096 1.5233903999999971 -0.7627392000000217","1.5233903999999971 -0.7627392000000217 4.570348999999988 -3.809697800000011","4.570348999999988 -3.809697800000011 7.617841000000006 -5.3334437999999995","15.236215399999999 -3.8102311999999987 18.28388520000001 -0.7625613999999903","12.189434600000004 -5.3334437999999995 15.236215399999999 -3.8102311999999987","7.617841000000006 -5.3334437999999995 12.189434600000004 -5.3334437999999995","4.5707046000000195 25.13969820000002 7.618552199999988 26.663622","7.618552199999988 26.663622 12.189079000000012 26.663622","12.189079000000012 26.663622 15.237104400000018 25.13952039999998","15.237104400000018 25.13952039999998 16.760494800000014 23.616129999999984","16.760494800000014 23.616129999999984 18.28388520000001 19.044891999999976","18.28388520000001 19.044891999999976 18.28388520000001 -5.335399599999997"]},h:{path:["3.0843383402867632e-19 0.7668731999999743 4.571060200000011 -3.804186999999997","4.571060200000011 -3.804186999999997 7.618552200000029 -5.327755200000029","16.76031700000002 16.003622 16.76031700000002 0.7663397999999866","15.23746000000001 -3.8038314000000053 16.76031700000002 0.7663397999999866","12.189256800000008 -5.327755200000029 15.23746000000001 -3.8038314000000053","7.618552200000029 -5.327755200000029 12.189256800000008 -5.327755200000029","0 16.00326639999997 0 -15.99273260000002"]},i:{path:["4.57410160000002 16.003622 4.57410160000002 -5.32775519999999","3.05 -15.992732599999977 4.574012705185188 -17.516745305185168","4.573923799999984 -17.516834199999998 4.573923799999984 -17.516834199999998","3.05 -15.992732599999977 3.05 -15.992910399999973","3.05 -15.992732599999977 4.57410160000002 -14.468630999999997","4.57410160000002 -14.468630999999997 6.0982032 -15.992732599999977","4.574012705185186 -17.516745305185168 6.0982032 -15.992732599999977"]},j:{path:["0 26.663622 3.0469586000000306 26.663622","3.0469586000000306 26.663622 6.094272800000012 25.13952039999998","6.094272800000012 25.13952039999998 7.617841000000006 20.568104599999977","7.617841000000006 20.568104599999977 7.617841000000006 -5.3334437999999995","6.094272800000012 -15.998776799999984 7.618196599999997 -17.52270060000001","6.094272800000012 -15.998776799999984 7.617841000000006 -14.475208599999991","7.617841000000006 -14.475208599999991 9.141764800000031 -15.999132400000018","7.618196599999997 -17.52270060000001 9.141764800000031 -15.999132400000018","7.618196599999997 -17.52270060000001 7.618196599999997 -17.52270060000001"]},k:{path:["6.094744474683139 3.8137868458414115 16.760494799999975 16.003444199999965","0 9.908460199999968 15.236748799999985 -5.328110800000021","0 16.003622 0 -15.993799400000034"]},l:{path:["0 16.003622 0 -15.993088200000011"]},m:{path:["0 0.7665176000000233 4.570349000000028 -3.8038314000000053","4.570349000000028 -3.8038314000000053 7.619263400000013 -5.327755200000029","31.997243218692567 -3.8041864880281313 33.52081180000003 0.7672287999999661","33.52081180000003 16.003622 33.52081180000003 0.7672287999999661","28.949751600000024 -5.327755200000029 31.997243218692567 -3.804186488028135","24.378869200000008 -5.327755200000029 28.949751600000024 -5.327755200000029","21.33137720000003 -3.8036536000000094 24.378869200000008 -5.327755200000029","16.760494800000014 0.7672287999999661 21.33137720000003 -3.8036536000000094","16.760494800000014 16.00326639999997 16.760494800000014 0.7672287999999661","15.236926600000022 -3.804009200000001 16.760494800000014 0.7672287999999661","12.189079000000012 -5.327755200000029 15.236926600000022 -3.804009200000001","7.619263400000013 -5.327755200000029 12.189079000000012 -5.327755200000029","0 16.003622 0 -5.327577400000033"]},n:{path:["0 0.7666953999999784 4.571415800000002 -3.804720400000024","4.571415800000002 -3.804720400000024 7.618552199999988 -5.3282886000000165","15.236852166930989 -3.804579816534522 16.76031700000002 0.7666953999999784","16.76031700000002 16.00326639999997 16.76031700000002 0.7666953999999766","12.189434600000004 -5.3282886000000165 15.236852166930989 -3.804579816534522","7.618552199999988 -5.3282886000000165 12.189434600000004 -5.3282886000000165","0 16.003622 0 -5.328110800000021"]},o:{path:["4.571060200000051 -3.804009200000001 7.618374399999992 -5.32775519999999","1.5237460000000291 -0.7566950000000183 4.571060200000051 -3.804009200000001","0 3.81489859999998 1.5237460000000291 -0.7566950000000183","0 6.861323799999983 0 3.81489859999998","0 6.861323799999983 1.524279400000057 11.432917399999981","1.524279400000057 11.432917399999981 4.571060200000051 14.479876000000013","4.571060200000051 14.479876000000013 7.618729999999984 16.003622","7.618729999999984 16.003622 12.189790200000036 16.003622","12.189790200000036 16.003622 15.237815600000042 14.478986999999993","15.237815600000042 14.478986999999993 18.284240800000045 11.432917399999981","18.284240800000045 11.432917399999981 19.80798679999999 6.861501599999979","19.80798679999999 6.861501599999979 19.80798679999999 3.814365199999992","18.2844186 -0.7566950000000183 19.80798679999999 3.814365199999992","15.237282200000013 -3.8038314000000053 18.2844186 -0.7566950000000183","12.189256800000008 -5.32775519999999 15.237282200000013 -3.8038314000000053","7.618374399999992 -5.32775519999999 12.189256800000008 -5.32775519999999"]},p:{path:["0 -0.7627391999999826 3.047136399999986 -3.809875600000007","3.047136399999986 -3.809875600000007 6.095339599999987 -5.333799399999991","0 26.663444200000004 0 -5.333799399999991","6.095339599999987 -5.333799399999991 10.665688600000015 -5.333799399999991","10.665688600000015 -5.333799399999991 13.713180807322715 -3.8102309926772815","13.71318080732271 -3.8102309926772815 16.76067260000001 -0.7627392000000217","16.76067260000001 -0.7627392000000217 18.284063000000007 3.8086765999999788","18.284063000000007 6.855457399999972 18.284063000000007 3.8086765999999788","16.76067260000001 11.425984199999997 18.284063000000007 6.855457399999972","13.713180599999992 14.473476199999974 16.76067260000001 11.425984199999997","10.665688600000015 15.99775559999999 13.713180599999992 14.473476199999974","6.095339599999987 15.99775559999999 10.665688600000015 15.99775559999999","3.0476698000000138 14.474187399999996 6.095339599999987 15.99775559999999","0 11.426517599999986 3.0476698000000138 14.474187399999996"]},q:{path:["0 6.855812999999964 1.5239237999999846 11.426695399999979","18.284063000000007 26.663622 18.284063000000007 -5.3327326000000195","7.619619000000004 -5.333621599999995 12.1896124 -5.333621599999995","12.1896124 -5.333621599999995 15.235859800000007 -3.8104090000000372","15.235859800000007 -3.8104090000000372 18.284063000000007 -0.7622057999999949","4.571238000000007 -3.810053400000003 7.619619000000004 -5.333621599999995","1.5242794000000166 -0.7630948000000135 4.571238000000007 -3.810053400000003","0 3.808498799999983 1.5242794000000166 -0.7630948000000135","0 6.855812999999964 0 3.808498799999983","7.619085600000016 15.99775559999999 12.189079000000012 15.99775559999999","12.189079000000012 15.99775559999999 15.236393199999995 14.474365199999992","15.236393199999995 14.474365199999992 18.284063000000007 11.426695399999984","4.571593599999998 14.474365199999992 7.619085600000016 15.99775559999999","1.5239237999999846 11.426695399999979 4.571593599999998 14.474365199999992"]},r:{path:["1.734723475976807e-18 3.814013642784264 1.5239237999999846 -0.7570505999999693","1.5239237999999846 -0.7570505999999693 4.571771399999994 -3.8048981999999807","4.571771399999994 -3.8048981999999807 7.619263399999972 -5.3281107999999815","7.619263399999972 -5.3281107999999815 12.188901199999975 -5.3281107999999815","0 16.003622 0 -5.3281107999999815"]},s:{path:["0 11.432028400000004 1.5237460000000291 14.479876000000013","1.5237460000000291 14.479876000000013 6.094983999999996 16.003622","6.094983999999996 16.003622 10.666399799999999 16.003622","10.666399799999999 16.003622 15.237104400000018 14.479876000000013","15.237104400000018 14.479876000000013 16.760850400000045 11.432739600000026","16.760850400000045 11.432739600000026 16.760850400000045 9.908815800000001","15.23746000000001 6.861679400000015 16.760850400000045 9.908815800000001","12.188545599999985 5.337755600000031 15.23746000000001 6.861679400000015","4.571949200000031 3.814543000000029 12.188545599999985 5.337755600000031","1.523923800000025 2.2904414000000077 4.571949200000031 3.814543000000029","0.00035560000003214185 -0.7566949999999775 1.523923800000025 2.2904414000000077","0.00035560000003214185 -0.7566949999999775 1.5235682000000335 -3.804009200000001","1.5235682000000335 -3.804009200000001 6.095517400000023 -5.327577399999994","15.236570999999989 -3.804186999999997 16.761028200000002 -0.7568727999999734","10.666044200000007 -5.327577399999994 15.236570999999989 -3.804186999999997","6.095517400000023 -5.327577399999994 10.666044200000007 -5.327577399999994"]},t:{path:["0 -5.327755200000029 10.664799599999995 -5.327755200000029","6.0941277078080205 14.480153073852616 9.14176479999995 16.003622","9.14176479999995 16.003622 12.18836779999999 16.003622","4.570348999999988 9.909171399999993 6.0941277078080205 14.480153073852616","4.570348999999988 9.909171399999993 4.570348999999988 -15.993621600000038"]},u:{path:["16.760494800000014 16.003622 16.760494800000014 -5.327577399999994","12.189967999999991 14.479698200000017 16.760494800000014 9.909171399999952","9.142298199999978 16.003622 12.189967999999991 14.479698200000017","1.5238155186039428 14.480085903686115 4.571415799999962 16.003622","4.571415799999962 16.003622 9.142298199999978 16.003622","0 9.908993599999997 1.5238155186039428 14.480085903686115","0 9.908993599999997 0 -5.327221800000002"]},v:{path:["9.142120399999982 16.003622 18.284063000000007 -5.328466400000012","0 -5.3281107999999815 9.142120399999982 16.003622"]},w:{path:["18.284075552614425 15.997659864635121 24.37869140000001 -5.333584400000002","12.189434600000004 -5.333228799999971 18.28407555261443 15.997659864635118","6.094679227397875 15.997970870594422 12.189434600000004 -5.333228799999971","0 -5.333228799999971 6.094679227397875 15.997970870594422"]},x:{path:["0.0003555999999915912 16.003622 16.761383799999994 -5.3282886000000165","0 -5.328110800000021 16.760850400000006 16.003622"]},y:{path:["0 26.663622 1.5242794000000166 26.663622","1.5242794000000166 26.663622 4.571771399999994 25.139520400000023","4.571771399999994 25.139520400000023 7.618907800000021 22.092383999999996","7.618907800000021 22.092383999999996 10.666044200000007 15.997933400000026","10.666044200000007 15.997933400000026 19.808164599999987 -5.333621599999995","1.523923800000025 -5.3334437999999995 10.666044200000007 15.997933400000026"]},z:{path:["0.0001777999999957956 16.003622 16.76067260000001 16.003622","0.0001777999999957956 16.003622 16.76031700000002 -5.327933000000025","0 -5.327933000000025 16.760317000000022 -5.327933000000025"]},"{":{path:["3.0473141999999416 -17.527522799999936 4.5707045999999725 -20.575192599999944","3.0473141999999416 -14.480919799999974 3.0473141999999416 -17.527522799999936","3.0473141999999416 -14.480919799999974 4.570882399999935 -11.433249999999958","4.570882399999935 -11.433249999999958 6.094272799999972 -9.909859600000004","6.094272799999972 -9.909859600000004 7.618196599999957 -6.8618342000000005","7.618196599999957 -3.8154089999999954 7.618196599999957 -6.8618342000000005","6.0948062 -0.7675613999999449 7.618196599999957 -3.8154089999999954","3.047669799999954 0.7556512000000382 6.0948062 -0.7675613999999449","3.0459807363089517 3.8025209363090227 6.094450599999927 6.850990799999998","6.094450599999927 9.898127200000067 6.094450599999927 6.850990799999998","4.5712379999999255 12.94490800000006 6.094450599999927 9.898127200000067","3.0480253999999247 14.467587200000034 4.5712379999999255 12.94490800000006","1.523568199999993 17.516323800000023 3.0480253999999247 14.467587200000034","1.523568199999993 20.563638000000047 1.523568199999993 17.516323800000023","1.523568199999993 20.563638000000047 3.0474919999999774 23.611130000000024","3.0474919999999774 23.611130000000024 4.570882399999935 25.134698200000017","4.570882399999935 25.134698200000017 7.618196599999957 26.658622","3.047669799999933 22.08667280000001 4.570882399999935 25.134698200000017","3.047669799999933 22.08667280000001 3.047669799999933 19.04184780000001","3.047669799999933 19.04184780000001 4.570171199999951 15.993289000000058","4.570171199999951 15.993289000000058 6.094450599999927 14.469187400000036","6.094450599999927 14.469187400000036 7.618196599999957 11.420806400000039","7.618196599999957 11.420806400000039 7.618196599999957 8.373136600000025","6.094450599999927 5.326711400000022 7.618196599999957 8.373136600000025","0 2.2795750000000368 6.094450599999927 5.326711400000022","0 2.2795750000000368 3.0476697999999374 0.7556512000000524","3.0476697999999325 0.7556512000000559 6.094450599999927 -2.291129599999941","6.094450599999927 -2.291129599999941 6.094450599999927 -5.338977199999988","4.570882399999935 -8.385935799999938 6.094450599999927 -5.338977199999988","3.047136399999986 -9.909148399999943 4.570882399999935 -8.385935799999938","1.5233903999999567 -12.957351599999981 3.047136399999986 -9.909148399999943","1.5233903999999567 -12.957351599999981 1.5233903999999567 -16.004310200000013","1.5233903999999567 -16.004310200000013 3.046425199999922 -19.050913199999968","3.046425199999922 -19.050913199999968 4.570704599999972 -20.575192599999944","4.5707045999999725 -20.575192599999944 7.618552199999948 -22.099294199999967"]},"|":{path:["0 25.138622 0 -22.09554820000002"]},"}":{path:["3.053892799999988 -20.569836999999996 4.577283199999985 -17.52216719999998","4.577283199999985 -14.475741834180443 4.577283199999985 -17.52216719999998","3.0535371999999965 -11.428072200000006 4.577283199999985 -14.475741834180443","1.5297911999999672 -9.903792799999987 3.0535371999999965 -11.428072200000006","0.006222999999974127 -6.856478599999964 1.5297911999999672 -9.903792799999987","0.006222999999974127 -3.809697799999972 0.006222999999974127 -6.856478599999964","0.006222999999974127 -3.809697799999972 1.5294355999999756 -0.7618502000000031","1.5297911999999672 6.856346400000033 4.577816703752094 3.808320896247901","1.5297911999999672 9.903127200000027 1.5297911999999672 6.856346400000033","1.5297911999999672 9.903127200000027 3.0533594000000006 12.950619200000004","3.0533594000000006 12.950619200000004 4.577460999999981 14.474720800000025","4.577460999999981 14.474720800000025 6.1008513999999785 17.522035000000006","6.1008513999999785 20.56934920000003 6.1008513999999785 17.522035000000006","4.577460999999981 23.616485600000015 6.1008513999999785 20.56934920000003","3.0535371999999974 25.14076500000003 4.577460999999981 23.616485600000015","0.006756400000001941 26.663622 3.0535371999999974 25.14076500000003","3.053537199999997 25.14076500000003 4.577283199999985 22.09256180000003","4.577283199999985 22.09256180000003 4.577283199999985 19.04525041800855","3.053714999999992 15.998289000000018 4.577283199999985 19.04525041800855","1.5301467999999991 14.474720800000025 3.053714999999992 15.998289000000018","0.006222999999974127 11.427406600000003 1.5301467999999991 14.474720800000025","0.006222999999974127 11.427406600000003 0.006222999999974127 8.379381200000077","0.006222999999974127 8.379381200000077 1.5296133999999713 5.332600400000002","1.5296133999999713 5.332600400000002 7.624241799999977 2.2849306000000293","1.5294355999999756 -0.7618502000000031 7.624241799999975 2.2849306000000293","1.5299690000000032 -2.2861295999999793 4.578438573295234 0.7623399732952496","1.5299690000000032 -2.2861295999999793 1.5299690000000032 -5.333442135244523","1.5299690000000032 -5.333442135244523 3.053714999999992 -8.380757999999982","3.053714999999992 -8.380757999999982 4.577105399999989 -9.904148399999979","4.577105399999989 -9.904148399999979 6.1008513999999785 -12.951818199999995","6.1008513999999785 -12.951818199999995 6.1008513999999785 -15.999660012880891","4.577105399999989 -19.046624399999995 6.1008513999999785 -15.999660012880891","3.053892799999988 -20.569836999999996 4.577105399999989 -19.046624399999995","0.006578599999965718 -22.093582999999985 3.053892799999988 -20.569836999999996"]},"~":{path:["13.712647200000049 -8.376555799999952 19.8076312 -11.423514399999984","7.618374399999992 -12.947082599999977 13.712647200000049 -8.376555799999952","0 -8.376377999999999 7.618374399999992 -12.947082599999977"]},"\xB0":{path:["3 -11 0 -8 3 -5 6 -8 3 -11"]},\u03A9:{path:["0 9 7 9 5 6 3 3 2 0 2 -3 3 -6 4 -8 6 -10 8 -11 12 -11 14 -10 16 -8 17 -6 18 -3 18 0 17 3 15 6 13 9 20 9"]},\u03BC:{path:["0 14 1 4 1 -6 1 4 2 7 4 8 6 8 8 7 10 4 10 -6 10 6 11 8 12 9"]}},bT.spacing={A:7.465644200000006,B:7.161250600000006,C:8.989745799999952,D:7.161072799999971,E:5.332577599999951,F:3.655923599999994,G:7.313625200000018,H:8.83737119999995,I:6.70412680000004,J:8.228050599999989,K:7.161250600000017,L:3.5044379999999933,M:9.141942599999993,N:8.837193400000046,O:7.4658220000001165,P:7.161250600000017,Q:7.465999799999963,R:7.161250600000017,S:7.1610727999999995,T:3.8091871999999967,U:8.83719340000016,V:4.113936399999943,W:6.399199800000019,X:7.161250600000017,Y:4.1137586000000965,Z:7.16107280000017,a:8.532622000000002,b:6.856679200000016,c:6.856323599999982,d:8.532622000000046,e:6.856501400000013,f:4.5708824000000154,g:8.53262200000006,h:8.380425199999962,i:5.637682400000017,j:5.942076000000018,k:5.027828400000033,l:6.7043046,m:10.056190200000003,n:8.380069600000013,o:7.008698199999969,p:6.856679199999974,q:8.53244419999993,r:2.8952951999999073,s:6.704304600000057,t:4.5708824000000154,u:8.380247399999973,v:5.180558599999927,w:7.465999799999963,x:6.704126799999813,y:5.332933199999957,z:6.704126799999926,0:7.161250600000009,1:15.846247200000045,2:7.160895000000018,3:7.1612506000000025,4:5.637682400000003,5:7.161250600000017,6:7.009053799999947,7:7.161250599999988,8:7.161250600000017,9:8.684996600000062,"`":7.009053800000009,"~":3.656812600000002,"!":7.008876000000015,"@":8.227695000000011,"#":7.313980800000067,$:7.161250600000017,"%":7.7696822000000125,"^":12.036882200000008,"&":7.925079399999959,"*":6.551752199999953,"(":6.094450599999959,")":7.771104600000058,_:4.113758599999983,"+":9.447047399999974,"-":9.446869600000014,"=":9.44651399999998,"[":4.1142920000000345,"]":5.78987920000003,"{":9.141587000000015,"}":7.466355399999884,":":7.008875999999987,'"':7.0088760000001,"|":6.7044824000000744,"<":9.142120399999953,">":9.142653799999948,"?":6.8566792000000305,";":7.008875999999987,"'":7.008698200000026,"\\":2.133244399999967,",":7.0088760000001,".":7.008875999999987,"/":2.133066600000053};var cre=bT;function xc(o,t){return ms(o)!==t}function UE(o){let t=wA.getCache().textOffsetCache;switch(o){case 3:return t[0];case 2:return t[1];case 1:return t[2];case 6:return t[3];case 5:return t[4];case 4:return t[5];case 9:return t[6];case 8:return t[7];case 7:return t[8];default:return t[0]}}function Gd(o,t,e){o=o.toString();let r={text:o,x:e/2,y:-e/2,fontSize:t-e,fontWidth:e},n=o.split(`
`).length,s=t*n,a=V8e(r,s-t),l=new _e;l.ext2(S.ORIGIN);for(let u of a)for(let d of u.primitives)l.ext1(d.bbox());let c=l.ext7(e/2).build1(),h=new ut(0,c.maxX,0,s);return{width:h.width(),height:h.height(),path:a}}function F8e(o,t,e,r){let i=JB;switch(o){case"Serif":i=lre;break;case"Sans Serif":i=cre;break}let n={text:t,x:0,y:0,fontSize:e,fontWidth:r,svgFont:i},a=t.split(`
`).length,l=e*a,c=V8e(n,l-e),h=new _e;h.ext2(S.ORIGIN);for(let p of c)for(let m of p.primitives)h.ext1(m.bbox());let u=h.ext7(r/2).build1(),d=new ut(0,u.maxX,0,u.maxY);return{width:d.width(),height:d.height(),path:c}}function LA(o,t,e){let r=Math.pow(10,t),i=Math.round(o*10*r)/r,n=new ft;return e!="mil"&&(i=n.conversion1("mil",e,i)),i.toFixed(t)}function V8e(o,t){let e=new Array;if(!o)return e;let r=wA.getCache().textCache;function i(I){if(r.has(I))return r.get(I);{let C=I.split(" ");return r.set(I,C),C}}let{text:n,x:s,y:a,fontSize:l,fontWidth:c,svgFont:h}=o,{fontPath:u}=h||Vy,d=s,p=a;function m(I,C=2){let E=Math.pow(10,C);return Math.round(I*E+1e-10)/E}let g=l/32,y=null,b=null,P=null,T=null;for(let I of n)switch(I){case" ":{u===Vy.fontPath?d+=l*.7:d+=h.getSpaceWidth(g);break}case`
`:{d=s,p+=Math.max(l+c,l);break}default:{let C=u[I];if(C!=null){let E=C.path,O=d;for(let _ of E){let R=i(_),v=R.length,D=new On,w=null;for(let F=0;F<v;F+=2)y=m(d+g*+R[F]),b=t-m(p+g*(+R[F+1]-16)),O=Math.max(O,y),w==null?w=new S(y,b):(P=new S(y,b),T=new M(w,P),D.push(T),w=P);D.size()>0&&(e.push(fe.build7(D.toArray())),D.clear())}u===Vy.fontPath?d=O+c+l*.15:d=O+h.getSpacing(I)*g}break}}return e}function Rc(o,t){return o?o.some((e,r,i)=>t(e,r,i)):!1}function G8e(o,t){if(!t)return!1;let e=t.indexOf(o);return e>-1&&t.splice(e,1),!0}function U8e(o,t,e=!0){return!t||!e&&t.includes(o)?!1:(t.push(o),!0)}var ICe=class{constructor(){this.list=new Map;this.layers=new Set;this.viewGroupInfoMap=new Map}clear(){this.list.clear(),this.layers.clear(),this.viewGroupInfoMap.clear()}attach(t,e){if(e==null){console.log("this shape is not defined!!!");return}let r=this.list.get(e);r==null&&(r=new Array,this.list.set(e,r)),r.push(t)}remove(t,e){if(!t)return!1;let r=this.list.get(e);return!r||r.length==0?!1:G8e(t,r)}attachLayer(t){this.layers.add(t)}attachViewGroup(t,e){t&&this.viewGroupInfoMap.set(t,e)}setLayerState(t){this.layerPresenter=t}setState(t){this.shapePresenter=t}modify(){var r,i,n;if(!(this.list.size>0||this.layers.size>0||this.viewGroupInfoMap.size>0))return;Sa.unRefreshViews&&this.list.clear();let e=bn.getInstance();this.viewGroupInfoMap.forEach((s,a)=>{e.setEngineGroupVisible(a,s)}),this.viewGroupInfoMap.clear(),(r=this.layerPresenter)==null||r.notify(this.layers),this.layers.clear(),(i=this.shapePresenter)==null||i.notify(this.list),(n=this.layerPresenter)==null||n.refresh(),this.list.clear()}},Do=new ICe;var CCe=ee.BLACK,SCe=ee.BLACK,hre=!0;function H8e(){var t,e;let o=(e=(t=ce)==null?void 0:t.themeConfig)==null?void 0:e.canvasTheme;if(o){let r=o.selectColor,i=o.selectTransparency,n=ee.build(r.r,r.g,r.b,1-i);CCe.equals(n,!1)||(CCe=n,hre=!0);let s=o.hoverHighlightColor,a=o.hoverHighlightTransparency,l=ee.build(s.r,s.g,s.b,1-a);SCe.equals(l)||(SCe=l,hre=!0)}}function tj(o){return o?SCe:CCe}function W8e(){return hre}function z8e(o){hre=o}var ure=new Set,rj=new Map;function Y8e(o){ure.add(o)}function j8e(o,t){if(o.layerId!=t){console.warn("layer was not modified");return}let e=rj.get(t);e||(e=new Set,rj.set(t,e)),e.add(o)}var Xl=class{constructor(){this.obj={}}contains(t){return t in this.obj}isEmpty(){for(var t in this.obj)return!1;return!0}getOrDefault(t,e){let r=this.obj[t];return r===void 0?e:r}get(t){return this.obj[t]}put(t,e){let r=this.obj[t];return this.obj[t]=e,r}del(t){let e=this.obj[t];return delete this.obj[t],e}computeIfAbsent(t,e){let r=this.obj;if(t in r)return r[t];{let i=e(t.toString());return r[t]=i,i}}iterator(t){let e=this.obj;for(let r in e){let i=e[r];if(!t(r,i))break}}origin(){return this.obj}clear(){this.obj={}}size(){return Object.keys(this.obj).length}getKeys(){return Object.keys(this.obj)}getValues(){return Object.values(this.obj)}};var jM=class jM{constructor(){this._user=null;this.selectMap=new Xl;this.colorMap=new Xl;this.maskColorMap=new Xl;this.selectIdMap=new Xl}static getInstance(){return jM.ins==null&&(jM.ins=new jM),jM.ins}set currentUser(t){this._user=t}get currentUser(){return this._user}updateSelect(t){let e=this.getSelectInfo(t);e&&e.currId&&e.currId!=this.currUser&&t.click(!1,!0)}getSelectInfo(t){let e=null,r=t;for(;r&&this.selectIdMap.size()>0&&(e=this.selectIdMap.get(r.globalIndex),r=t.syncSelectCheckParent&&r.getParent(),!(e||r==null)););return e}getHightColor(t){let e=this.getSelectInfo(t);return!e||e.currId==this.currUser?null:this.colorMap.get(e.currId)}getMaskHightColor(t){let e=this.getSelectInfo(t);return!e||e.currId==this.currUser?null:this.maskColorMap.get(e.currId)}get currUser(){return this._user.uuid}currUserHight(t){let e=this.getSelectInfo(t);e&&(e.currId=this.currUser,t.forceUpdateMask=!0)}currUserUnHight(t){let e=this.getSelectInfo(t);e&&(e.currId==this.currUser&&(e.currId=Array.from(e.selectUserIds).shift()),t.click(!1,!0))}};jM.ins=null;var zb=jM;var zs=class o extends ME{constructor(){super(),this.setDataState(0,!0),this.setDataState(4,!0)}get item(){return this}update(){this._bbox=this.buildBBox()||void 0}bbox(){if(this._bbox==null)throw new Error("PcbItem is Empty!!!");return this._bbox}get globalIndex(){return this.model.globalIndex}set globalIndex(t){this.model.globalIndex=t}get zIndex(){return this.model.zIndex}set zIndex(t){this.model.zIndex=t}get number(){return this.model.number}set number(t){this.model.number=t}get layerId(){return null}set layerId(t){}get viewGroupId(){return""}get viewGroupIdModified(){return!1}get isEmpty(){return this.model.isEmpty}get isVisible(){return this.hasDataState(0)}set isVisible(t){this.isVisible!=t&&(this.setDataState(0,t),this.refreshRender())}get manualHighLight(){return this.hasDataState(6)||this._parent&&this._parent.manualHighLight||!1}set manualHighLight(t){this.hasDataState(6)!=t&&(this.setDataState(8,!0),this.setDataState(6,t),this.refreshRender())}get manualHighLightModified(){return this.hasDataState(8)||this._parent&&this._parent.manualHighLightModified||!1}set forceUpdateMask(t){this.setDataState(7,t)}get forceUpdateMask(){return this.hasDataState(7)}get highLightBySelect(){return this.hasDataState(1)}set highLightBySelect(t){this.highLightBySelect!=t&&(this.setDataState(1,t),this.refreshRender())}get highLightByHover(){return this.hasDataState(2)}set highLightByHover(t){this.highLightByHover!=t&&(this.setDataState(2,t),this.refreshRender())}get isHighLight(){return this.highLightBySelect||this.highLightByHover}get state(){return this.getViewState()}get partition(){var t,e;return(e=(t=this._parent)==null?void 0:t.partition)!=null?e:this.model.partition}set partition(t){this.model.partition=t,this.refreshRender()}get highLightType(){return this.highLightBySelect?1:this.highLightByHover?0:null}get syncSelectCheckParent(){return!0}get highlightColor(){var e;let t=(e=zb.getInstance())==null?void 0:e.getHightColor(this);return t||this.getHighlightColor(this.highLightByHover)}get rendering(){return this.hasDataState(3)}set rendering(t){this.setDataState(3,t)}get sendDeleteMsg(){return this.hasDataState(4)}set sendDeleteMsg(t){this.setDataState(4,t)}get updateFilterVisible(){return this.hasDataState(5)}set updateFilterVisible(t){this.setDataState(5,t)}initVisible(){this.setDataState(0,$t.getElementFilterVisible(this))}setParent(t){this._parent=t,t instanceof o&&this.model instanceof z2&&this.model.setParent(t.model)}getParent(){return this._parent}setGroupID(t){this.model.setGroupID(t)}getGroupID(){return this.model.getGroupID()}highLight(t=!1){t?(this.highLightBySelect=!1,this.highLightByHover=!0):(this.highLightBySelect=!0,this.highLightByHover=!1)}unHighLight(){this.highLightBySelect=!1,this.highLightByHover=!1}hidden(){this.setHidden(),this.refreshRender()}onlySetVisibleState(t){t?this.setVisible():this.setHidden()}visible(t=!1){var e;this.refreshFilterVisible(!1)||(this.setVisible(),t||(e=zb.getInstance())==null||e.currUserUnHight(this),this.refreshRender())}getHighlightColor(t=!1){return tj(t)}click(t=!1,e=!1){var r;this.refreshFilterVisible(!0,t)||(e?this.forceUpdateMask=!0:(r=zb.getInstance())==null||r.currUserHight(this),t?this.setHover():this.setSelect(),this.refreshRender())}otherClick(){this.refreshFilterVisible(!0,!1)||(this.setSelect(),this.refreshRender())}refreshFilterVisible(t,e){return this.updateFilterVisible?$t.updateElementFilterVisible(this,t,e):!1}remove(){this.isVisible=!1,this.unHighLight(),this.model.remove(),this.sendDeleteMsg&&A.publish("delete",this)}getMathGraphics(t=1,e=0){let r=this.buildBBox();if(r!=null){let i=new Array,n=new M(r.LL(),r.LR()),s=new M(r.LR(),r.UR()),a=new M(r.UR(),r.UL()),l=new M(r.UL(),r.LL());return i.push(n),i.push(s),i.push(a),i.push(l),fe.build2(i)}else return null}getFileGraphics(t,e,r){let i=this.getMathGraphics(t,e);return i==null?null:[i]}initRefreshRender(){Do.attach(this,this.getType()),this.rendering=!0}refreshRender(){this.rendering||(Do.attach(this,this.getType()),this.rendering=!0)}resetReadRender(){this.rendering=!1}resetModelNotify(){this.model instanceof ki&&this.model.resetDataState(),this.setDataState(8,!1),this.setDataState(7,!1)}get layerModified(){return this.model.layerModified}get netModified(){return this.model.netModified}get shapeModified(){return this.model.shapeModified}getRenderData(){return this.resetReadRender(),this}getViewState(){return this.isEmpty?"Not Shown":this.isVisible?this.isHighLight?"Main And Highlight":"Only Main":"Not Shown"}getType(){return null}setBBoxModify(){Y8e(this)}setLayerModify(t){j8e(this,t)}};var Gy=class extends zs{constructor(){super(),this._clickTimer=null,this._bbox=new ut(0,0,0,0),this.initRefreshRender()}click(t=!1){if(super.click(t),t===!1){let e=k1.getInstance();this._clickTimer!=null&&window.clearTimeout(this._clickTimer),this._clickTimer=window.setTimeout(()=>{let r=e.clickTargetGlobalIndex;r===""?(e.clickTargetGlobalIndex=this.globalIndex,e.clickCount+=1):r===this.globalIndex?e.clickCount+=1:(e.clickTargetGlobalIndex=this.globalIndex,e.clickCount=1),e.clickCount>=3&&A.publish("ui/toastMsg",{type:"info",msg:"The filter panel on the right can disable the selection of DRC Marking.",timer:2},$())}),A.publish("jumpToErrorSubscribe",this.globalIndex,$())}}};var qp=class extends Gy{constructor(t,e){super(),this.model=t,this.contentModel=e||null,this.initRefreshRender()}get name(){return this.model.name}set name(t){this.model.name=t,this.refreshRender()}get locked(){return this.model.locked}set locked(t){this.model.locked=t,this.refreshRender()}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}get position(){return this.model.position}set position(t){this.model.position=t,this.refreshRender()}get errType(){return this.model.errType}set errType(t){this.model.errType=t,this.refreshRender()}get color(){return this.model.color}set color(t){this.model.color=t,this.refreshRender()}get referenceLayerIds(){return this.model.referenceLayerIds}set referenceLayerIds(t){this.model.referenceLayerIds=t,this.refreshRender()}get matrix(){return this.getMatrix()}get bbox2(){return this.model.bbox}get viewGroupId(){return this.model.viewGroupId||""}remove(){this.sendDeleteMsg=!1,super.remove(),this.refreshRender()}isSelect(t,e){return this.model.inShape(t,e)}rotateFor(t,e){}toJSON(){var e;return{globalIndex:this.model.globalIndex,partition:this.partition,name:this.name,layerId:this.layerId,locked:this.locked,position:this.position,color:this.color,errType:this.errType,contentModel:(e=this.contentModel)==null?void 0:e.toJSON(),matrix:this.getMatrix(),bbox2:this.model.bbox}}getMatrix(t=this.model.rectWidth,e=this.model.rectWidth){let r=xc(this.layerId,!1),i=UE(5),n=new S(i.x*t,i.y*e);return Ae.getMatrix4(n,0,r?-1:1,this.position)}transform(t){}buildBBox(){return this.model.updateBox()}getMathGraphics(t=this.layerId,e=0){return null}getType(){return 17}hidden(){var t;super.hidden(),(t=this.child)==null||t.hidden()}visible(t=!1){var e;this.unHighLight(),super.visible(t),(e=this.child)==null||e.visible()}onlySetVisibleState(t){var e;super.onlySetVisibleState(t),(e=this.child)==null||e.onlySetVisibleState(t)}refreshRender(){var t;super.refreshRender(),(t=this.child)==null||t.refreshRender()}injectedBBox(t){this.model.injectedBBox(t)}};var HE=class extends wi{constructor(){super(...arguments);this._clickTargetGlobalIndex="";this._clickCount=0}get clickTargetGlobalIndex(){return this._clickTargetGlobalIndex}set clickTargetGlobalIndex(e){this._clickTargetGlobalIndex=e}get clickCount(){return this._clickCount}set clickCount(e){this._clickCount=e}resetClickStatus(){this._clickTargetGlobalIndex="",this._clickCount=0}deleteItem(e){e&&(e.remove(),this.map.delete(e.globalIndex),e.globalIndex===this.clickTargetGlobalIndex&&this.resetClickStatus())}};var jx=class extends Gy{constructor(t){super(),this.model=t,this.initRefreshRender()}getType(){return 20}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}get text(){return this.model.text}set text(t){this.model.text=t,this.refreshRender()}get ruleText(){return this.model.ruleText}set ruleText(t){this.model.ruleText=t,this.refreshRender()}get textWidth(){return this.model.textWidth}set textWidth(t){this.model.textWidth=t,this.refreshRender()}get path(){return this.model.path}get locked(){return this.model.locked}set locked(t){this.model.locked=t,this.refreshRender()}buildBBox(){return this.model.bbox}isSelect(t,e){return this.model.inShape(t,e)}get isVisible(){return this._parent.isVisible}set isVisible(t){this.isVisible!=t&&(this.setDataState(0,t),this.refreshRender())}transform(t){throw new Error("Method not implemented.")}rotateFor(t,e){throw new Error("Method not implemented.")}injectedBBox(t){this.model.injectedBBox(t)}hidden(){super.hidden()}};var ECe=class{constructor(){this.compErrorCount=new Map;this.sharedErrors=new Map}registerError(t,e){return e.filter(i=>(this.compErrorCount.get(i)||0)<8).length!==e.length?!1:(e.forEach(i=>{this.compErrorCount.set(i,(this.compErrorCount.get(i)||0)+1)}),this.sharedErrors.set(t,e),!0)}unregisterError(t){let e=this.sharedErrors.get(t);e&&(e.forEach(r=>{if(this.compErrorCount.has(r)){let i=this.compErrorCount.get(r)-1;this.compErrorCount.set(r,Math.max(0,i))}}),this.sharedErrors.delete(t))}getErrorCount(t){return this.compErrorCount.get(t)||0}reset(){this.compErrorCount.clear(),this.sharedErrors.clear()}},qM=new ECe;function X8e(o,t,e,r,i,n){if(isNaN(e))throw new Error("line error,width is NaN");if(e<0)return;function s(h){return r==i?!0:n===le.CCW?r>i?h>=r&&h<=Vr?!0:h>=0&&h<=i:h>=r&&h<=i:r>i?h>=i&&h<=r:h>=i&&h<=Vr?!0:h>=0&&h<=r}let a=new _e;if(t<0)return null;if(t==0)return a.ext2(o),null;let l=o.add(new S(Math.cos(r)*t,Math.sin(r)*t)),c=o.add(new S(Math.cos(i)*t,Math.sin(i)*t));if(a.ext6(l.x,l.y).ext6(c.x,c.y),s(0)){let h=o.add(new S(t,0));a.ext6(h.x,h.y)}if(s(es)){let h=o.add(new S(0,t));a.ext6(h.x,h.y)}if(s(Math.PI)){let h=o.add(new S(-t,0));a.ext6(h.x,h.y)}if(s(es*3)){let h=o.add(new S(0,-t));a.ext6(h.x,h.y)}return a.ext7(e/2),a.build1()}function B1(o){return o>=0&&o<=Vr||(o%=Vr,o<0&&(o+=Vr)),o}function dre(o,t,e,r,i=le.CCW){if(i==le.CCW)if(r>e){let n=(r-e)/2+e;return o.add(new S(Math.cos(n),Math.sin(n)).mul(t))}else{if(r==e)return o.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(t));{let n=(r+Vr-e)/2+e;return o.add(new S(Math.cos(n),Math.sin(n)).mul(t))}}else if(r>e){let n=(e+Vr-r)/2+r;return o.add(new S(Math.cos(n),Math.sin(n)).mul(t))}else{if(r==e)return o.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(t));{let n=(e-r)/2+r;return o.add(new S(Math.cos(n),Math.sin(n)).mul(t))}}}function xf(o,t,e,r,i,n,s,a){if(r=B1(r),i=B1(i),e==0)return!1;if(s==0&&a!=null&&(s=10/a),n==le.CW){let O=r;r=i,i=O}let{x:l,y:c}=o,h=s/2,u=e-h,d=e+h,p=l-t.x,m=c-t.y,g=Math.atan2(m,p);if(g<0&&(g+=Vr),r<=i&&g>=r&&g<=i||r>i&&(g>=r&&g<=Vr||g>=0&&g<=i)||r==i){var y=Math.sqrt(p*p+m*m);return y<=d&&y>=u}else{var y=(d+u)/2,b=new Mt(t.x+Math.cos(r)*y,t.y+Math.sin(r)*y,0),P=new Mt(t.x+Math.cos(i)*y,t.y+Math.sin(i)*y,0),T=l-b.x,I=c-b.y,C=l-P.x,E=c-P.y;return T*T+I*I<=s*s/4?!0:C*C+E*E<=s*s/4}}var pre=class extends GE{constructor(e,r,i,n,s,a=1001){super();this.modelType="DrcCreepage";this.globalIndex=e,this._text=r,this._ruleText=i,this._textWidth=n,this._path=s,this._layerId=a,this.updateBox()}get layerId(){return this._layerId}set layerId(e){this._layerId!==e&&(this._layerId=e,this.layerModified=!0)}get text(){return this._text}set text(e){this._text!==e&&(this._text=e)}get ruleText(){return this._ruleText}set ruleText(e){this._ruleText!==e&&(this._ruleText=e)}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth!==e&&(this._textWidth=e,this.updateBox())}get path(){return this._path}set path(e){this._path=e,this.updateBox()}get locked(){return this._locked}set locked(e){this._locked!==e&&(this._locked=e)}get color(){return this._color}set color(e){(this._color.r!==e.r||this._color.g!==e.g||this._color.b!==e.b||this._color.alpha!==e.alpha)&&(this._color=e)}updateBox(){let e=new _e,r=[...this.injectedBBoxes,...this.path.map(i=>i.bbox())];for(let i of r)e.ext1(i);return this._bbox=e.build(),this._bbox||new ut(0,0,0,0)}inShape(e,r){let i=new S(e,r),[n,s]=this.injectedBBoxes;if(Yx(s).isContains(i))return!0;if(n.isContains(i)){for(let l of this._path)if(l instanceof M){if(Xa(i,l.start(),l.end(),.1))return!0}else if(l instanceof q){let c=l.center,h=l.ry,u=mh(l.startAngle),d=mh(l.sweepAngle),p=d+u,m=d>=0?le.CCW:le.CW;if(xf(i,c,h,u,p,m,.1))return!0}}return!1}clone(...e){throw new Error("Method not implemented.")}transform(e){throw new Error("Method not implemented.")}};var Xx=class Xx extends HE{static getInstance(){return Xx.instance||(Xx.instance=new Xx),Xx.instance}updateCache(t){this.map.set(t.globalIndex,t)}deleteItem1(t){let e=new jx(t);return this.map.delete(e.globalIndex),e}deleteCreepageError(t){let e=t.child;e instanceof jx&&(Xx.getInstance().deleteItem(e),e.remove(),this.map.delete(e.globalIndex)),qM.unregisterError(t.contentModel.globalIndex),t.child=null}addItemByModel(t){let e=new jx(t);return this.updateCache(e),e}addItem(t,e,r,i,n=1001){let s=new pre(cr(),e,r,200,i,n),a=this.addItemByModel(s);return a.setParent(t),a}};Xx.instance=null;var $M=Xx;var KM=class KM extends HE{static getInstance(){return KM._instance||(KM._instance=new KM),KM._instance}getAllItem(){let t=super.getAllItem(),e=$M.getInstance().getAllItem();for(let r of e)t.push(r);return t}updateCache(t){this.map.set(t.globalIndex,t)}addItemByModel(t){let e=new qp(t);return this.updateCache(e),e}addItem(t,e,r,i,n,s,a=ee.of3("#FFCC00"),l=1001){let c=ZB.getInstance().addItem(t,e,r,i,n,s,a,l);return this.addItemByModel(c)}rebuildItem(t,e,r,i,n,s,a,l){let c=ZB.getInstance().addItem(t,e,r,i,n,s,a,l);return this.addItemByModel(c)}findItemByGlobalIndex(t){let e=this.map.get(t);return e||null}copyItem(t){}deleteItem(t){t instanceof qp&&(ZB.getInstance().deleteItem(t.model),t.remove(),this.map.delete(t.globalIndex),t.globalIndex===this.clickTargetGlobalIndex&&this.resetClickStatus())}setTargetDRCItemsVisible(t){for(let e of t)e.state==="Main And Highlight"&&e.visible()}setTargetDRCItemsClicked(t){for(let e of t)e.click()}};KM._instance=null;var k1=KM;var er=class{getItem(t,e={}){let r={isContainDRCs:!1,...e},i=null,n=[pr,Kt,Hr,Zt,Uo,Xt,ti,is,Go,wh,Cr,pt,Ln,_o,Ei,Qn];for(let s of n)if(i=s.getItem(t),i!=null)return i;return(typeof i>"u"||i===null)&&r.isContainDRCs&&(i=k1.getInstance().getItem(t)),i}getLoopNode(t){let e=null,r=[pr,Hr,Kt];for(let i of r)if(e=i.getItem(t),e!=null)return e;return e}getConnectNode(t){let e=null,r=[Kt,Hr,pr,Ei,Qn,Zt,Xt,pt];for(let i of r)if(e=i.getItem(t),e!=null)return e;return e}getItems(t){let e=null,r=[pr,Kt,Hr,Zt,Uo,Xt,ti,is,Go,wh,Cr,pt,Ln,_o,Ei,Qn],i=new Array;for(let n of r)e=n.getItem(t),e!=null&&i.push(e);return i}getItemByType(t,e){let r=this.getManageByType(e),i=r==null?void 0:r.getItem(t);return i!=null?i:null}getManageByType(t){switch(t){case"Track":case"ArcTrack":return pr;case"Pad":return Kt;case"Via":return Hr;case"Circle":return Zt;case"Radius Dimension":return Uo;case"Rect":return Xt;case"Text":return ti;case"Protractor Dimension":return is;case"Length Dimension":return Go;case"Smart Dimension":return wh;case"Component":return Cr;case"Polygon":return pt;case"Image":return Ln;case"Picture":return _o;case"Copper":return Ei;case"Inner":return Qn;default:return null}}getItemsByNet(t){let e=new Set;for(let r of t){let i=ze.getSameNetItemsWithoutPourAndPlaneZone(r);for(let n of i)e.add(n)}return e}};var Q0=class{constructor(){this.nums=new Set}add(t){return t==""||this.nums.has(t)?!1:(this.nums.add(t),!0)}getIncrementalNumber(t){let e="";if(typeof t>"u"||t==="")e="1";else{t.endsWith("?")&&(t=t.replace("?",""));let r=t.split(/[^0-9]+/);if(r[r.length-1]=="")e=t+"1";else if(r[r.length-1].match(/[0-9]+/)){let i=parseInt(r[r.length-1])+1;e=t.replace(new RegExp(r[r.length-1]+"$"),i.toString())}else e="A"}return this.add(e),e}getMaxNum(){let t=0;for(let e of this.nums)isNaN(Number(e))||(t=Math.max(t,Number(e)));return t}getNum(t){if(t.endsWith("?")&&(t=t.replace("?","")),this.nums.has(t.toUpperCase())){let e=t.split(/[^0-9]+/);if(e[e.length-1]=="")return this.getNum(t+"1");if(e[e.length-1].match(/[0-9]+/)){let r=parseInt(e[e.length-1])+1;return this.getNum(t.replace(new RegExp(e[e.length-1]+"$"),r.toString()))}else return this.getNum("A")}else return t==""?this.getNum("1"):t.toUpperCase()}getUniqueName(t){if(t.endsWith("?")&&(t=t.replace("?","")),this.nums.has(t)){let e=t.split(/[^0-9]+/);if(e[e.length-1]=="")return this.getUniqueName(t+"1");if(e[e.length-1].match(/[0-9]+/)){let r=parseInt(e[e.length-1])+1;return this.getUniqueName(t.replace(new RegExp(e[e.length-1]+"$"),r.toString()))}else return this.getUniqueName("A")}else return t==""?this.getUniqueName("1"):t}deleteNum(t){this.nums.delete(t)}clear(){this.nums.clear()}has(t){return this.nums.has(t)}getNums(){return Array.from(this.nums)}getArrayPadNum(t,e){let r=[];for(let i=0;i<e;i++)for(let n=0;n<t.length;n++){let s=this.getNum(t[n]);r.push(s),t[n]=s,this.add(s)}return r}};var Dc=class o extends kd{constructor(t){super(),this._name=t,this._fileUuid=""}get name(){return this._name}set name(t){this.watcher!=null&&!this.watcher.modifyName(this,t)||(this._name=t)}get fileUuid(){return this._fileUuid||""}set fileUuid(t){this._fileUuid=t}toJSON(){return{name:this.name,fileUuid:this.fileUuid}}isPartitionSplitOut(){return this._fileUuid!=""&&this._fileUuid!=null}clone(){let t=new o(this.name);return t.fileUuid=this.fileUuid,t}};var lr=class extends ki{get bbox(){return this._bbox}};var WE=class{constructor(t,e){this.id=t,this.layerId=e,this.hash=t+"_"+e}};var Cd=class extends WE{constructor(t,e,r,i){super(t,e),this.shape=r,this.width=i}};var ud=class extends WE{constructor(t,e,r){super(t,e),this.shape=r}};var Pp=class extends WE{constructor(t,e,r,i=0){if(super(t,e),this.shape=r,this.width=i,r.length>100){this.rtree=new Mb(10);for(let n of r)this.rtree.add(n)}}getShapes(t,e){return this.rtree!=null?this.rtree.search(t.bbox().extendOfSize(e)):this.shape}};var Ud=class extends WE{constructor(t,e,r,i){super(t,e),this.shape=r,this.width=i}};var ZM=class ZM{constructor(){this.hash=null;this.cache=new Map;this.treeMap=new Map;this.map=new Map;this.polyTreeMap=new Map;this.maskClear=!1}static getInstance(){return ZM.manager==null&&(ZM.manager=new ZM),ZM.manager}setMask(t){this.maskClear=t}addCache(t,e,r,i=0){if(r==null)return null;if(r instanceof Tl){let n=new Ud(t,e,r,i);return this.cache.set(n.hash,n),n}else if(r instanceof fe){let n=new ud(t,e,r);return this.cache.set(n.hash,n),n}else if(r instanceof Gt){let n=new Cd(t,e,r,i);return this.cache.set(n.hash,n),n}else{let n=new Pp(t,e,r,i);return this.cache.set(n.hash,n),n}}getCache(t,e){return this.hash=t+"_"+e,this.cache.get(this.hash)}getTree(t){let e=this.treeMap.get(t);if(e==null){e=new nn(50);for(let r of t.items)for(let i of r.primitives)e.add(i);this.treeMap.set(t,e)}return e}getPointInPolyline(t){return new ere}getPolyTree(t){let e=this.polyTreeMap.get(t);if(e==null){e=new nn(50);for(let r of t)e.add(r);this.polyTreeMap.set(t,e)}return e}delete(t,e){this.hash=t+"_"+e;let r=this.cache.get(this.hash);r!=null&&(r instanceof Cd?(this.treeMap.delete(r.shape),this.map.delete(r.shape)):r instanceof Pp&&this.polyTreeMap.delete(r.shape),this.cache.delete(this.hash))}clear(){this.maskClear||(this.cache.clear(),this.treeMap.clear(),this.map.clear())}};ZM.manager=null;var _u=ZM;var ro=class{point2Angle(t,e,r){if(t.equals(e))if(r.equals(t)){let I=t.add(new S(.001,0)),C=.001,E=t.angle(I),O=e.angle(I),_=le.CCW;return{center:I,radius:C,startAngle:E,endAngle:O,sweep:_}}else{let I=t.add(r).mul(.5),C=r.distance1(t)/2,E=t.angle(I),O=e.angle(I),_=le.CCW;return{center:I,radius:C,startAngle:E,endAngle:O,sweep:_}}let i=e.sub(r).normalize(),n=r.sub(t).normalize();i.cross(n)==0&&r.add(new S(-i.y,i.x).mul(.01));let s=2*(e.x-t.x),a=2*(e.y-t.y),l=e.x*e.x+e.y*e.y-t.x*t.x-t.y*t.y,c=2*(r.x-e.x),h=2*(r.y-e.y),u=r.x*r.x+r.y*r.y-e.x*e.x-e.y*e.y,d=(l*h-u*a)/(s*h-c*a),p=(s*u-c*l)/(s*h-c*a),m=new S(d,p),g=m.distance1(t),y=t.angle(m),b=e.angle(m),P=n.cross(i),T;return P>0?T=le.CCW:T=le.CW,{center:m,radius:g,startAngle:y,endAngle:b,sweep:T}}pointToAngle(t,e,r){let i=e.sub(t),n=new S(-i.y,i.x).normalize(),s=Math.abs(r)/2,a;if(s!=0)a=i.length()/2/Math.sin(s);else throw new Error("Can't represent circle!!!");let l=n.rotate(S.ORIGIN,s),c,h;r>0?(c=le.CCW,h=e.add(l.mul(a))):(c=le.CW,h=t.sub(l.mul(a)));let u=t.angle(h),d=e.angle(h);return{center:h,radius:a,startAngle:u,endAngle:d,sweep:c}}angleToPoint(t,e,r,i,n){let s=t.add(new S(Math.cos(r),Math.sin(r)).mul(e)),a=t.add(new S(Math.cos(i),Math.sin(i)).mul(e)),l;return n==le.CCW?l=(i+Vr-r)%Vr:l=-(r+Vr-i)%Vr,{start:s,end:a,angle:l}}tangentToArc(t,e,r,i=!0){if(e.equals(r)){let m=new S(t.y,-t.x).normalize(),g=e.add(m),y=e.angle(g),b=y+Vr;return i?{center:g,radius:1,startAngle:y,endAngle:b,sweep:le.CW}:{center:g,radius:1,startAngle:b,endAngle:y,sweep:le.CW}}let n=r.sub(e),s=t.cross(n),a,l,c;s>0?(a=le.CCW,l=new S(-t.y,t.x).normalize(),c=new S(-n.y,n.x).normalize()):(a=le.CW,l=new S(t.y,-t.x).normalize(),c=new S(n.y,-n.x).normalize());let h=new M(e,e.add(l.mul(1e5))),u=e.add(r).mul(.5),d=new M(u.sub(c.mul(1e5)),u.add(c.mul(1e5)));if(Tt(h,d)>0){let m=new S(Ee[0],Ee[1]),g=m.distance1(e),y=e.angle(m),b=r.angle(m);return{center:m,radius:g,startAngle:y,endAngle:b,sweep:a}}else{let m=e.add(l.mul(1e5)),g=m.distance1(e),y=e.angle(m),b=r.angle(m);return{center:m,radius:g,startAngle:y,endAngle:b,sweep:a}}}tangentAngleArc(t,e,r,i){let n=null,s=null,a=null;i>0?(n=le.CCW,a=e.rotate(S.ORIGIN,Math.PI/2),s=t.add(a.mul(r))):(n=le.CW,a=e.rotate(S.ORIGIN,-Math.PI/2),s=t.add(a.mul(r)));let l=a.mul(-1).angle(S.ORIGIN),c=l+i;return{center:s,radius:r,startAngle:l,endAngle:c,sweep:n}}};function ef(o,t=1){let e=new Array;return o.forEach(r=>{if(r.primitives.length==1){let a=r.primitives[0];if(a instanceof q&&Math.abs(a.sweepAngle)==360)if(a.isCCW){let l=a.sweepAngle/2;r=fe.build7([q.build3(a.center,0,l,a.rx,a.ry),q.build3(a.center,l,l,a.rx,a.ry)])}else{e.push(["CIRCLE",a.center.x*t,a.center.y*t,a.rx*t]);return}}let i=new Array,n=r.primitives,s=!1;for(let a of n)if(a instanceof M)i.push(a.start().x*t),i.push(a.start().y*t),s||(i.push("L"),s=!0);else if(a instanceof q&&Fd(a)>1e-8)s=!1,i.push(a.start().x*t),i.push(a.start().y*t),i.push("ARC"),i.push(a.sweepAngle);else if(a instanceof Mr){s=!1,i.push(a.start().x*t),i.push(a.start().y*t),i.push("C");for(let l=1,c=a.controls.length;l<c-1;l++){let h=a.controls[l];i.push(h.x*t),i.push(h.y*t)}}i.length>2&&(i.push(n[n.length-1].end().x*t),i.push(n[n.length-1].end().y*t),e.push(i))}),e}function Lh(o,t=1){if(o.primitives.length==1){let i=o.primitives[0];if(i instanceof q&&Math.abs(i.sweepAngle)==360)return["CIRCLE",i.center.x*t,i.center.y*t,i.rx*t]}let e=new Array,r=o instanceof Gt?o.items:[o];for(let i of r){let n=new Array;e.push(n);let s=i.primitives,a=!1;for(let l of s)if(l instanceof M)n.push(l.start().x*t),n.push(l.start().y*t),a||(n.push("L"),a=!0);else if(l instanceof q&&Fd(l)>1e-8)if(Math.abs(l.sweepAngle)==360){let c=l.points(.01);c.pop();let h=!0;for(let u of c)n.push(u.x*t),n.push(u.y*t),!a&&h&&(n.push("L"),a=!0),h=!1}else a=!1,n.push(l.start().x*t),n.push(l.start().y*t),n.push("ARC"),n.push(l.sweepAngle);else if(l instanceof Mr){a=!1,n.push(l.start().x*t),n.push(l.start().y*t),n.push("C");for(let c=1,h=l.controls.length;c<h-1;c++){let u=l.controls[c];n.push(u.x*t),n.push(u.y*t)}}n.length>2&&(n.push(s[s.length-1].end().x*t),n.push(s[s.length-1].end().y*t))}return e.length==1?e[0]:e}function vu(o,t=1){t==0&&(t=1),o=Q9t(o,t);let e=o.length,r=new Array(e),i=new ro,n=null,s=null,a=!1,l=null,c=new On,h=null,u=null,d=0,p=2,m=null,g=null,y=null;for(d=0;d<e;d++){if(h=o[d],h[0]==="CIRCLE"){let b=fe.build7([q.build2(new S(h[1],h[2]),0,360,h[3],h[3],le.CW)]);r[d]=b;continue}for(n=new S(h[0],h[1]),a=!1,u=h.length,p=2;p<u;)switch(m=h[p],m){case"L":{s=new S(h[p+1],h[p+2]),l=new M(n,s),c.addLast(l),n=s,p+=3,a=!0;break}case"ARC":{if(a=!1,g=h[p+1]/180*Math.PI,s=new S(h[p+2],h[p+3]),Math.abs(g)>1e-8&&!n.equals1(s)){let{center:b,radius:P,startAngle:T,endAngle:I,sweep:C}=i.pointToAngle(n,s,g);l=q.build2(b,T/Math.PI*180,I/Math.PI*180,P,P,C),c.addLast(l)}n=s,p+=4;break}case"C":{a=!1;let b=new Array;for(b.push(n),p++;;){let P=new S(h[p],h[p+1]);if(b.push(P),typeof h[p+2]=="string"){n=P,p+=2;break}if(p+=2,p>=u)break}l=new Mr(b),c.addLast(l);break}default:{a?(s=new S(h[p],h[p+1]),l=new M(n,s),c.addLast(l),n=s,p+=2):p++;break}}c.size()>0&&(y=fe.build7(c.toArray()),r[d]=y),c.clear()}return c.clear(),h=null,r}function Yb(o,t=1){if(o.length<2)return null;if(o[0]=="CIRCLE")return fe.build7([q.build2(new S(o[1],o[2]),0,360,o[3],o[3],le.CW)]);try{let e=new Array,r=new S(o[0]/t,o[1]/t),i=!1;for(let n=2,s=o.length;n<s;)if(o[n]=="L"){let a=new S(o[n+1]/t,o[n+2]/t);if(!r.equals1(a)){let l=new M(r,a);e.push(l)}r=a,n+=3,i=!0}else if(o[n]=="ARC"||o[n]=="CARC"){i=!1;let a=o[n+1]/180*Math.PI,l=new S(o[n+2]/t,o[n+3]/t);if(ne.greater(Ht.regular(a),0)&&!r.equals1(l)){let c=new ro,{center:h,radius:u,startAngle:d,endAngle:p,sweep:m}=c.pointToAngle(r,l,a),g=q.build2(h,d/Math.PI*180,p/Math.PI*180,u,u,m);e.push(g)}r=l,n+=4}else if(o[n]=="C"){i=!1;let a=new Array;for(a.push(r),n++;;){let c=new S(o[n]/t,o[n+1]/t);if(a.push(c),typeof o[n+2]=="string"){r=c,n+=2;break}if(n+=2,n>=s)break}let l=new Mr(a);e.push(l)}else if(i){let a=new S(o[n]/t,o[n+1]/t);if(!r.equals1(a)){let l=new M(r,a);e.push(l)}r=a,n+=2,i=!0}else n++;return e.length>0?fe.build7(e):null}catch{console.warn("source is not valid: ",o);return}}function q8e(o){let t=new Array;o=o.asClose();let e=o.primitives[0].start();for(let i of o.primitives)i instanceof M?t.push(i.start()):i instanceof q?i.points(.01).forEach(s=>{t.push(s)}):i instanceof Mr&&i.points(.1).forEach(s=>{t.push(s)});let r=o.primitives[o.primitives.length-1].end();return t.push(r),r.equals(e)||t.push(e),t}function Q9t(o,t=1){if(t==0||t==1)return o;let e=o.length,r=new Array(e),i="",n=null,s=null,a=null,l=0,c=0;for(;l<e;l++){n=o[l],s=n.length;let h=new Array(s);for(c=0;c<s;c++)a=n[c],i=typeof a,i==="number"?h[c]=a/t:h[c]=a;r[l]=h}return r}var dc=class extends ki{constructor(t,e,r){super(),this.globalIndex=t,this.update(e,r)}get modify(){return!1}set modify(t){}get net(){var t;return(t=this._net)==null?void 0:t.toUpperCase()}set net(t){this._net!=t&&(this._net=t,this.netModified=!0)}get showNet(){return this._net}get start(){return this.pls.length>0?this.pls[0].primitives[0].start():null}update(t,e){this._net=t,this.pls=e}get source(){return ef(this.pls)}updateBox(){let t=new _e;for(let e of this.pls)t.ext1(e.bbox());return this._bbox=t.build1(),this._bbox}};function $8e(o,t,e){if(isNaN(e)||e<0)throw new Error("line error,width is NaN");let r=wA.getCache().boxCache,i=e/2;return r[0]=Math.min(o.x,t.x)-i,r[1]=Math.max(o.x,t.x)+i,r[2]=Math.min(o.y,t.y)-i,r[3]=Math.max(o.y,t.y)+i,new ut(r[0],r[1],r[2],r[3])}var qx=class o{constructor(t,e){this._start=t,this._end=e}get start(){return this._start}set start(t){this._start.equals(t)||(this._start=t)}get end(){return this._end}set end(t){this._end.equals(t)||(this._end=t)}get direct(){return this._end.sub(this._start).normalize()}get length(){return this._start.distance1(this._end)}set length(t){let e=this._end.sub(this._start).normalize(),r=this._start.add(e.mul(t));this.end=r}get primitive(){return new M(this._start,this._end)}get center(){return this._start.add(this._end).mul(.5)}transform(t){this.start=this._start.multiply4(t),this.end=this._end.multiply4(t)}inShape(t,e,r,i){r<.05&&i!=null&&(r=10/i.getScale());let n=t-this._start.x,s=e-this._start.y,a=t-this._end.x,l=e-this._end.y,c=this._end.x-this._start.x,h=this._end.y-this._start.y,u=new S(-h,c).normalize(),d=c+u.x*r/2,p=h+u.y*r/2,m=d*d+p*p,g=n*n+s*s,y=a*a+l*l,b=Math.abs(n*h-s*c)/2,T=Math.sqrt(c*c+h*h)*r/4;if(b<=T&&g<=m&&y<=m)return!0;{let I=r/2;return g<=I*I?!0:y<=I*I}}getBBox(t){return $8e(this._start,this._end,t)}getMathGraphics(t,e){return this.primitive.stroke(t+e*2,kr.ROUND,le.CW)}clone(){return new o(this._start,this._end)}equals(t){return t instanceof o?this._start.equals1(t.start)&&this._end.equals1(t.end):!1}};var fre=class{constructor(t,e,r,i){this.layerId=t;this.width=e;this.locked=r;this.net=i}};var JM=class JM extends wi{static getInstance(){return JM.manager==null&&(JM.manager=new JM),JM.manager}getKey(t,e,r,i){return`${t}_${e}_${r}_${i}`}getComponent(t,e,r,i){let n=this.getKey(t,e,r,i),s=this.map.get(n);return s==null&&(s=new fre(t,e,r,i),this.map.set(n,s)),s}};JM.manager=null;var $x=JM;var yt=class extends ki{constructor(t,e,r,i,n,s,a){super(),this._globalIndex=t,this._baseModel=e,this.com=$x.getInstance().getComponent(r,i,s,n.toString()),this._bbox=a||e.getBBox(i)}get layerId(){return this.com.layerId}set layerId(t){this.com.layerId!=t&&(this.watchLayerIdModify(this.com.layerId),this.com=$x.getInstance().getComponent(t,this.com.width,this.com.locked,this.com.net),this.layerModified=!0)}get net(){var t;return(t=this.com.net)==null?void 0:t.toUpperCase()}set net(t){this.com.net!=t&&(this.com=$x.getInstance().getComponent(this.com.layerId,this.com.width,this.com.locked,t),this.netModified=!0)}get showNet(){return this.com.net}get length(){return this._baseModel.length}set length(t){t=bo(t),this._baseModel.length=t}get start(){return this._baseModel.start}set start(t){this._baseModel.start.equals(t)||(this._baseModel.start=t,this.updateShapeData())}get end(){return this._baseModel.end}set end(t){this._baseModel.end.equals(t)||(this._baseModel.end=t,this.updateShapeData())}get width(){return this.com.width}set width(t){this._baseModel instanceof qx&&(t=bo(t)),this.com.width!=t&&(this.com=$x.getInstance().getComponent(this.com.layerId,t,this.com.locked,this.com.net),this.updateShapeData())}get locked(){return this.com.locked}set locked(t){this.com=$x.getInstance().getComponent(this.com.layerId,this.com.width,t,this.com.net)}get bbox(){return this._bbox}recycle(){super.recycle()}inShape(t,e,r){return this._baseModel.inShape(t,e,this.width,r)}updateBox(){return this._bbox=this._baseModel.getBBox(this.width),this._bbox}getMathGraphics(t=this.layerId,e=0){return!this.isEmpty&&this.layerId==t?this._baseModel.getMathGraphics(this.width,e):null}};var mre=class{constructor(t,e,r,i){this.startLayer=t,this.endLayer=e,this.radius=r,this.holeRadius=i}};var OCe=class{constructor(){this.ViaBaseInfoPool=new Map}getViaBaseInfoByStartLayer(t,e){return this.getViaBaseInfo(t,e.endLayer,e.radius,e.holeRadius)}getViaBaseInfoByEndLayer(t,e){return this.getViaBaseInfo(e.startLayer,t,e.radius,e.holeRadius)}getViaBaseInfoByRadius(t,e){return this.getViaBaseInfo(e.startLayer,e.endLayer,t,e.holeRadius)}getViaBaseInfoByHoleRadius(t,e){return this.getViaBaseInfo(e.startLayer,e.endLayer,e.radius,t)}getViaBaseInfo(t,e,r,i){let n=this.generateId({startLayer:t,endLayer:e,radius:r,holeRadius:i}),s=this.ViaBaseInfoPool.get(n);return s!=null||(s=new mre(t,e,r,i),this.ViaBaseInfoPool.set(n,s)),s}generateId(t){let{startLayer:e,endLayer:r,radius:i,holeRadius:n}=t;return`${e}_${r}_${i}_${n}`}},Ea=new OCe;var It=class extends ki{constructor(){super(...arguments);this.modelType="Via"}get bbox(){return this._bbox}get expansionType(){return this.viaExpansion.expansionType}set expansionType(e){this.viaExpansion.expansionType!=e&&(this.viaExpansion=I0.getExpansionByexpansionType(e,this.viaExpansion))}get startLayer(){return this.viaBaseInfo.startLayer}set startLayer(e){this.viaBaseInfo.startLayer!=e&&(this.viaBaseInfo=Ea.getViaBaseInfoByStartLayer(e,this.viaBaseInfo))}get endLayer(){return this.viaBaseInfo.endLayer}set endLayer(e){this.viaBaseInfo.endLayer!=e&&(this.viaBaseInfo=Ea.getViaBaseInfoByEndLayer(e,this.viaBaseInfo))}get radiusModified(){return this.hasDataState(7)}set radiusModified(e){this.setDataState(7,e)}get holeRadius(){return this.viaBaseInfo.holeRadius}set holeRadius(e){e=bo(e*2)/2,this.viaBaseInfo.holeRadius!=e&&(this.viaBaseInfo=Ea.getViaBaseInfoByHoleRadius(e,this.viaBaseInfo),this.updateShapeData(),this.holeRadiusModified=!0)}get holeRadiusModified(){return this.hasDataState(8)}set holeRadiusModified(e){this.setDataState(8,e)}get topExpansion(){return this.viaExpansion.topExpansion}set topExpansion(e){this.viaExpansion.topExpansion!=e&&(this.viaExpansion=I0.getExpansionByTopExpansion(e,this.viaExpansion),this.updateShapeData(),this.topExpansionModified=!0)}get topExpansionModified(){return this.hasDataState(9)}set topExpansionModified(e){this.setDataState(9,e)}get bottomExpansion(){return this.viaExpansion.bottomExpansion}set bottomExpansion(e){this.viaExpansion.bottomExpansion!=e&&(this.viaExpansion=I0.getExpansionByBottomExpansion(e,this.viaExpansion),this.updateShapeData(),this.bottomExpansionModified=!0)}get bottomExpansionModified(){return this.hasDataState(10)}set bottomExpansionModified(e){this.setDataState(10,e)}};var QB=class{getRtree(t){return _u.getInstance().getTree(t)}getInpolylines(t){return _u.getInstance().getPointInPolyline(t)}isPoints(t){return!!(t instanceof M&&ne.eq(t.start().distance2(t.end()),0))}};var ACe=class{auto(t,e){return e.bbox().isContains(t)?e instanceof hs?this.pips(t,e.items):this.pip(t,e):!1}pips(t,e){for(let r=0;r<e.length;r++)if(r===0){if(!this.pip(t,e[r]))return!1}else if(this.pip(t,e[r]))return!1;return!0}pip(t,e){return r()%2!==0;function r(){let i=e.end(),n=0,{x:s,y:a}=t;for(let c of e.primitives){if(i.y>a?c.bbox().minY>a:c.bbox().maxY<=a){i=c.end();continue}if(c instanceof q&&(c.isCCW?Math.floor(c.startAngle/90)+1!==Math.ceil(c.endAngle()/90):Math.ceil(c.startAngle/90)-1!==Math.floor(c.endAngle()/90))){let h=c.startAngle,u=c.endAngle();if(c.sweepAngle>0){let d=90;for(;d<=u;)d>h&&(l(q.build3(c.center,h,d-h,c.rx,c.ry)),h=d),d+=90;h<u&&l(q.build3(c.center,h,u-h,c.rx,c.ry))}else{let d=270;for(;d>=u;)d<h&&(l(q.build3(c.center,h,d-h,c.rx,c.ry)),h=d),d-=90;h>u&&l(q.build3(c.center,h,u-h,c.rx,c.ry))}}else l(c)}return n;function l(c){let h=c.start(),u=c.end();if(i.y>a!=h.y>a&&(i.x>s?h.x>s?n+=h.y>i.y?1:-1:i.y>h.y?(i.x-s)*(h.y-a)-(i.y-a)*(h.x-s)<0&&n--:(i.x-s)*(h.y-a)-(i.y-a)*(h.x-s)>0&&n++:h.x>s&&(i.y>h.y?(i.x-s)*(h.y-a)-(i.y-a)*(h.x-s)<0&&n--:(i.x-s)*(h.y-a)-(i.y-a)*(h.x-s)>0&&n++)),h.y>a!=u.y>a){if(h.x>s)if(u.x>s)n+=u.y>h.y?1:-1;else if(c instanceof M)h.y>u.y?(h.x-s)*(u.y-a)-(h.y-a)*(u.x-s)<0&&n--:(h.x-s)*(u.y-a)-(h.y-a)*(u.x-s)>0&&n++;else if(c instanceof q){let{center:d,isCCW:p,rx2:m}=c,g=(d.x-s)**2+(d.y-a)**2;h.y>u.y?(p?g>m:g<m)&&n--:(p?g<m:g>m)&&n++}else throw new Error("not support!");else if(u.x>s)if(c instanceof M)h.y>u.y?(h.x-s)*(u.y-a)-(h.y-a)*(u.x-s)<0&&n--:(h.x-s)*(u.y-a)-(h.y-a)*(u.x-s)>0&&n++;else if(c instanceof q){let{center:d,isCCW:p,rx2:m}=c,g=(d.x-s)**2+(d.y-a)**2;h.y>u.y?(p?g>m:g<m)&&n--:(p?g<m:g>m)&&n++}else throw new Error("not support!")}i=u}}}pipsSASM(t,e,r){let i=e[0];if(!this.pip(t,i))return!1;let n=r.search(new ut(t.x-1e-5,t.x+1e-5,t.y-1e-5,t.y+1e-5));for(let s=0;s<n.length;s++)if(this.pip(t,n[s]))return!1;return!0}},Kx=new ACe;var e8=class extends QB{checkCache(t,e,r){if(r=r==0?1e-8:r,t instanceof Ud){if(e instanceof Ud)return this.check(t.shape,e.shape,(t.width+e.width)/2+r);if(e instanceof Pp){if(e.shape==null)return!1;let n=(t.width+e.width)/2+r;for(let s of e.getShapes(t.shape,n))if(this.check(t.shape,s,n))return!0;return!1}else{if(e instanceof ud)return this.check(t.shape,e.shape,t.width/2+r);if(e instanceof Cd)return this.check(t.shape,e.shape,(t.width+e.width)/2+r)}}else if(t instanceof Pp){let i=t.shape;if(e instanceof Ud){let n=(t.width+e.width)/2+r;for(let s of t.getShapes(e.shape,n))if(this.check(e.shape,s,n))return!0;return!1}else if(e instanceof Pp){let n=(t.width+e.width)/2+r;for(let s of i)for(let a of e.getShapes(s,n))if(this.check(a,s,n))return!0;return!1}else if(e instanceof ud){let n=t.width/2+r;for(let s of t.getShapes(e.shape,n))if(this.check(e.shape,s,n))return!0;return!1}else if(e instanceof Cd){let n=(t.width+e.width)/2+r;for(let s of t.getShapes(e.shape,n))if(this.check(e.shape,s,n))return!0;return!1}}else if(t instanceof ud){if(e instanceof Ud)return this.check(t.shape,e.shape,e.width/2+r);if(e instanceof Pp){let i=e.width/2+r;for(let n of e.getShapes(t.shape,i))if(this.check(t.shape,n,i))return!0;return!1}else{if(e instanceof ud)return this.check(t.shape,e.shape,r);if(e instanceof Cd)return this.check(t.shape,e.shape,e.width/2+r)}}else if(t instanceof Cd){if(e instanceof Ud)return this.check(t.shape,e.shape,(t.width+e.width)/2+r);if(e instanceof Pp){let i=(t.width+e.width)/2+r;for(let n of e.getShapes(t.shape,i))if(this.check(t.shape,n,i))return!0;return!1}else{if(e instanceof ud)return this.check(t.shape,e.shape,t.width/2+r);if(e instanceof Cd)return this.check(t.shape,e.shape,(t.width+e.width)/2+r)}}return!1}check(t,e,r){if(!t.bbox().isIntersect(e.bbox().extendOfSize(r)))return!1;if(t instanceof Tl){if(e instanceof Tl)return this.checkPts(t,e,r);if(e instanceof fe)return this.checkPt2Pl(t,e,r);if(e instanceof Gt)return this.checkPt2PlGrp(t,e,r)}else if(t instanceof fe){if(e instanceof Tl)return this.checkPt2Pl(e,t,r);if(e instanceof fe)return this.checkPls(t,e,r);if(e instanceof Gt)return this.checkPl2PlGrp(t,e,r)}else if(t instanceof Gt){if(e instanceof Tl)return this.checkPt2PlGrp(e,t,r);if(e instanceof fe)return this.checkPl2PlGrp(e,t,r);if(e instanceof Gt)return this.checkPlGrps(t,e,r)}return!1}checkPts(t,e,r){if(t.start().distance1(e.end())<r||t.end().distance1(e.start())<r||t.start().distance1(e.start())<r||t.end().distance1(e.end())<r)return!0;let n=new ir(t,e).getDistance();return ne.lesseq(n,r)}checkPt2Pl(t,e,r){let i=Jr.inPolyline(t.start(),e);if(i||(i=Jr.inPolyline(t.end(),e)),i)return!0;{let n=Number.MAX_VALUE,s=t.bbox().extendOfSize(r);for(let a of e.primitives)if(!this.isPoints(a)&&s.isIntersect(a.bbox())&&(n=this.getDistance(a,t,n),ne.lesseq(n,r)))return!0;return!1}}checkPt2PlGrp(t,e,r){let i=this.getInpolylines(e),n=i.inPolygon(t.start(),e.items);if(n||(n=i.inPolygon(t.end(),e.items)),n)return!0;{let s=Number.MAX_VALUE,a=t.bbox().extendOfSize(r),c=this.getRtree(e).search(a);for(let h of c)if(!this.isPoints(h)&&a.isIntersect(h.bbox())&&(s=this.getDistance(h,t,s),ne.lesseq(s,r)))return!0;return!1}}checkPls(t,e,r){let i=Kx.pip(t.start(),e);if(i||(i=Kx.pip(e.end(),t)),i)return!0;{let n=Number.MAX_VALUE;for(let s of t.primitives){if(this.isPoints(s))continue;let a=s.bbox().extendOfSize(r);if(a.isIntersect(e.bbox())){for(let l of e.primitives)if(!this.isPoints(l)&&a.isIntersect(l.bbox())&&(n=this.getDistance(s,l,n),ne.lesseq(n,r)))return!0}}return!1}}checkPl2PlGrp(t,e,r){let n=this.getInpolylines(e).inPolygon(t.start(),e.items);if(n||(n=Jr.inPolyline(e.items[0].start(),t)),n)return!0;{let s=Number.MAX_VALUE,a=this.getRtree(e);for(let l of t.primitives){if(this.isPoints(l))continue;let c=l.bbox().extendOfSize(r),h=a.search(c);for(let u of h)if(!this.isPoints(u)&&c.isIntersect(u.bbox())&&(s=this.getDistance(u,l,s),ne.lesseq(s,r)))return!0}return!1}}checkPlGrps(t,e,r){let i=this.getInpolylines(t),n=this.getInpolylines(e),s=t.items.length>0?n.inPolygon(t.items[0].start(),e.items):!1;if(s||(s=e.items.length>0?i.inPolygon(e.items[0].start(),t.items):!1),s)return!0;{let a=Number.MAX_VALUE,l=this.getRtree(t),c=this.getRtree(e);if(t.bbox().area()>e.bbox().area())for(let h of e.items)for(let u of h.primitives){let d=u.bbox().extendOfSize(r),p=l.search(d);for(let m of p)if(!this.isPoints(m)&&d.isIntersect(m.bbox())&&(a=this.getDistance(m,u,a),ne.lesseq(a,r)))return!0}else for(let h of t.items)for(let u of h.primitives){let d=u.bbox().extendOfSize(r),p=c.search(d);for(let m of p)if(!this.isPoints(m)&&d.isIntersect(m.bbox())&&(a=this.getDistance(m,u,a),ne.lesseq(a,r)))return!0}return!1}}getDistance(t,e,r){let n=new ir(t,e).getDistance();return ne.lesseq(n,r)&&(r=n),r}};var Pn=class o extends dc{constructor(e,r,i,n,s,a,l,c,h,u,d=.8,p){super(e,i,p||vu(c));this.modelType="Copper";if(this._layerId=r,this._style=n,this._gridLineWidth=s,this._clearance=a,this._optimization=l,this._locked=h,this._optimizationWidth=d,u==null){let m=new _e,g=null,y=null,b=this.pls.length;for(let P=0;P<b;P++)y=this.pls[P],g=y.bbox(),m.ext1(g);switch(n){case"solid":{l&&m.ext7(d/2);break}case"90grid":case"45grid":{m.ext7(s/2);break}case"none":break}u=m.build1()}this._bbox=u}get modify(){return!1}set modify(e){}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this._layerId),this._layerId=e,this.layerModified=!0)}get bbox(){return this._bbox}get locked(){return this._locked}set locked(e){this._locked=e}get style(){return this._style}set style(e){this._style!=e&&(this._style=e,this.updateShapeData())}get gridLineWidth(){return this._gridLineWidth}set gridLineWidth(e){this._gridLineWidth!=e&&(this._gridLineWidth=e,this.updateShapeData())}get clearance(){return this._clearance}set clearance(e){this._clearance!=e&&(this._clearance=e,this.updateShapeData())}get optimization(){return this._optimization}set optimization(e){this._optimization!=e&&(this._optimization=e,this.updateShapeData())}get optimizationWidth(){return this._optimizationWidth}set optimizationWidth(e){this._optimizationWidth!=e&&(this._optimizationWidth=e,this.updateShapeData())}get isSolid(){return this.style=="solid"}get copperPath(){return this.source}transform(e){}updateBox(){let e=new _e;for(let r of this.pls)e.ext1(r.bbox());switch(this.style){case"solid":{this.optimization&&e.ext7(this.optimizationWidth/2);break}case"90grid":case"45grid":{e.ext7(this.gridLineWidth/2);break}case"none":break}return this._bbox=e.build1(),this._bbox}clone(){this.refreshBBox&&this.updateBox();let e=new o(this.globalIndex,this.layerId,this.showNet,this.style,this.gridLineWidth,this.clearance,this.optimization,this.source,this.locked,this._bbox,this.optimizationWidth);return e.number=this.number,e.zIndex=this.zIndex,e}inShape(e,r){let{style:i,optimization:n,gridLineWidth:s}=this,a=new S(e,r);switch(i){case"solid":{let l=Jr.inPolygon(a,this.pls);if(!l&&n){for(let c of this.pls)for(let h of c.primitives)if(h instanceof M?l=Xa(a,h.start(),h.end(),this.optimizationWidth):h instanceof q&&(l=xf(a,h.center,h.rx,h.startAngle/180*Math.PI,h.endAngle()/180*Math.PI,h.sweep(),this.optimizationWidth)),l)return l}return l}case"90grid":case"45grid":{let l=!1;for(let c of this.pls)for(let h of c.primitives)if(h instanceof M?l=Xa(a,h.start(),h.end(),s):h instanceof q&&(l=xf(a,h.center,h.rx,h.startAngle/180*Math.PI,h.endAngle()/180*Math.PI,h.sweep(),s)),l)return l;return!1}case"none":break}return!1}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}getOutline(e=this.layerId,r=0){return this.pls}getRealOutline(){let e=new Array,{style:r,optimization:i,gridLineWidth:n}=this;for(let s of this.pls)switch(r){case"solid":{if(e.push(s),i)for(let a of s.primitives){let l=a.stroke(this.optimizationWidth,kr.ROUND,le.CW);e.push(l)}break}case"90grid":case"45grid":{for(let a of s.primitives){let l=a.stroke(n,kr.ROUND,le.CW);e.push(l)}break}case"none":break}return e}getMathGraphics(e=this.layerId,r=0){let i=new Array,{style:n,optimization:s,gridLineWidth:a}=this;switch(n){case"solid":if(Re.addAll(i,this.pls),s)for(let l of this.pls)for(let c of l.primitives)i.push(c.stroke(this.optimizationWidth,kr.ROUND,le.CW));case"90grid":case"45grid":for(let l of this.pls)for(let c of l.primitives)i.push(c.stroke(a,kr.ROUND,le.CW));case"none":break}return new Gt(i)}initRTree(){if(this.style==="solid"||this.isEmpty)return;this._rTree||(this._rTree=new nn(10));let e=this.pls;for(let r of e){let i=r.primitives;for(let n of i)this._rTree.add(n)}}search(e){var i;return this._rTree||this.initRTree(),e=e.extendSize(this.gridLineWidth),((i=this._rTree)==null?void 0:i.search(e))||[]}};var Cn=class o extends dc{constructor(e,r,i,n,s,a,l,c){super(e,i,c||vu(s));this.modelType="Inner";if(this._layerId=r,this._style=n,this._locked=a,l==null){let h=new _e,u=null,d=null,p=this.pls.length;for(let m=0;m<p;m++)d=this.pls[m],u=d.bbox(),h.ext1(u);l=h.build1()}this._bbox=l}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this._layerId),this._layerId=e,this.layerModified=!0)}get bbox(){return this._bbox}get locked(){return this._locked}set locked(e){this._locked=e}get style(){return this._style}set style(e){this._style!=e&&(this._style=e,this.updateShapeData())}get showNet(){return this._net}get copperPath(){return this.source}transform(e){}inShape(e,r,i){return Jr.inPolygon(new S(e,r),this.pls)}getOutline(e,r){return this.pls}clone(){this.refreshBBox&&this.updateBox();let e=new o(this.globalIndex,this.layerId,this.showNet,this.style,this.source,this.locked,this.bbox);return e.number=this.number,e.zIndex=this.zIndex,e}getMathGraphics(e=this.layerId,r=0){return new Gt(this.pls)}};var _Ce=class{constructor(){this.CacheElementManagerInstance=_u.getInstance()}getTrackCache(t){let{globalIndex:e,layerId:r}=t,i=this.CacheElementManagerInstance.getCache(e,r);return i==null&&(i=this.CacheElementManagerInstance.addCache(e,r,t.primitive,t.width)),i}getPadCache(t,e=t.layerId){let{globalIndex:r}=t,i=this.CacheElementManagerInstance.getCache(r,e);return i==null&&(i=this.CacheElementManagerInstance.addCache(r,e,t.getMathGraphics(e))),i}getViaCache(t,e=t.layerId){let{globalIndex:r}=t,i=this.CacheElementManagerInstance.getCache(r,e);return i==null&&(i=this.CacheElementManagerInstance.addCache(r,e,t.getMathGraphics(e))),i}getTearDropCache(t){let{globalIndex:e,layerId:r}=t,i=this.CacheElementManagerInstance.getCache(e,r);return i==null&&(i=this.CacheElementManagerInstance.addCache(e,r,t.getMathGraphics(r))),i}getProfileCache(t){let e=t.layerId;switch(t.type){case"Line":{let{globalIndex:r}=t,i=this.CacheElementManagerInstance.getCache(r,e);return i==null&&(i=this.CacheElementManagerInstance.addCache(r,e,t.getMathGraphics(e).primitives,t.strokeWidth)),i}case"Board Outline":{let{globalIndex:r}=t,i=this.CacheElementManagerInstance.getCache(r,e);return i==null&&(i=this.CacheElementManagerInstance.addCache(r,e,t.getMathGraphics(e))),i}case"Prohibited Region":case"Fill Region":case"TearDrop":case"Slot Region":{let{globalIndex:r}=t,i=this.CacheElementManagerInstance.getCache(r,e);return i==null&&(i=this.CacheElementManagerInstance.addCache(r,e,t.getMathGraphics(e))),i}default:return null}}getFillCache(t,e){let{globalIndex:r,layerId:i}=t;if(t instanceof Pn){let n=this.CacheElementManagerInstance.getCache(r,i);if(t.style=="solid"){if(n==null){let s=t.optimization?t.optimizationWidth:0;n=this.CacheElementManagerInstance.addCache(r,i,new Gt(t.pls),s)}}else{if(e){let s=r+"_"+e.globalIndex;if(n=this.CacheElementManagerInstance.getCache(s,i),n==null){let a=t.search(e.bbox),l=t.gridLineWidth;n=this.CacheElementManagerInstance.addCache(s,i,a,l)}return n}if(n==null){let s=new Array,a=t.pls;for(let c of a)Re.addAll(s,c.primitives);let l=t.gridLineWidth;n=this.CacheElementManagerInstance.addCache(r,i,s,l)}}return n}else if(t instanceof Cn){let n=this.CacheElementManagerInstance.getCache(r,i);return n==null&&(n=this.CacheElementManagerInstance.addCache(r,i,new Gt(t.pls))),n}}},Co=new _Ce;var Uy=class{constructor(){this.collisionCheck=new e8}checkIntersection(t,e){return t.isEmpty||e.isEmpty||t==e?!1:t instanceof yt?this.dispatchTrackCheck(t,e):t instanceof Je?this.dispatchPadCheck(t,e):t instanceof It?this.dispatchViaCheck(t,e):t instanceof lr?t.type=="TearDrop"?this.dispatchTearCheck(t,e):this.dispatchProfileCheck(t,e):t instanceof dc?this.dispatchCopperCheck(t,e):!1}dispatchTrackCheck(t,e){return e instanceof yt?this.checkTracks(t,e):e instanceof Je?this.checkTrackPad(t,e):e instanceof It?this.checkTrackVia(t,e):e instanceof lr?e.type=="TearDrop"?this.checkTrackTear(t,e):this.checkTrackProfile(t,e):e instanceof dc?this.checkTrackCopper(t,e):!1}dispatchPadCheck(t,e){return e instanceof yt?this.checkTrackPad(e,t):e instanceof Je?this.checkPads(t,e):e instanceof It?this.checkPadVia(t,e):e instanceof lr?e.type=="TearDrop"?this.checkPadTear(t,e):this.checkPadProfile(t,e):e instanceof dc?this.checkPadCopper(t,e):!1}dispatchViaCheck(t,e){return e instanceof yt?this.checkTrackVia(e,t):e instanceof Je?this.checkPadVia(e,t):e instanceof It?this.checkVias(t,e):e instanceof lr?e.type=="TearDrop"?this.checkViaTear(t,e):this.checkViaProfile(t,e):e instanceof dc?this.checkViaCopper(t,e):!1}dispatchProfileCheck(t,e){return e instanceof yt?this.checkTrackProfile(e,t):e instanceof Je?this.checkPadProfile(e,t):e instanceof It?this.checkViaProfile(e,t):e instanceof lr?e.type=="TearDrop"?this.checkTearProfile(e,t):this.checkProfiles(t,e):e instanceof dc?this.checkProfileCopper(t,e):!1}dispatchCopperCheck(t,e){return e instanceof yt?this.checkTrackCopper(e,t):e instanceof Je?this.checkPadCopper(e,t):e instanceof It?this.checkViaCopper(e,t):e instanceof lr?e.type=="TearDrop"?this.checkTearCopper(e,t):this.checkProfileCopper(e,t):e instanceof dc?this.checkCoppers(e,t):!1}dispatchTearCheck(t,e){return e instanceof yt?this.checkTrackTear(e,t):e instanceof Je?this.checkPadTear(e,t):e instanceof It?this.checkViaTear(e,t):e instanceof lr?e.type=="TearDrop"?this.checkTears(t,e):this.checkTearProfile(t,e):e instanceof dc?this.checkTearCopper(t,e):!1}checkTracks(t,e){let r=Co.getTrackCache(t),i=Co.getTrackCache(e);return this.collisionCheck.checkCache(r,i,0)}checkTrackPad(t,e){let r=Co.getTrackCache(t),i=Co.getPadCache(e,t.layerId),n=this.collisionCheck.checkCache(r,i,0);if(!n&&e.plated){let s=Co.getPadCache(e,12);return this.collisionCheck.checkCache(r,s,0)}return n}checkTrackVia(t,e){let r=Co.getTrackCache(t),i=Co.getViaCache(e,t.layerId);if(i!=null){let s=Math.max(t.width/2,e.radius);if(t.start.distance1(e.center)<s||t.end.distance1(e.center)<s)return!0}let n=this.collisionCheck.checkCache(r,i,0);if(!n){let s=Co.getViaCache(e,12);if(s!=null){let a=Math.max(t.width/2,e.holeRadius);if(t.start.distance1(e.center)<a||t.end.distance1(e.center)<a)return!0}return this.collisionCheck.checkCache(r,s,0)}return n}checkPads(t,e){let r=t.layerId,i=e.layerId,n=gr(r),s=gr(i);if(n&&s){let a=$e.getInstance().getAllCopperLayerIds();for(let u of a){let d=Co.getPadCache(t,u),p=Co.getPadCache(e,u),m=this.collisionCheck.checkCache(d,p,0);if(m)return m}let l=Co.getPadCache(t,12);if(t.plated&&this.checkMultiPad(e,l,a))return!0;let c=Co.getPadCache(e,12);if(e.plated&&this.checkMultiPad(t,c,a))return!0;let h=t.plated&&e.plated&&this.collisionCheck.checkCache(l,c,0);return h||!1}else{let a=n?i:r,l=Co.getPadCache(t,a),c=Co.getPadCache(e,a),h=this.collisionCheck.checkCache(l,c,0);if(!h){let u=n?t:e;if(u.plated){let d=Co.getPadCache(u,12);return this.collisionCheck.checkCache(n?c:l,d,0)}}return h}}checkMultiPad(t,e,r){for(let i of r){let n=Co.getPadCache(t,i),s=this.collisionCheck.checkCache(n,e,0);if(s)return s}return!1}checkPadVia(t,e){let r=t.layerId,i=gr(r),n=Co.getViaCache(e,e.startLayer);if(i){let s=$e.getInstance().getAllCopperLayerIds();if(n!=null)for(let h of s){let u=Co.getPadCache(t,h),d=this.collisionCheck.checkCache(u,n,0);if(d)return d}let a=Co.getPadCache(t,12);if(t.plated&&n!=null){let h=this.collisionCheck.checkCache(a,n,0);if(h)return h}let l=Co.getViaCache(e,12),c=this.checkMultiPad(t,l,s);return c||t.plated&&this.collisionCheck.checkCache(a,l,0)}else{let s=Co.getPadCache(t,t.layerId),a=this.collisionCheck.checkCache(s,n,0);if(!a){let l=Co.getViaCache(e,12);return this.collisionCheck.checkCache(s,l,0)}return a}}checkVias(t,e){let r=Co.getViaCache(t,t.startLayer),i=Co.getViaCache(e,e.startLayer),n=t.center.distance1(e.center);if(r!=null&&i!=null){if(ne.lesseq(n,t.radius+e.radius))return!0}else{let l=this.collisionCheck.checkCache(r,i,0);if(l)return l}let s=Co.getViaCache(t,12);if(s!=null&&i!=null){if(ne.lesseq(n,t.holeRadius+e.radius))return!0}else{let l=this.collisionCheck.checkCache(s,i,0);if(l)return l}let a=Co.getViaCache(e,12);if(r!=null&&a!=null){if(ne.lesseq(n,t.radius+e.holeRadius))return!0}else{let l=this.collisionCheck.checkCache(r,a,0);if(l)return l}return ne.lesseq(n,t.holeRadius+e.holeRadius)}checkTrackProfile(t,e){let r=Co.getTrackCache(t),i=Co.getProfileCache(e);return this.collisionCheck.checkCache(r,i,0)}checkTrackCopper(t,e){let r=Co.getTrackCache(t),i=Co.getFillCache(e,t);return this.collisionCheck.checkCache(r,i,0)}checkPadProfile(t,e){let r=Co.getPadCache(t,e.layerId),i=Co.getProfileCache(e),n=this.collisionCheck.checkCache(r,i,0);if(!n&&gr(t.layerId)&&t.plated){let s=Co.getPadCache(t,12);return this.collisionCheck.checkCache(s,i,0)}return n}checkPadCopper(t,e){let r=Co.getPadCache(t,e.layerId),i=Co.getFillCache(e,t),n=this.collisionCheck.checkCache(r,i,0);if(!n&&gr(t.layerId)&&t.plated){let s=Co.getPadCache(t,12);return this.collisionCheck.checkCache(s,i,0)}return n}checkViaProfile(t,e){let r=Co.getViaCache(t,t.startLayer),i=Co.getProfileCache(e),n=this.collisionCheck.checkCache(r,i,0);if(!n){let s=Co.getViaCache(t,12);return this.collisionCheck.checkCache(s,i,0)}return n}checkViaCopper(t,e){let r=Co.getViaCache(t,t.startLayer),i=Co.getFillCache(e,t),n=this.collisionCheck.checkCache(r,i,0);if(!n){let s=Co.getViaCache(t,12);return this.collisionCheck.checkCache(s,i,0)}return n}checkProfiles(t,e){let r=Co.getProfileCache(t),i=Co.getProfileCache(e);return this.collisionCheck.checkCache(r,i,0)}checkProfileCopper(t,e){let r=Co.getProfileCache(t),i=Co.getFillCache(e,t);return this.collisionCheck.checkCache(r,i,0)}checkCoppers(t,e){let r=Co.getFillCache(t,e),i=Co.getFillCache(e,t);return this.collisionCheck.checkCache(r,i,0)}checkTrackTear(t,e){let r=Co.getTrackCache(t),i=Co.getTearDropCache(e);return this.collisionCheck.checkCache(r,i,0)}checkPadTear(t,e){let r=Co.getPadCache(t,e.layerId),i=Co.getTearDropCache(e),n=this.collisionCheck.checkCache(r,i,0);if(!n&&gr(t.layerId)&&t.plated){let s=Co.getPadCache(t,12);return this.collisionCheck.checkCache(s,i,0)}return n}checkViaTear(t,e){let r=Co.getViaCache(t,t.startLayer),i=Co.getTearDropCache(e),n=this.collisionCheck.checkCache(r,i,0);if(!n){let s=Co.getViaCache(t,12);return this.collisionCheck.checkCache(s,i,0)}return n}checkTearProfile(t,e){let r=Co.getTearDropCache(t),i=Co.getProfileCache(e);return this.collisionCheck.checkCache(r,i,0)}checkTearCopper(t,e){let r=Co.getTearDropCache(t),i=Co.getFillCache(e,t);return this.collisionCheck.checkCache(r,i,0)}checkTears(t,e){let r=Co.getTearDropCache(t),i=Co.getTearDropCache(e);return this.collisionCheck.checkCache(r,i,0)}};var ij=class{constructor(t){this.result=new Map;this.tool=new Uy;this.maps=t,this.check()}add2Result(t,e,r){if(t>e){let i=e;e=t,t=i}this.result.get(t)==null&&this.result.set(t,new Map),this.result.get(t).set(e,r)}check(){_u.getInstance().clear();for(let t of this.maps){let e=this.tool.checkIntersection(t[0],t[1]);this.add2Result(t[0].globalIndex,t[1].globalIndex,e)}}};var QM=class QM extends wi{static getInstance(){return QM.manager==null&&(QM.manager=new QM),QM.manager}addItem(t,e){this.map.set(t,e)}delete(t){this.map.delete(t)}};QM.manager=null;var gre=QM;var vCe=hI(),$2=vCe.top||vCe;try{$2.location&&$2.location.search}catch{$2=null}var tEt="-time-diff",yre=$2&&rEt();function rEt(){let o=vCe.PRO_LOG_LEVEL;return o=="trace"||o=="debug"}function xCe(o){return o+tEt}function iEt(o,t){let e=xCe(o);Array.isArray($2[e])?$2[e].push(t):$2[e]=[t]}function nj(o){let t=xCe(o),e=$2[t];return Array.isArray(e)?e:[]}function nEt(o){let t=0;return nj(o).forEach(e=>t+=e),t}function K8e(o){delete $2[xCe(o)]}function t8(o,t=3){return+o.toFixed(t)}function pn(o,t=!1){if(!yre)return;let e=new Date().getTime();t&&$2[o]||($2[o]=e)}function bre(o){if(!yre)return;let t=$2[o];return!isNaN(t)}function Bi(o,t=0){if(!yre)return;let e=$2[o];if(isNaN(e))return!1;let r=new Date().getTime(),i=t8((r-e)/1e3);return i>=t&&$0(o,void 0,`${i}s`),iEt(o,i),delete $2[o],!0}function RCe(o,t=""){if(!yre)return;let e=Array.isArray(o)?o:Object.keys(o),r=t&&nj(t),i=0;if(r.length==0?e.forEach(a=>{let l=nEt(a);i+=l}):r.forEach(a=>i+=a),i==0){e.forEach(a=>{K8e(a)});return}let n={},s=0;e.forEach(a=>{let l=nj(a),c=0;l.forEach(u=>c+=u);let h=c/i*100;s+=h,n[a]={desc:o[a]||a,"time(s)":t8(c),"ratio(%)":t8(h),records:l.length>1?`(${l.length}): ${l.join(", ")}`:l.length},K8e(a)}),s!=0&&($0(t,{color:"#ffff00"},`${t8(i)}s`,`${t8(i*s/100)}s(${t8(s)}%)`),console.table(n))}function Pre(){let o="createPcbEditorToRendered-time",t="createIframe-time",e="loadFrame-time",r="rpcInitFrameInfoInit-time",i="pcbDataStrDecode-time",n="buildController-time",s="attachModify-time",a="updateRTree-time",l="rebuildRatline-time",c="annotationModify-time",h="updateDRC-time",u="ratlineResultFromWorker-time";RCe({[t]:"\u521B\u5EFAiframe",[e]:"\u52A0\u8F7Diframe",[r]:"\u7F16\u8F91\u5668\u521D\u59CB\u5316",[i]:"\u89E3\u7801 & \u6784\u5EFA\u6570\u636E\u6A21\u578B",[n]:"\u6784\u5EFA\u4E1A\u52A1\u6A21\u578B",[s]:"\u66F4\u65B0\u89C6\u56FE\u5C42\u53D8\u5316",[a]:"\u66F4\u65B0rTree",[l]:"\u91CD\u5EFA\u98DE\u7EBF",[c]:"\u66F4\u65B0\u6279\u6CE8",[h]:"\u66F4\u65B0DRC",[u]:"worker\u98DE\u7EBF\u7ED3\u679C"},o)}var Zx=class o extends ki{constructor(e,r,i,n,s,a,l,c){super();this.modelType="Ratline";this.globalIndex=e,this.net=n,this.startId=s,this.endId=a,this._start=r,this._end=i,this._locked=l,this.shapeModified=!0}get modify(){return!1}set modify(e){}get layerId(){return 57}set layerId(e){}get start(){return this._start}set start(e){this._start!=e&&(this._start=e,this.updateShapeData())}get end(){return this._end}set end(e){this._end!=e&&(this._end=e,this.updateShapeData())}get bbox(){return new _e().ext2(this.start).ext2(this.end).build1()}get length(){return this.start.distance1(this.end)}get locked(){return this._locked}set locked(e){this._locked=e}rotateFor(e,r){}transform(e){}inOutline(e){return this.inShape(e.x,e.y)}inShape(e,r,i){let n=Ni().getScale();return Xa(new S(e,r),this.start,this.end,0,n)}updateBox(){return this.bbox}clone(){this.refreshBBox&&this.updateBox();let e=new o(this.globalIndex,this.start,this.end,this.net,this.startId,this.endId,this.locked,this.bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var e4=class e4 extends wi{constructor(){super(...arguments);this.idMap=new Map;this._lastRatline=null}static getInstance(){return e4.manager==null&&(e4.manager=new e4),e4.manager}add(e,r,i,n,s,a){let l=new Zx(e,r,i,n,s,a,!1,null),c=this.map.get(n);return c==null&&(c=new Array,this.map.set(n,c)),c.push(l),this.idMap.set(e,l),l}delete(e){let r=this.map.get(e);if(r!=null)for(let i of r)this.idMap.delete(i.globalIndex);this.map.delete(e)}deleteById(e){if(this._lastRatline=this.idMap.get(e),this.idMap.delete(e),this._lastRatline!=null&&(this._last=this.map.get(this._lastRatline.net),this._last!=null)){let r=this._last.indexOf(this._lastRatline);r>=0&&this._last.splice(r,1),this._last.length==0&&this.map.delete(this._lastRatline.net)}}getRatlineByNetName(e){return this.map.get(e)||[]}getRatlineLengthByName(e){let r=this.getRatlineByNetName(e),i=0;return r.forEach(n=>i+=n.length),i}getRatlineById(e){return this.idMap.get(e)}getAllNets(){let e=new Array(this.map.size),r=0;for(let i of this.map.values())e[r]=i,r++;return e}getAllRatlines(){return this.idMap.values()}recycle(){super.recycle(),this.idMap.clear()}};e4.manager=null;var PT=e4;var K2=class{constructor(t){this.item=t}get near(){return this._near==null?new Set:Array.isArray(this._near)?new Set(this._near):this._near}addNear(t){if(this._near==null&&(this._near=new Array),Array.isArray(this._near)){if(this._near.includes(t))return;this._near.push(t),this._near.length>50&&(this._near=new Set(this._near))}else this._near.add(t)}deleteNear(t){if(this._near!=null)if(Array.isArray(this._near)){let e=this._near.indexOf(t);e>=0&&this._near.splice(e,1)}else this._near.delete(t)}deleteAllNear(){this._near!=null&&(this._near=new Array)}cluster(){let t=[this],e=new Set;for(e.add(this);t.length;){let r=t.pop();for(let i of r.near)e.has(i)||(t.push(i),e.add(i))}return Array.from(e)}bbox(){return this.item.bbox}};var Hd=class{constructor(){this.whetherCheckNet=!0}needCheckIntersection(t,e){return t.isEmpty||e.isEmpty||t==e?!1:t instanceof yt?this.dispatchTrackCheck(t,e):t instanceof Je?this.dispatchPadCheck(t,e):t instanceof It?this.dispatchViaCheck(t,e):t instanceof lr?t.type=="TearDrop"?this.dispatchTearCheck(t,e):this.dispatchProfileCheck(t,e):t instanceof Pn||t instanceof Cn?this.dispatchCopperCheck(t,e):!1}dispatchTrackCheck(t,e){return e instanceof yt?this.checkTracks(t,e):e instanceof Je?this.checkTrackPad(t,e):e instanceof It?this.checkTrackVia(t,e):e instanceof lr?e.type=="TearDrop"?this.checkTrackTear(t,e):this.checkTrackProfile(t,e):e instanceof Pn||e instanceof Cn?this.checkTrackCopper(t,e):!1}dispatchPadCheck(t,e){return e instanceof yt?this.checkTrackPad(e,t):e instanceof Je?this.checkPads(t,e):e instanceof It?this.checkPadVia(t,e):e instanceof lr?e.type=="TearDrop"?this.checkPadTear(t,e):this.checkPadProfile(t,e):e instanceof Pn||e instanceof Cn?this.checkPadCopper(t,e):!1}dispatchViaCheck(t,e){return e instanceof yt?this.checkTrackVia(e,t):e instanceof Je?this.checkPadVia(e,t):e instanceof It?this.checkVias(t,e):e instanceof lr?e.type=="TearDrop"?this.checkViaTear(t,e):this.checkViaProfile(t,e):e instanceof Pn||e instanceof Cn?this.checkViaCopper(t,e):!1}dispatchProfileCheck(t,e){return e instanceof yt?this.checkTrackProfile(e,t):e instanceof Je?this.checkPadProfile(e,t):e instanceof It?this.checkViaProfile(e,t):e instanceof lr?e.type=="TearDrop"?this.checkProfileTear(t,e):this.checkProfiles(t,e):e instanceof Pn||e instanceof Cn?this.checkProfileCopper(t,e):!1}dispatchCopperCheck(t,e){return e instanceof yt?this.checkTrackCopper(e,t):e instanceof Je?this.checkPadCopper(e,t):e instanceof It?this.checkViaCopper(e,t):e instanceof lr?e.type=="TearDrop"?this.checkTearCopper(e,t):this.checkProfileCopper(e,t):e instanceof Pn||e instanceof Cn?this.checkCoppers(e,t):!1}dispatchTearCheck(t,e){return e instanceof yt?this.checkTrackTear(e,t):e instanceof Je?this.checkPadTear(e,t):e instanceof It?this.checkViaTear(e,t):e instanceof lr?e.type=="TearDrop"?this.checkTears(t,e):this.checkProfileTear(e,t):e instanceof Pn||e instanceof Cn?this.checkTearCopper(t,e):!1}checkTracks(t,e){return!(t.length<1e-8||e.length<1e-8||t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net)}checkTrackPad(t,e){if(t.length<1e-8)return!1;let r=gr(e.layerId);return!(!r&&t.layerId!=e.layerId||r&&!e.plated&&e.isUnuseLayer(t.layerId)||this.whetherCheckNet&&t.net!=e.net)}checkTrackVia(t,e){return!(t.length<1e-8||this.whetherCheckNet&&t.net!=e.net||!e.isContains(t.layerId))}checkPads(t,e){let r=gr(t.layerId),i=gr(e.layerId);if(r&&!i){if(!t.plated&&t.isUnuseLayer(e.layerId))return!1}else if(!r&&i&&!e.plated&&e.isUnuseLayer(t.layerId))return!1;return!(!r&&!i&&t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net)}checkPadVia(t,e){if(this.whetherCheckNet&&t.net!=e.net)return!1;let r=t.layerId,i=gr(r);if(!i&&!e.isContains(r))return!1;if(i&&!t.plated){if(e.isContains(1)||e.isContains(2))return!0;{let n=$e.getInstance().getAllCopperLayerIds();for(let s of n)if(s!=1&&s!=2&&e.isContains(s)&&!t.isUnuseLayer(s))return!0;return!1}}return!0}checkVias(t,e){return!(this.whetherCheckNet&&t.net!=e.net||!e.isContains(t.startLayer)&&!e.isContains(t.endLayer))}checkTrackProfile(t,e){if(t.length<1e-8)return!1;let r=e.type;return!(r!="Fill Region"&&r!="Line"||this.whetherCheckNet&&t.net!=e.net||t.layerId!=e.layerId)}checkTrackCopper(t,e){return!(t.length<1e-8||this.whetherCheckNet&&t.net!=e.net||t.layerId!=e.layerId)}checkTrackTear(t,e){return!(t.length<1e-8||this.whetherCheckNet&&t.net!=e.net||t.layerId!=e.layerId)}checkPadProfile(t,e){let r=e.type;if(r!="Fill Region"&&r!="Line"||this.whetherCheckNet&&t.net!=e.net)return!1;let i=gr(t.layerId);return!(!i&&t.layerId!=e.layerId||i&&!t.plated&&t.isUnuseLayer(e.layerId)||!gs($e.getInstance().getLayer(e.layerId).type))}checkPadCopper(t,e){if(this.whetherCheckNet&&t.net!=e.net)return!1;let r=gr(t.layerId);return!(!r&&t.layerId!=e.layerId||r&&!t.plated&&t.isUnuseLayer(e.layerId))}checkPadTear(t,e){if(this.whetherCheckNet&&t.net!=e.net)return!1;let r=gr(t.layerId);return!(!r&&t.layerId!=e.layerId||r&&!t.plated&&t.isUnuseLayer(e.layerId))}checkViaProfile(t,e){let r=e.type;return!(r!="Fill Region"&&r!="Line"||this.whetherCheckNet&&t.net!=e.net||!t.isContains(e.layerId)||!gs($e.getInstance().getLayer(e.layerId).type))}checkViaCopper(t,e){return!(this.whetherCheckNet&&t.net!=e.net||!t.isContains(e.layerId))}checkViaTear(t,e){return!(this.whetherCheckNet&&t.net!=e.net||!t.isContains(e.layerId))}checkProfiles(t,e){var n,s;if(!gs((n=$e.getInstance().getLayer(t.layerId))==null?void 0:n.type)||!gs((s=$e.getInstance().getLayer(e.layerId))==null?void 0:s.type))return!1;let r=t.type,i=e.type;return!(r!="Fill Region"&&r!="Line"||i!="Fill Region"&&i!="Line"||t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net)}checkProfileCopper(t,e){let r=t.type;return!(r!="Fill Region"&&r!="Line"||t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net||!gs($e.getInstance().getLayer(e.layerId).type))}checkProfileTear(t,e){let r=t.type;return!(r!="Fill Region"&&r!="Line"||t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net||!gs($e.getInstance().getLayer(e.layerId).type))}checkCoppers(t,e){return!(t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net)}checkTearCopper(t,e){return!(t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net)}checkTears(t,e){return!(t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net)}};function Jx(o,t,e=!0){_u.getInstance().clear();let r=new Hd;return r.whetherCheckNet=e,r.needCheckIntersection(o,t)?new Uy().checkIntersection(o,t):!1}function r8(o,t){let e=new Hd;return t.isEmpty?!1:!o.isEmpty&&o!=t?e.needCheckIntersection(t,o):!1}var ln=class o extends kd{constructor(t,e=!1,r=[]){super(),this._padId=t,this._isBridgingCopper=e,this._networkList=r}get isBridgingCopper(){return this._isBridgingCopper}set isBridgingCopper(t){this._isBridgingCopper=t}get networkList(){return this._networkList}set networkList(t){this._networkList=t}get padId(){return this._padId}set padId(t){this._padId=t}toJSON(){return{padId:this.padId,isBridgingCopper:this.isBridgingCopper,networkList:Ls(this.networkList)}}clone(){return new o(this.padId,this.isBridgingCopper,Array.from(this.networkList))}};var DCe=class{constructor(){this.model=void 0;this.keep=t=>{if(this.model==null)return!0;switch(this.model.modelType){case"Track":case"ArcTrack":return t==12||t==this.model.layerId;case"Pad":return this.model.layerId==12?!0:t==12||t==this.model.layerId;case"Via":return!!(t==12||this.model.isContains(t));case"Polygon":case"Rect":case"Circle":case"Copper":case"Inner":return t==12||t==this.model.layerId;default:return!1}}}},Qx=new DCe;var i8=class{constructor(t){this.map=new Map;this.net=t}get conditionMap(){return this._conditionMap==null&&(this._conditionMap=new Map),this._conditionMap}insert2Rtree(t){}insertPlatedPad2Rtree(t){this.insert2Rtree(t)}remove4Rtree(t){}end(){}getModel(t){for(let e of this.map.keys())if(e.globalIndex===t)return this.map.get(e);return null}cluster(t,e){this.trim(t,e);let r=new Map(this.map),i=[];for(let[,n]of r){let s=new Set;for(let a of n.cluster())r.delete(a.item),s.add(a.item.globalIndex);i.push(s)}return i}getConnect(){this.trim();let t=new Map(this.map),e=[];return t.forEach(r=>{let i=new Set,n=new Map;for(let s of r.cluster()){if(t.delete(s.item),s.item instanceof Je){let a=n.get(s.item.globalIndex);a==null&&(a=new Set,n.set(s.item.globalIndex,a)),a.add(s.item.layerId)}i.add(s.item.globalIndex)}e.push({set:i,padMap:n})}),e}trim(t,e){let{add:r,remove:i,platPads:n}=this.vary(t);if(r.size==0&&i.size==0&&n.size==0)return!1;e!=null&&e.sycnChangeData(r,i,n);for(let s of i){let a=this.map.get(s);if(a==null)continue;this.remove4Rtree(a);let l=a.near;for(let c of l)c.deleteNear(a);this.map.delete(s)}this.removeConditionMap(i);for(let s of r){let a=new K2(s);this.insert2Rtree(a),this.map.set(s,a)}for(let s of n){let a=new K2(s);this.insertPlatedPad2Rtree(a),this.map.set(s,a),r.add(s)}for(let s of r){let a=this.map.get(s);if(a==null)continue;a.deleteAllNear(),Qx.model=s;let l=s.buildBBox();if(l==null)continue;let c=this.search(l.extendOfSize(1e-8));for(let h of c)this.condition(s,h.item)&&(a.addNear(h),h.addNear(a))}return this.end(),!0}removeConditionMap(t){for(let e of t){let r=this.getId(e),i=this.conditionMap.get(r);if(i){for(let[n]of i){let s=this.conditionMap.get(n);s&&s.delete(r)}this.conditionMap.delete(r)}}}vary(t){let e=new Set,r=new Set,{shapes:i,platPads:n,sourcePlatPads:s}=this.shapes();if(t)for(let a of s)a.layerOrBoxModified=!1;if(this.map.size===0)for(let a of i)e.add(a);else{let a=!1;for(let l of i)a=this.map.has(l),l.layerOrBoxModified?(a&&r.add(l),e.add(l),t&&(l.layerOrBoxModified=!1)):a||e.add(l);for(let[l]of this.map)(!i.has(l)||l.layerOrBoxModified)&&(r.add(l),t&&(l.layerOrBoxModified=!1))}return i.clear(),{add:e,remove:r,platPads:n}}shapes(){_u.getInstance().clear();let t=this.netShapes(this.net),e=new Set,r=new Set,i=new Set,n=$e.getInstance().getAllCopperLayerIds(),s=new Map;for(let[a]of this.map)if(a.modelType=="Pad"){let l=a;if(l.layerId!=12){let c=s.get(l.globalIndex);c==null&&(c=new Map,s.set(l.globalIndex,c)),c.set(l.layerId,l)}}for(let a=0,l=t.length;a<l;a++){let c=t[a];if(!(c instanceof lr&&c.type=="Copper Region")&&!(c instanceof lr&&c.type=="Fill Region"&&c.component instanceof ln&&c.component.isBridgingCopper))if(c instanceof Je)if(c.layerId==12&&!c.plated){if(i.add(c),c.refreshBBox&&c.buildBBox(),!c.layerOrBoxModified){let h=s.get(c.globalIndex);if(h!=null){for(let u=0,d=n.length;u<d;u++){let p=n[u];if(!c.isUnuseLayer(p)){if(p===1&&c.top!=null){let m=h.get(p);m!=null?(e.add(m),this.reversePlatCache(m)):r.add(c.cloneLayer(p,c.top.clone(),void 0,void 0,void 0))}else if(p===2&&c.bottom!=null){let m=h.get(p);m!=null?(e.add(m),this.reversePlatCache(m)):r.add(c.cloneLayer(p,void 0,c.bottom.clone(),void 0,void 0))}else if(c.inner!=null){let m=h.get(p);m!=null?(e.add(m),this.reversePlatCache(m)):r.add(c.cloneLayer(p,void 0,void 0,c.inner.clone(),void 0))}}}continue}}for(let h=0,u=n.length;h<u;h++){let d=n[h];c.isUnuseLayer(d)||(d===1&&c.top!=null?r.add(c.cloneLayer(d,c.top.clone(),void 0,void 0,void 0)):d===2&&c.bottom!=null?r.add(c.cloneLayer(d,void 0,c.bottom.clone(),void 0,void 0)):c.inner!=null&&r.add(c.cloneLayer(d,void 0,void 0,c.inner.clone(),void 0)))}}else e.add(c);else c instanceof ki&&e.add(c)}return{shapes:e,platPads:r,sourcePlatPads:i}}reversePlatCache(t){let e=this.map.get(t);this.insertPlatedPad2Rtree(e)}condition(t,e){if(t==e)return!1;let r=this.getId(t),i=this.getId(e),n=this.conditionMap.get(r),s=this.conditionMap.get(i),a;return n?(a=n.get(i),a===void 0?s?(a=s.get(r),a===void 0?(a=this.connect(t,e),n.set(i,a),s.set(r,a)):n.set(i,a)):(a=this.connect(t,e),n.set(i,a),this.conditionMap.set(i,new Map().set(r,a))):s?s.get(r)===void 0&&s.set(r,a):this.conditionMap.set(i,new Map().set(r,a))):(s?(a=s.get(r),a===void 0?(a=this.connect(t,e),s.set(r,a)):this.conditionMap.set(i,new Map().set(r,a))):(a=this.connect(t,e),this.conditionMap.set(i,new Map().set(r,a))),this.conditionMap.set(r,new Map().set(i,a))),a}getId(t){return t instanceof Je?t.globalIndex+"_"+t.layerId:t.globalIndex}get capacity(){return this.net==="GND"?20:10}connect(t,e){return r8(t,e)&&new Uy().checkIntersection(t,e)}};var t4=["Track","ArcTrack","Pad","Via","Polygon","Rect","Circle"],dd=["Track","ArcTrack","Pad","Via","Polygon","Rect","Circle","Copper","Inner"],Tre=["Track","ArcTrack","Pad","Via","Polygon","Rect","Circle","Ratline","Copper","Inner"],S0=["Polygon","Rect","Circle"],dm=["Track","ArcTrack","Pad","Via","Image","Picture","Length Dimension","Smart Dimension","Protractor Dimension","Radius Dimension","Polygon","Rect","Circle","Copper","Inner","Component","Ratline","Text","DRCResult","DrcComponentSpacing","DrcComponentOverlap","DrcCreepage","Line","Arc"],NTr=["Track","ArcTrack","Pad","Via","Image","Picture","Length Dimension","Smart Dimension","Protractor Dimension","Radius Dimension","Polygon","Rect","Circle","Copper","Inner","Component","Ratline","Text","DRCResult"],r4=["Track","ArcTrack","Pad","Via","Image","Picture","Length Dimension","Smart Dimension","Protractor Dimension","Radius Dimension","Polygon","Rect","Circle","Copper","Inner","Component","Ratline","Text"],oj=["Track","ArcTrack","Pad","Via","Image","Picture","Length Dimension","Smart Dimension","Protractor Dimension","Radius Dimension","Polygon","Rect","Circle","Copper","Inner","Component","Ratline","Text"],Z8e=["Track","ArcTrack","Pad","Via","Image","Picture","Length Dimension","Smart Dimension","Protractor Dimension","Radius Dimension","Polygon","Rect","Circle","Copper","Inner","Component","Ratline","Text"],J8e=["Track","ArcTrack","Pad","Via","Ratline"],wCe=["Polygon","ArcTrack","Rect","Circle"],sj=["Track","ArcTrack","Pad","Via"],Q8e=["Track","ArcTrack"];function oEt(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minY+e.maxY)/2,n=(r.minY+r.maxY)/2;return i-n}function sEt(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minX+e.maxX)/2,n=(r.minX+r.maxX)/2;return i-n}var TT=class o{constructor(t,e){this.childs=new Array;this._bbox=null;this.parent=null;if(this.capacity=t,typeof e<"u"&&Array.isArray(e))for(let r of e)this.insert(r)}bbox(){return an.notnull(this._bbox)}itor(t,e){for(let r of this.childs)r instanceof o?r.itor(t+1,e):e(r,t)}debug(t){for(let e of this.childs)console.log(t,e.bbox(),e instanceof o?"+":"-"),e instanceof o&&e.debug(t+" |--")}insert(t){let e=this.childs,r=t.bbox();if(!(t instanceof o))for(let i=0;i<e.length;i++){let n=e[i];if(n instanceof o&&r.isInside(n.bbox())){n.insert(t),this._bbox=ut.extend2(this._bbox,r);return}}t instanceof o&&(t.parent=this),e.length<=this.capacity?e.push(t):(e.push(t),this.splitNode()),this._bbox=ut.extend2(this._bbox,r)}remove(t){if(t instanceof o&&t.childs.length>0)throw new Error;let e=this.childs,r=t.bbox(),i=new Array;for(let n=0;n<e.length;n++){let s=e[n];if(s===t)return e.splice(n,1),e.length>0?(this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this.parent!==null?(this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this._bbox=null,1;s instanceof o&&r.isInside(s.bbox())&&i.push(s)}if(t instanceof o)throw new Error;for(let n of i){let s=n.remove(t);if(s===1)return this.childs.length>0&&this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox(),1;if(s!==0)throw new Error}return 0}recycle(){this.childs.length=0,this._bbox=null}updateBBox(){let t=new _e;for(let e of this.childs)t.ext1(e.bbox());this._bbox=t.build1()}splitNode(){let t=this.childs,e=t.length,r=-1,i=-1,n=Number.NEGATIVE_INFINITY;for(let c=0;c<e;c++){let h=t[c];for(let u=c+1;u<e;u++){let d=t[u],p=ut.extend2(h.bbox(),d.bbox()).area();p>n&&(n=p,r=c,i=u)}}let s=this.asNode(t[r]),a=this.asNode(t[i]);for(let c=0;c<e;c++)if(c!==r&&c!==i){let h=t[c],u=h.bbox(),d=ut.extend2(s._bbox,u).area(),p=ut.extend2(a._bbox,u).area();d<p?s.insert(h):a.insert(h)}t.length=0;let l=this.parent;s.updateBBox(),a.updateBBox(),l!==null&&l.childs.length<this.capacity?(s.parent=l,a.parent=l,l.childs.push(s),l.childs.push(a),l.remove(this),l.updateBBox()):(s.parent=this,a.parent=this,t.push(s),t.push(a),this.updateBBox()),this.childs.length>0&&this.updateBBox()}asNode(t){if(t instanceof o)return t;{let e=new o(this.capacity);return e.insert(t),e}}},eFe=.5,tFe=1e5,Sd=class{constructor(t){this.items=new Set;this.changeList=new Set;this.deadList=new Set;this.capacity=t,this.capacity2=t*t,this.root=new TT(t)}itor(t){this.root.itor(0,t)}size(){return this.items.size}search(t){this.flushWhenNeed();let e=[],r=[];for(r.push(this.root);;){let i=r.shift();if(i!==void 0)this.dfsSearchNode(t,i,e);else break}return e}dfsSearchNode(t,e,r){if(e!==void 0)for(let i of e.childs)t.isSeparated(i.bbox())||(i instanceof TT?i.bbox().isInside(t)?this.add2Result(i,r):this.dfsSearchNode(t,i,r):r.push(i))}addResult2Cb(t,e,r){if(t!==void 0)for(let i of t.childs)i instanceof TT?this.addResult2Cb(i,e,r):(!r||r(i))&&e(i)}search2Cb(t,e){this.flushWhenNeed(),this.root!==void 0&&this.search4Node(t,this.root,e)}search4Node(t,e,r){if(e!==void 0)for(let i of e.childs)t.isSeparated(i.bbox())||(i instanceof TT?i.bbox().isInside(t)?this.addResult2Cb(i,r):this.search4Node(t,i,r):r(i))}searchInside(t){this.flushWhenNeed();let e=[],r=[];for(r.push(this.root);;){let i=r.shift();if(i!==void 0)for(let n of i.childs){let s=n.bbox();t.isSeparated(s)||(n instanceof TT?s.isInside(t)?this.add2Result(n,e):r.push(n):s.isInside(t)&&e.push(n))}else break}return e}searchIntersect(t){this.flushWhenNeed();let e=[],r=[];for(r.push(this.root);;){let i=r.shift();if(i!==void 0)for(let n of i.childs){let s=n.bbox();t.isSeparated(s)||(n instanceof TT?s.isIntersect(t)&&!s.isInside(t)?this.add2Result(n,e):r.push(n):s.isIntersect(t)&&!s.isInside(t)&&e.push(n))}else break}return e}add2Result(t,e,r){if(t!==void 0)for(let i of t.childs)i instanceof TT?this.add2Result(i,e,r):(!r||r(i))&&e.push(i)}conditionSearch(t,e){this.flushWhenNeed();let r=[],i=[];for(i.push(this.root);;){let n=i.shift();if(n!==void 0)for(let s of n.childs)t.isSeparated(s.bbox())||(s instanceof TT?s.bbox().isInside(t)?this.add2Result(s,r,e):i.push(s):e(s)&&r.push(s));else break}return r}insert(t){this.items.add(t),this.changeList.add(t)}remove(t){this.items.delete(t),this.deadList.add(t)}bbox(){return this.flushWhenNeed(),this.root.bbox()}flushDeleteWhenNeed(){let t=this.deadList.size;if(t>0){let e=1;if(this.items.size>0&&(e=t/this.items.size),e>eFe||t>tFe)this.deadList.clear(),this.changeList.clear(),this.deadList=new Set,this.changeList=new Set,this.fullRefresh();else{for(let i of this.deadList)this.root.remove(i);this.deadList.clear(),this.deadList=new Set}}}flushWhenNeed(){let t=this.changeList.size+this.deadList.size;if(t>0){let e=1;if(this.items.size>0&&(e=t/this.items.size),e>eFe||t>tFe)this.deadList.clear(),this.changeList.clear(),this.deadList=new Set,this.changeList=new Set,this.fullRefresh();else{for(let i of this.deadList)this.root.remove(i);this.deadList.clear(),this.deadList=new Set;for(let i of this.changeList)this.items.has(i)&&this.root.insert(i)}this.changeList.clear(),this.changeList=new Set}}debug(){this.root.debug("")}recycle(){this.items.clear(),this.changeList.clear(),this.deadList.clear(),this.deadList=new Set,this.changeList=new Set,this.root.recycle()}fullRefresh(){let t=new Array;for(let e of this.items)t.push(e);for(;;){let e=this.organize(t);if(e.length>1)t=e;else break}this.root.recycle(),this.root=new TT(this.capacity,t)}organize(t){xr(t,sEt,0,t.length);let e=t.length,r=[];for(let i=0;i<e;)if(i+this.capacity2<=e){let n=i+this.capacity2;xr(t,oEt,i,n);for(let s=i;s<n;s+=this.capacity){let a=new TT(this.capacity,t.slice(s,s+this.capacity));r.push(a)}i=i+this.capacity*this.capacity}else{let n=new TT(this.capacity,t.slice(i,i+this.capacity));r.push(n),i=i+this.capacity}return r}};var aj=class extends i8{getMap(t){let e=this.netShapes(),r=new Map;this.map.clear();let i=$e.getInstance().getAllCopperLayerIds(),n=new Map,s;for(let l of e){if(l.layerOrBoxModified=!1,l instanceof Je&&l.layerId==12&&!l.plated){let c=n.get(l.globalIndex);c==null&&(c=new Map,n.set(l.globalIndex,c));for(let h=0,u=i.length;h<u;h++){let d=i[h];l.isUnuseLayer(d)||(d===1&&l.top!=null?(s=new K2(l.cloneLayer(d,l.top.clone(),void 0,void 0,void 0)),c.set(d,s),this.insertPlatedPad2Rtree(s),this.map.set(s.item,s)):d===2&&l.bottom!=null?(s=new K2(l.cloneLayer(d,void 0,l.bottom.clone(),void 0,void 0)),c.set(d,s),this.insertPlatedPad2Rtree(s),this.map.set(s.item,s)):l.inner!=null&&(s=new K2(l.cloneLayer(d,void 0,void 0,l.inner.clone(),void 0)),c.set(d,s),this.insertPlatedPad2Rtree(s),this.map.set(s.item,s)))}continue}s=new K2(l),r.set(l.globalIndex,s),this.insert2Rtree(s),this.map.set(s.item,s)}let a=new Set;for(let{key:l,value:c,layerId:h}of t){let u=r.get(l);if(u==null){let d=n.get(l);if(d!=null&&(u=d.get(h)),u==null)continue}for(let d of c){if(a.has(d))continue;let p=r.get(d);p!=null&&(u.addNear(p),p.addNear(u))}a.add(l),c.length=0}return this}netShapes(){let t=[];return this.net?ze.getSameNetItems(this.net,e=>e.model instanceof ki&&t.push(e.model)&&!1):ze.getAllNoneNetsItems().forEach(e=>e.model instanceof ki&&t.push(e.model)),t}insertPlatedPad2Rtree(t){this.rtree==null&&(this.rtree=new Sd(this.capacity)),this.rtree.insert(t)}getConditionMap(){return this.conditionMap}search(t){let e=Vt.search4Types(t,dd,Qx.keep),r=new Array;for(let i of dd){let n=e.getResults(i);for(let s of n){let a=s.model;if(a instanceof ki){let l=this.map.get(a);l!=null&&r.push(l)}}}if(e.clear(),e=null,this.rtree!=null){let i=this.rtree.search(t);for(let n of i)r.push(n)}return r}end(){this.rtree!=null&&(this.rtree=void 0,delete this.rtree)}};var ys=class extends ki{constructor(){super(...arguments);this.modelType="Line";this._parent=void 0}get isSegment(){return this.width==0}get layerModified(){return this._parent?this._parent.layerModified:this.hasDataState(3)}set layerModified(e){e&&(this.layerOrBoxModified=!0),this.setDataState(3,e)}};var ss=class extends lr{constructor(){super(...arguments);this.modelType="Polygon";this._children=new Array(0)}get childrenModified(){return this.hasDataState(7)}set childrenModified(e){this.setDataState(7,e)}get start(){return this.type=="TearDrop"?this.simplyPolyline.primitives[0].start():this.childrens[0][0].start}get end(){let e=this.childrens[this.childrens.length-1];return e[e.length-1].end}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}inOutline(e){return this.inShape(e.x,e.y)}inShape(e,r,i){switch(this.type){case"Copper Region":case"Line":case"Board Outline":case"3D Shell - Outline":{for(let n of this.childrens)for(let s of n)if(s.inShape(e,r,i))return!0;return!1}default:{let n=this.isInside(new S(e,r));if(n)return n;for(let s of this.childrens)for(let a of s)if(a.inShape(e,r,i))return!0;return!1}}}isInside(e){let r=this.outline;return r!=null?Jr.inPolygon(e,r instanceof Gt?r.items:[r]):!1}InnerArea(e,r,i){let n=this.isInside(new S(e,r));if(n)return n;for(let s of this.childrens)for(let a of s)if(a.inShape(e,r,i))return!0;return!1}onlyOutline(e,r){for(let i of this.childrens)for(let n of i)if(n.inShape(e,r))return!0;return!1}onOutlineShape(e,r,i){let n=this.isInside(new S(e,r));if(n)return n;for(let s of this.childrens)for(let a of s)if(a.inShape(e,r,i))return!0;return!1}isClose(){return this.childrens.every(e=>{if(e.length==2){if(e[0]instanceof ys&&e[1]instanceof ys)return!1;{let r=e[0],i=e[e.length-1];if(r.start.distance1(i.end)<this.strokeWidth)return!0}}else if(e.length>2){let r=e[0],i=e[e.length-1];if(r.start.distance1(i.end)<this.strokeWidth)return!0}return!1})}equals(e){let r=this.childrens,i=e.childrens;return r.length!=i.length||r.some((a,l)=>{let c=i[l];return a.length!=c.length})?!1:!r.some((a,l)=>{let c=i[l];return a.some((h,u)=>{let d=c[u];return!h.equals(d)})})}};function Ire(o,t,e){if(isNaN(t)||t<0)throw new Error("Circle error,radius is NaN");let r=new _e;return r.ext2(o).ext7(t+e/2),r.build1()}function iFe(o,t,e){if(!(o.component instanceof um))return!1;let i=!1,n=lEt(o);for(let s in n){let a=n[s];switch(s){case"circle":for(let l of a)if(i=M1(new S(t,e),l.center,l.radius),i)return!1;break;case"line":for(let l of a)if(i=Xa(new S(t,e),l.start,l.end,l.width),i)return!1;break}if(i)break}return i}function lEt(o){let t=o.component,e={},r=nFe(t),{innerRadius:i,stiffToCenterLength:n,stiffStrokeWidth:s}=r;if(e.circle=[{center:o.center,radius:i}],n>0&&s>0){e.line=[];let a=new S(o.center.x,o.center.y+n),l=new S(o.center.x,o.center.y-n);e.line.push({start:a,end:l,width:s});let c=new S(o.center.x-n,o.center.y),h=new S(o.center.x+n,o.center.y);e.line.push({start:c,end:h,width:s})}return e}function nFe(o){let{holeDiameter:t,counterboreProps:e,stiffenerProps:r}=o,i=t/2,n=i;e&&(n=e.diameter/2);let s=0,a=0;return r&&(s=Math.max(r.topWidth,r.bottomWidth)+i,a=r.stiffThickness),{innerRadius:i,outerRadius:n,stiffToCenterLength:s,stiffStrokeWidth:a}}function oFe(o){let t=o.component,e=o.radius+o.strokeWidth/2,r=new _e().ext2(o.center).ext7(e);if(t instanceof um&&t.stiffenerProps){let{stiffToCenterLength:i}=nFe(t),n=Math.max(0,i-e);r.ext7(n)}return r.build1()}var rFe=5e4;function qu(o,t,e=Qc){let r=sFe(t);if(r>0)return r;if(o>rFe)return rFe;if(o>=e)return o;switch(t){case"3D Shell - Outline":return new ft().conversion("mm","mil",1.5)/10;default:return 1}}function sFe(o){let t=x.getInstance().envFlag==="cnc-preview";switch(o){case"Slot Region":return t?5:.1;case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":return t?5:1;case"TearDrop":return t?5:.001;case"Copper Region":case"Fill Region":case"FPC Stiffener":case"Prohibited Region":case"Constraint Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return t?5:.02;default:return-1}}function n8(o,t,e){if(t==e)return o;let r=qu(o,t);return(e!="3D Shell - Outline"&&t=="3D Shell - Outline"||sFe(e)>0&&(t=="Board Outline"||t=="Line"))&&(r=qu(-1,t)),r}function pd(o){switch(o){case"Board Outline":case"Slot Region":case"Copper Region":case"Fill Region":case"Prohibited Region":case"Constraint Region":case"TearDrop":case"3D Shell - Outline":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":case"3D Shell - Screw Pillar":case"FPC Stiffener":return!0;default:return!1}}function xu(o,t=1e-8){if(o.length==1){let e=o[0];if(e instanceof q&&ne.greatereq(Math.abs(e.sweepAngle),359.9))return!0}else if(o.length==2){if(o[0]instanceof M&&o[1]instanceof M)return!1;{let e=o[0],r=o[o.length-1];if(e.start().distance1(r.end())<=t)return!0}}else if(o.length>2){let e=o[0],r=o[o.length-1];if(e.start().distance1(r.end())<=t)return!0}return!1}function aFe(o){if(o.length===0)return!1;if(o.length===1){if(o[0]instanceof q&&ne.greatereq(Math.abs(o[0].sweepAngle),359.9))return!0}else if(o.length===2){if(o[0]instanceof M&&o[1]instanceof M)return!1}else if(o.length>2&&o[0].start().distance1(o[o.length-1].end())<.01)return!0;return!1}var Po=class extends lr{constructor(){super(...arguments);this.modelType="Circle"}get primitive(){return q.build2(this.center,0,360,this.radius,this.radius,le.CW)}transform(e){this.center=this.center.multiply4(e),this.updateShapeData()}inShape(e,r,i){let n=this.strokeWidth;switch(n<.05&&i!=null&&(n=10/i.getScale()),this.type){case"Copper Region":case"Line":case"Board Outline":case"3D Shell - Outline":{let s=this.center.distance1(new S(e,r));return s<=this.radius+n/2&&s>=this.radius-n/2}case"3D Shell - Screw Pillar":{let s=this.center.distance1(new S(e,r))<=this.radius+n/2;return s||(s=iFe(this,e,r)),s}default:return this.center.distance1(new S(e,r))<=this.radius+this.strokeWidth/2}}isInside(e){return this.center.distance1(e)<=this.radius+this.strokeWidth/2}InnerArea(e,r){return this.center.distance1(new S(e,r))<=this.radius+this.strokeWidth/2}isSelectOnlyLine(e,r){let i=this.center.distance1(new S(e,r));return i<=this.radius+this.strokeWidth/2&&i>=this.radius-this.strokeWidth/2}updateBox(){return this.type==="3D Shell - Screw Pillar"?this._bbox=oFe(this):this._bbox=Ire(this.center,this.radius,this.strokeWidth),this._bbox}getMathGraphics(e=this.layerId,r=0){return this.isEmpty?null:this.layerId==e||this.layerId==12||11==this.layerId?fe.build2([q.build2(this.center,0,-360,this.radius+r,this.radius+r,le.CW)]):null}};var Cre=class{constructor(t,e,r,i,n,s){this.num=0;this.type=t,this.layerId=e,this.strokeWidth=i,this.net=r,this.silkColor=n,this.locked=s}};var i4=class i4 extends wi{static getInstance(){return i4.manager==null&&(i4.manager=new i4),i4.manager}getKey(t,e,r,i,n,s){return n==null?`${t}/${e}/${r}/${i}/${s}`:`${t}/${e}/${r}/${i}/${n.toRGBAString()}/${s}`}getComponent(t,e,r,i,n,s){i=qu(i,t);let a=this.getKey(t,e,r,i,n,s),l=this.map.get(a);return l==null&&(l=new Cre(t,e,r,i,n,s),this.map.set(a,l)),l.num++,l}setType(t,e){return e.num--,this.getComponent(t,e.layerId,e.net,e.strokeWidth,e.silkColor,e.locked)}setLayerId(t,e){return e.num--,this.getComponent(e.type,t,e.net,e.strokeWidth,e.silkColor,e.locked)}setNet(t,e){return e.num--,this.getComponent(e.type,e.layerId,t,e.strokeWidth,e.silkColor,e.locked)}setStrokeWidth(t,e){return e.num--,this.getComponent(e.type,e.layerId,e.net,t,e.silkColor,e.locked)}setSilkColor(t,e){return e.num--,this.getComponent(e.type,e.layerId,e.net,e.strokeWidth,t,e.locked)}setLocked(t,e){return e.num--,this.getComponent(e.type,e.layerId,e.net,e.strokeWidth,e.silkColor,t)}};i4.manager=null;var Sre=i4;var n4=Sre.getInstance(),eR=class{constructor(t,e,r,i,n,s,a){this.data=n4.getComponent(t,e,r,i,n,s),a!=null&&(this._component=a)}get type(){return this.data.type}set type(t){this.data.type!=t&&(this.data=n4.setType(t,this.data))}get layerId(){return this.data.layerId}set layerId(t){this.data.layerId!=t&&(this.data=n4.setLayerId(t,this.data))}get net(){return this.data.net}set net(t){this.data.net!=t&&(this.data=n4.setNet(t,this.data))}get locked(){return this.data.locked}set locked(t){this.data.locked!=t&&(this.data=n4.setLocked(t,this.data))}get strokeWidth(){return this.data.strokeWidth}set strokeWidth(t){t=qu(t,this.type),this.data.strokeWidth!=t&&(this.data=n4.setStrokeWidth(t,this.data))}get silkColor(){return this.data.silkColor||null}set silkColor(t){(this.data.silkColor!=null&&t!=null&&!this.data.silkColor.equals(t)||this.data.silkColor!=t)&&(this.data=n4.setSilkColor(t,this.data))}get component(){return this._component||void 0}set component(t){this._component!=t&&(t?this._component=t:delete this._component)}addCopper(t){this._copperIndexMap||(this._copperIndexMap=new Array),this._copperIndexMap.includes(t)||this._copperIndexMap.push(t)}deleteCopper(t){if(this._copperIndexMap!=null){let e=this._copperIndexMap.indexOf(t);e>=0&&this._copperIndexMap.splice(e,0)}}iteratorCopper(t){this._copperIndexMap&&this._copperIndexMap.forEach(e=>{t(e)})}clearCopperData(){delete this._copperIndexMap}};var $p=class o extends Po{constructor(e,r,i,n,s,a,l,c,h,u,d){super();this.modelType="Circle";this._globalIndex=e,this.base=new eR(r,i,c,a,h,l,u),this._center=n,this._radius=VS(s),this._bbox=d||Ire(n,s,a)}get center(){return this._center}set center(e){this._center.equals(e)||(this._center=e,this.updateShapeData())}get radius(){return this._radius}set radius(e){e=VS(e),this._radius!=e&&(this._radius=e,this.updateShapeData())}clone(){var i;this.refreshBBox&&this.updateBox();let e=(i=this.component)==null?void 0:i.clone(),r=new o(this.globalIndex,this.type,this.layerId,this._center,this._radius,this.strokeWidth,this.locked,this.showNet,this.silkColor,e,this._bbox);return r.number=this.number,r.zIndex=this.zIndex,r}get type(){return this.base.type}set type(e){this.base.type!=e&&(this.base.type=e,this.updateShapeData())}get layerId(){return this.base.layerId}set layerId(e){this.base.layerId!=e&&(this.watchLayerIdModify(this.base.layerId),this.base.layerId=e,this.layerModified=!0)}get net(){var e;return(e=this.base.net)==null?void 0:e.toUpperCase()}set net(e){this.base.net!=e&&(this.base.net=e,this.netModified=!0)}get showNet(){return this.base.net}get locked(){return this.base.locked}set locked(e){this.base.locked=e}get strokeWidth(){return this.base.strokeWidth}set strokeWidth(e){e=qu(e,this.type),this.base.strokeWidth!=e&&(this.base.strokeWidth=e,this.updateShapeData())}get silkColor(){return this.base.silkColor||null}set silkColor(e){this.base.silkColor=e}get component(){return this.base.component}set component(e){this.base.component!=e&&(this.base.component=e)}addCopper(e){this.base.addCopper(e)}deleteCopper(e){this.base.deleteCopper(e)}iteratorCopper(e){this.base.iteratorCopper(e)}clearCopperData(){this.base.clearCopperData()}};var o4=class o4 extends wi{static getInstance(){return o4.manager==null&&(o4.manager=new o4),o4.manager}addModel(t){this.map.set(t.globalIndex,t)}addCircle(t,e,r,i,n,s,a,l,c=null,h){return this._last=new $p(t,e,r,i,n,s,a,l,c,h,void 0),this.addModel(this._last),this._last}delete(t){t instanceof Po&&this.map.delete(t.globalIndex)}};o4.manager=null;var zi=o4;var lj=new Error,LCe=new class extends AA{decide1(t){return t[0]&&t[1]}}(2),cEt=new class extends NB{onPolylineGroup(t,e){throw lj}onSegment(t,e,r,i,n,s){throw lj}},MCe=class{constructor(t,e){this.rtree=t,this.level=e}setLevel(t){if(this.level!=t){let e=LCe.weight(t);for(let r of this.rtree.itemList)r.setWeight(e);this.level=t}}},zE=class o extends DE{static isIntersect(t,e,r=Gi.DUMMY){let i=new o(r),n=i.createGroup1(t.items),s=i.createGroup2(e.items);return n.rtree.itemList.length==0||s.rtree.itemList.length==0?!1:i.isIntersect(n,s)}constructor(t){super(new _x(!1),LCe.rule,t,cEt)}createGroup1(t){return this.createGroup(t,0)}createGroup2(t){return this.createGroup(t,1)}createGroup(t,e){let r=LCe.weight(e);for(let n of t)this.addPolyline(n,r);let i=this.buildRTree();return this.sides.length=0,new MCe(i,e)}isIntersect(t,e){if(t.level!==e.level){let r=t.rtree.bbox().intersection1(e.rtree.bbox());if(r!==null){try{this.inters(t,e);let i=(r.minY+r.maxY)/2;this.sweep(t,e,i)}catch(i){if(i===lj)return!0;throw i}return!1}else return!1}else throw new Error("inersection detection should not in same group")}inters(t,e){if(t.rtree.size()>e.rtree.size()){let r=t;t=e,e=r}for(let r of t.rtree.items()){r.trans=NaN;let i=r.bbox().extendOfSize(1e-5);for(let n of e.rtree.search(i))if(n.trans=NaN,Tt(r.shape,n.shape)>0)throw lj}}sweep(t,e,r){let i=new Array;this.fillValidSides(i,t.rtree.itemList,r),this.fillValidSides(i,e.rtree.itemList,r),xr(i,(s,a)=>s.getX(r)-a.getX(r),0,i.length);let n=new vx(this.rule,this,r);for(let s of i)s.setWeight(s.baseWeight);for(let s of i)n.onEp(s)}isIntersect1(t,e){if(t.level!==e.level){let r=t.rtree.bbox().intersection1(e.rtree.bbox());if(r!==null){try{let i=(r.minY+r.maxY)/2;this.sweep(t,e,i)}catch(i){if(i===lj)return!0;throw i}return!1}else return!1}else throw new Error("inersection detection should not in same group")}};var Kp=class o{constructor(t,e,r,i,n){this.text=t,this.group=e,this.pl=r,this.flag=i,this.order=n}clone(){let{text:t,group:e,pl:r,flag:i,order:n}=this;return new o(t,e,r.clone(),i,n)}};var pm=class{constructor(t,e,r,i=!1){this.pls=new Array;this.map=new Map;this.skip=i,this.text=t,this.groupId=e,r=this.sort(r),this.checkRelate(r)}getPolyline(t,e){let r=this.map.get(t);if(r!=null)return r.setLevel(e),r;{let i=new Array;for(let l of t.primitives)if(l instanceof Mr){let c=null;for(let h of l.points(.01))c!=null&&i.push(new M(c,h)),c=h}else i.push(l);let n=fe.build2(i),s=new zE(Gi.DUMMY),a=e==0?s.createGroup1([n]):s.createGroup2([n]);return this.map.set(t,a),a}}check(t,e){let r={inter:!1,outline:null,hole:null};if(!t.bbox().isInside(e.bbox().extendOfSize(1e-4))&&!e.bbox().isInside(t.bbox().extendOfSize(1e-4)))return r;let i=new zE(Gi.DUMMY),n=this.getPolyline(t,0),s=this.getPolyline(e,1);return n.rtree.itemList.length==0||s.rtree.itemList.length==0?r.inter=!1:r.inter=i.isIntersect1(n,s),r.inter&&(t.bbox().area()>e.bbox().area()?(r.outline=t,r.hole=e):(r.outline=e,r.hole=t)),r}sort(t){return t.sort((e,r)=>r.bbox().area()-e.bbox().area())}checkRelate(t){let e=new Set,r=new Set;for(;t.length>0;){let i=t.shift(),n=0;if(!e.has(i)&&!r.has(i)){e.add(i);let s=this.groupId++;this.pls.push(new Kp(this.text,s,i,!0,n)),this.dfs(t,0,e,r,i,n,s)}}return{outline:e,hole:r}}dfs(t,e,r,i,n,s,a){let l=s%2!=0;for(;e<t.length;e++){let c=t[e];if(!r.has(c)&&!i.has(c)){let h=this.check(n,c);if(h.inter)if(!l)i.add(h.hole),this.pls.push(new Kp(this.text,a,c,!1,s+1)),this.dfs(t,e+1,r,i,c,s+1,a);else{r.add(h.hole);let u=this.groupId++;this.pls.push(new Kp(this.text,u,c,!0,s+1)),this.dfs(t,e+1,r,i,c,s+1,u)}}}}};var Fs=class{constructor(t,e,r,i=!0){this.pl1=t,this.pl2=e,this.clearance=r;let{relation:n,distance:s,line:a,pt1:l,pt2:c}=this.getRelation();this.relation=n,this.distance=s,this.line=a,this.pt1=l,this.pt2=c,this.setDistZeroWhenContain=i}getRelation(){let t=3,e=Number.MAX_VALUE,r=null,i=null,n=null,s=new Mb(10),a=this.pl2.primitives.length>100;if(a)for(let c of this.pl2.primitives)s.add(c);let l=c=>a?s.search(c):this.pl2.primitives;for(let c of this.pl1.primitives){let h=c.bbox().extendOfSize(e);for(let u of l(h)){if(c instanceof M&&ne.eq(c.start().distance2(c.end()),0)||u instanceof M&&ne.eq(u.start().distance2(u.end()),0)||h.isSeparated(u.bbox()))continue;let d=new ir(c,u),p=d.getDistance(),m=d.getLine();if(ne.less(p,e)&&(e=p,r=m,i=c,n=u,h=c.bbox().extendOfSize(e)),ne.eq(e,0)){t=0;break}}if(ne.eq(e,0)){t=0;break}}return t!=0&&(i!=null&&this.isClose(this.pl2)&&this.pointInPolyline(i.start(),this.pl2)?(t=2,this.setDistZeroWhenContain&&(e=0)):n!=null&&this.isClose(this.pl1)&&this.pointInPolyline(n.start(),this.pl1)&&(t=1,this.setDistZeroWhenContain&&(e=0))),{relation:t,distance:e,line:r,pt1:i,pt2:n}}pointInPolyline(t,e){if(!e.bbox().isContains(t))return!1;let i=[];return e.points(.1,n=>{i.push(n)}),this.isSelect(t.x,t.y,i)}isSelect(t,e,r){let i=!1;for(let a=0,l=r.length-1;a<l;a++){let c=r[a],h=r[a+1];if(t==c.x&&e==c.y||t==h.x&&e==h.y)return!0;if(c.y<e&&h.y>=e||c.y>=e&&h.y<e){let u=c.x+(e-c.y)*(h.x-c.x)/(h.y-c.y);if(t==u)return!0;u>t&&(i=!i)}}let n=r[r.length-1],s=r[0];if(t==n.x&&e==n.y||t==s.x&&e==s.y)return!0;if(n.y<e&&s.y>=e||n.y>=e&&s.y<e){let a=n.x+(e-n.y)*(s.x-n.x)/(s.y-n.y);if(t==a)return!0;a>t&&(i=!i)}return i}isClose(t){return t.primitives.length>0&&t.primitives[0].start().distance2(t.primitives[t.primitives.length-1].end())<1e-8}};function ig(o,t){for(let e=0;e<o;e+=2){let r=new S(Ee[e],Ee[e+1]),i=!0;for(let n of t)n.distance2(r)<1e-8&&(i=!1);i&&t.push(r)}return t}function tR(o){let t=[];if(o=o.filter(r=>r.length),o.length)for(let r=0;r<o.length;r++){let i=o[r].slice(),n=o[r],s=o[r+1];for(;s&&n[n.length-1].end().equals1(s[0].start());)i.push(...s),r++,n=o[r],s=o[r+1];if(No(fe.build2(i)))return!0;t.push(i)}if(t.length>=2){for(let i of t)if(i.length>=2){let n=i[0],s=i[i.length-1];if(n.start().distance2(s.end())<1e-8)return!0}let r=t.length;for(let i=0;i<r;i++)for(let n=i+1;n<r;n++)if(e(i,n))return!0}return!1;function e(r,i){let n=t[r],s=t[i];for(let a=0;a<n.length;a++)for(let l=0;l<s.length;l++){let c=n[a],h=s[l],u=Tt(c,h),d=ig(u,[]);if(u>0)if(r==0&&i==t.length-1&&a==0&&l==s.length-1){if(!(u==2&&d.length==1&&c.start().distance2(h.end())<1e-8))return!0}else return!0}return!1}}function o8(o,t){let e=[],r=[],i=t[0].start(),n=o.length-1;for(let l=0;l<t.length;l++){let c=t[l],h=s(c,n);h&&(r.push(l),n=n-h+1)}return{coincideLines:e,coincidePoint:i,drawCoincideLines:r};function s(l,c){let h=0;for(;c>=0&&l;){let u=!0,d=o[c],p=Tt(d,l);if(p>=2){let m=ig(p,[]);c==0&&r.length==1&&m.length==1&&d.start().distance2(l.end())<1e-8||(u=m.some(g=>g.distance2(i)<1e-8||g.distance2(d.end())<1e-8))}if(p>=4&&!a(d,l)&&(u=!1),p>=4&&l instanceof q&&d instanceof q&&(Math.abs(l.rx-d.rx)>1e-8||l.center.distance1(d.center)>1e-8)&&(u=!1),u){let m=ig(p,[d.end()]);p>=4&&m.length>=2&&(i=m[1],(!e.length||e[e.length-1]!=c)&&(e.push(c),h++))}else return 0;c--}return h}function a(l,c){return l instanceof M&&c instanceof M||l instanceof q&&c instanceof q}}function No(o){if(o instanceof fe)return lFe(o);let t=o.items;if(t.length>=2)for(let r=0;r<t.length-1;r++)for(let i=r+1;i<t.length;i++){let n=t[r],s=t[i];if(n.bbox().intersection1(s.bbox())&&new Fs(n,s,0).relation==0)return!0}return!!t.some(r=>lFe(r))}function lFe(o){let t=new Array;o.primitives.forEach(r=>{r instanceof M&&r.length()<.01||t.push(r)});let e=t.length;if(e==2){let r=t[0],i=t[1];if(r instanceof M&&i instanceof M&&r.end().equals1(i.start())&&i.end().equals1(r.start()))return!0;let n=Tt(t[0],t[1]);for(let s=0;s<n;s+=2){let a=new S(Ee[s],Ee[s+1]);if(!(a.distance2(t[0].start())<1e-8||a.distance2(t[0].end())<1e-8)){if(!(a.distance2(t[1].start())<1e-8||a.distance2(t[1].end())<1e-8))return!0}}}else if(e>2)for(let r=0;r<e;r++){let i=t[r];if(r+1<e){let n=t[r+1],s=[i.end()],a=Tt(i,n);if(s=ig(a,s),s.length>1)return!0}for(let n=r+2;n<e;n++){let s=t[n],a=Tt(i,s);if(r==0&&n==e-1){for(let l=0;l<a;l+=2)if(new S(Ee[l],Ee[l+1]).distance1(i.start())>=1e-4)return!0}else if(a>0)return!0}}return!1}function YI(o,t){return fv(o)}var Li=class extends ki{constructor(){super(...arguments);this.modelType="Text"}get outlineModified(){return this.hasDataState(7)}set outlineModified(e){this.setDataState(7,e)}equals(e){let r=this.silkColor==e.silkColor||this.silkColor!=null&&e.silkColor!=null&&this.silkColor.equals(e.silkColor);return this.layerId==e.layerId&&this.type==e.type&&this.value==e.value&&this.showValue==e.showValue&&this.fontFamily==e.fontFamily&&this.fontSize==e.fontSize&&this.rotation==e.rotation&&this.origin==e.origin&&this.strokeWidth==e.strokeWidth&&this.reverse==e.reverse&&this.reverseExpansion==e.reverseExpansion&&this.mirror==e.mirror&&r&&this.position.equals(e.position)}};function Ere(o){let t=o.outline.map(r=>{let i=new Array;for(let n of r.primitives)if(n instanceof Mr){let s=n.points(.1),a=fe.build4(s);Re.addAll(i,a.primitives)}else i.push(n);return fe.build2(i)});return t=hEt(t),new pm("",0,t).pls}function hEt(o){let t=[];return o.forEach(e=>{if(No(e)){let i=YI(e);for(let n of i)t.push(n)}else t.push(e)}),t}var rR=class extends ki{get matrix(){let t=xc(this.layerId,this.mirror);return Ae.rotateZ(this.rotation).scale(t?-1:1,1,1).translate1(this.start.x,this.start.y,0)}};var ql=class extends rR{constructor(){super(...arguments);this.modelType="Image"}get templateModified(){return this.hasDataState(7)}set templateModified(e){this.setDataState(7,e)}getPath(){let e=this.getViewMatrix(),r=this.getTemplatePath();return r.forEach(i=>{i.pl=i.pl.multiply3(e.toMatrix3())}),r}getPathByTemplatePath(e){let r=this.getViewMatrix(),i=e;return i=i.map(n=>n.clone()),i.forEach(n=>{n.pl=n.pl.multiply3(r.toMatrix3())}),i}};var Ore=class{static rectToPolygon(t){if(t[0]=="R"){let e=new S(t[1],t[2]),r=t[3],i=t[4],n=new S(e.x+r,e.y),s=new S(e.x+r,e.y-i),a=new S(e.x,e.y-i);return[e.x,e.y,"L",n.x,n.y,s.x,s.y,a.x,a.y,e.x,e.y]}else return t}};var WS=class WS{static BaseBoxModel(t=!0){return WS._modify?(t&&(WS._modify=!1),!0):!1}constructor(t,e,r,i,n,s,a){if(this._layerId=t,this._leftLow=e,this._leftUp=r,this._rightLow=i,this._rightUp=n,this._locked=s,a==null){let l=wA.getCache().boxCache;l[0]=Math.min(e.x,r.x,i.x,n.x),l[1]=Math.max(e.x,r.x,i.x,n.x),l[2]=Math.min(e.y,r.y,i.y,n.y),l[3]=Math.max(e.y,r.y,i.y,n.y),a=new ut(l[0],l[1],l[2],l[3])}this._bbox=a}isFlipX(){return this._rightLow.sub(this._leftLow).cross(this.rightUp.sub(this._rightLow))<0}get layerId(){return this._layerId}set layerId(t){this._layerId!=t&&(this._layerId=t)}get leftLow(){return this._leftLow}set leftLow(t){this._leftLow.equals(t)||(this._leftLow=t,WS._modify=!0)}get leftUp(){return this._leftUp}set leftUp(t){this._leftUp.equals(t)||(this._leftUp=t,WS._modify=!0)}get rightLow(){return this._rightLow}set rightLow(t){this._rightLow.equals(t)||(this._rightLow=t,WS._modify=!0)}get rightUp(){return this._rightUp}set rightUp(t){this._rightUp.equals(t)||(this._rightUp=t,WS._modify=!0)}get bbox(){return this._bbox}set bbox(t){this._bbox=t}get center(){return this.leftLow.add(this.rightUp).mul(.5)}set center(t){let e=this.center;this.leftLow=this.leftLow.sub(e).add(t),this.leftUp=this.leftUp.sub(e).add(t),this.rightLow=this.rightLow.sub(e).add(t),this.rightUp=this.rightUp.sub(e).add(t)}get width(){return this.leftLow.distance1(this.rightLow)}get height(){return this.leftLow.distance1(this.leftUp)}get rotation(){return this.rightLow.sub(this.leftLow).normalize().angle(S.ORIGIN)}get primitives(){let t=new M(this.leftLow,this.rightLow),e=new M(this.rightLow,this.rightUp),r=new M(this.rightUp,this.leftUp),i=new M(this.leftUp,this.leftLow);return[t,e,r,i]}get locked(){return this._locked}set locked(t){this._locked=t}extendOfSize(t){let e=this.rightLow.sub(this.leftLow).normalize().mul(t),r=this.leftUp.sub(this.leftLow).normalize().mul(t);return this.leftLow=this.leftLow.sub(e).sub(r),this.leftUp=this.leftUp.sub(e).add(r),this.rightLow=this.rightLow.add(e).sub(r),this.rightUp=this.rightUp.add(e).add(r),this}isIntersection(t){if(this.isContainBox(t)||t.isContainBox(this))return!0;for(let e of t.primitives)for(let r of this.primitives)if(e.bbox().isIntersect(r.bbox())&&Tt(e,r)>0)return!0;return!1}isContainBox(t){let e=this.rightLow.sub(this.leftLow).normalize(),r=Math.atan2(e.y,e.x);if(ne.eq(r,0)){let m=new _e().ext2(this.leftLow).ext2(this.rightLow).ext2(this.rightUp).ext2(this.leftUp).build1();return!!(m.isContains(t.leftLow)||m.isContains(t.rightLow)||m.isContains(t.rightUp)||m.isContains(t.leftUp))}let i=Ae.translate(-this.leftLow.x,-this.leftLow.y,0).rotateZ(-r).translate1(this.leftLow.x,this.leftLow.y,0),n=this.leftLow.multiply4(i),s=this.rightLow.multiply4(i),a=this.rightUp.multiply4(i),l=this.leftUp.multiply4(i),c=new _e().ext2(n).ext2(s).ext2(a).ext2(l).build1(),h=t.leftLow.multiply4(i);if(c.isContains(h))return!0;let u=t.rightLow.multiply4(i);if(c.isContains(u))return!0;let d=t.rightUp.multiply4(i);if(c.isContains(d))return!0;let p=t.leftUp.multiply4(i);return!!c.isContains(p)}transform(t){this.leftLow=this.leftLow.multiply4(t),this.leftUp=this.leftUp.multiply4(t),this.rightLow=this.rightLow.multiply4(t),this.rightUp=this.rightUp.multiply4(t),this.updateBox()}inShape(t,e,r){if(this.width==0&&this.height==0)return!1;let i=this.leftLow.sub(this.leftUp).normalize(),n=this.rightUp.sub(this.rightLow).normalize(),s=this.rightLow.sub(this.leftLow).normalize(),a=this.leftUp.sub(this.rightUp).normalize(),l=new S(t,e),c=l.sub(this.leftUp).normalize(),h=l.sub(this.leftLow).normalize(),u=l.sub(this.rightLow).normalize(),d=l.sub(this.rightUp).normalize();return i.cross(c)*n.cross(u)>=0&&s.cross(h)*a.cross(d)>=0}updateBox(){let t=ut.extend3(this.leftLow,this.leftUp),e=ut.extend3(this.rightLow,this.rightUp);return this.bbox=ut.extend2(t,e),this.bbox}getMathGraphics(t=this.layerId,e=0){if(this.layerId==t){let r=this.rightLow.sub(this.leftLow).normalize().mul(e),i=this.leftUp.sub(this.leftLow).normalize().mul(e),n=this.leftLow.sub(r).sub(i),s=this.leftUp.sub(r).add(i),a=this.rightLow.add(r).sub(i),l=this.rightUp.add(r).add(i),c=new Array,h=new M(n,s),u=new M(s,l),d=new M(l,a),p=new M(a,n);return c.push(h),c.push(u),c.push(d),c.push(p),fe.build2(c)}return null}clone(){return new WS(this._layerId,this._leftLow,this._leftUp,this._rightLow,this._rightUp,this._locked,this._bbox)}};WS.Blength=15,WS._modify=!1;var vs=WS;var s8=class{constructor(t,e,r,i,n,s,a,l,c,h,u,d){this.num=0;this.type=t,this.origin=s,this.strokeWidth=a,this.mirror=h,this.showKey=e,this.showValue=r,this.fontFamily=i,this.fontSize=n,this.reverse=l,this.reverseExpansion=c,this.positionIsNull=u,this.silkColor=d}};var gFe=nd(cj());var Hy=class extends s8{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p,m){super(r,i,n,s,a,l,c,h,u,d,p,m),this._layerId=t,this._locked=e}get layerId(){return this._layerId}set layerId(t){this._layerId!=t&&(this._layerId=t)}get locked(){return this._locked}set locked(t){this._locked=t}};var s4=class s4 extends wi{constructor(){super(...arguments);this.uuidMap={}}static getInstance(){return s4.mgr==null&&(s4.mgr=new s4),s4.mgr}getId(e){let r=this.uuidMap[e];return r==null&&(r=(0,gFe.default)(e),this.uuidMap[e]=r),r}get(e,r,i,n,s,a,l,c,h,u,d,p){let m=this.getId(`${e}/${r}/${i}/${n}/${s}/${a}/${l}/${c}/${h}/${u}/${d}/${p}/`),g=this.map.get(m);return g==null&&(g=new s8(e,r,i,n,s,a,l,c,h,u,d,p),this.map.set(m,g)),g.num++,g}getSpace(e,r,i,n,s,a,l,c,h,u,d,p,m,g){let y=this.getId(`${e}/${r}/${i}/${n}/${s}/${a}/${l}/${c}/${h}/${u}/${d}/${p}/${m}/${g}/`),b=this.map.get(y);return b==null&&(b=new Hy(e,r,i,n,s,a,l,c,h,u,d,p,m,g),this.map.set(y,b)),b.num++,b}setType(e,r){return r.num--,r instanceof Hy?this.getSpace(r.layerId,r.locked,e,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(e,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setShowKey(e,r){return r.num--,r instanceof Hy?this.getSpace(r.layerId,r.locked,r.type,e,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,e,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setShowValue(e,r){return r.num--,r instanceof Hy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,e,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,e,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setFontFamily(e,r){return r.num--,r instanceof Hy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,e,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,e,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setFontSize(e,r){return r.num--,r instanceof Hy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,e,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,e,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setOrigin(e,r){return r.num--,r instanceof Hy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,e,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,e,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setStrokeWidth(e,r){return r.num--,r instanceof Hy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,e,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,e,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setReverse(e,r){return r.num--,r instanceof Hy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,e,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,e,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setReverseExpansion(e,r){return r.num--,r instanceof Hy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,e,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,e,r.mirror,r.positionIsNull,r.silkColor)}setMirror(e,r){return r.num--,r instanceof Hy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,e,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,e,r.positionIsNull,r.silkColor)}setPositionIsNull(e,r){return r.num--,r instanceof Hy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,e,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,e,r.silkColor)}setSilkColor(e,r){return r.num--,r instanceof Hy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,e):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,e)}setLayerIdLocked(e,r,i){return i.num--,this.getSpace(e,r,i.type,i.showKey,i.showValue,i.fontFamily,i.fontSize,i.origin,i.strokeWidth,i.reverse,i.reverseExpansion,i.mirror,i.positionIsNull,i.silkColor)}toBase(e){return e.num--,this.get(e.type,e.showKey,e.showValue,e.fontFamily,e.fontSize,e.origin,e.strokeWidth,e.reverse,e.reverseExpansion,e.mirror,e.positionIsNull,e.silkColor)}};s4.mgr=null;var tf=s4;var yFe=nd(cj());var Are=class{constructor(t,e,r,i,n,s){this.fontFamily=t;this.fontSize=e;this.reverse=r;this.expansion=i;this.bold=n;this.italic=s;this.num=0}};var a4=class a4 extends wi{constructor(){super(...arguments);this.uuidMap={}}static getInstance(){return a4.mgr==null&&(a4.mgr=new a4),a4.mgr}getId(e){let r=this.uuidMap[e];return r==null&&(r=(0,yFe.default)(e),this.uuidMap[e]=r),r}get(e,r,i,n,s,a){let l=this.getId(`${e}/${r}/${i}/${n}/${s}/${a}/`),c=this.map.get(l);return c==null&&(c=new Are(e,r,i,n,s,a),this.map.set(l,c)),c.num++,c}setFontFamily(e,r){if(r.num--,r.num==0){let i=this.getId(`${r.fontFamily}/${r.fontSize}/${r.reverse}/${r.expansion}/${r.bold}/${r.italic}/`);this.map.delete(i)}return this.get(e,r.fontSize,r.reverse,r.expansion,r.bold,r.italic)}setFontSize(e,r){if(r.num--,r.num==0){let i=this.getId(`${r.fontFamily}/${r.fontSize}/${r.reverse}/${r.expansion}/${r.bold}/${r.italic}/`);this.map.delete(i)}return this.get(r.fontFamily,e,r.reverse,r.expansion,r.bold,r.italic)}setReverse(e,r){if(r.num--,r.num==0){let i=this.getId(`${r.fontFamily}/${r.fontSize}/${r.reverse}/${r.expansion}/${r.bold}/${r.italic}/`);this.map.delete(i)}return this.get(r.fontFamily,r.fontSize,e,r.expansion,r.bold,r.italic)}setExpansion(e,r){if(r.num--,r.num==0){let i=this.getId(`${r.fontFamily}/${r.fontSize}/${r.reverse}/${r.expansion}/${r.bold}/${r.italic}/`);this.map.delete(i)}return this.get(r.fontFamily,r.fontSize,r.reverse,e,r.bold,r.italic)}setBold(e,r){if(r.num--,r.num==0){let i=this.getId(`${r.fontFamily}/${r.fontSize}/${r.reverse}/${r.expansion}/${r.bold}/${r.italic}/`);this.map.delete(i)}return this.get(r.fontFamily,r.fontSize,r.reverse,r.expansion,e,r.italic)}setItalic(e,r){if(r.num--,r.num==0){let i=this.getId(`${r.fontFamily}/${r.fontSize}/${r.reverse}/${r.expansion}/${r.bold}/${r.italic}/`);this.map.delete(i)}return this.get(r.fontFamily,r.fontSize,r.reverse,r.expansion,r.bold,e)}};a4.mgr=null;var a8=a4;var l8=a8.getInstance(),_re=class{constructor(t,e,r){this.width=NaN;this.height=NaN;this.id=t,this.polylines=e,this.base=r}hasOutline(){return this.polylines?this.polylines.length>0:!1}get outline(){return ef(this.polylines)}get fontFamily(){return this.base.fontFamily}set fontFamily(t){t!=this.base.fontFamily&&(this.base=l8.setFontFamily(t,this.base))}get fontSize(){return this.base.fontSize}set fontSize(t){t!=this.base.fontSize&&(this.base=l8.setFontSize(t,this.base))}get reverse(){return this.base.reverse}set reverse(t){t!=this.base.reverse&&(this.base=l8.setReverse(t,this.base))}get expansion(){return this.base.expansion}set expansion(t){t!=this.base.expansion&&(this.base=l8.setExpansion(t,this.base))}get bold(){return this.base.bold}set bold(t){t!=this.base.bold&&(this.base=l8.setBold(t,this.base))}get italic(){return this.base.italic}set italic(t){t!=this.base.italic&&(this.base=l8.setItalic(t,this.base))}sycnOldFontParam(t){this.text=t.text,this.fontFamily=t.fontFamily,this.fontSize=t.fontSize,this.reverse=t.reverse,this.expansion=t.expansion}toString(){var e;return this.fontFamily+":"+this.text+":"+this.fontSize+":"+this.reverse.toString()+":"+this.expansion+":"+this.bold.toString()+":"+this.italic.toString()+":"+this.width.toString()+":"+this.height.toString()+":"+((e=this.polylines)==null?void 0:e.length.toString())}toJSON(){return{id:this.id,fontFamily:this.fontFamily,text:this.text,fontSize:this.fontSize,reverse:this.reverse,expansion:this.expansion,bold:this.bold,italic:this.italic,width:this.width,height:this.height,outline:this.outline}}};var pEt=0,l4=class l4 extends wi{static getInstance(){return l4.manager==null&&(l4.manager=new l4),l4.manager}getFontCache(t,e,r,i,n,s=!1,a=!1){if(e!=""){for(let[,l]of this.map)if(this.isEqual(t,e,r,i,n,s,a,l))return l}}addFontCache(t,e,r,i,n,s,a,l,c=!1,h=!1){let u="FONT"+pEt++,d=a8.getInstance().get(t,r,i,n,c,h),p=new _re(u,l,d);return this.map.delete(u),this.map.set(u,p),p.fontFamily=t,p.text=e,p.fontSize=r,p.reverse=i,p.expansion=n,p.width=s,p.height=a,p.bold=c,p.italic=h,fm.ins.updateFontCache(p),p}isEqual(t,e,r,i,n,s=!1,a=!1,l){return!!(t==l.fontFamily&&e==l.text&&ne.eq(r,l.fontSize)&&i==l.reverse&&(i&&ne.eq(n,l.expansion)||!i)&&s==l.bold&&a==l.italic&&l.hasOutline())}getAllItem(){let t=[],e={},r=mo.getInstance();for(let[i]of this.map){let n=r.getItem(i),s=this.map.get(i),a=s.toString();n!=null&&s.text!=""&&s.hasOutline()&&e[a]==null&&(t.push(s),e[a]=s)}return t}getFontTemplate(t){return this.map.get(t)}copy(t,e){if(t!=null){let{id:r,fontFamily:i,text:n,fontSize:s,reverse:a,expansion:l,bold:c,italic:h,width:u,height:d,outline:p}=t;this.getFontCache(i,n,s,a,l,c,h)==null&&this.addFontCache(i,n,s,a,l,u,d,vu(p),c,h)}}clear(){this.map.clear()}};l4.manager=null;var Wy=l4;function MA(o,t,e,r,i,n,s,a=!1,l=!1){if(t=="default")return Gd(e,r,s);if(["default2","Serif","Sans Serif"].includes(t))return F8e(t,e,r,s);let c=Wy.getInstance(),h=c.getFontTemplate(o);if(h!=null&&c.isEqual(t,e,r,i,n,a,l,h)||(h=c.getFontCache(t,e,r,i,n,a,l)),h!=null){if(isNaN(h.width)||isNaN(h.height)){let u=new _e;for(let d of h.polylines)u.ext1(d.bbox());if(u.valid()){let d=u.build1();h.width=d.width(),h.height=d.height()}else h.width=0,h.height=0}return{width:h.width,height:h.height,path:h.polylines}}else return null}var vre=class vre{constructor(){this.footprints=new Map}add(t){for(let e of t.getItems())e instanceof Li&&fm.ins.has(e)&&this.footprints.set(e,t)}updateFontCache(t){let e=this.footprints.get(t);e!=null&&e.refershBBox()}};vre.ins=new vre;var c8=vre;var xre=class xre{constructor(){this.texts=new Set}addFont(t){this.queryFont(t)||this.texts.add(t)}updateFont(t){this.queryFont(t)||this.texts.add(t)}deleteFont(t){this.texts.delete(t)}has(t){return this.texts.has(t)}queryFont(t){let e=t.getText();if(e==""||e==null)return t.outline=[],t.updateBox4(0,0),!0;let r=t.fontFamily,i=r==""||["","default","default2","Serif","Sans Serif"].includes(r);i&&!Vy.everyCharHasDefaultFontPath(e)&&(t.fontFamily="\u9ED1\u4F53",i=!1),i?t.type=0:t.type=1;let n=MA(t.globalIndex,t.fontFamily,e,t.fontSize,t.reverse,t.reverseExpansion,t.strokeWidth);return n&&n.path?(t.outline=n.path,t.updateBox4(n.width,n.height),!0):!1}updateFontCache(t){let e=Wy.getInstance(),r=!1,i=!1,n=Array.from(this.texts);for(let s of n){let a=s.getText();s.reverseExpansion;let{fontFamily:l,fontSize:c,reverse:h,reverseExpansion:u}=s;e.isEqual(l,a,c,h,u,r,i,t)&&(s.outline=t.polylines,s.updateBox4(t.width,t.height),this.texts.delete(s),c8.ins.updateFontCache(s))}}};xre.ins=new xre;var fm=xre;var Ed=class o extends Li{constructor(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R){super();this._matrixChange=!1;if(this._globalIndex=e,this._position=d,this._rotation=u,this._key=n,this._value=a,this._outline=T,s||l){this.base=tf.getInstance().get(i,s,l,c,h,p,m,g,y,b,P,O);let v=xc(r,b),D=UE(p),w=new S(D.x*I,D.y*C),F=Ae.getMatrix4(w,u,v?-1:1,d),H=S.ORIGIN.multiply4(F),z=new S(0,C).multiply4(F),G=new S(I,0).multiply4(F),W=new S(I,C).multiply4(F);R||(R=new vs(r,H,z,G,W,E,_)),this._box=R}else this.base=tf.getInstance().getSpace(r,E,i,s,l,c,h,p,m,g,y,b,P,O);fm.ins.addFont(this),jo("data/model/TextModel")}get positionIsNull(){return this.base.positionIsNull}set positionIsNull(e){this.base.positionIsNull!=e&&(this.base=tf.getInstance().setPositionIsNull(e,this.base))}get show(){return this.showKey||this.showValue}get box(){if(!this.show||this._box==null){let{layerId:e,locked:r}=this.base;return new vs(e,this._position,this._position,this._position,this._position,r)}return this.reset4Matrix(),this._box}set box(e){this.show?this._box=e:this.base=tf.getInstance().setLayerIdLocked(e.layerId,e.locked,this.base),this._matrixChange=!1}get bbox(){return!this.show||this._box==null?this._position.bbox():this._box.bbox}get matrix(){let e=xc(this.layerId,this.mirror),r=UE(this.origin),i=new S(r.x*this.width,r.y*this.height),n=this.rotation;return Ae.getMatrix4(i,n,e?-1:1,this.position)}get layerId(){var e;return((e=this._box)==null?void 0:e.layerId)||this.base.layerId}set layerId(e){this.layerId!=e&&(this.watchLayerIdModify(this.layerId),!this.show||this._box==null?this.base=tf.getInstance().setLayerIdLocked(e,this.base.locked,this.base):this._box.layerId=e,this._matrixChange=!0,this.updateShapeData(),this.layerModified=!0)}get type(){return this.base.type}set type(e){this.base.type!=e&&(this.base=tf.getInstance().setType(e,this.base),this.updateShapeData())}get position(){return this._position}set position(e){this._position.equals(e)||(this._position=e,this.updateShapeData(),this._matrixChange=!0)}get rotation(){return this._rotation}set rotation(e){Math.abs(this.rotation-e)<1e-8||this._rotation!=e&&(this._rotation=e,this._matrixChange=!0,this.updateShapeData())}get origin(){return this.base.origin}set origin(e){this.base.origin!=e&&(this.base=tf.getInstance().setOrigin(e,this.base),this._matrixChange=!0,this.updateShapeData())}get strokeWidth(){return this.base.strokeWidth}set strokeWidth(e){e<=0&&(e=Qc),this.base.strokeWidth!=e&&(this.base=tf.getInstance().setStrokeWidth(e,this.base),this.updateShapeData(),fm.ins.updateFont(this))}get mirror(){return this.base.mirror}set mirror(e){this.base.mirror!=e&&(this.base=tf.getInstance().setMirror(e,this.base),this._matrixChange=!0,this.updateShapeData())}get width(){return!this.show||this._box==null?0:this._box.width}get height(){return!this.show||this._box==null?0:this._box.height}get locked(){return this._box!=null?this._box.locked:this.base.locked}set locked(e){!this.show||this._box==null?this.base=tf.getInstance().setLayerIdLocked(this.base.layerId,e,this.base):this._box.locked=e}get outline(){return this._outline}set outline(e){this._outline!=e&&(this._outline=e,this.outlineModified=!0)}updateShow(){if(this._box==null&&this.show){let{layerId:e,locked:r}=this.base,i=xc(e,this.base.mirror),n=UE(this.base.origin),s=new S(n.x*0,n.y*0),a=Ae.getMatrix4(s,this._rotation,i?-1:1,this._position),l=S.ORIGIN.multiply4(a),c=new S(0,0).multiply4(a),h=new S(0,0).multiply4(a),u=new S(0,0).multiply4(a);this._box=new vs(e,l,c,h,u,r),this.base=tf.getInstance().toBase(this.base)}else!this.show&&this._box!=null&&(this.base=tf.getInstance().setLayerIdLocked(this._box.layerId,this._box.locked,this.base),this._box=void 0)}get key(){return this._key}set key(e){this._key!=e&&(this._key=e,fm.ins.updateFont(this))}get showKey(){return this.base.showKey}set showKey(e){this.base.showKey!=e&&(this.base=tf.getInstance().setShowKey(e,this.base),this.updateShow(),fm.ins.updateFont(this))}get value(){return this._value}set value(e){this._value!=e&&(this._value=e,fm.ins.updateFont(this))}get showValue(){return this.base.showValue}set showValue(e){this.base.showValue!=e&&(this.base=tf.getInstance().setShowValue(e,this.base),this.updateShow(),fm.ins.updateFont(this))}get fontFamily(){return this.base.fontFamily}set fontFamily(e){this.base.fontFamily!=e&&(this.base=tf.getInstance().setFontFamily(e,this.base),fm.ins.updateFont(this))}get fontSize(){return this.base.fontSize}set fontSize(e){this.base.fontSize!=e&&(this.base=tf.getInstance().setFontSize(e,this.base),fm.ins.updateFont(this))}get reverse(){return this.base.reverse}set reverse(e){this.base.reverse!=e&&(this.base=tf.getInstance().setReverse(e,this.base),fm.ins.updateFont(this))}get reverseExpansion(){return this.base.reverseExpansion}set reverseExpansion(e){this.base.reverseExpansion!=e&&(this.base=tf.getInstance().setReverseExpansion(e,this.base),fm.ins.updateFont(this))}get silkColor(){return this.base.silkColor}set silkColor(e){this.silkColor!=e&&(this.base=tf.getInstance().setSilkColor(e,this.base))}set matrixChange(e){this._matrixChange!=e&&(this._matrixChange=e)}get matrixChange(){return this._matrixChange}reset4Matrix(){this._matrixChange&&(this.reset4(this.width,this.height,this.matrix),this._matrixChange=!1)}getMatrix(e=this.width,r=this.height){let i=xc(this.layerId,this.mirror),n=UE(this.origin),s=new S(n.x*e,n.y*r),a=this.rotation;return Ae.getMatrix4(s,a,i?-1:1,this.position)}updateBox4(e,r){let i=this.getMatrix(e,r);this.reset4(e,r,i),this._matrixChange=!1}transform(e,r){if(!r){let n=new S(e.data[0],e.data[1]).normalize(),s=Math.atan2(n.y,n.x);xc(this.layerId,this.mirror)?this.rotation=this.rotation-s:this.rotation=this.rotation+s}let i=this.position.multiply4(e);this.position=i,this._matrixChange=!0}inShape(e,r,i){return!this.show||this._box==null?!1:(this.reset4Matrix(),this._box.inShape(e,r,i))}reset4(e,r,i){if(!this.show||this._box==null)return;this._box==null&&this.updateShow();let n=new S(i.data[12],i.data[13]);this._box.leftLow=n,e==0&&r==0?(this._box.leftUp=n,this._box.rightLow=n,this._box.rightUp=n):(this._box.leftUp=new S(0,r).multiply4(i),this._box.rightLow=new S(e,0).multiply4(i),this._box.rightUp=new S(e,r).multiply4(i)),this.updateShapeData()}updateBox(){return!this.show||this._box==null?this._position.bbox():(this.reset4Matrix(),this._box.updateBox())}getMathGraphics(e=this.layerId,r=0){return this.reset4Matrix(),this.isEmpty?null:this.box.getMathGraphics(e,r)}clone(){var i;this.refreshBBox&&this.updateBox(),this.reset4Matrix();let e=new Array;for(let n of this.outline)e.push(n.clone());let r=new o(this._globalIndex,this.layerId,this.base.type,this._key,this.base.showKey,this._value,this.base.showValue,this.base.fontFamily,this.base.fontSize,this._rotation,this._position,this.base.origin,this.base.strokeWidth,this.base.reverse,this.base.reverseExpansion,this.base.mirror,this.base.positionIsNull,e,this.width,this.height,this.locked,this.silkColor,(i=this._box)==null?void 0:i.bbox);return r.number=this.number,r.zIndex=this.zIndex,r}remove(){fm.ins.deleteFont(this),super.remove()}getRealOutline(){let e=this.matrix,r=this.outline;if(this.type==1){let i=Ere(this);return i.forEach(n=>{n.pl=n.pl.multiply3(e.toMatrix3())}),i}else return r.map(i=>i.multiply3(e.toMatrix3()))}getTextOutline(){let e=this.matrix,r=this.outline;return this.type==1?(r=r.map(i=>i.multiply3(e.toMatrix3())),r):r.map(i=>i.multiply3(e.toMatrix3()))}getText(){let e="",r=this.key,i=this.value,n=this.showKey,s=this.showValue;return r!=""&&i===""&&x.getInstance().doctype!=3&&this.getParent()==null&&r!="Footprint"&&!x.getInstance().footprintIsConnectDevice&&(i=`<${r}>`),n?s?e=r+":"+i:e=r:s?e=i:e="",e}buildBBox(){return this.isEmpty?null:(this.refreshBBox&&(this.updateBox(),this.refreshBBox=!1),this.bbox)}},YE=class o extends Ed{constructor(){super(...arguments);this._parent=void 0}clone(){var i;this.refreshBBox&&this.updateBox(),this.reset4Matrix();let e=new Array;for(let n of this.outline)e.push(n.clone());let r=new o(this._globalIndex,this.layerId,this.base.type,this._key,this.base.showKey,this._value,this.base.showValue,this.base.fontFamily,this.base.fontSize,this._rotation,this._position,this.base.origin,this.base.strokeWidth,this.base.reverse,this.base.reverseExpansion,this.base.mirror,this.base.positionIsNull,e,this.width,this.height,this.locked,this.silkColor,(i=this._box)==null?void 0:i.bbox);return r.number=this.number,r.zIndex=this.zIndex,r}};var c4=class c4 extends wi{static getInstance(){return c4.manager==null&&(c4.manager=new c4),c4.manager}addModel(t){this.map.set(t.globalIndex,t)}addText(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y=!1,b=!1,P=0,T){return r!=""?this._last=new YE(t,e,P,r,i,n,s,a,l,c,u,d,p,m,g,y,b,[],0,0,h,T):this._last=new Ed(t,e,P,r,i,n,s,a,l,c,u,d,p,m,g,y,b,[],0,0,h,T),this.addModel(this._last),this._last}delete(t){t instanceof Li&&this.map.delete(t.globalIndex)}deleteById(t){this.map.delete(t)}};c4.manager=null;var mo=c4;var jE=class{constructor(t,e,r,i,n=!0){this.layers=new Array;this.items=new Array;this.attrsMap={};this.attributes=new Map;this.textOffset=S.ORIGIN;this.ids=new Set;this.resultNeedToBeCached=!0;this.componentId=r,this._footprintUUID=t,this._deviceUUID=e,this.resultNeedToBeCached=n,this._bbox=i}clear(){this.layers.length=0,this.items.length=0,this.attrsMap=null,this.attributes.clear(),this.ids.clear(),this.layers=null,this.items=null,this.attributes=null}addCloneItem(t){if(t.modelType=="Text"&&t.key!=""){let e=t;this.attributes.set(e.key,e),this.attrsMap[e.key]=e.value,this.ids.add(e.globalIndex)}else this.items.push(t),this.ids.add(t.globalIndex)}addReuseAttrMap(){this.attrsMap["Reuse Block"]==null&&(this.attrsMap["Reuse Block"]=""),this.attrsMap["Group ID"]==null&&(this.attrsMap["Group ID"]=""),this.attrsMap["Channel ID"]==null&&(this.attrsMap["Channel ID"]="")}modify(t,e){let r=this.attributes.get(t);r!=null&&(r.value=e||"")}buildModel(){let t=S.ORIGIN,e=new Array(this.attributes.size),r=0;for(let l of this.attributes.values())e[r]=l,r++;let i={...this.attrsMap},n=Array.from(this.items),s=new vs(1,this._bbox.LL(),this._bbox.UL(),this._bbox.LR(),this._bbox.UR(),!1,this._bbox);return this.resultNeedToBeCached?xs.getInstance().add(this.componentId,1,t,0,this.textOffset,i,e,n,s,this._footprintUUID,this._deviceUUID):new vi(this.componentId,1,t,0,this.textOffset,i,e,n,s,this._footprintUUID,this._deviceUUID,null)}getComponent(t,e,r,i,n,s,a,l){let c=this.buildModel();if(c.setLayerIdReplacementTable(l),c.layerId=r,r==2){let u=Ae.getMatrix4(S.ORIGIN,n-Math.PI,1,i);c.multiply4(u)}else{let u=Ae.getMatrix4(S.ORIGIN,n,1,i);c.multiply4(u)}c.locked=a;for(let u in s)u!="Device"&&u!="Footprint"&&c.addATTRMap(u,s[u]);return e!=null&&c.setGroupID(e),c}hasId(t){return this.ids.has(t)}addId(t){return this.ids.add(t)}getId(){let t=0,e=this.componentId+"e"+t++;for(;this.ids.has(e);)e=this.componentId+"e"+t++;return e}getNoRepeatId(t){let e=0,r=t+"r"+e++;for(;this.ids.has(r);)r=t+"r"+e++;return r}getAttr(t){return this.attributes.get(t)}transform(t){for(let e of this.items)e.transform(t);for(let e of this.attributes.values())e.transform(t)}};var Oa={PartitionId:"partitionId",Index:"Index",GroupID:"groupId",Net:"netName",Name:"ruleName",StartLayer:"StartLayer",EndLayer:"EndLayer",CenterX:"centerX",CenterY:"centerY",HoleDiameter:"holeDiameter",ViaDiameter:"viaDiameter",ViaType:"viaType",TopSolderExpansion:"topSolderExpansion",BottomSolderExpansion:"bottomSolderExpansion",Locked:"locked",UnusedInnerLayers:"unusedInnerLayers",ZIndex:"zIndex"};var Vg=class{getConfig(t){return t>"1.9"?{CANVAS:this.getCANVAS(t),LAYER:this.getLAYER(t),LAYER_PHYS:this.getLAYER_PHYS(t),ACTIVE_LAYER:this.getACTIVE_LAYER(t),NET:this.getNET(t),PRIMITIVE:this.getPRIMITIVE(t),GROUP:this.getGROUP(t),VIA:this.getVIA(t),PAD:this.getPAD(t),LINE:this.getLINE(t),ARC:this.getARC(t),FILL:this.getFILL(t),FPC_FILL:this.getFPC_FILL(t),POLY:this.getPOLY(t),REGION:this.getREGION(t),PARTITION:this.getPARTITION(t),POUR:this.getPOUR(t),POURED:this.getCopper(t),BOARD:this.getBoard(t),IMAGE:this.getIMAGE(t),OBJ:this.getOBJ(t),TEARDROP:this.getTEARDROP(t),FONT:this.getFONT(t),STRING:this.getSTRING(t),ATTR:this.getATTR(t),DIMENSION:this.getDIMENSION(t),COMPONENT:this.getCOMPONENT(t),PAD_NET:this.getPAD_NET(t),RULE_TEMPLATE:this.getRULE_TEMPLATE(t),RULE:this.getRULE(t),RULE_SELECTOR:this.getRULE_SELECTOR(t),EQLEN_GRP:this.getEQLEN_GRP(t),EQLEN:this.getEQLEN(t),SHELL:this.getSHELL(t),SHELLCUT:this.getSHELLCUT(t),SHELL_ENTITY:this.getSHELLENTITY(t),CREASE:this.getCREASE(t),BOSS:this.getBOSS(t),PANELIZE:this.getPanelize(t),SILK_OPTS:this.getSILK_OPTS(t),PREFERENCE:this.getPreference(t),INNER:this.getInner()}:t>"1.7"?{CANVAS:this.getCANVAS(t),LAYER:this.getLAYER(t),LAYER_PHYS:this.getLAYER_PHYS(t),ACTIVE_LAYER:this.getACTIVE_LAYER(t),NET:this.getNET(t),PRIMITIVE:this.getPRIMITIVE(t),GROUP:this.getGROUP(t),CONNECT:this.getCONNECT(t),VIA:this.getVIA(t),PAD:this.getPAD(t),LINE:this.getLINE(t),ARC:this.getARC(t),CARC:this.getARC(t),FILL:this.getFILL(t),FPC_FILL:this.getFPC_FILL(t),POLY:this.getPOLY(t),REGION:this.getREGION(t),PARTITION:this.getPARTITION(t),POUR:this.getPOUR(t),POURED:this.getCopper(t),IMAGE:this.getIMAGE(t),OBJ:this.getOBJ(t),TEARDROP:this.getTEARDROP(t),FONT:this.getFONT(t),STRING:this.getSTRING(t),ATTR:this.getATTR(t),DIMENSION:this.getDIMENSION(t),COMPONENT:this.getCOMPONENT(t),PAD_NET:this.getPAD_NET(t),DEVICE:this.getDEVICE(t),RULE_TEMPLATE:this.getRULE_TEMPLATE(t),RULE:this.getRULE(t),RULE_SELECTOR:this.getRULE_SELECTOR(t),EQLEN_GRP:this.getEQLEN_GRP(t),EQLEN:this.getEQLEN(t),SHELL:this.getSHELL(t),SHELLCUT:this.getSHELLCUT(t),SHELL_ENTITY:this.getSHELLENTITY(t),CREASE:this.getCREASE(t),BOSS:this.getBOSS(t),PANELIZE:this.getPanelize(t),PROP:this.getProperty(t),SILK_OPTS:this.getSILK_OPTS(t),PREFERENCE:this.getPreference(t),CUSTOMFOOTPRINT:this.getCustomFootprint(t)}:{CANVAS:this.getCANVAS(t),LAYER:this.getLAYER(t),LAYER_PHYS:this.getLAYER_PHYS(t),ACTIVE_LAYER:this.getACTIVE_LAYER(t),NET:this.getNET(t),PRIMITIVE:this.getPRIMITIVE(t),GROUP:this.getGROUP(t),CONNECT:this.getCONNECT(t),VIA:this.getVIA(t),PAD:this.getPAD(t),LINE:this.getLINE(t),ARC:this.getARC(t),CARC:this.getARC(t),FILL:this.getFILL(t),FPC_FILL:this.getFPC_FILL(t),POLY:this.getPOLY(t),REGION:this.getREGION(t),PARTITION:this.getPARTITION(t),POUR:this.getPOUR(t),POURED:this.getCopper(t),IMAGE:this.getIMAGE(t),OBJ:this.getOBJ(t),TEARDROP:this.getTEARDROP(t),FONT:this.getFONT(t),STRING:this.getSTRING(t),ATTR:this.getATTR(t),DIMENSION:this.getDIMENSION(t),COMPONENT:this.getCOMPONENT(t),PAD_NET:this.getPAD_NET(t),DEVICE:this.getDEVICE(t),RULE_TEMPLATE:this.getRULE_TEMPLATE(t),RULE:this.getRULE(t),RULE_SELECTOR:this.getRULE_SELECTOR(t),EQLEN_GRP:this.getEQLEN_GRP(t),EQLEN:this.getEQLEN(t),SHELL:this.getSHELL(t),SHELLCUT:this.getSHELLCUT(t),SHELL_ENTITY:this.getSHELLENTITY(t),CREASE:this.getCREASE(t),BOSS:this.getBOSS(t),PANELIZE:this.getPanelize(t),SILK_OPTS:this.getSILK_OPTS(t),PREFERENCE:this.getPreference(t),REUSE_BLOCK:this.getReuseBlock(t),CUSTOMFOOTPRINT:this.getCustomFootprint(t),INNER:this.getInner()}}getInner(){return["fill"]}getProperty(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","color"];default:return["color"]}}getSILK_OPTS(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["layerId","defaultColor","baseColor"];default:return["defaultColor","baseColor"]}}getCANVAS(t){return["originX","originY","unit","gridXSize","gridYSize","snapXSize","snapYSize","altSnapXSize","altSnapYSize","gridType","multiGridType","multiGridRatio","highlightValue"]}getLAYER(t){return["layerId","layerType","layerName","use","show","locked","activeColor","activateTransparency","inactiveColor","inactiveTransparency"]}getLAYER_PHYS(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":"layerId","material","thickness","permittivity","lossTangent","isKeepIsland";default:return["material","thickness","permittivity","lossTangent","isKeepIsland","zIndex"]}}getACTIVE_LAYER(t){return["layerId"]}getRULE_TEMPLATE(t){return["name"]}getNET(t){switch(t){case"1.0":return["netName","netType","specialColor","retLine"];case"1.1":case"1.2":return["netName","netType","specialColor","retLine","differentialName","isPositiveNet"];case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["netName","netType","specialColor","retLine","differentialName","isPositiveNet","equalLengthGroupName"];default:return["netType","specialColor","retLine","differentialName","isPositiveNet","equalLengthGroupName"]}}getPRIMITIVE(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["primiveName","display","pick"];default:return["display","pick"]}}getGROUP(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["groupID","groupName"];default:return["groupName"]}}getCONNECT(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["mainId","relatedIds"];default:return["relatedIds"]}}getVIA(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return[Oa.Index,Oa.GroupID,Oa.Net,Oa.Name,Oa.CenterX,Oa.CenterY,Oa.HoleDiameter,Oa.ViaDiameter,Oa.ViaType,Oa.TopSolderExpansion,Oa.BottomSolderExpansion,Oa.Locked,Oa.UnusedInnerLayers];default:return[Oa.PartitionId,Oa.GroupID,Oa.Net,Oa.Name,Oa.CenterX,Oa.CenterY,Oa.HoleDiameter,Oa.ViaDiameter,Oa.ViaType,Oa.TopSolderExpansion,Oa.BottomSolderExpansion,Oa.Locked,Oa.UnusedInnerLayers,Oa.ZIndex]}}getPAD(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return[0,"groupId","netName","layerId","num","centerX","centerY","padAngle","hole","defaultPad","specialPad","padOffsetX","padOffsetY","relativeAngle","plated","padType","topSolderExpansion","bottomSolderExpansion","topPasteExpansion","bottomPasteExpansion","locked","connectMode","spokeSpace","spokeWidth","spokeAngle","unusedInnerLayers","padLen"];default:return["partitionId","groupId","netName","layerId","num","centerX","centerY","padAngle","hole","defaultPad","specialPad","padOffsetX","padOffsetY","relativeAngle","plated","padType","topSolderExpansion","bottomSolderExpansion","topPasteExpansion","bottomPasteExpansion","locked","zIndex","connectMode","spokeSpace","spokeWidth","spokeAngle","unusedInnerLayers","padLen","attrsMap"]}}getLINE(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","netName","layerId","startX","startY","endX","endY","width","locked"];default:return["partitionId","groupId","netName","layerId","startX","startY","endX","endY","width","locked","zIndex"]}}getARC(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","netName","layerId","startX","startY","endX","endY","angle","width","locked"];default:return["partitionId","groupId","netName","layerId","startX","startY","endX","endY","angle","width","locked","zIndex","arcType"]}}getPOLY(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","netName","layerId","width","path","locked"];default:return["partitionId","groupId","netName","layerId","width","path","locked","zIndex","specialColor","polyType"]}}getFILL(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","netName","layerId","width","fillStyle","path","locked"];default:return["partitionId","groupId","netName","layerId","width","fillStyle","path","locked","zIndex","isBridgingCopper","networkList","refs","specialColor"]}}getFPC_FILL(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","material","thickness","path","locked"];default:return["partitionId","groupId","layerId","material","thickness","path","locked","zIndex"]}}getREGION(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","width","prohibitType","path","locked","name"];default:return["partitionId","groupId","layerId","width","prohibitType","path","locked","name","zIndex","regionType"]}}getBoard(t){return["path"]}getPARTITION(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","name","fileUuid","path"];default:return["name","fileUuid","path"]}}getPOUR(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","netName","layerId","width","name","order","path","pourType","keepIsland","locked"];default:return["partitionId","groupId","netName","layerId","width","name","order","path","pourType","keepIsland","locked","zIndex"]}}getCopper(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["id","targetId","strokeWidth","fill","path"];case"1.9":return["partitionId","strokeWidth","fill","path","id"];default:return["pourFill"]}}getIMAGE(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","startX","startY","width","height","angle","mirror","path","locked"];default:return["partitionId","groupId","layerId","startX","startY","width","height","angle","mirror","path","locked","zIndex","specialColor"]}}getOBJ(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","fileName","startX","startY","width","height","angle","mirror","path","locked"];default:return["partitionId","groupId","layerId","fileName","startX","startY","width","height","angle","mirror","path","locked","zIndex"]}}getTEARDROP(t){switch(t){case"1.0":case"1.1":return["index","netName","layerId","refs","path"];case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","netName","layerId","path","groupId"];default:return["partitionId","netName","layerId","path","groupId","refs","locked"]}}getFONT(t){switch(t){case"1.0":case"1.1":return[0,"path"];case"1.2":case"1.3":case"1.4":case"1.5":return[0,"width","height","path"];default:return["text","fontFamily","fontSize","thickness","bold","italic","reverse","expansion","width","height","path"]}}getSTRING(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["Index","groupId","layerId","x","y","text","fontFamily","fontSize","strokeWidth","bold","italic","origin","angle","reverse","expansion","mirror","locked"];default:return["partitionId","groupId","layerId","x","y","text","fontFamily","fontSize","strokeWidth","bold","italic","origin","angle","reverse","expansion","mirror","locked","zIndex","specialColor"]}}getATTR(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupID","parentId","layerId","x","y","key","value","keyVisible","valueVisible","fontFamily","fontSize","strokeWidth","bold","italic","origin","angle","reverse","expansion","mirror","locked"];default:return["partitionId","groupID","parentId","layerId","x","y","key","value","keyVisible","valueVisible","fontFamily","fontSize","strokeWidth","bold","italic","origin","angle","reverse","expansion","mirror","locked","zIndex","specialColor"]}}getDIMENSION(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","type","layerId","unit","strokeWidth","precision","textFollow","coords","locked"];default:return["partitionId","type","layerId","unit","strokeWidth","precision","textFollow","coords","locked","zIndex","groupId","specialColor","text"]}}getCOMPONENT(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","x","y","angle","attrs","locked"];default:return["partitionId","groupId","layerId","x","y","angle","attrs","locked","zIndex","specialColor","layerIdReplacements"]}}getPAD_NET(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["componentId","padNum","padNet","padId","padLen"];default:return["partitionId","componentId","padNum","padNet","padId","padLen","attrsMap"]}}getDEVICE(t){return[0,1]}getRULE(t){return["ruleType","ruleName","ruleState","ruleContext"]}getRULE_SELECTOR(t){return["ruleSelect","ruleOrder","ruleKeyValue","copperValue","innerPlaneValue"]}getEQLEN_GRP(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["sort","name","groupColor"];default:return["name","sort","pads"]}}getEQLEN(t){return[0,1]}getSHELL(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","shellType","shellHeight","pcbHeight","strokeWidth","path","attrs","locked"];default:return["partitionId","groupId","shellType","shellHeight","pcbHeight","strokeWidth","path","locked","zIndex","thickness","direction","bottomHeight","topInnerHeight","bottomInnerHeight"]}}getSHELLCUT(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","depth","strokeWidth","path","locked"];default:return["partitionId","groupId","layerId","depth","strokeWidth","path","locked","zIndex"]}}getSHELLENTITY(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","booleanOperation","belong","depth","strokeWidth","path","locked"];default:return["partitionId","groupId","layerId","depth","strokeWidth","path","locked","zIndex","type","entityBelong","slotOptions","refs"]}}getBOSS(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":return["index","groupId","layerId","specification","centerX","centerY","depth","counterBore","stiffener","locked"];case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","centerX","centerY","specification","depth","thickness","holeDiameter","counterBore","stiffener","locked"];default:return["partitionId","groupId","layerId","centerX","centerY","specification","depth","thickness","holeDiameter","counterBore","stiffener","locked","zIndex"]}}getPanelize(t){return["on","row","column","rowSpacing","columnSpacing","onlyOutline","horizontalStamp","verticalStamp","horizontalSize","verticalSize"]}static getPanelizeStamp(t){return["on","stampHoleGroupQuantity","stampHoleDiameter","stampHoleQuantityPerGroup","stampHoleSpacing"]}static getPanelizeSide(t){return["on","sideHeight","positionHoleDiameter","markDiameter","markExpansion"]}getCREASE(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","startX","startY","endX","endY","angle","locked"];default:return["partitionId","groupId","layerId","startX","startY","endX","endY","angle","locked","zIndex"]}}getPreference(t){return["startTrackWidthFollowLast","lastTrackWidth","startViaSizeFollowLast","lastViaInnerDiameter","lastViaDiameter","snap","routingMode","routingCorner","removeLoop","rotatingObject","trackFollow","stretchTrackMinCorner","preferenceConfig","realTimeUpdateUnusedLayers","unusedPadRange","pushVia","pathOptimization4BePushed","currentPathOptimization4BePushed","removeCircuitsContainingVias","removeAntenna"]}getReuseBlock(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["shapeID","groupId","channelId"];default:return["groupId","channelId"]}}getCustomFootprint(t){return[0,1]}},h4=new Vg().getConfig("2.0");function Rre(o){return o?1:0}function Xb(o){return o===1}function Fa(o){let t=o.getGroupID();return t==null||x.getInstance().doctype==4?0:t}function Va(o){return o==="0"||o===0?null:o!=null?o.toString():null}function F1(o,t=1){if(o.primitives.length==1){let n=o.primitives[0];if(n instanceof q&&n.sweepAngle==360)return["CIRCLE",xe(n.center.x*t,4),xe(n.center.y*t,4),xe(n.rx*t,4)]}let e=new Array,r=o.primitives,i=!1;for(let n of r)if(n instanceof M&&n.length()>1e-8)e.push(xe(n.start().x*t,4)),e.push(xe(n.start().y*t,4)),i||(e.push("L"),i=!0);else if(n instanceof q&&Fd(n)>1e-8)i=!1,e.push(xe(n.start().x*t,4)),e.push(xe(n.start().y*t,4)),n instanceof Q9?e.push("CARC"):e.push("ARC"),e.push(xe(n.sweepAngle,4));else if(n instanceof Mr){i=!1,e.push(xe(n.start().x*t,4)),e.push(xe(n.start().y*t,4)),e.push("C");for(let s=1,a=n.controls.length;s<a-1;s++){let l=n.controls[s];e.push(xe(l.x*t,4)),e.push(xe(l.y*t,4))}}return e.length>2&&(e.push(xe(r[r.length-1].end().x*t,4)),e.push(xe(r[r.length-1].end().y*t,4))),e}var Rn=class{getKey(){return this.id}};var h8=class extends Rn{};var CFe=["Polyimide","FR4","Stainless Steel","Tape","EMI Shielding Film"];var SFe=["3M468","3M9077","TESA8854"],Du=class o extends kd{constructor(e,r,i){super();this._material="Polyimide";this._fpcModel=null;this.material=e,this.fpcModel=r,this.thickness=i}get material(){return this._material}set material(e){this._material=e}get fpcModel(){return this._fpcModel}set fpcModel(e){this._fpcModel=e}get thickness(){return this._thickness}set thickness(e){this._thickness=e}toJSON(){return{material:this.material,fpcModel:this.fpcModel,thickness:this.thickness}}clone(){return new o(this.material,this.fpcModel,this.thickness)}};function Dre(o){switch(o){case 3:return pl.LEFT_BOTTOM;case 6:return pl.CENTER_BOTTOM;case 9:return pl.RIGHT_BOTTOM;case 2:return pl.LEFT_MIDDLE;case 5:return pl.CENTER_MIDDLE;case 8:return pl.RIGHT_MIDDLE;case 1:return pl.LEFT_TOP;case 4:return pl.CENTER_TOP;case 7:return pl.RIGHT_TOP;default:return pl.LEFT_BOTTOM}}function FCe(o){switch(o){case pl.LEFT_BOTTOM:return 3;case pl.CENTER_BOTTOM:return 6;case pl.RIGHT_BOTTOM:return 9;case pl.LEFT_MIDDLE:return 2;case pl.CENTER_MIDDLE:return 5;case pl.RIGHT_MIDDLE:return 8;case pl.LEFT_TOP:return 1;case pl.CENTER_TOP:return 4;case pl.RIGHT_TOP:return 7}}function d8(o){switch(o){case 0:return JO.NORMAL;case 2:return JO.MARKER;case 1:return JO.TEST;default:return JO.NORMAL}}function OFe(o){switch(o){case JO.NORMAL:return 0;case JO.MARKER:return 2;case JO.TEST:return 1;default:return 0}}function AFe(o){switch(o){case 1:return ZO.BLIND;case 2:return ZO.SUTURE;case 0:return ZO.NORMAL;default:return ZO.NORMAL}}function _Fe(o){switch(o){case ZO.BLIND:return 1;case ZO.SUTURE:return 2;case ZO.NORMAL:return 0;default:return 0}}function vFe(o){switch(o){case KL.DOT:return 1;case KL.CENTER:return 2;default:return 2}}function xFe(o){switch(o){case 1:return KL.DOT;case 2:return KL.CENTER;default:return KL.CENTER}}function nR(o){switch(o){case Mo.AUTO_ROUTER:return"12";case Mo.BLIND:return"4";case Mo.COPPER:return"7";case Mo.DIFFER_ENTAIL:return"10";case Mo.NET_LENGTH:return"11";case Mo.NET_LENGTH_TOLERANCE:return"13";case Mo.OTHER:return"2";case Mo.PASTE:return"8";case Mo.PLANE:return"6";case Mo.RADIUS:return"5";case Mo.SAFE:return"1";case Mo.SOLDER:return"9";case Mo.TRACK:return"3";case Mo.CREEPAGE:return"14";default:return o}}function mm(o){switch(o){case"12":return Mo.AUTO_ROUTER;case"4":return Mo.BLIND;case"7":return Mo.COPPER;case"10":return Mo.DIFFER_ENTAIL;case"11":return Mo.NET_LENGTH;case"13":return Mo.NET_LENGTH_TOLERANCE;case"2":return Mo.OTHER;case"8":return Mo.PASTE;case"6":return Mo.PLANE;case"5":return Mo.RADIUS;case"1":return Mo.SAFE;case"9":return Mo.SOLDER;case"3":return Mo.TRACK;case"14":return Mo.CREEPAGE;default:return null}}function RFe(o){switch(o){case QL.DEFAULT:return 1;case QL.NORMAL:return 0;default:return 0}}function DFe(o){switch(o){case 1:return QL.DEFAULT;case 0:return QL.NORMAL;default:return QL.NORMAL}}function wFe(o){switch(o){case rA.FORTY_FIVE:return 0;case rA.NINETY:return 1;case rA.NINETY_ARC:return 2;default:return 0}}function LFe(o){switch(o){case 0:return rA.FORTY_FIVE;case 1:return rA.NINETY;case 2:return rA.NINETY_ARC;default:return rA.FORTY_FIVE}}function MFe(o){switch(o){case iA.LESS:return 0;case iA.MID:return 1;case iA.MORE:return 2;default:return 0}}function NFe(o){switch(o){case 0:return iA.LESS;case 1:return iA.MID;case 2:return iA.MORE;default:return iA.LESS}}function kFe(o){switch(o){case rM.COMPLETION_FIRST:return 1;case rM.SPEED_FIRST:return 0;default:return 1}}function BFe(o){switch(o){case 1:return rM.COMPLETION_FIRST;case 0:return rM.SPEED_FIRST;default:return rM.COMPLETION_FIRST}}function FFe(o){switch(o){case AI.M2:return"M2";case AI.M3:return"M3";case AI.M4:return"M4";case AI.M5:return"M5";case AI.M6:return"M6";default:return null}}function VFe(o){switch(o){case"M2":return AI.M2;case"M3":return AI.M3;case"M4":return AI.M4;case"M5":return AI.M5;case"M6":return AI.M6;default:return null}}function GFe(o){switch(o){case JL.PUSH_COVER:return"DRAWER";case JL.UPPER_LOWER_SHELLS:return"T&B";default:return"DRAWER"}}function UFe(o){switch(o){case"DRAWER":return JL.PUSH_COVER;case"T&B":return JL.UPPER_LOWER_SHELLS;default:return JL.PUSH_COVER}}function HFe(o){switch(o){case dE.X_AXIS_NEGATIVE:return 2;case dE.X_AXIS_POSITIVE:return 1;case dE.Y_AXIS_NEGATIVE:return 8;case dE.Y_AXIS_POSITIVE:return 4;default:return null}}function WFe(o){switch(o){case 2:return dE.X_AXIS_NEGATIVE;case 1:return dE.X_AXIS_POSITIVE;case 8:return dE.Y_AXIS_NEGATIVE;case 4:return dE.Y_AXIS_POSITIVE;default:return null}}function VCe(o){switch(o){case $O.GRID:return"grid";case $O.NONE:return"none";case $O.OUTLETS:return"outlets";default:return"none"}}function GCe(o){switch(o){case"grid":return $O.GRID;case"none":return $O.NONE;case"outlets":return $O.OUTLETS;default:return $O.NONE}}function zFe(o){switch(o){case OI.EMI_SHIELDING_FILM:return"EMI Shielding Film";case OI.FR4:return"FR4";case OI.M3_DOUBLE_SIDED_TAPE:return"Tape";case OI.PI:return"Polyimide";case OI.STEEL_SHEET:return"Stainless Steel";default:return o}}function UCe(o){switch(o){case"EMI Shielding Film":return OI.EMI_SHIELDING_FILM;case"FR4":return OI.FR4;case"Tape":return OI.M3_DOUBLE_SIDED_TAPE;case"Polyimide":return OI.PI;case"Stainless Steel":return OI.STEEL_SHEET;default:return o}}function YFe(o){switch(o){case QP.NONE:return"WIRING_MODE_IGNORE";case QP.OBSTRUCT:return"WIRING_MODE_OBSTRUCT";case QP.PUSH:return"WIRING_MODE_PUSHAWAY";case QP.SURROUND:return"WIRING_MODE_SURROUND";case QP.SURROUND_AND_PUSH:return"WIRING_MODE_SURROUND_AND_PUSHAWAY";default:return"WIRING_MODE_IGNORE"}}function jFe(o){switch(o){case"WIRING_MODE_IGNORE":return QP.NONE;case"WIRING_MODE_OBSTRUCT":return QP.OBSTRUCT;case"WIRING_MODE_PUSHAWAY":return QP.PUSH;case"WIRING_MODE_SURROUND":return QP.SURROUND;case"WIRING_MODE_SURROUND_AND_PUSHAWAY":return QP.SURROUND_AND_PUSH;default:return QP.NONE}}function XFe(o){switch(o){case qv.VIA:return 3;case qv.PAD:return 2;case qv.ALL:return 1;default:return null}}function qFe(o){switch(o){case 3:return qv.VIA;case 2:return qv.PAD;case 1:return qv.ALL;default:return null}}function $Fe(o){switch(o){case Mk.OPTIMIZA_NONE:return"OPTIMIZA_NONE";case Mk.OPTIMIZA_OPEN:return"OPTIMIZA_OPEN";default:return null}}function KFe(o){switch(o){case"OPTIMIZA_NONE":return Mk.OPTIMIZA_NONE;case"OPTIMIZA_OPEN":return Mk.OPTIMIZA_OPEN;default:return null}}function ZFe(o){switch(o){case $v.NONE:return 2;case $v.ALL:return 1;case $v.SINGLE:return 0;default:return null}}function JFe(o){switch(o){case 2:return $v.NONE;case 1:return $v.ALL;case 0:return $v.SINGLE;default:return null}}function QFe(o){switch(o){case Kv.OPTIMIZA_NONE:return"OPTIMIZA_NONE";case Kv.OPTIMIZA_STRONG:return"OPTIMIZA_STRONG";case Kv.OPTIMIZA_WEAK:return"OPTIMIZA_WEAK";default:return null}}function eVe(o){switch(o){case"OPTIMIZA_NONE":return Kv.OPTIMIZA_NONE;case"OPTIMIZA_STRONG":return Kv.OPTIMIZA_STRONG;case"OPTIMIZA_WEAK":return Kv.OPTIMIZA_WEAK;default:return null}}function tVe(o){switch(o){case _g.ELLIPSE:return"ELLIPSE";case _g.OVAL:return"OVAL";case _g.RECT:return"RECT";case _g.POLYGON:return"POLYGON";default:return null}}function rVe(o){switch(o){case"ELLIPSE":return _g.ELLIPSE;case"OVAL":return _g.OVAL;case"RECT":return _g.RECT;case"POLYGON":return _g.POLYGON;default:return null}}function iVe(o){switch(o){case KO.ROUND:return"ROUND";case KO.SLOT:return"SLOT";case KO.RECT:return"RECT";default:return"ROUND"}}function nVe(o){switch(o){case"ROUND":return KO.ROUND;case"SLOT":return KO.SLOT;case"RECT":return KO.RECT;default:return KO.ROUND}}function f4(o){switch(o){case QO.DIRECT:return 1;case QO.DIVERGENCE:return 0;case QO.NON_CONNECT:return 2;default:return 1}}function m4(o){switch(o){case 1:return QO.DIRECT;case 0:return QO.DIVERGENCE;case 2:return QO.NON_CONNECT;default:return QO.DIRECT}}function IT(o){return o?1:0}function CT(o){return o==1}function oVe(o){switch(o){case tM.DIRECT:return 0;case tM.NON_CONNECT:return 1;default:return 0}}function sVe(o){switch(o){case 0:return tM.DIRECT;case 1:return tM.NON_CONNECT;default:return tM.DIRECT}}function aVe(o){switch(o){case eM.ALL:return 0;case eM.LAYERED:return 1;default:return 0}}function lVe(o){switch(o){case 0:return eM.ALL;case 1:return eM.LAYERED;default:return eM.ALL}}function cVe(o){switch(o){case ZL.NORMAL:return"Line";case ZL.BOARD_OUTLINE:return"Board Outline";default:return"Line"}}function hVe(o){switch(o){case"Line":return ZL.NORMAL;case"Board Outline":return ZL.BOARD_OUTLINE;default:return ZL.NORMAL}}var ST=class extends h8{constructor(t=!1){super(),this.replace=t}getData(t,e){var r;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupID":return Fa(e);case"parentId":let i=e.getParent();return i!=null?i.globalIndex:"";case"layerId":return e.layerId;case"x":return e.positionIsNull?null:xe(e.position.x*10,4);case"y":return e.positionIsNull?null:xe(e.position.y*10,4);case"key":return e.key;case"value":{let n=e.getParent();if(n!=null&&n instanceof vi)if(this.replace){if(e.key==="Device")return gh.getInstance().getItem(n.deviceUUID).name==e.value?n.deviceUUID:e.value;if(e.key==="Footprint")return Wi.getInstance().getItem(n.footprintUUID).footprintId==e.value?n.footprintUUID:e.value}else{if(e.key==="Device")return n.deviceUUID;if(e.key==="Footprint")return n.footprintUUID;if(e.key==="Name")return n.attrsMap.Name}return e.value}case"keyVisible":return e.showKey;case"valueVisible":return e.showValue;case"fontFamily":return e.fontFamily;case"fontSize":return xe(e.fontSize*10,4);case"strokeWidth":return xe(e.strokeWidth*10,4);case"bold":return 0;case"italic":return 0;case"origin":return this.getAlign(e.origin);case"angle":return xe(e.rotation/Math.PI*180,4);case"reverse":return e.reverse;case"expansion":return xe(e.reverseExpansion*10,4);case"mirror":return e.mirror;case"locked":return e.locked;case"zIndex":return e.zIndex;case"path":return ef(e.outline);case"width":return e.width;case"height":return e.height;case"specialColor":return(3==e.layerId||4==e.layerId)&&e.silkColor!=null&&(e.getParent()==null||e.getParent()!=null&&e.key!="")?(r=e.silkColor)==null?void 0:r.toString():null}}getAlign(t){switch(t){case 3:return pl.LEFT_BOTTOM;case 6:return pl.CENTER_BOTTOM;case 9:return pl.RIGHT_BOTTOM;case 2:return pl.LEFT_MIDDLE;case 5:return pl.CENTER_MIDDLE;case 8:return pl.RIGHT_MIDDLE;case 1:return pl.LEFT_TOP;case 4:return pl.CENTER_TOP;case 7:return pl.RIGHT_TOP}}};function uj(o,t,e){let r="";return t=="Footprint"?r=e:t=="Designator"&&(r="U?"),{id:"e"+o,partitionId:null,groupId:"0",parentId:"",layerId:3,x:null,y:null,key:t,value:r,keyVisible:!1,valueVisible:!1,fontFamily:"default",fontSize:50,strokeWidth:8,bold:!1,italic:!1,origin:Dre(3),angle:0,reverse:!1,expansion:0,mirror:!1,locked:!1,zIndex:null,path:null,width:null,height:null,number:-1}}function kA(o,t,e){return e.sub(o).rotate(S.ORIGIN,-t)}function wre(o,t){if(!o)return!1;for(let e=0;e<o.length;e++){let r=o[e];if(Array.isArray(r)){let i=!1;for(let n=0;n<r.length;n++){let s=r[n];if(t(s,e,n)){i=!0;break}}if(i)return!0;continue}if(t(r,e,-1))return!0}return!1}function p8(o){return o.length==0||Array.isArray(o[0])?o:[o]}function g4(o){return o.length==1&&Array.isArray(o[0])?o[0]:o}var Lre=class extends h5e{constructor(t,e){let r=x.getInstance().projectId;super(t,r,x.getInstance().currOpenProjectId===r,e)}setHandle(t){this.handle=t}onDocDetail(t,e,r){var i;(i=this.handle)==null||i.onDocDetail(t,e,r)}};var f8=class{constructor(){this.client="";this._ticket=-1}setClient(t){this.client=t}setTicket(t){this._ticket=t}};var m8=class extends f8{constructor(){super(...arguments);this.attr={};this.client=""}onDocDetail(e,r,i){this.client=e;let n=i,s=n==null?void 0:n.attributes,a=(n==null?void 0:n.title)||"",l=this.attr={};if(s)for(let c in s)c!="uuid"&&c!="utime"&&c!="Footprint"&&(l[c]=s[c]);this.name=a,this.utime=n==null?void 0:n.updateTime,this.footprintUUID=s==null?void 0:s.Footprint,delete this.attr.Footprint,delete this.attr.Symbol,delete this.attr["Convert to PCB"],delete this.attr["Sim Model"],delete this.attr["Sim Model Title"],delete this.attr["Sim Model Path"],delete this.attr["NGSpice Model"],delete this.attr["NGSpice Model Title"],delete this.attr["NGspice Model Path"]}};var oR=class{constructor(t,e){this._attrMap={};this.attrDataMap={};this.components=new Set;this.client="";this.compiler=new Lre(t,e),this._uuid=t}async destroy(){await this.compiler.destroy()}async parse(t,e){let r=this.compiler,i=new m8;return r.setHandle(i),(e?await e(r):await r.init(t)).success?(this.client=i.client,this.sycn(i),this.attrModel=new Ed("",3,0,"Device",!1,this._name,!1,"default",HCe,0,S.ORIGIN,3,.6,!1,0,!1,!0,[],0,0,!1),this.addAttr(this.attrModel.key,this.getAttrData1(this.attrModel)),!0):!1}sycn(t){this._name=t.name,this._utime=t.utime,this._footprintUUID=t.footprintUUID,this._attrMap=t.attr}setHandle(t){this.compiler.setHandle(t),t.setClient(this.client)}get footprintUUID(){return this._footprintUUID}get name(){return this._name}get uuid(){return this._uuid}get utime(){return this._utime}get attrs(){return this._attrMap}get attrMap(){return this._attrMap}set name(t){this._name=t}set uuid(t){this._uuid=t}set utime(t){this._utime=t}set footprintUUID(t){this._footprintUUID=t}set attrMap(t){this._attrMap=t}createComponent(t,e){e==null&&(e=this.footprintUUID);let r=Wi.getInstance().getItem(e),i=new jE(e,this._uuid,t,r.getBBox());return i=r.generate(i),this.overlap(i),i}rebuildComponent(t,e,r,i){e==null&&(e=this.footprintUUID);let n=Wi.getInstance().getItem(e),s=new jE(e,this._uuid,t,n.getBBox(),i);return s=n.formatParseBuild(s,r),this.overlapAttr(s,r),s}getAttrData(t,e){let r=new ST,i=h4.ATTR,n=new Array(6),s=kA(t.position,t.rotation,e.position),a=e.rotation-t.rotation,l=0;for(let c=0,h=i.length;c<h;c++){let u=i[c];if(u=="x")n[l]=xe(s.x*10),l++;else if(u=="y")n[l]=xe(s.y*10),l++;else if(u=="angle")n[l]=xe(a/Math.PI*180,3),l++;else if(u=="keyVisible")n[l]=!1,l++;else if(u=="valueVisible")n[l]=!1,l++;else{let d=r.getData(u,e);n[l]=d,l++}}return n}getAttrData1(t){let e=new ST,r=h4.ATTR,i=r.length,n=new Array(i);for(let s=0;s<i;s++){let a=r[s],l=e.getData(a,t);n[s]=l}return n}addAttr(t,e){this.attrDataMap[t]=e}restoreAttr(t,e){let{componentPosition:r,angle:i,footprintId:n,componentLayerId:s}=e;n==null&&(n=this._footprintUUID);let a=Wi.getInstance().getItem(n);if(a.has(t.key))t=a.restoreAttr(t,{componentPosition:r,angle:i,componentLayerId:s}),this.has(t.key)&&(t.value=this._attrMap[t.key]);else{let l=this.attrDataMap[t.key];l!=null&&this.restore(t,r,i,l)}}copy(t,e){t==null&&(t=this._footprintUUID);let r=Wi.getInstance().getItem(t),i=new jE(t,this._uuid,e,r.getBBox());return i=r.copy(i),i}add(t){this.components.add(t)}delete(t){t instanceof vi&&this.components.delete(t)}getComponents(){let t=new Array;return this.components.forEach(e=>{t.push(e)}),t}overlapAttr(t,e){let r=null,i=new Set;for(let s of e)this._attrMap[s.key]!=null&&s.key!="Name"&&i.add(s.key),s.key=="Device"&&(r=s);for(let s in this._attrMap){if(s=="Footprint"||i.has(s))continue;let a=this._attrMap[s];t.attrsMap[s]!=null&&t.modify(s,a),t.attrsMap[s]=a}let n=t.getAttr("Device");n==null?r!=null?(n=r.finish(),t.addCloneItem(n)):(n=this.attrModel.clone(),n.globalIndex=t.getId(),zS(n),t.addCloneItem(n)):n.value=this._name,t.attrsMap.Device=this._name}overlap(t){for(let r in this._attrMap)r!="Footprint"&&(t.attrsMap[r]!=null&&t.modify(r,this._attrMap[r]),t.attrsMap[r]=this._attrMap[r]);t.attrsMap.Device!=null&&t.modify("Device",this._name);let e=t.getAttr("Device");t.getAttr("Device")==null?(e=this.attrModel.clone(),e.globalIndex=t.getId(),zS(e),t.addCloneItem(e)):e.value=this._name,t.attrsMap.Device=this._name}overlapValue(t){let e=t.key;e!="Footprint"&&(e=="Device"?t.value!=this._name&&(t.value=this._name):this._attrMap[e]!=null&&(t.value=this._attrMap[e]))}has(t){return this._attrMap[t]!=null}checkKeyValue(t,e,r){if(t=="Footprint"){r==null&&(r=this._footprintUUID);let i=Wi.getInstance().getItem(r);return i==null||r!=this._footprintUUID?!1:e==i.footprintId}if(t=="Device")return e==this.name;if(this.has(t))return this._attrMap[t]==e;{if(r==null&&(r=this._footprintUUID),r==null)return!1;let i=Wi.getInstance().getItem(r);return i==null?!1:t=="3D Model"||t=="3D Model Title"||t=="3D Model Transform"?i.checkKeyValue(t,e)?!0:e===void 0:i.checkKeyValue(t,e)}}needSave(t,e,r,i,n){n==null&&(n=this._footprintUUID);let s=Wi.getInstance().getItem(n);return s.has(t.key)?s.needSave(t,e,r,i,this.attrMap[t.key]):this.needSave1(t,e,r)}needSave1(t,e,r){let i=.01,n=this.attrDataMap[t.key];if(n!=null){let a=h4.ATTR;for(let l=0,c=a.length;l<c;l++){let h=a[l],u=n[l];switch(h){case"layerId":{let d=parseInt(u);if(t.layerId!=d)return!0;break}case"x":{let d=parseFloat(u)/10;if(Math.abs(xe(e.x,2)-d)>i)return!0;break}case"y":{let d=parseFloat(u)/10;if(Math.abs(xe(e.y,2)-d)>i)return!0;break}case"value":if(t.value!=u)return!0;break;case"keyVisible":if(t.showKey!=Xb(u))return!0;break;case"valueVisible":if(t.showValue!=Xb(u))return!0;break;case"fontFamily":if(u==""&&(u="default"),t.fontFamily!=u)return!0;break;case"fontSize":{let d=parseFloat(u)/10;if(Math.abs(xe(t.fontSize,2)-d)>i)return!0;break}case"strokeWidth":{let d=parseFloat(u)/10;if(Math.abs(xe(t.strokeWidth,2)-d)>i)return!0;break}case"origin":if(u=FCe(u),t.origin!=u)return!0;break;case"angle":{let d=parseFloat(u)/180*Math.PI;if(Math.abs(d-r)>i)return!0;break}case"reverse":if(t.reverse!=Xb(u))return!0;break;case"expansion":{let d=parseFloat(u)/10;if(Math.abs(xe(t.reverseExpansion,2)-d)>i)return!0;break}case"mirror":if(t.mirror!=Xb(u))return!0;break;case"locked":if(t.locked!=Xb(u))return!0;break}}return!1}else return!0}toJSON(){return{name:this._name,uuid:this._uuid,utime:this._utime,footprintUUID:this._footprintUUID,attrs:this._attrMap}}restore(t,e,r,i){let s=h4.ATTR,a=0,l=0;for(let c=0,h=s.length;c<h;c++){let u=s[c],d=i[c];switch(u){case"layerId":{let p=parseInt(d);isNaN(p)||(t.layerId=p);break}case"x":{let p=parseFloat(d)/10;isNaN(p)||(a=p);break}case"y":{let p=parseFloat(d)/10;isNaN(p)||(l=p);break}case"value":t.value=d;break;case"keyVisible":t.showKey=Xb(d);break;case"valueVisible":t.showValue=Xb(d);break;case"fontFamily":t.fontFamily=d;break;case"fontSize":{let p=parseFloat(d)/10;isNaN(p)||(t.fontSize=Math.abs(p));break}case"strokeWidth":{let p=parseFloat(d)/10;isNaN(p)||(t.strokeWidth=p);break}case"origin":t.origin=FCe(d);break;case"angle":{let p=parseFloat(d)/180*Math.PI;isNaN(p)||(t.rotation=p+r);break}case"reverse":t.reverse=Xb(d);break;case"expansion":{let p=parseFloat(d)/10;isNaN(p)||(t.reverseExpansion=p);break}case"mirror":t.mirror=Xb(d);break;case"locked":t.locked=Xb(d);break}}t.position=new S(a,l).add(e).rotate(e,r)}};var zy=class zy extends wi{constructor(){super();this.listener=null}static getInstance(e){e||(e=zy.otherDecodingProjectId);let r;return e?(r=zy.otherProjectManagerMap[e],r||(r=new zy,zy.otherProjectManagerMap[e]=r),r):(zy.manager||(zy.manager=new zy),r=zy.manager,r)}static async clearOtherProjectManagerMap(){zy.otherDecodingProjectId=void 0;for(let e in zy.otherProjectManagerMap)await zy.otherProjectManagerMap[e].clear(),delete zy.otherProjectManagerMap[e]}bindListener(e){this.listener=e}async bindDeviceListener(e){this.listener!=null&&await this.listener.bindListener(e)}addDevice(e,r){this.map.set(e,r)}async add(e,r,i){let n=this.map.get(e);if(n==null){n=new oR(e,r);try{await n.parse(i)&&this.addDevice(e,n)}catch(s){console.log(s);return}await this.bindDeviceListener(n)}return n}getItem(e){return this.map.get(e)}delete(e){e.modelType==="Component"&&this.deleteComponent(e)}deleteComponent(e){if(e instanceof vi){let r=this.map.get(e.deviceUUID);r!=null&&r.delete(e)}}async clear(){for(let[,e]of this.map)await e.destroy();this.map.clear()}};zy.manager=null,zy.otherProjectManagerMap={};var gh=zy;var Mre=class{};var $l=class extends Mre{constructor(){super(...arguments);this.resultNeedToBeCached=!0;this.keepDisabledLayerItem=!1}clearGroupId(){}changeNet4Map(e){}load(){}clear(){}isNumber(e){return e!=null&&!isNaN(e)}clearFootExcludeProps(){}get hashkey(){return this.index}get shapeLayerId(){return this.layerId}};var E0=class extends $l{constructor(){super(...arguments);this.netModifyInter=null}loadPartitionId(e){e!==void 0&&this.model.partition!=e&&(this.model.partition=e)}clearFootExcludeProps(){this.partition=void 0}loadGroupId(e){e=Va(e),this.model.getGroupID()!=e&&this.model.setGroupID(e)}loadLayerId(e){this.model.layerId!=e&&(this.model.layerId=e)}loadLocked(e){this.model.locked!=e&&(this.model.locked=e)}loadzIndex(e){this.model.zIndex!=e&&(this.model.zIndex=e)}loadNumber(e){e&&this.model.number!=e&&(this.model.number=e)}};var g8=class extends E0{constructor(){super(...arguments);this.value="";this.showKey=!1;this.showValue=!0;this.strokeWidth=.6;this.reverse=!1;this.reverseExpansion=0;this.resetAttr=!1}getPosition(){let e=this.x,r=this.y;return this.x==null&&(e=S.ORIGIN.x),this.y==null&&(r=S.ORIGIN.y),new S(e,r)}getAlign(e){switch(e){case pl.LEFT_BOTTOM:return 3;case pl.CENTER_BOTTOM:return 6;case pl.RIGHT_BOTTOM:return 9;case pl.LEFT_MIDDLE:return 2;case pl.CENTER_MIDDLE:return 5;case pl.RIGHT_MIDDLE:return 8;case pl.LEFT_TOP:return 1;case pl.CENTER_TOP:return 4;case pl.RIGHT_TOP:return 7}}loadPosition(e){this.model.position.equals(e)||(this.model.position=e)}loadKey(e){this.model.key!=e&&(this.model.key=e)}loadValue(e){this.model.value!=e&&(this.model.value=e)}loadShowKey(e){this.model.showKey!=e&&(this.model.showKey=e)}loadShowValue(e){this.model.showValue!=e&&(this.model.showValue=e)}loadFontFamily(e){this.model.fontFamily!=e&&(this.model.fontFamily=e)}loadFontSize(e){this.model.fontSize!=e&&(this.model.fontSize=e)}loadStrokeWidth(e){this.model.strokeWidth!=e&&(this.model.strokeWidth=e)}loadOrigin(e){this.model.origin!=e&&(this.model.origin=e)}loadRotation(e){this.model.rotation!=e&&(this.model.rotation=e)}loadReverse(e){this.model.reverse!=e&&(this.model.reverse=e)}loadReverseExpansion(e){this.model.reverseExpansion!=e&&(this.model.reverseExpansion=e)}loadMirror(e){this.model.mirror!=e&&(this.model.mirror=e)}loadWAndH(e,r){(this.model.width!=e||this.model.height!=r)&&this.model.updateBox4(e||this.model.width,r||this.model.height)}getNameValueById(e,r){let i=r;if(e=="Device"){let n=gh.getInstance().getItem(r);n!=null&&(i=n.name)}else if(e=="Footprint"){let n=Wi.getInstance().getItem(r);n!=null&&(i=n.footprintId)}return i}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadLayerId(this.layerId),this.loadPosition(this.getPosition()),this.loadKey(this.key||"");let e=this.getNameValueById(this.key,this.value);this.loadValue(e),this.loadShowKey(this.showKey),this.loadShowValue(this.showValue),this.loadFontFamily(this.fontFamily),this.loadFontSize(this.fontSize),this.loadStrokeWidth(this.strokeWidth),this.loadOrigin(this.origin),this.loadRotation(this.angle),this.loadReverse(this.reverse),this.loadReverseExpansion(this.reverseExpansion),this.loadMirror(this.mirror),this.loadLocked(this.locked),this.loadSpecialColor(this.specialColor)}loadSpecialColor(e){(this.model.silkColor!=e&&(this.model.silkColor==null||e==null)||this.model.silkColor!=null&&e!=null&&!this.model.silkColor.equals(e))&&(this.model.silkColor=e)}};var Yy=class extends g8{constructor(){super()}feed(t){let{id:e,partitionId:r,groupId:i,parentId:n,layerId:s,x:a,y:l,key:c,value:h,keyVisible:u,valueVisible:d,fontFamily:p,fontSize:m,strokeWidth:g,bold:y,italic:b,origin:P,angle:T,reverse:I,expansion:C,mirror:E,locked:O,zIndex:_,number:R,specialColor:v}=t;if(this.partition=r,this.index=e,this.groupId=Va(i),this.parentIndex=n,this.zIndex=_,this.number=R,this.isNumber(s)&&(this.layerId=s),this.isNumber(a)){let D=a/10;this.x=D}if(this.isNumber(l)){let D=l/10;this.y=D}this.key=c,this.value=h||"",this.showKey=u,this.showValue=d,this.fontFamily=p,this.isNumber(m)&&(this.fontSize=Math.abs(m/10)),this.isNumber(g)&&(this.strokeWidth=g/10),this.origin=this.getAlign(P),this.isNumber(T)&&(this.angle=T/180*Math.PI),this.reverse=I,this.isNumber(C)&&(this.reverseExpansion=C/10),this.mirror=E,this.locked=O,v&&(this.specialColor=ee.of3(v))}check(){return this.index==null||this.layerId==null||this.key==null||this.showKey==null||this.value==null||this.showValue==null||this.fontFamily==null||this.fontSize==null||this.angle==null||this.locked==null||this.origin==null||this.strokeWidth==null||this.mirror==null?!1:(this.showValue||this.showKey?this.positionIsNull=!1:(this.x==null||this.y==null)&&(this.positionIsNull=!0),this.x==null&&this.y==null&&!this.positionIsNull&&(this.resetAttr=!0),!0)}finish(){if(this.check()){let t=this.resultNeedToBeCached?mo.getInstance().addText(this.index,this.layerId,this.key,this.showKey,this.value,this.showValue,this.fontFamily,this.fontSize,this.angle,this.locked,this.getPosition(),this.origin,this.strokeWidth,this.reverse,this.reverseExpansion,this.mirror,this.positionIsNull,null,this.specialColor):new YE(this.index,this.layerId,0,this.key,this.showKey,this.value,this.showValue,this.fontFamily,this.fontSize,this.angle,this.getPosition(),this.origin,this.strokeWidth,this.reverse,this.reverseExpansion,this.mirror,this.positionIsNull,[],0,0,this.locked,this.specialColor);return this.groupId!=null&&t.setGroupID(this.groupId),this.partition&&(t.partition=this.partition),this.isNumber(this.zIndex)&&(t.zIndex=this.zIndex),this.isNumber(this.number)&&(t.number=this.number),t}else return null}getText(t=this.value){let e="";return this.showKey?this.showValue?e=this.key+":"+t:e=this.key:this.showValue?e=t:e="",e}getOldFontParam(){let t=this.value;if(this.key=="Device"){let a=gh.getInstance().getItem(this.value);a!=null&&(t=a.name)}else if(this.key=="Footprint"){let a=Wi.getInstance().getItem(this.value);a!=null&&(t=a.footprintId)}let e=this.getText(t),{fontFamily:r,fontSize:i,reverse:n,reverseExpansion:s}=this;return{fontFamily:r,fontSize:i,reverse:n,expansion:s,text:e}}loadDimension(t){this.model=t,this.loadGroupId(this.groupId);let e=this.getPosition();t.textPosition.equals(e)||(t.textPosition=e),t.fontSize!=this.fontSize&&(t.fontSize=this.fontSize)}loadShowKey(t){this.model.showKey!=t&&(this.model.showKey=t)}loadShowValue(t){this.model.showValue!=t&&(this.model.showValue=t)}};var y4=class extends g8{feed(t){let{id:e,partitionId:r,groupId:i,layerId:n,x:s,y:a,text:l,fontFamily:c,fontSize:h,strokeWidth:u,bold:d,italic:p,origin:m,angle:g,reverse:y,expansion:b,mirror:P,locked:T,zIndex:I,number:C,specialColor:E}=t;if(this.index=e,this.partition=r,this.groupId=Va(i),this.layerId=n,this.zIndex=I,this.number=C,this.isNumber(s)){let _=s/10;this.x=_}if(this.isNumber(a)){let _=a/10;this.y=_}if(this.value=l,this.fontFamily=c,this.isNumber(h)){let _=h/10;this.fontSize=_}let O=u/10;if(this.isNumber(O)&&O>0&&(this.strokeWidth=O),this.origin=this.getAlign(m),this.isNumber(g)){let _=g/180*Math.PI;this.angle=_}if(this.reverse=y,this.isNumber(b)){let _=b/10;this.reverseExpansion=_}this.mirror=P,this.locked=T,E&&(this.specialColor=ee.of3(E))}check(){return!(this.index==null||this.layerId==null||((this.layerId==58||this.layerId==59)&&(this.layerId=1),this.value==null||this.value=="")||this.fontFamily==null||this.fontSize==null||this.strokeWidth==null||this.origin==null||this.angle==null||this.mirror==null||this.locked==null)}clear(){this.model=null,this.index=null,this.partition=null,this.groupId=null,this.zIndex=null,this.number=null,this.layerId=null,this.value=null,this.x=null,this.y=null,this.fontFamily=null,this.angle=null,this.mirror=null,this.origin=null,this.fontSize=null,this.zIndex=null,this.number=null,this.locked=null}clearGroupId(){this.groupId=null}finish(){if(this.check()){let t=this.resultNeedToBeCached?mo.getInstance().addText(this.index,this.layerId,"",!1,this.value,!0,this.fontFamily,this.fontSize,this.angle,this.locked,new S(this.x,this.y),this.origin,this.strokeWidth,this.reverse,this.reverseExpansion<0?0:this.reverseExpansion,this.mirror,null,null,this.specialColor):new YE(this.index,this.layerId,0,"",!1,this.value,!0,this.fontFamily,this.fontSize,this.angle,new S(this.x,this.y),this.origin,this.strokeWidth,this.reverse,this.reverseExpansion<0?0:this.reverseExpansion,this.mirror,!1,[],0,0,this.locked,this.specialColor);return this.groupId!=null&&t.setGroupID(this.groupId),this.partition&&(t.partition=this.partition),this.isNumber(this.zIndex)&&(t.zIndex=this.zIndex),this.isNumber(this.number)&&(t.number=this.number),t}else return null}};var Nre=class extends $l{constructor(){super(...arguments);this.activeAlpha=1;this.deactiveAlpha=.5}feed(e){let{layerId:r,layerType:i,layerName:n,use:s,show:a,locked:l,activeColor:c,activateTransparency:h,inactiveColor:u,inactiveTransparency:d}=e;this.isNumber(r)&&(this.layerId=r),this.type=i,this.name=n,this.locked=l,this.parseState(s,a),this.activeColor=ee.of3(c),this.activeAlpha=this.isNumber(h)?h:this.activeAlpha,this.deactiveColor=ee.of3(u),this.deactiveAlpha=this.isNumber(d)?d:this.deactiveAlpha}parseState(e,r){e?r?this.layerStatus=1:this.layerStatus=2:this.layerStatus=0}get hashkey(){return this.layerId}getType(){return this.type}check(){return!(!this.layerId||this.type==null||this.name==null||!this.activeColor||this.layerStatus===void 0&&isNaN(this.layerStatus)||!this.deactiveColor)}layerCheck(){return this.layerId==52&&(this.layerStatus=0),this.layerId==null?!1:(this.layerId===56&&this.layerStatus===0&&(this.layerStatus=1),this.activeColor=ee.of6(this.activeColor,this.activeAlpha),this.deactiveColor=ee.of6(this.deactiveColor,this.deactiveAlpha),!0)}finish(){if(this.layerCheck()){if(!this.resultNeedToBeCached)return this.addNotCacheLayer();let e=$e.getInstance(),r=vf.build(this.layerStatus!=0,this.layerStatus==1,!1),i=e.modifyLayer(this.layerId,this.type,this.name,r,this.activeColor,this.deactiveColor);return i.locked=this.locked,i}else return null}addNotCacheLayer(){let e=$e.getInstance(),r=e.getLayer(this.layerId);if(r==null){let i=vf.build(!1,!1,!1),n=e.modifyLayer(this.layerId,this.type,this.name,i,this.activeColor,this.deactiveColor);return n.locked=this.locked,n}return r}getName(){return this.name}loadLayerType(e){this.model.type!==e&&(this.model.type=e)}loadLayerName(e){this.model.name!==e&&(this.model.name=e)}loadLayerConfig(e){this.model.config!==e&&(this.model.config=e,this.loadLayerVisible(this.layerStatus==1),this.loadLayerLocked(this.locked))}loadLayerVisible(e){this.model.visible!==e&&(this.model.visible=e)}loadLayerLocked(e){this.model.locked!==e&&(this.model.locked=e)}load(){this.loadLayerType(this.type),this.loadLayerName(this.name),this.loadLayerConfig(this.layerStatus!=0)}};var kre=class extends $l{get hashkey(){return this.layerId}feed(t){let{layerId:e,material:r,thickness:i,permittivity:n,lossTangent:s,isKeepIsland:a,zIndex:l}=t;this.isNumber(e)&&(this.layerId=e),this.material=r,this.isNumber(i)&&(this.thickness=i/10),this.permittivity=n,this.LossTangent=s,this.isKeepIsland=a,this.zIndex=l}setLayerId(t){this.layerId=t}check(){return!(!this.layerId||this.thickness!==null&&isNaN(this.thickness)||this.permittivity!==null&&isNaN(this.permittivity)||this.LossTangent!==null&&isNaN(this.LossTangent))}finish(){return this.check()?this.resultNeedToBeCached?$e.getInstance().addLayerPhy(this.layerId,this.material,this.thickness,this.permittivity,this.LossTangent,this.isKeepIsland,this.zIndex):new xA(this.layerId,this.material,this.thickness,this.permittivity,this.LossTangent,this.isKeepIsland,this.zIndex):null}loadMaterial(t){this.model.material!==t&&(this.model.material=t)}loadThickness(t){this.model.thickness!==t&&(this.model.thickness=t)}loadPermittivity(t){this.model.permittivity!==t&&(this.model.permittivity=t)}loadLossTangent(t){this.model.lossTangent!==t&&(this.model.lossTangent=t)}loadIsKeepIsland(t){this.model.isKeepIsland!==t&&(this.model.isKeepIsland=t)}loadZIndex(t){this.model.zIndex!==t&&(this.model.zIndex=t)}load(){this.loadMaterial(this.material),this.loadThickness(this.thickness),this.loadPermittivity(this.permittivity),this.loadLossTangent(this.LossTangent),this.loadIsKeepIsland(this.isKeepIsland),this.loadZIndex(this.zIndex)}};var Bre=class extends $l{get hashkey(){return null}feed(t){let{layerId:e}=t;this.id=e}check(){return!(this.id==null||isNaN(this.id))}finish(){this.id!=null&&($e.getInstance().activeLayer=this.id)}};function BA(o,t){return o?Object.hasOwnProperty.call(o,t):!1}function Z2(o,t,e,r){return o?BA(o,t)?o[t]:(r&&(o[t]=e),e):e}function FA(o,t,e,r=!0){return!o||!r&&BA(o,t)||o[t]===e?!1:(o[t]=e,!0)}function gm(o,t){if(!o)return!1;for(let e in o){let r=o[e];if(t(r,e,o))return!0}return!1}function b4(o){return o?Object.keys(o):[]}function jy(o){return o?b4(o).length==0:!0}function XE(o){return typeof o=="number"&&!Number.isNaN(o)&&isFinite(o)}function uVe(o){let t={};return gm(o,(e,r)=>{t[e]||(t[e]=[]),t[e].push(r)}),t}var dj=class{static converArray2Obj(t){return{unit:t[0],padTopExpan:t[1],padBotExpan:t[2],viaTopExpan:t[3],viaBotExpan:t[4],testPointTopExpan:XE(t[5])?t[5]:2,testPointBotExpan:XE(t[6])?t[6]:2}}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t,i=r.padTopExpan/10;e.padTopExpansion!==i&&(e.padTopExpansion=i);let n=r.padBotExpan/10;e.padBottomExpansion!==n&&(e.padBottomExpansion=n);let s=r.viaTopExpan/10;e.viaTopExpansion!==s&&(e.viaTopExpansion=s);let a=r.viaBotExpan/10;e.viaBottomExpansion!==a&&(e.viaBottomExpansion=a);let l=XE(r.testPointTopExpan)?r.testPointTopExpan/10:.2;e.testPointTopExpansion!==l&&(e.testPointTopExpansion=l);let c=XE(r.testPointBotExpan)?r.testPointBotExpan/10:.2;e.testPointBottomExpansion!==c&&(e.testPointBottomExpansion=c)}};var WCe=[.40157,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1.1811,.6,.6,.6,.6,.6,.6,1,.6,-1,-1,-1,.6,.6,.6,.6,.6,.6,.6,1,1.1811,.6,-1,-1,.6,.6,.6,.6,.6,.6,.6,1,.6,.6,.6,-1,1.18,1.18,1.18,1.18,1.18,1.18,1.18,1,1.18,1.18,1.18,-1,.6929,.6929,.6929,.6929,.6929,.6929,.6929,1,.6929,.6929,.6929,.6929],dVe=[.79921,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1.1811,.59843,.59843,.59843,.59843,.59843,.59843,1,.59843,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,1,.59843,.59843,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,1,.59843,.59843,.59843,-1,1.1811,1.1811,1.1811,1.1811,1.1811,1.1811,1.1811,1,1.1811,1.1811,1.1811,-1,.6929,.6929,.6929,.6929,.6929,.6929,.6929,1,.6929,.6929,.6929,.6929],pVe=[.35039,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1.1811,.59843,.59843,.59843,.59843,.59843,.59843,1,.59843,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,1,1.1811,.59843,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,1,.59843,.59843,.59843,-1,1.1811,1.1811,1.1811,1.1811,1.1811,1.1811,1.1811,1,1.1811,1.1811,1.1811,-1,.6929,.6929,.6929,.6929,.6929,.6929,.6929,1,.6929,.6929,.6929,.6929],qb={TWO_LAYERS_BOARD:"JLCPCB Capability(Two Layers Board)",SINGLE_LAYER_BOARD:"JLCPCB Capability(Single Layer Board)",MULTIPLE_LAYERS_BOARD:"JLCPCB Capability(Multiple Layers Board)",HIGH_FREQUENCY_BOARD:"JLCPCB Capability(High Frequency Board)",ALUMINUM_SUBSTRATE_BOARD:"JLCPCB Capability(Aluminum Substrate Board)",COPPER_SUBSTRATE_BOARD:"JLCPCB Capability(Copper Substrate Board)"};var pj=class o{static converArray2Obj(t){let e=t[0],r=t[1],i=[],n=0;if(r instanceof Array){let s=o.getTable(r);i.push({layerId:1,isOpen:1,content:s})}else{for(let s in r){let a=r[s],l=o.getTable(a);i.push({layerId:+s,isOpen:1,content:l})}Object.keys(r).length>1&&(n=1)}return{unit:e,isForAll:n,safeSpacing:i}}static getTable(t){let e=t;if(e.length==8){let i=Object.values(qb),n=te.getInstance().getRuleTemplateName();i.includes(n)&&(e[4][0]=11.811,e[5][4]=11.811),e.splice(1,0,e[1].slice(0));for(let s=2;s<e.length;s++)e[s].splice(1,0,e[s][1]);e.push([].concat(e[1][0],e.slice(1).map(s=>s[1])))}e[1].push(e[1][e[1].length-1]),e.splice(3,0,[...e[1]]),e.splice(4,0,[...e[2]]),e[1].pop();for(let i=5;i<e.length;i++)e[i].splice(3,0,e[i][1]),e[i].splice(4,0,e[i][2]);e[3][3]=e[1][1],e[4][3]=e[2][1],e[4][4]=e[2][2];let r=6;e.splice(7,0,new Array(7).fill(r));for(let i=7;i<e.length;i++)e[i].splice(7,0,r);return e}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r={unit:t.unit,isForAll:aVe(t.isForAll),safeSpacing:t.safeSpacing.map(l=>({layerId:l.layerId,isOpen:IT(l.isOpen),content:l.content}))},i=r.isForAll;e.status!==i&&(e.status=i);let n=new Map,s=new Map,a=!1;for(let l of r.safeSpacing){let{layerId:c,isOpen:h,content:u}=l,d=u.map(m=>m.map(g=>g/10)),p=e.tables.get(+c);(!p||JSON.stringify(p.data)!==JSON.stringify(d)||p.status!==h)&&(a=!0),n.set(+c,d),s.set(+c,h)}a&&e.overWriteTables(new qa(n,s))}};var fj=class{static converArray2Obj(t){let e=t[0],r=t[1],i=t[2];isNaN(i)&&(i=0);let n=t[3];return isNaN(n)&&(n=11.8),{unit:e,deviceClearance:r,thru2SmdClearance:i,holeClearance:n}}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t,i=r.deviceClearance/10,n=r.thru2SmdClearance/10;isNaN(n)&&(n=0);let s=r.holeClearance/10;isNaN(s)&&(s=1.18);let a=[i,n,s];JSON.stringify(e.clearances)!==JSON.stringify(a)&&(e.clearances=a)}};var mj=class{static converArray2Obj(t){let e=t[0],r=t[1],i=1,n=[];if(r instanceof Object)for(let s in r){let a=r[s];n.push({layerId:+s,stroMin:a[0],stroDef:a[1],stroMax:a[2]})}else n.push({layerId:1,stroMin:t[1],stroDef:t[2],stroMax:t[3]});return{unit:e,track:{isOpen:i,content:n}}}static decode(t,e){e.unit=t.unit;let r={unit:t.unit,track:{isOpen:IT(t.track.isOpen),content:t.track.content}},i=new Map,n=!1;for(let s of r.track.content){let a={minValue:s.stroMin/10,defaultValue:s.stroDef/10,maxValue:s.stroMax/10},l=e.toJSON().get(s.layerId);l&&JSON.stringify(l)!==JSON.stringify(a)&&(n=!0),i.set(s.layerId,a)}e.getLayerStatus()!==+r.track.isOpen&&e.setLayerStatus(+r.track.isOpen),n&&e.overWriteTables(new qa(i))}};var gj=class{static converArray2Obj(t){return{unit:t[0],netLenMin:t[1],netLenMax:t[2]}}static decode(t,e){e.unit!=t.unit&&(e.unit=t.unit);let r=t,i=r.netLenMin/10;e.netLengthMin!==i&&(e.netLengthMin=i);let n=r.netLenMax/10;e.netLengthMax!==n&&(e.netLengthMax=n)}};var yj=class{static converArray2Obj(t){return{unit:t[0],netLengthTolerance:t[1]}}static decode(t,e){e.unit!=t.unit&&(e.unit=t.unit);let i=t.netLengthTolerance/10;e.netLengthTolerance!=i&&(e.netLengthTolerance=i)}};var bj=class{static converArray2Obj(t){let e=t[0],r=t[1],i=1,n=[],s=[],a=0;if(r instanceof Object)for(let l in r){let c=r[l],{stroke:h,spacing:u,lenTolerMax:d}=c;n.push({layerId:+l,stroMin:h[0],stroDef:h[1],stroMax:h[2]}),s.push({layerId:+l,spacMin:u[0],spacDef:u[1]}),a=d}else n.push({layerId:1,stroMin:t[1],stroDef:t[2],stroMax:t[3]}),s.push({layerId:1,spacMin:t[4],spacDef:t[5]}),a=t[7];return{unit:e,stroWidth:{isOpen:i,content:n},spacing:{isOpen:i,content:s},differPairLenTolerMax:a}}static decode(t,e){e.unit!=t.unit&&(e.unit=t.unit);let r={unit:t.unit,stroWidth:{isOpen:IT(t.stroWidth.isOpen),content:t.stroWidth.content},spacing:{isOpen:IT(t.spacing.isOpen),content:t.spacing.content},differPairLenTolerMax:t.differPairLenTolerMax},i=e.toJSON(),n=new Map,s=!1;for(let h of r.stroWidth.content){let u={minValue:h.stroMin/10,defaultValue:h.stroDef/10,maxValue:h.stroMax/10},d=i.strokeWidthTables.tables.get(h.layerId);d&&JSON.stringify(d)!==JSON.stringify(u)&&(s=!0),n.set(h.layerId,u)}e.getLayerStatus(0)!==r.stroWidth.isOpen&&e.setLayerStatus(0,r.stroWidth.isOpen),s&&e.overWriteTables(0,new qa(n));let a=!1,l=new Map;for(let h of r.spacing.content){let u={minValue:h.spacMin/10,defaultValue:h.spacDef/10,maxValue:null},d=i.diffPairSpacingTables.tables.get(h.layerId);d&&JSON.stringify(d)!==JSON.stringify(u)&&(a=!0),l.set(h.layerId,u)}e.getLayerStatus(1)!==r.spacing.isOpen&&e.setLayerStatus(1,r.spacing.isOpen),a&&e.overWriteTables(1,new qa(l));let c=r.differPairLenTolerMax/10;e.differentialPairLenTolerMax!=c&&(e.differentialPairLenTolerMax=c)}};var Pj=class{static converArray2Obj(t){let e=new Array;for(let r of t){let i=+r[1],n=+r[2];isNaN(i)||i<=0||isNaN(n)||n<=0||i===n||i===1&&n===2||i===2&&n===1||e.push({name:r[0],staLayerId:i,endLayerId:n,viaSizeRule:r[3]})}return{blinds:{content:e}}}static decode(t,e){let r=t;for(let i of r.blinds.content){let n=+i.staLayerId,s=+i.endLayerId;if(isNaN(n)||n<=0||isNaN(s)||s<=0||n===s||n===1&&s===2||n===2&&s===1)continue;let a=!1,l=e.getBlindViaContentByName(i.name);l?JSON.stringify(l)!==JSON.stringify(i)&&(a=!0):a=!0,a&&e.addBlind(i.name,n,s,i.viaSizeRule)}}};var Tj=class{static converArray2Obj(t){return{unit:t[0],minRadius:t[1],defRadius:t[2],maxRadius:t[3],minInner:t[4],defInner:t[5],maxInner:t[6]}}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t,i=r.minRadius/10;e.minRadius!==i&&(e.minRadius=i);let n=r.defRadius/10;e.defalutRadius!==n&&(e.defalutRadius=n);let s=r.maxRadius/10;e.maxRadius!==s&&(e.maxRadius=s);let a=r.minInner/10;e.minInner!==a&&(e.minInner=a);let l=r.defInner/10;e.defalutInner!==l&&(e.defalutInner=l);let c=r.maxInner/10;e.maxInner!==c&&(e.maxInner=c)}};var Ij=class{static converArray2Obj(t){let e=[{layerId:1,connType:t[7]!==void 0?t[7].toString():t[3].toString(),spoWidth:t[8]!==void 0?t[8]:t[4],spoSpac:t[9]!==void 0?t[9]:t[5],spoAng:t[10]?t[10]:t[6]}];return{unit:t[0],mulPad:{isOpen:1,content:e}}}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t.mulPad,i={unit:t.unit,mulPad:{isOpen:IT(r.isOpen),content:r.content.map(a=>({layerId:a.layerId,connType:f4(a.connType),spoSpac:a.spoSpac,spoWidth:a.spoWidth,spoAng:a.spoAng,reserveDefData:a.reserveDefData}))}},n=new Map,s=!1;for(let a of i.mulPad.content){let l={connectMode:a.connType!==void 0?+a.connType.toString():+0 .toString(),lineAngle:a.spoAng?a.spoAng/180*Math.PI:.5*Math.PI,lineClearance:a.spoSpac!==void 0?a.spoSpac/10:1,lineWidth:a.spoWidth!==void 0?a.spoWidth/10:1},c=e.toJSON().tables.get(a.layerId);c&&JSON.stringify(c)!==JSON.stringify(l)&&(s=!0),n.set(a.layerId,l)}e.getLayerStatus()!==i.mulPad.isOpen&&e.setLayerStatus(i.mulPad.isOpen),s&&e.overWriteTables(new qa(n))}};var Cj=class{static converArray2Obj(t){let e=[{layerId:1,connType:t[3].toString(),spoWidth:t[4],spoSpac:t[5],spoAng:t[6]}],r=[{layerId:1,connType:t[7]}],i=[{layerId:1,connType:t[8]!==void 0?t[8].toString():t[3].toString(),spoWidth:t[9]!==void 0?t[9]:t[4],spoSpac:t[10]!==void 0?t[10]:t[5],spoAng:t[11]?t[11]:t[6]}];return{unit:t[0],sglPad:{isOpen:1,content:e},mulPad:{isOpen:1,content:i},track:{isOpen:1,content:r}}}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t.sglPad,i=t.mulPad,n=t.track,s={unit:t.unit,sglPad:{isOpen:IT(r.isOpen),content:r.content.map(m=>({layerId:m.layerId,connType:f4(m.connType),spoSpac:m.spoSpac,spoWidth:m.spoWidth,spoAng:m.spoAng}))},mulPad:{isOpen:IT(i.isOpen),content:i.content.map(m=>({layerId:m.layerId,connType:f4(m.connType),spoSpac:m.spoSpac,spoWidth:m.spoWidth,spoAng:m.spoAng}))},track:{isOpen:IT(n.isOpen),content:n.content.map(m=>({layerId:m.layerId,connType:oVe(m.connType)}))}},a=e.toJSON(),l=!1,c=new Map;for(let m of s.sglPad.content){let g={connectMode:m.connType,lineAngle:m.spoAng/180*Math.PI,lineClearance:m.spoSpac/10,lineWidth:m.spoWidth/10},y=a.singleLayerPadModel.tables.get(m.layerId);y&&JSON.stringify(y)!==JSON.stringify(g)&&(l=!0),c.set(m.layerId,g)}e.getLayerStatus(0)!==s.sglPad.isOpen&&e.setLayerStatus(0,s.sglPad.isOpen),l&&e.overWriteTables(new qa(c),0);let h=!1,u=new Map;for(let m of s.mulPad.content){let g={connectMode:+m.connType.toString(),lineWidth:m.spoWidth/10,lineClearance:m.spoSpac/10,lineAngle:m.spoAng/180*Math.PI},y=a.multiLayerPadModel.tables.get(m.layerId);y&&JSON.stringify(y)!==JSON.stringify(g)&&(h=!0),u.set(m.layerId,g)}e.getLayerStatus(1)!==s.mulPad.isOpen&&e.setLayerStatus(1,s.mulPad.isOpen),h&&e.overWriteTables(new qa(u),1);let d=!1,p=new Map;for(let m of s.track.content){let g=a.trackConnectModel.tables.get(m.layerId);g!=null&&g!==m.connType&&(d=!0),p.set(m.layerId,m.connType)}e.getLayerStatus(2)!==s.track.isOpen&&e.setLayerStatus(2,s.track.isOpen),d&&e.overWriteTables(new qa(p),2)}};var Sj=class{static converArray2Obj(t){return{unit:t[0],padTopExpan:t[1],padBotExpan:t[2],testPointTopExpan:XE(t[3])?t[3]:-1e3,testPointBotExpan:XE(t[4])?t[4]:-1e3}}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t,i=r.padTopExpan/10;e.padTopExpansion!==i&&(e.padTopExpansion=i);let n=r.padBotExpan/10;e.padBottomExpansion!==n&&(e.padBottomExpansion=n);let s=XE(r.testPointTopExpan)?r.testPointTopExpan/10:-100;e.testPointTopExpansion!==s&&(e.testPointTopExpansion=s);let a=XE(r.testPointBotExpan)?r.testPointBotExpan/10:-100;e.testPointBottomExpansion!==a&&(e.testPointBottomExpansion=a)}};var Fre=class{static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t,i=r.creepageDistance/10;e.creepageDistance!==i&&(e.creepageDistance=i);let n=r.ignoreLayer;e.ignoreLayer!==n&&(e.ignoreLayer=n)}};var Ej=class o extends $l{get hashkey(){return this.index}clear(){this.type=null,this.name=null,this.isDefault=null,this.context=null}feed(t){let{ruleType:e,ruleName:r,ruleState:i,ruleContext:n}=t;this.type=nR(e),this.name=r,this.index=[e,r].toString();let s=RFe(i);s===0?this.isDefault=!1:s===1&&(this.isDefault=!0),this.context=n}check(){return this.type==null||this.name==null||this.context==null?!1:(this.isDefault==null&&(this.isDefault=!1),!0)}finish(){if(this.check())switch(this.type){case"1":return this.getSafeSpacing();case"2":return this.getOtherSpacing();case"14":return this.getCreepageSpacing();case"3":return this.getTrackPhysics();case"11":return this.getNetLengthPhysics();case"13":return this.getNetLengthTolerancePhysics();case"10":return this.getDifferentailPhysics();case"4":return this.getBlind();case"5":return this.getRadius();case"6":return this.getPlane();case"7":return this.getCopper();case"8":return this.getPaste();case"9":return this.getSolder();case"12":return this.getAutoRouter()}return null}toJson(){return{name:this.name,type:this.type,isDefault:this.isDefault,context:this.context}}conver2Obj(t){if(!(this.context instanceof Array))return null;switch(this.type){case"1":{this.context=pj.converArray2Obj(this.context),this.isDefault&&t.addDefaultSafeSpaceData(this.context);break}case"2":{this.context=fj.converArray2Obj(this.context);break}case"3":{this.context=mj.converArray2Obj(this.context);break}case"11":{this.context=gj.converArray2Obj(this.context);break}case"13":{this.context=yj.converArray2Obj(this.context);break}case"10":this.context instanceof Array&&(this.context=bj.converArray2Obj(this.context));break;case"4":{this.context=Pj.converArray2Obj(this.context);break}case"5":{this.context=Tj.converArray2Obj(this.context);break}case"6":{let e=this.context[1],r=this.context[2];this.isDefault&&t.addDefaultInnerSpace(e,r),t.addInner2SafeChangeMap(this.name,"Plane_"+this.name,this.isDefault,e,r),this.context=Ij.converArray2Obj(this.context);break}case"7":{let e=this.context[1],r=this.context[2];this.isDefault&&t.addDefaultCopperSpace(e,r),t.addCopper2SafeChangeMap(this.name,"Copper_"+this.name,this.isDefault,e,r),this.context=Cj.converArray2Obj(this.context);break}case"8":{this.context=Sj.converArray2Obj(this.context);break}case"9":{this.context=dj.converArray2Obj(this.context);break}case"12":break}}getNewRuleDecode(t){if(!t.init)return null;switch(this.type){case"1":return t.fixSafeData(this.context),null;case"6":return this.getSafeDecode4Plane(!1,t);case"7":return this.getSafeDecode4Plane(!0,t);default:return null}}getSafeDecode4Plane(t,e){let r=t?"Copper_":"Plane_",i=new o;i.type="1",i.name=r+this.name,i.isDefault=!1;let n=e.getNewDefaultData(t,this.name);return n==null?null:(i.context={unit:e.defaultSafeData.unit,isForAll:0,safeSpacing:[{layerId:1,isOpen:1,content:n}]},i)}getSafeSpacing(){let t=te.getInstance(),e=te.getInstance().getSafeSpacing(this.name);return e==null&&(e=te.getInstance().addSafeSpacing(this.name)),this.isDefault&&t.getDefaultSafeSpacing()!=e&&t.getDefaultSafeSpacing()!=null&&t.deleteSafeSpacing(t.getDefaultSafeSpacing().name),pj.decode(this.context,e),e.isDefault=this.isDefault,e}getOtherSpacing(){let t=te.getInstance(),e=t.getOtherSpacing(this.name);return e==null&&(e=t.addOtherSpacing(this.name)),this.isDefault&&t.getDefaultOtherSpacing()!=e&&t.getDefaultOtherSpacing()!=null&&t.deleteOtherSpacing(t.getDefaultOtherSpacing().name),fj.decode(this.context,e),e.isDefault=this.isDefault,e}getCreepageSpacing(){let t=te.getInstance(),e=t.getCreepageSpacing(this.name);return e==null&&(e=t.addCreepageSpacing(this.name)),this.isDefault&&t.getDefaultCreepageSpacing()!=e&&t.getDefaultCreepageSpacing()!=null&&t.deleteCreepageSpacing(t.getDefaultCreepageSpacing().name),Fre.decode(this.context,e),e.isDefault=this.isDefault,e}getTrackPhysics(){let t=te.getInstance(),e=t.getTrackPhysics(this.name);return e==null&&(e=t.addTrackPhysics(this.name)),this.isDefault&&t.getDefaultTrackPhysics()!=e&&t.getDefaultTrackPhysics()!=null&&t.deleteTrackPhysics(t.getDefaultTrackPhysics().name),mj.decode(this.context,e),e.isDefault=this.isDefault,e}getNetLengthPhysics(){let t=te.getInstance(),e=t.getNetLengthPhysics(this.name);return e==null&&(e=t.addNetLengthPhysics(this.name)),this.isDefault&&t.getDefaultNetLengthPhysics()!=e&&t.getDefaultNetLengthPhysics()!=null&&t.deleteNetLengthPhysics(t.getDefaultNetLengthPhysics().name),gj.decode(this.context,e),e.isDefault=this.isDefault,e}getNetLengthTolerancePhysics(){let t=te.getInstance(),e=t.getNetLengthTolerancePhysics(this.name);return e==null&&(e=t.addNetLengthTolerancePhysics(this.name)),this.isDefault&&t.getDefaultNetLengthTolerancePhysics()!=e&&t.getDefaultNetLengthTolerancePhysics()!=null&&t.deleteNetLengthTolerancePhysics(t.getDefaultNetLengthTolerancePhysics().name),yj.decode(this.context,e),e.isDefault=this.isDefault,e}getDifferentailPhysics(){let t=te.getInstance(),e=t.getDifferentialPhysics(this.name);return e==null&&(e=t.addDifferentialPhysics(this.name)),this.isDefault&&t.getDefaultDifferentialPhysics()!=e&&t.getDefaultDifferentialPhysics()!=null&&t.deleteDifferentialPhysics(t.getDefaultDifferentialPhysics().name),bj.decode(this.context,e),e.isDefault=this.isDefault,e}getBlind(){let t=te.getInstance(),e=t.getBlindPhysics(this.name);return e==null&&(e=t.addBlindPhysics(this.name)),this.isDefault&&t.getDefaultBlindPhysics()!=e&&t.getDefaultBlindPhysics()!=null&&t.deleteBlindPhysics(t.getDefaultBlindPhysics().name),Pj.decode(this.context,e),e.isDefault=this.isDefault,e}getRadius(){let t=te.getInstance(),e=t.getRadiusPhysics(this.name);return e==null&&(e=t.addRadiusPhysics(this.name)),this.isDefault&&t.getDefaultRadiusPhysics()!=e&&t.getDefaultRadiusPhysics()!=null&&t.deleteRadiusPhysics(t.getDefaultRadiusPhysics().name),Tj.decode(this.context,e),e.isDefault=this.isDefault,e}getPlane(){let t=te.getInstance(),e=t.getInnerPlane(this.name);return e==null&&(e=t.addInnerPlane(this.name)),this.isDefault&&t.getDefaultInnerPlane()!=e&&t.getDefaultInnerPlane()!=null&&t.deleteInnerPlane(t.getDefaultInnerPlane().name),Ij.decode(this.context,e),e.isDefault=this.isDefault,e}getCopper(){let t=te.getInstance(),e=t.getCopperPlane(this.name);return e==null&&(e=t.addCopperPlane(this.name)),this.isDefault&&t.getDefaultCopperPlane()!=e&&t.getDefaultCopperPlane()!=null&&t.deleteCopperPlane(t.getDefaultCopperPlane().name),Cj.decode(this.context,e),e.isDefault=this.isDefault,e}getPaste(){let t=te.getInstance(),e=t.getPasteExpansion(this.name);return e==null&&(e=t.addPasteExpansion(this.name)),this.isDefault&&t.getDefaultPasteExpansion()!=e&&t.getDefaultPasteExpansion()!=null&&t.deletePasteExpansion(t.getDefaultPasteExpansion().name),Sj.decode(this.context,e),e.isDefault=this.isDefault,e}getSolder(){let t=te.getInstance(),e=t.getSolderExpansion(this.name);return e==null&&(e=t.addSolderExpansion(this.name)),this.isDefault&&t.getDefaultSolderExpansion()!=e&&t.getDefaultSolderExpansion()!=null&&t.deleteSolderExpansion(t.getDefaultSolderExpansion().name),dj.decode(this.context,e),e.isDefault=this.isDefault,e}getAutoRouter(){let t=wFe(this.context.routingCorner),e=this.context.isKeep,r=MFe(this.context.viaQuantity),i=kFe(this.context.routingEffectPriority),n=0,s=this.context.layers,a=this.context.ignoreNets,l={routingCorner:t,isKeep:e,viaQuatity:r,routingEffectPriority:i,routingNetPriority:n,layers:s,ignoreNets:a,routingRange:0},c=te.getInstance(),h=c.getAutoRouter(this.name)||c.addAutoRouter(this.name,l);return Object.assign(h,l),this.isDefault&&c.getDefaultAutoRouter()!=h&&c.getDefaultAutoRouter()!=null&&c.deleteAutoRouter(c.getDefaultAutoRouter().name),h}};var jI=te.getInstance(),Vre=class extends $l{get hashkey(){return this.index}feed(t){let{ruleSelect:e,ruleOrder:r,ruleKeyValue:i,copperValue:n,innerPlaneValue:s}=t;this.isNumber(r)&&(this.order=r),this.index=e.toString(),this.keyValue={};for(let a in i)this.keyValue[nR(a)]=i[a];this.copperRuleValue={};for(let a in n)this.copperRuleValue[nR(a)]=n[a];this.innerPlaneRuleValue={};for(let a in s)this.innerPlaneRuleValue[nR(a)]=s[a];this.select=e}versionUpgrades(t){let e=this.select[0];if(this.order==4){if(e==="NET_CLASS"||e==="NET"||e==="EQ_LEN_GRP"){for(let r in this.keyValue)String(r)==="7"&&(this.copperRuleValue={"7":t.getSafeName4Copper(this.keyValue[r])}),String(r)==="6"&&(this.innerPlaneRuleValue={"6":t.getSafeName4Plane(this.keyValue[r])});this.copperRuleValue["7"]==null&&(this.copperRuleValue={"7":t.getDefaultCopper()}),this.innerPlaneRuleValue["6"]==null&&(this.innerPlaneRuleValue={"6":t.getDefaultPlane()})}}else for(let r in this.keyValue){if(String(r)==="7"){let i=this.keyValue[r],n=t.getSafeName4Copper(i);if(n==null&&i=="default"&&(n=t.getDefaultCopper()),n==null)continue;this.copperRuleValue={"7":n}}if(String(r)==="6"){let i=this.keyValue[r],n=t.getSafeName4Plane(i);if(n==null&&i=="default"&&(n=t.getDefaultPlane()),n==null)continue;this.innerPlaneRuleValue={"6":n}}}}check(){if(this.order===void 0||isNaN(this.order)||!Array.isArray(this.select)||this.keyValue===null||typeof this.keyValue!="object")return!1;let t=!0;if(this.order==2&&this.select[0]==="POUR"){t=!1;for(let r in this.keyValue)t=!0;for(let r in this.copperRuleValue)t=!0;for(let r in this.innerPlaneRuleValue)t=!0}return!!t}finish(){if(!this.check())return;let t=te.getInstance(),e=this.select[0],r=this.select[1];if(this.order==4){if(e==="NET_CLASS"){let i=t.getNetClass(r);i==null&&(i=t.addNetClass(r));for(let n in this.keyValue)this.modifyCommonRule(i,n,this.keyValue[n]);for(let n in this.copperRuleValue)String(n)==="7"&&(i.safeCopperPlane=this.copperRuleValue[n]);for(let n in this.innerPlaneRuleValue)String(n)==="6"&&(i.safeInnerPlane=this.innerPlaneRuleValue[n]);return i}else if(e==="DIFF_PAIR"){let i=t.getNetDifferential(r);i==null&&(i=t.addNetDifferential(r));for(let n in this.keyValue)this.modifyCommonRule(i,n,this.keyValue[n]);return i}else if(e==="EQ_LEN_GRP"){let i=t.getEqualLengthGroup(r);i==null&&(i=t.addEqualLengthGroup(r));for(let n in this.keyValue)this.modifyCommonRule(i,n,this.keyValue[n]);for(let n in this.copperRuleValue)String(n)==="7"&&(i.safeCopperPlane=this.copperRuleValue[n]);for(let n in this.innerPlaneRuleValue)String(n)==="6"&&(i.safeInnerPlane=this.innerPlaneRuleValue[n]);return i}else if(e==="NET"){if(r==null)return;let i=t.getNet(r);i==null&&(i=t.addNet(r));for(let n in this.keyValue)this.modifyCommonRule(i,n,this.keyValue[n]);for(let n in this.copperRuleValue)String(n)==="7"&&(i.safeCopperPlane=this.copperRuleValue[n]);for(let n in this.innerPlaneRuleValue)String(n)==="6"&&(i.safeInnerPlane=this.innerPlaneRuleValue[n]);return i}}else if(this.order==3){let i=this.select[0],n=this.select[1];if(i[0]==null||n[0]==null)return;let s=this.getNetType(i[0]),a=this.getNetType(n[0]),l=t.betweenNetRule.getRule(i[1],n[1]);l||(l=new kg(s,i[1],a,n[1]),t.betweenNetRule.addRule(l));for(let c in this.keyValue)c==="1"&&(l.ruleName=this.keyValue[c]),c==="14"&&(l.creepageRule=this.keyValue[c]);for(let c in this.copperRuleValue)String(c)==="7"&&(l.safeCopperPlane=this.copperRuleValue[c]);for(let c in this.innerPlaneRuleValue)String(c)==="6"&&(l.safeInnerPlane=this.innerPlaneRuleValue[c]);return l}else if(this.order==2){if(e==="POUR"){let i=r,n=t.addRegionSelector(i);for(let s in this.keyValue)this.modifyRegionCommonRule(n,s,this.keyValue[s]);for(let s in this.copperRuleValue)String(s)==="7"&&(n.safeClearance=this.copperRuleValue[s]);for(let s in this.innerPlaneRuleValue)String(s)==="6"&&(n.safeClearance=this.innerPlaneRuleValue[s]);return n}else if(e==="REGION"){let i=r,n=t.addConstraintSelector(i);for(let s in this.keyValue)this.modifyRegionCommonRule(n,s,this.keyValue[s]);for(let s in this.copperRuleValue)String(s)==="7"&&(n.safeCopperPlane=this.copperRuleValue[s]);for(let s in this.innerPlaneRuleValue)String(s)==="6"&&(n.safeInnerPlane=this.innerPlaneRuleValue[s]);return n}}return null}getNetType(t){switch(t){case"NET":return"net";case"NET_CLASS":return"netClass";case"EQ_LEN_GRP":return"equalLengthGroup"}}modifyCommonRule(t,e,r){let i=this.getRuleName4NetModel(e,r);switch(e){case"1":t.safeSpacing!==i&&(t.safeSpacing=i);break;case"3":t.trackPhysics!==i&&(t.trackPhysics=i);break;case"11":t.netLengthPhysics!==i&&(t.netLengthPhysics=i);break;case"13":t.netLengthTolerancePhysics!==i&&(t.netLengthTolerancePhysics=i),t.targetNet=r instanceof Array?r[1]:null;break;case"10":t.differentialPhysics!==i&&(t.differentialPhysics=i);break;case"4":t.blindViaPhysics!==i&&(t.blindViaPhysics=i);break;case"5":t.radiusPhysics!==i&&(t.radiusPhysics=i);break;case"6":t.innerPlane!==i&&(t.innerPlane=i);break;case"7":t.copperPlane!==i&&(t.copperPlane=i);break;case"8":t.pasteExpansion!==i&&(t.pasteExpansion=i);break;case"9":t.solderExpansion!==i&&(t.solderExpansion=i);break;case"14":t.creepageSpacing!==i&&(t.creepageSpacing=i);break}}modifyCommonRuleClear(t){t.safeSpacing="default",t.trackPhysics="default",t.netLengthPhysics="default",t.netLengthTolerancePhysics=null,t.targetNet=null,t.differentialPhysics="default",t.blindViaPhysics="default",t.radiusPhysics="default",t.innerPlane="default",t.copperPlane="default",t.pasteExpansion="default",t.solderExpansion="default",t.creepageSpacing="default"}modifyCopperRule(t,e,r){switch(e){case"7":t.safeCopperPlane!=r&&(t.safeCopperPlane=r);break}}modifyInnerPlaneRule(t,e,r){switch(e){case"6":t.safeInnerPlane!=r&&(t.safeInnerPlane=r);break}}modifyRegionCommonRule(t,e,r){switch(e){case"1":t.safeClearance!==r&&(t.safeClearance=r);break;case"2":t.otherClearance!==r&&(t.otherClearance=r);break;case"3":t.track!==r&&(t.track=r);break;case"10":t.diff!==r&&(t.diff=r);break;case"5":t.radius!==r&&(t.radius=r);break;case"6":t.innerPlane!==r&&(t.innerPlane=r);break;case"7":t.copperPlane!==r&&(t.copperPlane=r);break;case"14":t.creepageClearance!==r&&(t.creepageClearance=r);break}}modifyRegionCommonRuleClear(t){t.safeClearance=null,t.otherClearance=null,t.track=null,t.diff=null,t.radius=null,t.innerPlane=null,t.copperPlane=null,t.creepageClearance=null}modifyRegionCopperRule(t,e,r){switch(e){case"1":t.safeCopperPlane=r;break}}modifyRegionInnerPlaneRule(t,e,r){switch(e){case"1":t.safeInnerPlane=r;break}}getRuleName4NetModel(t,e){let r,i=e instanceof Array?e[0]:e;switch(t){case"1":r=jI.getSafeSpacing(i);break;case"3":r=jI.getTrackPhysics(i);break;case"11":r=jI.getNetLengthPhysics(i);break;case"13":r=jI.getNetLengthTolerancePhysics(i);break;case"10":r=jI.getDifferentialPhysics(i);break;case"4":r=jI.getBlindPhysics(i);break;case"5":r=jI.getRadiusPhysics(i);break;case"6":r=jI.getInnerPlane(i);break;case"7":r=jI.getCopperPlane(i);break;case"8":r=jI.getPasteExpansion(i);break;case"9":r=jI.getSolderExpansion(i);break;case"14":r=jI.getCreepageSpacing(i);break}return t=="13"&&r==null?null:r!=null&&!r.isDefault?i:"default"}getRule(t,e){let r=te.getInstance(),i=t[0],n=t[1];if(e==4){if(i==="NET_CLASS"){let s=r.getNetClass(n);return s==null&&(s=r.addNetClass(n)),s}else if(i==="DIFF_PAIR"){let s=r.getNetDifferential(n);return s==null&&(s=r.addNetDifferential(n)),s}else if(i==="EQ_LEN_GRP"){let s=r.getEqualLengthGroup(n);return s==null&&(s=r.addEqualLengthGroup(n)),s}else if(i==="NET"){if(n==null)return;let s=r.getNet(n);return s==null&&(s=r.addNet(n)),s}}else if(e==3){let s=t[0],a=t[1];if(s[0]==null||a[0]==null)return;let l=this.getNetType(s[0]),c=this.getNetType(a[0]),h=r.betweenNetRule.getRule(s[1],a[1]);return h==null&&(h=new kg(l,s[1],c,a[1]),r.betweenNetRule.addRule(h)),h}else if(e==2){if(i==="POUR"){let s=n;return r.addRegionSelector(s)}else if(i==="REGION"){let s=n;return r.addConstraintSelector(s)}}}needUpdate(t,e){if(t==4||t==2)switch(e){case"NET_CLASS":case"NET":case"EQ_LEN_GRP":case"POUR":case"REGION":return!0}else if(t==3)return!0;return!1}loadKeyValue(t,e,r,i){if(r==4||r==2)switch(i){case"NET_CLASS":case"DIFF_PAIR":case"EQ_LEN_GRP":case"NET":this.modifyCommonRuleClear(t);break;case"POUR":case"REGION":this.modifyRegionCommonRuleClear(t);break}for(let n in e){let s=e[n];if(r==4||r==2)switch(i){case"NET_CLASS":case"DIFF_PAIR":case"EQ_LEN_GRP":case"NET":this.modifyCommonRule(t,n,s);break;case"POUR":case"REGION":this.modifyRegionCommonRule(t,n,s);break}else if(r==3)switch(n){case"1":t.ruleName!==s&&(t.ruleName=s);break;case"14":t.creepageRule!==s&&(t.creepageRule=s);break}}}loadCopperRuleValue(t,e,r,i){let n=this.needUpdate(r,i);t.safeCopperPlane&&n&&(e==null?void 0:e["7"])==null&&this.modifyCopperRule(t,"7",null);for(let s in e){let a=e[s];n&&this.modifyCopperRule(t,s,a)}}loadInnerPlaneRuleValue(t,e,r,i){let n=this.needUpdate(r,i);t.safeInnerPlane&&n&&(e==null?void 0:e["6"])==null&&this.modifyInnerPlaneRule(t,"6",null);for(let s in e){let a=e[s];n&&this.modifyInnerPlaneRule(t,s,a)}}load(){if(!this.resultNeedToBeCached)return;let t=this.getRule(this.select,this.order);this.loadKeyValue(t,this.keyValue,this.order,this.select[0]),this.loadCopperRuleValue(t,this.copperRuleValue,this.order,this.select[0]),this.loadInnerPlaneRuleValue(t,this.innerPlaneRuleValue,this.order,this.select[0])}};var Gre=class extends $l{constructor(){super(...arguments);this.origin=S.ORIGIN;this.highlightValue=.5}get hashkey(){return null}feed(e){let{originX:r,originY:i,unit:n,gridXSize:s,gridYSize:a,snapXSize:l,snapYSize:c,altSnapXSize:h,altSnapYSize:u,gridType:d,multiGridType:p,multiGridRatio:m,highlightValue:g}=e;(this.isNumber(r)||this.isNumber(i))&&(this.origin=new S(r/10,i/10)),this.unit=n,this.isNumber(s)&&(this.gridX=s/10),this.isNumber(a)&&(this.gridY=a/10),this.isNumber(l)?this.snapX=l/10:this.snapX=this.gridX,this.isNumber(c)?this.snapY=c/10:this.snapY=this.gridY,this.isNumber(h)?this.altSnapX=h:this.altSnapX=this.gridX,this.isNumber(u)?this.altSnapY=u:this.altSnapY=this.gridY,this.isNumber(g)&&(this.highlightValue=g),this.gridType=VCe(d),this.multiGridType=VCe(p),this.multiGridRatio=m}check(){return!(!(this.unit==="mm"||this.unit==="mil")||this.gridX===void 0||isNaN(this.gridX)||this.gridY===void 0||isNaN(this.gridY)||this.snapX===void 0||isNaN(this.snapX)||this.snapY===void 0||isNaN(this.snapY)||this.altSnapX===void 0||isNaN(this.altSnapX)||this.altSnapY===void 0||isNaN(this.altSnapY)||this.gridType==null||this.multiGridType==null||this.multiGridRatio<0||isNaN(this.multiGridRatio))}finish(){x.getInstance().origin=this.origin,x.getInstance().unit=this.unit,x.getInstance().forceValue=this.highlightValue,St.getInstance().setGridX(this.gridX),St.getInstance().setGridY(this.gridY),St.getInstance().setSnapX(this.snapX),St.getInstance().setSnapY(this.snapY);let e={GridX:{number:this.altSnapX,unit:this.unit},GridY:{number:this.altSnapY,unit:this.unit}};x.getInstance().altGridSize=e,x.getInstance().gridType=this.gridType,x.getInstance().multiType=this.multiGridType,x.getInstance().multiRatio=this.getGridRatio(+this.multiGridRatio),Ni().setTarget(new Mt(this.origin.x,this.origin.y,0))}getGridTypeByNum(e){switch(e){case 0:return"none";case 1:return"grid";case 2:return"outlets"}return"none"}getGridRatio(e){return e>=1?e:5}loadOrigin(e){this.model.origin.equals(e)||(this.model.origin=e)}loadUnit(e){this.model instanceof XI||this.model.unit!==e&&(this.model.unit=e)}load(){this.loadOrigin(this.origin),this.loadUnit(this.unit)}};var o3t=.001/180*Math.PI,y8=class{constructor(){this.deltaAngle=o3t;this.minLength=.01}fixStart(t,e,r,i,n){let s=t.sub(e).normalize(),a=i.sub(e).normalize(),l=Math.acos(s.dot(a));if(Math.abs(r*l)>this.minLength&&l>this.deltaAngle)return t;{let h=this.minLength/r,u=Math.max(h,this.deltaAngle),d=t.angle(e),p=i.angle(e),m=this.getAngle(n,d,p);return Math.abs(m)>Math.PI?n===le.CCW?d=p+u:d=p-u:n===le.CCW?d=p-u:d=p+u,new S(Math.cos(d),Math.sin(d)).mul(r).add(e)}}fixEnd(t,e,r,i,n){let s=i.sub(e).normalize(),a=t.sub(e).normalize(),l=Math.acos(s.dot(a));if(Math.abs(r*l)>this.minLength&&l>this.deltaAngle)return t;{let h=this.minLength/r,u=Math.max(h,this.deltaAngle),d=i.angle(e),p=t.angle(e),m=this.getAngle(n,d,p);return Math.abs(m)>Math.PI?n===le.CCW?p=d-u:p=d+u:n===le.CCW?p=d+u:p=d-u,new S(Math.cos(p),Math.sin(p)).mul(r).add(e)}}fixStartAngle(t,e,r,i){let n=this.getAngle(i,t,r),s=Vr-n;if(s=Math.min(s,n),Math.abs(e*s)>this.minLength&&s>this.deltaAngle)return t;{let l=this.minLength/e,c=Math.max(l,this.deltaAngle);return Math.abs(n)>Math.PI?i===le.CCW?t=r+c:t=r-c:i===le.CCW?t=r-c:t=r+c,t}}fixEndAngle(t,e,r,i){let n=this.getAngle(i,r,t),s=Vr-n;if(s=Math.min(s,n),Math.abs(e*s)>this.minLength&&s>this.deltaAngle)return t;{let l=this.minLength/e,c=Math.max(l,this.deltaAngle);return Math.abs(n)>Math.PI?i===le.CCW?t=r-c:t=r+c:i===le.CCW?t=r+c:t=r-c,t}}getAngle(t,e,r){r=(r%Vr+Vr)%Vr,e=(e%Vr+Vr)%Vr;let i=0;return t==le.CCW?i=(r-e+Vr)%Vr:i=(e-r+Vr)%Vr,(i%Vr+Vr)%Vr}};var s3t=new y8,b8=class o{constructor(t,e,r,i,n,s=1){this._center=t,this._radius=e,this._startAngle=B1(r),this._endAngle=B1(i),this._sweep=n,this._arcType=s}get center(){return this._center}set center(t){this._center!=t&&(this._center=t)}get radius(){return this._radius}set radius(t){t==0&&(t=1e-8),this._radius!=t&&(this._radius=t)}get startAngle(){return this._startAngle}set startAngle(t){t=B1(t),this._startAngle!=t&&(this._startAngle=t)}get endAngle(){return this._endAngle}set endAngle(t){t=B1(t),this._endAngle!=t&&(this._endAngle=t)}get sweep(){return this._sweep}set sweep(t){this._sweep!=t&&(this._sweep=t)}get arcType(){return this._arcType}set arcType(t){this._arcType=t}get angle(){let t=new ro,{angle:e}=t.angleToPoint(this.center,this.radius,this.startAngle,this.endAngle,this.sweep);return e}set angle(t){let e=new ro,{center:r,radius:i,startAngle:n,endAngle:s,sweep:a}=e.pointToAngle(this.start,this.end,t);this.center=r,this.radius=i,this.startAngle=n,this.endAngle=s,this.sweep=a}get sweepAngle(){let t=this.startAngle,e=this.endAngle;return this.sweep===le.CCW?e<=t&&(e+=Vr):e>=t&&(t+=Vr),e-t}get start(){return this.center.add(new S(Math.cos(this.startAngle),Math.sin(this.startAngle)).mul(this.radius))}set start(t){t=s3t.fixStart(t,this.center,this.radius,this.end,this.sweep);let e=this.end,r=this.start,i=this.midPoint,n=e.distance2(t),s=Math.sqrt(i.distance2(r)-e.distance2(r)/4);isNaN(s)&&(s=1e-4);let a=s/2+n/s/8;a==0&&(a=1e-8),this.radius=a;let l=e.sub(t),c=t.add(e).mul(.5),h;this.sweep==le.CCW?h=new S(-l.y,l.x).normalize():h=new S(l.y,-l.x).normalize();let u=c.add(h.mul(a-s));this.center=u;let d=t.sub(u).normalize(),p=e.sub(u).normalize();this.startAngle=Math.atan2(d.y,d.x),this.endAngle=Math.atan2(p.y,p.x)}get end(){return this.center.add(new S(Math.cos(this.endAngle),Math.sin(this.endAngle)).mul(this.radius))}set end(t){let e=this.end,r=this.start,i=this.midPoint,n=t.distance2(r),s=Math.sqrt(i.distance2(r)-e.distance2(r)/4);isNaN(s)&&(s=1e-4);let a=s/2+n/s/8;a==0&&(a=1e-8),this.radius=a;let l=t.sub(r),c=r.add(t).mul(.5),h;this.sweep==le.CCW?h=new S(-l.y,l.x).normalize():h=new S(l.y,-l.x).normalize();let u=c.add(h.mul(a-s));this.center=u;let d=r.sub(u).normalize(),p=t.sub(u).normalize(),m=Math.atan2(d.y,d.x),g=Math.atan2(p.y,p.x);this.startAngle=m,this.endAngle=g}get length(){return Math.abs(this.radius*this.sweepAngle*Math.PI/Math.PI)}set length(t){let e=t/this.radius;this.sweep==le.CCW?this.endAngle=this.startAngle+e:this.endAngle=this.startAngle-e}get midPoint(){let t=this.startAngle,e=this.endAngle,r=this.sweep,i=this.center,n=this.radius;if(r==le.CCW)if(e>t){let s=(e-t)/2+t;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(e+Vr-t)/2+t;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}}else if(e>t){let s=(t+Vr-e)/2+e;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(t-e)/2+e;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}}}set midPoint(t){let e=this.end,r=this.start,i=this.midPoint,n=e.sub(r),s;this.sweep==le.CCW?s=new S(-n.y,n.x).normalize():s=new S(n.y,-n.x).normalize();let a=t.sub(i),l=s.mul(a.dot(s)),c=i.add(l),h=e.distance2(r),u=Math.sqrt(c.distance2(r)-e.distance2(r)/4);isNaN(u)&&(u=1e-4);let d=u/2+h/u/8;d==0&&(d=1e-8),this.radius=d;let p=r.add(e).mul(.5),m=i.sub(p),g=c.sub(p);m.dot(g)<0&&(this.sweep==le.CCW?this.sweep=le.CW:this.sweep=le.CCW),this.sweep==le.CCW?s=new S(-n.y,n.x).normalize():s=new S(n.y,-n.x).normalize();let b=p.add(s.mul(d-u));this.center=b;let P=r.sub(b).normalize(),T=e.sub(b).normalize(),I=Math.atan2(P.y,P.x),C=Math.atan2(T.y,T.x);this.startAngle=I,this.startAngle=C}get primitive(){return this.arcType==1?q.build2(this.center,this.startAngle/Math.PI*180,this.endAngle/Math.PI*180,this.radius,this.radius,this.sweep):Q9.build2(this.center,this.startAngle/Math.PI*180,this.endAngle/Math.PI*180,this.radius,this.radius,this.sweep)}getAngle(){return this.sweep==le.CCW?(this.endAngle-this.startAngle+Vr)%Vr:(this.startAngle-this.endAngle+Vr)%Vr}setStartAngleAndEndAngle(t,e){this.startAngle=t,this.endAngle=e}transform(t){this._center=this._center.multiply4(t);let r=t.data[0]*t.data[5]-t.data[1]*t.data[4]<0,i=r?Math.atan2(-t.data[1],-t.data[0]):Math.atan2(t.data[1],t.data[0]);r?(this._sweep=this._sweep==le.CCW?le.CW:le.CCW,this._startAngle=B1(Math.PI-(this._startAngle+i)),this._endAngle=B1(Math.PI-(this._endAngle+i))):(this._startAngle=B1(this._startAngle+i),this._endAngle=B1(this._endAngle+i))}inShape(t,e,r,i){r<.05&&i!=null&&(r=10/i.getScale());let n=this.sweep==le.CW,s=n?this.endAngle:this.startAngle,a=n?this.startAngle:this.endAngle;s%=Vr,s<0&&(s+=Vr),a%=Vr,a<0&&(a+=Vr);let l=this.radius-r/2,c=this.radius+r/2,h=t-this.center.x,u=e-this.center.y,d=Math.atan2(u,h);if(d<0&&(d+=Vr),s<=a&&d>=s&&d<=a||s>a&&(d>=s&&d<=Vr||d>=0&&d<=a)||s==a){var p=Math.sqrt(h*h+u*u);return p<=c&&p>=l}else{var p=(c+l)/2,m=new S(this.center.x+Math.cos(s)*p,this.center.y+Math.sin(s)*p),g=new S(this.center.x+Math.cos(a)*p,this.center.y+Math.sin(a)*p),y=t-m.x,b=e-m.y,P=t-g.x,T=e-g.y;return y*y+b*b<=r*r/4?!0:P*P+T*T<=r*r/4}}getBBox(t){return X8e(this.center,this.radius,t,this.startAngle,this.endAngle,this.sweep)}getMathGraphics(t,e){return this.primitive.stroke(t+e*2,kr.ROUND,le.CW)}clone(){return new o(this._center,this._radius,this._startAngle,this._endAngle,this._sweep,this._arcType)}equals(t){return t instanceof o?this.radius==t.radius&&this.startAngle==t.startAngle&&this.endAngle==t.endAngle&&this.sweep==t.sweep&&this.arcType==t.arcType&&this.center.equals1(t.center):!1}};var Oi=class o extends yt{constructor(e,r,i,n,s,a,l,c,h,u,d,p){super(e,new b8(i,n,a,l,c,d),r,s,u,h,p);this.modelType="ArcTrack";jo("data/model/ArcTrackModel")}get radius(){return this._baseModel.radius}set radius(e){this._baseModel.radius!=e&&(this._baseModel.radius=e,this.updateShapeData())}get arcType(){return this._baseModel.arcType}set arcType(e){this._baseModel.arcType!=e&&(this._baseModel.arcType=e)}get startAngle(){return this._baseModel.startAngle}set startAngle(e){this._baseModel.startAngle=e,this.updateShapeData()}get endAngle(){return this._baseModel.endAngle}set endAngle(e){this._baseModel.endAngle=e,this.updateShapeData()}get center(){return this._baseModel.center}set center(e){this._baseModel.center=e,this.updateShapeData()}get midPoint(){return this._baseModel.midPoint}set midPoint(e){this._baseModel.midPoint=e}get sweepAngle(){return this._baseModel.sweepAngle}get sweep(){return this._baseModel.sweep}set sweep(e){this._baseModel.sweep!=e&&(this._baseModel.sweep=e,this.updateShapeData())}get isCCW(){return this.sweep===le.CCW}get angle(){return this._baseModel.angle}set angle(e){this._baseModel.angle=e,this.updateShapeData()}get primitive(){return this._baseModel.primitive}transform(e){this._baseModel.transform(e),this.updateShapeData()}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this.layerId,this.center,this.radius,this.width,this.startAngle,this.endAngle,this.sweep,this.locked,this.showNet,this.arcType,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var qr=class o extends yt{constructor(e,r,i,n,s,a,l,c){super(e,new qx(i,n),r,bo(s),l,a,c);this.modelType="Track";jo("data/model/TrackModel")}get direct(){return this._baseModel.direct}get center(){return this._baseModel.center}get midPoint(){return this._baseModel.center}get primitive(){return this._baseModel.primitive}transform(e){this._baseModel.transform(e),this.updateShapeData()}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}inOutline(e){return this.inShape(e.x,e.y)}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this.layerId,this.start,this.end,this.width,this.locked,this.showNet,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var P4=class P4 extends wi{static getInstance(){return P4.manager==null&&(P4.manager=new P4),P4.manager}addModel(t){return this._last=t,this.map.set(t.globalIndex,this._last),this._last}addTrack(t,e,r,i,n,s,a){return this._last=new qr(t,e,r,i,n,s,a),this.addModel(this._last),this._last}addArcTrack(t,e,r,i,n,s,a,l,c,h,u){return this._last=new Oi(t,e,r,i,l,n,s,a,c,h,u),this.addModel(this._last),this._last}delete(t,e){(t.modelType==="ArcTrack"||t.modelType==="Track")&&this.map.delete(e)}deleteById(t){this.map.delete(t)}};P4.manager=null;var An=P4;var P8=class extends E0{loadNet(t){this.model.net!=t&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(this.model.net,this.model),this.model.net=t)}loadWidth(t){this.model.width!=t&&(this.model.width=t)}};var T4=class extends P8{constructor(){super(...arguments);this.start=S.ORIGIN;this.end=S.ORIGIN;this.locked=!1}feed(e){let{id:r,partitionId:i,groupId:n,netName:s,layerId:a,startX:l,startY:c,endX:h,endY:u,angle:d,width:p,locked:m,zIndex:g,number:y,arcType:b}=e;this.index=r,this.partition=i,this.groupId=Va(n),this.net=s||"",this.zIndex=g,this.number=y,this.isNumber(a)&&(this.layerId=a),this.isNumber(l)&&this.isNumber(c)&&(this.start=new S(l/10,c/10)),this.isNumber(h)&&this.isNumber(u)&&(this.end=new S(h/10,u/10)),this.isNumber(d)&&(this.angle=d/180*Math.PI),this.isNumber(p)&&(this.width=p/10),this.locked=m,this.type=vFe(b)}clear(){this.model=null,this.index=null,this.partition=null,this.groupId=null,this.net=null,this.zIndex=null,this.number=null,this.layerId=null,this.start=S.ORIGIN,this.end=S.ORIGIN,this.angle=null,this.width=0,this.locked=null,this.type=null}clearGroupId(){this.groupId=null}changeNet4Map(e){let r=e.get(this.net);r!=null&&(this.net=r)}check(){return!(!this.layerId||!this.width||isNaN(this.angle)||this.groupId===void 0||this.net==null||this.angle==null||isNaN(this.angle)||this.start.equals1(this.end)||this.width==null||isNaN(this.width)||this.width<=0||this.locked==null)}arcCheck(){return!(this.index==null||this.net==null||this.layerId==null||this.angle==null||ne.eq(Math.abs(Ht.toDegrees(this.angle)),360)||ne.eq(this.angle,0)||this.width==null||this.start.equals1(this.end))}finish(){if(this.arcCheck()){let{center:e,radius:r,startAngle:i,endAngle:n,sweep:s}=new ro().pointToAngle(this.start,this.end,this.angle),a=this.addItem(e,r,i,n,s);return this.groupId!=null&&a.setGroupID(this.groupId),this.partition&&(a.partition=this.partition),this.isNumber(this.zIndex)&&(a.zIndex=this.zIndex),this.isNumber(this.number)&&(a.number=this.number),a}else return null}addItem(e,r,i,n,s){return this.resultNeedToBeCached?An.getInstance().addArcTrack(this.index,this.layerId,e,r,i,n,s,this.width,this.locked,this.net,this.type):new Oi(this.index,this.layerId,e,r,this.width,i,n,s,this.locked,this.net,this.type)}loadCenter(e){this.model.center.equals(e)||(this.model.center=e)}loadRadius(e){this.model.radius!=e&&(this.model.radius=e)}loadSweep(e){this.model.sweep!=e&&(this.model.sweep=e)}loadStartAngle(e){this.model.startAngle!=e&&(this.model.startAngle=e)}loadEndAngle(e){this.model.endAngle!=e&&(this.model.endAngle=e)}loadType(e){this.model.arcType!=e&&(this.model.arcType=e)}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.partition!==void 0&&this.loadNet(this.net),this.loadLayerId(this.layerId),this.loadWidth(this.width),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadNumber(this.number),this.loadType(this.type);let{center:e,radius:r,startAngle:i,endAngle:n,sweep:s}=new ro().pointToAngle(this.start,this.end,this.angle);this.loadCenter(e),this.loadRadius(r),this.loadStartAngle(i),this.loadEndAngle(n),this.loadSweep(s)}};var I4=class extends P8{constructor(){super(...arguments);this.startX=0;this.startY=0;this.endX=0;this.endY=0;this.width=0}feed(e){let{id:r,partitionId:i,groupId:n,netName:s,layerId:a,startX:l,startY:c,endX:h,endY:u,width:d,locked:p,zIndex:m,number:g}=e;this.index=r,this.partition=i,this.groupId=Va(n),this.net=s,this.zIndex=m,this.number=g,this.isNumber(a)&&(this.layerId=a),this.isNumber(l)&&(this.startX=l/10),this.isNumber(c)&&(this.startY=c/10),this.isNumber(h)&&(this.endX=h/10),this.isNumber(u)&&(this.endY=u/10),this.isNumber(d)&&(this.width=d/10),this.locked=p}clear(){this.model=null,this.index=null,this.partition=null,this.groupId=null,this.net=null,this.zIndex=null,this.number=null,this.layerId=null,this.startX=0,this.startY=0,this.endX=0,this.endY=0,this.width=0,this.locked=null}clearGroupId(){this.groupId=null}changeNet4Map(e){let r=e.get(this.net);r!=null&&(this.net=r)}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.net==null||this.width==null||isNaN(this.width)||this.width<=0||this.locked==null)}finish(){if(!this.check())return null;let e=new S(this.startX,this.startY),r=new S(this.endX,this.endY);if(e.distance1(r)<.01)return null;let i=this.getItem(e,r);return this.groupId!=null&&i.setGroupID(this.groupId),this.partition&&(i.partition=this.partition),this.isNumber(this.zIndex)&&(i.zIndex=this.zIndex),this.isNumber(this.number)&&(i.number=this.number),i}getItem(e,r){return this.resultNeedToBeCached?An.getInstance().addTrack(this.index,this.layerId,e,r,this.width,this.locked,this.net):new qr(this.index,this.layerId,e,r,this.width,this.locked,this.net)}loadStart(e){this.model.start.equals(e)||(this.model.start=e)}loadEnd(e){this.model.end.equals(e)||(this.model.end=e)}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.partition!==void 0&&this.loadNet(this.net),this.loadLayerId(this.layerId),this.loadWidth(this.width),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadNumber(this.number);let e=new S(this.startX,this.startY),r=new S(this.endX,this.endY);this.loadStart(e),this.loadEnd(r)}};function C4(o,t,e,r,i,n){let s=Ae.rotateZForPoint(t,-i),a=o.multiply4(s),l=Math.min(e/2,r/2,n),c=t,h=new S(t.x,t.y-r),u=new S(t.x+e,t.y),d=new S(t.x+e,t.y-r),p=h.add1(l,l),m=d.add1(-l,l),g=u.add1(-l,-l),y=c.add1(l,-l);if(new ut(h.x,u.x,h.y,u.y).isContains(a)){if(a.x<p.x){if(a.y<p.y)return a.distance1(p)<=l;if(a.y>y.y)return a.distance1(y)<=l}if(a.x>m.x){if(a.y<m.y)return a.distance1(m)<=l;if(a.y>g.y)return a.distance1(g)<=l}return!0}else return!1}function T8(o,t,e,r,i,n,s,a=!1,l){s<.05&&l!=null&&(s=10/l.getScale());let c=Ae.rotateZForPoint(t,-i),h=o.multiply4(c),u=Math.min(e/2,r/2,n),d=t,p=new S(t.x,t.y-r),m=new S(t.x+e,t.y),g=new S(t.x+e,t.y-r),y=p.add1(u,u),b=g.add1(-u,u),P=m.add1(-u,-u),T=d.add1(u,-u),I=new S(d.x,y.y),C=new S(d.x,T.y),E=new S(T.x,d.y),O=new S(P.x,d.y),_=new S(g.x,P.y),R=new S(g.x,b.y),v=new S(b.x,g.y),D=new S(y.x,g.y);return!!(Xa(h,I,C,s)||Xa(h,E,O,s)||Xa(h,_,R,s)||Xa(h,v,D,s)||!a&&(xf(h,y,u,Tu,Tu*1.5,le.CCW,s)||xf(h,b,u,Tu*1.5,Vr,le.CCW,s)||xf(h,P,u,0,Tu/2,le.CCW,s)||xf(h,T,u,Tu/2,Tu,le.CCW,s)))}function Oj(o,t,e,r,i,n){let s=Math.min(t/2,e/2,i),a=Ae.rotateZForPoint(o,r),l=o,c=new S(o.x,o.y-e),h=new S(o.x+t,o.y),u=new S(o.x+t,o.y-e),d=c.add1(s,s).multiply4(a),p=u.add1(-s,s).multiply4(a),m=h.add1(-s,-s).multiply4(a),g=l.add1(s,-s).multiply4(a),y=new _e;return y.ext2(d).ext2(p).ext2(m).ext2(g).ext7(s+n/2),y.build1()}var Aa=class extends lr{constructor(){super(...arguments);this.modelType="Rect"}get leftLow(){let e=Ae.rotateZForPoint(this.start,this.rotation);return new S(this.start.x,this.start.y-this.height).multiply4(e)}set leftLow(e){let r=this.start,i=Ae.rotateZForPoint(r,-this.rotation),n=Ae.rotateZForPoint(r,this.rotation),s=e.multiply4(i),a=this.getBox(s,new S(this.start.x+this.width,this.start.y)),l=new S(a[0],a[3]).multiply4(n),c=Math.abs(a[2]-a[0]),h=Math.abs(a[3]-a[1]);this.start=l,this.width=c,this.height=h}get leftUp(){return this.start}set leftUp(e){let r=this.start,i=Ae.rotateZForPoint(r,-this.rotation),n=Ae.rotateZForPoint(r,this.rotation),s=e.multiply4(i),a=this.getBox(s,new S(this.start.x+this.width,this.start.y-this.height)),l=new S(a[0],a[3]).multiply4(n),c=Math.abs(a[2]-a[0]),h=Math.abs(a[3]-a[1]);this.start=l,this.width=c,this.height=h}get rightLow(){let e=Ae.rotateZForPoint(this.start,this.rotation);return new S(this.start.x+this.width,this.start.y-this.height).multiply4(e)}set rightLow(e){let r=this.start,i=Ae.rotateZForPoint(r,-this.rotation),n=Ae.rotateZForPoint(r,this.rotation),s=e.multiply4(i),a=this.getBox(s,r),l=new S(a[0],a[3]).multiply4(n),c=Math.abs(a[2]-a[0]),h=Math.abs(a[3]-a[1]);this.start=l,this.width=c,this.height=h}get rightUp(){let e=Ae.rotateZForPoint(this.start,this.rotation);return new S(this.start.x+this.width,this.start.y).multiply4(e)}set rightUp(e){let r=this.start,i=Ae.rotateZForPoint(r,-this.rotation),n=Ae.rotateZForPoint(r,this.rotation),s=e.multiply4(i),a=this.getBox(s,new S(this.start.x,this.start.y-this.height)),l=new S(a[0],a[3]).multiply4(n),c=Math.abs(a[2]-a[0]),h=Math.abs(a[3]-a[1]);this.start=l,this.width=c,this.height=h}get realCornerRadius(){return Math.min(this.width/2,this.height/2,this.radius)}get cornerRatio(){return this.realCornerRadius/Math.min(this.width/2,this.height/2)}get polyline(){return Ng(this.leftLow.add(this.leftUp).mul(.5),this.rightLow.add(this.rightUp).mul(.5),this.height,2*this.realCornerRadius/Math.min(this.width,this.height))}getBox(e,r){let i=Math.min(e.x,r.x),n=Math.max(e.x,r.x),s=Math.min(e.y,r.y),a=Math.max(e.y,r.y);return n-i<.01&&(n=i+.01),a-s<.01&&(s=a-.01),[i,s,n,a]}getAllLinesInOrder(){let e=this.getLines(),r=this.getArcs();return[r[0],e[0],r[1],e[1],r[2],e[2],r[3],e[3]].filter(i=>i!=null)}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}transform(e){let r=this.rightLow,i=this.start.multiply4(e);r=r.multiply4(e),this.rotation=S.caculateAngle(this.rotation,e)%Vr;let n=Ae.translate(-i.x,-i.y,0).rotateZ(-this.rotation),s=Ae.rotateZ(this.rotation).translate1(i.x,i.y,0),a=new _e;a.ext2(i.multiply4(n)).ext2(r.multiply4(n));let l=a.build1();this.start=l.UL().multiply4(s)}inOutline(e){return this.inShape(e.x,e.y)}inShape(e,r,i){switch(this.type){case"Annotation":case"Copper Region":case"Line":case"Board Outline":case"3D Shell - Outline":return T8(new S(e,r),this.start,this.width,this.height,this.rotation,this.radius,this.strokeWidth,void 0,i);default:return T8(new S(e,r),this.start,this.width,this.height,this.rotation,this.radius,this.strokeWidth,void 0,i)?!0:C4(new S(e,r),this.start,this.width,this.height,this.rotation,this.radius)}}isInside(e){return C4(e,this.start,this.width,this.height,this.rotation,this.radius)}InnerArea(e,r){return C4(new S(e,r),this.start,this.width,this.height,this.rotation,this.radius)}isSelectOnlyLine(e,r){return T8(new S(e,r),this.start,this.width,this.height,this.rotation,this.radius,this.strokeWidth,!0)}getEndPoints(){let{leftUp:e,leftLow:r,rightUp:i,rightLow:n,realCornerRadius:s}=this,a=n.sub(r).normalize(),l=e.sub(r).normalize(),c=r.add(a.mul(s)),h=n.add(a.mul(-s)),u=n.add(l.mul(s)),d=i.add(l.mul(-s)),p=i.add(a.mul(-s)),m=e.add(a.mul(s)),g=e.add(l.mul(-s)),y=r.add(l.mul(s));return[c,h,u,d,p,m,g,y]}getMidPoints(){let e=[],{leftUp:r,leftLow:i,rightUp:n,rightLow:s,realCornerRadius:a}=this,l=s.sub(i).normalize(),c=r.sub(i).normalize(),h=i.add(l.mul(a)),u=s.add(l.mul(-a)),d=s.add(c.mul(a)),p=n.add(c.mul(-a)),m=n.add(l.mul(-a)),g=r.add(l.mul(a)),y=r.add(c.mul(-a)),b=i.add(c.mul(a)),P=[h,u,d,p,m,g,y,b];for(let T=0;T<P.length;T=T+2){let I=P[T],C=P[T+1],E=I.add(C).mul(.5);e.push(E)}if(a>0){let T=h.add(c.mul(this.radius)),I=d.add(l.mul(-this.radius)),C=m.add(c.mul(-this.radius)),E=y.add(l.mul(this.radius)),O=[T,I,C,E],_=[b,h,u,d,p,m,g,y];for(let R=0;R<4;R++){let v=O[R],D=dre(v,a,_[R*2].angle(v),_[R*2+1].angle(v),le.CCW);e.push(D)}}return e}getArcCenterPoints(){if(this.radius>0){let{leftUp:e,leftLow:r,rightUp:i,rightLow:n,realCornerRadius:s}=this,a=n.sub(r).normalize(),l=e.sub(r).normalize(),c=r.add(a.mul(s)),h=n.add(l.mul(s)),u=i.add(a.mul(-s)),d=e.add(l.mul(-s)),p=c.add(l.mul(this.radius)),m=h.add(a.mul(-this.radius)),g=u.add(l.mul(-this.radius)),y=d.add(a.mul(this.radius));return[p,m,g,y]}return[]}getLines(){let{leftUp:e,leftLow:r,rightUp:i,rightLow:n,realCornerRadius:s}=this,a=n.sub(r).normalize(),l=e.sub(r).normalize(),c=new M(r.add(a.mul(s)),n.add(a.mul(-s))),h=new M(n.add(l.mul(s)),i.add(l.mul(-s))),u=new M(i.add(a.mul(-s)),e.add(a.mul(s))),d=new M(e.add(l.mul(-s)),r.add(l.mul(s)));return[c,h,u,d]}getArcs(){let e=[],{leftUp:r,leftLow:i,rightUp:n,rightLow:s,realCornerRadius:a}=this;if(this.radius>0){let l=s.sub(i).normalize(),c=r.sub(i).normalize(),h=i.add(l.mul(a)),u=s.add(l.mul(-a)),d=s.add(c.mul(a)),p=n.add(c.mul(-a)),m=n.add(l.mul(-a)),g=r.add(l.mul(a)),y=r.add(c.mul(-a)),b=i.add(c.mul(a)),P=h.add(c.mul(a)),T=d.add(l.mul(-a)),I=m.add(c.mul(-a)),C=y.add(l.mul(a)),E=[P,T,I,C],O=[b,h,u,d,p,m,g,y];for(let _=0;_<E.length;_++){let R=E[_];e.push(q.build2(R,O[_*2].angleD(R),O[_*2+1].angleD(R),a,a,le.CCW))}}return e}updateBox(){return this._bbox=Oj(this.start,this.width,this.height,this.rotation,this.radius,this.strokeWidth),this._bbox}getMathGraphics(e=this.layerId){return this.isEmpty?null:this.layerId==e||this.layerId==12||11==this.layerId?Ng(this.leftLow.add(this.leftUp).mul(.5),this.rightLow.add(this.rightUp).mul(.5),this.height,2*this.realCornerRadius/Math.min(this.width,this.height)):null}};var Zp=class o extends Aa{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p,m){super(),this._globalIndex=t,this.base=new eR(e,r,c,h,d,u,p),this._start=i,this._width=bo(n),this._height=bo(s),this._rotation=a,this._radius=l,this._bbox=m||Oj(i,n,s,a,l,this.strokeWidth)}get start(){return this._start}set start(t){this._start.equals(t)||(this._start=t,this.updateShapeData())}get width(){return this._width}set width(t){t=bo(t),this._width!=t&&(this._width=t,this.updateShapeData())}get height(){return this._height}set height(t){t=bo(t),this._height!=t&&(this._height=t,this.updateShapeData())}get rotation(){return this._rotation}set rotation(t){this._rotation!=t&&(this._rotation=t,this.updateShapeData())}get radius(){return this._radius}set radius(t){this._radius!=t&&(this._radius=t,this.updateShapeData())}get realCornerRadius(){return Math.min(this.width/2,this.height/2,this.radius)}get cornerRatio(){return this.realCornerRadius/Math.min(this.width/2,this.height/2)}get polyline(){return Ng(this.leftLow.add(this.leftUp).mul(.5),this.rightLow.add(this.rightUp).mul(.5),this.height,2*this.realCornerRadius/Math.min(this.width,this.height))}getAllLinesInOrder(){let t=this.getLines(),e=this.getArcs();return[e[0],t[0],e[1],t[1],e[2],t[2],e[3],t[3]].filter(r=>r!=null)}rotateFor(t,e){let r=Ae.rotateZForPoint(t,e);this.transform(r)}transform(t){let e=this.rightLow,r=this.start.multiply4(t);e=e.multiply4(t),this.rotation=S.caculateAngle(this.rotation,t)%Vr;let i=Ae.translate(-r.x,-r.y,0).rotateZ(-this.rotation),n=Ae.rotateZ(this.rotation).translate1(r.x,r.y,0),s=new _e;s.ext2(r.multiply4(i)).ext2(e.multiply4(i));let a=s.build1();this.start=a.UL().multiply4(n)}inOutline(t){return this.inShape(t.x,t.y)}isInside(t){return C4(t,this.start,this.width,this.height,this.rotation,this.radius)}InnerArea(t,e){return C4(new S(t,e),this.start,this.width,this.height,this.rotation,this.radius)}isSelectOnlyLine(t,e){return T8(new S(t,e),this.start,this.width,this.height,this.rotation,this.radius,this.strokeWidth,!0)}getEndPoints(){let{leftUp:t,leftLow:e,rightUp:r,rightLow:i,realCornerRadius:n}=this,s=i.sub(e).normalize(),a=t.sub(e).normalize(),l=e.add(s.mul(n)),c=i.add(s.mul(-n)),h=i.add(a.mul(n)),u=r.add(a.mul(-n)),d=r.add(s.mul(-n)),p=t.add(s.mul(n)),m=t.add(a.mul(-n)),g=e.add(a.mul(n));return[l,c,h,u,d,p,m,g]}getMidPoints(){let t=[],{leftUp:e,leftLow:r,rightUp:i,rightLow:n,realCornerRadius:s}=this,a=n.sub(r).normalize(),l=e.sub(r).normalize(),c=r.add(a.mul(s)),h=n.add(a.mul(-s)),u=n.add(l.mul(s)),d=i.add(l.mul(-s)),p=i.add(a.mul(-s)),m=e.add(a.mul(s)),g=e.add(l.mul(-s)),y=r.add(l.mul(s)),b=[c,h,u,d,p,m,g,y];for(let P=0;P<b.length;P=P+2){let T=b[P],I=b[P+1],C=T.add(I).mul(.5);t.push(C)}if(s>0){let P=c.add(l.mul(this.radius)),T=u.add(a.mul(-this.radius)),I=p.add(l.mul(-this.radius)),C=g.add(a.mul(this.radius)),E=[P,T,I,C],O=[y,c,h,u,d,p,m,g];for(let _=0;_<4;_++){let R=E[_],v=dre(R,s,O[_*2].angle(R),O[_*2+1].angle(R),le.CCW);t.push(v)}}return t}getArcCenterPoints(){if(this.radius>0){let{leftUp:t,leftLow:e,rightUp:r,rightLow:i,realCornerRadius:n}=this,s=i.sub(e).normalize(),a=t.sub(e).normalize(),l=e.add(s.mul(n)),c=i.add(a.mul(n)),h=r.add(s.mul(-n)),u=t.add(a.mul(-n)),d=l.add(a.mul(this.radius)),p=c.add(s.mul(-this.radius)),m=h.add(a.mul(-this.radius)),g=u.add(s.mul(this.radius));return[d,p,m,g]}return[]}getLines(){let{leftUp:t,leftLow:e,rightUp:r,rightLow:i,realCornerRadius:n}=this,s=i.sub(e).normalize(),a=t.sub(e).normalize(),l=new M(e.add(s.mul(n)),i.add(s.mul(-n))),c=new M(i.add(a.mul(n)),r.add(a.mul(-n))),h=new M(r.add(s.mul(-n)),t.add(s.mul(n))),u=new M(t.add(a.mul(-n)),e.add(a.mul(n)));return[l,c,h,u]}getArcs(){let t=[],{leftUp:e,leftLow:r,rightUp:i,rightLow:n,realCornerRadius:s}=this;if(this.radius>0){let a=n.sub(r).normalize(),l=e.sub(r).normalize(),c=r.add(a.mul(s)),h=n.add(a.mul(-s)),u=n.add(l.mul(s)),d=i.add(l.mul(-s)),p=i.add(a.mul(-s)),m=e.add(a.mul(s)),g=e.add(l.mul(-s)),y=r.add(l.mul(s)),b=c.add(l.mul(s)),P=u.add(a.mul(-s)),T=p.add(l.mul(-s)),I=g.add(a.mul(s)),C=[b,P,T,I],E=[y,c,h,u,d,p,m,g];for(let O=0;O<C.length;O++){let _=C[O];t.push(q.build2(_,E[O*2].angleD(_),E[O*2+1].angleD(_),s,s,le.CCW))}}return t}updateBox(){return this._bbox=Oj(this.start,this.width,this.height,this.rotation,this.radius,this.strokeWidth),this._bbox}getMathGraphics(t=this.layerId){return this.isEmpty?null:this.layerId==t||this.layerId==12||11==this.layerId?Ng(this.leftLow.add(this.leftUp).mul(.5),this.rightLow.add(this.rightUp).mul(.5),this.height,2*this.realCornerRadius/Math.min(this.width,this.height)):null}clone(){var r;this.refreshBBox&&this.updateBox();let t=(r=this.component)==null?void 0:r.clone(),e=new o(this.globalIndex,this.type,this.layerId,this._start,this._width,this._height,this._rotation,this._radius,this.showNet,this.strokeWidth,this.locked,this.silkColor,t,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}get type(){return this.base.type}set type(t){this.base.type!=t&&(this.base.type=t,this.updateShapeData())}get layerId(){return this.base.layerId}set layerId(t){this.base.layerId!=t&&(this.watchLayerIdModify(this.base.layerId),this.base.layerId=t,this.layerModified=!0)}get net(){var t;return(t=this.base.net)==null?void 0:t.toUpperCase()}set net(t){this.base.net!=t&&(this.base.net=t,this.netModified=!0)}get showNet(){return this.base.net}get locked(){return this.base.locked}set locked(t){this.base.locked=t}get strokeWidth(){return this.base.strokeWidth}set strokeWidth(t){t=qu(t,this.type),this.base.strokeWidth!=t&&(this.base.strokeWidth=t,this.updateShapeData())}get silkColor(){return this.base.silkColor}set silkColor(t){this.base.silkColor=t}get component(){return this.base.component}set component(t){this.base.component!=t&&(this.base.component=t,this.updateShapeData())}get bbox(){return this._bbox}addCopper(t){this.base.addCopper(t)}deleteCopper(t){this.base.deleteCopper(t)}iteratorCopper(t){this.base.iteratorCopper(t)}clearCopperData(){this.base.clearCopperData()}};var S4=class S4 extends wi{static getInstance(){return S4.manager==null&&(S4.manager=new S4),S4.manager}addModel(t){this.map.set(t.globalIndex,t)}addRect(t,e,r,i,n,s,a,l,c=1,h=0,u=0,d=null,p){return this._last=new Zp(t,e,r,i,n,s,h,u,a,c,l,d,p,null),this.addModel(this._last),this._last}delete(t,e){t instanceof Aa&&this.map.delete(e)}};S4.manager=null;var rn=S4;var nl=class extends ki{constructor(){super(...arguments);this.modelType="Arc"}get layerModified(){return this._parent?this._parent.layerModified:this.hasDataState(3)}set layerModified(e){e&&(this.layerOrBoxModified=!0),this.setDataState(3,e)}get rx(){return this.radius}get ry(){return this.radius}setStartAngleAndEndAngle(e,r){this.startAngle=e,this.endAngle=r}};var ih=class o extends ys{constructor(e,r,i,n){super();this.modelType="Line";this._parent=void 0;this._globalIndex=e,this._viewProperty=n;let s=new qx(r,i);this._baseModel=s,jo("data/model/LineModel")}get isSegment(){return this.width==0}get layerId(){return this._viewProperty.layerId}set layerId(e){this._parent?(this._parent.watchLayerIdModify(this._parent.layerId),this._viewProperty.layerId=e):this._viewProperty.layerId!=e&&(this.watchLayerIdModify(this._viewProperty.layerId),this._viewProperty.layerId=e,this.layerModified=!0)}get start(){return this._baseModel.start}set start(e){this._baseModel.start=e,this.updateShapeData()}get end(){return this._baseModel.end}set end(e){this._baseModel.end=e,this.updateShapeData()}get width(){return this._viewProperty.strokeWidth}set width(e){e=bo(e),this._parent?this._viewProperty.strokeWidth=e:this._viewProperty.strokeWidth!=e&&(this._viewProperty.strokeWidth=e,this.updateShapeData())}get bbox(){return this._baseModel.getBBox(this.width)}get direct(){return this._baseModel.direct}get length(){return this._baseModel.length}set length(e){this._baseModel.length=e,this.updateShapeData()}get primitive(){return this._baseModel.primitive}get center(){return this._baseModel.center}get locked(){return this._viewProperty.locked}set locked(e){this._parent?this._parent.locked=e:this._viewProperty.locked!=e&&(this._viewProperty.locked=e)}setParent(e){if(e)this._viewProperty=e;else{let r={layerId:this.layerId,strokeWidth:this.width,locked:this.locked};this._viewProperty=r,this.layerModified=this.layerModified,this.updateShapeData()}super.setParent(e)}transform(e){this._baseModel.transform(e),this.updateShapeData()}inShape(e,r,i){return this._baseModel.inShape(e,r,this.width,i)}updateBox(){return this._baseModel.getBBox(this.width)}getMathGraphics(e=this.layerId,r=0){return!this.isEmpty&&this.layerId==e?this._baseModel.getMathGraphics(this.width,r):null}clone(){this.refreshBBox&&this.updateBox();let e={layerId:this.layerId,strokeWidth:this.width,locked:this.locked},r=new o(this._globalIndex,this.start,this.end,e);return r.number=this.number,r.zIndex=this.zIndex,r}equals(e){return e instanceof o?this.layerId==e.layerId&&this.width==e.width&&this._baseModel.equals(e._baseModel):!1}buildBBox(){return this.isEmpty?null:this.updateBox()}};var yh=class o extends nl{constructor(t,e,r,i,n,s,a,l=1){super(),this._globalIndex=t,this._viewProperty=a;let c=new b8(e,r,i,n,s,l);this._baseModel=c,jo("data/model/ArcModel")}get layerId(){return this._viewProperty.layerId}set layerId(t){this._parent?(this._parent.watchLayerIdModify(this._parent.layerId),this._viewProperty.layerId=t):this._viewProperty.layerId!=t&&(this.watchLayerIdModify(this._viewProperty.layerId),this._viewProperty.layerId=t,this.layerModified=!0)}get arcType(){return this._baseModel.arcType}set arcType(t){this._baseModel.arcType!=t&&(this._baseModel.arcType=t)}get angle(){let t=new ro,{angle:e}=t.angleToPoint(this.center,this.radius,this.startAngle,this.endAngle,this.sweep);return e}set angle(t){let e=new ro,{center:r,radius:i,startAngle:n,endAngle:s,sweep:a}=e.pointToAngle(this.start,this.end,t);this.center=r,this.radius=i,this.startAngle=n,this.endAngle=s,this.sweep=a}get center(){return this._baseModel.center}set center(t){this._baseModel.center=t,this.updateShapeData()}get radius(){return this._baseModel.radius}set radius(t){this._baseModel.radius=t,this.updateShapeData()}get rx(){return this.radius}get ry(){return this.radius}get width(){return this._viewProperty.strokeWidth}set width(t){this._parent?this._viewProperty.strokeWidth=t:this._viewProperty.strokeWidth!=t&&(this._viewProperty.strokeWidth=t,this.updateShapeData())}get startAngle(){return this._baseModel.startAngle}set startAngle(t){this._baseModel.startAngle=t,this.updateShapeData()}get endAngle(){return this._baseModel.endAngle}set endAngle(t){this._baseModel.endAngle=t,this.updateShapeData()}get sweepAngle(){return this._baseModel.sweepAngle}get sweep(){return this._baseModel.sweep}set sweep(t){this._baseModel.sweep=t,this.updateShapeData()}get bbox(){return this._baseModel.getBBox(this.width)}get isSegment(){return this.width==0}get midPoint(){return this._baseModel.midPoint}set midPoint(t){this._baseModel.midPoint=t,this.updateShapeData()}get start(){return this._baseModel.start}set start(t){this._baseModel.start=t,this.updateShapeData()}get end(){return this._baseModel.end}set end(t){this._baseModel.end=t,this.updateShapeData()}get length(){return this._baseModel.length}set length(t){this._baseModel.length=t,this.updateShapeData()}get primitive(){return this._baseModel.primitive}get locked(){return this._viewProperty.locked}set locked(t){this._viewProperty.locked!=t&&(this._viewProperty.locked=t)}setParent(t){if(t)this._viewProperty=t;else{let e={layerId:this.layerId,strokeWidth:this.width,locked:this.locked};this._viewProperty=e,this.layerModified=this.layerModified,this.updateShapeData()}super.setParent(t)}getAngle(){return this._baseModel.getAngle()}setStartAngleAndEndAngle(t,e){this.startAngle=t,this.endAngle=e}transform(t){this._baseModel.transform(t),this.updateShapeData()}inShape(t,e,r){return this._baseModel.inShape(t,e,this.width,r)}updateBox(){return this._baseModel.getBBox(this.width)}getMathGraphics(t=this.layerId,e=0){return!this.isEmpty&&this.layerId==t?this._baseModel.getMathGraphics(this.width,e):null}clone(){this.refreshBBox&&this.updateBox();let t={layerId:this.layerId,strokeWidth:this.width,locked:this.locked},e=new o(this._globalIndex,this.center,this.radius,this.startAngle,this.endAngle,this.sweep,t,this.arcType);return e.number=this.number,e.zIndex=this.zIndex,e}equals(t){return t instanceof o?this.layerId==t.layerId&&this.width==t.width&&this._baseModel.equals(t._baseModel):!1}buildBBox(){return this.isEmpty?null:this.updateBox()}};var Jp=class o extends ss{constructor(e,r,i,n,s,a,l,c,h,u,d){super();this.modelType="Polygon";this._pl=null;this._needUpdateCache=!1;this._simplify=!1;this._globalIndex=e,this.base=new eR(r,i,a,s,c,l,h),this.updateData(n,d),this._bbox=u||this.updateBox(),jo("data/model/PolygonModel")}get simplyPolyline(){return this._simplify?this._pl:null}get isSimplify(){return this._simplify}set isSimplify(e){this._simplify=e}get childrens(){return p8(this._children)}set childrens(e){this._children=g4(e),this.iteratorChildren(r=>{r.setParent(this)}),this.updateChildrenShape(),this.updateShapeData(),this._isClose=this.isClose(),this.childrenModified=!0,this.isSimplify||(this._needUpdateCache=!0)}get childrenModified(){return this.hasDataState(7)}set childrenModified(e){this.setDataState(7,e)}get outline(){return this.getMathGraphics()}updateData(e,r){this._simplify=!!r,r?(this._pl=r,this._isClose=!0,this.updateShapeData(),this.clearChildren()):(this._children=g4(e),this.iteratorChildren(i=>{i.setParent(this)}),this._isClose=this.isClose(),this.updateShapeData(),this._pl=null)}clearChildren(){this.iteratorChildren(e=>{e.remove()})}refreshOutlineByChildren(){return this._needUpdateCache=!0,this.getMathGraphics()}refreshChildrenByOutline(e,r){if(!this._pl)return null;if(!r&&this._children.length>0)return this._children;let i=this._pl instanceof fe?[this._pl]:this._pl.items,n=new Array,s=this.globalIndex,a=this.layerId,l=this.strokeWidth,c=this.locked;for(let h=0;h<i.length;h++){let u=i[h],d=new On,p=!0;for(let g=0;g<u.primitives.length;g++){let y=u.primitives[g],b;if(y instanceof M){let P=s+cr();b=new ih(P,y.start(),y.end(),this)}else if(y instanceof q){let P=s+cr();b=new yh(P,y.center,y.rx,Ht.toRadians(y.startAngle),Ht.toRadians(y.endAngle()),y.sweep(),this,1)}else if(y instanceof Q9){let P=s+cr();b=new yh(P,y.center,y.rx,Ht.toRadians(y.startAngle),Ht.toRadians(y.endAngle()),y.sweep(),this,2)}b!=null&&e!=null&&(b.setParent(this),d.addLast(b),e(b,p),p=!1)}let m=d.toArray();m.length>0&&n.push(m),d.clear()}return this._children=g4(n),this._isClose=this.isClose(),this._children}get lastIsClose(){return this._isClose}iteratorChildren(e){return wre(this._children,e)}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}transform(e){this.isSimplify&&this.childrens.length==0&&this._pl!=null?this._pl=this._pl.multiply3(e.toMatrix3()):this.iteratorChildren(r=>{r.transform(e)}),this.updateShapeData(),this._needUpdateCache=!0}inOutline(e){return this.inShape(e.x,e.y)}InnerArea(e,r,i){let n=this.isInside(new S(e,r));if(n)return n;for(let s of this.childrens)for(let a of s)if(a.inShape(e,r,i))return!0;return!1}onlyOutline(e,r){for(let i of this.childrens)for(let n of i)if(n.inShape(e,r))return!0;return!1}onOutlineShape(e,r,i){let n=this.isInside(new S(e,r));if(n)return n;for(let s of this.childrens)for(let a of s)if(a.inShape(e,r,i))return!0;return!1}updateBox(){if(this._simplify&&this._pl!=null)return this._bbox=this._pl.bbox(),this._bbox;if(this._children.length==1){let i=this._children[0].buildBBox();if(i==null)throw new Error("Polygon isEmpty.updateBBox Error!!!");return this._bbox=i,this._bbox}let e=new _e;return this.iteratorChildren(r=>{let i=r.buildBBox();if(i==null)throw new Error("Polygon isEmpty.updateBBox Error!!!");e.ext1(i)}),this._bbox=e.build1(),this._bbox}updateSimplyOutline(){if(this.isSimplify&&this._children.length>0){let e=this.childrens,r=new Array;for(let i of e){let n=new Array;for(let s of i)if(s instanceof ys){let a=s.primitive;n.push(a)}else if(s instanceof nl){let a=s.primitive;if(s.length>1e-8&&s.end.distance1(s.start)<.1&&s.getAngle()>Math.PI){let l=a.sweepAngle/2,c=a.startAngle+l,h=q.build3(a.center,a.startAngle,l,a.rx,a.ry),u=q.build3(a.center,c,l,a.rx,a.ry);n.push(h),n.push(u)}else n.push(a)}r.push(fe.build2(n))}if(r.length==1)this._pl=r[0].area()>0?r[0].reverse():r[0];else{let i=new Gt(r),n=i.getOutMostPolyline();this._pl=n.area()>0?new Gt(r.map(s=>s.reverse())):i}}}getMathGraphics(e,r){if(this.isEmpty)return null;if(!this._needUpdateCache&&this._pl)return this._pl;let i=this.childrens;if(i.length==0)return this._needUpdateCache=!1,this._pl;let n=new Array;for(let s of i){let a=new Array;for(let l of s)if(l instanceof ys){let c=l.primitive;a.push(c)}else if(l instanceof nl){let c=l.primitive;if(l.length>1e-8&&l.end.distance1(l.start)<.1&&l.getAngle()>Math.PI){let h=c.sweepAngle/2,u=c.startAngle+h,d=q.build3(c.center,c.startAngle,h,c.rx,c.ry),p=q.build3(c.center,u,h,c.rx,c.ry);a.push(d),a.push(p)}else a.push(c)}n.push(fe.build2(a))}if(n.length==1)this._pl=n[0].closed()&&n[0].area()>0?n[0].reverse():n[0];else{let s=new Gt(n),a=s.getOutMostPolyline();this._pl=a.area()>0?new Gt(n.map(l=>l.reverse())):s}return this._needUpdateCache=!1,this._pl}update4Childs(){this.updateShapeData(),this._needUpdateCache=!0}clone(){var n;this.refreshBBox&&this.updateBox();let e=this.childrens.map(s=>s.map(a=>a.clone())),r=(n=this.component)==null?void 0:n.clone(),i=new o(this.globalIndex,this.type,this.layerId,e,this.strokeWidth,this.showNet,this.locked,this.silkColor,r,this.bbox);return i.number=this.number,i.zIndex=this.zIndex,i}isClose(){return this.childrens.every(e=>{if(e.length==2){if(e[0]instanceof ys&&e[1]instanceof ys)return!1;{let r=e[0],i=e[e.length-1];if(r.start.distance1(i.end)<this.strokeWidth)return!0}}else if(e.length>2){let r=e[0],i=e[e.length-1];if(r.start.distance1(i.end)<this.strokeWidth)return!0}return!1})}equals(e){let r=this.childrens,i=e.childrens;return r.length!=i.length||r.some((a,l)=>{let c=i[l];return a.length!=c.length})?!1:!r.some((a,l)=>{let c=i[l];return a.some((h,u)=>{let d=c[u];return!h.equals(d)})})}get type(){return this.base.type}set type(e){this.base.type!=e&&(this.base.type=e,this.updateShapeData())}get layerId(){return this.base.layerId}set layerId(e){this.base.layerId!=e&&(this.watchLayerIdModify(this.base.layerId),this.base.layerId=e,this.layerModified=!0)}get net(){var e;return(e=this.base.net)==null?void 0:e.toUpperCase()}set net(e){this.base.net!=e&&(this.base.net=e,this.netModified=!0)}get showNet(){return this.base.net}get locked(){return this.base.locked}set locked(e){this.base.locked=e}get strokeWidth(){return this.base.strokeWidth}set strokeWidth(e){e=qu(e,this.type),this.base.strokeWidth!=e&&(this.base.strokeWidth=e,this.updateChildrenShape(),this.updateShapeData())}get silkColor(){return this.base.silkColor||null}set silkColor(e){this.base.silkColor=e}get component(){return this.base.component}set component(e){this.base.component!=e&&(this.base.component=e,this.updateShapeData())}get bbox(){return this._bbox}addCopper(e){this.base.addCopper(e)}deleteCopper(e){this.base.deleteCopper(e)}iteratorCopper(e){this.base.iteratorCopper(e)}clearCopperData(){this.base.clearCopperData()}updateChildrenShape(){let e=this.childrens.flat(1);for(let r of e)r.shapeModified=!0}};var E4=class E4 extends wi{static getInstance(){return E4.manager==null&&(E4.manager=new E4),E4.manager}addModel(t){this.map.set(t.globalIndex,t)}addPolygon(t,e,r,i,n,s,a,l,c,h,u){return n=qu(n,e),this._last=new Jp(t,e,r,i,n,s,a,l,c,h,u),this.addModel(this._last),this._last}delete(t,e){t instanceof ss&&this.map.delete(e)}};E4.manager=null;var Mi=E4;function O4(o){let t=s=>!o||typeof o!="function"?o===s.type:o(s),e=[],r=rn.getInstance().getAllItem(),i=zi.getInstance().getAllItem(),n=Mi.getInstance().getAllItem();for(let s of r)t(s)&&e.push(s);for(let s of i)t(s)&&e.push(s);for(let s of n)t(s)&&e.push(s);return e}function wu(o,t,e){switch(e){case"Copper Region":case"Fill Region":case"Line":case"TearDrop":let r=$e.getInstance().getLayer(t);return r!=null&&gs(r.type)?o||"":null;default:return null}}function fVe(o){return rn.getInstance().getItem(o)||zi.getInstance().getItem(o)||Mi.getInstance().getItem(o)}function mVe(){let o=new Array;function t(e){for(let r of e)r.layerId==11&&o.push(r)}return t(rn.getInstance().getAllItem()),t(zi.getInstance().getAllItem()),t(Mi.getInstance().getAllItem()),o}function gVe(){let o=new Array;function t(e){for(let r of e)r.type=="Slot Region"&&o.push(r)}return t(rn.getInstance().getAllItem()),t(zi.getInstance().getAllItem()),t(Mi.getInstance().getAllItem()),o}var sR=class o extends kd{constructor(t){super(),this._connects=t}get connects(){return this._connects||[]}set connects(t){this._connects=t}get type(){return this._connects?1:0}toJSON(){return{connects:this.connects}}clone(){return new o(this.connects)}};var nu=class o extends kd{constructor(t){super(),this.name=t}get name(){return this._name}set name(t){this._name=t}modifyName(t){this.watcher!=null&&!this.watcher.modifyName(this,t)||(this._name=t)}toJSON(){return{name:this.name}}clone(){return new o(this.name)}};var wl=class o extends kd{constructor(t,e,r,i=0){super(),this.type=t,this.stretchLength=e,this.lineId=r,this.belong=i}get lineId(){return this._baseLineId}set lineId(t){this._baseLineId=t}get type(){return this._type}set type(t){this._type=t}get stretchLength(){return this._stretchLength}set stretchLength(t){this._stretchLength=t}get belong(){return this._belong}set belong(t){o.getBelongOptions().some(r=>r.value===t)?this._belong=t:this._belong=0}static getBelongOptions(){return[{text:"Auto",value:0},{text:"Upper shell",value:1},{text:"Lower shell",value:2}]}toJSON(){return{type:this.type,lineId:this.lineId,stretchLength:this.stretchLength,belong:this.belong}}clone(){let t=new o(this.type,this.stretchLength,this.lineId);return t.belong=this.belong,t}};var yVe=[4,8,16],ou=class o extends kd{constructor(t,e,r,i){super(),this._type=t,this._slotDepth=e,this._slotOption=r,this._baseLineId=i}syncLatestData(){var t;(t=this.watcher)==null||t.syncLatestData(this)}get lineId(){return this._baseLineId}set lineId(t){this._baseLineId=t,this.syncLatestData()}get type(){return this._type}set type(t){this._type=t,this.syncLatestData()}get slotDepth(){return this._slotDepth}set slotDepth(t){this._slotDepth=t,this.syncLatestData()}get slotOption(){return this._slotOption}set slotOption(t){this._slotOption=t,this.syncLatestData()}updateSlotOption(t,e=!0){let r=new Set(this.slotOption);e?r.add(t):r.delete(t),this.slotOption=Array.from(r)}getShowType(){switch(this.type){case"Top":return"Top/Bottom Slot Region";case"Side":return"Side Slot Region"}}toJSON(){return{type:this.type,lineId:this.lineId,slotDepth:this.slotDepth,slotOption:this.slotOption}}clone(){return new o(this.type,this.slotDepth,this.slotOption,this.lineId)}};var Vn=class o extends kd{constructor(e,r,i,n,s,a,l,c=.8){super();this._copperResult=new Array(0);this._style=e,this._gridLineWidth=r,this._clearance=i,this._keepIsland=n,this._optimization=s,this._name=a,this._order=l,this._optimizationValue=c}syncLatestData(){var e;(e=this.watcher)==null||e.syncLatestData(this)}get style(){return this._style}set style(e){this._style=e,this.syncLatestData()}get gridLineWidth(){return this._gridLineWidth}set gridLineWidth(e){e=bo(e),this._gridLineWidth=e,this.syncLatestData()}get clearance(){return this._clearance}set clearance(e){this._clearance=e,this.syncLatestData()}get keepIsland(){return this._keepIsland}set keepIsland(e){this._keepIsland=e,this.syncLatestData()}get optimization(){return this._optimization}set optimization(e){this._optimization=e,this.syncLatestData()}set optimizationValue(e){this._optimizationValue=e,this.syncLatestData()}get optimizationValue(){return this._optimizationValue}set order(e){this._order=e}get order(){return this._order}get copperResult(){return this._copperResult}set copperResult(e){this._copperResult=e}get name(){return this._name}set name(e){this._name=e}modifyName(e){this.watcher!=null&&!this.watcher.modifyName(this,e)||(this._name=e)}toJSON(){return{style:this._style,gridLineWidth:this._gridLineWidth,clearance:this._clearance,keepIsland:this._keepIsland,optimization:this._optimization,name:this._name,optimizationValue:this._optimizationValue,order:this._order}}clone(){return new o(this.style,this.gridLineWidth,this.clearance,this.keepIsland,this.optimization,this.name,this.order,this._optimizationValue)}};var fd=class o extends kd{constructor(t,e,r,i,n){super(),this._device=t,this._track=e,this._copper=r,this._fill=i,this._planzone=n}syncLatestData(){var t;(t=this.watcher)==null||t.syncLatestData(this)}get device(){return this._device}set device(t){this._device=t,this.syncLatestData()}get track(){return this._track}set track(t){this._track=t,this.syncLatestData()}get copper(){return this._copper}set copper(t){this._copper=t,this.syncLatestData()}get fill(){return this._fill}set fill(t){this._fill=t,this.syncLatestData()}get planzone(){return this._planzone}set planzone(t){this._planzone=t,this.syncLatestData()}toJSON(){return{device:this._device,track:this._track,copper:this._copper,fill:this._fill,planzone:this._planzone}}clone(){return new o(this.device,this.track,this.copper,this.fill,this.planzone)}};var J2=class o extends kd{constructor(t){super(),this._connects=t}get connects(){return this._connects}set connects(t){this._connects=t}toJSON(){return{connects:this.connects}}clone(){return new o(this.connects)}};var nf=class extends Rn{getShapeInfo(t){if(t instanceof Po)return $b(0,t);if(t instanceof Aa)return $b(1,t);if(t instanceof ss){let e=t.getMathGraphics(t.layerId,0);return $b(2,{pl:e})}}};function $b(o,t){if(o===0){let e=t,r=e.center,i=e.radius;return[["CIRCLE",xe(r.x*10,4),xe(r.y*10,4),xe(i*10,4)]]}else if(o===1){let e=t,r=e.start,i=e.width,n=e.height;return[["R",xe(r.x*10,4),xe(r.y*10,4),xe(i*10,4),xe(n*10,4),xe(e.rotation/Math.PI*180,4),xe(e.radius*10,4)]]}else if(o===2){let r=t.pl;if(r instanceof Gt){let i=[];for(let n of r.items)i.push(F1(n,10));return i}else return[F1(r,10)]}}var Aj=class{get mainId(){return this._mainId}get relatedIds(){return this._relatedIds}constructor(t,e=new Set){this._mainId=t,this._relatedIds=e}deleteRelatedId(t){this.relatedIds.delete(t)}addRelatedId(t){this.relatedIds.add(t)}clear(){this._mainId=null,this._relatedIds=null}toJSON(){return{mainId:this.mainId,relatedIds:Array.from(this.relatedIds)}}};var A4=class A4 extends wi{static getInstance(){return A4.manager==null&&(A4.manager=new A4),A4.manager}constructor(){super()}delConnect(t){let e=this.map.get(t);e&&(e.clear(),this.map.delete(t))}addConnectRelatedId(t,e){t==""||t==null||(this.map.has(t)||this.map.set(t,new Aj(t)),this.map.get(t).addRelatedId(e))}modifyMainID(t,e,r){var i;t!=e&&((i=this.map.get(t))==null||i.deleteRelatedId(r),e!=""&&e!=null&&this.addConnectRelatedId(e,r))}delConnectRelatedId(t,e){let r=this.map.get(t);r instanceof Aj&&(r.deleteRelatedId(e),r.relatedIds.size===0&&this.delConnect(r.mainId))}};A4.manager=null;var $a=A4;var Hre=class Hre{static createId(){return"l"+Hre.id++}};Hre.id=0;var I8=Hre,Wre=class Wre{static createId(){return"a"+Wre.id++}};Wre.id=0;var Ure=Wre;var md=class extends E0{constructor(){super()}parseShapeModel(t,e,r,i,n,s,a){if(i=wu(i,r,e),a=a[0]instanceof Array?a:[a],a.length==1&&a[0].length==0)return;let l=new Array;for(let h of a)if(h[0]=="CIRCLE"||h[0]=="C"){let u=new S(parseFloat(h[1])/10,parseFloat(h[2])/10),d=parseFloat(h[3])/10;return this.resultNeedToBeCached?zi.getInstance().addCircle(t,e,r,u,d,s,n,i):new $p(t,e,r,u,d,s,n,i,null,null)}else if(h[0]=="R"){let u=new S(parseFloat(h[1])/10,parseFloat(h[2])/10),d=parseFloat(h[3])/10,p=parseFloat(h[4])/10,m=parseFloat(h[5])/180*Math.PI;isNaN(m)&&(m=0);let g=(parseFloat(h[6])||0)/10;return this.resultNeedToBeCached?rn.getInstance().addRect(t,e,r,u,d,p,i,n,s,m,g):new Zp(t,e,r,u,d,p,m,g,i,s,n,null,null)}else{let u=new S(parseFloat(h[0])/10,parseFloat(h[1])/10),d=new ro,p=new On,m=!1,g={layerId:r,strokeWidth:s,locked:n};for(let P=2,T=h.length;P<T;){let I=typeof h[P]=="number";if(h[P]=="L"||I&&m){let C=I?P:P+1,E=new S(parseFloat(h[C])/10,parseFloat(h[C+1])/10),O=this.index+I8.createId(),_=new ih(O,u,E,g);p.addLast(_),u=E,P=C+2,m=!0}else if(h[P]=="ARC"||h[P]=="CARC"||I&&!m){m=!1;let C=I?P:P+1,E=parseFloat(h[C])/180*Math.PI,O=new S(parseFloat(h[C+1])/10,parseFloat(h[C+2])/10);if(ne.greater(Ht.regular(E),0)&&!u.equals1(O)){let{center:_,radius:R,startAngle:v,endAngle:D,sweep:w}=d.pointToAngle(u,O,E),F=null;h[P]=="ARC"?F=1:F=2;let H=this.index+Ure.createId(),z=new yh(H,_,R,v,D,w,g,F);p.addLast(z)}u=O,P=C+3}else throw Error("wrong path for poly")}let y=p.toArray();p.clear();let b=0;for(let P of y)if(b+=P.length,b>1e-8)break;if(b<1e-8||r!=11&&pd(e)&&!xu(y.map(P=>P.primitive),1e-4))if(aFe(y.map(P=>P.primitive)))y[y.length-1].end=y[0].start;else{for(let P of y)P.remove();return null}y.length>0&&l.push(y)}let c=this.resultNeedToBeCached?Mi.getInstance().addPolygon(t,e,r,l,s,i,n,null,null):new Jp(t,e,r,l,s,i,n,null,null);return c.type=="Board Outline"&&!c.isClose()&&(c.type="Line"),c}parseShapeModelSimplify(t,e,r,i,n,s,a){if(a=a[0]instanceof Array?a:[a],a.length==1&&a[0].length==0)return;i=wu(i,r,e);let l=a[0][0];if(l=="CIRCLE"||l=="C"){let p=a[0],m=new S(parseFloat(p[1])/10,parseFloat(p[2])/10),g=parseFloat(p[3])/10;return this.resultNeedToBeCached?zi.getInstance().addCircle(t,e,r,m,g,s,n,i):new $p(t,e,r,m,g,s,n,i,null,null)}if(l=="R"){let p=a[0],m=new S(parseFloat(p[1])/10,parseFloat(p[2])/10),g=parseFloat(p[3])/10,y=parseFloat(p[4])/10,b=parseFloat(p[5])/180*Math.PI;isNaN(b)&&(b=0);let P=(parseFloat(p[6])||0)/10;return this.resultNeedToBeCached?rn.getInstance().addRect(t,e,r,m,g,y,i,n,s,b,P):new Zp(t,e,r,m,g,y,b,P,i,s,n,null,null)}let c=new Array;for(let p of a){let m=new S(parseFloat(p[0])/10,parseFloat(p[1])/10),g=new ro,y=!1,b=new Array;for(let T=2,I=p.length;T<I;)if(p[T]=="L"){let C=new S(parseFloat(p[T+1])/10,parseFloat(p[T+2])/10),E=new M(m,C);b.push(E),m=C,T+=3,y=!0}else if(p[T]=="ARC"||p[T]=="CARC"){y=!1;let C=parseFloat(p[T+1])/180*Math.PI,E=new S(parseFloat(p[T+2])/10,parseFloat(p[T+3])/10);if(ne.greater(Ht.regular(C),0)&&!m.equals1(E)){let{center:O,radius:_,startAngle:R,endAngle:v,sweep:D}=g.pointToAngle(m,E,C);R=Ht.toDegrees(R),v=Ht.toDegrees(v);let w=p[T]=="ARC"?q.build2(O,R,v,_,_,D):Q9.build2(O,R,v,_,_,D);b.push(w)}m=E,T+=4}else if(y){let C=new S(parseFloat(p[T])/10,parseFloat(p[T+1])/10),E=new M(m,C);b.push(E),m=C,T+=2}let P=0;for(let T of b)if(P+=T.length(),P>1e-8)break;(P<1e-8||r!=11&&pd(e)&&!xu(b,1e-4))&&(b.length=0),b.length>0&&c.push(b)}if(c.length==0)return;let h=[];c.forEach(p=>{h.push(fe.build2(p))});let u=h.length==1?h[0]:new Gt(h),d=this.resultNeedToBeCached?Mi.getInstance().addPolygon(t,e,r,[],s,i,n,null,null,null,u):new Jp(t,e,r,[],s,i,n,null,null,null,u);return d.type=="Board Outline"&&!d.isClose()&&(d.type="Line"),d}loadType(t){this.model.type!=t&&(this.model.type=t)}loadNet(t){t=wu(t,this.model.layerId,this.model.type),this.model.net!=t&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(this.model.net,this.model),this.model.net=t)}loadWidth(t){!isNaN(t)&&this.model.strokeWidth!=t&&(this.model.strokeWidth=t)}loadPath(t){if(t=t[0]instanceof Array?t:[t],!(t.length==1&&t[0].length==0)){if(JSON.stringify(this.getShapeInfo(this.model))!=JSON.stringify(t)){let e=new Array,{globalIndex:r,layerId:i,net:n,strokeWidth:s,locked:a,type:l}=this.model;for(let c of t)if(c[0]=="CIRCLE"||c[0]=="C"){let h=new S(parseFloat(c[1])/10,parseFloat(c[2])/10),u=parseFloat(c[3])/10;this.model instanceof Po?(this.model.center=h,this.model.radius=u):(this.resultNeedToBeCached||(this.model=new $p(r,l,i,h,u,s,a,n,null,null)),this.model=zi.getInstance().addCircle(r,l,i,h,u,s,a,n));return}else if(c[0]=="R"){let h=new S(parseFloat(c[1])/10,parseFloat(c[2])/10),u=parseFloat(c[3])/10,d=parseFloat(c[4])/10,p=parseFloat(c[5])/180*Math.PI;isNaN(p)&&(p=0);let m=(parseFloat(c[6])||0)/10;this.model instanceof Aa?(this.model.start=h,this.model.width=u,this.model.height=d,this.model.rotation=p,this.model.radius=m):(this.resultNeedToBeCached||(this.model=new Zp(r,l,i,h,u,d,p,m,n,s,a,null,null)),this.model=rn.getInstance().addRect(r,l,i,h,u,d,n,a,s,p,m));return}else{let h=new S(parseFloat(c[0])/10,parseFloat(c[1])/10),u=new ro,d=new On,p=!1,m={layerId:i,strokeWidth:s,locked:a};for(let b=2,P=c.length;b<P;){let T=typeof c[b]=="number";if(c[b]=="L"||T&&p){let I=T?b:b+1,C=new S(parseFloat(c[I])/10,parseFloat(c[I+1])/10),E=I+I8.createId(),O=new ih(E,h,C,m);d.addLast(O),h=C,b=I+2,p=!0}else if(c[b]=="ARC"||c[b]=="CARC"||T&&!p){p=!1;let I=T?b:b+1,C=parseFloat(c[I])/180*Math.PI,E=new S(parseFloat(c[I+1])/10,parseFloat(c[I+2])/10);if(ne.greater(Ht.regular(C),0)&&!h.equals1(E)){let{center:O,radius:_,startAngle:R,endAngle:v,sweep:D}=u.pointToAngle(h,E,C),w=null;c[b]=="ARC"?w=1:w=2;let F=I+I8.createId(),H=new yh(F,O,_,R,v,D,m,w);d.addLast(H)}h=E,b=I+3}else throw Error("wrong path for poly")}let g=d.toArray();d.clear();let y=0;for(let b of g)if(y+=b.length,y>1e-8)break;if(y<1e-8||i!=11&&pd(l)&&!xu(g.map(b=>b.primitive),1e-4)){for(let b of g)b.remove();return null}g.length>0&&e.push(g)}if(this.model instanceof ss){let c=this.model.childrens;for(let h of c)for(let u of h)u.remove();this.model.childrens=e}else this.model=this.resultNeedToBeCached?Mi.getInstance().addPolygon(r,l,i,e,s,n,a,null,null):new Jp(r,l,i,e,s,n,a,null,null)}this.model instanceof ss&&(this.model.isSimplify&&this.model.refreshOutlineByChildren(),this.model.type=="Board Outline"&&!this.model.isClose()&&this.loadType("Line"))}}loadPourOrder(t,e){if(e!=null){let r=this.model.component;r instanceof Vn&&(r.order=e)}}loadComponent(t){this.model.component instanceof sR&&t instanceof sR?this.model.component.connects=Array.from(t.connects):this.model.component instanceof nu&&t instanceof nu?this.model.component.name=t.name:this.model.component instanceof wl&&t instanceof wl?($a.getInstance().modifyMainID(this.model.component.lineId,t.lineId,this.model.globalIndex),this.model.component.type=t.type,this.model.component.stretchLength=t.stretchLength,this.model.component.lineId=t.lineId,this.model.component.belong=t.belong):this.model.component instanceof K0&&t instanceof K0?(this.model.component.shellHeight=t.shellHeight,this.model.component.substrateHeight=t.substrateHeight,this.model.component.shellThickness=t.shellThickness,this.model.component.botShellHeight=t.botShellHeight,this.model.component.topInnerHeight=t.topInnerHeight,this.model.component.bottomInnerHeight=t.bottomInnerHeight,this.model.component.pushCoverDir=t.pushCoverDir):this.model.component instanceof um&&t instanceof um?(this.model.component.specification=t.specification,this.model.component.height=t.height,this.model.component.thickness=t.thickness,this.model.component.holeDiameter=t.holeDiameter,this.model.component.counterboreProps=t.counterboreProps,this.model.component.stiffenerProps=t.stiffenerProps):this.model.component instanceof ou&&t instanceof ou?($a.getInstance().modifyMainID(this.model.component.lineId,t.lineId,this.model.globalIndex),this.model.component.slotDepth=t.slotDepth,this.model.component.lineId=t.lineId,this.model.component.type=t.type,this.model.component.slotOption=t.slotOption):this.model.component instanceof Du&&t instanceof Du?(this.model.component.material=t.material,this.model.component.fpcModel=t.fpcModel,this.model.component.thickness=t.thickness):this.model.component instanceof Vn&&t instanceof Vn?(this.model.component.style=t.style,this.model.component.gridLineWidth=t.gridLineWidth,this.model.component.clearance=t.clearance,this.model.component.keepIsland=t.keepIsland,this.model.component.optimization=t.optimization,this.model.component.name=t.name,this.model.component.optimizationValue=t.optimizationValue,this.model.component.order=t.order):this.model.component instanceof Dc&&t instanceof Dc?(this.model.component.name=t.name,this.model.component.fileUuid=t.fileUuid):this.model.component instanceof fd&&t instanceof fd?(this.model.component.device=t.device,this.model.component.track=t.track,this.model.component.copper=t.copper,this.model.component.fill=t.fill,this.model.component.planzone=t.planzone):this.model.component instanceof ln&&t instanceof ln?($a.getInstance().modifyMainID(this.model.component.padId,t.padId,this.model.globalIndex),this.model.component.padId=t.padId,this.model.component.isBridgingCopper=t.isBridgingCopper,this.model.component.networkList=t.networkList):this.model.component instanceof J2&&t instanceof J2?this.model.component.connects=Array.from(t.connects):(this.model.component instanceof ln?$a.getInstance().delConnectRelatedId(this.model.component.padId,this.model.globalIndex):this.model.component instanceof wl||this.model.component instanceof ou?$a.getInstance().delConnectRelatedId(this.model.component.lineId,this.model.globalIndex):this.model.component instanceof J2,t instanceof ln?$a.getInstance().addConnectRelatedId(t.padId,this.model.globalIndex):this.model.component instanceof wl||this.model.component instanceof ou?$a.getInstance().addConnectRelatedId(this.model.component.lineId,this.model.globalIndex):t instanceof J2,this.model.component=t)}getShapeInfo(t){if(t instanceof Po)return $b(0,t);if(t instanceof Aa)return $b(1,t);if(t instanceof ss){let e=t.getMathGraphics(t.layerId,0);return $b(2,{pl:e})}}};var C8=class extends md{clearGroupId(){this.groupId=null}changeNet4Map(t){let e=t.get(this.net);e!=null&&(this.net=e)}feed(t){let{id:e,partitionId:r,groupId:i,netName:n,layerId:s,width:a,path:l,locked:c,zIndex:h,number:u,specialColor:d,polyType:p}=t;this.index=e,this.partition=r,this.groupId=Va(i),this.net=n,this.zIndex=h,this.number=u,this.isNumber(s)&&(this.layerId=s),this.isNumber(a)&&(this.width=a/10),this.path=l,this.locked=c,d&&(this.specialColor=ee.of3(d)),p!=null?this.type=cVe(p):(this.type="Line",U2(this.layerId)&&(this.type="Board Outline"))}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.resultNeedToBeCached&&!this.keepDisabledLayerItem&&!$e.getInstance().isValidLayer(this.layerId)||this.width==null||isNaN(this.width)||this.width<=0||this.path==null||this.locked==null)}polyCheck(){return!(this.index==null||this.layerId==null||this.layerId==1002||this.width==null||this.path==null||this.locked==null)}finish(){try{if(this.polyCheck()){let t=this.parseShapeModel(this.index,this.type,this.layerId,this.net,this.locked,this.width,this.path);return t==null?null:(this.groupId!=null&&t.setGroupID(this.groupId),this.partition&&(t.partition=this.partition),this.specialColor!=null&&(t.silkColor=this.specialColor),this.isNumber(this.zIndex)&&(t.zIndex=this.zIndex),this.isNumber(this.number)&&(t.number=this.number),t)}else return null}catch(t){console.log(t)}}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId),this.loadType(this.type),this.loadLayerId(this.layerId),this.loadWidth(this.width),this.partition!==void 0&&this.loadNet(this.net),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadSpecialColor(this.specialColor)}loadSpecialColor(t){(this.model.silkColor!=t&&(this.model.silkColor==null||t==null)||this.model.silkColor!=null&&t!=null&&!this.model.silkColor.equals(t))&&(this.model.silkColor=t)}};var _4=class _4 extends wi{constructor(){super(...arguments);this.layerMapSet={}}static getInstance(){return _4.manager==null&&(_4.manager=new _4),_4.manager}addModel(e){this.map.set(e.globalIndex,e);let r=this.layerMapSet[e.layerId];r==null&&(r=new Set,this.layerMapSet[e.layerId]=r),r.add(e)}add(e,r,i,n,s){return this._last=new Cn(e,r,i,n,s,!1,void 0),this.addModel(this._last),this._last}delete(e,r){if(e instanceof Cn){let i=this.layerMapSet[e.layerId];i&&i.delete(e),this.map.delete(r)}}};_4.manager=null;var Ho=_4;var aR=class extends md{clearGroupId(){this.groupId=null}isPlane(){return this.fillStyle==2}changeNet4Map(t){let e=t.get(this.net);e!=null&&(this.net=e)}feed(t){let{id:e,partitionId:r,groupId:i,netName:n,layerId:s,width:a,fillStyle:l,path:c,locked:h,zIndex:u,number:d,isBridgingCopper:p,networkList:m,refs:g,specialColor:y}=t;this.index=e,this.partition=r,this.groupId=Va(i),this.net=n,this.zIndex=u,this.number=d,this.isNumber(s)&&(this.layerId=s),this.isNumber(a)&&(this.width=a/10),this.fillStyle=this.getFillType(l),this.path=c,this.locked=h,this.isBridgingCopper=p,this.networkList=m||[],g&&(this.refs=g),y&&(this.specialColor=ee.of3(y))}getFillType(t){switch(t){case N2.SOLID:return 0;case N2.GRID:return 1;case N2.PLANE:return 2}}check(){var t;return!(this.index==null||this.groupId===void 0||this.layerId==null||this.resultNeedToBeCached&&!this.keepDisabledLayerItem&&!$e.getInstance().isValidLayer(this.layerId)||this.width==null||isNaN(this.width)||this.width<0||this.path==null||!((t=this.path)!=null&&t.length)||this.locked==null||this.isBridgingCopper&&this.networkList==null||this.fillStyle==null)}getComponent(){let t=new ln("",this.isBridgingCopper,this.networkList);return vE(this.layerId)&&this.refs!=null&&this.refs.length>0&&(t.padId=this.refs[0]),t}finish(){if(this.check())if(this.fillStyle==0){let t="Fill Region";gr(this.layerId)&&(t="Slot Region");let e=this.parseShapeModel(this.index,t,this.layerId,this.net,this.locked,this.width,this.path);if(e==null)return null;if(e.type=="Fill Region"){let r=this.getComponent();this.resultNeedToBeCached&&r.padId!=""&&$a.getInstance().addConnectRelatedId(r.padId,e.globalIndex),e.component=r}return this.specialColor!=null&&(e.silkColor=this.specialColor),this.groupId!=null&&e.setGroupID(this.groupId),this.partition&&(e.partition=this.partition),this.isNumber(this.zIndex)&&(e.zIndex=this.zIndex),this.isNumber(this.number)&&(e.number=this.number),e}else if(Rh($e.getInstance().getLayer(this.layerId).type)){let t=this.toFix(this.path,10),e=Ho.getInstance().add(this.index,this.layerId,this.net,this.fillStyle==2,t);return this.groupId!=null&&e.setGroupID(this.groupId),this.isNumber(this.zIndex)&&(e.zIndex=this.zIndex),this.isNumber(this.number)&&(e.number=this.number),e}else return null;else return null}loadPlanePath(t,e){let r=this.toFix(e,10);JSON.stringify(t.source)!==JSON.stringify(r)&&(t.pls=vu(r))}load(){if(this.fillStyle==0){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId),this.loadLayerId(this.layerId);let t="Fill Region";gr(this.layerId)&&(t="Slot Region"),this.loadType(t);let e=t=="Fill Region"?this.getComponent():null;this.loadComponent(e),this.partition!==void 0&&this.loadNet(this.net),this.loadWidth(this.width),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadSpecialColor(this.specialColor)}else{let t=Ho.getInstance().getItem(this.index);t&&(this.loadLayerId(this.layerId),this.partition!==void 0&&this.loadPlaneNet(this.net),this.loadPlanePath(t,this.path))}}loadPlaneNet(t){this.model.net!=t&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(this.model.net,this.model),this.model.net=t)}loadSpecialColor(t){(this.model.silkColor!=t&&(this.model.silkColor==null||t==null)||this.model.silkColor!=null&&t!=null&&!this.model.silkColor.equals(t))&&(this.model.silkColor=t)}toFix(t,e=1){let r=t.length,i=new Array(r),n="",s=null,a=null,l=null,c=0,h=0;for(;c<r;c++){s=t[c],a=s.length;let u=new Array(a);for(h=0;h<a;h++)l=s[h],n=typeof l,n==="number"?u[h]=l/e:u[h]=l;i[c]=u}return i}};var S8=class extends md{constructor(){super(...arguments);this.fpcModel=null}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,material:a,thickness:l,path:c,locked:h,zIndex:u,number:d}=e;this.index=r,this.partition=i,this.groupId=Va(n),this.zIndex=u,this.number=d,this.isNumber(s)&&(this.layerId=s);let p=zFe(a);p==="3M468"||p==="3M9077"||p==="TESA8854"?(this.material="Tape",this.fpcModel=p):p==="Polyimide"||p==="FR4"||p==="Stainless Steel"||p==="EMI Shielding Film"?(this.material=p,this.fpcModel=null):(this.material="Polyimide",this.fpcModel=null),this.thickness=l,this.path=c,this.locked=h}clearGroupId(){this.groupId=null}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.path==null||this.locked==null)}getComponent(){return new Du(this.material,this.fpcModel,this.thickness)}finish(){if(this.check()){let e=this.parseShapeModel(this.index,"FPC Stiffener",this.layerId,"",this.locked,1,this.path);return e==null?null:(this.partition&&(e.partition=this.partition),this.isNumber(this.zIndex)&&(e.zIndex=this.zIndex),this.isNumber(this.number)&&(e.number=this.number),e.component=this.getComponent(),e.setGroupID(this.groupId),e)}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId);let e=this.getComponent();this.loadType("FPC Stiffener"),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadComponent(e)}};var E8=class extends md{constructor(){super(...arguments);this.isConstraint=!1;this.track=!1;this.copper=!1;this.component=!1;this.fill=!1;this.planzone=!1}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,width:a,prohibitType:l,path:c,locked:h,zIndex:u,name:d,number:p,regionType:m}=e;this.index=r,this.partition=i,this.groupId=Va(n),this.zIndex=u,this.number=p,this.isNumber(s)&&(this.layerId=s),this.isNumber(a)&&(this.width=a/10),this.parseType(l),this.isConstraint=m==Nk.CONSTRAINT,this.path=c,this.locked=h,this.name=d}clearGroupId(){this.groupId=null}parseType(e){if(e!=null&&Array.isArray(e))for(let r of e)switch(r){case eT.COMPONENT:this.component=!0;break;case eT.TRACK:this.track=!0;break;case eT.FILL:this.fill=!0;break;case eT.COPPER:this.copper=!0;break;case eT.PLANE:this.planzone=!0;break}}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.resultNeedToBeCached&&!this.keepDisabledLayerItem&&!$e.getInstance().isValidLayer(this.layerId)||this.width==null||isNaN(this.width)||this.width<=0||this.path==null||this.locked==null)}regionCheck(){return!(this.index==null||this.layerId==null||this.width==null||this.path==null||this.locked==null)}getTypeAndComponent(){let e,r;return this.isConstraint?(e="Constraint Region",r=new nu(this.name)):(e="Prohibited Region",r=new fd(this.component,this.track,this.copper,this.fill,this.planzone)),{type:e,componentModel:r}}finish(){if(this.regionCheck()){Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]);let{type:e,componentModel:r}=this.getTypeAndComponent(),i=this.parseShapeModel(this.index,e,this.layerId,"",this.locked,this.width,this.path);return i==null?null:(this.partition&&(i.partition=this.partition),this.isNumber(this.zIndex)&&(i.zIndex=this.zIndex),this.isNumber(this.number)&&(i.number=this.number),i.component=r,i.setGroupID(this.groupId),i)}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId);let{type:e,componentModel:r}=this.getTypeAndComponent();this.loadType(e),this.loadLayerId(this.layerId),this.loadWidth(this.width),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadComponent(r)}};var lR=class extends md{feed(t){let{id:e,name:r,fileUuid:i,path:n}=t;this.index=e,this.name=r,this.fileUuid=i||"",this.path=n}check(){return!(!this.index||!this.name||this.path==null)}finish(){if(this.check()){x.getInstance().id==this.fileUuid&&(x.getInstance().partitionId=this.index),Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]);let t="Partition",e=new Dc(this.name);e.fileUuid=this.fileUuid,e.name=this.name;let r=this.parseShapeModel(this.index,t,1004,"",!1,.1,this.path);return r==null?null:(r.component=e,r)}else return null}getComponent(){return new Dc(this.name)}loadPartition(t,e){x.getInstance().id==t&&x.getInstance().partitionId!=e&&(x.getInstance().partitionId=e)}load(){this.loadPartition(this.fileUuid,this.index),this.loadPourOrder(this.layerId);let t=this.getComponent();t.fileUuid=this.fileUuid,this.loadPath(this.path),this.loadComponent(t)}};var O8=class extends md{constructor(){super(...arguments);this.order=0}addCopperDecode(e){this.coppers=e}clearCopperDecode(){this.coppers=null}feed(e){let{id:r,partitionId:i,groupId:n,netName:s,layerId:a,width:l,name:c,order:h,path:u,pourType:d,keepIsland:p,locked:m,zIndex:g,number:y}=e;this.index=r,this.partition=i,this.groupId=Va(n),this.net=s,this.zIndex=g,this.number=y,this.isNumber(a)&&(this.layerId=a),this.isNumber(l)&&(this.width=l/10),this.name=c,this.isNumber(h)&&(this.order=h),this.path=u,this.type=d,this.keepIsland=p,this.locked=m}clearGroupId(){this.groupId=null}changeNet4Map(e){let r=e.get(this.net);r!=null&&(this.net=r)}check(){return!(!this.pourcheck()||this.groupId===void 0||this.width==null||isNaN(this.width)||this.width<=0)}pourcheck(){if(this.index==null||this.net==null||this.layerId==null||this.resultNeedToBeCached&&!this.keepDisabledLayerItem&&!$e.getInstance().isSignalLayer(this.layerId)||this.width==null||this.path==null||this.locked==null||this.name==null||this.type==null||this.keepIsland==null||this.path==null)return!1;if(Array.isArray(this.path)){let e=[];for(let r of this.path)r!=null&&r.length>0&&e.push(r);if(e.length>0)this.path=e;else return!1}return!0}getComponent(){let e={};if(e.name=this.name,e.keepIsland=this.keepIsland,e.gridLineWidth=1,e.clearance=2,this.type.pourType===Lk.SOLID){e.style="solid",e.optimization=this.type.fineness!=0;let p=parseFloat(this.type.fineness)/10;e.optimizationValue=p}else{this.type.angle==0?e.style="90grid":e.style="45grid";let m=this.type.strokeWidth/10,g=this.type.strokeSpacing/10;e.gridLineWidth=m,e.clearance=g}let{style:i,gridLineWidth:n,clearance:s,keepIsland:a,optimization:l,name:c,optimizationValue:h}=e,u=h;return u==0&&(u=.8),new Vn(i,n,s,a,l,c,this.order,u)}finish(){var e;if(this.pourcheck()){Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]);let r=this.parseShapeModel(this.index,"Copper Region",this.layerId,this.net,this.locked,this.width,this.path);return r==null?null:(r.component=this.getComponent(),this.groupId!=null&&r.setGroupID(this.groupId),this.partition&&(r.partition=this.partition),this.isNumber(this.zIndex)&&(r.zIndex=this.zIndex),this.isNumber(this.number)&&(r.number=this.number),(e=this.coppers)==null||e.finish1(r),this.clearCopperDecode(),r)}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId,this.order);let e=this.getComponent();this.loadType("Copper Region"),this.loadLayerId(this.layerId),this.partition!==void 0&&this.loadNet(this.net),this.loadWidth(this.width),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadComponent(e)}};var v4=class v4 extends wi{static getInstance(){return v4.manager==null&&(v4.manager=new v4),v4.manager}addModel(t){return this.map.set(t.globalIndex,t),t}addCopper(t,e,r,i,n,s,a,l,c=!1,h=.8){return this._last=new Pn(t,e,r,i,n,s,a,l,c,void 0,h),this.addModel(this._last),this._last}delete(t,e){if(t instanceof lr||t instanceof Pn){this.map.delete(e);let r=t.getParent();r!=null&&r instanceof lr&&r.deleteCopper(e)}}};v4.manager=null;var Wo=v4;var Yre=class extends E0{constructor(){super(...arguments);this.coppers=[]}finish1(e){this.model=e;for(let r of this.coppers)r.finish1(e)}finish(){if(this.check())for(let e of this.coppers)e.finish()}check(){return!(!this.index||(this.model||(this.model=fVe(this.index),this.finish1(this.model)),!this.model))}feed(e){let{id:r,pourFill:i,number:n}=e,s;this.index=r;for(let a of i)s=new YCe,s.feed({...a,number:n}),this.coppers.push(s)}load(){}},YCe=class extends E0{constructor(){super()}check(){return!(!this.index||!this.path)}feed(t){let{id:e,strokeWidth:r,fill:i,path:n,number:s}=t;this.index=e,this.number=s,this.strokeWidth=r,this.fill=i,this.path=n}finish1(t){this.profile=t}getStyleAndWidth(t,e){let r=t.gridLineWidth,i=t.style,{optimization:n,optimizationValue:s=.8}=t;return(i=="90grid"||i=="45grid")&&e==0&&(i="solid",n=!0,s=r,r=0),i=="solid"&&e!=0&&(i="90grid"),(i=="90grid"||i=="45grid")&&e!=0&&(r=e),{style:i,gridLineWidth:r,optimization:n,optimizationValue:s}}finish(){if(this.profile==null)return;let t=this.profile.component;if(!(t instanceof Vn))return;let{style:e,gridLineWidth:r,optimization:i,optimizationValue:n}=this.getStyleAndWidth(t,this.strokeWidth);if(this.profile.addCopper(this.index),this.resultNeedToBeCached&&Wo.getInstance().getItem(this.index)!=null)return;let{layerId:s,net:a}=this.profile,{clearance:l}=t,c=new Pn(this.index,s,a,e,r,l,i,this.path,!1,null,n);return c.setParent(this.profile),this.isNumber(this.number)&&(c.number=this.number),this.resultNeedToBeCached&&Wo.getInstance().addModel(c),c}loadNet(t){this.model.net!==t&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(this.model.net,this.model),this.model.net=t)}loadStyle(t){this.model.style!==t&&(this.model.style=t)}loadGridLineWidth(t){this.model.gridLineWidth!==t&&(this.model.gridLineWidth=t)}loadPath(t){JSON.stringify(this.model.copperPath)!==JSON.stringify(t)&&this.model.update(this.model.net,vu(t))}load(){this.finish1(this.model.getParent()),this.loadLayerId(this.profile.layerId),this.loadNet(this.profile.net);let t=this.profile.component,{style:e,gridLineWidth:r}=this.getStyleAndWidth(t,this.strokeWidth);this.loadStyle(e),this.loadGridLineWidth(r),this.loadNumber(this.number),this.loadPath(this.path)}};var cR=class o extends ql{constructor(e,r,i,n,s,a,l,c,h,u,d,p){super();this.modelType="Image";this._globalIndex=e,this._template=h,this._silkColor=d,this._start=i,this._width=n,this._height=s,this._rotation=a,this._mirror=l;let m=xc(r,l);if(!p){let g=Ae.translate(0,-s,0).rotateZ(a).scale(m?-1:1,1,1).translate1(i.x,i.y,0);p=new vs(r,S.ORIGIN,new S(0,s),new S(n,0),new S(n,s),c,u),p.transform(g),p.updateBox()}this.box=p}get silkColor(){return this._silkColor||void 0}set silkColor(e){this.silkColor!=e&&(e?this._silkColor=e:delete this._silkColor)}get template(){return this._template}set template(e){this._template=e,this.templateModified=!0}get templateModified(){return this.hasDataState(7)}set templateModified(e){this.setDataState(7,e)}clone(){this.refreshBBox&&this.updateBox();let e=new o(this.globalIndex,this.layerId,this.start,this.width,this.height,this.rotation,this.mirror,this.locked,this.template,this.bbox,this.silkColor);return e.number=this.number,e.zIndex=this.zIndex,e}getViewMatrix(){let e=new _e;this._template.forEach(l=>{e.ext1(l.bbox())});let r=e.build1(),i=Ae.translate(-r.UL().x,-r.UL().y,0),n=r.height(),s=r.width(),a=Ae.scale(this.width/s,this.height/n,1);return i.multiply4(a).multiply4(this.matrix)}getRealPath(){let e=this.getViewMatrix().toMatrix3();return this._template.map(r=>r.multiply3(e))}getPath(){let e=this.getViewMatrix(),r=this.getTemplatePath();return r.forEach(i=>{i.pl=i.pl.multiply3(e.toMatrix3())}),r}getPathByTemplatePath(e){let r=this.getViewMatrix(),i=e;return i=i.map(n=>n.clone()),i.forEach(n=>{n.pl=n.pl.multiply3(r.toMatrix3())}),i}getTemplatePath(){let e=this._template.map(n=>n.clone());return new pm("",0,e).pls}get matrix(){let e=xc(this.layerId,this.mirror);return Ae.rotateZ(this.rotation).scale(e?-1:1,1,1).translate1(this.start.x,this.start.y,0)}get layerId(){return this.box.layerId}set layerId(e){this.layerId!=e&&(this.watchLayerIdModify(this.layerId),this.box.layerId=e,this.reset4Matrix(this.matrix),this.layerModified=!0)}get start(){return this._start}set start(e){this._start!=e&&(this._start=e,this.reset4Matrix(this.matrix))}get width(){return this._width}set width(e){this._width!=e&&(this._width=e,this.reset4(this.width,this.height,this.matrix))}get height(){return this._height}set height(e){this._height!=e&&(this._height=e,this.reset4(this.width,this.height,this.matrix))}get rotation(){return this._rotation}set rotation(e){this._rotation!=e&&(this._rotation=e,this.reset4Matrix(this.matrix))}get mirror(){return this._mirror}set mirror(e){this._mirror!=e&&(this._mirror=e,this.reset4Matrix(this.matrix))}get center(){return this.box.center}set center(e){let r=e.sub(this.center),i=Ae.translate(r.x,r.y,0);this.transform(i)}get bbox(){return this.box.bbox}get locked(){return this.box.locked}set locked(e){this.box.locked=e}transform(e){let r=new S(e.data[0],e.data[1]).normalize(),i=Math.atan2(r.y,r.x);xc(this.layerId,this.mirror)?this.rotation-=i:this.rotation+=i,this.start=this.start.multiply4(e)}inShape(e,r,i){return this.box.inShape(e,r,i)}reset4Matrix(e){this.reset4(this.width,this.height,e)}reset4(e,r,i){this.box.leftUp=S.ORIGIN.multiply4(i),this.box.leftLow=new S(0,-r).multiply4(i),this.box.rightLow=new S(e,-r).multiply4(i),this.box.rightUp=new S(e,0).multiply4(i),this.updateShapeData()}updateBox(){return this.box.updateBox()}getMathGraphics(e=this.layerId,r){return this.isEmpty?null:this.box.getMathGraphics(e,r)}buildBBox(){return this.isEmpty?null:(this.refreshBBox&&(this.updateBox(),this.refreshBBox=!1),this.bbox)}};var x4=class x4 extends wi{static getInstance(){return x4.manager==null&&(x4.manager=new x4),x4.manager}addModel(t){this.map.set(t.globalIndex,t)}addImage(t,e,r,i,n,s,a,l,c,h){let u=new cR(t,e,r,i,n,s,a,l,c,void 0,h);return this.addModel(u),u}delete(t){t instanceof ql&&this.map.delete(t.globalIndex)}};x4.manager=null;var Qs=x4;var A8=class extends E0{loadStart(t){this.model.start.equals(t)||(this.model.start=t)}loadWidth(t){this.model.width!==t&&(this.model.width=t)}loadHeight(t){this.model.height!==t&&(this.model.height=t)}loadAngle(t){this.model.rotation!==t&&(this.model.rotation=t)}loadMirror(t){this.model.mirror!==t&&(this.model.mirror=t)}};var _8=class extends A8{constructor(){super();this.start=S.ORIGIN}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,startX:a,startY:l,width:c,height:h,angle:u,mirror:d,path:p,locked:m,zIndex:g,number:y,specialColor:b}=e;this.index=r,this.partition=i,this.groupId=Va(n),this.zIndex=g,this.number=y,this.isNumber(s)&&(this.layerId=s),this.isNumber(c)&&(this.width=c/10),this.isNumber(a)&&this.isNumber(l)&&(this.start=new S(a/10,l/10)),this.isNumber(h)&&(this.height=h/10),this.isNumber(u)&&(this.angle=u/180*Math.PI),this.mirror=d,this.path=p,this.locked=m,b&&(this.specialColor=ee.of3(b))}clearGroupId(){this.groupId=null}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.resultNeedToBeCached&&!this.keepDisabledLayerItem&&!$e.getInstance().isValidLayer(this.layerId)||((this.layerId==58||this.layerId==59)&&(this.layerId=1),this.width==null||isNaN(this.width)||this.width<=0)||this.height==null||isNaN(this.height)||this.height<=0||this.locked==null||this.angle==null||isNaN(this.angle))}finish(e=!1){if(!this.check())return null;let r=e?this.path:vu(this.path),i=this.resultNeedToBeCached?Qs.getInstance().addImage(this.index,this.layerId,this.start,this.width,this.height,this.angle,this.mirror,this.locked,r):new cR(this.index,this.layerId,this.start,this.width,this.height,this.angle,this.mirror,this.locked,r);return this.groupId!=null&&i.setGroupID(this.groupId),this.partition&&(i.partition=this.partition),this.specialColor!=null&&(i.silkColor=this.specialColor),this.isNumber(this.zIndex)&&(i.zIndex=this.zIndex),this.isNumber(this.number)&&(i.number=this.number),i}loadPath(e){JSON.stringify(ef(this.model.template))!==JSON.stringify(e)&&(this.model.template=vu(e))}load(){this.loadPartitionId(this.partition),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadStart(this.start),this.loadWidth(this.width),this.loadHeight(this.height),this.loadAngle(this.angle),this.loadMirror(this.mirror),this.loadPath(this.path),this.loadSpecialColor(this.specialColor)}loadSpecialColor(e){(this.model.silkColor!=e&&(this.model.silkColor==null||e==null)||this.model.silkColor!=null&&e!=null&&!this.model.silkColor.equals(e))&&(this.model.silkColor=e)}};var jre=class extends $l{get hashkey(){return this.name}feed(t){let{netName:e,netType:r,specialColor:i,retLine:n,differentialName:s,isPositiveNet:a,equalLengthGroupName:l}=t;this.name=e,this.type=r,i!=null?this.specialColor=ee.of3(i):this.specialColor=null,this.showRatline=n,s!=null?this.DifferentailName=s:s===null&&(this.DifferentailName=null),l!=null&&(this.EqualLengthGroupName=l),this.IsPositiveNet=a}check(){return!(this.name==null||this.type===void 0||this.specialColor===void 0||this.showRatline===void 0)}finish(){if(this.name==null||!this.resultNeedToBeCached)return;let t=te.getInstance().getNet(this.name);if(t==null&&(t=te.getInstance().addNet(this.name)),this.type!=null){let e=te.getInstance().getNetClass(this.type);e==null&&(e=te.getInstance().addNetClass(this.type)),e.addNetwork(t)}if(this.DifferentailName){let e=te.getInstance().getNetDifferential(this.DifferentailName);e==null&&(e=te.getInstance().addNetDifferential(this.DifferentailName)),e.positiveNet!=null?e.fillNegativeNet(t):e.positiveNet!=null||this.IsPositiveNet?e.fillPositiveNet(t):e.fillNegativeNet(t)}if(this.EqualLengthGroupName){let e=te.getInstance().getEqualLengthGroup(this.EqualLengthGroupName);e==null&&(e=te.getInstance().addEqualLengthGroup(this.EqualLengthGroupName)),e.addEqualLengthGroup(t)}return this.specialColor&&te.getInstance().setSpecialColor(t.name,this.specialColor),t.showRatline=this.showRatline,t}loadNetType(t,e){if(e!=null){let r=te.getInstance().getNetClass(e);r==null&&(r=te.getInstance().addNetClass(e)),r.getNet(this.name)||r.addNetwork(t)}else t.netClass&&t.netClass.removeNetwork(t.name)}loadDifferentialName(t,e,r){if(e){let i=te.getInstance().getNetDifferential(e);i==null&&(i=te.getInstance().addNetDifferential(e)),i.hasNet(t.name)||(i.positiveNet!=null?i.fillNegativeNet(t):i.positiveNet!=null||r?i.fillPositiveNet(t):i.fillNegativeNet(t))}else t.netDifferential&&t.netDifferential.removeNetDifferential(t.name)}loadEqualLengthGroupName(t,e){if(e){let r=te.getInstance().getEqualLengthGroup(e);r==null&&(r=te.getInstance().addEqualLengthGroup(e)),r.hasNet(t.name)||r.addEqualLengthGroup(t)}else t.equalLengthGroup&&t.equalLengthGroup.removeNetwork(t.name)}load(){if(!this.resultNeedToBeCached)return;let t=te.getInstance().getNet(this.name);t==null&&(t=te.getInstance().addNet(this.name)),this.loadNetType(t,this.type),this.loadDifferentialName(t,this.DifferentailName,this.IsPositiveNet),this.loadEqualLengthGroupName(t,this.EqualLengthGroupName)}};var YS=class extends z2{constructor(e,r,i){super();this.modelType="Combination";this._items=new Array(0);this._indexs=new Set;this.globalIndex=e,this.update(r,i)}get size(){return this._items.length}get name(){return this._name}set name(e){this._name=e}get isEmpty(){return this.hasDataState(1)}set isEmpty(e){this.setDataState(1,e)}get locked(){for(let e of this._items)if(e.locked)return!0;return!1}update(e,r){this.clearCache(),this._name=r;for(let i of e)i instanceof ys||i instanceof nl?(i.getParent().setGroupID(this.globalIndex),this._items.push(i.getParent()),this._indexs.add(i.getParent().globalIndex)):(i.setGroupID(this.globalIndex),this._items.push(i),this._indexs.add(i.globalIndex))}clearCache(){for(let e of this._items)e.setGroupID(void 0);this._items.length=0,this._indexs.clear()}getIndex(){return new Set(this._indexs)}updateIndexs(){this._indexs.clear();for(let e of this._items)this._indexs.add(e.globalIndex)}addItem(e){e instanceof ys||e instanceof nl?e.getParent().setGroupID(this.globalIndex):e.setGroupID(this.globalIndex),this._items.push(e),this._indexs.add(e.globalIndex)}deleteItem(e){let r=this._items.indexOf(e);r>=0&&(this._items.splice(r,1),this._indexs.delete(e.globalIndex),e.setGroupID(void 0))}getItems(){return this._items}setItems(e){this._items=e,this.updateIndexs()}dissolution(){for(let e of this._items)e.setGroupID(void 0);this._items.length=0,this._indexs.clear(),this.isEmpty=!0}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}transform(e){for(let r of this._items)r.transform(e)}getBBox(){let e=new _e;for(let r of this._items)if(r instanceof ki){let i=r.buildBBox();i!=null&&e.ext1(i)}return e.build1()}remove(){this.dissolution()}updateBox(){let e=new _e;for(let r of this._items)if(r instanceof ki){let i=r.buildBBox();i!=null&&e.ext1(i)}return e.build1()}clone(){throw new Error("Method not implemented.")}hasItem(e){return this._indexs.has(e)}};var R4=class R4 extends wi{constructor(){super(...arguments);this.numberManager=new Q0;this.combinOptions=new Array;this.modifyOptions=!0}static getInstance(){return R4.manager==null&&(R4.manager=new R4),R4.manager}combination(e,r){let i=this.numberManager.getNum("");return this._last=new YS(i,e,r),this.map.set(i,this._last),this.numberManager.add(i),this.numberManager.add(r.split("group")[1]||""),this.modifyOptions=!0,this._last}getGroupByName(e){for(let r of this.map.values())if(r.name===e)return r;return null}getGroupNameByGroupId(e){var r;return e&&((r=this.getItem(e))==null?void 0:r.name)||null}getDefaultName(){return"group"+this.numberManager.getNum("")}joinCombination(e,r){let i=this.map.get(r);return i==null?(console.log("not exsit combination,join,combination fail!!!!!"),null):(e.forEach(n=>{if(n instanceof ys||n instanceof nl){let s=n.getParent();s!=null&&i.addItem(s)}else i.addItem(n)}),this.modifyOptions=!0,i)}removeFromCombination(e,r){let i=this.map.get(r);return i==null?(console.log("not exsit combination,join,combination fail!!!!!"),null):(e.forEach(n=>i.deleteItem(n)),this.modifyOptions=!0,i)}getAllGroupId(){if(this.map.size===0)return[];let e=this.map.keys(),r=new Array(this.map.size),i=0;for(let n of e)r[i]=n,i++;return r}getCombin(){return this.modifyOptions&&(this.updateCombinOptions(),this.modifyOptions=!1),this.combinOptions}updateCombinOptions(){let e=new Array;for(let r of this.map.values()){let i={};i.value=r.name,i.text=r.name,e.push(i)}this.combinOptions=e}copy(e){}rebuild(e,r,i){e=e.toString(),this.numberManager.add(e),(i==null||i=="")&&(i="group"+e);let n=new YS(e,r,i);return this.map.set(e,n),this.modifyOptions=!0,n}delete(e,r){if(e.modelType==="Combination")this.numberManager.deleteNum(r),this.map.delete(r),this.modifyOptions=!0;else if(e instanceof z2){let i=e.getGroupID();if(i!=null){let n=this.getItem(i);n!=null&&n.deleteItem(e)}}}};R4.manager=null;var Ip=R4;var Xre=class extends $l{get hashkey(){return this.id}feed(t){let{id:e,groupName:r}=t;this.id=e.toString(),this.name=r}check(){return!(!this.id||!this.name)}finish(){if(!this.resultNeedToBeCached)return new YS(this.id,[],this.name);let t=Ip.getInstance(),e=t.getItem(this.id);return e==null&&(e=t.rebuild(this.id,[],this.name)),e}load(){this.model.globalIndex==this.id&&this.model.name!==this.name&&(this.model.name=this.name)}};var Gg=class o extends It{constructor(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y){super();this.modelType="Via";c=bo(c*2)/2,u=bo(u*2)/2,this._type=r,this._name=i,this._viaBaseInfo=Ea.getViaBaseInfo(n,s,c,u),this._center=h,this._viaExpansion=I0.getViaExpansion(d,p,m),this._unusedInnerLayers=a,this._net=l.toString(),this._locked=g,this._bbox=y||wY(c,h,u,p,m),this.globalIndex=e,jo("data/model/ViaModel")}get net(){var e;return(e=this._net)==null?void 0:e.toUpperCase()}set net(e){this._net!=e&&(this._parent!=null&&this._parent instanceof ki&&this._parent.modelType=="Component"&&this._parent.setNet(this.globalIndex,this.globalIndex,e),this._net=e,this.netModified=!0)}get showNet(){return this._net}get name(){return this._name}set name(e){this.name!=e&&(this._name=e)}get unusedInnerLayers(){return this._unusedInnerLayers}set unusedInnerLayers(e){this._unusedInnerLayers.toString()!=e.toString()&&(this._unusedInnerLayers=e,this.updateShapeData())}get layerId(){return 12}set layerId(e){}get viaExpansion(){return this._viaExpansion}set viaExpansion(e){this._viaExpansion!=e&&(this.checkExpansionModify(e),this._viaExpansion=e)}get expansionType(){return this._viaExpansion.expansionType}set expansionType(e){this._viaExpansion.expansionType!=e&&(this.viaExpansion=I0.getExpansionByexpansionType(e,this.viaExpansion))}get viaBaseInfo(){return this._viaBaseInfo}set viaBaseInfo(e){this._viaBaseInfo!=e&&(this.checkBaseInfoModify(e),this._viaBaseInfo=e)}get type(){return this._type}set type(e){this.type!=e&&(this._type=e,this.updateShapeData())}get startLayer(){return this._viaBaseInfo.startLayer}set startLayer(e){this._viaBaseInfo.startLayer!=e&&(this.viaBaseInfo=Ea.getViaBaseInfoByStartLayer(e,this.viaBaseInfo),this.layerOrBoxModified=!0)}get endLayer(){return this._viaBaseInfo.endLayer}set endLayer(e){this._viaBaseInfo.endLayer!=e&&(this.viaBaseInfo=Ea.getViaBaseInfoByEndLayer(e,this.viaBaseInfo),this.layerOrBoxModified=!0)}get radius(){return this._viaBaseInfo.radius}set radius(e){this._viaBaseInfo.radius!=e&&(this._viaBaseInfo=Ea.getViaBaseInfoByRadius(e,this.viaBaseInfo),this.updateShapeData(),this.radiusModified=!0)}get radiusModified(){return this.hasDataState(7)}set radiusModified(e){this.setDataState(7,e)}get center(){return this._center}set center(e){this._center.equals(e)||(this._center=e,this.updateShapeData())}get holeRadius(){return this.viaBaseInfo.holeRadius}set holeRadius(e){e=bo(e*2)/2,this._viaBaseInfo.holeRadius!=e&&(this._viaBaseInfo=Ea.getViaBaseInfoByHoleRadius(e,this.viaBaseInfo),this.updateShapeData(),this.holeRadiusModified=!0)}get holeRadiusModified(){return this.hasDataState(8)}set holeRadiusModified(e){this.setDataState(8,e)}get topExpansion(){return this._viaExpansion.topExpansion}set topExpansion(e){this._viaExpansion.topExpansion!=e&&(this._viaExpansion=I0.getExpansionByTopExpansion(e,this.viaExpansion),this.updateShapeData(),this.topExpansionModified=!0)}get topExpansionModified(){return this.hasDataState(9)}set topExpansionModified(e){this.setDataState(9,e)}get bottomExpansion(){return this._viaExpansion.bottomExpansion}set bottomExpansion(e){this._viaExpansion.bottomExpansion!=e&&(this._viaExpansion=I0.getExpansionByBottomExpansion(e,this.viaExpansion),this.updateShapeData(),this.bottomExpansionModified=!0)}get bottomExpansionModified(){return this.hasDataState(10)}set bottomExpansionModified(e){this.setDataState(10,e)}get locked(){return this._locked}set locked(e){this._locked!=e&&(this._locked=e,this.updateShapeData())}isContains(e){return Ub(e,this.type,this.startLayer,this.endLayer)}isSeparated(e){return!this.isContains(e.startLayer)&&!this.isContains(e.endLayer)&&!e.isContains(this.startLayer)&&!e.isContains(this.endLayer)}isUnuseLayer(e){let r=1<<e-15;return(NE.compress(this._unusedInnerLayers)&r)!==0}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}transform(e){this.center=this.center.multiply4(e)}inOutline(e){let r=Math.max(this.radius,this.holeRadius);return M1(e,this.center,r)}inShape(e,r){return this.inOutline(new S(e,r))}getMathGraphics(e=this.layerId,r=0){if(this.isEmpty||this.isUnuseLayer(e))return null;if(e==12||e===47)return fe.build2([q.build3(this.center,0,-360,this.holeRadius,this.holeRadius)]);if([5,6].includes(e)){let i=e==5?this.topExpansion:this.bottomExpansion,n=this.radius+i;return n<=0?null:fe.build2([q.build3(this.center,0,-360,n,n)])}else return fe.build2([q.build3(this.center,0,-360,this.radius+r,this.radius+r)])}getFileGraphics(e,r,i){if(this.isEmpty)return null;if(gr(e)){let n=[];if(i==null){let s=this.getOneInnerInUse();s==null?i=[]:i=[s]}for(let s of i){let a=this.getMathGraphics(s,r);a!=null&&n.push(a)}return n}else{let n=this.getMathGraphics(e,r);return n!=null?[n]:null}}updateBox(){return this._bbox=wY(this.radius,this.center,this.holeRadius,this.topExpansion,this.bottomExpansion),this._bbox}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this._type,this._name,this._viaBaseInfo.startLayer,this._viaBaseInfo.endLayer,this._unusedInnerLayers,this._net,this._viaBaseInfo.radius,this._center,this._viaBaseInfo.holeRadius,this._viaExpansion.expansionType,this._viaExpansion.topExpansion,this._viaExpansion.bottomExpansion,this._locked,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}multiply3(e){let r=e.toMatrix3(),i=this.getMathGraphics();return i!=null?i.multiply3(r):null}getOneInnerInUse(){for(let e=15;e<=46;e++)if(!this.isUnuseLayer(e))return e;return null}checkBaseInfoModify(e){this._viaBaseInfo.radius!=e.radius&&(this.radiusModified=!0,this.updateShapeData()),this._viaBaseInfo.holeRadius!=e.holeRadius&&(this.holeRadiusModified=!0,this.updateShapeData()),this._viaBaseInfo.startLayer!=e.startLayer&&(this.layerOrBoxModified=!0),this._viaBaseInfo.endLayer!=e.endLayer&&(this.layerOrBoxModified=!0)}checkExpansionModify(e){this._viaExpansion.topExpansion!=e.topExpansion&&(this.topExpansionModified=!0,this.updateShapeData()),this._viaExpansion.bottomExpansion!=e.bottomExpansion&&(this.topExpansionModified=!0,this.updateShapeData())}};var D4=class D4 extends wi{static getInstance(){return D4.manager==null&&(D4.manager=new D4),D4.manager}addModel(t){this.map.set(t.globalIndex,t)}addVia(t,e,r,i,n,s,a,l,c,h,u,d,p,m=new Array,g=!1){e==0&&g&&(e=2);let y=new Gg(t,e,r,i,n,m,s,a,l,c,u,d,p,h);return this.addModel(y),y}delete(t,e){t instanceof It&&this.map.delete(e)}};D4.manager=null;var Tn=D4;var w4=class extends E0{constructor(){super(...arguments);this.layerId=12;this.name="";this.center=S.ORIGIN;this.holeRadius=0;this.radius=0;this.isSuture=!1}feed(e){let{id:r,partitionId:i,groupId:n,netName:s,ruleName:a,centerX:l,centerY:c,holeDiameter:h,viaDiameter:u,viaType:d,topSolderExpansion:p,bottomSolderExpansion:m,locked:g,zIndex:y,unusedInnerLayers:b,number:P}=e;this.index=r,this.partition=i,this.groupId=Va(n),this.net=s,this.zIndex=y,this.number=P,this.isNumber(l)&&this.isNumber(c)&&(this.center=new S(l/10,c/10)),this.isNumber(h)&&(this.holeRadius=h/20),this.isNumber(u)&&(this.radius=u/20),this.isSuture=_Fe(d)==2,p===null?this.topSolderExpansion=null:this.isNumber(p)&&(this.topSolderExpansion=p/10),m===null?this.bottomSolderExpansion=null:this.isNumber(m)&&(this.bottomSolderExpansion=m/10),this.unusedInnerLayers=b||[],this.name=a,this.locked=g}clear(){this.model=null,this.index=null,this.partition=null,this.groupId=null,this.net=null,this.zIndex=null,this.number=null,this.layerId=null,this.name="",this.startLayer=null,this.endLayer=null,this.center=S.ORIGIN,this.holeRadius=0,this.radius=0,this.isSuture=!1,this.topSolderExpansion=null,this.bottomSolderExpansion=null,this.unusedInnerLayers=null,this.zIndex=null,this.number=null,this.locked=null}clearGroupId(){this.groupId=null}changeNet4Map(e){let r=e.get(this.net);r!=null&&(this.net=r)}check(){return!(!this.viaCheck()||this.holeRadius==null||isNaN(this.holeRadius)||this.radius==null||isNaN(this.radius)||this.topSolderExpansion===void 0||this.bottomSolderExpansion===void 0)}viaCheck(){return!(this.index==null||this.net==null||this.locked==null)}getViaType(e){let r=0;if(this.name!=""){let i=te.getInstance().getDefaultBlindPhysics(),n=i==null?void 0:i.getBlindVia(this.name);n!=null?(r=1,this.model.viaBaseInfo=Ea.getViaBaseInfo(n.startLayer,n.endLayer,this.radius,this.holeRadius)):r=0}return r==0&&e&&(r=2),r}finish(){if(this.viaCheck()){let e=0;if(this.name!=""){let n=te.getInstance().getDefaultBlindPhysics(),s=n==null?void 0:n.getBlindVia(this.name);s!=null?(e=1,this.startLayer=s.startLayer,this.endLayer=s.endLayer,this.resultNeedToBeCached&&s.status.used.add(this.index)):(this.name="",e=0,this.startLayer=1,this.endLayer=2)}else this.startLayer=1,this.endLayer=2;let r=1;this.topSolderExpansion==null||this.bottomSolderExpansion==null?(r=1,this.topSolderExpansion=-100,this.bottomSolderExpansion=-100):r=2;let i=this.getItem(e,r);return this.groupId!=null&&i.setGroupID(this.groupId),this.partition&&(i.partition=this.partition),this.isNumber(this.zIndex)&&(i.zIndex=this.zIndex),this.isNumber(this.number)&&(i.number=this.number),i}else return null}getItem(e,r){return this.resultNeedToBeCached?Tn.getInstance().addVia(this.index,e,this.name,this.startLayer,this.endLayer,this.net,this.radius,this.center,this.holeRadius,this.locked,r,this.topSolderExpansion,this.bottomSolderExpansion,this.unusedInnerLayers,this.isSuture):(e==0&&this.isSuture&&(e=2),new Gg(this.index,e,this.name,this.startLayer,this.endLayer,this.unusedInnerLayers,this.net,this.radius,this.center,this.holeRadius,r,this.topSolderExpansion,this.bottomSolderExpansion,this.locked))}getName(){return this.name}loadNet(e){this.model.net!==e&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(this.model.net,this.model),this.model.net=e)}loadName(e){this.model.name!==e&&(this.model.name=e)}loadCenter(e){this.model.center.equals(e)||(this.model.center=e)}loadHoleRadius(e){this.model.holeRadius!==e&&(this.model.holeRadius=e)}loadRadius(e){this.model.radius!=e&&(this.model.radius=e)}loadType(e){let r=this.getViaType(e);this.model.type!==r&&(this.model.type=r)}loadTopExpansion(e){this.model.topExpansion!==e&&(this.model.topExpansion=e)}loadBottomExpansion(e){this.model.bottomExpansion!==e&&(this.model.bottomExpansion=e)}loadExpansionType(){let e=2;if((this.topSolderExpansion==null||this.bottomSolderExpansion==null)&&(e=1),this.model.expansionType!=e&&(this.model.expansionType=e),e==1){let r=this.net,i=te.getInstance().getSolderExpansionByNet(r);i&&(this.topSolderExpansion=i.viaTopExpansion,this.bottomSolderExpansion=i.viaBottomExpansion)}}loadUnusedInnerLayers(e){this.model.unusedInnerLayers.toString()!=e.toString()&&(this.model.unusedInnerLayers=e)}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.partition!==void 0&&this.loadNet(this.net),this.loadName(this.name),this.loadCenter(this.center),this.loadHoleRadius(this.holeRadius),this.loadRadius(this.radius),this.loadType(this.isSuture),this.loadExpansionType(),this.loadTopExpansion(this.topSolderExpansion),this.loadBottomExpansion(this.bottomSolderExpansion),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadUnusedInnerLayers(this.unusedInnerLayers)}};var L4=class L4 extends wi{static getInstance(){return L4.manager==null&&(L4.manager=new L4),L4.manager}addModel(t){this.map.set(t.globalIndex,t)}addPad(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T=null,I,C,E){return this._last=new US(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,void 0,C,E),this.addModel(this._last),this._last}delete(t,e){t instanceof Je&&this.map.delete(e)}};L4.manager=null;var $n=L4;var qE=class extends Rn{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case 0:return this.id;case"groupId":return Fa(e);case"netName":return e.showNet;case"layerId":return e.layerId;case"num":return e.num;case"centerX":return xe(e.center.x*10,4);case"centerY":return xe(e.center.y*10,4);case"padAngle":return xe(e.rotation/Math.PI*180,4);case"hole":return qCe(e);case"defaultPad":return jCe(e);case"specialPad":return XCe(e);case"padOffsetX":return xe(e.holeOffset.x*10,4);case"padOffsetY":return xe(e.holeOffset.y*10,4);case"relativeAngle":return xe(e.holeRotation/Math.PI*180,4);case"plated":return e.plated;case"padType":return e.isTestPad?d8(1):d8(0);case"topSolderExpansion":return e.expansionType==1?null:xe(e.topSolderExpansion*10,4);case"bottomSolderExpansion":return e.expansionType==1?null:xe(e.bottomSolderExpansion*10,4);case"topPasteExpansion":return e.expansionType==1?null:xe(e.pasteExpansion*10,4);case"bottomPasteExpansion":return e.expansionType==1?null:xe(e.pasteExpansion*10,4);case"locked":return e.locked;case"zIndex":return e.zIndex;case"connectMode":{let r=e.padRule;return r?m4(r.connectMode):null}case"spokeSpace":{let r=e.padRule;return r?xe(r.lineClearance*10,4):null}case"spokeWidth":{let r=e.padRule;return r?xe(r.lineWidth*10,4):null}case"spokeAngle":{let r=e.padRule;return r?xe(r.lineAngle/Math.PI*180,4):null}case"unusedInnerLayers":return e.unusedInnerLayers;case"padLen":return xe(e.padLen*10,4);case"attrsMap":return vj(e)}}};function vj(o){let t=o.getParent(),e;t&&(e=Wi.getInstance().getItem(t.footprintUUID));let r={};for(let i in o.attrsMap){let n=o.attrsMap[i];t?(e.getValue(i)==null||e.getValue(i)!=null&&e.getValue(i)!=n)&&(r[i]=n):r[i]=n}return r}function jCe(o){if(o instanceof Je)return o.isPolygon()?{padType:_g.POLYGON,path:F1(o.polygonPl,10)}:o.layerId==12||o.layerId==1?_j(o.top):_j(o.bottom)}function _j(o){switch(o.type){case"RECT":return{padType:_g.RECT,width:xe(o.width*10,4),height:xe(o.height*10,4),radius:o.ratio*100};default:return{padType:rVe(o.type),width:xe(o.width*10,4),height:xe(o.height*10,4)}}}function XCe(o){if(!(o instanceof Je)||o.type!=2||o.isPolygon())return[];let t=_j(o.top),e=_j(o.inner),r=_j(o.bottom);return[{startLayer:1,endLayer:1,pad:t},{startLayer:1,endLayer:2,pad:e},{startLayer:2,endLayer:2,pad:r}]}function qCe(o){return gr(o.layerId)?{holeType:nVe(o.holeShape),width:xe(o.holeLength*10,4),height:xe(o.holeRadius*20,4)}:null}var M4=class extends E0{constructor(){super(...arguments);this.center=S.ORIGIN;this.type=1;this.padType=0;this.defaultRatio=0;this.topRatio=0;this.bottomRatio=0;this.innerRatio=0;this.holeOffset=S.ORIGIN}feed(e){let{id:r,partitionId:i,groupId:n,netName:s,layerId:a,num:l,centerX:c,centerY:h,padAngle:u,hole:d,defaultPad:p,specialPad:m,padOffsetX:g,padOffsetY:y,relativeAngle:b,plated:P,padType:T,topSolderExpansion:I,bottomSolderExpansion:C,topPasteExpansion:E,bottomPasteExpansion:O,locked:_,zIndex:R,connectMode:v,spokeSpace:D,spokeWidth:w,spokeAngle:F,unusedInnerLayers:H,number:z,padLen:G,refs:W,attrsMap:L}=e;if(this.index=r,this.partition=i,this.groupId=Va(n),this.net=s,this.zIndex=R,this.number=z,this.isNumber(c)&&this.isNumber(h)&&(this.center=new S(c/10,h/10)),this.isNumber(a)&&(this.layerId=a),this.num=l,this.isNumber(u)){let N=u/180*Math.PI;this.rotation=N}this.parseHole(d);let B=this.parseDefaultPad(p);if(B&&(B.isPolygon?this.path=B.path:(this.defaultType=B.shape,this.defaultWidth=B.width,this.defaultHeight=B.height,B.ratio&&(this.defaultRatio=B.ratio))),this.parseSpecialPad(m),this.isNumber(g)&&this.isNumber(y)&&(this.holeOffset=new S(g/10,y/10)),this.isNumber(b)&&(this.holeRotation=b/180*Math.PI),this.plated=P,this.padType=OFe(T),I==null?this.topSolderExpansion=null:this.isNumber(I)&&(this.topSolderExpansion=I/10),C==null?this.bottomSolderExpansion=null:this.isNumber(C)&&(this.bottomSolderExpansion=C/10),E==null?this.pasteExpansion=null:this.isNumber(E)&&(this.pasteExpansion=E/10),O==null?this.pasteExpansion=null:this.isNumber(O)&&(this.pasteExpansion=O/10),v==null)this.connectMode=null;else{let N=f4(v);this.connectMode=isNaN(N)?null:N}if(D==null)this.spokeSpace=null;else{let N=D/10;this.spokeSpace=isNaN(N)?null:N}if(w==null)this.spokeWidth=null;else{let N=w/10;this.spokeWidth=isNaN(N)?null:N}if(F==null)this.spokeAngle=null;else{let U=F/180*Math.PI;this.spokeAngle=isNaN(U)?null:U}this.prepareExpansion(),this.unusedInnerLayers=H||[],this.locked=_,this.padLen=(G||0)/10,this.attrsMap=L||{},W&&(this.refs=W)}clear(){this.model=null,this.index=null,this.partition=null,this.groupId=null,this.net=null,this.zIndex=null,this.number=null,this.layerId=null,this.num=null,this.center=S.ORIGIN,this.type=1,this.padType=0,this.holeRadius=null,this.defaultType=null,this.defaultWidth=null,this.defaultHeight=null,this.defaultRatio=0,this.topType=null,this.topWidth=null,this.topHeight=null,this.topRatio=0,this.bottomType=null,this.bottomWidth=null,this.bottomHeight=null,this.bottomRatio=0,this.innerType=null,this.innerWidth=null,this.innerHeight=null,this.innerRatio=0,this.rotation=null,this.expansionType=null,this.pasteExpansion=null,this.topSolderExpansion=null,this.bottomSolderExpansion=null,this.plated=null,this.holeLength=null,this.holeShape=null,this.holeRotation=null,this.holeOffset=S.ORIGIN,this.path=null,this.connectMode=null,this.spokeSpace=null,this.spokeWidth=null,this.spokeAngle=null,this.unusedInnerLayers=null,this.thermalType=null,this.padLen=null,this.attrsMap=null,this.zIndex=null,this.number=null,this.refs=null,this.locked=null}clearGroupId(){this.groupId=null}clearFootExcludeProps(){super.clearFootExcludeProps(),this.net="",this.attrsMap=null}changeNet4Map(e){let r=e.get(this.net);r!=null&&(this.net=r)}parseHole(e){e!=null&&(this.holeShape=iVe(e.holeType),isNaN(e.width)||(this.holeLength=e.width/10),isNaN(e.height)||(this.holeRadius=e.height/20))}parseSpecialPad(e){!Array.isArray(e)||e.length==0||(this.type=2,e.forEach(r=>{if(Io(r.startLayer)&&Io(r.endLayer)){let i=this.parseDefaultPad(r.pad);if(!i)return;i.isPolygon?this.path=i.path:(this.topType=i.shape,this.topWidth=i.width,this.topHeight=i.height,i.ratio&&(this.topRatio=i.ratio))}else if(2==r.startLayer&&2==r.endLayer){let i=this.parseDefaultPad(r.pad);if(!i)return;i.isPolygon?this.path=i.path:(this.bottomType=i.shape,this.bottomWidth=i.width,this.bottomHeight=i.height,i.ratio&&(this.bottomRatio=i.ratio))}else{let i=this.parseDefaultPad(r.pad);if(!i)return;i.isPolygon?this.path=i.path:(this.innerType=i.shape,this.innerWidth=i.width,this.innerHeight=i.height,i.ratio&&(this.innerRatio=i.ratio))}}))}parseDefaultPad(e){let r=e.padType,i=tVe(e.padType);switch(r){case _g.OVAL:case _g.ELLIPSE:return{isPolygon:!1,shape:i,width:e.width/10,height:e.height/10,path:null};case _g.RECT:return{isPolygon:!1,shape:i,width:e.width/10,height:e.height/10,ratio:e.radius/100,path:null};case _g.POLYGON:return{isPolygon:!0,shape:i,width:0,height:0,path:e.path}}}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.num==null||this.rotation==null||isNaN(this.rotation)||!(this.padType===0||this.padType===1||this.padType===2)||this.topSolderExpansion===void 0||this.bottomSolderExpansion===void 0||this.pasteExpansion===void 0||this.locked==null)}padVerify(e,r){if(e=="ELLIPSE")switch(r){case"top":this.topHeight=this.topWidth;break;case"bottom":this.bottomHeight=this.bottomWidth;break;case"inner":this.innerHeight=this.innerWidth;break}}initData(){this.topType==null&&(this.topType=this.defaultType,this.topRatio=this.defaultRatio),this.topWidth==null&&(this.topWidth=this.defaultWidth),this.topHeight==null&&(this.topHeight=this.defaultHeight),this.padVerify(this.topType,"top"),this.bottomType==null&&(this.bottomType=this.defaultType,this.bottomRatio=this.defaultRatio),this.bottomWidth==null&&(this.bottomWidth=this.defaultWidth),this.bottomHeight==null&&(this.bottomHeight=this.defaultHeight),this.padVerify(this.bottomType,"bottom"),this.innerType==null&&(this.innerType=this.defaultType,this.innerRatio=this.defaultRatio),this.innerWidth==null&&(this.innerWidth=this.defaultWidth),this.innerHeight==null&&(this.innerHeight=this.defaultHeight)}padCheck(){if(this.initData(),this.index==null||this.layerId==null||this.num==null||this.rotation==null||this.locked==null||this.net==null)return!1;if(this.path!=null){if(this.path.length==0||!Array.isArray(this.path))return!1;let e=Yb(this.path);if(e==null)return!1;if(e.primitives.length==2&&e.primitives[0]instanceof M&&e.primitives[1]instanceof M)return!1}return this.layerId!=12&&(this.type=1),!0}prepareExpansion(){this.topSolderExpansion==null&&this.bottomSolderExpansion==null&&this.pasteExpansion==null?(this.expansionType=1,this.topSolderExpansion=.4,this.bottomSolderExpansion=.4,this.pasteExpansion=.4):this.expansionType=2}finish(){if(this.padCheck()){if(this.resultNeedToBeCached&&this.refs!=null)for(let n of this.refs)$a.getInstance().addConnectRelatedId(this.index,n);this.connectMode==null?this.thermalType=1:this.thermalType=2;let e=null;this.thermalType===2&&(e=Su.getPadRule(this.connectMode,this.spokeSpace,this.spokeWidth,this.spokeAngle));let r,i;if(this.path==null)i=N8e(this.index,this.layerId,this.topType,this.topWidth,this.topHeight,this.topRatio,this.bottomType,this.bottomWidth,this.bottomHeight,this.bottomRatio,this.innerType,this.innerWidth,this.innerHeight,this.innerRatio,this.holeLength,this.holeRadius,this.holeShape,this.holeRotation,this.holeOffset);else{let n=this.getShapes();if(!n)return null;i=k8e(this.index,this.layerId,this.holeLength,this.holeRadius,this.holeShape,this.holeRotation,this.holeOffset,n)}return r=this.getItem(i,e),this.groupId!=null&&r.setGroupID(this.groupId),this.partition&&(r.partition=this.partition),this.zIndex&&(r.zIndex=this.zIndex),this.isNumber(this.number)&&(r.number=this.number),r.padType=this.padType,r}else return null}getItem(e,r){return this.resultNeedToBeCached?$n.getInstance().addPad(this.index,this.layerId,this.type,this.num,this.center,this.rotation,this.locked,this.net,this.expansionType,this.pasteExpansion,this.topSolderExpansion,this.bottomSolderExpansion,this.unusedInnerLayers,this.plated,e.top,e.bottom,e.inner,e.hole,r,void 0,this.padLen,this.attrsMap):new US(this.index,this.layerId,this.type,this.num,this.center,this.rotation,this.locked,this.net,this.expansionType,this.pasteExpansion,this.topSolderExpansion,this.bottomSolderExpansion,this.unusedInnerLayers,this.plated,e.top,e.bottom,e.inner,e.hole,r,void 0,void 0,this.padLen,this.attrsMap)}getShapes(e=this.path){return Yb(e,10)}loadNet(e){this.model.net!=e&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(this.model.net,this.model),this.model.net=e)}loadNum(e){this.model.num!=e&&(this.model.num=e)}loadCenter(e){this.model.center.equals(e)||(this.model.center=e)}loadRotation(e){this.model.rotation!==e&&(this.model.rotation=e)}loadHoleStyle(e,r,i,n,s){this.loadHoleShape(e),this.loadHoleLength(r),this.loadHoleRadius(i),this.loadHoleRotation(n),this.loadHoleOffset(s)}loadHoleShape(e){this.model.holeShape!=e&&(this.model.holeShape=e)}loadHoleLength(e){this.model.holeLength!=e&&(this.model.holeLength=e)}loadHoleRadius(e){this.model.holeRadius!=e&&(this.model.holeRadius=e)}loadHoleOffset(e){this.model.holeOffset.equals(e)||(this.model.holeOffset=e)}loadHoleRotation(e){this.model.holeRotation!=e&&(this.model.holeRotation=e)}loadPlated(e){this.model.plated!==e&&(this.model.plated=e)}loadPadRule(e,r,i,n){this.model.padRule?this.connectMode==null?this.model.padRule=null:(this.loadConnectMode(e),this.loadLineWidth(i),this.loadLineClearance(r),this.loadLineAngle(n)):this.connectMode!=null&&(this.model.padRule=Su.getPadRule(this.connectMode,this.spokeSpace,this.spokeWidth,this.spokeAngle))}loadConnectMode(e){this.model.padRule.connectMode!=e&&(this.model.padRule=Su.getPadRuleByconnectMode(e,this.model.padRule))}loadLineWidth(e){this.model.padRule.lineWidth!=e&&(this.model.padRule=Su.getPadRuleBylineWidth(e,this.model.padRule))}loadLineClearance(e){this.model.padRule.lineClearance!=e&&(this.model.padRule=Su.getPadRuleBylineClearance(e,this.model.padRule))}loadLineAngle(e){this.model.padRule.lineAngle!=e&&(this.model.padRule=Su.getPadRuleBylineAngle(e,this.model.padRule))}loadUnusedInnerLayers(e){this.model.unusedInnerLayers.toString()!==e.toString()&&(this.model.unusedInnerLayers=e)}loadPadStyle(e,r,i,n,s,a){return e!=null?(a!=null&&(r="POLYGON"),e.pl!=null&&a!=null&&F1(e.pl,10)!=a&&(a=this.getShapes(a)),$o.getStyle(r,i,n,s,a)):$o.getStyle(r,i,n,s,this.getShapes(a))}loadPadType(e){this.model.padType!=e&&(this.model.padType=e)}loadType(e){this.model.type!=e&&(this.model.type=e)}loadPadLen(e){this.model.padLen!=e&&(this.model.padLen=e)}loadExpansionType(e){if(this.model.expansionType!=e&&(this.model.expansionType=e),e==1){let r=te.getInstance().getSolderExpansionByNet(this.net),i=te.getInstance().getPasteExpansionByNet(this.net);i&&(this.pasteExpansion=bCe(this.model,i)),r&&(this.topSolderExpansion=this.model.isTestPad?r.testPointTopExpansion:r.padTopExpansion,this.bottomSolderExpansion=this.model.isTestPad?r.testPointBottomExpansion:r.padBottomExpansion)}}loadExpansion(e,r,i){this.model.topSolderExpansion!=e&&(this.model.topSolderExpansion=e),this.model.bottomSolderExpansion!=r&&(this.model.bottomSolderExpansion=r),this.model.pasteExpansion!=i&&(this.model.pasteExpansion=i)}loadAttrMap(e){if(!e)return;let r=vj(this.model);if(JSON.stringify(r)!=JSON.stringify(e)){for(let i in e)this.model.modifyATTRMap(i,e[i]),delete r[i];for(let i in r)this.model.deleteATTRMap(i)}}load(){this.initData(),this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadLayerId(this.layerId),this.loadType(this.type),this.loadPadType(this.padType),this.loadNum(this.num),this.loadCenter(this.center),this.loadRotation(this.rotation),this.loadLocked(this.locked),this.partition!==void 0&&this.loadNet(this.net),this.loadExpansionType(this.expansionType),this.loadExpansion(this.topSolderExpansion,this.bottomSolderExpansion,this.pasteExpansion),this.loadUnusedInnerLayers(this.unusedInnerLayers),this.loadPlated(this.plated),this.model.top!=null&&(this.model.top=this.loadPadStyle(this.model.top,this.topType,this.topWidth,this.topHeight,this.topRatio,this.path)),this.model.bottom!=null&&(this.model.bottom=this.loadPadStyle(this.model.bottom,this.bottomType,this.bottomWidth,this.bottomHeight,this.bottomRatio,this.path)),this.model.inner!=null&&(this.model.inner=this.loadPadStyle(this.model.inner,this.innerType,this.innerWidth,this.innerHeight,this.innerRatio,this.path)),this.loadHoleStyle(this.holeShape,this.holeLength,this.holeRadius,this.holeRotation,this.holeOffset),this.loadPadRule(this.connectMode,this.spokeSpace,this.spokeWidth,this.spokeAngle),this.loadPadLen(this.padLen),this.loadAttrMap(this.attrsMap),this.loadzIndex(this.zIndex),this.loadNumber(this.number)}};function Qp(o,t){let e=new Map;for(let r of t)VA(e,o(r),r);return e}function VA(o,t,e){if(t==null)return;let r=o.get(t);r==null&&(r=new Array,o.set(t,r)),r.push(e)}var GA=class GA extends wi{static getInstance(){return GA.manager==null&&(GA.manager=new GA),GA.manager}constructor(){super()}setPadLenByModel(t,e){let r=t.getParent();r&&this.setPadLen(r.globalIndex,t.globalIndex,e)}setPadLen(t,e,r){let i=this.getItem(t);i||(i=new Map,this.map.set(t,i)),i.set(e,r)}getPadLenByModel(t){let e=t.getParent();if(e){let r=this.getPadLen(e.globalIndex,t.globalIndex);return r==null?t.padLen||0:r}return null}getPadLen(t,e){let r=this.getItem(t);if(r){let i=r.get(e);if(i!=null)return i}}deletePadLen(t,e){let r=this.getItem(t);r&&r.delete(e)}updatePadLen(t){let{unit:e,value:r}=t,i=GA.getInstance(),n=new ft;r.forEach(s=>{let a=s.hashId;s.pads.forEach(l=>{if(l.padLen!=null){let c=n.conversion(e,"mil",l.padLen)/10;i.setPadLen(a,l.hashId,c)}})})}getAllCompPadLenInfo(){let t=[],e=xs.getInstance().getAllItem(),r=GA.getInstance(),i=x.getInstance().unit,n=new ft;return e.forEach(s=>{let a=s.designator,l=s.getFormulaName(),c=s.attrsMap,h=c.Value,u=c.Device,d=c.Footprint,p=[];s.getPads().forEach(m=>{p.push({hashId:m.globalIndex,num:m.num,padLen:n.conversion("mil",i,r.getPadLenByModel(m)*10)})}),t.push({designator:a,name:l,deviceName:u,value:h,footName:d,pads:p,hashId:s.globalIndex})}),{unit:i,data:t}}};GA.manager=null;var as=GA;function v8(o){let t=gh.getInstance().getItem(o.deviceUUID),e=Wi.getInstance().getItem(o.footprintUUID),r={},i=["3D Model Title","3D Model","3D Model Transform"];for(let n in o.attrsMap){let s=o.attrsMap[n];if(n=="Reuse Block"||n=="Group ID"||n=="Channel ID"){r[n]=s;continue}(t.attrMap[n]==null&&e.getValue(n)==null||t.attrMap[n]!=null&&t.attrMap[n]!=s||t.attrMap[n]==null&&e.getValue(n)!=null&&e.getValue(n)!=s)&&n!="Device"&&n!="Designator"&&n!="3D Model Title"&&n!="3D Model"&&n!="3D Model Transform"&&n!="Footprint"&&(r[n]=s);for(let a of i)if(n==a)if(t.attrMap[a]!=null)o.attrsMap[n]!=t.attrMap[n]&&(r[a]=o.attrsMap[a]);else{let l=e.getValue(n);o.attrsMap[n]!=l&&(o.attrsMap[a]!=null&&o.attrsMap[a]!=""||l!=null)&&(r[a]=o.attrsMap[a])}}return r}function bVe(o){let t=o.deviceUUID,e=o.footprintUUID,r=gh.getInstance().getItem(t),i=Wi.getInstance().getItem(e),n=o.attrsMap,s=o.attrKeyText,a=o.layerId,l=o.position,c=o.rotation,h={},u=new Set(["Reuse Block","Group ID","Channel ID","Footprint","Designator"]);for(let d in n){let p=n[d];if(u.has(d)){h[d]=p;continue}if(i&&i.checkKeyValue(d,p)){let m=!(r!=null&&r.has(d)),g=s[d],y=!!g;if(g){let b=g.layerId;b=a==2?Mg(b):b;let P=g.position,T=g.rotation;y=r==null?void 0:r.needSave(g,kA(l,c,P),T-c,b,e)}if(m&&!y)continue}h[d]=p}return h}var x8=class extends E0{constructor(){super(...arguments);this.position=S.ORIGIN;this.attrs=new Array;this.padNets=new Array;this.reuseBlock=null}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,x:a,y:l,angle:c,attrs:h,locked:u,zIndex:d,number:p,specialColor:m,layerIdReplacements:g}=e;this.index=r,this.groupId=Va(n),this.number=p,this.zIndex=d,this.isNumber(s)&&(this.layerId=s),this.partition=i,this.isNumber(a)&&this.isNumber(l)&&(this.position=new S(a/10,l/10)),this.isNumber(c)&&(this.rotation=c/180*Math.PI),this.attrsMap=h,this.locked=u,this.layerIdReplacementTable=g,m&&(this.specialColor=ee.of3(m))}get index(){return this._index}set index(e){let r=this.index;this._index=e;let i=new RegExp(`^${r}`);for(let n of this.attrs)n.parentIndex==r&&(n.parentIndex=e,n.index=e+n.index.replace(i,""));for(let n of this.padNets)n.parentIndex==r&&(n.parentIndex=e);this.reuseBlock&&(this.reuseBlock.shapeIndex=e)}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.rotation==null||isNaN(this.rotation)||this.locked==null)}setReuseBlock(e){this.reuseBlock=e}getReuseBlock(){return this.reuseBlock}getFootprintUUID(){return this.attrs.forEach(e=>{e.key==="Device"?this.device=gh.getInstance().getItem(e.value):e.key==="Footprint"&&(this.footprint=Wi.getInstance().getItem(e.value))}),this.device==null?null:(this.footprint==null&&(this.footprint=Wi.getInstance().getItem(this.device.footprintUUID)),this.footprint!=null?this.footprint.source!=null?this.footprint.source:this.footprint.uuid:null)}addAttribute(e){e.key!=""&&this.attrs.push(e)}addPadNet(e){this.padNets.push(e)}canBuild(){for(let e of this.attrs)if(e.key=="Device")return!0;return!1}filterAttr(){let e=new Map;for(let r of this.attrs){let i=e.get(r.key);(i==null||i.ticket<r.ticket)&&e.set(r.key,r)}this.attrs.length=0;for(let[,r]of e)this.attrs.push(r)}finish(){var e;try{this.filterAttr();let r;for(let u of this.attrs)u.key==="Device"?(this.device=gh.getInstance().getItem(u.value),u.value=(e=this.device)==null?void 0:e.name):u.key==="Footprint"&&(this.footprint=Wi.getInstance().getItem(u.value),r=u);if(this.device==null||(this.footprint==null&&(this.footprint=Wi.getInstance().getItem(this.device.footprintUUID)),this.footprint==null))return null;r&&(r.value=this.footprint.footprintId||"");let i=this.device.rebuildComponent(this.index,this.footprint.uuid,this.attrs,this.resultNeedToBeCached),n=i.getComponent(this.index,this.groupId,this.layerId,this.position,this.rotation,this.attrsMap,this.locked,this.layerIdReplacementTable);for(let u of this.attrs){let d=n.attrKeyText[u.key];if(d!=null){u.check(),d.fontFamily=u.fontFamily,d.value=u.value,d.showKey=u.showKey,d.showValue=u.showValue,d.layerId=u.layerId,d.fontSize=u.fontSize,d.strokeWidth=u.strokeWidth,d.origin=u.origin,d.rotation=u.angle,d.mirror=u.mirror,d.locked=u.locked,d.silkColor=u.specialColor;let p=u.x,m=u.y;if(u.showKey||u.showValue?d.positionIsNull=!1:p==null||m==null?d.positionIsNull=!0:(p!==null||m!==null)&&(d.positionIsNull=!1),u.resetAttr)if(d.key==="Designator"){let y=n.buildBBox().UL().add1(0,-.5);p=y.x,m=y.y}else{let g=n.getNewTextPosition();p=g.x,m=g.y}p==null&&(p=S.ORIGIN.x),m==null&&(m=S.ORIGIN.y),d.position=new S(p,m),d.reverse=u.reverse,d.reverseExpansion=u.reverseExpansion}else{if(i.componentId!=null){let p=u.index;i.addId(p),u.index=p}d=u.finish()}n.addAttribute(d)}this.attrs.length=0,this.attrsMap=null,this.layerIdReplacementTable=null;let s=new Array;Re.addAll(s,n.getPads()),Re.addAll(s,n.getVias());let a=Qp(u=>u.modelType=="Pad"?u.num:u.globalIndex.replace(n.globalIndex,""),s),l=Qp(u=>u.num,this.padNets),c=new Set,h=new Set;for(let[u,d]of l){let p=a.get(u);if(p!=null){if(d.length==1&&p.length==1)this.matchPadNet(p[0],d[0]),c.add(p[0]),h.add(d[0]);else for(let m of d)if(!h.has(m)){for(let g of p)if(!c.has(g)&&n.globalIndex+m.id==g.globalIndex){this.matchPadNet(g,m),c.add(g),h.add(m);break}}}}if(c.size!=s.length&&h.size!=this.padNets.length){for(let u of s)if(!c.has(u)){for(let d of this.padNets)if(!h.has(d)&&u.globalIndex==n.globalIndex+d.id){this.matchPadNet(u,d),c.add(u),h.add(d);break}}for(let u of s)if(!c.has(u)){for(let d of this.padNets)if(!h.has(d)){this.matchPadNet(u,d),c.add(u),h.add(d);break}}}return this.padNets.length=0,this.specialColor!=null&&(n.silkColor=this.specialColor),this.partition&&(n.partition=this.partition),this.isNumber(this.number)&&(n.number=this.number),this.isNumber(this.zIndex)&&(n.zIndex=this.zIndex),this.reuseBlock!=null&&(n.combinationID=this.reuseBlock.groupId,n.channelID=this.reuseBlock.channelId),this.footprint!=null&&this.footprint.modifyName(n.name,n.name),n}catch(r){console.log(r)}}matchPadNet(e,r){if(e.net=r.net,e.partition=r.partition,e instanceof Je&&(as.getInstance().setPadLenByModel(e,r.padLen),r.attrsMap!=null)){let i=e.globalIndex.replace(this.index,""),n=this.footprint.getModelBy(e.modelType,i),s={};n instanceof Je&&(s=n.attrsMap?{...n.attrsMap}:{});for(let a in r.attrsMap)s[a]=r.attrsMap[a];for(let a in s){let l=s[a];e.modifyATTRMap(a,l)}}}loadRotation(e){if(this.model.rotation!=e){let r=e-this.model.rotation,i=this.model.position,n=Ae.translate(-i.x,-i.y,0).rotateZ(r).translate1(i.x,i.y,0);this.model.multiply4(n,!0),this.model.rotation=e}}loadPosition(e){if(!this.model.position.equals(e)){let r=e.sub(this.model.position),i=Ae.translate(r.x,r.y,0);this.model.multiply4(i,!0)}}loadAttrmap(e){let r=v8(this.model);if(JSON.stringify(r)!=JSON.stringify(e)){for(let i in e)this.model.modifyATTRMap(i,e[i]),delete r[i];for(let i in r)this.model.deleteATTRMap(i)}}loadLayerIdReplacementTable(e){this.model.setLayerIdReplacementTable(e)}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadNumber(this.number),this.loadRotation(this.rotation),this.loadPosition(this.position),this.loadAttrmap(this.attrsMap),this.loadSpecialColor(this.specialColor),this.loadLayerIdReplacementTable(this.layerIdReplacementTable)}loadSpecialColor(e){(this.model.silkColor!=e&&(this.model.silkColor==null||e==null)||this.model.silkColor!=null&&e!=null&&!this.model.silkColor.equals(e))&&(this.model.silkColor=e)}};var Xy=class extends ki{get globalIndex(){return this._globalIndex}set globalIndex(t){this._globalIndex=t,this.text!=null&&(this.text.globalIndex=t)}get silkColor(){return this.text.silkColor}set silkColor(t){this.text!=null&&(this.text.silkColor=t)}};var Rf=class o extends Xy{constructor(e,r,i,n,s,a,l,c,h,u,d,p=10,m=3,g=5,y,b){super();this.modelType="Length Dimension";this._lineLen=10;this._arrLineLen=3;this._textOffset=5;let P=i.distance1(n),T=LA(P,l,u).toString()+u,{width:I,height:C,path:E}=Gd(T,c,h),O=RB(i,n,I,g),_=pT(ms(r)?-n.angle(i):n.angle(i)),R=ms(r)?9:3;b||(b=new Ed(e,r,0,"",!1,T,!0,"default",c,_,O,R,h,!1,0,!1,!1,E,I,C,d)),y==null&&(y=DB(i,n,s,a,h,b,p,m)),this._globalIndex=e,this._start=i,this._end=n,this._left=s,this._right=a,this._precision=l,this._lineLen=p,this._arrLineLen=m,this._textOffset=g,this._bbox=y,this.text=b,this._unit=u}get refreshBBox(){return this.text.refreshBBox}set refreshBBox(e){this.text.refreshBBox=e}get layerId(){return this.text.layerId}set layerId(e){this.text.layerId!=e&&(this.watchLayerIdModify(this.layerId),this.text.layerId=e,ms(e)&&this.text.origin!=9?this.text.origin=9:!ms(e)&&this.text.origin!=3&&(this.text.origin=3),this.updateText(),this.layerModified=!0)}get unit(){return this._unit}set unit(e){this._unit!=e&&(this._unit=e,this.updateText())}get textPosition(){return this.text.position}set textPosition(e){this.text.position=e,this.updateText()}get strokeWidth(){return this.text.strokeWidth}set strokeWidth(e){this.text.strokeWidth!=e&&(this.text.strokeWidth=e,this.updateText())}get start(){return this._start}set start(e){this._start.equals(e)||(this._start=e,this.updateText())}get end(){return this._end}set end(e){this._end.equals(e)||(this._end=e,this.updateText())}get left(){return this._left}set left(e){this._left.equals(e)||(this._left=e,this.updateText())}get right(){return this._right}set right(e){this._right.equals(e)||(this._right=e,this.updateText())}get length(){return this.start.distance1(this.end)}set length(e){let i=this.end.sub(this.start).normalize().mul(e-this.length),n=Ae.translate(i.x,i.y,0);this.end=this.end.multiply4(n),this.right=this.right.multiply4(n)}get precision(){return this._precision}set precision(e){this._precision!=e&&(this._precision=e,this.updateText())}get fontSize(){return this.text.fontSize}set fontSize(e){this.text.fontSize!=e&&(this.text.fontSize=e,this.updateText())}get content(){return LA(this.length,this.precision,this.unit).toString()+this._unit}get lineLen(){return this._lineLen}set lineLen(e){this._lineLen!=e&&(this._lineLen=e)}get arrLineLen(){return this._arrLineLen}set arrLineLen(e){this._arrLineLen!=e&&(this._arrLineLen=e)}get textOffset(){return this._textOffset}set textOffset(e){this._textOffset!=e&&(this._textOffset=e)}get bbox(){return this._bbox}updateText(){let{width:e,height:r,path:i}=Gd(this.content,this.fontSize,this.strokeWidth);this.text.outline=i,this.text.position=RB(this.start,this.end,e,this.textOffset);let n=ms(this.layerId);this.text.rotation=pT(n?-this.end.angle(this.start):this.end.angle(this.start)),this.text.updateBox4(e,r),this.updateShapeData()}transform(e){this.start=this.start.multiply4(e),this.end=this.end.multiply4(e),this.left=this.left.multiply4(e),this.right=this.right.multiply4(e),this.text.transform(e),this.updateText()}flip(e){let r=this.buildBBox().center().multiply4(e),i=this._start.equals(this._left),n=this._end.equals(this._right);if(this.transform(e),i&&n){let l=this._left;this._left=this._right,this._right=l,l=this._start,this._start=this._end,this._end=l,this.updateText()}let s=this.buildBBox().center(),a=r.sub(s);this.start=this.start.add(a),this.end=this.end.add(a),this.left=this.left.add(a),this.right=this.right.add(a),this.updateText()}inShape(e,r){let i=new S(e,r),n=kS(this.start,this.end,this.left,this.right,this.text.box.width,this.lineLen,this.arrLineLen);for(let s of n)if(Xa(i,s.start(),s.end(),this.strokeWidth))return!0;return this.text.inShape(e,r)}get locked(){return this.text.locked}set locked(e){this.text.locked=e}calibrateLine(e,r,i,n){let s,a,l;this.start.equals(this.end)?(r?s=this.vectorProjectOnPerpendicularLine(this.right.sub(this.left),e[0].sub(e[1])):s=this.vectorProjectOnPerpendicularLine(e[0].sub(e[3]),e[1].sub(e[0])),a=0):(s=this.end.sub(this.start),a=s.length());let c=s.normalize(),h=e[3].sub(e[2]).dot(c);switch(i?l=a+h:l=a-h,n){case 0:this.end=e[3].add(c.mul(l)),this.left=e[3].add(e[1].sub(e[0]));break;case 1:this.start=e[3].sub(c.mul(l)),this.right=e[3].add(e[1].sub(e[0]));break;case 2:this.start=e[1].sub(c.mul(l));break;case 3:this.end=e[1].add(c.mul(l));break}}vectorProjectOnPerpendicularLine(e,r){let i=r.rotate(new S(0,0),Math.PI/2).normalize(),n=e.angle(i);return Math.abs(n)>Math.PI/2&&(i=i.mul(-1)),i.mul(e.dot(i))}updateBox(){return this.text.buildBBox(),this._bbox=DB(this.start,this.end,this.left,this.right,this.strokeWidth,this.text,this.lineLen,this.arrLineLen),this._bbox}getBaseGraphics(){let e=[];return this.text.outline.forEach(i=>{e.push(i.primitives.map(n=>n.multiply3(this.text.matrix.toMatrix3())))}),kS(this.start,this.end,this.left,this.right,this.text.box.width,this.lineLen,this.arrLineLen).forEach(i=>{e.push([i])}),e}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this.layerId,this._start,this._end,this._left,this._right,this._precision,this.fontSize,this.strokeWidth,this._unit,this.locked,this._lineLen,this._arrLineLen,this._textOffset,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var N4=class N4 extends wi{static getInstance(){return N4.manager==null&&(N4.manager=new N4),N4.manager}addModel(t){this.map.set(t.globalIndex,t)}addDimension(t,e,r,i,n,s,a,l,c,h,u){return this._last=new Rf(t,e,r,i,n,s,a,l,c,h,u,void 0,void 0,void 0,void 0),this.addModel(this._last),this._last}delete(t,e){t instanceof Rf&&this.map.delete(e)}};N4.manager=null;var Ka=N4;function xj(o,t,e){let r=new Array(0),i=new M(o,t),n=new M(o,e);r.push(i,n);let s=t.sub(o),a=e.sub(o),l=Math.atan2(s.y,s.x)*180/Math.PI,c=Math.atan2(a.y,a.x)*180/Math.PI;if(l==c&&(c+=1e-8),s.cross(a)>=0){let u=q.build2(o,l,c,10,10,le.CCW);r.push(u)}else{let u=q.build2(o,l,c,10,10,le.CW);r.push(u)}return r}function $re(o,t,e){let r=t.sub(o).normalize(),i=e.sub(o).normalize(),n=r.add(i).normalize().mul(15);return o.add(n)}function $Ce(o,t,e,r){let i=Math.pow(10,r),n=t.sub(o),s=e.sub(o),a=n.normalize().dot(s.normalize()),l=Math.acos(a)/Math.PI*180,c=Math.round(l*i)/i;return isNaN(c)&&(c=0),c.toFixed(r)}function Kre(o,t,e){let r=o.add1(ms(t)?-1:1,0),i=e/2+.1;return q.build2(r,0,360,i,i,le.CCW)}function KCe(o,t,e,r,i){let n=xj(o,t,e),s=new _e;for(let l of n)s.ext1(l.bbox());s.ext7(i/2),s.ext1(r.bbox);let a=Kre(r.bbox.UR(),r.layerId,i);return s.ext1(a.bbox()),s.build1()}function PVe(o,t,e,r){let i=xj(o,t,e),n=new _e;for(let s of i)n.ext1(s.bbox());return n.ext7(r/2),n.build1()}var zd=class o extends Xy{constructor(e,r,i,n,s,a,l,c,h,u,d,p){super();this.modelType="Protractor Dimension";let m=$Ce(a,l,c,s),{width:g,height:y,path:b}=Gd(m.toString(),n,i),P=ms(r)?9:3;p=p||new Ed(e,r,0,"",!1,m.toString(),!0,"default",n,0,h,P,i,!1,0,!1,!1,b,g,y,u),d==null&&(d=KCe(a,l,c,p,i)),this._globalIndex=e,this._precision=s,this._center=a,this._end1=l,this._end2=c,this._bbox=d,this.text=p}get modify(){return this.text.refreshBBox}set modify(e){this.text.refreshBBox=e}get layerId(){return this.text.layerId}set layerId(e){this.layerId!=e&&(this.watchLayerIdModify(this.layerId),this.text.layerId=e,ms(e)&&this.text.origin!=9?this.text.origin=9:!ms(e)&&this.text.origin!=3&&(this.text.origin=3),this.updateText(),this.layerModified=!0)}get start(){return this.end1}set start(e){this.end1=e}get end(){return this.end2}set end(e){this.end2=e}get strokeWidth(){return this.text.strokeWidth}set strokeWidth(e){this.text.strokeWidth!=e&&(this.text.strokeWidth=e,this.updateText())}get fontSize(){return this.text.fontSize}set fontSize(e){this.text.fontSize!=e&&(this.text.fontSize=e,this.updateText())}get precision(){return this._precision}set precision(e){this._precision!=e&&(this._precision=e,this.updateText())}get center(){return this._center}set center(e){this._center.equals(e)||(this._center=e,this.text.position=$re(this.center,this.end1,this.end2),this.updateText())}get end1(){return this._end1}set end1(e){this._end1.equals(e)||(this._end1=e,this.text.position=$re(this.center,this.end1,this.end2),this.updateText())}get end2(){return this._end2}set end2(e){this._end2.equals(e)||(this._end2=e,this.text.position=$re(this.center,this.end1,this.end2),this.updateText())}get angle(){let e=Math.pow(10,this.precision),r=this.start.sub(this.center),i=this.end.sub(this.center),n=r.normalize().dot(i.normalize()),s=Math.acos(n)/Math.PI*180,a=Math.round(s*e)/e;return isNaN(a)&&(a=0),a}set angle(e){isNaN(e)&&(e=0);let r=e/180*Math.PI,i=this.start.sub(this.center).normalize(),n=this.end.sub(this.center).normalize(),s=this.end.sub(this.center).length();if(i.cross(n)>=0){let l=i.rotate(S.ORIGIN,r);this.end=this.center.add(l.mul(s))}else{let l=i.rotate(S.ORIGIN,-r);this.end=this.center.add(l.mul(s))}}get textPosition(){return this.text.position}set textPosition(e){this.text.position=e,this.updateText()}get bbox(){return this._bbox}get content(){return $Ce(this.center,this.end1,this.end2,this.precision)}get locked(){return this.text.locked}set locked(e){this.text.locked=e}updateText(){let{width:e,height:r,path:i}=Gd(this.content.toString(),this.fontSize,this.strokeWidth);this.text.outline=i,this.text.updateBox4(e,r),this.updateShapeData()}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}transform(e){this.text.transform(e);let r=this.textPosition,i=this.center.multiply4(e),n=this.end1.multiply4(e),s=this.end2.multiply4(e);this.center=i,this.end1=n,this.end2=s,this.textPosition=r}flip(e){let r=this.textPosition,i=this.center.multiply4(e),n=this.end1.multiply4(e),s=this.end2.multiply4(e);this.center=i,this.end1=n,this.end2=s;let l=r.add1((this.text.width+1.4)/2,(this.text.height+.6)/2).multiply4(e);this.textPosition=l.add1(-((this.text.width+1.4)/2),-((this.text.height+.6)/2))}inOutline(e){return this.inShape(e.x,e.y)}inShape(e,r,i){let n=i==null?1:i.getScale(),s=new S(e,r),a=xj(this.center,this.end1,this.end2),l=ms(this.layerId)?this.text.bbox.UL():this.text.bbox.UR(),c=Kre(l,this.text.layerId,this.strokeWidth);for(let h of a)if(h instanceof M){if(Xa(s,h.start(),h.end(),this.strokeWidth,n))return!0}else if(xf(s,h.center,h.rx,h.startAngle/180*Math.PI,h.endAngle()/180*Math.PI,h.sweep(),this.strokeWidth,n))return!0;return xf(s,c.center,c.rx,c.startAngle/180*Math.PI,c.endAngle()/180*Math.PI,c.sweep(),this.strokeWidth/2)?!0:this.text.inShape(e,r)}updateBox(){return this.text.updateBox(),this._bbox=KCe(this.center,this.end1,this.end2,this.text,this.strokeWidth),this._bbox}getBaseGraphics(){let e=xj(this.center,this.end1,this.end2),r=new S(this.text.width,this.text.height).multiply4(this.text.matrix),n=[[Kre(r,this.text.layerId,this.strokeWidth)]];return this.text.outline.forEach(s=>{n.push(s.primitives.map(a=>a.multiply3(this.text.matrix.toMatrix3())))}),e.forEach(s=>{n.push([s])}),n}getDegree(){return{center:this.center,radius:this.strokeWidth/2+.1,width:this.strokeWidth/2}}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this.layerId,this.strokeWidth,this.fontSize,this._precision,this._center,this.end1,this.end2,this.textPosition,this.locked,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var k4=class k4 extends wi{static getInstance(){return k4.manager==null&&(k4.manager=new k4),k4.manager}addModel(t){this.map.set(t.globalIndex,t)}addProtractor(t,e,r,i,n,s,a,l,c){let h=a.sub(s).normalize(),u=l.sub(s).normalize(),d=h.add(u).normalize().mul(15);return this._last=new zd(t,e,r,i,n,s,a,l,s.add(d),c,null),this.lastPrecision=this._last.precision,this.addModel(this._last),this._last}delete(t){t instanceof zd&&this.map.delete(t.globalIndex)}};k4.manager=null;var Za=k4;function B4(o,t){let e=new M(o,t),r=t.sub(o).normalize(),i=r.rotate(S.ORIGIN,Math.PI/4).mul(3),n=r.rotate(S.ORIGIN,-Math.PI/4).mul(3),s=new M(t,t.sub(n)),a=new M(t,t.sub(i));return[e,s,a]}function hR(o,t,e){let r=t.angle(o),i=t.sub(o).normalize(),n=new S(-i.y,i.x);return r>-es&&r<es?t.sub(i.mul(6)).add(n.mul(5)).sub(i.mul(e)):t.sub(i.mul(6)).sub(n.mul(5))}function ZCe(o,t,e,r){let i=B4(o,t),n=new _e;for(let s of i)n.ext1(s.bbox());return n.ext7(r/2),n.ext1(e.bbox),n.build1()}function TVe(o,t,e){let r=B4(o,t),i=new _e;for(let n of r)i.ext1(n.bbox());return i.ext7(e/2),i.build1()}var Df=class o extends Xy{constructor(e,r,i,n,s,a,l,c,h,u,d,p,m){super();this.modelType="Radius Dimension";let g="R"+LA(l,c,h).toString()+h,{width:y,height:b,path:P}=Gd(g,a,s),T=ms(r)?9:3,I=pT(n.angle(i));m=m||new Ed(e,r,0,"",!1,g,!0,"default",a,I,u,T,s,!1,0,!1,!1,P,y,b,d),p==null&&(p=ZCe(i,n,m,s)),this._globalIndex=e,this._start=i,this._end=n,this._radius=l,this._precision=c,this._unit=h,this._bbox=p,this.text=m}get refreshBBox(){return this.text.refreshBBox}set refreshBBox(e){this.text.refreshBBox=e}get layerId(){return this.text.layerId}set layerId(e){if(this.text.layerId!=e){this.watchLayerIdModify(this.layerId),this.text.layerId=e;let r=ms(e)?9:3;this.text.origin!=r&&(this.text.origin=r),this.updateText(),this.layerModified=!0}}get textPosition(){return this.text.position}set textPosition(e){this.text.position!=e&&(this.text.position=e,this.updateShapeData())}get start(){return this._start}set start(e){this._start.equals(e)||(this._start=e,this.updateText(),this.text.position=hR(this.start,this.end,this.text.width),this.updateShapeData())}get end(){return this._end}set end(e){this._end.equals(e)||(this._end=e,this.updateText(),this.text.position=hR(this.start,this.end,this.text.width),this.updateShapeData())}get strokeWidth(){return this.text.strokeWidth}set strokeWidth(e){this.text.strokeWidth!=e&&(this.text.strokeWidth=e,this.updateText())}get fontSize(){return this.text.fontSize}set fontSize(e){this.text.fontSize!=e&&(this.text.fontSize=e,this.updateText(),this.updateShapeData())}get radius(){return this._radius}set radius(e){this._radius!=e&&(this._radius=e,this.updateText(),this.updateShapeData())}get precision(){return this._precision}set precision(e){this._precision!=e&&(this._precision=e,this.updateText(),this.updateShapeData())}get bbox(){return this._bbox}get unit(){return this._unit}set unit(e){this._unit!=e&&(this._unit=e,this.updateText())}get content(){return"R"+LA(this.radius,this.precision,this.unit).toString()+this.unit}get locked(){return this.text.locked}set locked(e){this.text.locked=e}updateText(){let{width:e,height:r,path:i}=Gd(this.content,this.fontSize,this.strokeWidth),n=ms(this.layerId);this.text.rotation=pT(n?-this.end.angle(this.start):this.end.angle(this.start)),this.text.outline=i,this.text.updateBox4(e,r),this.updateShapeData()}transform(e){let r=this.start.multiply4(e),i=this.end.multiply4(e);this._start=r,this._end=i,this.text.transform(e),this.updateShapeData()}flip(e){this._start=this._start.multiply4(e),this._end=this._end.multiply4(e),this.updateText(),this.text.position=hR(this._start,this._end,this.text.width),this.updateShapeData()}inOutline(e){return this.inShape(e.x,e.y)}inShape(e,r,i){let n=i==null?1:i.getScale(),s=new S(e,r),a=B4(this.start,this.end);for(let l of a)if(Xa(s,l.start(),l.end(),this.strokeWidth,n))return!0;return this.text.inShape(e,r)}updateBox(){return this.text.updateBox(),this._bbox=ZCe(this.start,this.end,this.text,this.strokeWidth),this._bbox}getBaseGraphics(){let e=[];return this.text.outline.forEach(i=>{e.push(i.primitives.map(n=>n.multiply3(this.text.matrix.toMatrix3())))}),B4(this.start,this.end).forEach(i=>{e.push([i])}),e}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this.layerId,this._start,this._end,this.strokeWidth,this.fontSize,this._radius,this._precision,this._unit,this.textPosition,this.locked,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var F4=class F4 extends wi{static getInstance(){return F4.manager==null&&(F4.manager=new F4),F4.manager}addModel(t){this.map.set(t.globalIndex,t)}addRadius(t,e,r,i,n,s,a,l,c,h){let u=hR(r,i,n);return this._last=new Df(t,e,r,i,n,s,a,l,c,u,h),this.lastPrecision=this._last.precision,this.addModel(this._last),this._last}delete(t){t instanceof Df&&this.map.delete(t.globalIndex)}};F4.manager=null;var Sl=F4;var R8=class extends E0{constructor(){super(...arguments);this.attrs=new Array;this.fontSize=6}feed(e){let{id:r,partitionId:i,type:n,layerId:s,unit:a,strokeWidth:l,precision:c,coords:h,locked:u,zIndex:d,number:p,text:m,specialColor:g,groupId:y}=e;this.partition=i,this.index=r,this.type=n,this.zIndex=d,this.number=p,this.partition=i,this.isNumber(s)&&(this.layerId=s),this.unit=a,this.isNumber(l)&&(this.width=l/10),this.isNumber(c)&&(this.precision=c),this.coords=h,this.locked=u,this.groupId=Va(y),g&&(this.specialColor=ee.of3(g)),m&&(this.fontValue=m.text,this.isNumber(m.fontSize)&&(this.fontSize=Math.abs(m.fontSize/10)),this.isNumber(m.x)&&(this.fontX=m.x/10),this.isNumber(m.y)&&(this.fontY=m.y/10))}check(){return!(!this.layerId||this.precision==null||isNaN(this.precision)||this.width==null||isNaN(this.width)||this.width<=0||this.type!=="ANGLE"&&!(this.unit==="mm"||this.unit==="cm"||this.unit==="inch"||this.unit==="mil")||this.fontValue==null||this.fontSize==null)}getAttrLength(){return this.attrs.length}getCoords(e){let r,i;switch(this.type){case"LENGTH":let n=new S(e[0]/10,e[1]/10);r=new S(e[2]/10,e[3]/10),i=new S(e[4]/10,e[5]/10);let s=new S(e[6]/10,e[7]/10);return{left:n,start:r,end:i,right:s};case"ANGLE":r=new S(e[0]/10,e[1]/10);let a=new S(e[2]/10,e[3]/10);return i=new S(e[4]/10,e[5]/10),{start:r,center:a,end:i};case"RADIUS":i=new S(e[0]/10,e[1]/10),r=new S(e[2]/10,e[3]/10);let l=e[4]/10;return{end:i,start:r,radius:l}}}finish(){let e,r,i,n,s,a=this.fontSize,l,c=this.groupId,h=this.getCoords(this.coords);switch(this.type){case"LENGTH":return r=h.left,e=h.start,n=h.end,i=h.right,l=this.resultNeedToBeCached?Ka.getInstance().addDimension(this.index,this.layerId,e,n,r,i,this.precision,a,this.width,this.unit,this.locked):new Rf(this.index,this.layerId,e,n,r,i,this.precision,a,this.width,this.unit,this.locked),this.specialColor!=null&&(l.silkColor=this.specialColor),c!=null&&l.setGroupID(c),this.isNumber(this.zIndex)&&(l.zIndex=this.zIndex),this.isNumber(this.number)&&(l.number=this.number),this.partition&&(l.partition=this.partition),l;case"ANGLE":let u=this.getTextPosition();e=h.start,s=h.center,n=h.end;let d=e.sub(s).normalize(),p=n.sub(s).normalize(),m=d.add(p).normalize().mul(15);return l=this.resultNeedToBeCached?Za.getInstance().addProtractor(this.index,this.layerId,this.width,a,this.precision,s,e,n,this.locked):new zd(this.index,this.layerId,this.width,a,this.precision,s,e,n,s.add(m),this.locked),u!=null&&(l.textPosition=u),this.specialColor!=null&&(l.silkColor=this.specialColor),c!=null&&l.setGroupID(c),this.isNumber(this.zIndex)&&(l.zIndex=this.zIndex),this.isNumber(this.number)&&(l.number=this.number),this.partition&&(l.partition=this.partition),l;case"RADIUS":{let g=this.getTextPosition();n=h.end,e=h.start;let y=h.radius,b=this.resultNeedToBeCached?Sl.getInstance().addRadius(this.index,this.layerId,e,n,this.width,a,y,this.precision,this.unit,this.locked):new Df(this.index,this.layerId,e,n,this.width,a,y,this.precision,this.unit,hR(e,n,this.width),this.locked);return g!=null&&(b.textPosition=g),this.specialColor!=null&&(b.silkColor=this.specialColor),c!=null&&b.setGroupID(c),this.isNumber(this.zIndex)&&(b.zIndex=this.zIndex),this.isNumber(this.number)&&(b.number=this.number),this.partition&&(b.partition=this.partition),b}}}getTextPosition(){let e=this.fontX,r=this.fontY;return e==null&&(e=S.ORIGIN.x),r==null&&(r=S.ORIGIN.x),new S(e,r)}loadUnit(e){this.model.unit!==e&&(this.model.unit=e)}loadStrokeWidth(e){this.model.strokeWidth!=e&&(this.model.strokeWidth=e)}loadPrecision(e){this.model.precision!=e&&(this.model.precision=e)}loadCoords(e){let r=this.getCoords(e),i;switch(this.type){case"LENGTH":i=this.model,i.left.equals(r.left)||(i.left=r.left),i.start.equals(r.start)||(i.start=r.start),i.end.equals(r.end)||(i.end=r.end),i.right.equals(r.right)||(i.right=r.right);break;case"ANGLE":i=this.model,i.start.equals(r.start)||(i.start=r.start),i.center.equals(r.center)||(i.center=r.center),i.end.equals(r.end)||(i.end=r.end);break;case"RADIUS":i=this.model,i.end.equals(r.end)||(i.end=r.end),i.start.equals(r.start)||(i.start=r.start),i.radius!==r.radius&&(i.radius=r.radius);break}}loadFontGroupId(e){e!=null&&this.model.text.getGroupID()!=e&&this.model.text.setGroupID(e)}loadFontPosition(e){this.model.textPosition.equals(e)||(this.model.textPosition=e)}loadFontValue(e){this.model.text.value!=e&&(this.model.text.value=e)}loadFontSize(e){this.model.fontSize!=e&&(this.model.fontSize=e)}loadFontWidth(e){this.model.text.strokeWidth!=e&&(this.model.text.strokeWidth=e)}load(){this.loadPartitionId(this.partition),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),(this.type=="LENGTH"||this.type=="RADIUS")&&this.loadUnit(this.unit),this.loadCoords(this.coords),this.loadStrokeWidth(this.width),this.loadPrecision(this.precision),this.loadFontGroupId(this.groupId),this.loadFontPosition(this.getTextPosition()),this.loadFontValue(this.fontValue),this.loadFontSize(this.fontSize),this.loadSpecialColor(this.specialColor)}loadSpecialColor(e){(this.model.silkColor!=e&&(this.model.silkColor==null||e==null)||this.model.silkColor!=null&&e!=null&&!this.model.silkColor.equals(e))&&(this.model.silkColor=e)}};var D8=class extends md{constructor(){super(...arguments);this.connects=new Array}feed(e){let{id:r,partitionId:i,netName:n,layerId:s,path:a,groupId:l,number:c,refs:h,locked:u}=e;this.index=r,this.partition=i,this.groupId=Va(l),this.net=n,this.number=c,this.isNumber(s)&&(this.layerId=s),this.path=a,this.connects=h||[],this.locked=u}getConnect(){return this.connects}check(){return!(this.index==null||this.net==null||this.layerId==null||this.path==null)}clearGroupId(){this.groupId=null}changeNet4Map(e){let r=e.get(this.net);r!=null&&(this.net=r)}canBuild(){return this.connects.length>0}finish(){if(this.check()){let e=Yb(this.path,10);if(!e||!xu(e.primitives,1e-4))return null;let r=this.resultNeedToBeCached?this.parseShapeModelSimplify(this.index,"TearDrop",this.layerId,this.net,!1,.02,this.path):this.parseShapeModel(this.index,"TearDrop",this.layerId,this.net,!1,.02,this.path);return r==null?null:(r.component=new J2(this.connects),this.groupId!=null&&r.setGroupID(this.groupId),this.partition&&(r.partition=this.partition),this.isNumber(this.number)&&(r.number=this.number),r.locked=this.locked,r)}}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId),this.loadType("TearDrop"),this.loadLayerId(this.layerId),this.partition!==void 0&&this.loadNet(this.net),this.loadPath(this.path),this.loadConnects(this.connects),this.loadLocked(this.locked)}loadConnects(e){let r=this.model.component;r.connects=e}};var $E=class extends $l{constructor(){super(...arguments);this.width=NaN;this.height=NaN}static getUniqueId(e){let{fontFamily:r,fontSize:i,text:n,bold:s,italic:a,reverse:l,expansion:c}=e;return[r,i,n,s,a,l,c].toString()}feed(e){let{fontFamily:r,fontSize:i,text:n,path:s,width:a,height:l,bold:c,italic:h,reverse:u,expansion:d}=e;this.fontFamily=r,this.text=n,this.path=s,this.width=a/10,this.height=l/10,this.fontSize=Math.abs(i),this.bold=c,this.italic=h,this.reverse=u,this.expansion=d}get hashkey(){return null}setText(e){this.text=e}clear(){this.fontFamily=null,this.text=null,this.path=null,this.width=null,this.height=null,this.fontSize=null,this.bold=null,this.italic=null,this.reverse=null,this.expansion=null,this.model=null}check(){return!(!this.width==null||!this.height==null||!this.fontFamily==null||!this.text==null||!this.fontSize==null||!this.reverse==null||!this.expansion==null||!this.bold==null||!this.italic==null||!this.path==null)}finish(){Array.isArray(this.path)&&this.path.length>0&&Wy.getInstance().getFontCache(this.fontFamily,this.text,this.fontSize,this.reverse,this.expansion,this.bold,this.italic)==null&&Wy.getInstance().addFontCache(this.fontFamily,this.text,this.fontSize,this.reverse,this.expansion,this.width,this.height,vu(this.path),this.bold,this.italic)}load(){let e=Wy.getInstance().getFontCache(this.fontFamily,this.text,this.fontSize,this.reverse,this.expansion,this.bold,this.italic);e!=null?JSON.stringify(e.outline)!=JSON.stringify(this.path)&&Wy.getInstance().addFontCache(this.fontFamily,this.text,this.fontSize,this.reverse,this.expansion,this.width,this.height,vu(this.path),this.bold,this.italic):Wy.getInstance().addFontCache(this.fontFamily,this.text,this.fontSize,this.reverse,this.expansion,this.width,this.height,vu(this.path),this.bold,this.italic)}};var w8=class extends md{constructor(){super(...arguments);this.locked=!1}feed(e){let{id:r,partitionId:i,groupId:n,shellType:s,shellHeight:a,pcbHeight:l,strokeWidth:c,path:h,locked:u,zIndex:d,number:p}=e;this.index=r,this.partition=i,this.groupId=Va(n),this.type=GFe(s),this.zIndex=d,this.number=p,this.isNumber(a)&&(this.shellHeight=a/10),this.isNumber(l)&&(this.pcbHeight=l/10),this.path=h,this.parseAttr(e),this.locked=u}parseAttr(e){let r=e.thickness,i=e.bottomHeight,n=e.topInnerHeight,s=e.bottomInnerHeight,a=HFe(e.direction),l=r/10,c=i/10,h=n/10,u=s/10;this.isNumber(r)&&(this.thickness=l),this.isNumber(i)&&(this.botHeight=c),isNaN(a)||(this.pushCoverDir=a),this.isNumber(n)&&(this.topInnerHeight=h),this.isNumber(s)&&(this.bottomInnerHeight=u)}check(){return this.index==null||this.groupId===void 0||this.type==null||this.shellHeight==null||isNaN(this.shellHeight)||(this.shellHeight<V2&&(this.shellHeight=V2),this.pcbHeight==null||isNaN(this.pcbHeight))||this.thickness==null||this.path==null||this.locked==null?!1:(this.type==="T&B"&&(this.botHeight==null||this.botHeight<V2)&&(this.botHeight=V2),!0)}clearGroupId(){this.groupId=null}getComponent(e){let r={};r.type=this.type,(e instanceof ss||e instanceof Po)&&r.type==="DRAWER"&&(r.type="T&B"),r.shellHeight=this.shellHeight,this.pcbHeight!=null&&(r.substrateHeight=this.pcbHeight),r.shellThickness=this.thickness,this.botHeight!=null&&(r.botShellHeight=this.botHeight);let{type:i,shellHeight:n,substrateHeight:s,botShellHeight:a,shellThickness:l}=r,c=new K0(i,n,s,a,l);return this.pushCoverDir!=null&&(c.pushCoverDir=this.pushCoverDir),this.topInnerHeight!=null&&(c.topInnerHeight=this.topInnerHeight),this.bottomInnerHeight!=null&&(c.bottomInnerHeight=this.bottomInnerHeight),c}finish(){if(this.check()){Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]);let e=this.thickness,r=this.parseShapeModel(this.index,"3D Shell - Outline",53,"",this.locked,e,this.path);return r==null?null:(r.component=this.getComponent(r),this.groupId!=null&&r.setGroupID(this.groupId),this.partition&&(r.partition=this.partition),this.isNumber(this.zIndex)&&(r.zIndex=this.zIndex),this.isNumber(this.number)&&(r.number=this.number),r)}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId);let e=this.getComponent(this.model);this.loadType("3D Shell - Outline"),this.loadLayerId(53),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadComponent(e)}};var L8=class extends md{constructor(){super(...arguments);this.locked=!1}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,depth:a,strokeWidth:l,path:c,locked:h,zIndex:u,number:d,refs:p}=e;this.index=r,this.partition=i,this.groupId=Va(n);let m=s;this.zIndex=u,this.number=d,this.isNumber(m)&&(this.layerId=m),this.isNumber(a)&&(this.depth=a/10),this.isNumber(l)&&(this.strokeWidth=l/10),this.path=c,this.locked=h,p&&(this.refs=p)}check(){return!(this.index==null||this.groupId===void 0||this.path==null||this.layerId==null||this.depth==null||this.strokeWidth==null||this.locked==null)}clearGroupId(){this.groupId=null}getComponent(){var i;let e=[4,8,16];return new ou("Top",this.depth,e,((i=this.refs)==null?void 0:i[0])||"")}finish(){if(this.check()){Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]);let e=this.parseShapeModel(this.index,"3D Shell - Top Slot Region",this.layerId,"",this.locked,this.strokeWidth,this.path);if(e==null)return null;let r=this.getComponent();return this.resultNeedToBeCached&&r.lineId!=""&&$a.getInstance().addConnectRelatedId(r.lineId,e.globalIndex),e.component=r,this.groupId!=null&&e.setGroupID(this.groupId),this.partition&&(e.partition=this.partition),this.isNumber(this.zIndex)&&(e.zIndex=this.zIndex),this.isNumber(this.number)&&(e.number=this.number),e}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId);let e=this.getComponent();this.loadType("3D Shell - Top Slot Region"),this.loadLayerId(this.layerId),this.loadWidth(this.strokeWidth),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadComponent(e)}};var M8=class extends md{constructor(){super(...arguments);this.locked=!1}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,depth:a,strokeWidth:l,path:c,locked:h,zIndex:u,number:d,refs:p,type:m,entityBelong:g,slotOptions:y}=e;this.index=r,this.partition=i,this.groupId=Va(n),this.zIndex=u,this.number=d,this.isNumber(s)&&(this.layerId=s),this.isEntity=m==kk.ENTITY,this.isEntity?this.belong=this.getBelong(g):y?(this.slotOptions=[],y.forEach(b=>{this.slotOptions.push(this.getSlotOption(b))})):this.slotOptions=yVe,this.isNumber(a)&&(this.depth=a/10),this.isNumber(l)&&(this.strokeWidth=l/10),this.path=c,this.locked=h,p&&(this.refs=p)}getBelong(e){switch(e){case eA.AUTO:return 0;case eA.LOWER_SHELLS:return 2;case eA.UPPER_SHELLS:return 1}}getSlotOption(e){switch(e){case tA.ENTITY:return 16;case tA.OUTLINE:return 4;case tA.SCREW_PILLAR:return 8}}check(){return!(this.index==null||this.groupId===void 0||this.path==null||this.layerId==null||this.isEntity==null||this.depth==null||this.strokeWidth==null||this.locked==null)}clearGroupId(){this.groupId=null}getType(){let e=this.refs[0];return this.isEntity?e?"3D Shell - Side Entity":"3D Shell - Top/Bottom Entity":e?"3D Shell - Side Slot Region":"3D Shell - Top Slot Region"}finish(){if(this.check()){Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]);let e=this.getType(),r=this.parseShapeModel(this.index,e,this.layerId,"",this.locked,this.strokeWidth,this.path);if(r==null)return null;this.isNumber(this.zIndex)&&(r.zIndex=this.zIndex),this.isNumber(this.number)&&(r.number=this.number);let i=this.createComponentModel();return r.component=i,this.resultNeedToBeCached&&i.lineId!=""&&$a.getInstance().addConnectRelatedId(i.lineId,r.globalIndex),r.setGroupID(this.groupId),r}else return null}createComponentModel(){var r;let e=((r=this.refs)==null?void 0:r[0])||"";return this.isEntity?new wl(e?"side":"top_bottom",this.depth,e,this.belong):new ou(e?"Side":"Top",this.depth,this.slotOptions,e)}load(){this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId);let e=this.createComponentModel(),r=this.getType();this.loadType(r),this.loadLayerId(this.layerId),this.loadWidth(this.strokeWidth),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadComponent(e)}};var N8=class extends md{constructor(){super(...arguments);this.start=S.ORIGIN;this.end=S.ORIGIN;this.locked=!1}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,startX:a,startY:l,endX:c,endY:h,angle:u,locked:d,zIndex:p,number:m}=e;this.index=r,this.partition=i,this.groupId=Va(n),this.zIndex=p,this.number=m,this.isNumber(s)&&(this.layerId=s),this.isNumber(a)&&this.isNumber(l)&&(this.start=new S(a/10,l/10)),this.isNumber(c)&&this.isNumber(h)&&(this.end=new S(c/10,h/10)),this.isNumber(u)&&(this.angle=u/180*Math.PI),this.locked=d}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.angle==null||isNaN(this.angle)||this.locked==null)}clearGroupId(){this.groupId=null}finish(){if(this.check()){let e=this.index+cr(),r=new ih(e,this.start,this.end,{layerId:this.layerId,strokeWidth:1,locked:this.locked}),i=Mi.getInstance().addPolygon(this.index,"3D Shell - Side Datum Line",this.layerId,[[r]],1,null,this.locked,null,null);return this.groupId!=null&&i.setGroupID(this.groupId),this.partition&&(i.partition=this.partition),this.isNumber(this.zIndex)&&(i.zIndex=this.zIndex),this.isNumber(this.number)&&(i.number=this.number),i}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId),this.loadType("3D Shell - Side Datum Line"),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath([[xe(this.start.x*10,4),xe(this.start.y*10,4),"L",xe(this.end.x*10,4),xe(this.end.y*10,4)]])}};var k8=class extends md{constructor(){super(...arguments);this.center=S.ORIGIN;this.counterbore=null;this.stiffener=null;this.locked=!1;this.needCounterbore=!1;this.needStiffener=!1}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,centerX:a,centerY:l,specification:c,depth:h,thickness:u,holeDiameter:d,counterBore:p,stiffener:m,locked:g,zIndex:y,number:b}=e;this.index=r,this.groupId=Va(n),this.zIndex=y,this.number=b,this.partition=i,this.isNumber(s)&&(this.layerId=s),this.isNumber(a)&&this.isNumber(l)&&(this.center=new S(a/10,l/10));let P=FFe(c);P&&!["M2","M3","M4","M5","M6"].includes(P)&&(P="M2"),this.specification=P||"Custom",this.isNumber(h)&&(this.depth=h/10),this.isNumber(u)&&(this.thickness=u/10),this.isNumber(d)&&(this.holeDiameter=d/10),this.parseCounterBore(p),this.parseStiffener(m),this.locked=g}parseCounterBore(e){this.needCounterbore=!!e,e&&(this.counterbore={height:e.height/10,diameter:e.diameter/10})}parseStiffener(e){if(this.needStiffener=!!e,e){let{topWidth:r,bottomWidth:i,height:n,stiffThickness:s}=e;this.stiffener={topWidth:r/10,bottomWidth:i/10,height:n/10,stiffThickness:s/10}}}check(){if(this.index==null||this.layerId==null||this.specification==null||this.center==null||this.depth==null||isNaN(this.depth)||(this.depth<V2&&(this.depth=V2),this.locked==null))return!1;if(this.specification=="Custom"){if(!xh(this.holeDiameter)||!xh(this.thickness))return!1;this.needStiffener&&!this.stiffener&&(this.needStiffener=!1),this.needCounterbore&&!this.counterbore&&(this.needCounterbore=!1)}return!0}clearGroupId(){this.groupId=null}getComponent(){let e=new um(this.specification,this.depth);e.specification=this.specification,aT.updatePropsBySpecification(e,this.specification,this.needStiffener,this.needCounterbore),e.height=this.depth,xh(this.thickness)&&(e.thickness=this.thickness),xh(this.holeDiameter)&&(e.holeDiameter=this.holeDiameter),this.needCounterbore?this.counterbore&&(e.counterboreProps=this.counterbore):e.counterboreProps=null,this.needStiffener?this.stiffener&&(e.stiffenerProps=this.stiffener):e.stiffenerProps=null;let r=aT.getScrewPillarSize(e);return e}finish(){if(this.check()){let e=zi.getInstance().addCircle(this.index,"3D Shell - Screw Pillar",this.layerId,this.center,.1,1,this.locked,null);this.isNumber(this.zIndex)&&(e.zIndex=this.zIndex),this.isNumber(this.number)&&(e.number=this.number);let r=this.getComponent();e.component=r,e.setGroupID(this.groupId);let i=aT.getScrewPillarSize(r);return e.radius=i.outerRadius,e}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId);let e=this.getComponent();this.loadType("3D Shell - Screw Pillar"),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadComponent(e),this.loadCenter(this.center)}loadCenter(e){this.model.center.equals(e)||(this.model.center=e)}};var bm=class extends rR{constructor(){super(...arguments);this.modelType="Picture"}get hashIdModified(){return this.hasDataState(7)}set hashIdModified(e){this.setDataState(7,e)}needMirror(){return xc(this.layerId,this.mirror)}};function wj(o){switch(o){case 3:case 4:case 13:return o;default:return 3}}var B8=class o extends bm{constructor(e,r,i,n,s,a,l,c,h,u,d){super();this.modelType="Picture";this._globalIndex=e,this._start=i,this._width=n,this._height=s,this._rotation=a,this._mirror=l,this._hashId=c;let p=xc(r,l);if(!d){let m=Ae.translate(0,-s,0).rotateZ(a).scale(p?-1:1,1,1).translate1(i.x,i.y,0);d=new vs(r,S.ORIGIN,new S(0,s),new S(n,0),new S(n,s),h,u),d.transform(m),d.updateBox()}this.box=d}get hashId(){return this._hashId}set hashId(e){this._hashId!=e&&(this._hashId=e,this.hashIdModified=!0)}get layerId(){return this.box.layerId}set layerId(e){this.layerId!=e&&(this.watchLayerIdModify(this.layerId),this.box.layerId=e,this.reset4Matrix(this.matrix),this.layerModified=!0)}get start(){return this._start}set start(e){this._start!=e&&(this._start=e,this.reset4Matrix(this.matrix))}get width(){return this._width}set width(e){this._width!=e&&(this._width=e,this.reset4(this.width,this.height,this.matrix))}get height(){return this._height}set height(e){this._height!=e&&(this._height=e,this.reset4(this.width,this.height,this.matrix))}get rotation(){return this._rotation}set rotation(e){this._rotation!=e&&(this._rotation=e,this.reset4Matrix(this.matrix))}set mirror(e){this._mirror!=e&&(this._mirror=e,this.reset4Matrix(this.matrix))}get mirror(){return this._mirror}get center(){return this.box.center}set center(e){let r=e.sub(this.center),i=Ae.translate(r.x,r.y,0);this.transform(i)}get bbox(){return this.box.bbox}get locked(){return this.box.locked}set locked(e){this.box.locked=e}get hashIdModified(){return this.hasDataState(7)}set hashIdModified(e){this.setDataState(7,e)}get matrix(){let e=xc(this.layerId,this.mirror);return Ae.rotateZ(this.rotation).scale(e?-1:1,1,1).translate1(this.start.x,this.start.y,0)}transform(e){let r=new S(e.data[0],e.data[1]).normalize(),i=Math.atan2(r.y,r.x);xc(this.layerId,this.mirror)?this.rotation-=i:this.rotation+=i,this.start=this.start.multiply4(e)}inShape(e,r,i){return this.box.inShape(e,r,i)}reset4Matrix(e){this.reset4(this.width,this.height,e)}reset4(e,r,i){this.box.leftUp=S.ORIGIN.multiply4(i),this.box.leftLow=new S(0,-r).multiply4(i),this.box.rightLow=new S(e,-r).multiply4(i),this.box.rightUp=new S(e,0).multiply4(i),this.updateShapeData()}updateBox(){return this.box.updateBox()}getMathGraphics(e=this.layerId,r){return this.isEmpty?null:this.box.getMathGraphics(e,r)}needMirror(){return xc(this.layerId,this.mirror)}clone(){this.refreshBBox&&this.updateBox();let e=new o(this.globalIndex,this.layerId,this.start,this.width,this.height,this.rotation,this.mirror,this.hashId,this.locked,this.bbox);return e.number=this.number,e.zIndex=this.zIndex,e}buildBBox(){return this.isEmpty?null:(this.refreshBBox&&(this.updateBox(),this.refreshBBox=!1),this.bbox)}};var G4=class G4 extends wi{static getInstance(){return G4.manager==null&&(G4.manager=new G4),G4.manager}addModel(t){this.map.set(t.globalIndex,t)}addImage(t,e,r,i,n,s,a,l,c){return this._last=new B8(t,wj(e),r,i,n,s,a,c,l,void 0),this.addModel(this._last),this._last}delete(t,e){t instanceof bm&&this.map.delete(e)}};G4.manager=null;var e0=G4;var F8=class extends A8{constructor(){super();this.start=S.ORIGIN}getPath(){return this.path}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,fileName:a,startX:l,startY:c,width:h,height:u,angle:d,mirror:p,path:m,locked:g,zIndex:y,number:b}=e;this.index=r,this.partition=i,this.groupId=Va(n),this.zIndex=y,this.number=b,this.isNumber(s)&&(this.layerId=s),this.fileName=a,this.isNumber(l)&&this.isNumber(c)&&(this.start=new S(l/10,c/10)),this.isNumber(h)&&(this.width=h/10),this.isNumber(u)&&(this.height=u/10),this.isNumber(d)&&(this.angle=d/180*Math.PI),this.mirror=p;let P=m.split("blob:").pop();this.hashId=P,this.locked=g,this.path=m}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.width==null||isNaN(this.width)||this.width<=0||this.height==null||isNaN(this.height)||this.height<=0||this.locked==null||this.angle==null||isNaN(this.angle))}clearGroupId(){this.groupId=null}finish(){let e=this.hashId,r=this.resultNeedToBeCached?e0.getInstance().addImage(this.index,this.layerId,this.start,this.width,this.height,this.angle,this.mirror,this.locked,e):new B8(this.index,this.layerId,this.start,this.width,this.height,this.angle,this.mirror,e,this.locked);return this.groupId!=null&&r.setGroupID(this.groupId),this.partition&&(r.partition=this.partition),this.isNumber(this.zIndex)&&(r.zIndex=this.zIndex),this.isNumber(this.number)&&(r.number=this.number),r}loadHash(e){this.model.hashId!==e&&(this.model.hashId=e)}load(){this.loadPartitionId(this.partition),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadStart(this.start),this.loadWidth(this.width),this.loadHeight(this.height),this.loadAngle(this.angle),this.loadMirror(this.mirror),this.loadHash(this.hashId)}};var Zre=class extends $l{get hashkey(){return this.name}feed(t){this.name=t.name}check(){return this.name!==void 0}finish(){this.name!=null&&te.getInstance().setRuleTemplateName(this.name)}load(){if(!this.resultNeedToBeCached)return;te.getInstance().getRuleTemplateName()!==this.name&&te.getInstance().setRuleTemplateName(this.name)}};var uR=class extends $l{constructor(){super(...arguments);this.netModifyInter=null}get hashkey(){return this.parentIndex+"|"+this.id+"|"+this.num}getPadId(){return`${this.parentIndex}${this.id}`}feed(e){let{componentId:r,padNum:i,padNet:n,padId:s,partitionId:a,padLen:l,attrsMap:c}=e;this.parentIndex=r,this.partition=a,this.num=i,this.net=n,this.id=s,this.isNumber(l)&&(this.padLen=l/10),this.attrsMap=c||{}}check(){return!(this.parentIndex==null||this.num==null||this.net==null)}finish(){}loadPadNet(e,r,i){if(!this.model)return;r=this.parentIndex+r,this.model.modelType=="Via"&&(e=r);let n=this.parentModel.isCachePadNet()?this.parentModel.getNet(e,r):this.model.net;n!=i&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(n,this.model),this.parentModel.isCachePadNet()&&this.parentModel.setNet(e,r,i),this.model.net=i)}loadPadLen(e,r,i){as.getInstance().setPadLen(e,`${e}${r}`,i)}loadPadAttr(e){if(this.model&&this.model.modelType=="Pad")for(let r in e){let i=e[r];this.model.addATTRMap(r,i)}}load(){this.loadPadNet(this.num,this.id,this.net),this.loadPadLen(this.parentIndex,this.id,this.padLen),this.loadPadAttr(this.attrsMap)}};var Jre=class extends $l{constructor(){super(),this.padsPairs=[]}get hashkey(){return this.index}get sort(){return this._sort}feed(t){let{id:e,name:r,sort:i,pads:n}=t;this.index=e,this.groupName=r,this.number=e,this.padsPairs=n,this._sort=i}check(){return!(!this.number||!this.groupName)}updateDetails(t,e){let r=[];for(let i=0;i<e.length;i++){let n=e[i];r.push(new rg(n[0],n[1]))}r.length&&t.updatePadsPairGroupDetails(r)}finish(){let t=te.getInstance(),e=t.getPadsPairGroupItemByGroupName(this.groupName);return e||(e=t.addPadsPairGroup(this.groupName)),this.updateDetails(e,this.padsPairs),this.groupColor&&(e.groupColor=this.groupColor),this.index&&(e.number=this.index),e}loadPadsPairs(t){let e=[];for(let r of this.model.details)e.push([r.pad1Title,r.pad2Title]);JSON.stringify(e)!==JSON.stringify(t)&&this.updateDetails(this.model,t)}loadGroupColor(t){this.model.groupColor!==t&&(this.model.groupColor=t)}load(){this.loadPadsPairs(this.padsPairs),this.loadGroupColor(this.groupColor)}};var Qre=class{constructor(){this.init=!1;this.defaultSafeData=null;this.defaultCopperSpace=null;this.defaultInnerSpace=null;this.copperChangeMap=new Map;this.innerChangeMap=new Map}addDefaultSafeSpaceData(t){this.init=!0,this.defaultSafeData=t}addDefaultCopperSpace(t,e){this.defaultCopperSpace={netClearance:t,boardClearance:e}}addDefaultInnerSpace(t,e){this.defaultInnerSpace={netClearance:t,boardClearance:e}}getNewDefaultData(t,e){if(t&&this.defaultSafeData==null||!t&&this.defaultInnerSpace==null)return null;let r=t?this.copperChangeMap.get(e):this.innerChangeMap.get(e);if(r==null)return null;let{netClearance:i,boardClearance:n}=r,s=this.defaultSafeData.safeSpacing[0].content,a=new Array(s.length);for(let l=0;l<s.length;l++)a[l]=Array.from(s[l]);return this.updateSafeData(a,i,n),a}fixSafeData(t){if(this.defaultCopperSpace!=null)for(let e of t.safeSpacing)this.updateSafeData(e.content,this.defaultCopperSpace.netClearance,this.defaultCopperSpace.netClearance)}updateSafeData(t,e,r){for(let i=0;i<t.length;i++){let n=t[i];for(let s=0;s<n.length;s++)i==7?s==11||s==8?n[s]=r:n[s]=e:s==7&&(i==11||i==8?n[s]=r:n[s]=e)}}addCopper2SafeChangeMap(t,e,r,i,n){this.copperChangeMap.set(t,{name:e,isDefault:r,netClearance:i,boardClearance:n})}addInner2SafeChangeMap(t,e,r,i,n){this.innerChangeMap.set(t,{name:e,isDefault:r,netClearance:i,boardClearance:n})}getSafeName4Copper(t){var e;return(e=this.copperChangeMap.get(t))==null?void 0:e.name}getSafeName4Plane(t){var e;return(e=this.innerChangeMap.get(t))==null?void 0:e.name}getDefaultCopper(){for(let[,t]of this.copperChangeMap)if(t.isDefault)return t.name;return null}getDefaultPlane(){for(let[,t]of this.innerChangeMap)if(t.isDefault)return t.name;return null}};var eie=class{constructor(t,e,r){this._hashId=t,this._source=r,this._fileName=e}get fileName(){return this._fileName}get hashId(){return this._hashId}get source(){return this._source}};var JCe=class extends wi{addTemplate(t,e,r){let i=this.getItem(t);return i||(i=new eie(t,e,r),this.map.set(t,i)),i}},Yd=new JCe;async function V8(o){if(!o)return;let t=[];for(let e of o){if(Yd.getItem(e.hashId))continue;let r=new Promise((i,n)=>{let{hashId:s,dataUrl:a,fileName:l}=e,c=new Image;c.src=a,c.onload=()=>{Yd.addTemplate(s,l,c),i(!0)},c.onerror=()=>{i(!1)}});t.push(r)}return Promise.all(t)}var tie=class extends $l{feed(t){this.index=t.id,this.url=t.content,this.fileName=t.filename}check(){return this.url!=null}async finish(){await V8([{hashId:this.index,dataUrl:this.url,fileName:this.fileName}])}};var rie=class extends E0{constructor(){super(...arguments);this.coppers=[]}feed(e){let{id:r,fill:i,number:n}=e,s;this.layerId=r;for(let a of i)s=new aR,s.feed({...a,number:n,layerId:r,fillStyle:N2.PLANE}),this.coppers.push(s)}get hashkey(){return this.layerId}check(){return!!this.index}finish(){if(this.check())for(let e of this.coppers)e.finish()}};var ng=class{constructor(){this.canvas=new Array;this.layer=new Array;this.layerPhys=new Array;this.activeLayer=new Array;this.net=new Array;this.ruleTemplateName=new Array;this.rule=new Array;this.ruleSelect=new Array;this.padsPairGroup=new Array;this.group=new Array;this.via=new Array;this.pad=new Array;this.line=new Array;this.arc=new Array;this.poly=new Array;this.fill=new Array;this.fpcFill=new Array;this.region=new Array;this.partition=new Array;this.pour=new Array;this.copper=new Array;this.image=new Array;this.tearDrop=new Array;this.font=new Array;this.str=new Array;this.attr=new Array;this.dimension=new Array;this.component=new Array;this.padNet=new Array;this.shells=new Array;this.shellCuts=new Array;this.shellEntity=new Array;this.creases=new Array;this.bosses=new Array;this.objs=new Array;this.blob=new Array;this.reuseBlocks=new Array;this.dimensionAttr=new Array;this.inner=new Array;this.ignoreType=new Set;this.shapeTicketRecode=new Map;this.otherTicketRecode=new Map;this.batch=1;this.index=1;this.ids=null;this._isNew=!0;this.oldTicket=null;this.lastDecodes=new Map}get isNew(){return this._isNew}isShape(t){switch(t){case"HEAD":case"LAYER":case"LAYER_PHYS":case"ACTIVE_LAYER":case"PRIMITIVE":case"RULE_TEMPLATE":case"RULE":case"RULE_SELECTOR":case"PANELIZE":case"SILK_OPTS":case"PREFERENCE":case"CANVAS":case"ATTR":return!1;default:return!0}}delete(t,e,r){this.deleteTicket(t,r,e)}delete2(t,e,r){if(this.deleteTicket(t,r,e))switch(t){case"LINE":case"ARC":An.getInstance().deleteById(e);break;case"STRING":mo.getInstance().deleteById(e);break}}updateShapeTicket(t,e,r=1){return this.oldTicket=this.shapeTicketRecode.get(t),this.oldTicket==null||Math.abs(this.oldTicket)<e?(this.shapeTicketRecode.set(t,e*r),!0):!1}updateOtherTicket(t,e,r,i=1){let n=this.otherTicketRecode.get(t);n||(n=new Map,this.otherTicketRecode.set(t,n));let s=n.get(e)||0;return r>Math.abs(s)?(n.set(e,r*i),!0):!1}async iterator(t){let e=[[this.canvas,"CANVAS"],[this.layer,"LAYER"],[this.layerPhys,"LAYER_PHYS"],[this.activeLayer,"ACTIVE_LAYER"],[this.net,"NET"],[this.group,"GROUP"],[this.via,"VIA"],[this.pad,"PAD"],[this.line,"LINE"],[this.poly,"POLY"],[this.fill,"FILL"],[this.fpcFill,"FPC_FILL"],[this.region,"REGION"],[this.partition,"PARTITION"],[this.pour,"POUR"],[this.copper,"POURED"],[this.objs,"OBJ"],[this.tearDrop,"TEARDROP"],[this.str,"STRING"],[this.attr,"ATTR"],[this.dimension,"DIMENSION"],[this.component,"COMPONENT"],[this.padNet,"PAD_NET"],[this.ruleTemplateName,"RULE_TEMPLATE"],[this.rule,"RULE"],[this.ruleSelect,"RULE_SELECTOR"],[this.padsPairGroup,"EQLEN_GRP"],[this.shells,"SHELL"],[this.shellCuts,"SHELLCUT"],[this.shellEntity,"SHELL_ENTITY"],[this.creases,"CREASE"],[this.bosses,"BOSS"],[this.reuseBlocks,"REUSE_BLOCK"]];for(let[r,i]of e){let n=this.getTicketRecode(i);if(n==null)continue;let s,a;for(let l=r.length-1;l>=0;l--)s=r[l],a=n.get(s.hashkey),!(a==null||s.ticket>=Math.abs(a))&&r.splice(l,1)}if(t)for(let[r,i]of e)for(let n of r)await t(n)}feed(t,e,r,i=!1){if(this.ignoreType.has(t))return null;let n=this.getDecode(t,i);return n&&(n.ticket=r,n.feed(e)),this.updateTicket(t,r,n),n}feed2(t,e,r){if(this.ignoreType.has(t))return null;if(this.lastDecode=this.lastDecodes.get(t),this.lastDecode||(this.lastDecode=this.getOldDecode(t),this.lastDecodes.set(t,this.lastDecode)),this.lastDecode){if(this.lastDecode.ticket=r,this.lastDecode.feed(e),this.updateTicket(t,r,this.lastDecode))if(this.handleItem&&this.handleItem.length>0){let i=this.lastDecode.finish();for(let n of this.handleItem)n(i)}else this.lastDecode.finish();this.lastDecode.clear()}}getOldDecode(t){switch(t){case"LINE":return new I4;case"ARC":return new T4;case"FONT":return new $E;case"STRING":return new y4;case"PAD":return new M4;case"RULE":return new Ej;case"VIA":return new w4}}updateTicket(t,e,r){switch(t){case"VIA":case"PAD":case"LINE":case"CARC":case"ARC":case"POLY":case"FILL":case"FPC_FILL":case"REGION":case"PARTITION":case"POUR":case"IMAGE":case"OBJ":case"TEARDROP":case"STRING":case"ATTR":case"DIMENSION":case"COMPONENT":case"SHELL":case"SHELLCUT":case"SHELL_ENTITY":case"CREASE":case"BOSS":return this.updateShapeTicket(r.index,e);case"POURED":case"GROUP":case"REUSE_BLOCK":case"EQLEN_GRP":case"RULE_TEMPLATE":case"RULE_SELECTOR":case"RULE":case"PAD_NET":case"NET":case"ACTIVE_LAYER":case"LAYER_PHYS":case"LAYER":case"BLOB":case"INNER":return this.updateOtherTicket(t,r.hashkey,e);default:return!0}}deleteTicket(t,e,r){switch(t){case"VIA":case"PAD":case"LINE":case"CARC":case"ARC":case"POLY":case"FILL":case"FPC_FILL":case"REGION":case"PARTITION":case"POUR":case"IMAGE":case"OBJ":case"TEARDROP":case"STRING":case"ATTR":case"DIMENSION":case"COMPONENT":case"SHELL":case"SHELLCUT":case"SHELL_ENTITY":case"CREASE":case"BOSS":return this.updateShapeTicket(r,e,-1);case"POURED":case"GROUP":case"REUSE_BLOCK":case"EQLEN_GRP":case"RULE_TEMPLATE":case"RULE_SELECTOR":case"RULE":case"PAD_NET":case"NET":case"ACTIVE_LAYER":case"LAYER_PHYS":case"LAYER":case"BLOB":case"INNER":return this.updateOtherTicket(t,r,e,-1);default:return!0}}getDeletedIds(){let t=new Array;for(let[e,r]of this.shapeTicketRecode)r<0&&t.push(e.toString());for(let[e,r]of this.otherTicketRecode)for(let[i,n]of r)n<0&&t.push(i.toString());return t}getTicketRecode(t){switch(t){case"VIA":case"PAD":case"LINE":case"CARC":case"ARC":case"POLY":case"FILL":case"FPC_FILL":case"REGION":case"PARTITION":case"POUR":case"IMAGE":case"OBJ":case"TEARDROP":case"STRING":case"ATTR":case"DIMENSION":case"COMPONENT":case"SHELL":case"SHELLCUT":case"SHELL_ENTITY":case"CREASE":case"BOSS":return this.shapeTicketRecode;case"POURED":case"GROUP":case"REUSE_BLOCK":case"EQLEN_GRP":case"RULE_TEMPLATE":case"RULE_SELECTOR":case"RULE":case"PAD_NET":case"NET":case"ACTIVE_LAYER":case"LAYER_PHYS":case"LAYER":case"BLOB":case"FONT":return this.otherTicketRecode.get(t);default:return null}}parse(t,e,r,i,n){return this.isShape(t)&&(this._isNew=!1),i&&(e.id=i,e.number=n),this.ids&&this.ids.add(i),this.feed(t,e,r)}parse2(t,e,r,i,n){return this.isShape(t)&&(this._isNew=!1),i&&(e.id=i,e.number=n),this.ids&&this.ids.add(i),this.feed2(t,e,r)}clientParse(t,e,r,i,n){return i!=null&&(e.id=i),n!=null&&(e.number=n),this.feed(t,e,r,!0)}getDecode(t,e=!1){switch(t){case"BLOB":{let r=new tie;return!e&&this.blob.push(r),r}case"CANVAS":{let r=new Gre;return!e&&this.canvas.push(r),r}case"LAYER":{let r=new Nre;return!e&&this.layer.push(r),r}case"LAYER_PHYS":{let r=new kre;return!e&&this.layerPhys.push(r),r}case"ACTIVE_LAYER":{let r=new Bre;return!e&&this.activeLayer.push(r),r}case"NET":{let r=new jre;return!e&&this.net.push(r),r}case"GROUP":{let r=new Xre;return!e&&this.group.push(r),r}case"VIA":{let r=new w4;return!e&&this.via.push(r),r}case"PAD":{let r=new M4;return!e&&this.pad.push(r),r}case"LINE":{let r=new I4;return!e&&this.line.push(r),r}case"ARC":{let r=new T4;return!e&&this.arc.push(r),r}case"POLY":{let r=new C8;return!e&&this.poly.push(r),r}case"FILL":{let r=new aR;return!e&&this.fill.push(r),r}case"FPC_FILL":{let r=new S8;return!e&&this.fpcFill.push(r),r}case"REGION":{let r=new E8;return!e&&this.region.push(r),r}case"PARTITION":{let r=new lR;return!e&&this.partition.push(r),r}case"POUR":{let r=new O8;return!e&&this.pour.push(r),r}case"POURED":{let r=new Yre;return!e&&this.copper.push(r),r}case"IMAGE":{let r=new _8;return!e&&this.image.push(r),r}case"OBJ":{let r=new F8;return!e&&this.objs.push(r),r}case"TEARDROP":{let r=new D8;return!e&&this.tearDrop.push(r),r}case"STRING":{let r=new y4;return!e&&this.str.push(r),r}case"FONT":{let r=new $E;return!e&&this.font.push(r),r}case"ATTR":{let r=new Yy;return!e&&this.attr.push(r),r}case"DIMENSION":{let r=new R8;return!e&&this.dimension.push(r),r}case"COMPONENT":{let r=new x8;return!e&&this.component.push(r),r}case"PAD_NET":{let r=new uR;return!e&&this.padNet.push(r),r}case"RULE_TEMPLATE":{let r=new Zre;return!e&&this.ruleTemplateName.push(r),r}case"RULE":{let r=new Ej;return!e&&this.rule.push(r),r}case"RULE_SELECTOR":{let r=new Vre;return!e&&this.ruleSelect.push(r),r}case"EQLEN_GRP":{let r=new Jre;return!e&&this.padsPairGroup.push(r),r}case"SHELL":{let r=new w8;return!e&&this.shells.push(r),r}case"SHELLCUT":{let r=new L8;return!e&&this.shellCuts.push(r),r}case"SHELL_ENTITY":{let r=new M8;return!e&&this.shellEntity.push(r),r}case"CREASE":{let r=new N8;return!e&&this.creases.push(r),r}case"BOSS":{let r=new k8;return!e&&this.bosses.push(r),r}case"INNER":{let r=new rie;return!e&&this.inner.push(r),r}default:return null}}batchs(){this.batchDecode(this.via),this.batchDecode(this.pad),this.batchDecode(this.line),this.batchDecode(this.arc),this.batchDecode(this.poly),this.batchDecode(this.fill),this.batchDecode(this.fpcFill),this.batchDecode(this.region),this.batchDecode(this.partition),this.batchDecode(this.pour),this.batchDecode(this.image),this.batchDecode(this.objs),this.batchDecode(this.tearDrop),this.batchDecode(this.str),this.batchDecode(this.attr),this.batchDecode(this.dimension),this.batchDecode(this.component),this.batchDecode(this.shells),this.batchDecode(this.shellCuts),this.batchDecode(this.shellEntity),this.batchDecode(this.creases),this.batchDecode(this.bosses)}batchDecode(t,e=this.batch){if(this.batch==1)return;let r=t.length,i=Math.ceil(r/e),n=(this.index-1)*i,s=this.index==this.batch?r-n:i,a=n+s,l=t.slice(n,a);t.length=0,Re.addAll(t,l),l.length=0}addIgnoreType(t){this.ignoreType.add(t)}preAdjust(){this.iterator(null),this.shapeTicketRecode.clear(),this.otherTicketRecode.clear();let t=new Map;for(let n of this.component)t.set(n.index,n);let e=new Array;for(let n of this.attr){let s=t.get(n.parentIndex);s!=null?s.addAttribute(n):e.push(n)}this.attr.length=0,Re.addAll(this.attr,e);for(let n of this.padNet){let s=t.get(n.parentIndex);s!=null&&s.addPadNet(n)}this.padNet.length=0;for(let n of this.reuseBlocks){let s=t.get(n.shapeIndex);s!=null&&s.setReuseBlock(n)}t.clear(),xr(this.pour,(n,s)=>n.order-s.order,0,this.pour.length);let r=new Map;for(let n of this.copper){let s=n.index;r.set(s,n)}for(let n of this.pour){let s=n.index,a=r.get(s);a&&n.addCopperDecode(a)}r.clear();let i=new Qre;for(let n of this.rule)n.conver2Obj(i);if(i.init){let n=Array.from(this.rule);for(let s of n){let a=s.getNewRuleDecode(i);a!=null&&this.rule.push(a)}for(let s of this.ruleSelect)s.versionUpgrades(i)}for(let n of this.inner)Re.addAll(this.fill,n.coppers);this.inner.length=0}getItemFormat(t){return this.format[t]}clear(){this.shapeTicketRecode.clear(),this.otherTicketRecode.clear()}};var dR=class{constructor(){this.manager=te.getInstance()}ruleInitAndCheck(){this.manager.correctDefault(),this.manager.correctRuleData(),this.manager.correctRegion()}correctEmptyNet(){let t="default",e=this.manager.getNet("");e!=null&&(e.safeSpacing=t,e.trackPhysics=t,e.differentialPhysics=t,e.netLengthPhysics=t,e.netLengthTolerancePhysics=t,e.blindViaPhysics=t,e.radiusPhysics=t,e.innerPlane=t,e.copperPlane=t,e.solderExpansion=t,e.pasteExpansion=t)}};var ET=class{constructor(t){this._isNew=!0;this.loadFont=!0;this.loadBlob=!0;this.watch=!0;this.mulSelect=!1;this.decode=new ng,this.compiler=t,this.docType=t instanceof Pu?3:4}get isNew(){return this._isNew}delete(t,e,r){this.decode.delete(t,e,r)}delete2(t,e,r){this.decode.delete2(t,e,r)}getDecodeTool(){return this.decode}async init(t,e){this.compiler!=null&&(this.compiler.setHandle(t||new og(this)),await this.compiler.init(this.loadFont,this.loadBlob,this.watch,this.mulSelect,x.getInstance().needNum,e),this.compiler instanceof Pu&&(console.time("parseFootAndDevice"),await this.parseFootAndDevice(),console.timeEnd("parseFootAndDevice")))}async parseFootAndDevice(){if(this.docType!=3)return;let t=new Set,e=new Set,r=x.getInstance().compilerChannel;for(let n of this.decode.attr){let s=n.key,a=n.value;if(s=="Device"){if(e.has(a))continue;e.add(a);let l=await gh.getInstance().add(a,r,this.watch);if(l){let c=l.footprintUUID;c!=null&&c!=""&&t.add(c)}}else s=="Footprint"&&t.add(a)}let i=new Array;for(let n of t)n.indexOf("_")>-1?i.push(Wi.getInstance().addCustomFootprint(n,r,this.watch)):i.push(Wi.getInstance().add(n,r,this.watch));await Promise.all(i)}async footprintIsExist(t){return await this.compiler.footprintIsExist(t)}async getCloneFootprint(t,e){return await Wi.getInstance().cloneFootprint(t,e,this.watch)}async parseObj(){let t=[],e=new Set,r={};for(let i of this.decode.blob)r[i.hashkey]=i;for(let i of this.decode.objs){let a=(i.getPath().match(/blob\:(.*)/)||[])[1];if(a){if(e.has(a))continue;e.add(a);let l=r[a];l&&l.check()&&t.push({hashId:l.index,dataUrl:l.url,fileName:l.fileName})}}await V8(t)}setBatch(t=1,e=1){this.decode.batch=t,this.decode.index=e}setDocType(t){this.docType=t}build(){return this.decode.preAdjust(),this.decode.batchs(),this.batchBuildItems(),!0}parse(t,e,r,i,n){t!=="BLOB"&&t!="FONT"&&(this._isNew=!1),i&&(e.id=i,e.number=n),this.decode.feed(t,e,r)}parse2(t,e,r,i,n){t!=="BLOB"&&t!="FONT"&&(this._isNew=!1),i&&(e.id=i,e.number=n),this.decode.feed2(t,e,r)}batchBuildItems(){this.handleLayers(this.decode.layer,this.decode.layerPhys),this.buildItems(this.decode.layer),this.buildItems(this.decode.layerPhys),this.buildItems(this.decode.net),this.buildItems(this.decode.ruleTemplateName),this.buildItems(this.decode.rule),this.buildItems(this.decode.ruleSelect),this.ruleInitAndCheck(),this.buildItems(this.decode.group),this.buildItems(this.decode.font),this.buildItems(this.decode.via),this.buildItems(this.decode.pad),this.buildItems(this.decode.line),this.buildItems(this.decode.arc),this.buildItems(this.decode.poly),this.buildItems(this.decode.fill),this.buildItems(this.decode.fpcFill),this.buildItems(this.decode.region),this.buildItems(this.decode.partition),this.buildItems(this.decode.pour),this.buildItems(this.decode.copper),this.buildItems(this.decode.image),this.buildItems(this.decode.objs),this.buildItems(this.decode.tearDrop),this.buildItems(this.decode.str),this.docType!=3&&this.buildItems(this.decode.attr),this.buildItems(this.decode.dimension),this.buildItems(this.decode.component),this.buildItems(this.decode.shells),this.buildItems(this.decode.shellCuts),this.buildItems(this.decode.shellEntity),this.buildItems(this.decode.creases),this.buildItems(this.decode.bosses),this.buildItems(this.decode.padsPairGroup),this.buildItems(this.decode.activeLayer),this.filterPlaneLayer()}filterPlaneLayer(){let t=new Set($e.getInstance().getAllPlaneLayerIds());if(t.size>0)for(let e of An.getInstance().getAllItem())t.has(e.layerId)&&(e.remove(),An.getInstance().delete(e,e.globalIndex))}ruleInitAndCheck(){let t=new dR;t.ruleInitAndCheck(),t.correctEmptyNet()}handleLayers(t,e){this.compiler.mgr.layerPhyFix.fix(t,e)}fixRuleSelectorLayers(t,e){this.compiler.mgr.layerPhyFix.fix(t,e)}buildItems(t){if(t){for(let e of t)try{e.finish()}catch(r){console.log(r)}t.length=0}}async parseSourceByCompiler(t,e){if(t==null)return!1;let r=new og(this);this.compiler.setHandle(r);let i=this.compiler instanceof Pu;e&&(t=i?uz("",t,[],[],[],[]):o5e("",t,!1)),this.compiler.consistencyManager.parseFull(t),i&&await this.parseFootAndDevice()}clear(){this.decode.clear()}};var pR=class{constructor(){this.client="";this._ticket=-1}setClient(t){this.client=t}setTicket(t){this._ticket=t}destory(){}needOn(t,e){return!1}onStringNum(t,e){}onAttrNum(t,e){}onPadNet(t,e,r,i){}onDelPadNet(t,e,r,i,n,s){}onComponent(t,e,r,i,n,s){}onDelComponent(t,e,r,i){}onComponentNum(t,e){}onDimensionNum(t,e){}onBossNum(t,e){}onShellEntityNum(t,e){}onShellCutNum(t,e){}onCreaseNum(t,e){}onShellNum(t,e){}onFpcFillNum(t,e){}onTeardropNum(t,e){}onImageNum(t,e){}onPouredNum(t,e){}onPourNum(t,e){}onRegionNum(t,e){}onFillNum(t,e){}onPolyNum(t,e){}onObjNum(t,e){}onArcNum(t,e){}onLineNum(t,e){}onPadNum(t,e){}onViaNum(t,e){}onPartitionNum(t,e){}onBoard(t,e,r,i){}onDelBoard(t,e,r){}};function KE(o,t,e){switch(t){case"Board Outline":case"Line":return x.getInstance().compiler.uploadPoly(o,e);case"Fill Region":case"Slot Region":return x.getInstance().compiler.uploadFill(o,e);case"Prohibited Region":case"Constraint Region":return x.getInstance().compiler.uploadRegion(o,e);case"Copper Region":return x.getInstance().compiler.uploadPour(o,e);case"Partition":return x.getInstance().compiler.uploadPartition(o,e);case"TearDrop":return x.getInstance().compiler.uploadTeardrop(o,e);case"FPC Stiffener":return x.getInstance().compiler.uploadFpcFill(o,e);case"3D Shell - Outline":return x.getInstance().compiler.uploadShell(o,e);case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return x.getInstance().compiler.uploadShellEntity(o,e);case"3D Shell - Side Datum Line":return x.getInstance().compiler.uploadCrease(o,e);case"3D Shell - Screw Pillar":return x.getInstance().compiler.uploadBoss(o,e);case"Board":return x.getInstance().compiler.uploadBoard(e)}return null}function qI(o,t){switch(t){case"Board Outline":case"Line":return x.getInstance().compiler.deletePoly(o);case"Fill Region":case"Slot Region":return x.getInstance().compiler.deleteFill(o);case"Prohibited Region":case"Constraint Region":return x.getInstance().compiler.deleteRegion(o);case"Copper Region":return x.getInstance().compiler.deletePour(o);case"Partition":return x.getInstance().compiler.deletePartition(o);case"TearDrop":return x.getInstance().compiler.deleteTeardrop(o);case"FPC Stiffener":return x.getInstance().compiler.deleteFpcFill(o);case"3D Shell - Outline":return x.getInstance().compiler.deleteShell(o);case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return x.getInstance().compiler.deleteShellEntity(o);case"3D Shell - Side Datum Line":return x.getInstance().compiler.deleteCrease(o);case"3D Shell - Screw Pillar":return x.getInstance().compiler.deleteBoss(o);case"Board":return x.getInstance().compiler.deleteBoard()}return null}var og=class extends pR{constructor(e){super();this.componentTask=new Array;this.blobTask=new Array;this.pcbDecode=e}async awaitPromise(){await Promise.all(this.componentTask),this.componentTask.length=0}async awaitBlobPromise(){await Promise.all(this.blobTask),this.blobTask.length=0}destory(){this.pcbDecode.clear(),this.pcbDecode=null,this.clientTool=null,this.componentTask.length=0,this.blobTask.length=0}setClientTool(e){this.clientTool=e}deleteAll(e){let i=(this.pcbDecode instanceof ET?this.pcbDecode.getDecodeTool():this.pcbDecode).getDeletedIds();for(let n of i){let s=pc(n);if(!(s instanceof Li&&!s.getText())&&s){let a=s.getParent();if(a&&i.includes(a.globalIndex))continue;e(s.globalIndex),this.deleteOne(s)}}}deleteOne(e){let r=x.getInstance().compiler;e instanceof It?r.deleteVia(e.globalIndex):e instanceof Je?r.deletePad(e.globalIndex):e instanceof qr?r.deleteLine(e.globalIndex):e instanceof Oi?r.deleteArc(e.globalIndex):e instanceof ql?r.deleteImage(e.globalIndex):e instanceof bm?r.deleteObj(e.globalIndex):e instanceof Li?e.getText()?r.deleteAttr(e.globalIndex):r.deleteString(e.globalIndex):e instanceof Xy?r.deleteDimension(e.globalIndex):e instanceof vi?r.deleteComponent(e.globalIndex):e instanceof lr&&qI(e.globalIndex,e.type)}async setAll(e){await(this.pcbDecode instanceof ET?this.pcbDecode.getDecodeTool():this.pcbDecode).iterator(async i=>{if(!(e&&!e(i)))if(i instanceof w4)this.clientTool.setVia(i);else if(i instanceof M4)this.clientTool.setPad(i);else if(i instanceof uR)this.componentTask.length>0&&await this.awaitPromise(),this.clientTool.setPadNet(i);else if(i instanceof I4)this.clientTool.setLine(i);else if(i instanceof T4)this.clientTool.setArc(i);else if(i instanceof C8)this.clientTool.setPoly(i);else if(i instanceof aR)this.clientTool.setFill(i);else if(i instanceof S8)this.clientTool.setFPCFill(i);else if(i instanceof E8)this.clientTool.setRegion(i);else if(i instanceof lR)this.clientTool.setPartition(i);else if(i instanceof O8)this.clientTool.setPour(i);else if(i instanceof _8)this.clientTool.setImage(i);else if(i instanceof F8)this.blobTask.length>0&&await this.awaitBlobPromise(),this.clientTool.setObj(i);else if(i instanceof D8)this.clientTool.setTeardrop(i);else if(i instanceof y4)this.clientTool.setString(i);else if(i instanceof Yy){if(!this.clientTool.setAttrSync(i)){let s=this.clientTool.setAttr(i);this.componentTask.push(s),s.then(()=>{let a=this.componentTask.indexOf(s);a>=0&&this.componentTask.splice(a,1)})}}else i instanceof R8?this.clientTool.setDimension(i):i instanceof x8?(this.componentTask.length>0&&await this.awaitPromise(),this.clientTool.setComponent(i)):i instanceof w8?this.clientTool.setSHell(i):i instanceof L8?this.clientTool.setSHellCut(i):i instanceof M8?this.clientTool.setShellEntity(i):i instanceof N8?this.clientTool.setCrease(i):i instanceof k8&&this.clientTool.setBoss(i)})}getDecode(){return this.pcbDecode}onBoard(e,r,i,n){this.pcbDecode.parse("BOARD",e,i)}onDelBoard(e,r,i){this.pcbDecode.delete("BOARD",null,r)}onLayerFill(e,r,i,n,s){n.id=e,this.pcbDecode.parse("INNER",n,i)}onDelLayerFill(e,r,i,n){this.pcbDecode.delete("INNER",e,i)}onBlob(e,r,i,n,s){this.pcbDecode.parse("BLOB",n,i,e)}onDelBlob(e,r,i,n){this.pcbDecode.delete("BLOB",e,i)}onFont(e,r,i,n){let s=$E.getUniqueId(i);this.pcbDecode.parse("FONT",i,r,s)}onDelFont(e,r,i,n){let s=$E.getUniqueId(e);this.pcbDecode.delete("FONT",s,i)}onString(e,r,i,n,s){this.pcbDecode.parse("STRING",s,n,e,r)}onDelString(e,r,i){this.pcbDecode.delete("STRING",e,i)}onAttr(e,r,i,n,s){this.pcbDecode.parse("ATTR",s,n,e,r)}onDelAttr(e,r,i){this.pcbDecode.delete("ATTR",e,i)}onPadNet(e,r,i){this.pcbDecode.parse("PAD_NET",i,r)}onDelPadNet(e,r,i,n,s){this.pcbDecode.delete("PAD_NET",e+"|"+r,s)}onComponent(e,r,i,n,s){this.pcbDecode.parse("COMPONENT",s,n,e,r)}onDelComponent(e,r,i){this.pcbDecode.delete("COMPONENT",e,i)}onPanelize(e,r,i){this.pcbDecode.parse("PANELIZE",i,r)}onDelPanelize(e,r){this.pcbDecode.delete("PANELIZE",null,r)}onRuleSelector(e,r,i){this.pcbDecode.parse("RULE_SELECTOR",i,r)}onDelRuleSelector(e,r,i){this.pcbDecode.delete("RULE_SELECTOR",e.toString(),i)}onRule(e,r,i){this.pcbDecode.parse("RULE",i,r)}onDelRule(e,r,i,n){this.pcbDecode.delete("RULE",[e,r].toString(),n)}onRuleTemplate(e,r,i){this.pcbDecode.parse("RULE_TEMPLATE",i,r)}onDimension(e,r,i,n,s){this.pcbDecode.parse("DIMENSION",s,n,e,r)}onDelDimension(e,r,i){this.pcbDecode.delete("DIMENSION",e,i)}onBoss(e,r,i,n,s){this.pcbDecode.parse("BOSS",s,n,e,r)}onDelBoss(e,r,i){this.pcbDecode.delete("BOSS",e,i)}onShellEntity(e,r,i,n,s){this.pcbDecode.parse("SHELL_ENTITY",s,n,e,r)}onDelShellEntity(e,r,i){this.pcbDecode.delete("SHELL_ENTITY",e,i)}onShellCut(e,r,i,n,s){this.pcbDecode.parse("SHELLCUT",s,n,e,r)}onDelShellCut(e,r,i){this.pcbDecode.delete("SHELLCUT",e,i)}onCrease(e,r,i,n,s){this.pcbDecode.parse("CREASE",s,n,e,r)}onDelCrease(e,r,i){this.pcbDecode.delete("CREASE",e,i)}onShell(e,r,i,n,s){this.pcbDecode.parse("SHELL",s,n,e,r)}onDelShell(e,r,i){this.pcbDecode.delete("SHELL",e,i)}onFpcFill(e,r,i,n,s){this.pcbDecode.parse("FPC_FILL",s,n,e,r)}onDelFpcFill(e,r,i){this.pcbDecode.delete("FPC_FILL",e,i)}onTeardrop(e,r,i,n,s){this.pcbDecode.parse("TEARDROP",s,n,e,r)}onDelTeardrop(e,r,i){this.pcbDecode.delete("TEARDROP",e,i)}onImage(e,r,i,n,s){this.pcbDecode.parse("IMAGE",s,n,e,r)}onDelImage(e,r,i){this.pcbDecode.delete("IMAGE",e,i)}onPoured(e,r,i,n,s){this.pcbDecode.parse("POURED",s,n,e,r)}onDelPoured(e,r,i){this.pcbDecode.delete("POURED",e,i)}onPour(e,r,i,n,s){this.pcbDecode.parse("POUR",s,n,e,r)}onDelPour(e,r,i){this.pcbDecode.delete("POUR",e,i)}onRegion(e,r,i,n,s){this.pcbDecode.parse("REGION",s,n,e,r)}onDelRegion(e,r,i){this.pcbDecode.delete("REGION",e,i)}onFill(e,r,i,n,s){this.pcbDecode.parse("FILL",s,n,e,r)}onDelFill(e,r,i){this.pcbDecode.delete("FILL",e,i)}onPoly(e,r,i,n,s){this.pcbDecode.parse("POLY",s,n,e,r)}onDelPoly(e,r,i){this.pcbDecode.delete("POLY",e,i)}onEQLenGrp(e,r,i,n){this.pcbDecode.parse("EQLEN_GRP",n,i,e)}onDelEQLenGrp(e,r,i){this.pcbDecode.delete("EQLEN_GRP",e,i)}onObj(e,r,i,n,s){this.pcbDecode.parse("OBJ",s,n,e,r)}onDelObj(e,r,i){this.pcbDecode.delete("OBJ",e,i)}onArc(e,r,i,n,s){this.pcbDecode.parse("ARC",s,n,e,r)}onDelArc(e,r,i){this.pcbDecode.delete("ARC",e,i)}onLine(e,r,i,n,s){this.pcbDecode.parse("LINE",s,n,e,r)}onDelLine(e,r,i){this.pcbDecode.delete("LINE",e,i)}onPad(e,r,i,n,s){this.pcbDecode.parse("PAD",s,n,e,r)}onDelPad(e,r,i){this.pcbDecode.delete("PAD",e,i)}onVia(e,r,i,n,s){this.pcbDecode.parse("VIA",s,n,e,r)}onDelVia(e,r,i){this.pcbDecode.delete("VIA",e,i)}onPreference(e,r,i){this.pcbDecode.parse("PREFERENCE",i,r)}onSilkOpts(e,r,i,n){n.layerId=e,this.pcbDecode.parse("SILK_OPTS",n,i)}onDelSilkOpts(e,r,i){this.pcbDecode.delete("SILK_OPTS",e,i)}onGroup(e,r,i,n){this.pcbDecode.parse("GROUP",n,i,e)}onDelGroup(e,r,i){this.pcbDecode.delete("GROUP",e,i)}onPrimitive(e,r,i,n){n.primitiveName=e,this.pcbDecode.parse("PRIMITIVE",n,i)}onDelPrimitive(e,r,i){this.pcbDecode.delete("PRIMITIVE",e,i)}onNet(e,r,i,n){n.netName=e,this.pcbDecode.parse("NET",n,i)}onDelNet(e,r,i){this.pcbDecode.delete("NET",e,i)}onPartition(e,r,i,n,s){this.pcbDecode.parse("PARTITION",s,n,e,r)}onDelPartition(e,r,i){this.pcbDecode.delete("PARTITION",e,i)}onActiveLayer(e,r,i){this.pcbDecode.parse("ACTIVE_LAYER",i,r)}onLayerPhys(e,r,i,n){n.layerId=e,this.pcbDecode.parse("LAYER_PHYS",n,i)}onDelLayerPhys(e,r,i){this.pcbDecode.delete("LAYER_PHYS",e,i)}onLayer(e,r,i,n){n.layerId=e,this.pcbDecode.parse("LAYER",n,i)}onDelLayer(e,r,i){this.pcbDecode.delete("LAYER",e,i)}onCanvas(e,r,i){this.pcbDecode.parse("CANVAS",i,r)}onDocDetail(e,r,i){}},iie=class extends og{onFont(t,e,r,i){let n=$E.getUniqueId(r);this.pcbDecode.parse2("FONT",r,e,n,void 0)}onDelFont(t,e,r,i){let n=$E.getUniqueId(t);this.pcbDecode.delete2("FONT",n,r)}onString(t,e,r,i,n){this.pcbDecode.parse2("STRING",n,i,t,e)}onDelString(t,e,r){this.pcbDecode.delete2("STRING",t,r)}onArc(t,e,r,i,n){this.pcbDecode.parse2("ARC",n,i,t,e)}onDelArc(t,e,r){this.pcbDecode.delete2("ARC",t,r)}onLine(t,e,r,i,n){this.pcbDecode.parse2("LINE",n,i,t,e)}onDelLine(t,e,r){this.pcbDecode.delete2("LINE",t,r)}};var G8=class o extends ys{constructor(t,e,r){super(),this._globalIndex=t,this.model=e,this._parent=r}get bbox(){return this.updateBox()}get _layerId(){return this._parent._layerId}get position(){return this._parent.position}get rotation(){return this._parent.rotation}get scaleX(){return this._parent.scaleX}get layerId(){return this._parent._layerId}set layerId(t){this._parent.layerId=t}getMatrix(){return Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position)}get start(){return this.model.start.multiply4(this.getMatrix())}set start(t){this.model.start=t}get end(){return this.model.end.multiply4(this.getMatrix())}set end(t){this.model.end=t}get width(){return this.model.width}set width(t){this.model.width=t}get direct(){return this.end.sub(this.start).normalize()}get length(){return this.model.length}set length(t){this.model.length=t}get primitive(){return new M(this.start,this.end)}get center(){return this.start.add(this.end).mul(.5)}get locked(){return this.model.locked}set locked(t){this.model.locked=t}equals(t){return t instanceof ys?this.layerId==t.layerId&&this.width==t.width&&this.start.equals1(t.start)&&this.end.equals1(t.end):!1}inShape(t,e,r){let i=this.getMatrix().inverse(),n=new S(t,e).multiply4(i);return this.model.inShape(n.x,n.y,r)}clone(...t){return new o(this._globalIndex,this.model,this._parent)}transform(t){}updateBox(){let t=this.getMatrix().toMatrix3();return this.model.primitive.multiply3(t).bbox().extendOfSize(this.width)}getMathGraphics(t=this.layerId,e=0){let r=this.model.getMathGraphics(t,e);return r!=null&&(r=r.multiply3(this.getMatrix().toMatrix3())),r}buildBBox(){return this.isEmpty?null:this.updateBox()}};var U8=class o extends nl{constructor(t,e,r){super(),this._globalIndex=t,this.model=e,this._parent=r}get _layerId(){return this._parent._layerId}get position(){return this._parent.position}get rotation(){return this._parent.rotation}get scaleX(){return this._parent.scaleX}get layerId(){return this._parent._layerId}set layerId(t){this._parent.layerId=t}getMatrix(){return Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position)}get center(){return this.model.center.multiply4(this.getMatrix())}set center(t){}get angle(){return this.model.angle}set angle(t){this.model.angle=t}get midPoint(){return this.model.midPoint.multiply4(this.getMatrix())}set midPoint(t){this.model.midPoint=t}get start(){return this.model.start.multiply4(this.getMatrix())}set start(t){this.model.start=t}get end(){return this.model.end.multiply4(this.getMatrix())}set end(t){this.model.end=t}get radius(){return this.model.radius}set radius(t){this.model.radius=t}get startAngle(){return this.scaleX<0?B1(Math.PI-(this.model.startAngle+this.rotation)):B1(this.model.startAngle+this.rotation)}set startAngle(t){this.model.startAngle=t}get endAngle(){return this.scaleX<0?B1(Math.PI-(this.model.endAngle+this.rotation)):B1(this.model.endAngle+this.rotation)}set endAngle(t){this.model.endAngle=t}get primitive(){return this.model.primitive.multiply3(this.getMatrix().toMatrix3())}get arcType(){return this.model.arcType}set arcType(t){}get width(){return this._parent.strokeWidth}set width(t){this._parent.strokeWidth=t}get sweepAngle(){return this.model.sweepAngle}get sweep(){return this.scaleX<0?this.model.sweep==le.CCW?le.CW:le.CCW:this.model.sweep}set sweep(t){}get length(){return this.model.length}set length(t){}get locked(){return this._parent.locked}set locked(t){this._parent.locked!=t&&(this._parent.locked=t)}get bbox(){return this.updateBox()}get isSegment(){return this.model.isSegment}getAngle(){return this.model.getAngle()}equals(t){return t instanceof nl?this.layerId==t.layerId&&this.width==t.width&&this.radius==t.radius&&this.startAngle==t.startAngle&&this.endAngle==t.endAngle&&this.sweep==t.sweep&&this.arcType==t.arcType&&this.center.equals1(t.center):!1}updateBox(){let t=this.getMatrix().toMatrix3();return this.model.primitive.multiply3(t).bbox().extendOfSize(this.width)}inShape(t,e,r){let i=this.getMatrix().inverse(),n=new S(t,e).multiply4(i);return this.model.inShape(n.x,n.y,r)}transform(t){}getMathGraphics(t=this.layerId,e=0){if(!this.isEmpty&&this.layerId==t){let r=this.model.getMathGraphics(this.width,e);if(r!=null){let i=this.getMatrix();return r.multiply3(i.toMatrix3())}}return null}clone(){return new o(this._globalIndex,this.model,this._parent)}buildBBox(){return this.isEmpty?null:this.updateBox()}};var nie=class o extends ss{constructor(e,r){super();this._parent=void 0;this._globalIndex=e,this._model=r,this._layerId=r.layerId,this.position=S.ORIGIN,this.rotation=0,this.scaleX=1,this._children=new Array(this.model.childrens.length);let i=0;for(let n of this.model.childrens){let s=new Array(n.length),a=0;for(let l of n)l instanceof ys?s[a]=new G8(l.globalIndex,l,this):l instanceof nl&&(s[a]=new U8(l.globalIndex,l,this)),a++;this._children[i]=s,i++}this._bbox=r.bbox}get number(){return this.model.number}set number(e){this._number=e}updateSimplyOutline(){this._model.updateSimplyOutline()}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=S.ORIGIN,this.rotation=0,this.scaleX=1,this._number=e.number}get isSimplify(){return this.model.isSimplify}set isSimplify(e){this.model.isSimplify=e}get childrens(){return p8(this._children)}set childrens(e){this._children=e}get outline(){return this.model.outline}refreshOutlineByChildren(){this.model.refreshOutlineByChildren()}refreshChildrenByOutline(e,r){return this.model.refreshChildrenByOutline(e,r)}getMatrix(){return Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position)}get lastIsClose(){return this.model.lastIsClose}iteratorChildren(e){return this.model.iteratorChildren(e)}clone(){let e=new o(this._globalIndex,this.model);return e.position=this.position,e.layerId=this.layerId,e.rotation=this.rotation,e.scaleX=this.scaleX,e}get type(){return this.model.type}set type(e){this.model.type=e}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this._layerId),this._layerId=e,this.layerModified=!0)}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}set net(e){this.model.net=e,this.netModified=!0}get showNet(){return this.model.net}get locked(){return this.model.locked}set locked(e){this.model.locked=this.locked}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get component(){return this.model.component}set component(e){this.model.component=e}addCopper(e){this.model.addCopper(e)}deleteCopper(e){this.model.deleteCopper(e)}iteratorCopper(e){this.model.iteratorCopper(e)}clearCopperData(){this.model.clearCopperData()}transform(e){let r=Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position).multiply4(e);this.position=new S(r.data[12],r.data[13]),this.scaleX=r.data[0]*r.data[5]-r.data[1]*r.data[4],r=r.scale(1/this.scaleX,1,1),this.rotation=Math.atan2(r.data[1],r.data[0]);for(let i of this._children)if(Array.isArray(i))for(let n of i)n.updateShapeData();else i.updateShapeData();this.updateShapeData()}get simplyPolyline(){if(this.model.isSimplify&&this.model.simplyPolyline){let e=Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position);return this.model.simplyPolyline.multiply3(e.toMatrix3())}else return null}isInside(e){e=e.multiply4(this.getMatrix().inverse());let r=this.outline;return r!=null?Jr.inPolygon(e,r instanceof Gt?r.items:[r]):!1}updateBox(){let e=Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position);if(this.isSimplify&&this.model.simplyPolyline)return this._bbox=this.model.simplyPolyline.multiply3(e.toMatrix3()).bbox(),this.bbox;let r=new _e;for(let i of this.childrens)for(let n of i){let s=n.buildBBox();s!=null&&r.ext1(s)}return this._bbox=r.build1(),this._bbox}getMathGraphics(e,r){let i=this.model.getMathGraphics(e,r);if(i!=null){let n=Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position);i=i.multiply3(n.toMatrix3())}return i}};var oie=class o extends Aa{constructor(e,r){super();this._parent=void 0;this.scaleX=1;this._globalIndex=e,this.model=r,this._layerId=r.layerId,this.position=r.start,this._rotation=r.rotation,this._number=r.number,this._bbox=r.bbox}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.start,this._rotation=e.rotation,this._number=e.number}get start(){return this.position}set start(e){this.position.equals(e)||(this.position=e,this.updateShapeData())}get width(){return this.model.width}set width(e){this.model.width=e}get height(){return this.model.height}set height(e){this.model.height=e}get rotation(){return this._rotation}set rotation(e){this._rotation!=e&&(this._rotation=e,this.updateShapeData())}get radius(){return this.model.radius}set radius(e){this.model.radius=e}clone(){let e=new o(this._globalIndex,this.model);return e.position=this.position,e.layerId=this.layerId,e.rotation=this.rotation,e.scaleX=this.scaleX,e}get type(){return this.model.type}set type(e){this.model.type=e}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this._layerId),this._layerId=e,this.layerModified=!0)}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}set net(e){this.model.net=e,this.netModified=!0}get showNet(){return this.model.net}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get component(){return this.model.component}set component(e){this.model.component=e}addCopper(e){this.model.addCopper(e)}deleteCopper(e){this.model.deleteCopper(e)}iteratorCopper(e){this.model.iteratorCopper(e)}clearCopperData(){this.model.clearCopperData()}};var sie=class o extends Po{constructor(e,r){super();this._parent=void 0;this.scaleX=1;this._globalIndex=e,this._model=r,this._layerId=r.layerId,this.position=r.center,this._number=r.number,this._bbox=r.bbox}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.center,this._number=e.number}get rotation(){return 0}set rotation(e){}get type(){return this.model.type}set type(e){this.model.type=e}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this._layerId),this._layerId=e,this.layerModified=!0)}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}set net(e){this.model.net=e,this.netModified=!0}get showNet(){return this.model.net}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get component(){return this.model.component}set component(e){this.model.component=e}addCopper(e){this.model.addCopper(e)}deleteCopper(e){this.model.deleteCopper(e)}iteratorCopper(e){this.model.iteratorCopper(e)}clearCopperData(){this.model.clearCopperData()}get center(){return this.position}set center(e){this.position.equals(e)||(this.position=e,this.updateShapeData())}get radius(){return this.model.radius}set radius(e){this.model.radius=e}clone(){let e=new o(this._globalIndex,this.model);return e.position=this.position,e.layerId=this.layerId,e.rotation=this.rotation,e.scaleX=this.scaleX,e}};var U4=class o extends It{constructor(e,r){super();this._parent=void 0;this.scaleX=1;this._globalIndex=e,this.model=r,this._layerId=r.layerId,this.position=r.center,this._net=r.net,this._number=r.number,this._bbox=r.bbox}reset4Model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.center,this._number=e.number,this._locked=void 0,this._viaExpansion=void 0,this._viaBaseInfo=void 0,this._unusedInnerLayers=void 0}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.center,this._number=e.number}get rotation(){return 0}get layerId(){return this._layerId}set layerId(e){}get center(){return this.position}set center(e){this.position.equals(e)||(this.position=e,this.updateShapeData())}get radius(){return this._viaBaseInfo?this._viaBaseInfo.radius:this.model.radius}set radius(e){this.radius!=e&&(this._viaBaseInfo=Ea.getViaBaseInfoByRadius(e,this.viaBaseInfo),this.updateShapeData(),this.radiusModified=!0)}get net(){var e;return((e=this._net)==null?void 0:e.toUpperCase())||""}set net(e){this._net!=e&&(this._parent!=null&&this._parent instanceof ki&&this._parent.modelType=="Component"&&this._parent.setNet(this.globalIndex,this.globalIndex,e),this._net=e,this.netModified=!0)}get showNet(){return this._net}get name(){return this.model.name}set name(e){this.model.name=e}get viaExpansion(){return this._viaExpansion||this.model.viaExpansion}set viaExpansion(e){this.viaExpansion!=e&&(this.checkExpansionModify(e),this._viaExpansion=e)}get holeRadius(){return this._viaBaseInfo?this._viaBaseInfo.holeRadius:this.model.holeRadius}set holeRadius(e){this.holeRadius!=e&&(this._viaBaseInfo=Ea.getViaBaseInfoByHoleRadius(e,this.viaBaseInfo),this.updateShapeData(),this.holeRadiusModified=!0)}get expansionType(){return this._viaExpansion?this._viaExpansion.expansionType:this.model.expansionType}set expansionType(e){this.expansionType!=e&&(this._viaExpansion=I0.getExpansionByexpansionType(e,this.viaExpansion))}get topExpansion(){return this._viaExpansion?this._viaExpansion.topExpansion:this.model.topExpansion}set topExpansion(e){this.topExpansion!=e&&(this._viaExpansion=I0.getExpansionByTopExpansion(e,this.viaExpansion),this.updateShapeData(),this.topExpansionModified=!0)}get bottomExpansion(){return this._viaExpansion?this._viaExpansion.bottomExpansion:this.model.bottomExpansion}set bottomExpansion(e){this.bottomExpansion!=e&&(this._viaExpansion=I0.getExpansionByBottomExpansion(e,this.viaExpansion),this.updateShapeData(),this.bottomExpansionModified=!0)}get locked(){return this._locked||this.model.locked}set locked(e){this._locked=e}get type(){return this.model.type}set type(e){this.model.type=e}get startLayer(){return this._viaBaseInfo?this._viaBaseInfo.startLayer:this.model.startLayer}get endLayer(){return this._viaBaseInfo?this._viaBaseInfo.endLayer:this.model.endLayer}get viaBaseInfo(){return this._viaBaseInfo||this.model.viaBaseInfo}set viaBaseInfo(e){this.viaBaseInfo!=e&&(this.checkBaseInfoModify(e),this._viaBaseInfo=e)}get bbox(){return this._bbox}get unusedInnerLayers(){return this._unusedInnerLayers||this.model.unusedInnerLayers}set unusedInnerLayers(e){this.unusedInnerLayers.toString()!=e.toString()&&(this._unusedInnerLayers=e,this.updateShapeData())}inOutline(e){let r=Math.max(this.radius,this.holeRadius);return M1(e,this.center,r)}transform(e){this.center=this.center.multiply4(e)}isUnuseLayer(e){let r=1<<e-15;return(NE.compress(this.unusedInnerLayers)&r)!==0}getOneInnerInUse(){for(let e=15;e<=46;e++)if(!this.isUnuseLayer(e))return e;return null}inShape(e,r){return this.inOutline(new S(e,r))}getMathGraphics(e=this.layerId,r=0){if(this.isEmpty||this.isUnuseLayer(e))return null;if(e==12||e===47)return fe.build2([q.build3(this.center,0,-360,this.holeRadius,this.holeRadius)]);if([5,6].includes(e)){let i=e==5?this.topExpansion:this.bottomExpansion,n=this.radius+i;return n<=0?null:fe.build2([q.build3(this.center,0,-360,n,n)])}else return fe.build2([q.build3(this.center,0,-360,this.radius+r,this.radius+r)])}getFileGraphics(e,r,i){if(this.isEmpty)return null;if(gr(e)){let n=[];if(i==null){let s=this.getOneInnerInUse();s==null?i=[]:i=[s]}for(let s of i){let a=this.getMathGraphics(s,r);a!=null&&n.push(a)}return n}else{let n=this.getMathGraphics(e,r);return n!=null?[n]:null}}isContains(e){return Ub(e,this.type,this.startLayer,this.endLayer)}isSeparated(e){return!this.isContains(e.startLayer)&&!this.isContains(e.endLayer)&&!e.isContains(this.startLayer)&&!e.isContains(this.endLayer)}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}updateBox(){return this._bbox=wY(this.radius,this.center,this.holeRadius,this.topExpansion,this.bottomExpansion),this._bbox}multiply3(e){let r=e.toMatrix3(),i=this.getMathGraphics();return i!=null?i.multiply3(r):null}clone(){let e=new o(this._globalIndex,this.model);return e.position=this.position,e.layerId=this.layerId,e.scaleX=this.scaleX,e}checkBaseInfoModify(e){this.viaBaseInfo.radius!=e.radius&&(this.radiusModified=!0,this.updateShapeData()),this.viaBaseInfo.holeRadius!=e.holeRadius&&(this.holeRadiusModified=!0,this.updateShapeData())}checkExpansionModify(e){this.viaExpansion.topExpansion!=e.topExpansion&&(this.topExpansionModified=!0,this.updateShapeData()),this.viaExpansion.bottomExpansion!=e.bottomExpansion&&(this.topExpansionModified=!0,this.updateShapeData())}};var aie=class o extends ql{constructor(e,r){super();this._parent=void 0;this.scaleX=1;this._globalIndex=e,this.model=r,this._layerId=r.layerId,this.position=r.start,this._rotation=r.rotation,this._number=r.number}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.start,this._rotation=e.rotation,this._number=e.number}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get template(){return this.model.template}set template(e){this.model.template=e,this.templateModified=!0}get box(){let e=this.model.box.clone();e.layerId=this._layerId;let{width:r,height:i,matrix:n}=this;return e.leftUp=S.ORIGIN.multiply4(n),e.leftLow=new S(0,-i).multiply4(n),e.rightLow=new S(r,-i).multiply4(n),e.rightUp=new S(r,0).multiply4(n),e}set box(e){}getViewMatrix(){let e=new _e;this.template.forEach(l=>{e.ext1(l.bbox())});let r=e.build1(),i=Ae.translate(-r.UL().x,-r.UL().y,0),n=r.height(),s=r.width(),a=Ae.scale(this.width/s,this.height/n,1);return i.multiply4(a).multiply4(this.matrix)}getRealPath(){let e=this.getViewMatrix().toMatrix3();return this.template.map(r=>r.multiply3(e))}getPath(){let e=this.getViewMatrix(),r=this.getTemplatePath();return r.forEach(i=>{i.pl=i.pl.multiply3(e.toMatrix3())}),r}getPathByTemplatePath(e){let r=this.getViewMatrix(),i=e;return i=i.map(n=>n.clone()),i.forEach(n=>{n.pl=n.pl.multiply3(r.toMatrix3())}),i}getTemplatePath(){let e=this.template.map(n=>n.clone());return new pm("",0,e).pls}get matrix(){let e=xc(this.layerId,this.mirror);return Ae.rotateZ(this.rotation).scale(e?-1:1,1,1).translate1(this.start.x,this.start.y,0)}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this.layerId),this._layerId=e,this.layerModified=!0)}get start(){return this.position}set start(e){this.position!=e&&(this.position=e,this.reset4Matrix(this.matrix))}get width(){return this.model.width}set width(e){}get height(){return this.model.height}set height(e){}get rotation(){return this._rotation}set rotation(e){this._rotation!=e&&(this._rotation=e,this.updateShapeData())}get mirror(){return this.model.mirror}set mirror(e){this.model.mirror=e}get center(){return this.model.center.multiply4(this.matrix)}set center(e){let r=e.sub(this.center),i=Ae.translate(r.x,r.y,0);this.transform(i)}get bbox(){return this.box.bbox}get locked(){return this.model.locked}set locked(e){}transform(e){let r=new S(e.data[0],e.data[1]).normalize(),i=Math.atan2(r.y,r.x);xc(this.layerId,this.mirror)?this._rotation-=i:this._rotation+=i,this.position=this.position.multiply4(e),this.updateShapeData()}inShape(e,r,i){let n=this.matrix.inverse(),s=new S(e,r).multiply4(n);return this.model.inShape(s.x,s.y,i)}reset4Matrix(e){}reset4(e,r,i){}updateBox(){let{width:e,height:r}=this,i=this.matrix,n=new S(0,0).multiply4(i),s=new S(0,-r).multiply4(i),a=new S(e,-r).multiply4(i),l=new S(e,0).multiply4(i),c=new _e().ext2(s).ext2(n).ext2(a).ext2(l);return this._bbox=c.build(),this._bbox}getMathGraphics(e=this.layerId,r){let i=this.model.getMathGraphics(e,r);return i==null?null:i.multiply3(this.matrix.toMatrix3())}clone(){let e=new o(this._globalIndex,this.model);return e.position=this.position,e.rotation=this.rotation,e.scaleX=this.scaleX,e}getPathBytemplatePath(e){let r=this.getViewMatrix(),i=e;return i=i.map(n=>n.clone()),i.forEach(n=>{n.pl=n.pl.multiply3(r.toMatrix3())}),i}};var lie=class o extends bm{constructor(e,r){super();this._parent=void 0;this._globalIndex=e,this._model=r,this._layerId=r.layerId,this.position=r.start,this.scaleX=1,this._rotation=r.rotation,this._number=r.number}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.start,this._rotation=e.rotation,this._number=e.number}get layerId(){return this._layerId}set layer(e){this.layerId!=e&&(this.watchLayerIdModify(this.layerId),this.layerModified=!0)}get start(){return this.position}set start(e){this.position=e,this.updateShapeData()}get width(){return this.model.width}set width(e){this.model.width=e}get height(){return this.model.height}set height(e){this.model.height=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e,this.updateShapeData()}get hashId(){return this.model.hashId}set hashId(e){this.model.hashId=e}get mirror(){return this.model.mirror}set mirror(e){this.model.mirror=e}get center(){return this.model.center.multiply4(this.matrix)}set center(e){let r=e.sub(this.center),i=Ae.translate(r.x,r.y,0);this.transform(i)}get bbox(){return this.box.bbox}get locked(){return this.model.locked}set locked(e){this.model.locked=e}transform(e){let r=new S(e.data[0],e.data[1]).normalize(),i=Math.atan2(r.y,r.x);xc(this.layerId,this.mirror)?this._rotation-=i:this._rotation+=i,this.position=this.position.multiply4(e),this.updateShapeData()}inShape(e,r,i){let n=this.matrix.inverse(),s=new S(e,r).multiply4(n);return this.model.inShape(s.x,s.y,i)}reset4Matrix(e){}reset4(e,r,i){}updateBox(){let{width:e,height:r}=this,i=this.matrix,n=new S(0,0).multiply4(i),s=new S(0,-r).multiply4(i),a=new S(e,-r).multiply4(i),l=new S(e,0).multiply4(i),c=new _e().ext2(s).ext2(n).ext2(a).ext2(l);return this._bbox=c.build(),this._bbox}getMathGraphics(e=this.layerId,r){let i=this.model.getMathGraphics(e,r);return i==null?null:i.multiply3(this.matrix.toMatrix3())}needMirror(){return xc(this.layerId,this.mirror)}get matrix(){let e=xc(this.layerId,this.mirror);return Ae.rotateZ(this.rotation).scale(e?-1:1,1,1).translate1(this.start.x,this.start.y,0)}get box(){let e=this.model.box.clone();e.layerId=this._layerId;let{width:r,height:i,matrix:n}=this;return e.leftUp=S.ORIGIN.multiply4(n),e.leftLow=new S(0,-i).multiply4(n),e.rightLow=new S(r,-i).multiply4(n),e.rightUp=new S(r,0).multiply4(n),e}set box(e){}clone(){let e=new o(this._globalIndex,this.model);return e.position=this.position,e._layerId=this._layerId,e._rotation=this._rotation,e.scaleX=this.scaleX,e}};var H8=class o extends Li{constructor(e,r){super();this._parent=void 0;this._globalIndex=e,this._model=r,this._layerId=r.layerId,this._position=r.position,this._rotation=r.rotation,this._origin=r.origin,this._number=r.number}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this._position=e.position,this._rotation=e.rotation,this._origin=e.origin,this._number=e.number}get scaleX(){return 1}get positionIsNull(){return this.model.positionIsNull}set positionIsNull(e){this.model.positionIsNull!=e&&(this.model.positionIsNull=e)}get box(){let e=this.model.box.clone();e.layerId=this._layerId;let{width:r,height:i}=this,n=this.getMatrix(r,i),s=new S(n.data[12],n.data[13]);return e.leftLow=s,e.leftUp=new S(0,i).multiply4(n),e.rightLow=new S(r,0).multiply4(n),e.rightUp=new S(r,i).multiply4(n),e}set box(e){}get bbox(){return this.box.bbox}get matrix(){let e=xc(this._layerId,this.mirror),r=UE(this._origin),i=new S(r.x*this.width,r.y*this.height),n=this._rotation;return Ae.getMatrix4(i,n,e?-1:1,this._position)}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this._layerId),this._layerId=e,this.updateShapeData(),this.layerModified=!0)}get type(){return this.model.type}set type(e){this.model.type!=e&&(this.model.type=e,this.model.updateShapeData())}get position(){return this._position}set position(e){this._position.equals(e)||(this._position=e,this.updateShapeData())}get rotation(){return this._rotation}set rotation(e){Math.abs(this.rotation-e)<1e-8||this._rotation!=e&&(this._rotation=e,this.updateShapeData())}get origin(){return this._origin}set origin(e){this._origin!=e&&(this._origin=e,this.updateShapeData())}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e}get mirror(){return this.model.mirror}set mirror(e){this.model.mirror=e}get width(){return this.model.width}get height(){return this.model.height}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get outline(){return this.model.outline}set outline(e){this.model.outline!=e&&(this.model.outline=e,this.outlineModified=!0)}get key(){return this.model.key}set key(e){this.model.key=e}get showKey(){return this.model.showKey}set showKey(e){this.model.showKey=e}get value(){return this.model.value}set value(e){this.model.value=e}get showValue(){return this.model.showValue}set showValue(e){this.model.showValue=e}get fontFamily(){return this.model.fontFamily}set fontFamily(e){this.model.fontFamily=e}get fontSize(){return this.model.fontSize}set fontSize(e){this.model.fontSize=e}get reverse(){return this.model.reverse}set reverse(e){this.model.reverse=e}get reverseExpansion(){return this.model.reverseExpansion}set reverseExpansion(e){this.model.reverseExpansion=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}set matrixChange(e){this.model.matrixChange=e}get matrixChange(){return this.model.matrixChange}reset4Matrix(){this.model.reset4Matrix()}getMatrix(e=this.width,r=this.height){let i=xc(this.layerId,this.mirror),n=UE(this.origin),s=new S(n.x*e,n.y*r),a=this.rotation;return Ae.getMatrix4(s,a,i?-1:1,this.position)}updateBox4(e,r){this.model.updateBox4(e,r)}transform(e,r){if(!r){let n=new S(e.data[0],e.data[1]).normalize(),s=Math.atan2(n.y,n.x);xc(this.layerId,this.mirror)?this._rotation=this._rotation-s:this._rotation=this._rotation+s}let i=this._position.multiply4(e);this._position=i,this.updateShapeData()}inShape(e,r,i){this.reset4Matrix();let n=this.getMatrix().inverse(),s=new S(e,r).multiply4(n);return this.model.inShape(s.x,s.y,i)}reset4(e,r,i){}updateBox(){this.reset4Matrix();let{width:e,height:r}=this,i=this.getMatrix(e,r),n=new S(0,0).multiply4(i),s=new S(0,r).multiply4(i),a=new S(e,0).multiply4(i),l=new S(e,r).multiply4(i),c=new _e().ext2(n).ext2(s).ext2(a).ext2(l);return this._bbox=c.build(),this._bbox}getMathGraphics(e=this.layerId,r=0){if(this.reset4Matrix(),this.isEmpty)return null;let i=this.box.getMathGraphics(e,r);return i==null?null:i.multiply3(this.getMatrix().toMatrix3())}getRealOutline(){let e=this.matrix,r=this.outline;if(this.type==1){let i=Ere(this);return i.forEach(n=>{n.pl=n.pl.multiply3(e.toMatrix3())}),i}else return r.map(i=>i.multiply3(e.toMatrix3()))}getTextOutline(){let e=this.matrix,r=this.outline;return this.type==1?(r=r.map(i=>i.multiply3(e.toMatrix3())),r):r.map(i=>i.multiply3(e.toMatrix3()))}getText(){return this.model.getText()}clone(){this.reset4Matrix();let e=new o(this._globalIndex,this.model);return e.position=this.position,e.layerId=this.layerId,e.rotation=this.rotation,e}};var H4=class{};H4.isRender4GPU=!1;function fR(o,t){return o?o.has(t):!1}function Ug(o,t,e,r){return o?fR(o,t)?o.get(t):(r&&o.set(t,e),e):e}function mR(o,t,e,r=!0){return!o||!r&&fR(o,t)||o.get(t)===e?!1:(o.set(t,e),!0)}function UA(o,t){if(!o)return!1;for(let[e,r]of o)if(t(r,e,o))return!0;return!1}function QCe(o){let t=[];return UA(o,(e,r)=>{t.push(r)}),t}var c3t=["LAYER_PHYS","ACTIVE_LAYER","NET","PRIMITIVE","GROUP","FONT"],Hg={},XI=class{constructor(t,e,r=""){this.projectId="";this._id=void 0;this._utime=void 0;this._childs=new Set;this.components=new Set;this.attrDataMap=new Map;this.layers=[];this._bbox=null;this._layeredBoxMap=null;this.items=new Map;this._isSMT=null;this.isNew=!1;this._uuid=t,this.projectId=r,this._origin=S.ORIGIN,this.instance=new OS(this.uuid,this.projectId,e)}get id(){return this._id}set id(t){this._id=t}async destroy(){this.instance!=null&&(await this.instance.destroy(),this.instance=null)}getInstance(){return this.instance}getModelBy(t,e){return this.items.get(e)}getItems(){return this.items}get isSMT(){if(this._isSMT==null){this._isSMT=!0;for(let[,t]of this.items)if(t.modelType=="Pad"&&t.layerId==12){this._isSMT=!1;break}}return this._isSMT}getId(t,e){for(;;){let r="e"+t;if(e.has(r))t++;else return t}}getBBox(){return this._bbox.transform4(Ae.translate(-this._origin.x,-this._origin.y,0))}getLayeredBoxMap(){return this._layeredBoxMap}getPads(){let t=[];for(let[,e]of this.items)e.modelType=="Pad"&&t.push(e);return t}async parse(t,e){for(let[,s]of this.items)s.remove();this.items.clear();let r=new ng;if(r.ids=new Set,this.ignoreTypes(c3t,r),this.instance==null)throw new Error("this footprint is destory!!!");let i=this.instance;i.setHandle(new og(r)),e?await e(i):await i.init(!1,!1,t,void 0,x.getInstance().needNum),this.isNew=r.isNew;let n=i.getDocDetail();return this._id=n==null?void 0:n.title,this._utime=n==null?void 0:n.updateTime,this.attrHandle(r),this.layers=r.layer,r.preAdjust(),this.batchBuildItems(r),this.updateBBox(),c8.ins.add(this),r}updateLayer(t){let e=!1;for(let r=0;r<this.layers.length;r++)this.layers[r].layerId==t.layerId&&(this.layers[r]=t,e=!0);e||this.layers.push(t)}deleteLayer(t){for(let e=0;e<this.layers.length;e++)if(this.layers[e].layerId==t){this.layers.splice(e,1);break}}updateBBox(){let t=new _e,e={};for(let[,r]of this.items){if(r instanceof Li&&r.key!="")continue;t.ext1(r.updateBox());let i=e[r.layerId];if(i)i.ext1(r.updateBox());else{let n=new _e;n.ext1(r.updateBox()),e[r.layerId]=n}}t.valid()?this._bbox=t.build():this._bbox=S.ORIGIN.bbox(),this.recordLayeredBbox(e)}recordLayeredBbox(t){let e={},r=Ae.translate(-this._origin.x,-this._origin.y,0);for(let i in t){let n,s=t[i];s.valid()?n=s.build():n=S.ORIGIN.bbox(),e[i]=n.transform4(r)}this._layeredBoxMap=e}updateAttrDecode(t){t instanceof Yy&&this.attrDataMap.set(t.key,t)}deleteAttrDecode(t){this.attrDataMap.delete(t)}setHandle(t){this.instance!=null&&this.instance.setHandle(t)}attrHandle(t){let e=t.attr,r=!0,i=!0,n=new Map,s=new Array(0);e.forEach((h,u)=>{h.key=="Footprint"&&this._id!=null?(h.value=this._id,r=!1):h.key=="Designator"&&(i=!1),n.has(h.key)?s.unshift(u):(n.set(h.key,!0),this.attrDataMap.set(h.key,h))});for(let h of s)e.splice(h,1);let a=t.ids||new Set;t.ids=null;let l=0;if(r&&this._id!=null){l=this.getId(l,a);let h=new Yy;e.push(h),h.feed(uj("e"+l,"Footprint",this._id)),l++}if(i&&this._id!=null){l=this.getId(l,a);let h=new Yy;e.push(h),h.feed(uj("e"+l,"Designator",this._id))}let c=t.canvas[0];c&&(this._origin=c.origin)}addChild(t){this._childs.add(t)}getChilds(){return this._childs}getOrigin(){return this._origin}get origin(){return this._origin}set origin(t){this._origin=t}generate(t){let e=Ae.translate(-this._origin.x,-this._origin.y,0);for(let[,r]of this.items){let i=t.componentId+r.globalIndex;t.hasId(i)&&(i=t.getNoRepeatId(i));let n=this.clone(r,i);n.transform(e),t.addCloneItem(n)}return t}clone(t,e){let r=this.clone2Template(t);if(r.globalIndex=e,r.modelType=="Polygon"){let i=r.childrens;for(let n of i)for(let s of n)s.globalIndex=e+s.globalIndex}return zS(r),r}clone2Template(t){if(!H4.isRender4GPU)return t.clone(!0);switch(t.modelType){case"Pad":return new HS(t.globalIndex,t);case"Via":return new U4(t.globalIndex,t);case"Image":return new aie(t.globalIndex,t);case"Picture":return new lie(t.globalIndex,t);case"Polygon":return new nie(t.globalIndex,t);case"Rect":return new oie(t.globalIndex,t);case"Circle":return new sie(t.globalIndex,t);case"Text":return t.key!=""?t.clone(!0):new H8(t.globalIndex,t);default:return t.clone(!0)}}formatParseBuild(t,e){let r=Ae.translate(-this._origin.x,-this._origin.y,0),i=new Map;for(let n of e)i.set(n.key,n);for(let[,n]of this.items){let s=this.clone2Template(n);if(s.globalIndex=t.componentId+s.globalIndex,s.modelType=="Polygon"){let a=s.childrens;for(let l of a)for(let c of l)c.globalIndex=t.componentId+c.globalIndex}else if(s.modelType=="Text"){let a=i.get(s.key);a!=null&&(s.globalIndex=a.index,t.hasId(s.globalIndex)&&(s.globalIndex=t.getNoRepeatId(s.globalIndex)),s.silkColor=a.specialColor)}t.resultNeedToBeCached&&zS(s),s.transform(r),t.addCloneItem(s)}return i.clear(),t}buildItems(t){for(let e of t){e.resultNeedToBeCached=!1;let r=e.finish();r instanceof ki&&this.items.set(r.globalIndex,r)}}addItem(t){this.items.set(t.globalIndex,t),this.updateBBox()}deleteItem(t){this.items.delete(t.globalIndex),this.updateBBox()}refershBBox(){this.updateBBox();for(let t of this.components)t.initBox()}copy(t){let e=Ae.translate(-this._origin.x,-this._origin.y,0);for(let[,r]of this.items){if(r.modelType=="Text"&&r.key!="")continue;let i=this.clone2Template(r);if(i.globalIndex=t.componentId+i.globalIndex,t.hasId(i.globalIndex)&&(i.globalIndex=t.getNoRepeatId(i.globalIndex)),i.modelType=="Polygon"){let n=i.childrens;for(let s of n)for(let a of s)a.globalIndex=t.componentId+a.globalIndex}zS(i),i.transform(e),t.addCloneItem(i)}return t}ignoreTypes(t,e){for(let r of t)e.addIgnoreType(r)}batchBuildItems(t){this.buildItems(t.layer),this.buildItems(t.via),this.buildItems(t.pad),this.buildItems(t.line),this.buildItems(t.arc),this.buildItems(t.poly),this.buildItems(t.fill),this.buildItems(t.fpcFill),this.buildItems(t.region),this.buildItems(t.pour),this.buildItems(t.image),this.buildItems(t.objs),this.buildItems(t.tearDrop),this.buildItems(t.str),this.buildItems(t.dimension),this.buildItems(t.attr);for(let e of this.items)e instanceof lr&&e.type=="TearDrop"&&(e.type="Fill Region",e.component=void 0)}getNewNum(t,e){if(["1","2"].includes(e)){let r=this.getNum(t,e),i=this.getName(t);return wy(Hg,i[0]).push(r),i[0]+r}else return t}getName(t){let e=t.replace(/[?\d\？]+$/,""),r=t.replace(e,"");return[e,r]}getMax(t,e){if(t.length==0)return 1;if(e==="1"){let r=t[0];for(let i of t)i>r&&(r=i);return++r}else if(e==="2"){let r=1;for(;t.includes(r);)r++;return r}}getUniqueVluesIngoreCase(t){let e=[],r=t.toLocaleUpperCase();for(let i in Hg)(typeof i=="string"?i.toLocaleUpperCase():i)===r&&e.push(...Hg[i]);return e}getNum(t,e){let[r,i]=this.getName(t),n=this.getUniqueVluesIngoreCase(r);if(n==null)return n=new Array,Hg[r]=n,i!=""&&i!="?"&&i!="\uFF1F"?parseInt(i):1;if(i!=""&&i!="?"&&i!="\uFF1F"){let s=parseInt(i);return this.getMax(n,e)}else return this.getMax(n,e)}get uuid(){return this._uuid}get footprintId(){return this._id}get updateTime(){return this._utime}add(t){this.components.add(t)}delete(t){if(t instanceof vi){let e=t.name;if(e){let r=this.getName(e),i=parseInt(r[1]);if(Hg[r[0]]!=null&&!isNaN(i)){let n=Hg[r[0]].indexOf(i);n>=0&&Hg[r[0]].splice(n,1)}}this.components.delete(t)}}modifyId(t){this.components.delete(t)}modifyName(t,e){let r=this.getName(t),i=parseInt(r[1]);if(Hg[r[0]]!=null&&!isNaN(i)){let a=Hg[r[0]].indexOf(i);a>-1&&Hg[r[0]].splice(a,1)}let n,s;t==e?(n=r,s=i):(n=this.getName(e),s=parseInt(n[1])),isNaN(s)||(Hg[n[0]]==null&&(Hg[n[0]]=new Array),Hg[n[0]].indexOf(s)<0&&Hg[n[0]].push(s),e=n[0]+s)}addName(t){let e=this.getName(t);Hg[e[0]]==null&&(Hg[e[0]]=[]);let r=parseInt(e[1]);!isNaN(r)&&!Hg[e[0]].includes(r)&&Hg[e[0]].push(r)}getModel(){return null}getComponents(){let t=new Array;return this.components.forEach(e=>{t.push(e)}),t}has(t){return this.attrDataMap.has(t)}checkKeyValue(t,e){if(this.has(t)){let r=this.attrDataMap.get(t);return r!=null&&r.value==e}else return!1}getValue(t){let e=this.attrDataMap.get(t);return e!=null?e.value:null}restoreAttr(t,e){let{componentPosition:r,angle:i,componentLayerId:n}=e,s=this.attrDataMap.get(t.key);return s!=null&&this.restore(t,s,{componentPosition:r,rotation:i,componentLayerId:n}),t}needSave(t,e,r,i,n){let s=.01,a=this.attrDataMap.get(t.key);if(a!=null){let l=a.layerId;if(i!=l)return!0;let c=a.x-this._origin.x;if(Math.abs(xe(e.x,2)-c)>s)return!0;let h=a.y-this._origin.y;if(Math.abs(xe(e.y,2)-h)>s||(n!=null&&n!=t.value||n==null)&&t.value!=a.value&&a.value!=`<${t.key}>`||t.showKey!=a.showKey||t.showValue!=a.showValue||(a.fontFamily==""&&(a.fontFamily="default"),t.fontFamily!=a.fontFamily))return!0;let u=a.fontSize;if(Math.abs(xe(t.fontSize,2)-u)>s)return!0;let d=a.strokeWidth;if(t.fontFamily=="defalut"&&Math.abs(xe(t.strokeWidth,2)-d)>s||t.origin!=a.origin)return!0;let p=a.angle;if(Math.abs(p-r)>s||t.reverse!=a.reverse)return!0;let m=a.reverseExpansion;if(Math.abs(xe(t.reverseExpansion,2)-m)>s||t.mirror!=a.mirror||t.locked!=a.locked)return!0}return!1}restore(t,e,r){let{componentPosition:i,rotation:n,componentLayerId:s}=r,a=e.layerId,l=0,c=0;isNaN(a)||(t.layerId=s===1?3:s===2?4:a);let h=e.x;isNaN(h)||(l=h);let u=e.y;isNaN(u)||(c=u),t.value=e.value,t.showKey=e.showKey,t.showValue=e.showValue,t.fontFamily=e.fontFamily;let d=e.fontSize;isNaN(d)||(t.fontSize=Math.abs(d));let p=e.strokeWidth;isNaN(p)||(t.strokeWidth=p),t.origin=e.origin;let m=e.angle;isNaN(m)||(t.rotation=m+n);let g=e.reverseExpansion;isNaN(g)||(t.reverseExpansion=g),t.reverse=e.reverse,t.mirror=e.mirror,t.locked=e.locked,t.position=new S(l,c).sub(this._origin).add(i).rotate(i,n)}getSource(){return null}isEmpty(){return this.isNew}getFootprintLayerInfo(){let t={};return this.layers.forEach(e=>{t[e.layerId]={name:e.getName(),type:e.getType()}}),t}iterator(t){(Array.from(this.items.values())||[]).some((r,i)=>!t(r,i))}iterateModels(t){return UA(this.items,t)}getChildrenLayerIdSet(){let t=new Set;return this.iterateModels(e=>{t.add(e.layerId)}),t}getBasicLayerTable(t){t||(t=this.getChildrenLayerIdSet());let e={},r=this.layers,i=t.size,n=0;return Rc(r,s=>{let a=s.layerId;if(t.has(a)){let l=s.getType(),c=s.getName(),h={layerId:a,layerType:l,layerName:c};e[a]=h,n++}return n==i}),e}};var Xc=class extends XI{constructor(t,e,r=""){super(t,e,r)}get source(){return this._source}updateSource(t){this._source=t}async parse(t,e){var n;let r=await super.parse(t,e),i=(n=this.getInstance())==null?void 0:n.getDocDetail();return i&&(this._source=this.getProjectSource(i.source)),r}getProjectSource(t){return t?t.split("|")[0]:""}};var Pm=class Pm extends wi{constructor(){super();this.listener=null}static getInstance(e){e||(e=Pm.otherDecodingProjectId);let r;return e?(r=Pm.otherProjectManagerMap[e],r||(r=new Pm,Pm.otherProjectManagerMap[e]=r),r):(Pm.manager==null&&(Pm.manager=new Pm),r=Pm.manager,r)}static get curProjectUuid(){let e=this.otherDecodingProjectId;return e||(this._curProjectUuid||(this._curProjectUuid=x.getInstance().projectId),this._curProjectUuid)}static set curProjectUuid(e){this._curProjectUuid=e}static async clearOtherProjectManagerMap(){Pm.otherDecodingProjectId=void 0;for(let e in Pm.otherProjectManagerMap)await Pm.otherProjectManagerMap[e].clear(),delete Pm.otherProjectManagerMap[e]}bindListener(e){this.listener=e}async bindFootprintListener(e){this.listener!=null&&await this.listener.bindListener(e)}addFootPrint(e,r){this.map.set(e,r)}async add(e,r,i){let n=this.map.get(e);if(n==null){let s=new XI(e,r,Pm.curProjectUuid);try{await s.parse(i)}catch(a){console.log(a);return}return this.addFootPrint(e,s),await this.bindFootprintListener(s),s}return n}isCustomUuid(e){return e.indexOf("_")>-1}async addCustomFootprint(e,r,i){let n=this.map.get(e);if(n==null){let s=new Xc(e,r,Pm.curProjectUuid);try{await s.parse(i)}catch(l){console.log(l);return}if(s.getItems().size==0&&s.id==null){s.destroy();return}let a=await this.add(s.source,r);return a==null?console.log(`custom footprint ${e} not find Source footprint:${s.source}!!!`):a.addChild(s),this.map.set(e,s),this.addFootPrint(e,s),await this.bindFootprintListener(s),s}return n}async cloneFootprint(e,r,i){let n;if(e instanceof Xc){let s=x.getInstance().compiler,a=x.getInstance().compilerChannel;if(s instanceof Pu){let l=r||x.getInstance().id+"_"+cr();(await s.customFootprint(l,e.uuid)).success&&(n=await Pm.getInstance().addCustomFootprint(l,a,i))}}else{let s=x.getInstance().compiler;if(s instanceof Pu){let a=x.getInstance().compilerChannel,l=r||x.getInstance().id+"_"+cr();(await s.customFootprint(l,e.uuid)).success&&(n=await Pm.getInstance().addCustomFootprint(l,a,i))}}return n}getAllCustoms(){let e=this.getAllItem(),r=[];return e.forEach(i=>{i instanceof Xc&&r.push(i)}),r}getItem(e){if(e!=null)return this.map.get(e)}async clear(){var e;for(let[,r]of this.map)await((e=r.getInstance())==null?void 0:e.destroy());this.map.clear()}deleteComponent(e){if(e instanceof vi){let r=e.footprintUUID,i=this.map.get(r);i!=null&&i.delete(e)}}parseFootprintFile(e,r,i,n){let s=new Array;return s.push(["FOOTPRINT",e,{uuid:r,utime:i}]),n.forEach(a=>{let l=a[0];this.isSingleItem(l)&&(l=="POLY"&&(a[6]=Ore.rectToPolygon(a[6])),s.push(a))}),s.push(["END_FOOTPRINT"]),s}isSingleItem(e){switch(e){case"POUR":case"POLY":case"REGION":case"FILL":case"PAD":case"ARC":case"LINE":case"VIA":case"STRING":case"ATTR":case"DIMENSION":return!0}return!1}getLayerTableMapping(e){let r={};return Rc(e,i=>{let n=this.getItem(i);if(n){let s=n.getBasicLayerTable();FA(r,i,s)}}),r}};Pm.manager=null,Pm.otherProjectManagerMap={};var Wi=Pm;var h3t=new Set(["Name","Unique ID","3D Model","3D Model Title","3D Model Transform"]),HCe=6.75,vi=class o extends ki{constructor(e,r,i,n,s,a,l,c,h,u,d,p){super();this.modelType="Component";this.pads=new Array(0);this.others=new Array(0);this._attrsMap={};this.attrs={};this._globalIndex=e,this._position=i,this._rotation=n,this._textOffset=s;for(let m of h3t){let g=a[m];if(["3D Model","3D Model Title","3D Model Transform"].indexOf(m)>=0&&typeof g!="string"){a[m]=void 0;continue}g==null&&(a[m]="")}this._attrsMap=a,this._footprintUUID=u,this._deviceUUID=d,p!=null&&(this._silkColor=p),this.updateShapes(c),this.updateAttributes(l),h.layerId=r,this.box=h,c.length=0,l.length=0,jo("data/model/ComponentModel")}get attrsMapSource(){return this._attrsMap}get attrsMap(){return this._attrsMap}get reuseBlock(){return this._attrsMap["Reuse Block"]||""}set reuseBlock(e){this._attrsMap["Reuse Block"]=e.trim()}get combinationID(){return this._attrsMap["Group ID"]||""}set combinationID(e){this._attrsMap["Group ID"]=e.trim()}get channelID(){return this._attrsMap["Channel ID"]||""}set channelID(e){this._attrsMap["Channel ID"]=e.trim()}get deviceUUID(){return this._deviceUUID}get footprintUUID(){return this._footprintUUID}set footprintUUID(e){this._footprintUUID!=e&&(this._footprintUUID=e)}get numShape(){return this.attrs.Designator}set numShape(e){this.attrs.Designator=e,e.setParent(this)}get deviceShape(){return this.attrs.Device}set deviceShape(e){this.attrs.Device=e,e.setParent(this)}get idShape(){return this.attrs.Footprint}set idShape(e){this.attrs.Footprint=e,e.setParent(this)}get attributes(){return Object.values(this.attrs)}get attrKeyText(){return this.attrs}get attrKeyValue(){let e={};for(let r in this._attrsMap)r!="Reuse Block"&&r!="Channel ID"&&r!="Group ID"&&r!="Reuse Block"&&(e[r]=this._attrsMap[r]);return e}get layerId(){return this.box.layerId}set layerId(e){if(this.layerId!=e){this.watchLayerIdModify(this.layerId);for(let l of this.pads){let c=l.layerId;c==12?l.oppositeLayer():c==1?l.layerId=2:c==2&&(l.layerId=1)}let r=new Set;for(let l of this.others){let c=l.layerId;if(c!=null){let h=Mg(c);h===c&&l.modelType=="Text"&&r.add(l),l.layerId=h}}let i=Object.values(this.attrs);for(let l of i){let c=Mg(l.layerId);c===l.layerId&&r.add(l),l.layerId=c}let n=this.position,s=Ae.getMatrix4(n.mul(-1),0,-1,n);for(let l of this.pads)l.flip(s);for(let l of i)r.has(l)||(l.position=l.position.multiply4(s));for(let l of this.others)l instanceof Li?r.has(l)||(l.position=l.position.multiply4(s)):l instanceof ql?l.start=l.start.multiply4(s):l.transform(s);for(let l of r){let c=l.origin;if(c===4||c===5||c===6)l.position=l.position.multiply4(s);else{let h=1;(c===7||c===8||c===9)&&(h=-1);let u=l.mirror?(Math.PI-l.rotation)%yp:l.rotation,d=S.getVector2(u).mul(h),p=l.position.add(d.mul(l.box.width));l.position=p.multiply4(s)}l.rotation=Math.PI*2-l.rotation}r.clear(),i.length=0;let a=(Math.PI-this.rotation)%yp;this._rotation=a,this.box.layerId=e,this.box.transform(s),this.layerModified=!0,this.updateShapeData()}}flipShape(e){let r=new Set;if(e instanceof Je){let s=e.layerId;s==12?e.oppositeLayer():s==1?e.layerId=2:s==2&&(e.layerId=1)}else{let s=e.layerId;if(s!=null){let a=Mg(s);a===s&&e.modelType=="Text"&&r.add(e),e.layerId=a}}let i=this.position,n=Ae.getMatrix4(i.mul(-1),0,-1,i);if(e instanceof Je)e.flip(n);else if(r.has(e)){let s=e,a=s.origin;if(a===4||a===5||a===6)s.position=s.position.multiply4(n);else{let l=1;(a===7||a===8||a===9)&&(l=-1);let c=S.getVector2(s.rotation).mul(l),h=s.position.add(c.mul(s.box.width));s.position=h.multiply4(n)}s.rotation=Math.PI*2-s.rotation}else e instanceof Li?e.position=e.position.multiply4(n):e instanceof ql?e.start=e.start.multiply4(n):e.transform(n);r.clear(),this.updateShapeData()}get position(){return this._position}set position(e){if(e.x==this.position.x&&e.y==this.position.y)return;let r=e.sub(this.position),i=Ae.translate(r.x,r.y,0);this.transform(i)}get name(){return this._attrsMap.Designator}set name(e){this._attrsMap.Designator!=e&&(this._attrsMap.Designator=e,this.numShape.value=e)}get silkColor(){return this._silkColor}set silkColor(e){this._silkColor!=e&&(this._silkColor=e)}get footprintId(){return this._attrsMap.Footprint}set footprintId(e){this.idShape.value=e,this._attrsMap.Footprint=e}get device(){return this._attrsMap.Device}set device(e){this.deviceShape.value=e,this._attrsMap.Device=e}get designator(){return this._attrsMap.Designator}get addIntoBom(){return this._attrsMap["Add into BOM"]}get rotation(){return this._rotation}set rotation(e){if(this.rotation!=e){let r=e-this.rotation,i=this.position,n=Ae.translate(-i.x,-i.y,0).rotateZ(r).translate1(i.x,i.y,0);for(let a of this.pads)a.transform(n);let s=Object.values(this.attrs);for(let a of s)a.transform(n);for(let a of this.others)a.transform(n);this.box.transform(n),this.updateShapeData(),this._rotation=e}}get textOffset(){return this._textOffset}set textOffset(e){this._textOffset!=e&&(this._textOffset=e)}get bbox(){return this.box.bbox}get locked(){return this.box.locked}set locked(e){this.box.locked=e}getLayerIdReplacementTable(){return this.layerIdReplacementTable}setLayerIdReplacementTable(e,r,i){if(i){this.layerIdReplacementTable=e;return}let n=this.layerIdReplacementTable,s=jy(n),a=jy(e);if(s&&a)return;let l=b4(n),c=b4(e),{less:h,more:u,same:d}=Fb(l,c),p=new Map;this.iterateAllChildren(m=>{Ug(p,m.layerId,[],!0).push(m)}),Rc(h,m=>{let g=n[m];if(!g)return;let y=parseInt(m),b=Ug(p,g);Rc(b,P=>{P.layerId=y})}),Rc(u,m=>{let g=e[m];if(!g)return;let y=parseInt(m),b=Ug(p,y);Rc(b,P=>{P.layerId=g})}),Rc(d,m=>{let g=n[m];if(!g)return;let y=e[m];if(!y||g==y)return;let b=Ug(p,g);Rc(b,P=>{P.layerId=y})}),r&&gm(e,m=>{fR(p,m)||delete e[m]}),this.layerIdReplacementTable=e}updateReplacedLayerId(e){let r=this.layerIdReplacementTable;if(!e||!r)return!1;let i=e.layerId,n=r[i];return!n||n==i?!1:(e.layerId=n,!0)}updateAttributes(e){for(let r of e)this.attrs[r.key]=r,r.setParent(this)}updateShapes(e){for(let r of e)this.addCompositionItem(r)}initPadNet(){this.padNet=new Map;for(let e of this.pads){let{num:r,globalIndex:i,net:n}=e,s=this.padNet.get(r);s==null&&(s=new Map,this.padNet.set(r,s)),s.set(i,n)}for(let e of this.getVias()){let{globalIndex:r,net:i}=e,n=this.padNet.get(r);n==null&&(n=new Map,this.padNet.set(r,n)),n.set(r,i)}this.numMapNet==null&&(this.numMapNet=new Map)}setNet4Model(e){e.modelType=="Pad"?this.setNet(e.num,e.globalIndex,e.net):this.setNet(e.globalIndex,e.globalIndex,e.net)}setNet(e,r,i){var s;if(this.padNet==null)return;let n=this.padNet.get(e);n==null&&(n=new Map,this.padNet.set(e,n)),n.set(r,i),(s=this.numMapNet)==null||s.delete(e)}isCachePadNet(){return this.padNet!=null}getNet(e,r){var n,s;if(this.padNet==null)return"";let i=this.padNet.get(e);if(i==null)return((n=this.numMapNet)==null?void 0:n.get(e))||"";{let a=i.get(r);return a==null?((s=this.numMapNet)==null?void 0:s.get(e))||"":a}}deleteNet(e,r){var n;if(this.padNet==null)return;let i=this.padNet.get(e);if(i!=null){let s=i.get(r);i.delete(r),i.size==0&&s!=null&&(this.padNet.delete(e),(n=this.numMapNet)==null||n.set(e,s))}}getPads(){return this.pads}updatePads(e,r){this.updateReplacedLayerId(e),r=="add"&&(this.pads.push(e),this.setNet4Model(e),e.setParent(this)),r=="delete"&&(this.pads=this.pads.filter(i=>i!==e),this.deleteNet(e.num,e.globalIndex),e.setParent(void 0))}getVias(){let e=new Array;for(let r of this.others)r.modelType=="Via"&&e.push(r);return e}getItems(){let e=new Array;for(let r of this.pads)e.push(r);for(let r of this.others)e.push(r);return e}iterateItems(e){let r=Rc(this.pads,e);return r||Rc(this.others,e)}iterateAttrs(e){return gm(this.attrs,e)}iterateAllChildren(e){let r=this.iterateItems(e);return r||this.iterateAttrs(e)}getChildrenLayerIdSet(e,r){let i=new Set,n=this.layerIdReplacementTable,s=e?uVe(n):null;return this.iterateItems(a=>{let l=a.layerId;if(e){let c=Z2(s,l.toString());if(c&&c.length>0){Rc(c,h=>{i.add(+h)});return}}i.add(l)}),r||this.iterateAttrs(a=>{let l=a.layerId;if(e){let c=Z2(s,l.toString());if(c&&c.length>0){Rc(c,h=>{i.add(+h)});return}}i.add(l)}),i}getOutlines(){return this.others.filter(e=>e instanceof lr&&e.layerId==11)}getComponentShapes(){return this.others.filter(e=>e instanceof lr&&e.layerId==48)}getAttr(e){return typeof e<"u"?{[e]:this.attrs[e]}:this.attrs}flip(e,r){let i=r||this.position,{x:n,y:s}=i,{_x:a,_y:l,_z:c}=e?{_x:1,_y:-1,_z:1}:{_x:-1,_y:1,_z:1},h=Ae.translate(-n,-s,0).scale(a,l,c).translate1(n,s,0);for(let p of this.pads)p.flip(h);for(let p of this.attributes)if(!p.locked){let m=p.position.multiply4(h);p.position=m,p.mirror=!p.mirror,e&&(p.rotation=p.rotation+Math.PI)}for(let p of this.others)if(p instanceof Li){let m=p.position.multiply4(h);p.position=m,p.mirror=!p.mirror,e&&(p.rotation=p.rotation+Math.PI)}else p instanceof ql||p instanceof bm?(p.start=p.start.multiply4(h),p.mirror=!p.mirror,e&&(p.rotation=p.rotation+Math.PI)):p.transform(h);let u=Math.PI*2-this.rotation;e&&(u=u+Math.PI);let d=this.position.multiply4(h);this._rotation=u,this._position=d,this.box.transform(h),this.updateShapeData()}addAttribute(e){this.updateReplacedLayerId(e),this.attrs[e.key]=e;let r=/^=\{([^\}]+)\}/g;(e.key!=="Name"||e.key=="Name"&&!r.test(this._attrsMap[e.key]))&&(this._attrsMap[e.key]=e.value),e.setParent(this)}removeAttribute(e){delete this.attrs[e.key],delete this._attrsMap[e.key],e.setParent(void 0)}deleteModel(e){if(e instanceof Je){let r=this.pads.indexOf(e);r>=0&&(this.pads.splice(r,1),this.deleteNet(e.num,e.globalIndex))}else if(e instanceof Li&&e.key!="")delete this.attrs[e.key],delete this._attrsMap[e.key];else{let r=this.others.indexOf(e);r>=0&&(this.others.splice(r,1),e instanceof It&&this.deleteNet(e.globalIndex,e.globalIndex))}e.setParent(void 0)}getFormulaName(){let e=this._attrsMap.Name;if(!e||!e.startsWith("="))return e;e=e.slice(1);let r=/\{([^\}]+)\}/g,i=null,n=[];for(;i=r.exec(e);)n.push(i[1]);let s=this._attrsMap;s.ID=this.globalIndex;for(let a=0;a<n.length;a++){let l=n[a],c=`{${l}!}`;s[l]!=null&&(c=s[l]),e=e.replace(`{${l}}`,c)}return delete s.ID,e}multiply4(e,r=!1){for(let a of this.pads)a.transform(e);if(!r)for(let a of this.attributes)a.transform(e);for(let a of this.others)a.transform(e);let i=new S(e.data[0],e.data[1]).normalize(),n=Math.atan2(i.y,i.x);this.layerId==2?this._rotation=this.rotation+n:this._rotation=this.rotation+n;let s=this.position.multiply4(e);this._position=s,this.box.transform(e),this.updateShapeData()}transform(e){for(let a of this.pads)a.transform(e);for(let a of this.attributes)a.locked||a.transform(e);for(let a of this.others)a.transform(e);let r=new S(e.data[0],e.data[1]).normalize(),i=Math.atan2(r.y,r.x),n=(this.rotation+i)%yp,s=this.position.multiply4(e);this._rotation=n,this._position=s,this.box.transform(e),this.updateShapeData()}getAttrBBox(){let e=new _e,r=!1;for(let i in this.attrs){let n=this.attrs[i];(n.showKey&&n.key!==""||n.showValue&&n.value!=="")&&(r=!0,e.ext1(this.attrs[i].bbox))}if(r)return e.build1()}addATTRMap(e,r){this._attrsMap[e]=r}modifyATTRMap(e,r){this._attrsMap[e]=r}deleteATTRMap(e){delete this._attrsMap[e]}clearMap(){this._attrsMap={}}getNewTextPosition(){let e=this.box.leftLow,r=this.box.leftLow.sub(this.box.leftUp).normalize(),i=this.textOffset.length(),n=e.add(r.mul(i)),s=this.attributes.length,a=HCe+.5,l=.001;for(let c=1;c<s+1;c++){let h=e.add(r.mul(c*a)),u=!0;for(let d=0;d<s;d++){let p=this.attributes[d],m=h.add(r.mul(a-l)),g=h.sub(r.mul(a-l)),y=new _e;y.ext2(g).ext2(m);let b=y.build1();if(!p.positionIsNull&&b.isContains(p.position)){u=!1;break}}if(u){n=h;break}}return n.y>e.add(r.mul(i)).y&&(i+=-a),this.textOffset=new S(this.textOffset.x,i+a),n}resetAttr(e){e&&e.key!=""&&(e.showValue||e.showKey)&&e.positionIsNull&&(e.origin!=3&&(e.origin=3),e.position=this.getNewTextPosition(),e.positionIsNull=!1,e.key==="Name"&&(e.value=e.value))}inShape(e,r){return this.box.inShape(e,r)}updateBox(){return this.box.updateBox()}getMathGraphics(e=this.layerId,r=0){return this.isEmpty?null:this.box.getMathGraphics(e,r)}clone(){let e={...this._attrsMap},r=new Array(this.attributes.length),i=0;for(let c of this.attributes)r[i]=c.clone(),i++;let n=this.getItems(),s=new Array(n.length);i=0;for(let c of n)s[i]=c.clone(),i++;let a=this.box.clone(),l=new o(this._globalIndex,this.layerId,this._position,this._rotation,this._textOffset,e,r,s,a,this._footprintUUID,this._deviceUUID,this._silkColor);return l.number=this.number,l.zIndex=this.zIndex,l}initBox(){let e=Wi.getInstance().getItem(this.footprintUUID);if(e==null)throw new Error("Footprint not exsit!!!");let r=this.layerId,i=this.position,n=e.getBBox();n==null&&(n=e.getOrigin().bbox());let s=r==2?-1:1,a=this.rotation;a=r==2?(Math.PI-a)%yp:a;let l=Ae.getMatrix4(S.ORIGIN,a,s,i);this.box.leftLow=n.LL(),this.box.leftUp=n.UL(),this.box.rightLow=n.LR(),this.box.rightUp=n.UR(),this.box.transform(l),this.box.updateBox(),this.refreshBBox=!0,this.watchBBoxModify()}addCompositionItem(e){this.updateReplacedLayerId(e),e.modelType==="Pad"?(this.pads.push(e),this.setNet4Model(e)):e.modelType==="Via"?(this.setNet4Model(e),this.others.push(e)):this.others.push(e),e.setParent(this)}removeCompositionItemById(e,r=!0){let i=-1,n=r?this.pads:this.others;for(let s=0;s<n.length;s++)if(n[s].globalIndex===e){i=s;break}i<=-1||n.splice(i,1)}buildBBox(){return this.isEmpty?null:(this.refreshBBox&&(this.updateBox(),this.refreshBBox=!1),this.bbox)}};var W4=class W4 extends wi{static getInstance(){return W4.manager==null&&(W4.manager=new W4),W4.manager}addModel(t){this.map.set(t.globalIndex,t)}add(t,e,r,i,n,s,a,l,c,h,u,d=null){return this._last=new vi(t,e,r,i,n,s,a,l,c,h,u,d),this.addModel(this._last),this._last}delete(t,e){t instanceof vi&&this.map.delete(e)}};W4.manager=null;var xs=W4;var HA=class o extends Xy{constructor(e,r,i,n,s,a,l,c,h,u,d,p,m=1.2,g=.8,y=3,b,P,T){super();this._lineLen=1.2;this._arrLineLen=.8;this._textOffset=3;let I=n.distance1(s),C=b||LA(I,c,d).toString()+d,{width:E,height:O,path:_}=Gd(C,h,u),R=RB(n,s,E,y),v=pT(ms(i)?-s.angle(n):s.angle(n)),D=ms(i)?9:3;T=T||new Ed(e,i,0,"",!1,C,!0,"default",h,v,R,D,u,!1,0,!1,!1,_,E,O,p),P==null&&(P=DB(n,s,a,l,u,T,m,g)),this._globalIndex=e,this.modelType=r,this._start=n,this._end=s,this._left=a,this._right=l,this._precision=c,this._lineLen=m,this._arrLineLen=g,this._textOffset=y,this._bbox=P,this._unit=d,this.text=T}get refreshBBox(){return this.text.refreshBBox}set refreshBBox(e){this.text.refreshBBox=e}get layerId(){return this.text.layerId}set layerId(e){this.text.layerId!=e&&(this.watchLayerIdModify(this.layerId),this.text.layerId=e,ms(e)&&this.text.origin!=9?this.text.origin=9:!ms(e)&&this.text.origin!=3&&(this.text.origin=3),this.updateText(),this.layerModified=!0)}get unit(){return this._unit}set unit(e){this._unit!=e&&(this._unit=e,this.updateText())}get textPosition(){return this.text.position}get strokeWidth(){return this.text.strokeWidth}set strokeWidth(e){this.text.strokeWidth!=e&&(this.text.strokeWidth=e,this.updateText())}get start(){return this._start}set start(e){this._start.equals(e)||(this._start=e,this.updateText())}get end(){return this._end}set end(e){this._end.equals(e)||(this._end=e,this.updateText())}get left(){return this._left}set left(e){this._left.equals(e)||(this._left=e,this.updateText())}get right(){return this._right}set right(e){this._right.equals(e)||(this._right=e,this.updateText())}get length(){return this.start.distance1(this.end)}set length(e){let i=this.end.sub(this.start).normalize().mul(e-this.length),n=Ae.translate(i.x,i.y,0);this.end=this.end.multiply4(n),this.right=this.right.multiply4(n)}get precision(){return this._precision}set precision(e){this._precision!=e&&(this._precision=e,this.updateText())}get fontSize(){return this.text.fontSize}set fontSize(e){this.text.fontSize!=e&&(this.text.fontSize=this.fontSize,this.updateText())}get content(){return LA(this.length,this.precision,this.unit).toString()+this._unit}get lineLen(){return this._lineLen}set lineLen(e){this._lineLen!=e&&(this._lineLen=e)}get arrLineLen(){return this._arrLineLen}set arrLineLen(e){this._arrLineLen!=e&&(this._arrLineLen=e)}get textOffset(){return this._textOffset}set textOffset(e){this._textOffset!=e&&(this._textOffset=e)}get bbox(){return this._bbox}updateText(){let{width:e,height:r,path:i}=Gd(this.content,this.fontSize,this.strokeWidth);this.text.outline=i,this.text.position=RB(this.start,this.end,e,this.textOffset);let n=ms(this.layerId);this.text.rotation=pT(n?-this.end.angle(this.start):this.end.angle(this.start)),this.text.updateBox4(e,r),this.updateShapeData()}transform(e){this.start=this.start.multiply4(e),this.end=this.end.multiply4(e),this.left=this.left.multiply4(e),this.right=this.right.multiply4(e),this.updateText()}inShape(e,r){let i=new S(e,r),n=kS(this.start,this.end,this.left,this.right,this.text.box.width,this.lineLen,this.arrLineLen);for(let s of n)if(Xa(i,s.start(),s.end(),this.strokeWidth))return!0;return this.text.inShape(e,r)}get locked(){return this.text.locked}set locked(e){this.text.locked=e}calibrateLine(e,r,i,n){let s,a,l;this.start.equals(this.end)?(r?s=this.vectorProjectOnPerpendicularLine(this.right.sub(this.left),e[0].sub(e[1])):s=this.vectorProjectOnPerpendicularLine(e[0].sub(e[3]),e[1].sub(e[0])),a=0):(s=this.end.sub(this.start),a=s.length());let c=s.normalize(),h=e[3].sub(e[2]).dot(c);switch(i?l=a+h:l=a-h,n){case 0:this.end=e[3].add(c.mul(l)),this.left=e[3].add(e[1].sub(e[0]));break;case 1:this.start=e[3].sub(c.mul(l)),this.right=e[3].add(e[1].sub(e[0]));break;case 2:this.start=e[1].sub(c.mul(l));break;case 3:this.end=e[1].add(c.mul(l));break}}vectorProjectOnPerpendicularLine(e,r){let i=r.rotate(new S(0,0),Math.PI/2).normalize(),n=e.angle(i);return Math.abs(n)>Math.PI/2&&(i=i.mul(-1)),i.mul(e.dot(i))}updateBox(){return this.text.buildBBox(),this._bbox=DB(this.start,this.end,this.left,this.right,this.strokeWidth,this.text,this.lineLen,this.arrLineLen),this._bbox}remove(){Oo.getInstance().textConfig.setCustomColor(this.text.globalIndex,null),super.remove()}clone(){let e=new o(this._globalIndex,this.modelType,this.layerId,this._start,this._end,this._left,this._right,this._precision,this.fontSize,this.strokeWidth,this._unit,this.locked,this._lineLen,this._arrLineLen,this._textOffset,this.text.value,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var z4=class z4 extends wi{static getInstance(){return z4.manager==null&&(z4.manager=new z4),z4.manager}addDimension(t,e,r,i,n,s,a,l,c,h,u){let d=new HA(t,"Smart Dimension",e,r,i,n,s,a,l,c,h,u);return this.map.set(t,d),d}copy(t){}delete(t){t instanceof HA&&this.map.delete(t.globalIndex)}};z4.manager=null;var gR=z4;function pc(o){let t=[An.getInstance(),$n.getInstance(),Tn.getInstance(),zi.getInstance(),Sl.getInstance(),rn.getInstance(),mo.getInstance(),Za.getInstance(),Ka.getInstance(),gR.getInstance(),xs.getInstance(),Mi.getInstance(),Qs.getInstance(),e0.getInstance(),Wo.getInstance(),Ho.getInstance()];for(let e of t){let r=e.getItem(o);if(r!=null)return r}return null}function SVe(){let o=[],t=[An.getInstance(),$n.getInstance(),Tn.getInstance()];for(let e of t)e.getAllItem().forEach(r=>o.push(r));return o}function zS(o){switch(o.modelType){case"Track":case"ArcTrack":{An.getInstance().addModel(o);break}case"Pad":{$n.getInstance().addModel(o);break}case"Via":{Tn.getInstance().addModel(o);break}case"Image":{Qs.getInstance().addModel(o);break}case"Picture":{e0.getInstance().addModel(o);break}case"Length Dimension":{Ka.getInstance().addModel(o);break}case"Protractor Dimension":{Za.getInstance().addModel(o);break}case"Radius Dimension":{Sl.getInstance().addModel(o);break}case"Polygon":{Mi.getInstance().addModel(o);break}case"Rect":{rn.getInstance().addModel(o);break}case"Circle":{zi.getInstance().addModel(o);break}case"Copper":{Wo.getInstance().addModel(o);break}case"Inner":{Ho.getInstance().addModel(o);break}case"Component":{let e=o;for(let r of e.getItems())zS(r);for(let r of e.attributes)zS(r);xs.getInstance().addModel(o);break}case"Text":{mo.getInstance().addModel(o);break}default:}}function WA(o,t){switch(o){case"Track":case"ArcTrack":return An.getInstance().getItem(t);case"Pad":return $n.getInstance().getItem(t);case"Via":return Tn.getInstance().getItem(t);case"Image":return Qs.getInstance().getItem(t);case"Picture":return e0.getInstance().getItem(t);case"Length Dimension":return Ka.getInstance().getItem(t);case"Protractor Dimension":return Za.getInstance().getItem(t);case"Radius Dimension":return Sl.getInstance().getItem(t);case"Polygon":return Mi.getInstance().getItem(t);case"Rect":return rn.getInstance().getItem(t);case"Circle":return zi.getInstance().getItem(t);case"Copper":return Wo.getInstance().getItem(t);case"Inner":return Ho.getInstance().getItem(t);case"Component":return xs.getInstance().getItem(t);case"Text":return mo.getInstance().getItem(t);default:return}}function Lj(o){let t=o[0],e=o[1];switch(t){case"NET_CLASS":return te.getInstance().getNetClass(e);case"DIFF_PAIR":return te.getInstance().getNetDifferential(e);case"EQ_LEN_GRP":return te.getInstance().getEqualLengthGroup(e);case"NET":return te.getInstance().getNet(e);case"POUR":case"REGION":return te.getInstance().getRegion(e);default:if(Array.isArray(t)&&Array.isArray(e))return te.getInstance().betweenNetRule.getRule(t[1],e[1])}}function EVe(o){let t=o[0],e=o[1];switch(t){case"NET_CLASS":te.getInstance().deleteNetClass(e);break;case"DIFF_PAIR":te.getInstance().deleteNetDifferential([e]);break;case"EQ_LEN_GRP":te.getInstance().deleteEqualLengthGroup(e);break;case"NET":te.getInstance().deleteNet(e);break;case"POUR":case"REGION":te.getInstance().deleteRegion(e);break;default:Array.isArray(t)&&Array.isArray(e)&&te.getInstance().betweenNetRule.deleteRule4(t[1],e[1]);break}}function OVe(o,t){switch(o){case"1":return te.getInstance().getSafeSpacing(t);case"2":return te.getInstance().getOtherSpacing(t);case"3":return te.getInstance().getTrackPhysics(t);case"11":return te.getInstance().getNetLengthPhysics(t);case"13":return te.getInstance().getNetLengthTolerancePhysics(t);case"10":return te.getInstance().getDifferentialPhysics(t);case"4":return te.getInstance().getBlindPhysics(t);case"5":return te.getInstance().getRadiusPhysics(t);case"6":return te.getInstance().getInnerPlane(t);case"7":return te.getInstance().getCopperPlane(t);case"8":return te.getInstance().getPasteExpansion(t);case"9":return te.getInstance().getSolderExpansion(t);case"12":return te.getInstance().getAutoRouter(t);case"14":return te.getInstance().getCreepageSpacing(t)}}function AVe(o,t){switch(o){case"1":te.getInstance().deleteSafeSpacing(t);case"2":te.getInstance().deleteOtherSpacing(t);case"3":te.getInstance().deleteTrackPhysics(t);case"11":te.getInstance().deleteNetLengthPhysics(t);case"13":te.getInstance().deleteNetLengthTolerancePhysics(t);case"10":te.getInstance().deleteDifferentialPhysics(t);case"4":te.getInstance().deleteBlindPhysics(t);case"5":te.getInstance().deleteRadiusPhysics(t);case"6":te.getInstance().deleteInnerPlane(t);case"7":te.getInstance().deleteCopperPlane(t);case"8":te.getInstance().deletePasteExpansion(t);case"9":te.getInstance().deleteSolderExpansion(t);case"12":te.getInstance().deleteAutoRouter(t);case"14":te.getInstance().deleteCreepageSpacing(t)}}function Mj(o){return rn.getInstance().getItem(o)||zi.getInstance().getItem(o)||Mi.getInstance().getItem(o)}var yR=class{constructor(t,e){this.junctions=new Array;this.id=e,this.junctions=t}};var gl=class o{constructor(t){this._id=null;this.point=t}hashCode(){return this.point.hashCode()}equals(t){return t instanceof o?this.point.equals(t.point):t instanceof S?this.point.equals(t):!1}bbox(){return this.point.bbox()}get id(){return this._id}set id(t){this._id=t}};var cie=class{constructor(t){this.node=t}bbox(){return this.node.bbox}},hie=class extends cie{constructor(t,e){super(t),this.point=e,this.box=e.bbox().extendOfSize(Math.min(t.width/2,.1))}bbox(){return this.box}},bR=class o{static getCluster(t,e){let r=new Array;if(t.size==1){for(let i of t)if(i instanceof Je||i instanceof It){let n=new gl(i.center);n.id=i.globalIndex}else if(i instanceof yt){let n=new gl(i.start);n.id=i.globalIndex;let s=new gl(i.end);s.id=i.globalIndex,r.push(n),r.push(s)}else if(i instanceof Po){let n=new S(i.center.x-i.radius,i.center.y),s=new gl(n);s.id=i.globalIndex,r.push(s)}else if(i instanceof Aa){let n=new gl(i.start);n.id=i.globalIndex,r.push(n)}else if(i instanceof ss){let n=new gl(i.start);if(n.id=i.globalIndex,r.push(n),i.type=="Line"&&!i.isClose()){let s=new gl(i.end);s.id=i.globalIndex,r.push(s)}}else if(i instanceof dc){let n=new gl(i.start);n.id=i.globalIndex,r.push(n)}}else{let i=new Array,n=new nn(10),s=new nn(10);for(let c of t)if(c instanceof yt){let h=new hie(c,c.start),u=new hie(c,c.end);n.add(h),n.add(u),i.push(h),i.push(u)}else if(c instanceof Je||c instanceof It){s.add(new cie(c));let h=new gl(c.center);h.id=c.globalIndex,r.push(h)}else if(c instanceof Po){let h=new S(c.center.x-c.radius,c.center.y),u=new gl(h);u.id=c.globalIndex,r.push(u)}else if(c instanceof Aa){let h=new gl(c.start);h.id=c.globalIndex,r.push(h)}else if(c instanceof ss){let h=new gl(c.start);if(h.id=c.globalIndex,r.push(h),c.type=="Line"&&!c.isClose()){let u=new gl(c.end);u.id=c.globalIndex,r.push(u)}}else if(c instanceof dc){let h=new gl(c.start);h.id=c.globalIndex,r.push(h)}let a=new Hd,l=new Set;for(let c of i){if(l.has(c))continue;let h=!1,u=Math.min(c.node.width/2,.1),d=n.search(c.point.bbox().extendOfSize(u));for(let p of d)if(!(c==p||c.node==p.node||!a.needCheckIntersection(c.node,p.node))&&!l.has(p)&&c.point.distance1(p.point)<=u){l.add(p),l.add(c),h=!0;break}if(!h){let p=s.search(c.bbox());for(let m of p){if(c==m||c.node==m.node||!a.needCheckIntersection(c.node,m.node))continue;if(m.node.inOutline(c.point)){l.add(c),h=!0;break}}}if(!h){let p=new gl(c.point);p.id=c.node.globalIndex,r.push(p)}}}if(r.length==0){let i=o.getDefault(t);i!=null&&r.push(i)}return new yR(r,e)}static getDefault(t){for(let e of t)if(e instanceof Je||e instanceof It){let r=new gl(e.center);return r.id=e.globalIndex,r}else if(e instanceof yt){let r=new gl(e.start);return r.id=e.globalIndex,r}else if(e instanceof Po){let r=new S(e.center.x-e.radius,e.center.y),i=new gl(r);return i.id=e.globalIndex,i}else if(e instanceof Aa){let r=new gl(e.start);return r.id=e.globalIndex,r}else if(e instanceof ss){let r=new gl(e.start);return r.id=e.globalIndex,r}else if(e instanceof dc){let r=new gl(e.start);return r.id=e.globalIndex,r}return null}};var Kb=class{constructor(t,e,r,i){this._length=null;this.cluster1=t,this.cluster2=e,this.left=r,this.right=i}get length2(){return this._length==null&&(this._length=this.left.point.distance2(this.right.point)),this._length}build(t){let e=this.left,r=this.right;return PT.getInstance().add("rat"+e.id+r.id,e.point,r.point,t,e.id,r.id)}};var PR=class{constructor(t,e){this.p0=t,this.p1=e}eqauls(t){return this.p0.x==t.p0.x&&this.p0.y==t.p0.y?this.p1.x==t.p1.x&&this.p1.y==t.p1.y:this.p1.x==t.p0.x&&this.p1.y==t.p0.y?this.p0.x==t.p1.x&&this.p0.y==t.p1.y:!1}get length2(){return this.p0.distance2(this.p1)}},die=class{constructor(t,e,r){this.p0=t,this.p1=e,this.p2=r}update(t,e,r){this.p0=t,this.p1=e,this.p2=r}get center(){let t=this.p1.sub(this.p0),e=this.p2.sub(this.p0),r=this.p1.distance2(S.ORIGIN)-this.p0.distance2(S.ORIGIN),i=this.p2.distance2(S.ORIGIN)-this.p0.distance2(S.ORIGIN),n=1/(2*t.cross(e)),s=(e.y*r+-t.y*i)*n,a=(-e.x*r+t.x*i)*n;return new S(s,a)}getRadius(t){return t.distance1(this.p0)}get edges(){return[new PR(this.p0,this.p1),new PR(this.p1,this.p2),new PR(this.p2,this.p0)]}},uie=50;function Nj(o,t,e=0){let r=uie*10**e,i=o.div(r),n=t/r,s=Math.floor(i.x-n),a=Math.floor(i.x+n),l=Math.floor(i.y-n),c=Math.floor(i.y+n);return a-s==1?c-l==1?[{x:a,y:c,level:e},{x:a,y:l,level:e},{x:s,y:c,level:e},{x:s,y:l,level:e}]:c==l?[{x:a,y:l,level:e},{x:s,y:l,level:e}]:Nj(o,t,e+1):c-l==1?a==s?[{x:a,y:c,level:e},{x:a,y:l,level:e}]:Nj(o,t,e+1):a==s&&c==l?[{x:a,y:l,level:e}]:Nj(o,t,e+1)}function kj(o,t,e,r){if(o==null||t==null)return 1;let i=o.distance1(t);return ne.lesseq(i+r,e)?-1:ne.lesseq(i+e,r)?2:ne.greater(i,e+r)?1:0}function _Ve(o,t,e,r){let i=kj(o,t,e,r);if(i==-1||t==null)return{center:o,r:e};if(i==2||o==null)return{center:t,r};let n=o.distance1(t),s=(n+e+r)/2,a=(s-e)/n;return{center:new S(o.x+a*(t.x-o.x),o.y+a*(t.y-o.y)),r:s}}var vVe=20,W8=class o{constructor(){this.childs=new Array;this.parent=null}insert(t){let e=this.childs;if(!(t instanceof o))for(let r=0;r<e.length;r++){let i=e[r];if(i instanceof o&&kj(i.center,t[1],i.radius,t[2])===-1){i.insert(t);return}}if(t instanceof o&&(t.parent=this),e.length<=vVe)if(e.push(t),this.center==null)this.center=t[1],this.radius=t[2];else{let r=_Ve(this.center,t[1],this.radius,t[2]);this.center=r.center,this.radius=r.r}else e.push(t),this.splitNode()}checkNode(){this.childs.length>0?(this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this.parent!==null?(this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):(this.center=null,this.radius=null)}remove(t){if(t instanceof o&&t.childs.length>0)throw new Error;let e=this.childs,r=new Array,{center:i,radius:n}=this.get(t);for(let s=0;s<e.length;s++){let a=e[s];if(a===t)return e.splice(s,1),e.length>0?(this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this.parent!==null?(this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):(this.center=null,this.radius=null),1;a instanceof o&&kj(a.center,i,a.radius,n)===-1&&r.push(a)}if(t instanceof o)throw new Error;for(let s of r){let a=s.remove(t);if(a===1)return this.childs.length>0&&this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox(),1;if(a!==0)throw new Error}return 0}recycle(){this.childs.length=0,this.center=null,this.radius=null}get(t){let e,r;return t instanceof o?(e=t.center,r=t.radius):(e=t[1],r=t[2]),{center:e,radius:r}}updateBBox(){let t,e;for(let r of this.childs){let i=this.get(r);if(t==null)t=i.center,e=i.radius;else{let n=_Ve(t,i.center,e,i.radius);t=n.center,e=n.r}}this.center=t,this.radius=e}splitNode(){let t=this.childs,e=t.length,r=-1,i=-1,n=Number.NEGATIVE_INFINITY;for(let c=0;c<e;c++){let h=this.get(t[c]);for(let u=c+1;u<e;u++){let d=this.get(t[u]),p=h.center.distance2(d.center);p>n&&(n=p,r=c,i=u)}}let s=this.asNode(t[r]),a=this.asNode(t[i]);for(let c=0;c<e;c++)if(c!==r&&c!==i){let h=this.get(t[c]),u=s.center.distance2(h.center),d=a.center.distance2(h.center);u<d?s.insert(t[c]):a.insert(t[c])}s.updateBBox(),a.updateBBox(),t.length=0;let l=this.parent;l!==null&&l.childs.length<vVe?(s.parent=l,a.parent=l,l.childs.push(s),l.childs.push(a),l.remove(this),l.updateBBox()):(s.parent=this,a.parent=this,t.push(s),t.push(a),this.updateBBox()),this.childs.length>0&&this.updateBBox()}asNode(t){if(t instanceof o)return t;{let e=new o;return e.insert(t),e}}},pie=class{constructor(){this.items=new Set;this.root=new W8}search(t,e,r){let i=[],n=[];if(this.items.size==0||this.root!=null&&kj(this.root.center,t,this.root.radius,e)==1)return i;n.push(this.root);let s=null,a=new Array;for(;s=n.shift(),s!==void 0;){for(let c=0,h=s.childs.length;c<h;c++){let u=s.childs[c],d=this.get(u),p=kj(d.center,t,d.radius,e);p!=1&&(u instanceof W8?p==2?this.add2Result(u,i,r):n.push(u):r(u)&&(i.push(u),a.push(c),this.items.delete(u)))}let l=a.length>0;for(;a.length>0;){let c=a.pop();s.childs.splice(c,1)}l&&s.checkNode()}return i}get(t){let e,r;return t instanceof W8?(e=t.center,r=t.radius):(e=t[1],r=t[2]),{center:e,radius:r}}add2Result(t,e,r){let i=[t];for(;;){let n=i.shift();if(n!==void 0)for(let s of n.childs)s instanceof W8?i.push(s):(!r||r(s))&&e.push(s);else break}}insert(t){this.items.add(t),this.root.insert(t)}remove(t){if(this.items.delete(t))return this.root.remove(t)}recycle(){this.items.clear(),this.root.recycle()}},fie=class{constructor(){this.grids=new Map;this.edges=new Array}search(t){var r;let e=new Set;for(let[i,n]of this.grids){let s=uie*10**i,a=t.div(s),l=Math.floor(a.x),c=Math.floor(a.y),h=(r=n.get(l))==null?void 0:r.get(c);if(h!=null)for(let u of h.search(t,0,d=>d[1].distance1(t)-d[2]<=1e-4))e.add(u)}return e}insertGrid(t){let[,e,r]=t,i=Nj(e,r);for(let{x:n,y:s,level:a}of i){let l=this.grids.get(a);l==null&&(l=new Map,this.grids.set(a,l));let c=l.get(n);c==null&&(c=new Map,l.set(n,c));let h=c.get(s);h==null&&(h=new pie,c.set(s,h)),h.insert(t)}}delete(t){let[,e,r]=t,i=Nj(e,r);if(i.length!=1)for(let{x:n,y:s,level:a}of i){let l=this.grids.get(a);l==null&&(l=new Map,this.grids.set(a,l));let c=l.get(n);c==null&&(c=new Map,l.set(n,c));let h=c.get(s);h==null&&(h=new pie,c.set(s,h)),h.remove(t)}}triangulate(t){if(t.length<1)return;if(xr(t,(v,D)=>ne.eq(v.x,D.x)?v.y-D.y:v.x-D.x,0,t.length),t.length==2){this.edges.push(new PR(t[0],t[1]));return}let e=new _e,r=new Map,i=new Map,n=0,s=null,a=new Set;for(let v of t){if(s!=null&&s.equals1(v)){this.edges.push(new PR(s,v)),a.add(v);continue}s=v,r.set(n,v),i.set(v,n),e.ext2(v),n++}e.ext7(20);let l=e.build();Math.max(l.width(),l.height())>1e3?uie=50:uie=20;let c=l.LL(),h=l.UL(),u=l.LR(),d=l.UR(),p=n;for(let v of[c,h,u,d])r.set(n,v),i.set(v,n),n++;let m=this.getTriangle4Index([p,p+1,p+2],r),g=this.getTriangle4Index([p+1,p+3,p+2],r);this.insertGrid(m),this.insertGrid(g),n=0;let y=new Map,b=null,P,T,I,C;for(let v of t)if(!a.has(v)){P=this.search(v);for(let D of P){let[w]=D;this.getEdge(w,y),this.delete(D)}for(let[,D]of y)if(D.length==1&&(b=D[0],I=r.get(b[0]),C=r.get(b[1]),Math.abs(I.sub(C).cross(I.sub(v)))>1e-4)){let w=this.getTriangle4Points(I,C,v,i);this.insertGrid(w)}y.clear()}let E=new Map,O=this.edges;function _(v,D){if(v>=p||D>=p)return;if(v>D){let F=v;v=D,D=F}let w=E.get(v);if(w==null&&(w=new Set,E.set(v,w)),!w.has(D)){let F=new PR(r.get(v),r.get(D));w.add(D),O.push(F)}}let R;for(let[,v]of this.grids)for(let[,D]of v)for(let[,w]of D)for(let F of w.items)R=F[0],_(R[0],R[1]),_(R[1],R[2]),_(R[2],R[0]);this.grids.clear()}getEdge(t,e){return this.toMap(t[0],t[1],e),this.toMap(t[1],t[2],e),this.toMap(t[2],t[0],e),e}toMap(t,e,r){let i=this.getKey(t,e),n=r.get(i);n==null&&(n=[],r.set(i,n)),n.push([t,e])}getKey(t,e){return t>e?e+","+t:t+","+e}getTriangle4Points(t,e,r,i){let n=new die(t,e,r),s=[i.get(t),i.get(e),i.get(r)],a=n.center,l=n.getRadius(a);return[s,a,l]}getTriangle4Index(t,e){let r=new die(e.get(t[0]),e.get(t[1]),e.get(t[2])),i=r.center,n=r.getRadius(i);return[t,i,n]}};function z8(o){let t=new Uint32Array(o*2);for(let i=0;i<o;i++)t[i*2]=i,t[i*2+1]=0;let e=i=>{let n=i;for(;t[n*2]!==n;)n=t[n*2];let s=i;for(;s!==n;){let a=t[s*2];t[s*2]=n,s=a}return n};return{find:e,union:(i,n)=>{let s=e(i),a=e(n);if(s===a)return!1;let l=t[s*2+1],c=t[a*2+1];return l>c?t[a*2]=s:l<c?t[s*2]=a:(t[a*2]=s,t[s*2+1]++),!0}}}var TR=class{constructor(t,e,r=!1){this.clusters=new Array;let i=0;this._net=t,_u.getInstance().clear(),this.ids=e;for(let n of this.ids){if(r&&n.size<=Y4)continue;let s=new Set;for(let a of n){let l=pc(a);l&&!(l instanceof dc||l instanceof ss&&l.type=="TearDrop")&&s.add(l)}if(s.size>0){let a=bR.getCluster(s,i++);n.size>Y4&&jS.add(n,a),this.clusters.push(a)}}}getConnects(){let t=new Array,e=0;for(let r of this.ids)t[e++]=Array.from(r);return t}generateRatline(){let t=this.clusters.length,e=new Array;if(t>1){let r=this.getMaters();xr(r,(s,a)=>s.length2-a.length2,0,r.length);let i=new Set,n=z8(this.clusters.length);for(let s of r)if(n.union(s.cluster1.id,s.cluster2.id)&&(i.add(s),i.size===this.clusters.length-1))break;for(let s of i)e.push(s.build(this._net));this.clusters=[]}return e}getMaters(){let t=new Map,e=new Map,r=new Map;for(let n of this.clusters)for(let s of n.junctions){let a=s.point.clone();e.set(a,n),r.set(a,s)}let i=new fie;i.triangulate(Array.from(e.keys()));for(let n of i.edges){let{p0:s,p1:a}=n,l=e.get(s),c=e.get(a);if(l!=c){let h=this.getId(l.id,c.id),u=t.get(h);u!=null?u.length2>n.length2&&t.set(h,new Kb(l,c,r.get(s),r.get(a))):t.set(h,new Kb(l,c,r.get(s),r.get(a)))}}return e.clear(),r.clear(),Array.from(t.values())}getId(t,e){return t<e?t+"|"+e:e+"|"+t}union(t,e){let r=new Set;for(let i of t)r.add(i);for(let i of e)r.add(i);return r}getFather(t,e){let r=null,i=null;for(let n of e)n.has(t.cluster1)&&(r=n),n.has(t.cluster2)&&(i=n);if(r==null&&i==null){let n=new Set;return n.add(t.cluster1),n.add(t.cluster2),e.add(n),!0}else{if(r!=null&&i==null)return r.add(t.cluster2),!0;if(r==null&&i!=null)return i.add(t.cluster1),!0;if(r!=i){e.delete(r),e.delete(i);let n=this.union(r,i);return e.add(n),!0}}return!1}};var Y4=20,eSe=class{constructor(){this.map=new Map}updateIds(t,e){e.every(i=>!!this.get(i))||new TR(t,e,!0)}delete(t){this.map.delete(t)}add(t,e){this.map.delete(t),this.map.set(t,e)}getCluster(t){let e=new Set;for(let r of t){let i=pc(r);i&&!(i instanceof dc||i instanceof ss&&i.type=="TearDrop")&&e.add(i)}return e.size>0?bR.getCluster(e,0):null}get(t){return t.size<=Y4?this.getCluster(t):this.map.get(t)}},tSe=class{constructor(){this.map=new Map}add(t,e){this.map.delete(t),this.map.set(t,e)}get(t){return this.map.get(t)}},t0=class{};t0.useWireClusterCache=!1,t0.emptyNetChange=!0;var zA=new tSe,jS=new eSe;var mie=class{constructor(){this.add=new Set;this.remove=new Set;this.platPads=new Set}sycnChangeData(t,e,r){this.sycn(t,this.add),this.sycn(e,this.remove),this.sycn(r,this.platPads)}sycn(t,e){for(let r of t)e.add(r.globalIndex)}has(t){return this.remove.has(t)||this.add.has(t)||this.platPads.has(t)}};var gie=class{constructor(t,e){this.rtree1=new nn(10);this.rtree2=new nn(10);this.left=null;this.right=null;this.distance=Number.MAX_VALUE;t.itemList.length==1?this.left=t.itemList[0]:this.rtree1=t,e.itemList.length==1?this.right=e.itemList[0]:this.rtree2=e,this.find()}findNearXPoint(t,e){let r=Number.MAX_VALUE,i=e[0];for(let n of e){let s=Math.abs(n.point.x-t.point.x);s<r&&(r=s,i=n)}return i}findNearest(t,e){let r=t.point.bbox().extendOfSize(this.distance),i=e.search(r),n=null,s=this.distance*this.distance;for(let a of i){let l=a.point.distance2(t.point);l<s&&(s=l,n=a)}return this.distance=Math.sqrt(s),n}find(){if(this.rtree1.itemList.length==0&&this.rtree2.itemList.length==0){this.distance=this.left.point.distance1(this.right.point);return}else if(this.rtree1.itemList.length==0&&this.rtree2.itemList.length!=0){let t=this.findNearest(this.left,this.rtree2);t!=null&&(this.right=t)}else if(this.rtree1.itemList.length!=0&&this.rtree2.itemList.length==0){let t=this.findNearest(this.right,this.rtree1);t!=null&&(this.left=t)}else{let t=this.findNearXPoint(this.rtree1.itemList[0],this.rtree2.itemList),e=this.rtree1.itemList[0].point.distance1(t.point);e<this.distance&&(this.distance=e,this.left=this.rtree1.itemList[0],this.right=t)}for(let t of this.rtree1.itemList){let e=this.findNearest(t,this.rtree2);e!=null&&(this.left=t,this.right=e)}}};var YA=class extends yR{constructor(t,e,r){let i=new Array,n=new Map;for(let s of t)for(let a of s.junctions)n.set(a,s),i.push(a);super(i,e),this.map=n,this.max=r}},yie=class{constructor(t){this.changes=new mie;this.id=0;this.oldMap=new Map;this._net=t}rebuild(){zo.removeNetRatlines(this._net),Mh.deleteJumpWireCache(this._net);let t=Mh.cluster(this._net,!0),e=new TR(this._net,t).generateRatline();for(let r=0;r<e.length;r++)zo.addRatlineByModel(e[r])}generateRatline(){let t=this.getRatlines(this._net);if(t==null||t.length==0)return this.rebuild();let e=this.getOldClusterIds(this._net);this.clearOldCache();let r=this.updateClusterIds4Net(this._net);e=this.filterNotChangeIds(e);let i=this.getClusterMap(e),n=this.getClusterMap(r),{notChanges:s,changes:a,allIds:l}=this.compareCluster(i,n),c=this.getChangeClusters(a),{oldMaters:h,clusters:u,all:d}=this.getClusterMaters(t,s,c);zA.add(this._net,l);let p=this.getSuperNode(h);Re.addAll(p,c);let m=new Map;for(let b of p){let P=this.getStaticRtree(b);m.set(b,P)}for(let b of u){let P=this.getStaticRtree(b);m.set(b,P)}let g=p.length;if(g>500)return this.rebuild();for(let b=0;b<g;b++){let P=p[b],T=m.get(P);for(let I=b+1;I<g;I++){let C=p[I],E=m.get(C);this.createSuperMaterial(T,E,P,C,m,h)}}let y=this.getRatlineResult(d,h);for(let b=0;b<y.length;b++)zo.addRatlineByModel(y[b])}getSuperNode(t){let e=new Map,r=new Map;for(let s of t){let a=s.cluster1,l=s.cluster2,c=e.get(a),h=e.get(l);c==null&&(c=new Set,e.set(a,c)),c.add(l),h==null&&(h=new Set,e.set(l,h)),h.add(a);let u=Math.max(s.length2,r.get(a)||0),d=Math.max(s.length2,r.get(l)||0);r.set(a,u),r.set(l,d)}let i=new Set,n=new Array;for(let[s,a]of e){if(i.has(s))continue;let l=new Set,c=r.get(s);l.add(s),i.add(s);let h=Array.from(a);for(Re.addAllSet(i,h);h.length>0;){let d=h.shift();l.add(d),c=Math.max(c,r.get(d));let p=e.get(d);if(p!=null)for(let m of p)i.has(m)||(h.push(m),i.add(m))}let u=new YA(l,this.id++,Math.sqrt(c));n.push(u)}return n}clearOldCache(){zo.removeNetRatlines(this._net),Mh.deleteJumpWireCache(this._net)}addJumpWireClusterNodeCache(t,e){t.size>Y4&&jS.add(t,e)}getRatlineResult(t,e){let r=t.length,i=new Array;if(r>0){xr(e,(a,l)=>a.length2-l.length2,0,e.length);let n=new Set,s=z8(r);for(let a of e)if(s.union(a.cluster1.id,a.cluster2.id)&&(n.add(a),n.size===r-1))break;for(let a of n)i.push(a.build(this._net))}return i}createMaterial(t,e,r,i){let n=this.getNearPoint(t,e);return new Kb(r,i,n.left,n.right)}createSuperMaterial(t,e,r,i,n,s){if(r instanceof YA&&i instanceof YA){let a=this.getNearPoint(t,e);r=r.map.get(a.left),i=i.map.get(a.right),s.push(new Kb(r,i,a.left,a.right))}else if(r instanceof YA&&!(i instanceof YA)){let a=this.getNearPoint(t,e),l=t.search(e.bbox().extendOfSize(Math.max(a.distance,r.max))),c=new Set;for(let h of l){let u=r.map.get(h);c.add(u)}r=r.map.get(a.left),c.delete(r),s.push(new Kb(r,i,a.left,a.right));for(let h of c)s.push(this.createMaterial(n.get(h),e,h,i))}else if(!(r instanceof YA)&&i instanceof YA){let a=this.getNearPoint(t,e),l=e.search(t.bbox().extendOfSize(Math.max(a.distance,i.max))),c=new Set;for(let h of l){let u=i.map.get(h);c.add(u)}i=i.map.get(a.right),c.delete(i),s.push(new Kb(r,i,a.left,a.right));for(let h of c)s.push(this.createMaterial(t,n.get(h),r,h))}else{let a=this.getNearPoint(t,e);s.push(new Kb(r,i,a.left,a.right))}}getNearPoint(t,e){return new gie(t,e)}getStaticRtree(t){let e=new nn(10);for(let r of t.junctions)e.add(r);return e}getChangeClusters(t){let e=new Array;for(let r of t)this.getCluster(r,e);return e}getCluster(t,e){let r=new Set;for(let i of t){let n=pc(i);n&&!(n instanceof dc||n instanceof ss&&n.type=="TearDrop")&&r.add(n)}if(r.size>0){let i=bR.getCluster(r,this.id++);this.addJumpWireClusterNodeCache(t,i),e.push(i)}}compareCluster(t,e){let r=new Array,i=new Array,n=new Array;for(let[s,a]of e){let l=t.get(s);l!=null&&l.length==a.length?(r.push(...l),n.push(...l)):(i.push(...a),n.push(...a))}return{notChanges:r,changes:i,allIds:n}}getClusterMap(t){let e=new Map;for(let r of t){let i=this.getHash(r),n=e.get(i);n==null&&(n=[],e.set(i,n)),n.push(r)}return e}filterNotChangeIds(t){let e=new Array;for(let r of t){let i=!1;for(let n of r)if(this.changes.has(n)){i=!0;break}i||e.push(r)}return e}getHash(t){return Array.from(t).sort().join("|")}updateClusterIds4Net(t){return Mh.getNode(t).cluster(!0,this.changes)}getClusterMaters(t,e,r){let i=new Map,n=new Map,s=Array.from(r);for(let u of e){n.set(u,this.getOldClusterNode(u));for(let d of u){let p=i.get(d);p==null&&(p=[],i.set(d,p)),p.push(u)}}let a=new Array,l=new Set,c=new Map,h=new Set;for(let u of t){let d=u.model.startId==u.model.endId;if(d){if(h.has(u.model.startId))continue;h.add(u.model.startId)}let p=i.get(u.model.startId),m=i.get(u.model.endId);if(p!=null&&m!=null&&(!d||d&&p.length>1))for(let g=0,y=p.length;g<y&&!(d&&g>0||!d&&h.has(u.model.startId)&&g>0);g++){let b=p[g];for(let P=0,T=m.length;P<T;P++){let I=m[P];if(b==I||!d&&h.has(u.model.endId)&&P>0)continue;let C=n.get(b),E=n.get(I);l.has(C)||(C.id=this.id++,l.add(C),s.push(C),this.addJumpWireClusterNodeCache(b,C)),l.has(E)||(E.id=this.id++,l.add(E),s.push(E),this.addJumpWireClusterNodeCache(I,E));let O=new gl(u.start),_=new gl(u.end);O.id=u.model.startId,_.id=u.model.endId;let R=new Kb(C,E,O,_);a.push(R)}}else{if(p!=null)for(let g of p)c.has(g)||c.set(g,n.get(g));if(m!=null)for(let g of m)c.has(g)||c.set(g,n.get(g))}}for(let[u,d]of c)l.has(d)||(d.id=this.id++,s.push(d),this.addJumpWireClusterNodeCache(u,d)),r.push(d);return{oldMaters:a,clusters:l,all:s}}getOldClusterNode(t){return this.oldMap.get(t)}getOldClusterIds(t){let e=zA.get(t)||[];for(let r of e){let i=jS.get(r);if(i==null){let n=new Set;for(let s of r){let a=pc(s);a&&!(a instanceof dc||a instanceof ss&&a.type=="TearDrop")&&n.add(a)}if(n.size==0)continue}if(r.size<=Y4){if(i==null)continue}else if(i==null)throw new Error("old cluster relation error!!!");this.oldMap.set(r,i)}return Array.from(this.oldMap.keys())}getRatlines(t){return zo.getItem(t)}};var jA=class{static rebuildConnect(t){if(!t){this.emptyNetChange(t);return}Mh.deleteJumpWireCache(t),new TR(t,Mh.cluster(t,!0),!0)}static rebuild(t){if(!t){this.emptyNetChange(t);return}new yie(t).generateRatline()}static rebuildAll(t){Array.isArray(t)&&(t=new Set(t));for(let e of t)this.rebuild(e)}static emptyNetChange(t){t==""&&(t0.emptyNetChange=!0)}};jA.userWorker=!0;var Q2=class Q2{static updateEmptyNet(){if(t0.emptyNetChange){let e=Q2.getNode("").cluster(!0);zA.add("",e),t0.emptyNetChange=!1}}static deleteJumpWireCache(t){let e=zA.get(t);if(e!=null)for(let r of e)jS.delete(r)}static cluster(t,e=!1){if(t0.useWireClusterCache){t==""&&Q2.updateEmptyNet();let n=zA.get(t);return n==null?[]:(jS.updateIds(t,n),n)}let i=Q2.getNode(t).cluster(e);return Q2.deleteJumpWireCache(t),zA.add(t,i),t==""&&(t0.emptyNetChange=!1),i}static getNetConnectRelation(t,e=!1){if(t0.useWireClusterCache){t==""&&Q2.updateEmptyNet();let n=zA.get(t);return n==null?[]:(jS.updateIds(t,n),n)}let i=Q2.getNode(t).cluster(e);return t==""&&(t0.emptyNetChange=!1),i}static getConnect(t){return Q2.getNode(t).getConnect()}static input(t){t&&(t.forEach(e=>{let{net:r,ratline:i}=e;Q2.map.set(r,new aj(r).getMap(e.map)),e.map.length=0,Q2.deleteJumpWireCache(r),zo.removeNetRatlines(r),jA.rebuildConnect(r),i.forEach(n=>{zo.addRatlineByModel(PT.getInstance().add(n.globalIndex,new S(n.start.x,n.start.y),new S(n.end.x,n.end.y),r,n.startId,n.endId))}),i.length=0}),t.length=0)}static getNode(t){let e=Q2.map.get(t);if(e)return e;let r=new aj(t);return Q2.map.set(t,r),r}};Q2.map=new Map;var Mh=Q2;var ds=class o extends zs{searchNode(t=!0){let e=new Array;Zb.filterPlane=t,Zb.clear(),Zb.update([this]);let r=Zb.getMap(),i=new ij(r);Zb.sycnResult(i.result);let n=new Set,s=Zb.getResult();for(let[l,c]of s)for(let[h,u]of c)u&&(n.add(h),n.add(l));let a=new er;for(let l of n){let c=a.getConnectNode(l);c!=null&&c!=this&&e.push(c)}return e}searchNowNode(t=!0){var s;let e=this.net;if(e==null)return[];let r=(s=Mh.getNode(e))==null?void 0:s.map.get(this.model),i=new er,n=new Array;if(r!=null)for(let a of r.near){let l=i.getItemByType(a.item.globalIndex,a.item.modelType);if(l!=null&&l!=this&&l instanceof o){if(t&&(a.item.modelType=="Copper"||a.item.modelType=="Inner"))continue;n.push(l)}}return n}searchNodeLoopType(){let t=new Array;Zb.clear(),Zb.updateLoopTypeConnect([this]);let e=Zb.getMap(),r=new ij(e);Zb.sycnResult(r.result);let i=new Set,n=Zb.getResult();for(let[a,l]of n)for(let[c,h]of l)h&&(i.add(c),i.add(a));let s=new er;for(let a of i){let l=s.getConnectNode(a);l!=null&&l!=this&&t.push(l)}return t}searchNodeIgnoreNet(){let t=Zb.getFilterWhetherCheckNet();Zb.changeFilterWhetherCheckNet(!1);let e=this.searchNode();return Zb.changeFilterWhetherCheckNet(t),e}searchCycleNode(){return j4.searchCycleNode(this)}searchCycleNode2(){return j4.searchCycleNode2(this,void 0,!0)}searchCycleNodeTrack(){return j4.searchCycleNode2(this,!0)}searchAllConnectNode(){return xVe(this)}searchAllConnectNode1(){t0.useWireClusterCache=!0;let t=xVe(this);return t0.useWireClusterCache=!1,t}iteratorRatlines(t){this._ratlines&&this._ratlines.some(e=>t(e))}hasRatline(t){return this._ratlines?this._ratlines.includes(t):!1}addRatline(t){this._ratlines||(this._ratlines=[]),this._ratlines.push(t)}removeRatline(t){if(!this._ratlines)return;let e=this._ratlines.indexOf(t);e>=0&&this._ratlines.splice(e,1),this._ratlines.length==0&&this.clearRatlines()}clearRatlines(){this._ratlines&&delete this._ratlines}};function XS(o){let t="searchConnectNodeIds-time";pn(t);let e=gre.getInstance().getItem(o),r=null;if(e==null)r=Mh.getNetConnectRelation(o);else{r=new Array(e.length);let i=0;for(let n of e)r[i++]=new Set(n)}return Bi(t,.05),r}function xVe(o){let t=o.net;if(t==null)return new Set;let e=XS(t),r=new Set,i=new er;for(let n of e)if(n.has(o.globalIndex))for(let s of n){let a=i.getConnectNode(s);a instanceof ds&&r.add(a)}return r}function bie(o){let t=o.net;if(t==null)return new Set;t0.useWireClusterCache=!0;let e=Mh.getNetConnectRelation(t);t0.useWireClusterCache=!1;let r=new Set,i=new er;for(let n of e)if(n.has(o.globalIndex))for(let s of n){let a=i.getConnectNode(s);a instanceof ds&&r.add(a)}return r}var fc=class{constructor(t,e,r){this.pl1=t,this.pl2=e,this.clearance=r;let{relation:i,distance:n,line:s,pt1:a,pt2:l,pt1Parent:c,pt2Parent:h}=this.getRelation();this.relation=i,this.distance=n,this.line=s,this.pt1=a,this.pt2=l,this.pt1Parent=c,this.pt2Parent=h}getRelation(){let t=this.pl1 instanceof Gt?this.pl1.getOutMostPolyline():this.pl1,e=this.pl2 instanceof Gt?this.pl2.getOutMostPolyline():this.pl2,r=new Fs(t,e,this.clearance,!1);if(r.relation==3||r.relation==0){let{relation:p,distance:m,line:g,pt1:y,pt2:b}=r;return{relation:p,distance:m,line:g,pt1:y,pt2:b,pt1Parent:t,pt2Parent:e}}let i=this.pl1 instanceof Gt?this.pl1.items:[this.pl1],n=this.pl2 instanceof Gt?this.pl2.items:[this.pl2],s=r,a=t,l=e;for(let p of i)for(let m of n){let g=new Fs(p,m,this.clearance,!1);if(g.distance<s.distance&&(s=g,a=p,l=m),g.relation==0){let{relation:y,distance:b,line:P,pt1:T,pt2:I}=g;return{relation:y,distance:b,line:P,pt1:T,pt2:I,pt1Parent:a,pt2Parent:l}}}if(Jr.inPolygon(n[0].start(),i)){let{relation:p,distance:m,line:g,pt1:y,pt2:b}=s;return{relation:1,distance:m,line:g,pt1:y,pt2:b,pt1Parent:a,pt2Parent:l}}else if(Jr.inPolygon(i[0].start(),n)){let{relation:p,distance:m,line:g,pt1:y,pt2:b}=s;return{relation:2,distance:m,line:g,pt1:y,pt2:b,pt1Parent:a,pt2Parent:l}}let{distance:c,line:h,pt1:u,pt2:d}=s;return{relation:3,distance:c,line:h,pt1:u,pt2:d,pt1Parent:a,pt2Parent:l}}};var Ue=class o extends ds{constructor(e){super();this.startRatline=new Array(0);this.endRatline=new Array(0);this.model=e,e.setModelWatcher(this),this.initRefreshRender()}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}get showNet(){return this.model.showNet}set net(e){this.net!=e&&(ze.delete(this),this.model.net=e,ze.addItem(this),this.refreshRender())}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=e,this.refreshRender()}get color(){return Oo.getInstance().trackConfig.getCustomColor(this.globalIndex)||ze.getSpecialColor(this.net)}set color(e){Oo.getInstance().trackConfig.setCustomColor(this.globalIndex,e),this.refreshRender()}get gId(){return this.model.globalIndex}set gId(e){this.model.globalIndex=e}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get length(){return this.model.length}set length(e){this.model.length=bo(e),this.refreshRender()}get midPoint(){return this.model.midPoint}get start(){return this.model.start}set start(e){this.model.start=e,this.refreshRender()}get end(){return this.model.end}set end(e){this.model.end=e,this.refreshRender()}get width(){return this.model.width}set width(e){this.model.width=bo(e),this.refreshRender()}get primitive(){return this.model.primitive}get viewGroupId(){return this.model.modelType+this.net}get viewGroupIdModified(){return this.netModified}moveRatline(e,r){var n;if((n=be.getLayer(57))!=null&&n.visible){for(let s of this.startRatline)s.isVisible&&(s.startNode==this&&!s.start.equals(e)&&(s.start=e,s.click()),s.endNode==this&&!s.end.equals(e)&&(s.end=e,s.click()));for(let s of this.endRatline)s.isVisible&&(s.startNode==this&&!s.start.equals(r)&&(s.start=r,s.click()),s.endNode==this&&!s.end.equals(r)&&(s.end=r,s.click()))}}addRatline(e){super.addRatline(e),e.startNode==this&&(e.start.equals1(this.start)&&this.startRatline.push(e),e.start.equals1(this.end)&&this.endRatline.push(e)),e.endNode==this&&(e.end.equals1(this.start)&&this.startRatline.push(e),e.end.equals1(this.end)&&this.endRatline.push(e))}removeRatline(e){super.removeRatline(e);let r=this.startRatline.indexOf(e);r>=0&&this.startRatline.splice(r,1);let i=this.endRatline.indexOf(e);i>=0&&this.endRatline.splice(i,1)}rotateFor(e,r){this.model.rotateFor(e,r),this.refreshRender()}transform(e){this.model.transform(e),this.refreshRender()}remove(){if(this.sendDeleteMsg){let e=this.searchNodeLoopType();if(e.length<10)for(let r of e)r instanceof o&&A.publish("hasModifyPcbItem",r);this.clearRatlines()}this.model.remove(),super.remove(),Oo.getInstance().trackConfig.setCustomColor(this.globalIndex,null)}isSelect(e,r){return this.getParent()!=null?!1:this.model.inShape(e,r)}getMathGraphics(e,r=0){return this.isEmpty?null:this.model.getMathGraphics(e,r)}buildBBox(){return this.model.buildBBox()}refreshRender(){!this.model.isEmpty&&this.model!=null&&this._ratlines!=null&&this._ratlines.length>0&&this.moveRatline(this.start,this.end),super.refreshRender()}};var X4=.05,rSe=class{constructor(){this.hightItemsArr=new Set}setIsChildPcb(t){this._isChildPcb=t}isChildPcb(){return this._isChildPcb}hightItems(t){for(let e of t)this.checkIsCanEditByItem(e)||(e.click(),this.hightItemsArr.add(e))}cancelHightLightAll(){for(let t of this.hightItemsArr)t.visible();this.hightItemsArr=new Set}checkIsCanEditByPoint(t){let e=this.getJudgeCanEditArea();if(this._isChildPcb){if((e instanceof fe||e instanceof Gt)&&new fc(e,fe.build2([new M(t,t.add(new S(.1,.1)))]),0).relation==1)return!0}else{for(let r of e)if(new fc(r,fe.build2([new M(t,t.add(new S(.1,.1)))]),0).relation!==3)return!1;return!0}}checkTrackCanEditByPoint(t){let e=this.getJudgeCanEditArea();if(this._isChildPcb){if(e instanceof fe)return Jr.inPolyline(t,e,void 0,void 0,X4);if(e instanceof Gt)return e.items.every(r=>Jr.inPolyline(t,r,void 0,void 0,X4))}else{for(let r of e){if(r instanceof fe)return!(Jr.inPolyline(t,r)&&!Jr.inEdge4Polyline(t,r,X4));if(r instanceof Gt)return!r.items.every(i=>Jr.inPolyline(t,i)&&!Jr.inEdge4Polyline(t,i,X4))}return!0}}checkIsInCanEdit(t,e,r){let i=this.getJudgeCanEditArea();if(!i)return!1;if(i.length===0)return!0;let n=t instanceof zs?t.getMathGraphics(e):fe.build2(t);if(this._isChildPcb){if(new fc(i,n,0).relation==1)return!0;if(r=="track")return n.primitives.every(a=>{let l=[a.start(),a.midPoint,a.end()];return i instanceof Gt?l.every(c=>Jr.inPolygon(c,i.items)):l.every(c=>Jr.inPolyline(c,i,void 0,void 0,X4))});if(t instanceof Ue){let a=[t.start,t.midPoint,t.end];return i instanceof Gt?a.every(l=>Jr.inPolygon(l,i.items)):a.every(l=>Jr.inPolyline(l,i,void 0,void 0,X4))}}else{for(let s of i){let a=new fc(s,n,0).relation;if(a==1)return!1;if(a==0){if(r=="track"){let l,c=n.primitives[n.primitives.length-1].end();if(s instanceof Gt?l=Jr.inPolygon(c,s.items):l=Jr.inPolyline(c,s,void 0,void 0,X4),l)return!1;let h=this.getIntersectPoints(n.primitives,s.primitives);if(!(h.length==1&&h[0].length>=1))return!1}if(t instanceof Ue){if([t.start,t.midPoint,t.end].some(h=>Jr.inPolyline(h,s)&&!Jr.inEdge4Polyline(h,s)))return!1}else return!1}}return!0}}getIntersectPoints(t,e){let r=[];for(let i of t)for(let n of e){let s=Tt(n,i);if(s>0){let a=ig(s,[]);for(let l=0;l<a.length;l++){let c=a[l];for(let h=0;h<r.length;h++){let u=r[h];for(let d=0;d<u.length;d++)u[d].equals1(c)&&(u.length>1?(a.splice(l,1),l--):(u.splice(d,1),d--,r.splice(h,1),h--))}}a.length&&r.push(a)}}return r}checkIsCanEditByItem(t){return t.partition==x.getInstance().partitionId}getJudgeCanEditArea(){if(this._isChildPcb){let t=Dn.getInstance().getItemById(x.getInstance().partitionId);return t==null?void 0:t.getMathGraphics()}else{let t=Dn.getInstance().getAllItem();return t.length==0?[]:(t=t.filter(r=>!r.isEmpty&&r instanceof Ye&&r.type=="Partition"&&r.getComponent().isPartitionSplitOut()),t.map(r=>r.getMathGraphics()))}}checkIsCanEditByBBox(t){let e=new Array,r=new M(t.LL(),t.LR()),i=new M(t.LR(),t.UR()),n=new M(t.UR(),t.UL()),s=new M(t.UL(),t.LL());return e.push(r),e.push(i),e.push(n),e.push(s),this.checkIsInCanEdit(e)}getTransparencyByPcbType(t,e,r){let i=(e==null?void 0:e.alpha)!=null?e==null?void 0:e.alpha:r;if(i==null)return i;if(!this.checkIsCanEditByItem(t)){let n=t.getParent();t instanceof Ye&&t.type=="Partition"||n!=null&&n instanceof Ye&&n.type=="Partition"?i=i*.8:i=i*.5}return i}showMassageTip(t,e){A.publish("ui/toastMsg",{type:"info",msg:t,bottomBarMsg:e?{type:"info",msg:`<span class="i18n" i18n="${e}">${e}</span>`}:void 0},$())}},Bt=new rSe;var Ye=class extends ds{constructor(){super(...arguments);this._notShowFill=!0}get color(){return this._color}set color(e){e?this._color=e:delete this._color}get hiddenCopperResult(){return this._hiddenCopperResult||!1}set hiddenCopperResult(e){e?this._hiddenCopperResult=e:delete this._hiddenCopperResult}get notShowFill(){return this._notShowFill}set notShowFill(e){this._notShowFill=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get lineColor(){var s,a;let e,r=this.color,i=(a=(s=ce)==null?void 0:s.themeConfig)==null?void 0:a.canvasTheme;i?(e=i.getRegionLineStyle(this,{defaultLineColor:r}).lineColor,e.equals(ee.BLACK,!1)&&(e=r)):e=r;let n=Bt.getTransparencyByPcbType(this,e);return e!=null&&n!=null&&e.alpha!=n&&(e=ee.of6(e,n)),e}get lineSolid(){var i,n;let e=!0,r=(n=(i=ce)==null?void 0:i.themeConfig)==null?void 0:n.canvasTheme;return r&&(e=r.getRegionLineStyle(this).lineSolid),e}get isPixel(){var i,n;if(this.type=="Annotation")return!0;let e=!1,r=(n=(i=ce)==null?void 0:i.themeConfig)==null?void 0:n.canvasTheme;return r&&(e=r.getRegionLineStyle(this).isPixel),e}get copperResultMap(){return this._copperResultMap}checkRegion(e){this.model.type=="Fill Region"&&!mp(this.model.layerId)&&this.model.component instanceof ln&&(this.model.component.isBridgingCopper=!1)}fillCopper(){let e=this.getComponent();if(this.clearCopper(),e!=null&&e instanceof Vn){let r=e.style,i=e.gridLineWidth,n=e.optimization,s=e.clearance,a=e.optimizationValue;s==0&&r!="solid"&&(r="solid",n=!0,a=e.gridLineWidth,i=0);let l=0;e.copperResult.forEach(c=>{let h=Ei.addCopper(this.layerId,this.net,r,i,s,n,c,a);h.number=l++,this.hiddenCopperResult?h.hidden():h.fill(),h.setParent(this),this.addCopperResult(h),this.model.addCopper(h.globalIndex),A.publish("hasModifyPcbItem",h)})}}updatePourOutline(){var e,r;if(this.type=="Copper Region"){let i=(r=(e=ce)==null?void 0:e.themeConfig)==null?void 0:r.canvasTheme;if(i&&i.getRegionLineStyle(this).lineNone){if(this.isHighLight)return;if(this.hasCopperRes()){this.hidden();return}this.isVisible=!0}}}needShowOutline(){var e,r;if(this.type=="Copper Region"){let i=(r=(e=ce)==null?void 0:e.themeConfig)==null?void 0:r.canvasTheme;if(i&&i.getRegionLineStyle(this).lineNone)return this.isHighLight?!0:!this.hasCopperRes()}return!0}addNewCopperModel(e){let r=Ei.addCopperByModel(e);r.setParent(this),this.addCopperResult(r),this.hiddenCopperResult?r.hidden():r.fill()}initVisible(){super.initVisible(),this.type=="Copper Region"&&(this.hiddenCopperResult=!this.isVisible)}deleteCopperById(e){if(!this._copperResultMap)return;let r=null;for(let i of this._copperResultMap)if(i.globalIndex===e){r=i;break}r!=null&&this._copperResultMap.delete(r),this.model.deleteCopper(e)}toggleCopperResult(e){if(this.type=="Copper Region"){if(!this._copperResultMap)return;this.hiddenCopperResult=!e,this._copperResultMap.forEach(r=>{e?r.visible():r.hidden()})}}refreshStyle(){this.removeFill(),this.fill()}deleteRegionRuleSelector(){let e=te.getInstance().getRegion(this.globalIndex);e!=null&&(x.getInstance().compiler.deleteRuleSelector([e.regionType=="constraint"?"REGION":"POUR",e.name]),te.getInstance().deleteRegion(this.globalIndex),x.getInstance().compiler.deleteRuleSelector(["REGION",this.globalIndex]))}getViewState(){return this.isEmpty?"Not Shown":this.notShowFill?"Not Show Fill":this.isVisible?this.isHighLight?"Main And Highlight":"Only Main":"Not Shown"}hasCopperRes(){return this._copperResultMap&&this._copperResultMap.size>0}getCopperResult(){return this._copperResultMap}addCopperResult(e){this._copperResultMap||(this._copperResultMap=new Set),this._copperResultMap.add(e)}deleteCopperResult(e,r){this._copperResultMap&&e!=null&&(this._copperResultMap.delete(e),this.model.deleteCopper(r))}clearCopper(){this._copperResultMap&&(this._copperResultMap.forEach(e=>{e.remove(),A.publish("delete",e)}),this.model.clearCopperData(),delete this._copperResultMap)}iteratorCopper(e){this._copperResultMap&&this._copperResultMap.forEach(r=>{e(r)})}};var XA=class XA{static getInstance(){return XA.manager==null&&(XA.manager=new XA),XA.manager}constructor(){this.nameManager=new Q0,this.items=new Map,A.subscribe("removeFileUuids",t=>{XA.getInstance().getAllItem().forEach(r=>{r.model instanceof lr&&r.model.component instanceof Dc&&t.includes(r.model.component.fileUuid)&&(r.model.component.fileUuid="",RVe(r))})},$())}hasName(t){return this.nameManager.has(t)}getName(t="partition1"){return this.nameManager.getNum(t)}addName(t){this.nameManager.add(t)}deleteName(t){this.nameManager.deleteNum(t)}hasItemById(t){return this.items.has(t)}getItemById(t){return this.items.get(t)}getAllItem(){return Array.from(this.items.values())}addItem(t){let e=t.globalIndex;this.items.set(e,t)}hasSpiltOutPartition(){for(let[,t]of this.items){if(t instanceof Ye&&t.type=="Partition"){let e=t.getComponent();if(e instanceof Dc&&e.isPartitionSplitOut())return!0}return!1}}deleteItemById(t){this.items.delete(t),this.syncPartitionStatus()}clearItems(){this.items.clear()}recycle(){this.items.clear(),this.nameManager.clear()}syncPartitionStatus(){if(Bt.isChildPcb())return;let t=XA.getInstance().getAllItem(),e=[];for(let r of t)r.model instanceof lr&&r.model.component instanceof Dc&&e.push({id:r.globalIndex,fileUuid:r.model.component.fileUuid});A.publish("syncPcbPartitionStatus",{mainUuid:x.getInstance().id,partitionData:e},$())}};XA.manager=null;var Dn=XA;var Pie=te.getInstance(),Wg=class extends so{constructor(){super(...arguments);this.queryTool=new er}equals(e,r){return e!=null&&r!=null?e.equals(r):r==e}needSendInfo(e){var i;let r=((i=this.queryTool.getItem(this.gId))==null?void 0:i.type)||"";return e.tool.type=="Copper Region"||r=="Copper Region"?e.action=="add"||e.action=="delete"?{action:"fullUpdate",data:null}:e.action=="modify"?this.comparePourChange():{action:"notUpdate",data:null}:{action:"notUpdate",data:null}}rebuildRegionSelector(e,r){if(e.type==="Constraint Region"){let i=Pie.addRegionSelector(this.gId),n=Pie.updateRegionSelector(this.gId,r,!0);return this.showExistRegionSelector(n),i}}modifyRegionSelector(e,r){if(e.type==="Constraint Region"){let i=Pie.updateRegionSelector(this.gId,r,!0);this.showExistRegionSelector(i)}}removeRegionSelector(){Pie.deleteRegion(this.gId),x.getInstance().compiler.deleteRuleSelector(["REGION",this.gId])}rebuildPartition(e){Dn.getInstance().addItem(e)}showExistRegionSelector(e){for(let r of e){let i=r.type,n=`"${r.name}"`,s="When undoing/redoing, it was found that the rule name {name} does not exist, and the {type} rule in the constraint region has been cleared",a=[`<span class="i18n" i18n='${s}' i18n-params-name='${n}' i18n-params-type="${i}"></span>`];ie.publish("ui/toastMsg",{type:"info",msg:{value:s,options:{name:n,type:i},translateOptionKeys:["type"]},bottomBarMsg:{type:"info",msg:a}},$())}}};var r0=class{static getNumberManager(){return this.numberManager==null&&(this.numberManager=new Q0),this.numberManager}};r0.numberManager=null,r0.isStart=!0;var Le=class extends ds{constructor(){super(...arguments);this._highlightByComponent=!1;this._parent=void 0}set padExpansion(e){this.model.padExpansion=e,this.refreshRender(),this.updateSmartPad()}get padExpansion(){return this.model.padExpansion}get selectItem(){return this.hasDataState(9)}set selectItem(e){this.hasDataState(9)!=e&&(this.setDataState(9,e),this.refreshRender())}get hole(){return this.model.hole}set hole(e){this.hole!=e&&(this.model.hole=e,this.refreshRender())}get highlightMaskColor(){var r;let e=(r=zb.getInstance())==null?void 0:r.getMaskHightColor(this);return e||ee.BLACK}queryPasteExpansion(e){let r;return this.layerId==2?this.isTestPad?r=e.testPointBottomExpansion:r=e.padBottomExpansion:this.isTestPad?r=e.testPointTopExpansion:r=e.padTopExpansion,r}get smartPad(){return this._smartPad}set smartPad(e){this._smartPad=e,this.model.updateShapeData()}get partition(){return this.model.partition}set partition(e){super.partition=e}get padLen(){return this.model.padLen}set padLen(e){this.model.padLen=e}get attrsMap(){return this.model.attrsMap}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get num(){return this.model.num}set num(e){let r=r0.getNumberManager();e==""?r.deleteNum(this.model.num):(r.deleteNum(this.model.num),r.add(e)),this.model.num=e,this.refreshRender()}get unusedInnerLayers(){return this.model.unusedInnerLayers}set unusedInnerLayers(e){this.model.unusedInnerLayers=e,this.refreshRender()}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}get showNet(){return this.model.showNet}set net(e){this.showNet!=e&&(ze.delete(this),this.model.net=e,ze.addItem(this),this.refreshRender())}get highlightByComponent(){return this._highlightByComponent}set highlightByComponent(e){this._highlightByComponent=!!e,this.refreshRender()}get type(){return this.model.type}set type(e){this.model.type=e,this.refreshRender()}get isTestPad(){return this.model.isTestPad}set isTestPad(e){this.model.isTestPad=e}set padRuleType(e){if(e==1)this.padRule=null;else if(!this.padRule){let r=te.getInstance().getRuleByNet(this.net,10),i=this.layerId!==12,n=this.layerId;this.padRule=Su.getPadRule(i?r.getSingleConnectMode(n):r.getMultiConnectMode(),i?r.getSingleLineClearance(n):r.getMultiLineClearance(),i?r.getSingleLineWidth(n):r.getMultiLineWidth(),i?r.getSingleLineAngle(n):r.getMultiLineAngle())}}get padRuleType(){return this.padRule?2:1}get padRule(){return this.model.padRule}set padRule(e){this.model.padRule=e}get plated(){return this.model.plated}set plated(e){this.model.plated=e}get pasteExpansionModified(){return this.model.pasteExpansionModified}get topSolderExpansionModified(){return this.model.topSolderExpansionModified}get bottomSolderExpansionModified(){return this.model.bottomSolderExpansionModified}get numModified(){return this.model.numModified}get topModified(){return this.model.topModified}get bottomModified(){return this.model.bottomModified}get innerModified(){return this.model.innerModified}get holeModified(){return this.model.holeModified}get viewGroupId(){return this.model.modelType+this.net+"_mask"}get wireViewGroupId(){return this.model.modelType+this.net+"_mask_W"}get realSolderExpansion(){return this.layerId==1?this.topSolderExpansion:this.layerId==2?this.bottomSolderExpansion:-100}get realPasteExpansion(){return 12==this.layerId?0:this.pasteExpansion}get realMaxExpansion(){return Math.max(this.realSolderExpansion,this.realPasteExpansion)}get maxShapeLayer(){let e=this.layerId,r=this.realMaxExpansion;return r>0&&r==this.realSolderExpansion?e==1?5:6:r>0&&r==this.realPasteExpansion?e==1?7:8:e}get viewGroupIdModified(){return this.netModified}get grayIndex(){return be.getGrayIndex()}get usedLayers(){let e=[],r=new Set(this.unusedInnerLayers);if(r.size>0||this.type==2||this.grayIndex!=0){let i=$e.getInstance().getAllCopperLayerIds();for(let n of i)r.has(n)||e.push(n)}return e}getMathGraphics(e=this.layerId,r=0){return this.isEmpty?null:this.model.getMathGraphics(e,r)}clearRelation(){if(OT.on){let r=this.searchNode();if(r.length<10)for(let i of r)A.publish("hasModifyPcbItem",i)}this.clearRatlines(),r0.getNumberManager().deleteNum(this.num)}refreshRatlinePosition(){var i;if(!((i=be.getLayer(57))==null?void 0:i.visible))return;let r=this.center;this.iteratorRatlines(n=>{n.isVisible&&(n.startNode==this&&!n.start.equals(r)&&(n.start=r,n.click()),n.endNode==this&&!n.end.equals(r)&&(n.end=r,n.click()))})}toPadRuleJson(){return this.padRule?this.padRule.toJSON():null}refreshRender(){this.model.isEmpty||this.refreshRatlinePosition(),super.refreshRender()}getOneInnerInUse(){return this.model.getOneInnerInUse()}updateSmartPad(){this.smartPad&&this.smartPad.update(this.model.getBBox(!0))}addATTRMap(e,r){this.model.addATTRMap(e,r)}modifyATTRMap(e,r){this.model.modifyATTRMap(e,r)}deleteATTRMap(e){this.model.deleteATTRMap(e)}clearMap(){this.model.clearMap()}};var qA=class{constructor(t,e){this.isEmpty=!1;this.isVisible=!0;this.locked=!1;this.viewGroupId="";this.padId=e,this.globalIndex=this.padId+"_SmartPad",this._bbox=t,this.refreshRender()}get spotSize(){return Math.min(this._bbox.height()/7.5,this._bbox.width()/7.5,.8)}adjustAssociatedDimensions(t){we.smartMode&&wh.getAllItem().forEach(r=>{r.restriction&&[r.restriction.start,r.restriction.end].includes(this.padId)&&t(r)}),this.refreshRender()}visible(){this.adjustAssociatedDimensions(t=>{t.visible(),A.publish("hasModifyPcbItem",t)}),this.isVisible=!0,this.refreshRender()}hidden(){this.adjustAssociatedDimensions(t=>{t.hidden(),A.publish("hasModifyPcbItem",t)}),Vs.cancel(),this.isVisible=!1,this.refreshRender()}remove(){this.adjustAssociatedDimensions(t=>{t.remove(),A.publish("delete",t)}),Vs.cancel(),this.isVisible=!1,this.isEmpty=!0,this.refreshRender()}isSelect(t,e){return this.getSelectSpotIndex(t,e)!=null}highlightSpot(t,e){let r=this.getSelectSpotIndex(t,e),i=this.getSpotCenter(r);if(i!=null){Vs.highlightSpot(i,this.spotSize);let n=Kt.getItem(this.padId);n!=null&&n.visible()}this.refreshRender()}selectOnePoint(t,e){let r=this.getSelectSpotIndex(t,e);if(r!=null){let i=this.getSpotCenter(r);return i==null?!1:(Vs.addRestriction(this.padId,r,i,this.spotSize),Vs.justSelectOnePoint=!0,!0)}return!1}getSelectSpotIndex(t,e){let{_bbox:r,spotSize:i}=this,n=new S(t,e);return M1(n,r.center(),i)?4:M1(n,r.UL(),i)?0:M1(n,r.UR(),i)?1:M1(n,r.LR(),i)?2:M1(n,r.LL(),i)?3:null}getSpotCenter(t){let e=this._bbox;return t===4?e.center():t===0?e.UL():t===1?e.UR():t===2?e.LR():t===3?e.LL():null}update(t){let e=this._bbox;this._bbox=t,e.UL().equals1(t.UL())||this.modifySmartDimensionEnds(this.padId,0,t.UL()),e.UR().equals1(t.UR())||this.modifySmartDimensionEnds(this.padId,1,t.UR()),e.LR().equals1(t.LR())||this.modifySmartDimensionEnds(this.padId,2,t.LR()),e.LL().equals1(t.LL())||this.modifySmartDimensionEnds(this.padId,3,t.LL()),e.center().equals1(t.center())||this.modifySmartDimensionEnds(this.padId,4,t.center()),this.refreshRender()}modifySmartDimensionEnds(t,e,r){if(Y8.isMoving)return;let i=ZE.find([this.padId]);for(let n in i){let s=i[n];for(let a of s){if(a.start==t&&a.startIndex==e){let l=wh.getItem(a.id);l&&(l.left=r,l.setLeftSpotSize(this.spotSize))}if(a.end==t&&a.endIndex==e){let l=wh.getItem(a.id);l&&(l.right=r,l.setRightSpotSize(this.spotSize))}}}this.refreshRender()}getType(){return 10}getRenderData(){let t=this.getViewState();return{layerId:1002,bbox:this._bbox,color:ee.build(.7,.7,.7,.7),spotSize:this.spotSize,state:t,highLightType:1,highlightColor:ee.BLACK}}transform(t){this._bbox=this._bbox.transform(t)}refreshRender(){Do.attach(this,this.getType())}getViewState(){return this.isEmpty?"Not Shown":this.isVisible?"Only Main":"Not Shown"}};var Ri=class extends Le{constructor(t){super(),C0(t),this.model=t,t.setModelWatcher(this),we.smartMode&&(this.smartPad=new qA(this.model.getBBox(),this.globalIndex)),this.initRefreshRender(),jo("editor/shape/Pad")}get top(){return this.model.top}set top(t){this.model.top=t,this.refreshRender()}get bottom(){return this.model.bottom}set bottom(t){this.model.bottom=t,this.refreshRender()}get inner(){return this.model.inner}set inner(t){this.model.inner=t,this.refreshRender()}set hole(t){this.hole!=t&&(this.model.hole=t,this.refreshRender())}get hole(){return this.model.hole}get color(){return Oo.getInstance().padConfig.getCustomColor(this.globalIndex)||ze.getSpecialColor(this.net)}set color(t){Oo.getInstance().padConfig.setCustomColor(this.globalIndex,t),this.refreshRender()}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}get holeOffset(){return this.model.holeOffset||S.ORIGIN}set holeOffset(t){this.hole&&(this.model.holeOffset=t,this.refreshRender())}get holeRotation(){return this.model.holeRotation}set holeRotation(t){this.hole&&t!=null&&(this.model.holeRotation=t,this.refreshRender())}get topType(){var t;return(t=this.top)==null?void 0:t.type}set topType(t){this.top&&t!=null&&(this.top=$o.getPadStyleByType(t,this.top),this.refreshRender())}get innerType(){var t;return(t=this.inner)==null?void 0:t.type}set innerType(t){this.inner&&t!=null&&(this.inner=$o.getPadStyleByType(t,this.inner),this.refreshRender())}get bottomType(){var t;return(t=this.bottom)==null?void 0:t.type}set bottomType(t){this.bottom&&t!=null&&(this.bottom=$o.getPadStyleByType(t,this.bottom),this.refreshRender())}get center(){return this.model.center}set center(t){this.model.center=t,this.refreshRender()}get topWidth(){var t;return(t=this.top)==null?void 0:t.width}set topWidth(t){this.top&&t!=null&&(this.top=$o.getPadStyleByWidth(t,this.top),this.refreshRender())}get topHeight(){var t;return(t=this.top)==null?void 0:t.height}set topHeight(t){this.top&&t!=null&&(this.top=$o.getPadStyleByHeight(t,this.top),this.refreshRender())}get innerWidth(){var t;return(t=this.inner)==null?void 0:t.width}set innerWidth(t){this.inner&&t!=null&&(this.inner=$o.getPadStyleByWidth(t,this.inner),this.refreshRender())}get innerHeight(){var t;return(t=this.inner)==null?void 0:t.height}set innerHeight(t){this.inner&&t!=null&&(this.inner=$o.getPadStyleByHeight(t,this.inner),this.refreshRender())}get bottomWidth(){var t;return(t=this.bottom)==null?void 0:t.width}set bottomWidth(t){this.bottom&&t!=null&&(this.bottom=$o.getPadStyleByWidth(t,this.bottom),this.refreshRender())}get bottomHeight(){var t;return(t=this.bottom)==null?void 0:t.height}set bottomHeight(t){this.bottom&&t!=null&&(this.bottom=$o.getPadStyleByHeight(t,this.bottom),this.refreshRender())}get topRatio(){var t;return(t=this.top)==null?void 0:t.ratio}set topRatio(t){this.top&&t!=null&&(this.top=$o.getPadStyleByRatio(t,this.top),this.refreshRender())}get innerRatio(){var t;return(t=this.inner)==null?void 0:t.ratio}set innerRatio(t){this.inner&&t!=null&&(this.inner=$o.getPadStyleByRatio(t,this.inner),this.refreshRender())}get bottomRatio(){var t;return(t=this.bottom)==null?void 0:t.ratio}set bottomRatio(t){this.bottom&&t!=null&&(this.bottom=$o.getPadStyleByRatio(t,this.bottom),this.refreshRender())}get pasteExpansion(){return this.model.padExpansion.pasteExpansion}set pasteExpansion(t){this.model.pasteExpansion=t,this.refreshRender(),this.updateSmartPad()}get expansion(){return this.model.padExpansion}set expansion(t){this.model.padExpansion=t,this.refreshRender(),this.updateSmartPad()}get topSolderExpansion(){return this.model.topSolderExpansion}set topSolderExpansion(t){this.model.topSolderExpansion=t,this.refreshRender(),this.updateSmartPad()}get bottomSolderExpansion(){return this.model.bottomSolderExpansion}set bottomSolderExpansion(t){this.model.bottomSolderExpansion=t,this.refreshRender(),this.updateSmartPad()}get expansionType(){return this.model.expansionType}set expansionType(t){this.model.expansionType=t,C0(this.model),this.refreshRender()}get rotation(){return this.model.rotation}set rotation(t){this.model.rotation=t,this.refreshRender()}get holeShape(){return this.model.holeShape}set holeShape(t){this.hole&&t!=null&&(this.model.holeShape=t,this.refreshRender())}get holeRadius(){return this.model.holeRadius}set holeRadius(t){this.hole&&t!=null&&(this.model.holeRadius=t,this.refreshRender())}get holeLength(){return this.model.holeLength}set holeLength(t){this.hole&&t!=null&&(this.model.holeLength=t,this.refreshRender())}get holeColor(){var t,e,r;return((r=(e=(t=ce)==null?void 0:t.themeConfig)==null?void 0:e.canvasTheme)==null?void 0:r.getHoleColor(this.plated,Oo.getInstance().padConfig.getSelectAlpha(this.selectItem)))||ee.BLACK}queryPasteExpansion(t){let e;return this.layerId==2?this.isTestPad?e=t.testPointBottomExpansion:e=t.padBottomExpansion:this.isTestPad?e=t.testPointTopExpansion:e=t.padTopExpansion,e}oppositeLayer(){this.model.oppositeLayer(),this.refreshRender()}rotateFor(t,e){let r=Ae.translate(-t.x,-t.y,0).rotateZ(e).translate1(t.x,t.y,0);this.transform(r)}visible(t=!1){super.visible(t),this.smartPad&&this.smartPad.visible()}hidden(){super.hidden(),this.smartPad&&this.smartPad.hidden()}remove(){this.clearRelation(),this.smartPad&&this.smartPad.remove(),super.remove(),this.model.remove()}flip(t){this.model.flip(t),this.refreshRender()}transform(t){this.model.transform(t),this.refreshRender(),this.updateSmartPad()}isSelect4Layer(t,e,r){return r===1&&this.top?this.top.inShape(t,e,this.center,this.rotation):r===2&&this.bottom?this.bottom.inShape(t,e,this.center,this.rotation):this.inner?this.inner.inShape(t,e,this.center,this.rotation):!1}isSelect(t,e,r=!1){return we.smartMode&&r&&this.smartPad&&this.smartPad.isSelect(t,e)?!0:this.model.inShape(t,e)}getBBoxFilterExt(){return this.model.getBBox(!0)}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,type:this.type,num:this.num,center:this.center,topType:this.topType,topWidth:this.topWidth,topHeight:this.topHeight,topRatio:this.topRatio,bottomType:this.bottomType,bottomWidth:this.bottomWidth,bottomHeight:this.bottomHeight,bottomRatio:this.bottomRatio,innerType:this.innerType,innerWidth:this.innerWidth,innerHeight:this.innerHeight,innerRatio:this.innerRatio,rotation:this.rotation,locked:this.locked,net:this.net,expansionType:this.expansionType,pasteExpansion:this.pasteExpansion,topSolderExpansion:this.topSolderExpansion,bottomSolderExpansion:this.bottomSolderExpansion,unusedInnerLayers:this.unusedInnerLayers,plated:this.plated,holeLength:this.holeLength,holeRadius:this.holeRadius,holeShape:this.holeShape,holeRotation:this.holeRotation,holeOffset:this.holeOffset,isTestPad:this.isTestPad,padRule:this.toPadRuleJson(),padLen:this.padLen,attrsMap:{...this.model.attrsMap}}}getFileGraphics(t,e,r){if(this.isEmpty)return null;if(t==12){let i=[];r=r||[1,2,15];for(let n of r){let s=this.getMathGraphics(n,e);s!=null&&i.push(s)}return i}else{let i=this.getMathGraphics(t,e);return i!=null?[i]:null}}getTopShape(t){return this.top&&(this.layerId==1||this.layerId==12)?Fg(this.model,this.top,t):null}getInnerShape(t){return this.inner&&this.layerId==12?Fg(this.model,this.inner,t):null}getBottomShape(t){return this.bottom&&(this.layerId==2||this.layerId==12)?Fg(this.model,this.bottom,t):null}getHoleShape(t){return this.hole&&this.layerId==12?this.hole.getShape(t,this.center,this.rotation):null}buildBBox(){this.model.refreshBBox&&this.updateSmartPad();let t=this.model.buildBBox();return this.smartPad!=null&&t!=null?t.extendOfSize(this.smartPad.spotSize):t}getDimensionBBox(){return this.model.getBBox(!0)}getType(){return 9}getLines(){let t=this.buildBBox();if(t==null)throw new Error("Pad is Empty!!!");let e=[],r=new M(t.LL(),t.LR()),i=new M(t.LR(),t.UR()),n=new M(t.UR(),t.UL()),s=new M(t.UL(),t.LL()),a=new M(t.LL().add(t.UL()).mul(.5),t.UR().add(t.LR()).mul(.5)),l=new M(t.UL().add(t.UR()).mul(.5),t.LR().add(t.LL()).mul(.5));return e.push(r,i,n,s,a,l),e}};var q4=class q4{constructor(){this.layerMap=new Map;this.netHight=new Set;this.viaVisible=!0;this.forceHightRange=!1}static getInstance(){return q4.state==null&&(q4.state=new q4),q4.state}getState(t,e){return this.viaVisible?this.forceHightRange?this.layerMap.get(t)||this.netHight.has(e):this.layerMap.get(t):!1}setLayer(t,e){if(this.layerMap.get(t)!=e){if(this.layerMap.set(t,e),!this.viaVisible)return;let r=te.getInstance().getAllBlindPhysics();for(let i of r){let n=i.getBlindVia(t);if(n!=null)for(let s of n.status.used){let a=Hr.getItem(s);a!=null&&this.updateVia(a)}}}}setHighlight(t,e){let r=new Set;for(let i of t)(e&&!this.netHight.has(i)||!e&&this.netHight.has(i))&&(e?this.netHight.add(i):this.netHight.delete(i),r.add(i));this.viaVisible&&this.netChangeAction(r)}setForceHightRange(t){if(this.forceHightRange!=t){if(this.forceHightRange=t,!this.viaVisible)return;let e=this.netHight;this.netChangeAction(e)}}netChangeAction(t){if(t.size==0)return;let e=te.getInstance().getAllBlindPhysics();for(let[r,i]of this.layerMap)if(!i)for(let n of e){let s=n.getBlindVia(r);if(s!=null)for(let a of s.status.used){let l=Hr.getItem(a);if(l!=null){if(!t.has(l.net))continue;this.updateVia(l)}}}}setVisible(t){this.viaVisible!=t&&(this.viaVisible=t,this.viaVisibleChangeAction())}viaVisibleChangeAction(){let t=te.getInstance().getAllBlindPhysics();for(let e of t){let r=e.getAllVias();for(let i of r)for(let n of i.status.used){let s=Hr.getItem(n);s!=null&&this.updateVia(s)}}}changeNet(t,e,r){r.type==1&&this.viaVisible&&(this.netHight.has(e)||this.netHight.has(t))&&this.updateVia(r,e)}updateVia(t,e){this.getState(t.name,e||t.net)?(t.updateFilterVisible=!0,t.visible()):t.hidden()}};q4.state=null;var Jb=q4;var Ge=class extends ds{constructor(e){super();this.highlightByComponent=!1;C0(e),this.model=e,e.setModelWatcher(this),this.initRefreshRender(),jo("editor/shape/Via")}get expansionType(){return this.model.expansionType}set expansionType(e){this.model.expansionType=e,C0(this.model),this.refreshRender()}initVisible(){super.initVisible(),this.isVisible&&this.visible()}get selectItem(){return this.hasDataState(9)}set selectItem(e){this.hasDataState(9)!=e&&(this.setDataState(9,e),this.refreshRender())}get type(){return this.model.type}set type(e){if(this.model.type!=e){if(e==1){let r=te.getInstance().getDefaultBlindPhysics().getFirst();if(r==null)return;this.model.type=e,this.model.viaBaseInfo=Ea.getViaBaseInfo(r.startLayer,r.endLayer,this.model.radius,this.model.holeRadius),this.model.name=r.name,r.status.used.add(this.globalIndex),this.updateFilterVisible=!0,this.visible()}else{let i=te.getInstance().getDefaultBlindPhysics().getBlindVia(this.model.name);i==null||i.status.used.delete(this.globalIndex),this.model.type=e,this.model.viaBaseInfo=Ea.getViaBaseInfo(1,2,this.model.radius,this.model.holeRadius),this.model.name="",this.updateFilterVisible=!0,this.refreshFilterVisible(!1)}this.refreshRender()}}get isSuture(){return this.model.type==2}get color(){return Oo.getInstance().viaConfig.getCustomColor(this.globalIndex)||ze.getSpecialColor(this.net)}set color(e){Oo.getInstance().viaConfig.setCustomColor(this.globalIndex,e),this.refreshRender()}get name(){return this.model.name}set name(e){if(this.model.name!=e){let r=te.getInstance().getDefaultBlindPhysics(),i=r.getBlindVia(this.model.name);i==null||i.status.used.delete(this.globalIndex),this.model.name=e;let n=r.getBlindVia(this.model.name);n!=null&&this.type==1&&(n.status.used.add(this.globalIndex),this.model.viaBaseInfo=Ea.getViaBaseInfo(n.startLayer,n.endLayer,this.model.radius,this.model.holeRadius),this.updateFilterVisible=!0,this.visible(),this.refreshRender())}}visible(e=!1){this.type==1?te.getInstance().getDefaultBlindPhysics().getBlindVia(this.model.name)!=null&&(Jb.getInstance().getState(this.name,this.net)?super.visible(e):this.hidden()):super.visible(e)}get startLayer(){return this.model.startLayer}set startLayer(e){this.model.startLayer=e,this.refreshRender()}get endLayer(){return this.model.endLayer}set endLayer(e){this.model.endLayer=e,this.refreshRender()}get unusedInnerLayers(){return this.model.unusedInnerLayers}set unusedInnerLayers(e){this.model.unusedInnerLayers=e,this.refreshRender()}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}get showNet(){return this.model.showNet}set net(e){if(this.model.net!=e){ze.delete(this);let r=this.model.net;this.model.net=e,Jb.getInstance().changeNet(r,e,this),ze.addItem(this),this.refreshRender()}}get radius(){return this.model.radius}set radius(e){this.model.radius=e,this.refreshRender()}get center(){return this.model.center}set center(e){this.model.center=e,this.refreshRender()}get holeRadius(){return this.model.holeRadius}set holeRadius(e){this.model.holeRadius=e,this.refreshRender()}get layerId(){return this.model.layerId}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get topExpansion(){return this.model.topExpansion}set topExpansion(e){this.model.topExpansion=e,this.refreshRender()}get viaBaseInfo(){return this.model.viaBaseInfo}set viaBaseInfo(e){this.model.viaBaseInfo=e,this.refreshRender()}get viaExpansion(){return this.model.viaExpansion}set viaExpansion(e){let r=this.model.viaExpansion.expansionType;this.model.viaExpansion=e,r!==e.expansionType&&C0(this.model),this.refreshRender()}get bottomExpansion(){return this.model.bottomExpansion}set bottomExpansion(e){this.model.bottomExpansion=e,this.refreshRender()}get holeColor(){var i,n;let e=ee.BLACK,r=(n=(i=ce)==null?void 0:i.themeConfig)==null?void 0:n.canvasTheme;if(r&&this.type===0){e=r.getHoleColor(!0,Oo.getInstance().padConfig.getSelectAlpha(this.selectItem));let s=Bt.getTransparencyByPcbType(this,e);s&&e.alpha!=s&&(e=ee.of6(e,s))}return e}get layerPairStr(){if(!ga.getInstance().viaShowPair)return"";let e=this.startLayer,r=this.endLayer,i=a(e),n=a(r);return i<n?`${i}-${n}`:`${n}-${i}`;function a(l){return l==1?1:l==2?be.configInnerLayers.size+2:l-15+2}}get usedLayers(){let e=[];if(this.unusedInnerLayers.length>0){let r=$e.getInstance().getAllCopperLayerIds();this.type==1?e=r.filter(i=>this.isContains(i)&&!this.unusedInnerLayers.includes(i)):e=r.filter(i=>!this.unusedInnerLayers.includes(i))}return e}get allLayers(){return be.getAllCopperLayerIds()}get grayIndex(){return be.getGrayIndex()}get netModified(){return this.model.netModified}get radiusModified(){return this.model.radiusModified}get holeRadiusModified(){return this.model.holeRadiusModified}get topExpansionModified(){return this.model.topExpansionModified}get bottomExpansionModified(){return this.model.bottomExpansionModified}get viewGroupId(){return this.model.modelType+this.net+"_mask"}get viewGroupIdModified(){return this.netModified}get wireViewGroupId(){return this.model.modelType+this.net+"_mask_W"}get holeViewGroupId(){return this.viewGroupId+"_hole"}get maxShapeLayer(){let e=this.topExpansion,r=this.bottomExpansion,i=this.holeRadius-this.radius;return e>0&&e>r&&e>i?5:r>0&&r>i?6:i>0?47:12}isContains(e){return this.model.isContains(e)}buildBBox(){return this.model.buildBBox()}getOneInnerInUse(){return this.model.getOneInnerInUse()}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i),this.refreshRender()}remove(){let e=this.searchNode();if(e.length<10)for(let r of e)A.publish("hasModifyPcbItem",r);this.clearRatlines(),this.model.remove(),super.remove(),Oo.getInstance().viaConfig.setCustomColor(this.globalIndex,null)}transform(e){this.model.transform(e),this.refreshRender()}isSelect(e,r){return this.model.inShape(e,r)}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,type:this.type,name:this.name,startLayer:this.startLayer,endLayer:this.endLayer,unusedInnerLayers:this.unusedInnerLayers,net:this.net,radius:this.radius,center:this.center,holeRadius:this.holeRadius,locked:this.locked,expansion:this.expansionType,topExpansion:this.topExpansion,bottomExpansion:this.bottomExpansion,isSuture:this.isSuture}}getMathGraphics(e=this.model.layerId,r=0){if(this.isEmpty)return null;if(e==12||e===47)return fe.build2([q.build3(this.center,0,-360,this.holeRadius,this.holeRadius)]);if([5,6].includes(e)){let i=e==5?this.topExpansion:this.bottomExpansion,n=this.radius+i;return n<=0?null:fe.build2([q.build3(this.center,0,-360,n,n)])}else return fe.build2([q.build3(this.center,0,-360,this.radius+r,this.radius+r)])}getFileGraphics(e,r,i){if(this.isEmpty)return null;if(gr(e)){let n=[];if(i==null){let s=this.getOneInnerInUse();s==null?i=[]:i=[s]}for(let s of i){let a=this.getMathGraphics(s,r);a!=null&&n.push(a)}return n}else{let n=this.getMathGraphics(e,r);return n!=null?[n]:[]}}getType(){return this.type==1?2:23}refreshRatlinePosition(){var i;if(!((i=be.getLayer(57))==null?void 0:i.visible))return;let r=this.center;this.iteratorRatlines(n=>{n.isVisible&&(n.startNode==this&&!n.start.equals(r)&&(n.start=r,n.click()),n.endNode==this&&!n.end.equals(r)&&(n.end=r,n.click()))})}refreshRender(){this.refreshRatlinePosition(),super.refreshRender()}};function sg(o,t,e,r){if(o==="Partition")return 1004;if(t===52)return 1;let i=be.getLayer(t);if(i==null)return t;switch(o){case"Line":if(i&&!gr(i.layerID)&&47!=i.layerID&&i.layerID!=57&&!IA(i.layerID)&&!ba(i.layerID)&&!_c(i.layerID))return i.layerID;if(t==1002)return t;break;case"Copper Region":case"TearDrop":if(i&&i.isSignalLayer())return i.layerID;break;case"Prohibited Region":if(gr(i.layerID)||i.isSignalLayer()||i.isPlaneLayer())return i.layerID;break;case"Constraint Region":return gr(i.layerID)||i.isSignalLayer()||i.isPlaneLayer()?i.layerID:12;case"Cutout":case"Fill Region":if(!gr(i.layerID)&&!U2(i.layerID)&&!i.isPlaneLayer()&&!i.isDrillLayer()&&47!=i.layerID&&i.layerID!=57&&!ba(i.layerID)&&!_c(i.layerID)&&!(e!==0&&t===49))return i.layerID;break;case"FPC Stiffener":return[58,59].includes(i.layerID)?i.layerID:ms(i.layerID)?59:58;case"Board Outline":return 11;case"Slot Region":return 12;case"3D Shell - Outline":case"3D Shell - Side Entity":case"3D Shell - Side Datum Line":case"3D Shell - Side Slot Region":return 53;case"3D Shell - Top Slot Region":case"3D Shell - Screw Pillar":case"3D Shell - Top/Bottom Entity":return[54,55].includes(i.layerID)?i.layerID:54}return r||1}function $4(){let o=be.getActiveLayerID(),t=$e.getInstance();return o==3||o==4||o==13||t.isCustomLayer(o)||Nte(o)?o:13}var iSe=class{constructor(){this.fillComponent={style:"solid",gridLineWidth:1,clearance:2,keepIsland:!1,optimization:!0,optimizationValue:.8};this.prohibitComponent={device:!0,track:!1,copper:!1,fill:!1,planzone:!1};this.d3ShellScrewPillarComponent={specification:"M2"};this.d3ShellSlotRegionComponent={slotOption:[4,8,16]};this._defaultSlotOption=[4,8,16]}get defaultSlotOption(){return this._defaultSlotOption}syncFillData(t){let{style:e,gridLineWidth:r,clearance:i,keepIsland:n,optimization:s,optimizationValue:a}=t;this.fillComponent.style=e,this.fillComponent.gridLineWidth=r,this.fillComponent.clearance=i,this.fillComponent.keepIsland=n,this.fillComponent.optimization=s,this.fillComponent.optimizationValue=a}updateFillComponent(t){t.style=this.fillComponent.style,t.gridLineWidth=this.fillComponent.gridLineWidth,t.clearance=this.fillComponent.clearance,t.keepIsland=this.fillComponent.keepIsland,t.optimization=this.fillComponent.optimization,t.optimizationValue=this.fillComponent.optimizationValue}syncProhibitData(t){let{device:e,track:r,copper:i,fill:n,planzone:s}=t;this.prohibitComponent.device=e,this.prohibitComponent.track=r,this.prohibitComponent.copper=i,this.prohibitComponent.fill=n,this.prohibitComponent.planzone=s}updateProhibitComponent(t){t.device=this.prohibitComponent.device,t.fill=this.prohibitComponent.fill,t.track=this.prohibitComponent.track,t.planzone=this.prohibitComponent.planzone,t.copper=this.prohibitComponent.copper}syncD3ShellScrewPillarData(t){let e=t.specification;this.d3ShellScrewPillarComponent.specification=e!=="Custom"?e:"M2"}syncD3ShellSlotRegionComponentData(t){this._defaultSlotOption=Array.from(t.slotOption)}},Tm=new iSe;var nSe={cursor:{color:{value:"#00FFFF"},borderStyle:{value:"dotted"}},background:{color:{value:"#000000"}},boardShape:{color:{value:"#6D6A69"},borderStyle:{value:"solid"},borderColor:{value:"#000000"}},grid:{color:{value:"#FFFFFF"},transparency:{value:"0.7"}},boldGrid:{color:{value:"#FFFFFF"},transparency:{value:"0.5"}},coordinateAxis:{color:{value:"#FFFFFF"},transparency:{value:"0.2"}},"Select Box":{color:{value:"#00FFFF"},borderStyle:{value:"dotted"}},select:{color:{value:"",tag:"default",tagValue:"#000000"},transparency:{value:"0.5"}},hoverHighlight:{color:{value:"",tag:"default",tagValue:"#000000"},transparency:{value:"0.5"}},metallicDrilling:{color:{value:"47",tag:"followLayerId",tagValue:"47"},transparency:{value:"0"}},unMetallicDrilling:{color:{value:"47",tag:"followLayerId",tagValue:"47"},transparency:{value:"0"}},pad:{transparency:{value:"0"}},via:{transparency:{value:"0"}},track:{transparency:{value:"0"}},copperRegion:{transparency:{value:"0.3"},borderColor:{value:"",tagValue:"#000000"},borderStyle:{value:"dotted"}},solidRegion:{transparency:{value:"0.3"},borderColor:{value:"",tagValue:"#000000"},borderStyle:{value:"solid"}},prohibitedRegion:{color:{value:"#9966FF"},transparency:{value:"0"},borderColor:{value:"",tagValue:"#000000"},borderStyle:{value:"solid"}},constraintRegion:{color:{value:"",tag:"followLayerId",tagValue:""},transparency:{value:"0.5"},borderColor:{value:"",tagValue:"#000000"},borderStyle:{value:"solid"}},colorfulImage:{transparency:{value:"0.5"}},annotation:{borderColor:{value:"#00CCFF"},borderStyle:{value:"solid"}},partition:{color:{value:"#FFFFFF"},transparency:{value:"100"},borderColor:{value:"#C0C0C0"},borderStyle:{value:"solid"}}};var K4=class K4{constructor(){this.nameManager=new Q0}static getInstance(){return K4.manager==null&&(K4.manager=new K4),K4.manager}getName(t="constraint1"){return this.nameManager.getNum(t)}hasName(t){return this.nameManager.has(t)}addName(t){this.nameManager.add(t)}deleteName(t){this.nameManager.deleteNum(t)}};K4.manager=null;var wf=K4;function j8(o){if(o.type==0)return $e.getInstance().getUseLayer().map(r=>r.layerId);let t=new Set;return o.connects.forEach(e=>{let r=pc(e);r&&t.add(r.layerId)}),Array.from(t)}var nr=class extends Ye{constructor(e){super();this._notShowFill=!1;this._selectChildId=null;if(this.model=e,e.setModelWatcher(this),this.layerId=sg(this.type,this.layerId,1),this.net=wu(this.net,this.layerId,this.type),Lf(this.type,this.model.component,this.model.layerId)||(this.model.component=V1(1,this.model)),this.type==="Constraint Region"){let r=te.getInstance().addConstraintSelector(this.globalIndex);Xp.getInstance().publish("modify",r)}eP(this.model.component),this.initRefreshRender()}get component(){return this.getComponent()}get color(){return super.color||$A.getLineColor(this)}set color(e){super.color=e,this.refreshRender()}get type(){return this.model.type}set type(e){if(this.model.type!=e){if(this.hiddenCopperResult=!1,this.model.type=="Copper Region"?(Ei.nameManager.deleteNum(this.component.name),this.deleteRegionRuleSelector()):this.model.type==="Constraint Region"?(wf.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()):this.model.type==="Partition"&&(Dn.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()),e==="Constraint Region"){let i=te.getInstance().addConstraintSelector(this.globalIndex);Xp.getInstance().publish("modify",i)}let r=this.model.type;this.model.type=e,this.model.component=V1(1,this.model),this.layerId=sg(e,this.layerId,1),this.strokeWidth=n8(this.strokeWidth,this.model.type,r),this.net=wu(this.net,this.layerId,this.type),eP(this.model.component),this.refreshRender()}}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=sg(this.type,e,1,this.model.layerId),this.checkRegion(1),this.refreshRender()}get rotation(){return this.model.rotation}set rotation(e){this.model.rotation=e,this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}get showNet(){return this.model.showNet}set net(e){if(this.model.net!=e){ze.delete(this),this.model.net=e;let r=be.getLayer(this.layerId);r&&r.isSignalLayer()&&ze.addItem(this)}}get start(){return this.model.start}set start(e){this.model.start=e,this.refreshRender()}get width(){return this.model.width}set width(e){this.model.width=e,this.refreshRender()}get height(){return this.model.height}set height(e){this.model.height=e,this.refreshRender()}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e,this.refreshRender(),this.type=="3D Shell - Outline"&&(this.component.shellThickness=this.strokeWidth)}get cornerRadius(){return this.model.radius}get realCornerRadius(){return this.model.realCornerRadius}set cornerRadius(e){this.model.radius=e,this.refreshRender()}get leftLow(){return this.getLL()}get leftUp(){return this.getUL()}get rightUp(){return this.getUR()}get rightLow(){return this.getLR()}get radius(){return this.realCornerRadius}get viewColor(){var n,s;let e=this.color,r=(s=(n=ce)==null?void 0:n.themeConfig)==null?void 0:s.canvasTheme;r&&(e=r.getRegionColor(this,e));let i=Bt.getTransparencyByPcbType(this,e);return i!=null&&e.alpha!=i&&(e=ee.of6(e,i)),e}get fillColor(){var n,s;let e=super.color||$A.getFillColor(this),r=(s=(n=ce)==null?void 0:n.themeConfig)==null?void 0:s.canvasTheme;r&&(e=r.getRegionColor(this,e));let i=Bt.getTransparencyByPcbType(this,e);return i!=null&&e.alpha!=i&&(e=ee.of6(e,i)),e}get partitionName(){return this.component instanceof Dc?this.component.name:""}get constrainName(){return this.component instanceof nu?this.component.name:""}get fpcMaterial(){return this.component instanceof Du?this.component.material:""}get fpcThickness(){return this.component instanceof Du?this.component.thickness:""}get layers(){return this.type=="Annotation"?j8(this.component):[]}get viewGroupId(){return this.model.component instanceof ln&&this.model.component.isBridgingCopper?this.model.modelType+null:this.model.modelType+this.net}get viewGroupIdModified(){return this.netModified}isSelectChild(){return this._selectChildId!=null}getSelectChildId(){return this._selectChildId}get selectChildId(){return this._selectChildId}getSelectLine(){let e=this.model.polyline.primitives,r=this._selectChildId/2,i=0;for(let n=0;n<e.length;n++){let s=e[n];if(s instanceof M){if(i==r)return s;i++}}return null}clearSelectChildId(){this._selectChildId=null}selectChild(e,r){let i=new S(e,r);this._selectChildId=S8e(this.leftLow.add(this.leftUp).mul(.5),this.rightLow.add(this.rightUp).mul(.5),this.height,2*this.realCornerRadius/Math.min(this.width,this.height),this.strokeWidth,i,Ni().getScale())}fill(){this.isEmpty||!this.notShowFill||(this.notShowFill=!1,this.refreshRender())}removeFill(){this.notShowFill=!0,this.refreshRender()}visible(e=!1){this.fill(),this._selectChildId=null,super.visible(e)}hidden(){this.fill(),this._selectChildId=null,super.hidden()}click(e=!1,r=!1){this.fill(),super.click(e,r)}remove(){this.type=="Copper Region"?(Ei.nameManager.deleteNum(this.component.name),this.clearCopper(),this.deleteRegionRuleSelector()):this.type=="Constraint Region"?(wf.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()):this.type=="Partition"&&(Dn.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()),super.remove()}getComponent(){return this.model.component}setComponent(e){Lf(this.type,e,this.model.layerId)&&(this.model.component=e,eP(this.model.component))}getPointByIndex(e){switch(e){case 2:return this.getLL();case 0:return this.getUL();case 3:return this.getLR();case 1:return this.getUR();default:return null}}setLL(e){this.model.leftLow=e,this.refreshRender()}getLL(){return this.model.leftLow}setLR(e){this.model.rightLow=e,this.refreshRender()}getLR(){return this.model.rightLow}setUR(e){this.model.rightUp=e,this.refreshRender()}getUR(){return this.model.rightUp}setUL(e){this.model.leftUp=e,this.refreshRender()}getUL(){return this.model.leftUp}getEndPoints(){return this.model.getEndPoints()}getMidPoints(){return this.model.getMidPoints()}getArcCenterPoints(){return this.model.getArcCenterPoints()}getLines(){return this.model.getLines()}getArcs(){return this.model.getArcs()}getHoveredArc(e,r){let{strokeWidth:i,realCornerRadius:n}=this;return this.getArcs().filter(a=>xf(new S(e,r),a.center,n,Ht.toRadians(a.startAngle),Ht.toRadians(a.endAngle()),a.sweep(),i))[0]}getHoveredLine(e,r){let i=[],{strokeWidth:n,realCornerRadius:s}=this;i.push(...this.getLines(),...this.getArcs());let a=new S(e,r);return i.filter(l=>l instanceof M?Xa(a,l.start(),l.end(),n):xf(a,l.center,s,Ht.toDegrees(l.startAngle),Ht.toDegrees(l.endAngle()),l.sweep(),n))[0]}getPolyline(){return this.model.polyline}getStrokeWidth(){return this.model.strokeWidth}getAllLinesInOrder(){return this.model.getAllLinesInOrder()}rotateFor(e,r){this.model.rotateFor(e,r),this.refreshRender()}transform(e){this.removeFill(),this.model.transform(e),this.refreshRender()}refreshRender(){var e;this.model!=null&&((e=be.getLayer(57))!=null&&e.visible)&&this.iteratorRatlines(i=>{i.isVisible&&(i.startNode==this&&!i.start.equals(this.start)&&(i.start=this.start,i.click()),i.endNode==this&&!i.end.equals(this.start)&&(i.end=this.start,i.click()))}),super.refreshRender()}isSelect(e,r,i){if(this.getParent()!=null)return!1;let n=this.model.inShape(e,r,i?Ni():void 0);return this.type=="Copper Region"&&(this.needShowOutline()||(n=!1)),this.type=="Copper Region"&&this.isHighLight?n||this.isInInnerArea(e,r):n}isInInnerArea(e,r){return this.model.InnerArea(e,r)}isSelectOnlyLine(e,r){return!this.isVisible||this.getParent()!=null?!1:this.model.isSelectOnlyLine(e,r)}isInProfile(e,r){return this.isVisible?this.model.inShape(e,r):!1}toJSON(){var s;let e;this.type==="Constraint Region"&&(e=te.getInstance().getRegion(this.globalIndex).clone());let r=this.getComponent(),i=r&&typeof r.toJSON=="function"?r.toJSON():null;return{globalIndex:this.globalIndex,partition:this.partition,type:this.type,layerId:this.layerId,start:this.start,width:this.width,height:this.height,cornerRadius:this.cornerRadius,net:this.net,locked:this.locked,strokeWidth:this.strokeWidth,rotation:this.rotation,silkColor:((s=this.silkColor)==null?void 0:s.toString())||null,componentData:i,regionRuleSelector:e}}getMathGraphics(e=this.layerId,r=0){return this.model.getMathGraphics(e)}inActiveLayer(e){return this.type=="Annotation"?(this.component==null,!0):e==this.layerId}buildBBox(){return this.model.buildBBox()}getType(){return 24}getViewState(){return this.isEmpty?"Not Shown":this.isVisible?this.notShowFill?this.needShowOutline()?"Not Show Fill":"Not Shown":this.isHighLight?"Main And Highlight":this.needShowOutline()?"Only Main":"Not Shown":"Not Shown"}setSelectChildIdByOver(e){this._selectChildId=e}};var IR=class IR{constructor(){this._autoGenerate=!1;this._outlineCollect=new Map;this._bbox=new _e}static getInstance(){return IR.instance||(IR.instance=new IR),IR.instance}get outlineCollect(){return this._outlineCollect}get bbox(){return this._bbox}set bbox(t){this._bbox=t}get autoGenerate(){return this._autoGenerate&&!this._board}set autoGenerate(t){this._autoGenerate=t}set board(t){this._autoGenerate&&t&&(this.outlineCollect.clear(),this.bbox=new _e),t?Ys.getInstance().isBoard=!0:Ys.getInstance().isBoard=!1,this._board=t}get board(){return this._board}static getValidProfile(t){return!["Annotation","TearDrop","Partition"].includes(t)}getShape(t){let e=0,r=new Array(t.childrens.length);for(let i of t.childrens){let n=new Array(i.length),s=0;for(let a of i)a instanceof ys?n[s++]=$u.addByModel(a):n[s++]=qc.addArcByModel(a);r[e++]=n}return r}deleteBoard(t){t==this.board&&(this.board=null)}addBoard(t,e=!1){if(this.board&&!e)return null;switch(t.modelType){case"Rect":this.board=new nr(t);break;case"Circle":this.board=new Sr(t);break;case"Polygon":this.board=new ct(t,this.getShape(t));break}return this.board}};IR.id="board",IR.width=.02;var Cs=IR;var Iie=class Iie{constructor(t){this._changeMaps=null;this.profileColorMap=new Map;this.profileStyleMap=new Map;this._param=null;this._isBoard=!1;this._param=t||Ls(nSe)}static getInstance(t){return this._instance==null&&(this._instance=new Iie(t)),this._instance}set isBoard(t){t!=this._isBoard&&(this._isBoard=t,this.backgroundColor=this.backgroundColor)}checkSetting(t){let e=Ls(nSe);if(!t)return this._changeMaps=null,e;this._changeMaps=[];for(let r in e){let i=e[r];if(!t[r])t[r]=i,this._changeMaps.push(r);else{let n=this._param&&this._param[r],s=t[r];this.itemEquals(n,s)||this._changeMaps.push(r)}}return t}itemEquals(t,e){return!t&&!e?!0:t&&e?this.contentDataItemEquals(t.borderColor,e.borderColor)&&this.contentDataItemEquals(t.borderStyle,e.borderStyle)&&this.contentDataItemEquals(t.color,e.color)&&this.contentDataItemEquals(t.transparency,e.transparency):!1}contentDataItemEquals(t,e){var r,i;return!t&&!e?!0:!(!(t&&e)||((r=t.value)==null?void 0:r.toLowerCase())!=((i=e.value)==null?void 0:i.toLowerCase())||(t.tag||"")!=(e.tag||"")||(t.tagValue||"")!=(e.tagValue||""))}updateAll(t){this._param=this.checkSetting(t),Oo.getInstance().padConfig.setShapeAlpha(1-this.padTransparency),Oo.getInstance().viaConfig.setShapeAlpha(1-this.viaTransparency),Oo.getInstance().trackConfig.setShapeAlpha(1-this.trackTransparency),this.backgroundColor=this.backgroundColor,this.gridColor=this.gridColor,this.gridTransparency=this.gridTransparency,this.boldGridColor=this.boldGridColor,this.boldGridTransparency=this.boldGridTransparency,this.coordinateAxisColor=this.coordinateAxisColor,this.coordinateAxisTransparency=this.coordinateAxisTransparency,this.partitionBorderColor=this.partitionBorderColor,this.partitionColor=this.partitionColor,this.partitionLineStyle=this.partitionLineStyle,this.partitionTransparency=this.partitionTransparency,this.colorfulImageTransparency=this.colorfulImageTransparency,this.refreshRender()}updateSelectAlpha(t){if(t!=null){let e=1-t/100;Oo.getInstance().padConfig.setSelectAlpha(e),Oo.getInstance().viaConfig.setSelectAlpha(e)}}hasChangeKey(t){return this._changeMaps?t.some(e=>this._changeMaps.includes(e)):!0}refreshRender(){var r;let t=!1;H8e(),t=t||this.hasChangeKey(["select","hoverHighlight"]),(t||this.hasChangeKey(["metallicDrilling","unMetallicDrilling","pad"]))&&Kt.getAllItem().forEach(i=>i.refreshRender()),(t||this.hasChangeKey(["via"]))&&Hr.getAllItem().forEach(i=>i.refreshRender()),(t||this.hasChangeKey(["track"]))&&pr.getAllItem().forEach(i=>i.refreshRender()),(t||this.hasChangeKey(["copperRegion"]))&&Ei.getAllItem().forEach(i=>i.refreshRender()),(t||this.hasChangeKey(["boardShape"])||this.hasChangeKey(["background"]))&&((r=Cs.getInstance().board)==null||r.refreshRender());let e=["copperRegion","solidRegion","prohibitedRegion","constraintRegion","annotation","partition"].map(i=>t||this.hasChangeKey([i]));Xt.getAllItem().concat(Zt.getAllItem()).concat(pt.getAllItem()).forEach(i=>{switch(i.type){case"Copper Region":{e[0]&&i.refreshRender();break}case"Fill Region":{e[1]&&i.refreshRender();break}case"Prohibited Region":{e[2]&&i.refreshRender();break}case"Constraint Region":{e[3]&&i.refreshRender();break}case"Annotation":{e[4]&&i.refreshRender();break}case"Partition":{e[5]&&i.refreshRender();break}}}),(t||this.hasChangeKey(["colorfulImage"]))&&_o.getAllItem().forEach(i=>i.refreshRender())}isSolidLine(t){return t==="solid"}getParam(t){return this._param[t]}getCommonColor(t){var i;let e=ee.BLACK;if(!t)return console.warn("has no color content!"),ee.BLACK;let r=t.value;if(t.tag==="followLayerId")return be.getLayer(+r)?ee.BLACK:null;if(r){if(!r)return e;r==="#000000"&&t.tag!="default"&&((i=t.tagValue)!=null&&i.startsWith("#"))&&(r="#000001");try{return ee.of3(r)}catch{return e}}return e}setCommonColor(t,e){if(e&&t){let r=e.toString();t.value=r,e instanceof ee?t.tag="":t.tag="followLayerId"}}getColor(t){return this.getCommonColor(t==null?void 0:t.color)}setColor(t,e){this.setCommonColor(t==null?void 0:t.color,e)}getBorderColor(t){return this.getCommonColor(t==null?void 0:t.borderColor)}setBorderColor(t,e){return this.setCommonColor(t==null?void 0:t.borderColor,e)}getTransparency(t){let e=parseFloat(t&&t.transparency&&t.transparency.value);return isNaN(e)?0:e}normalAlpha(t){return isNaN(t)?0:Math.min(Math.max(t,0),1)}setTransparency(t,e){if(t!=null&&t.transparency&&!isNaN(e)){e=Math.min(Math.max(e,0),1);let r=e.toString();t.transparency.value=r}}getLineStyle(t){return t&&t.borderStyle&&t.borderStyle.value}setLineStyle(t,e){t!=null&&t.borderStyle&&e&&(t.borderStyle.value=e)}getHoleColor(t,e=1){let r=t?this.metallicDrillingColor:this.unMetallicDrillingColor,n=(1-(t?this.metallicDrillingTransparency:this.unMetallicDrillingTransparency))*e;return r||(r=ee.BLACK),r=ee.of6(r,n),r}getRegionColor(t,e){let r=-1,i=e||t.color,n=i;if(t.type=="Copper Region"?r=1-this.copperRegionTransparency:t.type=="Fill Region"?r=1-this.solidRegionTransparency:t.type=="Prohibited Region"?(n=this.prohibitedRegionColor,n||(n=ee.BLACK||i),r=1-this.prohibitedRegionTransparency):t.type==="Constraint Region"?(n=this.constraintRegionColor,n||(n=ee.BLACK||i),r=1-this.constraintRegionTransparency):t.type==="Partition"?(n=this.partitionColor,n||(n=ee.of3("#C0C0C0")),r=1-this.partitionTransparency):t.type=="Annotation"&&(n=this.annotationBorderColor,r=1-.3),n==null)throw new Error("Region Color Error!!!");return r>=0?ee.of6(n,r):n}getRegionLineStyle2(t,e=ee.BLACK){let r=ee.BLACK,i="solid",n=!1,s=null;return t=="Copper Region"?(r=this.copperRegionBorderColor,i=this.copperRegionLineStyle,n=!0):t=="Fill Region"?(r=this.solidRegionBorderColor,i=this.solidRegionLineStyle):t==="Prohibited Region"?(r=this.prohibitedRegionBorderColor,i=this.prohibitedRegionLineStyle):t==="Constraint Region"?(r=this.constraintRegionBorderColor,i=this.constraintRegionLineStyle):t==="Partition"?(r=this.partitionBorderColor||ee.of3("#C0C0C0"),i=this.partitionLineStyle||"solid"):t=="Annotation"?(r=this.annotationBorderColor,i=this.annotationLineStyle):t=="TearDrop"?n=!0:t=="Segment"?(r=this.selectBoxColor,i=this.selectBoxLineStyle):t=="Board"&&(r=this.boardBorderColor,i=this.boardLineStyle,s=this.boardColor,i=="none"&&(r=this.backgroundColor)),r||(r=e),t==="Partition"&&i==="none"&&(r=ee.of2(r.r,r.g,r.b,0)),{lineColor:r,lineSolid:i==="none"?!0:i==="solid",lineNone:i==="none",isPixel:n,color:s}}getRegionLineStyle(t,e){let{defaultLineColor:r}=e||{},i=t.type,n=this.profileColorMap.get(i),s=this.profileStyleMap.get(i),a=!1;return(n==null||s==null)&&(i=="Copper Region"?(n=this.copperRegionBorderColor,s=this.copperRegionLineStyle):i=="Fill Region"?(n=this.solidRegionBorderColor,s=this.solidRegionLineStyle):i==="Prohibited Region"?(n=this.prohibitedRegionBorderColor,s=this.prohibitedRegionLineStyle):i==="Constraint Region"?(n=this.constraintRegionBorderColor,s=this.constraintRegionLineStyle):i==="Partition"?(n=this.partitionBorderColor||ee.of3("#C0C0C0"),s=this.partitionLineStyle||"solid"):i=="Annotation"?(n=this.annotationBorderColor,s=this.annotationLineStyle):i=="TearDrop"?(n=t.color,s="solid",a=!0):i=="Board"?(n=this.boardBorderColor,s=this.boardLineStyle,s==="none"&&(n=this.backgroundColor)):(n=t.color,s="solid")),n||(n=r||ee.BLACK||t.color),t.type==="Partition"&&s==="none"&&(n=ee.of2(n.r,n.g,n.b,0)),a||(a=s=="dotted"),{lineColor:n,lineSolid:s==="none"?!0:s==="solid",lineNone:s==="none",isPixel:a}}cursorParam(){return this.getParam("cursor")}get cursorColor(){return this.getColor(this.cursorParam())}set cursorColor(t){this.setColor(this.cursorParam(),t)}get cursorLineStyle(){return this.getLineStyle(this.cursorParam())}set cursorLineStyle(t){this.setLineStyle(this.cursorParam(),t)}backgroundParam(){return this.getParam("background")}get backgroundColor(){return this.getColor(this._isBoard?this.boardParam():this.backgroundParam())}set backgroundColor(t){let e=this.backgroundColor;e.equals(t)||(this.setColor(this.backgroundParam(),t),e=this.backgroundColor),x.getInstance().backgroundColor=e}get rulerBackgroundColor(){return x.getInstance().rulerBackgroundColor}set rulerBackgroundColor(t){t&&(x.getInstance().rulerBackgroundColor=t)}get rulerStringColor(){return x.getInstance().rulerStringColor}set rulerStringColor(t){t&&(x.getInstance().rulerStringColor=t)}gridParam(){return this.getParam("grid")}get gridColor(){return this.getColor(this.gridParam())}set gridColor(t){this.setColor(this.gridParam(),t);let e=this.gridColor;e&&(St.getInstance().gridColor=e)}get gridTransparency(){return this.getTransparency(this.gridParam())}set gridTransparency(t){this.setTransparency(this.gridParam(),t),St.getInstance().transparency=this.gridTransparency}boldGridParam(){return this.getParam("boldGrid")}get boldGridColor(){return this.getColor(this.boldGridParam())}set boldGridColor(t){this.setColor(this.boldGridParam(),t);let e=this.boldGridColor;e&&(St.getInstance().multiGridColor=e)}get boldGridTransparency(){return this.getTransparency(this.boldGridParam())}set boldGridTransparency(t){this.setTransparency(this.boldGridParam(),t),St.getInstance().multiTransparency=this.boldGridTransparency}coordinateAxisParam(){return this.getParam("coordinateAxis")}get coordinateAxisColor(){return this.getColor(this.coordinateAxisParam())}set coordinateAxisColor(t){this.setColor(this.coordinateAxisParam(),t);let e=this.coordinateAxisColor;e&&(St.getInstance().coordinateAxisColor=e)}get coordinateAxisTransparency(){return this.getTransparency(this.coordinateAxisParam())}set coordinateAxisTransparency(t){this.setTransparency(this.coordinateAxisParam(),t),St.getInstance().coordinateAxisTransparency=this.coordinateAxisTransparency}selectBoxParam(){return this.getParam("Select Box")}get selectBoxColor(){return this.getColor(this.selectBoxParam())}set selectBoxColor(t){this.setColor(this.selectBoxParam(),t)}get selectBoxLineStyle(){return this.getLineStyle(this.selectBoxParam())}set selectBoxLineStyle(t){this.setLineStyle(this.selectBoxParam(),t)}selectParam(){return this.getParam("select")}get selectColor(){return this.getColor(this.selectParam())}set selectColor(t){this.setColor(this.selectParam(),t)}get selectTransparency(){return this.getTransparency(this.selectParam())}set selectTransparency(t){this.setTransparency(this.selectParam(),t)}hoverHighlightParam(){return this.getParam("hoverHighlight")}get hoverHighlightColor(){return this.getColor(this.hoverHighlightParam())}set hoverHighlightColor(t){this.setColor(this.hoverHighlightParam(),t)}get hoverHighlightTransparency(){return this.getTransparency(this.hoverHighlightParam())}set hoverHighlightTransparency(t){this.setTransparency(this.hoverHighlightParam(),t)}metallicDrillingParam(){return this.getParam("metallicDrilling")}get metallicDrillingColor(){return this.getColor(this.metallicDrillingParam())}set metallicDrillingColor(t){this.setColor(this.metallicDrillingParam(),t)}get metallicDrillingTransparency(){return this.getTransparency(this.metallicDrillingParam())}set metallicDrillingTransparency(t){this.setTransparency(this.metallicDrillingParam(),t)}unMetallicDrillingParam(){return this.getParam("unMetallicDrilling")}get unMetallicDrillingColor(){return this.getColor(this.unMetallicDrillingParam())}set unMetallicDrillingColor(t){this.setColor(this.unMetallicDrillingParam(),t)}get unMetallicDrillingTransparency(){return this.getTransparency(this.unMetallicDrillingParam())}set unMetallicDrillingTransparency(t){this.setTransparency(this.unMetallicDrillingParam(),t)}padParam(){return this.getParam("pad")}get padTransparency(){return this.getTransparency(this.padParam())}set padTransparency(t){Oo.getInstance().padConfig.setShapeAlpha(1-this.normalAlpha(t)),this.setTransparency(this.padParam(),t)}viaParam(){return this.getParam("via")}get viaTransparency(){return this.getTransparency(this.viaParam())}set viaTransparency(t){Oo.getInstance().viaConfig.setShapeAlpha(1-this.normalAlpha(t)),this.setTransparency(this.viaParam(),t)}trackParam(){return this.getParam("track")}get trackTransparency(){return this.getTransparency(this.trackParam())}set trackTransparency(t){Oo.getInstance().trackConfig.setShapeAlpha(1-this.normalAlpha(t)),this.setTransparency(this.trackParam(),t)}copperRegionParam(){return this.getParam("copperRegion")}get copperRegionTransparency(){return this.getTransparency(this.copperRegionParam())}set copperRegionTransparency(t){this.setTransparency(this.copperRegionParam(),t)}get copperRegionBorderColor(){return this.getBorderColor(this.copperRegionParam())}set copperRegionBorderColor(t){this.profileColorMap.delete("Copper Region"),this.setBorderColor(this.copperRegionParam(),t)}get copperRegionLineStyle(){return this.getLineStyle(this.copperRegionParam())}set copperRegionLineStyle(t){this.setLineStyle(this.copperRegionParam(),t)}solidRegionParam(){return this.getParam("solidRegion")}get solidRegionTransparency(){return this.getTransparency(this.solidRegionParam())}set solidRegionTransparency(t){this.setTransparency(this.solidRegionParam(),t)}get solidRegionBorderColor(){return this.getBorderColor(this.solidRegionParam())}set solidRegionBorderColor(t){this.setBorderColor(this.solidRegionParam(),t)}get solidRegionLineStyle(){return this.getLineStyle(this.solidRegionParam())}set solidRegionLineStyle(t){this.setLineStyle(this.solidRegionParam(),t)}prohibitedRegionParam(){return this.getParam("prohibitedRegion")}get prohibitedRegionColor(){return this.getColor(this.prohibitedRegionParam())}set prohibitedRegionColor(t){this.setColor(this.prohibitedRegionParam(),t)}get prohibitedRegionTransparency(){return this.getTransparency(this.prohibitedRegionParam())}set prohibitedRegionTransparency(t){this.setTransparency(this.prohibitedRegionParam(),t)}get prohibitedRegionBorderColor(){return this.getBorderColor(this.prohibitedRegionParam())}set prohibitedRegionBorderColor(t){this.setBorderColor(this.prohibitedRegionParam(),t)}get prohibitedRegionLineStyle(){return this.getLineStyle(this.prohibitedRegionParam())}set prohibitedRegionLineStyle(t){this.setLineStyle(this.prohibitedRegionParam(),t)}constraintRegionParam(){return this.getParam("constraintRegion")}get constraintRegionColor(){return this.getColor(this.constraintRegionParam())}set constraintRegionColor(t){this.setColor(this.constraintRegionParam(),t)}get constraintRegionTransparency(){return this.getTransparency(this.constraintRegionParam())}set constraintRegionTransparency(t){this.setTransparency(this.constraintRegionParam(),t)}get constraintRegionBorderColor(){return this.getBorderColor(this.constraintRegionParam())}set constraintRegionBorderColor(t){this.setBorderColor(this.constraintRegionParam(),t)}get constraintRegionLineStyle(){return this.getLineStyle(this.constraintRegionParam())}set constraintRegionLineStyle(t){this.setLineStyle(this.constraintRegionParam(),t)}partitionParam(){return this.getParam("partition")}get partitionColor(){return this.getColor(this.partitionParam())}set partitionColor(t){this.setColor(this.partitionParam(),t)}get partitionTransparency(){return this.getTransparency(this.partitionParam())}set partitionTransparency(t){this.setTransparency(this.partitionParam(),t)}get partitionBorderColor(){return this.getBorderColor(this.partitionParam())}set partitionBorderColor(t){this.setBorderColor(this.partitionParam(),t)}get partitionLineStyle(){return this.getLineStyle(this.partitionParam())}set partitionLineStyle(t){this.setLineStyle(this.partitionParam(),t)}boardOutlineInnerParam(){return this.getParam("boardOutlineInner")}get boardOutlineInnerColor(){return this.getColor(this.boardOutlineInnerParam())}set boardOutlineInnerColor(t){this.setColor(this.boardOutlineInnerParam(),t)}get boardOutlineInnerTransparency(){return this.getTransparency(this.boardOutlineInnerParam())}set boardOutlineInnerTransparency(t){this.setTransparency(this.boardOutlineInnerParam(),t)}colorfulImageParam(){return this.getParam("colorfulImage")}get colorfulImageTransparency(){return this.getTransparency(this.colorfulImageParam())}set colorfulImageTransparency(t){this.setTransparency(this.colorfulImageParam(),t)}annotationParam(){return this.getParam("annotation")}get annotationBorderColor(){return this.getBorderColor(this.annotationParam())}get annotationLineStyle(){return this.getLineStyle(this.annotationParam())}boardParam(){return this.getParam("boardShape")}get boardBorderColor(){return this.getBorderColor(this.boardParam())}get boardColor(){return this.getColor(this._isBoard?this.backgroundParam():this.boardParam())}get boardLineStyle(){return this.getLineStyle(this.boardParam())}};Iie._instance=null;var Ys=Iie;var DVe=HBe(()=>bn.getInstance()),oSe=class{getLineColor(t){if(t.type==="Constraint Region")return ee.WHITE;if(t.type==="Partition")return Ys.getInstance().getRegionLineStyle2("Partition").lineColor;if(t.type=="3D Shell - Side Slot Region"||t.type=="3D Shell - Top Slot Region"){let r=12;return DVe().getLayer(r).activeColor}if(t.type=="Board")return Ys.getInstance().getRegionLineStyle2("Board").lineColor;let e=be.getLayer(t.layerId);return e&&e.isSignalLayer()?ze.getSpecialColor(t.net):ee.BLACK}getFillColor(t){if(t.type==="Constraint Region"){let r=DVe().getLayer(t.layerId).activeColor;return ee.of6(r,.5)}if(t.type=="Board")return Ys.getInstance().getRegionLineStyle2("Board").color;let e=be.getLayer(t.layerId);return e&&e.isSignalLayer()?ze.getSpecialColor(t.net):ee.BLACK}},$A=new oSe;function sSe(o,t){return(o+t)%t}var ct=class extends Ye{constructor(e,r){super();this._notShowFill=!1;this._children=new Array(0);this._isSelectPolygon=!1;this._mask=!1;if(this.model=e,this.layerId=sg(e.type,e.layerId,2),this.net=wu(e.net,e.layerId,e.type),Lf(e.type,e.component,this.model.layerId)||(this.model.component=V1(2,e)),e.type==="Constraint Region"){let i=te.getInstance().addConstraintSelector(e.globalIndex);Xp.getInstance().publish("modify",i)}e.isSimplify||this.setChildrens(r,!0),this.initRefreshRender(),e.setModelWatcher(this),eP(this.model.component),jo("editor/shape/PcbPolygon")}resetModelNotify(){super.resetModelNotify(),this.iteratorChildren(e=>{e.resetModelNotify()})}isSelectOne(){var e;return((e=this._selectModels)==null?void 0:e.length)==1}get component(){return this.getComponent()}get isSelectPolygon(){return this._isSelectPolygon}set isSelectPolygon(e){this._isSelectPolygon=e}get start(){let e=this.getOutMostChildren();if(e.length>0)return e[0].start;{let r=this.model.outline;if(r==null)throw new Error("Polygon was removed!!!");return r instanceof fe?r.start():r.primitives[0].start()}}get end(){let e=this.getOutMostChildren();if(e.length>0)return e[e.length-1].end;{let r=this.model.outline;if(r==null)throw new Error("Polygon was removed!!!");return r instanceof fe?r.end():r.primitives[r.primitives.length-1].end()}}get color(){let e=super.color||$A.getLineColor(this),r=Bt.getTransparencyByPcbType(this,e);return r!=null&&e.alpha!=r&&(e=ee.of6(e,r)),e}set color(e){super.color=e,this.refreshRender()}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}get showNet(){return this.model.net}set net(e){if(this.model.net!=e){ze.delete(this),this.model.net=e;let r=be.getLayer(this.layerId);r&&r.isSignalLayer()&&ze.addItem(this),this.refreshRender()}}get type(){return this.model.type}set type(e){if(e!=this.model.type){let r=["TearDrop"].includes(e);switch(this.isSimplify?r||(this.isSimplify=!1,this._children.length==0&&this.refreshChildrenByOutline()):r&&(this.isSimplify=!0,this._children.length>0&&this.refreshOutlineByChildren()),this.hiddenCopperResult=!1,this.model.type=="Copper Region"?(Ei.nameManager.deleteNum(this.component.name),this.deleteRegionRuleSelector()):this.model.type==="Constraint Region"?(wf.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()):this.model.type==="Partition"&&(Dn.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()),e){case"Line":case"3D Shell - Screw Pillar":break;default:if(this.checkClose())return}if(e==="Constraint Region"){let n=te.getInstance().addConstraintSelector(this.globalIndex);Xp.getInstance().publish("modify",n)}let i=this.model.type;i=="TearDrop"&&i!=e&&A.publish("deleteConnects",{item:this,connects:this.model.component.connects}),this.model.type=e,this.model.component=V1(2,this.model),this.layerId=sg(e,this.model.layerId,2),this.strokeWidth=n8(this.strokeWidth,this.model.type,i),this.net=wu(this.net,this.layerId,this.type),this.iteratorChildren(n=>{n.layerId=this.layerId,n.width=this.strokeWidth}),this.clickSelect(),eP(this.model.component),this.refreshRender()}}get layerId(){return this.model.layerId}set layerId(e){if(this.model.layerId!=e){let r=sg(this.type,e,2,this.model.layerId);this.model.layerId=r,this.checkRegion(2),this.iteratorChildren(i=>{i.model.layerId=r}),this.clickSelect(),this.refreshRender()}}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e,this.type=="3D Shell - Outline"&&(this.component.shellThickness=this.strokeWidth),this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get outline(){return this.getMathGraphics()}get partitionName(){return this.component instanceof Dc?this.component.name:""}get constrainName(){return this.component instanceof nu?this.component.name:""}get fpcMaterial(){return this.component instanceof Du?this.component.material:""}get fpcThickness(){return this.component instanceof Du?this.component.thickness:""}get fillColor(){var n,s;let e=super.color||$A.getFillColor(this),r=(s=(n=ce)==null?void 0:n.themeConfig)==null?void 0:s.canvasTheme;r&&(e=r.getRegionColor(this,e));let i=Bt.getTransparencyByPcbType(this,e);return i!=null&&e.alpha!=i&&(e=ee.of6(e,i)),e}get fillState(){return this.notShowFill?1:0}get childrenModified(){return this.model.childrenModified}get isSimplify(){return this.model.isSimplify}set isSimplify(e){this.model.isSimplify=e}get viewGroupId(){return this.model.component instanceof ln&&this.model.component.isBridgingCopper?this.model.modelType+null:this.model.modelType+this.model.net}get viewGroupIdModified(){return this.netModified}clickSelect(){this.iteratorSelectModels(e=>{e.isEmpty||e.click()})}onlyOneChilds(){if(this._children.length==1){let e=this._children[0];if(Array.isArray(e)){if(e.length==1)return e[0]}else return e}return null}isComplexPolygon(){return this._children.length>1&&Array.isArray(this._children[0])}outlineLength(){let e=0;for(let r of this._children)if(!Array.isArray(r))e+=r.length;else for(let i of r)e+=i.length;return e}keepOutline(){this.getChildrens().slice(1).forEach(e=>{e.forEach(r=>{r.remove(),A.publish("delete",r)})}),this.getChildrens().length=1,this.setChildrens([])}get primitives(){let e=new Array;for(let r of this._children)if(!Array.isArray(r))e.push(r.primitive);else for(let i of r)e.push(i.primitive);return e}getEdgePolylines(){let e=new Array;for(let r of this._children)if(Array.isArray(r))for(let i of r){let n=i.getMathGraphics(this.layerId,0);n!=null&&e.push(n)}else{let i=r.getMathGraphics(this.layerId,0);i!=null&&e.push(i)}return e}getAllChildrens(){let e=new Array;for(let r of this._children)if(!Array.isArray(r))e.push(r);else for(let i of r)e.push(i);return e}refreshOutlineByChildren(){this.model.refreshOutlineByChildren()}refreshChildrenByOutline(e){if(!e&&this._children.length>0)return this._children;let r=new Array,i=this.strokeWidth,n=[],s;return this.model.refreshChildrenByOutline((l,c)=>{let h;l.modelType==="Line"?h=$u.addByModel(l):h=qc.addArcByModel(l),h&&(h.setParent(this),n.push(h))},e),n.length>0&&r.push(n),this._children=g4(r),this._children}iteratorSelectModels(e){this._selectModels&&this._selectModels.some(r=>e(r))}addSelect(e){if(this._mask)return;this._selectModels||(this._selectModels=[]);let r=[];this._selectModels=this._selectModels.filter(i=>{let n=i.isEmpty;return n||r.push(i.globalIndex),!n}),!e.isEmpty&&!r.includes(e.globalIndex)&&this._selectModels.push(e),this._selectModels.length>0||this.clearSelectNodes()}removeSelect(e){if(this._mask||!this._selectModels)return;let r=this._selectModels.indexOf(e);r>=0&&this._selectModels.splice(r,1),this._selectModels.length==0&&(this.notShowFill=!1,this.refreshRender(),this.clearSelectNodes())}selectChild(e,r){for(let i of this._children)if(Array.isArray(i)){for(let n of i)if(n.isSelect(e,r,!0))return n}else if(i.isSelect(e,r,!0))return i}clearSelectNodes(){delete this._selectModels}getSelects(){return this._selectModels?Array.from(this._selectModels):[]}hasSelectModel(e){return this._selectModels?this._selectModels.includes(e):!1}iteratorChildren(e){return wre(this._children,e)}getChildrens(){return p8(this._children)}setChildrens(e,r=!1){if(e.length>0){this._children=g4(e);for(let s of this._children)if(Array.isArray(s))for(let a of s)a.setParent(this),a.layerId=this.model.layerId,a.width=this.model.strokeWidth;else s.setParent(this),s.layerId=this.model.layerId,s.width=this.model.strokeWidth}if(r)return;let i=this.getChildrens(),n=new Array(i.length);for(let s=0,a=i.length;s<a;s++){let l=i[s],c=new Array(l.length);for(let h=0,u=l.length;h<u;h++)c[h]=l[h].model;n[s]=c}this.model.childrens=n,this.refreshRender()}insertChildren(e,r){let[i,n]=r;this.getChildrens()[i].splice(n,0,e),e.setParent(this),e.layerId=this.model.layerId,e.width=this.model.strokeWidth,this.setChildrens([])}removeChild(e){let[r,i]=e,n=this.getChildrens();n[r][i].remove(),A.publish("delete",n[r][i]),n[r].splice(i,1),this.setChildrens([])}removeChildByIndex(e=0){let i=this.getChildrens()[e];for(let n=i.length-1;n>=0;n--)i[n].remove(),A.publish("delete",i[n]),i.splice(n,1);this.setChildrens([])}removeAllChildren(){this.iteratorChildren(e=>{e.remove(),A.publish("delete",e)}),this._children.length=0,this.setChildrens([])}getConnect(e,r,i=!1,n=this.model.lastIsClose){for(let s=0;s<this._children.length;s++){let a=this._children[s];if(Array.isArray(a)){let l=a.length;for(let c=0;c<l;c++)if(a[c]==e){let h=a[sSe(r?c-1:c+1,l)];return!n&&(r&&c==0||!r&&c==l-1)||h==null||h.isEmpty||i&&!this.hasSelectModel(h)?null:h}}else if(a==e){let l=this._children[sSe(r?s-1:s+1,this._children.length)];return!n&&(r&&s==0||!r&&s==this._children.length-1)||l==null||l.isEmpty||i&&!this.hasSelectModel(l)?null:l}}return null}outMostChildrenIndex(){let e=this.getChildrens();if(e.length<=1)return 0;let r=0,i=0;return e.map((n,s)=>{let a=new _e;n.forEach(c=>{let h=c.buildBBox();h&&a.ext1(h)});let l=a.valid()?a.build1().area():0;l>i&&(i=l,r=s)}),r}getOutMostChildren(){let e=this.outMostChildrenIndex();return this.getChildrens()[e]||[]}filterOutMostChildren(){let e=this.outMostChildrenIndex();return this.getChildrens().map((r,i)=>i==e?r:[])}setCustomColor(e){this.color=e}checkClose(){let e=this.getChildrens();if(e.length==1&&e[0].length==1&&e[0][0]instanceof mt)return!0;let r=e.map(i=>{let n=i[0].start,s=i[i.length-1].end;if(!n.equals(s)){let a=$u.add(this.model.layerId,s,n,this.model.strokeWidth,!1);i.push(a)}return i});return this.setChildrens(r),!1}getComponent(){return this.model.component}setComponent(e){Lf(this.type,e,this.model.layerId)&&(this.model.component=e,eP(this.model.component))}fill(){this.isEmpty||!this.notShowFill||(this.notShowFill=!1,this.refreshRender())}removeFill(){this.notShowFill=!0,this.refreshRender()}deletePoint(e){let[r,i]=e,n=this.getChildrens(),s=n[r][i],a,l,c=this.getConnect(s,!0);c!=null?a=c.start:a=s.start,l=s.end;let h=$u.add(this.layerId,a,l,this.model.strokeWidth,!1);if(s.remove(),A.publish("delete",s),h.setParent(this),n[r].splice(i,1,h),c!=null){c.remove(),A.publish("delete",c);let u=n[r].indexOf(c);n[r].splice(u,1)}this.clearSelectNodes(),this.refreshRender()}get childrens(){return this._children}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}visible(e=!1){this.isSimplify&&!this.isHighLight?(this.model.updateSimplyOutline(),this.removeAllChildren()):this.iteratorChildren(r=>{var i;(i=this._selectModels)!=null&&i.includes(r)||r.visible()}),this.fill(),super.visible(e)}hidden(){this.iteratorChildren(e=>{e.hidden()}),this.fill(),super.hidden()}click(e=!1,r=!1){e||this.isSimplify&&this.refreshChildrenByOutline(),this._mask=!0,this.iteratorChildren(i=>{i.click(e,r)}),this.fill(),super.click(e,r),this._mask=!1}remove(){this.removeFill(),this.iteratorChildren(this.iteratorChildrenCallback),this.type=="Copper Region"?(Ei.nameManager.deleteNum(this.component.name),this.clearCopper(),this.deleteRegionRuleSelector()):this.type=="Constraint Region"?(wf.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()):this.type=="Partition"&&(Dn.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()),super.remove(),this.refreshRender()}transform(e){this.removeFill(),this.model.transform(e),this.refreshRender()}isSelect(e,r,i){if(!this.isVisible||this.getParent()!=null)return!1;let n=this.model.inShape(e,r,i?Ni():void 0);return this.type=="Copper Region"&&(this.needShowOutline()||(n=!1)),this.type=="Copper Region"&&this.isHighLight?n||this.isInInnerArea(e,r):n}isInInnerArea(e,r){return this.model.InnerArea(e,r)}isInProfile(e,r){return this.isVisible?this.model.inShape(e,r):!1}onlyOutline(e,r){return this.model.onlyOutline(e,r)}selectEdges(e,r){let i=new Array;for(let n of this._children)if(Array.isArray(n))for(let s of n){let a=s.buildBBox();a!=null&&a.isContains1(e,r)&&s.isSelect(e,r)&&i.push(s)}else{let s=n.buildBBox();s!=null&&s.isContains1(e,r)&&n.isSelect(e,r)&&i.push(n)}return i}buildBBox(){return this.model.buildBBox()}queryBBox(){return this.model.buildBBox()}toJSON(){var c;let e=new Array;this.isSimplify&&this.refreshChildrenByOutline();let r=this.getChildrens(),i=-1;for(let h of r){i++,e.push([]);for(let u of h){if(u.model.modelType==="Line"){e[i].push({LINE:u.toJSON()});continue}e[i].push({ARC:u.toJSON()})}}let n;this.type==="Constraint Region"&&(n=te.getInstance().getRegion(this.globalIndex).clone());let s=this.getComponent(),a=s&&typeof s.toJSON=="function"?s.toJSON():null;return{globalIndex:this.globalIndex,partition:this.partition,type:this.type,layerId:this.layerId,shapes:e,strokeWidth:this.strokeWidth,net:this.net,locked:this.locked,silkColor:((c=this.silkColor)==null?void 0:c.toString())||null,componentData:a,regionRuleSelector:n,isSimplify:this.isSimplify}}isClose(e){return e!=null&&!isNaN(e)?this.isClose2(e):this.getChildrens().every((r,i)=>this.isClose2(i))}isClose2(e){let r=this.getChildrens()[e];if(r.length==2){let i=r[0],n=r[r.length-1];if(i instanceof mt&&n instanceof mt&&i.start.distance1(n.end)>=this.model.strokeWidth)return!1;if(i.start.distance1(n.end)<this.model.strokeWidth)return!0}else if(r.length>2){let i=r[0],n=r[r.length-1];if(i.start.distance1(n.end)<this.model.strokeWidth)return!0}}getMathGraphics(e,r){return this.model.getMathGraphics(e,r)}equals1(e){return this.start.equals(e.start)&&this.end.equals(e.end)?e.model.equals(this.model):!1}addRatline(e){this.type=="Line"&&!this.isClose()?(e.startNode==this&&(e.start.equals1(this.start)&&super.addRatline(e),e.start.equals1(this.end)&&(this.endRatline==null&&(this.endRatline=new Array),this.endRatline.push(e))),e.endNode==this&&(e.end.equals1(this.start)&&super.addRatline(e),e.end.equals1(this.end)&&(this.endRatline==null&&(this.endRatline=new Array),this.endRatline.push(e)))):super.addRatline(e)}removeRatline(e){if(super.removeRatline(e),this.endRatline!=null){let r=this.endRatline.indexOf(e);r>=0&&this.endRatline.splice(r,1)}}refreshRender(){var e,r,i;if(this.model!=null&&(((e=this.endRatline)==null?void 0:e.length)||0)+(((r=this._ratlines)==null?void 0:r.length)||0)>0&&((i=be.getLayer(57))==null?void 0:i.visible)&&(this.iteratorRatlines(s=>{s.isVisible&&(s.startNode==this&&!s.start.equals(this.start)&&(s.start=this.start,s.click()),s.endNode==this&&!s.end.equals(this.start)&&(s.end=this.start,s.click()))}),this.endRatline!=null))for(let s of this.endRatline)s.isVisible&&(s.startNode==this&&!s.start.equals(this.end)&&(s.start=this.end),s.endNode==this&&!s.start.equals(this.end)&&(s.end=this.end));super.refreshRender()}getType(){return 13}needShowOutline(){var e,r;if(this.type=="Copper Region"){let i=(r=(e=ce)==null?void 0:e.themeConfig)==null?void 0:r.canvasTheme;if(i&&i.getRegionLineStyle(this).lineNone){let s=this.getChildrens().find(a=>!!a.find(c=>{if(c.isHighLight)return!0}));return this.isHighLight||this.isSelectPolygon||s?!0:!this.hasCopperRes()}}return!0}getViewState(){return this.isEmpty?"Not Shown":this.isVisible?this.notShowFill?this.needShowOutline()?"Not Show Fill":"Not Shown":this.isHighLight?"Main And Highlight":this.needShowOutline()?"Only Main":"Not Shown":"Not Shown"}iteratorChildrenCallback(e,r,i){e.remove(),A.publish("delete",e)}};var Z4=new y8,vt=class extends zs{constructor(t){super(),this.model=t,t.setModelWatcher(this),this.refreshRender(),jo("editor/shape/PcbArc")}get modelType(){return this.model.modelType}set arcType(t){this.model.arcType=t}get arcType(){return this.model.arcType}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}set isSegment(t){}get isSegment(){return this.model.isSegment}get width(){let t=this.getParent();return t!=null&&t instanceof ct?t.strokeWidth:this.model.width}set width(t){this.model.width=t}get center(){return this.model.center}set center(t){this.model.center=t,this.refreshRender()}get radius(){return this.model.radius}set radius(t){t==0&&(t=1e-8),this.model.radius=t,this.refreshRender()}get startAngle(){return this.model.startAngle}set startAngle(t){this.model.startAngle=Z4.fixStartAngle(t,this.radius,this.endAngle,this.sweep),this.refreshRender()}get endAngle(){return this.model.endAngle}set endAngle(t){this.model.endAngle=Z4.fixEndAngle(t,this.radius,this.startAngle,this.sweep),this.refreshRender()}get sweep(){return this.model.sweep}set sweep(t){this.model.sweep=t,this.refreshRender()}get locked(){let t=this.getParent();return t!=null?t.locked:this.model.locked}set locked(t){let e=this.getParent();e!=null?(e.locked=t,this.model.locked=t):this.model.locked=t}get start(){return this.model.start}set start(t){this.model.start=Z4.fixStart(t,this.center,this.radius,this.end,this.sweep),this.refreshRender()}get end(){return this.model.end}set end(t){this.model.end=Z4.fixEnd(t,this.center,this.radius,this.start,this.sweep),this.refreshRender()}get length(){return this.model.length}set length(t){this.model.length=t,this.refreshRender()}get midPoint(){return this.model.midPoint}set midPoint(t){this.model.midPoint=t,this.refreshRender()}get direct(){return this.end.sub(this.start).normalize()}get primitive(){return this.model.primitive}get color(){let t=ee.BLACK,e=this.getParent();if(e!=null&&e instanceof Ye){let r=e.color;r!=null&&(t=r)}return t}get lineColor(){let t=this.getParent();return t!=null&&t instanceof Ye?t.lineColor:this.color}get lineSolid(){let t=this.getParent();return t!=null&&t instanceof Ye?t.lineSolid:!0}get isPixel(){return!1}get viewGroupId(){var t;return((t=this.getParent())==null?void 0:t.viewGroupId)||""}get viewGroupIdModified(){var t;return((t=this.getParent())==null?void 0:t.viewGroupIdModified)||!1}buildBBox(){return this.isEmpty?null:this.model.buildBBox()}getAngle(){return this.model.getAngle()}setStartAngleAndEndAngle(t,e){this.model.setStartAngleAndEndAngle(t,e),this.refreshRender()}rotateFor(t,e){this.model.rotateFor(t,e),this.refreshRender()}visible(t=!1){super.visible(t);let e=this.getParent();e!=null&&e instanceof ct&&e.removeSelect(this)}hidden(){super.hidden()}pointIsContain(t){let e=this.buildBBox();return!!(e&&e.isContains(t))}click(t=!1,e=!1){super.click(t,e);let r=this.getParent();r!=null&&r instanceof ct&&r.addSelect(this)}lineIsEqual(t){if(t instanceof mt)return!1;if(this.center.equals(t.center)&&ne.eq(this.radius,t.radius)){if(this.sweep===t.sweep){if(this.start.equals(t.start)&&this.end.equals(t.end)&&ne.eq(this.startAngle,t.startAngle)&&ne.eq(this.endAngle,t.endAngle))return!0}else if(this.start.equals(t.end)&&this.end.equals(t.start)&&ne.eq(this.startAngle,t.endAngle)&&ne.eq(this.endAngle,t.startAngle))return!0}return!1}remove(){this.model.remove(),super.remove()}applyMatrix(t){this.model.transform(t),this.refreshRender()}transform(t){let e=this.getParent();e!=null&&e instanceof ct?e.transform(t):this.model.transform(t),this.refreshRender()}isSelect(t,e,r){if(!this.isVisible)return!1;let i=this.getParent();return i&&i.getViewState()=="Not Shown"?!1:this.model.inShape(t,e,r?Ni():void 0)}queryBBox(){return this.model.buildBBox()}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,center:this.center,radius:this.radius,width:this.width,startAngle:this.startAngle,endAngle:this.endAngle,sweep:this.sweep,locked:this.locked,isSegment:this.isSegment,arcType:this.arcType}}getMathGraphics(t=this.layerId,e=0){return this.isEmpty?null:this.model.getMathGraphics(t,e)}getType(){return 1}getViewState(){if(this.getParent()!=null)return"Not Shown";if(this.isEmpty)return"Not Shown";if(this.isVisible){if(this.isHighLight)return"Main And Highlight";{let t=this.getParent();return t&&t.getViewState()=="Not Shown"?"Not Shown":"Only Main"}}else return"Not Shown"}setBBoxModify(){}setLayerModify(t){}refreshRender(){if(!this.rendering){let t=this.getParent();t!=null?t.rendering||(Do.attach(t,t.getType()),t.rendering=!0):(Do.attach(this,this.getType()),this.rendering=!0)}return null}};function wVe(o,t){let e=t.center,r=t.radius,i=t.start,n=t.end,s=t.midPoint,a=o.distance1(e),l=H2(a,r,.001),c=new M(i,s),h=new M(n,s),u=new M(o,e),d=xE(c,u)||xE(h,u);return l&&!!d}var mt=class extends zs{constructor(t){super(),this.model=t,t.setModelWatcher(this),this.refreshRender(),jo("editor/shape/PcbLine")}get modelType(){return this.model.modelType}set isPixel(t){t?this._isPixel=t:delete this._isPixel}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}get locked(){let t=this.getParent();return t!=null?t.locked:this.model.locked}set locked(t){let e=this.getParent();e!=null?(e.locked=t,this.model.locked=t):this.model.locked=t}get direct(){return this.model.direct}get length(){return this.model.length}set length(t){this.model.length=t,this.refreshRender()}get start(){return this.model.start}set start(t){this.model.start=t,this.refreshRender()}get midPoint(){return this.model.center}get end(){return this.model.end}set end(t){this.model.end=t,this.refreshRender()}get width(){let t=this.getParent();return t!=null&&t instanceof ct?t.strokeWidth:this.model.width}set width(t){this.model.width=t,this.refreshRender()}get primitive(){return this.model.primitive}get color(){let t=ee.BLACK,e=this.getParent();if(e!=null&&e instanceof Ye){let r=e.color;r!=null&&(t=r)}return t}get lineColor(){let t=this.getParent();return t!=null&&t instanceof Ye?t.lineColor:this.color}get lineSolid(){let t=this.getParent();return t!=null&&t instanceof Ye?t.lineSolid:!0}get isPixel(){let t=this.getParent();return t!=null&&t instanceof Ye?t.isPixel:this._isPixel||!1}get viewGroupId(){var t;return((t=this.getParent())==null?void 0:t.viewGroupId)||""}get viewGroupIdModified(){var t;return((t=this.getParent())==null?void 0:t.viewGroupIdModified)||!1}rotateFor(t,e){this.model.rotateFor(t,e),this.refreshRender()}hidden(){super.hidden()}visible(t=!1){super.visible(t);let e=this.getParent();e!=null&&e instanceof ct&&e.removeSelect(this)}pointIsContain(t){return uT(new M(this.start,this.end),t)>0}lineIsEqual(t){return t instanceof vt?!1:!!(Math.abs(this.direct.cross(t.direct))<Rl&&(this.start.equals1(t.start)&&this.end.equals1(t.end)||this.end.equals1(t.start)&&this.start.equals1(t.end)))}click(t=!1,e=!1){super.click(t,e);let r=this.getParent();r!=null&&r instanceof ct&&r.addSelect(this)}remove(){this.model.remove(),super.remove()}applyMatrix(t){this.model.transform(t),this.refreshRender()}transform(t){let e=this.getParent();e!=null&&e instanceof ct?e.transform(t):this.model.transform(t),this.refreshRender()}isSelect(t,e,r){if(!this.isVisible)return!1;let i=this.getParent();return i&&i.getViewState()=="Not Shown"?!1:this.model.inShape(t,e,r?Ni():void 0)}queryBBox(){return this.model.buildBBox()}buildBBox(){return this.isEmpty?null:this.model.buildBBox()}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,end:this.end,width:this.width,locked:this.locked}}getMathGraphics(t=this.layerId,e=0){return this.isEmpty?null:this.model.getMathGraphics(t,e)}getType(){return 8}getViewState(){if(this.getParent()!=null)return"Not Shown";if(this.isEmpty)return"Not Shown";if(this.isVisible){if(this.isHighLight)return"Main And Highlight";{let t=this.getParent();return t&&t.getViewState()=="Not Shown"?"Not Shown":"Only Main"}}else return"Not Shown"}setBBoxModify(){}setLayerModify(t){}refreshRender(){if(!this.rendering){let t=this.getParent();t!=null?t.rendering||(Do.attach(t,t.getType()),t.rendering=!0):(Do.attach(this,this.getType()),this.rendering=!0)}return null}};function aSe(o){for(let t in ce.fontConfig.info)if(ce.fontConfig.info[t].family==o&&!["default","default2","Serif","Sans Serif"].includes(o))return o;return["default","default2","Serif","Sans Serif"].includes(o)||o==""?rt.defaultTextFamily[1]:o}function Cie(){let o=new Array;for(let t in ce.fontConfig.info){let e=ce.fontConfig.info[t],r=e.family;r.toLocaleLowerCase()==="default"&&(r="Default"),o.push({value:e.family,text:r})}return o}function LVe(o,t,e){let r={fontFamily:t,type:e},i=["","default","default2","Serif","Sans Serif"].includes(t);return!Vy.everyCharHasDefaultFontPath(o)&&i&&(r.fontFamily=aSe(t)),["","default","default2","Serif","Sans Serif"].includes(r.fontFamily)?e!==0&&(r.type=0):e!==1&&(r.type=1),r}var Kl=(V=>(V[V.ALL=0]="ALL",V[V.COMPONENT=1]="COMPONENT",V[V.ATTR=2]="ATTR",V[V.COMPONENTSILK=3]="COMPONENTSILK",V[V.TRACK=4]="TRACK",V[V.PAD_TEST=5]="PAD_TEST",V[V.PAD=6]="PAD",V[V.PADSPAIR=7]="PADSPAIR",V[V.NETWORK=8]="NETWORK",V[V.VIA=9]="VIA",V[V.SUTUREVIA=10]="SUTUREVIA",V[V.RATLINE=11]="RATLINE",V[V.COMBINATION=12]="COMBINATION",V[V.TEXT=13]="TEXT",V[V.PICTURE=14]="PICTURE",V[V.IMAGE=15]="IMAGE",V[V.DIMENSION=16]="DIMENSION",V[V.SHEETBOARD=17]="SHEETBOARD",V[V.SLOT=18]="SLOT",V[V.REGION=19]="REGION",V[V.FPC_STIFFENER=20]="FPC_STIFFENER",V[V.POUR=21]="POUR",V[V.COPPER=22]="COPPER",V[V.PROHIBIT=23]="PROHIBIT",V[V.CONSTRAINT=24]="CONSTRAINT",V[V.PARTITION=25]="PARTITION",V[V.LINE=26]="LINE",V[V.SHELL=27]="SHELL",V[V.BOSS=28]="BOSS",V[V.CREASE=29]="CREASE",V[V.TOPSHELLCUT=30]="TOPSHELLCUT",V[V.SIDESHELLCUT=31]="SIDESHELLCUT",V[V.TOPBOTTOMENTITY=32]="TOPBOTTOMENTITY",V[V.SIDEENTITY=33]="SIDEENTITY",V[V.TEARDROP=34]="TEARDROP",V[V.DRCTAGGING=35]="DRCTAGGING",V[V.LOCKED=36]="LOCKED",V[V.UNLOCKED=37]="UNLOCKED",V[V.ANNOTATION=38]="ANNOTATION",V))(Kl||{});var X8=class extends Rn{getData(t){switch(t){case"originX":return xe(x.getInstance().origin.x*10,4);case"originY":return xe(x.getInstance().origin.y*10,4);case"unit":return x.getInstance().unit;case"gridXSize":return xe(St.getInstance().getGridX()*10,6);case"gridYSize":return xe(St.getInstance().getGridY()*10,6);case"snapXSize":return xe(St.getInstance().getSnapX()*10,6);case"snapYSize":return xe(St.getInstance().getSnapY()*10,6);case"altSnapXSize":return xe(x.getInstance().altGridSize.GridX.number,6);case"altSnapYSize":return xe(x.getInstance().altGridSize.GridY.number,6);case"gridType":return GCe(x.getInstance().gridType);case"multiGridType":return GCe(x.getInstance().multiType);case"multiGridRatio":return x.getInstance().multiRatio;case"highlightValue":return xe(x.getInstance().forceValue)}}};var CR=class extends Rn{getData(t,e){switch(this.id=e.layerId,t){case"layerId":return this.id;case"layerType":return e.type;case"layerName":return e.name;case"show":return e.visible;case"locked":return e.locked;case"use":return e.config;case"activeColor":return e.realActiveColor.toString();case"activateTransparency":return e.realActiveColor.alpha;case"inactiveColor":return e.deactiveColor.toString();case"inactiveTransparency":return $e.getInstance().deactiveAlpha}}};var SR=class extends Rn{getData(t){switch(this.id=$e.getInstance().activeLayer,t){case"layerId":return this.id}}};var q8=class extends Rn{getData(t,e){switch(this.id=e.name,t){case"netName":return e.name;case"netType":let r=e.netClass;return r!=null?r.name:null;case"specialColor":{let n=ze.getSpecialColor(e.name);return n.equals(ee.BLACK)?null:n.toString()}case"retLine":{let n=ze.ratlineVisibleBeforeGray[e.name];return n!=null?n:e.showRatline}case"differentialName":let i=e.netDifferential;return i!=null?i.name:null;case"isPositiveNet":return e.isPositiveNet;case"equalLengthGroupName":{let n=e.equalLengthGroup;return n!=null?n.name:null}}}};var $8=class extends Rn{getData(t,e){switch(t){case"primiveName":return e;case"display":return this.getDisplay(e);case"pick":return this.getPick(e)}}getDisplay(t){return $t.getVisible(this.getElement(t))}getPick(t){return $t.getPick(this.getElement(t))}getElement(t){switch(t){case"ALL":return 0;case"COMPONENT":return 1;case"PROPERTY":return 2;case"COMPONENTSILK":return 3;case"TRACK":return 4;case"TESTPOINT":return 5;case"FPC_STIFFENER":return 20;case"PAD":return 6;case"PADSPAIR":return 7;case"NETWORK":return 8;case"VIA":return 9;case"SUTUREHOLE":return 10;case"RATLINE":return 11;case"GROUP":return 12;case"TEXT":return 13;case"IMAGE":return 15;case"PICTURE":return 14;case"DIMENSION":return 16;case"BOARDOUTLINE":return 17;case"SLOTREGION":return 18;case"FILLREGIEN":return 19;case"COPPEROUTLINE":return 21;case"COPPERFILLED":return 21;case"PROHIBITEDREGION":return 23;case"CONSTRAINT":return 24;case"PARTITION":return 25;case"LINE":return 26;case"SHELL":return 27;case"SIDESHELLCUT":return 31;case"TOPSHELLCUT":return 30;case"SIDEENTITY":return 33;case"TOPBOTTOMENTITY":return 32;case"CREASE":return 29;case"BOSS":return 28;case"TEARDROP":return 34;case"LOCKED":return 36;case"UNLOCKED":return 37;default:return null}}};var K8=class extends Rn{getData(t,e){switch(this.id=e.globalIndex,t){case"groupID":return this.id;case"groupName":return e.name}}};var $I=class extends Rn{getData(t,e){switch(this.id=e.globalIndex,t){case Oa.PartitionId:return e.partition;case Oa.Index:return this.id;case Oa.GroupID:return Fa(e);case Oa.Net:return e.showNet;case Oa.Name:return e.name;case Oa.StartLayer:return e.startLayer;case Oa.EndLayer:return e.endLayer;case Oa.CenterX:return xe(e.center.x*10,4);case Oa.CenterY:return xe(e.center.y*10,4);case Oa.HoleDiameter:return xe(e.holeRadius*20,4);case Oa.ViaDiameter:return xe(e.radius*20,4);case Oa.ViaType:return AFe(e.type);case Oa.TopSolderExpansion:return e.expansionType==1?null:xe(e.topExpansion*10,4);case Oa.BottomSolderExpansion:return e.expansionType==1?null:xe(e.bottomExpansion*10,4);case Oa.Locked:return e.locked;case Oa.UnusedInnerLayers:return e.unusedInnerLayers}}};var JE=class extends Rn{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"netName":return e.showNet;case"layerId":return e.layerId;case"startX":return xe(e.start.x*10,4);case"startY":return xe(e.start.y*10,4);case"endX":return xe(e.end.x*10,4);case"endY":return xe(e.end.y*10,4);case"width":return xe(e.width*10,4);case"locked":return e.locked;case"zIndex":return e.zIndex}}};var QE=class extends Rn{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"netName":return e.showNet;case"layerId":return e.layerId;case"startX":return xe(e.start.x*10,4);case"startY":return xe(e.start.y*10,4);case"endX":return xe(e.end.x*10,4);case"endY":return xe(e.end.y*10,4);case"angle":return xe(e.angle/Math.PI*180,4);case"width":return xe(e.width*10,4);case"locked":return e.locked;case"zIndex":return e.zIndex;case"arcType":return xFe(e.arcType)}}};var e3=class extends nf{getData(t,e){var r;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"netName":return e.showNet||"";case"layerId":return e.layerId;case"width":return xe(e.strokeWidth*10,4);case"path":return this.getShapeInfo(e)[0]||[];case"locked":return e.locked;case"zIndex":return e.zIndex;case"specialColor":return(r=e.silkColor)==null?void 0:r.toString();case"polyType":return hVe(e.type)}}};var KI=class extends nf{getData(t,e){var r;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"id":case"index":return this.id;case"groupId":return Fa(e);case"netName":return e.net||"";case"layerId":return e.layerId;case"width":return e instanceof lr?xe(e.strokeWidth*10,4):0;case"fillStyle":if(e instanceof lr)return N2.SOLID;if(e instanceof Cn)return N2.PLANE;break;case"path":return e instanceof lr?this.getShapeInfo(e):this.toFix(e.copperPath,10);case"locked":return e.locked;case"zIndex":return e.zIndex;case"isBridgingCopper":return e instanceof lr&&e.component instanceof ln&&e.component.isBridgingCopper?e.component.isBridgingCopper:!1;case"networkList":return e instanceof lr&&e.component instanceof ln&&e.component.isBridgingCopper?e.component.networkList:[];case"refs":return e instanceof lr&&e.component instanceof ln&&e.component.padId!=""?[e.component.padId]:null;case"specialColor":return(r=e.silkColor)==null?void 0:r.toString()}}toFix(t,e=1){let r=new Array;return t.forEach(i=>{let n=new Array;i.forEach(s=>{typeof s=="number"?n.push(xe(s*e,4)):n.push(s)}),r.push(n)}),r}};var ER=class extends nf{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"layerId":return e.layerId;case"width":return xe(e.strokeWidth*10,4);case"prohibitType":return this.getProhibitType(e);case"path":return this.getShapeInfo(e);case"locked":return e.locked;case"name":if(e.component instanceof nu)return e.component.name;case"regionType":return e.component instanceof nu?Nk.CONSTRAINT:Nk.PROHIBIT}}getProhibitType(t){let e=t.component,r=new Array;return e instanceof fd&&(e.track&&r.push(eT.TRACK),e.device&&r.push(eT.COMPONENT),e.copper&&r.push(eT.COPPER),e.fill&&r.push(eT.FILL),e.planzone&&r.push(eT.PLANE)),r}};var Z8=class extends nf{getData(t,e){this.id=e.globalIndex;let r=e.component;switch(t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"netName":return e.showNet;case"layerId":return e.layerId;case"width":return xe(e.strokeWidth*10,4);case"name":return r!=null&&r instanceof Vn?r.name:"";case"order":return r!=null&&r instanceof Vn?r.order:null;case"path":return this.getShapeInfo(e);case"pourType":return this.getPourType(e);case"keepIsland":return r!=null&&r instanceof Vn?r.keepIsland:"";case"HeatWeld":return 0;case"locked":return e.locked;case"zIndex":return e.zIndex}}getPourType(t){let e=t.component;if(e!=null&&e instanceof Vn){let r=e.style;return r=="solid"?{pourType:Lk.SOLID,fineness:e.optimization?e.optimizationValue*10:0}:{pourType:Lk.GRID_LINE,angle:r==="45grid"?45:0,strokeWidth:e.gridLineWidth*10,strokeSpacing:e.clearance*10}}return null}getStyle(t){switch(t){case"solid":return 0;case"90grid":return 0;case"45grid":return 0}}};var OR=class extends Rn{getData(t,e){var r;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"layerId":return e.layerId;case"startX":return xe(e.start.x*10,4);case"startY":return xe(e.start.y*10,4);case"width":return xe(e.width*10,4);case"height":return xe(e.height*10,4);case"angle":return xe(e.rotation/Math.PI*180,4);case"mirror":return e.mirror;case"path":return this.getPolygonsPath(e.template);case"locked":return e.locked;case"specialColor":return(3==e.layerId||4==e.layerId)&&e.getParent()==null&&e.silkColor!=null?(r=e.silkColor)==null?void 0:r.toString():null}}getPolygonsPath(t){let e=new Array;return t.forEach(r=>{let i=F1(r);e.push(i)}),e}};var t3=class extends Rn{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"netName":return e.net;case"layerId":return e.layerId;case"refs":return e.component.connects;case"path":return F1(e.getMathGraphics(e.layerId,0),10);case"groupId":return Fa(e);case"locked":return e.locked}}};var KA=class extends Rn{getData(t,e){switch(t){case 0:return e.id;case"path":return e.outline;case"width":return e.width*10;case"height":return e.height*10;case"text":return e.text;case"fontFamily":return e.fontFamily;case"fontSize":return e.fontSize;case"thickness":return 10;case"bold":return e.bold;case"italic":return e.italic;case"reverse":return e.reverse;case"expansion":return e.expansion}}};var r3=class extends h8{getData(t,e){var r;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"Index":return this.id;case"groupId":return Fa(e);case"layerId":return e.layerId;case"x":return xe(e.position.x*10,4);case"y":return xe(e.position.y*10,4);case"text":return e.value;case"fontFamily":return e.fontFamily;case"fontSize":return xe(e.fontSize*10,4);case"strokeWidth":return xe(e.strokeWidth*10,4);case"bold":return 0;case"italic":return 0;case"origin":return Dre(e.origin);case"angle":return xe(e.rotation/Math.PI*180,4);case"reverse":return e.reverse;case"expansion":return xe(e.reverseExpansion*10,4);case"mirror":return e.mirror;case"locked":return e.locked;case"zIndex":return e.zIndex;case"path":return ef(e.outline);case"width":return e.width*10;case"height":return e.height*10;case"specialColor":return(3==e.layerId||4==e.layerId)&&e.silkColor!=null&&(e.getParent()==null||e.getParent()!=null&&e.key!="")?(r=e.silkColor)==null?void 0:r.toString():null}}};var AR=class extends Rn{getData(t,e){var i;this.id=e.globalIndex;let r=e.text;switch(t){case"partitionId":return e.partition;case"index":return this.id;case"type":return e instanceof Rf?"LENGTH":e instanceof Df?"RADIUS":e instanceof zd?"ANGLE":"";case"layerId":return e.layerId;case"unit":return e instanceof Rf||e instanceof Df?e.unit:"";case"strokeWidth":return xe(e.strokeWidth*10,4);case"precision":return e.precision;case"textFollow":return 1;case"coords":return this.getCoords(e);case"locked":return e.locked;case"zIndex":return e.zIndex;case"groupId":return Fa(e);case"fontX":return r.positionIsNull?null:xe(r.position.x*10,4);case"fontY":return r.positionIsNull?null:xe(r.position.y*10,4);case"fontValue":return r.value;case"fontSize":return xe(r.fontSize*10,4);case"fontWidth":return xe(r.strokeWidth*10,4);case"specialColor":return(3==e.layerId||4==e.layerId)&&e.getParent()==null&&e.silkColor!=null?(i=e.silkColor)==null?void 0:i.toString():null;case"text":return this.getStr(r,r.positionIsNull)}}getStr(t,e){let r=["layerId","x","y","text","fontFamily","fontSize","strokeWidth","bold","italic","origin","angle","reverse","expansion","mirror","locked"],i={},n=new r3;return r.forEach(s=>{i[s]=n.getData(s,t)}),e&&(i.x=null,i.y=null),i}getCoords(t){let e=new Array;return t instanceof Rf?(e.push(xe(t.left.x*10,4)),e.push(xe(t.left.y*10,4)),e.push(xe(t.start.x*10,4)),e.push(xe(t.start.y*10,4)),e.push(xe(t.end.x*10,4)),e.push(xe(t.end.y*10,4)),e.push(xe(t.right.x*10,4)),e.push(xe(t.right.y*10,4))):t instanceof Df?(e.push(xe(t.end.x*10,4)),e.push(xe(t.end.y*10,4)),e.push(xe(t.start.x*10,4)),e.push(xe(t.start.y*10,4)),e.push(t.radius*10)):t instanceof zd&&(e.push(xe(t.start.x*10,4)),e.push(xe(t.start.y*10,4)),e.push(xe(t.center.x*10,4)),e.push(xe(t.center.y*10,4)),e.push(xe(t.end.x*10,4)),e.push(xe(t.end.y*10,4))),e}};var i3=class extends Rn{getData(t,e){var r;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"layerId":return e.layerId;case"x":return xe(e.position.x*10,4);case"y":return xe(e.position.y*10,4);case"angle":return xe(e.rotation/Math.PI*180,4);case"attrs":return v8(e);case"locked":return e.locked;case"zIndex":return e.zIndex;case"specialColor":return(r=e.silkColor)==null?void 0:r.toString();case"layerIdReplacements":return e.getLayerIdReplacementTable()}}};var n3=class extends Rn{getData(t,e){switch(t){case"partitionId":return e.partition;case"componentId":let r=e.getParent();return r!=null?r.globalIndex:e.globalIndex;case"padNum":if(e instanceof Je)return e.num;{let i=e.getParent();if(i!=null){let n=i.globalIndex,s=new RegExp(n);return e.globalIndex.replace(s,"")}return e.globalIndex}case"padNet":return e.showNet;case"padId":{let i=e.getParent();return i!=null?e.globalIndex.replace(i.globalIndex,""):e.globalIndex}case"padLen":{let i=e.getParent(),n=as.getInstance().getPadLen(i.globalIndex,e.globalIndex);return n!=null?xe(n*10,4):null}case"attrsMap":return e instanceof Je?vj(e):null}}};function lSe(o){return o instanceof Eu?["NET_CLASS",o.name]:o instanceof bp?["NET",o.name]:o instanceof Vd?["EQ_LEN_GRP",o.name]:[]}function Eie(o){return o instanceof j2?lSe(o):o instanceof q2?["DIFF_PAIR",o.name]:o instanceof kg?[lSe(o.net1),lSe(o.net2)]:o instanceof UI?o.regionType=="constraint"?["REGION",o.name]:["POUR",o.name]:[]}function Oie(o){return o instanceof HI?"1":o instanceof Wb?"2":o instanceof zI?"14":o instanceof Ux?"3":o instanceof Lx?"11":o instanceof Mx?"13":o instanceof Hb?"10":o instanceof Rx?"4":o instanceof Vx?"5":o instanceof wx?"6":o instanceof Dx?"7":o instanceof Gx?"9":o instanceof Fx?"8":o instanceof Hx?"12":null}var cSe=class{getBetweenNetRule(t){let e={};return t.ruleName&&(e[Mo.SAFE]=t.ruleName),t.creepageRule&&(e[Mo.CREEPAGE]=t.creepageRule),e}getNetRule(t){let e={};return this.isNotDefault(t.safeSpacing)&&(e[Mo.SAFE]=t.safeSpacing),this.isNotDefault(t.trackPhysics)&&(e[Mo.TRACK]=t.trackPhysics),this.isNotDefault(t.netLengthPhysics)&&(e[Mo.NET_LENGTH]=t.netLengthPhysics),t.netLengthTolerancePhysics&&(e[Mo.NET_LENGTH_TOLERANCE]=[t.netLengthTolerancePhysics,t.targetNet]),this.isNotDefault(t.differentialPhysics)&&(e[Mo.DIFFER_ENTAIL]=t.differentialPhysics),this.isNotDefault(t.blindViaPhysics)&&(e[Mo.BLIND]=t.blindViaPhysics),this.isNotDefault(t.radiusPhysics)&&(e[Mo.RADIUS]=t.radiusPhysics),this.isNotDefault(t.innerPlane)&&(e[Mo.PLANE]=t.innerPlane),this.isNotDefault(t.copperPlane)&&(e[Mo.COPPER]=t.copperPlane),this.isNotDefault(t.pasteExpansion)&&(e[Mo.PASTE]=t.pasteExpansion),this.isNotDefault(t.solderExpansion)&&(e[Mo.SOLDER]=t.solderExpansion),this.isNotDefault(t.creepageSpacing)&&(e[Mo.CREEPAGE]=t.creepageSpacing),e}getRegionRule(t){let e={};return t.safeClearance&&(e[Mo.SAFE]=t.safeClearance),t.otherClearance&&(e[Mo.OTHER]=t.otherClearance),t.track&&(e[Mo.TRACK]=t.track),t.diff&&(e[Mo.DIFFER_ENTAIL]=t.diff),t.radius&&(e[Mo.RADIUS]=t.radius),t.innerPlane&&(t.regionType!="region"||t.regionType=="region"&&this.isNotDefault(t.innerPlane))&&(e[Mo.PLANE]=t.innerPlane),t.copperPlane&&(t.regionType!="region"||t.regionType=="region"&&this.isNotDefault(t.copperPlane))&&(e[Mo.COPPER]=t.copperPlane),t.creepageClearance&&(e[Mo.CREEPAGE]=t.creepageClearance),e}isNotDefault(t){return!!t&&t!=="default"}},hSe=class{getBetweenNetRule(t){return{[Mo.COPPER]:t.safeCopperPlane}}getNetRule(t){let e={};return typeof t.safeCopperPlane<"u"&&t.safeCopperPlane!==null&&this.isNotDefault(t.safeCopperPlane)&&(e[Mo.COPPER]=t.safeCopperPlane),e}getRegionRule(t){let e={};return typeof t.safeCopperPlane<"u"&&t.safeCopperPlane!==null&&t.safeCopperPlane&&(e[Mo.COPPER]=t.safeCopperPlane),e}isNotDefault(t){return!!t&&t!=="default"}},uSe=class{getBetweenNetRule(t){return{[Mo.PLANE]:t.safeInnerPlane}}getNetRule(t){let e={};return typeof t.safeInnerPlane<"u"&&t.safeInnerPlane!==null&&this.isNotDefault(t.safeInnerPlane)&&(e[Mo.PLANE]=t.safeInnerPlane),e}getRegionRule(t){let e={};return typeof t.safeInnerPlane<"u"&&t.safeInnerPlane!==null&&t.safeInnerPlane&&(e[Mo.PLANE]=t.safeInnerPlane),e}isNotDefault(t){return!!t&&t!=="default"}},_R=class extends Rn{constructor(){super(...arguments);this._commonRuleGenerator=new cSe;this._copperRuleGenerator=new hSe;this._innerPlaneRuleGenerator=new uSe}getData(e,r){switch(e){case"ruleOrder":return r instanceof Eu||r instanceof bp?4:r instanceof kg?3:r instanceof q2||r instanceof Vd?4:r instanceof UI?2:0;case"ruleSelect":return Eie(r);case"ruleKeyValue":return this.getRule(r);case"copperValue":return this.getCopperRule(r);case"innerPlaneValue":return this.getInnerPlaneRule(r)}}getRuleSelect(e){return e instanceof Eu?["NET_CLASS",e.name]:e instanceof bp?["NET",e.name]:e instanceof Vd?["EQ_LEN_GRP",e.name]:[]}getRule(e){if(e instanceof j2)return this._commonRuleGenerator.getNetRule(e);if(e instanceof q2){if(this._commonRuleGenerator.isNotDefault(e.differentialPhysics))return{[Mo.DIFFER_ENTAIL]:e.differentialPhysics}}else{if(e instanceof kg)return this._commonRuleGenerator.getBetweenNetRule(e);if(e instanceof UI)return this._commonRuleGenerator.getRegionRule(e)}return{}}getCopperRule(e){return e instanceof j2?this._copperRuleGenerator.getNetRule(e):e instanceof kg?this._copperRuleGenerator.getBetweenNetRule(e):e instanceof UI?this._copperRuleGenerator.getRegionRule(e):{}}getInnerPlaneRule(e){return e instanceof j2?this._innerPlaneRuleGenerator.getNetRule(e):e instanceof kg?this._innerPlaneRuleGenerator.getBetweenNetRule(e):e instanceof UI?this._innerPlaneRuleGenerator.getRegionRule(e):{}}};var vR=class extends Rn{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupID":return Fa(e);case"parentId":return e.globalIndex;case"layerId":return e.layerId;case"x":return xe(e.textPosition.x*10,4);case"y":return xe(e.textPosition.y*10,4);case"key":return"";case"value":{if(e instanceof Df)return e.radius;if(e instanceof Rf)return e.length;if(e instanceof zd)return uc(e.angle)}case"keyVisible":return!1;case"valueVisible":return!0;case"fontFamily":return"default";case"fontSize":return xe(e.fontSize*10,4);case"strokeWidth":return xe(e.strokeWidth*10,4);case"bold":return 0;case"italic":return 0;case"origin":return 3;case"angle":return 0;case"reverse":return!1;case"expansion":return 0;case"mirror":return!1;case"locked":return!1}}};var xR=class extends Rn{getData(t,e){switch(this.id=e.layerId,t){case"layerId":return this.id;case"material":return e.material;case"thickness":return xe(e.thickness*10,3);case"permittivity":return e.permittivity;case"lossTangent":return e.lossTangent;case"isKeepIsland":return e.isKeepIsland;case"zIndex":return e.zIndex}}};var RR=class extends nf{getData(t,e){let r=e.component;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"shellType":return UFe(r.type);case"shellHeight":return xe(r.shellHeight*10,4);case"pcbHeight":return xe(r.substrateHeight*10,4);case"strokeWidth":return xe(e.strokeWidth*10,4);case"path":return this.getShapeInfo(e);case"attrs":{let i=r.getAttrs();return i.Thickness!=null&&(i.Thickness=xe(i.Thickness*10,4)),i.BottomHeight!=null&&(i.BottomHeight=xe(i.BottomHeight*10,4)),i.Direction!=null&&(i.Direction=Number(i.Direction)),i.TopInnerHeight!=null&&(i.TopInnerHeight=xe(i.TopInnerHeight*10,4)),i.BottomInnerHeight!=null&&(i.BottomInnerHeight=xe(i.BottomInnerHeight*10,4)),i}case"thickness":{let i=r.getAttrs();return i.Thickness!=null?xe(i.Thickness*10,4):null}case"direction":{let i=r.getAttrs();return i.Direction!=null?WFe(i.Direction):null}case"bottomHeight":{let i=r.getAttrs();return i.BottomHeight!=null?xe(i.BottomHeight*10,4):null}case"topInnerHeight":{let i=r.getAttrs();return i.TopInnerHeight!=null?xe(i.TopInnerHeight*10,4):null}case"bottomInnerHeight":{let i=r.getAttrs();return i.BottomInnerHeight!=null?xe(i.BottomInnerHeight*10,4):null}case"locked":return e.locked;case"zIndex":return e.zIndex}}};var DR=class extends Rn{getData(t,e){let r=e.childrens[0][0];switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"layerId":return e.layerId;case"startX":return xe(r.start.x*10,4);case"startY":return xe(r.start.y*10,4);case"endX":return xe(r.end.x*10,4);case"endY":return xe(r.end.y*10,4);case"angle":return Ste;case"locked":return e.locked;case"zIndex":return e.zIndex}}};var wR=class extends Rn{getData(t,e){let r=e.component;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"layerId":return e.layerId;case"specification":let i=r.specification;return VFe(i!=="Custom"?i:null);case"centerX":return xe(e.center.x*10,4);case"centerY":return xe(e.center.y*10,4);case"depth":return xe(r.height*10,4);case"thickness":return xe(r.thickness*10,4);case"holeDiameter":return xe(r.holeDiameter*10,4);case"counterBore":return this.getCounterbore(r);case"stiffener":return this.getStiffener(r);case"locked":return e.locked;case"zIndex":return e.zIndex}}getCounterbore(t){if(t.counterboreProps){let{height:e,diameter:r}=t.counterboreProps;if(xh(e)&&xh(r))return{height:xe(e*10,4),diameter:xe(r*10,4)}}return null}getStiffener(t){if(t.stiffenerProps){let{topWidth:e,bottomWidth:r,height:i,stiffThickness:n}=t.stiffenerProps;if(xh(e)&&xh(r)&&xh(i)&&xh(n))return{topWidth:xe(e*10,4),bottomWidth:xe(r*10,4),height:xe(i*10,4),stiffThickness:xe(n*10,4)}}return null}};var Aie=class extends Rn{getData(t,e){switch(t){case"direction":return Rre(e.vertical);case"on":return e.vertical?e.borderAtTopBottom:e.borderAtLeftRight;case"sideHeight":return xe(e.borderHeight*10,4);case"positionHoleDiameter":return e.createPositionHole?xe(e.positionHoleDiameter*10,4):0;case"markDiameter":return e.createMark?xe(e.markDiameter*10,4):0;case"markExpansion":return xe(e.markExpansion*10,4)}}};var _ie=class extends Rn{getData(t,e){switch(t){case"direction":return Rre(e.vertical);case"on":return e.vertical?e.stampColumn:e.stampRow;case"stampHoleGroupQuantity":return parseInt(e.vertical?e.stampPerColumn:e.stampPerRow);case"stampHoleDiameter":return xe(e.stampHoleDiameter*10,4);case"stampHoleQuantityPerGroup":return e.stampHolePerGroup;case"stampHoleSpacing":return xe(e.stampHoleSpacing*10,4)}}};var J8=class extends Rn{getData(t,e){switch(t){case"on":return e.on;case"row":return e.row;case"column":return e.column;case"rowSpacing":return xe(e.rowSpacing*10,4);case"columnSpacing":return xe(e.columnSpacing*10,4);case"onlyOutline":return e.onlyOutline;case"horizontalStamp":return this.getEncodeDate(e,!0,!0);case"verticalStamp":return this.getEncodeDate(e,!0,!1);case"horizontalSize":return this.getEncodeDate(e,!1,!0);case"verticalSize":return this.getEncodeDate(e,!1,!1)}}getEncodeDate(t,e=!0,r=!0){let i,n;e?(i=Vg.getPanelizeStamp(null),n=new _ie):(n=new Aie,i=Vg.getPanelizeSide(null));let s={};t=Object.assign({vertical:!r},t);for(let a of i)s[a]=n.getData(a,t);return s}};var Q8=class extends Rn{getData(t,e){switch(t){case"layerId":return e.layerId;case"defaultColor":return this.isTop(e)?we.topSilkscreenColor:we.bottomSilkscreenColor;case"baseColor":return this.isTop(e)?we.topBoardColor:we.bottomBoardColor}}isTop(t){return G2(t.layerId)}isBottom(t){return ms(t.layerId)}};var LR=class extends Rn{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"layerId":return e.layerId;case"fileName":{let r=Yd.getItem(e.hashId);return r?r.fileName:(console.error(`\u83B7\u53D6\u771F\u5F69\u56FE\u7247id:${e.globalIndex}template\u5931\u8D25`),"")}case"startX":return xe(e.start.x*10,4);case"startY":return xe(e.start.y*10,4);case"width":return xe(e.width*10,4);case"height":return xe(e.height*10,4);case"angle":return xe(e.rotation/Math.PI*180,4);case"mirror":return e.mirror;case"path":return"blob:"+e.hashId;case"locked":return e.locked;case"zIndex":return e.zIndex}}};var MR=class extends nf{getData(t,e){let r=e.component;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"layerId":return e.layerId;case"booleanOperation":return r instanceof wl?1:0;case"belong":if(r instanceof wl)return r.belong;{let n=0;return r.slotOption.forEach(s=>{n+=s}),n}case"depth":let i=r instanceof wl?r.stretchLength:r.slotDepth;return xe(i*10,4);case"strokeWidth":return xe(e.strokeWidth*10,4);case"path":return this.getShapeInfo(e);case"locked":return e.locked;case"refs":return e.component instanceof wl||e.component instanceof ou?[e.component.lineId]:null;case"type":return this.getType(e);case"entityBelong":return r instanceof wl?this.getBelong(r):null;case"slotOptions":return r instanceof ou?this.getSlotOption(r):null}}getType(t){let e=t.type;return e=="3D Shell - Top/Bottom Entity"||e=="3D Shell - Side Entity"?kk.ENTITY:kk.SLOT}getBelong(t){switch(t.belong){case 0:return eA.AUTO;case 2:return eA.LOWER_SHELLS;case 1:return eA.UPPER_SHELLS}}getSlotOption(t){let e=t.slotOption,r=[];e.forEach(n=>{r.push(i(n))});function i(n){switch(n){case 16:return tA.ENTITY;case 4:return tA.OUTLINE;case 8:return tA.SCREW_PILLAR}}return r}};var NR=class extends Rn{getData(t,e){switch(t){case"name":return e instanceof WI?e.groupName:[];case"sort":if(e instanceof WI)return e.number;case"groupColor":if(e instanceof WI)return e.groupColor;case"pads":if(e instanceof WI){let r=[];for(let i of e.details)r.push([i.pad1Title,i.pad2Title]);return r}}}};var kR=class extends Rn{getData(t,e){switch(t){case 1:return e instanceof rg?[e.pad1Title,e.pad2Title]:[];case 0:if(e instanceof rg)return e.parent.number}}};var J4=class J4{constructor(){this._type="WIRING_CORNER_LINE45";this._mode="WIRING_MODE_SURROUND";this.cornerType=1}static getInstance(){return J4.instance==null&&(J4.instance=new J4),J4.instance}get type(){return this._type}set type(t){this._type=t,this.setType(t)}get mode(){return this._mode}set mode(t){this._mode=t}getRoutingModeByNum(t){switch(t){case 0:return"WIRING_MODE_IGNORE";case 1:return"WIRING_MODE_PUSHAWAY";case 2:return"WIRING_MODE_SURROUND";case 3:return"WIRING_MODE_OBSTRUCT";case 4:return"WIRING_MODE_SURROUND_AND_PUSHAWAY"}}getRoutingModeByStr(t){switch(t){case"WIRING_MODE_IGNORE":return 0;case"WIRING_MODE_PUSHAWAY":return 1;case"WIRING_MODE_SURROUND":return 2;case"WIRING_MODE_OBSTRUCT":return 3;case"WIRING_MODE_SURROUND_AND_PUSHAWAY":return 4}}getRoutingTypeByStr(t){switch(t){case M2.L45:return"WIRING_CORNER_LINE45";case M2.L90:return"WIRING_CORNER_LINE90";case M2.L:return"WIRING_CORNER_FREEANGLE";case M2.R45:return"WIRING_CORNER_ARC45";case M2.R90:return"WIRING_CORNER_ARC90";case M2.R:return"WIRING_CORNER_ARC"}}getRoutingTypeByEnum(t){switch(t){case"WIRING_CORNER_LINE45":return M2.L45;case"WIRING_CORNER_LINE90":return M2.L90;case"WIRING_CORNER_FREEANGLE":return M2.L;case"WIRING_CORNER_ARC45":return M2.R45;case"WIRING_CORNER_ARC90":return M2.R90;case"WIRING_CORNER_ARC":return M2.R}}setType(t){switch(t){case"WIRING_CORNER_LINE45":this.cornerType=1;break;case"WIRING_CORNER_LINE90":this.cornerType=2;break;case"WIRING_CORNER_ARC45":this.cornerType=3;break;case"WIRING_CORNER_ARC90":this.cornerType=4;break;case"WIRING_CORNER_ARC":this.cornerType=5;break;case"WIRING_CORNER_FREEANGLE":this.cornerType=6;break}}getNextType(t){switch(t&&(this.cornerType==2||this.cornerType===3)&&(this.cornerType=4),this.cornerType){case 1:return"WIRING_CORNER_LINE90";case 2:return"WIRING_CORNER_ARC45";case 3:return"WIRING_CORNER_ARC90";case 4:return"WIRING_CORNER_ARC";case 5:return"WIRING_CORNER_FREEANGLE";case 6:return"WIRING_CORNER_LINE45"}}getNextMode(){switch(this._mode){case"WIRING_MODE_IGNORE":return"routeMode(WIRING_MODE_OBSTRUCT)";case"WIRING_MODE_OBSTRUCT":return"routeMode(WIRING_MODE_SURROUND)";case"WIRING_MODE_SURROUND":return"routeMode(WIRING_MODE_SURROUND_AND_PUSHAWAY)";case"WIRING_MODE_SURROUND_AND_PUSHAWAY":return"routeMode(WIRING_MODE_PUSHAWAY)";case"WIRING_MODE_PUSHAWAY":return"routeMode(WIRING_MODE_IGNORE)"}}};J4.instance=null;var tr=J4;var ZI=class{constructor(){}createBaseHeader(){let t={};return t.unit=x.getInstance().unit,t}};function G1(o){if(o instanceof yt)return 0;if(o instanceof Je)return o.isTestPad?o.layerId==12?4:3:o.layerId==12?2:1;if(o instanceof It)return 5;if(o instanceof lr)switch(o.type){case"Board Outline":return 11;case"TearDrop":case"Fill Region":return 6;case"Slot Region":return 8;case"Line":return o.layerId===11?11:9;case"Copper Region":return 13;case"Prohibited Region":return 15}else{if(o instanceof Cn)return 14;if(o instanceof vi)return 16;if(o instanceof dc)switch(o.modelType){case"Copper":return 13;case"Inner":return 14}else return 10}}function dSe(o){if(o instanceof yt)return o.net;if(o instanceof Je)return o.net;if(o instanceof Pn)return o.net;if(o instanceof Cn)return o.net;if(o instanceof It)return o.net;if(o instanceof lr)switch(o.type){case"Copper Region":case"Fill Region":case"Line":case"TearDrop":return mp(o.layerId)?o.net:null;default:return null}return null}function _a(o,t=!1){let e,r=o,i;if((o instanceof Pn||o instanceof Cn)&&(e=o.globalIndex),o instanceof ys||o instanceof nl||o instanceof Pn){let c=o.getParent();c instanceof lr&&(r=c)}o instanceof It&&(i=o.name);let{globalIndex:n,layerId:s}=r,a=t?12:G1(r),l=dSe(r);if(a===6&&r instanceof lr&&r.component instanceof ln){let c=r.component;if(c.isBridgingCopper){let h=c.networkList;return{id:n,isBridgingCopper:c.isBridgingCopper,nets:h,layerId:s,shapeType:a,viaName:i}}}return{id:n,net:l,layerId:s,shapeType:a,viaName:i,...e!==void 0&&{regionId:e},item:r}}var ag=class o extends Pa{constructor(t,e,r,i,n){super(n||"",t,e),this.arc=r,this.width=i}multiply3(t){return new o(this.net,this.layer,this.arc.multiply3(t),t.iScale*this.width)}bbox(){return this.arc.bbox().extendOfSize(this.width/2)}shape(t,e){return this.layer.equals(t)?this.arc.stroke(this.width+e*2,kr.ROUND,le.CW):null}};var qy=class o extends Pa{constructor(t,e,r,i,n,s,a,l,c,h,u){super(t,e,$r.MULTI),this.center=r,this.holeDiameter=an.normal(i),this.startLayerPad=s,this.innerPad=an.normal(a),this.endLayerPad=c,this.mask=h,this.startLayer=n,this.endLayer=l,this.unuseLayers=u,this.__bbox=this._bbox()}multiply3(t){return new o(this.id,this.net,this.center.multiply3(t),t.iScale*this.holeDiameter,this.startLayer,t.iScale*this.startLayerPad,t.iScale*this.innerPad,this.endLayer,t.iScale*this.endLayerPad,this.mask,this.unuseLayers)}bbox(){return this.__bbox}isUnuseLayers(t){for(let e of this.unuseLayers)if(e.equals(t))return!0;return!1}_bbox(){let t=0;for(let e of[this.holeDiameter,this.startLayerPad,this.innerPad,this.endLayerPad])t<e&&(t=e);return t/=2,new ut(this.center.x-t,this.center.x+t,this.center.y-t,this.center.y+t)}shape(t,e){if(this.isUnuseLayers(t))return null;let r=Number.NaN;return t.type!==0?t.equals(this.startLayer)?r=this.startLayerPad/2+e:t.equals(this.endLayer)?r=this.endLayerPad/2+e:this.isContains(t)&&t.type==5?r=this.innerPad/2+e:this.isContains(t)&&t.type==6&&(r=this.innerPad/2+e):this.holeDiameter>0&&(r=this.holeDiameter/2+e),isNaN(r)?null:fe.build2([q.build3(this.center,0,-360,r,r)])}getOutsideShapeWithHole(t,e){if(!this.isContains(t,!1))return null;if(this.isUnuseLayers(t)){let i=this.holeDiameter/2+e;return fe.build2([q.build3(this.center,0,-360,i,i)])}let r;if(t.equals(this.startLayer))r=this.startLayerPad;else if(t.equals(this.endLayer))r=this.endLayerPad;else if(t.type==5||t.type==6)r=this.innerPad;else throw new Error("not support");return r=Math.max(r,this.holeDiameter)/2+e,fe.build2([q.build3(this.center,0,-360,r,r)])}isContains(t,e=!0){if(e&&this.isUnuseLayers(t))return!1;if(t.equals(this.startLayer)||t.equals(this.endLayer))return!0;if(this.startLayer.equals($r.TOP_COPPER)){if(!t.equals($r.BOT_COPPER)&&t.order<=this.endLayer.order)return!0}else if(this.startLayer.equals($r.BOT_COPPER)){if(!t.equals($r.TOP_COPPER)&&t.order>=this.endLayer.order)return!0}else if(this.endLayer.equals($r.TOP_COPPER)){if(!t.equals($r.BOT_COPPER)&&t.order<=this.startLayer.order)return!0}else if(this.endLayer.equals($r.BOT_COPPER)){if(!t.equals($r.TOP_COPPER)&&t.order>=this.startLayer.order)return!0}else if(!t.equals($r.BOT_COPPER)&&!t.equals($r.TOP_COPPER)){if(this.startLayer.order>this.endLayer.order){if(t.order<this.startLayer.order&&t.order>this.endLayer.order)return!0}else if(t.order<this.endLayer.order&&t.order>this.startLayer.order)return!0}return!1}};var of=class o extends Pa{constructor(t,e,r){super(t||"","",$r.OUTLINE),this.type=e,this.outlines=r,this.__bbox=this._bbox()}multiply3(t){return new o(this.id,this.type,this.outlines.multiply3(t))}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.outlines}};var U1=class o extends Pa{constructor(t,e,r,i,n,s){super(s||"","",t),this._leftLow=e,this._leftUp=r,this._rightLow=i,this._rightUp=n}multiply3(t){let e=this._leftLow.multiply3(t),r=this._leftUp.multiply3(t),i=this._rightLow.multiply3(t),n=this._rightUp.multiply3(t);return new o(this.layer,e,r,i,n)}bbox(){let t=new _e;return t.ext2(this._leftLow).ext2(this._leftUp).ext2(this._rightLow).ext2(this._rightUp),t.build1()}shape(t,e){if(this.layer.equals(t)){let r=this._rightLow.sub(this._leftLow).normalize().mul(e),i=this._leftUp.sub(this._leftLow).normalize().mul(e),n=this._leftLow.sub(r).sub(i),s=this._leftUp.sub(r).add(i),a=this._rightLow.add(r).sub(i),l=this._rightUp.add(r).add(i),c=new Array,h=new M(n,a),u=new M(a,l),d=new M(l,s),p=new M(s,n);return c.push(h),c.push(u),c.push(d),c.push(p),fe.build2(c)}else return null}};var Mf=class o extends Pa{constructor(t,e,r,i,n,s){super(s||"",t,e),this.type=r,this.width=i,this.outlines=n,this.__bbox=this._bbox()}multiply3(t){return new o(this.net,this.layer,this.type,this.width,this.outlines.multiply3(t))}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox().extendOfSize(this.width/2)}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outlines:null}};var AT=class{static zoomCorner(t,e){let r=new Array,i=new Array,n=new Array;return this.getPanPrimitive(t,r,n,e),this.rearrange(r,n),this.processStart(r,n),this.getResult(r,n,i,e),i.length>0?fe.build2(i):null}static zoomPolygon(t,e){let r=t.area()>0?t.reverse1():t,i=gy.getExtendPolyLine(r,e,!1);if(i.length===1)return i[0];if(i.length===0)return null;throw new Error("Call durui!")}static zoomLines(t,e){return this.zoomPolygon(fe.build2(t.primitives.concat(t.reverse().primitives)),e/2)}static getPanPrimitive(t,e,r,i){let n=t.primitives;for(let s of n){let a=this.panDistance(s,i);a!==void 0&&(e.push(a),r.push(s))}}static rearrange(t,e){let r=t.length,i=0;for(let a=0;a<r;a++){let l=e[a],c=t[a],h=a==r-1?t[0]:t[a+1];if(!(c instanceof q&&h instanceof q)&&!this.isCW(c.end(),h.start(),l.end())){if(Tt(c,h)!=0){i=a==r-1?0:a+1;break}}else{i=a;break}}let n=this.start4Index(e,i),s=this.start4Index(t,i);e.length=0,t.length=0,n.forEach(a=>{e.push(a)}),s.forEach(a=>{t.push(a)})}static processStart(t,e){let r=t.length;if(r>2){let i=t[r-1],n=t[0],s=e[r-1];if(!(i instanceof q&&n instanceof q)&&!this.isCW(i.end(),n.start(),s.end())){let a=Tt(i,n);for(let l=0;l<a;l+=2){let c=new S(Ee[l],Ee[l+1]);t[r-1]=this.generatePrimitive(i,i.start(),c),t[0]=this.generatePrimitive(n,c,n.end())}}}}static getResult(t,e,r,i){let n=t.length;for(let s=0;s<n;s++){let a=e[s],l=s===n-1?e[0]:e[s+1],c=s==n-1?0:s+1,h=c==n-1?e[0]:e[c+1],u=t[s],d=s==n-1?t[0]:t[s+1],p=c==n-1?t[0]:t[c+1];if(!(u instanceof q&&d instanceof q)&&!this.isCW(u.end(),d.start(),a.end())){let g=this.add(t,r,s,u,d,0);g=this.update(t,r,s,d,g);let y=this.generateArc(l,h,d,p,i);if(g=this.add(t,r,s,u,y,g),g=this.update(t,r,s,y,g),g>0)continue}r.push(u);let m=this.generateArc(a,l,u,d,i);m!==void 0&&r.push(m)}}static generateArc(t,e,r,i,n){if(n>0){let s=t.end(),a=e.start(),l=r.end(),c=i.start();if(l.distance2(c)>1e-8)if(s.equals(a)){let h=l.angleD(s),u=c.angleD(s);return q.build2(s,h,u,n,n,le.CW)}else{let h=l.angleD(s),u=c.angleD(s),d=l.angleD(a),p=c.angleD(a),m=q.build2(s,h,u,n,n,le.CW),g=q.build2(a,d,p,n,n,le.CW);return m.pointOn(m.endAngle()).equals1(c)?m:g.pointOn(g.endAngle()).equals1(c)?g:m}}}static updateNews(t,e,r,i){let n=t.length,s=e==n-1?0:e+1;t[s]=this.generatePrimitive(r,i,r.end())}static add(t,e,r,i,n,s){if(s>0)return s;if(i!=null&&n!=null){let a=Tt(i,n);for(let l=0;l<a;l+=2){let c=new S(Ee[l],Ee[l+1]);e.push(this.generatePrimitive(i,i.start(),c)),this.updateNews(t,r,n,c);break}return a}else return 0}static update(t,e,r,i,n){if(n>0)return n;let s=e.length;if(s>0&&i!=null){let a=e[s-1],l=Tt(a,i);for(let c=0;c<l;c+=2){let h=new S(Ee[c],Ee[c+1]);e[s-1]=this.generatePrimitive(a,a.start(),h),this.updateNews(t,r,i,h)}return l}else return 0}static generatePrimitive(t,e,r){if(t instanceof M)return new M(e,r);if(t instanceof q){let i=t,n=e.angleD(i.center),s=r.angleD(i.center);return q.build2(i.center,n,s,i.rx,i.ry,i.sweep())}else throw new Error("not supported operation")}static start4Index(t,e){let r=t.length,i=new Array;for(let n=e;n<r;n++)i.push(t[n]);for(let n=0;n<e;n++)i.push(t[n]);return i}static isCW(t,e,r){let i=new M(r,t),n=new M(r,e),s=i.end().x-i.start().x,a=i.end().y-i.start().y,l=n.end().x-n.start().x,c=n.end().y-n.start().y;return!(s*c-a*l>0)}static panDistance(t,e){if(t instanceof M){if(t.isPoint())return;{let r=t.panDistance(e);return r.length()>1e-5?r:void 0}}else if(t instanceof q){let r=t;if(r.sweepAngle>0){if(r.rx-e<=0||r.ry-e<=0)return}else if(r.sweepAngle<0&&(r.rx+e<=0||r.ry+e<=0))return;return r=r.panDistance(e),r.start().distance1(r.end())>1e-5||ne.eq(Math.abs(r.sweepAngle),360)?r:void 0}else throw new Error("not supported operation")}};var tP=class o{constructor(t,e,r,i,n){if(t===4){this.outline=an.notnull(n);let s=n.bbox();e=s.width(),r=s.height()}else this.outline=an.mustnull(n);if(this.type=t,this.xSize=e,this.ySize=r,0<=i&&i<=100)this.cornerRadius=i;else throw new Error("cornerRadius is only allowed 0-100")}transform(t){let e=this.outline!==null?this.outline.multiply3(t):null;return new o(this.type,t.iScale*this.xSize,t.iScale*this.ySize,this.cornerRadius,e)}equals(t){return t!==null&&t instanceof o?t.type!==this.type||t.xSize!==this.xSize||t.ySize!==this.ySize?!1:t.cornerRadius===this.cornerRadius:!1}},JI=class o{constructor(t,e,r,i,n){t.type===0?(an.notnull(e),an.notnull(r),an.notnull(i)):t.type===4?(an.notnull(e),an.mustnull(r),an.mustnull(i)):t.type===7?(an.mustnull(e),an.mustnull(r),an.notnull(i)):(an.mustnull(e),an.notnull(r),an.mustnull(i)),this.top=n?this.mirrorShapes(e,n):e,this.inner=r,this.bot=i,this.layer=t}mirrorShapes(t,e){let r=t&&t.outline;if(!r)return null;let i=[];return r.points(1,n=>{i.push(n.mirrorY(e))}),new tP(t.type,t.xSize,t.ySize,t.cornerRadius,fe.build4(i))}transform(t){let e=this.top!==null?this.top.transform(t):null,r=this.inner!==null?this.inner.transform(t):null,i=this.bot!==null?this.bot.transform(t):null;return new o(this.layer,e,r,i)}};var _T=class o{constructor(t,e,r,i,n,s){if(ne.less(r,e))throw new Error(Td.format("hole size %f must less or eq than hole length %f",e,r));this.type=t,this.size=an.positiveOr0(e),this.length=an.positiveOr0(r),this.rotation=i,this.offsetX=an.normal(n),this.offsetY=an.normal(s)}transform(t){return new o(this.type,t.iScale*this.size,t.iScale*this.length,this.rotation,t.iScale*this.offsetX,t.iScale*this.offsetY)}},O0=class o extends Pa{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g=new Array,y){super(t,e,r),this.location=i,this.rotation=n,this.shapes=s,this.hole=a,this.pasteMaskEx=an.normal(l),this.topSolderMaskEx=an.normal(c),this.bottomSolderMaskEx=an.normal(h),this.designator=u,this.plated=d,this.flag=p,this.__bbox=this._bbox(),this.padRule=m,this.unuseLayers=g,this.type=y}multiply3(t){return new o(this.id,this.net,this.layer,this.location.multiply3(t),Ht.transformD(this.rotation,t),this.shapes.transform(t),this.hole.transform(t),this.pasteMaskEx*t.iScale,this.topSolderMaskEx*t.iScale,this.bottomSolderMaskEx*t.iScale,this.designator,this.plated,this.flag,this.padRule,this.unuseLayers)}bbox(){return this.__bbox}_bbox(){let t=new _e,e=0,r=0;for(let c of[this.shapes.top,this.shapes.inner,this.shapes.bot])c!==null&&(e<c.xSize&&(e=c.xSize),r<c.ySize&&(r=c.ySize),c.outline!==null&&t.ext1(c.outline.bbox()));e/=2,r/=2;let i=this.location.add1(-e,r),n=this.location.add1(e,-r),s=this.location.add1(e,r),a=this.location.add1(-e,-r),l=Qe.rotateD(this.rotation).setOrigin1(this.location);if(t.ext2(i.multiply3(l)).ext2(n.multiply3(l)).ext2(s.multiply3(l)).ext2(a.multiply3(l)),this.layer.type===0){e=this.hole.size/2,r=this.hole.length/2;let c=this.location.add1(this.hole.offsetX,this.hole.offsetY);i=c.add1(-e,r),n=c.add1(e,-r),s=this.location.add1(e,r),a=this.location.add1(-e,-r);let h=Qe.rotateD(this.hole.rotation).setOrigin1(c);i=i.multiply3(h),n=n.multiply3(h),t.ext2(i.multiply3(l)).ext2(n.multiply3(l)).ext2(s.multiply3(l)).ext2(a.multiply3(l))}return t.build1()}isUnuseLayers(t){for(let e of this.unuseLayers)if(e.equals(t))return!0;return!1}hasHoleShape(){return this.hole&&this.hole.size>0&&this.hole.length>0}shape(t,e){return this.isUnuseLayers(t)?null:t.type!==0?this.shapes.top!==null&&t.type===4?this.generate1(this.shapes.top,e):this.shapes.bot!==null&&t.type===7?this.generate1(this.shapes.bot,e):this.shapes.inner!==null&&t.type===5?this.generate1(this.shapes.inner,e):this.shapes.inner!==null&&t.type===6?this.generate1(this.shapes.inner,e):null:this.hasHoleShape()?this.getHoleShape(e):null}getHoleShape(t){let e=this.hole.size/2+t,r=this.hole.length/2+t,i;switch(this.hole.type){case 2:i=new M(new S(-r+e,0),new S(r-e,0)).stroke(e*2,kr.ROUND,le.CW);break;case 1:i=new M(new S(-e,0),new S(e,0)).stroke(e*2,kr.BUTT,le.CW);break;default:i=fe.build2([q.build3(S.ORIGIN,0,-360,e,e)]);break}return i.multiply3(Qe.rotateD(this.hole.rotation).translate(this.hole.offsetX,this.hole.offsetY).rotateD(this.rotation).translate1(this.location))}generate1(t,e){let r=e*2,i=Qe.rotateD(this.rotation).translate1(this.location);switch(t.type){case 3:{let n,s;if(t.xSize>=t.ySize){let a=(t.xSize-t.ySize)/2;s=t.ySize,n=new M(new S(-a,0),new S(a,0))}else{let a=(t.ySize-t.xSize)/2;s=t.xSize,n=new M(new S(0,-a),new S(0,a))}return s=s+r,s>0?n.stroke(s,kr.ROUND,le.CW).multiply3(i):null}case 1:if(t.cornerRadius==0){if(e>0)return this.roundRectangle(t,e).multiply3(i);{let n=t.xSize/2+e,s=t.ySize+r;return n>0&&s>0?new M(new S(-n,0),new S(n,0)).stroke(s,kr.BUTT,le.CW).multiply3(i):null}}else{let n=Math.min(t.xSize,t.ySize)/2,a=(n/100*t.cornerRadius+e)/(n+e),l=t.xSize/2+e,c=t.ySize+r;return Ng(new S(-l,0),new S(l,0),c,a,le.CW).multiply3(i)}case 2:{let n=t.xSize/2+e,s=t.ySize+r;return n>0&&s>0?new M(new S(-n,0),new S(n,0)).stroke(s,kr.BUTT,le.CW).multiply3(i):null}case 4:if(e!==0&&t.outline!==null){let n=t.outline.bbox();return n.width()+r>0&&n.height()+r>0?AT.zoomPolygon(t.outline,e):null}else return t.outline;default:if(t.xSize+r>0&&t.ySize+r>0){if(t.xSize===t.ySize)return fe.build2([q.build3(S.ORIGIN,0,-360,t.xSize/2+e,t.ySize/2+e)]).multiply3(i);if(t.xSize<t.ySize){let n=t.xSize+r,s=(t.ySize-t.xSize)/2;return new M(new S(0,-s),new S(0,s)).stroke(n,kr.ROUND,le.CW).multiply3(i)}else{let n=(t.xSize-t.ySize)/2,s=t.ySize+r;return new M(new S(-n,0),new S(n,0)).stroke(s,kr.ROUND,le.CW).multiply3(i)}}else return null}}roundRectangle(t,e){return fe.build2([new M(new S(-t.xSize/2,t.ySize/2+e),new S(t.xSize/2,t.ySize/2+e)),q.build3(new S(t.xSize/2,t.ySize/2),90,-90,e,e),new M(new S(t.xSize/2+e,t.ySize/2),new S(t.xSize/2+e,-t.ySize/2)),q.build3(new S(t.xSize/2,-t.ySize/2),0,-90,e,e),new M(new S(t.xSize/2,-t.ySize/2-e),new S(-t.xSize/2,-t.ySize/2-e)),q.build3(new S(-t.xSize/2,-t.ySize/2),-90,-90,e,e),new M(new S(-t.xSize/2-e,-t.ySize/2),new S(-t.xSize/2-e,t.ySize/2)),q.build3(new S(-t.xSize/2,t.ySize/2),-180,-90,e,e)])}pIsInLine(t,e,r){return e.start().distance2(t)<=r||e.end().distance2(t)<=r?!0:this.pointToLineSegmentDistanceSimplified2(t,e.start(),e.end())<=r}pointToLineSegmentDistanceSimplified2(t,e,r){let i=c(r,e),n=c(t,e),s=u(i);if(s===0)return u(n)**2;let a=h(n,i)/s,l=Math.max(0,Math.min(a,s));return Math.abs(u(n)**2-l**2);function c(d,p){return new S(d.x-p.x,d.y-p.y)}function h(d,p){return d.x*p.x+d.y*p.y}function u(d){return Math.sqrt(d.x*d.x+d.y*d.y)}}getOutsideShapeWithLine(t,e,r,i){let n=new S(this.hole.offsetX,this.hole.offsetY),s=Qe.rotateD(this.hole.rotation).translate1(n),a=this.hole.size/2+i,l=this.hole.length/2+i,c=[];switch(this.hole.type){case 2:{let u=new S(-l+a,0).multiply3(s),d=new S(l-a,0).multiply3(s),p=(r/2-a)**2;if(r>a*2){c.push(new M(t,e).stroke(r,kr.ROUND,le.CW));let m=new M(t,e);this.pIsInLine(u,m,p)&&this.pIsInLine(d,m,p)||c.push(new M(u,d).stroke(a*2,kr.ROUND,le.CW))}else{c.push(new M(u,d).stroke(a*2,kr.ROUND,le.CW));let m=new M(u,d);this.pIsInLine(t,m,p)&&this.pIsInLine(e,m,p)||c.push(new M(t,e).stroke(r,kr.ROUND,le.CW))}break}case 1:{let u=new S(-a,0).multiply3(s),d=new S(a,0).multiply3(s),p=(r/2-a)**2;if(r>a*2){c.push(new M(t,e).stroke(r,kr.ROUND,le.CW));let m=new M(t,e);(!this.pIsInLine(new S(-a,-a).multiply3(s),m,p)||!this.pIsInLine(new S(-a,a).multiply3(s),m,p)||!this.pIsInLine(new S(a,-a).multiply3(s),m,p)||!this.pIsInLine(new S(a,a).multiply3(s),m,p))&&c.push(new M(u,d).stroke(a*2,kr.BUTT,le.CW))}else{c.push(new M(u,d).stroke(a*2,kr.BUTT,le.CW));let m=s.getInverseMatrix();t=t.multiply3(m);let g=a-r/2;t.x>g||t.x<-g||t.y>g||t.y<-g?c.push(new M(t,e).stroke(r,kr.ROUND,le.CW)):(e=e.multiply3(m),(e.x>g||e.x<-g||e.y>g||e.y<-g)&&c.push(new M(e,e).stroke(r,kr.ROUND,le.CW)))}break}default:{let u=(r/2-a)**2;r>a*2?(c.push(new M(t,e).stroke(r,kr.ROUND,le.CW)),this.pIsInLine(n,new M(t,e),u)||c.push(fe.build2([q.build3(n,0,-360,a,a)]))):(c.push(fe.build2([q.build3(n,0,-360,a,a)])),t.distance2(n)<=u&&e.distance2(n)<=u||c.push(new M(t,e).stroke(r,kr.ROUND,le.CW)));break}}let h=Qe.rotateD(this.rotation).translate1(this.location);return c.map(u=>u.multiply3(h))}getOutsideShapeWithRect(t,e,r,i=0){let n=t/2,s=e/2,l=Math.min(t,e)/2,c=n-i,h=s-i,u=[new S(-c,-h),new S(-c,h),new S(c,-h),new S(c,h)];function d(T,I=0){if(I>=i)return T.x<=n-I&&T.x>=-(n-I)&&T.y<=s-I&&T.y>=-(s-I);if(T.x<=n-I&&T.x>=-(n-I)&&T.y<=h-I&&T.y>=-(h-I)||T.x<=c-I&&T.x>=-(c-I)&&T.y<=s-I&&T.y>=-(s-I))return!0;let C=(i-I)**2;return u[0].distance2(T)<C||u[1].distance2(T)<C||u[2].distance2(T)<C||u[3].distance2(T)<C}let p=new S(this.hole.offsetX,this.hole.offsetY),m=Qe.rotateD(this.hole.rotation).translate1(p),g=this.hole.size/2+r,y=this.hole.length/2+r,b=[];switch(this.hole.type){case 2:{let T=new S(-y+g,0).multiply3(m),I=new S(y-g,0).multiply3(m);if(l>g)b.push(Ng(new S(-n,0),new S(n,0),e,i/l,le.CW)),(!d(T,g)||!d(I,g))&&b.push(new M(T,I).stroke(g*2,kr.ROUND,le.CW));else{b.push(new M(T,I).stroke(g*2,kr.ROUND,le.CW));let C=new M(T,I),E=(g-i)**2;(!this.pIsInLine(new S(-c,-h),C,E)||!this.pIsInLine(new S(-c,h),C,E)||!this.pIsInLine(new S(c,-h),C,E)||!this.pIsInLine(new S(c,h),C,E))&&b.push(Ng(new S(-n,0),new S(n,0),e,i/l,le.CW))}break}case 1:{let T=new S(-g,0).multiply3(m),I=new S(g,0).multiply3(m);if(l>g)b.push(Ng(new S(-n,0),new S(n,0),e,i/l,le.CW)),(!d(new S(-g,-g).multiply3(m))||!d(new S(-g,g).multiply3(m))||!d(new S(g,-g).multiply3(m))||!d(new S(g,g).multiply3(m)))&&b.push(new M(T,I).stroke(g*2,kr.BUTT,le.CW));else{let O=function(_){return _=_.multiply3(C),_.x<=E&&_.x>=-E&&_.y<=E&&_.y>=-E};b.push(new M(T,I).stroke(g*2,kr.BUTT,le.CW));let C=m.getInverseMatrix(),E=g-i;(!O(new S(-c,-h))||!O(new S(-c,h))||!O(new S(c,-h))||!O(new S(c,h)))&&b.push(Ng(new S(-n,0),new S(n,0),e,i/l,le.CW))}break}default:{if(l>g)b.push(Ng(new S(-n,0),new S(n,0),e,i/l,le.CW)),d(p,g)||b.push(fe.build2([q.build3(p,0,-360,g,g)]));else{b.push(fe.build2([q.build3(p,0,-360,g,g)]));let T=(g-i)**2;(new S(-c,-h).distance2(p)>T||new S(-c,h).distance2(p)>T||new S(c,-h).distance2(p)>T||new S(c,h).distance2(p)>T)&&b.push(Ng(new S(-n,0),new S(n,0),e,i/l,le.CW))}break}}let P=Qe.rotateD(this.rotation).translate1(this.location);return b.map(T=>T.multiply3(P))}getOutsideShapeWithCircle(t,e){let r=t**2,i=new S(this.hole.offsetX,this.hole.offsetY),n=Qe.rotateD(this.hole.rotation).translate1(i),s=this.hole.size/2+e,a=this.hole.length/2+e,l=[];switch(this.hole.type){case 2:{let h=new S(-a+s,0).multiply3(n),u=new S(a-s,0).multiply3(n);if(t>s){l.push(fe.build2([q.buildCircle(S.ORIGIN,t,le.CW)]));let d=(t-s)**2;(S.ORIGIN.distance2(h)>d||S.ORIGIN.distance2(u)>d)&&l.push(new M(h,u).stroke(s*2,kr.ROUND,le.CW))}else l.push(new M(h,u).stroke(s*2,kr.ROUND,le.CW)),this.pIsInLine(S.ORIGIN,new M(h,u),(s-t)**2)||l.push(fe.build2([q.buildCircle(S.ORIGIN,t,le.CW)]));break}case 1:{let h=new S(-s,0).multiply3(n),u=new S(s,0).multiply3(n);if(t>s)l.push(fe.build2([q.buildCircle(S.ORIGIN,t,le.CW)])),(new S(-s,-s).multiply3(n).distance2(S.ORIGIN)>r||new S(-s,s).multiply3(n).distance2(S.ORIGIN)>r||new S(s,-s).multiply3(n).distance2(S.ORIGIN)>r||new S(s,s).multiply3(n).distance2(S.ORIGIN)>r)&&l.push(new M(h,u).stroke(s*2,kr.BUTT,le.CW));else{l.push(new M(h,u).stroke(s*2,kr.BUTT,le.CW));let d=n.getInverseMatrix(),p=S.ORIGIN.multiply3(d),m=s-t;(p.x<-m||p.x>m||p.y<-m||p.y>m)&&l.push(fe.build2([q.buildCircle(S.ORIGIN,t,le.CW)]))}break}default:{t>s?(l.push(fe.build2([q.buildCircle(S.ORIGIN,t,le.CW)])),i.distance2(S.ORIGIN)>(t-s)**2&&l.push(fe.build2([q.build3(i,0,-360,s,s)]))):(l.push(fe.build2([q.build3(i,0,-360,s,s)])),i.distance2(S.ORIGIN)>(s-t)**2&&l.push(fe.build2([q.buildCircle(S.ORIGIN,t,le.CW)])));break}}let c=Qe.rotateD(this.rotation).translate1(this.location);return l.map(h=>h.multiply3(c))}getOutsideShapeWithHole(t,e,r){r==null&&(r=e);let i;if(t.type===4?i=this.shapes.top:t.type===7?i=this.shapes.bot:(t.type===5||t.type===6)&&(i=this.shapes.inner),!i||this.isUnuseLayers(t))return this.isUnuseLayers($r.MULTI)||!this.hasHoleShape()?[]:[this.getHoleShape(r)];if(this.isUnuseLayers($r.MULTI)||!this.hasHoleShape()){let s=this.generate1(i,e);return s?[s]:[]}let n=e*2;switch(i.type){case 3:{let s,a;if(i.xSize>=i.ySize){let l=(i.xSize-i.ySize)/2;a=i.ySize,s=new M(new S(-l,0),new S(l,0))}else{let l=(i.ySize-i.xSize)/2;a=i.xSize,s=new M(new S(0,-l),new S(0,l))}return a=a+n,a>0?this.getOutsideShapeWithLine(s.start(),s.end(),a,r):[this.getHoleShape(r)]}case 1:if(i.cornerRadius==0){if(e>0)return this.getOutsideShapeWithRect(i.xSize+n,i.ySize+n,r,e);{let s=i.xSize+n,a=i.ySize+n;return s>0&&a>0?this.getOutsideShapeWithRect(s,a,r):[this.getHoleShape(r)]}}else{let s=Math.min(i.xSize,i.ySize)/2,l=(s/100*i.cornerRadius+e)/(s+e),c=i.xSize+n,h=i.ySize+n;return this.getOutsideShapeWithRect(c,h,r,l*Math.min(c,h)/2)}case 2:{let s=i.xSize+n,a=i.ySize+n;return s>0&&a>0?this.getOutsideShapeWithRect(s,a,r):[this.getHoleShape(r)]}case 4:if(e!==0&&i.outline!==null){let s=i.outline.bbox();return s.width()+n>0&&s.height()+n>0?[AT.zoomPolygon(i.outline,e),this.getHoleShape(r)]:[this.getHoleShape(r)]}else return[i.outline,this.getHoleShape(r)];default:if(i.xSize+n>0&&i.ySize+n>0){if(i.xSize===i.ySize)return this.getOutsideShapeWithCircle(i.xSize/2+e,r);if(i.xSize<i.ySize){let s=i.xSize+n,a=(i.ySize-i.xSize)/2;return this.getOutsideShapeWithLine(new S(0,-a),new S(0,a),s,r)}else{let s=(i.xSize-i.ySize)/2,a=i.ySize+n;return this.getOutsideShapeWithLine(new S(-s,0),new S(s,0),a,r)}}else return[this.getHoleShape(r)]}}};var vT=class o extends Pa{constructor(t,e,r,i,n="",s){super(n,t,e),this.type=r,this.outlines=i,this.__bbox=this._bbox(),this.networkList=s}get isBridgingCopper(){return!!this.networkList}multiply3(t){return new o(this.net,this.layer,this.type,this.outlines.multiply3(t))}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outlines:null}};var $y=class o extends Pa{constructor(t,e,r){super(t||"","",$r.MULTI),this.type=e,this.outlines=r,this.__bbox=this._bbox()}multiply3(t){return new o(this.id,this.type,this.outlines.multiply3(t))}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.outlines}};var Ll=class o extends Pa{constructor(t,e,r,i,n,s,a,l,c){super(t,e,$r.MULTI),this.center=r,this.holeDiameter=an.normal(i),this.topPad=n,this.innerPad=an.normal(s),this.botPad=a,this.mask=l,this.unuseLayers=c,this.__bbox=this._bbox()}isContains(t){return!this.isUnuseLayers(t)}multiply3(t){return new o(this.id,this.net,this.center.multiply3(t),t.iScale*this.holeDiameter,t.iScale*this.topPad,t.iScale*this.innerPad,t.iScale*this.botPad,this.mask,this.unuseLayers)}bbox(){return this.__bbox}_bbox(){let t=0;for(let e of[this.holeDiameter,this.topPad,this.innerPad,this.botPad])t<e&&(t=e);return t/=2,new ut(this.center.x-t,this.center.x+t,this.center.y-t,this.center.y+t)}shape(t,e){if(this.isUnuseLayers(t))return null;let r=Number.NaN;return t.type!==0?t.equals($r.TOP_COPPER)?r=this.topPad/2+e:t.equals($r.BOT_COPPER)?r=this.botPad/2+e:t.type===5?r=this.innerPad/2+e:t.type===6&&(r=this.innerPad/2+e):this.holeDiameter>0&&(r=this.holeDiameter/2+e),isNaN(r)?null:fe.build2([q.build3(this.center,0,-360,r,r)])}getOutsideShapeWithHole(t,e,r){if(r==null&&(r=e),this.holeDiameter<=0)return this.shape(t,e);if(this.isUnuseLayers(t)){let n=this.holeDiameter/2+r;return fe.build2([q.build3(this.center,0,-360,n,n)])}let i=Number.NaN;return t.equals($r.TOP_COPPER)?i=this.topPad/2+e:t.equals($r.BOT_COPPER)?i=this.botPad/2+e:t.type===5?i=this.innerPad/2+e:t.type===6&&(i=this.innerPad/2+e),i=isNaN(i)?this.holeDiameter/2+r:Math.max(i,this.holeDiameter/2+r),fe.build2([q.build3(this.center,0,-360,i,i)])}isUnuseLayers(t){for(let e of this.unuseLayers)if(e.equals(t))return!0;return!1}};var pSe=te.getInstance(),MVe;(t=>{let o;(r=>{function e(i){return i instanceof lr&&i.type==="Line"}r.isLine=e})(o=t.TypeCheck||(t.TypeCheck={}))})(MVe||(MVe={}));var fSe=class{constructor(){this.isHole=t=>t instanceof Je&&gr(t.layerId)||t instanceof It;this.isBridgingCopper=t=>{var e;return t instanceof lr&&((e=t.component)==null?void 0:e.isBridgingCopper)}}hasNet(t){return!!(t instanceof yt||t instanceof Je||t instanceof It||t instanceof Pn||t instanceof Cn||oi.isFill(t)||oi.isLine(t)||oi.isTearDrop(t))}isConstraint(t){return t instanceof lr&&t.type==="Constraint Region"}isLine(t){return t instanceof lr&&t.type==="Line"}isBoardOutline(t){return t instanceof lr&&t.layerId===11}isPour(t){return t instanceof lr&&t.type==="Copper Region"}isFill(t){return t instanceof lr&&t.type==="Fill Region"}isProhibit(t){return t instanceof lr&&t.type==="Prohibited Region"}isSlot(t){return t instanceof lr&&t.type==="Slot Region"}isRegion(t){return t instanceof lr&&t.type==="Fill Region"}isTearDrop(t){return t instanceof lr&&t.type==="TearDrop"}isPcbBoxShape(t){return t instanceof rR||t instanceof Li}isSingleLayerShape(t){return!(gr(t.layerId)||U2(t.layerId))}isPlaneLayer(t){let e=$e.getInstance().getLayer(t);return e&&Rh(e.type)}isUnuseLayer(t){let e=$e.getInstance().getLayer(t);return e==null||!e.config}isSmdComponent(t){return t.getPads().every(r=>!gr(r.layerId))}getShapeNetDiff(t){if(t.net){let e=pSe.getNet(t.net);return e==null?null:e.netDifferential}return null}getShape2NetDiff(t,e){if(t.net&&e.net){let r=pSe.getNet(t.net),i=pSe.getNet(e.net);if(r&&i&&r.netDifferential==i.netDifferential&&r.netDifferential!=null)return r.netDifferential}}getModelPairHoleStatus(t,e){let r=oi.isHole(t),i=oi.isHole(e);return r&&i?2:r?0:i?1:3}getMultiShapeEffectLayers(t){if(t instanceof It)return t.type==1?$e.getInstance().getAllCopperLayerIds().filter(r=>t.isContains(r)):[12]}hasIntersectionNet(t,e,r=!1){if(r)return!0;if(typeof e=="string")return t.includes(e);for(let i of e)if(t.includes(i))return!0;return!1}getFillOutline(t){let e=t.getOutline();return t instanceof Pn&&(t.style==="45grid"||t.style==="90grid")&&(e=e.filter(r=>!(r.primitives.length===1&&r.primitives[0]instanceof M))),e}},oi=new fSe;var mSe=class{constructor(){this.cacheManager=_u.getInstance()}clear(){this.cacheManager.clear()}getCache(t,e=t.layerId){let r=this.getCache2(t,e);return r||(t instanceof yt?this.getTrackCache(t):t instanceof lr?this.getProfileCache(t):t instanceof Pn?this.getCopperOutlineCache(t):t instanceof Cn?this.getPlaneZoneCache(t):t instanceof Je?this.getPadCache(t,e):t instanceof It?this.getViaCache(t,e):t instanceof vi?this.getComponentCache(t):t instanceof Li||t instanceof ql?this.getOtherCache(t):null)}getComponentCache(t){let e=this.getCache2(t);if(e==null){let r=t.getMathGraphics();e=this.cacheManager.addCache(t.globalIndex,t.layerId,r,0)}return e}getOtherCache(t){let e=this.getCache2(t);if(e==null){let r=t.getMathGraphics(t.layerId);e=this.cacheManager.addCache(t.globalIndex,t.layerId,r,0)}return e}getPadCache(t,e){let r=this.getCache2(t,e);if(r==null){let i=t.getMathGraphics(e);r=this.cacheManager.addCache(t.globalIndex,e,i,0)}return r}getViaCache(t,e){let r=this.getCache2(t,e);if(r==null){let i=t.getMathGraphics(e);r=this.cacheManager.addCache(t.globalIndex,e,i,0)}return r}getTrackCache(t){let e=this.getCache2(t);return e==null&&(e=this.cacheManager.addCache(t.globalIndex,t.layerId,t.primitive,t.width)),e}getProfileCache(t){let e=this.getCache2(t);if(e)return e;let r=t.type;switch(oi.isBoardOutline(t)&&(r="Board Outline"),r){case"Line":let i=t.getMathGraphics().primitives;return this.cacheManager.addCache(t.globalIndex,t.layerId,i,t.strokeWidth);case"Board Outline":{let s=t.getMathGraphics().primitives;return this.cacheManager.addCache(t.globalIndex,t.layerId,s,0)}case"Constraint Region":case"Prohibited Region":case"Fill Region":case"TearDrop":case"Slot Region":{let s=t.getMathGraphics();return this.cacheManager.addCache(t.globalIndex,t.layerId,s,0)}default:return null}}getPlaneZoneCache(t){let e=this.getCache2(t);return e==null&&(e=this.cacheManager.addCache(t.globalIndex,t.layerId,new Gt(t.pls))),e}getCopperOutlineCache(t){let e=this.getCache2(t);if(e==null){let r=t.getOutline();if(t.isSolid){r=r.map(s=>s.closeEndpoint());let i=new Gt(r),n=t.optimization?t.optimizationWidth:0;e=this.cacheManager.addCache(t.globalIndex,t.layerId,i,n)}else{let i=[];r.forEach(n=>{i.push(...n.primitives)}),e=this.cacheManager.addCache(t.globalIndex,t.layerId,i,t.gridLineWidth)}}return e}getCache2(t,e=t.layerId){return this.cacheManager.getCache(t.globalIndex,e)}},bh=new mSe;var o3=class{clear(){bh.clear()}isInConstraint(t,e){let r,i;if(t instanceof lr){let n=bh.getProfileCache(t);if(!n)return!1;i=n.layerId,r=n.shape}else r=t;if(e instanceof yt)return this.getPtsCtrlPoints(s=>this.primitiveIterator([e.primitive],s)).every(s=>Jr.inPolyline(s,r));if(e instanceof lr){if(e.type==="Prohibited Region")return!1;let n=[];if(e instanceof Aa)n=[e.leftLow,e.rightLow,e.rightUp,e.leftUp];else if(e instanceof Po){let{center:s,radius:a}=e,l=s.add(new S(-1,0).mul(a)),c=s.add(new S(1,0).mul(a)),h=s.add(new S(0,1).mul(a)),u=s.add(new S(0,-1).mul(a));n=[s,l,c,h,u]}else e instanceof ss&&(n=this.getPtsCtrlPoints(e.iteratorChildren.bind(e)),e.type=="TearDrop"&&(n=bh.getProfileCache(e).shape.getPoints(.1)));return n.every(s=>Jr.inPolyline(s,r))}else if(e instanceof It){let n=e.center;return(i==12||e.isContains(i))&&Jr.inPolyline(n,r)}else if(e instanceof Je){let n=e.center;return Jr.inPolyline(n,r)}else if(e instanceof Li||e instanceof ql){let n=e.bbox.center();return Jr.inPolyline(n,r)}else if(e instanceof vi){let n=e.position;return Jr.inPolyline(n,r)}else if(e instanceof Pn||e instanceof Cn){if(!e.pls||e.pls.length==0)return!1;let n=e.pls[0].primitives;return this.getPtsCtrlPoints(a=>this.primitiveIterator(n,a)).every(a=>Jr.inPolyline(a,r))}return!1}isTrackTouchConstraint(t,e){let r,i;if(t instanceof lr){let n=bh.getProfileCache(t);i=n.layerId,r=n.shape}else r=t;return e instanceof yt?this.getPtsCtrlPoints(s=>this.primitiveIterator([e.primitive],s)).some(s=>Jr.inPolyline(s,r)):!1}primitiveIterator(t,e){return t.some((r,i)=>e(r,i))}getPtsCtrlPoints(t){let e=[];return t((r,i)=>{if(r instanceof M||r instanceof ys)i==0&&e.push(r instanceof ys?r.start:r.start()),e.push(r instanceof ys?r.end:r.end());else if(r instanceof q||r instanceof nl)if(ne.less(Math.abs(r.sweepAngle),360))i==0&&e.push(r instanceof nl?r.start:r.start()),e.push(r.midPoint),e.push(r instanceof nl?r.end:r.end());else{let n=r.center,s=r.rx,a=n.add(new S(-1,0).mul(s)),l=n.add(new S(1,0).mul(s)),c=n.add(new S(0,1).mul(s)),h=n.add(new S(0,-1).mul(s));e.push(a,l,c,h)}}),e}};function QI(o){return xr(o,(t,e)=>{var n,s;let r=((n=t.component.name.match(/\d+$/))==null?void 0:n[0])||0,i=((s=e.component.name.match(/\d+$/))==null?void 0:s[0])||0;return Number(r)-Number(i)}),o}function Bj(o){return o=o.filter(t=>t),xr(o,(t,e)=>{var n,s;let r=((n=t.match(/\d+$/))==null?void 0:n[0])||0,i=((s=e.match(/\d+$/))==null?void 0:s[0])||0;return Number(r)-Number(i)}),o}var Lu=class extends z2{constructor(e,r,i){super();this.locked=!1;this.name=e,this.globalIndex=r,this.position=i}get name(){return this._name}set name(e){this._name=e}get position(){return this._position}set position(e){this._position=e}get isEmpty(){return!1}get layerIds(){return this._layerIds}set layerIds(e){e&&(this._layerIds=e)}updateBox(){return null}transform(e){}clone(){return null}toJSON(){let{globalIndex:e}=this;return{globalIndex:e}}};var rP=class extends Lu{constructor(t,e,r,i,n,s,a){super(r,t,e),this._obj=i,this._startLayer=n,this._endLayer=s,this.layerIds=a}get obj(){return this._obj}set obj(t){this._obj=t}get startLayer(){return this._startLayer}set startLayer(t){this._startLayer=t}get endLayer(){return this._endLayer}set endLayer(t){this._endLayer=t}get errorType(){return"Blind/Buried Via"}toJSON(){return{...super.toJSON(),errorType:this.errorType,name:this.name,obj:this.obj,startLayer:this.startLayer,endLayer:this.endLayer}}};var sf=class extends Lu{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p){super(r,t,e),this._obj1=i,this._obj2=s,this._obj1Type=n,this._obj2Type=a,this._minDistance=l,this._clearance=c,this._errorType=h,this.layerIds=u,this._net=d,this._line=p}get errorType(){return this._errorType}get line(){return this._line}set line(t){this._line=t}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get obj1Type(){return this._obj1Type}set obj1Type(t){this._obj1Type=t}get obj2(){return this._obj2}set obj2(t){this._obj2=t}get obj2Type(){return this._obj2Type}set obj2Type(t){this._obj2Type=t}get minDistance(){return this._minDistance}set minDistance(t){this._minDistance=t}get clearance(){return this._clearance}set clearance(t){this._clearance=t}get net(){return this._net}set net(t){this._net=t}toJSON(){let{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,errorType:h,layerIds:u,net:d,line:p}=this;return{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,errorType:h,layerIds:u,net:d,line:p}}};var Ky=class extends Lu{constructor(t,e,r,i,n,s,a,l){super(r,t,e),this._obj1=i,this._obj1Type=n,this._net=s,this.isFree=a,this._errorType="No Connection",this.layerIds=l}get errorType(){return this._errorType}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get obj1Type(){return this._obj1Type}set obj1Type(t){this._obj1Type=t}get net(){return this._net}set net(t){this._net=t}get errInfo(){return this.isFree?this.obj1Type=="Copper Region(Filled)"||this.obj1Type=="Plane Zone"?"{obj1} is a free copper region":this.obj1Type=="Track"?"{obj1} is a free track":this.obj1Type=="Line"?"{obj1} is a free line":this.obj1Type=="Fill Region"?"{obj1} is a free fill region":"":"{obj1} is disconnected from other objects of the same network"}toJSON(){return{...super.toJSON(),errorType:this.errorType,name:this.name,obj1:this.obj1,obj1Type:this.obj1Type,net:this.net}}};var Zy=class extends Lu{constructor(t,e,r,i,n,s,a,l,c,h){super(r,t,e),this._obj1=i,this._obj2=s,this._obj1Type=n,this._obj2Type=a,this._minDistance=l,this._clearance=c,this.layerIds=h}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get obj1Type(){return this._obj1Type}set obj1Type(t){this._obj1Type=t}get obj2(){return this._obj2}set obj2(t){this._obj2=t}get obj2Type(){return this._obj2Type}set obj2Type(t){this._obj2Type=t}get minDistance(){return this._minDistance}set minDistance(t){this._minDistance=t}get clearance(){return this._clearance}set clearance(t){this._clearance=t}get errorType(){return"Differential Pair Error"}toJSON(){let{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,layerIds:h}=this;return{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,layerIds:h}}};var Jy=class extends Lu{constructor(t,e,r,i,n,s,a,l){super(r,t,e),this.net_P=i,this.net_N=n,this.toleranceScope=s,this.value_P=a,this.value_N=l}get errorType(){return"Differential Pair Error"}toJSON(){let{globalIndex:t,position:e,name:r,net_P:i,net_N:n,toleranceScope:s,value_P:a,value_N:l}=this;return{globalIndex:t,position:e,name:r,net_P:i,net_N:n,toleranceScope:s,value_P:a,value_N:l}}};var Qy=class extends Lu{constructor(t,e,r,i,n,s,a,l){super(r,t,e),this.obj=i,this.width=n,this.minWidth=s,this.maxWidth=a,this.layerIds=l}get errorType(){return"Differential Pair Error"}toJSON(){let{globalIndex:t,position:e,name:r,obj:i,width:n,minWidth:s,maxWidth:a,layerIds:l}=this;return{globalIndex:t,position:e,name:r,obj:i,width:n,minWidth:s,maxWidth:a,layerIds:l}}};var eC=class extends Lu{constructor(t,e,r,i,n,s,a,l,c,h){super(r,t,e),this._obj1=i,this._obj2=s,this._obj1Type=n,this._obj2Type=a,this._minDistance=l,this._distance=c,this.layerIds=h}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get obj1Type(){return this._obj1Type}set obj1Type(t){this._obj1Type=t}get obj2(){return this._obj2}set obj2(t){this._obj2=t}get obj2Type(){return this._obj2Type}set obj2Type(t){this._obj2Type=t}get minDistance(){return this._minDistance}set minDistance(t){this._minDistance=t}get distance(){return this._distance}set distance(t){this._distance=t}get errorType(){return"Plane Zone"}toJSON(){let{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,distance:c,layerIds:h}=this;return{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,layerIds:h}}};var eb=class extends Lu{constructor(t,e,r,i,n,s,a){super(r,t,e),this._net=i,this._netLength=n,this._minNetLength=s,this._maxNetLength=a}get net(){return this._net}set net(t){this._net=t}get netLength(){return this._netLength}set netLength(t){this._netLength=t}get minNetLength(){return this._minNetLength}set minNetLength(t){this._minNetLength=t}get maxNetLength(){return this._maxNetLength}set maxNetLength(t){this._maxNetLength=t}get errorType(){return"Net Length Range"}toJSON(){let{globalIndex:t,position:e,name:r,net:i,netLength:n,minNetLength:s,maxNetLength:a}=this;return{globalIndex:t,position:e,name:r,net:i,netLength:n,minNetLength:s,maxNetLength:a}}};var xT=class extends Lu{constructor(t,e,r,i,n,s){super(r,t,e),this._net=i,this._netLengthDiff=n,this._netLengthTolerance=s}get net(){return this._net}set net(t){this._net=t}get netLengthDiff(){return this._netLengthDiff}set netLengthDiff(t){this._netLengthDiff=t}get netLengthTolerance(){return this._netLengthTolerance}set netLengthTolerance(t){this._netLengthTolerance=t}get errorType(){return"Net Length Tolerance"}toJSON(){let{globalIndex:t,position:e,name:r,net:i,netLengthDiff:n,netLengthTolerance:s}=this;return{globalIndex:t,position:e,name:r,net:i,netLengthDiff:n,netLengthTolerance:s}}};var tb=class extends Lu{constructor(t,e,r,i,n,s,a,l,c,h){super(r,t,e),this._obj1=i,this._type=n,this._radius=s,this._minRadius=a,this._maxRadius=l,this.layerIds=c,this._isBlind=h}get type(){return this._type}set type(t){this._type=t}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get radius(){return this._radius}set radius(t){this._radius=t}get minRadius(){return this._minRadius}set minRadius(t){this._minRadius=t}get maxRadius(){return this._maxRadius}set maxRadius(t){this._maxRadius=t}get isBlind(){return this._isBlind}set isBlind(t){this._isBlind=t}get errorType(){return"Via Size"}toJSON(){let{globalIndex:t,position:e,name:r,obj1:i,type:n,radius:s,minRadius:a,maxRadius:l,layerIds:c,isBlind:h}=this;return{globalIndex:t,position:e,name:r,obj1:i,type:n,radius:s,minRadius:a,maxRadius:l,layerIds:c,isBlind:h}}};var rb=class extends Lu{constructor(t,e,r,i,n,s,a,l){super(r,t,e),this._obj1=i,this._width=n,this._minWidth=s,this._maxWidth=a,this.layerIds=l}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get width(){return this._width}set width(t){this._width=t}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get errorType(){return"Track Error"}toJSON(){let{globalIndex:t,position:e,name:r,obj1:i,width:n,minWidth:s,maxWidth:a,layerIds:l}=this;return{globalIndex:t,position:e,name:r,obj1:i,width:n,minWidth:s,maxWidth:a,layerIds:l}}};var s3=class extends Lu{constructor(t,e="",r=new S(0,0)){super(e,t,r)}get errorType(){return"Netlist Error"}};var vie=class{constructor(t,e){this.buffer=[];this.capacity=t,this.cb=e}add(t){this.buffer.push(t),this.buffer.length>=this.capacity&&this.flush()}flush(){this.buffer.length>0&&(this.cb(this.buffer),this.buffer.length=0)}};var iP=class extends Lu{constructor(t,e,r,i,n,s,a,l,c,h,u,d){super(r,t,e),this._obj1=i,this._obj2=s,this._obj1Type=n,this._obj2Type=a,this._minDistance=l,this._clearance=c,this._path=d,this._errorType="Creepage Distance",this.layerIds=u}get errorType(){return this._errorType}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get obj1Type(){return this._obj1Type}set obj1Type(t){this._obj1Type=t}get obj2(){return this._obj2}set obj2(t){this._obj2=t}get obj2Type(){return this._obj2Type}set obj2Type(t){this._obj2Type=t}get minDistance(){return this._minDistance}set minDistance(t){this._minDistance=t}get clearance(){return this._clearance}set clearance(t){this._clearance=t}get path(){return this._path}set path(t){this._path=t}toJSON(){let{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,errorType:h,layerIds:u,path:d}=this;return{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,errorType:h,layerIds:u,path:d}}};var Q4=class Q4 extends wi{constructor(){super();this.errorRecordBuffer=null;this.id=0;this._id2ClearanceMap=new Map;this._id2InnerMap=new Map;this._id2TrackMap=new Map;this._id2DiffPairWidthMap=new Map;this._id2DiffPairGapMap=new Map;this._id2DiffPairLengthMap=new Map;this._id2BlindMap=new Map;this._id2NetLengthMap=new Map;this._id2NetLengthToleranceMap=new Map;this._id2RadiusMap=new Map;this._id2ConnectMap=new Map;this._id2NetlistMap=new Map;this._id2CreepageMap=new Map}static getInstance(){return Q4.manager==null&&(Q4.manager=new Q4),Q4.manager}initializeErrorRecordBuffer(){this.errorRecordBuffer=new vie(3e4,e=>{self.workerBus.publish("syncFromContentModel",JSON.stringify(e))})}clearErrorRecordBuffer(){var e;(e=this.errorRecordBuffer)==null||e.flush(),this.errorRecordBuffer=null}get idMapClearance(){return this._id2ClearanceMap}get idMapInner(){return this._id2InnerMap}get idMapTrack(){return this._id2TrackMap}get idMapDiffPairWidth(){return this._id2DiffPairWidthMap}get idMapDiffPairGap(){return this._id2DiffPairGapMap}get idMapDiffPairLength(){return this._id2DiffPairLengthMap}get idMapBlind(){return this._id2BlindMap}get idMapNetLength(){return this._id2NetLengthMap}get idMapNetLengthTolerance(){return this._id2NetLengthToleranceMap}get idMapRadius(){return this._id2RadiusMap}get idMapConnect(){return this._id2ConnectMap}get idMapNetlist(){return this._id2NetlistMap}get idMapCreepage(){return this._id2CreepageMap}getAllClearance(){let e=new Set;for(let[,r]of this.idMapClearance)r.forEach(i=>{e.add(i)});return e}getAllCreepage(){let e=new Set;for(let[,r]of this.idMapCreepage)r.forEach(i=>{e.add(i)});return e}deleteAllError(){this.map.clear(),this._id2ClearanceMap.clear(),this._id2InnerMap.clear(),this._id2TrackMap.clear(),this._id2DiffPairWidthMap.clear(),this._id2DiffPairGapMap.clear(),this._id2DiffPairLengthMap.clear(),this._id2BlindMap.clear(),this._id2NetLengthMap.clear(),this._id2RadiusMap.clear(),this._id2ConnectMap.clear(),this._id2NetlistMap.clear(),this._id2CreepageMap.clear()}getCreepageError(e,r){let i=this.idMapCreepage.get(e);if(i==null)return null;for(let n of i)if(n.obj1==e&&n.obj2==r||n.obj2==e&&n.obj1==r)return n;return null}hasSafeErrorIgnoreCopper(e){let r=this.idMapClearance.get(e);if(r==null)return!1;for(let i of r)if(!this.isCopperOrPlane(i.obj1)&&!this.isCopperOrPlane(i.obj2))return!0;return!1}getClearanceError(e,r){let i=this.idMapClearance.get(e);if(i==null)return null;for(let n of i)if(n.obj1==e&&n.obj2==r||n.obj2==e&&n.obj1==r)return n;return null}hasDiffLengthError(e){return this.idMapDiffPairLength.has(e)}getDiffPairGapError(e,r){let i=this.idMapDiffPairGap.get(e);if(i==null)return null;for(let n of i)if(n.obj1==e&&n.obj2==r||n.obj2==e&&n.obj1==r)return n;return null}isCopperOrPlane(e){return!!(Wo.getInstance().getItem(e)||Ho.getInstance().getItem(e))}addError(e){if(this.map.set(e.globalIndex,e),e instanceof sf){let{obj1:r,obj2:i}=e;this.mapAddSet(this._id2ClearanceMap,r,e),this.mapAddSet(this._id2ClearanceMap,i,e)}else if(e instanceof eC){let{obj1:r,obj2:i}=e;this.mapAddSet(this._id2InnerMap,r,e),this.mapAddSet(this._id2InnerMap,i,e)}else if(e instanceof eb)this.idMapNetLength.set(e.net,e);else if(e instanceof xT)this.idMapNetLengthTolerance.set(e.net,e);else if(e instanceof rb)this.idMapTrack.set(e.obj1,e);else if(e instanceof Qy)this.idMapDiffPairWidth.set(e.obj,e);else if(e instanceof Zy){let{obj1:r,obj2:i}=e;this.mapAddSet(this._id2DiffPairGapMap,r,e),this.mapAddSet(this._id2DiffPairGapMap,i,e)}else if(e instanceof Jy)this.idMapDiffPairLength.set(e.net_P,e),this.idMapDiffPairLength.set(e.net_N,e);else if(e instanceof rP)this.idMapBlind.set(e.obj,e);else if(e instanceof tb)this.idMapRadius.set(e.obj1,e);else if(e instanceof Ky){let r=e.obj1Type=="Bridging Copper"?e.globalIndex:this.getConnectMapId(e);this.idMapConnect.set(r,e)}else if(e instanceof s3)this.idMapNetlist.set(e.globalIndex,e);else if(e instanceof iP){let{obj1:r,obj2:i}=e;this.mapAddSet(this._id2CreepageMap,r,e),this.mapAddSet(this._id2CreepageMap,i,e)}}deleteError(e){if(e==null||!this.map.has(e.globalIndex))return e;if(this.map.delete(e.globalIndex),e instanceof sf){let{obj1:r,obj2:i}=e;this.mapDeleteSet(this._id2ClearanceMap,r,e),this.mapDeleteSet(this._id2ClearanceMap,i,e)}else if(e instanceof eC){let{obj1:r,obj2:i}=e;this.mapDeleteSet(this._id2InnerMap,r,e),this.mapDeleteSet(this._id2InnerMap,i,e)}else if(e instanceof eb)this.idMapNetLength.delete(e.net);else if(e instanceof rb)this.idMapTrack.delete(e.obj1);else if(e instanceof Qy)this.idMapDiffPairWidth.delete(e.obj);else if(e instanceof Zy){let{obj1:r,obj2:i}=e;this.mapDeleteSet(this._id2DiffPairGapMap,r,e),this.mapDeleteSet(this._id2DiffPairGapMap,i,e)}else if(e instanceof Jy)this.idMapDiffPairLength.delete(e.net_P),this.idMapDiffPairLength.delete(e.net_N);else if(e instanceof rP)this.idMapBlind.delete(e.obj);else if(e instanceof tb)this.idMapRadius.delete(e.obj1);else if(e instanceof Ky){let r=e.obj1Type=="Bridging Copper"?e.globalIndex:this.getConnectMapId(e);this.idMapConnect.delete(r)}else if(e instanceof s3)this.idMapNetlist.delete(e.globalIndex);else if(e instanceof iP){let{obj1:r,obj2:i}=e;this.mapDeleteSet(this._id2CreepageMap,r,e),this.mapDeleteSet(this._id2CreepageMap,i,e)}return e}getConnectMapId(e){return e.obj1||e.globalIndex}createId(){return"err"+this.id++}addClearanceError(e,r,i,n,s,a,l,c,h,u="Safe Spacing",d,p){let m=this.createId(),g=new sf(m,e,r,i,n,s,a,l,c,u,h,d,p);return this.addError(g),g}deleteClearanceError(e){let r=this.idMapClearance,i=new Set,n=r.get(e);if(n!=null){for(let s of n)this.deleteError(s),i.add(s);r.delete(e)}return Array.from(i)}addCreepageError(e,r,i,n,s,a,l,c,h="Creepage Distance",u,d){let p=this.createId(),m=new iP(p,e,r,i,n,s,a,l,c,h,u,d);return this.addError(m),m}deleteCreepageError(e){let r=this.idMapCreepage,i=new Set,n=this.idMapCreepage.get(e);if(n!=null){for(let s of n)this.deleteError(s),i.add(s);r.delete(e)}return Array.from(i)}addInnerError(e,r,i,n,s,a,l,c,h){let u=this.createId(),d=new eC(u,e,r,i,n,s,a,l,c,h);return this.addError(d),d}deleteInnerError(e){let r=this.idMapInner,i=new Set,n=r.get(e);if(n!=null){for(let s of n)this.deleteError(s),i.add(s);r.delete(e)}return Array.from(i)}addNetLengthError(e,r,i,n,s,a){let l=this.createId(),c=new eb(l,e,r,i,n,s,a),h=this.idMapNetLength.get(i);return h&&this.map.delete(h.globalIndex),this.addError(c),c}deleteNetLengthError(e){let r=this.idMapNetLength.get(e);return this.deleteError(r)}addNetLengthToleranceError(e,r,i,n,s){let a=this.createId(),l=new xT(a,e,r,i,n,s),c=this.idMapNetLengthTolerance.get(i);return c&&this.map.delete(c.globalIndex),this.addError(l),l}deleteNetLengthToleranceError(e){let r=this.idMapNetLengthTolerance.get(e);return this.deleteError(r)}addTrackWidthError(e,r,i,n,s,a,l){let c=this.createId(),h=new rb(c,e,r,i,n,s,a,l);return this.addError(h),h}deleteTrackWidthError(e){let r=this.idMapTrack.get(e);return this.deleteError(r)}addDiffPairTrackWidthError(e,r,i,n,s,a,l){let c=this.createId(),h=new Qy(c,e,r,i,n,s,a,l);return this.addError(h),h}deleteDiffPairTrackWidthError(e){let r=this.idMapDiffPairWidth.get(e);return this.deleteError(r)}addDiffPairTrackGapError(e,r,i,n,s,a,l,c,h){let u=this.createId(),d=new Zy(u,e,r,i,n,s,a,l,c,h);return this.addError(d),d}deleteDiffPairTrackGapError(e){let r=this.idMapDiffPairGap,i=new Set,n=r.get(e);if(n!=null){for(let s of n)this.deleteError(s),i.add(s);r.delete(e)}return Array.from(i)}addDiffPairTrackLengthError(e,r,i,n,s,a,l){let c=this.createId(),h=new Jy(c,e,r,i,n,s,a,l);return this.addError(h),h}deleteDiffPairTrackLengthError(e){let r=this.idMapDiffPairLength.get(e);return this.deleteError(r)}addBlindError(e,r,i,n,s,a){let l=this.createId(),c=new rP(l,e,r,i,n,s,a);return this.addError(c),c}deleteBlindError(e){let r=this.idMapBlind.get(e);return this.deleteError(r)}addRadiusError(e,r,i,n,s,a,l,c,h){let u=this.createId(),d=new tb(u,e,r,i,n,s,a,l,c,h);return this.addError(d),d}deleteRadiusError(e){let r=this.idMapRadius.get(e);return this.deleteError(r)}addConnectError(e,r,i,n,s,a,l){let c=this.createId(),h=new Ky(c,e,r,i,n,s,a,l);return this.addError(h),h}deleteConnectError(e){let r=this.idMapConnect.get(e);return this.deleteError(r)}addNetlistError(){let e=this.createId(),r=new s3(e),i=this.idMapNetlist.get(e);return i&&this.map.delete(i.globalIndex),this.addError(r),r}deleteNetlistError(e){let r=this.idMapNetlist.get(e);return this.deleteError(r)}mapAddSet(e,r,i){let n=e.get(r);n||(n=new Set,e.set(r,n)),n.add(i)}mapDeleteSet(e,r,i){let n=e.get(r);n&&(n.delete(i),n.size===0&&e.delete(r))}};Q4.manager=null;var pi=Q4;var xie=class{};var eF=class extends xie{constructor(){super(...arguments);this.coppers=new Set;this.thermals=new Set}addThermalCopper(e){this.thermals.add(e)}removeThermalCopper(e){this.coppers.delete(e)}addFilterCopper(e){this.coppers.add(e)}filter(e){return this.thermals.has(e)&&this.coppers.has(e)}};var e6=class{constructor(t){this._item=t,this._bbox=this.buildBBox()}set item(t){this._item=t}get item(){return this._item}get layerId(){return this.item.isEmpty?1:this.item.layerId}update(){this._bbox=this.buildBBox()}buildBBox(){return this._item.buildBBox()}bbox(){return this._bbox}},tF=class{constructor(t){this.layerRTreeMap={};this.capacity=t}searchInside(t,e,r){var n;let i=new Array;for(let s in this.layerRTreeMap){if(e&&!e(+s))continue;let a=(n=this.layerRTreeMap[s])==null?void 0:n.searchInside(t);for(let l of a)i.push(l.item)}return i}search4Types(t,e,r){let i=this.search(t,r),n=new Set(e),s=new Array;for(let a of i)n.has(a.modelType)&&s.push(a);return s}searchByType(t,e){throw new Error("Method not implemented.")}searchByTypes(t,e){throw new Error("Method not implemented.")}searchByLayer(t,e){return this.search(t,r=>e!=null?r==e:!0)}searchByLayers(t,e){throw new Error("Method not implemented.")}flushDeleteWhenNeed(){this.flushWhenNeed()}get items(){let t=Object.values(this.layerRTreeMap),e=new Set;for(let r of t)Re.addAllSet(e,r.items);return e}get changeList(){let t=Object.values(this.layerRTreeMap),e=new Set;for(let r of t)Re.addAllSet(e,r.changeList);return e}get deadList(){let t=Object.values(this.layerRTreeMap),e=new Set;for(let r of t)Re.addAllSet(e,r.deadList);return e}getLayerKeys(){return Object.keys(this.layerRTreeMap).map(t=>Number(t))}size(){let t=Object.values(this.layerRTreeMap),e=0;for(let r of t)e+=r.items.size;return e}search(t,e){var i;let r=new Array;for(let n in this.layerRTreeMap){let s=(i=this.layerRTreeMap[n])==null?void 0:i.search(t);for(let a of s)e&&!e(+n,a.item.modelType)||r.push(a.item)}return r}insert(t){this.getRtree(t).insert(t)}getRtree(t){let e=this.layerRTreeMap[t.layerId];return e==null&&(e=new Sd(this.capacity),this.layerRTreeMap[t.layerId]=e),e}remove(t){this.getRtree(t).remove(t)}bbox(){let t=new _e,e=Object.values(this.layerRTreeMap);for(let r of e)r.bbox()!=null&&t.ext1(r.bbox());return t.valid()?t.build1():null}recycle(){for(let t in this.layerRTreeMap)this.layerRTreeMap[t].recycle();this.layerRTreeMap={}}flushWhenNeed(){let t=Object.values(this.layerRTreeMap);for(let e of t)e.flushWhenNeed()}};var RT=class{constructor(t=!1){this.shapes=[];this.clear=t,this.fillAllFilter()}fillAllFilter(){this.getVias(this.shapes),this.getTracks(this.shapes),this.getTexts(this.shapes),this.getImages(this.shapes),this.getPads(this.shapes),this.getProfiles(this.shapes),this.getComponents(this.shapes),this.getCoppers(this.shapes),this.getPlanes(this.shapes)}getVias(t){let e=Tn.getInstance().getAllItem();for(let r=0;r<e.length;r++)t.push(e[r]);this.clear&&Tn.getInstance().recycle()}getTracks(t){An.getInstance().getAllItem().forEach(r=>{r.length>1e-8&&t.push(r)}),this.clear&&An.getInstance().recycle()}getTexts(t){mo.getInstance().getAllItem().forEach(r=>{let i=r.box;this.checkLayer(r.layerId)&&(!i||i.height==0||i.width==0||t.push(r))}),this.clear&&mo.getInstance().recycle()}getImages(t){Qs.getInstance().getAllItem().forEach(r=>{this.checkLayer(r.layerId)&&t.push(r)}),this.clear&&Qs.getInstance().recycle()}getPads(t){let e=$n.getInstance().getAllItem();for(let r=0;r<e.length;r++)t.push(e[r]);this.clear&&$n.getInstance().recycle()}getProfiles(t){let e=zi.getInstance().getAllItem(),r=rn.getInstance().getAllItem(),i=Mi.getInstance().getAllItem();for(let n of e)this.checkProfile(n)&&t.push(n);for(let n of r)this.checkProfile(n)&&t.push(n);for(let n of i)this.checkProfile(n)&&t.push(n);this.clear&&(zi.getInstance().recycle(),rn.getInstance().recycle(),Mi.getInstance().recycle())}checkProfile(t){if(t.type=="Partition"||!this.checkLayer(t.layerId))return!1;switch(t.type){case"Line":case"Prohibited Region":case"Fill Region":case"Board Outline":case"Slot Region":case"TearDrop":return!0}return!1}getComponents(t){let e=xs.getInstance().getAllItem();for(let r=0;r<e.length;r++)t.push(e[r]);this.clear&&xs.getInstance().recycle()}getPlanes(t){let e=Ho.getInstance().getAllItem();for(let r=0;r<e.length;r++)t.push(e[r]);this.clear&&Ho.getInstance().recycle()}getCoppers(t){let e=Wo.getInstance().getAllItem();for(let r=0;r<e.length;r++)t.push(e[r]);this.clear&&Wo.getInstance().recycle()}checkLayer(t){let e=$e.getInstance().getLayer(t);return e?!!(e.config&&(gr(t)||gs(e==null?void 0:e.type)||Rh(e==null?void 0:e.type)||t==11)):!1}};function nP(o){let t=new tF(10);o==null&&(o=new RT().shapes);for(let e of o)(mp(e.layerId)||e.layerId==11)&&t.insert(new e6(e));return t}var Nf=class{constructor(t){this.pcbTree=t}bbox(){return this.pcbTree.bbox()}search(t,e){return this.pcbTree.search(t,e)}searchByLayer(t,e){return this.pcbTree.searchByLayer(t,e)}search4Types(t,e,r){return this.pcbTree.search4Types(t,e,r)}insert(t){this.pcbTree.insert(t)}recycle(){this.pcbTree.recycle()}};var ZA=class{constructor(t){this.map=new Map;this.cb=t}get(t,e){let r=this.map.get(t);if(r!==void 0)return r;let i=e?e(t):this.cb(t);return this.map.set(t,i),i}};var gSe=class{constructor(){this.clearance=new ZA(t=>te.getInstance().getItemMaxClearance(t))}clear(){this.clearance.map.clear()}getShapeMaxClearance(t){let e=G1(t);return oi.isHole(t)?Math.max(this.clearance.get(e),this.clearance.get(12)):this.clearance.get(e)}},ySe=class{constructor(){this.effectiveRules={safeSpacing:new Set,diffPair:new Set};this.ruleManager=te.getInstance();this.clearance=new ZA(t=>{let[e,r,i]=t.split(",");return te.getInstance().getModelPairMaxClearance(this.effectiveRules,Number(e),Number(r),Number(i))})}initEffectiveRules(){let t=this.createNameModelMap(this.ruleManager.getAllSafeSpacing(),r=>r.isDefault?"default":r.name),e=this.createNameModelMap(this.ruleManager.getAllDifferentialPhysics(),r=>r.isDefault?"default":r.name);this.collectUsedRules(t,e)}createNameModelMap(t,e){let r=new Map;for(let i of t){let n=e(i);n&&r.set(n,i)}return r}collectUsedRules(t,e){let r=(i,n=!1)=>{i&&t.has(i)&&this.effectiveRules.safeSpacing.add(t.get(i)),i&&n&&e.has(i)&&this.effectiveRules.diffPair.add(e.get(i))};this.ruleManager.getAllRegions().forEach(i=>{r(i.safeClearance),r(i.safeCopperPlane),r(i.safeInnerPlane),r(i.diff,!0)}),this.ruleManager.betweenNetRule.rule.forEach(i=>{r(i.ruleName),r(i.safeCopperPlane),r(i.safeInnerPlane)}),this.ruleManager.getAllNets().forEach(i=>{r(i.safeSpacing),r(i.safeCopperPlane),r(i.safeInnerPlane),r(i.differentialPhysics,!0)}),this.ruleManager.getAllNetClass().forEach(i=>{r(i.safeSpacing),r(i.safeCopperPlane),r(i.safeInnerPlane),r(i.differentialPhysics,!0)})}clear(){this.clearance.map.clear(),this.effectiveRules.safeSpacing.clear(),this.effectiveRules.diffPair.clear()}getShapePairMaxClearance(t,e,r){let i=r===12||r===11?void 0:r;t=[13,14].includes(t)?7:t,e=[13,14].includes(e)?7:e;let n=i?`${t},${e},${i}`:`${t},${e}`;return this.clearance.get(n)}},Rie=new gSe,JA=new ySe;function a3(o,t){return o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,o|t<<1}var Cm=class Cm{constructor(t,e){this.x=t,this.y=e}normalized(){}};Cm.NULL=new Cm(0,0),Cm.RIGHT=new Cm(1,0),Cm.RIGHT45=new Cm(1,1),Cm.UP=new Cm(0,1),Cm.UP45=new Cm(-1,1),Cm.LEFT=new Cm(-1,0),Cm.LEFT45=new Cm(-1,-1),Cm.DOWN=new Cm(0,-1),Cm.DOWN45=new Cm(1,-1);var DT=Cm;var i0=class extends DT{constructor(t,e){super(t,e)}conver(){return new S(this.x,this.y)}};var qS=class{constructor(t,e){this.point=t,this.direction=e;let{x:r,y:i}=e;this.a=i,this.b=-r,this.c=-(this.a*t.x+this.b*t.y)}inter(t){let{a:e,b:r,c:i}=t;return new i0((i*this.b-this.c*r)/(this.a*r-e*this.b),(this.c*e-i*this.a)/(this.a*r-e*this.b))}};var H1=class{constructor(t,e,r,i,n){this.start=t,this.middle=e,this.end=r,this.startPoint=i,this.endPoint=n}get _startPoint(){return this.startPoint===void 0&&(this.startPoint=this.start.inter(this.middle)),this.startPoint}get _endPoint(){return this.endPoint===void 0&&(this.endPoint=this.end.inter(this.middle)),this.endPoint}conver(){return new M(this._startPoint.conver(),this._endPoint.conver())}};var tC=class o extends ut{constructor(t,e,r,i,n,s,a,l){super(t,e,r,i),this.left_lower_x=n,this.right_lower_x=s,this.left_upper_x=a,this.right_upper_x=l}diff(t){throw new Error("Method not implemented.")}isIntersectOctagon(t){return!(this.minX>t.maxX||this.maxX<t.minX||this.minY>t.maxY||this.maxY<t.minY||this.left_lower_x>t.right_upper_x||this.right_upper_x<t.left_lower_x||this.right_lower_x<t.left_upper_x||this.left_upper_x>t.right_lower_x)}inter(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX),i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY),s=Math.max(this.left_lower_x,t.left_lower_x),a=Math.min(this.right_lower_x,t.right_lower_x),l=Math.max(this.left_upper_x,t.left_upper_x),c=Math.min(this.right_upper_x,t.right_upper_x);return new o(e,r,i,n,s,a,l,c)}union(t){let e=Math.min(this.minX,t.minX),r=Math.max(this.maxX,t.maxX),i=Math.min(this.minY,t.minY),n=Math.max(this.maxY,t.maxY),s=Math.min(this.left_lower_x,t.left_lower_x),a=Math.max(this.right_lower_x,t.right_lower_x),l=Math.min(this.left_upper_x,t.left_upper_x),c=Math.max(this.right_upper_x,t.right_upper_x);return new o(e,r,i,n,s,a,l,c)}isInside(t){return r(this.minX,t.minX)&&e(this.maxX,t.maxX)&&r(this.minY,t.minY)&&e(this.maxY,t.maxY)&&(t.left_lower_x==null||r(this.left_lower_x,t.left_lower_x))&&(t.right_upper_x==null||e(this.right_upper_x,t.right_upper_x))&&(t.left_upper_x==null||r(this.left_upper_x,t.left_upper_x))&&(t.right_lower_x==null||e(this.right_lower_x,t.right_lower_x));function e(i,n){return i<=n}function r(i,n){return i>=n}}outline(){return fe.build7(this.get().map(t=>t.conver()))}get(t=!0){if(t){if(this.left_lower_x===null&&this.right_lower_x===null&&this.left_upper_x===null&&this.right_upper_x===null)return[new H1(void 0,void 0,void 0,new i0(this.minX,0),new i0(0,this.minY)),new H1(void 0,void 0,void 0,new i0(this.minX,0),new i0(0,this.maxY)),new H1(void 0,void 0,void 0,new i0(this.maxX,0),new i0(0,this.minY)),new H1(void 0,void 0,void 0,new i0(this.maxX,0),new i0(0,this.maxY))];{let e=new qS(new i0(this.minX,0),DT.UP),r=new qS(new i0(this.maxX,0),DT.DOWN),i=new qS(new i0(0,this.minY),DT.LEFT),n=new qS(new i0(0,this.maxY),DT.RIGHT),s=new qS(new i0(this.left_lower_x,0),DT.UP45),a=new qS(new i0(this.right_lower_x,0),DT.LEFT45),l=new qS(new i0(this.left_upper_x,0),DT.RIGHT45),c=new qS(new i0(this.right_upper_x,0),DT.DOWN45),h=new H1(s,e,l),u=new H1(c,r,a),d=new H1(a,i,s),p=new H1(l,n,c),m=new H1(i,s,e),g=new H1(r,a,i),y=new H1(e,l,n),b=new H1(n,c,r);return[h,u,d,p,m,g,y,b]}}}equals(t){return t instanceof o?!!(ne.eq(this.minX,t.minX)&&ne.eq(this.minY,t.minY)&&ne.eq(this.maxX,t.maxX)&&ne.eq(this.maxY,t.maxY)&&ne.eq(this.left_lower_x,t.left_lower_x)&&ne.eq(this.right_lower_x,t.right_lower_x)&&ne.eq(this.left_upper_x,t.left_upper_x)&&ne.eq(this.right_upper_x,t.right_upper_x)):!1}static byBBox(t){return new o(t.minX,t.maxX,t.minY,t.maxY,t.minY+t.minX,t.maxX-t.minY,t.minX-t.maxY,t.maxY+t.maxX)}static byLine(t,e){let r=t.start(),i=t.end(),n=e/2,s=r.x-i.x,a,l;s<0?(a=r,l=i):(a=i,l=r);let c=a.x,h=a.y,u=l.x,d=l.y,p=h-d,m=c-n,g=u+n,y=n,b=-n;if(p<0?(b+=h,y+=d):(b+=d,y+=h),s===0||p===0)return new o(m,g,b,y,b+m,g-b,m-y,y+g);{let P,T,I,C,E,O,_,R,v;return p<0?(P=1,T=1,_=Math.sqrt(n*n*(P*P+T*T)),R=P*c+T*h,v=P*u+T*d,I=Math.min(_+R,-_+R),C=Math.max(_+v,-_+v),P=-1,T=1,_=Math.sqrt(n*n*(P*P+T*T)),R=P*c+T*h,v=P*u+T*d,(d-h)/(u-c)>1?(E=Math.min(-_-v,_-v),O=Math.max(-_-R,_-R)):(E=Math.min(-_-R,_-R),O=Math.max(-_-v,_-v))):(P=-1,T=1,_=Math.sqrt(n*n*(P*P+T*T)),R=P*c+T*h,v=P*u+T*d,E=Math.min(-_-R,_-R),O=Math.max(-_-v,_-v),P=1,T=1,_=Math.sqrt(n*n*(P*P+T*T)),R=P*c+T*h,v=P*u+T*d,(d-h)/(u-c)>-1?(I=Math.min(_+R,-_+R),C=Math.max(_+v,-_+v)):(I=Math.min(_+v,-_+v),C=Math.max(_+R,-_+R))),new o(m,g,b,y,I,O,E,C)}}};var bSe=class{converBBox(t){return t instanceof tC?t:new tC(t.minX,t.maxX,t.minY,t.maxY,t.minY+t.minX,t.maxX-t.minY,t.minX-t.maxY,t.maxY+t.maxX)}trackToOctagon(t,e,r){let i=r/2,n=t.x-e.x,s,a;n<0?(s=t,a=e):(s=e,a=t);let l=s.x,c=s.y,h=a.x,u=a.y,d=c-u,p=l-i,m=h+i,g=i,y=-i;if(d<0?(y+=c,g+=u):(y+=u,g+=c),n===0||d===0)return new tC(p,m,y,g,y+p,m-y,p-g,g+m);{let b,P,T,I,C,E,O,_,R;return d<0?(b=1,P=1,O=Math.sqrt(i*i*(b*b+P*P)),_=b*l+P*c,R=b*h+P*u,T=Math.min(O+_,-O+_),I=Math.max(O+R,-O+R),b=-1,P=1,O=Math.sqrt(i*i*(b*b+P*P)),_=b*l+P*c,R=b*h+P*u,(u-c)/(h-l)>1?(C=Math.min(-O-R,O-R),E=Math.max(-O-_,O-_)):(C=Math.min(-O-_,O-_),E=Math.max(-O-R,O-R))):(b=-1,P=1,O=Math.sqrt(i*i*(b*b+P*P)),_=b*l+P*c,R=b*h+P*u,C=Math.min(-O-_,O-_),E=Math.max(-O-R,O-R),b=1,P=1,O=Math.sqrt(i*i*(b*b+P*P)),_=b*l+P*c,R=b*h+P*u,(u-c)/(h-l)>-1?(T=Math.min(O+_,-O+_),I=Math.max(O+R,-O+R)):(T=Math.min(O+R,-O+R),I=Math.max(O+_,-O+_))),new tC(p,m,y,g,T,E,C,I)}}trackMortonCode(t,e,r){return a3((t.x+e.x)/2,(t.y+e.y)/2)}},nh=new bSe;var PSe=class{constructor(t){this.item=t,this._bbox=this.item.buildBBox()}bbox(){return this._bbox}};var Die=class{constructor(t,e=!1){this.rtree=new Sd(t)}get items(){return this.rtree.items}insert(t){this.rtree.insert(new PSe(t))}search(t,e){this.rtree.search2Cb(t,r=>e(r.item))}searchItems(t){return this.rtree.search(t)}recycle(){this.rtree.recycle(),this.rtree=null}};var wie=class{constructor(){this.constraint=[];this.singleLayerMap=new Map;this.multiLayerMap=new Map;this.groupTypes=new Set(["Track","ArcTrack","Pad","Via","Image","Picture","Polygon","Rect","Circle","Copper","Inner","Component","Line","Arc","TearDrop","Text"])}get size(){let t=0;for(let[,e]of this.singleLayerMap)for(let[,r]of e)t+=r.items.size;for(let[,e]of this.multiLayerMap)for(let[,r]of e)t+=r.items.size;return t}iterateMap(t,e,r){if(r!==void 0){let i=t.get(r);if(!i)return;for(let[n,s]of i)e(s,n)}else for(let[i,n]of t)for(let[s,a]of n)e(a,s,i)}itorTree(t,e,r){switch(t){case 1:this.iterateMap(this.singleLayerMap,e,r);break;case 2:this.iterateMap(this.multiLayerMap,e,r);break;case 3:this.iterateMap(this.singleLayerMap,e,r),this.iterateMap(this.multiLayerMap,e,r);break;default:throw new Error(`Unsupported status: ${t}`)}}getNodeGroupType(t){let e=t.modelType;if(this.groupTypes.has(e))return G1(t)}getNodeGroup(t){let e=this.getNodeGroupType(t),r=t.layerId,i=r===12||r===11,n=i?this.multiLayerMap.get(e):this.singleLayerMap.get(e),s=n&&n.get(r);return s||(s=new Die(15),n||(n=new Map,i?this.multiLayerMap.set(e,n):this.singleLayerMap.set(e,n)),n.set(r,s)),s}insert(t){t instanceof lr&&t.type==="Constraint Region"?this.constraint.push(t):this.getNodeGroup(t).insert(t)}search(t,e,r,i){this.itorTree(t,(n,s,a)=>{i&&!i(s,a)||n.search(e,l=>{l.isEmpty||r(l)})})}searchItems(t,e,r){let i=new Set;return this.itorTree(t,(n,s,a)=>{if(!(r&&!r(s,a)))for(let l of n.searchItems(e)){let c=l.item;c.isEmpty||i.add(c)}}),i}searchByType(t,e,r,i,n){this.itorTree(t,(s,a)=>{n&&!n(a)||s.search(e,l=>{l.isEmpty||i(l)})},r)}getTree(t,e,r){var i,n;switch(t){case 1:return(i=this.singleLayerMap.get(e))==null?void 0:i.get(r);case 2:return(n=this.multiLayerMap.get(e))==null?void 0:n.get(r);default:return null}}};function NVe(o){let t=new wie;for(let e=0;e<o.length;e++){let r=o[e];t.insert(r)}return t}function kVe(o=new RT().shapes){return o.filter(e=>t(e.layerId));function t(e){return mp(e)||e==11}}var t6=class t6{constructor(){this._checkSameNet=!1;this._useForceModelPairClearance=!1;this.checkEnv=0;this.filters=new Array;this.clear()}static getInstance(){return t6.instance==null&&(t6.instance=new t6),t6.instance}addFilter(t){this.filters.push(t)}filterCopper(t){for(let e of this.filters)e instanceof eF&&e.addFilterCopper(t)}needCheck(t,e){for(let r of this.filters)if(r.filter(t)||r.filter(e))return!1;return!0}clear(){this.filters.length=0,bh.clear(),this.drcMap=new Nf(nP([])),this.ruleHelper=new $S,pi.getInstance().clearErrorRecordBuffer()}initialEnv(t,e,r=!1){this.filters.length=0,bh.clear(),this.checkEnv=0,this.drcMap=t,this.ruleHelper=new $S,this.ruleHelper.constraintMap.updateByDRCMap(t,e),this.checkSameNet=r}initialEnv_Worker(t,e=!1){this.filters.length=0,bh.clear(),this.checkEnv=1,this.initDrcMap(),this.ruleHelper=new $S,this.ruleHelper.constraintMap.updateByDRCMap_Worker(t),this.checkSameNet=e,JA.initEffectiveRules(),pi.getInstance().initializeErrorRecordBuffer()}initDrcMap(){let t=kVe();this.drcMap=NVe(t),t.length=0}realeTime(t){this.ruleHelper.constraintMap.realTimeDRC(t)}get drcMap(){return this._drcMap}set drcMap(t){this._drcMap=t}get language(){return this._language}set language(t){this._language=t}get ruleHelper(){return this._ruleHelper}set ruleHelper(t){this._ruleHelper=t}get checkSameNet(){return this._checkSameNet}set checkSameNet(t){this._checkSameNet=t}get useForceModelPairClearance(){return this._useForceModelPairClearance}set useForceModelPairClearance(t){this._useForceModelPairClearance=t}};t6.instance=null;var sn=t6;var Lie=class{constructor(){this.constraintMap={};this.utils=new o3}get _constraintMap(){return this.constraintMap}getConstraints(t){let e=this.constraintMap[t];return e||new Set}isChecked(t){return this.constraintMap[t]!=null}updateByDRCMap(t,e,r=!0){r&&(this.constraintMap={});let i=this.constraintMap;e=e||O4("Constraint Region");for(let n of e){let s=n.buildBBox(),a=n.layerId,l=h=>a==11||a==12||h==11||h==12?!0:h==a,c=t.search(s,l);for(let h of c)this.utils.isInConstraint(n,h)&&(i[h.globalIndex]||(i[h.globalIndex]=new Set),i[h.globalIndex].add(n))}}updateByDRCMap_Worker(t,e=!0){e&&(this.constraintMap={});let r=this.constraintMap;t=t||O4("Constraint Region");for(let i of t){let n=i.layerId!==12?s=>s===12||s===11?!0:s===i.layerId:void 0;sn.getInstance().drcMap.search(3,i.buildBBox(),s=>{this.utils.isInConstraint(i,s)&&(r[s.globalIndex]||(r[s.globalIndex]=new Set),r[s.globalIndex].add(i))},n)}}realTimeDRC(t){t.forEach(({constraint:e,shape:r})=>{this.utils.isInConstraint(e,r)&&(this.constraintMap[r.globalIndex]=this.constraintMap[r.globalIndex]||new Set,this.constraintMap[r.globalIndex].add(e))})}updateMap(t,e=!0,r=!1){e&&(this.constraintMap={});let i=this.constraintMap;for(let n of Object.keys(t)){let s=pc(n);if(s instanceof lr&&s.type==="Constraint Region"){let a=t[n];for(let l of a){let c=i[l.globalIndex];if(!r&&c&&c.has(s))continue;this.checkLayer(s,l)&&this.utils.isInConstraint(s,l)?(c||(c=new Set,i[l.globalIndex]=c),c.add(s)):c&&c.delete(s)}}}}delete(t){delete this.constraintMap[t]}checkLayer(t,e){return t.layerId===12||[12,11].includes(e.layerId)||t.layerId===e.layerId}isInConstraintCompatible(t,e){let r=t.shape(t.layer,0);if(e instanceof Ns||e instanceof ag){let i=e instanceof Ns?new M(e.start,e.end):e.arc;return this.utils.getPtsCtrlPoints(s=>this.utils.primitiveIterator([i],s)).every(s=>Jr.inPolyline(s,r))}else if(e instanceof Mf||e instanceof of||e instanceof vT||e instanceof $y){let i=e.shape(e.layer,0);return this.utils.getPtsCtrlPoints(s=>this.utils.primitiveIterator(i.primitives,s)).every(s=>Jr.inPolyline(s,r))}else if(e instanceof Ll||e instanceof qy){let i=e.center;return Jr.inPolyline(i,r)}else if(e instanceof O0){let i=e.location;return Jr.inPolyline(i,r)}else if(e instanceof U1){let i=e.bbox().center();return Jr.inPolyline(i,r)}return!1}};var TSe=class{constructor(){this.points=[];this.lines=[];this.arcs=[];this.listText=[]}addPt(t,e=!0){if(t instanceof M)this.lines.push(t);else if(t instanceof q)this.arcs.push(t);else throw new Error("not support");e&&this.points.push(t.start())}addPoint(t){this.points.push(t)}addText(t,e,r=1,i=.1,n=!0){this.listText.push({pos:t,str:e,size:r,width:i}),n&&this.points.push(t)}addPly(t,e=!0){t.primitives.forEach(r=>this.addPt(r,e))}build(){let t=[],e=[],r=[],i=[];return this.points.forEach(n=>t.push(n.x,n.y)),this.lines.forEach(n=>e.push(n.start().x,n.start().y,n.end().x,n.end().y)),this.arcs.forEach(n=>r.push(n.center.x,n.center.y,n.rx,Ht.toRadians(n.startAngle),Ht.toRadians(n.endAngle()),n.sweep())),this.listText.forEach(n=>i.push(n.pos.x,n.pos.y,n.str,n.width,n.size)),{points:t,lines:e,arcs:r,texts:i}}},Fj=class Fj{constructor(t){this.map=new Bd;this.bus=t}initColor(t){return this.map.computeIfAbsent(t,()=>new TSe)}draw(){let t={},e=this.map.entries();for(;e.hasNext();){let r=e.next();t[r.key.toString()]=r.value.build()}this.bus.publish("/debug/draw",t)}clear(){this.map.clear()}static init(t){if(!t)throw new Error("bus is undefined!");this.palette=new Fj(t)}static getDefaultColor(){for(let t of this.colorBuffersMap)if(t[0]!==null&&t[0])return t[0]=!1,t[1];return this.colorBuffersMap.forEach(t=>{if(t[0]===null){console.log(1);return}t[0]=!0}),this.getDefaultColor()}static clear(){this.palette.clear()}static auto(t,e=this.getDefaultColor()){if(Array.isArray(t))t.forEach(r=>{this.auto(r,e)});else if(t instanceof tC)this.auto(t.outline(),e);else if(t instanceof S)this.point(t,e);else if(t instanceof ut)this.bbox(t,e);else if(t instanceof Tl)this.primitive(t,e);else if(t instanceof fe)this.polyline(t,e);else if(t instanceof hs)this.polygon(t,e);else if(t instanceof Jo)this.group(t,e);else if(t instanceof Gt)this.auto(t.items,e);else{debugger;throw new Error("No incoming type!")}}static text(t,e,r=.5,i=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");this.palette.initColor(i).addText(t,e,r,r/10),this.palette.draw()}static point(t,e=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let r=this.palette.initColor(e);Array.isArray(t)?t.forEach(i=>{this.point(i,e)}):r.addPoint(t),this.palette.draw()}static bbox(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.bbox(r,e)}):(this.primitive(new M(new S(t.maxX,t.maxY),new S(t.maxX,t.minY)),e),this.primitive(new M(new S(t.maxX,t.maxY),new S(t.minX,t.maxY)),e),this.primitive(new M(new S(t.minX,t.minY),new S(t.maxX,t.minY)),e),this.primitive(new M(new S(t.minX,t.minY),new S(t.minX,t.maxY)),e))}static primitive(t,e=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let r=this.palette.initColor(e);Array.isArray(t)?t.forEach(i=>{this.primitive(i,e)}):r.addPt(t),this.palette.draw()}static polyline(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.polyline(r,e)}):t.primitives.forEach(r=>{this.primitive(r,e)})}static polygon(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.polygon(r,e)}):t.items.forEach(r=>{this.polyline(r,e)})}static group(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.group(r,e)}):t.items.forEach(r=>{this.polygon(r,e)})}static async begin(){this.t1=performance.now()}static async end(t){console.log(t||"t1:",performance.now()-this.t1)}static async log(t){console.log(t||"==================")}};Fj.colorBuffersMap=[[!0,ee.BLUE],[!0,ee.GREEN],[!0,ee.WHITE],[!0,ee.RED],[!0,ee.Golden],[!0,ee.Gray]],Fj.t1=0;var Ko=Fj;var Uj=nd(Lb());var Mie=class{constructor(t,e,r){this.lineMap=[];this.bbox=t,this.interval=e,this.angle=r,r===90?this.distance=(i,n)=>i.x-this.bbox.minX-n*this.interval:r===0?this.distance=(i,n)=>i.y-this.bbox.minY-n*this.interval:Od()}interLine(t){let e=t.primitives.length,r=[],i=e-1,n=this.interPt(t.primitives[i]),s=n,a=new Array(e);s.forEach(l=>{(l.near1===!1||l.near2===!1)&&(a[i]!==void 0&&Od(),a[i]=l.index)});for(let l=0;l<e;l++){let c=t.primitives[l],h=this.interPt(c),u=l===0?i:l-1;for(let d=0;d<h.length;d++){let p=h[d],m=p.index;l!==i&&(p.near1===!1||p.near2===!1)&&(a[l]!==void 0&&Od(),a[l]=m);let g=p.near1===!0||p.near2===!0;if(!g&&a[u]===m)p.num===0?(p.num=1,p.point1=c.start(),p.near1=!0,p.startPosition=null):p.num===1?un(p.point1,c.start())?Od():(p.num=2,p.point2=c.start(),p.near2=!0,p.startPosition=null):p.num===2&&Od();else if(g&&a[u]!==m){let y=(()=>{for(let P=0;P<s.length;P++)if(s[P].index===m)return P;Od()})(),b=s[y];b.num===0?(b.num=1,b.point1=c.start(),b.near1=!1,b.endPosition=null):b.num===1?(b.num=2,b.point2=c.start(),b.near2=!1,b.endPosition=null):b.num===2&&Od(),u===i?n[u]=b:r[u][y]=b}r[l]===void 0&&(r[l]=[]),r[l].push(p)}s=h}return r}position(t){return ne.eq(t,0)?null:t<0}frontier(t,e){if(t instanceof M){let i=this.distance(t.start(),0),n=this.distance(t.end(),0);return i<n?{min:Math.floor((i-1e-5)/this.interval),max:Math.floor((n+1e-5)/this.interval)+1}:{min:Math.floor((n-1e-5)/this.interval),max:Math.floor((i+1e-5)/this.interval)+1}}else if(t instanceof q){let n={min:180,max:0};e===90?n={min:270,max:90}:e===0?n={min:180,max:0}:Od();let s=t.startAngle,a=t.endAngle();if(t.sweepAngle<0){let h=s;s=a,a=h}for(s-=1,a+=1;s<0||a<0;)s+=360,a+=360;let l=h=>{for(let u=0;u<=Math.floor(a/360);u++){let d=h+u*360;if(d<=a&&d>=s)return!0}return!1};for(;n.min<0;)n.min+=360;for(;n.max<0;)n.max+=360;let c={min:l(n.min)?Math.floor((this.distance(t.center,0)-t.rx-1e-5)/this.interval):null,max:l(n.max)?Math.floor((this.distance(t.center,0)+t.rx+1e-5)/this.interval)+1:null};if(c.min===null||c.max===null){let h=this.distance(t.start(),0),u=this.distance(t.end(),0);c.min===null&&(c.min=h<u?Math.floor((h-1e-5)/this.interval):Math.floor((u-1e-5)/this.interval)),c.max===null&&(c.max=h<u?Math.floor((u+1e-5)/this.interval)+1:Math.floor((h+1e-5)/this.interval)+1)}return c}}interArcInfo(t,e,r,i,n){let s=Tt(t,e),a,l,c;s===0?c=0:s===2?(c=1,a=new S(Ee[0],Ee[1])):s===4?(a=new S(Ee[0],Ee[1]),l=new S(Ee[2],Ee[3]),un(a,l)?(c=1,l=void 0):c=2):Od();let h,u;if(c!==0){let d=this.distance(t.start(),r),p=this.distance(t.end(),r),m=d*d<ne.eps,g=p*p<ne.eps;if(c===1)m&&g?Od():m&&!g?un(t.start(),a)?h=!0:h=null:!m&&g&&un(t.end(),a)?h=!1:h=null;else if(c===2){let y=a.distance1(t.start()),b=l.distance1(t.start());if(m&&g)y<b?(h=!0,u=!1):(h=!1,u=!0);else if(m&&!g)y<b?(h=!0,u=null):(h=null,u=!0);else if(!m&&g){let P=a.distance1(t.end()),T=l.distance1(t.end());P<T?(h=!1,u=null):(h=null,u=!1)}else h=null,u=null}}return{index:r,num:c,point1:a,point2:l,startPosition:i,endPosition:n,near1:h,near2:u}}},Nie=class extends Mie{constructor(e,r){super(e,r,90);this.angle=90;this.sortCmp=(e,r)=>e.y-r.y}positionPoint(e,r){return this.position(e.x-this.bbox.minX-r*this.interval)}interPt(e){if(e instanceof M){let i=e.start().x>e.end().x,{start:n,end:s}=i?{start:e.end(),end:e.start()}:{start:e.start(),end:e.end()},a=(s.y-n.y)/(s.x-n.x),l=[],c=null;for(let h=this.frontier(e,90),u=h.min;u<=h.max;u++){let d=this.bbox.minX+u*this.interval;if(Math.abs(e.start().x-e.end().x)<1e-4&&Math.abs(e.start().x-d)<1e-4)return l.push({index:u,num:2,point1:e.start(),point2:e.end(),startPosition:null,endPosition:null,near1:!0,near2:!1}),l;let p=this.position(e.start().x-d),m=this.position(e.end().x-d);if(n.x>d){l.push({index:u,num:0,startPosition:p,endPosition:m});continue}else if(s.x<d){let g=l.length;if(g===0&&Od(),l[g-1].num===0){l.push({index:u,num:0,startPosition:p,endPosition:m});continue}let y=l[g-1].near1;if(!(s.x-(d-this.interval)<1e-4)){l.push({index:u,num:0,startPosition:p,endPosition:m});continue}let T=!!i;y==null?l[g-1].near1=T:y!==T&&Od(),l.push({index:u,num:0,startPosition:p,endPosition:m})}else if(c===null){let g=d-n.x;c=new S(d,n.y+g*a);let b=g<1e-4?!i:null;l.push({index:u,num:1,point1:c,near1:b,startPosition:p,endPosition:m})}else c=new S(c.x+this.interval,c.y+a*this.interval),l.push({index:u,num:1,point1:c,near1:null,startPosition:p,endPosition:m})}return l}else if(e instanceof q){let r=[],i=this.frontier(e,0);for(let n=i.min;n<=i.max;n++){let{startPosition:s,endPosition:a}=this.getStartEndPosition(e,this.bbox.minX+n*this.interval);r.push(this.interArcInfo(e,this.getLine(n),n,s,a))}return r}else Od()}getLine(e){if(this.lineMap[e]===void 0){let i=this.bbox.minX+e*this.interval;this.lineMap[e]=new M(new S(i,this.bbox.minY-1e-5),new S(i,this.bbox.maxY+1e-5))}return this.lineMap[e]}getStartEndPosition(e,r){return{startPosition:this.position(e.start().x-r),endPosition:this.position(e.end().x-r)}}},kie=class extends Mie{constructor(e,r){super(e,r,0);this.angle=0;this.sortCmp=(e,r)=>e.x-r.x;this.positionPoint=(e,r)=>this.position(e.y-this.bbox.minY-r*this.interval)}interPt(e){if(e instanceof M){let i=e.start().y>e.end().y,{start:n,end:s}=i?{start:e.end(),end:e.start()}:{start:e.start(),end:e.end()},a=(s.y-n.y)/(s.x-n.x),l=[],c=null;for(let h=this.frontier(e,0),u=h.min;u<=h.max;u++){let d=this.bbox.minY+u*this.interval;if(Math.abs(e.start().y-e.end().y)<1e-4&&Math.abs(e.start().y-d)<1e-4)return l.push({index:u,num:2,point1:e.start(),point2:e.end(),startPosition:null,endPosition:null,near1:!0,near2:!1}),l;let p=this.position(e.start().y-d),m=this.position(e.end().y-d);if(n.y>d){l.push({index:u,num:0,startPosition:p,endPosition:m});continue}else if(s.y<d){let g=l.length;if(g===0&&Od(),l[g-1].num===0){l.push({index:u,num:0,startPosition:p,endPosition:m});continue}let y=l[g-1].near1;if(!(s.y-(d-this.interval)<1e-4)){l.push({index:u,num:0,startPosition:p,endPosition:m});continue}let T=!!i;y==null?l[g-1].near1=T:Od(),l.push({index:u,num:0,startPosition:p,endPosition:m});continue}else if(c===null){let g=d-n.y;c=new S(n.x+g/a,d);let b=g<1e-4?!i:null;l.push({index:u,num:1,point1:c,near1:b,startPosition:p,endPosition:m})}else c=new S(c.x+this.interval/a,c.y+this.interval),l.push({index:u,num:1,point1:c,near1:null,startPosition:p,endPosition:m})}return l}else if(e instanceof q){let r=[],i=this.frontier(e,90);for(let n=i.min;n<=i.max;n++){let s=this.bbox.minY+n*this.interval,a=this.position(e.start().y-s),l=this.position(e.end().y-s);r.push(this.interArcInfo(e,this.getLine(n),n,a,l))}return r}else Od()}getLine(e){if(this.lineMap[e]===void 0){let i=this.bbox,n=i.minY+e*this.interval;this.lineMap[e]=new M(new S(i.minX-1e-5,n),new S(i.maxX+1e-5,n))}return this.lineMap[e]}},Bie=class{constructor(t,e,r,i){this.useTransform=!0;this.allGridInterPoint=[];i&&Ko.init(i),this.rad=r,this.transform=this.useTransform&&r!==0,this.gridLine=this.createGridLine(t,e,r),this.interval=e,this.bbox=t}run(t){this.transform&&(t=t.multiply3(new Qe().rotate(this.rad)));let e=t.items.slice(),r=new Set(new Array(t.items.length).fill(0).map((a,l)=>l));for(let a=0;a<this.gridLine.length;a++){let l=this.gridLine[a];this.nowGridLine=a;for(let c=0;c<t.items.length;c++)this.runPolyline(t.items[c])&&r.delete(c);for(let c=0;c<this.allGridInterPoint.length;c++){if(!this.allGridInterPoint[c])continue;let h=this.allGridInterPoint[c].sort(l.sortCmp);for(let u=0;u<h.length;u+=2)e.push(fe.build2([new M(h[u],h[u+1])]))}this.allGridInterPoint=[]}let i=new Array,n=new Array;for(let a=0,l=e.length;a<l;a++)r.has(a)?i.push(e[a].reverse()):n.push(e[a]);let s=new Array;for(let a of i)s.push(this.transform?new Gt([a]).multiply3(new Qe().rotate(-this.rad)):new Gt([a]));return s.push(this.transform?new Gt(n).multiply3(new Qe().rotate(-this.rad)):new Gt(n)),s}runPolyline(t){let e=new Map;this.gridLine[this.nowGridLine].interLine(t).forEach((s,a)=>{s.forEach(l=>{let c=l.index,h=this.effectivePoint(t.primitives[a],l);e.has(c)||e.set(c,[]),h.forEach(u=>{e.get(c).push(u)})})});let n=!1;return e.forEach((s,a)=>{if(s.length%2!==0)throw new Error;this.allGridInterPoint[a]===void 0&&(this.allGridInterPoint[a]=[]),s.forEach(l=>{n=!0,this.allGridInterPoint[a].push(l)})}),n}createGridLine(t,e,r){if(this.useTransform)return this.transform&&(t=t.transform(new Qe().rotate(r))),[new Nie(t,e),new kie(t,e)];if(r===Math.PI/4)return[];if(r===0)return[new Nie(t,e),new kie(t,e)];Od()}effectivePoint(t,e){if(e.num===0)return[];if(e.num===1){let r=e.near1===!0?null:e.startPosition,i=e.near1===!1?null:e.endPosition;return r===null?i?[e.point1]:[]:i===null?r?[e.point1]:[]:r===i?[]:[e.point1]}else if(e.num===2){let r=e.near1,i=e.near2,n=e.point1,s=e.point2,a=e.startPosition,l=e.endPosition;if(r!==null&&i!==null?r!==i?(a=null,l=null):Od():r!==null&&i===null?r===!0?a=null:l=null:r===null&&i!==null&&(i===!0?a=null:l=null),t instanceof M){if(a===null&&l===null)return[];Od()}else if(t instanceof q){let c=h=>{let u=t.rx/10;for(;u/=10;){let d=q.build3(h,0,360,u,u);if(Tt(d,t)===2){let p=new S(Ee[0],Ee[1]),m=this.gridLine[this.nowGridLine].positionPoint(p,e.index);return(m===null||un(p,h))&&Od(),m}u<1e-8&&Od()}};if(a===null&&l===null){let h=c(n),u=c(s);if(h===u)return h?[n,s]:[];Od()}else if(a===null&&l!==null){if(r===!0)return l?[s]:[n,s];if(i===!0)return l?[n]:[n,s];Od()}else if(a!==null&&l===null){if(r===!1)return a?[s]:[n,s];if(i===!1)return a?[n]:[n,s];Od()}else if(a!==null&&l!==null)return[n,s]}else Od()}else Od()}};function Od(o){throw new Error(o||"gnrGrids error!")}var d3t=new ZA(o=>{let t=new Sd(10);return o.forEach((e,r)=>{r!==0&&t.insert(e)}),t});function FVe(o,t){let e=t[0];if(!Kx.pip(o,e))return!1;let r=d3t.get(t).search(new ut(o.x-1e-5,o.x+1e-5,o.y-1e-5,o.y+1e-5));for(let i=0;i<r.length;i++)if(Kx.pip(o,r[i]))return!1;return!0}var VVe;(r=>{let o;(s=>(s[s.offsetBig=1e-5]="offsetBig",s[s.offsetSmall=ne.eps]="offsetSmall"))(o=r.Constant||(r.Constant={}));let t;(p=>(p[p._=0]="_",p[p.First=1]="First",p[p.Second=2]="Second",p[p.Third=3]="Third",p[p.Fourth=4]="Fourth",p[p.XPositive=5]="XPositive",p[p.XNegative=6]="XNegative",p[p.YPositive=7]="YPositive",p[p.YNegative=8]="YNegative"))(t=r.Quadrant||(r.Quadrant={}));let e;(l=>(l[l._=0]="_",l[l.partially=1]="partially",l[l.fully=2]="fully",l[l.empty=3]="empty"))(e=r.OccType||(r.OccType={}))})(VVe||(VVe={}));var Vj;(C=>{let o;(O=>{class E{constructor(R){this.map=new Map;this.cb=R}get(R,v){let D=this.map.get(R);if(D!==void 0)return D;let w=v(R);return this.map.set(R,w),w}}O.Nor=E})(o||(o={}));function t(E){return new o.Nor(E)}C.Mnemonic=t;let e;(O=>{class E{constructor(){this.buffer=[]}add(R,v,D){this.buffer[R]===void 0&&(this.buffer[R]=[]),this.buffer[R][v]=D}search(R,v){return this.buffer[R]===void 0||this.buffer[R][v]===void 0?void 0:this.buffer[R][v]}}O.Nor=E})(e||(e={}));function r(){return new e.Nor}C.Buffer=r;let i;(O=>{class E{constructor(){this.buffer=[]}add(R,v,D){this.buffer[R]===void 0?(this.buffer[R]=[],this.buffer[R][v]=new Set().add(D)):this.buffer[R][v]===void 0?this.buffer[R][v]=new Set().add(D):this.buffer[R][v].add(D)}search(R,v){return this.buffer[R]===void 0||this.buffer[R][v]===void 0?void 0:this.buffer[R][v]}forEach(R){this.buffer.forEach((v,D)=>{v.forEach((w,F)=>{w.forEach(H=>R(D,F,H))})})}}O.Nor=E})(i||(i={}));function n(){return new i.Nor}C.GridBuffer=n;let s;(O=>{class E{constructor(){this.buffer=[]}add(R,v,D,w){this.buffer[R]===void 0?(this.buffer[R]=[],this.buffer[R][v]=new Map().set(D,w)):this.buffer[R][v]===void 0?this.buffer[R][v]=new Map().set(D,w):this.buffer[R][v].set(D,w)}search(R,v){return this.buffer[R]===void 0||this.buffer[R][v]===void 0?void 0:this.buffer[R][v]}forEach(R){this.buffer.forEach((v,D)=>{v.forEach((w,F)=>{w.forEach((H,z)=>R(D,F,z,H))})})}}O.Nor=E})(s||(s={}));function a(){return new s.Nor}C.GridBufferType=a;let l;(O=>{class E{constructor(){this.coord=new Map}add(R,v){let D=this.coord.get(R);D?D.add(v):this.coord.set(R,new Set().add(v))}get(R){this.coord.forEach((v,D)=>v.forEach(w=>R(D,w)))}}O.Nor=E})(l||(l={}));function c(){return new l.Nor}C.Coord=c;let h;(O=>{class E{constructor(){this.coord=new Map}get(R){this.coord.forEach((v,D)=>v.forEach((w,F)=>R(D,F,w)))}add(R,v,D){let w=this.coord.get(R);w?w.set(v,this.cmp?this.cmp(w.get(v),D):D):this.coord.set(R,new Map().set(v,D))}getArr(){let R=[];return this.get((v,D,w)=>R.push({x:v,y:D,tag:w})),R}set(R){return this.cmp=R,this}}O.Nor=E})(h||(h={}));function u(){return new h.Nor}C.CoordType=u;let d;(F=>{class E{constructor(z){this.items=new Set;this.grid=[];this.gridSize=z}getItems(){return Array.from(this.items)}add(z){if(!this.items.has(z))return this.items.add(z),Mu.Occ.occBBox(z.bbox(),this.gridSize,(G,W)=>{this.grid[G]===void 0&&(this.grid[G]=[]),this.grid[G][W]===void 0&&(this.grid[G][W]=new Set),this.grid[G][W].add(z)}),this}remove(z){if(this.items.has(z))return this.items.delete(z),Mu.Occ.occBBox(z.bbox(),this.gridSize,(G,W)=>{this.grid[G]===void 0||this.grid[G][W]===void 0||this.grid[G][W].delete(z)}),this}search(z){let G=new Set;Mu.Occ.occBBox(z,this.gridSize,(L,B)=>{this.grid[L]&&this.grid[L][B]&&this.grid[L][B].forEach(N=>{G.add(N)})});let W=[];return G.forEach(L=>{z.isSeparated(L.bbox())||W.push(L)}),W}clear(){this.items.clear(),this.grid.length=0}}F.BBoxNor=E;class O{constructor(z){this.items=new Map;this.grid=[];this.gridSize=z}getItems(){return Array.from(this.items.keys())}add(z){if(this.items.has(z))return;let G=[];return Mu.Occ.occBBox(z.bbox(),this.gridSize,(W,L)=>{G.push({x:W,y:L}),this.grid[W]===void 0&&(this.grid[W]=[]),this.grid[W][L]===void 0&&(this.grid[W][L]=new Set),this.grid[W][L].add(z)}),this.items.set(z,G),this}remove(z){let G=this.items.get(z);if(G)return G.forEach(W=>{let L=W.x,B=W.y;this.grid[L]===void 0||this.grid[L][B]===void 0||this.grid[L][B].delete(z)}),this.items.delete(z),this}search(z){let G=new Set;Mu.Occ.occBBox(z,this.gridSize,(L,B)=>{this.grid[L]&&this.grid[L][B]&&this.grid[L][B].forEach(N=>{G.add(N)})});let W=[];return G.forEach(L=>{z.isSeparated(L.bbox())||W.push(L)}),W}clear(){this.items.clear(),this.grid.length=0}}F.BBoxStor=O;class _ extends O{searchItem(z){let G=this.items.get(z);if(!G)return;let W=new Set;G.forEach(B=>{let N=B.x,U=B.y;this.grid[N]&&this.grid[N][U]&&this.grid[N][U].forEach(k=>{W.add(k)})});let L=[];return W.forEach(B=>{z.bbox().isSeparated(B.bbox())||L.push(B)}),L}}F.BBoxNorDynamicBBox=_;class R extends E{add(z){if(!this.items.has(z))return this.items.add(z),z.occGrids(this.gridSize,(G,W)=>{this.grid[G]===void 0&&(this.grid[G]=[]),this.grid[G][W]===void 0&&(this.grid[G][W]=new Set),this.grid[G][W].add(z)}),this}remove(z){if(this.items.has(z))return this.items.delete(z),z.occGrids(this.gridSize,(G,W)=>{this.grid[G]===void 0||this.grid[G][W]===void 0||this.grid[G][W].delete(z)}),this}}F.OccNor=R;class v extends O{add(z){if(this.items.has(z))return;let G=[];return z.occGrids(this.gridSize,(W,L)=>{G.push({x:W,y:L}),this.grid[W]===void 0&&(this.grid[W]=[]),this.grid[W][L]===void 0&&(this.grid[W][L]=new Set),this.grid[W][L].add(z)}),this.items.set(z,G),this}}F.OccStor=v;class D extends E{add(z){if(!this.items.has(z))return this.items.add(z),Mu.Occ.occPolygon(z.getMathGraphics(),this.gridSize,(G,W)=>{this.grid[G]===void 0&&(this.grid[G]=[]),this.grid[G][W]===void 0&&(this.grid[G][W]=new Set),this.grid[G][W].add(z)}),this}remove(z){if(this.items.has(z))return this.items.delete(z),Mu.Occ.occPolygon(z.getMathGraphics(),this.gridSize,(G,W)=>{this.grid[G]===void 0||this.grid[G][W]===void 0||this.grid[G][W].delete(z)}),this}}F.GraphicsNor=D;class w extends O{add(z){if(this.items.has(z))return;let G=[];return Mu.Occ.occPolygon(z.getMathGraphics(),this.gridSize,(W,L)=>{G.push({x:W,y:L}),this.grid[W]===void 0&&(this.grid[W]=[]),this.grid[W][L]===void 0&&(this.grid[W][L]=new Set),this.grid[W][L].add(z)}),this.items.set(z,G),this}}F.GraphicsStor=w})(d||(d={}));function p(E="bbox",O="nor",_=6,R=!1){switch(E){case"bbox":switch(O){case"nor":return R?new d.BBoxNorDynamicBBox(_):new d.BBoxNor(_);case"stor":return new d.BBoxStor(_);default:throw js.error()}case"occ":switch(O){case"nor":return new d.OccNor(_);case"stor":return new d.OccStor(_);default:throw js.error()}case"graphics":switch(O){case"nor":return new d.GraphicsNor(_);case"stor":return new d.GraphicsStor(_);default:throw js.error()}default:throw js.error()}}C.Grid=p;let m;(_=>{class E{constructor(v,D,w){this.capacity=w,this.bbox=v,this.root=new O(D,this.bbox,this.capacity)}add(v){return this}remove(v){return this}search(v){let D=new Set;return this.root.search(v,w=>D.add(w)),Array.from(D)}}_.Nor=E;class O{constructor(v,D,w){this.bbox=D,v.length>w?this.split(v,w):this.items=v}search(v,D){v.isIntersect(this.bbox)&&(this.items!==void 0?this.items.forEach(w=>D(w)):(v.isIntersect(this.nodeLU.bbox)&&this.nodeLU.search(v,D),v.isIntersect(this.nodeLD.bbox)&&this.nodeLD.search(v,D),v.isIntersect(this.nodeRU.bbox)&&this.nodeRU.search(v,D),v.isIntersect(this.nodeRD.bbox)&&this.nodeRD.search(v,D)))}split(v,D){let w=this.bbox.center(),F=new ut(this.bbox.minX,w.x,w.y,this.bbox.maxY).extendOfSize(1e-5),H=new ut(this.bbox.minX,w.x,this.bbox.minY,w.y).extendOfSize(1e-5),z=new ut(w.x,this.bbox.maxX,w.y,this.bbox.maxY).extendOfSize(1e-5),G=new ut(w.x,this.bbox.maxX,this.bbox.minY,w.y).extendOfSize(1e-5),W=[],L=[],B=[],N=[];for(let U=0;U<v.length;U++)v[U].bbox().isIntersect(F)&&W.push(v[U]),v[U].bbox().isIntersect(H)&&L.push(v[U]),v[U].bbox().isIntersect(z)&&B.push(v[U]),v[U].bbox().isIntersect(G)&&N.push(v[U]);this.nodeLU=new O(W,F,D),this.nodeLD=new O(L,H,D),this.nodeRU=new O(B,z,D),this.nodeRD=new O(N,G,D)}}})(m||(m={}));function g(E,O=[],_=6){return new m.Nor(E,O,_)}C.QuadTree=g;let y;(_=>{class E{constructor(v,D,w){this.capacity=w||2,this.root=new O(v,D,this.capacity)}search(v){let D=new Set;return this.root.search(v,w=>{D.add(w)}),Array.from(D)}}_.Nor=E;class O{constructor(v,D,w){this.items=[];this.onMedianItems=[];this.quickSelect=(v,D,w,F,H)=>{let z=Math.floor(Math.random()*(w-D+1))+D;this.swap(v,z,w);let G=D,W=D;for(;W<w;)H(v[W],v[w])&&this.swap(v,G++,W),W++;return this.swap(v,G,W),w===F+G-1?this.dimensional===!0?this.getBboxMiddleX(v[G].bbox()):this.getBboxMiddleY(v[G].bbox()):w>F+G-1?this.quickSelect(v,G+1,w,F,H):this.quickSelect(v,D,G-1,F-(w-G+1),H)};this.items=v,this.bbox=D,this.capacity=w,!(this.items.length<this.capacity)&&(this.dimensional=this.getDimensional(),this.median=this.getMedian(),this.createMedianItems(),this.createNode())}search(v,D){if(v.isIntersect(this.bbox)){if(this.items.length<this.capacity)for(let w=0;w<this.items.length;w++)D(this.items[w]);for(let w=0;w<this.onMedianItems.length;w++)D(this.onMedianItems[w]);if(this.dimensional===!0){if(this.median>v.minX&&this.median<v.maxX){this.leftNode.search(v,D),this.rightNode.search(v,D);return}v.maxX<this.median?this.leftNode.search(v,D):v.minX>this.median&&this.rightNode.search(v,D)}else{if(this.median>v.minY&&this.median<v.maxY){this.leftNode.search(v,D),this.rightNode.search(v,D);return}v.maxY<this.median?this.leftNode.search(v,D):v.minY>this.median&&this.rightNode.search(v,D)}}}createNode(){let v,D=[],w,F=[];for(let H=0;H<this.items.length;H++)this.dimensional===!0?this.items[H].bbox().maxX<this.median?D.push(this.items[H]):this.items[H].bbox().minX>this.median&&F.push(this.items[H]):this.items[H].bbox().maxY<this.median?D.push(this.items[H]):this.items[H].bbox().minY>this.median&&F.push(this.items[H]);this.dimensional===!0?(v=new ut(this.bbox.minX,this.median,this.bbox.minY,this.bbox.maxY),w=new ut(this.median,this.bbox.maxX,this.bbox.minY,this.bbox.maxY)):(v=new ut(this.bbox.minX,this.bbox.maxX,this.bbox.minY,this.median),w=new ut(this.bbox.minX,this.bbox.maxX,this.median,this.bbox.maxY)),this.leftNode=new O(D,v,this.capacity),this.rightNode=new O(F,w,this.capacity)}createMedianItems(){for(let v=0;v<this.items.length;v++)this.dimensional===!0?this.median>=this.items[v].bbox().minX&&this.median<=this.items[v].bbox().maxX&&this.onMedianItems.push(this.items[v]):this.median>=this.items[v].bbox().minY&&this.median<=this.items[v].bbox().maxY&&this.onMedianItems.push(this.items[v])}getDimensional(){return this.createDimensionalVariance()}createDimensionalDifference(){let v=this.bbox;return v.maxX-v.minX>v.maxY-v.minY}createDimensionalVariance(){let v=0,D=0;for(let H=0;H<this.items.length;H++)v+=this.getBboxMiddleX(this.items[H].bbox()),D+=this.getBboxMiddleY(this.items[H].bbox());v/=this.items.length,D/=this.items.length;let w=0,F=0;for(let H=0;H<this.items.length;H++)w+=Math.pow(v-this.getBboxMiddleX(this.items[H].bbox()),2),F+=Math.pow(D-this.getBboxMiddleY(this.items[H].bbox()),2);return w>F}getMedian(){return this.createMedianQuickSelect()}createMedianQuickSelect(){let v=this.items.length,D=v%2===0?Math.floor(v/2):Math.floor(v/2)+1;D=v-D+1;let w=this.items,F=D;if(this.dimensional===!0){let H=(z,G)=>this.getBboxMiddleX(z.bbox())<=this.getBboxMiddleX(G.bbox());return this.quickSelect(w,0,w.length-1,F,H)}else{let H=(z,G)=>this.getBboxMiddleY(z.bbox())<=this.getBboxMiddleY(G.bbox());return this.quickSelect(w,0,w.length-1,F,H)}}swap(v,D,w){return[v[D],v[w]]=[v[w],v[D]]}createMedianSort(){let v=this.items.length,D=v%2===0?Math.floor(v/2):Math.floor(v/2)+1,w;return this.dimensional===!0?w=(F,H)=>this.getBboxMiddleX(F.bbox())-this.getBboxMiddleX(H.bbox()):w=(F,H)=>this.getBboxMiddleY(F.bbox())-this.getBboxMiddleY(H.bbox()),this.items.sort(w),this.dimensional===!0?this.getBboxMiddleX(this.items[D].bbox()):this.getBboxMiddleY(this.items[D].bbox())}getBboxMiddleX(v){return(v.maxX+v.minX)/2}getBboxMiddleY(v){return(v.maxY+v.minY)/2}}})(y||(y={}));function b(E,O,_){return new y.Nor(E,O,_)}C.KDTree=b;let P;(_=>{class E{constructor(v,D){D=D||2;let w=[];for(let H=0;H<v.length;H++)w[H]=new O(v[H],"Left");w.sort((H,z)=>H.mortonCode-z.mortonCode);let F=[w,[]];for(;;){if(F[1]=[],Mu.Method.splitNum(0,F[0].length,D,(H,z)=>{F[1].push(new O(F[0].slice(H,z),"Node"))}),F[1].length===1){this.rootNode=F[1][0];return}F[0]=F[1]}}search(v){return this.rootNode.search(v).map(D=>D._item)}}_.Nor=E;class O{constructor(v,D){this.nodes=[];D==="Left"?(this.item=v,this.bbox=v.bbox):(this.bbox=Mu.Method.minOutsourcing(v),this.nodes=v),this.mortonCode=Mu.Method.mortonCode(this.bbox.center().x,this.bbox.center().y)}search(v){let D=[];if(this.item!==void 0)return[this];for(let w=0;w<this.nodes.length;w++){let F=this.nodes[w];v.isIntersect(F.bbox)&&Array.prototype.push.apply(D,F.search(v))}return D}get _item(){return this.item}}})(P||(P={}));function T(E,O){return new P.Nor(E,O)}C.BVH=T;let I;(_=>{let E;(H=>{function R(z,G="Array"){if(G==="Array")return new H.Nor(z)}H.instance=R;class v{constructor(G){this.queue=[],this.cmp=G}remove(G){for(let W=0;W<this.size();W++)this.queue[W]===G&&this.queue.splice(W,1)}size(){return this.queue.length}empty(){return this.queue.length===0}push(G){for(let W=0;W<this.size();W++)if(this.cmp(G,this.queue[W])){this.queue.splice(W,0,G);return}this.queue.push(G)}pop(){for(let G=0;G<this.size()-1;G++)this.queue[G]=this.queue[G+1];this.queue.pop()}top(){return this.empty()&&js.error(),this.queue[0]}}H.Nor=v;class D{static build(G,W){return new F(G,W)}}class w{constructor(G,W,L){this.item=L,this.isBigTop=G,this.cmp=W}push(G){if(this.item===void 0)this.item=G;else{let W=this.cmp(G,this.item);(this.isBigTop?W:!W)?this.leftChild===void 0?this.leftChild=new w(this.isBigTop,this.cmp,G):this.leftChild.push(G):this.rightChild===void 0?this.rightChild=new w(this.isBigTop,this.cmp,G):this.rightChild.push(G)}}}class F{constructor(G,W){this.root=new w(G,W)}push(G){this.root.push(G)}}})(E=_.Build||(_.Build={}));class O{constructor(){let v=(w,F)=>w<F,D=(w,F)=>w>F;this.minX=_.Build.instance(v),this.maxX=_.Build.instance(D),this.minY=_.Build.instance(v),this.maxY=_.Build.instance(D)}bbox(){return new ut(this.minX.top(),this.maxX.top(),this.minY.top(),this.maxY.top())}insert(v){this.minX.push(v.minX),this.maxX.push(v.maxX),this.minY.push(v.minY),this.maxY.push(v.maxY)}remove(v){this.minX.remove(v.minX),this.maxX.remove(v.maxX),this.minY.remove(v.minY),this.maxY.remove(v.maxY)}}})(I||(I={}))})(Vj||(Vj={}));var Mu;(h=>{let o;(N=>{function u(U,k){let V=null,Y=null,X=0;return U.points(k,Z=>{Y?X+=(Z.x+Y.x)*(Z.y-Y.y):V=Z,Y=Z}),X+=(V.x+Y.x)*(V.y-Y.y),X/2}N.area=u;function d(U,k){let V={p:U.primitives[0].start(),n:U.primitives[0].start().cross(k)};return U.primitives.forEach(Y=>{let X=Y.start().cross(k);X>V.n&&(V={p:Y.start(),n:X})}),V.p}N.polylineFurthestPoint=d;function p(U,k){let V=[U],Y=U.center,X=U.rx,Z=U.startAngle,Q=U.endAngle(),ae=Z;return(he=>{let re=(()=>{let me=k-U.center.y;if(me===0)return{min:0,max:180};{let Oe=Math.acos(Math.abs(me)/X)*180/Math.PI,Ie=me>0?90:270;return{min:Ie-Oe,max:Ie+Oe}}})(),se=Z>Q?Q:Z,K=Z>Q?Z:Q;for(let me=re.min;me>se&&he(me);me-=360);for(let me=re.min;me<K&&he(me);me+=360);for(let me=re.max;me>se&&he(me);me-=360);for(let me=re.max;me<K&&he(me);me+=360);})(he=>{for(let re=0;re<V.length;re++){if(V[re].sweep()===le.CW&&he>V[re].startAngle&&he<V[re].endAngle())return V.splice(re,1,q.build2(Y,V[re].startAngle,he,X,X,V[re].sweep())),V.splice(re+1,0,q.build2(Y,he,V[re].endAngle(),X,X,V[re].sweep())),!1;if(V[re].sweep()===le.CCW&&he>V[re].endAngle()&&he<V[re].startAngle)return V.splice(re,1,q.build2(Y,V[re].endAngle(),he,X,X,V[re].sweep())),V.splice(re+1,0,q.build2(Y,he,V[re].startAngle,X,X,V[re].sweep())),!1}return!0}),V}N.arcCutByY=p;function m(U,k=.1){return g.area(U,k)}N.polylineIsCW=m;let g;(V=>{function U(Y,X=.1){let Z=0;return Y.primitives.forEach(ae=>{if(ae instanceof M)Z+=(ae.end().y+ae.start().y)*(ae.end().x-ae.start().x);else if(ae instanceof q)Z+=(ae.end().y+ae.start().y)*(ae.end().x-ae.start().x),Z+=Q(ae)*(ae.isCCW?2:-2);else if(ae instanceof Mr){let he=ae.start();ae.points(X).forEach(re=>{Z+=(re.y+he.y)*(re.x-he.x),he=re}),Z+=(ae.end().y+he.y)*(ae.end().x-he.x)}}),Z>0;function Q(ae){let he=Math.abs(ae.sweep()),re=ae.rx2*Math.PI;if(he>=360)return re;return he===180?re/2:re*(he/360)+(he<180?-1:1)*se(ae.center,ae.start(),ae.end());function se(K,me,Oe){let Ie=K.distance1(me),ue=me.distance1(Oe),Pe=Oe.distance1(K),j=(Ie+ue+Pe)/2;return Math.sqrt(j*(j-Ie)*(j-ue)*(j-Pe))}}}V.area=U;function k(Y,X){let Z=0;return Y.primitives.forEach(Q=>{if(Q instanceof M){let ae=Q.start(),he=Q.end();Z+=(he.x-ae.x)*(he.y+ae.y)}else if(Q instanceof q)(()=>{let ae=[],he=Q.center,re=he.y,se=Q.rx;return K(Q,0).forEach(me=>K(me,re).forEach(Oe=>ae.push(Oe))),ae;function K(me,Oe){let Ie=[],ue=me.startAngle,Pe=me.endAngle(),j=ue,J=me.start();return(oe=>{let pe=(()=>{let ge=Oe-re;if(ge===0)return{min:0,max:180};{let Se=Math.acos(Math.abs(ge)/se)*180*Math.PI,De=ge>0?90:270;return{min:De-Se,max:De+Se}}})();for(let ge=0;!(pe.min-ge<ue&&(oe(pe.min-ge)||oe(pe.min+ge)));ge+=360);for(let ge=0;!(oe(pe.max-ge)||oe(pe.max+ge));ge+=360);})(oe=>{if(oe>j&&oe<Pe)return Ie.push(q.build3(he,j,oe-j,se,se)),j=oe,!0}),Ie.push(q.build3(he,j,Pe-j,se,se)),Ie}return[]})().forEach(ae=>{Z+=0});else if(Q instanceof Mr){let ae=Q.points(X),he=ae.length;for(let re=0;re<he;re++){let se=ae[re],K=ae[re+1];Z+=(K.x-se.x)*(K.y+se.y)}}else js.error()}),Z<0}V.green=k})(g=N.PolylineIsCW||(N.PolylineIsCW={}));function y(U,k){let V=U.center,Y=k?U.start():U.end(),X=(()=>{let re=h.Company.slope(V,Y);return Math.abs(re)>Number.MAX_SAFE_INTEGER?0:-1/re})(),Z=U.rx,Q=(()=>{if(X===1/0)return[new S(Y.x,Y.y+Z),new S(Y.x,Y.y-Z)];{let re=i.slopeToRadians(X),se=Z*Math.cos(re),K=Z*Math.sin(re);return[new S(Y.x+se,Y.y+K),new S(Y.x-se,Y.y-K)]}})(),ae=k?U.end():U.start(),he=(()=>{let re=h.Position.checkPointVector(V,Y,ae);if(re===null){let se=U.rx/10;for(;se/=10;){let K=e.pp(q.build3(Y,0,360,se,se),U);if(K.length===1)return h.Position.checkPointVector(V,Y,K[0]);js.error()}}else return re})();if(h.Position.checkPointVector(V,Y,Q[0])===he)return Math.abs(U.sweepAngle)>180?Q[1]:Q[0];if(h.Position.checkPointVector(V,Y,Q[1])===he)return Math.abs(U.sweepAngle)>180?Q[0]:Q[1];js.error()}N.getTangentForArcEndPoint=y;function b(U,k,V){let Y=h.Company.crossProduct(U.x,U.y,k.x,k.y,V.x,V.y);return Y===0?null:Y<0}N.triangleIsCW=b;function P(U){return T.angleSW(U)===null}N.isConvexPolygon=P;let T;(k=>{function U(V){let Y=null,X=V.primitives.length;if(X===1)return null;for(let Z=0;Z<X;Z++){let Ie=function(ue){return Y===null?(Y=ue,!0):ue===Y},Q=V.primitives[Z],ae=Z===X-1?0:Z+1,he=V.primitives[ae],re=Q.start(),se=Q.end(),K=he.end(),me=null,Oe=[ae,Z,Y];if(Q instanceof M)if(he instanceof M){if(me=b(re,se,K),me===null)throw new Error;if(Ie(me))continue;return Oe}else if(he instanceof q){if(me=b(re,se,y(he,!0)),me===null)me=!he.isCCW;else if(me===he.isCCW)return Oe;if(Ie(me))continue;return Oe}else js.error();else if(Q instanceof q)if(he instanceof M){if(me=b(y(Q,!1),se,K),me===null)me=!Q.isCCW;else if(me===Q.isCCW)return Oe;if(Ie(me))continue;return Oe}else if(he instanceof q){if(me=b(y(Q,!1),se,y(he,!0)),Q.isCCW!==he.isCCW)return Oe;if(me===null&&(me=!Q.isCCW),Ie(me))continue;return Oe}else js.error();else js.error()}return Y===null?js.error():null}k.angleSW=U})(T||(T={}));function I(U){return C.cut(U)}N.cutPolygonIntoConvexParts=I;let C;(Y=>{function U(X){let Z=0,Q=[],ae=[h.Conver.polylineArcToLine(X)];for(;ae.length!==0;){let he=k(ae.shift());he.length===1?Q.push(he[0]):he.length===2&&(Z++,ae.push(he[0]),ae.push(he[1]))}return console.log("\u5212\u5206\u4E86",Z),Q}Y.cut=U;function k(X){let Z=V(X);if(Z===null)return[X];let Q=Z.index,ae=(me=>{let Oe=Q-2,Ie=Q+2;for(;Oe>0;){if(me(Oe))return Oe;Oe--}for(;Ie<X.primitives.length;){if(me(Ie))return Ie;Ie++}})(me=>{let Oe=new M(X.primitives[Q].end(),X.primitives[me].end());if(!Ie(me,me+1<X.primitives.length?me+1:0,X.primitives[Q].end())||!Ie(Q,Q+1<X.primitives.length?Q+1:0,X.primitives[me].end()))return!1;for(let ue=0;ue<X.primitives.length;ue++){let Pe=X.primitives[ue],j=e.pp(Pe,Oe);for(let J=0;J<j.length;J++)if(!un(j[J],Oe.start())&&!un(j[J],Oe.end()))return!1}return!0;function Ie(ue,Pe,j){let J=X.primitives[ue].start(),oe=X.primitives[ue].end(),pe=X.primitives[Pe].end(),ge=l.checkPointVector(J,oe,j),Se=l.checkPointVector(oe,pe,j);return ge===null||Se===null?!1:Z.norVec===!0?!ge||!Se:ge||Se}}),he=X.primitives[Q].end(),re=X.primitives[ae].end();Ko.auto(new M(he,re),ee.WHITE);let se=[],K=[];for(let me=0,Oe=!1;me<X.primitives.length;me++){let Ie=X.primitives[me];Oe?K.push(Ie):se.push(Ie),(me===ae||me===Q)&&(Oe?(me===ae?K.push(new M(re,he)):K.push(new M(he,re)),Oe=!1):(me===ae?se.push(new M(re,he)):se.push(new M(he,re)),Oe=!0))}return[fe.build7(se),fe.build7(K)]}function V(X){let Z=h.Method.polylineIsCW(X);if(Z!==X.area(.1)<0)throw new Error;let Q=X.primitives.length;if(Q<2)return null;for(let ae=0;ae<Q;ae++){let ue=function(Pe){return Z===null?(Z=Pe,!0):Pe===Z},he=X.primitives[ae],re=ae===Q-1?0:ae+1,se=X.primitives[re],K=he.start(),me=he.end(),Oe=se.end(),Ie={index:ae,norVec:Z};if(he instanceof M)if(se instanceof M){let Pe=b(K,me,Oe);if(Pe===null&&js.error("\u7EBF\u6BB5\u5171\u7EBF\uFF01"),ue(Pe))continue;return Ie}else if(se instanceof q){let Pe=b(K,me,y(se,!0));if(Pe===null)Pe=!se.isCCW;else if(Pe===se.isCCW)return Ie;if(ue(Pe))continue;return Ie}else js.error();else if(he instanceof q)if(se instanceof M){let Pe=b(y(he,!1),me,Oe);if(Pe===null)Pe=!he.isCCW;else if(Pe===he.isCCW)return Ie;if(ue(Pe))continue;return Ie}else if(se instanceof q){let Pe=b(y(he,!1),me,y(se,!0));if(he.isCCW!==se.isCCW)return Ie;if(Pe===null&&(Pe=!he.isCCW),ue(Pe))continue;return Ie}else js.error();else js.error()}return Z===null?js.error():null}})(C=N.CutPolygonIntoConvexParts||(N.CutPolygonIntoConvexParts={}));function E(U,k,V){if(U.length<5||k.length<5)for(let Z=0,Q=U.length;Z<Q;Z++)for(let ae=0,he=k.length;ae<he;ae++)U[Z].bbox().isIntersect(k[ae].bbox().extendOfSize(1e-5))&&V(U[Z],k[ae]);U.sort((Z,Q)=>Z.bbox().minX-Q.bbox().minX),k.sort((Z,Q)=>Z.bbox().minX-Q.bbox().minX);let Y=0,X=0;for(;Y<U.length&&X<k.length;){if(U[Y].bbox().minX<k[X].bbox().minX){let Z=U[Y],Q=Z.bbox(),ae=k.length;for(let he=X;he<ae;he++){let re=k[he],se=re.bbox();if(se.minX-1e-5>Q.maxX)break;Math.max(Q.minY,se.minY)<Math.min(Q.maxY,se.maxY)+1e-5&&V(Z,re)}Y++}else{let Z=k[X],Q=Z.bbox(),ae=U.length;for(let he=Y;he<ae;he++){let re=U[he],se=re.bbox();if(se.minX-1e-5>Q.maxX)break;Math.max(Q.minY,se.minY)<Math.min(Q.maxY,se.maxY)+1e-5&&V(re,Z)}}X++}}N.slideWindow=E;function O(U,k,V){let Y=U.distance1(k),X=k.distance1(V),Z=V.distance1(U),Q=(Y+X+Z)/2;return Math.sqrt(Q*(Q-Y)*(Q-X)*(Q-Z))}N.hailun=O;function _(U,k,V="merge"){switch(V){case"merge":return R.sortMerge(U,k);case"insert":return R.sortInsert(U,k);default:js.error()}}N.sort=_;let R;(Y=>{function U(X,Z){let Q=X.length;if(Q<2)return X;for(let ae=1;ae<Q;ae++){let he=X[ae],re=ae-1;for(;re>=0&&Z(he,X[re]);)X[re+1]=X[re],re--;X[re+1]=he}}Y.sortInsert=U;function k(X,Z){let Q=X.length;if(Q<=1)return X;let ae=Math.floor(Q/2),he=k(X.slice(0,ae),Z),re=k(X.slice(ae,Q),Z);return V(he,re,Z)}Y.sortMerge=k;function V(X,Z,Q){let ae=0,he=0,re=[];for(;ae<X.length&&he<Z.length;)Q(X[ae],Z[he])?re.push(X[ae++]):re.push(Z[he++]);for(;ae<X.length;)re.push(X[ae++]);for(;he<Z.length;)re.push(Z[he++]);return re}})(R||(R={}));function v(U,k,V){return D.mergeOrdelyOppositeDualPointer(U,k,V)}N.mergeOrdely=v;let D;(k=>{function U(V,Y,X){let Z=V.length-1,Q=Y.length-1,ae=Z+Q+1;for(;Z>=0&&Q>=0;)X(V[Z],Y[Q])?V[ae--]=Y[Q--]:V[ae--]=V[Z--];if(Z<0)for(;ae>=0;)V[ae--]=Y[Q--];return V}k.mergeOrdelyOppositeDualPointer=U})(D||(D={}));function w(U){let k=U.sweepAngle,V=U.startAngle,Y=U.endAngle(),X=U.center,Z=U.rx;if(Math.abs(k)>=360)return[q.build3(X,V,V+90,Z,Z),q.build3(X,V+90,V+180,Z,Z),q.build3(X,V+180,V+270,Z,Z),q.build3(X,V+270,V+360,Z,Z)];{for(;V<0||Y<0;)V+=360,Y+=360;let Q=Math.floor(Y/360),ae=Q===0?[0,90,180,270]:Q===1?[360,450,540,630]:js.error(),he=[];ae[0]<=Y&&ae[0]>=V&&he.push(q.build3(X,V,90,Z,Z))}return null}N.cutArc=w;function F(U){let k=[];if(U.isCCW?Math.floor(U.startAngle/90)+1!==Math.ceil(U.endAngle()/90):Math.ceil(U.startAngle/90)-1!==Math.floor(U.endAngle()/90)){let V=U.startAngle,Y=U.endAngle();if(U.sweepAngle>0){let X=90;for(;X<=Y;)X>V&&(k.push(q.build3(U.center,V,X-V,U.rx,U.ry)),V=X),X+=90;V<Y&&k.push(q.build3(U.center,V,Y-V,U.rx,U.ry))}else{let X=270;for(;X>=Y;)X<V&&(k.push(q.build3(U.center,V,X-V,U.rx,U.ry)),V=X),X-=90;V>Y&&k.push(q.build3(U.center,V,Y-V,U.rx,U.ry))}}else return[U];return k}N.cutArc2=F;function H(U,k,V,Y){V=V||1,Y=Y||N.minOutsourcing(U);let X=U.length,Z=0;for(let Q=0,ae=U.length;Q<ae;Q++)Z+=U[Q].bbox.area();if(k==="defaultGridInfo"){if(Z===0)return{bbox:Y.extendOfSize(1e-5),width:V,height:V};{let Q=Math.sqrt(X),ae=Math.sqrt(Y.area()/(Z/X));Q>ae&&(Q=ae);let he,re;he=re=Q;let se=Y.width(),K=Y.height();if(se!==K){let Pe=se/K;he*=Pe,re/=Pe}let me=Math.ceil(he),Oe=Math.ceil(re),Ie=Y.width()/me,ue=Y.height()/Oe;return ue<V&&(ue=V),Ie<V&&(Ie=V),{bbox:Y.extendOfSize(1e-5),height:ue,width:Ie}}}else if(k==="useGridNum"){let Q=Math.sqrt(X),ae=Math.sqrt(Y.area()/(Z/X));Z===0?Y=Y.extendOfSize(1e-5):Q>ae&&(Q=ae);let he,re;he=re=Q;let se=Y.width(),K=Y.height();if(se!==K){let Pe=se/K;he*=Pe,re/=Pe}let me=Math.ceil(he),Oe=Math.ceil(re),Ie=Y.width()/me,ue=Y.height()/Oe;return ue<V&&(ue=V),Ie<V&&(Ie=V),{bbox:Y.extendOfSize(1e-5),height:ue,width:Ie}}}N.getGridInfo=H;function z(U){let k=U.length,V=Number.MAX_SAFE_INTEGER,Y=Number.MIN_SAFE_INTEGER,X=Number.MAX_SAFE_INTEGER,Z=Number.MIN_SAFE_INTEGER;for(let Q=0;Q<k;Q++){let ae=U[Q];V=Math.min(ae.bbox.minX,V),Y=Math.max(ae.bbox.maxX,Y),X=Math.min(ae.bbox.minY,X),Z=Math.max(ae.bbox.maxY,Z)}return new ut(V,Y,X,Z)}N.minOutsourcing=z;function G(U,k){if(U.length===0)return[];let V=2,Y=U,X;for(;;){let Z=Y.length;if(Z===1)break;X=[],h.Method.splitNum(0,Z,V,(Q,ae)=>{if(ae===Z&&Q===ae-1){X.push(Y[Q]);return}X.push(N.mergeOrdely(Y[Q],Y[ae-1],k))}),Y=X}return Y[0]}N.mergeArr=G;function W(U,k){let V=U.bbox().extendOfSize(1e-5).intersection1(k.bbox().extendOfSize(1e-5));if(V===null)return{pts1:null,pts2:null};let Y=this.getInterBBoxPtInfo(U,V);if(Y.length===0)return{pts1:null,pts2:null};let X=this.getInterBBoxPtInfo(k,V);return X.length===0?{pts1:null,pts2:null}:{pts1:Y,pts2:X}}N.getInterPublicBBoxPtInfo=W;function L(U,k,V,Y){let X=k;for(;;){if(k<=V){Y(X-k,X);return}Y(U*V,(U+1)*V),k-=V,U++}}N.splitNum=L;function B(U,k){return U=(U|U<<8)&16711935,U=(U|U<<4)&252645135,U=(U|U<<2)&858993459,U=(U|U<<1)&1431655765,k=(k|k<<8)&16711935,k=(k|k<<4)&252645135,k=(k|k<<2)&858993459,k=(k|k<<1)&1431655765,U|k<<1}N.mortonCode=B})(o=h.Method||(h.Method={}));let t;(T=>{function u(I,C,E){if(I instanceof Tl){if(C instanceof Tl)throw new Error("no support");if(C instanceof fe)throw new Error("no support");if(C instanceof Gt||C instanceof hs)throw new Error("no support");if(C instanceof Jo)throw new Error("no support")}else if(I instanceof fe){if(C instanceof Tl)throw new Error("no support");if(C instanceof fe)return m(I,C,E);if(C instanceof Gt||C instanceof hs)throw new Error("no support");if(C instanceof Jo)throw new Error("no support")}else if(I instanceof Gt||I instanceof hs){if(C instanceof Tl)throw new Error("no support");if(C instanceof fe)throw new Error("no support");if(C instanceof Gt||C instanceof hs)throw new Error("no support");if(C instanceof Jo)throw new Error("no support")}else if(I instanceof Jo){if(C instanceof Tl)throw new Error("no support");if(C instanceof fe)throw new Error("no support");if(C instanceof Gt||C instanceof hs)throw new Error("no support");if(C instanceof Jo)throw new Error("no support")}return null}T.auto=u;function d(I,C,E){if(I instanceof Tl){if(C instanceof Tl)throw new Error("no support");if(C instanceof fe)throw new Error("no support");if(C instanceof Gt||C instanceof hs)throw new Error("no support");if(C instanceof Jo)throw new Error("no support")}else if(I instanceof fe){if(C instanceof Tl)throw new Error("no support");if(C instanceof fe)throw new Error("no support");if(C instanceof Gt||C instanceof hs)throw new Error("no support");if(C instanceof Jo)throw new Error("no support")}else if(I instanceof Gt||I instanceof hs){if(C instanceof Tl)throw new Error("no support");if(C instanceof fe)throw new Error("no support");if(C instanceof Gt||C instanceof hs)throw new Error("no support");if(C instanceof Jo)throw new Error("no support")}else if(I instanceof Jo){if(C instanceof Tl)throw new Error("no support");if(C instanceof fe)throw new Error("no support");if(C instanceof Gt||C instanceof hs)throw new Error("no support");if(C instanceof Jo)throw new Error("no support")}return null}T.autoLine=d;function p(I,C,E=0){}T.pp=p;function m(I,C,E){return b.chek(I,C)}T.polyline=m;function g(I,C){}T.polylinePolygon=g;function y(I,C){}T.polygon=y;class b{static chek(C,E){for(this.polyline1=C,this.polyline2=E,this.d=new S(0,1),this.simplex=[this.support()],this.d=new S(0,0).sub(this.simplex[0]);;){let O=this.support();if(O.dot(this.d)<0)return!1;if(this.simplex.push(O),this.handleSimplex())return!0}}static handleSimplex(){return this.simplex.length===2?this.lineCase():this.triangleCase()}static lineCase(){let C=this.simplex[0],E=this.simplex[1],O=C.sub(E),_=new S(0,0).sub(E),R=this.tripleProd(O,_,O);return this.d=R,!1}static tripleProd(C,E,O){return new S(0,new S(0,C.cross(E)).cross(O))}static triangleCase(){let C=this.simplex[0],E=this.simplex[1],O=this.simplex[2],_=E.sub(O),R=C.sub(O),v=new S(0,0).sub(O),D=this.tripleProd(R,_,_),w=this.tripleProd(_,R,R);return D.dot(v)>0?(this.remove(C),this.d=D,!1):w.dot(v)>0?(this.remove(E),this.d=w,!1):!0}static remove(C){let E=this.simplex.indexOf(C);E>0&&this.simplex.splice(E,1)}static support(){return this.minkowskiDifference(o.polylineFurthestPoint(this.polyline1,this.d),o.polylineFurthestPoint(this.polyline2,this.d.mul(-1)))}static minkowskiDifference(C,E){return new S(E.x-C.x,E.y-C.y)}}class P extends b{static chek1(C,E,O){for(this.polyline1=C,this.polyline2=E,this.d=new S(0,1),this.simplex=[this.support()],this.d=new S(0,0).sub(this.simplex[0]);;){let _=this.support();if(_.dot(this.d)<0)return!1;if(this.simplex.push(_),this.handleSimplex())return!0}}}})(t=h.Collision||(h.Collision={}));let e;(d=>{function u(p,m){let g=Tt(p,m),y=[];for(let b=0;b<g;b+=2)y.push(new S(Ee[b],Ee[b+1]));return y}d.pp=u})(e=h.Intersect||(h.Intersect={}));let r;(p=>{function u(m,g){let y=m-g;return y>0?y>1e-5?!0:null:y<-1e-5?!1:null}p.equals=u;function d(m,g,y){return m<y+1e-5&&m>g-1e-5}p.corridor=d})(r=h.Precision||(h.Precision={}));let i;(y=>{function u(b){let P=bh.getCache(b);if(P instanceof Ud)return P.shape;if(P instanceof Pp)return P.shape;if(P instanceof ud)return P.shape;if(P instanceof Cd)return P.shape;js.error()}y.pcbShapeModelToShap=u;function d(b){return Math.atan(b)}y.slopeToRadians=d;function p(b){return b*180/2*Math.PI}y.radiansToAngle=p;function m(b,P=.1){let T=[],I=null;return b.points(P).forEach((C,E)=>{E!==0&&T.push(new M(I,C)),I=C}),T}y.arcToLine=m;function g(b){let P=[];return b.primitives.forEach(T=>{T instanceof q?m(T).forEach(I=>P.push(I)):P.push(T)}),fe.build7(P)}y.polylineArcToLine=g})(i=h.Conver||(h.Conver={}));let n;(m=>{function u(g,y){return(g.y-y.y)/(g.x-y.x)}m.slope=u;function d(g,y,b,P,T,I){return(b-g)*(I-y)-(T-g)*(P-y)}m.crossProduct=d;function p(g,y,b){return new S((g.x+y.x+b.x)/2,(g.y+y.y+b.y)/2)}m.triangleCentre=p})(n=h.Company||(h.Company={}));let s;(w=>{function u(F,H,z){z(Math.floor(F.x/H),Math.floor(F.y/H))}w.occPoint=u;function d(F,H,z,G){g(new ut(F.x-z,F.x+z,F.y-z,F.y+z),H,G)}w.occPointExtend=d;function p(F,H,z,G){let W=Vj.CoordType().set((L,B)=>L&&B);u(F,H,(L,B)=>W.add(L,B,!1)),T(q.build3(F,0,360,z,z),H,(L,B)=>W.add(L,B,!0)),W.get(G)}w.occPointDiscernExtend=p;function m(F,H,z){u(F,H,(G,W)=>z(G,W,2))}w.occPointType=m;function g(F,H,z){for(let G=Math.floor(F.minX/H),W=Math.ceil(F.maxX/H);G<=W;G++)for(let L=Math.floor(F.minY/H),B=Math.ceil(F.maxY/H);L<=B;L++)z(G,L)}w.occBBox=g;function y(F,H,z,G){g(F.extendOfSize(z),H,G)}w.occBBoxExtend=y;function b(F,H,z,G){for(let W=Math.floor(F.minX/H),L=Math.ceil(F.maxX/H);W<L;W++)for(let B=Math.floor(F.minY/H),N=Math.ceil(F.maxY/H);B<N;B++)G(W,B)}w.occBBoxDiscernExtend=b;function P(F,H,z){let G=Math.floor(F.minX/H),W=Math.ceil(F.maxX/H),L=Math.floor(F.minY/H),B=Math.ceil(F.maxY/H),N;for(let U=G;U<W;U++){N=U===G||W?1:2;for(let k=L;k<B;k++)N=k===L||B?1:2,z(U,k,N)}}w.occBBoxType=P;function T(F,H,z){let G=F.bbox();if(Math.abs(G.maxX-G.minX)<H||Math.abs(G.maxY-G.minY)<H)return g(G,H,z);if(F instanceof M)return v.occLine(F,H,z);if(F instanceof q)return v.occArc(F,H,z);throw new Error("Method not implemented.")}w.occPt=T;function I(F,H,z,G){let W=F.bbox();if(Math.abs(W.maxX-W.minX)<H||Math.abs(W.maxY-W.minY)<H)return y(W,H,z,G);if(F instanceof M)return v.occLineExtend(F,H,z,G);if(F instanceof q)return v.occArcExtend(F,H,z,G);throw new Error("Method not implemented.")}w.occPtExtend=I;function C(F,H,z){T(F,H,(G,W)=>z(G,W,1))}w.occPtType=C;function E(F,H,z){D.Gnr.occPolygon(Gj.getPolygon(F),H,z)}w.occPolygon=E;function O(F,H,z,G){D.Gnr.occPolygonExtend(Gj.getPolygon(F),H,z,G)}w.occPolygonExtend=O;function _(F,H,z){D.Gnr.occPolygonType(Gj.getPolygon(F),H,z)}w.occPolygonType=_;function R(F,H,z){return new ut(F*z,F*z+z,H*z,H*z+z)}w.demoGrid=R;let v;(L=>{function F(B,N,U){let k=(se,K,me)=>{let Oe=Math.floor(K/N),Ie=Math.floor(me/N);for(let ue=Oe<Ie,Pe=ue?Oe:Ie,j=ue?Ie:Oe;Pe<=j;Pe++)U(se,Pe);return me},V=B.start().x<B.end().x,Y=V?B.start():B.end(),X=V?B.end():B.start(),Z=Math.floor(Y.x/N),Q=Math.floor(X.x/N);if(Q===Z){k(Z,Y.y,X.y);return}let ae=(X.y-Y.y)/(X.x-Y.x),he=ae*N,re=k(Z++,Y.y,Y.y+(Z*N-Y.x)*ae);for(;Z<Q;)re=k(Z++,re,re+he);k(Z,re,X.y)}L.occLine=F;function H(B,N,U,k){}L.occLineExtend=H;function z(B,N,U){let k=B.bbox();for(let V=Math.floor(k.minX/N)*N,Y=Math.ceil(k.maxX/N)*N;V<=Y;V+=N){let X=new M(new S(V,k.minY),new S(V,k.maxY)),Z=Math.floor(V/N),Q=Tt(X,B);for(let ae=0;ae<Q;ae+=2){let he=Ee[ae+1];U(Z,Math.floor(he/N)),U(Z-1,Math.floor(he/N))}}for(let V=Math.floor(k.minY/N)*N,Y=Math.ceil(k.maxY/N)*N;V<=Y;V+=N){let X=new M(new S(k.minX,V),new S(k.maxX,V)),Z=Math.floor(V/N),Q=Tt(X,B);for(let ae=0;ae<Q;ae+=2){let he=Ee[ae];U(Math.floor(he/N),Z),U(Math.floor(he/N),Z-1)}}}L.occArc=z;function G(B,N,U,k){}L.occArcExtend=G;class W{constructor(N,U,k){this.bbox=N,this.gridWidth=U,this.gridHeight=k}convertLine(N){return new M(new S((N.start().x-this.bbox.minX)/this.gridWidth,(N.start().y-this.bbox.minY)/this.gridHeight),new S((N.end().x-this.bbox.minX)/this.gridWidth,(N.end().y-this.bbox.minY)/this.gridHeight))}trimLine(N){let U=Math.floor(N.start().x),k=N.end().y-N.start().y,V=N.start().x-N.end().x,Y=N.end().x*N.start().y-N.start().x*N.end().y,X=-k/V,Z=-Y/V,Q=X*U+Z;return new M(new S(U,Q),N.end())}occupy(N,U){N=this.convertLine(N),U(Math.floor(N.start().x),Math.floor(N.start().y)),console.log(Math.floor(N.start().x),Math.floor(N.start().y));let k=N.start(),V=N.end(),Y=V.x-k.x,X=V.y-k.y,Z=Math.abs(X/Y);if(Y>0&&X>0)Z<=1?(console.log("case:1"),this.bresenham(k,V,U)):(console.log("case:2"),this.bresenham(new S(k.y,k.x),new S(V.y,V.x),(Q,ae)=>{U(ae,Q)}));else if(Y>0&&X<0)Z<=1?(console.log("case:3"),this.bresenham(new S(k.x,-k.y),new S(V.x,-V.y),(Q,ae)=>{U(Q,-ae)})):(console.log("case:4"),this.bresenham(new S(-k.y,k.x),new S(-V.y,V.x),(Q,ae)=>{U(ae,-Q)}));else if(Y<0&&X>0)Z<=1?(console.log("case:5"),this.bresenham(new S(-k.x,k.y),new S(-V.x,V.y),(Q,ae)=>{U(-Q,ae)})):(console.log("case:6"),this.bresenham(new S(k.y,-k.x),new S(V.y,-V.x),(Q,ae)=>{U(-ae,Q)}));else if(Y<0&&X<0)Z<=1?(console.log("case:7"),this.bresenham(V,k,(Q,ae)=>{U(Q,ae)})):(console.log("case:8"),this.bresenham(new S(V.y,V.x),new S(k.y,k.x),(Q,ae)=>{U(ae,Q)}));else throw new Error("not support")}bresenham(N,U,k){let V=this.trimLine(new M(N,U));N=V.start(),U=V.end();let Y=N.x,X=N.y,Z=U.x,Q=U.y,ae=Z-Y,he=Q-X,re=Y,se=X,K=2*he-ae;for(;re<=Z+1;)k(re,se),K<0?(K=K+2*he,se=se):(K=K+2*he-2*ae,se=se+1,k(re,this.floor(se))),re=re+1,k(re,this.floor(se))}bresenham2(N,U,k){let V=N.x,Y=N.y,X=U.x,Q=(U.y-Y)/(X-V),ae=Math.ceil(V),he=Y+(ae-V)*Q;for(;ae<=X;)k(ae,Math.floor(he)),ae++,he+=Q}floor(N){return N<0?Math.ceil(N):Math.floor(N)}bresenham1(N,U){let k=N.start().x,V=N.start().y,Y=N.end().x,X=N.end().y,Z=Y-k,Q=X-V,ae=Math.abs(Z/Q);if((Z===0||Q===0||ae===1||ae===0)&&console.warn("BRENSENHAM"),Z>0&&Q>0&&ae>0&&ae<1){let he=k,re=V,se=2*Q-Z;for(;he<=Y+1;)console.log(1),se<0?(se=se+2*Q,re=re):(se=se+2*Q-2*Z,re=re+1),he=he+1,U(he,re)}if(Z>0&&Q>0&&ae>1){let he=k,re=V,se=2*Z-Q;for(;re<=X+1;)console.log(2),se<0?(se=se+2*Z,he=he):(se=se+2*Z-2*Q,he=he+1),re=re+1,U(he,-re)}if(Z>0&&Q<0&&ae>0&&ae<1){let he=k,re=-V,se=2*Q-Z;for(;he<=Y+1;)console.log(3),se<0?(se=se+2*Q,re=re):(se=se+2*Q-2*Z,re=re+1),he=he+1,U(he,-re)}if(Z<0&&Q>0&&ae>1){let he=k,re=-V,se=2*Z-Q;for(;re<=X+1;)console.log(4,he,re,se),se<0?(se=se+2*Z,he=he):(se=se+2*Z-2*Q,he=he+1),re=re+1,U(he,-re)}if(Z<0&&Q>0&&ae>0&&ae<1){let he=-k,re=V,se=2*Q-Z;for(;he<=Y+1;)console.log(5),se<0?(se=se+2*Q,re=re):(se=se+2*Q-2*Z,re=re+1),he=he+1,U(-he,re)}if(Z<0&&Q>0&&ae>1){let he=-k,re=V,se=2*Z-Q;for(;re<=X+1;)console.log(6),se<0?(se=se+2*Z,he=he):(se=se+2*Z-2*Q,he=he+1),re=re+1,U(-he,re)}if(Z<0&&Q<0&&ae>0&&ae<1){let he=-k,re=-V,se=2*Q-Z;for(;he<=Y+1;)console.log(7),se<0?(se=se+2*Q,re=re):(se=se+2*Q-2*Z,re=re+1),he=he+1,U(-he,-re)}if(Z<0&&Q<0&&ae>1){let he=-k,re=-V,se=2*Z-Q;for(;re<=X+1;)console.log(8),se<0?(se=se+2*Z,he=he):(se=se+2*Z-2*Q,he=he+1),re=re+1,U(-he,-re)}}}L.Bresenham=W})(v||(v={}));let D;(z=>{let F;(N=>{function G(U,k,V){let Y=Vj.Coord(),X=new B(Z(),k,0);return U.items.forEach(Q=>{Q.primitives.forEach(ae=>{let he=ae.start(),re=ae.end();Y.add(Math.floor(he.x/k),Math.floor(he.y/k)),Y.add(Math.floor(re.x/k),Math.floor(re.y/k))})}),X.getInterPoint(U,(Q,ae)=>{let he=re=>{if(re%k!==0)throw new Error("");return re/k};if(Q.x===ae.x){let re=he(Q.x),se=Math.floor(Math.min(Q.y,ae.y)/k),K=Math.floor(Math.max(Q.y,ae.y)/k);Y.add(re,se),Y.add(re,K);for(let me=se+1;me<K;me++)Y.add(re,me);re--,Y.add(re,se),Y.add(re,K);for(let me=se+1;me<K;me++)Y.add(re,me)}else if(Q.y===ae.y){let re=he(Q.y),se=Math.floor(Math.min(Q.x,ae.x)/k),K=Math.floor(Math.max(Q.x,ae.x)/k);Y.add(se,re),Y.add(K,re);for(let me=se+1;me<K;me++)Y.add(me,re);re--,Y.add(se,re),Y.add(K,re);for(let me=se+1;me<K;me++)Y.add(me,re)}}),Y.get(V);function Z(){let Q=U.bbox().extendOfSize(1e-5);return new ut(ae(Q.minX),he(Q.maxX),ae(Q.minY),he(Q.maxY));function ae(re){return Math.floor(re/k)*k}function he(re){return Math.ceil(re/k)*k}}}N.occPolygon=G;function W(U,k,V,Y){let X=new B((()=>{let ae=U.bbox().extendOfSize(1e-5);return new ut(he(ae.minX),re(ae.maxX),he(ae.minY),re(ae.maxY));function he(se){return Math.floor(se/k)*k}function re(se){return Math.ceil(se/k)*k}})(),k,0),Z=Vj.Coord(),Q=Math.ceil(V/k);return Q===0&&(Q=1),U.items.forEach(ae=>{ae.primitives.forEach(he=>{h.Occ.occPointExtend(he.start(),k,V,Y),h.Occ.occPointExtend(he.end(),k,V,Y)})}),X.getInterPoint(U,(ae,he)=>{function re(se){return se%k===0?se/k:js.error()}if(ae.x===he.x)for(let se=Math.floor((Math.min(ae.y,he.y)-V)/k),K=re(ae.x);se<=Math.floor((Math.max(ae.y,he.y)+V)/k)+V;se++)for(let me=0;me<Q;me++)Z.add(K+me,se),Z.add(K-me-1,se);else if(ae.y===he.y)for(let se=Math.floor((Math.min(ae.x,he.x)-V)/k),K=re(ae.y);se<=Math.floor((Math.max(ae.x,he.x)+V)/k);se++)for(let me=0;me<Q;me++)Z.add(se,K+me),Z.add(se,K-me-1);else throw new Error("")}),Z.get(Y)}N.occPolygonExtend=W;function L(U,k,V){}N.occPolygonType=L;class B extends Bie{getInterPoint(k,V){this.transform&&js.error(),this.gridLine.forEach((Y,X)=>{this.nowGridLine=X;for(let Z=0;Z<k.items.length;Z++)this.runPolyline(k.items[Z]);this.allGridInterPoint.forEach((Z,Q)=>{Z.sort(Y.sortCmp);for(let ae=0;ae<Z.length;ae+=2)if(this.nowGridLine===0){let he=this.interval*Q+this.bbox.minX;V(new S(he,Z[ae].y),new S(he,Z[ae+1].y))}else if(this.nowGridLine===1){let he=this.interval*Q+this.bbox.minY;V(new S(Z[ae].x,he),new S(Z[ae+1].x,he))}}),this.allGridInterPoint=[]})}}})(F=z.Gnr||(z.Gnr={}));function H(G,W,L){let B=[];this.occPolyline(G,W,(k,V)=>{B[k]||(B[k]=[]),B[k][V]||(B[k][V]=1),B[k][V]++,Ko.auto(this.demoGrid(k,V,W),ee.GREEN)});let N=G.bbox(),U=new Map;for(let k=Math.floor(N.minX/W),V=Math.ceil(N.maxX/W);k<V;k++){let Y=B[k],X=!1,Z=0;for(let Q=Math.floor(N.minY/W),ae=Math.ceil(N.maxY/W);Q<ae;Q++)for(;Y[Q]--;)if(!X)Z=Q,X=!0;else{for(let he=Z;he<=Q;he++)U.set(he,k);X=!1}}U.forEach(L)}})(D||(D={}))})(s=h.Occ||(h.Occ={}));let a;(I=>{function u(){return new RT().shapes.map(C=>{if(!C)return;let E=h.Conver.pcbShapeModelToShap(C);if(E instanceof Tl)return E})}I.getLine=u;function d(){return new RT().shapes.map(C=>{if(!C)return;let E=h.Conver.pcbShapeModelToShap(C);if(E instanceof fe)return E})}I.getPolyline=d;function p(){return Math.random()<.5}I.bool=p;function m(C,E,O){let _=[];for(;E--;)_.push(g(C,O));return _}I.numArr=m;function g(C,E){return E?Math.random()*(C.max-C.min)+C.min:Math.floor(Math.random()*(C.max-C.min)+C.min)}I.num=g;function y(C,E,O){if(O){let _=y(C,E);return Ko.auto(_,O),_}return m({min:C.minX,max:C.maxX},E).map(_=>new S(_,g({min:C.minY,max:C.maxY})))}I.point=y;function b(C,E,O){if(O){let v=b(C,E);return Ko.auto(v,O),v}let _=y(C,2*E),R=[];for(let v=0;v<_.length;v+=2)R.push(new M(_[v],_[v+1]));return R}I.line=b;function P(C,E,O,_,R){if(R){let z=P(C,E,O,_);return Ko.auto(z,R),z}let v=[],D=y(C,_),w=m(E,_),F=m({min:1,max:360},_),H=m(O,_);for(let z=0;z<_;z++)v.push(q.build3(D[z],F[z],H[z],w[z],w[z]));return v}I.arc=P;function T(C,E,O,_,R){let v=[];for(;_--;)v.push(p()?b(C,1,R)[0]:P(C,E,O,1,R)[0]);return v}I.pt=T})(a=h.Random||(h.Random={}));let l;(w=>{function u(F,H,z=1e-5){let G=[];if(!F.bbox().extendOfSize(z).isIntersect(H.bbox()))return G;return H.primitives.forEach(B=>G.push(...W(B))),G;function W(B){let N=L(B),U=N.length;if(B instanceof M)U>1&&js.error();else if(B instanceof q&&(U>2&&js.error(),un(N[0],N[1])))return[];return N}function L(B){let{interPoint:N,interPointNum:U}=w.pp(B,F);if(U===2)return N;let k=B.start(),V=B.end(),Y=w.pointOnLine(k,F),X=w.pointOnLine(V,F);if(B instanceof M){if(Y&&X)return[];if(Y){let Z=w.checkPointVector(F.start(),F.end(),V);Z===!0?N.push(k):Z===!1||js.error()}else if(X){let Z=w.checkPointVector(F.start(),F.end(),k);Z===!0?N.push(V):Z===!1||js.error()}}else if(B instanceof q){if(Y&&X&&js.error(),Y){let Z=w.checkPointVector(F.start(),F.end(),V);Math.abs(B.sweepAngle)>180?Z===!0||(Z===!1?N.push(k):js.error()):Z===!0?N.push(k):Z===!1||js.error()}else if(X){let Z=w.checkPointVector(F.start(),F.end(),k);Math.abs(B.sweepAngle)>180?Z===!0||(Z===!1?N.push(V):js.error()):Z===!0?N.push(V):Z===!1||js.error()}}else js.error();return N}}w.linePolyline=u;function d(F,H){let z=[],G=Tt(F,H);for(let W=0;W<G;W+=2)z.push(new S(Ee[W],Ee[W+1]));return{interPoint:z,interPointNum:G/2}}w.pp=d;function p(F,H){let z=F.x-H.x,G=F.y-H.y;if(z===0)return G>0?90:G<0?270:0;if(G===0)return z>0?0:z<0?180:0;let W=Math.atan(Math.abs(G)/Math.abs(z))*180/Math.PI;if(z>0){if(G>0)return W;if(G<0)return 360-W;js.error()}else if(z<0){if(G>0)return 180-W;if(G<0)return 180+W;js.error()}else js.error()}w.calculateVectorAngle=p;function m(F,H){let z=F.x-H.x,G=F.y-H.y;return z>0?G>0?1:G<0?4:1:z<0?G>0?2:(G<0,3):G>0?2:(G<0,4)}w.checkQuadrant=m;function g(F,H){return F.x<=H.maxX&&F.x>=H.minX&&F.y<=H.maxY&&F.y>=H.minY}w.pointInBBox=g;function y(F,H){let z=w.calculateVectorAngle(F,H.center);if(!T(z,H))return!1;let G=F.distance2(H.center),W=H.rx**2;if(G>W)return!1;if(G===W)return null;if(Math.abs(H.sweepAngle)<180){let L=b(H.start(),H.end(),F),B=b(H.start(),H.end(),H.center);return L===null?!0:(B===null&&js.error(),L!==B)}else return!0}w.pointInsideArcCircle=y;function b(F,H,z){let G=z.x,W=z.y,L=(F.x-G)*(H.y-W)-(F.y-W)*(H.x-G);return L>0?!0:L<0?!1:null}w.checkPointVector=b;function P(F,H,z=1e-5){return H.distance2(F)<z*z}w.pointOnLine=P;function T(F,H){let z,G,W=H.sweepAngle;if(Math.abs(W)>=360)return!0;for(W>0?(z=H.startAngle,G=z+W):(G=H.startAngle,z=G-W);F<z&&F<G;)F+=360;for(;F>z&&F>G;)F-=360;return F>=z&&F<=G}w.angleOnArc=T;function I(F,H){return F.minX>=H.minX&&F.maxX<=H.maxX&&F.minY>=H.minY&&F.maxY<=H.maxY}w.bboxInBBox=I;function C(F,H,z){return FVe(F,H)}w.pips=C;function E(F,H,z="ray"){if(!g(F,H.bbox()))return!1;let G=D.optimise(F,H);if(G!==null)return G;if(z==="ray")return D.ray(F,H);js.error()}w.pip=E;function O(F,H,z){for(let G=0;G<H.length;G++)if(G===0){if(!_(F,H[G],z))return!1}else if(_(F,H[G],z))return!1;return!0}w.pipsUseSpaceAcceleratedStructure=O;function _(F,H,z){return G()%2!==0;function G(){let W=H.end(),L=0,{x:B,y:N}=F;for(let k of z.search(new ut(F.x,H.bbox().maxX,F.y,F.y).extendOfSize(1e-5))){if(W.y>N?k.bbox().minY>N:k.bbox().maxY<=N){W=k.end();continue}if(k instanceof q&&(k.isCCW?Math.floor(k.startAngle/90)+1!==Math.ceil(k.endAngle()/90):Math.ceil(k.startAngle/90)-1!==Math.floor(k.endAngle()/90))){let V=k.startAngle,Y=k.endAngle();if(k.sweepAngle>0){let X=90;for(;X<=Y;)X>V&&(U(q.build3(k.center,V,X-V,k.rx,k.ry)),V=X),X+=90;V<Y&&U(q.build3(k.center,V,Y-V,k.rx,k.ry))}else{let X=270;for(;X>=Y;)X<V&&(U(q.build3(k.center,V,X-V,k.rx,k.ry)),V=X),X-=90;V>Y&&U(q.build3(k.center,V,Y-V,k.rx,k.ry))}}else U(k)}return L;function U(k){let V=k.start(),Y=k.end();if(W.y>N!=V.y>N&&(W.x>B?V.x>B?L+=V.y>W.y?1:-1:W.y>V.y?(W.x-B)*(V.y-N)-(W.y-N)*(V.x-B)<0&&L--:(W.x-B)*(V.y-N)-(W.y-N)*(V.x-B)>0&&L++:V.x>B&&(W.y>V.y?(W.x-B)*(V.y-N)-(W.y-N)*(V.x-B)<0&&L--:(W.x-B)*(V.y-N)-(W.y-N)*(V.x-B)>0&&L++)),V.y>N!=Y.y>N){if(V.x>B)if(Y.x>B)L+=Y.y>V.y?1:-1;else if(k instanceof M)V.y>Y.y?(V.x-B)*(Y.y-N)-(V.y-N)*(Y.x-B)<0&&L--:(V.x-B)*(Y.y-N)-(V.y-N)*(Y.x-B)>0&&L++;else if(k instanceof q){let{center:X,isCCW:Z,rx2:Q}=k,ae=(X.x-B)**2+(X.y-N)**2;V.y>Y.y?(Z?ae>Q:ae<Q)&&L--:(Z?ae<Q:ae>Q)&&L++}else throw new Error("not support!");else if(Y.x>B)if(k instanceof M)V.y>Y.y?(V.x-B)*(Y.y-N)-(V.y-N)*(Y.x-B)<0&&L--:(V.x-B)*(Y.y-N)-(V.y-N)*(Y.x-B)>0&&L++;else if(k instanceof q){let{center:X,isCCW:Z,rx2:Q}=k,ae=(X.x-B)**2+(X.y-N)**2;V.y>Y.y?(Z?ae>Q:ae<Q)&&L--:(Z?ae<Q:ae>Q)&&L++}else throw new Error("not support!")}W=Y}}}w.pipUseSpaceAcceleratedStructure=_;function R(F,H,z,G){return v.hailun(F,H,z,G)}w.pointInTriangle=R;let v;(H=>{function F(z,G,W,L){let B=G.distance1(W),N=W.distance1(L),U=L.distance1(G),k=(B+N+U)/2;return Math.sqrt(k*(k-B)*(k-N)*(k-U))}H.hailun=F})(v||(v={}));let D;(W=>{function F(L,B){return N()%2!==0;function N(){let U=B.end(),k=0,{x:V,y:Y}=L;for(let Z of B.primitives){if(U.y>Y?Z.bbox().minY>Y:Z.bbox().maxY<=Y){U=Z.end();continue}if(Z instanceof q&&(Z.isCCW?Math.floor(Z.startAngle/90)+1!==Math.ceil(Z.endAngle()/90):Math.ceil(Z.startAngle/90)-1!==Math.floor(Z.endAngle()/90))){let Q=Z.startAngle,ae=Z.endAngle();if(Z.sweepAngle>0){let he=90;for(;he<=ae;)he>Q&&(X(q.build3(Z.center,Q,he-Q,Z.rx,Z.ry)),Q=he),he+=90;Q<ae&&X(q.build3(Z.center,Q,ae-Q,Z.rx,Z.ry))}else{let he=270;for(;he>=ae;)he<Q&&(X(q.build3(Z.center,Q,he-Q,Z.rx,Z.ry)),Q=he),he-=90;Q>ae&&X(q.build3(Z.center,Q,ae-Q,Z.rx,Z.ry))}}else X(Z)}return k;function X(Z){let Q=Z.start(),ae=Z.end();if(U.y>Y!=Q.y>Y&&(U.x>V?Q.x>V?k+=Q.y>U.y?1:-1:U.y>Q.y?(U.x-V)*(Q.y-Y)-(U.y-Y)*(Q.x-V)<0&&k--:(U.x-V)*(Q.y-Y)-(U.y-Y)*(Q.x-V)>0&&k++:Q.x>V&&(U.y>Q.y?(U.x-V)*(Q.y-Y)-(U.y-Y)*(Q.x-V)<0&&k--:(U.x-V)*(Q.y-Y)-(U.y-Y)*(Q.x-V)>0&&k++)),Q.y>Y!=ae.y>Y){if(Q.x>V)if(ae.x>V)k+=ae.y>Q.y?1:-1;else if(Z instanceof M)Q.y>ae.y?(Q.x-V)*(ae.y-Y)-(Q.y-Y)*(ae.x-V)<0&&k--:(Q.x-V)*(ae.y-Y)-(Q.y-Y)*(ae.x-V)>0&&k++;else if(Z instanceof q){let{center:he,isCCW:re,rx2:se}=Z,K=(he.x-V)**2+(he.y-Y)**2;Q.y>ae.y?(re?K>se:K<se)&&k--:(re?K<se:K>se)&&k++}else throw new Error("not support!");else if(ae.x>V)if(Z instanceof M)Q.y>ae.y?(Q.x-V)*(ae.y-Y)-(Q.y-Y)*(ae.x-V)<0&&k--:(Q.x-V)*(ae.y-Y)-(Q.y-Y)*(ae.x-V)>0&&k++;else if(Z instanceof q){let{center:he,isCCW:re,rx2:se}=Z,K=(he.x-V)**2+(he.y-Y)**2;Q.y>ae.y?(re?K>se:K<se)&&k--:(re?K<se:K>se)&&k++}else throw new Error("not support!")}U=ae}}}W.ray=F;function H(L,B){if(N()){let{rx2:U,center:k}=B.primitives[0];return L.distance2(k)<U}return null;function N(){let U,k;if(B.primitives[0]instanceof q)U=B.primitives[0].center,k=B.primitives[0].rx;else return!1;for(let V=1;V<B.primitives.length;V++){let Y=B.primitives[V];if(Y instanceof q){if(ne.eq(U.x,Y.center.x)&&ne.eq(U.y,Y.center.y)&&ne.eq(k,Y.rx))continue;return!1}else return!1}return!0}}W.optimise=H;function z(L,B){let U=B.bbox(),{x:k,y:V}=L,Y=[Z=>{let Q=Z.start().x,ae=Z.start().y,he=Z.end().x,re=Z.end().y;{let se=h.Precision.equals(ae,V),K=h.Precision.equals(re,V);if(se===K)return null;let me=h.Precision.corridor(Q,k,U.maxX),Oe=h.Precision.corridor(he,k,U.maxX);return(!me||!Oe)&&!h.Precision.corridor((he-Q)/(re-ae)*(V-ae)+Q,k,U.maxX)?null:se===null?K?!0:null:K===null?se?!1:null:K}}],X=Z=>{let Q=0;return B.primitives.forEach(ae=>{if(Z.line.bbox().isIntersect(ae.bbox().extendOfSize(1e-5)))if(ae instanceof q)h.Method.cutArc2(ae).forEach(he=>{let re=Z.pos(he);re===!0?Q++:re===!1&&Q--});else{let he=Z.pos(ae);he===!0?Q++:he===!1&&Q--}}),Q};for(let Z=0;Z<1;Z++)return X({line:new M(L,new S(U.maxX,L.y)),pos:Y[0]})%2!==0}W.ray1=z;function G(L,B){let N=k=>{if(k instanceof M){let V=w.calculateVectorAngle(k.start(),L)-w.calculateVectorAngle(k.end(),L);return Math.abs(V)===180?null:(V<-180&&(V+=360),V>180&&(V-=360),V>180&&V<-180&&js.error(),V)}else if(k instanceof q){let V=w.calculateVectorAngle(k.start(),L)-w.calculateVectorAngle(k.end(),L);V<-180&&(V+=360),V>180&&(V-=360),V>180&&V<-180&&js.error();let Y=w.pointInsideArcCircle(L,k);return Y===null?null:Y?360-V:V}else js.error()},U=0;for(let k=0;k<B.primitives.length;k++){let V=N(B.primitives[k]);if(V===null)return!0;U+=V}return!ne.eq(U,0)}W.circular=G})(D||(D={}))})(l=h.Position||(h.Position={}));let c;(g=>{function u(y,b){let P=y.length;if(P===0)return null;if(P===1)return y[0];let T=y[0];for(let I=1;I<P;I++)b(T,y[I])>0&&(T=y[I]);return T}g.extremalNumb=u;function d(y,b){let P=y.length;if(P===0)return null;if(P===1)return y[0];let T=y[0];for(let I=1;I<P;I++)b(T,y[I])&&(T=y[I]);return T}g.extremalBool=d;function p(y,b,P,T,I="quickSelect"){switch(I){case"quickSelect":return m.topKQuickSelect(y,b,P,T);default:js.error()}}g.topK=p;let m;(T=>{function y(I,C,E,O){let _=I.slice();if(O>0&&O<=E-C+1){let R=P(_,C,E,(v,D)=>v<D);return R-C===O-1?_[R]:R-C>O-1?y(_,C,R-1,O):y(_,R+1,E,O-R+C-1)}return null}T.topKQuickSelect=y;function b(I,C){return this.sort(I,(E,O)=>E<=O)[C]}T.sortIndex=b;function P(I,C,E,O){let _=I[C];for(;C<E;){for(;C<E&&!O(I[E],_);)--E;for(I[C]=I[E];C<E&&O(I[C],_);)++C;I[E]=I[C]}return I[C]=_,C}})(m||(m={}))})(c=h.Top||(h.Top={}))})(Mu||(Mu={}));var Gj;(t=>{function o(e){if(e instanceof fe)return new hs([e]);if(e instanceof hs)return e;if(e instanceof Gt)return new hs(e.items);js.error()}t.getPolygon=o})(Gj||(Gj={}));var js;(a=>{function o(l,c=!0){if(c){throw console.log(l||""),new Error;return}throw new Error(l||"")}a.error=o;function t(){return typeof window<"u"?window._MSG_BUS_=window._MSG_BUS_||new Uj.MessageBus:new Uj.WorkerMessageBridge(new Uj.MessageBus,self)}a.getBus=t;function e(l){let c=performance.now();for(;performance.now()-c<l;);}a.sleep=e;function r(){return new i.Nor}a.Table=r;let i;(c=>{class l{constructor(){this.tab={}}add(u,d){this.tab[u]=d}print(){console.table(this.tab)}}c.Nor=l})(i||(i={}));let n;(c=>{class l{constructor(){this.scal=new Map;this.scal1=new Map}fun(u,d){this.mark(u);let p=d();return this.mark(u),p}mark(u){return this.scal.get(u)===void 0?this.scal.set(u,performance.now()):this.scal1.set(u,performance.now()-this.scal.get(u)),this}cout(){let u=r();this.scal1.forEach((d,p)=>u.add(p,{v:d})),u.print()}}c.Nor=l})(n||(n={}));function s(){return new n.Nor}a.Clok=s})(js||(js={}));var Ml=te.getInstance(),$S=class{constructor(){this.constraintMap=new Lie;this.forceModelPairClearanceMap=new Map;this.ruleItemCache=new Map;this.getSafeClearance=(t,e,r,i)=>{let n=t.getClearance(e,r,i);return!sn.getInstance().checkSameNet&&ne.eq(n,0)?-1:n}}getRuleItem(t,e=!1){let r=t instanceof ki,i=r?t.globalIndex:t.id;if(this.ruleItemCache.has(i))return this.ruleItemCache.get(i);let n=r?_a(t):t;return e&&(n.shapeType=12),this.ruleItemCache.set(i+e,n),n}getShape2Clearance(t,e,r,i,n,s){if(sn.getInstance().useForceModelPairClearance){let d=this.getModelPairClearance(t,e,n,i);if(d!==void 0){let p=Ml.getDefaultSafeSpacing();return p==null&&(Ml.correctDefault(),p=Ml.getDefaultSafeSpacing()),{rule:p,ruleType:"Safe Spacing",clearance:d,net:void 0}}}let a=this.getRuleItem(t,0==i||2==i),l=this.getRuleItem(e,1==i||2==i),c=s!=null?s:this.determineRuleType(a,l,i),h=this.generateConstraints(c,a,l,r),u;switch(c){case"safe":u=this.getSafeRuleInfos(a,l,h,n);break;case"other":u=this.getOtherRuleInfos(a,l,h);break;case"creepage":u=this.getCreepageRuleInfos(a,l,h,n);break;case"diff":if(u=this.getDiffRuleInfos(a,l,h,n),u!=null)return u;h=this.generateConstraints("safe",a,l,r),u=this.getSafeRuleInfos(a,l,h,n);break}return u}determineRuleType(t,e,r){return r==2||[t.shapeType,e.shapeType].includes(16)?"other":t.shapeType===0&&e.shapeType===0?"diff":"safe"}generateConstraints(t,e,r,i,n,s){let a=[e,r],l=s,c=(d,p)=>p.clearance>d.clearance;switch(t){case"safe":let d=e.shapeType===14||r.shapeType===14,p=e.shapeType===13||r.shapeType===13;(e.shapeType!==0||r.shapeType!==0||oi.getShape2NetDiff(e,r)==null)&&(d?t="plane":p&&(t="copper")),l=(m=>this.getSafeClearance(m,e.shapeType,r.shapeType,n));break;case"other":a=a.filter(m=>m.shapeType===16||m.shapeType==2||m.shapeType==12),l=(m=>this.getOtherClearance(e,r,m));break;case"diff":l=(m=>this.getDiffClearance(m,n));break;case"creepage":l=(m=>this.getCreepageClearance(e,r,m)),c=(m,g)=>g.clearance<m.clearance;break}if(l==null)return null;let h=this.getConstraintRuleByCache2(a,t,i).map(d=>({rule:d,clearance:l(d)})),u=Mu.Top.extremalBool(h,c);return h=null,u?u.rule:null}getRuleForDiffWidth(t,e){let r=this.getRuleItem(t),i=oi.getShapeNetDiff(r);if(i==null)return null;let n=this.getConstraintRuleByCache(r,"diff",e);if(n==null){let s=i.differentialPhysics;n=Ml.getDifferentialPhysics(s)||null}return n}getRuleForTrackWidth(t,e){let r=this.getRuleItem(t),i=this.getConstraintRuleByCache(r,"track",e);if(i==null){let n=Ml.getNet(r.net);n!=null?i=Ml.getTrackPhysics(n.trackPhysics)||null:i=Ml.getDefaultTrackPhysics()||null}return i}getRuleForViaRadius(t,e){let r=this.getRuleItem(t),i=this.getConstraintRuleByCache(r,"radius",e);if(i==null){if(r.viaName&&r.viaName!==""){let s=te.getInstance().getDefaultBlindPhysics();if(s){let a=s.getBlindVia(r.viaName);if(a&&a.viaSizeRule!=="")return te.getInstance().getRadiusPhysicsByName(a.viaSizeRule)||null}}let n=Ml.getNet(r.net);n!=null?i=Ml.getRadiusPhysics(n.radiusPhysics)||null:i=Ml.getDefaultRadiusPhysics()||null}return i}getRuleForBlind(t){let e=Ml.getNet(t.net),r;return e!=null?r=Ml.getBlindPhysics(e.blindViaPhysics):r=Ml.getDefaultBlindPhysics(),r}getOtherClearance(t,e,r){let i=0;return[t.shapeType,e.shapeType].includes(2)?i=r.thru2SmdClearance:[t.shapeType,e.shapeType].includes(12)?i=r.holeClearance:i=r.deviceClearance,!sn.getInstance().checkSameNet&&ne.eq(i,0)?-1:i}getCreepageClearance(t,e,r,i){let n=r.creepageDistance;return!t.net||!e.net||t.net===e.net||!sn.getInstance().checkSameNet&&ne.eq(n,0)?-1:n}getDiffClearance(t,e){let r=t.getDifferentialPairSpacingMin(e);return!sn.getInstance().checkSameNet&&ne.eq(r,0)?-1:r}getDiffRuleInfos(t,e,r,i){let n=oi.getShape2NetDiff(t,e),s=l=>this.getDiffClearance(l,i);if(n==null)return;let a=r;if(a==null&&t.net!=""&&e.net!=""){if(Ml.getRule4Order(t,e,"BetweenNetRule",0,i).length>0)return;let c=n.differentialPhysics;a=Ml.getDifferentialPhysics(c)}if(a){let l=s(a);return{rule:a,ruleType:"Differential Pair Error",clearance:l}}}getOtherRuleInfos(t,e,r){let i=a=>this.getOtherClearance(t,e,a),n=r;n==null&&(n=Ml.getDefaultOtherSpacing(),n==null&&(Ml.correctDefault(),n=Ml.getDefaultOtherSpacing()));let s=i(n);return(t.shapeType===15||e.shapeType===15)&&(s=0),{rule:n,ruleType:"Other Spacing",clearance:s}}getCreepageRuleInfos(t,e,r,i,n){var c;let s=n||(h=>this.getCreepageClearance(t,e,h,i)),a=r;if(a==null){let h=["BetweenNetRule","NetRule"];for(let u of h){let d=Ml.getRule4Order(t,e,u,2,i);if(d.length>0){let p=d.map(m=>({rule:m,clearance:s(m)}));a=(c=Mu.Top.extremalBool(p,(m,g)=>g.clearance<m.clearance))==null?void 0:c.rule,p=null;break}}}a==null&&(a=Ml.getDefaultCreepageSpacing(),a==null&&(Ml.correctDefault(),a=Ml.getDefaultCreepageSpacing()));let l=s(a);return(t.shapeType===15||e.shapeType===15)&&(l=0),{rule:a,ruleType:"Creepage Distance",clearance:l}}isBridgeCopperRuleItem(t){return t&&"isBridgingCopper"in t&&t.isBridgingCopper&&Array.isArray(t.nets)}getSafeRuleInfos(t,e,r,i,n){var h;let s=n||(u=>this.getSafeClearance(u,t.shapeType,e.shapeType,i)),a=r,l="";if(a==null){let u=t.shapeType===14||e.shapeType===14,d=t.shapeType===13||e.shapeType===13,p=["BetweenNetRule","NetRule"],m=["BetweenNetRule","CustomPlaneRule","NetRule"],g=u||d?m:p,y=this.isBridgeCopperRuleItem(t),b=this.isBridgeCopperRuleItem(e),P=y?t.nets.length==0?[""]:t.nets:[t.net],T=b?e.nets.length==0?[""]:e.nets:[e.net],I=new Set,C=[];if(y&&b){for(let E of P)for(let O of T){if(E===O||E==null||O==null)continue;let _=Ml.getRule4Order(t,e,"NetRule",0,i,[E,O]);_.length>0&&C.push(..._.map(R=>({rule:R,net:E})))}if(C.length>0){let E=C.map(_=>({rule:_.rule,clearance:s(_.rule),net:_.net})),O=Mu.Top.extremalBool(E,(_,R)=>R.clearance>_.clearance);E=null,a=O.rule,l=O.net}}else if(y||b){for(let E of g){for(let O of P)for(let _ of T){if(O===_||O==null||_==null)continue;let R=`${O}-${_}`,v=`${_}-${O}`;if(!I.has(R)){let D=Ml.getRule4Order(t,e,E,0,i,[O,_]);if(D.length>0){let w=y?O:_;C.push(...D.map(F=>({rule:F,net:w}))),["BetweenNetRule","CustomPlaneRule"].includes(E)&&(I.add(R),I.add(v))}}}if(I.size>2&&I.size/2===P.length*T.length)break}if(C.length>0){let E=C.map(_=>({rule:_.rule,clearance:s(_.rule),net:_.net})),O=Mu.Top.extremalBool(E,(_,R)=>R.clearance>_.clearance);E=null,a=O.rule,l=O.net}}else for(let E of g){let O=Ml.getRule4Order(t,e,E,0,i);if(O.length>0){let _=O.map(R=>({rule:R,clearance:s(R)}));a=(h=Mu.Top.extremalBool(_,(R,v)=>v.clearance>R.clearance))==null?void 0:h.rule,_=null;break}}}a==null&&(a=Ml.getDefaultSafeSpacing(),a==null&&(Ml.correctDefault(),a=Ml.getDefaultSafeSpacing()));let c=s(a);return(t.shapeType===15||e.shapeType===15)&&(c=0),{rule:a,ruleType:"Safe Spacing",clearance:c,net:l||void 0}}getConstraintRuleByCache2(t,e,r){let i=[],n=["copper","plane"].includes(e),s=t.every(l=>l.shapeType===13),a=n?t.find(l=>[13,14].includes(l.shapeType)):null;for(let l of t){a=a||l;let c=this.getConstraintRuleByCache(l,e,r,a||l,s);c&&i.push(c)}return i}getConstraintRuleByCache(t,e,r,i,n=!1){if(!r){let s=n?t.regionId:t.id,a=this.constraintMap._constraintMap[s];r=a?Array.from(a):void 0}return r!=null&&r.length?this.getConstraintRule(r,e,i!=null?i:t):null}getConstraintRule(t,e,r){if(!t.length)return null;let i=r&&[12,11].includes(r.layerId);t=t.filter(u=>{if(u instanceof lr)return u.layerId==12||i||!i&&u.layerId==(r==null?void 0:r.layerId)});let n=[],a=Bj(t.map(u=>{if(u instanceof lr){let d=`${ur}${u.number}`;return n.push({sortValue:d,originalValue:u.globalIndex}),d}else return n.push({sortValue:u,originalValue:u}),u})).map(u=>n.find(d=>d.sortValue===u).originalValue)[0],l=Ml.getRegion(a);if(!l)return null;let c=t.find(u=>u instanceof lr&&u.globalIndex===a);if(r&&c&&c.layerId!==12&&!i&&r.layerId!==c.layerId)return null;let h=null;switch(e){case"safe":l.safeClearance&&(h=Ml.getSafeSpacing(l.safeClearance)||null);break;case"other":l.otherClearance&&(h=Ml.getOtherSpacing(l.otherClearance)||null);break;case"creepage":l.creepageClearance&&(h=Ml.getCreepageSpacing(l.creepageClearance)||null);break;case"track":l.track&&(h=Ml.getTrackPhysics(l.track)||null);break;case"diff":l.diff&&(h=Ml.getDifferentialPhysics(l.diff)||null);break;case"radius":l.radius&&(h=Ml.getRadiusPhysics(l.radius)||null);break;case"copper":l.safeCopperPlane&&(h=Ml.getSafeSpacing(l.safeCopperPlane)||null),!h&&l.safeClearance&&(h=Ml.getSafeSpacing(l.safeClearance)||null);break;case"plane":l.safeInnerPlane&&(h=Ml.getSafeSpacing(l.safeInnerPlane)||null),!h&&l.safeClearance&&(h=Ml.getSafeSpacing(l.safeClearance)||null);break}return h}setModelPairClearance(t,e,r,i,n){if(sn.getInstance().useForceModelPairClearance&&this.forceModelPairClearanceMap){let s=this.generateModelPairKey(e,r,i,n);this.forceModelPairClearanceMap.set(s,t)}}getModelPairClearance(t,e,r,i){if(sn.getInstance().useForceModelPairClearance&&this.forceModelPairClearanceMap){let n=this.generateModelPairKey(t,e,r,i);return this.forceModelPairClearanceMap.get(n)}}generateModelPairKey(t,e,r,i){let n,s=oi.isSingleLayerShape(t),a=oi.isSingleLayerShape(e);return!s&&a?(i===0?i=1:i===1&&(i=0),n=`${e.globalIndex}-${t.globalIndex}-${r}`):n=`${t.globalIndex}-${e.globalIndex}-${r}`,i?`${n}-${i}`:n}};var l3=class{getMaxClearance(t){return Math.max(te.getInstance().getMaxSafe(t),te.getInstance().getItemMaxClearance(12))}getSafeClearance(t,e,r,i){let n=this.getShapeType(t,r),s=this.getShapeType(e,r),a=t.shape.net,l=e.shape.net,c=i!=null?[i]:[t.regionId,e.regionId];return this.getSafeClearance2(n,s,a,l,c)}getSafeClearance1(t,e,r,i,n){let s=this.getShapeType(t,r),a=this.getShapeType(e,i),l=t.shape.net,c=e.shape.net,h=n!=null?[n]:[t.regionId,e.regionId];return s==12&&a==12?this.getHoleClearance(h):this.getSafeClearance2(s,a,l,c,h)}getSafeClearance2(t,e,r,i,n=[],s){let a=Bj(n)[0],l=t==0&&e==0&&this.isDiffPair(r,i);if(a!=null){let m=l?"diff":"safe",g=new $S().getConstraintRule(n,m);if(g instanceof Hb)return g.getDifferentialPairSpacingMin(s);if(g instanceof HI)return g.getClearance(t,e,s)}let c=this.getBetweenNetRule(t,e,r,i,s);if(c!=null)return c.getClearance(t,e,s);if(l){let m=this.getDiffPair(r);return te.getInstance().getDifferentialPhysics(m.differentialPhysics).getDifferentialPairSpacingMin(s)}let h=te.getInstance().getSafeSpacingByNet(r,Wx(t,e)),u=te.getInstance().getSafeSpacingByNet(i,Wx(t,e,!0)),d=[h,u],p=-1;for(let m of d){let g=m.getClearance(t,e,s);p=Math.max(p,g)}if(p!=-1)return p;for(let m of d){let g=m.getClearance(t,e,s);p=Math.max(p,g)}return p}getHoleClearance(t=[]){if(Bj(t)[0]!=null){let r=new $S().getConstraintRule(t,"other");if(r instanceof Wb)return r.holeClearance}else return te.getInstance().getDefaultOtherSpacing().holeClearance}isDiffPair(t,e){let r=te.getInstance().getNet(t);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential;if(t!=e&&i.hasNet(t)&&i.hasNet(e))return!0}return!1}getDiffPair(t){let e=te.getInstance().getNet(t);return e!=null&&e.netDifferential!=null?e.netDifferential:null}getBetweenNetRule(t,e,r,i,n){let s=te.getInstance().getBetweenNetRuleByNet(t,e,r,i,n);return s!=null?te.getInstance().getSafeSpacing(s.name):null}getShapeType(t,e){switch(t.type){case"Track":return 0;case"ArcTrack":return 0;case"Region":return 6;case"BoxShape":return 10;case"Line":return 9;case"Prohibit":return 15;case"Slot":return 8;case"Via":return e.equals($r.MULTI)?12:5;case"BlindVia":return e.equals($r.MULTI)?12:5;case"Pad":return t.layerId==12?e.equals($r.MULTI)?12:2:1;case"Outline":return 11}}};var p3t={ADAPT_ALL:{name:"Fit All in Window",cmd:"ADAPT_ALL",tips:""},ADAPT_BOARDOUTLINE:{name:"Fit Board Outline View",cmd:"ADAPT_BOARDOUTLINE",tips:""},ADAPT_SELECTED:{name:"Fit Selection View",cmd:"ADAPT_SELECTED",tips:""}},UVe=p3t;var f3t={ADDWITH_ROUTING:{name:"Add Routing",cmd:"ADDWITH_ROUTING",tips:""},ADDWITH_VIA:{name:"Add Via",cmd:"ADDWITH_VIA",tips:""},ADDVIA_FENCE:{name:"Add Via Fence...",cmd:"ADDVIA_FENCE",tips:""},ADDWITH_TESTPOINTER:{name:"Add Test Point",cmd:"ADDWITH_TESTPOINTER",tips:""},ADDWITH_TEARS:{name:"Add Teardrops...",cmd:"ADDWITH_TEARS",tips:""},ADDWITH_NODE:{name:"Add Node",cmd:"ADDWITH_NODE",tips:""},ADDWITH_ARC:{name:"Add Arc",cmd:"ADDWITH_ARC",tips:""},ADDWITH_TRACK:{name:"Add Track",cmd:"ADDWITH_TRACK",tips:""},ADDWITH_EQUALLENGTHTUNING:{name:"Equal Length Tunning",cmd:"ADDWITH_EQUALLENGTHTUNING",tips:""},ADD_SOLDER_MASK:{name:"Add Solder Mask Region",cmd:"ADD_SOLDER_MASK",tips:""}},HVe=f3t;var m3t={ALIGNMENT:{name:"Alignment",cmd:"ALIGNMENT",tips:""},align_top:{name:"Align Top",cmd:"align_top",tips:""},align_vertical_center:{name:"Align Vertical Centers",cmd:"align_vertical_center",tips:""},align_bottom:{name:"Align Bottom",cmd:"align_bottom",tips:""},align_left:{name:"Align Left",cmd:"align_left",tips:""},align_horizontal_center:{name:"Align Horizontal Centers",cmd:"align_horizontal_center",tips:""},align_right:{name:"Align Right",cmd:"align_right",tips:""},align_grid:{name:"Align Grid",cmd:"align_grid",tips:""}},WVe=m3t;var g3t={COMBINATION:{name:"Group",cmd:"COMBINATION",tips:""},COMBINATION_SELECT:{name:"Group Selected",cmd:"COMBINATION_SELECT",tips:""},COMBINATION_JOIN:{name:"Join Group",cmd:"COMBINATION_JOIN",tips:""},REUSE_LAYOUT_ROUTE:{name:"Reuse Layout Route",cmd:"REUSE_LAYOUT_ROUTE",tips:""},COMBINATION_CANCEL:{name:"Ungroup",cmd:"COMBINATION_CANCEL",tips:""},COMBINATION_MOVE_OUT:{name:"Remove From Group",cmd:"COMBINATION_MOVE_OUT",tips:""}},zVe=g3t;var y3t={RAISE_PRIORITY:{name:"Raise Priority",cmd:"RAISE_PRIORITY",tips:""},LOWER_PRIORITY:{name:"Lower Priority",cmd:"LOWER_PRIORITY",tips:""},COPPER_AREA:{name:"Copper Region",cmd:"COPPER_AREA",tips:""},HIDE_SELECTED_COPPER_FILLS:{name:"Hide Selected Copper Fills",cmd:"HIDE_SELECTED_COPPER_FILLS",tips:""},SHOW_SELECTED_COPPER_FILLS:{name:"Show Selected Copper Fills",cmd:"SHOW_SELECTED_COPPER_FILLS",tips:""},HIDE_COPPER_FILLS:{name:"Hide All Copper",cmd:"HIDE_COPPER_FILLS",tips:""},SHOW_COPPER_FILLS:{name:"Show All Copper",cmd:"SHOW_COPPER_FILLS",tips:""},REBUILD_SELECTED:{name:"Rebuild Selected",cmd:"REBUILD_SELECTED",tips:""},REBUILD_ALL:{name:"Rebuild All",cmd:"REBUILD_ALL",tips:""},COPPER_MANAGER:{name:"Copper Manager...",cmd:"COPPER_MANAGER",tips:""}},YVe=y3t;var b3t={DISTRIBUTION:{name:"Distribute",cmd:"DISTRIBUTION",tips:""},distribute_horizontal_equidistant:{name:"Distribute Horizontally",cmd:"distribute_horizontal_equidistant",tips:""},distribute_vertical_equidistant:{name:"Distribute Vertically",cmd:"distribute_vertical_equidistant",tips:""},distribute_left_side_edge_equidistant:{name:"Distribute Left Edges Equidistantly",cmd:"distribute_left_side_edge_equidistant",tips:""},distribute_top_side_edge_equidistant:{name:"Distribute Top Edges Equidistantly",cmd:"distribute_top_side_edge_equidistant",tips:""},distribute_horizontal_by_center_distance:{name:"Distribute Horizontally by Center Distance...",cmd:"distribute_horizontal_by_center_distance",tips:""},distribute_vertical_by_center_distance:{name:"Distribute Vertically by Center Distance...",cmd:"distribute_vertical_by_center_distance",tips:""},distribute_horizontal_by_edges_distance:{name:"Distribute Horizontally by Edges Distance...",cmd:"distribute_horizontal_by_edges_distance",tips:""},distribute_vertical_by_edges_distance:{name:"Distribute Vertically by Edges Distance...",cmd:"distribute_vertical_by_edges_distance",tips:""},distribute:{name:"Distribute Array",cmd:"distribute",tips:""},component_distribute_by_region:{name:"Component Distribute By Region",cmd:"component_distribute_by_region",tips:""}},jVe=b3t;var P3t={ONLY_SELECT:{name:"Apply only selected components",cmd:"ONLY_SELECT",tips:""},CURRENT_PCB:{name:"Apply current PCB",cmd:"CURRENT_PCB",tips:""},ALL_PROJECT:{name:"Apply the whole project",cmd:"ALL_PROJECT",tips:""}},XVe=P3t;var T3t={FLIP:{name:"Flip",cmd:"FLIP",tips:""},FLIP_LEFTANDRIGHT:{name:"Flip Right and Left",cmd:"FLIP_LEFTANDRIGHT",tips:""},FLIP_UPANDDOWN:{name:"Flip Up and Down",cmd:"FLIP_UPANDDOWN",tips:""},FLIP_LEFTANDRIGHT_BY_REFER_POINT:{name:"Flip Right and Left by Reference Point",cmd:"FLIP_LEFTANDRIGHT_BY_REFER_POINT",tips:""},FLIP_UPANDDOWN_BY_REFER_POINT:{name:"Flip Up and Down by Reference Point",cmd:"FLIP_UPANDDOWN_BY_REFER_POINT",tips:""}},qVe=T3t;var I3t={GRID:{name:"Grid Size",cmd:"GRID",tips:""},SNAP_SIZE:{name:"Snap Size",cmd:"SNAP_SIZE",tips:""},GRIDTYPE:{name:"Grid Type",cmd:"GRIDTYPE",tips:""},GRID_1MIL:{name:"1mil",cmd:"GRID_1MIL",tips:""},GRID_5MIL:{name:"5mil",cmd:"GRID_5MIL",tips:""},GRID_10MIL:{name:"10mil",cmd:"GRID_10MIL",tips:""},GRID_20MIL:{name:"20mil",cmd:"GRID_20MIL",tips:""},GRID_25MIL:{name:"25mil",cmd:"GRID_25MIL",tips:""},GRID_50MIL:{name:"50mil",cmd:"GRID_50MIL",tips:""},GRID_0_025MM:{name:"0.025mm",cmd:"GRID_0_025MM",tips:""},GRID_0_1MM:{name:"0.100mm",cmd:"GRID_0_1MM",tips:""},GRID_0_25MM:{name:"0.250mm",cmd:"GRID_0_25MM",tips:""},GRID_0_5MM:{name:"0.500mm",cmd:"GRID_0_5MM",tips:""},GRID_1_0MM:{name:"1.000mm",cmd:"GRID_1_0MM",tips:""},GRID_CUSTOM:{name:"Custom: x(5mil), y(5mil)",cmd:"GRID_CUSTOM",tips:""},GRID_SNAP_KEEP_RATIO:{name:"Grid/Snap Keep Ratio",cmd:"GRID_SNAP_KEEP_RATIO",tips:""},GRID_SETTING:{name:"Common Grid/Snap Setting...",cmd:"GRID_SETTING",tips:""},GRID_RANGE_SETTING:{name:"Grid Range Setting(Polar coordinate)...",cmd:"GRID_RANGE_SETTING",tips:""},GRID_COORDINATE:{name:"Cartesian Coordinate System",cmd:"GRID_COORDINATE",tips:""},POLAR_COORDINATE:{name:"Polar Coordinate System",cmd:"POLAR_COORDINATE",tips:""},GRID_TYPE_DOT:{name:"Grid Dot",cmd:"GRID_TYPE_DOT",tips:""},GRID_TYPE_GRID:{name:"Grid",cmd:"GRID_TYPE_GRID",tips:""},GRID_TYPE_NONE:{name:"None",cmd:"GRID_TYPE_NONE",tips:""}},$Ve=I3t;var C3t={HIGHLIGHT_AND_UNHIGHLIGHT:{name:"Highlight/Unhighlight",cmd:"HIGHLIGHT_AND_UNHIGHLIGHT",tips:""},HIGHLIGHT_CANCELALL:{name:"Unhighlight All",cmd:"HIGHLIGHT_CANCELALL",tips:""},HIGHLIGHT_CANCEL:{name:"Unhighlight",cmd:"HIGHLIGHT_CANCEL",tips:""},HIGHLIGHT_CANCEL_NET:{name:"Unhighlight Net",cmd:"HIGHLIGHT_CANCEL_NET",tips:""},HIGHLIGHT_CANCEL_COMPONENT:{name:"Unhighlight Component",cmd:"HIGHLIGHT_CANCEL_COMPONENT",tips:""},HIGHLIGHT_CANCEL_SELECTED_OBJECTS:{name:"Unhighlight Selected",cmd:"HIGHLIGHT_CANCEL_SELECTED_OBJECTS",tips:""},HIGHLIGHT:{name:"Highlight",cmd:"HIGHLIGHT",tips:""},HIGHLIGHT_NET:{name:"Highlight Net",cmd:"HIGHLIGHT_NET",tips:""},HIGHLIGHT_COMPONENT:{name:"Highlight Component",cmd:"HIGHLIGHT_COMPONENT",tips:""},HIGHLIGHT_SELECTED_OBJECTS:{name:"Highlight Selected",cmd:"HIGHLIGHT_SELECTED_OBJECTS",tips:""}},KVe=C3t;var S3t={LOCKED:{name:"Locked",cmd:"LOCKED",tips:""},LOCKED_CANCEL:{name:"Unlock",cmd:"LOCKED_CANCEL",tips:""}},ZVe=S3t;var E3t={ADD_NODE:{name:"Add Node",cmd:"ADD_NODE",tips:""},EDIT_NODE:{name:"Edit Node",cmd:"EDIT_NODE",tips:""},MOVE_NODE:{name:"Move Node",cmd:"MOVE_NODE",tips:""},DELETE_NODE:{name:"Delete Node",cmd:"DELETE_NODE",tips:""}},JVe=E3t;var O3t={OFFSET:{name:"Offset",cmd:"OFFSET",tips:""},OFFSET_RELATIVE:{name:"Relative Offset...",cmd:"OFFSET_RELATIVE",tips:""},OFFSET_ABSOLUTE:{name:"Absolute Offset...",cmd:"OFFSET_ABSOLUTE",tips:""}},QVe=O3t;var A3t={DEVICE_EDIT:{name:"Edit Device...",cmd:"DEVICE_EDIT",tips:""},EASY_DEVICE_EDIT:{name:"Edit Device",cmd:"DEVICE_EDIT",tips:""},SAVE_TO_LIBRARY:{name:"Save to The Library...",cmd:"SAVE_TO_LIBRARY",tips:""},UPDATE_COMPONENT:{name:"Update Project Library",cmd:"UPDATE_COMPONENT",tips:""},PACKAGE_EDIT_IN_PCB:{name:"Edit Footprint",cmd:"PACKAGE_EDIT_IN_PCB",tips:""},PACKAGE_EDIT:{name:"Edit Footprint",cmd:"PACKAGE_EDIT",tips:""},PACKAGE_REPLACE:{name:"Replace Footprint",cmd:"PACKAGE_REPLACE",tips:""},RECOVER_FOOTPRINT:{name:"Revert to Footprint Template",cmd:"RECOVER_FOOTPRINT",tips:""},PACKAGE_ATTR:{name:"Footprint Property",cmd:"PACKAGE_ATTR",tips:""}},eGe=A3t;var _3t={PREVIOUS_PAGE:{name:"Previous Page",cmd:"PREVIOUS_PAGE",tips:""},NEXT_PAGE:{name:"Next Page",cmd:"NEXT_PAGE",tips:""},GOTO_PAGE:{name:"Goto Page",cmd:"GOTO_PAGE",tips:""}},tGe=_3t;var v3t={Default:{name:"Default",cmd:"Default",tips:""},"Only Component":{name:"Only Component",cmd:"Only Component",tips:""},"Only Component Attribute":{name:"Only Component Attribute",cmd:"Only Component Attribute",tips:""},"Only Track":{name:"Only Track",cmd:"Only Track",tips:""},"Only Via":{name:"Only Via",cmd:"Only Via",tips:""},"Only Pad Pair":{name:"Only Pad Pair",cmd:"Only Pad Pair",tips:""},"Only Net":{name:"Only Net",cmd:"Only Net",tips:""},"Only Group":{name:"Only Group",cmd:"Only Group",tips:""},"Only Pad":{name:"Only Pad",cmd:"Only Pad",tips:""},"Only Line":{name:"Only Line",cmd:"Only Line",tips:""},PRIMITIV_COMPONENT:{name:"Component",cmd:"PRIMITIV_COMPONENT",tips:""},PRIMITIV_DEVICE_ATTR:{name:"Component-ATTR",cmd:"PRIMITIV_DEVICE_ATTR",tips:""},PRIMITIV_PAD:{name:"Pad",cmd:"PRIMITIV_PAD",tips:""},PAD_NUMBER:{name:"Pad Number",cmd:"PAD_NUMBER",tips:""},PRIMITIV_TRACK:{name:"Track",cmd:"PRIMITIV_TRACK",tips:""},PRIMITIV_PADPAIR:{name:"Pad Pairs",cmd:"PRIMITIV_PADPAIR",tips:""},PRIMITIV_SUTUREVIA:{name:"Suture Via",cmd:"PRIMITIV_SUTUREVIA",tips:""},PRIMITIV_2DLINE:{name:"Outline",cmd:"PRIMITIV_2DLINE",tips:""},PRIMITIV_VIA:{name:"Via",cmd:"PRIMITIV_VIA",tips:""},SECOND_COMBINATION:{name:"Group",cmd:"SECOND_COMBINATION",tips:""},PRIMITIV_BOARD:{name:"Board Outline",cmd:"PRIMITIV_BOARD",tips:""},PRIMITIV_SLOT:{name:"Slot Region",cmd:"PRIMITIV_SLOT",tips:""},PRIMITIV_POUR:{name:"Copper Region",cmd:"PRIMITIV_POUR",tips:""},PRIMITIV_ALL:{name:"All",cmd:"PRIMITIV_ALL",tips:""},MORE:{name:"More...",cmd:"MORE",tips:""}},rGe=v3t;var x3t={PLACE_VIA:{name:"Place Via",cmd:"PLACE_VIA",tips:""},PLACE_BURIEDHOLE:{name:"Place Blind/Buried Via",cmd:"PLACE_BURIEDHOLE",tips:""}},iGe=x3t;var R3t={RATLINES_SHOW:{name:"Show Ratline",cmd:"RATLINES_SHOW",tips:""},RATLINES_HIDE:{name:"Hide Ratline",cmd:"RATLINES_HIDE",tips:""}},nGe=R3t;var D3t={ROTATE:{name:"Rotate",cmd:"ROTATE",tips:""},rotate_left:{name:"Rotate Left",cmd:"rotate_left",tips:""},rotate_right:{name:"Rotate Right",cmd:"rotate_right",tips:""},rotate_reference_point:{name:"Rotate By Reference Point",cmd:"rotate_reference_point",tips:""}},oGe=D3t;var w3t={SETUP_WINDOWINGAREA:{name:"Add Solder Mask Region",cmd:"SETUP_WINDOWINGAREA",tips:""}},sGe=w3t;var L3t={STRETCHING:{name:"Stretch",cmd:"STRETCHING",tips:""},STRETCHING_PUSHAWAY:{name:"Push and Stretch",cmd:"STRETCHING_PUSHAWAY",tips:""}},aGe=L3t;var M3t={SYMBOL_UPDATE:{name:"Update Symbol",cmd:"SYMBOL_UPDATE",tips:""},SYMBOL_EDIT:{name:"Edit Symbol in Library",cmd:"SYMBOL_EDIT",tips:""},SYMBOL_REPLACE:{name:"Replace Symbol",cmd:"SYMBOL_REPLACE",tips:""}},lGe=M3t;var N3t={TURNOVER:{name:"Flip to Opposite Side",cmd:"TURNOVER",tips:""}},cGe=N3t;var k3t={VIA_SIZE:{name:"Via Size",cmd:"VIA_SIZE",tips:""},VIA_SIZE_FOLLOWRULES:{name:"Follow Rule",cmd:"VIA_SIZE_FOLLOWRULES",tips:""},VIA_SIZE_RULESSETTING:{name:"Rule Setting...",cmd:"VIA_SIZE_RULESSETTING",tips:""},VIA_SIZE_COMMONLY_SETTING:{name:"Common Size Setting...",cmd:"VIA_SIZE_COMMONLY_SETTING",tips:""},VIA_SIZE_INPUT:{name:"Enter Via Size...",cmd:"VIA_SIZE_INPUT",tips:""},VIA_TYPE:{name:"Via Type",cmd:"VIA_TYPE",tips:""},VIA_TYPE_THROUGH_VIA:{name:"Through Via",cmd:"VIA_TYPE_THROUGH_VIA",tips:""},VIA_TYPE_RULESSETTING:{name:"Via Type Setting...",cmd:"VIA_TYPE_RULESSETTING",tips:""}},hGe=k3t;var B3t={WIRING_AUTO:{name:"Auto Route",cmd:"WIRING_AUTO",tips:""},WIRING_AUTO_CONNECT:{name:"Connection",cmd:"WIRING_AUTO_CONNECT",tips:""},WIRING_AUTO_NET:{name:"Net",cmd:"WIRING_AUTO_NET",tips:""},WIRING_AUTO_ALL:{name:"All",cmd:"WIRING_AUTO_ALL",tips:""},WIRING_CLEAR:{name:"Unroute",cmd:"WIRING_CLEAR",tips:""},WIRING_CLEAR_CONNECT:{name:"Connection",cmd:"WIRING_CLEAR_CONNECT",tips:""},WIRING_CLEAR_NET:{name:"Net",cmd:"WIRING_CLEAR_NET",tips:""},WIRING_CLEAR_ALL:{name:"All",cmd:"WIRING_CLEAR_ALL",tips:""},WIRING_CORNER:{name:"Routing Corner",cmd:"WIRING_CORNER",tips:""},WIRING_CORNER_LINE45:{name:"Line 45\xB0",cmd:"WIRING_CORNER_LINE45",tips:""},WIRING_CORNER_LINE90:{name:"Line 90\xB0",cmd:"WIRING_CORNER_LINE90",tips:""},WIRING_CORNER_ARC45:{name:"Arc 45\xB0",cmd:"WIRING_CORNER_ARC45",tips:""},WIRING_CORNER_ARC90:{name:"Arc 90\xB0",cmd:"WIRING_CORNER_ARC90",tips:""},WIRING_CORNER_ARC:{name:"Arc Free Angle",cmd:"WIRING_CORNER_ARC",tips:""},WIRING_CORNER_FREEANGLE:{name:"Line Free Angle",cmd:"WIRING_CORNER_FREEANGLE",tips:""},WIRING_MODE:{name:"Routing Mode",cmd:"WIRING_MODE",tips:""},WIRING_MODE_PUSHAWAY:{name:"Push",cmd:"WIRING_MODE_PUSHAWAY",tips:""},WIRING_MODE_SURROUND_AND_PUSHAWAY:{name:"Around & Push",cmd:"WIRING_MODE_SURROUND_AND_PUSHAWAY",tips:""},WIRING_MODE_SURROUND:{name:"Around",cmd:"WIRING_MODE_SURROUND",tips:""},WIRING_MODE_OBSTRUCT:{name:"Block",cmd:"WIRING_MODE_OBSTRUCT",tips:""},WIRING_MODE_IGNORE:{name:"Ignore",cmd:"WIRING_MODE_IGNORE",tips:""},WIRING_WIDTH:{name:"Routing Width",cmd:"WIRING_WIDTH",tips:"",option:{i18nContext:"router"}},WIRING_WIDTH_FOLLOWRULES:{name:"Follow Rule",cmd:"WIRING_WIDTH_FOLLOWRULES",tips:""},WIRING_WIDTH_RULESSETTING:{name:"Rule Setting...",cmd:"WIRING_WIDTH_RULESSETTING",tips:""},WIRING_WIDTH_COMMONLY_SSETTING:{name:"Common Width Setting...",cmd:"WIRING_WIDTH_COMMONLY_SSETTING",tips:""},WIDTH:{name:"Width...",cmd:"WIDTH",tips:""},WIRING_WIDTH_INPUT:{name:"Enter Width...",cmd:"WIRING_WIDTH_INPUT",tips:""},AUTO_TRIM_SILKSCREEN:{name:"Auto Trim Silkscreen",cmd:"AUTO_TRIM_SILKSCREEN",tips:""}},uGe=B3t;var F3t={SINGlE_ROUTE:{name:"Single Routing Mode",cmd:"SINGlE_ROUTE",tips:""},CHANGETRACK:{name:"Change Track",cmd:"CHANGETRACK",tips:""},CHANGECONTROLTRACK:{name:"Switch Control Line",cmd:"CHANGECONTROLTRACK",tips:""}},dGe=F3t;var V3t={INCREASE_GAP:{name:"Increase Gap",cmd:"INCREASE_GAP",tips:""},DECREASE_GAP:{name:"Decrease Gap",cmd:"DECREASE_GAP",tips:""},GAP_STEP_VALUE:{name:"Gap Step Value...",cmd:"GAP_STEP_VALUE",tips:""},EQUAL_LENGTH_TUNING_SETTING:{name:"Equal Length Tunning Setting...",cmd:"EQUAL_LENGTH_TUNING_SETTING",tips:""},NET_CLASS_LENGTH_TOLERANCE_RULE_SETTING:{name:"Net Class Length Tolerance Rule Setting...",cmd:"DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING",tips:""},DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING:{name:"Differential Pair Length Tolerance Rule Setting...",cmd:"DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING",tips:""},IGNORE_DRC:{name:"Ignore DRC",cmd:"IGNORE_DRC",tips:""}},pGe=V3t;var G3t={CONVERT_TO:{name:"Convert to",cmd:"CONVERT_TO",tips:""},CONVERT_TO_PAD:{name:"Convert to Pad",cmd:"CONVERT_TO_PAD",tips:""},CONVERT_TO_TRACK:{name:"Convert to Track",cmd:"CONVERT_TO_TRACK",tips:""},CONVERT_TO_2D_LINE:{name:"Convert to Line",cmd:"CONVERT_TO_2D_LINE",tips:""},CONVERT_TO_BOARD_OUTLINE:{name:"Convert to Board Outline",cmd:"CONVERT_TO_BOARD_OUTLINE",tips:""},CONVERT_TO_CONSTRAINT_REGION:{name:"Convert to Constraint Region",cmd:"CONVERT_TO_CONSTRAINT_REGION",tips:""},CONVERT_TO_COPPER_REGION:{name:"Convert to Copper Region",cmd:"CONVERT_TO_COPPER_REGION",tips:""},CONVERT_TO_SLOT_REGION:{name:"Convert to Slot Region",cmd:"CONVERT_TO_SLOT_REGION",tips:""},CONVERT_TO_FILL_REGION:{name:"Convert to Fill Region",cmd:"CONVERT_TO_FILL_REGION",tips:""},CONVERT_TO_PROHIBITED_REGION:{name:"Convert to  Prohibited Region",cmd:"CONVERT_TO_PROHIBITED_REGION",tips:""},CONVERT_TO_D3_SHELL_OUTLINE:{name:"Convert to 3D Shell - Outline",cmd:"CONVERT_TO_D3_SHELL_OUTLINE",tips:""},CONVERT_TO_D3_SHELL_SLOT_REGION:{name:"Convert to 3D Shell -  Slot Region",cmd:"CONVERT_TO_D3_SHELL_SLOT_REGION",tips:""},CONVERT_TO_D3_SHELL_ENTITY:{name:"Convert to 3D Shell - Entity",cmd:"CONVERT_TO_D3_SHELL_ENTITY",tips:""},CONVERT_TO_FPC_STIFFENER:{name:"Convert to FPC Stiffener",cmd:"CONVERT_TO_FPC_STIFFENER",tips:""}},fGe=G3t;var FR={...UVe,...HVe,...WVe,...zVe,...YVe,...jVe,...qVe,...$Ve,...KVe,...ZVe,...JVe,...QVe,...eGe,...tGe,...rGe,...iGe,...nGe,...oGe,...sGe,...aGe,...lGe,...cGe,...hGe,...uGe,...dGe,...XVe,...pGe,...fGe,MORE:{name:"More...",cmd:"MORE",tips:""},CANCEL:{name:"Cancel",cmd:"CANCEL",tips:"esc"},COMPLETE:{name:"Finish",cmd:"COMPLETE",tips:""},REGRESSION:{name:"Backspace",cmd:"REGRESSION",tips:""},toggleAdsorb:{name:"Snap",cmd:"toggleAdsorb",tips:""},ADSORBENT_CONFIG:{name:"Snap Setting...",cmd:"ADSORBENT_CONFIG",tips:""},CHECK_OUT:{name:"Check Out",cmd:"CHECK_OUT",tips:""},CHECK_IN:{name:"Check In",cmd:"CHECK_IN",tips:""},FILTER:{name:"Filter",cmd:"FILTER",tips:""},DISPLAY:{name:"Display",cmd:"DISPLAY",tips:""},ENLARGE:{name:"Zoom In",cmd:"ENLARGE",tips:""},NARROW:{name:"Zoom Out",cmd:"NARROW",tips:""},PASTE:{name:"Paste",cmd:"PASTE",tips:""},CUT:{name:"Cut",cmd:"CUT",tips:""},LOOKUP:{name:"Find...",cmd:"LOOKUP",tips:""},SELECT_PARENT:{name:"Parent",cmd:"SELECT_PARENT",tips:""},SELECT_CONNECTED_THERMALS:{name:"Connected Thermals",cmd:"SELECT_CONNECTED_THERMALS",tips:""},CROSSPROBE:{name:"Cross Probe...",cmd:"CROSSPROBE",tips:""},PLACETRANSFER:{name:"Placement Transfer...",cmd:"PLACETRANSFER",tips:""},REFRESH:{name:"Refresh...",cmd:"REFRESH",tips:""},RENUMBER:{name:"Renumber Pads...",cmd:"RENUMBER",tips:""},SELECT:{name:"Select",cmd:"SELECT",tips:""},COPY:{name:"Copy",cmd:"COPY",tips:""},copyToImage:{name:"Copy as an image",cmd:"copyToImage",tips:""},copyToSvg:{name:"Copy as SVG",cmd:"copyToSvg",tips:""},copyToPng:{name:"Copy as PNG",cmd:"copyToPng",tips:""},DELETE:{name:"Delete",cmd:"DELETE",tips:""},MOVE:{name:"Move",cmd:"MOVE",tips:""},MOVE_BY_CENTER_POINT:{name:"Move by Center Point",cmd:"MOVE_BY_CENTER_POINT",tips:""},MOVE_BY_ORIGIN_POINT:{name:"Move by Origin Point",cmd:"MOVE_BY_ORIGIN_POINT",tips:""},MOVE_BY_REFERENCE_POINT:{name:"Move by Reference Point",cmd:"MOVE_BY_REFERENCE_POINT",tips:""},MOVE_SEQUENTIAL:{name:"Move Sequential",cmd:"MOVE_SEQUENTIAL",tips:""},ARRAYS:{name:"Arrays",cmd:"ARRAYS",tips:""},DETACHING_WIRES_FROM_DEVICES:{name:"Detaching Wires From Devices",cmd:"DETACHING_WIRES_FROM_DEVICES",tips:""},UNROUTE_COMPONENT_CONNECTIONS:{name:"Unroute Component Connections",cmd:"UNROUTE_COMPONENT_CONNECTIONS",tips:""},ATTR_LOCATION:{name:"Property Location...",cmd:"ATTR_LOCATION",tips:""},ATTRIBUTE:{name:"Property...",cmd:"ATTRIBUTE",tips:""},IPC2552:{name:"IPC/DAC-2552 Properties...",cmd:"IPC2552",tips:""},ANNOTATION:{name:"Add Annotation",cmd:"ANNOTATION",tips:""},NET:{name:"Net",cmd:"NET",tips:""},DEVICE:{name:"Component",cmd:"DEVICE",tips:""},SELECTED_ELEMENT:{name:"Selected Element",cmd:"SELECTED_ELEMENT",tips:""},EXCHANGE_LOCATION:{name:"Swap Location",cmd:"EXCHANGE_LOCATION",tips:""},OVERLAP:{name:"Overlap",cmd:"OVERLAP",tips:""},SELECTOVERLAP:{name:"Select Overlap",cmd:"SELECTOVERLAP",tips:""},CONNECT:{name:"Connect",cmd:"CONNECT",tips:""},CONNECTED_COPPER:{name:"Connected Copper",cmd:"CONNECTED_COPPER",tips:""},NET_MENU:{name:"Net",cmd:"NET_MENU",tips:""},NET_COLOR:{name:"Net Color...",cmd:"NET_COLOR",tips:""},"new-net-class":{name:"New Net Class...",cmd:"new-net-class",tips:""},"join-net-class":{name:"Join Net Class...",cmd:"join-net-class",tips:""},"remove-from_net-class":{name:"Remove From Net Class",cmd:"remove-from_net-class",tips:""},"new-equal-length-group":{name:"New Equal Length Group...",cmd:"new-equal-length-group",tips:""},"join-equal-length-group":{name:"Join Equal Length Group...",cmd:"join-equal-length-group",tips:""},"remove-from_equal-length-group":{name:"Remove From Equal Length Group",cmd:"remove-from_equal-length-group",tips:""},"new-differentialPair":{name:"New Differential Pair...",cmd:"new-differentialPair",tips:""},"delete-differentialPair":{name:"Delete Differential Pair",cmd:"delete-differentialPair",tips:""},INSERT_NODE:{name:"Insert Node",cmd:"INSERT_NODE",tips:""},EDIT_BOUNDARY:{name:"Edit Outline",cmd:"EDIT_BOUNDARY",tips:""},GENERATE_D3_SHELL_OUTLINE:{name:"Generate 3D Shell - Outline",cmd:"GENERATE_D3_SHELL_OUTLINE",tips:""},FORMAT_BRUSH:{name:"Format Painter...",cmd:"FORMAT_BRUSH",tips:""},DIVISION:{name:"Slice",cmd:"DIVISION",tips:""},REPLACE_LAYER:{name:"Change Layer",cmd:"REPLACE_LAYER",tips:""},FLIP_PATH:{name:"Flip Path",cmd:"FLIP_PATH",tips:""},REMOVE_LOOP:{name:"Remove Loop",cmd:"REMOVE_LOOP",tips:""},SELECT_NET:{name:"Select Net",cmd:"SELECT_NET",tips:""},COMMENT:{name:"Comment",cmd:"COMMENT",tips:""},EXPAND:{name:"Expand",cmd:"EXPAND",tips:""},CORNER:{name:"Corner",cmd:"CORNER",tips:""},GROUP_OF_OBJECT:{name:"Group of Object",cmd:"GROUP_OF_OBJECT",tips:""},DUPLICATE:{name:"Duplicate",cmd:"DUPLICATE",tips:""},DUPLICATE_TO_CURSOR:{name:"Duplicate to Cursor",cmd:"DUPLICATE_TO_CURSOR",tips:""},DUPLICATE_TO_OTHER_LAYER:{name:"Duplicate to Other Layer",cmd:"DUPLICATE_TO_OTHER_LAYER",tips:""},CUTOUT:{name:"Cutout",cmd:"CUTOUT",tips:""},CUTOUT_RECT:{name:"Rectangle",cmd:"CUTOUT_RECT",tips:""},CUTOUT_CIRCLE:{name:"Circle",cmd:"CUTOUT_CIRCLE",tips:""},CUTOUT_POLYGON:{name:"Polygon",cmd:"CUTOUT_POLYGON",tips:""},avoidSlots:{name:"Avoid Slots",cmd:"avoidSlots",tips:""},avoidPads:{name:"Avoid Pads",cmd:"avoidPads",tips:""},boolOperation:{name:"Boolean Operation",cmd:"boolOperation",tips:""},boolAggregate:{name:"Merge Areas",cmd:"boolAggregate",tips:""},boolSubtraction:{name:"Subtract Top Area",cmd:"boolSubtraction",tips:""},boolIntersection:{name:"Preserve overlapping areas",cmd:"boolIntersection",tips:""},boolExclusive:{name:"Exclude Overlapping Areas",cmd:"boolExclusive",tips:""},boolSplit:{name:"Split Area with Holes",cmd:"boolSplit",tips:""},MERGE_AS_CLOSED_OBJECT:{name:"Merge as a Closed Line",cmd:"MERGE_AS_CLOSED_OBJECT",tips:""},MERGE_PADS:{name:"Merge pads",cmd:"MERGE_PADS",tips:""},DISPERSED_AS_INDEPENDENT_LIEN:{name:"Dispersed as Independent Line",cmd:"DISPERSED_AS_INDEPENDENT_LIEN",tips:""},SPLIT:{name:"Split",cmd:"SPLIT",tips:""},ADD_FILLET:{name:"Add Fillet...",cmd:"ADD_FILLET",tips:""},ADD_CHAMFER:{name:"Add Chamfer...",cmd:"ADD_CHAMFER",tips:""},UNROUTE_ATTACHED_SEGMENTS:{name:"Unroute Attached Segments",cmd:"UNROUTE_ATTACHED_SEGMENTS",tips:""},UNROUTE_CONNECTIONS:{name:"Unroute Connections",cmd:"UNROUTE_CONNECTIONS",tips:""},TABLE_SETTING:{name:"Table Setting...",cmd:"TABLE_SETTING",tips:""},OPTIMIZA_NONE:{name:"None",cmd:"OPTIMIZA_NONE",tips:""},OPTIMIZA_WEAK:{name:"Weak",cmd:"OPTIMIZA_WEAK",tips:""},OPTIMIZA_STRONG:{name:"Strong",cmd:"OPTIMIZA_STRONG",tips:""},OPTIMIZATION:{name:"Optimization",cmd:"OPTIMIZATION",tips:""},ADD:{name:{value:"Add",context:"contextMenu"},cmd:"ADD",tips:""},BATCH_FANOUT:{name:"Fanout Routing...",cmd:"BATCH_FANOUT",tips:""},OBJECT_PRIORITY:{name:"Measuring Object",cmd:"OBJECT_PRIORITY",tips:""},COLUMNS_INPUT:{name:"Enter Columns...",cmd:"COLUMNS_INPUT",tips:""},REUSE_BLOCK:{name:"Reuse Block",cmd:"REUSE_BLOCK",tips:""},selectedBSSaveAsCloud:{name:"Save as Reuse Block Based on Selected...",cmd:"selectedBSSaveAsCloud",tips:""},selectedBSSaveAsLocal:{name:"Save as Reuse Block(Local) Based on Selected...",cmd:"selectedBSSaveAsLocal",tips:""},EXIT_EDIT_PAD_SHAPE_MOE:{name:"Exit Edit Pad Shape Mode",cmd:"EXIT_EDIT_PAD_SHAPE_MOE",tips:""},"opensubmenu-boardshape":{name:"Board Shape",cmd:"opensubmenu-boardshape",tips:""},convertToBoard:{name:"Generate Board Shape from Selection",cmd:"convertToBoard",tips:""},convertToLineFromBoard:{name:"Generate Lines from Board Shape",cmd:"convertToLineFromBoard",tips:""},clearMeasureResults:{name:"Clear Results",cmd:"clearMeasureResults",tips:""},CreepageDistance:{name:"Creepage Distance",cmd:"CreepageDistance",tips:""},MeasuringDistance:{name:"Measuring Distance",cmd:"MeasuringDistance",tips:""}};function ISe(o){switch(o){case"ANNOTATION":return"createAnnotation";case"COPY":return"Copy";case"copyToImage":return"copyToImage";case"copyToSvg":return"copyToSvg";case"copyToPng":return"copyToPng";case"CUT":return"cut";case"DUPLICATE":return"Duplicate";case"DUPLICATE_TO_CURSOR":return"DuplicateToCursor";case"boolAggregate":return"BoolAggregate";case"boolIntersection":return"BoolIntersection";case"boolSubtraction":return"BoolSubtraction";case"boolExclusive":return"BoolExclusive";case"boolSplit":return"BoolSplit";case"DUPLICATE_TO_OTHER_LAYER":return"DuplicateToOtherLayer";case"PASTE":return"Paste";case"DELETE":return"Delete Selected";case"MOVE_BY_CENTER_POINT":return"Move by Center Point";case"MOVE_BY_ORIGIN_POINT":return"MOVE_BY_ORIGIN_POINT";case"MOVE_BY_REFERENCE_POINT":return"MOVE_BY_REFERENCE_POINT";case"ARRAYS":return"editArray";case"ENLARGE":return"Zoom In";case"NARROW":return"Zoom Out";case"ADAPT_ALL":return"Fit All in Window";case"LOOKUP":return"Find and Replace";case"RATLINES_HIDE":return"Show/Hide Selected Ratline";case"RATLINES_SHOW":return"Show/Hide Selected Ratline";case"HIGHLIGHT_SELECTED_OBJECTS":return"HIGHLIGHT_SELECTED_OBJECTS";case"HIGHLIGHT_COMPONENT":return"HIGHLIGHT_COMPONENT";case"HIGHLIGHT_CANCELALL":return"Unhighlight All";case"HIGHLIGHT_CANCEL_COMPONENT":return"HIGHLIGHT_CANCEL_COMPONENT";case"HIGHLIGHT_CANCEL_SELECTED_OBJECTS":return"HIGHLIGHT_CANCEL_SELECTED_OBJECTS";case"ADDWITH_VIA":return"Place Via";case"ADDVIA_FENCE":return"PlaceViaFence";case"PLACE_VIA":return"Place Via";case"COMBINATION_SELECT":return"Group Selected";case"COMBINATION_CANCEL":return"Ungroup Selected";case"rotate_left":return"Rotate Left";case"rotate_right":return"rotate_right";case"rotate_reference_point":return"rotate_reference_point";case"align_left":return"Align Left";case"align_horizontal_center":return"Align Horizontal Centers";case"align_right":return"Align Right";case"align_top":return"Align Top";case"align_vertical_center":return"Align Vertical Centers";case"align_bottom":return"Align Bottom";case"align_grid":return"Align Grid";case"distribute_horizontal_equidistant":return"Horizontal Equidistant Distribution";case"distribute_vertical_equidistant":return"Vertical Equidistant Distribution";case"distribute_left_side_edge_equidistant":return"distribute_left_side_edge_equidistant";case"distribute_top_side_edge_equidistant":return"distribute_top_side_edge_equidistant";case"distribute_horizontal_by_center_distance":return"distribute_horizontal_by_center_distance";case"distribute_vertical_by_center_distance":return"distribute_vertical_by_center_distance";case"distribute_horizontal_by_edges_distance":return"distribute_horizontal_by_edges_distance";case"distribute_vertical_by_edges_distance":return"distribute_vertical_by_edges_distance";case"distribute":return"distribute";case"component_distribute_by_region":return"component_distribute_by_region";case"component_distribute_by_region":return"Component Distribute By Region";case"FLIP_LEFTANDRIGHT":return"Flip Right and Left";case"FLIP_UPANDDOWN":return"Flip Up and Down";case"ADDWITH_TRACK":return"Single Routing";case"STRETCHING":return"Stretch Track";case"WIRING_CORNER":return"Routing Corner";case"REBUILD_ALL":return"Rebuild All Copper Area";case"SHOW_COPPER_FILLS":case"HIDE_COPPER_FILLS":return"ChangeCopperZoneVisibleorInvisible";case"COMPLETE":return"Finish";case"CANCEL":return"Cancel";case"REGRESSION":return"Backspace";case"OVERLAP":return"Select Overlap";case"CONNECTED_COPPER":return"connectedCopper";case"FLIP_PATH":return"Filp Path While Drawing";case"HIGHLIGHT_NET":return"Highlight Or Unhighlight Net";case"HIGHLIGHT_CANCEL_NET":return"Highlight Or Unhighlight Net";case"HIGHLIGHT_AND_UNHIGHLIGHT":return"Unhighlight All";case"TURNOVER":return"flip2OppositeSide";case"EQUAL_LENGTH_TUNING_SETTING":case"WIRING_WIDTH_INPUT":return"Change Track Width While Routing";case"COLUMNS_INPUT":case"VIA_SIZE_INPUT":return"Show Attribute Dialog When Placing Object";case"CROSSPROBE":return"pcbCrossProbe";case"INCREASE_GAP":return"increaseSnakeGap";case"DECREASE_GAP":return"decreaseSnakeGap";case"CHANGE_DIFFPAIR_FANOUT_MODE":return"changeDiffPairFanOutMode";case"MOVE_BY_REFERENCE_POINT":return"MOVE_BY_REFERENCE_POINT";case"WIRING_MODE":return"changeRoutingMode";case"toggleAdsorb":return"toggleAdsorb";case"GRID_SNAP_KEEP_RATIO":return"gridSnapKeepRatio";case"GRID_SETTING":return"setGridSize";case"GRID_RANGE_SETTING":return"setGridRange";case"OFFSET_ABSOLUTE":return"absoluteOffset";case"OFFSET_RELATIVE":return"relativeOffset";case"FLIP_LEFTANDRIGHT_BY_REFER_POINT":return"fliph_reference_point";case"FLIP_UPANDDOWN_BY_REFER_POINT":return"flipv_reference_point";case"ADD":return"ADD";case"ADD_FILLET":return"ADD_FILLET";case"ADD_CHAMFER":return"ADD_CHAMFER";case"ADDWITH_TEARS":return"teardrop";case"ADAPT_SELECTED":return"adaptSelectionView";case"EXCHANGE_LOCATION":return"swapLocation";case"ATTR_LOCATION":return"set-attr-text-position";case"REUSE_LAYOUT_ROUTE":return"reuseLayoutRoute";case"OBJECT_PRIORITY":return"prioritizeObjectSelection";case"clearMeasureResults":return"clearMeasureResults";case"CreepageDistance":return"creepageDistance";case"selectedBSSaveAsCloud":return"selectedBSSaveAsCloud";case"selectedBSSaveAsLocal":return"selectedBSSaveAsLocal";case"COPPER_MANAGER":return"viewCopperAreaManager";case"CUTOUT":return"Cutout";case"CUTOUT_RECT":return"draw(RCutout)";case"CUTOUT_CIRCLE":return"draw(CCutout)";case"CUTOUT_POLYGON":return"draw(PCutout)";case"avoidSlots":return"avoidSlots";case"avoidPads":return"avoidPads";case"CONVERT_TO_PAD":return"CONVERT_TO_PAD";case"CONVERT_TO_TRACK":return"CONVERT_TO_TRACK";case"CONVERT_TO_2D_LINE":return"CONVERT_TO_2D_LINE";case"CONVERT_TO_SLOT_REGION":return"CONVERT_TO_SLOT_REGION";case"CONVERT_TO_FILL_REGION":return"CONVERT_TO_FILL_REGION";case"CONVERT_TO_COPPER_REGION":return"CONVERT_TO_COPPER_REGION";case"CONVERT_TO_PROHIBITED_REGION":return"CONVERT_TO_PROHIBITED_REGION";case"CONVERT_TO_BOARD_OUTLINE":return"CONVERT_TO_BOARD_OUTLINE";case"CONVERT_TO_CONSTRAINT_REGION":return"CONVERT_TO_CONSTRAINT_REGION";case"CONVERT_TO_D3_SHELL_OUTLINE":return"CONVERT_TO_D3_SHELL_OUTLINE";case"CONVERT_TO_D3_SHELL_SLOT_REGION":return"CONVERT_TO_D3_SHELL_SLOT_REGION";case"CONVERT_TO_D3_SHELL_ENTITY":return"CONVERT_TO_D3_SHELL_ENTITY";case"CONVERT_TO_FPC_STIFFENER":return"CONVERT_TO_FPC_STIFFENER";case"convertToBoard":return"convertToBoard";case"convertToLineFromBoard":return"convertToLineFromBoard";case"opensubmenu-boardshape":return"opensubmenu-boardshape";default:return null}}var Jt=class{constructor(){this.result=new Array}addObj(t,e=!1,r=!1){this.result.push({...t,separate:e,selectedTag:r})}add(t,e=!1,r=!1,i=!0,n=!1,s=!1){if(FR[t]){let a=ISe(FR[t].cmd),l=sr.getConfigHotkeyInfo(a),c;l||(c=r6.getMenuHotkeyConfigInfo(t)),FR[t].tips=i&&(l==null?void 0:l.hotKey)||"";let h={...FR[t],separate:e,selectedTag:r,uiAction:l==null?void 0:l.uiAction,subHotKey:l?l.subHotkey:c==null?void 0:c.hotkey,subHotKeyCmd:l?l.menuHotkeyCmd:c==null?void 0:c.menuCmd,disabled:n};s&&(h.option={disabledI18n:s}),this.result.push(h)}else{let a=r6.getMenuHotkeyConfigInfo(t),l={name:t,cmd:t,tips:"",separate:e,selectedTag:r,subHotKey:a==null?void 0:a.hotkey,subHotKeyCmd:a==null?void 0:a.menuCmd,disabled:n};s&&(l.option={disabledI18n:s}),this.result.push(l)}}addExtend(t,e,r=!1,i=!1,n=!1){let s=ISe(FR[t].cmd),a=sr.getConfigHotkeyInfo(s),l;a||(l=r6.getMenuHotkeyConfigInfo(t)),FR[t].tips=(a==null?void 0:a.hotKey)||"",this.result.push({...FR[t],extend:e.result,separate:r,selectedTag:i,uiAction:a==null?void 0:a.uiAction,subHotKey:a?a.subHotkey:l==null?void 0:l.hotkey,subHotKeyCmd:a?a.menuHotkeyCmd:l==null?void 0:l.menuCmd,disabled:n})}addSeparate(){this.result.length>0&&(this.result[this.result.length-1].separate=!0)}};function lg(o){let t=new Jt,e=ce.trackConfig,r="WIRING_WIDTH:";return e.forEach(i=>{let n=i.getMenu(r),s=!1;o==i.mil&&(s=!0),t.addObj(n,!1,s)}),t.add("WIRING_WIDTH_COMMONLY_SSETTING",!0),t}function rF(o,t){let e=new Jt,r=ce.viaConfig,i="VIA_SIZE:";return r.forEach((n,s)=>{let a=n.getMenu(i),l=!1;o!=null&&xe(o)==xe(n.milInnerRadius)&&t!=null&&xe(t)==xe(n.milRadius)&&(l=!0),e.addObj(a,s==r.length-1,l)}),e.add("VIA_SIZE_COMMONLY_SETTING",!1),e}function KS(o){let t=new Jt;return t.add("WIRING_CORNER_LINE45",!1,o=="WIRING_CORNER_LINE45"),t.add("WIRING_CORNER_LINE90",!1,o=="WIRING_CORNER_LINE90"),we.diffTrack||(t.add("WIRING_CORNER_ARC45",!1,o=="WIRING_CORNER_ARC45"),t.add("WIRING_CORNER_ARC90",!1,o=="WIRING_CORNER_ARC90")),t.add("WIRING_CORNER_ARC",!1,o=="WIRING_CORNER_ARC"),t.add("WIRING_CORNER_FREEANGLE",!1,o=="WIRING_CORNER_FREEANGLE"),t}function Fie(o,t){let e=new Jt;return e.add("VIA_SIZE_FOLLOWRULES",!1,ce.pcbConfig.startViaSize=="rule"),e.add("VIA_SIZE_RULESSETTING",!0),ce.viaConfig.forEach(i=>{let n=i.getMenu(),s=!1;o!=null&&rCe(o,i.milInnerRadius)&&t!=null&&rCe(t,i.milRadius)&&(s=!0),e.addObj(n,!1,s)}),e.result.length>0&&(e.result[e.result.length-1].separate=!0),e.add("VIA_SIZE_COMMONLY_SETTING",!0),e.add("VIA_SIZE_INPUT"),e}function Vie(o,t){let e=new Jt;for(let r of o){let i=r.getMenu(),n=!1;t==r.layerID&&(n=!0),e.addObj(i,!1,n)}return e}function mGe(o=!1){let t=new Jt,e=tr.getInstance();return o||(t.add("WIRING_MODE_PUSHAWAY",!1,e.mode=="WIRING_MODE_PUSHAWAY"),t.add("WIRING_MODE_SURROUND_AND_PUSHAWAY",!1,e.mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"),t.add("WIRING_MODE_SURROUND",!1,e.mode=="WIRING_MODE_SURROUND"),t.add("WIRING_MODE_OBSTRUCT",!1,e.mode=="WIRING_MODE_OBSTRUCT")),t.add("WIRING_MODE_IGNORE",!1,e.mode=="WIRING_MODE_IGNORE"),t}function gGe(o){let t=new Jt;return t.add("WIRING_WIDTH_FOLLOWRULES",!1,ce.pcbConfig.startTrackWidth=="rule"),t.add("WIRING_WIDTH_RULESSETTING",!0),ce.trackConfig.forEach(r=>{let i=r.getMenu(),n=!1;o==r.mil&&(n=!0),t.addObj(i,!1,n)}),t.add("WIRING_WIDTH_COMMONLY_SSETTING",!0),t.add("WIRING_WIDTH_INPUT"),t}function yGe(o,t,e,r){let i=new Jt,n=new Set;return e&&(n=te.getInstance().getDefaultBlindPhysics().getContainsLayerVias(o)),n!=null&&n.forEach(s=>{let a=s.getMenu(),l=!1;r==s.name&&(l=!0),i.addObj(a,!1,l)}),i.addSeparate(),i.add("VIA_TYPE_RULESSETTING"),i}function bGe(o,t,e=!1){let r=new Jt;if(t==null?r.add("CANCEL",!0):t.tracks.length==1?(r.add("COMPLETE"),r.add("CANCEL"),r.add("REGRESSION",!0)):(r.add("COMPLETE"),r.add("CANCEL"),r.add("REGRESSION",!0),e||r.add("CHANGECONTROLTRACK"),r.add("SINGlE_ROUTE",!e,e),e&&r.add("CHANGETRACK",!0)),t!=null){let i=t.node.layerId,n=t.node.end.layerId,s=t.node.via.viaName;r.add("PLACE_VIA");let a=be.getAllSignalLayer(),l=Vie(a,n);if(r.addExtend("REPLACE_LAYER",l),t.tracks.length==1){let c=yGe(i,t.node.net,!0,s);r.addExtend("PLACE_BURIEDHOLE",c)}}if(r.addExtend("WIRING_CORNER",KS(tr.getInstance().type)),r.addExtend("WIRING_MODE",mGe()),t!=null){let i=gGe(t.node.width);r.addExtend("WIRING_WIDTH",i),r.addExtend("VIA_SIZE",Fie(t.node.via.inner,t.node.via.radius))}return r.add("REMOVE_LOOP",!1,pr.removeLoop),r.add("toggleAdsorb",!1,o),r.add("ADSORBENT_CONFIG"),r}var i6=class i6{constructor(){this.channel=x.getInstance().compilerChannel;this._allowPull=15}static getInstance(){return i6.ins==null&&(i6.ins=new i6),i6.ins}set mouseDown(t){t?this._allowPull=this._allowPull&14:this._allowPull=this._allowPull|1,this.allowPull||this.channel.pause()}set noControl(t){t?this._allowPull=this._allowPull|2:this._allowPull=this._allowPull&13,this.allowPull||this.channel.pause()}get allowPull(){return this._allowPull>=15}set allowPull(t){t?this._allowPull=15:this._allowPull=0,this.allowPull||this.channel.pause()}autoPull(){return requestAnimationFrame(()=>{this.allowPull&&this.channel.pull()})}start(){requestAnimationFrame(()=>{this.autoPull(),this.start()})}};i6.ins=null;var Mn=i6;var iF=class{constructor(){this.nextTool=null}getCanUndo(){return this.nextTool?this.nextTool.getCanUndo():!1}setNextTool(t){this.nextTool=t}getNextTool(){return this.nextTool}};var ko=class extends iF{constructor(){super(...arguments);this.drawing=!1;this.filterItems=new Set}getToolName(){return""}handler(e){this.nextTool!=null&&e(this.nextTool)}onKeyDown(e){this.handler(r=>{r.onKeyDown(e)})}onKeyUp(e){this.handler(r=>{r.onKeyUp(e)})}onMouseLeftDown(e){this.handler(r=>{r.onMouseLeftDown(e)})}onMouseMidDown(e){this.handler(r=>{r.onMouseMidDown(e)})}onMouseRightDown(e){this.handler(r=>{r.onMouseRightDown(e)})}onMouseLeftUp(e){this.handler(r=>{r.onMouseLeftUp(e)})}onMouseMidUp(e){this.handler(r=>{r.onMouseMidUp(e)})}onMouseRightUp(e){this.handler(r=>{r.onMouseRightUp(e)})}onMouseMove(e){this.handler(r=>{r.onMouseMove(e)})}onMouseLeave(e){this.handler(r=>{r.onMouseLeave(e)})}onMouseOut(e){this.handler(r=>{r.onMouseOut(e)})}onMouseEnter(e){this.handler(r=>{r.onMouseEnter(e)})}onMouseOver(e){this.handler(r=>{r.onMouseOver(e)})}onMouseWheel(e){this.handler(r=>{r.onMouseWheel(e)})}onDoubleClick(e){this.handler(r=>{r.onDoubleClick(e)})}onResize(e){this.handler(r=>{r.onResize(e)})}interrupt(){this.handler(e=>{e.interrupt()})}restore(){this.handler(e=>{e.interrupt()})}parse(e){}};var ci=class extends ko{constructor(){super(...arguments);this.option="OPTIONCOMPLETE"}onMouseRightUp(e){if(e.openMenu)switch(this.option){case"OPTIONCOMPLETE":{this.option1(e);break}case"OPTIONLEFTUP":{this.option2(e);break}}}option1(e){switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.completed():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}option2(e){switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}start(){Mn.getInstance().allowPull=!1}end(){Mn.getInstance().allowPull=!0}completed(e){}cancel(e){}rightClickMenuData(e){}onMouseWheel(e){this.onMouseMove(e)}canChangeWhileRouting(e){return!(["Copper Region","Fill Region","Slot Region","Prohibited Region","Constraint Region","FPC Stiffener","3D Shell - Side Datum Line","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Side Entity","3D Shell - Top/Bottom Entity"].indexOf(e)>=0)}onEnterPlace(e){this.onMouseLeftUp(e)}};var U3t=0;function su(){return"BASE"+U3t++}var Yi=class o extends mt{constructor(e,r){super(e);this.isBase=!0;this._color=null;this._color=r,this.sendDeleteMsg=!1}static build(e,r,i,n,s=ee.BLACK){let a=new ih(su(),r,i,{layerId:e,strokeWidth:n,locked:!1});return new o(a,s)}get color(){return this._color}set color(e){this._color=e,this.refreshRender()}setBBoxModify(){}setLayerModify(e){}};var nF=class{constructor(t,e,r=null){this.len=xe(10/Ni().getScale(),2);this.layerId=e,this._position=t,this._rotation=r,this.updateBaseCross()}remove(){this.line1.remove(),this.line2.remove(),this.line1=null,this.line2=null}isRepeat(t,e){return t.x===this._position.x&&t.y===this._position.y&&e==this._rotation}getLines(){return[this.line1,this.line2]}get position(){return this._position}set position(t){this._position=t,this.updateBaseCross()}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this.updateBaseCross()}updateBaseCross(){let t=Ni(),e=new S(this.len,0),r=new S(0,this.len);this.line1=Yi.build(this.layerId,e.mul(-1),e,2/t.getScale()),this.line2=Yi.build(this.layerId,r.mul(-1),r,2/t.getScale());let i=Ae.translate(this._position.x,this._position.y,0);this.line1.transform(i),this.line2.transform(i)}};var H3t=ee.of3("#5588ff"),Gie=class{constructor(t,e,r,i=!1){this.globalIndex=su();this.length=1e5;this.state="Only Main";this.viewGroupId="";this.start=t,this.end=e,this.layerId=r,this.midPoint=t.add(e).mul(.5),this.isSnapComponent=i,this.refreshRender()}remove(){this.state="Not Shown",this.refreshRender()}visible(){this.state="Only Main",this.refreshRender()}hidden(){this.state="Not Shown",this.refreshRender()}updateBaseExtensionCord(t=!1){let e=this.start,r=this.end,i=r.sub(e).normalize(),n=this.midPoint.sub(i.mul(this.length)),s=this.midPoint.add(i.mul(this.length));return t&&(n=e,s=r),[n,s]}getType(){return 29}refreshRender(){Do.attach(this,this.getType())}getViewState(){return this.state}getRenderData(){let{layerId:t}=this,e=this.updateBaseExtensionCord(this.isSnapComponent);return{layerId:t,segments:[e],isSolid:!1,color:H3t,highlightColor:ee.BLACK,highLightType:null,manualHighLight:x.getInstance().forceDeactive}}};var va=class extends zs{get box(){return this.model.text.box}};var A0=class extends ds{constructor(){super()}get net(){return this.model.net.toUpperCase()}get showNet(){return this.model.net}set net(t){this.model.net!=t&&(ze.delete(this),this.model.net=t,ze.addItem(this),this.refreshRender())}get copperPath(){return this.model.source}get pls(){return this.model.pls}set pls(t){this.model.pls=t}get start(){return this.pls.length>0?this.pls[0].primitives[0].start():null}get locked(){return this.model.locked}set locked(t){this.model.locked=t}get layerId(){return this.model.layerId}get color(){return this._color||ze.getSpecialColor(this.net)}set color(t){t?this._color=t:delete this._color,this.refreshRender()}rotateFor(t,e){}transform(t){}getType(){return 4}isSelect(t,e){return this.model.inShape(t,e)}inPolygon(t,e){return this.model.inShape(t,e)}inCopper(t,e){return this.isVisible?this.inPolygon(t,e):!1}buildBBox(){return this.model.buildBBox()}};var n0=class extends zs{constructor(){super(),this.initRefreshRender()}get mirror(){return this.model.mirror}get box(){return this.model.box}set mirror(t){this.model.mirror!=t&&(this.model.mirror=t,this.refreshRender())}get start(){return this.model.start}set start(t){this.model.start=t,this.refreshRender()}get center(){return this.model.center}set center(t){this.model.center=t,this.refreshRender()}get width(){return this.model.width}set width(t){this.model.width=t,this.refreshRender()}get height(){return this.model.height}set height(t){let e=this.model.box.leftLow;this.model.height=t;let r=e.sub(this.model.box.leftLow),i=Ae.translate(r.x,r.y,0);this.model.transform(i),this.refreshRender()}modifyHeight(t){this.model.height=t,this.refreshRender()}get rotation(){return this.model.rotation%Vr}set rotation(t){this.model.rotation=t,this.refreshRender()}get locked(){return this.model.locked}set locked(t){this.model.locked=t}rotateFor(t,e){let r=Ae.translate(-t.x,-t.y,0).rotateZ(e).translate1(t.x,t.y,0);this.transform(r)}isSelect(t,e){return this.getParent()!=null?!1:this.model.inShape(t,e)}transform(t){this.model.transform(t),this.refreshRender()}getMathGraphics(t,e){return this.model.getMathGraphics(t,e)}buildBBox(){return this.model.buildBBox()}};function $c(o,t=!1){var e;if(o instanceof ki)switch(o.modelType){case"Track":case"ArcTrack":{if(!t){let i=pr.getItem(o.globalIndex);if(i!=null)return i}return pr.addTrackByModel(o)}case"Pad":{if(!t){let i=Kt.getItem(o.globalIndex);if(i!=null)return i;let n=Kt.getItem(o.globalIndex);if(n!=null)return n}switch(o.layerId){case 1:return o.top.type=="POLYGON"?Kt.addPolygonPadByModel(o):Kt.addPadByModel(o);case 2:return o.bottom.type=="POLYGON"?Kt.addPolygonPadByModel(o):Kt.addPadByModel(o);default:return o.top.type=="POLYGON"?Kt.addPolygonPadByModel(o):Kt.addPadByModel(o)}}case"Via":{if(!t){let i=Hr.getItem(o.globalIndex);if(i!=null)return i}return Hr.addViaByModel(o)}case"Image":{if(!t){let i=Ln.getItem(o.globalIndex);if(i!=null)return i}return Ln.addImageByModel(o)}case"Picture":{if(!t){let i=_o.getItem(o.globalIndex);if(i!=null)return i}return _o.addImageByModel(o)}case"Length Dimension":{if(!t){let i=Go.getItem(o.globalIndex);if(i!=null)return i}return Go.addDimensionByModel(o)}case"Protractor Dimension":{if(!t){let i=is.getItem(o.globalIndex);if(i!=null)return i}return is.addProtractorByModel(o)}case"Radius Dimension":{if(!t){let i=Uo.getItem(o.globalIndex);if(i!=null)return i}return Uo.addRadiusMarkByModel(o)}case"Polygon":{if(!t){let n=pt.getItem(o.globalIndex);if(n!=null)return n}let i=new Array;for(let n of o.childrens){let s=new Array;for(let a of n)s.push($c(a));i.push(s)}return pt.addPolygonByModel(o,i)}case"Rect":{if(!t){let i=Xt.getItem(o.globalIndex);if(i!=null)return i}return Xt.addRectByModel(o)}case"Circle":{if(!t){let i=Zt.getItem(o.globalIndex);if(i!=null)return i}return Zt.addCircleByModel(o)}case"Copper":{if(!t){let a=Ei.getItem(o.globalIndex);if(a!=null)return a}let i,n=(e=o.getParent())==null?void 0:e.globalIndex;if(!n||(i||(i=Xt.getItem(n)),i||(i=Zt.getItem(n)),i||(i=pt.getItem(n)),!i))return;let s=Ei.addCopperByModel(o);return s.fill(),i.addCopperResult(s),s.setParent(i),s}case"Inner":{if(!t){let i=Qn.getItem(o.globalIndex);if(i!=null)return i}return Qn.addPlaneZoneByModel(o)}case"Component":{if(!t){let l=Cr.getItem(o.globalIndex);if(l!=null)return l}let i=o.getItems(),n=o.attributes,s=new Array,a=new Array;for(let l of i){let c=$c(l);c!=null&&s.push(c)}for(let l of n){let c=$c(l);a.push(c)}return Cr.addComponentByModel(a,s,o)}case"Line":return $u.addByModel(o);case"Arc":return qc.addArcByModel(o);case"Ratline":{if(!t){let i=zo.getRatlineById(o.globalIndex);if(i!=null)return i}return zo.addRatlineByModel(o)}case"Text":{if(!t){let i=ti.getItem(o.globalIndex);if(i!=null)return i}return ti.addtextByModel(o)}}return null}function wT(o,t){switch(o){case"Track":case"ArcTrack":return pr.getItem(t);case"Pad":{let e=Kt.getItem(t);if(e!=null)return e}case"Via":{let e=Hr.getItem(t);if(e!=null)return e}case"Image":{let e=Ln.getItem(t);if(e!=null)return e}case"Picture":{let e=_o.getItem(t);if(e!=null)return e}case"Length Dimension":{let e=Go.getItem(t);if(e!=null)return e}case"Protractor Dimension":{let e=is.getItem(t);if(e!=null)return e}case"Radius Dimension":{let e=Uo.getItem(t);if(e!=null)return e}case"Polygon":{let e=pt.getItem(t);if(e!=null)return e}case"Rect":{let e=Xt.getItem(t);if(e!=null)return e}case"Circle":{let e=Zt.getItem(t);if(e!=null)return e}case"Copper":{let e=Ei.getItem(t);if(e!=null)return e}case"Inner":{let e=Qn.getItem(t);if(e!=null)return e}case"Component":{let e=Cr.getItem(t);if(e!=null)return e}case"Ratline":{let e=zo.getRatlineById(t);if(e!=null)return e}case"Text":{let e=ti.getItem(t);if(e!=null)return e}}}var Uie=null,wc=class o{constructor(){this._hasModified=!1;this.padNumberManger=new Q0;this.UUID="";this.category="";this.describe="";this._footprintId="";this.deviceAttrsMap={};this._textOffset=S.ORIGIN}static getTemplate(){return Uie==null&&(Uie=new o),Uie}removeAttribute(t){t.isEmpty||delete this.deviceAttrsMap[t.key]}get hasModified(){return this._hasModified}set hasModified(t){this._hasModified=t}set textOffset(t){this._textOffset=t}get textOffset(){return this._textOffset}set footprintId(t){this._footprintId=t;let e=ti.getAllItem();for(let r of e)r.key=="Footprint"&&(r.value=t)}get footprintId(){return this._footprintId}checkMustAttr(){let e=h4.ATTR;this.footprintId=x.getInstance().name;let r=ti.getAllItem(),i=!1,n=new Map;for(let s of r)s.key=="Footprint"&&(i=!0),s.key!=""&&(n.has(s.key)?(s.remove(),ti.delete(s),x.getInstance().compiler.deleteAttr(s.globalIndex)):n.set(s.key,s.key));if(!i){let s=uj(cr(),"Footprint",x.getInstance().name),a=new Yy;a.feed(s);let l=a.finish();l!=null&&($c(l),x.getInstance().compiler.uploadAttr(l.globalIndex,or.getInstance().encode("ATTR",l)))}}};var Sm=class{constructor(t){this.shapes=new Array;this.center=new S(0,0);this.high=0;this.shapes=t.map(e=>e instanceof mt||e instanceof vt?e.primitive:e),this.calc()}getBBox(){let t=new _e;return this.shapes.forEach(e=>{t.ext1(e.bbox())}),t.build1()}calc(){let t=this.getBBox(),e=t.center(),r=this.shapes,i=t.width()<t.height();i&&(r=this.shapes.map(l=>l.multiply3(Ae.rotateZForPoint(e,Math.PI/2).toMatrix3())));let n=new Array;r.forEach(l=>{l instanceof M?this.calcLine(l,e,n):this.calcArc(l,e,n)}),xr(n,(l,c)=>c-l,0,n.length);let s=new Set,a=8;n.forEach(l=>{s.add(this.toFix(l,a))}),n=Array.from(s),n.length>1?(this.center=new S(e.x,(n[0]+n[1])/2),i&&(this.center=this.center.multiply4(Ae.rotateZForPoint(e,-Math.PI/2))),this.high=n[0]-n[n.length-1]):this.center=e,this.optimization()}optimization(){if(this.high==0){let t=this.getBBox();this.high=t.height(),this.center.equals(S.ORIGIN)&&(this.center=t.center())}}toFix(t,e=1){let r=Math.pow(10,e);return Math.round(t*r)/r}calcLine(t,e,r){let i=t;i.bbox().isContainsX(e.x)&&(i.isPoint()?r.push(i.start().y):i.b!=0&&r.push(this.toFix(-(i.a*e.x+i.c)/i.b,4)))}calcArc(t,e,r){let i=new _e;i.ext1(t.bbox());let n=i.build1();if(n.isContainsX(e.x)){let a=t.rx*t.rx-(e.x-t.center.x)*(e.x-t.center.x);if(a>=0){let l=Math.sqrt(a);n.isContainsY(t.center.y-l)&&r.push(t.center.y-l),n.isContainsY(t.center.y+l)&&r.push(t.center.y+l)}}}};var Zo=class o extends vt{constructor(e,r){super(e);this._color=null;this.isBase=!0;this._color=r,this.sendDeleteMsg=!1}static build(e,r,i,n,s,a,l,c=ee.BLACK){let h=new yh(su(),r,i,s,a,l,{layerId:e,strokeWidth:n,locked:!1});return new o(h,c)}get color(){return this._color}set color(e){this._color=e,this.refreshRender()}setBBoxModify(){}setLayerModify(e){}};var fn=class extends Le{constructor(e){super();this._fillState=0;C0(e),this.model=e,e.setModelWatcher(this),we.smartMode&&(this.smartPad=new qA(this.model.getBBox(),this.globalIndex)),this.initRefreshRender(),jo("editor/shape/PolygonPad")}get topSolderOutline(){var e;return(e=this.model.getMathGraphics(5))==null?void 0:e.primitives}get topPasteOutline(){var e;return(e=this.model.getMathGraphics(7))==null?void 0:e.primitives}get bottomSolderOutline(){var e;return(e=this.model.getMathGraphics(6))==null?void 0:e.primitives}get bottomPasteOutline(){var e;return(e=this.model.getMathGraphics(8))==null?void 0:e.primitives}get hole(){return this.model.hole}set hole(e){this.hole!=e&&(this.model.hole=e,this.refreshRender())}get pads(){return this.model.pads}get pl(){return this.model.polygonPl}set pl(e){let r=new Sm(e.primitives);this.model.center=r.center;let i=this.pads,n=$o.getPadStyleByPl(e,i[0]);this.model instanceof HS&&(e=e.multiply3(this.model.getPolygonMatrix().inverse().toMatrix3()),n=$o.getPadStyleByPl(e,i[0])),this.model.top!=null&&(this.model.top=n),this.model.bottom!=null&&(this.model.bottom=n),this.model.inner!=null&&(this.model.inner=n),this.refreshRender()}get primitives(){return this.pl.primitives}get center(){return this.model.center}set center(e){let r=e.sub(this.center),i=Ae.translate(r.x,r.y,0);this.transform(i)}get pasteExpansion(){return this.model.pasteExpansion}set pasteExpansion(e){this.model.pasteExpansion=e,this.refreshRender(),this.updateSmartPad()}get topSolderExpansion(){return this.model.topSolderExpansion}set topSolderExpansion(e){this.model.topSolderExpansion=e,this.refreshRender(),this.updateSmartPad()}get bottomSolderExpansion(){return this.model.bottomSolderExpansion}set bottomSolderExpansion(e){this.model.bottomSolderExpansion=e,this.refreshRender(),this.updateSmartPad()}get expansionType(){return this.model.expansionType}set expansionType(e){this.model.expansionType=e,C0(this.model),this.refreshRender()}get rotation(){return this.model.rotation}set rotation(e){let r=e-this.rotation,i=Ae.translate(-this.center.x,-this.center.y,0).rotateZ(r).translate1(this.center.x,this.center.y,0);this.transform(i)}get holeShape(){return this.hole?this.hole.holeShape:"ROUND"}set holeShape(e){this.hole&&e!=null&&(this.model.holeShape=e,this.refreshRender())}get holeRadius(){return this.hole?this.hole.holeRadius:this.getDefaultHoleRadius()}set holeRadius(e){this.hole&&e!=null&&(this.model.holeRadius=e,this.refreshRender())}get holeLength(){return this.hole?this.hole.holeLength:this.getDefaultHoleRadius()*2}set holeLength(e){this.hole&&e!=null&&(this.model.holeLength=e,this.refreshRender())}get holeOffset(){return this.hole?this.hole.holeOffset:new S(0,0)}set holeOffset(e){this.hole&&e!=null&&(this.model.holeOffset=e,this.refreshRender())}get holeRotation(){return this.hole?this.hole.holeRotation:0}set holeRotation(e){this.hole&&e!=null&&(this.model.holeRotation=e)}get expansion(){return this.model.padExpansion}set expansion(e){if(this.expansion!=e){let r=this.model.expansionType;this.model.padExpansion=e,e.expansionType!==r?C0(this.model):this.updateSmartPad(),this.refreshRender()}}get color(){return Oo.getInstance().padConfig.getCustomColor(this.globalIndex)||ze.getSpecialColor(this.net)}set color(e){Oo.getInstance().padConfig.setCustomColor(this.globalIndex,e),this.refreshRender()}get layerId(){return this.model.layerId}set layerId(e){e=this.getLayerId(e),this.layerId!=e&&(this.model.layerId=e,this.layerId==12&&(this.hole=vc.getHoleStyle(this.holeRadius*2,this.getDefaultHoleRadius(),this.holeShape,this.holeRotation,this.holeOffset)),this.refreshRender())}get shapes(){return this.pl}get holeColor(){var e,r,i;return((i=(r=(e=ce)==null?void 0:e.themeConfig)==null?void 0:r.canvasTheme)==null?void 0:i.getHoleColor(this.plated,Oo.getInstance().padConfig.getSelectAlpha(this.selectItem)))||ee.BLACK}get fillState(){return this._fillState}shapeToPl(e){let r=e.map(i=>i.primitive);return fe.build2(r)}getLayerId(e){return e==1||e==2||e==12?e:1}setChildrens(e){this.pl=e}getChildrens(){return this.pl}createPreviewChildrens(){let e=this.layerId;return this.primitives.map(i=>{if(i instanceof M)return Yi.build(e,i.start(),i.end(),.02);if(i instanceof q){let n=i.startAngle/180*Math.PI,s=i.endAngle()/180*Math.PI;return Zo.build(e,i.center,i.rx,.02,n,s,i.sweep())}})}fill(){this._fillState=0,this.refreshRender()}removeFill(){this._fillState=1,this.refreshRender()}deletePoint(e){let i=this.pl.primitives,n=i[e],s=(e-1+i.length)%i.length,a=i[s],l=a?a.start():n.start(),c=new M(l,n.end()),h=Array.from(this.primitives);h.splice(e,1,c),s=h.indexOf(a),h.splice(s,1),this.pl=fe.build2(h)}oppositeLayer(){}getDefaultHoleRadius(){return new Sm(this.primitives).high*.3}flip(e){this.model.flip(e),this.refreshRender()}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}visible(e=!1){super.visible(e),this.smartPad&&this.smartPad.visible()}hidden(){super.hidden(),this.smartPad&&this.smartPad.hidden()}transform(e){this.model.transform(e),this.refreshRender(),this.updateSmartPad()}isSelect4Layer(e,r,i){return this.layerId==12||this.layerId===i?Jr.inPolygon(new S(e,r),[this.pl]):!1}isSelect(e,r,i=!1){return we.smartMode&&i&&this.smartPad&&this.smartPad.isSelect(e,r)?!0:this.model.inShape(e,r)}buildBBox(){let e=this.model.buildBBox();return this.model.refreshBBox&&e!=null&&this.smartPad&&this.smartPad.update(e),this.smartPad!=null&&e!=null?e.extendOfSize(this.smartPad.spotSize):e}getDimensionBBox(){return this.model.getBBox(!0)}toJSON(){let e=this.primitives.map(i=>{if(i instanceof M)return{LINE:{start:i.start(),end:i.end()}};{let{center:n,startAngle:s,rx:a,isCCW:l}=i,c=i.endAngle(),h=l?le.CCW:le.CW;return{ARC:{center:n,startAngle:s,endAngle:c,rx:a,sweep:h}}}});return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,num:this.num,center:this.center,rotation:this.rotation,shapes:e,net:this.net,locked:this.locked,expansionType:this.expansionType,pasteExpansion:this.pasteExpansion,topSolderExpansion:this.topSolderExpansion,bottomSolderExpansion:this.bottomSolderExpansion,unusedInnerLayers:this.unusedInnerLayers,plated:this.plated,holeLength:this.holeLength,holeRadius:this.holeRadius,holeShape:this.holeShape,holeRotation:this.holeRotation,holeOffset:this.holeOffset,padRule:this.toPadRuleJson(),padLen:this.padLen,attrsMap:{...this.model.attrsMap}}}remove(){this.clearRelation(),this.smartPad&&this.smartPad.remove(),super.remove(),this.model.remove(),Oo.getInstance().padConfig.setCustomColor(this.globalIndex,null)}getType(){return 12}getLines(){let e=this.buildBBox();if(e==null)throw new Error("Pad is Empty!!!");let r=[],i=new M(e.LL(),e.LR()),n=new M(e.LR(),e.UR()),s=new M(e.UR(),e.UL()),a=new M(e.UL(),e.LL()),l=new M(e.LL().add(e.UL()).mul(.5),e.UR().add(e.LR()).mul(.5)),c=new M(e.UL().add(e.UR()).mul(.5),e.LR().add(e.LL()).mul(.5));return r.push(i,n,s,a,l,c),r}};var ca=class extends va{constructor(e){super();this.type="Length Dimension";this.model=e,e.setModelWatcher(this),this.initRefreshRender()}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=e,this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get box(){return this.model.text.box}get textPosition(){return this.model.textPosition}set textPosition(e){this.model.textPosition=e}get width(){return this.model.strokeWidth}set width(e){this.model.strokeWidth=e,this.refreshRender()}get unit(){return this.model.unit}set unit(e){this.model.unit=e,this.refreshRender()}get precision(){return this.model.precision}set precision(e){this.model.precision=e,this.refreshRender(),Go.lastPrecision=e}get start(){return this.model.start}set start(e){this.model.calibrateLine([this.start,this.left,this.start,e],!0,!1,0),this.model.start=e,this.refreshRender()}get end(){return this.model.end}set end(e){this.model.calibrateLine([this.end,this.right,this.end,e],!0,!0,1),this.model.end=e,this.refreshRender()}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get strokeWidth(){return this.model.strokeWidth}modifyEnd(e){this.model.end=e,this.model.right=e,this.refreshRender()}modifyDimension(e,r){this.model.start=e,this.model.end=r,this.refreshRender()}get length(){let e=this.model.length*10;this.unit!="mil"&&(e=new ft().conversion1("mil",this.unit,e));let r=Math.pow(10,this.precision);return e=Math.round(e*r)/r,e}set length(e){this.model.length=e,this.refreshRender()}set height(e){this.model.fontSize=e,this.refreshRender()}get height(){return this.model.fontSize}set left(e){this.model.calibrateLine([this.right,this.end,this.left,e],!1,!1,2),this.model.left=e,this.refreshRender()}get left(){return this.model.left}set right(e){this.model.calibrateLine([this.left,this.start,this.right,e],!1,!0,3),this.model.right=e,this.refreshRender()}get right(){return this.model.right}updateText(e){let r=this.model.text;r.position=e}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}transform(e){this.model.transform(e),this.refreshRender()}flip(e){this.model.flip(e),this.refreshRender()}isSelect(e,r){return this.getParent()!=null?!1:this.model.inShape(e,r)}buildBBox(){return this.model.buildBBox()}getLineBBox(){return wB(this.start,this.end,this.left,this.right,this.strokeWidth,this.lineLen,this.arrLineLen)}toJSON(){var r;return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,end:this.end,precision:this.precision,height:this.height,width:this.width,unit:this.unit,locked:this.locked,leftPoint:this.left,rightPoint:this.right,silkColor:((r=this.silkColor)==null?void 0:r.toString())||null,content:this.model.content,valueTextPosition:this.model.text.position}}getCoords(){return[xe(this.left.x*10,4),xe(this.left.y*10,4),xe(this.start.x*10,4),xe(this.start.y*10,4),xe(this.end.x*10,4),xe(this.end.y*10,4),xe(this.right.x*10,4),xe(this.right.y*10,4)]}getBaseGraphics(){return this.model.getBaseGraphics()}getType(){return 5}get textPath(){return this.model.text.outline}get textMatrix(){return this.model.text.matrix}get viewWidth(){return this.model.text.width}get viewHeight(){return this.model.text.height}get lineLen(){return 10}get arrLineLen(){return 3}get outlineModified(){return this.model.text.outlineModified}};var ol=class extends va{constructor(e){super();this.type="Protractor Dimension";this.model=e,e.setModelWatcher(this),this.initRefreshRender()}get textPosition(){return this.model.textPosition}set textPosition(e){this.model.textPosition=e,this.refreshRender()}get box(){return this.model.text.box}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=e,this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get width(){return this.model.strokeWidth}set width(e){e=bo(e),this.model.strokeWidth=e,this.refreshRender()}get precision(){return this.model.precision}set precision(e){this.model.precision=e,is.lastPrecision=e,this.refreshRender()}get center(){return this.model.center}set center(e){this.model.center=e,this.refreshRender()}get height(){return this.model.fontSize}set height(e){e=bo(e),this.model.fontSize=e,this.refreshRender()}get start(){return this.model.start}set start(e){this.model.start=e,this.refreshRender()}get end(){return this.model.end}set end(e){this.model.end=e,this.refreshRender()}get angle(){return this.model.angle}set angle(e){this.model.angle=e,this.refreshRender()}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.model.transform(i),this.refreshRender()}transform(e){this.model.transform(e),this.refreshRender()}flip(e){this.model.flip(e),this.refreshRender()}isSelect(e,r){return this.getParent()!=null?!1:this.model.inShape(e,r)}buildBBox(){return this.model.buildBBox()}getLineBBox(){return PVe(this.center,this.start,this.end,this.strokeWidth)}toJSON(){var r;return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,width:this.width,fontsize:this.model.fontSize,precision:this.precision,center:this.center,end1:this.start,end2:this.end,locked:this.locked,textPosition:this.textPosition,silkColor:((r=this.silkColor)==null?void 0:r.toString())||null}}getCoords(){return[xe(this.start.x*10,4),xe(this.start.y*10,4),xe(this.center.x*10,4),xe(this.center.y*10,4),xe(this.end.x*10,4),xe(this.end.y*10,4)]}getBaseGraphics(){return this.model.getBaseGraphics()}getDegree(){return{center:this.center,radius:this.model.strokeWidth/2+.1,width:this.model.strokeWidth/2}}getType(){return 14}get strokeWidth(){return this.width}get textPath(){return this.model.text.outline}get textMatrix(){return this.model.text.matrix}get viewWidth(){return this.model.text.width}get viewHeight(){return this.model.text.height}get outlineModified(){return this.model.text.outlineModified}};var n6=class extends so{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?or.getInstance().encode("DIMENSION",t.model):null,this.action=e,this.deleteGroupID(t)}rebuild(){let{globalIndex:t,partition:e,layerId:r,start:i,end:n,precision:s,height:a,width:l,unit:c,locked:h,leftPoint:u,rightPoint:d,silkColor:p,content:m,valueTextPosition:g}=this.data,y=p?ee.of3(p):null,b=new S(i.x,i.y),P=new S(n.x,n.y),T=new S(u.x,u.y),I=new S(d.x,d.y),C=Go.rebuild(t,r,b,P,T,I,s,a,l,c,h);return C.updateText(new S(g.x,g.y)),C.partition=e,C.number=this.number,A.publish("hasModifyPcbItem",C),this.addGroupID(C),C.silkColor=y,this.updateFilterStatus(C),this.updateData(),this.data=void 0,C}getItem(){return Go.getItem(this.gId)}remove(){let t=Go.getItem(this.gId);this.data=t.toJSON(),this.number=t.number,t.remove(),A.publish("delete",t),A.publish("hasModifyPcbItem",t),this.updateData()}modify(){let{globalIndex:t,layerId:e,start:r,end:i,precision:n,height:s,width:a,unit:l,locked:c,leftPoint:h,rightPoint:u,silkColor:d,content:p,valueTextPosition:m}=this.data,g=d?ee.of3(d):null,y=new S(r.x,r.y),b=new S(i.x,i.y),P=new S(h.x,h.y),T=new S(u.x,u.y),I=Go.getItem(this.gId),C=I.toJSON();I.globalIndex!=t,!I.left.equals(P)&&!I.right.equals(T)&&!I.start.equals(y)&&!I.end.equals(b)?(I.left=P,I.right=T,I.modifyDimension(y,b)):(I.start.equals(y)||(I.start=y,I.updateText(new S(m.x,m.y))),I.end.equals(b)||(I.end=b,I.updateText(new S(m.x,m.y))),I.left.equals(P)||(I.left=P),I.right.equals(T)||(I.right=T)),I.precision!=n&&(I.precision=n),I.height!=s&&(I.height=s),I.width!=a&&(I.width=a),I.unit!=l&&(I.unit=l),I.locked!=c&&(I.locked=c),this.equals(g,I.silkColor)||(I.silkColor=g),I.layerId!=e&&(I.layerId=e),I.updateText(new S(m.x,m.y)),this.data=C,this.modifyGroupID(I),A.publish("hasModifyPcbItem",I),this.updateData()}equals(t,e){return t!=null&&e!=null?t.equals(e):e==t}upload(t=!1){let e=this.isDelete(t),r=x.getInstance().compiler;e?(r.setTicket(),r.deleteDimension(this.gId)):(this.source==null&&this.updateData(),this.source!=null&&(r.setTicket(),r.uploadDimension(this.gId,this.source))),this.source=null}updateData(){if(this.source==null){let t=Go.getItem(this.gId);t!=null&&(this.source=or.getInstance().encode("DIMENSION",t.model))}}};var Em=class{constructor(t,e,r){this.action=t,this.data=e,this.item=r}};var VR=class{getConnectCommands(t){let e=$a.getInstance().getItem(t),r=new Array;if(e!=null){for(let i of e.relatedIds){let n=this.getItem(i);if(n!=null){let s=Te.dispatch(n,"modify");this.resetConnectItemInfo(n),r.push(s)}}$a.getInstance().delConnect(t)}return r}getItem(t){let e;return e=Zt.getItem(t),e!=null||(e=Xt.getItem(t),e!=null)||(e=pt.getItem(t),e!=null),e}resetConnectItemInfo(t,e=void 0){if(t!=null){let r=t.getComponent();switch(t.type){case"3D Shell - Side Slot Region":r.lineId=e;return;case"3D Shell - Side Entity":r.lineId=e;return;case"Fill Region":r.padId=e;return}}}};var o6=class extends so{constructor(t,e){super(),this.gId=t.globalIndex,this.data=e=="add"?void 0:t.toJSON(),this.number=e=="delete"?t.number:null,this.source=e=="delete"?or.getInstance().encode("PAD",t.model):null;let r=t.getParent();r&&(this.hasParent=!0,this.padNetSource=e=="delete"?or.getInstance().encode("PAD_NET",t.model):null,this.padLen=as.getInstance().getPadLen(r.globalIndex,this.gId)),this.action=e,A.publish("cheakTearDrop",new Em(e,t.toJSON(),t)),this.deleteGroupID(t),ce.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:t.globalIndex,net:t.net,bbox:t.buildBBox()}])}hasConnectChange(){return this.action==="delete"}getConnnectChangeCommand(){return new VR().getConnectCommands(this.gId)}rebuild(){var V;let{globalIndex:t,partition:e,layerId:r,type:i,num:n,center:s,topType:a,topWidth:l,topHeight:c,topRatio:h,bottomType:u,bottomWidth:d,bottomHeight:p,bottomRatio:m,innerType:g,innerWidth:y,innerHeight:b,innerRatio:P,rotation:T,locked:I,net:C,expansionType:E,pasteExpansion:O,topSolderExpansion:_,bottomSolderExpansion:R,unusedInnerLayers:v,plated:D,holeLength:w,holeRadius:F,holeShape:H,holeRotation:z,holeOffset:G,isTestPad:W,padRule:L,padLen:B,attrsMap:N}=this.data;s=new S(s.x,s.y),G=new S(G.x,G.y);let U=Kt.rebuild(t,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v,D,w,F,H,z,G,W,_f.buildByJson(L),B,N),k=(V=U.getParent())==null?void 0:V.globalIndex;return k&&as.getInstance().setPadLen(k,U.globalIndex,this.padLen),U.partition=e,U.number=this.number,A.publish("hasModifyPcbItem",U),this.addGroupID(U),this.updateFilterStatus(U),this.updateData(),this.data=void 0,U}getItem(){return Kt.getItem(this.gId)}remove(){var r;this.updateData();let t=Kt.getItem(this.gId);this.data=t.toJSON(),this.number=t.number,A.publish("hasModifyPcbItem",t),t.remove();let e=(r=t.getParent())==null?void 0:r.globalIndex;e&&as.getInstance().deletePadLen(e,t.globalIndex),A.publish("delete",t)}modify(){var X;let{globalIndex:t,partition:e,layerId:r,type:i,num:n,center:s,topType:a,topWidth:l,topHeight:c,topRatio:h,bottomType:u,bottomWidth:d,bottomHeight:p,bottomRatio:m,innerType:g,innerWidth:y,innerHeight:b,innerRatio:P,rotation:T,locked:I,net:C,expansionType:E,pasteExpansion:O,topSolderExpansion:_,bottomSolderExpansion:R,unusedInnerLayers:v,plated:D,holeLength:w,holeRadius:F,holeShape:H,holeRotation:z,holeOffset:G,padRule:W,padLen:L,attrsMap:B}=this.data;s=new S(s.x,s.y);let N=new S(G.x,G.y),U=Kt.getItem(this.gId),k=U.toJSON();U.partition!=e&&(U.partition=e),U.layerId!=r&&(U.layerId=r),U.num!=n&&(U.num=n),U.type!=i&&(U.type=i),U.padLen!=L&&(U.padLen=L),U.clearMap();for(let Z in B)U.addATTRMap(Z,B[Z]);let V=(X=U.getParent())==null?void 0:X.globalIndex;if(V){let Z=as.getInstance().getPadLen(V,U.globalIndex);as.getInstance().setPadLen(V,U.globalIndex,this.padLen),this.padLen=Z}U.center.equals(s)||(U.center=s),U.top&&(U.top=$o.getStyle(a,l,c,h,U.top.pl)),U.inner&&(U.inner=$o.getStyle(g,y,b,P,U.inner.pl)),U.bottom&&(U.bottom=$o.getStyle(u,d,p,m,U.bottom.pl)),U.rotation!=T&&(U.rotation=T),U.locked!=I&&(U.locked=I),U.net!=C&&(A.publish("hasModifyPcbItem",U),U.net=C),U.expansion=ju.getPadExpansion(E,O,_,R),U.unusedInnerLayers.toString()!=v.toString()&&(U.unusedInnerLayers=v),U.plated!=D&&(U.plated=D),U.hole&&(U.hole=vc.getHoleStyle(w,F,H,z,N));let Y=U.padRule;W==null||Y==null?W!=Y&&(U.padRule=_f.buildByJson(W)):U.padRule=Su.getPadRule(W.connectMode,W.lineClearance,W.lineWidth,W.lineAngle),this.data=k,this.modifyGroupID(U),A.publish("hasModifyPcbItem",U),this.updateData()}upload(t=!1){let e=x.getInstance().compiler,r=e.consistencyManager.getMaxTicket();this.isDelete(t)?(this.padNetSource&&(e.setTicket(++r),e.deletePadNet(this.padNetSource.componentId,this.padNetSource.padNum,this.padNetSource.padId)),this.hasParent||(e.setTicket(++r),e.deletePad(this.gId))):(this.source==null&&this.updateData(),this.padNetSource&&(e.setTicket(++r),e.uploadPadNet(this.padNetSource)),!this.hasParent&&this.source&&(e.setTicket(++r),e.uploadPad(this.gId,this.source))),this.padNetSource=void 0,this.source=void 0}updateData(){if(this.source==null){let t=Kt.getItem(this.gId);if(t!=null){let e=t.getParent();this.source=or.getInstance().encode("PAD",t.model),this.padNetSource=e&&or.getInstance().encode("PAD_NET",t.model)}}}};var W3t=new Set(["3D Shell - Outline","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Screw Pillar","3D Shell - Side Datum Line","3D Shell - Top/Bottom Entity","3D Shell - Side Entity"]),Nl=class{constructor(t,e,r=[]){this.type=e,t===null?this.componentData=t:typeof t=="string"?this.componentData=t:this.componentData=JSON.stringify(t),Array.isArray(r)&&!ce.pcbConfig.isRebuildCopperAuto?this.copperData=JSON.stringify(r):this.copperData=JSON.stringify([])}is3DShell(){return W3t.has(this.type)}rebuildComponent(t){let e=t.getComponent();this.updateComponent(e,t.globalIndex,t)}setComponentData(t,e){this.componentData=t,this.copperData=e}modifyComponent(t){let e=t.getComponent();this.updateComponent(e,t.globalIndex,t)}updateComponent(t,e,r){try{t instanceof K0?this.updateD3ShellOutlineComponent(t,e):t instanceof um?this.updateD3ShellScrewPillarComponent(t,e):t instanceof ou?this.updateD3ShellSlotRegionComponent(t,e):t instanceof wl?this.updateD3ShellEntityComponent(t,e):t instanceof Vn?this.updateFillComponent(t,e,r):t instanceof fd?this.updateProhibitComponent(t,e):t instanceof nu?this.updateConstraintComponent(t,e):t instanceof ln?this.updateBridgingCopperComponent(t,e,r):t instanceof Du?this.updateFPCStiffenerComponent(t,e):t instanceof J2?this.updateTearDropComponent(t,e):t instanceof Dc&&this.updatePartitionComponent(t,e)}catch(i){console.error("Component update failed",i)}}deleteComponent(t){let e=t==null?void 0:t.getComponent();e instanceof ln?$a.getInstance().delConnectRelatedId(e.padId,t.globalIndex):(e instanceof wl||e instanceof ou)&&$a.getInstance().delConnectRelatedId(e.lineId,t.globalIndex)}updateD3ShellOutlineComponent(t,e){let{shellHeight:r,botShellHeight:i,pushCoverDir:n,topInnerHeight:s,bottomInnerHeight:a,substrateHeight:l,type:c,shellThickness:h}=JSON.parse(this.componentData);t.shellHeight!==r&&(t.shellHeight=r),t.pushCoverDir!==n&&(t.pushCoverDir=n),t.botShellHeight!==i&&(t.botShellHeight=i),t.substrateHeight!==l&&(t.substrateHeight=l),t.type!==c&&(t.type=c),t.shellThickness!==h&&(t.shellThickness=h),t.topInnerHeight!==s&&(t.topInnerHeight=s),t.bottomInnerHeight!==a&&(t.bottomInnerHeight=a)}updateD3ShellScrewPillarComponent(t,e){let{specification:r,height:i,holeDiameter:n,thickness:s,counterboreProps:a,stiffenerProps:l}=JSON.parse(this.componentData);t.specification!==r&&(t.specification=r),t.height!==i&&(t.height=i),t.holeDiameter!==n&&(t.holeDiameter=n),t.thickness!==s&&(t.thickness=s),JSON.stringify(t.counterboreProps)!==JSON.stringify(a)&&(t.counterboreProps=a),JSON.stringify(t.stiffenerProps)!==JSON.stringify(l)&&(t.stiffenerProps=l)}updateD3ShellSlotRegionComponent(t,e){let{lineId:r,type:i,slotDepth:n,slotOption:s}=JSON.parse(this.componentData),a=$a.getInstance(),l=t.lineId;l&&a.delConnectRelatedId(l,e),r&&a.addConnectRelatedId(r,e),l!==r&&(t.lineId=r),t.type!==i&&(t.type=i),t.slotDepth!==n&&(t.slotDepth=n),t.slotOption=s}updateD3ShellEntityComponent(t,e){let{lineId:r,type:i,stretchLength:n,belong:s}=JSON.parse(this.componentData),a=$a.getInstance(),l=t.lineId;l&&a.delConnectRelatedId(l,e),r&&a.addConnectRelatedId(r,e),l!==r&&(t.lineId=r),t.type!==i&&(t.type=i),t.stretchLength!==n&&(t.stretchLength=n),t.belong!==s&&(t.belong=s)}updateFillComponent(t,e,r){let{style:i,gridLineWidth:n,clearance:s,keepIsland:a,optimization:l,name:c,optimizationValue:h,order:u}=JSON.parse(this.componentData),d=JSON.parse(this.copperData);r&&JSON.stringify(t.copperResult)!=this.copperData&&(t.copperResult=d),t.style!==i&&(t.style=i),t.gridLineWidth!==n&&(t.gridLineWidth=n),t.clearance!==s&&(t.clearance=s),t.keepIsland!==a&&(t.keepIsland=a),t.optimization!==l&&(t.optimization=l),t.name!==c&&(t.name=c),t.optimizationValue!==h&&(t.optimizationValue=h),t.order!==u&&(t.order=u)}updateProhibitComponent(t,e){let{device:r,track:i,copper:n,fill:s,planzone:a}=JSON.parse(this.componentData);t.device!==r&&(t.device=r),t.track!==i&&(t.track=i),t.copper!==n&&(t.copper=n),t.fill!==s&&(t.fill=s),t.planzone!==a&&(t.planzone=a)}updateConstraintComponent(t,e){let{name:r}=JSON.parse(this.componentData);t.name!==r&&t.modifyName(r)}updateBridgingCopperComponent(t,e,r){if(!this.componentData)return;let{padId:i,isBridgingCopper:n,networkList:s}=JSON.parse(this.componentData),a=t.padId;if(t.padId!==i){t.padId=i;let l=$a.getInstance();i==null?a&&l.delConnectRelatedId(a,e):l.addConnectRelatedId(i,e)}t.isBridgingCopper!==n&&(t.isBridgingCopper=n,n&&(ze.delete(r),r.model.netModified=!0)),Tte(t.networkList,s,!0)||(t.networkList=s)}updateFPCStiffenerComponent(t,e){let{material:r,fpcModel:i,thickness:n}=JSON.parse(this.componentData);t.material!==r&&(t.material=r),t.fpcModel!==i&&(t.fpcModel=i),t.thickness!==n&&(t.thickness=n)}updateTearDropComponent(t,e){let{connects:r}=JSON.parse(this.componentData);t.connects!==r&&(t.connects=r,pt.addConncect(pt.getItem(e),r))}updatePartitionComponent(t,e){let{fileUuid:r,name:i}=JSON.parse(this.componentData);t.fileUuid!==r&&(t.fileUuid=""),t.name!==i&&(t.name=i)}};var Hie=new ZA(o=>{let t=new Sd(10);return o.forEach((e,r)=>{r!==0&&t.insert(e)}),t});var ii=class extends A0{constructor(t){super(),this.model=t,t.setModelWatcher(this),this.pls.length==1&&this.pls[0].primitives.length==1&&this.pls[0].primitives[0]instanceof M&&this.model.style=="solid"&&(this.model.style="90grid"),this.initRefreshRender()}isSelect(t,e){let{style:r,optimization:i,gridLineWidth:n,optimizationWidth:s,pls:a}=this,l=new S(t,e);switch(r){case"solid":{let c=Kx.pipsSASM(l,a,Hie.get(a));if(!c&&i){for(let h of Hie.get(a).search(l.bbox().extendOfSize(this.optimizationWidth+1e-5)))for(let u of h.primitives)if(u instanceof M?c=Xa(l,u.start(),u.end(),s):u instanceof q&&(c=xf(l,u.center,u.rx,u.startAngle/180*Math.PI,u.endAngle()/180*Math.PI,u.sweep(),s)),c)return c}return c}case"90grid":case"45grid":{let c=!1;for(let h of a)for(let u of h.primitives)if(u instanceof M?c=Xa(l,u.start(),u.end(),n):u instanceof q&&(c=xf(l,u.center,u.rx,u.startAngle/180*Math.PI,u.endAngle()/180*Math.PI,u.sweep(),n)),c)return c;return!1}case"none":break}return!1}get viewGroupId(){return this.model.modelType+this.net}get style(){return this.model.style}get gridLineWidth(){return this.model.gridLineWidth}get clearance(){return this.model.clearance}get optimization(){return this.model.optimization}get optimizationWidth(){return this.model.optimizationWidth}get isSolid(){return this.model.style=="solid"}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId!=t&&(this.model.layerId=t,this.refreshRender())}get viewColor(){var i,n;let t=this.color,e=(n=(i=ce)==null?void 0:i.themeConfig)==null?void 0:n.canvasTheme;if(e){let s=e.copperRegionTransparency;t=ee.of6(t,1-s)}let r=Bt.getTransparencyByPcbType(this,t);return r&&t.alpha!=r&&(t=ee.of6(t,r)),t}get isPlaneZone(){return!1}get viewStyle(){return this.style}fill(){$t.getVisible(21)?this.visible():this.hidden()}rotateFor(t,e){}visible(t=!1){super.visible(t)}getOutline(t=this.layerId,e=0){return this.pls}getRealOutline(){return this.model.getRealOutline()}get syncSelectCheckParent(){return!1}remove(){super.remove(),Hie.map.delete(this.pls)}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,net:this.net,style:this.style,gridLineWidth:this.gridLineWidth,clearance:this.clearance,optimization:this.optimization,copperPath:this.copperPath,optimizationWidth:this.optimizationWidth}}};var s6=class{constructor(t,e=!0){this._layerId=t,this._keepIsland=e}get layerId(){return this._layerId}set layerId(t){this._layerId=t}get keepIsland(){return this._keepIsland}set keepIsland(t){this._keepIsland=t}toJSON(){return{layerId:this._layerId,keepIsland:this._keepIsland}}};var Ki=class extends A0{constructor(t){super(),this.model=t,t.setModelWatcher(this);let e=t.layerId;be.getActiveLayerID()!=this.layerId?this.hidden():this.fill();let r=be.fetchPlanzoneLayerKeepIsland(e),i=typeof r>"u"?!0:r;if(!Xd.hasProfileItem(e))Xd.addProfileItem(e,new s6(e,i));else{let n=Xd.fetchProfileItem(e);n.keepIsland=i,Xd.updateProfileItem(e,n)}}get style(){return this.model.style}set style(t){this.model.style=t}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId!=t&&(this.model.layerId=t,this.refreshRender())}get viewColor(){let t=this.color,e=Bt.getTransparencyByPcbType(this,t);return e!=null&&t.alpha!=e&&(t=ee.of6(t,e)),t}get viewStyle(){return this.style?"solid":"none"}get isPlaneZone(){return!0}get gridLineWidth(){return 0}get optimization(){return!1}fill(){this.refreshRender()}transform(t){}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,net:this.net,style:this.style,copperPath:this.copperPath}}getOutline(t,e){return this.pls}};function z3t(o,t){return(e,r,i=!0)=>(o.whetherCheckNet=i,o.needCheckIntersection(e,r)?t.checkIntersection(e,r):!1)}var CSe=class{constructor(t){this.item=t,this._box=t.buildBBox()}bbox(){return this._box}},ESe=["Track","ArcTrack","Pad","Via","Polygon","Circle","Rect","Copper","Inner"],SSe=class{constructor(t){this.parent=new Uint32Array(t),this.rank=new Uint32Array(t);for(let e=0;e<t;e++)this.parent[e]=e,this.rank[e]=0}find(t){return this.parent[t]!==t&&(this.parent[t]=this.find(this.parent[t])),this.parent[t]}union(t,e){let r=this.find(t),i=this.find(e);r!==i&&(this.rank[r]<this.rank[i]?this.parent[r]=i:this.rank[r]>this.rank[i]?this.parent[i]=r:(this.parent[i]=r,this.rank[r]++))}getGroups(){var e;let t=new Map;for(let r=0;r<this.parent.length;r++){let i=this.find(r);t.has(i)||t.set(i,[]),(e=t.get(i))==null||e.push(r)}return t}recycle(){this.parent=null,this.rank=null}},ib=class{constructor(t,e){this.groups=new Array;this.treeMap=new Map;this.map=new Map;let r=new Hd,i=new Uy;this.isTouch=z3t(r,i),this.items=this.filter(t),this.excluded=e==null?new Set(t):e;let n=0;this.items.forEach(s=>{this.map.set(s,n++),this.insert(s)}),_u.getInstance().clear()}insert(t){let e=new CSe(t),r=t.model;if(r instanceof ki){let i=r.modelType,n=r.layerId,s=this.treeMap.get(i);s==null&&(s=new Map,this.treeMap.set(i,s));let a=s.get(n);a==null&&(a=new Sd(15),s.set(n,a)),a.insert(e)}}filter(t){return t=t.filter(e=>{var r;return e instanceof Le||e instanceof Ue||e instanceof Ge?!0:e instanceof Ye&&(e.type=="Line"||e.type=="Fill Region")&&((r=be.getLayer(e.layerId))==null?void 0:r.isSignalLayer())||!1}),t}updateScene(){if(this.items.length>1){let e=(()=>{var l;let r=new SSe(this.items.length),i=!1,n=Array.from(this.treeMap.entries()).map(([c,h])=>{let u=new Map(Array.from(h.entries()).sort(([,d],[,p])=>d.items.size-p.items.size));return[c,u]}),s=new Set(n.map(([c])=>c));for(let[c,h]of n){for(let[,u]of h){let d=this.getSearchLayerIds(c,Array.from(u.items)[0].item);for(let p of s){i=p==c;for(let m of d){let g=(l=this.treeMap.get(p))==null?void 0:l.get(m);if(g!=null)for(let y of u.items){let b=y.item,P=this.map.get(b);g.search2Cb(b.buildBBox(),T=>{let I=T.item,C=this.map.get(I);if(i&&C<=P)return;this.isTouch(b.model,I.model)&&r.union(P,C)})}}}u.recycle()}s.delete(c)}let a=r.getGroups();return r.recycle(),a})();this.groups=Array.from(e.values()).map(r=>r.map(i=>this.items[i])),this.scene=this.groups.length<=1?1:2}else this.items.length===1?this.scene=0:this.scene=void 0}getSearchLayerIds(t,e){let r;switch(t){case"Track":case"ArcTrack":r=[e.layerId,12];break;case"Pad":e.layerId==12?(r=be.getAllCopperLayerIds(),r.push(12)):r=[e.layerId,12];break;case"Via":r=be.getAllCopperLayerIds(),r.push(12);break;case"Polygon":case"Rect":case"Circle":e instanceof Ye&&mp(e.layerId)&&(e.type=="Fill Region"||e.type=="Copper Region"||e.type=="Line"||e.type=="TearDrop")?r=[e.layerId,12]:r=[];break;case"Copper":case"Inner":e instanceof A0?r=[e.layerId,12]:r=[];break;default:{r=[];break}}return r}getNetPcbItems(t){let e=new Set,r=new Set,i=!1;switch(this.scene){case 0:let n=this.items[0];if(r=this.getNearItems(n),r.size==0)break;r=this.filterItemNet(r),r=$t.selectItemFilter(t.sceneX,t.sceneY,r),r=this.checkIntersection(n,r);let s=this.getNearItemNets(r);s.size>1&&(i=!0),e.add({group:this.items,nets:s});break;case 1:case 2:for(let a of this.groups){if(!a)continue;let l=new Set;for(let c of a){let h=this.getNearItems(c);if(h.size==0)continue;h=this.filterItemNet(h),h=$t.selectItemFilter(t.sceneX,t.sceneY,h),h=this.checkIntersection(c,h);let u=this.getNearItemNets(h);if(u.size>1){i=!0;break}Re.addAllSet(l,u)}l.size===1&&e.add({group:a,nets:l})}break}return{netsGroupSet:e,isMoreThan2Nets:i}}getNearItems(t){let e=new Set,r;if(t instanceof Le?t.layerId==12?r=(i,n)=>!!(i&&mp(i)||i==12):r=(i,n)=>t.layerId==i||i==12:t instanceof Ue?r=(i,n)=>t.layerId==i||i==12:t instanceof Ge?r=(i,n)=>!!(i&&t.isContains(i)||i==12):t instanceof Ye&&(t.layerId==12?r=(i,n)=>!!(i&&mp(i)||i==12):r=(i,n)=>t.layerId==i||i==12),r!=null){let i=Vt.search4Types(t.buildBBox(),ESe,r);for(let n of i.getResult(dd))t!==n&&(this.excluded.has(n)||e.add(n))}return e}getConnectItems(){let t=this.items[0];if(t==null)return new Set;let e=this.getNearItems(t);return this.checkIntersection(t,e)}filterItemNet(t){let e=new Set;return t.forEach(r=>{var i;(r instanceof Ue||r instanceof Ge||r instanceof Ri||r instanceof fn||r instanceof ii||r instanceof Ki||r instanceof Ye&&(r.type=="Line"||r.type=="Fill Region")&&((i=be.getLayer(r.layerId))!=null&&i.isSignalLayer()))&&e.add(r)}),e}getNearItemNets(t){let e=new Set;return t.forEach(r=>{let i=r.net;i&&!e.has(i)&&e.add(i)}),e}checkIntersection(t,e){let r=new Set;return e.forEach(i=>{this.isTouch(t.model,i.model,!1)&&r.add(i)}),r}recycle(){this.excluded=null,this.groups=null,this.treeMap=null,this.map=null,this.items=null}};var _n=class extends zs{constructor(t){super();let e=new er;this._startNode=e.getConnectNode(t.startId),this._endNode=e.getConnectNode(t.endId),this.model=t,t.setModelWatcher(this),this._startNode.addRatline(this),this._endNode.addRatline(this),this.refreshRender()}get start(){return this.model.start}set start(t){this.model.start.equals(t)||(this.model.start=t,this.refreshRender())}get locked(){return this.model.locked}set locked(t){this.model.locked=t}get end(){return this.model.end}set end(t){this.model.end.equals(t)||(this.model.end=t,this.refreshRender())}get startNode(){return this._startNode}get endNode(){return this._endNode}get net(){return this.model.net.toUpperCase()}get showNet(){return this.model.net}get color(){return this._color||ze.getSpecialColor(this.net)}set color(t){t?this._color=t:delete this._color}get layerId(){return this.model.layerId}get viewGroupId(){return this.model.modelType+this.net}get viewGroupIdModified(){return!1}getInfoForConnectType(t){if(t instanceof Ue)return{type:"Track",id:`${ur}${t.number}`,net:t.net,globalIndex:t.globalIndex};if(t instanceof Ge)return{type:"Via",id:`${ur}${t.number}`,net:t.net,globalIndex:t.globalIndex};if(t instanceof Le){let e=t.getParent();return e instanceof Me?{type:e.name,id:t.num,net:t.net,globalIndex:t.globalIndex}:{type:"Pad",id:`${ur}${t.number}`,net:t.net,globalIndex:t.globalIndex}}else return t instanceof Ye?{type:t.type,id:`${ur}${t.number}`,net:t.net||"",globalIndex:t.globalIndex}:t instanceof ii?{type:"Copper Region(Filled)",id:`${ur}${t.number}`,net:t.net,globalIndex:t.globalIndex}:t instanceof Ki?{type:"Plane Zone",id:`${ur}${t.number}`,net:t.net,globalIndex:t.globalIndex}:null}rotateFor(t,e){this.model.rotateFor(t,e)}remove(){this._startNode.removeRatline(this),this._endNode.removeRatline(this),this.model.remove(),super.remove()}getViewState(){return this.isEmpty?"Not Shown":this.isVisible?this.isHighLight?"Main And Highlight":"Only Main":"Not Shown"}getType(){return 25}transform(t){}isSelect(t,e){return this.model.inShape(t,e)}getEndsInfo(){return{start:this.getInfoForConnectType(this.startNode),end:this.getInfoForConnectType(this.endNode)}}buildBBox(){return this.model.buildBBox()}getLength(){return this.model.length}};function Bo(o){return o instanceof ds||o instanceof _n?o.showNet:null}function nb(o){if(o instanceof Ye&&["Line","Copper Region","Fill Region"].includes(o.type)||o instanceof fn){let t=o.net;if(o.net)return;if(be.getLayer(o.layerId).isSignalLayer()){let e;if(o instanceof Ye&&o.type=="Copper Region"){let i=o.getMathGraphics();e=Wr.getSelectContect(i)}else e=new ib([o]).getConnectItems();let r=new Set;for(let i of e)if(i.layerId==o.layerId||gr(i.layerId)||i instanceof Ge){let n=Bo(i);n&&r.add(n)}r.size>0&&(r.has("GND")?t="GND":t=Array.from(r)[0])}o.net=t}}function ZS(){let o=Xt.getAllItem(),t=Zt.getAllItem(),e=pt.getAllItem();return[].concat(o,t,e)}function W1(o){return Xt.getItem(o)||Zt.getItem(o)||pt.getItem(o)}var LT=class o{constructor(){this.data=new Set}static getInstance(){return o.proxy||(o.proxy=new o),o.proxy}addData(t){this.data.add(t)}upload(){let t=x.getInstance().compiler;this.data.forEach(e=>{t.setTicket();let r=W1(e);if(r&&r.type=="Copper Region"){let i=or.getInstance().encode("POURED",Array.from(r.copperResultMap||[]));t.uploadPoured(e,i)}else t.deletePoured(e)}),this.data.clear()}};var GR=class extends so{constructor(e,r){super();this.hasCommand=!0;if(ce.pcbConfig.isRebuildCopperAuto){this.hasCommand=!1;return}this.gId=e.globalIndex,this.data=r=="add"?void 0:e.toJSON(),this.action=r,this.deleteGroupID(e);let i=e.getParent();i!=null&&(this.parentGId=i.globalIndex)}rebuild(){if(!this.hasCommand)return;let r=new er().getItem(this.parentGId),{globalIndex:i,layerId:n,net:s,style:a,gridLineWidth:l,clearance:c,optimization:h,copperPath:u,optimizationWidth:d}=this.data,p=Ei.rebuildCopper(i,n,s,a,l,c,h,u,d);return this.addGroupID(p),r!=null&&(r.addCopperResult(p),r.model.addCopper(this.gId),p.setParent(r),r.refreshRender()),this.updateFilterStatus(p),A.publish("hasModifyPcbItem",p),this.updateData(),this.data=void 0,p}getItem(){return Ei.getItem(this.gId)}remove(){if(!this.hasCommand)return;let r=new er().getItem(this.parentGId),i=Ei.getItem(this.gId);i&&(A.publish("hasModifyPcbItem",i),this.data=i.toJSON(),i.remove(),r!=null&&(r.model.deleteCopper(this.gId),r.deleteCopperResult(i,i.globalIndex)),A.publish("delete",i),this.updateData())}modify(){if(!this.hasCommand)return;let{globalIndex:e,layerId:r,net:i,style:n,gridLineWidth:s,clearance:a,optimization:l,copperPath:c,optimizationWidth:h}=this.data,u=Ei.getItem(this.gId);if(!u)return;let d=u.toJSON();u.net!=i&&(u.net=i),u.copperPath.toString()!=c.toString()&&(u.pls=vu(c)),this.data=d,this.modifyGroupID(u),this.updateData(),A.publish("hasModifyPcbItem",u)}upload(e=!1){LT.getInstance().addData(this.parentGId)}updateData(){}};var UR=class{constructor(){this.coppers=new Array}recordCopperCommand(t,e){e=="delete"&&(t.iteratorCopper(r=>{ce.pcbConfig.isRebuildCopperAuto||this.coppers.push(new GR(r,e)),LT.getInstance().addData(t.globalIndex)}),LT.getInstance().upload())}rebuildCoppers(){for(let t of this.coppers)t.rebuild(),LT.getInstance().addData(t.parentGId);LT.getInstance().upload()}removeCoppers(){for(let t of this.coppers)t.remove(),LT.getInstance().addData(t.parentGId)}};var c3=class extends so{constructor(e,r){super();this.dataMap=new Map;this.hasCommand=!0;if(this.parentGId=e.globalIndex,ce.pcbConfig.isRebuildCopperAuto){this.hasCommand=!1;return}this.action=r,r!="add"&&e.iteratorCopper(i=>{this.dataMap.set(i.globalIndex,i.toJSON())})}rebuild(){if(!this.hasCommand)return;let e=W1(this.parentGId);this.do(e),this.updateFilterStatus(e)}do(e){let r=new Map;e.iteratorCopper(i=>{r.set(i.globalIndex,i.toJSON()),A.publish("hasModifyPcbItem",i),i.remove(),e!=null&&(e.model.deleteCopper(this.gId),e.deleteCopperResult(i,i.globalIndex)),A.publish("delete",i),this.updateData()});for(let[,i]of this.dataMap){let{globalIndex:n,layerId:s,net:a,style:l,gridLineWidth:c,clearance:h,optimization:u,copperPath:d,optimizationWidth:p}=i,m=Ei.rebuildCopper(n,s,a,l,c,h,u,d,p);this.modifyGroupID(m),e!=null&&(e.addCopperResult(m),e.model.addCopper(n),m.setParent(e),e.refreshRender()),m.fill(),A.publish("hasModifyPcbItem",m),this.updateData()}this.dataMap=r}remove(){if(!this.hasCommand)return;let e=W1(this.parentGId);this.do(e)}modify(){if(!this.hasCommand)return;let e=W1(this.parentGId);this.do(e)}getItem(){return"ignore"}upload(e){let r=x.getInstance().compiler;r.setTicket();let i=W1(this.parentGId);if(i&&i.type=="Copper Region"){let n=or.getInstance().encode("POURED",Array.from(i.copperResultMap||[]));r.uploadPoured(this.parentGId,n)}else r.deletePoured(this.parentGId)}updateData(){}};var QA=class extends Wg{constructor(e,r){super();this.copperTool=new UR;let i=e.getComponent(),n=i instanceof Vn?i.copperResult:[];this.gId=e.globalIndex,this.type=e.type,this.number=r=="delete"?e.number:null,this.data=r=="add"?void 0:e.toJSON(),this.source=r=="delete"?or.getInstance().encodeProfile(e.model):null,this.tool=new Nl(JSON.stringify(e.getComponent()),e.type,n),this.action=r,this.deleteGroupID(e),this.copperTool.recordCopperCommand(e,r),ce.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:e.globalIndex,net:e.net,bbox:e.buildBBox()}])}rebuild(){let{globalIndex:e,partition:r,type:i,layerId:n,center:s,radius:a,strokeWidth:l,locked:c,net:h,silkColor:u,regionRuleSelector:d,componentData:p}=this.data,m=u?ee.of3(u):null,g=new S(s.x,s.y),y=this.rebuildCircle(e,i,n,g,a,l,c,h,m);return y.partition=r,y.number=this.number,A.publish("hasModifyPcbItem",y),this.addGroupID(y),this.updateFilterStatus(y),this.tool.rebuildComponent(y),this.copperTool.rebuildCoppers(),y.type==="FPC Stiffener"?A.publish("checkOpenStiffenerLayer",{notShowTip:!0}):y.type=="Partition"&&this.rebuildPartition(y),this.rebuildRegionSelector(y,d),this.updateData(),this.data=void 0,y}rebuildCircle(e,r,i,n,s,a,l,c,h){return Zt.rebuild(e,r,i,n,s,a,l,c,h)}getItem(){return Zt.getItem(this.gId)}remove(){let e=this.getItem();this.data=e.toJSON(),this.number=e.number,this.tool.deleteComponent(e);let r=e.getComponent(),i=r?JSON.stringify(r):"{}",n=r instanceof Vn?JSON.stringify(r.copperResult):"[]";this.tool.setComponentData(i,n),A.publish("hasModifyPcbItem",e),this.copperTool.removeCoppers(),e.remove(),this.removeRegionSelector(),A.publish("delete",e),this.updateData()}modify(){let{globalIndex:e,type:r,layerId:i,center:n,radius:s,strokeWidth:a,locked:l,net:c,silkColor:h,regionRuleSelector:u}=this.data,d=h?ee.of3(h):null,p=new S(n.x,n.y),m=this.getItem(),g=m.toJSON(),y=m.getComponent(),b=y?JSON.stringify(y):"{}",P=y instanceof Vn?JSON.stringify(y.copperResult):"[]";m.removeFill(),m.type!=r&&(m.type=r),m.layerId!=i&&(m.layerId=i),m.center.equals(p)||(m.center=p),m.radius!=s&&(m.radius=s),m.strokeWidth!=a&&(m.strokeWidth=a),m.locked!=l&&(m.locked=l),m.net!=c&&(A.publish("hasModifyPcbItem",m),m.net=c),this.equals(d,m.silkColor)||(m.silkColor=d),this.data=g,this.modifyGroupID(m),this.tool.modifyComponent(m),this.tool.setComponentData(b,P),this.modifyRegionSelector(m,u),m.fill(),m.toggleCopperResult(!m.hiddenCopperResult),A.publish("hasModifyPcbItem",m),this.updateData()}compareDataChange(e){let r=Zt.getItem(this.gId);if(!r||this.action!=="modify")return!0;let i=this.data,n=r.toJSON(),s=["center","radius","strokeWidth","type"];if(a(n,s)!==a(i,s)&&(r.type=="Copper Region"||i.type=="Copper Region"))return e.push(new c3(r,"delete")),r.clearCopper(),!0;if(JSON.stringify(this.data)!==JSON.stringify(r))return!0;return!1;function a(l,c){let h=c.map(u=>l[u]);return JSON.stringify(h)}}comparePourChange(){let e=this.data,r=Zt.getItem(this.gId);return!r||this.action!=="modify"?{action:"fullUpdate",data:null}:e.type=="Copper Region"&&r.type!=="Copper Region"?{action:"fullUpdate",data:null}:e.type!=="Copper Region"&&r.type=="Copper Region"?{action:"fullUpdate",data:null}:r.model.component.name!==e.componentData.name?{action:"halfUpdate",data:{id:r.globalIndex,key:"name",value:r.model.component.name}}:r.net!==e.net?{action:"halfUpdate",data:{id:r.globalIndex,key:"net",value:r.net}}:r.layerId!==e.layerId?{action:"halfUpdate",data:{id:r.globalIndex,key:"layerId",value:r.layerId}}:{action:"notUpdate",data:null}}upload(e=!1){let r=x.getInstance().compiler,i=r.consistencyManager.getMaxTicket();this.isDelete(e)?(r.setTicket(++i),qI(this.gId,this.type)):(this.source==null&&this.updateData(),r.setTicket(++i),KE(this.gId,this.type,this.source)),this.source=null}updateData(){if(this.source==null){let e=Zt.getItem(this.gId);e!=null&&(this.source=or.getInstance().encodeProfile(e.model),this.type=e.type)}}};var a6=class extends so{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?or.getInstance().encode("DIMENSION",t.model):null,this.action=e,this.deleteGroupID(t)}rebuild(){let{globalIndex:t,partition:e,layerId:r,width:i,fontsize:n,precision:s,center:a,end1:l,end2:c,locked:h,textPosition:u,silkColor:d}=this.data,p=d?ee.of3(d):void 0,m=new S(a.x,a.y),g=new S(l.x,l.y),y=new S(c.x,c.y),b=new S(u.x,u.y),P=is.rebuild(t,r,i,n,s,m,g,y,h);return P.textPosition=b,P.partition=e,P.number=this.number,A.publish("hasModifyPcbItem",P),this.addGroupID(P),P.silkColor=p,this.updateFilterStatus(P),this.updateData(),this.data=void 0,P}getItem(){return is.getItem(this.gId)}remove(){let t=is.getItem(this.gId);this.data=t.toJSON(),this.number=t.number,A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t),this.updateData()}modify(){let{globalIndex:t,layerId:e,width:r,fontsize:i,precision:n,center:s,end1:a,end2:l,locked:c,textPosition:h,silkColor:u}=this.data,d=u?ee.of3(u):void 0,p=new S(s.x,s.y),m=new S(a.x,a.y),g=new S(l.x,l.y),y=new S(h.x,h.y),b=is.getItem(this.gId),P=b.toJSON();b.layerId!=e&&(b.layerId=e),b.width!=r&&(b.width=r),b.height!=i&&(b.height=i),b.precision!=n&&(b.precision=n),b.center.equals(p)||(b.center=p),b.start.equals(m)||(b.start=m),b.end.equals(g)||(b.end=g),b.textPosition.equals(y)||(b.textPosition=y),b.locked!=c&&(b.locked=c),d||(b.silkColor=void 0),this.equals(b.silkColor,d)||(b.silkColor=d),this.data=P,this.modifyGroupID(b),A.publish("hasModifyPcbItem",b)}equals(t,e){return t!=null&&e!=null?t.equals(e):e==t}upload(t=!1){let e=this.isDelete(t),r=x.getInstance().compiler;e?(r.setTicket(),r.deleteDimension(this.gId)):(this.source==null&&this.updateData(),this.source!=null&&(r.setTicket(),r.uploadDimension(this.gId,this.source))),this.source=void 0}updateData(){if(this.source==null){let t=is.getItem(this.gId);t!=null&&(this.source=or.getInstance().encode("DIMENSION",t.model))}}};var e_=class extends Wg{constructor(e,r){super();this.copperTool=new UR;let i=e.getComponent(),n=i instanceof Vn?i.copperResult:[];this.gId=e.globalIndex,this.type=e.type,this.number=r=="delete"?e.number:null,this.data=r=="add"?void 0:e.toJSON(),this.source=r=="delete"?or.getInstance().encodeProfile(e.model):null,this.tool=new Nl(JSON.stringify(i),e.type,n),this.action=r,this.deleteGroupID(e),this.copperTool.recordCopperCommand(e,r),ce.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:e.globalIndex,net:e.net,bbox:e.buildBBox()}])}rebuild(){let e=this.data,{globalIndex:r,partition:i,type:n,layerId:s,start:a,width:l,height:c,net:h,locked:u,strokeWidth:d,rotation:p,silkColor:m,cornerRadius:g,componentData:y}=e,b=m?ee.of3(m):null,P=new S(a.x,a.y),T=this.rebuildRect(r,n,s,P,l,c,h,u,d,p,g,b);return T.partition=i,T.number=this.number,A.publish("hasModifyPcbItem",T),this.addGroupID(T),this.updateFilterStatus(T),this.tool.rebuildComponent(T),this.copperTool.rebuildCoppers(),T.type==="FPC Stiffener"?A.publish("checkOpenStiffenerLayer",{notShowTip:!0}):T.type=="Partition"&&this.rebuildPartition(T),this.rebuildRegionSelector(T,e.regionRuleSelector),this.updateData(),this.data=void 0,T}rebuildRect(e,r,i,n,s,a,l,c,h,u,d,p){return Xt.rebuild(e,r,i,n,s,a,l,c,h,u,d,p)}getItem(){return Xt.getItem(this.gId)}remove(){let e=this.getItem();this.data=e.toJSON(),this.number=e.number,A.publish("hasModifyPcbItem",e);let r=e.getComponent(),i=r?JSON.stringify(r):"{}",n=r instanceof Vn?JSON.stringify(r.copperResult):"[]";this.tool.setComponentData(i,n),this.tool.deleteComponent(e),this.copperTool.removeCoppers(),e.remove(),this.removeRegionSelector(),A.publish("delete",e),this.updateData()}modify(){let e=this.data,{globalIndex:r,type:i,layerId:n,start:s,width:a,height:l,net:c,locked:h,strokeWidth:u,rotation:d,silkColor:p,cornerRadius:m}=e,g=p?ee.of3(p):null,y=new S(s.x,s.y),b=this.getItem(),P=b.toJSON(),T=b.getComponent(),I=T?JSON.stringify(T):"{}",C=T instanceof Vn?JSON.stringify(T.copperResult):"[]";b.removeFill(),b.type!=i&&(b.type=i),b.layerId!=n&&(b.layerId=n),b.width!=a&&(b.width=a),b.height!=l&&(b.height=l),b.rotation!=d&&(b.rotation=d),b.start.equals(y)||(b.start=y),b.net!=c&&(A.publish("hasModifyPcbItem",b),b.net=c),b.locked!=h&&(b.locked=h),b.strokeWidth!=u&&(b.strokeWidth=u),this.equals(g,b.silkColor)||(b.silkColor=g),b.cornerRadius!=m&&(b.cornerRadius=m),this.data=P,this.modifyGroupID(b),this.tool.modifyComponent(b),this.tool.setComponentData(I,C),this.modifyRegionSelector(b,e.regionRuleSelector),b.fill(),b.toggleCopperResult(!b.hiddenCopperResult),A.publish("hasModifyPcbItem",b),this.updateData()}compareDataChange(e){let r=Xt.getItem(this.gId);if(!r||this.action!=="modify")return!0;let i=this.data,n=r.toJSON(),s=["start","width","height","rotation","strokeWidth","cornerRadius","type"];if(a(n,s)!==a(i,s)&&(r.type=="Copper Region"||i.type=="Copper Region"))return e.push(new c3(r,"delete")),r.clearCopper(),!0;if(JSON.stringify(this.data)!==JSON.stringify(r))return!0;return!1;function a(l,c){let h=c.map(u=>l[u]);return JSON.stringify(h)}}comparePourChange(){let e=this.data,r=Xt.getItem(this.gId);return!r||this.action!=="modify"?{action:"fullUpdate",data:null}:e.type=="Copper Region"&&r.type!=="Copper Region"?{action:"fullUpdate",data:null}:e.type!=="Copper Region"&&r.type=="Copper Region"?{action:"fullUpdate",data:null}:r.model.component.name!==e.componentData.name?{action:"halfUpdate",data:{id:r.globalIndex,key:"name",value:r.model.component.name}}:r.net!==e.net?{action:"halfUpdate",data:{id:r.globalIndex,key:"net",value:r.net}}:r.layerId!==e.layerId?{action:"halfUpdate",data:{id:r.globalIndex,key:"layerId",value:r.layerId}}:{action:"notUpdate",data:null}}upload(e=!1){let r=x.getInstance().compiler,i=r.consistencyManager.getMaxTicket();this.isDelete(e)?(r.setTicket(++i),qI(this.gId,this.type)):(this.source==null&&this.updateData(),r.setTicket(++i),KE(this.gId,this.type,this.source)),this.source=null}updateData(){if(this.source==null){let e=Xt.getItem(this.gId);e!=null&&(this.source=or.getInstance().encodeProfile(e.model),this.type=e.type)}}};function OSe(o){let{globalIndex:t,layerId:e,key:r,showKey:i,value:n,showValue:s,fontFamily:a,fontSize:l,rotation:c,locked:h,position:u,origin:d,strokeWidth:p,reverse:m,reverseExpansion:g,mirror:y,silkColor:b,positionIsNull:P}=o,T=b?ee.of3(b):void 0,I=new S(u.x,u.y),C=ti.rebuild(t,e,r,i,n,s,a,l,c,h,I,d,p,m,g,y,P);return A.publish("hasModifyPcbItem",C),C.silkColor=T,C}var l6=class extends so{constructor(t,e,r){super(),e=="add"?(this.groupId=t.getGroupID(),this.gId=t.globalIndex,this.action=e):(this.gId=t.globalIndex,this.data=t.toJSON(),r||(this.source=e=="delete"?or.getInstance().encode(t.key?"ATTR":"STRING",t.model):null),this.action=e,this.deleteGroupID(t))}rebuild(){let t=OSe(this.data);return this.addGroupID(t),this.updateFilterStatus(t),this.updateData(),this.data=void 0,t}getItem(){return ti.getItem(this.gId)}remove(){let t=ti.getItem(this.gId);this.data=t.toJSON(),A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t),this.updateData()}modify(){let{globalIndex:t,layerId:e,key:r,showKey:i,value:n,formulaName:s,showValue:a,fontFamily:l,fontSize:c,rotation:h,locked:u,position:d,origin:p,strokeWidth:m,reverse:g,reverseExpansion:y,mirror:b,silkColor:P,positionIsNull:T}=this.data,I=P?ee.of3(P):void 0,C=ti.getItem(this.gId),E=new S(d.x,d.y),O=C.toJSON();C.layerId!=e&&(C.layerId=e),C.key!=r&&(C.key=r),C.showKey!=i&&(C.showKey=i),C.value!=n&&(C.value=s||n),C.showValue!=a&&(C.showValue=a),C.fontFamily!=l&&(C.fontFamily=l),C.strokeWidth!=m&&(C.strokeWidth=m),C.fontSize!=c&&(C.fontSize=c),C.positionIsNull!=T&&(C.positionIsNull=T),C.rotation!=h&&(C.rotation=h),C.locked!=u&&(C.locked=u),C.position.equals(E)||(C.position=E),C.origin!=p&&(C.origin=p),C.mirror!=b&&(C.mirror=b),C.reverse!=g&&(C.reverse=g),C.reverseExpansion!=y&&(C.reverseExpansion=y),I||(C.silkColor=void 0),(I&&C.silkColor&&!C.silkColor.equals(I)||C.silkColor!=I)&&(C.silkColor=I),this.data=O,this.modifyGroupID(C),C.hasHelpLine&&C.updateHelpLine(),A.publish("hasModifyPcbItem",C),this.updateData()}uploadData(t=!1){let e=this.isDelete(t),r=x.getInstance().compiler;r.setTicket(),e?r.deleteString(this.gId):(this.updateData(),this.source&&("key"in this.source?r.uploadAttr(this.gId,this.source):r.uploadString(this.gId,this.source))),this.source=void 0}upload(t=!1){this.uploadData(t)}updateData(){if(this.source==null){let t=ti.getItem(this.gId);t!=null&&(this.source=or.getInstance().encode(t.key?"ATTR":"STRING",t.model))}}};var Wj=null,PGe=new Array,c6=class extends so{constructor(t,e){super(),this.gId=t.globalIndex,this.groupId=t.getGroupID(),this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?or.getInstance().encode("LINE",t.model):null,this.action=e,this.deleteGroupID(t),this.action==="delete"&&this.checkGroup(),A.publish("cheakTearDrop",new Em(e,t.toJSON(),t)),ce.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:t.globalIndex,net:t.net,bbox:t.buildBBox()}])}checkGroup(){if(this.groupId!=null){let t=x.getInstance().tabId,e=kt.getItem(this.groupId);if(e!=null){let r=e.name;PGe.push({attr:{id:this.groupId,pcbid:t},text:`${r} (${this.groupId})`}),Wj!=null&&(clearTimeout(Wj),Wj=null),Wj=setTimeout(()=>{PGe.length=0,Wj=null},10)}}}rebuild(){var d;let{globalIndex:t,partition:e,layerId:r,start:i,end:n,width:s,locked:a,net:l}=this.data;if(!((d=$e.getInstance().getLayer(r))!=null&&d.config))return null;let c=new S(i.x,i.y),h=new S(n.x,n.y),u=pr.rebuild(t,r,c,h,s,a,l);return u.partition=e,u.number=this.number,A.publish("hasModifyPcbItem",u),this.addGroupID(u),this.updateFilterStatus(u),this.updateData(),this.data=void 0,u}getItem(){return pr.getItem(this.gId)}remove(){let t=pr.getItem(this.gId);this.data=t.toJSON(),this.number=t.number,A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t),A.publish("cheakTearDrop",new Em("delete",this.data,t)),this.updateData()}modify(){let{globalIndex:t,layerId:e,start:r,end:i,width:n,locked:s,net:a}=this.data,l=new S(r.x,r.y),c=new S(i.x,i.y),h=pr.getItem(this.gId);if(!h)return;let u=h.toJSON();h.layerId!=e&&(h.layerId=e),h.start.equals(l)||(h.start=l),h.end.equals(c)||(h.end=c),h.width!=n&&(h.width=n),h.locked!=s&&(h.locked=s),h.net!=a&&(A.publish("hasModifyPcbItem",h),h.net=a),this.data=u,this.modifyGroupID(h),A.publish("hasModifyPcbItem",h),this.updateData()}upload(t=!1){let e=this.isDelete(t),r=x.getInstance().compiler;r.setTicket(),e?r.deleteLine(this.gId):(this.source==null&&this.updateData(),this.source!=null&&r.uploadLine(this.gId,this.source)),this.source=void 0}updateData(){if(this.source==null){let t=pr.getItem(this.gId);t!=null&&(this.source=or.getInstance().encode("LINE",t.model))}}};var h6=class extends so{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?or.getInstance().encode("VIA",t.model):null,t.getParent()&&(this.hasParent=!0,this.padNetSource=e=="delete"?or.getInstance().encode("PAD_NET",t.model):void 0),this.action=e,this.deleteGroupID(t),A.publish("cheakTearDrop",new Em(e,t.toJSON(),t)),ce.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:t.globalIndex,net:t.net,bbox:t.buildBBox()}])}rebuild(){let{globalIndex:t,partition:e,type:r,name:i,startLayer:n,endLayer:s,net:a,radius:l,center:c,holeRadius:h,locked:u,expansion:d,topExpansion:p,bottomExpansion:m,unusedInnerLayers:g,isSuture:y}=this.data,b=new S(c.x,c.y),P=Hr.rebuild(t,r,i,n,s,a,l,b,h,u,d,p,m,g,y);return P.partition=e,P.number=this.number,this.data=void 0,A.publish("hasModifyPcbItem",P),this.addGroupID(P),this.updateFilterStatus(P),this.updateData(),this.data=void 0,P}getItem(){return Hr.getItem(this.gId)}remove(){this.updateData();let t=Hr.getItem(this.gId);t!=null&&(this.data=t.toJSON(),this.number=t.number,A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t))}modify(){let{type:t,name:e,startLayer:r,endLayer:i,net:n,radius:s,center:a,holeRadius:l,locked:c,expansion:h,topExpansion:u,bottomExpansion:d,unusedInnerLayers:p,isSuture:m}=this.data,g=new S(a.x,a.y),y=Hr.getItem(this.gId),b=y.toJSON();y.type!=t&&(y.type=t),y.name!=e&&(y.name=e),(y.startLayer!=r||y.endLayer!=i||y.radius!=s||y.holeRadius!=l)&&(y.viaBaseInfo=Ea.getViaBaseInfo(r,i,s,l)),y.net!=n&&(A.publish("hasModifyPcbItem",y),y.net=n),y.center.equals(g)||(y.center=g),y.locked!=c&&(y.locked=c),y.viaExpansion=I0.getViaExpansion(h,u,d),y.unusedInnerLayers.toString()!=p.toString()&&(y.unusedInnerLayers=p),this.data=b,this.modifyGroupID(y),A.publish("hasModifyPcbItem",y),this.updateData()}upload(t=!1){let e=this.isDelete(t),r=x.getInstance().compiler,i=r.consistencyManager.getMaxTicket();e?(this.padNetSource&&(r.setTicket(++i),r.deletePadNet(this.padNetSource.componentId,this.padNetSource.padNum,this.padNetSource.padId)),this.hasParent||(r.setTicket(++i),r.deleteVia(this.gId))):(this.source==null&&this.updateData(),this.padNetSource&&(r.setTicket(++i),r.uploadPadNet(this.padNetSource)),!this.hasParent&&this.source&&(r.setTicket(++i),r.uploadVia(this.gId,this.source))),this.padNetSource=void 0,this.source=void 0}updateData(){if(this.source==null){let t=Hr.getItem(this.gId);if(t!=null){let e=t.getParent();this.source=or.getInstance().encode("VIA",t.model),this.padNetSource=e&&or.getInstance().encode("PAD_NET",t.model)}}}};var Ph=class extends zs{constructor(t){super(),this.model=t}get name(){return this.model.name}set name(t){this.model.name=t}get locked(){return this.model.locked}get size(){return this.model.size}getIndex(){return this.model.getIndex()}addItem(t){this.model.addItem(t.model)}deleteItem(t){this.model.deleteItem(t.model)}getItems(){let t=new Array,e=new er;for(let r of this.model.getItems()){let i=e.getItemByType(r.globalIndex,r.modelType);i!=null&&t.push(i)}return t}setItems(t){this.model.setItems(t.map(e=>e.model))}dissolution(){this.model.dissolution()}rotateFor(t,e){let r=Ae.translate(-t.x,-t.y,0).rotateZ(e).translate1(t.x,t.y,0);this.transform(r)}visible(){}hidden(){}click(){}remove(){this.model.remove(),kt.delete(this)}transform(t){for(let e of this.getItems())e.transform(t)}isSelect(t,e){return!0}buildBBox(){return this.model.getBBox()}hasItem(t){return this.model.hasItem(t)}};function Gs(o){return xe(o*10,4)}var oF=class{static genUnitItem(t,e){e.unit=t.unit}static genForAllItem(t,e){e.isForAll=lVe(t.status)}static genSafeSpacingContentItem(t,e){e.safeSpacing=[];let r=t.toJSON();for(let[i,n]of r)e.safeSpacing.push({layerId:i,isOpen:CT(n.layerState),content:n.table.map(s=>s.map(Gs)),columnNames:[]})}};var zj=class{static genUnitItem(t,e){e.unit=t.unit}static genTrackContentItem(t,e){e.track={isOpen:CT(t.getLayerStatus()),content:[]};let r=t.toJSON();for(let[i,n]of r)e.track.content.push({layerId:i,stroMin:Gs(n.minValue),stroDef:Gs(n.defaultValue),stroMax:Gs(n.maxValue)})}};var u6=class{static genUnitItem(t,e){e.unit=t.unit}static genStroWidthContentItem(t,e){e.stroWidth={isOpen:!1,content:[]};let i=t.toJSON().strokeWidthTables;e.stroWidth.isOpen=CT(i.status);for(let[n,s]of i.tables)e.stroWidth.content.push({layerId:n,stroMin:Gs(s.minValue),stroMax:Gs(s.maxValue),stroDef:Gs(s.defaultValue)})}static genSpacingContentItem(t,e){e.spacing={isOpen:!1,content:[]};let i=t.toJSON().diffPairSpacingTables;e.spacing.isOpen=CT(i.status);for(let[n,s]of i.tables)e.spacing.content.push({layerId:n,spacMin:Gs(s.minValue),spacDef:Gs(s.defaultValue)})}static genDifferPairLenTolerMaxItem(t,e){e.differPairLenTolerMax=Gs(t.differentialPairLenTolerMax)}};var Yj=class{static genUnitItem(t,e){e.unit=t.unit}static genMulPadContentItem(t,e){e.mulPad={isOpen:!1,content:[]};let r=t.toJSON();e.mulPad.isOpen=CT(r.status);for(let[i,n]of r.tables)e.mulPad.content.push({layerId:i,connType:m4(n.connectMode),spoSpac:Gs(n.lineClearance),spoWidth:Gs(n.lineWidth),spoAng:xe(n.lineAngle/Math.PI*180,4)})}};var d6=class{static genUnitItem(t,e){e.unit=t.unit}static genSglPadContentItem(t,e){e.sglPad={isOpen:!1,content:[]};let i=t.toJSON().singleLayerPadModel;e.sglPad.isOpen=CT(i.status);for(let[n,s]of i.tables)e.sglPad.content.push({layerId:n,connType:m4(s.connectMode),spoSpac:Gs(s.lineClearance),spoWidth:Gs(s.lineWidth),spoAng:xe(s.lineAngle/Math.PI*180,4)})}static genMulPadContentItem(t,e){e.mulPad={isOpen:!1,content:[]};let i=t.toJSON().multiLayerPadModel;e.mulPad.isOpen=CT(i.status);for(let[n,s]of i.tables)e.mulPad.content.push({layerId:n,connType:m4(s.connectMode),spoSpac:Gs(s.lineClearance),spoWidth:Gs(s.lineWidth),spoAng:xe(s.lineAngle/Math.PI*180,4)})}static genTrackContentItem(t,e){e.track={isOpen:!1,content:[]};let i=t.toJSON().trackConnectModel;e.track.isOpen=CT(i.status);for(let[n,s]of i.tables)e.track.content.push({layerId:n,connType:sVe(s)})}};var p6=class{static genUnitItem(t,e){e.unit=t.unit}static genDeviceClearanceItem(t,e){e.deviceClearance=Gs(t.deviceClearance)}static genThru2SmdClearanceItem(t,e){e.thru2SmdClearance=Gs(t.thru2SmdClearance)}static genHoleClearanceItem(t,e){e.holeClearance=Gs(t.holeClearance)}};var sF=class{static genUnitItem(t,e){e.unit=t.unit}static genNetLenMinItem(t,e){e.netLenMin=Gs(t.netLengthMin)}static genNetLenMaxItem(t,e){e.netLenMax=Gs(t.netLengthMax)}};var Wie=class{static genBlindItem(t,e){e.blinds={content:[]};let r=t.getAllVias();for(let i of r)e.blinds.content.push({name:i.name,staLayerId:i.startLayer,endLayerId:i.endLayer,viaSizeRule:i.viaSizeRule})}};var h3=class{static genUnitItem(t,e){e.unit=t.unit}static genMinRadiusItem(t,e){e.minRadius=Gs(t.minRadius)}static genDefRadiusItem(t,e){e.defRadius=Gs(t.defalutRadius)}static genMaxRadiusItem(t,e){e.maxRadius=Gs(t.maxRadius)}static genMinInnerItem(t,e){e.minInner=Gs(t.minInner)}static genDefInnerItem(t,e){e.defInner=Gs(t.defalutInner)}static genMaxInnerItem(t,e){e.maxInner=Gs(t.maxInner)}};var u3=class{static genUnitItem(t,e){e.unit=t.unit}static genPadTopExpanItem(t,e){e.padTopExpan=Gs(t.padTopExpansion)}static genPadBotExpanItem(t,e){e.padBotExpan=Gs(t.padBottomExpansion)}static genViaTopExpanItem(t,e){e.viaTopExpan=Gs(t.viaTopExpansion)}static genViaBotExpanItem(t,e){e.viaBotExpan=Gs(t.viaBottomExpansion)}static genTestPointTopExpanItem(t,e){e.testPointTopExpan=Gs(t.testPointTopExpansion)}static genTestPointBotExpanItem(t,e){e.testPointBotExpan=Gs(t.testPointBottomExpansion)}};var HR=class{static genUnitItem(t,e){e.unit=t.unit}static genPadTopExpanItem(t,e){e.padTopExpan=Gs(t.padTopExpansion)}static genPadBotExpanItem(t,e){e.padBotExpan=Gs(t.padBottomExpansion)}static genTestPointTopExpanItem(t,e){e.testPointTopExpan=Gs(t.testPointTopExpansion)}static genTestPointBotExpanItem(t,e){e.testPointBotExpan=Gs(t.testPointBottomExpansion)}};var jj=class{static genUnitItem(t,e){e.unit=t.unit}static genNetLenTolerance(t,e){e.netLengthTolerance=Gs(t.netLengthTolerance)}};var aF=class{static genUnitItem(t,e){e.unit=t.unit}static genCreepageClearanceItem(t,e){e.creepageDistance=Gs(t.creepageDistance)}static genIgnoreLayer(t,e){e.ignoreLayer=t.ignoreLayer}};var WR=class extends Rn{getData(t,e){switch(t){case"ruleType":return mm(Oie(e));case"ruleName":return e.name;case"ruleState":let r=e.isDefault?1:0;return DFe(r);case"ruleContext":return this.getContext(e)}}getContext(t){let e={};if(t instanceof HI)return oF.genUnitItem(t,e),oF.genForAllItem(t,e),oF.genSafeSpacingContentItem(t,e),e;if(t instanceof zI)return aF.genUnitItem(t,e),aF.genCreepageClearanceItem(t,e),aF.genIgnoreLayer(t,e),e;if(t instanceof Wb)return p6.genUnitItem(t,e),p6.genDeviceClearanceItem(t,e),p6.genThru2SmdClearanceItem(t,e),p6.genHoleClearanceItem(t,e),e;if(t instanceof Ux)return zj.genUnitItem(t,e),zj.genTrackContentItem(t,e),e;if(t instanceof Lx)return sF.genUnitItem(t,e),sF.genNetLenMinItem(t,e),sF.genNetLenMaxItem(t,e),e;if(t instanceof Mx)return jj.genUnitItem(t,e),jj.genNetLenTolerance(t,e),e;if(t instanceof Hb)return u6.genUnitItem(t,e),u6.genStroWidthContentItem(t,e),u6.genSpacingContentItem(t,e),u6.genDifferPairLenTolerMaxItem(t,e),e;if(t instanceof Rx)return Wie.genBlindItem(t,e),e;if(t instanceof Vx)return h3.genUnitItem(t,e),h3.genMinRadiusItem(t,e),h3.genDefRadiusItem(t,e),h3.genMaxRadiusItem(t,e),h3.genMinInnerItem(t,e),h3.genDefInnerItem(t,e),h3.genMaxInnerItem(t,e),e;if(t instanceof wx)return Yj.genUnitItem(t,e),Yj.genMulPadContentItem(t,e),e;if(t instanceof Dx)return d6.genUnitItem(t,e),d6.genSglPadContentItem(t,e),d6.genMulPadContentItem(t,e),d6.genTrackContentItem(t,e),e;if(t instanceof Gx)return u3.genUnitItem(t,e),u3.genPadTopExpanItem(t,e),u3.genPadBotExpanItem(t,e),u3.genViaTopExpanItem(t,e),u3.genViaBotExpanItem(t,e),u3.genTestPointTopExpanItem(t,e),u3.genTestPointBotExpanItem(t,e),e;if(t instanceof Fx)return HR.genUnitItem(t,e),HR.genPadTopExpanItem(t,e),HR.genPadBotExpanItem(t,e),HR.genTestPointTopExpanItem(t,e),HR.genTestPointBotExpanItem(t,e),e;if(t instanceof Hx){let r=t.config;return{routingCorner:LFe(r.routingCorner),isKeep:this.autoBool(r.isKeep),viaQuantity:NFe(r.viaQuatity),routingEffectPriority:BFe(r.routingEffectPriority),layers:r.layers,ignoreNets:r.ignoreNets}}return null}getNumber(t){return xe(t*10,4)}autoBool(t){return t?1:0}};var lF=class extends Rn{getData(t,e){switch(t){case"shapeID":return e.globalIndex;case"groupId":return e.combinationID;case"channelId":return e.channelID}}};var zR=class extends Rn{getData(t){switch(t){case"name":return te.getInstance().getRuleTemplateName()}}};var YR=class extends nf{getData(t,e){let r=e.component;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"layerId":return e.layerId;case"material":return r.material==="Tape"?UCe(r.fpcModel):UCe(r.material);case"thickness":return r.thickness;case"path":return this.getShapeInfo(e);case"locked":return e.locked;case"zIndex":return e.zIndex}}};var d3=class extends Rn{getData(t,e){if(!Array.isArray(e)){let s=[],a=e.getParent();if(!a)return[];a.iteratorCopper(l=>{let c=Wo.getInstance().getItem(l);s.push(c)}),e=s}if(e.length==0)return[];let r=["strokeWidth","fill","path","id"],i=[],n=new ASe;for(let s of e){let a={};for(let l of r)a[l]=n.getData(l,s);i.push(a)}return i}},ASe=class extends Rn{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"id":return this.id;case"strokeWidth":return e.style=="90grid"||e.style=="45grid"?e.gridLineWidth:0;case"fill":return!(e.style=="90grid"||e.style=="45grid");case"path":return e.copperPath}}};var jR=class extends nf{getData(t,e){switch(this.id=e.globalIndex,t){case"index":return this.id;case"name":if(e.component instanceof Dc)return e.component.name;break;case"fileUuid":if(e.component instanceof Dc)return e.component.fileUuid;break;case"path":return this.getShapeInfo(e)}}};var Y3t=function(o,t){return t.bbox().area()-o.bbox().area()},oh=class{constructor(t,e,r,i,n){this.rtree=new nn(20);this.cache=new Array(30);this.notConnected=new Array;this.notConnectedArcs=new Set;this.bbox=t,this.autoConnectDistance=an.positive(e),this.cutWidth=an.positive(r),this.logger=i;for(let s of n)this.rtree.add(s)}addLine(t,e){let r=null,i=null;e?(r=t.start(),i=t.end()):(r=t.end(),i=t.start());let n=new ut(r.x,r.x,r.y,r.y),s=this.rtree.search(n.extendOfSize(this.autoConnectDistance)),a=Number.MAX_VALUE,l=null;for(let c of s)if(c!=t){if(c.start().equals1(i)||c.end().equals1(i))continue;let h=c.start().distance2(r),u=c.end().distance2(r);h<a&&(a=h,l=c.start()),u<a&&(a=u,l=c.end())}return l}getDeltaLines(){let t=this.connect0().set.iterator(),e=new Array;for(;t.hasNext();){let r=t.next();e.push(r)}return e}connect0(){this.notConnected.length=0,this.notConnectedArcs.clear();let t=new Array,e=this.notConnected,r=this.notConnectedArcs,i=new Ba;for(let n of this.rtree.items()){if(t.push(n),n instanceof q&&n.isCircle())continue;let s=0,a=0,l=this.rtree.search(n.bbox().extendOfSize(this.cutWidth));for(let c of l)if(n!=c&&((n.start().equals(c.start())||n.start().equals(c.end()))&&s++,(n.end().equals(c.start())||n.end().equals(c.end()))&&a++,(n instanceof M&&c instanceof M&&n.equals2(c)||n instanceof q&&c instanceof q&&n.equals1(c))&&(s--,a--)),s>0&&a>0)break;if(s==0){let c=this.addLine(n,!0);if(c!=null){let h=new M(n.start(),c);h.length()<=this.autoConnectDistance&&(i.contains(h)||(t.push(h),i.add(h)),s++)}}if(a==0){let c=this.addLine(n,!1);if(c!=null){let h=new M(n.end(),c);h.length()<=this.autoConnectDistance&&(i.contains(h)||(t.push(h),i.add(h)),a++)}}(s==0||a==0)&&(e.push(n),n instanceof q&&r.add(n))}for(let n of e)for(let s of this.rtree.search(n.bbox().extendOfSize(this.autoConnectDistance)))if(n!=s){let a=new ir(n,s),l=a.getDistance();if(this.cutWidth/10<l&&l<=this.autoConnectDistance){let c=a.getLine();n instanceof q&&(n.start().equals1(c.start())||n.start().equals1(c.end())||n.end().equals1(c.start())||n.end().equals1(c.end()))&&r.delete(n),s instanceof q&&(s.start().equals1(c.start())||s.start().equals1(c.end())||s.end().equals1(c.start())||s.end().equals1(c.end()))&&r.delete(s),i.contains(c)||(t.push(c),i.add(c))}}for(let n of r)n.end().distance1(n.start())<=this.autoConnectDistance&&t.push(new M(n.start(),n.end()));return{pts:t,set:i}}connect(){return this.connect0().pts}bboxOutline(){let t=this.bbox.extendOfSize(this.bbox.width());return new hs([fe.build5([t.minX,t.minY,t.minX,t.maxY,t.maxX,t.maxY,t.maxX,t.minY]).asClose()])}detectBase(t,e,r){if(this.rtree.size()==0)return this.bboxOutline();let i=this.connect(),n=this.bbox.extendOfSize(Math.max(this.bbox.width(),this.bbox.height())),s=[Gl.DIFF,fe.build5([n.minX,n.minY,n.minX,n.maxY,n.maxX,n.maxY,n.maxX,n.minY,n.minX,n.minY])];for(let l of i){let c=hs.buildByStroke(l,this.cutWidth,kr.ROUND,1,e);c&&s.push(c)}if(r!=null){for(let l of this.notConnected){let c=r.get(l);if(c!=null){let h=hs.buildByStroke(l,c,kr.ROUND,1,e);h&&s.push(h)}}for(let l of this.notConnectedArcs){let c=r.get(l);if(c!=null){let h=hs.buildByStroke(l,c,kr.ROUND,1,e);h&&s.push(h)}}}let a=HP(s,e);if(a.items.length<2)return this.bboxOutline();{let l=a.items.slice();return xr(l,Y3t,0,l.length),t(new Jo(l))}}detect(t){let e=this.detectBase(r=>{let i=new Array,n=r.items;for(let s=1;s<n.length;s++)Re.addAll(i,n[s].items);return new Gt(i)},t);return e instanceof Gt?e:e.toPolylineGroup()}detect1(){return this.detectBase(t=>t.items[0]).toPolylineGroup()}detect2(t){let e=this.detectBase(r=>new Jo(r.items.slice(1)),t);return e instanceof Jo?e:new Jo([e])}detect3(t,e){let r=this.detectBase(i=>new Jo(i.items.slice(1)),e,t);return r instanceof Jo?r:new Jo([r])}};var ai=class o{constructor(){this.items=Array();this.outlines=Array();this.slots=Array();this.originOutline=Array();this.holes=Array();this.positionHoles=new Array;this.stampGroups=new Array;this.marks=Array();this.vCutShapes=Array();this.closures=Array();this.borderClosures=[Array(),Array()];this.borderClosures_outerMost=Array();this.id=0;this.useSetJsonFirst=!1;let t=new ft,e=a=>t.conversion("mm","mil",a)/10,r=e(2),i=e(1),n=e(.5),s=e(6);this._param={success:!1,on:!1,row:1,column:1,rowSpacing:0,columnSpacing:0,onlyOutline:!0,minSpacing:e(1.6),resetCanvasOrigin:!1,description:"",minStampHoleDiameter:e(.1),minStampHoleSpacing:e(.1),stampHoleDiameter:e(.55),stampHoleSpacing:e(.85),stampHolePerGroup:8,stampRow:!1,stampColumn:!1,stampPerColumn:1,stampPerRow:1,borderHeight:s,borderAtTopBottom:!0,borderAtLeftRight:!1,createPositionHole:!0,createMark:!0,positionHoleDiameter:r,markDiameter:i,markExpansion:n,defaultBorderHeight:s,defaultMarkExpansion:n,defaultMarkDiameter:i,defaultPositionHoleDiameter:r,minBorderHeight:e(3),minMarkDiameter:e(.1),minMarkExpansion:e(.5),minPositionHoleDiameter:e(.2),borderRadius:e(1),useCustomSize:null,customWidth:e(100),customHeight:e(100),outputUnit:"mm",flipOrigin:!1,flipX:!1,flipY:!1}}static getInstance(){return o.model==null&&(o.model=new o),o.model}getDefaultPanelize(){return this._param}setDefaultPanelize(t){Object.entries(t).forEach(e=>{let r=e[0],i=e[1];i!=null&&typeof i==typeof this._param[r]&&(this._param[r]=i)})}getProfileGroup(t){let e=new Array;for(let r of this.items)if(r.layerId==t){if(r instanceof Li)continue;if(r instanceof ys)e.push({primitives:[r.primitive],strokeWidth:r.width});else if(r instanceof nl)e.push({primitives:[r.primitive],strokeWidth:r.width});else if(r instanceof Po)e.push({primitives:[r.primitive],strokeWidth:r.strokeWidth});else if(r instanceof Je)continue}for(let r of this.outlines)r.layerId==t&&(r instanceof ys?e.push({primitives:[r.primitive],strokeWidth:r.width}):r instanceof nl?e.push({primitives:[r.primitive],strokeWidth:r.width}):r instanceof Po&&e.push({primitives:[r.primitive],strokeWidth:r.strokeWidth}));return e}getPadGroup(t){let e=new Array;for(let r of this.items)if(r instanceof Je){let i=r.getMathGraphics(t);i!=null&&e.push(i)}return e}getText(t){let e=new Array;for(let r of this.items)r.layerId==t&&r instanceof Li&&e.push(r);return e}get bbox(){if(!this.outerBBox)return;let t=new _e;return t.ext1(this.outerBBox),this.items.forEach(e=>{t.ext1(e.buildBBox())}),t.build1()}getClosures(){let t=this._param,e=new Array;if(t.borderAtTopBottom&&t.borderAtLeftRight){let i=Array.from(this.borderClosures[0]),n=Array.from(this.borderClosures[1]);e.push([this.convert2Polyline(this.borderClosures_outerMost),this.convert2Polyline([].concat(i,n),!0)])}else e.push([this.convert2Polyline(this.borderClosures[0])],[this.convert2Polyline(this.borderClosures[1])]);return e.push(...this.closures.map(i=>[this.convert2Polyline(i)])),e.map(i=>i.filter(n=>n!=null))}convert2Polyline(t,e=!1){if(!t||!t.length)return null;let r=new _e;t.forEach(a=>r.ext1(a.bbox()));let i=r.build1().area(),s=new oh(this.outerBBox,2,.2,new Gi(4),t).detect();if(s){let a=s.bbox().area();if(ne.lesseq(a,i)){let l=s.items[0];return e?l.reverse():l}}return null}remove(){this.offset=null,this.singleBBox=null,this.outerBBox=null,this.items.length=0,this.holes.length=0,this.positionHoles.length=0,this.stampGroups.length=0,this.originOutline.length=0,this.marks.length=0,this.outlines.length=0,this.slots.length=0,this.closures.length=0,this.vCutShapes.length=0,this.borderClosures[0].length=0,this.borderClosures[1].length=0,this.borderClosures_outerMost.length=0}get outputUnit(){return this._param.outputUnit}gId(){return"Panelize"+this.id++}addLine(t,e,r=11,i=!1){if(t.equals1(e))return;let n=new ih(this.gId(),t,e,{layerId:r,strokeWidth:1,locked:!1});return this.items.push(n),i&&this.vCutShapes.push(n),n}addVCutIndicator(t,e){let r=t.add1(e?22:0,e?0:-22);this.addText("V-CUT",4.5,r,2,e?0:-Math.PI/2),this.addArrow(t,e)}addHalfArrow(t,e){let r=this.singleBBox.height()*.6,i=r/9,n=t.add1(0,-i+r/2),s=n.add1(0,-r),a=n.add1(-i,-i);[s,a].forEach(l=>{let c=this.addLine(n,l,13,!1);e&&c.transform(Ae.rotateZForPoint(t,Math.PI))})}addArrow(t,e){let r=t.add1(e?2:0,e?0:-2),i=r.add1(e?18:0,e?0:-18),n=r.add1(2,e?2:-2),s=r.add1(e?2:-2,-2);[i,n,s].forEach(a=>this.addLine(r,a,13,!0))}addVCutLine(t,e,r){this.addLine(t,e,void 0,!0)}addMark(t,e,r){[1,2].forEach(i=>{let n=$o.getStyle("ELLIPSE",e,e,0,null),s=i==1,a=new US(this.gId(),i,1,"",t,0,!1,"",1,0,r,r,[],!0,s?n:null,s?null:n,null,null);this.items.push(a),this.marks.push(a)})}addText(t,e,r,i,n=0){let{width:a,height:l,path:c}=Gd(t,e,.6),h=new Ed(this.gId(),13,0,"",!1,t,!0,"default",e,n,r,i,.6,!1,0,!1,!1,c,a,l,!1);this.items.push(h),this.vCutShapes.push(h)}addPositionHole(t,e){let r=this.addHole(t,e);this.positionHoles.push(r)}addHole(t,e){let r=new $p(this.gId(),"Slot Region",12,t,e/2,1,!1,null,null,null);return this.items.push(r),this.holes.push(r),r}addStampHole(t,e){return this.addHole(t,e)}addStampHoleGroup(t,e){let r=t.map(i=>this.addStampHole(i,e));this.stampGroups.push(r)}addArc(t,e,r,i,n=le.CCW,s=11){let a=new yh(this.gId(),t,e,r,i,n,{layerId:s,strokeWidth:1,locked:!1});this.items.push(a)}copyOutline(t,e,r,i){let n=new Array,s=new Array;if(t instanceof Aa?t.getAllLinesInOrder().forEach(a=>n.push(a)):t instanceof Po?s.push(t):t instanceof ss&&t.childrens.forEach(l=>{l.forEach(c=>n.push(c))}),r&&this.originOutline.push([].concat(n,s)),i){let a;for(let l of n)if(l instanceof M||l instanceof ys){let c=l instanceof M?l.start():l.start,h=l instanceof M?l.end():l.end;a=new ih(this.gId(),c,h,{layerId:t.layerId,strokeWidth:t.strokeWidth,locked:!1}),a.transform(e),this.outlines.push(a)}else if(l instanceof q||l instanceof nl){let c=l instanceof q?Ht.toRadians(l.startAngle):l.startAngle,h=l instanceof q?Ht.toRadians(l.endAngle()):l.endAngle,u=l instanceof q?l.sweep():l.sweep,d=new yh(this.gId(),l.center,l.rx,c,h,u,{layerId:t.layerId,strokeWidth:t.strokeWidth,locked:!1});d.transform(e),this.outlines.push(d)}for(let l of s){let c=new $p(this.gId(),"Line",l.layerId,l.center,l.radius,l.strokeWidth,!1,null,null,null);c.transform(e),this.outlines.push(c)}}}copySlot(t,e,r,i){if(i){let n;if(t instanceof ss){let s=t.childrens.map(a=>a.map(l=>l instanceof nl?new yh(this.gId(),l.center,l.rx,l.startAngle,l.endAngle,l.sweep,{layerId:t.layerId,strokeWidth:t.strokeWidth,locked:!1}):new ih(this.gId(),l.start,l.end,{layerId:t.layerId,strokeWidth:t.strokeWidth,locked:!1})));n=new Jp(this.gId(),"Slot Region",t.layerId,s,t.strokeWidth,null,!1,null,null),n.transform(e),this.slots.push(n)}else if(t instanceof Aa)n=new Zp(this.gId(),"Slot Region",t.layerId,t.start,t.width,t.height,t.rotation,t.radius,null,t.strokeWidth,!1,null,null),n.transform(e),this.slots.push(n);else if(t instanceof Po){let s=new $p(this.gId(),"Slot Region",t.layerId,t.center,t.radius,t.strokeWidth,!1,null,null,null);s.transform(e),this.slots.push(s)}}}};function rC(o){return Wi.getInstance().getItem(o.footprintUUID).isSMT}function Cp(o,t,e=!1){let r=gh.getInstance().getItem(t.deviceUUID),i=Wi.getInstance().getItem(t.footprintUUID);if(o.key=="3D Model"||o.key=="3D Model Transform")return!1;let n,s,a;if(e)n=o.layerId,s=o.position.sub(i.origin),a=o.rotation;else{n=t.layerId==2?Mg(o.layerId):o.layerId;let l=t.layerId==2?(Math.PI-t.rotation)%yp:t.rotation;a=o.rotation-l,t.layerId==2?(t.flipShape(o),s=kA(t.position,l,o.position),t.flipShape(o)):s=kA(t.position,l,o.position)}return!!(r==null||o.key=="Device"||o.key=="Designator"||o.key=="Footprint"&&t.footprintUUID!=r.footprintUUID||r!=null&&(!r.checkKeyValue(o.key,o.value,t.footprintUUID)||r.needSave(o,s,a,n,i.uuid)))}var t_=class extends Rn{getData(t,e){if(Array.isArray(e)||(e=Array.from(Ho.getInstance().layerMapSet[e.layerId])),e.length==0)return[];let r=["partitionId","groupId","netName","layerId","width","fillStyle","path","locked","zIndex","isBridgingCopper","networkList","refs","specialColor","id"],i=[],n=new KI;for(let s of e){let a={};for(let l of r)a[l]=n.getData(l,s);i.push(a)}return i}};var XR=class{constructor(t,e,r){this.canvas=new X8;this.layer=new CR;this.layerPhys=new xR;this.activeLayer=new SR;this.ruleTemplateName=new zR;this.rule=new WR;this.ruleSelect=new _R;this.padsPairGroup=new NR;this.padsPairGroupDetail=new kR;this.net=new q8;this.primitive=new $8;this.group=new K8;this.via=new $I;this.pad=new qE;this.line=new JE;this.arc=new QE;this.poly=new e3;this.fill=new KI;this.fpcFill=new YR;this.region=new ER;this.partition=new jR;this.pour=new Z8;this.copper=new d3;this.image=new OR;this.obj=new LR;this.tear=new t3;this.font=new KA;this.str=new r3;this.attr=new ST;this.inner=new t_;this.dimension=new AR;this.dimensionAttr=new vR;this.component=new i3;this.padNet=new n3;this.shell=new RR;this.shellEntity=new MR;this.crease=new DR;this.boss=new wR;this.panelize=new J8;this.reuseBlock=new lF;this.source=!1;this.version=t,this.doctype=e,this.compiler=r,this.format=new Vg().getConfig(t),this.compiler==null&&(this.encoder=new Bk(x.getInstance().id))}get ignorePartitionId(){return this.doctype!=3}saveCommonData(){this.feed("CANVAS"),$e.getInstance().getAllItem().forEach(D=>{this.feed("LAYER",D)}),$e.getInstance().getLayerPhys().forEach(D=>{this.feed("LAYER_PHYS",D)}),this.feed("ACTIVE_LAYER");let r=te.getInstance(),i=r.getAllSafeSpacing(),n=r.getAllOtherSpacing(),s=r.getAllTrackPhysics(),a=r.getAllCreepageSpacing(),l=r.getAllNetLengthPhysics(),c=r.getAllNetLengthTolerancePhysics(),h=r.getAllDifferentialPhysics(),u=r.getAllBlindPhysics(),d=r.getAllRadiusPhysics(),p=r.getAllInnerPlane(),m=r.getAllCopperPlane(),g=r.getAllPasteExpansion(),y=r.getAllSolderExpansion(),b=r.getAllAutoRouterRules(),P=r.getAllNetClass(),T=r.getAllNets(),I=r.getAllNetDifferentials(),C=r.getAllEqualLengthGroups(),E=r.getAllPadsPairGroups(),O=r.getAllRegions();T.forEach(D=>{this.feed("NET",D)}),this.feed("RULE_TEMPLATE"),i.forEach(D=>{this.feed("RULE",D)}),n.forEach(D=>{this.feed("RULE",D)}),a.forEach(D=>{this.feed("RULE",D)}),s.forEach(D=>{this.feed("RULE",D)}),l.forEach(D=>{this.feed("RULE",D)}),c.forEach(D=>{this.feed("RULE",D)}),h.forEach(D=>{this.feed("RULE",D)}),u.forEach(D=>{this.feed("RULE",D)}),d.forEach(D=>{this.feed("RULE",D)}),p.forEach(D=>{this.feed("RULE",D)}),m.forEach(D=>{this.feed("RULE",D)}),g.forEach(D=>{this.feed("RULE",D)}),y.forEach(D=>{this.feed("RULE",D)}),b.forEach(D=>{this.feed("RULE",D)}),E.forEach(D=>{this.feed("EQLEN_GRP",D)});let _=[];E.forEach(D=>{D.details.forEach(w=>{_.push(w)})}),_.forEach(D=>{this.feed("EQLEN",D)}),P.forEach(D=>{this.feed("RULE_SELECTOR",D)}),T.forEach(D=>{this.feed("RULE_SELECTOR",D)}),I.forEach(D=>{this.feed("RULE_SELECTOR",D)}),C.forEach(D=>{this.feed("RULE_SELECTOR",D)}),r.betweenNetRule.rule.forEach(D=>{this.feed("RULE_SELECTOR",D)}),O.forEach(D=>{this.feed("RULE_SELECTOR",D)}),this.getPrimitives().forEach(D=>{this.feed("PRIMITIVE",D)}),this.feed("SILK_OPTS",$e.getInstance().getLayer(3)),this.feed("SILK_OPTS",$e.getInstance().getLayer(4))}getFile(){return this.encoder.getDataStr()}getItems(t){return this.feedItems(t),this.getFile()}feed(t,e){let r=this.getItemFormat(t),i=this.getEncode(t),n={};for(let s of r)this.ignorePartitionId&&s=="partitionId"||(n[s]=this.getData(s,i,e));return this.upload2Compiler(t,n,e),this.uploadSource(t,n,e),n}feedFromGerber(t,e){let r=this.getItemFormat(t),i=this.getEncode(t),n={};for(let s of r)this.ignorePartitionId&&s=="partitionId"||(n[s]=this.getData(s,i,e));this.uploadSource(t,n,e)}feedItem(t){let e=this.getFileType(t);this.feed(e,t)}feedCopper(t){let e=new Map,r,i=[];for(let n of t)r=n.getParent().globalIndex,i=e.get(r),i||(i=[],e.set(r,i)),i.push(n);e.forEach((n,s)=>{this.feed("POURED",n)})}feedInner(t){let e=new Map,r,i=[];for(let n of t)r=n.layerId,i=e.get(r),i||(i=[],e.set(r,i)),i.push(n);e.forEach((n,s)=>{this.feed("INNER",n)})}feedComponent(t){this.feed("COMPONENT",t);let e=t.attributes,r=!0;for(let s of e)s.key=="Device"&&(r=!1),Cp(s,t)&&this.feed("ATTR",s);if(r)throw new Error("The device is missing device attributes, saving will lead to data loss, please contact the official customer service in time!");t.getPads().forEach(s=>{this.feed("PAD_NET",s)}),t.getItems().filter(s=>s instanceof It).forEach(s=>{this.feed("PAD_NET",s)})}feed4Type(t){switch(t){case"CANVAS":return this.feed(t);case"ACTIVE_LAYER":return this.feed(t);default:break}}feedItems(t){t.forEach(e=>{if(e.getParent()==null){let r=this.getFileType(e);this.feed(r,e)}})}feedPanelize(){let t=ai.getInstance(),e=JSON.parse(JSON.stringify(t.getDefaultPanelize()));this.feed("PANELIZE",e)}getFileType(t){if(t instanceof qr)return"LINE";if(t instanceof Je)return"PAD";if(t instanceof It)return"VIA";if(t instanceof Oi)return"ARC";if(t instanceof lr)switch(t.type){case"Line":case"Board Outline":return"POLY";case"Fill Region":case"Slot Region":return"FILL";case"TearDrop":return"TEARDROP";case"FPC Stiffener":return"FPC_FILL";case"Prohibited Region":case"Constraint Region":return"REGION";case"Partition":return"PARTITION";case"Copper Region":return"POUR";case"3D Shell - Outline":return"SHELL";case"3D Shell - Screw Pillar":return"BOSS";case"3D Shell - Side Datum Line":return"CREASE";case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":return"SHELL_ENTITY"}else{if(t instanceof Li)return t.key!=""?"ATTR":"STRING";if(t instanceof zd)return"DIMENSION";if(t instanceof Rf)return"DIMENSION";if(t instanceof Df)return"DIMENSION";if(t instanceof vi)return"COMPONENT";if(t instanceof ql)return"IMAGE";if(t instanceof bm)return"OBJ";if(t instanceof YS)return"GROUP";if(t instanceof Cn)return"FILL";if(t instanceof Pn)return"POURED";throw new Error("not support this shape:"+t)}}getItemFormat(t){return this.format[t]}getEncode(t){switch(t){case"CANVAS":return this.canvas;case"LAYER":return this.layer;case"LAYER_PHYS":return this.layerPhys;case"ACTIVE_LAYER":return this.activeLayer;case"NET":return this.net;case"PRIMITIVE":return this.primitive;case"GROUP":return this.group;case"VIA":return this.via;case"PAD":return this.pad;case"LINE":return this.line;case"ARC":return this.arc;case"POLY":return this.poly;case"FILL":return this.fill;case"FPC_FILL":return this.fpcFill;case"REGION":return this.region;case"PARTITION":return this.partition;case"POUR":return this.pour;case"POURED":return this.copper;case"IMAGE":return this.image;case"OBJ":return this.obj;case"TEARDROP":return this.tear;case"FONT":return this.font;case"STRING":return this.str;case"ATTR":return this.attr;case"DIMENSION":return this.dimension;case"COMPONENT":return this.component;case"PAD_NET":return this.padNet;case"RULE_TEMPLATE":return this.ruleTemplateName;case"RULE":return this.rule;case"RULE_SELECTOR":return this.ruleSelect;case"EQLEN_GRP":return this.padsPairGroup;case"EQLEN":return this.padsPairGroupDetail;case"SHELL_ENTITY":return this.shellEntity;case"SHELL":return this.shell;case"CREASE":return this.crease;case"BOSS":return this.boss;case"PANELIZE":return this.panelize}}getData(t,e,r){return e.getData(t,r)}getPrimitives(){return["ALL","COMPONENT","PROPERTY","COMPONENTSILK","TRACK","VIA","TESTPOINT","PAD","PADSPAIR","NETWORK","SUTUREHOLE","TEARDROP","RATLINE","GROUP","TEXT","IMAGE","PICTURE","DIMENSION","BOARDOUTLINE","SLOTREGION","FILLREGIEN","COPPEROUTLINE","COPPERFILLED","PROHIBITEDREGION","CONSTRAINT","PARTITION","LINE","LOCKED","UNLOCKED","SHELL","BOSS","CREASE","TOPSHELLCUT","SIDESHELLCUT","TOPBOTTOMENTITY","SIDEENTITY","FPC_STIFFENER"]}uploadSource(t,e,r){var i;if(this.encoder!=null)switch(t){case"CANVAS":return this.encoder.uploadCanvas(e);case"LAYER":return this.encoder.uploadLayer(r.layerId,e);case"LAYER_PHYS":return this.encoder.uploadLayerPhys(r.layerId,e);case"ACTIVE_LAYER":return this.encoder.uploadActiveLayer(e);case"NET":return this.encoder.uploadNet(r.name,e);case"PRIMITIVE":return this.encoder.uploadPrimitive(r,e);case"GROUP":return this.encoder.uploadGroup(r.globalIndex,e);case"VIA":return this.encoder.uploadVia(r.globalIndex,e);case"PAD":return this.encoder.uploadPad(r.globalIndex,e);case"LINE":return this.encoder.uploadLine(r.globalIndex,e);case"ARC":case"CARC":return this.encoder.uploadArc(r.globalIndex,e);case"POLY":return this.encoder.uploadPoly(r.globalIndex,e);case"FILL":return this.encoder.uploadFill(r.globalIndex,e);case"FPC_FILL":return this.encoder.uploadFpcFill(r.globalIndex,e);case"REGION":return this.encoder.uploadRegion(r.globalIndex,e);case"PARTITION":return this.encoder.uploadPartition(r.globalIndex,e);case"POUR":return this.encoder.uploadPour(r.globalIndex,e);case"POURED":return this.encoder.uploadPoured((i=r[0])==null?void 0:i.getParent().globalIndex,e);case"IMAGE":return this.encoder.uploadImage(r.globalIndex,e);case"OBJ":return this.encoder.uploadObj(r.globalIndex,e);case"TEARDROP":return this.encoder.uploadTeardrop(r.globalIndex,e);case"STRING":return this.encoder.uploadString(r.globalIndex,e);case"ATTR":return this.encoder.uploadAttr(r.globalIndex,e);case"DIMENSION":return this.encoder.uploadDimension(r.globalIndex,e);case"COMPONENT":return this.encoder.uploadComponent(r.globalIndex,e);case"PAD_NET":return this.encoder.uploadPadNet(e);case"RULE_TEMPLATE":return this.encoder.uploadRuleTemplate(e);case"RULE":return this.encoder.uploadRule(e);case"RULE_SELECTOR":return this.encoder.uploadRuleSelector(e);case"EQLEN_GRP":return this.encoder.uploadEQLenGrp(r.number,e);case"SHELLCUT":return this.encoder.uploadShellCut(r.globalIndex,e);case"SHELL_ENTITY":return this.encoder.uploadShellEntity(r.globalIndex,e);case"SHELL":return this.encoder.uploadShell(r.globalIndex,e);case"CREASE":return this.encoder.uploadCrease(r.globalIndex,e);case"BOSS":return this.encoder.uploadBoss(r.globalIndex,e);case"PANELIZE":return this.encoder.uploadPanelize(e);case"SILK_OPTS":return this.encoder.uploadSilkOpts(r.layerId,e);case"PREFERENCE":return this.encoder.uploadPreference(e);case"INNER":return this.encoder.uploadLayerFill(r[0].layerId,e);case"BOARD":return this.encoder.uploadBoard(e)}}upload2Compiler(t,e,r){var n,s;if(this.compiler==null)return;let i=this.doctype!=3;switch(t){case"PAD":{(i||r.getParent()==null)&&this.compiler.uploadPad(r.globalIndex,e);break}case"POLY":{(i||r.getParent()==null)&&this.compiler.uploadPoly(r.globalIndex,e);break}case"POUR":{(i||r.getParent()==null)&&this.compiler.uploadPour(r.globalIndex,e);break}case"POURED":{((s=(n=r[0])==null?void 0:n.getParent())==null?void 0:s.globalIndex)!=null&&this.compiler.uploadPour(r.globalIndex,e);break}case"INNER":{e[0]&&this.compiler.uploadLayerFill(e[0].layerId,e);break}case"FILL":{(i||r.getParent()==null)&&this.compiler.uploadFill(r.globalIndex,e);break}case"FPC_FILL":{(i||r.getParent()==null)&&this.compiler.uploadFpcFill(r.globalIndex,e);break}case"REGION":{(i||r.getParent()==null)&&this.compiler.uploadRegion(r.globalIndex,e);break}case"PARTITION":{this.compiler.uploadPartition(r.globalIndex,e);break}case"ARC":{(i||r.getParent()==null)&&this.compiler.uploadArc(r.globalIndex,e);break}case"LINE":{(i||r.getParent()==null)&&this.compiler.uploadLine(r.globalIndex,e);break}case"VIA":{(i||r.getParent()==null)&&this.compiler.uploadVia(r.globalIndex,e);break}case"STRING":{(i||r.getParent()==null)&&this.compiler.uploadString(r.globalIndex,e);break}case"ATTR":{this.compiler.uploadAttr(r.globalIndex,e);break}case"FONT":this.compiler.uploadFont(e);break;case"IMAGE":{(i||r.getParent()==null)&&this.compiler.uploadImage(r.globalIndex,e);break}case"OBJ":{(i||r.getParent()==null)&&this.compiler.uploadObj(r.globalIndex,e);break}case"DIMENSION":{(i||r.getParent()==null)&&this.compiler.uploadDimension(r.globalIndex,e);break}case"DIMENSIONATTR":{this.compiler.uploadAttr(r.globalIndex,e);break}case"LAYER":{this.compiler.uploadLayer(r.layerId,e);break}case"LAYER_PHYS":{this.compiler.uploadLayerPhys(r.layerId,e);break}case"ACTIVE_LAYER":{this.compiler.uploadActiveLayer(e);break}case"COMPONENT":{this.compiler.uploadComponent(r.globalIndex,e);break}case"CANVAS":{this.compiler.uploadCanvas(e);break}case"PAD_NET":{this.compiler.uploadPadNet(e);break}case"PRIMITIVE":{this.compiler.uploadPrimitive(r,e);break}case"GROUP":{this.compiler.uploadGroup(r.globalIndex,e);break}case"NET":{this.compiler.uploadNet(r,e);break}case"TEARDROP":{this.compiler.uploadTeardrop(r.globalIndex,e);break}case"FONT":break;case"RULE_TEMPLATE":{this.compiler.uploadRuleTemplate(e);break}case"RULE":{this.compiler.uploadRule(e);break}case"RULE_SELECTOR":{this.compiler.uploadRuleSelector(e);break}case"SHELL":{this.compiler.uploadShell(r.globalIndex,e);break}case"CREASE":{this.compiler.uploadCrease(r.globalIndex,e);break}case"SHELLCUT":{this.compiler.uploadShellCut(r.globalIndex,e);break}case"SHELL_ENTITY":{this.compiler.uploadShellEntity(r.globalIndex,e);break}case"BOSS":{this.compiler.uploadBoss(r.globalIndex,e);break}case"PANELIZE":{this.compiler.uploadPanelize(e);break}case"SILK_OPTS":{this.compiler.uploadSilkOpts(r.layerId,e);break}case"EQLEN":case"EQLEN_GRP":{this.compiler.uploadEQLenGrp(r.number,e);break}case"PREFERENCE":{this.compiler.uploadPreference(e);break}case"BOARD":{this.compiler.uploadBoard(e);break}default:break}}};var qR=class extends so{constructor(e,r){super();this.combinationIndex={};this.combinationName={};for(let i of e)this.combinationIndex[i.globalIndex]=i.getIndex(),this.combinationName[i.globalIndex]=i.name;this.action=r}rebuild(){for(let e in this.combinationIndex){let r=this.combinationIndex[e],i=new Array,n=new er;for(let l of r){let c=n.getItem(l);c!=null&&i.push(c)}let s=this.combinationName[e],a=kt.rebuild(e,i,s);return this.updateFilterStatus(a),this.updateData(),a}}getItem(){return"ignore"}remove(){for(let e in this.combinationIndex){let r=kt.getItem(e);r!=null&&(r.remove(),A.publish("delete",r),this.updateData())}}modify(){for(let e in this.combinationIndex){let r=kt.getItem(e);if(r==null)continue;let i=r.getItems();i.forEach(a=>a.setGroupID(void 0));let n=new er,s=new Array;for(let a of this.combinationIndex[e]){let l=n.getItem(a);l!=null&&s.push(l)}r.setItems(s),s.forEach(a=>a.setGroupID(e)),this.combinationIndex[e].clear();for(let a of i)this.combinationIndex[e].add(a.globalIndex)}}upload(e=!1){if(x.getInstance().doctype==4)return;let r=x.getInstance().compiler;for(let i in this.combinationIndex){let n=kt.getItem(i),s=this.isDelete(e);r.setTicket(),s||!n?r.deleteGroup(i):r.uploadGroup(i,{groupName:n.name});let a=new XR("2.0",3,r),l=this.combinationIndex[i],c=new Array,h=new er;for(let u of l){let d=h.getItem(u);d!=null&&(c.push(d),r.setTicket(),a.feedItem(d.model))}}}updateData(){}};var xa=class extends va{constructor(e){super();this.type="Radius Dimension";this.model=e,e.setModelWatcher(this),this.initRefreshRender()}get textPosition(){return this.model.textPosition}set textPosition(e){this.model.textPosition=e,this.refreshRender()}get box(){return this.model.text.box}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=e,this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e,this.refreshRender()}get unit(){return this.model.unit}set unit(e){this.model.unit=e,this.refreshRender()}get precision(){return this.model.precision}set precision(e){this.model.precision=e,this.refreshRender()}get width(){return this.model.strokeWidth}set width(e){this.model.strokeWidth=e,this.refreshRender()}get height(){return this.model.fontSize}set height(e){this.model.fontSize=e,this.refreshRender()}get start(){return this.model.start}set start(e){this.model.start=e,this.refreshRender()}get end(){return this.model.end}set end(e){let r=0,i=Xj(e.bbox());for(let n of i.getArcs())n.isSelect(e.x,e.y)&&(r=n.radius);for(let n of i.rects)if(n.isSelect(e.x,e.y)){let s=n.getHoveredArc(e.x,e.y);if(s)r=s.rx;else continue}for(let n of i.polygons){let s=n.getAllChildrens();for(let a of s)a.isSelect(e.x,e.y)&&cF(a.model.modelType)&&(r=a.radius)}this.model.radius=r,this.model.end=e,this.refreshRender()}getCenter(){let e,r=Xj(this.end.bbox());for(let i of r.getArcs())i.isSelect(this.end.x,this.end.y)&&(e=i.center);for(let i of r.rects)if(i.isSelect(this.end.x,this.end.y)){let n=i.getHoveredArc(this.end.x,this.end.y);if(n)e=n.center;else continue}for(let i of r.polygons){let n=i.getAllChildrens();for(let s of n)s.isSelect(this.end.x,this.end.y)&&cF(s.model.modelType)&&(e=s.center)}return e}getArcRadius(){return this.model.radius*10}updateRadius(e,r){this.start=e,this.end=r}getRadiusLength(){return this.model.text.width+8}setRadiusLength(e){this.model.radius=e,this.refreshRender()}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.model.transform(i),this.refreshRender()}transform(e){this.model.transform(e),this.refreshRender()}flip(e){this.model.flip(e),this.refreshRender()}isSelect(e,r){return this.getParent()!=null?!1:this.model.inShape(e,r)}buildBBox(){return this.model.buildBBox()}getLineBBox(){return TVe(this.start,this.end,this.strokeWidth)}toJSON(){var r;return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,end:this.end,width:this.width,height:this.height,length:this.end.distance1(this.start),precision:this.precision,unit:this.unit,locked:this.locked,textPosition:this.textPosition,silkColor:((r=this.silkColor)==null?void 0:r.toString())||null}}getCoords(){return[xe(this.end.x*10,4),xe(this.end.y*10,4),xe(this.start.x*10,4),xe(this.start.y*10,4),this.model.radius*10]}getBaseGraphics(){return this.model.getBaseGraphics()}getType(){return 15}get strokeWidth(){return this.width}get textPath(){return this.model.text.outline}get textMatrix(){return this.model.text.matrix}get viewWidth(){return this.model.text.width}get viewHeight(){return this.model.text.height}get outlineModified(){return this.model.text.outlineModified}};var f6=class extends so{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?or.getInstance().encode("DIMENSION",t.model):null,this.action=e,this.deleteGroupID(t)}rebuild(){let{globalIndex:t,partition:e,layerId:r,start:i,end:n,width:s,height:a,length:l,precision:c,unit:h,locked:u,textPosition:d,silkColor:p}=this.data,m=p?ee.of3(p):void 0,g=new S(i.x,i.y),y=new S(n.x,n.y);d=new S(d.x,d.y);let b=Uo.rebuild(t,r,g,y,s,a,l,c,h,u);return b.textPosition=d,b.partition=e,b.number=this.number,A.publish("hasModifyPcbItem",b),this.addGroupID(b),b.silkColor=m,this.updateFilterStatus(b),this.updateData(),this.data=void 0,b}getItem(){return Uo.getItem(this.gId)}remove(){let t=Uo.getItem(this.gId);this.data=t.toJSON(),this.number=t.number,A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t),this.updateData()}modify(){let{globalIndex:t,layerId:e,start:r,end:i,width:n,height:s,length:a,precision:l,unit:c,locked:h,textPosition:u,silkColor:d}=this.data,p=d?ee.of3(d):void 0,m=new S(r.x,r.y),g=new S(i.x,i.y);u=new S(u.x,u.y);let y=Uo.getItem(this.gId),b=y.toJSON();y.start.equals(m)||(y.start=m),y.end.equals(g)||(y.end=g),y.layerId!=e&&(y.layerId=e),y.width!=n&&(y.width=n),y.height!=s&&(y.height=s),y.unit!=c&&(y.unit=c),y.precision!=l&&(y.precision=l),y.locked!=h&&(y.locked=h),y.textPosition.equals(u)||(y.textPosition=u),p||(y.silkColor=void 0),this.equals(p,y.silkColor)||(y.silkColor=p),this.data=b,this.modifyGroupID(y),A.publish("hasModifyPcbItem",y),this.updateData()}equals(t,e){return t!=null&&e!=null?t.equals(e):e==t}upload(t=!1){let e=this.isDelete(t),r=x.getInstance().compiler;e?(r.setTicket(),r.deleteDimension(this.gId)):(this.source==null&&this.updateData(),r.setTicket(),this.source!=null&&r.uploadDimension(this.gId,this.source)),this.source=void 0}updateData(){if(this.source==null){let t=Uo.getItem(this.gId);t!=null&&(this.source=or.getInstance().encode("DIMENSION",t.model))}}};var Ar=class extends Ue{constructor(t){super(t),jo("editor/shape/Track")}get direct(){return this.model.direct}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,end:this.end,width:this.width,locked:this.locked,net:this.net}}getType(){return 22}update(){this._bbox=nh.trackToOctagon(this.start,this.end,this.width)}octagon(){return this._bbox}};var qj=class{static rebuild(t){let{globalIndex:e,layerId:r,start:i,end:n,width:s,locked:a}=t,l=new S(i.x,i.y),c=new S(n.x,n.y);return $u.rebuild(e,r,l,c,s,a)}};var $j=class{static rebuild(t){let{globalIndex:e,layerId:r,center:i,radius:n,width:s,startAngle:a,endAngle:l,sweep:c,locked:h,arcType:u}=t,d=new S(i.x,i.y);return qc.rebuild(e,r,d,n,s,a,l,c,h,u)}};var MT=class extends Wg{constructor(e,r){super();this.copperTool=new UR;let i=e.getComponent(),n=i instanceof Vn?i.copperResult:[];this.gId=e.globalIndex,this.type=e.type,this.number=r=="delete"?e.number:null,this.data=r=="add"?void 0:e.toJSON(),this.source=r=="delete"?or.getInstance().encodeProfile(e.model):null,this.tool=new Nl(JSON.stringify(e.getComponent()),e.type,n),this.action=r,this.deleteGroupID(e),this.copperTool.recordCopperCommand(e,r),r=="modify"&&this.type=="TearDrop"&&A.publish("addModifyTeardrop",e),ce.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:e.globalIndex,net:e.net,bbox:e.buildBBox()}])}hasConnectChange(){return this.action==="delete"&&this.type=="3D Shell - Side Datum Line"}getConnnectChangeCommand(){return new VR().getConnectCommands(this.gId)}rebuild(){let e=this.data,r=e.globalIndex,i=e.partition,n=e.type,s=e.layerId,a=e.shapes,l=e.strokeWidth,c=e.net,h=e.locked,u=e.silkColor?ee.of3(e.silkColor):null,d=e.componentData,p=!!e.isSimplify,m=a.map(y=>y.map(b=>{for(let P in b){if(P=="LINE")return qj.rebuild(b[P]);if(P=="ARC")return $j.rebuild(b[P])}}).filter(b=>b!=null)),g=this.rebuildPolygon(r,n,s,m,l,c,h,u);return p&&(g.isSimplify=!0),g.fill(),g.partition=i,g.number=this.number,A.publish("hasModifyPcbItem",g),this.addGroupID(g),this.updateFilterStatus(g),this.tool.rebuildComponent(g),this.copperTool.rebuildCoppers(),g.type==="FPC Stiffener"?A.publish("checkOpenStiffenerLayer",{notShowTip:!0}):g.type=="Partition"&&this.rebuildPartition(g),this.rebuildRegionSelector(g,e.regionRuleSelector),this.updateData(),this.data=void 0,g}rebuildPolygon(e,r,i,n,s,a,l,c){return pt.rebuild(e,r,i,n,s,a,l,c)}getItem(){return pt.getItem(this.gId)}remove(){let e=this.getItem();this.data=e.toJSON(),this.number=e.number;let r=e.getComponent(),i=r?JSON.stringify(r):"{}",n=r instanceof Vn?JSON.stringify(r.copperResult):"[]";this.tool.setComponentData(i,n),this.tool.deleteComponent(e),A.publish("hasModifyPcbItem",e),this.copperTool.removeCoppers(),e.remove(),this.removeRegionSelector(),A.publish("delete",e),this.updateData()}modify(){let e=this.getItem(),r=e.toJSON(),i=e.getComponent(),n=i?JSON.stringify(i):"{}",s=i instanceof Vn?JSON.stringify(i.copperResult):"[]";e.removeFill();let a=this.data,l=a.globalIndex,c=a.type,h=a.layerId,u=a.shapes,d=a.strokeWidth,p=a.net,m=a.locked,g=a.silkColor?ee.of3(a.silkColor):null,y=e.getChildrens();y.forEach(P=>{P.forEach(T=>T.remove())}),y.length=0;let b=u.map(P=>P.map(T=>{for(let I in T){if(I=="LINE")return qj.rebuild(T[I]);if(I=="ARC")return $j.rebuild(T[I])}}).filter(T=>T!=null));e.setChildrens(b),e.isSimplify&&e.refreshOutlineByChildren(),e.type!=c&&(e.type=c),e.layerId!=h&&(e.layerId=h),e.strokeWidth!=d&&(e.strokeWidth=d),e.net!=p&&(A.publish("hasModifyPcbItem",e),e.net=p),e.locked!=m&&(e.locked=m),this.equals(g,e.silkColor)||(e.silkColor=g),this.modifyRegionSelector(e,a.regionRuleSelector),e.fill(),this.data=r,this.modifyGroupID(e),this.tool.modifyComponent(e),this.tool.setComponentData(n,s),e.toggleCopperResult(!e.hiddenCopperResult),A.publish("hasModifyPcbItem",e),this.updateData()}compareDataChange(e){let r=pt.getItem(this.gId);if(!r||this.action!=="modify")return!0;let i=this.data,n=r.toJSON();if((!s(n.shapes,i.shapes)||i.type!==n.type)&&(r.type=="Copper Region"||i.type=="Copper Region"))return e.push(new c3(r,"delete")),r.clearCopper(),!0;if(JSON.stringify(this.data)!==JSON.stringify(r))return!0;return!1;function s(l,c){if(l.length!=c.length)return!1;for(let h=0;h<l.length;h++)if(a(n.shapes)!==a(i.shapes))return!1;return!0}function a(l){let c=l.map(h=>{if(Array.isArray(h))return h=h.map(u=>{let d=Object.keys(u)[0],p=u[d];return d==="LINE"?[p.start,p.end,p.width]:d==="ARC"?[p.center,p.startAngle,p.endAngle,p.radius,p.sweep,p.width]:[]}),h;{let u=Object.keys(h)[0],d=h[u];return u==="LINE"?[d.start,d.end,d.width]:u==="ARC"?[d.center,d.startAngle,d.endAngle,d.radius,d.sweep,d.width]:[]}});return JSON.stringify(c)}}comparePourChange(){let e=this.data,r=pt.getItem(this.gId);return!r||this.action!=="modify"?{action:"fullUpdate",data:null}:e.type=="Copper Region"&&r.type!=="Copper Region"?{action:"fullUpdate",data:null}:e.type!=="Copper Region"&&r.type=="Copper Region"?{action:"fullUpdate",data:null}:r.model.component.name!==e.componentData.name?{action:"halfUpdate",data:{id:r.globalIndex,key:"name",value:r.model.component.name}}:r.net!==e.net?{action:"halfUpdate",data:{id:r.globalIndex,key:"net",value:r.net}}:r.layerId!==e.layerId?{action:"halfUpdate",data:{id:r.globalIndex,key:"layerId",value:r.layerId}}:{action:"notUpdate",data:null}}upload(e=!1){let r=x.getInstance().compiler,i=r.consistencyManager.getMaxTicket();this.isDelete(e)?(r.setTicket(++i),qI(this.gId,this.type)):(this.source==null&&this.updateData(),r.setTicket(++i),KE(this.gId,this.type,this.source)),this.source=null}updateData(){if(this.source==null){let e=this.getItem();e!=null&&(this.source=or.getInstance().encodeProfile(e.model),this.type=e.type)}}};function zie(){let o=te.getInstance().getAllBlindPhysics(),t=te.getInstance().getDefaultBlindPhysics();o.forEach(i=>{i.getAllVias().forEach(s=>{s.used=!1})});let e=Hr.getAllItem(),r=new Set;for(let i of e){let n=i.name;if(!r.has(n)){r.add(n);let s=t.getBlindVia(n);s!=null&&(s.used=!0)}}return o}var hF=class{};var iC=class extends hF{toPlainObj(t){let e=t.layerID,r=t.type,i=t.name,n=0;t.config&&(t.visible?n=1:n=2);let s=t.activeColor,a=t.deactiveColor;return{layerId:e,layerType:r,layerName:i,status:n,activeColor:s.toString(),activeColorAlpha:s.alpha,deactiveColor:a.toString(),deactiveColorAlpha:$e.getInstance().deactiveAlpha,locked:t.locked}}save(t){let e=this.toPlainObj(t);return[e.layerId,e.layerType,e.layerName,e.status,e.activeColor,e.activeColorAlpha,e.deactiveColor,e.deactiveColorAlpha,e.locked]}};function Sp(o,t=!1){let e=$e.getInstance().getLayer(+o),r=x.getInstance().compiler,i=r.consistencyManager.getMaxTicket();r.setTicket(++i),e==null||t?x.getInstance().compiler.deleteLayer(+o):x.getInstance().compiler.uploadLayer(+o,or.getInstance().encode("LAYER",e))}function uF(o,t=!1){let e=x.getInstance().compiler,r=e.consistencyManager.getMaxTicket();e.setTicket(++r),t?x.getInstance().compiler.deleteLayerPhys(o.layerId):x.getInstance().compiler.uploadLayerPhys(o.layerId,or.getInstance().encode("LAYER_PHYS",o))}function dF(){let o=x.getInstance().compiler,t=o.consistencyManager.getMaxTicket();o.setTicket(++t),x.getInstance().compiler.uploadActiveLayer(or.getInstance().encode("ACTIVE_LAYER"))}function Yie(){let o=x.getInstance().compiler,t=o.mgr;if(t.layerPhyFix.errorLayerData.size>0||t.layerPhyFix.errorLayerPhyData.size>0){let e=$e.getInstance().getAllItem(),r=$e.getInstance().getLayerPhys();for(let i of t.layerPhyFix.errorLayerData)o.deleteLayer(i);for(let i of t.layerPhyFix.errorLayerPhyData)o.deleteLayerPhys(i);for(let i of e)Sp(i.layerId);for(let i of r)uF(i);t.layerPhyFix.clear()}}var Bf=class o{static getInstance(){return o._instance==null&&(o._instance=new o),o._instance}constructor(){A.subscribe("toggleLayerSelected",t=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e=parseInt(t.layerid),r=t.toggleType,i=t.LayerBartoggleLayer;sl.toggleLayer(e,r,i),A.publish("updateFrame","")},$()),A.subscribe("toggleLayerState",t=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e=t.layeridarr;e!=null&&(e.forEach(r=>{let i=parseInt(r.id);i!=null&&(r.isVisible!=null&&(be.getLayer(i).visible=r.isVisible),r.isLocked!=null&&(be.getLayer(i).locked=r.isLocked),Sp(r.id))}),Au.layeredGroup.updateLayerVisibility(),Au.updateVisibility(),A.publish("updateFrame",""))},$()),A.subscribe("DisplayLayer",t=>{if(!(!x.getInstance().isactive||23==x.getInstance().doctype)&&t.length==2){let e=new Array,r=be.getAllLayer().filter(i=>!Cx(i.layerID));if(t[1].toLowerCase()=="all")be.setGray(0),r.forEach(i=>{i.visible=!0,Sp(i.layerID),e.push({layerId:i.layerID,show:!0})});else{let i=parseInt(t[1]);r.forEach(n=>{n.visible=!1}),r.forEach(n=>{n.layerID==i&&(n.visible=!0),e.push({layerId:n.layerID,show:n.visible}),Sp(n.layerID)}),sl.toggleLayer(i)}A.publish("layerStatus",e,$()),A.publish("updateFrame","")}},$()),A.subscribe("layerNeedGray",t=>{!x.getInstance().isactive||23==x.getInstance().doctype||(be.setGray(t),A.publish("updateFrame",""))},$()),A.subscribe("justSwitchToNormalBrightness",()=>{!x.getInstance().isactive||23==x.getInstance().doctype||(be.setGray(0),A.publish("dealMultLayer",0),A.publish("updateFrame",""))},$()),A.subscribe("ToggleLayer",t=>{if(!(!x.getInstance().isactive||23==x.getInstance().doctype)&&t.length==2){let e=parseInt(t[1]);sl.toggleLayer(e),A.publish("updateFrame","")}},$()),A.messageBus.rpcService("CanRemoveLayers",t=>new Promise((e,r)=>{let i=t.layerIds,n=t.action,s=[],a=[],l=0;zie(),te.getInstance().getAllBlindPhysics().forEach(d=>{d.data.forEach(p=>{[p.startLayer,p.endLayer].forEach(m=>{Ms(m)&&(l=Math.max(m,l))})})});let h=i.some(d=>d<=l),u=$e.getInstance();i.forEach(d=>{let p=null;try{p=be.getLayer(d)}finally{if(!p)return;p.isInnerLayer()||u.isCustomLayer(p.layerID)?(!TGe(p.layerID)||n==="layerTotalUpdated"&&X3t(String(p.layerID)))&&(a.push(p.layerID),s.push(p.name)):j3t(p.layerID)||(a.push(p.layerID),s.push(p.name))}}),e({notEmpty:{layerNames:s,layerIds:a},conflictBlindViaRule:h})})),A.messageBus.rpcService("LayerConfig",t=>new Promise((e,r)=>{let i=[],n=t&&t.signal?be.getAllSignalLayer():be.getAllLayer();if(t&&t.hasMulti){let a=be.getMultLayer();!n.includes(a)&&n.push(a)}let s=new iC;for(let a of n)i.push(s.toPlainObj(a));e(i)})),A.messageBus.rpcService("LayerConfigForAutoRouter",t=>new Promise((e,r)=>{let i=[],n=t&&t.copper?be.getAllCopperLayer():be.getAllLayer();if(t&&t.hasMulti){let a=be.getMultLayer();!n.includes(a)&&n.push(a)}let s=new iC;for(let a of n)i.push(s.toPlainObj(a));e(i)})),A.messageBus.rpcService("getLineLayer",()=>new Promise((t,e)=>{let r=new Array,i=be.getAllLayer();for(let n of i)if(!gr(n.layerID)&&n.config&&![47,52].includes(n.layerID)&&!ba(n.layerID)&&!IA(n.layerID)){let s={text:n.name,value:n.layerID};r.push(s)}t(r)})),A.messageBus.rpcService("getCopperLayersCount",()=>new Promise((t,e)=>{let r=be.getAllCopperLayer().length;t(r)}))}updateLayerInfo(){let t=Array(),e=be.getAllLayer().filter(i=>i.layerID!=47),r=new iC;for(let i of e){let n=r.save(i);n.splice(0,0,"LAYER"),t.push(n),be.refreshConfigInnerLayers(i.layerID,i)}A.publish("renderLayerPanel",{tabid:x.getInstance().tabId,array:t},$()),A.publish("setActive",{activeLayer:be.getActiveLayerID()},$())}refreshLayerPanel(){A.publish("updateLayerMgrIcon",{},$())}};function j3t(o){let t=Lc();for(let e of t){let r=e.model;if(r!=null&&r instanceof ki&&r.layerId==o)return!1}return!0}function X3t(o){let t=Array.from(te.getInstance().getAllBlindPhysics());for(let e=0;e<t.length;e++){let r=t[e].data;for(let i=0;i<r.length;i++)if(String(r[i].startLayer)===String(o)||String(r[i].endLayer)===String(o))return!0}return!1}var e2=class{setGGEID(t){if(this.getAttr(t,"Footprint")!==null){let e=Ji.getItem(t.footprintUUID);if(this.getAttr(t,"Designator")!==null){let r=this.getAttr(t,"Designator");e.modifyName("",r.value),t.modifyATTRMap("Designator",r.value)}}}checkDesignator(t){if(this.getAttr(t,"Footprint")!=null){let r=Ji.getItem(t.footprintUUID),i=this.getAttr(t,"Designator"),n=ce.pcbConfig.designatorAnnocationType;i.value=r.getNewNum(i.value,n),t.modifyATTRMap("Designator",i.value)}}getAttr(t,e){for(let r of t.attributes)if(r.key==e)return r;return null}sycnLayers(t){if(!(!t||t.length==0)){for(let e of t)be.getLayer(e.layerId)==null&&be.addPcbLayerByModel(e);Bf.getInstance().updateLayerInfo()}}build(t,e,r=!1,i){t.addReuseAttrMap();let n=t.buildModel();n.setLayerIdReplacementTable(i,!0),n.position=e,this.setGGEID(n),this.checkDesignator(n);let s=n.box.bbox,a=n.position,l=.5,c=ce.attributeConfig.getAttribute("Footprint"),h=ce.attributeConfig.getAttribute("Designator"),u=h!=null&&(h.showKey||h.showValue),d=new Set,p=ce.getDefaultFontSetting();for(let g of n.attributes)if(d.add(g.key),(g.key==="Designator"||g.key==="Footprint"||g.key==="Device")&&!g.showKey&&!g.showValue&&(g.fontFamily=p.defaultComponentFontTypeface,g.fontSize=p.defaultComponentFontHeight,g.strokeWidth=p.defaultComponentFontStrokeWidth,g.type=g.fontFamily==="default"?0:1),g.key=="Designator"&&u&&a.equals(g.position)&&g.positionIsNull){let y=s.UL().add1(0,l);g.position=y,g.origin!=3&&(g.origin=3),g.positionIsNull=!1}else if(c!=null&&(c.showKey||c.showValue)&&g.key=="Footprint"&&a.equals(g.position)){let y=s.LL().add1(0,-l);g.position=y,g.origin!=1&&(g.origin=1)}let m=$c(n);if(!r)for(let g in m.attrsMap){let y=m.attrsMap[g],b=ce.attributeConfig.getAttribute(g);if(b!=null&&(b.showKey||b.showValue)&&!d.has(g)&&!(g=="3D Model"||g=="3D Model Transform")){let P=this.createAttribute(m,y,g);P.showKey=P.showKey||b.showKey,P.showValue=P.showValue||b.showValue,m.addAttribute(P)}}return m.layerId=this.getLayer(r),m.position=e,this.resetAttr(m),this.sycnLayers(t.layers),t.clear(),m}getId(t){let e=new Set,r=t.getItems(),i=t.attributes;for(let l of r)e.add(l.globalIndex);for(let l of i)e.add(l.globalIndex);let n=t.globalIndex,s=0,a=n+"e"+s++;for(;e.has(a);)a=n+"e"+s++;return a}createAttribute(t,e,r="Device"){let i=ce.getDefaultFontSetting(),n=i.defaultComponentFontTypeface,s=i.defaultComponentFontHeight,a=i.defaultComponentFontStrokeWidth,l=mo.getInstance().addText(this.getId(t),3,r,!1,e,!1,n,s,0,!1,S.ORIGIN,3,a,!1,0,!1,!0);return ti.addtextByModel(l)}getLayer(t){return be.getActiveLayerID()==2&&!t?2:1}resetAttr(t){t.attributes.forEach(e=>{let r=ce.attributeConfig.getAttribute(e.key);r!=null&&(e.showKey=e.showKey||r.showKey,e.showValue=e.showValue||r.showValue),t.resetAttr(e)})}};var z1=class{constructor(t){this.attr=new ST(!0);this.component=new i3;this.padNet=new n3;this.via=new $I;this.reuseBlock=new lF;this.file=new Array;this.format=new Vg().getConfig(t)}save(t){return this.file.length=0,this.feed("COMPONENT",t),t.attributes.forEach(n=>{Cp(n,t)&&this.feed("ATTR",n)}),t.getPads().forEach(n=>{this.feed("PAD_NET",n)}),t.getItems().filter(n=>n instanceof It).forEach(n=>{this.feed("PAD_NET",n)}),this.file}replace(t,e,r){return this.file.length=0,this.feed("COMPONENT",t),t.attributes.forEach(a=>{a.key==e&&(a.value=r),Cp(a,t)&&this.feed("ATTR",a)}),t.getPads().forEach(a=>{this.feed("PAD_NET",a)}),t.getItems().filter(a=>a instanceof It).forEach(a=>{this.feed("PAD_NET",a)}),this.file}restore(t){return this.file.length=0,this.feed("COMPONENT",t),t.attributes.forEach(n=>{Cp(n,t)&&n.key!="Footprint"&&this.feed("ATTR",n)}),t.getPads().forEach(n=>{this.feed("PAD_NET",n)}),t.getItems().filter(n=>n instanceof It).forEach(n=>{this.feed("PAD_NET",n)}),this.file}feed(t,e){let r=this.getItemFormat(t),i=this.getEncode(t),n={};for(let c of r)n[c]=this.getData(c,i,e);let s=i.getKey(),a=e.number,l={id:s,number:a,type:t,data:n};return this.file.push(l),l}getItemFormat(t){return this.format[t]}getEncode(t){switch(t){case"ATTR":return this.attr;case"COMPONENT":return this.component;case"PAD_NET":return this.padNet}}getData(t,e,r){return e.getData(t,r)}};var Xie=class extends $l{get hashkey(){return null}feed(t){let{startTrackWidthFollowLast:e,lastTrackWidth:r,startViaSizeFollowLast:i,lastViaInnerDiameter:n,lastViaDiameter:s,snap:a,routingMode:l,routingCorner:c,removeLoop:h,rotatingObject:u,trackFollow:d,stretchTrackMinCorner:p,preferenceConfig:m,realTimeUpdateUnusedLayers:g,unusedPadRange:y,pushVia:b,pathOptimization4BePushed:P,currentPathOptimization4BePushed:T,removeCircuitsContainingVias:I,removeAntenna:C}=t;this.startTrackWidthFollowLast=e||x.getInstance().doctype!=3,this.lastTrackWidth=r/10,this.startViaSizeFollowLast=i||x.getInstance().doctype!=3,this.lastViaInnerRadius=n/20,this.lastViaRadius=s/20,this.snap=a,this.routingMode=YFe(l),this.routingCorner=c,this.removeLoop=h,this.rotatingObject=u,this.trackFollow=d,this.stretchTrackMinCorner=p,this.preferenceConfig=m,this.realTimeUpdateUnusedLayers=g,this.unusedPadRange=XFe(y)||3,this.pushVia=$Fe(b)||"OPTIMIZA_OPEN",this.pathOptimization4BePushed=ZFe(P)||0,this.currentPathOptimization=QFe(T)||"OPTIMIZA_WEAK",this.removeCircuitsContainingVias=I!=null?I:!0,this.removeAntenna=C!=null?C:!0}check(){return!(this.startTrackWidthFollowLast==null||!this.isNumber(this.lastTrackWidth)||this.lastTrackWidth<=0||this.startViaSizeFollowLast==null||!this.isNumber(this.lastViaInnerRadius)||this.lastViaInnerRadius<=0||!this.isNumber(this.lastViaRadius)||this.lastViaRadius<=0||this.snap==null||this.routingMode==null||this.removeLoop==null||this.rotatingObject==null||this.trackFollow==null||this.routingCorner==null||((isNaN(this.stretchTrackMinCorner)||this.stretchTrackMinCorner<0)&&(this.stretchTrackMinCorner=1),!this.isNumber(this.unusedPadRange)||this.unusedPadRange<1||this.unusedPadRange>3)||this.pushVia==null||this.pathOptimization4BePushed==null||this.currentPathOptimization==null||this.removeCircuitsContainingVias==null||this.removeAntenna==null)}finish(){if(this.check()){ce.pcbConfig.startTrackWidth=this.startTrackWidthFollowLast?"last":"rule",ce.pcbConfig.startViaSize=this.startViaSizeFollowLast?"last":"rule",rt.defaultVia.radius=this.lastViaRadius,rt.defaultVia.innerRadius=this.lastViaInnerRadius,we.adsorb=this.snap;let t=tr.getInstance();t.mode=this.routingMode,pr.removeLoop=this.removeLoop,ce.pcbConfig.rotateWhole=this.rotatingObject?"single":"whole",this.trackFollow!=null&&(ce.pcbConfig.trackFollow=this.trackFollow?"moveKeep":"moveDisconnect"),t.type=t.getRoutingTypeByStr(this.routingCorner),ce.pcbConfig.layerPhyPerferenceConfig=this.preferenceConfig,ce.pcbConfig.unusedPadRange=this.unusedPadRange,ce.pcbConfig.realTimeUpdateUnusedLayers=this.realTimeUpdateUnusedLayers;let e=al.getInstance();e.setPushVia(this.pushVia),e.setPathOptimization4BePushed(this.pathOptimization4BePushed),e.setCurrentPathOptimization(this.currentPathOptimization),e.setRemoveLoop(this.removeCircuitsContainingVias,"Remove Circuits Containing Vias"),e.setRemoveLoop(this.removeAntenna,"Remove Antenna"),x.getInstance().isPreview||(we.widthFollowRule=ce.pcbConfig.startTrackWidth=="rule",we.sizeFollowRule=ce.pcbConfig.startViaSize=="rule",we.prevTrackWidth=this.lastTrackWidth,we.removeLoop=this.removeLoop,e.setTrackMinCorner(this.stretchTrackMinCorner))}else return null}loadUnusedPadRange(t){ce.pcbConfig.unusedPadRange!==t&&(ce.pcbConfig.unusedPadRange=t)}loadLayerPhyPerferenceConfig(t){ce.pcbConfig.layerPhyPerferenceConfig!==t&&(ce.pcbConfig.layerPhyPerferenceConfig=t)}loadRealTimeUpdateUnusedLayers(t){ce.pcbConfig.realTimeUpdateUnusedLayers!=t&&(ce.pcbConfig.realTimeUpdateUnusedLayers=t)}load(){this.resultNeedToBeCached&&(this.loadLayerPhyPerferenceConfig(this.preferenceConfig),this.loadUnusedPadRange(this.unusedPadRange),this.loadRealTimeUpdateUnusedLayers(this.realTimeUpdateUnusedLayers))}};var El=class{constructor(t,e=!0,r=!0){this.type=t,this._visible=e,this._pick=r}get visible(){return this._visible}set visible(t){t!=null&&(this._visible=t)}get pick(){return this._pick}set pick(t){t!=null&&(this._pick=t)}};var m6=class m6 extends wi{static getInstance(){return m6.manager==null&&(m6.manager=new m6),m6.manager}constructor(){super(),this.addModel(new El(0,!0)),this.addModel(new El(1,!0)),this.addModel(new El(2,!0)),this.addModel(new El(3,!0)),this.addModel(new El(4,!0)),this.addModel(new El(5,!0)),this.addModel(new El(6,!0)),this.addModel(new El(7,!0,!1)),this.addModel(new El(8,!0,!1)),this.addModel(new El(9,!0)),this.addModel(new El(10,!0)),this.addModel(new El(12,!0,!1)),this.addModel(new El(13,!0)),this.addModel(new El(15,!0)),this.addModel(new El(14,!0)),this.addModel(new El(16,!0)),this.addModel(new El(17,!0)),this.addModel(new El(18,!0)),this.addModel(new El(19,!0)),this.addModel(new El(20,!0)),this.addModel(new El(21,!0)),this.addModel(new El(23,!0)),this.addModel(new El(24,!0)),this.addModel(new El(26,!0)),this.addModel(new El(27,!0)),this.addModel(new El(28,!0)),this.addModel(new El(29,!0)),this.addModel(new El(30,!0)),this.addModel(new El(31,!0)),this.addModel(new El(32,!0)),this.addModel(new El(33,!0)),this.addModel(new El(34,!0,!0)),this.addModel(new El(35,!0,!1)),this.addModel(new El(36,!0)),this.addModel(new El(37,!0)),this.addModel(new El(38,!0))}addModel(t){this.map.set(t.type,t)}add(t,e=!0,r=!0){let i=new El(t,e,r);return this.map.set(t,i),i}};m6.manager=null;var Ui=m6;var $ie=class extends $l{get hashkey(){return this.type}feed(t){let{primitiveName:e,display:r,pick:i}=t;this.type=e,this.display=r,this.pick=i}check(){return!!this.type}finish(){switch(this.type){case"ALL":Ui.getInstance().getItem(0).pick=this.pick;break;case"COMPONENT":Ui.getInstance().getItem(1).pick=this.pick,Ui.getInstance().getItem(1).visible=this.display;break;case"PROPERTY":Ui.getInstance().getItem(2).pick=this.pick,Ui.getInstance().getItem(2).visible=this.display;break;case"COMPONENTSILK":Ui.getInstance().getItem(3).visible=this.display;break;case"TRACK":Ui.getInstance().getItem(4).pick=this.pick,Ui.getInstance().getItem(4).visible=this.display;break;case"TESTPOINT":Ui.getInstance().getItem(5).pick=this.pick,Ui.getInstance().getItem(5).visible=this.display;break;case"FPC_STIFFENER":Ui.getInstance().getItem(20).pick=this.pick,Ui.getInstance().getItem(20).visible=this.display;break;case"PAD":Ui.getInstance().getItem(6).pick=this.pick,Ui.getInstance().getItem(6).visible=this.display;break;case"VIA":Ui.getInstance().getItem(9).pick=this.pick,Ui.getInstance().getItem(9).visible=this.display;break;case"SUTUREHOLE":Ui.getInstance().getItem(10).pick=this.pick,Ui.getInstance().getItem(10).visible=this.display;break;case"TEARDROP":Ui.getInstance().getItem(34).pick=this.pick,Ui.getInstance().getItem(34).visible=this.display;break;case"TEXT":Ui.getInstance().getItem(13).pick=this.pick,Ui.getInstance().getItem(13).visible=this.display;break;case"IMAGE":Ui.getInstance().getItem(15).pick=this.pick,Ui.getInstance().getItem(15).visible=this.display;break;case"PICTURE":Ui.getInstance().getItem(14).pick=this.pick,Ui.getInstance().getItem(14).visible=this.display;break;case"DIMENSION":Ui.getInstance().getItem(16).pick=this.pick,Ui.getInstance().getItem(16).visible=this.display;break;case"BOARDOUTLINE":Ui.getInstance().getItem(17).pick=this.pick,Ui.getInstance().getItem(17).visible=this.display;break;case"SLOTREGION":Ui.getInstance().getItem(18).pick=this.pick,Ui.getInstance().getItem(18).visible=this.display;break;case"FILLREGIEN":Ui.getInstance().getItem(19).pick=this.pick,Ui.getInstance().getItem(19).visible=this.display;break;case"COPPEROUTLINE":Ui.getInstance().getItem(21).pick=this.pick,Ui.getInstance().getItem(21).visible=this.display;break;case"PROHIBITEDREGION":Ui.getInstance().getItem(23).pick=this.pick,Ui.getInstance().getItem(23).visible=this.display;break;case"CONSTRAINT":Ui.getInstance().getItem(24).pick=this.pick,Ui.getInstance().getItem(24).visible=this.display;break;case"LINE":Ui.getInstance().getItem(26).pick=this.pick,Ui.getInstance().getItem(26).visible=this.display;break;case"PADSPAIR":x.getInstance().doctype===3&&(Ui.getInstance().getItem(7).pick=this.pick);break;case"NETWORK":x.getInstance().doctype===3&&(Ui.getInstance().getItem(8).pick=this.pick);break;case"GROUP":x.getInstance().doctype===3&&(Ui.getInstance().getItem(12).pick=this.pick);break;case"COPPERFILLED":x.getInstance().doctype===3&&(Ui.getInstance().getItem(21).visible=this.display);break;case"SHELL":x.getInstance().doctype===3&&(Ui.getInstance().getItem(27).pick=this.pick,Ui.getInstance().getItem(27).visible=this.display);break;case"SIDESHELLCUT":x.getInstance().doctype===3&&(Ui.getInstance().getItem(31).pick=this.pick,Ui.getInstance().getItem(31).visible=this.display);break;case"TOPSHELLCUT":x.getInstance().doctype===3&&(Ui.getInstance().getItem(30).pick=this.pick,Ui.getInstance().getItem(30).visible=this.display);break;case"SIDEENTITY":x.getInstance().doctype===3&&(Ui.getInstance().getItem(33).pick=this.pick,Ui.getInstance().getItem(33).visible=this.display);break;case"TOPBOTTOMENTITY":x.getInstance().doctype===3&&(Ui.getInstance().getItem(32).pick=this.pick,Ui.getInstance().getItem(32).visible=this.display);break;case"CREASE":x.getInstance().doctype===3&&(Ui.getInstance().getItem(29).pick=this.pick,Ui.getInstance().getItem(29).visible=this.display);break;case"BOSS":x.getInstance().doctype===3&&(Ui.getInstance().getItem(28).pick=this.pick,Ui.getInstance().getItem(28).visible=this.display);break;case"LOCKED":Ui.getInstance().getItem(36).pick=this.pick;break;case"UNLOCKED":Ui.getInstance().getItem(37).pick=this.pick;break}}};var Kie=class extends $l{get hashkey(){return this.layerId}feed(t){let{layerId:e,defaultColor:r,baseColor:i}=t;this.layerId=e,this.defaultColor=r,this.baseColor=i}check(){return!(this.layerId!=4&&this.layerId!=3||!this.checkColor(this.defaultColor)||!this.checkColor(this.baseColor))}checkColor(t){return/^#[a-fA-F0-9]{6}$/.test(t)}finish(){if(this.check())this.layerId==3?(we.topSilkscreenColor=this.defaultColor,we.topBoardColor=this.baseColor):(we.bottomSilkscreenColor=this.defaultColor,we.bottomBoardColor=this.baseColor);else return null}loadTopSilkscreenColor(t){we.topSilkscreenColor!==t&&(we.topSilkscreenColor=t)}loadTopBoardColor(t){we.topBoardColor!==t&&(we.topBoardColor=t)}loadBottomSilkscreenColor(t){we.bottomSilkscreenColor!==t&&(we.bottomSilkscreenColor=t)}loadBottomBoardColor(t){we.bottomBoardColor!==t&&(we.bottomBoardColor=t)}load(){this.resultNeedToBeCached&&(this.layerId==3?(this.loadTopSilkscreenColor(this.defaultColor),this.loadTopBoardColor(this.baseColor)):(this.loadBottomSilkscreenColor(this.defaultColor),this.loadBottomBoardColor(this.baseColor)))}};var $R=class extends $l{getModelData(){this.modelData=this.model.getDefaultPanelize()}};var g6=class extends $R{get hashkey(){return this.index}feed(t){let{direction:e,on:r,stampHoleGroupQuantity:i,stampHoleDiameter:n,stampHoleQuantityPerGroup:s,stampHoleSpacing:a}=t;this.vertical=Xb(e),this.index=e.toString(),this.vertical?this.stampColumn=r:this.stampRow=r,this.vertical?this.stampPerColumn=i:this.stampPerRow=i,this.isNumber(n)&&(this.stampHoleDiameter=n/10),this.stampHolePerGroup=s,this.isNumber(a)&&(this.stampHoleSpacing=a/10)}check(){if(this.vertical==null||!this.isNumber(this.stampHolePerGroup)||this.stampHolePerGroup<1||isNaN(this.stampHoleDiameter)||this.stampHoleDiameter<0||isNaN(this.stampHoleSpacing)||this.stampHoleSpacing<0)return!1;if(this.vertical){if(!this.isNumber(this.stampPerColumn)||this.stampPerColumn<1||this.vertical&&this.stampColumn==null)return!1}else if(!this.isNumber(this.stampPerRow)||this.stampPerRow<1||this.stampRow==null)return!1;return!0}finish(){if(this.check()){let t={stampHolePerGroup:this.stampHolePerGroup,stampHoleDiameter:this.stampHoleDiameter,stampHoleSpacing:this.stampHoleSpacing};this.vertical?(t.stampPerColumn=this.stampPerColumn,t.stampColumn=this.stampColumn):(t.stampPerRow=this.stampPerRow,t.stampRow=this.stampRow),ai.getInstance().setDefaultPanelize(t)}else return null}loadStampRow(t){this.modelData.stampRow!==t&&this.model.setDefaultPanelize({stampRow:t})}loadStampPerRow(t){this.modelData.stampPerRow!==t&&this.model.setDefaultPanelize({stampPerRow:t})}loadStampColumn(t){this.modelData.stampColumn!==t&&this.model.setDefaultPanelize({stampColumn:t})}loadStampPerColumn(t){this.modelData.stampPerColumn!==t&&this.model.setDefaultPanelize({stampPerColumn:t})}loadStampHoleDiameter(t){this.modelData.stampHoleDiameter!==t&&this.model.setDefaultPanelize({stampHoleDiameter:t})}loadStampHolePerGroup(t){this.modelData.stampHolePerGroup!==t&&this.model.setDefaultPanelize({stampHolePerGroup:t})}loadStampHoleSpacing(t){this.modelData.stampHoleSpacing!==t&&this.model.setDefaultPanelize({stampHoleSpacing:t})}load(){this.getModelData(),this.loadStampRow(this.stampRow),this.loadStampPerRow(this.stampPerRow),this.loadStampColumn(this.stampColumn),this.loadStampPerColumn(this.stampPerColumn),this.loadStampHoleDiameter(this.stampHoleDiameter),this.loadStampHolePerGroup(this.stampHolePerGroup),this.loadStampHoleSpacing(this.stampHoleSpacing)}};var y6=class extends $R{get hashkey(){return this.index}feed(t){let e=ai.getInstance().getDefaultPanelize(),{direction:r,on:i,sideHeight:n,positionHoleDiameter:s,markDiameter:a,markExpansion:l}=t;this.index=r.toString(),this.vertical=Xb(r),this.vertical?this.borderAtTopBottom=i:this.borderAtLeftRight=i,this.isNumber(n)&&(this.borderHeight=n/10),this.createPositionHole=s!=0,this.isNumber(s)&&(this.positionHoleDiameter=s>0?s/10:e.defaultPositionHoleDiameter),this.createMark=a!=0,this.isNumber(a)&&(this.markDiameter=a>0?a/10:e.markDiameter),this.isNumber(l)&&(this.markExpansion=l/10)}check(){if(this.vertical){if(this.borderAtTopBottom==null)return!1}else if(this.borderAtLeftRight==null)return!1;return!(isNaN(this.borderHeight)||this.borderHeight<=0||this.createPositionHole==null||isNaN(this.positionHoleDiameter)||this.positionHoleDiameter<0||this.createMark==null||isNaN(this.markDiameter)||this.markDiameter<0||isNaN(this.markExpansion)||this.markExpansion<0)}finish(){if(this.check()){let t={borderAtTopBottom:this.borderAtTopBottom,borderAtLeftRight:this.borderAtLeftRight,borderHeight:this.borderHeight,createPositionHole:this.createPositionHole,createMark:this.createMark,markExpansion:this.markExpansion};this.positionHoleDiameter&&(t.positionHoleDiameter=this.positionHoleDiameter),this.markDiameter&&(t.markDiameter=this.markDiameter),ai.getInstance().setDefaultPanelize(t)}else return null}loadBorderAtTopBottom(t){this.modelData.borderAtTopBottom!==t&&this.model.setDefaultPanelize({borderAtTopBottom:t})}loadBorderAtLeftRight(t){this.modelData.borderAtLeftRight!==t&&this.model.setDefaultPanelize({borderAtLeftRight:t})}loadBorderHeight(t){this.modelData.borderHeight!==t&&this.model.setDefaultPanelize({borderHeight:t})}loadPositionHoleDiameter(t){this.modelData.positionHoleDiameter!==t&&this.model.setDefaultPanelize({positionHoleDiameter:t})}loadCreatePositionHole(t){this.modelData.createPositionHole!==t&&this.model.setDefaultPanelize({createPositionHole:t})}loadCreateMark(t){this.modelData.createMark!==t&&this.model.setDefaultPanelize({createMark:t})}loadMarkDiameter(t){this.modelData.markDiameter!==t&&this.model.setDefaultPanelize({markDiameter:t})}loadMarkExpansion(t){this.modelData.markExpansion!==t&&this.model.setDefaultPanelize({markExpansion:t})}load(){this.getModelData(),this.loadBorderAtTopBottom(this.borderAtTopBottom),this.loadBorderAtLeftRight(this.borderAtLeftRight),this.loadBorderHeight(this.borderHeight),this.loadPositionHoleDiameter(this.positionHoleDiameter),this.loadCreatePositionHole(this.createPositionHole),this.loadCreateMark(this.createMark),this.loadMarkDiameter(this.markDiameter),this.loadMarkExpansion(this.markExpansion)}};var Zie=class extends $R{get hashkey(){return null}feed(t){let{on:e,row:r,column:i,rowSpacing:n,columnSpacing:s,onlyOutline:a,horizontalStamp:l,verticalStamp:c,horizontalSize:h,verticalSize:u}=t;this.on=e,this.row=r,this.column=i,this.isNumber(n)&&(this.rowSpacing=n/10),this.isNumber(s)&&(this.columnSpacing=s/10),this.onlyOutline=a,this.horizontalStamp=new g6,this.horizontalStamp.feed(Object.assign({direction:0},l)),this.verticalStamp=new g6,this.verticalStamp.feed(Object.assign({direction:1},c)),this.horizontalSize=new y6,this.horizontalSize.feed(Object.assign({direction:0},h)),this.verticalSize=new y6,this.verticalSize.feed(Object.assign({direction:1},u))}check(){return!(this.on==null||!this.isNumber(this.row)||this.row<1||!this.isNumber(this.column)||this.column<1||isNaN(this.rowSpacing)||this.rowSpacing<0||isNaN(this.columnSpacing)||this.columnSpacing<0||this.onlyOutline==null)}finish(){if(this.check())this.horizontalStamp.finish(),this.verticalStamp.finish(),this.horizontalSize.finish(),this.verticalSize.finish(),ai.getInstance().setDefaultPanelize({on:this.on,row:this.row,column:this.column,rowSpacing:this.rowSpacing,columnSpacing:this.columnSpacing,onlyOutline:this.onlyOutline});else return null}loadOn(t){this.modelData.on!==t&&this.model.setDefaultPanelize({on:t})}loadRow(t){this.modelData.row!==t&&this.model.setDefaultPanelize({row:t})}loadColumn(t){this.modelData.column!==t&&this.model.setDefaultPanelize({column:t})}loadRowSpacing(t){this.modelData.rowSpacing!==t&&this.model.setDefaultPanelize({rowSpacing:t})}loadColumnSpacing(t){this.modelData.columnSpacing!==t&&this.model.setDefaultPanelize({columnSpacing:t})}loadOnlyOutline(t){this.modelData.onlyOutline!==t&&this.model.setDefaultPanelize({onlyOutline:t})}load(){this.getModelData(),this.loadOn(this.on),this.loadRow(this.row),this.loadColumn(this.column),this.loadRowSpacing(this.rowSpacing),this.loadColumnSpacing(this.columnSpacing),this.loadOnlyOutline(this.onlyOutline),this.horizontalStamp.model=this.model,this.horizontalStamp.load(),this.verticalStamp.model=this.model,this.verticalStamp.load(),this.horizontalSize.model=this.model,this.horizontalSize.load(),this.verticalSize.model=this.model,this.verticalSize.load()}};var Jie=class extends md{finish(){return this.check()&&Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]),this.resultNeedToBeCached=!1,Cs.getInstance().addBoard(this.parseShapeModel(Cs.id,"Board",1006,null,!1,this.width||Cs.width,this.path))}check(){return this.path!=null}feed(t){let{path:e}=t;this.path=e}load(){this.resultNeedToBeCached=!1;let t=Cs.getInstance().board;t&&(t.remove(),Cs.getInstance().board=null),this.finish()}};var ob=class extends ng{constructor(){super(...arguments);this.primitive=new Array;this.panelize=new Array;this.panelizeStamp=new Array;this.panelizeSide=new Array;this.silkOpts=new Array;this.preference=new Array}getDecode(e){let r=super.getDecode(e);if(r==null)switch(e){case"PRIMITIVE":{let i=new $ie;return this.primitive.push(i),i}case"PANELIZE":{let i=new Zie;return this.panelize.push(i),i}case"PANELIZE_STAMP":{let i=new g6;return this.panelizeStamp.push(i),i}case"PANELIZE_SIDE":{let i=new y6;return this.panelizeSide.push(i),i}case"SILK_OPTS":{let i=new Kie;return this.silkOpts.push(i),i}case"PREFERENCE":{let i=new Xie;return this.preference.push(i),i}case"BOARD":return this.board=new Jie,this.board;default:return null}else return r}};var Qie=class{constructor(t){this.items=new Array;this.file=t,this.decode=new ng}parse(){for(let t of this.file)this.decode.parse(t.type,t.data,0,t.id,t.number)}async parseFootAndDevice(){let t=new Set,e=new Set,r=x.getInstance().compilerChannel;for(let n of this.decode.attr){let s=n.key,a=n.value;if(s=="Device"){if(e.has(a))continue;e.add(a);let l=await gh.getInstance().add(a,r);if(l){let c=l.footprintUUID;c!=null&&c!=""&&t.add(c)}}else s=="Footprint"&&t.add(a)}for(let n of t)n.indexOf("_")>-1?await Wi.getInstance().addCustomFootprint(n,r):await Wi.getInstance().add(n,r);let i=new Map;for(let n of this.decode.attr){let s=i.get(n.parentIndex);s||(i.set(n.parentIndex,[]),s=i.get(n.parentIndex)),s.push(n)}}build(){this.parse(),this.decode.preAdjust(),this.buildItems(this.decode.component)}async replaceDecode(t){this.parse();let e=new Array;for(let r=0;r<this.decode.attr.length;r++)this.decode.attr[r].key==t.key&&e.push(r);e.reverse();for(let r of e)this.decode.attr.splice(r,1);this.decode.attr.push(t),await this.parseFootAndDevice(),this.decode.preAdjust(),this.buildItems(this.decode.component)}async replaceFootprint(t){this.parse();for(let e=0;e<this.decode.attr.length;e++){let r=this.decode.attr[e];r.key=="Footprint"&&(r.value=t)}await this.parseFootAndDevice(),this.decode.preAdjust(),this.buildItems(this.decode.component)}buildItems(t){try{t.forEach(e=>{let r=e.finish();r!=null&&r instanceof vi&&this.items.push(r)})}catch(e){console.log(e)}}};var Y1=class extends Qie{constructor(e){super(e);this.items=new Array;this.file=e,this.decode=new ob}buildItems(e){try{e.forEach(r=>{let i=r.finish();if(i!=null&&i instanceof vi){let n=$c(i);this.items.push(n)}})}catch(r){console.log(r)}}};var oP=class extends so{constructor(t,e){if(super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),e=="modify"){this.saved=new Set;let r=t.attributes;for(let i of r)Cp(i.model,t.model)&&this.saved.add(i.globalIndex)}this.preData=e=="delete"?or.getInstance().encodeComponent("COMPONENT",t.model):null,this.action=e,this.deleteGroupID(t),t.getPads().forEach(r=>{A.publish("cheakTearDrop",new Em(e,r.toJSON(),r))}),t.getVias().forEach(r=>{A.publish("cheakTearDrop",new Em(e,r.toJSON(),r))}),ce.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",t.getPads().map(r=>({id:r.globalIndex,net:r.net,bbox:r.buildBBox()})))}rebuild(){let{footprint:t,device:e,globalIndex:r,partition:i,layerId:n,position:s,rotation:a,textOffset:l,locked:c,attrsMap:h,ATTR:u,pads:d,silkColor:p,custom:m,childPartition:g}=this.data,y=new Array,b=p?ee.of3(p):null;new Promise(async()=>{let _=Ji.getItem(t);m!=null&&(_=await Ji.addCustomFootprint(m,x.getInstance().compilerChannel)),_.modifyName("",h.Designator)});let P;e!=null&&(P=ps.getItem(e));let T=Ji.getItem(t);if(m!=null){let _=m;T=Ji.getItem(_)}let I;e!=null?(P=ps.getItem(e),I=P.copy(T.uuid,r)):(I=new jE(T.uuid,"",r,T.getBBox()),I=T.generate(I)),I.attrsMap=h;let E=new e2().build(I,S.ORIGIN,!0);E.layerId=n,E.rotation=a,E.textOffset=l,E.locked=c,E.position=s,p&&(E.silkColor=p),u.forEach(_=>{let R=ti.copy(_,_.globalIndex);R.key=_.key,R.showKey=_.showKey,y.push(R)}),y.forEach(_=>{if(_.key=="Designator"){let R=h.Designator;h.Designator=R,_.value=R}else _.key=="Footprint"?(h.Footprint=T.footprintId,_.value=T.footprintId):_.key=="Device"&&P!=null&&(h.Device=P.name,_.value=P.name);E.addAttribute(_)});let O=Qp(_=>_.num,d);if(E.getPads().forEach(_=>{let R=O.get(_.num);if(R!=null)if(R.length==1)_.net=R[0].net,R[0].padLen!=null&&as.getInstance().setPadLen(E.globalIndex,_.globalIndex,R[0].padLen);else{let v=_.globalIndex.replace(E.globalIndex,"");for(let D of R)D.id==v&&(_.net=D.net,D.padLen!=null&&as.getInstance().setPadLen(E.globalIndex,_.globalIndex,D.padLen))}}),E.getVias().forEach(_=>{let R=_.getParent(),v;if(R!=null){let w=R.globalIndex,F=new RegExp(w);v=_.globalIndex.replace(F,"")}else v=_.globalIndex;let D=O.get(v);if(D!=null)if(D.length==1)_.net=D[0].net;else for(let w of D)w.id==v&&(_.net=w.net)}),P!=null)for(let _ of E.attributes){let R=P.getAttrData(E.model,_.model);P.addAttr(_.key,R)}if(E.partition=i,E.number=this.number,g!=null){for(let _ of E.getPads())_.partition=g[_.globalIndex]||"";for(let _ of E.getVias())_.partition=g[_.globalIndex]||""}if(A.publish("hasModifyPcbItem",E),P!=null)for(let _ of E.attributes){let R=P.getAttrData(E.model,_.model);P.addAttr(_.key,R)}return this.addGroupID(E),E.silkColor=b,this.updateFilterStatus(E),this.data=void 0,E}getItem(){return Cr.getItem(this.gId)}remove(){this.updateData();let t=Cr.getItem(this.gId);this.data=t.toJSON(),t.remove();let e=t.getItems();for(let r of e)r instanceof Le&&as.getInstance().deletePadLen(t.globalIndex,r.globalIndex);A.publish("delete",t),A.publish("hasModifyPcbItem",t)}modify(){let t=Cr.getItem(this.gId);this.saved||(this.saved=new Set),this.saved.clear();let e=t.attributes;for(let T of e)Cp(T.model,t.model)&&this.saved.add(T.globalIndex);let r=t.toJSON(),{footprint:i,layerId:n,position:s,rotation:a,textOffset:l,locked:c,attrsMap:h,custom:u,silkColor:d,ATTR:p}=this.data,m=u==null?i:u,g=d?ee.of3(d):null;s=new S(s.x,s.y),l=new S(l.x,l.y);let y=t.attributes;for(let T of y)t.removeAttribute(T);t.layerId!=n&&(t.layerId=n),t.textOffset.equals(l)||(t.textOffset=l);let b=!1;t.position.equals(s)||(t.position=s,b=!0),t.rotation!=a&&(t.rotation=a,b=!0),t.locked!=c&&(t.locked=c);for(let T of p){let I=OSe(T);t.addAttribute(I)}t.clearMap();for(let T in h)t.addATTRMap(T,h[T]);if(g||(t.silkColor=void 0),g&&t.silkColor!=g&&!t.silkColor.equals(g)&&(t.silkColor=g),t.footprintUUID!=m){let I=new z1("2.0").replace(t.model,"Footprint",m);t.remove(),A.publish("delete",t);let C=new Y1(I);C.build(),t=C.items[0]}t.visible();let P=t.getItems();for(let T of P)T instanceof Ye&&T.fill();this.data=r,this.modifyGroupID(t),A.publish("hasModifyPcbItem",t)}upload(t=!1){var l;let e=this.isDelete(t);this.preData==null&&this.updateData();let{componentData:r,attrData:i,padNetData:n}=this.preData,s=x.getInstance().compiler,a=s.consistencyManager.getMaxTicket();if(s.setTicket(++a),e?s.deleteComponent(this.gId):s.uploadComponent(this.gId,r),n.length)for(let c of n)s.setTicket(++a),e?s.deletePadNet(c.componentId,c.padNum,c.padId):s.uploadPadNet(c);if(i.size){let c=[];for(let[h,u]of i)c.push(h),s.setTicket(++a),e?s.deleteAttr(h):s.uploadAttr(h,u);if((l=this.data)!=null&&l.ATTR)for(let h of this.data.ATTR){let u=h.globalIndex;(!this.saved||this.saved.has(u))&&!c.includes(u)&&s.deleteAttr(u)}}this.preData=null}updateData(){if(this.preData==null){let t=Cr.getItem(this.gId);t!=null&&(this.preData=or.getInstance().encodeComponent("COMPONENT",t.model))}}};var Si=class extends Ue{constructor(t){super(t),jo("editor/shape/ArcTrack")}get arcType(){return this.model.arcType}set arcType(t){this.model.arcType=t}get angle(){return this.model.angle}set angle(t){this.model.angle=t,this.refreshRender()}get center(){return this.model.center}set center(t){this.model.center=t,this.refreshRender()}get radius(){return this.model.radius}set radius(t){this.model.radius=t,this.refreshRender()}get startAngle(){return this.model.startAngle}set startAngle(t){this.model.startAngle=t,this.refreshRender()}get endAngle(){return this.model.endAngle}set endAngle(t){this.model.endAngle=t,this.refreshRender()}get isCCW(){return this.model.isCCW}get sweep(){return this.model.sweep}set sweep(t){this.model.sweep=t,this.refreshRender()}get midPoint(){return this.model.midPoint}set midPoint(t){this.model.midPoint=t,this.refreshRender()}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,center:this.center,radius:this.radius,startAngle:this.startAngle,endAngle:this.endAngle,sweep:this.sweep,width:this.width,locked:this.locked,net:this.net,arcType:this.arcType}}getType(){return 0}};var b6=class extends so{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?or.getInstance().encode("ARC",t.model):null,this.action=e,this.deleteGroupID(t),A.publish("cheakTearDrop",new Em(e,t.toJSON(),t)),ce.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:t.globalIndex,net:t.net,bbox:t.buildBBox()}])}getItem(){return pr.getItem(this.gId)}rebuild(){var m;let{globalIndex:t,partition:e,layerId:r,center:i,radius:n,startAngle:s,endAngle:a,sweep:l,width:c,locked:h,net:u,arcType:d}=this.data;if(!((m=$e.getInstance().getLayer(r))!=null&&m.config))return null;i=new S(i.x,i.y);let p=pr.rebuildArcTrack(t,r,i,n,s,a,l,c,h,u,d);return p.partition=e,p.number=this.number,this.addGroupID(p),this.updateFilterStatus(p),A.publish("hasModifyPcbItem",p),this.data=void 0,p}remove(){let t=pr.getItem(this.gId);t!=null&&t instanceof Si&&(this.data=t.toJSON(),this.number=t.number,A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t))}modify(){let{globalIndex:t,layerId:e,center:r,radius:i,startAngle:n,endAngle:s,sweep:a,width:l,locked:c,net:h,arcType:u}=this.data;r=new S(r.x,r.y);let d=pr.getItem(this.gId),p=d.toJSON();d.layerId!=e&&(d.layerId=e),d.center.equals(r)||(d.center=r),d.radius!=i&&(d.radius=i),d.startAngle!=n&&(d.startAngle=n),d.endAngle!=s&&(d.endAngle=s),d.sweep!=a&&(d.sweep=a),d.width!=l&&(d.width=l),d.locked!=c&&(d.locked=c),d.arcType!=u&&(d.arcType=u),d.net!=h&&(A.publish("hasModifyPcbItem",d),d.net=h),this.data=p,this.modifyGroupID(d),A.publish("hasModifyPcbItem",d)}updateData(){if(this.source==null){let t=pr.getItem(this.gId);t!=null&&(this.source=or.getInstance().encode("ARC",t.model))}}upload(t){let e=this.isDelete(t),r=x.getInstance().compiler;r.setTicket(),e?r.deleteArc(this.gId):(this.source==null&&this.updateData(),this.source!=null&&r.uploadArc(this.gId,this.source)),this.source=void 0}};var P6=class extends so{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?or.getInstance().encode("PAD",t.model):null;let r=t.getParent();r&&(this.hasParent=!0,this.padNetSource=e=="delete"?or.getInstance().encode("PAD_NET",t.model):null,this.padLen=as.getInstance().getPadLen(r.globalIndex,this.gId)),this.action=e,A.publish("cheakTearDrop",new Em(e,t.toJSON(),t)),this.deleteGroupID(t),ce.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:t.globalIndex,net:t.net,bbox:t.buildBBox()}])}hasConnectChange(){return this.action==="delete"}getConnnectChangeCommand(){return new VR().getConnectCommands(this.gId)}rebuild(){var R;let{globalIndex:t,partition:e,layerId:r,num:i,center:n,rotation:s,shapes:a,net:l,locked:c,expansionType:h,pasteExpansion:u,topSolderExpansion:d,bottomSolderExpansion:p,unusedInnerLayers:m,plated:g,holeLength:y,holeRadius:b,holeShape:P,holeRotation:T,holeOffset:I,padRule:C}=this.data;n=new S(n.x,n.y),I=new S(I.x,I.y);let E=fe.build2(this.parseShape(a)),O=Kt.rebuildPolygonPad(t,r,i,n,s,E,l,c,h,u,d,p,m,g,y,b,P,T,I,_f.buildByJson(C)),_=(R=O.getParent())==null?void 0:R.globalIndex;return _&&this.padLen!=null&&as.getInstance().setPadLen(_,O.globalIndex,this.padLen),O.partition=e,O.number=this.number,A.publish("hasModifyPcbItem",O),this.addGroupID(O),this.updateFilterStatus(O),this.updateData(),this.data=void 0,O}getItem(){return Kt.getItem(this.gId)}remove(){let t=Kt.getItem(this.gId);this.data=t.toJSON(),this.number=t.number,t.remove(),A.publish("hasModifyPcbItem",t),A.publish("delete",t),this.updateData()}modify(){var D;let t=Kt.getItem(this.gId),e=t.toJSON();t.removeFill();let{globalIndex:r,layerId:i,num:n,center:s,rotation:a,shapes:l,net:c,locked:h,expansionType:u,pasteExpansion:d,topSolderExpansion:p,bottomSolderExpansion:m,unusedInnerLayers:g,plated:y,holeLength:b,holeRadius:P,holeShape:T,holeRotation:I,holeOffset:C,padRule:E,padLen:O}=this.data;s=new S(s.x,s.y),C=new S(C.x,C.y),t.layerId!=i&&(t.layerId=i),t.num!=n&&(t.num=n),t.padLen!=O&&(t.padLen=O);let _=(D=t.getParent())==null?void 0:D.globalIndex;if(_){let w=as.getInstance().getPadLen(_,t.globalIndex);this.padLen!=null&&as.getInstance().setPadLen(_,t.globalIndex,this.padLen),this.padLen=w}t.center.equals(s)||(t.center=s),t.rotation!=a&&(t.rotation=a),t.locked!=h&&(t.locked=h),t.net!=c&&(A.publish("hasModifyPcbItem",t),t.net=c),t.expansion=ju.getPadExpansion(u,d,p,m),t.unusedInnerLayers.toString()!=g.toString()&&(t.unusedInnerLayers=g),t.plated!=y&&(t.plated=y),t.hole&&(t.hole=vc.getHoleStyle(b,P,T,I,C)),t.padRule&&E&&(t.padRule=Su.getPadRule(E.connectMode,E.lineWidth,E.lineClearance,E.lineAngle));let v=this.parseShape(l);t.pl=fe.build2(v),t.fill(),this.data=e,this.modifyGroupID(t),A.publish("hasModifyPcbItem",t),this.updateData()}parseShape(t){let e=new Array;for(let r of t)for(let i in r){let n=r[i];if(i=="LINE"){let s=new S(n.start.x,n.start.y),a=new S(n.end.x,n.end.y),l=new M(s,a);e.push(l)}if(i=="ARC"){let s=new S(n.center.x,n.center.y),a=q.build2(s,n.startAngle,n.endAngle,n.rx,n.rx,n.sweep);e.push(a)}}return e}upload(t=!1){let e=x.getInstance().compiler,r=e.consistencyManager.getMaxTicket();this.isDelete(t)?(this.padNetSource&&(e.setTicket(++r),e.deletePadNet(this.padNetSource.componentId,this.padNetSource.padNum,this.padNetSource.padId)),this.hasParent||(e.setTicket(++r),e.deletePad(this.gId))):(this.source==null&&this.updateData(),this.padNetSource&&(e.setTicket(++r),e.uploadPadNet(this.padNetSource)),!this.hasParent&&this.source&&(e.setTicket(++r),e.uploadPad(this.gId,this.source))),this.padNetSource=void 0,this.source=void 0}updateData(){if(this.source==null||this.padNetSource==null){let t=Kt.getItem(this.gId);if(t!=null){let e=t.getParent();this.source=or.getInstance().encode("PAD",t.model),this.padNetSource=e&&or.getInstance().encode("PAD_NET",t.model)}}}};var Yn=class extends n0{constructor(t){super(),this.model=t,t.setModelWatcher(this);let e=new _e;t.template.forEach(i=>{e.ext1(i.bbox())});let r=e.build1();this.templateMatrix=Ae.translate(-r.UL().x,-r.UL().y,0),this.templateHeight=r.height(),this.templateWidth=r.width()}get template(){return this.model.template}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId!=t&&(this.model.layerId=t,this.refreshRender())}get silkColor(){return this.model.silkColor}set silkColor(t){this.model.silkColor=t}get lineColor(){return ee.BLACK}get viewMatrix(){let t=Ae.scale(this.width/this.templateWidth||1,this.height/this.templateHeight||1,1);return this.templateMatrix.multiply4(t).multiply4(this.model.matrix)}get matrix(){return this.viewMatrix}getRealPath(){let t=this.viewMatrix.toMatrix3();return this.template.map(e=>e.multiply3(t))}getPath(){let t=this.viewMatrix,e=this.getTemplatePath();return e.forEach(r=>{r.pl=r.pl.multiply3(t.toMatrix3())}),e}getPathByTemplatePath(t){let e=this.viewMatrix,r=t;return r=r.map(i=>i.clone()),r.forEach(i=>{i.pl=i.pl.multiply3(e.toMatrix3())}),r}getTemplatePath(){let t=this.template.map(i=>i.clone());return new pm("",0,t).pls}hasSameTemplateWith(t){let e=this.template,r=t.template;if(e.length!=r.length)return!1;for(let i=0;i<e.length;i++){let n=e[i],s=r[i];if(!n.equals(s))return!1}return!0}toJSON(){var e;return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,width:this.width,height:this.height,rotation:this.rotation,mirror:this.mirror,locked:this.locked,silkColor:((e=this.silkColor)==null?void 0:e.toString())||null,template:ef(this.template)}}getType(){return 7}get path(){return this.template}get leftLow(){return this.model.box.leftLow}get leftUp(){return this.model.box.leftUp}get rightUp(){return this.model.box.rightUp}get rightLow(){return this.model.box.rightLow}get templateModified(){return this.model.templateModified}getPolygonsPath(t){let e=new Array;return t.forEach(r=>{let i=F1(r);e.push(i)}),e}};var T6=class extends so{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?or.getInstance().encode("IMAGE",t.model):null,this.action=e,this.deleteGroupID(t)}rebuild(){let{globalIndex:t,partition:e,layerId:r,start:i,width:n,height:s,rotation:a,mirror:l,locked:c,template:h,silkColor:u}=this.data,d=u?ee.of3(u):null;i=new S(i.x,i.y),h=vu(h);let p=Ln.rebuild(t,r,i,n,s,a,l,c,h);return p.partition=e,p.number=this.number,A.publish("hasModifyPcbItem",p),this.addGroupID(p),p.silkColor=d,this.updateFilterStatus(p),this.updateData(),this.data=void 0,p}getItem(){return Ln.getItem(this.gId)}remove(){let t=Ln.getItem(this.gId);A.publish("hasModifyPcbItem",t),this.data=t.toJSON(),this.number=t.number,t.remove(),A.publish("delete",t),this.updateData()}modify(){let{layerId:t,start:e,width:r,height:i,rotation:n,mirror:s,locked:a,template:l,silkColor:c}=this.data,h=c?ee.of3(c):null,u=Ln.getItem(this.gId),d=u.toJSON();e=new S(e.x,e.y),u.layerId!=t&&(u.layerId=t),u.width!=r&&(u.width=r),u.height!=i&&(u.height=i),u.start.equals(e)||(u.start=e),u.mirror!=s&&(u.mirror=s),u.rotation!=n&&(u.rotation=n),u.locked!=a&&(u.locked=a),h||(u.silkColor=void 0),h&&u.silkColor!=h&&!u.silkColor.equals(h)&&(u.silkColor=h),this.data=d,this.modifyGroupID(u),A.publish("hasModifyPcbItem",u),this.updateData()}upload(t=!1){let e=this.isDelete(t),r=x.getInstance().compiler;r.setTicket(),e?r.deleteImage(this.gId):(this.source==null&&this.updateData(),this.source!=null&&r.uploadImage(this.gId,this.source)),this.source=null}updateData(){if(this.source==null){let t=Ln.getItem(this.gId);t!=null&&(this.source=or.getInstance().encode("IMAGE",t.model))}}};var I6=class extends so{constructor(t,e){super(),this.gId=t.globalIndex,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?or.getInstance().encode("OBJ",t.model):null,this.action=e,this.deleteGroupID(t)}rebuild(){let{globalIndex:t,partition:e,layerId:r,start:i,width:n,height:s,rotation:a,mirror:l,locked:c,hashId:h}=this.data,u=new S(i.x,i.y),d=_o.rebuild(t,r,u,n,s,a,l,c,h);return d.partition=e,A.publish("hasModifyPcbItem",d),this.addGroupID(d),this.updateFilterStatus(d),this.updateData(),this.data=void 0,d}getItem(){return _o.getItem(this.gId)}remove(){let t=_o.getItem(this.gId);this.data=t.toJSON(),A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t),this.updateData()}modify(){let{globalIndex:t,layerId:e,start:r,width:i,height:n,rotation:s,mirror:a,locked:l,hashId:c}=this.data,h=_o.getItem(this.gId),u=h.toJSON();r=new S(r.x,r.y),h.layerId!=e&&(h.layerId=e),h.width!=i&&(h.width=i),h.height!=n&&(h.height=n),h.start.equals(r)||(h.start=r),h.mirror!=a&&(h.mirror=a),h.rotation!=s&&(h.rotation=s),h.locked!=l&&(h.locked=l),this.data=u,this.modifyGroupID(h),A.publish("hasModifyPcbItem",h),this.updateData()}upload(t=!1){let e=this.isDelete(t),r=x.getInstance().compiler;r.setTicket(),e?r.deleteObj(this.gId):(this.source==null&&this.updateData(),this.source!=null&&r.uploadObj(this.gId,this.source)),this.source=void 0}updateData(){if(this.source==null){let t=_o.getItem(this.gId);t!=null&&(this.source=or.getInstance().encode("OBJ",t.model))}}};var C6=class o{constructor(){this.data=new Set}static getInstance(){return o.proxy||(o.proxy=new o),o.proxy}addData(t){this.data.add(t)}upload(){let t=x.getInstance().compiler;this.data.forEach(e=>{t.setTicket();let r=$e.getInstance().getLayer(e);if(r!=null&&r.type=="PLANE"){let i=or.getInstance().encode("INNER",Array.from(Ho.getInstance().layerMapSet[e]));t.uploadLayerFill(e,i)}else t.deleteLayerFill(e)}),this.data.clear()}};var pF=class extends so{constructor(e,r){super();this.hasCommand=!0;if(this.layerId=e.layerId,ce.pcbConfig.isRebuildCopperAuto){this.hasCommand=!1;return}this.gId=e.globalIndex,this.data=r=="add"?void 0:e.toJSON(),this.action=r,this.deleteGroupID(e),ce.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:e.globalIndex,net:e.net,bbox:e.buildBBox()}])}rebuild(){if(!this.hasCommand)return;let{globalIndex:e,partition:r,layerId:i,net:n,style:s,copperPath:a}=this.data,l=Qn.rebuild(e,i,n,s,a);return l.partition=r,A.publish("hasModifyPcbItem",l),this.addGroupID(l),this.updateData(),this.data=void 0,l}getItem(){return Qn.getItem(this.gId)}remove(){if(!this.hasCommand)return;let e=Qn.getItem(this.gId);e&&(A.publish("hasModifyPcbItem",e),this.data=e.toJSON(),e.remove(),A.publish("delete",e),this.updateData())}modify(){if(!this.hasCommand)return;let{globalIndex:e,layerId:r,net:i,style:n,copperPath:s}=this.data,a=Qn.getItem(this.gId);if(!a)return;let l=a.toJSON();a.net!=i&&(A.publish("hasModifyPcbItem",a),a.net=i),a.style!=n&&(a.style=n),this.data=l,this.modifyGroupID(a),A.publish("hasModifyPcbItem",a),this.updateData()}upload(e=!1){C6.getInstance().addData(this.layerId)}updateData(){}};var Nh=class extends va{constructor(e,r,i,n,s,a,l,c,h,u,d){super();this.restriction=null;this.type="Smart Dimension";this.leftRadius=u,this.rightRadius=d,this.model=new HA(e,"Smart Dimension",r,i,n,s,a,x.getInstance().unit=="mil"?1:3,l,c,x.getInstance().unit,h),this.refreshRender()}get box(){return this.model.text.box}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=e,this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get textPosition(){return this.model.textPosition}get strokeWidth(){return this.model.strokeWidth}get width(){return this.model.strokeWidth}set width(e){this.model.strokeWidth=e,this.refreshRender()}get unit(){return this.model.unit}set unit(e){this.model.unit=e,this.precision=e=="mil"?1:3,this.refreshRender()}get precision(){return this.model.precision}set precision(e){this.model.precision=e,this.refreshRender()}get start(){return this.model.start}set start(e){this.model.calibrateLine([this.start,this.left,this.start,e],!0,!1,0),this.model.start=e,this.refreshRender()}get end(){return this.model.end}set end(e){this.model.calibrateLine([this.end,this.right,this.end,e],!0,!0,1),this.model.end=e,this.refreshRender()}modifyEnd(e){this.model.end=e,this.model.right=e,this.refreshRender()}modifyDimension(e,r){this.model.start=e,this.model.end=r,this.refreshRender()}get length(){let e=this.model.length*10;this.unit!="mil"&&(e=new ft().conversion1("mil",this.unit,e));let r=Math.pow(10,this.precision);return e=Math.round(e*r)/r,e}set length(e){this.model.length=e,this.refreshRender()}set height(e){this.model.fontSize=e,this.refreshRender()}get height(){return this.model.fontSize}set left(e){this.model.calibrateLine([this.right,this.end,this.left,e],!1,!1,2),this.model.left=e,this.refreshRender()}get left(){return this.model.left}set right(e){this.model.calibrateLine([this.left,this.start,this.right,e],!1,!0,3),this.model.right=e,this.refreshRender()}get right(){return this.model.right}setLeftSpotSize(e){this.leftRadius=e,this.refreshRender()}setRightSpotSize(e){this.rightRadius=e,this.refreshRender()}rotateFor(e,r){}transform(e){this.model.transform(e),this.refreshRender()}isSelect(e,r){return this.getParent()!=null?!1:this.model.inShape(e,r)}buildBBox(){return this.model.buildBBox()}getLineBBox(){return wB(this.start,this.end,this.left,this.right,this.strokeWidth,this.lineLen,this.arrLineLen)}updateText(){this.model.updateText()}toJSON(){var r;return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,end:this.end,precision:this.precision,height:this.height,width:this.width,unit:this.unit,locked:this.locked,leftPoint:this.left,rightPoint:this.right,leftSpotSize:this.leftRadius,rightSpotSize:this.rightRadius,silkColor:((r=this.silkColor)==null?void 0:r.toString())||null}}getType(){return 5}get textPath(){return this.model.text.outline}get textMatrix(){return this.model.text.matrix}get viewWidth(){return this.model.text.width}get viewHeight(){return this.model.text.height}get lineLen(){return 1.2}get arrLineLen(){return .8}get highlightColor(){return ee.BLACK}set highlightColor(e){}get Type(){return"smartDimension"}get leftCenter(){return this.left}get rightCenter(){return this.right}get outlineModified(){return this.model.text.outlineModified}refreshRender(){Do.attach(this,this.getType())}flip(e){}};var Rs=class extends n0{constructor(t){super(),this.model=t,t.setModelWatcher(this)}needMirror(){return xc(this.layerId,this.mirror)}get hashId(){return this.model.hashId}set hashId(t){Yd.getItem(t)!=null&&(this.model.hashId=t,this.refreshRender())}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId!=t&&(this.model.layerId=t,this.refreshRender())}get source(){return Yd.getItem(this.hashId).source}get leftDown(){return this.model.box.leftLow}get leftUp(){return this.model.box.leftUp}get rightDown(){return this.model.box.rightLow}get rightUp(){return this.model.box.rightUp}get alpha(){var r,i;let t=.5,e=(i=(r=ce)==null?void 0:r.themeConfig)==null?void 0:i.canvasTheme;return e&&(t=1-e.colorfulImageTransparency),t=Bt.getTransparencyByPcbType(this,void 0,t),t}get hashIdModified(){return this.model.hashIdModified}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,width:this.width,height:this.height,rotation:this.rotation,mirror:this.mirror,locked:this.locked,hashId:this.hashId}}getType(){return 11}};var ene=class extends so{constructor(e,r){super();this.dataMap=new Map;this.hasCommand=!0;if(this.parentGId=e[0].layerId,ce.pcbConfig.isRebuildCopperAuto){this.hasCommand=!1;return}this.action=r,r=="add"||e.forEach(i=>{this.dataMap.set(i.globalIndex,i.toJSON())})}rebuild(){this.hasCommand&&this.do()}do(){let e=Array.from(Qn.layerMapSet[this.parentGId]||[]),r=new Map;e.forEach(i=>{r.set(i.globalIndex,i.toJSON()),A.publish("hasModifyPcbItem",i),i.remove(),A.publish("delete",i),this.updateData()});for(let[,i]of this.dataMap){let{globalIndex:n,partition:s,layerId:a,net:l,style:c,copperPath:h}=i,u=Qn.rebuild(n,a,l,c,h);u.partition=s,this.modifyGroupID(u),A.publish("hasModifyPcbItem",u),this.updateData()}this.dataMap=r}remove(){this.hasCommand&&this.do()}modify(){this.hasCommand&&this.do()}getItem(){return"ignore"}upload(e){let r=x.getInstance().compiler,i=Qn.layerMapSet[this.parentGId];if(r.setTicket(),i){let n=or.getInstance().encode("INNER",Array.from(i));r.uploadLayerFill(this.parentGId,n)}else r.deleteLayerFill(this.parentGId)}updateData(){}};var af="default",tne=class extends so{constructor(t,e){super(),this.netName=t.name,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?or.getInstance().encode("RULE_SELECTOR",t):null,this.action=e}rebuild(){let{name:t,safeSpacing:e,trackPhysics:r,differentialPhysics:i,netLengthPhysics:n,netLengthTolerancePhysics:s,blindViaPhysics:a,radiusPhysics:l,innerPlane:c,copperPlane:h,solderExpansion:u,pasteExpansion:d,netClassName:p,equalLengthGroupName:m,netDifferentialName:g,targetNet:y}=this.data;this.preCheck();let b=te.getInstance().rebuild(this.data);y&&(b.targetNet=y),p&&te.getInstance().getNetClass(p).addNetwork(b),m&&te.getInstance().getEqualLengthGroup(m).addNetwork(b),g&&x.getInstance().compiler.uploadNet(this.netName,or.getInstance().encode("NET",b)),this.data=void 0}remove(){let t=te.getInstance().getNet(this.netName);t!=null&&(this.data=t.toJSON(),te.getInstance().deleteNet(t.name,!1))}preCheck(){var g,y,b,P,T,I,C,E,O,_,R;let{safeSpacing:t,trackPhysics:e,differentialPhysics:r,netLengthPhysics:i,netLengthTolerancePhysics:n,blindViaPhysics:s,radiusPhysics:a,innerPlane:l,copperPlane:c,solderExpansion:h,pasteExpansion:u,netClassName:d,equalLengthGroupName:p,netDifferentialName:m}=this.data;t!==af&&(this.data.safeSpacing=((g=te.getInstance().getSafeSpacing(t))==null?void 0:g.name)||af),e!==af&&(this.data.trackPhysics=((y=te.getInstance().getTrackPhysics(e))==null?void 0:y.name)||af),r!==af&&(this.data.differentialPhysics=((b=te.getInstance().getDifferentialPhysics(r))==null?void 0:b.name)||af),i!==af&&(this.data.netLengthPhysics=((P=te.getInstance().getNetLengthPhysics(i))==null?void 0:P.name)||af),n!==af&&(this.data.netLengthTolerancePhysics=((T=te.getInstance().getNetLengthTolerancePhysics(n))==null?void 0:T.name)||af),s!==af&&(this.data.blindViaPhysics=((I=te.getInstance().getBlindPhysics(s))==null?void 0:I.name)||af),a!==af&&(this.data.radiusPhysics=((C=te.getInstance().getRadiusPhysics(a))==null?void 0:C.name)||af),l!==af&&(this.data.innerPlane=((E=te.getInstance().getInnerPlane(l))==null?void 0:E.name)||af),c!==af&&(this.data.copperPlane=((O=te.getInstance().getCopperPlane(c))==null?void 0:O.name)||af),h!==af&&(this.data.solderExpansion=((_=te.getInstance().getSolderExpansion(h))==null?void 0:_.name)||af),u!==af&&(this.data.pasteExpansion=((R=te.getInstance().getPasteExpansion(u))==null?void 0:R.name)||af),d&&te.getInstance().getNetClass(d)==null&&te.getInstance().addNetClass(d),p&&te.getInstance().getEqualLengthGroup(p)==null&&te.getInstance().addEqualLengthGroup(p),m&&te.getInstance().getNetDifferential(m)==null&&te.getInstance().addNetDifferential(m)}modify(){}getItem(){return"ignore"}upload(t){let e=this.isDelete(t),r=x.getInstance().compiler;r.setTicket(),e?r.deleteRuleSelector(["NET",this.netName]):(this.source==null&&this.updateData(),r.uploadRuleSelector(this.source)),this.source=void 0}updateData(){if(this.source==null){let t=te.getInstance().getNet(this.netName);t!=null&&(this.source=or.getInstance().encode("RULE_SELECTOR",t))}}};var rne=class extends so{constructor(t,e){super(),this.ruleName=t.name,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?or.getInstance().encode("RULE_SELECTOR",t):null,this.action=e}rebuild(){if(this.data){let{name:t,safeSpacing:e,trackPhysics:r,differentialPhysics:i,netLengthPhysics:n,netLengthTolerancePhysics:s,blindViaPhysics:a,radiusPhysics:l,innerPlane:c,copperPlane:h,solderExpansion:u,pasteExpansion:d,targetNet:p,nets:m,creepageSpacing:g}=this.data,y=new Eu(t,e,r,i,n,s,a,l,c,h,u,d,g,m);y.targetNet=p,te.getInstance().addNetClass(t,y)}}modify(){}remove(){let t=te.getInstance().getNetClass(this.ruleName);t&&t.getNets().size===0&&(this.data=t.toJSON(),te.getInstance().deleteNetClass(t.name))}getItem(){return"ignore"}upload(t){let e=this.isDelete(t),r=x.getInstance().compiler;r.setTicket(),e?r.deleteRuleSelector(["NET_CLASS",this.ruleName]):(this.source==null&&this.updateData(),r.uploadRuleSelector(this.source)),this.source=void 0}updateData(){if(this.source==null){let t=te.getInstance().getNetClass(this.ruleName);t!=null&&(this.source=or.getInstance().encode("RULE_SELECTOR",t))}}};var ine=class extends so{constructor(t,e){super(),this.ruleName=t.name,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?or.getInstance().encode("RULE_SELECTOR",t):null,this.action=e}rebuild(){if(this.data){let{name:t,safeSpacing:e,trackPhysics:r,differentialPhysics:i,netLengthPhysics:n,netLengthTolerancePhysics:s,blindViaPhysics:a,radiusPhysics:l,innerPlane:c,copperPlane:h,solderExpansion:u,pasteExpansion:d,targetNet:p,nets:m,creepageSpacing:g}=this.data,y=new Vd(t,e,r,i,n,s,a,l,c,h,u,d,g,m);y.targetNet=p,te.getInstance().addEqualLengthGroup(t,y)}}modify(){}remove(){let t=te.getInstance().getEqualLengthGroup(this.ruleName);t&&t.getAllNets().length===0&&(this.data=t.toJSON(),te.getInstance().deleteEqualLengthGroup(t.name))}getItem(){return"ignore"}upload(t){let e=this.isDelete(t),r=x.getInstance().compiler;r.setTicket(),e?r.deleteRuleSelector(["EQ_LEN_GRP",this.ruleName]):(this.source==null&&this.updateData(),r.uploadRuleSelector(this.source)),this.source=void 0}updateData(){if(this.source==null){let t=te.getInstance().getEqualLengthGroup(this.ruleName);t!=null&&(this.source=or.getInstance().encode("RULE_SELECTOR",t))}}};var nne=class extends so{constructor(t,e){super(),this.ruleName=t.name,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?or.getInstance().encode("RULE_SELECTOR",t):null,this.action=e}rebuild(){let{name:t,positiveNet:e,negativeNet:r,differentialPhysics:i}=this.data;te.getInstance().addNetDifferential(t,e,r,i)}remove(){let t=te.getInstance().getNetDifferential(this.ruleName);t&&(this.data=t.toJSON(),te.getInstance().deleteNetDifferential([this.ruleName]))}modify(){}getItem(){return"ignore"}upload(t){let e=this.isDelete(t),r=x.getInstance().compiler;r.setTicket(),e?r.deleteRuleSelector(["DIFF_PAIR",this.ruleName]):(this.source==null&&this.updateData(),r.uploadRuleSelector(this.source)),this.source=void 0}updateData(){if(this.source==null){let t=te.getInstance().getNetDifferential(this.ruleName);t!=null&&(this.source=or.getInstance().encode("RULE_SELECTOR",t))}}};var JS=class o{constructor(){this.flag=!1}static getInstance(){return o.proxy||(o.proxy=new o),o.proxy}modify(){this.flag=!0}upload(){if(this.flag){let t=x.getInstance().compiler,e=Cs.getInstance().board;if(t.setTicket(),e){let r=or.getInstance().encode("BOARD",e.model);KE("","Board",r)}else qI("","Board");this.flag=!1}}};var fF=class extends MT{rebuildPolygon(t,e,r,i,n,s,a,l){let c=new Jp(t,e,r,[],n,"",!1,null,null),h=new ct(c,[]);return h.setChildrens(i),Cs.getInstance().board=h,h}getItem(){let t=Cs.getInstance().board;return t instanceof ct?t:null}upload(t=!1){JS.getInstance().modify()}};var mF=class extends e_{rebuildRect(t,e,r,i,n,s,a,l,c,h,u,d){let p=new Zp(t,e,r,i,n,s,h,u,a,c,l,d,null),m=new nr(p);return Cs.getInstance().board=m,m}getItem(){let t=Cs.getInstance().board;return t instanceof nr?t:null}upload(t=!1){JS.getInstance().modify()}};var gF=class extends QA{rebuildCircle(t,e,r,i,n,s,a,l,c){let h=new $p(t,e,r,i,n,s,a,l,c,null),u=new Sr(h);return Cs.getInstance().board=u,u}getItem(){let t=Cs.getInstance().board;return t instanceof Sr?t:null}upload(t=!1){JS.getInstance().modify()}};function Om(o,t){return o instanceof t}var Te=class{static dispatch(t,e){if(Om(t,ca))return new n6(t,e);if(Om(t,Nh))return new mT(t,e);if(Om(t,Ri)||Om(t,fn))return Om(t,Ri)?new o6(t,e):new P6(t,e);if(Om(t,Sr))return t.type=="Board"?new gF(t,e):new QA(t,e);if(Om(t,ol))return new a6(t,e);if(Om(t,nr))return t.type=="Board"?new mF(t,e):new e_(t,e);if(Om(t,fr))return new l6(t,e);if(Om(t,Ar))return new c6(t,e);if(Om(t,Si))return new b6(t,e);if(Om(t,Ge))return new h6(t,e);if(Om(t,Ph))return new qR([t],e);if(Om(t,xa))return new f6(t,e);if(Om(t,ct))return t.type=="Board"?new fF(t,e):new MT(t,e);if(Om(t,Me))return new oP(t,e);if(Om(t,Yn))return new T6(t,e);if(Om(t,Rs))return new I6(t,e);if(Om(t,Ki))return new pF(t,e);if(Om(t,ii))return ce.pcbConfig.isRebuildCopperAuto?void 0:new GR(t,e);if("net"in t&&"layer"in t)throw new Error("this primitive is not supported!!")}static dispatchCoppers(t,e,r){t.type=="Copper Region"&&r.addCommand(new c3(t,e))}static dispatchPlanezones(t,e,r){r.addCommand(new ene(t,e))}static disPatchRule(t,e){let r;return t instanceof bp?r=new tne(t,e):t instanceof Eu?r=new rne(t,e):t instanceof Vd?r=new ine(t,e):t instanceof q2&&(r=new nne(t,e)),r}static getManager(t){return t instanceof c6||t instanceof b6?pr:t instanceof o6?Kt:t instanceof h6?Hr:t instanceof QA?Zt:t instanceof e_?Xt:t instanceof l6?ti:t instanceof a6?is:t instanceof n6||t instanceof mT?Go:t instanceof f6?Uo:t instanceof oP?Cr:t instanceof MT?pt:t instanceof P6?Kt:t instanceof T6?Ln:t instanceof I6?_o:null}};var hr=class{constructor(t,e,r,i,n=ee.BLACK,s=2,a=3){this.globalIndex=su();this.state="Only Main";this._manualHighLight=null;this.viewGroupId="";this._layerId=t,this._start=e,this._end=r,this._isSolid=i,this._color=n,this._gap=s,this._len=a,this.refreshRender()}get start(){return this._start}set start(t){this._start=t,this.refreshRender()}get end(){return this._end}set end(t){this._end=t,this.refreshRender()}set color(t){this._color=t,this.refreshRender()}get color(){return this._color}get isSolid(){return this._isSolid}set isSolid(t){this._isSolid=t,this.refreshRender()}get layerId(){return this._layerId}set layerId(t){this._layerId=t}get width(){return 0}set width(t){}get length(){return this._start.distance1(this._end)}get len(){return this._len}get gap(){return this._gap}get isEmpty(){return!1}transform(t){this.start=this.start.multiply4(t),this.end=this.end.multiply4(t)}visible(){this.state="Only Main",this.refreshRender()}click(){this.state="Main And Highlight",this.refreshRender()}remove(){this.state="Not Shown",this.refreshRender()}getType(){return 29}refreshRender(){Do.attach(this,this.getType())}getViewState(){return this.state}set manualHighLight(t){this._manualHighLight=t}getRenderData(){var h,u;let t=(u=(h=ce)==null?void 0:h.themeConfig)==null?void 0:u.canvasTheme,e=ee.BLACK;if(t){let d=t.hoverHighlightColor,p=t.hoverHighlightTransparency;e=ee.build(d.r,d.g,d.b,1-p)}let{layerId:r,color:i,isSolid:n,state:s,gap:a,len:l}=this,c=[[this.start,this.end]];return{layerId:r,segments:c,color:i,gap:a,len:l,isSolid:n,highlightColor:e,highLightType:null,manualHighLight:this._manualHighLight==null?x.getInstance().forceDeactive:this._manualHighLight}}getMathGraphics(){return new M(this._start,this._end).stroke(this.width,kr.ROUND,le.CW)}hidden(){this.state="Not Shown",this.refreshRender()}buildBBox(){return new M(this._start,this._end).bbox()}};var vSe=class{constructor(){this.line1=null;this.line2=null}getTimer(){return this.timer}setTimer(t){this.timer=t}show(t){let e=ce.themeConfig.canvasTheme,r=e.isSolidLine(e.cursorLineStyle),i=e.cursorColor,n=this.computeLength(new S(0,0)),s=this.computeLength(new S(0,-Ni().getHeight())),a=this.computeLength(new S(Ni().getWidth(),0));this.line1==null?this.line1=new hr(1002,new S(t.x,n.y),new S(t.x,s.y),r,i):(this.line1.start=new S(t.x,n.y),this.line1.end=new S(t.x,s.y)),this.line2==null?this.line2=new hr(1002,new S(n.x,t.y),new S(a.x,t.y),r,i):(this.line2.start=new S(n.x,t.y),this.line2.end=new S(a.x,t.y))}click(){this.line1!=null&&this.line1.click(),this.line2!=null&&this.line2.click()}visible(){this.line1!=null&&this.line1.visible(),this.line2!=null&&this.line2.visible()}remove(){this.line1!=null&&(this.line1.remove(),this.line1=null),this.line2!=null&&(this.line2.remove(),this.line2=null)}computeLength(t){let e=new S(Ni().getWidth()/2,-Ni().getHeight()/2);return t.sub(e).multiply4(Ni().get2dCameraMatrix().inverse())}},mc=new vSe;var So=class{constructor(t){this._nums=[];this.push(t)}push(t){if(t)if(t instanceof Array)this._nums.push(...t);else{if(isNaN(t))return;this._nums.push(t)}}pop(){return this._nums.pop()}clear(){this._nums.length=0}get total(){let t=0;return this._nums.forEach(e=>t+=e),t}get size(){return this._nums.length}get average(){return this.total/this.size}get max(){return Math.max(...this._nums)}get min(){return Math.min(...this._nums)}};var KR=class{constructor(t){this.type=t}};var _0=class o extends KR{constructor(e,r,i){super(1);this.title="Warning";this.msg=e,this.cb=r,this.cbCancel=i}equal(e){return e instanceof o&&this.type==e.type&&this.msg==e.msg}open(e){return{type:this.type,option:{msg:this.msg,title:this.title,textOK:"Yes",textCancel:"No"},extra:{}}}close(e){let r=e.action;r=="confirm"&&this.cb(),(r=="cancel"||r=="close"||r==null||e==null)&&this.cbCancel&&this.cbCancel()}};var one=class{checkInFrameInner2(t,e){let r=pt.getAllItem(),i=Xt.getAllItem(),n=Zt.getAllItem(),s=new Array,a=new Array;t.forEach(p=>{let m=p.getMathGraphics(p.layerId,0);a.push(m)});let l=new Set,c=a.length,h=new Array;for(let p=0;p<c;p++){let m=a[p];if(l.has(p))continue;let g=m.bbox(),y=g.area();for(let b=p+1;b<c;b++){let P=a[b];if(l.has(b))continue;let T=P.bbox(),I=g.intersection1(T);if(I!=null&&I.area()>=Math.min(T.area(),y)){let C=new Fs(m,P,0);C.relation==1?l.add(b):C.relation==2&&l.add(p)}}}r.forEach(p=>{if(p.layerId==11&&t.indexOf(p)<0&&p.getParent()==null&&(e==null||e!=null&&!e.has(p))){let m=p.getMathGraphics(p.layerId,0);p.isClose()&&(m=m.closeEndpoint()),h.push(m);let g=m.bbox(),y=g.area();for(let b=0;b<c;b++){if(l.has(b))continue;let P=a[b],T=P.bbox(),I=g.intersection1(T);if(I!=null&&I.area()>=Math.min(T.area(),y)){let C=new Fs(m,P,0);if(C.relation==1)l.add(b);else if(C.relation==2){s.push(p);return}}}}}),i.forEach(p=>{if(p.layerId==11&&t.indexOf(p)<0&&p.getParent()==null&&(e==null||e!=null&&!e.has(p))){let m=p.getMathGraphics(p.layerId,0);h.push(m);let g=m.bbox(),y=g.area();for(let b=0;b<c;b++){if(l.has(b))continue;let P=a[b],T=P.bbox(),I=g.intersection1(T);if(I!=null&&I.area()>=Math.min(T.area(),y)){let C=new Fs(m,P,0);if(C.relation==1)l.add(b);else if(C.relation==2){s.push(p);return}}}}}),n.forEach(p=>{if(p.layerId==11&&t.indexOf(p)<0&&p.getParent()==null&&(e==null||e!=null&&!e.has(p))){let m=p.getMathGraphics(p.layerId,0);h.push(m);let g=m.bbox(),y=g.area();for(let b=0,P=a.length;b<P;b++){if(l.has(b))continue;let T=a[b],I=T.bbox(),C=g.intersection1(I);if(C!=null&&C.area()>=Math.min(I.area(),y)){let E=new Fs(m,T,0);if(E.relation==1)l.add(b);else if(E.relation==2){s.push(p);return}}}}});let u=new _e,d=new Array;for(let p of h)u.ext1(p.bbox()),Re.addAll(d,p.primitives);if(u.valid()){let p=u.build1().extendOfSize(5),g=new oh(p,1,.1,new Gi(4),d).detect();for(let y of g.items){let b=y.bbox(),P=b.area();if(!(P>p.area()))for(let T=0;T<c;T++){if(l.has(T))continue;let I=a[T],C=I.bbox(),E=b.intersection1(C);E!=null&&E.area()>=Math.min(C.area(),P)&&new Fs(y,I,0).relation==1&&l.add(T)}}}for(let p of l)s.push(t[p]);return s}};function nC(o){let t=new dT(!1),e=new FI(_A,new Gi(4),t);for(let i of o)vh(i)||(i=i.reverse().asClose()),e.addPolyline(i.asClose());e.simplify();let r=[];for(let i of t.plGrps)xr(i.items,q3t,0,i.items.length),r.push(i.items[0]);return r}var q3t=function(o,t){return t.bbox().area()-o.bbox().area()};var io=class{plGrpsToShapes(t,e=1,r=1,i=!1){return this.plsToShapes(t.items,e,r,i)}plsToShapes(t,e=1,r=1,i=!1){let n=new Array;for(let s of t)n.push(this.plToShapes(s,e,r,i));return n}plToShapes(t,e=1,r=1,i=!1){return this.ptsToShapes(t.primitives,e,r,i)}ptsToShapes(t,e=1,r=1,i=!1){let n=new Array;for(let s of t)n.push(this.ptToShape(s,e,r,i));return n}ptToShape(t,e=1,r=1,i=!1){if(t instanceof M)return $u.add(e,t.start(),t.end(),r,i);if(t instanceof q){let n=Ht.toRadians(t.startAngle),s=Ht.toRadians(t.endAngle());return qc.addArc(e,t.center,t.rx,r,n,s,t.sweep(),i)}else throw new Error("not surpport!!!")}clone4(t){let e=t.clone();return e.globalIndex=cr(),e.modelType=="Line"?$u.addByModel(e):qc.addArcByModel(e)}clone4Shape(t,e=1,r=1,i=!1){if(t instanceof M)return $u.add(e,t.start(),t.end(),r,i);if(t instanceof q){let n=Ht.toRadians(t.startAngle),s=Ht.toRadians(t.endAngle());return qc.addArc(e,t.center,t.rx,r,n,s,t.sweep(),i)}}addLine(t,e,r=1,i=1,n=!1){return $u.add(r,t,e,i,n)}};var au=class{constructor(){this.fac=new io}create4Pt(t,e,r,i,n,s){let a=this.fac.ptToShape(r,e,i,s);return pt.addPolygon(t,e,[[a]],i,n,s)}create4Pts(t,e,r,i,n,s){let a=this.fac.ptsToShapes(r,e,i,s);return pt.addPolygon(t,e,[a],i,n,s)}create4Pl(t,e,r,i,n,s){let a=this.fac.ptsToShapes(r.primitives,e,i,s);return pt.addPolygon(t,e,[a],i,n,s)}create4Pls(t,e,r,i,n,s){let a=this.fac.plsToShapes(r,e,i,s);return pt.addPolygon(t,e,a,i,n,s)}create4PlGrp(t,e,r,i,n,s){return this.create4Pls(t,e,r.items,i,n,s)}};var mi=class{constructor(){this.command=null;this.items=new Array;this.needUndo=!1}getCommand(){return this.command}createGroup(t){return this.command==null&&(this.command=new ve(t)),this}addGroup(t){return this.command==null&&(this.command=t),this}addCommand4Item(t,e){let r=Te.dispatch(t,e);if(!(t instanceof ii)&&r==null)throw new Error("input shape error!!!");return A.publish("hasModifyPcbItem",t),this.addCommand(r)}addCommand(t){return this.command!=null&&this.command.addCommand(t),this}undo(t=!0){this.command!=null&&(this.command.undo(),this.command=null),t&&A.publish("flushService",""),A.publish("flushSelectingInfo","")}execute(){this.command!=null&&this.command.length>0&&(je.executeCommand(this.command),this.command=null,A.publish("flushService",""))}conver2Slot(t){for(let e of t)if(this.inBoardOutline(e))if(e instanceof ct&&!e.isClose()){this.addCommand4Item(e,"delete");for(let r of e.getChildrens()){let i=r.map(s=>s.getMathGraphics());r.length>1&&(i=nC(i));let n=new au;i.forEach(s=>{let a=n.create4Pl("Slot Region",12,s,e.strokeWidth,"",e.locked);a.fill(),this.addCommand4Item(a,"add")})}e.remove(),A.publish("delete",e)}else this.addCommand4Item(e,"modify"),e.type="Slot Region",e.fill();return this}getInnerOutlines(t,e){let r=t.filter(i=>this.inBoardOutline(i));return r.length?new one().checkInFrameInner2(r,e):[]}checkOutlines(t,e=new Set){this.execute(),this.checkOutlinesNoExecute(t,e)}checkOutlinesNoExecute(t,e){let r=this.getInnerOutlines(t,e);if(r.length>0){let n=['<span class="i18n">Board outline are placed inside the board outline detected, Suggesting convert the internal board outline to slot region\uFF1A</span>'];for(let s=0;s<r.length;s++){let a={text:`${ur}${r[s].number}`,attr:{pcbId:x.getInstance().tabId,id:r[s].globalIndex}};n.push(a,"\uFF0C")}n.pop(),A.publish("logPublishProxy",{type:"info",msg:n},$())}}openMsgBox(t){A.publish("clearSelect",""),this.highlightAndCenter(t);let e=new _0("Board outline are not allowed to be placed inside the board outline, do you want to  convert the internal highlight primitive to slot region?",()=>{this.conver2Slot(t),this.execute()},()=>{this.undo()});A.publish("openMsgbox",e)}highlightAndCenter(t){let e=new _e;for(let r of t)r.click(),e.ext1(r.buildBBox());if(A.publish("onlySelect",t),Pr.model=3,e.valid()){let r=e.build1(),i=ZR();if(r.isInside(i)){let s=x.getInstance().openRuler?40:20,a=ut.extend4(r.center(),window.innerWidth-s,window.innerHeight-s);A.publish("adaptBBox",[a,Ni().getScale()])}else A.publish("adaptBBox",r)}}inBoardOutline(t){return!t.isEmpty&&t instanceof Ye&&(t.type=="Board Outline"||t.type=="Line"&&t.layerId==11)}};function Gr(o,t){return on(Di.convert(o,t,kl.unit)||0,5)}function RSe(o,t){return on(Di.convert(o,kl.unit,t)||0,5)}var kl=class{constructor(t,e){this.config={StencilThickness:Gr(.12,39.37),StencilThicknessMultiple:3.5,FillHeight:65,DefaultSolderMaskExpansion:Gr(.0508,39.37),DefaultTrackSpacing:Gr(.15,39.37),DefaultStrokeWidth:Gr(.1524,39.37),DefaultVIAHoleRadius:Gr(.15,39.37),DefaultVIADiameter:Gr(.6,39.37),DefaultVIAthermalPadSpacing:Gr(1,39.37),LEADCUTOUTOVERLAP:Gr(.01,39.37)};this.shapes=[];this._bbox=null;this.firstPinDesigner="1";this._firstPinPosition=null;this._firstPinBBox=null;this._origin=S.ORIGIN;this.historyGroup=null;this.pads=[];this.modelName=t,this.defaultOptions=Object.assign({},this.defaultOptions,e),this.currentOptions=this.defaultOptions}unitConvert(t,e){return Gr(t,e)}unitReverse(t,e){return RSe(t,e)}fixOptions(t,e=!0){this.currentOptions=Object.assign({},this.defaultOptions,t,this.fixedOptions),e&&this.fixWidth2Height(this.currentOptions),["pinDiameter","bodyLength","bodyWidth"].forEach(i=>{let n=this.currentOptions[i];!Object.is(n,void 0)&&!(n instanceof So)&&(this.currentOptions[i]=new So(n))});for(let i in this.currentOptions)Array.isArray(this.currentOptions[i])&&(this.currentOptions[i]=new So(this.currentOptions[i]).average);return this.currentOptions}fixWidth2Height(t){let e=["BGA","ChipArray","SOIC_SOP","SOT23","SOT223","TO-DPAK"],r=t.bodyWidth,i=t.bodyLength,n=t.packageName;r&&i&&e.indexOf(n)>-1&&(t.bodyWidth=i,t.bodyLength=r)}get bbox(){return this._bbox||this.updateBBox()}get firstPinPosition(){var t;return this._firstPinPosition=this._firstPinPosition||((t=this.getPinPosition(1))==null?void 0:t.center)||S.ORIGIN,this._firstPinPosition}get firstPinBBox(){var t;return this._firstPinBBox=this._firstPinBBox||((t=this.getPinPosition(1))==null?void 0:t.buildBBox())||new ut(0,0,0,0),this._firstPinBBox}get packageName(){return this.currentOptions.packageName||this.modelName}updateBBox(t){if(t)return this._bbox=t,t;let e=new _e;return this.shapes.forEach(r=>{e.ext1(r.buildBBox())}),this._bbox=e.build1(),this._bbox}resetShape(t=!1){this.shapes.length=0,(t||!this.historyGroup)&&(this.historyGroup=new mi,this.historyGroup.createGroup("footprint-generate"))}getPinPosition(t){let e=t==1,r=null,i=new _e,n=this.shapes;for(let a of n)if(a instanceof Ri){if(r||(r=a),e&&a.num===this.firstPinDesigner)return this._origin=a.center,a;i.ext2(a.center)}let s=e?r&&r.center||null:i.build1().center();return e&&(this._firstPinPosition=s),this._origin=e?r.center:s,e?r:s}autoShowLayer(t){be.layerMap[t]||console.warn("this layerId has not been created!",t)}createPad(t,e=!0){var I,C;let r=this.currentOptions;t=Object.assign({net:"",rotation:0,spin:!1,padShape:r.padShape},t,{pasteMaskEx:null,topSolderMaskEx:null,bottomSolderMaskEx:null});let{location:i,designator:n,layer:s,net:a,pasteMaskEx:l,topSolderMaskEx:c,bottomSolderMaskEx:h,rotation:u,spin:d,padShape:p}=t,m=((I=r.pinDiameter)==null?void 0:I.average)||r.pinWidth,g=((C=r.pinDiameter)==null?void 0:C.average)||r.pinHeight,y=r.padExpansion,b=t.padSizeInfo||this.getCommonPadSize(m,g,y,d),P=0,T=Kt.addPad(s,1,n,i,p,b.padWidth,b.padHeight,P,p,b.padWidth,b.padHeight,P,p,b.padWidth,b.padHeight,P,u,!1,a,1,l,c,h,[],!0,b.holeWidth,b.holeHeight/2,"ROUND",0,rt.defalutPad.holeOffset);return e&&this.shapes.push(T),T}addThermalPad(t,e){let r=this.currentOptions.thermalPad,i=r==null?void 0:r.thermalPadWidth,n=r==null?void 0:r.thermalPadHeight;if(!i||!n)return;let s=this.getCommonPadSize(i,n,0,!1),a=this.bbox.center();if(r.hasThermalVias!=="0"&&r.hasThermalVias){let l={viaDiameter:this.config.DefaultVIADiameter,viaSPacing:this.config.DefaultVIAthermalPadSpacing,vaiHoleRadius:this.config.DefaultVIAHoleRadius},{viaDiameter:c,viaSPacing:h,vaiHoleRadius:u}=Object.assign({},l,e),d=c+h,p=Math.floor(n/d),m=Math.floor(i/d),g=a.add1(-(m-1)*h/2,(p-1)*h/2);if(p>0&&m>0)for(let y=0;y<p;y++)for(let b=0;b<m;b++){let P=Hr.addVia(0,"",1,2,"",c/2,g.add1(b*h,-y*h),u,!1,1,0,0);this.shapes.push(P)}}return this.createPad({location:a,designator:t,layer:1,padSizeInfo:s,padShape:"RECT"})}addLine(t){return this.autoShowLayer(t.layer),this.addPolygon({lineType:"Line",layer:t.layer,outline:fe.build4([t.start,t.end]),width:t.width,net:t.net,locked:t.locked})}addArc(t){return this.addPolygon({lineType:"Line",layer:t.layer,outline:fe.build2([q.build2(t.center,t.startAngle,t.endAngle,t.radius,t.radius,t.sweep)]),width:t.width,net:t.net,locked:t.locked})}addArcByArc(t){let e=t.arc;return this.addArc({layer:t.layer,width:t.width,locked:t.locked,center:e.center,radius:e.rx,startAngle:e.startAngle,endAngle:e.endAngle(),sweep:e.sweep()})}addConnectRelatedId(t,e){if(!(t&&e))return;t.component instanceof ln&&(t.component.padId=e),$a.getInstance().addConnectRelatedId(e,t.globalIndex);let r=Te.dispatch(t,"modify")}addCicle(t){this.autoShowLayer(t.layer);let e=Zt.addCircle(t.lineType,t.layer,t.center,t.radius,t.width,!!t.locked,t.net||"");return e.fill(),A.publish("hasModifyPcbItem",e),e}addPolygon(t){this.autoShowLayer(t.layer);let e=this.config.DefaultStrokeWidth;if(t.outline.primitives.length==0)return null;pd(t.lineType)&&(t.outline=t.outline.asClose());let i=new au().create4Pl(t.lineType,t.layer,t.outline,t.width||e,t.net||"",!!t.locked);return i.fill(),A.publish("hasModifyPcbItem",i),i}buildBodySilk(t=this.bbox,e=this.config.DefaultStrokeWidth,r){if(this.currentOptions.bodyDiameter>0)return this.buildCircleBodySilk(t,e);let n=t.extendSize(e),s=3;r=r||[];let a=r.includes("T")?null:this.addLine({layer:s,start:n.UL(),end:n.UR(),width:e}),l=r.includes("R")?null:this.addLine({layer:s,start:n.UR(),end:n.LR(),width:e}),c=r.includes("B")?null:this.addLine({layer:s,start:n.LR(),end:n.LL(),width:e}),h=r.includes("L")?null:this.addLine({layer:s,start:n.LL(),end:n.UL(),width:e});return[a,l,c,h].forEach(u=>u&&this.shapes.push(u)),this.trackBBox=n,n}buildCircleBodySilk(t=this.bbox,e=this.config.DefaultStrokeWidth){let r=t.center(),n=t.width()/2+e/2,s=this.addCicle({lineType:"Line",net:"",layer:3,center:r,radius:n,width:e,locked:!1});return this.shapes.push(s),s.buildBBox()}buildConerSilk(t=this.bbox,e,r){let i=3;e=e||this.config.DefaultStrokeWidth,r=r||this.unitConvert(.5,39.37);let n=e/2,s=t.UL().add1(-n,n),a=this.addLine({layer:i,start:s,end:s.add1(r,0),width:e}),l=this.addLine({layer:i,start:s,end:s.add1(0,-r),width:e});s=t.UR().add1(n,n);let c=this.addLine({layer:i,start:s,end:s.add1(-r,0),width:e}),h=this.addLine({layer:i,start:s,end:s.add1(0,-r),width:e});s=t.LR().add1(n,-n);let u=this.addLine({layer:i,start:s,end:s.add1(-r,0),width:e}),d=this.addLine({layer:i,start:s,end:s.add1(0,r),width:e});s=t.LL().add1(-n,-n);let p=this.addLine({layer:i,start:s,end:s.add1(r,0),width:e}),m=this.addLine({layer:i,start:s,end:s.add1(0,r),width:e});this.shapes.push(a,l,c,h,u,d,p,m)}createBody(){let t=this.currentOptions;if(t.bodyDiameter>0)return this.createCircleBody(t.bodyDiameter);let e=t.bodyLength.average,r=t.bodyWidth.average,i=ut.extend4(S.ORIGIN,e,r),n=fe.build6(i),s=this.addPolygon({lineType:"Line",layer:48,net:"",outline:n,width:.1});return this.shapes.push(s),this._bbox=i,i}createCircleBody(t){let e=this.currentOptions;if(t=t||e.bodyDiameter||0,t<=0)return;let r=t/2,i=this.addCicle({lineType:"Line",net:"",layer:48,center:S.ORIGIN,radius:r,width:0,locked:!1});return this.shapes.push(i),this._bbox=ut.extend4(S.ORIGIN,t,t),this._bbox}buildPasteMaskShape(t,e,r,i){let n=e?7:8;if(t=t.extendSize(r.expansionSize),r.corner==0)return this.addPolygon({lineType:"Fill Region",layer:n,net:"",outline:fe.build6(t).asClose(),width:0});{let s=i||Math.min(t.width(),t.height())*.1,a=i||s,l=t.UL().add1(s,0),c=t.UR().add1(-s,0),h=t.UR().add1(0,-a),u=t.LR().add1(0,a),d=t.LR().add1(-s,0),p=t.LL().add1(s,0),m=t.LL().add1(0,a),g=t.UL().add1(0,-a),y=null;if(r.corner==2)y=fe.build4([l,c,h,u,d,p,m,g,l]);else{s=a=Math.min(s,a);let b=[];b.push(new M(l,c)),b.push(q.build1(c,h,a,s,!1,le.CW)),b.push(new M(h,u)),b.push(q.build1(u,d,s,a,!1,le.CW)),b.push(new M(d,p)),b.push(q.build1(p,m,a,s,!1,le.CW)),b.push(new M(m,g)),b.push(q.build1(g,l,s,a,!1,le.CW)),y=fe.build2(b)}return this.addPolygon({lineType:"Fill Region",layer:n,net:"",outline:y.asClose(),width:0})}}createFootprint(){return this.getPinPosition(this.currentOptions.footprintOrigin),this.shapes}buildPoint(t,e=!0){let r={radius:this.unitConvert(.5,10),spacing:this.unitConvert(1,10),layer:3,aligment:"auto",isInner:!1,bbox:this.trackBBox||this.bbox};t=Object.assign(r,t);let i=this.getPinPosition(1);if(!i)return;let n=t.bbox,s=i.center,a=t.center;if(!a){let c=t.radius+t.spacing;if(t.isInner&&(c=-c),t.aligment=="horizontal")this.positionOnBBox(s).horizontal!=J1e.RIGHT?a=new S(Math.min(n.minX,i.buildBBox().minX-(i.topSolderExpansion||i.bottomSolderExpansion))-c,s.y):a=new S(Math.max(n.maxX,i.buildBBox().maxX+(i.topSolderExpansion||i.bottomSolderExpansion))+c,s.y);else if(t.aligment=="vertical")this.positionOnBBox(s).vertical!=yy.BOTTOM?a=new S(s.x,Math.max(n.maxY,i.buildBBox().maxY+(i.topSolderExpansion||i.bottomSolderExpansion))+c):a=new S(s.x,Math.min(n.minY,i.buildBBox().minY-(i.topSolderExpansion||i.bottomSolderExpansion))-c);else{let h=this.positionOnBBox(s);(h.vertical===yy.CENTER?this.currentOptions.firstPinAt===0?yy.TOP:yy.BOTTOM:h.vertical)===yy.TOP?a=n.UL().add1(-c,c):a=n.LL().add1(-c,-c)}}let l=this.createAPoint(a,t.radius,t.layer);return e&&this.shapes.push(l),l}getCornerPositionOfFirstpin(t,e){t=t||this.bbox,e=e||this.firstPinPosition;let r=this.positionOnBBox(e,t),i=null;switch(r){case jm.LT:case jm.CT:i=t.UL();break;case jm.RT:i=t.UR();break;case jm.LB:case jm.LC:case jm.CB:case jm.CC:i=t.LL();break;case jm.RB:case jm.RC:i=t.LR();break}return i}buildComponentPoint(t,e=49,r){let i=this.getCornerPositionOfFirstpin(t,r);this.buildPoint({radius:this.unitConvert(.06,39.37),center:i,layer:e})}positionOnBBox(t,e=this.bbox){return e.positionOnBBox(t)}createAPoint(t,e,r){return this.addCicle({lineType:"Fill Region",net:"",layer:r,center:t,radius:e,width:1})}buildPinOutlineShape(t){if(!t)return;let e=50,r=t.primitives[0];return t.primitives.length==1&&r instanceof q&&r.isCircle()?this.createAPoint(r.center,r.rx,e):this.addPolygon({lineType:"Fill Region",net:"",layer:e,outline:t})}addLinesByPoints(t,e){if(!t||t.length<2)return;let r={net:"",layer:3,stroke:this.config.DefaultStrokeWidth},{layer:i,stroke:n}=Object.assign({},r,e),s=null;for(let a of t)s&&!s.equals(a)&&this.shapes.push(this.addLine({layer:i,start:s,end:a,width:n})),s=a}fixFirstPinPosition(t){if(this.currentOptions.firstPinAt==t)return;let e=t==0?90:-90,r=Ae.rotateZ(Ht.toRadians(e));this.shapes.forEach(i=>{i.transform(r),i instanceof Ye&&i.fill()})}createPasteMask(t){t=t||this.currentOptions.customPasteMask,t&&this.shapes.forEach(e=>{e instanceof Ri&&e.layerId!==12&&(this.shapes.push(this.buildPasteMaskShape(e.buildBBox(),e.layerId===1,t)),e.expansion=ju.getPadExpansion(e.expansionType,this.unitConvert(-100,39.37),this.unitConvert(2,1),this.unitConvert(2,1)))})}clonePolygonModel(t,e){return t&&e?this.addPolygon({lineType:t.type,net:t.net,layer:t.layerId,outline:e,width:t.strokeWidth,locked:t.locked}):null}resetPolygonChildren(t,e){if(t){t.removeAllChildren();let r=new io;t.setChildrens([r.plToShapes(e,t.layerId,t.strokeWidth,t.locked)])}return t}clonePad(t,e){return this.createPad({location:e.center,padSizeInfo:{holeWidth:t.holeLength,holeHeight:t.holeRadius*2,padWidth:t.topWidth||t.innerWidth||t.bottomWidth,padHeight:t.topHeight||t.innerHeight||t.bottomHeight},layer:t.layerId,designator:t.num},e.autoPush)}cloneLine(t,e){return this.addLine({layer:t.layerId,start:e.start,end:e.end,width:t.width,locked:t.locked})}cloneArc(t,e){return this.addArc({layer:t.layerId,center:e.center,radius:t.radius,startAngle:t.startAngle,endAngle:t.endAngle,sweep:t.sweep,width:t.width,locked:t.locked})}buildPositiveAndNegative(t=!0){let e=this.bbox,i=e.height()*.8,n=i*.6,s=n/4,a=e.minX+s,l=a+n,c=s/2,h=-s/2,u=a+n/2-s/2,d=u+s,p=i/2,m=-i/2,g=13,y=fe.build4([new S(a,h),new S(a,c),new S(l,c),new S(l,h)]).asClose();this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:g,outline:y})),this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:g,outline:y.multiply3(Qe.MIRROR_X)}));let b=fe.build4([new S(Math.abs(u),m),new S(Math.abs(u),p),new S(Math.abs(d),p),new S(Math.abs(d),m)]).asClose();this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:g,outline:t?b.mirrorY():b}))}buildSilkByPackageType(t=!1){let e=this,i=this.currentOptions.componentType,n=this.config.DefaultStrokeWidth,s=n,a=n*3,c=this.getPinPosition(1).buildBBox(),h=c.extendSize(a),u=3,d=h.UL(),p=h.UR(),m=h.LR(),g=h.LL(),y=[],b,P,T,I,C,E,O=S.ORIGIN,_=n/2,R=c.height()-_/2;switch(i){case"C":default:if(!t){b=p.add1(-a/2-n/2,0),P=d.add1(s,0),T=d.add1(0,-s),I=g.add1(0,s),C=g.add1(s,0),E=m.add1(-a/2-n/2,0),y.push(this.addLine({layer:u,start:b,end:P,width:n}));let F=q.build1(P,T,s,s,!1,le.CCW);y.push(this.addArc({layer:u,radius:F.rx,center:F.center,width:n,startAngle:F.startAngle,endAngle:F.endAngle(),sweep:F.sweep(),locked:!1})),y.push(this.addLine({layer:u,start:T,end:I,width:n}));let H=q.build1(I,C,s,s,!1,le.CCW);y.push(this.addArc({layer:u,radius:H.rx,center:H.center,width:n,startAngle:H.startAngle,endAngle:H.endAngle(),sweep:H.sweep()})),y.push(this.addLine({layer:u,start:C,end:E,width:n})),v(y)}break;case"R":t||(b=p.add1(-a/2-n/2,0),P=d,T=g,I=m.add1(-a/2-n/2,0),y.push(this.addLine({layer:u,start:b,end:P,width:n})),y.push(this.addLine({layer:u,start:P,end:T,width:n})),y.push(this.addLine({layer:u,start:T,end:I,width:n})),v(y));break;case"I":case"BD":if(!t&&(b=p.add1(-a/2-n/2,0),P=d.add1(s,0),T=d.add1(0,-s),I=g.add1(0,s),C=g.add1(s,0),E=m.add1(-a/2-n/2,0),y.push(this.addLine({layer:u,start:b,end:P,width:n})),y.push(this.addLine({layer:u,start:P,end:T,width:n})),y.push(this.addLine({layer:u,start:T,end:I,width:n})),y.push(this.addLine({layer:u,start:I,end:C,width:n})),y.push(this.addLine({layer:u,start:C,end:E,width:n})),v(y),i==="BD")){let F=T.add1(-(a+n)/4,0),H=F.add1(-n,0),z=I.add1(-(a+n)/4,0),G=z.add1(-n,0),W=this.addPolygon({lineType:"Fill Region",net:"",layer:3,outline:fe.build4([F,H,G,z]).asClose()});v([W])}break;case"CO":t||(b=d.mirrorY(),P=d,T=g,I=T.mirrorY(),this.shapes.push(this.addLine({layer:u,start:b,end:P,width:n})),this.shapes.push(this.addLine({layer:u,start:P,end:T,width:n})),this.shapes.push(this.addLine({layer:u,start:T,end:I,width:n})),this.shapes.push(this.addLine({layer:u,start:I,end:b,width:n})));break;case"D":case"LED":if(!t){b=p.add1(-a/2-n/2,0),P=d.add1(s,0),T=d.add1(0,-s),I=g.add1(0,s),C=g.add1(s,0),E=m.add1(-a/2-n/2,0),this.shapes.push(this.addLine({layer:u,start:b,end:P,width:n})),this.shapes.push(this.addLine({layer:u,start:P,end:T,width:n})),this.shapes.push(this.addLine({layer:u,start:T,end:I,width:n})),this.shapes.push(this.addLine({layer:u,start:I,end:C,width:n})),this.shapes.push(this.addLine({layer:u,start:C,end:E,width:n})),b=b.mirrorY(),P=d.mirrorY(),T=g.mirrorY(),I=E.mirrorY(),this.shapes.push(this.addLine({layer:u,start:b,end:P,width:n})),this.shapes.push(this.addLine({layer:u,start:P,end:T,width:n})),this.shapes.push(this.addLine({layer:u,start:T,end:I,width:n})),T=d.add1(0,-s),I=g.add1(0,s);let F=T.add1(-(a+n)/4,0),H=F.add1(-n,0),z=I.add1(-(a+n)/4,0),G=z.add1(-n,0);if(i==="D"){let W=this.addPolygon({lineType:"Fill Region",net:"",layer:3,outline:fe.build4([F,H,G,z]).asClose()});this.shapes.push(W)}else if(i==="LED"){let W=new S(H.x-n,(H.y+G.y)/2);this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:3,outline:fe.build4([F,H,W,G,z]).asClose()}))}}break;case"F":t||(b=p.add1(-a/2-n/2,0),P=d.add1(s,0),T=d.add1(0,-s),I=g.add1(0,s),C=g.add1(s,0),E=m.add1(-a/2-n/2,0),y.push(this.addLine({layer:u,start:b,end:P,width:n})),y.push(this.addLine({layer:u,start:T,end:I,width:n})),y.push(this.addLine({layer:u,start:C,end:E,width:n})),v(y));let D=q.build1(O.add1(0,R/2),O,R/2,R/2,!1,le.CCW),w=q.build1(O,O.add1(0,-R/2),R/2,R/2,!1,le.CW);this.shapes.push(this.addPolygon({layer:u,width:_,lineType:"Line",outline:fe.build2([D,w])}));break}function v(D){e.cloneMirrorItems(D,!0,e.shapes)}}cloneMirrorItems(t,e=!0,r,i){let n=Qe.MIRROR_X,s=[],a=typeof i=="function";return t.forEach(l=>{let c=null;if(l instanceof mt)c=this.cloneLine(l,{start:l.start.multiply3(n),end:l.end.multiply3(n)});else if(l instanceof vt){let h=[],u=l.endAngle-l.startAngle;h.push(q.build1(l.start.mirrorY(),l.end.mirrorY(),l.radius,l.radius,Math.abs(u)>180,u>=0?le.CW:le.CCW)),c=this.addPolygon({lineType:"Line",net:"",layer:l.layerId,outline:fe.build2(h)})}else if(l instanceof ct&&!l.isComplexPolygon()){let h=l.primitives.map(u=>u.multiply3(n));c=this.clonePolygonModel(l,fe.build2(h))}else l instanceof Sr?c=this.addCicle({lineType:"Fill Region",net:l.net,layer:l.layerId,center:l.center.multiply3(n),radius:l.radius,width:l.strokeWidth}):l instanceof Ri&&(c=this.clonePad(l,{center:l.center.multiply3(n),autoPush:!1}));e&&s.push(l),c&&s.push(c),r&&(e&&r.push(l),c&&r.push(c)),a&&c&&i.call(this,c)}),s}buildPlusMinusSign(t,e,r,i=13,n=!0){let s=fe.build6(ut.extend4(t,e,r)),a=fe.build6(ut.extend4(t,r,e));this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:i,outline:s})),n&&this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:i,outline:a}))}isPolarity(){return this.currentOptions.polarity||["PC","D","BD","LED"].includes(this.currentOptions.componentType)}getCommonPadSize(t,e,r,i){if(i){let a=t;t=e,e=a}t||(t=0),e||(e=0),r||(r=0);let n=t+r,s=e+r;return{holeWidth:t,holeHeight:e,padWidth:n,padHeight:s}}getStraightPassPadSize(t){let e={padExpansion:this.unitConvert(.2,39.37),padRatio:1.5};t=Object.assign({},e,t);let{pinDiameterMax:r,padExpansion:i,padRatio:n}=t;i=Math.max(0,i),n=Math.max(1,n);let s=r+i,a=s*n;return{holeWidth:s,holeHeight:s,padWidth:a,padHeight:a}}createQFPLinkPads(t){var pe;let{LEADCUTOUTOVERLAP:e}=this.config,{pinsNumberLR:r,pinsNumberTB:i,leadSpan_h:n,leadSpan_v:s,rowSpace:a,columnSpace:l,startDesignator:c,padSizeOptions:h,filterFun_left:u,filterFun_right:d,filterFun_top:p,filterFun_bottom:m}=t;c||(c=1),h||(h={}),r==0&&(n=0),r<=1&&(l=0),i==0&&(s=0),i<=1&&(a=0);let{pinLength:g,pinWidth:y,padShape:b,padExpansion:P}=this.currentOptions;P||(P=0);let T=this.bbox,I=T.width(),C=T.height(),E=T.center(),O=n-I,_=O/2,R=s-C,v=R/2,D=_-g/2,w=v-g/2,F=T.extendSize(Math.max(0,O),Math.max(0,R)),H=1,z=[],G=[],W=[],L=[],B=null,N=null,U=c,k=Object.assign({},h,{pinWidth:g,pinHeight:y,pinSpacing:l,padShape:b,pinFloatingLen:isNaN(h.pinFloatingLen)?D:h.pinFloatingLen}),{holeWidth:V,holeHeight:Y,Jh:X,Jt:Z}=this.getQFPLinkPadSizeInfo(k),Q=this.getCommonPadSize(V,Y,P),ae=Object.assign({},h,{pinWidth:g,pinHeight:y,pinSpacing:a,padShape:b,pinFloatingLen:isNaN(h.pinFloatingLen)?w:h.pinFloatingLen}),{holeWidth:he,holeHeight:re,Jh:se,Jt:K}=this.getQFPLinkPadSizeInfo(ae),me=this.getCommonPadSize(he,re,P,!0),Oe=new S(T.minX-_,E.y+(r-1)*l/2),Ie="";for(let ge=0;ge<r;ge++){let Se=Oe.add1(0,-ge*l),De={};if(De.pin_solid={lineType:"Fill Region",net:"",layer:50,outline:fe.build6(ut.extend4(Se,g,y))},D>0){let Ze=D+e*2,Wt=y,Nr=Se.x+g/2;De.pin_float={lineType:"Fill Region",net:"",layer:51,outline:fe.build6(ut.extend4(new S(Nr+D/2,Se.y),Ze,Wt))}}let tt=Se.add1((X-Z)/2,0);De.pad={location:tt,padSizeInfo:Q,layer:H,designator:(U++).toString()},z.push(De),Ie||(Ie=(pe=De.pad)==null?void 0:pe.designator)}U+=i+r-1;let ue=[];z.reverse().forEach(ge=>{var Wt,Nr,Lr;u!=null&&u.call(null,ge.pad.designator)||ue.push(ge);let Se=(U--).toString();if(d!=null&&d.call(null,Se))return;let De=Qe.MIRROR_X,tt=(Wt=ge.pin_solid)==null?void 0:Wt.outline.multiply3(De),Ze=(Lr=(Nr=ge.pin_float)==null?void 0:Nr.outline)==null?void 0:Lr.multiply3(De);W.push({pin_solid:ge.pin_solid?Object.assign({},ge.pin_solid,{outline:tt}):null,pin_float:ge.pin_float?Object.assign({},ge.pin_float,{outline:Ze}):null,pad:ge.pad?Object.assign({},ge.pad,{location:ge.pad.location.multiply3(De)}):null})}),z.length=0,z.push(...ue.reverse()),U=r+1,Oe=new S(E.x-(i-1)*a/2,T.minY-v);for(let ge=0;ge<i;ge++){let Se=Oe.add1(ge*a,0),De={};if(De.pin_solid={lineType:"Fill Region",net:"",layer:50,outline:fe.build6(ut.extend4(Se,y,g))},w>0){let Ze=y,Wt=w+e*2,Nr=Se.y+g/2;De.pin_float={lineType:"Fill Region",net:"",layer:51,outline:fe.build6(ut.extend4(new S(Se.x,Nr+w/2),Ze,Wt))}}let tt=Se.add1(0,(se-K)/2);De.pad={location:tt,padSizeInfo:me,layer:H,designator:(U++).toString()},L.push(De)}U=(r+r)*2,ue.length=0;let Pe=null,j="";L.reverse().forEach(ge=>{var Wt,Nr,Lr;m!=null&&m.call(null,ge.pad.designator)||ue.push(ge);let Se=(U--).toString();if(p!=null&&p.call(null,Se))return;let De=Qe.MIRROR_Y,tt=(Wt=ge.pin_solid)==null?void 0:Wt.outline.multiply3(De),Ze=(Nr=ge.pin_float)==null?void 0:Nr.outline.multiply3(De);W.push({pin_solid:ge.pin_solid?Object.assign({},ge.pin_solid,{outline:tt}):null,pin_float:ge.pin_float?Object.assign({},ge.pin_float,{outline:Ze}):null,pad:ge.pad?Object.assign({},ge.pad,{location:ge.pad.location.multiply3(De)}):null}),j=(Lr=ge.pad)==null?void 0:Lr.designator});let J=[].concat(z,L.reverse(),G,W);U=c,J.forEach(ge=>{let Se=ge.pin_solid&&this.addPolygon(ge.pin_solid),De=ge.pin_float&&this.addPolygon(ge.pin_float),tt=ge.pad&&this.createPad(ge.pad,!1);tt&&(!B&&ge.pad.designator===Ie&&(B=tt.buildBBox()),ge.pad.designator===j&&(Pe=tt),Se&&this.addConnectRelatedId(Se,tt.globalIndex),De&&this.addConnectRelatedId(De,tt.globalIndex),tt.num=(U++).toString(),tt.rotation=0,this.shapes.push(tt)),Se&&this.shapes.push(Se),De&&this.shapes.push(De)}),Pe&&(N=Pe.buildBBox()),L.length=0,L.push(...ue.reverse()),this.firstPinDesigner="1";let oe=this.addThermalPad(U.toString());return{firstPinBBox:B,lastPinBBox:N,outSideBBox:F,thermalPad:oe}}getQFPLinkPadSizeInfo(t){let e={JtRatio:.6,bodyChamferLen:this.unitConvert(.2,39.37),pinFloatingLen:0,holeHeightRatio:1.4,holeHeightSpacingRatio:.56};t=Object.assign({},e,t);let{pinWidth:r,pinHeight:i,pinSpacing:n,padShape:s,bodyChamferLen:a,pinFloatingLen:l,JtRatio:c,holeHeightRatio:h,holeHeightSpacingRatio:u}=t;l=Math.max(l,0);let d=s==="OVAL",p=r*c,m=Math.min(r,l+a),g=d?i/2:0,y=r+p+m+g,b=0,P=this.unitConvert(.3,39.37);return n-i>=P?b=i*1.1:n>0?b=Math.min(i*h,n*u):b=i*h,{holeWidth:y,holeHeight:b,Jt:p,Jh:m}}};kl.unit=10;var ane=class o extends kl{constructor(e,r){super(e,r);this.pinPitchExt=0;this.fixedOptions={firstPinAt:0};this.defaultOptions={polarity:!0,componentType:"D",padShape:"ELLIPSE",pinPitch:Gr(11.76,39.37),bodyLength:new So(Gr(8.5,39.37)),bodyWidth:new So(Gr(2.5,39.37)),pinDiameter:new So(Gr(.63,39.37)),footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("Axial",e),this.one=r,r)}createPads(){let e=[],{pinPitch:r,pinDiameter:i}=this.currentOptions,{LEADCUTOUTOVERLAP:n}=this.config,s=this.bbox,a=this.pinPitchExt=r-s.width(),l=a/2,c=i.max,h=i.average,u=h/2,d=new S(s.minX-l,s.center().y),p=this.createAPoint(d,u,50);e.push(p);let m=null;if(a>0){let T=l+u+n,I=h,C=d.x-u;m=this.addPolygon({lineType:"Fill Region",net:"",layer:51,outline:fe.build6(ut.extend4(new S(C+T/2,d.y),T,I))}),e.push(m)}let g=this.getStraightPassPadSize({pinDiameterMax:c}),y=this.createPad({location:d,padSizeInfo:g,layer:12,designator:"1"},!1);e.push(y),this.addConnectRelatedId(p,y.globalIndex),this.addConnectRelatedId(m,y.globalIndex);let b="",P=[];this.cloneMirrorItems(e,!0,this.shapes,T=>{T instanceof Ri?(T.num="2",b=T.globalIndex):P.push(T)}),b&&P.forEach(T=>this.addConnectRelatedId(T,b)),this.firstPinDesigner="1"}refixOptions(e,r=!0){if(this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),e.pinPitch-e.bodyLength.average<this.unitConvert(.1,39.37))throw new Error("The parameter does not conform to the rules: The pin span is at least 0.1 mm more than the body length!");return this.currentOptions}buildSilk(){this.buildSilkByPackageType(!0);let e=this.buildBodySilk();if(this.isPolarity()){let i=e.width()*.1;this.addLinesByPoints([e.UL().add1(i,0),e.LL().add1(i,0)],{layer:3})}}buildPolarity(){if(this.buildComponentPoint(this.bbox.extendSize(this.pinPitchExt*2,0)),!this.isPolarity())return;let r=!1;this.buildPositiveAndNegative(r),this.buildComponentPoint(void 0,13,r?this.firstPinPosition:this.firstPinPosition.mirrorY())}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var lne=class o extends kl{constructor(e,r){super(e,r);this.fixedOptions={padExpansion:0,polarity:!0,padShape:"ELLIPSE"};this.defaultOptions={packageName:"BGA-529_19x19x0.8P",rowsPins:23,columnsPins:23,bodyLength:new So(Gr(19,39.37)),bodyWidth:new So(Gr(19,39.37)),pinDiameter:new So(Gr(.4,39.37)),pinSpacing:Gr(.8,39.37),pinPitch:Gr(.8,39.37),customPasteMask:{expansionSize:0,corner:2},firstPinAt:1,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("BGA",e),this.one=r,r)}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=this.fixOptions(e,r),this.currentOptions}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.createFootprint()}createPads(){let{rowsPins:e,columnsPins:r,pinSpacing:i,pinPitch:n,pinDiameter:s,padExpansion:a,firstPinAt:l}=this.currentOptions,c=this.getPadRule(s.average),h=this.getCommonPadSize(c.PADDiameter,c.PADDiameter,a),u=l==1,d=S.ORIGIN,p=new _e,m=[],g="",y=0,b="IOQSXZ",P=1;for(let C=0;C<r;C++){u?(g=Pte(g,b),y=0):(g="",y+=1);for(let E=0;E<e;E++){u?y+=1:g=Pte(g,b);let O=u?d.add1(C*n,E*i):d.add1(C*n,-E*i),_=this.createPad({location:O,designator:g+y,layer:P,padSizeInfo:h,topSolderMaskEx:this.unitConvert(.15,10),bottomSolderMaskEx:this.unitConvert(.15,10)},!1),R=s.average;m.push(this.buildPinOutlineShape(fe.build2([q.buildCircle(O,R/2,le.CCW)]))),p.ext2(O),m.push(_)}}let T=p.build1().center(),I=Ae.translate(-T.x,-T.y,0);m.forEach(C=>{C.transform(I),this.shapes.push(C)}),this._firstPinPosition=null,this.firstPinDesigner="A1"}getPadRule(e){let r=39.37;e=this.unitReverse(e,r);let i=e,n=0,s=0;return e<=.2?(i=e*(1-.15),n=e*1,s=n*.1):e<=.5?(i=e*(1-.2),n=e*1,s=n*.15):e<=.75?(i=e*(1-.25),n=e*(1-.2),s=n*.2):(i=e*(1-.3),n=e*(1-.2),s=n*.3),{PADDiameter:this.unitConvert(i,r),OpeningWidth:this.unitConvert(n,r),Chamfer_Length:this.unitConvert(s,r)}}buildSilk(){this.buildBodySilk(),this.buildPoint({aligment:this.currentOptions.firstPinAt===0?"horizontal":"vertical",spacing:this.unitConvert(.4,39.37),radius:this.unitConvert(.1,39.37)}),this.buildGoldenTriangle()}getChamferLength(){let e=this.currentOptions,r=e.bodyWidth.average,i=(e.columnsPins-1)*e.pinPitch,n=e.bodyLength.average,s=(e.rowsPins-1)*e.pinSpacing;return Math.min((r-i)*.4,(n-s)*.4,this.unitConvert(1,39.37))}buildGoldenTriangle(e=this.config.DefaultStrokeWidth){let r=this.getChamferLength();if(r<=this.unitConvert(.3,39.37))return;let i=this.trackBBox,n=this.firstPinPosition;if(!n)return;let s=null,a=this.positionOnBBox(n),c=(a.vertical===yy.CENTER?this.currentOptions.firstPinAt===0?yy.TOP:yy.BOTTOM:a.vertical)===yy.TOP,h=3;s=c?i.UL():i.LL(),this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:h,outline:fe.build4([s,s.add1(r,0),s.add1(0,c?-r:r),s])}));let u=e*1.5,d=r+u;s=c?i.UL().add1(-u,u):i.LL().add1(-u,-u);let p=s.add1(d,0),m=c?s.add1(0,-d):s.add1(0,d);this.shapes.push(this.addLine({layer:h,start:s,end:p,width:e})),this.shapes.push(this.addLine({layer:h,start:s,end:m,width:e}))}buildPolarity(){if(this.buildComponentPoint(),!this.currentOptions.polarity)return;let e=this.unitConvert(.1,39.37),r=this.unitConvert(.2,39.37),i=this.firstPinPosition,n=13,s=this.positionOnBBox(i),l=(s.vertical===yy.CENTER?this.currentOptions.firstPinAt===0?yy.TOP:yy.BOTTOM:s.vertical)===yy.TOP;this.shapes.push(this.addArcByArc({layer:n,arc:q.buildCircle(i.add1(0,(l?1:-1)*this.unitConvert(.1,39.37)),e,le.CCW),width:r}));let c=this.getChamferLength();if(c<=this.unitConvert(.3,39.37))return;let h=l?this.trackBBox.UL():this.trackBBox.LL();this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:n,outline:fe.build4([h,h.add1(c,0),h.add1(0,l?-c:c),h])}))}};var cne=class o extends kl{constructor(e,r){super(e,r);this.fixedOptions={padShape:"RECT",firstPinAt:1,padExpansion:0};this.defaultOptions={polarity:!0,componentType:"D",bodyLength:new So(Gr(1,39.37)),bodyWidth:new So(Gr(.5,39.37)),pinWidth:Gr(.2,39.37),height:Gr(.5,39.37),customPasteMask:null,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("Chip",e),this.one=r,r)}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createLead(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.createFootprint()}refixOptions(e,r=!0){this.resetShape(),this.currentOptions=this.fixOptions(e,r),e=this.currentOptions;let i=e.pinWidth;if(i<this.unitConvert(.2,39.37)&&i<=e.bodyLength.average*.05)throw new Error("The parameter does not conform to the rules: The pin length is not less than 0.2 mm and not less than 0.05 of the body length!");return this.currentOptions}createLead(){var l;let e=this.bbox,r=this.currentOptions.pinWidth,i=ut.extend3(e.UL(),e.LL().add1(r,0)),n=i.transform(Qe.MIRROR_X),s=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:fe.build6(i)}),a=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:fe.build6(n)});((l=this.pads)==null?void 0:l.length)>=2&&(this.addConnectRelatedId(s,this.pads[0].globalIndex),this.addConnectRelatedId(a,this.pads[1].globalIndex)),this.shapes.push(s,a)}createPads(){let{pinWidth:e,height:r,padExpansion:i}=this.currentOptions,n=this.bbox,s=n.width(),a=n.height(),l=n.center(),c=0;e>=this.unitConvert(.3,39.37)?c=s-e*2-e*.5*2:c=s-e*2-e*.4*2;let h=0,u=0,d=0,p=this.config;d=p.FillHeight/100*r,d>p.StencilThickness*p.StencilThicknessMultiple&&(d=p.StencilThickness*p.StencilThicknessMultiple),u=d*d*.5*a/a/p.StencilThickness,e>=this.unitConvert(.3,39.37)?h=e+u+e*.5:h=e+u+e*.4;let m=a+a*.08,g=this.getCommonPadSize(h,m,i),y=new S(c/2+h/2,0),b=y.mirrorY(l),P=1,T=this.createPad({location:b,layer:P,designator:"1",padSizeInfo:g}),I=this.createPad({location:y,layer:P,designator:"2",padSizeInfo:g});this.firstPinDesigner="1",this.pads=[T,I]}buildSilk(){this.buildSilkByPackageType()}buildPolarity(){if(this.buildComponentPoint(),!this.isPolarity())return;let r=!1;this.buildPositiveAndNegative(r),this.buildComponentPoint(void 0,13,r?this.firstPinPosition:this.firstPinPosition.mirrorY())}};var hne=class o extends kl{constructor(e,r){super(e,r);this.fixedOptions={polarity:!1,padShape:"RECT",padExpansion:0};this.defaultOptions={pins:8,bodyWidth:new So(Gr(1.6,39.37)),bodyLength:new So(Gr(3.2,39.37)),pinLength:Gr(.475,39.37),pinWidth:Gr(.5,39.37),pinPitch:Gr(.8,39.37),customPasteMask:null,firstPinAt:1,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("ChipArray",e),this.one=r,r)}createPads(){let{pins:e,pinLength:r,pinWidth:i,pinPitch:n,padExpansion:s}=this.currentOptions,a=e/2,l=1,c=this.bbox,h=c.center(),u=r,d=i,p=n,m=this.unitConvert(.025,39.37),g=u*.6,y=u+g+m,b=d,P=this.getCommonPadSize(y,b,s),T=[],I=new S(c.minX+u/2,h.y+(a-1)*p/2),C=1;for(let E=0;E<a;E++){let O=I.add1(0,-E*p),_=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:fe.build6(ut.extend4(O,u,d))});T.push(_);let R=O.add1(m/2-g/2,0),v=this.createPad({location:R,padSizeInfo:P,layer:l,designator:(C++).toString()},!1);this.addConnectRelatedId(_,v.globalIndex),T.push(v)}C=e,this.cloneMirrorItems(T,!0,this.shapes,E=>{E instanceof Ri&&(E.num=(C--).toString())}),this.firstPinDesigner="1"}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildComponentPoint(),this.fixFirstPinPosition(0),this.createFootprint()}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),e.pins=Math.max(2,parseInt((((e.pins||0)+1)/2).toString())*2),this.currentOptions}buildSilk(){let e=this.config.DefaultStrokeWidth,r=e/2+this.config.DefaultTrackSpacing,i=this.getPinPosition(1),n=this.bbox,s=i.buildBBox(),a=Math.min(n.minX,s.minX),l=Math.max(n.maxY,s.maxY),h=new S(a-r,l+r).multiply3(Qe.MIRROR_Y),u=new S(s.maxX-e/2,l+r),d=ut.extend3(h,u),p=[d.UR(),d.UL(),d.LL(),d.LR()],m=p.map(y=>y.mirrorY()),g={net:"",layer:3,stroke:e};this.addLinesByPoints(p,g),this.addLinesByPoints(m,g)}};var une=class o extends kl{constructor(e,r){super(e,r);this.plusLen=0;this.plusWidth=0;this.fixedOptions={firstPinAt:0};this.defaultOptions={componentType:"C",padShape:"ELLIPSE",bodyDiameter:Gr(10,39.37),pinDiameter:new So(Gr(.65,39.37)),pinPitch:Gr(5.08,39.37),padExpansion:0,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("Cylindrical",e),this.one=r,r)}createPads(){let e=[],r=this.bbox,{pinDiameter:i,pinPitch:n,padExpansion:s}=this.currentOptions,l=(n-r.width())/2,c=i.max,u=i.average/2,d=new S(r.minX-l,r.center().y),p=this.createAPoint(d,u,50);e.push(p);let m=this.getStraightPassPadSize({pinDiameterMax:c,padExpansion:s}),g=this.createPad({location:d,padSizeInfo:m,layer:12,designator:"1"},!1);this.addConnectRelatedId(p,g.globalIndex),e.push(g),this.cloneMirrorItems(e,!0,this.shapes,y=>{y instanceof Ri&&(y.num="2")}),this.firstPinDesigner="1"}refixOptions(e,r=!0){if(this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),e.pinPitch+e.pinDiameter.average>e.bodyDiameter)throw new Error("The parameter does not conform to the rules: The sum of the pin spacing and pin diameter cannot exceed the body length!");return this.currentOptions}buildSilk(){let e=3,r=this.currentOptions.componentType,i=this.buildBodySilk(),n=r==="LED",s=this.firstPinBBox,a=s.center().mirrorY().x,l=i.width()/2;if(n){let h=this.shapes.pop();h&&h.remove();let u=(a+i.maxX)/2,d=Math.sqrt(Math.pow(l,2)-Math.pow(u,2)),p=new S(u,d),m=p.multiply3(Qe.MIRROR_Y);this.shapes.push(this.addArcByArc({layer:e,arc:q.build1(p,m,l,l,!0,le.CCW),width:this.config.DefaultStrokeWidth})),this.addLinesByPoints([p,m])}if(!this.isPolarity())return;this.plusLen=Math.min(s.width(),s.height()),this.plusWidth=this.plusLen/4,this.polarityCenter=new S((s.minX+i.minX)/2,s.center().y),this.buildPlusMinusSign(this.polarityCenter,this.plusLen,this.plusWidth,e,!0);let c=Math.sqrt(Math.pow(l,2)-Math.pow(a,2));!n&&this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:e,outline:fe.build2([q.build1(new S(a,c),new S(a,-c),l,l,!1,le.CW)])}))}buildPolarity(){this.buildComponentPoint(),this.isPolarity()&&(this.buildPlusMinusSign(this.polarityCenter,this.plusLen,this.plusWidth,13,!0),this.buildComponentPoint(void 0,13,this.firstPinPosition))}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var dne=class o extends kl{constructor(e,r){super(e,r);this.lastPinBBox=null;this.outSideBBox=null;this.fixedOptions={polarity:!0,pins:2,padShape:"RECT",firstPinAt:0};this.defaultOptions={bodyLength:new So([Gr(1.15,39.37),Gr(1.25,39.37)]),bodyWidth:new So([Gr(.75,39.37),Gr(.8,39.37)]),pinLength:Gr((.3+.4)/2,39.37),pinWidth:Gr((.23+.28)/2,39.37),pinSpacing:Gr(.75,39.37),pinPitch:Gr(.45,39.37),customPasteMask:{expansionSize:0,corner:2},footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("DFN_4",e),this.one=r,r)}createPads(){let{pins:e,pinLength:r,pinSpacing:i,pinPitch:n}=this.currentOptions,s=r,a=i,l=this.createQFPLinkPads({pinsNumberLR:e,pinsNumberTB:0,leadSpan_h:a,leadSpan_v:0,rowSpace:0,columnSpace:n||i,padSizeOptions:{pinFloatingLen:0,bodyChamferLen:this.unitConvert(.025,39.37)}});this.firstPinDesigner="1",this._firstPinBBox=l.firstPinBBox,this.lastPinBBox=l.lastPinBBox,this.outSideBBox=l.outSideBBox}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=this.fixOptions(e,r),this.currentOptions}buildSilk(){let e=this.config.DefaultStrokeWidth,r=e/2+this.config.DefaultTrackSpacing,i=this.bbox.extendSize(e),n=this.firstPinBBox,s=this.lastPinBBox,a=3,l={layer:a,stroke:e},c=0,h=0;n&&(c=i.maxY-n.maxY-r),s&&(h=s.minX-i.minX-r);let u=i.UL(),d=i.LL(),p=i.UR(),m=i.LR();if(n?s||(this.addLinesByPoints([u,p],l),this.addLinesByPoints([d,m],l)):(this.addLinesByPoints([u,d],l),this.addLinesByPoints([p,m],l)),h>2*e){let y=u,b=u.add1(h,0),P=this.addLine({layer:a,start:y,end:b,width:e});this.shapes.push(P,this.clonePolygonModel(P,fe.build4([y.multiply3(Qe.MIRROR_X),b.multiply3(Qe.MIRROR_X)])),this.clonePolygonModel(P,fe.build4([y.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),b.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y))])),this.clonePolygonModel(P,fe.build4([y.multiply3(Qe.MIRROR_Y),b.multiply3(Qe.MIRROR_Y)])))}if(c>2*e){let y=u,b=u.add1(0,-c),P=this.addLine({layer:a,start:y,end:b,width:e});this.shapes.push(P,this.clonePolygonModel(P,fe.build4([y.multiply3(Qe.MIRROR_X),b.multiply3(Qe.MIRROR_X)])),this.clonePolygonModel(P,fe.build4([y.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),b.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y))])),this.clonePolygonModel(P,fe.build4([y.multiply3(Qe.MIRROR_Y),b.multiply3(Qe.MIRROR_Y)])))}let g=this.currentOptions.pinWidth/4;this.buildPoint({aligment:"horizontal",layer:a,spacing:g*2,radius:g})}buildPolarity(){if(this.buildComponentPoint(this.outSideBBox),!this.currentOptions.polarity)return;let e=this.currentOptions.pinWidth/4;this.buildPoint({aligment:"horizontal",layer:13,spacing:e*2,radius:e})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var pne=class o extends kl{constructor(e,r){super(e,r);this.leadWidth=0;this.fixedOptions={polarity:!0,customPasteMask:null,padExpansion:0};this.defaultOptions={pins:8,padShape:"OVAL",leadSpan:Gr(7.62,39.37),bodyLength:new So([Gr(6.1,39.37),Gr(6.6,39.37)]),bodyWidth:new So([Gr(9.02,39.37),Gr(10.16,39.37)]),pinDiameter:new So([Gr(.35,39.37),Gr(.53,39.37)]),pinPitch:Gr(2.54,39.37),firstPinAt:0,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("DIP",e),this.one=r,r)}createPads(){let{pins:e,pinDiameter:r,leadSpan:i,pinPitch:n,padExpansion:s}=this.currentOptions,a=e/2,l=this.bbox,c=l.center(),h=r.max,u=h/2,d=(i-l.width())/2+h/2;this.leadWidth=d;let p=n,m=0;p>0?m=Math.min((h+this.unitConvert(.2,39.37))*2,p*.6):m=(h+this.unitConvert(.2,39.37))*2;let g=(h+this.unitConvert(.2,39.37))*2.5,y=m,b=new _e,P=[],T=new S(l.minX-d/2,c.y+(a-1)*p/2),I=this.getCommonPadSize(g,m,s),C=RSe(h,39.37)+.25;I.holeWidth=I.holeHeight=this.unitConvert(on(C,1),39.37);let E=12,O=!1,_=1,R=this.config.LEADCUTOUTOVERLAP;for(let v=0;v<a;v++){let D=T.add1(0,-v*p);O=v==0||v==a-1;let w=O?y/2-u:0,F=d>0&&this.addPolygon({lineType:"Fill Region",net:"",layer:51,outline:fe.build6(ut.extend4(D.add1(0,-w/2+R),d+R,y-w))});F&&P.push(F);let H=D.add1(u-d/2,0),z=this.createAPoint(H,u,50);P.push(z);let G=this.createPad({location:H,padSizeInfo:I,layer:E,designator:(_++).toString()},!1);this.addConnectRelatedId(F,G.globalIndex),this.addConnectRelatedId(z,G.globalIndex),P.push(G),b.ext2(D)}_=e,this.cloneMirrorItems(P,!0,this.shapes,v=>{v instanceof Ri&&(v.num=(_--).toString())}),this.firstPinDesigner="1"}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),e.pins=Math.max(2,parseInt((((e.pins||0)+1)/2).toString())*2),this.currentOptions}buildSilk(){let e=this.bbox,r=this.config.DefaultStrokeWidth,i=r/2+this.config.DefaultTrackSpacing,n=e.maxY+r/2,s=-n,l=this.getPinPosition(1).buildBBox(),c=Math.max(e.minX,l.maxX)+i,h=-c,u=ut.extend3(new S(c,s),new S(h,n)),d=3,p=e.width()*.125,m={net:"",layer:d,stroke:r},y=u.center().add1(-p,u.height()/2),b=y.mirrorY();this.addLinesByPoints([y,u.UL(),u.LL(),u.LR(),u.UR(),b],m),this.shapes.push(this.addArcByArc({layer:d,arc:q.build1(y,b,p,p,!1,le.CCW),width:r,locked:!1})),this.buildPoint({aligment:"auto",layer:d,spacing:this.unitConvert(.3,39.37)+this.config.DefaultTrackSpacing,radius:this.unitConvert(.15,39.37)})}buildPolarity(){this.buildComponentPoint(this.bbox.extendSize(this.leadWidth*2,0)),this.currentOptions.polarity&&this.buildPoint({aligment:"auto",layer:13,spacing:this.unitConvert(.3,39.37)+this.config.DefaultTrackSpacing,radius:this.unitConvert(.15,39.37)})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var fne=class o extends kl{constructor(e,r){super(e,r);this.bodyLChamfer=0;this.padSizeInfo=null;this.fixedOptions={padShape:"RECT",polarity:!0,firstPinAt:0,padExpansion:0};this.defaultOptions={bodyLength:new So([Gr(10.1,39.37),Gr(10.5,39.37)]),bodyWidth:new So([Gr(10.1,39.37),Gr(10.5,39.37)]),leadSpan:Gr(11,39.37),pinLength:Gr(3.15,39.37),pinWidth:Gr(1,39.37),customPasteMask:{expansionSize:0,corner:2},footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("E_Cap",e),this.one=r,r)}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.createFootprint()}refixOptions(e,r=!0){this.resetShape(),this.currentOptions=e=this.fixOptions(e,r);let i=e.pinLength,n=e.bodyLength.average;if(i<this.unitConvert(.2,39.37)&&i<=n*.05)throw new Error("The parameter does not conform to the rules: The pin length is not less than 0.2 mm and not less than 0.05 of the body length!");return this.currentOptions}createBody(){let e=this.currentOptions,r=e.bodyLength.average,i=e.bodyWidth.average,n=ut.extend4(S.ORIGIN,r,i),s=i*.2;this.bodyLChamfer=s;let a=n.UL(),l=n.LL(),c=fe.build4([a.add1(s,0),n.UR(),n.LR(),l.add1(s,0),l.add1(0,s),a.add1(0,-s)]).asClose(),h=this.addPolygon({lineType:"Fill Region",net:"",layer:48,outline:c});return this.shapes.push(h),this.updateBBox(n),n}createPads(){let{pinLength:e,pinWidth:r,leadSpan:i,padExpansion:n}=this.currentOptions,s=this.bbox,a=e,l=r,c=s.minX-(i-s.width())/2,h=new S(c,s.center().y),u=ut.extend4(h,a,l),d=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:fe.build6(u)});this.shapes.push(d);let p=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:fe.build6(u.transform(Qe.MIRROR_X))});this.shapes.push(p);let m=this.unitConvert(.3,39.37),g=m*2,y=m*.2,b=l*.4,P=a+g+y,T=l+b,I=c-g,C=new S(I,h.y),E=this.getCommonPadSize(P,T,n);this.padSizeInfo=E;let O=1,_=this.createPad({location:C,designator:"1",layer:O,padSizeInfo:E}),R=this.createPad({location:C.mirrorY(),designator:"2",layer:O,padSizeInfo:E});this.addConnectRelatedId(d,_.globalIndex),this.addConnectRelatedId(p,R.globalIndex),this.firstPinDesigner="1"}buildSilk(){let e=this.bbox,i=e.height()/5,n=i*.6,s=n/4,a=e.minX+s,l=new S(a+n/2,e.center().y).add1(0,-(i+s)),c=3,h=ut.extend4(l,n,s);this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:c,outline:fe.build6(h)})),this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:c,outline:fe.build6(h.transform(Qe.MIRROR_X))})),this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:c,outline:fe.build6(ut.extend4(l,s,i))}));let u=this.config.DefaultStrokeWidth,d=e.extendSize(u),p=u/2+this.config.DefaultTrackSpacing,m=this.bodyLChamfer+u/2,g=this.padSizeInfo,y=d.UL(),b=new S(d.minX,d.center().y+g.padHeight/2+p),P=[b,y.add1(0,-m),y.add1(m,0),d.UR(),b.mirrorY()],T={net:"",layer:c,stroke:u};this.addLinesByPoints(P,T),this.addLinesByPoints(P.map(I=>I.multiply3(Qe.MIRROR_Y)),T),this.trackBBox=d}buildPolarity(){if(this.buildComponentPoint(this.trackBBox),!this.currentOptions.polarity)return;let e=this.bbox,i=e.height()/5,n=i*.6,s=n/4,a=e.minX+s,l=new S(a+n/2,e.center().y),c=13,h=ut.extend4(l,n,s);this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:c,outline:fe.build6(h)})),this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:c,outline:fe.build6(h.transform(Qe.MIRROR_X))})),this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:c,outline:fe.build6(ut.extend4(l,s,i))})),this.buildComponentPoint(this.trackBBox,c)}};var mne=class o extends kl{constructor(e,r){super(e,r);this.columnsX=[];this.fixedOptions={firstPinAt:0,polarity:!0};this.defaultOptions={rowsPins:2,columnsPins:4,padShape:"ELLIPSE",bodyLength:new So(Gr(10.16,39.37)),bodyWidth:new So(Gr(2.54,39.37)),pinDiameter:new So(Gr(.64,39.37)),pinPitch:Gr(2.54,39.37),pinWidth1:Gr(1.52,39.37),pinSpacing:Gr(2.54,39.37),pinLength:Gr(1.52,39.37),footprintOrigin:1}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("HEADER_H",e),this.one=r,r)}createPads(){this.columnsX.length=0;let e=this.bbox,{rowsPins:r,columnsPins:i,pinPitch:n,pinSpacing:s,pinWidth1:a,pinDiameter:l}=this.currentOptions,c=l.max,u=l.average/2,d=this.getStraightPassPadSize({pinDiameterMax:c}),p=new S(-(i-1)*s/2,e.maxY+a),m=1,g=this.config.LEADCUTOUTOVERLAP;for(let y=0;y<i;y++)for(let b=0;b<r;b++){let P=p.add1(y*s,b*n);b===0&&(this.columnsX.push(P.x),this.outsideBBox=ut.extend1(e,P.add1(-u,u)));let T=this.createAPoint(P,u,50);this.shapes.push(T);let I=fe.build6(ut.extend3(P.add1(-u,u),new S(P.x+u,e.maxY-g))),C=this.addPolygon({lineType:"Fill Region",net:"",layer:51,outline:I});this.shapes.push(C);let E=this.createPad({location:P,padSizeInfo:d,layer:12,designator:(m++).toString()});this.addConnectRelatedId(T,E.globalIndex),this.addConnectRelatedId(C,E.globalIndex)}this.firstPinDesigner="1"}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),this.currentOptions}buildSilk(){this.buildBodySilk();let e=this.config.DefaultStrokeWidth,r=3,i=this.currentOptions.pinLength,n=this.bbox.minY-e;this.columnsX.forEach(a=>{let l=new S(a,n);this.shapes.push(this.addLine({layer:r,start:l,end:l.add1(0,-i),width:e}))});let s=this.currentOptions.pinDiameter.average/4;this.buildPoint({aligment:"horizontal",layer:r,spacing:s*2,radius:s})}buildPolarity(){if(this.buildComponentPoint(this.outsideBBox),!this.currentOptions.polarity)return;let e=this.currentOptions.pinDiameter.average/4;this.buildPoint({aligment:"horizontal",layer:13,spacing:e*2,radius:e})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var gne=class o extends kl{constructor(e,r){super(e,r);this.fixedOptions={firstPinAt:0,polarity:!0};this.defaultOptions={rowsPins:2,columnsPins:4,padShape:"ELLIPSE",bodyLength:new So(Gr(10.16,39.37)),bodyWidth:new So(Gr(5.08,39.37)),pinDiameter:new So(Gr(.64,39.37)),pinSpacing:Gr(2.54,39.37),pinPitch:Gr(2.54,39.37),footprintOrigin:1}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("HEADER_V",e),this.one=r,r)}createPads(){let{rowsPins:e,columnsPins:r,pinPitch:i,pinSpacing:n,pinDiameter:s}=this.currentOptions,a=s.max,c=s.average/2,h=this.getStraightPassPadSize({pinDiameterMax:a}),u=S.ORIGIN.add1(-(r-1)*i/2,-((e-1)*n)/2),d=1;for(let p=0;p<r;p++)for(let m=0;m<e;m++){let g=u.add1(p*i,m*n),y=this.createAPoint(g,c,50);this.shapes.push(y);let b=this.createPad({location:g,padSizeInfo:h,layer:12,designator:(d++).toString()},!1);this.addConnectRelatedId(y,b.globalIndex),this.shapes.push(b)}this.firstPinDesigner="1"}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),this.currentOptions}buildSilk(){let e=3;this.buildBodySilk();let r=this.currentOptions.pinDiameter.average/4;this.buildPoint({aligment:"horizontal",layer:e,spacing:r*2,radius:r})}buildPolarity(){if(this.buildComponentPoint(),!this.currentOptions.polarity)return;let e=this.currentOptions.pinDiameter.average/4;this.buildPoint({aligment:"horizontal",layer:13,spacing:e*2,radius:e})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var yne=class o extends kl{constructor(e,r){super(e,r);this.lastPinBBox=null;this.outSideBBox=null;this.fixedOptions={polarity:!0};this.defaultOptions={rowsPins:6,columnsPins:6,padShape:"OVAL",bodyLength:new So([Gr(2.9,39.37),Gr(3.1,39.37)]),bodyWidth:new So([Gr(2.9,39.37),Gr(3.1,39.37)]),pinLength:Gr(.3,39.37),pinWidth:Gr(.2,39.37),pinPitch:Gr(.4,39.37),thermalPad:{thermalPadWidth:Gr(1.8,39.37),thermalPadHeight:Gr(1.8,39.37),hasThermalVias:!0},customPasteMask:{expansionSize:0,corner:2},firstPinAt:0,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("QFN",e),this.one=r,r)}createPads(){let{rowsPins:e,columnsPins:r,pinPitch:i}=this.currentOptions,n=this.createQFPLinkPads({pinsNumberLR:e,pinsNumberTB:r,leadSpan_h:this.bbox.width(),leadSpan_v:this.bbox.height(),rowSpace:i,columnSpace:i,padSizeOptions:{pinFloatingLen:0,bodyChamferLen:this.unitConvert(.025,39.37)}});this._firstPinBBox=n.firstPinBBox,this.lastPinBBox=n.lastPinBBox,this.outSideBBox=n.outSideBBox,this.createThermalPadAndSolidPin(n.thermalPad)}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=Math.min(r.width(),r.height())*.1,n=r.UL(),s=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:fe.build4([n.add1(i,0),r.UR(),r.LR(),r.LL(),n.add1(0,-i)])});s&&(this.shapes.push(s),this.addConnectRelatedId(s,e.globalIndex))}buildSilk(){let e=this.config.DefaultStrokeWidth,r=e/2+this.config.DefaultTrackSpacing,i=this.bbox.extendSize(e),n=this.firstPinBBox,s=this.lastPinBBox,a=3,l={layer:a,stroke:e},c=0,h=0;n&&(c=i.maxY-n.maxY-r),s&&(h=s.minX-i.minX-r);let u=i.UL(),d=i.LL(),p=i.UR(),m=i.LR();if(n?s||(this.addLinesByPoints([u,p],l),this.addLinesByPoints([d,m],l)):(this.addLinesByPoints([u,d],l),this.addLinesByPoints([p,m],l)),h>2*e){let y=u,b=u.add1(h,0),P=this.addLine({layer:a,start:y,end:b,width:e});this.shapes.push(P,this.clonePolygonModel(P,fe.build4([y.multiply3(Qe.MIRROR_X),b.multiply3(Qe.MIRROR_X)])),this.clonePolygonModel(P,fe.build4([y.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),b.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y))])),this.clonePolygonModel(P,fe.build4([y.multiply3(Qe.MIRROR_Y),b.multiply3(Qe.MIRROR_Y)])))}if(c>2*e){let y=u,b=u.add1(0,-c),P=this.addLine({layer:a,start:y,end:b,width:e});this.shapes.push(P,this.clonePolygonModel(P,fe.build4([y.multiply3(Qe.MIRROR_X),b.multiply3(Qe.MIRROR_X)])),this.clonePolygonModel(P,fe.build4([y.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),b.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y))])),this.clonePolygonModel(P,fe.build4([y.multiply3(Qe.MIRROR_Y),b.multiply3(Qe.MIRROR_Y)])))}let g=this.currentOptions.pinWidth/4;this.buildPoint({aligment:this.currentOptions.rowsPins?"horizontal":"vertical",layer:a,spacing:g*2,radius:g})}buildPolarity(){if(this.buildComponentPoint(this.outSideBBox),!this.currentOptions.polarity)return;let e=this.currentOptions.pinWidth/4;this.buildPoint({aligment:this.currentOptions.rowsPins?"horizontal":"vertical",layer:13,spacing:e*2,radius:e})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(e.rowsPins?0:1),this.createFootprint()}};var bne=class o extends kl{constructor(e,r){super(e,r);this.lastPinBBox=null;this.outSideBBox=null;this.fixedOptions={polarity:!0};this.defaultOptions={rowsPins:44,columnsPins:44,padShape:"OVAL",leadSpan:Gr(22,39.37),leadSpan2:Gr(22,39.37),bodyLength:new So([Gr(20,39.37),Gr(20,39.37)]),bodyWidth:new So([Gr(20,39.37),Gr(20,39.37)]),pinLength:Gr(.6,39.37),pinWidth:Gr(.16,39.37),pinPitch:Gr(.4,39.37),thermalPad:{thermalPadWidth:Gr(7.5,39.37),thermalPadHeight:Gr(6.74,39.37),hasThermalVias:!0},customPasteMask:{expansionSize:0,corner:2},firstPinAt:1,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("QFP",e),this.one=r,r)}createPads(){let{rowsPins:e,columnsPins:r,leadSpan:i,leadSpan2:n,pinPitch:s}=this.currentOptions,a=this.createQFPLinkPads({pinsNumberLR:e,pinsNumberTB:r,leadSpan_h:i,leadSpan_v:n,rowSpace:s,columnSpace:s});this._firstPinBBox=a.firstPinBBox,this.lastPinBBox=a.lastPinBBox,this.outSideBBox=a.outSideBBox,this.createThermalPadAndSolidPin(a.thermalPad)}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=r.UL();this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:fe.build4([i,r.UR(),r.LR(),r.LL(),i])}))}buildSilk(){let e=this.config.DefaultStrokeWidth,r=e/2+this.config.DefaultTrackSpacing,i=this.bbox.extendSize(e),n=this.firstPinBBox,s=this.lastPinBBox,a=3,l={net:"",layer:a,stroke:e},c=0,h=0;n&&(c=i.maxY-n.maxY-r),s&&(h=s.minX-i.minX-r);let u=i.UL(),d=i.LL(),p=i.UR(),m=i.LR();if(n?s||(this.addLinesByPoints([u,p],l),this.addLinesByPoints([d,m],l)):(this.addLinesByPoints([u,d],l),this.addLinesByPoints([p,m],l)),h>2*e){let C=u,E=u.add1(h,0),O=this.addLine({layer:a,start:C,end:E,width:e});this.shapes.push(O,this.clonePolygonModel(O,fe.build4([C.multiply3(Qe.MIRROR_X),E.multiply3(Qe.MIRROR_X)])),this.clonePolygonModel(O,fe.build4([C.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),E.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y))])),this.clonePolygonModel(O,fe.build4([C.multiply3(Qe.MIRROR_Y),E.multiply3(Qe.MIRROR_Y)])))}if(c>2*e){let C=u,E=u.add1(0,-c),O=this.addLine({layer:a,start:C,end:E,width:e});this.shapes.push(O,this.clonePolygonModel(O,fe.build4([C.multiply3(Qe.MIRROR_X),E.multiply3(Qe.MIRROR_X)])),this.clonePolygonModel(O,fe.build4([C.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),E.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y))])),this.clonePolygonModel(O,fe.build4([C.multiply3(Qe.MIRROR_Y),E.multiply3(Qe.MIRROR_Y)])))}let g=this.bbox,y=0;n&&(y=Math.max(y,n.maxX-g.minX)),s&&(y=Math.max(y,g.maxY-s.minY));let b=-(2*e+y)*2,P=Math.abs(b)<g.width()&&Math.abs(b)<g.height(),T=null;if(P){T=g.extendSize(b),this.addLinesByPoints([T.UL(),T.UR(),T.LR(),T.LL(),T.UL()],l);let C=this.currentOptions.pinLength/4,E=e+C;this.shapes.push(this.createAPoint(T.UL().add1(E,-E),C,a))}let I=this.currentOptions.pinWidth/4;this.buildPoint({aligment:this.currentOptions.rowsPins?"horizontal":"vertical",layer:a,spacing:I*2,radius:I})}buildPolarity(){if(this.buildComponentPoint(this.outSideBBox),!this.currentOptions.polarity)return;let e=this.currentOptions.pinWidth/4;this.buildPoint({aligment:this.currentOptions.rowsPins?"horizontal":"vertical",layer:13,spacing:e*2,radius:e})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(e.rowsPins?0:1),this.createFootprint()}};var Pne=class o extends kl{constructor(e,r){super(e,r);this.outSideBBox=null;this.fixedOptions={pins:2,polarity:!0,pinSpacing:0,firstPinAt:0,thermalPad:null};this.defaultOptions={padShape:"RECT",leadSpan:Gr(3.75,39.37),bodyLength:new So([Gr(2.5,39.37),Gr(2.8,39.37)]),bodyWidth:new So([Gr(1.5,39.37),Gr(1.8,39.37)]),pinLength:Gr(.35,39.37),pinWidth:Gr(.6,39.37),customPasteMask:{expansionSize:0,corner:2},footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("SOD",e),this.one=r,r)}createPads(){let{pins:e,leadSpan:r,pinSpacing:i}=this.currentOptions,n=e/2,s=this.createQFPLinkPads({pinsNumberLR:n,pinsNumberTB:0,leadSpan_h:r,leadSpan_v:r,rowSpace:i,columnSpace:i});this._firstPinBBox=s.firstPinBBox,this.outSideBBox=s.outSideBBox,this.createThermalPadAndSolidPin(s.thermalPad)}refixOptions(e,r=!0){this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),e.pins=Math.max(2,parseInt((((e.pins||0)+1)/2).toString())*2);let i=(e.leadSpan-e.bodyLength.average)/2-e.pinLength,n=e.pinLength;if(i/n>2&&n<this.unitConvert(.5,39.37))throw new Error("The parameter does not conform to the rules: The length of the dangling pin cannot exceed 2 times the length of the pin, and the pin length cannot be less than 0.5 mm!");return this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=r.UL(),n=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:fe.build4([i,r.UR(),r.LR(),r.LL(),i])});this.shapes.push(n),this.addConnectRelatedId(n,e.globalIndex)}buildSilk(){let e=this.config.DefaultStrokeWidth,r=e/2+this.config.DefaultTrackSpacing,i=this.bbox.extendSize(e),n=this.firstPinBBox,s=3,a={net:"",layer:s,stroke:e},l=0;n&&(l=i.maxY-n.maxY-r);let c=i.UL(),h=i.LL(),u=i.UR(),d=i.LR();if(this.addLinesByPoints([c,u],a),this.addLinesByPoints([h,d],a),l>e){let g=c,y=c.add1(0,-l),b=this.addLine({layer:s,start:g,end:y,width:e}),P=this.addLine({layer:s,start:g.multiply3(Qe.MIRROR_Y),end:y.multiply3(Qe.MIRROR_Y),width:e});this.shapes.push(b,P);let T=2*e,I=l+e,C=fe.build6(ut.extend4(u.add1(-e/2+T/2,e/2-I/2),T,I));this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:s,outline:C}),this.addPolygon({lineType:"Fill Region",net:"",layer:s,outline:C.multiply3(Qe.MIRROR_Y)}))}let p=Math.max(n.maxX-this.bbox.minX,0)+r+e/2,m=new S(this.bbox.maxX-p,i.maxY);this.addLinesByPoints([m,m.multiply3(Qe.MIRROR_Y)],a)}buildPolarity(){this.buildComponentPoint(this.outSideBBox),this.currentOptions.polarity&&(this.buildPositiveAndNegative(!0),this.buildComponentPoint(this.outSideBBox,13))}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.createFootprint()}};var Tne=class o extends kl{constructor(e,r){super(e,r);this.outSideBBox=null;this.fixedOptions={polarity:!0};this.defaultOptions={pins:10,padShape:"OVAL",leadSpan:Gr(6,39.37),bodyWidth:new So([Gr(3.9,39.37),Gr(3.9,39.37)]),bodyLength:new So([Gr(4.9,39.37),Gr(4.9,39.37)]),pinLength:Gr(.835,39.37),pinWidth:Gr(.375,39.37),pinPitch:Gr(1,39.37),thermalPad:null,customPasteMask:{expansionSize:0,corner:2},firstPinAt:1,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("SOIC_SOP",e),this.one=r,r)}createPads(){let{pins:e,leadSpan:r,pinPitch:i}=this.currentOptions,n=e/2,s=r,a=this.createQFPLinkPads({pinsNumberLR:n,pinsNumberTB:0,leadSpan_h:s,leadSpan_v:s,rowSpace:i,columnSpace:i});this._firstPinBBox=a.firstPinBBox,this.outSideBBox=a.outSideBBox,this.createThermalPadAndSolidPin(a.thermalPad)}refixOptions(e,r=!0){this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),e.pins=Math.max(2,parseInt((((e.pins||0)+1)/2).toString())*2);let i=(e.leadSpan-e.bodyWidth.average)/2-e.pinLength,n=e.pinLength;if(i/n>2&&n<this.unitConvert(.5,39.37))throw new Error("The parameter does not conform to the rules: The length of the dangling pin cannot exceed 2 times the length of the pin, and the pin length cannot be less than 0.5 mm!");return this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=r.UL(),n=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:fe.build4([i,r.UR(),r.LR(),r.LL(),i])});this.shapes.push(n),this.addConnectRelatedId(n,e.globalIndex)}buildSilk(){let e=this.config.DefaultStrokeWidth,r=this.firstPinBBox,i=3,n={net:"",layer:i,stroke:e},s=this.bbox,a=0;r&&(a=Math.max(a,r.maxX-s.minX));let l=-(2*e+a)*2,c=Math.abs(l)<s.width()&&Math.abs(l)<s.height(),h=null;if(c=!0,c){h=s.extendSize(l,e),this.addLinesByPoints([h.UL(),h.UR(),h.LR(),h.LL(),h.UL()],n);let d=this.currentOptions.pinLength/4,p=e+d;this.shapes.push(this.createAPoint(h.UL().add1(p,-p),d,i))}let u=this.currentOptions.pinLength/4;this.buildPoint({aligment:"vertical",layer:i,spacing:u*2,radius:u})}buildPolarity(){if(this.buildComponentPoint(this.outSideBBox),!this.currentOptions.polarity)return;let e=this.currentOptions.pinLength/4;this.buildPoint({aligment:"horizontal",layer:13,spacing:this.currentOptions.pinWidth/2,radius:e})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var Ine=class o extends kl{constructor(e,r){super(e,r);this.outSideBBox=null;this.fixedOptions={polarity:!1,padShape:"RECT",firstPinAt:0};this.defaultOptions={pins:4,leadSpan:Gr(7,39.37),bodyWidth:new So([Gr(3.3,39.37),Gr(3.7,39.37)]),bodyLength:new So([Gr(6.3,39.37),Gr(6.7,39.37)]),pinLength:Gr(.9,39.37),pinWidth:Gr(.7,39.37),pinPitch:Gr(2.3,39.37),pinWidth1:Gr(3,39.37),customPasteMask:{expansionSize:0,corner:2},footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("SOT223",e),this.one=r,r)}createPads(){let{pins:e,leadSpan:r,pinPitch:i,pinWidth:n,pinWidth1:s}=this.currentOptions,l=e-1,c=this.createQFPLinkPads({pinsNumberLR:l,pinsNumberTB:0,leadSpan_h:r,leadSpan_v:r,rowSpace:i,columnSpace:i,filterFun_right:()=>!0});this._firstPinBBox=c.firstPinBBox;let h=n;this.currentOptions.pinWidth=s;let u=this.createQFPLinkPads({pinsNumberLR:1,pinsNumberTB:0,leadSpan_h:r,leadSpan_v:r,rowSpace:i,columnSpace:i,startDesignator:l+1,padSizeOptions:{holeHeightRatio:1.2},filterFun_left:()=>!0});this.currentOptions.pinHeight=h,this.firstPinDesigner="1",this.outSideBBox=ut.extend2(c.outSideBBox,u.outSideBBox)}refixOptions(e,r=!0){this.resetShape(),this.currentOptions=e=this.fixOptions(e,r);let i=(e.leadSpan-e.bodyWidth.average)/2-e.pinLength,n=e.pinLength;if(i/n>2)throw new Error("The parameter does not conform to the rules: The length of the dangling pin cannot exceed 2 times the length of the pin!");return this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=r.UL(),n=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:fe.build4([i,r.UR(),r.LR(),r.LL(),i])});this.shapes.push(n),this.addConnectRelatedId(n,e.globalIndex)}buildSilk(){let e=this.config.DefaultStrokeWidth,r=this.firstPinBBox,n={net:"",layer:3,stroke:e},s=this.bbox,a=0;r&&(a=Math.max(a,r.maxX-s.minX));let l=-(2*e+a)*2,c=Math.abs(l)<s.width()&&Math.abs(l)<s.height(),h=null;c&&(h=s.extendSize(l,e),this.addLinesByPoints([h.UL(),h.UR(),h.LR(),h.LL(),h.UL()],n))}buildPolarity(){this.buildComponentPoint(this.outSideBBox)}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var Cne=class o extends kl{constructor(e,r){super(e,r);this.outSideBBox=null;this.fixedOptions={polarity:!0,padShape:"RECT"};this.defaultOptions={pins:6,leadSpan:Gr(2.3,39.37),bodyWidth:new So([Gr(1.2,39.37),Gr(1.4,39.37)]),bodyLength:new So([Gr(2.8,39.37),Gr(3,39.37)]),pinLength:Gr(.3,39.37),pinWidth:Gr(.43,39.37),pinPitch:Gr(.95,39.37),customPasteMask:{expansionSize:0,corner:2},firstPinAt:0,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("SOT23",e),this.one=r,r)}createPads(){let{pins:e,leadSpan:r,pinPitch:i}=this.currentOptions,n=null,s=null;switch(e){case 3:n=l=>l==="2",s=l=>["4","6"].includes(l);break;case 5:s=l=>l==="5";break;case 6:default:break}let a=this.createQFPLinkPads({pinsNumberLR:3,pinsNumberTB:0,leadSpan_h:r,leadSpan_v:r,rowSpace:i,columnSpace:i,filterFun_left:n,filterFun_right:s});this._firstPinBBox=a.firstPinBBox,this.outSideBBox=a.outSideBBox}refixOptions(e,r=!0){if(this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),![3,5,6].includes(e.pins))throw new Error("The parameter does not conform to the rules: The number of pins can only be 3, 5 or 6!");let n=(e.leadSpan-e.bodyWidth.average)/2-e.pinLength,s=e.pinLength;if(n/s>2)throw new Error("The parameter does not conform to the rules: The length of the dangling pin cannot exceed 2 times the length of the pin!");return this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=r.UL(),n=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:fe.build4([i,r.UR(),r.LR(),r.LL(),i])});this.shapes.push(n),this.addConnectRelatedId(n,e.globalIndex)}buildSilk(){let e=3,r=this.config.DefaultStrokeWidth,i=r/2+this.config.DefaultTrackSpacing,n=this.bbox.extendSize(r),s=this.firstPinBBox,a=n.UL(),l=n.LL(),c=n.UR(),h=n.LR(),u={net:"",layer:e,stroke:r};this.addLinesByPoints([a,c],u),this.addLinesByPoints([l,h],u);let d=0;s&&(d=n.maxY-s.maxY-i);let p=null;if(d>2*r){let y=a,b=a.add1(0,-d);p=this.addLine({layer:e,start:y,end:b,width:r});let P=this.addLine({layer:e,start:y.multiply3(Qe.MIRROR_Y),end:b.multiply3(Qe.MIRROR_Y),width:r});this.shapes.push(p,P)}let m=this.currentOptions.pins;if(p||m===3){let y=null;m===3?y=this.addLine({layer:e,start:c,end:c.add1(0,-(d+this.currentOptions.pinPitch)),width:r}):y=this.addLine({layer:e,start:p.start.multiply3(Qe.MIRROR_X),end:p.end.multiply3(Qe.MIRROR_X),width:r});let b=this.addLine({layer:e,start:y.start.multiply3(Qe.MIRROR_Y),end:y.end.multiply3(Qe.MIRROR_Y),width:r});this.shapes.push(y,b)}let g=(s.minY-i)*2;if(g>2*r){let y=n.center().add1(-n.width()/2,g/2);m===3?this.shapes.push(this.addLine({layer:e,start:y,end:y.multiply3(Qe.MIRROR_Y),width:r})):m==5&&this.shapes.push(this.addLine({layer:e,start:y.multiply3(Qe.MIRROR_X),end:y.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),width:r}))}this.buildPoint({aligment:"auto",layer:e,spacing:this.config.DefaultTrackSpacing,radius:this.unitConvert(.15,39.37)})}buildPolarity(){this.buildComponentPoint(this.outSideBBox),this.currentOptions.polarity&&this.buildPoint({aligment:"auto",layer:13,spacing:this.config.DefaultTrackSpacing,radius:this.unitConvert(.15,39.37)})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var Sne=class o extends kl{constructor(e,r){super(e,r);this.outSideBBox=null;this.fixedOptions={polarity:!1,padShape:"RECT",firstPinAt:0,padExpansion:0};this.defaultOptions={pins:4,leadSpan:Gr((9.4+10.41)/2,39.37),bodyWidth:new So([Gr(5.97,39.37),Gr(6.22,39.37)]),bodyLength:new So([Gr(6.35,39.37),Gr(6.73,39.37)]),pinLength:Gr(1.59,39.37),pinWidth:Gr(.82,39.37),pinPitch:Gr(2.28,39.37),pinLength1:Gr((4.59+5.46)/2,39.37),pinWidth1:Gr((5.21+5.5)/2,39.37),leadTabOverhang:Gr((.89+1.27)/2,39.37),leadThickness:Gr((.46+.61)/2,39.37),customPasteMask:{expansionSize:0,corner:2},footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("TO_DPAK",e),this.one=r,r)}createPads(){let{FillHeight:e,StencilThickness:r,StencilThicknessMultiple:i}=this.config,{pins:n,leadThickness:s=0,leadTabOverhang:a,leadSpan:l,pinLength:c,pinLength1:h,pinWidth1:u,pinPitch:d,padShape:p,padExpansion:m}=this.currentOptions,y=n-1,b=this.bbox.width(),P=l-b-a;l=b+P*2;let T=Math.min(e/100*s,r*i),I=c*.2,C=T*T*.5/r,E=this.createQFPLinkPads({pinsNumberLR:y,pinsNumberTB:0,leadSpan_h:l,leadSpan_v:l,rowSpace:d,columnSpace:d,filterFun_right:()=>!0,padSizeOptions:{holeHeightRatio:1.4,pinFloatingLen:0,bodyChamferLen:I,JtRatio:C/c,holeHeightSpacingRatio:1/0}});this._firstPinBBox=E.firstPinBBox,this.outSideBBox=E.outSideBBox;let O=h,_=u,R=this.bbox,v=new S(R.maxX,R.center().y).add1(a-O/2,0),D=ut.extend4(v,O,_),w=O*.1,F=D.UR(),H=D.LR(),z=fe.build4([D.UL(),F.add1(-w,0),F.add1(0,-w),H.add1(0,w),H.add1(-w,0),D.LL(),D.UL()]),G=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:z});this.shapes.push(G);let W=s<=0?0:C,L=this.getQFPLinkPadSizeInfo({pinWidth:O,pinHeight:_,pinSpacing:d,padShape:p,holeHeightRatio:1.04,pinFloatingLen:0,bodyChamferLen:0,JtRatio:W/O,holeHeightSpacingRatio:1/0}),B=this.createPad({location:v.add1(-L.Jh/2+L.Jt/2,0),designator:(y+1).toString(),layer:1,padSizeInfo:this.getCommonPadSize(L.holeWidth,L.holeHeight,m)});this.addConnectRelatedId(G,B.globalIndex),this.firstPinDesigner="1"}refixOptions(e,r=!0){this.resetShape(),this.currentOptions=e=this.fixOptions(e,r);let i=(e.leadSpan-e.bodyWidth.average)/2-e.pinLength,n=e.pinLength;if(i/n>2)throw new Error("The parameter does not conform to the rules: The length of the dangling pin cannot exceed 2 times the length of the pin!");return this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=r.UL(),n=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:fe.build4([i,r.UR(),r.LR(),r.LL(),i])});this.shapes.push(n),this.addConnectRelatedId(n,e.globalIndex)}buildSilk(){this.buildBodySilk(this.bbox,this.config.DefaultStrokeWidth,["R"])}buildPolarity(){this.buildComponentPoint(this.outSideBBox)}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var Ene=class{hasPad(t){for(let e of t)if(e instanceof Le)return!0;return!1}onlyConnectTrack(t){if(t.length==0)return!1;for(let e of t)if(!(e instanceof Ue))return!1;return!0}};var SGe=Math.cos(Math.PI/180*89),$3t=Math.cos(Math.PI/180*91),Nu=class extends Ene{constructor(e){super();this._startNodes=new Array;this._endNodes=new Array;this.track=e;let r=this.track.searchCycleNode();for(let i of r)if(i instanceof Ue){let n=this.track.start.distance2(i.start),s=this.track.start.distance2(i.end),a=this.track.end.distance2(i.start),l=this.track.end.distance2(i.end),c=Math.min(n,s),h=Math.min(a,l);c<h?this._startNodes.push(i):this._endNodes.push(i)}else{let n=this.track.start.distance2(i.center),s=this.track.end.distance2(i.center);n<s?this._startNodes.push(i):this._endNodes.push(i)}if(this._startType=this.getType(this._startNodes),this._endType=this.getType(this._endNodes),this.track instanceof Ar){let i=this.track.direct;if(this._startType===6){let s=this._startNodes[0].direct.mul(-1);this._startAngleType=this.getAngleType(i,s)}if(this._startType===5){let s=this._startNodes[0].direct;this._startAngleType=this.getAngleType(i,s)}if(this._endType===6){let s=this._endNodes[0].direct;this._endAngleType=this.getAngleType(i.mul(-1),s.mul(-1))}if(this._endType===5){let s=this._endNodes[0].direct;this._endAngleType=this.getAngleType(i.mul(-1),s)}}else this._startAngleType=3,this._endAngleType=3}get startType(){return this._startType}get endType(){return this._endType}get startNodes(){return this._startNodes}get endNodes(){return this._endNodes}get startAngleType(){return this._startAngleType}get endAngleType(){return this._endAngleType}getType(e){if(e.length==1){let r=e[0];if(r instanceof Ar){if(r.width!=this.track.width)return 11;let i=r.start.distance2(this.track.start),n=r.start.distance2(this.track.end),s=r.end.distance2(this.track.start),a=r.end.distance2(this.track.end),l=Math.min(i,n),c=Math.min(s,a);return l<c?5:6}else if(r instanceof Si){if(this.track.isSelect(r.start.x,r.start.y))return 7;if(this.track.isSelect(r.end.x,r.end.y))return 8}else return r instanceof Le?1:r instanceof Ge?2:r instanceof Ye?4:0}else return e.length==0?0:e.some(r=>r instanceof Le)?1:11}getDot(e,r){let i=e.dot(r);return Math.abs(i)<.1&&(i=0),i}getAngleType(e,r){let i=this.getDot(e,r);return i>SGe?0:i<=SGe&&i>=$3t?1:2}isSameLayer(e,r){for(let i of r)if(i.layerId!=e.layerId)return!1;return!0}canDrag(e){return e==0||e==4||e==5||e==6||e==1}isConnectTrack(e){return e==5||e==6||e==7||e==8}get startTangent(){let e=this.track,r=e.start,n=e.center.sub(r).normalize();if(this._startType===5||this._startType===6){let a=this._startNodes[0].direct;return this.getDot(n,a)===0}else return!1}get endTangent(){let e=this.track,r=e.end,n=e.center.sub(r).normalize();if(this._endType===5||this._endType===6){let a=this._endNodes[0].direct;return this.getDot(n,a)===0}else return!1}};var Kj=class{};var t2=o=>{switch(o){case 15:return 1;case 16:return 2;case 17:return 3;case 18:return 4;case 19:return 5;case 20:return 6;case 21:return 7;case 22:return 8;case 23:return 9;case 24:return 10;case 25:return 11;case 26:return 12;case 27:return 13;case 28:return 14;case 29:return 15;case 30:return 16;case 31:return 17;case 32:return 18;case 33:return 19;case 34:return 20;case 35:return 21;case 36:return 22;case 37:return 23;case 38:return 24;case 39:return 25;case 40:return 26;case 41:return 27;case 42:return 28;case 43:return 29;case 44:return 30;case 45:return 31;case 46:return 32;default:return 0}},One=class{constructor(t,e){this.type=t,this.order=e}getHashed(){return this.type+"-"+this.order}};var Ane=class{},i_=class o extends Ane{constructor(t){super(),this.neckThickness=an.positiveOr0(t)}transform(t){return new o(this.neckThickness*t.iScale)}},JR=class o extends Ane{constructor(t,e,r=90){super(),this.gridWidth=an.positiveOr0(t),this.gridClearance=an.positiveOr0(e),this.angle=r}transform(t){let e=t.iScale;return new o(this.gridWidth*e,this.gridClearance*e)}},S6=class o extends Pa{constructor(e,r,i,n,s,a,l,c,h,u,d,p,m){super(e,r,i);this.multiLayerClearance=1;this.multiLayerThermal=!1;for(let g of d)if(!(g instanceof M||g instanceof q))throw new Error("invalid outlines, must be Line or Arc");this.method=n,this.outlineClearance=an.normal(s),this.clearance=a,this.thermal=l,this.keepIsland=c,this.pourIndex=h,this.needCopper=u,this.outlines=d,this.coppered=p,this.__bbox=this._bbox(),this.name=m||""}multiply3(e){let r=new Array(this.outlines.length);for(let a=0;a<this.outlines.length;a++)r[a]=this.outlines[a].multiply3(e);let i;if(this.coppered!==null){i=new Array(this.coppered.length);for(let a=0;a<this.coppered.length;a++)i[a]=this.coppered[a].multiply3(e)}else i=null;let n;this.method==null?n=null:n=this.method.transform(e);let s={};for(let a in this.clearance){let l=this.clearance[a];s[a]=l*e.iScale}return new o(this.id,this.net,this.layer,n,this.outlineClearance*e.iScale,s,this.thermal,this.keepIsland,this.pourIndex,this.needCopper,r,i,this.name)}bbox(){return this.__bbox}_bbox(){let e=new _e;for(let r of this.outlines)e.ext1(r.bbox());return e.build1()}shape(e,r){return this.layer.equals(e)||this.layer.equals($r.MULTI)?fe.build2(this.outlines):null}};var sP=class o extends Pa{constructor(t,e,r,i,n,s,a,l,c){super(t||"","",e),this.type=r,this.copper=i,this.track=n,this.device=s,this.region=l,this.plane=a,this.outlines=c,this.__bbox=this._bbox()}multiply3(t){return new o(this.id,this.layer,this.type,this.copper,this.track,this.device,this.plane,this.region,this.outlines.multiply3(t))}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outlines:null}};var E6=class o{constructor(t,e,r,i){this._connectMode=0;this._lineWidth=1;this._lineClearance=1;this._lineAngle=es;this._connectMode=t,this._lineWidth=e,this._lineClearance=r,this._lineAngle=i}static getPadRule(t){if(t)return new o(t.connectMode,t.lineWidth,t.lineClearance,t.lineAngle)}static getDefRule(){return new o(0,1,1,es)}get lineAngle(){return this._lineAngle}set lineAngle(t){this._lineAngle=t}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t}get connectMode(){return this._connectMode}set connectMode(t){this._connectMode=t}get lineClearance(){return this._lineClearance}set lineClearance(t){this._lineClearance=t}};var O6=o=>{switch(o){case"MULTI":return 0;case"TOP_SILK":return 1;case"TOP_PASTE_MASK":return 2;case"TOP_PASTE_MASK":return 3;case"TOP":return 4;case"SIGNAL":return 5;case"PLANE":return 6;case"BOTTOM":return 7;case"BOT_PASTE_MASK":return 8;case"BOT_SOLDER_MASK":return 9;case"BOT_SILK":return 10;case"OUTLINE":return 11;case"DOCUMENT":return 12;case"MECHANICAL":return 13;default:return 16}};var v0=class extends Ns{constructor(t,e,r,i,n,s,a){super(t,e,r,i,n,s),this.sourceIndex=a}};var n_=class extends ME{constructor(e,r,i,n){super();this._color=ee.BLACK;this._state="Only Main";this.viewGroupId="";this.globalIndex=e,this._layerId=r,this._center=i,this.radius=n,this.refreshRender()}set color(e){this._color=e,this.refreshRender()}get color(){return this._color}get radius(){return this._radius}set radius(e){this.radius!=e&&(this._radius=e,this.shapeModified=!0,this.refreshRender())}get shapeModified(){return this.hasDataState(5)}set shapeModified(e){this.setDataState(5,e)}get layerId(){return this._layerId}get layerModified(){return!1}get center(){return this._center}get highlightColor(){return ee.BLACK}get highLightType(){return null}get manualHighLight(){return x.getInstance().forceDeactive}remove(){this._state="Not Shown",this.refreshRender()}getType(){return 30}refreshRender(){Do.attach(this,this.getType())}getViewState(){return this._state}getRenderData(){return this}};var oC=class extends Ns{constructor(){super(...arguments);this.pcbVia=null;this.via=null;this.isReset=!1}reset(){this.isReset=!0}used(){this.isReset=!1}getRopeStart(){return this.isReset?this.pcbVia.center:this.end}hiddenVia(){if(this.pcbVia!=null){let e=Hr.getItem(this.pcbVia.id);e!=null&&e.hidden()}}visibleVia(){if(this.pcbVia!=null){let e=Hr.getItem(this.pcbVia.id);e!=null&&e.visible()}}previewVia(){this.hiddenVia(),this.removePreviewVia(),this.via=new n_(su(),12,this.end,this.width/2)}removePreviewVia(){this.via!=null&&this.via.remove(),this.via=null}};var QS=class{constructor(t,e,r,i,n,s,a){this.obstacles=new Set;this.sweep=null;this.modifyPath=new Array;this.modifyVias=new Array;this.walkHulls=new Array;this.previousChain=new Array;this.sourceIndex=t,this.all=e,this.tracks=r,this.path=i,this.startVia=n,this.endVia=s,this.sweep=a}updateModifyPath(t){this.modifyPath.length=0;let e=t.sourceTrackChain[this.sourceIndex],r=this.getPath(e),i=r.length,n=this.path.length,s=!1;for(let a=0,l=0;a<i&&l<n;){let c=r[a],h=this.path[l];if(c.equals1(h))s&&this.modifyPath.push(this.tracks[l-1]),a++,l++,s=!1;else{let u=l+1;for(;u<n;u++){let d=this.path[u];if(c.equals1(d))break}if(u<n){for(let d=l;d<=u;d++)d>=1&&this.modifyPath.push(this.tracks[d-1]);l=u}else if(a++,s=!0,a==i)for(let d=l;d<n;d++)d>=1&&this.modifyPath.push(this.tracks[d-1])}}}getPath(t){let e=new Array;if(t.length==0)return e;if(t.length==1)return[t[0].start,t[0].end];{let r,i;t[0].start.distance2(t[1].start)<1e-8||t[0].start.distance2(t[1].end)<1e-8?(r=t[0].end,i=t[0].start):(r=t[0].start,i=t[0].end),e.push(r),e.push(i);for(let n=1,s=t.length;n<s;n++){let a=t[n];a.start.distance2(i)<1e-8?(e.push(a.end),i=a.end):(e.push(a.start),i=a.start)}return e}}get length(){let t=0;for(let e of this.tracks)t+=e.start.distance1(e.end);return t}clear(){this.all.clear(),this.tracks.length=0,this.path.length=0,this.obstacles.clear(),this.modifyPath.length=0,this.modifyVias.length=0,this.walkHulls.length=0,this.previousChain.length=0}};var K3t=.1,wSe=class{constructor(){this._parent=null}set parent(t){this._parent=t}get parent(){return this._parent}},aP=class{constructor(t,e,r,i){this.samePositionNeighbor=new Set;this.neighbors=new Set;this._decorator=null;this.position=t,this.range=e,this.direct=r,this.box=new ut(this.position.x,this.position.x,this.position.y,this.position.y).extendOfSize(this.range),this.component=i}set decorator(t){this._decorator=t,this._decorator.parent=this}get decorator(){return this._decorator}bbox(){return this.box}addNeighbor(t){if(this.box.isIntersect(t.box)&&this.component!=t.component)if(this.position.equals1(t.position)){let e=new _ne(this,t,0);this.samePositionNeighbor.add(e),t.samePositionNeighbor.add(e)}else{let e=Math.min(this.range,t.range),r=this.position.distance1(t.position);if(r<=e&&r<K3t){let i=new _ne(this,t,r);this.neighbors.add(i),t.neighbors.add(i)}}}vote(t){return this.samePositionNeighbor.has(t)?!0:this.samePositionNeighbor.size==1?!1:this.neighbors.has(t)}getConnectNeighbors(){let t=new Array;for(let e of this.samePositionNeighbor)e.neighbor1==this?t.push(e.neighbor2):t.push(e.neighbor1);if(t.length==0)for(let e of this.neighbors)e.isNeighbor()&&(e.neighbor1==this?t.push(e.neighbor2):t.push(e.neighbor1));return t}},_ne=class{constructor(t,e,r){this.neighbor1=t,this.neighbor2=e,this.distance=r}isNeighbor(){return this.neighbor1.vote(this)&&this.neighbor2.vote(this)}},QR=class{constructor(t){this.neighbors=t}classify(){let t=this.neighbors.length,e=new nn(10);for(let r=0;r<t;r++){let i=this.neighbors[r],n=new LSe(r);i.decorator=n,e.add(i)}for(let r=0;r<t;r++){let i=this.neighbors[r],n=e.search(i.bbox());for(let s of n)s.decorator.index>i.decorator.index&&i.addNeighbor(s)}e.clear()}},LSe=class extends wSe{constructor(t){super(),this.index=t}};var Z3t=0;function EGe(o,t,e){let r=o.tracks[0].width,i=o.tracks[0].net,n=o.tracks[0].layer,s=new Array,a=t[0];for(let c=1,h=t.length;c<h;c++){let u=t[c],d=new v0(i,n,a,u,r,"chain"+Z3t++,o.sourceIndex);s.push(d),a=u}let l=new cg(e);l.path.push(s[0].start);for(let c of s)l.tracks.push(c),l.all.add(c),l.path.push(c.end);return l.sourceIndex=o.sourceIndex,l.endVia=o.endVia,l.startVia=o.startVia,l}var cg=class{constructor(t){this.sourceIndex=null;this.all=new Set;this.tracks=new Array;this.startVia=null;this.endVia=null;this.path=new Array;this.firstTouchTrack=null;this.sweep=null;this.obstacles=new Array;this.map=t}build(){return new QS(this.sourceIndex,this.all,this.tracks,this.path,this.startVia,this.endVia,this.sweep)}canShove(){return this.sourceIndex!=null}get length(){let t=0;for(let e of this.tracks)t+=e.start.distance1(e.end);return t}getPath(){if(this.firstTouchTrack!=null){let t=new Array,e=this.firstTouchTrack;t.push(this.firstTouchTrack);let r=this.tracks.indexOf(this.firstTouchTrack);for(let i=r-1;i>=0;i--){let n=this.tracks[i];t.push(n)}for(let i=r+1,n=this.tracks.length;i<n;i++){let s=this.tracks[i];t.push(s)}return this.firstTouchTrack=null,t}else return this.tracks}clearShape(){}generateChain(t){let e=t.start,r=t.end;return this.tracks.push(t),this.path.push(e),this.all.add(t),this.getTracks(t.layer,e,t.width,t.net),this.tracks=this.tracks.reverse(),this.path=this.path.reverse(),this.path.push(r),this.getTracks(t.layer,r,t.width,t.net,!1),this}getTracks(t,e,r,i,n=!0){let s=new ut(e.x,e.x,e.y,e.y),a=this.map.getShoveItems(t,s),l=new Array,c=new Array;if(n&&this.startVia==null||!n&&this.endVia==null){let y=this.map.getMultiItems(s);for(let b of y){let P=null;if(b instanceof Ll?P=b:b instanceof oC&&(P=b.pcbVia),P!=null&&P.net==i&&P.center.distance2(e)<1e-4){n?this.startVia=P:this.endVia=P;return}}}let h=this.map.getObstacleItems(t,s),u=this.map.getObstacleItems($r.MULTI,s);for(let y of u)h.push(y);for(let y of h)if(y instanceof O0&&y.net==i&&y.location.distance2(e)<.1)return;let d=new aP(e,r/2,S.ORIGIN,{point:e,item:null,isStart:n}),p=new Array;p.push(d);for(let y of a)if(y instanceof Ns&&!(y instanceof oC)&&!this.all.has(y)&&y.net==i){let b=new aP(y.start,y.width/2,S.ORIGIN,{point:y.end,item:y,isStart:!0}),P=new aP(y.end,y.width/2,S.ORIGIN,{point:y.start,item:y,isStart:!1});p.push(b,P)}new QR(p).classify();let g=d.getConnectNeighbors();for(let y of g){l.push(y.component.point);let b=y.component.item;this.all.add(b),c.push(b)}if(l.length==1&&c[0].width==r)this.path.push(l[0]),this.tracks.push(c[0]),this.getTracks(t,l[0],c[0].width,i,n);else for(let y of c)this.all.delete(y)}};var $d=class o extends Ar{constructor(e,r){super(e);this.isBase=!0;super.color=r,this.sendDeleteMsg=!1}static build(e,r,i,n,s){let a=new qr(su(),e,r,i,n,!1,s);return new o(a,null)}getAngle(){let e=this.end.sub(this.start);return Qte(Math.atan2(e.y,e.x))}setBBoxModify(){}setLayerModify(e){}};function vne(o){let{type:t,order:e}=xne(o.layerId),r="";return o instanceof Ar&&(r=o.globalIndex),new v0(o.net,new $r(O6(t),e),o.start,o.end,o.width,r,0)}function xne(o){let t=$e.getInstance().getLayer(o),e=0;switch(t.type){case"SIGNAL":case"PLANE":e=t2(o);break;case"MECHANICAL":case"PLANE":e=1;break;default:e=0;break}return{type:t.type,order:e}}var yF=class o{constructor(t){this.childs=new Array;this._bbox=null;this.parent=null;this.capacity=t}bbox(){return an.notnull(this._bbox)}itor(t,e){for(let r of this.childs)r instanceof o?r.itor(t+1,e):e(r,t)}debug(t){for(let e of this.childs)console.log(t,e.bbox(),e instanceof o?"+":"-"),e instanceof o&&e.debug(t+" |--")}insert(t){let e=this.childs,r=t.bbox();for(let i=0;i<e.length;i++){let n=e[i];if(n instanceof o&&r.isInside(n.bbox())){n.insert(t),this._bbox=ut.extend2(this._bbox,r);return}}t instanceof o&&(t.parent=this),e.length<=this.capacity?e.push(t):(e.push(t),this.splitNode()),this._bbox=ut.extend2(this._bbox,r)}remove(t){if(t instanceof o&&t.childs.length>0)throw new Error;let e=this.childs,r=t.bbox(),i=new Array;for(let n=0;n<e.length;n++){let s=e[n];if(s===t)return e.splice(n,1),e.length>1?(this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):e.length==1?this.parent!==null?(this.parent.childs.push(this.childs[0]),this.childs[0]instanceof o&&(this.childs[0].parent=this.parent),this.childs.length=0,this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this.updateBBox():this.parent!==null?(this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this._bbox=null,1;s instanceof o&&r.isInside(s.bbox())&&i.push(s)}if(t instanceof o)throw new Error;for(let n of i){let s=n.remove(t);if(s===1)return this.childs.length>0&&this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox(),1;if(s!==0)throw new Error}return 0}recycle(){this.childs.length=0}updateBBox(){let t=new _e;for(let e of this.childs)t.ext1(e.bbox());this._bbox=t.build1()}splitNode(){let t=this.childs,e=t.length,r=-1,i=-1,n=Number.NEGATIVE_INFINITY;for(let c=0;c<e;c++){let h=t[c];for(let u=c+1;u<e;u++){let d=t[u],p=ut.extend2(h.bbox(),d.bbox()).area();p>n&&(n=p,r=c,i=u)}}let s=this.asNode(t[r]),a=this.asNode(t[i]);for(let c=0;c<e;c++)if(c!==r&&c!==i){let h=t[c],u=h.bbox(),d=ut.extend2(s._bbox,u).area(),p=ut.extend2(a._bbox,u).area();d<p?s.insert(h):a.insert(h)}t.length=0;let l=this.parent;s.updateBBox(),a.updateBBox(),l!==null&&l.childs.length<this.capacity?(s.parent=l,a.parent=l,l.childs.push(s),l.childs.push(a),l.remove(this),l.updateBBox()):(s.parent=this,a.parent=this,t.push(s),t.push(a),this.updateBBox()),this.childs.length>0&&this.updateBBox()}asNode(t){if(t instanceof o)return t;{let e=new o(this.capacity);return e.insert(t),e}}},lP=class{constructor(t){this.items=new Set;this.root=new yF(t)}itor(t){this.root.itor(0,t)}search(t){let e=[],r=[];if(this.items.size==0||this.root!=null&&t.isSeparated(this.root.bbox()))return e;r.push(this.root);let i=null;for(;i=r.shift(),i!==void 0;)for(let n of i.childs)t.isSeparated(n.bbox())||(n instanceof yF?n.bbox().isInside(t)?this.add2Result(n,e):r.push(n):e.push(n));return e}add2Result(t,e,r){let i=[t];for(;;){let n=i.shift();if(n!==void 0)for(let s of n.childs)s instanceof yF?i.push(s):(!r||r(s))&&e.push(s);else break}}conditionQuery(t,e){let r=[];if(this.items.size==0||this.root!=null&&t.isSeparated(this.root.bbox()))return!1;r.push(this.root);let i=null;for(;i=r.shift(),i!==void 0;)for(let n of i.childs)if(!t.isSeparated(n.bbox())){if(n instanceof yF)r.push(n);else if(e(n))return!0}return!1}insert(t){this.items.add(t),this.root.insert(t)}remove(t){return this.items.delete(t),this.root.remove(t)}bbox(){return this.root.bbox()}debug(){this.root.debug("")}recycle(){this.items.clear(),this.root.recycle()}};var o0=class extends Ns{constructor(){super(...arguments);this.locked=!1}};var Rne=class o extends Pa{constructor(t,e,r,i,n){super(t,e,r),this.outline=i,this.connect=n,this.__bbox=this.outline.bbox()}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outline:null}bbox(){return this.__bbox}multiply3(t){return new o(this.id,this.net,this.layer,this.outline.multiply3(t),this.connect)}};function sC(o){let t=new Array,e=$e.getInstance();for(let r of o){let i=e.getLayer(r);t.push([i.layerId,i.type])}return t}function J3t(o,t){switch(o){case 1:return $r.TOP_COPPER;case 3:return $r.TOP_SILK;case 5:return $r.TOP_SOLDER_MASK;case 7:return $r.TOP_PASTE;case 2:return $r.BOT_COPPER;case 4:return $r.BOT_SILK;case 6:return $r.BOT_SOLDER_MASK;case 8:return $r.BOT_PASTE;case 11:return $r.OUTLINE;case 12:return $r.MULTI;case 13:return $r.DOCUMENT;default:if(Ms(o))if(gs(t)){let e=t2(o);return new $r(5,e)}else{let e=t2(o);return new $r(6,e)}else return $r.OTHER}}function aC(o){let t=new Array;for(let[e,r]of o){let i=J3t(e,r);t.push(i)}return t}var OGe={},bF=class{constructor(t){this.pcbshape=null;this.pcblayer=null;this.item=null;t instanceof zs?(this.item=t,t instanceof Ue&&(this.pcbshape=this.converToShape(this.item))):this.pcbshape=t,this._box=this.buildBbox()}get id(){return this.pcbshape!=null?this.pcbshape.id:this.item!=null?this.item.globalIndex:""}get layer(){return this.pcblayer!=null?this.pcblayer:this.pcbshape!=null?(this.pcblayer=this.pcbshape.layer,this.pcblayer):this.item instanceof Ge?(this.pcblayer=$r.MULTI,$r.MULTI):(this.pcblayer=this.getLayer(this.item.layerId),this.pcblayer)}get shape(){return this.pcbshape==null&&(this.pcbshape=this.converToShape(this.item)),this.pcbshape}converToShape(t){if(t instanceof Ge)return t.type==1?new qy(t.globalIndex,t.net,t.center,t.holeRadius*2,this.getLayer(t.startLayer),t.radius*2,t.radius*2,this.getLayer(t.endLayer),t.radius*2,!1,aC(sC(t.unusedInnerLayers))):new Ll(t.globalIndex,t.net,t.center,t.holeRadius*2,t.radius*2,t.radius*2,t.radius*2,!1,aC(sC(t.unusedInnerLayers)));if(t instanceof Ar){let e=new o0(t.net,this.getLayer(t.layerId),t.start,t.end,t.width,t.globalIndex);return e.locked=t.locked,e}else if(t instanceof Si){let e=q.build2(t.center,t.startAngle/Math.PI*180,t.endAngle/Math.PI*180,t.radius,t.radius,t.sweep);return new ag(t.net,this.getLayer(t.layerId),e,t.width,t.globalIndex)}else if(t instanceof fr||t instanceof n0){let e=t.model.box;return new U1(this.getLayer(t.layerId),e.leftLow,e.leftUp,e.rightLow,e.rightUp,t.globalIndex)}else if(t instanceof Ye){if(!(gs($e.getInstance().getLayer(t.layerId).type)||12==t.layerId||11==t.layerId))return null;let e=t.getComponent();return this.getProfileShape(t.globalIndex,t.type,t.net,t.layerId,0,t.getMathGraphics(t.layerId,0),t.strokeWidth,e,e)}else if(t instanceof Ri){if(gr(t.layerId)){let e=this.getShape(t.topType,t.topWidth,t.topHeight,t.topRatio,null),r=this.getShape(t.innerType,t.innerWidth,t.innerHeight,t.innerRatio,null),i=this.getShape(t.bottomType,t.bottomWidth,t.bottomHeight,t.bottomRatio,null),n=this.getHoleShape(t);return new O0(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,t.rotation/Math.PI*180,new JI(this.getLayer(t.layerId),e,r,i),n,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),this.getUnuseLayers(t.unusedInnerLayers))}else if(Io(t.layerId)){let e=this.getShape(t.topType,t.topWidth,t.topHeight,t.topRatio,null),r=new _T(0,0,0,t.rotation/Math.PI*180,0,0);return new O0(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,t.rotation/Math.PI*180,new JI(this.getLayer(t.layerId),e,null,null),r,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),this.getUnuseLayers(t.unusedInnerLayers))}else if(2==t.layerId){let e=this.getShape(t.bottomType,t.bottomWidth,t.bottomHeight,t.bottomRatio,null),r=new _T(0,0,0,t.rotation/Math.PI*180,0,0);return new O0(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,t.rotation/Math.PI*180,new JI(this.getLayer(t.layerId),null,null,e),r,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),this.getUnuseLayers(t.unusedInnerLayers))}}else if(t instanceof fn){if(gr(t.layerId)){let e=this.getShape("POLYGON",0,0,0,t.primitives),r=this.getShape("POLYGON",0,0,0,t.primitives),i=this.getShape("POLYGON",0,0,0,t.primitives),n=this.getHoleShape(t);return new O0(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,t.rotation/Math.PI*180,new JI(this.getLayer(t.layerId),e,r,i),n,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),this.getUnuseLayers(t.unusedInnerLayers))}else if(Io(t.layerId)){let e=this.getShape("POLYGON",0,0,0,t.primitives),r=new _T(0,0,0,t.rotation/Math.PI*180,0,0);return new O0(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,t.rotation/Math.PI*180,new JI(this.getLayer(t.layerId),e,null,null),r,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),this.getUnuseLayers(t.unusedInnerLayers))}else if(2==t.layerId){let e=this.getShape("POLYGON",0,0,0,t.primitives),r=new _T(0,0,0,t.rotation/Math.PI*180,0,0);return new O0(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,t.rotation/Math.PI*180,new JI(this.getLayer(t.layerId),null,null,e),r,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),this.getUnuseLayers(t.unusedInnerLayers))}}return null}getProfileShape(t,e,r,i,n,s,a,l,c){switch(e){case"Line":return i==11?new of(t,n,s):new Mf(r,this.getLayer(i),n,a,s,t);case"Prohibited Region":return new sP(t,this.getLayer(i),n,c.copper,c.track,c.device,c.planzone,c.fill,s);case"Fill Region":return new vT(r,this.getLayer(i),n,s,t);case"Board Outline":return new of(t,n,s);case"Slot Region":return new $y(t,n,s);case"TearDrop":return new Rne(t,r,this.getLayer(i),s,l.connects)}}getShape(t,e,r,i,n){let s;switch(t){case"ELLIPSE":s=new tP(0,e,r,i*100,null);break;case"OVAL":s=new tP(3,e,r,i*100,null);break;case"RECT":s=new tP(1,e,r,i*100,null);break;case"POLYGON":s=new tP(4,e,r,0,fe.build2(n));break}return s}getHoleShape(t){return t.holeShape=="ROUND"?new _T(0,t.holeRadius*2,t.holeLength,t.holeRotation/Math.PI*180,t.holeOffset.x,t.holeOffset.y):new _T(2,t.holeRadius*2,t.holeLength,t.holeRotation/Math.PI*180,t.holeOffset.x,t.holeOffset.y)}toPadRule(t){if(t==null)return null;let e=t.toJSON();return new E6(e.connectMode,e.lineWidth,e.lineClearance,e.lineAngle)}getUnuseLayers(t){let e=new Array;for(let r of t){let i=this.getLayer(r);e.push(i)}return e}getLayer(t){let e=OGe[t];if(e!=null)return e;let r=$e.getInstance().getLayer(t),i=0;switch(r==null?void 0:r.type){case"SIGNAL":case"PLANE":i=t2(t);break;case"MECHANICAL":case"PLANE":i=1;break;default:i=0;break}let n=new $r(O6(r==null?void 0:r.type),i);return OGe[t]=n,n}buildBbox(){if(this.pcbshape!=null)return this.pcbshape.bbox();if(this.item!=null)return this.item.buildBBox();throw new Error("Method not implemented.")}bbox(){return this._box}};function MSe(o){return new nn(10)}var A6=class o{static getMap(){return o.map==null&&(o.map=new NSe),o.map}static clear(){o.map!=null&&o.map.clear(),o.map=null}},NSe=class{constructor(){this.pcbLayerRTreeMap=new Bd;this.multiLayerRTree=new lP(10);this.layerRTreeMap=new Bd;this.realTimeLayerRTreeMap=new Bd;this.box2d=new _e;this.map={};this.shapes=this.getShapes(),this.addDocShapes2RTree()}getShapes(){let t=new Array;Re.addAll(t,Hr.getAllItem()),Re.addAll(t,pr.getAllItem()),Re.addAll(t,ti.getAllItem()),Re.addAll(t,Ln.getAllItem()),Re.addAll(t,Kt.getAllItem()),Re.addAll(t,Zt.getAllItem()),Re.addAll(t,pt.getAllItem()),Re.addAll(t,Xt.getAllItem());let e=new Array;for(let r of t)e.push(new bF(r));return e}getTrack(t){let e=this.map[t];if(e!=null&&e.shape!=null){let r=e.shape;if(r instanceof Ns)return r}return null}getPcbLayers(){return this.pcbLayerRTreeMap.keys()}getLayerRTreePcbLayers(){return this.layerRTreeMap.keys()}getRealTimeLayerRTreePcbLayers(){return this.realTimeLayerRTreeMap.keys()}getMultiRtreeItems(t){let e=this.multiLayerRTree.search(t),r=new Array;for(let i of e)i.shape!=null&&r.push(i.shape);return r}addDocShapes2RTree(){for(let t of this.shapes)this.map[t.id]=t,this.addShape2RTree(t),this.box2d.ext1(t.bbox())}getMultiItems(t){let e=new Array,r=this.layerRTreeMap.get($r.MULTI);return r!=null&&r.search(t).forEach(s=>{s.shape!=null&&e.push(s.shape)}),this.multiLayerRTree.search(t).forEach(n=>{n.shape!=null&&e.push(n.shape)}),e}getShoveItems(t,e){let r=this.pcbLayerRTreeMap.get(t);if(r!=null){let i=r.search(e),n=new Array;for(let s of i)s.shape!=null&&n.push(s.shape);return n}else return new Array}getObstacleItems(t,e){let r=new Array,i=this.layerRTreeMap.get(t);i!=null&&i.search(e).forEach(a=>{a.shape!=null&&r.push(a.shape)});let n=this.realTimeLayerRTreeMap.get(t);return n!=null&&n.search(e).forEach(a=>{a.shape!=null&&r.push(a.shape)}),r}addShape2RTree(t){let e=this.map[t.id];e==null&&t instanceof Pa&&(e=new bF(t),this.map[e.id]=e),t instanceof Ns?t instanceof o0&&t.locked?this.addNode2RTree1(e):this.addNode2RTree(e):t instanceof bF&&t.item!=null&&t.item instanceof Ar&&!t.item.locked?this.addNode2RTree(e):this.addNode2RTree1(e)}removeShape4RTree(t){if(t.layer.type==0){let e=this.map[t.id];this.multiLayerRTree.remove(e)}else{let e=this.pcbLayerRTreeMap.get(t.layer);if(e!=null){let i=this.map[t.id];e.remove(i)}let r=this.layerRTreeMap.get(t.layer);if(r!=null){let i=this.map[t.id];r.remove(i)}}}addNode2RTree(t){switch(t.layer.type){case 4:case 7:case 5:this.pcbLayerRTreeMap.computeIfAbsent(t.layer,MSe).add(t);break;case 0:this.multiLayerRTree.insert(t);break;default:break}}addNode2RTree1(t){switch(t.layer.type){case 4:case 7:case 5:case 0:case 11:this.layerRTreeMap.computeIfAbsent(t.layer,MSe).add(t);break;default:break}}addRealTimeShape(t){switch(t.layer.type){case 4:case 7:case 5:case 0:case 11:this.realTimeLayerRTreeMap.computeIfAbsent(t.layer,MSe).add(t);break;default:break}}removeRealTimeShape(t){let e=this.realTimeLayerRTreeMap.get(t.layer);if(e!=null){let r=this.map[t.id];e.remove(r)}}clear(){this.clearArray(this.pcbLayerRTreeMap),this.multiLayerRTree.recycle(),this.clearArray(this.layerRTreeMap),this.clearArray(this.realTimeLayerRTreeMap),this.shapes.length=0}clearArray(t){let e=t.keys();for(;e.hasNext();){let r=e.next(),i=t.get(r);i instanceof lP?i.recycle():i.clear()}}};var Dne=class{constructor(){this.previewTrack=new Set;this.collideTracks=new Set;this.map=A6.getMap();this.adsorp=null}resetLastMap(t){if(t!=null)for(let e=1,r=t.sourceTrackChain.length;e<r;e++)this.remove4Rtree(t.sourceTrackChain[e]),this.add4Rtree([t.shovePathMap[e]])}resetMap(){this.add4Rtree(Array.from(this.collideTracks)),this.remove4Rtree(Array.from(this.previewTrack)),this.collideTracks.clear(),this.previewTrack.clear()}remove4Rtree(t){t.forEach(e=>{e instanceof QS?e.tracks.forEach(r=>{r instanceof o0?this.collideTracks.add(r):r instanceof v0&&this.previewTrack.delete(r),this.map.removeShape4RTree(r)}):(e instanceof o0?this.collideTracks.add(e):e instanceof v0&&this.previewTrack.delete(e),this.map.removeShape4RTree(e))})}add4Rtree(t){t.forEach(e=>{if(e instanceof QS)e.tracks.forEach(r=>{if(r instanceof v0){if(this.previewTrack.has(r))return;this.previewTrack.add(r)}else if(r instanceof o0){if(!this.collideTracks.has(r))return;this.collideTracks.delete(r)}this.map.addShape2RTree(r)});else{if(e instanceof v0){if(this.previewTrack.has(e))return;this.previewTrack.add(e)}else if(e instanceof o0){if(!this.collideTracks.has(e))return;this.collideTracks.delete(e)}this.map.addShape2RTree(e)}})}adsorpTrack(t,e,r,i){let n=new Array;if(this.adsorp!=null)if(this.adsorp instanceof Ns)if(e!=null){let s=e.end,a=this.adsorp.end.sub(this.adsorp.start).normalize();if(Math.abs(i.dot(a))<=1e-8)n.push(t.start),n.push(r),n.push(r);else{let l=e.end.sub(e.start).normalize();if(Math.abs(l.dot(a))>1e-8){let c=1;if(a.x==0&&a.y!=0)c=(s.y-r.y)/a.y;else if(a.x!=0&&a.y==0)c=(s.x-r.x)/a.x;else{let p=(s.x-r.x)/a.x,m=(s.y-r.y)/a.y;Math.abs(p)>Math.abs(m)?c=m:c=p}let h=r.add(a.mul(c)),u=new Ns(e.net,e.layer,r,h,e.width,e.id),d=this.checkAdsorp(u);t.end.equals1(t.start)?(n.push(t.start),n.push(d),n.push(d)):(n.push(t.start),n.push(r),n.push(d))}else n.push(t.start),n.push(r),n.push(r)}}else n.push(t.start),n.push(r),n.push(r);else n.push(t.start),n.push(r),n.push(r);else if(e!=null){let s=this.checkAdsorp(e);n.push(t.start),n.push(e.start),n.push(s)}else n.push(t.start),n.push(r),n.push(r);return n}getSolidObstacle(t){for(let e of t.tracks)if(this.adsorp=null,this.checkObstacle(e),this.adsorp!=null)return t.firstTouchTrack=e,this.adsorp;return null}getType(t){if(t instanceof Ns)return 0;if(t instanceof ag)return 0;if(t instanceof CA)return 6;if(t instanceof U1)return 10;if(t instanceof Mf)return 9;if(t instanceof sP)return 15;if(t instanceof $y)return 8;if(t instanceof Ll)return 5;if(t instanceof qy)return 5;if(t instanceof O0)return t.layer.equals($r.MULTI)?2:1;if(t instanceof of)return 11}getSafeClearance(t,e,r=0){let i=r,n=this.getType(e);if(e.net!=null){let h=te.getInstance().getBetweenNetRuleByNet(i,n,t,e.net);if(h!=null)return te.getInstance().getSafeSpacing(h.name).getClearance(n,i)}if(n==0){let h=te.getInstance().getNet(t);if(h!=null&&h.netDifferential!=null){let u=h.netDifferential;if(t!=e.net&&u.hasNet(t)&&u.hasNet(e.net))return te.getInstance().getDifferentialPhysics(u.differentialPhysics).getDifferentialPairSpacingMin()}}let s=te.getInstance().getSafeSpacingByNet(t,i),a=te.getInstance().getSafeSpacingByNet(e.net,i),l=[s,a],c=-1;for(let h of l){let u=h.getClearance(n,i);c=Math.max(c,u)}if(c!=-1)return c;for(let h of l){let u=h.getClearance(n,i);c=Math.max(c,u)}return c}checkOnlyVia(t){if(t instanceof Ll)t=new Ns(t.net,$r.TOP_COPPER,t.center,t.center,t.topPad);else if(t.start.distance2(t.end)==0)return t.end;let e=te.getInstance().getMaxSafe(),r=t.bbox().extendOfSize(e),i=this.map.getMultiRtreeItems(r),n=t.end,s=t.net,a=this.getPrimitive(t);for(let l of i){let c=this.getSafeClearance(s,l),u=Math.max(c,0);ne.eq(u,0)||(n=this.checkClearance1(a,t,u,l),a=this.getNewPrimitive(a,n))}return n}check(t){if(t instanceof Ll)return this.checkShoveVia(t);if(t.start.distance2(t.end)==0)return t.end;let e=te.getInstance().getMaxSafe(),r=t.bbox().extendOfSize(e),i=this.map.getShoveItems(t.layer,r),n=t.end,s=t.net,a=this.getPrimitive(t);for(let l of i){let c=this.getSafeClearance(s,l),u=Math.max(c,0);ne.eq(u,0)||(n=this.checkClearance1(a,t,u,l),a=this.getNewPrimitive(a,n))}return n}checkShoveVia(t){let e=te.getInstance().getMaxSafe(),r=new _e().ext2(t.center).ext7(e+t.topPad/2).build1(),i=new Array,n=this.map.getPcbLayers(),s=new Array;for(;n.hasNext();){let h=n.next();this.map.getShoveItems(h,r).forEach(p=>{i.push(p)});let d=new Ns(t.net,h,t.center,t.center,t.topPad);s.push(d)}let a=t.net,l=t.center,c=new M(t.center,t.center);for(let h of i){let u=this.getSafeClearance(a,h,5);if(!ne.eq(u,0))for(let d of s)l=this.checkClearance1(c,d,u,h),c=new M(c.start(),l)}return l}checkAdsorp(t){if(t instanceof Ll)t=new Ns(t.net,$r.TOP_COPPER,t.center,t.center,t.topPad);else if(t instanceof Ns&&t.start.distance2(t.end)==0)return t.end;let e=te.getInstance().getMaxSafe(),r=t.bbox().extendOfSize(e),i=this.map.getShoveItems(t.layer,r);this.map.getObstacleItems(t.layer,r).forEach(c=>{i.push(c)}),this.addMultiObstacle(r,i),this.addOutlineObstacle(r,i);let s=t.net,a=this.getPrimitive(t),l=a.end();for(let c of i){let h=this.getSafeClearance(s,c),d=Math.max(h,0);ne.eq(d,0)||(l=this.checkClearance1(a,t,d,c),a=this.getNewPrimitive(a,l))}return l}addMultiObstacle(t,e){this.map.getObstacleItems($r.MULTI,t).forEach(i=>{e.push(i)})}addOutlineObstacle(t,e){this.map.getObstacleItems($r.OUTLINE,t).forEach(i=>{e.push(i)})}checkObstacle(t){if(t.start.distance2(t.end)==0)return t.end;let e=te.getInstance().getMaxSafe(),r=t.bbox().extendOfSize(e),i=this.map.getObstacleItems(t.layer,r);this.addMultiObstacle(r,i),this.addOutlineObstacle(r,i);let n=t.end,s=t.net,a=this.getPrimitive(t);for(let l of i){let c=this.getSafeClearance(s,l),u=Math.max(c,0);ne.eq(u,0)||(n=this.checkClearance1(a,t,u,l),a=this.getNewPrimitive(a,n))}return n}checkVia(t,e){let r=te.getInstance().getMaxSafe(),i=new _e().ext2(t.center).ext2(e).ext7(r+t.topPad/2).build1(),n=new Array,s=new Array,a=this.map.getLayerRTreePcbLayers();for(;a.hasNext();){let d=a.next();this.map.getObstacleItems(d,i).forEach(g=>{n.push(g)}),(d.equals($r.OUTLINE)||d.equals($r.MULTI))&&(d=$r.TOP_COPPER);let m=new Ns(t.net,d,t.center,e,t.topPad);s.push(m)}let l=this.map.getRealTimeLayerRTreePcbLayers();for(;l.hasNext();){let d=l.next();this.map.getObstacleItems(d,i).forEach(g=>{n.push(g)}),(d.equals($r.OUTLINE)||d.equals($r.MULTI))&&(d=$r.TOP_COPPER);let m=new Ns(t.net,d,t.center,e,t.topPad);s.push(m)}this.addMultiObstacle(i,n),this.addOutlineObstacle(i,n);let c=t.net,h=e,u=new M(t.center,e);for(let d of n){let p=this.getSafeClearance(c,d,5);if(!ne.eq(p,0))for(let m of s)h=this.checkClearance1(u,m,p,d),u=new M(u.start(),h)}return h}checkSolidVia(t,e){let r=te.getInstance().getMaxSafe(),i=t.bbox().extendOfSize(r),n=this.map.getObstacleItems(e,i);this.addMultiObstacle(i,n),this.addOutlineObstacle(i,n);let s=t.net,a=null,l=Number.MAX_VALUE,c=new M(t.center,t.center);for(let h of n){let u=this.getSafeClearance(s,h,5);if(ne.eq(u,0))continue;let d=h.shape(e,0),p=t.shape(e,u);if(d instanceof fe){d=d.asClose(),p=p.asClose();for(let m of p.primitives)for(let g of d.primitives)if(Tt(m,g)>0){let P=new ir(c,g).getDistance();P<l&&(l=P,a=h);break}}}return a}checkClearance1(t,e,r,i){return i instanceof Ns||i instanceof ag?this.checkTrackTrack(t,e,i,r):i instanceof O0?this.checkTrackPad(t,e,i,r):i instanceof Ll?this.checkTrackVia(t,e,i,r):i instanceof U1?this.checkTrackBox(t,e,i,r):i instanceof CA?this.checkTrackProfile(t,e,i,r):i instanceof Mf?this.checkTrackLine(t,e,i,r):i instanceof sP?this.checkTrackProhibit(t,e,i,r):i instanceof $y?this.checkTrackProfile(t,e,i,r):i instanceof of?this.checkTrackBoard(t,e,i,r):t.end()}checkTrackTrack(t,e,r,i){if(this.isSameNet(e.net,r.net)||!e.layer.equals(r.layer))return t.end();let n=e.width,s=r.width,a=this.getPrimitive(r),c=new ir(t,a).getDistance(),h=i+n/2+s/2,u=Math.pow(10,2);if(Math.round((c-h)*u)/u>=-1e-8)return t.end();{let p;return t instanceof M?a instanceof M?p=this.calcuLineLine(t,a,h):p=this.calcuLineArc(t,a,!0,h):a instanceof M?p=this.calcuLineArc(a,t,!1,h):p=this.calcuArcArc(t,a,h),this.adsorp=r,p}}checkTrackPad(t,e,r,i){if(e.net===r.net)return t.end();let n=xe(i+e.width/2,2),s=r.shape(e.layer,0),a=r.shape($r.MULTI,0),l=Number.MAX_VALUE,c=Number.MAX_VALUE;if(s!=null&&(s=s.asClose(),l=this.getMin(t,s)),a!=null&&(a=a.asClose(),c=this.getMin(t,a)),ne.lesseq(l,c)&&ne.less(l,n)){let h=this.getEnd(t,s,n);return this.adsorp=r,h}else if(ne.less(c,l)&&ne.less(c,n)){let h=this.getEnd(t,a,n);return this.adsorp=r,h}return t.end()}checkTrackVia(t,e,r,i){if(e.net===r.net||r instanceof qy&&r.shape(e.layer,0)==null)return t.end();let n=r.shape(e.layer,0),s=this.getMin(t,n),a=xe(i+e.width/2,2);if(ne.less(s,a)){let l=this.getEnd(t,n,a);return this.adsorp=r,l}return t.end()}checkTrackProhibit(t,e,r,i){if(!r.track)return t.end();let n=r.shape(e.layer,0);if(n!=null){n=n.asClose();let s=this.getMin(t,n),a=xe(i+e.width/2,2);if(ne.less(s,a)||s==a&&s==0){let l=this.getEnd(t,n,a);return this.adsorp=r,l}}return t.end()}checkTrackProfile(t,e,r,i){if(r instanceof CA&&this.isSameNet(e.net,r.net))return t.end();let n=r.shape(e.layer,0);if(n!=null){n=n.asClose();let s=this.getMin(t,n),a=xe(i+e.width/2,2);if(ne.less(s,a)||s==a&&s==0){let l=this.getEnd(t,n,a);return this.adsorp=r,l}}return t.end()}checkTrackLine(t,e,r,i){if(r instanceof Mf&&this.isSameNet(e.net,r.net))return t.end();let n=r.shape(e.layer,0),s=xe(e.width/2+r.width/2,2),a=t.bbox();for(let l of n.primitives){let c=l.bbox().extendOfSize(s+i);if(!a.isIntersect(c))continue;let h=l.stroke(s*2,kr.ROUND,le.CCW).asClose(),u=this.getMin(t,h);if(ne.less(u,i)||u==i&&u==0){let d=this.getEnd(t,h,i);this.adsorp=r,t=this.getNewPrimitive(t,d)}}return t.end()}checkTrackBoard(t,e,r,i){let n=r.shape(e.layer,0),s=e.width/2,a=t.bbox();for(let l of n.primitives){let c=l.bbox().extendOfSize(s+i);if(!a.isIntersect(c))continue;let h=l.stroke(s*2,kr.ROUND,le.CCW).asClose(),u=this.getMin(t,h);if(ne.less(u,xe(i,2))||u==xe(i,2)&&u==0){let d=this.getEnd(t,h,i);this.adsorp=r,t=this.getNewPrimitive(t,d)}}return t.end()}checkTrackBox(t,e,r,i){let n=r.shape(e.layer,0);if(n!=null){n=n.asClose();let s=this.getMin(t,n),a=xe(i+e.width/2,2);if(ne.less(s,a)){let l=this.getEnd(t,n,a);return this.adsorp=r,l}}return t.end()}getEnd(t,e,r){let i=t.end(),n=new fc(fe.build2([t]),e,r);switch(n.relation){case 3:return n.distance>r?i:this.getInterEnd(t,e,r);case 0:return this.getInterEnd(t,e,r);case 1:case 2:return t.start()}}getInterEnd(t,e,r){let i=t.end();for(let n of e.primitives)n instanceof M?t instanceof M?(i=this.calcuLineLine(t,n,r),t=new M(t.start(),i)):(i=this.calcuLineArc(n,t,!1,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())):n instanceof q&&(t instanceof M?(i=this.calcuLineArc(t,n,!0,r),t=new M(t.start(),i)):(i=this.calcuArcArc(t,n,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())));return i}getNewPrimitive(t,e){return t instanceof M?new M(t.start(),e):q.build2(t.center,t.startAngle,e.angleD(t.center),t.rx,t.ry,t.sweep())}getPrimitive(t,e=!0){if(e){let r;return t instanceof Ns?r=new M(t.start,t.end):r=q.build2(t.arc.center,t.arc.startAngle,t.arc.endAngle(),t.arc.rx,t.arc.rx,t.arc.sweep()),r}else{let r;if(t instanceof Ns)r=new M(t.end,t.start);else{let i=t.arc.sweep()==le.CCW?le.CW:le.CCW;r=q.build2(t.arc.center,t.arc.endAngle(),t.arc.startAngle,t.arc.rx,t.arc.rx,i)}return r}}isSameNet(t,e){return t===e}isSameLayer(t,e){return t===e}calcuLineLine(t,e,r){let i=t.start(),n=t.end(),s=e.stroke(r*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(i,s))return i;let l=new Set;for(let c of s.primitives){let h=Tt(t,c);if(h>0)for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);l.add(d)}}if(l.size>0){let c=n.distance1(i);l.forEach(h=>{let u=h.distance1(i);u<c&&(n=h,c=u)})}return n}calcuLineArc(t,e,r,i){if(r){let n=t.start(),s=t.end();if(i=i<.01?0:i,i==0)return t.start();let a=e.stroke(i*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(n,a))return n;let c=new Set;for(let h of a.primitives){let u=Tt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=s.distance1(n);c.forEach(u=>{let d=u.distance1(n);d<h&&(s=u,h=d)})}return s}else{let n=e.start(),s=e.end(),a=(e.startAngle%360+360)%360,l=t.stroke(i*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(n,l))return n;let h=new Set;for(let u of l.primitives){let d=Tt(e,u);if(d>0)for(let p=0;p<d;p+=2){let m=new S(Ee[p],Ee[p+1]);h.add(m)}}if(h.size>0){let u=e.center,d=e.sweep(),p=e.sweepAngle;h.forEach(m=>{let g=(m.angleD(u)%360+360)%360;if(d==le.CCW){let y=(g-a+360)%360;y<p&&(s=m,p=y)}else{let y=(g-a-360)%360;y>p&&(s=m,p=y)}})}return s}}calcuArcArc(t,e,r){let i=t.start(),n=t.end(),s=(t.startAngle%360+360)%360,a=e.stroke(r*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(i,a))return i;let c=new Set;for(let h of a.primitives){let u=Tt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=t.center,u=t.sweep(),d=t.sweepAngle;c.forEach(p=>{let m=(p.angleD(h)%360+360)%360;if(u==le.CCW){let g=(m-s+360)%360;g<d&&(n=p,d=g)}else{let g=(m-s-360)%360;g>d&&(n=p,d=g)}})}return n}getMin(t,e){let r=Number.MAX_VALUE;for(let i of e.primitives){let n=new ir(t,i).getDistance();n<r&&(r=n)}return xe(r,2)}clear(){A6.clear()}};var p3=class{constructor(t){this.bheap=new Array;this.count=0;this.comp=t}size(){return this.count}add(t){this.count>0?this.siftUp(this.count,t):this.bheap[0]=t,this.count++}remove(t){let e=this.bheap.indexOf(t);e>-1&&(this.bheap.splice(e,1),this.count--),this.count<0&&(this.count=0)}poll(){for(;;)if(this.count>0){this.count--;let t=this.bheap[0];return this.count>0&&this.siftDown(0,this.bheap[this.count]),t}else return null}siftUp(t,e){for(;t>0;){let r=t-1>>>1,i=this.bheap[r];if(this.comp(e,i)>=0)break;this.bheap[t]=i,t=r}this.bheap[t]=e}siftDown(t,e){let r=this.count>>>1;for(;t<r;){let i=(t<<1)+1,n=this.bheap[i],s=i+1;if(s<this.count){let a=this.bheap[s];this.comp(n,a)>0&&(i=s,n=a)}if(this.comp(e,n)<=0)break;this.bheap[t]=n,t=i}this.bheap[t]=e}};var wne=class{constructor(t){this.points=new Array;this.line=t}addInters(t){!t.equals1(this.line.start())&&!t.equals1(this.line.end())&&this.points.push(t)}sort(){xr(this.points,(r,i)=>r.distance2(this.line.start())-i.distance2(this.line.start()),0,this.points.length),this.points.push(this.line.end());let t=new Array,e=this.line.start();t.push(e);for(let r of this.points)e.distance2(r)>1e-8&&(t.push(r),e=r);return t}};var Lne=class extends Ll{constructor(){super(...arguments);this.locked=!1}};var PF=class{checkLock(t){return t instanceof o0||t instanceof Lne?t.locked:!1}pointInPolyline(t,e){if(!e.bbox().isContains(t))return!1;let i=[];return e.points(1,n=>{i.push(n)}),this.isSelect(t.x,t.y,i)}isSelect(t,e,r){let i=!1;for(let a=0,l=r.length-1;a<l;a++){let c=r[a],h=r[a+1];if(t==c.x&&e==c.y||t==h.x&&e==h.y)return!0;if(c.y<e&&h.y>=e||c.y>=e&&h.y<e){let u=c.x+(e-c.y)*(h.x-c.x)/(h.y-c.y);if(t==u)return!0;u>t&&(i=!i)}}let n=r[r.length-1],s=r[0];if(t==n.x&&e==n.y||t==s.x&&e==s.y)return!0;if(n.y<e&&s.y>=e||n.y>=e&&s.y<e){let a=n.x+(e-n.y)*(s.x-n.x)/(s.y-n.y);if(t==a)return!0;a>t&&(i=!i)}return i}checkIntersection(t,e){for(let r of t.primitives)for(let i of e.primitives)if(Tt(r,i)>0)return!0;return!1}checkAroundStartpoint(t,e,r){let i=e.path[0].sub(e.path[1]).normalize(),n=e.path[0].add(i.mul(r+e.tracks[0].width/2)),s=fe.build4(t);for(let a of s.primitives)if(a instanceof M){let l=a.end().sub(a.start()).normalize(),c=n.sub(a.start()).normalize(),h=l.cross(c),u=c.dot(i);if(ne.eq(h,0)&&ne.eq(u,0))return!0}return!1}};var no=class{constructor(){this._arcFirst=!1}get arcFirst(){return this._arcFirst}set arcFirst(t){this._arcFirst=t}degree45Model(t,e){let r=e.sub(t),i=Math.abs(r.x),n=Math.abs(r.y),s;if(i>n){let a=r.x/i*n;s=new S(a,r.y)}else if(i==n)s=r;else{let a=r.y/n*i;s=new S(r.x,a)}return[t.add(s),e.sub(s)]}degree90Model(t,e){let r=e.sub(t),i=new S(r.x,0);return[t.add(i),e.sub(i)]}degree45(t,e,r){let i=this.degree45Model(e,r),n=i[0].sub(e);if(ne.eq(n.x,0)&&ne.eq(n.y,0))return[e,i[1],r];let s=i[1].sub(e);if(ne.eq(s.x,0)&&ne.eq(s.y,0))return[e,i[0],r];n=n.normalize(),s=s.normalize();let a=Math.acos(t.dot(n)),l=Math.acos(t.dot(s));return a>l?[e,i[1],r]:[e,i[0],r]}degree90(t,e,r){let i=this.degree90Model(e,r),n=i[0].sub(e).normalize();if(ne.eq(n.x,0)&&ne.eq(n.y,0))return[e,i[1],r];let s=i[1].sub(e).normalize();if(ne.eq(s.x,0)&&ne.eq(s.y,0))return[e,i[0],r];let a=Math.acos(t.dot(n)),l=Math.acos(t.dot(s));return a>l?[e,i[1],r]:[e,i[0],r]}arc(t,e,r){return new ro().tangentToArc(t,e,r)}arc90(t,e,r){let i=this.degree45(t,e,r),n=i[1].sub(i[0]);return Math.abs(n.x)<1e-5||Math.abs(n.y)<1e-5?this.arcFirst=!1:this.arcFirst=!0,i}arc45(t,e,r){let i=this.degree45(t,e,r),n=i[1].sub(i[0]).length(),s=i[2].sub(i[1]).length(),a,l=n-s;return ne.greater(l,0)?(this.arcFirst=!1,a=i[1].sub(i[0]).normalize().mul(l).add(i[0])):(this.arcFirst=!0,a=i[2].sub(i[1]).normalize().mul(l).add(i[2])),[e,a,r]}};var GSe=Math.PI/4;var eD=Math.sqrt(2)/2,bLi=Math.cos(GSe/2),PLi=Math.cos(GSe),kSe=new S(1,1).normalize(),BSe=new S(-1,1).normalize(),FSe=new S(-1,-1).normalize(),VSe=new S(1,-1).normalize(),ll=class o{static OctagonalHull(t,e,r,i){let n=new Array;return n.push(new S(t.x-r,t.y-r+i)),n.push(new S(t.x-r+i,t.y-r)),n.push(new S(t.x+e.x+r+i,t.y-r)),n.push(new S(t.x+e.x+r,t.y-r+i)),n.push(new S(t.x+e.x+r,t.y+e.y+r-i)),n.push(new S(t.x+e.x+r-i,t.y+e.y+r)),n.push(new S(t.x-r+i,t.y+e.y+r)),n.push(new S(t.x-r,t.y+e.y+r-i)),fe.build4(n).asClose()}static OctagonalHull1(t,e){let r=new Array,i=GSe,n=S.getVector2(Math.PI/8),s=0;for(;s<8;){let a=t.add(n.mul(e));r.push(a),n=n.rotate(S.ORIGIN,i),s++}return fe.build4(r).asClose()}static segmentHull(t,e,r){let i=t.width/2+e,n=i/(.5+Math.sqrt(.5))/2,a=t.end.sub(t.start).normalize().angle(S.ORIGIN),l=Ae.rotateZ(a),c=new S(i,0).multiply4(l),h=new S(0,i).multiply4(l),u=new S(n,0).multiply4(l),d=new S(0,n).multiply4(l),p=t.start,m=t.end,g=p.sub(h).sub(u),y=p.sub(c).sub(d),b=p.sub(c).add(d),P=p.add(h).sub(u),T=m.add(h).add(u),I=m.add(c).add(d),C=m.add(c).sub(d),E=m.sub(h).add(u);return fe.build4([g,y,b,P,T,I,C,E,g])}static getLineHull(t,e){let r=t.start(),i=t.end(),s=i.sub(r).normalize().angle(S.ORIGIN),a=Ae.rotateZ(s),l=e/(.5+Math.sqrt(.5))/2,c=new S(e,0).multiply4(a),h=new S(0,e).multiply4(a),u=new S(l,0).multiply4(a),d=new S(0,l).multiply4(a),p=r.sub(h).sub(u),m=r.sub(c).sub(d),g=r.sub(c).add(d),y=r.add(h).sub(u),b=i.add(h).add(u),P=i.add(c).add(d),T=i.add(c).sub(d),I=i.sub(h).add(u);return fe.build4([p,I,T,P,b,y,g,m,p])}static convexHull1(t,e){let r=t.bbox().extendOfSize(e),i=new M(r.LL(),r.UL()),n=new M(r.LL(),r.LR()),s=new M(r.LR(),r.UR()),a=new M(r.UR(),r.UL()),l=Math.max(r.height(),r.width()),c=new S(l,l),h=new S(-l,l),u=new M(r.LL().sub(h),r.LL().add(h)),d=new M(r.LR().sub(c),r.LR().add(c)),p=new M(r.UR().sub(h),r.UR().add(h)),m=new M(r.UL().sub(c),r.UL().add(c)),g=(o.getMinDistance(u,t,r.LL(),e)-e)*eD,y=(o.getMinDistance(d,t,r.LR(),e)-e)*eD,b=(o.getMinDistance(p,t,r.UR(),e)-e)*eD,P=(o.getMinDistance(m,t,r.UL(),e)-e)*eD,T=new S(g,g),I=new S(-y,y),C=new S(-b,-b),E=new S(P,-P),O=new M(u.start().add(T),u.end().add(T)),_=new M(d.start().add(I),d.end().add(I)),R=new M(p.start().add(C),p.end().add(C)),v=new M(m.start().add(E),m.end().add(E));Tt(O,i);let D=new S(Ee[0],Ee[1]);Tt(O,n);let w=new S(Ee[0],Ee[1]);Tt(_,n);let F=new S(Ee[0],Ee[1]);Tt(_,s);let H=new S(Ee[0],Ee[1]);Tt(R,s);let z=new S(Ee[0],Ee[1]);Tt(R,a);let G=new S(Ee[0],Ee[1]);Tt(v,a);let W=new S(Ee[0],Ee[1]);Tt(v,i);let L=new S(Ee[0],Ee[1]);return fe.build4([D,w,F,H,z,G,W,L,D])}static convexHull(t,e){let r=null,i=null,n=null,s=null;function a(W){(r==null||W.sub(r).dot(BSe)>0)&&(r=W)}function l(W){(i==null||W.sub(i).dot(kSe)>0)&&(i=W)}function c(W){(n==null||W.sub(n).dot(FSe)>0)&&(n=W)}function h(W){(s==null||W.sub(s).dot(VSe)>0)&&(s=W)}function u(W){for(let L of W)a(L),l(L),c(L),h(L)}let d=null;for(let W of t.primitives)W instanceof M?u([W.start()]):W instanceof q&&u(o.getArcPoint(W)),d=W;d!=null&&u([d.end()]);let p=t.bbox().extendOfSize(e),m=new M(p.LL(),p.UL()),g=new M(p.LL(),p.LR()),y=new M(p.LR(),p.UR()),b=new M(p.UR(),p.UL()),P=Math.max(p.height(),p.width()),T=new S(P,P),I=new S(-P,P),C=new M(n.sub(I).add(FSe.mul(e)),n.add(I).add(FSe.mul(e))),E=new M(s.sub(T).add(VSe.mul(e)),s.add(T).add(VSe.mul(e))),O=new M(i.sub(I).add(kSe.mul(e)),i.add(I).add(kSe.mul(e))),_=new M(r.sub(T).add(BSe.mul(e)),r.add(T).add(BSe.mul(e)));Tt(C,m);let R=new S(Ee[0],Ee[1]);Tt(C,g);let v=new S(Ee[0],Ee[1]);Tt(E,g);let D=new S(Ee[0],Ee[1]);Tt(E,y);let w=new S(Ee[0],Ee[1]);Tt(O,y);let F=new S(Ee[0],Ee[1]);Tt(O,b);let H=new S(Ee[0],Ee[1]);Tt(_,b);let z=new S(Ee[0],Ee[1]);Tt(_,m);let G=new S(Ee[0],Ee[1]);return fe.build4([R,v,D,w,F,H,z,G,R])}static convexHullPoints(t,e){let r=t.bbox().extendOfSize(e),i=new M(r.LL(),r.UL()),n=new M(r.LL(),r.LR()),s=new M(r.LR(),r.UR()),a=new M(r.UR(),r.UL()),l=Math.max(r.height(),r.width()),c=new S(l,l),h=new S(-l,l),u=new M(r.LL().sub(h),r.LL().add(h)),d=new M(r.LR().sub(c),r.LR().add(c)),p=new M(r.UR().sub(h),r.UR().add(h)),m=new M(r.UL().sub(c),r.UL().add(c)),g=(o.getMinDistance(u,t,r.LL(),e)-e)*eD,y=(o.getMinDistance(d,t,r.LR(),e)-e)*eD,b=(o.getMinDistance(p,t,r.UR(),e)-e)*eD,P=(o.getMinDistance(m,t,r.UL(),e)-e)*eD,T=new S(g,g),I=new S(-y,y),C=new S(-b,-b),E=new S(P,-P),O=new M(u.start().add(T),u.end().add(T)),_=new M(d.start().add(I),d.end().add(I)),R=new M(p.start().add(C),p.end().add(C)),v=new M(m.start().add(E),m.end().add(E));Tt(O,i);let D=new S(Ee[0],Ee[1]);Tt(O,n);let w=new S(Ee[0],Ee[1]);Tt(_,n);let F=new S(Ee[0],Ee[1]);Tt(_,s);let H=new S(Ee[0],Ee[1]);Tt(R,s);let z=new S(Ee[0],Ee[1]);Tt(R,a);let G=new S(Ee[0],Ee[1]);Tt(v,a);let W=new S(Ee[0],Ee[1]);Tt(v,i);let L=new S(Ee[0],Ee[1]);return[D,w,F,H,z,G,W,L]}static getArcPoint(t){if(t.isCircle()){let c=new Array;c.push(t.start());for(let h=0;h<8;h++){let u=t.pointOn(h*45);c.push(u)}return c}let e=t.sweep()==le.CW,r=e?t.endAngle():t.startAngle;r=(r+360)%360;let i=e?t.startAngle:t.endAngle();i=(i+360)%360;let n=r/45,s=i/45,a=new Array;if(n>s){for(let h=Math.ceil(n);h<8;h++)a.push(h);let c=Math.floor(s);for(let h=0;h<=c;h++)a.push(h)}else if(n<s){let c=Math.floor(s);for(let h=Math.ceil(n);h<=c;h++)a.push(h)}let l=new Array;l.push(t.start());for(let c of a){let h=t.pointOn(c*45);l.push(h)}return l}static getMinDistance(t,e,r,i){let n=Number.MAX_VALUE,s=null;for(let a of e.primitives)if(s=a.bbox().extendOfSize(i),s.isContainsX1(r.x)||s.isContainsY1(r.y)){let c=new ir(t,a).getDistance();c<n&&(n=c)}return n}static getArcHull(t,e){return o.getArcStroke(t,e,"45")}static getArcRect(t,e){return o.getArcStroke(t,e,"90")}static getArcStroke(t,e,r){let i=t.rx+e,n=t.rx-e;n<=0&&(n=.001);let s=t.sweep()==le.CCW,a=s?t.pointOn(t.endAngle()):t.pointOn(t.startAngle),l=s?t.pointOn(t.startAngle):t.pointOn(t.endAngle()),c=s?t.startAngle:t.startAngle+t.sweepAngle,h=s?t.sweepAngle:-t.sweepAngle,u=q.build3(t.center,c,h,i,i),d=u.pointOn(u.endAngle()).angleD(a),p=q.build3(a,d,180,e,e),m=q.build3(t.center,c+h,-h,n,n),g=m.pointOn(m.endAngle()).angleD(l),y=q.build3(l,g,180,e,e),b=o.points(u,.1),P=o.points(p,.1),T=m.points(.1),I=o.points(y,.1),C=b.concat(P).concat(T).concat(I),E=new Array,O=null,_=new no;for(let R of C){if(O!=null){let v=r=="45"?_.degree45Model(O,R):_.degree90Model(O,R),D=R.sub(O).normalize().cross(v[0].sub(O).normalize());ne.lesseq(D,0)?(o.add2Result(E,O,v[0]),o.add2Result(E,v[0],R)):(o.add2Result(E,O,v[1]),o.add2Result(E,v[1],R))}O=R}return E}static add2Result(t,e,r){e.equals1(r)||t.push(new M(e,r))}static points(t,e){let r=t.rx+e,i=t.rx/r,n=Math.ceil(Math.abs(t.sweepAngle/Ht.toDegrees(Math.acos(i))/2)),s=t.sweepAngle/n,a=[],l=t.startAngle+s,c=Ht.toRadians(s/2),h=Math.cos(c),u=Math.sin(c),d=(1-h)*t.rx;a.push(t.start());let p=a[0],m,g=new S(1,0),y=new S(0,1),b=new S(1,1).normalize();for(let P=1;P<=n;P++,l+=s){m=t.center.add(new S(t.rx*Math.cos(Ht.toRadians(l)),t.rx*Math.sin(Ht.toRadians(l))));let T=u*p.distance1(m),I=m.sub(p),C=new S(Math.abs(I.x),Math.abs(I.y));if(ne.less(Math.abs(C.cross(g)),T)||ne.less(Math.abs(C.cross(y)),T)||ne.less(Math.abs(C.cross(b)),T)){let E=l-s/2,_=t.center.add(new S(r*Math.cos(Ht.toRadians(E)),r*Math.sin(Ht.toRadians(E)))).sub(t.center).normalize().mul(d),R=m.sub(p).normalize().mul(d);a.push(p.add(_).add(R)),a.push(m.add(_).add(R.mul(-1)))}a.push(m),p=m}return a.pop(),a.push(t.end()),a}};var Q3t=0;function Ku(o){if(o.length>2){let t=o[0],e=new Array;e.push(t);for(let r=1,i=o.length;r<i;r++){let n=o[r],s=!1;if(r+1<i){let a=n.sub(t).normalize(),l=o[r+1].sub(t).normalize(),c=a.cross(l);Math.abs(c)<1e-8&&(s=!0)}s||(e.push(n),t=n)}return e}else return o}var TF=class{constructor(){this.check=new PF}filterRepeat(t){let e=new Array,r=null;for(let i of t)(r==null||r.distance2(i)>1e-8)&&(e.push(i),r=i);return e}aroundHull(t,e,r){if(!Array.isArray(e)||e.length<2)return e;e=this.filterRepeat(e);let i=this.convertPath(e),n=this.convertPolyline(t,r),s=this.getSides(i),a=this.getSides(n),l=this.intersection(s,a),c=this.getEndpoint(s),h=this.getEndpoint(a),u=new Array,d=null;l=this.filterInters(c,h,l);let p=l[l.length-1];for(let m of c)if(d==null)if(this.has(l,m)&&m.distance2(p)>1e-8){this.deletePoint(l,m),u.push(m);let g=!1;for(;;){let y=!1;for(let b of h){if(g)if(this.has(c,b)){u.push(b),d=b,y=!0;break}else u.push(b);b.distance2(m)<1e-8&&(g=!0)}if(y||!g)break}}else u.push(m);else m.distance2(d)<1e-8&&(d=null);return this.reducePoints(u)}convertPolyline(t,e){let r=vh(t);return e==le.CW&&r||e==le.CCW&&!r?t.reverse().primitives:t.primitives}convertPath(t){let e=new Array,r=t[0];for(let i=1,n=t.length;i<n;i++){let s=t[i],a=new M(r,s);e.push(a),r=s}return e}directError(t,e,r){let i=e.indexOf(t);return i>-1&&i+1<e.length&&!this.check.pointInPolyline(t.add(e[i+1]).mul(.5),r)}filterInters(t,e,r){let i=new Array,n=-1,s=new Array;for(let c=0,h=t.length;c<h;c++){let u=t[c];this.has(r,u)&&(c-n==1||s.length>0&&(i.push(s),s=new Array),s.push(u),n=c)}s.length>0&&i.push(s);let a=e.length,l=new Array;for(let c of i)if(c.length>1)for(let h=0,u=c.length;h<u;h++){let d=this.getIndex(e,c[h]);if(d>-1){let p=d+1;p>=a&&(p=0),h+1<u&&e[p].distance2(c[h+1])<1e-8||l.push(c[h])}else l.push(c[h])}else l.push(c[0]);return l}getIndex(t,e){let r=t.indexOf(e);if(r<0){for(let i=0,n=t.length;i<n;i++)if(t[i].distance2(e)<1e-8)return i}return r}intersection(t,e){let r=new Array;for(let i of t)for(let n of e)if(i.line.bbox().isIntersect(n.line.bbox())){let s=Tt(i.line,n.line);for(let a=0;a<s;a+=2){let l=new S(Ee[a],Ee[a+1]);i.addInters(l),n.addInters(l),r.push(l)}}return r}getSides(t){let e=new Array;for(let r of t){let i=new wne(r);e.push(i)}return e}getEndpoint(t){let e=new Array;e.push(t[0].line.start());for(let r of t){let i=r.sort();i.shift(),i.forEach(n=>{e.push(n)})}return e}getPolyline4Sweep(t,e){let r=vh(fe.build4(t));return e==le.CW&&r||e==le.CCW&&!r?t.reverse():t}has(t,e){for(let r of t)if(r.distance2(e)<1e-8)return!0;return!1}deletePoint(t,e){let r=0,i=t.length;for(;r<i&&!(t[r].distance2(e)<1e-8);r++);r<i&&t.splice(r,1)}filter(t){let e=new Array,r=t[0];e.push(r);for(let i=1,n=t.length;i<n;i++){let s=t[i],a=!1;if(i+1<n){let l=s.sub(r).normalize(),c=t[i+1].sub(r).normalize(),h=l.cross(c);Math.abs(h)<1e-8&&(a=!0)}if(!a){let l=t[i];l.distance2(r)>1e-8&&(e.push(l),r=l)}}return r.distance2(t[t.length-1])>1e-8&&e.push(t[t.length-1]),e=this.reducePoints(e),e}reducePoints(t){if(t.length>2){let e=t[0],r=new Array;r.push(e);for(let i=1,n=t.length;i<n;i++){let s=t[i],a=!1;if(i+1<n){let l=s.sub(e).normalize(),c=t[i+1].sub(e).normalize(),h=l.cross(c);Math.abs(h)<1e-8&&(a=!0)}a||(r.push(s),e=s)}return r}else return t}route(t,e,r){let i=t.tracks[0].layer,n=0,s=0;if(t.startVia!=null&&e.checkSolidVia(t.startVia,i)!=null)return 2;if(t.endVia!=null)return e.checkSolidVia(t.endVia,i)!=null?2:1;let a=0,l=this.copyChain(t),c=this.copyChain(t);for(;a<10;){if(n!=2&&(n=this.singleStep(l,e,le.CW)),s!=2&&(s=this.singleStep(c,e,le.CCW)),n==1&&s==1||n==2&&s==2){let u=l.length,d=c.length;u>d?this.replaceChain(t,c.path):this.replaceChain(t,l.path);break}else if(n==1){this.replaceChain(t,l.path);break}else if(s==1){this.replaceChain(t,c.path);break}a++}if(a==10){let u=l.length,d=c.length;u>d?this.replaceChain(t,c.path):this.replaceChain(t,l.path)}return s==1||n==1?1:2}copyChain(t){let e=new cg(t.map);return e.tracks=Array.from(t.tracks),e.path=Array.from(t.path),e}singleStep(t,e,r){let i=e.getSolidObstacle(t);if(i!=null){let n=t.path[t.path.length-1],s=i.shape(t.tracks[0].layer,0);if(s instanceof fe){let a=ll.convexHull(s.asClose(),1+t.tracks[0].width/2);if(this.check.pointInPolyline(n,a)){let c=e.check(t.firstTouchTrack),h=new Ns(t.firstTouchTrack.net,t.firstTouchTrack.layer,t.firstTouchTrack.start,c,t.firstTouchTrack.width,t.firstTouchTrack.id);return t.tracks.pop(),t.path.pop(),t.tracks.push(h),t.path.push(c),1}let l=this.aroundHull(a,t.path,r);return this.replaceChain(t,l),0}}return 2}replaceChain(t,e){let r=t.tracks[0].width,i=t.tracks[0].net,n=t.tracks[0].layer,s=new Array,a=e[0];for(let l=1,c=e.length;l<c;l++){let h=e[l],u=new v0(i,n,a,h,r,"walk"+Q3t++,-1);s.push(u),a=h}t.path.length=0,t.tracks.length=0,t.all.clear(),t.path.push(s[0].start);for(let l of s)t.tracks.push(l),t.all.add(l),t.path.push(l.end)}};var Mne=class{constructor(t){this.walk=new TF;this.hulls=new Array;this.collide=t}onCollideSolid(t,e,r){let i=e.shape(t.tracks[0].layer,0);if(i instanceof fe&&!t.obstacles.has(e)){let n=this.getShapeHulls(e,i,r+t.tracks[0].width/2+.001),s=Array.from(t.path);for(let l of n)s=this.walk.aroundHull(l,s,le.CCW);let a=Array.from(t.path);for(let l of n)a=this.walk.aroundHull(l,a,le.CW);return[{sweep:le.CCW,path:s},{sweep:le.CW,path:a}]}return[]}getShapeHulls(t,e,r){let i=new Array;if(t instanceof of)for(let n of e.primitives){let s=n.stroke(.001,kr.ROUND,le.CW).asClose(),a=ll.convexHull(s,r);i.push(a)}else if(t instanceof Mf)for(let n of e.primitives){let s=n.stroke(t.width,kr.ROUND,le.CW).asClose(),a=ll.convexHull(s,r);i.push(a)}else{let n=ll.convexHull(e,r);i.push(n)}return i}onCollideRope(t,e,r){let i=t.tracks[0].width,n=fe.build4(t.path),s=new M(e.start,e.end),a=i/2+r+e.width/2,l=new Array;for(let h of n.primitives){let u=Tt(h,s);for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);l.push(p)}}xr(l,(h,u)=>h.distance2(e.start)-u.distance2(e.start),0,l.length);let c=s.end().sub(s.start()).normalize();if(l.length>0){let h=new Ll(e.pcbVia.id,e.pcbVia.net,l[l.length-1].add(c.mul(a)),e.pcbVia.holeDiameter,e.pcbVia.topPad,e.pcbVia.innerPad,e.pcbVia.botPad,e.pcbVia.mask,e.pcbVia.unuseLayers);return this.onCollideVia(t,h,r)}else{let h=Number.MAX_VALUE;for(let u of n.primitives){let p=new ir(u,s).getDistance();p<h&&(h=p)}if(h<a){let u=new Ll(e.pcbVia.id,e.pcbVia.net,e.end,e.pcbVia.holeDiameter,e.pcbVia.topPad,e.pcbVia.innerPad,e.pcbVia.botPad,e.pcbVia.mask,e.pcbVia.unuseLayers);return this.onCollideVia(t,u,r)}else return this.onCollideVia(t,e.pcbVia,r)}}onCollideVia(t,e,r){let i=t.tracks[0].width,n=fe.build4(t.path),s=this.fixCenter(t,e),a=new M(s,s),l=Number.MAX_VALUE,c=null,h=i/2+r+e.topPad/2;for(let u of n.primitives){let d=new ir(u,a),p=d.getDistance();if(p<l&&(l=p,c=d.getLine(),l==0)){let m=u.end().sub(u.start()).normalize(),g=new S(-m.y,m.x);return s.add(g.mul(h))}}if(l<h&&c!=null){let u=c.start().distance2(s),d=c.end().distance2(s),p=c.end().sub(c.start()).normalize();return u<d?c.end().sub(p.mul(h)):c.start().add(p.mul(h))}return e.center}fixCenter(t,e){let r=e.center;if(!(t.startVia!=null&&t.endVia!=null)){if(t.startVia!=null){let i=this.collide.getSafeClearance(t.startVia.net,e,5),n=t.startVia.center,s=r,a=t.startVia.topPad/2+i+e.topPad/2,l=s.sub(n);l.length()<a&&(r=n.add(l.normalize().mul(a)))}else if(t.endVia!=null){let i=this.collide.getSafeClearance(t.endVia.net,e,5),n=t.endVia.center,s=r,a=t.endVia.topPad/2+i+e.topPad/2,l=s.sub(n);l.length()<a&&(r=n.add(l.normalize().mul(a)))}}return r}onCollideTrack(t,e,r){let i=t,n=t.tracks[0].width,s=e.getPath();this.hulls.length=0;for(let l of s){let c=ll.segmentHull(l,r+n/2,0);this.hulls.push(c)}let a=this.hulls;for(let l=0;l<4;l++){let c=l>1?le.CW:le.CCW,h=Array.from(i.path);for(let u of a)h=this.walk.aroundHull(u,h,c);if(a=a.reverse(),!this.walk.check.checkIntersection(fe.build4(h),fe.build4(e.path))&&!this.walk.check.checkAroundStartpoint(h,e,1+t.tracks[0].width/2))return{path:h,sweep:c}}return{path:[],sweep:0}}};var IF=class{constructor(t,e){this.map=t,this.result=e}getChain(t,e){if(t instanceof o0){let r=this.result.getSource(t);if(r!=null)return r;let i=t.start,n=e.center,s=new cg(this.map);i.equals(n)?(s.path.push(n),i=t.end):s.path.push(n),s.path.push(i),s.tracks.push(t),s.all.add(t),s.startVia=e,s.getTracks(t.layer,i,e.topPad,e.net,!1);let a=this.result.addSource(s.tracks);s.sourceIndex=a;let l=s.build();return this.result.shovePathMap[a]=l,l}else if(t instanceof v0)return this.result.shovePathMap[t.sourceIndex];return null}modifyVia(t,e){let r=t.center,i=new ut(r.x,r.x,r.y,r.y),n=new Array,s=this.map.getPcbLayers();for(;s.hasNext();){let c=s.next();this.map.getShoveItems(c,i).forEach(u=>{n.push(u)})}let a=new Array,l=new Array;if(r.distance2(e)>2e-8){for(let c of n)if(c instanceof Ns&&(c.start.distance2(r)<2e-8||c.end.distance2(r)<2e-8)&&t.net==c.net){let h=this.getChain(c,t),u=Ku(h.path);if(u.length==1)continue;let d=new Array;r.equals1(u[0])?d=this.repairStart(u,e):d=this.repairEnd(u,e),a.push(h);let p=EGe(h,d,this.map);p.sweep=h.sweep;let m=new Ll(t.id,t.net,e,t.holeDiameter,t.topPad,t.innerPad,t.botPad,t.mask,t.unuseLayers);h.startVia==t||h.startVia!=null&&h.startVia.id==t.id?p.startVia=m:h.endVia==t||h.endVia!=null&&h.endVia.id==t.id?p.endVia=m:h.path[0].equals1(r)?p.startVia=m:h.path[h.path.length-1].equals1(r)&&(p.endVia=m);let g=p.build();l.push(g),this.result.shovePathMap[g.sourceIndex]=g,g.modifyVias.push(m);for(let y of h.modifyVias)y.id!=m.id&&g.modifyVias.push(y)}}return{oldTracks:a,newTracks:l}}repairStart(t,e){let r=new no,i=t[1].sub(t[0]),n=null,s=new Array;if(ne.eq(i.x,0)||ne.eq(i.y,0)){let a=t[1];if(t[2]!=null){a=t[2],s.push(a);for(let c=3,h=t.length;c<h;c++)s.push(t[c])}else s.push(a);let l=r.degree45Model(e,a);ne.eq(e.x,l[0].x)||ne.eq(e.y,l[0].y)?n=l[0]:n=l[1]}else{for(let l=1,c=t.length;l<c;l++)s.push(t[l]);let a=r.degree45Model(e,t[1]);ne.eq(e.x,a[0].x)||ne.eq(e.y,a[0].y)?n=a[0]:n=a[1]}return e.distance2(n)<1e-8?s=Ku([].concat([n],s)):s=Ku([].concat([e],[n],s)),s.length<2&&(s=t),s}repairEnd(t,e){let r=new no,i=t.length,n=t[i-2].sub(t[i-1]),s=null,a=new Array;if(ne.eq(n.x,0)||ne.eq(n.y,0)){let l=t[i-2];if(t[i-3]!=null){l=t[i-3];for(let h=0;h<i-2;h++)a.push(t[h])}else a.push(l);let c=r.degree45Model(l,e);ne.eq(e.x,c[0].x)||ne.eq(e.y,c[0].y)?s=c[0]:s=c[1]}else{for(let c=0;c<i-1;c++)a.push(t[c]);let l=r.degree45Model(t[i-2],e);ne.eq(e.x,l[0].x)||ne.eq(e.y,l[0].y)?s=l[0]:s=l[1]}return e.distance2(s)<1e-8?a=Ku([].concat(a,[s])):a=Ku([].concat(a,[s,e])),a.length<2&&(a=t),a}clear(){A6.clear()}};var Zj=class{constructor(){this.parent=null;this.shoveState=1;this.sourceTrackChain=new Array;this.shovePathMap={};this.ropes=new Array}addSource(t){let e=this.sourceTrackChain.length;return this.sourceTrackChain.push(t),e}getSource(t){for(let e=0,r=this.sourceTrackChain.length;e<r;e++)if(this.sourceTrackChain[e].indexOf(t)>-1)return this.shovePathMap[e];return null}clear(){for(let t in this.shovePathMap)this.shovePathMap[t].clear(),delete this.shovePathMap[t];for(let t of this.sourceTrackChain)t.length=0;this.sourceTrackChain.length=0,this.parent!=null&&(this.parent.clear(),this.parent=null)}};var _6=class extends S{constructor(e){super(e.x,e.y);this.isOrigin=!1}},Nne=class{constructor(){this.needOptimization=!1;this.tool=new no}replacePath(t){let e=new Array;for(let r of t){let i=new _6(r);e.push(i),i.isOrigin=!0}return e}optimizationPolyline(t){let e=[];t.points(.1,s=>{e.push(s)});let r=this.optimization(e),i=this.reducePoints(r);return fe.build4(i)}optimization(t){this.needOptimization=!0;let e=this.replacePath(t),r=new Date().getTime();for(;this.needOptimization;)if(this.needOptimization=!1,e=this.reducePoints(e),e=this.degree45(e),!this.needOptimization||new Date().getTime()-r>100){e=this.reduceOrigin(e);break}return e}reduceOrigin(t){let e=0,r=null,i=new Array,n=new Array;for(let s of t)if(!s.isOrigin)n.push(s),e++;else{if(e>1&&r!=null){let a=this.tool.degree45Model(r,s);a[0].distance2(n[0])<a[1].distance2(n[0])?i.push(new _6(a[0])):i.push(new _6(a[1])),n.length=0,this.needOptimization=!0}else{for(let a of n)i.push(a);n.length=0}e=0,r=s,i.push(s)}return i[0].equals1(t[0])&&i[i.length-1].equals1(t[t.length-1])?i:t}degree45(t){let e=new Array,r=t[0];e.push(r);for(let i=1,n=t.length;i<n;i++){let s=t[i],a=i+1;if(a<n){let l=t[a],c=r.sub(s).normalize(),h=l.sub(s).normalize(),u=c.dot(h);if(ne.greatereq(u,0)){let d=this.tool.degree45Model(r,l);d[0].distance2(s)<d[1].distance2(s)?e.push(new _6(d[0])):e.push(new _6(d[1])),this.needOptimization=!0}else e.push(s)}else e.push(s);r=e[e.length-1]}return e[0].equals1(t[0])&&e[e.length-1].equals1(t[t.length-1])?e:t}reducePoints(t){if(t.length>2){let e=t[0],r=new Array;r.push(e);for(let i=1,n=t.length;i<n;i++){let s=t[i],a=!1;if(i+1<n){let l=s.sub(e).normalize(),c=t[i+1].sub(e).normalize(),h=l.cross(c);Math.abs(h)<1e-8&&(a=!0)}a||(r.push(s),e=s)}return r}else return t}};function vGe(o){return new Array}var v6=class{constructor(t,e,r,i,n){this.inters=new Array;this.shape=t,this.start=e,this.end=r,this.source=i,this.group=n,this._bbox=new _e().ext1(t.bbox()).ext2(e).ext2(r).build1(),this.inters.push(e),this.inters.push(r)}static rebuild(t,e,r){if(e.distance2(r)<1e-6||t instanceof M)return new M(e,r);if(t instanceof q){let i=t,n=e.angleD(i.center),s=r.angleD(i.center);return q.build2(i.center,n,s,i.rx,i.ry,i.sweep())}else throw new Error("not supported operation")}bbox(){return this._bbox}},tOt=1e-7,kne=1e-14,Jj=class{findPath4Sweep(t,e,r){let i=t[0].start(),n=t[t.length-1].end(),s=this.intersection(t,e,r),a=this.split(s),l=this.findConnect(a,i,n,r);for(let c of l)return c;return null}findPath4SweepEnd(t,e,r){let i=t[0].start(),n=t[t.length-1].end(),s=this.intersection(t,e,r),a=this.split(s),l=this.findConnectEnd(a,i,n,r);for(let c of l)return c;return null}intersection(t,e,r){let i=new nn(10),n=0;for(let l of e){let c=vh(l);if(r==le.CCW&&!c||r==le.CW&&c){let u=l.reverse().primitives;for(let d of u)d.start().distance2(d.end())<=kne&&d instanceof M||i.add(new v6(d,d.start(),d.end(),!1,n))}else{let h=l.primitives;for(let u of h)u.start().distance2(u.end())<=kne&&u instanceof M||i.add(new v6(u,u.start(),u.end(),!1,n))}n++}for(let l of t)l.start().distance2(l.end())<=kne&&l instanceof M||i.add(new v6(l,l.start(),l.end(),!0,n));let s=new Set,a=i.itemList;for(let l of a){s.add(l);let c=l.bbox().extendOfSize(1e-5);for(let h of i.search(c))if(!s.has(h)&&l.group!=h.group){let u=Tt(l.shape,h.shape);for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);l.inters.push(p),h.inters.push(p)}}}return s.clear(),a}toArray(t){let e=new Array,r=t.iterator();for(;r.hasNext();){let i=r.next();e.push(i)}return e}split(t){let e=new Array;for(let r of t){let i=r.start,n=r.end,s=r.inters;dn(s,r.shape);let a=null;for(let l of s)if(a==null)l.equals1(i)&&(a=l);else if(!l.equals1(a)){let c=v6.rebuild(r.shape,a,l);if(e.push(new v6(c,a,l,r.source,r.group)),l.equals1(n))break;a=l}}return e}findConnect(t,e,r,i){let n=new Bd,s=new nn(10);for(let T of t)n.computeIfAbsent(T.start,vGe).push(T),s.add(T.start);let a={},l=new Array,c=new Array,h=new Ba,u=new On,d=new Ba,p=new On,m=new On,g=Number.MAX_VALUE,y=this.findNexts(e,n,d,s),b=this.findNext(a,y,i,u);if(b==null)return l;u.add(b),this.add(a,b);let P=b.end;for(b.source&&(h.add(P),p.add(b));u.size()>0;)if(this.isStart(r,P)){if(u.size()>0){let T=this.fillSideGroups(u,0);l.push(T)}break}else{let T=this.findNexts(P,n,d,s),I=this.findNext(a,T,i,u);if(I==null&&(P=this.findNeigber(P,d,s,.01),P!==null&&(T=this.findNexts(P,n,d,s),I=this.findNext(a,T,i,u))),I!=null){if(u.add(I),this.add(a,I),P=I.end,I.source)p.clear(),this.copyTo(u,p);else if(h.contains(P)){if(m.size()>0){let E=this.fillSideGroups(m,0);l.push(E)}else if(p.size()>0){let E=this.fillSideGroups(p,0);l.push(E)}break}h.add(P);let C=P.distance2(r);C<g&&(g=C,m.clear(),this.copyTo(u,m))}else if(P!=null?d.add(P):c.push(u.removeLast()),u.size()>0)P=u.getLast().end;else break}return l}findConnectEnd(t,e,r,i){let n=new Bd,s=new nn(10);for(let g of t)n.computeIfAbsent(g.start,vGe).push(g),s.add(g.start);let a={},l=new Array,c=new Array,h=new On,u=new Ba,d=this.findNexts(e,n,u,s);if(d.length==0)return l;let p=this.findNext(a,d,i,h);h.add(p),this.add(a,p);let m=p.end;for(;h.size()>0;)if(this.isStart(r,m)){if(h.size()>0){let g=this.fillSideGroups(h,0);l.push(g)}break}else{let g=this.findNexts(m,n,u,s),y=this.findNext(a,g,i,h);if(y==null&&(m=this.findNeigber(m,u,s,.01),m!==null&&(g=this.findNexts(m,n,u,s),y=this.findNext(a,g,i,h))),y!=null)h.add(y),this.add(a,y),m=y.end;else if(m!=null?u.add(m):c.push(h.removeLast()),h.size()>0)m=h.getLast().end;else break}return l}add(t,e){if(e==null)return;let r=t[e.group];r==null&&(r=new Set,t[e.group]=r),r.add(e)}has(t,e){if(e==null)return!1;let r=t[e.group];return r==null?!1:r.has(e)}copyTo(t,e){let r=t.iterator();for(;r.hasNext();){let i=r.next();e.add(i)}}isStart(t,e){return t.distance2(e)<=1e-4}findNexts(t,e,r,i){let n=new Ba,s=i.search(t.bbox().extendOfSize(tOt));for(let c of s)r.contains(c)||t.distance2(c)<kne&&n.add(c);let a=[],l=n.iterator();for(;l.hasNext();){let c=l.next(),h=e.get(c);Re.addAll(a,h)}return a}findNext(t,e,r,i){if(e!=null){let n=null,s=null;for(let a of e){let l=this.getDirect(a);if(!this.has(t,a))if(n==null&&s==null)n=a,s=l;else{let c=s.cross(l);if(r==le.CCW&&ne.less(c,0))n=a,s=l;else if(r==le.CW&&ne.greater(c,0))n=a,s=l;else if(ne.eq(c,0)&&i.size()>0){let h=i.getLast(),u=this.getDirect(h,!0),d=u.cross(l),p=u.cross(s);r==le.CCW?d<p&&(n=a,s=l):d>p&&(n=a,s=l)}}}return n}return null}getDirect(t,e=!1){let r=t.shape;if(r instanceof M)return r.direct;if(r instanceof q){let n=(e?r.end():r.start()).sub(r.center).normalize();return r.sweep()==le.CCW?new S(-n.y,n.x):new S(n.y,-n.x)}else return new S(1,0)}fillSideGroups(t,e){let r=[];return kI(t,(i,n)=>(r.push(n.shape),!0)),fe.build2(r)}findNeigber(t,e,r,i){let n=i*i,s=Number.MAX_VALUE,a=null;for(let l of r.search(t.bbox().extendOfSize(i)))if(!e.contains(l)){let c=t.distance2(l);c<s&&(s=c,a=l)}return s<n?a:null}},LMi=new Jj;var USe=class{constructor(t,e){this.oldPath=t,this.chain=e}get length(){let t=0,e=this.oldPath[0];for(let r=1,i=this.oldPath.length;r<i;r++){let n=this.oldPath[r];t+=e.distance1(n),e=n}return t}};function xGe(o,t){let e=o.length-t.length;return e==0?o.path.length-t.path.length:e}function rOt(o,t){let e=o.length-t.length;return e==0?xGe(o.chain,t.chain):e}var iOt=0,Bne=class{constructor(){this.lineStack=new Array;this.walk=new TF;this.collide=new Dne;this.hulls=new Array;this.vias=new Set;this.ropes=new Array;this.helpLine=new Array;this.step=new Mne(this.collide);this.viaConnectChains=new Array;this.previewTrack=new Set;this.collideTracks=new Set;this.tracks=new Set;this.route=new Nne;this.result=new Zj;this.time=0;this.place=!0;this.debug=!1;this.logger=new Gi(1)}convertPath(t){let e=new cg(this.collide.map);e.path.push(t[0].start);for(let i of t){let n=vne(i);e.tracks.push(n),e.all.add(n),e.path.push(n.end)}return e.sourceIndex=0,e.build()}convertPathVia1(t){let e=new Array,r=null,i=null,n=[];for(let a of t)if(a instanceof Ns)e.push(a);else if(a instanceof Ge){let l=new Ll(a.globalIndex,a.net,a.center,a.holeRadius*2,a.radius*2,a.radius*2,a.radius*2,!1,aC(sC(a.unusedInnerLayers)));if(e.length==0)r=l;else{i=l;let c=new cg(this.collide.map);c.path.push(e[0].start);for(let h of e)c.tracks.push(h),c.all.add(h),c.path.push(h.end);r!=null&&(c.startVia=r),i!=null&&(c.endVia=i),c.sourceIndex=0,n.push(c.build()),r=l,i=null,e.length=0}}let s=new cg(this.collide.map);s.path.push(e[0].start);for(let a of e)s.tracks.push(a),s.all.add(a),s.path.push(a.end);return r!=null&&(s.startVia=r),i!=null&&(s.endVia=i),s.sourceIndex=0,n.push(s.build()),e.length=0,n}convertPathVia(t){let e=new Array,r=null,i=null,n=[];for(let a of t)if(a instanceof $d)e.push(a);else if(a instanceof Ge){let l=new Ll(a.globalIndex,a.net,a.center,a.holeRadius*2,a.radius*2,a.radius*2,a.radius*2,!1,aC(sC(a.unusedInnerLayers)));if(e.length==0)r=l;else{i=l;let c=new cg(this.collide.map);c.path.push(e[0].start);for(let h of e){let u=vne(h);c.tracks.push(u),c.all.add(u),c.path.push(u.end)}r!=null&&(c.startVia=r),i!=null&&(c.endVia=i),c.sourceIndex=0,n.push(c.build()),r=l,i=null,e.length=0}}let s=new cg(this.collide.map);s.path.push(e[0].start);for(let a of e){let l=vne(a);s.tracks.push(l),s.all.add(l),s.path.push(l.end)}return r!=null&&(s.startVia=r),i!=null&&(s.endVia=i),s.sourceIndex=0,n.push(s.build()),e.length=0,n}resetLastMap(t){if(t!=null)for(let e=1,r=t.sourceTrackChain.length;e<r;e++)this.result.sourceTrackChain.push(t.sourceTrackChain[e]),this.result.shovePathMap[e]=t.shovePathMap[e],this.remove4Rtree(t.sourceTrackChain[e]),this.add4Rtree([t.shovePathMap[e]])}resetMap(){this.add4Rtree(Array.from(this.collideTracks)),this.remove4Rtree(Array.from(this.previewTrack)),this.remove4Rtree(Array.from(this.tracks))}init(t,e){this.time=new Date().getTime(),this.clear();let r=this.result;this.result=new Zj,this.result.sourceTrackChain.splice(0,0,t.tracks),this.result.shovePathMap[0]=t,this.resetLastMap(e),this.remove4Rtree([t]),this.result.parent=r}shoveMain(t,e){let r=!0;this.init(t,e),t=this.walkObstacle(t),this.add4Rtree([t]),this.lineStack.push(t.sourceIndex);let i=0;do{if(this.shoveLineMain(),this.hasObstacle(this.result.shovePathMap[t.sourceIndex]))this.lineStack.push(t.sourceIndex);else break;if(!this.debug&&new Date().getTime()-this.time>200){this.result.shoveState=2,this.logger.debug1("1-time out!");break}if(this.result.shoveState==2)break;i++}while(i<100);if(this.result.shoveState==2){let n=this.result.parent;this.remove4Rtree(this.ropes),this.add4Rtree(Array.from(this.vias));let s=this.getVia4Ropes(n.ropes);this.remove4Rtree(Array.from(s)),this.add4Rtree(n.ropes),this.ropes.length=0;for(let a of n.ropes)a.previewVia(),this.ropes.push(a),this.result.ropes.push(a);this.result=n,r=!1}else this.previewVia();return this.resetMap(),this.viaConnectChains.length=0,this.lineStack.length=0,this.previewTrack.clear(),this.collideTracks.clear(),this.tracks.clear(),r}shove(t){let e=this.convertPath(t);this.shoveMain(e)}walkObstacle(t){let e=0,r=new p3(rOt),i=!0,n=t;for(;i&&e<100;){this.hulls.length=0;let s=this.getSolidObstacle(n);if(s!=null){if(!n.obstacles.has(s)){let l=this.collide.getSafeClearance(n.tracks[0].net,s),c=s.shape(n.tracks[0].layer,0);if(c instanceof fe){let u=this.getShapeHulls(s,c,l);if(this.pointInHulls(n.path[0],u)){if(!this.place){this.result.shoveState=2;break}let d=[n.path[0],n.path[0]];n=this.getNewChain(n,d),i=!1;break}if(this.pointInHulls(n.path[n.path.length-1],u)){if(!this.place){this.result.shoveState=2;break}let d=new Array;d.push(n.path[0]);for(let m=0,g=n.tracks.length;m<g;m++){let y=n.path[m+1],b=n.tracks[m];this.collide.adsorp=null;let P=this.collide.checkObstacle(b);if(this.collide.adsorp!=null){d.push(y,P);break}else d.push(y)}n=this.getNewChain(n,d),e++;continue}}let h=this.step.onCollideSolid(n,s,l);for(let u of h){let d=u.path;d=this.route.optimization(d);let p=this.getChainFactory(n,d);p.sweep=u.sweep;let m=p.build(),g=new USe(u.path,m);r.add(g);for(let y of n.obstacles)m.obstacles.add(y);m.obstacles.add(s)}}let a=this.findMinNodePath1(r);a!=null&&(n=a.chain)}else break;e++}return this.hulls.length=0,this.result.shovePathMap[n.sourceIndex]=n,n}pointInHulls(t,e){for(let r of e)if(this.walk.check.pointInPolyline(t,r))return!0;return!1}getShapeHulls(t,e,r){let i=new Array;if(t instanceof of)for(let n of e.primitives){let s=n.stroke(1e-5,kr.ROUND,le.CW).asClose(),a=ll.convexHull(s,r);i.push(a)}else if(t instanceof Mf)for(let n of e.primitives){let s=n.stroke(t.width,kr.ROUND,le.CW).asClose(),a=ll.convexHull(s,r);i.push(a)}else{let n=ll.convexHull(e,r);i.push(n)}return i}findMinNodePath1(t){for(;;){let e=t.poll();return e===null?null:(t.remove(e),e)}}findMinNodePath(t){for(;;){let e=t.poll();return e===null?null:(t.remove(e),e)}}remove4Rtree(t){t.forEach(e=>{e instanceof QS?e.tracks.forEach(r=>{r instanceof o0?this.collideTracks.add(r):r instanceof v0?this.previewTrack.delete(r):r instanceof Ns&&this.tracks.delete(r),this.collide.map.removeShape4RTree(r)}):(e instanceof o0?this.collideTracks.add(e):e instanceof v0?this.previewTrack.delete(e):e instanceof Ns&&this.tracks.delete(e),this.collide.map.removeShape4RTree(e))})}add4Rtree(t){t.forEach(e=>{if(e instanceof QS)e.tracks.forEach(r=>{if(r instanceof v0){if(this.previewTrack.has(r))return;this.previewTrack.add(r)}else if(r instanceof o0){if(!this.collideTracks.has(r))return;this.collideTracks.delete(r)}else r instanceof Ns&&this.tracks.add(r);this.collide.map.addShape2RTree(r)});else{if(e instanceof v0){if(this.previewTrack.has(e))return;this.previewTrack.add(e)}else if(e instanceof o0){if(!this.collideTracks.has(e))return;this.collideTracks.delete(e)}else e instanceof Ns&&this.tracks.add(e);this.collide.map.addShape2RTree(e)}})}clear(){this.helpLine.forEach(t=>{t.remove()}),this.helpLine.length=0,this.ropes.forEach(t=>{t.removePreviewVia()}),this.vias.clear()}shoveLineMain(){let t=0;for(;this.lineStack.length>0;){this.hulls.length=0;let e=this.lineStack.shift(),r=this.result.shovePathMap[e];if(this.getSolidObstacle(r)!=null?this.onCollideSolid(r):(this.repair4Rope(r),r=this.result.shovePathMap[r.sourceIndex],this.deleteViaConnectChain(r.sourceIndex),this.onCollideVia(r),this.onCollideTrack(r)),t++,this.lineStack.length>300){this.result.shoveState=2;return}if(t>=100){this.result.shoveState=2;return}if(this.lineStack.length==0&&this.viaConnectChains.length>0){let n=this.viaConnectChains.shift();this.lineStack.push(n)}if(!this.debug&&new Date().getTime()-this.time>200&&(this.result.shoveState=2,this.logger.debug1("7-walk solid time out!")),this.result.shoveState==2)break}}previewVia(){for(let i of this.ropes)i.reset();let t=new Array,e=new Set,r=new Set;for(let i of this.ropes)this.vias.has(i.pcbVia)?t.push(i):(i.visibleVia(),r.add(i),e.add(i.pcbVia));this.remove4Rtree(Array.from(r)),this.add4Rtree(Array.from(e)),this.ropes.length=0;for(let i of t)i.previewVia(),this.ropes.push(i),this.result.ropes.push(i)}getRope(t,e=!0){for(let r of this.ropes)if(!e&&r.start.distance2(t.path[0])<1e-4||e&&r.start.distance2(t.path[t.path.length-1])<1e-4)return r;return null}repair4Rope(t){for(let e=0;e<2;e++){let r=e==0,i=this.getRope(t,r);if(i==null)return t;{let n=new IF(this.collide.map,this.result),s=i.end,a=i.getRopeStart();if(a.distance2(s)>1e-4){let l=new Ll(i.id,i.net,a,i.pcbVia.holeDiameter,i.pcbVia.topPad,i.pcbVia.innerPad,i.pcbVia.botPad,i.pcbVia.mask,i.pcbVia.unuseLayers),c=n.modifyVia(l,s);this.remove4Rtree(c.oldTracks),this.add4Rtree(c.newTracks),this.updateViaConnectChain(c),this.vias.add(i.pcbVia),i.used()}}}}checkPointInHulls(t){for(let e of this.hulls)if(this.walk.check.pointInPolyline(t,e))return!0;return!1}onCollideTrack(t){let e=new Array,r=this.getObstacle(t);for(;r instanceof QS;){let i=this.lineStack.indexOf(r.sourceIndex);this.repair4Rope(r),r=this.result.shovePathMap[r.sourceIndex],this.hulls.length=0,this.deleteViaConnectChain(r.sourceIndex),this.addHull(r,t);let n=!1;if(this.checkPointInHulls(r.path[0])&&(n=!0),!n&&this.checkPointInHulls(r.path[r.path.length-1])&&(n=!0),!n){let s=this.collideTrack(r,t);if(s.length>0){this.add4Rtree(s);let a=e.indexOf(r.sourceIndex);a>-1&&e.splice(a,1);for(let l of s)l.updateModifyPath(this.result),i<0&&e.push(l.sourceIndex);this.remove4Rtree([r])}else{this.result.shoveState=2,this.logger.debug3("23-collide track around fail:track start in hulls:%s,%s,%s,%s,",t,r,this.hulls,this.result);break}}if(n){if(this.hulls.length=0,this.addHull(t,r),this.checkPointInHulls(t.path[0])){this.result.shoveState=2,this.logger.debug3("8-collide track around fail:track start in hulls:%s,%s,%s,%s,",t,r,this.hulls,this.result);break}if(this.checkPointInHulls(t.path[t.path.length-1])){this.result.shoveState=2,this.logger.debug3("9-collide track around fail:track end in hulls:%s,%s,%s,%s,",t,r,this.hulls,this.result);break}let s=this.collideSolidSweep(t,t.sweep,fe.build4(r.path));s.length>0?(this.add4Rtree(s),this.remove4Rtree([t]),t=s[0],t.updateModifyPath(this.result),this.result.shovePathMap[t.sourceIndex]=t,this.getSolidObstacle(t)!=null&&(this.logger.debug1("20-collide track around fail:track end in hulls"),this.result.shoveState=2)):(this.result.shoveState=2,this.logger.debug3("10-collide track around fail:not path %s , %s, %s",t,r,this.result))}if(r=this.getObstacle(t),!this.debug&&new Date().getTime()-this.time>200&&(this.result.shoveState=2,this.logger.debug1("10-collide track time out")),this.result.shoveState==2)break}for(let i of e)this.lineStack.push(i);this.logger.debug2(this.lineStack)}onCollideVia(t){let e=new Array,r=this.getViaObstacle(t);for(;r!=null;){if(r instanceof Ll){let i=this.collide.getSafeClearance(t.tracks[0].net,r),n=this.step.onCollideVia(t,r,i);if(n.distance2(r.center)>1e-4){let a=new IF(this.collide.map,this.result).modifyVia(r,n);this.remove4Rtree(a.oldTracks),this.add4Rtree(a.newTracks),this.updateViaConnectChain(a),this.vias.add(r);let l=new oC(r.net,r.layer,r.center,n,r.topPad,r.id);this.remove4Rtree([r]),e.push(l),l.pcbVia=r}else{this.remove4Rtree([r]);let s=new oC(r.net,r.layer,r.center,n,r.topPad,r.id);e.push(s),s.pcbVia=r}}else if(r instanceof oC){let i=this.collide.getSafeClearance(t.tracks[0].net,r.pcbVia),n=new Ll(r.id,r.net,r.end,r.pcbVia.holeDiameter,r.pcbVia.topPad,r.pcbVia.innerPad,r.pcbVia.botPad,r.pcbVia.mask,r.pcbVia.unuseLayers),s=this.step.onCollideVia(t,n,i),a=new IF(this.collide.map,this.result),l=r.getRopeStart();if(l.distance2(s)>1e-4){this.deleteRope(r);let c=new Ll(r.id,r.net,l,r.pcbVia.holeDiameter,r.pcbVia.topPad,r.pcbVia.innerPad,r.pcbVia.botPad,r.pcbVia.mask,r.pcbVia.unuseLayers),h=a.modifyVia(c,s);this.remove4Rtree(h.oldTracks),this.add4Rtree(h.newTracks),this.updateViaConnectChain(h);let u=new oC(r.net,r.layer,r.start,s,r.width,r.id);this.remove4Rtree([r]),e.push(u),u.pcbVia=r.pcbVia,this.vias.add(r.pcbVia)}else this.remove4Rtree([r]),e.push(r),this.vias.add(r.pcbVia);this.deleteRope(r)}else this.result.shoveState=2,this.logger.debug3("%s %s %s","11-collide via fail",r,this.result);if(r=this.getViaObstacle(t),!this.debug&&new Date().getTime()-this.time>200&&(this.result.shoveState=2,this.logger.debug1("12-collide via fail:time out")),this.result.shoveState==2)break}this.add4Rtree(e),this.addRopes(e)}deleteRope(t){let e=this.ropes.indexOf(t);e>-1&&this.ropes.splice(e,1)}addRopes(t){for(let e of t)this.ropes.push(e)}updateViaConnectChain(t){for(let e=0,r=t.oldTracks.length;e<r;e++){let i=t.oldTracks[e],n=t.newTracks[e];if(n.updateModifyPath(this.result),n!=null){let s=-1;i!=null&&(s=this.getViaConnectIndex(i)),s<0&&this.viaConnectChains.push(n.sourceIndex)}}}getViaConnectIndex(t){for(let e=0,r=this.viaConnectChains.length;e<r;e++)if(this.viaConnectChains[e]==t.sourceIndex)return e;return-1}getViaObstacle(t){let e=t.tracks;t.modifyPath.length>0&&(e=t.modifyPath);for(let r of e)if(this.collide.adsorp=null,this.collide.checkOnlyVia(r),this.collide.adsorp!=null){if(this.collide.adsorp instanceof oC)return this.collide.adsorp;if(this.collide.adsorp instanceof Ll){for(let i of this.ropes)if(i.pcbVia==this.collide.adsorp)return i;return this.collide.adsorp}}for(let r of t.modifyVias)if(this.collide.adsorp=null,this.collide.checkOnlyVia(r),this.collide.adsorp!=null){if(this.collide.adsorp instanceof oC)return this.collide.adsorp;if(this.collide.adsorp instanceof Ll){for(let i of this.ropes)if(i.pcbVia==this.collide.adsorp)return i;return this.collide.adsorp}}return null}hasObstacle(t){let e=t.tracks;t.modifyPath.length>0&&(e=t.modifyPath);for(let r of e)if(this.collide.adsorp=null,this.collide.check(r),this.collide.adsorp!=null)return!0;for(let r of t.modifyVias)if(this.collide.adsorp=null,this.collide.check(r),this.collide.adsorp!=null)return!0;for(let r of e)if(this.collide.adsorp=null,this.collide.checkObstacle(r),this.collide.adsorp!=null)return!0;for(let r of t.modifyVias)if(this.collide.adsorp=null,this.collide.checkVia(r,r.center),this.collide.adsorp!=null)return!0;return!1}getObstacle(t){let e=t.tracks;t.modifyPath.length>0&&(e=t.modifyPath);for(let i of e)if(this.collide.adsorp=null,this.collide.check(i),this.collide.adsorp!=null){if(this.collide.adsorp instanceof o0){let n=this.result.getSource(this.collide.adsorp);if(n!=null)return n;let s=new cg(this.collide.map).generateChain(this.collide.adsorp),a=this.result.addSource(s.tracks);s.sourceIndex=a;let l=s.build();return this.result.shovePathMap[a]=l,l}else if(this.collide.adsorp instanceof v0)return this.result.shovePathMap[this.collide.adsorp.sourceIndex]}let r=t.modifyVias;r.length==0&&(t.startVia!=null&&r.push(t.startVia),t.endVia!=null&&r.push(t.endVia));for(let i of r)if(this.collide.adsorp=null,this.collide.check(i),this.collide.adsorp!=null){if(this.collide.adsorp instanceof o0){let n=this.result.getSource(this.collide.adsorp);if(n!=null)return n;let s=new cg(this.collide.map).generateChain(this.collide.adsorp),a=this.result.addSource(s.tracks);s.sourceIndex=a;let l=s.build();return this.result.shovePathMap[a]=l,l}else if(this.collide.adsorp instanceof v0)return this.result.shovePathMap[this.collide.adsorp.sourceIndex]}return null}getSolidObstacle(t){let e=t.tracks;t.sourceIndex>0&&t.modifyPath.length>0&&(e=t.modifyPath);for(let i of e)if(this.collide.adsorp=null,this.collide.checkObstacle(i),this.collide.adsorp!=null)return this.collide.adsorp;let r=t.modifyVias;r.length==0&&(t.startVia!=null&&r.push(t.startVia),t.endVia!=null&&r.push(t.endVia));for(let i of r)if(this.collide.adsorp=null,this.collide.checkVia(i,i.center),this.collide.adsorp!=null)return this.collide.adsorp;return null}needWalkAround(t){let e=t.path[t.path.length-1];for(let r of this.hulls)if(this.walk.check.pointInPolyline(t.path[0],r)||this.walk.check.pointInPolyline(e,r))return!0;return!1}getFirst(t,e){let r=e.tracks,i=0,n=r.length-1;for(let s=0;s<=n;s++){let a=r[s],l=new M(a.start,a.end);for(let c of t.tracks){let h=new M(c.start,c.end);if(Tt(l,h)>0)return i=s,i}}return 0}getLast(t,e){let r=e.tracks,i=r.length-1;for(let n=i;n>=0;n--){let s=r[n],a=new M(s.start,s.end);for(let l of t.tracks){let c=new M(l.start,l.end);if(Tt(a,c)>0)return i=n,i}}return i}addHull(t,e){let r=this.collide.getSafeClearance(t.tracks[0].net,e.tracks[0]),i=t.tracks[0].width,n=t.tracks[0].layer,s=e.tracks;for(let a of s){let l=ll.segmentHull(a,r+i/2+1e-5,0);this.hulls.push(l)}if(e.startVia!=null){let a=this.collide.getSafeClearance(t.tracks[0].net,e.startVia,5),l=e.startVia.shape(n,a+i/2),c=ll.convexHull(l,1e-5);e.path[e.path.length-1].distance2(e.startVia.center)<e.path[0].distance2(e.startVia.center)?this.hulls.push(c):this.hulls.splice(0,0,c)}if(e.endVia!=null){let a=this.collide.getSafeClearance(t.tracks[0].net,e.endVia,5),l=e.endVia.shape(n,a+i/2),c=ll.convexHull(l,1e-5);e.path[e.path.length-1].distance2(e.endVia.center)<e.path[0].distance2(e.endVia.center)?this.hulls.push(c):this.hulls.splice(0,0,c)}}collideTrack(t,e){let{path:r,sweep:i}=this.processHullSet(t,e);if(r.length>2){let n=this.getChainFactory(t,r);n.sweep=i;let s=n.build();return this.result.shovePathMap[s.sourceIndex]=s,this.addWalkHulls(s,e),s.previousChain.push(e.sourceIndex),[s]}else return[]}addWalkHulls(t,e){if(e.modifyPath.length==0)for(let r of this.hulls)t.walkHulls.push(r);else{let r=new Array,i=this.collide.getSafeClearance(t.tracks[0].net,e.tracks[0]),n=t.tracks[0].layer,s=e.modifyPath;for(let a of s){let l=ll.segmentHull(a,i,0);r.push(l)}if(e.startVia!=null){let a=this.collide.getSafeClearance(t.tracks[0].net,e.startVia,5),l=e.startVia.shape(n,a),c=ll.convexHull(l,1e-5);e.path[e.path.length-1].distance2(e.startVia.center)<e.path[0].distance2(e.startVia.center)?r.push(c):r.splice(0,0,c)}if(e.endVia!=null){let a=this.collide.getSafeClearance(t.tracks[0].net,e.endVia,5),l=e.endVia.shape(n,a),c=ll.convexHull(l,1e-5);e.path[e.path.length-1].distance2(e.endVia.center)<e.path[0].distance2(e.endVia.center)?r.push(c):r.splice(0,0,c)}for(let a of r)t.walkHulls.push(a)}}reducePoints(t){if(t.length>2){let e=t[0],r=new Array;r.push(e);for(let i=1,n=t.length;i<n;i++){let s=t[i],a=!1;if(i+1<n){let l=s.sub(e).normalize(),c=t[i+1].sub(e).normalize(),h=l.cross(c);Math.abs(h)<1e-4&&(a=!0)}a||(r.push(s),e=s)}return r}else return t}getNewChain(t,e){let r=this.getChainFactory(t,e);return r.sweep=t.sweep,r.build()}getChainFactory(t,e){let r=t.tracks[0].width,i=t.tracks[0].net,n=t.tracks[0].layer,s=new Array,a=e[0];for(let c=1,h=e.length;c<h;c++){let u=e[c],d=new v0(i,n,a,u,r,"shove"+iOt++,t.sourceIndex);s.push(d),a=u}let l=new cg(this.collide.map);l.path.push(s[0].start);for(let c of s)l.tracks.push(c),l.all.add(c),l.path.push(c.end);return l.sourceIndex=t.sourceIndex,l.endVia=t.endVia,l.startVia=t.startVia,l}collideSolidSweep(t,e,r){let i=this.processHullSetSweep(t,e,r);return i.length>2?[this.getNewChain(t,i)]:[]}processHullSet(t,e){let r=this.collide.getSafeClearance(t.tracks[0].net,e.tracks[0]),i=t,n=this.hulls,s=new Array,a=new Jj,l=fe.build4(i.path).primitives,c=a.findPath4SweepEnd(l,n,le.CCW),h=a.findPath4SweepEnd(l,n,le.CW);for(let u=0;u<2;u++){let d=u==0?le.CCW:le.CW,p=u==0?c:h;if(p==null)continue;let m=new Array;if(p.points(.1,b=>{m.push(b)}),this.checkIntersection(p,fe.build4(e.path))||t.sourceIndex!=0&&this.checkIntersection(p,fe.build4(this.result.shovePathMap[0].path))||t.sourceIndex!=0&&this.checkAroundStartpoint(m,e,r+t.tracks[0].width/2))continue;if(e.walkHulls.length>0){let b=!1,P=fe.build4(e.path);for(let T of e.walkHulls)if(this.checkIntersection(P,T)&&this.checkIntersection(p,T)){b=!0;break}if(b)continue}if(m[0]!=null&&!m[0].equals(i.path[0])||m[m.length-1]!=null&&!m[m.length-1].equals(i.path[i.path.length-1]))continue;let g=this.route.optimization(m),y=fe.build4(g);this.checkIntersection(y,fe.build4(e.path))?s.push({path:m,sweep:d}):s.push({path:g,sweep:d})}return s.length>0?(xr(s,(u,d)=>this.getLength(u.path)-this.getLength(d.path),0,s.length),s[0]):{path:[],sweep:0}}getLength(t){let e=0;for(let r=0,i=t.length;r<i-1;r++){let n=t[r],s=t[r+1];e+=n.distance1(s)}return e}getPreviousChain(t){let e=new Array;for(let r of t.previousChain){let i=this.result.shovePathMap[r],n=this.collide.getSafeClearance(t.tracks[0].net,i.tracks[0]),s=t.tracks[0].layer,a=i.tracks;for(let l of a){let c=ll.segmentHull(l,n,0);e.push(c)}if(i.startVia!=null){let l=this.collide.getSafeClearance(t.tracks[0].net,i.startVia,5),c=i.startVia.shape(s,l),h=ll.convexHull(c,1e-5);i.path[i.path.length-1].distance2(i.startVia.center)<i.path[0].distance2(i.startVia.center)?e.push(h):e.splice(0,0,h)}if(i.endVia!=null){let l=this.collide.getSafeClearance(t.tracks[0].net,i.endVia,5),c=i.endVia.shape(s,l),h=ll.convexHull(c,1e-5);i.path[i.path.length-1].distance2(i.endVia.center)<i.path[0].distance2(i.endVia.center)?e.push(h):e.splice(0,0,h)}}return e}onCollideSolid(t){let e=this.getSolidObstacle(t),r=this.getPreviousChain(t),i=new p3(xGe),n=0,s=t,a=new Array;for(;e!=null;){a.push(s);let l=this.getSolidHull(e,s);if(!s.obstacles.has(e)&&l!=null){let h=this.collide.getSafeClearance(s.tracks[0].net,e);if(!this.pointInHulls(s.path[0],l)&&!this.pointInHulls(s.path[s.path.length-1],l)){let d=this.step.onCollideSolid(s,e,h);d=d.filter(p=>{let m=fe.build4(p.path);for(let g of r)if(this.checkIntersection(m,g))return!1;return!(p.path[0]!=null&&!p.path[0].equals(s.path[0])||p.path[p.path.length-1]!=null&&!p.path[p.path.length-1].equals(s.path[s.path.length-1]))});for(let p of d){let m=p.path;m=this.route.optimization(p.path);let g=this.getChainFactory(s,m);g.sweep=p.sweep;let y=g.build();y.updateModifyPath(this.result),i.add(y);for(let b of s.obstacles)y.obstacles.add(b);y.obstacles.add(e)}}}let c=this.findMinNodePath(i);if(c!=null)s=c;else{this.result.shoveState=2,this.logger.debug3("%s %s %s","4-walk solid fail:no path!",this.result,a);break}if(e=this.getSolidObstacle(s),n++,n>=1e3){this.result.shoveState=2,this.logger.debug3("%s %s","5-walk solid to long!",this.result);break}if(!this.debug&&new Date().getTime()-this.time>200&&(this.result.shoveState=2,this.logger.debug1("6-walk solid time out!")),this.result.shoveState==2)break}return this.result.shovePathMap[s.sourceIndex]=s,this.remove4Rtree([t]),this.add4Rtree([s]),s.updateModifyPath(this.result),this.lineStack.splice(0,0,s.sourceIndex),s}helpPolyline(t,e){let r=[];t.points(1,i=>{r.push(i)}),this.helpHull(r,e)}getSolidHull(t,e){let r=this.collide.getSafeClearance(e.tracks[0].net,t),i=t.shape(e.tracks[0].layer,0);if(i instanceof fe){let n=e.tracks[0].width;if(e.modifyVias.length>0)for(let s of e.modifyVias){n=Math.max(s.topPad,n);let a=this.collide.getSafeClearance(e.tracks[0].net,t,5);r=Math.max(r,a)}return this.getShapeHulls(t,i,r+n/2+1e-5)}return null}processHullSetSweep(t,e,r){let i=this.hulls,n=e,s=e==le.CCW?le.CW:le.CCW;for(let a=0;a<4;a++){let l=a>1?s:n,c=Array.from(t.path);for(let d of i)c=this.walk.aroundHull(d,c,l);if(i=i.reverse(),this.checkIntersection(fe.build4(c),r)||c[0]!=null&&!c[0].equals(t.path[0])||c[c.length-1]!=null&&!c[c.length-1].equals(t.path[t.path.length-1]))continue;let h=this.getNewChain(t,c);if(this.getSolidObstacle(h)==null)return c}return[]}deleteViaConnectChain(t){let e=this.viaConnectChains.indexOf(t);e>-1&&this.viaConnectChains.splice(e,1)}checkIntersection(t,e){for(let r of t.primitives)for(let i of e.primitives)if(Tt(r,i)>0)return!0;return!1}checkAroundStartpoint(t,e,r){let i=e.path[0].sub(e.path[1]).normalize(),n=e.path[0].add(i.mul(r+e.tracks[0].width/2)),s=fe.build4(t);for(let a of s.primitives)if(a instanceof M){let l=a.end().sub(a.start()).normalize(),c=n.sub(a.start()).normalize(),h=l.cross(c),u=c.dot(i);if(ne.eq(h,0)&&ne.eq(u,0))return!0}return!1}helpHull(t,e=ee.BLUE){let r=t[0];for(let i=0,n=t.length;i<n;i++){let s=t[i],a=new hr(1002,r,s,!1,e);this.helpLine.push(a),r=s}}getVia4Ropes(t){let e=new Set;for(let r of t)r.pcbVia!=null&&e.add(r.pcbVia);return e}clearCache(){this.collide.clear(),this.result.clear()}};var tD=class{constructor(){this.shoveFun=new Bne;this.last=null;this._current=null;this.previewResult=null;this.lastShoveResults=new Array;this.path=new Array;this.lines=new Array}clearCache(){this.shoveFun.clearCache(),this.last!=null&&this.last.clear(),this._current!=null&&this._current.clear(),this.previewResult!=null&&this.previewResult.clear(),this.lastShoveResults.length=0,this.path.length=0,this.lines.length=0}getChain(t){let e=this.shoveFun.collide.map;this.shoveFun.place=!1;let r=e.getTrack(t.globalIndex);r==null&&(r=this.convert(t));let i=new cg(e);return i.generateChain(r),i.sourceIndex=0,i.build()}getNewChainFactory(t,e){return this.shoveFun.getChainFactory(t,e)}get current(){return this._current}set current(t){t!=this._current&&(this.last=this._current),this._current=t}convert(t){if(t instanceof Ar){let{type:e,order:r}=xne(t.layerId),i=new $r(O6(e),r);return new o0(t.net,i,t.start,t.end,t.width,t.gId)}else if(t instanceof Si){let{type:e,order:r}=xne(t.layerId),i=new $r(O6(e),r),n=t.primitive;return new ag(t.net,i,n,t.width,t.gId)}else return new Ll(t.globalIndex,t.net,t.center,t.holeRadius*2,t.radius*2,t.radius*2,t.radius*2,!1,aC(sC(t.unusedInnerLayers)))}addPath(t){let e=this.convert(t);this.path.push(e),this.lastShoveResults.push(this.last)}getShoveResults(t){return this.lastShoveResults[t]}getShovePath(t){return this.path.slice(0,t)}backspace(t){this.current=this.lastShoveResults[t];let e=this.path.length,r=this.lastShoveResults.length,i=this.lastShoveResults[t];return this.path.splice(t,e-t),this.lastShoveResults.splice(t,r-t),i}shoveTrackInterrupt(){this.current!=null&&(this.visibleTracks(this.current),this.clear()),this.clearCache()}shoveTrackComplete(t){return this.shoveTrackGroupComplete(t.commands)}shoveTrackGroupComplete(t){let e=!1;if(this.current!=null){this.visibleTracks(this.current);for(let i in this.current.shovePathMap){let n=this.current.shovePathMap[i],a=this.current.sourceTrackChain[i][0],l=pr.getItem(a.id);for(let c of n.tracks){let h=pr.addTrack(l.layerId,c.start,c.end,c.width,!1,c.net);A.publish("hasModifyPcbItem",h),t.addCommand(Te.dispatch(h,"add"))}}let r=this.current.sourceTrackChain.length;for(let i=0;i<r;i++){let n=this.current.sourceTrackChain[i];for(let s of n){let a=pr.getItem(s.id);a!=null&&!a.isEmpty&&(t.addCommand(Te.dispatch(a,"delete")),A.publish("hasModifyPcbItem",a),a.remove(),A.publish("delete",a))}}e=!0}return this.clear(),e}clear(){this.lines.forEach(t=>{t.remove()}),this.lines.length=0}hiddenTracks(t){for(let e of t.sourceTrackChain)for(let r of e)this.hidden(r.id)}visibleTracks(t){for(let e of t.sourceTrackChain)for(let r of e)this.visible(r.id)}preview(t){if(this.clear(),this.previewResult!=null&&this.visibleTracks(this.previewResult),t!=null){let e=Object.values(t.shovePathMap);for(let r of e)this.display(r,t);e.length>0?this.hiddenTracks(t):this.visibleTracks(t)}this.previewResult=t}preview1(t){this.clear(),this.previewResult!=null&&this.visibleTracks(this.previewResult),this.previewResult=null;let e=t.pop();for(let r of t){let i=r.shovePathMap[0];this.display(i,r)}if(e!=null){let r=Object.values(e.shovePathMap);for(let i of r)this.display(i,e);this.hiddenTracks(e)}this.previewResult=e}getViaCenter(){if(this.previewResult!=null){let t=this.previewResult.shovePathMap[0];if(t.startVia!=null)return t.path[0];if(t.endVia!=null)return t.path[t.path.length-1]}return null}previewShove(t){if(this.clear(),this.previewResult!=null&&this.visibleTracks(this.previewResult),t!=null){for(let e in t.shovePathMap)e!=0&&this.display(t.shovePathMap[e],t);this.hiddenTracks(t)}this.previewResult=t}getNetDelta(t){let e=0;for(let r of this.lines)r instanceof $d&&r.net==t&&(e+=r.length);if(this.previewResult!=null){for(let r of this.previewResult.sourceTrackChain)for(let i of r)if(i!=null&&i.net==t){let n=pr.getItem(i.id);n!=null&&(e-=n.length)}}return e}hidden(t){let e=pr.getItem(t);e!=null&&!e.isEmpty&&e.hidden()}visible(t){let e=pr.getItem(t);e!=null&&!e.isEmpty&&e.visible()}display(t,e){let r=e.sourceTrackChain[t.sourceIndex];if(!Array.isArray(r))return;let i=r[0],n=pr.getItem(i.id);if(n!=null)for(let s of t.tracks){let a=$d.build(n.layerId,s.start,s.end,s.width,s.net);this.lines.push(a)}}displayVia(t){let e=new n_(su(),1002,t.center,t.topPad/2);this.lines.push(e)}};function RGe(o){let t=new Jt,e=tr.getInstance();t.add("CANCEL",!0);let r=new Jt;return r.add("WIRING_MODE_PUSHAWAY",!1,e.mode=="WIRING_MODE_PUSHAWAY"),r.add("WIRING_MODE_SURROUND",!1,e.mode=="WIRING_MODE_SURROUND"),r.add("WIRING_MODE_IGNORE",!1,e.mode=="WIRING_MODE_IGNORE"),t.addExtend("WIRING_MODE",r),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var x6=class x6{constructor(){this.currTool=null;this.time=0;this.opening=!1;ie.subscribe("rightClickMenuCMD",this.parse.bind(this)),ie.subscribe("TempMaskRightClickMenu",this.mask50ms.bind(this))}static getInstance(){return x6.instance==null&&(x6.instance=new x6),x6.instance}mask50ms(){this.time=new Date().getTime()+200}updateInputInfo(t){var s;let{left:e,top:r}=((s=window.frameElement)==null?void 0:s.getBoundingClientRect())||{},i=this.getRatio(),n=Pi.getInstance();n.mouseX=(t.mouseX-e)*i,n.mouseY=(t.mouseY-r)*i}getMenuStatus(){return this.opening}parse(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;t.mouseInfo&&this.updateInputInfo(t.mouseInfo);let e=this.currTool!=null;t.isClose&&e?(this.currTool.parse({cmdKey:":"}),this.currTool=null):e&&(this.currTool.parse(t),this.currTool=null),e&&ie.publish("updateCross",""),this.opening=!1}menuData(t,e){if(new Date().getTime()<=this.time)return;let r=this.getRatio();t.left=t.left/r,t.top=t.top/r,ie.publish("rightClickPcbMenu",t,$()),this.currTool=e,ie.publish("TempMaskDialog",""),this.opening=!0}getRatio(t=1){return x.getInstance().getRatio()}close(){if(!(!x.getInstance().isactive||23==x.getInstance().doctype))return this.opening&&ie.publish("rightClickPcbMenu",{state:"hide"},$()),this.currTool!=null}};x6.instance=null;var Qt=x6;function nOt(o,t){let e=o.octagon(),r=t.octagon(),i=(e.minY+e.maxY)/2,n=(r.minY+r.maxY)/2;return i-n}function oOt(o,t){let e=o.octagon(),r=t.octagon(),i=(e.minX+e.maxX)/2,n=(r.minX+r.maxX)/2;return i-n}var j1=class o{constructor(t,e){this.childs=new Array;this._octagon=null;this.parent=null;if(this.capacity=t,typeof e<"u"&&Array.isArray(e))for(let r of e)this.insert(r)}octagon(){return an.notnull(this._octagon)}itor(t,e,r=!1){let i=Ko.getDefaultColor();r&&Ko.auto(this.octagon().outline(),i);for(let n of this.childs)n instanceof o?n.itor(t+1,e,r):(Ko.auto(n.octagon().outline(),i),e(n,t))}debug(t){for(let e of this.childs)console.log(t,e.octagon(),e instanceof o?"+":"-"),e instanceof o&&e.debug(t+" |--")}insert(t){let e=this.childs,r=t.octagon();if(!(t instanceof o))for(let i=0;i<e.length;i++){let n=e[i];if(n instanceof o&&r.isInside(n.octagon())){n.insert(t),this.union(r);return}}t instanceof o&&(t.parent=this),e.length<=this.capacity?e.push(t):(e.push(t),this.splitNode()),this.union(r)}union(t){this._octagon==null?this._octagon=t:this._octagon=this._octagon.union(t)}remove(t){if(t instanceof o&&t.childs.length>0)throw new Error;let e=this.childs,r=t.octagon(),i=new Array;for(let n=0;n<e.length;n++){let s=e[n];if(s===t)return e.splice(n,1),e.length>1?(this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):e.length==1?this.parent!==null?(this.parent.childs.push(this.childs[0]),this.childs[0]instanceof o&&(this.childs[0].parent=this.parent),this.childs.length=0,this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this.updateBBox():this.parent!==null?(this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this._octagon=null,1;s instanceof o&&r.isInside(s.octagon())&&i.push(s)}if(t instanceof o)throw new Error;for(let n of i){let s=n.remove(t);if(s===1)return this.childs.length>0&&this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox(),1;if(s!==0)throw new Error}return 0}recycle(){this.childs.length=0}updateBBox(){let t=this.childs[0].octagon();for(let e of this.childs)t=t.union(e.octagon());this._octagon=t}splitNode(){let t=this.childs,e=t.length,r=-1,i=-1,n=Number.NEGATIVE_INFINITY;for(let c=0;c<e;c++){let h=t[c];for(let u=c+1;u<e;u++){let d=t[u],p=h.octagon().union(d.octagon()).area();p>n&&(n=p,r=c,i=u)}}let s=this.asNode(t[r]),a=this.asNode(t[i]);for(let c=0;c<e;c++)if(c!==r&&c!==i){let h=t[c],u=h.octagon(),d=s._octagon.union(u).area(),p=a._octagon.union(u).area();d<p?s.insert(h):a.insert(h)}t.length=0;let l=this.parent;l!==null&&l.childs.length<this.capacity?(s.parent=l,a.parent=l,l.childs.push(s),l.childs.push(a),l.remove(this),l.updateBBox()):(s.parent=this,a.parent=this,t.push(s),t.push(a),this.updateBBox()),this.childs.length>0&&this.updateBBox(),s.updateBBox(),a.updateBBox()}asNode(t){if(t instanceof o)return t;{let e=new o(this.capacity);return e.insert(t),e}}},DGe=.5,wGe=1e5,x0=class{constructor(t){this.items=new Set;this.changeList=new Set;this.deadList=new Set;this.capacity=t,this.capacity2=t*t,this.root=new j1(t)}itor(t,e=!1){this.root.itor(0,t,e)}size(){return this.items.size}search(t){let e=nh.converBBox(t);this.flushWhenNeed();let r=[],i=[];for(i.push(this.root);;){let n=i.shift();if(n!==void 0)for(let s of n.childs)e.isIntersectOctagon(s.octagon())&&(s instanceof j1?s.octagon().isInside(e)?this.add2Result(s,r):i.push(s):r.push(s));else break}return r}add2Result(t,e,r){if(t!==void 0)for(let i of t.childs)i instanceof j1?this.add2Result(i,e,r):(!r||r(i))&&e.push(i)}search2Cb(t,e){let r=nh.converBBox(t);this.flushWhenNeed();let i=[this.root];for(;;){let n=i.pop();if(n!==void 0)for(let s of n.childs)r.isIntersectOctagon(s.octagon())&&(s instanceof j1?s.octagon().isInside(r)?this.addResult2Cb(s,e):i.push(s):e(s));else break}}addResult2Cb(t,e,r){if(t!==void 0)for(let i of t.childs)i instanceof j1?this.addResult2Cb(i,e,r):(!r||r(i))&&e(i)}searchInside(t){let e=nh.converBBox(t);this.flushWhenNeed();let r=[],i=[];for(i.push(this.root);;){let n=i.shift();if(n!==void 0)for(let s of n.childs){let a=s.octagon();e.isIntersectOctagon(a)&&(s instanceof j1?a.isInside(e)?this.add2Result(s,r):i.push(s):a.isInside(e)&&r.push(s))}else break}return r}conditionSearch(t,e){let r=nh.converBBox(t);this.flushWhenNeed();let i=[],n=[];for(n.push(this.root);;){let s=n.shift();if(s!==void 0)for(let a of s.childs)r.isIntersectOctagon(a.octagon())&&(a instanceof j1?a.octagon().isInside(r)?this.add2Result(a,i,e):n.push(a):e(a)&&i.push(a));else break}return i}insert(t){this.items.add(t),this.changeList.add(t)}remove(t){this.items.delete(t),this.deadList.add(t)}bbox(){return this.flushWhenNeed(),this.root.octagon().bbox()}flushDeleteWhenNeed(){let t=this.deadList.size;if(t>0){let e=1;if(this.items.size>0&&(e=t/this.items.size),e>DGe||t>wGe)this.fullRefresh(),this.deadList.clear(),this.changeList.clear(),this.deadList=new Set,this.changeList=new Set;else{for(let i of this.deadList)this.root.remove(i);this.deadList.clear(),this.deadList=new Set}}}flushWhenNeed(){let t=this.changeList.size+this.deadList.size;if(t>0){let e=1;if(this.items.size>0&&(e=t/this.items.size),e>DGe||t>wGe)this.deadList.clear(),this.changeList.clear(),this.deadList=new Set,this.changeList=new Set,this.fullRefresh();else{for(let i of this.deadList)this.root.remove(i);this.deadList.clear(),this.deadList=new Set;for(let i of this.changeList)this.items.has(i)&&this.root.insert(i);this.changeList.clear(),this.changeList=new Set}}}debug(){this.root.debug("")}recycle(){this.items.clear(),this.changeList.clear(),this.deadList.clear(),this.deadList=new Set,this.changeList=new Set,this.root.recycle()}fullRefresh(){let t=new Array;for(let e of this.items)t.push(e);for(;;){let e=this.organize(t);if(e.length>1)t=e;else break}this.root.recycle(),this.root=new j1(this.capacity,t)}organize(t){xr(t,oOt,0,t.length);let e=t.length,r=[];for(let i=0;i<e;)if(i+this.capacity2<=e){let n=i+this.capacity2;xr(t,nOt,i,n);for(let s=i;s<n;s+=this.capacity){let a=new j1(this.capacity,t.slice(s,s+this.capacity));r.push(a)}i=i+this.capacity*this.capacity}else{let n=new j1(this.capacity,t.slice(i,i+this.capacity));r.push(n),i=i+this.capacity}return r}};var CF=class{constructor(t,e){this.map=new Map;this.groupTypes=new Set(["Track","ArcTrack","Pad","Via","Image","Picture","Length Dimension","Smart Dimension","Protractor Dimension","Radius Dimension","Polygon","Rect","Circle","Copper","Inner","Component","Line","Arc","Ratline","Text","DRCResult","Combination"]);this.init=!1;this.capacity=t,this.otherMap=new Map,this.ratlineMap=new Map,this.func=e}itorTree(t,e=!1){for(let[r,i]of this.map)for(let[n,s]of i)t(s,n,r);if(!e){for(let[,r]of this.ratlineMap)t(r,57,"Ratline");for(let[r,i]of this.otherMap)t(i,r)}}itor(t,e){this.itorTree((r,i,n)=>{(!e||e(i,n))&&r.itor(t)})}size(){let t=0;for(let[,e]of this.map)for(let[,r]of e)t+=r.size();for(let[,e]of this.otherMap)t+=e.size();for(let[,e]of this.ratlineMap)t+=e.size();return t}itoratorAllItems(t){for(let[,e]of this.map)for(let[,r]of e)r.items.forEach(i=>{t(i)});for(let[,e]of this.otherMap)e.items.forEach(r=>{t(r)});for(let[,e]of this.ratlineMap)e.items.forEach(r=>{t(r)})}getSearchResult(){return this.func()}search(t,e,r=!0){let i=this.getSearchResult();return this.itorTree((n,s,a)=>{if(e&&!e(s,a))return;let l=i.getResults(a);for(let c of n.search(t))c.item.isEmpty?(c instanceof Ar?n instanceof x0&&n.remove(c):n instanceof x0||n.remove(c),this.remove(c)):l.add(c.item)},r),i}searchInside(t,e,r=!0){let i=this.getSearchResult();return this.itorTree((n,s,a)=>{if(e&&!e(s,a))return;let l=i.getResults(a);for(let c of n.searchInside(t))c.item.isEmpty?(c instanceof Ar?n instanceof x0&&n.remove(c):n instanceof x0||n.remove(c),this.remove(c)):l.add(c.item)},r),i}searchIntersectByType(t,e,r){let i=this.getSearchResult();for(let n of e){let s=this.map.get(n);if(s!=null){let a=i.getResults(n);for(let[l,c]of s){if(r&&!r(l,n))continue;let h=c.searchIntersect(t);for(let u of h)u.item.isEmpty?(u instanceof Ar?c instanceof x0&&c.remove(u):c instanceof x0||c.remove(u),this.remove(u)):a.add(u.item)}}}return i}search4Types(t,e,r){let i=this.getSearchResult();for(let n of e){let s=this.map.get(n);if(s!=null){let a=i.getResults(n);for(let[l,c]of s){if(r&&!r(l,n))continue;let h=c.search(t);for(let u of h)u.item.isEmpty?(u instanceof Ar?c instanceof x0&&c.remove(u):c instanceof x0||c.remove(u),this.remove(u)):a.add(u.item)}}}return i}searchByType(t,e){return this.search(t,(r,i)=>i==e,!1)}searchByTypes(t,e){return this.search(t,(r,i)=>i==null?!1:e.includes(i),!e.includes("Ratline"))}searchByLayer(t,e){return this.search(t,r=>r==e,e!=57)}searchByLayers(t,e){return this.search(t,r=>r==null?!1:e.includes(r),!e.includes(57))}conditionSearch(t,e,r,i=!0){let n=this.getSearchResult();return this.itorTree((s,a,l)=>{if(r&&!r(a,l))return;let c=n.getResults(l),h=s.conditionSearch(t,e);for(let u of h)u.item.isEmpty?(u instanceof Ar?s instanceof x0&&s.remove(u):s instanceof x0||s.remove(u),this.remove(u)):c.add(u.item)},i),n}getNodeGroupType(t){let e=t.item.model.modelType;if(this.groupTypes.has(e))return e}getNodeGroup(t,e){let r=this.getNodeGroupType(t),i=e||t.item.model.layerId||t.item.layerId;if(r){if(r=="Ratline"){let l=t.item.model.net,c=this.ratlineMap.get(l);return c||(c=new Sd(this.capacity),this.ratlineMap.set(l,c)),c}}else{let a=this.otherMap.get(i);return a||(a=new Sd(this.capacity),this.otherMap.set(i,a)),a}let n=this.map.get(r),s=n&&n.get(i);return s||(t instanceof Ar?s=new x0(this.capacity):s=new Sd(this.capacity),n||(n=new Map,this.map.set(r,n)),n.set(i,s)),s}insert(t){t.update(),t.bbox()&&this.getNodeGroup(t).insert(t)}initInsertItem(t){t.update(),this.getNodeGroup(t).insert(t)}remove(t,e){this.getNodeGroup(t,e).remove(t)}updateBBox(t){let e=new _e;return this.itorTree((r,i,n)=>{if(r.size()>0){if(n=="DRCResult"||t&&n=="Text")return;e.ext1(r.bbox())}}),e.valid()?e.build1():null}bbox(){return this.flushWhenNeed(),this.updateBBox(!1)}getIgnoreTextBBox(){return this.flushWhenNeed(),this.updateBBox(!0)}flushDeleteWhenNeed(){this.itorTree(t=>{t.flushDeleteWhenNeed()})}flushWhenNeed(){this.itorTree(t=>{t.flushWhenNeed()})}recycle(){this.itorTree(t=>{t.recycle()}),this.map.clear()}};var NT=class{constructor(t){this.items=new Set;this.root=new j1(t)}itor(t,e=!1){this.root.itor(0,t,e)}size(){return this.items.size}search(t){let e=nh.converBBox(t),r=[],i=[];for(i.push(this.root);;){let n=i.shift();if(n!==void 0)for(let s of n.childs)e.isIntersectOctagon(s.octagon())&&(s instanceof j1?s.octagon().isInside(e)?this.add2Result(s,r):i.push(s):r.push(s));else break}return r}add2Result(t,e,r){if(t!==void 0)for(let i of t.childs)i instanceof j1?this.add2Result(i,e,r):(!r||r(i))&&e.push(i)}conditionSearch(t,e){let r=nh.converBBox(t),i=[],n=[];for(n.push(this.root);;){let s=n.shift();if(s!==void 0)for(let a of s.childs)r.isIntersectOctagon(a.octagon())&&(a instanceof j1?a.octagon().isInside(r)?this.add2Result(a,i,e):n.push(a):e(a)&&i.push(a));else break}return i}insert(t){this.items.add(t),this.root.insert(t)}remove(t){this.items.delete(t),this.root.remove(t)}bbox(){return this.root.octagon().bbox()}debug(){this.root.debug("")}recycle(){this.items.clear(),this.root.recycle()}};var Fne=class{constructor(){this.items=new Set}getResults(t){return this.items}};var rD=class extends Fne{constructor(){super(...arguments);this.items=new Set;this.tracks=new Set;this.arcTracks=new Set;this.pads=new Set;this.vias=new Set;this.images=new Set;this.pictures=new Set;this.dimensions=new Set;this.smartDimensions=new Set;this.protractor=new Set;this.radius=new Set;this.polygons=new Set;this.rects=new Set;this.circles=new Set;this.coppers=new Set;this.planes=new Set;this.components=new Set;this.ratlines=new Set;this.texts=new Set;this.drcs=new Set;this.includeRatlines=!1;this.filters=new Array;this.actions=new Array;this.onces=new Array}getResults(e){switch(e){case"Track":return this.tracks;case"ArcTrack":return this.arcTracks;case"Pad":return this.pads;case"Via":return this.vias;case"Image":return this.images;case"Picture":return this.pictures;case"Length Dimension":return this.dimensions;case"Smart Dimension":return this.smartDimensions;case"Protractor Dimension":return this.protractor;case"Radius Dimension":return this.radius;case"Polygon":return this.polygons;case"Rect":return this.rects;case"Circle":return this.circles;case"Copper":return this.coppers;case"Inner":return this.planes;case"Component":return this.components;case"Ratline":return this.ratlines;case"Text":return this.texts;case"DRCResult":case"DrcComponentSpacing":case"DrcCreepage":case"DrcComponentOverlap":return this.drcs;default:return this.items}}getResult(e){let r=new Array;for(let i of e)Re.addAll(r,this.getResults(i));return r}getConnectNodes(){let e=new Array;return Re.addAll(e,this.tracks),Re.addAll(e,this.arcTracks),Re.addAll(e,this.pads),Re.addAll(e,this.vias),Re.addAll(e,this.polygons),Re.addAll(e,this.rects),Re.addAll(e,this.circles),Re.addAll(e,this.coppers),Re.addAll(e,this.planes),e}getProfiles(){let e=new Array;return Re.addAll(e,this.polygons),Re.addAll(e,this.rects),Re.addAll(e,this.circles),e}getAllItems(){let e=new Array;return Re.addAll(e,this.tracks),Re.addAll(e,this.arcTracks),Re.addAll(e,this.pads),Re.addAll(e,this.vias),Re.addAll(e,this.polygons),Re.addAll(e,this.rects),Re.addAll(e,this.circles),Re.addAll(e,this.coppers),Re.addAll(e,this.planes),Re.addAll(e,this.images),Re.addAll(e,this.pictures),Re.addAll(e,this.dimensions),Re.addAll(e,this.smartDimensions),Re.addAll(e,this.protractor),Re.addAll(e,this.radius),Re.addAll(e,this.texts),Re.addAll(e,this.components),this.includeRatlines&&Re.addAll(e,this.ratlines),e}getPadsAndVias(){let e=new Array;return Re.addAll(e,this.pads),Re.addAll(e,this.vias),e}getArcs(){let e=new Array;return Re.addAll(e,this.arcTracks),Re.addAll(e,this.circles),e}getTracks(){let e=new Array;return Re.addAll(e,this.arcTracks),Re.addAll(e,this.tracks),e}getTPV(){let e=new Array;return Re.addAll(e,this.arcTracks),Re.addAll(e,this.tracks),Re.addAll(e,this.pads),Re.addAll(e,this.vias),e}setFilter(e){return this.filters.push(e),this}setAction(e){return this.actions.push(e),this}setOnceAction(e){return this.onces.push(e),this}doAction(e){for(let r of e){let i=this.getResults(r);for(let n of i)this.filter(n)&&this.todo(n)}}once(e){for(let r of e){let i=this.getResults(r);for(let n of i)if(this.filter(n)){for(let s of this.onces)if(s.doAction(n))return n}}return null}clearFilter(){this.filters.length=0}clearAction(){this.actions.length=0}filter(e){for(let r of this.filters)if(!r.doAction(e))return!1;return!0}todo(e){for(let r of this.actions)r.doAction(e)}clear(){this.items.clear(),this.tracks.clear(),this.arcTracks.clear(),this.pads.clear(),this.vias.clear(),this.images.clear(),this.pictures.clear(),this.dimensions.clear(),this.smartDimensions.clear(),this.protractor.clear(),this.radius.clear(),this.polygons.clear(),this.rects.clear(),this.circles.clear(),this.coppers.clear(),this.planes.clear(),this.components.clear(),this.ratlines.clear(),this.texts.clear(),this.drcs.clear(),this.clearFilter(),this.clearAction()}};var s0=class{constructor(t){this.model=t,this._bbox=this.buildBBox()}octagon(){return this._bbox}update(){this._bbox=this.buildBBox()}buildBBox(){return this.model.isEmpty?null:this.model instanceof qr?nh.trackToOctagon(this.model.start,this.model.end,this.model.width):nh.converBBox(this.model.buildBBox())}bbox(){return this._bbox}},iD=class iD{constructor(){this._RTREE=null;this.rtree=new NT(15);this.shoveTree=new NT(15);this.shoveTreeMap=new Map;this.treeMap=new Map}static getInstance(){return iD.manager==null&&(iD.manager=new iD),iD.manager}add(t){let e=new s0(t);this.treeMap.set(t,e),this.rtree.insert(e)}clearShoveTree(){this.shoveTree.recycle(),this.shoveTreeMap.clear()}addShoveTree(t){if(t.isEmpty)return;let e=new s0(t);this.shoveTreeMap.set(t,e),this.shoveTree.insert(e)}deleteShoveTree(t){let e=this.shoveTreeMap.get(t);e!=null&&this.shoveTree.remove(e),this.shoveTreeMap.delete(t)}deleteTree(t){let e=this.treeMap.get(t);e!=null&&this.rtree.remove(e),this.treeMap.delete(t)}updateTree(t){if(t instanceof yt){if(!t.globalIndex.startsWith("TRACK"))return}else if(t instanceof It){if(!t.globalIndex.startsWith("VIA"))return}else return;let e=this.treeMap.get(t);e!=null?(this.rtree.remove(e),e.update()):(e=new s0(t),this.treeMap.set(t,e)),this.rtree.insert(e)}checkModels(t){for(let e of t)this.shoveTreeMap.get(e)==null&&this.addShoveTree(e)}get RTREE(){return this._RTREE==null&&(this._RTREE=sOt()),this._RTREE}update(){for(let[t,e]of this.treeMap)if(t instanceof It){let r=e.buildBBox();r!=null?r.equals(e.bbox())||(this.rtree.remove(e),e.update(),this.rtree.insert(e)):(this.rtree.remove(e),this.treeMap.delete(t))}}search(t){let e=this.rtree.search(t),r=new Array(e.length),i=0;for(let n of e)r[i]=n.model,i++;return r}clear(){this.treeMap.clear(),this.rtree.recycle(),this.shoveTree.recycle(),this._RTREE!=null&&this._RTREE.map.clear(),this._RTREE=null,this.shoveTreeMap.clear()}};iD.manager=null,iD.partition=null;var hi=iD;function sOt(){let o=new CF(50,()=>new rD);for(let[e,r]of Vt.map)switch(e){case"Track":case"ArcTrack":case"Pad":case"Via":{o.map.set(e,r);break}case"Polygon":case"Rect":case"Circle":{for(let[i,n]of r)for(let s of n.items){let a=s.item.model;a.isEmpty||!t(a)||(o.insert(s),a.globalIndex==x.getInstance().partitionId&&(hi.partition=a))}break}case"Image":case"Text":{for(let[i,n]of r)for(let s of n.items){let a=s.item.model;a.isEmpty||!t(a)||o.insert(s)}break}}function t(e){if(e.modelType=="Track"||e.modelType=="ArcTrack")return!0;if(e.modelType=="Pad")return!0;if(e.modelType=="Via")return!0;if(e.modelType=="Image"||e.modelType=="Text"){let r=$e.getInstance().getLayer(e.layerId);if(gs(r.type))return!0}else if(e.modelType=="Polygon"||e.modelType=="Rect"||e.modelType=="Circle"){let r=e;switch(r.type){case"Prohibited Region":return!!r.component.track;case"Board Outline":case"Constraint Region":case"Partition":case"Slot Region":return!0;case"Fill Region":case"TearDrop":case"Line":{let i=$e.getInstance().getLayer(r.layerId);if(gs(i.type)||r.layerId==11)return!0}}}return!1}return o}var R6=class R6{constructor(){this.ids=new Set}static getInstance(){return R6.manager==null&&(R6.manager=new R6),R6.manager}add(t){this.ids.add(t)}delete(t){this.ids.delete(t)}has(t){return this.ids.has(t)}clear(){this.ids=new Set}};R6.manager=null;var gc=R6;var SF=class{constructor(){this.trackStatus=new Map;this.viaStatus=new Map;this.whiteTrackStatus=new Map;this.previewTrackStatus=new Map;this.previewViaStatus=new Map;this.updateTrackStatus=new Map;this.selectTrackStatus=new Set;this.hightStatus=new Map}getTrackStatus(t){return this.trackStatus.get(t)}getViaStatus(t){return this.viaStatus.get(t)}setViaHidden(t){gc.getInstance().add(t),this.viaStatus.set(t,!1)}setViaVisible(t){gc.getInstance().delete(t),this.viaStatus.set(t,!0)}setTrackHidden(t){gc.getInstance().add(t),this.trackStatus.set(t,!1)}setTrackVisible(t){gc.getInstance().delete(t),this.trackStatus.set(t,!0)}setTrackWhite(t){this.whiteTrackStatus.set(t,!0)}getTrackWhite(t){return this.whiteTrackStatus.get(t)}setTrackPreview(t){this.previewTrackStatus.set(t,!0)}getTrackPreview(t){return this.previewTrackStatus.get(t)}setTrackUpdate(t){this.updateTrackStatus.set(t,!0)}getTrackUpdate(t){return this.updateTrackStatus.get(t)}setTrackSelect(t){this.selectTrackStatus.add(t)}getTrackSelect(t){return this.selectTrackStatus.has(t)}setViaPreview(t){this.previewViaStatus.set(t,!0)}getViaPreview(t){return this.previewViaStatus.get(t)}clearPreview(){this.previewTrackStatus.clear(),this.previewViaStatus.clear()}flip(){for(let[t,e]of this.trackStatus)this.trackStatus.set(t,!e);for(let[t,e]of this.viaStatus)this.viaStatus.set(t,!e)}unHightAll(){for(let[t]of this.hightStatus)this.hightStatus.set(t,!1)}setHight(t){this.hightStatus.set(t,!0)}deleteHight(t){this.hightStatus.delete(t)}deleteTrack(t){this.trackStatus.delete(t),this.whiteTrackStatus.delete(t),this.previewTrackStatus.delete(t),this.selectTrackStatus.delete(t)}deleteVia(t){this.viaStatus.delete(t),this.previewViaStatus.delete(t)}};var D6=class D6{constructor(){this.status=new Array;this.current=new SF}static getInstance(){return D6.manager==null&&(D6.manager=new D6),D6.manager}getNext(){this.status.push(this.current),this.current=new SF}undo(){let t=this.status.pop();return t!=null&&t.flip(),t}clear(){this.status.length=0,this.current=new SF}};D6.manager=null;var _r=D6;var Vne=new Error("list is empty"),EF=class{constructor(t,e){this._prev=null;this._next=null;this.fanoutInfo=null;this.ignoreArcOptimization=!1;this.ignore=!1;this.parent=t,this._item=e}get item(){return this._item}get prev(){return this._prev}get next(){return this._next}insertAfter(t){t._next=this._next,this._next=t,t._prev=this,t._next!==null&&(t._next._prev=t)}insertBefore(t){t._prev=this._prev,this._prev=t,t._next=this,t._prev!==null&&(t._prev._next=t)}clear(){this._prev=null,this._next=null}remove(){this._prev!==null&&(this._prev._next=this._next),this.next!==null&&(this.next._prev=this._prev),this._prev=null,this._next=null}set(t){this._item=t}},HSe=class{constructor(t){this._next=t}hasNext(){return this._next!==null}next(){let t=this._next;if(t!==null)return this._next=t.next,t.item;throw new Error("iterator is null")}},WSe=class{constructor(t){this._next=t}hasNext(){return this._next!==null}next(){let t=this._next;if(t!==null)return this._next=t.next,t;throw new Error("iterator is null")}},OF=class{constructor(){this.prev=null;this.next=null}remove(){this.prev!==null&&(this.prev=null),this.next!==null&&(this.next=null)}},Kn=class{constructor(){this.viaNode=new OF;this.parentNode=new OF;this.otherNode=new OF;this.first=null;this.last=null;this.cnt=0;this.startType=0;this.endType=0}replace(t,e,r,i=!1){var h,u,d;let n=new OF;n.prev=this.first,n.next=this.last,n.target=t?t.parent:r;let s=t?t.parent:r,a=this.getRange(t,e),l=this.listIterator(),c=e;if(c){let p=this.getRange(this.first,this.last);for(let m of p)this.remove(m);for(let m of p)m.ignore=!1,hi.getInstance().updateTree(m.item),s.insertNodeAfter(c,m),_r.getInstance().current.setTrackVisible((u=m.item)==null?void 0:u.globalIndex),c=m}else{let p=[];for(;l.hasNext();){let m=this.getFirstNode();if(!m)break;this.shift(),p.push(m),m.ignore=!1,m.parent=s,hi.getInstance().updateTree(m.item),_r.getInstance().current.setTrackVisible((h=m.item)==null?void 0:h.globalIndex)}i?(p=p.reverse(),p.forEach(m=>{s.addFirstNode(m)})):p.forEach(m=>{s.addLastNode(m)})}this.clear();for(let p of a)p.parent.remove(p),this.addLastNode(p),p.ignore=!0,hi.getInstance().deleteTree(p.item),_r.getInstance().current.setTrackHidden((d=p.item)==null?void 0:d.globalIndex);this.parentNode=n}getRange(t,e){let r=new Array,i=t;for(;i!=null&&(r.push(i),i!=e);)i=i.next;return r}insertNodeAfter(t,e){return e.parent=this,t.insertAfter(e),t===this.last&&(this.last=e),this.cnt++,e}getFirstNode(){return this.first}getLastNode(){return this.last}add(t){return this.addLast(t)}push(t){return this.addLast(t)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let t=this.first;if(t===null)throw Vne;return this.remove(t),t.item}removeLast(){let t=this.last;if(t===null)throw Vne;return this.remove(t),t.item}addLast(t){return this.first===null||this.last===null?(this.first=new EF(this,t),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,t)}addLastNode(t){return t.parent=this,this.first===null||this.last===null?(this.first=t,this.last=this.first,this.cnt=1,this.first):(this.last.insertAfter(t),this.last=t,this.cnt++,t)}addFirst(t){if(this.first===null||this.last===null){let e=new EF(this,t);return this.first=e,this.last=e,this.cnt++,e}else return this.insertBefore(this.first,t)}addFirstNode(t){return t.parent=this,this.first===null||this.last===null?(this.first=t,this.last=this.first,this.cnt=1,this.first):(this.first.insertBefore(t),this.first=t,this.cnt++,t)}getFirst(){if(this.first===null)throw Vne;return this.first.item}getLast(){if(this.last===null)throw Vne;return this.last.item}insertAfter(t,e){let r=new EF(this,e);return t.insertAfter(r),t===this.last&&(this.last=r),this.cnt++,r}insertBefore(t,e){let r=new EF(this,e);return t.insertBefore(r),t===this.first&&(this.first=r),this.cnt++,r}remove(t){t===this.first&&(this.first=t.next),t===this.last&&(this.last=t.prev),t.remove(),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new HSe(this.first)}listIterator(){return new WSe(this.first)}toArray(){let t=new Array(this.cnt),e=this.first,r=0;for(;e!=null;)t[r]=e.item,e=e.next,r++;return t}getAllItems(){return this.toArray()}};var bs=class{constructor(t,e){this.connectTrack=new Map;this.collideOrder=-1;this.item=t,this.isSource=e}addConnectTrack(t,e){this.connectTrack.set(t,e)}deleteConnectTrack(t){this.connectTrack.delete(t)}replace(t){_r.getInstance().current.setViaVisible(t.globalIndex),_r.getInstance().current.setViaHidden(this.item.globalIndex),this.item=t}};var lC=class{constructor(t){this.starts=new Array;this.ends=new Array;this.via=t;let e=this.getTracks(t.buildBBox()),r=t.center;for(let i of e){let n=i.model;n instanceof yt&&t.isContains(n.layerId)&&t.net==n.net&&!gc.getInstance().has(n.globalIndex)&&(n.start.distance2(r)<n.end.distance2(r)?this.starts.push(n):this.ends.push(n))}this.viaNode=_i.getInstance().createNode(this.via,!0)}getTracks(t){return Vt.searchByTypes(t,["Track","ArcTrack"]).getTracks()}generateList(t){for(let e of this.starts)xt.getInstance().getNode(e)==null&&new ku(e,t).generateList();for(let e of this.ends)xt.getInstance().getNode(e)==null&&new ku(e,t).generateList()}getConnectTracks(t){let e=new Set;for(let r of this.starts)if(!e.has(r)){let i=new ku(r,t);Re.addAllSet(e,i.tracks)}for(let r of this.ends)if(!e.has(r)){let i=new ku(r,t);Re.addAllSet(e,i.tracks)}return e}};var w6=class w6{constructor(){this.map=new Map;this.nodeMap=new Map;this._lastNode=void 0;this.replaceMap=new Map}static getInstance(){return w6.manager==null&&(w6.manager=new w6),w6.manager}getNode(t){let e=this.nodeMap.get(t);if(!e){for(let[r,i]of this.nodeMap)if(r.globalIndex===t.globalIndex){e=i;break}}return e}getViaNode(t,e){return this._lastNode=this.nodeMap.get(t),this._lastNode==null?(new lC(t).generateList(e),this._lastNode=this.nodeMap.get(t)):this._lastNode.isSource&&(new lC(t).generateList(e),this._lastNode=this.nodeMap.get(t)),this._lastNode}addModel(t){this.map.set(t.globalIndex,t),hi.getInstance().add(t)}createNode(t,e){return this._lastNode=this.nodeMap.get(t),this._lastNode!=null?this._lastNode:(this._lastNode=new bs(t,e),this.nodeMap.set(t,this._lastNode),this._lastNode)}getMapViaId(t){let e=this.replaceMap.get(t);for(;e;){let r=this.replaceMap.get(e);if(r)e=r;else break}return e}replace(t,e){let r=this.nodeMap.get(t);return r.replace(e),this.nodeMap.delete(t),this.nodeMap.set(e,r),this.replaceMap.get(e.globalIndex)?this.replaceMap.delete(e.globalIndex):t.globalIndex!=e.globalIndex&&this.replaceMap.set(t.globalIndex,e.globalIndex),r}getItem(t){return this.map.get(t)}delete(t){this.map.delete(t.globalIndex)}addVia(t,e,r,i,n,s,a,l,c,h,u,d,p,m=new Array,g=!1){e==0&&g&&(e=2);let y=new Gg(t,e,r,i,n,m,s,a,l,c,u,d,p,h,void 0);return this.addModel(y),y}clear(){for(let[,t]of this.map)t.remove();this.map.clear(),this.nodeMap.clear(),this.replaceMap.clear()}};w6.manager=null;var _i=w6;var Gne=class{constructor(t){this.connectTrack=new Map;this.item=t}addConnectTrack(t,e){this.connectTrack.set(t,e)}deleteConnectTrack(t){this.connectTrack.delete(t)}};var Une=class{constructor(t){this.starts=new Array;this.ends=new Array;this.via=t;let e=this.getTracks(t.buildBBox()),r=t.center;for(let i of e){let n=i.model;n instanceof yt&&(t.layerId==n.layerId||t.layerId==12&&!t.isUnuseLayer(n.layerId))&&t.net==n.net&&(n.start.distance2(r)<n.end.distance2(r)?this.starts.push(n):this.ends.push(n))}}getTracks(t){return Vt.searchByTypes(t,["Track","ArcTrack"]).getTracks()}generateList(t){for(let e of this.starts)xt.getInstance().getNode(e)==null&&new ku(e,t).generateList();for(let e of this.ends)xt.getInstance().getNode(e)==null&&new ku(e,t).generateList()}};var L6=class L6{constructor(){this.nodeMap=new Map;this._lastNode=null}static getInstance(){return L6.manager==null&&(L6.manager=new L6),L6.manager}getNode(t,e){return this._lastNode=this.nodeMap.get(t),this._lastNode==null&&(this._lastNode=this.createNode(t),new Une(t).generateList(e),this._lastNode=this.nodeMap.get(t)),this._lastNode}createNode(t){return this._lastNode=this.nodeMap.get(t),this._lastNode!=null?this._lastNode:(this._lastNode=new Gne(t),this.nodeMap.set(t,this._lastNode),this._lastNode)}clear(){this.nodeMap.clear()}};L6.manager=null;var yc=L6;var aOt=Math.PI/2,_5i=Math.PI/4,v5i=Math.PI/8;function zg(o,t){return Math.abs(o)<aOt?t*Math.tan(Math.abs(o)):Number.MAX_VALUE}function ia(o,t){if(t.length!=3)return[o,o];let e=t[1].sub(t[0]),r=t[2].sub(t[1]),i=Math.abs(e.x)<1e-8&&Math.abs(e.y)<1e-8,n=Math.abs(r.x)<1e-8&&Math.abs(r.y)<1e-8,s=e.normalize(),a=r.normalize();return i&&n?[o,o]:!i&&n?[s,s]:i&&!n?[a,a]:[s,a]}function o_(o,t,e){let r=t.sub(o);return e.cross(r)}function Qj(o,t,e){let r=t.sub(o);return e.dot(r)}function eX(o,t){let e=t.x-o.x,r=t.y-o.y;return Math.abs(e)>Math.abs(r)?e>0?new S(1,0):new S(-1,0):r>0?new S(0,1):new S(0,-1)}function AF(o,t=!0){let e=o.center,r=o.end(),i=Math.PI/2,n=o.sweep();return t?i=n===le.CCW?i:-i:(r=o.start(),i=n===le.CCW?-i:i),r.sub(e).normalize().rotate(S.ORIGIN,i)}function zSe(o,t){return o.cross(t)>0?le.CCW:le.CW}function LGe(o){let t=Math.PI,e=t/2,r=e/2,i=o.angleX(),n=t*6/180,s=r+e,a=r+e*2,l=r+e*3;return i>=r-n&&i<=r+n?new S(1,1).normalize():i>=s-n&&i<=s+n?new S(-1,1).normalize():i>=a-n&&i<=a+n?new S(-1,-1).normalize():i>=l-n&&i<=l+n?new S(1,-1).normalize():i<r||i>e*3+r?new S(1,0):i<e+r?new S(0,1):i<t+r?new S(-1,0):new S(0,-1)}function Hne(o,t=40){for(let e=0;e<o.length;e++)for(let r=e+1;r<o.length;r++){let i=o[e],n=o[r];if(i.distance1(n)>t)return!1}return!0}function _F(o){switch(o){case"Single wiring":return"SINGLE_WIRE";case"Differential pair wiring":return"DIFF_WIRE";case"Multi-route wiring":return"MULTI_WIRE"}}function Ps(o){return o.partition!=x.getInstance().partitionId}var ku=class{constructor(t,e){this.all=new Set;this.reverseTrack=new Array;this.tracks=new Array;this.track=t,this.layerId=t.layerId,this.precision=e,this.generateChain(t)}generateChain(t){let e=t.start,r=t.end;return this.all.add(t),this.tracks.push(t),t.locked||Ps(t)||t.getParent()!=null?this:(this.getTracks(e,t.net,t.width),this.reverse(),this.reverseTrack.push(!1),this.getTracks(r,t.net,t.width,!1),this)}reverse(){if(this.reverseTrack.length!=0){this.reverseTrack.reverse(),this.tracks.reverse();for(let t=0,e=this.reverseTrack.length;t<e;t++)this.reverseTrack[t]=!this.reverseTrack[t]}}searchTracks(t){return Vt.search4Types(t,["Pad","Via","Track","ArcTrack"],this.keep.bind(this)).getTPV()}keep(t,e){return e=="Track"||e=="ArcTrack"?t==this.layerId:e=="Pad"?t==12||t==this.layerId:e=="Via"}reversePath(){this.reverse(),[this.startType,this.endType]=[this.endType,this.startType],[this.start,this.end]=[this.end,this.start]}getTracks(t,e,r,i=!0){for(;t;){let n=new ut(t.x,t.x,t.y,t.y),s=this.searchTracks(n),a=[];for(let b of s)Bt.checkIsCanEditByItem(b)&&a.push(b.model);let l=new Array;for(let b of a)b instanceof It?b.net==e&&this.posEqual(b.center,t)&&b.isContains(this.layerId)&&l.push(b):b instanceof Je?b.net==e&&this.posEqual(b.center,t)&&(b.layerId==this.layerId||b.layerId==12)&&l.push(b):b instanceof yt&&b.net==e&&!this.all.has(b)&&b.layerId==this.layerId&&(this.posEqual(b.start,t)||this.posEqual(b.end,t))&&l.push(b);let c=new Array,h=new Array,u=new Array;if(i&&this.start==null||!i&&this.end==null)for(let b of l){let P=null;if((b instanceof Je||b instanceof It)&&(P=b),P!=null&&P.net==e&&this.posEqual(P.center,t)){i?(this.start=P,b instanceof Je?this.startType=1:this.startType=2):(b instanceof Je?this.endType=1:this.endType=2,this.end=P);return}}if(l.length==0){Re.addAll(l,a);let b=new Array;if(i&&this.start==null||!i&&this.end==null)for(let E of l){let O=null;if(E instanceof Je?E.net==e&&(E.layerId==this.layerId||E.layerId==12)&&(O=E,b.push(O)):E instanceof It&&E.net==e&&E.isContains(this.layerId)&&(O=E,b.push(O)),O!=null&&O.net==e&&this.posEqual2(O.center,t)){i?(this.start=O,E instanceof Je?this.startType=1:this.startType=2):(E instanceof Je?this.endType=1:this.endType=2,this.end=O);return}}let P=new aP(t,r/2,S.ORIGIN,{point:t,item:null,isStart:i}),T=new Array;T.push(P);for(let E of l)if(E instanceof yt&&this.itemIsWire(E)&&!this.all.has(E)&&E.net==e&&E.layerId==this.layerId&&E.length>1e-4){if(i&&!E.start.equals1(this.track.end)||!i&&!E.start.equals1(this.track.start)){let O=new aP(E.start,E.width/2,S.ORIGIN,{point:E.end,item:E,isStart:!0});T.push(O)}if(i&&!E.end.equals1(this.track.end)||!i&&!E.end.equals1(this.track.start)){let O=new aP(E.end,E.width/2,S.ORIGIN,{point:E.start,item:E,isStart:!1});T.push(O)}}new QR(T).classify();let C=P.getConnectNeighbors();for(let E of C){c.push(E.component.point);let O=E.component.item;E.component.isStart?h.push(!1):h.push(!0),this.all.add(O),u.push(O)}if(c.length==0){let E=Number.MAX_VALUE,O=null;for(let _ of b)if(_.inOutline(t)){let R=_.center.distance2(t);R<E&&(E=R,O=_)}if(O!=null){i?(this.start=O,O instanceof Je?this.startType=1:this.startType=2):(O instanceof Je?this.endType=1:this.endType=2,this.end=O);return}}}else for(let b of l)b instanceof yt&&this.itemIsWire(b)&&!this.all.has(b)&&b.net==e&&b.layerId==this.layerId&&b.length>1e-4&&(this.posEqual2(b.start,t)?(c.push(b.end),h.push(!1),this.all.add(b),u.push(b)):this.posEqual2(b.end,t)&&(c.push(b.start),h.push(!0),this.all.add(b),u.push(b)));let d=c.length,p=new Array,m=new Array,g=new Array;for(let b=0;b<d;b++){let P=c[b],T=h[b],I=u[b];p.push(P),m.push(T),g.push(I)}let y=xt.getInstance();if(g.length==1&&!y.getNode(g[0])){let b=g[0];if(b.locked||Ps(b)||b.getParent()!=null){i?this.startType=10:this.endType=10;for(let P of g)this.all.delete(P)}else{this.tracks.push(g[0]),this.reverseTrack.push(m[0]),t=p[0];continue}}else if(c.length==1){i?this.startType=12:this.endType=12;for(let b of u)this.all.delete(b)}else if(c.length>1){i?this.startType=11:this.endType=11;for(let b of u)this.all.delete(b)}else for(let b of u)this.all.delete(b);t=null}}posEqual(t,e){return this.precision==null?t.equals1(e):t.distance1(e)<this.precision}posEqual2(t,e){return this.precision==null?t.distance2(e)<1e-4:t.distance1(e)<this.precision}itemIsWire(t){return t instanceof yt}generateList(){let t=xt.getInstance(),e=t.createList(),r=this.tracks.length;for(let i=0;i<r;i++){let n=this.tracks[i];if(this.reverseTrack[i]){if(n instanceof qr){let{start:a,end:l}=n;n.start=l,n.end=a}else if(n instanceof Oi){let{center:a,radius:l,startAngle:c,endAngle:h,sweep:u}=n;n.startAngle=h,n.endAngle=c,n.sweep=u==le.CCW?le.CW:le.CCW}}t.createNode(n,e)}if(e.startType=this.startType,e.endType=this.endType,this.start!=null&&this.start instanceof It){let i=_i.getInstance(),n=i.getNode(this.start);n==null&&(n=i.createNode(this.start,!0)),n.addConnectTrack(e,!0),e.viaNode.prev=n}if(this.start!=null&&this.start instanceof Je&&(yc.getInstance().getNode(this.start,this.precision).addConnectTrack(e,!0),e.otherNode.prev=this.start),this.end!=null&&this.end instanceof It){let i=_i.getInstance(),n=i.getNode(this.end);n==null&&(n=i.createNode(this.end,!0)),n.addConnectTrack(e,!1),e.viaNode.next=n}this.end!=null&&this.end instanceof Je&&(yc.getInstance().getNode(this.end,this.precision).addConnectTrack(e,!1),e.otherNode.next=this.end)}};var M6=class M6{constructor(){this.map=new Map;this._lastList=null;this._lastNode=null}static getInstance(){return M6.manager==null&&(M6.manager=new M6),M6.manager}getNode(t){return this._lastNode=this.map.get(t.globalIndex),this._lastNode!=null&&this._lastNode.set(t),this._lastNode}getListNode(t){return this._lastNode=this.getNode(t),this._lastNode==null&&(new ku(t).generateList(),this._lastNode=this.getNode(t)),this._lastNode}set(t,e){this.map.set(t.globalIndex,e)}delete(t){this.map.delete(t.globalIndex)}createList(){return this._lastList=new Kn,this._lastList}createNode(t,e){return this._lastNode=this.getNode(t),this._lastNode!=null?this._lastNode:(this._lastNode=e.add(t),this.set(t,this._lastNode),this._lastNode)}createFirstNode(t,e){return this._lastNode=this.getNode(t),this._lastNode!=null?this._lastNode:(this._lastNode=e.addFirst(t),this.set(t,this._lastNode),this._lastNode)}clear(){this.map.clear(),this._lastList=null,this._lastNode=null}};M6.manager=null;var xt=M6;var Br=class extends Ou{constructor(e=""){super();this.commands=new Array;this.description=e}upload(e){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}undo(){let e=this.commands.length;if(e!=0)for(let r=e-1;r>=0;r--)this.commands[r].undo()}redo(){if(this.commands.length!=0)for(let r of this.commands)r.redo()}addCommand(e){this.commands.push(e)}get length(){return this.commands.length}};var s_=class{constructor(t,e,r){this.path=new Array;let i=new Array;for(let h of t){if(h instanceof M&&h.length()<1e-8)continue;let u=this.getPrimitive(h,e,r);if(u!=null){if(i.length>0&&u instanceof q){let d=u.start().sub(u.center).normalize(),p=u.sweep()==le.CCW?new S(d.y,-d.x):new S(-d.y,d.x),m=this.addLine(u.start(),p,e,!0);m.length()>1e-8&&i.push(m)}if(i.push(u),u instanceof q){let d=u.end().sub(u.center).normalize(),p=u.sweep()==le.CCW?new S(-d.y,d.x):new S(d.y,-d.x),m=this.addLine(u.end(),p,e,!1);m.length()>1e-8&&i.push(m)}}}for(let h=0,u=i.length;h<u;h++){let d=i[h],p=i[h+1];if(p!=null){let m=this.getPoint(d,p);if(m!=null){let g=this.modifyPrimitiveEnd(d,m),y=this.modifyPrimitiveStart(p,m);i.splice(h,2,g,y)}}}if(i.length==0)return;let n=fe.build2(i),s=new Array;for(let h=0,u=n.primitives.length;h<u;){let d=n.primitives[h],p=this.getInters(d,n.primitives,h+1);if(p>h+1){h=p;let m=this.getPoint(d,n.primitives[p]);if(m!=null){let g=this.modifyPrimitiveEnd(d,m),y=this.modifyPrimitiveStart(n.primitives[p],m);n.primitives.splice(h,1,g),n.primitives.splice(p,1,y),s.push(g)}}else s.push(d),h++}let a=this.getNearPoint(s[s.length-1],t[t.length-1].end()),l=this.modifyPrimitiveEnd(s[s.length-1],a);if(l!=null&&s.splice(s.length-1,1,l),s.length==0)return;let c=fe.build2(s);this.path=c.primitives}getNearPoint(t,e){let i=new ir(t,new M(e,e)).getLine();return i.start().distance2(e)<i.end().distance2(e)?i.end():i.start()}isParaller(t,e){if(t instanceof M&&e instanceof M){let r=t.direct.cross(e.direct);if(ne.eq(r,0))return!0}return!1}getPoint(t,e){let r=Tt(t,e),i=null,n=Number.MAX_VALUE,s=this.isParaller(t,e),a=null;for(let l=0;l<r;l+=2){let c=new S(Ee[l],Ee[l+1]),h=c.distance2(t.start());h<n&&(i=c,n=h),a==null?a=c:a=a.add(c)}return s&&r>0&&a!=null?a.mul(2/r):i}modifyPrimitiveStart(t,e){if(t instanceof M)return new M(e,t.end());if(t instanceof q){if(t.start().equals1(e))return t;let r=e.angleD(t.center);return q.build2(t.center,r,t.endAngle(),t.rx,t.ry,t.sweep())}return null}modifyPrimitiveEnd(t,e){if(t instanceof M)return new M(t.start(),e);if(t instanceof q){if(t.end().equals1(e))return t;let r=e.angleD(t.center);return q.build2(t.center,t.startAngle,r,t.rx,t.ry,t.sweep())}return null}getInters(t,e,r){let i=-1;for(let n=r,s=e.length;n<s;n++){let a=e[n];Tt(t,a)>0&&(i=n)}return i}getPrimitive(t,e,r){if(t instanceof M){let i=t.end().sub(t.start()).normalize(),n=new S(-i.y,i.x).mul(e);r==le.CW&&(n=n.mul(-1));let s=t.start().sub(i.mul(e)).add(n),a=t.end().add(i.mul(e)).add(n);return new M(s,a)}else if(t instanceof q){let i=t.rx;return t.sweep()==le.CCW?r==le.CCW?i=t.rx-e:i=t.rx+e:r==le.CCW?i=t.rx+e:i=t.rx-e,i<=0?null:q.build2(t.center,t.startAngle,t.endAngle(),i,i,t.sweep())}return null}addLine(t,e,r,i){let n=t.add(e.mul(r));return i?new M(n,t):new M(t,n)}};function YSe(o){let t=0;for(let e of o)e instanceof M?t+=e.length():e instanceof q&&(t+=Math.abs(Ht.toRadians(e.sweepAngle)*e.rx));return t}function Ot(o,t){o=Array.isArray(o)?o:[o];for(let e=o.length;e>=0;e--){let r=o[e];if(!(e>0&&lOt(r))){if(r instanceof M)return r.direct;if(r instanceof q){t=t||r.end();let i=t.sub(r.center).normalize();return r.sweep()==le.CCW?new S(-i.y,i.x):new S(i.y,-i.x)}}}return null}function lOt(o){return o instanceof M?ne.eq(o.length(),0):o instanceof q?ne.eq(o.sweepAngle,0):!0}function MGe(o){let t=new Array(o.length);for(let e=0,r=o.length-1;r>=0;e++,r--){let i=Hp(o[r]);t[e]=i}return t}function gd(o,t){if(o instanceof q){if(Math.abs(o.sweepAngle)===360){let i=o.center.sub(t).mul(2).add(t),n=q.build4(i,t,o.center,o.rx,o.rx,o.sweep()),s=q.build4(t,i,o.center,o.rx,o.rx,o.sweep());return[n,s]}let e=q.build4(o.start(),t,o.center,o.rx,o.rx,o.sweep()),r=q.build4(t,o.end(),o.center,o.rx,o.rx,o.sweep());return e.start().equals1(e.end())&&(e=new M(o.start(),t)),r.start().equals1(r.end())&&(r=new M(t,o.end())),[e,r]}else return[new M(o.start(),t),new M(t,o.end())]}function nD(o,t){if(t.length==1)return gd(o,t[0]);let e=new Array;if(o instanceof q){if(Math.abs(o.sweepAngle)===360){let n=t[0];for(let a=1,l=t.length;a<l;a++){let c=t[a],h=q.build4(n,c,o.center,o.rx,o.rx,o.sweep());h.start().equals1(h.end())&&(h=new M(n,c)),n=c,e.push(h)}let s=q.build4(n,t[0],o.center,o.rx,o.rx,o.sweep());return s.start().equals1(s.end())&&(s=new M(s.start(),s.end())),e.push(s),e}let r=o.start();for(let n of t){let s=q.build4(r,n,o.center,o.rx,o.rx,o.sweep());s.start().equals1(s.end())&&(s=new M(r,n)),r=n,e.push(s)}let i=q.build4(r,o.end(),o.center,o.rx,o.rx,o.sweep());return i.start().equals1(i.end())&&(i=new M(r,o.end())),e.push(i),e}else{let r=o.start();for(let n of t){let s=new M(r,n);r=n,e.push(s)}let i=new M(r,o.end());return e.push(i),e}}function Yg(o,t,e=1e-8){return Math.abs(o.cross(t))<=e}function f3(o,t,e=1e-8){return Math.abs(o.dot(t))<=e}function tX(o,t,e=1e-8){let r=o.cross(t);return Math.abs(r)<=e?null:r>0?le.CCW:le.CW}function jSe(o,t,e=1e-8){return o.dot(t)>=1-e}function lb(o,t){if(t instanceof M){let e=t.end().sub(t.start()).normalize(),r=o.sub(t.start()).normalize(),i=e.cross(r);return ne.greater(i,0)?le.CCW:ne.less(i,0)?le.CW:null}else if(t instanceof q){let e=t.center,r=t.rx,i=t.sweep(),n=o.distance1(e);return ne.greater(n,r)?i==le.CCW?le.CW:le.CCW:ne.less(n,r)?i:null}}function kT(o,t,e){let r=t.cross(e),i=t.cross(o),n=e.cross(o);return r*i>0&&i*n<0}function hg(o,t,e,r){let i=o.start(),n=o.end();if(o instanceof q){let s=t.sub(o.center).normalize(),a=i.sub(o.center).normalize(),l=n.sub(o.center).normalize();if(kT(s,a,l))return lb(t,o);if(ne.eq(Math.abs(o.sweepAngle),180)){if(o.sweepAngle>0){if(ne.greater(a.cross(s),0))return lb(t,o)}else if(ne.greater(l.cross(s),0))return lb(t,o)}}if(t.distance2(i)<t.distance2(n))if(e!=null){let s=t.sub(i).normalize(),a=Ot(e).mul(-1),l=Ot(o,i),c=a.mul(-1).cross(l);return ne.eq(c,0)?lb(t,o):kT(s,a,l)?ne.greater(c,0)?le.CCW:le.CW:Yg(s,a)&&e.bbox().isContains(t)||Yg(s,l)&&o.bbox().isContains(t)?null:ne.greater(c,0)?le.CW:le.CCW}else return lb(t,o);else if(r!=null){let s=t.sub(n).normalize(),a=Ot(o,n).mul(-1),l=Ot(r,r.start()),c=a.mul(-1).cross(l);return ne.eq(c,0)?lb(t,o):kT(s,a,l)?ne.greater(c,0)?le.CCW:le.CW:Yg(s,a)&&o.bbox().isContains(t)||Yg(s,l)&&r.bbox().isContains(t)?null:ne.greater(c,0)?le.CW:le.CCW}else return lb(t,o)}var NGe=new th(1e-4);function oD(o,t){return!!(NGe.eq(o.direct.cross(t.sub(o.start())),0)&&o.bbox().extendOfSize(1e-4).isContains(t))}function sD(o,t){if(o.start().equals1(t)||o.end().equals1(t))return!0;let e=t.sub(o.center);if(NGe.eq(e.length(),o.rx)&&o.bbox().extendOfSize(1e-4).isContains(t)){e=e.normalize();let r=o.start().sub(o.center).normalize(),i=o.end().sub(o.center).normalize();return Math.abs(o.sweepAngle)<180?kT(e,r,i):!kT(e,r,i)}return!1}var bc=class o{constructor(t,e,r,i,n,s){this.start=t,this.end=e,this.pts=r;let a=this.getNear(t,r,!0),l=this.isEndpoint(this.startPt,a),c=this.getNear(e,r,!1),h=this.isEndpoint(this.endPt,c),u=lb(t,this.startPt)||le.CW,d=r.indexOf(this.startPt),p=r.indexOf(this.endPt),m=o.getPoint(e,c);function g(y){if(n!=null&&y.length>0){let b=Tt(n,y[0]);if(b>0){let P=new Array;for(let T=0;T<b;T+=2)P.push(new S(Ee[T],Ee[T+1]));dn(P,n),t=P[0]}}if(s!=null&&y.length>0){let b=Tt(s,y[y.length-1]);if(b>0){let P=new Array;for(let T=0;T<b;T+=2)P.push(new S(Ee[T],Ee[T+1]));dn(P,s),e=P[P.length-1]}}}if(d<p){let y=r.slice(d,p);y.push(this.endPt);let b=i==null?a.getDistance():i>a.getDistance()?i:a.getDistance(),P=new s_(y,b,u);this.result=P.path,g(this.result);let T=o.modifyStart(t,this.result[0]);if(this.result.splice(0,1,T),this.result.length==0)return;let I=this.result.pop();for(;this.result.length>0&&I.length()<1e-8;)I=this.result.pop();let C=new M(m,m),E=new ir(C,I),O=o.getPoint(m,E),_=o.modifyEnd(O,I);this.result.push(_)}else if(d===p){let y=[this.startPt],b=i==null?a.getDistance():i>a.getDistance()?i:a.getDistance();if(this.startPt instanceof q&&this.startPt.isCircle()){this.result=this.interceptCircle(this.startPt,t,e,u,b);return}let P=new s_(y,b,u);if(this.result=P.path,this.result.length==0)return;g(this.result);let T=this.result.pop();for(;this.result.length>0&&T.length()<1e-8;)T=this.result.pop();let I=new M(m,m),C=new ir(I,T),E=o.getPoint(m,C),O=o.modifyStart(t,T),_=o.modifyEnd(E,O);this.result.push(_)}else{let y=r.slice(p,d);y.push(this.startPt);let b=i==null?a.getDistance():i>a.getDistance()?i:a.getDistance(),P=new s_(y,b,u);for(this.result=P.path,g(this.result);this.result.length>0;){let I=this.result.pop();if(I instanceof M){if(l||oD(I,t)){I=o.modifyEnd(t,I),this.result.push(I);break}}else if(I instanceof q&&(l||sD(I,t))){I=o.modifyEnd(t,I),this.result.push(I);break}}if(this.result.length==0)return;let T=this.result.shift();if(ne.eq(c.getDistance(),b)&&lb(e,this.endPt)==u){let I=o.modifyStart(e,T);this.result.unshift(I)}else{let I=new M(m,m),C=new ir(I,T),E=o.getPoint(m,C),O=o.modifyStart(E,T);this.result.unshift(O)}this.result=this.reverse(this.result)}}interceptCircle(t,e,r,i,n){let s=(e.angleD(t.center)+360)%360,a=(r.angleD(t.center)+360)%360,l=t.rx;if(t.sweep()==le.CCW?i==le.CCW?l=t.rx-n:l=t.rx+n:i==le.CCW?l=t.rx+n:l=t.rx-n,l<=0)return null;{let c=a-s,h;return a>s?Math.abs(c)>180?h=le.CW:h=le.CCW:Math.abs(c)>180?h=le.CCW:h=le.CW,[q.build2(t.center,s,a,l,l,h)]}}isEndpoint(t,e){let r=e.getLine();return r.start().equals1(t.start())||r.start().equals1(t.end())||r.end().equals1(t.start())||r.end().equals1(t.end())}reverse(t){let e=new Array(t.length);for(let r=0,i=t.length-1;i>=0;r++,i--){let n=Hp(t[i]);e[r]=n}return e}static getPoint(t,e){if(e.getDistance()==0)return t;let r=e.getLine(),i=t.distance2(r.start()),n=t.distance2(r.end());return i>n?r.start():r.end()}static modifyStart(t,e){if(e instanceof M)return new M(t,e.end());if(e instanceof q){if(e.end().equals1(t))return new M(e.end(),t);let r=e.sweep();bf(e,t)||(r=r==le.CCW?le.CW:le.CCW);let i=t.angleD(e.center);return q.build2(e.center,i,e.endAngle(),e.rx,e.ry,r)}}static modifyEnd(t,e){if(e instanceof M)return new M(e.start(),t);if(e instanceof q){if(e.start().equals1(t))return new M(e.start(),t);let r=e.sweep();bf(e,t)||(r=r==le.CCW?le.CW:le.CCW);let i=t.angleD(e.center);return q.build2(e.center,e.startAngle,i,e.rx,e.ry,r)}}get startpt(){return this.startPt}getNear(t,e,r){let i=new M(t,t),n=Number.MAX_VALUE,s=null,a=null;for(let l of e){let c=new ir(i,l);if(c.getDistance()<n)s=c,n=c.getDistance(),a=c.getLine().direct,r?this.startPt=l:this.endPt=l;else if(Math.abs(c.getDistance()-n)<1e-8){let h=c.getLine(),u=r?this.startPt:this.endPt,d=this.getDot(a,u,t),p=this.getDot(h.direct,l,t);Math.abs(d)>Math.abs(p)&&(s=c,n=c.getDistance(),a=c.getLine().direct,r?this.startPt=l:this.endPt=l)}}return s}getDot(t,e,r){if(e instanceof M)return t.dot(e.direct);if(e instanceof q){let i=r.sub(e.center).normalize(),n=e.sweep()==le.CCW?new S(-i.y,i.x):new S(i.y,-i.x);return t.dot(n)}return 1}},Wne=class{constructor(t,e,r,i){this.start=t,this.end=e,this.pts=r;let n=this.getNear(t,r,!0),s=this.getNear(e,r,!1),a=lb(t,this.startPt)||le.CW,l=r.indexOf(this.startPt),c=r.indexOf(this.endPt),h=bc.getPoint(e,s);if(l<c){let u=r.slice(l,c);u.push(this.endPt);let d=i==null?n.getDistance():i>n.getDistance()?i:n.getDistance(),p=new s_(u,d,a);this.result=p.path;let m=bc.modifyStart(t,this.result[0]);this.result.splice(0,1,m);let g=this.result.pop();for(;g.length()<1e-8;)g=this.result.pop();let y=new M(h,h),b=new ir(y,g),P=bc.getPoint(h,b),T=bc.modifyEnd(P,g);this.result.push(T)}else if(l===c){let u=[this.startPt],d=i==null?n.getDistance():i>n.getDistance()?i:n.getDistance(),p=new s_(u,d,a);this.result=p.path;let m=this.result.pop();for(;m.length()<1e-8;)m=this.result.pop();let g=new M(h,h),y=new ir(g,m),b=bc.getPoint(h,y),P=bc.modifyStart(t,m),T=bc.modifyEnd(b,P);this.result.push(T)}else{let u=r.slice(c,l);u.push(this.startPt);let d=i==null?n.getDistance():i>n.getDistance()?i:n.getDistance(),p=new s_(u,d,a);this.result=p.path;let m=bc.modifyEnd(t,this.result[this.result.length-1]);this.result.splice(this.result.length-1,1,m);let g=this.result.shift(),y=new M(h,h),b=new ir(y,g),P=bc.getPoint(h,b),T=bc.modifyStart(P,g);this.result.splice(0,0,T),this.result=this.reverse(this.result)}}reverse(t){let e=new Array(t.length);for(let r=0,i=t.length-1;i>=0;r++,i--){let n=Hp(t[i]);e[r]=n}return e}static getPoint(t,e){if(e.getDistance()==0)return t;let r=e.getLine(),i=t.distance2(r.start()),n=t.distance2(r.end());return i>n?r.start():r.end()}static modifyStart(t,e){if(e instanceof M)return new M(t,e.end());if(e instanceof q){let r=e.sweep();bf(e,t)||(r=r==le.CCW?le.CW:le.CCW);let i=t.angleD(e.center);return q.build2(e.center,i,e.endAngle(),e.rx,e.ry,r)}}static modifyEnd(t,e){if(e instanceof M)return new M(e.start(),t);if(e instanceof q){let r=e.sweep();bf(e,t)||(r=r==le.CCW?le.CW:le.CCW);let i=t.angleD(e.center);return q.build2(e.center,e.startAngle,i,e.rx,e.ry,r)}}getNear(t,e,r){let i=new M(t,t),n=Number.MAX_VALUE,s=null,a=null;if(r){let l=e[0];return this.startPt=l,new ir(i,l)}else{let l=e[e.length-1];return this.endPt=l,new ir(i,l)}}getDot(t,e,r){return e instanceof M?t.dot(e.direct):e instanceof q?t.dot(r.sub(e.center).normalize()):1}};var Ti=class extends Ou{upload(t){}updateData(){}constructor(t,e=!1){super(),this.list=t,this.previous=t.parentNode.prev,this.next=t.parentNode.next,this.insertPre=e}redo(){this.list.replace(this.previous,this.next,this.list.parentNode.target,this.insertPre),this.previous=this.list.parentNode.prev,this.next=this.list.parentNode.next}undo(){this.list.replace(this.previous,this.next,this.list.parentNode.target,this.insertPre),this.previous=this.list.parentNode.prev,this.next=this.list.parentNode.next}};var N6=class N6{constructor(){this.id=0}static getInstance(){return N6.manager==null&&(N6.manager=new N6),N6.manager}getID(){return this.id++}};N6.manager=null;var Vf=N6;var k6=class k6{constructor(){this.map=new Map;this._last=null}static getInstance(){return k6.manager==null&&(k6.manager=new k6),k6.manager}addModel(t){return this._last=t,this.map.set(t.globalIndex,this._last),hi.getInstance().add(t),this._last}getItem(t){return this.map.get(t)}delete(t){this.map.delete(t.globalIndex)}deleteAll(){for(let[,t]of this.map)t.remove();this.map.clear(),this._last=null}addTrack(t,e,r,i,n,s,a){return this._last=new qr(t,e,r,i,n,s,a,null),this.addModel(this._last),this._last}addArcTrack(t,e,r,i,n,s,a,l,c,h,u=1){return this._last=new Oi(t,e,r,i,l,n,s,a,c,h,u,null),this.addModel(this._last),this._last}};k6.manager=null;var Zl=k6;var aD=class extends Ou{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e,r){super(),this.gId=t.globalIndex,this.list=e,this.node=r}redo(){let t=Zl.getInstance().getItem(this.gId);this.node.set(t),this.list.addLastNode(this.node),xt.getInstance().set(t,this.node)}undo(){this.list.remove(this.node);let t=this.node.item;this.node.set(null),xt.getInstance().delete(t)}};var a_=class extends so{constructor(t,e){super(),this.track=t.clone();let r=t.getGroupID();r&&this.track.setGroupID(r),this.net=t.net,this.action=e}rebuild(){let t=Zl.getInstance().getItem(this.track.globalIndex),e=this.track.clone();e.net=this.net,t!=null&&xt.getInstance().getNode(t).set(e);let r=this.track.getGroupID();return r&&e.setGroupID(r),Zl.getInstance().addModel(e),_r.getInstance().current.setTrackVisible(e.globalIndex),e}getItem(){return"ignore"}remove(){let t=this.track.globalIndex,e=Zl.getInstance().getItem(t);e.remove(),hi.getInstance().deleteTree(e),Zl.getInstance().delete(e),_r.getInstance().current.setTrackHidden(t)}modify(){let t=this.track.globalIndex,e=Zl.getInstance().getItem(t)||An.getInstance().getItem(t),r=e.clone(),i=e.getGroupID();i&&r.setGroupID(i);let n=e.net;e.layerId!=this.track.layerId&&(e.layerId=this.track.layerId),e.start.equals(this.track.start)||(e.start=this.track.start),e.end.equals(this.track.end)||(e.end=this.track.end),e.width!=this.track.width&&(e.width=this.track.width),e.locked!=this.track.locked&&(e.locked=this.track.locked),e.net!=this.net&&(e.net=this.net),this.track=r,this.net=n}updateData(){throw new Error("Method not implemented.")}upload(t){throw new Error("Method not implemented.")}};var Ss=class o{constructor(t){this.changeFanOutMode=!1;this.userModifyWidth=!1;this.userModifyViaSize=!1;this._wireMode=t,this.fanOutMode=1}static getInstance(t){return o.instance||(o.instance=new o(t)),t&&(o.instance._wireMode=t),o.instance}set wireMode(t){this._wireMode=t}get wireMode(){return this._wireMode}get wireConfirmType(){return this._wireMode=="Single wiring"?ce.pcbConfig.wireConfirm:"current"}get viaPosition(){return this._wireMode=="Single wiring"?ce.pcbConfig.addViaMethodWhileRoute:"currentInflectionPoint"}get autoChangeLayerWhileRoutingVias(){return ce.pcbConfig.autoChangeLayerWhileRoutingVias}get dblclickPlaceViasWhileRouting(){return ce.pcbConfig.dblclickPlaceViasWhileRouting}get placeBlind(){return ce.pcbConfig.placeBlind}get autoTerminateRouting(){return ce.pcbConfig.autoTerminateRouting}get showNetLength(){return this._wireMode=="Multi-route wiring"?!1:ce.pcbConfig.showNetLength}get showDiffLength(){return this._wireMode=="Multi-route wiring"?!1:ce.pcbConfig.showDiffLength}get routeAutoFanoutEnd(){return ce.pcbConfig.routeAutoFanoutEnd}get isAssignNetForFreeTrack(){return ce.pcbConfig.isAssignNetForFreeTrack}get autoLoopUpMsgBox(){return ce.pcbConfig.autoLoopUpMsgBox}set autoLoopUpMsgBox(t){ce.pcbConfig.autoLoopUpMsgBox=t,A.windowBridge.rpcCall("setUsrPcbFootprintLoopSetting",t,$())}get removeLoop(){return we.removeLoop}clear(){this.userModifyWidth=!1,this.userModifyViaSize=!1,this.doubleClickItem=null,this.changeFanOutMode=!1}reset(){this.width=null,this.innerRadius=null,this.radius=null,this.changeFanOutMode=!1}};var F6=class F6{constructor(){this.map=new Map}static getInstance(){return F6.manager==null&&(F6.manager=new F6),F6.manager}changeViaPosition(t,e){let r=this.map.get(t);r==null&&(r=new On,this.map.set(t,r)),r.add(e)}getFirstPosition(t){let e=this.map.get(t);return e==null?t.center:e.getFirst()}getLastPosition(t){let e=this.map.get(t);return e==null?t.center:e.getLast()}remove(t){this.map.delete(t)}clear(){this.map.clear()}};F6.manager=null;var Es=F6;var BT=class{constructor(t,e){this.style=null;this.direct=t,this.delta=e}reverse(){this.direct=this.direct.mul(this.delta).normalize().mul(-1),this.delta=-this.delta}},zne=class{getEvent(t){let e=[];for(let r of t.tracks){let i=new Yne(r.start.point,r.start.direct,r.width,r.net);e.push(i)}return this.linked(e,t.gaps),new jne(e,t.gaps,t.node.width)}getEndEvent(t){let e=[];for(let r of t.tracks){let i=new Yne(r.end.point,r.end.direct,r.width,r.net,r.drawing==0);e.push(i)}return this.linked(e,t.gaps),new jne(e,t.gaps,t.node.width)}linked(t,e){for(let r=0;r<t.length;r++){let i=t[r],n=e[r];i.next=n,i.previous=e[r-1]}}},Yne=class o{constructor(t,e,r,i,n=!0){this.previous=null;this.next=null;this.change=null;this.hasChanged=!1;this.point=t,this.direct=e,this.width=r,this.net=i,this.fanout=n}reverse(){this.direct=this.direct.mul(-1)}getNext(t){let e=new o(t,this.direct,this.width,this.net);return e.previous=this.previous,e.next=this.next,e.change=this.hasChanged?null:this.change,e.parent=this,e}getSameDirect(t){let e=this.point.add(this.direct.mul(t));return this.getNext(e)}getChangeNode(){if(this.change==null)return this;if(this.change.delta>0){let t=this.point.add(this.change.direct.mul(this.change.delta)),e=this.getNext(t);return e.hasChanged=!0,this.clearParentChange(),e.getSameDirect(this.change.delta)}else{let t=this.point.add(this.change.direct.mul(this.change.delta)),e=this.getNext(t);return e.hasChanged=!0,this.clearParentChange(),e}}clearParentChange(){let t=this;for(;t.parent!=null;)t.parent.change=null,t=t.parent}connect(){let t=new Array;t.push(this);let e=this,r=this,i=this;for(;e.parent!=null;){e=e.parent;let n=r.point.sub(e.point);ne.eq(this.direct.cross(n),0)||(t.push(i),r=i),i=e}return i!=r&&t.push(i),t.reverse()}},jne=class{constructor(t,e,r){this.nodes=t,this.gap=e,this.limit=r}getCenter(){let t=this.nodes.length,e=Math.floor(t/2),r;return t%2===0?r=this.nodes[e-1].point.add(this.nodes[e].point).mul(.5):r=this.nodes[e].point,r}getResultNodes(){let t=new Array;for(let e of this.nodes)t.push(e.connect());return t}reverseDirect(){for(let t of this.nodes)t.direct=t.direct.mul(-1)}},cb=Math.sqrt(2),XSe=class{constructor(){this.referNode=null;this.gap=0}init(){this.referNode=null,this.gap=0}update(t,e){this.referNode=t,this.gap=e}addGap(t){this.gap+=t}},qSe=class{constructor(){this.referNode=null;this.referStartPoint=null;this.referEndPoint=null;this.gap=0}init(){this.referNode=null,this.gap=0,this.referStartPoint=null,this.referEndPoint=null}update(t,e){this.referNode=t,this.gap=e,this.referStartPoint=this.referStartPoint||this.referNode.start.point,this.referEndPoint=this.referEndPoint||this.referNode.end.point}addGap(t){this.gap+=t}},Xne=class{fanout_v2(t){this.fanoutDiffpair(t),this.align(t),this.fanout90(t)}fanoutDiffpair(t){let e=t.nodes.length,r=t.limit;for(let i=0;i<e;i++){let n=i+1;if(n<e){let s=t.nodes[i],a=t.nodes[n];if(!s.fanout||!a.fanout)continue;let l=te.getInstance().getNet(s.net);if(l!=null&&l.netDifferential!=null&&l.netDifferential.hasNet(a.net)){let h=a.point.sub(s.point).cross(s.direct),d=(Math.abs(h)-s.next.width-s.width/2-a.width/2)/2;if(ne.eq(d,.006)){i++;continue}let p,m,g=s.direct;h>0?(p=new S(-g.y,g.x),m=new S(g.y,-g.x)):(p=new S(g.y,-g.x),m=new S(-g.y,g.x));let[y,b]=this.getDiffpairProject(s.point,a.point,d,g,r),P=this.calculateNodeEnd(s,p,d,r,y),T=this.calculateNodeEnd(a,m,d,r,b);t.nodes[i]=P,t.nodes[n]=T,i++}}}}getDiffpairProject(t,e,r,i,n){let s=this.getDiffpairStyle(r,n),a=e.sub(t).dot(i),l=Math.abs(a);if(a>0)switch(s){case 0:{let c=cb*n/2;return[Math.min(l+c,r),c]}default:return[r,r]}else switch(s){case 0:{let c=cb*n/2;return[c,Math.min(l+c,r)]}default:return[r,r]}}getDiffpairStyle(t,e){return t>=e*(1+cb/2)?0:t>e*(cb/2)?1:t>=0?2:3}align(t){let e=null,r=Number.MIN_SAFE_INTEGER;for(let i of t.nodes){if(!i.fanout)continue;let n=i.point.dot(i.direct);n>=r&&(r=n,e=i)}for(let i=0,n=t.nodes.length;i<n;i++){let s=t.nodes[i];if(!s.fanout)continue;let l=e.point.sub(s.point).dot(s.direct);ne.greater(l,0)&&(t.nodes[i]=s.getSameDirect(l))}}fanout90(t){this.calculateFanoutParam(t),this.calculateFanoutRefer(t);for(let e=0;e<t.nodes.length;e++){let r=t.nodes[e];r.fanout&&(t.nodes[e]=r.getChangeNode())}this.align(t)}calculateFanoutParam(t){var n,s;let e=t.getCenter(),r=t.nodes.length,i=Math.floor(r/2);if(r%2==0){let a=t.nodes[i-1].next.width/2,l=a,c=t.nodes[i-1],h=c.point.sub(e).normalize(),u=c.direct,p=u.cross(h)>0?new S(u.y,-u.x):new S(-u.y,u.x),m=p.mul(-1);for(let g=i-1;g>=0;g--){let y=t.nodes[g];a=this.calculateSingleParam(y,a,e,p,y.previous)}for(let g=i;g<r;g++){let y=t.nodes[g];l=this.calculateSingleParam(y,l,e,m,y.next)}}else{let a=t.nodes[i],l=a.width/2+((n=a.previous)==null?void 0:n.width)||0,c=a.width/2+((s=a.next)==null?void 0:s.width)||0,h=t.nodes[i-1],u=h.point.sub(e).normalize(),d=h.direct,m=d.cross(u)>0?new S(d.y,-d.x):new S(-d.y,d.x),g=m.mul(-1);for(let y=i-1;y>=0;y--){let b=t.nodes[y];l=this.calculateSingleParam(b,l,e,m,b.previous)}for(let y=i+1;y<r;y++){let b=t.nodes[y];c=this.calculateSingleParam(b,c,e,g,b.next)}}}calculateSingleParam(t,e,r,i,n){if(e+=t.width/2,t.fanout){let a=Math.abs(t.point.sub(r).cross(t.direct))-e;ne.greater(a,0)&&(t.change=new BT(i,a),t.change.style=1)}return n!=null&&(e+=t.width/2+n.width),e}calculateFanoutRefer(t){var n,s,a,l,c,h,u,d;let e=t.nodes.length,r=Math.floor(e/2),i=new XSe;if(e%2==0){for(let p=r-1;p>=0;p--){let m=t.nodes[p];if(m.change!=null&&m.change.delta>0&&m.fanout){let g=((n=m.previous)==null?void 0:n.width)||0,y=this.fanoutIncrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}i.init();for(let p=0;p<r;p++){let m=t.nodes[p];if(m.change!=null&&m.change.delta<0&&m.fanout){let g=((s=m.next)==null?void 0:s.width)||0,y=this.fanoutDecrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}i.init();for(let p=r;p<e;p++){let m=t.nodes[p];if(m.change!=null&&m.change.delta>0&&m.fanout){let g=((a=m.next)==null?void 0:a.width)||0,y=this.fanoutIncrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}i.init();for(let p=e-1;p>=r;p--){let m=t.nodes[p];if(m.change!=null&&m.change.delta<0&&m.fanout){let g=((l=m.previous)==null?void 0:l.width)||0,y=this.fanoutDecrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}}else{for(let p=r-1;p>=0;p--){let m=t.nodes[p];if(m.change!=null&&m.change.delta>0&&m.fanout){let g=((c=m.previous)==null?void 0:c.width)||0,y=this.fanoutIncrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}i.init();for(let p=0;p<r;p++){let m=t.nodes[p];if(m.change!=null&&m.change.delta<0&&m.fanout){let g=((h=m.next)==null?void 0:h.width)||0,y=this.fanoutDecrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}i.init();for(let p=r+1;p<e;p++){let m=t.nodes[p];if(m.change!=null&&m.change.delta>0&&m.fanout){let g=((u=m.next)==null?void 0:u.width)||0,y=this.fanoutIncrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}i.init();for(let p=e-1;p>r;p--){let m=t.nodes[p];if(m.change!=null&&m.change.delta<0&&m.fanout){let g=((d=m.previous)==null?void 0:d.width)||0,y=this.fanoutDecrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}}}fanoutIncrease(t,e,r){if(t.referNode==null)return t.update(r,r.width/2+e),null;{t.addGap(r.width/2);let i=r.point.distance1(t.referNode.point);if(i>=cb*t.gap)return t.update(r,r.width/2+e),null;{let n=cb*t.gap-i;return t.addGap(r.width/2+e),r.getSameDirect(n)}}}fanoutDecrease(t,e,r){if(t.referNode==null)return t.update(r,r.width/2+e),r.getSameDirect(-r.change.delta);{t.addGap(r.width/2);let i=r.point.distance1(t.referNode.point);if(i>=cb*t.gap)return t.update(r,r.width/2+e),r.getSameDirect(-r.change.delta);{let n=cb*t.gap-i;return t.addGap(r.width/2+e),r.getSameDirect(n-r.change.delta)}}}calculateNodeEnd(t,e,r,i,n){let s=new BT(e,r);switch(s.style=this.getDiffpairStyle(r,i),s.style){case 0:{let a=r-n;if(a>1e-8){let c=t.point.add(e.mul(a));t=t.getNext(c)}t.change=s;let l=t.point.add(e.mul(n));return t=t.getNext(l),t=t.getSameDirect(n+i),t.change=null,t}case 1:{t.change=s;let a=t.point.add(e.mul(r));return t=t.getNext(a),t=t.getSameDirect(r+i),t.change=null,t}case 2:{t=t.getSameDirect(i),t.change=s;let a=t.point.add(e.mul(r));return t=t.getNext(a),t=t.getSameDirect(r+i),t.change=null,t}case 3:{t.change=s,t=t.getSameDirect(r);let a=t.point.add(e.mul(r));return t=t.getNext(a),t=t.getSameDirect(i),t.change=null,t}}}main(){}},V6=class V6{constructor(t,e=!1){this.ignoreEndLimit=!1;this.checkstart=!0;this.fanOutMode=Ss.getInstance().fanOutMode,this.changeFanOutMode=Ss.getInstance().changeFanOutMode,this.position=t,this.ignoreEndLimit=e,V6.changeFanOut=!1,this.fanoutCenter=Es.getInstance().fanoutCenter}fanout_v3(t,e=!0){e&&this.outShape(t),this.fanoutDiffpair(t),this.align(t),(this.checkstart||!t.canEndWire)&&this.fanout90(t)}fanout_v4(t,e,r){this.outShape(t),this.align(t),this.fanout90_v1(t,e,r)}fixFanoutTrackWidth(t,e){let r=!1;for(let i of t.tracks)if(i.drawing==0){let n=i.start;for(;n.parent;){if(n.change){r=!0;break}n=n.parent}if(r)break}for(let i=0;i<t.tracks.length;i++){let n=t.tracks[i],s=e.tracks[i].start.model;if(n.drawing==0){if(!r||n.width<=n.preWidth||s&&["Pad","Via"].includes(s.modelType))continue;let a=n.start;for(;a.parent;)a.width=n.preWidth,a=a.parent}}}getOutShapeLength(t){let e=0,r=t.tracks.length,i=t.limit;for(let n=0;n<r;n++){let s=t.tracks[n],a=this.checkstart?s.start:s.end;if(a.fix||!s.fanout)continue;if(this.isDiffpair(t.tracks,n)){n++;continue}let l=a.model;if(l!=null&&(l.modelType=="Pad"||l.modelType=="Via")){let c=l.bbox,h=Math.max(c.width(),c.height())/2+i;e=Math.max(e,h)}}return e}outShape(t){let e=t.tracks.length,r=t.limit;for(let i=0;i<e;i++){let n=t.tracks[i],s=this.checkstart?n.start:n.end;if(s.fix||!n.fanout)continue;if(this.isDiffpair(t.tracks,i)){i++;continue}let a=s.model;if(a!=null&&(a.modelType=="Pad"||a.modelType=="Via")){let l=a.bbox,c=Math.max(l.width(),l.height())/2+r;this.checkstart?n.start=s.getSameDirect(c):n.end=s.getSameDirect(c)}}}isDiffpair(t,e){let r=t.length,i=e+1;if(i<r){let n=t[e],s=t[i],a=te.getInstance().getNet(n.net);if(a!=null&&a.netDifferential!=null&&a.netDifferential.hasNet(s.net)&&s.net!=a.name)return!0}return!1}fanoutDiffpair(t){let e=t.tracks.length,r=t.realTimeLimit,i=new Set;for(let n=0;n<e;n++){let s=n+1;if(s<e){let a=t.tracks[n],l=t.tracks[s],c=this.checkstart?a.start:a.end,h=this.checkstart?l.start:l.end;if(!a.fanout||!l.fanout||c.fix||h.fix)continue;let u=te.getInstance().getNet(a.net);if(u!=null&&u.netDifferential!=null&&u.netDifferential.hasNet(l.net)&&l.net!=u.name){i.add(a),i.add(l);let p=h.point.sub(c.point).cross(c.direct),g=(Math.abs(p)-a.next.width-a.width/2-l.width/2)/2;if(ne.lesseq(g,.006)){n++;continue}this.checkstart&&this.fixDiffpairNearGap(a,l,g);let y,b,P=c.direct;p>0?(y=new S(P.y,-P.x),b=new S(-P.y,P.x)):(y=new S(-P.y,P.x),b=new S(P.y,-P.x));let[T,I]=this.getDiffpairOutShapeLength(a,l,c,h,P),C=this.getDiffpairStyle(c.point,h.point,g,P,r,this.position,T),[E,O]=this.getDiffpairProject(c.point,h.point,g,P,r,C);[1,2].includes(C)&&(E<I||O<I)&&!this.changeFanOutMode&&(C=2);let _=this.calculateNodeEnd(c,y,g,r,E,C,T),R=this.calculateNodeEnd(h,b,g,r,O,C,T);(ne.neq(E,0)||ne.neq(O,0))&&(V6.changeFanOut=!0),this.checkstart?(a.start=_,l.start=R):(a.end=_,l.end=R),n++}}}if(this.checkstart&&V6.changeFanOut){for(let n of t.tracks)if(i.has(n))for(let s of n.start.connect())s.markChangeForDiffpair()}}fixDiffpairNearGap(t,e,r){let i=t.previous,n=e.next;if(r>0&&(i&&i.preWidth===i.width&&(i.width+=Math.abs(r)),n&&n.preWidth===n.width&&(n.width+=Math.abs(r))),r<0){let s=new l3;if(i&&i.preWidth===i.width){let a=i.preWidth-Math.abs(r),l=s.getSafeClearance2(0,0,t.net,i.previous.net,[],t.layerId);a>=l?i.width=a:i.width=l}if(n&&n.preWidth===n.width){let a=n.preWidth-Math.abs(r),l=s.getSafeClearance2(0,0,e.net,n.next.net,[],t.layerId);a>=l?n.width=a:n.width=l}}}getDiffpairProject(t,e,r,i,n,s){let a=e.sub(t).dot(i),l=Math.abs(a);if(a>0)switch(s){case 0:{let c=cb*n/2;return[Math.min(l+c,r),c]}default:return[r,r]}else switch(s){case 0:{let c=cb*n/2;return[c,Math.min(l+c,r)]}default:return[r,r]}}getDiffpairOutShapeLength(t,e,r,i,n){let s=ne.eq(n.x,0)||ne.eq(n.y,0),a=1/0,l=1/0,c=!0;if([r,i].forEach(h=>{let u=h.model;if(u!=null&&(u.modelType=="Pad"||u.modelType=="Via")){let d=u.bbox;if(s){let p=ne.eq(n.x,0);a=p?Math.min(a,d.height()/2):Math.min(a,d.width()/2),l=p?Math.min(a,d.width()/2):Math.min(a,d.height()/2)}else a=Math.min(a,Math.min(d.width(),d.height())/2),l=Math.min(a,Math.min(d.width(),d.height())/2)}else a=0,l=0;u!=null&&u instanceof Je&&u.getPad(u.layerId).type!=="ELLIPSE"&&(c=!1)}),c)l=0;else{let h=Math.max(t.width,e.width);l=l+h/2}return[a,l]}getDiffpairStyle(t,e,r,i,n,s,a){let l=t.add(e).mul(.5),c=Math.abs(i.dot(e.sub(t))),u=(Math.abs(i.dot(s.sub(l)))-c)/2>r?1:0;return r>=a+n*(1+cb/2)?u!==0?this.fanOutMode===1?1:2:0:r>a+n*(cb/2)?this.fanOutMode===1?1:2:r>=0?this.fanOutMode!==1?1:2:3}alignDirect(t){if(!this.checkstart||Ss.getInstance().wireMode!=="Differential pair wiring")return;let e=t.tracks,r=t.limit;for(let i=0;i<e.length-1;i++){let n=e[i],s=e[i+1],a=n.start.model,l=s.start.model;if(!(a&&a instanceof yt)||!(l&&l instanceof yt))return;let c=Ot(a.primitive,n.start.point),h=Ot(l.primitive,s.start.point);if(c.equals1(h))return;let u=new S(c.x,0).normalize(),d=new S(0,c.y).normalize(),p=new S(h.x,0).normalize(),m=new S(0,h.y).normalize(),g=u.add(p),y=d.add(m);if(g.equals1(S.ORIGIN)&&!y.equals1(S.ORIGIN)){let b=n.start.point.add(d.mul(r));if(n.start=n.start.getNext(b),n.start.direct=d,i===e.length-2){let P=s.start.point.add(d.mul(r));s.start=s.start.getNext(P),s.start.direct=d}}else if(!g.equals1(S.ORIGIN)&&y.equals1(S.ORIGIN)){let b=n.start.point.add(u.mul(r));if(n.start=n.start.getNext(b),n.start.direct=u,i===e.length-2){let P=s.start.point.add(d.mul(r));s.start=s.start.getNext(P),s.start.direct=u}}}}align(t){let e=null,r=Number.MIN_SAFE_INTEGER;for(let i of t.tracks){if(!i.fanout)continue;let n=this.checkstart?i.start:i.end;if(n.fix)continue;let s=n.point.dot(n.direct);s>=r&&(r=s,e=n)}for(let i=0,n=t.tracks.length;i<n;i++){let s=t.tracks[i];if(!s.fanout)continue;let a=this.checkstart?s.start:s.end;if(a.fix)continue;let c=e.point.sub(a.point).dot(a.direct);ne.greater(c,0)&&(this.checkstart?s.start=a.getSameDirect(c):s.end=a.getSameDirect(c))}}fanout90(t){this.calculateFanoutParam(t),this.calculateFanoutRefer(t);for(let r=0;r<t.tracks.length;r++){let i=t.tracks[r];if(i.fanout)if(this.checkstart){if(i.start.fix)continue;i.start=i.start.getChangeNode()}else{if(i.end.fix)continue;i.end=i.end.getChangeNode()}}if(!(!this.checkstart&&this.fanoutCenter)){if(this.checkstart&&V6.changeFanOut)for(let r of t.tracks)for(let i of r.start.connect())i.restoreChangeForDiffpair();this.align(t)}}fanout90_v1(t,e,r){this.calculateFanoutParam(t,e);for(let i=0;i<t.tracks.length;i++){let n=t.tracks[i],s=0,a=e.tracks[i].width,l=r.tracks[i].width;if(s=a&&a>s?a:s,s=l&&l>s?l:s,n.fanout)if(this.checkstart){if(n.start.fix)continue;n.start=n.start.getFanoutNode(s)}else{if(n.end.fix)continue;n.end=n.end.getFanoutNode(s)}}this.align(t)}calculateFanoutParam(t,e){var s,a;let r=this.checkstart?t.startCenter:t.endCenter;r=r||(this.checkstart?t.getStartCenter(e):this.fanoutCenter?this.fanoutCenter:t.getEndCenter(e));let i=t.tracks.length,n=Math.floor(i/2);if(i%2==0){let l=t.tracks[n-1],c=t.tracks[n],h=l.next.width+l.width/2+c.width/2,u=h/2-l.width/2,d=h/2-c.width/2,p=this.checkstart?l.start:l.end,m=this.checkstart?c.start:c.end,g=p.point.sub(r).normalize(),y=m.point.sub(r).normalize(),b=p.direct,P=b.cross(g),T=m.direct,I=T.cross(y),C=P>0?new S(b.y,-b.x):new S(-b.y,b.x),E=I>0?new S(T.y,-T.x):new S(-T.y,T.x);for(let O=n-1;O>=0;O--){let _=t.tracks[O];u=this.calculateSingleParam(_,u,r,C,_.previous)}for(let O=n;O<i;O++){let _=t.tracks[O];d=this.calculateSingleParam(_,d,r,E,_.next)}}else{let l=t.tracks[n],c=l.width/2+((s=l.previous)==null?void 0:s.width)||0,h=l.width/2+((a=l.next)==null?void 0:a.width)||0,u=t.tracks[n-1],d=t.tracks[n+1],p=this.checkstart?u.start:u.end,m=this.checkstart?d.start:d.end,g=p.point.sub(r).normalize(),y=m.point.sub(r).normalize(),b=p.direct,P=b.cross(g),T=m.direct,I=T.cross(y),C=P>0?new S(b.y,-b.x):new S(-b.y,b.x),E=I>0?new S(T.y,-T.x):new S(-T.y,T.x);for(let O=n-1;O>=0;O--){let _=t.tracks[O];c=this.calculateSingleParam(_,c,r,C,_.previous)}for(let O=n+1;O<i;O++){let _=t.tracks[O];h=this.calculateSingleParam(_,h,r,E,_.next)}}}calculateSingleParam(t,e,r,i,n){if(e+=t.width/2,t.fanout){let s=this.checkstart?t.start:t.end;if(!s.fix){let l=Math.abs(s.point.sub(r).cross(s.direct))-e;ne.neq(l,0)&&(s.change=new BT(i,l),s.change.style=1)}}return n!=null&&(e+=t.width/2+n.width),e}calculateFanoutRefer(t){var n,s,a,l,c,h,u,d;if(this.checkstart&&t.node.preWidth>t.node.width){let p=t.node.preWidth;for(let g of t.tracks)g.preWidth>p&&(p=g.preWidth);let m=p;m=Math.max(m,t.limit);for(let g of t.tracks){let y=g.start;g.start=y.getSameDirect(m)}}let e=t.tracks.length,r=Math.floor(e/2),i=new qSe;if(e%2==0){for(let p=r-1;p>=0;p--){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta>0&&m.fanout){let y=((n=m.previous)==null?void 0:n.width)||0,b=this.fanoutIncrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}i.init();for(let p=0;p<r;p++){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta<0&&m.fanout){let y=((s=m.next)==null?void 0:s.width)||0,b=this.fanoutDecrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}i.init();for(let p=r;p<e;p++){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta>0&&m.fanout){let y=((a=m.next)==null?void 0:a.width)||0,b=this.fanoutIncrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}i.init();for(let p=e-1;p>=r;p--){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta<0&&m.fanout){let y=((l=m.previous)==null?void 0:l.width)||0,b=this.fanoutDecrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}}else{for(let p=r-1;p>=0;p--){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta>0&&m.fanout){let y=((c=m.previous)==null?void 0:c.width)||0,b=this.fanoutIncrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}i.init();for(let p=0;p<r;p++){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta<0&&m.fanout){let y=((h=m.next)==null?void 0:h.width)||0,b=this.fanoutDecrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}i.init();for(let p=r+1;p<e;p++){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta>0&&m.fanout){let y=((u=m.next)==null?void 0:u.width)||0,b=this.fanoutIncrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}i.init();for(let p=e-1;p>r;p--){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta<0&&m.fanout){let y=((d=m.previous)==null?void 0:d.width)||0,b=this.fanoutDecrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}}}fanoutIncrease(t,e,r){if(t.referNode==null)return t.update(r,r.width/2+e),null;{t.addGap(r.width/2);let i=this.checkstart?r.start:r.end,n=this.checkstart?t.referNode.start:t.referNode.end,s=i.point.distance1(n.point);if(s>=cb*t.gap)return t.update(r,r.width/2+e),null;{let a=cb*t.gap-s;return t.addGap(r.width/2+e),i.fix?null:i.getSameDirect(a)}}}fanoutDecrease(t,e,r){let i=this.checkstart?r.start:r.end;if(t.referNode==null)return t.update(r,r.width/2+e),i.fix?null:i.getSameDirect(-i.change.delta);{t.addGap(r.width/2);let n=this.checkstart?t.referNode.start:t.referNode.end,s=i.point.distance1(n.point),a=this.checkstart?t.referStartPoint:t.referEndPoint,l=i.point.distance1(a),c=zg(Math.PI/8,l);if(s>=cb*t.gap)return t.update(r,r.width/2+e),i.fix?null:i.getSameDirect(c-i.change.delta);{let h=cb*t.gap-s;return t.addGap(r.width/2+e),i.fix?null:(h=Math.max(c,h),i.getSameDirect(h-i.change.delta))}}}calculateNodeEnd(t,e,r,i,n,s,a){let l=new BT(e,r);switch(l.style=s,l.style){case 0:{let c=r-n;if(c>1e-8){let u=t.point.add(e.mul(c));t=t.getNext(u)}t.change=l;let h=t.point.add(e.mul(n));return t=t.getNext(h),t=t.getSameDirect(n+i),t.change=null,t}case 1:{t.change=l;let c=t.point.add(e.mul(r));return t=t.getNext(c),t=t.getSameDirect(r),this.ignoreEndLimit&&!this.checkstart||(t=t.getSameDirect(i)),t.change=null,t}case 2:{t=t.getSameDirect(a+i),t.change=l;let c=t.point.add(e.mul(r));return t=t.getNext(c),t=t.getSameDirect(r),this.ignoreEndLimit&&!this.checkstart||(t=t.getSameDirect(i)),t.change=null,t}case 3:{t=t.getSameDirect(Math.abs(r));let c=t.point.add(e.mul(r));return t.change=l,t=t.getNext(c),t=t.getSameDirect(i),t.change=null,t}}}};V6.changeFanOut=!1;var m3=V6;var $Se=class{constructor(t,e){this.leftClearance=0;this.rightClearance=0;this.leftGap=0;this.rightGap=0;this.checkRight=!0;this.width=t,this.radius=e}get clearance(){return this.checkRight?this.rightClearance:this.leftClearance}get gap(){return this.checkRight?this.rightGap:this.leftGap}};function BGe(o){return{id:"",net:o,layerId:12,shapeType:5}}var G6=class{fanout(t){let e=t.tracks.length,r=t.result.wireVia.get(t.node);if(r==null)return null;{let i=new Array(e),n=null;for(let s=0;s<e;s++){let a=t.tracks[s],l=r.item,c=Math.max(l.radius,l.holeRadius),h=new $Se(a.width,c);if(s+1<e){let d=t.tracks[s+1];h.rightClearance=this.getRuleClearance(a.net,d.net),h.rightGap=a.next.width}let u=te.getInstance().getNet(a.net);u!=null&&u.netDifferential!=null&&(h.netDifferential=u.netDifferential),n!=null&&(h.leftClearance=n.rightClearance,h.leftGap=n.rightGap),n=h,i[s]=h}return this.getResult(i,t)}}getResult(t,e){let r=t.length,i=Math.floor(r/2),n=new Array(r).fill(0),s=0,a=0,l=0;function c(h,u){s=h.radius,a+=h.gap+h.width/2,l+=h.clearance+s,a>l&&(l=a),n[u]=l-a,a+=h.width/2,l+=s}if(r%2==0){let h=t[i-1];h.checkRight=!0,s=h.radius,a=h.gap/2+h.width/2,l=h.clearance/2+s,a>l&&(l=a),n[i-1]=l-a,a+=h.width/2,l+=s;for(let u=i-2;u>=0;u--)h=t[u],h.checkRight=!0,c(h,u);h=t[i],h.checkRight=!1,s=h.radius,a=h.gap/2+h.width/2,l=h.clearance/2+s,a>l&&(l=a),n[i]=l-a,a+=h.width/2,l+=s;for(let u=i+1;u<r;u++)h=t[u],h.checkRight=!1,c(h,u);return this.fixEvenDiffPairResult(t,n,e)}else{let h=t[i];s=0,a=h.width/2,l=h.radius;for(let u=i-1;u>=0;u--)h=t[u],h.checkRight=!0,c(h,u);h=t[i],s=0,a=h.width/2,l=h.radius;for(let u=i+1;u<r;u++)h=t[u],h.checkRight=!1,c(h,u);return this.fixOddDiffPairResult(t,n)}}adjustDiffPairs(t,e){var r;for(let i=0;i<e.length-1;i++)if(t[i].netDifferential&&t[i].netDifferential===((r=t[i+1])==null?void 0:r.netDifferential)){let n=e[i],s=e[i+1],a=Math.abs(n)<1e-6,l=Math.abs(s)<1e-6;if(!(a&&!l||!a&&l))continue;let h=(n-s)/2,u=h,d=-h,p=e[i],m=e[i+1],g=[...e];g[i]=u,g[i+1]=d;let y=!1;if(i>0){let b=t[i].leftGap-t[i].radius-Math.abs(g[i-1]-g[i]),P=t[i].clearance;b<P&&(y=!0)}if(!y&&i<t.length-2){let b=t[i+1].rightGap-(t[i+1].radius+t[i+2].radius)-Math.abs(g[i+1]-g[i+2]),P=t[i+1].clearance;b<P&&(y=!1)}y&&(g[i]=p,g[i+1]=m),e[i]=g[i],e[i+1]=g[i+1]}}fixEvenDiffPairResult(t,e,r){var s,a,l,c;let i=t.length,n=Math.floor(i/2);return(n>=2&&(!t[n].netDifferential||t[n].netDifferential!==((s=t[n-1])==null?void 0:s.netDifferential))&&t[n-1].netDifferential===((a=t[n-2])==null?void 0:a.netDifferential)||t[n].netDifferential&&t[n].netDifferential===((l=t[n+1])==null?void 0:l.netDifferential)&&(!t[n-1].netDifferential||t[n].netDifferential!==((c=t[n-1])==null?void 0:c.netDifferential)))&&(Es.getInstance().fanoutCenter=r.tracks[n-1].end.point.add(r.tracks[n].end.point).mul(.5)),this.adjustDiffPairs(t,e),e}fixOddDiffPairResult(t,e){var n;let r=t.length,i=Math.floor(r/2);if(t[i].netDifferential&&t[i].netDifferential===((n=t[i+1])==null?void 0:n.netDifferential)){let s=(e[i]+e[i+1])/2;e[i]=-Math.abs(s),e[i+1]=s;for(let a=i-1;a>=0;a--)e[a]+=s;for(let a=i+2;a<r;a++)e[a]-=s}else if(i>0&&t[i-1].netDifferential&&t[i-1].netDifferential===t[i].netDifferential){let s=(e[i]+e[i-1])/2;e[i]=Math.abs(s),e[i-1]=s;for(let a=i-2;a>=0;a--)e[a]-=s;for(let a=i+1;a<r;a++)e[a]+=s}return this.adjustDiffPairs(t,e),e}getSafeRuleByCustom(t,e,r){let i=[];for(let l of r){let c=te.getInstance().getRule4Order(t,e,l,0);i=i.concat(c)}let n=te.getInstance().getAllOtherSpacing();for(let l of n)i=i.concat(l);if(i.length===0)return te.getInstance().getDefaultSafeSpacing();let s=i.map(l=>({rule:l,maxClearance:this.getRuleMaxClearance(l)}));return s.reduce((l,c)=>c.maxClearance>l.maxClearance?c:l,s[0]).rule||te.getInstance().getDefaultSafeSpacing()}getRuleMaxClearance(t){if(t instanceof HI){let e=[t.getItemMaxClearance(5,[5]),t.getItemMaxClearance(5,[12])];return Math.max(...e)}else if(t instanceof Wb)return t.holeClearance}getRuleClearance(t,e){let r=BGe(t),i=BGe(e),n=["BetweenNetRule","NetRule"],s=this.getSafeRuleByCustom(r,i,n);return s?this.getRuleMaxClearance(s):0}};var ri=class{constructor(){this.trackManager=Zl.getInstance();this.nodeManager=xt.getInstance();this.viewManager=_r.getInstance()}createList(){return this.nodeManager.createList()}drawWireTrack(t,e,r,i){let n=t[0],s=t[0],a=t.length;for(let l=1;l<a;l++)if(s=t[l],n.distance2(s)>1e-8){let c=this.createTrack(e.layerId,n,s,e.width,e.net,r);this.addList(c,i,r),n=s}}drawCornerNodeTrack(t,e,r,i){var l;let n=t[0],s=t[0],a=t.length;for(let c=1;c<a;c++)if(s=t[c],n.point.distance2(s.point)>1e-8){let h=(l=s.width)!=null?l:e.width,u=this.createTrack(e.layerId,n.point,s.point,h,e.net,r),d=this.addList(u,i,r);n.change==s.change&&(d.fanoutInfo=n.change),n=s}}drawCornerTrack(t,e,r,i){let n=t[0],s=t[0],a=t.length;for(let l=1;l<a;l++)if(s=t[l],n.distance2(s)>1e-8){let c=this.createTrack(e.layerId,n,s,e.width,e.net,r);this.addList(c,i,r),n=s}}drawInfoTrack(t,e,r,i,n){let s=t[0],a=t[0],l=t.length;n||(n=e.width);for(let c=1;c<l;c++)if(a=t[c],s.distance2(a)>1e-8){let h=this.createTrack(e.layerId,s,a,n,e.net,r);this.addList(h,i,r),s=a}}drawInfoArcTrack(t,e,r,i,n){n||(n=e.width);for(let s=0;s<t.length;s++){let a=t[s],l=this.createArcTrack(e.layerId,a.center,a.rx,Ht.toRadians(a.startAngle),Ht.toRadians(a.endAngle()),a.sweep(),n,e.net,r);this.addList(l,i,r)}}drawFanoutTrack(t,e,r,i){let n=t[0],s=t[0],a=t.length;for(let l=1;l<a;l++)if(s=t[l],n.point.distance2(s.point)>1e-8){let c=this.createTrack(e.layerId,n.point,s.point,e.width,e.net,r.command),h=this.addList(c,i,r.command);n.change==s.change&&(h.fanoutInfo=n.change),n=s}}drawFanoutTrackFirst(t,e,r,i){let n=t.length,s=t[n-1],a=t[n-1],l=new Array;for(let c=n-2;c>=0;c--)if(s=t[c],s.point.distance2(a.point)>1e-8){let h=this.createTrack(e.layerId,s.point,a.point,e.width,e.net,r.command),u=this.addFirst(h,i,r.command);l.unshift(u),s.change==a.change&&(u.fanoutInfo=s.change),a=s}return l}drawViaFanout(t){let r=new G6().fanout(t);if(r==null)return;let i=Math.floor(t.tracks.length/2);for(let n=0;n<t.tracks.length;n++){let s=t.tracks[n],a=t.result.wireMap.get(s),l=a.getAllItems(),c=l[l.length-1].end;if(n<i){let h=new S(-s.end.direct.y,s.end.direct.x),u=c.add(h.mul(r[n])),d=this.createTrack(s.layerId,c,u,s.width,s.net,t.result.command),p=this.addList(d,a,t.result.command);p.fanoutInfo=new BT(h,-r[n])}else{let h=new S(s.end.direct.y,-s.end.direct.x),u=c.add(h.mul(r[n])),d=this.createTrack(s.layerId,c,u,s.width,s.net,t.result.command),p=this.addList(d,a,t.result.command);p.fanoutInfo=new BT(h,-r[n])}}}createTrack4Pt(t,e,r){if(t instanceof M)return this.createTrack(e.layerId,t.start(),t.end(),e.width,e.showNet,r);if(t instanceof q)return this.createArcTrackByArc(e.layerId,t,e.width,e.showNet,r);throw new Error("not support")}createTrack(t,e,r,i,n,s,a=void 0){let l=this.trackManager.addTrack(`TRACK${Vf.getInstance().getID()}`,t,e,r,i,!1,n);return this.viewManager.current.setTrackVisible(l.globalIndex),l.partition=x.getInstance().partitionId,l.setGroupID(a),s.addCommand(new a_(l,"add")),l}createArcTrackByArc(t,e,r,i,n,s=null){return this.createArcTrack(t,e.center,e.rx,Ht.toRadians(e.startAngle),Ht.toRadians(e.endAngle()),e.sweep(),r,i,n,void 0,s)}createArcTrack(t,e,r,i,n,s,a,l,c,h,u=void 0){let d=this.trackManager.addArcTrack(`TRACK${Vf.getInstance().getID()}`,t,e,r,i,n,s,a,!1,l,h);return d.setGroupID(u),d.partition=x.getInstance().partitionId,this.viewManager.current.setTrackVisible(d.globalIndex),c.addCommand(new a_(d,"add")),d}addList(t,e,r){let i=this.nodeManager.createNode(t,e);return r.addCommand(new aD(t,e,i)),i}addFirst(t,e,r){let i=this.nodeManager.createFirstNode(t,e);return r.addCommand(new aD(t,e,i)),i}};var U6=class o{constructor(t=!1){this._notChange=!0;this._isSource=!0;this._pushDirect=null;this._lastPushDirect=null;this.isReversePush=!1;this.checkDRC=!1;this.collideOrder=-1;this.isVertex=!1;this.isInput=t}setPushDirect(t,e){this._lastPushDirect==null&&(this._lastPushDirect=t),this._lastPushDirect!=null&&e!=null&&(this.isReversePush=this._lastPushDirect!=e),this._pushDirect=e}get isInputFirstPushed(){return this.isInput&&this._lastPushDirect==null&&this._lastPushDirect!=this._pushDirect}sycnPushDirect(t){this.setPushDirect(t._lastPushDirect,t._pushDirect)}get pushDirect(){return this._pushDirect}get notChange(){return this._notChange}set notChange(t){this._notChange!=t&&(this.checkDRC=!1),this._notChange=t}get isSource(){return this._isSource}set isSource(t){this._isSource!=t&&(this.checkDRC=!1),this._isSource=t}clearPushDirect(){this._lastPushDirect=null,this._pushDirect=null}change(){this._notChange=!1,this._isSource=!1,this.checkDRC=!1}clone(){let t=new o;return t.isInput=this.isInput,t._isSource=this._isSource,t._notChange=this._notChange,t._pushDirect=this.pushDirect,t.isReversePush=this.isReversePush,t._lastPushDirect=this._lastPushDirect,t.collideOrder=this.collideOrder,t.checkDRC=this.checkDRC,t.isVertex=this.isVertex,t}mergeStatus(t){this._notChange=this._notChange||t._notChange,this._isSource=this._isSource||t._isSource,this.setPushDirect(this._lastPushDirect||t._lastPushDirect,this._pushDirect||t._pushDirect),this.isVertex=this.isVertex||t.isVertex}};var H6=class H6{constructor(){this.map=new Map;this._status=null}static getInstance(){return H6.manager==null&&(H6.manager=new H6),H6.manager}getStatus(t){return this._status=this.map.get(t),this._status==null&&(this._status=new U6,this.map.set(t,this._status)),this._status}setOrder(t,e){this._status=this.getStatus(t),this._status.collideOrder=e}addInputStatus(t){return this._status=this.map.get(t),this._status==null&&(this._status=new U6(!0),this.map.set(t,this._status)),this._status}setStatus(t,e){this.map.set(t,e)}clear(){this.map.clear()}};H6.manager=null;var Fr=H6;var Ts="45";var iX=null;function nX(o){switch(o){case"WIRING_CORNER_LINE45":{Ts="45";break}case"WIRING_CORNER_LINE90":{Ts="90";break}case"WIRING_CORNER_ARC45":case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC":{Ts="freeArc";break}case"WIRING_CORNER_FREEANGLE":{Ts="free";break}}}function FGe(o){switch(o){case"line45":{Ts="45";break}case"line90":{Ts="90";break}case"arc90":{Ts="freeArc";break}default:{Ts="45";break}}}function jg(o){iX!=null&&Xg(),iX=Ts,Ts=o}function Xg(){iX!=null&&(Ts=iX,iX=null)}var qne=class{constructor(t,e){this.outline=e,this.hash=t}checkCollide(t,e=Ts,r=!1){return this.outline.isCollide(t,e)}collide(t,e=Ts){return this.outline.collide(t,e)}};function Ol(o){let t=new Array,e=new M(o.LL(),o.LR()),r=new M(o.LR(),o.UR()),i=new M(o.UR(),o.UL()),n=new M(o.UL(),o.LL());return t.push(e),t.push(r),t.push(i),t.push(n),fe.build2(t)}var $ne=class{constructor(){this.direct=null;this.point=null;this.dir0=null;this.dir1=null;this.dir2=null;this.mid=null;this.pro0=0;this.pro1=0;this.pro2=0}lineCollide(t,e){if(Math.abs(t.direct.cross(e.direct))<1e-4&&CO.area(t.start(),t.end(),e.start())<1e-4)return this.direct=t.direct,this.point=t.start(),this.dir0=t.end().sub(this.point),this.dir1=e.start().sub(this.point),this.dir2=e.end().sub(this.point),this.pro0=this.dir0.dot(this.direct),this.pro1=this.dir1.dot(this.direct),this.pro2=this.dir2.dot(this.direct),this.pro0>0?this.pro1>this.pro2?this.isSeparated(0,this.pro0,this.pro2,this.pro1):this.isSeparated(0,this.pro0,this.pro1,this.pro2):this.pro1>this.pro2?this.isSeparated(this.pro0,0,this.pro2,this.pro1):this.isSeparated(this.pro0,0,this.pro1,this.pro2);{this.mid=t.start().add(t.end()).mul(.5),this.direct=new S(-t.direct.y,t.direct.x),this.dir1=e.start().sub(this.mid),this.dir2=e.end().sub(this.mid),this.pro1=this.dir1.dot(this.direct),this.pro2=this.dir2.dot(this.direct);let r=Math.min(Math.abs(this.pro1),Math.abs(this.pro2));return this.pro1*this.pro2>0?{isSeparated:!0,min:r}:{isSeparated:!1,min:r}}}isSeparated(t,e,r,i){return r>e?{isSeparated:!0,min:r-e}:i<t?{isSeparated:!0,min:t-i}:{isSeparated:!1,min:0}}};var cP=class{constructor(t,e){this.inters=new Array;this.symbols=new Array;this.pts=new Array;this.hasSort=!1;this.source=t,this.shape=e}addPoint(t,e){this.inters.push(t),this.pts.push(e)}addInnerPoint(t){this.inters.push(t),this.pts.push(null)}sort(){this.hasSort||(dn(this.inters,this.source),this.hasSort=!0)}getEnd(){return this.inters.length>0?this.inters[0]:this.source.end()}};var qg=class{constructor(t=-1,e=!1,r=.006){this.ps=null;this.ps1=null;this._outline=null;this._hull=null;this._rect=null;this._free=null;this.subId=t,this.forceUseSource=e,this.kit=new th(r)}get outline(){return null}get hull(){return null}get rect(){return null}get free(){return null}pointInPolyline(t,e){return e instanceof Gt?new rh().inPolygon(t,e.items):new rh().inPolyline(t,e)}inLine(t,e){return!!(this.kit.eq(t.direct.cross(e.sub(t.start())),0)&&t.bbox().extendOfSize(.006).isContains(e))}inArc(t,e){let r=e.sub(t.center);if(this.kit.eq(r.length(),t.rx)&&t.bbox().extendOfSize(1e-4).isContains(e)){r=r.normalize();let i=t.start().sub(t.center).normalize(),n=t.end().sub(t.center).normalize();return Math.abs(t.sweepAngle)<=180?kT(r,i,n):!kT(r,i,n)}return!1}pointInHull(t,e){return e=="45"||e=="90"?this.inHull(t,e):this.inInside(t,this.getOutline(e))}inHull(t,e){let r;switch(e){case"45":{if(this.ps==null){let g=this.hull;this.ps=new Array;for(let y of g.primitives)this.ps.push(y.start())}if(!this.hull.bbox().isContains(t))return!1;r=this.ps;break}case"90":{if(this.ps1==null){let g=this.rect;this.ps1=new Array;for(let y of g.primitives)this.ps1.push(y.start())}if(!this.rect.bbox().isContains(t))return!1;r=this.ps1;break}default:return!1}let i=r[0],n=t.sub(i),s=1,a=r.length-1,l=r[s].sub(i).normalize(),c=r[a].sub(i).normalize(),h=n.normalize();if(this.kit.lesseq(l.cross(h),0)||this.kit.greatereq(c.cross(h),0))return!1;let d=r[0].sub(r[r.length-1]).normalize().cross(t.sub(r[r.length-1]));if(this.kit.lesseq(d,0))return!1;let p=s+a+1>>1,m=0;for(;s<a;){if(m=r[p].sub(i).cross(n),ne.greater(m,0))s=p;else if(ne.less(m,0))a=p;else{if(this.kit.lesseq(r[p+1].sub(r[p]).normalize().cross(t.sub(r[p])),0)||this.kit.lesseq(r[p].sub(r[p-1]).normalize().cross(t.sub(r[p-1])),0))return!1;s=p}if(a>s&&a-s==1)break;p=s+a+1>>1}return!this.kit.lesseq(r[a].sub(r[s]).normalize().cross(t.sub(r[s])),0)}inInside(t,e){return e.bbox().isContains(t)?e instanceof Gt?!Jr.inEdge4Polyline(t,e,.006)&&Jr.inPolygon(t,e.items):!Jr.inEdge4Polyline(t,e,.006)&&Jr.inPolyline(t,e):!1}inPolygon(t,e){return e.bbox().isContains(t)?e instanceof Gt?Jr.inPolygon(t,e.items):Jr.inPolyline(t,e):!1}getPointInOutline(t,e){let r=this.getOutline(e);if(r instanceof fe){if(this.inInside(t,r))return r}else if(this.inInside(t,r)){for(let i of r.items)if(this.inInside(t,i))return i}return null}getOutline(t){switch(t){case"45":return this.hull;case"90":return this.rect;case"free":return this.free||this.outline;case"freeArc":return this.outline;default:return this.outline}}isCollide(t,e){return!1}collide(t,e){return null}sortInters(t,e){let r=t.iterator(),i=new Array;for(;r.hasNext();){let n=r.next();i.push(n)}return dn(i,e)}};var ZSe=new $ne,hP=class extends qg{constructor(t,e,r=!1,i=-1){super(i,r),this.shape=t,this.width=e;let n=t.direct.angle(S.ORIGIN)%Jte;this.useFree=this.shape.length()>20&&!ne.eq(n,0)}get outline(){return this._outline==null&&(this._outline=this.shape.stroke(this.width,kr.ROUND,le.CCW)),this._outline}get hull(){return this.forceUseSource?this.outline:this.useFree?this.free:(this._hull==null&&(this._hull=ll.convexHull(fe.build2([this.shape]),this.width/2)),this._hull)}get rect(){if(this.forceUseSource)return this.outline;let t=this.shape.direct,e=S.X_UNIT_VECTOR;return Math.abs(t.dot(e))<1e-4||Math.abs(t.cross(e))<1e-4?(this._rect==null&&(this._rect=Ol(this.shape.bbox().extendOfSize(this.width/2))),this._rect):this.free}get free(){return this.forceUseSource?this.outline:(this._free==null&&(this._free=ll.getLineHull(this.shape,this.width/2)),this._free)}isCollide(t,e){let r=t.bbox().extendOfSize(this.width/2),i=this.shape.bbox();if(!r.intersection1(i))return!1;if(t instanceof M){let a=ZSe.lineCollide(t,this.shape);if(a.isSeparated){if(this.kit.greatereq(a.min,this.width/2))return!1;{let l=ZSe.lineCollide(this.shape,t);if(l.isSeparated&&this.kit.greatereq(l.min,this.width/2))return!1}}else{let l=ZSe.lineCollide(this.shape,t);if(l.isSeparated){if(this.kit.greatereq(l.min,this.width/2))return!1}else return!0}}if(this.inHull(t.start(),e)||this.inHull(t.end(),e))return!0;let s=new ir(t,this.shape).getDistance();return!(s!=0&&this.kit.greatereq(s,this.width/2))}collide(t,e){let r=new cP(t,this),i=this.getOutline(e),n=t.start();if(e=="45"||e=="90"?this.inHull(n,e):this.inInside(n,i))return r.addInnerPoint(n),r;let a=t.bbox().extendOfSize(.1);for(let l of i.primitives){let c=l.bbox();if(!a.isIntersect(c))continue;let h=Tt(t,l);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);r.addPoint(d,l)}h==0&&(l instanceof M?(this.inLine(l,t.start())&&r.addPoint(t.start(),l),this.inLine(l,t.end())&&r.addPoint(t.end(),l)):l instanceof q&&(this.inArc(l,t.start())&&r.addPoint(t.start(),l),this.inArc(l,t.end())&&r.addPoint(t.end(),l)))}return r}getPointInOutline(t,e){switch(e){case"45":case"90":return this.inHull(t,e)?this.getOutline(e):null;default:{let r=this.getOutline(e);if(r instanceof fe){if(this.inInside(t,r))return r}else if(this.inInside(t,r)){for(let i of r.items)if(this.inInside(t,i))return i}return null}}}};var X1=class extends qg{constructor(t,e,r=!1,i=-1){super(i,r),this.shape=t,this.width=e}get outline(){return this._outline==null&&(this._outline=this.shape.stroke(this.width,kr.ROUND,le.CCW)),this._outline}get hull(){return this.forceUseSource?this.outline:(this._hull==null&&(this._hull=fe.build2(ll.getArcHull(this.shape,this.width/2))),this._hull)}get rect(){return this.forceUseSource?this.outline:(this._rect==null&&(this._rect=fe.build2(ll.getArcRect(this.shape,this.width/2))),this._rect)}isCollide(t,e){let r=t.bbox().extendOfSize(this.width/2),i=this.shape.bbox();if(!r.intersection1(i))return!1;let n=this.getOutline(e);if(this.inInside(t.start(),n)||this.inInside(t.end(),n))return!0;let a=new ir(t,this.shape).getDistance();return!(a!=0&&this.kit.greatereq(a,this.width/2))}collide(t,e){let r=new cP(t,this),i=this.getOutline(e),n=t.start();if(this.inInside(n,i))return r.addInnerPoint(n),r;let a=t.bbox().extendOfSize(.1);for(let l of i.primitives){let c=l.bbox();if(!a.isIntersect(c))continue;let h=Tt(t,l);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);r.addPoint(d,l)}h==0&&(l instanceof M?(this.inLine(l,t.start())&&r.addPoint(t.start(),l),this.inLine(l,t.end())&&r.addPoint(t.end(),l)):l instanceof q&&(this.inArc(l,t.start())&&r.addPoint(t.start(),l),this.inArc(l,t.end())&&r.addPoint(t.end(),l)))}return r}};var hBi=Math.PI/4,cC=class extends qg{constructor(t,e,r=!1,i=-1){super(i),this.shape=t,this.width=e,this.graphics=new Array;let n=q.build2(t.center,0,180,t.rx,t.rx,le.CCW),s=q.build2(t.center,180,360,t.rx,t.rx,le.CCW);this.graphics.push(new X1(n,e,r,i)),this.graphics.push(new X1(s,e,r,i))}get outline(){if(this._outline==null){let t=new Array;for(let e of this.graphics)t.push(e.outline);this._outline=new Gt(t)}return this._outline}get hull(){if(this._hull==null){let t=new Array;for(let e of this.graphics){let r=e.hull;if(r instanceof fe)t.push(r);else for(let i of r.items)t.push(i)}this._hull=new Gt(t)}return this._hull}get rect(){if(this._rect==null){let t=new Array;for(let e of this.graphics){let r=e.rect;if(r instanceof fe)t.push(r);else for(let i of r.items)t.push(i)}this._rect=new Gt(t)}return this._rect}isCollide(t,e){let r=t.bbox().extendOfSize(this.width/2),i=this.shape.bbox();if(!r.intersection1(i))return!1;for(let n of this.graphics)if(n.isCollide(t,e))return!0;return!1}collide(t,e){let r=new Array;for(let i of this.graphics){if(!i.isCollide(t,e))continue;let n=i.collide(t,e);if(n.inters.length>0){n.sort();let s=n.getEnd();r.push({point:s,inter:n})}}return J0(r,t),r.length>0?r[0].inter:null}};var oX=class extends qg{constructor(t,e,r=!1){super(),this.shape=t,this.clearance=e,this.graphics=new Array;let i=0;for(let n of t.primitives)n instanceof M?this.graphics.push(new hP(n,e*2,r,i++)):n instanceof q&&(n.isCircle()?this.graphics.push(new cC(n,e*2,r,i++)):this.graphics.push(new X1(n,e*2,r,i++)))}get outline(){if(this._outline==null)if(this.clearance==0)this._outline=this.shape;else{let t=new Array;for(let e of this.graphics)t.push(e.outline);this._outline=new Gt(t)}return this._outline}get hull(){if(this._hull==null)if(this.clearance==0)this._hull=ll.convexHull(this.shape,this.clearance);else{let t=new Array;for(let e of this.graphics){let r=e.hull;if(r instanceof fe)t.push(r);else for(let i of r.items)t.push(i)}this._hull=new Gt(t)}return this._hull}get rect(){if(this._rect==null)if(this.clearance==0)this._rect=Ol(this.shape.bbox());else{let t=new Array;for(let e of this.graphics){let r=e.rect;if(r instanceof fe)t.push(r);else for(let i of r.items)t.push(i)}this._rect=new Gt(t)}return this._rect}isCollide(t,e){let r=t.bbox().extendOfSize(this.clearance),i=this.shape.bbox();if(!r.intersection1(i))return!1;for(let n of this.graphics)if(n.isCollide(t,e))return!0;return!1}collide(t,e){let r=new Array;for(let i of this.graphics){if(!i.isCollide(t,e))continue;let n=i.collide(t,e);if(n.inters.length>0){n.sort();let s=n.getEnd();r.push({point:s,inter:n})}}return J0(r,t),r.length>0?r[0].inter:null}getPointInOutline(t,e){let r=this.getOutline(e);if(r instanceof fe){if(this.inInside(t,r))return r}else for(let i of r.items)if(this.inInside(t,i))return i;return null}};var vF=class extends qg{constructor(e,r,i=!1){super();this.graphics=new Array;this.shape=e,this.clearance=r;let n=0;for(let s of e.primitives)s instanceof M?this.graphics.push(new hP(s,r*2,i,n++)):s instanceof q&&(s.isCircle()?this.graphics.push(new cC(s,r*2,i,n++)):this.graphics.push(new X1(s,r*2,i,n++)))}get outline(){if(this._outline==null)if(this.clearance==0)this._outline=this.shape;else{let e=new Array;for(let r of this.graphics)e.push(r.outline);this._outline=new Gt(e)}return this._outline}get hull(){if(this._hull==null)if(this.clearance==0)this._hull=ll.convexHull(this.shape,this.clearance);else{let e=new Array;for(let r of this.graphics){let i=r.hull;if(i instanceof fe)e.push(i);else for(let n of i.items)e.push(n)}this._hull=new Gt(e)}return this._hull}get rect(){if(this._rect==null)if(this.clearance==0)this._rect=Ol(this.shape.bbox());else{let e=new Array;for(let r of this.graphics){let i=r.rect;if(i instanceof fe)e.push(i);else for(let n of i.items)e.push(n)}this._rect=new Gt(e)}return this._rect}isCollide(e,r){let i=e.bbox().extendOfSize(this.clearance),n=this.shape.bbox();if(!i.intersection1(n))return!1;if(this.inInside(e.start(),this.shape)||this.inInside(e.end(),this.shape))return!0;for(let s of this.graphics)if(s.isCollide(e,r))return!0;return!1}collide(e,r){let i=e.start();if(this.inPolygon(i,this.shape)){let a=new cP(e,this);return a.addInnerPoint(i),a}let s=new Array;for(let a of this.graphics){if(!a.isCollide(e,r))continue;let l=a.collide(e,r);if(l.inters.length>0){l.sort();let c=l.getEnd();s.push({point:c,inter:l})}}return J0(s,e),s.length>0?s[0].inter:null}getPointInOutline(e,r){if(this.inInside(e,this.shape))return this.shape;for(let i of this.graphics)if(i.getPointInOutline(e,r)!=null)return i.getOutline(r);return null}};var Kne=class extends qg{constructor(e,r){super();this.graphics=new Array;this.shape=e,this.clearance=r,this.graphics=new Array;let i=0;for(let n of e.primitives)n instanceof M?this.graphics.push(new hP(n,r*2,!1,i++)):n instanceof q&&(n.isCircle()?this.graphics.push(new cC(n,r*2,!1,i++)):this.graphics.push(new X1(n,r*2,!1,i++)))}get outline(){if(this._outline==null)if(this.clearance==0)this._outline=this.shape;else{let e=new Array;for(let r of this.graphics)e.push(r.outline);this._outline=new Gt(e)}return this._outline}get hull(){if(this._hull==null){let e=new Array;for(let r of this.graphics){let i=r.hull;if(i instanceof fe)e.push(i);else for(let n of i.items)e.push(n)}this._hull=new Gt(e)}return this._hull}get rect(){if(this._rect==null)if(this.clearance==0)this._rect=Ol(this.shape.bbox());else{let e=new Array;for(let r of this.graphics){let i=r.rect;if(i instanceof fe)e.push(i);else for(let n of i.items)e.push(n)}this._rect=new Gt(e)}return this._rect}isCollide(e,r){let i=e.bbox().extendOfSize(this.clearance),n=this.shape.bbox();if(!i.intersection1(n))return!1;if(this.inInside(e.start(),this.shape)||this.inInside(e.end(),this.shape))return!0;for(let s of this.graphics)if(s.isCollide(e,r))return!0;return!1}collide(e,r){let i=e.start();if(this.inPolygon(i,this.shape)){let a=new cP(e,this);return a.addInnerPoint(i),a}let s=new Array;for(let a of this.graphics){if(!a.isCollide(e,r))continue;let l=a.collide(e,r);if(l.inters.length>0){l.sort();let c=l.getEnd();s.push({point:c,inter:l})}}return J0(s,e),s.length>0?s[0].inter:null}};var g3=class extends qg{constructor(t,e){super(null,!1,e<=2e-4?1e-8:.006),this.shape=t,this.clearance=e}get outline(){if(this._outline==null){let t=!1;if(this.clearance==0)this._outline=this.shape;else{let e=this.shape;this.shape instanceof fe&&this.shape.isClose()&&vh(this.shape)&&(e=e.reverse(),t=!0),this._outline=AT.zoomCorner(e,this.clearance)}(t||this._outline instanceof fe&&this._outline.isClose()&&!vh(this._outline))&&(this._outline=this._outline.reverse())}return this._outline}get hull(){return this._hull==null&&(this._hull=ll.convexHull(this.shape,this.clearance)),this._hull}get rect(){return this._rect==null&&(this._rect=Ol(this.shape.bbox().extendOfSize(this.clearance))),this._rect}isCollide(t,e){let r=t.bbox().extendOfSize(this.clearance),i=this.shape.bbox();if(!r.intersection1(i))return!1;if((e=="45"||e=="90"?this.inHull(t.start(),e):this.inInside(t.start(),this.shape))||(e=="45"||e=="90"?this.inHull(t.end(),e):this.inInside(t.end(),this.shape)))return!0;let a=t.bbox().extendOfSize(this.clearance);for(let l of this.shape.primitives){if(l instanceof M&&l.length()<1e-8)continue;let c=l.bbox();if(a.isIntersect(c)){let h=new ir(t,l).getDistance();if(h==0||this.kit.less(h,this.clearance))return!0}}return!1}collide(t,e){let r=new cP(t,this),i=this.getOutline(e),n=t.start();if(e=="45"||e=="90"?this.inHull(n,e):this.inInside(n,i))return r.addInnerPoint(n),r;let a=t.bbox().extendOfSize(.1);for(let l of i.primitives){let c=l.bbox();if(!a.isIntersect(c))continue;let h=Tt(t,l);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);r.addPoint(d,l)}h==0&&(l instanceof M?(this.inLine(l,t.start())&&r.addPoint(t.start(),l),this.inLine(l,t.end())&&r.addPoint(t.end(),l)):l instanceof q&&(this.inArc(l,t.start())&&r.addPoint(t.start(),l),this.inArc(l,t.end())&&r.addPoint(t.end(),l)))}return r}getPointInOutline(t,e){switch(e){case"45":case"90":return this.inHull(t,e)?this.getOutline(e):null;default:{let r=this.getOutline(e);if(r instanceof fe){if(this.inInside(t,r))return r}else if(this.inInside(t,r)){for(let i of r.items)if(this.inInside(t,i))return i}return null}}}};var W6=class extends qg{constructor(t,e,r=!1,i=!1){super(),this.shape=t,this.clearance=e,this.isPartition=i,this.graphics=new Array;let n=0;for(let s of t.primitives)s instanceof M?this.graphics.push(new hP(s,e*2,r,n++)):s instanceof q&&(s.isCircle()?this.graphics.push(new cC(s,e*2,r,n++)):this.graphics.push(new X1(s,e*2,r,n++)))}get outline(){if(this._outline==null)if(this.clearance==0)this._outline=this.shape;else{let t=new Array;for(let e of this.graphics){let r=e.outline;if(r instanceof Gt)for(let i of r.items)t.push(i);else t.push(r)}this._outline=new Gt(t)}return this._outline}get hull(){if(this._hull==null)if(this.clearance==0)this._hull=ll.convexHull(this.shape,this.clearance);else{let t=new Array;for(let e of this.graphics){let r=e.hull;if(r instanceof fe)t.push(r);else for(let i of r.items)t.push(i)}this._hull=new Gt(t)}return this._hull}get rect(){if(this._rect==null)if(this.clearance==0)this._rect=Ol(this.shape.bbox());else{let t=new Array;for(let e of this.graphics){let r=e.rect;if(r instanceof fe)t.push(r);else for(let i of r.items)t.push(i)}this._rect=new Gt(t)}return this._rect}isCollide(t,e){let r=t.bbox().extendOfSize(this.clearance),i=this.shape.bbox();if(r.isSeparated(i))return!!this.isPartition;let n=Jr.inPolyline(t.start(),this.shape);if(this.checkByIsPartition(n))return!0;let s=Jr.inPolyline(t.end(),this.shape);if(this.checkByIsPartition(s))return!0;for(let a of this.graphics)if(a.isCollide(t,e))return!0;return!1}checkByIsPartition(t){return this.isPartition?!t:t}collide(t,e){let r=new cP(t,this),i=t.start(),n=Jr.inPolyline(t.start(),this.shape);if(this.checkByIsPartition(n))return r.addInnerPoint(i),r;let s=new Array;for(let a of this.graphics){if(!a.isCollide(t,e))continue;let l=a.collide(t,e);if(l.inters.length>0){l.sort();let c=l.getEnd();s.push({point:c,inter:l})}}return J0(s,t),s.length>0?s[0].inter:null}getPointInOutline(t,e){if(this.inInside(t,this.shape))return this.isPartition?null:this.shape;for(let r of this.graphics){let i=r.getPointInOutline(t,e);if(i!=null&&!this.isPartition)return i}return null}};var z6=class z6{constructor(){this.map=new Map;this.change=new Set;this._lastHash=null;this._lastObstacle=null;this.count=0}static getInstance(){return z6.manager==null&&(z6.manager=new z6),z6.manager}clear(){this.map.clear(),this.change.clear(),this._lastHash=null,this._lastObstacle=null,this.count=0}getObstacle(t){return this.change.has(t)&&this.map.delete(this._lastHash),this._lastObstacle=this.map.get(this._lastHash),this._lastObstacle}getModelObstacle(t,e,r){if(this._lastHash=t.globalIndex+"_"+e+"_"+r,this._lastObstacle=this.getObstacle(t.globalIndex),this._lastObstacle==null){let i=this.dispatch(t,e,r);this._lastObstacle=new qne(this._lastHash,i),this.map.set(this._lastObstacle.hash,this._lastObstacle)}return this._lastObstacle}dispatch(t,e,r){switch(t.modelType){case"Line":case"Track":return this.generateLineHull(t,e);case"Arc":case"ArcTrack":return this.generateArcHull(t,e,r);case"Via":case"Pad":return this.generatePadHull(t,e,r);case"Polygon":return this.generatePolygonHull(t,e,r);case"Rect":return this.generateRectHull(t,e,r);case"Circle":return this.generateCircleHull(t,e,r);case"Text":case"Image":return this.generateTextImageHull(t,e,r);default:return null}}generateLineHull(t,e){let r=t.primitive;return new hP(r,t.width+e*2)}generateArcHull(t,e,r){let i=t.primitive;return new X1(i,t.width+e*2)}generatePadHull(t,e,r){if(t.modelType=="Pad"&&t.isPolygon()&&t.buildBBox().area()>50){let n=t.getMathGraphics(r);return new vF(n,e)}let i=t.getMathGraphics(r);return Math.abs(i.area())>50?new W6(i,e,!0):new g3(i,e)}generateRectHull(t,e,r){switch(t.type){case"Fill Region":case"TearDrop":case"Slot Region":case"Prohibited Region":{let s=t.getMathGraphics(r);return new g3(s,e)}case"Partition":{let s=t.getMathGraphics();return x.getInstance().partitionId==t.globalIndex?new W6(s,e,!0,!0):new g3(s,e)}case"Line":case"Board Outline":let i=t.layerId==11?0:t.strokeWidth,n=t.getMathGraphics(r);return new oX(n,i/2+e,t.layerId==11);default:break}}generateCircleHull(t,e,r){switch(t.type){case"Fill Region":case"TearDrop":case"Slot Region":case"Prohibited Region":{let s=t.getMathGraphics(r);return new g3(s,e)}case"Partition":{let s=t.getMathGraphics();return x.getInstance().partitionId==t.globalIndex?new W6(s,e,!0,!0):new g3(s,e)}case"Line":case"Board Outline":let i=t.layerId==11?0:t.strokeWidth,n=q.buildCircle(t.center,t.radius);return new cC(n,i+e*2,t.layerId==11);default:break}}generatePolygonHull(t,e,r){switch(t.type){case"TearDrop":{let s=t.getMathGraphics(r);return new g3(s,e)}case"Fill Region":case"Slot Region":case"Prohibited Region":{let s=t.getMathGraphics(r);return s instanceof fe?new vF(s,e,t.getParent()!=null):new Kne(s,e)}case"Partition":{let s=t.getMathGraphics();return x.getInstance().partitionId==t.globalIndex?new W6(s,e,!0,!0):new vF(s,e)}case"Line":case"Board Outline":let i=t.layerId==11?0:t.strokeWidth,n=t.getMathGraphics(r);return new oX(n,i/2+e,t.layerId==11);default:break}}generateTextImageHull(t,e,r){let i=t.getMathGraphics(r);return new g3(i,e)}};z6.manager=null;var Os=z6;var JSe=class{constructor(t){this.item=t,this.box=t.buildBBox()}bbox(){return this.box}},Y6=class Y6{constructor(){this.tree=null;this.hasConstraint=null}static getInstance(){return Y6.manager==null&&(Y6.manager=new Y6),Y6.manager}init(){this.tree==null&&(this.tree=new nn(10),this.add(rn.getInstance().getAllItem(),this.tree),this.add(zi.getInstance().getAllItem(),this.tree),this.add(Mi.getInstance().getAllItem(),this.tree),this.hasConstraint=this.tree.size()>0)}clear(){var t;(t=this.tree)==null||t.clear(),this.tree=null,this.hasConstraint=null}search4Rtree(t){return Vt.searchByTypes(t,S0).getProfiles()}searchConstraint(t){let e=new Array;if(this.tree==null){let r=this.search4Rtree(t);for(let i of r){let n=i.model;n instanceof lr&&n.type=="Constraint Region"&&e.push(n)}}else{let r=this.tree.search(t);for(let i of r)e.push(i.item)}return e}add(t,e){for(let r of t)r.type=="Constraint Region"&&e.add(new JSe(r))}};Y6.manager=null;var Jl=Y6;var Ep=class{constructor(){this.utils=new o3;this.map=new Map;this.isHole=t=>t instanceof Je&&gr(t.layerId)||t instanceof It;this.utils.clear()}searchConstraintRegion(t){return Jl.getInstance().searchConstraint(t)}getConstraintRegion(t,e){var i;if(Jl.getInstance().hasConstraint==!1)return[];let r=(i=this.map.get(t))==null?void 0:i.filter(n=>!n.isEmpty);if(r==null&&Jl.getInstance().hasConstraint!=!1){e=t.buildBBox(),r=new Array,this.map.set(t,r);let n=this.searchConstraintRegion(e);if(!n)return[];for(let s of n)this.utils.isInConstraint(s,t)&&r.push(s);QI(r)}return r==null?[]:r}getTrackTouchConstraintRegion(t){let e=this.map.get(t);if(e==null&&Jl.getInstance().hasConstraint!=!1){e=new Array,this.map.set(t,e);let r=t.buildBBox(),i=this.searchConstraintRegion(r);for(let n of i)this.utils.isTrackTouchConstraint(n,t)&&e.push(n);QI(e)}return e==null?[]:e}isInConstraint(t,e){return this.utils.isInConstraint(e,t)}isTrackTouchConstraint(t,e){return this.utils.isTrackTouchConstraint(e,t)}filterConstraint4LayerId(t,e){let r=new Array;if(e==null)return t;for(let i of t)(i.layerId==e||i.layerId==12)&&r.push(i);return r}getClearance(t,e,r,i){let n=te.getInstance(),s=t.shapeType==12&&e.shapeType==12;for(let l of r){let c=n.getRegion(l.globalIndex);if(c.safeClearance!=null)return n.getSafeSpacing(c.safeClearance).getClearance(t.shapeType,e.shapeType,i);if(s&&c.otherClearance!=null)return n.getOtherSpacing(c.otherClearance).holeClearance}return s?n.getDefaultOtherSpacing().holeClearance:n.getSafeClearance(t,e,i)}getSafeRuleItems(t,e,r,i,n){let s=this.getClearance(t,e,r,n),a=this.getClearance(t,e,i,n);return Math.max(s,a)}getSafeClearance(t,e,r,i,n){let s=this.getConstraintRegionLayerId(t,e,i),a=this.isDiffPair(t,e),l=t.item!=null?this.filterConstraint4LayerId(this.getConstraintRegion(t.item,n),s):this.filterConstraint4LayerId(this.getConstraintRegion(r),s),c=e.item!=null?this.filterConstraint4LayerId(this.getConstraintRegion(e.item),s):[];return a?this.getDiffPairClearance(t,e,l,c,s):this.getSafeRuleItems(t,e,l,c,s)}isMultiItem(t){return t.shapeType==8||t.shapeType==11||t.shapeType==12}getConstraintRegionLayerId(t,e,r){let i=this.isMultiItem(t),n=this.isMultiItem(e);return!i&&!n?r:i&&n?r==12?null:r:r==12?t.layerId==12&&e.layerId==12?null:t.layerId!=12?t.layerId:e.layerId:r}getDiffClearance(t,e,r,i){let n=te.getInstance();for(let l of r){let c=n.getRegion(l.globalIndex);if(c.diff)return n.getDifferentialPhysics(c.diff).getDifferentialPairSpacingMin(i)}let s=te.getInstance().getDifferentialPhysicsByNet(t.net);return s?s.getDifferentialPairSpacingMin(i):n.getSafeClearance(t,e,i)}getDiffPairClearance(t,e,r,i,n){let s=this.getDiffClearance(t,e,r,n),a=this.getDiffClearance(t,e,i,n);return Math.max(s,a)}isValid4Model(t,e){if(t.modelType=="Via"){let r=_a(t),i=_a(t,!1);return this.isValid(r,e)||this.isValid(i,e)}else{let r=_a(t);return this.isValid(r,e)}}isValid(t,e){let r=te.getInstance(),i=r.getRegion(e.globalIndex),n=!1;if(t.shapeType===0){let s=r.getNet(t.net);if(s!=null&&s.netDifferential!=null&&(n=!0),n){if(i.diff!=null)return!0}else if(i.safeClearance!=null||i.track!=null)return!0}else if(t.shapeType===5){if(i.radius!=null)return!0}else if(t.shapeType===12&&i.otherClearance!=null)return!0;return!1}isDiffPair(t,e){var i;let r=!1;if(t.shapeType===0&&e.shapeType===0){let n=te.getInstance().getNet(t.net);n!=null&&n.netDifferentialName!=null&&((i=n.netDifferential)!=null&&i.hasNet(e.net))&&e.net!=n.name&&(r=!0)}return r}hasDiffPair(t){for(let e of t){let r=te.getInstance().getNet(e);if(r!=null&&r.netDifferentialName!=null){if(!r.netDifferential)continue;if(e==r.netDifferential.positiveNet.name){if(t.has(r.netDifferential.negativeNet.name))return!0}else if(t.has(r.netDifferential.positiveNet.name))return!0}}return!1}getMaxClearance(){return Math.max(te.getInstance().getMaxSafe(),te.getInstance().getItemMaxClearance(12))}getMaxTrackClearance(t){return te.getInstance().getMaxSafeTrack(t)}getTrackSafeClearance(t,e,r,i,n){let s=this.isDiffPair(t,e),a=this.getConstraintRegionLayerId(t,e,n),l=this.filterConstraint4LayerId(this.getConstraintRegion(r),a),c=this.filterConstraint4LayerId(this.getConstraintRegion(i),a);return s?this.getTrackDiffPairClearance(t,e,l,c,a):this.getTrackSafeRuleItems(t,e,l,c,a)}getTrackSafeRuleItems(t,e,r,i,n){let s=this.getClearance(t,e,r,n),a=this.getClearance(t,e,i,n);return Math.max(s,a)}getTrackDiffPairClearance(t,e,r,i,n){let s=this.getDiffClearance(t,e,r,n),a=this.getDiffClearance(t,e,i,n);return Math.max(s,a)}};var _d=class{constructor(t){this.tracks=new Set;this.vias=new Set;this.pads=new Set;this.imageTexts=new Set;this.profiles=new Set;this.checkStart=new Set;this.checkEnd=new Set;for(let e of t)this.addModel(e)}addModel(t){if(t.modelType=="Track"||t.modelType=="ArcTrack"){let e=xt.getInstance().getListNode(t);if(e!=null&&e.ignore)return;if(this.tracks.add(t),e!=null){let r=e.parent;e.prev==null&&r.otherNode.prev!=null&&this.checkStart.add(t),e.next==null&&r.otherNode.next!=null&&this.checkEnd.add(t)}}else if(t.modelType=="Pad")this.pads.add(t);else if(t.modelType=="Via")this.vias.add(t);else if(t.modelType=="Image"||t.modelType=="Text"){let e=$e.getInstance().getLayer(t.layerId);gs(e.type)&&this.imageTexts.add(t)}else if(t.modelType=="Polygon"||t.modelType=="Rect"||t.modelType=="Circle"){let e=t;switch(e.type){case"Board Outline":case"Prohibited Region":case"Constraint Region":case"Partition":case"Slot Region":{this.profiles.add(t);break}case"TearDrop":case"Fill Region":case"Line":{let r=$e.getInstance().getLayer(e.layerId);(gs(r.type)||e.layerId==11)&&this.profiles.add(t);break}}}}replaceVias(t){this.vias=t}replacePads(t){this.pads=t}replaceTracks(t){this.tracks=t}remove(t){for(let e of t)e.modelType=="Track"||e.modelType=="ArcTrack"?(this.tracks.delete(e),this.checkStart.delete(e),this.checkEnd.delete(e)):e.modelType=="Pad"?this.pads.delete(e):e.modelType=="Via"?this.vias.delete(e):e.modelType=="Image"||e.modelType=="Text"?this.imageTexts.delete(e):(e.modelType=="Polygon"||e.modelType=="Rect"||e.modelType=="Circle")&&this.profiles.delete(e)}clear(){this.tracks.clear(),this.vias.clear(),this.pads.clear(),this.imageTexts.clear(),this.profiles.clear()}getAll(){let t=new Set;return Re.addAllSet(t,this.tracks),Re.addAllSet(t,this.vias),Re.addAllSet(t,this.pads),Re.addAllSet(t,this.imageTexts),Re.addAllSet(t,this.profiles),t}getAllItem(){let t=new Array;return Re.addAll(t,this.tracks),Re.addAll(t,this.vias),Re.addAll(t,this.pads),Re.addAll(t,this.imageTexts),Re.addAll(t,this.profiles),t}};var xF=class{constructor(){this.exclusions=new Set}filter(t){return t}};var Zne=class extends xF{constructor(){super(...arguments);this.obstacles=new Set;this.waitShoves=new Set;this.shovedPath=new Set;this.allowPushVia=!1;this.isShove=!1;this.net=null;this.arounds=null;this.layerId=null}isValid(e){return this.layerId!=null&&e.layerId!=this.layerId?!1:!e.locked&&!Ps(e)&&e.getParent()==null?this.obstacles.has(e)||this.exclusions.has(e)?!0:this.waitShoves.has(e)?!1:this.net!=null&&e.net==this.net?!!(this.shovedPath.has(e)&&(this.arounds==null||this.arounds!=null&&this.arounds.has(e))):this.isShove?!!this.shovedPath.has(e):!0:!0}canShove(e){return e.locked||Ps(e)||e.getParent()!=null||this.layerId!=null&&e.layerId!=this.layerId?!1:!this.shovedPath.has(e)}setMode(e){this.isShove=e}setNet(e,r){if(this.net=e,this.arounds=r,this.layerId=null,r!=null&&r.size>0)for(let i of r){this.layerId=i.layerId;break}}setNetAndLayerId(e,r){this.net=e,this.layerId=r}clear(){this.net=null}};var Jne=class extends xF{constructor(){super(...arguments);this.obstacles=new Set;this.waitShoves=new Set;this.shovedPath=new Set;this.isShove=!1;this.net=null}isValid(e){return this.waitShoves.has(e)||this.net!=null&&e.net==this.net?!1:e.locked||Ps(e)||e.getParent()!=null||this.obstacles.has(e)||this.exclusions.has(e)?!0:this.isShove?!!(this.shovedPath.has(e)&&e.net!=this.net):!0}isValidPad(e){return!!(this.obstacles.has(e)||this.exclusions.has(e))}isSameNet(e){return this.net!=null&&e.net==this.net}canShove(e){return e.locked||Ps(e)||e.getParent()!=null?!1:!this.shovedPath.has(e)}setMode(e){this.isShove=e}setNet(e){this.net=e}clear(){this.net=null}};var RF=class{constructor(){this.trackfilter=new Zne;this.viaFilter=new Jne;this.filterMode=0;this.repeatList=new Set}isPushTrack(){return this.filterMode==3}isTrackShove(){return this.trackfilter.isShove}canShoveVia(){return this.viaFilter.isShove}clearExclusion(){this.trackfilter.exclusions.clear(),this.viaFilter.exclusions.clear()}setAroundMode(){this.trackfilter.setMode(!1),this.viaFilter.setMode(!1)}setNet(t,e){this.trackfilter.setNet(t,e),this.viaFilter.setNet(t)}setNetAndLayerId(t,e){this.trackfilter.setNetAndLayerId(t,e)}setFilterMode(t){this.filterMode=t}setSolidFilterMode(t=!0){this.trackfilter.setMode(t),this.viaFilter.setMode(!0)}setSolidViaFilterMode(t=!0){this.trackfilter.setMode(t),this.viaFilter.setMode(!1)}addObstacle(t){t instanceof yt?this.trackfilter.obstacles.add(t):t instanceof It&&this.viaFilter.obstacles.add(t)}hasObstacle(t){return t instanceof yt?this.trackfilter.obstacles.has(t):t instanceof It?this.viaFilter.obstacles.has(t):!1}removeObstacle(t){t instanceof yt?this.trackfilter.obstacles.delete(t):t instanceof It&&this.viaFilter.obstacles.delete(t)}isValidTrack(t){return this.filterMode==2?this.trackfilter.canShove(t):this.filterMode==3?this.trackfilter.isValid(t):this.trackfilter.isValid(t)}isValidVia(t){return this.filterMode==2?this.viaFilter.canShove(t):this.filterMode==3?this.viaFilter.isValid(t):this.trackfilter.layerId!=null&&!t.isContains(this.trackfilter.layerId)?!1:this.viaFilter.isValid(t)}isValidPad(t){return this.filterMode==2?!1:this.filterMode==3?this.viaFilter.isValidPad(t):!this.viaFilter.isSameNet(t)}isValidOther(t){return this.filterMode==2?!1:this.filterMode!=3}isValid(t){return t instanceof yt?this.isValidTrack(t):t instanceof It?this.isValidVia(t):t instanceof Je?this.isValidPad(t):this.isValidOther(t)}addWaitList(t){if(t instanceof bs)this.viaFilter.waitShoves.add(t.item);else{let e=t.iterator();for(;e.hasNext();)this.trackfilter.waitShoves.add(e.next());t.viaNode.prev!=null&&this.viaFilter.waitShoves.add(t.viaNode.prev.item),t.viaNode.next!=null&&this.viaFilter.waitShoves.add(t.viaNode.next.item)}}addWait(t){if(t instanceof bs)this.viaFilter.waitShoves.add(t.item);else{let e=t.iterator();for(;e.hasNext();)this.trackfilter.waitShoves.add(e.next());t.viaNode.prev!=null&&this.viaFilter.waitShoves.add(t.viaNode.prev.item),t.viaNode.next!=null&&this.viaFilter.waitShoves.add(t.viaNode.next.item)}}addList2Filter(t){let e=t.iterator();for(;e.hasNext();){let r=e.next();this.trackfilter.shovedPath.add(r),this.trackfilter.waitShoves.delete(r)}t.viaNode.prev!=null&&(this.viaFilter.shovedPath.add(t.viaNode.prev.item),this.viaFilter.waitShoves.delete(t.viaNode.prev.item)),t.viaNode.next!=null&&(this.viaFilter.shovedPath.add(t.viaNode.next.item),this.viaFilter.waitShoves.delete(t.viaNode.next.item))}addListObstacles(t){t.viaNode.prev!=null&&(this.viaFilter.shovedPath.add(t.viaNode.prev.item),this.viaFilter.waitShoves.delete(t.viaNode.prev.item)),t.viaNode.next!=null&&(this.viaFilter.shovedPath.add(t.viaNode.next.item),this.viaFilter.waitShoves.delete(t.viaNode.next.item)),t.otherNode.prev!=null&&this.viaFilter.obstacles.add(t.otherNode.prev),t.otherNode.next!=null&&this.viaFilter.obstacles.add(t.otherNode.next)}addAroundList(t){if(t instanceof bs){this.viaFilter.shovedPath.add(t.item),this.viaFilter.waitShoves.delete(t.item);return}this.addList2Filter(t);let e=new Set;if(t.otherNode.prev!=null)if(t.otherNode.prev instanceof Je)this.viaFilter.obstacles.add(t.otherNode.prev);else if(t.otherNode.prev instanceof Kn){let r=t.otherNode.prev;r!=null&&!e.has(r)&&(e.add(r),this.addList2Filter(r))}else this.viaFilter.obstacles.add(t.otherNode.prev);if(t.otherNode.next!=null)if(t.otherNode.next instanceof Je)this.viaFilter.obstacles.add(t.otherNode.next);else if(t.otherNode.next instanceof Kn){let r=t.otherNode.next;r!=null&&!e.has(r)&&(e.add(r),this.addList2Filter(r))}else this.viaFilter.obstacles.add(t.otherNode.next)}addAroundTracks(t){if(t!=null){if(t instanceof bs){this.viaFilter.shovedPath.add(t.item),this.viaFilter.waitShoves.delete(t.item);return}for(let e of t)this.trackfilter.shovedPath.add(e),this.trackfilter.waitShoves.delete(e)}}addShoveComplete(t){if(t instanceof bs){this.viaFilter.shovedPath.add(t.item),this.viaFilter.waitShoves.delete(t.item);return}if(this.addList2Filter(t),t.otherNode.prev!=null)if(t.otherNode.prev instanceof Je)this.viaFilter.obstacles.add(t.otherNode.prev);else if(t.otherNode.prev instanceof Kn){let e=t.otherNode.prev;this.addList2Filter(e)}else this.viaFilter.obstacles.add(t.otherNode.prev);if(t.otherNode.next!=null)if(t.otherNode.next instanceof Je)this.viaFilter.obstacles.add(t.otherNode.next);else if(t.otherNode.next instanceof Kn){let e=t.otherNode.next;this.addList2Filter(e)}else this.viaFilter.obstacles.add(t.otherNode.next)}deleteAroundTracks(t){if(t!=null){if(t instanceof bs){this.viaFilter.shovedPath.delete(t.item),this.viaFilter.waitShoves.add(t.item);return}for(let e of t)this.trackfilter.shovedPath.delete(e),this.trackfilter.waitShoves.add(e)}}deleteList4Filter(t){let e=t.iterator();for(;e.hasNext();){let r=e.next();this.trackfilter.shovedPath.delete(r),this.trackfilter.waitShoves.add(r)}t.viaNode.prev!=null&&(this.viaFilter.shovedPath.delete(t.viaNode.prev.item),this.viaFilter.waitShoves.add(t.viaNode.prev.item)),t.viaNode.next!=null&&(this.viaFilter.shovedPath.delete(t.viaNode.next.item),this.viaFilter.waitShoves.add(t.viaNode.next.item)),t.otherNode.prev!=null&&this.viaFilter.obstacles.delete(t.otherNode.prev),t.otherNode.next!=null&&this.viaFilter.obstacles.delete(t.otherNode.next)}deleteAroundList(t){if(t instanceof bs){this.viaFilter.shovedPath.delete(t.item),this.viaFilter.waitShoves.add(t.item);return}this.deleteList4Filter(t)}addRepeatAroundList(t){if(this.repeatList.add(t),t instanceof bs){this.viaFilter.shovedPath.delete(t.item),this.viaFilter.waitShoves.add(t.item);return}this.deleteList4Filter(t)}clearRepeatAroundList(){for(let t of this.repeatList)this.addAroundList(t);this.repeatList.clear()}addObastacleList(t){if(t instanceof bs)this.viaFilter.obstacles.add(t.item);else{this.addList2Obstacles(t);let e=new Set;if(t.otherNode.prev!=null)if(t.otherNode.prev instanceof Je)this.viaFilter.obstacles.add(t.otherNode.prev);else if(t.otherNode.prev instanceof Kn){let r=t.otherNode.prev;r!=null&&!e.has(r)&&(e.add(r),this.addList2Obstacles(r))}else this.viaFilter.obstacles.add(t.otherNode.prev);if(t.otherNode.next!=null)if(t.otherNode.next instanceof Je)this.viaFilter.obstacles.add(t.otherNode.next);else if(t.otherNode.next instanceof Kn){let r=t.otherNode.next;r!=null&&!e.has(r)&&(e.add(r),this.addList2Obstacles(r))}else this.viaFilter.obstacles.add(t.otherNode.next)}}addExclusionShape(t){t instanceof yt?this.viaFilter.exclusions.add(t):this.viaFilter.exclusions.add(t)}addExclusionList(t){if(t instanceof bs)this.viaFilter.exclusions.add(t.item);else{this.addList2Exclusion(t);let e=new Set;if(t.otherNode.prev!=null)if(t.otherNode.prev instanceof Je)this.viaFilter.exclusions.add(t.otherNode.prev);else if(t.otherNode.prev instanceof Kn){let r=t.otherNode.prev;r!=null&&!e.has(r)&&(e.add(r),this.addList2Exclusion(r))}else this.viaFilter.exclusions.add(t.otherNode.prev);if(t.otherNode.next!=null)if(t.otherNode.next instanceof Je)this.viaFilter.exclusions.add(t.otherNode.next);else if(t.otherNode.next instanceof Kn){let r=t.otherNode.next;r!=null&&!e.has(r)&&(e.add(r),this.addList2Exclusion(r))}else this.viaFilter.exclusions.add(t.otherNode.next)}}addList2Obstacles(t){let e=t.iterator();for(;e.hasNext();)this.trackfilter.obstacles.add(e.next());t.viaNode.prev!=null&&this.viaFilter.obstacles.add(t.viaNode.prev.item),t.viaNode.next!=null&&this.viaFilter.obstacles.add(t.viaNode.next.item)}addList2Exclusion(t){let e=t.iterator();for(;e.hasNext();)this.trackfilter.exclusions.add(e.next());t.viaNode.prev!=null&&this.viaFilter.exclusions.add(t.viaNode.prev.item),t.viaNode.next!=null&&this.viaFilter.exclusions.add(t.viaNode.next.item)}clearObstacles(){this.trackfilter.obstacles.clear(),this.viaFilter.obstacles.clear()}};var hC=class{constructor(t){this.cb=t}doAction(t){this.cb(t)}};var QSe=class{constructor(){this.start=0;this.log="";this.map=new Map;this.countMap=new Map}startTime(t){}endTime(){}getSingleMax(){let t="",e=0;for(let[r,i]of this.map)for(let n of i)n>e&&(e=n,t=r);console.log(`${t} this max time:${e}ms`)}getCount(){let t=new Map;for(let[e,r]of this.countMap){let i=this.map.get(e),n=r/i.length;t.set(e,n)}for(let[e,r]of t)console.log(`${e} this same time:${r}ms`)}clear(){this.map.clear(),this.countMap.clear()}},VGe=new QSe,sX=class{constructor(){this.sameNetFilter=null;this.filter=null;this.manager=gc.getInstance();this.aroundFilter=null;this.useShoveTree=!1;this.ignores=new Set;this.hasPartition=null}get pushFilter(){if(this.filter==null)throw new Error("push filter use Error!!!");return this.filter}updateParition(){this.hasPartition=Dn.getInstance().getAllItem().length>0}clearParition(){this.hasPartition=null}itemValid(t){return this.isValid(t.item.model)}need(t,e){return e=="Track"||e=="ArcTrack"?this.filter!=null&&this.filter.trackfilter.layerId!=null?this.filter.trackfilter.layerId==t:!0:e=="Pad"?this.filter!=null&&this.filter.trackfilter.layerId!=null&&t!=12?this.filter.trackfilter.layerId==t:!0:e=="Image"||e=="Text"?this.filter!=null&&this.filter.trackfilter.layerId!=null?this.filter.trackfilter.layerId==t:!0:(e=="Polygon"||e=="Rect"||e=="Circle")&&this.filter!=null&&this.filter.trackfilter.layerId!=null&&t!=11&&t!=12&&t!=1004?this.filter.trackfilter.layerId==t:!0}keepTPV(t,e){return e=="Track"||e=="ArcTrack"?this.filter!=null&&this.filter.trackfilter.layerId!=null?this.filter.trackfilter.layerId==t:!0:e=="Pad"?this.filter!=null&&this.filter.trackfilter.layerId!=null&&t!=12?this.filter.trackfilter.layerId==t:!0:e=="Via"}search4Rtree(t,e=!0,r){r==null&&(r=new _d([]));let n=hi.getInstance().RTREE.conditionSearch(t,this.itemValid.bind(this),this.need.bind(this));return n.setAction(new hC(s=>{r.addModel(s.model)})),n.doAction(["Track","ArcTrack","Pad","Via","Polygon","Rect","Circle","Text","Image"]),hi.partition!=null&&r.addModel(hi.partition),e?r.getAllItem():[]}search4TPV(t,e=!0,r){r==null&&(r=new _d([]));let n=hi.getInstance().RTREE.conditionSearch(t,this.itemValid.bind(this),this.keepTPV.bind(this));return n.setAction(new hC(s=>{r.addModel(s.model)})),n.doAction(["Track","ArcTrack","Pad","Via"]),hi.partition!=null&&r.addModel(hi.partition),e?r.getAllItem():[]}search4RtreePad(t,e=!0,r){r==null&&(r=new _d([]));let s=hi.getInstance().RTREE.searchByType(t,"Pad").pads;if(s!=null)for(let a of s){let l=a.model;this.isValid(l)&&r.addModel(l)}return e?r.getAllItem():[]}search4RtreeVia(t,e=!0,r){r==null&&(r=new _d([]));let s=hi.getInstance().RTREE.searchByType(t,"Via").vias;if(s!=null)for(let a of s){let l=a.model;this.isValid(l)&&r.addModel(l)}return e?r.getAllItem():[]}searhTracks(t,e){return e=="Track"?this.filter!=null&&this.filter.trackfilter.layerId!=null?this.filter.trackfilter.layerId==t:!0:e=="ArcTrack"?this.filter!=null&&this.filter.trackfilter.layerId!=null?this.filter.trackfilter.layerId==t:!0:!1}search4RtreeTrack(t,e=!0,r){r==null&&(r=new _d([]));let s=hi.getInstance().RTREE.search(t,this.searhTracks.bind(this)).getTracks();if(s!=null){let a=s.length;for(let l=0;l<a;l++){let c=s[l].model;this.isValid(c)&&r.addModel(c)}}return e?r.getAllItem():[]}search4RtreeTrackAndVia(t,e=!0,r){let i=this.search4RtreeVia(t,e,r),n=this.search4RtreeTrack(t,e,r);return e?i.concat(n):[]}isValid(t){return this.ignores.has(t)?!1:t instanceof yt?!(t.isEmpty||this.manager.has(t.globalIndex)||this.filter!=null&&!this.filter.isValidTrack(t)):t instanceof Je?!(this.filter!=null&&!this.filter.isValidPad(t)):t instanceof It?!(t.isEmpty||this.manager.has(t.globalIndex)||this.filter!=null&&!this.filter.isValidVia(t)):t instanceof lr?!(this.filter!=null&&!this.filter.isValidOther(t)||t.layerId==1004&&x.getInstance().partitionId==""&&t.component.fileUuid==""):t instanceof Li?!(this.filter!=null&&!this.filter.isValidOther(t)):t instanceof ql?!(this.filter!=null&&!this.filter.isValidOther(t)):!1}searchPadContidition(t,e){return e=="Pad"?this.filter!=null&&this.filter.trackfilter.layerId!=null&&t!=12?this.filter.trackfilter.layerId==t:!0:!1}search4ShoveRtree(t,e=!0,r){r==null&&(r=new _d([]));let i=hi.getInstance().shoveTree.search(t),n=hi.getInstance().RTREE.map.get("Pad");if(n!=null){for(let[a,l]of n)if(this.searchPadContidition(a,"Pad")){let c=l.search(t),h=c.length;for(let u=0;u<h;u++){let d=c[u].item.model;this.isValid(d)&&r.addModel(d)}}}let s=i.length;for(let a=0;a<s;a++){let l=i[a].model;this.isValid(l)&&r.addModel(l)}return e?r.getAllItem():[]}search4WireTree(t,e=!0,r){r==null&&(r=new _d([]));let i=hi.getInstance().rtree.search(t),n=i.length;for(let s=0;s<n;s++){let a=i[s].model;this.isValid(a)&&r.addModel(a)}return e?r.getAllItem():[]}search4All(t,e=!0,r){if(this.useShoveTree)return this.search4ShoveRtree(t,e,r);{let i=this.search4Rtree(t,e,r);return Re.addAll(i,this.search4WireTree(t,e,r)),i}}searchTPV(t,e=!0,r){if(this.useShoveTree)return this.search4ShoveRtree(t,e,r);{let i=this.search4TPV(t,e,r);return Re.addAll(i,this.search4WireTree(t,e,r)),i}}searchVia4All(t,e=!0,r){let i=this.search4RtreeVia(t,e,r);return Re.addAll(i,this.search4WireTree(t,e,r)),i}searchTrack4All(t,e=!0,r){if(this.useShoveTree)return this.search4ShoveRtree(t,e,r);{let i=this.search4RtreeTrack(t,e,r);return Re.addAll(i,this.search4WireTree(t,e,r)),i}}searchTrackAndVia4All(t,e=!0,r){if(this.useShoveTree)return this.search4ShoveRtree(t,e,r);{let i=this.search4RtreeTrackAndVia(t,e,r);return Re.addAll(i,this.search4WireTree(t,e,r)),i}}setPushFilter(){this.filter=new RF}search1(t){let e=new _d([]);if(this.search4All(t,!1,e),this.aroundFilter!=null){let r=this.aroundFilter.filter(e.tracks);e.replaceTracks(r)}return e}searchConnect(t){let e=new _d([]);if(this.searchTPV(t,!1,e),this.aroundFilter!=null){let r=this.aroundFilter.filter(e.tracks);e.replaceTracks(r)}return e}searchInput(t){let e=new _d([]);if(this.search4WireTree(t,!1,e),this.aroundFilter!=null){let r=this.aroundFilter.filter(e.tracks);e.replaceTracks(r)}return e}searchVia(t,e){if(!e)return this.search1(t);let r=new _d([]);if(this.searchVia4All(t,!1,r),this.aroundFilter!=null){let i=this.aroundFilter.filter(r.tracks);r.replaceTracks(i)}return r}searchTrack(t){let e=new _d([]);if(this.searchTrack4All(t,!1,e),this.aroundFilter!=null){let r=this.aroundFilter.filter(e.tracks);e.replaceTracks(r)}return e}searchTrackAndVia(t){let e=new _d([]);if(this.searchTrackAndVia4All(t,!1,e),this.aroundFilter!=null){let r=this.aroundFilter.filter(e.tracks);e.replaceTracks(r)}return e}searchPad(t){let e=this.search4Rtree(t),r=new _d(e);return r.tracks.clear(),r.vias.clear(),r}searchOutline(t){let r=hi.getInstance().RTREE.searchByTypes(t,["Rect","Circle","Polygon"]),i=new Array;if(r!=null)return r.setAction(new hC(n=>{let s=n.model;s instanceof lr&&(s.type=="Board Outline"||s.layerId==11||s.type=="Partition"&&x.getInstance().partitionId==s.globalIndex)&&i.push(s)})),r.doAction(["Rect","Circle","Polygon"]),i}searchPartition(t){let e=new _d([]),i=hi.getInstance().RTREE.searchByTypes(t,["Rect","Circle","Polygon"]);if(i!=null)return i.setAction(new hC(n=>{let s=n.model;s instanceof lr&&s.type=="Partition"&&e.addModel(s)})),i.doAction(["Rect","Circle","Polygon"]),e}},Nt=new sX;var lD=class{constructor(){this.manager=Os.getInstance()}collide(t,e){let r=t.start();if(this.pointInPolyline(r,e))return r;let n=t.bbox(),s=new Ba;s.add(t.end());for(let l of e.primitives){let c=l.bbox();if(!n.isIntersect(c))continue;let h=Tt(t,l);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);s.add(d)}}let a=this.sortInters(s,t);return a.length>0?a[0]:t.end()}checkCollide(t,e){if(t instanceof M&&!t.isPoint()){let i=t.end().sub(t.start()).normalize().angle(S.ORIGIN),n=Qe.rotate(i),s=t.multiply3(n),a=e.multiply3(n),l=s.bbox().extendOfSize(1e-6),c=a.bbox();return l.isIntersect(c)!=null}return!0}collideOutline(t,e,r){let i=new Array,n=t,s=n.bbox();for(let l of e.primitives){if(l instanceof M&&l.length()<1e-8)continue;let c=l.bbox().extendOfSize(r);if(!s.isIntersect(c))continue;let h=l.stroke(r*2,kr.ROUND,le.CCW).closeEndpoint(),u=n.bbox(),d=h.bbox();if(!u.isIntersect(d))continue;let p=this.collide(n,h);i.push(p),n=this.getNewPrimitive(n,p)}let a=dn(i,t);return a.length>0?a[0]:t.end()}sortInters(t,e){let r=t.iterator(),i=new Array;for(;r.hasNext();){let n=r.next();i.push(n)}return dn(i,e)}getNewPrimitive(t,e){return t instanceof M?new M(t.start(),e):q.build2(t.center,t.startAngle,e.angleD(t.center),t.rx,t.ry,t.sweep())}pointInPolyline(t,e){return Jr.inPolyline(t,e)}};var bl=class{constructor(t,e,r,i,n=!1,s,a,l=null){this.info=null;this.block=null;this.source=t,this.point=e,this.obstacle=r,this.clearance=i,this.isSameNet=n,this.layer1=s,this.layer2=a,this.info=l}bbox(){return this.point.bbox()}};var cOt=.001,cD=class{constructor(){this.manager=Os.getInstance();this.kit=new th(cOt)}getEnd(t,e,r){if(!this.checkCollide(t,e,r))return t.end();let i=t.end(),n=new Fs(fe.build2([t]),e,r);switch(n.relation){case 3:return n.distance>r?i:this.getInterEnd(t,e,r);case 0:return this.getInterEnd(t,e,r);case 1:case 2:return t.start()}}checkCollide(t,e,r){if(t instanceof M&&!t.isPoint()){let n=t.end().sub(t.start()).normalize().angle(S.ORIGIN),s=Qe.rotate(n),a=t.multiply3(s),l=e.multiply3(s),c=a.bbox().extendOfSize(1e-6),h=l.bbox().extendOfSize(r);return c.isIntersect(h)!=null}return!0}getInterEnd(t,e,r){let i=t.end();for(let n of e.primitives)n instanceof M?t instanceof M?(i=this.calcuLineLine(t,n,r),t=new M(t.start(),i)):(i=this.calcuLineArc(n,t,!1,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())):n instanceof q&&(t instanceof M?(i=this.calcuLineArc(t,n,!0,r),t=new M(t.start(),i)):(i=this.calcuArcArc(t,n,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())));return i}getNewPrimitive(t,e){return t instanceof M?new M(t.start(),e):q.build2(t.center,t.startAngle,e.angleD(t.center),t.rx,t.ry,t.sweep())}isSameNet(t,e){return t===e}isSameLayer(t,e){return t===e}pointInPolyline(t,e){return e instanceof Gt?new rh().inPolygon(t,e.items):new rh().inPolyline(t,e)}calcuLineLine(t,e,r){let i=t.start(),n=t.end(),s=e.stroke(r*2,kr.ROUND,le.CCW).asClose();if(this.pointInPolyline(i,s))return i;let l=new Set;for(let c of s.primitives){let h=Tt(t,c);if(h>0)for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);l.add(d)}}if(l.size>0){let c=n.distance1(i);l.forEach(h=>{let u=h.distance1(i);u<c&&(n=h,c=u)})}return n}calcuLineArc(t,e,r,i){if(r){let n=t.start(),s=t.end();if(i=i<1e-5?0:i,i==0)return t.start();let a=e.stroke(i*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(n,a))return n;let c=new Set;for(let h of a.primitives){let u=Tt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=s.distance1(n);c.forEach(u=>{let d=u.distance1(n);d<h&&(s=u,h=d)})}return s}else{let n=e.start(),s=e.end(),a=(e.startAngle%360+360)%360,l=t.stroke(i*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(n,l))return n;let h=new Set;for(let u of l.primitives){let d=Tt(e,u);if(d>0)for(let p=0;p<d;p+=2){let m=new S(Ee[p],Ee[p+1]);h.add(m)}}if(h.size>0){let u=e.center,d=e.sweep(),p=e.sweepAngle;h.forEach(m=>{let g=(m.angleD(u)%360+360)%360;if(d==le.CCW){let y=(g-a+360)%360;y<p&&(s=m,p=y)}else{let y=(g-a-360)%360;y>p&&(s=m,p=y)}})}return s}}calcuArcArc(t,e,r){let i=t.start(),n=t.end(),s=(t.startAngle%360+360)%360,a=e.stroke(r*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(i,a))return i;let c=new Set;for(let h of a.primitives){let u=Tt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=t.center,u=t.sweep(),d=t.sweepAngle;c.forEach(p=>{let m=(p.angleD(h)%360+360)%360;if(u==le.CCW){let g=(m-s+360)%360;g<d&&(n=p,d=g)}else{let g=(m-s-360)%360;g>d&&(n=p,d=g)}})}return n}isCollide(t,e,r,i=!0,n=!0){if(e==null)return!1;let s=t.bbox().extendOfSize(r);for(let a of e.primitives){if(a instanceof M&&a.length()<1e-8)continue;let l=a.bbox();if(s.isIntersect(l)){let c=new ir(t,a).getDistance();if(this.kit.less(c,r))return!0}}return!!(i&&this.pointInPolyline(t.start(),e)||t instanceof q&&this.kit.eq(Math.abs(t.sweepAngle),360)&&e.primitives[0].start().distance1(t.center)<t.rx)}};var R0=class{constructor(t){this.collide=!1;this.obstalce=null;this.collideInfo=null;this.style=null;this.style=t}addObstacle(t){this.obstalce=t}check(t){return this.obstalce!=null&&(this.collide=this.obstalce.checkCollide(t,this.style)),this}inters(t){return this.obstalce!=null&&this.collideInfo==null&&(this.collideInfo=this.obstalce.collide(t,this.style)),this.collideInfo!=null?(this.collideInfo.sort(),this.collideInfo.getEnd()):t.end()}};var e9e=class extends cD{check(t,e,r,i,n,s){switch(i.modelType){case"Track":case"ArcTrack":return this.checkTrackTrack(t,e,r,i,n,s);case"Pad":return this.checkTrackPad(t,e,r,i,n,s);case"Via":return this.checkTrackVia(t,e,r,i,n,s);case"Polygon":case"Rect":case"Circle":{let a=i;switch(a.type){case"Fill Region":case"TearDrop":case"Slot Region":return this.checkTrackProfile(t,e,r,a,n,s);case"Line":return this.checkTrackLine(t,e,r,a,n,s);case"Board Outline":return this.checkTrackBoard(t,e,r,a,n,s);case"Prohibited Region":return this.checkTrackProhibit(t,e,r,a,n,s);case"Partition":return this.checkTrackPartition(t,e,r,a,n,s)}break}case"Text":case"Image":return this.checkTrackBox(t,e,r,i,n,s)}return new R0(s)}checkPoint(t,e,r,i,n,s){if(this.isSameNet(r.net,i.net)||e!==12&&e!==i.layerId)return!1;let a=s?i.start:i.end,l=new M(a,a),c=t.bbox(),h=l.bbox(),u=r.width,d=i.width,p=n+u/2+d/2;if(!c.extendOfSize(p).intersection1(h))return!1;let g=new ir(t,l).getDistance();if(this.kit.greatereq(g,p)){let y=fe.build7([l]),b=ll.convexHull(y,n);return!!(!new rh().inEdge4Polyline(t.end(),b,.006)&&this.pointInPolyline(t.end(),b))}else return!0}checkTrackTrackEnd(t,e,r,i,n,s,a=!1){if(!a&&this.isSameNet(r.net,i.net)||e!==12&&e!==i.layerId)return!1;let l=r.width,c=i.width,h=n+l/2+c/2,u=s?i.start:i.end;if(!t.bbox().extendOfSize(h).isContains(u))return!1;let d;t instanceof M?d=new hP(t,h*2):d=new X1(t,h*2);let p=d.getOutline(Ts);return!!d.inInside(u,p)}checkTrackTrack(t,e,r,i,n,s){let a=new R0(s);if(this.isSameNet(r.net,i.net)||e!==12&&e!==i.layerId)return a;let l=r.width,c=n+l/2,h=this.manager.getModelObstacle(i,c,e);return a.addObstacle(h),a.check(t)}checkTrackPad(t,e,r,i,n,s){let a=new R0(s);if(r.net===i.net||e!==12&&i.layerId!==12&&e!==i.layerId)return a;let l=n+r.width/2;if(!i.isUnuseLayer(e)){let c=this.manager.getModelObstacle(i,l,e);return a.addObstacle(c),a.check(t)}return a}checkTrackVia(t,e,r,i,n,s){let a=new R0(s);if(r.net===i.net||i.type==1&&!i.isContains(r.layerId))return a;let l=n+r.width/2;if(!i.isUnuseLayer(e)){let c=this.manager.getModelObstacle(i,l,e);return a.addObstacle(c),a.check(t)}return a}checkTrackProfile(t,e,r,i,n,s){let a=new R0(s);if(i.type=="Fill Region"&&i.component instanceof ln&&i.component.isBridgingCopper){let h=i.component.networkList;if(h.length==0&&this.isSameNet(r.net,"")||h.length==1&&this.isSameNet(r.net,h[0]))return a}else if((i.type=="Fill Region"||i.type=="TearDrop")&&this.isSameNet(r.net,i.net)||(i.type=="Fill Region"||i.type=="TearDrop")&&i.layerId!==e&&e!==12)return a;let l=n+r.width/2,c=this.manager.getModelObstacle(i,l,r.layerId);return a.addObstacle(c),a.check(t)}checkTrackLine(t,e,r,i,n,s){let a=new R0(s);if(i.layerId!==11&&this.isSameNet(r.net,i.net)||e!==12&&i.layerId!==e&&i.layerId!==11)return a;let l=r.width/2+n,c=this.manager.getModelObstacle(i,l,r.layerId);return a.addObstacle(c),a.check(t)}checkTrackBoard(t,e,r,i,n,s){let a=new R0(s),l=r.width/2+n,c=this.manager.getModelObstacle(i,l,r.layerId);return a.addObstacle(c),a.check(t)}checkTrackBox(t,e,r,i,n,s){let a=new R0(s);if(e!==12&&i.layerId!==r.layerId)return a;let l=n+r.width/2,c=this.manager.getModelObstacle(i,l,r.layerId);return a.addObstacle(c),a.check(t)}checkTrackProhibit(t,e,r,i,n,s){let a=new R0(s);if(e!==12&&i.layerId!==e&&i.layerId!==12||!i.component.track)return a;let c=n+r.width/2,h=this.manager.getModelObstacle(i,c,r.layerId);return a.addObstacle(h),a.check(t)}checkTrackPartition(t,e,r,i,n,s){let a=new R0(s);if(i.type=="Partition"&&!i.component.isPartitionSplitOut())return a;let l=n,c=this.manager.getModelObstacle(i,l,r.layerId);return a.addObstacle(c),a.check(t)}},kh=new e9e;function hOt(o,t,e,r){return!(o.net==t.net||o.isSeparated(t)||e==12&&r==12||e!=12&&r!=12&&e!=r||o.type==1&&t.type==1&&r!==12&&e!==12&&(!o.isContains(r)||!t.isContains(e))||o.isUnuseLayer(e)||t.isUnuseLayer(r))}var t9e=class extends cD{check(t,e,r,i,n,s){switch(r.modelType){case"Track":case"ArcTrack":return this.checkViaTrack(t,e,r,i,n);case"Pad":return this.checkViaPad(t,e,r,i,n,s);case"Via":return this.checkViaVia(t,e,r,i,n,s);case"Polygon":case"Rect":case"Circle":switch(r.type){case"Fill Region":case"TearDrop":case"Slot Region":return this.checkViaRegion(t,e,r,i,n);case"Line":return this.checkViaLine(t,e,r,i,n);case"Board Outline":return this.checkViaBoard(t,e,r,i,n);case"Partition":return this.checkViaPartition(t,e,r,i,n)}case"Text":case"Image":return this.checkViaBox(t,e,r,i,n)}return new R0}checkViaTrack(t,e,r,i,n){let s=new R0;if(e.net==r.net||n!=12&&n!=r.layerId||e.type==1&&!e.isContains(r.layerId))return s;let a=i;if(!e.isUnuseLayer(n)||n==12){let l=this.getViaRadius(e,n),c=this.manager.getModelObstacle(r,a+l,r.layerId);return s.addObstacle(c),s.check(t)}return s}checkViaVia(t,e,r,i,n,s){let a=new R0;if(!hOt(e,r,n,s))return a;let l=this.getViaRadius(e,n),c=this.manager.getModelObstacle(r,i+l,s);return a.addObstacle(c),a.check(t)}getViaRadius(t,e){return e==12?t.holeRadius:t.radius}checkViaPad(t,e,r,i,n,s){let a=new R0;if(e.net==r.net||n==12&&s==12)return a;if(r.layerId==12){if(n!=12&&s!=12&&n!=s)return a}else if(r.layerId!=s)return a;if(e.isUnuseLayer(n)||r.isUnuseLayer(s)||e.type==1&&r.layerId!=12&&!e.isContains(r.layerId))return a;if(e.type==0){let l=this.getViaRadius(e,n);if(s!==12){let c=this.manager.getModelObstacle(r,i+l,s);return a.addObstacle(c),a.check(t)}if(s==12){let c=this.manager.getModelObstacle(r,i+l,s);return a.addObstacle(c),a.check(t)}}else{let l=this.getViaRadius(e,n);if(e.isContains(s)&&s!==12){let c=this.manager.getModelObstacle(r,i+l,s);return a.addObstacle(c),a.check(t)}if(s==12){let c=this.manager.getModelObstacle(r,i+l,s);return a.addObstacle(c),a.check(t)}}return a}checkViaRegion(t,e,r,i,n){let s=new R0;if(e.isUnuseLayer(n)||n!=12&&r.layerId!=12&&n!=r.layerId)return s;if(r.type=="Fill Region"&&r.component instanceof ln&&r.component.isBridgingCopper){let c=r.component.networkList;if(c.length==0&&this.isSameNet(e.net,"")||c.length==1&&this.isSameNet(e.net,c[0]))return s}else if((r.type=="Fill Region"||r.type=="TearDrop")&&this.isSameNet(e.net,r.net)||e.type==1&&(r.type=="Fill Region"||r.type=="TearDrop")&&!e.isContains(r.layerId))return s;let a=this.getViaRadius(e,n),l=this.manager.getModelObstacle(r,i+a,r.layerId);return s.addObstacle(l),s.check(t)}checkViaLine(t,e,r,i,n){let s=new R0;if(this.isSameNet(e.net,r.net)||n!=12&&r.layerId!=11&&n!=r.layerId||e.type==1&&!e.isContains(r.layerId)||e.isUnuseLayer(n))return s;let a=this.getViaRadius(e,n),l=this.manager.getModelObstacle(r,i+a,r.layerId);return s.addObstacle(l),s.check(t)}checkViaBoard(t,e,r,i,n){let s=new R0;if(e.isUnuseLayer(n))return s;let a=this.getViaRadius(e,n),l=this.manager.getModelObstacle(r,i+a,r.layerId);return s.addObstacle(l),s.check(t)}checkViaPartition(t,e,r,i,n){let s=new R0,a=this.manager.getModelObstacle(r,i,r.layerId);return s.addObstacle(a),s.check(t)}checkViaBox(t,e,r,i,n){let s=new R0;if(n!==12&&n!==r.layerId||e.type==1&&!e.isContains(r.layerId)&&n!==12||e.isUnuseLayer(n))return s;let a=this.getViaRadius(e,n),l=this.manager.getModelObstacle(r,i+a,r.layerId);return s.addObstacle(l),s.check(t)}},hD=new t9e;var aX=class o{constructor(t){this.map=new Map;this.shape=t}addRes(t,e){this.map.set(t,e)}hashCode(){return this.shape.hashCode()}equals(t){return!!(t instanceof o&&t.shape.equals(this.shape))}},j6=class j6{constructor(){this.map=new Map;this.map1=new Map;this._hashMap=null}static getInstance(){return j6.manager==null&&(j6.manager=new j6),j6.manager}addDrcError(t,e,r,i){this._hashMap=this.map.get(t),this._hashMap==null&&(this._hashMap=new Bd,this.map.set(t,this._hashMap));let n=new aX(e),s=this._hashMap.get(n);s==null&&(s=n,this._hashMap.put(n,n)),s.addRes(r,i),this.addError(r,e,t,i)}addError(t,e,r,i){this._hashMap=this.map1.get(t),this._hashMap==null&&(this._hashMap=new Bd,this.map1.set(t,this._hashMap));let n=new aX(e),s=this._hashMap.get(n);s==null&&(s=n,this._hashMap.put(n,n)),s.addRes(r,i)}change(t){if(this._hashMap=this.map1.get(t),this._hashMap!=null){let e=this._hashMap.keys();for(;e.hasNext();){let r=e.next();for(let[i]of r.map){let n=this.map.get(i);if(n!=null){let s=n.get(r);s!=null&&s.map.delete(t)}}}this.map1.delete(t)}}getErrors(t,e){let r=new Array,i=this.map.get(t);if(i!=null){let n=new aX(e),s=i.get(n);if(s!=null)for(let[,a]of s.map)r.push(a)}return r}clear(){this.map.clear(),this.map1.clear()}};j6.manager=null;var Ra=j6;var Qne=class{constructor(t){this.item=void 0;this._shapeType=10;this.item=t}setItem(t){this.item=t}get id(){var t;return((t=this.item)==null?void 0:t.globalIndex)||""}get net(){return dSe(this.item)}get layerId(){var t;if(this.item==null)throw new Error("Rule Item data Error!!!");return(t=this.item)==null?void 0:t.layerId}get shapeType(){return this._shapeType}set shapeType(t){this._shapeType=t}get isBridgingCopper(){return this._shapeType===6&&this.item instanceof lr&&this.item.component instanceof ln?this.item.component.isBridgingCopper:!1}get nets(){return this.isBridgingCopper&&this.item instanceof lr?this.item.component.networkList:[]}},uP=class{constructor(){this.rule1=new Qne;this.rule2=new Qne}sycnRule1(t,e=!1){return this.rule1.setItem(t),e?this.rule1.shapeType=12:this.rule1.shapeType=G1(t),this.rule1}sycnRule2(t,e=!1){return this.rule2.setItem(t),e?this.rule2.shapeType=12:this.rule2.shapeType=G1(t),this.rule2}sycnTrack1(t){return this.rule1.setItem(t),this.rule1.shapeType=0,this.rule1}};function DF(o,t){if(o.length==0)return o;if(t instanceof M){let e=t.start();xr(o,(r,i)=>{if(r.point.equals1(i.point)){if(r.isSameNet&&!i.isSameNet)return-1;if(!r.isSameNet&&i.isSameNet)return 1}return r.point.distance2(e)-i.point.distance2(e)},0,o.length)}else{let e=t.center,r=t.start().sub(e).normalize(),i=t.sweep();xr(o,(n,s)=>{if(n.point.equals1(s.point)){if(n.isSameNet&&!s.isSameNet)return-1;if(!n.isSameNet&&s.isSameNet)return 1}let a=n.point.sub(e).normalize(),l=s.point.sub(e).normalize(),c=xe(r.dot(a),8),h=xe(r.dot(l),8),u=r.cross(a),d=r.cross(l),p=Math.acos(c),m=Math.acos(h);return(i==le.CCW&&ne.less(u,0)||i==le.CW&&ne.greater(u,0))&&(p=Vr-p),(i==le.CCW&&ne.less(d,0)||i==le.CW&&ne.greater(d,0))&&(m=Vr-m),p-m},0,o.length)}return o}var uOt=new th(.006);function eoe(o,t){return!!(uOt.eq(o.direct.cross(t.sub(o.start())),0)&&o.bbox().extendOfSize(.006).isContains(t))}var As=class extends lD{constructor(){super(...arguments);this.clearanceUtils=new Ep;this.pair1=new uP;this.pair2=new uP}block(e){return this.blockTrack(e)}check(e){switch(e.modelType){case"Track":case"ArcTrack":return this.drcBlockTrackPrimitive(e);case"Via":return this.drcBlockViaPrimitive(e)}return[]}search(e){return Nt.search4Rtree(e)}searchAll(e){return Nt.search4All(e)}blockTrack(e){let r=te.getInstance(),i=r.getMaxSafeTrack(e.layerId),n=this.getBBox(e,i),s=this.search(n),a=e.primitive,l=e.width,c=new Array;this.pair1.sycnTrack1(e);let h=[e.layerId],u=[e.layerId,12];for(let d of s){let p=this.clearanceUtils.isHole(d)?u:h;for(let m of p){this.pair2.sycnRule1(d,m==12);let g=r.getSafeClearance(this.pair1.rule1,this.pair2.rule1,e.layerId);if(d instanceof lr&&(d.type=="Prohibited Region"||d.type=="Partition")&&(g=1e-4),ne.eq(g,0))continue;let y=kh.check(a,m,e,d,g);if(y.collide){let b=y.inters(a),P=new bl(e,b,d,g,void 0,e.layerId,m,y.collideInfo);c.push(P)}}}return DF(c,a),c}blockTrack2(e,r=!1){let n=te.getInstance().getMaxSafeTrack(e.layerId),s=this.getBBox(e,n),a=this.searchAll(s);r&&(a=a.filter(m=>!(m instanceof yt)));let l=e.primitive,c=e.width,h=new Array,u=this.pair1.sycnRule1(e),d=[e.layerId],p=[e.layerId,12];for(let m of a){let g=this.clearanceUtils.isHole(m)?p:d;for(let y of g){let b=this.clearanceUtils.getTrackSafeClearance(u,this.pair2.sycnRule1(m),e,m,e.layerId);if(m instanceof lr&&(m.type=="Prohibited Region"||m.type=="Partition")&&(b=1e-4),ne.eq(b,0))continue;let P=kh.check(l,y,e,m,b);if(P.collide){let T=P.inters(l),I=new bl(e,T,m,b,void 0,e.layerId,y,P.collideInfo);h.push(I)}}}return h}blockEndpointPrimitive1(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),s=(r?e.start:e.end).bbox().extendOfSize(i+e.width/2),a=Nt.searchTrack(s),l=new Set,c=this.pair1.sycnRule1(e),h=[e.layerId];for(let u of a.tracks)if(u.net!=e.net&&u!=e){let d=h;for(let p of d){let m=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnTrack1(u),u,p);if(ne.eq(m,0))continue;kh.checkTrackTrackEnd(u.primitive,p,u,e,m,r,!0)&&l.add(u)}}return l}blockEndpointPrimitive(e){let r=this.clearanceUtils.getMaxTrackClearance(),i=new Set;for(let n of e){let s=this.pair1.sycnTrack1(n),a=this.getBBox(n,r),l=Nt.searchTrack(a);for(let c of l.checkEnd){if(!a.extendOfSize(c.width/2).isContains(c.end)||n.layerId!=c.layerId)continue;let h=this.clearanceUtils.getSafeClearance(s,this.pair2.sycnTrack1(c),c,n.layerId);if(ne.eq(h,0))continue;if(kh.checkTrackTrackEnd(n.primitive,n.layerId,n,c,h,!1))i.add(c);else if(n.layerId==c.layerId){let p=xt.getInstance().getListNode(c).parent;p.otherNode.next instanceof Je&&kh.check(n.primitive,n.layerId,n,p.otherNode.next,h).collide&&i.add(c)}}for(let c of l.checkStart){if(!a.extendOfSize(c.width/2).isContains(c.start)||n.layerId!=c.layerId)continue;let h=this.clearanceUtils.getSafeClearance(s,this.pair2.sycnTrack1(c),c,n.layerId);if(ne.eq(h,0))continue;if(kh.checkTrackTrackEnd(n.primitive,n.layerId,n,c,h,!0))i.add(c);else if(n.layerId==c.layerId){let p=xt.getInstance().getListNode(c).parent;p.otherNode.prev instanceof Je&&kh.check(n.primitive,n.layerId,n,p.otherNode.prev,h).collide&&i.add(c)}}}return i}blockEndpoint(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=new Set,s=this.getBBox4Primitive(e,r,i),a=Nt.searchTrack(s);for(let l of a.checkEnd){if(!s.extendOfSize(l.width/2).isContains(l.end))continue;let c=this.clearanceUtils.getSafeClearance(this.pair1.sycnRule1(e),this.pair2.sycnRule1(l),l,e.layerId);if(ne.eq(c,0))continue;if(kh.checkTrackTrackEnd(r,e.layerId,e,l,c,!1))n.add(l);else if(e.layerId==l.layerId){let d=xt.getInstance().getListNode(l).parent;d.otherNode.next instanceof Je&&kh.check(r,e.layerId,e,d.otherNode.next,c).collide&&n.add(l)}}for(let l of a.checkStart){if(!s.extendOfSize(l.width/2).isContains(l.start))continue;let c=this.clearanceUtils.getSafeClearance(this.pair1.sycnRule1(e),this.pair2.sycnRule1(l),l,e.layerId);if(ne.eq(c,0))continue;if(kh.checkTrackTrackEnd(r,e.layerId,e,l,c,!0))n.add(l);else if(e.layerId==l.layerId){let d=xt.getInstance().getListNode(l).parent;d.otherNode.prev instanceof Je&&kh.check(r,e.layerId,e,d.otherNode.prev,c).collide&&n.add(l)}}return n}blockPad(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=this.getBBox4Primitive(e,r,i),s=Nt.searchPad(n);return this.blockTrack4Shapes(e,r,!1,s)}getBBox4Primitive(e,r,i){return r instanceof M?nh.trackToOctagon(r.start(),r.end(),e.width+i*2):r.bbox().extendOfSize(i+e.width/2)}blockTrackPrimitive(e,r,i,n=!0){let s=this.clearanceUtils.getMaxTrackClearance(e.layerId),a=this.getBBox4Primitive(e,r,s),l=Nt.search1(a);return this.blockTrack4Shapes(e,r,i,l,n)}blockTrackOnlyTrack(e,r,i,n=!1){let s=this.clearanceUtils.getMaxTrackClearance(e.layerId),a=this.getBBox4Primitive(e,r,s),l=Nt.searchTrack(a);return this.blockTrack4Shapes(e,r,i,l,n)}getBBox(e,r){return e instanceof qr?nh.trackToOctagon(e.start,e.end,e.width+r*2):e.buildBBox().extendOfSize(r)}blockTrackOther(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=this.getBBox(e,i),s=Nt.searchConnect(n);return s.remove(r),this.blockTrack4Shapes(e,e.primitive,!0,s,!1)}blockTrackInput(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=this.getBBox(e,i),s=Nt.searchInput(n);return s.remove(r),this.blockTrack4Shapes(e,e.primitive,!0,s,!1)}blockTrackOtherObstruct(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=this.getBBox(e,i),s=Nt.search1(n);return s.remove(r),this.blockTrack4ShapesObstruct(e,e.primitive,!1,s,!1)}blockTrack4Shapes(e,r,i,n,s=!0){let a=new Array,l=this.pair1.sycnRule1(e),c=r.bbox().extendOfSize(e.width/2),h=[e.layerId],u=[e.layerId,12],d=new Map,p=Ra.getInstance().getErrors(e.globalIndex,r);for(let y of p)d.set(y.obstacle,y);function m(y,b,P){if(ne.eq(b,0))return;let T=d.get(y);if(T!=null&&T.clearance==b&&T.layer2==P){if(T.block.collide){let C=new bl(e,T.point,y,b,void 0,e.layerId,P,T.block.collideInfo);C.block=T.block,a.push(C)}return}if(y.buildBBox().extendOfSize(b+e.width/2).isSeparated(r.bbox()))return;let I=kh.check(r,P,e,y,b);if(I.collide){let C=I.inters(r),E=new bl(e,C,y,b,void 0,e.layerId,P,I.collideInfo);E.block=I,a.push(E),i&&Ra.getInstance().addDrcError(e.globalIndex,r,y.globalIndex,E)}else if(i){let C=new bl(e,r.end(),y,b,void 0,e.layerId,P,null);C.block=I,Ra.getInstance().addDrcError(e.globalIndex,r,y.globalIndex,C)}}let g=e.layerId;for(let y of n.tracks){if((!i||i&&y!=e)&&s&&y.net==e.net&&y.layerId==e.layerId){let P=new Array,T=y.primitive,I=Tt(r,T),C=!1,E=!1;for(let _=0;_<I;_+=2){let R=new S(Ee[_],Ee[_+1]),v=R.equals1(r.start());C?E=R.equals1(r.end())||R.equals1(T.end()):C=v,!(R.equals1(r.end())&&R.equals1(T.start()))&&(v||P.push(R))}if(C&&E)continue;P.length==0&&r instanceof M&&eoe(r,y.end)&&!y.end.equals1(r.start())&&P.push(y.end);let O=dn(P,r);if(O.length>0){let _=O[0],R=new bl(e,_,y,0,!0,e.layerId,e.layerId);a.push(R)}continue}if(y==e||y.layerId!=e.layerId)continue;let b=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(y),y,g,c);m(y,b,g)}for(let y of n.vias)if(!(y.net==e.net||!y.isContains(e.layerId)))for(let b of u){let P=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(y,b==12),y,b,c);m(y,P,b)}for(let y of n.pads){if(y.net==e.net||y.layerId!=12&&y.layerId!=e.layerId)continue;let b=this.clearanceUtils.isHole(y)?u:h;for(let P of b){let T=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(y,P==12),y,P,c);m(y,T,P)}}for(let y of n.imageTexts){if(y.layerId!=e.layerId)continue;let b=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(y),y,g,c);m(y,b,g)}for(let y of n.profiles){if(y.layerId!=12&&y.layerId!=1004&&y.layerId!=11&&y.layerId!=e.layerId)continue;let b=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(y),y,g,c);(y.type=="Prohibited Region"||y.type=="Partition")&&(b=1e-4),m(y,b,g)}return DF(a,r),a}blockTrack4ShapesObstruct(e,r,i,n,s=!0){let a=new Array,l=this.pair1.sycnRule1(e),c=[e.layerId],h=[e.layerId,12],u=new Map,d=Ra.getInstance().getErrors(e.globalIndex,r);for(let g of d)u.set(g.obstacle,g);function p(g,y,b){if(ne.eq(y,0))return;let P=u.get(g);if(P!=null&&P.clearance==y&&P.layer2==b){if(P.block.collide){let I=new bl(e,P.point,g,y,void 0,e.layerId,b,P.block.collideInfo);I.block=P.block,a.push(I)}return}if(g.buildBBox().extendOfSize(y+e.width/2).isSeparated(r.bbox()))return;let T=kh.check(r,b,e,g,y);if(T.collide){let I=T.inters(r),C=new bl(e,I,g,y,void 0,e.layerId,b,T.collideInfo);C.block=T,a.push(C),i&&Ra.getInstance().addDrcError(e.globalIndex,r,g.globalIndex,C)}else if(i){let I=new bl(e,r.end(),g,y,void 0,e.layerId,b,null);I.block=T,Ra.getInstance().addDrcError(e.globalIndex,r,g.globalIndex,I)}}let m=e.layerId;for(let g of n.tracks){if((!i||i&&g!=e)&&s&&g.net==e.net&&g.layerId==e.layerId){let b=new Array,P=g.primitive,T=Tt(r,P),I=!1,C=!1;for(let O=0;O<T;O+=2){let _=new S(Ee[O],Ee[O+1]),R=_.equals1(r.start());I?C=_.equals1(r.end())||_.equals1(P.end()):I=R,!(_.equals1(r.end())&&_.equals1(P.start()))&&(R||b.push(_))}if(I&&C)continue;b.length==0&&r instanceof M&&eoe(r,g.end)&&!g.end.equals1(r.start())&&b.push(g.end);let E=dn(b,r);if(E.length>0){let O=E[0],_=new bl(e,O,g,0,!0,e.layerId,e.layerId);a.push(_)}continue}if(g==e||g.layerId!=e.layerId)continue;let y=this.clearanceUtils.getTrackSafeClearance(l,this.pair2.sycnRule1(g),e,g,m);p(g,y,m)}for(let g of n.vias)if(!(g.net==e.net||!g.isContains(e.layerId)))for(let y of h){let b=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(g,y==12),g,y);p(g,b,y)}for(let g of n.pads){if(g.net==e.net||g.layerId!=12&&g.layerId!=e.layerId)continue;let y=this.clearanceUtils.isHole(g)?h:c;for(let b of y){let P=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(g,b==12),g,b);p(g,P,b)}}for(let g of n.imageTexts){if(g.layerId!=e.layerId)continue;let y=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(g),g,m);p(g,y,m)}for(let g of n.profiles){if(g.layerId!=12&&g.layerId!=1004&&g.layerId!=11&&g.layerId!=e.layerId)continue;let y=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(g),g,m);(g.type=="Prohibited Region"||g.type=="Partition")&&(y=1e-4),p(g,y,m)}return DF(a,r),a}blockOtherTrackOnlyTrack(e){let r=this.clearanceUtils.getMaxTrackClearance(e.layerId),i=this.getBBox(e,r),n=Nt.searchTrack(i);return this.blockOtherTrack(e,n)}blockOtherTrack(e,r){let i=new Array,n=this.pair1.sycnRule1(e),s=null;function a(c,h,u){if(ne.eq(h,0))return;s=c.primitive;let d=kh.check(s,u,c,e,h);if(d.collide){let p=d.inters(s),m=new bl(c,p,e,h,!1,c.layerId,u,d.collideInfo);m.block=d,i.push(m),Ra.getInstance().addDrcError(c.globalIndex,s,e.globalIndex,m)}else{let p=new bl(c,s.end(),e,h,!1,c.layerId,u,null);p.block=d,Ra.getInstance().addDrcError(c.globalIndex,s,e.globalIndex,p)}}let l=e.layerId;for(let c of r.tracks){if(c==e||c.net==e.net||c.layerId!=e.layerId)continue;let h=this.clearanceUtils.getSafeClearance(n,this.pair2.sycnRule1(c),c,l);a(c,h,l)}return i}checkDRC(e,r){let i=this.clearanceUtils.getSafeClearance(this.pair1.sycnRule1(e),this.pair2.sycnRule1(r),r,e.layerId);return kh.check(e.primitive,e.layerId,e,r,i).collide}checkTrackDRC(e){let r=e.primitive,i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=this.getBBox(e,i),s=Nt.search1(n);return this.checkTrackDRC4Primitive(e,s,r)}checkTrackDRC4Primitive(e,r,i){let n=this.pair1.sycnRule1(e),s=[e.layerId],a=[e.layerId,12],l=new Map,c=Ra.getInstance().getErrors(e.globalIndex,i);for(let d of c)l.set(d.obstacle,d);function h(d,p,m){if(ne.eq(p,0))return!1;let g=l.get(d);return g!=null&&g.clearance==p&&g.layer2==m?g.block.collide:kh.check(i,m,e,d,p,"free").collide}let u=e.layerId;for(let d of r.tracks){if(d.net==e.net||d.layerId!=e.layerId)continue;let p=this.clearanceUtils.getSafeClearance(n,this.pair2.sycnRule1(d),d,u);if(h(d,p,u))return!0}for(let d of r.vias)if(!(d.net==e.net||!d.isContains(e.layerId)))for(let p of a){let m=this.clearanceUtils.getSafeClearance(n,this.pair2.sycnRule1(d,p==12),d,p);if(h(d,m,p))return!0}for(let d of r.pads){if(d.net==e.net||d.layerId!=12&&d.layerId!=e.layerId)continue;let p=this.clearanceUtils.isHole(d)?a:s;for(let m of p){let g=this.clearanceUtils.getSafeClearance(n,this.pair2.sycnRule1(d,m==12),d,m);if(h(d,g,m))return!0}}for(let d of r.imageTexts){if(d.layerId!=e.layerId)continue;let p=this.clearanceUtils.getSafeClearance(n,this.pair2.sycnRule1(d),d,u);if(h(d,p,u))return!0}for(let d of r.profiles){if(d.layerId!=12&&d.layerId!=11&&d.layerId!=1004&&d.layerId!=e.layerId)continue;let p=this.clearanceUtils.getSafeClearance(n,this.pair2.sycnRule1(d),d,u);if((d.type=="Prohibited Region"||d.type=="Partition")&&(p=1e-4),h(d,p,u))return!0}return!1}checkDRC4Primitive(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=this.getBBox4Primitive(e,r,i),s=Nt.search1(n);return this.checkTrackDRC4Primitive(e,s,r)}blockTrackPoint(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=r?e.start:e.end,s=n.bbox().extendOfSize(i+e.width/2),a=Nt.search1(s),l=new Array,c=this.pair1.sycnRule1(e),h=[e.layerId],u=[e.layerId,12],d=new M(n,n);function p(g,y,b){if(ne.eq(y,0))return;kh.check(d,b,e,g,y).collide&&l.push(g)}let m=e.layerId;for(let g of a.tracks){if(g.net==e.net||g.layerId!=e.layerId)continue;let y=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnRule1(g),g,m);p(g,y,m)}if(l.length>0)return l;for(let g of a.vias)for(let y of u){let b=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnRule1(g,y==12),g,y);if(p(g,b,y),l.length>0)return l}for(let g of a.pads){let y=this.clearanceUtils.isHole(g)?u:h;for(let b of y){let P=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnRule1(g,b==12),g,b);if(p(g,P,b),l.length>0)return l}}for(let g of a.imageTexts){let y=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnRule1(g),g,m);if(p(g,y,m),l.length>0)return l}for(let g of a.profiles){let y=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnRule1(g),g,m);if((g.type=="Prohibited Region"||g.type=="Partition")&&(y=1e-4),p(g,y,m),l.length>0)return l}return l}blockTrackGraphics(e,r,i,n){let s=this.clearanceUtils.getMaxTrackClearance(e.layerId),a=this.getBBox4Primitive(e,r,s),l=Nt.search1(a),c=new Array,h=this.pair1.sycnRule1(e),u=[e.layerId],d=[e.layerId,12],p=new Map,m=Ra.getInstance().getErrors(e.globalIndex,r);for(let b of m)p.set(b.obstacle,b);function g(b,P,T){if(ne.eq(P,0))return;let I=!1,C=p.get(b);if(C!=null&&C.clearance==P&&C.layer2==T){if(I=!0,C.block.collide){let O=new bl(e,C.point,b,P,void 0,e.layerId,T,C.block.collideInfo);O.block=C.block,c.push(O)}return}let E=kh.check(r,T,e,b,P);if(I&&C.block.collide!=E.collide){debugger;console.log(C)}if(E.collide){let O=E.inters(r),_=new bl(e,O,b,P,void 0,e.layerId,T,E.collideInfo);_.block=E,c.push(_),i&&Ra.getInstance().addDrcError(e.globalIndex,r,b.globalIndex,_)}else if(i){let O=new bl(e,r.end(),b,P,void 0,e.layerId,T,null);O.block=E,Ra.getInstance().addDrcError(e.globalIndex,r,b.globalIndex,O)}}let y=e.layerId;for(let b of l.tracks){if(n&&n.includes(b))continue;if((!i||i&&b!=e)&&b.net==e.net&&b.layerId==e.layerId){let T=new Array,I=b.primitive,C=Tt(r,I),E=!1,O=!1;for(let R=0;R<C;R+=2){let v=new S(Ee[R],Ee[R+1]),D=v.equals1(r.start());E?O=v.equals1(r.end())||v.equals1(I.end()):E=D,!(v.equals1(r.end())&&v.equals1(I.start()))&&(D||T.push(v))}if(E&&O)continue;let _=dn(T,r);if(_.length>0){let R=_[0],v=new bl(e,R,b,0,!0,e.layerId,e.layerId);c.push(v)}continue}if(b==e)continue;let P=this.clearanceUtils.getSafeClearance(h,this.pair2.sycnRule1(b),b,y);g(b,P,y)}for(let b of l.vias)for(let P of d){let T=this.clearanceUtils.getSafeClearance(h,this.pair2.sycnRule1(b,P==12),b,P);g(b,T,P)}for(let b of l.pads){let P=this.clearanceUtils.isHole(b)?d:u;for(let T of P){let I=this.clearanceUtils.getSafeClearance(h,this.pair2.sycnRule1(b,T==12),b,T);g(b,I,T)}}for(let b of l.imageTexts){let P=this.clearanceUtils.getSafeClearance(h,this.pair2.sycnRule1(b),b,y);g(b,P,y)}for(let b of l.profiles){let P=this.clearanceUtils.getSafeClearance(h,this.pair2.sycnRule1(b),b,y);(b.type=="Prohibited Region"||b.type=="Partition")&&(P=1e-4),g(b,P,y)}return DF(c,r),c}drcBlockTrackPrimitive(e){let r=this.clearanceUtils.getMaxTrackClearance(e.layerId),i=this.getBBox(e,r),n=Nt.search4Rtree(i).filter(d=>!(d instanceof lr&&d.type=="Partition")),s=e.primitive,a=e.width,l=new Array,c=this.pair1.sycnRule1(e),h=[e.layerId],u=[e.layerId,12];for(let d of n){let p=this.clearanceUtils.isHole(d)?u:h;for(let m of p){let g=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnRule1(d,m==12),d,m);if(d instanceof lr&&(d.type=="Prohibited Region"||d.type=="Partition")&&(g=1e-4),ne.eq(g,0))continue;let y=kh.check(s,m,e,d,g,"0");if(y.collide){let b=y.inters(s),P=new bl(e,b,d,g,void 0,e.layerId,m,y.collideInfo);l.push(P)}}}return DF(l,s),l}checkViasCollides(e,r,i,n){if(e.net==r.net||e.type==1&&r.type==1&&!e.isContains(r.startLayer)&&!e.isContains(r.endLayer))return!1;let s=i.distance1(n),a=[e.startLayer,12],l=0;for(let c of a){let h=this.pair1.sycnRule1(e,c==12),u=c===12?e.holeRadius:e.radius;for(let d of a){let p=this.pair2.sycnRule1(r,d==12),m=this.clearanceUtils.getSafeClearance(h,p,r,d),g=this.clearanceUtils.getSafeClearance(h,p,e,c),y=Math.max(m,g),b=d===12?r.holeRadius:r.radius;l=Math.max(l,y+u+b)}}return s<=l}blockTrack1(e,r){let n=te.getInstance().getMaxSafeTrack(e.layerId),s=this.getBBox4Primitive(e,r,n),a=Nt.search1(s),l=this.pair1.sycnRule1(e),c=a.getAll();for(let h of c){let u=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(h),h,e.layerId);if(h instanceof lr&&(h.type=="Prohibited Region"||h.type=="Partition")&&(u=1e-4),ne.eq(u,0))continue;if(kh.check(r,e.layerId,e,h,u).collide)return!0}for(let h of a.checkEnd){if(!s.extendOfSize(h.width/2).isContains(h.end))continue;let u=this.clearanceUtils.getSafeClearance(this.pair1.sycnRule1(e),this.pair2.sycnRule1(h),h,e.layerId);if(ne.eq(u,0))continue;if(kh.checkTrackTrackEnd(r,e.layerId,e,h,u,!1))return!0;if(e.layerId==h.layerId){let m=xt.getInstance().getListNode(h).parent;if(m.otherNode.next instanceof Je&&kh.check(r,e.layerId,e,m.otherNode.next,u).collide)return!0}}for(let h of a.checkStart){if(!s.extendOfSize(h.width/2).isContains(h.start))continue;let u=this.clearanceUtils.getSafeClearance(this.pair1.sycnRule1(e),this.pair2.sycnRule1(h),h,e.layerId);if(ne.eq(u,0))continue;if(kh.checkTrackTrackEnd(r,e.layerId,e,h,u,!0))return!0;if(e.layerId==h.layerId){let m=xt.getInstance().getListNode(h).parent;if(m.otherNode.prev instanceof Je&&kh.check(r,e.layerId,e,m.otherNode.prev,u).collide)return!0}}return!1}collideVia(e,r=!1){let n=te.getInstance().getMaxSafe(),s=e.buildBBox().extendOfSize(n),a=Nt.searchVia(s,r),l=$e.getInstance().getAllCopperLayerIds(),c=a.getAll();return this.checkViaCollides(e,c,l)}blockViaPoint(e){let i=te.getInstance().getMaxSafe(),n=e.buildBBox().extendOfSize(i),s=Nt.search1(n);return this.blockViaPoint4Shapes(e,s)}blockViaPoint4Shapes(e,r){let i=$e.getInstance().getAllCopperLayerIds(),n=r.getAll();return this.checkViaCollides(e,n,i)}blockViaPrimitive(e,r){let n=te.getInstance().getMaxSafe(),s=r.bbox().extendOfSize(Math.max(e.radius,e.holeRadius)+n),a=Nt.search1(s);return this.blockVia4Shapes(e,r,a)}blockVia4Shapes(e,r,i){let n=new Array,s=this.pair1.sycnRule1(e),a=this.pair1.sycnRule2(e,!0),l=$e.getInstance().getAllSignalLayerIds(),c=new Map,h=Ra.getInstance().getErrors(e.globalIndex,r);for(let d of h)c.set(d.obstacle,d);function u(d,p,m,g){if(ne.eq(p,0))return;let y=c.get(d);if(y!=null&&y.clearance==p&&y.layer2==g){if(y.block.collide){let P=new bl(e,y.point,d,p,void 0,m,g,y.block.collideInfo);P.block=y.block,n.push(P)}return}let b=hD.check(r,e,d,p,m,g);if(b.collide){let P=b.inters(r),T=new bl(e,P,d,p,void 0,m,g,b.collideInfo);T.block=b,n.push(T),Ra.getInstance().addDrcError(e.globalIndex,r,d.globalIndex,T)}else{let P=new bl(e,r.end(),d,p,void 0,m,g,null);P.block=b,Ra.getInstance().addDrcError(e.globalIndex,r,d.globalIndex,P)}}for(let d of i.tracks){if(d.net==e.net||!e.isContains(d.layerId))continue;let p=this.clearanceUtils.getSafeClearance(s,this.pair2.sycnRule1(d),d,d.layerId),m=this.clearanceUtils.getSafeClearance(a,this.pair2.sycnRule1(d),d,d.layerId);e.radius+p>=e.holeRadius+m?u(d,p,d.layerId,d.layerId):u(d,m,12,d.layerId)}for(let d of i.vias){if(d.net==e.net||e.isSeparated(d))continue;let p=this.pair2.sycnRule1(d),m=this.pair2.sycnRule2(d,!0);for(let g of l)if(e.isContains(g)&&d.isContains(g)){let y=this.clearanceUtils.getSafeClearance(s,p,d,g),b=this.clearanceUtils.getSafeClearance(s,m,d,g),P=this.clearanceUtils.getSafeClearance(a,p,d,g),T=e.radius+y+d.radius,I=e.radius+b+d.holeRadius,C=e.holeRadius+P+d.radius,E=Math.max(T,I,C);E===T?u(d,y,g,g):E===I?u(d,b,g,12):E===C&&u(d,P,12,g);break}}for(let d of i.pads)if(!(d.net==e.net||d.layerId!=12&&!e.isContains(d.layerId)))if(d.layerId==12){let p=this.pair2.sycnRule1(d),m=this.pair2.sycnRule1(d,!0);for(let g of l)if(e.isContains(g)){let y=this.clearanceUtils.getSafeClearance(s,p,d,g),b=this.clearanceUtils.getSafeClearance(a,p,d,g),P=e.radius+y,T=e.holeRadius+b;P>T?u(d,y,g,g):u(d,y,12,g);let I=this.clearanceUtils.getSafeClearance(s,m,d,g);u(d,I,g,12)}}else{let p=this.clearanceUtils.getSafeClearance(s,this.pair2.sycnRule1(d),d,d.layerId),m=this.clearanceUtils.getSafeClearance(a,this.pair2.sycnRule1(d),d,12);e.radius+p>=e.holeRadius+m?u(d,p,d.layerId,d.layerId):u(d,m,12,d.layerId)}for(let d of i.imageTexts){if(!e.isContains(d.layerId))continue;let p=this.clearanceUtils.getSafeClearance(s,this.pair2.sycnRule1(d),d,d.layerId),m=this.clearanceUtils.getSafeClearance(a,this.pair2.sycnRule1(d),d,12);e.radius+p>=e.holeRadius+m?u(d,p,d.layerId,d.layerId):u(d,m,12,d.layerId)}for(let d of i.profiles){if(d.layerId!=12&&d.layerId!=1004&&d.layerId!=11&&!e.isContains(d.layerId))continue;let p=this.clearanceUtils.getSafeClearance(s,this.pair2.sycnRule1(d),d,d.layerId),m=this.clearanceUtils.getSafeClearance(a,this.pair2.sycnRule1(d),d,12);(d.type=="Prohibited Region"||d.type=="Partition")&&(p=1e-4,m=1e-4);let g=Math.max(e.radius,e.holeRadius);g+p>=g+m?u(d,p,d.layerId,d.layerId):u(d,m,12,d.layerId)}return DF(n,r),n}collideViaTrack(e){let i=te.getInstance().getMaxSafe(),n=e.buildBBox().extendOfSize(i),s=Nt.searchTrack(n);this.pair1.sycnRule1(e),this.pair1.sycnRule2(e,!0);let a=$e.getInstance().getAllCopperLayerIds(),l=s.getAll();return this.checkViaCollides(e,l,a)}drcBlockViaPrimitive(e){let r=this.clearanceUtils.getMaxTrackClearance(),i=e.buildBBox().extendOfSize(r),n=this.getViaLayers(e),s=Nt.search4Rtree(i).filter(a=>n.includes(a.layerId));return this.pair1.sycnRule1(e),this.pair1.sycnRule2(e,!0),this.checkViaCollides(e,s,n)}checkViaCollides(e,r,i){this.pair1.sycnRule1(e),this.pair1.sycnRule2(e,!0);let n=new Array,s=new M(e.center,e.center);e:for(let a of r){for(let l of i){if(!e.isContains(l))continue;this.pair2.sycnRule1(a);let c=this.clearanceUtils.getSafeClearance(this.pair1.rule1,this.pair2.rule1,a,l);if(a instanceof lr&&a.type=="Partition"&&(c=1e-4),ne.eq(c,0))continue;let h=hD.check(s,e,a,c,l,l);if(h.collide){let u=new bl(e,e.center,a,c,!1,l,l,h.collideInfo);u.block=h,n.push(u);continue e}}for(let l of i){if(!e.isContains(l))continue;this.pair2.sycnRule1(a);let c=this.clearanceUtils.getSafeClearance(this.pair1.rule2,this.pair2.rule1,a,l);if(a instanceof lr&&a.type=="Partition"&&(c=1e-4),ne.eq(c,0))continue;let h=hD.check(s,e,a,c,12,l);if(h.collide){let u=new bl(e,e.center,a,c,!1,12,l,h.collideInfo);u.block=h,n.push(u);continue e}}if(this.clearanceUtils.isHole(a))for(let l of i){if(!e.isContains(l))continue;this.pair2.sycnRule1(a,!0);let c=this.clearanceUtils.getSafeClearance(this.pair1.rule1,this.pair2.rule1,a,l);if(a instanceof lr&&a.type=="Partition"&&(c=1e-4),ne.eq(c,0))continue;let h=hD.check(s,e,a,c,l,12);if(h.collide){let u=new bl(e,e.center,a,c,!1,l,12,h.collideInfo);u.block=h,n.push(u);continue e}}}return n}drcBlockViaPrimitive2(e){let r=this.clearanceUtils.getMaxTrackClearance(),i=e.buildBBox().extendOfSize(r),n=this.getViaLayers(e),s=Nt.search1(i).getAll();return this.checkViaCollides(e,s,n)}getViaLayers(e){if(e==null)return[];if(e instanceof It&&e.type==0){let r=new Array,i=be.getAllLayer();for(let n of i)n.config&&(n.type=="MULTI"||n.type=="TOP"||n.type=="OUTLINE"||n.type=="SIGNAL"||n.type=="BOTTOM")&&r.push(n.layerID);return r}else if(e instanceof It&&e.type==1){let r=[11,12],i=be.getAllLayer();for(let n of i)(e.isContains(n.layerID)&&n.layerID==12||n.isCopperLayer()||n.layerID==11||n.isInnerLayer())&&r.push(n.layerID);return r}else return[]}drcBlockViaPrimitiveValid(e){let r=this.clearanceUtils.getMaxTrackClearance(),i=e.buildBBox().extendOfSize(r),n=this.getViaLayers(e),s=Nt.search4Rtree(i).filter(a=>n.includes(a.layerId));return this.checkViaValid(e,s,n)}checkViaValid(e,r,i){this.pair1.sycnRule1(e),this.pair1.sycnRule2(e,!0);let n=new M(e.center,e.center);for(let s of r){for(let a of i){if(!e.isContains(a))continue;this.pair2.sycnRule1(s);let l=this.clearanceUtils.getSafeClearance(this.pair1.rule1,this.pair2.rule1,s,a);if(s instanceof lr&&s.type=="Partition"&&(l=1e-4),ne.eq(l,0))continue;let c=hD.check(n,e,s,l,a,a);if(c.collide){let h=new bl(e,e.center,s,l,!1,a,a,c.collideInfo);return h.block=c,!1}}for(let a of i){if(!e.isContains(a))continue;this.pair2.sycnRule1(s);let l=this.clearanceUtils.getSafeClearance(this.pair1.rule2,this.pair2.rule1,s,a);if(s instanceof lr&&s.type=="Partition"&&(l=1e-4),ne.eq(l,0))continue;let c=hD.check(n,e,s,l,12,a);if(c.collide){let h=new bl(e,e.center,s,l,!1,12,a,c.collideInfo);return h.block=c,!1}}if(this.clearanceUtils.isHole(s))for(let a of i){if(!e.isContains(a))continue;this.pair2.sycnRule1(s,!0);let l=this.clearanceUtils.getSafeClearance(this.pair1.rule1,this.pair2.rule1,s,a);if(s instanceof lr&&s.type=="Partition"&&(l=1e-4),ne.eq(l,0))continue;let c=hD.check(n,e,s,l,a,12);if(c.collide){let h=new bl(e,e.center,s,l,!1,a,12,c.collideInfo);return h.block=c,!1}}}return!0}};var GGe=Array();for(let o=-1;o<=1;o++)for(let t=-1;t<=1;t++)o==0&&t==0||GGe.push(new S(o,t).normalize());var X6=class{constructor(t,e,r,i){this.valid=!0;this.pushItems=new Set;this._point=t,this.dir=e,this._dis=r,this.needContinue=i}get point(){return this._point}get dis(){return this._dis}set dis(t){this._dis=t}setNewPoint(t){this._dis+=this.point.distance1(t),this._point=t}setObstacle(t,e,r){this.needContinue=r,this.intersection(t,e)}intersection(t,e){if(e!=null){let r=new _e;r.ext2(this.point).ext1(e.bbox());let i=r.build1(),n=new M(this.point,this.point.add(this.dir.mul(i.width()+i.height()+10)));for(let s of e.primitives){let a=Tt(n,s);for(let l=0;l<a;l+=2){let c=new S(Ee[l],Ee[l+1]);t.contains(c)||(this._dis+=this.point.distance1(c),this._point=c,t.add(c))}}}}};function lX(o){let t=new Set;for(let e of GGe){let r=new X6(o,e,0,!0);t.add(r)}return t}var wF=class{constructor(t,e,r){this.valid=new Set;this.minDistance=3;this.result=null;this.found=new Ba;this.timeout=0;this.find=e,this.findRes=r,this.start=new X6(t,S.ORIGIN,0,!0)}setFail(){this.result!=null&&(this.result.valid=!1,this.result=null)}init(){if(this.start.valid){let t=this.find(this.start.point);if(t==null)this.result=this.start;else{this.start.valid=!1;let e=lX(this.start.point);for(let r of e)r.intersection(this.found,t.pl),this.valid.add(r)}}else if(this.valid.size==0){let t=lX(this.start.point);for(let e of t)e.valid=!1,this.valid.add(e)}}getDistination(t=10){if(this.init(),this.result!=null){let r=this.find(this.result.point);if(r==null)return this.result.point;this.result.setObstacle(this.found,r.pl,r.continue),this.result=null}let e=new Array;for(let r of this.valid)r.valid&&e.push(r);for(this.timeout=performance.now()+t;performance.now()<this.timeout;){this.result!=null&&this.result.needContinue&&e.push(this.result),e=e.sort((r,i)=>r.dis-i.dis),e.length>0&&(this.minDistance=e[0].dis);for(let r of this.valid){if(r.valid)continue;let i=r.point.add(r.dir.mul(this.minDistance-r.dis+1)),n=this.findRes(i,r.point);n!=null?(r.setNewPoint(n),r.valid=!0,e.push(r)):r.setNewPoint(i)}for(let r=0;r<e.length;r++){let i=e[r],n=this.find(i.point);n!=null?i.setObstacle(this.found,n.pl,n.continue):i.needContinue&&(this.result=i,e.splice(r,e.length-r))}if(e.length==0)return this.result!=null?this.result.point:this.start.point}return this.start.point}};var q6=class q6{constructor(){this.startMap=new Map;this.endMap=new Map;this.centerMap=new Map;this.lastSearch=null}static getInstance(){return q6.manager==null&&(q6.manager=new q6),q6.manager}getStartPoint(t,e,r){return this.lastSearch=this.startMap.get(t.globalIndex),this.lastSearch==null&&(this.lastSearch=new wF(t.start,e,r),this.startMap.set(t.globalIndex,this.lastSearch)),this.lastSearch.find=e,this.lastSearch.findRes=r,this.lastSearch}getEndPoint(t,e,r){return this.lastSearch=this.endMap.get(t.globalIndex),this.lastSearch==null&&(this.lastSearch=new wF(t.end,e,r),this.endMap.set(t.globalIndex,this.lastSearch)),this.lastSearch.find=e,this.lastSearch.findRes=r,this.lastSearch}getCenterPoint(t,e,r,i){return this.lastSearch=this.centerMap.get(t.globalIndex),this.lastSearch==null&&(this.lastSearch=new wF(e,r,i),this.centerMap.set(t.globalIndex,this.lastSearch)),this.lastSearch.find=r,this.lastSearch.findRes=i,this.lastSearch}checkTrack(t,e){e?(this.lastSearch=this.startMap.get(t.globalIndex),this.lastSearch!=null&&this.lastSearch.result!=null&&this.lastSearch.result.point.equals1(t.start)&&this.startMap.delete(t.globalIndex)):(this.lastSearch=this.endMap.get(t.globalIndex),this.lastSearch!=null&&this.lastSearch.result!=null&&this.lastSearch.result.point.equals1(t.end)&&this.endMap.delete(t.globalIndex))}setFail(t){let e=t.getLast(),r=this.endMap.get(e.globalIndex);r!=null&&r.setFail()}clear(){this.startMap.clear(),this.endMap.clear(),this.centerMap.clear()}};q6.manager=null;var t9=q6;var toe=class{constructor(t,e){this.manager=Os.getInstance();this.clearanceUtils=new Ep;this.block=new As;this.track=t,this.command=e}offset(){let e=t9.getInstance().getEndPoint(this.track,this.find.bind(this),this.findRes.bind(this)).getDistination();if(!e.equals1(this.track.end)){let r=xt.getInstance().getNode(this.track),i=new ri,n=r.parent,s=this.track.primitive;if(s instanceof M&&Xa(e,s.start(),s.end(),1e-4)){let a=i.createTrack(this.track.layerId,this.track.start,e,this.track.width,this.track.net,this.command,this.track.getGroupID()),l=i.createList(),c=i.addFirst(a,l,this.command),h=n.getLastNode(),u=Fr.getInstance().getStatus(h).clone();Fr.getInstance().setStatus(c,u),l.replace(h,h),this.command.addCommand(new Ti(l))}else{let a=i.createTrack(this.track.layerId,this.track.end,e,this.track.width,this.track.net,this.command,this.track.getGroupID());i.addList(a,n,this.command)}}}offsetStart(){let e=t9.getInstance().getStartPoint(this.track,this.find.bind(this),this.findRes.bind(this)).getDistination();if(!e.equals1(this.track.start)){let r=new ri,n=xt.getInstance().getNode(this.track).parent,s=this.track.primitive;if(s instanceof M&&Xa(e,s.start(),s.end(),1e-4)){let a=r.createTrack(this.track.layerId,e,this.track.end,this.track.width,this.track.net,this.command,this.track.getGroupID()),l=r.createList(),c=r.addFirst(a,l,this.command),h=n.getFirstNode(),u=Fr.getInstance().getStatus(h).clone();Fr.getInstance().setStatus(c,u),l.replace(h,h),this.command.addCommand(new Ti(l))}else{let a=r.createTrack(this.track.layerId,e,this.track.start,this.track.width,this.track.net,this.command,this.track.getGroupID());r.addFirst(a,n,this.command)}}}find(t){let r=te.getInstance().getMaxSafe(),i=this.track.width/2,n=t.bbox().extendOfSize(i+r),s=Nt.search1(n),a=_a(this.track),l=this.track.layerId;for(let c of s.tracks)if(c.layerId==l&&c.net!=this.track.net){let h=_a(c),u=this.clearanceUtils.getSafeClearance(a,h,c,c.layerId);if(ne.eq(u,0))continue;let p=this.manager.getModelObstacle(c,u+i,c.layerId).outline.getPointInOutline(t,Ts);if(p!=null)return{pl:p,continue:!0}}for(let c of s.pads)if(c.net!=this.track.net&&(c.layerId==l||c.layerId==12)){let h=_a(c);if(!c.isUnuseLayer(l)){let u=this.clearanceUtils.getSafeClearance(a,h,c,this.track.layerId);if(ne.eq(u,0))continue;let p=this.manager.getModelObstacle(c,u+i,l).outline.getPointInOutline(t,Ts);if(p!=null)return{pl:p,continue:!0}}if(c.layerId==12){h.shapeType=12;let u=this.clearanceUtils.getSafeClearance(a,h,c,this.track.layerId);if(ne.eq(u,0))continue;let p=this.manager.getModelObstacle(c,u+i,c.layerId).outline.getPointInOutline(t,Ts);if(p!=null)return{pl:p,continue:!0}}}for(let c of s.vias)if(c.net!=this.track.net&&c.isContains(l)){let h=_a(c);if(!c.isUnuseLayer(l)){let u=this.clearanceUtils.getSafeClearance(a,h,c,this.track.layerId);if(ne.eq(u,0))continue;let p=this.manager.getModelObstacle(c,u+i,l).outline.getPointInOutline(t,Ts);if(p!=null)return{pl:p,continue:!0}}if(c.layerId==12){h.shapeType=12;let u=this.clearanceUtils.getSafeClearance(a,h,c,this.track.layerId);if(ne.eq(u,0))continue;let p=this.manager.getModelObstacle(c,u+i,c.layerId).outline.getPointInOutline(t,Ts);if(p!=null)return{pl:p,continue:!0}}}for(let c of s.profiles)switch(c.type){case"TearDrop":case"Fill Region":{let u=c.net!=this.track.net,d=c.component;if(d instanceof ln&&d.isBridgingCopper){let p=d.networkList;p.length==0&&this.track.net==""||p.length==1&&this.track.net==p[0]?u=!1:u=!0}if(c.layerId==l&&u){let p=_a(c),m=this.clearanceUtils.getSafeClearance(a,p,c,this.track.layerId);if(ne.eq(m,0))continue;let y=this.manager.getModelObstacle(c,m+i,c.layerId).outline.getPointInOutline(t,Ts);if(y!=null)return{pl:y,continue:!0}}break}case"Slot Region":{let u=_a(c),d=this.clearanceUtils.getSafeClearance(a,u,c,this.track.layerId);if(ne.eq(d,0))continue;let m=this.manager.getModelObstacle(c,d+i,c.layerId).outline.getPointInOutline(t,Ts);if(m!=null)return{pl:m,continue:!0};break}case"Line":{if(c.layerId==l&&c.net!=this.track.net||c.layerId==11){let u=_a(c),d=this.clearanceUtils.getSafeClearance(a,u,c,this.track.layerId);if(ne.eq(d,0))continue;let m=this.manager.getModelObstacle(c,d+i,c.layerId).outline.getPointInOutline(t,Ts);if(m!=null)return{pl:m,continue:c.layerId!=11}}break}case"Board Outline":{let u=_a(c),d=this.clearanceUtils.getSafeClearance(a,u,c,this.track.layerId);if(ne.eq(d,0))continue;let m=this.manager.getModelObstacle(c,d+i,c.layerId).outline.getPointInOutline(t,Ts);if(m!=null)return{pl:m,continue:!1};break}case"Prohibited Region":{if(c.layerId==l||c.layerId==12){let u=c.component,d=1e-4;if(u.track){let m=this.manager.getModelObstacle(c,i+d,c.layerId).outline.getPointInOutline(t,Ts);if(m!=null)return{pl:m,continue:!0}}}break}}for(let c of s.imageTexts)if(c.layerId==l){let h=_a(c),u=this.clearanceUtils.getSafeClearance(a,h,c,this.track.layerId);if(ne.eq(u,0))continue;let p=this.manager.getModelObstacle(c,u+i,c.layerId).outline.getPointInOutline(t,Ts);if(p!=null)return{pl:p,continue:!0}}return null}findRes(t,e){let r=new M(t,e),i=this.block.blockTrackPrimitive(this.track,r,!1);return i.length>0?i[0].point:null}};function roe(){return{minDistance:Number.POSITIVE_INFINITY,start:null,end:null}}var Zu=class o{static getMinDistanceWithoutCross(t,e){let r=roe();return o.minLine(t,e,r),r.minDistance}static getMinDistance(t,e){return Tt(t,e)?0:this.getMinDistanceWithoutCross(t,e)}static getMinLineWithCross(t,e){let r=roe();return o.minLine(t,e,r),new M(r.start,r.end)}static getMinLine(t,e){return o.intersection(t,e)||this.getMinLineWithCross(t,e)}static getMinDistanceFromPoint(t,e){let r=roe();if(e instanceof M)this.point2LineMinLine(r,e,t);else if(e instanceof q)this.point2ArcMinDistance(t,e,r);else throw new Error("not support");return r.minDistance}constructor(t,e){if(this.pt1=t,this.pt2=e,this.minline=o.intersection(t,e),this.minline)this.minDistance=0;else{let r=roe();o.minLine(t,e,r),this.minline=new M(r.start,r.end),this.minDistance=r.minDistance}}getDistance(){return this.minDistance}getLine(){return this.minline}static intersection(t,e){let r=Tt(t,e);if(r===0)return;let i=new Array;for(let n=0;n<r;n+=2){let s=new S(Ee[n],Ee[n+1]);i.push(s)}return i.length>1?new M(i[0],i[1]):new M(i[0],i[0])}static minLine(t,e,r){if(t instanceof M&&e instanceof M)return this.minDistanceForLines(t,e,r);if(t instanceof q&&e instanceof M)return this.minDistanceForLineAndArc(t,e,r);if(t instanceof M&&e instanceof q)return this.minDistanceForLineAndArc(e,t,r);if(t instanceof q&&e instanceof q)return this.minDistanceForArcs(t,e,r);throw new Error("not support")}static minDistanceForLines(t,e,r){[t.start(),t.end(),e.start(),e.end()].forEach((i,n)=>{n<2?this.point2LineMinLine(r,e,i):this.point2LineMinLine(r,t,i)})}static minDistanceForLineAndArc(t,e,r){this.point2LineMinLine(r,e,t.start()),this.point2LineMinLine(r,e,t.svgEnd);let i=o.foot(e,t.center);e.bbox().extendOfSize(1e-8).isContains(i)&&this.point2ArcMinLine(r,t,i),this.point2ArcMinLine(r,t,e.start()),this.point2ArcMinLine(r,t,e.end())}static minDistanceForArcs(t,e,r){this.concentricArc(t,e,r),this.point2ArcMinDistance(e.start(),t,r),this.point2ArcMinDistance(e.svgEnd,t,r),this.point2ArcMinDistance(t.start(),e,r),this.point2ArcMinDistance(t.svgEnd,e,r),(vm(t,e.center)||vm(e,t.center))&&this.shortestLineForArcs(t,e,r)}static minLineForArcAndLine(t,e,r){let i=t.pointOn(r.angleD(t.center)),n=t.pointOn(t.center.angleD(r));this.arcShortestLine(t,e,r,i),this.arcShortestLine(t,e,r,n)}static arcInnerLineFootSegment(t,e,r){let i=r.distance1(t.center);if(i!==0){let n=t.rx*(r.y-t.center.y)/i+t.center.y,s=t.rx*(r.x-t.center.x)/i+t.center.x;i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=new S(s,n),e.end=r)}else i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=t.start(),e.end=r)}static shortestLineForArcs(t,e,r){let i=t.center.angleD(e.center),n=e.center.angleD(t.center),s=t.pointOn(i),a=t.pointOn(n),l=e.pointOn(i),c=e.pointOn(n);vm(t,s)&&(this.arcShortestLine(e,r,s,l),this.arcShortestLine(e,r,s,c)),vm(t,a)&&(this.arcShortestLine(e,r,a,l),this.arcShortestLine(e,r,a,c)),this.shortestLineForArcs1(t,e,r)}static shortestLineForArcs1(t,e,r){let i=e.start().sub(t.center).normalize(),n=e.end().sub(t.center).normalize(),s=t.start().sub(e.center).normalize(),a=t.end().sub(e.center).normalize(),l=t.center.add(i.mul(t.rx)),c=t.center.add(n.mul(t.rx)),h=e.center.add(s.mul(e.rx)),u=e.center.add(a.mul(e.rx));vm(t,l)&&ne.greater(e.start().distance2(t.center),0)&&this.arcShortestLine(t,r,e.start(),l),vm(t,c)&&ne.greater(e.end().distance2(t.center),0)&&this.arcShortestLine(t,r,e.end(),c),vm(e,h)&&ne.greater(t.start().distance2(e.center),0)&&this.arcShortestLine(e,r,t.start(),h),vm(e,u)&&ne.greater(t.end().distance2(e.center),0)&&this.arcShortestLine(e,r,t.end(),u)}static concentricArc(t,e,r){if(!(t.center.distance1(e.center)<1e-5&&t.rx===e.rx&&t.ry===e.ry))return;let i=t.start().distance1(e.svgEnd);i<r.minDistance&&(r.minDistance=i,r.start=t.start(),r.end=e.svgEnd),i=e.start().distance1(t.svgEnd),i<r.minDistance&&(r.minDistance=i,r.start=e.start(),r.end=t.svgEnd)}static point2ArcMinDistance(t,e,r){if(vm(e,t)){let i=e.pointOn(t.angleD(e.center)),n=e.pointOn(e.center.angleD(t));this.arcShortestLine(e,r,t,i),this.arcShortestLine(e,r,t,n)}else this.minLineSegment(r,e.start(),t),this.minLineSegment(r,e.svgEnd,t)}static point2ArcMinLine(t,e,r){if(vm(e,r)){let i=r.distance1(e.center);i>e.rx||i>e.ry?this.minLineForArcAndLine(e,t,r):this.arcInnerLineFootSegment(e,t,r)}}static point2LineMinLine(t,e,r){let i=o.foot(e,r);e.bbox().extendOfSize(1e-8).isContains(i)?this.minLineSegment(t,i,r):(this.minLineSegment(t,e.start(),r),this.minLineSegment(t,e.end(),r))}static minLineSegment(t,e,r){let i=e.distance1(r);i<t.minDistance&&(t.minDistance=i,t.start=e,t.end=r)}static arcShortestLine(t,e,r,i){if(!vm(t,i))return;let n=r.distance1(i);n<e.minDistance&&(e.minDistance=n,e.start=r,e.end=i)}static foot(t,e){if(t.isPoint())return t.start();if(!ne.eq(t.b,0)&&!ne.eq(t.a,0)){let r=(t.b*t.b*e.x-t.a*t.b*e.y-t.a*t.c)/(t.b*t.b+t.a*t.a),i=(-t.a*t.b*e.x+t.a*t.a*e.y-t.b*t.c)/(t.b*t.b+t.a*t.a);return new S(r,i)}else return ne.eq(t.b,0)&&!ne.eq(t.a,0)?new S(t.start().x,e.y):!ne.eq(t.b,0)&&ne.eq(t.a,0)?new S(e.x,t.start().y):e}};function vm(o,t){if(ne.eq(o.sweepAngle,360))return!0;let e=Ht.regularD(t.angleD(o.center));return o.sweepAngle>0?(ne.less(e,o.startAngle)&&(e+=360),ne.greatereq(o.endAngle(),e)):(ne.greater(e,o.startAngle)&&(e-=360),ne.lesseq(o.endAngle(),e))}var ioe=class{constructor(t,e){this.point=t,this.model=e}},LF=class extends RE{constructor(){super(...arguments);this.points=new Array}},noe=class extends On{addLast(t){return this.first===null||this.last===null?(this.first=new LF(this,t),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,t)}addFirst(t){if(this.first===null||this.last===null){let e=new LF(this,t);return this.first=e,this.last=e,this.cnt++,e}else return this.insertBefore(this.first,t)}insertAfter(t,e){let r=new LF(this,e);return t.insertAfter(r),t===this.last&&(this.last=r),this.cnt++,r}insertBefore(t,e){let r=new LF(this,e);return t.insertBefore(r),t===this.first&&(this.first=r),this.cnt++,r}};var $6=class $6{constructor(){this.map=new Map;this.ptMap=new Map}static getInstance(){return $6.manager==null&&($6.manager=new $6),$6.manager}getList(t){let e=this.map.get(t);if(e==null){let r=t.getMathGraphics();e=new noe;for(let i of r.primitives){let n=e.add(i);this.ptMap.set(i,n)}this.map.set(t,e)}return e}getNode(t){return this.ptMap.get(t)}clear(){this.map.clear(),this.ptMap.clear()}};$6.manager=null;var D0=$6;var MF=class{};var hb=class o{constructor(t,e,r,i,n,s=null){this.signalLayers=new Set;this.state=new MF;this.signalLayers=t,this.layerId=e,this.point=r,this.direct=i,this.allowModifyDirect=n,this.model=s}clone(){return new o(new Set(Array.from(this.signalLayers)),this.layerId,this.point,this.direct,this.allowModifyDirect,this.model)}};var ooe=class o{constructor(t,e,r,i,n,s,a){this.previous=null;this.next=null;this.drawing=0;this.isReverse=!1;this.startAlignMap=new Map;this.alignMap=new Map;this.net=t,this.width=e,this.layerId=r,this.direct=i,this.start=n,this.end=s,this.isReverse=a}clone(){let t=this.start.clone(),e=this.end.clone(),r=new o(this.net,this.width,this.layerId,this.direct,t,e,this.isReverse);return r.drawing=this.drawing,r}get fanout(){return this.drawing==0}};var cX=class o{constructor(t,e,r=null){this.parent=null;this.change=null;this.hasChanged=!1;this.fix=!1;this.diffpairChangeCache=null;this.direct=t,this.point=e,this.model=r}reverse(){this.direct=this.direct.mul(-1)}getNext(t){let e=new o(this.direct,t);return e.change=this.hasChanged?null:this.change,e.parent=this,e}getSameDirect(t){let e=this.point.add(this.direct.mul(t));return this.getNext(e)}getChangeNode(){if(this.change==null)return this;if(this.change.delta>0){let t=this.point.add(this.change.direct.mul(this.change.delta)),e=this.getNext(t);return e.hasChanged=!0,this.clearParentChange(),e.getSameDirect(this.change.delta)}else{let t=this.point.add(this.change.direct.mul(this.change.delta)),e=this.getNext(t);return e.hasChanged=!0,this.clearParentChange(),e}}getFanoutNode(t=0){if(this.change==null)return this;let e=Math.abs(this.change.delta),r=this.change.delta/e,i=this.point.add(this.change.direct.mul(r*(e+t))),n=this.getNext(i);return n.hasChanged=!0,this.clearParentChange(),n}markChangeForDiffpair(){this.change&&(this.diffpairChangeCache=this.change,this.change=null)}restoreChangeForDiffpair(){this.diffpairChangeCache&&(this.change=this.diffpairChangeCache,this.diffpairChangeCache=null)}clearParentChange(){let t=this;for(;t.parent!=null;)t.parent.change=null,t=t.parent}connect(){let t=new Array;t.push(this);let e=this;for(;e.parent!=null;)e=e.parent,t.push(e);return t.reverse()}clone(){return new o(this.direct,this.point)}};var NF=class o{constructor(t,e){this.restrainViaSize=!1;this.config=t,this.viaPosition=(t==null?void 0:t.viaPosition)||"currentInflectionPoint",this.radius=(t==null?void 0:t.radius)||1.2,this.inner=(t==null?void 0:t.innerRadius)||.6,this.viaName=e||""}clone(){let t=new o(this.config,this.viaName);return!this.config.radius&&this.radius&&(t.radius=this.radius),!this.config.innerRadius&&this.inner&&(t.inner=this.inner),t.restrainViaSize=!!this.restrainViaSize,t}};var lf=class o{constructor(t,e,r,i,n,s=new NF){this.previous=null;this.next=null;this.start=null;this.end=null;this.drawing=0;this.isReverse=!1;this.startAlignMap=new Map;this.alignMap=new Map;this.net=t,this.width=e,this.layerId=r,this.direct=i,this.allowModifyNet=n,this.via=s,this.preWidth=e}clone(){let t=new o(this.net,this.width,this.layerId,this.direct,this.allowModifyNet,this.via.clone());return t.drawing=this.drawing,t}getCornerNode(){let t=new cX(this.start.direct,this.start.point,this.start.model),e=new cX(this.end.direct.mul(-1),this.end.point,this.end.model),r=new ooe(this.net,this.width,this.layerId,this.direct,t,e,this.isReverse);return this.preWidth&&(r.preWidth=this.preWidth),r.drawing=this.drawing,r}};var ub=class extends MF{constructor(t,e){super(),this.state=t,this.isStart=e}};var hX=new no,soe=class{constructor(t){this.res=new Array;this.node=t,this.fanout=t.fanoutInfo}optimize(t,e){let r=this.previous!=null,i=this.next!=null;r&&i?this.optimize1(t,e):r&&!i?this.optimize2(t,e):!r&&i&&this.optimize3(t,e)}optimize1(t,e){let r=Math.abs(this.previous.fanout.delta)+Math.abs(this.next.fanout.delta),i=this.node.item.length;if(r<i){let h=hX.degree45(this.previous.fanout.direct,this.previous.node.item.start,this.node.item.end);this.res.push(h[0],h[1]);let u=hX.degree45(this.node.item.direct,h[1],this.next.node.item.end);this.res.push(...u)}else{let h=hX.degree45(this.previous.fanout.direct,this.previous.node.item.start,this.next.node.item.end);this.res.push(...h)}let n=new ri,s=this.res,a=s[0],l=s[0];i=s.length;let c=xt.getInstance().createList();for(let h=1;h<i;h++)if(l=s[h],a.distance2(l)>1e-8){let u=n.createTrack(t.layerId,a,l,this.node.item.width,t.net,e);n.addList(u,c,e),a=l}c.size()>0&&(c.replace(this.previous.node,this.next.node),e.addCommand(new Ti(c)))}optimize2(t,e){let r=hX.degree45(this.previous.fanout.direct,this.previous.node.item.start,this.node.item.end);this.res.push(...r);let i=new ri,n=this.res,s=n[0],a=n[0];length=n.length;let l=xt.getInstance().createList();for(let c=1;c<length;c++)if(a=n[c],s.distance2(a)>1e-8){let h=i.createTrack(t.layerId,s,a,this.node.item.width,t.net,e);i.addList(h,l,e),s=a}l.size()>0&&(l.replace(this.previous.node,this.node),e.addCommand(new Ti(l)))}optimize3(t,e){let r=hX.degree45(this.node.item.direct,this.node.item.start,this.next.node.item.end);this.res.push(...r);let i=new ri,n=this.res,s=n[0],a=n[0];length=n.length;let l=xt.getInstance().createList();for(let c=1;c<length;c++)if(a=n[c],s.distance2(a)>1e-8){let h=i.createTrack(t.layerId,s,a,this.node.item.width,t.net,e);i.addList(h,l,e),s=a}l.size()>0&&(l.replace(this.node,this.next.node),e.addCommand(new Ti(l)))}},y3=class{optimization(t,e,r){let i=t.listIterator(),n=new Array;for(;i.hasNext();){let l=i.next(),c=new soe(l);n.push(c)}let s=new Array,a=n.length;for(let l=0;l<a;l++){let c=n[l].fanout;c!=null?c.delta>0?l+1<a&&(n[l+1].previous=n[l]):c.delta==0?s.push(n[l]):l-1>=0&&(n[l-1].next=n[l]):s.push(n[l])}for(let l of s)l.optimize(e,r)}optimizaNodes(t,e,r){let i=new Array;for(let a of t){let l=new soe(a);i.push(l)}let n=new Array,s=i.length;for(let a=0;a<s;a++){let l=i[a].fanout;l!=null?l.delta>0?a+1<s&&(i[a+1].previous=i[a]):l.delta==0?n.push(i[a]):a-1>=0&&(i[a-1].next=i[a]):n.push(i[a])}for(let a of n)a.optimize(e,r)}};var l_=class o{constructor(t){this.stack=new Array;this.group=0;this.i=0;this.debug=!0;this.pause=!1;this.item=null;this.group=t}add(t){if(this.debug){if(this.item!=null){let e=this.stack.length;if(!t.equals(this.item.stack[e]))debugger}this.stack.push(t)}}play(){this.isEnd()&&(this.i=0),this.stack[this.i].display(),ie.publish("updateFrame",""),this.i++}setCompateItem(t){this.item=t}isStart(){return this.i==0}isEnd(){return this.i==this.stack.length}init(){for(let t of this.stack)t.remove();this.i=0}clear(){for(let t of this.stack)t.remove();ie.publish("updateFrame","")}equals(t){if(t instanceof o&&this.stack.length==t.stack.length){let e=this.stack.length;for(let r=0;r<e;r++)if(!this.stack[r].equals(t.stack[r]))return!1;return!0}return!1}};var Bh=class{display(){}remove(){}};var Kd=class o extends Bh{constructor(t){super(),this.line2=t}display(){for(let t of this.line2)t.display();ie.publish("updateFrame","")}remove(){for(let t of this.line2)t.remove()}equals(t){if(t instanceof o){let e=t.line2.length;if(this.line2.length==e){for(let r=0;r<e;r++)if(!this.line2[r].equals(t.line2[r]))return!1;return!0}}return!1}};var kF=class{constructor(t,e=16){this.point=t,this.size=e}isSelect(t,e){let r=this.point,i=this.size;return new _e().ext6(r.x,r.y).ext7(i/2).build1().isIntersect(new ut(t,t,e,e))}isSelectScale(t,e,r){let i=this.point,n=this.size;return new _e().ext6(i.x,i.y).ext7(n/2/r).build1().extendOfSize(1/r).isIntersect(new ut(t,t,e,e))}};var qi=class extends ME{constructor(e,r,i=!1,n=ee.build(.28,1.8,.3,1)){super();this._select=!1;this.viewGroupId="";this.globalIndex=su(),this._layerId=e,this._point=r,this._isTriangle=i,this._color=n,this._state="Only Main",this.shapeModified=!0,this.colorModified=!0,this.refreshRender()}get shapeModified(){return this.hasDataState(5)}set shapeModified(e){this.setDataState(5,e)}get color(){return this._color}set color(e){var r;(r=this._color)!=null&&r.equals(e)||(this._color=e,this.colorModified=!0,this.refreshRender())}get x(){return this._point.x}get y(){return this._point.y}get layerId(){return this._layerId}get position(){return this._point}get isTriangle(){return this._isTriangle}get highLightType(){return null}get highlightColor(){return ee.BLACK}get colorModified(){return this.hasDataState(7)}set colorModified(e){this.setDataState(7,e)}getType(){return 31}refreshRender(){Do.attach(this,this.getType())}getViewState(){return this._state}getRenderData(){return this}get manualHighLight(){return x.getInstance().forceDeactive}remove(){this._state="Not Shown",this.shapeModified=!0,this.refreshRender()}hidden(){this._state="Not Shown",this.shapeModified=!0,this.refreshRender()}visible(){this._state="Only Main",this.shapeModified=!0,this.refreshRender()}click(){this._state="Main And Highlight",this.shapeModified=!0,this.refreshRender()}setPosition(e){var r;return(r=this._point)!=null&&r.equals(e)||(this._point=e,this.shapeModified=!0,this.refreshRender()),this}getPosition(){return this._point}status(){return this._select}setStatus(e){this._select=!1}transform(e){this.setPosition(this._point.multiply4(e))}isSelect(e,r){let i=Ni().getScale(),n=new kF(this._point);return this._select=n.isSelectScale(e,r,i)}isSelectWidth(e,r,i){let n=new S(e,r),s=Ni().getScale(),a=new kF(this._point);return this._select=this._point.distance2(n)<=i*i/4||a.isSelectScale(e,r,s)}getDistance(e,r){let i=new S(e,r);return this._point.distance2(i)}inTop(e,r){let i=Ni().getScale();return new kF(this._point).isSelectScale(e,r,i)}resetModelNotify(){this._dataState=0}};var ns=class o{constructor(t,e,r,i,n,s,a){this.globalIndex=su();this.state="Only Main";this._color=null;this.viewGroupId="";this._color=a,this._layerId=t,this._center=e,this._radius=r,this._startAngle=i,this._endAngle=n,this._sweep=s,this.refreshRender()}static build(t,e,r,i,n,s,a=ee.BLACK){return new o(t,e,r,i,n,s,a)}get layerId(){return this._layerId}set layerId(t){this._layerId=t,this.refreshRender()}get center(){return this._center}set center(t){this._center=t,this.refreshRender()}get radius(){return this._radius}set radius(t){this._radius=t,this.refreshRender()}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=t,this.refreshRender()}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=t,this.refreshRender()}get sweep(){return this._sweep}set sweep(t){this._sweep=t,this.refreshRender()}get isSolid(){return this._isSolid}set isSolid(t){this._isSolid!=t&&(this._isSolid=!0,this.refreshRender())}get color(){return this._color}set color(t){this._color=t,this.refreshRender()}get width(){return 0}set width(t){}get length(){return Math.abs(this.radius*(this.endAngle-this.startAngle)*Math.PI/Math.PI)}get isEmpty(){return!1}get start(){return this.center.add(new S(Math.cos(this.startAngle),Math.sin(this.startAngle)).mul(this.radius))}set start(t){this._startAngle=Z4.fixStartAngle(t.angle(this.center),this.radius,this.endAngle,this.sweep),this.refreshRender()}get end(){return this.center.add(new S(Math.cos(this.endAngle),Math.sin(this.endAngle)).mul(this.radius))}set end(t){this._endAngle=Z4.fixEndAngle(t.angle(this.center),this.radius,this.startAngle,this.sweep),this.refreshRender()}visible(){this.state="Only Main",this.refreshRender()}click(){this.state="Main And Highlight",this.refreshRender()}remove(){this.state="Not Shown",this.refreshRender()}getType(){return 33}refreshRender(){Do.attach(this,this.getType())}getViewState(){return this.state}getRenderData(){var d,p;let t=(p=(d=ce)==null?void 0:d.themeConfig)==null?void 0:p.canvasTheme,e=ee.BLACK;if(t){let m=t.hoverHighlightColor,g=t.hoverHighlightTransparency;e=ee.build(m.r,m.g,m.b,1-g)}let{layerId:r,center:i,radius:n,startAngle:s,endAngle:a,sweep:l,width:c,length:h,color:u}=this;return{layerId:r,center:i,radius:n,startAngle:s,endAngle:a,sweep:l,width:c,length:h,color:u,modelType:"Arc",layerModified:!0,shapeModified:!0,highLightByHover:!1,highLightBySelect:!1,isHighLight:!1,lineColor:u,lineSolid:!0,isPixel:!1,highLightType:null,highlightColor:e}}getMathGraphics(){return q.build2(this.center,this.startAngle,this.endAngle,this.radius,this.radius,this.sweep).stroke(this.width,kr.ROUND,le.CW)}hidden(){this.state="Not Shown",this.refreshRender()}buildBBox(){return q.build2(this.center,this.startAngle,this.endAngle,this.radius,this.radius,this.sweep).bbox()}getAngle(){return this.sweep==le.CCW?(this.endAngle-this.startAngle+yp)%yp:(this.startAngle-this.endAngle+yp)%yp}};var eo=class o extends Bh{constructor(e,r){super();this.color=null;this.layerId=1002;this.shapes=new Array;this.line=e,this.info=r,this.color=r.color,this.layerId=1002}display(){if(this.line instanceof q){let e=ns.build(this.layerId,this.line.center,this.line.rx,mh(this.line.startAngle),mh(this.line.endAngle()),this.line.sweep(),this.color||ee.BLACK),r=Ot(this.line),i=this.line.end().sub(r.rotate(S.ORIGIN,Tu/4).mul(1.5)),n=new hr(this.layerId,this.line.end(),i,!0,this.color||ee.BLACK);this.shapes.push(e,n);return}if(this.line.isPoint())this.shapes.push(new qi(this.layerId,this.line.start(),null,this.color||ee.BLACK));else{let e=new hr(this.layerId,this.line.start(),this.line.end(),!1,this.color||ee.BLACK),r=this.line.end().sub(this.line.direct.rotate(S.ORIGIN,Tu/4).mul(1.5)),i=new hr(this.layerId,this.line.end(),r,!0,this.color||ee.BLACK);this.shapes.push(e,i)}}remove(){for(let e of this.shapes)e.remove();this.shapes.length=0}equals(e){return e instanceof o?this.line.equals1(e.line):!1}};var uD=class o extends Ge{constructor(e,r){super(e);this.isBase=!0;super.color=r,this.sendDeleteMsg=!1}static build(e,r,i,n,s,a){let l=new Gg(su(),0,"",1,2,[],"",r,e,i,2,n,s,!1);return new o(l,a)}get color(){return super.color}set color(e){super.color=e,this.refreshRender()}get net(){return this.model.net}set net(e){this.model.net!=e&&(this.model.net=e,this.refreshRender())}setBBoxModify(){}setLayerModify(e){}};var aoe=class extends Bh{constructor(e,r,i){super();this.color=null;this.layerId=1002;this.shapes=new Array;this.center=e,this.radius=r,this.info=i,this.color=i.color,this.layerId=1002}display(){this.shapes.push(uD.build(this.center,this.radius,this.radius/2,0,0,this.color||ee.BLACK))}remove(){for(let e of this.shapes)e.remove();this.shapes.length=0}};var c_=class extends Bh{constructor(e,r){super();this.vias=new Array;this.line2=new Array;this.radius=e,this.info=r}addCenter(e){let r=new aoe(e,this.radius,this.info);this.vias.push(r)}display(){let e=null;for(let r of this.vias){if(e!=null){let i=new eo(new M(e.center,r.center),this.info);this.line2.push(i),i.display()}r.display(),e=r}ie.publish("updateFrame","")}remove(){for(let e of this.vias)e.remove();for(let e of this.line2)e.remove()}};var r9e=class{constructor(){this.stack=new Array;this.cloneStack=new Array;this.compare=!1;this.debugs=new Array;this.debugs1=new Array;this.lines=[];this.action="print";this.timeout=0;this.i=0;this.position=null;this.replay=!1;this.debug=!0;this.pause=!1;this.single=!1;this.level="STRONG";this.resultIndex=0}setLevel(t){switch(t){case 0:{this.level="NONE";break}case 1:{this.level="WEAK";break}case 2:{this.level="STRONG";break}case 3:{this.level="SUPER";break}}}init(){this.clear(),this.stack.length=0,this.lines.length=0,this.action="print",this.timeout=0,this.i=0,this.resultIndex=0}setCompare(){this.compare=!0,this.cloneStack=this.stack,this.stack=[]}setPosition(t,e){this.position=new S(t,e)}input(t){if(this.debug){if(this.compare&&t instanceof l_){let e=this.stack.length;t.setCompateItem(this.cloneStack[e])}this.stack.push(t)}}inputDebugGraphics(t){if(this.debug){if(this.compare&&t instanceof Kd){let e=this.stack.length;if(!t.equals(this.cloneStack[e]))debugger}this.stack.push(t)}}inputGraphics(t,e){this.debug&&this.stack.push({primitive:t,net:e})}inputAction(t,e){this.debug&&this.stack.push({action:t,timeout:e})}inputClear(){if(this.debug){let t=this.stack[this.stack.length-1];if(t!=null&&t.action!=null&&t.action=="clear")return;this.inputAction("clear",100)}}compareDisplay(t){this.compare&&(this.display(t),this.displayClone(t))}play(){return;for(let i=0;i<t;i++){let n=this.stack[i];switch(n.action!=null&&(e=n.action,r=n.timeout),e){case"await":{this.await(r);break}case"clear":{this.clear();break}case"print":{n.primitive!=null&&this.displayPrimitive(n.primitive,n.net);break}}}}play4Next(){if(this.single)return;let t=this.stack[this.i];if(t instanceof l_){t.isStart()&&this.debugs.push(t),t.play(),t.isEnd()&&this.i++;return}switch(t.action!=null?(this.action=t.action,this.timeout=t.timeout):this.action="print",this.action){case"await":{this.await(this.timeout);break}case"clear":{this.clear();break}case"print":{t instanceof Bh?(t.display(),this.debugs1.push(t)):t.primitive!=null&&this.displayPrimitive(t.primitive,t.net);break}}this.i++,this.i>=this.stack.length&&(this.i=0,this.clear()),ie.publish("updateFrame","")}displayPrimitive(t,e){let r=dP([t],2);for(let i of r)this.lines.push({l:i,net:e})}await(t){let e=performance.now()+t;for(;performance.now()<e;);}clearAction(){console.log("await clear")}clear(){for(let t of this.lines)t.l.remove();this.lines.length=0;for(let t of this.debugs)t.clear();this.debugs.length=0;for(let t of this.debugs1)t.remove();this.debugs1.length=0}singlePause(){this.pause=!0,this.single=!0}exitPause(){this.pause=!1,this.single=!1}display(t){let e=this.stack[t];if(e instanceof l_){e.isStart()&&this.debugs.push(e),e.play();return}switch(e.action!=null?(this.action=e.action,this.timeout=e.timeout):this.action="print",this.action){case"await":{this.await(this.timeout);break}case"clear":{this.clear();break}case"print":{e instanceof Bh?(e.display(),this.debugs1.push(e)):e.primitive!=null&&this.displayPrimitive(e.primitive,e.net);break}}ie.publish("updateFrame","")}displayClone(t){let e=this.cloneStack[t];if(e instanceof l_){e.isStart()&&this.debugs.push(e),e.play();return}switch(e.action!=null?(this.action=e.action,this.timeout=e.timeout):this.action="print",this.action){case"await":{this.await(this.timeout);break}case"clear":{this.clear();break}case"print":{e instanceof Bh?(e.display(),this.debugs1.push(e)):e.primitive!=null&&this.displayPrimitive(e.primitive,e.net);break}}ie.publish("updateFrame","")}displayRange(t,e,r=3){for(let i=t;i<=e;i+=r)this.display(i)}next(){for(;this.resultIndex<this.stack.length;this.resultIndex++){let t=this.stack[this.resultIndex];if(t instanceof Kd||t instanceof c_){this.display(this.resultIndex),this.resultIndex++;break}}this.resultIndex>=this.stack.length&&(this.resultIndex=0)}prev(){for(;this.resultIndex>0;this.resultIndex--){let t=this.stack[this.resultIndex];if(t instanceof Kd||t instanceof c_){this.display(this.resultIndex),this.resultIndex--;break}}this.resultIndex<0&&(this.resultIndex=0)}},Yr=new r9e;Window.ShoveDebug=Yr;var BF=class o extends Bh{constructor(e,r,i){super();this.result=new Array;this.shapes=new Array;this.line1=e,this.line2=r,this.result=i}display(){this.line1.display();for(let e of this.line2)e.display();for(let e of this.result)this.shapes.push(new qi(1002,e,!0))}remove(){this.line1.remove();for(let e of this.line2)e.remove();for(let e of this.shapes)e.remove();this.shapes.length=0}equals(e){if(e instanceof o&&this.line2.length==e.line2.length&&this.line1.equals(e.line1)){let r=this.line2.length;for(let i=0;i<r;i++)if(!this.line2[i].equals(e.line2[i]))return!1;return!0}return!1}};var loe=class extends lD{constructor(){super(...arguments);this.manager1=D0.getInstance()}check(e,r,i,n){let s=e.primitive,a=this.manager1.getList(r),l=n;if(Yr.debug){let c=new eo(s,{color:ee.BLUE}),h=new Array,u=a.iterator();for(;u.hasNext();){let d=u.next(),p=new eo(new M(d.start(),d.end()),{color:ee.Gray});h.push(p)}if(this.debug1!=null){let d=new BF(c,h,[]);this.debug1.add(d)}}return this.collideConstraint(s,e,a,l)}collideConstraint(e,r,i,n){let s=e,a=s.bbox(),l=i.listIterator();for(;l.hasNext();){let c=l.next(),h=c.item;if(h instanceof M&&h.length()<1e-8)continue;let u=h.bbox().extendOfSize(n);if(!a.isIntersect(u))continue;let d=s.bbox(),p=h.bbox();d.isIntersect(p)&&this.collidePrimitve(s,c,r)}}collidePrimitve(e,r,i){let n=r.item,s=e.bbox(),a=n.bbox();if(!s.isIntersect(a))return;let l=Tt(e,n);for(let c=0;c<l;c+=2){let h=new S(Ee[c],Ee[c+1]),u=new ioe(h,i);r.points.push(u)}}};var coe=class extends cD{constructor(){super(...arguments);this.manager1=D0.getInstance()}check(e,r,i,n,s=!1){if(i.layerId!=r.layerId&&s&&i.layerId!=12)return!1;let a=this.manager1.getList(i),l=r.width/2+n;return!!this.checkPrimitives(e,a.toArray(),l)}checkPrimitives(e,r,i){if(r==null)return!1;let n=e.bbox().extendOfSize(i);for(let s of r){if(s instanceof M&&s.length()<1e-8)continue;let a=s.bbox();if(n.isIntersect(a)){let l=new ir(e,s).getDistance();if(this.kit.less(l,i))return!0}}return!1}};var hoe=class{constructor(t){this.check=new coe;this.block=new loe;this.utils=new Ep;this.debug=t}search1(t){let e=[],r=Vt.search4Types(t,["Polygon","Rect","Circle"]);for(let i of r.getResult(S0)){let n=i.model;n instanceof lr&&n.type=="Constraint Region"&&e.push(n)}return e}blockTrack(t,e){this.block.debug1=this.debug;let r=e.bbox().extendOfSize(0),i=this.search1(r),n=new Set;for(let s of i){if(!this.utils.isValid4Model(t,s))continue;this.check.check(e,t,s,0,!0)&&(this.block.check(t,s,t.layerId,0),n.add(s))}return Array.from(n)}blockTrackProfile(t,e,r){this.block.debug1=this.debug,this.check.check(e,t,r,0)&&this.block.check(t,r,t.layerId,0)}};var uC=class o{constructor(t,e,r,i,n){this.lastDirect=t,this.start=e,this.end=r,this.width=i,this.nextDirect=n}static build(t,e){return new o(t.start.direct,t.start.point,e,t.width,t.direct)}static build1(t,e,r){return new o(t.direct,t.point,r,e.width,e.direct)}static build2(t,e){return new o(t.start.direct,t.start.point,e,t.width,t.direct)}modifyStart(t){return new o(this.lastDirect,t,this.end,this.width,this.nextDirect)}modifyEnd(t){return new o(this.lastDirect,this.start,t,this.width,this.nextDirect)}modifyNextDirect(t){return new o(this.lastDirect,this.start,this.end,this.width,t)}};function FT(o,t,e){let r=e.sub(t),n=o.cross(r)>0?le.CCW:le.CW,s=o.dot(r)>0,a=Math.abs(o.cross(r));return{sweep:n,isRight:s,dis:a}}function dC(o,t,e){let r=zg(e,t),i=o+r*2,n=t*2;return{delta:r,edgeLength:i,dis2:n,min:o,angle:e}}var h_=class o{constructor(t,e,r){this.node=e,this.edgeParam=r,this.directInfo=t}static build(t,e,r,i,n){let s=FT(t.start.direct,t.start.point,e),a=dC(n,i,r/2),l=uC.build(t,e);return new o(l,s,a)}static build1(t,e,r,i){let n=FT(t.lastDirect,t.start,t.end),s=dC(i,r,e/2);return new o(t,n,s)}modifyStart(t){this.directInfo=this.directInfo.modifyStart(t),this.node=FT(this.directInfo.lastDirect,this.directInfo.start,this.directInfo.end)}modifyEnd(t){this.directInfo=this.directInfo.modifyEnd(t),this.node=FT(this.directInfo.lastDirect,this.directInfo.start,t)}modifyMin(t){this.edgeParam=dC(t,this.edgeParam.dis2/2,this.edgeParam.angle)}modifyNextDirect(t){this.directInfo=this.directInfo.modifyNextDirect(t)}clone(t,e,r){let i=FT(this.directInfo.lastDirect,t,e),n=dC(this.edgeParam.min,r,this.edgeParam.angle),s=new uC(this.directInfo.lastDirect,t,e,this.directInfo.width,this.directInfo.nextDirect);return new o(s,i,n)}},pP=class o{constructor(t,e,r){this.node=e,this.edgeParam=r,this.directInfo=t}static build1(t,e,r,i){let n=FT(t.start.direct,t.start.point,t.end.point),s=dC(i,r,e/2);return new o(t,n,s)}static build2(t,e,r,i){let n=FT(t.end.direct,t.end.point,t.start.point),s=dC(i,r,e/2);return new o(t,n,s)}};var cf=class o{constructor(){this.tool=new no}alignAngle(t,e,r,i=null,n=0,s){let a=n||na.getInstance().trackMinCorner*t.width||.01;switch(i){case 45:{let l=this.tool.degree45(t.nextDirect,t.start,t.end);return this.align(t,e,r,a,l,s)}case 90:{let l=this.tool.degree90(t.nextDirect,t.start,t.end);return this.align(t,e,r,a,l)}default:return this.align(t,e,r,a,[t.start,t.end])}}align(t,e,r,i,n,s){if(ne.eq(t.end.sub(t.start).cross(t.lastDirect),0)&&e===Math.PI/2){let O=t.end,_=[t.start,t.end],R=FT(t.lastDirect,O,t.end),v=dC(i,r,e/2),D=new uC(t.lastDirect,O,t.end,t.width,t.lastDirect),w=new h_(D,R,v);return{path:_,tool:w}}let a=t.lastDirect,l=t.nextDirect,c=ia(l,n),u=(a.angle(S.ORIGIN)+Math.PI*2)%(Math.PI*2)/e,d=Math.round(u)*e,p=S.getVector2(d);if(ne.greatereq(a.dot(p),1))return{path:[],tool:h_.build1(t,e,r,i)};let m=Math.floor(u)*e,g=Math.ceil(u)*e,y=S.getVector2(m),b=S.getVector2(g),P=Math.acos(c[0].dot(y)),T=Math.acos(c[0].dot(b)),I=y;P>T&&(I=b);let C=a.dot(I),E=Math.acos(C)/2;if(ne.eq(E,0))return{path:[],tool:h_.build1(t,e,r,i)};{if(s){let z=zSe(a,I);r=s(z)}let O=zg(E,r),_=t.start.add(a.mul(O)),R=_.add(I.mul(O+i)),v=[t.start,_,R],D=FT(I,R,t.end),w=dC(i,r,e/2),F=new uC(I,R,t.end,t.width,t.nextDirect),H=new h_(F,D,w);return{path:v,tool:H}}}alignAngle_v1(t,e,r,i,n=null,s){switch(n){case 45:{let a=this.tool.degree45(t.direct,t.start.point,t.end.point);return this.align_v1(t,e,r,i,a,s)}case 90:{let a=this.tool.degree90(t.direct,t.start.point,t.end.point);return this.align_v1(t,e,r,i,a)}default:return this.align_v1(t,e,r,i,[t.start.point,t.end.point])}}alignAngle_v2(t,e,r,i,n=null){switch(n){case 45:{let s=this.tool.degree45(t.direct,t.end.point,t.start.point);return this.align_v2(t,e,r,i,s)}case 90:{let s=this.tool.degree90(t.direct,t.end.point,t.start.point);return this.align_v2(t,e,r,i,s)}default:return this.align_v2(t,e,r,i,[t.start.point,t.end.point])}}align_v1(t,e,r,i,n,s){if(ne.eq(t.end.point.sub(t.start.point).cross(t.start.direct),0)&&e===Math.PI/2){let O=t.start.getNext(t.end.point);O.direct=t.start.direct,t.start=O;let _=FT(t.start.direct,t.end.point,t.end.point),R=dC(i,r,e/2);return new pP(t,_,R)}let a=t.start.direct,l=t.direct,c=ia(l,n),u=(a.angle(S.ORIGIN)+Math.PI*2)%(Math.PI*2)/e,d=Math.round(u)*e,p=S.getVector2(d);if(ne.greatereq(a.dot(p),1)){if(t.end.point.equals1(t.start.point)){let O=t.start.getNext(t.end.point);O.direct=l,t.start=O}return pP.build1(t,e,r,i)}let m=Math.floor(u)*e,g=Math.ceil(u)*e,y=S.getVector2(m),b=S.getVector2(g),P=Math.acos(c[0].dot(y)),T=Math.acos(c[0].dot(b)),I=y;P>T&&(I=b);let C=a.dot(I),E=Math.acos(C)/2;if(ne.eq(E,0))return pP.build1(t,e,r,i);{if(s){let z=zSe(a,I);r=s(z)}let O=zg(E,r),_=t.start.point.add(a.mul(O)),R=_.add(I.mul(O+i)),D=t.start.getNext(_).getNext(R);D.direct=I,t.start=D;let w=FT(I,R,t.end.point),F=dC(i,r,e/2);return new pP(t,w,F)}}align_v2(t,e,r,i,n){if(t.end.point.equals1(t.start.point)&&e===Math.PI/2)return pP.build2(t,e,r,i);let s=t.end.direct,a=t.direct,l=ia(a,n),h=(s.angle(S.ORIGIN)+Math.PI*2)%(Math.PI*2)/e,u=Math.round(h)*e,d=S.getVector2(u);if(ne.greatereq(s.dot(d),1))return pP.build2(t,e,r,i);let p=Math.floor(h)*e,m=Math.ceil(h)*e,g=S.getVector2(p),y=S.getVector2(m),b=Math.acos(l[0].dot(g)),P=Math.acos(l[0].dot(y)),T=g;b>P&&(T=y);let I=s.dot(T),C=Math.acos(I)/2;if(ne.eq(C,0))return pP.build2(t,e,r,i);{let E=zg(C,r),O=t.end.point.add(s.mul(E)),_=O.add(T.mul(E+i)),v=t.end.getNext(O).getNext(_);v.direct=T,t.end=v;let D=FT(T,_,t.start.point),w=dC(i,r,e/2);return new pP(t,D,w)}}static alignStart(t){let e=t.node,r=e.start.point,i=e.start.direct;i=new S(i.y,-i.x);let n=e.previous,s=e.next,a=e,l=e,c=0,h=0;for(;n!=null||s!=null;)n!=null&&(c=c-(a.width/2+n.width+n.previous.width/2),a=n.previous,n=a.previous,a.start.isEmpty||(a.start.point=r.add(i.mul(c)))),s!=null&&(h=h+(l.width/2+s.width+s.next.width/2),l=s.next,s=l.next,l.start.isEmpty||(l.start.point=r.add(i.mul(h))))}static fixEnd(t,e,r,i){let n=t.tracks.length,s=o.getDistance(t),a=o.getDistance(e),l=Math.floor(n/2),c=t.tracks.indexOf(t.node),h;return c>=l?h=new S(i.y,-i.x):h=new S(-i.y,i.x),r.add(h.mul(a-s))}static getDistance(t,e=t.node){let r=t.tracks.length,i=Math.floor(r/2),n=t.tracks.indexOf(e);if(r%2==0)if(n>=i){let s=t.tracks[i].previous.width/2+t.tracks[i].width;for(let a=i+1;a<=n;a++){let l=t.tracks[a];s+=l.previous.width,s+=l.width}return s-=e.width/2,s}else{let s=t.tracks[i-1].next.width/2+t.tracks[i-1].width;for(let a=i-2;a>=n;a--){let l=t.tracks[a];s+=l.next.width,s+=l.width}return s-=e.width/2,s}else if(n>=i){let s=t.tracks[i].width/2;for(let a=i+1;a<=n;a++){let l=t.tracks[a];s+=l.previous.width,s+=l.width}return s-=e.width/2,s}else{let s=t.tracks[i].width/2;for(let a=i-1;a>=n;a--){let l=t.tracks[a];s+=l.next.width,s+=l.width}return s-=e.width/2,s}}static alignEnd(t,e=!0){let r=t.node,i=e?r.end.point:r.start.point,n=e?r.end.direct:r.start.direct;n=new S(n.y,-n.x);let s=r.previous,a=r.next,l=r,c=r,h=0,u=0;for(;s!=null||a!=null;)s!=null&&(h=h-(l.width/2+s.width+s.previous.width/2),l=s.previous,s=l.previous,e?l.end.point=i.add(n.mul(h)):l.start.point=i.add(n.mul(h))),a!=null&&(u=u+(c.width/2+a.width+a.next.width/2),c=a.next,a=c.next,e?c.end.point=i.add(n.mul(u)):c.start.point=i.add(n.mul(u)))}static project4Direct(t){let e=t.tracks.length,r=Math.floor(e/2);if(e%2===0){let i=t.tracks[r-1].end.point.add(t.tracks[r].end.point).mul(.5),n=t.tracks[r-1].width/2+t.tracks[r-1].next.width/2,s=t.tracks[r-1].end.direct;t.tracks[r-1].end.isEmpty&&(t.tracks[r-1].end.point=i.add(new S(s.y,-s.x).mul(n))),t.node=t.tracks[r-1]}else t.node=t.tracks[r]}static isAlign(t,e=!1,r){let i;if(r)i=r;else{let s=Number.MIN_SAFE_INTEGER;for(let a of t){let l=e?a.start:a.end,c=l.point.dot(l.direct);c>=s&&(s=c,i=l.point)}}let n=0;for(let s=0;s<t.length;s++){let a=t[s],l=e?a.start:a.end,h=i.sub(l.point).dot(l.direct);ne.eq(h,0)&&n++}return r&&n++,n==t.length}static alignPoints(t,e=!1,r){let i;if(r)i=r;else{let n=Number.MIN_SAFE_INTEGER;for(let s of t){let a=e?s.start:s.end,l=a.point.dot(a.direct);l>=n&&(n=l,i=a.point)}}for(let n=0,s=t.length;n<s;n++){let a=t[n],l=e?a.start:a.end,h=i.sub(l.point).dot(l.direct);ne.greater(h,0)&&(l.point=l.point.add(l.direct.mul(h)))}}};var FF=class o extends Bh{constructor(e,r,i){super();this.result=new Array;this.shapes=new Array;this.line1=e,this.line2=r;for(let n=0;n<i;n+=2)this.result.push(new S(Ee[n],Ee[n+1]))}display(){this.line1.display(),this.line2.display();for(let e of this.result)this.shapes.push(new qi(1002,e))}remove(){this.line1.remove(),this.line2.remove();for(let e of this.shapes)e.remove();this.shapes.length=0}equals(e){return e instanceof o?this.line1.equals(e.line1)&&this.line2.equals(e.line2):!1}};var uoe=class{constructor(t){this.selections=new Array;this.start=t,this.layerId=$e.getInstance().activeLayer,this.createBox(this.layerId,t.x,t.y)}moveTo(t,e){this.layerId!==$e.getInstance().activeLayer&&(this.clear(),this.layerId=$e.getInstance().activeLayer,this.createBox(this.layerId,t,e)),this.selections[0].start=new S(this.start.x,this.start.y),this.selections[0].end=new S(t,this.start.y),this.selections[1].start=new S(t,this.start.y),this.selections[1].end=new S(t,e),this.selections[2].start=new S(t,e),this.selections[2].end=new S(this.start.x,e),this.selections[3].start=new S(this.start.x,e),this.selections[3].end=new S(this.start.x,this.start.y)}clear(){for(let t of this.selections)t.remove();this.selections.length=0}createBox(t,e,r){let i=new hr(t,new S(this.start.x,this.start.y),new S(e,this.start.y),!1),n=new hr(t,new S(e,this.start.y),new S(e,r),!1),s=new hr(t,new S(e,r),new S(this.start.x,r),!1),a=new hr(t,new S(this.start.x,r),new S(this.start.x,this.start.y),!1);this.selections.push(i),this.selections.push(n),this.selections.push(s),this.selections.push(a)}};var pC=class o{constructor(t){this.previous=null;this.next=null;this.width=t,this.preWidth=t}clone(){return new o(this.width)}};var u_=class{constructor(t){this.needComplete=(t,e)=>{let r=e.map(l=>l instanceof yt?l.end:l instanceof It||l instanceof Je?l.center:null).filter(Boolean),i=r[0],s=r[1].sub(i).normalize(),a=.1;for(let l=2;l<r.length;l++){let h=r[l].sub(i);if(Math.abs(s.cross(h))>a)return!0}return!1};this.event=t}sortVectors(t){if(t.length<=1)return t;let e=(n,s)=>s.some(a=>a.equals(n)),r=[],i=t[0];r.push(i);for(let n=1;n<t.length;n++)e(t[n],r)||(r.push(t[n]),i=t[n]);return r}getRoutes(t){let e=Un.getInstance();if(t.lastMode=="Single wiring"&&t.wire!=="Single wiring"){let r=[],i=e.current.tracks,n=this.alignEnd(e.current.node),s=this.sortVectors(e.getSingleEvents().flatMap(l=>[l.start,l.end])),a=fe.build4(s);for(let l=0;l<i.length;l++){let c=i[l];if(c!==e.current.node){let[h,u]=n.get(c),d=fe.build7(this.getPath(c.end.point,h,a.primitives,u));r.push(d)}else a&&r.push(a)}return r}}getStartRoutes(t,e,r){var a;let i=e.start.model,n=[i.primitive];if(!r){let l=Array.from((a=pr.getItem(i.globalIndex))==null?void 0:a.searchAllConnectNode1());l.length>0&&(n=l.flatMap(c=>gc.getInstance().has(c.globalIndex)?null:c.primitive).filter(Boolean))}let s=[];for(let l of t){let c=l.start.model,h;if(c instanceof yt?h=c.end:h=c.center,l!==e){let u;if(r){let d=c.primitive,p=ir.foot(new M(d.start(),d.end()),n[0].start()),m=this.getPath(p,n[0].end(),n).flatMap(g=>g.points(.1));m.unshift(h,p),u=fe.build4(m)}else u=fe.build7(this.getPath(h,i.end,n));s.push(u)}else s.push(fe.build4([h,h]))}return s}getDiffStartRoutes(){let t=this.event.node,e=this.event.tracks.find(a=>a!==this.event.node),r=t.start.point,i=e.start.point,n=t.width+this.event.gaps[0].width,s=(a,l)=>{let c=[];if(a.length&&l.length)for(let h of this.event.tracks){if(h==t){c.push(fe.build7(a));continue}c.push(fe.build7(l))}return c};if(ne.greater(r.distance1(i),n)){let a=t.start.model,l=e.start.model;if(a instanceof qr&&l instanceof qr){let c=xt.getInstance().getListNode(a).parent.getAllItems().map(g=>g.primitive),h=xt.getInstance().getListNode(l).parent.getAllItems().map(g=>g.primitive);if(Math.abs(r.distance1(i)-n)<.001)return;let u=this.getPath(r,i,h,n),d=this.getPath(i,r,c,n),p=u.length,m=d.length;if(p>0&&m>0){let g=u[p-1].end(),y=d[m-1].end();if(g.distance2(i)>y.distance2(r)){let b=s(c,d),P=Ot(d[d.length-1])||e.start.direct;return[b,P]}}}}}getPls(t,e,r=!1){let i=[],n=e.getPoints(1).length>0;for(let s of t.tracks){let a;if(s==t.node&&n){n&&i.push(e);continue}r?a=[s.start.point,s.start.point.add(s.start.direct.mul(1e-8))]:a=[s.end.point,s.end.point.add(t.node.direct.mul(1e-8))],a.length>0&&i.push(fe.build4(a))}return i}checkIsSingle(t){let e=t.result.wireMap;return e.size==1?!0:t.tracks.every(r=>r==t.node?!0:e.get(r).size()==0)}getPath(t,e,r,i){return r.length==0?[]:new bc(t,e,r,i).result}getInnerDistance1(t,e,r){let i=r.sub(e.start).normalize(),s=e.lastDirect.cross(i)>0?le.CCW:le.CW;return this.calInnerDistance(t,s)}calInnerDistance(t,e){if(e==le.CCW){let r=0,i=t.previous;for(;i!=null;)r+=i.width+t.width/2+i.previous.width/2,t=i.previous,i=t.previous;return r}else{let r=0,i=t.next;for(;i!=null;)r+=i.width+t.width/2+i.next.width/2,t=i.next,i=t.next;return r}}alignEnd(t,e=!0){let r=new Map,i=e?t.end.point:t.start.point,n=e?t.end.direct:t.start.direct;n=new S(n.y,-n.x);let s=t.previous,a=t.next,l=t,c=t,h=0,u=0;for(r.set(t,[t.end.point,0]);s!=null||a!=null;)s!=null&&(h=h-(l.width/2+s.width+s.previous.width/2),l=s.previous,s=l.previous,r.set(l,[i.add(n.mul(h)),h])),a!=null&&(u=u+(c.width/2+a.width+a.next.width/2),c=a.next,a=c.next,r.set(c,[i.add(n.mul(u)),u]));return r}};function doe(o){let t=Ot(o[0].primitive);for(let e=0;e<o.length;e++){let r=o[e],i=Ot(r.primitive);if(!t.equals1(i))return!1}return!0}function K6(o){if(!Array.isArray(o)||o.length===0)return;let t=new Map,e,r=0;return o.forEach(i=>{let n=t.get(i)||0;t.set(i,n+1),n+1>r&&(e=i,r=n+1)}),e}function UGe(o){if(!Array.isArray(o)||o.length===0)return;if(o.length==2){let i=o[0],n=o[1];if(Math.abs(i.dot(n))<1e-5)return i.add(n).normalize()}let t=new Map,e,r=0;return o.forEach(i=>{let n=t.get(i)||0;t.set(i,n+1),n+1>r&&(e=i,r=n+1)}),e}function i9e(o,t=!0){if(o){let e=[],r=[];o.forEach(s=>{var c;let l=new er().getItem((c=s.start.model)==null?void 0:c.globalIndex);r.push({info:s,item:l,project:0}),l&&e.push(l)}),r=VT.sort(r);let i=r.map(s=>s.info),n=[];for(let s=0;s<i.length-1;s++){let a=i[s],l=i[s+1],c=te.getInstance().getNet(a.net);if(c!=null&&c.netDifferential!=null&&te.getInstance().getNet(l.net).netDifferential==c.netDifferential){let y=Ds(a.start.point,a.layerId),b=Ds(l.start.point,a.layerId),P=fP(y,a.net,l.net,a.layerId),T=fP(b,a.net,l.net,a.layerId),I=Math.max(P,T,0);if(I)n.push(new pC(I));else{let C=te.getInstance().getDifferentialPhysicsByNet(a.net);n.push(new pC(C.getDifferentialPairSpacingDefault(a.layerId)))}continue}let h=a.start.point,u=a.start.direct,d=l.start.point,p=Math.abs(d.sub(h).cross(u)),m=(a.width+l.width)/2;n.push(new pC(p-m))}VT.linked(i,n),Un.getInstance().current.modifySort(i,n,t)}}var Z6=class Z6{constructor(){this.startItems=new Array;this.startItemsConnects={};this.canBackSpace={};this.oldStartItems=new Array}static getInstance(){return Z6.manager==null&&(Z6.manager=new Z6),Z6.manager}setStartItems(t){this.startItems.length=0,Re.addAll(this.startItems,t),Re.addAll(this.oldStartItems,t),this.hight()}getStartItem(t){return this.startItems[t]}isStart(t){return this.startItems.includes(t)}getNodeList(t){let e=t.start.model,r=t.start.point;if(!e||!(e instanceof yt))return;let i=new ku(e),n=i.tracks,s=n.findIndex(h=>h==e),a=i.reverseTrack[s],l=a?e.end:e.start,c=a?e.start:e.end;if(!(s==n.length-1&&c.equals(r)))if(s==0&&l.equals(r))i.reversePath();else{this.canBackSpace[e.globalIndex]=!1;return}this.canBackSpace[e.globalIndex]=!0,i.generateList()}backspace(t,e){e||(e=new S(Pi.getInstance().sceneX,Pi.getInstance().sceneY));let r=Un.getInstance().current,i=r.tracks,n=[],s=!1,a=i;t&&(a=[r.node]);let l=[],c=a.map(u=>{let d=u,m=d.start.model;if(m&&m instanceof yt&&this.startItems.includes(m)&&this.canBackSpace[m.globalIndex]){let g=xt.getInstance().getNode(m);g||(this.getNodeList(d),g=xt.getInstance().getNode(m)),s=!0;let y=g.parent,b=y.getLastNode();_r.getInstance().current.setTrackHidden(b.item.globalIndex);let P=b.prev,T=y.viaNode.prev||y.otherNode.prev;if(P){let C=y.pop(),O=new er().getItem(C.globalIndex);O&&l.push(O),this.changeTrackInfoByItem(b.item,d,P.item)}else{if(T instanceof It){let C=_i.getInstance().getNode(T);C&&C.deleteConnectTrack(y)}this.changeTrackInfoByItem(b.item,d,T)}let I=this.startItems.findIndex(C=>C==m);I!=-1&&(this.startItems[I]=d.start.model,this.canBackSpace[d.start.model.globalIndex]=!0)}return d});if(!s)return!1;c.forEach(u=>{if(u.startAlignMap.size>0){let d=u.startAlignMap.get(u).start();d&&(u.start.point=d),u.startAlignMap.clear()}}),this.hight();let h=[];if(c.forEach(u=>{var m;let p=new er().getItem((m=u.start.model)==null?void 0:m.globalIndex);h.push({info:u,item:p,project:0}),p&&n.push(p)}),c.length>1){this.align(h,r.node),h=VT.sort2(h,e,r.node).tracksInfo;let d=h.map(m=>m.info),p=VT.getGapsByTracks(d);VT.linked(d,p),r.modifySort(d,p),this.consoleTrackEvent(r)}return l}align(t,e){let r=this.startItems,i=r.some(a=>a instanceof yt),n=r.every(a=>a instanceof yt)&&doe(r),s=new u_;if(i)try{let a=t.filter(l=>l.item instanceof Ue).map(l=>l.item.model);if(a.length){let l=UGe(a.map(m=>Ot(m.primitive))),c=a.map(m=>l.dot(m.end)),h=c.findIndex(m=>m==Math.max(...c));if(c.every(m=>m==c[0])&&e.start.model instanceof yt){let m=a.indexOf(e.start.model);m>=0&&(h=m)}let u=a[h],d=t.find(m=>m.item.model==u).info,p=s.getStartRoutes(t.map(m=>m.info),d,n);for(let m=0;m<t.length;m++){let g=t[m].info;if(g!==d){let y=p[m];g.end.point=y.end()||g.end.point,g.start.point=y.end()||g.start.point,g.end.direct=Ot(y.primitives[y.primitives.length-1])||d.end.direct,g.start.direct=Ot(y.primitives[y.primitives.length-1])||d.start.direct,g.startAlignMap.set(g,y)}}}}catch(a){console.error(a)}}consoleTrackEvent(t,e){t.tracks.forEach(i=>{this.consoleTrackInfo(i,e)})}consoleTrackInfo(t,e){var r;console.log("\u5BFC\u7EBF\u8D77\u70B9\u4FE1\u606F"),console.log(`start:(${t.start.point.x},${t.start.point.y}); layer:${t.layerId}; item:${e==null?void 0:e.globalIndex}, net:${t.net},width:${t.width}, direct:(${t.direct.x},${t.direct.y}),nextGap:${(r=t.next)==null?void 0:r.width},canModifyDirect:${t.start.allowModifyDirect},canModifyNet:${t.allowModifyNet},sortDirect:(${t.start.direct.x},${t.start.direct.y})`)}changeTrackInfoByItem(t,e,r){let i=t.layerId,n=t instanceof qr?t.direct:new S(1,0),s=!0;r instanceof qr&&(n=r.direct,s=!1);let a=go.getSignalLayerIds(r,i),l=new hb(new Set(a),i,t.start,n,s,r),c=new hb(new Set(a),i,t.end,n,s,null);e.start=l,e.end=c,e.startAlignMap.clear()}clear(){this.unHight(),this.startItems.length=0,this.startItemsConnects={},this.canBackSpace={},this.oldStartItems.length=0}hight(){let t=new er;this.startItems.forEach(e=>{if(!e)return;let r=t.getItem(e.globalIndex);r&&!r.isEmpty&&r.isVisible&&r.click()})}unHight(){let t=new er;this.startItems.forEach(e=>{if(!e)return;let r=t.getItem(e.globalIndex);r&&!r.isEmpty&&(r.updateFilterVisible=!0,r.visible())})}getBackspaceItems(){let t={};return this.startItems.forEach(e=>{if(e instanceof yt){if(!xt.getInstance().getNode(e))return;let i=xt.getInstance().getNode(e).parent;t[e.globalIndex]={pathList:i,endItem:i.otherNode.prev}}}),t}};Z6.manager=null;var hf=Z6;var poe=class o{constructor(t,e,r,i){this.limit=1;this.realTimeLimit=1;this.canEndWire=!1;this.tracks=t,this.gaps=e,this.node=r,this.canEndWire=i}toggleNext(){let t=this.tracks.indexOf(this.node),e=t+1>=this.tracks.length?0:t+1;this.node=this.tracks[e]}clone(){let t=new Array,e=new Array;for(let n of this.tracks){let s=n.clone();n.start!=null&&(s.start=n.start.clone()),n.end!=null&&(s.end=n.end.clone()),t.push(s)}for(let n of this.gaps){let s=n.clone();e.push(s)}this.linked(t,e);let r=this.tracks.indexOf(this.node),i=t[r];return new o(t,e,i,this.canEndWire)}linked(t,e){for(let r=0;r<t.length;r++){let i=t[r],n=e[r];i.next=n,i.previous=e[r-1]}}getStartCenter(t){let e=this.tracks.length,r=Math.floor(e/2),i;if(e%2===0){let n=this.tracks[r-1].start.point,s=this.tracks[r].start.point;if(i=n.add(s).mul(.5),t){let a=t.tracks[r-1].width,l=t.tracks[r].width,c=s.sub(n).normalize(),h=a-l;i=i.add(c.mul(h))}}else i=this.tracks[r].start.point;return i}getEndCenter(t){let e=this.tracks.length,r=Math.floor(e/2),i;if(e%2===0){let n=this.tracks[r-1].end.point,s=this.tracks[r].end.point;if(i=n.add(s).mul(.5),t){let a=t.tracks[r-1].width,l=t.tracks[r].width,c=s.sub(n).normalize(),h=a-l;i=i.add(c.mul(h))}}else i=this.tracks[r].end.point;return i}};var GT=class extends Ou{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e,r,i){super(),this.node=t,this.trackId=e,this.isStart=r,this.connect=i}redo(){this.connect?(this.isStart?this.node instanceof bs?this.trackId.viaNode.prev=this.node:this.trackId.otherNode.prev=this.node.item:this.node instanceof bs?this.trackId.viaNode.next=this.node:this.trackId.otherNode.next=this.node.item,this.node.addConnectTrack(this.trackId,this.isStart)):(this.isStart?this.trackId.viaNode.prev=null:this.trackId.viaNode.next=null,this.node.deleteConnectTrack(this.trackId))}undo(){this.connect?(this.isStart?this.node instanceof bs?this.trackId.viaNode.prev=null:this.trackId.otherNode.prev=null:this.node instanceof bs?this.trackId.viaNode.next=null:this.trackId.otherNode.next=null,this.node.deleteConnectTrack(this.trackId)):(this.isStart?this.node instanceof bs?this.trackId.viaNode.prev=this.node:this.trackId.otherNode.prev=this.node.item:this.node instanceof bs?this.trackId.viaNode.next=this.node:this.trackId.otherNode.next=this.node.item,this.node.addConnectTrack(this.trackId,this.isStart))}};function VF(o){let t=o.listIterator(),e=new Array;for(;t.hasNext();){let s=t.next();dOt(s.item),e.push(s),o.remove(s)}for(let s=e.length-1;s>=0;s--)o.addLastNode(e[s]);if(o.viaNode.prev!=null){let s=o.viaNode.prev.connectTrack.get(o);o.viaNode.prev.addConnectTrack(o,!s)}if(o.viaNode.next!=null){let s=o.viaNode.next.connectTrack.get(o);o.viaNode.next.addConnectTrack(o,!s)}if(o.otherNode.prev!=null&&o.otherNode.prev instanceof Je){let s=yc.getInstance().getNode(o.otherNode.prev),a=s.connectTrack.get(o);s.addConnectTrack(o,!a)}if(o.otherNode.next!=null&&o.otherNode.next instanceof Je){let s=yc.getInstance().getNode(o.otherNode.next),a=s.connectTrack.get(o);s.addConnectTrack(o,!a)}let r=o.viaNode.prev;o.viaNode.prev=o.viaNode.next,o.viaNode.next=r;let i=o.otherNode.prev;o.otherNode.prev=o.otherNode.next,o.otherNode.next=i;let n=o.startType;o.startType=o.endType,o.endType=n}function dOt(o){if(o instanceof qr){let{start:t,end:e}=o;o.start=e,o.end=t}else if(o instanceof Oi){let{center:t,radius:e,startAngle:r,endAngle:i,sweep:n}=o;o.startAngle=i,o.endAngle=r,o.sweep=n==le.CCW?le.CW:le.CCW}}function GF(o,t){let e=t.listIterator(),r=new Array(t.size()),i=0;for(;e.hasNext();)r[i++]=e.next();for(let n of r)t.remove(n),o.addLastNode(n)}function foe(o,t){let e=new Array,r=o;for(;r!=null&&(e.push(r),r!=t);)r=r.next;return e}function J6(o,t){var e,r;t?(o.ignore=!1,hi.getInstance().updateTree(o.item),_r.getInstance().current.setTrackVisible((e=o.item)==null?void 0:e.globalIndex)):(o.ignore=!0,hi.getInstance().deleteTree(o.item),_r.getInstance().current.setTrackHidden((r=o.item)==null?void 0:r.globalIndex))}var moe=class extends Ou{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e){super(),this.target=t,this.list=e,this.node=e.getFirstNode()}redo(){GF(this.target,this.list)}undo(){if(this.node!=null){let t=this.node,e=new Array;for(;t!=null;)e.push(t),t=t.next;for(let r=e.length-1;r>=0;r--)this.target.remove(e[r]),this.list.addFirstNode(e[r])}}};var goe=class extends Ou{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t){super(),this.list=t}redo(){VF(this.list)}undo(){VF(this.list)}};var Kg=class{constructor(){this.nodeManager=xt.getInstance();this.wireMap=new Map;this.wireVia=new Map;this.command=new Br;this.level="STRONG";this.direct=new S(1,0)}creataList(t){let e=this.nodeManager.createList();return this.wireMap.set(t,e),e}initList(t){let e=this.wireMap.get(t);if(e!=null){if(e.size()>0){let r=e.getLast(),i=t.start.model;r!==i?(e=new ri().createList(),this.wireMap.set(t,e)):(e.otherNode.next=null,e.viaNode.next=null)}else e.otherNode.next=null,e.viaNode.next=null;return e}if(t.start.model!=null){let r=t.start.model;if(r instanceof yt&&r.layerId==t.layerId){if(r.end.equals1(t.start.point)){let i=xt.getInstance().getListNode(r);i.next==null&&(e=i.parent)}if(r.start.equals1(t.start.point)){let i=xt.getInstance().getListNode(r);i.prev==null&&(VF(i.parent),e=i.parent)}}}return e==null&&(e=this.nodeManager.createList()),this.wireMap.set(t,e),e}updateEnd(t,e){let r=this.wireMap.get(t);if(r!=null&&t.end.model!=null){let i=t.end.model;if(i instanceof yt&&i.layerId==t.layerId){if(i.end.equals1(t.end.point)){let n=xt.getInstance().getListNode(i);n.next==null&&(e.addCommand(new goe(n.parent)),VF(n.parent),this.mergeLists(r,n.parent,e))}if(i.start.equals1(t.end.point)){let n=xt.getInstance().getListNode(i);n.prev==null&&this.mergeLists(r,n.parent,e)}}}}mergeLists(t,e,r=this.command){if(e.size()>0&&(r.addCommand(new moe(t,e)),GF(t,e)),this.changeViaNode(e.viaNode.prev,t,e,!0,r),this.changeViaNode(e.viaNode.next,t,e,!1,r),e.otherNode.prev!=null&&e.otherNode.prev instanceof Je){let i=yc.getInstance().getNode(e.otherNode.prev);this.changeViaNode(i,t,e,!0,r)}if(e.otherNode.next!=null&&e.otherNode.next instanceof Je){let i=yc.getInstance().getNode(e.otherNode.next);this.changeViaNode(i,t,e,!1,r)}}setInputStatus(t){let e=t.listIterator();for(;e.hasNext();){let r=e.next();Fr.getInstance().addInputStatus(r)}}changeViaNode(t,e,r,i,n){if(t!=null){let s=t.connectTrack.get(r);s!=null&&(t.deleteConnectTrack(r),n.addCommand(new GT(t,r,s,!1))),t.addConnectTrack(e,i),n.addCommand(new GT(t,e,i,!0))}}bind4Info(t){let e=this.wireMap.get(t);if(!(e==null||e.size()==0)){if(t.start.model!=null){let r=t.start.model,i=!1;r instanceof yt&&xt.getInstance().getListNode(r).parent==e&&(i=!0),i||this.bind(e,t.layerId,r,!0,this.command)}if(t.end.model!=null){let r=t.end.model,i=!1;r instanceof yt&&xt.getInstance().getListNode(r).parent==e&&(i=!0),i||this.bind(e,t.layerId,r,!1,this.command)}}}bind(t,e,r,i,n){if(r instanceof It&&!r.isEmpty){let s=_i.getInstance().getViaNode(r);i?t.viaNode.prev=s:t.viaNode.next=s,s.addConnectTrack(t,i),n.addCommand(new GT(s,t,i,!0))}else if(r instanceof yt){if(r.layerId!=e)return;let s=xt.getInstance().getListNode(r);if(i&&t.viaNode.prev!=null&&t.viaNode.prev.connectTrack.get(s.parent)!=null||!i&&t.viaNode.next!=null&&t.viaNode.next.connectTrack.get(s.parent)!=null)return;i?t.otherNode.prev=s.parent:t.otherNode.next=s.parent}else if(r instanceof Je){if(r.layerId!=12&&r.layerId!=e)return;let s=yc.getInstance().getNode(r);i?t.otherNode.prev=r:t.otherNode.next=r,s.addConnectTrack(t,!0),n.addCommand(new GT(s,t,i,!0))}else{if(r.layerId!=12&&r.layerId!=e)return;i?t.otherNode.prev=r:t.otherNode.next=r}}initViaNode(t){let e=this.wireVia.get(t);if(e!=null&&t.start.model!=null){let r=t.start.model;if(r instanceof yt){let i=xt.getInstance().getListNode(r);if(i.prev==null&&r.start.equals1(t.start.point)){let n=!0,s=i.parent;n?s.viaNode.prev=e:s.viaNode.next=e,e.addConnectTrack(s,n),this.command.addCommand(new GT(e,s,n,!0))}if(i.next==null&&r.end.equals1(t.start.point)){let n=!1,s=i.parent;n?s.viaNode.prev=e:s.viaNode.next=e,e.addConnectTrack(s,n),this.command.addCommand(new GT(e,s,n,!0))}}}}};function Q6(){let o=te.getInstance().getRadiusPhysicsByNet(""),t=tr.getInstance(),e=na.getInstance();return{trackWidthFollow:ce.pcbConfig.startTrackWidth,viaSizeFollow:ce.pcbConfig.startViaSize,lastTrackWidth:we.prevTrackWidth,lastInnerRadius:rt.defaultVia.innerRadius||o.defalutInner,lastRadius:rt.defaultVia.radius||o.defalutRadius,snap:we.adsorb,routingMode:t.mode,routingCorner:t.type,removeLoop:we.removeLoop,rotatingObject:ce.pcbConfig.rotateWhole,trackFollow:ce.pcbConfig.trackFollow,stretchTrackMinCorner:e.trackMinCorner,preferenceConfig:ce.pcbConfig.layerPhyPerferenceConfig,realTimeUpdateUnusedLayers:ce.pcbConfig.realTimeUpdateUnusedLayers,unusedPadRange:ce.pcbConfig.unusedPadRange,pushVia:e.pushVia,pathOptimization4BePushed:e.pathOptimization4BePushed,currentPathOptimization:e.currentPathOptimization4BePushed,removeCircuitsContainingVias:e.removeCircuitsContainingVias,removeAntenna:e.removeAntenna}}function Hi(){x.getInstance().compiler.uploadPreference(or.getInstance().encode("PREFERENCE",Q6()))}var yoe=class{constructor(t){this.wiringRouterParams=al.getInstance();this.afterPlacingTheViaSwitch2Layer=[this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().activeLayerId,this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().value],this.startTrackWidth=ce.pcbConfig.startTrackWidth,this.startViaSize=ce.pcbConfig.startViaSize,this.width=this.wiringRouterParams.getPanelTrackWidth(),this.wireMode=t}resetWirePanelData(){this.wiringRouterParams.setAfterPlacingTheViaSwitch2Layer(this.afterPlacingTheViaSwitch2Layer),ce.pcbConfig.startTrackWidth=this.startTrackWidth,ce.pcbConfig.startViaSize=this.startViaSize,we.widthFollowRule=ce.pcbConfig.startTrackWidth=="rule",we.sizeFollowRule=ce.pcbConfig.startViaSize=="rule",this.wiringRouterParams.setTrackWidth(this.width*10),Hi()}};var fC=class o{constructor(t,e,r){this.result=new Kg;this.realTimeLimit=1;this.nextEvent=null;this.publish=!1;this.tracks=t,this.gaps=e,this.node=r}saveWirePanelInfo(t){this.wirePanelInfo=new yoe(t)}modifySpacing(t){for(let e of this.gaps)e.width=t}isDiffGap(){let t=new l3,e=this.tracks,r=[];for(let i=0;i<e.length-1;i++)t.isDiffPair(e[i].net,e[i+1].net)&&(r.push(!0),i++),r.push(!1);return r}modifySpacing1(t){if(t.length==1){let e=this.isDiffGap();for(let r=0;r<this.gaps.length;r++){let i=this.gaps[r];e[r]||(i.width=t[0])}}else for(let e=0;e<this.gaps.length;e++){let r=this.gaps[e];r.width=t[e]}}modifyWidth(t){for(let e of this.tracks)e.width=t}updateSpacing(){let t=al.getInstance().getAsRuleMiniumSpacing(this),e=this.isDiffGap();for(let r=0;r<this.gaps.length;r++){let i=this.gaps[r];if(t[r]!=null){let n=t[r]/10;if(e[r]){i.width=n;continue}n>i.width&&(i.width=n)}}}toggleNext(){let t=this.tracks.indexOf(this.node),e=t+1>=this.tracks.length?0:t+1,r=this.tracks.length,i=0;for(;this.tracks[e].drawing==1&&(e=e+1>=this.tracks.length?0:e+1,i++,i!=r););this.node=this.tracks[e]}togglePre(){let t=this.tracks.indexOf(this.node),e=t-1<0?this.tracks.length-1:t-1,r=this.tracks.length,i=0;for(;this.tracks[e].drawing==1&&(e=e-1<0?this.tracks.length-1:e-1,i++,i!=r););this.node=this.tracks[e]}changeControlNodeByIndex(t){return this.node=this.tracks[t],!0}modifySort(t,e,r=!0){let i=this.tracks.indexOf(this.node);this.tracks.length=0,this.tracks.push(...t),this.gaps.length=0,this.gaps.push(...e),r&&(this.node=this.tracks[i])}reverse(){this.tracks.reverse(),this.gaps.reverse();for(let t of this.tracks)t.previous=null,t.next=null;for(let t of this.gaps)t.previous=null,t.next=null;this.linked(this.tracks,this.gaps)}clone(t=!1){let e=new Array,r=new Array;for(let s of this.tracks){let a=s.clone();if(s.startAlignMap.size>0&&!(s==this.node&&t)){let l=s.startAlignMap.get(s);a.startAlignMap.set(a,l)}s.start!=null&&(a.start=s.start.clone()),s.end!=null&&(a.end=s.end.clone()),e.push(a)}for(let s of this.gaps){let a=s.clone();r.push(a)}this.linked(e,r);let i=this.tracks.indexOf(this.node),n=e[i];return new o(e,r,n)}linked(t,e){for(let r=0;r<t.length;r++){let i=t[r],n=e[r];i.next=n,i.previous=e[r-1],n!=null&&(n.previous=i,n.next=t[r+1])}}getCornerEvent(){let t=new Array;for(let i of this.tracks){let n=i.getCornerNode();t.push(n)}let e=this.tracks.indexOf(this.node),r=new poe(t,this.gaps,t[e],this.isCanEndWire);return r.linked(t,this.gaps),r.realTimeLimit=this.realTimeLimit,r}resetInfo(){for(let t of this.tracks){t.isReverse&&(t.direct=t.direct.mul(-1)),t.isReverse=!1,t.end.model=null;let e=t.start.model;if(e!=null&&e instanceof yt&&e.isEmpty){let r=Zl.getInstance().getItem(e.globalIndex);t.start.model=r}}}};var Bu=class{constructor(t,e=!1){this.onlyTrack=!1;this.all=new Set;this.pts=new Array;this.tracks=new Array;this.onlyTrack=e,this.generateChain(t)}notConnectPadEndPoint(){return this.start!=null&&this.end==null?this.pts[this.pts.length-1].end():this.start==null&&this.end!=null?this.pts[0].start():null}generateChain(t){let e=t.start,r=t.end;return this.all.add(t),this.tracks.push(t),this.getTracks(e,t.net,t.width,t.layerId),this.reverse(),this.pts.push(t.primitive),this.tracks=this.tracks.reverse(),this.getTracks(r,t.net,t.width,t.layerId,!1),this}reverse(){if(this.pts.length!=0){this.pts.reverse();for(let t=0,e=this.pts.length;t<e;t++){let r=Hp(this.pts[t]);this.pts.splice(t,1,r)}}}getTracks(t,e,r,i,n=!0){let s=new ut(t.x,t.x,t.y,t.y),a=this.searchTracks(s,i);a=a.filter(y=>Bt.checkIsCanEditByItem(y));let l=new Array;for(let y of a)y instanceof Ge||y instanceof Le?y.net==e&&y.center.equals1(t)&&l.push(y):y instanceof Ue&&y.net==y.net&&!this.all.has(y)&&y.width==y.width&&y.layerId==i&&(y.start.equals1(t)||y.end.equals1(t))&&l.push(y);l.length==0&&Re.addAll(l,a);let c=new Array,h=new Array,u=new Array;if(n&&this.start==null||!n&&this.end==null)for(let y of l){let b=null;if((y instanceof Le||y instanceof Ge)&&(b=y),b!=null&&b.net==e&&b.center.distance2(t)<1e-4){n?(this.start=b,y instanceof Le?this.startType=1:this.startType=2):(y instanceof Le?this.endType=1:this.endType=2,this.end=b);return}if(this.onlyTrack&&y instanceof Si&&y.net==e&&(y.start.distance2(t)<1e-4||y.end.distance2(t)<1e-4)){n?this.startType=3:this.endType=3;return}}let d=new aP(t,r/2,S.ORIGIN,{point:t,item:null,isStart:n}),p=new Array;p.push(d);for(let y of l)if(y instanceof Ue&&this.itemIsWire(y)&&!this.all.has(y)&&y.net==e&&y.layerId==i&&y.length>1e-4){let b=new aP(y.start,y.width/2,S.ORIGIN,{point:y.end,item:y,isStart:!0}),P=new aP(y.end,y.width/2,S.ORIGIN,{point:y.start,item:y,isStart:!1});p.push(b,P)}new QR(p).classify();let g=d.getConnectNeighbors();for(let y of g){c.push(y.component.point);let b=y.component.item;y.component.isStart?h.push(b.primitive):h.push(Hp(b.primitive)),this.all.add(b),u.push(b)}if(c.length==1&&u[0].width==r)this.tracks.push(u[0]),this.pts.push(h[0]),this.getTracks(c[0],e,u[0].width,i,n);else if(c.length>1||u[0]&&u[0].width!=r){n?this.startType=11:this.endType=11;for(let y of u)this.all.delete(y)}else for(let y of u)this.all.delete(y)}searchTracks(t,e){return Vt.search4Types(t,["Pad","Via","Track","ArcTrack"],(i,n)=>n=="Track"||n=="ArcTrack"?i==e:n=="Pad"?i==12||i==e:n=="Via").getTPV()}itemIsWire(t){return this.onlyTrack?t instanceof Ar:t instanceof Ue}notConnectPadTrack(){return this.start!=null&&this.end==null?this.tracks[this.tracks.length-1]:this.start==null&&this.end!=null?this.tracks[0]:null}reverseResult(){this.tracks.reverse(),this.reverse();let t=this.start;this.start=this.end,this.end=t,[this.startType,this.endType]=[this.endType,this.startType]}};var r9=class{constructor(t=!1,e){this.precision=1e-4;this.onlyCheckEndpoint=t,e!=null&&(this.precision=e)}setOnlyCheckEndpoint(t=!1){this.onlyCheckEndpoint=t}isConnect(t,e){if(t instanceof yt){if(e instanceof yt)return this.checkTracks(t,e);if(e instanceof Je)return this.checkTrackPad(t,e);if(e instanceof It)return this.checkTrackVia(t,e)}else{if(t instanceof Je&&e instanceof yt)return this.checkTrackPad(e,t);if(t instanceof It&&e instanceof yt)return this.checkTrackVia(e,t)}return!1}checkTracks(t,e){let r=this.onlyCheckEndpoint?this.precision:t.width*t.width/4;return t.start.distance2(e.start)<r||t.start.distance2(e.end)<r||t.end.distance2(e.start)<r||t.end.distance2(e.end)<r}checkTrackPad(t,e){let r=this.onlyCheckEndpoint?this.precision:t.width*t.width/4;return t.start.distance2(e.center)<r||t.end.distance2(e.center)<r}checkTrackVia(t,e){let r=this.onlyCheckEndpoint?this.precision:t.width*t.width/4;return t.start.distance2(e.center)<r||t.end.distance2(e.center)<r}},boe=class extends r9{checkTracks(t,e){return this.onlyCheckEndpoint?super.checkTracks(t,e):!!(t.inOutline(e.start)||t.inOutline(e.end))}checkTrackPad(t,e){return this.onlyCheckEndpoint?super.checkTrackPad(t,e):!!(e.inOutline(t.start)||e.inOutline(t.end))}checkTrackVia(t,e){return this.onlyCheckEndpoint?super.checkTrackVia(t,e):!!(e.inOutline(t.start)||e.inOutline(t.end))}};var UF=class{constructor(){this.filter=new Hd;this.check=new r9(!0)}searchCycleNode(t){if(t==null||t.isEmpty)return[];let e=new Array;if(t instanceof Le){let r=this.searchTracks(t).getTracks(),i=new Array;for(let n of r)!n.isEmpty&&this.filter.needCheckIntersection(n.model,t.model)&&i.push(n);for(let n of i)(this.check.isConnect(n.model,t.model)||this.isEnd(n,n.start)&&t.model.inOutline(n.start)||this.isEnd(n,n.end)&&t.model.inOutline(n.end))&&e.push(n)}else if(t instanceof Ge){let r=this.searchTracks(t).getTracks(),i=new Array;for(let n of r)!n.isEmpty&&this.filter.needCheckIntersection(n.model,t.model)&&i.push(n);for(let n of i)(this.check.isConnect(n.model,t.model)||this.isEnd(n,n.start)&&t.model.inOutline(n.start)||this.isEnd(n,n.end)&&t.model.inOutline(n.end))&&e.push(n)}else if(t instanceof Ue){let r=this.searchTracks(t).getTPV(),i=new Array,n=new Array;for(let l of r)!l.isEmpty&&l!=t&&(l instanceof Ue&&this.filter.needCheckIntersection(l.model,t.model)?n.push(l):(l instanceof Ge&&this.filter.needCheckIntersection(l.model,t.model)||l instanceof Le&&this.filter.needCheckIntersection(l.model,t.model))&&i.push(l));let s=this.isEndpoint(i,n,t.start),a=this.isEndpoint(i,n,t.end);for(let l of i)(this.check.isConnect(t.model,l.model)||s&&l.model.inOutline(t.start)||a&&l.model.inOutline(t.end))&&e.push(l);for(let l of n)this.check.isConnect(l.model,t.model)&&e.push(l)}return e}getBBox(t){return t instanceof Ar?nh.trackToOctagon(t.start,t.end,t.width):t.buildBBox()}searchTracks(t){if(t instanceof Le){let e=t.buildBBox(),r;return t.layerId==12?r=(i,n)=>n=="Track"||n=="ArcTrack":r=(i,n)=>(n=="Track"||n=="ArcTrack")&&i==t.layerId,Vt.search(e,r)}else if(t instanceof Ge){let e=t.buildBBox(),r=(i,n)=>!!((n=="Track"||n=="ArcTrack")&&t.isContains(i));return Vt.search(e,r)}else{let e=this.getBBox(t),r=(i,n)=>(n=="Track"||n=="ArcTrack")&&t.layerId==i||n=="Pad"&&(i==12||i==t.layerId)?!0:n=="Via";return Vt.search(e,r)}}checkPadVia(t,e){let r=new Fs(t.getMathGraphics(),e.getMathGraphics(),0);return r.relation==1||r.relation==2}searchCycleNode2(t,e=!1,r=!1){if(t==null||t.isEmpty)return[];this.check.setOnlyCheckEndpoint(!r);let i=new Array;if(t instanceof Le){let n=this.searchPadAndViaCycleNode(t,r);for(let s of n.tracks)!s.isEmpty&&this.filter.needCheckIntersection(s.model,t.model)&&(this.check.isConnect(s.model,t.model)||this.isEnd(s,s.start)&&t.model.inOutline(s.start)||this.isEnd(s,s.end)&&t.model.inOutline(s.end))&&i.push(s);for(let s of n.pads)!s.isEmpty&&s!=t&&this.filter.needCheckIntersection(s.model,t.model)&&this.checkPadVia(s.model,t.model)&&(i.push(s),this.searchCycleNode2(s,void 0,!1).forEach(l=>{i.push(l)}));for(let s of n.vias)!s.isEmpty&&this.filter.needCheckIntersection(s.model,t.model)&&this.checkPadVia(s.model,t.model)&&(i.push(s),this.searchCycleNode2(s,void 0,!1).forEach(l=>{i.push(l)}))}else if(t instanceof Ge){let n=this.searchPadAndViaCycleNode(t,r);for(let s of n.tracks)!s.isEmpty&&this.filter.needCheckIntersection(s.model,t.model)&&(this.check.isConnect(s.model,t.model)||this.isEnd(s,s.start)&&t.model.inOutline(s.start)||this.isEnd(s,s.end)&&t.model.inOutline(s.end))&&i.push(s);for(let s of n.pads)!s.isEmpty&&this.filter.needCheckIntersection(s.model,t.model)&&this.checkPadVia(s.model,t.model)&&(i.push(s),this.searchCycleNode2(s,void 0,!1).forEach(l=>{i.push(l)}));for(let s of n.vias)!s.isEmpty&&s!=t&&this.filter.needCheckIntersection(s.model,t.model)&&this.checkPadVia(s.model,t.model)&&(i.push(s),this.searchCycleNode2(s,void 0,!1).forEach(l=>{i.push(l)}))}else if(t instanceof Ue){let n;t instanceof Ar?n=nh.trackToOctagon(t.start,t.end,t.width):t instanceof Si&&(n=t.buildBBox());let s=e?this.searchAbstractTrackCycleTrack(n,t):this.searchAbstractTrackCycleNode(n,t),a=new Array,l=new Array;for(let u of s)!u.isEmpty&&u!=t&&u instanceof zs&&u!=t&&(u instanceof Ue&&this.filter.needCheckIntersection(u.model,t.model)?l.push(u):(u instanceof Ge&&this.filter.needCheckIntersection(u.model,t.model)||u instanceof Le&&this.filter.needCheckIntersection(u.model,t.model))&&a.push(u));let c=this.isEndpoint(a,l,t.start),h=this.isEndpoint(a,l,t.end);for(let u of a)(this.check.isConnect(t.model,u.model)||c&&u.model.inOutline(t.start)||h&&u.model.inOutline(t.end))&&i.push(u);for(let u of l)this.check.isConnect(u.model,t.model)&&i.push(u)}return this.check.setOnlyCheckEndpoint(!0),i}searchPadAndViaCycleNode(t,e=!1){return Vt.search4Types(t.buildBBox(),e?sj:Q8e,(i,n)=>{switch(n){case"Track":case"ArcTrack":return t.layerId==12||i==t.layerId;case"Pad":case"Via":return e;default:return!1}})}searchAbstractTrackCycleNode(t,e){return Vt.search4Types(t,sj,(r,i)=>{switch(i){case"Track":case"ArcTrack":return r==e.layerId;case"Via":return!0;case"Pad":return r==12||r==e.layerId}return!1}).getTPV()}searchAbstractTrackCycleTrack(t,e){return Vt.search4Types(t,["Track","ArcTrack"],(r,i)=>{switch(i){case"Track":case"ArcTrack":return r==e.layerId}return!1}).getTracks()}isEnd(t,e){let r=this.searchAbstractTrackCycleNode(e.bbox().extendOfSize(.01),t),i=new Array,n=new Array;for(let s of r)!s.isEmpty&&s!=t&&(s instanceof Ue&&this.filter.needCheckIntersection(s.model,t.model)?n.push(s):(s instanceof Le&&this.filter.needCheckIntersection(s.model,t.model)||s instanceof Ge&&this.filter.needCheckIntersection(s.model,t.model))&&i.push(s));return this.isEndpoint(i,n,e)}isEndpoint(t,e,r){for(let i of t)if(r.distance1(i.center)<.01)return!1;for(let i of e)if(r.equals1(i.start)||r.equals1(i.end))return!1;return!0}};var HF=class{constructor(){this.searchCycleNode=new UF,this.searchCycleNode.check=new boe(!1)}getNearItem(t,e,r){let i=this.filterItems(e);if(t instanceof Le)return this.getPadNearNode(i,t,r);if(t instanceof Ge)return this.getViaNearNode(i,t,r);if(t instanceof Ue)return this.getTrackNearNode(i,t,r)}getNearItem1(t,e,r,i,n){let s=n instanceof Function?n(this.filterItems(e)):this.filterItems(e);if(s.length==0)return null;let a;if(t instanceof Le?a=this.getPadNearNodes(s,t,i):t instanceof Ge?a=this.getViaNearNodes(s,t,i):t instanceof Ue&&(a=this.getTrackNearNodes(s,t,i)),r!==12)for(let[c,h]of a){let u=h.filter(d=>{let p=!1;return d instanceof Ue?p=d.layerId===r:d instanceof Le?p=d.layerId==12||d.layerId===r:d instanceof Ge&&(p=d.isContains(r)),p});a.set(c,u)}let l;return l=this.setDistance2Items(a,i),this.findHighestScoreElement(l)}calculateScore(t,e){t=t*1e3;let r=e>0?e:1;return t*t/r}findHighestScoreElement(t){let e=-1/0,r=null,i=t.keys(),n=i.next().value;for(;n;){let a=t.get(n);for(let l of a){let c=this.calculateScore(n,l.keys().next().value);c>e&&(e=c,r=l)}n=i.next().value}return!r||Math.sqrt(r.keys().next().value)>400?null:r.values().next().value}groupItems(t,e){let r=new Array,i=new Array,n=new Array,s=new Array,a=new Array,l=new Array,c=Ss.getInstance().wireMode==="Multi-route wiring";for(let h of t)if(h!==e)if(this.layerIsContains(h,e))if(h instanceof Le)r.push(h);else if(h instanceof Ge)i.push(h);else{if(c&&h.length<h.width)continue;n.push(h)}else if(h instanceof Le)s.push(h);else if(h instanceof Ge)a.push(h);else{if(c&&h.length<h.width)continue;l.push(h)}return{c_pads:r,c_via:i,c_track:n,pads:s,via:a,track:l}}layerIsContains(t,e){if(this.isMultiLayer(t))return!0;let r=e.layerId;if((e instanceof Ge||this.isMultiLayer(e))&&(r=this.getReferenceLayer(e)),t instanceof Ge){if(t.isContains(r))return!0}else if(t.layerId==r)return!0;return!1}getReferenceLayer(t){let e=be.getActiveLayerID(),r=be.getLayer(e);return gs(r.type)||(e=1),t instanceof Ge&&(t.isContains(e)||(e=t.startLayer)),e}isMultiLayer(t){return t instanceof Ge?t.type==0:gr(t.layerId)}getPadNearNode(t,e,r){let i=null,{c_pads:n,c_via:s,c_track:a,pads:l,via:c,track:h}=this.groupItems(t,e);if(i=this.getNearNode(n,e,r),i||(i=this.getNearNode(s,e,r),i)||(i=this.getNearNode(a,e,r),i)||(i=this.getNearNode(l,e,r),i)||(i=this.getNearNode(c,e,r),i)||(i=this.getNearNode(h,e,r),i))return i}getValidPadNodes(t,e,r){let i=null,{c_pads:n}=this.groupItems(t,e);return i=this.getNearNode2(n,r,10),i}getNearNode2(t,e,r){let i=Number.MAX_VALUE,n=[],s=[];r=Math.pow(r,2);for(let a of t){let c=this.fixPosition(a,e).distance2(e);c<i&&(i=c),s.push({dis:c,item:a})}for(let a of s)ne.lesseq(a.dis,i+r)&&n.push(a.item);return n}getTrackNearNode(t,e,r){let i=new Set;i.add(e);let n=this.getConnectPad([e],i);if(n){let p=this.getValidPadNodes(t,n,this.fixPosition(n,r));if(p.length){t=[];for(let m of p)Re.addAll(t,this.getConnectAllPad(m,p))}}let s=null,{c_pads:a,c_via:l,c_track:c,pads:h,via:u,track:d}=this.groupItems(t,e);if(s=this.getNearNode(c,e,r),s||(s=this.getNearNode(l,e,r),s)||(s=this.getNearNode(a,e,r),s)||(s=this.getNearNode(d,e,r),s)||(s=this.getNearNode(u,e,r),s)||(s=this.getNearNode(h,e,r),s))return s}getViaNearNode(t,e,r){let i=new Set;i.add(e);let n=this.getConnectPad([e],i);if(n){let p=this.getValidPadNodes(t,n,this.fixPosition(n,r));if(p.length){t=[];for(let m of p)Re.addAll(t,this.getConnectAllPad(m,p))}}let s=null,{c_pads:a,c_via:l,c_track:c,pads:h,via:u,track:d}=this.groupItems(t,e);if(s=this.getNearNode(l,e,r),s||(s=this.getNearNode(c,e,r),s)||(s=this.getNearNode(a,e,r),s)||(s=this.getNearNode(u,e,r),s)||(s=this.getNearNode(d,e,r),s)||(s=this.getNearNode(h,e,r),s))return s}weightedBasePriority(t,e){let r=new Map;for(let[i,n]of Object.entries(t)){if(n.length==0)continue;let s=e[i];r.has(s)||r.set(s,[]);let a=r.get(s).concat(n);r.set(s,a)}return r}refineGroupItems(t,e){let r=e==null?void 0:e.getParent();if(r instanceof Me){let i={component_c_pads:Array(),component_c_via:Array(),component_c_track:Array(),component_pads:Array(),component_via:Array(),component_track:Array()};for(let[,n]of Object.entries(t))for(let s=0;s<n.length;s++){let a=n[s],l=a==null?void 0:a.getParent();if(l instanceof Me&&l==r){let c=n.findIndex(h=>h==a);a instanceof Le?this.layerIsContains(a,e)?i.component_c_pads.push(a):i.component_pads.push(a):a instanceof Ge?this.layerIsContains(a,e)?i.component_c_via.push(a):i.component_via.push(a):a instanceof Ue&&(this.layerIsContains(a,e)?i.component_c_track.push(a):i.component_track.push(a)),n.splice(c,1),s--}}return{...t,...i}}return t}getPadNearNodes(t,e,r){let i=this.groupItems(t,e),n=this.refineGroupItems(i,e),s={c_pads:1,c_via:.85,c_track:.7,pads:.55,via:.4,track:.25},a={component_c_pads:2,component_c_via:1.85,component_c_track:1.7,component_pads:1.55,component_via:1.4,component_track:1.25},l=s;return i!==n&&(l={...s,...a}),this.weightedBasePriority(n,l)}getTrackNearNodes(t,e,r){new Set().add(e);let n=this.groupItems(t,e),s=this.refineGroupItems(n,e),a={c_track:1,c_via:.85,c_pads:.7,track:.55,via:.4,pads:.25},l={component_c_track:2,component_c_via:1.85,component_c_pads:1.7,component_track:1.55,component_via:1.4,component_pads:1.25},c=a;return n!==s&&(c={...a,...l}),this.weightedBasePriority(n,c)}getViaNearNodes(t,e,r){let i=new Set;i.add(e);let n=this.getConnectPad([e],i);if(n){let u=this.getPadNearNode(t,n,this.fixPosition(n,r));t=t.concat(this.getConnectAllPad(u))}let s=this.groupItems(t,e),a=this.refineGroupItems(s,e),l={c_via:1,c_track:.85,c_pads:.7,via:.55,track:.4,pads:.25},c={component_c_via:2,component_c_track:1.85,component_c_pads:1.7,component_via:1.55,component_track:1.4,component_pads:1.25},h=l;return s!==a&&(h={...l,...c}),this.weightedBasePriority(s,h)}getNearNode(t,e,r){let i=e.getParent();if(i!=null&&i instanceof Me){let n=t.filter(s=>s.getParent()==i);if(n.length>0)return this.getNearNode4Dis(n,e,r)}return this.getNearNode4Dis(t,e,r)}getNearNode4Dis(t,e,r){let i=Number.MAX_VALUE,n=null;for(let s of t){let a;if(e instanceof Ue&&s instanceof Ue)a=this.fixPosition(s,r).distance2(r)-(e.width+s.width)/2;else{let l=e.getMathGraphics(e.layerId),c=s.getMathGraphics(s.layerId);a=new Fs(l,c,0).distance}a<i&&(i=a,n=s)}return n}setDistance2Items(t,e){let r=new Map;return t.forEach((i,n)=>{i.forEach(s=>{let a=this.fixPosition(s,e);if(a){let l=a.distance2(e);r.has(n)||r.set(n,[]);let c=new Map;c.set(l,s);let h=r.get(n).concat([c]);r.set(n,h)}})}),r}getConnectAllPad(t,e){let r=new Set;r.add(t);let i=[t];for(;i.length>0;){let n=i.shift(),s=this.searchCycleNode.searchCycleNode(n),a=[];s.find(c=>{if(r.has(c))return!1;if(c instanceof Le&&!(e!=null&&e.includes(c)))return!0;a.push(c),r.add(c)})||i.push(...a)}return Array.from(r)}getConnectPad(t,e){if(t.length==0)return null;let r=t.shift(),i=this.searchCycleNode.searchCycleNode(r);for(let n of i)if(!e.has(n)){if(n instanceof Le)return n;t.push(n),e.add(n)}return this.getConnectPad(t,e)}filterItems(t){let e=ze.getSameNetItems(t),r=new Array;for(let i of e)gc.getInstance().has(i.globalIndex)||(i instanceof Le||i instanceof Ge||i instanceof Ue)&&r.push(i);return r}fixPosition(t,e,r=!1){if(t instanceof Le||t instanceof Ge)return t.center;{let i=t.width,n=t.start.distance1(e),s=t.end.distance1(e);if(r){if(n<s)return t.start;if(s<n)return t.end}if(n<s&&n<=i)return t.start;if(s<n&&s<=i)return t.end;{let a=t.primitive,l=new M(e,e),h=new Zu(a,l).getLine();return h.start().distance2(e)<h.end().distance2(e)?h.end():h.start()}}}};var WF=class extends HF{constructor(t,e,r,i=!1){super(),this.fixToEnd=i,this.isSingle=r;let n=this.getNetDifferentail(t),s=this.fixPosition(t,e);if(n!=null)if(this.rule=te.getInstance().getDifferentialPhysics(n.differentialPhysics),this.net_P=n.positiveNet.name,this.net_N=n.negativeNet.name,t.net==this.net_P){if(this.positive=t,this.start_P=s,this.negative=this.getNearItem(this.positive,this.net_N,s),this.negative==null){this.success=!1;return}this.start_N=this.fixPosition(this.negative,s),this.success=!0}else{if(this.negative=t,this.start_N=s,this.positive=this.getNearItem(this.negative,this.net_P,s),this.positive==null){this.success=!1;return}this.start_P=this.fixPosition(this.positive,s),this.success=!0}else this.success=!1}filter(t,e){let r=t.filter(i=>i.layerId==e.layerId);if(r.length>0)for(let i of r){let n=i.searchNode();for(let s of n)if(s instanceof Ue)return i}else for(let i of t){let n=i.searchNode();for(let s of n)if(s instanceof Ue)return i}return t[0]}getNetDifferentail(t){let e=t.net;if(te.getInstance().getAllNetDifferentials().size>0){let i=te.getInstance().getNet(e);if(i!=null&&i.netDifferential!=null)return i.netDifferential}return null}fixPosition(t,e){var r;if(t instanceof Le||t instanceof Ge)return t.center;{if(!this.isSingle&&this.fixToEnd){let a=new Bu(t);if(a.start==null&&a.pts.length>0&&a.tracks[0]==t)return a.pts[0].start();if(a.end==null&&a.pts.length>0&&a.tracks[a.tracks.length-1]==t)return a.pts[a.pts.length-1].end()}let i=t.width+(((r=this.rule)==null?void 0:r.getDifferentialPairSpacingDefault(t.layerId))||0)+1e-5,n=t.start.distance1(e),s=t.end.distance1(e);if(n<s&&n<=i)return t.start;if(s<n&&s<=i)return t.end;{let a=t.primitive,l=new M(e,e),h=new ir(a,l).getLine();return h.start().distance2(e)<h.end().distance2(e)?h.end():h.start()}}}};var fi=class{constructor(){this.id="";this.type="open";this.dialogType=""}command(t){return!1}};var Poe=class extends fi{constructor(t){super(),this.data=t}open(t){return{action:"route-prohibit-violate-drc",data:{position:this.data.position}}}modify(){}close(t){if(!t)return;let{action:e}=t;return e=="confirm"?this.data.cb&&this.data.cb():this.data.cbCancel&&this.data.cbCancel(),!0}};function Ql(o,t=!1){let e=te.getInstance().getNet(o),r=x.getInstance().compiler;r.setTicket(),t||e==null?r.deleteNet(o):r.uploadNet(o,or.getInstance().encode("NET",e))}var Toe=class extends so{constructor(t,e,r){super(),this.data={net:t,color:e.toString()};let i=te.getInstance().getNet(this.data.net);this.source=r=="delete"?or.getInstance().encode("NET",i):null,this.action=r}getItem(){return"ignore"}rebuild(){}remove(){}modify(){let t=this.data,e=ze.getSpecialColor(t.net).toString();dD([t.net],ee.of3(t.color)),this.data={net:t.net,color:e},this.updateData()}upload(t=!1){let e=this.isDelete(t),r=x.getInstance().compiler;e||(this.source==null&&this.updateData(),this.source!=null&&(r.setTicket(),r.uploadNet(this.data.net,this.source))),this.source=null}updateData(){if(this.source==null){let t=te.getInstance().getNet(this.data.net);t!=null&&(this.source=or.getInstance().encode("NET",t))}}};var zF=class{constructor(t,e,r,i,n=!0){this.trunk=new Array;this.leaves=new Array;this.data=t,this.start=r,this.end=i,this.cycle=new Set(e),this.all=new Set(e),n&&(Re.addAllSet(this.all,e[0].searchNodeLoopType()),Re.addAllSet(this.all,e[e.length-1].searchNodeLoopType()),this.getTrunk(e),e.forEach((s,a)=>{let l=this.getIntersection(s,e[a+1]);this.addAll(l),l.length>0&&l.forEach(c=>{let h=[c];this.leaves.push(h),this.DFS(c,h)})}))}getTrunk(t){let e=new Set,r=new Array;t.forEach((i,n)=>{let s=this.getIntersection(i,t[n+1]);i instanceof Le?r.length>0&&(this.trunk.push(r),r=new Array):r.push(i),s.length>0&&(r.length>0&&this.trunk.push(r),r=new Array),e=new Set(s)}),r.length>0&&this.trunk.push(r)}DFS(t,e){let r=this.getNodes(t);this.addAll(r),r.forEach(i=>{e.push(i),this.DFS(i,e)})}addAll(t){t.forEach(e=>{this.all.add(e)})}getNodes(t){let e=t.searchCycleNode2(),r=new Array;return e.forEach(i=>{!this.all.has(i)&&i!=t&&this.isNeed(i)&&!i.isSelect(this.start.x,this.start.y)&&!i.isSelect(this.end.x,this.end.y)&&r.push(i)}),this.specialOneTrackConPad(t,new Set(e),r),this.filterNodes(r)}getIntersection(t,e){let r=new Array;if(e==null)return r;let i=new Set(t.searchNodeLoopType()),n=new Set(e.searchNodeLoopType());for(let s of i)!this.all.has(s)&&s!=t&&this.isNeed(s)&&n.has(s)&&r.push(s);return this.filterNodes(r)}specialOneTrackConPad(t,e,r){if(r.length||!(t instanceof Ue))return;let i=t.searchNodeLoopType(),n=i.filter(c=>!e.has(c)&&!this.all.has(c)&&c instanceof Le);if(n.length==1){let c=n[0];c.searchNodeLoopType().length==1&&r.push(c)}let s=t.start,a=t.end,l=t.width;for(let c of i)if(c instanceof Ue&&c!=t&&!e.has(c)&&!this.all.has(c)&&!r.includes(c)&&!c.isSelect(this.start.x,this.start.y)&&!c.isSelect(this.end.x,this.end.y)){let h=s.distance2(c.start),u=s.distance2(c.end),d=a.distance2(c.start),p=a.distance2(c.end),m=(l+c.width)/2;Math.min(h,u,d,p)<m*m&&r.push(c)}}filterNodes(t){let e=new Array,r=new Array;if(t.forEach(i=>{i instanceof Le||i instanceof Ge?e.push(i):r.push(i)}),e.length==0)return r;{let i=Array.from(e);return r.forEach(n=>{for(let s of e)if(n.isSelect(s.center.x,s.center.y))return;i.push(n)}),i}}isNeed(t){return t instanceof Ue||t instanceof Le||t instanceof Ge}leavaHasPad(){for(let t of this.leaves)for(let e of t)if(e instanceof Le)return!0;return!1}cycleContainsPad(t,e){for(let r of this.cycle)if(!t.has(r)&&!e.has(r)&&r instanceof Le)return!0;return this.leavaHasPad()}reverse(){let t=new Array;for(let e=this.trunk.length-1;e>=0;e--)t.push(this.trunk[e]);this.trunk.length=0,t.forEach(e=>{this.trunk.push(e)})}};var Ioe=class{constructor(t){this.nexts=new Array;this.channel=new Array;this.source=t}addNexts(t){for(let e of t)this.nexts.indexOf(e)<0&&(this.nexts.push(e),this.channel.push(!0))}setNextChannel(t,e){let r=this.nexts.indexOf(t);r>=0&&(this.channel[r]=e)}queryChannel(t){let e=this.nexts.indexOf(t);return e>=0?this.channel[e]:!0}nextCanReach(){for(let t of this.channel)if(t)return!0;return!1}};var Coe=class{constructor(t,e,r,i,n=!0){this.curr=new Array;this.cycles=new Array;this.process=new Set;this.cache={};this.startNodes=t,this.endNodes=e,this.start=r,this.end=i,this.needLeaves=n;for(let s of this.startNodes)this.DFS(s,[]);xr(this.cycles,(s,a)=>s.cycle.size-a.cycle.size,0,this.cycles.length),this.classifyCycle()}classifyCycle(){if(this.cycles.length>1&&this.cycleContainsPad()){console.log("need classify cycle");let t=this.updateEndpoint(this.startNodes,this.start),e=this.updateEndpoint(this.endNodes,this.end),r={nodes:this.startNodes,point:this.start,isMulti:!1},i={nodes:this.endNodes,point:this.end,isMulti:!1};if(t==null||t.length==0){if(!(e==null||e.length==0)){if(e.length==1)e[0].point.equals1(r.point)||(i=e[0]);else if(e.length==2){let n=new Array;for(let s of e)s.point.equals1(r.point)||n.push(s);n.length>0?i=n[0]:i=e[0]}}}else if(t.length==1&&!t[0].point.equals1(i.point)){if(e==null||e.length==0)r=t[0];else if(e.length==1)e[0].point.equals1(t[0].point)||(r=t[0],i=e[0]);else if(e.length==2){let n=new Array;for(let s of e)!s.point.equals1(r.point)&&!s.point.equals1(t[0].point)&&n.push(s);n.length>0?i=n[0]:i=e[0],r=t[0]}}else if(t.length==2){if(e==null||e.length==0){let n=new Array;for(let s of t)s.point.equals1(i.point)||n.push(s);n.length>0?r=n[0]:r=t[0]}else if(e.length==1){e[0].point.equals1(t[0].point)||(i=e[0]);let n=new Array;for(let s of t)s.point.equals1(i.point)||n.push(s);n.length>0?r=n[0]:r=t[0]}else if(e.length==2){let n=new Set,s=new Set,a=0;for(let l of t)for(let c of e)l.point.equals1(c.point)&&(n.add(l),s.add(c),a++);if(a==2)t.length==2?(r=t[0],i=t[1]):e.length==2&&(r=e[0],i=e[1]);else{for(let l of n){let c=t.indexOf(l);c>=0&&t.splice(c,1)}for(let l of s){let c=e.indexOf(l);c>=0&&e.splice(c,1)}t.length>0&&(r=t[0]),e.length>0&&(i=e[0])}}}this.startNodes=r.nodes,this.endNodes=i.nodes,this.start=r.point,this.end=i.point,this.cycles.length=0,this.curr.length=0,this.cache={};for(let n of this.startNodes)this.DFS(n,[]);xr(this.cycles,(n,s)=>n.cycle.size-s.cycle.size,0,this.cycles.length)}}updateEndpoint(t,e){let r=!0;for(let i of t)i instanceof Ue||(r=!1);if(r){if(t.size>2)return null;{let i=new Array;for(let n of t){let s=new Set(t);this.getTracks(n,s,i)}return xr(i,(n,s)=>n.isMulti||s.isMulti?-1:0,0,i.length),i}}else return null}getTracks(t,e,r){let i=t.start.bbox().extendOfSize(t.width/2),n=t.end.bbox().extendOfSize(t.width/2),s=this.getConnectItemsByBbox(i,{net:t.net,layer:t.layerId}).filter(l=>{let c=l;return c instanceof Ue?!!(!e.has(c)&&(c.start.equals1(t.start)||c.end.equals1(t.start))):c instanceof Le||c instanceof Ge?!!(!e.has(c)&&c.center.equals1(t.start)):!1}),a=this.getConnectItemsByBbox(n,{net:t.net,layer:t.layerId}).filter(l=>{let c=l;return c instanceof Ue?!!(!e.has(c)&&(c.start.equals1(t.end)||c.end.equals1(t.end))):c instanceof Le||c instanceof Ge?!!(!e.has(c)&&c.center.equals1(t.end)):!1});if(s.length>1){let l=new Set,c=null;for(let h of s){let u=h;u instanceof Le||u instanceof Ge?c={nodes:new Set([u]),point:t.start,isMulti:!1}:u instanceof Ue&&l.add(u)}c==null&&(l.add(t),c={nodes:l,point:t.start,isMulti:!0}),r.push(c),Re.addAllSet(e,c.nodes)}else if(s.length==1){let l=s[0];if(l instanceof Le||l instanceof Ge){let c={nodes:new Set([l]),point:t.start,isMulti:!1};r.push(c),Re.addAllSet(e,c.nodes)}else l instanceof Ue&&(e.add(l),this.getTracks(l,e,r))}if(a.length>1){let l=new Set,c=null;for(let h of a){let u=h;u instanceof Le||u instanceof Ge?c={nodes:new Set([u]),point:t.end,isMulti:!1}:u instanceof Ue&&l.add(u)}c==null&&(l.add(t),c={nodes:l,point:t.end,isMulti:!0}),r.push(c),Re.addAllSet(e,c.nodes)}else if(a.length==1){let l=a[0];if(l instanceof Le||l instanceof Ge){let c={nodes:new Set([l]),point:t.end,isMulti:!1};r.push(c),Re.addAllSet(e,c.nodes)}else l instanceof Ue&&(e.add(l),this.getTracks(l,e,r))}}getConnectItemsByBbox(t,e){return Vt.conditionSearch(t,i=>{let n=i.item;return n.net!==e.net?!1:n instanceof Ue?n.length!=0:n instanceof Ge?!!n.isContains(e.layer):!0},(i,n)=>{switch(n){case"Track":case"ArcTrack":return i==e.layer;case"Via":return i==12||i==e.layer;case"Pad":return i==12||i==e.layer}return!1}).getResult(sj)}getNode(t){let e=t.globalIndex,r=this.cache[e];if(r!=null)return r;{let i=new Ioe(t);return this.cache[e]=i,i}}DFS(t,e){let r=this.getNode(t),i=!0;if(this.curr.push(t),this.isEnd(t)){let n=Array.from(this.curr);this.cycles.push(new zF(Array.from(this.curr),n,this.start,this.end,this.needLeaves))}else{let n=this.getNodes(t,new Set([].concat(this.curr,e)));n.forEach(s=>{this.process.add(s)}),r.addNexts(n),n.forEach(s=>{if(r.queryChannel(s)){let l=this.DFS(s,n);this.process.delete(s),r.setNextChannel(s,l)}}),n.length==0?i=!1:n.length==1?i=r.queryChannel(n[0]):i=r.nextCanReach()}return this.curr.pop(),i}getNodes(t,e){let r=t.searchCycleNode2(),i=new Array;return r.forEach(n=>{!e.has(n)&&!this.process.has(n)&&!this.startNodes.has(n)&&n!=t&&this.isNeed(n)&&i.push(n)}),this.filterNodes(i,t)}filterNodes(t,e){let r=new Array,i=new Array;if(t.forEach(n=>{n instanceof Le||n instanceof Ge?r.push(n):i.push(n)}),r.length==0)return i;{let n=Array.from(r);return i.forEach(s=>{for(let a of r)if(e.isSelect(a.center.x,a.center.y)&&s.isSelect(a.center.x,a.center.y))return;n.push(s)}),n}}isNeed(t){return t instanceof Ue||t instanceof Le||t instanceof Ge}isEnd(t){return this.endNodes.has(t)}cycleContainsPad(){for(let t of this.cycles)if(t.cycleContainsPad(this.startNodes,this.endNodes))return!0;return!1}};var YF=class extends ds{constructor(e,r){super();this.pt=e;this.model=r;this.net=this.model.net}get length(){return this.pt instanceof M||this.pt instanceof q?this.pt.length():0}get color(){throw new Error("Method not implemented.")}set color(e){throw new Error("Method not implemented.")}get locked(){throw new Error("Method not implemented.")}set locked(e){throw new Error("Method not implemented.")}get showNet(){var e;return(e=this.model.showNet)!=null?e:null}rotateFor(e,r){throw new Error("Method not implemented.")}transform(e){throw new Error("Method not implemented.")}isSelect(e,r,i){throw new Error("Method not implemented.")}buildBBox(){throw new Error("Method not implemented.")}},uX=class extends Coe{DFS(t,e){let r=this.getNode(t),i=!0;if(this.curr.push(t),this.isEnd(t)){let n=Array.from(this.curr);this.cycles.push(new zF(Array.from(this.curr),n,this.start,this.end,this.needLeaves))}else{let n=this.getNodes(t,new Set([].concat(this.curr,e)));n.forEach(s=>{this.process.add(s)}),r.addNexts(n),n.forEach(s=>{if(r.queryChannel(s)){let l=this.DFS(s,n);this.process.delete(s),r.setNextChannel(s,l)}}),n.length==0?i=!1:n.length==1?i=r.queryChannel(n[0]):i=r.nextCanReach()}if(this.curr.pop(),!i&&t instanceof Ue){let n=this.searchNearNode(t);if(n.length>0)for(let s of n){let a=s[0];this.curr.push(a),this.DFS(s[1],[s[1]])&&(i=!0),this.curr.pop()}}return i}searchNearNode(t){let e=new Hd,r=Vt.search4Types(t.buildBBox(),["Pad","Via"],(n,s)=>{switch(s){case"Pad":case"Via":return!0;default:return!1}}),i=new Array;for(let n of r.pads)if(!n.isEmpty&&n instanceof Le&&e.needCheckIntersection(n.model,t.model)&&!this.isEndpoint(n,t.start)&&!this.isEndpoint(n,t.end)&&this.canSplitTrack(n.center,t)){let s=this.spiltTrack(n.center,t);i.push([s,n])}for(let n of r.vias)if(!n.isEmpty&&n instanceof Ge&&e.needCheckIntersection(n.model,t.model)&&!this.isEndpoint(n,t.start)&&!this.isEndpoint(n,t.end)&&this.canSplitTrack(n.center,t)){let s=this.spiltTrack(n.center,t);i.push([s,n])}return i}getNodes(t,e){let r=t.searchCycleNode2(),i=new Array;return r.forEach(n=>{!e.has(n)&&!this.process.has(n)&&!this.startNodes.has(n)&&n!=t&&this.isNeed(n)&&i.push(n)}),this.filterNodes(i,t)}isEndpoint(t,e){return e.distance1(t.center)<.01}canSplitTrack(t,e){let r=e.primitive;return ir.getMinDistanceFromPoint(t,r)<.02}spiltTrack(t,e){let r=new M(t,t),n=new ir(r,e.primitive).getLine();if(n.start().equals(t)){let s=gd(e.primitive,n.end());return new YF(s[0],e.model)}else{let s=gd(e.primitive,n.start());return new YF(s[0],e.model)}}};function dX(o){let{id:t,designator:e,number:r}=o;if(t!=null&&t!=""){let n=Kt.getItem(t);if(n!=null)return n;let s=Kt.getAllItem().find(a=>{let l=a.getParent();return l!=null?`${ur}${l.number}${ur}${a.number}`==t:`${ur}${a.number}`==t});if(s!=null)return s}let i=Cr.getAllItem();for(let n of i)if(n.designator==e||`${ur}${n.number}`==e){let s=n.getPads();for(let a of s)if(a.num==r)return a}return null}function pX(o){let{id:t,designator:e,number:r}=o;if(t!=null&&t!=""){let s=Kt.getItem(t);if(s!=null)return[s];let a=Kt.getAllItem().find(l=>{let c=l.getParent();return c!=null?`${ur}${c.number}${ur}${l.number}`==t:`${ur}${l.number}`==t});if(a!=null)return[a]}let i=Cr.getAllItem(),n=new Array;for(let s of i)if(s.designator==e||`${ur}${s.number}`==e){let a=s.getPads();for(let l of a)l.num==r&&n.push(l)}return n}function jF(o,t){let e={pad1:null,pad2:null,netMinLength:0},r=pX(o),i=pX(t);for(let n of r)for(let s of i){if(e.pad1=n,e.pad2=s,!e.pad1||!e.pad2||e.pad1.net!=e.pad2.net){e.netMinLength=0;continue}let a=new Set,l=new Set;a.add(e.pad1),l.add(e.pad2);let h=new uX(a,l,e.pad1.center,e.pad2.center,!1).cycles,u=WGe(h).length;if(u>0)return e.netMinLength=u,e}return e}function HGe(o,t="-"){let e=o.split(t);if(e.length<=1||!e[0]||!e[1])throw new Error("\u710A\u76D8\u5BF9\u540D\u79F0\u4E0D\u5408\u6CD5.");return new rg(e[0],e[1])}function n9e(o){let t=[],e=[];for(let r=0;r<o.length;r++){let i=!1,n=o[r],s=dX(n.pad1),a=dX(n.pad2),l=n.pad1.id?n.pad1.id:n.pad1.designator+":"+n.pad1.number,c=n.pad2.id?n.pad2.id:n.pad2.designator+":"+n.pad2.number;if(s?t.push(s.globalIndex):(i=!0,e.push(l)),a?t.push(a.globalIndex):(i=!0,e.push(c)),i)continue;let h=new Set,u=new Set,d=new uX((h.add(s),h),(u.add(a),u),s.center,a.center,!1);WGe(d.cycles).cycle.forEach(m=>{t.push(m.globalIndex)})}return{lostPads:e,globalIndexArr:t}}function WGe(o){let t={length:0,cycle:new Set};for(let e=0;e<o.length;e++){let i=o[e].cycle;if(i.size<=2)return t.cycle=i,t;let n=0;i.forEach(s=>{if(s instanceof Ue||s instanceof YF)n+=s.length;else if(s instanceof Le){let a=as.getInstance().getPadLenByModel(s.model);a!=null&&(n+=a)}}),e<=0&&(t.length=n,t.cycle=i),t.length>=n&&(t.length=n,t.cycle=i)}return t}function zGe(o){let t=x.getInstance().unit,e={[tn.Nets]:()=>{let n=[];for(let a of ze.getAllNets()){let l=e5(a);l&&n.push(l)}n||(n=[]),n.push(...ze.getAllNoneNets());let s={};return n.forEach(a=>{let l=ze.getNetLength(a),c=ze.getSpecialColor(a).toString();s[a==null?void 0:a.toUpperCase()]={name:a,color:c,netLength:l,unit:t}}),s},[tn.RatlineNets]:()=>{let n=ze.getAllNets();return Pd(Object.values(fX(n)).filter(Boolean),"netName")},[tn.NetClasses]:()=>{let n=Array.from(te.getInstance().getAllNetClass());return Pd(n,"name").map(s=>({name:s.name,sub:s.getAllNets().map(a=>a.name)}))},[tn.Differentials]:()=>{let n=Array.from(te.getInstance().getAllNetDifferentials());return Pd(n,"name").map(s=>({name:s.name,sub:s.getAllNets().map(a=>a.name)}))},[tn.EqualLengthGroups]:()=>{let n=Array.from(te.getInstance().getAllEqualLengthGroups());return Pd(n,"name").map(a=>{let l,c;return a.netLengthTolerancePhysics&&(l=pOt(a),c=te.getInstance().getNetLengthTolerancePhysics(a.netLengthTolerancePhysics).netLengthTolerance),{name:a.name,targetNet:l,netLengthTolerance:c,unit:t,sub:a.getAllNets().map(h=>h.name)}})},[tn.PadsPairGroups]:()=>{let s=te.getInstance().getAllPadsPairGroupsInstances().map(c=>({groupName:c.groupName,groupColor:c.groupColor,details:c.details}));return Pd(s,"groupName").map(c=>{let h=c.groupName,u=c.groupColor,d=c.details;return{name:h,color:u,sub:d.map(p=>{let m={},g=`${p.pad1Title}-${p.pad2Title}`,y=Kt.getItem(p.pad1.id),b=Kt.getItem(p.pad2.id);y!=null?m[p.pad1Title]=`${ur}${y.number}`:m[p.pad1Title]=p.pad1Title,b!=null?m[p.pad2Title]=`${ur}${b.number}`:m[p.pad2Title]=p.pad2Title;let T=jF(p.pad1,p.pad2).netMinLength;return{name:g,netLength:T,unit:t,color:u,padsPairId:m}}).sort((p,m)=>m.netLength-p.netLength)}})}},r=[];switch(o==tn.NetComponents&&(o=tn.ALLNETROOT),o){case tn.ALLNETROOT:r=Object.keys(e);break;case tn.Nets:r=[o];break;default:r=[o,tn.Nets];break}let i={name:"netRoot"};return r.forEach(n=>{let s=e[n];s&&(i[n]=s())}),i}function YGe(){let o=Cr.getAllItem();return AM(o,"name").map(e=>({globalIndex:e.globalIndex,name:e.name||`${ur}${e.number}`,children:Pd(e.getPads().map(r=>({type:"Pad",globalIndex:r.globalIndex,deviceName:e.name,num:r.num,net:r.net,name:r.num+(r.net?`: ${r.net}`:"")})),"name")}))}function dD(o,t){o.forEach(a=>{let l=ze.getItem(a)||ze.getNoneNetsItem(a);te.getInstance().setSpecialColor(a,t);for(let h of l)if(h instanceof Ge||h instanceof Ue||h instanceof Le||h instanceof Ye){let u=be.getLayer(h.layerId);!h.color.equals(t)&&(h instanceof Ge||u&&!u.isPlaneLayer())&&(h.color=null),h.refreshRender()}zo.getRatlineByNetName(a).forEach(h=>h.refreshRender()),Ei.getAllItem().forEach(h=>{h.net==a&&h.refreshRender()}),ZS().forEach(h=>{h.type=="Copper Region"&&h.net==a&&h.refreshRender()}),Ql(a)}),A.publish("updateFrame","");let e={},r={},i={},n={};ze.getAllNoneNets().forEach(a=>{e[a]=ze.getSpecialColor(a).toString()}),ze.getAllNets().forEach(a=>{e[a]=ze.getSpecialColor(a).toString()});let s=Fu.getDesignRulers();s.Net.forEach(a=>{if(a.type==="netClass"){let l=a.sub[0];a.sub.every(h=>e[l.name]==e[h.name])&&l!=null&&(r[a.name]=e[l.name])}}),s.NetDifferentails.forEach(a=>{if(a.type==="netDifferentail"){let l=a.sub[0];a.sub.every(h=>e[l.name]==e[h.name])&&l!=null&&(n[a.name]=e[l.name])}}),s.Net.forEach(a=>{if(a.type==="equalLengthGroup"){let l=a.sub[0];a.sub.every(h=>e[l.name]==e[h.name])&&l!=null&&(i[a.name]=e[l.name])}}),A.publish("updateNetColor",{[tn.Nets]:e,[tn.NetClasses]:r,[tn.Differentials]:n,[tn.EqualLengthGroups]:i},$())}function jGe(o){let{netNames:t,color:e}=o;if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r=new ve("net color");t.forEach(i=>{r.addCommand(new Toe(i,ze.getSpecialColor(i),"modify"))}),je.executeCommand(r),dD(t,ee.of3(e)),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}function fX(o){let t={};return o.forEach(e=>{let r=zo.getRatlineByNetName(e)||[],i=[];if(r&&r.length>0){i=r.map(a=>{let l=a.getEndsInfo();return{name:[l.start.type,": ",l.start.id," - ",l.end.type,": ",l.end.id],id:a.globalIndex,globalIndex:`${ur}${a.number}`,startNode:a.startNode.globalIndex,endNode:a.endNode.globalIndex}});let s=te.getInstance().getNet(e).showRatline;t[e]={netName:e,ratlines:i,eyeState:s}}else t[e]=!1}),t}function pOt(o){let t=o.targetNet;if(t)return t;{let e=o.getAllNetIds(),r=e.map(n=>ze.getNetLength(n)),i=0;return r.forEach((n,s)=>{r[s]>r[i]&&(i=s)}),e[i]}}function e5(o){let t=ze.getItem(o.toUpperCase());return t?Array.from(t).map(e=>e.showNet).sort()[0]:null}function XGe(){A.messageBus.rpcService("getDifferentailOptions",t5),A.messageBus.rpcService("getDifferentailTitle",r5),A.messageBus.rpcService("getDifferentailPairList",o9e),A.messageBus.rpcService("getAllNetsList",fOt),A.messageBus.rpcService("getAllNetClassList",s9e),A.messageBus.rpcService("handleDifferentailManagerData",o=>new Promise((t,e)=>{(!x.getInstance().isactive||23==x.getInstance().doctype)&&t(!1);let r=Array.from(te.getInstance().getAllNetDifferentials()),i=[],n=[];r.forEach(l=>{if(o.findIndex(c=>c.name==l.name)<0)i.push({name:l.name,positiveNet:l.positiveNet.name,negativeNet:l.negativeNet.name});else{let c=l.positiveNet.name,h=l.negativeNet.name;o.forEach(u=>{let[d,p]=u.sub;d.name!==c&&n.push(c),p.name!==h&&n.push(h)})}});let s=[];r.forEach(l=>{s.push(l.name)}),te.getInstance().deleteNetDifferential(s);for(let l of i)l.positiveNet&&Ql(l.positiveNet),l.negativeNet&&Ql(l.negativeNet),x.getInstance().compiler.deleteRuleSelector(["DIFF_PAIR",l.name]);for(let l of n)Ql(l);o.forEach(l=>{var g,y,b,P;let c=l.name,h=(g=l.sub[0])==null?void 0:g.name,u=(y=l.sub[1])==null?void 0:y.name,d=l["Differential Pair"],p=te.getInstance().addNetDifferential(c,h,u,d),m=r.find(T=>T.name==c);(!s.includes(c)||((b=m==null?void 0:m.positiveNet)==null?void 0:b.name)!==h||((P=m==null?void 0:m.negativeNet)==null?void 0:P.name)!==u)&&(h&&Ql(h),u&&Ql(u),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",p)))}),A.publish("forceRenderTree",tn.Differentials,$()),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$());let a=Fu.getDesignRulers();t({NetDifferentails:a.NetDifferentails,option:a.option})})),A.messageBus.rpcService("getDifferentailBySuffix",o=>{let t=Fu.getDesignRulers(),{positiveNetSuffix:e,negativeNetSuffix:r}=o,i=c=>c.replace(/([\/*\\+?^$|\-()\[\]{}!])/g,function(h){return"\\"+h}),n=new RegExp(`(.+)(${i(e)})$`,"g"),s=new RegExp(`(.+)(${i(r)})$`,"g"),a={},l=[];t.NetDifferentails.filter(c=>{if(c.type!=="netDifferentail"&&c.name){let h=n.exec(c.name);n.lastIndex=0;let u=s.exec(c.name);if(s.lastIndex=0,h){let d=h[1];LIe(a,d).positiveNet=c.name}if(u){let d=u[1];LIe(a,d).negativeNet=c.name}}});for(let c in a){let{positiveNet:h,negativeNet:u}=a[c];h&&u&&l.push({title:c,positiveNet:h,negativeNet:u})}return new Promise((c,h)=>{c(l)})})}function t5(){let o=[],t=new Set;for(let e of te.getInstance().getAllNets()){let r=e5(e.name);r&&t.add(r)}return t.forEach(e=>{var n;let r=e,i=(n=ze.getItem(r.toUpperCase()))==null?void 0:n.size;r&&i>0&&o.push({value:e,text:e,showOriginalText:!0})}),o}function r5(){let o=Fu.getDesignRulers(),t=[];o.NetDifferentails.filter(n=>{if(n.type==="netDifferentail"&&n.name)return t.push(n.name),!0});let e=0,r=[],i=new RegExp("^DP[\\s_]*(\\d+)$","i");for(let n=0,s=t.length;n<s;n++)(e=t[n].match(i))&&(e=e[1]*1,r.indexOf(e)===-1&&r.push(e+""));return r=Pd(r),r.length?"DP"+(+r[r.length-1]+1):"DP1"}function o9e(){let o=Fu.getDesignRulers(),t=[];return o.NetDifferentails.filter(e=>{if(e.type==="netDifferentail")return t.push(e),!0}),t}function fOt(){let o=te.getInstance().getAllNets(),t=[];return o.forEach(e=>{e.name&&t.push({value:e.name,text:e.name})}),t}function s9e(o){let t=[];return o?te.getInstance().getAllNetClass().forEach(e=>{t.push({value:e.name,text:e.name})}):te.getInstance().getAllEqualLengthGroups().forEach(e=>{t.push({value:e.name,text:e.name})}),t}var XF=new S(1,0),mX=new S(1,1).normalize(),qF=new S(0,1),gX=new S(-1,1).normalize(),VT=class o extends ko{constructor(e,r){super();this.event=null;this.selectItems=[];this.fac=new mi().createGroup("selectMultiStart");this.wire=e,this.box=new yX,this.config=Ss.getInstance(e),this.tool=r}setSelectItems(e){this.selectItems=e}clearSelectItems(){this.selectItems=[]}onMouseLeftDown(e){let{sceneX:r,sceneY:i}=e,n;switch(this.wire){case"Single wiring":let a=this.config.doubleClickItem;a&&(r=a.center.x,i=a.center.y),n=a||go.clickHere(r,i);break;case"Differential pair wiring":n=go.diffClickHere(r,i);break;case"Multi-route wiring":n=this.selectItems;break}if(go.searchProhibitArea(r,i)&&this.wire!=="Multi-route wiring"){let a={...e,sceneX:r,sceneY:i};this.openViolateProhibitDialog(new S(r,i),{cb:()=>{this.confirm(a,n),this.tool.confirmResult()},cbCancel:()=>{}})}else this.confirm(e,n)}confirm(e,r){var s;let{sceneX:i,sceneY:n}=e;switch(this.wire){case"Single wiring":{if(r!=null&&go.checkDiffItem(r)){let{net:d}=go.getNet(r),p=te.getInstance().getNet(d);if(p!=null&&p.netDifferential!=null){if(this.event=this.getDiffPair(r,new S(i,n),!0,ce.pcbConfig.startTrackWidth,we.prevTrackWidth,this.config.userModifyWidth),!this.event)return;this.generateConnectNode(),this.consoleTrackEvent(this.event,r),be.setActiveLayerId(this.event.node.layerId);break}}let a=go.getItemAndPoint(r,i,n,e.adsorb,!0);if(!a)return;let l;if(a.select instanceof Ge){let u=go.canRouteByLayer([a.select]);u!=!1?l=u:a.select=null}let c=this.getSingleInfo(a.point,a.select,ce.pcbConfig.startTrackWidth,we.prevTrackWidth,this.config.userModifyWidth,l);this.event=new fC([c],[],c),this.getValidWidth(this.event.tracks,ce.pcbConfig.startTrackWidth);let h=(s=a.select)==null?void 0:s.model;h instanceof yt||h instanceof Je||h instanceof It?hf.getInstance().setStartItems([h]):hf.getInstance().setStartItems([null]),this.generateConnectNode(),this.consoleTrackInfo(c,r),be.setActiveLayerId(c.layerId);break}case"Differential pair wiring":{if(r!=null){let{net:a}=go.getNet(r),l=te.getInstance().getNet(a);if(l!=null&&l.netDifferential!=null){let c=this.getDiffPair(r,new S(i,n),!1,ce.pcbConfig.startTrackWidth,we.prevTrackWidth,this.config.userModifyWidth);if(!c)return;this.event=c,this.getValidWidth(this.event.tracks,ce.pcbConfig.startTrackWidth),this.generateConnectNode(),this.consoleTrackEvent(this.event,r),be.setActiveLayerId(this.event.node.layerId)}else this.prompt(a)}break}case"Multi-route wiring":{let a=r;a.length<=1?this.box.isBBox()?this.boxSelect(e):this.box.start(i,n):this.getMultiEventByItems(new S(i,n),a);break}}ie.publish("flushSelectingInfo","")}getValidWidth(e,r){if(r==="rule")return;let i=e.map(h=>{var u;return(u=h.start.model)==null?void 0:u.net}).filter(Boolean),n,s,a=!0,l=!0,c=new er;e.forEach(h=>{let u;h.start.model&&(u=c.getItem(h.start.model.globalIndex));let d=h.start.point,p=h.start.layerId,m=go.getMinDifWidth(u,d,p,i),g=go.getMaxDifWidth(u,d,p,i);we.prevTrackWidth<m&&(a=!1),we.prevTrackWidth>g&&(l=!1),n=n?Math.max(n,m):m,s=s?Math.min(s,g):g}),a?l||(we.prevTrackWidth=s,e.forEach(h=>h.width=s)):(we.prevTrackWidth=n,e.forEach(h=>h.width=n))}generateConnectNode(){this.event.tracks.forEach(r=>{hf.getInstance().getNodeList(r)})}consoleTrackEvent(e,r){e.tracks.forEach(n=>{this.consoleTrackInfo(n,r)})}consoleTrackInfo(e,r){var i,n;console.log("\u5BFC\u7EBF\u8D77\u70B9\u4FE1\u606F"),console.log(`start:(${e.start.point.x},${e.start.point.y}); layer:${e.layerId}; item:${(i=e.start.model)==null?void 0:i.globalIndex}, net:${e.net},width:${e.width}, direct:(${e.direct.x},${e.direct.y}),nextGap:${(n=e.next)==null?void 0:n.width},canModifyDirect:${e.start.allowModifyDirect},canModifyNet:${e.allowModifyNet},lineDirect:(${e.start.direct.x},${e.start.direct.y})`)}getControlTrack(e){let{sceneX:r,sceneY:i}=e,n=new ut(r,r,i,i);return hi.getInstance().update(),new sX().search4WireTree(n).filter(l=>l instanceof yt&&l.inShape(r,i))}getControlTrackIndex(e,r){if(e){let n=xt.getInstance().getNode(e).parent,s;if(r.result.wireMap.forEach((a,l)=>{n==a&&(s=l)}),s)return r.tracks.indexOf(s)}return-1}prompt(e){if(e==""||e==null)return;let r=new _0("No differential pair, do you want to create a differential pair?",()=>{ie.publish("openDifferentailDialog",{name:r5(),positiveNet:e,negativeNet:"",netOptions:t5()},$())});ie.publish("openMsgbox",r)}getSingleInfo(e,r,i,n,s,a){let l=go.getLayerId(r,a),c=go.getNet(r),h=go.getWidth(r,i,n,s,e,l),u=go.getViaRadius(e,r,this.config.userModifyViaSize),d=go.getDirect(e,r),p=go.getSignalLayerIds(r,l),m=r&&!Bt.checkIsCanEditByItem(r)?null:r==null?void 0:r.model,g=new hb(new Set(p),l,e,d.direct,d.allowModify,m),y=new hb(new Set([l]),l,e,d.direct,d.allowModify,m),b=new NF(this.config);u&&u.radius&&u.innerRadius&&(b.radius=u.radius,b.inner=u.innerRadius);let P=new lf(c.net,h,l,new S(1,0),c.allowModify,b);return P.start=g,P.end=y,P}getDiffPair(e,r,i,n,s,a){let l=go.getItemAndPoint(e,r.x,r.y,!0);e=l.select,r=l.point;let c=new WF(e,r,i);if(!c.success)return null;let h=this.getSingleInfo(c.start_P,c.positive,n,s,a,void 0),u=this.getSingleInfo(c.start_N,c.negative,n,s,a,void 0);e instanceof Ue?c.positive==e?u.width=h.width:h.width=u.width:c.positive instanceof Ue?u.width=h.width:c.negative instanceof Ue&&(h.width=u.width);let d=Ds(c.start_P,h.layerId,!0),p=Ds(c.start_N,h.layerId,!0),m=d.concat(p);QI(m);let g=fP(m,h.net,u.net,h.layerId);g==null&&(g=te.getInstance().getDifferentialPhysicsByNet(h.net).getDifferentialPairSpacingDefault(h.layerId));let y=new pC(g),b;e==c.positive?b=h:b=u;let{tracksInfo:P}=o.sort2(this.getSortItems([h,u],[c.positive,c.negative]),r,b),T=P.map(I=>I.info);return this.setStartItems(P),o.linked(T,[y]),new fC(T,[y],b)}setStartItems(e){let r=new Array;for(let i of e){let n=i==null?void 0:i.item.model;n instanceof yt||n instanceof Je||n instanceof It?r.push(n):r.push(null)}hf.getInstance().setStartItems(r)}getSortItems(e,r){let i=new Array;for(let n=0,s=e.length;n<s;n++){let a=e[n],l=r[n];i.push({info:a,item:l,project:0})}return i}getMultiInfos(e,r,i,n,s,a,l){let c=[],h,u=go.getMultiInfoItemByRatline(e,i,r),d=go.canRouteByLayer(u.selects),p=u.selects.map(I=>I.model),m=p.some(I=>I instanceof yt),g=p.every(I=>I instanceof yt)&&doe(p),y=new u_;if(u.selects.forEach((I,C)=>{let E=this.getItemInfo(I,u.points[C],n,s,a,d,l);C==u.selectNum&&(h=E),hf.getInstance().getNodeList(E),c.push({info:E,item:I,project:0})}),m)try{let I=c.filter(R=>R.item instanceof Ue).map(R=>R.item.model),C=K6(I.map(R=>Ot(R.primitive))),E=I.map(R=>C.dot(R.end)),O=E.findIndex(R=>R==Math.max(...E)),_=I[O];if(h=c.find(R=>R.item.model==_).info,y.needComplete(h,p)){let R=y.getStartRoutes(c.map(v=>v.info),h,g);for(let v=0;v<c.length;v++){let D=c[v].info;if(D!==h){let w=R[v];D.end.point=w.end()||D.end.point,D.start.point=w.end()||D.start.point,D.end.direct=Ot(w.primitives[w.primitives.length-1])||h.end.direct,D.start.direct=Ot(w.primitives[w.primitives.length-1])||h.start.direct,D.startAlignMap.set(D,w),D.direct=D.start.direct,D.end.direct=D.start.direct}}}}catch(I){console.error(I)}let{tracksInfo:b}=o.sort2(c,i,h),P=b.map(I=>I.info);this.setStartItems(b),this.getValidWidth(P,ce.pcbConfig.startTrackWidth);let T=o.getGapsByTracks(P);return o.linked(P,T),new fC(P,T,h)}static modifyDirect1(e,r,i){let n=[],s=e.filter(y=>{if(!y.info.start.allowModifyDirect)return!0;n.push(y)}),{direct:a,center:l}=o.getDirectAndCenter(e),c=r.sub(l).normalize(),h=new S(-a.y,a.x);h.dot(c)<0&&(h=new S(a.y,-a.x));let u=h,d=i?e.find(y=>y.info==i):null,p=!1;if(Ss.getInstance().wireMode==="Differential pair wiring"&&e.length===2){let[y,b]=e,P=y.info.start.direct,T=b.info.start.direct,I=E=>ne.eq(Math.abs(E.x),Math.abs(E.y)),C=ne.eq(Math.abs(P.dot(T)),0);I(P)&&I(T)&&C&&(u=P.add(T).normalize(),p=!0)}let m=!0;if(!p&&s.length!==0){xr(s,(b,P)=>b.info.start.point.distance2(r)-P.info.start.point.distance2(r));let y=i&&s.find(b=>b.info==i);if(s.length>0&&!y){let b={};s.forEach(I=>{let C=I.info.start.direct.toString();b[C]?b[C].push(I):b[C]=[I]});let P=0,T;for(let I in b){let C=b[I].length;if(P<C)T=b[I],P=C;else if(P==C){let E=T[0].info.start.direct,O=b[I][0].info.start.direct;E.dot(h)<O.dot(h)&&(T=b[I])}}d||(d=T[0]),u=T[0].info.start.direct}y&&(u=i.start.direct),m=!this.start4SameDirectTracks(e)}if(m){let y=mX.normalize(),b=gX.normalize(),P=[XF,XF.mul(-1),y,y.mul(-1),qF,qF.mul(-1),b,b.mul(-1)],T=null,I=null;P.forEach(C=>{let E=C.dot(u);T?ne.less(T,E)&&(T=E,I=C):(T=E,I=C)}),u=I}let g=a;return g.cross(u)<0&&(g=g.mul(-1)),m&&u&&e.forEach(y=>{y.info.start.direct=u.normalize(),y.info.direct=y.info.start.direct,y.info.end.direct=y.info.start.direct}),{sortDirect:g,center:l,lineDirect:u,control:d}}static start4SameDirectTracks(e){let r=null;for(let i of e)if(i.info.start.model instanceof yt){if(r==null)r=i.info.start.direct;else if(r.dot(i.info.start.direct)<.99)return!1}else return!1;return!0}getItemInfo(e,r,i,n,s,a,l){let c;if(e instanceof Le||e instanceof Ge)c=e.center;else{let d=new pD(e);if(d.endType==null&&d.startType==null){let p=r.distance2(e.start),m=r.distance2(e.end);if(p>m?c=e.end:c=e.start,l){let g=l.isContains(e.start),y=l.isContains(e.end);g&&!y?c=e.start:!g&&y&&(c=e.end)}}else d.endType==null?c=e.end:d.startType==null&&(c=e.start)}let h=!1,u=te.getInstance().getNet(e.net);return u!=null&&u.netDifferential!=null&&(h=!0),this.getSingleInfo(c,e,i,n,s,a)}static getDiffRule(e,r){let i;if(e){let n=te.getInstance().getRegion(e.globalIndex);n.diff?i=te.getInstance().getDifferentialPhysics(n.diff):i=te.getInstance().getDifferentialPhysicsByNet(r.net)}else i=te.getInstance().getDifferentialPhysicsByNet(r.net);return i}static getGapsByTracks(e){let r=[];for(let i=0;i<e.length-1;i++){let n=e[i],s=e[i+1],a=te.getInstance().getNet(n.net);if(a!=null&&a.netDifferential!=null&&te.getInstance().getNet(s.net).netDifferential==a.netDifferential){let m=Ds(n.end.point,n.layerId),g=Ds(s.end.point,s.layerId),y=fP(m,n.net,s.net,n.layerId),b=fP(g,n.net,s.net,s.layerId);y==null&&(y=te.getInstance().getDifferentialPhysicsByNet(n.net).getDifferentialPairSpacingDefault(n.layerId)),b==null&&(b=te.getInstance().getDifferentialPhysicsByNet(s.net).getDifferentialPairSpacingDefault(s.layerId));let P=Math.max(y,b);r.push(new pC(P));continue}let l=o.fixTrackDirect(n,s);l.equals1(n.start.direct)||(n.direct=l,s.direct=l);let c=n.start.point,h=s.start.point,u=Math.abs(h.sub(c).cross(l)),d=(n.width+s.width)/2;r.push(new pC(u-d))}return r}static fixTrackDirect(e,r){if(e.start.allowModifyDirect||r.start.allowModifyDirect)return e.start.direct;let i=e.start.direct,n=r.start.direct;if(i.equals1(n))return i;let s=new S(i.x,0).normalize(),a=new S(0,i.y).normalize(),l=new S(n.x,0).normalize(),c=new S(0,n.y).normalize(),h=s.add(l),u=a.add(c);return h.equals1(S.ORIGIN)&&!u.equals1(S.ORIGIN)?a:!h.equals1(S.ORIGIN)&&u.equals1(S.ORIGIN)?s:i}static getDirectAndCenter(e){let r=e.length;if(r==0)return;let i=e[0].info.start.point;for(let u=1;u<r;u++)i=i.add(e[u].info.start.point);i=i.mul(1/r);let n=0,s=0,a=0,l=0;for(let u of e){let d=u.info.start.point.sub(i).normalize();n+=Math.abs(XF.cross(d)),s+=Math.abs(mX.cross(d)),a+=Math.abs(qF.cross(d)),l+=Math.abs(gX.cross(d))}let c=[{sum:n,dir:XF},{sum:s,dir:mX},{sum:a,dir:qF},{sum:l,dir:gX}];return c.sort((u,d)=>u.sum-d.sum),{direct:c[0].dir,center:i}}static sort2(e,r,i){let{sortDirect:n,center:s,lineDirect:a,control:l}=o.modifyDirect1(e,r,i),c=a;for(let h of e)h.project=h.info.start.point.sub(s).dot(n);return e.sort((h,u)=>{let d=h.project-u.project;if(Math.abs(d)<1e-4){let p=h.info.start.point.sub(s).dot(c),m=u.info.start.point.sub(s).dot(c);return p-m}else return h.project-u.project}),{tracksInfo:e,control:l}}static sort(e){let r=e.length;if(r==0)return;let i=e[0].info.start.point;for(let d=1;d<r;d++)i=i.add(e[d].info.start.point);i=i.mul(1/r);let n=0,s=0,a=0,l=0;for(let d of e){let p=d.info.start.point.sub(i);n+=Math.abs(XF.cross(p)),s+=Math.abs(mX.cross(p)),a+=Math.abs(qF.cross(p)),l+=Math.abs(gX.cross(p))}let c=[{sum:n,dir:XF},{sum:s,dir:mX},{sum:a,dir:qF},{sum:l,dir:gX}];c.sort((d,p)=>d.sum-p.sum);let h=c[0].dir,u=new S(-h.y,h.x).normalize();for(let d of e)d.project=d.info.start.point.sub(i).dot(h);if(e.sort((d,p)=>{let m=d.project-p.project;if(Math.abs(m)<1e-4){let g=d.info.start.point.sub(i).dot(u),y=p.info.start.point.sub(i).dot(u);return g-y}else return d.project-p.project}),!e[0].info.start.allowModifyDirect)h.cross(e[0].info.start.direct)<0&&(e=e.reverse());else for(let d of e)d.info.start.direct=u,d.info.direct=d.info.start.direct,d.info.end.direct=d.info.start.direct;return e}static linked(e,r){for(let i=0;i<e.length;i++){let n=e[i],s=r[i];n.next=s,n.previous=r[i-1],s!=null&&(s.previous=n,s.next=e[i+1])}}onMouseMove(e){this.wire=="Multi-route wiring"&&jt.update(e,"Please select the start point or make a choice before entering the wiring process"),this.box.update(e.sceneX,e.sceneY)}onMouseLeftUp(e){if(this.wire!=="Multi-route wiring")return;go.searchProhibitArea(e.sceneX,e.sceneY)?this.openViolateProhibitDialog(new S(e.sceneX,e.sceneY),{cb:()=>{this.boxSelect(e),this.tool.confirmResult()},cbCancel:()=>{this.box.interrupt()}}):this.boxSelect(e)}boxSelect(e){let r=this.box.success(e.sceneX,e.sceneY),i=r&&go.multiBoxSelect(r.extendOfSize(.1),new S(e.sceneX,e.sceneY));if(i!=null&&i.length>1&&(i=i.filter(n=>Bt.checkIsCanEditByItem(n)),i.length>1)){let n=new S(e.sceneX,e.sceneY);this.getMultiEventByItems(n,i,r)}}getMultiEventByItems(e,r,i){var l;jt.cancel();let n,s;r.forEach((c,h)=>{if(c instanceof Ue&&c.length<=c.width){let u=Array.from(c.searchAllConnectNode1()).filter(p=>p instanceof Ue),d;for(let p of u)if(p.start.equals(c.end)){let m=Te.dispatch(p,"modify");this.fac.addCommand(m),p.rotateFor(p.model.center,Math.PI),d=p}else p.end.equals(c.start)&&(d=p);if(d){let p=Te.dispatch(c,"delete");this.fac.addCommand(p),p.remove(),r.splice(h,1,d)}}}),(l=this.fac.getCommand())!=null&&l.length&&ie.publish("updateRtree","");let a=this.getMultiNodes(r);a.length==1&&(this.config.lastMode=this.wire,this.wire="Single wiring",this.tool.modifyWireMode(this.wire)),a.forEach(c=>{let h;if(c instanceof Le||c instanceof Ge)h=e.distance1(c.center);else{let u=new M(e,e),d=new M(c.start,c.end);h=new ir(d,u).getLine().length()}(n==null||n>h)&&(s=c,n=h)}),this.event=this.getMultiInfos(a,s,e,ce.pcbConfig.startTrackWidth,we.prevTrackWidth,this.config.userModifyWidth,i),be.setActiveLayerId(this.event.node.layerId),this.consoleTrackEvent(this.event,s)}isUnion(e,r,i){let{net:n}=e,{net:s}=r;if(n==s){let l=e.bbox(),c=r.bbox(),h=a(e),u=a(r);if(!l.isSeparated(c))return l.isContainsBBox(c)?!0:VB(h,u)}function a(l){if(l instanceof Ge)return fe.build2([q.build2(l.center,0,360,l.radius,l.radius,le.CW)]);{let c=i===1?l.model.top:i===2?l.model.bottom:l.model.padStyle;return Fg(l.model,c,0)}}return!1}getMultiNodes(e){let r=[],i=[];e.forEach(h=>{h instanceof Ge||h instanceof Le?i.push(h):r.push(h)});let n=go.canRouteByLayer(i),s=i.length,a=new a9e(s);for(let h=0;h<s;h++)for(let u=h+1;u<s;u++)this.isUnion(i[h],i[u],n)&&a.union(h,u);let l=new Map;for(let h=0;h<s;h++){let u=a.find(h);l.has(u)||l.set(u,[]),l.get(u).push(i[h])}Array.from(l.values()).map(h=>c(h));function c(h){let u=null,d=0;for(let p=0;p<h.length;p++){let m=h[p].bbox().area();m>d&&(u=h[p],d=m)}u&&r.push(u)}return r}openViolateProhibitDialog(e,r){let i=new Poe({position:{x:e.x,y:e.y,error:0},cb:()=>{r.cb&&r.cb()},cbCancel:()=>{r.cbCancel&&r.cbCancel()}});ie.publish("openDialog",i)}clearDelteCommands(e=!1){var i;let r=(i=this.fac)==null?void 0:i.getCommand();if(r!=null&&r.length&&e)this.fac.undo(!1),this.fac=new mi().createGroup("selectMultiStart");else return r}interrupt(){var e;(e=this.box)==null||e.interrupt(),jt.cancel(),this.config.lastMode=null,ie.publish("flushSelectingInfo","")}},pD=class{constructor(t){let e=t.start,r=t.end;this.track=t,this.getConnectType(e,t.net,t.width,t.layerId),this.getConnectType(r,t.net,t.width,t.layerId,!1)}getConnectType(t,e,r,i,n=!0){let s=new ut(t.x,t.x,t.y,t.y),l=this.searchTracks(s,i).filter(h=>h!=this.track).map(h=>h),c=new Array;for(let h of l)h instanceof Ge||h instanceof Le?h.net==e&&h.center.equals1(t)&&c.push(h):h instanceof Ue&&h.net==h.net&&h.width==h.width&&h.layerId==i&&(h.start.equals1(t)||h.end.equals1(t))&&c.push(h);for(let h of c){let u=null;if((h instanceof Le||h instanceof Ge)&&(u=h),u!=null&&u.net==e&&u.center.distance2(t)<1e-4){n?h instanceof Le?this.startType=1:this.startType=2:h instanceof Le?this.endType=1:this.endType=2;return}if(h instanceof Si&&h.net==e&&(h.start.distance2(t)<1e-4||h.end.distance2(t)<1e-4)){n?this.startType=3:this.endType=3;return}if(h instanceof Ar&&h.net==e&&(h.start.distance2(t)<1e-4||h.end.distance2(t)<1e-4)){n?this.startType=6:this.endType=5;return}}}searchTracks(t,e){return Vt.search4Types(t,["Pad","Via","Track","ArcTrack"],(i,n)=>n=="Track"||n=="ArcTrack"?i==e:n=="Pad"?i==12||i==e:n=="Via").getTPV()}},yX=class{constructor(){this.mouseLeftX=0;this.mouseLeftY=0;this.isFirstMove=!0;this.startTime=0;this.minMoveTime=200}start(t,e){var r;this.mouseLeftX=t,this.mouseLeftY=e,this.isFirstMove=!0,this.startTime=Date.now(),(r=this.selectBox)==null||r.clear(),this.selectBox=new uoe(new S(t,e))}update(t,e){this.selectBox&&(this.selectBox.moveTo(t,e),Date.now()-this.startTime>this.minMoveTime&&(this.isFirstMove=!1))}getBBox(t,e){return this.selectBox?new _e().ext6(t,e).ext6(this.mouseLeftX,this.mouseLeftY).build1():null}isOtherBoxModel(t,e){return this.selectBox?ne.eq(Math.floor(t),Math.floor(this.mouseLeftX))&&ne.eq(Math.floor(e),Math.floor(this.mouseLeftY)):!1}success(t,e){if(this.selectBox){if(this.isFirstMove)return null;let r=new _e().ext6(t,e).ext6(this.mouseLeftX,this.mouseLeftY).build1();return ne.eq(r.width(),0)&&ne.eq(r.height(),0)?null:(this.selectBox.clear(),this.selectBox=null,r)}return null}isBBox(){return this.selectBox!=null}interrupt(){var t;(t=this.selectBox)==null||t.clear(),this.selectBox=null}},a9e=class{constructor(t){this.parent=Array(t).fill(0).map((e,r)=>r)}find(t){return this.parent[t]!==t&&(this.parent[t]=this.find(this.parent[t])),this.parent[t]}union(t,e){let r=this.find(t),i=this.find(e);r!==i&&(this.parent[i]=r)}};var mOt=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function Soe(o){return mOt[o]||0}var ug=class ug{static build(t,e,r){let i=this.getHash(t,e,r),n=this._colorCache[i];return n||(n=new ug(t,e,r),this._colorCache[i]=n),n}static getHash(t,e,r){return 31*(31*t+e)+r}static of(t){return ug.build(t>>16&255,t>>8&255,t&255)}constructor(t,e,r){this.R=t,this.G=e,this.B=r,this._hashed=ug.getHash(t,e,r)}toString(){return Td.format("#%02X%02X%02X",this.R,this.G,this.B)}hashCode(){return this._hashed}equals(t){return t instanceof ug?t.R===this.R&&t.G===this.G&&t.B===this.B:!1}};ug._colorCache={},ug.BLACK=ug.of(0),ug.WHITE=ug.of(16777215),ug.RED=ug.of(16711680),ug.GREEN=ug.of(65280),ug.BLUE=ug.of(255),ug.YELLOW=ug.of(16776960);var fD=ug;var l9e=class{constructor(t,e,r,i,n,s,a){this.id=t,this.name=e,this.color=r,this.visible=i,this.active=n,this.config=s,this.isSignal=!0,this.layer=a}},i5=class{constructor(t,e){this.idIndex={};this.layerIndex=new Bd;this.define(1,"TopLayer",16711680,!0,!0,!0,4,0),this.define(2,"BottomLayer",255,!0,!1,!0,7,0),this.define(3,"TopSilkLayer",16763904,!0,!1,!0,1,0),this.define(4,"BottomSilkLayer",6736947,!0,!1,!0,10,0),this.define(5,"TopPasteMaskLayer",8421504,!0,!1,!0,3,0),this.define(6,"BottomPasteMaskLayer",8388608,!0,!1,!0,8,0),this.define(7,"TopSolderMaskLayer",8388736,!0,!1,!0,2,0),this.define(8,"BottomSolderMaskLayer",11141375,!0,!1,!0,9,0),this.define(9,"Ratlines",6579455,!0,!1,!0,14,0),this.define(10,"BoardOutline",16711935,!0,!1,!0,11,0),this.define(11,"Multi-Layer",12632256,!0,!1,!0,0,0),this.define(12,"Document",16777215,!0,!1,!0,12,0),this.define(13,"TopAssembly",3394713,!0,!1,!0,13,1),this.define(14,"BottomAssembly",5592575,!0,!1,!0,13,2),this.define(15,"Mechanical",15737584,!1,!1,!1,13,3),this.define(19,"3DModel",6737151,!1,!1,!1,15,0),this.define(21,"Inner1",10066278,!1,!1,!1,5,1),this.define(22,"Inner2",32768,!1,!1,!1,5,2),this.define(23,"Inner3",65280,!1,!1,!1,5,3),this.define(24,"Inner4",12357120,!1,!1,!1,5,4),this.define(25,"Inner5",7396346,!1,!1,!1,5,5),this.define(26,"Inner6",52326,!1,!1,!1,5,6),this.define(27,"Inner7",10053375,!1,!1,!1,5,7),this.define(28,"Inner8",8388736,!1,!1,!1,5,8),this.define(29,"Inner9",32896,!1,!1,!1,5,9),this.define(30,"Inner10",1413983,!1,!1,!1,5,10),this.define(31,"Inner11",128,!1,!1,!1,5,11),this.define(32,"Inner12",46080,!1,!1,!1,5,12),this.define(33,"Inner13",3032918,!1,!1,!1,5,13),this.define(34,"Inner14",10060847,!1,!1,!1,5,14),this.define(35,"Inner15",16777130,!1,!1,!1,5,15),this.define(36,"Inner16",10060847,!1,!1,!1,5,16),this.define(37,"Inner17",3032918,!1,!1,!1,5,17),this.define(38,"Inner18",3487231,!1,!1,!1,5,18),this.define(39,"Inner19",8388796,!1,!1,!1,5,19),this.define(40,"Inner20",4435551,!1,!1,!1,5,20),this.define(41,"Inner21",12840142,!1,!1,!1,5,21),this.define(42,"Inner22",7506296,!1,!1,!1,5,22),this.define(43,"Inner23",3756095,!1,!1,!1,5,23),this.define(44,"Inner24",815453,!1,!1,!1,5,24),this.define(45,"Inner25",5933696,!1,!1,!1,5,25),this.define(46,"Inner26",2855806,!1,!1,!1,5,26),this.define(47,"Inner27",2333085,!1,!1,!1,5,27),this.define(48,"Inner28",4568291,!1,!1,!1,5,28),this.define(49,"Inner29",2186657,!1,!1,!1,5,29),this.define(50,"Inner30",4547799,!1,!1,!1,5,30),this.define(51,"Inner31",6908393,!1,!1,!1,5,31),this.define(52,"Inner32",9464297,!1,!1,!1,5,32),this.define(99,"ComponentShapeLayer",52428,!1,!1,!1,17,0),this.define(100,"LeadShapeLayer",13408665,!1,!1,!1,18,0),this.define(101,"Component Marking Layer",6750156,!1,!1,!1,19,0),this.define(102,"Drill drawing Layer",6750156,!1,!1,!1,20,0),this.logger=t,this.reOrderLayers(e)}reOrderLayers(t){let e=20;if(t!==null&&t.length>0){for(let r of t)if(r.type===5||r.type===6){e++;let i=this.idIndex[e];i.isSignal=r.type===5,this.layerIndex.put(r,i),this.logger.debug3("alias %s to %s",r,i.layer)}}}info1(t){return this.idIndex[t]}info2(t){let e=this.layerIndex.get(t);if(e!==null)return e;switch(t.type){case 0:return this.idIndex[11];case 14:return this.idIndex[9];case 7:return this.idIndex[2];case 8:return this.idIndex[6];case 10:return this.idIndex[4];case 9:return this.idIndex[8];case 12:return this.idIndex[12];case 5:return this.info1(Math.min(20+t.order,52));case 6:{let r=this.info1(Math.min(20+t.order,52));return r.isSignal=!1,r}case 13:return this.idIndex[15];case 11:return this.idIndex[10];case 15:return this.idIndex[19];case 4:return this.idIndex[1];case 3:return this.idIndex[5];case 1:return this.idIndex[3];case 2:return this.idIndex[7];default:return this.logger.warning3("unsupported layer type %d, use Document instead",t.type),this.idIndex[12]}}encode(t){let e=this.idIndex[t];return e===null?(this.logger.warning3("unknown layer id %d, use Document layer instead",t),this.idIndex[12].layer):e.layer.type===5?e.isSignal?e.layer:new $r(6,e.layer.order):e.layer}define(t,e,r,i,n,s,a,l){let c=new $r(a,l),h=new l9e(t,e,fD.of(r),i,n,s,c);this.idIndex[t]=h,this.layerIndex.put(c,h)}iterator(){return this.layerIndex.values()}};var n5=null,Eoe=null;function gOt(o){if(!n5){let t={5:7,7:5,6:8,8:6,9:null,10:11,11:12,12:13,13:9,14:10,15:14,19:null,99:48,102:56},e=-6;for(let r=21;r<=52;r++)t[r]=r+e;n5=t}return Ef(n5,o)?n5[o]:o}function yOt(o){if(!Eoe){gOt(1);let t={};for(let e in n5)n5[e]&&(t[n5[e]]=+e);Eoe=t}return Ef(Eoe,o)?Eoe[o]:o}var qGe=(function(){let o=new i5(new Gi(1),[]),t={},e=0;for(let r=1;r<=56;r++){e=yOt(r);let i=o.info1(e);i&&i.layer&&(t[r]=i.layer)}return t})();var sh=class o{constructor(t,e,r){this.name=t;let i=qGe[1];this.pcb_layer=new $r(i.type,i.order),e&&r&&this.parseEntity(e,r),this.dxfItems=[]}multiply3(t){let e=this.entity;return e.ports&&(this.entity.ports=this.verticesMultiply(this.entity.ports,t)),e.vertices&&(this.entity.vertices=this.verticesMultiply(this.entity.vertices,t)),this}validVertices(t){return t=t||this.entity.vertices,t&&t.length>0}isEof(t){return t.value=="EOF"}verticesBBox(t){let e=new _e;return t&&t.forEach(r=>{e.ext1(r.bbox())}),e.valid()||e.ext6(0,0),e.build1()}verticesMultiply(t,e){if(!t||!t.length)return console.warn("vertices is null"),null;let r=[];return t.forEach(i=>{r.push(i.multiply3(e))}),r}vector2Multiply(t,e){return t?t.multiply3(e):null}numberMultiply(t,e){return isNaN(t)?null:t*e.iScale}xyMultiply(t,e,r){return new S(t,e).multiply3(r)}autoPorts(){let t=this.entity.vertices;if(t||console.warn("entity has no vertices prop:",this.entity.type),t.length>=2){let e=t[0],r=t[t.length-1];if(e.equals(r))return;this.entity.ports=[e,r]}}cloneEntity(){if(!this.entity)return null;let t={},e,r=Object.keys(this.entity);for(let i=0;i<r.length;i++){let n=r[i],s=this.entity[n];if(!s||typeof s!="object")e=s;else if(s instanceof $r)e=new $r(s.type,s.order);else if(s instanceof S)e=new S(s.x,s.y);else if(Array.isArray(s)){if(s[0]instanceof S){e=[];for(let a of s)e.push(new S(a.x,a.y))}else if(s[0]instanceof o){e=[];for(let a of s)e.push(a.cloneOne())}}else s instanceof q?e=q.build2(s.center,s.startAngle,s.endAngle(),s.rx,s.ry,s.sweep()):s instanceof BS?e=new BS(s.net,s.layer,s.location,s.rotation,s.text,s.font,s.mirror):s instanceof o?e=s.cloneOne():e=Ls(s);t[n]=e}return t}entityDxfItems(){if(!this.entity.handle)throw console.error("entity.handle is null");return this.dxfItems=[],this.autoItem(0,this.name),null}autoItem(t,e){e==null&&(e=""),this.dxfItems.push([t,e])}autoDefault(t,e){return t==null?e:t}getLineStroke(t){let e=[0,5,9,13,15,18,20,25,30,35,40,50,53,60,70,80,90,100,106,120,140,158,200,211];if(e.includes(t))return t;{e.push(t);let r=e.sort((n,s)=>n-s),i=r.indexOf(t);return r[Math.abs(i-1)]}}};var o5=class o5 extends sh{constructor(t,e){super(o5.entityName,t,e)}cloneOne(){let t=new o5(null,null);return t.entity=this.cloneEntity(),t}isValid(){return!!this.entity.center}parseEntity(t,e){let r=this.initEntity();for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.center=ha(t);break;case 40:r.startWidth=e.value;break;case 41:r.endWidth=e.value;break;case 42:e.value!=0&&(r.bulge=e.value);break;case 70:r.curveFittingVertex=(e.value&1)!==0,r.curveFitTangent=(e.value&2)!==0,r.splineVertex=(e.value&8)!==0,r.splineControlPoint=(e.value&16)!==0,r.threeDPolylineVertex=(e.value&32)!==0,r.threeDPolylineMesh=(e.value&64)!==0,r.polyfaceMeshVertex=(e.value&128)!==0;break;case 50:break;case 71:r.faceA=e.value;break;case 72:r.faceB=e.value;break;case 73:r.faceC=e.value;break;case 74:r.faceD=e.value;break;default:Zd(r,e);break}e=t.next()}return this}initEntity(){return this.entity={type:o5.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,center:null,startWidth:null,endWidth:null,bulge:null,curveFittingVertex:null,curveFitTangent:null,splineVertex:null,splineControlPoint:null,threeDPolylineVertex:null,threeDPolylineMesh:null,polyfaceMeshVertex:null,faceA:null,faceB:null,faceC:null,faceD:null},this.entity}multiply3(t){return super.multiply3(t),this.entity.center=this.entity.center.multiply3(t),this.entity.startWidth=this.numberMultiply(this.entity.startWidth,t),this.entity.endWidth=this.numberMultiply(this.entity.endWidth,t),t.isMirrored()&&this.entity.bulge&&(this.entity.bulge=-this.entity.bulge),this}bbox(){let e=this.entity.center,r=e.x,i=e.y;return new ut(r-1,r+1,i-1,i+1)}entityDxfItems(){let t=this.entity;super.entityDxfItems();let e=$F(t,{curveFittingVertex:1,curveFitTangent:2,splineVertex:8,splineControlPoint:16,threeDPolylineVertex:32,threeDPolylineMesh:64,polyfaceMeshVertex:128},!0,0);this.autoItem(70,e);for(let r in t){let i=t[r];if(!w0(i))switch(r){case"center":Fh(this.dxfItems,i,10);break;case"startWidth":this.autoItem(40,i);break;case"endWidth":this.autoItem(41,i);break;case"bulge":this.autoItem(42,i);break;case"faceA":this.autoItem(71,i);break;case"faceB":this.autoItem(72,i);break;case"faceC":this.autoItem(73,i);break;case"faceD":this.autoItem(74,i);break;default:Jd(this.dxfItems,t,r);break}}return this.dxfItems}static builderNull(){let t=new o5(null,null);return t.initEntity(),t}};o5.entityName="VERTEXT";var b3=o5;function ha(o){let t={x:null,y:null,z:null};o.rewind();let e=o.next(),r=e.code;if(t.x=e.value,r+=10,e=o.next(),e.code!=r)throw new Error("Expected code for point value to be "+r+" but got "+e.code+".");return t.y=e.value,r+=10,e=o.next(),e.code!=r?(o.rewind(),c9e(t)):(t.z=e.value,c9e(t))}function Fh(o,t,e,r){!t||isNaN(t.x)||isNaN(t.y)||(gP(o,e,t.x||0),gP(o,e+10,t.y||0),r=r===void 0?t.z:r,Object.is(r,void 0)||gP(o,e+20,r))}function KF(o,t,e){t&&t.forEach(r=>{Fh(o,r,e)})}function c9e(o){return new S(o.x,o.y)}function bOt(o){let t=[];return o.forEach(e=>{t.push(c9e(e))}),t}var h9e=(h=>(h[h.handle=5]="handle",h[h.lineType=6]="lineType",h[h.layer=8]="layer",h[h.lineTypeScale=48]="lineTypeScale",h[h.visible=60]="visible",h[h.inPaperSpace=67]="inPaperSpace",h[h.ownerHandle=330]="ownerHandle",h[h.materialObjectHandle=347]="materialObjectHandle",h[h.lineweight=370]="lineweight",h[h.color=420]="color",h))(h9e||{});function Zd(o,t){let e=h9e[t.code];if(e)return o[e]=t.value,!0;switch(t.code){case 62:o.colorIndex=t.value,o.color=Soe(Math.abs(t.value));break;case 1e3:o.extendedData=o.extendedData||{},o.extendedData.customStrings=o.extendedData.customStrings||[],o.extendedData.customStrings.push(t.value);break;case 1001:o.extendedData=o.extendedData||{},o.extendedData.applicationName=t.value;break;case 100:o.subclassTag||(o.subclassTag=[]),o.subclassTag.push(t.value);default:return!1}return!1}function Jd(o,t,e){let r=h9e[e];if(!isNaN(r))return gP(o,r,t[e]),!0;switch(e){case"colorIndex":gP(o,62,t[e]);break;case"subclassTag":let i=t[e];Array.isArray(i)||(i=[i]),i.forEach(n=>{gP(o,100,n)});default:return!1}return!1}function gP(o,t,e){w0(e)&&(e=""),e=bX(t,e),!Object.is(e,NaN)&&o.push([t,e])}function bX(o,t){return o<=9?t:o>=10&&o<=59?parseFloat(t):o>=60&&o<=99?parseInt(Object.is(t,!0)||Object.is(t,!1)?t?"1":"0":t):o>=100&&o<=109?t:o>=110&&o<=149?parseFloat(t):o>=160&&o<=179?parseInt(t):o>=210&&o<=239?parseFloat(t):o>=270&&o<=289?parseInt(t):o>=290&&o<=299?t==="1"?1:0:o>=300&&o<=369?t:o>=370&&o<=389?parseInt(t):o>=390&&o<=399?t:o>=400&&o<=409?parseInt(t):o>=410&&o<=419?t:o>=420&&o<=429?parseInt(t):o>=430&&o<=439?t:o>=440&&o<=459?parseInt(t):o>=460&&o<=469?parseFloat(t):o>=470&&o<=481||o===999||o>=1e3&&o<=1009?t:o>=1010&&o<=1059?parseFloat(t):o>=1060&&o<=1071?parseInt(t):(console.log("WARNING: Group code does not have a defined type: %j",{code:o,value:t}),t)}function w0(o){return o==null||o===""}function Ooe(o,t){let e=[],r=!1,i=!1,n=4;for(let s=0;s<=n;s++){let a={x:null,y:null,z:null},l=!1;for(;t.value!=="EOF"&&!l&&!(t.code===0||i);){switch(t.code){case 10:case 11:case 12:case 13:if(r){i=!0;continue}a.x=t.value,r=!0;break;case 20:case 21:case 22:case 23:a.y=t.value;break;case 30:case 31:case 32:case 33:a.z=t.value;break;default:l=!0,o.rewind();break}t=o.next()}a.x!=null&&a.y!=null&&e.push(a),r=!1,i=!1}return o.rewind(),bOt(e)}function $Ge(o){let t={unit:39.37,name:"mm"};if(o!==0)if(o===1)t.unit=1e3,t.name="inch";else if(o===2)t.unit=12e3,t.name="ft";else if(o===3)t.unit=6336e4,t.name="mile";else if(o===4)t.unit=39.37,t.name="mm";else if(o===5)t.unit=393.7,t.name="cm";else if(o===6)t.unit=39370,t.name="m";else if(o===7)t.unit=3937007874e-2,t.name="km";else if(o===8)t.unit=1e3*1e-5,t.name="inch";else if(o===10)t.unit=36e3,t.name="yard";else if(o===11)t.unit=394e-7*1,t.name="nm";else if(o===12)t.unit=394e-7,t.name="nm";else if(o===13)t.unit=.039,t.name="um";else if(o===14)t.unit=3937,t.name="dm";else if(o===15)t.unit=39370*10,t.name="m";else if(o===16)t.unit=39370*100,t.name="m";else return t;return t}function ZF(o){return!o||o.length<2||o.push(o[0]),o}function KGe(o,t,e){let r=o[0].equals(t[0],e),i=o[1].equals(t[1],e),n=o[0].equals(t[1],e),s=o[1].equals(t[0],e);return r&&i||n&&s?[-1,-1]:r?[0,0]:i?[1,1]:n?[0,1]:s?[1,0]:null}function ZGe(o,t,e){let r=t.x-o.x,i=t.y-o.y,n=Math.sqrt(r*r+i*i)/2,s=Math.abs(e),a,l=s>=1,c=e>0?le.CCW:le.CW,h=Math.tan(Math.PI/8);if(s===1)a=n;else if(Math.abs(s-h)<1e-9)a=n*Math.SQRT2;else{let u=2*Math.atan(s);a=n/Math.sin(u)}return{radius:a,largeArcFlag:l,sweepFlag:c}}function Aoe(o,t){return o.forEach(e=>{e.multiply3(t)}),o}function JGe(o,t){let e=[],r=0;for(;t.value!=="EOF";){if(t.code===0){if(t.value==="VERTEX"){let i=new b3(o,t);e.push(i),t=o.lastReadGroup}else if(t.value==="SEQEND")break}if(++r>1e4)throw console.error("debug maxsize:",r)}return e}function $F(o,t,e,r){if(!o)return r;for(let i in t)if(Object.is(o[i],e))return t[i];return r}var mD=class{};var a0=class extends mD{constructor(t,e,r=!1){super(),this.x=t,this.y=e,this.isClick=r}doAction(t){return t.isSelect(this.x,this.y,this.isClick)}};var vd=class extends mD{doAction(t){return t instanceof Gy?!t.isEmpty&&Au.getActualVisibility(t):!t.isEmpty||t.isVisible||t.layerId&&!be.getLayer(t.layerId).visible}};var UT=class{constructor(){this.items=new Array}doAction(t){this.items.push(t)}};var s5=class{constructor(){this.outlines=new Array;this.slots=new Array;this.pours=new Array;this.regions=new Array;this.prohibits=new Array;this.constraints=new Array;this.teardrop=new Array;this.line=new Array;this.annotations=new Array;this.partitions=new Array;this.fpc=new Array;this.d3outlines=new Array;this.d3SideSlotRegion=new Array;this.d3TBSlotRegion=new Array;this.d3TBEntity=new Array;this.d3SideEntity=new Array;this.d3Screw=new Array;this.d3SideSlotDatumLine=new Array}doAction(t){if(t instanceof Ye)switch(t.type){case"Board Outline":{this.outlines.push(t);break}case"Slot Region":{this.slots.push(t);break}case"Copper Region":{this.pours.push(t);break}case"Fill Region":{this.regions.push(t);break}case"Prohibited Region":{this.prohibits.push(t);break}case"Constraint Region":{this.constraints.push(t);break}case"TearDrop":{this.teardrop.push(t);break}case"Line":{this.line.push(t);break}case"Annotation":{this.annotations.push(t);break}case"Partition":{this.partitions.push(t);break}case"FPC Stiffener":{this.fpc.push(t);break}case"3D Shell - Outline":{this.d3outlines.push(t);break}case"3D Shell - Side Slot Region":{this.d3SideSlotRegion.push(t);break}case"3D Shell - Top Slot Region":{this.d3TBSlotRegion.push(t);break}case"3D Shell - Top/Bottom Entity":{this.d3TBEntity.push(t);break}case"3D Shell - Side Entity":{this.d3SideEntity.push(t);break}case"3D Shell - Screw Pillar":{this.d3Screw.push(t);break}case"3D Shell - Side Datum Line":{this.d3SideSlotDatumLine.push(t);break}default:break}}clear(){this.outlines.length=0,this.slots.length=0,this.pours.length=0,this.regions.length=0,this.prohibits.length=0,this.constraints.length=0,this.teardrop.length=0,this.line.length=0,this.annotations.length=0,this.partitions.length=0,this.fpc.length=0,this.d3outlines.length=0,this.d3SideSlotRegion.length=0,this.d3TBSlotRegion.length=0,this.d3TBEntity.length=0,this.d3SideEntity.length=0,this.d3Screw.length=0,this.d3SideSlotDatumLine.length=0}};var go=class o{static clickHere(t,e){let r=Wr.wirePointSelect(t,e).getResult(Tre);return $t.filterWireElement(r,!1)}static getSingleItems(t,e){let r=new ut(t,t,e,e),i=Vt.search4Types(r,t4),n=new UT;i.setFilter(new a0(t,e)).setFilter(new vd).setAction(n),i.doAction(t4);let s=n.items;return $t.filterWireElement(s,!1)}static click4Items(t,e){let r=new ut(t,t,e,e),i=Vt.search4Types(r,t4),n=new UT;i.setFilter(new a0(t,e)).setFilter(new vd).setAction(n),i.doAction(t4);let s=n.items;return $t.filterWireElement(s,!0)}static click4ConnectNode(t,e,r){let i=new ut(t,t,e,e),n=Vt.search4Types(i,r),s=new UT;n.setFilter(new a0(t,e)).setFilter(new vd).setAction(s),n.doAction(r);let a=s.items;return $t.filterWireElement(a,!0)}static diffClickHere(t,e){let r=o.clickHere(t,e);return o.checkDiffItem(r)}static checkDiffItem(t){return t instanceof Ue||t instanceof Le||t instanceof Ge||t instanceof _n?t:null}static multiBoxSelect(t,e){let r=Ol(t),i=Wr.rtreeSearchNotOutside(r,!0),n=$t.filterWireElement(i.getResult(J8e),!0),s=new Array,a=new Array,l=new Array,c=new Array;for(let g of n)g instanceof Ue?s.push(g):g instanceof Le?l.push(g):g instanceof Ge?a.push(g):g instanceof _n&&c.push(g);let h="",u=!1;if(s.length+a.length+l.length==0){let g=o.getMultiInfoItemByRatline(c,e).selects;if(o.canRouteByLayer(g)==!1)A.publish("ui/toastMsg",{type:"warn",msg:"Multiple Routing can only be performed on graphic elements that are on the same layer simultaneously."},$());else{u=!0;for(let b of g)b instanceof Le?l.push(b):b instanceof Ue?s.push(b):b instanceof Ge&&a.push(b);s.length+a.length+l.length>0&&(h="Multiple routing lines are selected for flying wire, but are filtered by the right filter panel.")}}else{let g=new Array;if(s.length>0&&g.push("traces"),a.length>0&&g.push("vias"),l.length>0&&g.push("pads"),g.length>1){let y=g.pop();h=`Multiple routing lines are selected for ${g.join(",")} and ${y}, but are filtered by the right panel.`}else h=`Multiple routing lines are selected for ${g[0]}, but are filtered by the right panel.`}let d=new Array;Re.addAll(d,s),Re.addAll(d,l),Re.addAll(d,a);let p=d.length>0;return d=this.followFilter(d),p&&d.length==0&&A.publish("ui/toastMsg",{type:"warn",msg:h},$()),u?d:o.multiSelectEleFilter(d,e,t)}static boxSelect3(t){let e=Ol(t),r=Wr.rtreeSearchNotOutside(e,!0);return $t.filterWireElement(r.getResult(dd),!0).filter(i=>this.checkDiffItem(i))}static boxSelect(t,e){let r=Ol(t),i=Wr.rtreeSearchNotOutside(r,!0),n=$t.filterWireElement(i.getResult(dd),!0),s=o.multiSelectRatlineFilter(n);return s=this.followFilter(s),s.every(l=>l instanceof _n)?o.multiSelectRatline(s,e):o.multiSelectEleFilter(s,e,t)}static followFilter(t){let e=$t.getPick(4),r=$t.getPick(6),i=$t.getPick(9);return t.filter(n=>n instanceof Ue?e:n instanceof Le?r:n instanceof Ge?i:!0)}static multiSelectEleFilter(t,e,r){let i=t.filter(d=>d instanceof Ue||d instanceof Le||d instanceof Ge),n={};i.forEach(d=>{let p=d.net||"";n[p]||(n[p]=[]),d instanceof Ue?n[p].unshift(d):n[p].push(d)});let s=[];for(let d in n){let p=n[d],m=[],g=0;for(;g<p.length;g++){let b=p[g];if(b instanceof Ue){let P=a(b,r);P&&m.unshift({item:b,points:P})}else break}let y=p.slice(g);for(;m.length;){let b=m.pop(),P=l(b,m,e,y);s.push(P.item),m=P.directConnWire,y=P.other}s.push(...y)}function a(d,p){let m=new pD(d),g=[];return m.startType==null&&(p?p.isContains(d.start)&&g.push(d.start):g.push(d.start)),m.endType==null&&(p?p.isContains(d.end)&&g.push(d.end):g.push(d.end)),g.length?g:null}function l(d,p,m,g){let y=T(d.points,m),b=d.item,P=h(b);return p=p.filter(I=>{let C=P.has(I.item);return C&&T(I.points,m)<y&&(d=I),!C}),g=g.filter(I=>!P.has(I)),{directConnWire:p,item:d.item,other:g};function T(I,C){let E=C.distance2(I[0]);for(let O=1;O<I.length;O++){let _=C.distance2(I[O]);_<E&&(E=_)}return E}}function c(d){return!d.searchCycleNode().filter(m=>m instanceof Ue).find(m=>{let g=new ku(m.model);if(!g.startType||!g.endType)return!0})}function h(d){var y;let p=(y=Mh.getNode(d.net))==null?void 0:y.map.get(d.model),m=new er,g=new Set([d]);if(p!=null)for(let b of p.cluster()){let P=m.getItemByType(b.item.globalIndex,b.item.modelType);if(P!=null&&P!=d&&P instanceof ds){let T=b.item.modelType;if(T=="Copper"||T=="Inner")break;(T=="Pad"||T=="Via"||T=="Track"||T=="ArcTrack")&&g.add(P)}}return g}return o.canRouteByLayer(s)==!1?(o.multiFailMsg(),[]):s}static multiFailMsg(){A.publish("ui/toastMsg",{type:"error",msg:"Multiple Routing can only be performed on graphic elements that are on the same layer simultaneously."},$())}static canRouteByLayer(t){let e=[],r=[];t.forEach(c=>{c instanceof Ge?e.push(c):(c instanceof Ue||c instanceof Le&&c.layerId!=12)&&r.push(c)});let i;for(let c of r)if(i==null&&(i=c.layerId),c.layerId!=i)return!1;let n,s;for(let c of e)if(c.type==1){if(!n){let g=l(c.startLayer,c.endLayer);n=g.startLayer,s=g.endLayer;continue}let h=l(c.startLayer,c.endLayer),u=h.startLayer,d=h.endLayer,p=!1,m=!1;if(Ub(u,1,n,s)&&(n=u,p=!0),Ub(d,1,n,s)&&(s=d,m=!1),p||m||Ub(n,1,u,d))continue;return!1}if(i!=null)return n!=null?Ub(i,1,n,s)?i:!1:i;{let c=be.getActiveLayerID();return n!=null?Ub(c,1,n,s)&&be.getLayer(c).isSignalLayer()?c:a(n,s):c}function a(c,h){let u=15;if(be.getAllCopperLayerIds().forEach(d=>{d>u&&(u=d)}),c==1)return c;for(let d=c;d<=u;d++)if(be.getLayer(d).isSignalLayer())return d;return h==2?h:!1}function l(c,h){return c==2||h==1?[c,h]=[h,c]:c==1||h==2||c>h&&([c,h]=[h,c]),{startLayer:c,endLayer:h}}}static multiSelectRatlineFilter(t){return t.filter(e=>{if(e instanceof _n)return o.multiSelectRatlineFilter([e.startNode,e.endNode]).length>0;if(e instanceof Ue){let r=new pD(e);return r.startType==null||r.endType==null}return e instanceof Ge||e instanceof Le})}static multiSelectRatline(t,e){let r=o.multiSelectRatlineFilter(t),i=o.getMultiInfoItemByRatline(r,e).selects;return o.canRouteByLayer(i)==!1?(o.multiFailMsg(),[]):r}static getMultiInfoItemByRatline(t,e,r){let i=[],n=new Set,s=0,a=[];t.forEach(c=>{let h=c,u=e;if(!n.has(c)){if(n.add(c),c instanceof _n){let d=e.distance2(c.start),p=e.distance2(c.end);d>p?l(c.endNode)?(h=c.endNode,u=c.end):(h=c.startNode,u=c.start):l(c.startNode)?(h=c.startNode,u=c.start):(h=c.endNode,u=c.end),e=u}l(h)&&(r==c&&(s=i.length),i.push(h),a.push(u))}});function l(c){if(c instanceof Le||c instanceof Ue||c instanceof Ge)return!0}return{selects:i,selectNum:s,points:a}}static boxSelect2(t,e){let r=Ol(t),i=Wr.rtreeSearchNotOutside(r,!0),n=$t.filterWireElement(i.getResult(dd),!0);return o.multiSelectEleFilter2(n,e)}static multiSelectEleFilter2(t,e){return t.filter(r=>r instanceof _n?!1:r instanceof Ue?r.layerId==e.layerId&&r.net!=e.net:r instanceof Ge?r.model.isContains(e.layerId)&&!r.model.isUnuseLayer(e.layerId)&&r.net!=e.net:r instanceof Le?(r.layerId==12||r.layerId==e.layerId)&&r.net!=e.net:!1)}static getLayerId(t,e){let r=be.getActiveLayerID();if(e!=null){let n=be.getLayer(e);if(gs(n.type))return e}else if(t&&!t.model.isEmpty){let n=t.model.layerId,s=be.getLayer(n);if(gs(s.type))return n}let i=be.getLayer(r);return gs(i.type)?r:1}static searchProhibitArea(t,e){let r=be.getActiveLayerID(),i=new ut(t,t,e,e),n=Vt.search(i,(a,l)=>l&&S0.includes(l)&&a==r||a==12),s=new s5;n.setFilter(new vd).setFilter(new a0(t,e,!0)).setAction(s),n.doAction(S0);for(let a of s.prohibits)if(a.getComponent().track)return!0;return!1}static searchConstraints(t,e,r=!1,i=!1){let n=ut.extend3(t,t),s=Vt.search(n,(l,c)=>c==null?!1:S0.includes(c)),a=[];return s.setAction(new hC(l=>{if(l instanceof Ye&&l.type=="Constraint Region"&&(i||l.layerId==e||r&&l.layerId==12))return a.push(l.model),!0})),s.doAction(S0),QI(a)}static searchAllConstraints(t){let e=t.bbox(),r=Vt.search(e,(n,s)=>s==null?!1:S0.includes(s)),i=[];return r.setAction(new hC(n=>{n instanceof Ye&&n.type=="Constraint Region"&&i.push(n.model)})),r.doAction(S0),QI(i)}static handleRatlineItem(t,e,r,i){if(i&&t instanceof _n&&i){let n=new S(e,r),s=n.distance2(t.start),a=n.distance2(t.end);s>a?t=t.endNode:t=t.startNode}return t}static fixEndPosition(t,e=!0){let r=Pi.getInstance().adsorb,i=o.clickHere(t.x,t.y);return i instanceof _n?{select:null,point:t}:this.getItemAndPoint(i,t.x,t.y,r,e)}static getItemAndPoint(t,e,r,i,n=!1){let s=new S(e,r),a=t;if(!t)return a=null,{select:a,point:s};if(t&&!t.isSelect(e,r))return a=null,{select:a,point:s};if(!i&&!(t instanceof _n))return{select:a,point:s};if(t instanceof Ue)s=di.adsorpTrack(s,t);else if(t instanceof Le&&(!n||ce.adsorptionConfig.getConfig("Pad Center")))s=t.center;else if(t instanceof Ge)s=t.center;else if(t instanceof _n){let l=Bt.checkIsCanEditByItem(t.startNode),c=Bt.checkIsCanEditByItem(t.endNode);if(l&&c){let h=s.distance2(t.start),u=s.distance2(t.end);h>u?(s=t.end,a=t.endNode):(s=t.start,a=t.startNode)}else if(l)s=t.start,a=t.startNode;else if(c)s=t.end,a=t.endNode;else return{select:null,point:s}}return{select:a,point:s}}static getPoint(t,e,r,i){}static getNet(t){if(t==null)return{net:"",allowModify:o.canModifyNet(t)};{let e=this.getNetByItem(t);return{net:e,allowModify:o.canModifyNet(t,e)}}}static getNetByItem(t){let e=t.getParent();return e&&e instanceof Ye?e.showNet:Bo(t)}static canModifyNet(t,e){if(!t)return!0;if(t instanceof Le&&t.getParent()!=null||!w0(Bo(t))||!w0(e))return!1;if(t instanceof Ue||t instanceof ii||t instanceof Ye&&t.type=="Copper Region"||t instanceof Ge){let r=bie(t);return Array.from(r).every(i=>!(i instanceof Le&&i.getParent()!=null))}return!0}static getWidth(t,e,r,i,n,s,a){if(i)return r;if(t!=null&&t instanceof Ue)return t.width;if(e=="rule"){let l=a||t&&Bo(t)||"",c=Ds(n,s,!0),h=xm(c,l,s);if(h!=null)return h;{let u=te.getInstance().getNet(l);return u!=null&&(u==null?void 0:u.netDifferential)!=null?te.getInstance().getDifferentialPhysicsByNet(l).getStrokeWidthDefault(s):te.getInstance().getTrackPhysicsByNet(l).getDefaultWidth(s)}}return r}static getMinDifWidth(t,e,r,i){let n=t&&Bo(t)||"",s=te.getInstance().getNet(n),a=s&&s.netDifferential!=null,l=a&&i&&i.some(u=>!(s.netDifferential.positiveNet.hasNet(u)||s.netDifferential.negativeNet.hasNet(u)));a&&l&&(a=!1);let c=Ds(e,r,!0),h=_oe(c,n,r);return h!=null?h:a?te.getInstance().getDifferentialPhysicsByNet(n).getStrokeWidthMin(r):te.getInstance().getTrackPhysicsByNet(n).getMinWidth(r)}static getMaxDifWidth(t,e,r,i){let n=t&&Bo(t)||"",s=te.getInstance().getNet(n),a=s&&s.netDifferential!=null,l=a&&i&&i.some(u=>!s.netDifferential.positiveNet.hasNet(u)||!s.netDifferential.negativeNet.hasNet(u));a&&l&&(a=!1);let c=Ds(e,r,!0),h=voe(c,n,r);return h!=null?h:a?te.getInstance().getDifferentialPhysicsByNet(n).getStrokeWidthMax(r):te.getInstance().getTrackPhysicsByNet(n).getMaxWidth(r)}static getViaRadius(t,e,r){let i={radius:rt.defaultVia.radius,innerRadius:rt.defaultVia.innerRadius};if(r)return i;if(ce.pcbConfig.startViaSize=="rule"){let n;if(e){let s=Ds(t,o.getLayerId(e)),a=JF(s);if(a!=null)return a;{let l=o.getNetByItem(e);return n=te.getInstance().getRadiusPhysicsByNet(l),i={radius:n.defalutRadius,innerRadius:n.defalutInner},i}}else return n=te.getInstance().getRadiusPhysicsByNet(""),i={radius:n.defalutRadius,innerRadius:n.defalutInner},i}else return i}static getDirect(t,e){if(e instanceof Ar){let r=new pD(e);if(r.startType==null&&t.equals(e.start))return{direct:e.direct.mirrorCenter(),allowModify:!1};if(r.endType==null&&t.equals(e.end))return{direct:e.direct,allowModify:!1}}else if(e instanceof Si){let r=new pD(e);if(r.startType==null&&t.equals(e.start))return{direct:AF(e.primitive,!1),allowModify:!1};if(r.endType==null&&t.equals(e.end))return{direct:AF(e.primitive),allowModify:!1}}return{direct:new S(1,0),allowModify:!0}}static getSignalLayerIds(t,e){if(t instanceof Le||t instanceof Je)return gr(t.layerId)?$e.getInstance().getAllSignalLayerIds():[e];if(t instanceof Ge||t instanceof It)if(t.type==1){let r=$e.getInstance(),i=new Array;t.isContains(1)&&i.push(1);for(let n=15;n<=46;n++){if(!t.isContains(n))continue;let s=r.getLayer(n);s!=null&&s.config&&gs(s.type)&&i.push(n)}return t.isContains(2)&&i.push(2),i}else return $e.getInstance().getAllSignalLayerIds();else return[e]}static autoEndItem(t,e,r,i,n){let s=Vt.search(new ut(t.x,t.x,t.y,t.y),(u,d)=>d==null?!1:t4.includes(d)),a=new UT;s.setAction(a),s.doAction(t4);let l=a.items;n&&(n=n.filter(u=>u instanceof Je),l=l.filter(u=>!n.includes(u.model))),xr(l,(u,d)=>h(u)-h(d),0,l.length);let c=[e];i&&(c=i);for(let u of l)if(u instanceof Ue){if(c.includes(u.layerId)&&u.net==r&&u.isVisible&&u.isSelect(t.x,t.y))return u}else if(u instanceof Le){if((gr(u.layerId)||c.includes(u.layerId))&&u.net==r&&u.isSelect(t.x,t.y))return u}else if(u instanceof Ge){let d=!1;for(let p of c)if(u.isContains(p)){d=!0;break}if(d&&u.net==r&&u.isVisible&&u.isSelect(t.x,t.y))return u}else if(u instanceof Ye){let d=u.type;if(d!="Partition"&&d!="Board Outline"&&d!="Prohibited Region"&&d!="Slot Region"&&d!="Copper Region"&&d!="Constraint Region"&&u.net==r&&c.includes(u.layerId)&&u.isVisible&&u.isSelect(t.x,t.y))return u}return null;function h(u){return u instanceof Ue?2:u instanceof Le?0:u instanceof Ge?1:u instanceof Ye?3:1e3}}};function Ds(o,t,e=!0,r=!1){let i=go.searchConstraints(o,t,e,r);return i=i.filter(n=>n.inShape(o.x,o.y)),i}function xm(o,t,e){if(o.length>0){let r=te.getInstance().getNet(t),i=r!=null&&r.netDifferential!=null;for(let n of o){let s=te.getInstance().getRegion(n.globalIndex);if(i){if(s.diff)return te.getInstance().getDifferentialPhysics(s.diff).getStrokeWidthDefault(e)}else if(s.track)return te.getInstance().getTrackPhysics(s.track).getDefaultWidth(e)}return null}else return null}function _oe(o,t,e){if(o.length>0){let r=te.getInstance().getNet(t),i=r!=null&&r.netDifferential!=null;for(let n of o){let s=te.getInstance().getRegion(n.globalIndex);if(i){if(s.diff)return te.getInstance().getDifferentialPhysics(s.diff).getStrokeWidthMin(e)}else if(s.track)return te.getInstance().getTrackPhysics(s.track).getMinWidth(e)}return null}else return null}function voe(o,t,e){if(o.length>0){let r=te.getInstance().getNet(t),i=r!=null&&r.netDifferential!=null;for(let n of o){let s=te.getInstance().getRegion(n.globalIndex);if(i){if(s.diff)return te.getInstance().getDifferentialPhysics(s.diff).getStrokeWidthMax(e)}else if(s.track)return te.getInstance().getTrackPhysics(s.track).getMaxWidth(e)}return null}else return null}function JF(o){if(o.length>0){for(let t of o){let e=te.getInstance().getRegion(t.globalIndex);if(e.radius){let r=te.getInstance().getRadiusPhysics(e.radius);return{radius:r.defalutRadius,innerRadius:r.defalutInner}}}return null}else return null}function fP(o,t,e,r){let i=te.getInstance().getNet(t),n=i!=null&&i.netDifferential;if(n!=null&&n.hasNet(e))for(let a of o){let l=te.getInstance().getRegion(a.globalIndex);if(l.diff)return te.getInstance().getDifferentialPhysics(l.diff).getDifferentialPairSpacingDefault(r)}else for(let a of o){let l=te.getInstance().getRegion(a.globalIndex);if(l.safeClearance)return te.getInstance().getSafeSpacing(l.safeClearance).getClearance(0,0,r)}return null}function P3(o,t){if(o instanceof qr)return o.direct;if(o instanceof Oi){let e=o.center,r=t.sub(e).normalize();return o.sweep==le.CCW?new S(-r.y,r.x):new S(r.y,-r.x)}}var xoe=class{getConstraintListInfo(t,e,r,i,n){let s=this.getConstraintEvent(t,e,r,i,n);if(!s)return null;let a=t.tracks.length,l=Math.floor(a/2),c=new ri,h=new Br,u=new Array;for(let d=0;d<a;d++){let p=cf.getDistance(t,t.tracks[d]),g=cf.getDistance(s,s.tracks[d])-p,y=r[d];if(y.size()<=0){let H=c.createList();u.push(H);continue}let b=y.getAllItems(),P=b.map(H=>H.primitive),T=this.getDirect(b[0],b[0].start),I=this.getDirect(b[b.length-1],b[b.length-1].end),C,E;d>=l?(C=new S(T.y,-T.x),E=new S(I.y,-I.x)):(C=new S(-T.y,T.x),E=new S(-I.y,I.x));let O=b[0].start.add(C.mul(g)),_=b[b.length-1].end.add(E.mul(g));if(O.equals1(_)){u.push(c.createList());continue}let v=new Wne(O,_,P).result;this.debugPolyline(v,{color:ee.GREEN,msg:"panList",distance:g,net:t.tracks[d].net});let D=c.createList();for(let H of v)H instanceof q?c.drawInfoArcTrack([H],s.tracks[d],h,D):H instanceof M&&c.drawInfoTrack([H.start(),H.end()],s.tracks[d],h,D);let w=y.getFirstNode(),F=D.getFirstNode();for(;F&&w;)F.fanoutInfo=w.fanoutInfo||F.fanoutInfo,w=w.next,F=F.next;u.push(D)}return{increaseLists:u,command:h,event:s}}getDirect(t,e){if(t instanceof qr)return t.direct;if(t instanceof Oi){let r=t.center,i=e.sub(r).normalize();return t.sweep==le.CCW?new S(-i.y,i.x):new S(i.y,-i.x)}}debugPolyline(t,e={color:ee.GREEN}){if(Yr.debug&&this.debug!=null){let r=[];for(let i of t){let n=new eo(i,e);r.push(n)}this.debug.add(new Kd(r))}}sort(t){let e=t.listIterator(),r=[];for(;e.hasNext();){let i=e.next();J0(i.points,i.item),i.points.forEach(n=>{r.find(a=>a.point.equals1(n.point)&&a.model===n.model)||r.push(n)})}return r}add4Batch(t,e,r,i,n,s){let a=new Map;for(let c of t){let h=xt.getInstance().getNode(c.model).parent,u=a.get(h);u==null&&(u=[],a.set(h,u)),u.push(c)}let l=new Array;for(let[c,h]of a){let u=c.toArray();h.sort((C,E)=>{let O=u.indexOf(C.model),_=u.indexOf(E.model);if(O==_){let R=J0([C,E],C.model.primitive);return R.indexOf(C)-R.indexOf(E)}else return O-_});let d=h,p=r.indexOf(c),m=i.tracks[p],g=s.get(m);if(g&&(d=h.filter(C=>!g.find(E=>C.point.equals(E.point)))),!d.length)continue;let b=d[0].model,P=b.start,T=Jr.inPolyline(P,e);if(T&&d.some(C=>C.point.equals1(P))){let C=P3(b,P),E=Math.min(C.length(),b.length),O=P.add(C.mul(E)),_=n.inShape(O.x,O.y);T=T&&!_}d=d.splice(0,2);let I=null;for(let C of d){if(T){I=new a5(C),I.start=null,I.end=C,l.push(I),T=!1;break}I==null?(I=new a5(C),l.push(I)):(I.end=C,I=null)}}return l}isIncrease(t,e){return this.calculateIncrease(t,e)<0}changeTrackWidthByGroup(t,e,r,i,n){let s=r&&r.end!=null&&r.start==null,a=i&&i.end!=null&&i.start==null,l=r&&r.start,c=i&&i.start,h=t.width;if(l&&(h=xm([n],t.net,t.layerId)),s){let d=Ds(r.end.point,t.layerId).splice(1);h=xm(d,t.net,t.layerId)}let u=e.width;if(c&&(u=xm([n],e.net,e.layerId)),a){let d=Ds(i.end.point,e.layerId).splice(1);u=xm(d,e.net,e.layerId)}if(!h){let d=te.getInstance().getNet(t.net);d!=null&&(d==null?void 0:d.netDifferential)!=null?h=te.getInstance().getDifferentialPhysicsByNet(t.net).getStrokeWidthDefault(t.layerId):h=te.getInstance().getTrackPhysicsByNet(t.net).getDefaultWidth(t.layerId)}if(!u){let d=te.getInstance().getNet(e.net);d!=null&&(d==null?void 0:d.netDifferential)!=null?u=te.getInstance().getDifferentialPhysicsByNet(e.net).getStrokeWidthDefault(t.layerId):u=te.getInstance().getTrackPhysicsByNet(e.net).getDefaultWidth(t.layerId)}t.width=h,e.width=u}changeTrackSavespaceByGroup(t,e,r=!1,i,n,s){let a=i&&i.end!=null&&i.start==null,l=n&&n.end!=null&&n.start==null,c=i&&i.start,h=n&&n.start,u=t.next.width;if(a&&l){let d=Ds(i.end.point,t.layerId),p=Ds(n.end.point,e.layerId),m=QI(Array.from(d).concat(p).filter(g=>g!==s));u=fP(m,t.net,e.net,t.layerId),u||(r?u=te.getInstance().getDifferentialPhysicsByNet(t.net).getDifferentialPairSpacingDefault(t.layerId):u=te.getInstance().getSafeClearance({id:"",net:t.net,layerId:t.layerId,shapeType:0},{id:"",net:e.net,layerId:e.layerId,shapeType:0},t.layerId))}return c&&h&&(u=fP([s],t.net,e.net,t.layerId),u||(r?u=te.getInstance().getDifferentialPhysicsByNet(t.net).getDifferentialPairSpacingDefault(t.layerId):u=te.getInstance().getSafeClearance({id:"",net:t.net,layerId:t.layerId,shapeType:0},{id:"",net:e.net,layerId:e.layerId,shapeType:0},t.layerId))),t.end.model&&(u=t.next.width),t.next.width=u,u}getConstraintEvent(t,e,r,i,n){let s=t.clone(),a=s.tracks,l=t.node.layerId,c=D0.getInstance().getList(e),h=c.toArray(),u=this.sort(c);this.debugInters(u);let d=this.add4Batch(u,fe.build2(h),r,t,e,i);if(!d.length)return null;this.checkGroups(d,n,r,l,e),this.debugGroups(d);let p=ce.pcbConfig.startTrackWidth=="rule";for(let m=0;m<a.length-1;m++){let g=a[m],y=a[m+1],b=r[m],P=r[m+1],T=d.find(O=>O.list===b),I=d.find(O=>O.list===P),C=te.getInstance().getNet(g.net),E=g.net&&C&&C.hasNet(y.net);this.changeTrackSavespaceByGroup(g,y,E,T,I,e),p&&this.changeTrackWidthByGroup(g,y,T,I,e)}return s}checkGroups(t,e,r,i,n){var s,a,l,c;for(let h=0;h<r.length;h++){let u=r[h],d=e.get(h),p=t.find(m=>m.list===u);if(p){let m=p.start,g=p.end;if(m){let y=m.point,b=d.findIndex(T=>T.point.equals1(y));if(Ds(y,i)[0].globalIndex!==n.globalIndex){let T=null;for(let I=b+1;I<d.length;I++)d[I].type===0&&((s=Ds(d[I].point,i)[1])==null?void 0:s.globalIndex)===n.globalIndex&&(T=d[I].point);T?m.point=T:p.start=null}}if(g){let y=g.point,b=d.findIndex(T=>T.point.equals1(y)),P=Ds(y,i);if(P[0].globalIndex!==n.globalIndex){let T=null;for(let I=b-1;I>=0;I--)d[I].type===1&&((a=Ds(d[I].point,i)[1])==null?void 0:a.globalIndex)===n.globalIndex&&(T=d[I].point);T?g.point=T:p.end=null}if(m){let T=m.point,I=Ds(T,i);P[1]&&((l=I[1])==null?void 0:l.globalIndex)!=((c=P[1])==null?void 0:c.globalIndex)&&(p.end=null)}}}}}debugInters(t){if(t.length>0&&Yr.debug&&this.debug!=null)for(let e of t){let r=new eo(new M(e.point,e.point),{color:ee.GREEN}),i=new eo(e.model.primitive,{color:ee.Golden,net:e.model.net}),n=new FF(r,i,0);this.debug.add(n)}}debugGroups(t){if(t.length>0&&Yr.debug&&this.debug!=null)for(let e of t)e.debug(this.debug)}getDistance(t,e){return new Zu(t.primitive,e.primitive).getDistance()}calculateIncrease(t,e){return this.getEventWidth(t)-this.getEventWidth(e)}getEventWidth(t){let e=0;for(let r of t.tracks)e+=r.width;for(let r of t.gaps)e+=r.width;return e}};var Roe=class{constructor(t){this.stack=new Array;this.group=0;this.i=0;this.debug=!0;this.pause=!1;this.group=t}add(t){this.debug&&this.stack.push(t)}play(){this.isEnd()&&(this.i=0),this.stack[this.i].display(),ie.publish("updateFrame",""),this.i++}isStart(){return this.i==0}isEnd(){return this.i==this.stack.length}init(){for(let t of this.stack)t.remove();this.i=0}clear(){for(let t of this.stack)t.remove();ie.publish("updateFrame","")}};var gD=class extends hb{constructor(){super(...arguments);this.isEmpty=!1}},a5=class{constructor(t){this.end=null;this.parent=null;this.start=t,this.list=xt.getInstance().getNode(t.model).parent,this.net=t.model.net}debug(t){if(Yr.debug&&t!=null){let e=[];if(this.start!=null){let i=new eo(new M(this.start.point,this.start.point),{color:ee.BLUE,msg:"ConstraintTrackGroup"});e.push(i)}if(this.start!=null&&this.end!=null){let i=new eo(new M(this.start.point,this.end.point),{color:ee.BLUE,msg:"ConstraintTrackGroup"});e.push(i)}if(this.end!=null){let i=new eo(new M(this.end.point,this.end.point),{color:ee.BLUE,msg:"ConstraintTrackGroup"});e.push(i)}let r=new Kd(e);t.add(r)}}isSameList(t){return this.list==xt.getInstance().getNode(t.model).parent}getStartDirect(){return this.start!=null?this.start.model.direct:this.list.getFirst().direct}getEndDirect(){return this.end!=null?this.end.model.direct.mul(-1):this.list.getLast().direct.mul(-1)}getTrackInfo(){if(this.start!=null&&this.end!=null){let t=this.start.model.layerId,e=this.start.model.direct,r=new lf(this.start.model.net,this.start.model.width,t,e,!1);return r.start=new gD(new Set([t]),t,this.start.point,e,!1),r.end=new gD(new Set([t]),t,this.end.point,this.end.model.direct,!1),r}else if(this.start!=null&&this.end==null){let t=this.start.model.layerId,e=this.start.model.direct,r=new lf(this.start.model.net,this.start.model.width,t,e,!1);r.start=new gD(new Set([t]),t,this.start.point,e,!1);let i=this.list.getLast();return r.end=new gD(new Set([t]),t,i.end,i.direct,!1),r.end.isEmpty=!0,r}else if(this.start==null&&this.end!=null){let t=this.end.model.layerId,e=this.list.getFirst(),r=e.direct,i=new lf(this.end.model.net,this.end.model.width,t,r,!1);return i.start=new gD(new Set([t]),t,e.start,r,!1),i.end=new gD(new Set([t]),t,this.end.point,this.end.model.direct,!1),i.start.isEmpty=!0,i}}syncTrackInfo(t){if(this.start!=null&&this.end!=null){let e=P3(this.start.model,this.start.point);t.width=this.start.model.width,t.direct=e,t.start.point=this.start.point,t.start.direct=e,t.start.state=new ub(1,!0),t.end.direct=P3(this.end.model,this.end.point),t.end.point=this.end.point,t.end.state=new ub(1,!1),t.start.model=this.start.model,t.end.model=this.end.model}else if(this.start!=null&&this.end==null){let e=P3(this.start.model,this.start.point);t.width=this.start.model.width,t.direct=e,t.start.point=this.start.point,t.start.direct=e,t.start.state=new ub(1,!0);let r=this.list.getLast();t.end.point=r.end,t.end.direct=P3(r,r.end),t.end.state=new ub(3,!1),t.start.model=this.start.model,t.end.model=null}else if(this.start==null&&this.end!=null){let e=this.list.getFirst(),r=P3(e,e.start);t.direct=r,t.start.direct=r,t.start.state=new ub(3,!0),t.end.direct=P3(this.end.model,this.end.point),t.end.point=this.end.point,t.end.state=new ub(1,!1),t.start.model=null,t.end.model=this.end.model}}},T3=class o{constructor(){this.profiles=new Set;this.orders=new Map;this.blockShape=new hoe;this.points=new Map;this.startListMapPrimitives=new Map;this.endListMapPrimitives=new Map}run(t,e){this.initDebug(e);let r=t.clone();this.checkConstraint(e,r);let i=null;for(let n of this.profiles){this.points=new Map,r.position=t.position;let s=this.getConstraintEvents(n,e,r);if(s!=null){t.nextEvent=r;let a=new y3;for(let l=0;l<t.tracks.length;l++){let c=t.tracks[l],h=s.result[l];tr.getInstance().type!=="WIRING_CORNER_ARC"&&a.optimization(h,c,s.command)}i!=null&&i.undo(),e=s.result,i=s.command}}return Yr.inputClear(),this.clearList(),i==null?null:(t.result.command.addCommand(i),{result:e,command:i})}compareOrder(t,e){var n,s;if(!t)return-1;if(!e)return 1;let r=((n=t.component.name.match(/\d+$/))==null?void 0:n[0])||0,i=((s=e.component.name.match(/\d+$/))==null?void 0:s[0])||0;return Number(i)-Number(r)}runSingle(t,e){if(!e||e.size()<=0)return;let r=[e],i=t.clone();this.checkConstraint(r,i);let n=i.node,s=null,a=this.orders.get(0),l=a.order.length;for(let u=1;u<l;u++){let d=a.order[u],p=a.current,m=p.type,g=d.type;if(m==0){let O=Ds(p.point,n.layerId)[1];p.type=1,p.profile=O}let y=this.compareOrder(d.profile,p.profile);if(y==0||y>0)a.current=d;else continue;let b=this.initPathLists(i.tracks.length),P=new Br;this.checkConstraintProfile2(r);let T=this.splitEvent2(i,r,n);if(!T)continue;if(t.nextEvent=i,T.prev!=null){let E=this.interceptList(T.prev,r,!0,!1,n);this.addLists(b,E.result,P),E.command.undo()}let I=!1;g===0&&(I=!0);let C=this.interceptList(T.current,r,I,!1,n);if(this.addLists(b,C.result,P),C.command.undo(),n.width=T.current.node.width,T.next!=null){let E=!!T.prev;d.type==0&&Ds(a.current.point,t.node.layerId)[1]==a.order[0].profile&&(T.next.node.width=t.node.width);let O=this.interceptList(T.next,r,E,!1,n);this.addLists(b,O.result,P);let _=t.clone();_.node.width=T.next.node.width,t.nextEvent=_,n.width=T.next.node.width,O.command.undo()}s!=null&&s.undo(),r=b,s=P}if(this.clearList(),s==null)return null;t.result.command.addCommand(s);let c=t.tracks.indexOf(t.node);return r[c]}initDebug(t){if(Yr.debug){this.debug=new Roe(1),Yr.input(this.debug);for(let e of t){let r=e.iterator(),i=[];for(;r.hasNext();){let n=r.next(),s=new eo(n.primitive,{color:ee.Golden,id:n.globalIndex,net:n.net,width:n.width});i.push(s)}this.debug.add(new Kd(i))}this.blockShape.debug=this.debug}}clearList(){for(let t of this.profiles){let e=D0.getInstance().getList(t);this.clear(e)}this.profiles.clear(),Yr.debug&&Yr.inputClear()}checkConstraint(t,e){this.clearList();for(let i of t){if(i.size()==0)continue;let n=i.getAllItems();for(let s of n){let a=this.blockShape.blockTrack(s,s.primitive);xr(a,(l,c)=>this.constraintDistance(s,l)-this.constraintDistance(s,c)),Re.addAllSet(this.profiles,a)}}let r=0;for(let i of t){if(i.size()===0)continue;let n=this.getBlockPointOrder(i,e);this.orders.set(r++,{current:n[0],order:n})}}getBlockPointOrder(t,e){let r=t.getAllItems(),i=new Set;for(let l of r){let c=this.blockShape.blockTrack(l,l.primitive);Re.addAllSet(i,c)}let n=[];for(let l of i){this.checkConstraintProfile([t],l);let c=D0.getInstance().getList(l),h=c.toArray(),u=this.sort(c);if(!u.length)continue;let d=this.add4Batch(u,fe.build2(h),[t],e,l),p=d[0].start,m=d[0].end;p&&n.push({type:1,point:p.point,profile:l}),m&&n.push({type:0,point:m.point,profile:l})}let s=t.getFirst().start,a=Ds(s,e.node.layerId)[0];return xr(n,(l,c)=>l.point.distance1(s)-c.point.distance1(s)),a?n.unshift({type:1,point:s,profile:a}):n.unshift({type:1,point:s,profile:null}),n}constraintDistance(t,e){let i=D0.getInstance().getList(e).toArray(),n=1/0;for(let s of i){let a=Tt(s,t.primitive);for(let l=0;l<a;l+=2){let h=new S(Ee[l],Ee[l+1]).sub(t.start).length();n>h&&(n=h)}}return n}checkConstraintProfile(t,e){let r=D0.getInstance().getList(e);this.clear(r);for(let i of t){let n=i.listIterator();for(;n.hasNext();){let a=n.next().item;this.blockShape.blockTrackProfile(a,a.primitive,e)}}}checkConstraintProfile2(t){for(let[e,r]of this.orders){let i=t[e],n=r.current.profile,s=D0.getInstance().getList(n);this.clear(s);let a=i.listIterator();for(;a.hasNext();){let c=a.next().item;this.blockShape.blockTrackProfile(c,c.primitive,n)}}}splitPath2(t,e){let r=[];return t.forEach((i,n)=>{let s=[],a=i.getFirstNode();for(;a;)s.push(a),a=a.next;let l=e[n],c=[];if(l){for(a=l.getFirstNode();a;)c.push(a),a=a.next;let h=c.length,d=s.length-h,p=s.splice(d);return r.push([s,p])}else{r.push([s,[]]);return}}),r}splitPath(t,e){let r=[];return t.forEach((i,n)=>{let s=[],a=e[n],l=i.getFirstNode();for(;l;)s.push(l),l=l.next;let c=s.indexOf(a);if(c<0)return r.push([s,[]]);{let h=s.splice(c+1);return r.push([s,h])}}),r}moveEndFanout(t,e,r,i){var s;let n=t[0];for(;n&&!n.fanoutInfo;)n=n.next;if(n&&n.fanoutInfo){let a=n.fanoutInfo,l=e[e.length-1],c=l.item.end,h=l.item.width+r+n.item.width;if(!(n.item.start.distance1(c)>=h)){let u=Math.cos(Math.PI/4),d=Math.abs(a.delta*u),p=h-d,m=(s=n.next)==null?void 0:s.item,g=m==null?void 0:m.direct;if(g){let y=new S(-g.y,g.x),b=c.add(y.mul(2)),P=Vb(c,b,m.start,m.end),T=P.sub(c).length();if(T<p){let I=Math.sqrt(p*p-T*T),C=P.sub(m.start).length();I-=C,this.moveEndPath(n,t,I*u,i)}}}}}changeDiffEndFanout(t,e,r,i,n){let s=r.tracks,a=i.tracks,l=r.tracks.length,c=Math.floor(l/2),h=this.splitPath(t,e);for(let u=0;u<l-1;u++){let d=s[u],p=s[u+1],m=a[u],g=a[u+1],y=!1,b=te.getInstance().getNet(d.net);if(b&&b.netDifferential&&te.getInstance().getNet(p.net).netDifferential==b.netDifferential&&(y=!0),y){let P=d.next,T=m.next;if(P==null||T==null)return;let I=P.preWidth+d.width/2+p.width/2,C=T.width+m.width/2+g.width/2;if(I==C)return;if(I>C){let E=h[u][0],O=h[u][1],_=h[u+1][0],R=h[u+1][1];O&&O.length>0&&R&&R.length>0&&(this.moveEndFanout(O,_,T.width,n),this.moveEndFanout(R,E,T.width,n))}u+=1}}}moveFanout(t,e,r,i){let n=t[t.length-1];for(;n&&!n.fanoutInfo;)n=n.prev;if(n&&n.fanoutInfo){let s=n.fanoutInfo,a=e[0],l=a.item.start,c=a.item.width+r+n.item.width;if(!(n.item.start.distance1(l)>=c)){let h=Math.cos(Math.PI/4),u=Math.abs(s.delta*h),d=c-u,p=n.prev;if(p==null)return;let m=p.item.direct;if(p&&m){let g=new S(-m.y,m.x),y=l.add(g.mul(2)),b=Vb(l,y,p.item.start,p.item.end);if(b==null)return;let P=b.sub(l).length();if(P<d){let T=Math.sqrt(d*d-P*P),I=b.sub(p.item.end).length();T-=I,this.movePath(n,t,T*h,i)}}}}}changeDiffFanout(t,e,r,i,n){let s=r.tracks,a=i.tracks,l=r.tracks.length,c=this.splitPath(t,e);for(let h=0;h<l-1;h++){let u=s[h],d=s[h+1],p=a[h],m=a[h+1],g=!1,y=te.getInstance().getNet(u.net);if(y&&y.netDifferential&&te.getInstance().getNet(d.net).netDifferential==y.netDifferential&&(g=!0),g){let b=u.next,P=p.next,T=b.preWidth+u.width/2+d.width/2,I=P.width+p.width/2+m.width/2;if(T==I)return;if(T<I){let C=c[h][0],E=c[h][1],O=c[h+1][0],_=c[h+1][1];E&&E.length>0&&_&&_.length>0&&(this.moveFanout(C,_,P.width,n),this.moveFanout(O,E,P.width,n))}h+=1}}}movePath(t,e,r,i){let n=e.indexOf(t),s=e[n-1],a=e[n+1];if(!s||!t)return;let c=s.item.direct.mul(-1),h=s.item.start,u=this.getDistByDirect(s.item.end,c,r),d=this.getDistByDirect(t.item.start,c,r),p=this.getDistByDirect(t.item.end,c,r),m=t.item.end,g=t;a&&(m=a.item.end,g=a);let y=new ri,b=y.createList(),P=y.createTrack(s.item.layerId,h,u,s.item.width,s.item.showNet,i,s.item.getGroupID()),T=y.createTrack(t.item.layerId,d,p,t.item.width,t.item.showNet,i,t.item.getGroupID()),I=y.createTrack(g.item.layerId,p,m,g.item.width,g.item.showNet,i,g.item.getGroupID());y.addList(P,b,i),y.addList(T,b,i),y.addList(I,b,i);let C=b.getFirstNode().next;C.fanoutInfo=t.fanoutInfo,b.replace(s,g),i.addCommand(new Ti(b))}moveEndPath(t,e,r,i){let n=e.indexOf(t),s=e[n+1],a=e[n-1];if(!s||!t)return;let l=s.item.direct,c=this.getDistByDirect(s.item.start,l,r),h=s.item.end;if(h.sub(c).dot(l)<0)return;let p=this.getDistByDirect(t.item.start,l,r),m=this.getDistByDirect(t.item.end,l,r),g=t.item.start,y=t;a&&(g=a.item.start,y=a);let b=new ri,P=b.createList(),T=b.createTrack(y.item.layerId,g,p,y.item.width,y.item.showNet,i,y.item.getGroupID()),I=b.createTrack(t.item.layerId,p,m,t.item.width,t.item.net,i,t.item.getGroupID()),C=b.createTrack(s.item.layerId,c,h,s.item.width,s.item.showNet,i,s.item.getGroupID());b.addList(T,P,i),b.addList(I,P,i),b.addList(C,P,i);let E=P.getFirstNode().next;E.fanoutInfo=t.fanoutInfo,P.replace(y,s),i.addCommand(new Ti(P))}getDistByDirect(t,e,r){return t.add(e.mul(r))}getPreEndNodes(t){let e=[];return t.forEach(r=>{let i=r.getLastNode();e.push(i)}),e}getOrderMap(t,e){let r=new Map,i=0;for(let n of t){let s=this.getBlockPointOrder(n,e);r.set(i++,s)}return r}getConstraintEvents(t,e,r){let i=this.getOrderMap(e,r);this.checkConstraintProfile(e,t);let n=new xoe,s=n.getConstraintListInfo(r,t,e,this.points,i);return s?n.isIncrease(r,s.event)?this.increaseFanout(r,e,s,t):this.decreaseFanout(r,e,s,t):null}increaseFanout(t,e,r,i){let n=r.increaseLists;this.checkConstraintProfile(n,i);let s=new Br,a=this.splitEvent(t,n,i),l=e.length,c=this.initPathLists(l);if(a.prev!=null){this.syncChangeEvent(a.current,r.event,a.next?null:r.increaseLists);let h,u,d=this.alignPath(r.event,n,a.prev),p=this.fanout90(d.cornerEvent,e,t,r.event);this.addLists(c,d.startResult,s),this.addLists(c,p.result,s),this.addLists(c,d.endResult,s),d.command.undo(),p.command.undo(),u=this.getPreEndNodes(c);let m=this.interceptList(a.current,n,!1,!1);if(this.addLists(c,m.result,s),m.command.undo(),a.next!=null){h=this.getPreEndNodes(c);let g=this.alignPath(r.event,n,a.next),y=this.fanout90(g.cornerEvent,e,t,r.event);this.addLists(c,g.startResult,s),this.addLists(c,y.result,s),this.addLists(c,g.endResult,s),g.command.undo(),y.command.undo()}u&&this.changeDiffFanout(c,u,t,r.event,s),h&&this.changeDiffEndFanout(c,h,r.event,t,s),a.next==null&&this.syncCloneEvent(t,r.event,n);for(let g=0;g<l;g++)c[g].size()==0&&this.addList(c[g],e[g],s);return r.command.undo(),{result:c,command:s}}else{let h,u=this.alignPath(t,r.increaseLists,a.current),d=this.fanout90(u.cornerEvent,e,t,r.event);if(this.addLists(c,u.startResult,s),this.addLists(c,d.result,s),this.addLists(c,u.endResult,s),u.command.undo(),d.command.undo(),a.next!=null){this.syncChangeEvent(a.next,r.event,r.increaseLists),h=this.getPreEndNodes(c);let p=this.interceptList(a.next,e,!1,!1);this.addLists(c,p.result,s),p.command.undo(),h&&this.changeDiffFanout(c,h,t,r.event,s),this.syncCloneEvent(t,r.event,n)}for(let p=0;p<l;p++)c[p].size()==0&&this.addList(c[p],e[p],s);return r.command.undo(),{result:c,command:s}}}decreaseFanout(t,e,r,i){let n=e.length,s=this.initPathLists(n),a=new Br,l=this.splitEvent(t,e,i);if(l.prev!=null){let c,h;this.syncChangeEvent(l.current,r.event,l.next?null:r.increaseLists);let u=this.interceptList(l.prev,e,!0);this.addLists(s,u.result,a),u.command.undo(),h=this.getPreEndNodes(s);let d=this.alignPath(t,e,l.current),p=this.fanout90(d.cornerEvent,r.increaseLists,t,r.event);if(this.addLists(s,d.startResult,a),this.addLists(s,p.result,a),this.addLists(s,d.endResult,a),d.command.undo(),p.command.undo(),l.next!=null){c=this.getPreEndNodes(s);let m=this.interceptList(l.next,e,!0,!1);this.addLists(s,m.result,a),m.command.undo()}h&&this.changeDiffEndFanout(s,h,t,r.event,a),c&&this.changeDiffFanout(s,c,r.event,t,a),l.next==null&&this.syncCloneEvent(t,r.event,r.increaseLists);for(let m=0;m<n;m++)s[m].size()==0&&this.addList(s[m],e[m],a);return r.command.undo(),{result:s,command:a}}else{let c,h=this.interceptList(l.current,e,!0);if(this.addLists(s,h.result,a),h.command.undo(),l.next!=null){this.syncChangeEvent(l.next,r.event,r.increaseLists),c=this.getPreEndNodes(s);let u=this.alignPath(t,e,l.next),d=this.fanout90(u.cornerEvent,r.increaseLists,t,r.event);this.addLists(s,u.startResult,a),this.addLists(s,d.result,a),this.addLists(s,u.endResult,a),u.command.undo(),d.command.undo(),c&&this.changeDiffEndFanout(s,c,t,r.event,a),this.syncCloneEvent(t,r.event,r.increaseLists)}for(let u=0;u<n;u++)s[u].size()==0&&this.addList(s[u],e[u],a);return r.command.undo(),{result:s,command:a}}}syncChangeEvent(t,e,r){e.gaps.forEach((i,n)=>{t.gaps[n].width=i.width}),e.tracks.forEach((i,n)=>{t.tracks[n].width=i.width}),r&&t.tracks.forEach((i,n)=>{r[n].size()&&(i.end.point=r[n].getLast().end)})}syncCloneEvent(t,e,r){t.gaps.forEach((i,n)=>{i.width=e.gaps[n].width}),t.tracks.forEach((i,n)=>{if(r[n].size()){let s=r[n].getLast();i.width=e.tracks[n].width,i.end.point=s.end}})}interceptList(t,e,r=!1,i=!0,n){var u,d;let s=t.tracks.length,a=t.getCornerEvent(),l=new Array(s),c=new ri,h=new Br;for(let p=0;p<s;p++){let m=t.tracks[p];if(n&&n.net!=m.net)continue;let g=a.tracks[p],y=m.start.state,b=m.end.state;if(y instanceof ub&&y.state==1?g.start.fix=!1:g.start.fix=!0,b instanceof ub&&b.state==1?g.end.fix=!1:g.end.fix=!0,!g.start.fix||!g.end.fix){let P=n?e[0]:e[p];if(P){let T=P.getAllItems(),I=T.map(R=>R.primitive),C=new bc(g.start.point,g.end.point,I),E=C.result,O=new Map;if(r){let R=I.indexOf(C.startpt);E.forEach((v,D)=>{O.set(v,T[R+D])})}this.debugPolyline(E,{color:ee.GREEN,msg:"interceptList"});let _=c.createList();for(let R of E)R instanceof q?c.drawInfoArcTrack([R],t.tracks[p],h,_,(u=O.get(R))==null?void 0:u.width):R instanceof M&&c.drawInfoTrack([R.start(),R.end()],t.tracks[p],h,_,(d=O.get(R))==null?void 0:d.width);if(l[p]=_,i){let R=P.getFirstNode(),v=_.getFirstNode();for(;v&&R;){let D=R.fanoutInfo;D&&(v.fanoutInfo=D),R=R.next,v=v.next}}}}}return{result:l,command:h}}addLists(t,e,r){let i=t.length;for(let n=0;n<i;n++)this.addList(t[n],e[n],r)}getStartPrimitives(t){let e=this.startListMapPrimitives.get(t);return e==null&&(e=t.getAllItems().map(i=>i.primitive),this.startListMapPrimitives.set(t,e)),e}getEndPrimitives(t){let e=this.endListMapPrimitives.get(t);return e==null&&(e=this.getStartPrimitives(t),e=MGe(e),this.endListMapPrimitives.set(t,e)),e}initPathLists(t){let e=new ri,r=new Array(t);for(let i=0;i<t;i++)r[i]=e.createList();return r}addList(t,e,r){if(e==null)return;let i=new ri,n=e.listIterator();for(;n.hasNext();){let s=n.next(),a=s.item,l;a instanceof Oi?l=i.createArcTrack(a.layerId,a.center,a.radius,a.startAngle,a.endAngle,a.sweep,a.width,a.net,r,void 0,a.getGroupID()):l=i.createTrack(a.layerId,a.start,a.end,a.width,a.showNet,r,a.getGroupID());let c=i.addList(l,t,r);c.fanoutInfo=s.fanoutInfo}}splitEvent(t,e,r,i){let n=D0.getInstance().getList(r),s=n.toArray(),a=this.sort(n),l=t.node.layerId,c=this.add4Batch(a,fe.build2(s),e,t,r);if(!c.length||a.length<=0)return null;let h=this.getOrderMap(e,t);this.checkGroups(c,h,e,l,r);let u=-1;return i&&(u=t.tracks.indexOf(i)),this.splitSingleGroupEvent(t,e,c,r,i,u)}splitEvent2(t,e,r){var n,s;let i=[];for(let[a,l]of this.orders){let c=l.current.profile,h=l.current.type,u=e[a],d=D0.getInstance().getList(c),p=d.toArray(),m=this.sort(d),g=this.add4Batch(m,fe.build2(p),[u],t,c);if(!g.length||m.length<=0)return null;h===1?(l.current.point=(n=g[0].start)==null?void 0:n.point,g[0].end=null):(l.current.point=(s=g[0].end)==null?void 0:s.point,g[0].start=null),i.push(g[0]);let y=-1;return r&&(y=t.tracks.indexOf(r)),this.splitSingleGroupEvent(t,e,i,c,r,y)}}checkGroups(t,e,r,i,n){var s,a,l,c;for(let h=0;h<r.length;h++){let u=r[h],d=e.get(h),p=t.find(m=>m.list===u);if(p){let m=p.start,g=p.end;if(m){let y=m.point,b=d.findIndex(T=>T.point.equals1(y));if(Ds(y,i)[0].globalIndex!==n.globalIndex){let T=null;for(let I=b+1;I<d.length;I++)d[I].type===0&&((s=Ds(d[I].point,i)[1])==null?void 0:s.globalIndex)===n.globalIndex&&(T=d[I].point);T?m.point=T:p.start=null}}if(g){let y=g.point,b=d.findIndex(T=>T.point.equals1(y)),P=Ds(y,i);if(P[0].globalIndex!==n.globalIndex){let T=null;for(let I=b-1;I>=0;I--)d[I].type===1&&((a=Ds(d[I].point,i)[1])==null?void 0:a.globalIndex)===n.globalIndex&&(T=d[I].point);T?g.point=T:p.end=null}if(m){let T=m.point,I=Ds(T,i);P[1]&&((l=I[1])==null?void 0:l.globalIndex)!=((c=P[1])==null?void 0:c.globalIndex)&&(p.end=null)}}}}}splitSingleGroupEvent(t,e,r,i,n,s){let a=t.clone(),l=t.clone(),c=t.clone(),h=!1,u=!1,d=D0.getInstance().getList(i),p=this.sort(d),m=s>=0?l.tracks[s]:null;this.sortGroup(e,r,l,m);for(let y=0;y<a.tracks.length;y++){let b=a.tracks[y];if(n&&n.net!=b.net)continue;let P=l.tracks[y],T=P.start.state;T instanceof ub&&T.state==1&&(b.end.point=P.start.point,b.end.direct=P.start.direct,b.end.state=T,h=!0)}h&&this.syncRule(l,i);for(let y=0;y<c.tracks.length;y++){let b=c.tracks[y];if(n&&n.net!=b.net)continue;let P=l.tracks[y],T=a.tracks[y],I=P.end.state;b.start.point=P.end.point,b.start.direct=P.end.direct,b.start.state=I,b.start.model=null,I instanceof ub&&I.state==1&&(o.syncEventRule(b,i),u=!0)}h&&u&&a.tracks.forEach((y,b)=>{let T=l.tracks[b].start.state;T instanceof ub&&T.state===1&&(c.tracks[b].width=y.width)});let g=u?c:l;return t.gaps.forEach((y,b)=>y.width=g.gaps[b].width),{prev:h?a:null,current:l,next:u?c:null}}alignPath(t,e,r){let i=new ri,n=new Br,s=r.getCornerEvent(),a=t.tracks.length;for(let m=0;m<a;m++){let g=r.tracks[m],y=s.tracks[m],b=g.start.state,P=g.end.state;b instanceof ub&&b.state==1?y.start.fix=!1:y.start.fix=!0,P instanceof ub&&P.state==1?y.end.fix=!1:y.end.fix=!0}let l=s.tracks.map(m=>m.start),c=s.tracks.map(m=>m.end),h=this.calculateReferDirect_v2(s,e);this.addDebugPoint(h,{color:ee.Golden,msg:"StartDirect"});let u=this.calculateReferDirect_v2(s,e,!1);this.addDebugPoint(h,{color:ee.Golden,msg:"endDirect"});let d=new Array(a);h!=null&&this.drawAlignEndPath(l,h,e,r,n,d,!1);let p=new Array(a);return u!=null&&this.drawAlignEndPath(c,u,e,r,n,p,!0),this.getReferCenterPoint(t,s,h,u,e),{startResult:d,endResult:p,command:n,cornerEvent:s}}getReferCenterPoint(t,e,r,i,n){let s=n.length,a=Math.floor(s/2);if(s%2==0){let l=n[a-1],c=n[a],h=e.tracks[a-1],u=e.tracks[a],d=t.tracks[a-1],p=t.tracks[a],m=l.getAllItems().map(w=>w.primitive),g=c.getAllItems().map(w=>w.primitive),y=r.direct,b=r.point,P=i.direct,T=i.point,I=this.totalWidth(t.tracks,t.gaps),C=this.totalWidth(e.tracks,e.gaps);I=C>I?C:I,t.tracks[0].width;let E=this.getCossPoint(b,y,m,I),O=this.getCossPoint(b,y,g,I),_=this.getCossPoint(T,P,m,I),R=this.getCossPoint(T,P,g,I),v,D;E&&O&&(v=E.add(O).mul(.5)),_&&R&&(D=_.add(R).mul(.5)),e.startCenter=v,e.endCenter=D}else{let l=n[a]}}getCossPoint(t,e,r,i=10){let n=null,s=new S(e.y,-e.x),a=t.add(s.mul(i)),l=t.add(s.mul(-1).mul(i)),c=new M(a,l);for(let h=0;h<r.length;h++){let u=r[h];if(u instanceof M){let d=Xte(u.start(),u.end(),c.start(),c.end());if(d){n=d;break}}else if(u instanceof q){let d=jte(u,c);if(d){let p;for(let m=0;m<d;m+=2)p=new S(Ee[m],Ee[m+1]);n=p;break}}}return n}totalWidth(t,e){let r=0;return t.forEach(i=>r+=i.width),e.forEach(i=>r+=i.width),r}addDebugPoint(t,e){if(Yr.debug&&this.debug!=null&&t!=null){let r=new M(t.point,t.point.add(t.direct)),i=new M(t.point,t.point),n=new eo(r,e),s=new eo(i,e);this.debug.add(new Kd([n,s]))}}drawAlignEndPath(t,e,r,i,n,s,a){let l=new ri,c=t.length;for(let h=0;h<c;h++){let u=t[h];if(u!=e&&!u.fix){let d=this.align4Refer(e.point,u,r[h],a);this.debugPolyline(d,{color:ee.GREEN,msg:"drawAlignEndPath"}),u.direct=e.direct,a&&d.reverse();let p=this.getList4Index(s,h);this.debugPolyline(d,{color:ee.GREEN,msg:"drawAlignEndPath-2"});for(let m of d)m instanceof q?a?l.drawInfoArcTrack([m.reverse()],i.tracks[h],n,p):l.drawInfoArcTrack([m],i.tracks[h],n,p):a?l.drawInfoTrack([m.end(),m.start()],i.tracks[h],n,p):l.drawInfoTrack([m.start(),m.end()],i.tracks[h],n,p)}}}debugPolyline(t,e={color:ee.GREEN}){if(Yr.debug&&this.debug!=null){let r=[];for(let i of t){let n=new eo(i,e);r.push(n)}this.debug.add(new Kd(r))}}getList4Index(t,e){let r=t[e];return r==null&&(r=new ri().createList(),t[e]=r),r}align4Refer(t,e,r,i){let n=i?this.getEndPrimitives(r):this.getStartPrimitives(r),a=new bc(e.point,t,n).result;return e.point=a[a.length-1].end(),a}getNearPoint(t,e){let r=new M(t,t),i=Number.MAX_VALUE,n=t;for(let s of e){let a=new Zu(r,s);if(ne.less(a.getDistance(),i)){i=a.getDistance();let l=a.getLine();l.start().equals1(t)?n=l.end():n=l.start()}else if(ne.eq(a.getDistance(),i)){let l=a.getLine();l.start().equals1(t)?n=l.end():n=l.start()}}return n}getMaxDistanceDirect(t,e){let r=0,i=t;for(let n of e)if(!n.fix&&n!=t){let a=n.point.sub(t.point).dot(t.direct);ne.greater(Math.abs(a),r)&&(r=a,i=n)}return i}fanout90(t,e,r,i){let n=t.tracks.length,s=new Br,a=new m3(r.position);a.fanout_v4(t,r,i),a.checkstart=!1,a.fanout_v4(t,r,i);let l=new Array(n);for(let c=0;c<n;c++){let h=t.tracks[c],u=e[c],d=null;if(!h.start.fix){let p=null,m=[],g=h.start.connect(),y=g[0];m.push(y);for(let P=0;P<g.length;P++){let T=new M(y.point,g[P].point),I=u.listIterator(),C=new Array;for(;I.hasNext();){let _=I.next().item,R=_.primitive,v=Tt(T,R);for(let D=0;D<v;D+=2){let w=new S(Ee[D],Ee[D+1]);C.push({point:w,model:_})}}let E=J0(C,T);if(E.length>0){g[P].point=E[0].point,p=E[0].model,m.push(g[P]);break}m.push(g[P]),y=g[P]}let b=this.listReplace(m,h,u,p);u=b.list,d=b.command,this.debugPolyline(u.toArray().map(P=>P.primitive),{color:ee.BLUE,msg:"fanout90"})}if(!h.end.fix){let p=null,m=[],g=h.end.connect(),y=g[0];m.push(y);for(let P=0;P<g.length;P++){let T=new M(y.point,g[P].point),I=u.listIterator(),C=new Array;for(;I.hasNext();){let _=I.next().item,R=_.primitive,v=Tt(T,R);for(let D=0;D<v;D+=2){let w=new S(Ee[D],Ee[D+1]);C.push({point:w,model:_})}}let E=J0(C,T);if(E.length>0){g[P].point=E[0].point,p=E[0].model,m.push(g[P]);break}m.push(g[P]),y=g[P]}let b=this.listReplaceEnd(m,h,u,p);u=b.list,d!=null&&d.undo(),d=b.command,this.debugPolyline(u.toArray().map(P=>P.primitive),{color:ee.BLUE,msg:"fanout90"})}(!h.start.fix||!h.end.fix)&&(l[c]=u),d!=null&&s.addCommand(d)}return{result:l,command:s}}listReplace(t,e,r,i){let n=new Br,s=new ri,a=s.createList();s.drawCornerNodeTrack(t,e,n,a);let l=r.listIterator(),c=!1;for(;l.hasNext();){let h=l.next(),u=h.item;if(c){let d=u.start,p=u.end,m=u.width;if(d.distance2(p)>1e-8){if(u instanceof Oi){let g=s.createArcTrack(e.layerId,u.center,u.radius,u.startAngle,u.endAngle,u.sweep,m,e.net,n,void 0,u.getGroupID()),y=s.addList(g,a,n);y.fanoutInfo=h.fanoutInfo}else if(u instanceof qr){let g=s.createTrack(e.layerId,d,p,m,u.showNet,n,u.getGroupID()),y=s.addList(g,a,n);y.fanoutInfo=h.fanoutInfo}}}else if(u==i){c=!0;let d=t[t.length-1].point,p=i.end;if(d.distance2(p)>1e-8){let m=wM(u.center.x,u.center.y,d.x,d.y),g=wM(u.center.x,u.center.y,p.x,p.y);if(u instanceof Oi){let y=s.createArcTrack(e.layerId,u.center,u.radius,m,g,u.sweep,e.width,e.net,n,void 0,u.getGroupID()),b=s.addList(y,a,n);b.fanoutInfo=h.fanoutInfo}else if(u instanceof qr){let y=s.createTrack(e.layerId,d,p,e.width,e.net,n,u.getGroupID()),b=s.addList(y,a,n);b.fanoutInfo=h.fanoutInfo}}}}return{list:a,command:n}}listReplaceEnd(t,e,r,i){let n=new Br,s=new ri,a=s.createList(),l=r.listIterator();for(;l.hasNext();){let u=l.next(),d=u.item;if(d==i){let y=i.start,b=t[t.length-1].point;if(y.distance2(b)>1e-8){if(d instanceof Oi){let P=wM(d.center.x,d.center.y,y.x,y.y),T=wM(d.center.x,d.center.y,b.x,b.y),I=s.createArcTrack(e.layerId,d.center,d.radius,P,T,d.sweep,e.width,e.net,n,void 0,d.getGroupID()),C=s.addList(I,a,n);C.fanoutInfo=u.fanoutInfo}else if(d instanceof qr){let P=s.createTrack(e.layerId,y,b,e.width,e.net,n,d.getGroupID()),T=s.addList(P,a,n);T.fanoutInfo=u.fanoutInfo}}break}let p=d.start,m=d.end,g=d.width;if(p.distance2(m)>1e-8){if(d instanceof Oi){let y=s.createArcTrack(e.layerId,d.center,d.radius,d.startAngle,d.endAngle,d.sweep,g,e.net,n,void 0,d.getGroupID()),b=s.addList(y,a,n);b.fanoutInfo=u.fanoutInfo}else if(d instanceof qr){let y=s.createTrack(e.layerId,p,m,g,e.net,n,d.getGroupID()),b=s.addList(y,a,n);b.fanoutInfo=u.fanoutInfo}}}let c=t.reverse(),h=new Set;for(let u of c)u.reverse(),u.change!=null&&h.add(u.change);for(let u of h)u.reverse();return s.drawCornerNodeTrack(c,e,n,a),{list:a,command:n}}calculateReferDirect_v2(t,e,r=!0){let i=t.tracks,n=[];i.forEach((d,p)=>{let g=e[p].getAllItems(),y=d.start,b=d.end,P=[];if(r){for(let C=0;C<g.length;C++)if(!y.fix){let E=g[C],O=E.start,_=E.end,R;E instanceof qr?R=fe.build4([O,_]):E instanceof Oi&&(R=fe.build2([q.build2(E.center,E.startAngle*180/Math.PI,E.endAngle*180/Math.PI,E.radius,E.radius,E.sweep)]));let v=!1,D=R.primitives;for(let w=0;w<D.length;w++){let F=D[w];F instanceof q?v=new rh().inPolyline(y.point,R):F instanceof M&&(v=Ax(y.point,R))}if(!v)P.push(R);else{R.primitives.forEach(w=>{if(w instanceof q){let F=wM(w.center.x,w.center.y,y.point.x,y.point.y);P.push(fe.build2([q.build2(w.center,w.startAngle,F*180/Math.PI,w.rx,w.ry,w.sweep())]))}else w instanceof M&&P.push(fe.build4([O,y.point]))});break}}}else for(let C=g.length-1;C>=0;C--)if(!b.fix){let E=g[C],O=E.end,_=E.start,R;E instanceof qr?R=fe.build4([O,_]):E instanceof Oi&&(R=fe.build2([q.build2(E.center,E.endAngle*180/Math.PI,E.startAngle*180/Math.PI,E.radius,E.radius,le.CCW==E.sweep?le.CW:le.CCW)]));let v=!1,D=R.primitives;for(let w=0;w<D.length;w++){let F=D[w];F instanceof q?v=new rh().inPolyline(b.point,R):F instanceof M&&(v=Ax(b.point,R))}if(!v)P.push(R);else{R.primitives.forEach(w=>{if(w instanceof q){let F=wM(w.center.x,w.center.y,b.point.x,b.point.y),H=q.build2(w.center,w.startAngle,F*180/Math.PI,w.rx,w.ry,w.sweep());P.push(fe.build2([H]))}else w instanceof M&&P.push(fe.build4([O,b.point]))});break}}let T=[];P.forEach(C=>{let E=C.primitives;T.push(...E)});let I=fe.build2(T);n[p]=I});let s=new Array,a=0;for(let d=0;d<n.length;d++)if(!(n[d].primitives.length<=0)){a=d;break}let l=n[a];for(let d=0;d<n.length;d++){s.push([]);let p=0;for(let m=n[d].primitives.length-1;m>=0;m--)s[d][m]=p,p+=n[d].primitives[m].length()}for(let d=a+1;d<n.length;d++){let p=c(n[d].end(),a),m=c(l.end(),d);if(m&&!p&&(a=d,l=n[d]),p&&m){let g=n[p.i].primitives[p.j],y=n[m.i].primitives[m.j];g instanceof M&&y instanceof M?h(p.i,p.j,p.point)<h(m.i,m.j,m.point)&&(a=d,l=n[d]):g instanceof q&&y instanceof q&&Math.abs(g.sweepAngle)<Math.abs(y.sweepAngle)&&(a=d,l=n[d])}}function c(d,p){if(!d)return 0;let m,g,y=1/0,b=new M(d,d),P=n[p].primitives;for(let T=P.length-1;T>=0;T--){let I=new Zu(b,P[T]).getLine();I.length()<y&&(m=T,g=I,y=I.length())}return g?{point:g.start().equals(d)?g.end():g.start(),i:p,j:m}:null}function h(d,p,m){let g=n[d].primitives[p];if(g instanceof M)return g.end().distance1(m)+s[d][p];if(g instanceof q){let y=g.startAngle,b=Ht.regularD(m.angleD(g.center));return Math.abs(y-b)<1e-8?0:q.build2(g.center,y,b,g.rx,g.ry,g.sweep()).length()+s[d][p]}}let u=t.tracks[a];return r?u.start:u.end}clear(t){let e=t.listIterator();for(;e.hasNext();){let r=e.next();r.points.length=0}}sort(t){let e=t.listIterator(),r=[];for(;e.hasNext();){let i=e.next();J0(i.points,i.item),i.points.forEach(n=>{r.find(a=>a.point.equals1(n.point))||r.push(n)})}return r}add4Batch(t,e,r,i,n){let s=new Map;for(let l of t){let c=xt.getInstance().getNode(l.model).parent,h=s.get(c);h==null&&(h=[],s.set(c,h)),h.push(l)}let a=[];for(let[l,c]of s){let h=l.toArray();c.sort((T,I)=>{let C=h.indexOf(T.model),E=h.indexOf(I.model);if(C==E){let O=J0([T,I],T.model.primitive);return O.indexOf(T)-O.indexOf(I)}else return C-E});let u=c,d=r.indexOf(l),p=i.tracks[d],g=u[0].model,y=g.start,b=Jr.inPolyline(y,e);if(b&&u.some(T=>T.point.equals1(y))){let T=P3(g,y),I=Math.min(T.length(),g.length),C=y.add(T.mul(I)),E=n.inShape(C.x,C.y);b=b&&!E}u=u.splice(0,2);let P=null;for(let T of u){if(b){P=new a5(T),P.start=null,P.end=T,a.push(P),b=!1;break}P==null?(P=new a5(T),a.push(P)):(P.end=T,P=null)}}return a}sortGroup(t,e,r,i){for(let n of e){let s=t.indexOf(n.list);s<0||n.syncTrackInfo(i||r.tracks[s])}}syncRule(t,e){for(let r=0;r<t.tracks.length-1;r++){let i=t.tracks[r],n=t.tracks[r+1],s=i.start.point,a=i.start.direct,l=n.start.point,h=Math.abs(l.sub(s).cross(a))-(i.width+n.width)/2;if(ce.pcbConfig.startTrackWidth=="rule"){let d=xm([e],i.net,i.layerId),p=xm([e],n.net,n.layerId);d&&(i.width=d),p&&(n.width=p)}let u=fP([e],i.net,n.net,n.layerId);u&&(h=u),i.next.width=h}if(t.tracks.length==1){let r=t.tracks[0];if(ce.pcbConfig.startTrackWidth=="rule"){let i=xm([e],r.net,r.layerId);i&&(r.width=i)}}}static syncEventRule(t,e){if(ce.pcbConfig.startTrackWidth=="rule"){let r=!e,i=this.filterProfiles(t,e),n=t.net,s=te.getInstance().getNet(n),a=s==null?void 0:s.netDifferential,l=xm(i,n,t.layerId);l?t.width=l:r||(a?l=te.getInstance().getDifferentialPhysicsByNet(n).getStrokeWidthDefault(t.layerId):l=te.getInstance().getTrackPhysicsByNet(n).getDefaultWidth(t.layerId),t.width=l)}}static filterProfiles(t,e){let r=t.start,i=Ds(r.point,t.layerId,!0);if(e){let n=i.findIndex(s=>e===s);i.splice(n,1)}return i}changeViaPosition(t,e){let r=t.result.wireVia,i=t.tracks;if(r.size<=0)return;let n=[];i.forEach(a=>{let l=r.get(a);n.push(l)});let s=this.calcViaPosition(n,e.result);this.fixViaFanoutTracks(n,s,e)}calcViaPosition(t,e){let r=new Map,i=[];e.forEach(c=>{let h=c.getLast().end;i.push(h)});let n=i[i.length-1].sub(i[0]).normalize(),s=n.mul(-1),a=t.length,l=Math.floor(a/2);if(a%2==0){let c=i[l-1],h=i[l],u=c.add(h).mul(.5),d=e[l-1].getLast().layerId,p=e[l-1].getLast().layerId,m=this.getRules(c,t[l-1].item.layerId,d),g=this.getRules(h,t[l].item.layerId,p),y;!m.rawProfile&&!g.rawProfile?y=m:!m.rawProfile&&g.rawProfile||m.rawProfile&&!g.rawProfile?y=m.rawProfile?m:g:y=m.safeVia>g.safeVia?m:g,this.calcLeftViaPosition(y.safeVia,y.rawProfile,i,t,u,s,l-1,y.rule,r,Math.max(y.safeVia/2,y.holeClearance/2-(y.rule.defalutRadius-y.rule.defalutInner)),e[l-1].getLast().layerId,y.holeClearance),this.calcRightViaPosition(y.safeVia,y.rawProfile,i,t,u,n,l,y.rule,r,Math.max(y.safeVia/2,y.holeClearance/2-(y.rule.defalutRadius-y.rule.defalutInner)),e[l].getLast().layerId,y.holeClearance)}else{let c=t[l].item.center,h=e[l-1].getLast().layerId,{safeVia:u,rule:d,rawProfile:p,holeClearance:m}=this.getRules(c,t[l].item.layerId,h);r.set(t[l],null),t[l].item.viaBaseInfo=Ea.getViaBaseInfo(t[l].item.startLayer,t[l].item.endLayer,d.defalutRadius,d.defalutInner),this.calcLeftViaPosition(u,p,i,t,c,s,l-1,d,r,Math.max(u+d.defalutRadius,m+d.defalutInner-(d.defalutRadius-d.defalutInner)),e[l-1].getLast().layerId,m),this.calcRightViaPosition(u,p,i,t,c,n,l+1,d,r,Math.max(u+d.defalutRadius,m+d.defalutInner-(d.defalutRadius-d.defalutInner)),e[l+1].getLast().layerId,m)}return r}getViasCenter(t){let e=t.length,r=Math.floor(e/2),i;return e%2==0?i=t[r-1].item.center.add(t[r].item.center).mul(.5):i=t[r].item.center,i}fixViaFanoutTracks(t,e,r){let i=r.result,n=[];i.forEach((a,l)=>{n[l]||(n[l]=[]);let c=a.getFirstNode();for(;c;)n[l].push(c),c=c.next});let s=this.getViasCenter(t);t.forEach((a,l)=>{let c=r.result[l],h=e.get(a);if(!h)return;let u=s.sub(h.rawPosi).normalize(),d=h.direct,p=u.rotate(new S(0,0),Math.PI/2),m=p.cross(d),g=p.cross(u),y=m*g;if(y/=Math.abs(y),y>0)return;let b=r.command,P=new ri,T=n[l],I=T.length-1,C=T[I],E=P.createList(),O=P.createTrack(C.item.layerId,C.item.start,C.item.end,C.item.width,C.item.net,b,C.item.getGroupID()),_=P.createTrack(C.item.layerId,C.item.end,h.posi,C.item.width,C.item.net,b,C.item.getGroupID());P.addList(O,E,b),P.addList(_,E,b),E.replace(C,C),b.addCommand(new Ti(E));let R=new BT(_.direct,-1);c.getLastNode().fanoutInfo=R})}calcLeftViaPosition(t,e,r,i,n,s,a,l,c,h,u,d){let p=t,m=h,g=l,y=e;for(let b=a;b>=0;b--){let P=r[b],T=i[b],I=n.add(s.mul(m)),C=!0;if(y&&(C=y.inShape(I.x,I.y)),C){let E=I.add(s.mul(g.defalutRadius));if(y&&(C=y.inShape(E.x,E.y)),C){let O=P.sub(n).length(),_=E.sub(n).length();O>_?(T.item.viaBaseInfo=Ea.getViaBaseInfo(T.item.startLayer,T.item.endLayer,g.defalutRadius,g.defalutInner),T.item.center=P,c.set(T,null),m=O+T.item.radius+p):(m<d-(g.defalutRadius-g.defalutInner)*2?(m+=2*T.item.radius,m+=d-(g.defalutRadius-g.defalutInner)*2):(m+=2*T.item.radius,m+=p),T.item.viaBaseInfo=Ea.getViaBaseInfo(T.item.startLayer,T.item.endLayer,g.defalutRadius,g.defalutInner),T.item.center=E,this.addChangeViaRecord(T,{direct:E.sub(P).normalize(),posi:E,rawPosi:P},c))}else{let O=Ds(E,u,!0)[0],_,R;if(O){let D=te.getInstance().getRegion(O.globalIndex);_=te.getInstance().getRadiusPhysics(D.radius),R=te.getInstance().getSafeSpacing(D.safeClearance),y=O}else _=te.getInstance().getDefaultRadiusPhysics(),R=te.getInstance().getDefaultSafeSpacing(),y=null;let v=R.getClearance(5,5)||0;if(v>p+g.defalutRadius){let D=v-(p+g.defalutRadius);E=E.add(s.mul(D)),m+=D}this.addChangeViaRecord(T,{direct:E.sub(P).normalize(),posi:E,rawPosi:P},c),T.item.viaBaseInfo=Ea.getViaBaseInfo(T.item.startLayer,T.item.endLayer,_.defalutRadius,_.defalutInner),T.item.center=E,p=v,m+=_.defalutRadius,m+=p,g=_}}else{let E=Ds(I,u,!0)[0],O,_;if(E){let v=te.getInstance().getRegion(E.globalIndex);O=te.getInstance().getRadiusPhysics(v.radius),_=te.getInstance().getSafeSpacing(v.safeClearance),y=E}else O=te.getInstance().getDefaultRadiusPhysics(),_=te.getInstance().getDefaultSafeSpacing(),y=null;let R=_.getClearance(5,5)||0;if(R>p){let v=R-p;I=I.add(s.mul(v)),m+=v}I=I.add(s.mul(O.defalutRadius)),this.addChangeViaRecord(T,{direct:I.sub(P).normalize(),posi:I,rawPosi:P},c),T.item.viaBaseInfo=Ea.getViaBaseInfo(T.item.startLayer,T.item.endLayer,O.defalutRadius,O.defalutInner),T.item.center=I,p=R,m+=2*O.defalutRadius,m+=p,g=O}}}calcRightViaPosition(t,e,r,i,n,s,a,l,c,h,u,d){let p=t,m=h,g=l,y=e,b=i.length;for(let P=a;P<b;P++){let T=r[P],I=i[P],C=n.add(s.mul(m)),E=!0;if(y&&(E=y.inShape(C.x,C.y)),E){let O=C.add(s.mul(g.defalutRadius));if(y&&(E=y.inShape(O.x,O.y)),E){let _=T.sub(n).length(),R=O.sub(n).length();_>R?(I.item.viaBaseInfo=Ea.getViaBaseInfo(I.item.startLayer,I.item.endLayer,g.defalutRadius,g.defalutInner),I.item.center=T,c.set(I,null),m=_+I.item.radius+p):(p<d-(g.defalutRadius-g.defalutInner)*2?(m+=2*I.item.radius,m+=d-(g.defalutRadius-g.defalutInner)*2):(m+=2*I.item.radius,m+=p),I.item.viaBaseInfo=Ea.getViaBaseInfo(I.item.startLayer,I.item.endLayer,g.defalutRadius,g.defalutInner),I.item.center=O,this.addChangeViaRecord(I,{direct:O.sub(T).normalize(),posi:O,rawPosi:T},c))}else{let _=Ds(O,u,!0)[0],R,v;if(_){let w=te.getInstance().getRegion(_.globalIndex);R=te.getInstance().getRadiusPhysics(w.radius),v=te.getInstance().getSafeSpacing(w.safeClearance),y=_}else R=te.getInstance().getDefaultRadiusPhysics(),v=te.getInstance().getDefaultSafeSpacing(),y=null;let D=v.getClearance(5,5)||0;if(D>p+g.defalutRadius){let w=D-(p+g.defalutRadius);O=O.add(s.mul(w)),m+=w}this.addChangeViaRecord(I,{direct:O.sub(T).normalize(),posi:O,rawPosi:T},c),I.item.viaBaseInfo=Ea.getViaBaseInfo(I.item.startLayer,I.item.endLayer,R.defalutRadius,R.defalutInner),I.item.center=O,p=D,m+=R.defalutRadius,m+=p,g=R}}else{let O=Ds(C,u,!0)[0],_,R,v;if(O){let w=te.getInstance().getRegion(O.globalIndex);_=te.getInstance().getRadiusPhysics(w.radius),v=te.getInstance().getOtherSpacing(w.otherClearance).holeClearance,R=te.getInstance().getSafeSpacing(w.safeClearance),y=O}else _=te.getInstance().getDefaultRadiusPhysics(),R=te.getInstance().getDefaultSafeSpacing(),v=te.getInstance().getDefaultOtherSpacing().holeClearance,y=null;let D=R.getClearance(5,5)||0;if(D>p){let w=D-p;C=C.add(s.mul(w)),m+=w}C=C.add(s.mul(_.defalutRadius)),this.addChangeViaRecord(I,{direct:C.sub(T).normalize(),posi:C,rawPosi:T},c),I.item.viaBaseInfo=Ea.getViaBaseInfo(I.item.startLayer,I.item.endLayer,_.defalutRadius,_.defalutInner),I.item.center=C,p=D,m+=2*_.defalutRadius,m+=p,g=_,d=v}}}sameVec(t,e){let r=Math.abs(t.x-e.x),i=Math.abs(t.y-e.y);return r<1e-8&&i<1e-8}getRules(t,e,r){let i=Ds(t,e,!0,!0)[0],n,s,a,l;if(i){let c=te.getInstance().getRegion(i.globalIndex);n=te.getInstance().getSafeSpacing(c.safeClearance),l=te.getInstance().getOtherSpacing(c.otherClearance).holeClearance,s=n.getClearance(5,5,r)||0,a=te.getInstance().getRadiusPhysics(c.radius)}else n=te.getInstance().getDefaultSafeSpacing(),l=te.getInstance().getDefaultOtherSpacing().holeClearance,s=n.getClearance(5,5,r)||0,a=te.getInstance().getDefaultRadiusPhysics();return{safeSpacing:n,safeVia:s,rule:a,rawProfile:i,holeClearance:l}}addChangeViaRecord(t,e,r){let i=e.posi,n=e.rawPosi;if(this.sameVec(i,n))return r.set(t,null);r.set(t,e)}copyFanoutInfo(t,e){let r=t.length;for(let i=0;i<r;i++){let n=t[i],s=e[i];if(!n||!s)continue;let a=[],l=[],c=n&&n.getFirstNode();for(;c;)a.push(c),c=c.next;let h=s&&s.getFirstNode();for(;h;)l.push(h),h=h.next;for(let u=0;u<a.length;u++){let d=a[a.length-1-u],p=l[l.length-1-u];d.fanoutInfo||(d.fanoutInfo=p.fanoutInfo)}}}};var yD=class o extends Si{constructor(e,r){super(e);this.isBase=!0;super.color=r,this.sendDeleteMsg=!1}static build(e,r,i,n,s,a,l,c){let h=new Oi(su(),e,r,i,l,n,s,a,!1,c,1);return new o(h,null)}getAngle(){let e=this.midPoint.sub(this.center).normalize(),r=Math.atan2(e.x,-e.y);return r<-es?r+=Math.PI:r>es&&(r-=Math.PI),r}setBBoxModify(){}setLayerModify(e){}};var db=class extends so{constructor(t,e){super(),this._via=t.clone(),this.net=t.net,this.action=e}rebuild(){this._via.net=this.net;let t=this._via.clone();return _i.getInstance().addModel(t),_r.getInstance().current.setViaVisible(t.globalIndex),t}getItem(){return"ignore"}remove(){let t=this._via.globalIndex,e=_i.getInstance().getItem(t);e&&e.remove(),e&&_i.getInstance().delete(e),_r.getInstance().current.setViaHidden(t)}modify(){let t=this._via.globalIndex,e=_i.getInstance().getItem(t),r=e.clone();e.type!=this._via.type&&(e.type=this._via.type),e.name!=this._via.name&&(e.name=this._via.name),e.net!=this._via.net&&(e.net=this._via.net),e.center.equals(this._via.center)||(e.center=this._via.center),e.viaBaseInfo=Ea.getViaBaseInfo(this._via.startLayer,this._via.endLayer,this._via.radius,this._via.holeRadius),e.locked!=this._via.locked&&(e.locked=this._via.locked),e.viaExpansion=I0.getViaExpansion(this._via.expansionType,this._via.topExpansion,this._via.bottomExpansion),e.unusedInnerLayers.toString()!=this._via.unusedInnerLayers.toString()&&(e.unusedInnerLayers=this._via.unusedInnerLayers),this._via=e}updateData(){throw new Error("Method not implemented.")}upload(t){throw new Error("Method not implemented.")}};var l5=class l5{constructor(){this.sourceMap=new Map;this.sourceViaMap=new Map;this.map=new Map;this.viaMap=new Map;this.hightMap=new Map}static getInstance(){return l5.manager==null&&(l5.manager=new l5),l5.manager}view4Status(t){let e=new Br,r=new Array,i=new Array;for(let[a,l]of t.trackStatus)l?r.push(a):i.push(a);for(let[a,l]of t.updateTrackStatus)t.trackStatus.has(a)||(l?r.push(a):i.push(a));this.hiddenView(i,e),this.visibleTrack(r,t);for(let a of i)t.deleteTrack(a);let n=new Array,s=new Array;for(let[a,l]of t.viaStatus)l?n.push(a):s.push(a);this.hiddenVia(s,e),this.visibleVia(n,t);for(let a of s)t.deleteVia(a);return this.handleHight(t),t.updateTrackStatus.clear(),e}handleHight(t){let e=t.hightStatus,r=new Array,i=new Array;for(let[s,a]of e)a?i.push(s):r.push(s);let n=new er;r.forEach(s=>{let a=this.hightMap.get(s);a||(a=n.getItem(s)),t.deleteHight(s),this.hightMap.delete(s),a.visible()}),i.forEach(s=>{let a=this.hightMap.get(s);a||(a=n.getItem(s),this.hightMap.set(s,a)),a.click()})}setHightItem(t){this.hightMap.set(t.globalIndex,t)}get getMap(){return this.map}visibleTrack(t,e){for(let r of t){let i=this.getSourceView(r,!0);if(i!=null)i.visible();else{let n=this.map.get(r);if(n==null){let s=this.getTrackModel(r);if(!s||s.length<1e-8)continue;if(s!=null){let a;a=this.getHighlightColor(s.net,s.layerId),e.getTrackPreview(s.globalIndex)&&(a=this.getPreviewColor(s.net,s.layerId)),e.getTrackWhite(s.globalIndex)&&(a=this.getDarkModeHighlightColor(ee.WHITE));let h;s instanceof qr?h=new $d(s,a):h=new yD(s,a),h.isEmpty||(h.partition=x.getInstance().partitionId),e.getTrackSelect(s.globalIndex)?h.click():h.visible(),this.map.set(r,h)}}else e.getTrackPreview(n.globalIndex)?n.color=this.getPreviewColor(n.net,n.layerId):n.color=this.getHighlightColor(n.net,n.layerId),e.getTrackSelect(n.globalIndex)?n.click():n.visible()}}}restoreTrackColor(t){let{updateTracks:e,updateVias:r}=t,i=Ui.getInstance().getItem(4);for(let s of e){let a=this.map.get(s);if(a){if(!i.visible){a.hidden();continue}let l=a.net,c=a.layerId,h=!ze.getSpecialColor(l).equals(ee.BLACK),u;h?u=ze.getSpecialColor(l).mul(1):u=$e.getInstance().getLayer(c).activeColor.mul(1),a.color=u,a.visible()}else if(!i.visible){let l=this.getSourceTrack(s);l==null||l.hidden()}}let n=Ui.getInstance().getItem(9);for(let s of r){let a=this.viaMap.get(s);if(a){if(!n.visible){a.updateFilterVisible,a.hidden();continue}}else if(!n.visible){let l=Hr.getItem(s);l==null||l.hidden()}}}hiddenView(t,e){for(let r of t){let i=this.getSourceView(r,!1);if(i!=null)i.hidden();else{gc.getInstance().delete(r);let n=this.map.get(r);n!=null&&(n.model.isEmpty||e.addCommand(new a_(n.model,"delete")),n.sendDeleteMsg=!1,n.remove(),hi.getInstance().deleteTree(n.model),this.map.delete(r))}}}getSourceView(t,e){let r=this.sourceMap.get(t);if(r==null){let i=this.getSourceTrack(t);i!=null&&(r={track:i,visible:e},this.sourceMap.set(t,r))}return r!=null&&(r.visible=e),r==null?void 0:r.track}visibleVia(t,e){for(let r of t){let i=this.getSourceViaView(r,!0);if(i!=null)i.visible();else{let n=this.viaMap.get(r);if(n==null){let s=this.getViakModel(r);if(s!=null){let a;be.getGrayIndex()==0?(a=this.getHighlightColor(s.net,s.layerId),e.getViaPreview(s.globalIndex)&&(a=this.getDarkModeHighlightColor(ze.getSpecialColor(s.net)))):a=ee.BLACK;let c=new uD(s,a);this.viaMap.set(r,c)}}else e.getViaPreview(n.globalIndex)?n.color=this.getDarkModeHighlightColor(ze.getSpecialColor(n.net)):n.color=this.getHighlightColor(n.net,12),n.visible()}}}getDarkModeHighlightColor(t){return x.getInstance().forceValue!=0&&(t=t.mul1(1/x.getInstance().forceValue)),t}hiddenVia(t,e){for(let r of t){let i=this.getSourceViaView(r,!1);if(i!=null)i.hidden();else{gc.getInstance().delete(r);let n=this.viaMap.get(r);n!=null&&(n.model.isEmpty||e.addCommand(new db(n.model,"delete")),n.sendDeleteMsg=!1,n.remove(),hi.getInstance().deleteTree(n.model),this.viaMap.delete(r))}}}getSourceViaView(t,e){let r=this.sourceViaMap.get(t);if(r==null){let i=Hr.getItem(t);i!=null&&(r={track:i,visible:e},this.sourceViaMap.set(t,r))}return r!=null&&(r.visible=e),r==null?void 0:r.track}getPreviewColor(t,e){let r=!ze.getSpecialColor(t).equals(ee.BLACK),i;if(r)i=ee.of6(this.getDarkModeHighlightColor(ze.getSpecialColor(t)),1-.1);else{let n=$e.getInstance().getLayer(e);i=ee.of6(this.getDarkModeHighlightColor(n.activeColor),1-.1)}return i}getHighlightColor(t,e){let r=!ze.getSpecialColor(t).equals(ee.BLACK),i;if(r)i=this.getDarkModeHighlightColor(ze.getSpecialColor(t));else{let n=$e.getInstance().getLayer(e);i=this.getDarkModeHighlightColor(n.activeColor)}return i}getTrackModel(t){return Zl.getInstance().getItem(t)}getViakModel(t){return _i.getInstance().getItem(t)}getSourceTrack(t){return pr.getItem(t)}clear(){for(let[,t]of this.map)t.sendDeleteMsg=!1,t.remove();for(let[,t]of this.viaMap)t.sendDeleteMsg=!1,t.remove();this.hightMap.forEach(t=>{t.visible()}),this.map.clear(),this.viaMap.clear(),this.sourceMap.clear(),this.sourceViaMap.clear(),this.hightMap.clear()}complete(t=new ve("wire")){let e={};for(let[,s]of this.map){let a=s.model.clone(),l=a.globalIndex,c=s.model.getGroupID(),h=pr.addTrackByModel(a,!0);c&&(h.setGroupID(c),this.joinCombination([h],c)),h.partition=x.getInstance().partitionId,e[l]=h.globalIndex,h.updateFilterVisible=!0,h.visible(),t.addCommand(Te.dispatch(h,"add")),ie.publish("hasModifyPcbItem",h)}let r={},i=_i.getInstance(),n=new Set;for(let[,s]of this.sourceViaMap)if(!s.visible){let a=i.getMapViaId(s.track.globalIndex);this.viaMap.get(a)&&(r[s.track.globalIndex]=a,n.add(a))}for(let[s,a]of this.viaMap){if(n.has(s))continue;let l=a.model.clone(),c=l.globalIndex,h=Hr.addViaByModel(l,!0);h.partition=x.getInstance().partitionId,e[c]=h.globalIndex,h.updateFilterVisible=!0,h.visible(),t.addCommand(Te.dispatch(h,"add")),ie.publish("hasModifyPcbItem",h)}for(let[,s]of this.sourceMap)if(s.track.updateFilterVisible=!0,s.track.visible(),!s.visible){let a=s.track;t.addCommand(Te.dispatch(a,"delete")),a.remove(),ie.publish("delete",a),ie.publish("hasModifyPcbItem",a)}for(let[s,a]of this.sourceViaMap)if(a.track.updateFilterVisible=!0,a.track.visible(),!a.visible){let l=a.track,c=r[s];if(c){let h=this.viaMap.get(c);t.addCommand(Te.dispatch(l,"modify")),l.center=h.center,ie.publish("hasModifyPcbItem",l)}else t.addCommand(Te.dispatch(l,"delete")),l.remove(),ie.publish("delete",l),ie.publish("hasModifyPcbItem",l)}return{command:t,newIds:e}}joinCombination(t,e){kt.getItem(e)!=null&&kt.joinCombination(t,e)}checkTrackIsCanEdit(){let t=!0;for(let[,e]of this.map)if(!Bt.checkIsInCanEdit(e)){t=!1;break}for(let[,e]of this.viaMap)if(!Bt.checkIsInCanEdit(e)){t=!1;break}return t}};l5.manager=null;var ji=l5;var c5=class c5{constructor(){this.events=new Array;this.current=null}static getInstance(){return c5.manager==null&&(c5.manager=new c5),c5.manager}getNext(){if(this.current!=null){this.events.push(this.current);let t=this.current,e=this.current.result.wireMap,r=this.current.result.wireVia;this.resetModel(t.node,e.get(t.node));let i=[],n=[];for(let c of this.current.tracks){let h=e.get(c),u=r.get(c),d=null,p=null;if(h&&h.size()>0){let m=h.getLastNode();p=Fr.getInstance().getStatus(m),d=m.item.width}p&&p.isInput?(i.push(d),n.push(h.getLast().end.clone())):u?n.push(u.item.center):c.start.point.equals1(c.end.point)?(i.push(null),n.push(null)):(i.push(null),n.push(c.end.point))}let s=this.current.nextEvent;s?this.current=s.clone():this.current=this.current.clone(!0);let a=n.every(c=>!c),l=be.getActiveLayerID();for(let c=0;c<this.current.tracks.length;c++){let h=this.current.tracks[c];h.allowModifyNet&&h.net&&(h.allowModifyNet=!1);let u=h.layerId,d=h.start.point,p=h.start;if(h.start=h.end.clone(),h.start.point=d,a&&(h.start.direct=p.direct),h.drawing!==2&&n[c]&&(h.start.point=n[c]),h.start.signalLayers.has(l)){h.end.layerId=l;let g=h.layerId;h.layerId=l,g!==l&&(T3.syncEventRule(h),i[c]=h.width)}let m=ce.pcbConfig.startTrackWidth;if(h.end.signalLayers=new Set([h.layerId]),i[c]&&(h.width=i[c]),h.layerId!=u&&m==="rule"){this.changeStartTrackWidth(h.start.point,h.layerId,h);let g=h.width;we.prevTrackWidth=g}}this.checkEndpoint(t)}return this.current}changeStartTrackWidth(t,e,r){if(ce.pcbConfig.startTrackWidth=="rule"){let i=Ds(t,e),n=r.net,s=xm(i,n,r.layerId);if(s!=null)r.width=s;else{let a=go.getWidth(null,"rule",null,!1,r.start.point,e,r.net);a!=null&&(r.width=a)}return r.width}}restoreCurrentInitState(t){if(t!=null){let e=t,r=this.current.tracks.indexOf(this.current.node);this.current=t.clone();let i=be.getActiveLayerID();for(let n of this.current.tracks)n.start=n.end.clone(),n.start.signalLayers.has(i)&&(n.end.layerId=i,n.layerId=i),n.end.signalLayers=new Set([n.layerId]);this.checkEndpoint(e),this.current.changeControlNodeByIndex(r)}else if(this.current!=null){this.current=this.current.clone();for(let e of this.current.tracks)e.end.point=e.start.point.clone(),e.end.signalLayers=new Set([e.layerId])}return this.current}checkEndpoint(t){let e=t.tracks.length;for(let r=0;r<e;r++){let i=t.tracks[r];if(i.drawing==2)continue;let n=i.end,a=this.current.tracks[r].start;n.model==null?n.point.equals(a.point)||(a.allowModifyDirect=!1):(a.model=n.model,n.model.modelType=="Via"?a.allowModifyDirect=!0:a.allowModifyDirect=!1)}}setPreviousSeg(t){let e=[];if(this.current!=null&&t=="previous"){let r=this.current,i=r.result.wireMap,n=new ri,s=_r.getInstance().current;e=r.tracks.map(a=>{let l=r.result.wireVia.get(a),c=i.get(a);if((!l||a.via.viaPosition!="currentInflectionPoint")&&c&&c.size()>1){let h=c.getLastNode();if(!s.getTrackWhite(h.item.globalIndex))return;let u=h.prev.item,d=n.createList();d.replace(h,h);let p=h.item;return a.end.point=p.start.clone(),a.end.model=u,r.result.command.addCommand(new Ti(d)),p.clone()}return null})}return e}getPreviousSeg(t=[],e=this.current){if(e&&t.length){let r=new ri;e.tracks.forEach((n,s)=>{let a=t[s];if(!a)return;let l=e.result.creataList(n),c=r.createTrack(a.layerId,a.start,a.end,a.width,a.net,e.result.command,a.getGroupID());r.addList(c,l,e.result.command),_r.getInstance().current.setTrackVisible(c.globalIndex),n.end.point=a.end.clone()}),e.position=e.node.end.point;let i=ji.getInstance().view4Status(_r.getInstance().current);e.result.command.addCommand(i)}}getLastEvent(){return this.events[this.events.length-1]}getSingleEvents(t=this.current.tracks.indexOf(this.current.node)){var r;let e=[];for(let i of this.events){let n=i.tracks[t],s=(r=i.result.wireMap.get(n))==null?void 0:r.getAllItems();s&&(e=e.concat(s))}return e}getSingleVias(t){var r;let e=[];for(let i of this.events){let n=t?i.tracks[t]:i.node;if(i.result.wireVia.size>0){let s=(r=i.result.wireVia.get(n))==null?void 0:r.item;s&&_i.getInstance().getNode(s)&&e.push(s)}}return e}hasTrack(t){let e=t.start.model;return!!Array.from(this.events).reverse().find(n=>{let s=n.tracks.find(l=>l.end.model==e?(e=l.start.model,!0):!1),a=n.result.wireMap.get(s);return!!(a&&a.size()>0)})}undo(){return this.current=this.events.pop(),this.current}clear(){this.events.length=0,this.current=null}resetModel(t,e){if(Ss.getInstance().wireMode!=="Single wiring")return;let r=i=>!!(!i||(i instanceof Aa||i instanceof Po||i instanceof ss)&&["Line","Fill Region"].includes(i.type));e.size()>0&&(t.end.model=r(t.end.model)?e.getLast():t.end.model,t.end.point=e.getLast().end,t.end.model instanceof yt&&(t.end.direct=Ot(t.end.model.primitive)))}};c5.manager=null;var Un=c5;var u9e=class{constructor(){this.lines=new Array;this._infos=new Array}add(t,e,r){let i=Os.getInstance().getModelObstacle(t,r,e);this._infos.push(i.outline.getOutline("default"))}displayCollideInfo(){for(let t of this.lines)t.remove();this.lines.length=0;for(let t of this._infos)this.displayPolyline(t)}displayPolyline(t){if(t!=null){let e=dP(t.primitives,1002);for(let r of e)r.color=ee.WHITE,this.lines.push(r)}}getPolylines(t,e,r){let i=new Array;if(t instanceof qr||t instanceof Oi){let n=t.getMathGraphics(t.layerId,r).closeEndpoint();i.push(n)}else if(t instanceof Je){if(12==t.layerId){if(!t.isUnuseLayer(e)){let n=t.getMathGraphics(e,r).closeEndpoint();i.push(n)}}else if(t.layerId==e){let n=t.getMathGraphics(e,r).closeEndpoint();i.push(n)}}else if(t instanceof It){if(e==12){let n=fe.build2([q.build3(t.center,0,-360,t.holeRadius+r,t.holeRadius+r)]).closeEndpoint();i.push(n)}else if(!t.isUnuseLayer(e)){let n=t.getMathGraphics(e,r).closeEndpoint();i.push(n)}}else if(t instanceof lr&&["Fill Region","TearDrop","Slot Region","Board Outline"].includes(t.type)){let n=t.getMathGraphics(e,r).closeEndpoint();for(let s of n.primitives){let a=s.stroke(r,kr.ROUND,le.CCW).closeEndpoint();i.push(a)}}else if(t instanceof lr&&t.type=="Line"){let n=t.getMathGraphics(e,r);for(let s of n.primitives){let a=s.stroke(r*2+t.strokeWidth,kr.ROUND,le.CCW).closeEndpoint();i.push(a)}}else if(t.box&&t.box instanceof vs){let n=t.box.getMathGraphics(t.layerId,r).closeEndpoint();i.push(n)}else if(t instanceof lr&&t.type=="Prohibited Region"){let n=t.getMathGraphics(e,0).closeEndpoint();i.push(n)}return i.filter(n=>n)}clear(){this._infos.length=0;for(let t of this.lines)t.remove();this.lines.length=0}},q1=new u9e;function Xe(o,t=3,e=x.getInstance().unit,r=new ft){o=o*10,t==null&&(t=3);let i=r||new ft;e!="mil"&&(o=i.conversion("mil",e,o)),e=="mil"&&t==3&&(t=1);let n=Math.pow(10,t);return Math.round(o*n)/n}function I3(o){return new ft().conversion(x.getInstance().unit,"mil",o/10)}function QF(o){return new ft().conversion1("mil",x.getInstance().unit,o*10)}function QGe(o){try{return o&&JSON.parse(JSON.stringify(o))}catch(t){return console.log(t,o),o}}function Fo(o){let t=Ni().get2dCameraMatrix(),e=new S(Ni().getWidth()/2,-Ni().getHeight()/2),r=o.multiply4(t).add(e),i=x.getInstance().getRatio();return new S(r.x/i,-r.y/i)}function Gf(){return{width:Ni().getWidth(),height:Ni().getHeight()}}function Qd(o,t){return o!=null&&t!=null?o.x===t.x&&o.y===t.y:!1}function d9e(o){let t=[];if(o.attr){let e=!1;for(let[r,i]of Object.entries(o.attr))t.push(`data-log-find-${r}="${i}"`),r==="path"&&(e=!0);e||t.push(`data-log-find-path="${x.getInstance().projectId}"`)}else if(o.call){t.push('data-log-find-call="true"');for(let e in o.call){let r=o.call[e];r=typeof r=="object"?JSON.stringify(r):r,t.push(`data-log-find-${e}='${r}'`)}}return`<span class="link" ${t.join(" ")}>${o.text}</span>`}var h5=class{constructor(){this.lastTime=-1;this.delay=0;this.func=null;this.animationFrameId=null;this.start=()=>{if(!this.func)return;performance.now()-this.lastTime>=this.delay?(this.func(),this.animationFrameId=null):this.animationFrameId=requestAnimationFrame(this.start)}}debounce(t,e=0){let r=this.func===t;this.func=t,this.delay=e,this.lastTime=performance.now(),!(r&&this.animationFrameId)&&(this.cancel(),this.start())}cancel(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}destroy(){this.cancel()}};var Doe=class extends fi{constructor(t){super(),this.data=t}open(t){return{action:"route-via-violate-drc",data:{viaPosition:this.data.viaPosition}}}modify(){}close(t){if(!t)return;let{action:e}=t;return e=="confirm"?this.data.cb&&this.data.cb():this.data.cbCancel&&this.data.cbCancel(),!0}};function li(o=!0){return{enforce:o,level:-9999}}var eUe={distanceSameComponentItem:{distanceSameComponentItem:li()},prohibitRegionRule:{overlapWithOtherObject:li()},trackRule:{minTrackWidth:li(),maxTrackWidth:li()},"Creepage Distance":{Creepage:li()},netLength:{minLength:li(),maxLength:li()},netLengthTolerance:{tolerance:li()},holeSize:{minViaSize:li(),maxViaSize:li()},connect:{sameNetNotConnect:li(),checkFreeCopper:li(),checkFreeTrack:li(),checkFreeLine:li(),checkFreeFillRegion:li()},diff:{minWidth:li(),maxWidth:li(),minGap:li(),maxLengthTolerance:li()},distanceTrack:{track:li(),SMDPad:li(),THPad:li(),SMDTestPoint:li(),THTestPoint:li(),via:li(),fillRegion:li(),slot:li(),line:li(),textAndImage:li(),outline:li(),hole:li()},distanceSMDPad:{SMDPad:li(),THPad:li(),SMDTestPoint:li(),THTestPoint:li(),via:li(),fillRegion:li(),slot:li(),line:li(),textAndImage:li(),outline:li(),hole:li()},distanceTHPad:{THPad:li(),SMDTestPoint:li(),THTestPoint:li(),via:li(),fillRegion:li(),slot:li(),line:li(),textAndImage:li(),outline:li(),hole:li()},distanceSMD_Test_Point:{SMDTestPoint:li(),THTestPoint:li(),via:li(),fillRegion:li(),slot:li(),line:li(),textAndImage:li(),outline:li(),hole:li()},distanceTH_Test_Point:{THTestPoint:li(),via:li(),fillRegion:li(),slot:li(),line:li(),textAndImage:li(),outline:li(),hole:li()},distanceVia:{via:li(),fillRegion:li(),slot:li(),line:li(),textAndImage:li(),outline:li(),hole:li()},distanceFillRegion:{fillRegion:li(),slot:li(),line:li(),textAndImage:li(),outline:li(),hole:li()},distanceSlot:{slot:li(),line:li(),textAndImage:li(),outline:li(),hole:li()},distanceLine:{line:li(),textAndImage:li(),outline:li(),hole:li()},distanceTextImage:{textAndImage:li(),outline:li(),hole:li()},distanceHole:{outline:li(),hole:li()},distanceComponent:{component:li(),SMDPad:li()},distancePlaneZone:{track:li(),SMDPad:li(),THPad:li(),SMDTestPoint:li(),THTestPoint:li(),via:li(),fillRegion:li(),planeZone:li(),slot:li(),line:li(),textAndImage:li(),outline:li(),hole:li()},distanceCopper:{track:li(),SMDPad:li(),THPad:li(),SMDTestPoint:li(),THTestPoint:li(),via:li(),fillRegion:li(),copper:li(),slot:li(),line:li(),textAndImage:li(),outline:li(),hole:li()},schematicNetlist:{netList:li()}};var Qa=class o{constructor(){this._isOpenDRCCustomCheck=!1;this.config=eUe}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}get isOpenDRCCustomCheck(){return this._isOpenDRCCustomCheck}set isOpenDRCCustomCheck(t){this._isOpenDRCCustomCheck=!!t}updateConfig(t){t&&(this.config=Object.assign({},this.config,t))}isCheck(t){return!this.isOpenDRCCustomCheck||!t?!0:t.enforce}isCheckDistance(t,e){if(!this.isOpenDRCCustomCheck)return!0;let r=null;return this.isSameComponentChild(t,e)?r=this.distanceSameComponentItem.distanceSameComponentItem:oi.getShape2NetDiff(t,e)?r=this.diff.minGap:(r=this.matchDistanceConfig(t,e),r||(r=this.matchDistanceConfig(e,t))),this.isCheck(r)}isCheckHoleDistance(t,e,r){let i=null;return this.isSameComponentChild(t,e)?i=this.distanceSameComponentItem.distanceSameComponentItem:r==1?i=this.matchHoleDistanceConfig(t,e):r==0&&(i=this.matchHoleDistanceConfig(e,t)),this.isCheck(i)}isSameComponentChild(t,e){let r=t.getParent(),i=e.getParent();return r instanceof vi&&i instanceof vi&&r.globalIndex===i.globalIndex}matchDistanceConfig(t,e){let r=null;if(t instanceof lr&&t.type=="Prohibited Region"||e instanceof lr&&e.type=="Prohibited Region")return this.prohibitRegionRule.overlapWithOtherObject;if(t instanceof vi)return e instanceof Je?this.distanceComponent.SMDPad:this.distanceComponent.component;let i=null;if(t instanceof yt)i=this.distanceTrack;else if(t instanceof Je){let n=gr(t.layerId);t.isTestPad?i=n?this.distanceTH_Test_Point:this.distanceSMD_Test_Point:i=n?this.distanceTHPad:this.distanceSMDPad}else t instanceof It?i=this.distanceVia:t instanceof lr&&(t.type=="Fill Region"||t.type=="TearDrop")?i=this.distanceFillRegion:t instanceof lr&&t.type=="Slot Region"?i=this.distanceSlot:t instanceof lr&&t.type=="Line"?i=this.distanceLine:t instanceof Li||t instanceof ql?i=this.distanceTextImage:t instanceof Pn?i=this.distanceCopper:t instanceof Cn&&(i=this.distancePlaneZone);if(i)if(e instanceof yt)r=i.track;else if(e instanceof Je){let n=gr(e.layerId);e.isTestPad?r=n?i.THTestPoint:i.SMDTestPoint:r=n?i.THPad:i.SMDPad}else e instanceof It?r=i.via:e instanceof lr&&(e.type=="Fill Region"||e.type=="TearDrop")?r=i.fillRegion:e instanceof lr&&e.type=="Slot Region"?r=i.slot:e instanceof lr&&e.type=="Line"?r=i.line:e instanceof Li||e instanceof ql?r=i.textAndImage:e instanceof lr&&e.type=="Board Outline"?r=i.outline:e instanceof Pn?r=i.copper:e instanceof Cn&&(r=i.planeZone);return r}matchHoleDistanceConfig(t,e){let r=null,i=null;if(t instanceof yt)i=this.distanceTrack;else if(t instanceof Je){let n=gr(t.layerId);t.isTestPad?i=n?this.distanceTH_Test_Point:this.distanceSMD_Test_Point:i=n?this.distanceTHPad:this.distanceSMDPad}else t instanceof It?i=this.distanceVia:t instanceof lr&&(t.type=="Fill Region"||t.type=="TearDrop")?i=this.distanceFillRegion:t instanceof lr&&t.type=="Slot Region"?i=this.distanceSlot:t instanceof lr&&t.type=="Line"?i=this.distanceLine:t instanceof Li||t instanceof ql?i=this.distanceTextImage:t instanceof Pn?i=this.distanceCopper:t instanceof Cn&&(i=this.distancePlaneZone);return i&&oi.isHole(e)&&(r=i.hole),r}get distanceSameComponentItem(){return this.config.distanceSameComponentItem}get prohibitRegionRule(){return this.config.prohibitRegionRule}get trackRule(){return this.config.trackRule}get netLength(){return this.config.netLength}get netLengthTolerance(){return this.config.netLengthTolerance}get holeSize(){return this.config.holeSize}get connect(){return this.config.connect}get diff(){return this.config.diff}get distanceTrack(){return this.config.distanceTrack}get distanceSMD_Test_Point(){return this.config.distanceSMD_Test_Point}get distanceTH_Test_Point(){return this.config.distanceTH_Test_Point}get distanceSMDPad(){return this.config.distanceSMDPad}get distanceTHPad(){return this.config.distanceTHPad}get distanceVia(){return this.config.distanceVia}get distanceFillRegion(){return this.config.distanceFillRegion}get distanceSlot(){return this.config.distanceSlot}get distanceHole(){return this.config.distanceHole}get distanceLine(){return this.config.distanceLine}get distanceTextImage(){return this.config.distanceTextImage}get distanceComponent(){return this.config.distanceComponent}get distancePlaneZone(){return this.config.distancePlaneZone}get distanceCopper(){return this.config.distanceCopper}get schematicNetlist(){return this.config.schematicNetlist}get creepageDistance(){return this.config["Creepage Distance"]}};var eV=class extends Lu{constructor(t,e,r,i,n,s){super(r,t,e),this._obj1=i,this._obj2=n,this.layerIds=s}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get obj2(){return this._obj2}set obj2(t){this._obj2=t}get errorType(){return"Copper Zone"}toJSON(){return{...super.toJSON(),errorType:this.errorType,name:this.name,obj1:this.obj1,obj2:this.obj2}}};var u5=class{encode(t=pi.getInstance().getAllItem()){let e=[];for(let r of t){let i=this.getErrorType(r);e.push({type:i,data:r.toJSON()})}return e}decode(t){let e=[];for(let r of t){let{type:i,data:n}=r;switch(i){case"ClearanceError":{let{position:s,name:a,obj1:l,obj1Type:c,obj2:h,obj2Type:u,minDistance:d,clearance:p,layerIds:m,errorType:g,net:y,line:b}=n,P=b,T=P&&(()=>{let{_start:C,_end:E}=P;return new M(new S(C.x,C.y),new S(E.x,E.y))})(),I=pi.getInstance().addClearanceError(new S(s.x,s.y),a,l,c,h,u,d,p,m,g,y,T);e.push(I);break}case"InnerError":{let{position:s,name:a,obj1:l,obj1Type:c,obj2:h,obj2Type:u,minDistance:d,clearance:p,layerIds:m}=n,g=pi.getInstance().addInnerError(new S(s.x,s.y),a,l,c,h,u,d,p,m);e.push(g);break}case"ConnectError":break;case"DifferentPairGapError":{let{position:s,name:a,obj1:l,obj1Type:c,obj2:h,obj2Type:u,minDistance:d,clearance:p,layerIds:m}=n,g=pi.getInstance().addDiffPairTrackGapError(new S(s.x,s.y),a,l,c,h,u,d,p,m);e.push(g);break}case"DifferentPairLengthError":{let{position:s,name:a,net_P:l,net_N:c,toleranceScope:h,value_P:u,value_N:d}=n,p=pi.getInstance().addDiffPairTrackLengthError(new S(s.x,s.y),a,l,c,h,u,d);e.push(p);break}case"DifferentPairWidthError":{let{position:s,name:a,obj:l,width:c,minWidth:h,maxWidth:u,layerIds:d}=n,p=pi.getInstance().addDiffPairTrackWidthError(new S(s.x,s.y),a,l,c,h,u,d);e.push(p);break}case"NetLengthError":{let{position:s,name:a,net:l,netLength:c,minNetLength:h,maxNetLength:u}=n,d=pi.getInstance().addNetLengthError(new S(s.x,s.y),a,l,c,h,u);e.push(d);break}case"NetLengthToleranceError":{let{position:s,name:a,net:l,netLengthDiff:c,netLengthTolerance:h}=n,u=pi.getInstance().addNetLengthToleranceError(new S(s.x,s.y),a,l,c,h);e.push(u);break}case"RadiusError":{let{position:s,name:a,obj1:l,type:c,radius:h,minRadius:u,maxRadius:d,layerIds:p,isBlind:m}=n,g=pi.getInstance().addRadiusError(new S(s.x,s.y),a,l,c,h,u,d,p,m);e.push(g);break}case"TrackError":{let{position:s,name:a,obj1:l,width:c,minWidth:h,maxWidth:u,layerIds:d}=n,p=pi.getInstance().addTrackWidthError(new S(s.x,s.y),a,l,c,h,u,d);e.push(p);break}case"NetlistError":{e.push(n);break}case"CreepageError":{let{position:s,name:a,obj1:l,obj1Type:c,obj2:h,obj2Type:u,minDistance:d,clearance:p,layerIds:m,errorType:g,path:y}=n,b=y.map(T=>{if(T.type==="Line")return new M(new S(T._start.x,T._start.y),new S(T._end.x,T._end.y));if(T.type==="Arc"){let{rx:I,ry:C,center:E,startAngle:O,sweepAngle:_}=T;return q.build3(new S(E.x,E.y),O,_,I,C)}}),P=pi.getInstance().addCreepageError(new S(s.x,s.y),a,l,c,h,u,d,p,g,m,b);e.push(P);break}}}return e}getErrorType(t){if(t instanceof sf)return"ClearanceError";if(t instanceof eC)return"InnerError";if(t instanceof Ky)return"ConnectError";if(t instanceof Zy)return"DifferentPairGapError";if(t instanceof Jy)return"DifferentPairLengthError";if(t instanceof Qy)return"DifferentPairWidthError";if(t instanceof eb)return"NetLengthError";if(t instanceof xT)return"NetLengthToleranceError";if(t instanceof eV)return"ProhibitError";if(t instanceof tb)return"RadiusError";if(t instanceof rb)return"TrackError";if(t instanceof iP)return"CreepageError"}};var lrn=te.getInstance(),crn=Qa.getInstance(),PX=sn.getInstance();function Zg(o){if(o instanceof yt)return"Track";if(o instanceof Je)return o.isTestPad?gr(o.layerId)?"TH Test Point":"SMD Test Point":gr(o.layerId)?"TH Pad":"SMD Pad";if(o instanceof It)return"Via";if(o instanceof lr)return o.layerId==11?"Board Outline":o.type;if(o instanceof Li)return"Text";if(o instanceof ql)return"Image";if(o instanceof vi)return"Device";if(o instanceof Pn)return"Copper Region(Filled)";if(o instanceof Cn)return"Plane Zone"}var p9e=class{constructor(){this._onlyCheck=!1}set onlyCheck(t){this._onlyCheck=t}get onlyCheck(){return this._onlyCheck}checkSpacing(t){let e=[],r=[];return t.copper.forEach(i=>{this.addError(i)?e.push(i):r.push(i)}),t.plane.forEach(i=>{this.addError(i)?e.push(i):r.push(i)}),t.safe.forEach(i=>{this.addError(i)?e.push(i):r.push(i)}),{success:e,fail:r}}addError(t){let{id1:e,id2:r,line:i,holeState:n,collideLayerIds:s}=t,a=t.distance,l=pc(e),c=pc(r),[h,u]=s,d=By(h,u),{rule:p,ruleType:m,clearance:g,net:y}=PX.ruleHelper.getShape2Clearance(l,c,void 0,n,d);if(!(g<0)){if(!oi.isProhibit(l)&&!oi.isProhibit(c)&&(a=xe(a,2)),!PX.checkSameNet&&a==0||a<g){if(p instanceof Hb){let b=this.getLineCenter(i);this.addDiffError(l,c,b,t.distance,g,p.name,s)}else if(p instanceof Wb)if(oi.isProhibit(l)||oi.isProhibit(l)){let T=l.getMathGraphics(l.layerId,0).bbox().extendOfSize(1e-5).isContains(i.start())?i.start():i.end();this.addClearanceError(l,c,T,t.distance,g,p.name,m,s,n)}else{let b=this.getLineCenter(i);this.addClearanceError(l,c,b,t.distance,g,p.name,m,s,n,void 0,i)}else{let b=this.getLineCenter(i);this.addClearanceError(l,c,b,t.distance,g,p.name,m,s,n,y)}return!1}return!0}}addError_Worker(t){let{shape1:e,shape2:r,line:i,holeState:n,collideLayerIds:s,ruleInfos:a}=t,l=t.distance,{rule:c,ruleType:h,clearance:u,net:d}=a;if(!(u<0)){if(!oi.isProhibit(e)&&!oi.isProhibit(r)&&(l=xe(l,2)),!PX.checkSameNet&&l==0||l<u){if(c instanceof Hb){let p=this.getLineCenter(i);this.addDiffError(e,r,p,t.distance,u,c.name,s)}else if(c instanceof Wb)if(oi.isProhibit(e)||oi.isProhibit(e)){let g=e.getMathGraphics(e.layerId,0).bbox().extendOfSize(1e-5).isContains(i.start())?i.start():i.end();this.addClearanceError(e,r,g,t.distance,u,c.name,h,s,n)}else{let p=this.getLineCenter(i);this.addClearanceError(e,r,p,t.distance,u,c.name,h,s,n,void 0,i)}else{let p=this.getLineCenter(i);this.addClearanceError(e,r,p,t.distance,u,c.name,h,s,n,d)}return!1}return!0}}getLineCenter(t){let e=t.start(),r=t.end();return e.add(r).mul(.5)}addClearanceError(t,e,r,i,n,s,a="Safe Spacing",l=[],c,h,u){if(this._onlyCheck)return;if(pi.getInstance().getClearanceError(t.globalIndex,e.globalIndex)==null||c!==void 0){let p=(m,g)=>{PX.checkEnv==0?pi.getInstance().addClearanceError(r,s,t.globalIndex,m,e.globalIndex,g,i,n,OY(l),a,h,u):pi.getInstance().errorRecordBuffer.add({type:"ClearanceError",data:{position:r,name:s,obj1:t.globalIndex,obj1Type:m,obj2:e.globalIndex,obj2Type:g,minDistance:i,clearance:n,layerIds:OY(l),errorType:a,net:h,line:u}})};if(c!==void 0)switch(c){case 0:p("Hole",Zg(e));break;case 1:p(Zg(t),"Hole");break;case 2:p("Hole","Hole");break;case 3:p(Zg(t),Zg(e));break}else p(Zg(t),Zg(e))}}addDiffError(t,e,r,i,n,s,a){if(this._onlyCheck)return;pi.getInstance().getDiffPairGapError(t.globalIndex,e.globalIndex)==null&&(PX.checkEnv==0?pi.getInstance().addDiffPairTrackGapError(r,s,t.globalIndex,Zg(t),e.globalIndex,Zg(e),i,n,OY(a)):pi.getInstance().errorRecordBuffer.add({type:"DifferentPairGapError",data:{position:r,name:s,obj1:t.globalIndex,obj1Type:Zg(t),obj2:e.globalIndex,obj2Type:Zg(e),minDistance:i,clearance:n,layerIds:OY(a)}}))}},uf=new p9e;var f5=class f5{constructor(){this.errors=new Array;this.id=0;this.pointInObstacle=!1;this.needRedraw2ShowObstaclePl=!1;this.obstacle=null;this.recordData=null}static getInstance(){return f5.manager==null&&(f5.manager=new f5),f5.manager}realTimeCheckRule(t=!1){this.needRedraw2ShowObstaclePl=!1,this.clear(!1);let e=tr.getInstance().mode,r=Un.getInstance();if(ah.switch){let i=this.getDrcCheckRoute(r,t),n=new As,s=Nt.filter;for(let a of i)for(let l of a){Nt.setPushFilter(),Nt.pushFilter.setNetAndLayerId(l.net,l.modelType=="Via"?null:l.layerId);let c=n.check(l);for(let h of c){let{source:u,obstacle:d,point:p}=h,m=this.id++,g=new sf(m.toString(),p,"",u.globalIndex,Zg(u),d.globalIndex,Zg(d),0,0,"Safe Spacing",[l.layerId]),{globalIndex:y,name:b,position:P,errorType:T,layerIds:I}=g,C=k1.getInstance().addItem(y,b,P,T,ce.pcbConfig.drcErrorZoom,I);C.contentModel=g,C.model.content=g,this.errors.push(C),$t.getVisible(35)?(C.visible(),C.isVisible=!0):(C.hidden(),C.isVisible=!1)}}Nt.filter=s}["WIRING_MODE_PUSHAWAY","WIRING_MODE_SURROUND_AND_PUSHAWAY","WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"].includes(e)&&this.displayCollidePl(r,t)}getDrcCheckRoute(t,e){var i,n;let r=[];if(e){let s=t.current.node,a=t.current.result.wireMap.get(s).getAllItems();if(r.push(a),t.current.result.wireVia.size>0){let h=(i=t.current.result.wireVia.get(s))==null?void 0:i.item;h&&_i.getInstance().getNode(h)&&r[0].push(h)}let l=t.getSingleVias();l.length>0&&(r[0]=r[0].concat(l));let c=t.getSingleEvents();return c.length>0&&(r[0]=r[0].concat(c)),r}else{for(let s=0;s<t.current.tracks.length;s++){let a=t.current.tracks[s],l=t.current.result.wireMap.get(a).getAllItems();if(r[s]||(r[s]=l),t.current.result.wireVia.size>0){let u=(n=t.current.result.wireVia.get(a))==null?void 0:n.item;u&&_i.getInstance().getNode(u)&&r[s].push(u)}let c=t.getSingleVias(s);c.length>0&&(r[s]=r[s].concat(c));let h=t.getSingleEvents(s);h.length>0&&(r[s]=r[s].concat(h))}return r}}getActualErrorPosition(t){let e=1/0,r;for(let i of t.source.getMathGraphics().primitives)for(let n of t.obstacle.getMathGraphics().primitives){let s=ir.getMinLine(i,n);s.length()<e&&(e=s.length(),r=s)}return r.start().add(r.end()).mul(.5)}recordEndPoints(t,e=!1){if(this.recordData={points:[],result:[]},t.tracks.length==1||e){this.recordData.points.push(t.position);let r=t.node,i=t.result.wireMap.get(r).getAllItems();i.length&&this.recordData.result.push(i)}else for(let r=0;r<t.tracks.length;r++){let i=t.tracks[r];this.recordData.points.push(i.end.clone().point);let n=t.result.wireMap.get(i).getAllItems();n.length&&this.recordData.result.push(n)}}isObstructMode(){return tr.getInstance().mode=="WIRING_MODE_OBSTRUCT"}displayCollidePl(t,e){q1.clear();let r=new As,i=(n,s)=>{if(this.recordData==null)return;let{points:a,result:l}=this.recordData;if(this.isObstructMode()&&this.pointInObstacle){if(this.originListMap&&this.originListMap.size>0){let c=this.originListMap.get(n);if(l.length&&c&&c.length){let h=c[0],u=Nt.filter;Nt.setPushFilter(),Nt.pushFilter.setNetAndLayerId(h.net,h.layerId);let p=new As().block(h);if(p.length>0){let m=Os.getInstance().getModelObstacle(p[0].obstacle,p[0].clearance,p[0].layer2).outline.outline;q1.displayPolyline(m);let g=c.flatMap(y=>y.primitive);for(let y of g)q1.displayPolyline(y.stroke(h.width,kr.ROUND,le.CCW))}Nt.filter=u}}return}if(a.length&&l.length){let c=l[s];if(c){let h=c[c.length-1],u=h.end,d=n.end.point,p=new M(d,u);if(!d.equals1(a[s])){let m=Nt.filter;Nt.setPushFilter(),Nt.pushFilter.setNetAndLayerId(h.net,h.layerId);let g=r.blockTrackPrimitive(h,p,!0,!1);if(g&&g.length>0){let y=g[0],b=Os.getInstance().getModelObstacle(y.obstacle,y.clearance,y.layer2).outline.outline;q1.displayPolyline(b),this.pointInObstacle&&q1.displayPolyline(p.stroke(h.width,kr.ROUND,le.CCW)),this.isObstructMode()&&(this.needRedraw2ShowObstaclePl=!0)}Nt.filter=m}}}};if(e){let n=t.current.node;i(n,0)}else for(let n=0;n<t.current.tracks.length;n++){let s=t.current.tracks[n];i(s,n)}}checkViaDRC(t){let e=!1,r=Un.getInstance().current,i=[];if(r.result.wireVia.size>0)for(let a of r.tracks){let l=r.result.wireVia.get(a).item;l&&_i.getInstance().getNode(l)&&i.push(l)}if(!i.length)return;let n=["WIRING_MODE_PUSHAWAY","WIRING_MODE_SURROUND_AND_PUSHAWAY","WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"],s=tr.getInstance().mode;if(n.includes(s)){let a=new As;Nt.setPushFilter();for(let l of i){Nt.pushFilter.setNetAndLayerId(l.net,null);let c=a.drcBlockViaPrimitive2(l);if(c.length){e=!0,this.clear();let h=0,u=.02;for(let P of c)h=Math.max(h,P.clearance),q1.add(P.obstacle,P.layer2,u);let d=Math.max(l.holeRadius-l.radius,0);q1.add(l,r.node.layerId,h+d/2),q1.displayCollideInfo();let p=Fo(l.center),m=Math.max(l.holeRadius,l.radius)/2+h,g=l.center.add(new S(m,0)),y=Fo(g),b=new Doe({viaPosition:{x:p.x,y:p.y,error:0},cb:()=>{this.clear(),t.cb&&t.cb()},cbCancel:()=>{this.clear(),t.cbCancel&&t.cbCancel()}});A.publish("openDialog",b)}}e||t.cb&&t.cb()}}getConstraintObstacle(){return this.obstacle}setConstraintObstacle(t,e){this.obstacle=t,this.obstacleLayerId=e}showViaObstaclePl(t){let e=new Ep;if(["WIRING_MODE_SURROUND_AND_PUSHAWAY","WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"].includes(tr.getInstance().mode)){this.clear();let i=this.getConstraintObstacle();if(i){let n=new uP,s=n.sycnRule1(t),a=n.sycnRule2(t,!0),c=new uP().sycnRule1(i),h=e.getSafeClearance(s,c,t,this.obstacleLayerId),u=e.getSafeClearance(a,c,t,this.obstacleLayerId),d=h+t.radius,p=u+t.holeRadius,m=d>p?h:u,g=be.getActiveLayer().layerID;q1.add(i,this.obstacleLayerId,m),q1.displayCollideInfo(),this.setConstraintObstacle(null,null)}}}clear(t=!0){t&&(this.clearCollidePl(),this.recordData=null);for(let e of this.errors)e.remove();this.errors.length=0}clearCollidePl(){q1.clear()}};f5.manager=null;var lu=f5;var TX=class TX{constructor(){this.pointInObstacle=!1;this.blockShape=new As;this.isWire=!1}run(t){}backFix(t,e,r=!0){if(!this.isWire)return!1;let n=this.getFirstInputStatus(t).item,l=new toe(n,new Br).find(r?n.start:n.end)!=null;return l&&(this.pointInObstacle=!0,lu.getInstance().pointInObstacle=!0),l}getFirstInputStatus(t){let e=t.listIterator();for(;e.hasNext();){let r=e.next();if(Fr.getInstance().getStatus(r).isInput)return r}return t.getFirstNode()}getLastPoint(t){let e=new Array;for(;t!=null;){e.push(t);let r=t.item,i=this.blockShape.blockTrackPrimitive(r,r.primitive,!0);if(i.length>0&&!i[0].point.equals1(r.start)){for(let n of e){let s=Fr.getInstance().getStatus(n);s.isInput=!0}return!0}t=t.prev}return!1}publish(){if(!this.pointInObstacle)return;let t=Date.now();t-TX.lastPublishTime>3e3&&(ie.publish("ui/toastMsg",{type:"warn",msg:"Track DRC violation detected,track could not be generated,please check the white DRC border"},$()),TX.lastPublishTime=t)}isChangeTrack(t){let e=Fr.getInstance().getStatus(t);return e.isInput||!e.notChange}getChangeTracks(t){let e=t.getFirstNode(),r=t.getLastNode();for(;e!=null&&!(this.isChangeTrack(e)||(e=e.next,e==r)););for(;r!=null&&!(this.isChangeTrack(r)||(r=r.prev,e==r)););let i=e,n=[];for(;i!=null&&(n.push(i.item),i!=r);)i=i.next;return n}sycnStatus(t,e){if(t==e)return;let i=Fr.getInstance().getStatus(t).clone();i.change(),Fr.getInstance().setStatus(e,i)}};TX.lastPublishTime=0;var mC=TX;var woe=class{constructor(t){this.connectList=new Set;this.via=t;let e=this.getTracks(t.buildBBox());for(let r of e){let i=r.model;if(i instanceof yt&&i.layerId==t.layerId&&i.net==t.net){if(t.inOutline(i.start)){let n=xt.getInstance().getListNode(i);n.prev==null&&this.connectList.add(n.parent)}if(t.inOutline(i.end)){let n=xt.getInstance().getListNode(i);n.next==null&&this.connectList.add(n.parent)}}}}getTracks(t){return Vt.searchByTypes(t,["Track","ArcTrack"]).getTracks()}};var Loe=class{constructor(t){this.pathCCW=new Set;this.pathCW=new Set;this.item=t}addCCW(t){this.pathCCW.add(t)}addCW(t){this.pathCW.add(t)}deleteCCW(t){this.pathCCW.delete(t)}deleteCW(t){this.pathCW.delete(t)}filter(t){let e=new Array,r=null,i=null,n=t[0];this.isDiffPair(n)&&(this.hasOtherDiffPair(n,this.pathCCW)&&(i=le.CW),this.hasOtherDiffPair(n,this.pathCW)&&(i==null?i=le.CCW:i=null));for(let s of t){if(r==null){let a=s.item;r=xt.getInstance().getNode(a).parent}s.aroundType>=2&&(s.newDirection==0?(this.pathCCW.has(r)||i==le.CCW)&&(s.cost+=s.weight,this.add2Obstacle(s)):(this.pathCW.has(r)||i==le.CW)&&(s.cost+=s.weight,this.add2Obstacle(s))),e.push(s)}return e}isDiffPair(t){var e;return((e=te.getInstance().getNet(t.item.net))==null?void 0:e.netDifferential)!=null}hasOtherDiffPair(t,e){var r,i;if(e.size>0){let n=(r=te.getInstance().getNet(t.item.net))==null?void 0:r.netDifferential;for(let s of e)if(n.hasNet((i=s.getFirst())==null?void 0:i.net))return!0}return!1}add2Obstacle(t){if(this.item instanceof It){let e=_i.getInstance().getViaNode(this.item);if(e!=null)for(let[r]of e.connectTrack)Nt.pushFilter.addExclusionList(r),t.cost+=this.getListLength(r)*2}else if(this.item instanceof Je){let e=yc.getInstance().getNode(this.item);if(e!=null)for(let[r]of e.connectTrack)Nt.pushFilter.addExclusionList(r),t.cost+=this.getListLength(r)*2}else if(this.item instanceof yt){let e=xt.getInstance().getNode(this.item);e.ignore||(Nt.pushFilter.addExclusionList(e.parent),t.cost+=this.getListLength(e.parent)*2)}else if(this.item instanceof lr&&(this.item.type=="Fill Region"||this.item.type=="TearDrop"||this.item.type=="Line")&&gs($e.getInstance().getLayer(this.item.layerId).type)){let e=new woe(this.item);for(let r of e.connectList)Nt.pushFilter.addExclusionList(r),t.cost+=this.getListLength(r)*2}}getListLength(t){let e=t.iterator(),r=0;for(;e.hasNext();){let i=e.next();r+=i.length}return r}};var m5=class m5{constructor(){this.map=new Map;this.temp=new Map;this._last=null}static getInstance(){return m5.manager==null&&(m5.manager=new m5),m5.manager}getObstacleInfo(t){return this._last=this.temp.get(t),this._last==null&&(this._last=new Loe(t),this.temp.set(t,this._last)),this._last}asyn(){let t=new Map;for(let[e,r]of this.temp)t.set(e,r),this._last=this.map.get(e),this._last==null?this.map.set(e,r):(Re.addAllSet(this._last.pathCCW,r.pathCCW),Re.addAllSet(this._last.pathCW,r.pathCW));return this.temp.clear(),t}undo(){this.temp.clear()}filter(t){if(t==null||t.length==0)return t;let e=t[0].obstacle,r=this.map.get(e);return r!=null&&(t=r.filter(t)),t}clear(){this.map.clear(),this.temp.clear()}};m5.manager=null;var Ju=m5;var tV=class extends Ou{constructor(e){super();this.map=new Map;this.map=e}upload(e){}updateData(){}redo(){}undo(){let e=Ju.getInstance();for(let[r,i]of this.map){let n=e.map.get(r);if(n!=null){for(let s of i.pathCCW)n.pathCCW.delete(s);for(let s of i.pathCW)n.pathCW.delete(s)}}}};var f9e=class{constructor(){this.clearanceUtils=new Ep;this.manager=Os.getInstance();this.pair1=new uP;this.pair2=new uP;this.lockedMap=new Map;this.obstacles=new Set}setFilter(t,e){this.obstacles=t,this.directFilter=e}isObstacle(t,e){return e.shape instanceof yt?this.isObstacle4Track(t,e):this.isObstacle4Via(t,e)}isObstacle4Track(t,e){if(t instanceof yt){let r=xt.getInstance().getNode(t);if(this.obstacles.has(r.parent))return!0;if(this.directFilter.canShove(t)&&!t.locked&&!Ps(t)&&t.getParent()==null){let i=this.getListNodePushDirect(r);if(i==null||e.pushItems.has(t))return e.pushItems.add(t),!1;{let n=Ot(t.primitive),s=i==le.CCW?new S(-n.y,n.x):new S(n.y,-n.x);return e.direct.dot(s)>0?(e.pushItems.add(t),!1):!0}}}else if(this.directFilter.canShoveViaModel(t))return e.pushItems.add(t),!1;return!0}isObstacle4Via(t,e){var r,i,n,s,a,l,c,h;if(t instanceof yt){let u=xt.getInstance().getNode(t);if(this.obstacles.has(u.parent))return!0;if(this.directFilter.canShove(t)&&!t.locked&&!Ps(t)&&t.getParent()==null){let d=this.getListNodePushDirect(u);if(d==null||e.pushItems.has(t))return e.pushItems.add(t),!1;{let p=Es.getInstance().getFirstPosition(e.shape),m=hg(t.primitive,p,(i=(r=u.prev)==null?void 0:r.item)==null?void 0:i.primitive,(s=(n=u.next)==null?void 0:n.item)==null?void 0:s.primitive),g=hg(t.primitive,e.point,(l=(a=u.prev)==null?void 0:a.item)==null?void 0:l.primitive,(h=(c=u.next)==null?void 0:c.item)==null?void 0:h.primitive);if(m!=g)return!1;if(g!=null&&g==d)return!0;let y=Ot(t.primitive),b=d==le.CCW?new S(-y.y,y.x):new S(y.y,-y.x);return e.direct.dot(b)>0?(e.pushItems.add(t),!1):!0}}}else if(this.directFilter.canShoveViaModel(t)&&!t.locked&&!Ps(t)&&t.getParent()==null){let u=Es.getInstance().getFirstPosition(t),d=Es.getInstance().getFirstPosition(e.shape);if(t.center.equals1(u))return e.pushItems.add(t),!1;let p=t.center.sub(u).normalize(),m=e.direct;if(p.dot(m)>.99){let y=u.sub(d);return m.dot(y)>0?(e.pushItems.add(t),!1):!0}}return!0}getListNodePushDirect(t){return Fr.getInstance().getStatus(t).pushDirect}exsitSpaceConstraint(t,e){let r=new _e,i=e?t[t.length-1].end:t[0].start,n=e?t[0].start:t[t.length-1].end;r.ext2(i).ext2(n);let s=r.build(),a=Nt.searchOutline(s);for(let l of a){let c=l.getMathGraphics();if(!c.isClose(.01))continue;let h=c.asClose(),u=Jr.pointInPolyline(n,h),d=Jr.pointInPolyline(i,h);if(u!=d)return!0}return!1}checkViaCollide(t,e){let r=t.shape;if(r instanceof yt){if(e.net!=r.net&&e.isContains(r.layerId)){let i=cn.pair1.sycnRule1(r),n=cn.pair2.sycnRule1(e);if(!e.isUnuseLayer(r.layerId)){let a=this.update4Track(t,r,e,i,n,r.layerId);if(a!=null)return a}let s=cn.pair2.sycnRule2(e,!0);return this.update4Track(t,r,e,i,s,12)}}else if(e.net!=r.net&&!r.isSeparated(e)){let i=$e.getInstance().getAllSignalLayerIds(),n=cn.pair1.sycnRule1(r),s=cn.pair1.sycnRule2(r,!0),a=cn.pair2.sycnRule1(e),l=cn.pair2.sycnRule2(e,!0),c=[];for(let h of i)if(r.isContains(h)){let u=this.getClearance(n,a,e,h),d=this.getClearance(n,l,e,h),p=this.getClearance(s,a,e,h),m=r.radius+u+e.radius,g=r.radius+d+e.holeRadius,y=r.holeRadius+p+e.radius;m>Math.max(g,y)?c.push({distance:m,layerId:h,type:"dis1"}):g>Math.max(m,y)?c.push({distance:g,layerId:h,type:"dis2"}):y>Math.max(m,g)&&c.push({distance:y,layerId:h,type:"dis3"})}if(c.length>0){let h=c.reduce((u,d)=>d.distance>u.distance?d:u);switch(h.type){case"dis1":return this.getPointInHull(t,e,h.distance-e.radius,h.layerId);case"dis2":return this.getPointInHull(t,e,h.distance-e.holeRadius,12);case"dis3":return this.getPointInHull(t,e,h.distance-e.radius,h.layerId)}}}return null}getClearance(t,e,r,i){return this.clearanceUtils.getSafeClearance(t,e,r,i)}update4Track(t,e,r,i,n,s){let a=this.getClearance(i,n,r,s);if(!ne.eq(a,0))return this.getPointInHull(t,r,a+e.width/2,s)}getPointInHull(t,e,r,i){return this.manager.getModelObstacle(e,r,i).outline.getPointInOutline(t.point,Ts)}clear(){this.lockedMap.clear()}},cn=new f9e;var g5=class extends Ou{upload(t){}updateData(){}constructor(t,e,r){super(),this.list=t,this.isSource=t.isSource,this.old=e.globalIndex,this.via=r.globalIndex}redo(){let t=this.getVia(this.old);if(t!=null){_i.getInstance().replace(this.list.item,t);let r=this.list.isSource;this.list.isSource=this.isSource,this.isSource=r}let e=this.via;this.via=this.old,this.old=e}undo(){let t=this.getVia(this.old);if(t!=null){_i.getInstance().replace(this.list.item,t);let r=this.list.isSource;this.list.isSource=this.isSource,this.isSource=r}let e=this.via;this.via=this.old,this.old=e}getVia(t){let e=Tn.getInstance().getItem(t);return e==null&&(e=_i.getInstance().getItem(t)),e}};var rV=class extends Ou{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e,r="add"){if(super(),this.gId=t.globalIndex,this.node=e,this.action=r,r=="delete"){let i=this.node.connectTrack;for(let[n,s]of i)s?n.viaNode.prev=null:n.viaNode.next=null}}redo(){let t=_i.getInstance().getItem(this.gId);if(t==null||t.isEmpty)throw new Error("via data error!!!");this.node.item=t,_i.getInstance().nodeMap.set(t,this.node)}undo(){if(this.action==="delete"){let t=_i.getInstance().getItem(this.gId);if(t==null||t.isEmpty)throw new Error("via data error!!!");this.node.item=t,_i.getInstance().nodeMap.set(t,this.node);let e=this.node.connectTrack;for(let[r,i]of e)i?r.viaNode.prev=this.node:r.viaNode.next=this.node}else{let t=_i.getInstance().getItem(this.gId);if(t==null||t.isEmpty)throw new Error("via data error!!!");_i.getInstance().nodeMap.delete(t)}}};var i9=class{constructor(){this.viaManager=_i.getInstance();this.viewManager=_r.getInstance()}cloneVia(t,e){let r=t.clone();r.globalIndex=`VIA${Vf.getInstance().getID()}`,this.viaManager.addModel(r),r.partition=x.getInstance().partitionId;let i=new db(r,"add");return this.viewManager.current.setViaVisible(r.globalIndex),e.addCommand(i),r}addVia(t,e,r,i,n){let s=this.viaManager.addVia(`VIA${Vf.getInstance().getID()}`,0,"",1,2,i,e,t,r,!1,1,-100,-100);s.partition=x.getInstance().partitionId;let a=new db(s,"add");return this.viewManager.current.setViaVisible(s.globalIndex),n.addCommand(a),s}addBlind(t,e,r,i,n,s,a,l){let c=this.viaManager.addVia(`VIA${Vf.getInstance().getID()}`,1,e,r,i,a,n,t,s,!1,1,-100,-100);c.partition=x.getInstance().partitionId;let h=new db(c,"add");return this.viewManager.current.setViaVisible(c.globalIndex),l.addCommand(h),c}deleteVia(t,e){this.viewManager.current.setViaHidden(t.globalIndex);let r=new db(t,"delete");e.addCommand(r)}createNode(t,e){let r=this.viaManager.createNode(t,!1),i=new rV(t,r);return e.addCommand(i),r}};var Moe=class{constructor(t){this.offset=S.ORIGIN;this.change=!1;this.via=t,this.oldCenter=t.center,this.center=t.center}setCenter(t){t.equals1(this.oldCenter)||(this.center=t,this.offset=t.sub(this.oldCenter),this.change=!0)}replace(){if(this.change){if(Yr.debug){let t=new c_(this.via.radius,{color:ee.GREEN,net:this.via.net});Yr.inputDebugGraphics(t),t.addCenter(this.via.center),t.addCenter(this.center)}Es.getInstance().changeViaPosition(this.via,this.via.center),this.via.center=this.center,_r.getInstance().current.setViaVisible(this.via.globalIndex),Es.getInstance().changeViaPosition(this.via,this.via.center),Os.getInstance().change.add(this.via.globalIndex),Ra.getInstance().change(this.via.globalIndex),hi.getInstance().updateTree(this.via),this.change=!1}}};function iV(o,t,e,r){let i=new Moe(o);if(i.setCenter(t),i.change){let n=new i9,s=_i.getInstance().getViaNode(i.via);if(s.isSource){let a=n.cloneVia(i.via,e),l=new g5(s,s.item,a);_i.getInstance().replace(i.via,a),e.addCommand(l),i.via=a,s.isSource=!1}for(let[a,l]of s.connectTrack){if(a.size()==0)continue;let c=l?a.getFirst():a.getLast();m9e(c,l,t,r,e)}e.addCommand(new db(i.via,"modify")),i.replace()}}function m9e(o,t,e,r,i){let s=xt.getInstance().getNode(o).parent;if(t){let h=s.getFirstNode(),u=h.next==null?h:h.next,d=h.item,p=u.item,m=d==r[0],g=d.primitive,y=p.primitive,b=Ot(g,g.start()),P=Ot(y),T;if(b.equals1(P))T=new no().degree45(b,e,p.end);else{let C=a(b);T=l(e,p.end,C)}let I=c(T,d,h,u,t);if(m){let C=0;for(let E of I)r[C++]=E}}else{let h=s.getLastNode(),u=h.prev==null?h:h.prev,d=s.getLast(),p=u.item,m=d==r[r.length-1],g=d.primitive,y=p.primitive,b=Ot(g),P=Ot(y),T=p.width,I=d.width,C;if(T===I){if(b.equals1(P))C=new no().degree45(b,p.start,e);else{let O=!a(b);C=l(p.start,e,O)}let E=c(C,d,u,h,t);if(m)if(r.length>1){let O=r.length-1;E.reverse();for(let _ of E)r[O--]=_}else{r.length=0;for(let O of E)r.push(O)}}}function a(h){return Math.abs(h.cross(new S(0,1)))<Rl||Math.abs(h.cross(new S(1,0)))<Rl}function l(h,u,d){let m=new no().degree45Model(h,u),g=m[0];return d&&(g=m[1]),[h,g,u]}function c(h,u,d,p,m){let g=new ri,y=g.createList(),b=new Array;for(let P=1;P<h.length;P++){let T=h[P-1],I=h[P],C=P==1?d.item.width:p.item.width,E=g.createTrack(u.layerId,T,I,C,u.showNet,i,u.getGroupID());b.push(E);let O=g.addList(E,y,i),_=P==1?d:p;rUe(_,O)}return y.replace(d,p),i.addCommand(new Ti(y)),b}}function tUe(o,t,e,r,i){let n=xt.getInstance().getNode(o);if(t){let c=n,h=c.next==null?c:c.next,u=c.item,d=h.item,p=u==r[0],m=u.primitive,g=d.primitive,y=Ot(m,m.start()),b=Ot(g),P;if(y.equals1(b))P=new no().degree45(y,e,d.end);else{let I=s(y);P=a(e,d.end,I)}let T=l(P,u,c,h,t);if(p){let I=0;for(let C of T)r[I++]=C}}else{let c=n.prev==null?n:n.prev,h=o,u=c.item,d=h==r[r.length-1],p=h.primitive,m=u.primitive,g=Ot(p),y=Ot(m),b=u.width,P=h.width,T;if(b===P){if(g.equals1(y))T=new no().degree45(g,u.start,e);else{let C=!s(g);T=a(u.start,e,C)}let I=l(T,h,c,n,t);if(d)if(r.length>1){let C=r.length-1;I.reverse();for(let E of I)r[C--]=E}else{r.length=0;for(let C of I)r.push(C)}}}function s(c){return Math.abs(c.cross(new S(0,1)))<Rl||Math.abs(c.cross(new S(1,0)))<Rl}function a(c,h,u){let p=new no().degree45Model(c,h),m=p[0];return u&&(m=p[1]),[c,m,h]}function l(c,h,u,d,p){let m=new ri,g=m.createList(),y=new Array;for(let b=1;b<c.length;b++){let P=c[b-1],T=c[b],I=b==1?u.item.width:d.item.width,C=m.createTrack(h.layerId,P,T,I,h.showNet,i,h.getGroupID());y.push(C);let E=m.addList(C,g,i),O=b==1?u:d;rUe(O,E)}return g.replace(u,d),i.addCommand(new Ti(g)),y}}function rUe(o,t){if(o==t)return;let r=Fr.getInstance().getStatus(o).clone();r.change(),r.clearPushDirect(),r.isReversePush=!1,Fr.getInstance().setStatus(t,r)}var Jg=class{constructor(t,e,r,i){this._lastPushDirect=null;this.parentMap=new Map;this.isReversePush=!1;this.valid=!0;this.pushItems=new Set;this.shape=t,this._point=e,this.direct=r,this.needContinue=i,this.debug=new c_(.5,{msg:"Constraint"})}get point(){return this._point}set point(t){this._point=t,this.debug.addCenter(t)}setParent(t,e){this.parentMap.set(t,e)}setDirect(t){this._lastPushDirect==null&&!this.direct.equals(S.ORIGIN)&&(this._lastPushDirect=this.direct),this._lastPushDirect!=null&&t!=null&&(this.isReversePush=ne.lesseq(this._lastPushDirect.dot(t),0)),this.direct=t}getStart(t){var e;if(t==11||t==12||t==1004){for(let[,r]of this.parentMap)return r.point;return null}else return(e=this.parentMap.get(t))==null?void 0:e.point}setConstraintObstacle(t,e){e||(e=t.layerId),lu.getInstance().setConstraintObstacle(t,e)}};var g9e=class{constructor(t){this.shape=t}bbox(){return this.shape.bbox()}},TOt=Math.sqrt(2),pb=class{constructor(t,e,r=!1){this.tree=new lP(20);this.min=Number.MAX_VALUE;this.pt=null;this.pointInLine=!1;this.pts=t,this.isClose=r;for(let i of t)this.tree.insert(new g9e(i));this.point=e}calculateDirect(t=this.point){this.point=t,this.pointInLine=!1;let e=this.tree.bbox(),i=new _e().ext1(e).ext2(this.point).build(),n=Math.max(i.width(),i.height()),s=1;for(;;){let a=this.point.bbox().extendOfSize(s),l=this.getDirect(a,s);if(s>=n){if(l!=null)return l;break}if(l!=null)return l;s*=2}return null}getDirect(t,e){let r=this.tree.search(t),i=new M(this.point,this.point);this.min=e*TOt,this.pt=null;let n=null;if(r.length>0)for(let s of r){let a=new ir(i,s.shape);a.getDistance()<this.min&&(this.min=a.getDistance(),this.pt=s.shape,n=s.shape)}if(n!=null){let s=this.pts.indexOf(n),a=s>0?this.pts[s-1]:null;this.isClose&&s==0&&(a=this.pts[this.pts.length-1]);let l=s<this.pts.length-1?this.pts[s+1]:null;this.isClose&&s==this.pts.length-1&&(l=this.pts[0]);let c=hg(n,this.point,a,l);return c==null?(this.pointInLine=!0,le.CCW):c}return null}get index(){return this.pt!=null?this.pts.indexOf(this.pt):-1}};var C3=class{constructor(t){this.manager=Os.getInstance();this.clearanceUtils=new Ep;this.hasConstraint=!1;this.shape=t}constraint(t){return!1}getNearPoint(t,e){let i=new ir(t,new M(e,e)).getLine();return i.start().equals1(e)?i.end():i.end().equals1(e)?i.start():e}getDirect(t,e,r){let i=Ot(t,e);return r==le.CCW?new S(-i.y,i.x):new S(i.y,-i.x)}calculatePolylineNearPoint(t,e,r){let i=new M(e,r),n=new Array;for(let s of t.primitives){if(s.bbox().isSeparated(i.bbox()))continue;let a=Tt(i,s);for(let l=0;l<a;l+=2){let c=new S(Ee[l],Ee[l+1]);n.push({pt:s,point:c})}}if(n.length>0){J0(n,i);let s=n[0];return this.getNearPoint(s.pt,r)}else return r}calculatePolylineSameDistancePoint(t,e){return t.calculateDirect(e),this.getNearPoint(t.pt,e)}getClearance(t,e,r,i){return this.clearanceUtils.getSafeClearance(t,e,r,i)}getConnectTrack(t,e){let r=_i.getInstance().getViaNode(t),i=0,n=null;for(let[s,a]of r.connectTrack){if(s.size()==0)continue;let l=a?s.getFirst():s.getLast();l.layerId==e&&l.width>i&&(i=l.width,n=l)}return n}getTrack(t){let e=_i.getInstance().getViaNode(t),r=0,i=null;for(let[n,s]of e.connectTrack){if(n.size()==0)continue;let a=s?n.getFirst():n.getLast();a.width>r&&(r=a.width,i=a)}return i}getPointInHull(t,e,r,i){return this.manager.getModelObstacle(e,r,i).outline.getPointInOutline(t.point,Ts)}update4Polyline(t,e,r){if(t!=null){if(e.obstacleLayerId=r,e.isReversePush&&e.getStart(r)!=null){let l=this.calculatePolylineNearPoint(t,e.getStart(r),e.point);if(!e.point.equals1(l)){e.point=l,this.hasConstraint=!0;return}}if(e.direct.equals1(S.ORIGIN))return this.update4Near(t,e);let i=new _e;i.ext2(e.point).ext1(t.bbox());let n=i.build1(),s=new M(e.point,e.point.add(e.direct.mul(n.width()+n.height()+10))),a=new Array;for(let l of t.primitives){let c=Tt(s,l);for(let h=0;h<c;h+=2){let u=new S(Ee[h],Ee[h+1]);u.equals1(e.point)||a.push(u)}}if(a.length>0){dn(a,s);let l=new pb(t.primitives,e.point,t.isClose(.01)),c=this.calculatePolylineSameDistancePoint(l,e.point);if(!c.equals1(e.point)&&ne.less(c.distance2(e.point),a[0].distance2(e.point))){let h=c.sub(e.point).normalize();if(ne.greatereq(h.dot(e.direct),0))e.setDirect(h),a[0]=c;else{let u=e.direct.cross(c.sub(e.point));u>0?(h=new S(-e.direct.y,e.direct.x),e.setDirect(h),a[0]=e.point.add(h.mul(Math.abs(u)))):(h=new S(e.direct.y,-e.direct.x),e.setDirect(h),a[0]=e.point.add(h.mul(Math.abs(u))))}}e.point=a[0],e.needContinue=!0,this.hasConstraint=!0}}}update4Near(t,e){let r=new pb(t.primitives,e.point,t.isClose(.01)),i=this.calculatePolylineSameDistancePoint(r,e.point);if(!i.equals1(e.point)){let n=i.sub(e.point).normalize();e.setDirect(n),e.point=i,this.hasConstraint=!0}}update4Track(t,e,r,i,n){let s=this.getClearance(r,i,this.shape,n);if(ne.eq(s,0))return;let a=this.getPointInHull(t,this.shape,s+e.width/2,n);a!=null&&this.update4Polyline(a,t,n)}update4Via(t,e,r,i){if(ne.eq(r,0))return;let n=this.getPointInHull(t,this.shape,r+e,i);n!=null&&this.update4Polyline(n,t,i)}};var Noe=class extends C3{constructor(t,e){super(t),this.pointOnlyNoneDrc=e}constraint(t){let e=!1,r=0;do this.hasConstraint=!1,this.drcConstraint(t),this.spaceConstraint(t),this.hasConstraint&&(e=!0),r++;while(this.hasConstraint&&r<20);return e&&t.setConstraintObstacle(this.shape,t.obstacleLayerId),e}drcConstraint(t){let e=t.shape,r=$e.getInstance().getAllSignalLayerIds();if(e instanceof yt)switch(this.shape.type){case"Board Outline":case"Line":{if(this.shape.net!=e.net&&this.shape.layerId==e.layerId||this.shape.layerId==11){let i=cn.pair1.sycnRule1(e),n=cn.pair2.sycnRule1(this.shape);this.update4Track(t,e,i,n,this.shape.layerId)}break}case"Partition":{let i=this.getPointInHull(t,this.shape,1e-4,this.shape.layerId);i!=null&&this.update4Polyline(i,t,this.shape.layerId);break}}else switch(this.shape.type){case"Board Outline":if(this.shape.layerId==11){let i=cn.pair1.sycnRule1(e),n=cn.pair1.sycnRule2(e,!0),s=cn.pair2.sycnRule1(this.shape),a=this.getClearance(n,s,e,this.shape.layerId),l=e.holeRadius+a,c=[];for(let u of r){let d=this.getClearance(i,s,e,u),p=e.radius+d;c.push({distance:p,layerId:u,type:"dis1"})}c.push({distance:l,layerId:this.shape.layerId,type:"dis2"});let h=this.getTrack(e);if(h!=null){let u=cn.pair1.sycnRule1(h),d=this.getClearance(u,s,e,h.layerId),p=h.width/2+d;c.push({distance:p,layerId:h.layerId,type:"dis3"})}if(c.length>0){let u=c.reduce((d,p)=>p.distance>d.distance?p:d);switch(u.type){case"dis1":this.update4Via(t,e.radius,this.getClearance(i,s,e,u.layerId),u.layerId);break;case"dis2":this.update4Via(t,e.holeRadius,a,u.layerId);break;case"dis3":let d=this.getPointInHull(t,this.shape,u.distance,u.layerId);d!=null&&this.update4Polyline(d,t,u.layerId);break}}}break;case"Line":{if(this.shape.net!=e.net&&e.isContains(this.shape.layerId)){let i=cn.pair1.sycnRule1(e),n=cn.pair1.sycnRule2(e,!0),s=cn.pair2.sycnRule1(this.shape),a=this.getClearance(i,s,e,this.shape.layerId),l=this.getClearance(n,s,e,this.shape.layerId),c=this.shape.layerId==11?this.getTrack(e):this.getConnectTrack(e,this.shape.layerId),h=e.radius+a,u=e.holeRadius+l,d=0;if(c!=null){let p=cn.pair1.sycnRule1(c),m=this.getClearance(p,s,e,c.layerId);d=c.width/2+m}if(d>Math.max(h,u)){let p=this.getPointInHull(t,this.shape,d,this.shape.layerId);p!=null&&this.update4Polyline(p,t,this.shape.layerId)}else e.radius+a>=e.holeRadius+l?this.update4Via(t,e.radius,a,this.shape.layerId):this.update4Via(t,e.holeRadius,l,this.shape.layerId)}break}case"Partition":{let i=this.getPointInHull(t,this.shape,1e-4,this.shape.layerId);i!=null&&this.update4Polyline(i,t,this.shape.layerId);break}}}spaceConstraint(t){let e=t.shape;switch(this.shape.type){case"Board Outline":case"Line":{if(this.shape.net!=e.net&&(e instanceof yt&&this.shape.layerId==e.layerId||e instanceof It&&e.isContains(this.shape.layerId))||this.shape.layerId==11){let r=this.shape.getMathGraphics();if(!r.isClose(.01))return;let i=t.getStart(this.shape.layerId);i==null&&(i=t.point);let n=t.point,s=r.asClose(),a=Jr.pointInPolyline(i,s),l=Jr.pointInPolyline(n,s);if(!this.pointOnlyNoneDrc&&a!=l){let c=this.calculatePolylineNearPoint(r,i,n);if(!c.equals1(n)){let h=c.sub(n).normalize();t.setDirect(h),t.point=c,t.isReversePush=!0,this.hasConstraint=!0}}}break}case"Partition":{let r=this.shape.getMathGraphics(),i=r.asClose(),n=Jr.pointInPolyline(t.point,i);if(this.shape.globalIndex==e.partition&&n)return;if(this.shape.globalIndex!=e.partition&&!n)return;let s=t.getStart(this.shape.layerId);s==null&&(s=t.point),this.shape.partition==e.globalIndex&&(Jr.pointInPolyline(s,r)||(s=r.bbox().center()));let a=this.calculatePolylineNearPoint(r,s,t.point);if(!a.equals1(t.point)){let l=a.sub(t.point).normalize();t.setDirect(l),t.isReversePush=!0,t.point=a,this.hasConstraint=!0}break}}}};var nV=class extends C3{constraint(t){let e=!1,r=0;do this.hasConstraint=!1,this.drcConstraint(t),this.hasConstraint&&(e=!0),r++;while(this.hasConstraint&&r<20);return e&&t.setConstraintObstacle(this.shape,t.obstacleLayerId),e}drcConstraint(t){let e=t.shape,r=$e.getInstance().getAllSignalLayerIds();if(this.shape instanceof Je){if(e instanceof yt){if(this.shape.net!=e.net&&(this.shape.layerId==e.layerId||this.shape.layerId==12)){let i=cn.pair1.sycnRule1(e),n=cn.pair2.sycnRule1(this.shape);if(this.shape.isUnuseLayer(e.layerId)||this.update4Track(t,e,i,n,e.layerId),this.shape.layerId==12){let s=cn.pair2.sycnRule2(this.shape,!0);this.update4Track(t,e,i,s,12)}}}else if(this.shape.net!=e.net&&(e.isContains(this.shape.layerId)||this.shape.layerId==12))if(this.shape.layerId==12){let i=cn.pair1.sycnRule1(e),n=cn.pair1.sycnRule2(e,!0),s=cn.pair2.sycnRule1(this.shape),a=cn.pair2.sycnRule1(this.shape,!0);for(let l of r)if(e.isContains(l)){let c=this.getClearance(i,s,this.shape,l),h=this.getClearance(n,s,this.shape,l),u=e.radius+c,d=e.holeRadius+h,p=0,m=this.getConnectTrack(e,l);if(m!=null){let y=cn.pair1.sycnRule1(m),b=this.getClearance(y,s,e,l);p=m.width/2+b}if(p>Math.max(u,d)){let y=this.getPointInHull(t,this.shape,p,l);y!=null&&this.update4Polyline(y,t,l)}else u>d?this.update4Via(t,e.radius,c,l):this.update4Via(t,e.holeRadius,h,l);let g=this.getClearance(i,a,this.shape,l);this.update4Via(t,e.radius,g,12)}}else{let i=cn.pair1.sycnRule1(e),n=cn.pair1.sycnRule2(e,!0),s=cn.pair2.sycnRule1(this.shape),a=this.getClearance(i,s,e,this.shape.layerId),l=this.getClearance(n,s,e,this.shape.layerId),c=e.radius+a,h=e.holeRadius+l,u=0,d=this.getConnectTrack(e,this.shape.layerId);if(d!=null){let p=cn.pair1.sycnRule1(d),m=this.getClearance(p,s,e,this.shape.layerId);u=d.width/2+m}if(u>Math.max(c,h)){let p=this.getPointInHull(t,this.shape,u,this.shape.layerId);p!=null&&this.update4Polyline(p,t,this.shape.layerId)}else c>=h?this.update4Via(t,e.radius,a,this.shape.layerId):this.update4Via(t,e.holeRadius,l,this.shape.layerId)}}else if(this.shape instanceof Li||this.shape instanceof ql){if(e instanceof yt){if(this.shape.layerId==e.layerId){let i=cn.pair1.sycnRule1(e),n=cn.pair2.sycnRule1(this.shape);this.update4Track(t,e,i,n,this.shape.layerId)}}else if(e.isContains(this.shape.layerId)){let i=cn.pair1.sycnRule1(e),n=cn.pair1.sycnRule2(e,!0),s=cn.pair2.sycnRule1(this.shape),a=this.getClearance(i,s,e,this.shape.layerId),l=this.getClearance(n,s,e,this.shape.layerId),c=e.radius+a,h=e.holeRadius+l,u=0,d=this.getConnectTrack(e,this.shape.layerId);if(d!=null){let p=cn.pair1.sycnRule1(d),m=this.getClearance(p,s,e,this.shape.layerId);u=d.width/2+m}if(u>Math.max(c,h)){let p=this.getPointInHull(t,this.shape,u,this.shape.layerId);p!=null&&this.update4Polyline(p,t,this.shape.layerId)}else e.radius+a>=e.holeRadius+l?this.update4Via(t,e.radius,a,this.shape.layerId):this.update4Via(t,e.holeRadius,l,this.shape.layerId)}}else if(e instanceof yt)switch(this.shape.type){case"TearDrop":case"Fill Region":{if(this.shape.layerId==e.layerId&&this.shape.net!=e.net){let n=cn.pair1.sycnRule1(e),s=cn.pair2.sycnRule1(this.shape);this.update4Track(t,e,n,s,this.shape.layerId)}break}case"Slot Region":{let n=cn.pair1.sycnRule1(e),s=cn.pair2.sycnRule1(this.shape);this.update4Track(t,e,n,s,this.shape.layerId);break}case"Prohibited Region":{if(this.shape.layerId==e.layerId||this.shape.layerId==12){let n=this.shape.component,s=1e-4;if(n.track){let a=this.getPointInHull(t,this.shape,s+e.width/2,this.shape.layerId);a!=null&&this.update4Polyline(a,t,this.shape.layerId)}}break}}else switch(this.shape.type){case"TearDrop":case"Fill Region":{let n=this.shape.net!=e.net,s=this.shape.component;if(s instanceof ln&&s.isBridgingCopper){let a=s.networkList;a.length==0&&e.net==""||a.length==1&&e.net==a[0]?n=!1:n=!0}if(e.isContains(this.shape.layerId)&&n){let a=cn.pair1.sycnRule1(e),l=cn.pair1.sycnRule2(e,!0),c=cn.pair2.sycnRule1(this.shape),h=this.getClearance(a,c,e,this.shape.layerId),u=this.getClearance(l,c,e,this.shape.layerId),d=e.radius+h,p=e.holeRadius+u,m=0,g=this.getConnectTrack(e,this.shape.layerId);if(g!=null){let y=cn.pair1.sycnRule1(g),b=this.getClearance(y,c,e,this.shape.layerId);m=g.width/2+b}if(m>Math.max(d,p)){let y=this.getPointInHull(t,this.shape,m,this.shape.layerId);y!=null&&this.update4Polyline(y,t,this.shape.layerId)}else e.radius+h>=e.holeRadius+u?this.update4Via(t,e.radius,h,this.shape.layerId):this.update4Via(t,e.holeRadius,u,this.shape.layerId)}break}case"Slot Region":{let n=cn.pair1.sycnRule1(e),s=cn.pair1.sycnRule2(e,!0),a=cn.pair2.sycnRule1(this.shape),l=this.getClearance(s,a,e,this.shape.layerId),c=e.holeRadius+l,h=[];for(let u of r)if(e.isContains(u)){let d=this.getClearance(n,a,e,u),p=e.radius+d;h.push({distance:p,layerId:u,type:"dis1"});let m=this.getConnectTrack(e,u);if(m!=null){let g=cn.pair1.sycnRule1(m),y=this.getClearance(g,a,e,u),b=m.width/2+y;b>0&&h.push({distance:b,layerId:u,type:"dis3"})}}if(h.push({distance:c,layerId:this.shape.layerId,type:"dis2"}),h.length>0){let u=h.reduce((d,p)=>p.distance>d.distance?p:d);switch(u.type){case"dis1":this.update4Via(t,e.radius,this.getClearance(n,a,e,u.layerId),u.layerId);break;case"dis2":this.update4Via(t,e.holeRadius,l,u.layerId);break;case"dis3":let d=this.getPointInHull(t,this.shape,u.distance,u.layerId);d&&this.update4Polyline(d,t,u.layerId);break}}break}}}};var gC=class extends C3{constructor(e,r){super(e);this.map=new Map;this.onlyDrc=r}constraint(e){let r=!1,i=0;do this.hasConstraint=!1,this.drcConstraint(e),this.onlyDrc||this.spaceConstraint(e),this.hasConstraint&&(r=!0),i++;while(this.hasConstraint&&i<20);return r&&e.setConstraintObstacle(this.shape),r}drcConstraint(e,r=this.shape){let i=this.getHull(e,r);this.calculate4Hull(i,r,e)}getHull(e,r){let i=e.shape;if(i instanceof yt){if(i.net!=r.net&&i.layerId==r.layerId){let n=cn.pair1.sycnRule1(i),s=cn.pair2.sycnRule1(r),a=this.getClearance(n,s,r,this.shape.layerId);return ne.eq(a,0)?null:this.getPointInHull(e,r,a+i.width/2,r.layerId)}}else if(i.net!=r.net&&i.isContains(r.layerId)){let n=cn.pair1.sycnRule1(i),s=cn.pair1.sycnRule2(i,!0),a=cn.pair2.sycnRule1(r),l=this.getClearance(n,a,i,r.layerId),c=this.getClearance(s,a,i,r.layerId),h,u=this.getConnectTrack(i,r.layerId),d=i.radius+l,p=i.holeRadius+c,m=0;if(u!=null){let g=cn.pair1.sycnRule1(u),y=this.getClearance(g,a,i,r.layerId);m=u.width/2+y}if(m>Math.max(d,p))h=this.getPointInHull(e,r,m,r.layerId);else if(d>=p){if(ne.eq(l,0))return null;h=this.getPointInHull(e,r,d,r.layerId)}else{if(ne.eq(c,0))return null;h=this.getPointInHull(e,r,p,r.layerId)}return h}return null}calculate4Hull(e,r,i){if(e!=null){let n=xt.getInstance().getListNode(r),a=Fr.getInstance().getStatus(n).pushDirect;if(a!=null){let l=this.getListPrimitives(n.parent),c=new pb(l,i.point),h=c.calculateDirect(i.point),u=this.getNearPoint(c.pt,i.point),d=this.getDirect(c.pt,u,a),p=i.shape,m=!1;if(p instanceof yt){let y=xt.getInstance().getListNode(p);m=Fr.getInstance().getStatus(y).isSource==!0}let g=c.calculateDirect(i.parentMap.get(r.layerId).point||i.point);g!=h&&g!=a||m&&g==h&&g!=a?i.setDirect(d.mul(-1)):i.setDirect(d)}this.update4Polyline(e,i,this.shape.layerId)}}spaceConstraint(e){let r=e.shape;if(r.net!=this.shape.net&&r instanceof yt&&r.layerId==this.shape.layerId||r instanceof It&&r.isContains(this.shape.layerId)&&e.parentMap.get(this.shape.layerId)!=null){let i=xt.getInstance().getListNode(this.shape),n=this.getListPrimitives(i.parent),s=new pb(n,e.point),a=s.calculateDirect(e.parentMap.get(this.shape.layerId).point),l=s.pointInLine,c=s.calculateDirect(e.point),h=s.pointInLine;if((l||h)&&(c=a),a!=c){let u;e.isReversePush?u=this.calculatePolylineNearPoint(fe.build7(n),e.parentMap.get(this.shape.layerId).point,e.point):u=this.calculatePolylineSameDistancePoint(s,e.point);let d=s.index;if(n.length>1&&d==0&&u.equals1(n[0].start())||n.length>1&&d==n.length-1&&u.equals1(n[n.length-1].end()))return;if(!u.equals1(e.point)){let p=Ot(s.pt,u),m=a==le.CCW?new S(-p.y,p.x):new S(p.y,-p.x);e.setDirect(m),e.point=u;let g=this.map.get(s.index);if(g!=null){g==this.shape&&(e.isReversePush=!1);let y=this.getHull(e,g);this.update4Polyline(y,e,this.shape.layerId)}this.hasConstraint=!0}}}}getListPrimitives(e){let r=new Array(e.size()),i=e.iterator(),n=0,s;for(;i.hasNext();)s=i.next(),r[n]=s.primitive,this.map.set(n,s),n++;return r}};var koe=class extends C3{constructor(t){super(t)}constraint(t){let e=!1,r=0;do this.hasConstraint=!1,this.drcConstraint(t),this.hasConstraint&&(e=!0),r++;while(this.hasConstraint&&r<20);return e&&t.setConstraintObstacle(this.shape,t.obstacleLayerId),e}drcConstraint(t){let e=t.shape;if(e instanceof yt){if(this.shape.net!=e.net&&this.shape.isContains(e.layerId)){let r=cn.pair1.sycnRule1(e),i=cn.pair2.sycnRule1(this.shape);this.shape.isUnuseLayer(e.layerId)||this.update4Track(t,e,r,i,e.layerId);let n=cn.pair2.sycnRule2(this.shape,!0);this.update4Track(t,e,r,n,12)}}else if(this.shape.net!=e.net&&!e.isSeparated(this.shape)){let r=$e.getInstance().getAllSignalLayerIds(),i=cn.pair1.sycnRule1(e),n=cn.pair1.sycnRule2(e,!0),s=cn.pair2.sycnRule1(this.shape),a=cn.pair2.sycnRule2(this.shape,!0),l=[];for(let c of r)if(e.isContains(c)){let h=this.getClearance(i,s,this.shape,c),u=this.getClearance(i,a,this.shape,c),d=this.getClearance(n,s,this.shape,c),p=e.radius+h+this.shape.radius,m=e.radius+u+this.shape.holeRadius,g=e.holeRadius+d+this.shape.radius;l.push({distance:p,layerId:c,type:"dis1"}),l.push({distance:m,layerId:c,type:"dis2"}),l.push({distance:g,layerId:c,type:"dis3"});let y=this.getConnectTrack(e,c);if(y!=null){let b=cn.pair1.sycnRule1(y),P=this.getClearance(b,s,e,c),T=y.width/2+P;T>0&&l.push({distance:T,layerId:c,type:"dis5"})}}if(l.length>0){let c=l.reduce((h,u)=>u.distance>h.distance?u:h);switch(c.type){case"dis5":let h=this.getPointInHull(t,this.shape,c.distance,c.layerId);h!=null&&this.update4Polyline(h,t,c.layerId);break;case"dis1":this.update4Via(t,e.radius,c.distance-e.radius-this.shape.radius,c.layerId);break;case"dis2":this.update4Via(t,e.radius,c.distance-e.radius-this.shape.holeRadius,c.layerId);break;case"dis3":this.update4Via(t,e.holeRadius,c.distance-e.holeRadius-this.shape.radius,c.layerId);break}}}}};var oV=class{constructor(t,e,r,i=new Set){this.block=new As;this.endtime=0;this.success=!0;this.obstacles=new Set;this.used=new Set;this.endtime=t,this.isWire=e,this.obstacles=i,this.directFilter=r,cn.setFilter(this.obstacles,this.directFilter)}isInput(t){let e=xt.getInstance().getListNode(t);return Fr.getInstance().getStatus(e).isInput}getConstraintPoint(t,e,r,i){let n=new Jg(t,e,S.ORIGIN,!0),s=new Jg(t,r,S.ORIGIN,!0);return s.setParent(i,n),s}addObstacle(t){this.obstacles.add(t);let e=t.otherNode.prev;e!=null&&e instanceof Kn&&this.obstacles.add(e);let r=t.otherNode.next;r!=null&&r instanceof Kn&&this.obstacles.add(r)}searchItems(){this.constraintPoint.needContinue=!1;let t=this.constraintPoint.point,r=te.getInstance().getMaxSafe(),i=this.getSize(),n=t.bbox().extendOfSize(i+r),s=Nt.search1(n),a=new _e().ext2(t);for(let[,h]of this.constraintPoint.parentMap)a.ext2(h.point);a.ext7(i+r);let l=a.build(),c=Nt.searchOutline(l);for(let h of c)s.addModel(h);return s}search(){let t=this.searchItems();for(let e of t.tracks){let r=new gC(e,this.onlyDrc(e));if(!(e.net==this.net||r.getHull(this.constraintPoint,e)==null||!cn.isObstacle(e,this.constraintPoint))&&r.constraint(this.constraintPoint)){let i=xt.getInstance().getListNode(e).parent;return this.addObstacle(i),!0}}for(let e of t.pads)if(new nV(e).constraint(this.constraintPoint))return!0;for(let e of t.vias){if(e.net==this.net||cn.checkViaCollide(this.constraintPoint,e)==null||!cn.isObstacle(e,this.constraintPoint))continue;if(new koe(e).constraint(this.constraintPoint))return!0}for(let e of t.profiles)switch(e.type){case"Prohibited Region":case"Slot Region":case"TearDrop":case"Fill Region":{if(new nV(e).constraint(this.constraintPoint))return!0;break}case"Board Outline":case"Partition":case"Line":{if(new Noe(e,this.closeShapeOnlyDrc(e)).constraint(this.constraintPoint))return!0;break}}for(let e of t.imageTexts)if(new nV(e).constraint(this.constraintPoint))return!0;return!1}offset(){this.init();let t=0;do{if(!this.search())break;t++}while(t<25&&performance.now()<this.endtime);Yr.debug&&Yr.inputDebugGraphics(this.constraintPoint.debug)}sycnShoveInfo(){if(this.success)for(let t of this.constraintPoint.pushItems)t instanceof yt?this.directFilter.awaitShove.add(t):this.directFilter.awaitShove.add(_i.getInstance().getNode(t))}sycnStatus(t,e){if(t==e)return;let i=Fr.getInstance().getStatus(t).clone();i.change(),Fr.getInstance().setStatus(e,i)}};var yC=class extends oV{constructor(t,e,r,i,n,s,a=new Set){super(i,n,s,a),this.tracks=t,this.findNewEnd=r,this.command=e,r?(this.track=t[t.length-1],this.constraintPoint=this.getConstraintPoint(this.track,this.tracks[0].start,this.track.end,this.track.layerId)):(this.track=t[0],this.constraintPoint=this.getConstraintPoint(this.track,this.tracks[this.tracks.length-1].end,this.track.start,this.track.layerId)),this.pointCollideTrack=this.getFirstCollideTrack(),cn.setFilter(this.obstacles,this.directFilter);let c=xt.getInstance().getListNode(this.track).parent;if(this.isWire)this.fix=!1;else{let h=cn.lockedMap.get(c);h!=null?this.fix=r?!h:h:this.fix=!1}}getFirstCollideTrack(){if(this.findNewEnd)for(let t=this.tracks.length-1;t>=0;t--){let e=this.tracks[t],r=this.block.blockTrackOnlyTrack(e,this.findNewEnd?e.primitive.reverse():e.primitive,!0);for(let i of r){let n=i.obstacle;if(!i.isSameNet&&n instanceof yt)return n}}else for(let t=0;t<this.tracks.length;t++){let e=this.tracks[t],r=this.block.blockTrackOnlyTrack(e,this.findNewEnd?e.primitive.reverse():e.primitive,!0);for(let i of r){let n=i.obstacle;if(!i.isSameNet&&n instanceof yt)return n}}return null}get net(){return this.track.net}closeShapeOnlyDrc(t){return t.layerId!=12&&t.layerId!=11&&t.layerId!=1004&&this.track.layerId!=t.layerId?!0:this.isWire?!this.findNewEnd:this.fix}constraintCheck(t){let e=this.block.blockTrackOnlyTrack(t,this.findNewEnd?t.primitive:t.primitive.reverse(),!0);if(e.length>0)for(let r of e){let i=r.obstacle;if(!r.isSameNet&&i instanceof yt){let s=xt.getInstance().getListNode(i).parent;if(this.used.has(s))continue;this.used.add(s);let a=this.isWire?this.isInput(i):!1;if(new gC(i,a).constraint(this.constraintPoint))return this.addObstacle(s),!0;if(this.pointCollideTrack!=null&&xt.getInstance().getListNode(this.pointCollideTrack).parent==s)return this.addObstacle(s),!0}}return!1}getConstraintPoint(t,e,r,i){let n=new Jg(t,e,S.ORIGIN,!0),s=new Jg(t,r,S.ORIGIN,!0);return s.setParent(i,n),s}getSize(){return this.track.width/2}onlyDrc(t){return t.layerId!=this.track.layerId||t.locked||Ps(t)||t.getParent()!=null||this.isWire&&this.isInput(t)}init(){if(this.findNewEnd)for(let t=0;t<this.tracks.length&&!this.constraintCheck(this.tracks[t]);t++);else for(let t=this.tracks.length-1;t>=0&&!this.constraintCheck(this.tracks[t]);t--);}getResult(){this.sycnShoveInfo(),m9e(this.track,!this.findNewEnd,this.constraintPoint.point,this.tracks,this.command)}};var n9=class extends yC{constructor(e,r,i,n,s,a,l,c=new Set){super(e,i,n,s,a,l,c);this.layerMap=new Map;this.via=r,n?this.constraintPoint=this.getConstraintPoint(this.via,this.tracks[0].start,this.tracks[this.tracks.length-1].end,this.track.layerId):this.constraintPoint=this.getConstraintPoint(this.via,this.tracks[this.tracks.length-1].end,this.tracks[0].start,this.track.layerId);let h=_i.getInstance().getViaNode(this.via);this.directFilter=l,this.directFilter.awaitShove.has(h)&&(this.directFilter.awaitShove.delete(h),this.directFilter.awaitingVias.add(h))}onlyDrc(e){return this.layerMap.get(e.layerId)?this.isWire?this.isInput(e):!1:!0}closeShapeOnlyDrc(e){return e.layerId!=12&&e.layerId!=11&&e.layerId!=1004&&!this.layerMap.get(e.layerId)?!0:this.isWire?!this.findNewEnd:this.fix}trackCheck(e,r,i,n){let s=this.block.blockTrackOnlyTrack(e,r?e.primitive.reverse():e.primitive,!0);if(s.length>0)for(let a of s){let l=a.obstacle;if(!a.isSameNet&&l instanceof yt){let h=xt.getInstance().getListNode(l).parent;if(this.obstacles.has(h))continue;this.addObstacle(h);let u=this.constraintPoint.parentMap.get(e.layerId);return u==null?(u=new Jg(this.via,a.point,S.ORIGIN,!0),this.constraintPoint.setParent(e.layerId,u)):u.point=a.point,i.set(n,a),!0}}else{let a=this.constraintPoint.parentMap.get(e.layerId);if(a==null){let l=Es.getInstance().getFirstPosition(this.via);a=new Jg(this.via,l,S.ORIGIN,!0),this.constraintPoint.setParent(e.layerId,a)}}return!1}init(){let e=0,r=_i.getInstance().getViaNode(this.via),i=new Map;for(let[c,h]of r.connectTrack)if(h){let u=c.getLastNode();for(;u!=null;){let d=u.item;if(this.trackCheck(d,h,i,c))break;u=u.prev}}else{let u=c.getFirstNode();for(;u!=null;){let d=u.item;if(this.trackCheck(d,h,i,c))break;u=u.next}}let n=$e.getInstance().getAllCopperLayerIds(),s=Es.getInstance().getFirstPosition(this.via);for(let c of n)if(this.constraintPoint.parentMap.get(c)==null){this.layerMap.set(c,!1);let h=new Jg(this.via,s,S.ORIGIN,!0);this.constraintPoint.setParent(c,h)}else this.layerMap.set(c,!0);let a=!1,l=new Ba;do{a=!1;for(let[c]of r.connectTrack){let h=i.get(c);if(h!=null){let u=h.obstacle;new gC(u,this.onlyDrc(u)).constraint(this.constraintPoint)&&!l.contains(this.constraintPoint.point)&&(a=!0,l.add(this.constraintPoint.point),this.constraintPoint.setConstraintObstacle(u))}}e++}while(a&&e<20)}getSize(){return Math.max(this.via.radius,this.via.holeRadius)}getResult(){this.sycnShoveInfo(),iV(this.via,this.constraintPoint.point,this.command,this.tracks)}};var S3=class{constructor(){this.obstacles=new Set;this.canShovePath=new Set;this.canShoveVia=new Set;this.awaitShove=new Set;this.awaitingVias=new Set;this.completes=new Set;this.max=-1}canShove(t){if(this.obstacles.has(t))return!1;let e=this.getPath(t);return this.canShovePath.has(e)}canShoveViaModel(t){if(this.obstacles.has(t))return!1;let e=_i.getInstance().getViaNode(t);return this.canShoveVia.has(e)}getPath(t){let e=xt.getInstance().getNode(t);return e!=null?e.parent:null}};var sV=class{constructor(t,e){this.block=new As;this.used=new Set;if(this.tracks=t,this.findNewEnd=e,e){this.track=t[t.length-1];for(let r of t){let i=this.block.blockTrackOnlyTrack(r,r.primitive,!0);if(this.classify(i))break}}else{this.track=t[0];for(let r=this.tracks.length-1;r>=0;r--){let i=this.tracks[r],n=this.block.blockTrackOnlyTrack(i,i.primitive.reverse(),!0);if(this.classify(n))break}}}classify(t){for(let e of t){let r=e.obstacle;if(!e.isSameNet&&r instanceof yt&&e.source instanceof yt&&this.calculateSameListObstacles(r,e.point,this.findNewEnd))return!0}return!1}calculateSameListObstacles(t,e,r){let n=this.getListNode(t).parent;if(!this.used.has(n))if(r){let a=n.toArray().map(u=>u.primitive),l=new pb(a,e),c=l.calculateDirect(e),h=l.calculateDirect(this.track.end);return c==h?!0:(this.used.add(n),!1)}else{let a=n.toArray().map(u=>u.primitive),l=new pb(a,e),c=l.calculateDirect(e),h=l.calculateDirect(this.track.start);return c==h?!0:(this.used.add(n),!1)}}getListNode(t){return xt.getInstance().getListNode(t)}};var Boe=class{constructor(){this.F=0;this.G=0;this.H=0;this.P=0;this.parent=null;this.modCount=0;this.weight=0}calcF(){this.F=this.G+this.H}sycn(t){t.F=this.F,t.G=this.G,t.H=this.H,t.P=this.P,t.parent=this.parent,t.modCount=this.modCount}},IX=class{constructor(t){this.node=t,this.modCount=t.modCount}notChanged(){return this.modCount===this.node.modCount}};function IOt(o,t){return o.node.F-t.node.F}var Foe=class{constructor(t,e,r,i){this.queue=new p3(IOt);this.openSet=new Bd;this.closeSet=new Ba;this.currentNode=null;this.success=!0;this.timeout=performance.now()+t,this.findNeighborNodes=i,this.endNode=this._findPath(e,r)}_findPath(t,e){var r=null;let i=Number.MAX_VALUE;for(this.openSet.put(t,t),this.queue.add(new IX(t));;){let n=this.findMinFNodeInOpneList();if(this.currentNode=n,n!==null&&performance.now()<this.timeout){this.openSet.remove(n),n.modCount++;let s=this.findNeighborNodes(n,this.closeHas.bind(this),this.addCloseSet.bind(this));if(n.sycn(this.currentNode),n.findCount>1&&this.currentNode!=n){let l=n;l.newParent!=null&&this.notFoundPoint(l.newParent,e,n),l.findCount--}if(n=this.currentNode,n.end.equals1(e.end))return n;let a=n.end.distance2(e.end);n!=null&&!n.equals(t)&&a<=i&&(i=a,r=n);for(let l of s){let c=this.openSet.get(l);if(c!==null){if(l=c,l.direction!=l.newDirection){l.findCount++;continue}this.foundPoint(n,c,e)}else l=this.notFoundPoint(n,e,l)}}else return this.success=!1,r}}closeHas(t){return this.closeSet.contains(t)}addCloseSet(t){return this.currentNode=t,this.closeSet.add(t)}calcG(t,e){return t.source?t.G+e.P:t.G+t.cost+e.P}calcH(t,e){return e.source?0:Math.min(e.start.distance1(t.end),e.end.distance1(t.end))}findMinFNodeInOpneList(){for(;;){let t=this.queue.poll();if(t===null)return null;if(t.notChanged())return t.node}}notFoundPoint(t,e,r){return r.parent=t,r.direction=r.newDirection,r.G=this.calcG(t,r),r.H=this.calcH(e,r),r.P=0,r.calcF(),r.modCount++,this.openSet.put(r,r),this.queue.add(new IX(r)),r}foundPoint(t,e,r){let i=this.calcG(t,e);ne.less(i,e.G)&&(e.parent=t,e.direction=e.newDirection,e.G=i,e.P=0,e.calcF(),e.modCount++,this.queue.add(new IX(e)))}};var Op=class o extends Boe{constructor(e,r){super();this.parent=null;this.node=null;this.source=!0;this.direction=0;this.newDirection=0;this.newParent=null;this.findCount=1;this.status=new U6;this.aroundType=0;this.startSource=null;this.startSourceNode=null;this.obstacle=null;this.obstacles=new Set;this.pushPath=new Set;this.pathError=!1;this.item=e,this.pt=r,this.cost=r.length()}get next(){var e,r;return(r=(e=this.node)==null?void 0:e.next)==null?void 0:r.item}get prev(){var e,r;return(r=(e=this.node)==null?void 0:e.prev)==null?void 0:r.item}replace(e){this.pt=e,this.cost=e.length()}getPathPrimitive(){return this.direction==0?this.pt:this.pt.reverse()}get start(){return this.getPathPrimitive().start()}get end(){return this.getPathPrimitive().end()}getNeihbor(){return this.direction==0?this.next:this.prev}hashCode(){return this.pt.hashCode()}sycnDirect(e){this.source=e.source,this.direction=e.direction,this.aroundType=e.aroundType,this.obstacle=e.obstacle,this.cloneStatus(e),this.weight=e.weight,this.source?(this.startSource=this.item,this.startSourceNode=this):(this.addAllObstacle(e.obstacles),Re.addAllSet(this.pushPath,e.pushPath),this.startSource=e.startSource,this.startSourceNode=e.startSourceNode)}checkSelfObstacle(){if(!this.source&&this.parent!=null){for(let e of this.parent.pushPath)this.obstacles.has(e)||this.pushPath.add(e);this.parent.source?(this.startSource=this.parent.item,this.startSourceNode=this.parent):(this.startSource=this.parent.startSource,this.startSourceNode=this.parent.startSourceNode),this.status.sycnPushDirect(this.parent.status),this.status.setPushDirect(this.parent.status.pushDirect,this.getChangeDirect())}this.source&&(this.startSource=this.item,this.startSourceNode=this)}getChangeDirect(){return this.direction}addPushPath(e){this.pushPath.add(e)}equals(e){if(e instanceof o){let r=e.pt;return e.aroundType==this.aroundType&&e.source==this.source&&r instanceof M&&this.pt instanceof M?this.pt.equals(r):e.aroundType==this.aroundType&&e.source==this.source&&r instanceof q&&this.pt instanceof q?this.pt.equals(r):!1}else return!1}addObstacles(e){this.obstacles.add(e)}addAllObstacle(e){for(let r of e)this.obstacles.add(r)}inPushPath(e){return this.pushPath.has(e)}cloneStatus(e){this.status=e.status.clone()}};var Voe=class o extends Bh{constructor(t){super(),this.line2=t}add(t){this.line2.push(t)}playResult(){var t,e;(t=this.line2[0])==null||t.display(),(e=this.line2[this.line2.length-1])==null||e.display(),ie.publish("updateFrame","")}display(){for(let t of this.line2)t.display();ie.publish("updateFrame","")}remove(){for(let t of this.line2)t.remove()}equals(t){if(t instanceof o){let e=t.line2.length;if(this.line2.length==e){for(let r=0;r<e;r++)if(!this.line2[r].equals(t.line2[r]))return!1;return!0}}return!1}};var bC=class{constructor(t){this.debug=null;this.kit=new th(.006);this.endtime=t}merge(t){if(t.length==0)return t;this.addDebug(t,ee.BLUE);let e=new Array,r=t[0].getPathPrimitive().start(),i=t[0].getPathPrimitive().end(),n=t[0],s=n.item,a=Ot(n.getPathPrimitive()),l=1,c=new Array;for(let h=1;h<t.length;h++){let u=t[h];c.push(u),u.source?s=u.item:u.item=s;let d=u.getPathPrimitive();if(d.length()<1e-8)continue;if(a.dot(Ot(d))>.99&&u.item.width==n.item.width&&d instanceof M&&n.pt instanceof M&&!u.item.locked&&!Ps(u.item)&&u.item.getParent()==null)i=d.end(),l++;else{if(n.pt instanceof M&&(n.direction==0?n.pt=new M(r,i):n.pt=new M(i,r)),l==1)e.push(n);else{let m=new Op(n.item,n.pt);m.direction=n.direction,m.newDirection=n.newDirection,m.cloneStatus(n),c.pop();for(let g of c)m.status.mergeStatus(g.status);e.push(m)}r=d.start(),i=d.end(),a=Ot(d),n=u,l=1,c.length=0,c.push(n)}}if(n.pt instanceof M&&(n.direction==0?n.pt=new M(r,i):n.pt=new M(i,r)),l==1)e.push(n);else{let h=new Op(n.item,n.pt);h.direction=n.direction,h.newDirection=n.newDirection,h.cloneStatus(n);for(let u of c)h.status.mergeStatus(u.status);e.push(h)}return this.addDebug(e,ee.GREEN),e}addDebug(t,e){if(Yr.debug){this.debug==null&&(this.debug=new Voe([]),Yr.inputDebugGraphics(this.debug),Yr.inputClear());let r=[];for(let n of t){let s=n.getPathPrimitive(),a=new eo(s,{color:e});r.push(a)}let i=new Kd(r);this.debug.add(i)}}};var Goe=class extends bC{constructor(e,r,i){super(e);this.tool=new no;this.change=!1;this.nodes=r,this.blockShape=i}optimize1(){if(this.nodes.length==0)return this.nodes;let e=this.nodes;for(;this.endtime>performance.now()&&(this.change=!1,e=this.optimizeShort(e),e=this.merge(e),!!this.change););return e}replaceNodes(e,r,i,n,s=!1){return(n.length()>1e-8||s)&&(i.direction==0?i.pt=new M(n.start(),n.end()):i.pt=new M(n.end(),n.start()),e.insertBefore(r,i)),i}cloneOrderNode(e){let r=new Op(e.item,e.pt);return r.direction=e.direction,r.newDirection=e.newDirection,r.status=e.status.clone(),r}isCollide(e,r){if(r.length()<1e-8)return!1;let i=e instanceof Op?e.item:e.item.item;return this.blockShape.checkDRC4Primitive(i,r)}optimizeShort(e){if(e.length==0)return e;this.addDebug(e,ee.BLUE);let r=new On;for(let a of e)r.add(a);let n=r.listIterator().next();e:for(;n!=null;){if(!this.notChange(n)){let a=n.item.getPathPrimitive(),l=Ot(a),c=a.start(),h=a.end(),u=new Array,d=n.next,p=a.length();for(;d!=null&&!this.notChange(d);){let m=d.item.getPathPrimitive();h=m.end(),p+=m.length();let g=this.getDistance(c,h),y=this.tool.degree45(l,c,h),b=new M(y[0],y[1]),P=new M(y[1],y[2]);if(this.kit.less(g,p)&&!this.isCollide(n,b)&&!this.isCollide(d,P)){let T=n.item.status.isReversePush!=d.item.status.isReversePush;if(u.push(d),p=g,d=d.next,T)break}else break}if(u.length==1&&this.isLongVertical(n,u[0])){let m=u[u.length-1],g=m.item.getPathPrimitive();h=g.end();let y=Ot(g),b=g.start().sub(l.mul((n.item.item.width+m.item.item.width)*2)),P=this.tool.degree45(l,b,h),T=new M(P[0],P[1]),I=new M(P[1],P[2]);m.item.status.isSource&&Yg(T.direct,y,1e-4)&&(P=this.tool.degree45(I.direct,c,h),T=new M(P[0],P[1]),I=new M(P[1],P[2]));let C=null;n.item.status.isReversePush&&(C=n.item.status.pushDirect);for(let v of u)v.item.status.isReversePush&&(C=v.item.status.pushDirect);let E=this.cloneOrderNode(n.item);if(T.direct.dot(l)<.99){if(C!=null)E.status.setPushDirect(null,C);else if(E.status.isSource){let v=tX(l,T.direct);E.status.setPushDirect(null,v)}E.status.isSource=!1}let O=this.cloneOrderNode(m.item);if(I.direct.dot(y)<.99){if(C!=null)O.status.setPushDirect(null,C);else if(O.status.isSource){let v=tX(y,I.direct);O.status.setPushDirect(null,v)}O.status.isSource=!1}let _=this.cloneOrderNode(n.item),R=new M(c,b);this.replaceNodes(r,n,_,R,n.prev==null),this.replaceNodes(r,n,E,T),this.replaceNodes(r,n,O,I),this.change=!0,r.remove(n);for(let v of u)r.remove(v);n=d==null?void 0:d.prev;continue e}else if(u.length>0){let m=u[u.length-1],g=m.item.getPathPrimitive();h=g.end();let y=Ot(g),b=this.tool.degree45(l,c,h),P=new M(b[0],b[1]),T=new M(b[1],b[2]);m.item.status.isSource&&Yg(P.direct,y,1e-4)&&(b=this.tool.degree45(T.direct,c,h),P=new M(b[0],b[1]),T=new M(b[1],b[2]));let I=null;n.item.status.isReversePush&&(I=n.item.status.pushDirect);for(let O of u)O.item.status.isReversePush&&(I=O.item.status.pushDirect);let C=this.cloneOrderNode(n.item);if(P.direct.dot(l)<.99){if(I!=null)C.status.setPushDirect(null,I);else if(C.status.isSource){let O=tX(l,P.direct);C.status.setPushDirect(null,O)}C.status.isSource=!1}let E=this.cloneOrderNode(m.item);if(T.direct.dot(y)<.99){if(I!=null)E.status.setPushDirect(null,I);else if(E.status.isSource){let O=tX(y,T.direct);E.status.setPushDirect(null,O)}E.status.isSource=!1}this.replaceNodes(r,n,C,P,n.prev==null),this.replaceNodes(r,n,E,T),this.change=!0,r.remove(n);for(let O of u)r.remove(O);n=d==null?void 0:d.prev;continue e}}n=n.next}let s=r.toArray();return this.addDebug(s,ee.GREEN),s}isLongVertical(e,r){let i=e.item.getPathPrimitive(),n=r.item.getPathPrimitive();if(Fd(i)>5*e.item.item.width&&Fd(n)>5*e.item.item.width){let s=Ot(i),a=Ot(n);return f3(s,a)}return!1}getDistance(e,r){let i=r.sub(e),n=Math.abs(i.x),s=Math.abs(i.y);return n<s?n*Math.sqrt(2)+s-n:s*Math.sqrt(2)+n-s}notChange(e){return e.item.status.notChange}};var Uoe=class extends bC{constructor(e,r,i){super(e);this.tool=new no;this.change=!1;this.direct=new S(1,0);this.nodes=r,this.blockShape=i}optimize1(){if(this.nodes.length==0)return this.nodes;let e=this.nodes;for(;this.endtime>performance.now()&&(this.change=!1,e=this.merge(e),e=this.optimizeCorner(e),!!this.change););return e}replaceNodes(e,r,i,n){return n.length()>1e-8&&(i.direction==0?i.pt=new M(n.start(),n.end()):i.pt=new M(n.end(),n.start()),e.insertBefore(r,i)),i}cloneOrderNode(e){let r=new Op(e.item,e.pt);return r.direction=e.direction,r.newDirection=e.newDirection,r.status=e.status.clone(),r}isCollide(e,r){if(r.length()<1e-8)return!1;let i=e instanceof Op?e.item:e.item.item;return this.blockShape.checkDRC4Primitive(i,r)}optimizeShort(e){this.addDebug(e,ee.BLUE);let r=new On;for(let a of e)r.add(a);let n=r.listIterator().next();e:for(;n!=null;){if(!this.notChange(n)){let a=n.item.getPathPrimitive(),l=Ot(a),c=a.start(),h=a.end(),u=new Array,d=n.next,p=a.length();for(;d!=null&&!this.notChange(d);){let m=d.item.getPathPrimitive();h=m.end(),p+=m.length();let g=this.getDistance(c,h),y=this.tool.degree45(l,c,h),b=new M(y[0],y[1]),P=new M(y[1],y[2]);if(this.kit.less(g,p)&&!this.isCollide(n,b)&&!this.isCollide(d,P))u.push(d),p=g,d=d.next;else break}if(u.length>0){let m=u[u.length-1],g=m.item.getPathPrimitive();h=g.end();let y=Ot(g),b=this.tool.degree45(l,c,h),P=new M(b[0],b[1]),T=new M(b[1],b[2]),I=this.cloneOrderNode(n.item);P.direct.dot(l)<.99&&(I.status.isSource=!1);let C=this.cloneOrderNode(m.item);T.direct.dot(y)<.99&&(C.status.isSource=!1),this.replaceNodes(r,n,I,P),this.replaceNodes(r,n,C,T),this.change=!0,r.remove(n);for(let E of u)r.remove(E);n=d==null?void 0:d.prev;continue e}}n=n.next}let s=r.toArray();return this.addDebug(s,ee.GREEN),s}optimizeCorner(e){if(e.length==0)return e;this.addDebug(e,ee.BLUE);let r=new On;for(let a of e)r.add(a);let n=r.listIterator().next();e:for(;n!=null;){if(!this.notChange(n)||!this.isAcuteAngle(n,n.next)){let a=this.isCorner(n);if(a>0){let l=n.prev.item.getPathPrimitive(),c=n.next.item.getPathPrimitive(),h=Ot(l),u=l.start(),d=c.end(),p=this.tool.degree45(h,u,d),m=new M(p[0],p[1]),g=new M(p[1],p[2]);if(a==1&&(p=this.tool.degree45(g.direct,u,d),m=new M(p[0],p[1]),g=new M(p[1],p[2])),!this.isCollide(n.prev,m)&&!this.isCollide(n.next,g)){let y=Ot(l),b=Ot(c),P=this.cloneOrderNode(n.prev.item),T=this.cloneOrderNode(n.next.item);P.status.change(),T.status.change(),(this.isSource(n.prev)&&m.direct.dot(y)>.99||g.length()<1e-9&&this.isSource(n.next)&&m.direct.dot(b)>.99)&&(P.status.isSource=!0),this.isSource(n.next)&&g.direct.dot(b)>.99&&(T.status.isSource=!0),this.addDebug([n.prev.item,n.item,n.next.item],ee.BLUE),this.replaceNodes(r,n.prev,P,m),this.replaceNodes(r,n.prev,T,g),this.addDebug([P,T],ee.GREEN),this.change=!0;let I=n.next.next;r.remove(n.prev),r.remove(n),r.remove(n.next),n=I==null?void 0:I.prev;continue e}else a=0}if(a==0){let l=n.item.getPathPrimitive(),c=Ot(l),h=l.start(),u=l.end(),d=new Array,p=n.next,m=l.length();for(;p!=null&&(!this.notChange(p)||!this.isSource(n)&&!this.isAcuteAngle(n,p));){let g=p.item.getPathPrimitive();u=g.end(),m+=g.length();let y=this.getDistance(h,u),b=this.tool.degree45(c,h,u),P=new M(b[0],b[1]),T=new M(b[1],b[2]);if(this.kit.less(y,m)&&!this.isCollide(n,P)&&!this.isCollide(p,T)){let I=n.item.status.isReversePush!=p.item.status.isReversePush||p.item.status.isSource;if(d.push(p),m=y,p=p.next,I)break}else break}if(d.length==0&&p!=null&&p.item.getPathPrimitive().length()<p.item.item.width)for(p=p.next;p!=null&&(!this.notChange(p)||!this.isSource(n)&&!this.isAcuteAngle(n,p));){let g=p.item.getPathPrimitive();u=g.end(),m+=g.length();let y=this.getDistance(h,u),b=this.tool.degree45(c,h,u),P=new M(b[0],b[1]),T=new M(b[1],b[2]);if(this.kit.less(y,m)&&!this.isCollide(n,P)&&!this.isCollide(p,T)){let I=n.item.status.isReversePush!=p.item.status.isReversePush||p.item.status.isSource;if(d.length==0&&d.push(n.next),d.push(p),m=y,p=p.next,I)break}else break}if(d.length>0){let g=d[d.length-1],y=g.item.getPathPrimitive();u=y.end();let b=Ot(y),P=c.cross(b);if(ne.eq(P,0)&&Yg(u.sub(h.normalize()),b)){let T=new M(h,u),I;T.direct.dot(b)>.99?I=this.cloneOrderNode(g.item):I=this.cloneOrderNode(n.item),this.replaceNodes(r,n,I,T)}else{let T=this.tool.degree45(c,h,u),I=new M(T[0],T[1]),C=new M(T[1],T[2]),E=C.length()<1e-9&&I.direct.dot(b)>.99,O=E?this.cloneOrderNode(g.item):this.cloneOrderNode(n.item);I.direct.dot(c)<.99&&!E&&(O.status.isSource=!1);let _=this.cloneOrderNode(g.item);C.direct.dot(b)<.99&&(_.status.isSource=!1),this.addDebug([n.item,...d.map(R=>R.item)],ee.BLUE),this.replaceNodes(r,n,O,I),this.replaceNodes(r,n,_,C),this.addDebug([O,_],ee.GREEN)}this.change=!0,r.remove(n);for(let T of d)r.remove(T);n=p==null?void 0:p.prev;continue e}else if(n.next!=null&&n.next.next==null&&!this.isAcuteAngle(n,p)&&(!this.isInputNotChange(n)||!this.isInputNotChange(p))){let g=this.getLines(n,n.next);if(g!=null){let y=g[0],b=g[1],P=g[2],T=n.next.item.getPathPrimitive(),I=Ot(T),C=this.cloneOrderNode(n.item);y.direct.dot(c)<.99&&(C.status.isSource=!1);let E=this.cloneOrderNode(n.next.item);b.direct.dot(I)<.99&&(E.status.isSource=!1);let O=this.cloneOrderNode(n.next.item);P.direct.dot(I)<.99&&(O.status.isSource=!1),this.addDebug([n.item,...d.map(_=>_.item)],ee.BLUE),this.replaceNodes(r,n,C,y),this.replaceNodes(r,n,E,b),this.replaceNodes(r,n,O,P),this.addDebug([C,E,O],ee.GREEN),d.push(n,n.next),this.change=!0;for(let _ of d)r.remove(_);n=p==null?void 0:p.prev;continue e}}}}else if(this.isShort(n.next)&&n.next.next!=null&&(!this.isInputNotChange(n.next)||!this.isInputNotChange(n.next.next))){let a=n.item.getPathPrimitive(),l=Ot(a),c=new Array,h=n.next.next,u=this.getLines(n,h);if(u!=null){let d=u[0],p=u[1],m=u[2],g=n.next.item.getPathPrimitive(),y=Ot(g),b=this.cloneOrderNode(n.item);d.direct.dot(l)<.99&&(b.status.isSource=!1);let P=this.cloneOrderNode(n.next.item);p.direct.dot(y)<.99&&(P.status.isSource=!1);let T=this.cloneOrderNode(n.next.item);m.direct.dot(y)<.99&&(T.status.isSource=!1),this.addDebug([n.item,...c.map(I=>I.item)],ee.BLUE),this.replaceNodes(r,n,b,d),this.replaceNodes(r,n,P,p),this.replaceNodes(r,n,T,m),this.addDebug([b,P,T],ee.GREEN),c.push(n,n.next,h),this.change=!0;for(let I of c)r.remove(I);n=h==null?void 0:h.prev;continue e}}n=n.next}let s=r.toArray();return this.addDebug(s,ee.GREEN),s}isInputNotChange(e){return e.item.status.isInput&&e.item.status.notChange}getLines(e,r){let i=e.item.getPathPrimitive(),n=r.item.getPathPrimitive(),s=i.length(),a=n.length(),l=s+a,c=Ot(i),h=s>a,u=h?i.midPoint:i.start(),d=h?n.end():n.midPoint,p=h?this.getDistance(u,d)+s/2:this.getDistance(u,d)+a/2,m=this.tool.degree45(c,u,d);h?m.unshift(i.start()):m.push(n.end());let g=new M(m[0],m[1]),y=new M(m[1],m[2]),b=new M(m[2],m[3]);if(this.kit.less(p,l)&&!this.isCollide(e,g)&&!this.isCollide(r,y)&&!this.isCollide(r,b))return[g,y,b];{let P=h?i.start():i.midPoint,T=h?n.midPoint:n.end(),I=h?this.getDistance(P,T)+a/2:this.getDistance(P,T)+s/2,C=this.tool.degree45(c,P,T);h?C.push(n.end()):C.unshift(i.start());let E=new M(C[0],C[1]),O=new M(C[1],C[2]),_=new M(C[2],C[3]);if(this.kit.less(I,l)&&!this.isCollide(e,E)&&!this.isCollide(r,O)&&!this.isCollide(r,_))return[E,O,_]}return null}isCorner(e){let r=e.item.getPathPrimitive(),i=Ot(r),n=e.prev!=null&&e.next!=null;if(this.isInput(e.item,i)&&n&&this.isAcuteAngle(e.prev,e.next))return 0;if(n&&(!this.notChange(e.prev)||this.needOptimize(e.prev,e))&&(!this.notChange(e.next)||this.needOptimize(e.next,e))){if(this.isSource(e.prev)&&!this.isSource(e.next)){let s=e.next.next;if(this.isParallel(e.next,s)&&this.isSource(s))return 0;let a=e.prev,l=a.item.getPathPrimitive(),c=Ot(l);if(this.isInput(a.item,c))return 0;let h=c.cross(this.direct);if(Math.abs(h)<.1){let d=e.next.item.getPathPrimitive(),p=Ot(d);return f3(c,p,.01)?2:0}else{let u=h>0?le.CCW:le.CW;if(e.next.item.status.pushDirect!=null&&e.next.item.status.pushDirect!=u)return 0;{let d=Ot(e.item.getPathPrimitive()),m=e.next.item.getPathPrimitive(),g=Ot(m),y=f3(d,this.direct),b=f3(g,this.direct);if(y&&!b)return 0;if(!y&&b)return 1}}return 1}else if(!this.isSource(e.prev)&&this.isSource(e.next)){let s=e.prev.prev;if(this.isParallel(s,e.prev)&&this.isSource(s))return 0;let a=e.next,l=a.item.getPathPrimitive(),c=Ot(l);if(this.isInputEnd(e.next)){let d=e.prev.item.getPathPrimitive(),p=d.start(),m=Ot(d),g=this.tool.degree45(m,p,l.end()),y=g[2].sub(g[1]);if(!Yg(y,c))return 0}if(this.isInput(a.item,c))return 0;let h=c.cross(this.direct);if(Math.abs(h)<.1){let d=e.prev.item.getPathPrimitive(),p=Ot(d);return f3(p,c,.01)?2:0}else{let u=h>0?le.CCW:le.CW;if(e.prev.item.status.pushDirect!=null&&e.prev.item.status.pushDirect!=u)return 0;{let p=e.prev.item.getPathPrimitive(),m=Ot(p),g=f3(c,this.direct),y=f3(m,this.direct);if(g&&!y)return 0;if(!g&&y)return 2}}return 2}else if(!this.isSource(e.prev)&&!this.isSource(e.next)){let s=e.prev,a=s.item.getPathPrimitive(),l=e.next.item.getPathPrimitive(),c=Ot(a);if(this.isInput(s.item,c))return 0;let h=s.item.status.pushDirect;if(h!=null){let u=h==le.CCW?new S(-c.y,c.x):new S(c.y,-c.x),d=l.end().sub(a.start());return u.dot(d)>0?1:2}else if(e.next.item.status.pushDirect!=null){let u=Ot(l);if(this.isInput(e.next.item,u))return 0;let p=e.next.item.status.pushDirect==le.CCW?new S(-u.y,u.x):new S(u.y,-u.x),m=l.end().sub(a.start());return p.dot(m)>0?1:2}}}return 0}isParallel(e,r){if(e==null||r==null)return!1;let i=Ot(e.item.getPathPrimitive()),n=r.item.getPathPrimitive(),s=Ot(n,n.start());return Yg(i,s)}isInput(e,r){return!!(e.status.isInput&&f3(r,this.direct))}isInputEnd(e){return e.item.status.isInput&&e.next==null}getDistance(e,r){let i=r.sub(e),n=Math.abs(i.x),s=Math.abs(i.y);return n<s?n*Math.sqrt(2)+s-n:s*Math.sqrt(2)+n-s}needOptimize(e,r){if(e!=null&&this.notChange(e)&&!e.item.item.locked&&!Ps(e.item.item)&&e.item.item.getParent()==null&&!this.notChange(r)){let i=e.item.getPathPrimitive(),n=Ot(i),s=Ot(r.item.getPathPrimitive());return n.dot(s)<.01}return!1}isAcuteAngle(e,r){if(e==null||r==null)return!0;let i=e.item.getPathPrimitive(),n=Ot(i),s=Ot(r.item.getPathPrimitive());return n.dot(s)>.01}isShort(e){return e==null?!1:e.item.getPathPrimitive().length()<e.item.item.width}notChange(e){return e.item.status.notChange}isSource(e){return e.item.status.isSource}};var Hoe=class extends bC{constructor(e,r,i,n){super(e);this.tool=new no;this.change=!1;this.nodes=r,this.blockShape=i,this.isWire=n}optimize1(){if(this.nodes.length==0)return this.nodes;let e=this.nodes;for(;this.endtime>performance.now()&&(this.change=!1,e=this.optimizeShort(e),e=this.merge(e),!!this.change););return e}replaceNodes(e,r,i,n){return n.length()>1e-8&&(i.direction==0?i.pt=new M(n.start(),n.end()):i.pt=new M(n.end(),n.start()),e.insertBefore(r,i)),i}cloneOrderNode(e){let r=new Op(e.item,e.pt);return r.direction=e.direction,r.newDirection=e.newDirection,r.status=e.status.clone(),r}isCollide(e,r){if(r.length()<1e-8)return!1;let i=e instanceof Op?e.item:e.item.item;return this.blockShape.checkDRC4Primitive(i,r)}optimizeShort(e){if(e.length==0)return e;if(!this.isWire&&e[0].status.isInput)return this.optimizeInputShort(e);this.addDebug(e,ee.BLUE);let r=new On;for(let a of e)r.add(a);let n=r.listIterator().next();e:for(;n!=null;){let a=n.item.getPathPrimitive(),l=Ot(a),c=a.start(),h=a.end(),u=new Array,d=r.getLastNode(),p=a.length();for(;d!=null&&d!=n&&d.item.item.width==n.item.item.width;){let m=d.item.getPathPrimitive();h=m.end();let g=this.getDistance(c,h),y=this.tool.degree45(l,c,h),b=new M(y[0],y[1]),P=new M(y[1],y[2]);if(this.notChange(d)&&!d.item.item.locked&&!Ps(d.item.item)&&d.item.item.getParent()==null){let T=Ot(m);y=this.tool.degree45(T.mul(-1),h,c),b=new M(y[2],y[1]),P=new M(y[1],y[0])}if((n.next!=d||this.kit.less(g,p+m.length()))&&!this.isCollide(n,b)&&!this.isCollide(d,P)){let T=n,I=new Array;for(;T!=d;){if(T.item.item.locked||Ps(T.item.item)||T.item.item.getParent()!=null){I.length=0;break}I.push(T),T=T.next}for(let C of I)u.push(C);u.push(d);break}else d=d.prev}if(u.length>0){let m=u[u.length-1],g=m.item.getPathPrimitive();h=g.end();let y=Ot(g),b=this.tool.degree45(l,c,h),P=new M(b[0],b[1]),T=new M(b[1],b[2]);if(this.notChange(m)){let O=Ot(g);b=this.tool.degree45(O.mul(-1),h,c),P=new M(b[2],b[1]),T=new M(b[1],b[0])}let I=this.cloneOrderNode(n.item);I.status.notChange=!1,P.direct.dot(l)<.99&&(I.status.isSource=!1);let C=this.cloneOrderNode(m.item);C.status.notChange=!1,T.direct.dot(y)<.99&&(C.status.isSource=!1);let E=n==null?void 0:n.prev;this.replaceNodes(r,n,I,P),this.replaceNodes(r,n,C,T),this.change=!0;for(let O of u)r.remove(O);n=E;continue e}else{if(n.next!=null&&n.next.next==null&&!this.isAcuteAngle(n,n.next)){let m=n.next,g=n.next.item.getPathPrimitive(),y=g.midPoint;p+=g.length()/2;let b=Ot(g),P=this.getDistance(c,y),T=this.tool.degree45(l,c,y),I=new M(T[0],T[1]),C=new M(T[1],T[2]),E=new M(T[2],g.end());if(this.kit.less(P,p)&&!this.isCollide(n,I)&&!this.isCollide(m,C)&&!this.isCollide(m,E)){let O=this.cloneOrderNode(n.item);I.direct.dot(l)<.99&&(O.status.isSource=!1);let _=this.cloneOrderNode(n.next.item);C.direct.dot(b)<.99&&(_.status.isSource=!1);let R=this.cloneOrderNode(n.next.item);E.direct.dot(b)<.99&&(R.status.isSource=!1),this.addDebug([n.item,...u.map(v=>v.item)],ee.BLUE),this.replaceNodes(r,n,O,I),this.replaceNodes(r,n,_,C),this.replaceNodes(r,n,R,E),this.addDebug([O,_,R],ee.GREEN),u.push(n,n.next),this.change=!0;for(let v of u)r.remove(v);n=m==null?void 0:m.prev;continue e}}if(n.next!=null&&this.isShort(n.next)&&n.next.next!=null&&(!this.isInputNotChange(n.next)||!this.isInputNotChange(n.next.next))){let m=n.next.next,g=m.item.getPathPrimitive(),y=g.midPoint;p+=g.length()/2;let b=Ot(g),P=this.getDistance(c,y),T=this.tool.degree45(l,c,y),I=new M(T[0],T[1]),C=new M(T[1],T[2]),E=new M(T[2],g.end());if(this.kit.less(P,p)&&!this.isCollide(n,I)&&!this.isCollide(m,C)&&!this.isCollide(m,E)){let O=this.cloneOrderNode(n.item);I.direct.dot(l)<.99&&(O.status.isSource=!1);let _=this.cloneOrderNode(m.item);C.direct.dot(b)<.99&&(_.status.isSource=!1);let R=this.cloneOrderNode(m.item);E.direct.dot(b)<.99&&(R.status.isSource=!1),this.addDebug([n.item,...u.map(v=>v.item)],ee.BLUE),this.replaceNodes(r,n,O,I),this.replaceNodes(r,n,_,C),this.replaceNodes(r,n,R,E),this.addDebug([O,_,R],ee.GREEN),u.push(n,n.next,m),this.change=!0;for(let v of u)r.remove(v);n=m==null?void 0:m.prev;continue e}}}n=n==null?void 0:n.next}let s=r.toArray();return this.addDebug(s,ee.GREEN),s}isShort(e){return e==null?!1:e.item.getPathPrimitive().length()<e.item.item.width}isAcuteAngle(e,r){if(e==null||r==null)return!0;let i=e.item.getPathPrimitive(),n=Ot(i),s=Ot(r.item.getPathPrimitive());return n.dot(s)>.01}optimizeInputShort(e){if(e.length==0)return e;this.addDebug(e,ee.BLUE);let r=new On;for(let a of e)r.add(a);let n=r.listIterator().next();e:for(;n!=null;){let a=n.item.getPathPrimitive(),l=Ot(a),c=a.start(),h=a.end(),u=new Array,d=r.getLastNode(),p=a.length();for(;!this.notChange(n)&&d!=null&&d!=n&&d.item.item.width==n.item.item.width;){let m=d.item.getPathPrimitive();h=m.end();let g=this.getDistance(c,h),y=this.tool.degree45(l,c,h),b=new M(y[0],y[1]),P=new M(y[1],y[2]);if(!this.isSource(n)&&this.notChange(d)&&!d.item.item.locked&&!Ps(d.item.item)&&d.item.item.getParent()==null){let T=Ot(m);y=this.tool.degree45(T.mul(-1),h,c),b=new M(y[2],y[1]),P=new M(y[1],y[0])}if((n.next!=d||this.kit.less(g,p+m.length()))&&!this.isCollide(n,b)&&!this.isCollide(d,P)){let T=n,I=new Array;for(;T!=d;){if(T.item.item.locked||Ps(T.item.item)||T.item.item.getParent()!=null){I.length=0;break}I.push(T),T=T.next}for(let C of I)u.push(C);u.push(d);break}else d=d.prev}if(u.length>0){let m=u[u.length-1],g=m.item.getPathPrimitive();h=g.end();let y=Ot(g),b=this.tool.degree45(l,c,h),P=new M(b[0],b[1]),T=new M(b[1],b[2]);if(this.notChange(m)){let O=Ot(g);b=this.tool.degree45(O.mul(-1),h,c),P=new M(b[2],b[1]),T=new M(b[1],b[0])}let I=this.cloneOrderNode(n.item);I.status.notChange=!1,P.direct.dot(l)<.99&&(I.status.isSource=!1);let C=this.cloneOrderNode(m.item);C.status.notChange=!1,T.direct.dot(y)<.99&&(C.status.isSource=!1);let E=n==null?void 0:n.prev;this.replaceNodes(r,n,I,P),this.replaceNodes(r,n,C,T),this.change=!0;for(let O of u)r.remove(O);n=E;continue e}else{if(n.next!=null&&n.next.next==null&&!this.isAcuteAngle(n,n.next)&&(!this.isInputNotChange(n)||!this.isInputNotChange(d))){let m=n.next,g=n.next.item.getPathPrimitive(),y=g.midPoint;p+=g.length()/2;let b=Ot(g),P=this.getDistance(c,y),T=this.tool.degree45(l,c,y),I=new M(T[0],T[1]),C=new M(T[1],T[2]),E=new M(T[2],g.end());if(this.kit.less(P,p)&&!this.isCollide(n,I)&&!this.isCollide(m,C)&&!this.isCollide(m,E)){let O=this.cloneOrderNode(n.item);I.direct.dot(l)<.99&&(O.status.isSource=!1);let _=this.cloneOrderNode(n.next.item);C.direct.dot(b)<.99&&(_.status.isSource=!1);let R=this.cloneOrderNode(n.next.item);E.direct.dot(b)<.99&&(R.status.isSource=!1),this.addDebug([n.item,...u.map(v=>v.item)],ee.BLUE),this.replaceNodes(r,n,O,I),this.replaceNodes(r,n,_,C),this.replaceNodes(r,n,R,E),this.addDebug([O,_,R],ee.GREEN),u.push(n,n.next),this.change=!0;for(let v of u)r.remove(v);n=m==null?void 0:m.prev;continue e}}if(n.next!=null&&this.isShort(n.next)&&n.next.next!=null&&(!this.isInputNotChange(n.next)||!this.isInputNotChange(n.next.next))){let m=n.next.next,g=m.item.getPathPrimitive(),y=g.midPoint;p+=g.length()/2;let b=Ot(g),P=this.getDistance(c,y),T=this.tool.degree45(l,c,y),I=new M(T[0],T[1]),C=new M(T[1],T[2]),E=new M(T[2],g.end());if(this.kit.less(P,p)&&!this.isCollide(n,I)&&!this.isCollide(m,C)&&!this.isCollide(m,E)){let O=this.cloneOrderNode(n.item);I.direct.dot(l)<.99&&(O.status.isSource=!1);let _=this.cloneOrderNode(m.item);C.direct.dot(b)<.99&&(_.status.isSource=!1);let R=this.cloneOrderNode(m.item);E.direct.dot(b)<.99&&(R.status.isSource=!1),this.addDebug([n.item,...u.map(v=>v.item)],ee.BLUE),this.replaceNodes(r,n,O,I),this.replaceNodes(r,n,_,C),this.replaceNodes(r,n,R,E),this.addDebug([O,_,R],ee.GREEN),u.push(n,n.next,m),this.change=!0;for(let v of u)r.remove(v);n=m==null?void 0:m.prev;continue e}}}n=n==null?void 0:n.next}let s=r.toArray();return this.addDebug(s,ee.GREEN),s}isInputNotChange(e){return e.item.status.isInput&&e.item.status.notChange}getDistance(e,r){let i=r.sub(e),n=Math.abs(i.x),s=Math.abs(i.y);return n<s?n*Math.sqrt(2)+s-n:s*Math.sqrt(2)+n-s}notChange(e){return e.item.status.notChange}isSource(e){return e.item.status.isSource}};var COt=Math.sqrt(2)-1,CX=class{constructor(t,e,r,i,n,s){this.tool=new no;this.change=!1;this.nodes=e,this.blockShape=r,this.direct=n,this.mergeOptimiza=new bC(t),this.onlyChange=new Goe(t,e,r),this.fullChange=new Uoe(t,e,r),this.fullChange.direct=this.direct,this.allChange=new Hoe(t,e,r,s),this.level=i,Ts!="45"&&(this.level="NONE")}optimization(){switch(this.level){case"NONE":return this.mergeOptimiza.merge(this.nodes);case"WEAK":return this.onlyChange.optimize1();case"STRONG":return this.fullChange.optimize1();default:{let t=Nt.filter;Nt.setPushFilter(),Nt.pushFilter.setAroundMode();let e=this.allChange.optimize1();return Nt.filter=t,e}}}optimize2(){if(this.nodes.length==0)return this.nodes;let t=this.nodes;for(;this.change=!1,t=this.optimizaAngle(t),t=this.merge(t),!!this.change;);return t}optimize3(){if(this.nodes.length==0)return this.nodes;let t=this.nodes;for(;this.change=!1,t=this.source2Source2(t),t=this.source2Source3(t),t=this.source2None1(t),t=this.none2Source1(t),t=this.source2Source1(t),t=this.none2None1(t),t=this.merge(t),!!this.change;);return t}optimize1(){if(this.nodes.length==0)return this.nodes;let t=this.nodes;for(;this.change=!1,t=this.source2None1(t),t=this.none2Source1(t),t=this.source2Source1(t),t=this.none2None1(t),t=this.merge(t),!!this.change;);return t}addDebug(t,e){if(Yr.debug){let r=[];for(let n of t){let s=n.getPathPrimitive(),a=new eo(s,{color:e});r.push(a)}let i=new Kd(r);Yr.inputDebugGraphics(i),Yr.inputClear()}}optimizaAngle(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=this.findNextNode(i),a=s[s.length-1];if(s.length==0?a=i.next:a.next!=null&&(a=a.next,s.push(a)),s.length==0)n.push(i.item),i=a;else{let l=this.getLines(n,i,s);l==null?(n.push(i.item),i=i.next):i=l.next}}return this.addDebug(n,ee.GREEN),n}optimizaAngle1(t){this.addDebug(t,ee.BLUE);let e=new On;for(let l of t)e.add(l);let i=e.listIterator().next(),n=new Array,s=i.item.getPathPrimitive(),a=Ot(s);for(;i!=null;){let l=i.next;if(l==null){n.push(i.item);break}let c=l.item.getPathPrimitive(),h=Ot(c);if(a.dot(h)>.01||i.item.status.notChange)n.push(i.item),i=l;else{let d=s.start(),p=c.end(),m=this.tool.degree45(a,d,p),g=new M(m[0],m[1]),y=new M(m[1],m[2]),b=!1;l.next==null&&ia(a,m)[1].dot(h)<.99&&(b=!0),!b&&!this.isCollide(i,g)&&!this.isCollide(i,y)?(this.modifyNode(n,this.cloneOrderNode(i.item),g),this.modifyNode(n,this.cloneOrderNode(l.item),y),this.change=!0,i=l.next):(n.push(i.item),i=l)}i!=null&&(s=i.item.getPathPrimitive(),a=Ot(s))}return this.addDebug(n,ee.GREEN),n}getLines(t,e,r){let i=e.item.getPathPrimitive(),n=i.start(),s=Ot(i);r.reverse();for(let a of r){let l=a.item.getPathPrimitive(),c=l.end(),h=this.tool.degree45(s,n,c),u=new M(h[0],h[1]),d=new M(h[1],h[2]),p=!1;if(a.next==null&&ia(s,h)[1].dot(Ot(l))<.99&&(p=!0),!p&&!this.isCollide(e,u)&&!this.isCollide(e,d))return this.modifyNode(t,this.cloneOrderNode(e.item),u),this.modifyNode(t,this.cloneOrderNode(a.item),d),this.change=!0,a}return null}getLines1(t,e,r){let i=e.item.getPathPrimitive(),n=i.start(),s=Ot(i);r.reverse();for(let a of r){let l=a[0];if(a[1]){let h=l.item.getPathPrimitive(),u=h.end(),d=this.tool.degree45(s,n,u),p=new M(d[0],d[1]),m=new M(d[1],d[2]),g=!1;if(l.next==null&&ia(s,d)[1].dot(Ot(h))<.99&&(g=!0),!g&&!this.isCollide(e,p)&&!this.isCollide(e,m))return this.modifyNode(t,this.cloneOrderNode(e.item),p),this.modifyNode(t,this.cloneOrderNode(l.item),m),this.change=!0,l.next}}return t.push(e.item),e.next}getLines2(t,e,r){let i=e.item.getPathPrimitive(),n=i.start(),s=Ot(i);r.reverse();for(let a of r){let l=a.item.getPathPrimitive(),c=l.end(),h=this.tool.degree45(s,n,c),u=new M(h[0],h[1]),d=new M(h[1],h[2]),p=!1;if(a.next==null&&ia(s,h)[1].dot(Ot(l))<.99&&(p=!0),!p&&!this.isCollide(e,u)&&!this.isCollide(e,d))return this.modifyNode(t,this.cloneOrderNode(e.item),u),this.modifyNode(t,this.cloneOrderNode(a.item),d),this.change=!0,a}return null}merge(t){this.addDebug(t,ee.BLUE);let e=new On;for(let d of t)e.add(d);let i=e.listIterator().next(),n=i.item.getPathPrimitive(),s=n.start(),a=n.end(),l=Ot(n),c=i.item.item,h=new Array,u=i;for(;u!=null&&u.next!=null;){u=u.next;let d=u.item;d.source?c=d.item:d.item=c;let p=d.getPathPrimitive();if(p.length()<1e-8){this.change=!0;continue}let m=l.dot(Ot(p)),g=i.item;m>.99&&d.item.width==g.item.width?a=p.end():(i.next==u?h.push(i.item):(this.change=!0,this.modifyNode(h,this.cloneOrderNode(i.item),new M(s,a))),s=p.start(),a=p.end(),l=Ot(p),i=u)}return i.next==null?h.push(u.item):(this.change=!0,this.modifyNode(h,this.cloneOrderNode(u.item),new M(s,a))),this.addDebug(h,ee.GREEN),h}removeAcute(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=i.next;if(s==null){n.push(i.item);break}let a=i.item.getPathPrimitive(),l=s.item.getPathPrimitive(),c=Ot(a),h=Ot(l);if(c.dot(h)<-.01){if(this.change=!0,a.length()>l.length()){let u=Math.abs(c.dot(l.end().sub(l.start()))),d=a.end().sub(c.mul(u));this.modifyNode(n,this.cloneOrderNode(i.item),new M(a.start(),d)),this.modifyNode(n,this.cloneOrderNode(s.item),new M(d,l.end()))}else{let u=Math.abs(h.dot(a.end().sub(a.start()))),d=l.start().add(h.mul(u));this.modifyNode(n,this.cloneOrderNode(i.item),new M(a.start(),d)),this.modifyNode(n,this.cloneOrderNode(s.item),new M(d,l.end()))}i=s.next}else n.push(i.item),i=s}return this.addDebug(n,ee.GREEN),n}modifyNode(t,e,r){return r.length()>.1&&(e.direction==0?e.pt=new M(r.start(),r.end()):e.pt=new M(r.end(),r.start()),t.push(e)),e}replaceNodes(t,e,r,i){return i.length()>1e-8&&(r.direction==0?r.pt=new M(i.start(),i.end()):r.pt=new M(i.end(),i.start()),t.insertBefore(e,r)),r}removeMid(t){this.addDebug(t,ee.BLUE);let e=t.length,r=new Array;for(let i=0;i<e;i++){let n=t[i],s=n.getPathPrimitive(),a=s.start(),l=Ot(s);if(i+2<e){let c=t[i+2],h=c.getPathPrimitive(),u=t[i+1].pt.length();if(u<s.length()&&u<h.length()){let d=h.end(),p=this.tool.degree45(l,a,d),m=new M(p[0],p[1]),g=new M(p[1],p[2]);if(!this.isCollide(n,m)&&!this.isCollide(n,g)){this.modifyNode(r,this.cloneOrderNode(n),m),this.modifyNode(r,this.cloneOrderNode(c),g),this.change=!0,i=i+2;continue}}}r.push(n)}return this.addDebug(r,ee.GREEN),r}removeShort(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=this.findNextNode2(i),a=s[s.length-1];if(s.length==0?a=i.next:a.next!=null&&(a=a.next,s.push(a)),s.shift(),s.length==0)n.push(i.item),i=a;else{let l=this.getLines(n,i,s);l==null?(n.push(i.item),i=i.next):i=l.next}}return this.addDebug(n,ee.GREEN),n}mergeSameDirect(t){this.addDebug(t,ee.BLUE);let e=t.length,r=new Array;for(let i=0;i<e;i++){let n=t[i],s=n.getPathPrimitive(),a=s.start(),l=Ot(s),c=n.item.width*3;if(i+2<e){let h=t[i+2],u=h.getPathPrimitive(),d=t[i+1].getPathPrimitive();if(Ot(s).dot(Ot(u))>.99){let p=u.end(),m=this.tool.degree45(l,a,p),g=new M(m[0],m[1]),y=new M(m[1],m[2]);if(!this.isCollide(n,g)&&!this.isCollide(n,y)){this.modifyNode(r,this.cloneOrderNode(n),g),this.modifyNode(r,this.cloneOrderNode(h),y),this.change=!0,i=i+2;continue}}}r.push(n)}return this.addDebug(r,ee.GREEN),r}remove4Distance(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=this.findNextDistanceNode(i);i=this.getLines1(n,i,s)}return this.addDebug(n,ee.GREEN),n}cloneOrderNode(t){let e=new Op(t.item,t.pt);return e.direction=t.direction,e.newDirection=t.newDirection,e.status=t.status.clone(),e}isCollide(t,e){if(e.length()<1e-8)return!1;let r=t instanceof Op?t.item:t.item.item;return this.blockShape.checkDRC4Primitive(r,e)}findNextNode(t){let e=t.item.getPathPrimitive(),r=new Array,i=Ot(e),n=t.next,s=-2,a=null;for(;n!=null;){let l=n.item.getPathPrimitive(),c=Ot(l),h=i.dot(c);if(ne.greatereq(h,s)&&(s=h,a=n),h<.01){return r.push(n),r;n=n.next}else{if(r.includes(a)){let u=r.indexOf(a);u>=0&&r.splice(u+1,r.length-u-1)}return r}}if(r.includes(a)){let l=r.indexOf(a);l>=0&&r.splice(l+1,r.length-l-1)}return r}findNextNode1(t){let e=t.item.getPathPrimitive(),r=new Array,i=Ot(e),n=t.next,s=-2,a=null,l=t.item.item.width*3;for(;n!=null;){let c=n.item.getPathPrimitive(),h=Ot(c),u=i.dot(h),d=c.length();if(ne.greatereq(u,s)&&d>l&&(s=u,a=n),u<.01||d<l)r.push(n),n=n.next;else{if(r.includes(a)){let p=r.indexOf(a);p>=0&&r.splice(p+1,r.length-p-1)}return r}}if(r.includes(a)){let c=r.indexOf(a);c>=0&&r.splice(c+1,r.length-c-1)}return r}findNextNode2(t){let e=t.item.getPathPrimitive(),r=new Array,i=e.end(),n=Ot(e),s=t.next,a=t.item.item.width*2;for(;s!=null;){let c=s.item.getPathPrimitive().end().sub(i),h=Math.abs(n.cross(c));if(ne.less(h,a))r.push(s),s=s.next;else return r}return r}findNextDistanceNode(t){let e=t.item.getPathPrimitive(),r=new Array,i=t.next,n=e.length(),s=0,a=e.start(),l=0,c=!1;for(;i!=null;){let h=i.item.getPathPrimitive();n+=h.length();let u=this.getDistance(a,h.end()),d=n-u;if(ne.greater(d,s)?(l=0,s=d,c=!0):(ne.eq(d,s),l++),r.push([i,c]),i=i.next,l>=2||i!=null&&i.item.status.notChange)break}return r}findNextDistanceNode1(t){let e=t.item.getPathPrimitive(),r=new Array,i=t.next,n=e.length(),s=0,a=e.start(),l=0,c=!1;for(;i!=null&&!(i!=null&&c&&i.item.status.isSource);){let h=i.item.getPathPrimitive();n+=h.length();let u=this.getDistance(a,h.end()),d=n-u;if(ne.greater(d,s)?(l=0,s=d,c=!0):(ne.eq(d,s),l++),r.push([i,c]),i=i.next,l>=2)break}return r}getDistance(t,e){let r=e.sub(t),i=Math.max(Math.abs(r.x),Math.abs(r.y)),n=Math.min(Math.abs(r.x),Math.abs(r.y));return i+n*COt}source2None(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=i.next;if(s!=null&&i.item.status.isSource&&!s.item.status.isSource){let a=i.item.getPathPrimitive(),l=Ot(a),c=s.item.getPathPrimitive(),h=Ot(c);if(l.dot(h)<.01){let d=a.start(),p=c.end(),m=this.tool.degree45(l,d,p),g=!1;s.next==null&&ia(l,m)[1].dot(h)<.99&&(g=!0);let y=new M(m[0],m[1]),b=new M(m[1],m[2]);if(!g&&!this.isCollide(i,y)&&!this.isCollide(i,b)){this.modifyNode(n,this.cloneOrderNode(i.item),y),this.modifyNode(n,this.cloneOrderNode(s.item),b),this.change=!0,i=s.next;continue}}}n.push(i.item),i=s}return this.addDebug(n,ee.GREEN),n}source2None1(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next();e:for(;i!=null;){if(i.item.status.isSource){let s=i.item.getPathPrimitive(),a=Ot(s),l=s.start(),c=this.findNext2(i),h=!0;for(;c.length>0;){let u=c.pop();!h&&c.length>0&&(u=c[0],c.length=0);let d=u.item.getPathPrimitive(),p=Ot(d),m=d.end(),g=this.tool.degree45(a,l,m),y=new M(g[0],g[1]),b=new M(g[1],g[2]),P=!1;if(i.next==null&&ia(a,g)[1].dot(a)<.99&&(P=!0),!P&&!this.isCollide(i,y)&&!this.isCollide(i,b)){let T=this.cloneOrderNode(i.item);y.direct.dot(a)<.99&&(T.status.isSource=!1),this.replaceNodes(e,i,T,y),this.replaceNodes(e,i,this.cloneOrderNode(u.item),b),this.change=!0;let I=i.next;e.remove(u);for(let C of c)e.remove(C);e.remove(i),i=I;continue e}h=!1}}i=i.next}let n=e.toArray();return this.addDebug(n,ee.GREEN),n}source2Source2(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next();e:for(;i!=null;){if(i.item.status.isSource){let s=this.findNodes(i);if(s.length>0){let a=s[0],l=a.item.getPathPrimitive(),c=Ot(l),h=l.start(),u=s[s.length-1],d=u.item.getPathPrimitive(),p=Ot(d),m=d.end(),g=this.tool.degree45(c,h,m),y=new M(g[0],g[1]),b=new M(g[1],g[2]),P=!1;if(i.next==null&&ia(c,g)[1].dot(c)<.99&&(P=!0),!P&&!this.isCollide(a,y)&&!this.isCollide(u,b)){this.replaceNodes(e,a,this.cloneOrderNode(a.item),y),this.replaceNodes(e,a,this.cloneOrderNode(u.item),b),this.change=!0;let T=u.next;for(let I of s)e.remove(I);i=T;continue e}}}i=i.next}let n=e.toArray();return this.addDebug(n,ee.GREEN),n}source2Source3(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next();e:for(;i!=null;){let s=this.find4Short(i);if(s.length>0){let a=s[0],l=a.item.getPathPrimitive(),c=Ot(l),h=l.start(),u=s[s.length-1],d=u.item.getPathPrimitive(),p=Ot(d),m=d.end(),g=this.tool.degree45(c,h,m),y=new M(g[0],g[1]),b=new M(g[1],g[2]),P=!1;if(i.next==null&&ia(c,g)[1].dot(c)<.99&&(P=!0),!P&&!this.isCollide(a,y)&&!this.isCollide(u,b)){this.replaceNodes(e,a,this.cloneOrderNode(a.item),y),this.replaceNodes(e,a,this.cloneOrderNode(u.item),b),this.change=!0;let T=u.next;for(let I of s)e.remove(I);i=T;continue e}}i=i.next}let n=e.toArray();return this.addDebug(n,ee.GREEN),n}none2None(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;)if(i.item.status.isSource)n.push(i.item),i=i.next;else{let s=this.findNextDistanceNode1(i);i=this.getLines1(n,i,s)}return this.addDebug(n,ee.GREEN),n}none2None1(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next();e:for(;i!=null;){if(!i.item.status.isSource){let s=i.item.getPathPrimitive(),a=Ot(s),l=s.start(),c=this.findNext2(i),h=!0;for(;c.length>0;){let u=c.pop();!h&&c.length>0&&(u=c[0],c.length=0);let d=u.item.getPathPrimitive(),p=Ot(d),m=d.end(),g=this.tool.degree45(a,l,m),y=new M(g[0],g[1]),b=new M(g[1],g[2]),P=!1;if(i.next==null&&ia(a,g)[1].dot(a)<.99&&(P=!0),!P&&!this.isCollide(i,y)&&!this.isCollide(i,b)){this.replaceNodes(e,i,this.cloneOrderNode(i.item),y),this.replaceNodes(e,i,this.cloneOrderNode(u.item),b),this.change=!0;let T=u.next;e.remove(u);for(let I of c)e.remove(I);e.remove(i),i=T;continue e}h=!1}}i=i.next}let n=e.toArray();return this.addDebug(n,ee.GREEN),n}none2Source(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=this.findNext1(i);if(s!=null&&!i.item.status.isSource&&s.item.status.isSource){let a=i.item.getPathPrimitive(),l=Ot(a),c=s.item.getPathPrimitive(),h=Ot(c);if(l.dot(h)<.01){let d=a.start(),p=c.end(),m=this.tool.degree45(l,d,p),g=new M(m[0],m[1]),y=new M(m[1],m[2]),b=!1;if(s.next==null&&ia(l,m)[1].dot(h)<.99&&(b=!0),!b&&!this.isCollide(i,g)&&!this.isCollide(i,y)){this.modifyNode(n,this.cloneOrderNode(i.item),g),this.modifyNode(n,this.cloneOrderNode(s.item),y),this.change=!0,i=s.next;continue}}}n.push(i.item),i=i.next}return this.addDebug(n,ee.GREEN),n}none2Source1(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next();e:for(;i!=null;){if(i.item.status.isSource){let s=i.item.getPathPrimitive(),a=Ot(s),l=s.end(),c=this.findPrev(i),h=!0;for(;c.length>0;){let u=c.pop();!h&&c.length>0&&(u=c[0],c.length=0);let d=u.item.getPathPrimitive(),p=Ot(d),m=d.start(),g=this.tool.degree45(p,m,l),y=new M(g[0],g[1]),b=new M(g[1],g[2]),P=!1;if(i.next==null||h){let T=ia(p,g);if(i.next==null&&T[1].dot(a)<.99&&(P=!0),i.next!=null){let I=Ot(i.next.item.getPathPrimitive());T[1].dot(I)<.01&&(P=!0)}}if(!P&&!this.isCollide(i,y)&&!this.isCollide(i,b)){this.replaceNodes(e,u,this.cloneOrderNode(u.item),y);let T=this.cloneOrderNode(i.item);b.direct.dot(a)<.99&&(T.status.isSource=!1),this.replaceNodes(e,u,T,b),this.change=!0,e.remove(u);for(let C of c)e.remove(C);let I=i.next;e.remove(i),i=I;continue e}h=!1}}i=i.next}let n=e.toArray();return this.addDebug(n,ee.GREEN),n}source2Source(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=i.next;if(s!=null&&i.item.status.isSource&&s.item.status.isSource&&!i.item.status.notChange&&!s.item.status.notChange){let a=i.item.getPathPrimitive(),l=Ot(a),c=s.item.getPathPrimitive(),h=Ot(c);if(l.dot(h)<.01){let d=a.start(),p=c.end(),m=this.tool.degree45(l,d,p),g=new M(m[0],m[1]),y=new M(m[1],m[2]),b=!1;if(s.next==null&&ia(l,m)[1].dot(h)<.99&&(b=!0),!b&&!this.isCollide(i,g)&&!this.isCollide(i,y)){this.modifyNode(n,this.cloneOrderNode(i.item),g),this.modifyNode(n,this.cloneOrderNode(s.item),y),this.change=!0,i=s.next;continue}}}n.push(i.item),i=s}return this.addDebug(n,ee.GREEN),n}source2Source1(t){this.addDebug(t,ee.BLUE);let e=new On;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=i.next;if(s!=null&&i.item.status.isSource&&s.item.status.isSource){let a=i.item.getPathPrimitive(),l=Ot(a),c=s.item.getPathPrimitive(),h=Ot(c);if(l.dot(h)<.01){let d=a.start(),p=!1,m=c.end(),g=this.tool.degree45(l,d,m);if(s.next==null&&ia(l,g)[1].dot(h)>.99&&(p=!0),!p){let T=a.length()/2,I=c.length()/2,C=Math.min(T/2,I/2,3);m=c.start().add(h.mul(C)),g=this.tool.degree45(l,d,m)}let y=new M(g[0],g[1]),b=new M(g[1],g[2]);if(!!1&&!this.isCollide(i,y)&&!this.isCollide(i,b)){this.modifyNode(n,this.cloneOrderNode(i.item),y),this.modifyNode(n,this.cloneOrderNode(s.item),b),p||this.modifyNode(n,this.cloneOrderNode(s.item),new M(m,c.end())),this.change=!0,i=s.next;continue}}}n.push(i.item),i=s}return this.addDebug(n,ee.GREEN),n}findNext(t,e){for(;t.next!=null;)if(t=t.next,t.item.status.isSource==e)return t;return null}findNext1(t){for(;t.next!=null;)if(t=t.next,t.item.status.isSource)return t;return null}findNodes(t){let e=this.findNext2(t);if(e.length>0){let r=this.findPrev(t);if(r.length>0){let i=new Array;for(let n=r.length-1;n>=0;n--)i.push(r[n]);return i.push(t),Re.addAll(i,e),i}}return[]}find4Short(t){let e=t.item.getPathPrimitive();if(t.prev!=null&&t.next!=null&&e.length()<t.item.item.width*2){let r=t.prev,i=t.next;return[r,t,i]}return[]}findNext2(t){let e=t.item.getPathPrimitive(),r=Ot(e),i=!1,n=new Array;for(;t.next!=null;){let s=t.next,a=s.item.getPathPrimitive(),l=Ot(a),c=r.dot(l);if(c<.01&&!s.item.status.isSource&&(i=!0),!i)return n;if(c>.01&&!s.item.status.isSource)return n.push(s),n;if(s.item.status.isSource)return n;n.push(s),t=s}return n}findPrev(t){let e=t.item.getPathPrimitive(),r=Ot(e),i=!1,n=new Array;for(;t.prev!=null;){let s=t.prev,a=s.item.getPathPrimitive(),l=Ot(a),c=r.dot(l);if(c<.01&&!s.item.status.isSource&&(i=!0),!i)return n;if(c>.01&&!s.item.status.isSource)return n.push(s),n;if(s.item.status.isSource)return n;n.push(s),t=s}return n}findNext3(t){let e=t.item.getPathPrimitive(),r=Ot(e),i=new Array;for(;t.next!=null;){let n=t.next,s=n.item.getPathPrimitive(),a=Ot(s);if(r.dot(a)>.01&&!n.item.status.isSource)return i.push(n),i;if(n.item.status.isSource)return i;i.push(n),t=n}return i}findPrev1(t){let e=t.item.getPathPrimitive(),r=Ot(e),i=new Array;for(;t.prev!=null;){let n=t.prev,s=n.item.getPathPrimitive(),a=Ot(s);if(r.dot(a)>.01&&!n.item.status.isSource)return i.push(n),i;if(n.item.status.isSource)return i;i.push(n),t=n}return i}};var bD=class{constructor(t){this.clearanceUtils=new Ep;this.sweep=null;this.end=null;this.endNode=null;this.point=null;this.startIndex=-1;this.endIndex=-1;this.rtree=new NT(15);this.tracks=new Array;if(t!=null){let e=t.iterator();for(;e.hasNext();){let r=e.next();this.tracks.push(r),this.rtree.insert(new s0(r))}t.viaNode.prev!=null&&this.rtree.insert(new s0(t.viaNode.prev.item)),t.otherNode.prev!=null&&t.otherNode.prev instanceof Je&&this.rtree.insert(new s0(t.otherNode.prev)),t.viaNode.next!=null&&this.rtree.insert(new s0(t.viaNode.next.item)),t.otherNode.next!=null&&t.otherNode.next instanceof Je&&this.rtree.insert(new s0(t.otherNode.next))}}getBBox4Primitive(t,e,r){return e instanceof M?nh.trackToOctagon(e.start(),e.end(),t.width+r*2):e.bbox().extendOfSize(r+t.width/2)}calculateStartCollide(t){let e=t.length,r=this.clearanceUtils.getMaxClearance();for(let i=0;i<e;i++){let n=t[i];if(n==null)continue;let s=_a(n),a=n.primitive,l=this.getBBox4Primitive(n,a,r),c=n.layerId,h=new Array,u=this.rtree.search(l);for(let p of u){let m=p.model;if(m instanceof yt){let g=this.clearanceUtils.getSafeClearance(s,_a(m,!1),m,n.layerId);if(ne.eq(g,0))continue;let y=kh.check(a,c,n,m,g);if(y.collide){let b=y.inters(a),P=new bl(n,b,m,g,void 0,n.layerId,c,y.collideInfo);h.push(P)}}else if(m instanceof It||m instanceof Je){let g=this.collideViaPad(n,m,!1);g!=null&&Re.addAll(h,g)}}let d=a.start();if(xr(h,(p,m)=>p.point.distance2(d)-m.point.distance2(d),0,h.length),h.length>0)return h[0]}return null}calculateEndCollide(t){let e=t.length,r=this.clearanceUtils.getMaxClearance();for(let i=e-1;i>=0;i--){let n=t[i];if(n==null)continue;let s=_a(n),a=n.primitive.reverse(),l=this.getBBox4Primitive(n,a,r),c=n.layerId,h=new Array,u=this.rtree.search(l);for(let p of u){let m=p.model;if(m instanceof yt){let g=this.clearanceUtils.getSafeClearance(s,_a(m,!1),m,n.layerId);if(ne.eq(g,0))continue;let y=kh.check(a,c,n,m,g);if(y.collide){let b=y.inters(a),P=new bl(n,b,m,g,void 0,n.layerId,c,y.collideInfo);h.push(P)}}else if(m instanceof It||m instanceof Je){let g=this.collideViaPad(n,m,!0);g!=null&&Re.addAll(h,g)}}let d=a.start();if(xr(h,(p,m)=>p.point.distance2(d)-m.point.distance2(d),0,h.length),h.length>0)for(let p of h){let m=p.obstacle;if(m instanceof It||m instanceof Je){this.endNode=m,this.point=p.point;return}if(p.obstacle.primitive.length()>1e-8){this.sweep=this.getSweep(p.obstacle,p.point),this.end=p.obstacle,this.point=p.point;return}}}}checkEndpoint(t,e,r,i=!0){if(r){if(e.viaNode.prev!=null){let n=this.collideViaPad(t,e.viaNode.prev.item,i);if(n)return n}if(e.otherNode.prev!=null&&e.otherNode.prev instanceof Je){let n=this.collideViaPad(t,e.otherNode.prev,i);if(n)return n}}else{if(e.viaNode.next!=null){let n=this.collideViaPad(t,e.viaNode.next.item);if(n)return n}if(e.otherNode.next!=null&&e.otherNode.next instanceof Je){let n=this.collideViaPad(t,e.otherNode.next);if(n)return n}}return null}collideViaPad(t,e,r=!0){let i=_a(t),n=this.clearanceUtils.getSafeClearance(i,_a(e,!1),e,t.layerId);if(t.buildBBox().extendOfSize(n).isSeparated(e.buildBBox()))return null;let s=r?t.primitive.reverse():t.primitive,a=t.layerId,l=new Array;if(ne.eq(n,0))return null;let c=kh.check(s,a,t,e,n);if(c.collide){let h=c.inters(s),u=new bl(t,h,e,n,void 0,t.layerId,a,c.collideInfo);l.push(u)}return l.length>0?l:null}getSweep(t,e){var n,s,a,l;let r=xt.getInstance().getListNode(t),i=hg(t.primitive,e,(s=(n=r.prev)==null?void 0:n.item)==null?void 0:s.primitive,(l=(a=r.next)==null?void 0:a.item)==null?void 0:l.primitive);return i==null?le.CCW:i}getListNode(t){return xt.getInstance().getListNode(t)}increase(t){if(this.point==null)return!0;let e=this.getNearPoint(t,this.end.primitive),r=this.getNearPoint(this.point,this.end.primitive);if(e.equals1(r)){let n=Ot(this.end.primitive,e),s=t.sub(e),a=this.point.sub(e),l=s.dot(n),c=a.dot(n);return l<c}return!!dn([e,r],this.end.primitive)[0].equals1(e)}getNearPoint(t,e){let r=new M(t,t),n=new ir(r,e).getLine();return n.start().equals1(t)?n.end():n.start()}getObstacles4Same(t){if(this.end!=null){let e=t.parent.toArray();if(this.endIndex=e.indexOf(this.end),this.startIndex=e.indexOf(t.item),this.endIndex>this.startIndex){let r=new Array;for(let i=this.startIndex;i<=this.endIndex;i++)r.push(e[i]);return r}else{let r=new Array;for(let i=this.endIndex;i<=this.startIndex;i++)r.push(e[i]);return r}}return[t.item]}getObstacles4Other(t,e){if(this.end!=null){let r=t.parent.toArray();if(this.endIndex=r.indexOf(this.end),this.startIndex=r.indexOf(t.item),this.endIndex>this.startIndex){let i=new Array;if(e){for(let n=this.startIndex;n<r.length;n++)i.push(r[n]);t.parent.viaNode.next!=null&&i.push(t.parent.viaNode.next),t.parent.otherNode.next!=null&&!(t.parent.otherNode.next instanceof Kn)&&i.push(t.parent.otherNode.next)}else{for(let n=0;n<=this.endIndex;n++)i.push(r[n]);t.parent.viaNode.prev!=null&&i.push(t.parent.viaNode.prev),t.parent.otherNode.prev!=null&&i.push(t.parent.otherNode.prev)}return i}else{let i=new Array;if(e){for(let n=this.endIndex;n<r.length;n++)i.push(r[n]);t.parent.viaNode.next!=null&&i.push(t.parent.viaNode.next),t.parent.otherNode.next!=null&&!(t.parent.otherNode.next instanceof Kn)&&i.push(t.parent.otherNode.next)}else{for(let n=0;n<=this.startIndex;n++)i.push(r[n]);t.parent.viaNode.prev!=null&&i.push(t.parent.viaNode.prev),t.parent.otherNode.prev!=null&&i.push(t.parent.otherNode.prev)}return i}}return[t.item]}getObstaclesIndex(t){if(this.end!=null){let e=t.parent.toArray();this.endIndex=e.indexOf(this.end),this.startIndex=e.indexOf(t.item)}}getMin(t,e,r,i=!0){let n=new Map,s=i?r.size():-1,a=null,l=-1;for(let h of t){l++;let u=new Array;n.set(l,u);let d=_a(e),p=r.getFirst(),m=this.clearanceUtils.getSafeClearance(d,_a(p,!1),p,e.layerId);if(ne.eq(m,0))continue;let g=e.layerId,y=r.listIterator(),b=0;for(;y.hasNext();){let I=y.next().item,C=kh.check(h,g,e,I,m);if(C.collide){let E=C.inters(h),O=new bl(e,E,I,m,void 0,e.layerId,g,C.collideInfo);u.push(O),i?b<s&&(s=b,a=I):b>s&&(s=b,a=I)}b++}let P=h.start();xr(u,(T,I)=>T.point.distance2(P)-I.point.distance2(P),0,u.length)}let c=new Array;for(let[h,u]of n){let d=!1;for(let p of u)if(p.obstacle==a){d=!0;break}c.push(d)}return c}};var Woe=class{constructor(t,e){this.sourceIndexMaps=new Map;this.node=null;this.sourceIndexMaps=t,this.directFilter=e}setNode(t){this.node=t}filter(t,e=this.node){if(e==null)return t;let r=e.item,i=new Set;for(let n of t){if(n.net==r.net&&n.layerId==r.layerId){if(e.startSource!=null&&this.sourceIndexMaps.get(e.startSource)>this.sourceIndexMaps.get(n))continue;i.add(n);continue}let s=n;if(s instanceof yt&&r.net!=s.net&&this.directFilter.canShove(s)){let a=xt.getInstance().getNode(s);if(e.inPushPath(a.parent)||e.inPushPath(s))continue}i.add(n)}return i}};var zoe=class{constructor(t){this.cwObstaclesMap=new Map;this.ccwObstaclesMap=new Map;this.cwPushMap=new Map;this.ccwPushMap=new Map;this.sameDirect=new Map;this.block=new As;this.used=new Set;this.exclusions=new Set;this.recommendDirect=new Map;this.source=t,this.exclusions=new Set(t);for(let e of t){let r=this.block.blockTrackOther(e,this.exclusions);this.classify(r)}}classify(t){this.groupSort(t);for(let e of t)this.classifyResult(e)}groupSort(t){let e=null,r=[],i=new Array,n=new Map,s=0;for(let l of t)l.obstacle instanceof yt?e==null?(e=l.point,r.push(l),n.set(l,s)):e.distance1(l.point)<1e-4?(r.push(l),n.set(l,s)):(i.push(r),r=[],s++,r.push(l),n.set(l,s)):n.set(l,s++);i.push(r);let a=!1;for(let l of i)if(l.length>1){let c=new Map;for(let h of l){let u=h.obstacle;if(u instanceof yt){let d=this.getListNode(u),p=c.get(d.parent);p==null&&(p=[],c.set(d.parent,p)),p.push(h)}}for(let[h,u]of c)if(u.length>1){a=!0;for(let d of u){let p=d.obstacle.primitive,g=new ir(p,new M(d.point,d.point)).getLine(),y;g.start().equals1(d.point)?y=Ot(p,g.end()):y=Ot(p,g.start());let b=Math.abs(y.dot(g.direct)),P=n.get(d)+b;n.set(d,P)}}}a&&t.sort((l,c)=>n.get(l)-n.get(c))}classifyResult(t){let e=t.obstacle;!t.isSameNet&&e instanceof yt&&t.source instanceof yt?this.calculateSameListObstacles(e,t.source,t.point):!t.isSameNet&&e instanceof It&&t.source instanceof yt?this.calculateEndpoints(this.getNode(e),t.source,t.point,t):!t.isSameNet&&e instanceof Je&&t.source instanceof yt&&this.calculateEndpoints(this.getNode(e),t.source,t.point,t)}calculateSameListObstacles(t,e,r){var h;let i=this.getListNode(t);if(this.used.has(i.parent))return;let n=i.parent;this.used.add(n),this.add2Exclusions(n);let s=new bD(n);if(s.calculateEndCollide(this.source),s.endNode!=null){let u=s.endNode,d;u instanceof It?((h=n.viaNode.prev)==null?void 0:h.item)==u?d=!0:d=!1:n.otherNode.prev==u?d=!0:d=!1,this.addCache(u,d,!1,s.point,t,r);return}let a=s.getSweep(t,r),l=le.CCW,c;if(s.getObstaclesIndex(i),s.startIndex<s.endIndex?c=a:s.startIndex==s.endIndex?s.increase(r)?c=a:c=a==le.CCW?le.CW:le.CCW:c=a==le.CCW?le.CW:le.CCW,s.sweep==a){this.sameDirect.set(n,!0);let u=s.getObstacles4Same(i),d=new Set(n.toArray());for(let p of u)d.delete(p);l==c?(this.recommendDirect.set(n,le.CW),this.cwObstaclesMap.set(n,new Set(u)),this.cwPushMap.set(n,new Set(d)),this.ccwObstaclesMap.set(n,new Set([n]))):(this.recommendDirect.set(n,le.CCW),this.cwObstaclesMap.set(n,new Set([n])),this.ccwObstaclesMap.set(n,new Set(u)),this.ccwPushMap.set(n,new Set(d)))}else{this.sameDirect.set(n,!1);let u=lb(r,t.primitive),d=l==u,p=s.getObstacles4Other(i,d),m=s.getObstacles4Other(i,!d);this.cwObstaclesMap.set(n,new Set(p)),this.ccwObstaclesMap.set(n,new Set(m))}}add2Exclusions(t){let e=t.iterator();for(;e.hasNext();)this.exclusions.add(e.next())}getCache(t,e,r,i,n){let s=Ot(i.primitive,n),a=n.sub(i.start).normalize(),l=s.cross(a)>0?le.CCW:le.CW,c=xt.getInstance().getListNode(i).parent,h=this.getObstacles(t,e,i);return e?r?l==le.CCW?{cw:new Set(h),ccw:new Set([c])}:{cw:new Set([c]),ccw:new Set(h)}:l==le.CCW?{cw:new Set([c]),ccw:new Set(h)}:{cw:new Set(h),ccw:new Set([c])}:r?l==le.CCW?{cw:new Set([c]),ccw:new Set(h)}:{cw:new Set(h),ccw:new Set([c])}:l==le.CCW?{cw:new Set(h),ccw:new Set([c])}:{cw:new Set([c]),ccw:new Set(h)}}addCache(t,e,r,i,n,s){var m,g,y,b,P,T,I,C;let a=xt.getInstance().getListNode(n),l=hg(n.primitive,s,(g=(m=a.prev)==null?void 0:m.item)==null?void 0:g.primitive,(b=(y=a.next)==null?void 0:y.item)==null?void 0:b.primitive),c;e?c=a.parent.getFirstNode():c=a.parent.getLastNode();let h=hg(c.item.primitive,i,(T=(P=c.prev)==null?void 0:P.item)==null?void 0:T.primitive,(C=(I=c.next)==null?void 0:I.item)==null?void 0:C.primitive),u=a.parent;this.sameDirect.set(u,l==h);let d=this.getObstacles(t,e,n),p=l==h?new Set([u]):this.getAll(u);e?r?(this.recommendDirect.set(u,l==le.CCW?le.CW:le.CCW),l==le.CCW?(this.cwObstaclesMap.set(u,new Set(d)),this.ccwObstaclesMap.set(u,p)):(this.cwObstaclesMap.set(u,p),this.ccwObstaclesMap.set(u,new Set(d)))):(this.recommendDirect.set(u,l),l==le.CCW?(this.cwObstaclesMap.set(u,p),this.ccwObstaclesMap.set(u,new Set(d))):(this.cwObstaclesMap.set(u,new Set(d)),this.ccwObstaclesMap.set(u,p))):r?(this.recommendDirect.set(u,l),l==le.CCW?(this.cwObstaclesMap.set(u,p),this.ccwObstaclesMap.set(u,new Set(d))):(this.cwObstaclesMap.set(u,new Set(d)),this.ccwObstaclesMap.set(u,p))):(this.recommendDirect.set(u,l==le.CCW?le.CW:le.CCW),l==le.CCW?(this.cwObstaclesMap.set(u,new Set(d)),this.ccwObstaclesMap.set(u,p)):(this.cwObstaclesMap.set(u,p),this.ccwObstaclesMap.set(u,new Set(d))))}getAll(t){let e=new Set,r=t.iterator();for(;r.hasNext();)e.add(r.next());return t.otherNode.prev!=null&&e.add(t.otherNode.prev),t.otherNode.next!=null&&e.add(t.otherNode.next),t.viaNode.prev!=null&&e.add(t.viaNode.prev.item),t.viaNode.next!=null&&e.add(t.viaNode.next.item),e}getObstacles(t,e,r){let i=xt.getInstance().getListNode(r),n=new Array;if(n.push(t),e)for(;i!=null;)n.push(i.item),i=i.prev;else for(;i!=null;)n.push(i.item),i=i.next;return n}getNode(t){return t instanceof It?_i.getInstance().getViaNode(t):yc.getInstance().getNode(t)}calculateEndpoints(t,e,r,i){for(let[n,s]of t.connectTrack){if(n.size()==0||n.getFirst().layerId!=e.layerId||this.used.has(n))continue;let a=new bD(n);a.calculateEndCollide(this.source);let l=a.calculateStartCollide(this.source);if(l!=null&&l.obstacle instanceof yt)return this.calculateSameListObstacles(l.obstacle,l.source,l.point);if(this.used.add(n),this.add2Exclusions(n),a.endNode!=null)if(this.sameDirect.set(n,!1),a.endNode==t.item)this.collideInCCW(i,e,r,a.point,n)?(this.cwObstaclesMap.set(n,new Set([t.item])),this.ccwObstaclesMap.set(n,new Set([n]))):(this.cwObstaclesMap.set(n,new Set([n])),this.ccwObstaclesMap.set(n,new Set([t.item])));else{let c=this.getAll(n);this.cwObstaclesMap.set(n,c),this.ccwObstaclesMap.set(n,c)}else a.end!=null&&this.addCache(t.item,s,!0,r,a.end,a.point)}}getListNode(t){return xt.getInstance().getListNode(t)}splitPolyline(t,e,r){let i=new M(e,e),n=new M(r,r),s=null,a=null;for(let p of t.primitives){let m=new ir(p,i),g=new ir(p,n);(s==null||m.getDistance()<s.getDistance())&&(s=m),(a==null||g.getDistance()<a.getDistance())&&(a=g)}function l(p,m){return p.pt1==m?t.primitives.indexOf(p.pt2):t.primitives.indexOf(p.pt1)}let c=l(s,i),h=l(a,n),u=new Array;function d(p,m){if(m==c){let g=gd(p,e);u.push(g[g.length-1])}else if(m==h){let g=gd(p,r);u.push(g[0])}else u.push(p)}if(c<h)for(let p=c;p<=h;p++){let m=t.primitives[p];d(m,p)}else if(c==h){let p=[e,r];dn(p,t.primitives[c]);let m=t.primitives[c];if(p[0]==e){let g=gd(m,e),y=gd(g[g.length-1],r);u.push(y[0])}else{for(let g=c;g<t.primitives.length;g++){let y=t.primitives[g];d(y,g)}for(let g=0;g<=h;g++){let y=t.primitives[g];d(y,g)}}}else{for(let p=c;p<t.primitives.length;p++){let m=t.primitives[p];d(m,p)}for(let p=0;p<=h;p++){let m=t.primitives[p];d(m,p)}}return u}collideInCCW(t,e,r,i,n){let s=this.getRtree(n),a=t.info.shape.getOutline(Ts),l=this.splitPolyline(a,r,i),c=e.width/2+t.clearance;for(let h of l){let u=h.bbox().extendOfSize(c),d=s.search(u);for(let p of d){let m=p.model;if(m instanceof yt&&Tt(h,m.primitive)>0)return!0}}return!1}getRtree(t){let e=new NT(15),r=t.iterator();for(;r.hasNext();){let i=r.next();e.insert(new s0(i))}return e}};var aV=class extends Ou{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e){super(),this.node=t,this.valid=e}redo(){J6(this.node,!this.valid),this.valid=!this.valid}undo(){J6(this.node,!this.valid),this.valid=!this.valid}};var lV=class extends Ou{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e,r){super(),this.src=e,this.list=t,this.node=r}redo(){this.list.remove(this.node);let t=this.node.item;this.node.set(null),xt.getInstance().delete(t)}undo(){this.src!=null?this.list.insertNodeAfter(this.src,this.node):this.list.addFirstNode(this.node)}};var o9=class{constructor(t=1e13){this.obstacleMaps=new Map;this.sourceMaps=new Map;this.sourceIndexMaps=new Map;this.blockShape=new As;this.debug=null;this.level="NONE";this.isWire=!1;this.direct=new S(1,0);this.trackList=null;this.collidedCloseShape=!1;this.success=!0;this.group=null;this.inputEndpointCanModify=!1;this.lastPushDirect=null;this.timeout=t}initDebug(){Yr.debug&&(Yr.inputClear(),this.debug=new l_(1),this.debug.init(),Yr.input(this.debug)),this.debug!=null&&(this.debug.debug=Yr.debug)}find(t,e,r){if(this.lastPushDirect=null,this.inputEndpointCanModify=!1,this.success=!0,t.length==0)return;Nt.pushFilter.clearExclusion(),this.directFilter=r,this.initDebug(),this.trackList=new On,this.obstacleMaps.clear(),this.sourceMaps.clear();let i=new Set,n=0;for(let g of t){this.directFilter.awaitShove.delete(g);let y=this.add(this.trackList,g,g.primitive);this.sourceMaps.set(g,[y]),this.sourceIndexMaps.set(g,n),i.add(y),this.debugTrack(g,g.primitive,ee.Golden),n++}if(this.group=new zoe(t),Nt.aroundFilter=new Woe(this.sourceIndexMaps,r),this.inputEndpointCanModify=this.endpointCanModify(t[t.length-1]),!this.inputEndpointCanModify)for(let[g,y]of this.group.sameDirect)!y&&!r.canShovePath.has(g)&&this.endpointIsFix(g)&&Nt.pushFilter.addExclusionList(g);if(!this.isWire){let g=this.blockShape.blockTrackPoint(t[0],!0),y=new Set(this.blockShape.blockTrackPoint(t[0],!1));for(let b of g)if(b instanceof yt&&y.has(b)){let P=xt.getInstance().getNode(b).parent;Nt.pushFilter.addWaitList(P)}}let s=new Foe(this.timeout,this.trackList.getFirst(),this.trackList.getLast(),this.findNeighborNodes.bind(this));Nt.aroundFilter=null,this.success=s.success;let a=xt.getInstance().getNode(t[0]).parent,l=this.connect(s.endNode,a);this.addPolylineDebug(l);for(let g of l)i.has(g)?g.source=!0:g.source=!1;let c=new Array,h=new ri,u=xt.getInstance(),d=null,p=null,m=null;for(let g of l)if(g.source){c.push(g.item);let y=u.getNode(g.item);d!=null&&(y!=null&&y.prev!=null&&(m=y.prev),d.replace(p,m),e.addCommand(new Ti(d))),p=y.next,d=null,m=null}else{let y=g.item,b=g.getPathPrimitive();if(p==null&&(p=u.getNode(y)),m=u.getNode(y),b.length()<1e-8&&l.length>1)continue;let P;b instanceof M?P=h.createTrack(y.layerId,b.start(),b.end(),y.width,y.showNet,e,y.getGroupID()):P=h.createArcTrackByArc(y.layerId,b,y.width,y.showNet,e,y.getGroupID()),d==null&&(d=u.createList());let T=h.addList(P,d,e);if(Fr.getInstance().setStatus(T,g.status.clone()),!g.status.isVertex){let C=g.obstacle;if(C!=null&&C instanceof yt){let E=this.getListNode(C);Fr.getInstance().getStatus(E).isVertex&&this.isSameShoveDirect(T,E)&&(g.status.isVertex=!0)}}let I=this.blockShape.blockOtherTrackOnlyTrack(P);for(let C of I){let E=C.source;E instanceof yt&&this.directFilter.canShove(E)&&this.directFilter.awaitShove.add(E)}c.push(P)}if(d!=null){let g=u.getNode(t[t.length-1]);g!=null&&(m=g),d.replace(p,m),e.addCommand(new Ti(d))}else if(p!=null){let g=u.getNode(t[t.length-1]);if(g!=null&&g.next!=p){m=g;let y=foe(p,m),b=p.parent;for(let P of y)e.addCommand(new aV(P,!1)),e.addCommand(new lV(b,P.prev,P)),J6(P,!1),b.remove(P)}}return Nt.pushFilter.clearExclusion(),d=null,p=null,m=null,c}optimize(t,e){if(this.success=!0,t.length==0)return;this.initDebug(),this.trackList=new On,this.obstacleMaps.clear(),this.sourceMaps.clear();let r=new Set,i=0;for(let p of t){let m=this.add(this.trackList,p,p.primitive);this.sourceMaps.set(p,[m]),this.sourceIndexMaps.set(p,i),r.add(m),this.debugTrack(p,p.primitive,ee.Golden),i++}let s=new CX(performance.now()+this.timeout,this.trackList.toArray(),this.blockShape,this.level,this.direct,this.isWire).optimization();this.addPolylineDebug(s);for(let p of s)r.has(p)?p.source=!0:p.source=!1;let a=new Array,l=new ri,c=xt.getInstance(),h=null,u=null,d=null;for(let p of s)if(p.source){a.push(p.item);let m=c.getNode(p.item);h!=null&&(m!=null&&m.prev!=null&&(d=m.prev),h.replace(u,d),e.addCommand(new Ti(h))),u=m.next,h=null,d=null}else{let m=p.item,g=p.getPathPrimitive();u==null&&(u=c.getNode(m)),d=c.getNode(m);let y;g instanceof M?y=l.createTrack(m.layerId,g.start(),g.end(),m.width,m.showNet,e,m.getGroupID()):y=l.createArcTrackByArc(m.layerId,g,m.width,m.showNet,e,m.getGroupID()),h==null&&(h=c.createList());let b=l.addList(y,h,e);if(Fr.getInstance().setStatus(b,p.status.clone()),!p.status.isVertex){let P=p.obstacle;if(P!=null&&P instanceof yt){let T=this.getListNode(P);Fr.getInstance().getStatus(T).isVertex!=null&&this.isSameShoveDirect(b,T)&&(p.status.isVertex=!0)}}a.push(y)}if(h!=null){let p=c.getNode(t[t.length-1]);p!=null&&(d=p),h.replace(u,d),e.addCommand(new Ti(h))}return h=null,u=null,d=null,a}isSameShoveDirect(t,e){let r=Ot(t.item.primitive),i=Ot(e.item.primitive),n=Fr.getInstance().getStatus(t).pushDirect,s=Fr.getInstance().getStatus(e).pushDirect;return this.isSameShoveDirect1(r,i,n,s)}isSameShoveDirect1(t,e,r,i){let n=r==le.CCW?new S(-t.y,t.x):new S(t.y,-t.x),s=i==le.CCW?new S(-e.y,e.x):new S(e.y,-e.x);return!!ne.greater(n.dot(s),0)}addPolylineDebug(t){if(Yr.debug){let e=new Array;for(let i of t){let n=new eo(i.getPathPrimitive(),{color:ee.Golden,net:i.item.net});e.push(n)}let r=new Kd(e);Yr.inputDebugGraphics(r),Yr.inputClear()}}connect(t,e){let r=new Array;if(t==null)return r;for(r.push(t);t.parent!=null;)t=t.parent,r.push(t);let i=r.reverse();this.filterFailResult(i);for(let n of i)if(n.aroundType>=2&&n.obstacle!=null){let s=Ju.getInstance().getObstacleInfo(n.obstacle);n.direction==0?s.addCCW(e):s.addCW(e)}return this.calculateVertex(i),this.success&&(i=new CX(performance.now()+this.timeout,i,this.blockShape,this.level,this.direct,this.isWire).optimization()),i}filterFailResult(t){if(this.success||!this.inputEndpointCanModify)return t;{let e=t.length-1;for(;e>=0&&!t[e].source;e--);return t.splice(e+1,t.length-e-1),t}}calculateVertex(t){let e=null,r=!1,i=null;for(let n of t)if(!n.status.isVertex){if(n.obstacle!=null&&n.obstacle instanceof yt&&e!=n.obstacle){e=n.obstacle,r=!1;let s=this.getListNode(n.obstacle);if(i=Fr.getInstance().getStatus(s),i.isVertex){let a=Ot(s.item.primitive),l=Ot(n.getPathPrimitive());this.isSameShoveDirect1(a,l,this.getListNodePushDirect(s),n.status.pushDirect)&&(r=!0)}}n.source&&(r=!1,i=null,e=null),r&&(n.status.isVertex=r)}}getListNodePushDirect(t){return Fr.getInstance().getStatus(t).pushDirect}getNodeNeihbor(t,e,r){var n;if((n=this.debug)!=null&&n.debug){let s=t.getPathPrimitive();this.debugTrack(t.item,s,ee.GREEN)}r(t);let i=t.getNeihbor();return i!=null&&!e(i)?(i.newDirection=t.direction,i.newParent=t,i.addAllObstacle(t.obstacles),[i]):[]}filterNeighborNodes(t,e,r,i){this.debugTrack(t.item,t.getPathPrimitive(),ee.GREEN),r(t);let n=e.filter(s=>s!=null&&!i(s));for(let s of n)s.newParent=t,s.addAllObstacle(t.obstacles);return n}findNeighborNodes(t,e,r){var l,c,h,u;let i=t.item;if(t.source&&(i.locked||Ps(i)||i.getParent()!=null))return this.getNodeNeihbor(t,e,r);let n=t.getPathPrimitive();t.checkSelfObstacle(),this.debugTrack(t.item,n,ee.BLUE),Nt.aroundFilter.setNode(t);let s=this.search(i,n,t.source),a=Array.from(s);if(s=this.filterObstacle(s,t),s.length==0)return this.getNodeNeihbor(t,e,r);{let d=!0;for(let p of s){let m=p.obstacle;if(m instanceof yt&&m.net==i.net&&m.layerId==i.layerId){let g=this.sourceMaps.get(m);if(g!=null){if(t.startSource!=null&&this.sourceIndexMaps.get(t.startSource)>this.sourceIndexMaps.get(m))continue;let y=0;if(t.item==p.obstacle){let P=g.indexOf(t.startSourceNode);P>=0&&(y=P+1)}let b=g.length-1;for(;y<=b;y++){let P=g[y],T=this._findNeighborNodesAtTrack(t,P,p,y<b,a);if(T!=null){let I=T.currentNode.obstacle;if(I instanceof yt){let C=this.getListNode(I);this.lastPushDirect=hg(I.primitive,T.currentNode.pt.end(),(c=(l=C.prev)==null?void 0:l.item)==null?void 0:c.primitive,(u=(h=C.next)==null?void 0:h.item)==null?void 0:u.primitive)}return this.filterNeighborNodes(T.currentNode,T.neighborNodes,r,e)}}}}else{d=!1;let g=this.getObstacleList(p,i,t);if(g===t.node.parent)continue;if(p.point.equals1(n.end()))return this.getNodeNeihbor(t,e,r);try{let{currentNode:y,neighborNodes:b}=this._findNeighborNodesAtPolygon(t,g,p);return ne.eq(y.pt.length(),0)&&r(t),this.inputEndpointCanModify&&!this.inObstacleCloseShape(m,p.point)&&(b.length=0),this.filterNeighborNodes(y,b,r,e)}catch(y){return this.debugCollide(g,t,p.point),console.log(y),[]}}}return d?this.getNodeNeihbor(t,e,r):[]}}filterObstacle(t,e){let r=e.item,i=[],n=new Set,s=!1;for(let a of t){if(a.isSameNet){let c=a.obstacle;if(c instanceof yt&&c.net==r.net&&c.layerId==r.layerId&&this.sourceMaps.get(c)==null||a.obstacle instanceof yt&&(e.startSource!=null&&this.sourceIndexMaps.get(e.startSource)>this.sourceIndexMaps.get(a.obstacle)||!this.isValid4SameTrack(e,a.obstacle,a.point)||!this.isValidSameNet(e,a.obstacle.primitive,a.point)))continue;i.push(a),s=!0;continue}if(s&&!a.isSameNet)break;let l=a.obstacle;if(l instanceof yt&&r.net!=l.net&&this.directFilter.canShove(l)){let c=xt.getInstance().getNode(l);if(e.inPushPath(c.parent))continue}if(e.aroundType>=2&&l instanceof yt&&r.net!=l.net&&this.directFilter.canShove(l)&&!l.locked&&!Ps(l)&&l.getParent()==null){let c=xt.getInstance().getNode(l);if(e.inPushPath(c.parent))continue;let h=n.has(c.parent)||this.isObstacle(e,l,a.point);if(!n.has(c.parent)&&h&&!this.inObstacles(e,c)){let u=this.getListNodePushDirect(c);if(u==null)h=!1;else if(u==le.CCW){let d=Ot(l.primitive),p=this.getDirect(l.start,a.point),m=d.cross(p);ne.lesseq(m,0)?h=!1:h=!0}else{let d=Ot(l.primitive),p=this.getDirect(l.start,a.point),m=d.cross(p);ne.greatereq(m,0)?h=!1:h=!0}}h?(n.add(c.parent),i.push(a)):e.addPushPath(c.parent)}else if(l instanceof It&&r.net!=l.net&&this.directFilter.canShoveViaModel(l)){if(this.directFilter.awaitShove.has(this.getSolidNode(l)))continue;i.push(a)}else{if(e.aroundType==1&&l instanceof yt&&r.net!=l.net&&this.directFilter.canShove(l)&&e.obstacle instanceof yt&&!l.locked&&!Ps(l)&&l.getParent()==null){let c=xt.getInstance().getNode(e.obstacle),h=xt.getInstance().getNode(l);n.has(h.parent)||this.isObstacle(e,l,a.point)?(n.add(h.parent),i.push(a)):h.parent==c.parent?e.addPushPath(l):e.addPushPath(h.parent);continue}else if(l instanceof yt&&r.net!=l.net&&this.directFilter.canShove(l)&&e.aroundType==0&&!l.locked&&!Ps(l)&&l.getParent()==null&&this.directFilter.awaitShove.has(l))continue;i.push(a)}}return i}endpointIsFix(t){return!this.canOffset(t,!0)&&!this.canOffset(t)}canOffset(t,e=!1){var r,i;if(t.size()>0){if(e){if(t.otherNode.prev==null&&(t.viaNode.prev==null||t.viaNode.prev!=null&&(!t.viaNode.prev.isSource||(r=Nt.filter)!=null&&r.canShoveVia())))return!0}else if(t.otherNode.next==null&&(t.viaNode.next==null||t.viaNode.next!=null&&(!t.viaNode.next.isSource||(i=Nt.filter)!=null&&i.canShoveVia())))return!0}return!1}isObstacle4CollidePoint(t,e){let r=this.getListNode(e),i=!0,n=this.getListNodePushDirect(r);if(n==null)i=!1;else if(n==le.CCW){let s=Ot(e.primitive),a=this.getDirect(e.start,t),l=s.cross(a);ne.lesseq(l,0)?i=!1:i=!0}else{let s=Ot(e.primitive),a=this.getDirect(e.start,t),l=s.cross(a);ne.greatereq(l,0)?i=!1:i=!0}return i}isObstacle(t,e,r){if(t.inPushPath(e))return!1;if(t.aroundType>=2){let i=xt.getInstance().getNode(t.item),n=xt.getInstance().getNode(e);if(t.inPushPath(n.parent))return!1;if(this.inObstacles(t,n))return!0;if(this.group!=null&&!this.inputEndpointCanModify)if(t.direction==0){let d=this.group.ccwObstaclesMap.get(n.parent);if(d!=null&&!this.group.sameDirect.get(n.parent)&&(d.has(e)||d.has(n.parent)))return!0}else{let d=this.group.cwObstaclesMap.get(n.parent);if(d!=null&&!this.group.sameDirect.get(n.parent)&&(d.has(e)||d.has(n.parent)))return!0}let s=Fr.getInstance().getStatus(i),a=Fr.getInstance().getStatus(n),l=this.getListNodePushDirect(i),c=this.getListNodePushDirect(n),h=l!=null&&this.notSpace(s),u=c!=null&&this.notSpace(a);if(u&&h&&l==c)return!1;if(u){let d=Ot(t.getPathPrimitive()),p=Ot(e.primitive),m=t.direction==1?new S(-d.y,d.x):new S(d.y,-d.x),g=c==le.CCW?new S(-p.y,p.x):new S(p.y,-p.x);return ne.greater(m.dot(g),0)?!1:this.isObstacle4CollidePoint(r,e)}else return!1}else if(t.aroundType==1&&t.obstacle instanceof yt&&this.directFilter.canShove(t.obstacle)){let i=xt.getInstance().getNode(t.obstacle),n=xt.getInstance().getNode(e);if(t.inPushPath(n.parent))return!1;if(this.inObstacles(t,n))return!0;if(this.group!=null&&!this.inputEndpointCanModify)if(t.direction==0){let m=this.group.ccwObstaclesMap.get(n.parent);if(m!=null&&!this.group.sameDirect.get(n.parent)&&(m.has(e)||m.has(n.parent)))return!0}else{let m=this.group.cwObstaclesMap.get(n.parent);if(m!=null&&!this.group.sameDirect.get(n.parent)&&(m.has(e)||m.has(n.parent)))return!0}let s=this.isReverse(i),a=this.isReverse(n);if(s&&!a)return!1;if(!s&&a)return!0;let l=Fr.getInstance().getStatus(i),c=Fr.getInstance().getStatus(n),h=this.getListNodePushDirect(i),u=this.getListNodePushDirect(n),d=h!=null&&this.notSpace(l),p=u!=null&&this.notSpace(c);if(d&&!p)return!1;if(d&&p){let m=Ot(t.obstacle.primitive),g=Ot(e.primitive);return this.isSameShoveDirect1(m,g,h,u)?!1:this.isObstacle4CollidePoint(r,e)}else{if(!d&&p)return lb(r,e.primitive)==u;if(u!=null){let g=Ot(t.obstacle.primitive),y=Ot(e.primitive);return this.isSameShoveDirect1(g,y,h,u)?!1:this.isObstacle4CollidePoint(r,e)}else return!1}}return!0}inObstacles(t,e){return t.obstacles.has(e.item)||t.obstacles.has(e.parent)}getCross(t,e){let r=Ot(t.primitive),i=this.getDirect(t.start,e);return r.cross(i)}getDirect(t,e){let r=e.sub(t);return Math.abs(r.x)<1e-8&&Math.abs(r.y)<1e-8?S.ORIGIN:r.normalize()}getHull(t,e){if(t.info!=null)return t.info.shape.getOutline(Ts);let r=t.clearance;return ll.convexHull(t.obstacle.getMathGraphics(t.layer2),r+e.width/2)}getObstacleList(t,e,r){var s;let{obstacle:i}=t;i instanceof lr&&(i.layerId==11||i.type=="Partition")&&(this.collidedCloseShape=!0);let n=this.obstacleMaps.get(t.info.shape);if(n==null){n=new On;let a=!0;i instanceof yt&&this.directFilter.canShove(i)&&!i.locked&&!Ps(i)&&i.getParent()==null&&(a=!1),this.obstacleMaps.set(t.info.shape,n);let l=t.info.shape.getOutline(Ts),c=a?2:1,h=i.locked||Ps(i)||i.getParent()!=null||i instanceof It||i instanceof Je||this.directFilter.obstacles.has(i),u=YSe(l.primitives);if((s=Nt.filter)!=null&&s.isPushTrack()){if(i instanceof Je){for(let g of l.primitives){let y=this.blockShape.blockPad(e,g);for(let b of y)Nt.pushFilter.addExclusionShape(b.obstacle)}let m=yc.getInstance().getNode(i);for(let[g]of m.connectTrack)Nt.pushFilter.addExclusionList(g)}else if(i instanceof It){let m=_i.getInstance().getViaNode(i);for(let[g]of m.connectTrack)Nt.pushFilter.addExclusionList(g)}}for(let m of l.primitives){let g=this.add(n,e,m);g.cloneStatus(r),g.status.change(),g.status.clearPushDirect(),g.source=!1,g.aroundType=c,g.obstacle=i,g.weight=u,g.status.isVertex=h}let d=n.getFirst(),p=n.getLast();d.node.prev=p.node,p.node.next=d.node}return n}inObstacleCloseShape(t,e){if(t instanceof lr&&t.type!="Slot Region"&&t.type!="Prohibited Region"){let r=t.getMathGraphics();if(r instanceof Jo){let l=this.trackList.getLast().item.end,c=r.items,h=Jr.inPolygon(e,c),u=Jr.inPolygon(l,c);return h&&u||!h&&!u}else if(r instanceof fe&&!r.isClose(.01))return!0;let i=this.trackList.getLast().item.end,n=r.asClose(),s=Jr.pointInPolyline(e,n),a=Jr.pointInPolyline(i,n);return s&&a||!s&&!a}return!0}getListNode(t){return xt.getInstance().getListNode(t)}getConnectList(t){let e=t.toArray(),r=e.map(c=>c.pt),i=e[0],n=i.item,s=i.obstacle,a=null;s instanceof Je?a=yc.getInstance().getNode(s):s instanceof It&&(a=_i.getInstance().getViaNode(s));let l=new bD;if(a!=null)for(let[c,h]of a.connectTrack){if(c.size()==0)continue;Nt.filter.addExclusionList(c);let u=l.getMin(r,n,c,h);for(let d=0;d<u.length;d++){let p=u[d],m=e[d];p&&m.addObstacles(c)}}}debugCollide(t,e,r){var i;if((i=this.debug)!=null&&i.debug){let{globalIndex:n,net:s,layerId:a,width:l}=e.item,c=new eo(e.getPathPrimitive(),{globalIndex:n,net:s,layerId:a,width:l,color:ee.Gray}),h=t.toArray(),u=[];for(let d of h){let p=new eo(d.getPathPrimitive(),{globalIndex:n,net:s,layerId:a,width:l,color:ee.Golden});u.push(p)}this.debug.add(new BF(c,u,[r]))}}debugTrack(t,e,r){var i;if((i=this.debug)!=null&&i.debug){let{globalIndex:n,net:s,layerId:a,width:l}=t;this.debug.add(new eo(e,{globalIndex:n,net:s,layerId:a,width:l,color:r}))}}add(t,e,r){let i=new Op(e,r),n=xt.getInstance().getNode(e);i.status=Fr.getInstance().getStatus(n).clone();let s=t.add(i);return i.node=s,i}insertAfter(t,e,r){let i=new Op(e,r),n=t.node.parent;if(t.node.prev==null&&t.node.next==null&&n.getFirst()!=t){let s=new RE(n,i);t.node.insertAfter(s),i.node=s}else{let s=n.insertAfter(t.node,i);i.node=s}return i}_findNeighborNodesAtPolygon(t,e,r){let i=r.point,n,s,a=this.trackList.getLast()==t,l=this.getBlockPointInfo(t,e,i);if(l==null){let y=this.getInters(t,e),b=e.getFirst(),[P,T]=this.replaceSource(t,y);return t.direction==1?(n=T,s=[P],P.P+=b.weight):(n=P,s=[T],T.P+=b.weight),{currentNode:n,neighborNodes:s}}let{isVertex:c}=l,h=l.location,[u,d]=this.replaceSource(t,i);if(t.direction==1?n=d:n=u,!c){let[y,b]=this.replaceSource(h,i);h=y}if(h.newDirection=1,h.next.newDirection=0,h.obstacle instanceof yt&&!h.obstacle.locked&&!Ps(h.obstacle)&&h.obstacle.getParent()==null)if(t.obstacle instanceof yt){let y=this.getListNode(h.obstacle),b=this.getListNode(t.obstacle);y.parent==b.parent||this.calculateSameListObstacles(h,t,a)}else this.calculateSameListObstacles(h,t,a);else if(h.obstacle instanceof Je||h.obstacle instanceof It){let y=this.getSolidNode(h.obstacle);this.calculateSolidObstacles(y,h,h.next)}let p=xt.getInstance().getNode(t.item),m=Fr.getInstance().getStatus(p),g=this.getListNodePushDirect(p);if(g!=null&&!this.hasConnectTrack(h)&&this.notSpace(m)&&(t.source||!t.source&&m.isVertex))g==le.CCW?h.next.P+=h.next.weight:h.P+=h.weight;else if(t.source){if(r.obstacle instanceof yt){let y=this.getListNode(r.obstacle);if(!this.group.sameDirect.get(y.parent)){let b=this.group.recommendDirect.get(y.parent);b==le.CCW?h.P+=h.weight:b==le.CW?h.next.P+=h.next.weight:this.directFilter.completes.has(y.parent)&&(g==le.CCW?h.P+=h.weight:g==le.CW&&(h.next.P+=h.next.weight))}}else if(r.obstacle instanceof Je||r.obstacle instanceof It){let y=this.getSolidNode(r.obstacle),b=null,P=!0;for(let[T]of y.connectTrack){let I=this.group.recommendDirect.get(T);if(I!=null){if(b==null)b=I;else if(b!=I){P=!1;break}}}P&&b!=null&&(b==le.CCW?h.P+=h.weight:b==le.CW&&(h.next.P+=h.next.weight))}}return t.source?s=Ju.getInstance().filter(this.filterPathError(h,h.next)):s=t.direction==h.newDirection?this.getNext(h):this.getNext(h.next),{currentNode:n,neighborNodes:s}}getNext(t){return t.pathError?[]:[t]}filterPathError(t,e){let r=new Array;return t.pathError||r.push(t),e.pathError||r.push(e),r}getSolidNode(t){return t instanceof Je?yc.getInstance().getNode(t):_i.getInstance().getViaNode(t)}hasConnectTrack(t){let e=t.obstacle;if(e!=null){let r=t.item.layerId;if(e instanceof Je||e instanceof It){let i=this.getSolidNode(e);for(let[n]of i.connectTrack)if(n.getFirst().layerId==r)return!0}}return!1}hasOtherConnectTrack(t){var r;let e=t.obstacle;if(e!=null&&((r=Nt.filter)!=null&&r.isPushTrack())){let i=t.item.layerId;if(e instanceof Je||e instanceof It){let n=this.getSolidNode(e);for(let[s]of n.connectTrack)if(s.getFirst().layerId==i&&!this.directFilter.canShovePath.has(s))return!0}}return!1}notSpace(t){return t!=null&&t.isVertex}isReverse(t){return Fr.getInstance().getStatus(t).isReversePush}getListLength(t){let e=t.iterator(),r=0;for(;e.hasNext();)r+=e.next().length;return r}calculateSameListObstacles(t,e,r){var u,d,p,m,g;if(!(t.obstacle instanceof yt))return;let i=this.getListNode(t.obstacle);if(e.obstacles.has(i.parent))return;let n=i.parent;if(Nt.pushFilter.addExclusionList(n),this.group!=null){let y=this.group.cwObstaclesMap.get(n),b=this.group.ccwObstaclesMap.get(n);if(y!=null&&b!=null){t.addAllObstacle(y),t.next.addAllObstacle(b);let P=this.endpointIsFix(n);r&&this.lastPushDirect!=null&&hg(t.obstacle.primitive,t.pt.end(),(d=(u=i.prev)==null?void 0:u.item)==null?void 0:d.primitive,(m=(p=i.next)==null?void 0:p.item)==null?void 0:m.primitive)!=this.lastPushDirect&&(y.clear(),b.clear());let T=this.getListLength(n);if(y.has(n)&&(P&&T>200?t.pathError=!0:t.P=T),b.has(n)&&(P&&T>200?t.next.pathError=!0:t.next.P=T),this.isWire&&Fr.getInstance().getStatus(i).isInput&&!t.pathError&&!t.next.pathError){let E=n.getLast(),O=y.has(E),_=b.has(E);O!=_&&(O&&(t.next.P=this.getListLength(n)),_&&(t.P=this.getListLength(n)))}let I=this.group.cwPushMap.get(n),C=this.group.ccwPushMap.get(n);if(I!=null)for(let E of I)t.addPushPath(E);if(C!=null)for(let E of C)t.next.addPushPath(E);return}}let s=new bD(n);s.calculateEndCollide(this.trackList.toArray().map(y=>y.item));let a=t.pt.end(),l=s.getSweep(t.obstacle,a);if(s.endNode!=null){let y=s.endNode,b;y instanceof It?((g=n.viaNode.prev)==null?void 0:g.item)==y?b=!0:b=!1:n.otherNode.prev==y?b=!0:b=!1;let P=this.group.getCache(y,b,!1,t.obstacle,a);t.addAllObstacle(P.cw),t.next.addAllObstacle(P.ccw);return}else if(s.end==null){let b=this.trackList.getLast().end,P=new pb(n.toArray().map(C=>C.primitive),b),T=P.calculateDirect();s.sweep=T;let I=P.index;I>=0&&(s.end=s.tracks[I],s.point=b)}let c=le.CCW,h;if(s.getObstaclesIndex(i),s.startIndex<s.endIndex?h=l:s.startIndex==s.endIndex?s.increase(a)?h=l:h=l==le.CCW?le.CW:le.CCW:h=l==le.CCW?le.CW:le.CCW,s.sweep==l){let y=s.getObstacles4Same(i),b=new Set(n.toArray());for(let T of y)b.delete(T);let P=this.endpointIsFix(n);if(c==h){t.addAllObstacle(y);for(let T of b)t.addPushPath(T);t.next.addObstacles(n),P?t.next.pathError=!0:t.next.P=this.getListLength(n)}else{t.next.addAllObstacle(y);for(let T of b)t.next.addPushPath(T);t.addObstacles(n),P?t.pathError=!0:t.P=this.getListLength(n)}}else{let y=lb(a,t.obstacle.primitive),b=c==y,P=s.getObstacles4Other(i,b),T=s.getObstacles4Other(i,!b);t.addAllObstacle(P),t.next.addAllObstacle(T)}}calculateSolidObstacles(t,e,r){if(this.group!=null)for(let[i]of t.connectTrack){if(i.size()==0)continue;let n=this.group.cwObstaclesMap.get(i),s=this.group.ccwObstaclesMap.get(i);if(n!=null&&s!=null){let a=this.endpointIsFix(i),l=this.getListLength(i);n.has(i)&&(a&&l>200?e.pathError=!0:e.P=l),s.has(i)&&(a&&l>200?r.pathError=!0:r.P=l),e.addAllObstacle(n),r.addAllObstacle(s);let c=this.group.cwPushMap.get(i),h=this.group.ccwPushMap.get(i);if(c!=null)for(let u of c)e.addPushPath(u);if(h!=null)for(let u of h)r.addPushPath(u)}else i.getFirst().layerId==e.item.layerId&&!this.inputEndpointCanModify&&this.endpointIsFix(i)&&(e.addObstacles(i),r.addObstacles(i),Nt.pushFilter.addExclusionList(i))}}getInters(t,e){let r=t.getPathPrimitive(),i=e.getFirst(),n=i,s=new Array;do{let a=i.pt;if(r.bbox().intersection1(a.bbox())!=null){let l=Tt(r,a);this.addInterdebug(r,a,l);for(let c=0;c<l;c+=2){let h=new S(Ee[c],Ee[c+1]);!h.equals1(r.start())&&!h.equals1(r.end())&&s.push(h)}}i=i.next}while(i!=null&&i!=n);return dn(s,r),s.length==0?r.end():s[0]}getBlockPointInfo(t,e,r){let i=t.getPathPrimitive(),n=i.bbox().extendOfSize(.1),s=e.getFirst(),a=s,l=r.bbox().extendOfSize(.1);do{let h=s.pt;if(n.intersection1(h.bbox())!=null&&l.intersection1(h.bbox())!=null){let u=Tt(i,h);this.addInterdebug(i,h,u);for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);if(p.equals1(r)&&!p.equals1(h.start())){let m={location:s,isVertex:void 0};return p.equals1(h.end())?m.isVertex=!0:m.isVertex=!1,s==a&&r.equals1(h.start())&&(m.location=s.prev,m.isVertex=!0),m}}}s=s.next}while(s!=null&&s!=a);if(r.equals1(i.start())){let h=new M(r,r);s=e.getFirst(),a=s;do{let u=s.pt;if(n.intersection1(u.bbox())!=null&&l.intersection1(u.bbox())!=null&&new ir(h,u).getDistance()<=.01){let p={location:s,isVertex:void 0};return r.equals1(u.end())?p.isVertex=!0:p.isVertex=!1,s==a&&r.equals1(u.start())&&(p.location=s.prev,p.isVertex=!0),p}s=s.next}while(s!=null&&s!=a)}return null}_findNeighborNodesAtTrack(t,e,r,i,n){let s=t.getPathPrimitive(),a=e.getPathPrimitive(),c=r.point.bbox().extendOfSize(.1);if(ne.eq(a.length(),0)||!s.bbox().extendOfSize(.01).isIntersect(a.bbox().extendOfSize(.01))||c.intersection1(a.bbox())==null)return null;let h=Tt(s,a);this.addInterdebug(s,a,h);let u=null;if(h>0)if(s instanceof M&&a instanceof M&&s.isParallel(a)||s instanceof q&&a instanceof q&&s.center.equals1(a.center)&&s.rx===a.rx){let m=[];for(let g=0;g<h;g+=2){let y=new S(Ee[g],Ee[g+1]);s.start().equals1(y)||m.push(y)}dn(m,s),u=m[0]}else{let m=[];for(let g=0;g<h;g+=2){let y=new S(Ee[g],Ee[g+1]);!y.equals1(s.start())&&y.equals1(r.point)&&m.push(y)}for(let g of m){let y=Ot(s,g),b=Ot(a,g);if((g.equals1(this.trackList.getLast().end)||!a.end().equals1(g)||!i)&&(t.direction===0&&(t.source||!t.source&&y.cross(b)<0)||t.direction===1&&(t.source||!t.source&&y.cross(b)>0)||t.source||!t.source&&(s instanceof q||a instanceof q))&&(u=g),u!=null)break}}else s instanceof M&&eoe(s,a.end())&&(u=a.end());let d=!1,p=t.weight;if(u!=null){let m=t.item;for(let g of n){let y=g.obstacle;if(y instanceof yt&&y.net!=m.net&&y.layerId==m.layerId){let b=this.getHull(g,m);if(!Jr.inEdge4Polyline(u,b,.006)&&Jr.pointInPolyline(u,b)){if(d=!0,p+=YSe(b.primitives),t.obstacle!=null&&t.obstacle instanceof yt){let P=this.getListNode(t.obstacle),T=this.getListNode(y);P.parent==T.parent&&(u=null)}break}}}}if(u!=null){let m,g;if(u.equals1(t.pt.start())||u.equals1(t.pt.end())){if(t.direction==0){if(m=t,g=t.next,g==null){let[b,P]=this.replaceSource(t,u);m=b,g=P}}else if(m=t.prev,g=t,m==null){let[b,P]=this.replaceSource(t,u);m=b,g=P}m.newDirection=t.direction,g.newDirection=t.direction}else{let[b,P]=this.replaceSource(t,u);b.newDirection=t.direction,P.newDirection=t.direction,m=b,g=P}let y;if(e.pt.start().equals1(u))y=e;else{let b=null;if(e.pt.end().equals1(u)&&(b=e.next),b==null){let[P,T]=this.replaceSource(e,u);y=T}else y=b}if(y!=null&&(y.newDirection=e.direction),t.direction==1){let b=e.direction==0?y.pt:y.pt.reverse(),P=m.newDirection==0?m.pt:m.pt.reverse(),T=y.pt instanceof q||m.pt instanceof q;d&&(y.P+=p,m.P+=p/2);let I=Ot(b),C=Ot(P);return!m.source&&C.cross(I)<-.01&&!T?{currentNode:g,neighborNodes:[m]}:{currentNode:g,neighborNodes:[y]}}else{let b=e.direction==0?y.pt:y.pt.reverse(),P=g.newDirection==0?g.pt:g.pt.reverse(),T=y.pt instanceof q||g.pt instanceof q;d&&(y.P+=p,g.P+=p/2);let I=Ot(b),C=Ot(P);return!g.source&&C.cross(I)>.01&&!T?{currentNode:m,neighborNodes:[g]}:{currentNode:m,neighborNodes:[y]}}}else return null}isValid4SameTrack(t,e,r){if(t.startSource==e){let n=[t.startSourceNode.end,r];return dn(n,e.primitive),n[0]!=r}return!0}isValidSameNet(t,e,r){let i=t.getPathPrimitive();if(i instanceof M&&e instanceof M&&i.isParallel(e)||i instanceof q&&e instanceof q&&i.center.equals1(e.center)&&i.rx===e.rx)return!0;{let n=Ot(i,r),s=Ot(e,r);if(t.direction===0&&(t.source||!t.source&&n.cross(s)<0))return!0;if(t.direction===1&&(t.source||!t.source&&n.cross(s)>0))return!0;if(t.source||!t.source&&(i instanceof q||e instanceof q))return!0}return!1}replaceSource(t,e){let r=t.item,i=this.splitPt(t.pt,e),n=this.insertAfter(t,r,i[0]),s=this.insertAfter(n,r,i[1]),a=t.node,l=a.parent;if(l.remove(a),n.pt.length()<1e-8&&l.remove(n.node),s.pt.length()<1e-8&&l.remove(s.node),a.prev=null,a.next=null,n.sycnDirect(t),s.sycnDirect(t),n.status.notChange=!1,s.status.notChange=!1,t.source){let c=this.sourceMaps.get(r);if(c!=null){let h=c.indexOf(t);h>=0&&c.splice(h,1,n,s)}}return[n,s]}addInterdebug(t,e,r){var i;if((i=this.debug)!=null&&i.debug){let n=new FF(new eo(t,{color:ee.WHITE}),new eo(e,{color:ee.WHITE}),r);this.debug.add(n)}}endpointCanModify(t){let e=this.getListNode(t),r=e.parent;if(e.next==null){if(r.otherNode.next==null&&(r.viaNode.next==null||r.viaNode.next!=null&&!r.viaNode.next.isSource))return!0;if(this.isWire&&Fr.getInstance().getStatus(e).isInput)return!0}return!this.isWire&&r.getFirst()==this.trackList.getFirst().item&&r.otherNode.prev==null&&(r.viaNode.prev==null||r.viaNode.prev!=null&&!r.viaNode.prev.isSource)}splitPt(t,e){if(t instanceof q){if(Math.abs(t.sweepAngle)===360){let n=t.center.sub(e).mul(2).add(e),s=q.build4(n,e,t.center,t.rx,t.rx,t.sweep()),a=q.build4(e,n,t.center,t.rx,t.rx,t.sweep());return[s,a]}let r=q.build4(t.start(),e,t.center,t.rx,t.rx,t.sweep()),i=q.build4(e,t.end(),t.center,t.rx,t.rx,t.sweep());return r.start().equals1(r.end())&&(r=new M(t.start(),e)),i.start().equals1(i.end())&&(i=new M(e,t.end())),[r,i]}else return[new M(t.start(),e),new M(e,t.end())]}search(t,e,r){return this.blockShape.blockTrackPrimitive(t,e,r)}};var PC=class{constructor(t,e,r,i,n=null){this.lists=[];this.level=e,this.direct=r;for(let s of t)this.lists.push(s);this.endTime=i,this.layerIds=n}optimize(t=!1){Nt.setPushFilter(),Nt.pushFilter.setAroundMode();let e=new Br("super optimize"),r=!1;for(;;){r=!1;let i=new o9(this.endTime-performance.now());i.level=this.level,i.isWire=t;for(let n of this.lists){hi.getInstance().update();let s=new Br,a=this.getChangeTracks(n);a.length&&(Nt.pushFilter.setNet(a[0].net,new Set(a)),this.layerIds!=null?this.layerIds.has(a[0].layerId)?i.direct=this.direct:i.direct=S.ORIGIN:i.direct=this.direct,i.optimize(a,s)),s.length>0&&(e.addCommand(s),r=!0),Nt.pushFilter.setNet(null,null)}if(r)this.lists.reverse();else break}return e}isChangeTrack(t){let e=Fr.getInstance().getStatus(t);return e.isInput||!e.notChange}getChangeTracks(t){let e=t.getFirstNode(),r=t.getLastNode();for(;e!=null;){if(this.isChangeTrack(e)){e.prev!=null&&!Fr.getInstance().getStatus(e).notChange&&(e=e.prev);break}if(e=e.next,e==r)break}for(;r!=null;){if(this.isChangeTrack(r)){r.next!=null&&!Fr.getInstance().getStatus(r).notChange&&(r=r.next);break}if(r=r.prev,e==r)break}let i=e,n=[];for(;i!=null&&(n.push(i.item),i!=r);)i=i.next;return n}};var s9=class{constructor(t){this.rtree=new x0(10);this.map=new Map;this.blockShape=new As;let e=0;for(let r of t)this.rtree.insert(new s0(r)),this.map.set(r,e++)}getShoveTracks(t,e){if(t==null||t.length==0)return;let r=new Set;for(let l of t){let c=this.search(l);for(let h of c)h.source instanceof yt&&r.add(h.source)}let i=Number.MAX_VALUE,n=-1,s=null,a=null;for(let l of r){let c=this.map.get(l);c<i&&(s=l,i=c),c>n&&(a=l,n=c)}if(s!=null&&a!=null){let l=xt.getInstance().getListNode(s);for(;l!=null&&(e.awaitShove.add(l.item),l.item!=a);)l=l.next}}getViaShoveTracks(t,e){let r=new Set,i=this.search4Via(t);for(let c of i)c.obstacle instanceof yt&&r.add(c.obstacle);let n=Number.MAX_VALUE,s=-1,a=null,l=null;for(let c of r){let h=this.map.get(c);h<n&&(a=c,n=h),h>s&&(l=c,s=h)}if(a!=null&&l!=null){let c=xt.getInstance().getListNode(a);for(;c!=null&&(e.add(c.item),c.item!=l);)c=c.next}}getShoveTracks4Order(t,e,r){if(t==null||t.length==0)return;let i=new Set;for(let c of t){let h=this.search(c);for(let u of h)u.source instanceof yt&&i.add(u.source)}let n=Number.MAX_VALUE,s=-1,a=null,l=null;for(let c of i){let h=this.map.get(c);h<n&&(a=c,n=h),h>s&&(l=c,s=h)}if(a!=null&&l!=null&&this.has(e,a,l)){let c=xt.getInstance().getListNode(a);for(;c!=null&&(r.add(c.item),Fr.getInstance().setOrder(c,e),c.item!=l);)c=c.next}}getViaShoveTracks4Order(t,e,r){let i=new Set,n=this.search4Via(t);for(let h of n)h.obstacle instanceof yt&&i.add(h.obstacle);let s=Number.MAX_VALUE,a=-1,l=null,c=null;for(let h of i){let u=this.map.get(h);u<s&&(l=h,s=u),u>a&&(c=h,a=u)}if(l!=null&&c!=null&&this.has(e,l,c)){let h=xt.getInstance().getListNode(l);for(;h!=null&&(r.add(h.item),Fr.getInstance().setOrder(h,e),h.item!=c);)h=h.next}}has(t,e,r){let i=xt.getInstance().getListNode(e);if(i.prev!=null&&Fr.getInstance().getStatus(i.prev).collideOrder==t)return!0;let n=!1;for(;i!=null;){if(Fr.getInstance().getStatus(i).collideOrder==t){n=!0;break}if(i.item==r)break;i=i.next}return!n&&i.next!=null&&Fr.getInstance().getStatus(i.next).collideOrder==t?!0:n}search(t){let e=this.blockShape.clearanceUtils.getMaxTrackClearance(),r=t.buildBBox().extendOfSize(e),i=this.rtree.search(r),n=[];for(let a of i)n.push(a.model);let s=new _d(n);return this.blockShape.blockOtherTrack(t,s)}search4Via(t){let e=this.blockShape.clearanceUtils.getMaxTrackClearance(),r=t.buildBBox().extendOfSize(e),i=this.rtree.search(r),n=[];for(let a of i)n.push(a.model);let s=new _d(n);return this.blockShape.blockViaPoint4Shapes(t,s)}checkViaCollide4Tracks(t,e,r){this.blockShape.pair1.sycnRule1(t.item),this.blockShape.pair1.sycnRule2(t.item,!0);for(let i of e){let n=this.blockShape.pair2.sycnRule1(i),s=this.blockShape.clearanceUtils.getSafeClearance(this.blockShape.pair1.rule1,n,i,i.layerId);if(ne.eq(s,0))continue;if(kh.check(i.primitive,i.layerId,i,t.item,s).collide){r.add(t);return}}}};var Yoe=class{constructor(t,e,r,i){this.clearanceUtils=new Ep;this.manager=Os.getInstance();this.rulePair1=new uP;this.rulePair2=new uP;this.fix=!1;this.shape=t,this.source=e,this.point=r,this.pointOnlyNoneDrc=i,this.rulePair1.sycnRule1(t),t instanceof It&&this.rulePair1.sycnRule2(t,!0)}getShapeSize(){return this.shape instanceof It?Math.max(this.shape.radius,this.shape.holeRadius):this.shape.width/2}getRes(){return this.inOutline(this.source,this.point)}checkOut(){let e=te.getInstance().getMaxSafe(),r=this.getShapeSize(),i=new _e;i.ext2(this.source).ext2(this.point);let n=i.ext7(r+e).build(),s=Nt.searchOutline(n);for(let a of s)if(this.needFix1(a,this.source,this.point))return!0;return!1}inOutline(t,e){let i=te.getInstance().getMaxSafe(),n=this.getShapeSize(),s=0;do{this.fix=!1;let a=new _e;a.ext2(t).ext2(e);let l=a.ext7(n+i).build(),c=Nt.searchOutline(l);for(let h of c)e=this.needFix(h,t,e);s++}while(this.fix&&s<20);return e}needFix1(t,e,r){if(!this.needCheck(t))return!1;let i=t.getMathGraphics();if(!i.isClose(.01))return!1;switch(t.type){case"Line":{if(this.shape instanceof It){this.rulePair2.sycnRule1(t);let l=this.inHull(r,this.rulePair1.rule1,this.rulePair2.rule1,t,t.layerId,this.shape.radius);if(l!=null||(l=this.inHull(r,this.rulePair1.rule2,this.rulePair2.rule1,t,t.layerId,this.shape.holeRadius),l!=null))return!0}else if(this.rulePair2.sycnRule1(t),this.inHull(r,this.rulePair1.rule1,this.rulePair2.rule1,t,t.layerId,this.shape.width/2)!=null)return!0;break}case"Partition":{let l=e,c=this.manager.getModelObstacle(t,1e-4,t.layerId);if(t.type=="Partition"&&this.shape.partition==t.globalIndex&&(Jr.pointInPolyline(l,i)||(l=i.bbox().center())),c.outline.getPointInOutline(r,Ts)!=null)return!0;break}}let n=i.asClose(),s=Jr.pointInPolyline(e,n),a=Jr.pointInPolyline(r,n);return t.type=="Partition"&&this.shape.partition==t.globalIndex&&a?!1:!this.pointOnlyNoneDrc&&s!=a}needFix(t,e,r){if(!this.needCheck(t))return r;let i=t.getMathGraphics();if(!i.isClose(.01))return r;switch(t.type){case"Line":{if(this.shape instanceof It){this.rulePair2.sycnRule1(t);let n=this.inHull(r,this.rulePair1.rule1,this.rulePair2.rule1,t,t.layerId,this.shape.radius);n!=null&&(r=this.getResult(n,e,r)),n=this.inHull(r,this.rulePair1.rule2,this.rulePair2.rule1,t,t.layerId,this.shape.holeRadius),n!=null&&(r=this.getResult(n,e,r))}else{this.rulePair2.sycnRule1(t);let n=this.inHull(r,this.rulePair1.rule1,this.rulePair2.rule1,t,t.layerId,this.shape.width/2);n!=null&&(r=this.getResult(n,e,r))}break}case"Partition":{let n=e,s=this.manager.getModelObstacle(t,1e-4,t.layerId);t.type=="Partition"&&this.shape.partition==t.globalIndex&&(Jr.pointInPolyline(n,i)||(n=i.bbox().center()));let a=s.outline.getPointInOutline(r,Ts);a!=null&&(r=this.getResult(a,n,r));break}}if(!this.fix){let n=i.asClose(),s=Jr.pointInPolyline(e,n),a=Jr.pointInPolyline(r,n);if(t.type=="Partition"&&this.shape.partition==t.globalIndex&&a)return r;if(!this.pointOnlyNoneDrc&&s!=a)return this.getResult(i,e,r)}return r}needCheck(t){switch(t.type){case"Line":return this.shape instanceof yt?(t.layerId==this.shape.layerId||t.layerId==11)&&t.net!=this.shape.net:(this.shape.isContains(t.layerId)||t.layerId==11)&&t.net!=this.shape.net;case"Partition":return!0}}inHull(t,e,r,i,n,s){let a=this.clearanceUtils.getSafeClearance(e,r,i,n);return ne.eq(a,0)?null:this.manager.getModelObstacle(i,a+s,n).outline.getPointInOutline(t,Ts)}getResult(t,e,r){let i=new M(e,r),n=new Array;for(let s of t.primitives){if(s.bbox().isSeparated(i.bbox()))continue;let a=Tt(i,s);for(let l=0;l<a;l+=2){let c=new S(Ee[l],Ee[l+1]);n.push({pt:s,point:c})}}if(n.length>0){J0(n,i);let s=n[0],l=new ir(s.pt,new M(r,r)).getLine();return this.fix=!0,l.start().equals1(r)?l.end():l.end().equals1(r)?l.start():r}else return r}};var SOt=Array();for(let o=-1;o<=1;o++)for(let t=-1;t<=1;t++)o==0&&t==0||SOt.push(new S(o,t).normalize());var p_=class{constructor(t,e,r,i,n=new Set){this.manager=Os.getInstance();this.clearanceUtils=new Ep;this.block=new As;this.points=new Array;this.found=new Map;this.obstacles=new Set;this.success=!0;this.timeout=i,this.via=t.item,this.command=e,this.obstacles=n,this.directFilter=r,this.directFilter.awaitShove.has(t)&&(this.directFilter.awaitShove.delete(t),this.directFilter.awaitingVias.add(t))}init(t,e){let r=lX(t);for(let i of r)e!=null&&i.intersection(this.found.get(i.dir),e),this.points.push(i)}getDistination(t){let e=new Array;for(let i of this.points)i.valid&&(e.push(i),this.found.set(i.dir,new Ba));let r=null;for(;performance.now()<this.timeout;){r!=null&&e.push(r),e=e.sort((n,s)=>n.dis-s.dis);let i=new Array;for(let n=0;n<e.length;n++){let s=e[n];if(this.search(s),!s.needContinue&&s.valid){r=s;break}else s.valid&&i.push(s)}if(e=i,e.length==0)return r!=null?(this.success=!0,r):(this.success=!1,t)}return this.success=!1,t}offset4Points(t,e,r){let i=this.get4Points(t,e);this.change(i,r)}offset(){let t=this.getOffset();this.change(t,[])}get4Points(t,e){for(let i of e)this.points.push(i);let r=this.getDistination(t);return this.sycnShoveInfo(r),r.point}sycnShoveInfo(t){if(this.success&&t!=null)for(let e of t.pushItems)e instanceof yt?this.directFilter.awaitShove.add(e):this.directFilter.awaitShove.add(_i.getInstance().getNode(e))}getOffset(){let t=Es.getInstance().getFirstPosition(this.via),e=this.inOutline(t,this.via.center),r=new X6(e,S.ORIGIN,0,!0);if(this.search(r),!r.needContinue)return this.success=!0,r.point;this.init(r.point);let i=this.getDistination(r);return this.sycnShoveInfo(i),i.point}checkShove(t){let e=this.block.blockViaPoint(t);for(let r of e){let i=r.obstacle;i instanceof It&&this.directFilter.canShoveViaModel(i)&&this.directFilter.awaitShove.add(_i.getInstance().getViaNode(i))}}change(t,e){iV(this.via,t,this.command,e)}inHull(t,e,r,i,n,s){let a=this.clearanceUtils.getSafeClearance(e,r,i,n);if(ne.eq(a,0))return!1;let l=s?this.via.holeRadius:this.via.radius,h=this.manager.getModelObstacle(i,a+l,n).outline.getPointInOutline(t.point,Ts);return h!=null?(t.setObstacle(this.found.get(t.dir),h,!0),!0):!1}inShoveHull(t,e,r,i,n,s){let a=this.clearanceUtils.getSafeClearance(e,r,i,n);if(ne.eq(a,0))return!1;let l=s?this.via.holeRadius:this.via.radius,h=this.manager.getModelObstacle(i,a+l,n).outline.getPointInOutline(t.point,Ts);return h!=null&&this.isObstacle(i,t)?(t.setObstacle(this.found.get(t.dir),h,!0),!0):!1}search(t){t.needContinue=!1;let e=t.point,i=te.getInstance().getMaxSafe(),n=Math.max(this.via.radius,this.via.holeRadius),s=e.bbox().extendOfSize(n+i),a=Nt.search1(s),l=_a(this.via),c=_a(this.via);c.shapeType=12;for(let h of a.tracks)if(this.via.isContains(h.layerId)&&h.net!=this.via.net){let u=_a(h);if(this.inShoveHull(t,l,u,h,h.layerId,!1)||this.inShoveHull(t,c,u,h,h.layerId,!0))return}for(let h of a.pads)if(h.net!=this.via.net&&(this.via.isContains(h.layerId)||h.layerId==12)){let u=_a(h),d=_a(h);d.shapeType=12;let p=h.layerId==12,m=p?$e.getInstance().getAllCopperLayerIds():[h.layerId];for(let g of m)if(!h.isUnuseLayer(g)&&this.via.isContains(g)&&(this.inHull(t,l,u,h,g,!1)||p&&this.inHull(t,l,d,h,12,!1)))return;if(p){for(let g of m)if(!h.isUnuseLayer(g)&&this.via.isContains(g)&&this.inHull(t,c,u,h,g,!0))return}}for(let h of a.vias){let u=_a(h),d=_a(h);if(d.shapeType=12,h.net!=this.via.net&&!h.isSeparated(this.via)&&(!h.isUnuseLayer(this.via.startLayer)&&(this.inShoveHull(t,l,u,h,this.via.startLayer,!1)||this.inShoveHull(t,l,d,h,12,!1))||h.layerId==12&&this.inShoveHull(t,c,u,h,12,!0)))return}for(let h of a.profiles)switch(h.type){case"TearDrop":case"Fill Region":{let d=h.net!=this.via.net,p=h.component;if(p instanceof ln&&p.isBridgingCopper){let m=p.networkList;m.length==0&&this.via.net==""||m.length==1&&this.via.net==m[0]?d=!1:d=!0}if(this.via.isContains(h.layerId)&&d){let m=_a(h);if(this.inHull(t,l,m,h,h.layerId,!1)||this.inHull(t,c,m,h,h.layerId,!0))return}break}case"Slot Region":{let d=_a(h);if(this.inHull(t,l,d,h,h.layerId,!1)||this.inHull(t,l,d,h,h.layerId,!0))return;break}case"Line":{if((this.via.isContains(h.layerId)||h.layerId==11)&&h.net!=this.via.net){let d=_a(h);if(this.inHull(t,l,d,h,h.layerId,!1)||this.inHull(t,l,d,h,h.layerId,!0))return}break}case"Board Outline":{let d=_a(h);if(this.inHull(t,l,d,h,h.layerId,!1)){let p=Es.getInstance().getFirstPosition(this.via),m=this.inOutline(p,t.point);t.point.equals1(m)||(t.valid=!1);return}if(this.inHull(t,l,d,h,h.layerId,!0)){let p=Es.getInstance().getFirstPosition(this.via),m=this.inOutline(p,t.point);t.point.equals1(m)||(t.valid=!1);return}break}case"Prohibited Region":{if(this.via.isContains(h.layerId)||h.layerId==12){let d=h.component,p=1e-4;if(d.track){let g=this.manager.getModelObstacle(h,n+p,h.layerId).outline.getPointInOutline(e,Ts);if(g!=null){t.setObstacle(this.found.get(t.dir),g,!0);return}}}break}case"Partition":{let p=this.manager.getModelObstacle(h,1e-4,h.layerId).outline.getPointInOutline(t.point,Ts);if(p!=null){t.setObstacle(this.found.get(t.dir),p,!0);let m=Es.getInstance().getFirstPosition(this.via),g=this.inOutline(m,t.point);t.point.equals1(g)||(t.valid=!1);return}break}}for(let h of a.imageTexts)if(this.via.isContains(h.layerId)){let u=_a(h);if(this.inHull(t,l,u,h,h.layerId,!1)||this.inHull(t,l,u,h,h.layerId,!0))return}return null}isObstacle(t,e){var r,i,n,s;if(t instanceof yt){let a=xt.getInstance().getNode(t);if(this.obstacles.has(a.parent))return!0;if(this.directFilter.canShove(t)&&!t.locked&&!Ps(t)&&t.getParent()==null){let l=this.getListNodePushDirect(a);if(l==null||e.pushItems.has(t))return e.pushItems.add(t),!1;{let c=hg(t.primitive,e.point,(i=(r=a.prev)==null?void 0:r.item)==null?void 0:i.primitive,(s=(n=a.next)==null?void 0:n.item)==null?void 0:s.primitive);if(c!=null&&c==l)return!0;let h=Ot(t.primitive),u=l==le.CCW?new S(-h.y,h.x):new S(h.y,-h.x);return e.dir.dot(u)>0?(e.pushItems.add(t),!1):!0}}}else if(this.directFilter.canShoveViaModel(t)){let a=Es.getInstance().getFirstPosition(t),l=Es.getInstance().getFirstPosition(this.via),c=t.center.sub(a).normalize(),h=e.dir;if(c.dot(h)>.99){let d=a.sub(l);return h.dot(d)>0?(e.pushItems.add(t),!1):!0}}return!0}getListNodePushDirect(t){return Fr.getInstance().getStatus(t).pushDirect}inOutline(t,e){return new Yoe(this.via,t,e,!1).getRes()}};var SX=class{constructor(t,e){this.blockShape=new As;this.cnt=0;this.inputLevel="WEAK";this.isWire=!1;this.interrupt=!1;this.lists=t,this.command=new Br("shove"),this.timeout=e,this.endTime=performance.now()+this.timeout}initShoveEnvironment(){Ju.getInstance().clear(),hi.getInstance().update(),t9.getInstance().clear()}shoveMain(){if(this.initShoveEnvironment(),this.shoveIterators(this.lists),!(performance.now()>this.endTime||this.interrupt)){if(this.inputLevel=="SUPER"||this.inputLevel=="STRONG"){if(this.isWire&&this.inputLevel=="SUPER"&&this.hasDiffPairAndNotChange())return;let t=new Array;for(let i of this.lists)i instanceof Kn&&t.push(i);let r=new PC(t,this.inputLevel,this.direct,this.endTime).optimize();this.add2Commands(this.command,r)}}}hasDiffPairAndNotChange(){let t=new Set;for(let e of this.lists)if(e instanceof Kn){let r=e.listIterator();for(;r.hasNext();){let n=r.next(),s=Fr.getInstance().getStatus(n);if(s.isInput&&!s.notChange)return!1}let i=e.getFirst();t.add(i.net)}return this.blockShape.clearanceUtils.hasDiffPair(t)}shoveIterators(t){let e=this.aroundSolid(t);this.add2Commands(this.command,e)}isChangeViaNode(t){return!t.isSource}aroundSolid(t){let e=new Br("aroundSolid"),r=0,i=Array.from(t),n=this.getAwaitShoveTracks(t);Nt.useShoveTree=!1;do{let s=new Br;this.setFilter4Solid(i);let a=this.initAroundPath(i);Re.addAllSet(a.awaitShove,n),n.clear();let{success:l,command:c}=this.aroundObstacles(i,a);if(l||r>=2?(this.add2Commands(s,c),this.addAroundCommand(s)):(c.undo(),Ju.getInstance().undo()),Nt.pushFilter.setNet(null,null),hi.getInstance().update(),this.add2Commands(e,s),r++,this.filterAwaitShoveItem(a.awaitShove),a.awaitShove.size==0&&l||r>=8)break;Re.addAllSet(n,a.awaitShove),i=i.reverse()}while(this.endTime>performance.now()&&!this.interrupt);return e}getAwaitShoveTracks(t){let e=new Set;for(let r of t)if(r instanceof Kn){let i=this.getChangeTracks(r);Re.addAllSet(e,i),r.viaNode.prev!=null&&this.isChangeViaNode(r.viaNode.prev)&&e.add(r.viaNode.prev),r.viaNode.next!=null&&this.isChangeViaNode(r.viaNode.next)&&e.add(r.viaNode.next)}else e.add(r);return e}getChangeTracks(t){let e=t.getFirstNode(),r=t.getLastNode();for(;e!=null&&!this.isChangeNode(e);)e=e.next;if(e==null)return[];for(;r!=null&&!(this.isChangeNode(r)||(r=r.prev,e==r)););let i=e,n=[];for(;i!=null&&(n.push(i.item),i!=r);)i=i.next;return n}isChangeNode(t){let e=Fr.getInstance().getStatus(t);return!e.checkDRC&&(e.isInput||!e.notChange)}filterAwaitShoveItem(t){let e=Array.from(t);for(let r of e)if(r instanceof yt){let i=xt.getInstance().getNode(r);i!=null&&i.ignore&&t.delete(r)}}setFilter4Solid(t){Nt.setPushFilter(),Nt.pushFilter.setAroundMode();for(let e of t)Nt.pushFilter.addWaitList(e)}getNode(t){let e=xt.getInstance().getNode(t);return e!=null&&e.ignore||e==null&&(new ku(t).generateList(),e=xt.getInstance().getNode(t)),e}aroundObstacles(t,e){hi.getInstance().update();let r=new o9(this.endTime-performance.now());r.direct=this.direct;let i=new Br("aroundObstacles"),n=!0,s=Array.from(t);for(e.completes.clear();s.length>0&&!this.interrupt&&this.endTime>performance.now();){e.awaitingVias.clear();let a=s.shift(),l=new Br;if(hi.getInstance().update(),Nt.pushFilter.addAroundList(a),a instanceof Kn){e.completes.add(a);let c=this.getAroundTracks(a,e,l);Nt.pushFilter.setNet(a.getFirst().net,new Set(c));let h;try{h=this.around(c,a,r,l,e)}catch(u){console.log(u),r.success=!1}if(Nt.pushFilter.setNet(null,null),!r.inputEndpointCanModify&&!r.success){if(l.undo(),Ju.getInstance().undo(),this.isWire&&this.lists.includes(a)){let u=a.getLastNode(),d=Fr.getInstance().getStatus(u);d.checkDRC=!1}this.add2AwaitShove(c,e),l=new Br}else{if(r.inputEndpointCanModify&&!r.success&&a.viaNode.next!=null&&h.length>0){this.add2AwaitShove([h[h.length-1]],e);for(let d of e.awaitingVias)e.awaitShove.add(d)}this.addAroundCommand(l);let u=0;for(;u<s.length&&h!=null&&h.length>0;){let d=s[u];if(d instanceof Kn){new s9(d.toArray()).getShoveTracks(h,e);break}u++}}Nt.pushFilter.addAroundList(a)}else if(e.awaitShove.has(a)){let c=!1;for(let[h,u]of a.connectTrack)this.getViaCollideTracks(h,u,e,l).length>0&&(c=!0);if(!c){let h=a.item,u=new p_(a,l,e,this.endTime,e.completes);u.offset(),Nt.pushFilter.addAroundTracks(a),u.success?(hi.getInstance().deleteShoveTree(h),hi.getInstance().addShoveTree(a.item),u.checkShove(a.item),this.updateNextOrder(a,s,e)):(l.undo(),l=new Br,e.awaitShove.add(a))}}this.add2Commands(i,l),Yr.inputClear()}return{success:n,command:i}}add2AwaitShove(t,e,r=null){for(let i of t)!i.isEmpty&&!this.getNode(i).ignore?(e.awaitShove.add(i),r!=null&&r.add(i)):hi.getInstance().deleteShoveTree(i);for(let i of e.awaitingVias)e.awaitShove.add(i)}updateNextOrder(t,e,r){try{if(e.length>0){let i=0;for(;i<e.length&&t!=null;){let n=e[i];if(n instanceof Kn){let s=new s9(n.toArray());t instanceof bs?s.getViaShoveTracks(t.item,r.awaitShove):t.length>0&&s.getShoveTracks(t,r);break}i++}}}catch(i){this.interrupt=!0,console.log(i)}}getViaCollideTracks(t,e,r,i){let n=new Array;if(e){let a=t.getFirstNode();for(;a!=null;){if(r.awaitShove.has(a.item))n.push(a);else{let l=a.item;if(this.blockShape.blockTrackOnlyTrack(l,l.primitive,!0).length>0)n.push(a);else break}a=a.next}}else{let a=t.getLastNode();for(;a!=null;){if(r.awaitShove.has(a.item))n.unshift(a);else{let l=a.item;if(this.blockShape.blockTrackOnlyTrack(l,l.primitive,!0).length>0)n.unshift(a);else break}a=a.prev}}let s=new Array;if(n.length>0){for(let l of n)Fr.getInstance().getStatus(l).change(),s.push(l.item);let a=new n9(s,e?t.viaNode.prev.item:t.viaNode.next.item,i,!e,this.endTime,this.isWire,r);a.offset(),a.getResult()}return s}addAroundCommand(t){let e=Ju.getInstance().asyn();e.size>0&&t.addCommand(new tV(e))}add2Commands(t,e){e.length>0&&t.addCommand(e)}getOptimizeLevel(t){switch(this.inputLevel){case"SUPER":case"STRONG":case"WEAK":return"WEAK";default:return this.inputLevel}}around(t,e,r,i,n){if(t.length==0)return[];if(Nt.pushFilter.addAroundTracks(t),t.length>0){let s=this.getIgnoreTracks(e,t);Nt.pushFilter.deleteAroundTracks(s)}return r.level=this.getOptimizeLevel(e),r.isWire=this.isWire,r.find(t,i,n)}getAroundTracks(t,e,r){let i=t.getFirstNode(),n=t.getLastNode();for(;i!=null&&!(this.isChangeNode(i)||e.awaitShove.has(i.item)||(i=i.next,i==n)););for(;n!=null&&!(this.isChangeNode(n)||e.awaitShove.has(n.item)||(n=n.prev,i==n)););let s=i,a=[],l=!1;for(;s!=null&&(e.awaitShove.has(s.item)&&(l=!0),a.push(s.item),s!=n);)s=s.next;if(l){i.prev==null&&this.checkPath(t,a,e,r,!0);let c=!1;return this.getNode(a[a.length-1]).next==null&&(c=this.checkPath(t,a,e,r,!1)),c||this.checkReversePush(t,a,e,r,!1),a}else return[]}getIgnoreTracks(t,e){let r=new Set(e),i=new Array,n=t.listIterator();for(;n.hasNext();){let s=n.next();r.has(s.item)||i.push(s.item)}return i}initAroundPath(t){let e=new S3;for(let r of t)r instanceof bs?e.canShoveVia.add(r):(e.canShovePath.add(r),r.viaNode.prev!=null&&e.canShoveVia.add(r.viaNode.prev),r.viaNode.next!=null&&e.canShoveVia.add(r.viaNode.next));return e}checkPath(t,e,r,i,n){let s=n?t.viaNode.prev:t.viaNode.next,a=cn.exsitSpaceConstraint(e,!n);if(this.viaOffset(s,e,r,i,n,a))return!0;let c=(n?t.getFirstNode():t.getLastNode()).item,h=this.blockShape.blockTrackPoint(c,n);if(h.length>0||a){if(this.canOffset(t,n)){let u=new yC(e,i,!n,this.endTime,this.isWire,r);u.offset(),u.getResult()}else this.removePointRepearLine(h,e,r,n);return!0}else return!1}checkReversePush(t,e,r,i,n){let s=n?t.getFirstNode():t.getLastNode();if(Fr.getInstance().getStatus(s).isInput&&this.isWire&&this.lists.length>1){let l=n?e[e.length-1]:e[0],c=this.blockShape.blockTrackInput(l,new Set);for(let h of c){let u=h.obstacle;if(u instanceof yt&&Fr.getInstance().getStatus(this.getNode(u)).isReversePush){if(this.canOffset(t,n)){this.get2End(e,!n);let p=new yC(e,i,!n,this.endTime,this.isWire,r);p.offset(),p.getResult()}break}}}}get2End(t,e){if(e){let r=this.getNode(t[t.length-1]);for(r=r.next;r!=null;)t.push(r.item),r=r.next}else{let r=this.getNode(t[0]);for(r=r.prev;r!=null;)t.unshift(r.item),r=r.prev}}viaOffset(t,e,r,i,n,s){if(this.canOffsetEndVia(t,r)){let l=this.blockShape.collideVia(t.item).length>0;if(!l){let c=n?e[0]:e[e.length-1];l=this.blockShape.blockTrackPoint(c,n).length>0,l||(l=n?!c.start.equals1(t.item.center):!c.end.equals1(t.item.center))}if(l||s){let c=new n9(e,t.item,i,!n,this.endTime,this.isWire,r);c.offset(),c.getResult()}else r.awaitShove.has(t)&&(r.awaitShove.delete(t),r.awaitingVias.add(t));return!0}return!1}canOffsetEndVia(t,e){return t!=null&&(this.canOffsetVia(t)||e.awaitShove.has(t))}canOffsetVia(t){return t!=null&&!t.item.locked&&!Ps(t.item)&&t.item.getParent()==null&&this.isChangeViaNode(t)}canOffset(t,e=!1){if(t.size()>0){if(e){if(t.otherNode.prev==null&&(t.viaNode.prev==null||t.viaNode.prev!=null&&this.isChangeViaNode(t.viaNode.prev)))return!0}else if((t.otherNode.next==null||this.isWire&&this.lists.includes(t))&&(t.viaNode.next==null||t.viaNode.next!=null&&this.isChangeViaNode(t.viaNode.next)))return!0}return!1}removePointRepearLine(t,e,r,i){for(let s of t)if(s instanceof yt){let a=this.getNode(s);if(a.ignore||!r.canShovePath.has(a.parent))continue;Nt.pushFilter.deleteAroundList(a.parent),r.awaitShove.add(s)}let n=new sV(e,!i);for(let s of n.used){if(!r.canShovePath.has(s))continue;Nt.pushFilter.deleteAroundList(s);let a=this.getChangeTracks(s);for(let l of a)this.getNode(l).ignore||r.awaitShove.add(l)}}};var fb=class extends mC{constructor(e=300){super();this.hasToggleStyle=!1;this.level="NONE";this.isWire=!1;this.timeout=e}run(e){Ju.getInstance().clear(),hi.getInstance().update();let r=this.getLists2(e,e.command),i=new SX(r,this.timeout);i.inputLevel=this.level,i.isWire=this.isWire,i.direct=e.direct,i.shoveMain(),i.command.length>0&&e.command.addCommand(i.command),Nt.clearParition(),this.hasToggleStyle&&(Xg(),this.hasToggleStyle=!1)}run1(e,r,i){this.level="STRONG",Ju.getInstance().clear(),hi.getInstance().update();let n=e,s=new SX(n,this.timeout);s.inputLevel=this.level,s.isWire=this.isWire,s.direct=i,s.shoveMain(),s.command.length>0&&r.addCommand(s.command),Nt.clearParition(),this.hasToggleStyle&&(Xg(),this.hasToggleStyle=!1)}getLists2(e,r){let i=[],n=Nt.filter;Nt.setPushFilter(),Nt.pushFilter.setAroundMode();for(let[s,a]of e.wireMap){if(s.drawing==0&&a.size()>0){let l=this.pointInObstacle,c=this.backFix(a,r);if(c&&!this.hasToggleStyle&&(jg("freeArc"),c=this.backFix(a,r),this.pointInObstacle=l||c,this.hasToggleStyle=!0),c){let h=this.getFirstInputStatus(a).item,u=new ri,d=u.createList(),p=u.createTrack(h.layerId,h.start,h.start,h.width,h.net,e.command,h.getGroupID());u.addList(p,d,e.command),d.replace(this.getFirstInputStatus(a),a.getLastNode()),e.command.addCommand(new Ti(d));continue}i.push(a)}if(a.size()==0&&a.viaNode.prev!=null){let l=!1;if(a.viaNode.prev.connectTrack.size>0)for(let[c]of a.viaNode.prev.connectTrack)c.size()>0&&(i.push(c),l=!0);l||i.push(a.viaNode.prev)}}return Nt.filter=n,i}};var y9e=class{constructor(t){this.clearanceUtils=new Ep;this.manager=Os.getInstance();this.map=new Map;this.ccw=new Array;this.cw=new Array;this.inner=new Array;this.rtree=new NT(15);this.path=t;let e=t.iterator();for(;e.hasNext();)this.rtree.insert(new s0(e.next()))}addResult(t){var c,h,u,d;let e=t.source,r=t.obstacle,i=r.start,n=r.end,s=t.point,a=xt.getInstance().getListNode(r);if(this.inSameListHull(t,e,r,s)){this.addInner(t);return}let l=hg(r.primitive,s,(h=(c=a.prev)==null?void 0:c.item)==null?void 0:h.primitive,(d=(u=a.next)==null?void 0:u.item)==null?void 0:d.primitive);if(l==le.CCW)this.ccw.push(t);else if(l==le.CW)this.cw.push(t);else{let p=t.clearance,m=e.width/2+r.width/2,g=p+m,y=s.distance2(i)<s.distance2(n)?i:n,b=this.pointHull(y,g);Jr.inPolyline(s,b)&&(this.ccw.push(t),this.cw.push(t))}}pointHull(t,e){return ll.OctagonalHull1(t,e)}addInner(t){this.inner.push(t)}addHullMap(t,e){this.map.set(t,e)}inSameListHull(t,e,r,i,n){let s=this.clearanceUtils.getMaxTrackClearance(),a=i.bbox().extendOfSize(s+e.width/2),l=this.rtree.search(a),c=!1;for(let h of l){let u=h.model;if(u.net==r.net&&u!=r){if(ne.eq(n,0))continue;if(this.getHull(t,e,u).pointInHull(i,Ts)){c=!0;break}}}return c}getHull(t,e,r){let i=this.map.get(r);if(i==null){let n=t.clearance+e.width/2;i=this.manager.getModelObstacle(r,n,r.layerId).outline,this.addHullMap(r,i)}return i}sort(t,e){t.length>0&&xr(t,(r,i)=>e.get(r)-e.get(i))}getNext(t){let e=this.ccw.indexOf(t),r=this.getNext4Index(this.ccw,e);return r!=null||(e=this.cw.indexOf(t),r=this.getNext4Index(this.cw,e),r!=null)||(e=this.inner.indexOf(t),r=this.getNext4Index(this.inner,e),r!=null)?r:null}getGroup(t){return this.ccw.includes(t)?this.ccw:this.cw.includes(t)?this.cw:this.inner.includes(t)?this.inner:null}getNext4Index(t,e){if(e>=0){let r=e+1;if(r<t.length)return t[r]}return null}},cV=class extends lD{constructor(){super(...arguments);this.map=new Map;this.clearanceUtils=new Ep;this.block=new As;this.inters=new Set}blockTracks(e,r=!1){if(e==null||e.length==0)return[];Nt.pushFilter.setNetAndLayerId(e[0].net,e[0].layerId);let i=this.clearanceUtils.getMaxTrackClearance(),n=new Array,a=xt.getInstance().getListNode(e[0]).parent,l=new Set;e=r?e.reverse():e;for(let g of e){let y=r?g.primitive.reverse():g.primitive,b=this.getBBox4Primitive(g,y,i),P=this.search(b);for(let v of l)P.vias.delete(v);let T=new Array,I=this.block.blockTrack4Shapes(g,y,!0,P);for(let v of I){let D=v.obstacle,w=v.block,F=v.clearance;if(D instanceof yt)if(v.isSameNet)xt.getInstance().getListNode(D).parent!=a&&!D.start.equals(g.start)&&!D.start.equals(g.end)&&!D.end.equals(g.start)&&!D.end.equals(g.end)&&T.push(v);else{this.inters.add(D);let H=this.getRes(D),z=v.block.collideInfo,G=z.shape.getOutline(Ts);H.addHullMap(D,w.obstalce.outline);let W=!1,L=y.end();if(w.obstalce.outline.pointInHull(y.start(),Ts)){let N=new bl(g,y.start(),D,F,!1,v.layer1,v.layer2,z);T.push(N),H.addInner(N);let U=y.bbox().extendOfSize(.1),k=new Ba;for(let Y of G.primitives){let X=Y.bbox();if(!U.isIntersect(X))continue;let Z=Tt(y,Y);for(let Q=0;Q<Z;Q+=2){let ae=new S(Ee[Q],Ee[Q+1]);k.add(ae)}}let V=this.sortInters(k,y);if(V.length>0)for(let Y of V){let X=new bl(g,Y,D,F,!1,v.layer1,v.layer2,z);T.push(X),H.addResult(X)}}else for(let N of z.inters)if(!W&&N.equals1(L)&&(W=!0),z.shape.pointInHull(N,Ts)){let U=new bl(g,N,D,F,!1,v.layer1,v.layer2,z);T.push(U),H.addInner(U)}else{let U=new bl(g,N,D,F,!1,v.layer1,v.layer2,z);T.push(U),H.addResult(U)}if(L){if(Jr.inEdge4Polyline(L,G,.006)){let N=new bl(g,L,D,F,!1,v.layer1,v.layer2,z);T.push(N),H.addResult(N)}else if(w.obstalce.outline.pointInHull(L,Ts)){let N=new bl(g,L,D,F,!1,v.layer1,v.layer2,z);T.push(N),H.addInner(N)}}}else D instanceof It&&(T.push(v),l.add(D))}let C=y.start();xr(T,(v,D)=>{if(v.point.equals1(D.point)){if(v.isSameNet&&!D.isSameNet)return-1;if(!v.isSameNet&&D.isSameNet)return 1}return v.point.distance2(C)-D.point.distance2(C)},0,T.length);let E=new Map,O=new Map,_=0,R=0;for(let v of T){let D=v.obstacle;E.get(D)==null&&E.set(D,_++),O.set(v,R),R++}xr(T,(v,D)=>{let w=E.get(v.obstacle)-E.get(D.obstacle);return w==0?O.get(v)-O.get(D):w},0,T.length),Re.addAll(n,T)}let c=new Map;for(let g=0;g<n.length;g++)c.set(n[g],g);for(let[,g]of this.map)g.sort(g.ccw,c),g.sort(g.cw,c),g.sort(g.inner,c);let h=new Set,u=new Ba,d=new Set;for(let g of n){if(d.has(g)||h.has(g))continue;let y=g.obstacle;if(!(y instanceof yt)){h.add(g);continue}let b=this.getRes(y),P=b.getGroup(g),T=P==b.inner;if(P==null)h.add(g);else if(T){let I=c.get(g);h.add(g);let C=null;for(let E=I+1;E<n.length;E++){let O=n[E],_=O.obstacle;if(_ instanceof yt&&this.getRes(_)==b&&!P.includes(O)){C=O;break}}if(C!=null){let E=b.getGroup(C);for(let O of b.inner)d.add(O);if(E==b.ccw)for(let O of b.ccw)d.add(O);else for(let O of b.cw)d.add(O)}}else{let I=P.indexOf(g),C=new Set;for(;I<P.length;I++){let _=P[I];C.add(_.obstacle);let R=P[I+1];if(R!=null){h.add(_),h.add(R);let v=c.get(_),D=c.get(R);for(let w=v+1;w<D;w++){let F=n[w],H=F.obstacle;H instanceof yt&&this.getRes(H)==b&&d.add(F)}}}if(!T)for(let _ of b.inner)d.add(_),C.add(_.obstacle);let E=P[P.length-1];h.add(E);let O=c.get(E);for(let _=O+1;_<n.length;_++){let R=n[_],v=R.obstacle;v instanceof yt&&this.getRes(v)==b&&C.has(v)&&d.add(R)}}}let p=new Array,m=new lP(5);e:for(let g of n)if(h.has(g)){let y=m.search(g.point.bbox().extendOfSize(1e-6));for(let b of y)if(b.point.equals1(g.point))continue e;this.inters.delete(g.obstacle),p.push(g),m.insert(g)}return Nt.pushFilter.setNet(null,null),p}getBBox4Primitive(e,r,i){return r instanceof M?nh.trackToOctagon(r.start(),r.end(),e.width+i*2):r.bbox().extendOfSize(i+e.width/2)}search(e){return Nt.searchTrackAndVia(e)}getRes(e){let i=xt.getInstance().getListNode(e).parent,n=this.map.get(i);return n==null&&(n=new y9e(i),this.map.set(i,n)),n}};var EX=class extends cV{constructor(t,e){super(),this.rtree=t,this.filter=e}search(t){let e=this.rtree.search(t),r=new _d([]);for(let i of e)this.filter!=null?this.filter.isValid(i.model)&&r.addModel(i.model):r.addModel(i.model);return r}};var joe=class extends o9{constructor(){super(...arguments);this.rtree=new x0(10)}init(e){for(let r of e)this.rtree.insert(new s0(r));return this}removeSelf(e,r,i){if(e.length!=0)return this.init(e),this.find(e,r,i)}search(e,r,i){let n=this.blockShape.clearanceUtils.getMaxTrackClearance(),s=r.bbox().extendOfSize(n+e.width/2),a=this.rtree.search(s),l=[];for(let h of a)l.push(h.model);let c=new _d(l);return this.blockShape.blockTrack4Shapes(e,r,i,c)}};var b9e=class{constructor(t){this.collideIndexs=new Array;this.id=t}},Xoe=class{constructor(t){this.collideIndexs=new Array;this.listIndex=-1;this.groupId=-1;this.track=t}},P9e=class{constructor(){this.start=null;this.end=null;this.group=0}isIntersection(t){let e=Math.min(this.start,this.end),r=Math.max(this.start,this.end),i=Math.min(t.start,t.end),n=Math.max(t.start,t.end),s=Math.max(e,i),a=Math.min(r,n);return s<=a+1}merge(t){let e=Math.min(this.start,this.end,t.start,t.end),r=Math.max(this.start,this.end,t.start,t.end);this.start=e,this.end=r,t.start=e,t.end=r}},PD=class{constructor(){this.tracks=new Array;this.list=null;this.node=new P9e}isIntersection(t){return!!(t.list==this.list&&this.node.isIntersection(t.node))}merge(t){this.node.merge(t.node)}resetOrder(t,e){let r=this.list.listIterator(),i=0;for(;r.hasNext();){let n=r.next();i>=this.node.start&&i<=this.node.end&&(e.add(n.item),Fr.getInstance().setOrder(n,t)),i++}}has(t){let e=this.list.listIterator(),r=0,i=!1;for(;e.hasNext();){let n=e.next();if(r>=this.node.start&&r<=this.node.end&&(i=Fr.getInstance().getStatus(n).collideOrder==t),i)break;r++}return i}},y5=class{constructor(){this.map=new Map;this.symbolsMap=new Map;this.collides=new Array;this.groups=new Array;this.indexs=new Array;this.symbols=new Array;this.trackSortMap=new Map;this.listSortMap=new Map;this.resetOrder=!0;this.cnt=0}addTrack(t,e){let i=this.getNode(t).parent,n=this.map.get(i),s=this.symbolsMap.get(i);n==null&&(n=this.cnt++,this.map.set(i,n)),s==null?s=1:s*=-1,this.symbolsMap.set(i,s);let a=this.groups.length;return this.collides.push(t),this.groups.push(n),this.indexs.push(a),this.symbols.push(s),!0}addVia(t,e){this.symbolsMap.set(t,0);let r=this.groups.length;return this.collides.push(t),this.groups.push(-1),this.indexs.push(r),this.symbols.push(0),!0}getNode(t){return xt.getInstance().getListNode(t)}getResult(t=0){this.sortTrack();let e=this.group(),r=new Map,i=new Set;for(let n of e){let s=new Array,a=new Array;for(let d of n.collideIndexs){if(i.has(d))continue;let p=this.collides[d];if(p instanceof yt){let m=this.trackSortMap.get(p);s.push(m),Re.addAllSet(i,m.collideIndexs)}else{let m=_i.getInstance().getViaNode(p);i.add(d),a.push(m)}}if(s.length==0){for(let d of a)r.set(t,d),t++;continue}xr(s,(d,p)=>d.listIndex-p.listIndex);let l=s[0].track,c=s[s.length-1].track,h=this.getNode(l);r.set(t,h.parent);let u=!1;for(;h!=null&&(Fr.getInstance().getStatus(h).collideOrder==-1&&(h.item.locked||Ps(h.item)||h.item.getParent()!=null?u&&(t++,r.set(t,h.parent),u=!1):(Fr.getInstance().setOrder(h,t),u=!0)),h.item!=c);)h=h.next;u?t++:r.delete(t);for(let d of a)r.set(t,d),t++}return r}getResult1(t=0){this.sortTrack();let e=this.group(),r=new Map,i=new Set;for(let n of e){let s=new Array,a=new Array;for(let p of n.collideIndexs){if(i.has(p))continue;let m=this.collides[p];if(m instanceof yt){let g=this.trackSortMap.get(m);s.push(g),Re.addAllSet(i,g.collideIndexs)}else{let g=_i.getInstance().getViaNode(m);i.add(p),a.push(g)}}if(s.length==0){for(let p of a)r.set(t,p),t++;continue}xr(s,(p,m)=>p.listIndex-m.listIndex);let l=s[0].track,c=s[s.length-1].track,h=this.getNode(l),u=new PD;u.node.start=s[0].listIndex,u.node.end=s[s.length-1].listIndex,u.list=h.parent,r.set(t,u);let d=!1;for(;h!=null&&(Fr.getInstance().getStatus(h).collideOrder==-1&&(h.item.locked||Ps(h.item)||h.item.getParent()!=null?d?(u.node.end=this.trackSortMap.get(u.tracks[u.tracks.length-1]).listIndex,t++,d=!1,u=new PD,u.node.start=this.trackSortMap.get(h.item).listIndex,u.node.end=s[s.length-1].listIndex,u.list=h.parent,r.set(t,u)):u.node.start=this.trackSortMap.get(h.item).listIndex:(d||(u.node.start=this.trackSortMap.get(h.item).listIndex),u.tracks.push(h.item),d=!0)),h.item!=c);)h=h.next;d?t++:r.delete(t);for(let p of a)r.set(t,p),t++}return r}group(){let t=new Array,e=0,r=new Array,i=Array.from(this.indexs);for(;i.length>0;){let s=i.shift(),a=this.groups[s],l=this.symbols[s],c=new b9e(a);if(c.collideIndexs.push(s),r.push(c),e+=l,e==0){let h=new Map;for(let d of r){let p=h.get(d.id);p==null?h.set(d.id,d):Re.addAll(p.collideIndexs,d.collideIndexs)}let u=new Array;for(let[,d]of h)u.push(d);u=this.mergePath(u),this.removeMidCollides(u,i),t.push(u),r=new Array}}r.length>0&&(r=this.mergePath(r),t.push(r));let n=new Array;for(let s of t)for(let a of s)n.push(a);return n=this.mergePath(n),n}sortTrack(){let t=this.indexs.length;for(let e=0;e<t;e++){let r=this.indexs[e],i=this.collides[r];if(i instanceof yt){let n=this.trackSortMap.get(i);n==null&&(n=new Xoe(i),this.trackSortMap.set(i,n)),n.collideIndexs.push(r)}}for(let[e,r]of this.map){let i=e.listIterator(),n=0;for(;i.hasNext();){let s=i.next();this.resetOrder&&Fr.getInstance().setOrder(s,-1);let a=this.trackSortMap.get(s.item);a!=null?(a.listIndex=n,a.groupId=r):(a=new Xoe(s.item),this.trackSortMap.set(s.item,a),a.listIndex=n,a.groupId=r),n++}}for(let[,e]of this.trackSortMap){let r=e.groupId,i=this.listSortMap.get(r);i==null&&(i=[],this.listSortMap.set(r,i)),i.push(e)}}removeMidCollides(t,e){for(let r of t)if(r.collideIndexs.length>1){let n=this.getTrackIndex4Order(r.collideIndexs),s=this.getTrackIndex4Order(r.collideIndexs,!0);if(n==-1||s==-1)continue;let a=this.listSortMap.get(r.id),l;n>s?l=this.getSegment(s,n,a):l=this.getSegment(n,s,a);for(let c of l)for(let h of c.collideIndexs){let u=e.indexOf(h);u>=0&&e.splice(u,1)}}}mergePath(t){let e=new Set;this.filterEndpoint(t,e);let r=!0;for(;r;){r=!1;let i=new Array,n=null,s=0;for(let a of t){if(s>0){i.push(a);continue}if(n!=null){let l=e.has(a);!l&&a.id==n.id?(Re.addAll(n.collideIndexs,a.collideIndexs),e.add(n),r=!0):l?i.push(a):(r&&s++,n=a,i.push(n))}else n=a,i.push(n)}t=i}return t}filterEndpoint(t,e){let r=new Map;for(let i of t){let n=r.get(i.id);n==null&&(n=[],r.set(i.id,n)),n.push(i)}for(let[i,n]of r)if(n.length==1){let s=n[0];if(s.collideIndexs.length==1){let a=this.collides[s.collideIndexs[0]];if(a instanceof yt){let l=xt.getInstance().getListNode(a),c=l.parent;(l.next==null&&c.otherNode.next==null&&(c.viaNode.next==null||!c.viaNode.next.isSource||this.collides.includes(c.viaNode.next.item))||this.isConnectVia(l))&&e.add(s)}else e.add(s)}}}isConnectVia(t){let e=t.parent;return e.viaNode.next!=null&&this.collides.includes(e.viaNode.next.item)&&e.viaNode.next.item.inOutline(t.item.end)?!0:!!(e.viaNode.prev!=null&&this.collides.includes(e.viaNode.prev.item)&&e.viaNode.prev.item.inOutline(t.item.start))}getTrackIndex(t){let e=this.collides[t];return e instanceof yt?this.trackSortMap.get(e).listIndex:-1}getTrackIndex4Order(t,e=!1){if(e)for(let r=t.length-1;r>=0;r--){let i=this.getTrackIndex(t[r]);if(i>=0)return i}else for(let r=0;r<t.length;r++){let i=this.getTrackIndex(t[r]);if(i>=0)return i}return-1}getSegment(t,e,r){let i=new Array;for(let n of r)n.listIndex>t&&n.listIndex<e&&i.push(n);return i}};var qoe=class extends yC{constructor(t,e,r,i,n,s,a,l=new Set){super(t,r,i,n,s,a,l),this.next=e,i?this.constraintPoint=this.getConstraintPoint(this.next[0],this.tracks[0].start,this.tracks[this.tracks.length-1].end,this.track.layerId):this.constraintPoint=this.getConstraintPoint(this.next[0],this.tracks[this.tracks.length-1].end,this.tracks[0].start,this.track.layerId)}onlyDrc(t){return this.isWire?this.isInput(t):!1}closeShapeOnlyDrc(t){return t.layerId!=12&&t.layerId!=11&&t.layerId!=1004?!0:this.isWire?!this.findNewEnd:this.fix}trackCheck(t,e,r,i){let n=this.block.blockTrackOnlyTrack(t,e?t.primitive.reverse():t.primitive,!0);if(n.length>0)for(let s of n){let a=s.obstacle;if(!s.isSameNet&&a instanceof yt){let c=xt.getInstance().getListNode(a).parent;if(this.obstacles.has(c))continue;this.addObstacle(c);let h=this.constraintPoint.parentMap.get(t.layerId);return h==null?(h=new Jg(this.next[0],s.point,S.ORIGIN,!0),this.constraintPoint.setParent(t.layerId,h)):h.point=s.point,r.set(i,s),!0}}return!1}init(){let t=0,e=new Map,r=[[this.tracks,!1],[this.next,!0]];for(let[s,a]of r)if(a)for(let l=s.length-1;l>=0;l--){let c=s[l];if(this.trackCheck(c,a,e,s))break}else for(let l of s)if(this.trackCheck(l,a,e,s))break;let i=!1,n=new Ba;do{i=!1;for(let[s]of r){let a=e.get(s);if(a!=null){let l=a.obstacle;new gC(l,this.onlyDrc(l)).constraint(this.constraintPoint)&&!n.contains(this.constraintPoint.point)&&(i=!0,n.add(this.constraintPoint.point),this.constraintPoint.setConstraintObstacle(l))}}t++}while(i&&t<20)}getSize(){return Math.max(this.tracks[this.tracks.length-1].width/2,this.next[0].width/2)}getResult(){this.sycnShoveInfo();let t=[[this.tracks,!1],[this.next,!0]];for(let[e,r]of t){if(e.length==0)continue;let i=r?e[0]:e[e.length-1];tUe(i,r,this.constraintPoint.point,e,this.command)}for(let e of this.next)this.tracks.push(e)}};var OX=class{constructor(t,e,r,i=!1){this.blockShape=new As;this.queue=new Array;this.queue1=new Array;this.allItems=new Set;this.all=new Set;this.allPushList=new Set;this.pushQueue=new Array;this.cnt=0;this.inputLevel="WEAK";this.level="NONE";this.isWire=!1;this.canPushViaLevel=2;this.interrupt=!1;this.isPositive=!0;this.obstacles=new Set;this.direct=r,this.hugPrefered=i,this.isShove=!i,this.lists=t,this.command=new Br("shove"),this.itorsCommand=new Br,this.timeout=e,this.endTime=performance.now()+this.timeout}initShoveEnvironment(){Ju.getInstance().clear(),hi.getInstance().update(),t9.getInstance().clear();for(let t of this.lists)t instanceof Kn&&this.all.add(t)}shoveMain(){this.initShoveEnvironment(),this.queue.push(this.lists);let t=0;for(;this.queue.length>0||this.queue1.length>0;){let e;if(this.queue.length>0)e=this.queue.shift(),this.isPositive=!0;else{if(e=this.queue1.shift().reverse(),e.length>1){e.sort((n,s)=>n instanceof Kn&&s instanceof Kn?this.pushQueue.indexOf(s)-this.pushQueue.indexOf(n):0);let r=null,i=[];for(;e.length>0;){let n=e.shift();if(n instanceof Kn){let s=this.pushQueue.indexOf(n);if(r!=null&&r-s!=1){e.unshift(n);break}i.push(n),r=s}else{e.length==0?i.push(n):e.unshift(n);break}}this.queue1.push(e),e=i}this.isPositive=!1}if(this.shoveIterators(e),t>100||performance.now()>this.endTime||this.interrupt)break;t++}if(!(t>100||performance.now()>this.endTime||this.interrupt||this.queue.length>0||this.queue1.length>0))if(this.level==this.inputLevel){if(this.level=="SUPER"||this.level=="STRONG"){let r=new PC(this.pushQueue,this.level,this.direct,this.endTime,this.getLayerIds()).optimize();this.add2Commands(this.command,r)}}else{if(this.level=="SUPER"||this.level=="STRONG"){for(let i of this.lists)if(i instanceof Kn){let n=this.pushQueue.indexOf(i);n>=0&&this.pushQueue.splice(n,1)}let r=new PC(this.pushQueue,this.level,this.direct,this.endTime,this.getLayerIds()).optimize();this.add2Commands(this.command,r)}if(this.inputLevel=="SUPER"||this.inputLevel=="STRONG"){if(this.isWire&&this.inputLevel=="SUPER"&&this.hasDiffPairAndNotChange())return;let e=new Array;for(let n of this.lists)n instanceof Kn&&e.push(n);let i=new PC(e,this.inputLevel,this.direct,this.endTime).optimize();this.add2Commands(this.command,i)}}}getLayerIds(){let t=new Set;for(let e of this.lists)if(e instanceof Kn&&e.size()>0){let r=e.getFirst();t.add(r.layerId)}return t.size==0?null:t}hasDiffPairAndNotChange(){let t=new Set;for(let e of this.lists)if(e instanceof Kn){let r=e.listIterator();for(;r.hasNext();){let n=r.next(),s=Fr.getInstance().getStatus(n);if(s.isInput&&!s.notChange)return!1}let i=e.getFirst();t.add(i.net)}return this.blockShape.clearanceUtils.hasDiffPair(t)}shoveIterators(t){this.itorsCommand=new Br;for(let i of t)i instanceof Kn&&(this.clearCollideInfo(i),this.allPushList.has(i)||(this.allPushList.add(i),this.pushQueue.push(i))),this.allItems.add(i);let e=this.aroundSolid(t);this.add2Commands(this.itorsCommand,e);let r=this.aroundTracks(t);if(this.interrupt){this.add2Commands(this.command,this.itorsCommand);return}if(this.hasCollides(t,!0)&&(this.itorsCommand.length==0&&(this.interrupt=!0),this.queue.unshift(t)),this.hasCollides(t,!1))if(this.queue1.length>0){let i=this.queue1[0];for(let n of t)i.includes(n)||i.push(n)}else this.queue1.unshift(t);if(r.length>0)if(this.isPositive)this.queue.push(r);else if(this.queue1.length>0){let i=this.queue1[0];for(let n of r)i.includes(n)||i.push(n)}else this.queue1.push(r);this.add2Commands(this.command,this.itorsCommand)}toggleSearchTree(t){Nt.useShoveTree=!0,hi.getInstance().clearShoveTree(),this.add2ShoveTree(t)}canOffset(t,e=!1){if(t.size()>0){if(e){if(t.otherNode.prev==null&&(t.viaNode.prev==null||t.viaNode.prev!=null&&(this.isChangeViaNode(t.viaNode.prev)||this.canPushViaLevel>0)))return!0}else if((t.otherNode.next==null||this.isWire&&this.lists.includes(t))&&(t.viaNode.next==null||t.viaNode.next!=null&&(this.isChangeViaNode(t.viaNode.next)||this.canPushViaLevel>0)))return!0}return!1}canOffsetVia(t){return t!=null&&!t.item.locked&&!Ps(t.item)&&t.item.getParent()==null&&this.isChangeViaNode(t)&&this.canPushViaLevel>0}isChangeViaNode(t){if(t.isSource)return!1;if(t.isSource){for(let[e,r]of t.connectTrack)if(r){if(this.isChangeNode(e.getFirstNode()))return!0}else if(this.isChangeNode(e.getLastNode()))return!0;return!1}else return!0}aroundSolid(t){let e=new Br("aroundSolid"),r=0,i=Array.from(t),n=this.getAwaitShoveTracks(t);Nt.useShoveTree=!1;do{let s=new Br;this.setFilter4Solid(i);let a=this.initAroundPath(i);Re.addAllSet(a.awaitShove,n),n.clear();let{success:l,command:c}=this.aroundObstacles(i,a);if(l||r>=2?(this.add2Commands(s,c),this.addAroundCommand(s)):(c.undo(),Ju.getInstance().undo()),Nt.pushFilter.setNet(null,null),hi.getInstance().update(),this.add2Commands(e,s),r++,this.filterAwaitShoveItem(a.awaitShove),a.awaitShove.size==0&&l||r>=8)break;Re.addAllSet(n,a.awaitShove),i=i.reverse()}while(this.endTime>performance.now()&&!this.interrupt);return e}getAwaitShoveTracks(t){let e=new Set;for(let r of t)if(r instanceof Kn){let i=this.getChangeTracks(r);Re.addAllSet(e,i),r.viaNode.prev!=null&&this.isChangeViaNode(r.viaNode.prev)&&e.add(r.viaNode.prev),r.viaNode.next!=null&&this.isChangeViaNode(r.viaNode.next)&&e.add(r.viaNode.next)}else e.add(r);return e}getListsCollideResult(t,e){let r=new Set,i=[],n=0,s=0,a=new Array,l=new Set;for(let T of t)if(T instanceof Kn){let I=this.getChangeTracks(T),C=new y5,E=!1;(T.viaNode.prev!=null&&this.isChangeViaNode(T.viaNode.prev)&&(T.viaNode.next==null||!this.isChangeViaNode(T.viaNode.next))||T.viaNode.prev==null&&I.length>0&&this.getNode(I[0]).prev==null&&this.getNode(I[I.length-1]).next!=null)&&(E=!0),T.viaNode.prev!=null&&this.isChangeViaNode(T.viaNode.prev)&&!E&&this.collide4Via(T.viaNode.prev,C,l);let O=new cV;if(I.length>0){let R=O.blockTracks(I,E);for(let v of R){let D=v.obstacle;D instanceof yt?(this.getNode(D),C.addTrack(D,v.point)):D instanceof It&&!l.has(D)&&((this.canPushViaLevel>0||!_i.getInstance().getNode(D).isSource)&&C.addVia(D,v.point),l.add(D))}}if(T.viaNode.prev!=null&&this.isChangeViaNode(T.viaNode.prev)&&E&&this.collide4Via(T.viaNode.prev,C,l),T.viaNode.next!=null&&this.isChangeViaNode(T.viaNode.next)&&this.collide4Via(T.viaNode.next,C,l),C.groups.length==0)continue;let _=C.getResult1(n);i.push(_);for(let[,R]of _)R instanceof PD&&(R.node.group=s);for(let R of O.inters){let v=C.trackSortMap.get(R);if(v!=null){let D=new PD;D.node.start=v.listIndex,D.node.end=v.listIndex,D.list=this.getNode(R).parent,D.tracks.push(R),a.push(D)}}n+=_.size,s++}else if(this.isChangeViaNode(T)){let I=new y5;this.collide4Via(T,I,l);let C=I.getResult1(n);i.push(C);for(let[,E]of C)E instanceof PD&&(E.node.group=s);n+=C.size,s++}let c=new Array;for(let T of i)for(let[,I]of T)c.push(I);let h=new Map;for(let T of c){if(T instanceof bs)continue;let I=h.get(T.list);I==null&&(I=[],h.set(T.list,I)),I.push(T)}for(let[,T]of h)T.sort((I,C)=>I.node.start-C.node.start);let u=new Map,d=c.concat(a),p=d.length;for(let T=0;T<p;T++){let I=d[T];if(I instanceof bs)continue;let C=I.node,E=u.get(C);E==null&&(E=new Set,u.set(C,E),E.add(C.group));for(let O=T+1;O<p;O++){let _=d[O];_ instanceof bs||I.node!=_.node&&I.isIntersection(_)&&(E.add(_.node.group),I.merge(_),_.node=C)}}for(let[,T]of h){let I=T[0],C=I.node,E=T.length,O=u.get(C);for(let _=1;_<E;_++){let R=T[_],v=!1;if(R.node!=C){{let D=u.get(R.node),w=new Set;Re.addAllSet(w,O),Re.addAllSet(w,D),w.size!=D.size+O.size?v=!1:v=!0}v||C.isIntersection(R.node)?(O.add(R.node.group),I.merge(R),R.node=C):(I=R,C=I.node,O.clear(),O.add(I.node.group))}}}let m=new Map;for(let T of i){let I=null;for(let[,C]of T)C instanceof bs||(I!=null&&m.get(I).push(C),c.push(C),I=C.node,m.has(I)||m.set(I,[]))}let g=new Array,y=new Set;function b(T,I){if(y.add(T),m.has(T))for(let C of m.get(T))y.has(C.node)||b(C.node,C);g.unshift(I)}for(let T of c){if(T instanceof bs){g.push(T);continue}y.has(T.node)||b(T.node,T)}let P=0;for(let T of g)T instanceof bs?(r.add(T),e.set(P,T)):(T.resetOrder(P,r),e.set(P,T.list)),P++;return r}collide4Via(t,e,r){if(this.isChangeViaNode(t)){let i=this.blockShape.blockViaPoint(t.item);for(let n of i){let s=n.obstacle;s instanceof yt?(this.getNode(s),e.addTrack(s,n.point)):s instanceof It&&!r.has(s)&&((this.canPushViaLevel>0||!_i.getInstance().getNode(s).isSource)&&e.addVia(s,n.point),r.add(s))}}}getChangeTracks(t){let e=t.getFirstNode(),r=t.getLastNode();for(;e!=null&&!this.isChangeTrack(e);)e=e.next;if(e==null)return[];for(;r!=null&&!(this.isChangeTrack(r)||(r=r.prev,e==r)););let i=e,n=[];for(;i!=null&&(n.push(i.item),i!=r);)i=i.next;return n}isChangeTrack(t){let e=Fr.getInstance().getStatus(t);return!!((e.isInput||!e.notChange)&&!e.checkDRC&&(this.isPositive&&!e.isReversePush||!this.isPositive&&e.isReversePush||e.isInputFirstPushed))}isChangeNode(t){let e=Fr.getInstance().getStatus(t);return!e.checkDRC&&(e.isInput||!e.notChange)}getListCollideResult1(t,e,r,i,n){let s=new y5;s.resetOrder=!1;let l=new EX(n,i).blockTracks(t);for(let h of l){let u=h.obstacle;gc.getInstance().has(u.globalIndex)||(u instanceof yt?(this.getNode(u),s.addTrack(u,h.point)):u instanceof It&&(this.canPushViaLevel>0||!_i.getInstance().getNode(u).isSource)&&s.addVia(u,h.point))}let c=s.getResult(r+1);for(let[h,u]of c)e.set(h,u)}getListCollideResult2(t,e,r,i,n){let s=new y5;s.resetOrder=!1;let a=new EX(n,i),l=this.blockShape.clearanceUtils.getMaxTrackClearance(),c=t.item.buildBBox().extendOfSize(l),h=a.search(c),u=this.blockShape.blockViaPoint4Shapes(t.item,h);for(let p of u){let m=p.obstacle;gc.getInstance().has(m.globalIndex)||(m instanceof yt?(this.getNode(m),s.addTrack(m,p.point)):m instanceof It&&(this.canPushViaLevel>0||!_i.getInstance().getNode(m).isSource)&&s.addVia(m,p.point))}let d=s.getResult(r+1);for(let[p,m]of d)e.set(p,m)}clearCollideInfo(t){let e=t.listIterator();for(;e.hasNext();){let r=e.next();this.setOrder(r,-1)}}setCollideInfo(t,e){if(t!=null)for(let r of t){let i=this.getNode(r),n=Fr.getInstance().getStatus(i);n.notChange||(n.collideOrder=e)}}aroundTracks(t){let e=Array.from(t);for(let l of e)l instanceof Kn&&this.clearCollideInfo(l);let r=new Br("aroundTracks"),i=new Array;Nt.pushFilter.setFilterMode(2);let n=new Map,s=this.getListsCollideResult(e,n);Nt.pushFilter.setFilterMode(0);let a=this.around4OrderQueue(t,n,i,s);this.add2Commands(r,a);for(let[,l]of n)if(l instanceof Kn){if(l.viaNode.prev!=null&&this.isChangeViaNode(l.viaNode.prev))for(let[c]of l.viaNode.prev.connectTrack)!i.includes(c)&&c.size()>0&&i.push(c);if(l.viaNode.next!=null&&this.isChangeViaNode(l.viaNode.next))for(let[c]of l.viaNode.next.connectTrack)!i.includes(c)&&c.size()>0&&i.push(c)}else{for(let[c]of l.connectTrack)!i.includes(c)&&c.size()>0&&i.push(c);l.connectTrack.size==0&&i.push(l)}return this.add2Commands(this.itorsCommand,r),this.cnt++,this.sortResult(i)}sortResult(t){let e=new Array,r=new Array;for(let i of t)i instanceof Kn&&this.pushQueue.includes(i)?r.push(i):e.push(i);return r.sort((i,n)=>this.pushQueue.indexOf(i)-this.pushQueue.indexOf(n)),this.isPositive&&r.reverse(),e.concat(r)}add2ShoveTree(t){for(let e of t)this.addItem2ShoveTree(e)}addItem2ShoveTree(t){if(t instanceof Kn){let e=hi.getInstance(),r=t.iterator();for(;r.hasNext();){let i=r.next();e.addShoveTree(i)}if(t.viaNode.prev!=null){e.addShoveTree(t.viaNode.prev.item);for(let[i]of t.viaNode.prev.connectTrack){if(i==t||i.size()==0)continue;let n=i.iterator();for(;n.hasNext();){let s=n.next();e.addShoveTree(s)}}}if(t.viaNode.next!=null){e.addShoveTree(t.viaNode.next.item);for(let[i]of t.viaNode.next.connectTrack){if(i==t||i.size()==0)continue;let n=i.iterator();for(;n.hasNext();){let s=n.next();e.addShoveTree(s)}}}if(t.otherNode.prev!=null){let i=t.otherNode.prev;if(i instanceof Je){e.addShoveTree(i);let n=yc.getInstance().getNode(i);for(let[s]of n.connectTrack){if(s==t||s.size()==0)continue;let a=s.iterator();for(;a.hasNext();){let l=a.next();e.addShoveTree(l)}}}else if(i instanceof Kn){let n=i.iterator();for(;n.hasNext();){let s=n.next();e.addShoveTree(s)}}}if(t.otherNode.next!=null){let i=t.otherNode.next;if(t.otherNode.next instanceof Je){e.addShoveTree(i);let n=yc.getInstance().getNode(t.otherNode.next);for(let[s]of n.connectTrack){if(s==t||s.size()==0)continue;let a=s.iterator();for(;a.hasNext();){let l=a.next();e.addShoveTree(l)}}}else if(i instanceof Kn){let n=i.iterator();for(;n.hasNext();){let s=n.next();e.addShoveTree(s)}}}}else{let e=hi.getInstance();e.addShoveTree(t.item);for(let[r]of t.connectTrack){if(r.size()==0)continue;let i=r.iterator();for(;i.hasNext();){let n=i.next();e.addShoveTree(n)}if(r.otherNode.prev!=null){let n=r.otherNode.prev;if(n instanceof Je){e.addShoveTree(n);let s=yc.getInstance().getNode(n);for(let[a]of s.connectTrack){if(a==r||a.size()==0)continue;let l=a.iterator();for(;l.hasNext();){let c=l.next();e.addShoveTree(c)}}}else if(n instanceof Kn){let s=n.iterator();for(;s.hasNext();){let a=s.next();e.addShoveTree(a)}}}if(r.otherNode.next!=null){let n=r.otherNode.next;if(r.otherNode.next instanceof Je){e.addShoveTree(n);let s=yc.getInstance().getNode(r.otherNode.next);for(let[a]of s.connectTrack){if(a==r||a.size()==0)continue;let l=a.iterator();for(;l.hasNext();){let c=l.next();e.addShoveTree(c)}}}else if(n instanceof Kn){let s=n.iterator();for(;s.hasNext();){let a=s.next();e.addShoveTree(a)}}}}}}around4OrderQueue(t,e,r,i){let n=Nt.filter,s=0;for(let[,p]of e)if(!r.includes(p))if(p instanceof bs){let m=!1;for(let[g]of p.connectTrack)!r.includes(g)&&g.size()>0&&(r.push(g),m=!0);m||r.push(p)}else r.push(p);let a=new Array,l=new Array;for(let[p,m]of e)a.push(m),l.push(p);let c=l[l.length-1],h=new Set,u=new Br("around4OrderQueue"),d=Array.from(t);do{this.toggleSearchTree(d),Nt.filter=this.setShoveTrackFilter(d);let p=new Br("around4OrderQueue-itors"),m=this.initAroundPath(a);Re.addAllSet(m.awaitShove,i),Re.addAllSet(m.obstacles,h),i.clear(),h.clear(),m.completes.clear();for(let b of d)b instanceof Kn?(m.canShovePath.add(b),m.completes.add(b),this.checkListOtherConnect(b,m)):b instanceof bs&&m.canShoveVia.add(b);m.max=c,Nt.pushFilter.setFilterMode(3);let g=this.aroundPath(a,l,m,h);this.add2Commands(p,g),this.filterAwaitShoveItem(m.awaitShove);let y=this.continuousCollide(a,l,m,h);this.add2Commands(p,y),c=m.max,Nt.pushFilter.setFilterMode(0),this.addAroundCommand(p),this.add2Commands(u,p),Nt.pushFilter.setNet(null,null),this.filterAwaitShoveItem(m.awaitShove);for(let b of a)if(!r.includes(b)&&!d.includes(b))if(b instanceof bs){let P=!1;for(let[T]of b.connectTrack)!r.includes(T)&&T.size()>0&&(r.push(T),P=!0);P||r.push(b)}else r.push(b);if(m.awaitShove.size==0)break;{Re.addAllSet(i,m.awaitShove),a=a.reverse(),l=l.reverse();let b=new Array;for(let P of d)(P instanceof bs||!a.includes(P))&&b.push(P);d=b}if(s++,s>=8)break}while(!this.interrupt);return Nt.filter=n,Nt.useShoveTree=!1,u}checkListOtherConnect(t,e){if(t.otherNode.prev!=null){let r=t.otherNode.prev;if(r instanceof Je){let i=yc.getInstance().getNode(r);for(let[n]of i.connectTrack)n==t||n.size()==0||e.canShovePath.add(n)}else r instanceof Kn&&e.canShovePath.add(r)}if(t.otherNode.next!=null){let r=t.otherNode.next;if(r instanceof Je){let i=yc.getInstance().getNode(r);for(let[n]of i.connectTrack)n==t||n.size()==0||e.canShovePath.add(t)}else r instanceof Kn&&e.canShovePath.add(r)}}checkCollide(t,e,r,i,n){let s=new Map;if(n.size()>0){if(t.setFilterMode(3),e instanceof Kn){let a=this.getCollideOrderTracks(e,r);this.getListCollideResult1(a,s,i,t,n)}else this.getListCollideResult2(e,s,i,t,n);t.setFilterMode(0)}return s}filterAwaitShoveItem(t){let e=Array.from(t);for(let r of e)if(r instanceof yt){let i=xt.getInstance().getNode(r);i!=null&&i.ignore&&t.delete(r)}}setShoveTrackFilter(t){let e=new RF;this.canPushViaLevel==0?e.setSolidViaFilterMode():e.setSolidFilterMode();for(let r of t)this.lists.includes(r)?e.addObastacleList(r):e.addAroundList(r);return e}hasCollides(t,e){Nt.setPushFilter();for(let r of t)if(r instanceof bs){if(this.blockShape.collideVia(r.item).length>0)return!0}else{Nt.pushFilter.setNet(r.getFirst().net,new Set([r.getFirst()]));let i=r.listIterator();for(;i.hasNext();){let n=i.next(),s=n.item,a=Fr.getInstance().getStatus(n);if(this.isChangeNode(n)&&(e&&!a.isReversePush||!e&&a.isReversePush)){let l=this.blockShape.checkTrackDRC(s);if(a.checkDRC=!l,l)return!0}}}return!1}setFilter4Solid(t){Nt.setPushFilter(),this.canPushViaLevel==0?Nt.pushFilter.setSolidViaFilterMode(!this.hugPrefered):Nt.pushFilter.setSolidFilterMode(!this.hugPrefered);for(let e of t)Nt.pushFilter.addWaitList(e);for(let e of this.obstacles)Nt.pushFilter.addListObstacles(e)}getNode(t){let e=xt.getInstance().getNode(t);return e!=null&&e.ignore||(e==null&&(new ku(t).generateList(),e=xt.getInstance().getNode(t)),this.all.has(e.parent)||(this.clearCollideInfo(e.parent),this.all.add(e.parent))),e}aroundObstacles(t,e){hi.getInstance().update();let r=new o9(this.endTime-performance.now());r.direct=this.direct;let i=new Br("aroundObstacles"),n=!0,s=Array.from(t);for(e.completes.clear();s.length>0&&!this.interrupt&&this.endTime>performance.now();){e.awaitingVias.clear();let a=s.shift(),l=new Br;if(hi.getInstance().update(),Nt.pushFilter.addAroundList(a),a instanceof Kn){if(a.size()==0)continue;e.completes.add(a);let c=this.getAroundTracks(a,e,l);Nt.pushFilter.setNet(a.getFirst().net,new Set(c));let h;try{h=this.around(c,a,r,l,e)}catch(u){console.log(u),r.success=!1}if(Nt.pushFilter.setNet(null,null),Nt.pushFilter.clearRepeatAroundList(),(!(this.lists.includes(a)&&r.inputEndpointCanModify)||this.lists.includes(a)&&this.hugPrefered&&!this.isShove)&&!r.success){if(this.hugPrefered&&(this.hugPrefered=!1),l.undo(),Ju.getInstance().undo(),this.isWire&&this.lists.includes(a)){let u=a.getLastNode(),d=Fr.getInstance().getStatus(u);d.checkDRC=!1}this.add2AwaitShove(c,e),l=new Br}else{if(this.isWire&&r.inputEndpointCanModify&&!r.success&&a.viaNode.next!=null&&h.length>0){this.add2AwaitShove([h[h.length-1]],e);for(let d of e.awaitingVias)e.awaitShove.add(d)}this.addAroundCommand(l);let u=0;for(;u<s.length&&h!=null&&h.length>0;){let d=s[u];if(d instanceof Kn){new s9(d.toArray()).getShoveTracks(h,e);break}u++}}Nt.pushFilter.addAroundList(a)}else if(e.awaitShove.has(a)){let c=!1;for(let[h,u]of a.connectTrack)this.getViaCollideNextTracks(h,u,e,l).length>0&&(c=!0);if(!c){let h=a.item,u=new p_(a,l,e,this.endTime,e.completes);u.offset(),Nt.pushFilter.addAroundTracks(a),u.success?(hi.getInstance().deleteShoveTree(h),hi.getInstance().addShoveTree(a.item),u.checkShove(a.item),this.updateNext(a,s,e)):(l.undo(),l=new Br,e.awaitShove.add(a))}}this.add2Commands(i,l),Yr.inputClear()}return{success:n,command:i}}getViaCollideNextTracks(t,e,r,i){let n=new Array,s=!1;if(e){let l=t.getFirstNode();for(;l!=null;){if(r.awaitShove.has(l.item))s=!0,n.push(l);else{let c=l.item;if(this.blockShape.blockTrackOnlyTrack(c,c.primitive,!0).length>0)s=!0,n.push(l);else break}l=l.next}}else{let l=t.getLastNode();for(;l!=null;){if(r.awaitShove.has(l.item))s=!0,n.unshift(l);else{let c=l.item;if(this.blockShape.blockTrackOnlyTrack(c,c.primitive,!0).length>0)s=!0,n.unshift(l);else break}l=l.prev}}let a=new Array;if(s){for(let c of n)Fr.getInstance().getStatus(c).change(),a.push(c.item);let l=new n9(a,e?t.viaNode.prev.item:t.viaNode.next.item,i,!e,this.endTime,this.isWire,r);l.offset(),l.getResult()}return a}updateNext(t,e,r){try{if(e.length>0){let i=0;for(;i<e.length&&t!=null;){let n=e[i];if(n instanceof Kn){let s=new s9(n.toArray());t instanceof bs?s.getViaShoveTracks(t.item,r.awaitShove):t.length>0&&s.getShoveTracks(t,r);break}i++}}}catch(i){this.interrupt=!0,console.log(i)}}addAroundCommand(t){let e=Ju.getInstance().asyn();e.size>0&&t.addCommand(new tV(e))}add2Commands(t,e){e.length>0&&t.addCommand(e)}getOptimizeLevel(t){if(this.lists.includes(t))switch(this.inputLevel){case"SUPER":case"STRONG":case"WEAK":return"WEAK";default:return this.inputLevel}switch(this.level){case"SUPER":case"STRONG":case"WEAK":return"WEAK";default:return this.level}}aroundPath(t,e,r,i){let n=new o9(this.endTime-performance.now());n.direct=this.direct;let s=new Br("aroundPath"),a=Array.from(t),l=Array.from(e);for(;a.length>0&&!this.interrupt;){r.awaitingVias.clear();let c=a.shift(),h=l.shift();this.addItem2ShoveTree(c);let u=new Br;if(c instanceof Kn){if(c.size()==0)continue;r.completes.add(c);let d;try{d=this.getCollideTracks(c,h,r,u)}catch(m){this.interrupt=!0,console.log(m),u.undo();break}Nt.pushFilter.setNet(c.getFirst().net,new Set(d)),hi.getInstance().checkModels(d);let p=this.around(d,c,n,u,r);if(Nt.pushFilter.setNet(null,null),Nt.pushFilter.clearRepeatAroundList(),n.success)this.updateShoveRtree(d,p),this.addAroundCommand(u),this.updateNextOrder(p,a,l,r);else{u.undo(),u=new Br,Ju.getInstance().undo(),p.length=0,this.add2AwaitShove(d,r,i);break}this.setCollideInfo(p,h)}else if(r.awaitShove.has(c)){let d=!1;for(let[p,m]of c.connectTrack)this.getViaCollideTracks(p,h,m,r,u).length>0&&(d=!0);if(!d){let p=c.item,m=new p_(c,u,r,this.endTime,r.completes);m.offset(),Nt.pushFilter.addAroundTracks(c),m.success?(hi.getInstance().deleteShoveTree(p),hi.getInstance().addShoveTree(c.item),m.checkShove(c.item),this.updateNextOrder(c,a,l,r)):(u.undo(),u=new Br,r.awaitShove.add(c))}}Nt.pushFilter.addShoveComplete(c),Yr.inputClear(),this.add2Commands(s,u)}return s}updateShoveRtree(t,e){let r=new Set(t);for(let i of e)r.has(i)?r.delete(i):hi.getInstance().addShoveTree(i);for(let i of r)hi.getInstance().deleteShoveTree(i)}around(t,e,r,i,n){if(t.length==0)return[];if(Nt.pushFilter.addAroundTracks(t),t.length>0){let s=this.getIgnoreTracks(e,t);Nt.pushFilter.deleteAroundTracks(s)}return r.level=this.getOptimizeLevel(e),r.isWire=this.isWire,r.find(t,i,n)}add2AwaitShove(t,e,r=null){for(let i of t)!i.isEmpty&&!this.getNode(i).ignore?(e.awaitShove.add(i),r!=null&&r.add(i)):hi.getInstance().deleteShoveTree(i);for(let i of e.awaitingVias)e.awaitShove.add(i)}getViaCollideTracks(t,e,r,i,n){let s=new Array,a=!1;if(r){let c=t.getFirstNode();for(;c!=null&&this.inOrderRange(c,e);)s.push(c),c=c.next;for(;s.length>0;){let h=s.pop();if(i.awaitShove.has(h.item)){a=!0,s.push(h);break}else{let u=h.item;if(this.blockShape.blockTrackOnlyTrack(u,u.primitive,!0).length>0){a=!0,s.push(h);break}}}}else{let c=t.getLastNode();for(;c!=null&&this.inOrderRange(c,e);)s.unshift(c),c=c.prev;for(;s.length>0;){let h=s.shift();if(i.awaitShove.has(h.item)){a=!0,s.unshift(h);break}else{let u=h.item;if(this.blockShape.blockTrackOnlyTrack(u,u.primitive,!0).length>0){a=!0,s.unshift(h);break}}}}let l=new Array;if(a){this.addItem2ShoveTree(t);let c=t.toArray();for(let u of s)Fr.getInstance().getStatus(u).change(),l.push(u.item);let h=new n9(l,r?t.viaNode.prev.item:t.viaNode.next.item,n,!r,this.endTime,this.isWire,i);h.offset(),h.getResult(),this.updateShoveRtree(c,t.toArray())}return l}updateNextOrder(t,e,r,i){try{if(e.length>0){let n=0;for(;n<e.length&&t!=null;){let s=e[n];if(s instanceof Kn){let a=new s9(this.getCollideRange(s,r[n]));t instanceof bs?a.getViaShoveTracks4Order(t.item,r[n],i.awaitShove):t.length>0&&(a.getShoveTracks4Order(t,r[n],i.awaitShove),!i.awaitShove.has(s.viaNode.prev)&&this.canPush(s.viaNode.prev)&&a.checkViaCollide4Tracks(s.viaNode.prev,t,i.awaitShove),!i.awaitShove.has(s.viaNode.next)&&this.canPush(s.viaNode.next)&&a.checkViaCollide4Tracks(s.viaNode.next,t,i.awaitShove));break}n++}}}catch(n){this.interrupt=!0,console.log(n)}}canPush(t){return t==null?!1:!t.isSource||this.canPushViaLevel>0}continuousCollide(t,e,r,i){let n=new Br("continuousCollide"),s=Nt.filter,a=new x0(10),l=this.setShoveTrackFilter([]),c=new Set;for(let g of r.awaitShove){if(g instanceof bs){l.addObstacle(g.item),a.insert(new s0(g.item)),c.add(g);continue}let y=this.getNode(g);if(!y.ignore&&this.equalsOrder(y,-1)){if(y.prev!=null&&!this.equalsOrder(y.prev,-1)||y.next!=null&&!this.equalsOrder(y.next,-1))continue;l.addObstacle(g),a.insert(new s0(g)),c.add(g)}}if(this.interrupt)return n;let h=t.length,u=new Array(h),d=new Array(h),p=new Map;for(let g=0;g<h;g++){let y=t[g];y instanceof bs&&p.set(y,e[g]),u[g]=y,d[g]=e[g]}let m=new Map;for(;u.length>0&&!this.interrupt&&performance.now()<this.endTime;){let g=u.pop(),y=d.pop();if(m.get(y)==g)continue;m.set(y,g);let b=new Br("removeSelfInters and next collide");if(g instanceof Kn){let T=this.removeSelfInters(g,y,r);this.add2Commands(b,T)}let P=this.checkCollide(l,g,y,r.max,a);if(!this.interrupt&&P.size>0){let T=new Array,I=new Array;for(let[E,O]of P)O instanceof bs&&p.has(O)||(t.push(O),e.push(E),T.push(O),I.push(E));r.max=Math.max(r.max,...I),Nt.filter=s,Nt.pushFilter.setFilterMode(3);let C=this.aroundPath(T,I,r,i);this.add2Commands(b,C),Nt.pushFilter.setFilterMode(0),u=Array.from(t),d=Array.from(e);for(let E of r.awaitShove){if(E instanceof bs){if(c.has(E))continue;l.addObstacle(E.item),a.insert(new s0(E.item));continue}let O=this.getNode(E);if(!O.ignore&&this.equalsOrder(O,-1)){if(O.prev!=null&&!this.equalsOrder(O.prev,-1)||O.next!=null&&!this.equalsOrder(O.next,-1)||l.hasObstacle(E)||c.has(E))continue;l.addObstacle(E),a.insert(new s0(E))}}}this.add2Commands(n,b)}return n}removeSelfIntersection(t,e,r){if(t==null)return;let i=new Br,n=new joe(this.endTime-performance.now()),s=!1;for(let l of t)if(e.awaitShove.has(l)){s=!0;break}let a=n.removeSelf(t,i,e);if(n.success?this.addAroundCommand(i):(i.undo(),i=new Br,Ju.getInstance().undo(),a.length=0),this.add2Commands(r,i),s)for(let l of a){let c=this.getNode(l);c.ignore||Fr.getInstance().getStatus(c).notChange||e.awaitShove.add(l)}return a}removeSelfInters(t,e,r){let i=new Br("removeSelfInters"),n;try{n=this.getCollideTracks1(t,e)}catch(s){this.interrupt=!0,console.log(s)}if(this.interrupt)return i;if(n.length>0){let s=this.removeSelfIntersection(n,r,i);this.setCollideInfo(s,e)}return i}getCollideOrderTracks(t,e){let r=t.listIterator(),i=new Array;for(;r.hasNext();){let n=r.next();this.equalsOrder(n,e)&&i.push(n.item)}return i}getCollideRange(t,e){let r=t.listIterator(),i=new Array;for(;r.hasNext();){let l=r.next();this.equalsOrder(l,e)&&i.push(l)}let n=i[0];for(;n.prev!=null&&(n=n.prev,!!this.inOrderRange(n,e));)i.unshift(n);let s=i[i.length-1];for(;s.next!=null&&(s=s.next,!!this.inOrderRange(s,e));)i.push(s);let a=new Array;for(let l of i)a.push(l.item);return a}getAroundTracks(t,e,r){let i=t.getFirstNode(),n=t.getLastNode();for(;i!=null&&!(this.isChangeTrack(i)||e.awaitShove.has(i.item)||(i=i.next,i==n)););for(;n!=null&&!(this.isChangeTrack(n)||e.awaitShove.has(n.item)||(n=n.prev,i==n)););let s=!1;for(;i!=null&&i.prev!=null;)if(this.isChangeNode(i.prev))i=i.prev;else{let c=i.item;if(this.blockShape.blockTrackPrimitive(c,c.primitive,!0,!1).length>0)s=!0,i=i.prev;else break}for(;n!=null&&n.next!=null;)if(this.isChangeNode(n.next))n=n.next;else{let c=n.item;if(this.blockShape.blockTrackPrimitive(c,c.primitive,!0,!1).length>0)s=!0,n=n.next;else break}let a=i,l=[];for(;a!=null&&(e.awaitShove.has(a.item)&&(s=!0),l.push(a.item),a!=n);)a=a.next;if(s){i.prev==null&&this.checkPath(t,l,e,r,!0),Nt.pushFilter.setNetAndLayerId(i.item.net,i.item.layerId);let c=!1;return this.getNode(l[l.length-1]).next==null&&(c=this.checkPath(t,l,e,r,!1)),c||this.checkReversePush(t,l,e,r,!1),Nt.pushFilter.setNetAndLayerId(null,null),l}else return Nt.pushFilter.setNetAndLayerId(null,null),[]}getCollideTracks(t,e,r,i){let n=new Array,s=t.getFirst();Nt.pushFilter.setNetAndLayerId(s.net,s.layerId);let a=!1,l=t.listIterator();for(;l.hasNext();){let p=l.next();this.equalsOrder(p,e)&&(n.push(p),!a&&r.awaitShove.has(p.item)&&(a=!0))}let c=n[0];for(;c.prev!=null&&(c=c.prev,!!this.inOrderRange(c,e));){if(r.awaitShove.has(c.item)){a=!0,n.unshift(c);continue}let p=c.item;if(this.blockShape.blockTrackOnlyTrack(p,p.primitive,!0).length>0)a=!0,n.unshift(c);else break}let h=n[n.length-1],u=h.item.width;for(;h.next!=null&&(h=h.next,!!this.inOrderRange(h,e));){if(r.awaitShove.has(h.item)){a=!0,n.push(h);continue}let p=h.item,m=p.width;m>u&&(u=m),p.width=u;let g=this.blockShape.blockTrackOnlyTrack(p,p.primitive,!0);if(p.width=m,g.length>0)a=!0,n.push(h);else break}let d=new Array;if(a){let p=null,m=new Array,g=new Array;for(let b of n)p!=null&&b.item.width!=p&&g.length>0&&(m.push(g),g=new Array),p=b.item.width,g.push(b.item);if(g.length>0&&(m.push(g),g=new Array),m.length>1){d=m[0];for(let b=1,P=m.length;b<P;b++){let T=new qoe(d,m[b],i,!0,this.endTime,this.isWire,r);T.offset(),T.getResult()}}else d=m[0];n[0].prev==null&&this.checkPath(t,d,r,i,!0);let y=!1;this.getNode(d[d.length-1]).next==null&&(y=this.checkPath(t,d,r,i,!1)),y||this.checkReversePush(t,d,r,i,!1)}return Nt.pushFilter.setNetAndLayerId(null,null),d}equalsOrder(t,e){return t!=null?Fr.getInstance().getStatus(t).collideOrder==e:!1}setOrder(t,e){t!=null&&Fr.getInstance().setOrder(t,e)}inOrderRange(t,e){let r=Fr.getInstance().getStatus(t);return!(r.collideOrder!=-1&&r.collideOrder!=e)}getCollideTracks1(t,e){let r=t.listIterator(),i=new Array;for(;r.hasNext();){let u=r.next();Fr.getInstance().getStatus(u).collideOrder==e&&i.push(u)}let n=new Array,s=i[0];for(;s.prev!=null&&(s=s.prev,!(!this.inOrderRange(s,e)||s.item.locked||Ps(s.item)||s.item.getParent()!=null));)n.unshift(s);let a=new Array,l=i[i.length-1];for(;l.next!=null&&(l=l.next,!(!this.inOrderRange(l,e)||l.item.locked||Ps(l.item)||l.item.getParent()!=null));)a.push(l);let c=!1;e:for(;n.length>0;){let u=n.shift(),d=u.item.primitive;for(let p of i){if(u.next==p)continue;let m=p.item.primitive;if(d.bbox().intersection1(m.bbox())&&Tt(d,m)>0){n.unshift(u),c=!0;break e}}}e:for(;a.length>0;){let u=a.pop(),d=u.item.primitive;for(let p of i){if(u.prev==p)continue;let m=p.item.primitive;if(d.bbox().intersection1(m.bbox())&&Tt(d,m)>0){a.push(u),c=!0;break e}}}let h=new Array;if(c){for(let u of n)h.push(u.item);for(let u of i)h.push(u.item);for(let u of a)h.push(u.item)}return h}canOffsetEndVia(t,e){return t!=null&&(this.canOffsetVia(t)||e.awaitShove.has(t))}checkPath(t,e,r,i,n){let s=n?t.viaNode.prev:t.viaNode.next,a=cn.exsitSpaceConstraint(e,!n);if(this.viaOffset(s,e,r,i,n,a))return!0;let c=(n?t.getFirstNode():t.getLastNode()).item,h=this.hugPrefered?[]:this.blockShape.blockTrackPoint(c,n);if(h.length>0||a){if(this.canOffset(t,n)){let u=new yC(e,i,!n,this.endTime,this.isWire,r);u.offset(),u.getResult()}else this.removePointRepeatLine(h,e,r,n);return!0}else return!1}checkReversePush(t,e,r,i,n){let s=n?t.getFirstNode():t.getLastNode();if(Fr.getInstance().getStatus(s).isInput&&this.isWire){let l=n?e[e.length-1]:e[0],c=this.blockShape.blockTrackOther(l,new Set);for(let h of c){let u=h.obstacle;if(u instanceof yt&&Fr.getInstance().getStatus(this.getNode(u)).isReversePush){if(this.canOffset(t,n)){this.get2End(e,!n);let p=new yC(e,i,!n,this.endTime,this.isWire,r);p.offset(),p.getResult()}break}}}}get2End(t,e){if(e){let r=this.getNode(t[t.length-1]);for(r=r.next;r!=null;)t.push(r.item),r=r.next}else{let r=this.getNode(t[0]);for(r=r.prev;r!=null;)t.unshift(r.item),r=r.prev}}viaOffset(t,e,r,i,n,s){if(this.canOffsetEndVia(t,r)){let a=t.item,c=this.blockShape.collideVia(t.item).length>0;if(!c){let h=n?e[0]:e[e.length-1];c=this.blockShape.blockTrackPoint(h,n).length>0,c||(c=n?!h.start.equals1(t.item.center):!h.end.equals1(t.item.center))}if(c||s){let h=new n9(e,t.item,i,!n,this.endTime,this.isWire,r);h.offset(),h.getResult()}else r.awaitShove.has(t)&&(r.awaitShove.delete(t),r.awaitingVias.add(t));return hi.getInstance().deleteShoveTree(a),hi.getInstance().addShoveTree(t.item),!0}return!1}removePointRepeatLine(t,e,r,i){for(let l of t)if(l instanceof yt){let c=this.getNode(l);if(c.ignore||!r.canShovePath.has(c.parent))continue;Nt.pushFilter.deleteAroundList(c.parent),r.awaitShove.add(l)}let n=i?e[e.length-1]:e[0],s=this.getNode(n);if(i?s.next==null:s.prev==null){let l=i?s.parent.viaNode.next:s.parent.viaNode.prev;if(l!=null&&this.canOffsetEndVia(l,r))return;if(l==null&&this.canOffset(s.parent,!i))return}let a=new sV(e,!i);for(let l of a.used){if(!r.canShovePath.has(l))continue;Nt.pushFilter.deleteAroundList(l);let c=this.getChangeTracks(l);for(let h of c)this.getNode(h).ignore||r.awaitShove.add(h)}}getIgnoreTracks(t,e){let r=new Set(e),i=new Array,n=t.listIterator();for(;n.hasNext();){let s=n.next();r.has(s.item)||i.push(s.item)}return i}initAroundPath(t){let e=new S3;for(let r of t)r instanceof bs?e.canShoveVia.add(r):(e.canShovePath.add(r),r.viaNode.prev!=null&&e.canShoveVia.add(r.viaNode.prev),r.viaNode.next!=null&&e.canShoveVia.add(r.viaNode.next),this.checkListOtherConnect(r,e));return e}};var dg=class extends mC{constructor(e=!1,r=200){super();this.canPushViaLevel=2;this.inputLevel="WEAK";this.level="NONE";this.hugPrefered=e,this.timeout=r,Nt.clearParition(),Nt.updateParition()}run(e){Ju.getInstance().clear(),hi.getInstance().update();let i=this.getLists(e,e.command),n=new OX(i,this.timeout,e.direct,this.hugPrefered);n.level=this.level,n.inputLevel=this.inputLevel,n.isWire=this.isWire,n.canPushViaLevel=this.canPushViaLevel,n.shoveMain(),n.command.length>0&&e.command.addCommand(n.command),Nt.clearParition()}run1(e,r,i){Ju.getInstance().clear(),hi.getInstance().update();let s=this.getLists1(e),a=new OX(s,this.timeout,i,this.hugPrefered);a.inputLevel=this.inputLevel,a.canPushViaLevel=this.canPushViaLevel,a.isWire=this.isWire,a.shoveMain(),a.command.length>0&&r.addCommand(a.command),Nt.clearParition()}getLists(e,r){let i=[],n=Nt.filter;Nt.setPushFilter();for(let[s,a]of e.wireMap){if(s.drawing==0&&a.size()>0){Nt.pushFilter.setSolidFilterMode();let l=this.backFix(a,r);if(Nt.pushFilter.setAroundMode(),l){let c=this.getFirstInputStatus(a).item,h=new ri,u=h.createList(),d=h.createTrack(c.layerId,c.start,c.start,c.width,c.net,e.command,c.getGroupID());h.addList(d,u,e.command),u.replace(this.getFirstInputStatus(a),a.getLastNode()),e.command.addCommand(new Ti(u));continue}i.push(a)}if(a.size()==0&&a.viaNode.prev!=null){let l=!1;if(a.viaNode.prev.connectTrack.size>0)for(let[c]of a.viaNode.prev.connectTrack)c.size()>0&&(i.push(c),l=!0);l||i.push(a.viaNode.prev)}}return Nt.filter=n,i}getLists1(e){let r=[];for(let i of e)i instanceof bs?(r.push(i),Fr.getInstance().addInputStatus(i)):i.size()>0&&r.push(i);return r}};var AX=class AX{constructor(t){this.kit=new th(1e-4);this.direct=new S(1,0);this.event=t,this.command=new Br;let e=new _e,r=t.trackNode.parent,i=r.getAllItems();for(let n of i)e.ext1(n.buildBBox());this.bbox=e.build1(),this.pathList=this.event.trackNode.parent,this.startPoint=r.getFirst().start,this.endPoint=r.getLast().end,AX.needclearWireCache=!0}get command(){return this._command}set command(t){this._command=t}getStartPoint(){return this.startPoint}getEndPoint(){return this.endPoint}complete(){this.command=null}interrupt(){var t;_r.getInstance().clear(),(t=this.command)==null||t.undo(),this.command=null,ji.getInstance().view4Status(_r.getInstance().current)}rotate(t){}lock(){return!1}getLengthIncrement(){let t=this.event.trackNode.parent,e=this.getPathList(),r=0;t.getAllItems().forEach(a=>{r+=a.length});let i=this.event.trackNode.item.net,n=ji.getInstance().getMap,s=0;for(let[a,l]of n)l.net==i&&l.isVisible&&(s+=l.length);return s-r}getIntersection(t,e){return Tt(t,e)>0?new S(Ee[0],Ee[1]):null}moveInit(){Yr.init(),AX.needclearWireCache&&this.initClear(),Nt.ignores.clear(),this.command.undo(),this.command=new Br,this.pathList.getAllItems().forEach(r=>{let i=Zl.getInstance().getItem(r.globalIndex);i||(i=pr.getItem(r.globalIndex).model),xt.getInstance().getNode(i)});let e=this.event.trackNode=xt.getInstance().getNode(this.event.trackNode.item);return hi.getInstance().update(),e}initClear(){_r.getInstance().clear(),Ra.getInstance().clear(),Os.getInstance().clear(),Fr.getInstance().clear()}moveEnd(){let t=this.block(),e=ji.getInstance().view4Status(_r.getInstance().current);return this.command.addCommand(e),hi.getInstance().update(),t}block(){return null}isBlock(){return this.event.isBlock()}isPush(){return this.event.isPush()}getWireResult(){this.wireResult=new Kg}around(){this.wireResult||this.getWireResult();let t=this.wireResult;this.shoveHandle(this.command);let e=this.pathList,r=this.generateTrackInfoByItem(e.getFirst(),e.getLast());t.wireMap.set(r,e),t.command=this.command,nX(tr.getInstance().type);let i=new fb;switch(na.getInstance().currentPathOptimization4BePushed){case"OPTIMIZA_STRONG":{i.level="SUPER";break}case"OPTIMIZA_WEAK":{i.level="STRONG";break}case"OPTIMIZA_NONE":{i.level="WEAK";break}default:{i.level="NONE";break}}t.direct=this.direct;try{i.run(t)}catch(s){throw new Error(s)}return this.wireResult=null,t}getPathList(){return this.pathList}shove(){this.wireResult||this.getWireResult();let t=this.wireResult;this.shoveHandle(this.command);let e=this.getPathList(),r=this.generateTrackInfoByItem(e.getFirst(),e.getLast());t.wireMap.set(r,e),t.command=this.command,nX(tr.getInstance().type);let i=new dg(tr.getInstance().mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY");t.direct=this.direct;let n=na.getInstance();switch(n.pushVia){case"OPTIMIZA_OPEN":{i.canPushViaLevel=2;break}case"OPTIMIZA_NONE":{i.canPushViaLevel=0;break}}switch(n.pathOptimization4BePushed){case 1:{i.level="SUPER";break}case 0:{i.level="STRONG";break}case 2:{i.level="WEAK";break}}switch(n.currentPathOptimization4BePushed){case"OPTIMIZA_STRONG":{i.inputLevel="SUPER";break}case"OPTIMIZA_WEAK":{i.inputLevel="STRONG";break}case"OPTIMIZA_NONE":{i.inputLevel="WEAK";break}default:{i.inputLevel="NONE";break}}try{i.run(t)}catch(s){throw new Error(s)}return this.wireResult=null,t}shoveHandle(t){let e=this.getInputTracks(),r=this.blockCheck(e);e.length>0&&this.collideClassify(r,e,t)}getInputTracks(){let e=this.getPathList().listIterator(),r=Fr.getInstance(),i=new Array;for(;e.hasNext();){let n=e.next();r.getStatus(n).isInput&&i.push(n.item)}return i}blockCheck(t){let e=new Map;for(let r of t){let i=this.repairBlock.checkOutLineBlock(r);e.set(r,i)}return e}collideClassify(t,e,r){let i=e[0].start,n=e[e.length-1].end;for(let[s,a]of t)for(let l of a){let c=this.repairBlock.checkOutLineAndModel(l.obstacle,i),h=this.repairBlock.checkOutLineAndModel(l.obstacle,n);if(c!=h&&this.sceneClassify(l.obstacle,l.point,s,r))return}}sceneClassify(t,e,r,i){if(t.layerId==11){if(this.canSplit())return this.splitPath(r,e,i),!0;Nt.ignores.add(t)}else if(t.type=="Partition")return this.splitPath(r,e,i),!0;return!1}canSplit(){let t=this.getPathList();return t.otherNode.next==null&&(t.viaNode.next==null||t.viaNode.next!=null&&!t.viaNode.next.isSource)||t.otherNode.prev==null&&(t.viaNode.prev==null||t.viaNode.prev!=null&&!t.viaNode.prev.isSource)}splitPath(t,e,r){let i=new ri,n=i.createList(),s=i.createTrack(t.layerId,t.start,e,t.width,t.showNet,r,t.getGroupID()),a=i.createTrack(t.layerId,e,t.end,t.width,t.showNet,r,t.getGroupID());i.addList(s,n,r),i.addList(a,n,r),this.wireResult.setInputStatus(n);let c=xt.getInstance().getNode(t);n.replace(c,c),r.addCommand(new Ti(n));let h=xt.getInstance().getNode(a),u=h.parent.getLastNode();for(;h!=null;){let d=Fr.getInstance().getStatus(h);if(d.isInput=!1,d.isSource=!0,d.notChange=!0,h==u)break;h=h.next}}generateTrackInfoByItem(t,e){let r=t.layerId,i=t.end.sub(t.start).normalize(),n=!0,s=go.getSignalLayerIds(null,r),a=new hb(new Set(s),r,t.start,i,n,null),l=new hb(new Set(s),r,e.end,i,n,null),c=new lf(t.net,t.width,t.layerId,i,!1);return c.start=a,c.end=l,c}};AX.needclearWireCache=!0;var l0=AX;var $oe=class{constructor(){this.adsorp=null;this.blockShape=new As;Nt.setPushFilter()}checkTrackIntersection(t){return t?!(this.blockTrack(t).distance1(t.end)>1e-8):!0}blockTrack(t,e=!0){if(t.length==0)return e?t.end:t.start;let r=t.primitive;e||(r=Hp(r));let i=this.blockShape.blockTrackPrimitive(t,r,!0,!1)[0];return i?(this.adsorp=i,i.point):r.end()}getEnd4Block(t){let e=this.adsorp.info.shape.outline,r=t.angle(S.ORIGIN),i=Ae.rotateZ(-r),n=e.multiply3(i.toMatrix3()).bbox();return[n.UL().multiply3(Qe.rotate(r)),n.LL().multiply3(Qe.rotate(r)),n.LR().multiply3(Qe.rotate(r)),n.UR().multiply3(Qe.rotate(r))]}};var E3=class{constructor(t){this.repairLineBlockMax=100;this.blockPrev=!0;this.blockCurr=!0;this.blockNext=!0;this.blockAdsorb=new $oe;this.event=t}updateBlock(){return null}block(){return null}setPre(t){this.previous=t}setNext(t){this.next=t}setCurr(t){this.current=t}isBlock(){return!this.blockPrev||!this.blockNext}blockBaseTrack(t,e,r,i,n=!0){if(!t)return;let s=this.blockAdsorb.blockTrack(t,n),a=n?t.end:t.start;if(s.distance2(a)>1e-8&&e){let l=this.blockAdsorb.getEnd4Block(r);Re.addAll(i,l),i.push(s)}}sortEnds(t,e){let r=e.map(i=>{let s=ir.foot(t,i).distance2(i);return{point:i,dis:s}});return xr(r,(i,n)=>i.dis-n.dis,0,r.length),r.map(i=>i.point)}getEnd(t,e){let r=Number.MAX_VALUE,i=e[0];for(let n of e){let a=ir.foot(t,n).distance2(n);ne.less(a,r)&&(r=a,i=n)}return i}checkOutLineBlock(t,e=!0){let r=new As,i=r.clearanceUtils.getMaxClearance(),n=t.primitive.bbox().extendOfSize(i+t.width/2),s=Nt.searchOutline(n).filter(h=>h.layerId==11&&h instanceof lr?h.getMathGraphics().isClose():!1),a=new _d(s),l=t.primitive;return e||(l=Hp(l)),r.blockTrack4Shapes(t,l,!0,a)}checkOutLineAndModel(t,e){let r=t.getMathGraphics();return Jr.inPolygon(e,r instanceof Gt?r.items:[r.asClose()])}getBlockPoint(t,e,r){let i=r?t.start:t.end,n,s=Number.MAX_VALUE;return e.forEach(a=>{let l=a.point,c=l.distance2(i);c<s&&(n=l,s=c)}),n}};var Koe=class extends E3{constructor(e){super(e);this.blockNum=-1;this.moveStart=!0;let r=e.trackNode;this.setCurr(r.item),this.updateBlock()}setMoveStart(e){this.moveStart=e}updateBlock(){this.blockNext=this.blockAdsorb.checkTrackIntersection(this.next),this.blockCurr=this.blockAdsorb.checkTrackIntersection(this.current)}block(){if(this.blockNum>this.repairLineBlockMax)return this.blockNum=-1,null;let e;this.blockAdsorb.adsorp=null;let r=!this.moveStart;if(this.current){let i=this.blockAdsorb.blockTrack(this.current,r),n=this.current.end;r||(n=this.current.start),i&&i.distance2(n)>1e-8&&this.blockCurr&&(e=i)}if(this.next&&!e){let i=this.blockAdsorb.blockTrack(this.next,r),n=this.next.end;r||(n=this.next.start),i&&i.distance2(n)>1e-8&&(e=i)}return e?this.blockNum++:this.blockNum=-1,e}};var Zoe=class extends l0{constructor(e){super(e);this.moveStart=!0;this.next=new M(this.event.oldStart,this.event.oldStart),this.repairBlock=new Koe(e)}movePointOffset(e,r){let i;r?i=this.event.oldStart.add(e):i=this.event.oldEnd.add(e),this.modifyPoint(i,r)}moveOffset(){}moveByIntercept(e,r,i,n){if(this.moveStart=n,e.some(s=>s.length()>1e-8)){this.moveInit();let s=this.event.trackNode,a=s.item.primitive,l=ir.foot(new M(a.start(),a.end()),e[0].start()),c=new bc(l,r,e).result;if(c.length){let h=c[0].end(),u=n?this.event.oldEnd:this.event.oldStart,d=h.sub(u);if(i.dot(d)>-1e-8&&Math.abs(i.cross(d))<1e-8){let p=[u];for(let m of c)p.push(m.end());return p=p.length>3?p.slice(0,4):p,n&&p.reverse(),this.repairBlock.setMoveStart(this.moveStart),this.changePath(p,s.item),!0}}this.moveEnd()}return!1}move(e,r){}modifyPoint(e,r){this.moveInit();let i=this.event.trackNode.item;this.moveStart=r,this.event.oldStart.equals(i.start)||(this.moveStart=!r),this.repairBlock.setMoveStart(this.moveStart),e=this.event.adsorb(e,i.width,i.layerId),this.moveStart?this.modifyStart(e):this.modifyEnd(e)}block(){let e,r=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.isBlock())e=this.repairBlock.block();else if(this.isPush()){this.shove();let i=this.getPathList();this.moveStart?this.event.start=i.getFirst().start:this.event.end=i.getLast().end}return this.event.adsorpTrackSetting=r,e}modifyStart(e){let r=this.event.trackNode.item,i=r.end,n=this.event.start.sub(this.event.end).normalize(),s=this.draw(i,e,n).reverse();this.event.start=s[1],this.changePath(s,r)}modifyEnd(e){let r=this.event.trackNode.item,i=this.event.end.sub(this.event.start).normalize(),n=this.draw(r.start,e,i);this.event.end=n[1],this.changePath(n,r)}changePath(e,r){let i=new ri,n=i.createList();for(let h=1;h<e.length;h++){let u=e[h-1],d=e[h],p=i.createTrack(r.layerId,u,d,r.width,r.showNet,this.command,r.getGroupID());i.addList(p,n,this.command)}let s,a=Array.from(e);this.moveStart?(s=n.getLast().globalIndex,a.reverse(),this.repairBlock.setCurr(n.getLast()),this.repairBlock.setNext(n.getFirst()),this.event.start=e[1]):(this.repairBlock.setCurr(n.getFirst()),this.repairBlock.setNext(n.getLast()),s=n.getFirst().globalIndex,this.event.end=e[1]);let l=a[1];this.next=new M(l,l),a.length>2&&(this.next=new M(l,a[a.length-1])),this.getWireResult(),this.wireResult.setInputStatus(n),n.replace(this.event.trackNode,this.event.trackNode),this.command.addCommand(new Ti(n)),_r.getInstance().current.setTrackSelect(s);let c=this.moveEnd();c&&this.modifyPoint(c,this.moveStart)}draw(e,r,i){let s=new no().degree45(i,e,r);return this.next=new M(s[1],s[2]),s}complete(){let e,r=this.getPathList();this.moveStart?e=r.getFirst().globalIndex:e=r.getLast().globalIndex,super.complete(),this.event.resultId=e}};var Joe=class extends E3{constructor(e,r,i,n,s){super(e);this.blockNum=-1;this.rangeStart=s,this.angleType=n,this.setPre(r),this.setNext(i),this.updateBlock()}setDirect(e){this.endDirect1=e}setNext2(e){this.next2=e}updateBlock(){this.blockPrev=this.blockAdsorb.checkTrackIntersection(this.previous),this.blockNext=this.blockAdsorb.checkTrackIntersection(this.next),this.blockCurr=this.blockAdsorb.checkTrackIntersection(this.current)}block(){if(this.blockNum>this.repairLineBlockMax)return this.blockNum=-1,null;let e;if(this.blockAdsorb.adsorp=null,(!this.blockPrev||!this.blockNext||!this.blockCurr)&&this.updateBlock(),this.angleType==2){if(this.previous){let r=this.blockAdsorb.blockTrack(this.previous),i=this.previous.end;r.distance2(i)>1e-8&&this.blockPrev&&(e=r)}if(this.next&&!e){let r=this.blockAdsorb.blockTrack(this.next),i=this.next.end;r.distance2(i)>1e-8&&this.blockNext&&(e=r)}if(this.current&&this.next2&&!e){let r=this.blockAdsorb.blockTrack(this.current),i=this.blockAdsorb.blockTrack(this.next2,!1),n=r.distance2(this.current.end)>1e-8,s=i.distance2(this.next2.start)>1e-8;if(n&&s){let a=r.sub(this.current.start),l=this.rangeStart.sub(this.current.start),c=i.sub(this.next2.end),h=this.rangeStart.sub(this.next2.end);Math.abs(a.cross(l))>Math.abs(c.cross(h))?e=r:e=i}else n&&!s?e=r:!n&&s&&(e=i)}}else{let r=new Array;if(this.blockBaseTrack(this.previous,this.blockPrev,this.endDirect1,r),this.blockBaseTrack(this.next,this.blockNext,this.endDirect1,r),this.blockBaseTrack(this.current,this.blockCurr,this.endDirect1,r),r.length>0){let i=new M(this.rangeStart,this.rangeStart.add(this.endDirect1));e=this.getEnd(i,r)}}return e?this.blockNum++:this.blockNum=-1,e}};var Qoe=class extends l0{constructor(e,r,i){super(e);this.adsorb=!0;this.angleType=r;let n=this.event.trackNode.item,s=i;this.event.oldStart.equals(n.start)||(s=!s),this.moveStart=s;let a=this.track1Node=s?this.event.trackNode.prev:this.event.trackNode,l=this.track2Node=s?this.event.trackNode:this.event.trackNode.next,c=a.item,h=l.item,u=new _e;u.ext1(c.buildBBox()).ext1(h.buildBBox()),this.bbox=u.build1();let d=c.primitive,p=h.primitive;this.direct1=d.direct,this.direct2=p.direct,this.endDirect1=p.direct,this.endDirect2=d.direct;let m=d.direct.cross(p.direct);switch(r){case 0:{if(Math.abs(this.direct1.x)<1e-8||Math.abs(this.direct2.x)<1e-8)this.endDirect1=new S(1,0);else if(Math.abs(this.direct1.y)<1e-8||Math.abs(this.direct2.y)<1e-8)this.endDirect1=new S(0,1);else if(s){let y=new S(-this.direct2.y,this.direct2.x);this.endDirect1=y.mul(this.direct1.dot(y)).normalize()}else{let y=new S(-this.direct1.y,this.direct1.x);this.endDirect1=y.mul(this.direct2.dot(y)).normalize()}let g=d.direct.cross(this.endDirect1);m*g<0&&(this.endDirect1=this.endDirect1.mul(-1));break}case 1:{this.endDirect1=d.direct.add(p.direct);break}case 2:default:break}if(this.rangeEnd1=d.start(),this.rangeStart=d.end(),this.rangeEnd2=p.end(),this.repairBlock=new Joe(e,c,h,r,this.rangeStart),this.angleType==0||this.angleType==1){let g=this.generateLine(d,this.bbox),y=this.generateLine(p,this.bbox),b=this.bbox.width()+this.bbox.height()+1e4,P=this.getLine2(this.rangeEnd1,this.endDirect1,b),T=this.getLine2(this.rangeEnd2,this.endDirect1,b),I=this.getIntersection(g,T),C=this.getIntersection(y,P);I!=null&&this.inRange(I,c.start,c.end)?this.rangeEnd1=I:this.rangeEnd2=C}this.repairBlock.setDirect(this.endDirect1)}getLine2(e,r,i=1e4){let n=r.normalize().mul(i+r.length());return new M(e.sub(n),e.add(n))}generateLine(e,r){let i=r.width()+r.height()+1e3,n=e.direct.mul(i),s=e.start().sub(n),a=e.end().add(n);return new M(s,a)}inRange(e,r,i){return!!(this.sameDirect(e,r,i)&&this.sameDirect(e,i,r))}sameDirect(e,r,i){let n=e.sub(r).normalize(),s=i.sub(r).normalize();return n.dot(s)>=0}move(e){if(Yr.replay?e=Yr.position||e:Yr.position=e,Yr.pause){Yr.play4Next();return}this.moveInit(),this.track1Node=this.moveStart?this.event.trackNode.prev:this.event.trackNode,this.track2Node=this.moveStart?this.event.trackNode:this.event.trackNode.next;let r=this.event.trackNode.item;this.adsorb&&(e=this.event.adsorb(e,Math.max(r.width/2,.1),r.layerId));let i=!1;this.angleType==1&&(i=!0),i&&this.fixRightAngleLine();let n=new _e().ext1(this.bbox).ext2(e).build1(),s=n.width()+n.height()+1e4,a=this.generateLine(this.track1Node.item.primitive,n),l=this.generateLine(this.track2Node.item.primitive,n),c=this.getLine2(e,this.endDirect1,s),h=null;this.angleType==2?h=this.getLine2(e,this.endDirect2,s):(this.angleType==1||this.angleType==0)&&(h=c);let u=this.getIntersection(c,a),d=this.getIntersection(h,l);if(u!=null||d!=null){let p=this.inRange(u,this.rangeEnd1,this.rangeStart),m=this.inRange(d,this.rangeStart,this.rangeEnd2),g=this.rangeStart.sub(u).normalize(),y=d.sub(this.rangeStart).normalize(),b=g.dot(this.direct1),P=y.dot(this.direct2);p&&!m?P>0?((this.angleType==1||this.angleType==0)&&(u=this.rangeEnd1),d=this.rangeEnd2):(u=this.rangeStart,d=this.rangeStart):!p&&m?b>0?((this.angleType==1||this.angleType==0)&&(d=this.rangeEnd2),u=this.rangeEnd1):(u=this.rangeStart,d=this.rangeStart):!p&&!m&&(b>0&&P>0?(u=this.rangeEnd1,d=this.rangeEnd2):(u=this.rangeStart,d=this.rangeStart));let T=[];if(T.push(this.track1Node.item.start),this.angleType==2){c=this.getLine2(u,this.endDirect1,s),h=this.getLine2(d,this.endDirect2,s);let I=this.getIntersection(c,h);T.push(u,I,d)}else T.push(u,d);T.push(this.track2Node.item.end),this.createByPoint(T)}}block(){let e,r=this.event.adsorpTrackSetting;return this.event.adsorpTrackSetting=!1,this.isBlock()?e=this.repairBlock.block():this.isPush()&&this.shove(),this.event.adsorpTrackSetting=r,e}moveOffset(e){}createByPoint(e){let r=new ri,i=r.createList(),n=this.track1Node.item,s=n;for(let h=1;h<e.length;h++){h>2&&(s=this.track2Node.item);let u=e[h-1],d=e[h],p=r.createTrack(n.layerId,u,d,n.width,n.showNet,this.command,s.getGroupID());r.addList(p,i,this.command)}let a;this.moveStart?a=i.getLast():a=i.getFirst();let l=i.getFirstNode().next;this.repairBlock.setCurr(l.item),i.size()==4&&this.repairBlock.setNext2(l.next.item),this.getWireResult(),this.wireResult.setInputStatus(i),i.replace(this.track1Node,this.track2Node),this.command.addCommand(new Ti(i)),this.event.start=a.start,this.event.end=a.end,_r.getInstance().current.setTrackSelect(a.globalIndex);let c=this.moveEnd();c&&this.move(c)}fixRightAngleLine(){let e=this.direct1,r=this.direct2,i=Math.sqrt(2)/2,n=new S(1,0),s=new S(i,i),a=new S(0,1),l=new S(-i,i),c=[n,s,a,l],h=[e,r],u=e,d=!0,p=!0;for(let O=0;O<2;O++){let _=h[O];for(let R of c){let v=R.cross(_);if(this.kit.lesseq(Math.abs(v),Rl)){u=R,d=!1,O==0?p=!0:p=!1;break}}if(!d)break}let m=this.bbox.width()+this.bbox.height()+1e4,g=new S(-u.y,u.x),y=this.track1Node,b=this.track2Node,P=y.item.primitive,T=b.item.primitive,I=this.getLine2(P.start(),p?u:g,m),C=this.getLine2(T.end(),p?g:u,m),E=this.getIntersection(I,C);if(E!=null){let O=[P.start(),E,T.end()],_=new ri,R=_.createList(),v=this.event.trackNode.item;for(let F=1;F<O.length;F++){let H=O[F-1],z=O[F],G=_.createTrack(v.layerId,H,z,v.width,v.showNet,this.command,v.getGroupID());_.addList(G,R,this.command)}this.track1Node=R.getFirstNode(),this.track2Node=R.getLastNode(),this.getWireResult(),this.wireResult.setInputStatus(R),R.replace(y,b),this.command.addCommand(new Ti(R));let D=this.track1Node.item.primitive,w=this.track2Node.item.primitive;this.rangeStart=E,this.endDirect1=D.direct.add(w.direct),this.repairBlock.setDirect(this.endDirect1)}}};var TD=class extends Bh{constructor(e,r){super();this.oldTrackIds=[];this.path=[];this.oldPoints=[];this.oldTrackIds=e,this.oldPoints=r}addLine(e){this.path.push(e)}displayPath(e){var r;(r=this.path[e])==null||r.display(),A.publish("updateFrame","")}display(){for(let e of this.path)e.display()}remove(){for(let e of this.path)e.remove()}};var ese=class extends E3{constructor(e,r,i){var s,a;super(e);this.blockNum=-1;let n=e.trackNode;this.hasPrev=n.prev?!0:r,this.hasNext=n.next?!0:i,this.setPre((s=n.prev)==null?void 0:s.item),this.setNext((a=n.next)==null?void 0:a.item),this.setCurr(n.item),this.updateBlock()}updateBlock(){this.blockPrev=this.oldPreviousWire?this.blockAdsorb.checkTrackIntersection(this.oldPreviousWire):!0,this.blockNext=this.oldNextWire?this.blockAdsorb.checkTrackIntersection(this.oldNextWire):!0}setNeedUpdatePre(e){this.oldPreviousWire=e}setNeedUpdateNext(e){this.oldNextWire=e}setOldPre(e,r){e&&r?this.oldPre=new M(e,r):this.oldPre=null}setOldNext(e,r){e&&r?this.oldNext=new M(e,r):this.oldNext=null}block(){if(this.blockNum>this.repairLineBlockMax)return this.blockNum=-1,null;let e;this.blockAdsorb.adsorp=null;let r=new Array;if(this.hasPrev&&this.hasNext){let i=new Array,n=new Array;if(this.blockBaseTrack(this.previous,this.blockPrev,this.event.direct,i),this.blockBaseTrack(this.next,this.blockNext,this.event.direct,n,!1),this.blockBaseTrack(this.current,this.blockCurr,this.event.direct,r),r.length>0||i.length>0||n.length>0){let s=[];if(i.length>0&&this.oldPre){let l=this.getEnd(new M(this.oldPre.start(),this.oldPre.end()),i),c=this.getVerticalLen(l,this.previous.start,this.previous.end);s.push(this.event.start.add(c))}else s.push(...i);if(n.length>0&&this.oldNext){let l=this.getEnd(new M(this.oldNext.start(),this.oldNext.end()),n),c=this.getVerticalLen(l,this.next.start,this.next.end);s.push(this.event.start.add(c))}else s.push(...n);if(r.length>0){let l=this.getEnd(new M(this.event.oldStart,this.event.oldEnd),r);s.push(l)}e=this.getEnd(new M(this.event.oldStart,this.event.oldEnd),s).sub(this.event.oldStart)}}else if(this.hasPrev||this.hasNext){this.blockCurr||(this.blockCurr=this.blockAdsorb.checkTrackIntersection(this.current));let i=this.getCheckEnd();if(this.current){let c=this.blockAdsorb.blockTrack(this.current,i),h=i?this.current.end:this.current.start;c.distance2(h)>1e-8&&this.blockCurr&&(i?(this.current.end=c,this.event.end=c):(this.current.start=c,this.event.start=c))}let n,s,a=!1,l;if(this.previous?(this.blockPrev||(this.blockPrev=this.blockAdsorb.checkTrackIntersection(this.previous)),n=this.previous.end,l=this.previous.start,s=this.blockAdsorb.blockTrack(this.previous),a=this.blockPrev):this.next&&(this.blockNext||(this.blockNext=this.blockAdsorb.checkTrackIntersection(this.next)),n=this.next.start,l=this.next.end,s=this.blockAdsorb.blockTrack(this.next,!1),a=this.blockNext),a&&s.distance2(n)>1e-8){let c=this.blockAdsorb.getEnd4Block(this.event.direct);s=this.getInRangePoint(l,s,c,this.event.direct),e=s.sub(i?this.event.oldEnd:this.event.oldStart)}}return e?this.blockNum++:this.blockNum=-1,e}getVerticalLen(e,r,i){let n=e.sub(r),s=i.sub(r).normalize(),a=n.dot(s);return n.sub(s.mul(a))}getInRangePoint(e,r,i,n){let s=r,a=new M(e,r);for(let l of i){let c=this.getPoint4Line(l,a,n);c!=null&&s.distance2(e)>c.distance2(e)&&(s=c)}return s}getCheckEnd(){return!!this.hasPrev}getPoint4Line(e,r,i){let n=new _e().ext1(r.bbox()).ext2(e).ext7(100).build1(),s=n.width()+n.height(),a=this.getLine(e,e.add(i),s),l=this.getLine(r.start(),r.end(),s);return this.getIntersection(a,l)}getLine(e,r,i=1e3){let n=r.sub(e),s=n.normalize().mul(i+n.length());return new M(e.sub(s),e.add(s))}getIntersection(e,r){return Tt(e,r)>0?new S(Ee[0],Ee[1]):null}};var a9=class extends l0{constructor(t){super(t),this.lastMouseOffset=this.event.lastRealMousePosition.sub(this.event.start),this.updateNode();let{startType:e,endType:r}=this.updatePointType();this.startIsOther=this.isConnectOther(e),this.endIsOther=this.isConnectOther(r),this.handleAddSnapFlag(this.event.trackNode,e,r),this.repairBlock=new ese(t,this.startIsOther,this.endIsOther)}updatePointType(){let t=this.start==this.pathList.getFirstNode()?this.pathList.startType:8,e=this.end==this.pathList.getLastNode()?this.pathList.endType:7;return{startType:t,endType:e}}updateNode(){let t=this.event;this.start=t.trackNode,this.end=t.trackNode;let e=t.trackNode,r=t.track.width;for(;e;){let i=e;e=e.prev;let n=e==null?void 0:e.item;if(n==null){this.start=i;break}(n instanceof Oi||Math.abs(n.width-r)>.01)&&(e=null,this.start=i)}for(e=t.trackNode;e;){let i=e;e=e.next;let n=e==null?void 0:e.item;if(n==null){this.end=i;break}(n instanceof Oi||Math.abs(n.width-r)>.01)&&(e=null,this.end=i)}}block(){let t,e=this.event.adsorpTrackSetting;return this.event.adsorpTrackSetting=!1,this.isBlock()?(this.repairBlock.updateBlock(),this.repairBlock.isBlock()?this.around().wireMap.forEach(i=>{this.updatePointByPathList(i)}):t=this.repairBlock.block()):this.isPush()&&this.shove().wireMap.forEach(i=>{this.updatePointByPathList(i)}),this.event.adsorpTrackSetting=e,t}updatePointByPathList(t){let e=Number.MAX_VALUE,r=this.event.start,i=t.getAllItems();i.find(a=>{let l=new M(this.event.start,this.event.start),h=new ir(a.primitive,l).getDistance();return ne.eq(h,0)?(r=this.event.start,!0):(ne.lesseq(h,e)&&(r=a.start,e=h),!1)});let n=Number.MAX_VALUE,s=this.event.end;i.reverse().find(a=>{let l=new M(this.event.end,this.event.end),h=new ir(a.primitive,l).getDistance();return ne.eq(h,0)?(s=this.event.end,!0):(ne.lesseq(h,n)&&(s=a.end,n=h),!1)}),this.event.start=r,this.event.end=s}move(t,e){if(this.lock())return;if(Yr.replay?t=Yr.position||t:Yr.position=t,Yr.pause){Yr.play4Next();return}let r=this.getOffset(e,this.lastMouseOffset)||t;this.moveOffset(r)}calculateStretch(t,e){var G,W,L,B,N,U;let{startNode:r,endNode:i}=this.addGuideLineForConnectOther(t,e);ji.getInstance().view4Status(_r.getInstance().current);let n=t.item,s=n.direct,a=this.getNormalOffset(s,e).normalize();this.direct=a;let l=this,c=t.parent,h=this.startIsOther,u=this.endIsOther,d=this,{resPre:p,resNext:m}=this.calculateMoveRange({offset:e,pathNode:t}),g=H(p.i,!0),y=H(m.i,!1),b=this.getLimit4Offset(this.bbox,e),P=w(g,p.cursor,p.record),T=F(y,m.cursor,m.record);if(g!=p.i||y!=m.i){if(p.endPointCursor<m.endPointCursor){let k=w(g,p.endPointCursor),V=F(y,p.endPointCursor),Y=V.midPoint.sub(k.midPoint),X=Y.length()*z(Y,s),Z=V.midPoint;for(let he=V.index;he!=null;he=this.getNextNode(he)){if(he==t)continue;let re=he.item.primitive;if(this.isCollinear(re,n.primitive)&&Z.equals(re.start())){let se=z(re.direct,s);X+=re.length()*se,Z=re.end(),T.index=he}if(he==m.i)break}let Q=k.midPoint;for(let he=k.index;he!=null;he=this.getPreNode(he)){if(he==t)continue;let re=he.item.primitive;if(this.isCollinear(re,n.primitive)&&Q.equals(re.end())){let se=z(re.direct,s);X+=re.length()*se,Q=re.start(),P.index=he}if(he==this.start)break}let ae=T.start.sub(s.mul(X));P={...P,start:ae,midPoint:ae,end:ae}}else if(p.endPointCursor>m.endPointCursor){let k=w(g,m.endPointCursor),V=F(y,m.endPointCursor),Y=V.midPoint.sub(k.midPoint),X=Y.length()*z(Y,s),Z=k.midPoint;for(let he=k.index;he!=null;he=this.getPreNode(he)){if(he==t)continue;let re=he.item.primitive;if(this.isCollinear(re,n.primitive)&&Z.equals(re.end())){let se=z(re.direct,s);X+=re.length()*se,Z=re.start(),P.index=he}if(he==P.index)break}let Q=V.midPoint;for(let he=V.index;he!=null;he=this.getNextNode(he)){if(he==t)continue;let re=he.item.primitive;if(this.isCollinear(re,n.primitive)&&Q.equals(re.start())){let se=z(re.direct,s);X+=re.length()*se,Q=re.end(),T.index=he}if(he==this.end)break}let ae=P.end.add(s.mul(X));T={...T,end:ae,midPoint:ae,start:ae}}}else D();this.repairBlock.setNeedUpdatePre((G=P.index)==null?void 0:G.item),this.repairBlock.setNeedUpdateNext((W=T.index)==null?void 0:W.item),h&&P.index==r&&(P.start=P.index.item.end,this.repairBlock.setNeedUpdatePre(null)),u&&T.index==i&&(T.end=T.index.item.start,this.repairBlock.setNeedUpdateNext(null));let I=O([P.start,P.midPoint,P.end]),C=O([T.start,T.midPoint,T.end]),E=[].concat(I,C);this.event.start=P.end,this.event.end=T.start;function O(k){let V;return k=k.filter(Y=>V&&Y.equals(V)?!1:(V=Y,!0)),k}let _=new ri,R=_.createList();E.length==1&&E.push(E[0]);let v=null;for(let k=1;k<E.length;k++){let V=E[k-1],Y=E[k],X=_.createTrack(n.layerId,V,Y,n.width,n.showNet,this.command),Z=_.addList(X,R,this.command);if(V.equals(this.event.start)&&Y.equals(this.event.end)){v=Z,X.setGroupID(n.getGroupID());continue}if(v){let Q=(L=T.index)==null?void 0:L.item.getGroupID();Q&&X.setGroupID(Q)}else{let Q=(B=P.index)==null?void 0:B.item.getGroupID();Q&&X.setGroupID(Q)}}if(this.getWireResult(),this.wireResult.setInputStatus(R),h&&P.index!=r){let k=_.createList();k.replace(r,r),this.command.addCommand(new Ti(k))}if(u&&T.index!=i){let k=_.createList();k.replace(i,i),this.command.addCommand(new Ti(k))}return this.replaceLine(R,P,T),this.repairBlock.setPre((N=v==null?void 0:v.prev)==null?void 0:N.item),this.repairBlock.setNext((U=v==null?void 0:v.next)==null?void 0:U.item),this.repairBlock.setCurr(v==null?void 0:v.item),c;function D(){let k=new M(P.midPoint,P.end),V=new M(T.midPoint,T.start),Y=l.getIntersection(k,V);if(Y)P.end=Y,T.start=Y;else{let X=T.index,Z=l.checkIntersection(k,X.item.primitive,b,!0);if(Z){P.end=Z,T.start=Z,T.midPoint=Z;return}let Q=P.index,ae=l.checkIntersection(V,Q.item.primitive,b,!1);ae&&(T.start=ae,P.end=ae,P.midPoint=ae)}}function w(k,V,Y=S.ORIGIN){let X=l.getCurrent(a.mul(V),n.primitive,b),Z=l.calculatePreviousIntersection(t,k,X,b),ae=Z.index.item.start,he=Z.point,re=he.add(Y);return{index:Z.index,start:ae,midPoint:he,end:re}}function F(k,V,Y=S.ORIGIN){let X=l.getCurrent(a.mul(V),n.primitive,b),Z=l.calculateNextIntersection(t,k,X,b),ae=Z.index.item.end,he=Z.point,re=he.add(Y);return{index:Z.index,end:ae,midPoint:he,start:re}}function H(k,V){return k==null?V?d.start:d.end:k}function z(k,V){return k.dot(V)>0?1:-1}}replaceLine(t,e,r){t.replace(e.index,r.index),this.command.addCommand(new Ti(t))}calculatePreviousIntersection(t,e,r,i){for(let n=this.getPreNode(t);n!=null;n=this.getPreNode(n)){let s=this.checkIntersection(r,n.item.primitive,i,!1);if(s!=null)return{index:n,point:s};if(n==e)break}return{index:e,point:e.item.start}}calculateNextIntersection(t,e,r,i){for(let n=this.getNextNode(t);n!=null;n=this.getNextNode(n)){let s=this.checkIntersection(r,n.item.primitive,i,!0);if(s!=null)return{index:n,point:s};if(n==e)break}return{index:e,point:e.item.end}}checkIntersection(t,e,r,i){if(e instanceof M){let n=t.direct,s=e.direct,a=n.cross(s);if(Math.abs(a)>1e-4){let l=this.getLine(e.start(),e.end(),r),c=this.getIntersection(t,l);if(c!=null){let h=e.start(),u=e.end();if(i?(h=c,this.kit.eq(c.distance1(u),0)&&(h=u)):(u=c,this.kit.eq(c.distance1(h),0)&&(u=h)),u.sub(h).normalize().dot(s)>=0)return c}}}return null}getCurrent(t,e,r){let i=e.direct,n=this.getNormalOffset(i,t),s=e.start().add(n),a=e.end().add(n);return this.getLine(s,a,r)}calculateMoveRange(t){let e=this,{offset:r,pathNode:i,noOverNormalLength:n}=t,s=this.bbox,a=this.getLimit4Offset(s,r),l={i:this.getPreNode(i),cursor:0,record:S.ORIGIN,endPointCursor:0},c={i:this.getNextNode(i),cursor:0,record:S.ORIGIN,endPointCursor:0},h={resPre:l,resNext:c},u=i.item,d=u.direct,p=this.getNormalOffset(d,r),m=p.length(),g=p.normalize();if(this.kit.eq(m,0))return h;let y=u.start,b=u.start,P=m,T=m,I=!1,C=!1,E=W.call(this,i,!0),O=W.call(this,i,!1),_=!0,R=!0,v=null,D=null,w=0;for(;(l.cursor<P||c.cursor<T)&&!(v==l.i&&D==c.i);){v=l.i,D=c.i;let L=l.i,B=c.i,N=this.getEndpointInfo(L,B,a),U=N.filter(se=>se.type=="PREVIOUS")[0],k=N.filter(se=>se.type=="NEXT")[0],V=N.filter(se=>se.type=="INTERSECTION")[0];U&&this.calculateEndpointProject([U],y,d,g),k&&this.calculateEndpointProject([k],b,d,g);let Y=!1,X=!1;if((R||_)&&(Y=this.minCornerDealCanMove(L,E,i,m,g,U,l,!0),X=this.minCornerDealCanMove(B,O,i,m,g,k,c,!1)),_){let se=G.call(this,L,E,i,P,U,l,!0);l=se.res,P=se.vLength,I=se.springBack}if(R){let se=G.call(this,B,O,i,T,k,c,!1);c=se.res,T=se.vLength,C=se.springBack}U&&U.projectSameDirect&&(U.projection+=l.cursor),k&&k.projectSameDirect&&(k.projection+=c.cursor);let Z=l.i,Q=c.i,ae=N.filter(se=>!(c.cursor>=T&&se.type=="NEXT"));l.cursor=this.getCursor(ae,P),this.kit.eq(l.cursor,P)&&(l.cursor=P),Y&&(w=l.cursor),y=u.start.add(g.mul(l.cursor)),l.i!=null&&(l.endPointCursor=l.cursor),!I&&U&&U.projectSameDirect&&this.kit.lesseq(U.projection,l.cursor)&&(l.i=this.getNi(l.i,!0));let he=N.filter(se=>!(l.cursor>=P&&se.type=="PREVIOUS"));c.cursor=this.getCursor(he,T),this.kit.eq(c.cursor,T)&&(c.cursor=T),X&&(w=c.cursor),b=u.start.add(g.mul(c.cursor)),c.i!=null&&(c.endPointCursor=c.cursor),!C&&k&&k.projectSameDirect&&this.kit.lesseq(k.projection,c.cursor)&&(c.i=this.getNi(c.i,!1)),_=Z!=l.i,R=Q!=c.i;let re=!1;if(L&&B&&V){let se=V.point,K=this.calculateProjectionLength(L.item.end,u.start,d,g),me=this.calculateProjectionLength(B.item.start,u.start,d,g),Oe=Math.max(K,me),Ie=u.start.add(g.mul(Oe));this.calculateEndpointProject([V],Ie,d,g);let ue=this.calculateProjectionLength(se,u.start,d,g);if(V.projectSameDirect){let Pe=!1;(!I&&this.kit.greatereq(l.cursor,ue)||this.kit.greatereq(z(l),ue))&&(Pe=!0),(!C&&this.kit.greatereq(c.cursor,ue)||this.kit.greatereq(z(c),ue))&&(Pe=!0),Pe&&(l.cursor=ue,c.cursor=ue,l.endPointCursor=ue,c.endPointCursor=ue,l.record=S.ORIGIN,c.record=S.ORIGIN,re=!0)}}if(re=this.fixBreak(c,l,re),re)break}let F=z(l),H=z(c);if(!n&&!this.kit.eq(F,H)){let L=Math.min(F,H),B=Math.max(L,w);return t.offset=g.mul(B),this.calculateMoveRange({...t,noOverNormalLength:!0})}return l.record.equals(S.ORIGIN)?this.repairBlock.setOldPre(void 0,void 0):E&&E.item&&this.repairBlock.setOldPre(E.item.start,E.item.end),c.record.equals(S.ORIGIN)?this.repairBlock.setOldNext(void 0,void 0):O&&O.item&&this.repairBlock.setOldNext(O.item.start,O.item.end),{resPre:l,resNext:c};function z(L){return L.cursor-Math.abs(L.record.dot(g))}function G(L,B,N,U,k,{i:V,cursor:Y,record:X,endPointCursor:Z},Q){if(!L&&!B)return{springBack:!1,vLength:U,res:{i:V,cursor:Y,record:X,endPointCursor:Z}};let ae=this.getNi(V,Q),he=B==null?void 0:B.item.primitive,re=L==null?void 0:L.item.primitive,se=L==null?void 0:L.item,K=N.item.primitive;if(he instanceof M&&re instanceof M&&this.kit.greater(re.length(),0)){if(k.projectSameDirect&&this.isCollinear(re,he)){let me=se.direct.mul(X.length()),Oe=se.start,Ie=se.end,ue=new M(Oe,Ie.add(me)),Pe=this.getTrackMinCorner(ue,K,N.item.width),j=Math.min(Pe,ue.length()),J=re.direct;J.dot(g)>0&&(J=J.mul(-1));let oe=k.point.add(J.mul(j)),pe=this.calculateProjectionLength(oe,K.start(),K.direct,g);this.kit.less(pe,U)&&(X=J.mul(j),U=m+Math.abs(X.dot(g)))}if(ae==null||!k.projectSameDirect||this.isCollinear(re,K)){let me=this.getEndPointCursor(re,K,g);if(this.kit.greatereq(m,me))U=m,X=S.ORIGIN;else if(this.kit.greatereq(U,me)){if(U=me,n){let Oe=Math.abs(X.dot(g)),Ie=me-Oe,ue=Math.max(Ie,m);Oe&&(X=X.mul((me-ue)/Oe))}return{springBack:!0,vLength:U,res:{i:V,cursor:Y,record:X,endPointCursor:Z}}}}}return{springBack:!1,vLength:U,res:{i:V,cursor:Y,record:X,endPointCursor:Z}}}function W(L,B){let N=0,U=L.parent.size(),k=-Math.sqrt(2)/2,V=L.item.primitive,Y=V.direct;for(let X=this.getNi(L,B);X!=null&&N<U;X=this.getNi(X,B)){let Z=X.item.primitive,Q=B?Y.dot(Z.direct.mul(-1)):Y.mul(-1).dot(Z.direct);if(!this.isCollinear(Z,V)&&Q<0&&this.kit.eq(Q,k))return X;N++}return null}}fixBreak(t,e,r){return r}minCornerDealCanMove(t,e,r,i,n,s,{i:a},l){if(!t&&!e)return!1;let c=this.getNi(a,l),h=e==null?void 0:e.item.primitive,u=t==null?void 0:t.item.primitive,d=r.item.primitive;if(h instanceof M&&u instanceof M&&this.kit.greater(u.length(),0)&&(c==null&&s.projectSameDirect||this.isCollinear(u,d)||l&&c==this.start&&this.startIsOther&&c||!l&&c==this.end&&this.endIsOther&&c)){let p=this.getEndPointCursor(u,d,n);if(new th(.01).greatereq(i,p))return!0}return!1}getNi(t,e){return t?e?this.getPreNode(t):this.getNextNode(t):null}getPreNode(t){return this.getPathPrev(t)}getNextNode(t){return this.getPathNext(t)}getCursor(t,e){let r=new Array;r.push(e);for(let n of t)n.projectSameDirect&&r.push(n.projection);return Math.min(...r)}getPathPrev(t){return t==this.start?null:t==null?void 0:t.prev}getPathNext(t){return t==this.end?null:t==null?void 0:t.next}getEndPointCursor(t,e,r){let i=this.calculateProjectionLength(t.end(),e.start(),e.direct,r),n=this.calculateProjectionLength(t.start(),e.start(),e.direct,r);return Math.max(i,n)}getTrackMinCorner(t,e,r){let n=al.getInstance().getTrackMinCorner()*r,s=e.direct,a=new S(-s.y,s.x),l=t.end().sub(t.start()),c=Math.abs(l.dot(s)),h=Math.abs(l.dot(a)),u=Math.max(c,h);if(u>0){let d=n/u;return t.length()*d}return 0}isCollinear(t,e){let r=t instanceof S?t:t.direct,i=e instanceof S?e:e.direct;return this.kit.eq(r.cross(i),0)}calculateEndpointProject(t,e,r,i){for(let n of t){let s=this.calculateProjectionLength(n.point,e,r,i);n.projection=s,n.type=="INTERSECTION"?n.projectSameDirect=this.kit.greater(s,0):n.projectSameDirect=this.kit.greatereq(s,-.001),this.kit.lesseq(s,0)&&(n.projection=0)}}calculateProjectionLength(t,e,r,i){let n=t.sub(e);return this.getNormalOffset(r,n).dot(i)}getEndpointInfo(t,e,r){let i=new Array;if(t!=null&&i.push({point:t.item.start,type:"PREVIOUS",projection:0,projectSameDirect:!1}),e!=null&&i.push({point:e.item.end,type:"NEXT",projection:0,projectSameDirect:!1}),t!=null&&e!=null){let n=this.getLine(t.item.start,t.item.end,r),s=this.getLine(e.item.start,e.item.end,r),a=this.getIntersection(n,s);a!=null&&i.push({point:a,type:"INTERSECTION",projection:0,projectSameDirect:!1})}return i}getLine(t,e,r=1e3){let i=e.sub(t),n=i.normalize().mul(r+i.length());return new M(t.sub(n),t.add(n))}getLimit4Offset(t,e){let r=t.extendOfSize(e.length());return r.width()+r.height()}addGuideLineForConnectOther(t,e){let r=this.startIsOther,i=this.endIsOther,n=t.item,s=n.direct,a=new ri,l,c;if(r){let h=this.start.item,u=this.calculateAddLine(s,e,h.start,!0),d=a.createTrack(n.layerId,u[0],u[1],n.width,n.showNet,this.command,n.getGroupID());l=this.addFirst(d)}if(i){let h=this.end.item,u=this.calculateAddLine(s.mul(-1),e,h.end,!1),d=a.createTrack(n.layerId,u[0],u[1],n.width,n.showNet,this.command,n.getGroupID());c=this.addList(d)}return{startNode:l,endNode:c}}addFirst(t){let e=this.event.trackNode.parent,r=e.insertBefore(this.start,t);return this.start=r,xt.getInstance().set(t,r),this.command.addCommand(new aD(t,e,r)),r}addList(t){let e=this.event.trackNode.parent,r=e.insertAfter(this.end,t);return this.end=r,xt.getInstance().set(t,r),this.command.addCommand(new aD(t,e,r)),r}calculateAddLine(t,e,r,i){let n=this.getNormalOffset(t,e),s=n.length(),a=r.add(n).add(t.mul(s)),l=r.sub(a),c=r.add(l.normalize());return i&&([r,c]=[c,r]),[r,c]}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}isConnectOther(t){return t==null?!1:![5,6,0].includes(t)}handleAddSnapFlag(t,e,r){let i=[],n=t.item.primitive,s=n.end().sub(n.start()).angle(S.ORIGIN),a=[0,1,2,11];a.includes(e)&&t.prev&&i.push({center:t.prev.item.start,rotation:s}),a.includes(r)&&t.next&&i.push({center:t.next.item.end,rotation:s});let c=this.getItems().filter(h=>h==t.item?!1:this.isCollinear(n,h.primitive));for(let h of c)i.push({center:h.start,rotation:s});di.handleAddSnapFlagData(void 0,void 0,i)}getItems(){let t=[],e=this.start;for(;e&&(t.push(e.item),e!=this.end);)e=e.next;return t}getOffset(t,e){if(!t)return null;let r,i=di.snapToSnapFlag(t,!0);if(i)Yr.replay&&(i=Yr.position),r=i.sub(this.event.oldStart);else{let n=new S(t.sceneX,t.sceneY);Yr.replay&&(n=Yr.position),r=n.sub(this.event.oldStart).sub(e)}return r}moveOffset(t){if(Yr.pause)return;this.moveInit();let e=this.event.trackNode.parent.getAllItems(),r=e.map(a=>a.globalIndex),i=e.map(a=>a.start.toString()+","+a.end.toString());this.debug?(Yr.debug&&Yr.inputDebugGraphics(this.debug),this.debug=new TD(r,i)):this.debug=new TD(r,i);let n=this.event.trackNode.parent;if(this.debug){let a=this.event.trackNode.parent.getAllItems();for(let l of a){let c=new M(l.start,l.end);this.debug.addLine(new eo(c,{color:fD.GREEN,id:l.globalIndex}))}}this.updateNode(),this.calculateStretch(this.event.trackNode,t);let s=this.moveEnd();s&&this.moveOffset(s)}};var tse=class extends l0{constructor(e,r,i,n,s){super(e);this.orthogonalFirst=!1;this.moveStart=s;let a=this.event.direct;this.orthogonalFirst=Math.abs(a.cross(new S(0,1)))<Rl||Math.abs(a.cross(new S(1,0)))<Rl,this.startNode=xt.getInstance().getNode(r[0]),r.length>1?this.endNode=xt.getInstance().getNode(r[r.length-1]):this.endNode=this.startNode,this.dragPoint=i,this.fixedPoint=n}move(e,r){}moveOffset(){}repairTrack(e){if(this.lock())return;this.moveInit(),this.dragPoint=this.dragPoint.multiply4(e);let i=new no().degree45Model(this.dragPoint,this.fixedPoint),n=i[0];this.orthogonalFirst&&(n=i[1]);let s=[this.dragPoint,n,this.fixedPoint];this.changePath(s,this.event.trackNode.item)}changePath(e,r){this.moveStart||(e=e.reverse());let i=new ri,n=i.createList(),s=[this.startNode.item,this.endNode.item];for(let a=1;a<e.length;a++){let l=s[a-1]||r,c=e[a-1],h=e[a],u=i.createTrack(r.layerId,c,h,r.width,r.showNet,this.command,l.getGroupID());i.addList(u,n,this.command)}this.getWireResult(),this.wireResult.setInputStatus(n),n.replace(this.startNode,this.endNode),this.command.addCommand(new Ti(n)),this.moveEnd()}getAssociationTrack(){return null}};function iUe(o,t,e,r,i){var b,P,T,I;let n=e[1].sub(e[0]),s=Math.abs(n.cross(new S(0,1)))<Rl||Math.abs(n.cross(new S(1,0)))<Rl,a=t,l=e[e.length-1],h=new no().degree45Model(a,l),u=[a],d=h[0];s&&(d=h[1]),u.push(d),u.push(l),r||(o.reverse(),u.reverse());let p=[],m=o[0];p.push(m),i.addCommand(Te.dispatch(m,"modify")),m.start=u[0],m.end=u[1];let g=o[1];if(g)i.addCommand(Te.dispatch(g,"modify")),g.start=u[1],g.end=u[2],p.push(g);else{let C=m.model.clone();C.start=u[1],C.end=u[2];let E;C instanceof qr?E=pr.addTrackByModel(C,!0):E=pr.addTrackByModel(C,!0),E.partition=x.getInstance().partitionId,i.addCommand(Te.dispatch(E,"add")),p.push(E)}let y=xt.getInstance().getNode(m.model);if(y){let C=y.parent;y.parent.getAllItems().forEach(E=>{xt.getInstance().delete(E)}),xt.getInstance().getListNode(m.model),(P=(b=C.viaNode)==null?void 0:b.prev)==null||P.deleteConnectTrack(C),(I=(T=C.viaNode)==null?void 0:T.next)==null||I.deleteConnectTrack(C)}return p}var rse=class extends l0{constructor(t){super(t)}move(t){if(this.lock())return;if(Yr.replay?t=Yr.position||t:Yr.position=t,Yr.pause){Yr.play4Next();return}let e=t.sub(this.event.lastMousePosition);this.moveOffset(e)}moveOffset(t){this.moveInit();let e;this.event.adsorbtion?(e=this.event.oldStart.add(t),e=di.adsorpGrid(e),t=e.sub(this.event.oldStart)):e=this.event.oldStart.add(t);let r=this.event.trackNode,i=r.item,n=this.event.adsorb(e,i.width,i.layerId).sub(e),s=this.event.oldEnd.add(t),a=this.event.adsorb(s,i.width,i.layerId).sub(s),l=n.length(),c=a.length();l!=0&&c!=0?l<c?t=t.add(n):t=t.add(a):l==0&&c!=0?t=t.add(a):l!=0&&c==0&&(t=t.add(n));let h=this.event.oldStart.add(t),u=this.event.oldEnd.add(t),d=new ri,p=d.createList(),m=d.createTrack(i.layerId,h,u,i.width,i.showNet,this.command,i.getGroupID());d.addList(m,p,this.command),p.replace(r,r),this.command.addCommand(new Ti(p)),this.event.start=h,this.event.end=u,_r.getInstance().current.setTrackSelect(m.globalIndex),this.moveEnd()}rotate(t){_r.getInstance().clear(),this.command.undo(),this.command=new Br;let e=this.event.trackNode.item;e.start=this.event.start,e.end=this.event.end;let r=new _e;if(r.ext1(e.buildBBox()),r.valid()){let l=r.build1().center();e.rotateFor(l,t)}this.event.oldStart=this.event.start=e.start,this.event.oldEnd=this.event.end=e.end;let i=Pi.getInstance(),n=i.realSceneX,s=i.realSceneY;this.event.lastMousePosition=new S(i.sceneX,i.sceneY),this.event.lastRealMousePosition=new S(n,s),_r.getInstance().current.setTrackSelect(e.globalIndex),ji.getInstance().view4Status(_r.getInstance().current)}};var T9e=class extends E3{constructor(t){super(t)}},ise=class extends l0{constructor(t){super(t),this.updateNode();let e=this.start==this.pathList.getFirstNode()?this.pathList.startType:8,r=this.end==this.pathList.getLastNode()?this.pathList.endType:7;this.lastMouseOffset=this.event.lastRealMousePosition.sub(this.event.start),this.handleAddSnapFlag(this.event.trackNode,e,r),this.startIsOther=!0,this.endIsOther=!0;let i=t.connectTracks,n=t.trackNode.parent,s=n.getFirstNode(),a=n.getLastNode();for(this.repairBlock=new T9e(t);s;){if(i.includes(s.item)){this.startTrackNode=s;break}s=s.next}for(;a;){if(i.includes(a.item)){this.endTrackNode=a;break}a=a.prev}}updateNode(){let t=this.event;this.start=t.trackNode,this.end=t.trackNode;let e=t.trackNode;for(;e;){let r=e;e=e.prev;let i=e==null?void 0:e.item;if(i==null){this.start=r;break}i instanceof Oi&&(e=null,this.start=r)}for(e=t.trackNode;e;){let r=e;e=e.next;let i=e==null?void 0:e.item;if(i==null){this.end=r;break}i instanceof Oi&&(e=null,this.end=r)}}move(t,e){if(this.lock())return;if(Yr.replay?t=Yr.position||t:Yr.position=t,Yr.pause){Yr.play4Next();return}let r=this.getOffset(e,this.lastMouseOffset,t);this.moveOffset(r)}moveOffset(t){if(Yr.pause)return;this.moveInit();let e=this.event.trackNode.parent.getAllItems(),r=e.map(n=>n.globalIndex),i=e.map(n=>n.start.toString()+","+n.end.toString());this.debug?(Yr.debug&&Yr.inputDebugGraphics(this.debug),this.debug=new TD(r,i)):this.debug=new TD(r,i),this.calculateStretch(this.startTrackNode,this.endTrackNode,t)}calculateStretch(t,e,r){let i=!1,n=t.parent,s=this.startIsOther,a=this.endIsOther;!s&&!a&&n.getFirstNode().item.start.equals(n.getLastNode().item.end)&&(i=!0);let l=new ri,c=l.createList();this.getItems().forEach(u=>{let d=l.createTrack(u.layerId,u.start,u.end,u.width,u.net,this.command,u.getGroupID()),p=l.addList(d,c,this.command);return u==t.item&&(t=p),u==e.item&&(e=p),_r.getInstance().current.setTrackHidden(u.globalIndex),p}),this.movePathList=c,this.calculateMoveRange(t,e,r),this.moveEnd()}getPathList(){return this.movePathList}calculateMoveRange(t,e,r){var u,d;let i=r,n=this.getLimit4Offset(this.bbox,r),s,a,l,c=!1;for(;!ne.lesseq(i.length(),0)&&(a=this.addPreAssist(t,i)||a,l=this.addNextAssist(e,i)||l,!(s&&s.equals(i)));){s=i;let p=this.getEndpointInfo(t.prev,t,e.next,e,n);this.generateEndInfoDirect(p,i);let m=p.find(_=>_.type=="PREVIOUS");if(a&&m.track==a&&m.projectSameDirect){i=this.stopMoveDirect(i,m.direct),this.generateEndInfoDirect(p,i);break}let g=p.find(_=>_.type=="NEXT");if(l&&g.track==l&&g.projectSameDirect){i=this.stopMoveDirect(i,g.direct),this.generateEndInfoDirect(p,i);break}let y=this.getMoveInfo(p,i),b=i,P=t.parent,T=!1,I,C,E,O;if(y){switch(y.type){case"PREVIOUS":{if(!y.minCorner){let R=y.track.next;y.track.prev==null?y.track.item.end=y.track.item.start:(_r.getInstance().current.setTrackHidden(y.track.item.globalIndex),P.remove(y.track)),y.track=t.prev,R!=t&&(E=R)}break}case"PREVIOUSEND":{if(!y.minCorner){let R=t;t==e?(T=!0,t=t.prev,e=e.next):t=t.next,_r.getInstance().current.setTrackHidden(R.item.globalIndex),P.remove(R)}break}case"NEXT":{if(!y.minCorner){let R=y.track.prev;y.track.next==null?y.track.item.start=y.track.item.end:(_r.getInstance().current.setTrackHidden(y.track.item.globalIndex),P.remove(y.track)),y.track=e.next,R!=e&&(O=R)}break}case"NEXTEND":{if(!y.minCorner){let R=e;t==e?(T=!0,t=t.prev,e=e.next):e=e.prev,_r.getInstance().current.setTrackHidden(R.item.globalIndex),P.remove(R)}break}case"INTER":{T=!0;let R=t;t=t.prev,e=e.next,_r.getInstance().current.setTrackHidden(R.item.globalIndex),P.remove(R);break}}if(b=b.normalize().mul(y.moveDis),y.minCorner){let R=y.type,v=i.sub(b),D=y.direct.dot(v),w;if(c&&(w=i),R=="NEXTEND"||R=="PREVIOUSEND")D!=0&&(i=i.sub(y.direct.mul(D)));else if(R=="PREVIOUS"){let F=y.track.prev;i=F.item.start.sub(F.item.end).normalize().mul(D).add(b),c=!0}else if(R=="NEXT"){let F=y.track.next;i=F.item.end.sub(F.item.start).normalize().mul(D).add(b),c=!0}w&&!ne.lesseq(Math.abs(this.autoNum(w).cross(this.autoNum(i))),0)&&(i=b)}}if(i=this.autoNum(i.sub(b)),T){if(t&&e){this.getInter(t,e,n);break}}else{let _=E||((u=m==null?void 0:m.track)==null?void 0:u.next)||t,R=O||((d=g==null?void 0:g.track)==null?void 0:d.prev)||e,v=this.getConnectTracks(_,R),D=Qe.translate1(b).toMatrix4();if(v.forEach(w=>{w.item.transform(D)}),I=_.prev,_){this.getInter(I,_,n,!0,a,l),I=_.prev,I&&this.deleteInValidTrack(I)&&(I=_.prev,this.getInter(I,_,n,!0,a,l));let w=t.prev;t&&this.deleteInValidTrack(t)&&(t==e?(T=!0,t=w,e=w.next):t=_==t?I.next:_.next,I=t.prev,this.getInter(I,t,n,!0,a,l))}if(C=R.next,R){this.getInter(R,C,n,!1,a,l),C&&this.deleteInValidTrack(C)&&(C=R.next,this.getInter(R,C,n,!1,a,l));let w=e.next;e&&this.deleteInValidTrack(e)&&(t==e?(T=!0,t=w.prev,e=w):e=R==e?C.prev:R.prev,C=e.next,this.getInter(e,C,n,!1,a,l))}if(T){this.getInter(t,e,n);break}}if(t==e)break;if(this.debug){let _=P.getAllItems();for(let R of _){let v=new M(R.start,R.end);this.debug.addLine(new eo(v,{color:fD.GREEN,id:R.globalIndex}))}}}this.deletePreAssist(a),this.deleteNextAssist(l),this.getWireResult();let h=t;for(h||(h=this.getPathList().getFirstNode()),h.prev&&(Fr.getInstance().addInputStatus(h.prev),hi.getInstance().updateTree(h.prev.item)),e!=null&&e.next&&(Fr.getInstance().addInputStatus(e.next),hi.getInstance().updateTree(e.next.item));h&&(Fr.getInstance().addInputStatus(h),_r.getInstance().current.setTrackSelect(h.item.globalIndex),hi.getInstance().updateTree(h.item),h!=e);)h=h.next}block(){let t,e=this.event.adsorpTrackSetting;return this.event.adsorpTrackSetting=!1,this.isBlock()?this.around():this.isPush()&&this.shove(),this.event.adsorpTrackSetting=e,t}deleteInValidTrack(t){if(_r.getInstance().current.getTrackStatus(t.item.globalIndex)!=!1&&this.autoNum(t.item.start).equals1(t.item.end)){let e=t.parent;if(_r.getInstance().current.setTrackHidden(t.item.globalIndex),e.remove(t),e.size()==0)debugger;return!0}return!1}addPreAssist(t,e){if(this.startIsOther){if(t.prev==null&&t){let r=t.parent,i=new ri,n=t.item.direct,s=e.normalize(),a=n.rotateD(S.ORIGIN,135),l=n.rotateD(S.ORIGIN,-135),c=a;s.dot(a)>s.dot(l)&&(c=l);let h=t.item,u=h.start,d=i.createTrack(h.layerId,u.add(c),u,h.width,h.net,this.command);return i.addFirst(d,r,this.command)}return null}}addPreAssist1(t){if(this.startIsOther){if(t.prev==null&&t.next){let e=t.parent,r=new ri,i=t.next.item.direct,n=t.item,s=n.start,a=r.createTrack(n.layerId,s.sub(i),s,n.width,n.net,this.command);return r.addFirst(a,e,this.command)}return null}}addNextAssist(t,e){if(this.endIsOther){if(t.next==null&&t){let r=t.parent,i=new ri,n=t.item,s=n.direct.mul(-1),a=e.normalize(),l=s.rotateD(S.ORIGIN,135),c=s.rotateD(S.ORIGIN,-135),h=l;a.dot(l)>a.dot(c)&&(h=c);let u=n.end,d=i.createTrack(n.layerId,u,u.add(h),n.width,n.net,this.command);return i.addList(d,r,this.command)}return null}}addNextAssist1(t){if(this.endIsOther){if(t.next==null&&t.prev){let e=t.parent,r=new ri,i=t.prev.item.direct,n=t.item,s=n.end,a=r.createTrack(n.layerId,s,s.add(i),n.width,n.net,this.command);return r.addList(a,e,this.command)}return null}}deletePreAssist(t){if(t&&_r.getInstance().current.getTrackStatus(t.item.globalIndex)){let e=t.item.start;t.item.start=this.autoNum(t.item.start.add(t.item.direct))}}deleteNextAssist(t){t&&_r.getInstance().current.getTrackStatus(t.item.globalIndex)&&(t.item.end=t.item.end.sub(t.item.direct))}stopMoveDirect(t,e){let r=t,i=e.dot(r);return i!=0&&(r=r.sub(e.mul(i))),r}getTrackMinCorner(t){return al.getInstance().getTrackMinCorner()*t}getInter(t,e,r,i=!0,n,s){if(!(t&&e))return null;if(ne.lesseq(Math.abs(this.autoNum(t.item.direct).cross(this.autoNum(e.item.direct))),0)){let h=e.parent;if(i){if(n==t&&this.deletePreAssist(n),e.item.start=t.item.start.clone(),_r.getInstance().current.setTrackHidden(t.item.globalIndex),h.remove(t),h.size()==0)debugger}else if(s==e&&this.deleteNextAssist(s),t.item.end=e.item.end.clone(),_r.getInstance().current.setTrackHidden(e.item.globalIndex),h.remove(e),h.size()==0)debugger;return}let a=this.getLine(t.item.start,t.item.end,r),l=this.getLine(e.item.start,e.item.end,r),c=this.getIntersection(a,l);return c&&(t.item.end=c,e.item.start=c),null}getLine(t,e,r=1e3){let i=e.sub(t),n=i.normalize().mul(r+i.length());return new M(t.sub(n),t.add(n))}getLimit4Offset(t,e){let r=t.extendOfSize(e.length());return r.width()+r.height()}getConnectTracks(t,e){let r=t,i=new Array;for(;r!=e&&r;)i.push(r),r=r.next;return r&&i.push(r),i}getMoveInfo(t,e){let r=Number.MAX_VALUE,i,n=e.normalize(),s=e.length();for(let a of t)if(a.projectSameDirect){let l=Math.max(a.projection-a.minCorner,0),c=a.direct.dot(n),h=l/c;s>=h&&r>h&&(i=a,r=h,i.moveDis=h)}return i}generateEndInfoDirect(t,e){t.forEach(r=>{r.direct.dot(e)>0?r.projectSameDirect=!0:r.projectSameDirect=!1})}getEndpointInfo(t,e,r,i,n){let s=new Array,a=this.getTrackMinCorner((t||r).item.width);if(t!=null){let l=t.item,c=e.item,h=this.getVertical(l.start,l.end,c.end),u=a,d=e.next;(!d||ne.eq(this.autoNum(d.item.direct).cross(this.autoNum(t.item.direct)),0))&&(u=0),s.push({direct:h.normalize(),type:"PREVIOUSEND",projection:h.length(),projectSameDirect:!1,minCorner:u});let p=0;if(t.prev&&this.isValidLine(l.start,l.end,c.end)&&!ne.eq(this.autoNum(t.prev.item.direct).cross(this.autoNum(e.item.direct)),0)){let g=t.prev;if(!g||this.isValidLine(g.item.start,l.start,l.end)){let y=this.getVertical(c.end,l.end,l.start).mul(-1);ne.lesseq(y.length(),u)?(c=t.item,t=t.prev,l=t.item):p=u}}let m=this.getVertical(c.end,l.end,l.start).mul(-1);s.push({direct:m.normalize(),type:"PREVIOUS",projection:m.length(),projectSameDirect:!1,minCorner:p,track:t})}if(r!=null){let l=r.item,c=i.item,h=this.getVertical(l.end,l.start,c.start),u=a,d=i.prev;(!d||ne.eq(this.autoNum(r.item.direct).cross(this.autoNum(d.item.direct)),0))&&(u=0),s.push({direct:h.normalize(),type:"NEXTEND",projection:h.length(),projectSameDirect:!1,minCorner:u});let p=0;if(r.next&&this.isValidLine(l.end,l.start,c.start)&&!ne.eq(this.autoNum(r.next.item.direct).cross(this.autoNum(i.item.direct)),0)){let g=r.next;if(!g||this.isValidLine(l.start,l.end,g.item.end)){let y=this.getVertical(c.start,l.start,l.end).mul(-1);ne.lesseq(y.length(),u)?(c=r.item,r=r.next,l=r.item):p=u}}let m=this.getVertical(c.start,l.start,l.end).mul(-1);s.push({direct:m.normalize(),type:"NEXT",projection:m.length(),projectSameDirect:!1,minCorner:p,track:r})}if(e==i&&t&&r){let l=this.getLine(t.item.start,t.item.end,n),c=this.getLine(r.item.start,r.item.end,n),h=this.getIntersection(l,c);if(h){let u=this.getVertical(e.item.start,e.item.end,h).mul(-1);s.push({direct:u.normalize(),type:"INTER",projection:on(u.length(),4),projectSameDirect:!1,minCorner:0})}}return s}isValidLine(t,e,r){let i=-Math.sqrt(2)/2,n=t.sub(e).normalize(),s=r.sub(e).normalize(),a=n.dot(s);return!!this.kit.eq(a,i)}getVertical(t,e,r){let i=t.sub(e).normalize(),n=r.sub(e),s=i.dot(n),a=i.mul(s).sub(n);return this.autoNum(a)}autoNum(t){return new S(on(t.x,4),on(t.y,4))}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}getOffset(t,e,r){if(!t)return r.sub(this.event.oldStart).sub(e);let i,n=di.snapToSnapFlag(t,!1);return n?i=n.sub(this.event.oldStart):i=new S(t.sceneX,t.sceneY).sub(this.event.oldStart).sub(e),i}handleAddSnapFlag(t,e,r){let i=[],n=t.item.primitive,s=n.end().sub(n.start()).angle(S.ORIGIN),a=[0,1,2,11];a.includes(e)&&i.push({center:this.start.item.start,rotation:s}),a.includes(r)&&i.push({center:this.end.item.end,rotation:s});let c=this.getItems().filter(h=>h==t.item?!1:this.isCollinear(n,h.primitive));for(let h of c)i.push({center:h.start,rotation:s});di.handleAddSnapFlagData(void 0,void 0,i)}getItems(){let t=[],e=this.start;for(;e&&(t.push(e.item),e!=this.end);)e=e.next;return t}isCollinear(t,e){let r=t instanceof S?t:t.direct,i=e instanceof S?e:e.direct;return this.kit.eq(r.cross(i),0)}interrupt(){var t;_r.getInstance().clear(),(t=this.command)==null||t.undo(),this.command=null,this.pathList.getAllItems().forEach(e=>{_r.getInstance().current.setTrackVisible(e.globalIndex)}),ji.getInstance().view4Status(_r.getInstance().current)}};var b5=class b5{constructor(){this.undoCommand=new Array;this.redoCommand=new Array;this.stack=null}static getInstance(){return b5.manager==null&&(b5.manager=new b5),b5.manager}executeCommand(t){this.stack!=null&&(this.undoCommand.push(this.stack),this.stack=null),this.stack=t,this.redoCommand.length>0&&(this.redoCommand.length=0)}redo(){if(this.stack!=null&&(this.undoCommand.push(this.stack),this.stack=null),this.redoCommand.length>0){let t=this.redoCommand.pop();t!=null&&(t.redo(),this.undoCommand.push(t))}}undo(){if(this.stack!=null)this.stack.undo(),this.redoCommand.push(this.stack),this.stack=null;else if(this.undoCommand.length>0){let t=this.undoCommand.pop();t!=null&&(t.undo(),this.redoCommand.push(t))}}undoAll(){for(this.undo();this.undoCommand.length>0;)this.undo()}clear(){this.undoCommand.length=0,this.redoCommand.length=0,this.stack=null}};b5.manager=null;var Rm=b5;var $1=class{constructor(){this.tracks=new Set;this.pads=new Set;this.vias=new Set;this.images=new Set;this.pictures=new Set;this.dimensions=new Set;this.smartDimensions=new Set;this.protractors=new Set;this.radius=new Set;this.polygons=new Set;this.rects=new Set;this.circles=new Set;this.coppers=new Set;this.planezones=new Set;this.components=new Set;this.texts=new Set;this.attrs=new Set;this.lines=new Set;this.arcs=new Set;this.ratlines=new Set;this.drcs=new Set;this.others=new Set}doAction(t){let e=t.model;if(!(e instanceof ki))return;switch(e.modelType){case"Track":case"ArcTrack":{this.tracks.add(t);break}case"Pad":{this.pads.add(t);break}case"Via":{this.vias.add(t);break}case"Image":{this.images.add(t);break}case"Picture":{this.pictures.add(t);break}case"Length Dimension":{this.dimensions.add(t);break}case"Smart Dimension":{this.smartDimensions.add(t);break}case"Protractor Dimension":{this.protractors.add(t);break}case"Radius Dimension":{this.radius.add(t);break}case"Polygon":{this.polygons.add(t);break}case"Rect":{this.rects.add(t);break}case"Circle":{this.circles.add(t);break}case"Copper":{this.coppers.add(t);break}case"Inner":{this.planezones.add(t);break}case"Component":{this.components.add(t);break}case"Text":{this.texts.add(t);break}case"Ratline":{this.ratlines.add(t);break}case"Line":{this.lines.add(t);break}case"Arc":{this.arcs.add(t);break}case"DRCResult":case"DrcComponentSpacing":case"DrcCreepage":case"DrcComponentOverlap":{this.drcs.add(t);break}default:{this.others.add(t);break}}}getProfiles(){let t=new Set;return Re.addAllSet(t,this.polygons),Re.addAllSet(t,this.rects),Re.addAllSet(t,this.circles),t}getResult(t){let e=new Set;for(let r of t)Re.addAllSet(e,this.getResults(r));return e}getResults(t){switch(t){case"Track":case"ArcTrack":return this.tracks;case"Pad":return this.pads;case"Via":return this.vias;case"Image":return this.images;case"Picture":return this.pictures;case"Length Dimension":return this.dimensions;case"Smart Dimension":return this.smartDimensions;case"Protractor Dimension":return this.protractors;case"Radius Dimension":return this.radius;case"Polygon":return this.polygons;case"Rect":return this.rects;case"Circle":return this.circles;case"Copper":return this.coppers;case"Inner":return this.planezones;case"Component":return this.components;case"Ratline":return this.ratlines;case"Text":return this.texts;case"Line":return this.lines;case"Arc":return this.arcs;case"DRCResult":return this.drcs;default:return this.others}}};var mb=class o{constructor(){this.tools=[]}static getInstance(){return o.instance||(o.instance=new o),o.instance}addTool(t){let r=t.event.track;Ve.highlight.isItemHighlighted(r.globalIndex)&&this.tools.push(t)}complete(t){let e=Ve.highlight,r=new er;this.tools.forEach(i=>{i.getPathList().getAllItems().forEach(s=>{let a=s.globalIndex,l=r.getItem(t[a]);l&&e.addHightItem(l)})})}clear(){this.tools.length=0}};var hV=class{constructor(t){this.trackNode=null;this.identify=null;this.commands=null;this.wireCommands=null;this.isMultiRepair=!1;this.point=null;this.adsorbtion=!1;this.isCoSelect=!1;this.direct=null;this.startRatline=[];this.endRatline=[];this.track=t,this.identify=new Nu(t),this.updatePoint(t),this.commands=null,this.lastMousePosition=t.start,Jl.getInstance().init(),Es.getInstance().clear()}updatePoint(t){this._start=this.oldStart=t.start,this._end=this.oldEnd=t.end,this.direct=this.optimizationDirect(this.oldEnd.sub(this.oldStart).normalize())}get start(){return this._start}set start(t){this._start=t;for(let e of this.startRatline)e.start=t}get end(){return this._end}set end(t){this._end=t;for(let e of this.endRatline)e.end=t}getPathList(t){this.wireCommands=new Br,this.commands=new ve("wire"),xt.getInstance().getNode(t.model)||new ku(t.model).generateList(),this.trackNode=xt.getInstance().getNode(t.model);let e=this.wireCommands;this.getRatline();let r=ji.getInstance().view4Status(_r.getInstance().current);return e.addCommand(r),hi.getInstance().update(),this.trackNode.parent}clearRatline(){this.startRatline.forEach(t=>{t.remove()}),this.endRatline.forEach(t=>{t.remove()})}getRatline(){let t=this.track,e=Vh.getNet(t.net);if(!t.net||!e.showRatline)return;let r=t.net,i=ze.getSpecialColor(r);for(let n of t.startRatline){n.hidden();let s=t.start,a;n.startNode!==t?a=n.start:a=n.end,this.startRatline.push(new hr(57,s,a,!0,i))}for(let n of t.endRatline){n.hidden();let s=t.end,a;n.startNode!==t?a=n.start:a=n.end,this.endRatline.push(new hr(57,a,s,!0,i))}}setMultiRepair(t){this.isMultiRepair=t}adsorb(t,e,r,i=!1){this.clearAdsorpPoint();let n=new _e().ext2(t).ext7(e).build1(),s=this.track.net,a=Vt.search(n,(h,u)=>u=="Pad"&&(h==12||h==r)||u=="Via"||(u=="Track"||u=="ArcTrack")&&h==r),l=new Array,c=new $1;a.setFilter(new vd).setFilter(new a0(t.x,t.y)).setAction(c),a.doAction(["Pad","Via","Track","ArcTrack"]);for(let h of c.pads)if(!h.isEmpty&&h.net==s)return this.showAdsorpPoint(h.center),h.center;for(let h of c.vias)if(!h.isEmpty&&h.net==s)return this.showAdsorpPoint(h.center),h.center;for(let h of c.tracks)h.isEmpty||l.push(h);return l.length>0?di.adsorpTrack(t,l[0],i):i?null:t}clearAdsorpPoint(){this.point!=null&&(this.point.remove(),this.point=null)}showAdsorpPoint(t){this.point=new qi(1002,t),setTimeout(()=>{this.point!=null&&(this.point.remove(),this.point=null)},2e3)}optimizationDirect(t){let e;Math.abs(t.x)<1e-8?e=0:e=t.x;let r;return Math.abs(t.y)<1e-8?r=0:r=t.y,new S(e,r)}isPush(){if(this.isMultiRepair)return!1;let t=tr.getInstance();return t.mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"||t.mode=="WIRING_MODE_PUSHAWAY"}isBlock(){if(this.isMultiRepair)return!1;let t=tr.getInstance();return t.mode=="WIRING_MODE_SURROUND"||t.mode=="WIRING_MODE_OBSTRUCT"}complete(t){this.commands&&(this.clearRatline(),this.wireCommands=null,this.commands.commands.forEach(e=>{t.addCommand(e)}),this.commands=null)}interrupt(){var t,e;mb.getInstance().clear(),(t=this.commands)==null||t.undo(),(e=this.wireCommands)==null||e.undo(),this.wireCommands=null,this.commands=null,this.clearRatline()}static complete2(t){let{newIds:e}=ji.getInstance().complete(t);return mb.getInstance().complete(e),e}static clear(){mb.getInstance().clear(),ji.getInstance().clear(),Zl.getInstance().deleteAll(),Rm.getInstance().clear(),_i.getInstance().clear(),hi.getInstance().clear(),xt.getInstance().clear(),Os.getInstance().clear(),_r.getInstance().clear(),gc.getInstance().clear(),Ra.getInstance().clear(),Es.getInstance().clear(),yc.getInstance().clear(),Fr.getInstance().clear(),Jl.getInstance().clear()}};var nse=class extends a9{constructor(){super(...arguments);this.closedSpilt=!1}updateNode(){let e=this.event;this.start=e.trackNode,this.end=e.trackNode;let r=e.trackNode,i=e.track.width;for(;r;){let n=r;r=r.prev,r==null&&(r=e.trackNode.parent.getLastNode());let s=r==null?void 0:r.item;if(r==e.trackNode)break;(s instanceof Oi||Math.abs(s.width-i)>.01)&&(this.closedSpilt=!0,r=null,this.start=n)}if(this.closedSpilt)for(r=e.trackNode;r;){let n=r;r=r.next,r==null&&(r=e.trackNode.parent.getFirstNode());let s=r==null?void 0:r.item;if(r==e.trackNode)break;(s instanceof Oi||Math.abs(s.width-i)>.01)&&(r=null,this.end=n)}else this.start=e.trackNode.parent.getFirstNode(),this.end=e.trackNode.parent.getLastNode()}updatePointType(){let e,r;return this.closedSpilt&&(e=8,r=7),{startType:e,endType:r}}getPreNode(e){let r=this.getPathPrev(e);if(!r){if(this.closedSpilt&&e==this.start)return null;r=e.parent.getLastNode()}return r}getNextNode(e){let r=this.getPathNext(e);if(!r){if(this.closedSpilt&&e==this.end)return null;r=e.parent.getFirstNode()}return r}replaceLine(e,r,i){let n=this.event.trackNode.parent.getFirstNode(),s=this.event.trackNode.parent.getLastNode(),a=new ri,l=this.event.trackNode,c=!1;for(;l&&l!=r.index;){if(l==n){c=!0;break}l=l.prev}if(c){e.replace(r.index,s),this.command.addCommand(new Ti(e));let h=a.createList();h.replace(n,i.index),this.command.addCommand(new Ti(h))}else{let h=!1;for(l=this.event.trackNode;l&&l!=i.index;){if(l==s){h=!0;break}l=l.next}if(h){e.replace(n,i.index),this.command.addCommand(new Ti(e));let u=a.createList();u.replace(r.index,s),this.command.addCommand(new Ti(u))}else e.replace(r.index,i.index),this.command.addCommand(new Ti(e))}}getItems(){let e=[],r=this.start;for(;r&&(e.push(r.item),r!=this.end);)r=r.next,r==null&&(r=this.start.parent.getFirstNode());return e}fixBreak(e,r,i){return(this.getPathPrev(e.i)==this.getPathNext(r.i)||this.getPathPrev(e.i)==r.i)&&(r.i=this.getNi(r.i,!1),e.i=this.getNi(e.i,!0),i=!0),i}};var cu=class extends hV{constructor(e){super(e);this.adsorpTrackSetting=!0;this.isClickPoint=!1;this.numberOfIterator=0;this.connectTracks=[]}setConnectTrack(e){this.connectTracks=e}getTool(){this.getPathList(this.track);let e=this.identify.startType,r=this.identify.endType;if((e==0||e==4)&&(r==0||r==4))return new rse(this);let i=this.trackNode.parent,n;return!this.isConnectOther(i.startType)&&!this.isConnectOther(i.endType)&&i.getFirst().start.equals(i.getLast().end)?n=new nse(this):n=new a9(this),mb.getInstance().addTool(n),n}isConnectOther(e){return e==null?!1:![5,6,0].includes(e)}getMultiTool(){this.getPathList(this.track);let e=new ise(this);return mb.getInstance().addTool(e),e}getRepairEndTool(){this.getPathList(this.track);let e=new Zoe(this);return mb.getInstance().addTool(e),e}getLineTool(e,r){this.getPathList(this.track);let i=new Qoe(this,e,r);return mb.getInstance().addTool(i),i}getRepairConnectLineTool(e,r,i){let n=this.getConnectPathList(this.track,e,r);if(n){n.tracks.forEach(a=>{r.add(a.globalIndex),i.add(a.globalIndex)});let s=new tse(this,n.tracks,n.start,n.end,n.moveStart);return mb.getInstance().addTool(s),s}return null}needModifyRepair1(e,r){let i=!1;return[3,8,7,12,5,6].includes(e)&&(Bt.checkIsCanEditByItem(r)||(i=!0)),i}adsorb(e,r,i,n=!1){return!Pi.getInstance().adsorb||!this.adsorpTrackSetting?e:super.adsorb(e,r,i,n)}getConnectPathList(e,r,i){if(i.has(e.globalIndex))return null;this.wireCommands=new Br,this.commands=new ve("wire");let n=xt.getInstance().getListNode(e.model);this.trackNode=n;let s=r.equals(e.start),a=[e.model],l,c;if(s){l=e.start;let h=n.next;h&&!h.item.locked&&!Ps(h.item)&&h.item.getParent()==null&&!i.has(h.item.globalIndex)&&h.item instanceof qr?(a.push(h.item),c=h.item.end):c=e.end}else{l=e.end;let h=n.prev;h&&!h.item.locked&&!Ps(h.item)&&h.item.getParent()==null&&!i.has(h.item.globalIndex)&&h.item instanceof qr?(a.unshift(h.item),c=h.item.start):c=e.start}return this.getRatline(),hi.getInstance().update(),{tracks:a,start:l,end:c,moveStart:s}}};var ID=class{constructor(t){this.event=t,this.command=new Br,this.pathList=t.trackNode.parent}getPathList(){return this.pathList}getLengthIncrement(){let t=0;return this.pathList.getAllItems().forEach(r=>{t+=r.length}),t}moveInit(){return _r.getInstance().clear(),this.command.undo(),this.command=new Br,this.pathList.getAllItems().forEach(r=>{let i=Zl.getInstance().getItem(r.globalIndex);i||(i=pr.getItem(r.globalIndex).model),xt.getInstance().getNode(i)}),this.event.trackNode=xt.getInstance().getNode(this.event.trackNode.item)}moveEnd(){this.block();let t=ji.getInstance().view4Status(_r.getInstance().current);this.command.addCommand(t),hi.getInstance().update()}block(){return null}complete(){this.command=null}interrupt(){var t;_r.getInstance().clear(),(t=this.command)==null||t.undo(),this.command=null,ji.getInstance().view4Status(_r.getInstance().current)}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}lock(){return!1}rotate(){}addArc(t,e,r){let i=this.event.trackNode.item,n=i.angle,s=new ro,{center:a,radius:l,startAngle:c,endAngle:h,sweep:u}=s.pointToAngle(t,e,n),d=new ri,p=d.createArcTrack(i.layerId,a,l,c,h,u,i.width,i.net,this.command,i.arcType,i.getGroupID());return d.addList(p,r,this.command)}addArc2(t,e,r,i,n,s){let a=this.event.trackNode.item,l=new ri,c=l.createArcTrack(a.layerId,t,e,r,i,n,a.width,a.net,this.command,a.arcType,a.getGroupID());return l.addList(c,s,this.command)}};var ose=class extends ID{constructor(t,e){super(t),this.moveType=e}move(t){if(this.lock())return;this.moveInit();let e;switch(this.moveType){case 0:e=this.moveStartPoint(t);break;case 2:e=this.moveEndPoint(t);break;case 1:e=this.moveMidPoint(t);break}let r=e.item;this.event.start=r.start,this.event.midPoint=r.midPoint,this.event.end=r.end,this.moveEnd()}moveOffset(t){}moveStartPoint(t){let e=this.event.trackNode,r=e.item,i=r.arcType,s=new ri().createList(),a,l=e;if(i===2){let c=t.angle(r.center),h=r.clone();if(h.startAngle=c,a=this.addArc2(h.center,h.radius,h.startAngle,h.endAngle,h.sweep,s),e.prev){let u=e.prev.item;this.addTrack(u.start,a.item.start,s,u,!0),l=e.prev}}else{if(e.prev){let g=e.prev.item;this.addTrack(g.start,t,s,g),l=e.prev}let c=this.getTangent(r.end).mul(-1),h=this.moveEndpoint(c,r.end,t,!1);a=this.addArc2(h.center,h.radius,h.startAngle,h.endAngle,h.sweep,s);let u=a.item,{startAngle:d,endAngle:p,sweep:m}=u;u.startAngle=p,u.endAngle=d,u.sweep=m==le.CCW?le.CW:le.CCW}return s.replace(l,e),this.command.addCommand(new Ti(s)),_r.getInstance().current.setTrackSelect(a.item.globalIndex),a}addTrack(t,e,r,i,n=!1){let s=new ri,a;if(i instanceof qr)a=s.createTrack(i.layerId,t,e,i.width,i.showNet,this.command,i.getGroupID());else{let l=i.clone();l.start=t,l.end=e,a=s.createArcTrack(i.layerId,l.center,l.radius,l.startAngle,l.endAngle,l.sweep,l.width,i.showNet,this.command,l.arcType,i.getGroupID())}n?s.addFirst(a,r,this.command):s.addList(a,r,this.command)}moveEndPoint(t){let e=this.event.trackNode,r=e.item,i=r.arcType,s=new ri().createList(),a,l=e;if(i===2){let c=t.angle(r.center),h=r.clone();if(h.endAngle=c,a=this.addArc2(h.center,h.radius,h.startAngle,h.endAngle,h.sweep,s),e.next){let u=e.next.item;this.addTrack(a.item.end,u.end,s,u),l=e.next}}else{let c=this.getTangent(r.start),h=this.moveEndpoint(c,r.start,t);if(a=this.addArc2(h.center,h.radius,h.startAngle,h.endAngle,h.sweep,s),e.next){let u=e.next.item;this.addTrack(t,u.end,s,u),l=e.next}}return s.replace(e,l),this.command.addCommand(new Ti(s)),_r.getInstance().current.setTrackSelect(a.item.globalIndex),a}moveMidPoint(t){let e=this.event.trackNode,r=e.item,n=new ri().createList(),a=new ro().point2Angle(r.start,r.end,t),l;return l=this.addArc2(a.center,a.radius,a.startAngle,a.endAngle,a.sweep,n),n.replace(e,e),this.command.addCommand(new Ti(n)),_r.getInstance().current.setTrackSelect(l.item.globalIndex),l}moveEndpoint(t,e,r,i=!0){return new ro().tangentToArc(t,e,r,i)}getTangent(t){let r=this.event.trackNode.item,i=t.sub(r.center).normalize();return this.getDirect(i)}getDirect(t){return this.event.trackNode.item.sweep==le.CCW?new S(-t.y,t.x):new S(t.y,-t.x)}};var sse=class extends ID{constructor(t){super(t),this.startTangent=this.event.startTangent,this.endTangent=this.event.endTangent;let r=t.trackNode.parent.getAllItems(),i=new _e;for(let s of r)i.ext1(s.buildBBox());this.bbox=i.build1();let n=this.event.trackNode.item;if(this.getPre(this.event.trackNode.prev)){let s=this.event.trackNode.prev;this.prevDirect=s.item.direct}else{let s=n.start.sub(n.center).normalize();n.sweep==le.CW?this.prevDirect=new S(s.y,-s.x):this.prevDirect=new S(-s.y,s.x)}if(this.getNext(this.event.trackNode.next)){let s=this.event.trackNode.next;this.nextDirect=s.item.direct.mul(-1)}else{let s=n.end.sub(n.center).normalize();n.sweep==le.CW?this.nextDirect=new S(-s.y,s.x):this.nextDirect=new S(s.y,-s.x)}}getPre(t){return this.startTangent&&t.prev?t.prev:null}getNext(t){return this.endTangent&&t.next?t.next:null}getLimit4Offset(t,e){let r=t.extendOfSize(e.length());return r.width()+r.height()}move(t){if(this.lock())return;let e=t.sub(this.event.lastMousePosition);this.moveOffset(e)}moveOffset(t){let e=this.moveInit(),r=this.getLimit4Offset(this.bbox,t),i=this.getPre(e)?this.getPre(e).item.start:e.item.start.add(this.prevDirect),n=this.getLine(e.item.start,i,r),s=this.getNext(e)?this.getNext(e).item.end:e.item.end.add(this.nextDirect),a=this.getLine(e.item.end,s,r),l=this.getNormalOffset(this.event.direct,t),c=e.item.start.add(l),h=this.event.direct.mul(e.item.length),u=this.getLine(c,c.add(h),r),d=this.getIntersection(u,n),p=this.getIntersection(u,a);if(d!=null&&p!=null){if(this.event.optimizationDirect(p.sub(d).normalize()).dot(this.event.direct)<=0){let g=this.getIntersection(n,a);d=g,p=g}if(d!=null&&p!=null){let g=this.getPre(e)?this.getPre(e).item.start:e.item.start;if(this.event.optimizationDirect(d.sub(g).normalize()).dot(this.prevDirect)<=0){let T=g,I=this.getLine(T,T.add(h),r);d=T,p=this.getIntersection(I,a)}let b=this.getNext(e)?this.getNext(e).item.end:e.item.end;if(this.event.optimizationDirect(p.sub(b).normalize()).dot(this.nextDirect)<=0){let T=b,I=this.getLine(T,T.add(h),r);d=this.getIntersection(I,n),p=T}if(d!=null&&p!=null){let I=new ri().createList(),C=(this.getPre(e)||e).item;if(g.equals(d)||this.addTrack(g,d,I,C),d.equals(p))this.event.start=this.event.midPoint=this.event.end=p;else{let E=this.addArc(d,p,I).item;this.event.start=E.start,this.event.midPoint=E.midPoint,this.event.end=E.end,_r.getInstance().current.setTrackSelect(E.globalIndex)}C=(this.getNext(e)||e).item,p.equals(b)||this.addTrack(p,b,I,C),I.replace(this.getPre(e)||e,this.getNext(e)||e),this.command.addCommand(new Ti(I)),this.moveEnd()}}}}addTrack(t,e,r,i,n=!1){let s=new ri,a=s.createTrack(i.layerId,t,e,i.width,i.net,this.command,i.getGroupID());n?s.addFirst(a,r,this.command):s.addList(a,r,this.command)}getLine(t,e,r){let n=e.sub(t).normalize().mul(r);return new M(t.sub(n),t.add(n))}getIntersection(t,e){return Tt(t,e)>0?new S(Ee[0],Ee[1]):null}};var ase=class extends ID{constructor(t){super(t)}move(t){if(this.lock())return;let e=this.moveInit().item;t=this.event.adsorpTrack(t,e.width,e.layerId);let r=t.sub(this.event.lastMousePosition);this.moveOffset(r)}moveOffset(t){let e=Ae.translate(t.x,t.y,0),r=this.event.trackNode,i=this.event.trackNode.item.clone();i.transform(e),this.event.start=i.start,this.event.midPoint=i.midPoint,this.event.end=i.end;let n=new ri,s=n.createList(),a=n.createArcTrack(i.layerId,i.center,i.radius,i.startAngle,i.endAngle,i.sweep,i.width,i.net,this.command,i.arcType,i.getGroupID());n.addList(a,s,this.command),s.replace(r,r),this.command.addCommand(new Ti(s)),this.curr=a,_r.getInstance().current.setTrackUpdate(a.globalIndex),_r.getInstance().current.setTrackSelect(a.globalIndex),this.moveEnd()}rotate(t=ce.pcbConfig.rotate){_r.getInstance().clear();let e=this.curr,r=this.event.trackNode.item;r.center=e.center,r.radius=e.radius,r.startAngle=e.startAngle,r.endAngle=e.endAngle,r.sweep=e.sweep,this.command.undo(),this.command=new Br;let i=new _e;if(i.ext1(r.buildBBox()),i.valid()){let a=i.build1().center();r.rotateFor(a,t)}this.event.oldStart=this.event.start=r.start,this.event.oldEnd=this.event.end=r.end,this.event.oldMidPoint=this.event.midPoint=r.midPoint;let n=Pi.getInstance();this.event.lastMousePosition=new S(n.sceneX,n.sceneY),_r.getInstance().current.setTrackUpdate(r.globalIndex),_r.getInstance().current.setTrackSelect(r.globalIndex),ji.getInstance().view4Status(_r.getInstance().current)}getLengthIncrement(){return 0}};var TC=class extends hV{constructor(e){super(e);this.startTangent=!1;this.endTangent=!1;this.oldMidPoint=this.midPoint=e.midPoint,this.startTangent=this.identify.startTangent,this.endTangent=this.identify.endTangent,this.resultId=e.globalIndex}get coSelect(){return this.isCoSelect}set coSelect(e){this.isCoSelect=e}getTool(){if(this.getPathList(this.track),this.startTangent||this.endTangent){let e=new sse(this);return mb.getInstance().addTool(e),e}else{let e=new ase(this);return mb.getInstance().addTool(e),e}}getEndTool(e){this.getPathList(this.track);let r=new ose(this,e);return mb.getInstance().addTool(r),r}adsorpTrack(e,r,i){let n=new _e().ext2(e).ext7(r).build1(),s=Vt.search(n,(l,c)=>l==i&&(c=="Track"||c=="ArcTrack")),a=new Array;return s.setFilter(new vd).setFilter(new a0(e.x,e.y)).setAction(new hC(l=>{l.isEmpty||a.push(l)})),s.doAction(["Track","ArcTrack"]),a.length>0?di.adsorpTrack(e,a[0]):e}};var Ap=class{static updateNetLengthMsg(t,e,r){let i=Ss.getInstance(),n=[];e=="Single wiring"?n.push(t.node.net):n=t.tracks.map(m=>m.net),n=n.filter(m=>!w0(m));let s=Array.from(new Set(n)).sort((m,g)=>g==(r==null?void 0:r.net)?1:-1);if(s.length==0&&jt.cancel(),e=="Multi-route wiring"){let m=s.reduce((g,y)=>(g[y]=ze.getNetLength(y)+this.getNetLengthDelta(y),g),{});A.publish("updateNets",{updateNetLength:m,unit:x.getInstance().unit},$()),jt.cancel();return}let a=t.node.net,l,c,h,u,d,p=te.getInstance().getNet(a);if(i.showDiffLength&&p!=null&&p.netDifferential!=null||r&&r.showDiffLength){let m=p.netDifferential.positiveNet.name,g=p.netDifferential.negativeNet.name,y=ze.getNetLength(m),b=ze.getNetLength(g),P=this.getNetLengthDelta(m),T=this.getNetLengthDelta(g),I=P==0?y:P,C=T==0?b:T;l={len_P:I,len_N:C},A.publish("updateNets",{updateNetLength:{[m]:I,[g]:C},unit:x.getInstance().unit},$())}(i.showNetLength&&p!=null||r&&r.showNetLength)&&(s.length==1||a==(r==null?void 0:r.net)?c=this.getNetLengthDelta(a):h=this.getNetLengthDelta(a)),r&&r.restrictLength&&c!=null&&(u=r.additionalLength,d=c-r.netLengthAtBeginning),(c!=null||l!=null||u!=null)&&jt.updateNetLengthMsg2(Pi.getInstance(),{net:a,netLength:c,netLength2:h,diffPairLength:l,additionalLength:u,hasIncreased:d})}static getNetLengthDelta(t){t=t==null?void 0:t.toUpperCase();let e=ze.getSameNetItems(t),r=0;e.forEach(s=>{if(s instanceof Ue&&s.isVisible){let a=s.length;r+=a}else if(s instanceof Le){let a=as.getInstance().getPadLenByModel(s.model);a!=null&&(r+=a)}});let i=ji.getInstance().getMap,n=0;for(let[s,a]of i)a.net==t&&a.isVisible&&(n+=a.length);return n+r}static updateNetLengthMsg2(t,e,r){if(e=="Multi-route wiring"){jt.cancel();return}let i=Ss.getInstance(),n=[];e=="Single wiring"?n.push(t.node.net):n=t.tracks.map(a=>a.net),n=n.filter(a=>!w0(a));let s=Array.from(new Set(n)).sort((a,l)=>l==(r==null?void 0:r.net)?-1:1);s.length==0&&jt.cancel();for(let a of s){let l,c,h,u,d=te.getInstance().getNet(a);if(i.showDiffLength&&d!=null&&d.netDifferential!=null||r&&r.showDiffLength){let p=d.netDifferential.positiveNet.name,m=d.netDifferential.negativeNet.name,g=ze.getNetLength(p),y=ze.getNetLength(m),b=this.getNetLengthDelta(p),P=this.getNetLengthDelta(m),T=b==0?g:b,I=P==0?y:P;l={len_P:T,len_N:I}}if(i.showNetLength&&d!=null&&(s.length==1||a==(r==null?void 0:r.net))||r&&r.showNetLength){let p=ze.getNetLength(a);c=this.getNetLengthDelta(a)}r&&r.restrictLength&&c!=null&&(h=r.additionalLength,u=c-r.netLengthAtBeginning),(c!=null||l!=null||h!=null)&&jt.updateNetLengthMsg2(Pi.getInstance(),{net:a,netLength:c,diffPairLength:l,additionalLength:h,hasIncreased:u})}}static getNetLengthDelta2(t){t=t==null?void 0:t.toUpperCase();let e=ze.getSameNetItems(t),r=0;e.forEach(l=>{if(l instanceof Ue&&l.isVisible){let c=l.length;r+=c}else if(l instanceof Le){let c=as.getInstance().getPadLenByModel(l.model);c!=null&&(r+=c)}});let i=Zl.getInstance().map,s=_r.getInstance().current.trackStatus,a=0;for(let[l,c]of i)s.get(l)&&c.net==t&&(a+=c.length)}};var O3=class extends ci{constructor(){super();this.event=null;this.tool=null;this.source=!1;this.option="OPTIONLEFTUP"}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide"},$());return}this.cancel();break}A.publish("updateFrame","")}addTrack(e,r,i){e.click(),this.event=new cu(e),this.event.lastRealMousePosition=new S(r,i),this.tool=this.event.getTool(),this.start()}addArcTracK(e){e.click(),this.event=new TC(e),this.tool=this.event.getTool(),this.start()}onMouseMove(e){if(this.event!=null&&this.drawing){let r=new S(e.sceneX,e.sceneY);this.tool.move(r,e),jt.updateNetLengthMsg2(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength:this.realTimeNetLength(),net:this.event.track.net})}}onMouseLeftUp(e){if(this.event!=null){this.tool.complete();let r=new ve("repair line");this.event.complete(r),this.tool&&(this.event instanceof cu?cu.complete2(r):TC.complete2(r),cu.clear()),r.length>0&&je.executeCommand(r),A.publish("flushService",""),this.event=null,this.tool=null,this.source&&A.publish("tool","dropdrag"),jt.cancel(),this.end()}else{let r=e.realSceneX,i=e.realSceneY,n=this.select(r,i);n!=null&&(n instanceof Ar?this.addTrack(n,r,i):n instanceof Si&&this.addArcTracK(n)),this.event!=null&&(this.event.lastMousePosition=new S(r,i))}}select(e,r){let i=Wr.pointSelectBeforeFilter(e,r).tracks;return $t.pointFilter(e,r,i)[0]}interrupt(){this.event!=null&&(this.tool.interrupt(),this.event.interrupt(),this.tool&&cu.clear(),this.event=null,this.tool=null,this.source&&A.publish("tool","dropdrag"),jt.cancel(),A.publish("flushService","")),this.end()}cancel(){this.event!=null?this.interrupt():A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:RGe(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"WIRING_MODE":{tr.getInstance().mode=="WIRING_MODE_PUSHAWAY"&&this.tool!=null&&this.tool instanceof a9&&(this.tool.interrupt(),this.event.commands.undo(),this.event.track.isEmpty||this.event.track.visible(),this.addTrack(this.event.track,this.event.lastRealMousePosition.x,this.event.lastRealMousePosition.y)),tr.getInstance().mode=i[1],we.synchronize(),A.publish("flushSelectingInfo",""),this.onMouseMove(Pi.getInstance());break}}A.publish("updateFrame","")}realTimeDiffPairLengthErr(){let e=this.event.track.net,r=te.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;ze.modifyNet(n),ze.modifyNet(s);let a=ze.getNetLength(n),l=ze.getNetLength(s),c=this.getIncrement(this.tool,n,s);return tr.getInstance().mode=="WIRING_MODE_PUSHAWAY"?(a=a+c[0],l=l+c[1]):this.event.track.net==n?a=a+c[2]:l=l+c[2],{len_P:a,len_N:l}}return null}realTimeNetLength(){let e=this.event.track.net,r=te.getInstance().getNet(e);return r!=null&&r.netLengthPhysics!=null?(ze.modifyNet(e),Ap.getNetLengthDelta(e)):0}getIncrement(e,r,i){if(e!=null){let n=0,s=0,a=e.getLengthIncrement();return[n,s,a]}return[0,0,0]}};var I9e=class{constructor(){this.drawingLines=[];this.snapFlags=[];this.filterItems=new Set}adsorpGrid(t){if(!St.getInstance().currentCoord)return this.adsorpPolar(t);let e=St.getInstance().getSnapX(),r=St.getInstance().getSnapY(),i=x.getInstance().origin;if(Pr.hasAlt){let n=x.getInstance().altGridSize.GridX,s=x.getInstance().altGridSize.GridY;e=n.number/10,r=s.number/10;let a=ft.ins;x.getInstance().unit=="mil"?n.unit!=x.getInstance().unit&&(e=a.conversion(n.unit,x.getInstance().unit,e),r=a.conversion(s.unit,x.getInstance().unit,r)):n.unit==x.getInstance().unit&&(e=a.conversion(n.unit,"mil",e),r=a.conversion(s.unit,"mil",r))}return e=e||1,r=r||1,x.getInstance().unit=="mm"&&(e=this.fix4Unit(e),r=this.fix4Unit(r)),new S(this.getValue(t.x-i.x,e)+i.x,this.getValue(t.y-i.y,r)+i.y)}getValue(t,e){if(e==0)return t;let r=t/e,i=Math.floor(r),n=Math.ceil(r),s;return Math.abs(i-r)>Math.abs(n-r)?s=n:s=i,s*e}fix4Unit(t){let e=ft.ins;return xe(e.mil2mm(t),4)*39.37007874015748}pointInPolar(t){let e=x.getInstance().origin,r=St.getInstance().startAngle,i=St.getInstance().endAngle,n=St.getInstance().sweepAngle,s=St.getInstance().minRadius,a=St.getInstance().maxRadius,l=t.sub(e),c=l.length();if(c<s||c>a)return!1;let h=new S(Math.cos(r),Math.sin(r)),u=new S(Math.cos(i),Math.sin(i)),d=l.normalize(),p=h.cross(d),m=u.cross(d);return!!(n<Math.PI&&ne.greatereq(p,0)&&ne.lesseq(m,0)||n>=Math.PI&&(ne.greatereq(p,0)||ne.lesseq(m,0)))}adsorpPolar(t){let e=x.getInstance().origin,r=St.getInstance().startAngle,i=t.sub(e),n=i.normalize();if(this.pointInPolar(t)){let s=St.getInstance().minRadius,a=n.angle(S.ORIGIN);a=a>=0?a:a+Vr;let l=i.length(),c=St.getInstance().radius,h=Math.round((l-s)/c)*c+s,u=St.getInstance().angleDelta,d=0;a>r?d=a-r:d=a-r+Vr;let p=Math.round(d/u)*u+r,m=Math.cos(p),g=Math.sin(p);return isNaN(m)||isNaN(g)||isNaN(h)?t:new S(m,g).mul(h).add(e)}else return t}adsorpTrack(t,e,r=!1){let i=e.primitive,s=new ir(i,new M(t,t)).getLine(),a,l=ce.adsorptionConfig.getSnapDistanceValue(),c=s.start().distance1(t),h=s.end().distance1(t);c<h&&h<l?a=s.end():h<c&&c<l?a=s.start():a=t;let u=a.distance1(e.start),d=a.distance1(e.end);return u>d&&d<l?new S(e.end.x,e.end.y):u<d&&u<l?new S(e.start.x,e.start.y):r?null:a}filterNodes(t,e,r=!1,i=[]){let s=new _e().ext2(t).ext7(1).build1(),a=Vt.search(s),l=new UT;a.setAction(l),a.doAction(["ArcTrack","Track","Pad","Via","Text","Image","Polygon","Rect","Circle","Line","Arc","Component"]);let c=l.items,h=this.getAdsorptionPcbItemClass(e),u=new Array,d=new Array;for(let p of c)if(this.checkFilterNode(p,h,t,e,r,i))if(p instanceof ct)if(p.type!="Line"){d.push(p);for(let m of p.getAllChildrens())u.push(m)}else for(let m of p.getAllChildrens())u.push(m);else u.push(p);return{nonPolygonNodes:u,polygonNodes:d}}getAdsorptionPcbItemClass(t){let e=t instanceof Vo||t instanceof O3||t instanceof O3||t instanceof Vo;return ce.adsorptionConfig.getNeedObjTypes(e)}checkFilterNode(t,e,r,i,n=!1,s=[]){if(!t.isVisible)return!1;let a=this.getLayerId(t),l=be.getLayer(a);if(a&&l&&!l.visible)return!1;if(i instanceof Vo||i instanceof Vo){if(!this.isActiveLayerPcbItem(t))return!1;let h=i;if(!this.isContainWire(t,h))return!1}else if(this.snapOnlyCurrentLayer()&&!this.isActiveLayerPcbItem(t))return!1;return!(this.isDrawingItem(t,i)||n&&Array.from(s).find(h=>t.globalIndex==h.globalIndex||t.getParent()&&t.getParent().globalIndex==h.globalIndex)||e.filter(h=>t instanceof h).length===0||!(t instanceof Ye?t.isInProfile(r.x,r.y):t.isSelect(r.x,r.y)))}snapOnlyCurrentLayer(){return ce.adsorptionConfig.getConfig("Snapping")=="currentLayer"}isActiveLayerPcbItem(t){let e=this.getLayerId(t),r=be.getActiveLayerID();return t instanceof Ge?!!t.isContains(r):!(e&&e!==12&&e!==r)}isContainWire(t,e){let r=this.getNet(t),i=e.getWires();if(r&&i.length>0){let n=!1;for(let s of i)r.toUpperCase()===s.toUpperCase()&&(n=!0);return n}return!0}getLayerId(t){if(t instanceof Ar)return t.layerId;if(t instanceof Ri)return t.layerId;if(t instanceof Si)return t.layerId;if(t instanceof Ye)return t.layerId;if(t instanceof mt)return t.layerId;if(t instanceof vt)return t.layerId;if(t instanceof fr)return t.layerId;if(t instanceof ol)return t.layerId;if(t instanceof ca)return t.layerId;if(t instanceof xa)return t.layerId;if(t instanceof Me)return t.layerId;if(t instanceof fn)return t.layerId;if(t instanceof Ki)return t.layerId}getNet(t){if(t instanceof ds)return t.net}isDrawingItem(t,e){if(e instanceof ko){if(t instanceof mt||t instanceof vt){let r=t.getParent();if(r!=null&&(e.filterItems.has(r)||this.filterItems.has(r)))return!0}return e.filterItems.has(t)||this.filterItems.has(t)}return!1}getDrawingLinePointInfo(t,e){let r,i=Number.MAX_VALUE,n=[],s=ce.adsorptionConfig.getSnapDistanceValue();for(let l of e){let c=!["Line Center"].includes(l),h=a.bind(this,l,s)();for(let u of h){let d=t.distance1(u.point);d<i&&d<u.width?(i=d,r=u.point,n=[{angle:u.rotation,adsorptionObj:c?u.primitive:null}]):Qd(u.point,r)&&n.push({angle:u.rotation,adsorptionObj:c?u.primitive:null})}}return{point:r,distance:i,crossObjs:n};function a(l,c){let h=[];for(let u of this.drawingLines){let{primitive:d}=u;switch(l){case"Endpoint":{let T=d instanceof M?d.end().sub(d.start()).angle(S.ORIGIN):null;h.push({point:d.start(),rotation:T,width:c,primitive:d},{point:d.end(),rotation:T,width:c,primitive:d});break}case"Midpoint":{let T=d instanceof M?d.end().sub(d.start()).angle(S.ORIGIN):null,I=d instanceof M?d.end().add(d.start()).mul(.5):d.midPoint;h.push({point:I,rotation:T,width:c,primitive:d});break}case"Arc/Circle Center Point":{d instanceof q&&h.push({point:d.center,width:c,primitive:d});break}case"Tangent Point":{d instanceof q&&h.push({point:d.center.add(new S(-d.rx,0)),width:c,primitive:d},{point:d.center.add(new S(d.rx,0)),width:c,primitive:d},{point:d.center.add(new S(0,-d.rx)),width:c,primitive:d},{point:d.center.add(new S(0,d.rx)),width:c,primitive:d});break}case"Intersection":case"Perpendicular Foot":case"Region Center":return[];case"Line Center":let p=d instanceof M?d.end().sub(d.start()).angle(S.ORIGIN):null,m=new ir(d,new M(t,t)),g=m.getLine(),y;g.start().distance1(t)<g.end().distance1(t)?y=g.end():y=g.start(),m.getDistance()==0&&(y=t);let b=y.distance1(d.start()),P=y.distance1(d.end());b>P&&P<c?h.push({point:new S(d.end().x,d.end().y),rotation:p,width:c,primitive:d}):b<P&&b<c?h.push({point:new S(d.start().x,d.start().y),rotation:p,width:c,primitive:d}):h.push({point:y,rotation:p,width:c,primitive:d});break}}return h}}getNearestOutlineObjPointInfo(t,e,r){let i,n,s=[],a=!1,l=ce.adsorptionConfig.getSnapDistanceValue();for(let h of r){let u=c(e,h,t);if(u.length)for(let d of u){let p=t.distance1(d.point);if(n==null||p<n){if(["Midpoint","Endpoint","Intersection","Perpendicular Foot","Tangent Point"].includes(h)&&p<l&&(a=!0),h=="Line Center"&&a)continue;n=p,i=d.point,s=[{angle:d.rotation,adsorptionType:h}]}else Qd(d.point,i)&&s.push({angle:d.rotation,adsorptionType:h})}}return{point:i,distance:n,crossObjs:s};function c(h,u,d){switch(u){case"Endpoint":return di.getEndPointInfo(h);case"Midpoint":return di.getMidPointInfo(h);case"Arc/Circle Center Point":return di.getArcCircleCenterPoint(h).map(p=>({point:p}));case"Tangent Point":return di.getTangentPoint(h).map(p=>({point:p}));case"Intersection":case"Perpendicular Foot":case"Region Center":return[];case"Line Center":return di.getLineCenterInfo(h,d)}}}getEndPointInfo(t){let e=[],r;return t instanceof mt?(r=t.end.sub(t.start).angle(S.ORIGIN),e.push({point:t.start,rotation:r},{point:t.end,rotation:r})):t instanceof nr?(r=t.rotation,e=e.concat(t.getEndPoints().map(i=>({point:i,rotation:r})))):t instanceof vt&&e.push({point:t.start},{point:t.end}),e}getMidPointInfo(t){let e=[],r;return t instanceof mt?(r=t.end.sub(t.start).angle(S.ORIGIN),e.push({point:t.midPoint,rotation:r})):t instanceof vt?e.push({point:t.midPoint}):t instanceof nr&&(r=t.rotation,e=e.concat(t.getMidPoints().map(i=>({point:i,rotation:r})))),e}getLineCenterInfo(t,e){let r=[],i=ce.adsorptionConfig.getSnapDistanceValue();if(t instanceof mt||t instanceof vt){let n=t.end.sub(t.start).angle(S.ORIGIN);return this.handleLineCenter(t.start,t.end,t.primitive,e,i,n)}else if(t instanceof nr){let n=t.rotation;t.getPolyline().primitives.forEach(a=>{r=r.concat(this.handleLineCenter(a.start(),a.end(),a,e,i,n))})}else if(t instanceof Sr){let[n,s]=nUe(t,e),a=s.sub(n).angle(S.ORIGIN);return this.handleLineCenter(n,s,q.build1(n,s,t.radius,t.radius,!1,le.CW),e,i,a)}return r}handleLineCenter(t,e,r,i,n,s){let a=[],l=new ir(r,new M(i,i)),c=l.getLine(),h;return c.start().distance1(i)<c.end().distance1(i)?h=c.end():h=c.start(),l.getDistance()==0&&(h=i),a.push({point:h,rotation:s}),a}getIntersectPoint(...t){let e={},r=[].concat(t,this.drawingLines);if(r.length>1){class n{constructor(c){this.line=c,this._bbox=c.primitive.bbox().extendOfSize(c.width/2)}get width(){return this.line.width}get primitive(){return this.line.primitive}bbox(){return this._bbox}}let s=new nn(7);for(let l of r)l instanceof Sr||l instanceof nr?s.add(l):s.add(new n(l));let a=new Set;for(let l of s.itemList){a.add(l);let c=l instanceof n?l.line:l,h=s.search(l.bbox());for(let u of h){if(l==u||a.has(u))continue;let d=u instanceof n?u.line:u,p=l instanceof Sr||l instanceof nr?l.getMathGraphics():fe.build2([l.primitive]),m=u instanceof Sr||u instanceof nr?u.getMathGraphics():fe.build2([u.primitive]);for(let g of p.primitives)for(let y of m.primitives){if(g.bbox().isSeparated(y.bbox()))continue;let b=Tt(g,y);for(let P=0;P<b;P+=2){let T=new S(Ee[P],Ee[P+1]),I=i(T);I?(I.items.add(c),I.items.add(d)):e[T.hashed]={point:T,items:new Set([c,d])}}}}}}return Object.values(e);function i(n){return e[n.hashed]}}getArcCircleCenterPoint(t){let e=[];return t instanceof Sr||t instanceof vt?e.push(t.center):t instanceof nr&&(e=e.concat(t.getArcCenterPoints())),e}getTangentPoint(t){let e=[];return(t instanceof Sr||t instanceof vt)&&e.push(...r(t)),e;function r(i){let n=[i.center.add(new S(-i.radius,0)),i.center.add(new S(i.radius,0)),i.center.add(new S(0,-i.radius)),i.center.add(new S(0,i.radius))];return i instanceof vt?n.filter(s=>i.isSelect(s.x,s.y)):n}}getNearestCrossPointInfo(t,e){let i=ce.adsorptionConfig.getSnapDistanceValue(),n=e.position,s=n.distance1(t),a=ce.adsorptionConfig,l,c,h;if(s<i)l=n,c=s;else{if(a.getConfig("Extended Line"))for(let u of[new M(n,n.add(new S(0,1))),new M(n,n.add(new S(1,0))),new M(n,e.getLines()[0].end.rotate(n,e.rotation||0))]){let d=new M(u.start(),u.end()),p=ir.foot(d,t),m=p.distance1(t);(c==null||m<c)&&m<i&&(c=m,l=p,h=d)}if(a.getConfig("Perpendicular Foot")&&e.rotation!=null)for(let u of e.getLines().slice(1)){let d=new M(u.start.rotate(n,e.rotation||0),u.end.rotate(n,e.rotation||0)),p=ir.foot(d,t),m=p.distance1(t);(c==null||m<c)&&m<i&&(c=m,l=p,h=d)}}return{point:l,distance:c,angle:e.rotation,line:h}}getNearestFlagPointInfo(t,e,r=!1){let n=ce.adsorptionConfig.getSnapDistanceValue(),s=e.center,a=s.distance1(t),l=ce.adsorptionConfig,c,h,u;if(a<n)c=s,h=a;else if(l.getConfig("Extended Line")){let d=[e.lines[0],e.lines[1]];if(r){let p=[new M(e.center,e.center.add(new S(0,1))),new M(e.center,e.center.add(new S(1,0)))];d.push(...p)}for(let p of d){let m=p,g=ir.foot(m,t),y=g.distance1(t);(h==null||y<h)&&y<n&&(h=y,c=g,u=m)}}return{point:c,distance:h,line:u}}getExtendedLinePointInfo(t,e,r,i,n,s=!1){let l=ce.adsorptionConfig.getSnapDistanceValue(),c,h,u;for(let d of[new M(e,e.add(new S(0,1))),new M(e,e.add(new S(1,0))),new M(e,e.add(new S(1,0)).rotate(e,i))]){let p=new M(d.start(),d.end()),m=ir.foot(p,t),g=OA([e,r||m],[d.start(),d.end()]),y=m.distance1(t);(h==null||y<h)&&y<l&&g&&(h=y,c=m,u=p)}if(s){let d,p,m=new S(n.realSceneX,n.realSceneY),g;ce.adsorptionConfig.getConfig("Grid Point")&&(g=di.adsorpGrid(m),d=m.distance1(g));let y=new S(n.sceneX,n.sceneY);c?(p=m.distance1(c),g&&d<p?(n.sceneY=g.y,n.sceneX=g.x):Ox(c.x,e.x)?n.sceneX=c.x:(Ox(c.y,e.y)||(n.sceneX=c.x),n.sceneY=c.y)):(n.sceneY=y.y,n.sceneX=y.x)}else if(c!=null)if(c.equals1(e))n.sceneX=c.x,n.sceneY=c.y;else if(Ox(c.x,e.x))n.sceneX=c.x;else if(Ox(c.y,e.y))n.sceneY=c.y;else{let d=new S(n.sceneX,n.sceneY),p=new S(n.sceneX,c.y),m=new S(c.x,n.sceneY),g=0,y;[p,m].forEach(b=>{let P=Vb(e,c,d,b);P&&(g?P.distance1(c)<g&&(g=P.distance1(c),y=P):(g=P.distance1(c),y=P))}),y&&(n.sceneX=y.x,n.sceneY=y.y)}return{point:c,distance:h,angle:i,line:u}}getCrossLineIntersectPointsInfo(t,e){let r=[],i=[],n=ce.adsorptionConfig;for(let a of t){let l=a.getLines(),{position:c,rotation:h}=a;if(n.getConfig("Extended Line")&&r.push({line:new M(c.sub(new S(1,0).mul(e)),c.add(new S(1,0).mul(e))),cross:a},{line:new M(c.sub(new S(0,1).mul(e)),c.add(new S(0,1).mul(e))),cross:a},{line:new M(c.sub(a.getLines()[0].end.rotate(c,a.rotation||0).sub(c).normalize().mul(e)),c.add(a.getLines()[0].end.rotate(c,a.rotation||0).sub(c).normalize().mul(e))),cross:a}),n.getConfig("Perpendicular Foot")){let u=l[1].start.rotate(c,h||0),p=l[1].end.rotate(c,h||0).sub(u).normalize();r.push({line:new M(c.sub(p.mul(e)),c.add(p.mul(e))),cross:a})}}if(r.length>1)for(let a=0;a<r.length;a++)for(let l=a+1;l<r.length;l++){let c=Tt(r[a].line,r[l].line);for(let h=0;h<c;h+=2){let u=new S(Ee[h],Ee[h+1]),d=s(u);d?(d.lines[a]=r[a],d.lines[l]=r[l]):i.push({point:u,lines:{[a]:r[a],[l]:r[l]}})}}return i.map(a=>{let l=Object.values(a.lines);return{...a,lines:l}});function s(a){for(let l of i)if(l.point.x===a.x&&l.point.y===a.y)return l;return null}}getCrossAndLineCenterIntersectPointsInfo(t,e,r){let i=[],n=[],s=[],a=ce.adsorptionConfig,{prePosition:l,preRotation:c}=e,h=new S(1,0).mul(r),u=new S(0,1).mul(r);for(let p of t){let m=p.getLines(),{position:g,rotation:y}=p;if(a.getConfig("Extended Line")&&(i.push({line:new M(g.sub(h),g.add(h))},{line:new M(g.sub(u),g.add(u))}),y&&i.push({line:new M(g.sub(m[0].end.rotate(g,y).sub(g).normalize().mul(r)),g.add(m[0].end.rotate(g,y).sub(g).normalize().mul(r)))})),a.getConfig("Perpendicular Foot")&&y){let b=m[1].start.rotate(g,y),T=m[1].end.rotate(g,y).sub(b).normalize();i.push({line:new M(g.sub(T.mul(r)),g.add(T.mul(r)))})}}if(n.push({line:new M(l.sub(h),l.add(h))},{line:new M(l.sub(u),l.add(u))}),c&&n.push({line:new M(l.sub(h.rotate(l,c).sub(l).normalize().mul(r)),l.add(h.rotate(l,c).sub(l).normalize().mul(r)))}),i.length>1)for(let p=0;p<i.length;p++)for(let m=0;m<n.length;m++){let g=Tt(i[p].line,n[m].line);for(let y=0;y<g;y+=2){let b=new S(Ee[y],Ee[y+1]);d(b)||s.push(b)}}return s;function d(p){for(let m of s)if(m.x===p.x&&m.y===p.y)return m;return null}}addSnapFlag(t,e){let r=new S(1,0),i=new S(0,1),n=new M(S.ORIGIN.add(r),S.ORIGIN.add(r.mul(-1))),s=new M(S.ORIGIN.add(i),S.ORIGIN.add(i.mul(-1))),a=Qe.rotate(e).translate(t.x,t.y),l={center:t,lines:[n.multiply3(a),s.multiply3(a)],rotation:e};this.snapFlags.findIndex(h=>h.center.similarEquals(t))<0&&this.snapFlags.push(l)}clearSnapFlag(){this.snapFlags=[]}handelAddSnapFlagPoint(t,e=!0){let r=(n,s)=>{let a=new S(1,0),l=new S(0,1),c=new M(S.ORIGIN.add(a),S.ORIGIN.add(a.mul(-1))),h=new M(S.ORIGIN.add(l),S.ORIGIN.add(l.mul(-1))),u=Qe.rotate(s).translate(n.x,n.y),d={center:n,lines:[c.multiply3(u),h.multiply3(u)],rotation:s};this.snapFlags.findIndex(m=>m.center.similarEquals(n)&&ne.eq(s,m.rotation))<0&&this.snapFlags.push(d)};Pi.getInstance().adsorb&&ce.adsorptionConfig.getConfig("Extended Line")&&(r(t,0),r(t,Math.PI/4))}handleAddSnapFlagData(t,e,r){if(this.snapOnlyCurrentLayer()&&!this.isActiveLayerPcbItem(e))return;let i,n;if(r&&r.length){for(let s of r)i=s.center,n=s.rotation||0,this.addSnapFlag(i,n);return}if(t&&t instanceof mt){let s=t.getParent(),a=null;s instanceof ct&&(a=s.getConnect(t,!0)),n=a?a.end.sub(a.start).angle(S.ORIGIN):0,i=t.start,this.addSnapFlag(i,n)}if(e&&e instanceof mt){let s=e.getParent(),a=null;s instanceof ct&&(a=s.getConnect(e,!1)),n=a?a.end.sub(a.start).angle(S.ORIGIN):0,i=e.end,this.addSnapFlag(i,n)}}snapToSnapFlag(t,e=!0,r=!1){if(!t.adsorb)return;let i=new S(t.realSceneX,t.realSceneY),n,s=ce.adsorptionConfig.getSnapDistanceValue(),a=s,l=[];if(!this.snapFlags.length)return;for(let d of this.snapFlags){let{point:p,distance:m,line:g}=this.getNearestFlagPointInfo(i,d,r);m<a?([a,n]=[m,p],g&&l.push({line:g,flag:d})):g&&l&&p.x===n.x&&p.y===n.y&&l.push({line:g,flag:d})}let c,h,u=new S(t.sceneX,t.sceneY);if(n==null||t.getCrossFlags().find(d=>d.position.equals1(u))?c=u:(c=new S(n.x,n.y),h=l.length?l.map(d=>d.line):null),h){if(h instanceof Array&&h.length==2){let d=Vb(h[0].start(),h[0].end(),h[1].start(),h[1].end());d&&d.distance1(c)<s&&(c=d)}e&&t.addExtensionCord(h),t.sceneDeltaX=c.x-t.sceneX,t.sceneDeltaY=c.y-t.sceneY,t.sceneX=c.x,t.sceneY=c.y}return t.getShowPoint()&&t.getShowPoint().setPosition(new S(t.sceneX,t.sceneY)),c}snapToOtherComponent(t,e,r,i){let{layerId:n,globalIndex:s}=t,a=t.getLines(),l;t instanceof Me?l=Cr.getAllItem().filter(b=>([n,b.layerId].includes(12)||b.layerId==n)&&b.globalIndex!==s):l=Kt.getAllItem().filter(b=>([n,b.layerId].includes(12)||b.layerId==n)&&b.globalIndex!==s);let h=ce.adsorptionConfig.getSnapDistanceValue(),u=[],d,p,m=Qe.translate(e.x,e.y),g=t.getParent(),y=t.getGroupID();for(let b of l){let P=b.getGroupID();if(b instanceof Le){let I=b.getParent(),C=I==null?void 0:I.getGroupID(),E=g==null?void 0:g.getGroupID();if(I&&g&&(I.globalIndex==g.globalIndex||C&&E&&C==E))continue}if(P&&y&&P==y)continue;let T=b.getLines();for(let I=0;I<a.length;I++){let C=a[I];C=C.multiply3(m);let{point:E,distance:O,line:_,offset:R,isMidLine:v}=this.getNearestComponentPointInfo(C,T,I);O<=h&&([h,d]=[O,E],_&&u.every(D=>!D.line.equals1(_))&&u.push({line:_,offset:R,distance:O,isMidLine:v}))}}if(u.length){u=u.sort((E,O)=>O.distance-E.distance);let b,P,T=!0,I=!0;for(let E of u){let O=E.line;O.direct.x==0&&T?(b=E,E.isMidLine&&(T=!1)):O.direct.y==0&&I&&(P=E,E.isMidLine&&(I=!1))}(b||P)&&(u=[]),b&&u.push(b),P&&u.push(P);let C=u[u.length-1].offset;u.length>=2&&(C=new S(b.offset.x,P.offset.y)),m=Qe.translate(C.x,C.y),p=r.multiply3(m),i.addExtensionCord(u.map(E=>E.line),!0)}return p}getNearestComponentPointInfo(t,e,r){let n=ce.adsorptionConfig.getSnapDistanceValue(),s=ce.adsorptionConfig,a,l,c,h,u=!1,d=t.start(),p=t.end(),m=d.add(p).mul(.5);for(let g=0;g<e.length;g++){let y=e[g],b=ir.foot(y,d),P=b.distance1(d),T=LM(d.x,d.y,y.start().x,y.start().y,y.end().x,y.end().y),I=LM(p.x,p.y,y.start().x,y.start().y,y.end().x,y.end().y),C=Math.min(T,I),E=()=>{let O=!1;return(t.direct.x==0&&y.direct.x==0||t.direct.y==0&&y.direct.y==0)&&(O=!0),O};if((l==null||P<l)&&P<n&&C<=100&&E()){l=P,a=b,h=b.sub(d);let O=y.start().add(y.end()).mul(.5);y=new M(O,m.add(h)),c=y,(g==4||g==5)&&(u=!0)}}return{point:a,distance:l,line:c,offset:h,isMidLine:u}}},di=new I9e;var Dm=class{constructor(t){this.shoveEvent=new tD;this._chain=null;this.bases=new Array;this.kit=new th(1e-4);this.hiddens=new Array;this.event=t,t.numberOfIterator=0}get chain(){return this._chain==null&&(this._chain=this.shoveEvent.getChain(this.event.track),this.shoveEvent.shoveFun.result.sourceTrackChain.push(this._chain.tracks),this.shoveEvent.shoveFun.result.shovePathMap[0]=this._chain),this._chain}blockBaseTrack(t,e,r,i,n,s,a=!0){let l=this.blockRepairTrack(e,t,a),c=a?e.end:e.start;if(l.distance2(c)>1e-8&&r){let h=t.getEnd4Block(i,n.layerId,n.width,n.net);e==n?Re.addAll(s,h):s.push(l)}}blockRepairTrack(t,e,r){return t instanceof $d?e.blockBaseTrack(t,r):e.blockTrack(t,r)}getLengthIncrement(){let t=0;for(let e of this.bases)e!=null&&!e.isEmpty&&(t+=e.length);for(let e of this.hiddens)t-=e.length;return t}changeBaseTrack(t,e=t.start,r=t.end){t.isEmpty||(t.start=e,t.end=r)}recycleBaseTrack(){for(let t of this.bases)t.remove();this.bases.length=0}mapBase2Track(t=!1){for(let e of this.bases)if(e.length>.01){let r=this.createTrack(e.start,e.end,this.event.track);this.event.commands.addCommand(Te.dispatch(r,"add")),A.publish("hasModifyPcbItem",r),t&&(this.event.resultTrack=r)}}getLines(t){let e=new Array;for(let r of t)if(r instanceof M)e.push(r);else break;return e}getCurrent(t,e,r){let i=e.direct,n=this.getNormalOffset(i,t),s=e.start().add(n),a=e.end().add(n);return this.getLine(s,a,r)}checkIntersection(t,e,r,i){if(e instanceof M){let n=t.direct,s=e.direct,a=n.cross(s);if(Math.abs(a)>1e-4){let l=this.getLine(e.start(),e.end(),r),c=this.getIntersection(t,l);if(c!=null){let h=e.start(),u=e.end();if(i?(h=c,this.kit.eq(c.distance1(u),0)&&(h=u)):(u=c,this.kit.eq(c.distance1(h),0)&&(u=h)),u.sub(h).normalize().dot(s)>=0)return c}}}return null}calculateNextIntersection(t,e,r,i,n){for(let s=t+1;s<=e;s++){let a=this.checkIntersection(r,i[s],n,!0);if(a!=null)return{index:s,point:a}}return{index:e,point:i[e].end()}}calculatePreviousIntersection(t,e,r,i,n){for(let s=t-1;s>=e;s--){let a=this.checkIntersection(r,i[s],n,!1);if(a!=null)return{index:s,point:a}}return{index:e,point:i[e].start()}}calculateProjectionLength(t,e,r,i){let n=t.sub(e);return this.getNormalOffset(r,n).dot(i)}getEndpointInfo(t,e,r){let i=new Array;if(t!=null&&i.push({point:t.start(),type:"PREVIOUS",projection:0,projectSameDirect:!1}),e!=null&&i.push({point:e.end(),type:"NEXT",projection:0,projectSameDirect:!1}),t!=null&&e!=null){let n=this.getLine(t.start(),t.end(),r),s=this.getLine(e.start(),e.end(),r),a=this.getIntersection(n,s);a!=null&&i.push({point:a,type:"INTERSECTION",projection:0,projectSameDirect:!1})}return i}realTimeAddCornerPath(t){if(this.isPush()||we.stretchTrackMinCorner<=0)return null;let{path:e,offset:r,isClosed:i,trackWidth:n,leftIsOther:s,rightIsOther:a,bbox:l,realtimeTracks:c}=t,[[h,u],[d,p],[m,g]]=c,y=e[d],b=e[h],P=e[m],T=y.direct,I=this.getNormalOffset(T,r).normalize(),C=0,E=0;if(u&&h==d-1&&this.isSameDir(b,I)){let O;s&&h==0&&(O=0);let _=O!==void 0?O:this.getTrackMinCorner(b,y,n),R=u.length;if(this.kit.less(b.length(),_)&&this.kit.greater(R,b.length())){let D=Math.min(R,_)-b.length(),w=Math.abs(I.dot(b.direct.mul(D)));E=Math.max(E,w),C--}}if(g&&m==this.getNextIndex(d,e,i)&&!this.isSameDir(P,I)){let O;a&&m==e.length-1&&(O=0);let _=O!==void 0?O:this.getTrackMinCorner(P,y,n),R=g.length;if(this.kit.less(P.length(),_)&&this.kit.greater(R,P.length())){let D=Math.min(R,_)-P.length(),w=Math.abs(I.dot(P.direct.mul(D)));E=Math.max(E,w),C++}}if(this.kit.greater(E,0)){let O=I.mul(E),{resultPre:_,resultNext:R}=this.calculateStretch({index:d,offset:O,path:e,bbox:l,isClosed:i,leftIsOther:s,rightIsOther:a,trackWidth:n});if(this.kit.eq(I.dot(y.start().sub(_.end)),0)){let F=null;if(C==1?F=_.index:C==-1&&(F=R.index),F!=null){let H=this.getEndPointCursor(e[F],y,I),z=this.calculateProjectionLength(p.start,y.start(),T,I);if(this.kit.greatereq(z,H)){O=I.mul(H);let G=this.calculateStretch({index:d,offset:O,path:e,bbox:l,isClosed:i,leftIsOther:s,rightIsOther:a,trackWidth:n});_=G.resultPre,R=G.resultNext}}}let v=_.index,D=R.index;if(this.kit.eq(_.end.distance1(R.start),0))return null;let w=Array.from(e);for(let F=v+1;F<d;F++)F==d-1?w[F]=new M(_.midPoint,_.end):w[F]=new M(_.midPoint,_.midPoint);for(let F=this.getNextIndex(d,e,i);F!=D;F=this.getNextIndex(F,e,i))F==this.getNextIndex(d,e,i)?w[F]=new M(R.start,R.midPoint):w[F]=new M(R.midPoint,R.midPoint);return w[v]=new M(_.start,_.midPoint),w[d]=new M(_.end,R.start),w[D]=new M(R.midPoint,R.end),w}return null}calculateStretch(t){let{index:e,offset:r,path:i,bbox:n,isClosed:s,leftIsOther:a,rightIsOther:l,trackWidth:c}=t,h=a&&e-1==0,u=l&&e+1==i.length-1,{startIndex:d,endIndex:p,index:m,newPath:g}=this.addGuideLineForConnectOther(i,e,r,a,l),y=this.getLimit4Offset(n,r),b=g[m],P=b.direct,T=this.getNormalOffset(b.direct,r).normalize(),I=this,{resPre:C,resNext:E}=this.calculateMoveRange({preIsConnectPadOrVia:h,nextIsConnectPadOrVia:u,offset:r,path:g,index:m,bbox:n,trackWidth:c,isClosed:s}),O=D(C.i,g),_=D(E.i,g),R=w(O,C.cursor,g,m,C.record),v=F(_,E.cursor,g,m,E.record);if(O!=C.i||_!=E.i){if(C.endPointCursor<E.endPointCursor){let G=w(O,C.endPointCursor,g,m),W=F(_,C.endPointCursor,g,m),L=W.midPoint.sub(G.midPoint),B=L.length()*H(L,P);for(let U=W.index+1;U<=v.index;U++){let k=g[U];if(this.isCollinear(k,b)){let V=H(k.direct,P);B+=k.length()*V}}for(let U=G.index-1;U>=0;U--){let k=g[U];if(this.isCollinear(k,b)){let V=H(k.direct,P);B+=k.length()*V}else break}let N=v.start.sub(P.mul(B));R={...R,start:N,midPoint:N,end:N}}else if(C.endPointCursor>E.endPointCursor){let G=w(O,E.endPointCursor,g,m),W=F(_,E.endPointCursor,g,m),L=W.midPoint.sub(G.midPoint),B=L.length()*H(L,P);for(let U=G.index-1;U>=R.index;U--){let k=g[U];if(this.isCollinear(k,b)){let V=H(k.direct,P);B+=k.length()*V}}for(let U=W.index+1;U<g.length;U++){let k=g[U];if(this.isCollinear(k,b)){let V=H(k.direct,P);B+=k.length()*V}else break}let N=R.end.add(P.mul(B));v={...v,end:N,midPoint:N,start:N}}}else z();return l&&E.i==g.length-1&&(v.index=E.i-1,v.end=i[i.length-1].end()),a&&(m--,R.index=D(R.index-1,i),v.index=D(v.index-1,i),C.i==0&&(R.start=i[0].start())),this.kit.eq(R.start.distance1(R.midPoint),0)&&(R.midPoint=R.end),this.kit.eq(v.end.distance1(v.midPoint),0)&&(v.midPoint=v.start),{resultPre:R,resultNext:v};function D(G,W){return G<0?0:G>=W.length?W.length-1:G}function w(G,W,L,B,N=S.ORIGIN){let U=I.getCurrent(T.mul(W),b,y),k=I.calculatePreviousIntersection(B,G,U,L,y),Y=L[k.index].start(),X=k.point,Z=X.add(N);return{index:k.index,start:Y,midPoint:X,end:Z}}function F(G,W,L,B,N=S.ORIGIN){let U=I.getCurrent(T.mul(W),b,y);B=s?-1:B;let k=I.calculateNextIntersection(B,G,U,L,y),Y=L[k.index].end(),X=k.point,Z=X.add(N);return{index:k.index,end:Y,midPoint:X,start:Z}}function H(G,W){return G.dot(W)>0?1:-1}function z(){let G=new M(R.midPoint,R.end),W=new M(v.midPoint,v.start),L=I.getIntersection(G,W);if(L)R.end=L,v.start=L;else{let B=g[v.index],N=I.checkIntersection(G,B,y,!0);if(N){R.end=N,v.start=N,v.midPoint=N;return}let U=g[R.index],k=I.checkIntersection(W,U,y,!1);k&&(v.start=k,R.end=k,R.midPoint=k)}}}calculateMoveRange(t){let{offset:e,path:r,index:i,bbox:n,trackWidth:s,isClosed:a,noOverNormalLength:l,preIsConnectPadOrVia:c,nextIsConnectPadOrVia:h}=t,u=this.getLimit4Offset(n,e),d=r[i],p={i:N(i-1),cursor:0,record:S.ORIGIN,endPointCursor:0},m={i:N(i+1),cursor:0,record:S.ORIGIN,endPointCursor:0},g={resPre:p,resNext:m};if(!(d instanceof M))return g;let y=this.getNormalOffset(d.direct,e),b=y.length(),P=y.normalize();if(this.kit.eq(b,0))return g;let T=d.start(),I=d.start(),C=b,E=b,O=!1,_=!1,R=G.call(this,i,!0),v=G.call(this,i,!1),D=!0,w=!0;for(;p.cursor<C||m.cursor<E;){let U=r[p.i],k=r[m.i],V=this.getEndpointInfo(U,k,u),Y=V.filter(K=>K.type=="PREVIOUS")[0],X=V.filter(K=>K.type=="NEXT")[0],Z=V.filter(K=>K.type=="INTERSECTION")[0];if(Y&&this.calculateEndpointProject([Y],T,d.direct,P),X&&this.calculateEndpointProject([X],I,d.direct,P),D){let K=z.call(this,U,R,d,C,Y,p,!0);p=K.res,C=K.vLength,O=K.springBack}if(w){let K=z.call(this,k,v,d,E,X,m,!1);m=K.res,E=K.vLength,_=K.springBack}Y&&Y.projectSameDirect&&(Y.projection+=p.cursor),X&&X.projectSameDirect&&(X.projection+=m.cursor);let Q=p.i,ae=m.i,he=V.filter(K=>!(m.cursor>=E&&K.type=="NEXT"));p.cursor=this.getCursor(he,C,p.cursor),this.kit.eq(p.cursor,C)&&(p.cursor=C),T=d.start().add(P.mul(p.cursor)),L(p.i)&&(p.endPointCursor=p.cursor),!O&&Y&&Y.projectSameDirect&&this.kit.lesseq(Y.projection,p.cursor)&&(p.i=N(p.i-1));let re=V.filter(K=>!(p.cursor>=C&&K.type=="PREVIOUS"));m.cursor=this.getCursor(re,E,m.cursor),this.kit.eq(m.cursor,E)&&(m.cursor=E),I=d.start().add(P.mul(m.cursor)),L(m.i)&&(m.endPointCursor=m.cursor),!_&&X&&X.projectSameDirect&&this.kit.lesseq(X.projection,m.cursor)&&(m.i=N(m.i+1)),D=Q!=p.i,w=ae!=m.i;let se=!1;if(U&&k&&Z){let K=Z.point,me=this.calculateProjectionLength(U.end(),d.start(),d.direct,P),Oe=this.calculateProjectionLength(k.start(),d.start(),d.direct,P),Ie=Math.max(me,Oe),ue=d.start().add(P.mul(Ie));this.calculateEndpointProject([Z],ue,d.direct,P);let Pe=this.calculateProjectionLength(K,d.start(),d.direct,P);if(Z.projectSameDirect){let j=!1;(!O&&this.kit.greatereq(p.cursor,Pe)||this.kit.greatereq(W(p),Pe))&&(j=!0),(!_&&this.kit.greatereq(m.cursor,Pe)||this.kit.greatereq(W(m),Pe))&&(j=!0),j&&(p.cursor=Pe,m.cursor=Pe,p.endPointCursor=Pe,m.endPointCursor=Pe,p.record=S.ORIGIN,m.record=S.ORIGIN,se=!0)}}if(a&&p.i<m.i&&(p.i=N(p.i+1),m.i=N(m.i-1),se=!0),se)break}let F=W(p),H=W(m);if(!l&&!this.kit.eq(F,H)){let U=Math.min(F,H);return t.offset=P.mul(U),this.calculateMoveRange({...t,noOverNormalLength:!0})}return{resPre:p,resNext:m};function z(U,k,V,Y,X,{i:Z,cursor:Q,record:ae,endPointCursor:he},re){let se=B(Z,re);if(k instanceof M&&U instanceof M&&this.kit.greater(U.length(),0)){if(X.projectSameDirect&&this.isCollinear(U,k)){let K=U.direct.mul(ae.length()),me=new M(U.start(),U.end().add(K)),Oe;re&&c&&(Oe=0),!re&&h&&(Oe=0);let Ie=Oe!==void 0?Oe:this.getTrackMinCorner(me,V,s),ue=Math.min(Ie,me.length()),Pe=U.direct;Pe.dot(P)>0&&(Pe=Pe.mul(-1));let j=X.point.add(Pe.mul(ue)),J=this.calculateProjectionLength(j,V.start(),V.direct,P);this.kit.less(J,Y)&&(ae=Pe.mul(ue),Y=b+Math.abs(ae.dot(P)))}if(!L(se)||!X.projectSameDirect||this.isCollinear(U,V)){let K=this.getEndPointCursor(U,V,P);if(this.kit.greatereq(b,K))Y=b,ae=S.ORIGIN;else if(this.kit.greatereq(Y,K)){if(Y=K,l){let me=Math.abs(ae.dot(P)),Oe=K-me,Ie=Math.max(Oe,b);ae=ae.mul((K-Ie)/me)}return{springBack:!0,vLength:Y,res:{i:Z,cursor:Q,record:ae,endPointCursor:he}}}}}return{springBack:!1,vLength:Y,res:{i:Z,cursor:Q,record:ae,endPointCursor:he}}}function G(U,k){let V=0,Y=r.length,X=-Math.sqrt(2)/2,Z=d.direct;for(let Q=B(U,k);L(Q)&&V<Y;Q=B(Q,k)){let ae=r[Q],he=k?Z.dot(ae.direct.mul(-1)):Z.mul(-1).dot(ae.direct);if(!this.isCollinear(ae,d)&&he<0&&this.kit.eq(he,X))return ae;V++}return null}function W(U){return U.cursor-Math.abs(U.record.dot(P))}function L(U,k=r.length){return U>=0&&U<k}function B(U,k){return N(k?U-1:U+1)}function N(U,k=r.length,V=t.isClosed){return V?(U+k)%k:U}}getTrackMinCorner(t,e,r){let i=we.stretchTrackMinCorner*r,n=e.direct,s=new S(-n.y,n.x),a=t.end().sub(t.start()),l=Math.abs(a.dot(n)),c=Math.abs(a.dot(s)),h=Math.max(l,c);if(h>0){let u=i/h;return t.length()*u}return 0}getEndPointCursor(t,e,r){let i=this.calculateProjectionLength(t.end(),e.start(),e.direct,r),n=this.calculateProjectionLength(t.start(),e.start(),e.direct,r);return Math.max(i,n)}isCollinear(t,e){let r=t instanceof S?t:t.direct,i=e instanceof S?e:e.direct;return this.kit.eq(r.cross(i),0)}isSameDir(t,e){let r=t instanceof S?t:t.direct,i=e instanceof S?e:e.direct;return r.dot(i)>0}handleAddSnapFlag(t,e){let{startType:r,endType:i,tracks:n,pts:s}=e,a=[],l=s[t],c=l.end().sub(l.start()).angle(S.ORIGIN),h=[0,1,2,11];h.includes(r)&&a.push({center:s[0].start(),rotation:c}),h.includes(i)&&a.push({center:s[s.length-1].end(),rotation:c});let d=s.filter((p,m)=>m!==t).filter(p=>this.isCollinear(l,p));for(let p of d)a.push({center:p.start(),rotation:c});di.handleAddSnapFlagData(void 0,void 0,a)}getPreIndex(t,e,r=!1){let i=e.length;return r?(t-1+i)%i:t-1}getNextIndex(t,e,r=!1){let i=e.length;return r?(t+1+i)%i:t+1}isConnectOther(t){return[11,2,1].includes(t)}addGuideLineForConnectOther(t,e,r,i,n){let s=Array.from(t),a=0,l=t.length-1,c=t[e];if(i){let h=this.calculateAddLine(c.direct,r,t[0].start(),!0);s.unshift(h),e++,a=1}if(n){let h=this.calculateAddLine(c.direct.mul(-1),r,t[t.length-1].end(),!1);s.push(h),l=s.length-2}return{startIndex:a,endIndex:l,index:e,newPath:s}}calculateAddLine(t,e,r,i){let n=this.getNormalOffset(t,e),s=n.length(),a=r.add(n).add(t.mul(s)),l=r.sub(a),c=r.add(l.normalize());return i&&([r,c]=[c,r]),new M(r,c)}calculateEndpointProject(t,e,r,i){for(let n of t){let s=this.calculateProjectionLength(n.point,e,r,i);n.projection=s,n.type=="INTERSECTION"?n.projectSameDirect=this.kit.greater(s,0):n.projectSameDirect=this.kit.greatereq(s,-.1),this.kit.lesseq(s,0)&&(n.projection=0)}}getCursor(t,e,r){let i=new Array;i.push(e);for(let n of t)n.projectSameDirect&&i.push(n.projection);return r=Math.min(...i),r}getLimit4Offset(t,e){let r=t.extendOfSize(e.length());return r.width()+r.height()}getLine4Index(t,e,r,i,n,s){if(t<0&&s){let a=r.add(e.direct).normalize();return new M(e.start(),e.start().add(a.mul(i)))}else if(t>=n.length&&s){let a=r.sub(e.direct).normalize();return new M(e.end().add(a.mul(i)),e.end())}else return n[t]}visible(){for(let t of this.bases)t.visible();for(let t of this.hiddens)t.visible();this.hiddens.length=0}recordHistory(t){if(this.event.addHistory){this.event.commands=new ve("repair line");for(let e of t)this.event.commands.addCommand(Te.dispatch(e,"modify")),A.publish("hasModifyPcbItem",e);this.event.addHistory=!1}}cancelHiddenTrack(){this.hiddens.forEach(t=>{t.visible()})}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}createBaseTrack(t,e,r){let i=$d.build(r.layerId,t,e,r.width,r.net);return this.bases.push(i),i}realTimePath(){return[]}shove(){let t=this.realTimePath(),e=this.shoveEvent.getNewChainFactory(this.chain,t).build();this.shoveEvent.shoveFun.remove4Rtree([this.chain]),this.shoveEvent.shoveFun.shoveMain(e),this.shoveEvent.shoveFun.add4Rtree([this.chain]);let r=this.shoveEvent.shoveFun.result;r.sourceTrackChain[0]=this.chain.tracks,this.shoveEvent.current=r,this.shoveEvent.preview(r)}shoveInterrupt(){this.shoveEvent.shoveTrackInterrupt()}getLine(t,e,r=1e3){let i=e.sub(t),n=i.normalize().mul(r+i.length());return new M(t.sub(n),t.add(n))}getIntersection(t,e){return Tt(t,e)>0?new S(Ee[0],Ee[1]):null}getPoint4Line(t,e,r){let i=new _e().ext1(e.bbox()).ext2(t).ext7(100).build1(),n=i.width()+i.height(),s=this.getLine(t,t.add(r),n),a=this.getLine(e.start(),e.end(),n);return this.getIntersection(s,a)}getInRangePoint(t,e,r,i){let n=e,s=new M(t,e);for(let a of r){let l=this.getPoint4Line(a,s,i);l!=null&&n.distance2(t)>l.distance2(t)&&(n=l)}return n}getNewTrackEnd(t,e,r,i){i||(e=e.mul(-1));let n=r.sub(t),s=this.getNormalOffset(e,n);return t.add(s.add(e.mul(s.length())))}createTrack(t,e,r){return pr.addTrack(r.layerId,t,e,r.width,!1,r.net)}syncTracks(t,e){for(let r=0;r<e.length;r++)t[r].start=e[r].start(),t[r].end=e[r].end()}lock(){return!1}isBlock(){return this.event.isBlock()}isPush(){return this.event.isPush()}};var uV=class extends Dm{constructor(t){super(t),this.event.commands=new ve("repair line - drag single track"),this.start=this.event.oldStart,this.end=this.event.oldEnd}move(t){if(this.lock())return;let e=t.sub(this.event.lastMousePosition);this.moveOffset(e)}moveOffset(t){this.recordHistory([this.event.track]);let e;this.event.adsorbtion?(this.start=this.event.oldStart.add(t),e=di.adsorpGrid(this.start),t=e.sub(this.event.oldStart)):e=this.event.oldStart.add(t);let r=this.event.adsorb(e,this.event.track.width,this.event.track.layerId).sub(e),i=this.event.oldEnd.add(t),n=this.event.adsorb(i,this.event.track.width,this.event.track.layerId).sub(i),s=r.length(),a=n.length();s!=0&&a!=0?s<a?t=t.add(r):t=t.add(n):s==0&&a!=0?t=t.add(n):s!=0&&a==0&&(t=t.add(r)),this.event.track.start=this.event.oldStart.add(t),this.event.track.end=this.event.oldEnd.add(t)}complete(){this.event.commands!=null&&this.event.commands.length>0&&A.publish("hasModifyPcbItem",this.event.track),this.shoveEvent.clearCache()}interrupt(){}};var EOt=1e-5,df=class{constructor(){this.kit=new th(EOt);this.clearance=0;this.adsorp=null}getSafeClearance(t,e,r=!0){let i=0;r||(i=5);let n=Bo(e);if(n!=null){let u=te.getInstance().getBetweenNetRuleByNet(i,G1(e.model),t,n,e.layerId);if(u!=null){let d=te.getInstance().getSafeSpacing(u.name),p=G1(e.model),m=d.getClearance(p,i,e.layerId);return xe(m,2)}}if(e instanceof Ue){let u=te.getInstance().getNet(t);if(u!=null&&u.netDifferential!=null){let d=u.netDifferential;if(t!=e.net&&d.hasNet(t)&&d.hasNet(e.net))return te.getInstance().getDifferentialPhysics(d.differentialPhysics).getDifferentialPairSpacingMin(e.layerId)}}let s=te.getInstance().getSafeSpacingByNet(t,0),a=te.getInstance().getSafeSpacingByNet(n,G1(e.model)),l=G1(e.model),c=[s,a],h=-1;for(let u of c){let d=u.getClearance(l,i);h=Math.max(h,d)}if(h!=-1)return xe(h,2);for(let u of c){let d=u.getClearance(l,i);h=Math.max(h,d)}return xe(h,2)}checkIntersection(t){return!(this.blockTrack(t).distance1(t.end)>1e-8)}checkBaseIntersection(t){return!(this.blockBaseTrack(t).distance1(t.end)>1e-8)}checkSegment2(t,e,r,i,n,s){let a=new M(t,e);for(let l of s){let c=this.getSafeClearance(n,l),u=Math.max(c,0);ne.eq(u,0)||(e=this.checkClearance1(a,r,i,n,u,l),a=this.getNewPrimitive(a,e))}return e}getEnd4Block(t,e,r,i){this.adsorp instanceof Ye&&this.adsorp.layerId==11&&(e=11);let n=this.adsorp.getMathGraphics(e),s=t.angle(S.ORIGIN),a=Ae.rotateZ(-s),l=this.getSafeClearance(i,this.adsorp),c=n.multiply3(a.toMatrix3()).bbox().extendOfSize(r/2+l);return[c.UL().multiply3(Qe.rotate(s)),c.LL().multiply3(Qe.rotate(s))]}blockTrack(t,e=!0){if(t.length==0)return e?t.end:t.start;let r=t.buildBBox(),i=Vt.search(r.extendOfSize(10)),n=new UT;i.setAction(n),i.doAction(["ArcTrack","Track","Pad","Via","Text","Image","Polygon","Rect","Circle"]);let s=n.items,a=t.end;e?a=t.end:a=t.start;let l=t.layerId,c=t.width,h=t.net,u=this.getPrimitive(t,e);for(let d of s){let p=this.getSafeClearance(h,d),g=Math.max(p,0);ne.eq(g,0)||(a=this.checkClearance1(u,l,c,h,g,d),u=this.getNewPrimitive(u,a))}return a}blockBaseTrack(t,e=!0){if(t.length==0)return e?t.end:t.start;let r=t.buildBBox(),i=Vt.search(r.extendOfSize(10)),n=new UT;i.setAction(n),i.doAction(["ArcTrack","Track","Pad","Via","Text","Image","Polygon","Rect","Circle"]);let s=n.items,a=t.end;e?a=t.end:a=t.start;let l=t.layerId,c=t.width,h=t.net,u=t.primitive;e||(u=Hp(u));for(let d of s){let p=this.getSafeClearance(h,d),g=Math.max(p,0);if(!ne.eq(g,0)&&(a=this.checkClearance1(u,l,c,h,g,d),u=this.getNewPrimitive(u,a),u.start().equals1(u.end())))break}return a}blockSegment(t,e,r,i,n=!0){let s=new _e().ext2(t.start).ext2(t.end).ext7(r).build1(),a=Vt.search(s.extendOfSize(10)),l=new UT;a.setAction(l),a.doAction(["ArcTrack","Track","Pad","Via","Text","Image","Polygon","Rect","Circle"]);let c=l.items,h=t.end;n?h=t.end:h=t.start;let u=t.primitive;n||(u=new M(t.end,t.start));for(let d of c){let p=this.getSafeClearance(i,d),g=Math.max(p,0);ne.eq(g,0)||(h=this.checkClearance1(u,e,r,i,g,d),u=this.getNewPrimitive(u,h))}return h}checkClearance1(t,e,r,i,n,s){return s.isEmpty?t.end():s instanceof Ar||s instanceof Si?this.checkTrackTrack(t,e,r,i,s,n):s instanceof Le?this.checkTrackPad(t,e,r,i,s,n):s instanceof Ge?this.checkTrackVia(t,e,r,i,s,n):s instanceof fr?this.checkTrackText(t,e,r,i,s,n):s instanceof Yn?this.checkTrackImage(t,e,r,i,s,n):s instanceof ct?this.checkTrackProfile(t,e,r,i,s,n):s instanceof nr?this.checkTrackProfile(t,e,r,i,s,n):s instanceof Sr?this.checkTrackProfile(t,e,r,i,s,n):t.end()}checkTrackTrack(t,e,r,i,n,s){if(!this.isSameLayer(e,n.layerId)||this.isSameNet(i,n.net))return t.end();let a=r,l=n.width,c=this.getPrimitive(n),u=new ir(t,c).getDistance();u=xe(u,2);let d=xe(s+a/2+l/2,2);if(this.kit.greatereq(xe(u),xe(d)))return t.end();{let p;return t instanceof M?c instanceof M?p=this.calcuLineLine(t,c,d):p=this.calcuLineArc(t,c,!0,d):c instanceof M?p=this.calcuLineArc(c,t,!1,d):p=this.calcuArcArc(t,c,d),this.adsorp=n,p}}checkTrackPad(t,e,r,i,n,s){let a=gr(n.layerId);if(i===n.net||!a&&n.layerId!==e)return t.end();let l=s+r/2,c=n.getMathGraphics(e,0),h=n.getMathGraphics(12,0),u=Number.MAX_VALUE,d=Number.MAX_VALUE;if(c!=null&&(u=this.getMin(t,c)),h!=null&&(d=this.getMin(t,h)),this.kit.lesseq(xe(u,2),xe(d,2))&&this.kit.less(xe(u,2),xe(l,2))){let p=this.getEnd(t,c,l);return this.adsorp=n,p}else if(this.kit.less(xe(d,2),xe(u,2))&&this.kit.less(xe(d,2),xe(l,2))){let p=this.getEnd(t,h,l);return this.adsorp=n,p}return t.end()}checkTrackVia(t,e,r,i,n,s){if(i===n.net)return t.end();if(n.type==1&&e!==n.startLayer&&e!==n.endLayer){if(Io(n.startLayer)){if(e<n.endLayer)return t.end()}else if(2==n.startLayer){if(e<n.startLayer)return t.end()}else if(e>n.startLayer||e<n.endLayer)return t.end()}let a=q.build2(n.center,0,360,n.radius,n.radius,le.CCW),l=new ir(t,a).getDistance(),c=s+r/2;if(this.kit.less(xe(l,2),xe(c,2))){let h=this.getEnd(t,fe.build2([a]),c);return this.adsorp=n,h}return t.end()}checkTrackProfile(t,e,r,i,n,s){switch(n.type){case"Board Outline":break;case"Fill Region":if(n.net===i||n.layerId!=e)return t.end();break;case"Prohibited Region":if(!gr(n.layerId)&&n.layerId!=e)return t.end();if(n.getComponent().track)s=.01;else return t.end();break;case"Copper Region":return t.end();case"Line":if(n.layerId==11)break;if(n.layerId!=e||n.net===i)return t.end();break;case"Slot Region":break}let l=this.getProfilePolyline(n),c=this.getMin(t,l),h=s+r/2;if(this.kit.less(xe(c,2),xe(h,2))||xe(c,2)==xe(h,2)&&xe(c,2)==0){let u=this.getEnd(t,l,h);return this.adsorp=n,u}return t.end()}checkTrackImage(t,e,r,i,n,s){if(e!=n.layerId)return t.end();let a=n.getMathGraphics(n.layerId,0),l=this.getMin(t,a),c=s+r/2;if(this.kit.less(xe(l,2),xe(c,2))){let h=this.getEnd(t,a,c);return this.adsorp=n,h}return t.end()}checkTrackText(t,e,r,i,n,s){if(e!=n.layerId)return t.end();let a=n.getMathGraphics(n.layerId,0),l=this.getMin(t,a),c=s+r/2;if(this.kit.less(xe(l,2),xe(c,2))){let h=this.getEnd(t,a,c);return this.adsorp=n,h}return t.end()}getEnd(t,e,r){let i=t.end();for(let n of e.primitives)n instanceof M?t instanceof M?(i=this.calcuLineLine(t,n,r),t=new M(t.start(),i)):(i=this.calcuLineArc(n,t,!1,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())):n instanceof q&&(t instanceof M?(i=this.calcuLineArc(t,n,!0,r),t=new M(t.start(),i)):(i=this.calcuArcArc(t,n,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())));return i}getNewPrimitive(t,e){return t instanceof M?new M(t.start(),e):q.build2(t.center,t.startAngle,e.angleD(t.center),t.rx,t.ry,t.sweep())}getPrimitive(t,e=!0){if(e){let r;return t instanceof Ar?r=new M(t.start,t.end):r=q.build2(t.center,t.startAngle/Math.PI*180,t.endAngle/Math.PI*180,t.radius,t.radius,t.sweep),r}else{let r;if(t instanceof Ar)r=new M(t.end,t.start);else{let i=t.sweep==le.CCW?le.CW:le.CCW;r=q.build2(t.center,t.endAngle/Math.PI*180,t.startAngle/Math.PI*180,t.radius,t.radius,i)}return r}}isSameNet(t,e){return t===e}isSameLayer(t,e){return t===e}getProfilePolyline(t){let e=new Array;return t instanceof ct?e=t.primitives:t instanceof nr?t.getAllLinesInOrder().forEach(r=>e.push(r)):e.push(q.build2(t.center,0,360,t.radius,t.radius,le.CCW)),fe.build2(e)}calcuLineLine(t,e,r){let i=t.start(),n=t.end();r+=this.clearance;let s=e.stroke(r*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(i,s))return i;let l=new Set;for(let c of s.primitives){let h=Tt(t,c);if(h>0)for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);l.add(d)}}if(l.size>0){let c=n.distance1(i);l.forEach(h=>{let u=h.distance1(i);u<c&&(n=h,c=u)})}return n}calcuLineArc(t,e,r,i){if(i+=this.clearance,r){let n=t.start(),s=t.end();if(i=i<.01?0:i,i==0)return t.start();let a=e.stroke(i*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(n,a))return n;let c=new Set;for(let h of a.primitives){let u=Tt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=s.distance1(n);c.forEach(u=>{let d=u.distance1(n);d<h&&(s=u,h=d)})}return s}else{let n=e.start(),s=e.end(),a=(e.startAngle%360+360)%360,l=t.stroke(i*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(n,l))return n;let h=new Set;for(let u of l.primitives){let d=Tt(e,u);if(d>0)for(let p=0;p<d;p+=2){let m=new S(Ee[p],Ee[p+1]);h.add(m)}}if(h.size>0){let u=e.center,d=e.sweep(),p=e.sweepAngle;h.forEach(m=>{let g=(m.angleD(u)%360+360)%360;if(d==le.CCW){let y=(g-a+360)%360;y<p&&(s=m,p=y)}else{let y=(g-a-360)%360;y>p&&(s=m,p=y)}})}return s}}calcuArcArc(t,e,r){let i=t.start(),n=t.end(),s=(t.startAngle%360+360)%360,a=e.stroke(r*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(i,a))return i;let c=new Set;for(let h of a.primitives){let u=Tt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=t.center,u=t.sweep(),d=t.sweepAngle;c.forEach(p=>{let m=(p.angleD(h)%360+360)%360;if(u==le.CCW){let g=(m-s+360)%360;g<d&&(n=p,d=g)}else{let g=(m-s-360)%360;g>d&&(n=p,d=g)}})}return n}getMin(t,e){let r=Number.MAX_VALUE;for(let i of e.primitives){let n=new ir(t,i).getDistance();n<r&&(r=n)}return r}modifyTrackEnd(t,e){if(t instanceof Ar)t.end=e;else{let r=e.angle(t.center);t.endAngle=r}}};var P5=class extends Dm{constructor(e,r){super(e);this.block=new df;this.length=e.track.length,this.center=r,this.event.commands=new ve("repair line - single connnect pad"),this.event.blockTrack=this.block.checkIntersection(this.event.track),this.previous=this.createBaseTrack(this.center,this.center,this.event.track),this.center.equals1(this.event.oldStart)?this.direct=this.event.track.direct:this.direct=this.event.track.direct.mul(-1)}move(e){if(this.lock())return;let r=e.sub(this.event.lastMousePosition);this.moveOffset(r)}moveOffset(e){this.recordHistory([this.event.track]);let r=this.draw(this.center,this.event.oldStart.add(e),this.direct);this.changeBaseTrack(this.previous,r[0],r[1]),this.changeBaseTrack(this.event.track,r[1],r[2]),this.blockTrack()}draw(e,r,i){let n=r.sub(e),s=this.getNormalOffset(i,n),a=s.length(),l=e.add(s).add(i.mul(a)),c=l.add(i.mul(this.length));return[e,l,c]}realTimePath(){let e=new Array;return e.push(this.center,this.event.track.start,this.event.track.end),e}blockTrack(){let e=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.isBlock()){let r=this.block.blockTrack(this.event.track,this.getCheckEnd()),i=this.getCheckEnd()?this.event.track.end:this.event.track.start;if(r.distance2(i)>1e-8&&this.event.blockTrack&&(this.event.identify.startType==0||this.event.identify.startType==4?this.event.track.start=r:(this.event.identify.endType==0||this.event.identify.endType==4)&&(this.event.track.end=r)),this.previous!=null){let n=this.previous.length,s=this.block.blockSegment(this.previous,this.event.track.layerId,this.event.track.width,this.event.track.net);if(Math.abs(s.distance1(this.center)-n)>1e-8){let a=s.sub(this.event.oldStart);this.moveOffset(a),this.blockTrack()}}}else this.isPush()&&(this.shove(),this.event.track.hidden(),this.previous!=null&&this.previous.hidden());this.event.adsorpTrackSetting=e}getCheckEnd(){return this.event.identify.startType==0||this.event.identify.startType==4?!1:(this.event.identify.endType==0||this.event.identify.endType==4,!0)}complete(){this.previous!=null&&(this.shoveEvent.shoveTrackComplete(this.event)||(this.mapBase2Track(),A.publish("hasModifyPcbItem",this.event.track))),this.recycleBaseTrack(),this.previous=null,this.shoveEvent.clearCache()}interrupt(){this.recycleBaseTrack(),this.previous=null,this.shoveInterrupt()}};var dV=class extends Dm{constructor(e){super(e);this.block=new df;this.nextIndex=1;this.lastMouseOffset=this.event.lastRealMousePosition.sub(this.event.track.start),this.event.commands=new ve("repair line - single connnect Track"),this.event.blockTrack=this.block.checkIntersection(this.event.track),this.findTrack=new Bu(this.event.track,!0);let r=this.findTrack.tracks.indexOf(this.event.track),i=this.findTrack.pts;r!=0&&this.findTrack.reverseResult();let n=new _e;for(let s of this.findTrack.tracks)n.ext1(s.buildBBox());this.bbox=n.build1(),this.current=this.createBaseTrack(i[0].start(),i[0].end(),this.event.track),this.next=this.createBaseTrack(i[1].start(),i[1].end(),this.findTrack.tracks[1]),this.nextMid=this.createBaseTrack(i[1].start(),i[1].start(),this.findTrack.tracks[1]),this.path=Array.from(this.getLines(i)),this.handleAddSnapFlag(r,this.findTrack),this.blockNext=this.block.checkBaseIntersection(this.next)}move(e,r){if(this.lock())return;if(r){let n=di.snapToSnapFlag(r,!1);n&&(e=n)}let i=this.getOffset(r);this.moveOffset(i),this.blockTrack(),this.optRealTimeAddCorner(i)}getOffset(e){let r,i=di.snapToSnapFlag(e,!1);return i?r=i.sub(this.event.oldStart):r=new S(e.sceneX,e.sceneY).sub(this.event.oldStart).sub(this.lastMouseOffset),r}moveOffset(e){this.visible(),this.recordHistory(this.findTrack.tracks),this.syncTracks(this.findTrack.tracks,this.path);let{resultNext:r,resultPre:i}=this.draw(e,this.path,this.bbox),{index:n,start:s,midPoint:a,end:l}=r;if(n!=0){this.hiddens.length=0;for(let c=0,h=this.findTrack.tracks.length;c<h;c++){let u=this.findTrack.tracks[c];c>n?u.visible():(u.hidden(),this.hiddens.push(u))}this.changeBaseTrack(this.current,i.end,s),this.changeBaseTrack(this.event.track,i.end,s),this.changeBaseTrack(this.nextMid,s,a),this.changeBaseTrack(this.next,a,l),this.next.width=this.findTrack.tracks[n].width,this.nextMid.width=this.findTrack.tracks[n].width,this.nextIndex=n}}draw(e,r,i){if(r.length<=0)throw new Error("path length is zero,input error");let n=!1,s=!1,a=this.isConnectOther(this.findTrack.endType),l=this.findTrack.tracks[0].width;return this.calculateStretch({index:0,offset:e,path:r,bbox:i,isClosed:n,leftIsOther:s,rightIsOther:a,trackWidth:l})}blockTrack(){let e=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.isBlock()){(!this.blockNext||!this.event.blockTrack)&&(this.blockNext=this.block.checkBaseIntersection(this.next),this.event.blockTrack=this.block.checkBaseIntersection(this.current));let r=this.block.blockBaseTrack(this.current,!1),i=this.current.start;r.distance2(i)>1e-8&&this.event.blockTrack&&(this.changeBaseTrack(this.current,r),this.changeBaseTrack(this.event.track,r));let n=this.block.blockBaseTrack(this.next,!1);if(n.distance2(this.next.start)>1e-8&&this.blockNext){let s=this.block.getEnd4Block(this.event.direct,this.current.layerId,this.current.width,this.current.net);n=this.getInRangePoint(this.next.end,n,s,this.event.direct);let a=n.sub(this.path[0].start());this.moveOffset(a),this.blockTrack()}}else this.isPush()&&(this.shove(),this.current.hidden(),this.nextMid.hidden(),this.next.hidden());this.event.adsorpTrackSetting=e}realTimePath(){let e=new Array;e.push(this.current.start),e.push(this.current.end),e.push(this.nextMid.end),e.push(this.next.end);let r=this.getLines(this.path);for(let i=this.nextIndex+1,n=r.length;i<n;i++){let s=r[i];e.push(s.end())}return e}complete(){if(this.event.commands!=null&&this.event.commands.length>0&&!this.shoveEvent.shoveTrackComplete(this.event)){for(let r=0,i=this.findTrack.tracks.length;r<i&&r<=this.nextIndex;r++){let n=this.findTrack.tracks[r];this.event.commands.addCommand(Te.dispatch(n,"delete")),A.publish("hasModifyPcbItem",n),n.remove(),A.publish("delete",n)}for(let r=this.nextIndex+1,i=this.findTrack.tracks.length;r<i;r++)this.findTrack.tracks[r].visible();this.mapBase2Track()}this.recycleBaseTrack(),this.current=null,this.next=null,this.shoveEvent.clearCache()}interrupt(){this.recycleBaseTrack(),this.cancelHiddenTrack(),this.current=null,this.next=null,this.shoveInterrupt()}getIntersection(e,r){return Tt(e,r)>0?new S(Ee[0],Ee[1]):null}optRealTimeAddCorner(e){let{path:r,bbox:i}=this,{current:n,nextIndex:s,next:a}=this,l=0,c=[[-1,null],[l,n],[s,a]],h=!1,u=this.isConnectOther(this.findTrack.endType),d=this.findTrack.tracks[0].width,p=this.realTimeAddCornerPath({offset:e,path:r,realtimeTracks:c,leftIsOther:h,rightIsOther:u,trackWidth:d,bbox:i});p&&(this.path=p,this.event.oldStart=p[l].start())}};var _X=class extends Dm{constructor(e){super(e);this.block=new df;this.lastMouseOffset=this.event.lastRealMousePosition.sub(this.event.track.start),this.event.commands=new ve("repair line - Multi connnect"),this.event.blockTrack=this.block.checkIntersection(this.event.track),this.next=this.createBaseTrack(this.event.oldEnd,this.event.oldEnd,this.event.track),this.previous=this.createBaseTrack(this.event.oldStart,this.event.oldStart,this.event.track);let r=new Bu(this.event.track,!0),i=r.tracks.indexOf(this.event.track);this.handleAddSnapFlag(i,r)}move(e,r){if(this.lock())return;let i=this.getOffset(r);this.moveOffset(i)}getOffset(e){let r,i=di.snapToSnapFlag(e,!1);return i?r=i.sub(this.event.oldStart):r=new S(e.sceneX,e.sceneY).sub(this.event.oldStart).sub(this.lastMouseOffset),r}moveOffset(e){this.visible(),this.recordHistory([this.event.track]);let r=this.getNormalOffset(this.event.direct,e),i=this.event.oldStart.add(r),n=this.getNewTrackEnd(this.event.oldStart,this.event.direct,i,!0),s=this.getNewTrackEnd(this.event.oldEnd,this.event.direct,i,!1);if(this.event.optimizationDirect(s.sub(n).normalize()).dot(this.event.direct)<=0){let l=this.getLine(this.event.oldStart,n),c=this.getLine(this.event.oldEnd,s),h=this.getIntersection(l,c);h!=null&&(n=h,s=h)}this.changeBaseTrack(this.previous,this.event.oldStart,n),this.changeBaseTrack(this.event.track,n,s),this.changeBaseTrack(this.next,s,this.event.oldEnd),this.blockTrack()}realTimePath(){return[this.previous.start,this.previous.end,this.next.start,this.next.end]}blockTrack(){let e=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.isBlock()){this.event.blockTrack||(this.event.blockTrack=this.block.checkIntersection(this.event.track)),this.block.adsorp=null;let r=new Array,i=this.event.line;if(this.blockBaseTrack(this.block,this.previous,!0,i.direct,this.event.track,r),this.blockBaseTrack(this.block,this.next,!0,i.direct,this.event.track,r,!1),this.blockBaseTrack(this.block,this.event.track,this.event.blockTrack,i.direct,this.event.track,r),r.length>0){let s=this.event.getEnd(i,r).sub(i.start());this.moveOffset(s)}}else this.isPush()&&(this.shove(),this.event.track.hidden(),this.previous.hidden(),this.next.hidden());this.event.adsorpTrackSetting=e}complete(){this.event.commands!=null&&this.event.commands.length>0&&(this.shoveEvent.shoveTrackComplete(this.event)||(this.mapBase2Track(),A.publish("hasModifyPcbItem",this.event.track)),this.recycleBaseTrack(),this.previous=null,this.next=null),this.shoveEvent.clearCache()}interrupt(){this.recycleBaseTrack(),this.cancelHiddenTrack(),this.previous=null,this.next=null,this.shoveInterrupt()}};var vX=class extends Dm{constructor(e,r){super(e);this.block=new df;this.lastMouseOffset=this.event.lastRealMousePosition.sub(this.event.track.start),this.center=r,this.findTrack=new Bu(this.event.track,!0),this.findTrack.tracks.indexOf(this.event.track)!=0&&this.findTrack.reverseResult(),this.index=this.findTrack.tracks.indexOf(this.event.track),this.nextIndex=this.index+1;let n=new _e;for(let s of this.findTrack.tracks)n.ext1(s.buildBBox());this.bbox=n.build1(),this.previous=this.createBaseTrack(this.center,this.center,this.event.track),this.current=this.createBaseTrack(this.findTrack.pts[0].start(),this.findTrack.pts[0].end(),this.event.track),this.next=this.createBaseTrack(this.findTrack.pts[1].start(),this.findTrack.pts[1].end(),this.findTrack.tracks[1]),this.nextMid=this.createBaseTrack(this.findTrack.pts[1].start(),this.findTrack.pts[1].start(),this.findTrack.tracks[1]),this.center=r,this.event.commands=new ve("repair line - connnect Track and other"),this.blockNext=this.block.checkBaseIntersection(this.next),this.event.blockTrack=this.block.checkIntersection(this.event.track),this.handleAddSnapFlag(this.index,this.findTrack)}move(e,r){if(this.lock())return;let i=this.getOffset(r);this.moveOffset(i)}getOffset(e){let r,i=di.snapToSnapFlag(e,!1);return i?r=i.sub(this.event.oldStart):r=new S(e.sceneX,e.sceneY).sub(this.event.oldStart).sub(this.lastMouseOffset),r}moveOffset(e){this.visible(),this.recordHistory([this.event.track]);let{resultPre:r,resultNext:i}=this.draw(e,this.getLines(this.findTrack.pts),this.bbox);for(let n=0,s=this.findTrack.tracks.length;n<s;n++){let a=this.findTrack.tracks[n];n>i.index?a.visible():(a.hidden(),this.hiddens.push(a))}this.changeBaseTrack(this.previous,r.start,r.end),this.changeBaseTrack(this.current,r.end,i.start),this.changeBaseTrack(this.event.track,r.end,i.start),this.changeBaseTrack(this.nextMid,i.start,i.midPoint),this.changeBaseTrack(this.next,i.midPoint,i.end),this.next.width=this.findTrack.tracks[i.index].width,this.nextMid.width=this.findTrack.tracks[i.index].width,this.nextIndex=i.index,this.blockTrack()}draw(e,r,i){if(r.length<=0)throw new Error("path length is zero,input error");let n=!1,s=!0,a=this.isConnectOther(this.findTrack.endType),l=this.findTrack.tracks[0].width,c=this.index;return this.calculateStretch({index:c,offset:e,path:r,bbox:i,isClosed:n,leftIsOther:s,rightIsOther:a,trackWidth:l})}realTimePath(){let e=new Array,r=!1,i=this.getLines(this.findTrack.pts);for(let n=0,s=i.length;n<s;n++){let a=i[n];n>this.nextIndex?e.push(a.end()):r||(e.push(this.previous.start,this.current.start,this.current.end,this.nextMid.end,this.next.end),r=!0)}return e}blockTrack(){let e=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.isBlock()){(!this.blockNext||!this.event.blockTrack)&&(this.blockNext=this.block.checkBaseIntersection(this.next),this.event.blockTrack=this.block.checkBaseIntersection(this.current)),this.block.adsorp=null;let r=new Array,i=this.findTrack.pts[this.index];if(this.blockBaseTrack(this.block,this.previous,!0,i.direct,this.current,r),this.blockBaseTrack(this.block,this.next,this.blockNext,i.direct,this.current,r,!1),this.blockNext&&r.length==0&&this.blockBaseTrack(this.block,this.current,this.event.blockTrack,i.direct,this.current,r),r.length>0){let s=this.event.getEnd(i,r).sub(i.start());this.moveOffset(s)}}else this.isPush()&&(this.shove(),this.previous.hidden(),this.current.hidden(),this.next.hidden(),this.nextMid.hidden());this.event.adsorpTrackSetting=e}complete(){if(this.event.commands!=null&&!this.shoveEvent.shoveTrackComplete(this.event)){for(let r=0,i=this.findTrack.tracks.length;r<i;r++){let n=this.findTrack.tracks[r];r>this.nextIndex?n.visible():n.isEmpty||(this.event.commands.addCommand(Te.dispatch(n,"delete")),A.publish("hasModifyPcbItem",n),n.remove(),A.publish("delete",n))}this.mapBase2Track()}this.recycleBaseTrack(),this.previous=null,this.current=null,this.next=null,this.shoveEvent.clearCache()}interrupt(){this.recycleBaseTrack(),this.cancelHiddenTrack(),this.previous=null,this.current=null,this.next=null,this.shoveInterrupt()}};var xX=class extends Dm{constructor(e){super(e);this.block=new df;this.lastMouseOffset=this.event.lastRealMousePosition.sub(this.event.track.start),this.findTrack=new Bu(this.event.track,!0);let r=this.findTrack.tracks.indexOf(this.event.track),i=this.isConnectOther(this.findTrack.startType),n=this.isConnectOther(this.findTrack.endType),s=this.findTrack.pts;this.isClosed=!1,!i&&!n&&s[0].start().equals(s[s.length-1].end())&&(this.isClosed=!0),this.index=r,this.previousIndex=this.getPreIndex(r,s,this.isClosed),this.nextIndex=this.getNextIndex(r,s,this.isClosed);let a=new _e;for(let d of this.findTrack.tracks)a.ext1(d.buildBBox());this.bbox=a.build1();let l=this.findTrack.pts[this.previousIndex],c=this.findTrack.tracks[this.previousIndex];this.previous=this.createBaseTrack(l.start(),l.end(),c),this.previousMid=this.createBaseTrack(l.end(),l.end(),c),this.current=this.createBaseTrack(this.findTrack.pts[r].start(),this.findTrack.pts[r].end(),this.event.track);let h=this.findTrack.pts[this.nextIndex],u=this.findTrack.tracks[this.nextIndex];this.nextMid=this.createBaseTrack(h.start(),h.start(),u),this.next=this.createBaseTrack(h.start(),h.end(),u),this.path=Array.from(this.getLines(this.findTrack.pts)),this.blockPrev=this.block.checkBaseIntersection(this.previous),this.blockNext=this.block.checkBaseIntersection(this.next),this.event.blockTrack=this.block.checkBaseIntersection(this.current),this.event.commands=new ve("repair line - connect Track"),this.handleAddSnapFlag(this.index,this.findTrack)}move(e,r){if(this.lock())return;let i=this.getOffset(r);this.moveOffset(i),this.blockTrack(),this.optRealTimeAddCorner(i)}getOffset(e){let r,i=di.snapToSnapFlag(e,!1);return i?r=i.sub(this.event.oldStart):r=new S(e.sceneX,e.sceneY).sub(this.event.oldStart).sub(this.lastMouseOffset),r}moveOffset(e){this.visible(),this.recordHistory(this.findTrack.tracks),this.syncTracks(this.findTrack.tracks,this.path);let{resultPre:r,resultNext:i}=this.draw(e,this.path,this.bbox);for(let a=0,l=this.findTrack.tracks.length;a<l;a++){let c=this.findTrack.tracks[a];this.isClosed&&a<r.index&&a>i.index||!this.isClosed&&(a<r.index||a>i.index)?c.visible():(c.hidden(),this.hiddens.push(c))}this.changeBaseTrack(this.previous,r.start,r.midPoint),this.changeBaseTrack(this.previousMid,r.midPoint,r.end),this.changeBaseTrack(this.current,r.end,i.start),this.changeBaseTrack(this.event.track,r.end,i.start),this.changeBaseTrack(this.nextMid,i.start,i.midPoint),this.changeBaseTrack(this.next,i.midPoint,i.end);let n=this.findTrack.tracks[r.index].width;this.previous.width=n,this.previousMid.width=n;let s=this.findTrack.tracks[i.index].width;this.next.width=s,this.nextMid.width=s,this.previousIndex=r.index,this.nextIndex=i.index}draw(e,r,i){let{isClosed:n}=this,s=this.isConnectOther(this.findTrack.startType),a=this.isConnectOther(this.findTrack.endType),l=this.findTrack.tracks[0].width,c=this.index;return this.calculateStretch({index:c,offset:e,path:r,bbox:i,isClosed:n,leftIsOther:s,rightIsOther:a,trackWidth:l})}blockTrack(){let e=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.isBlock()){(!this.blockPrev||!this.blockNext||!this.event.blockTrack)&&(this.blockPrev=this.block.checkBaseIntersection(this.previous),this.blockNext=this.block.checkBaseIntersection(this.next),this.event.blockTrack=this.block.checkBaseIntersection(this.current)),this.block.adsorp=null;let r=new Array,n=this.path[this.index];if(this.blockBaseTrack(this.block,this.previous,this.blockPrev,n.direct,this.current,r),this.blockBaseTrack(this.block,this.next,this.blockNext,n.direct,this.current,r,!1),this.blockPrev&&this.blockNext&&r.length==0&&this.blockBaseTrack(this.block,this.current,this.event.blockTrack,n.direct,this.current,r),r.length>0){let a=this.event.getEnd(n,r).sub(n.start());this.moveOffset(a),this.blockTrack()}}else this.isPush()&&(this.shove(),this.previous.hidden(),this.previousMid.hidden(),this.current.hidden(),this.next.hidden(),this.nextMid.hidden());this.event.adsorpTrackSetting=e}shove(){let e=this.realTimePath(),r=this.shoveEvent.getNewChainFactory(this.chain,e).build();this.shoveEvent.shoveFun.remove4Rtree([this.chain]),this.shoveEvent.shoveFun.shoveMain(r),this.shoveEvent.shoveFun.add4Rtree([this.chain]);let i=this.shoveEvent.shoveFun.result;i.sourceTrackChain[0]=this.chain.tracks,this.shoveEvent.current=i,this.shoveEvent.preview(i)}realTimePath(){let e=new Array,r=!1,i=this.getLines(this.path);for(let n=0,s=i.length;n<s;n++){let a=i[n];n<this.previousIndex?e.push(a.start()):n>this.nextIndex?e.push(a.end()):r||(e.push(this.previous.start,this.previousMid.start,this.current.start,this.current.end,this.nextMid.end,this.next.end),r=!0)}return e}complete(){if(this.event.commands!=null&&this.event.commands.length>0&&!this.shoveEvent.shoveTrackComplete(this.event)){for(let r=0,i=this.findTrack.tracks.length;r<i;r++){let n=this.findTrack.tracks[r];this.isClosed&&r<this.previousIndex&&r>this.nextIndex||!this.isClosed&&(r<this.previousIndex||r>this.nextIndex)?n.visible():n.isEmpty||(this.event.commands.addCommand(Te.dispatch(n,"delete")),A.publish("hasModifyPcbItem",n),n.remove(),A.publish("delete",n))}this.mapBase2Track()}this.recycleBaseTrack(),this.previous=null,this.current=null,this.next=null,this.shoveEvent.clearCache()}interrupt(){this.recycleBaseTrack(),this.cancelHiddenTrack(),this.previous=null,this.current=null,this.next=null,this.shoveInterrupt()}optRealTimeAddCorner(e){let{path:r,isClosed:i,bbox:n}=this,{previousIndex:s,previous:a,index:l,current:c,nextIndex:h,next:u}=this,d=[[s,a],[l,c],[h,u]],p=this.isConnectOther(this.findTrack.startType),m=this.isConnectOther(this.findTrack.endType),g=this.findTrack.tracks[0].width,y=this.realTimeAddCornerPath({offset:e,path:r,realtimeTracks:d,leftIsOther:p,rightIsOther:m,isClosed:i,trackWidth:g,bbox:n});y&&(this.path=y,this.event.oldStart=y[l].start())}};var CD=class{constructor(t){this.adsorpTrackSetting=!0;this.commands=null;this.addHistory=!0;this.identify=null;this.track=null;this.direct=null;this.adsorbtion=!1;this.point=null;this.blockTrack=!0;this.resultTrack=null;this.isCoSelect=!1;this.isMultiRepair=!1;this.isClickPoint=!1;this.numberOfIterator=0;this.track=t,this.oldStart=t.start,this.oldEnd=t.end,this.direct=this.optimizationDirect(this.oldEnd.sub(this.oldStart).normalize()),this.identify=new Nu(t),this.line=this.track.primitive,this.isCoSelect=this.isCoSelect,this.lastMousePosition=t.start,jt.getToleranceTargetNet(this.track.net)}get coSelect(){return this.isCoSelect}set coSelect(t){this.isCoSelect=t}getTool(){let t=new Bu(this.track,!0),e=t.tracks.indexOf(this.track),r=t.tracks[e-1]!=null,i=t.tracks[e+1]!=null;if(r&&i)return new xX(this);let n=this.identify.startType,s=this.identify.endType;if(n==0||n==4){if(s==0||s==4)return r||i?new dV(this):new uV(this);if(s==5||s==6){let a=this.identify.endNodes[0],l=this.optimizationDirect(a.end.sub(a.start).normalize());return Math.abs(this.direct.cross(l))<Rl?new P5(this,this.oldEnd):new dV(this)}else return new P5(this,this.oldEnd)}else if(n==5||n==6){let a=this.identify.startNodes[0],l=this.optimizationDirect(a.end.sub(a.start).normalize()),c=Math.abs(this.direct.cross(l));return s==0||s==4?c<Rl?new P5(this,this.oldStart):new dV(this):s==5||s==6?new xX(this):new vX(this,this.oldEnd)}else{if(s==0||s==4)return new P5(this,this.oldStart);if(s==5||s==6){let a=this.identify.endNodes[0],l=this.optimizationDirect(a.end.sub(a.start).normalize());return Math.abs(this.direct.cross(l))<Rl?new _X(this):new vX(this,this.oldStart)}else return new _X(this)}}setMultiRepair(t){this.isMultiRepair=t}isBlock(){if(this.isMultiRepair)return!1;let t=tr.getInstance();return t.mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"||t.mode=="WIRING_MODE_SURROUND"}isPush(){return this.isMultiRepair?!1:tr.getInstance().mode=="WIRING_MODE_PUSHAWAY"}optimizationDirect(t){let e;Math.abs(t.x)<1e-8?e=0:e=t.x;let r;return Math.abs(t.y)<1e-8?r=0:r=t.y,new S(e,r)}adsorb(t,e,r){if(!Pi.getInstance().adsorb||!this.adsorpTrackSetting)return t;this.clearAdsorpPoint();let i=new _e().ext2(t).ext7(e).build1(),n=Vt.search(i,(l,c)=>(c=="ArcTrack"||c=="Track")&&l==r||c=="Pad"&&(l==12||l==r)||c=="Via");n.setFilter(new a0(t.x,t.y)).setFilter(new vd);let s=new $1;n.setAction(s),n.doAction(["Track","ArcTrack","Pad","Via"]);let a=new Array;for(let l of s.pads)if(l.net==this.track.net)return this.showAdsorpPoint(l.center),l.center;for(let l of s.vias)if(l.net==this.track.net)return this.showAdsorpPoint(l.center),l.center;for(let l of s.tracks)l!=this.track&&a.push(l);return a.length>0?di.adsorpTrack(t,a[0]):t}showAdsorpPoint(t){this.point=new qi(1002,t),setTimeout(()=>{this.point!=null&&(this.point.remove(),this.point=null)},2e3)}clearAdsorpPoint(){this.point!=null&&(this.point.remove(),this.point=null)}adsorpTrack(t,e,r,i){if(!this.adsorpTrackSetting)return t;let n=new _e().ext2(t).ext7(e).build1(),s=Vt.search(n,(l,c)=>l==r&&(c=="Track"||c=="ArcTrack")),a=new Array;for(let l of s.getTracks())!i.has(l)&&l.isSelect(t.x,t.y)&&l.isVisible&&l.layerId==r&&l.net==this.track.net&&a.push(l);return a.length>0?di.adsorpTrack(t,a[0]):t}getEnd(t,e){let r=Number.MAX_VALUE,i=e[0];for(let n of e){let a=ir.foot(t,n).distance2(n);a<r&&(r=a,i=n)}return i}};var lse=class extends Dm{constructor(e,r,i){super(e);this.orthogonalFirst=!1;this.degreeTool=new no;this.setUpConnectTrack(r);let n=this.event.direct;this.orthogonalFirst=Math.abs(n.cross(new S(0,1)))<Rl||Math.abs(n.cross(new S(1,0)))<Rl,this.event.commands=new ve(i)}repairTrack(e){if(this.lock())return;this.dragPoint=this.dragPoint.multiply4(e),this.visible(),this.recordHistory();let r=this.degreeTool.degree45Model(this.dragPoint,this.fixedPoint),i=r[0];this.orthogonalFirst&&(i=r[1]),this.changeBaseTrack(this.current,this.dragPoint,i),this.changeBaseTrack(this.next,i,this.fixedPoint)}move(e){}moveOffset(e){}complete(){this.event.commands!=null&&this.event.commands.length>0&&(this.shoveEvent.shoveTrackComplete(this.event)||(A.publish("hasModifyPcbItem",this.current),this.isTrack(this.next)&&A.publish("hasModifyPcbItem",this.next),this.mapBase2Track())),this.recycleBaseTrack(),this.current=null,this.next=null,this.shoveEvent.clearCache()}recordHistory(){let e=[this.current];this.isTrack(this.next)&&e.push(this.next),super.recordHistory(e)}getAssociationTrack(){return this.isTrack(this.next)?this.next:null}lock(){return this.current.locked}isTrack(e){return e instanceof Ar&&!(e instanceof $d)}setUpConnectTrack(e){this.findTrack=new Bu(this.event.track,!0);let{tracks:r,pts:i}=this.findTrack,n=r.indexOf(this.event.track),s=new Nu(r[n]);if(e){let a=r.indexOf(s.endNodes[0]);a>0?n>a&&this.findTrack.reverseResult():r[n].start.equals1(i[n].start())||this.findTrack.reverseResult()}else{let a=r.indexOf(s.startNodes[0]);a>0?n>a&&this.findTrack.reverseResult():r[n].end.equals1(i[n].start())||this.findTrack.reverseResult()}i=this.findTrack.pts,n=r.indexOf(this.event.track),this.current=r[n],this.current.start=i[n].start(),this.current.end=i[n].end(),r[n+1]&&!r[n+1].locked?(this.next=r[n+1],this.next.start=i[n].end(),this.next.end=i[n+1].end()):this.next=this.createBaseTrack(i[n].end(),i[n].end(),this.event.track),this.dragPoint=this.current.start,this.fixedPoint=this.next.end}interrupt(){this.recycleBaseTrack(),this.current=null,this.next=null,this.shoveInterrupt()}};var pg=hI();function OOt(){var o,t;return pg.innerWidth||((t=(o=pg.document)==null?void 0:o.documentElement)==null?void 0:t.clientWidth)||0}function AOt(){var o,t;return pg.innerHeight||((t=(o=pg.document)==null?void 0:o.documentElement)==null?void 0:t.clientHeight)||0}var UTn={winWidth:OOt(),winHeight:AOt()};function yP(o){return navigator.userAgent.indexOf(o)}var r2=yP("Mac OS")>0,sUe=yP("chromeframe")>0||yP("x-clock")>0,cse=(yP("MSIE")>0||yP("Trident")>=0)&&!sUe,_Ot=cse&&yP("MSIE 9.0")>0,C9e=yP("Edge/")>0,RX=yP("Opera/")===0,SD=yP("Firefox/")>0,vOt=SD&&navigator.userAgent.match(/Firefox\/(\d+(\.\d+)?)/)[1],xOt=yP("AppleWebKit")>0,l9=yP("Chrome/")>0&&!cse&&!C9e&&!RX&&!SD,ROt=l9&&navigator.userAgent.match(/Chrome\/(\d+(\.\d+)?)/)[1],DOt=yP("Safari/")>-1&&!cse&&!C9e&&!RX&&!SD&&!l9,wOt=yP("Electron/")>0,oUe,LOt=(oUe=pg.document)==null?void 0:oUe.createDocumentFragment();pg.isMacOS=r2;pg.gClipboard=LOt;pg.isChromeFrame=sUe;pg.isIE=cse;pg.isIE9=_Ot;pg.isEdge=C9e;pg.isOpera=RX;pg.isFirefox=SD;pg.firefoxVersion=vOt;pg.isWebkit=xOt;pg.isChrome=l9;pg.chromeVersion=ROt;pg.isSafari=DOt;pg.isElectron=wOt;var gb=(Dt=>(Dt[Dt.A=65]="A",Dt[Dt.B=66]="B",Dt[Dt.C=67]="C",Dt[Dt.D=68]="D",Dt[Dt.E=69]="E",Dt[Dt.F=70]="F",Dt[Dt.G=71]="G",Dt[Dt.H=72]="H",Dt[Dt.I=73]="I",Dt[Dt.J=74]="J",Dt[Dt.K=75]="K",Dt[Dt.L=76]="L",Dt[Dt.M=77]="M",Dt[Dt.N=78]="N",Dt[Dt.O=79]="O",Dt[Dt.P=80]="P",Dt[Dt.Q=81]="Q",Dt[Dt.R=82]="R",Dt[Dt.S=83]="S",Dt[Dt.T=84]="T",Dt[Dt.U=85]="U",Dt[Dt.V=86]="V",Dt[Dt.W=87]="W",Dt[Dt.X=88]="X",Dt[Dt.Y=89]="Y",Dt[Dt.Z=90]="Z",Dt[Dt.NUM0=48]="NUM0",Dt[Dt.NUM1=49]="NUM1",Dt[Dt.NUM2=50]="NUM2",Dt[Dt.NUM3=51]="NUM3",Dt[Dt.NUM4=52]="NUM4",Dt[Dt.NUM5=53]="NUM5",Dt[Dt.NUM6=54]="NUM6",Dt[Dt.NUM7=55]="NUM7",Dt[Dt.NUM8=56]="NUM8",Dt[Dt.NUM9=57]="NUM9",Dt[Dt.KEY0=96]="KEY0",Dt[Dt.KEY1=97]="KEY1",Dt[Dt.KEY2=98]="KEY2",Dt[Dt.KEY3=99]="KEY3",Dt[Dt.KEY4=100]="KEY4",Dt[Dt.KEY5=101]="KEY5",Dt[Dt.KEY6=102]="KEY6",Dt[Dt.KEY7=103]="KEY7",Dt[Dt.KEY8=104]="KEY8",Dt[Dt.KEY9=105]="KEY9",Dt[Dt.MUL=106]="MUL",Dt[Dt.ADD=107]="ADD",Dt[Dt.Enter=108]="Enter",Dt[Dt.SUB=109]="SUB",Dt[Dt.DOT=110]="DOT",Dt[Dt.DIVISION=111]="DIVISION",Dt[Dt.F1=112]="F1",Dt[Dt.F2=113]="F2",Dt[Dt.F3=114]="F3",Dt[Dt.F4=115]="F4",Dt[Dt.F5=116]="F5",Dt[Dt.F6=117]="F6",Dt[Dt.F7=118]="F7",Dt[Dt.F8=119]="F8",Dt[Dt.F9=120]="F9",Dt[Dt.F10=121]="F10",Dt[Dt.F11=122]="F11",Dt[Dt.F12=123]="F12",Dt[Dt.BackSpace=8]="BackSpace",Dt[Dt.Esc=27]="Esc",Dt[Dt.RightArrow=39]="RightArrow",Dt[Dt.LeftArrow=37]="LeftArrow",Dt[Dt.DownArrow=40]="DownArrow",Dt[Dt.UpArrow=38]="UpArrow",Dt[Dt.sub=SD?173:189]="sub",Dt[Dt.dot=190]="dot",Dt[Dt.Spacebar=32]="Spacebar",Dt[Dt.Tab=9]="Tab",Dt[Dt.PageUp=33]="PageUp",Dt[Dt.PageDown=34]="PageDown",Dt[Dt.KeyEnter=13]="KeyEnter",Dt[Dt.Insert=45]="Insert",Dt[Dt.SEMICOLON=SD?59:186]="SEMICOLON",Dt[Dt.Delete=46]="Delete",Dt[Dt.BackQuote=192]="BackQuote",Dt[Dt.SLASH=191]="SLASH",Dt[Dt.NumLock=144]="NumLock",Dt[Dt.Control=17]="Control",Dt[Dt.Home=36]="Home",Dt[Dt.End=35]="End",Dt[Dt.Shift=16]="Shift",Dt[Dt.LBRACKET=219]="LBRACKET",Dt[Dt.RBRACKET=221]="RBRACKET",Dt[Dt.VECLINE=220]="VECLINE",Dt[Dt.EQUAL=SD?61:187]="EQUAL",Dt[Dt.LESS=188]="LESS",Dt[Dt.QUOTE=222]="QUOTE",Dt[Dt.CapeLock=20]="CapeLock",Dt[Dt.Alt=18]="Alt",Dt[Dt.Meta=91]="Meta",Dt))(gb||{});var Qg=class o{static set(t){t||(t={ctrlKey:!1,altKey:!1,shiftKey:!1});let e=o.getMouseKeyStatus(t);o.status=e}static getMouseKeyStatus(t){let{ctrlKey:e,altKey:r,shiftKey:i}=t;if([17,16,18].includes(t.keyCode)){if(!e&&!i&&!r)return 0;if(e&&!i&&!r)return 1;if(!e&&i&&!r)return 2;if(!e&&!i&&r)return 3;if(e&&i&&!r)return 4;if(e&&!i&&r)return 5;if(!e&&i&&r)return 6;if(e&&i&&r)return 7}else return 0}static getTrackFollowComponentStatus(){let t=ce.pcbConfig.trackFollow==="moveKeep";return o.status===5?!t:t}static getTrackFollowViaStatus(){let t=ce.pcbConfig.trackFollowVia==="moveKeep";return o.status===5?!t:t}};var DX=class{constructor(t,e=!0){this.item=t,this.isStart=e,t instanceof Ue?this.point=e?t.start:t.end:this.point=t.center,this.box=this.point.bbox().extendOfSize(.02)}bbox(){return this.box}},wX=class{constructor(t){this.items=new Set;this.all=new Set;this.tracks=new Map;this._ready=!1;this.items=new Set(t)}get ready(){return this._ready}set ready(t){this._ready=t}modifyTrackPosition(t){let e=Qg.getTrackFollowComponentStatus(),r=Qg.getTrackFollowViaStatus(),i=[],n=new Set;for(let c of this.items)if(c instanceof Me){let h=c.getPads(),u=c.getVias();h.forEach(d=>{e&&i.push(d),n.add(d)}),u.forEach(d=>{r&&i.push(d),n.add(d)})}else c instanceof Le?(e&&i.push(c),n.add(c)):(c instanceof Ge&&r&&i.push(c),n.add(c));let s=new Hd,a=[];i.forEach(c=>{if(!c.isEmpty&&(c instanceof Le||c instanceof Ge)){let h=[],u=[],d=this.searchConnectTrack(c);for(let y of d)y instanceof Ue&&y.getParent()==null&&s.needCheckIntersection(y.model,c.model)&&(c.isSelect(y.start.x,y.start.y)||c.isSelect(y.end.x,y.end.y))&&(y.start.distance2(c.center)<1e-4||y.end.distance2(c.center)<1e-4?h.push(y):n.has(y)||u.push(y));let p=new Set(h);h.forEach(y=>{this.excludeTracks(y,p,u)}),n.forEach(y=>(y instanceof Ue&&p.add(y),!0));let m=c.center;u.sort((y,b)=>{let P=Math.min(m.distance2(y.start),m.distance2(y.end)),T=Math.min(m.distance2(b.start),m.distance2(b.end));return P-T}).forEach(y=>{if(p.has(y)||y.locked)return;let b=new Bu(y,!0);this.handleFindTrack(b,y,u,c,p).forEach(T=>{a.push(...iUe(T.tracks,c.center,T.pts,T.sameOri,t))})})}}),a.filter(c=>{var h,u,d,p;if(c.length==0){let m=xt.getInstance().getNode(c.model);if(m){let g=m.parent;m.parent.getAllItems().forEach(y=>{xt.getInstance().delete(y)}),(u=(h=g.viaNode)==null?void 0:h.prev)==null||u.deleteConnectTrack(g),(p=(d=g.viaNode)==null?void 0:d.next)==null||p.deleteConnectTrack(g)}return t.addCommand(Te.dispatch(c,"delete")),c.remove(),A.publish("delete",c),!1}return!0}).forEach(c=>{let h=xt.getInstance().getListNode(c.model);Fr.getInstance().addInputStatus(h)})}searchConnectTrack(t){return Vt.search4Types(t.buildBBox(),["Track","ArcTrack"],(e,r)=>r=="Track"||"ArcTrack"?t instanceof Ge?t.isContains(e):t.layerId==12?!0:t.layerId==e:!1).getTracks()}handleFindTrack(t,e,r,i,n){let s=t.tracks,a=t.pts,l=s[0],c=s.length-1,h=s[c];if(r.includes(l)){let p=a[0].start();if(i.isSelect(p.x,p.y)){let m=u(l,a[0],s[1],a[1]);return this.excludeTracks(l,n,r,p),s.forEach(g=>{n.add(g)}),m}}if(r.includes(h)){let p=a[c].end();if(i.isSelect(p.x,p.y)){let m=d(h,a[c],s[c-1],a[c-1]);return this.excludeTracks(h,n,r,p),s.forEach(g=>{n.add(g)}),m}}for(let p=0;p<s.length;p++){let m=s[p],g=a[p];if(e.globalIndex==m.globalIndex){let y=[],b=g.start(),P=g.end(),T,I,C;if(b.distance2(i.center)<P.distance2(i.center)?(C=b,I=p,r.includes(s[p-1])&&!n.has(s[p-1])&&(T=p-1)):(C=P,T=p,r.includes(s[p+1])&&!n.has(s[p+1])&&(I=p+1)),I!=null){let E=s[I],O=a[I];u(E,O,s[I+1],a[I+1]).forEach(_=>{y.push(_)}),this.excludeTracks(E,n,r,C)}if(T!=null){let E=s[T],O=a[T];d(E,O,s[T-1],a[T-1]).forEach(_=>{y.push(_)}),this.excludeTracks(E,n,r,C)}return s.forEach(E=>{n.add(E)}),y}}function u(p,m,g,y){let b=m.start(),P=m.end(),T=p.start.equals1(b);return g&&n.has(g)&&(g=null),g?[{tracks:[p,g],pts:[b,P,y.end()],sameOri:T}]:[{tracks:[p],pts:[b,P],sameOri:T}]}function d(p,m,g,y){let b=m.start(),P=m.end();g&&n.has(g)&&(g=null);let T=p.start.equals1(P);return g?[{tracks:[p,g],pts:[P,b,y.start()],sameOri:T}]:[{tracks:[p],pts:[P,b],sameOri:T}]}return[]}excludeTracks(t,e,r,i){let n=[t];for(;n.length>0;){let s=[];n.forEach(a=>{let l=a.searchCycleNode().filter(c=>{if(c instanceof Ue&&!e.has(c)&&r.includes(c)){let h=!1;if(i&&(h=c.start.distance2(i)<1e-4||c.end.distance2(i)<1e-4),!h)return e.add(c),!0}return!1});s.push(...l)}),i&&(i=null),n=s}}setUpConnectTrack(){if(this._ready)return;let t=Qg.getTrackFollowComponentStatus(),e=Qg.getTrackFollowViaStatus();this._ready=!0;let r=[],i=new Set;for(let n of this.items)if(n instanceof Me){let s=n.getPads(),a=n.getVias();s.forEach(l=>{l.isEmpty||(t&&r.push(l),i.add(l))}),a.forEach(l=>{l.isEmpty||(e&&r.push(l),i.add(l))})}else n instanceof Le?n.isEmpty||(t&&r.push(n),i.add(n)):n instanceof Ge?n.isEmpty||(e&&r.push(n),i.add(n)):n.isEmpty||i.add(n);this.items=i,this.bfs1(r,t,e)}bfs1(t,e=!0,r=!0){let i=new Map;for(let s of t)if(s instanceof Le){if(e){let a=i.get(s.net);a==null&&(a=new Array,i.set(s.net,a)),a.push(s)}}else if(r){let a=i.get(s.net);a==null&&(a=new Array,i.set(s.net,a)),a.push(s)}let n=new Hd;for(let[s,a]of i){let l=s==""?ze.getAllNoneNetsItems():ze.getSameNetItems(s),c=new nn(10);for(let d of l)d instanceof Ue?(c.add(new DX(d)),c.add(new DX(d,!1))):(d instanceof Le||d instanceof Ge)&&c.add(new DX(d));let h=new Set;for(let d of a){let p=c.search(d.buildBBox());for(let m of p){let g=m.item;g instanceof Ue&&g.getParent()==null&&n.needCheckIntersection(d.model,g.model)&&(m.point.distance2(d.center)<1e-4||this.items.has(g)&&d.isSelect(m.point.x,m.point.y))&&h.add(m)}}let u=new Set;for(Re.addAllSet(u,h);h.size>0;){let d=new Set;for(let p of h){let m=p.item;if(!this.items.has(p.item))this.tracks.set(m.globalIndex,{track:m,moveStart:p.isStart,movePoint:p.isStart?m.start:m.end});else{let g=p.isStart?m.end.bbox():m.start.bbox(),y=p.isStart?m.end:m.start,b=c.search(g),P=!1,T=new Set;for(let I of b){if(u.has(I))continue;let C=I.item;if(n.needCheckIntersection(m.model,C.model)&&I.point.distance2(y)<1e-4)if(C instanceof Ue)this.items.has(C)?T.add(I):this.tracks.set(m.globalIndex,{track:m,moveStart:p.isStart,movePoint:p.isStart?m.start:m.end});else{this.items.has(C)||this.tracks.set(m.globalIndex,{track:m,moveStart:p.isStart,movePoint:p.isStart?m.start:m.end}),P=!0;break}}P||Re.addAllSet(d,T)}}h=d,Re.addAllSet(u,h)}}}};var S9e=class{constructor(t){this.item=t}bbox(){return this.item.buildBBox()}},cl=class{constructor(t,e,r=!1){this.items=new Set;this.tracks=new Set;this.moveTools={};this.status={};this.events=new Set;this.moveWholeTracks=new Set;this.groupSet=new Set;this.command=new ve("connect wire");this.preprocessing=!1;this.addHistory=!0;this.needUndoCommand=!0;this.needFollow=!0;this.maxItemNum=400;this.ratlines=null;let i=[];for(let n of t)if(Bt.checkIsCanEditByItem(n)&&(i.push(n),n instanceof Le||n instanceof Ge)){let s=n.getParent();s!=null&&this.items.add(s)}for(let n of i)this.addItem(this.items,n);this.items.size>this.maxItemNum&&(this.needFollow=!1),!r&&Qg.getTrackFollowComponentStatus()&&this.needFollow&&this.filterConnectTracks(),this.itemConnectTrack=new wX(this.items),this.needFollow?(this.itemConnectTrack.setUpConnectTrack(),this.addTearDrop(this.itemConnectTrack)):this.teardropFollowItems(),e&&(this.needUndoCommand=!1,this.command=e)}addTearDrop(t){let e=new Set,r=new Set;for(let i of this.items)if(i instanceof Me){let n=i.getPads(),s=i.getVias();for(let a of n)r.add(a.globalIndex);for(let a of s)r.add(a.globalIndex)}else r.add(i.globalIndex);for(let[i,n]of t.tracks)r.delete(n.track.globalIndex);for(let i of this.items){let n=pt.getTears(i.globalIndex);if(n!=null){for(let s of n)if(!e.has(s)){let a=s.getComponent().connects,l=!0;for(let c of a)if(!r.has(c)){l=!1;break}l&&e.add(s)}}}Re.addAllSet(this.items,e)}teardropFollowItems(){let t=new Set,e=new Set;for(let r of this.items)if(r instanceof Me){let i=r.getPads(),n=r.getVias();for(let s of i)e.add(s.globalIndex);for(let s of n)e.add(s.globalIndex)}else e.add(r.globalIndex);for(let r of e){let i=pt.getTears(r);if(i!=null){for(let n of i)if(!t.has(n)){let s=n.getComponent().connects,a=!0;for(let l of s)if(!e.has(l)){a=!1;break}a&&t.add(n)}}}Re.addAllSet(this.items,t)}addItem(t,e){if(e instanceof A0)return;let r=e.getGroupID();if(r==null){if(e instanceof fr&&e.key!=""){if(!e.isEmpty){let s=e.getParent();s!=null&&t.has(s)||t.add(e)}return}let i=e;if(e instanceof mt||e instanceof vt){let s=e.getParent();s!=null&&(i=s)}let n=i.getParent();n!=null?this.add(n,t):this.add(i,t)}else this.addItemForCombination(r,t)}addItemForCombination(t,e){t!=null&&!this.groupSet.has(t)&&(this.groupSet.add(t),kt.getItem(t).getItems().forEach(i=>{Bt.checkIsCanEditByItem(i)&&e.add(i)}))}add(t,e){if(!t.isEmpty){let r=t.getGroupID();this.addItemForCombination(r,e),e.add(t)}}addMap(t,e){let r=e.get(t.net);r==null&&(r=new Set,e.set(t.net,r)),r.add(t)}filterConnectTracks(){let t=new Set,e=new Map;this.items.forEach(n=>{n instanceof Le?this.addMap(n,e):n instanceof Ge?this.addMap(n,e):n instanceof Ue?this.addMap(n,e):n instanceof Me&&n.getPads().forEach(a=>{this.addMap(a,e)})});let r=new Hd,i=new r9(!0);for(let[n,s]of e){let a=ze.getSameNetItems(n).filter(h=>h instanceof Ue&&!this.items.has(h)),l=new nn(10);for(let h of a)l.add(new S9e(h));let c=new Map;for(let h of s){let u=l.search(h.buildBBox());for(let d of u){let p=d.item;if(r.needCheckIntersection(h.model,p.model)&&i.isConnect(h.model,p.model)){let m=c.get(p);m==null&&(m=[new Set,new Set],c.set(p,m));let[g,y]=m;if(h instanceof Ue){let b=p.start.distance2(h.start),P=p.start.distance2(h.end),T=p.end.distance2(h.start),I=p.end.distance2(h.end),C=Math.min(b,P),E=Math.min(T,I);C<E?g.add(h):y.add(h)}else{let b=p.start.distance2(h.center),P=p.end.distance2(h.center);b<P?g.add(h):y.add(h)}}}}e:for(let[h,u]of c){let[d,p]=u;if(d.size>0&&p.size>0){let m=l.search(h.buildBBox());for(let g of m){let y=g.item;if(y!=h&&r.needCheckIntersection(y.model,h.model)&&i.isConnect(y.model,h.model))continue e}this.items.add(h)}}}}getAllItem(){let t=new Set;this.items.forEach(e=>{e.isEmpty||t.add(e)});for(let e of this.getAllRepairTracks())t.add(e);return t}hasConnectTrack(){return this.moveInit(),this.itemConnectTrack.tracks.size>0}getAllRepairTracks(){let t=new Set;for(let[e,r]of this.itemConnectTrack.tracks)!r.track.isEmpty&&!gc.getInstance().has(r.track.globalIndex)&&t.add(r.track);for(let e of Object.keys(this.moveTools)){let r=this.moveTools[e],i=r==null?void 0:r.getAssociationTrack();i&&t.add(i)}return t}setUpConnectTrack(){if(!this.itemConnectTrack.ready&&this.needFollow)if(ce.changeRepairLineTool)this.itemConnectTrack.setUpConnectTrack();else{this.itemConnectTrack.setUpConnectTrack();for(let[t,{track:e,moveStart:r}]of this.itemConnectTrack.tracks)if(e instanceof Ar){let i=new CD(e),n="repair line - pad/via connect Track";this.moveTools[t]=new lse(i,r,n),this.tracks.add(t),this.events.add(i)}}}moveInit(){if(this.preprocessing||!this.needFollow)return;this.preprocessing=!0,this.itemConnectTrack=new wX(this.items),this.itemConnectTrack.modifyTrackPosition(this.command),ie.publish("updateRtree",""),this.itemConnectTrack.setUpConnectTrack();let t=new Set,e=new Map;for(let[r,{track:i,movePoint:n}]of this.itemConnectTrack.tracks)if(ce.changeRepairLineTool){if(i.locked)continue;if(t.has(r)){e.forEach((c,h)=>{c.has(r)&&(this.moveTools[h]=void 0,this.tracks.delete(h),this.moveWholeTracks.add(h),this.moveWholeTracks.add(r))});continue}let s=new cu(i),a=new Set,l=s.getRepairConnectLineTool(n,t,a);e.set(r,a),l&&(this.moveTools[r]=l,this.tracks.add(r),this.events.add(s));continue}}getRepairToolCommand(){let t;for(let[e,{track:r,moveStart:i}]of this.itemConnectTrack.tracks)if(r instanceof Ar){let n=this.moveTools[e];n&&(t?t.addCommand(n==null?void 0:n.command):t=n==null?void 0:n.command)}return t}setRepairToolCommand(t){for(let[e,{track:r,moveStart:i}]of this.itemConnectTrack.tracks)if(r instanceof Ar){let n=this.moveTools[e];n&&(n.command=t)}}moveConnectTrack(t){this.moveInit();for(let[e,{track:r,moveStart:i}]of this.itemConnectTrack.tracks)if(r instanceof Ar){let n=this.moveTools[e];n==null||n.repairTrack(t),this.moveWholeTracks.has(e)&&r.transform(t)}else{this.addHistory&&this.command.addCommand(Te.dispatch(r,"modify"));let n=i?r.start.multiply4(t):r.end.multiply4(t);i?r.start=n:r.end=n}this.addHistory&&(this.addHistory=!1)}complete(t){Object.values({...this.moveTools}).forEach(e=>{e!=null&&e.complete()}),this.needUndoCommand&&this.command.commands.forEach(e=>{t.addCommand(e)}),ce.changeRepairLineTool?(this.events.forEach(e=>{e.complete(t)}),cu.complete2(t),cu.clear()):this.events.forEach(e=>{e.commands.commands.forEach(r=>{t.addCommand(r)})}),this.command=new ve("connect wire"),this.needUndoCommand=!0,this.events.clear(),this.moveWholeTracks.clear(),this.moveTools={},this.status={}}interrupt(){Object.values({...this.moveTools}).forEach(t=>{t!=null&&t.interrupt()}),ce.changeRepairLineTool?(this.events.forEach(t=>{t.interrupt()}),cu.clear()):this.events.forEach(t=>{t.commands.undo()}),this.needUndoCommand&&this.command.undo(),this.command=new ve("connect wire"),this.needUndoCommand=!0,this.events.clear(),this.moveWholeTracks.clear(),this.moveTools={},this.status={}}findAllAssociationRatlines(){if(this.items==null||this.items.size==0)return[];let t=this.items,e=Array.from(t).filter(n=>n instanceof Me),r=[];e.forEach(n=>{r=[].concat(r,n.getPads())});let i=[];return r.forEach(n=>{n.iteratorRatlines(s=>{i.push(s)})}),i}setAllAssociationRatlinesVisible(){var e;this.ratlines==null&&(this.ratlines=this.findAllAssociationRatlines()),(e=be.getLayer(57))!=null&&e.visible&&this.ratlines.forEach(r=>{r.click()})}getMoveTools(){return this.moveTools}};var T5=class T5{constructor(){this.deleteNoticeSelected=!1}static getInstance(){return T5.instance==null&&(T5.instance=new T5),T5.instance}init(t,e,r){this.items=t||[],this.action=r,this.commandFactory=e;let i=!1;this.notComponentItem=this.items.filter(n=>n instanceof Me?(i=!0,!1):!0),i?this.deleteNoticeSelected?this.execute(this.defAction):A.publish("openMainDialog",{cmd:42,data:{}}):this.action(this.items,this.commandFactory)}execute(t){switch(t){case"deleteAll":this.action(this.items,this.commandFactory);break;case"remainComponent":A.publish("onlySelect",this.notComponentItem),this.notComponentItem.length>0?this.action(this.notComponentItem,this.commandFactory):A.publish("tool","dropdrag");break}this.interrupt()}changeDefSelect(t,e){this.deleteNoticeSelected=t,this.defAction=e}interrupt(){this.action=null,this.items=[],this.notComponentItem=[],this.commandFactory=new mi().createGroup("check delete")}};T5.instance=null;var pV=T5;var I5=class I5{constructor(){this.lockedItems=new Set;this.freeItems=new Set;this.defaultOptions={isDelete:!1,moveWholeComponent:!0};this.options={};this.actionType="skipLocked"}static getInstance(){return I5.instance==null&&(I5.instance=new I5),I5.instance}init(t,e="check locked",r,i){if(x.getInstance().isReadOnlyMode){ie.publish("onlySelect",t);return}this.options={...this.defaultOptions,...i},this.items=Array.from(t).filter(n=>n&&!n.isEmpty&&!(n instanceof _n)),Bt.isChildPcb()&&e=="delete select item"&&(this.items=this.items.filter(n=>!(n instanceof Me)),ie.publish("onlySelect",this.items)),this.action=r,this.commandFactory=typeof e=="string"?new mi().createGroup(e):e,this.checkLocked(this.items)?ie.publish("openMainDialog",{cmd:38,data:{option:{status:this.actionType}}}):this.deleteDialog(this.items,this.commandFactory,[])}deleteDialog(t,e,r){this.options.isDelete?pV.getInstance().init(t,e,this.action):this.action(t,e,r)}checkLocked(t=this.items){this.lockedItems.clear(),this.freeItems.clear();let e=new Array;for(let i of t)this.options.isDelete&&i instanceof Le?i.locked?this.lockedItems.add(i):this.freeItems.add(i):e.push(i);let r=new cl(e,null,!0);for(let i of r.items)i.locked?this.lockedItems.add(i):this.freeItems.add(i);return this.lockedItems.size>0}execute(t){if(this.actionType=t,!!this.action){switch(this.actionType){case"skipLocked":{ie.publish("onlySelect",this.freeItems),this.freeItems.size>0?this.deleteDialog(Array.from(this.freeItems),this.commandFactory,Array.from(this.lockedItems)):ie.publish("tool","dropdrag");break}case"remainLocked":{this.deleteDialog(this.items,this.commandFactory,[]);break}case"unLockLocked":{this.lockedItems.forEach(e=>{this.commandFactory.addCommand4Item(e,"modify"),e.locked=!1}),this.deleteDialog(this.items,this.commandFactory,[]);break}}this.interrupt()}}interrupt(){this.action=null,this.items=[],this.lockedItems.clear(),this.freeItems.clear(),this.commandFactory=new mi().createGroup("check locked")}};I5.instance=null;var ls=I5;var hse=new Xl;[ane.instance(),lne.instance(),cne.instance(),hne.instance(),une.instance(),dne.instance(),pne.instance(),fne.instance(),mne.instance(),gne.instance(),yne.instance(),bne.instance(),Pne.instance(),Tne.instance(),Cne.instance(),Ine.instance(),Sne.instance()].forEach(o=>{hse.put(o.modelName,o)});function aUe(o){let t=o.packageName,e=hse.get(t);if(!e){console.warn(`\u6682\u672A\u652F\u6301 ${t} \u7684\u5C01\u88C5\u751F\u6210\u5668`);return}try{let r=Lc();ls.getInstance().init(r,"delete select item",(i,n)=>{var c;A.messageBus.publish("refreshDrawStatus",""),e.resetShape(),use.clearAll((c=e.historyGroup)==null?void 0:c.getCommand(),h=>h instanceof fr&&!!h.key||i.indexOf(h)<0,!1,!1),e.generate(o);let a=!x.getInstance().origin.equals(e._origin)?x.getInstance().origin.sub(e._origin):null,l=a?Ae.translate(a.x,a.y,0):null;e.shapes.forEach(h=>{l&&(h instanceof Ye?(h.transform(l),h.fill()):h.transform(l)),e.historyGroup.addCommand4Item(h,"add")}),Ta&&A.publish("checkDimension",{on:!0}),A.publish("updateFrame",""),A.publish("adaptAll",""),e.historyGroup.execute(),e.historyGroup=null},{isDelete:!0})}catch(r){let i=r.message||r.toString();A.windowBridge.rpcCall("i18n",[i],$()).then(n=>{A.windowBridge.publish("ui/toastMsg",{type:"error",msg:{value:"Failure, please check the relevant parameters:{msg}",options:{msg:n.message}},timer:2},$())})}}function lUe(o){let t=o.packageName,e=hse.get(t);if(!e)return console.warn(`\u6682\u672A\u652F\u6301 ${t} \u7684\u5C01\u88C5\u751F\u6210\u5668`),null;e.resetShape(),e.generate(o);let r=e._origin;return e.shapes.forEach(i=>{e.historyGroup.addCommand4Item(i,"add")}),e.historyGroup.undo(),e.historyGroup=null,r.mul(-1)}function cUe(o){let t=o.packageName,e=hse.get(t);e.refixOptions(o,!1),e.currentOptions.Type=o.packageName,o.packageName==="Cylindrical"?e.currentOptions.Type="Radial":o.packageName==="DFN_4"?e.currentOptions.Type="DFN-4":o.packageName==="HEADER_H"?e.currentOptions.Type="Header-H":o.packageName==="HEADER_V"?e.currentOptions.Type="Header-V":o.packageName==="E_Cap"?e.currentOptions.Type="E-Cap":o.packageName==="TO_DPAK"&&(e.currentOptions.Type="TO-DPAK");let r=["footprintOrigin","firstPinAt","pins","rowsPins","columnsPins"];for(let i in e.currentOptions){let n=e.currentOptions[i];e.currentOptions[i]instanceof So?e.currentOptions[i]=Bs(e.currentOptions[i].average*10,"mil","mm"):typeof n=="number"&&r.indexOf(i)<0&&(e.currentOptions[i]=Bs(n*10,"mil","mm"))}return e.currentOptions}var fV=class extends nf{getData(t,e){switch(t){case"path":return this.getShapeInfo(e)}}};var hu=class extends XR{constructor(){super(...arguments);this.silkOpts=new Q8;this.preference=new mV;this.board=new fV}getEncode(e){switch(e){case"CANVAS":return this.canvas;case"LAYER":return this.layer;case"LAYER_PHYS":return this.layerPhys;case"ACTIVE_LAYER":return this.activeLayer;case"NET":return this.net;case"PRIMITIVE":return this.primitive;case"GROUP":return this.group;case"VIA":return this.via;case"PAD":return this.pad;case"LINE":return this.line;case"ARC":return this.arc;case"POLY":return this.poly;case"FILL":return this.fill;case"FPC_FILL":return this.fpcFill;case"REGION":return this.region;case"PARTITION":return this.partition;case"POUR":return this.pour;case"POURED":return this.copper;case"IMAGE":return this.image;case"OBJ":return this.obj;case"TEARDROP":return this.tear;case"FONT":return this.font;case"STRING":return this.str;case"ATTR":return this.attr;case"DIMENSION":return this.dimension;case"COMPONENT":return this.component;case"PAD_NET":return this.padNet;case"RULE_TEMPLATE":return this.ruleTemplateName;case"RULE":return this.rule;case"RULE_SELECTOR":return this.ruleSelect;case"EQLEN_GRP":return this.padsPairGroup;case"EQLEN":return this.padsPairGroupDetail;case"SHELL_ENTITY":return this.shellEntity;case"SHELL":return this.shell;case"CREASE":return this.crease;case"BOSS":return this.boss;case"PANELIZE":return this.panelize;case"SILK_OPTS":return this.silkOpts;case"PREFERENCE":return this.preference;case"INNER":return this.inner;case"BOARD":return this.board}}get ignorePartitionId(){return this.doctype!=3}saveCommonData(){this.feed("CANVAS"),$e.getInstance().getAllItem().forEach(w=>{w.type=="CUSTOM"?w.config&&this.feed("LAYER",w):this.feed("LAYER",w)}),$e.getInstance().getLayerPhys().forEach(w=>{this.feed("LAYER_PHYS",w)}),this.feed("ACTIVE_LAYER");let i=te.getInstance(),n=i.getAllSafeSpacing(),s=i.getAllOtherSpacing(),a=i.getAllCreepageSpacing(),l=i.getAllTrackPhysics(),c=i.getAllNetLengthPhysics(),h=i.getAllNetLengthTolerancePhysics(),u=i.getAllDifferentialPhysics(),d=i.getAllBlindPhysics(),p=i.getAllRadiusPhysics(),m=i.getAllInnerPlane(),g=i.getAllCopperPlane(),y=i.getAllPasteExpansion(),b=i.getAllSolderExpansion(),P=i.getAllAutoRouterRules(),T=i.getAllNetClass(),I=i.getAllNets(),C=i.getAllNetDifferentials(),E=i.getAllEqualLengthGroups(),O=i.getAllPadsPairGroups(),_=i.getAllRegions();I.forEach(w=>{this.feed("NET",w)}),this.feed("RULE_TEMPLATE"),n.forEach(w=>{this.feed("RULE",w)}),s.forEach(w=>{this.feed("RULE",w)}),a.forEach(w=>{this.feed("RULE",w)}),l.forEach(w=>{this.feed("RULE",w)}),c.forEach(w=>{this.feed("RULE",w)}),h.forEach(w=>{this.feed("RULE",w)}),u.forEach(w=>{this.feed("RULE",w)}),d.forEach(w=>{this.feed("RULE",w)}),p.forEach(w=>{this.feed("RULE",w)}),m.forEach(w=>{this.feed("RULE",w)}),g.forEach(w=>{this.feed("RULE",w)}),y.forEach(w=>{this.feed("RULE",w)}),b.forEach(w=>{this.feed("RULE",w)}),P.forEach(w=>{this.feed("RULE",w)}),O.forEach(w=>{this.feed("EQLEN_GRP",w)});let R=[];O.forEach(w=>{w.details.forEach(F=>{R.push(F)})}),R.forEach(w=>{this.feed("EQLEN",w)}),T.forEach(w=>{this.feed("RULE_SELECTOR",w)}),I.forEach(w=>{this.feed("RULE_SELECTOR",w)}),C.forEach(w=>{this.feed("RULE_SELECTOR",w)}),E.forEach(w=>{this.feed("RULE_SELECTOR",w)}),i.betweenNetRule.rule.forEach(w=>{this.feed("RULE_SELECTOR",w)}),_.forEach(w=>{this.feed("RULE_SELECTOR",w)}),this.getPrimitives().forEach(w=>{this.feed("PRIMITIVE",w)}),this.feed("SILK_OPTS",$e.getInstance().getLayer(3)),this.feed("SILK_OPTS",$e.getInstance().getLayer(4))}saveSelected(e){let{pcbName:r,ownerInfo:i}=e,n=Ve.getSelects(),s=new Array,a=new Array,l=new Array,c=new Array,h=new Array,u=new Set,d=new Set;for(let T of n)T instanceof Me?(s.push(T.model),d.add(T.deviceUUID),u.add(T.footprintUUID),l.push(...T.getTexts())):T instanceof va?a.push(T.model):T instanceof _n||(h.push(T.model),T instanceof fr?l.push(T):T instanceof ct&&T.type=="TearDrop"&&c.push(T.model));this.saveCommonData();let p=Ip.getInstance().getAllItem().filter(T=>T.getItems().every(I=>Ve.getSelectsById(I.globalIndex)));this.feedItems(p),this.feedItems(h),this.feedItems(Ka.getInstance().getAllItem()),this.feedItems(Sl.getInstance().getAllItem()),this.feedItems(Za.getInstance().getAllItem()),this.feedComponent2(s);let m=x.getInstance().compiler.consistencyManager.getMaxTicket(),g=Ls(x.getInstance().compiler.getDocDetail());g.board=Jm(),g.title=r,g.creator=i,g.modifier=i;let y=new s5e().meta(m,g),b=new t5e,P=[];return P.push(b.head({doc:g.board,client:"",updateTime:new Date().getTime()})),P.push(b.meta(1,{title:"Board1",zIndex:1})),P.push(this.getFile(!0)),P.push(y),{dataStr:P.join(y6e),footprints:Array.from(u),devices:Array.from(d)}}save(e){let r="pcbDataStrEncode-time";pn(r),e=e||{},this.saveCommonData(),this.feed("PREFERENCE",Q6()),x.getInstance().doctype!=4&&(this.feedPanelize(),this.feedItems(Ip.getInstance().getAllItem())),Wy.getInstance().getAllItem().forEach(s=>{this.feed("FONT",s)}),this.feedItems(Tn.getInstance().getAllItem()),this.feedItems($n.getInstance().getAllItem()),this.feedItems(An.getInstance().getAllItem()),this.feedItems(zi.getInstance().getAllItem().filter(s=>s.type!=="Partition")),this.feedItems(rn.getInstance().getAllItem().filter(s=>s.type!=="Annotation"&&s.type!=="Partition")),this.feedItems(Mi.getInstance().getAllItem().filter(s=>s.type!=="Partition")),this.feedInner(Ho.getInstance().getAllItem()),this.feedItems(Qs.getInstance().getAllItem()),this.feedItems(e0.getInstance().getAllItem()),this.feedItems(mo.getInstance().getAllItem()),this.feedItems(Ka.getInstance().getAllItem()),this.feedItems(Sl.getInstance().getAllItem()),this.feedItems(Za.getInstance().getAllItem());let n=xs.getInstance().getAllItem();return this.feedComponent2(n),this.feedCopper(Wo.getInstance().getAllItem()),Cs.getInstance().board&&this.feed("BOARD",Cs.getInstance().board.model),Bi(r),this.getFile()}uploadInitData(){this.saveCommonData(),this.feed("PREFERENCE",Q6()),this.feedPanelize()}getFile(e){return this.encoder.getDataStr(e)}onlyOutline(){return this.feed("CANVAS"),$e.getInstance().getAllItem().forEach(i=>{this.feed("LAYER",i)}),$e.getInstance().getLayerPhys().forEach(i=>{this.feed("LAYER_PHYS",i)}),this.feed("ACTIVE_LAYER"),[uu(),gV()].forEach(i=>{i.forEach(n=>{let s=this.getFileType(n);this.feed(s,n)})}),this.feedPanelize(),this.getFile()}getItems(e){return this.feedItems(e),this.getFile()}feed(e,r){let i=this.getItemFormat(e),n=this.getEncode(e),s={};for(let a of i)this.ignorePartitionId&&a=="partitionId"||(s[a]=this.getData(a,n,r));return this.upload2Compiler(e,s,r),this.uploadSource(e,s,r),s}feedFromGerber(e,r){let i=this.getItemFormat(e),n=this.getEncode(e),s={};for(let a of i)this.ignorePartitionId&&a=="partitionId"||(s[a]=this.getData(a,n,r));this.uploadSource(e,s,r)}feedItem(e){let r=this.getFileType(e);this.feed(r,e)}feedComponent2(e){for(let r of e){this.feed("COMPONENT",r);let i=r.attributes,n=!0;for(let l of i)l.key=="Device"&&(n=!1),Cp(l,r)&&this.feed("ATTR",l);if(n)throw new Error("The device is missing device attributes, saving will lead to data loss, please contact the official customer service in time!");r.getPads().forEach(l=>{this.feed("PAD_NET",l)}),r.getItems().filter(l=>l instanceof It).forEach(l=>{this.feed("PAD_NET",l)})}}feed4Type(e){switch(e){case"CANVAS":return this.feed(e);case"ACTIVE_LAYER":return this.feed(e);default:break}}feedItems(e){e.forEach(r=>{if(r instanceof zs&&(r=r.model),r.getParent()==null){let i=this.getFileType(r);this.feed(i,r)}})}};var dse=class extends so{constructor(t,e){super(),this.data=t.toJSON(),this.source=e=="delete"?hUe(t):null,this.action=e}rebuild(){throw new Error("PanelizeComponent can only be modified!")}remove(){throw new Error("PanelizeComponent cannot be deleted!!")}getItem(){return"ignore"}modify(){let t=Ii.toJSON();new _p().applyPanelize(this.data),ai.getInstance().setDefaultPanelize(this.data),this.data=t,this.updateData()}upload(t=!1){if(!this.isDelete(t)){if(this.updateData(),this.source!=null){let{panelizeData:r,panelizeHStampData:i,panelizeVStampData:n,panelizeHSideData:s,panelizeVSideData:a}=this.source;x.getInstance().compiler.uploadPanelize(r)}}this.source=null}updateData(){this.source==null&&Ii!=null&&(this.source=hUe(Ii))}};function hUe(o){if(!o)return;let t=JSON.parse(JSON.stringify(o));return{panelizeData:or.getInstance().encode("PANELIZE",t)}}var yV=class extends so{constructor(){super(),this.origin=x.getInstance().origin,this.action="modify"}getItem(){return"ignore"}rebuild(){let t=x.getInstance().origin;x.getInstance().origin=this.origin,this.origin=t}remove(){let t=x.getInstance().origin;x.getInstance().origin=this.origin,this.origin=t}modify(){let t=x.getInstance().origin;x.getInstance().origin=this.origin,this.origin=t,this.updateData()}upload(t=!1){if(!this.isDelete(t)){if(this.source==null&&this.updateData(),this.source!=null){let r=x.getInstance().compiler;r.setTicket(),r.uploadCanvas(this.source)}}this.source=null}updateData(){this.source==null&&(this.source=or.getInstance().encode("CANVAS"))}};var pse=class{};var E9e=class extends pse{constructor(){super(...arguments);this.lines=new Array}displayPolylines(e,r){this.clear();for(let i of e)this.displayPolyline(i,r)}displayPolyline(e,r){r=r||1002;let i=dP(e.primitives,r);Re.addAll(this.lines,i)}clear(){for(let e of this.lines)e.remove();this.lines.length=0}},uUe=new E9e;var fse=class{constructor(){this.viewGroupId="";this.model=ai.getInstance()}get globalIndex(){return""}get items(){return this.model.items}get outlines(){return this.model.outlines}get marks(){return this.model.marks}getType(){return 28}getSourceData(){let t=this.getViewState(),e=new Array,r=new Array,i=new Array,n=new Array,s=new Array,a=new Array;return[].concat(this.model.items,this.model.outlines).forEach(c=>{c instanceof ys?e.push(c):c instanceof nl?r.push(c):c instanceof Po?c.layerId==11?i.push(c):n.push(c):c instanceof Je?s.push(c):c instanceof Li&&a.push(c)}),{state:t,lines:e,arcs:r,pads:s,circles:i,holes:n,texts:a}}getRenderData(){let t=this.getViewState(),e=new Array,r=new Array,i=new Array,n=new Array,s=new Array,a=new Array,l=new Array,c=new Array;return[].concat(this.model.items,this.model.outlines,this.model.slots).forEach(u=>{u instanceof ys?e.push(u):u instanceof nl?r.push(u):u instanceof Po?u.layerId==11?i.push(u):n.push(u):u instanceof Je?s.push(u):u instanceof Li?a.push(u):u instanceof Aa?l.push(u):u instanceof ss&&c.push(u)}),{state:t,lines:e.map(u=>{let{layerId:d,start:p,end:m,width:g}=u;return{layerId:d,start:p,end:m,width:g,state:t}}),arcs:r.map(u=>{let{layerId:d,center:p,radius:m,width:g,startAngle:y,endAngle:b,sweep:P}=u;return{layerId:d,center:p,radius:m,width:g,startAngle:y,endAngle:b,sweep:P}}),pads:s.map(u=>{let{layerId:d,center:p,top:m,bottom:g,topSolderExpansion:y,bottomSolderExpansion:b}=u,P=d==1,T;if(P?T=m:T=g,T==null)throw new Error("Pad data Error!!!");return{layerId:d,center:p,width:T.width,height:T.height,solderExpansion:P?y:b}}),circles:i.map(u=>{let{layerId:d,center:p,strokeWidth:m,radius:g}=u;return{layerId:d,center:p,strokeWidth:m,radius:g}}),holes:n.map(u=>{let{layerId:d,center:p,radius:m}=u;return{layerId:d,center:p,radius:m}}),texts:a.map(u=>{let{layerId:d,width:p,height:m,strokeWidth:g,matrix:y,outline:b}=u;return{layerId:d,width:p,height:m,state:t,strokeWidth:g,matrix:y,path:b}}),rects:l.map(u=>{let{layerId:d,start:p,radius:m,rotation:g,width:y,height:b,strokeWidth:P}=u;return{layerId:d,start:p,radius:m,rotation:g,width:y,height:b,state:t,strokeWidth:P}}),polygons:c.map(u=>{let{layerId:d,strokeWidth:p,outline:m}=u;return{layerId:d,state:t,strokeWidth:p,outline:m}})}}refreshRender(){Do.attach(this,this.getType())}getViewState(){return"Only Main"}copyOutline(t,e,r,i){return this.model.copyOutline(t,e,r,i)}copySlot(t,e,r,i){return this.model.copySlot(t,e,r,i)}addLine(t,e,r=11,i=!1){return this.model.addLine(t,e,r,i)}addArc(t,e,r,i,n=le.CCW,s=11){return this.model.addArc(t,e,r,i,n,s)}addMark(t,e,r){return this.model.addMark(t,e,r)}addText(t,e,r,i,n=0){return this.model.addText(t,e,r,i,n)}addHalfArrow(t,e){return this.model.addHalfArrow(t,e)}addVCutLine(t,e,r){return this.model.addVCutLine(t,e,r)}addVCutIndicator(t,e){return this.model.addVCutIndicator(t,e)}addStampHole(t,e){return this.model.addStampHole(t,e)}addStampHoleGroup(t,e){return this.model.addStampHoleGroup(t,e)}addPositionHole(t,e){return this.model.addPositionHole(t,e)}addClosure(t){this.model.closures.push(t)}remove(){this.marks.length=0,this.model.remove(),this.refreshRender()}getBBox(){return this.model.bbox}toJSON(){return JSON.parse(JSON.stringify(this.model.getDefaultPanelize()))}getOthers(){return new Array().concat(this.model.marks,this.model.vCutShapes,this.model.holes)}getProfileGroup(t){return this.model.getProfileGroup(t)}getPadGroup(t){return this.model.getPadGroup(t)}getText(t){return this.model.getText(t)}get bBox(){return this.model.singleBBox}set bBox(t){this.model.singleBBox=t}get outerBBox(){return this.model.outerBBox}set outerBBox(t){this.model.outerBBox=t}get offset(){return this.model.offset}set offset(t){this.model.offset=t}get oldOrigin(){return this.model.oldOrigin}set oldOrigin(t){this.model.oldOrigin=t}get borderClosures(){return this.model.borderClosures}get borderClosures_outerMost(){return this.model.borderClosures_outerMost}set borderClosures_outerMost(t){this.model.borderClosures_outerMost=t}getClosures(){return this.model.getClosures()}toFix(t){return Bs(t*10,"mil",this.model.outputUnit)}createVCutLineGivenFixedPosition(t,e,r,i){let n=i.minX+(t.borderAtLeftRight?t.borderHeight:0),s=i.maxX-(t.borderAtLeftRight?t.borderHeight:0),a=i.maxY-(t.borderAtTopBottom?t.borderHeight:0),l=i.minY+(t.borderAtTopBottom?t.borderHeight:0),c,h;return r?(c=new S(n,e),h=new S(s,e)):(c=new S(e,a),h=new S(e,l)),[c,h]}getDataForDFM(){let t=this.model.getDefaultPanelize(),e=new Array,r={},i=new S(Bs(11.02,"mm","mil")/10,Bs(8.56,"mm","mil")/10),n=t.flipX&&t.column>1?[[0,0],[0,1]]:t.flipY&&t.row>1?[[0,0],[1,0]]:[[0,0]];for(let c of n){let[h,u]=c,d="pcs"+(t.row*h+u+1),p=(t.flipX||t.flipY)&&(t.flipOrigin?1:0)+(t.flipX?u:h)%2==1,m=i;p&&(m=i.rotate(this.bBox.center(),Math.PI));let g={x:on(m.x+(t.borderAtLeftRight?t.borderHeight+(t.stampColumn?t.columnSpacing:0):0)+this.offset.x*u),y:on(m.y+(t.borderAtTopBottom?t.borderHeight+(t.stampRow?t.rowSpacing:0):0)+this.offset.y*h)};e.push({key:d,x:g.x,y:g.y,rotate:p?180:0,mirror:!1,repeat_x:Math.ceil(t.column/(t.flipX&&t.column>1?2:1))-(u?t.column%2:0),repeat_y:Math.ceil(t.row/(t.flipY&&t.row>1?2:1))-(h?t.row%2:0),dis_x:this.toFix(this.offset.x*(t.flipX&&t.column>1?2:1)),dis_y:this.toFix(this.offset.y*(t.flipY&&t.row>1?2:1))}),r[d]={outline:{vertexs:this.convertToVertexs(this.model.originOutline,h,u)},holes:[],datum:g,direct_arrow:[],name:d}}let s;if(t.borderAtTopBottom&&t.borderAtLeftRight){let c=bV([...this.borderClosures[0],...this.borderClosures[1]],!0);s={vertexs:[this.convertPrimitivesToVertexs(this.borderClosures_outerMost)],vertexs_holes:[{index:0,vertexs:this.convertPrimitivesToVertexs(c)}]}}else s={vertexs:this.borderClosures.map(c=>this.convertPrimitivesToVertexs(c))};let a=this.model.closures.map(c=>this.convertPrimitivesToVertexs(bV(c,!1)));return{version:"0.1",date:new Date().toISOString().replace("T"," ").replace(/\..*/g,""),unit:this.model.outputUnit,ui_params_sum:t,pcs:r,set:{margins:s,tool_holes:this.model.positionHoles.map(c=>({dia:this.toFix(c.radius*2),x:this.toFix(c.center.x),y:this.toFix(c.center.y)})),marks:this.model.marks.filter(c=>c.top).map(c=>({dia:this.toFix(c.top.width),x:this.toFix(c.center.x),y:this.toFix(c.center.y)})),null_region:{vertexs:a},vcut:{lines:this.getVCut(t)},repeat:e,stamp_holes:this.model.stampGroups.map(c=>({holes:c.map(h=>({dia:this.toFix(h.radius*2),x:this.toFix(h.center.x),y:this.toFix(h.center.y)}))}))}}}convertToVertexs(t,e,r){let i=new Array;for(let n=0;n<t.length;n++){let s=t[n];for(let a of s)if(a instanceof Po)i.push([{x:a.center.x+a.radius,y:a.center.y},{x:a.center.x-a.radius,y:a.center.y,xc:a.center.x,yc:a.center.y,ccw:!0},{x:a.center.x+a.radius,y:a.center.y,xc:a.center.x,yc:a.center.y,ccw:!0}]);else{let l=a instanceof q||a instanceof M?a.start():a.start,c=a instanceof q||a instanceof M?a.end():a.end,h=[{x:l.x,y:l.y}];if(a instanceof ys||a instanceof M)h.push({x:c.x,y:c.y});else if(a instanceof nl||a instanceof q){let u=a instanceof q?a.sweep():a.sweep;h.push({x:c.x,y:c.y,xc:a.center.x,yc:a.center.y,ccw:u==le.CCW})}i.push(h)}}return this.addOffsetToVertex(i,e,r)}addOffsetToVertex(t,e,r){let i={x:this.offset.x*r,y:this.offset.y*e};return t.map(n=>n.map(s=>"xc"in s?{x:this.toFix(s.x+i.x),y:this.toFix(s.y+i.y),xc:this.toFix(s.xc+i.x),yc:this.toFix(s.yc+i.y),ccw:s.ccw}:{x:this.toFix(s.x+i.x),y:this.toFix(s.y+i.y)}))}convertPrimitivesToVertexs(t){let e=Array();for(let r=0;r<t.length;r++){let i=t[r];r==0&&e.push({x:this.toFix(i.start().x),y:this.toFix(i.start().y)}),i instanceof M?e.push({x:this.toFix(i.end().x),y:this.toFix(i.end().y)}):i instanceof q&&e.push({x:this.toFix(i.end().x),y:this.toFix(i.end().y),xc:this.toFix(i.center.x),yc:this.toFix(i.center.y),ccw:i.isCCW})}return e}getVCut(t){let e=[],r=[],i=[];for(let n=1;n<t.row;n++){let s=this.bBox.minY+this.offset.y*n,a=s-t.rowSpacing;r.push(s,a)}!t.stampRow&&t.borderAtTopBottom&&r.push(this.bBox.minY,this.bBox.minY+this.offset.y*t.row),e.push(...r.map(n=>this.createVCutLineGivenFixedPosition(t,n,!0,this.outerBBox)));for(let n=1;n<t.column;n++){let s=this.bBox.minX+this.offset.x*n,a=s-t.columnSpacing;i.push(s,a)}return!t.stampColumn&&t.borderAtLeftRight&&i.push(this.bBox.minX,this.bBox.minX+this.offset.x*t.column),e.push(...i.map(n=>this.createVCutLineGivenFixedPosition(t,n,!1,this.outerBBox))),e.map(n=>[this.toFix(n[0].x),this.toFix(n[0].y),this.toFix(n[1].x),this.toFix(n[1].y)])}};function bV(o,t){if(!o.length)return[];let e=[o[0]],r=new Set([o[0]]);for(let s=0;s<o.length-1;s++){let a=e[0].start(),l=e.at(-1).end();for(let c of o)if(!r.has(c))if(c.start().equals1(l)){e.push(c),r.add(c);break}else if(c.end().equals1(l)){e.push(c.reverse()),r.add(c);break}else c.end().equals1(a)?(e.unshift(c),r.add(c)):c.start().equals1(a)&&(e.unshift(c.reverse()),r.add(c))}let i=fe.build2(e);return(vh(i)==t?i:i.reverse()).primitives}var f_={x:"width",y:"height"},mse={x:"row",y:"column"},c9={x:"rowSpacing",y:"columnSpacing"},_p=class o{constructor(){}static getOutlineBbox(){return o.getBoardBBox(ai.getInstance().getDefaultPanelize(),uu())}static getBoardBBox(t,e){let r=new _e;for(let n of e){let s=n.getMathGraphics();r.ext1(s.bbox())}let i=r.build1();return Ii.bBox=i,o.bBoxWithOffset(i,t)}static getBoardBBox2(t,e){let r=new _e;e.forEach(n=>r.ext1(n.bbox()));let i=r.build1();return Ii.bBox=i,o.bBoxWithOffset(i,t)}static bBoxWithOffset(t,e){let r=t.maxX-t.minX,i=t.maxY-t.minY;return{x:t.minX,y:t.minY,width:r,height:i,maxX:t.maxX,maxY:t.maxY,offset:{x:e.columnSpacing+r,y:e.rowSpacing+i}}}calcBBox(t,e){let r=o.getBoardBBox2(t,e);Ii.offset=new S(r.offset.x,r.offset.y),x.getInstance().panelizeParam={success:t.success,on:t.on,row:t.row,column:t.column,offset:Ii.offset,onlyOutline:t.onlyOutline};let i,n={x:r.x,y:r.y,width:r.offset.x*t.column-t.columnSpacing,height:r.offset.y*t.row-t.rowSpacing};return i={x:n.x-(t.borderAtLeftRight?t.borderHeight+(t.stampColumn?t.columnSpacing:0):0),y:n.y-(t.borderAtTopBottom?t.borderHeight+(t.stampRow?t.rowSpacing:0):0),width:n.width+(t.borderAtLeftRight?t.borderHeight+(t.stampColumn?t.columnSpacing:0):0)*2,height:n.height+(t.borderAtTopBottom?t.borderHeight+(t.stampRow?t.rowSpacing:0):0)*2},i.center=new S(n.x+n.width/2,n.y+n.height/2),Ii.outerBBox=new ut(i.x,i.x+i.width,i.y,i.y+i.height),{bBox:r,innerBBox:n,outerBBox:i}}createOutLineCopies(t,e){let r=uu(),i=gV();for(let n=0;n<t.row;n++)for(let s=0;s<t.column;s++){let a=!n&&!s,l=!a||(t.flipX||t.flipY)&&t.flipOrigin,c;t.flipX&&!(s%2)==t.flipOrigin||t.flipY&&!(n%2)==t.flipOrigin?c=Ae.rotateZForPoint(Ii.bBox.center(),Math.PI).translate1(e.offset.x*s,e.offset.y*n,0):c=Ae.translate(e.offset.x*s,e.offset.y*n,0),r.forEach(h=>{Ii.copyOutline(h,c,a,l)}),i.forEach(h=>{Ii.copySlot(h,c,a,l)})}"META-PANELIZE-ENV"in window&&window["META-PANELIZE-ENV"]&&dUe().forEach(n=>{(t.flipX||t.flipY)&&t.flipOrigin?n.hidden():n.visible()})}createVCutLineGivenFixedPosition(t,e,r,i){let n=i.x+(t.borderAtLeftRight?t.borderHeight:0),s=i.x+i.width-(t.borderAtLeftRight?t.borderHeight:0),a=i.y+i.height-(t.borderAtTopBottom?t.borderHeight:0),l=i.y+(t.borderAtTopBottom?t.borderHeight:0),c,h;return r?(c=new S(n,e),h=new S(s,e)):(c=new S(e,a),h=new S(e,l)),Ii.addVCutLine(c,h,r),[c,h]}isIntersect(t,e,r){let[i,n]=[t,e].map(s=>s.map(a=>a instanceof Array?new ut(Math.min(a[0].x,a[1].x),Math.max(a[0].x,a[1].x),Math.min(a[0].y,a[1].y),Math.max(a[0].y,a[1].y)):new ut(a.x,a.x,a.y,a.y)));return n.map(s=>s.transform(r)).some(s=>i.some(a=>s.isIntersect(a)))}createVCutLines(t,e,r,i,n){if(!r.stampRow)for(let s=0;s<=r.row;s++){if(!r.borderAtTopBottom&&(s==0||s==r.row))continue;let a=s==r.row?i.y+i.height:i.y+e.offset.y*s;Ii.addVCutIndicator(new S(i.x+i.width,a),!0),r.rowSpacing&&!(s==0||s==r.row)&&Ii.addVCutIndicator(new S(i.x+i.width,a-r.rowSpacing),!0)}if(!r.stampColumn)for(let s=0;s<=r.column;s++){if(!r.borderAtLeftRight&&(s==0||s==r.column))continue;let a=s==r.column?i.x+i.width:i.x+e.offset.x*s;Ii.addVCutIndicator(new S(a,i.y),!1),r.columnSpacing&&!(s==0||s==r.column)&&Ii.addVCutIndicator(new S(a-r.columnSpacing,i.y),!1)}if(!r.stampRow&&!(r.borderAtLeftRight&&r.columnSpacing==0))if(r.rowSpacing==0){let s=this.getIntersects(n,new M(new S(e.x,e.maxY),new S(e.x+e.width,e.maxY))),a=this.getIntersects(n,new M(new S(e.x,e.y),new S(e.x+e.width,e.y)));if(!this.isIntersect(s,a,Qe.translate(0,e.height))){let l={pair:null,value:Number.MAX_SAFE_INTEGER};for(let u of s)for(let d of a){let p=Math.abs(u.x-d.x);p<l.value&&(l={pair:[u,d],value:p})}let c=l.pair[0],h=l.pair[1].add(new S(0,e.height));for(let u=0;u<r.column;u++)for(let d=0;d<r.row-1;d++){let p=new S(e.offset.x*u,e.offset.y*d);Ii.addVCutLine(c.add(p),h.add(p),!0)}}}else for(let s=1;s<r.row;s++){let a=e.y+e.offset.y*s,l=a-r.rowSpacing,c=[a,l].map(u=>this.createVCutLineGivenFixedPosition(r,u,!0,t)),h=fe.build4([c[0][1],c[0][0],c[1][0],c[1][1]]).asClose();Ii.addClosure(h.primitives)}if(!r.stampColumn&&!(r.borderAtTopBottom&&r.rowSpacing==0))if(r.columnSpacing==0){let s=this.getIntersects(n,new M(new S(e.x,e.y),new S(e.x,e.maxY))),a=this.getIntersects(n,new M(new S(e.maxX,e.y),new S(e.maxX,e.maxY)));if(!this.isIntersect(a,s,Qe.translate(e.width,0))){let l={pair:null,value:Number.MAX_SAFE_INTEGER};for(let u of s)for(let d of a){let p=Math.abs(u.y-d.y);p<l.value&&(l={pair:[u,d],value:p})}let c=l.pair[0].add(new S(e.width,0)),h=l.pair[1];for(let u=0;u<r.column-1;u++)for(let d=0;d<r.row;d++){let p=new S(e.offset.x*u,e.offset.y*d);Ii.addVCutLine(c.add(p),h.add(p),!1)}}}else for(let s=1;s<r.column;s++){let a=e.x+e.offset.x*s,l=a-r.columnSpacing,c=[a,l].map(u=>this.createVCutLineGivenFixedPosition(r,u,!1,t)),h=fe.build4([c[0][1],c[0][0],c[1][0],c[1][1]]).asClose();Ii.addClosure(h.primitives)}if(r.borderAtTopBottom&&!r.stampRow){let s=r.borderAtLeftRight?r.borderHeight:0;Ii.borderClosures[0].push(new M(new S(t.x+s,i.y),new S(t.x+t.width-s,i.y))),Ii.borderClosures[1].push(new M(new S(t.x+s,i.y+i.height),new S(t.x+t.width-s,i.y+i.height)))}if(r.borderAtLeftRight&&!r.stampColumn){let s=r.borderAtTopBottom?r.borderHeight:0;Ii.borderClosures[0].push(new M(new S(i.x,t.y+s),new S(i.x,t.y+t.height-s))),Ii.borderClosures[1].push(new M(new S(i.x+i.width,t.y+s),new S(i.x+i.width,t.y+t.height-s)))}r.borderAtTopBottom&&!r.stampRow&&r.borderAtLeftRight&&!r.stampColumn?([e.x+.001,e.maxX-.001].forEach((s,a)=>{let l=new M(new S(s,i.y),new S(s,i.y+i.height)),c=this.getInterSections(n,l,"y");if(c.up&&c.down){let h=c.down,u=c.up.add1(0,e.offset.y*(r.row-1));a==1&&(h=h.add1(i.width-e.width,0),u=u.add1(i.width-e.width,0)),Ii.addVCutLine(u,h,!1)}}),[e.y+.001,e.maxY-.001].forEach((s,a)=>{let l=new M(new S(i.x,s),new S(i.x+i.width,s)),c=this.getInterSections(n,l,"x");if(c.up&&c.down){let h=c.down,u=c.up.add1(e.offset.x*(r.column-1),0);a==1&&(h=h.add1(0,i.height-e.height),u=u.add1(0,i.height-e.height)),Ii.addVCutLine(h,u,!0)}})):r.borderAtTopBottom&&!r.stampRow?(this.createVCutLineGivenFixedPosition(r,i.y,!0,t),this.createVCutLineGivenFixedPosition(r,i.y+i.height,!0,t)):r.borderAtLeftRight&&!r.stampColumn&&(this.createVCutLineGivenFixedPosition(r,i.x,!1,t),this.createVCutLineGivenFixedPosition(r,i.x+i.width,!1,t))}createBorder(t,e){let i=new ft().conversion("mm","mil",5)/10,n=t.borderHeight/2,s,a,l,c,h=t.borderHeight-n;t.borderAtTopBottom&&t.borderAtLeftRight?(l=new S(e.x+i+t.borderHeight,e.y+e.height-h),c=l.add1(i,0)):t.borderAtTopBottom?(l=new S(e.x+i,e.y+e.height-h),c=l.add1(i,0)):(l=new S(e.x+h,e.y+i),c=l.add1(0,i)),s=l,a=t.createPositionHole?c:l,t.createPositionHole&&this.getAllMarkHolePosFromTopLeft(s,t,i,e).forEach(d=>Ii.addPositionHole(new S(d.x,d.y),t.positionHoleDiameter)),t.createMark&&this.getAllMarkHolePosFromTopLeft(a,t,i,e).forEach(d=>Ii.addMark(new S(d.x,d.y),t.markDiameter,t.markExpansion))}getAllMarkHolePosFromTopLeft(t,e,r,i){if(e.borderAtTopBottom){let n=t.add1(r,0);return[t,t.mirrorY(i.center),n.mirrorX(i.center),n.mirrorCenter(i.center)]}if(e.borderAtLeftRight){let n=t.add1(0,r);return[t,n.mirrorY(i.center),t.mirrorX(i.center),n.mirrorCenter(i.center)]}}createStampBorderLines(t,e,r,i,n,s){let a=t==="x"?"y":"x",l=[r[a],r[a]+r[f_[a]]];(e.stampRow&&e.borderAtTopBottom&&t=="x"||e.stampColumn&&e.borderAtLeftRight&&t=="y")&&(l[0]-=e[c9[t]],l[1]+=e[c9[t]]),n[a].forEach(c=>{for(let h=0;h<e[mse[t]];h++)l.push(c[0][a]+i.offset[a]*h)}),l.sort((c,h)=>c-h);for(let c=1;c<l.length;c+=2){let h=l[c],u=l[c-1],d=[{x:null,y:null},{x:null,y:null}];d[0][t]=r[t]-e[c9[a]],d[0][a]=h,d[1][t]=r[t]-e[c9[a]],d[1][a]=u;let p=new S(d[0].x,d[0].y),m=new S(d[1].x,d[1].y);Ii.addLine(p,m),Ii.borderClosures[0].push(new M(p,m));let g=[{x:null,y:null},{x:null,y:null}];g[0][t]=r[t]+(r[f_[t]]+e[c9[a]]),g[0][a]=h,g[1][t]=r[t]+(r[f_[t]]+e[c9[a]]),g[1][a]=u;let y=new S(g[0].x,g[0].y),b=new S(g[1].x,g[1].y);Ii.addLine(y,b),Ii.borderClosures[1].push(new M(y,b))}}arrayCopyStampLineAndHole(t,e,r,i,n,s,a,l,c){for(let h=0;h<e.row;h++)for(let u=0;u<e.column;u++)if(t==="x"?h<e.row-1:u<e.column-1){let d=new S(r.offset.x*u,r.offset.y*h),p=Qe.translate1(d),m=i,g=n,y=s;(e.flipX||e.flipY)&&(t=="x"&&e.flipX||t=="y"&&e.flipY?((e.flipOrigin?1:0)+(e.flipX?u:h))%2===1&&(m=a,g=l,y=c):((e.flipOrigin?1:0)+(e.flipX?u:h))%2===0?(m={[t]:i[t].map((P,T)=>[a[t][T][0],i[t][T][1]])},g={[t]:[l[t][1],n[t][0]]},y={[t]:[c[t][0],s[t][1]]}):(m={[t]:i[t].map((P,T)=>[i[t][T][0],a[t][T][1]])},g={[t]:[n[t][1],l[t][0]]},y={[t]:[s[t][0],c[t][1]]}));for(let P=0;P<i[t].length;P+=2){[m[t][P],m[t][P+1]].forEach(O=>{Ii.addLine(new S(O[0].x,O[0].y).add(d),new S(O[1].x,O[1].y).add(d))});let T=y[t][0][P/2].map(O=>O.multiply3(p)),I=y[t][1][P/2].map(O=>O.multiply3(p)),C=new M(T[0].start(),I[I.length-1].end()),E=new M(I[0].start(),T[T.length-1].end());Ii.addClosure([].concat(T,[C],I,[E]))}let b=g[t].map(P=>P.map(T=>new S(T.x,T.y).add(d))).flat(1);Ii.addStampHoleGroup(b,e.stampHoleDiameter)}}calcStampPos(t,e,r){let i=t.stampHoleSpacing,n=t.stampHoleDiameter,s={x:t.stampPerRow,y:t.stampPerColumn},a={x:[],y:[]},l={x:[[],[]],y:[[],[]]},c={x:[],y:[]};return["x","y"].forEach(h=>{let u=h==="x"?"y":"x",d=[];for(let g=0;g<s[h];g++){let y=e[h]+(g+1)/(s[h]+1)*e[f_[h]];d.push(y)}let p=Math.floor((d.length>1?Math.abs(d[1]-d[0]):e[f_[h]])/i-1),m=Math.min(t.stampHolePerGroup,p);for(let g=0;g<s[h];g++){let y=d[g];[-1,1].forEach(b=>{let P={type:"stampLine"};P[h]=y+(i*(m/2-.3)+n/2)*b,a[h].push(P)});for(let b=0;b<m;b++){let P={type:"stampHole"};P[h]=y+i*(b-(m-1)/2),a[h].push(P)}}for(let g=0;g<s[h];g++){let y=[],b=[[],[]],P=!0;for(let T=0;T<m+2;T++){let I=a[h][g*(m+2)+T],C=h==="x"?new M(new S(I.x,e.y),new S(I.x,e.maxY)):new M(new S(e.x,I.y),new S(+e.x+e.width,I.y)),E=this.getInterSections2(r,C,u);if(!E.down||!E.up){P=!1;break}E.up.position[u]+=I.type==="stampHole"?n/6:0,E.down.position[u]-=I.type==="stampHole"?n/6:0,u=="y"?E.down.position.y+=e.offset.y:E.down.position.x+=e.offset.x;let O=[E.up,E.down];I.type==="stampLine"?y.push(O.reverse()):I.type==="stampHole"&&O.forEach((_,R)=>b[R].push(_))}P&&(c[h].push(...y),b.forEach((T,I)=>l[h][I].push(...T)))}}),{stampHolePos:l,stampLinePos:c}}calcPolyBelowStamp(t){let e={x:[],y:[]};return["x","y"].forEach(r=>{[0,1].forEach(i=>{for(let n=0;n<t[r].length;n+=2){if(e[r][i]||(e[r][i]=[]),!t[r][n]||!t[r][n+1]){e[r][i].push([]);continue}let s=[],a=t[r][n][i],l=t[r][n+1][i],[c,h]=r=="x"==(i==0)?[l,a]:[a,l];if(c.polyline==h.polyline){let u=c.polyIndex,d=h.polyIndex,p=Qe.translate1(r=="x"?new S(0,Ii.offset.y):new S(Ii.offset.x,0)),m=i==0?c.polyline.primitives.map(y=>y.multiply3(p)):c.polyline.primitives,g=bc.modifyStart(c.position,m[u]);if(u==d)s.push(bc.modifyEnd(h.position,g));else{s.push(g);for(let b=u+1,P=m.length;b<d+(u<d?0:P);b++)s.push(m[b%P]);let y=bc.modifyEnd(h.position,m[d]);s.push(y)}}else s.push(new M(c.position,h.position));e[r][i].push(s)}})}),e}createStampHoleLines(t,e,r,i){let{stampHolePos:n,stampLinePos:s}=this.calcStampPos(t,e,i),a=this.calcPolyBelowStamp(s);s={x:s.x.map(u=>u.map(d=>d.position)),y:s.y.map(u=>u.map(d=>d.position))},n={x:n.x.map(u=>u.map(d=>d.position)),y:n.y.map(u=>u.map(d=>d.position))};let l,c,h;if(t.flipX||t.flipY){let u=Ae.rotateZForPoint(Ii.bBox.center(),Math.PI),d=i.map(m=>m.clone().multiply3(u.toMatrix3())),p=this.calcStampPos(t,e,d);c=p.stampHolePos,l=p.stampLinePos,h=this.calcPolyBelowStamp(l),l={x:l.x.map(m=>m.map(g=>g.position)),y:l.y.map(m=>m.map(g=>g.position))},c={x:c.x.map(m=>m.map(g=>g.position)),y:c.y.map(m=>m.map(g=>g.position))}}t.stampRow&&t.borderAtTopBottom&&(this.createStampBorderLines("y",t,r,e,s,l),this.createStampHoleLineAlongBorder("y",t,e,r,s,n,a,l,c,h)),t.stampColumn&&t.borderAtLeftRight&&(this.createStampBorderLines("x",t,r,e,s,l),this.createStampHoleLineAlongBorder("x",t,e,r,s,n,a,l,c,h)),t.stampRow&&this.arrayCopyStampLineAndHole("x",t,e,s,n,a,l,c,h),t.stampColumn&&this.arrayCopyStampLineAndHole("y",t,e,s,n,a,l,c,h)}createStampHoleLineAlongBorder(t,e,r,i,n,s,a,l,c,h){let u=e.stampHoleDiameter,d=t==="x"?"y":"x";[0,1].forEach(p=>{for(let m=0;m<e[mse[t]];m++){let g=n,y=s,b=a;(e.flipX||e.flipY)&&(t=="y"&&e.flipX||t=="x"&&e.flipY?((e.flipOrigin?1:0)+m)%2&&(g=l,y=c,b=h):((p?0:e[mse[t]]-1)+(e.flipOrigin?1:0))%2==1&&(g=l,y=c,b=h));let P=y[d][p].map(T=>{let I={x:null,y:null};return I[t]=T[t]+r.offset[t]*(e[mse[d]]*(p?0:1)-1),I[d]=T[d]+r.offset[d]*m,new S(I.x,I.y)});Ii.addStampHoleGroup(P,u),g[d].forEach(T=>{let I=[{x:null,y:null},{x:null,y:null}];p?(I[0][t]=T[0][t]-r.offset[t],I[0][d]=T[0][d]+r.offset[d]*m,I[1][t]=i[t]-e[c9[d]],I[1][d]=T[1][d]+r.offset[d]*m):(I[0][t]=i[t]+(i[f_[t]]+e[c9[d]]),I[0][d]=T[0][d]+r.offset[d]*m,I[1][t]=T[1][t]+(i[f_[t]]-r.offset[t]+e[c9[d]]),I[1][d]=T[1][d]+r.offset[d]*m);let C=new S(I[0].x,I[0].y),E=new S(I[1].x,I[1].y);Ii.addLine(C,E),Ii.borderClosures[p?0:1].push(new M(C,E));let O=t=="x"?new S((i[f_[t]]+e[c9[d]])*(p?0:1)-r.offset[t],r.offset[d]*m):new S(r.offset[d]*m,(i[f_[t]]+e[c9[d]])*(p?0:1)-r.offset[t]);Ii.borderClosures[p?0:1].push(...this.flatten(b[d][p?0:1]).map(_=>_.multiply3(Qe.translate1(O))))})}})}flatten(t){return t.reduce((e,r)=>(e.push(...r),e),[])}reRender(){this.applyPanelize({},!1)}static getBoardOutlines(t){let e=uu();if(!e.length)return[];if("META-PANELIZE-ENV"in window&&window["META-PANELIZE-ENV"])return e.map(l=>{let c=l.getMathGraphics();return vh(c)?c.reverse():c});let r=o.getBoardBBox(t,e),i=[];e.forEach(l=>Re.addAll(i,l.getMathGraphics().primitives));let s=new oh(new ut(r.x,r.maxX,r.y,r.maxY),2,.02,new Gi(4),i).detect();if(s&&s.bbox().area()<=r.height*r.width)return s.items.filter(c=>c.bbox().width()>.1&&c.bbox().height()>.1&&c.bbox().area()>1);let a=e.map(l=>l.getMathGraphics()).flat(2).filter(l=>l!=null).map(l=>l.primitives).flat(2);return[fe.build2(a)]}recordHistory(){let t=new ve("panelize");t.addCommand(new dse(Ii,"modify"));let e=new yV;return t.addCommand(e),t}applyPanelize(t={},e=!0,r=null){let n={...JSON.parse(JSON.stringify(ai.getInstance().getDefaultPanelize())),...t};"META-PANELIZE-ENV"in window&&window["META-PANELIZE-ENV"]&&(!n.borderAtTopBottom&&!n.stampColumn&&(n.columnSpacing=0),!n.borderAtLeftRight&&!n.stampRow&&(n.rowSpacing=0),!n.borderAtTopBottom&&n.row==1&&(n.columnSpacing=0),!n.borderAtLeftRight&&n.column==1&&(n.rowSpacing=0)),ai.getInstance().setDefaultPanelize(n);let s=r==null?x.getInstance().doctype!=3:r;if(Ii.remove(),x.getInstance().needRenderPanelize=!(!n.on||n.onlyOutline),s&&(St.getInstance().visible=T1.ONLYAXIS,St.getInstance().setMultiStyle(bS.None)),!n.on){e&&A.publish("adaptAll",""),A.publish("updateFrame",""),n.success=!1,ai.getInstance().setDefaultPanelize(n);return}if(ai.getInstance().useSetJsonFirst){ai.getInstance().useSetJsonFirst=!1;let m=new _e,g=new _e;pt.getAllItem().forEach(T=>{T.locked&&m.ext1(T.getMathGraphics().bbox()),g.ext1(T.getMathGraphics().bbox())});let y=m.build1(),b=g.build1(),P={width:b.width(),height:b.height(),innerWidth:y.width(),innerHeight:y.height()};A.globalMessageBus.rpcCall("panelizeOuterBBox2",P);return}else if(ai.getInstance().setJsonParamCache){Kt.getAllItem().forEach(y=>{y.remove()}),Zt.getAllItem().forEach(y=>{y.remove()});let m=new _e;pt.getAllItem().forEach(y=>{y.locked&&m.ext1(y.buildBBox())});let g=m.build1().center();pt.getAllItem().forEach(y=>{y.locked?ai.getInstance().setJsonParamCache.flipOrigin&&y.rotateFor(g,Math.PI):y.remove()}),ai.getInstance().setJsonParamCache=null}this.handleCustomRect(n);let a=o.getBoardOutlines(n);if(!a.length){A.publish("updateFrame",""),n.success=!1,ai.getInstance().setDefaultPanelize(n);return}let l=o.getBoardBBox2(n,a);if(l.height===0&&l.width===0){n.success=!1,ai.getInstance().setDefaultPanelize(n);return}let c="panelizeApply-time";pn(c),n.success=!0,ai.getInstance().setDefaultPanelize(n);let{innerBBox:h,outerBBox:u}=this.calcBBox(n,a);s&&(be.setActiveLayer(be.getOutlineLayer()),Ii.oldOrigin==null&&(Ii.oldOrigin=x.getInstance().origin));let d;if(n.resetCanvasOrigin?d=new S(u.x,u.y):s&&Ii.oldOrigin&&(d=Ii.oldOrigin),d){x.getInstance().origin=d;let m=this.calcBBox(n,a);l=m.bBox,h=m.innerBBox,u=m.outerBBox}let p={width:u.width,height:u.height,innerWidth:h.width,innerHeight:h.height};if(A.windowBridge.rpcCall("panelizeOuterBBox",p,$()),A.globalMessageBus.rpcCall("panelizeOuterBBox2",p),n.onlyOutline&&this.createOutLineCopies(n,l),(!n.stampRow||!n.stampColumn)&&this.createVCutLines(u,l,n,h,a),(n.stampRow||n.stampColumn)&&this.createStampHoleLines(n,l,h,a),(n.borderAtTopBottom||n.borderAtLeftRight)&&this.createBorder(n,u),"META-PANELIZE-ENV"in window&&window["META-PANELIZE-ENV"]&&(n.flipX||n.flipY))for(let m=0;m<n.row;m++)for(let g=0;g<n.column;g++){let y=((n.flipOrigin?1:0)+(n.flipX?g:m))%2==1,b=Ii.bBox.center().add1(l.offset.x*g,l.offset.y*m);Ii.addHalfArrow(b,y)}this.createOuterMostLine(n,a,l,h,u),e&&setTimeout(()=>{A.publish("adaptAll","")},10),A.publish("updateFrame",""),Bi(c)}addBorderByPoints(t,e,r,i){for(let n=0;n<t.length;n++){let s=t[n],a,l,c,h;s instanceof S?(Ii.addArc(s,e,Math.PI,Math.PI*1.5),a=q.build3(s,180,180*.5,e,e),Ii.addArc(s.mirrorX(r),e,Math.PI*.5,Math.PI),l=q.build3(s.mirrorX(r),180*.5,180*.5,e,e),Ii.addArc(s.mirrorY(r),e,Math.PI*1.5,Math.PI*2),c=q.build3(s.mirrorY(r),180*1.5,180*.5,e,e),Ii.addArc(s.mirrorCenter(r),e,0,Math.PI*.5),h=q.build3(s.mirrorCenter(r),0,180*.5,e,e)):(Ii.addLine(s[0],s[1]),a=new M(s[0],s[1]),Ii.addLine(s[0].mirrorX(r),s[1].mirrorX(r)),l=new M(s[0].mirrorX(r),s[1].mirrorX(r)),Ii.addLine(s[0].mirrorY(r),s[1].mirrorY(r)),c=new M(s[0].mirrorY(r),s[1].mirrorY(r)),Ii.addLine(s[0].mirrorCenter(r),s[1].mirrorCenter(r)),h=new M(s[0].mirrorCenter(r),s[1].mirrorCenter(r))),i.borderAtTopBottom&&i.borderAtLeftRight?Ii.borderClosures_outerMost.push(a,l,h,c):i.borderAtTopBottom?(Ii.borderClosures[0].push(c,a),Ii.borderClosures[1].push(h,l)):i.borderAtLeftRight&&(Ii.borderClosures[0].push(a,l),Ii.borderClosures[1].push(h,c))}i.borderAtTopBottom&&i.borderAtLeftRight?Ii.borderClosures_outerMost=bV(Ii.borderClosures_outerMost,!1):(i.borderAtTopBottom||i.borderAtLeftRight)&&(Ii.borderClosures[0]=bV(Ii.borderClosures[0],!1),Ii.borderClosures[1]=bV(Ii.borderClosures[1],!1))}createOuterMostLine(t,e,r,i,n){!t.stampRow&&t.rowSpacing>0&&[r.x+.1,r.maxX-.1].forEach((a,l)=>{let c=new M(new S(a,n.y),new S(a,n.y+n.height)),h=this.getInterSections(e,c,"y");if(h.up&&h.down){let u=h.up,d=h.down.add1(0,r.offset.y*(t.row-1));l==1&&(u=u.add1(i.width-r.width,0),d=d.add1(i.width-r.width,0)),Ii.addLine(u,d)}}),!t.stampColumn&&t.columnSpacing>0&&[r.y+.1,r.maxY-.1].forEach((a,l)=>{let c=new M(new S(n.x,a),new S(n.x+n.width,a)),h=this.getInterSections(e,c,"x");if(h.up&&h.down){let u=h.up,d=h.down.add1(r.offset.x*(t.column-1),0);l==1&&(u=u.add1(0,i.height-r.height),d=d.add1(0,i.height-r.height)),Ii.addLine(u,d)}});let s=!1;if(t.borderAtTopBottom&&!t.borderAtLeftRight){if(!t.stampRow&&t.rowSpacing>0){let a=new S(n.x,n.y),l=a.add1(t.borderRadius,t.borderRadius),c=a.add1(0,t.borderRadius),h=a.add1(0,t.borderHeight),u=a.add1(t.borderRadius,0),d=a.add1(n.width/2,0);this.addBorderByPoints([[h,c],l,[u,d]],t.borderRadius,n.center,t),s=!0}}else if(t.borderAtLeftRight&&!t.borderAtTopBottom&&!t.stampColumn&&t.columnSpacing>0){let a=new S(n.x,n.y),l=a.add1(t.borderRadius,0),c=a.add1(t.borderRadius,t.borderRadius),h=a.add1(t.borderHeight,0),u=a.add1(0,t.borderRadius),d=new S(n.x,n.y+n.height/2);this.addBorderByPoints([[h,l],c,[u,d]],t.borderRadius,n.center,t),s=!0}if(!s&&(t.borderAtLeftRight||t.borderAtTopBottom)){let a=new S(n.x,n.y),l=a.add1(t.borderRadius,t.borderRadius),c=a.add1(0,t.borderRadius),h=a.add1(0,t.borderAtLeftRight?n.height/2:t.borderHeight),u=a.add1(t.borderRadius,0),d=a.add1(t.borderAtTopBottom?n.width/2:t.borderHeight,0);this.addBorderByPoints([[h,c],l,[u,d]],t.borderRadius,n.center,t)}}getIntersects(t,e){let r=[];return t.forEach(i=>{for(let n of i.primitives)if(n instanceof M||n instanceof q){let s=[],a=Tt(e,n),l=n instanceof M&&n.direct&&ne.eq(e.direct.cross(n.direct),0);for(let c=0;c<a;c+=2){let h=new S(Ee[c],Ee[c+1]);s.push(h)}l&&s.length>1?r.push(s):s.length>0&&(r=r.concat(s))}}),r}getInterSections2(t,e,r){let i=new Array;for(let s of t){let a=new Array;for(let l=0;l<s.primitives.length;l++){let c=s.primitives[l],h=Tt(e,c);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);a.push({polyline:s,polyIndex:l,position:d})}}a.length>0&&(i=i.concat(a))}let n={};return i.forEach(s=>{(!n.up||+s.position[r]>+n.up.position[r])&&(n.up=s),(!n.down||+s.position[r]<+n.down.position[r])&&(n.down=s)}),n}getInterSections(t,e,r){let i=[];t.forEach(s=>{let a=[];for(let l of s.primitives){let c=Tt(e,l);for(let h=0;h<c;h+=2){let u=new S(Ee[h],Ee[h+1]);a.push(u)}}a.length>0&&(i=i.concat(a))});let n={};return i.forEach(s=>{s&&((!n.up||+s[r]>+n.up[r])&&(n.up=s),(!n.down||+s[r]<+n.down[r])&&(n.down=s))}),ne.eq(n.down.x,n.up.x)&&ne.eq(n.down.y,n.up.y)?{}:n}handleCustomRect(t){if(t.useCustomSize==null||t.customWidth<=0||t.customHeight<=0)return;let e="customRectForPanelize",r=Xt.getItem(e);if(t.useCustomSize)if(r&&!r.isEmpty)r.width=t.customWidth,r.height=t.customHeight;else{let i=new mi;i.createGroup("Use custom size for panelize");let n=je.stack!=null;[].concat(Xt.getAllItem(),Zt.getAllItem(),pt.getAllItem()).forEach(a=>{a.isEmpty||(!n&&i.addCommand4Item(a,"delete"),a.remove(),A.publish("delete",a))});let s=Xt.addRect("Board Outline",11,new S(0,0),t.customWidth,t.customHeight,"",!1,1,0,0,void 0,e);n||(i.addCommand4Item(s,"add"),i.execute())}else r&&je.undo()}helpCircle(t,e=.5){let r=q.buildCircle(t,e);uUe.displayPolyline(fe.build2([r]),4)}};var O9e=class{get deactiveAlpha(){return $e.getInstance().deactiveAlpha}set deactiveAlpha(t){$e.getInstance().deactiveAlpha=t;let e=be.getAllLayer();for(let r of e)r.refreshRender()}},ED=new O9e;var PV=class{buildLayers(t=$e.getInstance().getAllItem()){let e=$e.getInstance(),r=new Set([1001,1002]),i;for(let a of t){let l=a.layerId;if(r.has(l))return;be.addPcbLayerByModel(a,e.activeLayer==l),i=a.deactiveColor.alpha}i!=null&&(ED.deactiveAlpha=i);let n=be.getLayer(47),s=be.getLayer(12);n&&s&&(n.visible=s.visible)}buildLayerPhys(){}};var TV=class extends dR{constructor(){super(...arguments);this.manager=te.getInstance()}buildRule(e=this.manager.getAllNets()){for(let r of e)Vh.addNetByModel(r);this.ruleInitAndCheck(),this.correctEmptyNet()}};var IV=class{buildGroup(t=Ip.getInstance().getAllItem()){for(let e of t)kt.rebuildByModel(e)}};var pUe=$e.getInstance(),fUe=new RegExp(/(_([0-9]+))$/),OD=class{constructor(){this.planeLayerIds=new Set(pUe.getAllPlaneLayerIds());this.singleLayerIds=new Set(pUe.getAllSignalLayerIds())}addGroup(t){let e=t.model.getGroupID();if(e!=null){let r=kt.getItem(e);if(r==null)r=kt.rebuild(e,[t]);else if(r.addItem(t),t instanceof Me&&t.attrsMap["Reuse Block"]==null){let i=r.name;i!=null&&fUe.test(i)&&(t.reuseBlock=i.replace(fUe,""),t.combinationID==""&&(t.combinationID=i.replace(t.reuseBlock+"_","")))}}}};var AD=class extends OD{buildImages(t=Qs.getInstance().getAllItem()){return this.buildPcbItems(t,Ln,Ln.addImageByModel)}buildColorfulPictures(t=e0.getInstance().getAllItem()){return this.buildPcbItems(t,_o,_o.addImageByModel)}buildPads(t=$n.getInstance().getAllItem()){var r,i,n;let e=[];for(let s of t)if(((r=s.top)==null?void 0:r.pl)==null&&((i=s.bottom)==null?void 0:i.pl)==null&&((n=s.inner)==null?void 0:n.pl)==null){let a=Kt.addPadByModel(s);this.addGroup(a),e.push(a)}else{let a=Kt.addPolygonPadByModel(s);this.addGroup(a),e.push(a)}return e}buildLines(t=An.getInstance().getAllItem()){let e=new Array,r=$e.getInstance();for(let n of t){let s=n.layerId;s!=1&&s!=2&&Rh(r.getLayer(s).type)?(n.remove(),An.getInstance().delete(n,n.globalIndex)):e.push(n)}return this.buildPcbItems(e,pr,pr.addTrackByModel)}buildDimension(t=Ka.getInstance().getAllItem()){return this.buildPcbItems(t,Go,Go.addDimensionByModel)}buildRadiusMark(t=Sl.getInstance().getAllItem()){return this.buildPcbItems(t,Uo,Uo.addRadiusMarkByModel)}buildProtractor(t=Za.getInstance().getAllItem()){return this.buildPcbItems(t,is,is.addProtractorByModel)}buildVia(t=Tn.getInstance().getAllItem()){return this.buildPcbItems(t,Hr,Hr.addViaByModel)}buildText(t=mo.getInstance().getAllItem()){return this.buildPcbItems(t,ti,ti.addtextByModel)}buildPlaneZone(t=Ho.getInstance().getAllItem()){let e=[];for(let i=0;i<t.length;i++){let n=t[i];this.planeLayerIds.has(n.layerId)?e.push(n):Ho.getInstance().delete(n,n.globalIndex)}return this.buildPcbItems(e,Qn,Qn.addPlaneZoneByModel)}buildPcbItems(t,e,r){let i=[];for(let n of t){let s=r.call(e,n);this.addGroup(s),i.push(s)}return i}buildComponent(t=xs.getInstance().getAllItem()){let e=new Array;for(let r of t){let i=$c(r);this.addGroup(i),e.push(i);for(let n in i.attrsMap)i.modifyATTRMap(n,i.attrsMap[n])}return e}};var A9e=class{constructor(){this.default={material:"Polyimide",fpcModel:"3M9077"}}getOneStiffener(){let t=Xt.getAllItem();for(let e of t)if(e.type==="FPC Stiffener")return e;t=pt.getAllItem();for(let e of t)if(e.type==="FPC Stiffener")return e;t=Zt.getAllItem();for(let e of t)if(e.type==="FPC Stiffener")return e;return null}correctAllProps(t){let{material:e,fpcModel:r,thickness:i}=t;this.correctMaterial(e,t),this.correctModel(r,t),this.correctThickness(i,t)}correctMaterial(t,e){let r=e.material;return CFe.includes(t)?e.material=t:e.material="Polyimide",r!==e.material}correctModel(t,e){let r=e.fpcModel;return e.material==="Tape"?SFe.includes(t)?e.fpcModel=t:e.fpcModel="TESA8854":e.fpcModel=null,r!==e.fpcModel}correctThickness(t,e){let r=e.thickness,{values:i,defaultValue:n}=this.getThicknessValues(e);return i.some(s=>s===t)?e.thickness=t:e.thickness=n,r!==e.thickness}getThicknessValues(t){if(t.material==="Polyimide")return{values:[.1,.15,.2,.225,.25],defaultValue:.2};if(t.material==="FR4")return{values:[.1,.2,.4,.6,.8,1,1.2,1.6],defaultValue:.2};if(t.material==="Tape"){if(t.fpcModel==="3M468"){let e=[.13];return{values:e,defaultValue:e[0]}}else if(t.fpcModel==="3M9077"){let e=[.05];return{values:e,defaultValue:e[0]}}else if(t.fpcModel==="TESA8854"){let e=[.1];return{values:e,defaultValue:e[0]}}}else if(t.material==="EMI Shielding Film"){let e=[.018];return{values:e,defaultValue:e[0]}}else if(t.material==="Stainless Steel")return{values:[.1,.2,.3],defaultValue:.2};return{values:[0],defaultValue:0}}getMaterialOptions(){return[{value:"Polyimide",text:"Polyimide"},{value:"FR4",text:"FR4"},{value:"Stainless Steel",text:"Stainless Steel"},{value:"Tape",text:"Tape"},{value:"EMI Shielding Film",text:"EMI Shielding Film"}]}getModelOptions(){return[{value:"3M468",text:"3M468"},{value:"3M9077",text:"3M9077"},{value:"TESA8854",text:"TESA8854"}]}getThicknessOptions(t){let{values:e}=this.getThicknessValues(t);return e.map(r=>({value:r,text:`${r}mm`}))}getMixThicknessOptions(){let{values:t}=this.getThicknessValues({material:"Polyimide",fpcModel:"3M468"}),{values:e}=this.getThicknessValues({material:"FR4",fpcModel:"3M468"}),{values:r}=this.getThicknessValues({material:"Tape",fpcModel:"3M468"}),{values:i}=this.getThicknessValues({material:"Tape",fpcModel:"3M9077"}),{values:n}=this.getThicknessValues({material:"Tape",fpcModel:"TESA8854"}),{values:s}=this.getThicknessValues({material:"Stainless Steel",fpcModel:"3M468"}),{values:a}=this.getThicknessValues({material:"EMI Shielding Film",fpcModel:"3M468"}),l=Array.from(new Set([].concat(t,e,r,i,n,s,a)));return l.sort((c,h)=>c-h),l.map(c=>({value:c,text:`${c}mm`}))}},Qu=new A9e;var _D=class extends OD{constructor(){super(...arguments);this.boards=[];this.slots=[];this.pours=[];this.fills=[];this.tearDrops=[];this.prohibits=[];this.constraints=[];this.partitions=[];this.lines=[];this.fpcStiffeners=[];this.d3shellOutlines=[];this.d3shellSlots=[];this.d3shellEntitys=[];this.d3shellSideLines=[];this.d3shellScrews=[];this.result=new On}buildRect(e=rn.getInstance().getAllItem(),r){for(let i of e){if(!this.check(i)){rn.getInstance().delete(i,i.globalIndex);continue}let n=Xt.addRectByModel(i);i.type=="Partition"&&Dn.getInstance().addItem(n),this.getProfile(n),this.result.push(n),r&&r.push(n)}}buildCircle(e=zi.getInstance().getAllItem(),r){for(let i of e){if(!this.check(i)){zi.getInstance().delete(i);continue}let n=Zt.addCircleByModel(i);i.type=="Partition"&&Dn.getInstance().addItem(n),this.getProfile(n),this.result.push(n),r&&r.push(n)}}buildPolygon(e=Mi.getInstance().getAllItem(),r){for(let i of e){if(!this.check(i)){Mi.getInstance().delete(i,i.globalIndex);continue}let n=new Array(i.childrens.length);if(!i.isSimplify){let a=0;for(let l of i.childrens){let c=new Array(l.length),h=0;for(let u of l)u instanceof ys?c[h++]=$u.addByModel(u):c[h++]=qc.addArcByModel(u);n[a++]=c}}let s=pt.addPolygonByModel(i,n);i.type=="Partition"&&Dn.getInstance().addItem(s),this.getProfile(s),this.result.push(s),r&&r.push(s)}}getResult(){return this.result}buildProfiles(){return this.buildRect(),this.buildCircle(),this.buildPolygon(),this.updateAllProfile(),this.result.toArray()}check(e){var r,i;switch(e.type){case"Copper Region":{if(!this.singleLayerIds.has(e.layerId))return!1;break}case"Fill Region":{let n=(r=$e.getInstance().getLayer(e.layerId))==null?void 0:r.type;if(gs(n)&&!this.singleLayerIds.has(e.layerId))return!1;break}case"TearDrop":{let n=(i=$e.getInstance().getLayer(e.layerId))==null?void 0:i.type;if(gs(n)&&!this.singleLayerIds.has(e.layerId))return!1;break}}return!0}updateAllProfile(){this.updateOutline(),this.updateSlot(),this.updatePour(),this.updateFillRegion(),this.updateProhibitedRegion(),this.updateConstraintRegion(),this.updatePartitionRegion(),this.updateLine(),this.updateTearDrop(),this.updateFPCStiffener(),this.updateD3ShellOutline(),this.updateD3ShellOutline(),this.updateD3ShellSlotRegion(),this.updateD3ShellEntity(),this.updateD3ShellScrew(),this.updateD3ShellSideDatumLine()}getProfile(e){switch(e.type){case"Board Outline":this.boards.push(e);break;case"Slot Region":this.slots.push(e);break;case"Copper Region":this.pours.push(e);break;case"Fill Region":this.fills.push(e);break;case"TearDrop":this.tearDrops.push(e);break;case"Prohibited Region":this.prohibits.push(e);break;case"Constraint Region":this.constraints.push(e);break;case"Partition":this.partitions.push(e);break;case"Line":this.lines.push(e);break;case"FPC Stiffener":this.fpcStiffeners.push(e);break;case"3D Shell - Outline":this.d3shellOutlines.push(e);break;case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":this.d3shellSlots.push(e);break;case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":this.d3shellEntitys.push(e);break;case"3D Shell - Screw Pillar":this.d3shellScrews.push(e);break;case"3D Shell - Side Datum Line":this.d3shellSideLines.push(e);break}}updateOutline(){let e=this.boards;for(let r of e)this.addGroup(r)}updateSlot(){let e=this.slots;for(let r of e)this.addGroup(r)}updatePour(){let e=this.pours,r=Ei.nameManager;for(let i of e){let n=i.model.component;n.name?r.has(n.name)&&(n.name=r.getNum(n.name)):n.name=r.getNum("pour1"),r.add(n.name),this.addGroup(i)}}updateFillRegion(){let e=this.fills;for(let r of e)this.addGroup(r)}updateProhibitedRegion(){let e=this.prohibits;for(let r of e)this.addGroup(r)}updateTearDrop(){let e=this.tearDrops;for(let r of e)this.addGroup(r),new Nl(JSON.stringify({connects:r.getComponent().connects}),"TearDrop").modifyComponent(r)}updateConstraintRegion(){let e=this.constraints,r=wf.getInstance();for(let i of e){let n=i.model.component;n.name?r.hasName(n.name)&&(n.name=r.getName(n.name)):n.name=r.getName(),r.addName(n.name),this.addGroup(i)}}updatePartitionRegion(){let e=this.partitions,r=Dn.getInstance();for(let i of e){let n=i.model.component;n.name||(n.name=r.getName()),r.addName(n.name),this.addGroup(i)}}updateLine(){let e=this.lines;for(let r of e)this.addGroup(r)}updateFPCStiffener(){let e=this.fpcStiffeners;for(let r of e){let i=r.getComponent();Qu.correctAllProps(i),this.addGroup(r)}}updateD3ShellOutline(){let e=this.d3shellOutlines;for(let r of e)this.addGroup(r)}updateD3ShellSlotRegion(){let e=this.d3shellSlots;for(let r of e)this.addGroup(r)}updateD3ShellEntity(){let e=this.d3shellEntitys;for(let r of e)this.addGroup(r)}updateD3ShellScrew(){let e=this.d3shellScrews;for(let r of e)this.addGroup(r)}updateD3ShellSideDatumLine(){let e=this.d3shellSideLines;for(let r of e)this.addGroup(r)}};var gse=class extends OD{constructor(){super(...arguments);this.result=new On}build(e=Wo.getInstance().getAllItem()){for(let r of e){let i,n=r.getParent();if(!n)continue;let s=n.globalIndex;switch(n.modelType){case"Rect":i=Xt.getItem(s);break;case"Circle":i=Zt.getItem(s);break;case"Polygon":i=pt.getItem(s);break}if(!i)continue;let l=Ei.addCopperByModel(r);l.fill(),i.addCopperResult(l),l.setParent(i),this.result.push(l)}return this.result.toArray()}};var L0=class extends ET{constructor(e){super(e);this.items=new Array;this.decode=new ob}async init(e,r){this.compiler!=null&&(await super.init(e,r),await this.parseObj())}build(e){let{unRebuildRatline:r}=e||{};$Be();let i="pcbDataStrDecode-time";pn(i),this.buildDataModels(),BIe(),Ya.modelIsBuilt=!0,Bi(i);let n="buildController-time";return pn(n),this.buildController(),BIe(),Ya.controllerIsBuilt=!0,Bi(n),(x.getInstance().doctype===3||x.getInstance().id=="panelizePreview")&&new _p().applyPanelize({},!1),x.getInstance().doctype===3?setTimeout(()=>{ie.publish("HistoryFlushService",{openPcb:!0,unRebuildRatline:r})},0):ie.publish("updateFrame",""),Ya.engineHighlightReady=!0,!0}initItems(e){for(let r of e)r.initVisible();OT.initModify(e)}initEnd(){ze.finishInit(),OT.initModifyEnd()}buildController(){let e=new PV,r=new TV,i=new IV;e.buildLayers(),i.buildGroup(),r.buildRule();let n=new AD,a=new _D().buildProfiles(),c=new gse().build(),h=n.buildImages(),u=n.buildColorfulPictures(),d=n.buildLines(),p=n.buildDimension(),m=n.buildRadiusMark(),g=n.buildProtractor(),y=n.buildVia(),b=n.buildText(),P=n.buildPlaneZone(),T=n.buildPads(),I=n.buildComponent();Ya.engineHighlightReady=!1,this.initItems(a),this.initItems(c),this.initItems(h),this.initItems(u),this.initItems(T),this.initItems(d),this.initItems(p),this.initItems(m),this.initItems(g),this.initItems(y),this.initItems(b),this.initItems(P),this.initItems(I),this.initEnd();let C={components:{desc:"\u5143\u4EF6",amount:I.length},pads:{desc:"\u710A\u76D8",amount:T.length},via:{desc:"\u8FC7\u5B54",amount:y.length},track:{desc:"\u5BFC\u7EBF",amount:d.length},profiles:{desc:"2D\u8F6E\u5ED3\u7EBF",amount:a.length},text:{desc:"\u6587\u672C",amount:b.length},coppers:{desc:"\u94FA\u94DC",amount:c.length},images:{desc:"\u56FE\u7247",amount:h.length},colorfulPictures:{desc:"\u5F69\u8272\u56FE\u7247",amount:u.length},dimension:{desc:"\u5C3A\u5BF8\u5DE5\u5177",amount:p.length},radiusMark:{desc:"\u534A\u5F84\u5C3A\u5BF8",amount:m.length},protractor:{desc:"\u91CF\u89D2\u5668",amount:g.length},planeZones:{desc:"\u5185\u7535\u5C42",amount:P.length}};for(let E in C)C[E].ratio=+(C[E].amount/this.items.length).toFixed(2);$0("ShapeAmountCount",{color:"#ffff00"},this.items.length),console.table(C)}buildDataModels(){this.decode.preAdjust(),this.batchBuildItems(),this.buildItems(this.decode.canvas),this.buildItems(this.decode.primitive),this.buildItems(this.decode.panelize),this.buildItems(this.decode.panelizeStamp),this.buildItems(this.decode.panelizeSide),this.buildItems(this.decode.preference),this.buildItems(this.decode.silkOpts),this.buildItems(this.decode.activeLayer),this.buildItems(this.decode.board?[this.decode.board]:[])}getDecode(){return this.decode}};var IC=class extends vPe{constructor(t){super(),this.compiler=t}onLine(t,e,r,i,n,s,a,l,c,h){let u=r?JSON.parse(r):null;this.compiler.onParseLine(t,i,u,n,e)}onDocHead(){}onEnd(){}};var CV=class{constructor(t){this.commandFactory=t;let e=new hu("2.0",x.getInstance().doctype).save();this.parseSourceByCompiler(e),this.decode=this.modelDecode.getDecodeTool()}parseSourceByCompiler(t){if(t==null)return!1;let e=x.getInstance().compiler;this.modelDecode=new L0(e);let r=e.getHandle(),i=new og(this.modelDecode);e.setHandle(i,!0),new IC(e).parseFull(t),e.setHandle(r,!0)}getDecode(t,e){this.decode.preAdjust(),e&&e();for(let r of this.decode.attr)r.check();return this.diffDecode=this.getDifferentDecode(t,!1),this.delete(this.diffDecode),this.delete(this.getDifferentDecode(t,!0)),this.diffDecode}delete(t){if(this.deleteItem(Hr,t.via),this.deleteItem(ti,t.str),this.deleteItem(Xt,t.poly),this.deleteItem(Xt,t.fill),this.deleteItem(Xt,t.fpcFill),this.deleteItem(Xt,t.region),this.deleteItem(Xt,t.pour),this.deleteItem(Xt,t.shells),this.deleteItem(Xt,t.shellCuts),this.deleteItem(Xt,t.shellEntity),this.deleteItem(Zt,t.poly),this.deleteItem(Zt,t.fill),this.deleteItem(Zt,t.fpcFill),this.deleteItem(Zt,t.region),this.deleteItem(Zt,t.pour),this.deleteItem(Zt,t.shells),this.deleteItem(Zt,t.shellCuts),this.deleteItem(Zt,t.shellEntity),this.deleteItem(Zt,t.bosses),this.deleteItem(pt,t.poly),this.deleteItem(pt,t.fill),this.deleteItem(pt,t.fpcFill),this.deleteItem(pt,t.region),this.deleteItem(pt,t.pour),this.deleteItem(pt,t.shells),this.deleteItem(pt,t.shellCuts),this.deleteItem(pt,t.shellEntity),this.deleteItem(pt,t.creases),this.deleteItem(pr,t.line),this.deleteItem(pr,t.arc),this.deleteItem(pt,t.tearDrop),this.deleteItem(Qn,t.fill),this.deleteItem(Kt,t.pad),this.deleteItem(Ln,t.image),this.deleteItem(Ln,t.objs),t.board){let e=Cs.getInstance().board;e&&(this.commandFactory&&this.commandFactory.addCommand4Item(e,"delete"),e.remove(),A.publish("delete",e))}for(let e of t.dimension){let r=e.type,i;switch(r){case"LENGTH":i=Go.getItem(e.index);break;case"ANGLE":i=is.getItem(e.index);break;case"RADIUS":i=Uo.getItem(e.index);break}i&&(this.commandFactory&&this.commandFactory.addCommand4Item(i,"delete"),i.remove(),A.publish("delete",i))}this.deleteItem(Cr,t.component);for(let e of t.group){let r=kt.getGroupByName(e.name);r&&(this.commandFactory&&this.commandFactory.addCommand4Item(r,"delete"),r.remove(),A.publish("delete",r))}this.deleteItem(kt,t.group);for(let e of t.copper)this.deleteItem(Ei,e.coppers)}deleteItem(t,e){let r;for(let i of e)r=t.getItem(i.index),r&&(this.commandFactory&&this.commandFactory.addCommand4Item(r,"delete"),r.remove(),A.publish("delete",r))}getDifferentDecode(t,e=!1){let r=this.decode;e&&(r=t,t=this.decode);let i=new ob;return Re.addAll(i.canvas,this.pushItem(r.canvas,t.canvas)),Re.addAll(i.layer,this.pushItem(r.layer,t.layer)),Re.addAll(i.layerPhys,this.pushItem(r.layerPhys,t.layerPhys)),Re.addAll(i.activeLayer,this.pushItem(r.activeLayer,t.activeLayer)),Re.addAll(i.net,this.pushItem(r.net,t.net)),Re.addAll(i.rule,this.pushItem(r.rule,t.rule)),Re.addAll(i.ruleSelect,this.pushItem(r.ruleSelect,t.ruleSelect)),Re.addAll(i.primitive,this.pushItem(r.primitive,t.primitive)),Re.addAll(i.group,this.pushItem(r.group,t.group)),Re.addAll(i.via,this.pushItem(r.via,t.via)),Re.addAll(i.pad,this.pushItem(r.pad,t.pad)),Re.addAll(i.line,this.pushItem(r.line,t.line)),Re.addAll(i.arc,this.pushItem(r.arc,t.arc)),Re.addAll(i.poly,this.pushItem(r.poly,t.poly)),Re.addAll(i.fill,this.pushItem(r.fill,t.fill)),Re.addAll(i.fpcFill,this.pushItem(r.fpcFill,t.fpcFill)),Re.addAll(i.region,this.pushItem(r.region,t.region)),Re.addAll(i.partition,this.pushItem(r.partition,t.partition)),Re.addAll(i.pour,this.pushItem(r.pour,t.pour)),Re.addAll(i.image,this.pushItem(r.image,t.image)),Re.addAll(i.objs,this.pushItem(r.objs,t.objs)),Re.addAll(i.tearDrop,this.pushItem(r.tearDrop,t.tearDrop)),Re.addAll(i.font,this.pushItem(r.font,t.font)),Re.addAll(i.str,this.pushItem(r.str,t.str)),Re.addAll(i.attr,this.pushItem(r.attr,t.attr)),Re.addAll(i.dimension,this.pushItem(r.dimension,t.dimension)),Re.addAll(i.component,this.pushItem(r.component,t.component)),Re.addAll(i.padNet,this.pushItem(r.padNet,t.padNet)),Re.addAll(i.shells,this.pushItem(r.shells,t.shells)),Re.addAll(i.shellCuts,this.pushItem(r.shellCuts,t.shellCuts)),Re.addAll(i.creases,this.pushItem(r.creases,t.creases)),Re.addAll(i.bosses,this.pushItem(r.bosses,t.bosses)),Re.addAll(i.panelize,this.pushItem(r.panelize,t.panelize)),Re.addAll(i.panelizeStamp,this.pushItem(r.panelizeStamp,t.panelizeStamp)),Re.addAll(i.panelizeSide,this.pushItem(r.panelizeSide,t.panelizeSide)),Re.addAll(i.silkOpts,this.pushItem(r.silkOpts,t.silkOpts)),i.board=this.pushItem(r.board?[r.board]:[],t.board?[t.board]:[])[0],i}pushItem(t,e){let r=!0;if(t.length>0&&(r=t[0].hashkey==null),r&&e.length>0&&(r=e[0].hashkey==null),r){let i=e;for(let n of t)for(let s of e)this.deepEqual(n,s)&&(i=i.filter(a=>a!=s));return i}else{let i=new Array,n=new Map;for(let s of t)n.set(s.hashkey,s);for(let s of e){let a=n.get(s.hashkey);(!a||!this.deepEqual(a,s))&&i.push(s)}return i}}deepEqual(t,e){if(t===e)return!0;if(typeof t=="object"&&t!==null&&typeof e=="object"&&e!==null){if(Object.keys(t).length!=Object.keys(e).length)return!1;for(let r in t)if(e.hasOwnProperty(r)){if(!this.deepEqual(t[r],e[r]))return!1}else return!1;return!0}else return!1}};var yse=class{constructor(t){this._index=new Array;this._indexSet=new Set;this.repeatIndexIDComp=new Array;this.tool=t}applyCheck(){return!this.check()||(this.getIndex(),!Re.isSingle(this._index))?!1:(this.filterTearDrop(),this.filterDimension(),!0)}filterTearDrop(){let t=[],e=this.tool.tearDrop;for(let r of e)r.getConnect().length<2||!r.getConnect()[0]||!r.getConnect()[1]||t.push(r);this.tool.tearDrop.length=0,Re.addAll(this.tool.tearDrop,t)}filterDimension(){let t=[],e=this.tool.dimension;for(let r of e)r.getAttrLength()>=2||t.push(r);this.tool.dimension.length=0,Re.addAll(this.tool.dimension,t)}check(){return!(!this.checkItems(this.tool.line)||!this.checkItems(this.tool.canvas)||!this.checkItems(this.tool.layer)||!this.checkItems(this.tool.layerPhys)||!this.checkItems(this.tool.activeLayer)||!this.checkItems(this.tool.net)||!this.checkItems(this.tool.rule)||!this.checkItems(this.tool.ruleSelect)||!this.checkItems(this.tool.group)||!this.checkItems(this.tool.font)||!this.checkItems(this.tool.via)||!this.checkItems(this.tool.pad)||!this.checkItems(this.tool.arc)||!this.checkItems(this.tool.poly)||!this.checkItems(this.tool.fill)||!this.checkItems(this.tool.fpcFill)||!this.checkItems(this.tool.region)||!this.checkItems(this.tool.pour)||!this.checkItems(this.tool.image)||!this.checkItems(this.tool.objs)||!this.checkItems(this.tool.tearDrop)||!this.checkItems(this.tool.str)||!this.checkItems(this.tool.attr)||!this.checkItems(this.tool.dimension)||!this.checkItems(this.tool.component)||!this.checkItems(this.tool.shells)||!this.checkItems(this.tool.shellCuts)||!this.checkItems(this.tool.shellEntity)||!this.checkItems(this.tool.creases)||!this.checkItems(this.tool.bosses))}checkItems(t){try{for(let e of t)if(!e.check())return!1}catch{return!1}return!0}getIndex(){this._index.length=0,this._indexSet.clear(),this.repeatIndexIDComp.length=0,this.getIndexItem(this.tool.via),this.getIndexItem(this.tool.pad),this.getIndexItem(this.tool.line),this.getIndexItem(this.tool.arc),this.getIndexItem(this.tool.poly),this.getIndexItem(this.tool.fill),this.getIndexItem(this.tool.fpcFill),this.getIndexItem(this.tool.region),this.getIndexItem(this.tool.pour),this.getIndexItem(this.tool.image),this.getIndexItem(this.tool.tearDrop),this.getIndexItem(this.tool.str),this.getIndexItem(this.tool.dimension),this.getIndexItem(this.tool.component),this.getIndexItem(this.tool.attr),this.getIndexItem(this.tool.shells),this.getIndexItem(this.tool.shellCuts),this.getIndexItem(this.tool.shellEntity),this.getIndexItem(this.tool.creases),this.getIndexItem(this.tool.bosses)}getIndexItem(t){for(let e of t){for(let i=0;i<this.tool.dimensionAttr.length;i++)if(this.tool.dimensionAttr[i]===e)return;this._indexSet.has(e.index)&&this.repeatIndexIDComp.push(e),(e.index==null||e.index=="")&&this.repeatIndexIDComp.push(e),this._index.push(e.index),this._indexSet.add(e.index)}}setNoRepeatIndexID(){}};var bse=class extends yse{check(){return!this.checkItems(this.tool.silkOpts)||!this.checkItems(this.tool.primitive)||!this.checkItems(this.tool.panelize)||!this.checkItems(this.tool.panelizeStamp)||!this.checkItems(this.tool.panelizeSide)?!1:super.check()}};var SV=class extends L0{constructor(){super(...arguments);this.commandFactory=null;this.models=new On;this.layerModels=new On;this.ruleModels=new On;this.ruleSelectorModels=new On}async parseSourceByCompiler(e,r){if(e==null)return!1;let i=new og(this),n=this.compiler.getHandle();this.compiler.setHandle(i,!0),r&&(e=uz("",e,[],[],[],[])),new IC(this.compiler).parseFull(e),this.compiler instanceof Pu&&await this.parseFootAndDevice(),this.compiler.setHandle(n,!0)}build(e){let{noNeedSave:r}=e||{};this.decode.preAdjust(),this.handlePartitionIds();let i=new bse(this.decode);if(!r&&!i.applyCheck())return!1;r||(this.commandFactory=new mi,this.commandFactory.createGroup("modify by file source"));let n=new CV(this.commandFactory);if(this.decode=n.getDecode(this.decode),this.batchBuildItems(),this.buildItems(this.decode.canvas),this.buildItems(this.decode.primitive),this.buildItems(this.decode.panelize),this.buildItems(this.decode.panelizeStamp),this.buildItems(this.decode.panelizeSide),this.buildItems(this.decode.preference),this.buildItems(this.decode.silkOpts),this.buildAllItems(),this.buildItems(this.decode.activeLayer),this.decode.board){let a=this.decode.board.finish();a&&this.commandFactory&&this.commandFactory.addCommand4Item(a,"add")}this.docType==4&&wc.getTemplate().checkMustAttr();for(let a of this.items){let l=a;this.commandFactory&&this.commandFactory.addCommand4Item(l,"add"),l instanceof Me&&l.visible(),ie.publish("hasModifyPcbItem",l)}this.commandFactory&&this.commandFactory.execute();let s=vD().length>0;return ie.publish("autoFill",""),x.getInstance().doctype===3?(new _p().applyPanelize({},!1),r?(ie.publish("rebuildCopper",""),s||ie.publish("flushService","")):ie.publish("HistoryFlushService","")):(ie.publish("updateRtree",""),ie.publish("updateFrame","")),!0}buildItems(e){for(let r of e)try{let i=r.finish();i instanceof z2?this.models.addLast(i):i instanceof Y2?this.ruleSelectorModels.addLast(i):i instanceof N1?this.ruleModels.addLast(i):i instanceof RA&&this.layerModels.addLast(i)}catch(i){console.log(i)}}buildAllItems(){let e=new PV,r=new TV,i=new IV;e.buildLayers(this.layerModels.toArray()),i.buildGroup();let n=new Set;for(let C of this.ruleSelectorModels.toArray())C instanceof bp&&n.add(C);r.buildRule(n);let s=new Map;for(let C of this.models.toArray())if(C instanceof ki){let E=C.modelType,O=s.get(E);O==null&&(O=[],s.set(E,O)),O.push(C)}let a=new AD,l=new _D;l.buildRect(s.get("Rect")||[]),l.buildCircle(s.get("Circle")||[]),l.buildPolygon(s.get("Polygon")||[]),l.updateAllProfile();let c=a.buildImages(s.get("Image")||[]),h=a.buildColorfulPictures(s.get("Picture")||[]),u=a.buildLines(s.get("Track")||[]),d=a.buildLines(s.get("ArcTrack")||[]),p=a.buildDimension(s.get("Length Dimension")||[]),m=a.buildRadiusMark(s.get("Radius Dimension")||[]),g=a.buildProtractor(s.get("Protractor Dimension")||[]),y=a.buildVia(s.get("Via")||[]),b=a.buildText(s.get("Text")||[]),P=a.buildPlaneZone(s.get("Inner")||[]),T=a.buildPads(s.get("Pad")||[]),I=a.buildComponent(s.get("Component")||[]);Re.addAll(this.items,l.getResult().toArray()),Re.addAll(this.items,c),Re.addAll(this.items,h),Re.addAll(this.items,T),Re.addAll(this.items,u),Re.addAll(this.items,d),Re.addAll(this.items,p),Re.addAll(this.items,m),Re.addAll(this.items,g),Re.addAll(this.items,y),Re.addAll(this.items,b),Re.addAll(this.items,P),Re.addAll(this.items,I)}handlePartitionIds(){if(!this.partitionId)return;let e={},r=`_partition_${this.partitionId}`;this.replaceGlobalIndex(this.decode.via,r,e),this.replaceGlobalIndex(this.decode.pad,r,e),this.replaceGlobalIndex(this.decode.line,r,e),this.replaceGlobalIndex(this.decode.arc,r,e),this.replaceGlobalIndex(this.decode.poly,r,e),this.replaceGlobalIndex(this.decode.fill,r,e),this.replaceGlobalIndex(this.decode.fpcFill,r,e),this.replaceGlobalIndex(this.decode.region,r,e),this.replaceGlobalIndex(this.decode.pour,r,e);for(let i of this.decode.copper)this.replaceGlobalIndex(i.coppers,r,e);this.replaceGlobalIndex(this.decode.image,r,e),this.replaceGlobalIndex(this.decode.objs,r,e),this.replaceGlobalIndex(this.decode.tearDrop,r,e),this.replaceGlobalIndex(this.decode.str,r,e),this.replaceGlobalIndex(this.decode.attr,r,e),this.replaceGlobalIndex(this.decode.dimension,r,e),this.replaceGlobalIndex(this.decode.shells,r,e),this.replaceGlobalIndex(this.decode.shellCuts,r,e),this.replaceGlobalIndex(this.decode.shellEntity,r,e),this.replaceGlobalIndex(this.decode.creases,r,e),this.replaceGlobalIndex(this.decode.bosses,r,e)}replaceGlobalIndex(e,r,i){for(let n of e)if(n.index.endsWith(r)){let s=cr();i[n.index]=s,n.index=s}}};function vo(o){let t=new Jt;return t.add("CANCEL"),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var Pse=class{buildItems(t,e){try{t.forEach(r=>{r.index=cr();let i=r.finish();i instanceof ki&&(e.push(i),i.setGroupID(void 0))})}catch(r){console.log(r)}}buildAllItems(t,e=[]){let r=new AD,i=new _D;return t.forEach(n=>{let s=[];n instanceof ss?i.buildPolygon([n],s):n instanceof Po?i.buildCircle([n],s):n instanceof Aa?i.buildRect([n],s):n instanceof ql?s=r.buildImages([n]):n instanceof bm?s=r.buildColorfulPictures([n]):n instanceof yt?s=r.buildLines([n]):n instanceof Rf?s=r.buildDimension([n]):n instanceof Df?s=r.buildRadiusMark([n]):n instanceof zd?s=r.buildProtractor([n]):n instanceof Cn?s=r.buildPlaneZone([n]):n instanceof Li?s=r.buildText([n]):n instanceof Je?s=r.buildPads([n]):n instanceof It?s=r.buildVia([n]):n instanceof vi?s=r.buildComponent([n]):console.warn("Unsupported type!"),Re.addAll(e,s)}),e}getAllItems(t){let e=new Array,r=S.ORIGIN;t.canvas.forEach(n=>{r=n.origin}),this.buildItems(t.font,e),this.buildItems(t.via,e),this.buildItems(t.pad,e),this.buildItems(t.line,e),this.buildItems(t.arc,e),this.buildItems(t.poly,e),this.buildItems(t.fill,e),this.buildItems(t.fpcFill,e),this.buildItems(t.region,e),this.buildItems(t.pour,e),this.buildItems(t.image,e),this.buildItems(t.tearDrop,e),this.buildItems(t.str,e),this.buildItems(t.dimension,e);let i=Ae.translate(-r.x,-r.y,0);return e.forEach(n=>{n.transform(i)}),this.buildAllItems(e)}};var ep=class{constructor(t){this.stateMap=new Map;this.selections=new Array;this.matrix=Ae.ORIGIN;this.currAngle=0;this.group=t}isMoveBox(){return this.group.length>400}recordStyle(){if(this.group.length>400&&this.stateMap.size==0){let t=new _e;for(let r of this.group)t.ext1(r.buildBBox());let e=t.build();this.updateSelectBox(e);for(let r of this.group)this.stateMap.set(r,r.isVisible?r.isHighLight?2:1:0),r.hidden()}}updateSelectBox(t){let e=ce.themeConfig.canvasTheme,r=e.isSolidLine(e.selectBoxLineStyle),i=e.selectBoxColor,n=t.LL(),s=t.LR(),a=t.UR(),l=t.UL(),c=new hr(1002,n,s,r,i),h=new hr(1002,s,a,r,i),u=new hr(1002,a,l,r,i),d=new hr(1002,l,n,r,i);c.manualHighLight=!0,h.manualHighLight=!0,u.manualHighLight=!0,d.manualHighLight=!0,this.selections.push(c),this.selections.push(h),this.selections.push(u),this.selections.push(d)}rotateFor(t,e){let r=Ae.translate(-t.x,-t.y,0).rotateZ(e).translate1(t.x,t.y,0);this.transform(r)}rotateForAngle(t,e){let r=e-this.currAngle;this.currAngle=e;let i=Ae.translate(-t.x,-t.y,0).rotateZ(r).translate1(t.x,t.y,0);this.transform(i)}transform(t){if(this.selections.length>0){for(let e of this.selections)e.transform(t);this.matrix=this.matrix.multiply4(t)}else for(let e of this.group)e instanceof Ph||e.transform(t)}sycn(){for(let t of this.group)t instanceof Ph||t.transform(this.matrix);this.matrix=Ae.ORIGIN}removeBox(){for(let t of this.selections)t.remove();this.selections.length=0;for(let t of this.group){let e=this.stateMap.get(t);e!=null&&(e==0?t.hidden():e==1?t.visible():e==2&&(t.visible(),t.click()))}this.stateMap.clear(),this.matrix=Ae.ORIGIN}complete(){if(this.selections.length>0){for(let t of this.group)t instanceof Ph||t.transform(this.matrix);this.removeBox()}}cancel(){this.removeBox()}};var LX=class LX extends ci{constructor(){super(...arguments);this.mouseLeftX=0;this.mouseLeftY=0}static getInstance(){let e=LX;return e.instance==null&&(e.instance=new LX),e.instance}set group(e){if(this.filterItems.clear(),e!=null)for(let r of e)this.filterItems.add(r),r instanceof Me&&r.getItems().forEach(i=>this.filterItems.add(i));this.tool!=null&&this.tool.cancel(),this.tool=new ep(e),this.tool.recordStyle()}get group(){var e;return((e=this.tool)==null?void 0:e.group)||[]}getBBox(){if(this.group.length>0){let e=new _e;return this.group.forEach(i=>{e.ext1(i.buildBBox())}),e.valid()||e.ext6(0,0),e.build1()}else return new ut(0,0,0,0)}onKeyDown(e){switch(sr.getAction(2,e)){case"Cancel":this.cancel();break;case"Rotate Left":if(this.group.length>0){let i=new S(this.mouseLeftX,this.mouseLeftY),n=ce.pcbConfig.rotate;for(let s of this.group)s instanceof Ph||s.rotateFor(i,n)}break;case"rotate_right":if(this.group.length>0){let i=new S(this.mouseLeftX,this.mouseLeftY),n=-ce.pcbConfig.rotate;for(let s of this.group)s instanceof Ph||s.rotateFor(i,n)}break;case"Show Attribute Dialog When Placing Object":A.publish("openMainDialog",{cmd:23,data:{option:{unit:x.getInstance().unit}}});break}A.publish("updateFrame","")}onKeyUp(e){if(this.group.length>0){let r=new Mt(e.sceneX-this.mouseLeftX,e.sceneY-this.mouseLeftY,0),i=Ae.translate1(r);this.tool.transform(i),this.mouseLeftX=e.sceneX,this.mouseLeftY=e.sceneY}}onMouseLeftUp(e){if(A.publish("clearSelect",""),this.group.length>0){if(!Bt.checkIsCanEditByBBox(this.getBBox())){let n="beyond drawing range";Bt.showMassageTip(n,n);return}this.tool.complete();let r=new ve("import dxf");for(let n of this.group){A.publish("hasModifyPcbItem",n);let s=Te.dispatch(n,"add");r.addCommand(s)}je.executeCommand(r);let i=new Set;for(let n of this.group)n.visible(),n instanceof Ye&&n.type=="Copper Region"&&i.add(n.globalIndex);A.publish("select",[]),this.group.length=0,A.publish("flushService",""),A.publish("rebuildSingleCopper",{ids:Array.from(i),isLast:!0}),this.end()}A.publish("tool","dropdrag")}onMouseMove(e){if(this.group.length>0){let r=new Mt(e.sceneX-this.mouseLeftX,e.sceneY-this.mouseLeftY,0),i=Ae.translate1(r);this.tool.transform(i),this.mouseLeftX=e.sceneX,this.mouseLeftY=e.sceneY}}interrupt(){A.publish("select",new Array),this.tool.cancel();for(let e of this.group)e.remove(),A.publish("delete",e);this.group.length=0,this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break}A.publish("updateFrame","")}async partDxf(e){this.start();let{dataStr:r,userBBoxCenter:i,isOldDataString:n}=e,s=x.getInstance(),a=s.doctype,l=s.id,c=s.projectId,h=null,u=x.getInstance().compilerChannel;a==4?h=new OS(l,c,u):a==3?h=new Pu(l,c,u):h=new Pu(l,c,u);let d=new L0(h);if(r?await d.parseSourceByCompiler(r,n):await d.init(),this.option="OPTIONLEFTUP",this.drawing=!0,this.group=new Pse().getAllItems(d.getDecode()),i){let p=this.getBBox().center();this.mouseLeftX=p.x,this.mouseLeftY=p.y}else this.mouseLeftX=0,this.mouseLeftY=0}};LX.instance=null;var xD=LX;var He="<...>",mUe="Group";var ec=class{constructor(){this.count=0;this.idList=new Array;this.attrlist=null;this.hasNonSignalLayerItem=!1;this.poolCache={},this.unitConversion=new ft}getAttrList(){return this.attrlist}getExtra(){return{}}getResult(t){return{attrlist:{[t]:this.attrlist},idListOfPrimitive:{[t]:Array.from(this.idList)},selectNumberForId:this.count,selectCount:this.count,hasNonSignalLayerItem:this.hasNonSignalLayerItem,extra:{...this.getExtra()}}}getCompareValue(t,e){if(this.attrlist!=null){let r=this.attrlist[t];if(r!=null&&r.value!=e)return He}return e}getCompareDisabledValue(t,e){if(this.attrlist!=null){let r=this.attrlist[t];if(r!=null&&(r.disable||e))return!0}return e}clearCache(){this.attrlist=null,this.hasNonSignalLayerItem=!1,this.idList.length=0,this.idList=[],this.count=0}getValue(t){return isNaN(t)||t==null?0:t}modifyCombination(t,e){t=t.trim();let r=new Array,i=e.getGroupID();if(i!=null){let s=kt.getItem(i);if(s&&s.name==t)return r;if(s!=null){let a=Te.dispatch(s,"modify");if(r.push(a),s.deleteItem(e),e.setGroupID(void 0),s.size==0){let l=Te.dispatch(s,"delete");kt.delete(s),r.push(l)}}}let n=kt.getGroupByName(t);if(n!=null){let s=Te.dispatch(n,"modify");r.push(s),kt.joinCombination([e],n.globalIndex)}else if(t){let s=kt.combination([e],t),a=Te.dispatch(s,"add");r.push(a)}return r}getSilkColor(t,e){var r;if(t instanceof Me||t instanceof Ye||t instanceof Yn||t instanceof va||t instanceof fr){let i=(r=t.silkColor)==null?void 0:r.toString(),n;3==t.layerId?n=we.topSilkscreenColor:4==t.layerId?n=we.bottomSilkscreenColor:t instanceof Me&&(1==t.layerId?n=we.topSilkscreenColor:2==t.layerId&&(n=we.bottomSilkscreenColor)),(e["attr-silk-color"]==null||e["attr-silk-color"].value!=He)&&n&&(e["attr-silk-color"]={title:"Silk Screen",value:this.getCompareValue("attr-silk-color",i),defaultValue:n,followDefault:!i})}}};var Vu={getSheetFrameLayer(){return[{text:be.getOutlineLayer().name,value:11}]},isFootprintLayerInPCB(o){return[48,49,50,51,52].includes(o)&&x.getInstance().doctype===3},getRegionLayer(o){let t=new Array,e=be.getAllLayer();for(let r of e)if(!(r.layerID==56&&o=="Fill Region")&&!gr(r.layerID)&&!U2(r.layerID)&&!_c(r.layerID)&&r.config&&!r.isPlaneLayer()&&![47,52].includes(r.layerID)&&!ba(r.layerID)&&!(r.layerID===49&&!Vu.isFootprintLayerInPCB(r.layerID))&&57!=r.layerID){let i={text:r.name,value:r.layerID};t.push(i)}return t},getRegionLayer2(o){let t=new Array,e=be.getAllLayer();for(let r of e)if(!(r.layerID==56&&o.type=="Fill Region")&&!gr(r.layerID)&&!U2(r.layerID)&&!_c(r.layerID)&&r.config&&!r.isPlaneLayer()&&![47,52].includes(r.layerID)&&!ba(r.layerID)&&!(r.layerID===49&&!(o instanceof Sr))&&57!=r.layerID&&!Vu.isFootprintLayerInPCB(r.layerID)){let i={text:r.name,value:r.layerID};t.push(i)}return t},getSlotLayer(){return[{text:be.getMultLayer().name,value:12}]},getStiffenerLayer(){return[58,59].map(o=>{let t=be.getLayer(o);return{value:t.layerID,text:t.name}})},getProhibitLayer(){let o=new Array,t=be.getAllLayer();for(let e of t)if(gr(e.layerID)||e.config&&e.isSignalLayer()||e.config&&e.isPlaneLayer()){let r={text:e.name,value:e.layerID};o.push(r)}return o},getConstraintLayer(){let o=new Array,t=be.getAllLayer();for(let e of t)if(gr(e.layerID)||e.config&&e.isSignalLayer()||e.config&&e.isPlaneLayer()){let r={text:e.name,value:e.layerID};o.push(r)}return o},getPourLayer(){let o=new Array,t=be.getAllLayer();for(let e of t)if(e.config&&e.isSignalLayer()){let r={text:e.name,value:e.layerID};o.push(r)}return o},getPlaneLayer(){let o=new Array,t=be.getAllPlaneLayer();for(let e of t)if(e.config){let r={text:e.name,value:e.layerID};o.push(r)}return o},getLineLayer(){let o=new Array,t=be.getAllLayer();for(let e of t)if(!gr(e.layerID)&&!_c(e.layerID)&&e.config&&![47,52].includes(e.layerID)&&!ba(e.layerID)&&57!=e.layerID&&!IA(e.layerID)){let r={text:e.name,value:e.layerID};o.push(r)}return o},getLayerIdOptions(o){let t=$e.getInstance().getLayer(54),e=$e.getInstance().getLayer(55),r=$e.getInstance().getLayer(53);switch(o){case"3D Shell - Outline":case"3D Shell - Side Datum Line":return[{text:r.name,value:r.layerId}];case"3D Shell - Screw Pillar":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":return[{text:t.name,value:t.layerId},{text:e.name,value:e.layerId}];default:return[]}}},Zn=class o{static getLayerListByType(t){let e=[];for(let n=0;n<t.length;n++){let s=t[n],a=[];if(s instanceof Ue)a=o.abstractTrack();else if(s instanceof Me)a=o.component();else if(s instanceof mt||s instanceof vt||s instanceof Ye)a=o.createLayerOptionsByLineloop(s);else if(s instanceof Yn)a=o.image();else if(s instanceof Rs)a=o.trueColorImage();else if(s instanceof Le)a=o.abstractPad();else if(s instanceof fr)a=o.pcbText();else if(s instanceof Ge)a=o.via();else if(s instanceof va)a=o.abstractDimension();else{console.log("\u4E0D\u80FD\u5207\u5C42");continue}e.push(a)}return r(e);function r(n){if(n.length<=1)return n[0]||[];let s=new Set(i(n[0]));for(let a=0;a<n[0].length;a++)for(let l=1;l<n.length;l++)new Set(i(n[l])).has(n[0][a].value)||s.delete(n[0][a].value);return Array.from(s).map(a=>({text:$e.getInstance().getLayer(a).name,value:a}))}function i(n){let s=[];for(let a=0;a<n.length;a++)s.push(n[a].value);return s}}static abstractTrack(){let t=new Array,e=$e.getInstance().getAllItem();for(let r of e)r.config&&gs(r.type)&&t.push({text:r.name,value:r.layerId});return t}static component(){return[{text:$e.getInstance().getLayer(1).name,value:1},{text:$e.getInstance().getLayer(2).name,value:2}]}static createLayerOptionsByLineloop(t,e){let r=t.type||t.getParent().type,i=[];if(r!=null)switch(r){case"Board Outline":i=Vu.getSheetFrameLayer();break;case"Fill Region":i=Vu.getRegionLayer2(t);break;case"FPC Stiffener":i=Vu.getStiffenerLayer();break;case"Slot Region":i=Vu.getSlotLayer();break;case"Prohibited Region":i=Vu.getProhibitLayer();break;case"Constraint Region":i=Vu.getConstraintLayer();break;case"Copper Region":case"TearDrop":i=Vu.getPourLayer();break;case"Line":i=Vu.getLineLayer();break;default:i=Vu.getLayerIdOptions(r)}if(e==null||e.length==0)return i;{let n=new Set(e.map(a=>a.value)),s=Array.from(e);for(let a of i)n.has(a.value)||s.push(a);return s}}static createLayerOptionsByType(t){let e=[];if(t!=null)switch(t){case"Board Outline":e=Vu.getSheetFrameLayer();break;case"Fill Region":e=Vu.getRegionLayer(t);break;case"FPC Stiffener":e=Vu.getStiffenerLayer();break;case"Slot Region":e=Vu.getSlotLayer();break;case"Prohibited Region":e=Vu.getProhibitLayer();break;case"Constraint Region":e=Vu.getConstraintLayer();break;case"Copper Region":case"TearDrop":e=Vu.getPourLayer();break;case"Line":e=Vu.getLineLayer();break;default:e=Vu.getLayerIdOptions(t)}return e}static fixLayerOptions(t,e){let r=Array.from(e),i=!1,n=-1;for(let a=0;a<r.length;a++)if(+r[a].value>t&&n<=-1&&(n=a),r[a].value===t){i=!0;break}if(i)return r;let s=null;for(let a=0;a<Bg.length;a++)if(Bg[a].layerId===t){s={...Bg[a]};break}return n>=0&&s&&r.splice(n,0,{value:t,text:s.name}),r}static image(){let t=new Array,e=$e.getInstance().getAllItem();for(let r of e)12!=r.layerId&&11!=r.layerId&&7!=r.layerId&&8!=r.layerId&&57!=r.layerId&&47!=r.layerId&&r.config&&!Rh(r.type)&&!_E(r.layerId)&&![52].includes(r.layerId)&&!ba(r.layerId)&&!_c(r.layerId)&&t.push({text:r.name,value:r.layerId});return t}static trueColorImage(){let t=$e.getInstance(),e=t.getLayer(3),r=t.getLayer(4),i=t.getLayer(13);return[{text:e.name,value:e.layerId},{text:r.name,value:r.layerId},{text:i.name,value:i.layerId}]}static abstractPad(){let t=new Array,e=$e.getInstance(),r={text:e.getLayer(12).name,value:12},i={text:e.getLayer(1).name,value:1},n={text:e.getLayer(2).name,value:2};return t.push(r),t.push(i),t.push(n),t}static pcbText(){let t=new Array,e=$e.getInstance().getAllItem();for(let r of e)if(!gr(r.layerId)&&!U2(r.layerId)&&7!=r.layerId&&8!=r.layerId&&57!=r.layerId&&47!=r.layerId&&!ba(r.layerId)&&!_c(r.layerId)&&!Mte(r.layerId)&&r.config&&!Rh(r.type)){let i={text:r.name,value:r.layerId};t.push(i)}return t}static via(){let t=new Array,e=$e.getInstance().getAllItem();for(let r of e)r.config&&(gs(r.type)||Rh(r.type))&&t.push({text:r.name,value:r.layerId});return t}static abstractDimension(){let t=[{text:"Top Silkscreen Layer",value:3},{text:"Bottom Silkscreen Layer",value:4},{text:"Document Layer",value:13}],e=$e.getInstance(),r=e.getAllItem();for(let i of r)if((e.isCustomLayer(i.layerId)||Nte(i.layerId))&&i.config){let n={text:i.name,value:i.layerId};t.push(n)}return t}static canChangeLayer(t,e){return MOt(t).includes(e)}};function MOt(o){return o instanceof Ue?Zn.abstractTrack().map(t=>t.value):o instanceof Le?Zn.abstractPad().map(t=>t.value):o instanceof fr?Zn.pcbText().map(t=>t.value):o instanceof Me?Zn.component().map(t=>t.value):o instanceof Ye?NOt(o):o instanceof ii?Vu.getPourLayer().map(t=>t.value):o instanceof Ki?Vu.getPlaneLayer().map(t=>t.value):o instanceof Yn?Zn.image().map(t=>t.value):o instanceof Rs?Zn.trueColorImage().map(t=>t.value):o instanceof va?Zn.abstractDimension().map(t=>t.value):[]}function NOt(o){let t=o.type;switch(t){case"Board Outline":return Vu.getSheetFrameLayer().map(e=>e.value);case"Slot Region":return Vu.getSlotLayer().map(e=>e.value);case"Copper Region":case"TearDrop":return Vu.getPourLayer().map(e=>e.value);case"Fill Region":return Vu.getRegionLayer(t).map(e=>e.value);case"FPC Stiffener":return Vu.getStiffenerLayer().map(e=>e.value);case"Prohibited Region":case"Constraint Region":return Vu.getProhibitLayer().map(e=>e.value);case"Line":return Vu.getLineLayer().map(e=>e.value);case"3D Shell - Outline":case"3D Shell - Side Datum Line":case"3D Shell - Screw Pillar":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":return Vu.getLayerIdOptions(t).map(e=>e.value);default:return[]}}var EV=class{constructor(t){this.group=t}restoreAttr(t,e){let r=ps.getItem(e.deviceUUID),i=Ji.getItem(e.footprintUUID),n=e.attrKeyText[t];if(t=="Device"){n!=null&&r.restoreAttr(n.model,{componentPosition:e.position,angle:e.rotation,footprintId:i.uuid,componentLayerId:e.layerId});let s=r.name;e.modifyATTRMap(t,s.toString())}else if(t=="Footprint")this.restoreFootprint(e);else if(t=="3D Model Title"){n&&(n.positionIsNull=!0,e.removeAttribute(n));let s=e.attrKeyText["3D Model"];s&&(s.positionIsNull=!0,e.removeAttribute(s));let a=e.attrKeyText["3D Model Transform"];a&&(a.positionIsNull=!0,e.removeAttribute(a));let l=r.attrMap["3D Model"],c=r.attrMap["3D Model Title"],h=r.attrMap["3D Model Transform"];if(!l){let u=Ji.getItem(e.footprintUUID);u&&(l=u.getValue("3D Model"),c=u.getValue("3D Model Title"),h=u.getValue("3D Model Transform"))}e.modifyATTRMap("3D Model",l||void 0),e.modifyATTRMap("3D Model Title",c||void 0),e.modifyATTRMap("3D Model Transform",h||void 0)}else if(i.has(t)){n!=null&&(n.positionIsNull=!0,r.restoreAttr(n.model,{componentPosition:e.position,angle:e.rotation,footprintId:i.uuid,componentLayerId:e.layerId}));let s=r.attrs[t];s==null&&(s=i.getValue(t)),e.modifyATTRMap(t,s.toString())}else n!=null&&(n.positionIsNull=!0,e.removeAttribute(n)),r.has(t)?e.modifyATTRMap(t,r.attrMap[t]):e.deleteATTRMap(t)}restoreFootprint(t){this.group!=null&&this.group.addCommand(Te.dispatch(t,"delete"));let e=ps.getItem(t.deviceUUID),r=new z1("2.0"),i;if(e.footprintUUID==null||e.footprintUUID==""){let a=Ji.getItem(t.footprintUUID);a instanceof Xc&&(a=Ji.getItem(a.source)),e.restoreAttr(t.idShape.model,{componentPosition:t.position,angle:t.rotation,footprintId:a.uuid,componentLayerId:t.layerId}),i=r.replace(t.model,"Footprint",a.uuid)}else i=r.restore(t.model);A.publish("clearSelect",""),t.remove(),A.publish("delete",t);let n=new Y1(i);n.build();let s=n.items[0];A.publish("hasModifyPcbItem",s),this.group!=null&&this.group.addCommand(Te.dispatch(s,"add"))}};var yUe=6.75,MX=class extends ec{constructor(){super(...arguments);this.group=null;this.component=null;this.unionAttribute=null;this.interAttribute=null;this.attrIdMap={}}set(e){return this.component=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=x.getInstance().unit,i=x.getInstance().origin;this.attrlist==null&&(this.attrlist={});let n=this.attrlist;this.getSilkColor(e,n),(n["attr-x"]==null||n["attr-x"].value!=He)&&(n["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",Xe(e.position.x-i.x,void 0,void 0,this.unitConversion))}),(n["attr-y"]==null||n["attr-y"].value!=He)&&(n["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",Xe(e.position.y-i.y,void 0,void 0,this.unitConversion))}),(n["attr-rotation"]==null||n["attr-rotation"].value!=He)&&(n["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",uc(xe(e.rotation/Math.PI*180,3)))}),(n["attr-locked"]==null||n["attr-locked"].value!=He)&&(n["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(n["attr-layerid"]==null||n["attr-layerid"].value!=He)&&(n["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Zn.component()}),(n["attr-combination"]==null||n["attr-combination"].value!=He)&&(n["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",kt.getGroupNameByGroupId(e.getGroupID())||""),options:this.poolCache.combinationOptions,hasParent:e.getParent()!=null}),(n["attr-id"]==null||n["attr-id"].value!=He)&&(n["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${e.number}`),sourceId:e.globalIndex});let s=e.attrKeyValue,a=e.attrKeyText,l=ps.getItem(e.deviceUUID),c=Ji.getItem(e.footprintUUID),h=new Array;for(let u in s){if(u=="Standardization Check"||u=="IPC/DAC-2552")continue;let d={key:u,showKey:!1,value:s[u],showValue:!1,update:!1,recover:!1};if(l.checkKeyValue(u,s[u],c.uuid)?d.update=!1:d.update=!0,a[u]!=null&&(d.showKey=a[u].showKey,u!=="Name"&&(d.value=a[u].value),d.showValue=a[u].showValue,!d.update)){let p=e.layerId==2?Mg(a[u].layerId):a[u].layerId,m=Ji.getItem(e.footprintUUID),g=l.needSave(a[u].model,kA(e.position,e.rotation,a[u].position),a[u].rotation-e.rotation,p,m.uuid);d.update=g}d.key=="Footprint"&&(d.recover=!0),h.push(d)}return c!=null&&h.push({key:"FootprintId",showKey:!1,value:c.uuid,showValue:!1,update:!1,recover:!0}),this.unionAttribute=this.getUnionAttrs(this.unionAttribute,h,e.globalIndex),this.interAttribute=this.getIntersectionAttrs(this.interAttribute,h),(n["attr-array"]==null||n["attr-array"].value!=He)&&(n["attr-array"]={title:"Attribute",value:Array.from(this.interAttribute.values())}),(n["attr-reuse-block"]==null||n["attr-reuse-block"].value!=He)&&(n["attr-reuse-block"]={title:"Reuse Block",value:this.getCompareValue("attr-reuse-block",e.reuseBlock)}),(n["attr-group-id"]==null||n["attr-group-id"].value!=He)&&(n["attr-group-id"]={title:"Group ID",value:this.getCompareValue("attr-group-id",e.combinationID)}),(n["attr-channel-id"]==null||n["attr-channel-id"].value!=He)&&(n["attr-channel-id"]={title:"Channel ID",value:this.getCompareValue("attr-channel-id",e.channelID)}),this}updateAttrlist4OnlyComponents(){this.attrlist["attr-array"]={title:"Attribute",value:Array.from(this.unionAttribute.values())}}getExtra(){return{attrIdMap:this.attrIdMap}}hastrue(e,r){return e||r}getIntersectionAttrs(e,r){if(e==null){e=new Map;for(let i of r)e.set(i.key,i);return e}else{let i=new Set(e.keys());for(let n of r){let s=e.get(n.key);s!=null&&(n.value!=s.value&&(s.value=He),this.hastrue(n.showKey,s.showKey)&&(s.showKey=!0),this.hastrue(n.showValue,s.showValue)&&(s.showValue=!0),this.hastrue(n.update,s.update)&&(s.update=!0),this.hastrue(n.recover,s.recover)&&(s.recover=!0)),i.delete(n.key)}for(let n of i)e.delete(n);return e}}getUnionAttrs(e,r,i){e==null&&(e=new Map);for(let n of r){let s=e.get(n.key);this.attrIdMap[n.key]==null&&(this.attrIdMap[n.key]=[]),this.attrIdMap[n.key].push(i),s!=null?(n.value!=s.value&&(s.value=He),this.hastrue(n.showKey,s.showKey)&&(s.showKey=!0),this.hastrue(n.showValue,s.showValue)&&(s.showValue=!0),this.hastrue(n.update,s.update)&&(s.update=!0),this.hastrue(n.recover,s.recover)&&(s.recover=!0)):e.set(n.key,n)}return e}clearCache(){var e,r;super.clearCache(),(e=this.unionAttribute)==null||e.clear(),(r=this.interAttribute)==null||r.clear(),this.unionAttribute=null,this.interAttribute=null,this.attrIdMap={}}modifyBy(e,r,i){this.group=r,this.update(this.component,e,i)}update(e,r,i){let n=x.getInstance().origin,s=new ft;if(r["attr-layerid"]!=null){if(e.locked)return;e.layerId=parseInt(r["attr-layerid"])}if(r["attr-combination"]!=null){if(e.locked)return;this.modifyCombination(r["attr-combination"],e).forEach(l=>{this.group.addCommand(l)})}if(r["attr-x"]!=null){if(e.locked)return;let a=parseFloat(r["attr-x"])/10;x.getInstance().unit!="mil"&&(a=s.conversion(x.getInstance().unit,"mil",a)),e.position=new S(a+n.x,e.position.y)}if(r["attr-y"]!=null){if(e.locked)return;let a=parseFloat(r["attr-y"])/10;x.getInstance().unit!="mil"&&(a=s.conversion(x.getInstance().unit,"mil",a)),e.position=new S(e.position.x,a+n.y)}if(r["attr-rotation"]!=null){if(e.locked)return;let a=uc(parseFloat(r["attr-rotation"]));e.rotation=a/180*Math.PI}if(r["attr-locked"]!=null&&(e.locked=r["attr-locked"]=="yes"),r["attr-array"]!=null){let a=r["attr-array"];for(let l of a){let c=e.attrKeyValue[l.key];if(c!=null)l.update==null||l.update?this.updateAttr(l,e):new EV(this.group).restoreAttr(l.key,e);else{if(typeof c>"u"&&l.value===He)continue;if(i){let h="";l.value!=null&&(h=l.value.toString()),e.modifyATTRMap(l.key,h),this.createATTR(e,l.key,h)}}}e.refreshNameValue()}if(r["attr-silk-color"]!=null&&(r["attr-silk-color"]===""||r["attr-silk-color"]==="none"?e.silkColor=null:e.silkColor=ee.of3(r["attr-silk-color"])),r["attr-reuse-block"]!=null&&(e.reuseBlock=r["attr-reuse-block"].trim()),r["attr-group-id"]!=null){if(e.locked)return;e.combinationID=r["attr-group-id"].trim()}if(r["attr-channel-id"]!=null){if(e.locked)return;e.channelID=r["attr-channel-id"].trim()}}createATTR(e,r,i){let n=3;e.layerId==2&&(n=4);let s=ce.getDefaultFontSetting(),a=e.generateValidId(),l=ti.rebuild(a,n,r,!1,i,!1,s.defaultComponentFontTypeface,s.defaultComponentFontHeight,e.rotation,!1,S.ORIGIN,3,s.defaultComponentFontStrokeWidth,!1,0,!1,!0);return e.addAttribute(l),l}updateAttr(e,r){e.value!=null&&e.value!==He&&r.modifyATTRMap(e.key,e.value);let i=r.attrKeyText[e.key],n=!1,s=ps.getItem(r.deviceUUID);if(i==null){let a=r.attrKeyValue[e.key];(a==null||a===He)&&(a=""),i=this.createATTR(r,e.key,a),s.has(e.key)&&(n=!0)}e.showKey!=null&&(i.showKey=e.showKey),e.value!=null&&e.value!==He&&(i.value=e.value.toString()),e.showValue!=null&&(i.showValue=e.showValue),r.resetAttr(i),n&&s.addAttr(e.key,s.getAttrData(r.model,i.model))}};var A3=class{getHtmlData(){wc.getTemplate().checkMustAttr();let t={};t.category={title:"Category",value:wc.getTemplate().category},t.describe={title:"Describe",value:wc.getTemplate().describe};let e=new Array,r=NX(),i=new Set,n=new Set;for(let s in r){i.add(s);let a={key:s,showKey:!1,value:r[s].value,showValue:!1,update:!1,recover:!1};a.showKey=r[s].showKey,a.value=r[s].value,a.showValue=r[s].showValue,n.add(s),e.push(a)}for(let s in wc.getTemplate().deviceAttrsMap){if(i.has(s))continue;let a={key:s,showKey:!1,value:wc.getTemplate().deviceAttrsMap[s],showValue:!1,update:!1,recover:!1};n.add(s),e.push(a)}return n.has("3D Model")||e.push({key:"3D Model",showKey:!1,value:"",showValue:!1,update:!1,recover:!1}),t["attr-array"]={value:this.genD3ModelAttr(e)},t}getPadList(){let t=new Set(Ve.getSelects()),e=Kt.getAllItem(),r={};e.forEach(a=>{if(a!=rt.placingPad){let l=r[a.num];l==null&&(l=new Array,r[a.num]=l),l.push(a)}});let i=Object.keys(r);i!=null&&i.length>0&&i.sort((a,l)=>a.length<=l.length?a<l?-1:a>l?1:0:1);let n=new Array,s=x.getInstance().origin;for(let a of i){let l=r[a];for(let c of l){let h={};h.id=c.globalIndex,h.number=a,h.layerId=c.layerId,h.centerX=Xe(c.center.x-s.x),h.centerY=Xe(c.center.y-s.y),h.angle=xe(c.rotation/Math.PI*180,3),h.padLen=Xe(c.padLen),t.has(c)?h.select=!0:h.select=!1,n.push(h)}}return n}modifyBy(t,e){this.update(t)}getLayer(){return[{text:$e.getInstance().getLayer(1).name,value:1},{text:$e.getInstance().getLayer(2).name,value:2}]}update(t){console.warn(we.footprintIsConnectDevice);let e=!1,r=new ve("modify ATTR by footprint property");t.category!=null&&(e=!0,wc.getTemplate().category=t.category,A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())),t.describe!=null&&(e=!0,wc.getTemplate().describe=t.describe,A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()));let i=NX();if(t["attr-array"]!=null){let n=this.parseD3ModelAttr(t["attr-array"]||[]);for(let s of n){let a=s.key,l=i[s.key];if(typeof l>"u"&&(a=VBe(a),l=i[a]),l==null&&!s.showKey&&!s.showValue&&we.footprintIsConnectDevice,l!=null){if(s.update){let c=this.updateAttr(s,r);s.notHistory||(r.addCommand(Te.dispatch(c,"modify")),e=!0)}else{let c=this.restoreAttr(s,r);e=!0}l.visible()}else{let c=this.createATTR(s.key,s.value.toString());s.update&&(c.showKey=s.showKey,c.showValue=s.showValue,e=!0),this.resetText(c),s.notHistory||(r.addCommand(Te.dispatch(c,"add")),e=!0),c.visible()}}}e&&(A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),wc.getTemplate().hasModified=!0),je.executeCommand(r),A.publish("updateRtree","")}parseD3ModelAttr(t){let e=kx(t,"key","3D Model");if(e.index<=-1)return[...t];let r=e.data.value?JSON.parse(e.data.value):{},i=r.id,n=r.title,s=r.transf;return t.splice(e.index,1),t.push({...e.data,key:"3D Model",value:i,showKey:!1,showValue:!1}),t.push({...e.data,key:"3D Model Title",value:n}),t.push({...e.data,key:"3D Model Transform",value:s,showKey:!1,showValue:!1}),[...t]}genD3ModelAttr(t){let e=kx(t,"key","3D Model");e.index>=0&&t.splice(e.index,1);let r=kx(t,"key","3D Model Title");r.index>=0&&t.splice(r.index,1);let i=kx(t,"key","3D Model Transform");return i.index>=0&&t.splice(i.index,1),t.push({...e.data,key:"3D Model",value:JSON.stringify({id:e.data&&e.data.value||"",title:r.data&&r.data.value||"",transf:i.data&&i.data.value||""}),showKey:r.data?r.data.showKey:!1,showValue:r.data?r.data.showValue:!1}),t}createATTR(t,e){let r=ce.getDefaultFontSetting();return ti.addText(3,t,!1,e,!1,r.defaultComponentFontTypeface,r.defaultComponentFontHeight,0,!1,S.ORIGIN,3,r.defaultComponentFontStrokeWidth,!1,0,!1,!0)}updateAttr(t,e){let r=NX()[t.key];if(x.getInstance().doctype==bi.FOOTPRINT&&t.key=="Designator"&&!/\?$/gi.test(t.value)&&(t.value+="?"),r!=null){let i=typeof t.value<"u"?t.value.toString():r.value;this.resetText(r,!0),t.notHistory||e.addCommand(Te.dispatch(r,"modify")),typeof t.showKey<"u"&&(r.showKey=t.showKey),typeof t.showValue<"u"&&(r.showValue=t.showValue),r.value=i,t.key=="Footprint"&&(wc.getTemplate().footprintId=i,x.getInstance().name=i)}return r}resetText(t,e=!1){t&&t.key!=""&&(t.showValue||t.showKey||e)&&t.positionIsNull&&(t.origin!=3&&(t.origin=3),t.key!="Footprint"&&(t.position=BOt()),t.positionIsNull=!1)}restoreAttr(t,e){let r=NX()[t.key];return r!=null&&(t.notHistory||e.addCommand(Te.dispatch(r,"delete")),r.positionIsNull=!0,r.remove(),A.publish("delete",r),wc.getTemplate().removeAttribute(r)),r}};function NX(){let o=ti.getAllItem(),t={};for(let e of o)e.key!=""&&(t[e.key]=e);return t}function BOt(){let o=Lc(),t=new _e,e=yUe+.5,r=.001;o.forEach(n=>{n instanceof fr&&n.key!=null||t.ext1(n.buildBBox())});let i=wc.getTemplate();if(t.valid()){let n=t.build1(),s=n.LL(),a=n.LL().sub(n.LL()).normalize(),l=i.textOffset.length(),c=new S(s.x,0),h=NX(),u=c.add(i.textOffset),d=Object.keys(h).length;for(let p=1;p<d+1;p++){let m=new S(s.x,s.y-p*e),g=!0;for(let y in h){let b=h[y],P=m.add(a.mul(e-r)),T=m.sub(a.mul(e-r)),I=new _e;I.ext2(T).ext2(P);let C=I.build1();if(!b.positionIsNull&&C.isContains(b.position)){g=!1;break}}if(g){u=m;break}}return ne.greater(u.y,c.add(i.textOffset).y)&&(l-=e),i.textOffset=new S(i.textOffset.x,-l-e),u}return i.textOffset=i.textOffset.add(new S(0,-e)),i.textOffset}var Tse=class{constructor(){this.logger=new Gi(1);wc.getTemplate(),or.getInstance().setIgnorePartitionId(!0),A.messageBus.rpcService("openSaveFootprintDialog",()=>new Promise(t=>{let e={uuid:wc.getTemplate().UUID,name:wc.getTemplate().footprintId,category:wc.getTemplate().category,describe:wc.getTemplate().describe,source:x.getInstance().source||""};t(e)})),A.messageBus.rpcService("getFootprintMetaData",()=>new Promise(t=>{let e={hasModified:wc.getTemplate().hasModified,uuid:wc.getTemplate().UUID,name:wc.getTemplate().footprintId,category:wc.getTemplate().category,describe:wc.getTemplate().describe,source:x.getInstance().source||""};t(e)})),A.messageBus.subscribe("changeDeviceHasModify",t=>{wc.getTemplate().hasModified=t}),A.subscribe("updateDeviceAttr",t=>{wc.getTemplate().deviceAttrsMap=t,Object.keys(t).length==0?we.footprintIsConnectDevice=!1:we.footprintIsConnectDevice=!0;let e=ti.getAllItem();for(let r of e)r.refreshRender()}),A.subscribe("saveFootprintDataSuccess",t=>{t.id!==x.getInstance().tabId||x.getInstance().doctype!==4||(wc.getTemplate().UUID=t.id,wc.getTemplate().footprintId=t.name,x.getInstance().name=t.name,wc.getTemplate().category=t.category,wc.getTemplate().describe=t.describe,x.getInstance().isactive&&(A.publish("updateFrame",""),A.publish("flushAttrPlane","")))},$()),A.subscribe("change3DInfo",t=>{var l;if(x.getInstance().doctype!==4)return;let r=(l=new A3().getHtmlData()["attr-array"])==null?void 0:l.value,i=r==null?void 0:r.find(c=>c.key==="3D Model");if(!i)return;let{id:n,title:s,transf:a}=JSON.parse(i.value);if(n===`${t.uuid}|${t.path}`){let c={id:n,title:t.display_title||t.title,transf:a};A.publish("attrUpdate",{body:{FOOTPRINT:{"attr-array":[{key:"3D Model",update:!0,value:JSON.stringify(c)}]}},head:{action:"modifyFootprintDataByPanel",primitive:["FOOTPRINT"]}})}},$()),A.subscribe("pcb/partSourseStr2Canvas",async t=>{if(!(!x.getInstance().isactive||x.getInstance().doctype!==4))try{await xD.getInstance().partDxf(t),A.publish("toggle",{command:"importDxf"})}catch(e){this.logger.error2(e)}}),A.subscribe("refreshElementFilter",()=>{A.publish("refreshHighLigth",""),$t.refreshHidden()}),A.subscribe("placeOrigin",t=>{if(!(!x.getInstance().isactive||x.getInstance().doctype!==4)){if(t=="center"){let e=Kt.getAllItem(),r=new _e;if(e.forEach(i=>{r.ext1(i.buildBBox())}),e.length>0){let i=r.build1();_3(i.center())}}else if(t="pad1"){let e=Kt.getAllItem(),r={};e.forEach(n=>{r[n.num]=n});let i=Object.keys(r);if(i!=null&&i.length>0){i.sort();let s=r[i[0]].center;_3(s)}else if(e.length>0){let s=Object.values(r)[0].center;_3(s)}}A.publish("updateFrame","")}}),A.subscribe("deleteElementDialog",()=>{!x.getInstance().isactive||x.getInstance().doctype!==4||A.publish("openMainDialog",{cmd:4})}),A.subscribe("toggleElementFilter",this.toggleElementFilter.bind(this)),A.subscribe("insertImage",this.insertImage.bind(this)),A.subscribe("buttomCommand",this.buttomCommand.bind(this),$()),A.subscribe("panelSelectPad",this.select.bind(this)),A.subscribe("panelModifyPad",this.modify.bind(this)),A.subscribe("openRenumberPadsDialog",()=>{let t=Kt.getAllItem().length,e=0;Ve.getSelects().forEach(i=>{i instanceof Le&&e++}),A.publish("openMainDialog",{cmd:16,data:{selectPadsNum:e,allPadsNum:t}})}),A.messageBus.rpcService("pcb/decode",async t=>{if(t!==null){let e=x.getInstance(),r=new SV(e.compiler);return await r.parseSourceByCompiler(t),r.build()}return!1}),A.messageBus.rpcService("checkOrigin",()=>({originInGraphics:this.OriginCheck(),name:wc.getTemplate().footprintId})),A.messageBus.rpcService("isPadNumDuplicated",()=>{let t=!1,e={},r=Kt.getAllItem();i(e,r);function i(n,s){for(let a=0;a<s.length;a++){let l=s[a].num;l&&(n[l]&&n[l].length>0?(t=!0,n[l].push(s[a].globalIndex)):n[l]=[s[a].globalIndex])}}return{isPadNumDuplicated:t,padNums:e}}),A.messageBus.rpcService("pcb/generateFootprint",t=>{!x.getInstance().isactive||x.getInstance().doctype!=4||($0("pcb/generateFootprint",void 0,t),aUe(t))}),A.messageBus.rpcService("pcb/getFootprintOrigin",t=>{if(!(!x.getInstance().isactive||x.getInstance().doctype!=4))return lUe(t)}),A.messageBus.rpcService("pcb/generate3DModel",t=>A.globalMessageBus.rpcCall("/model/gnr",cUe(t))),A.messageBus.rpcService("footprint3DModel",()=>{var s;let t=null,e="",r="",n=(s=new A3().getHtmlData()["attr-array"])==null?void 0:s.value;if(n){let a=n.find(l=>l.key==="3D Model");if(a){let l=JSON.parse(a.value);t=l.id,e=l.transf,r=l.title}}return{d3modelItemId:t,d3modelItemTransform:e,d3modelItemTitle:r}})}OriginCheck(){let t=Lc(),e=new _e;return t.forEach(r=>{r instanceof fr&&r.key!=null||e.ext1(r.buildBBox())}),!(e.valid()&&!e.build1().isContains(x.getInstance().origin))}buttomCommand(t){if(!(!x.getInstance().isactive||x.getInstance().doctype!==4)&&t.action=="editPadShape"){let e=Ve.getSelects();e.length==1&&e[0]instanceof fn&&A.publish("tool","editPadShape")}}toggleElementFilter(t){if(!x.getInstance().isactive||x.getInstance().doctype!==4)return;let e=t.primitive;e.value=="all"?$t.setElement(0,e.isChecked,e.isVisible,e.group):$t.setElement(parseInt(e.value),e.isChecked,e.isVisible),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}insertImage(t){!x.getInstance().isactive||x.getInstance().doctype!==4||A.publish("openMainDialog",{cmd:14,data:{data:t}})}select(t){if(!x.getInstance().isactive||x.getInstance().doctype!==4)return;A.publish("clearSelect","");let e=new er,r=new Array,i=new _e;t.forEach(n=>{let s=e.getItem(n);s!=null&&(s.click(),r.push(s),i.ext1(s.buildBBox()))}),A.publish("adaptBBox_OnlyMove",i.build1()),t.length==1&&(mc.show(r[0].buildBBox().center()),mc.click(),clearTimeout(this.timer),this.timer=setTimeout(()=>{mc.remove(),A.publish("updateFrame","")},1e3)),A.publish("select",r),Pr.model=1,A.publish("updateFrame","")}modify(t){if(!x.getInstance().isactive||x.getInstance().doctype!==4)return;let e=t.id;if(e==null)return;let r=t.key,i=t.value,s=new er().getItem(e),a=x.getInstance().origin,l=new ft;if(s!=null&&s instanceof Le){let c=new ve("Panel modify pad"),h=!1;switch(c.addCommand(Te.dispatch(s,"modify")),r){case"layerId":{s.layerId=parseInt(i),h=!0;break}case"number":{s.num=i,h=!0;break}case"centerX":{i=l.conversion(x.getInstance().unit,"mil",parseFloat(i));let u=i/10+a.x,d=new S(u,s.center.y);s.center=d,h=!0;break}case"centerY":{i=l.conversion(x.getInstance().unit,"mil",parseFloat(i));let u=i/10+a.y,d=new S(s.center.x,u);s.center=d,h=!0;break}case"angle":{let u=parseFloat(i)/180*Math.PI;s.rotation=u,h=!0;break}case"padLen":{i=l.conversion(x.getInstance().unit,"mil",parseFloat(i))/10,s.padLen=i,h=!0;break}}h&&A.publish("clearDimension",""),je.executeCommand(c),A.publish("hasModifyPcbItem",s),A.publish("flushService",""),A.publish("flushSelectingInfo","")}}};var Ise=class{constructor(){A.subscribe("exportCoordinateFile",this.export.bind(this)),A.messageBus.rpcService("exportCoordinateFileRPC",t=>this.export.call(this,t.formData))}export(t){if(!x.getInstance().isactive||x.getInstance().doctype!==3)return;let e="exportPickAndPlaceFile-time";pn(e);let{fileName:r,fileType:i,unit:n,btmLayerCoordinateType:s,isContainPanelized:a,isContainPanelMarkCoord:l,attrHeads:c,mirrorBottomRotation:h,separator:u,exportNoUnit:d}=t,p=new Array,m=c.map(b=>b.title),g=Cr.getAllItem(),y=ai.getInstance().getDefaultPanelize();if(a&&y.success){let b=Ii.offset,P=ai.getInstance().getDefaultPanelize().row,T=ai.getInstance().getDefaultPanelize().column;for(let I=0;I<P;I++)for(let C=0;C<T;C++)g.forEach(E=>{let O=new S(0,0);b&&(O=new S(b.x*C,b.y*I));let _=this.getBody(E,c,n,s,O,h,d);p.push(_)})}else g.forEach(b=>{let P=new S(0,0),T=this.getBody(b,c,n,s,P,h,d);p.push(T)});if(l){let b=this.getPanelMarkBodyList(c,n,s,d);p.push(...b)}if(r||(r=new Date().toLocaleDateString()),Bi(e),t.isOnlyCreateData)return{...t,head:m,result:p,fileName:r,fileType:i,separator:u};A.publish("pcbcoordinateFileData",{...t,head:m,result:p,fileName:r,fileType:i,separator:u},$())}getBody(t,e,r,i,n,s,a){let l=this.getStaticValues(t,r,i,n,s,a),c=new Set(Object.keys(l)),h=JSON.parse(JSON.stringify(t.attrKeyValue||{})),u=[];for(let d of e){let p=d.key;c.has(p)?u.push(l[p]):p==="Name"?u.push(this.getNameContent(t)):p==="Comment"?u.push(this.getCommentContent(t)):u.push(h[p])}return u=u.map(d=>d!=null?d:""),u}getPanelMarkBodyList(t,e,r,i){return Ii.marks.map((n,s)=>{let a=[],l=this.getPanelMarkValues(s+1,n,e,r,i),c=new Set(Object.keys(l));for(let h of t){let u=h.key;c.has(u)?a.push(l[u]):a.push("")}return a})}getNameContent(t){let e=t.getFormulaName(),r=JSON.parse(JSON.stringify(t.attrKeyValue||{}));return e||(r.Value?r.Value:r["Manufacturer Part"]?r["Manufacturer Part"]:r.Device?r.Device:"")}getCommentContent(t){let e=t.getFormulaName(),r=JSON.parse(JSON.stringify(t.attrKeyValue||{}));return e||(r.Value?r.Value:r["Manufacturer Part"]?r["Manufacturer Part"]:r.Device?r.Device:"")}getStaticValues(t,e,r,i,n,s){let a=$e.getInstance().getLayer(t.layerId),l=x.getInstance().origin,c=t.getPads(),h=r==="mirrorCoordinateX"&&2==t.layerId?-1:1,u=r==="mirrorCoordinateY"&&2==t.layerId?-1:1,d;if(c.length>0){let D=new _e;c.forEach(F=>{D.ext2(F.center)}),d=D.build1().center().sub(l)}else d=t.position.sub(l);let p=this.toFixJoin((d.x+i.x)*h,e,s),m=this.toFixJoin((d.y+i.y)*u,e,s),g=t.position.sub(l),y=this.toFixJoin((g.x+i.x)*h,e,s),b=this.toFixJoin((g.y+i.y)*u,e,s),P;if(c.length>0){let D={};c.forEach(F=>D[F.num]=F);let w=D[1];if(w==null){let F=Object.keys(D);F.sort(),w=D[F[0]]}w&&(P=w.center.sub(l))}P||(P=t.position.sub(l));let T=this.toFixJoin((P.x+i.x)*h,e,s),I=this.toFixJoin((P.y+i.y)*u,e,s),C=a.name[0],E=xe(t.rotation/Math.PI*180,3);n&&Sx(t.layerId)&&(E=(180-E)%360),E=E>=0?E:360+E;let _=!c.some(D=>gr(D.layerId))?"Yes":"No",R=c.length;return{"Mid X":p,"Mid Y":m,"Ref X":y,"Ref Y":b,"Pad X":T,"Pad Y":I,Layer:C,Rotation:E,SMD:_,Pins:R}}getPanelMarkValues(t,e,r,i,n){let s=$e.getInstance().getLayer(e.layerId),a=x.getInstance().origin,l=i==="mirrorCoordinateX"&&2==s.layerId?-1:1,c=i==="mirrorCoordinateY"&&2==s.layerId?-1:1,h=e.center.sub(a),u=this.toFixJoin(h.x*l,r,n),d=this.toFixJoin(h.y*c,r,n),p=`Mark${t}`,m="Fiducial Marks",g=s.name[0];return{Designator:p,Device:m,Footprint:m,Name:m,"Mid X":u,"Mid Y":d,"Ref X":u,"Ref Y":d,"Pad X":u,"Pad Y":d,Pins:1,Layer:g,Rotation:0,SMD:"Yes"}}toFixJoin(t,e,r=!1){let i=x.getInstance().unit;return e==="mil"?i="mil":e==="mm"&&(i="mm"),Xe(t,null,i)+(r?"":i)}};var yd=class{constructor(t,e){this.value=t,this.isBold=e}toJSON(){return{value:this.value,isBold:this.isBold}}},i2=class{constructor(t,e){this.title=t,this.content=e}toJSON(){return{title:this.title.toJSON(),content:this.content.toJSON()}}},RD=class{constructor(){this.result=new Array;this.info={};this.result.push(this.getBoardInfo()),this.result.push(this.getPCBInfo()),this.result.push(this.getOtherInfo())}getBoardInfo(){let t=0,e=0,r=uu();if(r.length>0){let c=new _e;if(r.forEach(h=>{let u=h.getMathGraphics();c.ext1(u.bbox())}),c.valid()){let h=c.build1();t=h.width(),e=h.height()}}let i=`${Xe(t)}${x.getInstance().unit} x ${Xe(e)}${x.getInstance().unit}`,n=$e.getInstance().getAllItem(),s=0,a=0;n.forEach(c=>{c.config&&12!=c.layerId&&47!=c.layerId&&(s++,(gs(c.type)||Rh(c.type))&&a++)});let l=new Array;return l.push(new i2(new yd("Borard Size",!1),new yd(i,!1))),l.push(new i2(new yd("Layers",!1),new yd(`Total ${s}, Copper ${a}`,!1))),this.info.BoardSize=i,this.info.TotalLayers=s,this.info.TotalCoppers=a,l}getPCBInfo(){let t=new Array,e=new Set,r=new Set,i=Cr.getAllItem(),n=i.length,s=0,a=0;i.forEach(v=>{Io(v.layerId)?s++:a++,e.add(v.device),r.add(v.footprintId)});let l=Kt.getAllItem(),c=l.length,h=0,u=0,d=0,p=0;l.forEach(v=>{gr(v.layerId)?v.plated?d++:p++:Io(v.layerId)?h++:Sx(v.layerId)&&u++});let g=ze.getAllNets().length,b=zo.getAllNets().length;t.push(new i2(new yd("Devices",!1),new yd(`${e.size}`,!1))),t.push(new i2(new yd("Footprints",!1),new yd(`${r.size}`,!1))),t.push(new i2(new yd("Components",!1),new yd(`Total ${n},top ${s},Bottom ${a}`,!1))),t.push(new i2(new yd("Pads",!1),new yd(`Total ${c}, TopSurface ${h},BotSurface ${u},Plated Through-hole ${d}, Nono Plated Through-role ${p}`,!1))),t.push(new i2(new yd("Nets",!1),new yd(`Total ${g}, Unrouted ${b}`,!1))),this.info.Devices=e.size,this.info.Footprints=r.size,this.info.TotalComponents=n,this.info.TopComponents=s,this.info.BottomComponents=a,this.info.TotalPads=c,this.info.TopSurface=h,this.info.BotSurface=u,this.info.Plated=d,this.info.nonoPlated=p,this.info.netTotal=g,this.info.unrouted=b;let P=Kt.getAllTestPad(),T=0,I=0,C=P.length,E=0,O=0,_=[],R=new Set;return P.forEach(v=>{let{net:D,layerId:w}=v;D&&R.add(D),w==1?E++:w==2?O++:_.push(v)}),E+=_.length,O+=_.length,T=R.size,I=g?Math.round(T/g*1e4)/100:0,t.push(new i2(new yd("Test Point",!1),new yd(`All Nets ${g},Has Testpoint Nets ${T},Testpoint Coverage ${I}%`,!1))),t.push(new i2(new yd("",!1),new yd(`Total ${C},Top Side Testpoints ${E},Bottom Side Testpoints ${O}`,!1))),this.info.hasNet=T,this.info.testPointCoverage=I,this.info.total=C,this.info.topPoint=E,this.info.bottomPoint=O,t}getOtherInfo(){let t=pt.getAllItem(),e=Xt.getAllItem(),r=Zt.getAllItem(),i=0,n=0;t.forEach(p=>{p.type=="Slot Region"?i++:p.type=="Copper Region"&&n++}),e.forEach(p=>{p.type=="Slot Region"?i++:p.type=="Copper Region"&&n++}),r.forEach(p=>{p.type=="Slot Region"?i++:p.type=="Copper Region"&&n++});let s=Hr.getAllItem(),a=s.length,l=0,c=0;s.forEach(p=>{p.type==1?c++:l++});let h=pr.getAllItem(),u=0;h.forEach(p=>{u+=p.length});let d=new Array;return d.push(new i2(new yd("Slot Region",!1),new yd(`${i}`,!1))),d.push(new i2(new yd("Vias",!1),new yd(`Total ${a}, Through Vias ${l}, Blind Or Buried Vais ${c}`,!1))),d.push(new i2(new yd("CopperAreas",!1),new yd(`${n}`,!1))),d.push(new i2(new yd("Length of Tracks",!1),new yd(`${Xe(u)}${x.getInstance().unit}`,!1))),this.info.slot=i,this.info.totalVias=a,this.info.ThroughVias=l,this.info.blindTotal=c,this.info.copper=n,this.info.TrackLength=`${Xe(u)}${x.getInstance().unit}`,d}toJSON(){return{lists:this.result,info:this.info}}};var S5=class S5{constructor(){this.outlineWarn=null;this.slotWarn=null}static getInstance(){return S5.dialog==null&&(S5.dialog=new S5),S5.dialog}addOutlineWarn(t){this.outlineWarn==null&&(this.outlineWarn=t)}addSlotWarn(t){this.slotWarn==null&&(this.slotWarn=t)}open(){this.outlineWarn!=null&&(A.publish("openMsgbox",this.outlineWarn),this.outlineWarn=null),this.slotWarn!=null&&(A.publish("openMsgbox",this.slotWarn),this.slotWarn=null)}};S5.dialog=null;var Cse=S5;var Sse=class{constructor(t){this.shape=new Array;this.info=t,this.color=this.getColor(t.num),this.getShape()}getColor(t){let e=ee.WHITE;switch(t){case 0:e=ee.WHITE;break;case 1:e=ee.BLACK;break;case 2:e=ee.RED;break;case 3:e=ee.GREEN;break;case 4:e=ee.BLUE;break;case 5:e=ee.Gray;break}return e}getShape(){if(this.info.type=="Line"){let t=this.info.path,e=new hr(1002,new S(t[0],t[1]),new S(t[2],t[3]),!0,this.color);this.shape.push(e)}else if(this.info.type=="Arc"){let t=this.info.path,e=ns.build(1002,new S(t[0],t[1]),t[2],t[3],t[4],t[5],this.color);this.shape.push(e)}else(this.info.path[0]instanceof Array?vu(this.info.path):[Yb(this.info.path)]).forEach(e=>this.printPolygline(e,this.color))}printPolygline(t,e){let r=q8e(t);for(let i=0,n=r.length;i<n-1;i++){let s=r[i],a=r[i+1],l=new hr(1002,s,a,!0,e);this.shape.push(l)}}hidden(){for(let t of this.shape)t.hidden()}show(){for(let t of this.shape)t.visible()}};var Ese=class extends Kj{constructor(){super();this.shapes=new Array;this.getVias(this.shapes),this.getTracks(this.shapes),this.getTexts(this.shapes),this.getImages(this.shapes),this.getPads(this.shapes),this.getProfiles(this.shapes),this.getCopper(this.shapes),this.getPlane(this.shapes)}getPlane(e){Qn.getAllItem().forEach(i=>{let n={PlaneResult:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),outlines:i.copperPath}};e.push(n)})}getCopper(e){Ei.getAllItem().forEach(i=>{let n={PcbCopper:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),method:this.getMethod4Copper(i),outlines:i.copperPath}};e.push(n)})}getLayer(e){let r=be.getLayer(e),i=0;switch(r.type){case"SIGNAL":case"PLANE":i=t2(e);break;case"MECHANICAL":case"PLANE":i=1;break;default:i=0;break}return new One(r.type,i)}getVias(e){Hr.getAllItem().forEach(i=>{let n=i.getParent()!=null;if(i.type==1){let s={PcbBlindVia:{id:i.globalIndex,net:i.net,center:i.center,holeDiameter:i.holeRadius*2,startLayer:this.getLayer(i.startLayer),startLayerPad:i.radius*2,innerPad:i.radius*2,endLayer:this.getLayer(i.endLayer),endLayerPad:i.radius*2,mask:!1,locked:i.locked||n,unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(s)}else{let s={PcbVia:{id:i.globalIndex,net:i.net,center:i.center,holeDiameter:i.holeRadius*2,topPad:i.radius*2,innerPad:i.radius*2,botPad:i.radius*2,mask:!1,locked:i.locked||n,unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(s)}})}getTracks(e){pr.getAllItem().forEach(i=>{if(i instanceof Si){let n=q.build2(i.center,i.startAngle/Math.PI*180,i.endAngle/Math.PI*180,i.radius,i.radius,i.sweep),s={PcbarcTrack:{net:i.net,layer:this.getLayer(i.layerId),arc:n,width:i.width,id:i.globalIndex,locked:i.locked}};e.push(s)}else{let n={PcbTrack:{net:i.net,layer:this.getLayer(i.layerId),start:i.start,end:i.end,width:i.width,id:i.globalIndex,locked:i.locked}};e.push(n)}})}checkLayer(e){let r=be.getLayer(e);return!!(gr(e)||r.isSignalLayer()||r.isPlaneLayer()||e==11)}getTexts(e){ti.getAllItem().forEach(i=>{let n=i.model.box;if(!this.checkLayer(i.layerId)||!n||n.height==0||n.width==0)return;let s={PcbboxShape:{layer:this.getLayer(i.layerId),leftLow:n.leftLow,leftUp:n.leftUp,rightLow:n.rightLow,rightUp:n.rightUp,id:i.globalIndex}};e.push(s)})}getImages(e){Ln.getAllItem().forEach(i=>{if(!this.checkLayer(i.layerId))return;let n=i.model.box,s={PcbboxShape:{layer:this.getLayer(i.layerId),leftLow:n.leftLow,leftUp:n.leftUp,rightLow:n.rightLow,rightUp:n.rightUp,id:i.globalIndex}};e.push(s)})}getPads(e){Kt.getAllItem().forEach(i=>{if(i instanceof Ri){if(gr(i.layerId)){let n=this.getShape(i.topType,i.topWidth,i.topHeight,i.topRatio,null),s=this.getShape(i.innerType,i.innerWidth,i.innerHeight,i.innerRatio,null),a=this.getShape(i.bottomType,i.bottomWidth,i.bottomHeight,i.bottomRatio,null),l=this.getHoleShape(i),c={PcbPad:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),center:i.center,rotation:i.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.getLayer(i.layerId),top:n,inner:s,bot:a}},hole:l,pasteMaskEx:i.pasteExpansion,topSolderMaskEx:i.topSolderExpansion,bottomSolderMaskEx:i.bottomSolderExpansion,designator:"",plated:i.plated,padRule:i.toPadRuleJson(),unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(c)}else if(Io(i.layerId)){let n=this.getShape(i.topType,i.topWidth,i.topHeight,i.topRatio,null),s={PadHole:{type:0,size:0,length:0,rotation:i.rotation/Math.PI*180,offsetX:0,offsetY:0}},a={PcbPad:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),center:i.center,rotation:i.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.getLayer(i.layerId),top:n,inner:null,bot:null}},hole:s,pasteMaskEx:i.pasteExpansion,topSolderMaskEx:i.topSolderExpansion,bottomSolderMaskEx:i.bottomSolderExpansion,designator:"",plated:i.plated,padRule:i.toPadRuleJson(),unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(a)}else if(2==i.layerId){let n=this.getShape(i.bottomType,i.bottomWidth,i.bottomHeight,i.bottomRatio,null),s={PadHole:{type:0,size:0,length:0,rotation:i.rotation/Math.PI*180,offsetX:0,offsetY:0}},a={PcbPad:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),center:i.center,rotation:i.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.getLayer(i.layerId),top:null,inner:null,bot:n}},hole:s,pasteMaskEx:i.pasteExpansion,topSolderMaskEx:i.topSolderExpansion,bottomSolderMaskEx:i.bottomSolderExpansion,designator:"",plated:i.plated,padRule:i.toPadRuleJson(),unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(a)}}else if(i instanceof fn){if(gr(i.layerId)){let n=this.getShape("POLYGON",0,0,0,i.primitives),s=this.getShape("POLYGON",0,0,0,i.primitives),a=this.getShape("POLYGON",0,0,0,i.primitives),l=this.getHoleShape(i),c={PcbPad:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),center:i.center,rotation:i.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.getLayer(i.layerId),top:n,inner:s,bot:a}},hole:l,pasteMaskEx:i.pasteExpansion,topSolderMaskEx:i.topSolderExpansion,bottomSolderMaskEx:i.bottomSolderExpansion,designator:"",plated:i.plated,padRule:i.toPadRuleJson(),unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(c)}else if(Io(i.layerId)){let n=this.getShape("POLYGON",0,0,0,i.primitives),s={PadHole:{type:0,size:0,length:0,rotation:i.rotation/Math.PI*180,offsetX:0,offsetY:0}},a={PcbPad:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),center:i.center,rotation:i.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.getLayer(i.layerId),top:n,inner:null,bot:null}},hole:s,pasteMaskEx:i.pasteExpansion,topSolderMaskEx:i.topSolderExpansion,bottomSolderMaskEx:i.bottomSolderExpansion,designator:"",plated:i.plated,padRule:i.toPadRuleJson(),unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(a)}else if(2==i.layerId){let n=this.getShape("POLYGON",0,0,0,i.primitives),s={PadHole:{type:0,size:0,length:0,rotation:i.rotation/Math.PI*180,offsetX:0,offsetY:0}},a={PcbPad:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),center:i.center,rotation:i.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.getLayer(i.layerId),top:null,inner:null,bot:n}},hole:s,pasteMaskEx:i.pasteExpansion,topSolderMaskEx:i.topSolderExpansion,bottomSolderMaskEx:i.bottomSolderExpansion,designator:"",plated:i.plated,padRule:i.toPadRuleJson(),unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(a)}}})}getUnuseLayers(e){let r=new Array;for(let i of e){let n=this.getLayer(i);r.push(n)}return r}getProfiles(e){Zt.getAllItem().forEach(s=>{if(!this.checkLayer(s.layerId))return;let a=s.getComponent(),l=this.getProfileShape(s.globalIndex,s.type,s.net,s.layerId,0,s.getMathGraphics(s.layerId,0),s.strokeWidth,a,a);e.push(l)}),Xt.getAllItem().forEach(s=>{if(!this.checkLayer(s.layerId))return;let a=s.getComponent(),l=this.getProfileShape(s.globalIndex,s.type,s.net,s.layerId,1,s.getMathGraphics(s.layerId,0),s.strokeWidth,a,a);e.push(l)}),pt.getAllItem().forEach(s=>{if(!this.checkLayer(s.layerId))return;let a=s.getComponent(),l=this.getProfileShape(s.globalIndex,s.type,s.net,s.layerId,2,s.getMathGraphics(s.layerId,0),s.strokeWidth,a,a,a);e.push(l)})}getOutline(){let e=new Array;return Zt.getAllItem().forEach(s=>{s.type=="Board Outline"&&e.push(s)}),Xt.getAllItem().forEach(s=>{s.type=="Board Outline"&&e.push(s)}),pt.getAllItem().forEach(s=>{s.type=="Board Outline"&&e.push(s)}),e}getPlaneZone(e,r){let i=new Array;e?i=be.getAllPlaneLayer():r.forEach(s=>{let a=be.getLayer(s);i.push(a)});let n=this.getOutline();i.forEach(s=>{let a=Qn.layerMapSet[s.layerID];a!=null&&a.size>0?a.forEach(l=>{let c=te.getInstance().getInnerPlaneByNet(l.net),h=l.getOutline();xr(h,(d,p)=>p.bbox().area()-d.bbox().area(),0,h.length);let u={PcbPlaneZone:{net:l.net,layer:this.getLayer(l.layerId),thermal:c.getMultiConnectMode(l.layerId)!=1,outline:Lh(h[0]),coppered:[]}};this.shapes.push(u)}):n.forEach(l=>{let c="GND",h=te.getInstance().getInnerPlaneByNet(c),u={PcbPlaneZone:{net:c,layer:this.getLayer(s.layerID),thermal:h.getMultiConnectMode(s.layerID)!=1,outline:Lh(l.getMathGraphics(12,0)),coppered:[]}};this.shapes.push(u)})})}getShape(e,r,i,n,s){let a;switch(e){case"ELLIPSE":a={PadShape:{type:0,xSize:r,ySize:i,cornerRadius:n*100,outline:null}};break;case"OVAL":a={PadShape:{type:3,xSize:r,ySize:i,cornerRadius:n*100,outline:null}};break;case"RECT":a={PadShape:{type:1,xSize:r,ySize:i,cornerRadius:n*100,outline:null}};break;case"POLYGON":a={PadShape:{type:4,xSize:r,ySize:i,cornerRadius:0,outline:ef([fe.build2(s)])}}}return a}getHoleShape(e){return e.holeShape=="ROUND"?{PadHole:{type:0,size:e.holeRadius*2,length:e.holeLength,rotation:e.holeRotation/Math.PI*180,offsetX:e.holeOffset.x,offsetY:e.holeOffset.y}}:{PadHole:{type:2,size:e.holeRadius*2,length:e.holeLength,rotation:e.holeRotation/Math.PI*180,offsetX:e.holeOffset.x,offsetY:e.holeOffset.y}}}getProfileShape(e,r,i,n,s,a,l,c,h,u){switch(r){case"Line":return n==11?{PcbBoardOutline:{id:e,type:s,outlines:Lh(a)}}:{PcbLine:{id:e,net:i,layer:this.getLayer(n),type:s,width:l,outlines:Lh(a)}};case"Copper Region":let d=te.getInstance().getCopperPlaneByNet(i),p=te.getInstance().getRegion(e);p!=null?d=te.getInstance().getCopperPlane(p.copperPlane):d==null&&(d=te.getInstance().getDefaultCopperPlane());let m=gn.getOrder(e);return{PcbPolygonPour:{id:e,net:i,layer:this.getLayer(n),method:this.getMethod(c),thermal:d.getSingleConnectMode(n)!=1,keepIsland:c.keepIsland,pourIndex:m,needCopper:!0,outlines:Lh(a),coppered:[],name:c.name}};case"Prohibited Region":return{PcbProhibit:{id:e,layer:this.getLayer(n),type:s,copper:h.copper,track:h.track,device:h.device,plane:h.planzone,region:h.fill,outlines:Lh(a)}};case"Fill Region":return{PcbRegion:{id:e,net:i,layer:this.getLayer(n),type:s,outlines:Lh(a)}};case"Board Outline":return{PcbBoardOutline:{id:e,type:s,outlines:Lh(a)}};case"Slot Region":return{PcbSlot:{id:e,type:s,outlines:Lh(a)}};case"TearDrop":return{PcbTearDrop:{id:e,net:i,layer:this.getLayer(n),outline:Lh(a),connect:u.connects}}}}getMethod(e){switch(e.style){case"90grid":return{HatchedPourMethod:{gridWidth:e.gridLineWidth,gridClearance:e.clearance,angle:90}};case"45grid":return{HatchedPourMethod:{gridWidth:e.gridLineWidth,gridClearance:e.clearance,angle:45}};case"solid":return e.optimization?{SolidPourMethod:{neckThickness:.8}}:{SolidPourMethod:{neckThickness:0}};default:return{SolidPourMethod:{neckThickness:0}}}}getMethod4Copper(e){switch(e.style){case"90grid":return{HatchedPourMethod:{gridWidth:e.gridLineWidth,gridClearance:e.clearance,angle:90}};case"45grid":return{HatchedPourMethod:{gridWidth:e.gridLineWidth,gridClearance:e.clearance,angle:45}};case"solid":return e.optimization?{SolidPourMethod:{neckThickness:.8}}:{SolidPourMethod:{neckThickness:0}};default:return{SolidPourMethod:{neckThickness:0}}}}};var v3=Qa.getInstance(),kX=sn.getInstance(),K1=class{constructor(t=!1){this.checkSameNet=t}isSameComponentChild(t,e){let r=t.getParent(),i=e.getParent();return r instanceof vi&&i instanceof vi&&r.globalIndex===i.globalIndex}getClearance(t,e,r=3){let i=By(t.layerId,e.layerId);if(i!==12||r==2)return kX.ruleHelper.getShape2Clearance(t,e,void 0,r,i).clearance;{let n=h=>h.getItemMaxClearance(s.shapeType,[a.shapeType]),s=kX.ruleHelper.getRuleItem(t,r==0),a=kX.ruleHelper.getRuleItem(e,r==1),l=kX.ruleHelper.generateConstraints("safe",s,a,void 0,void 0,n);return kX.ruleHelper.getSafeRuleInfos(s,a,l,void 0,n).clearance}}commonCheck(t,e,r){if(r==3||e===t||this.isSameComponentChild(t,e))return!1;let i=(s,a)=>{if(s instanceof vi)return a instanceof Je,!0};if(i(t,e)||i(e,t)||!this.dispatchCheck(t,e,r))return!1;if((oi.isBoardOutline(t)||oi.isBoardOutline(e))&&t.bbox.intersection1(e.bbox))return!0;let n=this.getClearance(t,e,r);return!(n<0||!t.bbox.extendOfSize(n).intersection1(e.bbox))}isOpenDRCCustomCheck(){return v3.isOpenDRCCustomCheck}checkHole(t,e,r){if(!v3.isOpenDRCCustomCheck||!this.commonCheck(t,e,r))return!1;if(r==2&&v3.isCheck(v3.distanceHole.hole))return!0;if(r==0&&oi.isBoardOutline(e)){if(v3.isCheck(v3.distanceHole.outline))return!0}else if(r==1&&oi.isBoardOutline(t)){if(v3.isCheck(v3.distanceHole.outline))return!0}else if(r!==2&&v3.isCheckHoleDistance(t,e,r))return!0;return!1}check(t,e,r){return e===t?!1:r?!0:!(!v3.isCheckDistance(t,e)||!this.dispatchCheck(t,e))}dispatchCheck(t,e,r){if(t instanceof vi||e instanceof vi)return e instanceof vi&&([e,t]=[t,e]),this.checkComponentXXX(t,e);if(oi.isProhibit(t)||oi.isProhibit(e))return oi.isProhibit(e)&&([e,t]=[t,e]),this.checkProhibitXXX(t,e);if(oi.isBoardOutline(t)||oi.isBoardOutline(e))return oi.isBoardOutline(e)&&([e,t]=[t,e]),this.checkOutlineXXX(t,e);let i=oi.isBridgingCopper(t),n=oi.isBridgingCopper(e);return i||n?(n&&([e,t]=[t,e]),this.checkBridgingCopperXXX(t,e,i==n)):oi.isSingleLayerShape(t)&&oi.isSingleLayerShape(e)?this.checkSingleSingle(t,e):!oi.isSingleLayerShape(t)&&!oi.isSingleLayerShape(e)?this.checkMultiMulti(t,e,r):(oi.isSingleLayerShape(e)&&([e,t]=[t,e]),this.checkSingleMulti(t,e))}checkComponentXXX(t,e){if(e instanceof vi)return!0;if(oi.isProhibit(e)&&e.getParent()!==t)return this.checkProhibitXXX(e,t);if(e instanceof Je){let r=oi.isSmdComponent(t),i=e.getParent();return i instanceof vi?r&&Mg(i.layerId)===t.layerId:r&&gr(e.layerId)}return!1}checkOutlineXXX(t,e){return!this.isPlaneSingle(e)}checkBridgingCopperXXX(t,e,r){var s,a;let i=((s=t.component)==null?void 0:s.networkList)||[],n=r?((a=e.component)==null?void 0:a.networkList)||[]:oi.hasNet(e)?e.net:null;return r?i.length===0&&n.length===0?!1:i.length===1&&n.length===1?i[0]!==n[0]:!0:n==null?!0:i.length<=1?i.length===0?n!=="":i[0]!==n:!oi.hasIntersectionNet(i,n,this.checkSameNet)}checkProhibitXXX(t,e){let r=t.component;return!!((t.layerId===e.layerId||t.layerId===12)&&(r.track&&e instanceof yt||r.fill&&oi.isFill(e)||r.device&&e instanceof vi||r.copper&&e instanceof Pn||r.planzone&&e instanceof Cn))}checkSingleSingle(t,e){return this.isPlaneSingle(t)||this.isPlaneSingle(e)||t.layerId!==e.layerId?!1:this.checkSameNet?!0:!this.isSameNet(t,e)}checkSingleMulti(t,e){return this.isPlaneSingle(t)?!1:this.checkSameNet?!0:!this.isSameNet(t,e)}checkMultiMulti(t,e,r){return t instanceof It&&e instanceof It&&t.type==1&&e.type==1&&!t.isContains(e.startLayer)&&!t.isContains(e.endLayer)&&!e.isContains(t.startLayer)&&!e.isContains(t.endLayer)?!1:r!==void 0&&r==2||this.checkSameNet?!0:!this.isSameNet(t,e)}isSameNet(t,e){return oi.hasNet(t)&&oi.hasNet(e)?t.net===e.net:!1}isPlaneSingle(t){return t instanceof dc?!1:oi.isUnuseLayer(t.layerId)||oi.isSingleLayerShape(t)&&oi.isPlaneLayer(t.layerId)}};var Ose=class{constructor(t){this.tool=new er;this.count=0;this.errs=new Set;this.filter=new K1;let e=t.copper,r=t.plane,i=t.safe;e.forEach(n=>{this.parseCopper(n.id1,n.id2,n.pl1,n.pl2,n.relation,n.distance,n.line,n.pt1,n.pt2)}),r.forEach(n=>{this.parsePlane(n.id1,n.id2,n.pl1,n.pl2,n.relation,n.distance,n.line,n.pt1,n.pt2)}),i.forEach(n=>{this.parseSafe(n.id1,n.id2,n.pl1,n.pl2,n.relation,n.distance,n.line,n.pt1,n.pt2)})}parseSafe(t,e,r,i,n,s,a,l,c){let h=this.tool.getItem(t),u=this.tool.getItem(e),d=h.model,p=u.model;if(x3.isCheck(x3.diff.minGap)&&this.isCheckDiffPair(h,u,s,a)||!x3.isCheckDistance(h.model,u.model)||!(d instanceof ki&&p instanceof ki))return;let g=_a(d),y=_a(p),b=te.getInstance().getSafeRule(g,y),P=xe(b.getClearance(g.shapeType,y.shapeType),2);if(!ne.eq(P,0)&&(this.isProhibit(h)||this.isProhibit(u)?P=0:s=xe(s,2),s==0||s<P)){let I=Yb(a).primitives[0],C=I.start().add(I.end()).mul(.5);this.createError(h,u,C,s,P,b.name)}}isCheckDiffPair(t,e,r,i){let n=t.model,s=e.model;if(!(n instanceof ki&&s instanceof ki))return;let a=_a(n),l=_a(s);return te.getInstance().getRule4Order(a,l,"BetweenNetRule",0).length>0,!1}parseCopper(t,e,r,i,n,s,a,l,c){}parsePlane(t,e,r,i,n,s,a,l,c){}isProhibit(t){return t instanceof Ye&&t.type=="Prohibited Region"}createError(t,e,r,i,n,s){this.count++,i=i>0?i:0,Eo.getClearanceError(t.globalIndex,e.globalIndex)}createDiffError(t,e,r,i,n,s){this.count++,i=i>0?i:0,Eo.getDiffPairGapError(t.globalIndex,e.globalIndex)}};var OV=class extends hF{parse(t,e){if(e==null||e=="")return;let r=e.split(`
`);JSON.parse(r.find(n=>{if(JSON.parse(n)[0]==="DOCTYPE")return!0}))[2]>"1.0"?this.addCopperResults(r):this.addCopperResult(t,r)}addCopperResults(t){let e={};for(let r of t){let i=r?JSON.parse(r):[];if(i[0]=="POURED"){let n=i[2];e[n]||(e[n]=[]),i.splice(2,1);let s=JSON.stringify(i);e[n].push(s)}}for(let r in e)this.addCopperResult(r,e[r])}};var FOt=1024*1024*10,AV=class extends OV{getAllPourResult(){let t="getPourResultData-time";pn(t);let e=[],r=[];return pt.getAllItem().forEach(i=>r.push(i)),Xt.getAllItem().forEach(i=>r.push(i)),Zt.getAllItem().forEach(i=>r.push(i)),this.addResult(r,e),Bi(t),e}getCombinationPourResult(t){let e=[],r=[];for(let i of t)i instanceof Ye&&r.push(i);return this.addResult(r,e),e}addResult(t,e){let r='["DOCTYPE", "POURED", "1.1"]';t.forEach(i=>{if(i.type=="Copper Region"){let n=this.getPourResult(i);if(n!=null&&n.length>0&&(r&&(r+=`
`),r+=n,r.length>FOt))return e.push(r),r='["DOCTYPE", "POURED", "1.1"]',!0}}),r.length>0&&e.push(r)}getPourResult(t){let e=t.getComponent(),r="";if(e!=null&&e instanceof Vn&&t.hasCopperRes()){let i=t.getCopperResult(),n=i.size,s=0;for(let a of i)r+=JSON.stringify(this.save(a,t.globalIndex)),s!=n&&(r+=`
`),s++}return r}save(t,e){let r=new Array;return r.push("POURED"),r.push(t.globalIndex),r.push(e),t.style=="90grid"||t.style=="45grid"?(r.push(t.gridLineWidth),r.push(!1)):(r.push(0),r.push(!0)),r.push(t.copperPath),r}addCopperResult(t,e){let r=this.getProfile(t);if(r==null||r.type!="Copper Region")return;let n=r.getComponent();if(n instanceof Vn){let s=n.style,a=n.clearance,l=n.gridLineWidth,c=n.optimization,h=n.optimizationValue;e.forEach(u=>{let d=JSON.parse(u);if(d[0]=="POURED"){let p=s;if(p=="solid"&&d[2]!=0&&(p="90grid"),(p=="90grid"||p=="45grid")&&d[2]!=0&&(l=d[2]),n.copperResult.push(d[4]),Ei.getItem(d[1])!=null)return;let m=Ei.rebuildCopper(d[1],r.layerId,r.net,p,l,a,c,d[4],h);m.fill(),r.addCopperResult(m),r.model.addCopper(m.globalIndex),m.setParent(r),A.publish("hasModifyPcbItem",m)}})}}getProfile(t){let e=pt.getItem(t);if(e!=null)return e;let r=Xt.getItem(t);if(r!=null)return r;let i=Zt.getItem(t);return i!=null?i:null}};function bUe(){let o=pt.getAllItem(),t=Xt.getAllItem(),e=Zt.getAllItem(),r=0,i=0,n=0;function s(a){switch(a){case"3D Shell - Top Slot Region":case"3D Shell - Side Slot Region":{r++;break}case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":{i++;break}case"3D Shell - Screw Pillar":{n++;break}}}for(let a of o)s(a.type);for(let a of t)s(a.type);for(let a of e)s(a.type);return{d3SlotNum:r,d3EntityNum:i,d3DcrewNum:n}}function DD(o,t,e){if(o&&o.type=="Fill Region"&&e){let r=o.getComponent();if(!(r instanceof ln)||!r.isBridgingCopper)return;if(r.networkList.includes(t)){A.windowBridge.publish("ui/toastMsg",{type:"error",msg:{value:"{net} net has been selected, please select another bridge net",options:{net:t}}},$());return}r.networkList[e]?r.networkList[e]=t:r.networkList.push(t),A.publish("hasModifyPcbItem",o)}}function m_(o){if(o.length===0)return!1;let t=[];for(let r of o){if(!(r instanceof Ye)||r.type!=="Fill Region"||!r.getComponent().isBridgingCopper)return!1;t.push(r)}let e=t[0].getComponent().networkList;for(let r of t){let i=r.getComponent();if(!Tte(e,i.networkList,!0))return!1}return!0}var yb=class o{constructor(t,e,r,i){this.pts1=t,this.pts2=e,this.plgrp1=r,this.plgrp2=i}static build2(t,e){let r=new Array,i=new Array;for(let a of t.primitives)r.push(a);for(let a of e.primitives)i.push(a);let n=new Gt([t]),s=new Gt([e]);return new o(r,i,n,s)}static build3(t,e){let r=new Array,i=new Array;t.forEach(a=>{for(let l of a.primitives)r.push(l)}),e.forEach(a=>{for(let l of a.primitives)i.push(l)});let n=new Gt(t),s=new Gt(e);return new o(r,i,n,s)}intersection(){return zE.isIntersect(this.plgrp1,this.plgrp2)}inInner(){if(zE.isIntersect(this.plgrp1,this.plgrp2)&&(this.isClose(this.pts1)||this.isClose(this.pts2))){for(let e of this.pts1)for(let r of this.pts2)if(Tt(e,r)>0)return!1;return!0}else return!1}isClose(t){return!!(t.length>0&&t[0].start().equals1(t[t.length-1].end()))}hasInterEdge(){for(let t of this.pts1)for(let e of this.pts2)if(Tt(t,e)>0)return!0;return!1}};var BX=nd(Lb());var VOt=typeof window>"u"||window["META-PANELIZE-ENV"]?!1:/\bpcbBoolDebug\b/.test($().location.search),_9e;VOt&&(typeof window<"u"?_9e=window._MSG_BUS_=window._MSG_BUS_||new BX.MessageBus:_9e=new BX.WorkerMessageBridge(new BX.MessageBus,self));var Kc=class{getUnionForSingle(t,e=[]){let r=t.map(i=>new Gt(i));return r.length<=1?r:this.runBoolean(Gl.UNION,t,e)}getUnion(t,e=0){return t.length<=0?[new Gt(t)]:this.normalizeData(t,e).toPolylineGroups()}getSubtraction(t,e,r=[0,0]){return this.runBoolean(Gl.DIFF,[t,e],r)}getSubtraction2(t,e,r=[[],[]]){return this.runBoolean2(Gl.DIFF,t,e,r)}getSubtractionForSingle(t,e=[]){return this.runBoolean(Gl.DIFF,t,e)}getIntersection(t,e,r=[0,0]){return this.runBoolean(Gl.INTERSECT,[t,e],r)}getIntersection2(t,e,r=[[],[]]){return this.runBoolean2(Gl.INTERSECT,t,e,r)}getIntersectionForSingle(t,e=[]){return this.runBoolean(Gl.INTERSECT,t,e)}getMutuallyExclusive(t,e,r=[0,0]){return this.runBoolean(Gl.XOR,[t,e],r)}getMutuallyExclusive2(t,e,r=[[],[]]){return this.runBoolean2(Gl.XOR,t,e,r)}getMutuallyExclusiveForSingle(t,e=[]){return this.runBoolean(Gl.XOR,t,e)}run(t){let e=EO(),r=HP(t,_9e);return I2.runBoolean+=pI(e),r}runBoolean(t,e,r){let i=[t];return e.forEach((n,s)=>{var l;let a=this.normalizeData(n,(l=r[s])!=null?l:0);a&&i.push(a)}),this.run(i).toPolylineGroups()}runBoolean2(t,e,r,i){let n=[Gl.UNION],s=[Gl.UNION];e.forEach((l,c)=>{var u;let h=this.normalizeData(l,(u=i[0][c])!=null?u:0);h&&n.push(h)}),r.forEach((l,c)=>{var u;let h=this.normalizeData(l,(u=i[1][c])!=null?u:0);h&&s.push(h)});let a=[t,n,s];return this.run(a).toPolylineGroups()}normalizeData(t,e){if(!t.length)return null;if(e===2){let r=[Qf(t[0])];if(!r[0])return null;r[0].area(.1)>0&&(r[0]=r[0].reverse());for(let i=1;i<t.length;i++){let n=Qf(t[i]);n&&r.push(n.area(.1)>0?n:n.reverse())}return new Jo([new hs(r)])}else if(e===1){let n=function(c,h,u){let d=r[c];for(let p=c+1,m=r.length;p<m;p++){let g=r[p];if(!g.isVisited){if(d.bbox().maxX<g.bbox().minX)break;if(l(d,g)){r[p].isVisited=!0;let y;u?(h.push(g),y=[]):y=[g],n(p,y,!u),y&&y.length&&i.push(y)}}}},l=function(c,h){if(!c.bbox().extendOfSize(.001).isContainsBBox(h.bbox()))return!1;let d=h.primitives[0].start();return!!c.getWindingNum(d)},r=t.sort((c,h)=>c.bbox().minX-h.bbox().minX),i=[];r.forEach((c,h)=>{if(c.isVisited)return;r[h].isVisited=!0;let u=[c];n(h,u,!0),u&&u.length&&i.push(u)});let s=[];i.forEach(c=>{let h=[Qf(c[0])];if(h[0]){h[0].area(.1)>0&&(h[0]=h[0].reverse());for(let u=1;u<c.length;u++){let d=Qf(c[u]);d&&(d.area(.1)<0&&(d=d.reverse()),h.push(d))}s.push(new hs(h))}});let a=[Gl.UNION];return s.forEach(c=>a.push(c)),this.run(a)}else return e===3?this.run(this.gnrBooleanRules(t)):this.union(t)}union(t){let e=new dT(!1),r=new FI(vY.rule,new Gi(1),e);for(let n of t)r.addPolyline(n.asClose());r.simplify();let i=[];return e.plGrps.forEach(n=>{let s=[Qf(n.items[0])];if(s[0]){for(let a=1;a<n.items.length;a++){let l=Qf(n.items[a]);l&&s.push(l)}i.push(new hs(s))}}),new Jo(i)}gnrBooleanRules(t){let e=[Gl.UNION],r=[Gl.UNION];for(let i of t){let n=fv(i),s=e.length,a=r.length;for(let l of n){if(l.primitives.length===0){console.error("ply.primitives.length === 0");continue}l.area(.1)>0?r.push(l.reverse()):e.push(l)}s!==e.length&&a!==r.length&&e.push([Gl.DIFF,[Gl.UNION,...e.splice(s)],[Gl.UNION,...r.splice(a)]])}return e.length===1?(console.warn("unionPls.length === 1"),e):r.length===1?e:[Gl.DIFF,e,r]}toOuterLine(t){return t.area(.1)>0?t.reverse():t}toInnerLine(t){return t.area(.1)<0?t.reverse():t}gnrBooleanDataList(t,e){let r=[];return t.forEach(i=>r.push(e)),r}};var GOt=.001,FX=class{constructor(){this.kit=new th(GOt);this.adsorp=null}getEnd(t,e,r){if(!this.checkCollide(t,e,r))return t.end();let i=t.end(),n=new Fs(fe.build2([t]),e,r);switch(n.relation){case 3:return n.distance>r?i:this.getInterEnd(t,e,r);case 0:return this.getInterEnd(t,e,r);case 1:case 2:return t.start()}}checkCollide(t,e,r){if(t instanceof M&&!t.isPoint()){let n=t.end().sub(t.start()).normalize().angle(S.ORIGIN),s=Qe.rotate(n),a=t.multiply3(s),l=e.multiply3(s),c=a.bbox().extendOfSize(1e-6),h=l.bbox().extendOfSize(r);return c.isIntersect(h)!=null}return!0}getInterEnd(t,e,r){let i=t.end();for(let n of e.primitives)n instanceof M?t instanceof M?(i=this.calcuLineLine(t,n,r),t=new M(t.start(),i)):(i=this.calcuLineArc(n,t,!1,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())):n instanceof q&&(t instanceof M?(i=this.calcuLineArc(t,n,!0,r),t=new M(t.start(),i)):(i=this.calcuArcArc(t,n,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())));return i}getNewPrimitive(t,e){return t instanceof M?new M(t.start(),e):q.build2(t.center,t.startAngle,e.angleD(t.center),t.rx,t.ry,t.sweep())}getPrimitive(t,e=!0){if(e){let r;return t instanceof Ns?r=new M(t.start,t.end):r=q.build2(t.arc.center,t.arc.startAngle,t.arc.endAngle(),t.arc.rx,t.arc.rx,t.arc.sweep()),r}else{let r;if(t instanceof Ns)r=new M(t.end,t.start);else{let i=t.arc.sweep()==le.CCW?le.CW:le.CCW;r=q.build2(t.arc.center,t.arc.endAngle(),t.arc.startAngle,t.arc.rx,t.arc.rx,i)}return r}}isSameNet(t,e){return t===e}isSameLayer(t,e){return t===e}pointInPolyline(t,e){return e instanceof Gt?new rh().inPolygon(t,e.items):new rh().inPolyline(t,e)}calcuLineLine(t,e,r){let i=t.start(),n=t.end(),s=e.stroke(r*2,kr.ROUND,le.CCW).asClose();if(this.pointInPolyline(i,s))return i;let l=new Set;for(let c of s.primitives){let h=Tt(t,c);if(h>0)for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);l.add(d)}}if(l.size>0){let c=n.distance1(i);l.forEach(h=>{let u=h.distance1(i);u<c&&(n=h,c=u)})}return n}calcuLineArc(t,e,r,i){if(r){let n=t.start(),s=t.end();if(i=i<1e-5?0:i,i==0)return t.start();let a=e.stroke(i*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(n,a))return n;let c=new Set;for(let h of a.primitives){let u=Tt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=s.distance1(n);c.forEach(u=>{let d=u.distance1(n);d<h&&(s=u,h=d)})}return s}else{let n=e.start(),s=e.end(),a=(e.startAngle%360+360)%360,l=t.stroke(i*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(n,l))return n;let h=new Set;for(let u of l.primitives){let d=Tt(e,u);if(d>0)for(let p=0;p<d;p+=2){let m=new S(Ee[p],Ee[p+1]);h.add(m)}}if(h.size>0){let u=e.center,d=e.sweep(),p=e.sweepAngle;h.forEach(m=>{let g=(m.angleD(u)%360+360)%360;if(d==le.CCW){let y=(g-a+360)%360;y<p&&(s=m,p=y)}else{let y=(g-a-360)%360;y>p&&(s=m,p=y)}})}return s}}calcuArcArc(t,e,r){let i=t.start(),n=t.end(),s=(t.startAngle%360+360)%360,a=e.stroke(r*2,kr.ROUND,le.CCW).asClose();if(new rh().pointInPolyline(i,a))return i;let c=new Set;for(let h of a.primitives){let u=Tt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=t.center,u=t.sweep(),d=t.sweepAngle;c.forEach(p=>{let m=(p.angleD(h)%360+360)%360;if(u==le.CCW){let g=(m-s+360)%360;g<d&&(n=p,d=g)}else{let g=(m-s-360)%360;g>d&&(n=p,d=g)}})}return n}isCollide(t,e,r,i=!0){if(e==null)return!1;let n=t.bbox().extendOfSize(r);for(let s of e.primitives){if(s instanceof M&&s.length()<1e-8)continue;let a=s.bbox();if(n.isIntersect(a)){let l=new ir(t,s).getDistance();if(this.kit.less(l,r))return!0}}return!!(i&&this.pointInPolyline(t.start(),e)||t instanceof q&&this.kit.eq(Math.abs(t.sweepAngle),360)&&e.primitives[0].start().distance1(t.center)<t.rx)}isCollidePoly(t,e,r,i=!0){return t.primitives.some(n=>n instanceof M||n instanceof q?this.isCollide(n,e,r,i):n instanceof $H?this.isCollidePoly(fe.build6(n.bbox()),e,r,i):n instanceof Mr?this.isCollidePoly(fe.build4(n.points(1)),e,r,i):!1)}};var PUe=!1;try{/\bhideAutoLayoutProgress\b/.test($().location.search)&&(PUe=!0)}catch{}var Ase=class{constructor(t){this.state=2;this.matrixRes=null;this.historyGroup=null;this.componentPosition={};this.hasMoved=new Set;this.hasBoardOutline=!1;this.bboxLines={};this.showBBox=!1;this.workerManager=t,A.subscribe("pcb/autoLayout",this.autoLayouting2.bind(this)),A.subscribe("/jerboa/progress",this.layoutResult.bind(this)),A.subscribe("pcb/layoutInterrupt",this.layoutInterrupt.bind(this),$())}loadWorker(t){Mn.getInstance().allowPull=!1,this.workerManager.addWorker(`editor?entry=jerboa-service.js${$().location.search.replace(/\?/,"&")}`).publish("/jerboa/execute",t)}async autoLayouting2(t=!1){if(!x.getInstance().isactive||![bi.PCB,bi.PCBMODULE].includes(x.getInstance().doctype))return;let e=await this.createAutoLayoutInput2(t);if(e)return t||(this.loadWorker(JSON.stringify(e)),this.toggleAutoLayoutState(0)),e}async importLayoutResult2(t){this.toggleAutoLayoutState(0);try{let e=JSON.parse(t);e.boardOutline&&(this.hasBoardOutline=!0);let r=10,i=39.37,n=Di.convert(1,r,i);this.matrixRes=Qe.scale(1/n),this.componentPosition={},Cr.getAllItem().forEach(s=>{this.componentPosition[s.globalIndex]=s.position}),this.updateCanvas(e),this.toggleAutoLayoutState(2)}catch(e){q0({type:"error",message:["Automatic layouting interrupt: ",e.toString()],shortMsg:"Automatic layouting interrupt!"}),this.toggleAutoLayoutState(3)}}layoutResult(t){if(this.state!==1){console.error("Auto Layouting is stoped!",this.state);return}try{this.workName=t.workerName;let r=JSON.parse(t.str);$0("AutoLayoutResJson",void 0,r),e(r.subCircuitData_test),this.updateCanvas(r);let i=r.finish?1:Math.min(Math.max(r.progress,0),.99);this.updateProgress(i)}catch(r){q0({type:"error",message:["Automatic layouting interrupt: ",r.toString()],shortMsg:"Automatic layouting interrupt!"}),this.layoutInterrupt()}function e(r){if(!r)return;let i={Root:ee.WHITE,Page:ee.BLUE,Zone:ee.RED,ModuleAndGroup:ee.Golden,Component:ee.GREEN},n=r,s=new Ko(A);n.forEach(a=>{var h;let l=(h=i[a.hierarchy])!=null?h:ee.Gray,c=a.bbox;s.initColor(l).addPly(fe.build4(new ut(c[0],c[1],c[2],c[3]).points().map(u=>u.scale(3.937))))}),s.draw()}}updateCanvas(t){this.hasBoardOutline||this.addBoardOutline(t.boardOutline),this.updateComponent(t.components,t.finish),A.publish("updateFrame","")}async createAutoLayoutInput2(t=!1){if(!Cr.getAllItem().length)return;this.historyGroup||(this.historyGroup=new mi,this.historyGroup.createGroup("autoLayouting"));let e=10,r=39.37,i=uu(),n=Di.convert(1,e,r),s=Qe.scale(n);this.matrixRes=Qe.scale(1/n),this.clearBBoxLines(),this.showBBox=parent.location.href.includes("layout=showbbox");let a=[],l=[],c=[],h=null;if(i.length>0){let Y=new _e,X=[];i.forEach(he=>{Y.ext1(he.buildBBox()),X.push(...he.getMathGraphics().primitives)});let Z=Y.build1(),ae=new oh(Z,2,1.2,new Gi(2),X).detect();if(ae&&ae.bbox().area()<=Z.area()){if(ae.items.length===1)h=ae.items[0];else if(ae.items.length>1){let re={area:0,poly:null};ae.items.forEach(se=>{let K=se.bbox().area();K>re.area&&(re={area:K,poly:se})}),re.poly&&(h=re.poly,ae.items.forEach(se=>{if(se!=re.poly&&yb.build2(re.poly,se).inInner()){a.push({path:this.autoJerboaPoints(se,s),layer:11});let me=$e.getInstance().getAllCopperLayerIds();l.push({path:this.autoJerboaPoints(se,s),layers:me}),c.push(se.area)}}))}}}let u=te.getInstance().getDefaultOtherSpacing(),d=te.getInstance().getDefaultSafeSpacing(),p=d.getItemMaxClearance(11,[1,2]),m=d.getItemMaxClearance(6,[1,2]),g=d.getItemMaxClearance(15,[1,2]),y=d.getItemMaxClearance(8,[1,2]),b={componentToBoardOutline:xe(this.autoJerboaNum(p,s),3),componentToComponent:xe(Math.max(this.autoJerboaNum(u.deviceClearance,s),.5),3),componentToFillRegion:xe(this.autoJerboaNum(m,s),3),componentToProhibitedRegion:xe(this.autoJerboaNum(Math.max(y,g),s),3)},P=[],T=[],I={},C=Cr.getAllItem().map(Y=>Y.footprintUUID),E=Array.from(new Set(C));E&&E.forEach(Y=>{T.push(Ji.getItem(Y))}),T&&T.forEach(Y=>{let X=Y.id,Z=Y.uuid,Q=Y.getBBox(),ae=this.extractPrefix(X);if(!Q)return;let he=this.autoJerboaBBox2(Q,s),re=!1,se=Y.getPads();se.forEach(Oe=>{gr(Oe.layerId)&&(re=!0)});let K={};se.length>0&&se.forEach(Oe=>{let Ie=Oe.globalIndex,ue=Oe.layerId,Pe=Oe.center,j=this.autoJerboaPoint(Pe,s),J=Oe.getMathGraphics(ue),oe=this.autoJerboaPoints(J,s),pe=null;Oe.padStyle.type=="ELLIPSE"&&(pe=xe(Di.convert(Oe.padStyle.height*10,1,39.37),3));let ge=[];if(ge.push(ue),ue==12){ge=$e.getInstance().getAllSignalLayerIds();let tt=Oe.top,Ze=Oe.bottom,Wt=Oe.inner,Nr=[];if(tt&&tt.type==="ELLIPSE"&&Nr.push(tt.height),Ze&&Ze.type==="ELLIPSE"&&Nr.push(Ze.height),Wt&&Wt.type==="ELLIPSE"&&Nr.push(Wt.height),Nr.length>0){let Fe=pe=Nr.length>1?Math.max(...Nr):Nr[0];pe=xe(Di.convert(Fe*10,1,39.37),3)}let Lr=Oe.getMathGraphics(1),Dr=Lr instanceof Gt?Lr:new Gt([Lr]),Rr=Oe.getMathGraphics(2),ke=Rr instanceof Gt?Rr:new Gt([Rr]),Ut=new Kc().getUnionForSingle([Dr.items,ke.items]),ar=null;if(Ut.length>0)ar=Ut[0].items[0];else{let Fe=Dr.items[0].area(),it=ke.items[0].area();ar=Fe>it?Dr.items[0]:ke.items[0]}oe=this.autoJerboaPoints(ar,s)}let Se={number:Oe.num,layers:ge,location:j,path:oe,diameter:pe};K[Ie]=Se});let me={pads:K,footprintType:ae,assemblyType:re?"tht":"smd",bbox:he};I[X]?(I[X+"_"+Z]=me,P.push(Z)):I[X]=me});let O=Cr.getAllItem(),_={},R={},v={};O.forEach(Y=>{let X=Y.globalIndex,Z=Y.designator;Z in v?v[Z].push(X):v[Z]=[X];let Q=Y.attrKeyValue["Unique ID"];Q&&(_[Y.globalIndex]=Q,R[Q]=Y.globalIndex)});let D=[],w=[];for(let Y in v){let X=v[Y];X.length>1&&(D.push(...Array(X.length).fill(Y)),w.push(...X))}if(D.length>0){let Y="Auto component placement failed, has duplicated designator, please modify",X=[Y+":"];w.forEach((Z,Q)=>{X.push(Q==0?" ":", "),X.push({attr:{id:Z,pcbid:x.getInstance().tabId},text:D[Q]})}),q0({type:"error",message:X,shortMsg:Y});return}let F=(await A.windowBridge.rpcCall("getAutoLayoutSymbolInfoByUniqueId",{uniqueID:Object.values(_),pcbUuid:x.getInstance().tabId},$())).message||{},H={},z={},G={};Object.keys(F).forEach(Y=>{G[Y]=F[Y].map(X=>({...X,bbox:new ut(X.bbox.minX,X.bbox.maxX,X.bbox.minY,X.bbox.maxY)}))});let W=this.getBiggestBoxes(G);Object.keys(F).forEach(Y=>{this.getSchInfo2(W,G,Y,R,z)});let L=[],B=[];O.forEach(Y=>{let X=this.getComponentExtendBbox2(Y),Z=Y.layerId;Z===1?L.push(Y.bbox().area()):B.push(Y.bbox().area()),this.showBBox&&(this.bboxLines[Y.globalIndex]=X.map((me,Oe)=>Yi.build(1002,me,X[(Oe+1)%4],.1)));let Q={};Y.getPads().forEach(me=>{let Oe=me.globalIndex,Ie=me.net;Oe.includes(Y.globalIndex)&&(Oe=Oe.replace(Y.globalIndex,"")),Q[Oe]=Ie});let he=P.includes(Y.footprintUUID)?Y.footprintId+"_"+Y.footprintUUID:Y.footprintId,re=Y.name,se={};Y.reuseBlock.length<1&&Y.combinationID.length<1&&Y.channelID.length<1||(se.moduleName=Y.reuseBlock,se.groupID=Y.combinationID,se.channelID=Y.channelID);let K={name:Y.device,footprint:he,height:Y.attrKeyValue.Height?this.transformComponentHeight(Y.attrKeyValue.Height):null,value:Y.attrKeyValue.Value?Y.attrKeyValue.Value:null,reuseModule:se,rotation:xe(Ht.toDegrees(Y.rotation),4),nets:Q,location:this.autoJerboaPoint(Y.position,s),layer:Z,lock:Y.locked};H[re]=K});let N=[],U=["Prohibited Region","Slot Region","Fill Region","Partition"];[].concat(Xt.getAllItem(),Zt.getAllItem(),pt.getAllItem()).forEach(Y=>{let{type:X,layerId:Z,strokeWidth:Q}=Y;if(!(Z!=1004&&!be.getLayer(Z).isSignalLayer()&&!gr(Z))&&U.includes(X)){let ae=Y.getComponent();if(X==="Prohibited Region"&&ae instanceof fd&&!ae.device)return;let he=Y.getMathGraphics(void 0,Q/2);if(!he)return;let re=new Array;he.asClose().primitives.forEach(K=>{K instanceof q?re.push(...this.arc2octagon(K)):re.push(K)});let se=[];gr(Z)?se=$e.getInstance().getAllSignalLayerIds():se.push(Z),(X=="Prohibited Region"||X=="Slot Region")&&(Y.getParent()||this.autoPushProhibitedRegionPath(l,re,s,se,h,c)),(X=="Fill Region"||X=="Partition")&&(Y.getParent()||this.autoPushFillRegionPath(N,re,s,Z,h))}});let k;if(h){if(this.hasBoardOutline=!0,k={bbox:this.autoJerboaBBox2(h.bbox(),s),path:this.autoJerboaPoints(h,s)},!t){let Y=h.area(),X=Math.abs(Y)-c.reduce((ae,he)=>ae+Math.abs(he),0),Z=X/L.reduce((ae,he)=>ae+Math.abs(he),0),Q=X/B.reduce((ae,he)=>ae+Math.abs(he),0);if((Z<1.2||Q<1.2)&&!(await A.windowBridge.rpcCall("getAutoLayoutClickInfo",void 0,$())).message){q0({type:"info",message:"Auto layout canceled\uFF01",shortMsg:"Auto layout canceled\uFF01",timeout:3e3});return}}}else k={bbox:this.autoJerboaBBox2(N0(),s)};let V={boardOutline:k,clearance:b,components:H,schematicInfo:z,footprints:I,fillRegions:N,prohibitedRegions:l};return $0("AutoLayoutJson2",void 0,V),V}getBiggestBoxes(t){let e=Object.entries(t).map(i=>{let[n,s]=i,a=s.reduce((l,c)=>l+c.bbox.area(),0);return{uniqueId:n,info:s,bboxAreaSum:a}}).sort((i,n)=>n.bboxAreaSum-i.bboxAreaSum).slice(0,10).map(i=>({uniqueId:i.uniqueId,info:i.info.map(n=>({...n,bboxDouble:n.bbox.extendOfSize(n.bbox.width(),n.bbox.height())}))})),r=new Set;for(let i=0;i<e.length;i++){let n=e[i];for(let s=i+1;s<e.length;s++){let a=e[s];for(let l=0;l<n.info.length;l++)for(let c=0;c<a.info.length;c++)if(n.info[l].page==a.info[c].page&&a.info[c].bbox.isIntersect(n.info[l].bboxDouble)){r.add(s);break}}}return e.filter((i,n)=>!r.has(n))}getSchInfo(t,e,r,i){let n=r.attrKeyValue["Unique ID"];if(!e[n])return{page:null,location:null};for(let s=0;s<t.length;s++){let a=t[s];for(let l=0;l<a.info.length;l++)for(let c=0;c<e[n].length;c++){let h=e[n][c];if(h.page==a.info[l].page&&h.bbox.isIntersect(a.info[l].bboxDouble))return{page:h.page,location:h.location,group:i[a.uniqueId]}}}return{page:e[n][0].page,location:e[n][0].location}}getSchInfo2(t,e,r,i,n){if(!e[r])return;for(let l=0;l<t.length;l++){let c=t[l];for(let h=0;h<c.info.length;h++)for(let u=0;u<e[r].length;u++){let d=e[r][u];if(d.page==c.info[h].page&&d.bbox.isIntersect(c.info[h].bboxDouble)){let p=d.designator,m={page:d.page,location:d.location,group:i[c.uniqueId],connectWith:d.connectWith,zone:d.zone};n[p]=m;return}}}let s=e[r][0].designator,a={page:e[r][0].page,location:e[r][0].location,connectWith:e[r][0].connectWith,zone:e[r][0].zone};n[s]=a}getComponentExtendBbox(t){let e=t.rotation;t.rotation=0;let r=new _e;r.ext1(t.buildBBox()),t.getPads().forEach(l=>{let h=te.getInstance().getSafeSpacingByNet(l.net,l.layerId==12?2:1).getClearance(0,0),u=l.buildBBox().extendOfSize(h);r.ext1(u)});let i=r.build1(),s=i.center().rotate(t.position,e);return this.componentPosition[t.globalIndex]=s,t.rotation=e,{componentBbox:[i.LL(),i.LR(),i.UR(),i.UL()].map(l=>l.rotate(t.position,t.rotation)),componentBboxCenter:s}}getComponentExtendBbox2(t){let e=new _e;e.ext1(t.buildBBox()),t.getPads().forEach(n=>{let a=te.getInstance().getSafeSpacingByNet(n.net,n.layerId==12?2:1).getClearance(0,0),l=n.buildBBox().extendOfSize(a);e.ext1(l)});let r=e.build1();return this.componentPosition[t.globalIndex]=t.position,[r.LL(),r.LR(),r.UR(),r.UL()].map(n=>n.rotate(t.position,t.rotation))}arc2octagon(t){let e=[t.start()],r=t.sweep()==le.CCW?1:-1,i=360/8;for(let n=0;n<t.sweepAngle*r/i;n++){let s=Ht.toRadians(t.startAngle+n*i*r);e.push(new S(t.rx*Math.cos(s),t.rx*Math.sin(s)).add(t.center))}return e.push(t.end()),fe.build4(e).primitives}autoJerboaPoint(t,e){return e&&(t=t.multiply3(e)),[xe(t.x,4),xe(t.y,4)]}autoJerboaBBox(t,e){return[t.LL(),t.LR(),t.UR(),t.UL()].map(r=>this.autoJerboaPoint(r,e))}autoJerboaBBox2(t,e){return t=t.transform(e),[xe(t.minX,4),xe(t.maxX,4),xe(t.minY,4),xe(t.maxY,4)]}autoJerboaPoints(t,e){t=this.makeClockWise(t);let r=[],i="";return t.points(.1,n=>{let s=this.autoJerboaPoint(n,e),a=s.join("_");i!==a&&(i=a,r.push(s))}),r}autoJerboaPointsByBBox(t,e){return this.autoJerboaPoints(fe.build6(t),e)}autoJerboaPointsByPoints(t,e){return this.autoJerboaPoints(fe.build4(t),e)}autoJerboaResPoint(t,e){return new S(t[0],t[1]).multiply3(e)}autoJerboaNum(t,e){return e&&(t=t*e.iScale),t}toggleAutoLayoutState(t,e=!1,r=1){let i=this.state;if(t===0){if(i!=2)return;this.autoLayoutReady()}else{if(t===1)return;if(t===2){if(i!=1){this.state=t;return}this.autoLayoutEnd(e,r)}else if(t===3){if(i!=1){this.state=2;return}this.layoutInterrupt()}}}autoLayoutReady(){this.startTime=new Date,this.state=1,this.updateProgress(0,{messageTopic:"pcb/layoutInterrupt",messageTopicData:{manual:!0}}),this.historyGroup||(this.historyGroup=new mi,this.historyGroup.createGroup("autoLayouting")),this.ratlineLayerIsVisible=be.getRatlineLayer().visible,this.ratlineLayerIsVisible&&(be.getRatlineLayer().visible=!1)}autoLayoutEnd(t=!1,e=1){this.workName!=null&&(this.workerManager.deleteWorker(this.workName),this.workName=null),this.ratlineLayerIsVisible&&(be.getRatlineLayer().visible=!0),this.outline&&this.historyGroup.addCommand4Item(this.outline,"add"),this.hasMoved.forEach(r=>{let i=Cr.getItem(r);A.publish("hasModifyPcbItem",i)}),this.putLogs(t),this.hasMoved.clear(),this.historyGroup&&this.historyGroup.execute(),this.historyGroup=null,this.outline=null,A.publish("flushService",""),this.state=2,this.updateProgress(e),Mn.getInstance().allowPull=!0}layoutInterrupt(t){let e="";typeof t=="string"?e=t:t&&(e=t.message),e&&q0({type:"error",message:e,shortMsg:e}),this.autoLayoutEnd(!0,1)}addBoardOutline(t){if(!t||!(t instanceof Array)||t.length<3)return;this.outline&&(this.outline.remove(),A.publish("delete",this.outline));let e=new Array,r=new io;for(let i=0;i<t.length;i++){let n=this.autoJerboaResPoint(t[i],this.matrixRes),s=this.autoJerboaResPoint(t[i==t.length-1?0:i+1],this.matrixRes);e.push(r.addLine(n,s,11))}this.outline=pt.addPolygon("Line",11,[e],1,"",!1)}getBoardBox(t){let e=new _e;return t.forEach(r=>{if(!r.isEmpty){if(r instanceof Ye){let i=r.getMathGraphics();i!=null&&e.ext1(i.bbox())}else if(r instanceof vt||r instanceof mt){let i=r.getMathGraphics();i!=null&&e.ext1(i.bbox())}}}),e.build1()}updateComponent(t,e){if(!(t instanceof Object))return;let r=Cr.getAllItem();for(let i in t)if(t.hasOwnProperty(i)){let n=t[i],s=r.filter(u=>u.designator==i)[0];if(!this.hasMoved.has(s.globalIndex)){this.hasMoved.add(s.globalIndex);let u=Te.dispatch(s,"modify");this.historyGroup.addCommand(u)}let a=this.componentPosition[s.globalIndex],l=this.autoJerboaResPoint(n.location,this.matrixRes);this.componentPosition[s.globalIndex]=l;let c=l.sub(a),h=Ae.translate(c.x,c.y,0);s.rotation=Ht.toRadians(n.rotation),s.transform(h),this.showBBox&&this.bboxLines[s.globalIndex].forEach(u=>u.transform(h))}}clearBBoxLines(){Object.values(this.bboxLines).forEach(t=>{t.forEach(e=>e.remove())}),this.bboxLines={}}updateProgress(t,e){isNaN(t)&&(t=1,console.error("There has undesired number of progress: ",t)),PUe||A.publish("progressUpdate",[t,"Auto Layout",void 0,e],$()),t>=1&&this.toggleAutoLayoutState(2)}putLogs(t=!1){t||q0({type:"info",message:"Auto layout completed! Has moved components: {0}, use time: {1}s.",shortMsg:"Auto layout completed!",replace:{0:this.hasMoved.size.toString(),1:((new Date().getTime()-this.startTime.getTime())/1e3).toFixed(2).toString()},timeout:3e3})}extractPrefix(t){let e=t.indexOf("_");if(e!==-1)return t.substring(0,e);{let r=t.indexOf("-");if(r!==-1)return t.substring(0,r);{let i=t.search(/\d/);return i!==-1?t.substring(0,i):t}}}transformComponentHeight(t){let e=t.match(/^(\d+(\.\d+)?)/);return e?parseFloat(e[0]):0}autoPushProhibitedRegionPath(t,e,r,i,n,s){let a=new FX,l=fe.build2(e);a.isCollidePoly(l,n,0)&&(t.push({path:this.autoJerboaPoints(l,r),layers:i}),s.push(l.area()))}autoPushFillRegionPath(t,e,r,i,n){new FX().isCollidePoly(fe.build2(e),n,0)&&t.push({path:this.autoJerboaPoints(fe.build2(e),r),layer:i})}getMatrix(){let t=10,e=39.37,r=uu(),i;r.length>0?i=this.getBoardBox(r).LL():i=N0().LL();let n=Di.convert(1,t,e);return Qe.translate(-i.x*n,-i.y*n).scale(n)}makeClockWise(t){return t.area()>0?t.reverse1():t}};var IUe=nd(cj());var TUe=/^(\D*)(\d+|\?|\？)$/,UOt=/^(\D*)$/;var x9e=/^(.*?)(\d+|\?|\？)$/,HOt=/^([A-Z]+)(\d+|\?|\？)$/,v9e=o=>o==="?"||o==="\uFF1F",WOt=o=>/^\d+$/.test(o);function xse(o){return`${ur}${o.number}`||o.globalIndex}function Rse(o){return`$${o.layerId}_${o.globalIndex}`}function Dse(o,t){if(o.length<=1)return o;let e=Math.floor(o.length/2),r=o.slice(0,e),i=o.slice(e);return zOt(Dse(r,t),Dse(i,t),t)}function zOt(o,t,e){let r=[],i=0,n=0;for(;i<o.length&&n<t.length;)e(o[i],t[n])<=0?(r.push(o[i]),i++):(r.push(t[n]),n++);return r.concat(o.slice(i)).concat(t.slice(n))}function R9e(o,t){let e=Cr.getAllItem();e=e.filter(i=>i.partition==x.getInstance().partitionId);let r={1:[],2:[],allSelectedPath:[],sortedComponents:[]};if(o==="selected_component"?(e=Ve.getComponents(),Fn(e,(i,n)=>{let s=n.layerId,a=Rse(n);r[s].push(n),r.allSelectedPath.push(a)})):Fn(e,(i,n)=>{let s=n.layerId,a=Rse(n);switch(o){case"all_components":r[s].push(n),r.allSelectedPath.push(a);break;case"topLayer-components":s==1&&(r[s].push(n),r.allSelectedPath.push(a));break;case"bottomLayer-components":s===2&&(r[s].push(n),r.allSelectedPath.push(a));break}}),t)switch(t){case"horizontal_vertical_reverse":r.sortedComponents.push(...vse(r[1])),r.sortedComponents.push(...vse(r[2]));break;case"vertical_horizontal_reverse":r.sortedComponents.push(..._se(r[1])),r.sortedComponents.push(..._se(r[2]));break;case"horizontal_vertical":r.sortedComponents.push(...vse(r[1],!0)),r.sortedComponents.push(...vse(r[2],!0));break;case"vertical_horizontal":r.sortedComponents.push(..._se(r[1],!0)),r.sortedComponents.push(..._se(r[2],!0));break}return r}function _se(o,t=!1){return Dse(o,(e,r)=>Math.abs(e.position.x-r.position.x)>0?e.position.x>r.position.x?1:-1:t?r.position.y-e.position.y:e.position.y-r.position.y)}function vse(o,t=!1){return Dse(o,(e,r)=>Math.abs(e.position.y-r.position.y)>0?t?r.position.y-e.position.y:e.position.y-r.position.y:e.position.x-r.position.x)}function CUe(o,t,e,r){let i="refDesignator-time";pn(i);let n=R9e("all_components",t).sortedComponents,s=R9e(o,t),a=s.allSelectedPath,l={},c={},h=1e7,u=new ve("refDesignator"),d={};(e==="keep_designator"||e==="re_designator")&&(Fn(n,(g,y)=>{let b=y.attrKeyValue.Designator||"U?",P=Rse(y),T=TUe.exec(b);if(T){let I=T[1],C=T[2];v9e(C)||(a.includes(P)?e==="keep_designator"&&wy(d,b).push(P):wy(c,b).push(P))}else wy(c,b).push(P)}),Fn(d,(g,y)=>{c[g]&&delete d[g]}));let p=[];Fn(s.sortedComponents,(g,y)=>{var I,C,E,O;let b=y.attrKeyValue.Designator,P=Rse(y),T=TUe.exec(b);if(T){let _=T[2],R=T[1];v9e(_)||P!==(((I=d[b])==null?void 0:I[0])||((C=c[b])==null?void 0:C[0]))?(m(y,_,R),HOt.test(b)||p.push(d9e({text:`${b}(${xse(y)})`,attr:{id:y.globalIndex,pcbid:x.getInstance().tabId}}))):console.error(b)}else if(b=="")m(y,1,"U");else if(UOt.test(b))m(y,1,b);else{let _=x9e.exec(b),R=_==null?void 0:_[1],v=_==null?void 0:_[2];v9e(v)||P!==(((E=d[b])==null?void 0:E[0])||((O=c[b])==null?void 0:O[0]))?m(y,1,R):_||m(y,1,b),p.push(d9e({text:`${b}(${xse(y)})`,attr:{id:y.globalIndex,pcbid:x.getInstance().tabId}}))}}),p.length>0&&A.windowBridge.publish("ui/toastMsg",{type:"warn",msg:{value:"Found that some designators does not conform to the rules",options:{title:p.join(";")}},bottomBarMsg:{type:"warn",msg:['<span class="i18n">Found that some designators does not conform to the rules:</span> ',p.join(";")]},timer:3},$()),u.length>0&&je.executeCommand(u),A.publish("flushService",""),A.publish("flushSelectingInfo",""),A.windowBridge.rpcCall("save",{tabId:x.getInstance().tabId},$()),A.windowBridge.publish("ui/toastMsg",{type:"info",msg:"Finish Annotating Designator.",timer:3},$()),Bi(i);function m(g,y,b){for(let P=l[b]+1||r;P<h;P++){let T=b+P;if(!Object.keys(Object.assign({},c,d)).includes(T)){l[b]=P;let I=Te.dispatch(g,"modify");u.addCommand(I),g.modifyATTRMap("Designator",T);let C=g.attrKeyText;C.Designator&&(C.Designator.value=T);break}}}}function SUe(o){let t=R9e(o),e=new ve("clear-Designator");Fn(t[1].concat(t[2]),(r,i)=>{let n=i.attrKeyValue.Designator||"U?",s;if(WOt(n.trim()))s="?";else{let c=n.match(new RegExp("\\b(\\d*(\\p{L}+))","u")),h=c?c[1]:n.replace(x9e,"$1?");!x9e.test(h)&&n!==h?s=h+"?":s=h}let a=Te.dispatch(i,"modify");e.addCommand(a),i.modifyATTRMap("Designator",s);let l=i.attrKeyText;l.Designator&&(l.Designator.value=s)}),e.length>0&&je.executeCommand(e),A.publish("flushService",""),A.publish("flushSelectingInfo",""),A.windowBridge.rpcCall("save",{tabId:x.getInstance().tabId},$()),A.windowBridge.publish("ui/toastMsg",{type:"info",msg:"Finish Clear Designator.",timer:3},$())}function EUe(){let o=Cr.getAllItem();o=o.filter(n=>n.partition==x.getInstance().partitionId);let t="UNIQUE",e=[],r=new ve("resetUniquId"),i=(n,s,a)=>{let l=n+(s?(0,IUe.default)(s).substring(0,6):a).toLocaleUpperCase();return e.includes(l)&&(l=n+a.toLocaleUpperCase()),l};Fn(o,(n,s)=>{let a=s.attrKeyValue.Designator;if(r.addCommand(Te.dispatch(s,"modify")),a&&YBe.test(a)){let l=t+a.toLocaleUpperCase();e.includes(l)?l=i(t,a,xse(s)):e.push(l),e.push(l),s.modifyATTRMap("Unique ID",l);let c=s.attrKeyText;c["Unique ID"]&&(c["Unique ID"].value=l)}else{let l=i(t,a,xse(s));e.push(l),s.modifyATTRMap("Unique ID",l);let c=s.attrKeyText;c["Unique ID"]&&(c["Unique ID"].value=l)}}),r.length>0&&je.executeCommand(r),A.publish("flushService",""),A.windowBridge.rpcCall("save",{tabId:x.getInstance().tabId},$()),A.publish("flushSelectingInfo",""),A.windowBridge.publish("ui/toastMsg",{type:"info",msg:"Reset component unique ID successfully",timer:3},$())}var wse=class extends OV{addCopperResult(t,e){let r=this.getProfile(t);if(r==null||r.type!="Copper Region")return;let n=r.component;if(n instanceof Vn){let s=n.style,a=n.clearance,l=n.gridLineWidth,c=n.optimization,h=n.optimizationValue,u=Wo.getInstance();e.forEach(d=>{let p=JSON.parse(d);if(p[0]=="POURED"){let m=s;if(m=="solid"&&p[2]!=0&&(m="90grid"),(m=="90grid"||m=="45grid")&&p[2]!=0&&(l=p[2]),n.copperResult.push(p[4]),u.getItem(p[1])!=null)return;let g=Wo.getInstance().addCopper(p[1],r.layerId,r.net,m,l,a,c,p[4],!1,h);r.addCopper(g.globalIndex),g.setParent(r)}})}}getProfile(t){let e=Mi.getInstance().getItem(t);if(e!=null)return e;let r=rn.getInstance().getItem(t);if(r!=null)return r;let i=zi.getInstance().getItem(t);return i!=null?i:null}};var wD={x:"width",y:"height"},D9e={x:"row",y:"column"},h9={x:"rowSpacing",y:"columnSpacing"},Lse=class{constructor(){this._model=ai.getInstance()}applyPanelize(t={}){let r={...JSON.parse(JSON.stringify(this._model.getDefaultPanelize())),...t};if(this._model.setDefaultPanelize(r),this._model.remove(),!r.on)return;this.handleCustomRect(r);let i=this.getBoardOutlines(r);if(!i.length)return;let n=this.getBoardBBox2(r,i);if(n.height===0&&n.width===0)return;let{innerBBox:s,outerBBox:a}=this.calcBBox(r,i),l;if(r.resetCanvasOrigin&&(l=new S(a.x,a.y)),l){x.getInstance().origin=l;let c=this.calcBBox(r,i);n=c.bBox,s=c.innerBBox,a=c.outerBBox}r.onlyOutline&&this.createOutLineCopies(r,n,this.getAllBoard()),(!r.stampRow||!r.stampColumn)&&this.createVCutLines(a,n,r,s,i),(r.stampRow||r.stampColumn)&&this.createStampHoleLines(r,n,s,i),(r.borderAtTopBottom||r.borderAtLeftRight)&&this.createBorder(r,a),this.createOuterMostLine(r,i,n,s,a)}handleCustomRect(t){if(t.useCustomSize==null||t.customWidth<=0||t.customHeight<=0)return;let e="customRectForPanelize",r=rn.getInstance(),i=r.getItem(e);t.useCustomSize&&(i?(i.width=t.customWidth,i.height=t.customHeight):(r.recycle(),zi.getInstance().recycle(),Mi.getInstance().recycle(),r.addRect(e,"Board Outline",11,new S(0,0),t.customWidth,t.customHeight,"",!1,1,0,0)))}getBoardOutlines(t){let e=this.getAllBoard();if(!e.length)return[];let r=this.getBoardBBox(t,e),i=[];e.forEach(l=>Re.addAll(i,l.getMathGraphics().primitives));let s=new oh(new ut(r.x,r.x+r.width,r.y,r.y+r.height),2,.01,new Gi(4),i).detect();if(s&&s.bbox().area()<=r.height*r.width)return s.items;let a=e.map(l=>l.getMathGraphics()).flat(2).filter(l=>l!=null).map(l=>l.primitives).flat(2);return[fe.build2(a)]}getBoardBBox(t,e){let r=new _e;e.forEach(n=>{n.isEmpty||r.ext1(n.buildBBox())});let i=r.build1();return this._model.singleBBox=i,this.bBoxWithOffset(i,t)}getBoardBBox2(t,e){let r=new _e;e.forEach(n=>r.ext1(n.bbox()));let i=r.build1();return this._model.singleBBox=i,this.bBoxWithOffset(i,t)}bBoxWithOffset(t,e){let r=t.maxX-t.minX,i=t.maxY-t.minY;return{x:t.minX,y:t.minY,width:r,height:i,offset:{x:e.columnSpacing+r,y:e.rowSpacing+i}}}getAllBoard(){let t=new Array;return Mi.getInstance().iterator(r=>e(r)),rn.getInstance().iterator(r=>e(r)),zi.getInstance().iterator(r=>e(r)),t;function e(r){(r.type=="Board Outline"||r.type=="Line"&&r.layerId==11)&&t.push(r)}}createOutLineCopies(t,e,r){for(let i=0;i<t.row;i++)for(let n=0;n<t.column;n++){let s=!i&&!n,a=!s||(t.flipX||t.flipY)&&t.flipOrigin,l=Ae.translate(e.offset.x*n,e.offset.y*i,0);r.forEach(c=>this._model.copyOutline(c,l,s,a))}}createVCutLines(t,e,r,i,n){if(!r.stampRow)if(r.rowSpacing==0||r.borderAtLeftRight&&r.columnSpacing==0){let s=this.getIntersects(n,new M(new S(e.x,e.y+e.height),new S(e.x+e.width,e.y+e.height))),a=this.getIntersects(n,new M(new S(e.x,e.y),new S(e.x+e.width,e.y)));if(!this.isIntersect(s,a,Qe.translate(0,e.height))){let l=[s,a].map(u=>u.reduce((d,p)=>d.concat(p),[]).sort((d,p)=>p.x-d.x)[0]),c=l[0],h=l[1].add(new S(0,e.height));for(let u=0;u<r.column;u++)for(let d=0;d<r.row-1;d++){let p=new S(e.offset.x*u,e.offset.y*d);this._model.addLine(c.add(p),h.add(p))}}}else for(let s=1;s<r.row;s++){let a=e.y+e.offset.y*s,l=a-r.rowSpacing,c=[a,l].map(u=>this.createVCutLineGivenFixedPosition(r,u,!0,t)),h=fe.build4([c[0][1],c[0][0],c[1][0],c[1][1]]).asClose();this._model.closures.push(h.primitives)}if(!r.stampColumn)if(r.columnSpacing==0||r.borderAtTopBottom&&r.rowSpacing==0){let s=this.getIntersects(n,new M(new S(e.x,e.y),new S(e.x,e.y+e.height))),a=this.getIntersects(n,new M(new S(e.x+e.width,e.y),new S(e.x+e.width,e.y+e.height)));if(!this.isIntersect(a,s,Qe.translate(e.width,0))){let l=[a,s].map(u=>u.reduce((d,p)=>d.concat(p),[]).sort((d,p)=>p.x-d.x)[0]),c=l[0],h=l[1].add(new S(e.width,0));for(let u=0;u<r.column-1;u++)for(let d=0;d<r.row;d++){let p=new S(e.offset.x*u,e.offset.y*d);this._model.addLine(c.add(p),h.add(p))}}}else for(let s=1;s<r.column;s++){let a=e.x+e.offset.x*s,l=a-r.columnSpacing,c=[a,l].map(u=>this.createVCutLineGivenFixedPosition(r,u,!1,t)),h=fe.build4([c[0][1],c[0][0],c[1][0],c[1][1]]).asClose();this._model.closures.push(h.primitives)}r.borderAtTopBottom&&(this._model.borderClosures[0].push(new M(new S(i.x,i.y),new S(i.x+i.width,i.y))),this._model.borderClosures[1].push(new M(new S(i.x,i.y+i.height),new S(i.x+i.width,i.y+i.height)))),r.borderAtLeftRight&&(this._model.borderClosures[0].push(new M(new S(i.x,i.y),new S(i.x,i.y+i.height))),this._model.borderClosures[1].push(new M(new S(i.x+i.width,i.y),new S(i.x+i.width,i.y+i.height)))),r.borderAtTopBottom&&!r.stampRow&&r.borderAtLeftRight&&!r.stampColumn?([e.x,e.x+e.width].forEach((s,a)=>{let l=new M(new S(s,i.y),new S(s,i.y+i.height)),c=this.getInterSections(n,l,"y");if(c.up&&c.down){let h=c.down,u=c.up.add1(0,e.offset.y*(r.row-1));a==1&&(h=h.add1(i.width-e.width,0),u=u.add1(i.width-e.width,0)),this._model.addVCutLine(u,h,!1)}}),[e.y,e.y+e.height].forEach((s,a)=>{let l=new M(new S(i.x,s),new S(i.x+i.width,s)),c=this.getInterSections(n,l,"x");if(c.up&&c.down){let h=c.down,u=c.up.add1(e.offset.x*(r.column-1),0);a==1&&(h=h.add1(0,i.height-e.height),u=u.add1(0,i.height-e.height)),this._model.addVCutLine(h,u,!0)}})):r.borderAtTopBottom&&!r.stampRow?(this.createVCutLineGivenFixedPosition(r,i.y,!0,t),this.createVCutLineGivenFixedPosition(r,i.y+i.height,!0,t)):r.borderAtLeftRight&&!r.stampColumn&&(this.createVCutLineGivenFixedPosition(r,i.x,!1,t),this.createVCutLineGivenFixedPosition(r,i.x+i.width,!1,t))}calcBBox(t,e){let r=this.getBoardBBox2(t,e);this._model.offset=new S(r.offset.x,r.offset.y),x.getInstance().panelizeParam={success:t.success,on:t.on,row:t.row,column:t.column,offset:this._model.offset,onlyOutline:t.onlyOutline};let i={x:r.x,y:r.y,width:r.offset.x*t.column-t.columnSpacing,height:r.offset.y*t.row-t.rowSpacing},n={x:i.x-(t.borderAtLeftRight?t.borderHeight+(t.stampColumn?t.columnSpacing:0):0),y:i.y-(t.borderAtTopBottom?t.borderHeight+(t.stampRow?t.rowSpacing:0):0),width:i.width+(t.borderAtLeftRight?t.borderHeight+(t.stampColumn?t.columnSpacing:0):0)*2,height:i.height+(t.borderAtTopBottom?t.borderHeight+(t.stampRow?t.rowSpacing:0):0)*2,center:{x:i.x+i.width/2,y:i.y+i.height/2}};return this._model.outerBBox=new ut(n.x,n.x+n.width,n.y,n.y+n.height),{bBox:r,innerBBox:i,outerBBox:n}}createVCutLineGivenFixedPosition(t,e,r,i){let n=i.x+(t.borderAtLeftRight?t.borderHeight:0),s=i.x+i.width-(t.borderAtLeftRight?t.borderHeight:0),a=i.y+i.height-(t.borderAtTopBottom?t.borderHeight:0),l=i.y+(t.borderAtTopBottom?t.borderHeight:0),c,h;return r?(c=new S(n,e),h=new S(s,e)):(c=new S(e,a),h=new S(e,l)),this._model.addVCutLine(c,h,r),[c,h]}isIntersect(t,e,r){let[i,n]=[t,e].map(s=>s.map(a=>a instanceof Array?new ut(Math.min(a[0].x,a[1].x),Math.max(a[0].x,a[1].x),Math.min(a[0].y,a[1].y),Math.max(a[0].y,a[1].y)):new ut(a.x,a.x,a.y,a.y)));return n.map(s=>s.transform(r)).some(s=>i.some(a=>s.isIntersect(a)))}createBorder(t,e){let i=new ft().conversion("mm","mil",5)/10,n=t.borderHeight/2,s,a,l,c,h=t.borderHeight-n;t.borderAtTopBottom&&t.borderAtLeftRight?(l=new S(e.x+i+t.borderHeight,e.y+e.height-h),c=l.add1(i,0)):t.borderAtTopBottom?(l=new S(e.x+i,e.y+e.height-h),c=l.add1(i,0)):(l=new S(e.x+h,e.y+i),c=l.add1(0,i)),s=l,a=t.createPositionHole?c:l,t.createPositionHole&&this.getAllMarkHolePosFromTopLeft(s,t,i,e).forEach(d=>this._model.addPositionHole(new S(d.x,d.y),t.positionHoleDiameter)),t.createMark&&this.getAllMarkHolePosFromTopLeft(a,t,i,e).forEach(d=>this._model.addMark(new S(d.x,d.y),t.markDiameter,t.markExpansion))}getAllMarkHolePosFromTopLeft(t,e,r,i){if(e.borderAtTopBottom){let n=t.add1(r,0);return[t,t.mirrorY(i.center),n.mirrorX(i.center),n.mirrorCenter(i.center)]}if(e.borderAtLeftRight){let n=t.add1(0,r);return[t,n.mirrorY(i.center),t.mirrorX(i.center),n.mirrorCenter(i.center)]}}createStampBorderLines(t,e,r,i,n){let s=n==="x"?"y":"x",a=[e[s],e[s]+e[wD[s]]];(t.stampRow&&t.borderAtTopBottom&&n=="x"||t.stampColumn&&t.borderAtLeftRight&&n=="y")&&(a[0]-=t[h9[n]],a[1]+=t[h9[n]]),r[s].forEach(l=>{for(let c=0;c<t[D9e[n]];c++)a.push(l[0][s]+i.offset[s]*c)}),a.sort((l,c)=>l-c);for(let l=1;l<a.length;l+=2){let c=a[l],h=a[l-1],u=[{x:null,y:null},{x:null,y:null}];u[0][n]=e[n]-t[h9[s]],u[0][s]=c,u[1][n]=e[n]-t[h9[s]],u[1][s]=h;let d=new S(u[0].x,u[0].y),p=new S(u[1].x,u[1].y);this._model.addLine(d,p),this._model.borderClosures[0].push(new M(d,p));let m=[{x:null,y:null},{x:null,y:null}];m[0][n]=e[n]+(e[wD[n]]+t[h9[s]]),m[0][s]=c,m[1][n]=e[n]+(e[wD[n]]+t[h9[s]]),m[1][s]=h;let g=new S(m[0].x,m[0].y),y=new S(m[1].x,m[1].y);this._model.addLine(g,y),this._model.borderClosures[1].push(new M(g,y))}}arrayCopyStampLineAndHole(t,e,r,i,n,s){for(let a=0;a<t.row;a++)for(let l=0;l<t.column;l++)if(s==="x"?a<t.row-1:l<t.column-1){let c=new S(e.offset.x*l,e.offset.y*a),h=Qe.translate1(c);for(let d=0;d<r[s].length;d+=2){[r[s][d],r[s][d+1]].forEach(b=>{this._model.addLine(new S(b[0].x,b[0].y).add(c),new S(b[1].x,b[1].y).add(c))});let p=n[s][0][d/2].map(b=>b.multiply3(h)),m=n[s][1][d/2].map(b=>b.multiply3(h)),g=new M(p[0].start(),m[m.length-1].end()),y=new M(m[0].start(),p[p.length-1].end());this._model.closures.push([].concat(p,[g],m,[y]))}let u=i[s].map(d=>d.map(p=>new S(p.x,p.y).add(c))).flat(1);this._model.addStampHoleGroup(u,t.stampHoleDiameter)}}createStampHoleLines(t,e,r,i){let n=t.stampHoleSpacing,s=t.stampHoleDiameter,a={x:t.stampPerRow,y:t.stampPerColumn},l={x:[],y:[]},c={x:[[],[]],y:[[],[]]},h={x:[],y:[]},u=t.stampHolePerGroup;if(["x","y"].forEach(p=>{let m=p==="x"?"y":"x";for(let g=0;g<a[p];g++){let y=e[p]+(g+1)/(a[p]+1)*e[wD[p]];[-1,1].forEach(b=>{let P={type:"stampLine"};P[p]=y+(n*(u/2-.3)+s/2)*b,l[p].push(P)});for(let b=0;b<u;b++){let P={type:"stampHole"};P[p]=y+n*(b-(u-1)/2),l[p].push(P)}}l[p].forEach(g=>{let y=p==="x"?new M(new S(g.x,e.y),new S(g.x,+e.y+e.height)):new M(new S(e.x,g.y),new S(+e.x+e.width,g.y)),b=this.getInterSections2(i,y,m);if(b.up&&(b.up.position[m]+=g.type==="stampHole"?s/6:0),b.down&&(b.down.position[m]-=g.type==="stampHole"?s/6:0,m=="y"?b.down.position.y+=e.offset.y:b.down.position.x+=e.offset.x),b.down&&b.up){let P=[b.up,b.down];g.type==="stampLine"?h[p].push(P.reverse()):g.type==="stampHole"&&P.forEach((T,I)=>c[p][I].push(T))}})}),h.x.length<2||h.y.length<2)return;let d={x:[],y:[]};["x","y"].forEach(p=>{[0,1].forEach(m=>{for(let g=0;g<h[p].length;g+=2){let y=[],b=h[p][g][m],P=h[p][g+1][m],[T,I]=p=="x"==(m==0)?[P,b]:[b,P];if(T.polyline==I.polyline){let C=T.polyIndex,E=I.polyIndex,O=Qe.translate1(p=="x"?new S(0,this._model.offset.y):new S(this._model.offset.x,0)),_=m==0?T.polyline.primitives.map(v=>v.multiply3(O)):T.polyline.primitives,R=bc.modifyStart(T.position,_[C]);if(C==E)y.push(bc.modifyEnd(I.position,R));else{y.push(R);for(let D=C+1,w=_.length;D<E+(C<E?0:w);D++)y.push(_[D%w]);let v=bc.modifyEnd(I.position,_[E]);y.push(v)}}else y.push(new M(T.position,I.position));d[p][m]||(d[p][m]=[]),d[p][m].push(y)}})}),h={x:h.x.map(p=>p.map(m=>m.position)),y:h.y.map(p=>p.map(m=>m.position))},c={x:c.x.map(p=>p.map(m=>m.position)),y:c.y.map(p=>p.map(m=>m.position))},t.stampRow&&t.borderAtTopBottom&&(this.createStampBorderLines(t,r,h,e,"y"),this.createStampHoleLineAlongBorder(t,e,c,h,d,r,"y")),t.stampColumn&&t.borderAtLeftRight&&(this.createStampBorderLines(t,r,h,e,"x"),this.createStampHoleLineAlongBorder(t,e,c,h,d,r,"x")),t.stampRow&&this.arrayCopyStampLineAndHole(t,e,h,c,d,"x"),t.stampColumn&&this.arrayCopyStampLineAndHole(t,e,h,c,d,"y")}createStampHoleLineAlongBorder(t,e,r,i,n,s,a){let l=t.stampHoleDiameter,c=a==="x"?"y":"x";for(let h=0;h<t[D9e[a]];h++)r[c][0].forEach(u=>{let d={x:null,y:null};d[a]=u[a]+e.offset[a]*(t[D9e[c]]-1),d[c]=u[c]+e.offset[c]*h,this._model.addStampHole(new S(d.x,d.y),l)}),r[c][1].forEach(u=>{let d={x:null,y:null};d[a]=u[a]-e.offset[a],d[c]=u[c]+e.offset[c]*h,this._model.addStampHole(new S(d.x,d.y),l)}),i[c].forEach(u=>{let d=[{x:null,y:null},{x:null,y:null}];d[0][a]=u[0][a]-e.offset[a],d[0][c]=u[0][c]+e.offset[c]*h,d[1][a]=s[a]-t[h9[c]],d[1][c]=u[1][c]+e.offset[c]*h;let p=new S(d[0].x,d[0].y),m=new S(d[1].x,d[1].y);this._model.addLine(p,m),this._model.borderClosures[0].push(new M(p,m));let g=a=="x"?new S(-e.offset[a],e.offset[c]*h):new S(e.offset[c]*h,-e.offset[a]);this._model.borderClosures[0].push(...this.flatten(n[c][0]).map(I=>I.multiply3(Qe.translate1(g))));let y=[{x:null,y:null},{x:null,y:null}];y[0][a]=s[a]+(s[wD[a]]+t[h9[c]]),y[0][c]=u[0][c]+e.offset[c]*h,y[1][a]=u[1][a]+(s[wD[a]]-e.offset[a]+t[h9[c]]),y[1][c]=u[1][c]+e.offset[c]*h;let b=new S(y[0].x,y[0].y),P=new S(y[1].x,y[1].y);this._model.addLine(b,P),this._model.borderClosures[1].push(new M(b,P));let T=a=="x"?new S(s[wD[a]]-e.offset[a]+t[h9[c]],e.offset[c]*h):new S(e.offset[c]*h,s[wD[a]]-e.offset[a]+t[h9[c]]);this._model.borderClosures[1].push(...this.flatten(n[c][1]).map(I=>I.multiply3(Qe.translate1(T))))})}flatten(t){return t.reduce((e,r)=>(e.push(...r),e),[])}addBorderByPoints(t,e,r,i){for(let n=0;n<t.length;n++){let s=t[n],a,l,c,h;s instanceof S?(this._model.addArc(s,e,Math.PI,Math.PI*1.5),a=q.build3(s,180,180*.5,e,e),this._model.addArc(s.mirrorX(r),e,Math.PI*.5,Math.PI),l=q.build3(s.mirrorX(r),180*.5,180*.5,e,e),this._model.addArc(s.mirrorY(r),e,Math.PI*1.5,Math.PI*2),c=q.build3(s.mirrorY(r),180*1.5,180*.5,e,e),this._model.addArc(s.mirrorCenter(r),e,0,Math.PI*.5),h=q.build3(s.mirrorCenter(r),0,180*.5,e,e)):(this._model.addLine(s[0],s[1]),a=new M(s[0],s[1]),this._model.addLine(s[0].mirrorX(r),s[1].mirrorX(r)),l=new M(s[0].mirrorX(r),s[1].mirrorX(r)),this._model.addLine(s[0].mirrorY(r),s[1].mirrorY(r)),c=new M(s[0].mirrorY(r),s[1].mirrorY(r)),this._model.addLine(s[0].mirrorCenter(r),s[1].mirrorCenter(r)),h=new M(s[0].mirrorCenter(r),s[1].mirrorCenter(r))),i.borderAtTopBottom&&i.borderAtLeftRight?this._model.borderClosures_outerMost.push(a,c,l,h):i.borderAtTopBottom?(this._model.borderClosures[0].push(a,c),this._model.borderClosures[1].push(l,h)):i.borderAtLeftRight&&(this._model.borderClosures[0].push(a,l),this._model.borderClosures[1].push(c,h))}}createOuterMostLine(t,e,r,i,n){!t.stampRow&&t.rowSpacing>0&&[r.x,r.x+r.width].forEach((a,l)=>{let c=new M(new S(a,n.y),new S(a,n.y+n.height)),h=this.getInterSections(e,c,"y");if(h.up&&h.down){let u=h.up,d=h.down.add1(0,r.offset.y*(t.row-1));l==1&&(u=u.add1(i.width-r.width,0),d=d.add1(i.width-r.width,0)),this._model.addLine(u,d)}}),!t.stampColumn&&t.columnSpacing>0&&[r.y,r.y+r.height].forEach((a,l)=>{let c=new M(new S(n.x,a),new S(n.x+n.width,a)),h=this.getInterSections(e,c,"x");if(h.up&&h.down){let u=h.up,d=h.down.add1(r.offset.x*(t.column-1),0);l==1&&(u=u.add1(0,i.height-r.height),d=d.add1(0,i.height-r.height)),this._model.addLine(u,d)}});let s=!1;if(t.borderAtTopBottom&&!t.borderAtLeftRight){if(!t.stampRow&&t.rowSpacing>0){let a=new S(n.x,n.y),l=a.add1(t.borderRadius,t.borderRadius),c=a.add1(0,t.borderRadius),h=a.add1(0,t.borderHeight),u=a.add1(t.borderRadius,0),d=a.add1(n.width/2,0);this.addBorderByPoints([[h,c],l,[u,d]],t.borderRadius,n.center,t),s=!0}}else if(t.borderAtLeftRight&&!t.borderAtTopBottom&&!t.stampColumn&&t.columnSpacing>0){let a=new S(n.x,n.y),l=a.add1(t.borderRadius,0),c=a.add1(t.borderRadius,t.borderRadius),h=a.add1(t.borderHeight,0),u=a.add1(0,t.borderRadius),d=new S(n.x,n.y+n.height/2);this.addBorderByPoints([[h,l],c,[u,d]],t.borderRadius,n.center,t),s=!0}if(!s&&(t.borderAtLeftRight||t.borderAtTopBottom)){let a=new S(n.x,n.y),l=a.add1(t.borderRadius,t.borderRadius),c=a.add1(0,t.borderRadius),h=a.add1(0,t.borderAtLeftRight?n.height/2:t.borderHeight),u=a.add1(t.borderRadius,0),d=a.add1(t.borderAtTopBottom?n.width/2:t.borderHeight,0);this.addBorderByPoints([[h,c],l,[u,d]],t.borderRadius,n.center,t)}}getIntersects(t,e){let r=[];return t.forEach(i=>{for(let n of i.primitives)if(n instanceof M||n instanceof q){let s=[],a=Tt(e,n),l=n instanceof M&&n.direct&&ne.eq(e.direct.cross(n.direct),0);for(let c=0;c<a;c+=2){let h=new S(Ee[c],Ee[c+1]);s.push(h)}l&&s.length>1?r.push(s):s.length>0&&(r=r.concat(s))}}),r}getInterSections2(t,e,r){let i=new Array;for(let s of t){let a=new Array;for(let l=0;l<s.primitives.length;l++){let c=s.primitives[l],h=Tt(e,c);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);a.push({polyline:s,polyIndex:l,position:d})}}a.length>0&&(i=i.concat(a))}let n={};return i.forEach(s=>{(!n.up||+s.position[r]>+n.up.position[r])&&(n.up=s),(!n.down||+s.position[r]<+n.down.position[r])&&(n.down=s)}),n}getInterSections(t,e,r){let i=[];t.forEach(s=>{let a=[];for(let l of s.primitives){let c=Tt(e,l);for(let h=0;h<c;h+=2){let u=new S(Ee[h],Ee[h+1]);a.push(u)}}a.length>0&&(i=i.concat(a))});let n={};return i.forEach(s=>{s&&((!n.up||+s[r]>+n.up[r])&&(n.up=s),(!n.down||+s[r]<+n.down[r])&&(n.down=s))}),n}};var Mse=class extends ng{};var Nse=class extends ET{constructor(t){super(t),this.decode=new Mse}getDecodeTool(){return this.decode}};var E5=class extends Nse{constructor(t,e){super(t),this._world=e}async onlyCompiler(t=!0,e=!0){t&&await this.init(),e&&await this.destroy()}async buildModel(t=!0,e=!0,r=!0){var n;let i="pcbDataStrDecode-time";pn(i),t&&await this.init(),e&&await this.destroy(),this.buildDataModels(),this.syncTextFontPath(),r&&this.applyPanelize(),this.updateExpansionByRule(),this.updateDrcRuleConfig((n=this._world.options)==null?void 0:n.ruleCustomConfig),Bi(i)}async destroy(){this.compiler!=null&&await this.compiler.destroy()}buildDataModels(){this.decode.preAdjust(),this.batchBuildItems()}buildCopperData(t){if(!t)return;let e=new wse;for(let r in t){let i=t[r];e.parse(r,i)}}applyPanelize(){new Lse().applyPanelize()}syncTextFontPath(){mo.getInstance().iterator(t=>{if(t.outline&&t.outline.length>0)return;let e=t.getText();if(e==""||e==null){t.outline=[],t.updateBox4(0,0);return}let r=MA(t.globalIndex,t.fontFamily,e,t.fontSize,t.reverse,t.reverseExpansion,t.strokeWidth);r&&r.path&&(t.outline=r.path,t.updateBox4(r.width,r.height));let i=t.fontFamily,n=i==""||i=="default";n&&!Vy.everyCharHasDefaultFontPath(e)&&(t.fontFamily="\u9ED1\u4F53",n=!1),n?t.type=0:t.type=1})}ruleInitAndCheck(){new dR().ruleInitAndCheck()}updateExpansionByRule(){Tn.getInstance().iterator(t=>{C0(t)}),$n.getInstance().iterator(t=>{C0(t)})}updateDrcRuleConfig(t){if(!t)return;let e=Qa.getInstance(),{config:r,isOpenDRCCustomCheck:i}=t;e.isOpenDRCCustomCheck=i,e.updateConfig(r)}};var OUe=nd(Lb());function VX(o){let{uuid:t,docType:e,projectId:r,env:i}=o,n=i==null?void 0:i.windowTabId;if(n){let s=$();s&&(s._TAB_ID_=n)}return new Pu(t,r,x.getInstance().compilerChannel,n)}function AUe(o){let{uuid:t,docType:e,projectId:r,env:i}=o;x.getInstance().doctype=e,x.getInstance().id=t,x.getInstance().tabId=(i==null?void 0:i.tabId)||t+"@"+r,x.getInstance().currOpenProjectId=r;let n=i==null?void 0:i.windowTabId;if(n){let s=$();s&&(s._TAB_ID_=n)}}var g_=class{constructor(){this.channelIdMapComponentDecode=new Map;this.isMatch=!0;this.items=new Array}async decode(t){let e=VX(t),r=new E5(e,t);await r.onlyCompiler(),this.decodeTool=r.getDecodeTool()}hasComponents(){return this.decodeTool.component.length>0}async parseTemplate(t){if(!t)return;await this.decode(t);let e=this.decodeTool;await e.iterator(r=>{r.partition&&(r.partition="")}),e.preAdjust();for(let r of e.component){let i=r.getReuseBlock();if(i!=null){let n=i.getTemplateMapObjectChannelId();VA(this.channelIdMapComponentDecode,n,r)}else{let n=r.attrsMap["Channel ID"];n!=null&&n!=""&&VA(this.channelIdMapComponentDecode,n,r)}}}reuse(t,e,r){let i=this.decodeTool;if(!i)return;this.keepDisabledLayerItem=r;let n=new Map;for(let p of t)if(p.model.modelType==="Component"){let m=p.channelID;m!=null&&VA(n,m,p)}let s=new Map,a=new Map,l=!1;for(let[p,m]of this.channelIdMapComponentDecode){let g=n.get(p);if(g==null)continue;let y=Qp(P=>P.getFootprintUUID(),m),b=Qp(P=>P.footprintUUID,g);for(let[P,T]of y){let I=b.get(P);if(I!=null)for(let C=0,E=T.length;C<E;C++){let O=T[C],_=I[C];_!=null&&(l=!0,this.syncComponent(_,s,a,O),this.items.push(_))}}}if(!l)return null;this.isMatch=i.component.length==this.items.length,this.copyItems(i.via,s,a),this.copyItems(i.pad,s,a),this.copyItems(i.line,s,a),this.copyItems(i.arc,s,a),this.copyItems(i.poly,s,a),this.copyItems(i.fill,s,a),this.copyItems(i.fpcFill,s,a),this.copyItems(i.region,s,a),this.copyItems(i.pour,s,a),this.copyItems(i.image,s,a),this.copyItems(i.objs,s,a),this.copyItems(i.tearDrop,s,a),this.copyItems(i.str,s,a),this.copyItems(i.dimension,s,a),this.copyItems(i.shells,s,a),this.copyItems(i.shellCuts,s,a),this.copyItems(i.shellEntity,s,a),this.copyItems(i.creases,s,a),this.copyItems(i.bosses,s,a);for(let p of this.items)if(p instanceof ct&&p.type=="TearDrop"){let m=new Array;for(let g of p.getComponent().connects){let y=a[g];y!=null&&m.push(y)}pt.modifyConnect(p,m)}else if(p instanceof Ye&&p.type=="Copper Region"){let m=p.getComponent();if(m instanceof Vn){let g=Ei.nameManager.getNum(m.name);m.name=g,Ei.nameManager.add(g)}}let c=new Q0,h=kt.getAllItem().map(p=>p.name);for(let p of h)c.add(p);let u=e+"_1";return kt.combination(this.items,c.getUniqueName(u))}syncComponent(t,e,r,i){let n=new Array;Re.addAll(n,t.getPads()),Re.addAll(n,t.getVias());let s=t.globalIndex,a=Qp(p=>p instanceof Le?p.num:p.globalIndex.replace(s,""),n),l=Qp(p=>p.num,i.padNets),c=new Set,h=new Set;for(let[p,m]of l){let g=a.get(p);if(g!=null){if(m.length==1&&g.length==1)(e.get(m[0].net)==null||g[0]instanceof Le)&&e.set(m[0].net,g[0].net),r.get(i.index+m[0].id)==null&&(r[i.index+m[0].id]=g[0].globalIndex),c.add(g[0]),h.add(m[0]);else for(let y of m)if(!h.has(y)){for(let b of g)if(!c.has(b)&&s+y.id==b.globalIndex){e.set(y.net,b.net),r.set(i.index+y.id,b.globalIndex),c.add(b),h.add(y);break}}}}let u=Qp(p=>s+p.id,i.padNets);for(let p of n){if(!c.has(p)){for(let m of i.padNets)if(!h.has(m)&&p.globalIndex==s+m.id){e.set(m.net,p.net),r.set(i.index+m.id,p.globalIndex),c.add(p),h.add(m);break}}if(p instanceof Le&&u.get(p.globalIndex)){let m=u.get(p.globalIndex)[0];m.padLen!=null&&as.getInstance().setPadLenByModel(p.model,m.padLen)}}for(let p of n)if(!c.has(p)){for(let m of i.padNets)if(!h.has(m)){e.get(m.net)==null&&e.set(m.net,p.net),r.set(i.index+m.id,p.globalIndex),c.add(p),h.add(m);break}}t.layerId=i.layerId,t.position=i.position,t.rotation=i.rotation;let d=Qp(p=>p.key,i.attrs);for(let[p,m]of d){let g=m[0],y=t.attrKeyText[p];if(y!=null)y.model.layerId=g.layerId,g.x!=null&&g.y!=null?y.model.position=new S(g.x,g.y):y.model.positionIsNull=!0,y.model.rotation=g.angle,y.model.fontSize=g.fontSize,y.model.strokeWidth=g.strokeWidth,y.model.reverse=g.reverse,y.model.reverseExpansion=g.reverseExpansion,y.model.showKey=g.showKey,y.model.showValue=g.showValue,y.model.origin=g.origin,y.model.mirror=g.mirror,y.fontFamily=g.fontFamily,vp.addText(y);else{g.index=t.generateValidId();let b=t.attrKeyValue[p];b!=null&&(g.value=b);let P=g.finish(),T=ti.addtextByModel(P);t.addAttribute(T)}}}hasItems(){let t=this.decodeTool;if(t)return t.component.length>0||t.via.length>0||t.pad.length>0||t.line.length>0||t.arc.length>0||t.poly.length>0||t.fill.length>0||t.fpcFill.length>0||t.region.length>0||t.pour.length>0||t.image.length>0||t.objs.length>0||t.tearDrop.length>0||t.str.length>0||t.dimension.length>0||t.shells.length>0||t.shellCuts.length>0||t.shellEntity.length>0||t.creases.length>0||t.bosses.length>0}copy(t,e){let r=this.decodeTool;if(!r)return;this.keepDisabledLayerItem=e;let i=new Map,n=new Map;this.copyItems(r.component,i,n),this.copyItems(r.via,i,n),this.copyItems(r.pad,i,n),this.copyItems(r.line,i,n),this.copyItems(r.arc,i,n),this.copyItems(r.poly,i,n),this.copyItems(r.fill,i,n),this.copyItems(r.fpcFill,i,n),this.copyItems(r.region,i,n),this.copyItems(r.pour,i,n),this.copyItems(r.image,i,n),this.copyItems(r.objs,i,n),this.copyItems(r.tearDrop,i,n),this.copyItems(r.str,i,n),this.copyItems(r.dimension,i,n),this.copyItems(r.shells,i,n),this.copyItems(r.shellCuts,i,n),this.copyItems(r.shellEntity,i,n),this.copyItems(r.creases,i,n),this.copyItems(r.bosses,i,n);for(let h of this.items)if(h instanceof ct&&h.type=="TearDrop"){let u=new Array;for(let d of h.getComponent().connects){let p=n[d];p!=null&&u.push(p)}pt.modifyConnect(h,u)}else if(h instanceof Ye&&h.type=="Copper Region"){let u=h.getComponent();if(u instanceof Vn){let d=Ei.nameManager.getNum(u.name);u.name=d,Ei.nameManager.add(d)}}let s=new Q0,a=kt.getAllItem().map(h=>h.name);for(let h of a)s.add(h);let l=t+"_1",c=kt.combination(this.items,s.getUniqueName(l));for(let h of this.items)h instanceof Me&&(h.reuseBlock=t,h.combinationID==""&&(h.combinationID=c.globalIndex));return c}copyItems(t,e,r){try{let i=this.keepDisabledLayerItem;t=t.sort((a,l)=>a.order-l.order);let n=gn.getOrders(),s=new Map;for(let a in n){let l=n[a],c=l[l.length-1].getComponent().order;s.set(+a,c)}t.forEach(a=>{if(a.layerId!=null){let u=be.getLayer(a.layerId);if(u==null||!i&&!u.config)return}let l=a.keepDisabledLayerItem;i&&(a.keepDisabledLayerItem=!0),a.clearGroupId(),a.changeNet4Map(e);let c=cr();r.set(a.index,c),a.index=c;let h=$c(a.finish());h!=null&&h instanceof zs&&(h instanceof Ye&&h.type==="Copper Region"&&(h.getComponent().order=(s.get(h.layerId)||0)+1,s.set(h.layerId,h.getComponent().order)),this.items.push(h)),i&&(a.keepDisabledLayerItem=l)})}catch(i){console.log(i)}}getItems(){return this.items}getBasicLayerTable(t){let e={},r=this.decodeTool.layer,i=t.size,n=0;return Rc(r,s=>{let a=s.layerId;if(t.has(a)){let l=s.getType(),c=s.getName(),h={layerId:a,layerType:l,layerName:c};e[a]=h,n++}return n==i}),e}};var kse=class extends hu{constructor(t="2.0"){super(t,3)}saveCombination(t){this.saveCommonData();let e=new Array,r=new Array,i=new Set,n=new Set;for(let s of t){if(s instanceof ii){i.add(s.model);continue}if(s.model.modelType=="Inner"){n.add(s.model);continue}if(s instanceof Me?r.push(s):e.push(s.model),s instanceof Ye&&s.type=="Copper Region")for(let a of s.copperResultMap||[])i.add(a.model)}return this.feedItems(e),this.feedCopper(Array.from(i)),this.feedInner(Array.from(n)),r.forEach(s=>{this.feed("COMPONENT",s.model),s.attributes.forEach(h=>{Cp(h.model,s.model)&&this.feed("ATTR",h.model)}),s.getPads().forEach(h=>{this.feed("PAD_NET",h.model)}),s.getItems().filter(h=>h instanceof Ge).forEach(h=>{this.feed("PAD_NET",h.model)})}),this.getFile()}};function _Ue(o){let t=new kse().saveCombination(o),e=new AV().getCombinationPourResult(o),r=new Set,i=new Set,n=new Array,s=new Set;for(let l of o)if(l instanceof Me){let c=ps.getItem(l.deviceUUID);if(r.add(c),c.footprintUUID!=null){let u=Ji.getItem(l.footprintUUID);i.add(u)}let h=Ji.getItem(l.footprintUUID);if(h instanceof Xc){n.push(h);let u=Ji.getItem(h.source);i.add(u)}else i.add(h)}else l instanceof Rs&&s.add(l.hashId);let a=new Array;for(let l of r){let c=l.attrs;c.uuid=l.uuid,c.utime=l.utime.toString(),c.Footprint=l.footprintUUID,a.push(["DEVICE",l.name,c])}for(let l of i)a.push(["FOOTPRINT",l.footprintId,l.uuid,l.updateTime,l.getSource()]);for(let l of n)a.push(["CUSTOMFOOTPRINT",l.footprintId,l.source,l.uuid,l.getSource()]);return{dataStr:t,copper:e,template:a,blob:s}}function vUe(){let o=Cr.getAllItem(),t=new Map,e=new Map;for(let r of o)if(r.reuseBlock!=""){let i=e.get(r.reuseBlock);i==null&&(i=new Map,e.set(r.reuseBlock,i));let n=i.get(r.combinationID);n==null&&(n=new Array,i.set(r.combinationID,n)),n.push(r)}for(let[r,i]of e)for(let[n,s]of i){let a=r+"_"+n,l=new Set;for(let c of s)if(l.add(c),c.getGroupID()!=null){let h=kt.getItem(c.getGroupID());if(h!=null){let u=h.getItems();for(let d of u)l.add(d)}}l.size>0&&t.set(a,{items:l,title:r})}return t}var Bse=class extends fi{open(t,e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r={};r.action="reuse-template-dialog";let i=vUe(),n={},s=new Set,a=x.getInstance().tabId;for(let[l,c]of i){let h=_Ue(c.items),u=c.title;s.add(u),h.title=c.title,h.tabId=a,n[l]=h,h.isSelected=!0}return r.CBB=n,r.CBBTitle=Array.from(s),r}modify(t){}async close(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(t.action=="confirm"){let r=t.selects,i=t.pcbModule,n=new Set,s=new mi;s.createGroup("Reuse Template for PCB Template");let a={},l=new Map,c=new Map,h=Cr.getAllItem();for(let u of h){u.reuseBlock==""&&u.combinationID!=null&&u.combinationID!=""&&VA(l,u.combinationID,u);let d=c.get(u.reuseBlock);d==null&&(d=new Map,c.set(u.reuseBlock,d));let p=d.get(u.combinationID);p==null&&(p=[],d.set(u.combinationID,p)),p.push(u)}for(let u of r){let d=u.title,p=i[d];if(p==null)continue;let m=u.key.replace(d+"_",""),g=this.getComponents(c,d,m),y=l[m];if(y!=null)for(let E of y)g.push(E);let{bbox:b,pourMaxOrder:P}=this.preprocessComponents(g,s),T=new g_;await T.parseTemplate(p);let I=d+"_"+m,C={title:d,groupId:m,decoder:T,components:g,bbox:b,pourMaxOrder:P};a[I]=C}for(let u in a){let{title:d,components:p,decoder:m,bbox:g,pourMaxOrder:y}=a[u],b=m.reuse(p,d);if(b!=null){m.isMatch||n.add(b.name);let P=b.buildBBox(),T=Ae.translate(g.minX-P.minX,g.maxY-P.maxY,0),I=b.getItems(),C=[];for(let E of I)if(E.transform(T),!(E instanceof Me)){if(E instanceof Ye&&E.type=="Copper Region"){let O=C[E.layerId];O==null&&(O=new Array,C[E.layerId]=O),O.push(E);continue}s.addCommand4Item(E,"add")}for(let E in C){let O=y[E];O!=null&&gn.insertAfter(C[E],O,s.getCommand());for(let _ of C[E])s.addCommand4Item(_,"add")}s.addCommand4Item(b,"add")}}if(n.size>0){let u=x.getInstance().tabId,d=[];for(let p of n){let g={attr:{id:kt.getGroupByName(p).globalIndex,pcbid:u},text:p};d.push(g)}A.publish("ui/toastMsg",{type:"warn",msg:["The number of components in the following group templates is inconsistent with the reuse group, and the missing components are automatically ignored:",...n],bottomBarMsg:{type:"warn",msg:['<span class="i18n">The number of components in the following group templates is inconsistent with the reuse group, and the missing components are automatically ignored:</span>',...d]}},$())}s.execute(),A.publish("autoFill","")}return!0}getComponents(t,e,r){let i=t.get(e);return i==null?null:i.get(r)}preprocessComponents(t,e){let r=null,i=null,n=new _e,s={};for(let a of t)e.addCommand4Item(a,"modify"),n.ext1(a.buildBBox()),r=a.getGroupID(),r!=null&&(i=kt.getItem(r),i!=null&&(n.ext1(i.buildBBox()),this.preprocessCombination(i,e,s)));return n.valid()?{bbox:n.build1(),pourMaxOrder:s}:{bbox:null,pourMaxOrder:s}}recodeCopperOrder(t,e){if(t.type=="Copper Region"){let r=gn.getOrder(t.globalIndex);if(r!=null){let i=t.layerId,n=e[i];if(n==null){e[i]=t;return}n.getComponent().order>r&&(e[i]=t)}}}preprocessCombination(t,e,r){e.addCommand4Item(t,"delete");let i=Array.from(t.getItems());t.dissolution(),A.publish("delete",t);for(let n of i)n instanceof Me||(n instanceof Ye&&this.recodeCopperOrder(n,r),e.addCommand4Item(n,"delete"),n.remove(),A.publish("delete",n))}};var w9e=class{updateAllSubstrateHeight(t){if(!xh(t))return;let e=this.getAllOutline();for(let r of e){let i=r.getComponent();i.substrateHeight=t}}getOneOutline(){let t=Xt.getAllItem();for(let e of t)if(e.type==="3D Shell - Outline")return e;t=pt.getAllItem();for(let e of t)if(e.type==="3D Shell - Outline")return e;t=Zt.getAllItem();for(let e of t)if(e.type==="3D Shell - Outline")return e;return null}getAllOutline(){let t=Xt.getAllItem(),e=Zt.getAllItem(),r=pt.getAllItem();return this.filterOutline(t,e,r)}filterOutline(...t){let e=[];for(let r of t)for(let i of r)i instanceof Ye&&i.type=="3D Shell - Outline"&&e.push(i);return e}correctPushCoverWidthAndHeight(t,e){let r=!1;if(t.type!=="DRAWER")return r;let n=new ft().conversion("mm","mil",5/10),s=n,a=n,{width:l,height:c}=e;return bP()?(s=c>l?s:l/c*a,a=c>l?c/l*s:a,(l<s||c<a)&&(e.height=a,e.width=s,r=!0)):(l<s&&(e.width=s,r=!0),c<a&&(e.height=a,r=!0)),r}},LD=new w9e;var Fse=class{constructor(){this.timeout=null;ie.subscribe("CopperOrderUndo",()=>{this.debounce(this.sendCopperOrderUndoSuccess)}),ie.subscribe("CopperOrderRedo",()=>{this.debounce(this.sendCopperOrderRedoSuccess)})}debounce(t){this.timeout!=null&&clearTimeout(this.timeout),this.timeout=setTimeout(()=>{t(),this.timeout=null},10)}sendCopperOrderUndoSuccess(){ie.publish("ui/toastMsg",{type:"info",msg:"Undo successful, the copper priority has been modified in this operation"},$())}sendCopperOrderRedoSuccess(){ie.publish("ui/toastMsg",{type:"info",msg:"Redo successful, the copper priority has been modified in this operation"},$())}};var L9e=class{constructor(){this.path=[]}getPath(){return Array.from(this.path)}clear(){this.path.forEach(t=>t.remove()),this.path.length=0}dis(t,e=3,r={}){r=typeof r=="number"?{width:r}:r;let i={width:.1,showPointAsFork:!0,arrowLayerIdOrColor:ee.Silver,arrowAngle:30,...r};i.arrowLength=i.arrowLength?i.arrowLength:Math.min(i.width*6,.6),t=Array.isArray(t)?t:[t];let n=this.getPts(t),s=[];n=n.filter(h=>{if(h.length()>=1e-8)return!0;s.push(h)});let a=i.arrow?this.getArrowPts(n,i.arrowAngle,i.arrowLength):[],l=this.getColor(e),c=this.getColor(i.arrowLayerIdOrColor);this.displayPrimitives(n,i.width,l),this.displayPrimitives(a,i.width,c),i.showPointAsFork&&this.disP(s)}disP(t,e=ee.GREEN,r=.7){t=Array.isArray(t)?t:[t];let i=this.getPts(t),n=this.getColor(e),s=i.flatMap(c=>[c.start(),c.end()]),a=r/2,l=s.flatMap(c=>{let u=new _e().ext2(c).ext7(a).build1(),d=new M(u.UL(),u.LR()),p=new M(u.LL(),u.UR());return this.displayPrimitives([d,p],.05,n)});this.path.push(...l)}disA(t,e=ee.Silver,r){this.dis(t,3,{width:.15,arrow:!0,arrowLayerIdOrColor:e,arrowLength:r})}disFromMath(t,e,r){var s;let i=t;if(i instanceof _n)return;let n=(s=i.model)==null?void 0:s.getMathGraphics(e||(i==null?void 0:i.layerId));n&&this.dis(n,r)}getColor(t){return typeof t=="number"?$e.getInstance().getLayer(t).activeColor:t}getArrowPts(t,e,r){return t.flatMap(i=>{let n=S.ORIGIN;if(i instanceof M)n=i.direct;else if(i instanceof q){let d=i.end().sub(i.center);n=new S(d.y,-d.x).normalize(),(d.cross(n)<0&&i.sweep()===le.CCW||d.cross(n)>0&&i.sweep()===le.CW)&&(n=n.mul(-1))}let s=i.end(),a=e/180*Math.PI,l=n.rotate(S.ORIGIN,a),c=n.rotate(S.ORIGIN,-a),h=new M(s.sub(l.mul(r)),s),u=new M(s.sub(c.mul(r)),s);return[h,u]})}getPts(t){let e=[];return t.forEach((r,i)=>{if(r instanceof S)e.push(new M(r,r));else if(r instanceof ut){let n=[r.UL(),r.UR(),r.LR(),r.LL(),r.UL()],s=[];for(let a=0;a<n.length-1;a++)s.push(new M(n[a],n[a+1]));e.push(...s)}else r instanceof fe?e.push(...r.primitives):r instanceof M||r instanceof q?e.push(r):(r instanceof Ar||r instanceof $d||r instanceof Si)&&e.push(r.primitive)}),e}displayPrimitives(t,e,r=ee.BLACK){let i=[];for(let n of t)if(n instanceof M)i.push(Yi.build(1002,n.start(),n.end(),e,r));else if(n instanceof q){let s=n.sweep(),a=n.startAngle%360,l=n.endAngle()%360;a<0&&(a=360+a),l<0&&(l=360+l);let c=mh(a),h=mh(l);ne.eq(a,l)&&(a>l&&(h=a-1e-8),a<l&&(h=a+1e-8)),i.push(Zo.build(1002,n.center,n.rx,e,c,h,s,r))}return i.forEach(n=>n.refreshRender()),this.path.push(...i),i}log(t){let e=this.getPts(t);console.log(),console.log("------------------- ShowPl -------------------"),console.log("\u81EA\u76F8\u4EA4 ",No(fe.build2(e))?"Yes":"No");let r=(()=>{let a=[];for(let l=0;l<e.length;l++){let c=e[l-1],h=e[l];if(l===0)a.push([0]);else{if((c instanceof M||c instanceof q)&&(h instanceof M||h instanceof q)&&c.end().distance1(h.start())<1e-8){a[a.length-1].push(l);continue}a.push([l])}}return a})();console.log("\u6309\u662F\u5426\u8FDE\u7EED\u5206\u7EC4(\u8BEF\u5DEE1e-8) ",r);let i=e.length>1&&r.length==1&&e[0].start().distance1(e[e.length-1].end())<1e-8;console.log("\u662F\u5426\u95ED\u5408\u591A\u8FB9\u5F62 ",i);let n=a=>`${a.x}, ${a.y}`,s=e.map(a=>{if(a instanceof M)return{Type:"L",Start:n(a.start()),End:n(a.end()),Len:a.length()};if(a instanceof q){let l={radius:a.rx,startAngle:a.startAngle,endAngle:a.endAngle(),sweep:a.sweep()===le.CCW?"\u9006":"\u987A"};return{Type:"Arc",Start:n(a.start()),End:n(a.end()),Len:a.length(),Data:JSON.stringify(l)}}return{Type:"\u7A7A"}});console.table(s,["Type","Start","End","Len","Data"]),console.log(e),console.log("------------------- ShowPl -------------------"),console.log()}},O5=new L9e;function xUe(o,t=1){let e=new Array;return o.forEach(r=>{let i=new Array,n=r.primitives,s=!1;for(let a of n)if(a instanceof M)i.push(a.start().x*t),i.push(a.start().y*t),s||(i.push("L"),s=!0);else if(a instanceof q)s=!1,i.push(a.start().x*t),i.push(a.start().y*t),i.push("ARC"),i.push(a.sweepAngle);else if(a instanceof Mr){s=!1,i.push(a.start().x*t),i.push(a.start().y*t),i.push("C");for(let l=1,c=a.controls.length;l<c-1;l++){let h=a.controls[l];i.push(h.x*t),i.push(h.y*t)}}i.length>2&&(i.push(n[n.length-1].end().x*t),i.push(n[n.length-1].end().y*t),e.push(i))}),e}var RUe=te.getInstance(),t5n=Qa.getInstance(),Vse=class{constructor(){this.drcMap=sn.getInstance().drcMap;this.toBeCheckMap={};this.filter=new K1;this.maxClearances={}}updates(t,e={}){var i;let r=0;for(let n of t)this.update(n,e),(i=e.callback)==null||i.call(e,++r/t.length);return this.getMap()}update(t,e){let{checkSameNet:r,forceCheckPair:i,excludeCheckPair:n}=e,s=this.drcMap;this.filter.checkSameNet=r;let a=this.getShapeMaxClearance(t,oi.isHole(t)),l=t.buildBBox().extendOfSize(a),c=t.layerId,h=d=>c==11||c==12||d==11||d==12?!0:d==c,u=s.search(l,h);for(let d of u)this.hasInMap(t,d)||!(i&&i([t,d]))&&(n&&!n([t,d])||!this.filter.check(t,d))||this.add2BeCheckMap(t,d,3);for(let d of u){let p=oi.getModelPairHoleStatus(t,d);if(p==3)continue;let m=g=>{let y=this.filter.isOpenDRCCustomCheck(),b=this.filter.checkHole(t,d,g);if(this.hasInMap(t,d,g))return;if(!(i?i([t,d]):!1)){if(n&&!n([t,d]))return;y||g!==3&&this.filter.commonCheck(t,d,g)&&this.add2BeCheckMap(t,d,g),y&&b&&this.add2BeCheckMap(t,d,g)}};p==2?(m(0),m(1),m(2)):m(p)}}getModelPairStatus(t,e){return/hole_/.test(t)&&/hole_/.test(e)?2:/hole_/.test(t)&&!/hole_/.test(e)?0:!/hole_/.test(t)&&/hole_/.test(e)?1:3}getMap(){let t=[];for(let e in this.toBeCheckMap){let r=this.toBeCheckMap[e];for(let i in r){let n=r[i];t.push([].concat(n,[this.getModelPairStatus(e,i)]))}}return t}getShapeMaxClearance(t,e){let r=G1(t);if(this.maxClearances[r]==null&&(this.maxClearances[r]=RUe.getItemMaxClearance(r)),e){let i={};i[12]=RUe.getItemMaxClearance(12),this.maxClearances[r]<i[12]&&(this.maxClearances[r]=i[12])}return this.maxClearances[r]}hasInMap(t,e,r){let[i,n]=this.getMapIds(t,e,r);return this.toBeCheckMap[i]&&this.toBeCheckMap[i][n]}add2BeCheckMap(t,e,r){let{globalIndex:i}=t,{globalIndex:n}=e;switch(r){case 0:i="hole_"+i;break;case 1:n="hole_"+n;break;case 2:i="hole_"+i,n="hole_"+n;break}let s=this.compareIds(i,n)>0;if(s){let a=i;i=n,n=a}this.toBeCheckMap[i]==null&&(this.toBeCheckMap[i]={}),this.toBeCheckMap[i][n]=s?[e,t]:[t,e]}compareIds(t,e){let r=/([a-zA-Z]+|\d+)/g,i=t.match(r),n=e.match(r);for(let s=0;s<Math.min(i.length,n.length);s++){let a=i[s],l=n[s],c=!isNaN(Number(a)),h=!isNaN(Number(l));if(c&&h){let u=parseInt(a,10),d=parseInt(l,10);if(u!==d)return u-d}else{if(c)return-1;if(h)return 1;if(a!==l)return a.localeCompare(l)}}return i.length-n.length}getMapIds(t,e,r){let{globalIndex:i}=t,{globalIndex:n}=e;switch(r){case 0:i="hole_"+i;break;case 1:n="hole_"+n;break;case 2:i="hole_"+i,n="hole_"+n;break}return[i,n].sort(this.compareIds)}};var ed=class{constructor(t,e,r=null,i){this.relate=t,this.distance=e,this.line=r,this._holeState=i}syncCollideLayerIds(t){t&&t.length>0&&(t=t.filter(e=>e!==11),this.collideLayerIds=t)}};var CC=class extends QB{checkCache(t,e,r){let i=[];if(t instanceof Ud){if(e instanceof Ud){let n=(t.width+e.width)/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}else if(e instanceof Pp){let n=(t.width+e.width)/2,s=e.getShapes(t.shape,n+r);for(let a of s){let l=this.check(t.shape,a,n+r);l=this.getResSubWidth(l,n),i.push(l)}}else if(e instanceof ud){let n=t.width/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}else if(e instanceof Cd){let n=(t.width+e.width)/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}}else if(t instanceof Pp){if(e instanceof Ud){let n=(t.width+e.width)/2,s=t.getShapes(e.shape,n+r);for(let a of s){let l=this.check(e.shape,a,n+r);l=this.getResSubWidth(l,n),i.push(l)}}else if(e instanceof Pp){let n=t.shape,s=(t.width+e.width)/2;for(let a of n){let l=e.getShapes(a,s+r);for(let c of l){let h=this.check(c,a,s+r);h=this.getResSubWidth(h,s),i.push(h)}}}else if(e instanceof ud){let n=t.width/2,s=t.getShapes(e.shape,n+r);for(let a of s){let l=this.check(e.shape,a,n+r);l=this.getResSubWidth(l,n),i.push(l)}}else if(e instanceof Cd){let n=(t.width+e.width)/2,s=t.getShapes(e.shape,n+r);for(let a of s){let l=this.check(e.shape,a,n+r);l=this.getResSubWidth(l,n),i.push(l)}}}else if(t instanceof ud){if(e instanceof Ud){let n=e.width/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}else if(e instanceof Pp){let n=e.width/2,s=e.getShapes(t.shape,n+r);for(let a of s){let l=this.check(t.shape,a,n+r);l=this.getResSubWidth(l,n),i.push(l)}}else if(e instanceof ud){let n=this.check(t.shape,e.shape,r);i.push(n)}else if(e instanceof Cd){let n=e.width/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}}else if(t instanceof Cd){if(e instanceof Ud){let n=(t.width+e.width)/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}else if(e instanceof Pp){let n=(t.width+e.width)/2,s=e.getShapes(t.shape,n+r);for(let a of s){let l=this.check(t.shape,a,n+r);l=this.getResSubWidth(l,n),i.push(l)}}else if(e instanceof ud){let n=t.width/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}else if(e instanceof Cd){let n=(t.width+e.width)/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}}return xr(i,(n,s)=>n.distance-s.distance),i[0]}getResSubWidth(t,e){return t===null?null:new ed(t.relate,Math.max(t.distance-e,0),t.line)}adjustCollisionLine(t,e,r){if(t===null)return null;if(ne.eq(t.length(),0))return t;let i=this.determinePointOwner(t.start(),e,r),n=this.determinePointOwner(t.end(),e,r);if(i===n)return t;let s=this.getHalfWidth(e),a=this.getHalfWidth(r),l=t.end().sub(t.start()).normalize(),c,h;i===1?(c=t.start().add(l.mul(s)),h=t.end().sub(l.mul(a))):(c=t.end().sub(l.mul(s)),h=t.start().add(l.mul(a)));let u=c.add(h).mul(.5);return new M(u,u)}determinePointOwner(t,e,r){let i=this.getDistanceToCacheMidline(t,e),n=this.getDistanceToCacheMidline(t,r);return i<=n?1:2}getDistanceToCacheMidline(t,e){if(e instanceof Ud){let r=e.shape;return ir.getMinDistanceFromPoint(t,r)}else{if(e instanceof ud)return this.getMinDistanceFromPrimitives(t,e.shape.primitives);if(e instanceof Cd){let r=[];for(let i of e.shape.items)r.push(...i.primitives);if(r.length>7){let i=this.getPrimitiveRTree(r),n=t.bbox().extendOfSize(1e-6),s=i.search(n);if(s.length===0){let a=this.getMaxBBox(r),l=t.bbox().extendOfSize(Math.max(a.width(),a.height())),c=i.search(l);return this.getMinDistanceFromPrimitives(t,c)}return this.getMinDistanceFromPrimitives(t,s)}return this.getMinDistanceFromPrimitives(t,r)}}return Number.MAX_VALUE}getHalfWidth(t){return t instanceof Ud||t instanceof Cd?t.width/2:0}getMinDistanceFromPrimitives(t,e){let r=Number.MAX_VALUE;for(let i of e){let n=ir.getMinDistanceFromPoint(t,i);n<r&&(r=n)}return r}getMaxBBox(t){let e=null;for(let r of t){let i=r.bbox();e===null?e=i:e=ut.extend2(e,i)}return e||new ut(0,0,0,0)}getPrimitiveRTree(t){let e=new nn(7);for(let r of t)e.add(r);return e}check(t,e,r){if(!t.bbox().isIntersect(e.bbox().extendOfSize(r)))return new ed(3,Number.MAX_VALUE);if(t instanceof Tl){if(e instanceof Tl)return this.checkPts(t,e,r);if(e instanceof fe)return this.checkPt2Pl(t,e,r);if(e instanceof Gt)return this.checkPt2PlGrp(t,e,r)}else if(t instanceof fe){if(e instanceof Tl)return this.checkPt2Pl(e,t,r);if(e instanceof fe)return this.checkPls(t,e,r);if(e instanceof Gt)return this.checkPl2PlGrp(t,e,r)}else if(t instanceof Gt){if(e instanceof Tl)return this.checkPt2PlGrp(e,t,r);if(e instanceof fe)return this.checkPl2PlGrp(e,t,r);if(e instanceof Gt)return this.checkPlGrps(t,e,r)}}checkPts(t,e,r){let i=new ir(t,e),n=i.getDistance(),s=ne.lesseq(n,r)?0:3;return new ed(s,i.getDistance(),i.getLine())}checkPt2Pl(t,e,r){let i=!0,n=Jr.inPolyline(t.start(),e);if(n||(n=Jr.inPolyline(t.end(),e),i=!1),n){let s=i?t.start():t.end();return new ed(0,0,new M(s,s))}else{let s=3,a=Number.MAX_VALUE,l=null,c=t.bbox().extendOfSize(r);for(let h of e.primitives){if(this.isPoints(h)||!c.isIntersect(h.bbox()))continue;let u=new ir(h,t),d=u.getDistance(),p=u.getLine();if(ne.less(d,a)&&(a=d,l=p),ne.lesseq(a,r)&&(s=0),ne.eq(a,0))break}return new ed(s,a,l)}}checkPt2PlGrp(t,e,r){let i=Jr.inPolygon(t.start(),e.items);if(i||(i=Jr.inPolygon(t.end(),e.items)),i){let n=t.start().add(t.end()).mul(.5);return new ed(0,0,new M(n,n))}else{let n=3,s=Number.MAX_VALUE,a=null,l=t.bbox().extendOfSize(r),h=this.getRtree(e).search(l);for(let u of h){if(this.isPoints(u)||!l.isIntersect(u.bbox()))continue;let d=new ir(u,t),p=d.getDistance(),m=d.getLine();if(ne.less(p,s)&&(s=p,a=m),ne.lesseq(s,r)&&(n=0),ne.eq(s,0))break}return new ed(n,s,a)}}checkPls(t,e,r){let i=Jr.inPolyline(t.start(),e);if(i||(i=Jr.inPolyline(e.end(),t)),i)return new ed(0,0,new M(t.start(),t.start()));{let n=3,s=Number.MAX_VALUE,a=null;for(let l of t.primitives){if(this.isPoints(l))continue;let c=l.bbox().extendOfSize(r);if(c.isIntersect(e.bbox())){for(let h of e.primitives){if(this.isPoints(h)||!c.isIntersect(h.bbox()))continue;let u=new ir(l,h),d=u.getDistance(),p=u.getLine();if(ne.less(d,s)&&(s=d,a=p),ne.lesseq(s,r)&&(n=0),ne.eq(s,0))break}if(ne.eq(s,0))break}}return new ed(n,s,a)}}checkPl2PlGrp(t,e,r){let i=Jr.inPolygon(t.start(),e.items);if(i||(i=Jr.inPolyline(e.items[0].start(),t)),i)return new ed(0,0,new M(t.start(),t.start()));{let n=3,s=Number.MAX_VALUE,a=null,l=this.getRtree(e);for(let c of t.primitives){if(this.isPoints(c))continue;let h=c.bbox().extendOfSize(r),u=l.search(h);for(let d of u){if(this.isPoints(d)||!h.isIntersect(d.bbox()))continue;let p=new ir(d,c),m=p.getDistance(),g=p.getLine();if(ne.less(m,s)&&(s=m,a=g),ne.lesseq(s,r)&&(n=0),ne.eq(s,0))break}if(ne.eq(s,0))break}return new ed(n,s,a)}}checkPlGrps(t,e,r){let i=Jr.inPolygon(t.items[0].start(),e.items),n=new M(t.items[0].start(),t.items[0].start());if(i||(i=Jr.inPolygon(e.items[0].start(),t.items),n=new M(e.items[0].start(),e.items[0].start())),i)return new ed(0,0,n);{let s=3,a=Number.MAX_VALUE,l=null;if(t.bbox().area()>e.bbox().area()){let c=this.getRtree(t);for(let h of e.items)for(let u of h.primitives){if(this.isPoints(u))continue;let d=u.bbox().extendOfSize(r),p=c.search(d);for(let m of p){if(this.isPoints(m)||!d.isIntersect(m.bbox()))continue;let g=new ir(m,u),y=g.getDistance(),b=g.getLine();if(ne.less(y,a)&&(a=y,l=b),ne.lesseq(a,r)&&(s=0),ne.eq(a,0))break}}}else{let c=this.getRtree(e);for(let h of t.items)for(let u of h.primitives){if(this.isPoints(u))continue;let d=u.bbox().extendOfSize(r),p=c.search(d);for(let m of p){if(this.isPoints(m)||!d.isIntersect(m.bbox()))continue;let g=new ir(m,u),y=g.getDistance(),b=g.getLine();if(ne.less(y,a)&&(a=y,l=b),ne.lesseq(a,r)&&(s=0),ne.eq(a,0))break}}}return new ed(s,a,l)}}};var Gse=class{constructor(t,e,r){this.id1=t,this.id2=e,this.relation=r}getResult(){let{id1:t,id2:e,relation:r}=this,{relation:i,distance:n,line:s,holeState:a,collideLayerIds:l}=r;return{id1:t,id2:e,relation:i,distance:n,line:s,collideLayerIds:l,...a!==void 0&&{holeState:a}}}};var R3=class{constructor(){this.collisionAl=new CC;this.copperLayerIds=$e.getInstance().getAllCopperLayerId4Order();this.drcEnv=sn.getInstance();this.drcEnv.checkEnv==0&&(this.result=new Array)}initCheckFunc(t,e){let r=this.curryCommonCheck(t,e);return(i,n)=>{let s=r(i,n);return this.check2Result(t,e,s)}}getRuleInfos(t,e,r,i){let n=By(r,i);return this.drcEnv.ruleHelper.getShape2Clearance(t,e,void 0,this._holeStatus,n)}commonCheck(t,e,r=t.layerId,i=e.layerId){let n=this.getRuleInfos(t,e,r,i),s=oi.isProhibit(t)||oi.isProhibit(e),a=Math.max(xe(n.clearance,2),0);if(!s&&!this.drcEnv.checkSameNet&&a===0)return;let l=bh.getCache(t,r),c=bh.getCache(e,i),h=this.collisionAl.checkCache(l,c,a);return h&&(h.ruleInfos=n),h}curryCommonCheck(t,e){return(r,i)=>{let n=this.commonCheck(t,e,r,i);return n!=null&&(this._holeStatus!==void 0&&(n._holeState=this._holeStatus),n.syncCollideLayerIds([r,i])),n}}check2Result(t,e,r){return r&&this.checkIsDRCError(t,e,r)?(this.drcEnv.checkEnv==0?((t.modelType=="Copper"||t.modelType=="Inner")&&this.drcEnv.filterCopper(t),(e.modelType=="Copper"||e.modelType=="Inner")&&this.drcEnv.filterCopper(e),this.result.push(new Gse(t.globalIndex,e.globalIndex,{distance:r.distance,line:r.line,relation:r.relate,holeState:r._holeState,collideLayerIds:r.collideLayerIds}))):uf.addError_Worker({shape1:t,shape2:e,distance:r.distance,line:r.line,relation:r.relate,collideLayerIds:r.collideLayerIds,...r._holeState!==void 0&&{holeState:r._holeState},ruleInfos:r.ruleInfos}),!0):!1}checkIsDRCError(t,e,r){if(!r)return!1;let i=xe(r.distance,2);if(oi.isProhibit(t)||oi.isProhibit(e))return i===0;let n=xe(r.ruleInfos.clearance,2);return n<0?!1:this.drcEnv.checkSameNet?i<=n:i<n}swapHoleStatus(){this._holeStatus==0?this._holeStatus=1:this._holeStatus==1&&(this._holeStatus=0)}};var Use=class extends R3{checkShapeRelation(t,e,r){let i=this.initCheckFunc(t,e);if(r!==void 0&&(r==0&&(r=1),this._holeStatus=r),!(e instanceof lr&&oi.isProhibit(e)&&!e.component.copper))if(e instanceof Je){if((this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||e.layerId==12&&this._holeStatus==1&&i(t.layerId,12))return}else return e instanceof It?(!e.isContains(t.layerId)||(this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||this._holeStatus==1&&i(t.layerId,12),void 0):i(t.layerId,t.layerId)}};var Hse=class extends R3{checkShapeRelation(t,e,r){let i=this.initCheckFunc(t,e);if(r!==void 0&&(r==0&&(r=1),this._holeStatus=r),!(e instanceof lr&&oi.isProhibit(e)&&!e.component.planzone)){if(e instanceof Cn)return i(t.layerId,e.layerId);if(e instanceof Je){if((this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||e.layerId==12&&this._holeStatus==1&&i(t.layerId,12))return}else return e instanceof It?(!e.isContains(t.layerId)||(this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||this._holeStatus==1&&i(t.layerId,12),void 0):i(t.layerId,e.layerId)}}};var Wse=class extends R3{checkShapeRelation(t,e,r){r!==void 0&&(this._holeStatus=r),this.checkError2Result=this.initCheckFunc(t,e),!this.checkProhibit(t,e)&&(this.dispatchOutline(t,e)||(oi.isSingleLayerShape(t)&&oi.isSingleLayerShape(e)?this.checkSingleSingle(t,e):!oi.isSingleLayerShape(t)&&!oi.isSingleLayerShape(e)?this.dispatchMultiMulti(t,e):oi.isSingleLayerShape(t)?this.checkSingleMulti(t,e):(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkSingleMulti(e,t))))}checkProhibit(t,e){if(oi.isProhibit(t)||oi.isProhibit(e)){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}return!1}dispatchOutline(t,e){return oi.isBoardOutline(t)?(oi.isSingleLayerShape(e)?this.checkOutlineSingle(t,e):this.dispatchOutlineMulti(t,e),!0):oi.isBoardOutline(e)?(oi.isSingleLayerShape(t)?this.checkOutlineSingle(e,t):(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.dispatchOutlineMulti(e,t)),!0):!1}checkOutlineSingle(t,e){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([e.layerId]),this.check2Result(t,e,r)}dispatchOutlineMulti(t,e){e instanceof Je?this.checkOutlinePad(t,e):e instanceof It?this.checkOutlineVia(t,e):oi.isSlot(e)&&this.checkOutlineSlot(t,e)}checkOutlinePad(t,e){if(!(this._holeStatus==1&&this.checkError2Result(t.layerId,12))&&(this._holeStatus===void 0||this._holeStatus===3)){for(let r of this.copperLayerIds)if(!e.isUnuseLayer(r)&&this.checkError2Result(t.layerId,r))return}}checkOutlineVia(t,e){if(this._holeStatus===void 0||this._holeStatus===3){for(let r of this.copperLayerIds)if(!e.isUnuseLayer(r))return this.checkError2Result(t.layerId,r)}this._holeStatus===1&&this.checkError2Result(t.layerId,12)}checkOutlineSlot(t,e){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}checkSingleSingle(t,e){let r=this.commonCheck(t,e,t.layerId,t.layerId);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}checkSingleMulti(t,e){if(!(e instanceof It&&!e.isContains(t.layerId))){if(this._holeStatus===void 0||this._holeStatus==3){if(e instanceof Je){if(!e.isUnuseLayer(t.layerId))return this.checkError2Result(t.layerId,t.layerId)}else if(e instanceof It&&e.isContains(t.layerId)&&!e.isUnuseLayer(t.layerId))return this.checkError2Result(t.layerId,t.layerId)}(this._holeStatus==1||e instanceof lr)&&this.checkError2Result(t.layerId,12)}}dispatchMultiMulti(t,e){t instanceof Je?this.dispatchPad(t,e):t instanceof It?this.dispatchVia(t,e):this.dispatchMulti(t,e)}dispatchPad(t,e){e instanceof Je?this.checkPadPad(t,e):e instanceof It?this.checkPadVia(t,e):this.checkPadMulti(t,e)}dispatchVia(t,e){e instanceof Je?(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkPadVia(e,t)):e instanceof It?this.checkViaVia(t,e):this.checkViaMulti(t,e)}dispatchMulti(t,e){e instanceof Je?(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkPadMulti(e,t)):e instanceof It?(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkViaMulti(e,t)):this.checkMultiMulti(t,e)}checkPadPad(t,e){let r=this._holeStatus===0,i=this._holeStatus===1,n=this._holeStatus===2,s=this._holeStatus===void 0||this._holeStatus===3;for(let a of this.copperLayerIds){if([1,2].includes(a)){if(r&&this.checkError2Result(12,a)||i&&this.checkError2Result(a,12))break}else if(r&&!e.isUnuseLayer(a)&&this.checkError2Result(12,a)||i&&!t.isUnuseLayer(a)&&this.checkError2Result(a,12))break;if(s&&!t.isUnuseLayer(a)&&!e.isUnuseLayer(a)&&this.checkError2Result(a,a))break}n&&this.checkError2Result(12,12)}checkPadVia(t,e){let r=this._holeStatus===0,i=this._holeStatus===1,n=this._holeStatus===2,s=this._holeStatus===void 0||this._holeStatus===3;for(let a of this.copperLayerIds){if([1,2].includes(a)){if(r&&this.checkError2Result(12,a)||i&&this.checkError2Result(a,12))break}else if(r&&!e.isUnuseLayer(a)&&this.checkError2Result(12,a)||i&&!t.isUnuseLayer(a)&&this.checkError2Result(a,12))break;if(s&&!t.isUnuseLayer(a)&&!e.isUnuseLayer(a)&&this.checkError2Result(a,a))break}n&&this.checkError2Result(12,12)}checkPadMulti(t,e){if(this._holeStatus===void 0||this._holeStatus==3){for(let r of this.copperLayerIds)if(this.checkError2Result(r,e.layerId))break}this._holeStatus==0&&this.checkError2Result(12,12)}checkViaVia(t,e){let r=this._holeStatus===0,i=this._holeStatus===1,n=this._holeStatus===2,s=this._holeStatus===void 0||this._holeStatus===3;for(let a of this.copperLayerIds)if(r&&!e.isUnuseLayer(a)&&this.checkError2Result(12,a)||i&&!t.isUnuseLayer(a)&&this.checkError2Result(a,12)||s&&!t.isUnuseLayer(a)&&!e.isUnuseLayer(a)&&this.checkError2Result(a,a))break;n&&this.checkError2Result(12,12)}checkViaMulti(t,e){if(this._holeStatus===void 0||this._holeStatus==3){for(let r of this.copperLayerIds)if(!t.isUnuseLayer(r)){this.checkError2Result(r,12);break}}this._holeStatus!==void 0&&this._holeStatus!==3&&this.checkError2Result(12,12)}checkMultiMulti(t,e){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}};var _V=class{constructor(){this.progressCb=()=>{};this.copperCheck=new Use,this.planeCheck=new Hse,this.safeCheck=new Wse}check(t){let e=0,r=sn.getInstance();for(let i of t){let[n,s,a]=i;r.needCheck(n,s)&&(n instanceof Pn||s instanceof Pn?n instanceof Pn?this.copperCheck.checkShapeRelation(n,s,a):this.copperCheck.checkShapeRelation(s,n,a):n instanceof Cn||s instanceof Cn?n instanceof Cn?this.planeCheck.checkShapeRelation(n,s,a):this.planeCheck.checkShapeRelation(s,n,a):this.safeCheck.checkShapeRelation(n,s,a),e+=1/t.length,this.progressCb(e))}return this.getResult()}getResult(){let t={},e=new Array;for(let n of this.copperCheck.result)e.push(n.getResult());t.copper=e;let r=new Array;for(let n of this.planeCheck.result)r.push(n.getResult());t.plane=r;let i=new Array;for(let n of this.safeCheck.result)i.push(n.getResult());return t.safe=i,t}clearResult(){this.copperCheck.result.length=0,this.planeCheck.result.length=0,this.safeCheck.result.length=0}onProgress(t){this.progressCb=t}};var yNn=te.getInstance(),YOt=sn.getInstance(),M9e=class{checkBindVia(t){if(t.type!==1)return!0;let e=YOt.ruleHelper.getRuleForBlind(t),r=t.name,i=e.name,n=e.getBlindVia(r);return n!=null?n.startLayer==t.startLayer&&n.endLayer==t.endLayer?!0:(pi.getInstance().addBlindError(t.center,i,t.globalIndex,t.startLayer,t.endLayer,oi.getMultiShapeEffectLayers(t)),!1):!1}},MD=new M9e;var vV=Qa.getInstance(),GX=te.getInstance(),N9e=sn.getInstance(),k9e=class{init(){this.isCheckMin=vV.isCheck(vV.diff.minWidth),this.isCheckMax=vV.isCheck(vV.diff.maxWidth),this.isCheckMaxLengthTolerance=vV.isCheck(vV.diff.maxLengthTolerance)}checkDiffWidth(t){let e=N9e.ruleHelper.getRuleForDiffWidth(t),r=t.width,i=t.layerId;(this.isCheckMin&&xe(r,2)<xe(e.getStrokeWidthMin(i),2)||this.isCheckMax&&xe(r,2)>xe(e.getStrokeWidthMax(i),2))&&(N9e.checkEnv==0?pi.getInstance().addDiffPairTrackWidthError(t.midPoint,e.name,t.globalIndex,t.width,e.getStrokeWidthMin(i),e.getStrokeWidthMax(i),[i]):pi.getInstance().errorRecordBuffer.add({type:"DifferentPairWidthError",data:{position:t.midPoint,name:e.name,obj:t.globalIndex,width:t.width,minWidth:e.getStrokeWidthMin(i),maxWidth:e.getStrokeWidthMax(i),layerIds:[i]}}))}checkNetLength(t){let e=this.getNetDifferentials(t),r=this.createSameNetMap(t);for(let i of e)this.checkLength(i,r,t)}getNetDifferentials(t){let e=new Set,r=new Set;for(let i of t){let n=i.net;if(r.has(n))continue;let s=GX.getNet(n);s!=null&&s.netDifferential!=null&&e.add(s.netDifferential),r.add(n)}return e}createSameNetMap(t){let e=new Map;return t.forEach(r=>{let i="",n=0;if(r instanceof yt)i=r.net,n=r.length;else if(r instanceof Je){let s=as.getInstance().getPadLenByModel(r);s!==null&&(i=r.net,n=s)}if(i){let s=e.get(i)||0;e.set(i,s+n)}}),Object.fromEntries(e)}checkLength(t,e,r){if(!this.isCheckMaxLengthTolerance)return;let i=GX.getDifferentialPhysics(t.differentialPhysics),n=t.positiveNet.name,s=t.negativeNet.name,a=e[n],l=e[s],c=i.differentialPairLenTolerMax,h=Math.abs(a-l);if(!(a==null||l==null)&&xe(h,2)>xe(c,2)&&!pi.getInstance().hasDiffLengthError(n)){let u=this.getErrorBox(n,s,r);N9e.checkEnv==0?pi.getInstance().addDiffPairTrackLengthError(u.center(),i.name,n,s,c,a,l):pi.getInstance().errorRecordBuffer.add({type:"DifferentPairLengthError",data:{position:u.center(),name:i.name,net_P:n,net_N:s,toleranceScope:c,value_P:a,value_N:l}})}}getErrorBox(t,e,r){let i=new _e,n,s;return GX.getAllNets().forEach(a=>{a.name==GX.getNet(t).name&&(n=r.filter(l=>l.net==t)),a.name==GX.getNet(e).name&&(s=r.filter(l=>l.net==e))}),n.forEach(a=>{i.ext1(a.bbox)}),s.forEach(a=>{i.ext1(a.bbox)}),i.valid()?i.build1():null}},ND=new k9e;var zse=Qa.getInstance(),Yse=te.getInstance(),B9e=class{getNetDifferentials(t){let e=new Set,r=new Set;for(let i of t){let n=i.net;if(r.has(n))continue;let s=Yse.getNet(n);s!=null&&s.netLengthPhysics!=null?e.add(Yse.getNetLengthPhysicsByNet(s.name)):e.add(Yse.getDefaultNetLengthPhysics()),r.add(n)}return e}createSameNetMap(t){let e=new Map;return t.forEach(r=>{let i="",n=0;if(r instanceof yt)i=r.net,n=r.length;else if(r instanceof Je){let s=as.getInstance().getPadLenByModel(r);s!==null&&(i=r.net,n=s)}if(i){let s=e.get(i)||0;e.set(i,s+n)}}),e}checkNetLength(t,e){let r=this.getNetDifferentials(t),i=e||this.createSameNetMap(t);for(let[n,s]of i){let a;for(let l of r)l.name==Yse.getNetLengthPhysicsByNet(n).name&&(a=l);this.checkLength(a,n,i.get(n))}}checkLength(t,e,r){let{netLengthMax:i,netLengthMin:n}=t;if(i==0&&n==0)return!0;let s=zse.isCheck(zse.netLength.minLength);return zse.isCheck(zse.netLength.maxLength)&&xe(r,2)>i||s&&xe(r,2)<n?(sn.getInstance().checkEnv==0?pi.getInstance().addNetLengthError(this.allTrackCenter(e),t.name,e,r,n,i):pi.getInstance().errorRecordBuffer.add({type:"NetLengthError",data:{position:this.allTrackCenter(e),name:t.name,net:e,netLength:r,minNetLength:n,maxNetLength:i}}),!1):!0}allTrackCenter(t){let e=new _e;return An.getInstance().getAllItem().forEach(i=>{i.net==t&&e.ext1(i.bbox)}),e.valid()?e.build1().center():new S(0,0)}},xV=new B9e;var DUe=Qa.getInstance(),jse=te.getInstance(),F9e=class{init(){this.isCheckTolerance=DUe.isCheck(DUe.netLengthTolerance.tolerance)}getNetDifferentials(t){let e=new Set,r=new Set;for(let i of t){let n=i.net;if(r.has(n))continue;let s=jse.getNet(n);s!=null&&s.netLengthTolerancePhysics!=null?e.add(jse.getNetLengthTolerancePhysicsByNet(s.name)):e.add(jse.getDefaultNetLengthTolerancePhysics()),r.add(n)}return e}createSameNetMap(t){let e={};return t.forEach(r=>{let i="",n=0;if(r instanceof yt)i=r.net,n=r.length;else if(r instanceof Je){let s=as.getInstance().getPadLenByModel(r);s!==null&&(i=r.net,n=s)}i&&(e[i]=(e[i]||0)+n)}),e}checkNetLengthTolerance(t,e){let r=this.getNetDifferentials(t),i=e||this.createSameNetMap(t);for(let n in i){let s=jse.getNetLengthTolerancePhysicsByNet(n);if(s!=null){let a;r.forEach(l=>{l.name==s.name&&(a=l)}),this.checkLengthTolerance(a,n,i)}}}checkLengthTolerance(t,e,r){if(!t||t.netLengthTolerance==null||!this.isCheckTolerance)return!0;let i=te.getInstance().getNet(e);if(i.equalLengthGroup==null)return!0;let n=r[e],s=i.equalLengthGroup.targetNet,a;if(s)a=r[s];else{let h=i.equalLengthGroup.getAllNetIds().map(u=>r[u]);a=Math.max.apply(null,h)}let l=n-a;return l>t.netLengthTolerance||l<-t.netLengthTolerance?(sn.getInstance().checkEnv==0?pi.getInstance().addNetLengthToleranceError(this.allTrackCenter(e),t.name,e,l,t.netLengthTolerance):pi.getInstance().errorRecordBuffer.add({type:"NetLengthToleranceError",data:{position:this.allTrackCenter(e),name:t.name,net:e,netLengthDiff:l,netLengthTolerance:t.netLengthTolerance}}),!1):!0}allTrackCenter(t){let e=new _e;return An.getInstance().getAllItem().forEach(i=>{i.net==t&&e.ext1(i.bbox)}),e.valid()?e.build1().center().add1(.1,.1):new S(.1,.1)}},A5=new F9e;var Xse=Qa.getInstance(),c7n=te.getInstance(),V9e=sn.getInstance(),G9e=class{init(){this.isCheckMin=Xse.isCheck(Xse.holeSize.minViaSize),this.isCheckMax=Xse.isCheck(Xse.holeSize.maxViaSize)}checkVia(t){let e=V9e.ruleHelper.getRuleForViaRadius(t),r=t.center,i=t.globalIndex,n=e.name,s=xe(t.radius*2,2),a=xe(t.holeRadius*2,2);return this.isCheckMax&&s>xe(e.maxRadius*2,2)||this.isCheckMin&&s<xe(e.minRadius*2,2)?(V9e.checkEnv==0?pi.getInstance().addRadiusError(r,n,i,!0,t.radius,e.minRadius,e.maxRadius,oi.getMultiShapeEffectLayers(t),t.type==1):pi.getInstance().errorRecordBuffer.add({type:"RadiusError",data:{position:r,name:n,obj1:i,type:!0,radius:t.radius,minRadius:e.minRadius,maxRadius:e.maxRadius,layerIds:oi.getMultiShapeEffectLayers(t),isBlind:t.type==1}}),!1):this.isCheckMax&&a>xe(e.maxInner*2,2)||this.isCheckMin&&a<xe(e.minInner*2,2)?(V9e.checkEnv==0?pi.getInstance().addRadiusError(r,n,i,!1,t.holeRadius,e.minInner,e.maxInner,oi.getMultiShapeEffectLayers(t),t.type==1):pi.getInstance().errorRecordBuffer.add({type:"RadiusError",data:{position:r,name:n,obj1:i,type:!1,radius:t.holeRadius,minRadius:e.minInner,maxRadius:e.maxInner,layerIds:oi.getMultiShapeEffectLayers(t),isBlind:t.type==1}}),!1):!0}inValidRadius(t,e){return typeof e!="number"||isNaN(e)?-1:(e=xe(e*2,2),e>xe(t.maxRadius*2,2)?1:e<xe(t.minRadius*2,2)?-1:0)}inValidInnerRadius(t,e){return typeof e!="number"||isNaN(e)?-1:(e=xe(e*2,2),e>xe(t.maxInner*2,2)?1:e<xe(t.minInner*2,2)?-1:0)}},Uf=new G9e;var qse=Qa.getInstance(),T7n=te.getInstance(),U9e=sn.getInstance(),H9e=class{init(){this.isCheckMin=qse.isCheck(qse.trackRule.minTrackWidth),this.isCheckMax=qse.isCheck(qse.trackRule.maxTrackWidth)}checkTrackWidth(t){let e=t.layerId,r=U9e.ruleHelper.getRuleForTrackWidth(t),i=xe(t.width,2);return this.isCheckMax&&i>xe(r.getMaxWidth(e),2)||this.isCheckMin&&i<xe(r.getMinWidth(e),2)?(t instanceof qr?U9e.checkEnv==0?pi.getInstance().addTrackWidthError(t.start.add(t.end).mul(.5),r.name,t.globalIndex,t.width,r.getMinWidth(e),r.getMaxWidth(e),[e]):pi.getInstance().errorRecordBuffer.add({type:"TrackError",data:{position:t.start.add(t.end).mul(.5),name:r.name,obj1:t.globalIndex,width:t.width,minWidth:r.getMinWidth(e),maxWidth:r.getMaxWidth(e),layerIds:[e]}}):t instanceof Oi&&(U9e.checkEnv==0?pi.getInstance().addTrackWidthError(t.midPoint,r.name,t.globalIndex,t.width,r.getMinWidth(e),r.getMaxWidth(e),[e]):pi.getInstance().errorRecordBuffer.add({type:"TrackError",data:{position:t.midPoint,name:r.name,obj1:t.globalIndex,width:t.width,minWidth:r.getMinWidth(e),maxWidth:r.getMaxWidth(e),layerIds:[e]}})),!1):!0}inValidTrackWidth(t,e){if(typeof e!="number"||isNaN(e))return!1;if(e=xe(e,2),t instanceof Hb){if(e>xe(t.getStrokeWidthMax(),2))return 1;if(e<xe(t.getStrokeWidthMin(),2))return-1}else{if(e>xe(t.getMaxWidth(),2))return 1;if(e<xe(t.getMinWidth(),2))return-1}return 0}},u9=new H9e;var D3=class{constructor(){this._progress=0;this.progressCb=null}get progress(){return this._progress}set progress(t){this._progress=t}onProgress(t){this.progressCb=t}updateProgress(t){var r;t<0&&(t=0),(t>=1||ne.greatereq(t,1))&&(t=1);let e=Math.pow(10,2);return t=Math.floor(t*e)/e,t=xe(t,2),this.progress>=t?!1:(this.progress=t,(r=this.progressCb)==null||r.call(this,this.progress),!0)}reset(){this.progress=0,this.progressCb=null}};var W9e=class{constructor(){this.progress=new D3}checkError(t,e={}){this.checkDispatch(t),ND.checkNetLength(t),xV.checkNetLength(t),A5.checkNetLengthTolerance(t),this.checkSpacingError(t,e)}checkDispatch(t){for(let e of t)e instanceof yt?u9.checkTrackWidth(e):e instanceof It&&(MD.checkBindVia(e),Uf.checkVia(e))}checkSpacingError(t,e={}){this.progress.reset(),this.progress.onProgress(c=>{var h;(h=e.onProgress)==null||h.call(e,c),!e.disableProgressFromWorker&&this.handleUpdateProgressFromWorker(c,e.maxProgressFromWorker)});let r=new Vse,i={checkSameNet:e.spacingCheckSameNet,excludeCheckPair:e.excludeCheckPair,callback:c=>{this.progress.updateProgress(c*.25)}},n=r.updates(t,i),s=new _V;s.onProgress(c=>this.progress.updateProgress(.25+.76*c));let a=s.check(n);this.progress.updateProgress(1);let l=uf.checkSpacing(a);return{...a,...l}}handleUpdateProgressFromWorker(t,e){self.workerBus!=null&&(e=e||1,t=t*e,self.workerBus.publish("progressUpdate",{ratio:t,descripte:"Design rule check"}))}},kD=new W9e;var $se=class{constructor(t,e,r,i=!0,n=0){if(t>e){let s=(t-e)/2,a=e/2*n,l=(e/2-a)*Math.sqrt(2)+a+r+.01;i||(l=e/2+r+.01),this.center1=new S(-s,0),this.center2=new S(s,0);let c=new S(-1,1).normalize().mul(l),h=new S(-1,-1).normalize().mul(l),u=new S(1,1).normalize().mul(l),d=new S(1,-1).normalize().mul(l);this.leftUp=new M(this.center1,this.center1.add(c)),this.leftLow=new M(this.center1,this.center1.add(h)),this.rightUp=new M(this.center2,this.center2.add(u)),this.rightLow=new M(this.center2,this.center2.add(d))}else{let s=(e-t)/2,a=t/2*n,l=(t/2-a)*Math.sqrt(2)+a+r+.01;i||(l=t/2+r+.01),this.center1=new S(0,s),this.center2=new S(0,-s);let c=new S(-1,1).normalize().mul(l),h=new S(-1,-1).normalize().mul(l),u=new S(1,1).normalize().mul(l),d=new S(1,-1).normalize().mul(l);this.leftUp=new M(this.center1,this.center1.add(c)),this.leftLow=new M(this.center2,this.center2.add(h)),this.rightUp=new M(this.center1,this.center1.add(u)),this.rightLow=new M(this.center2,this.center2.add(d))}}};var Kse=1e-6,RV=class{constructor(t){this.thermalSet=new Set;this.padLines=new Set;this.constraintRtree=new nn(10);this.padPolyMap=new Map;this.padPolyMap2=new Map;this.commonPadMap=new Map;this.max=100;this.drcMap=t,this.filter=new eF,this.updateConstraintTree(),sn.getInstance().initialEnv(this.drcMap),sn.getInstance().addFilter(this.filter),_u.getInstance().setMask(!0)}isTheraml(t){return this.thermalSet.has(t)}getResult(){return Array.from(this.padLines)}updateConstraintTree(){this.constraintRtree.clear();let t=O4("Constraint Region");for(let e of t){let r=new e6(e);this.constraintRtree.add(r)}}searchConstraints(t,e){let r=[];for(let i of this.constraintRtree.search(t))(i.item.layerId===e||i.item.layerId===12)&&r.push(i.item);return r}addThermal2Tree(t){this.drcMap.insert(new e6(t))}getPads(t){let e=this.searchPads(t),r=new Set;return e.forEach(i=>{i instanceof Je&&i.net==t.net&&(i.layerId==12&&!i.isUnuseLayer(t.layerId)||i.layerId==t.layerId)&&r.add(i)}),r}getThermalModel(t,e,r,i,n,s){if(Math.abs(s-LE)>1e-5&&!e){let a=this.getPadWidth(t,n,e),l=this.getPadHeight(t,n,e),c=this.getPadType(t,n,e)=="RECT",h=this.getPadRatio(t,n,e),u=Ae.rotateZ(t.rotation).translate1(t.center.x,t.center.y,0).toMatrix3(),d=new $se(a,l,r,c,h),p=Math.min(a,l);i=i<=0?p/2+.02:i;let m=d.leftUp.multiply3(u),g=d.leftLow.multiply3(u),y=d.rightUp.multiply3(u),b=d.rightLow.multiply3(u),P=this.getThermalCopper(m,n,t,e,i,!0),T=this.getThermalCopper(g,n,t,e,i,!0),I=this.getThermalCopper(y,n,t,e,i,!0),C=this.getThermalCopper(b,n,t,e,i,!0);return[P,T,I,C]}else{let a=this.getPadWidth(t,n,e)/2+.02,l=this.getPadHeight(t,n,e)/2+.02,c,h,u,d,p,m=!1;if(e){if(Math.abs(s-LE)<1e-5)s=0;else{let w=Math.max(a,l);a=w,l=w}let R=Math.cos(s),v=Math.sin(s);Math.abs(R)>1e-5&&(a=a/R),Math.abs(v)>1e-5&&(l=l/v);let D=t.bbox.center();(D.x.toString()!=t.center.x.toString()||D.y.toString()!=t.center.y.toString())&&(m=!0),c=Ae.rotateZForPoint(t.center,t.rotation+s)}else c=Ae.rotateZForPoint(t.center,t.rotation);if(m){let R=new S((a-.02)*2+(r+.01)*2+.02,0),v=new S(0,(l-.02)*2+(r+.01)*2+.02);h=t.center.sub(R).multiply4(c),u=t.center.add(R).multiply4(c),d=t.center.add(v).multiply4(c),p=t.center.sub(v).multiply4(c);let D=this.getPolygonPadThermal(t,r+.01,new M(h,u),new M(d,p),n);h=D.left||h,u=D.right||u,d=D.top||d,p=D.bottom||p}else{let R=new S(a-.01+r,0),v=new S(0,l-.01+r);h=t.center.sub(R).multiply4(c),u=t.center.add(R).multiply4(c),d=t.center.add(v).multiply4(c),p=t.center.sub(v).multiply4(c)}let g=i<=0?a:i,y=i<=0?l:i,b=new M(t.center,h),P=new M(t.center,u),T=new M(t.center,d),I=new M(t.center,p),C=this.getThermalCopper(b,n,t,e,y,!1,!1),E=this.getThermalCopper(P,n,t,e,y,!1,!1),O=this.getThermalCopper(T,n,t,e,g,!1,!0),_=this.getThermalCopper(I,n,t,e,g,!1,!0);return[C,E,O,_]}}getPolygonPadThermal(t,e,r,i,n){let s=this.getPolygonPadBox(t,n,e),a=[],l=[];for(let m of s){if(Tt(m,r)>0){let b=new S(Ee[0],Ee[1]);a.push(b)}if(Tt(m,i)>0){let b=new S(Ee[0],Ee[1]);l.push(b)}}let[c,h]=p(a),[u,d]=p(l);function p(m){let g=m[0],y=m[1];if(m.length>2)for(let b=1;b<m.length;b++){let P=m[b];if(!(ne.eq(P.x,g.x)&&ne.eq(P.y,g.y))){y=P;break}}return[g,y]}return{left:c,right:h,top:u,bottom:d}}getPadPl(t,e,r,i){let n=null;return 12==t.layerId?n=t.getMathGraphics(e,-i):n=t.getMathGraphics(t.layerId,-i),n}getLine2(t,e){if(e.isPolygonPad&&(t.primitives.length>10||!this.isConvexPolygon(t)))return null;let r=e.width/2,i=e.line.direct,n=e.line,s=new S(-i.y,i.x).mul(r),a=new M(n.start().add(s),n.end().add(s)),l=h(a)[0],c;if(l&&(c=l.sub(s)),c==null)return null;{let u=new S(i.y,-i.x).mul(r),d=new M(n.start().add(u),n.end().add(u)),p=h(d)[0];if(p){let m=p.sub(u);ne.less(m.distance2(n.start()),c.distance2(n.start()))&&(c=m)}else return null}if(c)return new M(c,n.end());return null;function h(u){let d=t.primitives,p=new Array,m=u.start();for(let g of d){let y=Tt(u,g);if(y>0){let b=new S(Ee[0],Ee[1]),P;for(let T=2;T<y;T+=2){P||(P=b.distance2(m));let I=new S(Ee[T],Ee[T+1]),C=I.distance2(m);P<C&&(P=C,b=I)}p.push(b)}}return dn(p,u)}}isConvexPolygon(t){let e=[];t.points1(.1,n=>{e.push(n)}),e.pop();let r=e.length;if(r<3)return!1;let i=0;for(let n=0;n<r;n++){let s=e[n],a=s.x,l=s.y,c=e[(n+1)%r],h=c.x,u=c.y,d=e[(n+2)%r],p=d.x,m=d.y,g=(h-a)*(m-l)-(u-l)*(p-a);if(g!==0){if(g*i<0)return!1;i=g}}return!0}getLine(t,e){if(t==null)return null;let r=new Fs(t,fe.build2([e]),0);if(r.relation==0){let n=r.line.start(),s=e.end().sub(n).normalize(),a=new S(-s.x,-s.y).mul(.01),l=n.add(a);return new M(l,e.end())}return e}pIsInCopper(t,e,r,i){let n=e.x-r,s=e.x+r,a=e.y-r,l=e.y+r;for(let c of t.pls){let h=c.bbox();if(!(h.minX>s||h.maxX<n||h.minY>l||h.maxY<a))for(let u of c.primitives){let d=u.bbox();if(!(d.minX>s||d.maxX<n||d.minY>l||d.maxY<a)&&ir.getMinDistanceFromPoint(e,u)<r)return!0}}return i?t.inShape(e.x,e.y):!1}checkCopperClearance(t,e,r=!0){uf.onlyCheck=!0;let i=new Set,n,s=[];kD.checkSpacingError(Object.values(t).map(l=>l.copper)).fail.forEach(l=>{let c=t[l.id1]||t[l.id2];i.has(c)||(i.add(c),this.changeCopper(c)?s.push(c):(e(c),delete t[l.id1],delete t[l.id2]),n=c.copper,_u.getInstance().delete(n.globalIndex,n.layerId))}),kD.checkSpacingError(s.map(l=>l.copper)).fail.forEach(l=>{let c=t[l.id1];if(c)e(c),delete t[l.id1];else{let h=t[l.id2];h&&(e(h),delete t[l.id2])}}),uf.onlyCheck=!1,r&&(this.padPolyMap.clear(),this.padPolyMap2.clear(),this.commonPadMap.clear())}changeCopper(t,e=this.padPolyMap,r=this.max){let i,n;return t.isPolygonPad?(e.has(t.pad.globalIndex)?i=e.get(t.pad.globalIndex):(i=this.getPadPl(t.pad,t.copper.layerId,t.line,0),e.set(t.pad.globalIndex,i)),this.padPolyMap2.get(t.pad.globalIndex)==null&&(n=this.getLine2(i,t)),n==null&&(n=this.polygonPadHandle(i,t))):n=this.generatePadLine(t),n==null?!1:(t.copper.pls=this.getCopperByLine(n,t.width),t.line=n,this.filter.removeThermalCopper(t.copper),!0)}generatePadLine(t){let e=t.pad,r=this.commonPadMap.get(e.globalIndex),i=t.line;if(r!=null)if(Array.isArray(r)){let l=null;if(t.isVertical?l=r[1]:l=r[0],l!=null)return l==0?null:new M(i.start().add(i.direct.mul(l)),i.end())}else return r==0?null:new M(i.start().add(i.direct.mul(r)),i.end());let n=t.copper.layerId,s;if(n==1?s=e.top:n==2?s=e.bottom:s=e.inner,!s)return null;let a=s.type;if(a=="ELLIPSE"||a=="OVAL"&&ne.eq(s.width,s.height)){if(ne.lesseq(s.width,t.width))return this.commonPadMap.set(e.globalIndex,0),null;{let l=Math.sqrt(Math.pow(s.width/2,2)-Math.pow(t.width/2,2));return this.commonPadMap.set(e.globalIndex,l),new M(i.start().add(i.direct.mul(l)),i.end())}}if(t.is45){let[l,c]=[s.width,s.height],h=Math.sqrt(2),u=Math.min(l,c)/2,d=0;a=="RECT"?d=s.ratio:a=="OVAL"&&(d=1);let p=u*d,m=u-p,g=m*h+p,y=t.width;if(ne.less(g*2,y))return null;let b=h*p,P=0;if(ne.lesseq(y,b)){let T=y/2;P=m*h+Math.sqrt(p*p-T*T)}else if(ne.less((m*2+p)*h,y))P=Math.sqrt(p*p-Math.pow(p-(g-y/2),2));else{let T=u*2*h/2,I=y/2;P=T-I}return this.commonPadMap.set(e.globalIndex,P),P==0?null:new M(i.start().add(i.direct.mul(P)),i.end())}else{let[l,c]=t.isVertical?[s.height/2,s.width/2]:[s.width/2,s.height/2],h=t.width/2,u=this.commonPadMap.get(e.globalIndex);if(u||(u=[],this.commonPadMap.set(e.globalIndex,u)),ne.less(c,h))return t.isVertical?u[1]=0:u[0]=0,null;let d=Math.min(l,c),p=0;a=="RECT"?p=s.ratio:a=="OVAL"&&(p=1);let m=d*p,g=c-m,y=0;if(ne.lesseq(h,g))y=l;else{let b=h-g;y=Math.min(l,c)-m+Math.sqrt(Math.pow(m,2)-Math.pow(b,2)),ne.less(c,l)&&(y=l-c+y)}return t.isVertical?u[1]=y:u[0]=y,y==0?null:new M(i.start().add(i.direct.mul(y)),i.end())}}polygonPadHandle(t,e,r=this.padPolyMap2,i=this.max){let n=t;if(r.has(e.pad.globalIndex))n=r.get(e.pad.globalIndex);else{if(e.isPolygonPad){if(i==0)return null;n.primitives.length>10&&i--}n=this.getPadPl(e.pad,e.copper.layerId,e.line,e.width/2),r.set(e.pad.globalIndex,n)}return this.getLine(n,e.line)}complete(){sn.getInstance().clear(),_u.getInstance().setMask(!1),_u.getInstance().clear(),this.drcMap=null}getPadType(t,e,r){return r?"POLYGON":1==e?t.top.type:2==e?t.bottom.type:Ms(e)?t.inner.type:"POLYGON"}getPadRatio(t,e,r){return r?0:1==e?t.top.ratio:2==e?t.bottom.ratio:Ms(e)?t.inner.ratio:0}isPolygonPad(t){var e,r,i;return!(((e=t.top)==null?void 0:e.pl)==null&&((r=t.bottom)==null?void 0:r.pl)==null&&((i=t.inner)==null?void 0:i.pl)==null)}getPadWidth(t,e,r){let i;if(r){if(t.isUnuseLayer(e))return t.hole.holeLength;let s=this.getPolygonPadPl(t,e);s!=null?i=s.bbox().width():i=t.buildBBox().width()}else 1==e?i=t.top.width:2==e?i=t.bottom.width:Ms(e)&&(t.isUnuseLayer(e)?i=this.getPadHoleLen(t).width:i=t.inner.width);let n=this.getPadHoleLen(t).width;return i>n?i:n}getPadHoleLen(t){if(t.hole){let e=t.hole.getHolebbox(t.center,0);return{width:e.width(),height:e.height()}}return{width:0,height:0}}getPolygonPadPl(t,e){let r=null;12==t.layerId?r=t.getMathGraphics(e,0):r=t.getMathGraphics(t.layerId,0);let i=Ae.rotateZForPoint(t.center,-t.rotation);return r?r.multiply3(i.toMatrix3()):null}getPadHeight(t,e,r){let i;if(r){if(t.isUnuseLayer(e))return t.hole.holeRadius*2;let s=this.getPolygonPadPl(t,e);s!=null?i=s.bbox().height():i=t.buildBBox().height()}else 1==e?i=t.top.height:2==e?i=t.bottom.height:Ms(e)&&(t.isUnuseLayer(e)?i=this.getPadHoleLen(t).height:i=t.inner.height);let n=this.getPadHoleLen(t).height;return i>n?i:n}getPolygonPadBox(t,e,r=0){let i=this.getPolygonPadPl(t,e),n;i!=null?n=i.bbox():n=t.buildBBox(),n=n.extendOfSize(r);let s=Ae.rotateZForPoint(t.center,t.rotation).toMatrix3();return[new M(n.UL(),n.UR()).multiply3(s),new M(n.LL(),n.LR()).multiply3(s),new M(n.UL(),n.LL()).multiply3(s),new M(n.LR(),n.UR()).multiply3(s)]}island(t){let e=this.searchItems(t);for(let r of e)if(r!=t&&this.needCheckConnect(r,t)&&Jx(r,t))return!1;return!0}searchItems(t){let e=t.layerId,r=(i,n)=>i==e||i==12;return this.drcMap.search4Types(t.buildBBox(),dd,r)}searchPads(t){let e=t.layerId,r=(i,n)=>i==e||i==12?n!=null?n=="Pad":!0:!1;return this.drcMap.search4Types(t.buildBBox(),["Pad"],r)}};var _5=te.getInstance(),Zse=Wo.getInstance(),DV=class extends RV{generateThermal(t){let e=this.getPourProfile(t);if(!e||an.nullOrEmpty(e.net))return;let r=_5.getCopperPlaneByNet(e.net),i=_5.getRegion(e.globalIndex),n=_5.getSafeSpacingByNet(e.net,13);if(i&&i.copperPlane&&(r=_5.getCopperPlane(i.copperPlane)),i&&(i.safeCopperPlane||i.safeClearance)&&(n=_5.getSafeSpacing(i.safeCopperPlane||i.safeClearance)),r){let s=!1;n&&n.getClearance(11,7,e.layerId)==0&&(s=!0);let a=this.getPads(e);this.getLines(a,r,e,s)}}removeIsland(t){let e={};t.filter(n=>{let s=this.getPourProfile(n);if(!s||s.component.keepIsland)return;let a=e[s.net];a||(e[s.net]=a=[]),a.push(s)});let r=[];Object.values(e).forEach(n=>{this.getIslandsByCoppers(n).forEach(s=>r.push(s))});let i=[];for(let n of r){let s=n.globalIndex,a=n.getParent(),l=a.component,c=l.copperResult.indexOf(n.copperPath);c>=0&&l.copperResult.splice(c,1),a.deleteCopper(s),i.push(s)}return i}needCheckConnect(t,e){return t instanceof lr||t instanceof Je||t instanceof It||t instanceof yt||t instanceof Pn&&t.net===e.net&&this.thermalSet.has(t)}getIslandsByCoppers(t){let e=new Map,r=[];for(let a of t){let l=[],c=new _e;if(a.iteratorCopper(y=>{let b=Zse.getItem(y);this.thermalSet.has(b)||(l.push(b),c.ext1(b.buildBBox()))}),l.length===0)continue;l.sort((y,b)=>y.buildBBox().minX-b.buildBBox().minX);for(let y of l)this.island(y)&&e.set(y,[y]);r.push({coppers:l,bbox:c.build1()});let h=a.component,u=h.style==="solid",d=u?h.optimization?h.optimizationValue:0:h.gridLineWidth;if(d===0)continue;let p;if(u)p=y=>y.pls;else{let y=new Map;p=b=>{let P=y.get(b);if(!P){for(let T=1;T<b.pls.length;T++){let I=b.pls[T];if(I.primitives.length===1&&I.primitives[0]instanceof M){P=b.pls.slice(0,T);break}}P||(P=b.pls),y.set(b,P)}return P}}let m=(y,b)=>{let P=p(y),T=p(b),I=y.buildBBox().intersection1(b.buildBBox()),C=[],E=[];P.forEach(O=>{O.bbox().isIntersect(I)&&O.primitives.forEach(_=>{_.bbox().isIntersect(I)&&C.push(_)})}),T.forEach(O=>{O.bbox().isIntersect(I)&&O.primitives.forEach(_=>{_.bbox().isIntersect(I)&&E.push(_)})});for(let O of C)for(let _ of E)if(ir.getMinDistanceWithoutCross(O,_)<d)return!0;return!1},g=new On;for(let y of l){let b=y.buildBBox();for(let P of wUe(g.listIterator())){let T=P.item,I=T.buildBBox();if(I.maxX<b.minX){g.remove(P);continue}I.minY>b.maxY||b.minY>I.maxY||s(y,T,m)}g.add(y)}}let i=new On;for(let a of r.sort((l,c)=>l.bbox.minX-c.bbox.minX)){let l=a.bbox;for(let c of wUe(i.listIterator())){let h=c.item,u=h.bbox;if(u.maxX<l.minX){i.remove(c);continue}if(u.minY>l.maxY||l.minY>u.maxY)continue;let d=a.coppers,p=h.coppers,m=d.length,g=p.length,y=0,b=0;for(;y<m&&b<g;)if(d[y].buildBBox().minX<p[b].buildBBox().minX){let P=d[y],T=P.buildBBox();for(let I=b;I<g;I++){let C=p[I],E=C.buildBBox();if(E.minX>T.maxX)break;(T.minY<E.minY?E.minY:T.minY)<(T.maxY<E.maxY?T.maxY:E.maxY)&&s(P,C)}y++}else{let P=p[b],T=P.buildBBox();for(let I=y;I<m;I++){let C=d[I],E=C.buildBBox();if(E.minX>T.maxX)break;(E.minY<T.minY?T.minY:E.minY)<(E.maxY<T.maxY?E.maxY:T.maxY)&&s(C,P)}b++}}i.add(a)}let n=new Array;for(let a of e.keys())n.push(a);return n;function s(a,l,c=Jx){let h=e.get(a),u=e.get(l);h===u||!c(a,l)||(h&&u?h.length>u.length?u.forEach(d=>{h.push(d),e.set(d,h)}):h.forEach(d=>{u.push(d),e.set(d,u)}):h?h.forEach(d=>e.delete(d)):u.forEach(d=>e.delete(d)))}}getLines(t,e,r,i=!1){let n=r.component,s=(n.style==="solid"?n.optimization?n.optimizationValue:0:n.gridLineWidth)/2+Kse,a=new Array;r.iteratorCopper(u=>{a.push(Zse.getItem(u))});let l=r.layerId,c={};t.forEach(u=>{let d,p,m;if(u.padRule){if(u.padRule.connectMode!=0)return;d=u.padRule.lineClearance,p=u.padRule.lineWidth,m=u.padRule.lineAngle}else{let b=this.searchConstraints(u.bbox,r.layerId),P=!1;if(b.forEach(T=>{if(new o3().isInConstraint(T,u)){let I=_5.getRegion(T.globalIndex);if(I!=null&&I.copperPlane!=null){let C=_5.getCopperPlane(I.copperPlane);if(u.layerId==12){if(C.getMultiConnectMode(l)!=0)return;d=C.getMultiLineClearance(l),p=C.getMultiLineWidth(l),m=C.getMultiLineAngle(l)}else{if(C.getSingleConnectMode(l)!=0)return;d=C.getSingleLineClearance(l),p=C.getSingleLineWidth(l),m=C.getSingleLineAngle(l)}P=!0}}}),!P)if(u.layerId==12){if(e.getMultiConnectMode(l)!=0)return;d=e.getMultiLineClearance(l),p=e.getMultiLineWidth(l),m=e.getMultiLineAngle(l)}else{if(e.getSingleConnectMode(l)!=0)return;d=e.getSingleLineClearance(l),p=e.getSingleLineWidth(l),m=e.getSingleLineAngle(l)}}if(ne.eq(d,0))return;let g=this.isPolygonPad(u);this.getThermalModel(u,g,d,p,r.layerId,m).forEach(b=>{b.copper.setParent(r),c[b.copper.globalIndex]=b})});let h=u=>{u.copper.remove(),Zse.delete(u.copper,u.copper.globalIndex)};this.checkCopperClearance(c,h,!1),Object.values(c).forEach(u=>{this.saveThermal(u,a,s,i)?(r.addCopper(u.copper.globalIndex),n.copperResult.push(u.copper.copperPath),this.thermalSet.add(u.copper),this.padLines.add(u.copper),this.addThermal2Tree(u.copper)):h(u)}),this.padPolyMap.clear(),this.padPolyMap2.clear(),this.commonPadMap.clear()}saveThermal(t,e,r,i=!1){let n=t.copper.getParent();if(n!=null&&n instanceof lr&&n.type=="Copper Region"){let s=n.getMathGraphics(),a=t.copper.getRealOutline()[0];if(a!=null&&new Fs(s,a,0).relation==0)if(this.changeCopper(t)){if(a=t.copper.getRealOutline()[0],new Fs(s,a,0).relation==0)return!1}else return!1}for(let s of e)if(this.pIsInCopper(s,t.line.end(),r,t.isPolygonPad)){if(i){let a=s.pls[0],l=t.copper.getMathGraphics().items[0];if(l!=null&&new Fs(a,l,0).relation==0){let c=t.line.end().add(t.line.direct.mul(t.width));if(!s.inShape(c.x,c.y))return!1}}return!0}return!1}getThermalCopper(t,e,r,i,n,s=!1,a=!1){let l=xUe(this.getCopperByLine(t)),c=cr(),h=Zse.addCopper(c,e,r.net,"90grid",n,0,!1,l,!1);return this.filter.addThermalCopper(h),{copper:h,line:t,pad:r,isPolygonPad:i,width:n,is45:s,isVertical:a}}getCopperByLine(t,e){return[fe.build2([t])]}getPourProfile(t){let e=Mj(t);return e&&e.component instanceof Vn?e:null}};function wUe(o){return{next(){return o.hasNext()?{value:o.next()}:{done:!0,value:void 0}},[Symbol.iterator](){return this}}}var LUe=Ho.getInstance(),MUe=te.getInstance(),Jse=class extends RV{generateThermal(t){let e=this.getPourProfile(t);if(!e||an.nullOrEmpty(e.net))return;let r=te.getInstance().getInnerPlaneByNet(e.net),i=te.getInstance().getRegion(e.globalIndex);if(i&&i.innerPlane&&(r=te.getInstance().getInnerPlane(i.innerPlane)),r){let n=this.getPads(e);this.getLines(n,r,e)}}getLines(t,e,r){let i={},n=r.layerId;t.forEach(l=>{let c,h,u;if(l.padRule){if(l.padRule.connectMode!=0)return;c=l.padRule.lineClearance,h=l.padRule.lineWidth,u=l.padRule.lineAngle}else{let m=this.searchConstraints(l.bbox,r.layerId),g=!1;for(let y of m)if(new o3().isInConstraint(y,l)){let b=MUe.getRegion(y.globalIndex);if(b!=null&&b.innerPlane!=null){let P=MUe.getInnerPlane(b.innerPlane);if(l.layerId==12){if(P.getMultiConnectMode(n)!=0)return;c=P.getMultiLineClearance(n),h=P.getMultiLineWidth(n),u=P.getMultiLineAngle(n)}else return;g=!0}}if(!g)if(l.layerId==12){if(e.getMultiConnectMode(n)!=0)return;c=e.getMultiLineClearance(n),h=e.getMultiLineWidth(n),u=e.getMultiLineAngle(n)}else return}if(ne.eq(c,0))return;let d=this.isPolygonPad(l);this.getThermalModel(l,d,c,h,r.layerId,u).forEach(m=>i[m.copper.globalIndex]=m)});let s=!1,a=l=>{l.copper.remove(),LUe.delete(l.copper,l.copper.globalIndex),s=!0};this.checkCopperClearance(i,a),Object.values(i).forEach(l=>{this.checkThermal(r,l)?(this.padLines.add(l.copper),this.thermalSet.add(l.copper),this.addThermal2Tree(l.copper)):a(l)}),s&&_u.getInstance().delete(r.globalIndex,r.layerId)}checkThermal(t,e){let r=this.pIsInCopper(t,e.line.end(),Kse+.02,e.isPolygonPad);if(r){let i=t.getMathGraphics().items[0],n=e.copper.getMathGraphics().items[0];if(n!=null&&new Fs(i,n,0).relation==0){let s=e.line.end().add(e.line.direct.mul(e.width));r=t.inShape(s.x,s.y)}}return r}getThermalCopper(t,e,r,i,n,s=!1,a=!1){let l=ef(this.getCopperByLine(t,n)),c=cr(),h=LUe.add(c,e,r.net,!0,l);return this.filter.addThermalCopper(h),{copper:h,line:t,width:n,pad:r,isPolygonPad:i,is45:s,isVertical:a}}getCopperByLine(t,e){return[t.stroke(e,kr.ROUND,le.CW).asClose()]}getPourProfile(t){return Ho.getInstance().getItem(t)}needCheckConnect(t,e){return t instanceof Je||t instanceof It||t instanceof Cn&&this.thermalSet.has(t)}getIslandsByCoppers(t){return t.filter(e=>this.island(e))}};var NUe=Ho.getInstance();function kUe(o){o.forEach(t=>{NUe.delete(t,t.globalIndex);let e=cr();t.globalIndex=e,NUe.addModel(t),Qn.addPlaneZoneByModel(t)})}function BUe(o){return o!=null&&(o.remove(),A.publish("delete",o)),!0}async function Qse(o){let{uuid:t,dataStr:e,source:r,title:i,docType:n}=o;if(n!==4)return;let[s,a]=r.split("|"),l=Wi.getInstance(),c=l.getItem(s);if(c!=null){let h=i||c.footprintId;return await l.addCustomFootprint(t,x.getInstance().compilerChannel),!0}return!1}var w3=class{getSource(t,e,r){new oP(t,"modify"),Te.dispatch(t,"delete"),A.publish("hasModifyPcbItem",t),A.publish("delete",t);let i=new z1("2.0"),n;return e instanceof Array?e.forEach(s=>{n=i.replace(t.model,s[0],s[1])}):n=i.replace(t.model,e,r),t.remove(),n}parseSource(t){let e=new Y1(t);return e.build(),e.items.length>0?e.items[0]:null}async addFootprint(t){return!t||!t.uuid||x.getInstance().doctype!=3?void 0:t.uuid.indexOf("_")>-1?Qse(t):await Ji.add(t.uuid,x.getInstance().compilerChannel)}sycnName(t){for(let e in t){let r=Ji.getItem(e),i=Ji.getItem(t[e]);if(r!=null&&i!=null){let n=r.getChilds();for(let s of n)if(s instanceof Xc)for(let a of s.getComponents()){let l=Cr.getItem(a.globalIndex);l.idShape.value=i.footprintId,l.footprintId=i.footprintId}}}}};var eae=class extends w3{constructor(){super();this.uuids=new Array;this.map={};A.subscribe("pcbEditDevice",this.editDevice.bind(this)),A.messageBus.rpcService("editDeviceResult",this.editResult.bind(this))}editDevice(e){if(e.component!=null){let r=new Set;for(let i of e.component){let n=ps.getItem(i.deviceUUID);r.add(n.uuid);let s=this.map[n.uuid];s==null&&(s=new Array,this.map[n.uuid]=s),s.push(i.globalIndex)}this.uuids=Array.from(r)}A.publish("editDevice",{type:e.type,uuids:this.uuids},$())}async editResult(e){var n;let r=e.type;if(r==null||x.getInstance().doctype!=bi.PCB||!this.check(r))return;e.data instanceof Array||(e.data=[e.data]);let i=new mi().createGroup("Replace Device");for(let s of e.data){let a=s.modify,l=(n=s.option)==null?void 0:n.compareParam,c=this.getUpdateComponent(r,s,a);s.toBeReplaced&&c.forEach(y=>{i.addCommand4Item(y,"delete")});let h=new Array,u=s.device;for(let y of u)await this.addDevice(y);let d=c.map(y=>JSON.parse(JSON.stringify(y.attrKeyValue)));if(c.forEach(y=>{let b=ps.getItem(y.deviceUUID),P=[["Device",a[b.uuid]]];if(l){let I=ps.getItem(a[b.uuid]);P.push(["Footprint",l.keepFootprint||!I.footprintUUID?y.footprintUUID:I.footprintUUID]);for(let C in y.attrKeyText){let E=y.attrKeyText[C];if(!["Device","Footprint"].includes(C)){let O=this.replaceAttr(l,C,E.value,I.attrs[C]);O==null?y.removeAttribute(E):O!=E.value&&P.push([C,O])}}}let T=this.getSource(y,P);h.push(T)}),r==2&&!s.toBeReplaced){for(let y of u)this.removeDevice(y);for(let y of u)await this.addDevice(y)}let p=s.footprint;for(let y of p)await this.addFootprint(y);if(c.length==0)return;this.sycnName(a);let m=x.getInstance().isactive;x.getInstance().isactive=!0,A.publish("clearSelect","");let g=[];h.forEach(y=>{let b=this.parseSource(y),P=ps.getItem(b.deviceUUID);for(let T in P.attrs)["Device","Designator"].includes(T)||this.modifyAttr(b,T,P.attrs[T]);g.push(b)}),this.replaceAttrs(l,d,g),s.toBeReplaced&&g.forEach(y=>{i.addCommand4Item(y,"add")}),x.getInstance().isactive=m}e.data[0].toBeReplaced?i.execute():(je.clear(),A.windowBridge.rpcCall("save",{tabId:x.getInstance().tabId},$())),A.publish("flushService",""),this.clear()}getUpdateComponent(e,r,i){let n=new Array;switch(e){case 0:for(let s in i){let a=this.map[s];a!=null&&(a.forEach(l=>{let c=Cr.getItem(l);n.push(c)}),delete this.map[s])}break;case 1:case 2:for(let s in i){let a=ps.getItem(s);a!=null&&(a.getComponents().forEach(c=>{let h=Cr.getItem(c.globalIndex);n.push(h)}),delete this.map[s])}break}return r.toBeReplaced&&(n=n.filter(s=>r.toBeReplaced.includes(s.globalIndex))),n}async addDevice(e){return await ps.add(e.uuid,x.getInstance().compilerChannel)}removeDevice(e){let r=ps.getItem(e.uuid);return ps.delete(r),r}check(e){return!(e!=2&&Object.keys(this.map).length==0)}clear(){this.uuids.length=0}isNull(e){return e===""||e==null}modifyAttr(e,r,i){r=="Device"?e.device=i:r=="Designator"?e.name=i:e.modifyATTRMap(r,i)}replaceAttr(e,r,i,n){if(i==n)return i;if(r=="Device")return n;if(r==="Designator"||r==="Unique ID")return e.keepDesignator&&!this.isNull(i)||this.isNull(n)?i:n;if(r==="Footprint")return e.keepFootprint&&!this.isNull(i)||this.isNull(n)?i:n;if(["3D Model","3D Model Title","3D Model Transform"].includes(r))return e.keep3DModel&&!this.isNull(i)||this.isNull(n)?i:n;if(!(e.type==="targetBase"&&n==null)){if(e.noneNull){if(this.isNull(i)&&!this.isNull(n))return n;if(!this.isNull(i)&&this.isNull(n))return i}return e.type=="currentFirst"?i:n||""}}replaceAttrs(e,r,i){if(e)for(let n=0;n<i.length;n++){let s=i[n],a=r[n],c=ps.getItem(s.deviceUUID).attrs,h=Array.from(new Set([].concat(Object.keys(a),Object.keys(c)))).filter(u=>!["Device","Footprint","Symbol","Convert to PCB","Sim Model","Sim Model Title","Sim Model Path","NGSpice Model","NGSpice Model Title","NGspice Model Path"].includes(u));for(let u of h){let d=this.replaceAttr(e,u,a[u],c[u]),p=s.attrKeyValue[u];d!=null&&d!=p&&this.modifyAttr(s,u,d),d==null&&p!=null&&s.deleteATTRMap(u)}}}};var rae=class extends w3{constructor(){super();this.uuids=new Array;this.map={};A.subscribe("pcbUpdateDevice",this.editUpdate.bind(this))}editUpdate(e){if(e.component!=null){let r=new Set;for(let i of e.component){let n=ps.getItem(i.deviceUUID);r.add(n.uuid);let s=this.map[n.uuid];s==null&&(s=new Array,this.map[n.uuid]=s),s.push(i.globalIndex)}this.uuids=Array.from(r)}A.publish("updateComponent",{type:2,uuids:this.uuids},$())}};var iae=class extends w3{constructor(){super(),ie.subscribe("updateComponent",this.editUpdate.bind(this))}editUpdate(t){let e=new Array;if(t.component!=null)for(let r of t.component){let i={device:r.deviceUUID,footprint:r.footprintUUID};e.push(i)}ie.publish("updateComponent",{type:2,uuids:e},$())}};function y_(o,t,e=!0,r){e&&A.publish("updateRtree","");let i=Vt.search(o.buildBBox(),(n,s)=>s=="Via");for(let n of i.vias){let l=function(c){let h=o.getMathGraphics(c),u=n.getMathGraphics();if(!h||!u)return;if(yb.build2(h,u).inInner()){let p=Te.dispatch(n,"modify");t.addCommand(p),A.publish("hasModifyPcbItem",n),n.net=Object.is(r,void 0)?o.net:r,A.publish("hasModifyPcbItem",n)}},[s,a]=[n.startLayer,n.endLayer];l(s),l(a)}}function FUe(o){let t=[];t.push(o);let e=new Set([]),r=new Set([]);for(;t.length>0;){let n=t.shift();if(!e.has(n)){if(n===o||!(n instanceof Ri&&!n.isTestPad)){let s=n.searchNode(),a=[],l=!0;for(let c=0;c<s.length;c++)if(s[c]!==o){if(n instanceof Ue&&s[c]instanceof Ri&&!s[c].isTestPad){l=!1;break}if(s[c]instanceof Ue||s[c]instanceof Ge||s[c]instanceof Ri&&s[c].isTestPad){if(e.has(s[c]))continue;let h=n.getParent(),u=s[c].getParent();if(h&&u&&h===u)continue;a.push(s[c])}}l&&(i(r,a),t=t.concat(a))}e.add(n)}}return Array.from(r);function i(n,s){for(let a=0;a<s.length;a++)n.add(s[a])}}var BD=class{constructor(t){this.setOptions(t)}setOptions(t){let e=t.config;this.isNull(e.maxSpace)&&(e.maxSpace=e.autoSpace),this.isNull(e.minSpace)&&(e.minSpace=e.autoSpace),this.options=t}isNull(t){return Object.is(t,void 0)||Object.is(t,null)}getLayouts(){let t=this.options,e=new Xl;t.sourcePositionMap.forEach(n=>{e.put(n.uniqueId,n)});let r=new Xl;if(t.targets.forEach(n=>{if(!(n instanceof Me))return;let s=n.attrsMap["Unique ID"],a=s&&e.get(s),l=n.buildBBox();if(!a||!l){!l&&console.warn("LayoutTransmission data error!");return}let c=new S(a.x,a.y),h=n.position,u=l.transform(Qe.translate1(c.sub(h)));r.put(s,{component:n,position:c,bbox:u})}),e.clear(),e=null,r.size()<2)return Object.values(r.origin());let i=Object.values(r.origin()).sort((n,s)=>{let a=n.bbox.minX-s.bbox.minX;return a===0?s.bbox.maxY-n.bbox.maxY:a});return r.clear(),this.placeOneByOne(i,!0),i=i.sort((n,s)=>{let a=s.bbox.maxY-n.bbox.maxY;return a===0?n.bbox.minX-s.bbox.minX:a}),this.placeOneByOne(i,!1),i}fixPosition(t,e){let r=!e,i=this.options.config,n=i.maxSpace,s=i.minSpace,a=i.autoSpace,l=t[0],c=Qe.scale(1),h=null;t.forEach((u,d)=>{if(!l||l===u){l=u;return}u.position=u.position.multiply3(c),u.bbox=u.bbox.transform(c);let p=u.bbox;h=ut.extend2(h,l.bbox);let m=!1,g=!1,y=null;t.some((E,O)=>O===d?!0:(e&&E.bbox.maxY+s<=p.minY||r&&E.bbox.minX+s>=p.maxX||(y=ut.extend2(y,E.bbox)),!1)),y||(y=h),y.intersection1(p)&&(m=e,g=r);let P=p.minX-y.maxX;!m&&e&&P>0&&!(s<=P&&P<=n)&&(m=!0);let T=y.minY-p.maxY;!g&&r&&T>0&&!(s<=T&&T<=n)&&(g=!0);let I=0,C=0;if(e&&m&&(I=y.maxX-p.minX+a),r&&g&&(C=y.minY-p.maxY-a),I||C){let E=Qe.translate(I,C);u.position=u.position.multiply3(E),u.bbox=p.transform(E),c=c.multiply3(E)}l=u})}placeOneByOne(t,e,r=Qe.scale(1),i=1){for(;i>=0&&i<t.length;){let n=t[i];this.updateItemPosition(n,r);let s=Qe.scale(1),a=!0,l=i-1;for(;l>=0;){let c=t[l],h=this.getBBoxPositionInfo(c.bbox,n.bbox),u=!1;h.interset?u=!0:u=e&&a&&!this.isMatchSpace(h.dx_right)||!e&&a&&!this.isMatchSpace(h.dy_bottom),u&&(s=this.autoPlacedByAutoSpace(c,n,e,h.interset,h,s).totalMatrix),a=!1,l--}i++,r=r.multiply3(s)}}autoPlacedByAutoSpace(t,e,r,i,n,s){n=n||this.getBBoxPositionInfo(t.bbox,e.bbox);let a=this.options.config.autoSpace,l=0,c=0;if(l=-(n.dx_right-a),!n.interset&&this.isMatchSpace(n.dx_right)&&(l=0),c=n.dy_bottom-a,!n.interset&&this.isMatchSpace(n.dy_bottom)&&(c=0),i?Math.abs(l)<=Math.abs(c)?c=0:l=0:r?c=0:l=0,s){let h=Qe.translate(l,c);this.updateItemPosition(e,h),(r&&l!=0||!r&&c!=0)&&(s=s.multiply3(h))}return{dx:l,dy:c,totalMatrix:s}}updateItemPosition(t,e){return t.position=t.position.multiply3(e),t.bbox=t.bbox.transform(e),t}isMatchSpace(t){if(t<0)return!0;let e=this.options.config,r=e.maxSpace,i=e.minSpace;return t>=i&&t<=r}getBBoxPositionInfo(t,e){let r=e.maxY>t.maxY,i=e.maxX>t.maxX,n=e.minY<t.minY,s=e.minX<t.minX,a=t.isIntersect(e),l=t.minX-e.maxX,c=e.minX-t.maxX,h=e.minY-t.maxY,u=t.minY-e.maxY;return{up:r,right:i,down:n,left:s,interset:a,dx_left:l,dx_right:c,dy_top:h,dy_bottom:u}}};function VUe(o,t="."){return o.join(t)}function z9e(o,t="."){return o.split(t)}function Y9e(o,t,e="."){let r=z9e(t,e),i={levelKeys:r,queryState:!1,levelValue:null};if(!o||typeof o!="object")return i;let n=r.length,s=!1,a=0,l=o;for(;!s&&a<n;){let c=r[a];l&&typeof l=="object"&&Object.hasOwn(l,c)?(l=l[c],a++):s=!0}return s||(i.queryState=!0,i.levelValue=l),i}async function UX(o){let t=be.detectDisabledLayerTables(o),{hasDisabledLayer:e,layerIdReplacementTableMapping:r,mergedDisabledLayerTable:i}=XOt(t);if(!e)return{layerIdReplacementTableMapping:r};let n=!0,s={mergedDisabledLayerTable:i,skipLayerEnable:n},a=(await ie.windowBridge.rpcCall("openUnableLayerObjDialog",s,$())).message,l=a==null?void 0:a.action,c=a==null?void 0:a.layerIdReplacementTableByName,h=null;if(l=="confirm"&&n){let d=be.enableLayers(i,!1);d&&(c=d.layerIdReplacementTableByName,h=d.repeatedNameLayers),Bf.getInstance().updateLayerInfo(),Yie()}return qOt(r,c,t),jy(h)||ie.windowBridge.publish("pro-ui/showRepeatedNameLayers",h,$()),{layerIdReplacementTableMapping:r,detectedResMapping:t,dialogResponse:a}}function XOt(o){let t=!1,e={},r={};return gm(o,(i,n)=>{let{disabledLayerTable:s,layerIdReplacementTable:a}=i;t||(t=!jy(s)),e[n]=a,gm(s,l=>{let{layerId:c,layerName:h,layerType:u}=l,d=u=="CUSTOM"?h:c;(!n||!BA(r,d))&&(r[d]=l)})}),{hasDisabledLayer:t,layerIdReplacementTableMapping:e,mergedDisabledLayerTable:r}}function qOt(o,t,e){return o||(o={}),jy(t)||gm(e,(r,i)=>{let{disabledLayerTable:n}=r,s;gm(n,a=>{let{layerId:l,layerName:c}=a,h=t[c];h&&(s||(s=Z2(o,i,{},!0)),FA(s,l,h))})}),o}async function nae(o,t){if(!o)return o;let e="",r,i=!1;Array.isArray(o)?(r=new Map,mR(r,e,o),i=!0):r=o;let n=new Map,s=new Map,a={};UA(r,(p,m)=>{let g=new Set;if(Rc(p,y=>{if(y instanceof Me){let b=y.footprintUUID;if(Ug(n,b,[],!0).push(y),!BA(a,b)){let T=y.getBasicLayerTable();FA(a,b,T)}}else{let b=y.layerId;Ug(s,m,[],!0).push(y),g.add(b)}}),g.size>0){let y=t(g,m);jy(y)||FA(a,m,y)}});let l=await UX(a);if(!l)return i?Ug(r,e):r;let{layerIdReplacementTableMapping:c,detectedResMapping:h,dialogResponse:u}=l;return(u==null?void 0:u.action)=="cancel"&&s.size>0&&UA(s,(p,m)=>{let g=Z2(h,m),y=g==null?void 0:g.disabledLayerTable;if(jy(y))return;let P=Ug(r,m).filter(T=>{let I=T.layerId,C=I&&BA(y,I);return C&&T.remove(),!C});mR(r,m,P)}),jy(c)||UA(r,(p,m)=>{let g=Z2(c,m);Rc(p,y=>{if(y instanceof Me){let b=y.footprintUUID,P=Z2(c,b);y.setLayerIdReplacementTable(P,!0)}else if(g){let b=y.layerId,P=Z2(g,b);P&&(y.layerId=P)}})}),i?Ug(r,e):r}var oae=class{constructor(){this.historyGroup=null;this.deleteComponentMap={};this.footprintName2PositionMap={};this.uniqueId2RemoveComponentId=new Xl;this.oldComponentId2NewComponentIdMap=new Xl;this.sourcePositionMap=new Xl;this.addComponentMap=[];this.addUniqueId2ComponentIdMap=new Xl;this.reuseData=new Array;this.hasCheckedOpenStiffenerLayer=!1;this.ignoreAttr=new Set(["Footprint","Device","Symbol","Convert to PCB","3D Model","3D Model Transform","3D Model Title","FootprintName","DeviceName","SymbolName","CBB Title","CBB ID","Sim Model","Sim Model Title","Sim Model Path","NGSpice Model","NGSpice Model Title","NGspice Model Path"]);this.footprints=new Set;A.messageBus.rpcService("pcb/editor/updateForNetList",this.apply.bind(this)),A.messageBus.rpcService("pcb/editor/modifyPartitionFlag",this.modifyPartitionFlag.bind(this))}async apply(t){if(!t||!x.getInstance().isactive||x.getInstance().doctype!=3)return;let e=this.init(),r=Cr.isEmpty(),i;i=this.dataClassify(t,r),t=null,setTimeout(async()=>{A.publish("showLoading","",$());let{addMap:s,updateMap:a,delMap:l,commonCompared:c,env:h,pcbModule:u}=i;i=null,this.delComponents(l);let d;{let p=this.initPosition();d=await this.addComponents(s,u),this.layoutTransmission(p),this.sourcePositionMap.clear()}{let p=this.getComponentNetMap(s,[],[]);s.length=0,s=null,this.addUniqueId2ComponentIdMap.clear(),this.updateConnectNet(p,!1,!0),p=null}this.updateComponents(a),a.length=0,a=null,this.updatePadConnectNet();{let p=this.updateCommonCompared(c);c=null,p&&Object.keys(p).length>0&&A.publish("ui/commonComparedResApplyRes",{commonComparedResApplyRes:p,env:h},$())}A.publish("hideLoading","",$()),await this.checkShapesEnableLayer(),this.historyGroup.length>0&&(je.executeCommand(this.historyGroup),this.historyGroup=null),d.length>0&&A.publish("rebuildSingleCopper",{ids:d,isLast:!0}),A.publish("autoFill",""),A.publish("flushService",""),e&&A.publish("toggleLayerSelected",{layerid:e}),this.reset(),n()},50);function n(){A.publish("ui/toastMsg",{type:"info",msg:"Import finished"},$())}}init(){let t=$e.getInstance().activeLayer;return t==1?t=null:A.publish("toggleLayerSelected",{layerid:1}),this.historyGroup=new ve("import change for Net list"),A.publish("clearSelect",""),this.usedReuseTemplateDecoders=[],t}dataClassify(t,e){var m,g;let{componentCompared:r,commonCompared:i,options:n,env:s}=t,{updateConnectNet:a,customAttr:l,pcbModule:c}=n;this.customAttr=l||{};let h=[],u=[],d=[];for(let y in r){let b=r[y];b.delComponent&&h.push(b.delComponent),b.addComponent&&(u.push(b.addComponent),b.delComponent&&(b.addComponent.extra||(b.addComponent.extra={}),b.addComponent.extra.source||(b.addComponent.extra.source={}),b.addComponent.extra.source.componentId=(g=(m=b.delComponent.extra)==null?void 0:m.source)==null?void 0:g.componentId)),b.updateComponent&&d.push(b.updateComponent)}let p=this.getComponentNetMap([],h,d,r);return!e&&this.updateConnectNet(p,a),t.componentCompared={},{addMap:u,updateMap:d,delMap:h,commonCompared:i,env:s,pcbModule:c}}delComponents(t){t.forEach(e=>{this.deleteComponent(e)})}initPosition(){let t=N0(),e=t&&t.minX,r=t&&t.minY,i=S.ORIGIN;return this.isNull(e)||this.isNull(r)?i=x.getInstance().origin:i=new S(e,r),this.nextPosition=new S(i.x,i.y-10),i}async addComponents(t,e){let r=new WeakSet,i=[];e&&Object.keys(e).length>0&&(r=await this.reuseTemplate(t,e,i));for(let n of t)r.has(n)||await this.addComponent(n);return r=null,i}updateComponents(t){t.forEach(e=>{this.updateComponent(e)})}updateCommonCompared(t){var T,I,C,E,O,_,R,v,D,w,F,H,z,G,W;if(!t)return;let{designRuleCompared:e,netClassCompared:r,equalLengthNetGroupCompared:i,differentialPairCompared:n}=t,s=te.getInstance(),a={},l=x.getInstance(),c=l.compiler,h=or.getInstance(),u=!1,d=new Set;if(e){s.setRuleTemplateName("Custom Config");let{trackPhysics:L,netRule:B}=e,N=new Set,U=new Set,k="common";(T=L==null?void 0:L.less)==null||T.forEach(V=>{let Y=V==null?void 0:V.name;Y&&(s.deleteTrackPhysics(Y),c.deleteRule(mm("3"),Y),u=!0)}),(I=L==null?void 0:L.more)==null||I.forEach(V=>{if(!V)return;let{name:Y,isDefault:X,strokeValue:Z,unit:Q}=V,ae=bL(Q),he=this.valueDomain2RuleFactory(Z,ae);if(!he)return;let re=s.addTrackPhysics(Y,X,1,he);re&&(re.unit=Q,N.add(re))}),(C=L==null?void 0:L.changed)==null||C.forEach(V=>{if(!V)return;let{oldItem:Y,newItem:X,changedKeys:Z}=V;if(!Y||!X||Z.length==0)return;let Q=s.getTrackPhysics(Y.name);if(!Q)return;let ae=bL(X.unit);Z.forEach(he=>{if(he=="isDefault")Q.isDefault=!!X.isDefault;else if(he=="unit")Q.unit=X.unit;else if(he.indexOf("strokeValue")==0){let re=z9e(he),se=+re[1],K=re[2];if(!K)return;re[1]=k;let me=VUe(re),Oe=Y9e(X,he);Oe.queryState||(Oe=Y9e(X,me));let Ie=+Oe.levelValue;if(!Oe.queryState||!Ie)return;let ue=D2(Ie,ae);(se?[se]:Q.getAllLayerCodes()).forEach(j=>{K=="min"?Q.setMinWidth(ue,j):K=="max"?Q.setMaxWidth(ue,j):K=="default"&&Q.setDefaultWidth(ue,j)})}N.add(Q)})}),(E=B==null?void 0:B.changed)==null||E.forEach(V=>{if(!V)return;let{oldItem:Y,newItem:X,changedKeys:Z}=V;if(!Y||!X||Z.length==0)return;let Q=X.ruleMap;if(!Q)return;let ae=Y.net,he=s.getNet(ae);if(!(!he||!b([ae],{},"","changed",V,"OldNetworkNotExist",()=>p().netRule))){for(let se in Q){let K=this.validRuleName(Q[se]);se=="TrackPhysics"&&s.getTrackPhysics(K)&&(he.trackPhysics=K,U.add(he))}d.add(ae)}}),U.size>0&&(u=!0,U.forEach(V=>{c.uploadRuleSelector(h.encode("RULE_SELECTOR",V)),d.add(V.name)})),N.size>0&&(u=!0,N.forEach(V=>{c.uploadRule(h.encode("RULE",V))}))}if(r){let L=new Set;(O=r==null?void 0:r.less)==null||O.forEach(N=>{let U=N==null?void 0:N.name,k=U&&s.getNetClass(U);k&&(k.getNets().forEach(V=>{d.add(V)}),s.deleteNetClass(U),c.deleteRuleSelector(["NET_CLASS",U]),u=!0)}),(_=r==null?void 0:r.changed)==null||_.forEach(N=>{if(!N)return;let{oldItem:U,newItem:k,changedKeys:V}=N;if(!U||!k||V.length==0)return;let Y=s.getNetClass(k.name);Y&&V.includes("nets")&&Fb(U.nets,k.nets).more.forEach(X=>{Y.removeNetwork(X),d.add(X),L.add(Y)})});let B={};s.getAllNetClass().forEach(N=>{let U=N.name;N.getNets().forEach(k=>{B[k]=U})}),(R=r==null?void 0:r.more)==null||R.forEach(N=>{if(!N)return;let{name:U,nets:k,netRule:V}=N,Y=s.addNetClass(U);L.add(Y),k.forEach(X=>{if(!b([X],B,U,"more",N,"NewNetworkNotExist",m))return;let Q=s.getNet(X);Q&&(Y.addNetwork(Q),B[X]=U,d.add(X))})}),(v=r==null?void 0:r.changed)==null||v.forEach(N=>{if(!N)return;let{oldItem:U,newItem:k,changedKeys:V}=N;if(!U||!k||V.length==0)return;let Y=s.getNetClass(k.name);if(Y&&V.includes("nets")){Y.remove();let X=k.name,Z=!1;k.nets.forEach(Q=>{if(!b([Q],B,X,"changed",N,"NewNetworkNotExist",m))return;let he=s.getNet(Q);he&&(Y.addNetwork(he),d.add(Q),Z=!0)}),Z&&L.add(Y)}}),L.size>0&&(u=!0,L.forEach(N=>{c.uploadRuleSelector(h.encode("RULE_SELECTOR",N))}),A.publish("forceRenderTree",tn.NetClasses,$()))}if(i){let L=new Set;(D=i==null?void 0:i.less)==null||D.forEach(N=>{let U=N==null?void 0:N.name,k=U&&s.getEqualLengthGroup(U);k&&(k.getNets().forEach(V=>{d.add(V)}),s.deleteEqualLengthGroup(U),c.deleteRuleSelector(["EQ_LEN_GRP",U]),u=!0)}),(w=i==null?void 0:i.changed)==null||w.forEach(N=>{if(!N)return;let{oldItem:U,newItem:k,changedKeys:V}=N;if(!U||!k||V.length==0)return;let Y=s.getEqualLengthGroup(k.name);Y&&V.forEach(X=>{X=="nets"&&Fb(U.nets,k.nets).more.forEach(Z=>{Y.deleteNet(Z),d.add(Z),L.add(Y)})})});let B={};s.getAllEqualLengthGroups().forEach(N=>{let U=N.name;N.getNets().forEach(k=>{B[k]=U})}),(F=i==null?void 0:i.more)==null||F.forEach(N=>{if(!N)return;let{name:U,nets:k,useRuleName:V}=N,Y=s.addEqualLengthGroup(U);L.add(Y),k.forEach(X=>{if(!b([X],B,U,"more",N,"NewNetworkNotExist",g))return;let Q=s.getNet(X);Q&&(Y.addNetwork(Q),B[X]=U,d.add(X))}),Y.netLengthPhysics=this.validRuleName(V)}),(H=i==null?void 0:i.changed)==null||H.forEach(N=>{if(!N)return;let{oldItem:U,newItem:k,changedKeys:V}=N;if(!U||!k||V.length==0)return;let Y=s.getEqualLengthGroup(k.name);if(!Y)return;let X=!1;V.forEach(Z=>{if(Z=="nets"){Y.remove();let Q=k.name;k.nets.forEach(ae=>{if(!b([ae],B,Q,"changed",N,"NewNetworkNotExist",g))return;let re=s.getNet(ae);re&&(Y.addNetwork(re),d.add(ae),X=!0)})}else Z=="useRuleName"&&(Y.netLengthPhysics=this.validRuleName(k.useRuleName),X=!0)}),X&&L.add(Y)}),L.size>0&&(u=!0,L.forEach(N=>{c.uploadRuleSelector(h.encode("RULE_SELECTOR",N))}),A.publish("forceRenderTree",tn.EqualLengthGroups,$()))}if(n){let L=new Set;(z=n==null?void 0:n.less)==null||z.forEach(N=>{let U=N==null?void 0:N.name,k=U&&s.getNetDifferential(U);k&&(k.getNets().forEach(V=>{d.add(V)}),s.deleteNetDifferential([U]),c.deleteRuleSelector(["DIFF_PAIR",U]))});let B={};s.getAllNetDifferentials().forEach(N=>{let U=N.name;[N.negativeNet.name,N.positiveNet.name].forEach(k=>{B[k]=U})}),(G=n==null?void 0:n.more)==null||G.forEach(N=>{if(!N)return;let{name:U,positiveNet:k,negativeNet:V,useRuleName:Y}=N;if(!b([k,V],B,U,"more",N,"NewNetworkNotExist",y))return;let Z=s.addNetDifferential(U,k,V,this.validRuleName(Y));B[k]=U,B[V]=U,L.add(Z),d.add(k),d.add(V)}),(W=n==null?void 0:n.changed)==null||W.forEach(N=>{if(!N)return;let{oldItem:U,newItem:k,changedKeys:V}=N;if(!U||!k||V.length==0)return;let Y=s.getNetDifferential(k.name);if(!Y||!b([k.positiveNet,k.negativeNet],B,k.name,"changed",N,"NewNetworkNotExist",y))return;let Z=!1;V.forEach(Q=>{Z=!0,Q=="positiveNet"?(Y.positiveNet=s.getNet(k.positiveNet),d.add(k.positiveNet)):Q=="negativeNet"?(Y.negativeNet=s.getNet(k.negativeNet),d.add(k.negativeNet)):Q=="useRuleName"&&(Y.differentialPhysics=this.validRuleName(k.useRuleName))}),Z&&L.add(Y)}),L.size>0&&(u=!0,L.forEach(N=>{c.uploadRuleSelector(h.encode("RULE_SELECTOR",N))}),A.publish("forceRenderTree",tn.Differentials,$()))}return d.size>0&&(u=!0,d.forEach(L=>{Ql(L)}),A.publish("forceRenderTree",tn.Nets,$())),u&&A.publish("setPcbTabUnSaved",[l.tabId,!0],$()),a;function p(){return a.designRuleCompared||(a.designRuleCompared={trackPhysics:{},netRule:{}}),a.designRuleCompared}function m(){return a.netClassCompared||(a.netClassCompared={}),a.netClassCompared}function g(){return a.equalLengthNetGroupCompared||(a.equalLengthNetGroupCompared={}),a.equalLengthNetGroupCompared}function y(){return a.differentialPairCompared||(a.differentialPairCompared={}),a.differentialPairCompared}function b(L,B,N,U,k,V,Y){let X=[],Z={};L.forEach(ae=>{if(!ae)return;s.getNet(ae)||X.push(ae);let he=B[ae];he&&he!=N&&(Z[ae]=he)});let Q=!0;if(X.length>0){let ae=Y();P(ae,U,k,V,{notExistNets:X}),Q=!1}if(Object.keys(Z).length>0){let ae=Y();P(ae,U,k,"NetworkConflict",{netConflictMap:Z}),Q=!1}return Q}function P(L,B,N,U,k){if(!L)return;let V=L[B];V||(V=L[B]=[]);let Y={applyRes:U,commonComparedItem:N};k&&Object.assign(Y,k),V.push(Y)}}valueDomain2RuleData(t,e){if(!t)return null;let{default:r,min:i,max:n}=t;return isNaN(r)?null:(isNaN(i)&&(i=r),isNaN(n)&&(n=r),{defaultValue:D2(r,e),minValue:D2(i,e),maxValue:D2(n,e)})}valueDomain2RuleFactory(t,e){if(!t)return null;let r=new Map;for(let i in t){let n=+i;n||(n=1);let s=this.valueDomain2RuleData(t[i],e);s&&r.set(n,s)}return new qa(r)}validRuleName(t){return t||"default"}modifyPartitionFlag(t){var r,i,n,s;let e=[];for(let a in t){let l=t[a];if(l.delComponent){let c=(i=(r=l.delComponent.extra)==null?void 0:r.source)==null?void 0:i.componentId,h=c&&this.getComponent(c),u=h.partition!="";u||(u=!Bt.checkIsInCanEdit(h)),l.delComponent.extra.source.isPartition=u}if(l.updateComponent){let c=(s=(n=l.updateComponent.baseComponent.extra)==null?void 0:n.source)==null?void 0:s.componentId,h=c&&this.getComponent(c);l.updateComponent.baseComponent.extra.source.isPartition=h.partition!="",e.push(l.updateComponent)}}return e.forEach(a=>{var y,b,P,T;let{baseComponent:l,nets:c}=a;if(((b=(y=l.extra)==null?void 0:y.source)==null?void 0:b.isPartition)==!0)return;let h=(T=(P=l.extra)==null?void 0:P.source)==null?void 0:T.componentId,u=h&&this.getComponent(h),d=l.uniqueId;if(!u||!d||Bt.checkIsInCanEdit(u))return;l.extra.source.isPartition=!0;let m={};c.forEach(I=>{m[I.key]=I});let g=u.getPads();for(let I of g){let C=m[I.num];if(C!=null){let E=u.partition!="";C.isPartition=E}}}),t}reset(){this.deleteComponentMap={},this.footprintName2PositionMap={},this.uniqueId2RemoveComponentId.clear(),this.oldComponentId2NewComponentIdMap.clear(),this.addComponentMap.length=0,this.addUniqueId2ComponentIdMap.clear(),this.sourcePositionMap.clear(),this.reuseData.length=0,this.hasCheckedOpenStiffenerLayer=!1,delete this.historyGroup,delete this.customAttr,delete this.nextPosition,delete this.connectionGroups,delete this.visitedComponentPads,delete this.usedReuseTemplateDecoders}isNull(t){return Object.is(t,void 0)||Object.is(t,null)}getComponentNetMap(t,e,r,i){let n=this,s={};t.forEach(l=>{let c=l.uniqueId;if(!c)return;let h=l.nets,u=s[c];if(!u){let d=this.addUniqueId2ComponentIdMap.get(c);if(!d)return;u={net:{},componentId:d},s[c]=u}for(let d in h)u.net[d]=h[d];l.uniqueId=null,l.props=null,l.nets=null,l.extra=null}),e.forEach(l=>{var c;if(i){let h=l.uniqueId,u=(c=i[h])==null?void 0:c.addComponent;if(u){let d=l.nets||{},p=u.nets||{},m=[];for(let g in p)m.push({type:Object.hasOwn(d,"num")?"update":"add",key:g});a(l,u,m);return}}a(l)}),r.forEach(l=>{a(l.baseComponent,l.importComponent,l.nets)});function a(l,c,h){var g,y,b,P;let u=(y=(g=l.extra)==null?void 0:g.source)==null?void 0:y.componentId,d=u&&n.getComponent(u),p=l.uniqueId;if(!d||!p)return;let m=s[p];if(m||(m={net:{},componentId:u,isPartition:(P=(b=l.extra)==null?void 0:b.source)==null?void 0:P.isPartition},s[p]=m),h&&c){h.forEach(T=>{let I=T.key,C=c.nets[I];m.net[I]=C});return}if(c)Object.assign(m.net,c.nets);else{let T=d.getPads();for(let I of T)m.net[I.num]=I.net}}return s}async reuseTemplate(t,e,r){let i=new Map;for(let l of t){let c=l.props["Reuse Block"];c!=null&&c!=""&&VA(i,c,l)}let n=new WeakSet,s=new Set,a=new Set;for(let[l,c]of i){let h=e[l];if(h==null)continue;let u=new Xl;for(let b of c)await this.addComponent(b,u),n.add(b);if(a.has(l)){u.clear();continue}let d=u.getKeys(),p=/R(\d+)/,m=d.sort((b,P)=>{let T=b.match(p),I=P.match(p);if(T&&I){let C=T[0],E=+T[1],O=b.split(C)[0],_=I[0],R=+I[1],v=P.split(_)[0];if(O==v)return E-R}return 0}),g=[];m.forEach(b=>{let P=u.get(b);P&&P.length>0&&g.push(P)}),A.publish("maskUpdateFrame","");let y=this.usedReuseTemplateDecoders;for(let b of g){let P=new g_;if(await P.parseTemplate(h),!P.hasComponents()){a.add(l);break}for(let I of b)this.historyGroup.addCommand(Te.dispatch(I,"modify")),A.publish("hasModifyPcbItem",I);let T=P.reuse(b,l,!0);if(T!=null){P.isMatch||s.add(T.name),this.reuseData.push(T);let I=T.getItems();for(let C of I)C instanceof Me||(C instanceof Ye&&C.type==="Copper Region"&&r.push(C.globalIndex),this.historyGroup.addCommand(Te.dispatch(C,"add")),A.publish("hasModifyPcbItem",C));this.historyGroup.addCommand(Te.dispatch(T,"add")),y.push(P)}}u.clear()}if(s.size>0){let l=x.getInstance().tabId,c=[];for(let h of s){let d={attr:{id:kt.getGroupByName(h).globalIndex,pcbid:l},text:h};c.push(d)}A.publish("ui/toastMsg",{type:"warn",msg:["The number of components in the following group templates is inconsistent with the reuse group, and the missing components are automatically ignored:",...s],bottomBarMsg:{type:"warn",msg:['<span class="i18n">The number of components in the following group templates is inconsistent with the reuse group, and the missing components are automatically ignored:</span>',...c]}},$())}return i.clear(),s.clear(),i=null,s=null,n}updateConnectNet(t,e=!1,r=!1){A.publish("updateRtree","");for(let i in t){let n=t[i],a=this.getComponent(n.componentId).getPads();for(let l of a){let c=n.net[l.num];if(c!=null){if(l.net===c){r&&y_(l,this.historyGroup,!1,c);continue}e&&this.collectionPadConnectNodes(l),y_(l,this.historyGroup,!1,c),this.historyGroup.addCommand(Te.dispatch(l,"modify")),A.publish("hasModifyPcbItem",l),l.net=c,A.publish("hasModifyPcbItem",l)}}}}collectionPadConnectNodes(t){let e=this.connectionGroups;e||(e=this.connectionGroups=[]);let r=this.visitedComponentPads;r||(r=this.visitedComponentPads=new Set);let i={componentPads:new Set,connectNodes:new Set},n=[t],s=new Set;for(;n.length>0;){let c=n.shift();if(l(c))continue;c.searchNode(!1).forEach(u=>{l(u)||n.push(u)}),a(i,c),s.add(c)}e.push(i);function a(c,h){let{componentPads:u,connectNodes:d}=c;if(h instanceof Ue||h instanceof Ge||h instanceof Le||h instanceof Ye&&["Fill Region","Line"].includes(h.type)||h instanceof ii){if(h instanceof Le&&h.getParent())u.add(h),r.add(h);else if(d.add(h),h instanceof ii){let m=h.getParent();d.add(m),m instanceof Ye&&m.iteratorCopper(g=>{d.add(g)})}}}function l(c){return r.has(c)||s.has(c)}}updatePadConnectNet(){let t=this.connectionGroups;if(!t)return;let e=this.historyGroup,r=!1;return t.forEach(i=>{let{componentPads:n,connectNodes:s}=i,a=new Set;if(n.forEach(c=>{a.add(c.net)}),a.size!=1)return;let l=a.values().next().value||"";l&&s.forEach(c=>{r=this.changeItemNet(c,l,e)||r})}),r}changeItemNet(t,e,r){if(t.net==e)return!1;let i=Te.dispatch(t,"modify");return A.publish("hasModifyPcbItem",t),r.addCommand(i),t.net=e,A.publish("hasModifyPcbItem",t),!0}async addComponent(t,e){var v,D,w,F;let{uniqueId:r,props:i,nets:n,extra:s}=t,a=s==null?void 0:s.bindingLibs;if(!a)return;let l=(v=a.device)==null?void 0:v.libDetail,c=(D=a.footprint)==null?void 0:D.libDetail;if(!l||!c)return;let h=l.display_title,u=c.display_title,d=l.uuid,p=x.getInstance().compilerChannel,m=await ps.add(d,p),g=await Ji.add(c.uuid,p);if(!g)return;!this.hasCheckedOpenStiffenerLayer&&!this.footprints.has(g.id)&&(this.footprints.add(c.uuid),g.iterator(H=>_c(H.layerId)?(this.checkOpenStiffenerLayer(),!1):!0));let y=new e2,b=cr(),P=y.build(m.createComponent(b,g.uuid),S.ORIGIN),T=((w=this.deleteComponentMap[r])==null?void 0:w.location)||this.getPartPosition(u,P);P.position=new S(T.x,T.y),P.visible(),this.syncComponentConfig(P);let I=i.Designator;I&&P.name!=I&&(P.name=I,this.updateAttrShow(P,"Designator",I)),u&&(P.footprintId=u,this.updateAttrShow(P,"Footprint",u)),h&&P.deviceShape!=null&&(P.device=h,this.updateAttrShow(P,"Device",h));let C=new Set;for(let H in i){let z=i[H];if(this.isSpecialAttr(H))continue;if(H=="PCB Layer"){z=="BottomLayer"&&(P.layerId=2);continue}C.add(H),this.updateDeviceAttr(P,H,z);let G=ce.attributeConfig.getAttribute("Designator");G!=null&&H==="Designator"&&(P.numShape.showValue=G.showValue)}if(C.size>0)for(let H in P.attrsMap)this.isSpecialAttr(H)||C.has(H)||this.updateDeviceAttr(P,H,"",!0);let E=this.deleteComponentMap[r];if(E){P.position=E.location,P.layerId=E.layerId,P.rotation=E.rotation;let H=E.groupId;if(H){let G=kt.getItem(H);G?G.addItem(P):kt.combination([P],H)}let z=E.num_location;z&&P.numShape&&(P.numShape.position=z,P.numShape.positionIsNull=E.num_positionIsNull,P.numShape.showKey=E.num_showKey,P.numShape.showValue=E.num_showVal,P.numShape.rotation=E.num_rotation)}this.updateNets(n,P,!1,!0),this.historyGroup.addCommand(Te.dispatch(P,"add")),A.publish("hasModifyPcbItem",P);let O=s.layout,_=(F=s.source)==null?void 0:F.pageId;O&&_&&wy(this.sourcePositionMap.origin(),_).push({x:O.x,y:O.y,uniqueId:r}),!E&&this.addComponentMap.push(P),this.addUniqueId2ComponentIdMap.put(r,P.globalIndex),E==null&&P.combinationID!=null&&P.combinationID!=""&&e!=null&&e.computeIfAbsent(P.combinationID,()=>new Array).push(P);let R=this.uniqueId2RemoveComponentId.get(r);R&&this.oldComponentId2NewComponentIdMap.put(R,P.globalIndex)}syncComponentConfig(t){t.attributes.forEach(e=>{let r=ce.attributeConfig.getAttribute(e.key);r!=null&&(e.showKey=r.showKey,e.showValue=r.showValue)})}checkOpenStiffenerLayer(t){if(this.hasCheckedOpenStiffenerLayer)return;let e=!t;if(t){for(let r of t.getItems())if(r instanceof Ye&&_c(r.layerId)){e=!0;break}}e&&(A.publish("checkOpenStiffenerLayer",""),this.hasCheckedOpenStiffenerLayer=!0)}layoutTransmission(t){if(this.sourcePositionMap.size()==0||this.addComponentMap.length==0)return;let e=10,r={autoSpace:D2(.5,39.37,e)},i=[],n=this.addComponentMap.filter(u=>u.getGroupID()==null);this.sourcePositionMap.iterator((u,d)=>{let p=new BD({sourcePositionMap:d,targets:n,config:r}).getLayouts();if(p.length==0)return!0;let m=null;return p.forEach(g=>{m=ut.extend2(m,g.bbox)}),i.push({bbox:m,items:p}),!0}),n.length=0;let s=D2(5,39.37,e),a=s,l=5;i.length>1&&(i=i.sort((u,d)=>{let p=u.bbox.area(),m=d.bbox.area();return p<m?-1:p>m?1:u.bbox.height()-d.bbox.height()}));let c=0,h=null;t=t.add1(0,-a),this.reuseData=this.reuseData.sort((u,d)=>{let p=u.buildBBox(),m=d.buildBBox(),g=p.area(),y=m.area();return g<y?-1:g>y?1:p.height()-m.height()});for(let u of this.reuseData){let d=u.buildBBox(),p=d.UL(),g=(h?h.UR().add1(s,0):t).sub(p),y=u.getItems(),b=Ae.translate(g.x,g.y,0);for(let T of y)this.historyGroup.addCommand(Te.dispatch(T,"modify")),T.transform(b),A.publish("hasModifyPcbItem",T);let P=d.transform(Qe.translate1(g));h=ut.extend2(h,P),++c===l&&(c=0,t=h.LL().add1(0,-a),h=null)}for(let u of i){let{bbox:d,items:p}=u,m=u.bbox.UL(),y=(h?h.UR().add1(s,0):t).sub(m);p.forEach(b=>{let P=b.component;this.historyGroup.addCommand(Te.dispatch(P,"modify"));let T=b.position.sub(P.position).add(y);return P.transform(Ae.translate(T.x,T.y,0)),A.publish("hasModifyPcbItem",P),!0}),d=d.transform(Qe.translate1(y)),h=ut.extend2(h,d),++c===l&&(c=0,t=h.LL().add1(0,-a),h=null),p.length=0}i.length=0}updateNets(t,e,r=!1,i=!1){t!=null&&e.getPads().forEach(n=>{Ef(t,n.num)?(r&&this.historyGroup.addCommand(Te.dispatch(n,"modify")),n.net=t[n.num]||""):i&&(n.net="")})}isSpecialAttr(t){return this.ignoreAttr.has(t)}deleteComponent(t){var s,a;let e=(a=(s=t.extra)==null?void 0:s.source)==null?void 0:a.componentId,r=t.uniqueId,i=e&&this.getComponent(e);if(!i)return;this.deleteComponentMap[r]={location:i.position,layerId:i.layerId,rotation:i.rotation,num_positionIsNull:i.numShape?i.numShape.positionIsNull:!1,num_location:i.numShape?i.numShape.position:null,num_showKey:i.numShape?i.numShape.showKey:!1,num_showVal:i.numShape?i.numShape.showValue:!1,num_rotation:i.numShape?i.numShape.rotation:0,groupId:i.getGroupID()};let n=i.getGroupID();if(this.historyGroup.addCommand(Te.dispatch(i,"delete")),i.remove(),A.publish("delete",i),A.publish("hasModifyPcbItem",i),n!=null){let l=kt.getItem(n);l.getItems().length==0&&(this.historyGroup.addCommand(Te.dispatch(l,"delete")),l.dissolution(),A.publish("delete",l))}this.uniqueId2RemoveComponentId.put(r,i.globalIndex)}updateComponent(t){var u,d,p,m;let{baseComponent:e,importComponent:r,props:i,nets:n}=t;if(((d=(u=e.extra)==null?void 0:u.source)==null?void 0:d.isPartition)==!0)return;let s=(m=(p=e.extra)==null?void 0:p.source)==null?void 0:m.componentId,a=s&&this.getComponent(s);if(!a)return;let l=r.props,c=r.nets;A.publish("hasModifyPcbItem",a),this.historyGroup.addCommand(Te.dispatch(a,"modify")),i.forEach(g=>{if(this.isSpecialAttr(g.key))return;let y=g.type==="delete";this.updateDeviceAttr(a,g.key,l[g.key],y)});let h={};n.forEach(g=>{h[g.key]=c[g.key]}),this.updateNets(h,a,!0,!1),this.checkOpenStiffenerLayer(a),A.publish("hasModifyPcbItem",a)}getComponent(t){let e=Cr.getItem(this.oldComponentId2NewComponentIdMap.getOrDefault(t,t));if(e!=null)return e;console.warn("The device was not found!")}updateDeviceAttr(t,e,r,i=!1){if(i){if(e=="Device"){console.warn("Attributes that are not allowed to be deleted:",e);return}let n=t.attrKeyText[e];n&&(n.positionIsNull=!0,t.removeAttribute(n)),t.deleteATTRMap(e);return}if(e=="Group ID")t.combinationID=r;else if(e=="Channel ID")t.channelID=r;else if(e=="Reuse Block")t.reuseBlock=r;else if(e=="PCB Layer")t.layerId=r=="TopLayer"?1:2;else{t.model.addATTRMap(e,r);let n=t.attrKeyText;this.updateAttrShow(t,e,r),(r||r=="")&&n[e]&&(n[e].value=r),t.refreshNameValue()}}updateAttrShow(t,e,r){let i=this.getCustomeAttrByKey(e);if(!i)return;let s=t.attrKeyText[e];if(s)s.showKey=i.nameShow,s.showValue=i.valueShow;else if(i.nameShow||i.valueShow){let a=this.createATTR(t,e,r,i.nameShow,i.valueShow),l=ps.getItem(t.deviceUUID);l.has(a.key)&&l.addAttr(a.key,l.getAttrData(t.model,a.model))}t.resetAttr(s)}createATTR(t,e,r,i,n){let s=3;t.layerId==2&&(s=4);let a=ce.getDefaultFontSetting(),l=ti.addText(s,e,i,r,n,a.defaultComponentFontTypeface,a.defaultComponentFontHeight,t.rotation,!1,t.getNewTextPosition(),2,a.defaultComponentFontStrokeWidth,!1,0,!1,!0);return t.addAttribute(l),l}getCustomeAttrByKey(t){let e=this.customAttr;return e&&e[t]?e[t].on_PCB:null}getPartPosition(t,e){let i=this.footprintName2PositionMap[t],n=S.ORIGIN,s=this.getDeviceBBox(e),a=e.position,l=new S((s.minX+s.maxX)/2,(s.minY+s.maxY)/2),c=l.x-a.x,h=-(l.y-a.y);return i||(i=new S(this.nextPosition.x,this.nextPosition.y),this.nextPosition=new S(this.nextPosition.x+s.width()+10,this.nextPosition.y),i=new S(i.x+s.width()/2-c,i.y-s.height()/2-h)),n=new S(i.x,i.y-s.height()-10),this.footprintName2PositionMap[t]=n,i}getDeviceBBox(t){let e=new _e,r=t.buildBBox();return e.ext1(r),t.numShape&&e.ext1(t.numShape.buildBBox()),t.idShape&&e.ext1(t.idShape.buildBBox()),t.deviceShape&&e.ext1(t.deviceShape.buildBBox()),r=e.build(),r}async checkShapesEnableLayer(){let t=this.addComponentMap,e=this.usedReuseTemplateDecoders,r=new Map;Rc(t,i=>{let n=i.footprintUUID;Ug(r,n,[],!0).push(i)}),Rc(e,(i,n)=>{let s=i.getItems();if(s.length==0)return;let a=n.toString();mR(r,a,s)}),await nae(r,(i,n)=>{let s=parseInt(n),a=e[s];return a==null?void 0:a.getBasicLayerTable(i)})}};var $We=nd(AWe());var Cae=class{constructor(){this.fileData=[]}addTextFile(t,e,r){let n=new TextEncoder().encode(e);this.fileData.push({name:t,array:n,type:"file",size:n.length,dataType:"array",opts:r})}addFileArrayBuffer(t,e,r){let i=new Uint8Array(e);this.fileData.push({name:t,array:i,type:"file",size:i.length,dataType:"array",opts:r})}addFile(t,e,r){this.fileData.push({name:t,file:e,size:e.size,type:"file",dataType:"file",opts:r})}addFolder(t,e){this.fileData.push({name:t,type:"directory",size:0,dataType:"none",opts:e})}_createBuffer(){let t=0;for(let r=0;r<this.fileData.length;r++){let i=this.fileData[r].size;t+=512+512*Math.trunc(i/512),i%512&&(t+=512)}let e=10240*Math.trunc(t/10240);t%10240&&(e+=10240),this.buffer=new ArrayBuffer(e)}write(){return new Promise((t,e)=>{this._createBuffer();let r=0,i=0,n=()=>{if(i++,i===this.fileData.length){let s=new Uint8Array(this.buffer);t(s)}};for(let s=0;s<this.fileData.length;s++){let a=this.fileData[s];this._writeFileName(a.name,r),this._writeFileType(a.type,r),this._writeFileSize(a.size,r),this._fillHeader(r,a.opts,a.type),this._writeChecksum(r);let l=new Uint8Array(this.buffer,r+512,a.size);if(a.dataType==="array"){for(let c=0;c<a.size;c++)l[c]=a.array[c];n()}else if(a.dataType==="file"){let c=new FileReader;c.onload=(function(h){let u=h;return function(d){let p=d.target.result,m=new Uint8Array(p);for(let g=0;g<m.length;g++)u[g]=m[g];n()}})(l),c.readAsArrayBuffer(a.file)}else a.type==="directory"&&n();r+=512+512*Math.trunc(a.size/512),a.size%512&&(r+=512)}})}_writeString(t,e,r){let i=new Uint8Array(this.buffer,e,r),n=new TextEncoder;if(n.encodeInto){let s=n.encodeInto(t,i).written;for(let a=s;a<r;a++)i[a]=0}else{let s=n.encode(t);for(let a=0;a<r;a++)i[a]=a<s.length?s[a]:0}}_writeFileName(t,e){this._writeString(t,e,100)}_writeFileType(t,e){let r="0";t==="file"?r="0":t==="directory"&&(r="5");let i=new Uint8Array(this.buffer,e+156,1);i[0]=r.charCodeAt(0)}_writeFileSize(t,e){let r=t.toString(8);r=this._leftPad(r,11),this._writeString(r,e+124,12)}_leftPad(t,e){let r=t+"";for(;r.length<e;)r="0"+r;return r}_writeFileMode(t,e){this._writeString(this._leftPad(t,7),e+100,8)}_writeFileUid(t,e){this._writeString(this._leftPad(t,7),e+108,8)}_writeFileGid(t,e){this._writeString(this._leftPad(t,7),e+116,8)}_writeFileMtime(t,e){this._writeString(this._leftPad(t,11),e+136,12)}_writeFileUser(t,e){this._writeString(t,e+265,32)}_writeFileGroup(t,e){this._writeString(t,e+297,32)}_writeChecksum(t){this._writeString("        ",t+148,8);let e=new Uint8Array(this.buffer,t,512),r=0;for(let i=0;i<512;i++)r+=e[i];this._writeString(r.toString(8),t+148,8)}_getOpt(t,e,r){return t!=null&&t[e]!=null?t[e]:r}_fillHeader(t,e,r){let i=this._getOpt(e,"uid",1e3),n=this._getOpt(e,"gid",1e3),s=this._getOpt(e,"mode",r==="file"?"664":"775"),a=this._getOpt(e,"mtime",Date.now()),l=this._getOpt(e,"user","tarballjs"),c=this._getOpt(e,"group","tarballjs");this._writeFileMode(s,t),this._writeFileUid(i.toString(8),t),this._writeFileGid(n.toString(8),t),this._writeFileMtime(Math.trunc(a/1e3).toString(8),t),this._writeString("ustar",t+257,6),this._writeString("00",t+263,2),this._writeFileUser(l,t),this._writeFileGroup(c,t)}};var k5=class{};k5.svgPath=[{rect:"M12.5,3.5v9h-9v-9z M13.5,2.5h-11v11h11V2.5z"},{circle:"M8,3c2.757,0,5,2.243,5,5s-2.243,5-5,5s-5-2.243-5-5S5.243,3,8,3 M8,2C4.686,2,2,4.686,2,8s2.686,6,6,6s6-2.686,6-6S11.314,2,8,2L8,2z"},{triangle:"M12.268,3.804L8,11.196L3.732,3.804z M14,2.804L2,2.804L8,13.196z"},{sixPointStar:"M 8 3.729 L 9.067 6.151 L 11.698 5.865 L 10.136 8 L 11.699 10.136 L 9.068 9.85 L 8 12.271 L 6.932 9.85 L 4.301 10.136 L 5.864 8 L 4.301 5.864 L 6.932 6.15 Z M 8 1.25 L 6.313 5.077 L 2.154 4.625 L 4.625 8 L 2.154 11.375 L 6.312 10.923 L 8 14.75 L 9.688 10.923 L 13.846 11.375 L 11.375 8 L 13.846 4.625 L 9.688 5.077 Z"},{fourPointStar:`M11.964,4.036l-1.63,3.546L10.142,8l0.192,0.418l1.63,3.546l-3.546-1.63L8,10.142l-0.418,0.192l-3.546,1.63l1.63-3.546
			L5.858,8L5.666,7.582l-1.63-3.546l3.546,1.63L8,5.858l0.418-0.192L11.964,4.036 M14,2L8,4.757L2,2l2.757,6L2,14l6-2.757L14,14
			l-2.757-6L14,2L14,2z`},{plus:`M9.727,3v2.273v1h1H13v3.455h-2.273h-1v1V13H6.273v-2.273v-1h-1H3V6.273h2.273h1v-1V3H9.727 M10.727,2H5.273v3.273H2v5.455
			h3.273V14h5.455v-3.273H14V5.273h-3.273V2L10.727,2z`},{x:`M12.5,3.5v2.382l-2.447,1.224L8.264,8l1.789,0.894l2.447,1.224V12.5h-2.382l-1.223-2.447L8,8.264l-0.895,1.789L5.882,12.5
			H3.5v-2.382l2.447-1.224L7.736,8L5.947,7.106L3.5,5.882V3.5h2.382l1.223,2.447L8,7.736l0.895-1.789L10.118,3.5H12.5 M13.5,2.5h-4
			L8,5.5l-1.5-3h-4v4l3,1.5l-3,1.5v4h4l1.5-3l1.5,3h4v-4l-3-1.5l3-1.5V2.5L13.5,2.5z`},{diamond:"M8,2.914L13.086,8L8,13.086L2.914,8L8,2.914 M8,1.5L1.5,8L8,14.5L14.5,8L8,1.5L8,1.5z"},{doubleRect:"M12.5,3.5v9h-9v-9H12.5 M13.5,2.5h-11v11h11V2.5L13.5,2.5z M10.5,5.5v5h-5v-5H10.5 M11.5,4.5h-7v7h7V4.5L11.5,4.5z"}];function _We(o){return o===32||o===9||o===13||o===10}var HV=class{constructor(){this._line=1;this._col=0}line(){return this._line}col(){return this._col}_feed(t){return t===10?(this._col=0,this._line++):this._col++,this.feed(t)}parse(t){let e=t.length;for(let r=0;r<e;r++){let i=t.charCodeAt(r);if(!this._feed(i))return this}return this.finish(),this}};var AEe=500,vWe=String.fromCharCode,WV=class{constructor(){this.buffer=new Array}size(){return this.buffer.length}isEOF(){return!1}write(t){return this.buffer.push(t),1}writen1(t){return this.writen2(t,0,t.length)}writen2(t,e,r){let i=this.buffer;for(let n=0,s=e;n<r;n++,s++)i.push(t[s]);return r}writeAsync(t,e){e(this.write(t))}writenAsync1(t,e){e(this.writen1(t))}writenAsync2(t,e,r,i){i(this.writen2(t,e,r))}writeStr(t){let e=t.length,r=new Array(e);for(let i=0;i<e;i++)r[i]=t.charCodeAt(i);return this.writen1(r)}clear(){this.buffer.length=0}toString(){let t=this.buffer,e=t.length;if(e<=AEe)return vWe.apply(null,t);{let r=new Array;for(let i=0;i<t.length;i+=AEe){let n=Math.min(e-i,AEe),s=vWe.apply(null,t.slice(i,i+n));r.push(s)}return r.join("")}}};var xWe=(n=>(n[n.UNKNOW=0]="UNKNOW",n[n.NUMBER_INTEGER=1]="NUMBER_INTEGER",n[n.NUMBER_DECIMAL=2]="NUMBER_DECIMAL",n[n.NUMBER_E=3]="NUMBER_E",n[n.NUMBER_E_SIGNED=4]="NUMBER_E_SIGNED",n))(xWe||{}),RWe=(w=>(w[w.UNKNOW=0]="UNKNOW",w[w.MOVE_X=1]="MOVE_X",w[w.MOVE_Y=2]="MOVE_Y",w[w.LINE_X=3]="LINE_X",w[w.LINE_Y=4]="LINE_Y",w[w.HORIZONTAL_X=5]="HORIZONTAL_X",w[w.VERTICAL_Y=6]="VERTICAL_Y",w[w.CUBIC_BEZIER_X1=7]="CUBIC_BEZIER_X1",w[w.CUBIC_BEZIER_Y1=8]="CUBIC_BEZIER_Y1",w[w.CUBIC_BEZIER_X2=9]="CUBIC_BEZIER_X2",w[w.CUBIC_BEZIER_Y2=10]="CUBIC_BEZIER_Y2",w[w.CUBIC_BEZIER_X=11]="CUBIC_BEZIER_X",w[w.CUBIC_BEZIER_Y=12]="CUBIC_BEZIER_Y",w[w.ARC_RX=13]="ARC_RX",w[w.ARC_RY=14]="ARC_RY",w[w.ARC_ROTATION=15]="ARC_ROTATION",w[w.ARC_LARGE=16]="ARC_LARGE",w[w.ARC_SWEEP=17]="ARC_SWEEP",w[w.ARC_X=18]="ARC_X",w[w.ARC_Y=19]="ARC_Y",w[w.SMOOTH_CUBIC_BEZIER_X2=20]="SMOOTH_CUBIC_BEZIER_X2",w[w.SMOOTH_CUBIC_BEZIER_Y2=21]="SMOOTH_CUBIC_BEZIER_Y2",w[w.SMOOTH_CUBIC_BEZIER_X=22]="SMOOTH_CUBIC_BEZIER_X",w[w.SMOOTH_CUBIC_BEZIER_Y=23]="SMOOTH_CUBIC_BEZIER_Y",w[w.QUADRATIC_BEZIER_X1=24]="QUADRATIC_BEZIER_X1",w[w.QUADRATIC_BEZIER_Y1=25]="QUADRATIC_BEZIER_Y1",w[w.QUADRATIC_BEZIER_X=26]="QUADRATIC_BEZIER_X",w[w.QUADRATIC_BEZIER_Y=27]="QUADRATIC_BEZIER_Y",w))(RWe||{});function H_t(o){return 97<=o&&o<=122||65<=o&&o<=90}function wm(o){let t=parseFloat(o);if(isFinite(t))return t;throw new Error("expect number")}var Sae=class extends HV{constructor(e,r=!0,i=Gi.DUMMY){super();this.buffer=new WV;this.group=new Array;this.subPartStart=S.ORIGIN;this.curPoint=S.ORIGIN;this.lexState=0;this.parseState=0;this.isAbsolute=!1;this.isLargeArc=!1;this.x1=Number.NaN;this.y1=Number.NaN;this.x2=Number.NaN;this.y2=Number.NaN;this.x=Number.NaN;this.y=Number.NaN;this.rx=Number.NaN;this.ry=Number.NaN;this.rotation=Number.NaN;this.sweep=le.CCW;this.prevBezierCtrl2=null;this.logger=i,this.cb=e,this.yAxis=r?-1:1}on(e){return this.cb(e)}feed(e){switch(this.logger.include(0)&&this.logger.debug3("L: %c(%s)|%s",e,String.fromCharCode(e),xWe[this.lexState]),this.lexState){case 0:return _We(e)?!0:48<=e&&e<=57||e===45||e===43?(this.pushBuffer(e),this.lexState=1,!0):e===46?(this.pushBuffer(e),this.lexState=2,!0):H_t(e)?this.feedS(String.fromCharCode(e)):(this.logger.warning3("unknow letter %c",e),!0);case 1:return 48<=e&&e<=57?(this.pushBuffer(e),!0):e===46?(this.pushBuffer(e),this.lexState=2,!0):e===101||e===69?(this.pushBuffer(e),this.lexState=3,!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(e)):!1;case 2:return 48<=e&&e<=57?(this.pushBuffer(e),!0):e===101||e===69?(this.pushBuffer(e),this.lexState=3,!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(e)):!1;case 3:return 48<=e&&e<=57?(this.pushBuffer(e),!0):e===45||e===43?(this.pushBuffer(e),this.lexState=4,!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(e)):!1;case 4:return 48<=e&&e<=57?(this.pushBuffer(e),!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(e)):!1;default:return!0}}finish(){this.feed(32),this.tryNotify()}feedS(e){switch(this.logger.include(0)&&this.logger.debug3("P: %s|%s|%s|%s",e,RWe[this.parseState],this.curPoint,this.subPartStart),this.parseState){case 0:switch(e){case"M":this.isAbsolute=!0,this.parseState=1;break;case"m":this.isAbsolute=!1,this.parseState=1;break;case"L":this.isAbsolute=!0,this.parseState=3;break;case"l":this.isAbsolute=!1,this.parseState=3;break;case"H":this.isAbsolute=!0,this.parseState=5;break;case"h":this.isAbsolute=!1,this.parseState=5;break;case"V":this.isAbsolute=!0,this.parseState=6;break;case"v":this.isAbsolute=!1,this.parseState=6;break;case"z":case"Z":{this.group.push(new M(this.curPoint,this.subPartStart));let n=this.tryNotify();return this.curPoint=this.subPartStart,n}case"C":this.isAbsolute=!0,this.parseState=7;break;case"c":this.isAbsolute=!1,this.parseState=7;break;case"S":this.isAbsolute=!0,this.parseState=20;break;case"s":this.isAbsolute=!1,this.parseState=20;break;case"A":this.isAbsolute=!0,this.parseState=13;break;case"a":this.isAbsolute=!1,this.parseState=13;break;case"Q":this.isAbsolute=!0,this.parseState=24;break;case"q":this.isAbsolute=!1,this.parseState=24;break;default:this.logger.warning3("unknow %s",e)}return!0;case 1:let r=this.tryNotify();return this.x=wm(e),this.parseState=2,r;case 2:{this.y=this.yAxis*wm(e);let n;return this.isAbsolute?n=new S(this.x,this.y):n=this.curPoint.add1(this.x,this.y),this.curPoint=n,this.subPartStart=n,this.parseState=3,!0}case 3:return this.x=parseFloat(e),isFinite(this.x)?(this.parseState=4,!0):(this.parseState=0,this.feedS(e));case 4:{this.y=this.yAxis*wm(e);let n;return this.isAbsolute?n=new S(this.x,this.y):n=this.curPoint.add1(this.x,this.y),this.group.push(new M(this.curPoint,n)),this.curPoint=n,this.parseState=3,!0}case 5:if(this.x=parseFloat(e),isFinite(this.x)){let n;return this.isAbsolute?n=new S(this.x,this.curPoint.y):n=this.curPoint.add1(this.x,0),this.group.push(new M(this.curPoint,n)),this.curPoint=n,!0}else return this.parseState=0,this.feedS(e);case 6:if(this.y=parseFloat(e),isFinite(this.y)){this.y=this.yAxis*this.y;let n;return this.isAbsolute?n=new S(this.curPoint.x,this.y):n=this.curPoint.add1(0,this.y),this.group.push(new M(this.curPoint,n)),this.curPoint=n,!0}else return this.parseState=0,this.feedS(e);case 7:let i=parseFloat(e);return isFinite(i)?(this.x1=i,this.parseState=8,!0):(e!=="s"&&e!=="S"&&(this.prevBezierCtrl2=null),this.parseState=0,this.feedS(e));case 8:return this.y1=this.yAxis*wm(e),this.parseState=9,!0;case 9:return this.x2=wm(e),this.parseState=10,!0;case 10:return this.y2=this.yAxis*wm(e),this.parseState=11,!0;case 11:return this.x=wm(e),this.parseState=12,!0;case 12:{this.y=this.yAxis*wm(e);let n,s,a;return this.isAbsolute?(n=new S(this.x1,this.y1),s=new S(this.x2,this.y2),a=new S(this.x,this.y)):(n=this.curPoint.add1(this.x1,this.y1),s=this.curPoint.add1(this.x2,this.y2),a=this.curPoint.add1(this.x,this.y)),this.prevBezierCtrl2=s,this.group.push(new Mr([this.curPoint,n,s,a])),this.curPoint=a,this.parseState=7,!0}case 13:return this.rx=parseFloat(e),isFinite(this.rx)?(this.parseState=14,!0):(this.parseState=0,this.feedS(e));case 14:return this.ry=wm(e),this.parseState=15,!0;case 15:return this.rotation=wm(e),this.parseState=16,!0;case 16:return this.isLargeArc=wm(e)===1,this.parseState=17,!0;case 17:return this.sweep=wm(e)===1?le.CW:le.CCW,this.parseState=18,!0;case 18:return this.x=wm(e),this.parseState=19,!0;case 19:{this.y=this.yAxis*wm(e);let n;return this.isAbsolute?n=new S(this.x,this.y):n=this.curPoint.add1(this.x,this.y),this.group.push(q.build1(this.curPoint,n,this.rx,this.ry,this.isLargeArc,this.sweep)),this.curPoint=n,this.parseState=13,!0}case 20:return this.x2=parseFloat(e),isFinite(this.x2)?(this.parseState=21,!0):(e!=="s"&&e!=="S"&&(this.prevBezierCtrl2=null),this.parseState=0,this.feedS(e));case 21:return this.y2=this.yAxis*wm(e),this.parseState=22,!0;case 22:return this.x=wm(e),this.parseState=23,!0;case 23:{this.y=this.yAxis*wm(e);let n,s;this.isAbsolute?(n=new S(this.x2,this.y2),s=new S(this.x,this.y)):(n=this.curPoint.add1(this.x2,this.y2),s=this.curPoint.add1(this.x,this.y));let a;return this.prevBezierCtrl2?a=this.curPoint.add(this.curPoint.sub(this.prevBezierCtrl2)):a=this.curPoint,this.prevBezierCtrl2=n,this.group.push(new Mr([this.curPoint,a,n,s])),this.curPoint=s,this.parseState=20,!0}case 24:return this.x1=parseFloat(e),isFinite(this.x1)?(this.parseState=25,!0):(e!=="s"&&e!=="S"&&(this.prevBezierCtrl2=null),this.parseState=0,this.feedS(e));case 25:return this.y1=this.yAxis*wm(e),this.parseState=26,!0;case 26:return this.x=wm(e),this.parseState=27,!0;case 27:{this.y=this.yAxis*wm(e);let n,s;return this.isAbsolute?(n=new S(this.x1,this.y1),s=new S(this.x,this.y)):(n=this.curPoint.add1(this.x1,this.y1),s=this.curPoint.add1(this.x,this.y)),this.prevBezierCtrl2=n,this.group.push(new Mr([this.curPoint,n,s])),this.curPoint=s,this.parseState=24,!0}default:return this.logger.warning3("unsupported parse state %s",this.parseState),!0}}pushBuffer(e){this.buffer.write(e)}getCleanBuffer(){let e=this.buffer.toString();return this.buffer.clear(),e}tryNotify(){if(this.group.length===0)return!0;{let e=fe.build1(Fte(this.group));return this.group.length=0,this.on(e)}}onException(e){throw e}};var lh=Td.fmtNumber,f9=class{constructor(){this.state=0;this.prev=null;this.buffer=new Array}encPl(t){for(let e of t.primitives)this.encPt(e)}encPt(t){if(t instanceof M)this.encLine1(t);else if(t instanceof q)this.encArc(t);else if(t instanceof Mr){let e=t.points(.1),r=fe.build4(e);for(let i of r.primitives)this.encLine1(i)}else throw new Error("")}encBezier(t){let e=t.end(),r=t.controls.length;if(this.state===0){let i="";r==4?i+="M %s %s C ":r==3&&(i+="M %s %s Q ");for(let s=1;s<r;s++)i+="%s %s ";let n=new Array;for(let s of t.controls)n.push(lh(s.x)),n.push(lh(s.y));this.out(i,...n)}else if(t.start().equals(this.prev)){let i="";r==3?i+="S ":r==2&&(i+="T ");for(let s=1;s<r;s++)i+="%s %s ";let n=new Array;for(let s of t.controls)n.push(lh(s.x)),n.push(lh(s.y))}else{let i="";r==4?i+="M %s %s C ":r==3&&(i+="M %s %s Q ");for(let s=1;s<r;s++)i+="%s %s ";let n=new Array;for(let s of t.controls)n.push(lh(s.x)),n.push(lh(s.y));this.out(i,...n)}this.prev=e,this.state=3}encArc(t){let e=t.svgEnd;this.state===0?this.out("M %s %s A %s %s %s %d %d %s %s ",lh(t.start().x),lh(-t.start().y),lh(t.rx),lh(t.ry),0,t.isLarge()?1:0,t.sweep()===le.CCW?0:1,lh(e.x),lh(-e.y)):t.start().equals(this.prev)?this.state!==2?this.out("A %s %s %s %d %d %s %s ",lh(t.rx),lh(t.ry),0,t.isLarge()?1:0,t.sweep()===le.CCW?0:1,lh(e.x),lh(-e.y)):this.out("%s %s %s %d %d %s %s ",lh(t.rx),lh(t.ry),0,t.isLarge()?1:0,t.sweep()===le.CCW?0:1,lh(e.x),lh(-e.y)):this.out("L %s %s A %s %s %s %d %d %s %s ",lh(t.start().x),lh(-t.start().y),t.rx,t.ry,0,t.isLarge()?1:0,t.sweep()===le.CCW?0:1,lh(e.x),lh(-e.y)),this.prev=e,this.state=2}encLine1(t){this.encLine2(t.start(),t.end())}encLine2(t,e){this.state===0?this.out("M %s %s L %s %s ",lh(t.x),lh(-t.y),lh(e.x),lh(-e.y)):(this.state!==1&&this.out("L "),t.equals(this.prev)?this.out("%s %s ",lh(e.x),lh(-e.y)):this.out("%s %s %s %s ",lh(t.x),lh(-t.y),lh(e.x),lh(-e.y))),this.prev=e,this.state=1}close(t){this.state!==0&&(t&&this.out("Z "),this.state=0,this.prev=null)}toString(){return this.buffer.join("")}out(t,...e){e.length===0?this.buffer.push(t):this.buffer.push(Td.format(t,...e))}};function F3(o){let t=new Array;return new Sae(e=>(t.push(e),!0)).parse(o),t}function TP(o){let t=Array();return o.forEach(e=>{let r=new f9;r.encPl(e);let i=r.toString();t.push(i)}),t}function Eae(o){let t=new Jt;return t.add("CANCEL",!0),t.add("TABLE_SETTING",!0),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t}var IP=class extends ec{constructor(){super();this.existingInDevice=!1;this.unionAttribute=null;this.interAttribute=null;this.attrIdMap={};this._netLengthMap=new Map,this.pad=null}set(e){return this.pad=e,this}getExtra(){return{existingInDevice:this.existingInDevice}}getHtmlData(e){var b;this.idList.push(e.globalIndex),this.count++;let r=x.getInstance().unit,i=x.getInstance().origin;this.attrlist==null&&(this.attrlist={});let n=this.attrlist,s=this.getPadShapeOption();if(e.getParent()!=null){let P=e.getParent();P instanceof Me&&((n["attr-footprint-id"]==null||n["attr-footprint-id"].value!=He)&&(n["attr-footprint-id"]={title:"Footprint ID",value:this.getCompareValue("attr-footprint-id",P.footprintId)}),this.existingInDevice=!0)}else(n["attr-footprint-id"]==null||n["attr-footprint-id"].value!=He)&&(n["attr-footprint-id"]={title:"Footprint ID",value:this.getCompareValue("attr-footprint-id","")});(n["attr-select-net"]==null||n["attr-select-net"].value!=He)&&(n["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.showNet),options:this.poolCache.allNetOptions||ze.getNet()}),e.getParent()==null&&(n["attr-combination"]==null||n["attr-combination"].value!=He)&&(n["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",kt.getGroupNameByGroupId(e.getGroupID())||""),options:this.poolCache.combinationOptions,hasParent:e.getParent()!=null}),(n["attr-layerid"]==null||n["attr-layerid"].value!=He)&&(n["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Zn.abstractPad()}),(n["attr-number"]==null||n["attr-number"].value!=He)&&(n["attr-number"]={title:"Number",value:this.getCompareValue("attr-number",e.num)}),(n["attr-id"]==null||n["attr-id"].value!=He)&&(n["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",e.getParent()?`${ur}${e.getParent().number}${ur}${e.number}`:`${ur}${e.number}`),sourceId:e.globalIndex}),(n["attr-pad-shape-showtype"]==null||n["attr-pad-shape-showtype"].value!=He)&&(n["attr-pad-shape-showtype"]={title:"Type",value:this.getCompareValue("attr-pad-shape-showtype",e.type)}),(n["attr-pad-general-shape"]==null||n["attr-pad-general-shape"].value!=He)&&(n["attr-pad-general-shape"]={title:"Shape",value:this.getCompareValue("attr-pad-general-shape",this.getGeneralShape(e)),options:s}),(n["attr-pad-general-width"]==null||n["attr-pad-general-width"].value!=He)&&(n["attr-pad-general-width"]={title:"Width",value:this.getCompareValue("attr-pad-general-width",Xe(this.getGeneralWidth(e),void 0,r,this.unitConversion))}),(n["attr-pad-general-height"]==null||n["attr-pad-general-height"].value!=He)&&(n["attr-pad-general-height"]={title:"Height",value:this.getCompareValue("attr-pad-general-height",Xe(this.getGeneralHeight(e),void 0,r,this.unitConversion))}),(n["attr-pad-toplayer-shape"]==null||n["attr-pad-toplayer-shape"].value!=He)&&(n["attr-pad-toplayer-shape"]={title:"Shape",value:this.getCompareValue("attr-pad-toplayer-shape",e.topType),options:s}),e.topWidth!=null&&(n["attr-pad-toplayer-width"]==null||n["attr-pad-toplayer-width"].value!=He)&&(n["attr-pad-toplayer-width"]={title:"Width",value:this.getCompareValue("attr-pad-toplayer-width",Xe(e.topWidth,void 0,r,this.unitConversion))}),e.topHeight!=null&&(n["attr-pad-toplayer-height"]==null||n["attr-pad-toplayer-height"].value!=He)&&(n["attr-pad-toplayer-height"]={title:"Height",value:this.getCompareValue("attr-pad-toplayer-height",Xe(e.topHeight,void 0,r,this.unitConversion))}),(n["attr-pad-innerlayer-shape"]==null||n["attr-pad-innerlayer-shape"].value!=He)&&(n["attr-pad-innerlayer-shape"]={title:"Shape",value:this.getCompareValue("attr-pad-innerlayer-shape",e.innerType),options:s}),e.innerWidth!=null&&(n["attr-pad-innerlayer-width"]==null||n["attr-pad-innerlayer-width"].value!=He)&&(n["attr-pad-innerlayer-width"]={title:"Width",value:this.getCompareValue("attr-pad-innerlayer-width",Xe(e.innerWidth,void 0,r,this.unitConversion))}),e.innerHeight!=null&&(n["attr-pad-innerlayer-height"]==null||n["attr-pad-innerlayer-height"].value!=He)&&(n["attr-pad-innerlayer-height"]={title:"Height",value:this.getCompareValue("attr-pad-innerlayer-height",Xe(e.innerHeight,void 0,r,this.unitConversion))}),(n["attr-pad-bottomlayer-shape"]==null||n["attr-pad-bottomlayer-shape"].value!=He)&&(n["attr-pad-bottomlayer-shape"]={title:"Shape",value:this.getCompareValue("attr-pad-bottomlayer-shape",e.bottomType),options:s}),e.bottomWidth!=null&&(n["attr-pad-bottomlayer-width"]==null||n["attr-pad-bottomlayer-width"].value!=He)&&(n["attr-pad-bottomlayer-width"]={title:"Width",value:this.getCompareValue("attr-pad-bottomlayer-width",Xe(e.bottomWidth,void 0,r,this.unitConversion))}),e.bottomHeight!=null&&(n["attr-pad-bottomlayer-height"]==null||n["attr-pad-bottomlayer-height"].value!=He)&&(n["attr-pad-bottomlayer-height"]={title:"Height",value:this.getCompareValue("attr-pad-bottomlayer-height",Xe(e.bottomHeight,void 0,r,this.unitConversion))}),(n["attr-x"]==null||n["attr-x"].value!=He)&&(n["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",Xe(e.center.x-i.x))}),(n["attr-y"]==null||n["attr-y"].value!=He)&&(n["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",Xe(e.center.y-i.y,void 0,r,this.unitConversion))}),(n["attr-rotation"]==null||n["attr-rotation"].value!=He)&&(n["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",uc(xe(e.rotation/Math.PI*180,3)))});let a=e.locked,l=e.getParent();l!=null&&l instanceof Me&&l.locked&&(a=l.locked),(n["attr-locked"]==null||n["attr-locked"].value!=He)&&(n["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",a?"yes":"no"),options:this.poolCache.lockSettingOptions}),(n["attr-pad-hole-shape"]==null||n["attr-pad-hole-shape"].value!=He)&&(n["attr-pad-hole-shape"]={title:"Shape",value:this.getCompareValue("attr-pad-hole-shape",e.holeShape),options:this.getHoleShapeOption()}),e.holeRadius!=null&&(n["attr-pad-hole-diameter"]==null||n["attr-pad-hole-diameter"].value!=He)&&(n["attr-pad-hole-diameter"]={title:"Hole Diameter",value:this.getCompareValue("attr-pad-hole-diameter",Xe(e.holeRadius*2,void 0,r,this.unitConversion))}),e.holeLength!=null&&(n["attr-pad-hole-length"]==null||n["attr-pad-hole-length"].value!=He)&&(n["attr-pad-hole-length"]={title:"Hole Length",value:this.getCompareValue("attr-pad-hole-length",Xe(e.holeLength,void 0,r,this.unitConversion))}),e.holeRadius!=null&&(n["attr-pad-hole-width"]==null||n["attr-pad-hole-width"].value!=He)&&(n["attr-pad-hole-width"]={title:"Hole Width",value:this.getCompareValue("attr-pad-hole-width",Xe(e.holeRadius*2,void 0,r,this.unitConversion))}),e.holeRotation!=null&&!Number.isNaN(e.holeRotation)&&(n["attr-pad-hole-rotation"]==null||n["attr-pad-hole-rotation"].value!=He)&&(n["attr-pad-hole-rotation"]={title:"Hole Rotation",value:this.getCompareValue("attr-pad-hole-rotation",xe(e.holeRotation/Math.PI*180,3))}),(n["attr-pad-offset-x"]==null||n["attr-pad-offset-x"].value!=He)&&(n["attr-pad-offset-x"]={title:"Offset X",value:this.getCompareValue("attr-pad-offset-x",Xe(e.holeOffset.x,void 0,r,this.unitConversion))}),(n["attr-pad-offset-y"]==null||n["attr-pad-offset-y"].value!=He)&&(n["attr-pad-offset-y"]={title:"Offset Y",value:this.getCompareValue("attr-pad-offset-y",Xe(e.holeOffset.y,void 0,r,this.unitConversion))}),(n["attr-pad-plated"]==null||n["attr-pad-plated"].value!=He)&&(n["attr-pad-plated"]={title:"Plated",value:this.getCompareValue("attr-pad-plated",e.plated?"yes":"no")}),(n["attr-soldermask-showtype"]==null||n["attr-soldermask-showtype"].value!=He)&&(n["attr-soldermask-showtype"]={title:"Type",value:this.getCompareValue("attr-soldermask-showtype",e.expansionType)}),(n["attr-pastemask"]==null||n["attr-pastemask"].value!=He)&&(n["attr-pastemask"]={title:"Paste Mask Expansion",value:this.getCompareValue("attr-pastemask",Xe(e.pasteExpansion,void 0,r,this.unitConversion))});let c=Xe(e.topSolderExpansion,void 0,r,this.unitConversion),h=Xe(e.bottomSolderExpansion,void 0,r,this.unitConversion),u=c;e.layerId==2&&(u=h),(n["attr-soldermask"]==null||n["attr-soldermask"].value!=He)&&(n["attr-soldermask"]={title:"Solder Mask Expansion",value:this.getCompareValue("attr-soldermask",u)}),(n["attr-soldermask-toplayer"]==null||n["attr-soldermask-toplayer"].value!=He)&&(n["attr-soldermask-toplayer"]={title:"Top Solder",value:this.getCompareValue("attr-soldermask-toplayer",e.expansionType===1?"Follow Rule":c)}),(n["attr-soldermask-bottomlayer"]==null||n["attr-soldermask-bottomlayer"].value!=He)&&(n["attr-soldermask-bottomlayer"]={title:"Bottom Soler",value:this.getCompareValue("attr-soldermask-bottomlayer",e.expansionType===1?"Follow Rule":h)});let d=e.net,p=0;this._netLengthMap.has(d)?p=this._netLengthMap.get(d):(p=ze.getNetLength(d),this._netLengthMap.set(d,p)),(n["attr-net-length"]==null||n["attr-net-length"].value!=He)&&(n["attr-net-length"]={title:"Net Length",value:this.getCompareValue("attr-net-length",Xe(p,void 0,r,this.unitConversion))}),e.topRatio!=null&&(n["attr-corner-radius-toplayer"]==null||n["attr-corner-radius-toplayer"].value!=He)&&(n["attr-corner-radius-toplayer"]={title:"Corner Radius Ratio",value:this.getCompareValue("attr-corner-radius-toplayer",ka(e.topRatio*100,2))}),e.innerRatio!=null&&(n["attr-corner-radius-innerlayer"]==null||n["attr-corner-radius-innerlayer"].value!=He)&&(n["attr-corner-radius-innerlayer"]={title:"Corner Radius Ratio",value:this.getCompareValue("attr-corner-radius-innerlayer",ka(e.innerRatio*100,2))}),e.bottomRatio!=null&&(n["attr-corner-radius-bottomlayer"]==null||n["attr-corner-radius-bottomlayer"].value!=He)&&(n["attr-corner-radius-bottomlayer"]={title:"Corner Radius Ratio",value:this.getCompareValue("attr-corner-radius-bottomlayer",ka(e.bottomRatio*100,2))}),(n["attr-corner-radius-general"]==null||n["attr-corner-radius-general"].value!=He)&&(n["attr-corner-radius-general"]={title:"Corner Radius Ratio",value:this.getCompareValue("attr-corner-radius-general",ka(this.getGeneralRatio(e)*100,2))});let m=e.padRule;if(m?((n["attr-pad-thermal-type"]==null||n["attr-pad-thermal-type"].value!=He)&&(n["attr-pad-thermal-type"]={title:"Thermal Type",value:this.getCompareValue("attr-pad-thermal-type",2)}),(n["attr-pad-connection"]==null||n["attr-pad-connection"].value!=He)&&(n["attr-pad-connection"]={title:"Pad Connection",value:this.getCompareValue("attr-pad-connection",m.connectMode)}),(n["attr-spoke-angles"]==null||n["attr-spoke-angles"].value!=He)&&(n["attr-spoke-angles"]={title:"Spoke Angles",value:this.getCompareValue("attr-spoke-angles",xe(m.lineAngle/Math.PI*180,3))}),(n["attr-spoke-width"]==null||n["attr-spoke-width"].value!=He)&&(n["attr-spoke-width"]={title:"Spoke Width",value:this.getCompareValue("attr-spoke-width",Xe(m.lineWidth,void 0,r,this.unitConversion))}),(n["attr-spoke-spacing"]==null||n["attr-spoke-spacing"].value!=He)&&(n["attr-spoke-spacing"]={title:"Spoke Spacing",value:this.getCompareValue("attr-spoke-spacing",Xe(m.lineClearance,void 0,r,this.unitConversion))})):((n["attr-pad-thermal-type"]==null||n["attr-pad-thermal-type"].value!=He)&&(n["attr-pad-thermal-type"]={title:"Thermal Type",value:this.getCompareValue("attr-pad-thermal-type",1)}),(n["attr-pad-connection"]==null||n["attr-pad-connection"].value!=He)&&(n["attr-pad-connection"]={title:"Pad Connection",value:this.getCompareValue("attr-pad-connection",3)})),l!=null&&l instanceof Me){let P=as.getInstance().getPadLenByModel(e.model);(n["attr-pad-len"]==null||n["attr-pad-len"].value!=He)&&(n["attr-pad-len"]={title:"Pin length",value:this.getCompareValue("attr-pad-len",Xe(P,void 0,r,this.unitConversion))})}else if(x.getInstance().doctype==bi.FOOTPRINT){let P=e.padLen;(n["attr-pad-len"]==null||n["attr-pad-len"].value!=He)&&(n["attr-pad-len"]={title:"Pin length",value:this.getCompareValue("attr-pad-len",Xe(P,void 0,r,this.unitConversion))})}let g=e.attrsMap,y=new Array;for(let P in g){let T=g[P],I={key:P,value:T,update:!1};!I.update&&l!=null&&l instanceof Me&&((b=Ji.getItem(l.footprintUUID).getModelBy(e.model.modelType,e.globalIndex.replace(l.globalIndex,"")).attrsMap)==null?void 0:b[P])==T?I.update=!1:I.update=!0,y.push(I)}return this.unionAttribute=this.getUnionAttrs(this.unionAttribute,y,e.globalIndex),this.interAttribute=this.getIntersectionAttrs(this.interAttribute,y),(n["attr-array"]==null||n["attr-array"].value!=He)&&(n["attr-array"]={title:"Attribute",value:Array.from(this.interAttribute.values())}),this}clearCache(){var e,r;super.clearCache(),this._netLengthMap.clear(),this.existingInDevice=!1,(e=this.unionAttribute)==null||e.clear(),(r=this.interAttribute)==null||r.clear(),this.unionAttribute=null,this.interAttribute=null,this.attrIdMap={}}modifyBy(e,r){let i=new ft,n=x.getInstance().origin,s=e["attr-layerid"];s!=null&&(this.pad.layerId=parseInt(s));let a=Object.keys(e).sort((c,h)=>{let u=["attr-pad-general-shape","attr-pad-toplayer-shape","attr-pad-bottomlayer-shape","attr-pad-innerlayer-shape"];return u.includes(c)?-1:u.includes(h)?1:-1}),l=this.pad.getParent();for(let c of a)if(!(l instanceof Me&&["attr-layerid","attr-number","attr-net-length"].indexOf(c)>=0)){if(c=="attr-layerid"){if(this.pad.locked)continue;this.pad.layerId=parseInt(e[c])}else if(c=="attr-combination")this.modifyCombination(e[c],this.pad).forEach(u=>{r.addCommand(u)});else if(c=="attr-select-net"||c==="attr-select-net")this.pad.net=e[c],y_(this.pad,r),rt.setDefaultPad(this.pad);else if(c=="attr-number")this.pad.num=e[c];else if(c=="attr-pad-shape-showtype")this.pad.type=+e[c]===1?1:2;else if(c=="attr-corner-radius-general"){let h=ka(e[c]/100,2);Io(this.pad.layerId)?this.pad.topRatio=h:2==this.pad.layerId?this.pad.bottomRatio=h:gr(this.pad.layerId)&&(this.pad.topRatio=h,this.pad.innerRatio=h,this.pad.bottomRatio=h)}else if(c=="attr-pad-general-shape")Io(this.pad.layerId)?this.pad.topType=e[c]:2==this.pad.layerId?this.pad.bottomType=e[c]:gr(this.pad.layerId)&&(this.pad.topType=e[c],this.pad.innerType=e[c],this.pad.bottomType=e[c]);else if(c=="attr-pad-general-width"){let h=parseFloat(e[c])/10;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),Io(this.pad.layerId)?this.pad.topWidth=h:2==this.pad.layerId?this.pad.bottomWidth=h:gr(this.pad.layerId)&&(this.pad.topWidth=h,this.pad.innerWidth=h,this.pad.bottomWidth=h)}else if(c=="attr-pad-general-height"){let h=parseFloat(e[c])/10;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),Io(this.pad.layerId)?this.pad.topHeight=h:2==this.pad.layerId?this.pad.bottomHeight=h:gr(this.pad.layerId)&&(this.pad.topHeight=h,this.pad.innerHeight=h,this.pad.bottomHeight=h)}else if(c=="attr-pad-toplayer-shape")this.pad.topType=e[c];else if(c=="attr-corner-radius-toplayer"){let h=ka(e[c]/100,2);this.pad.topRatio=h}else if(c=="attr-pad-toplayer-width"){let h=parseFloat(e[c])/10;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.topWidth=h}else if(c=="attr-pad-toplayer-height"){let h=parseFloat(e[c])/10;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.topHeight=h}else if(c=="attr-pad-innerlayer-shape")this.pad.innerType=e[c];else if(c=="attr-corner-radius-innerlayer"){let h=ka(e[c]/100,2);this.pad.innerRatio=h}else if(c=="attr-pad-innerlayer-width"){let h=parseFloat(e[c])/10;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.innerWidth=h}else if(c=="attr-pad-innerlayer-height"){let h=parseFloat(e[c])/10;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.innerHeight=h}else if(c=="attr-pad-bottomlayer-shape")this.pad.bottomType=e[c];else if(c=="attr-corner-radius-bottomlayer"){let h=ka(e[c]/100,2);this.pad.bottomRatio=h}else if(c=="attr-pad-bottomlayer-width"){let h=parseFloat(e[c])/10;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.bottomWidth=h}else if(c=="attr-pad-bottomlayer-height"){let h=parseFloat(e[c])/10;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.bottomHeight=h}else if(c=="attr-x"||c=="attr-y"){if(this.pad.locked)continue;let h=parseFloat(e[c])/10;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h));let u;c=="attr-x"?u=new S(h+n.x,this.pad.center.y):u=new S(this.pad.center.x,h+n.y);let d=this.pad.getParent();if(tp.moveWhole&&d instanceof Me){r.addCommand(Te.dispatch(d,"modify"));let p=Ae.translate(u.x-this.pad.center.x,u.y-this.pad.center.y,0);this.pad.getParent().transform(p),A.publish("flushSelectingInfo","")}else this.pad.center=u}else if(c=="attr-rotation"){if(this.pad.locked)continue;let h=uc(parseFloat(e[c]))/180*Math.PI;this.pad.rotation=h}else if(c=="attr-locked"){let h=e[c]=="yes",u=this.pad.getParent();u!=null&&u instanceof Me?(r.addCommand(Te.dispatch(u,"modify")),u.locked=h,this.pad.locked=h):this.pad.locked=h}else if(c=="attr-pad-hole-shape"){if(this.pad.holeShape=e[c],e[c]==="SLOT"){let h=this.getGeneralWidth(this.pad),u=this.getGeneralHeight(this.pad);if(h>=u){let d=0*Math.PI;this.pad.holeRotation=d}else{let d=.5*Math.PI;this.pad.holeRotation=d}}}else if(c=="attr-pad-hole-diameter"){let h=parseFloat(e[c])/10;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.holeRadius=h/2}else if(c=="attr-pad-hole-length"){let h=parseFloat(e[c])/10;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.holeLength=h}else if(c=="attr-pad-hole-width"){let h=parseFloat(e[c])/20;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.holeRadius=h}else if(c=="attr-pad-hole-rotation"){let h=uc(parseFloat(e[c]))/180*Math.PI;this.pad.holeRotation=h}else if(c=="attr-pad-offset-x"){let h=parseFloat(e[c])/10;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.holeOffset=new S(h,this.pad.holeOffset.y)}else if(c=="attr-pad-offset-y"){let h=parseFloat(e[c])/10;x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.holeOffset=new S(this.pad.holeOffset.x,h)}else if(c=="attr-pad-plated"){let h=e[c]=="yes";this.pad.plated=h}else if(c=="attr-soldermask-showtype")this.pad.expansionType=parseInt(e[c]);else if(c=="attr-pastemask"){let h=parseFloat(e[c])/10;isNaN(h)||(x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.pasteExpansion=h)}else if(c=="attr-soldermask"){let h=parseFloat(e[c])/10;isNaN(h)||(x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.layerId==1?this.pad.topSolderExpansion=h:this.pad.layerId==2&&(this.pad.bottomSolderExpansion=h))}else if(c=="attr-soldermask-toplayer"){let h=parseFloat(e[c])/10;isNaN(h)||(x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.topSolderExpansion=h)}else if(c=="attr-soldermask-bottomlayer"){let h=parseFloat(e[c])/10;isNaN(h)||(x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.bottomSolderExpansion=h)}else if(c=="attr-pad-thermal-type"){let h=parseInt(e[c]);this.pad.padRuleType=h}else if(c=="attr-pad-connection")if(+e[c]===0){let h=te.getInstance().getRuleByNet(this.pad.net,10),u=this.pad.layerId!==12,d=this.pad.layerId;this.pad.padRule=Su.getPadRule(+e[c],u?h.getSingleLineClearance(d):h.getMultiLineClearance(),u?h.getSingleLineWidth(d):h.getMultiLineWidth(),u?h.getSingleLineAngle(d):h.getMultiLineAngle())}else this.pad.padRule=Su.getPadRuleByconnectMode(+e[c],this.pad.padRule);else if(c=="attr-spoke-width"){let h=parseFloat(e[c])/10;isNaN(h)||(x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.padRule=Su.getPadRuleBylineWidth(h,this.pad.padRule))}else if(c=="attr-spoke-angles")this.pad.padRule=Su.getPadRuleBylineAngle(parseFloat(e[c])*Math.PI/180,this.pad.padRule);else if(c=="attr-spoke-spacing"){let h=parseFloat(e[c])/10;isNaN(h)||(x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),this.pad.padRule=Su.getPadRuleBylineClearance(h,this.pad.padRule))}else if(c=="attr-pad-len"){let h=parseFloat(e[c])/10;isNaN(h)||(x.getInstance().unit!="mil"&&(h=i.conversion(x.getInstance().unit,"mil",h)),x.getInstance().doctype==bi.FOOTPRINT?this.pad.padLen=h:as.getInstance().setPadLenByModel(this.pad.model,h))}else if(c=="attr-array"){let h=e[c];for(let u of h)u.update==null||u.update?u.isAdd?this.updateAttr(u,this.pad):this.pad.attrsMap[u.key]!==void 0&&this.updateAttr(u,this.pad):this.restoreAttr(u,this.pad)}}this.pad!=null&&this.isShapeChange(e,!0)&&(this.pad.isTestPad?rt.setDefaultTestPad(this.pad):rt.setDefaultPad(this.pad))}updateAttr(e,r){e.value!==He&&r.modifyATTRMap(e.key,e.value||"")}restoreAttr(e,r){var n;let i=r.getParent();if(i&&i instanceof Me){let l=(n=Ji.getItem(i.footprintUUID).getModelBy(r.model.modelType,r.globalIndex.replace(i.globalIndex,"")).attrsMap)==null?void 0:n[e.key];l?r.modifyATTRMap(e.key,l.toString()):r.deleteATTRMap(e.key)}else r.deleteATTRMap(e.key)}isShapeChange(e,r){let i=["attr-layerid","attr-pad-shape-showtype","attr-corner-radius-general","attr-pad-general-shape","attr-pad-general-width","attr-pad-general-height","attr-pad-toplayer-shape","attr-corner-radius-toplayer","attr-pad-toplayer-width","attr-pad-toplayer-height","attr-pad-innerlayer-shape","attr-corner-radius-innerlayer","attr-pad-innerlayer-width","attr-pad-innerlayer-height","attr-pad-bottomlayer-shape","attr-corner-radius-bottomlayer","attr-pad-bottomlayer-width","attr-pad-bottomlayer-height","attr-rotation","attr-pad-hole-shape","attr-pad-hole-diameter","attr-pad-hole-length","attr-pad-hole-width","attr-pad-hole-rotation","attr-pad-offset-x","attr-pad-offset-y","attr-pad-plated","attr-soldermask-showtype","attr-pastemask","attr-soldermask","attr-soldermask-toplayer","attr-soldermask-bottomlayer","attr-pad-thermal-type","attr-pad-connection","attr-spoke-angles","attr-spoke-spacing","attr-spoke-width"];r||i.push("attr-x","attr-y");for(let n in e)if(i.indexOf(n)>=0)return!0;return!1}getPadShapeOption(){return[{value:"ELLIPSE",text:"Round"},{value:"RECT",text:"Rectangle"},{value:"OVAL",text:"Oval"}]}getHoleShapeOption(){return[{value:"SLOT",text:"Slot"},{value:"ROUND",text:"Round"}]}getGeneralShape(e){return e.layerId===2?e.bottomType:e.topType}getGeneralWidth(e){return e.layerId===2?e.bottomWidth:e.topWidth}getGeneralHeight(e){return e.layerId===2?e.bottomHeight:e.topHeight}getGeneralRatio(e){return e.layerId===2?e.bottomRatio:e.topRatio}getUnionAttrs(e,r,i){e==null&&(e=new Map);for(let n of r){let s=e.get(n.key);this.attrIdMap[n.key]==null&&(this.attrIdMap[n.key]=[]),this.attrIdMap[n.key].push(i),s!=null?(n.value!=s.value&&(s.value=He),this.hasTrue(n.update,s.update)&&(s.update=!0)):e.set(n.key,n)}return e}getIntersectionAttrs(e,r){if(e==null||!e.size){e=new Map;for(let i of r)e.set(i.key,i);return e}else{let i=new Set(e.keys());for(let n of r){let s=e.get(n.key);s!=null&&(n.value!=s.value&&(s.value=He),this.hasTrue(n.update,s.update)&&(s.update=!0)),i.delete(n.key)}for(let n of i)e.delete(n);return e}}hasTrue(e,r){return e||r}updateAttrlist4OnlyPads(){this.attrlist["attr-array"]={title:"Attribute",value:Array.from(this.unionAttribute.values())}}};var C_=class extends so{constructor(e,r){super();this.commands=new Array;this.commands=[],e.items.forEach(i=>{this.commands.push(Te.dispatch(i,r))}),e.combination instanceof Ph&&this.commands.push(Te.dispatch(e.combination,"add")),this.data=void 0,this.action=r}getItem(){return"ignore"}rebuild(){this.commands.forEach(e=>{e.rebuild()})}remove(){this.commands.forEach(e=>{e.remove()})}modify(){this.commands.forEach(e=>{e.modify()})}getStackTableIsCanEdit(){for(let e of this.commands){let r=Te.getManager(e),i=r&&r.getItem(e.gId);if(i&&!Bt.checkIsInCanEdit(i))return!1}return!0}upload(e){this.commands.forEach(r=>{r.upload(e)})}updateData(){this.commands.forEach(e=>{e.updateData()})}};var wWe=(o,t,e=0)=>o.reduce((r,i,n)=>n<=t?r+i:r,e),W_t=o=>o.flat(1/0),zV=class{constructor(t,e=13){this.awaitShake=null;this.locked=!1;this.layerId=13;this.rowBlank=10;this.columnBlank=50;this.rowHeight=0;this.distance2leftOff=10;this.columnNum=0;this.rowNum=0;this.font={origin:2,rotation:rt.defaultText.rotation,fontSize:rt.defaultTable.fontSize,imageSize:rt.defaultTable.fontSize/.7,fontFamily:rt.defaultTextFamily[0],strokeWidth:rt.defaultText.strokeWidth};this.everyModels=[];this.textItems=[];this.images=[];this.texts=[];this.stackConfig=t,this.rowBlank=this.font.imageSize/2,this.columnBlank=this.font.imageSize,this.distance2leftOff=this.font.imageSize,this.rowHeight=this.rowBlank*2+this.font.imageSize,this.columnNum=t.length,this.rowNum=t[0].length+1,this.layerId=e,this.textReceivedLen=0}get origin(){return this._origin}set origin(t){this._origin=new S(t.x,t.y)}createStackTable(t){let e=this,r=this.stackConfig[0],i=this.stackConfig.slice(1);this.origin=t;let n=[r].concat(i);n.forEach((s,a)=>{let l=[],c=[];if(s.forEach(h=>{if(typeof h=="string"){let u=e.createTextModel(h,t);c.push([u]),l.push(u)}else{let u=[],d;h.image&&(d=e.createImageModel(h.image,t,a),e.images.push(d),u.push(h.image));let p=e.createTextModel(h.alpha||"",t);l.push(p),u.push(p),c.push(u)}}),e.everyModels.push(c),e.textItems.push(l),a===n.length-1)return!1}),this.render()}getStackTableModel(t){return this.createStackTable(t),{polygonModels:this.pls,textModels:this.texts,imageModels:this.images}}awaitTextComplete(){return setTimeout(()=>{OT.asyncText>0?(this.awaitShake!=null&&clearTimeout(this.awaitShake),this.awaitShake=this.awaitTextComplete()):this.render()},50)}render(){let t=this;t.allTextNum=t.textItems.length;let e=[];t.everyModels.forEach(a=>{let l=t.getColumnWidth(a);e.push(l)});let r=t.collectColumnOff(e);t.columnOffArr=r;let i=t.createPolygonModel(),n=W_t(t.updateTextPosition(t.textItems)),s=[];if(n.forEach(a=>{a instanceof Li&&s.push(a)}),n=s,Number.isFinite(t.distance2leftOff)){let a=Ae.translate(t.distance2leftOff,0,0);n.forEach(l=>{l instanceof Li&&l.transform(a)})}t.pls=i,t.texts=n}updateTextPosition(t){let e=s=>this.columnBlank*s+wWe(this.columnOffArr,s-1),r=s=>this.rowHeight*s,i=this,n=this.origin.add1(0,-this.rowHeight/2);return t.forEach((s,a)=>{s.forEach((l,c)=>{if(!l)return;let h=0;a>0&&(h=r(a));let u=e(c),d=n.add1(u,-h);l.position=d,i.textReceivedLen++})}),t}getColumnWidth(t){let e=[];return t.forEach(r=>{let i=0;r.forEach(n=>{let s=0;if(n instanceof ql)s=n.width;else if(n instanceof Li){let a=n.buildBBox();if(a==null)throw new Error("text was removed!!!");s=Math.round(a.width()*100)/100}s===0?s+=this.columnBlank*4:s+=this.columnBlank*2,i<s&&(i=s)}),e.push(i)}),e}createImageModel(t,e,r){let i=Ae.translate(e.x+this.distance2leftOff,e.y-r*this.rowHeight-this.rowBlank,0);return t.transform(i),t}createPolygonModel(){let t=this.columnNum,e=this.rowNum,r=this.getTableWidth(),i=this.getTableHeight(),n=this._origin.x+r,s=[];for(;t>=0;){let u=this._origin.y-this.rowHeight*t,d=new S(this._origin.x,u),p=new S(n,u),m=new ih(cr(),d,p,{layerId:this.layerId,strokeWidth:rt.defaultTable.lineWidth,locked:!1}),g=new Jp(cr(),"Line",this.layerId,[[m]],rt.defaultTable.lineWidth,"",!1,null,null,null);s.push(g),t--}let a=this._origin.x,l=0,c=this.columnOffArr.slice();c.unshift(0);let h=this._origin.y;for(;l<e;){let u=c[l]+(l?this.columnBlank:0);a+=u;let d=new S(a,h),p=new S(a,h-i+rt.defaultTable.lineWidth),m=new ih(cr(),d,p,{layerId:this.layerId,strokeWidth:rt.defaultTable.lineWidth,locked:!1}),g=new Jp(cr(),"Line",this.layerId,[[m]],rt.defaultTable.lineWidth,"",!1,null,null,null);s.push(g),l++}return s}createTextModel(t,e){if(t=="")return null;let{fontSize:r,fontFamily:i,strokeWidth:n,origin:s}=this.font,a=nq(t),l=0,c=0,h=new _e;if(a.forEach(d=>{h.ext1(d.bbox())}),h.valid()){let d=h.build1();l=d.width(),c=d.height()}return new Ed(cr(),this.layerId,0,"",!1,t,!0,i,r,0,e,s,n,!1,0,!1,!1,nq(t),l,c,!1,ee.of7(KH),null)}getTableWidth(){return this.columnBlank*this.columnOffArr.length+wWe(this.columnOffArr,this.columnOffArr.length)}getTableHeight(){let t=this.stackConfig.length;return this.rowHeight*t}collectColumnOff(t){var e={};for(let n=0,s=t.length;n<s;n++)for(let a=0,l=t[0].length;a<l;a++)e[a]?e[a].push(t[n][a]):e[a]=[t[n][a]];let r=Object.values(e),i=new Array(r.length);for(let n=0,s=r.length;n<s;n++)i[n]=Math.max(...r[n]);return i}};var oq,LWe=new Gi(1);function MWe(){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(oq=new Set,zD(Ve.getSelects()).length<=0){A.publish("ui/toastMsg",{type:"warn",msg:"None of the selected objects meets the conditions for joining the group"},$());return}A.publish("openMainDialog",{cmd:30,data:{option:{defaultName:kt.getDefaultName()}}})}function NWe(){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let o=[],t=[];Ve.getSelects().forEach(r=>{let i=r;(r instanceof mt||r instanceof vt)&&(i=r.getParent()),i.getGroupID()?o.push(i):t.push(i)});let e=z_t(o);if(e.length>0){let r=e.map(c=>kt.getItem(c)),i=e.map(c=>kt.getGroupNameByGroupId(c)),n=new ve("dissolution"),s=new qR(r,"delete");n.addCommand(s);let a=[];for(let c of r)a.push(...c.getItems()),c.dissolution(),A.publish("delete",c);je.executeCommand(n),a.push(...t),A.publish("select",a),A.publish("flushSelectingInfo","");let l=i.join("\u3001");A.publish("showPcbSlideMsg",["Successfully cancel {num} group:{value}",{num:i.length,value:l}],$())}else LWe.warning1("include non-combination device,does not support dissolution!")}function kWe(){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(oq=new Set,zD(Ve.getSelects()).length<=0){A.publish("ui/toastMsg",{type:"warn",msg:"None of the selected objects meets the conditions for joining the group"},$());return}let e=kt.getAllItem().map(r=>({name:r.name,globalIndex:r.globalIndex}));A.publish("openMainDialog",{cmd:31,data:{option:e}})}function BWe(){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let o={};Ve.getSelects().forEach(e=>{let r=e;(e instanceof mt||e instanceof vt)&&(r=e.getParent());let i=r.getGroupID();if(!i)return;gx(o,i,()=>[]).push(r)});let t=Object.keys(o);if(t.length>0){let e=new ve("move out group"),r=t.map(s=>kt.getItem(s)),i=new qR(r,"modify");e.addCommand(i),Fn(o,(s,a)=>{kt.removeFromCombination(a,s)});let n=[];if(Fn(t,(s,a)=>{let l=kt.getItem(a),c=l?l.getItems():null;c!=null&&!c.length&&(n.push(l),kt.delete(l))}),n.length){let s=new qR(n,"delete");e.addCommand(s)}je.executeCommand(e),A.publish("flushSelectingInfo","")}else LWe.warning1("include non-combination device,does not support move out group!")}function zD(o){let t=[],e=[],r=[],i=x.getInstance().tabId;if(!o.length)return o;return o.forEach(s=>{let a=s.getGroupID(),l=s.getParent();if(a){let h=kt.getItem(a);t.push({item:{attr:{id:s.globalIndex,pcbid:i},text:`${ur}${s.number}`},parent:{attr:{id:a,pcbid:i},text:`${h.name} (${a})`}})}l instanceof Me&&e.push({item:{attr:{id:s.globalIndex,pcbid:i},text:`${ur}${s.number}`},parent:{attr:{id:l.globalIndex,pcbid:i},text:`${l.name} (${l.globalIndex})`}});let c=s.model.modelType;a==null&&!(l instanceof Me||c=="Ratline")&&r.push(s)}),t.forEach(s=>n("group",s)),e.forEach(s=>n("component",s)),r;function n(s,a){oq.size&&oq.has(a.item.attr.id)||(A.publish("logPublishProxy",{type:"warn",msg:['<span class="i18n">Object</span> ',a.item,` <span class="i18n">already exists in ${s}</span> `,a.parent,' <span class="i18n">cannot be grouped</span>']},$()),oq.add(a.item.attr.id))}}function z_t(o){if(o.every(r=>!r.getGroupID()))return[];let e=new Set;return o.forEach(r=>{let i;r instanceof mt||r instanceof vt?i=r.getParent().getGroupID():i=r.getGroupID(),i&&e.add(i)}),Array.from(e)}var B5=class extends zV{constructor(e,r=13,i="\u5C42\u5806\u53E0"){super(e,r);this.pcbPolygons=[];this.pcbImages=[];this.pcbTexts=[];this.ready=!1;this.removed=!1;this.groupPrefix=i}addStackTable(e){this.createStackTable(e);for(let r of this.texts){mo.getInstance().addModel(r);let i=ti.addtextByModel(r);this.pcbTexts.push(i)}for(let r of this.images){Qs.getInstance().addModel(r);let i=Ln.addImageByModel(r);this.pcbImages.push(i)}for(let r of this.pls){let i=r.childrens.map(s=>s.map(a=>$u.addByModel(a)));Mi.getInstance().addModel(r);let n=pt.addPolygonByModel(r,i);this.pcbPolygons.push(n)}this.items=[].concat(this.pcbPolygons,this.pcbTexts,this.pcbImages),this.ready=!0}isUpdate(){return this.font.fontSize!==rt.defaultTable.fontSize||this.font.strokeWidth!==rt.defaultText.strokeWidth}getNextTableName(){let e=`${this.groupPrefix}_1`,r=new RegExp(`^${this.groupPrefix}\\_(\\d+)$`),i=[],n=Math.max;return kt.getAllItem().map(a=>a.name).forEach(a=>{let l=a.match(r);l&&l[1]&&i.push(l[1])}),i.length?this.groupPrefix+`_${n(...i)+1}`:e}joinCombination(){if(!this.ready)return;let e=this.items,r=zD(e);if(r.length){let i=this.getNextTableName(),n=kt.combination(r,i);return this.combination=n,n}else A.publish("ui/toastMsg",{type:"warn",msg:"None of the selected objects meets the conditions for joining the group"},$())}remove(){var e;(e=this.items)==null||e.forEach(r=>{r.remove()}),this.removed=!0}transform(e){this.items&&(this.items.forEach(r=>{r&&r.transform(e)}),this.origin=this.origin.multiply4(e))}};var Y_t=.4,YV=new ft().conversion("mm","px(100)",Y_t),_Ee=6.5;function VWe(o="pdf"){let t=[];return t.push(...j_t()),t.push(...X_t()),t.push(...Oae()),r(t),e(t),i(t);function e(a){for(let l=0;l<a.length;l++)a[l].unshift(s(l))}function r(a){a.sort((l,c)=>l[l.length-1]-c[c.length-1]),a.sort((l,c)=>l[l.length-4]-c[c.length-4]),a.sort((l,c)=>l[l.length-5]-c[c.length-5]),a.sort((l,c)=>l[l.length-6]-c[c.length-6]),a.sort((l,c)=>l[l.length-7]-c[c.length-7])}function i(a){switch(o){case"gerber":case"pdf":{let l=[];for(let c=0;c<a.length;c++)for(let h=0;h<a[c][1].length;h++){let u=a[c][1][h],d=u.center;if(u instanceof Je){let p=u.holeOffset.multiply3(Qe.rotate(u.rotation));d=u.center.add(p)}l.push({position:d,image:a[c][0].image,text:a[c][0].alpha})}return l}}}function n(a){let l=Object.values(k5.svgPath[a])[0],c=F3(l),h=new _e;if(c.forEach(u=>{h.ext1(u.bbox())}),o==="pdf"||o==="gerber")return c}function s(a){if(a=a%269,a<9)return{image:n(a)};if(a<35){let l=String.fromCharCode(65+a-9);return{alpha:o==="pdf"?FWe(l):l}}else{let l=String.fromCharCode(65+(a-35)%26);return{image:n(Math.floor((a-35)/26)),alpha:o==="pdf"?FWe(l):l}}}}function j_t(){let o=Tn.getInstance().getAllItem(),t=new ft,e={};for(let i=0;i<o.length;i++){let n=o[i].holeRadius,s=`${(n*2*10).toFixed(1)}mil(${t.mil2mm(n*2*10).toFixed(3)}mm)`,a="PTH",l="Round",c=o[i].startLayer,h=o[i].endLayer,u=c+"-"+h,d="Via",p="";e[s+a+l+u]?(e[s+a+l+u].count++,e[s+a+l+u].objs.push(o[i])):e[s+a+l+u]={count:1,holeRadius:n,size:s,viaOrPad:d,plated:a,shape:l,padShape:p,startLayer:c,endLayer:h,layerPair:u,objs:[o[i]]}}let r=[];return Fn(e,(i,n,s)=>{r.push([n.objs,n.count+"",n.size,n.plated,n.shape,n.viaOrPad,n.padShape,n.layerPair])}),r}function X_t(){let o=$n.getInstance().getAllItem(),t=new ft,e={};for(let i=0;i<o.length;i++)if(gr(o[i].layerId)){let n=o[i].holeRadius,s=o[i].holeLength,a=`${(n*2*10).toFixed(1)}x${(s*10).toFixed(1)}mil(${t.mil2mm(n*2*10).toFixed(3)}x${t.mil2mm(s*10).toFixed(3)}mm)`,l=o[i].plated?"PTH":"NPTH",c=q_t(o[i].holeShape),h=null,u="Top Layer-Bottom Layer",d="Pad";e[a+l+c+u]?(e[a+l+c+u].count++,e[a+l+c+u].objs.push(o[i])):e[a+l+c+u]={count:1,holeRadius:n,holeLength:s,size:a,viaOrPad:d,plated:l,shape:c,padShape:h,layerPair:u,objs:[o[i]]}}let r=[];return Fn(e,(i,n,s)=>{r.push([n.objs,n.count+"",n.size,n.plated,n.shape,n.viaOrPad,n.padShape,n.layerPair])}),r}function Oae(o=!1){let t=new ft,e=_Ee/10,r=zi.getInstance().getAllItem().filter(s=>{let a=s.radius*2;return s.type=="Slot Region"&&t.conversion1("mil","mm",a)<=e}),i={};for(let s=0;s<r.length;s++){let a=r[s].radius,l=`${(a*2*10).toFixed(1)}mil(${t.mil2mm(a*2*10).toFixed(3)}mm)`,c="NPTH",h="Round",u="Top Layer-Bottom Layer",d="Via",p="";i[l+c+h+u]?(i[l+c+h+u].count++,i[l+c+h+u].objs.push(r[s])):i[l+c+h+u]={count:1,radius:a,size:l,viaOrPad:d,plated:c,shape:h,padShape:p,layerPair:u,objs:[r[s]]}}let n=[];return Fn(i,(s,a,l)=>{let c=[a.objs,a.count+"",a.size,a.plated,a.shape,a.viaOrPad,a.padShape,a.layerPair];o&&c.unshift("mark"),n.push(c)}),n}function q_t(o){let[t,...e]=o;return t.toUpperCase()+e.join("").toLocaleLowerCase()}function FWe(o=""){return Gd(o,8,.1).path}var Aae=class extends ci{constructor(){super();this.commands=new ve("draw drill table");this.stackTable=null;this.groupName="Drill Table";this.nameReceived=!1;this.option="OPTIONLEFTUP",A.windowBridge.rpcCall("i18n",[this.groupName],$()).then(r=>{this.groupName=r.message,this.nameReceived=!0})}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break}}onMouseLeftUp(e){this.stackTable!==null&&this.placeStackTable(e)}onMouseMove(e){let r=new S(e.sceneX,e.sceneY);if(this.drawing)if(this.stackTable!==null&&!this.stackTable.isUpdate()){let i=r.sub(this.stackTable.origin),n=Ae.translate(i.x,i.y,0);this.stackTable.transform(n)}else this.stackTable!==null&&(this.stackTable.remove(),A.publish("delete",this.stackTable),this.stackTable=null),this.newTable(r)}placeStackTable(e){let r=new S(e.sceneX,e.sceneY),i=!0;for(let s of this.stackTable.items)if(i&&!Bt.checkIsInCanEdit(s)){let a="beyond drawing range";Bt.showMassageTip(a,a),i=!1}if(!i){for(let s of this.stackTable.items)s.partition="";return}if(!this.stackTable.joinCombination())return;let n=this.stackTable.items;A.publish("onlySelect",n);for(let s of n)A.publish("hasModifyPcbItem",s);this.commands.addCommand(new C_(this.stackTable,"add")),je.executeCommand(this.commands),A.publish("flushService",""),this.commands=new ve("draw stacktable"),this.drawing=!0,this.stackTable=null,this.newTable(r)}newTable(e){if(!this.nameReceived)return;this.start();let r=sq(),i=new B5(r,56,this.groupName);i.addStackTable(e),this.stackTable=i}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Eae(e.adsorb).result};Qt.getInstance().menuData(r,this),this.drawing=!1}cancel(){this.interrupt(),A.publish("tool","dropdrag")}interrupt(){this.stackTable!==null&&(this.stackTable.remove(),this.drawing=!1,this.stackTable=null,A.publish("updateRtree","")),this.end()}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"TABLE_SETTING":A.windowBridge.publish("openTableSetting",{cmd:"place_part(drill_table)"},$());break}}};function sq(o="table"){let t=[];return t.push(...$_t()),t.push(...K_t()),t.push(...Oae()),r(t),e(t),i(t);function e(a){for(let l=0;l<a.length;l++)a[l].unshift(s(l))}function r(a){a.sort((l,c)=>l[l.length-1]-c[c.length-1]),a.sort((l,c)=>l[l.length-4]-c[c.length-4]),a.sort((l,c)=>l[l.length-5]-c[c.length-5]),a.sort((l,c)=>l[l.length-6]-c[c.length-6]),a.sort((l,c)=>l[l.length-7]-c[c.length-7])}function i(a){switch(o){case"table":{for(let l=0;l<a.length;l++)a[l].splice(1,1);return a.unshift(["Mark","Count","Size","Plated","Shape","Via/Pad","Pad Shape","Layer Pair"]),a}case"gerber":case"pdf":{let l=[];for(let c=0;c<a.length;c++)for(let h=0;h<a[c][1].length;h++){let u=a[c][1][h],d=u.center;if(u instanceof Le){let p=u.holeOffset.multiply3(Qe.rotate(u.rotation));d=u.center.add(p)}l.push({position:d,image:a[c][0].image,imageIndex:a[c][0].imageIndex,textIndex:a[c][0].textIndex,text:a[c][0].alpha})}return l}}}function n(a){let l=Object.values(k5.svgPath[a])[0],c=F3(l),h=new _e;if(c.forEach(m=>{h.ext1(m.bbox())}),o==="pdf"||o==="gerber")return c;let u=h.build1(),d=rt.defaultTable.fontSize/8;return new cR(cr(),56,new S(0,0),u.width()*d,u.height()*d,rt.defaultImage.rotation,!1,!1,c)}function s(a){if(a=a%269,a<9)return{image:n(a),imageIndex:a};if(a<35){let l=String.fromCharCode(65+a-9);return{alpha:o==="pdf"?nq(l):l,textIndex:a}}else{let l=(a-35)%26+9,c=String.fromCharCode(65+(a-35)%26),h=Math.floor((a-35)/26);return{image:n(h),imageIndex:h,alpha:o==="pdf"?nq(c):c,textIndex:l}}}}function $_t(){let o=Hr.getAllItem(),t=new ft,e={};for(let i=0;i<o.length;i++){let n=o[i].holeRadius,s=`${(n*2*10).toFixed(1)}mil(${t.mil2mm(n*2*10).toFixed(3)}mm)`,a="PTH",l="Round",c=be.getLayerName(o[i].startLayer),h=be.getLayerName(o[i].endLayer),u=c+"-"+h,d="Via",p="";e[s+a+l+u]?(e[s+a+l+u].count++,e[s+a+l+u].objs.push(o[i])):e[s+a+l+u]={count:1,holeRadius:n,size:s,viaOrPad:d,plated:a,shape:l,padShape:p,startLayer:c,endLayer:h,layerPair:u,objs:[o[i]]}}let r=[];return Fn(e,(i,n,s)=>{r.push([n.objs,n.count+"",n.size,n.plated,n.shape,n.viaOrPad,n.padShape,n.layerPair])}),r}function K_t(){let o=Kt.getAllItem(),t=new ft,e={},i=new IP().getPadShapeOption(),n={};i.forEach(a=>{n[a.value]=a.text});for(let a=0;a<o.length;a++){let l=o[a];if(gr(l.layerId)){let c=l.holeRadius,h=l.holeLength,u=`${(c*2*10).toFixed(1)}x${(h*10).toFixed(1)}mil(${t.mil2mm(c*2*10).toFixed(3)}x${t.mil2mm(h*10).toFixed(3)}mm)`,d=l.plated?"PTH":"NPTH",p=UWe(l.holeShape),m=l instanceof Ri&&l.topType==l.bottomType?n[l.topType]:"Polygon",g="Top Layer-Bottom Layer",y="Pad";e[u+d+p+g]?(e[u+d+p+g].count++,e[u+d+p+g].objs.push(o[a]),e[u+d+p+g].padShape!==m&&(e[u+d+p+g].padShape="(Mixed)")):e[u+d+p+g]={count:1,holeRadius:c,holeLength:h,size:u,viaOrPad:y,plated:d,shape:p,padShape:m,layerPair:g,objs:[o[a]]}}}let s=[];return Fn(e,(a,l,c)=>{s.push([l.objs,l.count+"",l.size,l.plated,l.shape,l.viaOrPad,l.padShape,l.layerPair])}),s}function GWe(){let o=Z_t().concat(J_t()).concat(Oae(!0));return r(o),e(o),n(o);function e(s){for(let a=0;a<s.length;a++)s[a][0]=a}function r(s){s.sort((a,l)=>a[a.length-1]-l[l.length-1]),s.sort((a,l)=>a[a.length-4]-l[l.length-4]),s.sort((a,l)=>a[a.length-5]-l[l.length-5]),s.sort((a,l)=>a[a.length-6]-l[l.length-6]),s.sort((a,l)=>a[a.length-7]-l[l.length-7])}function i(s,a){return s.x-a.x||s.y-a.y}function n(s){let a=[];for(let l of s){let[c,h]=l,u=h.map(d=>{let p=d.center;if(d instanceof Le){let m=d.holeOffset.multiply3(Qe.rotate(d.rotation));p=d.center.add(m)}return p});u.sort(i),a.push({positions:u,markIndex:c})}return a}}function Z_t(){let o=Hr.getAllItem(),t=new ft,e={};for(let i=0;i<o.length;i++){let n=o[i].holeRadius,s=`${(n*2*10).toFixed(1)}mil(${t.mil2mm(n*2*10).toFixed(3)}mm)`,a="PTH",l="Round",c=be.getLayerName(o[i].startLayer),h=be.getLayerName(o[i].endLayer),u=c+"-"+h,d="Via",p="";e[s+a+l+u]?(e[s+a+l+u].count++,e[s+a+l+u].objs.push(o[i])):e[s+a+l+u]={count:1,holeRadius:n,size:s,viaOrPad:d,plated:a,shape:l,padShape:p,startLayer:c,endLayer:h,layerPair:u,objs:[o[i]]}}let r=[];return Fn(e,(i,n,s)=>{r.push(["mark",n.objs,n.count+"",n.size,n.plated,n.shape,n.viaOrPad,n.padShape,n.layerPair])}),r}function J_t(){let o=Kt.getAllItem(),t=new ft,e={},i=new IP().getPadShapeOption(),n={};i.forEach(a=>{n[a.value]=a.text});let s=[];for(let a of o){let{layerId:l,holeRadius:c,holeLength:h,plated:u,holeShape:d}=a,p,m;if(a instanceof Ri?(p=a.topType,m=a.bottomType):(p="Polygon",m="Polygon"),!gr(l)||!c&&!h)continue;let g=`${(c*2*10).toFixed(1)}x${(h*10).toFixed(1)}mil(${t.mil2mm(c*2*10).toFixed(3)}x${t.mil2mm(h*10).toFixed(3)}mm)`,y=u?"PTH":"NPTH",b=UWe(d),P=p==m?n[p]:"Polygon",T="Top Layer-Bottom Layer",I="Pad",C=g+y+b+T;e[C]?(e[C][2]++,e[C][1].push(a),e[C][7]!==P&&(e[C][7]="(Mixed)")):(e[C]=["mark",[a],1,g,y,b,I,P,T],s.push(e[C]))}return s}function UWe(o){let[t,...e]=o;return t.toUpperCase()+e.join("").toLocaleLowerCase()}function nq(o=""){return Gd(o,rt.defaultTable.fontSize,.1).path}var HWe=`XSIZE  0.302000
YSIZE  0.302000
OFFSET 0.000000


CHAR !
LINE 0.000000 0.000000 0.000000 0.200000 P R 0.012000
LINE 0.000000 -0.100000 0.000000 -0.100000 P R 0.012000
ECHAR

CHAR "
LINE -0.050000 0.100000 -0.050000 0.200000 P R 0.012000
LINE 0.050000 0.100000 0.050000 0.200000 P R 0.012000
ECHAR

CHAR #
LINE -0.050000 -0.100000 -0.050000 0.200000 P R 0.012000
LINE 0.050000 -0.100000 0.050000 0.200000 P R 0.012000
LINE -0.100000 0.000000 0.100000 0.000000 P R 0.012000
LINE -0.100000 0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR $
LINE 0.000000 -0.100000 0.000000 0.200000 P R 0.012000
LINE -0.100000 -0.050000 0.050000 -0.050000 P R 0.012000
LINE 0.050000 -0.050000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 -0.050000 0.050000 P R 0.012000
LINE -0.050000 0.050000 -0.100000 0.100000 P R 0.012000
LINE -0.100000 0.100000 -0.050000 0.150000 P R 0.012000
LINE -0.050000 0.150000 0.100000 0.150000 P R 0.012000
ECHAR

CHAR %
LINE -0.100000 -0.100000 0.100000 0.200000 P R 0.012000
LINE -0.075000 0.175000 -0.075000 0.175000 P R 0.012000
LINE 0.075000 -0.075000 0.075000 -0.075000 P R 0.012000
ECHAR

CHAR &
LINE 0.100000 -0.100000 -0.100000 0.100000 P R 0.012000
LINE -0.100000 0.100000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.000000 0.150000 P R 0.012000
LINE 0.000000 0.150000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 -0.100000 0.000000 P R 0.012000
LINE -0.100000 0.000000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.100000 0.000000 P R 0.012000
ECHAR

CHAR '
LINE 0.000000 0.050000 0.050000 0.150000 P R 0.012000
LINE 0.025000 0.175000 0.025000 0.175000 P R 0.012000
ECHAR

CHAR (
LINE 0.050000 -0.100000 -0.050000 0.000000 P R 0.012000
LINE -0.050000 0.000000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.050000 0.200000 P R 0.012000
ECHAR

CHAR )
LINE -0.050000 -0.100000 0.050000 0.000000 P R 0.012000
LINE 0.050000 0.000000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 -0.050000 0.200000 P R 0.012000
ECHAR

CHAR *
LINE -0.100000 -0.050000 0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 0.100000 -0.050000 P R 0.012000
LINE 0.000000 -0.100000 0.000000 0.200000 P R 0.012000
ECHAR

CHAR +
LINE -0.100000 0.050000 0.100000 0.050000 P R 0.012000
LINE 0.000000 -0.050000 0.000000 0.150000 P R 0.012000
ECHAR

CHAR ,
LINE 0.000000 -0.100000 0.050000 0.000000 P R 0.012000
LINE 0.025000 0.025000 0.025000 0.025000 P R 0.012000
ECHAR

CHAR -
LINE -0.100000 0.050000 0.100000 0.050000 P R 0.012000
ECHAR

CHAR .
LINE 0.025000 -0.075000 0.025000 -0.075000 P R 0.012000
ECHAR

CHAR /
LINE -0.100000 -0.050000 0.100000 0.150000 P R 0.012000
ECHAR

CHAR 0
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 0.100000 0.150000 P R 0.012000
ECHAR

CHAR 1
LINE -0.050000 0.150000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 0.000000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
ECHAR

CHAR 2
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.100000 P R 0.012000
LINE 0.100000 0.100000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 0.000000 0.050000 P R 0.012000
LINE 0.000000 0.050000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR 3
LINE -0.100000 0.200000 0.100000 0.200000 P R 0.012000
LINE 0.100000 0.200000 0.100000 0.100000 P R 0.012000
LINE 0.100000 0.100000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 0.000000 0.050000 P R 0.012000
LINE 0.050000 0.050000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR 4
LINE 0.050000 -0.100000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 -0.100000 0.000000 P R 0.012000
LINE -0.100000 0.000000 0.100000 0.000000 P R 0.012000
ECHAR

CHAR 5
LINE 0.100000 0.200000 -0.100000 0.200000 P R 0.012000
LINE -0.100000 0.200000 -0.100000 0.100000 P R 0.012000
LINE -0.100000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR 6
LINE 0.100000 0.200000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 -0.100000 0.100000 P R 0.012000
LINE -0.100000 0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 -0.100000 0.050000 P R 0.012000
ECHAR

CHAR 7
LINE -0.100000 0.200000 0.100000 0.200000 P R 0.012000
LINE 0.100000 0.200000 -0.050000 -0.100000 P R 0.012000
ECHAR

CHAR 8
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE -0.050000 0.050000 0.050000 0.050000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE -0.100000 0.150000 -0.100000 0.100000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.100000 P R 0.012000
LINE -0.100000 0.000000 -0.100000 -0.050000 P R 0.012000
LINE 0.100000 0.000000 0.100000 -0.050000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE -0.050000 0.200000 -0.100000 0.150000 P R 0.012000
LINE 0.050000 0.050000 0.100000 0.100000 P R 0.012000
LINE -0.050000 0.050000 -0.100000 0.100000 P R 0.012000
LINE 0.050000 0.050000 0.100000 0.000000 P R 0.012000
LINE -0.050000 0.050000 -0.100000 0.000000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR 9
LINE -0.100000 -0.100000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.100000 0.100000 P R 0.012000
LINE -0.100000 0.100000 -0.050000 0.050000 P R 0.012000
LINE -0.050000 0.050000 0.100000 0.050000 P R 0.012000
ECHAR

CHAR :
LINE 0.000000 0.012000 0.000000 0.012000 P R 0.012000
LINE 0.000000 -0.025000 0.000000 -0.025000 P R 0.012000
ECHAR

CHAR ;
LINE 0.000000 0.025000 -0.050000 -0.100000 P R 0.012000
LINE 0.000000 0.025000 0.000000 0.025000 P R 0.012000
LINE 0.000000 0.175000 0.000000 0.175000 P R 0.012000
ECHAR

CHAR <
LINE 0.100000 0.200000 -0.050000 0.050000 P R 0.012000
LINE -0.050000 0.050000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR =
LINE -0.100000 0.100000 0.100000 0.100000 P R 0.012000
LINE -0.100000 0.000000 0.100000 0.000000 P R 0.012000
ECHAR

CHAR >
LINE -0.100000 0.200000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 -0.100000 -0.100000 P R 0.012000
ECHAR

CHAR ?
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.000000 0.050000 P R 0.012000
LINE 0.000000 0.050000 0.000000 0.000000 P R 0.012000
LINE 0.000000 -0.100000 0.000000 -0.100000 P R 0.012000
ECHAR

CHAR @
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.000000 0.000000 P R 0.012000
LINE 0.000000 0.000000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR A
LINE -0.100000 -0.100000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.050000 0.100000 0.050000 P R 0.012000
ECHAR

CHAR B
LINE -0.100000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.100000 P R 0.012000
LINE 0.100000 0.100000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.100000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.050000 0.050000 0.050000 P R 0.012000
ECHAR

CHAR C
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
ECHAR

CHAR D
LINE -0.100000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.100000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.050000 0.200000 P R 0.012000
ECHAR

CHAR E
LINE -0.100000 0.200000 0.100000 0.200000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.050000 0.050000 0.050000 P R 0.012000
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
ECHAR

CHAR F
LINE -0.100000 0.200000 0.100000 0.200000 P R 0.012000
LINE -0.100000 0.050000 0.050000 0.050000 P R 0.012000
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
ECHAR

CHAR G
LINE -0.050000 0.200000 0.100000 0.200000 P R 0.012000
LINE -0.050000 0.200000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.050000 0.050000 P R 0.012000
ECHAR

CHAR H
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE 0.100000 0.200000 0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.050000 0.100000 0.050000 P R 0.012000
ECHAR

CHAR I
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.000000 0.200000 0.000000 -0.100000 P R 0.012000
ECHAR

CHAR J
LINE 0.100000 0.200000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR K
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE 0.100000 0.200000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR L
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR M
LINE -0.100000 -0.100000 -0.100000 0.200000 P R 0.012000
LINE -0.100000 0.200000 0.000000 0.050000 P R 0.012000
LINE 0.000000 0.050000 0.100000 0.200000 P R 0.012000
LINE 0.100000 0.200000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR N
LINE -0.100000 -0.100000 -0.100000 0.200000 P R 0.012000
LINE -0.100000 0.200000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 0.100000 0.200000 P R 0.012000
ECHAR

CHAR O
LINE -0.100000 -0.050000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR P
LINE -0.100000 -0.100000 -0.100000 0.200000 P R 0.012000
LINE -0.100000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.100000 P R 0.012000
LINE 0.100000 0.100000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 -0.100000 0.050000 P R 0.012000
ECHAR

CHAR Q
LINE -0.100000 -0.050000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
LINE 0.000000 0.000000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR R
LINE -0.100000 -0.100000 -0.100000 0.200000 P R 0.012000
LINE -0.100000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.100000 P R 0.012000
LINE 0.100000 0.100000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 -0.100000 0.050000 P R 0.012000
LINE -0.050000 0.050000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR S
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 -0.050000 0.050000 P R 0.012000
LINE -0.050000 0.050000 -0.100000 0.100000 P R 0.012000
LINE -0.100000 0.100000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
ECHAR

CHAR T
LINE -0.100000 0.200000 0.100000 0.200000 P R 0.012000
LINE 0.000000 0.200000 0.000000 -0.100000 P R 0.012000
ECHAR

CHAR U
LINE -0.100000 0.200000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.100000 0.200000 P R 0.012000
ECHAR

CHAR V
LINE -0.100000 0.200000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.100000 0.200000 P R 0.012000
ECHAR

CHAR W
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.000000 0.050000 P R 0.012000
LINE 0.000000 0.050000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 0.100000 0.200000 P R 0.012000
ECHAR

CHAR X
LINE -0.100000 0.200000 0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 0.200000 P R 0.012000
ECHAR

CHAR Y
LINE -0.100000 0.200000 0.000000 0.050000 P R 0.012000
LINE 0.000000 0.050000 0.100000 0.200000 P R 0.012000
LINE 0.000000 0.050000 0.000000 -0.100000 P R 0.012000
ECHAR

CHAR Z
LINE -0.100000 0.200000 0.100000 0.200000 P R 0.012000
LINE 0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR [
LINE 0.050000 0.200000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
ECHAR

CHAR \\
LINE -0.100000 0.200000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR ]
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
ECHAR

CHAR ^
LINE -0.100000 0.100000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR _
LINE -0.100000 -0.100000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR \`
LINE -0.050000 0.200000 0.000000 0.050000 P R 0.012000
ECHAR

CHAR a
LINE -0.050000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 0.000000 P R 0.012000
LINE -0.050000 0.000000 0.100000 0.000000 P R 0.012000
ECHAR

CHAR b
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 -0.100000 0.050000 P R 0.012000
ECHAR

CHAR c
LINE 0.100000 0.100000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR d
LINE 0.100000 0.200000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 0.100000 0.050000 P R 0.012000
ECHAR

CHAR e
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.050000 0.000000 P R 0.012000
LINE 0.050000 0.000000 -0.100000 0.000000 P R 0.012000
ECHAR

CHAR f
LINE -0.050000 -0.100000 -0.050000 0.150000 P R 0.012000
LINE -0.050000 0.150000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE -0.100000 0.050000 0.000000 0.050000 P R 0.012000
ECHAR

CHAR g
LINE -0.050000 -0.150000 0.050000 -0.150000 P R 0.012000
LINE 0.050000 -0.150000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.100000 0.000000 P R 0.012000
LINE -0.100000 0.000000 -0.050000 -0.050000 P R 0.012000
LINE -0.050000 -0.050000 0.100000 -0.050000 P R 0.012000
ECHAR

CHAR h
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.050000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR i
LINE 0.000000 0.100000 0.000000 -0.050000 P R 0.012000
LINE 0.000000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.000000 0.200000 0.000000 0.200000 P R 0.012000
ECHAR

CHAR j
LINE 0.050000 0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.000000 -0.150000 P R 0.012000
LINE 0.000000 -0.150000 -0.050000 -0.150000 P R 0.012000
LINE -0.050000 -0.150000 -0.100000 -0.100000 P R 0.012000
LINE 0.050000 0.200000 0.050000 0.200000 P R 0.012000
ECHAR

CHAR k
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.000000 0.000000 0.000000 P R 0.012000
LINE 0.000000 0.000000 0.100000 -0.100000 P R 0.012000
LINE -0.050000 0.000000 0.050000 0.100000 P R 0.012000
ECHAR

CHAR l
LINE -0.050000 0.200000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 0.000000 -0.050000 P R 0.012000
LINE 0.000000 -0.050000 0.050000 -0.100000 P R 0.012000
ECHAR

CHAR m
LINE -0.100000 -0.100000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.000000 0.050000 P R 0.012000
LINE 0.000000 0.050000 0.000000 0.000000 P R 0.012000
LINE 0.000000 0.050000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR n
LINE -0.100000 0.100000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.000000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR o
LINE -0.100000 -0.050000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR p
LINE -0.100000 -0.150000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.050000 -0.050000 P R 0.012000
LINE 0.050000 -0.050000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR q
LINE 0.100000 -0.150000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.100000 0.000000 P R 0.012000
LINE -0.100000 0.000000 -0.050000 -0.050000 P R 0.012000
LINE -0.050000 -0.050000 0.100000 -0.050000 P R 0.012000
ECHAR

CHAR r
LINE -0.100000 0.100000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.000000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 0.050000 0.050000 P R 0.012000
ECHAR

CHAR s
LINE -0.100000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 0.000000 P R 0.012000
LINE 0.050000 0.000000 -0.050000 0.000000 P R 0.012000
LINE -0.050000 0.000000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR t
LINE -0.050000 0.200000 -0.050000 -0.050000 P R 0.012000
LINE -0.050000 -0.050000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE -0.100000 0.100000 0.050000 0.100000 P R 0.012000
ECHAR

CHAR u
LINE -0.100000 0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.100000 0.000000 P R 0.012000
LINE 0.100000 -0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR v
LINE -0.100000 0.100000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR w
LINE -0.100000 0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.000000 0.000000 P R 0.012000
LINE 0.000000 0.000000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR x
LINE -0.100000 0.100000 0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR y
LINE -0.100000 0.100000 -0.100000 0.000000 P R 0.012000
LINE -0.100000 0.000000 -0.050000 -0.050000 P R 0.012000
LINE -0.050000 -0.050000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 0.100000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 0.050000 -0.150000 P R 0.012000
LINE 0.050000 -0.150000 -0.050000 -0.150000 P R 0.012000
ECHAR

CHAR z
LINE -0.100000 0.100000 0.100000 0.100000 P R 0.012000
LINE 0.100000 0.100000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR {
LINE 0.050000 0.200000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 -0.050000 0.150000 P R 0.012000
LINE -0.050000 0.150000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.000000 P R 0.012000
LINE -0.050000 0.000000 -0.050000 -0.050000 P R 0.012000
LINE -0.050000 -0.050000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.050000 -0.100000 P R 0.012000
ECHAR

CHAR |
LINE 0.000000 0.200000 0.000000 -0.100000 P R 0.012000
ECHAR

CHAR }
LINE -0.050000 0.200000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 0.050000 0.150000 P R 0.012000
LINE 0.050000 0.150000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.050000 0.000000 P R 0.012000
LINE 0.050000 0.000000 0.050000 -0.050000 P R 0.012000
LINE 0.050000 -0.050000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 -0.050000 -0.100000 P R 0.012000
ECHAR

CHAR ~
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.150000 P R 0.012000
ECHAR

`;var WWe=.59055;var S_=11,F5=class{};var hh=`
`,ch=class o extends F5{constructor(t){if(super(),this.num=t,!t)throw new Error("Invalid XYNumber parameters")}get xy(){return this.num}format(t){return t.formatPointXY(this.num)}static create(t,e){return new o({x:t,y:e})}},mg=class o extends F5{constructor(t){if(super(),this.num=t,isNaN(t))throw new Error("Invalid UnitFormateNumber parameters")}get number(){return this.num}format(t){return[t.formatDecimalNumber(this.num)]}static create(t){return new o(t)}},aq=class extends F5{constructor(t){if(super(),this.num=t,isNaN(t))throw new Error("Invalid FormatNumber parameters")}get number(){return this.num}format(t){return[t.formatPureDecimalNumber(this.num)]}},V3=class extends F5{constructor(t){if(super(),this.num=t,isNaN(t))throw new Error("Invalid SymbolNameNumber parameters")}get number(){return this.num}format(t){return[t.formatSymbolNameDecimalNumber(this.num)]}},V5=class o extends F5{constructor(){super(...arguments);this.modifiers=[]}format(e){let r=[];for(let i of this.modifiers)typeof i=="number"?r.push(i.toString()):typeof i=="string"?r.push(i):r.push(...i.format(e));return[r.join("")]}static create(e){let r=new o;return r.modifiers=e||[],r}};var YD=class o{constructor(){this.rightLength=9;this._unit="INCH";this.toUnit=o.toUnitIN}get unit(){return this._unit}set unit(t){this._unit=t,this.toUnit=t=="INCH"?o.toUnitIN:o.toUnitMM}set decimal(t){this.rightLength=t}static toUnitIN(t){return t/100}static toUnitMM(t){return t*.254}static toNoExponentialString(t){let e=t.toString();if(/[eE]/.test(e)){let r=e.split(/[eE]/),[i,n]=r,s=i[0]=="-"?"-":"";i=s?i.slice(1):i;let a=i,l="";a.includes(".")&&([a,l]=a.split("."));let c=Number(n);c>0?(l=l.padEnd(c,"0"),a+=l.slice(0,c),l=l.slice(c)):c<0&&(a=a.padStart(-c,"0"),l=a.slice(c)+l,a=a.slice(0,a.length+c)),a=a||"0",e=s+a+(l?"."+l:"")}return e}formatPureDecimalNumber(t,e=13){let r=o.toNoExponentialString(t),i=+("1e"+e);return r.includes(".")&&r.split(".")[1].length>e&&(r=o.toNoExponentialString(Math.round(t*i)/i)),r.includes(".")?r:r+".0"}formatDecimalNumber(t){return t=this.toUnit(t),this.formatPureDecimalNumber(t,this.rightLength)}formatSymbolNameDecimalNumber(t){return t=this.toUnit(t)*1e3,this.formatPureDecimalNumber(t,this.rightLength)}formatPointXY(t){let e=this.formatDecimalNumber(t.x),r=this.formatDecimalNumber(t.y);return[e,r]}};var _ae=class{constructor(t){this._name=this.checkName(t)}get name(){return this._name}checkName(t){return t?t.toLowerCase().replace(/[^a-z0-9\.\+\-]/g,"_"):this.autoName()}autoName(){return new Date().getTime().toString()}},AC=class o extends _ae{constructor(e){super(e);this.folderMap=new Xl;this.fileMap=new Xl;this.childFolders=[];this.childFiles=[];this.hasZipFile=!1}addChildFolder(e){let r=e.name;return this.folderMap.getOrDefault(r,null)==null?(this.folderMap.put(r,this.folderMap.size()),this.childFolders.push(e),e.parent=this,e):null}addChildFile(e){let r=e.name;return this.fileMap.getOrDefault(r,null)==null?(this.fileMap.put(r,this.fileMap.size()),this.childFiles.push(e),e.parent=this,e):null}deleteFolder(e){let r=this.folderMap.get(e);r!=null&&(this.childFolders.splice(r,1),this.folderMap.clear(),this.childFolders.forEach((i,n)=>{this.folderMap.put(i.name,n)}))}getChildFolder(e){let r=this.folderMap.get(e);return r!=null?this.childFolders[r]:null}getChildFile(e){let r=this.fileMap.get(e);return r!=null?this.childFiles[r]:null}getAllChildFolder(){return this.childFolders}getAllChidFiles(){return this.childFiles}generateChildFolder(e){let r=e;for(e||(r=this.autoName());this.folderMap.getOrDefault(r,null)!=null;)r=this.autoName();let i=new o(r);return this.addChildFolder(i)}clone(){return new o(this.name)}set parent(e){this._parent=e}get parent(){return this._parent}},Wf=class extends _ae{constructor(){super(...arguments);this.hasZipFile=!1}addUnit2Doc(e){return`UNITS=${e.unit}`+hh}set parent(e){this._parent=e}get parent(){return this._parent}},vae=class extends Wf{constructor(t,e){super(t),this.content=e}exportText(){return this.content}};var evt="tools",xae=class{constructor(){this.num=1;this.tools=[];this.toolMap={}}getNum(t,e,r,i){if(this.toolMap[t]!=null)return this.toolMap[t];let n=this.num;return this.tools.push({NUM:n,SHAPE:i,TYPE:e,MIN_TOL:0,MAX_TOL:0,BIT:"",FINISH_SIZE:r,DRILL_SIZE:r,ORIG_SIZE:-1,SLOT_LENGTH:0,FREEZE:"NO"}),this.toolMap[t]=n,this.addNum(),n}addNum(){this.num++}getTool(t){return this.tools[t-1]}},Rae=class extends Wf{constructor(e,r){super(evt);this._thickness=0;this._userParams="";this.toolNums=new Set;this.format=new YD;this.tool=e,this.format=r}exportText(){let e=this.addUnit2Doc(this.format);return e+=this.getThicknessText(),e+=this.getuserParamsText(),this.toolNums.forEach(r=>{let i=this.tool.getTool(r);i&&(e+=this.exportObj("TOOLS",i)+hh)}),e}exportObj(e,r){let i="";i=`${e} {${hh}${n(r)}}${hh}`;function n(s){let a="";for(let l in s)a+=`    ${l}=${s[l]}${hh}`;return a}return i}addTool(e,r,i=!0){let n=this.format.formatSymbolNameDecimalNumber(e),s=this.getType(r,i),a=this.getShape(r),l=s+n+a,c=this.tool.getNum(l,s,n,a);return this.toolNums.add(c),c}getShape(e){return e==2?"SLOT":"HOLE"}getType(e,r=!0){switch(e){case 0:return r?" PLATED":"NON_PLATED";case 1:return"VIA";case 2:return"NON_PLATED"}}getThicknessText(){return`THICKNESS=${this._thickness}${hh}`}getuserParamsText(){return`USER_PARAMS=${this._userParams}${hh}`}set thickness(e){this._thickness=e}set userParams(e){this._userParams=e}};var lq=class{constructor(){}exportText(t){return""}},jV=class extends lq{constructor(e){super();this.code="#";this.content=e}exportText(){return this.code+this.content}};var YWe=500,CP=class{constructor(){this.currContent=[];this.content=[],this.currContent=[]}clearBlock(){this.content=[],this.currContent=[]}addComment(t){this.currContent.length>=YWe&&(this.content.push(this.currContent),this.currContent=[]),this.currContent.push(new jV(t))}addDataBlock(t){this.currContent.length>=YWe&&(this.content.push(this.currContent),this.currContent=[]),this.currContent.push(t)}exportText(t){this.content.push(this.currContent);let e=[],r="",i=0;for(let n of this.content){for(let s of n)r+=s.exportText(t)+hh;n.length=0,i++,i>=100&&(e.push(r),r="",i=0)}return i>0&&e.push(r),e}};var Da=class o extends lq{constructor(){super();this.code="";this.attr=null;this.modifiers=[]}exportText(e){let r=[];this.code&&r.push(this.code);for(let i of this.modifiers)if(typeof i=="number")r.push(i.toString());else if(typeof i=="string")r.push(i);else try{r.push(...i.format(e))}catch{console.log(this.modifiers)}if(this.attr&&Object.keys(this.attr).length>0){let i=";",n=!0;for(let s in this.attr)n||(i+=","),i+=s,this.attr[s]!=null&&(i+=`=${this.attr[s]}`),n=!1;r.push(i)}return r.join(" ")}addAttr(e,r){this.attr||(this.attr={}),this.attr[e]=r}static create(e,r){let i=new o;return i.code=e,i.modifiers=r||[],i}};var cq=Math.PI;var XV="x",tvt="xr";var Dae=Ht.toDegrees(3*cq/2),_C=class extends Wf{constructor(e){super(e);this.symbolNameMap={};this.attrTableMap={};this._decode=0;this.symbolNameNumber=0;this.attrTableNumber=0;this.featureListNum=0;this.symbolNameBlock=new CP,this.symbolNameBlock.addComment("Feature symbol names"),this.attrTableBlock=new CP,this.attrTableBlock.addComment("Feature attribute names"),this.featureListBlock=new CP,this.featureListBlock.addComment("Layer features")}polygonLine(e,r=!0){let i=[],n=this.checkIsAntiClockWise(e);r==!0?n&&(e=e.reverse()):n||(e=e.reverse()),e=e.asClose();let s=e.primitives,a;for(let l of s){a||(a={x:e.start().x,y:e.start().y},i.push(Da.create("OB",[new ch(a),this.getPolyType(r)])));let c={x:l.end().x,y:l.end().y};if(l instanceof M)i.push(Da.create("OS",[new ch(c)]));else if(l instanceof q){let h=l.length();if(Di.convert(h,10,1)<.1){i.push(Da.create("OS",[new ch(c)]));continue}let u=l.start().distance1(l.end()),d=l.sweepAngle,p=l.center;if(Di.convert(u,10,1)<1&&(d>Dae||d<-Dae)){let m=l.center,g=m.add(m.sub(l.start()));i.push(Da.create("OC",[new ch({x:g.x,y:g.y}),new ch(m),this.getCw(l.sweep())])),i.push(Da.create("OC",[new ch(c),new ch(m),this.getCw(l.sweep())]));continue}i.push(Da.create("OC",[new ch(c),new ch(p),this.getCw(l.sweep())]))}}return i.push(Da.create("OE",[])),i}checkArc(e){return this.checkArcLen(e.length())}checkArcLen(e){return!(e<.05)}checkIsAntiClockWise(e){return e.area(.1)>=0}polygonsConvert(e,r=!0){let i=[];if(e.forEach(({line:n,fill:s})=>{let a=this.polygonLine(n,s);for(let l of a)i.push(l)}),i.length!=0){this.addListBlock(Da.create("S",[this.getPolarity(r),this.getDecode()]));for(let n of i)this.featureListBlock.addDataBlock(n);this.featureListBlock.addDataBlock(Da.create("SE",[]))}}getApertureCircle(e,r=S_){if(e<=0)return null;let i="r"+ka(e,r);if(this.symbolNameMap[i]!=null)return this.symbolNameMap[i];this.symbolNameMap[i]=this.symbolNameNumber;let n="$"+this.symbolNameNumber,s=this.symbolNameNumber;return this.addSymbolNameNumber(),this.symbolNameBlock.addDataBlock(Da.create(n,[V5.create(["r",new V3(e)])])),s}getApertureOval(e,r,i=S_){let n="oval"+ka(e,i)+XV+ka(r,i);if(this.symbolNameMap[n]!=null)return this.symbolNameMap[n];this.symbolNameMap[n]=this.symbolNameNumber;let s="$"+this.symbolNameNumber,a=this.symbolNameNumber;return this.addSymbolNameNumber(),this.symbolNameBlock.addDataBlock(Da.create(s,[V5.create(["oval",new V3(e),XV,new V3(r)])])),a}getApertureSquare(e,r=S_){let i="s"+ka(e,r);if(this.symbolNameMap[i]!=null)return this.symbolNameMap[i];this.symbolNameMap[i]=this.symbolNameNumber;let n="$"+this.symbolNameNumber,s=this.symbolNameNumber;return this.addSymbolNameNumber(),this.symbolNameBlock.addDataBlock(Da.create(n,[V5.create(["s",new V3(e)])])),s}getApertureRect(e,r,i,n=S_){let s="rect"+ka(e,n)+XV+ka(r,n)+XV+ka(i,n);if(this.symbolNameMap[s]!=null)return this.symbolNameMap[s];this.symbolNameMap[s]=this.symbolNameNumber;let a="$"+this.symbolNameNumber,l=this.symbolNameNumber;this.addSymbolNameNumber();let c=["rect",new V3(e),XV,new V3(r)];return i!=0&&c.push(tvt,new V3(i),XV,"1234"),this.symbolNameBlock.addDataBlock(Da.create(a,[V5.create(c)])),l}getSymbolNameByDoc(e){let r="$"+this.symbolNameNumber,i=this.symbolNameNumber;return this.addSymbolNameNumber(),this.symbolNameBlock.addDataBlock(Da.create(r,[e.name])),i}primitiveConvert(e,r,i=!0){e instanceof M?this.lineConvert(e.start(),e.end(),r,i):e instanceof q&&this.ArcConvert(e.start(),e.end(),e.center,r,e.sweep(),e.length(),e.sweepAngle)}lineConvert(e,r,i,n=!0,s){let a=Da.create("L",[new ch({x:e.x,y:e.y}),new ch({x:r.x,y:r.y}),i,this.getPolarity(n),this.getDecode()]);return s&&this.getFeatureRecord(),this.addListBlock(a),a}ArcConvert(e,r,i,n,s,a,l,c=!0){if(Di.convert(a,10,1)<.1)return[this.lineConvert(e,r,n)];let h=e.distance1(r);if(Di.convert(h,10,1)<1&&(l>Dae||l<-Dae)){let d=e.distance1(i),p=new S(i.x-d,i.y),m=new S(i.x+d,i.y),g=[];return g.push(...this.ArcConvert(p,m,i,n,le.CCW,cq*d,cq)),g.push(...this.ArcConvert(m,p,i,n,le.CCW,cq*d,cq)),g}let u=Da.create("A",[new ch({x:e.x,y:e.y}),new ch({x:r.x,y:r.y}),new ch({x:i.x,y:i.y}),n,this.getPolarity(c),this.getDecode(),this.getCw(s)]);return this.addListBlock(u),[u]}PadConvert(e,r,i,n=!1,s=!0){let a=[new ch({x:e.x,y:e.y}),r,this.getPolarity(s),this.getDecode(),...this.getOrient(i)],l=Da.create("P",a);return n&&l.addAttr(this.getSmdAttr()),this.addListBlock(l),l}addDrillParameter(e,r,i){let n=this.getDrillAttr(),s;switch(r){case 0:s=i?0:1;break;case 1:s=2;break;case 2:s=1}e.addAttr(n,s)}addPadUsageParameter(e,r){let i=this.addAttr(".pad_usage"),n;n=r?0:1,e.addAttr(i,n)}getOrient(e,r=!1){switch(e=Ht.regularD(-e),e){case 0:return r?[4]:[0];case 90:return r?[5]:[1];case 180:return r?[6]:[2];case 270:return r?[7]:[3];default:return r?[9,e]:[8,e]}}getDrillAttr(){return this.addAttr(".drill")}getSmdAttr(){return this.addAttr(".smd")}addAttr(e){if(this.attrTableMap[e]!=null)return this.attrTableMap[e];this.attrTableMap[e]=this.attrTableNumber;let r="@"+this.attrTableNumber;return this.attrTableBlock.addDataBlock(Da.create(r,[e])),this.addAttrTableNumber(),this.attrTableMap[e]}addAttrTableNumber(){this.attrTableNumber++}addSymbolNameNumber(){this.symbolNameNumber++}getCw(e){return e==le.CW?"Y":"N"}getDecode(){return this._decode.toString()}set dcode(e){this._decode=e}getPolarity(e){return e?"P":"N"}getPolyType(e){return e?"I":"H"}addListBlock(e){if(Array.isArray(e))for(let r of e)this.featureListBlock.addDataBlock(r),this.needAddFeature(r)&&this.addFeatureRecode();else e&&(this.featureListBlock.addDataBlock(e),this.needAddFeature(e)&&this.addFeatureRecode())}needAddFeature(e){switch(e.code){case"S":case"A":case"L":case"T":case"P":return!0;default:return!1}}addFeatureRecode(){this.featureListNum++}getFeatureRecord(){return this.featureListNum}deleteBlock(){this.symbolNameBlock.clearBlock(),this.attrTableBlock.clearBlock(),this.featureListBlock.clearBlock()}exportText(e){let r=[];return Re.addAll(r,[this.addUnit2Doc(e)]),Re.addAll(r,this.symbolNameBlock.exportText(e)),Re.addAll(r,this.attrTableBlock.exportText(e)),Re.addAll(r,this.featureListBlock.exportText(e)),r}};var wae=class extends AC{constructor(t){super(t),this.addChildFile(new _C("features"))}getLayerDocument(){return this.getChildFile("features")}getToolDocument(t,e){let r=this.getChildFile("tools");return r||(r=this.addChildFile(new Rae(t,e))),r}},G3=class o extends wae{constructor(t){super(t)}clone(){return new o(this.name)}},E_=class o extends wae{constructor(t){super(t)}get startLayerName(){return this._startLayerName}set startLayerName(t){this._startLayerName=t}get endLayerName(){return this._endLayerName}set endLayerName(t){this._endLayerName=t}set plated(t){this.isPlated=t}get plated(){return this.isPlated}clone(){let t=new o(this.name);return t.startLayerName=this._startLayerName,t.endLayerName=this._endLayerName,t}};var jWe=.001,rvt=.1,$V=class{constructor(t){this.documentManage=t}static getDefaultPanelize(){let t=ai.getInstance().getDefaultPanelize();return{on:t.on,success:t.success,row:t.row,column:t.column,rowSpacing:t.rowSpacing,columnSpacing:t.columnSpacing,outerBBox:ai.getInstance().outerBBox,onlyOutline:t.onlyOutline,singleBBox:ai.getInstance().singleBBox}}getEnvironmentOrigin(){return x.getInstance().origin}generateOutLine(t){let e=this.outLine;return e?this.parseOutline(e,t):null}polyGonNeedConvertDrill(t){return t instanceof Po&&this.outLine&&t.globalIndex!=this.outLine.globalIndex?t.bbox.isInside(this.outLine.bbox):!1}parseOutline(t,e){if(t.layerId==11){let r=this.getOutline1(t,e),i=[];return i.push({line:r,fill:!0}),i}return null}getOutline1(t,e){let r;return t instanceof Aa?r=fe.build4([t.leftLow,t.leftUp,t.rightUp,t.rightLow]).asClose():t instanceof Po?r=this.circleModelToLine(t):r=t.pl,r.multiply3(Qe.translate1(e))}getOutline(t,e){let r;return t instanceof Aa?r=fe.build4([t.leftLow,t.leftUp,t.rightUp,t.rightLow]).asClose():t instanceof Po?r=this.circleModelToLine(t):r=t.getMathGraphics(),r.multiply3(Qe.translate1(e))}circleModelToLine(t){let e=t.center,r=t.radius;return this.documentManage.circleToLine(e,r)}generateCopper(t,e){let r=this.documentManage,i=e||Wo.getInstance().getAllItem(),n={},s={},a={};for(let c=0;c<i.length;c++){let h=i[c],u=h.layerId;if(!r.getLayerDocument(u))continue;let m=h.getParent().globalIndex;h.style=="solid"?(s[m]||(s[m]=[]),h.optimization&&(a[m]||(a[m]=[]),a[m].push(h)),s[m].push(h)):(a[m]||(a[m]=[]),a[m].push(h))}let l=Qe.translate1(t);for(let c in s){let h=s[c];if(h.length<=0)continue;let u,d=[];h.forEach(m=>{u=m.layerId,m.pls.sort((y,b)=>b.bbox().area()-y.bbox().area()).forEach((y,b)=>{let P=y.multiply3(l),T=b==0;d.push({line:P,fill:T})})});let p=r.getDcode();n[c]=p,r.addPolygonsToDoc(u,d,c)}for(let c in a){let h=a[c];if(h.length<=0)continue;let u;n[c]?u=n[c]:u=r.addDcode();for(let d of h){let p=d.pls.map(y=>y.multiply3(l)),m=d.style=="solid"?d.optimizationWidth:d.gridLineWidth,g=d.layerId;r.addPolyLineToDoc(g,m,p,u,c)}}}generatePlaneZone(t,e){let r=this.documentManage,i=e||Ho.getInstance().getAllItem(),n=Qe.translate1(t);for(let s of i){let a=s.layerId;if(!r.getLayerDocument(a)||!s.style)continue;let h=s.getOutline().sort((d,p)=>p.bbox().area()-d.bbox().area()),u=[];h.forEach((d,p)=>{let m=d.multiply3(n),g=p==0;u.push({line:m,fill:g})}),r.addDcode(),r.addPolygonsToDoc(a,u,s.globalIndex)}}generateImage(t,e){let r=this.documentManage,i=e||Qs.getInstance().getAllItem();for(let n of i){let s=n.layerId,a=n.getParent();if(s!=56){if(a){if(r.isSilkLayer(s)){if(!r.objectConfigs.includes("ComponentSilkscreen"))continue}else if(!r.objectConfigs.includes("Image"))continue}else if(!r.objectConfigs.includes("Image"))continue}if(!r.getLayerDocument(s))continue;let c=n.getPath(),h=[];for(let u of c)u.pl=u.pl.multiply3(Qe.translate1(t)),h.push(u);r.parseGroupLine(s,h)}}generateText(t,e){let r=this.documentManage,i=e||mo.getInstance().getAllItem(),n=Qe.translate1(t);for(let s of i){let a=s.layerId,l=r.getLayerDocument(a);if(!l)continue;let c=s.getParent(),h=!!s.key;if(a!=56){if(c&&c instanceof vi){if(h){if(!r.objectConfigs.includes("ComponentProperty"))continue}else if(r.isSilkLayer(a)&&!r.objectConfigs.includes("ComponentSilkscreen"))continue}else if(!r.objectConfigs.includes("Text"))continue}let{strokeWidth:u,fontFamily:d,showKey:p,showValue:m}=s;if(!p&&!m)continue;if(d=="default"||d==""){l.dcode=r.addDcode();let P=s.getRealOutline().map(T=>T.multiply3(n));r.addPolyLineToDoc(a,u,P);continue}let g=s.getRealOutline(),y=[];if(g[0]&&g[0]instanceof Kp)g.forEach((b,P)=>{let T=b.pl.multiply3(n);y.push({line:T,fill:b.flag})}),r.addDcode(),r.addPolygonsToDoc(a,y);else{let b=g.map(P=>P.multiply3(n));l.dcode=r.addDcode(),r.addPolyLineToDoc(a,u,b)}}}generatePolygonModel(t,e){let r=this.documentManage,i=r.filterObject(),n=e||Mi.getInstance().getAllItem();for(let s of n){let a=s.layerId;if(s.getParent()){if(r.isSilkLayer(a)){if(!r.objectConfigs.includes("ComponentSilkscreen"))continue}else if(i&&!i.includes(s.type))continue}else if(i&&!i.includes(s.type))continue;qV($e.getInstance().getLayer(a).type)||a!=11&&this.parseProfile(s,t)}}parseProfile(t,e,r=!1){let i=this.documentManage,n=Qe.translate1(e),s=t.layerId,{type:a,strokeWidth:l}=t,c=i.getLayerDocument(s);if(a=="FPC Stiffener"){let h=t.component;c=i.getFPCDocument(s,h.material,h.thickness,h.fpcModel)}switch(a){case"Board Outline":case"Line":{if(!c)return;let h;if(t instanceof Po?h=this.circleModelToLine(t):h=t.getMathGraphics(s,0),!h)return;let u=h.multiply3(n);if(c.parent instanceof G3){let d=u.isClose(jWe);if(!d){let p=u.primitives;this.addDrillPrimitives(p,t.strokeWidth);return}if(d&&t instanceof Po&&this.polyGonNeedConvertDrill(t)){let p=t.center.multiply3(n);return i.addDrillCircle(t.globalIndex,1,2,t.radius,p,2,!1)}}i.addPolyLineToDocByDoc(c,l,[u],i.addDcode());return}case"FPC Stiffener":case"Fill Region":{if(!c)return;let h;if(t instanceof Po?h=this.circleModelToLine(t):h=t.getMathGraphics(s,0),!h)return;let u=h.multiply3(n);i.addDcode(),u instanceof Gt?i.parsePolyGroup(c,u):i.addPolygonsToDocByDoc(c,[{line:u,fill:!0}]);return}case"Slot Region":{this.handleSlot(t,e,r);break}}}addDrillPrimitives(t,e){let r=this.documentManage;for(let i of t)i instanceof M?r.addDrillLine("",1,2,e/2,i.start(),i.end(),2,!1):i instanceof q&&r.addDrillArc("",1,2,e/2,i.start(),i.end(),i.center,i.sweep(),i.length(),i.sweepAngle,2,!1)}handleSlot(t,e,r=!1){let i=this.documentManage,n;if(t instanceof Po){let{center:a,radius:l}=t;if(a=a.multiply3(Qe.translate1(e)),r){i.addDrillCircle2Route(t.globalIndex,l,a,2,!1);return}n=i.circleToLine(a,l)}else n=this.getOutline(t,e);i.addDcode();let s=n.primitives;this.addDrillPrimitives(s,WWe)}handleLineAndArcModel(t,e,r=!1){let i=this.documentManage,n=Qe.translate1(e);for(let s of t){let a=s.layerId,l=i.getLayerDocument(a);if(!l)continue;let c=s.width,h=r&&l.parent instanceof G3,u=s.start.multiply3(n),d=s.end.multiply3(n);s.modelType==="Line"?h?i.addDrillLine("",1,2,s.width,u,d,2,!1):i.addLineConvert(l,c,"",u,d):h?i.addDrillArc("",1,2,s.width,s.start,s.end,s.center,s.sweep,s.length,s.sweepAngle,2,!1):i.addArcConvert(l,c,"",s.start.multiply3(n),s.end.multiply3(n),s.center.multiply3(n),s.sweep,s.length,s.sweepAngle)}}generateRect(t,e){let i=this.documentManage.filterObject(),n=e||rn.getInstance().getAllItem();for(let s of n){if(i&&!i.includes(s.type))continue;let a=s.layerId;qV($e.getInstance().getLayer(a).type)||this.parseProfile(s,t)}}generateCircle(t,e,r=!1){let n=this.documentManage.filterObject(),s=e||zi.getInstance().getAllItem();for(let a of s){if(n&&!n.includes(a.type))continue;let l=a.layerId;qV($e.getInstance().getLayer(l).type)||this.parseProfile(a,t,r)}}generateDimension(t){let e=this.documentManage,r=Ka.getInstance().getAllItem(),i=Za.getInstance().getAllItem(),n=Sl.getInstance().getAllItem(),s=Qe.translate1(t),a=l=>{for(let c of l){let h=c.layerId,u=e.getLayerDocument(h);if(!u)continue;let d=c.getBaseGraphics();e.addDcode();for(let p of d)for(let m of p)e.addPrimitivesToDoc(h,m.multiply3(s),c.strokeWidth);if(c instanceof zd){let p=c.getDegree(),{center:m,radius:g,width:y}=p;m=m.multiply3(s);let b=e.circleToLine(m,g);e.addPolyLineToDocByDoc(u,y,[b])}}};a(r),a(i),a(n)}generateTear(t){let e=this.documentManage,r=Mi.getInstance().getAllItem();for(let i of r)if(i.type=="TearDrop"){let n=i.layerId,s=e.getLayerDocument(n);if(!s)continue;let a=i.getMathGraphics(n,0);if(!a)continue;let l=a.multiply3(Qe.translate1(t));e.addDcode(),e.addPolygonsToDocByDoc(s,[{line:l}])}}generatePad(t,e,r=!1){let i=this.documentManage,n=e||$n.getInstance().getAllItem();for(let s of n){let a=s.layerId,l=gr(a);if(!gr&&!i.getLayerDocument(a))return;if((l||Io(a))&&(this.handlePad(s,1,t,!l),this.handlePad(s,5,t,!l),l||this.handlePad(s,7,t,!l)),(l||2==a)&&(this.handlePad(s,2,t,!l),this.handlePad(s,6,t,!l),l||this.handlePad(s,8,t,!l)),l){for(let b=15;b<=46;b++)s.unusedInnerLayers.includes(b)||this.handlePad(s,b,t,!l);let{plated:c,center:h,rotation:u,holeShape:d,holeLength:p,holeOffset:m,holeRadius:g,holeRotation:y}=s;if(h=h.multiply3(Qe.translate1(t)),g>0){d!=="SLOT"&&(m=m.multiply3(Qe.rotate(u)));let b=h.add(m),P=s.globalIndex;switch(d){case"SLOT":let T=p/2-g,I=b.add1(T,0).rotate(b,y),C=b.add1(-T,0).rotate(b,y);I=I.rotate(h,u),C=C.rotate(h,u),i.addDrillLine(P,1,2,g,I,C,0,c);break;case"ROUND":i.addDrillCircle(P,1,2,g,b,0,c);break;case"RECT":i.useCircleInsteadOfSquareDrill&&i.addDrillCircle(P,1,2,g,b,0,c);break;default:break}}}}}handlePad(t,e,r,i=!1){let n=this.documentManage,s=n.getLayerDocument(e);if(!s)return;let a=this.addPadShapeToDoc(t,s,e);if(a==null)return;let{symbolNum:l,isPolygonModel:c}=a;if(l==null)return;let{center:h}=t;n.addDcode(),h=h.multiply3(Qe.translate1(r)),n.addPadToDocByDoc(s,t.globalIndex,h,l,c,t.rotation,i)}addPadShapeToDoc(t,e,r){var P;let i=this.documentManage,n=this.getPadStyle(t,r);if(!n)return null;let{pasteExpansion:s,topSolderExpansion:a,bottomSolderExpansion:l}=t,c=n.type,h=n.width,u=n.height;if(c=="POLYGON"){let T=(P=t.getMathGraphics(r))==null?void 0:P.multiply3(Qe.translate1(t.center.mul(-1)));return T?{symbolNum:i.addSymbolDoc(T,e),isPolygonModel:!0}:null}let d=7,p=8,m=5,g=6,y=0;switch(r){case d:case p:y=s;break;case m:y=a;break;case g:y=l;break;default:break}let b;switch(c){case"ELLIPSE":{if(h+=y*2,h<=0)break;b=e.getApertureCircle(h);break}case"OVAL":{if(h+=y*2,u+=y*2,h<=0||u<=0)break;if(Ox(h,u)){b=e.getApertureCircle(h);break}b=e.getApertureOval(h,u);break}case"RECT":{if(h+=y*2,u+=y*2,h<=0||u<=0)break;let T=0;T=this.getExpansionRadius(n,y),Ox(h,u)&&T==0?b=e.getApertureSquare(h):b=e.getApertureRect(h,u,T);break}default:break}return{symbolNum:b,isPolygonModel:!1}}getExpansionRadius(t,e){let{width:r,height:i,ratio:n}=t;return Math.min(r,i)/2*n+e}getPadStyle(t,e){if(e==1){if(t.top!=null)return t.top}else if(e==2){if(t.bottom!=null)return t.bottom}else if(6==e){if(t.bottom!=null)return t.bottom}else if(8==e){if(t.bottom!=null)return t.bottom}else if(5==e){if(t.top!=null)return t.top}else if(7==e){if(t.top!=null)return t.top}else if(t.inner!=null)return t.inner;return null}generateVia(t){let e=this.documentManage,r=Tn.getInstance().getAllItem(),i=1,n=2,s=5,a=6,l=15,c=46;for(let h of r){let{startLayer:u,endLayer:d}=h,{center:p,radius:m,holeRadius:g,topExpansion:y,bottomExpansion:b}=h;p=p.multiply3(Qe.translate1(t));let P=!0,T=!0,I,C;P=Io(u)||Io(d),T=2==u||2==d;let E=h.globalIndex;P&&T?e.objectConfigs.includes("Via")&&(u=i,d=n,I=l,C=c):P?(I=l,C=Ms(u)?u:d):T?(I=Ms(u)?u:d,C=c):(I=u<d?u:d,C=u>d?u:d),P&&(e.addViaShapeToDoc(E,i,p,m),e.addViaShapeToDoc(E,s,p,m+y)),T&&(e.addViaShapeToDoc(E,n,p,m),e.addViaShapeToDoc(E,a,p,m+b));for(let O=I;O<=C;O++)h.unusedInnerLayers.includes(O)||e.addViaShapeToDoc(E,O,p,m);P&&T?e.objectConfigs.includes("Via")&&e.addDrillCircle(E,1,2,g,p,1,void 0,!0):e.addDrillCircle(E,u,d,g,p,1,void 0,!0)}}generateTrack(t){let e=this.documentManage,r=An.getInstance().getAllItem(),i=Qe.translate1(t);for(let n of r){let s=e.getLayerDocument(n.layerId);if(s){if(e.addDcode(),n instanceof qr){let a=n.start.multiply3(i),l=n.end.multiply3(i);e.addLineConvert(s,n.width,n.globalIndex,a,l)}else if(n instanceof Oi){let a=n.start.multiply3(i),l=n.end.multiply3(i),c=n.center.multiply3(i);e.addArcConvert(s,n.width,n.globalIndex,a,l,c,n.sweep,n.length,n.sweepAngle)}}}}getTrackNetData(){let t=[],e=An.getInstance().getAllItem();for(let r of e)t.push({globalIndex:r.globalIndex,net:r.net});return t}getPlaneData(){let t=[],e=Ho.getInstance().getAllItem();for(let r of e)t.push({globalIndex:r.globalIndex,net:r.net,fillType:"solid"});return t}getCopperData(){let t=[],e=rn.getInstance().getAllItem();e=e.concat(zi.getInstance().getAllItem()),e=e.concat(Mi.getInstance().getAllItem());for(let r of e){let i=r.component;i instanceof Vn&&t.push({globalIndex:r.globalIndex,net:r.net,fillType:i.style})}return t}getViaData(){let t=Tn.getInstance().getAllItem(),e=[];for(let r of t){let i=r.bbox;e.push({globalIndex:r.globalIndex,net:r.net,center:r.center,bbox:i,holeRadius:r.holeRadius,layerId:r.layerId})}return e}getCompData(){let t=xs.getInstance().getAllItem(),e=[],r=new Map;for(let i of t){let n=[];if(i.getPads().forEach(l=>{n.push(this.getPadInfo(l))}),!r.get(i.footprintUUID)){let l=[],c=Wi.getInstance().getItem(i.footprintUUID),h=c.getOrigin(),u=Qe.translate(-h.x,-h.y);c.getPads().forEach(d=>{l.push(this.getPadInfo(d,u))}),r.set(i.footprintUUID,{pads:l,bbox:c.getBBox()})}let s={},a=i.getAttr();for(let l in a)s[l]={value:a[l].value};e.push({globalIndex:i.globalIndex,rotation:i.rotation,position:i.position,bbox:i.bbox,layerId:i.layerId,designator:i.designator,footprintId:i.footprintId,footprintUUID:i.footprintUUID,pads:n,attrs:s,attrMap:i.attrKeyValue||{}})}return{map:e,footMap:r}}getPadInfo(t,e){let r=t.center,i=t.bbox,n=t.getMathGraphics();return e&&(r=r.multiply3(e),i=i==null?void 0:i.transform(e),n=n==null?void 0:n.multiply3(e)),{net:t.net,rotation:t.rotation,num:t.num,layerId:t.layerId,holeRadius:t.holeRadius,center:r,bbox:i,isTestPad:t.isTestPad,top:t.top?{type:t.top.type,width:t.top.width}:null,bottom:t.bottom?{type:t.bottom.type,width:t.bottom.width}:null,polyline:n,globalIndex:t.globalIndex}}getPcbTextOutline(t=""){return Gd(t,.2,.1).path}getLayerType(t){return $e.getInstance().getLayer(t).type}createPanelize(t,e){let r=ai.getInstance().items,i=ai.getInstance().outlines;for(let n of r){if(n instanceof Li){this.generateText(t,[n]);continue}if(n instanceof Aa){this.generateRect(t,[n]);continue}if(n instanceof Po){this.generateCircle(t,[n],!0);continue}if(n instanceof Je){this.generatePad(t,[n],!0);continue}if(n instanceof ys||n instanceof nl){this.handleLineAndArcModel([n],t);continue}}if(i.length>0){let n=this.documentManage,s=ai.getInstance().getDefaultPanelize(),a=_p.bBoxWithOffset(ai.getInstance().singleBBox,s);if(!this.outLine)return;let c=[this.outLine];e&&gV().forEach(h=>{c.push(h)});for(let h=0;h<s.row;h++)for(let u=0;u<s.column;u++){if(h===0&&u===0)continue;let d=new S(a.offset.x*u,a.offset.y*h).add(t);for(let p of c)p instanceof Aa?this.generateRect(d,[p]):p instanceof Po?this.generateCircle(d,[p]):p instanceof ss?this.generatePolygonModel(d,[p]):n.parseOutLinePolyLine([p],d)}}}outLineHandle(){function t(l){return l.layerId==11}let e=zi.getInstance().getAllItem().filter(l=>t(l)),r=rn.getInstance().getAllItem().filter(l=>t(l)),i=this.connectPolygonOutLine(r,e),n=[].concat(r,i.closePls,e),s,a;return n.forEach(l=>{a?a.area()<l.bbox.area()&&(a=l.bbox,s=l):(a=l.bbox,s=l)}),this.outLine=s,{lines:i.polys.concat(i.closePls),boardLines:i.outline}}connectPolygonOutLine(t,e){var m;let r=[],i=[],n=Mi.getInstance().getAllItem(),s=[],a=new _e,l;function c(g){(l==null||l>g.strokeWidth)&&(l=g.strokeWidth),s.push(g)}n.forEach(g=>{g.layerId==11&&c(g)}),t.forEach(g=>{c(g)}),e.forEach(g=>{c(g)});let h=[],u=s,d=l;u.forEach(g=>{a.ext1(g.bbox);let y=g.getMathGraphics();h.push(...y.primitives)});let p=[];if(h.length>0){let g=a.build1().extendOfSize(2),y=new oh(g,2,rvt,new Gi(1),h),b=g.extendOfSize(g.width()),P=y.detect().items.filter(I=>I.bbox().width()<b.width());for(let I of P)I.isClose(jWe)&&YI(I).forEach(E=>{let O={pl:E.asClose(),strokeWidth:d,bbox:E.bbox(),layerId:11};i.push(O)});let T={};n.forEach(I=>{if(I.layerId==11){let C=I.strokeWidth.toFixed(2).toString();T[C]||(T[C]=[]),T[C].push(I)}});for(let I in T){let C=T[I],E=(m=C[0])==null?void 0:m.strokeWidth,O=[];C.forEach(_=>{let R=_.strokeWidth,v=_.getMathGraphics().primitives,D=this.filterPrimitives(P,v,R),w=v.filter(F=>!D.has(F));for(let F of w){let H=fe.build2([F]),z={pl:H,strokeWidth:R,bbox:H.bbox(),layerId:11};r.push(z)}for(let F of D)O.push(F)}),O.length>0&&p.push({pl:O,strokeWidth:E,layerId:11})}}return{polys:r,closePls:i,outline:p}}filterPrimitives(t,e,r){if(t.length==0)return new Set(e);let i=new nn(10);e.forEach(s=>{i.add(s)});let n=new Set;return t.forEach(s=>{s.primitives.forEach(a=>{let l=i.search(a.bbox().extendOfSize(r));a instanceof q?l.filter(h=>h instanceof q).forEach(h=>{(this.inArcShape(a.start(),r,h)&&this.inArcShape(a.end(),r,h)||this.inArcShape(h.start(),r,a)&&this.inArcShape(h.end(),r,a))&&n.add(h)}):a instanceof M&&l.filter(h=>h instanceof M).forEach(h=>{(this.inLineShape(a.start(),r,h.start(),h.end())&&this.inLineShape(a.end(),r,h.start(),h.end())||this.inLineShape(h.start(),r,a.start(),a.end())&&this.inLineShape(h.end(),r,a.start(),a.end()))&&n.add(h)})})}),n}inArcShape(t,e,r){let i=t.x,n=t.y,s=r.sweep(),a=r.rx,l=r.center,c=s==le.CW,h=c?r.endAngle():r.startAngle,u=c?r.startAngle:r.endAngle();h%=Vr,h<0&&(h+=Vr),u%=Vr,u<0&&(u+=Vr);let d=a-e/2,p=a+e/2,m=i-l.x,g=n-l.y,y=Math.atan2(g,m);if(y<0&&(y+=Vr),h<=u&&y>=h&&y<=u||h>u&&(y>=h&&y<=Vr||y>=0&&y<=u)||h==u){var b=Math.sqrt(m*m+g*g);return b<=p&&b>=d}else{var P=r.start(),T=r.end();return P.distance2(t)<=e*e?!0:T.distance2(t)<=e*e}}inLineShape(t,e,r,i){let n=t.x,s=t.y,a=n-r.x,l=s-r.y,c=n-i.x,h=s-i.y,u=i.x-r.x,d=i.y-r.y,p=new S(-d,u).normalize(),m=u+p.x*e/2,g=d+p.y*e/2,y=m*m+g*g,b=a*a+l*l,P=c*c+h*h,T=Math.abs(a*d-l*u)/2,C=Math.sqrt(u*u+d*d)*e/4;if(T<=C&&b<=y&&P<=y)return!0;{let E=e/2;return b<=E*E?!0:P<=E*E}}getStackupInfo(){let t=[],r=$e.getInstance().getLayerPhys();for(let i of r)t.push({layerId:i.layerId,material:i.material,permittivity:i.permittivity,loss:i.lossTangent,type:i.layerType,thickness:i.thickness});return t}},hq=class{static getDocName(){return x.getInstance().name}static getLayer(t){return $e.getInstance().getLayer(t)}};function vEe(o){return o==="SIGNAL"||o==="TOP"?!0:o==="BOTTOM"}function qV(o){return o==="PLANE"}var Lae=class extends Wf{constructor(e,r){super(e);this.attrTableMap={};this.compNum=0;this.pinNum=0;this.allName=[];this.noNumPad=0;this.netDoc=r,this.attrTableBlock=new CP,this.attrTableBlock.addComment("Component attribute names"),this.compListBlock=new CP,this.compNum=0}addComp(e,r,i,n,s,a){this.noNumPad=0,this.compListBlock.addComment(` CMP ${this.compNum}`);let l=Da.create("CMP",[e,new ch({x:r.x,y:r.y}),new aq(i),this.isMirror(n),this.getCompName(s),this.getPartName(a)]);return this.compListBlock.addDataBlock(l),this.addCompNum(),this.clearPinNum(),l}addProperty(e,r){this.compListBlock.addDataBlock(Da.create("PRP",[this.getCompName(e),this.getStrName(r)]))}getPartName(e){if(!e)return"''";if(e=e.replaceAll(" ","_"),this.allName.includes(e)){let r=1,i=e;do e=`${i}_${r}`,r++;while(this.allName.includes(e))}return this.allName.push(e),e}addPad(e,r,i,n,s,a){let l=e.net,c=!1,h=e.num;(h==null||h=="")&&(this.noNumPad++,h=`un_${this.noNumPad}`);let u=e.layerId,d=e.holeRadius||0,p=e.center.multiply3(Qe.translate1(n)),m=a.multiply3(Qe.translate1(n)),g=e.bbox.width(),y=e.bbox.height();this.netDoc.addPad(l,d,p,u,g,y,!0,e.isTestPad),this.compListBlock.addDataBlock(Da.create("TOP",[this.getPinNum(),new ch({x:m.x,y:m.y}),new aq(s),this.isMirror(c),r,i,h]))}isMirror(e){return e?"M":"N"}getStrName(e){return e==null?"''":`'${e}'`}addCompNum(){this.compNum++}getNextCompNum(){return this.compNum}getNextPinNum(){return this.pinNum}clearPinNum(){this.pinNum=0}getPinNum(){return this.pinNum++}getCompName(e){return e?e.replaceAll(" ","_"):"''"}exportText(e){let r=[];return Re.addAll(r,[this.addUnit2Doc(e)]),Re.addAll(r,this.attrTableBlock.exportText(e)),Re.addAll(r,this.compListBlock.exportText(e)),r}};var KV=class o extends AC{constructor(t){super(t),this.addChildFile(new _C("features"))}addComponentFile(t){this.addChildFile(new Lae("components",t))}getComponentFile(){return this.getChildFile("components")}clone(){return new o(this.name)}};var Mae=class extends Wf{constructor(e){super(e);this.content={}}addAttr(e){Object.assign(this.content,e)}exportText(e){let r=this.addUnit2Doc(e);for(let i in this.content){let n,s=this.content[i];s instanceof mg?n=s.format(e)[0]:n=s,r+=`${i} = ${n}`+hh}return r}};var O_=class o extends AC{constructor(e,r){super(e);this.attrs={};this._layerType=r,this.addChildFile(new _C("features"))}get layerType(){return this._layerType}getFeatureDoc(){return this.getChildFile("features")}clone(){return new o(this.name,this.layerType)}addLayerStackup(e,r,i,n){let s=this.isInner(this._layerType);this.addAttr({".eda_layers":e||"",".layer_dielectric":s?0:new mg(r||0),".copper_weight":s?new mg(r||0):0,".dielectric_constant":i||0,".loss_tangent":n||0})}addAttr2Layer(e,r){this.attrs[e]=r}getAttrFromLayer(e){return this.attrs[e]}isInner(e){switch(e){case"TOP":case"BOTTOM":case"SIGNAL":case"PLANE":return!0;default:return!1}}addAttr(e){let r=this.getChildFile("attrlist");r||(r=this.addChildFile(new Mae("attrlist"))),r.addAttr(e)}};var Nae=class extends Wf{constructor(e){super(e);this.step=[];this.stepNumber=1;this.layerNumber=1;this.layer=[];this.physInfo=null}addSortPhy(e){this.physInfo=e}setStep(e){for(let r of e)this.step.push({COL:this.stepNumber,NAME:r.name}),this.stepNumber++}getStepNames(){let e=[];return this.step.forEach(r=>{e.push(r.NAME)}),e}setLayer(e,r,i,n,s){let a=this.sortLayer(e,r,i,n,s);for(let l of a){let c="",h="";l instanceof E_&&(c=l.startLayerName,h=l.endLayerName);let u={ROW:this.layerNumber,CONTEXT:this.getContext(l),TYPE:this.getType(l),NAME:l.name,POLARITY:"POSITIVE",START_NAME:c,END_NAME:h,OLD_NAME:""};this.physInfo&&l instanceof O_&&l.layerType=="SUBSTRATE"&&(u.DIELECTRIC_TYPE=this.getSubstrateType(l.getAttrFromLayer("DIELECTRIC_TYPE")),u.DIELECTRIC_NAME=l.getAttrFromLayer("DIELECTRIC_NAME")||""),this.layer.push(u),this.layerNumber++}}getSubstrateType(e){return"CORE"}exportText(){let e="";for(let r of this.step)e+=this.exportObj("STEP",r)+hh;for(let r of this.layer)e+=this.exportObj("LAYER",r)+hh;return e}getLayerNames(){let e=[];for(let r of this.layer)e.push(r.NAME);return e}exportObj(e,r){let i="";i=`${e} {${hh}${n(r)}}${hh}`;function n(s){let a="";for(let l in s)a+=`    ${l}=${s[l]}${hh}`;return a}return i}getContext(e){if(e instanceof O_){let r=this.getLayerType(e);if(vEe(r)||qV(r))return"BOARD";switch(r){case"TOP_SILK":case"BOT_SILK":case"TOP_SOLDER_MASK":case"BOT_SOLDER_MASK":case"TOP_PASTE_MASK":case"BOT_PASTE_MASK":case"TOP_STIFFENER":case"BOTTOM_STIFFENER":case"SUBSTRATE":return"BOARD";default:return"MISC"}}else return"BOARD"}sortLayer(e,r,i,n,s){let a=[];n!=null&&n["comp_+_top"]&&a.push(n["comp_+_top"]);let l=Object.assign({},e);if(s)for(let h in s)s[h].layerType=="TOP_STIFFENER"&&a.push(s[h]);if(this.physInfo){let h=this.physInfo;for(let u of h){let d=c(u.layerId);d&&(d.addLayerStackup(d.name,u.thickness,u.permittivity,u.loss),d.addAttr2Layer("DIELECTRIC_TYPE",u.type),d.addAttr2Layer("DIELECTRIC_NAME",u.material))}}else{c(3),c(7),c(5),c(1);for(let h=15;h<=46;h++)c(h);c(2),c(6),c(8),c(4)}if(s)for(let h in s)s[h].layerType=="BOTTOM_STIFFENER"&&a.push(s[h]);for(let h in r)a.push(r[h]);i&&a.push(i),n!=null&&n["comp_+_bot"]&&a.push(n["comp_+_bot"]),c(9),c(10),c(11),c(58),c(59),c(13),c(14);for(let h=71;h<=270;h++)c(h);for(let h in l)c(Number(h));function c(h){let u=l[h];return e[h]&&(a.push(e[h]),delete l[h]),u}return a}getLayerType(e){return e.layerType}getType(e){if(e instanceof E_)return"DRILL";if(e instanceof G3)return"ROUT";if(e instanceof KV)return"COMPONENT";let r=this.getLayerType(e);if(vEe(r))return"SIGNAL";if(qV(r))return"POWER_GROUND";switch(r){case"TOP_SILK":case"BOT_SILK":return"SILK_SCREEN";case"TOP_SOLDER_MASK":case"BOT_SOLDER_MASK":return"SOLDER_MASK";case"TOP_PASTE_MASK":case"BOT_PASTE_MASK":return"SOLDER_PASTE";case"TOP_STIFFENER":case"BOTTOM_STIFFENER":return"MASK";case"SUBSTRATE":return"DIELECTRIC";default:return"DOCUMENT"}}};var ovt="data";var kae=class extends Wf{constructor(){super(ovt);this.layerMap={};this.layerNames=[];this.nets=[];this.pkgNum=-1;this.pkgMap={};this.pkgBlock=new CP;this.allName=[]}setLayer(e,r){this.sortLayer(e,r)}getNetNumByName(e){e||(e="$NONE$");let r=this.netListDoc.getNetNumByNet(e);return this.nets[r]==null&&(this.nets[r]=[[new jV(` NET ${r}`),Da.create("NET",[e])]]),r}addVia(e,r){if(!e)return;let i=this.getNetNumByName(r),n=[];n.push(Da.create("SNT",["VIA"])),n=n.concat(this.getFid(e)),this.nets[i].push(n)}addTrack(e,r){if(!e)return;let i=this.getNetNumByName(r),n=[];n.push(Da.create("SNT",["TRC"])),n=n.concat(this.getFid(e)),this.nets[i].push(n)}addPlane(e,r){if(!e)return;let i=this.getNetNumByName(r),n=[];n.push(Da.create("SNT",["PLN","S","C",0])),n=n.concat(this.getFid(e)),this.nets[i].push(n)}getFillType(e){switch(e){case"solid":return"S";case"90grid":case"45grid":return"H";case"none":return"O";default:return"S"}}addPad(e,r,i,n,s){if(!e)return null;let a=this.getNetNumByName(r),l=[];l.push(Da.create("SNT",["TOP",this.getSide(i),n,s])),l=l.concat(this.getFid(e)),this.nets[a].push(l);let c=this.nets[a].length-2;return{netNum:a,subNetNum:c}}addPkg(e,r,i,n){let s=this.addPkgNum();return this.pkgMap[n]=s,this.pkgBlock.addComment(` PKG ${s}`),this.pkgBlock.addDataBlock(Da.create("PKG",[this.getCompName(e),mg.create(r),ch.create(i.LL().x,i.LL().y),ch.create(i.UR().x,i.UR().y)])),this.addRect(i),s}getCompName(e){if(!e)return"''";if(e=e.replaceAll(" ","_"),this.allName.includes(e)){let r=1,i=e;do e=`${i}_${r}`,r++;while(this.allName.includes(e))}return this.allName.push(e),e}getPkg(e){return this.pkgMap[e]}addPin(e,r,i){this.pkgBlock.addDataBlock(Da.create("PIN",[e,this.getPinType(r),ch.create(i.x,i.y),0,"U","U"]))}addPinRect(e,r,i){let n=ut.extend4(e,r,i);this.addRect(n)}addPinCircle(e,r){this.pkgBlock.addDataBlock(Da.create("CR",[ch.create(e.x,e.y),mg.create(r)]))}addPinPolygon(e){this.pkgBlock.addDataBlock(Da.create("CT",[])),this.polygonLine(e),this.pkgBlock.addDataBlock(Da.create("CE",[]))}polygonLine(e,r=!0){e=e.asClose();let i=e.primitives,n;for(let s of i){n||(n={x:e.start().x,y:e.start().y},this.pkgBlock.addDataBlock(Da.create("OB",[new ch(n),this.getPolyType(r)])));let a={x:s.end().x,y:s.end().y};if(s instanceof M)this.pkgBlock.addDataBlock(Da.create("OS",[new ch(a)]));else if(s instanceof q){let l={x:s.center.x,y:s.center.y};this.pkgBlock.addDataBlock(Da.create("OC",[new ch(a),new ch(l),this.getCw(s.sweep())]))}}this.pkgBlock.addDataBlock(Da.create("OE",[]))}getCw(e){return e==le.CW?"Y":"N"}getPolyType(e){return e?"I":"H"}getPinType(e){return e==12?"T":"S"}addRect(e){let r=e.LL();this.pkgBlock.addDataBlock(Da.create("RC",[ch.create(r.x,r.y),ch.create(e.width(),e.height())]))}addPkgNum(){return this.pkgNum++,this.pkgNum}getSide(e){if(1==e)return"T";if(2==e)return"B"}getFid(e){let r=[];return e.forEach(({layerName:i,record:n})=>{let{type:s,index:a}=this.layerMap[i];r.push(Da.create("FID",[s,a,n]))}),r}sortLayer(e,r){let i=[];n(3),n(7),n(5),n(1);for(let s=15;s<=46;s++)n(s);n(2),n(6),n(8),n(4);for(let s in r)i.push(r[s]);n(9),n(10),n(11),n(58),n(59),n(13),n(14);for(let s=71;s<=270;s++)n(s);function n(s){e[s]&&i.push(e[s])}return i.forEach((s,a)=>{this.layerMap[s.name]={index:a,type:this.getType(s)},this.layerNames.push(s.name)}),i}getType(e){if(e instanceof E_)return"H";switch(e.layerType){case"TOP":case"BOTTOM":case"SIGNAL":case"PLANE":return"C";case"TOP_SOLDER_MASK":case"BOT_SOLDER_MASK":case"TOP_PASTE_MASK":case"BOT_PASTE_MASK":return"L"}}setNetList(e){this.netListDoc=e}exportText(e){let r=[];Re.addAll(r,[this.addUnit2Doc(e)]);let i=`HDR Designed by EasyEDA Pro${hh}`;i+=`LYR ${this.layerNames.join(" ")}${hh}`;for(let n of this.nets)for(let s of n)for(let a of s)i+=a.exportText(e)+hh;return r.push(i),Re.addAll(r,this.pkgBlock.exportText(e)),r}};var svt="EasyEDA Pro",xEe=class extends Wf{exportText(){let t="";t+=this.addDate("JOB_NAME",this.checkName(this._jobName));let e=this._odbVersion.split(".");t+=this.addDate("ODB_VERSION_MAJOR",e[0]),t+=this.addDate("ODB_VERSION_MINOR",e[1]),t+=this.addDate("ODB_SOURCE",`${svt} v${this._version}`);let r=avt(new Date);return t+=this.addDate("CREATION_DATE",r),t+=this.addDate("SAVE_DATE",r),t+=this.addDate("SAVE_APP",""),t+=this.addDate("SAVE_USER",this._saveUser||""),t}addDate(t,e){return`${t}=${e}\r
`}set jobName(t){this._jobName=t}set version(t){this._version=t}set user(t){this._saveUser=t}set odbVersion(t){this._odbVersion=t}},Bae=class extends AC{constructor(){super("misc"),this.addChildFile(new xEe("info"))}getInfoFile(){return this.getChildFile("info")}};function avt(o){function t(c){return c>=10?c:"0"+c}let e=new Date(o),r=e.getFullYear(),i=t(e.getMonth()+1),n=t(e.getDate()),s=t(e.getHours()),a=t(e.getMinutes()),l=t(e.getSeconds());return`${r}${i}${n}.${s}${a}${l}`}var lvt="v",cvt="t",Fae=class extends Wf{constructor(e){super(e);this.attrTableMap={};this.netListArr=[];this.attrTableBlock=new CP,this.netListBlock=new CP,this.netNum=0}getNetNumByNet(e){if(e||(e="$NONE$"),this.attrTableMap[e]!=null)return this.attrTableMap[e];let r=this.addNetNum();return this.attrTableMap[e]=r,this.attrTableBlock.addDataBlock(Da.create("$"+r,[e])),r}addNetNum(){return this.netNum++}addPad(e,r,i,n,s,a,l,c){let h=this.getNetNumByNet(e);this.netListArr[h]==null&&(this.netListArr[h]=[]);let u=[mg.create(r),ch.create(i.x,i.y),this.getLayer(n)];r==0&&u.push(mg.create(s),mg.create(a)),u.push(this.getEpoint(l),this.getExp(),...this.getStaggerred()),l||u.push(lvt),c&&u.push(cvt);let d=Da.create(h.toString(),u);return this.netListArr[h].push(d),d}getLayer(e){switch(e){case 1:return"T";case 2:return"D";case 12:return"B";default:console.warn("layerId is error")}}getEpoint(e){return e?"e":"m"}getExp(){return"e"}getStaggerred(){return["staggered",0,0,0]}exportText(e){let r=[];Re.addAll(r,[this.addUnit2Doc(e)]);for(let i of this.netListArr)if(i)for(let n of i)this.netListBlock.addDataBlock(n);return Re.addAll(r,["H optimize N staggered N"+hh]),Re.addAll(r,this.attrTableBlock.exportText(e)),Re.addAll(r,this.netListBlock.exportText(e)),r}};var hvt=`X_DATUM=0
Y_DATUM=0

TOP_ACTIVE=0
BOTTOM_ACTIVE=0
RIGHT_ACTIVE=0
LEFT_ACTIVE=0
ONLINE_DRC_NAME=
ONLINE_DRC_MODE=DISABLED
ONLINE_DRC_STAT=RED
ONLINE_DRC_TIME=0
ONLINE_DRC_BEEP_VOL=2
ONLINE_DRC_BEEP_TONE=500
ONLINE_NET_MODE=DISABLED
ONLINE_NET_STAT=RED
ONLINE_NET_TIME=0
ONLINE_NET_BEEP_VOL=2
ONLINE_NET_BEEP_TONE=1000`;var Vae=class extends Wf{constructor(){super(...arguments);this.repeats=[]}addRepeats(e,r,i,n,s,a,l){let c=l.width()+i,h=l.height()+n,u=new S(0,0);for(let d=0;d<s;d++){let p=r.y+u.y+d*h;for(let m=0;m<a;m++){let g=r.x+u.x+m*c;this.repeats.push({NAME:e,X:mg.create(g),Y:mg.create(p),DX:mg.create(c),DY:mg.create(h),NX:1,NY:1,ANGLE:0,FLIP:"NO",MIRROR:"NO"})}}}exportText(e){let r=hvt.split(hh),i=this.addUnit2Doc(e);for(let n=0;n<2;n++)i+=r[n]+hh;for(let n of this.repeats)i+=this.exportObj("STEP-REPEAT",n,e);for(let n=2;n<r.length;n++)i+=r[n]+hh;return i}exportObj(e,r,i){let n="";n=`${e} {${hh}${s(r)}}${hh}`;function s(a){let l="";for(let c in a){let h=a[c];typeof a[c]=="object"&&a[c].format&&(h=a[c].format(i)),l+=`    ${c}=${h}${hh}`}return l}return n}};function REe(o){var i;if(!o)return"";let t=(i=o.name)==null?void 0:i.replace(/ /g,"");switch(o.type){case"SIGNAL":case"PLANE":for(var e=15,r=1;e<=46;e++,r++)(o.layerID==e||o.layerId==e)&&(t="InnerLayer"+r);break;case"CUSTOM":for(var e=71,r=1;e<=270;e++,r++)(o.layerID==e||o.layerId==e)&&(t="CustomLayer"+r);break}return t}var uvt=(()=>{let o={};return Bg.forEach(t=>{o[t.layerId]=t}),o})();function Gae(o){let t=uvt[o],e=REe(t),r=new RegExp(/[A-Z]/,"g"),i,n="",s=0;for(;(i=r.exec(e))!=null;){let l=i.index;n+=e.slice(s,l);let c=e[l].toLowerCase();l!=0&&(n+="_"),n+=c,s=l+1}if(e[s]&&(n+=e.slice(s)),!n)throw new Error("Invalid layerId "+o);let a=`${n}`;return a=a.trim().replace(/\s+/g,"_"),a}function XWe(o){return`dielectric_${o-361+1}`}function U5(o,t,e=!0,r=!1,i=!1){let n=e?"pth":"npth",s=r&&i?"_via":"";if(o==1&&t==2||t==1&&o==2)return`drill_${n}_through${s}`;let a=hq.getLayer(o),l=hq.getLayer(t),c=REe(a).replace("Layer","").toLowerCase(),h=REe(l).replace("Layer","").toLowerCase(),u=c+"_to_"+h;return`drill_${n}_${u}`}function uq(o,t,e,r){let i="",n=o==58,s={Polyimide:"pi","Stainless Steel":"gp",Tape:"ps","EMI Shielding Film":n?"csa":"ssa"},a={"3M468":"3m468","3M9077":"3m9077",TESA8854:"tesa8854"};return n?i="top_stiffener_layer_"+s[t]+(t=="EMI Shielding Film"?"":"t")+"_"+(a[r]||e):i="bottom_stiffener_layer_"+s[t]+(t=="EMI Shielding Film"?"":"b")+"_"+(a[r]||e),i}var pvt=.001;var Uae=class{constructor(t){this.odbDocumentManage=new DEe(t)}async exportText(t,e,r,i,n,s){await this.odbDocumentManage.exportText(t,e,r,i,n,s)}get formate(){return this.odbDocumentManage.formate}set formate(t){this.odbDocumentManage.formate=t}get zip(){return this.odbDocumentManage.zip}set zip(t){this.odbDocumentManage.zip=t}get tarWriter(){return this.odbDocumentManage.tarWriter}set tarWriter(t){this.odbDocumentManage.tarWriter=t}get decimalPlaces(){return this.odbDocumentManage.decimalPlaces}set decimalPlaces(t){this.odbDocumentManage.decimalPlaces=t}get fileUuid(){return this.odbDocumentManage.fileUuid}set fileUuid(t){this.odbDocumentManage.fileUuid=t}get job(){return this.odbDocumentManage.job}get userUuid(){return this.odbDocumentManage.userUuid}set userUuid(t){this.odbDocumentManage.userUuid=t}set odbVersion(t){this.odbDocumentManage.exportVerSion=t}getMatrixLayerNames(){return this.odbDocumentManage.getMatrixLayerNames()}getStepNames(){return this.odbDocumentManage.getStepNames()}isTest(){this.odbDocumentManage.setSplitVia(!0)}},DEe=class{constructor(t){this.splitVia=!1;this._decimalPlaces=S_;this.fileUuid="";this.userUuid="";this.comps=new Xl;this.featureRecode={};this.dcode=0;this.symbolNum=0;this._formate=new YD;this.stackUpMap=new Set;this.useCircleInsteadOfSquareDrill=!0;this.modelHandle=new $V(this),this.documentMap=new Xl,this.drillDocumentMap=new Xl,this.fpcDocumentMap=new Xl,this.job=new AC(t||"job");let e=this.job.generateChildFolder("fonts");this.job.generateChildFolder("input"),this.matrix=this.job.generateChildFolder("matrix"),this.steps=this.job.generateChildFolder("steps"),this.symbols=this.job.generateChildFolder("symbols"),this.job.generateChildFolder("user"),e.addChildFile(new vae("standard",HWe)),this.addStep("pcb")}get formate(){return this._formate}set formate(t){this._formate=t}get zip(){return this._zip}set zip(t){this._zip=t}get tarWriter(){return this._tarWriter}set tarWriter(t){this._tarWriter=t}get decimalPlaces(){return this._decimalPlaces}set decimalPlaces(t){this._decimalPlaces=t}get exportVerSion(){return this._exportVerSion}set exportVerSion(t){switch(this._exportVerSion=t,t){case"8.1":this.isV8=!0;break;default:this.isV8=!1}}setSplitVia(t){return this.splitVia=t}addStep(t){let e=this.steps.generateChildFolder(t);this.step=e,this.layers=e.generateChildFolder("layers"),this.addLayers(this.documentMap),this.addLayers(this.drillDocumentMap),this.addLayers(this.fpcDocumentMap),this.addLayers(this.comps),this.rout&&this.layers.addChildFolder(this.rout),this.outline=new _C("profile"),e.addChildFile(this.outline),e.addChildFile(new Vae("stephdr")),this.drillTool=new xae}addLayers(t){t.iterator((e,r)=>(this.layers.addChildFolder(r),!0))}clearStep(){var t;this.documentMap=this.clone(this.documentMap),this.drillDocumentMap=this.clone(this.drillDocumentMap),this.fpcDocumentMap=this.clone(this.fpcDocumentMap),this.comps=this.clone(this.comps),this.rout=(t=this.rout)==null?void 0:t.clone()}clone(t){let e=new Xl;return t.iterator((r,i)=>(e.put(r,i.clone()),!0)),e}async exportText(t,e,r,i,n,s){this.mainVersion=i,this.objectConfigs=r,this.defaultParam=n;let a=!this.defaultParam.onlyOutline&&this.defaultParam.success;this.createDocumentMap(e),await this.progressUpdate(.25);let l=new S(0,0).sub(this.modelHandle.getEnvironmentOrigin()),c=this.modelHandle.outLineHandle();if(this.createPanelize(l,this.defaultParam.onlyOutline),await this.progressUpdate(.3),a){this.step.getChildFile("stephdr").addRepeats("edit",l,this.defaultParam.columnSpacing,this.defaultParam.rowSpacing,this.defaultParam.row,this.defaultParam.column,this.defaultParam.singleBBox);let m=this.defaultParam.outerBBox.transform(Qe.translate1(l));this.setOutline(m),this.clearStep(),this.addStep("edit")}this.parseOutLinePolyLine(c.lines,l,c.boardLines),await this.generateElement(l),this.updateZip(this.job),await this.progressUpdate(.6),this.setNetListFolder(),this.setEdaDateFolder(),this.recordTrackAndViaNet(l),this.recordFootprint(l),this.addLayers(this.comps),await this.progressUpdate(.8);let h=t&&t.includes("PTH"),u=t&&t.includes("NPTH");(!h||!u)&&this.drillDocumentMap.iterator((p,m)=>{let g=m.plated;return!h&&g&&(m.parent.deleteFolder(m.name),this.drillDocumentMap.del(p)),!u&&!g&&(m.parent.deleteFolder(m.name),this.drillDocumentMap.del(p)),!0});let d=this.modelHandle.getStackupInfo();return this.createStackup(d),this.createMatrix(d),this.addMiscInfo(s),this.updateZip(this.job),await this.progressUpdate(.9),!0}updateOtherZip(){let t=this.step.getChildFolder("netlists"),e=this.step.getChildFolder("eda"),r=this.job.getChildFolder("matrix"),i=this.job.getChildFolder("misc"),n=[t,e];for(let s of this.stackUpMap){let a=this.layers.getChildFolder(s);n.push(a)}this.comps.iterator((s,a)=>(n.push(a),!0)),n.push(r,i);for(let s of n)this.updateZip(s)}updateZip(t){var r;let e=[t];for(;e.length>0;){let i=e.shift(),n=this.getZipFileName(i),s=n;i.hasZipFile||((r=this._zip)==null||r.folder(s),i.hasZipFile=!0);let a=i.getAllChidFiles();for(let c of a){let h=n+`/${c.name}`;if(!c.hasZipFile){let u=c.exportText(this.formate);if(this._tarWriter){let d="";Array.isArray(u)?d=u.join(hh):d=u,this._tarWriter.addTextFile(h,d)}else Array.isArray(u)?this._zip.file(h,new Blob(u,{type:"text/plain;charset=utf-8"})):this._zip.file(h,u);c instanceof _C&&c.deleteBlock(),c.hasZipFile=!0}}let l=i.getAllChildFolder();for(let c of l)e.push(c)}}getZipFileName(t){let e=[t],r=[];for(;e.length;){let i=e.shift();i.parent&&e.push(i.parent),r.unshift(i.name)}return r.join("/")}createStackup(t){if(!this.isV8)return;let e="SUBSTRATE";for(let r of t){let i=r.layerId;if(i>=361){let n=XWe(i),s=new O_(n,e);this.documentMap.put(i,s),this.layers.addChildFolder(s),this.stackUpMap.add(n)}}}addMiscInfo(t){let e=new Bae,r=e.getInfoFile();r.jobName=t,r.version=this.mainVersion,r.user="",r.odbVersion=this._exportVerSion,this.job.addChildFolder(e)}async progressUpdate(t){ie.publish("progressUpdate",[t,"Export ODB++..."],$()),await new Promise(e=>{setTimeout(e,30)})}createPanelize(t,e){this.modelHandle.createPanelize(t,e)}setOutline(t){let e=fe.build4([t.LL(),t.LR(),t.UR(),t.UL()]);this.outline.dcode=0,this.outline.polygonsConvert([{line:e}])}parseOutLinePolyLine(t,e,r){let i=this.getLayerDocument(11);if(i){let n=Qe.translate1(e);if(t.forEach(s=>{let l=s.pl.multiply3(n);if(i.parent instanceof G3&&!l.isClose(pvt)){let h=l.primitives;this.modelHandle.addDrillPrimitives(h,s.strokeWidth);return}this.addPolyLineToDocByDoc(i,s.strokeWidth,[l],this.addDcode())}),r){let s=this.addDcode();r.forEach(a=>{a.pl.forEach(l=>{let c=l.multiply3(n);this.addPrimitivesToDocByDoc(i,c,a.strokeWidth,s)})})}}}async generateElement(t){this.generateOutLine(t),this.generateCopper(t),this.generatePlaneZone(t),this.generateImage(t),this.generateDrillImage(t),await this.progressUpdate(.4),this.generateText(t),this.generatePolygonModel(t),this.generateRect(t),this.generateCircle(t),this.generateDimension(t),this.generateTear(t),this.generatePad(t),await this.progressUpdate(.5),this.generateVia(t),this.generateTrack(t)}generateCopper(t){this.objectConfigs.includes("CopperFilled")&&this.modelHandle.generateCopper(t)}addPolygonsToDoc(t,e,r){let i=this.getLayerDocument(t);i&&(i.dcode=this.getDcode(),r&&this.setFeatureRecode(r,i),i.polygonsConvert(e))}addPolyLineToDoc(t,e,r,i,n){let s=this.getLayerDocument(t);if(s){let a=s.getApertureCircle(e);s.dcode=i==null?this.getDcode():i,this.polylineConvert(s,r,a,void 0,n)}}addPrimitivesToDoc(t,e,r){let i=this.getLayerDocument(t);if(i){i.dcode=this.getDcode();let n=i.getApertureCircle(r);i.primitiveConvert(e,n)}}addPrimitivesToDocByDoc(t,e,r,i){t.dcode=i==null?this.getDcode():i;let n=t.getApertureCircle(r);t.primitiveConvert(e,n)}addPolyLineToDocByDoc(t,e,r,i){let n=t.getApertureCircle(e);t.dcode=i==null?this.getDcode():i,this.polylineConvert(t,r,n)}addPolygonsToDocByDoc(t,e){t.dcode=this.getDcode(),t.polygonsConvert(e)}addPadToDocByDoc(t,e,r,i,n,s,a=!1){t.dcode=this.getDcode(),this.setFeatureRecode(e,t);let l=t.PadConvert(r,i,n?0:this.toDegrees(s),a);t.addPadUsageParameter(l,!0)}addLineConvert(t,e,r,i,n){t.dcode=this.getDcode();let s=t.getApertureCircle(e);this.setFeatureRecode(r,t),t.lineConvert(i,n,s)}addArcConvert(t,e,r,i,n,s,a,l,c){t.dcode=this.getDcode();let h=t.getApertureCircle(e);this.setFeatureRecode(r,t),t.ArcConvert(i,n,s,h,a,l,c)}addSymbolDoc(t,e){let r="symbol"+this.addSymbolName(),i=new _C("features"),n=this.symbols.generateChildFolder(r);return i.polygonsConvert([{line:t}]),n.addChildFile(i),e.getSymbolNameByDoc(n)}generatePlaneZone(t){this.objectConfigs.includes("PlaneZone")&&this.modelHandle.generatePlaneZone(t)}generateImage(t){this.modelHandle.generateImage(t)}parseGroupLine(t,e){let r=this.getLayerDocument(t);if(!r)return;this.splitPolylineArr(e).forEach(n=>{let s=[];this.checkGerberPolyline(n),n.forEach((a,l)=>{let c=a.pl;s.push({line:c,fill:a.flag})}),r.dcode=this.addDcode(),r.polygonsConvert(s)})}parsePolyGroup(t,e){let r=[];e=e.getOutMostPolyline().area()>0?new Gt(e.items.map(n=>n.reverse())):e,e.items.forEach(n=>{r.push({line:n,fill:n.area(.1)<0})}),t.dcode=this.addDcode(),t.polygonsConvert(r)}splitPolylineArr(t){let e=[],r=[];for(let i of t)i.order==0?(r=[i],e.push(r)):i.order>0&&r.push(i);return e}checkGerberPolyline(t){for(let e of t){let r=[],i=e.pl.primitives;for(let n of i){if(n instanceof q||n instanceof M)r.push(n);else{let s=n.points(.1);r.push(...fe.build4(s).primitives)}e.pl=fe.build2(r)}}}isSilkLayer(t){return!![3,4].includes(t)}generateDrillImage(t){let e=56,r=.1;this.getDrillDrawingLayerSymbol().forEach(i=>{let n=this.getLayerDocument(e);if(!n)return;n.dcode=this.addDcode();let s=this.getPath(i),a=[];for(let l of s)l.pl=l.pl.multiply3(Qe.translate1(t)),a.push(l);if(i.text!=null){let l=n.getApertureCircle(r);for(let c of a){let h=c.pl;h instanceof fe&&this.polylineConvert(n,[h],l)}return}this.parseGroupLine(e,a)})}polylineConvert(t,e,r,i=!0,n){e.forEach(s=>{s.primitives.forEach(l=>{n&&this.setFeatureRecode(n,t),t.primitiveConvert(l,r,i)})})}getPath(t){let e,r;return t.image&&(e=new pm("",0,t.image),r=e.pls,r.forEach(i=>{i.pl=i.pl.multiply3(t.matrixImage)})),t.text&&(e=new pm("",0,t.text),r=e.pls,r.forEach(i=>{i.pl=i.pl.multiply3(t.matrixText)})),r}getDrillDrawingLayerSymbol(){let t=sq("gerber");if(t==null)return[];let e=1.57;return t.reduce((r,i)=>{let{position:n,text:s,image:a}=i;if(a!=null){let l=new _e;a.forEach(d=>{l.ext1(d.bbox())});let c=l.build1(),h=c.center(),u=Qe.translate(-h.x,-h.y).scale(e/c.width()).translate1(n);r.push({matrixImage:u,image:a})}if(s!=null){let l=this.modelHandle.getPcbTextOutline(s),{center:c,width:h,height:u}=this.getPolyLinesCenterAndWH(...l),d=Qe.translate(-c.x,-c.y).scale(e/Math.max(h,u)/1.8).translate1(n);r.push({matrixText:d,text:l,content:s})}return r},[])}getPolyLinesCenterAndWH(...t){console.time("calculate polyline center");let[e,r,i,n]=[1/0,1/0,-1/0,-1/0];for(let c of t)for(let h of c.primitives){let[u,d,p,m]=[h.start().x,h.end().x,h.start().y,h.end().y];e=Math.min(u,d,e),i=Math.max(u,d,i),r=Math.min(p,m,r),n=Math.max(p,m,n)}let s=new S((e+i)/2||0,(r+n)/2||0),a=Math.abs(i-e),l=Math.abs(n-r);return console.timeEnd("calculate polyline center"),{center:s,width:a,height:l}}generateText(t){this.modelHandle.generateText(t)}generatePolygonModel(t){this.modelHandle.generatePolygonModel(t)}filterObject(){let t=[];return(this.objectConfigs||[]).forEach(e=>{e==="BoardOutline"?t.push("Board Outline"):e==="BoardCutout"?t.push("Slot Region"):e==="CopperOutline"||e==="CopperFilled"?t.push("Copper Region"):e==="SolidRegion"?t.push("Fill Region"):e==="ProhibitedRegion"?t.push("Prohibited Region"):e==="Line"?t.push("Line"):e==="FPCStiffener"&&t.push("FPC Stiffener")}),this.objectConfigs||(t=null),t}generateRect(t){this.modelHandle.generateRect(t)}generateCircle(t){this.modelHandle.generateCircle(t)}getFPCDocument(t,e,r,i){let n=uq(t,e,r,i),s=this.fpcDocumentMap.get(n);if(!s){let a=this.modelHandle.getLayerType(t);s=new O_(n,a),this.fpcDocumentMap.put(n,s),this.layers.addChildFolder(s)}return s==null?void 0:s.getFeatureDoc()}generateDimension(t){this.objectConfigs.includes("Dimension")&&this.modelHandle.generateDimension(t)}generateTear(t){this.objectConfigs.includes("TearDrop")&&this.modelHandle.generateTear(t)}generatePad(t){this.objectConfigs.includes("Pad")&&this.modelHandle.generatePad(t)}addDrillArc(t,e,r,i,n,s,a,l,c,h,u,d){let p=i*2,m=this.getDrillFolder(e,r,d);if(!m)return;let g=m.getLayerDocument(),b=m.getToolDocument(this.drillTool,this.formate).addTool(p,u,d);g.dcode=b;let P=g.getApertureCircle(p);this.setFeatureRecode(t,g),g.ArcConvert(n,s,a,P,l,c,h).forEach(I=>{g.addDrillParameter(I,u,d)})}addDrillCircle(t,e,r,i,n,s,a,l=!1){let c=i*2,h=this.getDrillFolder(e,r,a,l);if(!h)return;let u=h.getLayerDocument(),p=h.getToolDocument(this.drillTool,this.formate).addTool(c,s,a);u.dcode=p;let m=u.getApertureCircle(c);this.setFeatureRecode(t,u);let g=u.PadConvert(n,m,0);u.addDrillParameter(g,s,a)}addDrillLine(t,e,r,i,n,s,a,l){let c=i*2,h=this.getDrillFolder(e,r,l);if(!h)return;let u=h.getLayerDocument(),p=h.getToolDocument(this.drillTool,this.formate).addTool(c,a,l);u.dcode=p;let m=u.getApertureCircle(c);this.setFeatureRecode(t,u);let g=u.lineConvert(n,s,m);u.addDrillParameter(g,a,l)}addDrillLine2Route(t,e,r,i,n,s){let a=e*2,l=this.rout;if(!l)return;let c=l.getLayerDocument(),u=l.getToolDocument(this.drillTool,this.formate).addTool(a,n,s);c.dcode=u;let d=c.getApertureCircle(a);this.setFeatureRecode(t,c);let p=c.lineConvert(r,i,d);c.addDrillParameter(p,n,s)}addDrillCircle2Route(t,e,r,i,n){let s=e*2,a=this.rout;if(!a)return;let l=a.getLayerDocument(),h=a.getToolDocument(this.drillTool,this.formate).addTool(s,i,n);l.dcode=h;let u=l.getApertureCircle(s);this.setFeatureRecode(t,l);let d=l.PadConvert(r,u,0);l.addDrillParameter(d,i,n)}toDegrees(t){return Ht.regularD(Ht.toDegrees(t))}generateVia(t){this.objectConfigs.includes("Via")&&this.modelHandle.generateVia(t)}generateTrack(t){this.objectConfigs.includes("Track")&&this.modelHandle.generateTrack(t)}addViaShapeToDoc(t,e,r,i){let n=this.getLayerDocument(e);if(!n)return;let s=n.getApertureCircle(i*2);if(s==null)return;n.dcode=this.addDcode(),this.setFeatureRecode(t,n);let a=n.PadConvert(r,s,0);n.addPadUsageParameter(a,!1)}addDcode(){return this.dcode++,this.dcode}addSymbolName(){return this.symbolNum++}getDcode(){return this.dcode}getLayerDocument(t){var e,r;return t==11?(e=this.rout)==null?void 0:e.getLayerDocument():(r=this.documentMap.get(t))==null?void 0:r.getFeatureDoc()}generateOutLine(t){if(!this.objectConfigs.includes("BoardOutline"))return;let e=this.modelHandle.generateOutLine(t);e&&(this.outline.dcode=0,this.outline.polygonsConvert(e))}circleToLine(t,e){let r=new S(t.x-e,t.y),i=new S(t.x+e,t.y),n=q.build4(r,i,t,e,e,le.CCW),s=q.build4(i,r,t,e,e,le.CCW);return fe.build2([n,s]).asClose()}createDocumentMap(t){for(let{layerId:e,isMirror:r}of t){if(e==58||e==59)continue;let i=this.modelHandle.getLayerType(e),n=Gae(e);if(e==11){this.rout=new G3(n),this.layers.addChildFolder(this.rout);continue}let s=new O_(n,i);this.documentMap.put(e,s),this.layers.addChildFolder(s)}}createMatrix(t){let e=Object.assign({},this.documentMap.origin()),r=Object.assign({},this.fpcDocumentMap.origin()),i=Object.assign({},this.drillDocumentMap.origin()),n=Object.assign({},this.comps.origin()),s=new Nae("matrix");this.matrix.addChildFile(s),s.setStep(this.steps.getAllChildFolder()),this.isV8&&s.addSortPhy(t),s.setLayer(e,i,this.rout,n,r)}getMatrixLayerNames(){return this.matrix.getChildFile("matrix").getLayerNames()}getStepNames(){return this.matrix.getChildFile("matrix").getStepNames()}getDrillFolder(t,e,r=!0,i=!1){var a,l;let n=(a=this.documentMap.get(t))==null?void 0:a.name,s=(l=this.documentMap.get(e))==null?void 0:l.name;if(n&&s){let c=this.getDrillMapName(t,e,r,i),h=this.drillDocumentMap.get(c);return h||(h=this.drillDocumentMap.get(this.getDrillMapName(e,t,r,i))),h||(h=this.generateDrillFolder(t,e,r,i)),h}return null}getDrillMapName(t,e,r=!0,i=!1){var c,h;let n=r?"pth":"npth",s=i&&this.splitVia?"-via":"",a=(c=this.documentMap.get(t))==null?void 0:c.name,l=(h=this.documentMap.get(e))==null?void 0:h.name;return a&&l?`${n}-${a}-${l}${s}`:null}generateDrillFolder(t,e,r=!0,i=!1){var a,l;let n=(a=this.documentMap.get(t))==null?void 0:a.name,s=(l=this.documentMap.get(e))==null?void 0:l.name;if(n&&s){let c=this.getDrillMapName(t,e,r,i),h=U5(t,e,r,i,this.splitVia),u=new E_(h);return u.startLayerName=n,u.endLayerName=s,u.plated=r,this.drillDocumentMap.put(c,u),this.layers.addChildFolder(u),u}return null}recordTrackAndViaNet(t){let e=this.modelHandle.getTrackNetData();for(let s of e)this.edaData.addTrack(this.getFeatureRecode(s.globalIndex),s.net);let r=this.modelHandle.getViaData();for(let s of r){let a=s.center.multiply3(Qe.translate1(t)),l=s.bbox;this.cadnet.addPad(s.net,s.holeRadius,a,s.layerId,l.width(),l.height(),!1,!1),this.edaData.addVia(this.getFeatureRecode(s.globalIndex),s.net)}let i=this.modelHandle.getCopperData();for(let s of i){let a=this.getFeatureRecode(s.globalIndex);a&&this.edaData.addPlane(a,s.net)}let n=this.modelHandle.getPlaneData();for(let s of n){let a=this.getFeatureRecode(s.globalIndex);a&&this.edaData.addPlane(a,s.net)}}setNetListFolder(){let r=this.step.generateChildFolder("netlists").generateChildFolder("cadnet");this.cadnet=r.addChildFile(new Fae("netlist"))}setEdaDateFolder(){let e=this.step.generateChildFolder("eda");this.edaData=e.addChildFile(new kae);let r=Object.assign({},this.documentMap.origin()),i=Object.assign({},this.drillDocumentMap.origin());this.edaData.setLayer(r,i),this.edaData.setNetList(this.cadnet)}recordFootprint(t){var n,s,a;let{map:e,footMap:r}=this.modelHandle.getCompData(),i=Qe.translate1(t);for(let l of e){let c=l.layerId,h=l.pads,u=this.getComponent(c),d=Ht.regularD(Ht.toDegrees(l.rotation));c==2&&(d=Ht.transformD(d,Qe.MIRROR_X)),d=Ht.regularD(360-d);let p=l.designator,m=((s=(n=l.attrs)==null?void 0:n.Device)==null?void 0:s.value)||l.footprintId,g=u.getNextCompNum(),y=l.footprintUUID,b=this.addFootprint(r.get(y),l.footprintId,l.footprintUUID),P=l.attrMap;u.addComp(b,l.position.multiply3(i),d,!1,p,m);let T=l.attrs;for(let E in T){if(E=="Value"||E=="Comment")continue;let O=T[E];u.addProperty(E,O.value)}P.FootprintId=l.footprintUUID;let I=(a=P.Name)==null?void 0:a.slice(2,-1),C=P[I];u.addProperty("Comment",C),u.addProperty("Value",P.Value);for(let E of h){let O=u.getNextPinNum(),_=this.edaData.addPad(this.getFeatureRecode(E.globalIndex),E.net,c,g,O);if(_){let{netNum:R,subNetNum:v}=_,D=E.center;u.addPad(E,R,v,t,d,D)}}}}addFootprint(t,e,r){if(this.edaData.getPkg(r)!=null)return this.edaData.getPkg(r);let i=null,n=S.ORIGIN;t.pads.forEach(l=>{let c=n.distance1(l.center);(i==null||i>c)&&(i=c)}),i==null&&(i=0);let s=t.bbox,a=this.edaData.addPkg(e,i,s,r);return t.pads.forEach(l=>{let{center:c}=l,h=c;if(l.layerId==12){this.edaData.addPin(l.num,l.layerId,h);let{holeRadius:u}=l;this.edaData.addPinCircle(h,u)}else{let u;switch(l.layerId==1?u=l.top:u=l.bottom,u.type){case"ELLIPSE":{this.edaData.addPin(l.num,l.layerId,h);let d=u.width/2;this.edaData.addPinCircle(h,d);break}default:{let d=l.center;this.edaData.addPin(l.num,l.layerId,d);let m=l.polyline;this.edaData.addPinPolygon(m);break}}}}),a}getComponent(t){let e="";switch(t){case 1:e="comp_+_top";break;case 2:e="comp_+_bot";break}if(this.comps.get(e)==null){let r=new KV(e);this.comps.put(e,r),r.addComponentFile(this.cadnet),this.layers.addChildFolder(r)}return this.comps.get(e).getComponentFile()}setFeatureRecode(t,e){let r=e.getFeatureRecord(),i=e.parent.name;this.featureRecode[t]==null&&(this.featureRecode[t]=[]),this.featureRecode[t].push({layerName:i,record:r})}getFeatureRecode(t){return this.featureRecode[t]}};var Hae=class{constructor(){this.layersName=[]}setLayersName(t){this.layersName=t}setSteps(t){this.steps=t}exportText(){let t={IsOdb:!0,isGerber:!1,ODBLayers:this.layersName.join(","),CompareOdbStepNames:this.steps};return JSON.stringify(t,void 0,4)}};var KWe=nd(jD());function LEe(o){return new Promise(async(t,e)=>{pn("generateOdb-time"),o=await fvt(o);let{title:i,fileUuid:n,userUuid:s,language:a,fileName:l,unit:c,format:h,silk:u,drillMap:d,drillTable:p,layerConfigs:m,objectConfigs:g,mainVersion:y,isTestExport:b,odbVersion:P,isZip:T}=o,I=new Uae;if(I.fileUuid=n,I.userUuid=s,I.decimalPlaces=h?h.Decimals:S_,I.odbVersion=P,p)m.some(_=>_.layerId==56)||m.push({layerId:56});else if(m){let _=m.findIndex(R=>R.layerId==56);_>-1&&m.splice(_,1)}let C=$V.getDefaultPanelize();if(T){let _=new KWe.default;I.zip=_}else I.tarWriter=new Cae;let E=new YD;E.unit=c=="MM"?"MM":"INCH",E.decimal=I.decimalPlaces,I.formate=E,await I.exportText(d,m,g,y,C,i).catch(_=>{throw e(_),_});let O=I.tarWriter?await new Wae().downLoad(I.tarWriter):await new Wae().downLoadZip(I.zip);if(b&&o.exportConfig){let _=new Hae;_.setLayersName(I.getMatrixLayerNames()),_.setSteps(I.getStepNames());let R=_.exportText();t({fileName:l,jsonFile:R,blob:O.blob});return}t({fileName:l,blob:O.blob})})}async function fvt(o){var p;o||(o={});let{title:t,fileUuid:e,userUuid:r,fileName:i,unit:n,drillMap:s,drillTable:a,layerConfigs:l,objectConfigs:c,mainVersion:h,isTestExport:u,format:d}=o;if(t||(o.title=`odb++_pcb_${H5(new Date,"yyyy_MM_dd")}.tgz`),i||(o.fileName=`odb++_pcb_${H5(new Date,"yyyy_MM_dd")}.tgz`),!l){o.layerConfigs=[];let m=(await ie.messageBus.rpcCall("gerberLayerConfig")).message;for(let g of m){let{layerId:y,status:b}=g;b!==0&&o.layerConfigs.push({layerId:y})}}if(s||(o.drillMap=["PTH","NPTH"]),a==null&&(o.drillTable=!0),!c){o.objectConfigs=[];for(let m of MEe)o.objectConfigs.push(m.value)}return h||(o.mainVersion=((p=document.querySelector('meta[name="editorMainVersion"]'))==null?void 0:p.getAttribute("content"))||""),n||(o.unit="IN"),u==null&&(o.isTestExport=!1),u?(d||(o.format={Integer:2,Decimals:6}),await vp.loadTextSuccess()):o.format={Integer:3,Decimals:9},o.odbVersion||(o.odbVersion="8.1"),o}var MEe=[{name:"Pad",value:"Pad"},{name:"Via",value:"Via"},{name:"Track",value:"Track"},{name:"Text",value:"Text"},{name:"Image",value:"Image"},{name:"Dimension",value:"Dimension"},{name:"Board Outline",value:"BoardOutline"},{name:"Slot Region",value:"BoardCutout"},{name:"Copper Region(Filled)",value:"CopperFilled"},{name:"Fill Region",value:"SolidRegion"},{name:"FPC Stiffener",value:"FPCStiffener"},{name:"Line",value:"Line"},{name:"Plane Zone",value:"PlaneZone"},{name:"Component Property",value:"ComponentProperty"},{name:"Component Silkscreen",value:"ComponentSilkscreen"},{name:"TearDrop",value:"TearDrop"}],Wae=class{downLoad(t){return new Promise(e=>{t.write().then(r=>{let i=$We.default.gzip(r),n=new Blob([i],{type:"application/x-gzip"});e({blob:n})})})}downLoadZip(t){return new Promise(e=>{t.generateAsync({type:"blob"}).then(function(r){Bi("generateOdb-time"),e({blob:r})})})}};function H5(o,t){if(!o||Object.prototype.toString.call(o)!="[object Date]")return;function e(i,n){let s=-Math.round(i.getTimezoneOffset()/15)*15,a=~~(s/60),l=~~s%60,c="+";return s<0&&(c="-"),c+("00"+a).slice(-2)+n+("00"+l).slice(-2)}let r={"M+":o.getMonth()+1,"d+":o.getDate(),"h+":o.getHours(),"m+":o.getMinutes(),"s+":o.getSeconds(),S:o.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(/y+/,i=>(o.getFullYear()+"").slice(i.length==2?-2:0))),/(Z+)/.test(t)&&(t=t.replace(/Z+/,i=>e(o,i.length==1?":":"")));for(let i of Object.keys(r)){let n=new RegExp(i);n.test(t)&&(t=t.replace(n,s=>s.length==1?r[i]:("00"+r[i]).slice(-2)))}return t}var dq=class{constructor(){this.fanoutItems=new Set;this.all=new Set}getHasFanoutIds(t){let e=[],r=this.getAllPad(t);for(let i of r){let n=i.searchNode();this.hasTrackOrVia(n)&&e.push(i)}return e.map(i=>i.globalIndex)}fanoutRemove(t){let e=this.getAllPad(t);for(let i of e)this.all.add(i);for(let i of e)this.findFanout(i);let r=new mi;r.addGroup(new ve("fanout remove"));for(let i of this.fanoutItems)r.addCommand4Item(i,"delete"),ie.publish("delete",i),ie.publish("hasModifyPcbItem",i),i.remove();r.execute()}findFanout(t){let e=t.searchNode();if(!this.hasTrackOrVia(e))return;let r=this.filterItems(e);for(r.forEach(i=>this.all.add(i));r.length;){let i=r.shift(),n=i.searchNode();this.filterItems(n).forEach(s=>{this.all.has(s)||r.push(s),this.all.add(s)}),this.hasTrackOrVia([i])&&this.fanoutItems.add(i)}}hasTrackOrVia(t){return!!t.some(e=>e instanceof Ue||e instanceof Ge)}filterItems(t){let e=[];for(let r of t)if(!this.all.has(r)){if(r instanceof Le)return[];(r instanceof Ue||r instanceof Ge||r instanceof Ye&&(r.type==="Fill Region"||r.type==="Line"))&&e.push(r)}return e}getAllPad(t){let e=new Set,r=new Set;for(let i of t)i instanceof Le?r.add(i):i instanceof Me&&i.getPads().forEach(n=>r.add(n)),e.add(i);return r}};var mvt={Component:"icon-eda-symbol",Group:"icon-eda-group","Copper Region":"icon-eda-region-copper",Track:"icon-eda-wire","Board Outline":"icon-eda-board-outline","Slot Region":"icon-eda-region-slot","Fill Region":"icon-eda-region-fill","Prohibited Region":"icon-eda-region-prohibited","Constraint Region":"icon-eda-region-constraint",Line:"icon-eda-line",Text:"icon-eda-text","3D Shell - Outline":"icon-eda-3dshell-outline","3D Shell - Screw Pillar":"icon-eda-3dshell-screw-pillar","3D Shell - Side Datum Line":"icon-eda-3dshell-datum-line","3D Shell - Side Slot Region":"icon-eda-3dshell-side-region-slot","3D Shell - Top/Bottom Slot Region":"icon-eda-3dshell-top-region-slot","3D Shell - Side Entity":"icon-eda-3dshell-side-entity","3D Shell - Top/Bottom Entity":"icon-eda-3dshell-top-entity",Image:"icon-eda-image","Colorful Image":"icon-eda-image",Dimension:"icon-eda-dimension",Pad:"icon-eda-pad","Test Point":"icon-eda-point-test","FPC Stiffener":"icon-eda-fpc-stiffener",Via:"icon-eda-via",NetClass:"icon-eda-class-track",Differential:"icon-eda-routing-differential",EqualLengthGroup:"icon-eda-routing-tuning",Designator:"icon-eda-symbol",Device:"icon-eda-device",Footprint:"icon-eda-footprint",Teardrop:"icon-eda-teardrop",ColorBox:"tree-node-color-box"};function e1(o,t){let e={orange:"icon-color-orange",primaryBlue:"icon-color-primaryblue"};return`${mvt[o]||"icon-eda-file"} ${e[t]||""}`}var ZWe="|_|",gvt="|__|";function k0(o){return o.length==2?o[0]+ZWe+o[1]:o.join(ZWe)}function W5(o,t){return o+gvt+t}var QWe=["Component","Group","Copper Region","Pad","Via","Test Point","Track","Board Outline","Slot Region","Fill Region","Prohibited Region","Constraint Region","Line","FPC Stiffener","3D Shell - Outline","3D Shell - Screw Pillar","3D Shell - Side Datum Line","3D Shell - Side Slot Region","3D Shell - Top/Bottom Slot Region","3D Shell - Side Entity","3D Shell - Top/Bottom Entity","Text","Image","Colorful Image","Dimension","Teardrop"];function eze(){A.publish("getAllItemsBack",QWe.map(o=>({id:o,title:[o],loading:!0,args:{iconCls:e1(o,"orange"),treeNodeType:tn.ObjectRoot,type:o}})),$())}function tze(o){let t={"Copper Region":"Copper Region","FPC Stiffener":"FPC Stiffener","Board Outline":"Board Outline","Slot Region":"Slot Region","Fill Region":"Fill Region","Prohibited Region":"Prohibited Region","Constraint Region":"Constraint Region",Line:"Line","3D Shell - Outline":"3D Shell - Outline","3D Shell - Screw Pillar":"3D Shell - Screw Pillar","3D Shell - Side Datum Line":"3D Shell - Side Datum Line","3D Shell - Side Slot Region":"3D Shell - Side Slot Region","3D Shell - Top Slot Region":"3D Shell - Top/Bottom Slot Region","3D Shell - Side Entity":"3D Shell - Side Entity","3D Shell - Top/Bottom Entity":"3D Shell - Top/Bottom Entity"},e=Object.values(t),r=!o||e.includes(o),i={};if(r){let l=pt.getAllItem(),c=Xt.getAllItem(),h=Zt.getAllItem(),u=new Map;for(let p of[l,c,h])for(let m of p){let g=t[m.type];o&&o!=g||(u.get(g)==null&&u.set(g,[]),m.getParent()&&m.getParent()instanceof Me||u.get(g).push(m))}(o?[o]:e).forEach(p=>{i[p]=JWe(p,u.get(p)||[])})}function n(){return Kt.getAllItem()}let s={Component:()=>Cr.getAllItem(),Group:()=>kt.getAllItem(),"Test Point":()=>Kt.getAllTestPad(),Pad:()=>n(),Via:()=>Hr.getAllItem(),Track:()=>pr.getAllItem(),Text:()=>ti.getAllItem().filter(l=>!l.key&&!l.getParent()),Image:()=>Ln.getAllItem(),"Colorful Image":()=>_o.getAllItem(),Dimension:()=>[].concat(Go.getAllItem(),is.getAllItem(),Uo.getAllItem()),Teardrop:()=>pt.getAllItem().filter(l=>l.type=="TearDrop")};return(o?[o]:Object.keys(s)).forEach(l=>{let c=s[l];c&&(i[l]=JWe(l,c()))}),yvt(i)}function yvt(o){let t=QWe.map(e=>o[e]);return t.sort((e,r)=>e.children.length>0&&r.children.length==0?-1:e.children.length==0&&r.children.length>0?1:-1),t.filter(Boolean)}function JWe(o,t){switch(o){case"Component":{let i=k0(["ObjTab",o]),n=t.length,s=e1(o);return{id:i,title:[o,`(${n})`],args:{iconCls:e1(o,"orange"),treeNodeType:tn.ObjectRoot,type:o,childIcon:s,childTreeNodeType:tn.Object},children:mx(e(t,a=>{let l=k0([i,a.globalIndex]),c=a.name||`${ur}${a.number}`;return W5(c,l)}))}}case"Group":{let i=k0(["ObjTab",o]),n=t.length,s=e1(o);return{id:i,title:[o,`(${n})`],args:{iconCls:e1(o,"orange"),treeNodeType:tn.ObjectRoot,type:o},children:e(mx(t,"title"),a=>{let l=k0([i,a.globalIndex]);return{id:l,title:a.name,args:{iconCls:s,treeNodeType:tn.Group},children:e(a.getItems(),c=>({id:k0([l,c.globalIndex]),title:c instanceof Me?c.name:`${ur}${c.number}`,args:{iconCls:e1(zae(c)),treeNodeType:tn.Object}}))}})}}case"Copper Region":{let i=[];t.sort((a,l)=>gn.getOrder(a.globalIndex)-gn.getOrder(l.globalIndex)).forEach(a=>{let l=a.layerId,c=be.getLayer(l),h=i.filter(u=>u.layerId===l)[0];h||(h={name:be.getLayer(l).name,color:GBe([c.color.r,c.color.g,c.color.b],!0),layerId:l,children:[]},i.push(h)),h.children.push(a)});let n=k0(["ObjTab",o]),s=t.length;return{id:n,title:[o,`(${s})`],args:{iconCls:e1(o,"orange"),treeNodeType:tn.ObjectRoot,type:o},amount:s,children:e(i,a=>{let l=k0([n,a.layerId]);return{id:l,title:[a.name],args:{iconCls:`icon-eda-eye ${a.eyeState?"":"eye-hidden"}`,eyeState:a.children.every(c=>!c.hiddenCopperResult),treeNodeType:tn.CopperLayer},children:e(a.children,c=>({id:k0([l,c.globalIndex]),title:c.component.name||`${ur}${c.number}`,args:{iconCls:`icon-eda-eye ${c.hiddenCopperResult?"eye-hidden":""}`,eyeState:!c.hiddenCopperResult,treeNodeType:tn.Copper}}))}})}}case"Track":{let i=new Map;for(let h of t){let u=h.net||"None";i.get(u)||i.set(u,[]),i.get(u).push({type:o,name:h.globalIndex,globalIndex:h.globalIndex,number:h.number})}let n=new Array(i.size),s=0;for(let[h]of i)n[s]=h,s++;let a=t.length,l=k0(["ObjTab",o]),c=e1(o);return{id:l,title:[o,`(${a})`],amount:a,args:{iconCls:e1(o,"orange"),treeNodeType:tn.ObjectRoot,type:o},children:e(AM(n),h=>{let u=k0([l,h]);return{id:u,title:h,args:{iconCls:c,treeNodeType:tn.TrackNet,childIcon:c,childTreeNodeType:tn.Object},children:mx(e(i.get(h),d=>{let p=k0([u,d.globalIndex]);return W5(`${ur}${d.number}`,p)}),"globalIndex")}})}}case"Pad":{let i=t.length,n=e1(o),s=k0(["ObjTab",o]);return{id:s,title:[o,`(${i})`],amount:i,args:{iconCls:e1(o,"orange"),treeNodeType:tn.ObjectRoot,type:o,childIcon:n,childTreeNodeType:tn.Object},children:mx(e(t,a=>{let l=a.getParent(),c=l instanceof Me?`${l.name}:${a.num}`:`${ur}${a.number}`,h=k0([s,a.globalIndex]);return W5(c,h)}))}}case"Test Point":{let i=new Map;for(let h of t){let u=h.net||"None";i.get(u)||i.set(u,[]),i.get(u).push({type:o,num:h.num,globalIndex:h.globalIndex})}let n=new Array(i.size),s=0;for(let[h]of i)n[s]=h,s++;let a=t.length,l=k0(["ObjTab",o]),c=e1(o);return{id:l,title:[o,`(${a})`],amount:a,args:{iconCls:e1(o,"orange"),treeNodeType:tn.ObjectRoot,type:o},children:e(AM(n),h=>{let u=k0([l,h]);return{id:u,title:`${h} (${i.get(h).length})`,args:{iconCls:c,treeNodeType:tn.TestPadNet,childIcon:c,childTreeNodeType:tn.Object},children:mx(e(i.get(h),d=>{let p=k0([u,d.globalIndex]);return W5(d.num,p)}),"num")}})}}case"Via":{let i=new ft,n=x.getInstance().unit,s=new Map,l=`1-${be.getAllCopperLayer().length}`;t.forEach(d=>{let p;d.name===""?p=l:p=`${d.name}`;let m=`${Xe(d.radius*2,void 0,n,i)}/${Xe(d.holeRadius*2,void 0,n,i)}${n}`;s.has(p)||s.set(p,new Map);let g=s.get(p);g.has(m)||g.set(m,[]),g.get(m).push({type:o,name:d.name,globalIndex:d.globalIndex,number:d.number})});let c=t.length,h=k0(["ObjTab",o]),u=e1(o);return{id:h,title:[o,`(${c})`],amount:c,args:{iconCls:e1(o,"orange"),treeNodeType:tn.ObjectRoot,type:o,childIcon:u,childTreeNodeType:tn.Object},children:e(Array.from(s.keys()),d=>{let p=k0([h,d]),m=s.get(d),g=0;for(let[,y]of m)g+=y.length;return{id:p,title:[d,`(${g})`],args:{iconCls:u,treeNodeType:tn.layerPair,childIcon:u,childTreeNodeType:tn.Object},children:e(Array.from(s.get(d).keys()),y=>{let b=k0([p,y]),P=s.get(d).get(y).length;return{id:b,title:[y,`(${P})`],args:{iconCls:u,treeNodeType:tn.Radiuse,childIcon:u,childTreeNodeType:tn.Object},children:mx(e(s.get(d).get(y),T=>{let I=k0([b,T.globalIndex]);return W5(`${ur}${T.number}`,I)}),"globalIndex")}})}})}}default:return r(o,t)}function e(i,n){let s=new Array(i.length);for(let a=0;a<i.length;a++)s[a]=n(i[a]);return s}function r(i,n){let s=k0(["ObjTab",i]),a=n.length,l=e1(i);return{id:s,title:[i,`(${a})`],amount:a,args:{iconCls:e1(i,"orange"),treeNodeType:tn.ObjectRoot,type:i,childIcon:l,childTreeNodeType:tn.Object},children:e(mx(n,"globalIndex"),c=>{let h=k0([s,c.globalIndex]),u=`${ur}${c.number}`;return W5(u,h)})}}}function zae(o){return o instanceof Me?"Component":o instanceof Ph?"Group":o instanceof Ue&&!o.key&&!o.getParent()?"Track":o instanceof Yn?"Image":o instanceof fr?o.key&&o.getParent()?"Component Property":"Text":o instanceof ca||o instanceof ol||o instanceof xa?"Dimension":o.type=="Line"&&!(o.getParent()&&o.getParent()instanceof Me)?"Line":o.type=="Prohibited Region"?"Prohibited Region":o.type=="Board Outline"?"Board Outline":o.type=="Copper Region"?"Copper Region":o.type=="Slot Region"?"Slot Region":o.type=="Fill Region"&&!(o.getParent()&&o.getParent()instanceof Me)?"Fill Region":o instanceof Le?o.isTestPad?gr(o.layerId)?"TH Test Point":"SMD Test Point":gr(o.layerId)?"TH Pad":"SMD Pad":o instanceof Ge?"Via":""}var U3=Qa.getInstance(),NEe=class{checkConnect(){let t=U3.isCheck(U3.connect.checkFreeCopper),e=U3.isCheck(U3.connect.checkFreeTrack),r=U3.isCheck(U3.connect.checkFreeFillRegion),i=U3.isCheck(U3.connect.checkFreeLine),n=U3.isCheck(U3.connect.sameNetNotConnect),s=Ei.getAllItem(),a=Qn.getAllItem();if(t){let c=new Set;s.forEach(h=>{c.add(h.net)}),a.forEach(h=>{c.add(h.net)});for(let h of c){let u=XS(h);for(let d of u){let p=!1,m=[],g=[];for(let y of d)Ei.getItem(y)!=null?m.push(Ei.getItem(y)):Qn.getItem(y)!=null&&g.push(Qn.getItem(y));if(m.length===d.size)for(let y of m){let b=y.buildBBox();Eo.addConnectError(b.center(),"Common",y.globalIndex,"Copper Region(Filled)",y.net,!0,[y.layerId])}else if(g.length===d.size)for(let y of g){let b=y.buildBBox();Eo.addConnectError(b.center(),"Common",y.globalIndex,"Plane Zone",y.net,!0,[y.layerId])}}}}let l=new Set;ze.getAllNets().forEach(c=>{let h=zo.getRatlineByNetName(c)||[];if(h.forEach(u=>{!u.startNode.isEmpty&&!u.endNode.isEmpty&&(l.add(u.startNode),l.add(u.endNode))}),h.length==0){let u=ze.getSameNetItems(c);if(this.isFreeItems(u)){let d=[],p=[],m=[];u.forEach(g=>{if(g instanceof Ue)e&&d.push(g);else if(g instanceof Ye)switch(g.type){case"Fill Region":r&&!g.getComponent().isBridgingCopper&&m.push(g);break;case"Line":i&&p.push(g);break}}),this.addFreeItemError(d,c),this.addFreeItemError(p,c),this.addFreeItemError(m,c)}}}),this.checkBridgingCopperConnects(),n&&l.forEach(c=>{if(c instanceof zs){let h=c.buildBBox(),u=c instanceof Ge?oi.getMultiShapeEffectLayers(c.model):[c.layerId];Eo.addConnectError(h.center(),"Common",c.globalIndex,zae(c),Bo(c)||"",!1,u)}})}checkBridgingCopperConnects(){var i,n;let t=ZS().filter(s=>s.type==="Fill Region"&&s.component instanceof ln&&s.component.isBridgingCopper),e=new CC,r=[];for(let s of t){let a=(i=s.component)==null?void 0:i.networkList;if(!a||a.length===0)continue;let l=s.buildBBox(),c=bh.getCache(s.model,s.layerId);for(let h of a){let u=ze.getSameNetItems(h).filter(m=>!oi.isBridgingCopper(m.model));if(!u||u.length==0)continue;if(u.every(m=>{let g=m.buildBBox();return l.isSeparated(g)})){let m=Eo.addConnectError(l.center(),"No Contact",s.globalIndex,"Bridging Copper",h,!1,[s.layerId]);r.push(m);continue}let p=!1;for(let m of u){if(m instanceof Pn||m instanceof Cn)continue;let g=m.buildBBox();if(l.isIntersect(g)){if(m instanceof Ye&&m.type==="Copper Region")if(((n=m.copperResultMap)==null?void 0:n.size)>0)for(let y of m.copperResultMap){let b=bh.getCache(y.model,m.layerId);if(e.checkCache(c,b,0).relate===0){p=!0;break}}else e.check(s.getMathGraphics(s.layerId),m.getMathGraphics(),0).relate===0&&(p=!0);else{let y=bh.getCache(m.model,m.layerId);e.checkCache(c,y,0).relate===0&&(p=!0)}if(p)break}}if(!p){let m=Eo.addConnectError(l.center(),"Common",s.globalIndex,"Bridging Copper",h,!1,[s.layerId]);r.push(m)}}}}isFreeItems(t){for(let e of t)if(e instanceof Le||e instanceof Ge||e instanceof Ye&&!(e.type=="Line"||e.type=="Fill Region"||e.type=="Copper Region"))return!1;return!0}addFreeItemError(t,e){if(t.length>0){let r=_s(t).build1(),i=t[0];Eo.addConnectError(r.center(),"Common",i.globalIndex,zae(i),e,!0,[i.layerId])}}},Yae=new NEe;var{IS_CLIENT:s2,IS_LCEDA:rze,IS_EASYEDA:ize,IS_ONLINE:bvt,IS_OFFLINE:JXn,IS_HALF_OFFLINE:QXn,IS_PRIVATE:m9,HAS_SCH:bb,IS_ENTERPRISE_CLIENT:kEe}=$Te,nze=s2&&!bvt;function A_(o){return o instanceof yt||o instanceof Je||o instanceof It||o instanceof lr||o instanceof dc||o instanceof Zx?o.net:null}var z5=class{constructor(t){this.changed=!1;this.root=new Gb,this.capacity=t,this.capacity2=t*t,this.itemList=[]}size(){return this.itemList.length}items(){return this.flushWhenNeed(),this.itemList}add(t){this.itemList.push(t),this.changed=!0}remove(t){Re.remove(this.itemList,t),this.changed=!0}clear(){this.changed=!1,this.root=new Gb,this.itemList.length=0}flushWhenNeed(){if(this.changed){let t=new Array;for(let e of this.itemList)t.push(new Gb(e));for(;;){let e=this.organize(t);if(e.length>1)t=e;else break}this.root=new Gb(t),this.changed=!1}}organize(t){xr(t,KIe,0,t.length);let e=t.length,r=[];for(let i=0;i<e;)if(i+this.capacity2<=e){let n=i+this.capacity2;xr(t,$Ie,i,n);for(let s=i;s<n;s+=this.capacity){let a=new Gb(t.slice(s,s+this.capacity));r.push(a)}i=i+this.capacity*this.capacity-1}else{let n=new Gb(t.slice(i,i+this.capacity));r.push(n),i=i+this.capacity-1}return r}search2(t){this.flushWhenNeed();let e=[],r=[];if(this.itemList.length==0||this.root!=null&&t.isSeparated(this.root.bbox()))return e;r.push(this.root);let i,n,s;for(;i=r.shift(),typeof i<"u";)if(n=i.items(),Array.isArray(n))for(let a of n)t.isSeparated(a.bbox())||(s=a.items(),Array.isArray(s)?a.bbox().isInside(t)?this.add2Result(a,e):r.push(a):e.push(s));else t.isSeparated(i.bbox())||e.push(n);return e}add2Result(t,e){let r=[t],i,n;for(;n=r.shift(),n!==void 0;)if(i=n.items(),Array.isArray(i))for(let s of i)r.push(s);else e.push(i)}search1(t){this.flushWhenNeed();let e=[],r=[];for(r.push(this.root);;){let i=r.shift();if(typeof i<"u"){let n=i.items();if(n instanceof Array)for(let s of n){let a=s.items();a instanceof Array?t.isSeparated(s.bbox())||r.push(s):e.push(a)}else e.push(n)}else break}return e}search(t){this.flushWhenNeed();let e=t.center(),r=[],i=[];i.push(this.root);let n=this.root.bbox().center().distance1(e),s=null,a,l,c,h;for(;;){let u=i.shift();if(typeof u<"u"){if(a=u.items(),Array.isArray(a))for(let d of a)l=d.items(),c=d.bbox(),Array.isArray(l)?t.isSeparated(c)?(h=c.center().distance1(e),h<n&&(n=h,s=d)):i.push(d):r.push(l);else c=a.bbox(),h=c.center().distance1(e),h<=n&&r.push(a);s!=null&&(this.getNearest(s,e,r),s=null)}else break}return r}getNearest(t,e,r){do{let i=t.items(),n=t.bbox().center().distance1(e);if(t=null,Array.isArray(i))for(let s of i){let a=s.items();if(Array.isArray(a)){let c=s.bbox().center().distance1(e);c<n&&(n=c,t=s)}else a.bbox().center().distance1(e)<=n&&r.push(a)}else i.bbox().center().distance1(e)<=n&&r.push(i)}while(t!=null)}walker(t){this.flushWhenNeed(),this._walker(this.root,0,t)}_walker(t,e,r){this.flushWhenNeed();let i=t.items();if(i instanceof Array)for(let n of i)this._walker(n,e+1,r);else r(i,e)}bbox(){return this.flushWhenNeed(),this.root.bbox()}};var jae=class{constructor(t,e,r,i){this.id=t,this.net=e,this.models=r,this.junctions=i;let n=new _e;for(let s of r)n.ext1(s.bbox);this.bbox=n.build()}getModelsByLayer(t){let e=[];for(let r of this.models)this.isModelOnLayer(r,t)&&e.push(r);return e}isModelOnLayer(t,e){return t instanceof Je&&gr(t.layerId)?!t.isUnuseLayer(e):t.layerId===e}};var Xae=class{extract(t){let e=[];for(let r of t)if(r instanceof Je||r instanceof It){let i=new gl(r.center);i.id=r.globalIndex,e.push(i)}else if(r instanceof yt){let i=new gl(r.start);i.id=r.globalIndex;let n=new gl(r.end);n.id=r.globalIndex,e.push(i),e.push(n)}else if(r instanceof Po){let i=new S(r.center.x-r.radius,r.center.y),n=new gl(i);n.id=r.globalIndex,e.push(n)}else if(r instanceof Aa){let i=new gl(r.start);i.id=r.globalIndex,e.push(i)}else if(r instanceof ss){let i=new gl(r.start);if(i.id=r.globalIndex,e.push(i),r.type=="Line"&&!r.isClose()){let n=new gl(r.end);n.id=r.globalIndex,e.push(n)}}else if(r instanceof dc){let i=new gl(r.start);i.id=r.globalIndex,e.push(i)}return e}};var qae=class{aggregate(t){let e=this.preprocessModels(t),r=this.groupByNet(e),i=[],n=0;for(let[s,a]of r){let l=this.findConnectedComponents(a);for(let c of l){let u=new Xae().extract(c);i.push(new jae(n++,s,c,u))}}return i}preprocessModels(t){let e=[],r=new Set,i=$e.getInstance().getAllCopperLayerIds();for(let n of t)if(n instanceof Je&&gr(n.layerId)&&!n.plated)for(let s=0,a=i.length;s<a;s++){let l=i[s];n.isUnuseLayer(l)||(l===1&&n.top!=null?r.add(n.cloneLayer(l,n.top.clone(),void 0,void 0,void 0)):l===2&&n.bottom!=null?r.add(n.cloneLayer(l,void 0,n.bottom.clone(),void 0,void 0)):Ms(l)&&n.inner!=null&&r.add(n.cloneLayer(l,void 0,void 0,n.inner.clone(),void 0)))}else e.push(n);for(let n of r)e.push(n);return e}findConnectedComponents(t){let e=new Map,r=new z5(10);for(let a of t){let l=new K2(a);e.set(a,l),r.add(l)}let i=new Map;for(let[a,l]of e){let c=a.bbox.extendOfSize(1e-8),h=r.search2(c);for(let u of h){if(u===l)continue;let d=this.getEdgeKey(a,u.item);if(i.has(d)){i.get(d)&&(l.addNear(u),u.addNear(l));continue}let p=this.checkConnection(a,u.item);i.set(d,p),p&&(l.addNear(u),u.addNear(l))}}let n=new Set,s=[];for(let[,a]of e){if(n.has(a))continue;let l=new Set,c=a.cluster();for(let h of c)n.add(h),l.add(h.item);s.push(l)}return s}getEdgeKey(t,e){let r=t.globalIndex,i=e.globalIndex;return r<i?`${r}:${i}`:`${i}:${r}`}checkConnection(t,e){return r8(t,e)?new Uy().checkIntersection(t,e):!1}groupByNet(t){let e=new Map;for(let r of t){let i=this.getNet(r),n=e.get(i)||[];n.push(r),e.set(i,n)}return e}getNet(t){return A_(t)}};var BEe=class{constructor(t){this.coord=t;this._points=[];this._bbox=null;this._minX=1/0;this._minY=1/0;this._maxX=-1/0;this._maxY=-1/0}get points(){return this._points}get pointCount(){return this._points.length}addPoint(t,e,r){this._points.push({point:t,cluster:e,endpoint:r}),this._updateBBox(t)}getBBox(){return this._bbox?this._bbox:new ut(0,0,0,0)}_updateBBox(t){this._minX=Math.min(this._minX,t.x),this._minY=Math.min(this._minY,t.y),this._maxX=Math.max(this._maxX,t.x),this._maxY=Math.max(this._maxY,t.y),this._bbox=new ut(this._minX,this._maxX,this._minY,this._maxY)}},$ae=class{constructor(t,e,r){this.grid=new Map;this.totalPoints=0;this.maxPointsPerGrid=0;this.config={gridSizeCoefficient:1,denseGridThreshold:1e3,...r},this.denseGridThreshold=this.config.denseGridThreshold,this.gridSize=e*this.config.gridSizeCoefficient;let i=this.gridSize*2;this.gridBBox=new ut(t.minX-i,t.maxX+i,t.minY-i,t.maxY+i)}insert(t,e,r){let i=this._pointToGridCoord(t),n=this._gridCoordToKey(i),s=this.grid.get(n);s||(s=new BEe(i),this.grid.set(n,s)),s.addPoint(t,e,r),this.totalPoints++;let a=s.points.length;a>this.maxPointsPerGrid&&(this.maxPointsPerGrid=a)}getNeighbors(t){let e=[];for(let r=-1;r<=1;r++)for(let i=-1;i<=1;i++){let n={x:t.x+i,y:t.y+r},s=this._gridCoordToKey(n),a=this.grid.get(s);a&&e.push(a)}return e}nonEmptyCells(){return Array.from(this.grid.values())}getCell(t){let e=this._gridCoordToKey(t);return this.grid.get(e)}getAllPoints(){let t=[];for(let e of this.grid.values())t.push(...e.points);return t}getMetrics(){let t=this.grid.size,e=t>0?this.totalPoints/t:0;return{gridSize:this.gridSize,totalPoints:this.totalPoints,totalClusters:this._countClusters(),nonEmptyGridCount:t,avgPointsPerGrid:e,maxPointsPerGrid:this.maxPointsPerGrid,clusterPairCount:0,executionTime:0}}hasDenseGrids(){return this.maxPointsPerGrid>=this.denseGridThreshold}_pointToGridCoord(t){let e=Math.floor((t.x-this.gridBBox.minX)/this.gridSize),r=Math.floor((t.y-this.gridBBox.minY)/this.gridSize);return{x:e,y:r}}_gridCoordToKey(t){return`${t.x},${t.y}`}_countClusters(){let t=new Set;for(let e of this.grid.values())for(let r of e.points)t.add(r.cluster.id);return t.size}};var ZV=class{constructor(t,e,r,i){this.actualDistance=1/0;this.checkResult=null;this.cluster1=t,this.cluster2=e,this.estimatedDistance=r,this.nearestEndpoints=i}getPairKey(){return this.cluster1.id<this.cluster2.id?`${this.cluster1.id}|${this.cluster2.id}`:`${this.cluster2.id}|${this.cluster1.id}`}};var Kae=class{constructor(){this.pairs=new Map}updateDistance(t,e,r,i,n){let s=this._getPairKey(t.id,e.id),a=this.pairs.get(s);(!a||a.distance2>r)&&this.pairs.set(s,{cluster1:t,cluster2:e,distance2:r,endpoint1:i,endpoint2:n})}getAllPairs(){return Array.from(this.pairs.values())}convertToCreepageClusterPairs(){return this.getAllPairs().map(t=>{let e=Math.sqrt(t.distance2);return new ZV(t.cluster1,t.cluster2,e,[t.endpoint1,t.endpoint2])})}get size(){return this.pairs.size}_getPairKey(t,e){return t<e?`${t}|${e}`:`${e}|${t}`}};var Pvt=[{x:0,y:-1},{x:1,y:-1},{x:1,y:0},{x:1,y:1}],Zae=class{constructor(){this.ruleModelManager=te.getInstance();this.ruleCache=new Map}setConfig(t){this.config=t}getMetrics(){return this.metrics}_getRuleCacheKey(t,e){return t<e?`${t}|${e}`:`${e}|${t}`}buildCandidateEdges(t,e){let r=performance.now();if(t.length<2)return[];let i=this._calculateBoardBBox(t),n=e||1e3,s=new $ae(i,n,this.config);for(let d of t)for(let p of d.junctions)s.insert(p.point.clone(),d,p);let a=new Kae,l=s.nonEmptyCells(),c=new Set;for(let d of l){this._calculateInternalGridDistances(d,a);for(let p of Pvt){let m={x:d.coord.x+p.x,y:d.coord.y+p.y},g=s.getCell(m);if(!g)continue;let y=this._getGridPairKey(d.coord,g.coord);c.has(y)||(c.add(y),this._calculateGridPairDistances(d,g,a))}}let h=performance.now(),u=s.getMetrics();return u.clusterPairCount=a.size,u.executionTime=h-r,this.metrics=u,s.hasDenseGrids()&&console.warn(`[CreepageMSTBuilder] Dense grid detected: ${u.maxPointsPerGrid} points in a single grid`),a.convertToCreepageClusterPairs()}computeMSTFromActualDistances(t,e){if(t.length===0)return[];let r=t.filter(s=>s.actualDistance<1/0).sort((s,a)=>s.actualDistance-a.actualDistance);if(r.length===0)return[];let i=z8(e),n=[];for(let s of r)if(i.union(s.cluster1.id,s.cluster2.id)&&(n.push(s),n.length===e-1))break;return n}_calculateInternalGridDistances(t,e){let r=t.points,i=r.length;for(let n=0;n<i;n++){let s=r[n];for(let a=n+1;a<i;a++){let l=r[a];if(s.cluster.id===l.cluster.id||s.cluster.net===l.cluster.net||!this._checkCreepageRule(s.cluster.net,l.cluster.net))continue;let c=s.point.x-l.point.x,h=s.point.y-l.point.y,u=c*c+h*h;e.updateDistance(s.cluster,l.cluster,u,s.endpoint,l.endpoint)}}}_calculateGridPairDistances(t,e,r){for(let i of t.points)for(let n of e.points){if(i.cluster.id===n.cluster.id||i.cluster.net===n.cluster.net||!this._checkCreepageRule(i.cluster.net,n.cluster.net))continue;let s=i.point.x-n.point.x,a=i.point.y-n.point.y,l=s*s+a*a;r.updateDistance(i.cluster,n.cluster,l,i.endpoint,n.endpoint)}}_checkCreepageRule(t,e){if(!t||!e)return!1;let r=this._getRuleCacheKey(t,e),i=this.ruleCache.get(r);if(i!==void 0)return i;let n={net:t,shapeType:0,id:"",layerId:1},s={net:e,shapeType:0,id:"",layerId:1},a=["BetweenNetRule","NetRule"],l=!1;for(let c of a){let h=this.ruleModelManager.getRule4Order(n,s,c,2);if(h.length>0){for(let u of h)if(u.creepageDistance>0){l=!0;break}}if(l)break}if(!l){let c=this.ruleModelManager.getDefaultCreepageSpacing();c&&c.creepageDistance>0&&(l=!0)}return this.ruleCache.set(r,l),l}_calculateBoardBBox(t){let e=1/0,r=1/0,i=-1/0,n=-1/0;for(let s of t)for(let a of s.junctions){let l=a.point;e=Math.min(e,l.x),r=Math.min(r,l.y),i=Math.max(i,l.x),n=Math.max(n,l.y)}return new ut(e,i,r,n)}_getGridPairKey(t,e){return t.x<e.x||t.x===e.x&&t.y<e.y?`${t.x},${t.y}|${e.x},${e.y}`:`${e.x},${e.y}|${t.x},${t.y}`}};var JV=class{constructor(t,e,r,i,n,s=!1){this.source=t;this.project=e;this.obstacles=r;this.clearance=i;this.calculateMinDistance=s;this.result=new Array;this.points=new Array;this.tree=new lP(7);this.used=new Set;let a=new nn(7);for(let c of e)n.isSeparated(c.bbox())||a.add(c);for(let c of t.primitives)n.isSeparated(c.bbox())||this.project4WithTree(c,a,n);this.result=this.isValidLines(this.result,n);let l=[];for(let c of this.result)l.push(c.start());this.removeRepeat(l)}removeRepeat(t){let e=new nn(7);for(let i of t)e.add(i);let r=new Set;for(let i of t){if(r.has(i))continue;let n=e.search(i.bbox().extendOfSize(1e-6));for(let s of n)r.add(s);this.points.push(i)}}project4WithTree(t,e,r){let i=t.bbox().extendOfSize(this.clearance).intersect(r);this.used.clear();for(let n of e.search(i))Re.addAll(this.result,this.projectPts(t,n))}projectPts(t,e){if(t instanceof M)return this.project4Direct(t,e);if(t instanceof q)return this.project4Arc(t,e);throw new Error("not support!!!")}project4Direct(t,e){let r=t.start(),i=t.direct,n=new Array;if(e instanceof M)this.add2Result(t,e.start(),n),this.add2Result(t,e.end(),n);else if(e instanceof q){let s=i.mul(e.rx),a=e.center.sub(s),l=e.center.add(s);this.isOn(e,a)&&this.add2Result(t,a,n),this.isOn(e,l)&&this.add2Result(t,l,n);let c=this.getTangencyPoint(r,e);for(let u of c){let d=new M(r,u);this.isValidProject(d)&&n.push(d)}let h=this.getTangencyPoint(t.end(),e);for(let u of h){let d=new M(t.end(),u);this.isValidProject(d)&&n.push(d)}this.add2Result(t,e.start(),n),this.add2Result(t,e.end(),n),this.calculateMinDis(t,e)}else throw new Error("not support!!!");return n}calculateMinDis(t,e){if(this.calculateMinDistance){let r=new Zu(t,e),i=r.getDistance();if(ne.greater(i,0)&&ne.less(i,this.clearance)){let n=r.getLine();t instanceof M?oD(t,n.start())?this.result.push(n):this.result.push(n.reverse()):t instanceof q&&(sD(t,n.start())?this.result.push(n):this.result.push(n.reverse()))}}}add2Result(t,e,r){if(this.used.has(e))return;this.used.add(e);let i=t.start(),n=t.direct,s=e.sub(i),a=n.dot(s),l=this.getStart4Line(a,t),c=new M(l,e);this.isValidProject(c)&&r.push(c)}isUsed(t){return this.tree.search(t.bbox().extendOfSize(1e-6)).length>0}isOn(t,e){return t.isCircle()?!0:vm(t,e)}getStart4Line(t,e){return ne.lesseq(t,0)?e.start():ne.greatereq(t,e.length())?e.end():e.start().add(e.direct.mul(t))}isValidProject(t){return!ne.greatereq(t.length(),this.clearance)}isValidLines(t,e){let r=new Array,i=new Array;for(let n of this.obstacles){let s=n.search(e);Re.addAll(i,s)}e:for(let n of t){let s=n.start();if(!this.isUsed(s)){for(let a of i){let l=Tt(n,a);for(let c=0;c<l;c+=2){let h=new S(Ee[c],Ee[c+1]);if(!h.equals1(n.start())&&!h.equals1(n.end()))continue e}}this.tree.insert(s),r.push(n)}}return r}project4Arc(t,e){this.calculateMinDis(t,e);let r=new Array;if(e instanceof M)return this.getLine4Arc(t,e.start(),r),this.getLine4Arc(t,e.end(),r),r.filter(i=>this.isValidProject(i));if(e instanceof q){let i=this.getTangencyPoint(t.center,e);i.push(e.start()),i.push(e.end());let n=e.center.sub(t.center).normalize();if(!n.equals1(S.ORIGIN)){n=new S(-n.y,n.x);let s=n.mul(e.rx),a=e.center.sub(s),l=e.center.add(s);this.isOn(e,a)&&i.push(a),this.isOn(e,l)&&i.push(l)}for(let s of i)this.getLine4Arc(t,s,r);return r.filter(s=>this.isValidProject(s))}else throw new Error("not support!!!")}getLine4Arc(t,e,r){let i=t.center;if(this.isOn(t,e)&&!e.equals1(i)){let n=e.sub(i).normalize().mul(t.rx);if(this.used.has(e))return;this.used.add(e),r.push(new M(i.add(n),e))}else for(let n of[t.start(),t.end()]){let s=new M(n,e);r.push(s)}}getTangencyPoint(t,e){let r=new Array,i=t.sub(e.center),n=i.length();if(ne.greatereq(e.rx,n))return r;let s=e.rx/n,a=Math.acos(s),l=i.normalize(),c=l.rotate(S.ORIGIN,a),h=l.rotate(S.ORIGIN,-a),u=e.center.add(c.mul(e.rx)),d=e.center.add(h.mul(e.rx));return this.isOn(e,u)&&r.push(u),this.isOn(e,d)&&r.push(d),r}};var Jae=class{constructor(){this.limit=Number.MAX_SAFE_INTEGER;this.newMapOld=new Map;this.direct=new S(0,1)}simplify(t){this.newMapOld.clear();let e=Array.from(t.primitives),r=!0,i=0;for(;r&&i<this.limit;){r=!1;for(let u=0,d=e.length;u<d;u++){let p=(u+1)%d,m=e[u],g=e[p];if(this.isConvex(m,g)){if(m instanceof q&&m.sweep()==le.CCW){r=!0,e.splice(u,1,new M(m.start(),m.end()));break}}else{let y=this.simplifyLines(m,g);r=!0,p==0?(e.shift(),e.pop(),e.push(...y)):e.splice(u,2,...y);break}}i++}let n=new Map,s=new Array;for(let u of e){let d=u.start();n.set(d,u),s.push(d)}s.sort((u,d)=>{let p=u.x-d.x;return ne.eq(p,0)?u.y-d.y:p});let a=new Array;for(let u of s){for(;a.length>=2&&ne.less(a[a.length-1].sub(a[a.length-2]).cross(u.sub(a[a.length-2])),0);)a.pop();a.push(u)}let l=new Array;s=s.reverse();for(let u of s){for(;l.length>=2&&ne.less(l[l.length-1].sub(l[l.length-2]).cross(u.sub(l[l.length-2])),0);)l.pop();l.push(u)}l[l.length-1].equals1(a[0])&&a.shift(),l[0].equals1(a[a.length-1])&&a.pop();let c=[...l,...a].reverse(),h=new Array;for(let u of c){let d=n.get(u);if(h.length>0){let p=h[h.length-1];p.end().equals1(u)||(h.pop(),h.push(new M(p.start(),u)))}h.push(d)}return h}simplifyOnePolygon(t){this.newMapOld.clear();let e=new Array,r=t.primitives;for(let n of r)this.newMapOld.set(n,n),this.calculate([n],e);let i=!0;for(;i;){i=!1;let n=e.shift();i=this.calculate([n],e)}return e}calculate(t,e){let r=!1;e:for(;t.length>0;){let i=t.shift();for(;e.length>=1&&(!this.isConvex1(e[e.length-1],i)||this.notIsConvex(i.start(),Ot(e[e.length-1]),Ot(i,i.start()),e));){let n=this.simplifyLines1(e[e.length-1],i);t.unshift(...n),e.pop(),r=!0;continue e}e.push(i)}return r}notIsConvex(t,e,r,i){let n=0;for(let s of i)t.equals1(s.start())||t.equals1(s.end())||(n+=this.windingNumber(t,s.start(),s.end()));if(n==0)return!1;if(n<0){let s=this.direct.dot(e),a=this.direct.dot(r);return!(s>=0&&s*a>=0)}else{let s=this.direct.dot(e),a=this.direct.dot(r);return!(s<=0&&s*a>=0)}return n>1&&n%2==1}windingNumber(t,e,r){if(e.y<=t.y&&t.y<r.y){if(r.sub(e).cross(t.sub(e))>0)return 1}else if(r.y<=t.y&&t.y<e.y&&r.sub(e).cross(t.sub(e))<0)return-1;return 0}replaceMap(t,e){let r=this.newMapOld.get(t);if(r!=null){this.newMapOld.delete(t);for(let i of e)this.newMapOld.set(i,r)}}simplifyLines1(t,e){if(t instanceof M&&e instanceof M)return[new M(t.start(),e.end())];if(t instanceof M&&e instanceof q){if(e.sweep()==le.CCW)return[t,new M(e.start(),e.end())];{let r=this.getTangencyPoint(t.start(),e);if(r.length>0){dn(r,e);let i=r[0],n=gd(e,i);return this.replaceMap(e,n),n.shift(),[new M(t.start(),i),...n]}else return[new M(t.start(),e.end())]}}else if(t instanceof q&&e instanceof M){if(t.sweep()==le.CCW)return[new M(t.start(),t.end()),e];{let r=this.getTangencyPoint(e.end(),t);if(r.length>0){dn(r,t);let i=r[r.length-1],n=gd(t,i);return this.replaceMap(t,n),n.pop(),[...n,new M(i,e.end())]}else return[new M(t.start(),e.end())]}}else if(t instanceof q&&e instanceof q){if(t.sweep()==le.CCW)return[new M(t.start(),t.end()),e];if(e.sweep()==le.CCW)return[t,new M(e.start(),e.end())];if(t.sweep()==le.CW){let i;t.rx>e.rx?i=this.getArcsTangencyPoint(e,t).arc2Tangency:i=this.getArcsTangencyPoint(t,e).arc1Tangency,dn(i,t);for(let n of i){let s=n.sub(t.start()).normalize(),a=this.getTangencyPoint(n,e);dn(a,e);for(let l of a){let c=l.sub(n);if(this.isCW(s,c)&&this.isValid(n,l,[t,e])){let h=gd(t,n);this.replaceMap(t,h);let u=h.shift(),d=gd(e,l);this.replaceMap(e,d);let p=d.pop();return[u,new M(n,l),p]}}}}let r=this.getTangencyPoint(t.start(),e);dn(r,e);for(let i of r){let n=i.sub(t.start()).normalize(),s=e.end().sub(i);if(this.isCW(n,s)&&this.isValid(t.start(),i,[t,e])){let a=gd(e,i);this.replaceMap(e,a);let l=a.pop();return[new M(t.start(),i),l]}}return[new M(t.start(),e.end())]}}simplifyLines(t,e){if(t instanceof M&&e instanceof M)return[new M(t.start(),e.end())];if(t instanceof M&&e instanceof q){let r=this.getTangencyPoint(t.start(),e);if(r.length>0){dn(r,e);let i=r[0],n=gd(e,i);return n.shift(),[new M(t.start(),i),...n]}else return[new M(t.start(),e.end())]}else if(t instanceof q&&e instanceof M){let r=this.getTangencyPoint(e.end(),t);if(r.length>0){dn(r,t);let i=r[r.length-1],n=gd(t,i);return n.pop(),[...n,new M(i,e.end())]}else return[new M(t.start(),e.end())]}else if(t instanceof q&&e instanceof q){if(t.sweep()==le.CW){let i;t.rx>e.rx?i=this.getArcsTangencyPoint(e,t).arc2Tangency:i=this.getArcsTangencyPoint(t,e).arc1Tangency,dn(i,t);for(let n of i){let s=n.sub(t.start()).normalize(),a=this.getTangencyPoint(n,e);dn(a,e);for(let l of a){let c=l.sub(n);if(this.isCW(s,c)&&this.isValid(n,l,[t,e])){let u=gd(t,n).shift(),p=gd(e,l).pop();return[u,new M(n,l),p]}}}}let r=this.getTangencyPoint(t.start(),e);dn(r,e);for(let i of r){let n=i.sub(t.start()).normalize(),s=e.end().sub(i);if(this.isCW(n,s)&&this.isValid(t.start(),i,[t,e])){let l=gd(e,i).pop();return[new M(t.start(),i),l]}}return[new M(t.start(),e.end())]}}isValid(t,e,r){let i=new M(t,e);for(let n of r){let s=Tt(i,n);for(let a=0;a<s;a+=2){let l=new S(Ee[a],Ee[a+1]);if(!l.equals1(t)&&!l.equals1(e))return!1}}return!0}isConvex1(t,e){if(t instanceof M&&e instanceof M)return this.isCW(t.direct,e.end().sub(t.start()).normalize());if(t instanceof M&&e instanceof q){if(e.sweep()==le.CCW)return!1;{let r=this.getTangencyPoint(t.start(),e);for(let i of r)if(!this.isCW(t.direct,i.sub(t.start())))return!1;return this.isCW(t.direct,Ot(e,e.start()))}}else if(t instanceof q&&e instanceof M){if(t.sweep()==le.CCW)return!1;{let r=this.getTangencyPoint(e.end(),t);for(let i of r)if(!this.isCW(e.end().sub(i).normalize(),e.direct))return!1;return this.isCW(Ot(t),e.direct)}}else if(t instanceof q&&e instanceof q)return t.sweep()==le.CW&&e.sweep()==le.CW&&this.isCW(Ot(t),Ot(e,e.start()))}isConvex(t,e){if(t instanceof M&&e instanceof M)return this.isCW(t.direct,e.direct)&&this.isCW(t.direct,e.end().sub(t.start()).normalize());if(t instanceof M&&e instanceof q)return this.isCW(t.direct,Ot(e,e.start()));if(t instanceof q&&e instanceof M)return this.isCW(Ot(t),e.direct);if(t instanceof q&&e instanceof q)return this.isCW(Ot(t),Ot(e,e.start()))}isCW(t,e){return ne.lesseq(t.cross(e),0)}getTangencyPoint(t,e){let r=new Array,i=t.sub(e.center),n=i.length();if(ne.greatereq(e.rx,n))return r;let s=e.rx/n,a=Math.acos(s),l=i.normalize(),c=l.rotate(S.ORIGIN,a),h=l.rotate(S.ORIGIN,-a),u=e.center.add(c.mul(e.rx)),d=e.center.add(h.mul(e.rx));return to(e,u)&&!e.start().equals1(u)&&!e.end().equals1(u)&&r.push(u),to(e,d)&&!e.start().equals1(d)&&!e.end().equals1(d)&&r.push(d),r}getArcsTangencyPoint(t,e){let r=new Array,i=new Array,n=t.rx,s=e.rx,a=t.center.distance1(e.center);if(ne.eq(a,0))return{arc1Tangency:r,arc2Tangency:i};if(ne.eq(n,s)){let d=t.center.sub(e.center).normalize(),p=d.rotate(S.ORIGIN,Math.PI/2),m=d.rotate(S.ORIGIN,-Math.PI/2),g=t.center.add(p.mul(n)),y=t.center.add(m.mul(n)),b=e.center.add(p.mul(s)),P=e.center.add(m.mul(s));if(to(t,g)&&r.push(g),to(t,y)&&r.push(y),to(e,b)&&i.push(b),to(e,P)&&i.push(P),ne.greater(a,n+s)){let T=Math.acos(2*n/a),I=d.rotate(S.ORIGIN,T),C=d.rotate(S.ORIGIN,-T),E=t.center.add(I.mul(n)),O=t.center.add(C.mul(n)),_=e.center.add(I.mul(-s)),R=e.center.add(C.mul(-s));to(t,E)&&r.push(E),to(t,O)&&r.push(O),to(e,_)&&i.push(_),to(e,R)&&i.push(R)}return{arc1Tangency:r,arc2Tangency:i}}let l=a/(s/n-1);if(ne.greatereq(n,l))return{arc1Tangency:r,arc2Tangency:i};let c=n/l,h=Math.acos(c),u=t.center.sub(e.center).normalize();if(this.calculateArcTangencys(u,h,t,r),this.calculateArcTangencys(u,h,e,i),a>n+s){let d=a/(s/n+1),p=n/d,m=Math.acos(p);this.calculateArcTangencys(u.mul(-1),m,t,r),this.calculateArcTangencys(u,m,e,i)}return{arc1Tangency:r,arc2Tangency:i}}calculateArcTangencys(t,e,r,i){let n=t.rotate(S.ORIGIN,e),s=t.rotate(S.ORIGIN,-e),a=r.center.add(n.mul(r.rx)),l=r.center.add(s.mul(r.rx));to(r,a)&&i.push(a),to(r,l)&&i.push(l)}};var Qae=class{getTangency(t,e){switch(new fc(t,e,0).relation){case 1:return[];case 2:return[];case 0:{let i=this.calTangency(t,e,0),n=this.calTangency(t,e,1);return[i,n]}case 3:{let i=this.calTangency(t,e,0),n=this.calTangency(t,e,1),s=this.calTangency(t,e,2),a=this.calTangency(t,e,3);return[i,n,s,a]}}}getTangency1(t,e){switch(new fc(t,e,0).relation){case 1:return null;case 2:return null;case 0:{let i=this.calTangency(t,e,0),n=this.calTangency(t,e,1);return[new M(i.start,i.end),new M(n.start,n.end)]}case 3:{let i=this.calTangency(t,e,0),n=this.calTangency(t,e,1),s=this.calTangency(t,e,2),a=this.calTangency(t,e,3);return[new M(i.start,i.end),new M(n.start,n.end),new M(s.start,s.end),new M(a.start,a.end)]}}}calTangency(t,e,r){let i=t.bbox(),n=e.bbox(),s=i.width()+i.height()+n.width()+n.height(),a=n.center().sub(i.center()).normalize().mul(s),l=new M(i.center().sub(a),n.center().add(a)),[c,h]=this.getStartPoint(t,l,r,!0),[u,d]=this.getStartPoint(e,l,r,!1),p=t.primitives.length,m=e.primitives.length,g=!0,y=p+m,b=0,P=new Set,T=new Set,I=h,C=d;for(;g||b<y;){g=!1;let E=t.primitives[h],O=e.primitives[d],_=this.getPrimitivesEdge(E,O,c,u,r);if(_.leftPoint!=c&&(g=!0,I=h),_.rightPoint!=u&&(g=!0,C=d),c=_.leftPoint,u=_.rightPoint,c.equals1(E.end())&&(h=(h+1)%p,P.add(h)),u.equals1(O.end())&&(d=(d+1)%m,T.add(d)),!g){let R=(h+1)%p;if(!P.has(R))h=R,P.add(h);else{let v=(d+1)%m;T.has(v)||(d=v,T.add(d))}}b++}return{start:c,leftIndex:I,end:u,rightIndex:C}}calTangency4Category(t,e,r,i,n,s,a){let l=t.primitives.length,c=i.primitives.length,h=!0;for(;h;){h=!1;let u=t.primitives[r],d=i.primitives[a],p=this.getPrimitivesEdge(u,d,e,s,n);(p.leftPoint!=e||p.rightPoint!=s)&&(h=!0),e=p.leftPoint,s=p.rightPoint,e.equals1(u.end())&&(r=(r+1)%l),s.equals1(d.end())&&(a=(a+1)%c)}return{start:e,leftIndex:r,end:s,rightIndex:a}}getStartPoint(t,e,r,i){switch(r){case 0:return this.getLeftPoint(t,e);case 1:return this.getRightPoint(t,e);case 2:return i?this.getLeftPoint(t,e):this.getRightPoint(t,e);case 3:return i?this.getRightPoint(t,e):this.getLeftPoint(t,e);default:return null}}getLeftPoint(t,e){let r=new Array,i=new Map,n=e.bbox();for(let l=0;l<t.primitives.length;l++){let c=t.primitives[l];if(c.bbox().isSeparated(n))continue;let h=Tt(c,e);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);r.push(d),i.set(d,l)}}dn(r,e);let s=r[0],a=i.get(s);return[s,a]}getRightPoint(t,e){let r=new Array,i=new Map,n=e.bbox();for(let l=0;l<t.primitives.length;l++){let c=t.primitives[l];if(c.bbox().isSeparated(n))continue;let h=Tt(c,e);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);r.push(d),i.set(d,l)}}dn(r,e);let s=r[r.length-1],a=i.get(s);return[s,a]}getTangencyPoint(t,e){let r=new Array,i=t.sub(e.center),n=i.length();if(ne.greatereq(e.rx,n))return r;let s=e.rx/n,a=Math.acos(s),l=i.normalize(),c=l.rotate(S.ORIGIN,a),h=l.rotate(S.ORIGIN,-a),u=e.center.add(c.mul(e.rx)),d=e.center.add(h.mul(e.rx));return to(e,u)&&r.push(u),to(e,d)&&r.push(d),r}getPrimitivesEdge(t,e,r,i,n){let s=t instanceof M,a=e instanceof M;if(s&&a)for(let l of[t.end()])for(let c of[e.end()]){let h=this.category(n,r,i,l,c);r=h.left,i=h.right}else if(s&&!a)for(let l of[t.end()]){let c=this.getTangencyPoint(l,e);c.push(e.end());for(let h of c){let u=this.category(n,r,i,l,h);r=u.left,i=u.right}}else if(!s&&a)for(let l of[e.end()]){let c=this.getTangencyPoint(l,t);c.push(t.end());for(let h of c){let u=this.category(n,r,i,h,l);r=u.left,i=u.right}}else{let l=t,c=e,h,u;if(l.rx>c.rx){let d=this.getArcsTangencyPoint(c,l);h=d.arc2Tangency,u=d.arc1Tangency}else{let d=this.getArcsTangencyPoint(l,c);h=d.arc1Tangency,u=d.arc2Tangency}h.push(t.end()),u.push(e.end());for(let d of h){let m=[...this.getTangencyPoint(d,c),...u];for(let g of m){let y=this.category(n,r,i,d,g);r=y.left,i=y.right}}}return{leftPoint:r,rightPoint:i}}filterPrimitivePoints(t,e,r){e.push(t),dn(e,r);let i=new Array,n=e.indexOf(t),s=t;i.push(t);for(let a=n+1;a<e.length;a++){let l=e[a];l.equals1(s)||(i.push(l),s=l)}return i}category(t,e,r,i,n){let s=!0;for(;s;)switch(s=!1,t){case 0:{ne.greater(this.getCross(e,r,n),0)&&(r=n,s=!0),ne.less(this.getCross(r,e,i),0)&&(e=i,s=!0);break}case 1:{ne.less(this.getCross(e,r,n),0)&&(r=n,s=!0),ne.greater(this.getCross(r,e,i),0)&&(e=i,s=!0);break}case 2:{ne.less(this.getCross(e,r,n),0)&&(r=n,s=!0),ne.less(this.getCross(r,e,i),0)&&(e=i,s=!0);break}case 3:{ne.greater(this.getCross(e,r,n),0)&&(r=n,s=!0),ne.greater(this.getCross(r,e,i),0)&&(e=i,s=!0);break}default:return{left:e,right:r}}return{left:e,right:r}}getCross(t,e,r){return e.sub(t).cross(r.sub(t))}getArcsTangencyPoint(t,e){let r=new Array,i=new Array,n=t.rx,s=e.rx,a=t.center.distance1(e.center);if(ne.eq(a,0))return{arc1Tangency:r,arc2Tangency:i};if(ne.eq(n,s)){let d=t.center.sub(e.center).normalize(),p=d.rotate(S.ORIGIN,Math.PI/2),m=d.rotate(S.ORIGIN,-Math.PI/2),g=t.center.add(p.mul(n)),y=t.center.add(m.mul(n)),b=e.center.add(p.mul(s)),P=e.center.add(m.mul(s));if(to(t,g)&&r.push(g),to(t,y)&&r.push(y),to(e,b)&&i.push(b),to(e,P)&&i.push(P),ne.greater(a,n+s)){let T=Math.acos(2*n/a),I=d.rotate(S.ORIGIN,T),C=d.rotate(S.ORIGIN,-T),E=t.center.add(I.mul(n)),O=t.center.add(C.mul(n)),_=e.center.add(I.mul(-s)),R=e.center.add(C.mul(-s));to(t,E)&&r.push(E),to(t,O)&&r.push(O),to(e,_)&&i.push(_),to(e,R)&&i.push(R)}return{arc1Tangency:r,arc2Tangency:i}}let l=a/(s/n-1);if(ne.greatereq(n,l))return{arc1Tangency:r,arc2Tangency:i};let c=n/l,h=Math.acos(c),u=t.center.sub(e.center).normalize();if(this.calculateArcTangencys(u,h,t,r),this.calculateArcTangencys(u,h,e,i),a>n+s){let d=a/(s/n+1),p=n/d,m=Math.acos(p);this.calculateArcTangencys(u.mul(-1),m,t,r),this.calculateArcTangencys(u,m,e,i)}return{arc1Tangency:r,arc2Tangency:i}}calculateArcTangencys(t,e,r,i){let n=t.rotate(S.ORIGIN,e),s=t.rotate(S.ORIGIN,-e),a=r.center.add(n.mul(r.rx)),l=r.center.add(s.mul(r.rx));to(r,a)&&i.push(a),to(r,l)&&i.push(l)}};var ele=class{constructor(t){this.preprocessor=t;this.tangencyMap=new Map}calculateTangency(t,e,r,i){this.tangencyMap.clear();let n=new Array,s=this.preprocessor.getPointsInBBox(r);for(let[l,c]of t)for(let h of s){let u=h.point,d=c?new M(l,u):new M(u,l);d.length()<e&&this.isTangencyPts(l,u,h.prevPrimitive,h.nextPrimitive)&&this.preprocessor.canMove(d)&&n.push(d)}for(let[l,c]of t)for(let h of i){let u=this.getTangencyPoint(l,h);for(let d of u){let p=c?new M(l,d):new M(d,l);r.isContains(d)&&p.length()<e&&this.preprocessor.canMove(p)&&(n.push(p),this.tangencyMap.set(d,[h]))}}let a=this.preprocessor.getLinesInBBox(r);for(let l of a)n.push(new M(l.startPoint,l.endPoint)),n.push(new M(l.endPoint,l.startPoint));return n}isTangencyPts(t,e,r,i){let n=e.sub(t).normalize(),s=this.getNextPoint(r,!1).sub(t).normalize(),a=this.getNextPoint(i,!0).sub(t).normalize(),l=n.cross(s),c=n.cross(a);return ne.greatereq(l*c,0)}getNextPoint(t,e){if(t instanceof M)return e?t.end():t.start();if(t instanceof q)if(e){let r=t.start(),i=Ot(t,r);return r.add(i)}else{let r=t.end(),i=Ot(t).mul(-1);return r.add(i)}return new S(0,0)}getTangencyPoint(t,e){let r=new Array,i=t.sub(e.center),n=i.length();if(ne.greatereq(e.rx,n))return r;let s=e.rx/n,a=Math.acos(s),l=i.normalize(),c=l.rotate(S.ORIGIN,a),h=l.rotate(S.ORIGIN,-a),u=e.center.add(c.mul(e.rx)),d=e.center.add(h.mul(e.rx));return to(e,u)&&r.push(u),to(e,d)&&r.push(d),r}};var tle=class{constructor(t,e){this.pls=t;this.isSolids=e;this.tangencyPoints=[];this.lineCache=new Map;this.arcTangencyPointsMap=new Map;this.ccwArcs=[];this.pointToArcLineKeys=new Map;this.pointTree=new nn(7),this.primitiveTree=new nn(7)}getAllPolyline(){return this.pls}getOutline(){let t=this.isSolids.indexOf(!1);return this.pls[t]}preprocess(){this.normalizeToClockwise(),this.extractTangencyPoints(),this.collectCCWArcs(),this.collectArcTangencyPoints(),this.collectArcToArcTangencyPoints(),this.splitArcsByTangencyPoints(),this.tangencyPoints=[],this.extractTangencyPoints(),this.cacheArcTangencyLines(),this.pointTree=new nn(7),this.buildPointTree(),this.primitiveTree=new nn(7),this.buildPrimitiveTree()}normalizeToClockwise(){for(let t=0;t<this.pls.length;t++){let e=this.pls[t];e.area()>0&&(this.pls[t]=e.reverse())}}buildPrimitiveTree(){for(let t=0;t<this.pls.length;t++){let e=this.pls[t];for(let r of e.primitives)this.primitiveTree.add(r)}}findTangencyPoint(t){let e=this.pointTree.search(t.bbox().extendOfSize(1e-6));for(let r of e)if(r.point.equals1(t))return r;return null}getTangencyPointIndex(t){let e=this.findTangencyPoint(t);if(e===null)return-1;for(let r=0;r<this.tangencyPoints.length;r++)if(this.tangencyPoints[r]===e)return r;return-1}getPointsInBBox(t){return this.pointTree.search(t).filter(r=>t.isContains(r.point))}getTangencyPoints(){return this.tangencyPoints}getLinesInBBox(t,e){let r=[],n=this.pointTree.search(t).filter(a=>t.isContains(a.point));for(let a=0;a<n.length;a++)for(let l=a+1;l<n.length;l++){let c=n[a],h=n[l],u=c.point.distance1(h.point);if(e!==void 0&&u>=e)continue;let d=this.getOrComputeLinePair(c,h,u);r.push(...d)}let s=this.getArcTangencyLinesFromCache(t,e);return r.push(...s),r}getOrComputeLinePair(t,e,r){let i=[];if(this.isValidTangencyLineForDirection(t,e.point)){let n=this.getLineKey(t.point,e.point),s=this.lineCache.get(n);if(s===void 0){let a=new M(t.point,e.point);this.canMove(a)?s={startIndex:this.getTangencyPointIndex(t.point),endIndex:this.getTangencyPointIndex(e.point),length:r,startPoint:t.point,endPoint:e.point,bbox:()=>a.bbox()}:s=null,this.lineCache.set(n,s)}s!==null&&i.push(s)}if(this.isValidTangencyLineForDirection(e,t.point)){let n=this.getLineKey(e.point,t.point),s=this.lineCache.get(n);if(s===void 0){let a=new M(t.point,e.point);this.canMove(a)?s={startIndex:this.getTangencyPointIndex(e.point),endIndex:this.getTangencyPointIndex(t.point),length:r,startPoint:e.point,endPoint:t.point,bbox:()=>a.bbox()}:s=null,this.lineCache.set(n,s)}s!==null&&i.push(s)}return i}getArcTangencyLinesFromCache(t,e){let r=[],n=this.pointTree.search(t).filter(s=>t.isContains(s.point));for(let s of n){let a=this.getTangencyPointIndex(s.point);if(a===-1)continue;let l=this.pointToArcLineKeys.get(a)||[];for(let c of l){let h=this.lineCache.get(c);if(h!=null){if(!t.isContains(h.endPoint)||e!==void 0&&h.length>=e)continue;r.push(h)}}}return r}getLineKey(t,e){return`${t.x},${t.y}-${e.x},${e.y}`}getPrimitiveTree(){return this.primitiveTree}getObstacles(){return this.pls}getIsSolids(){return this.isSolids}extractTangencyPoints(){for(let t=0;t<this.pls.length;t++){let e=this.pls[t],r=this.isSolids[t],i=e.primitives.length;for(let n=0;n<i;n++){let s=e.primitives[(n-1+i)%i],a=e.primitives[n],l=a.start();if(this.isConvexPoint(s,a,r)){let h={point:l,obstacleIndex:t,primitiveIndex:n,prevPrimitive:s,nextPrimitive:a,type:r?1:0,bbox:()=>l.bbox().extendOfSize(1e-6)};this.tangencyPoints.push(h)}}}}buildPointTree(){for(let t of this.tangencyPoints)this.pointTree.add(t)}isValidTangencyLineForDirection(t,e){let r=e.sub(t.point).normalize(),i=this.getNextPoint(t.prevPrimitive,!1).sub(t.point).normalize(),n=this.getNextPoint(t.nextPrimitive,!0).sub(t.point).normalize(),s=r.cross(i),a=r.cross(n);return ne.greatereq(s*a,0)}isConvexPoint(t,e,r){let i=this.getOutDirect(t),n=this.getOutDirect(e),s=i.cross(n);return r?ne.lesseq(s,0):ne.greatereq(s,0)}getOutDirect(t){return t instanceof M?t.direct:t instanceof q?Ot(t):new S(0,0)}getNextPoint(t,e){if(t instanceof M)return e?t.end():t.start();if(t instanceof q)if(e){let r=t.start(),i=Ot(t,r);return r.add(i)}else{let r=t.end(),i=Ot(t).mul(-1);return r.add(i)}return new S(0,0)}canMove(t){let e=t.bbox(),r=t.midPoint;for(let n=0,s=this.pls.length;n<s;n++){let a=this.pls[n];if(!a.bbox().isSeparated(e)&&this.isSolids[n]&&Jr.inPolyline(r,a))return!1}let i=this.primitiveTree.search(e);for(let n of i){let s=Tt(t,n);for(let a=0;a<s;a+=2){let l=new S(Ee[a],Ee[a+1]);if(!l.equals1(t.start())&&!l.equals1(t.end()))return!1}}return!0}collectCCWArcs(){for(let t=0;t<this.pls.length;t++){let e=this.pls[t],r=this.isSolids[t];for(let i of e.primitives)i instanceof q&&(r?!i.isCCW:i.isCCW)&&this.ccwArcs.push({arc:i,obstacleIndex:t})}}collectArcTangencyPoints(){for(let t=0;t<this.tangencyPoints.length;t++){let e=this.tangencyPoints[t];for(let{arc:r,obstacleIndex:i}of this.ccwArcs){if(e.obstacleIndex===i)continue;let n=this.computeArcTangency(e.point,r);for(let s of n){let a=new M(e.point,s);if(!this.canMove(a)||!this.isValidTangencyLineForDirection(e,s))continue;let l=this.arcTangencyPointsMap.get(r)||[];l.push(s),this.arcTangencyPointsMap.set(r,l)}}}}cacheArcTangencyLines(){for(let t=0;t<this.tangencyPoints.length;t++){let e=this.tangencyPoints[t];for(let{arc:r,obstacleIndex:i}of this.ccwArcs){if(e.obstacleIndex===i)continue;let n=this.computeArcTangency(e.point,r);for(let s of n){let a=new M(e.point,s);if(!this.canMove(a)||!this.isValidTangencyLineForDirection(e,s))continue;let l=this.getTangencyPointIndexSlow(s);if(l===-1)continue;let c=this.getLineKey(e.point,s),h=e.point.distance1(s);this.lineCache.set(c,{startIndex:t,endIndex:l,length:h,startPoint:e.point,endPoint:s,bbox:()=>a.bbox()});let u=this.pointToArcLineKeys.get(t)||[];u.push(c),this.pointToArcLineKeys.set(t,u)}}}}getTangencyPointIndexSlow(t){for(let e=0;e<this.tangencyPoints.length;e++)if(this.tangencyPoints[e].point.equals1(t))return e;return-1}splitArcsByTangencyPoints(){for(let t=0;t<this.pls.length;t++){let e=this.pls[t],r=[];for(let i of e.primitives)if(i instanceof q){let n=this.arcTangencyPointsMap.get(i);if(n&&n.length>0){dn(n,i);let s=this.removeDuplicatePoints(n),a=nD(i,s);r.push(...a)}else r.push(i)}else r.push(i);this.pls[t]=fe.build2(r)}}removeDuplicatePoints(t){if(t.length<=1)return t;let e=[],r=t[0];e.push(r);for(let i=1;i<t.length;i++){let n=t[i];n.equals1(r)||(e.push(n),r=n)}return e}computeArcTangency(t,e){let r=[],i=t.sub(e.center),n=i.length();if(ne.greatereq(e.rx,n))return r;let s=e.rx/n,a=Math.acos(s),l=i.normalize(),c=l.rotate(S.ORIGIN,a),h=l.rotate(S.ORIGIN,-a),u=e.center.add(c.mul(e.rx)),d=e.center.add(h.mul(e.rx));return to(e,u)&&r.push(u),to(e,d)&&r.push(d),r}addArcTangencyPoint(t,e){let r=this.arcTangencyPointsMap.get(t)||[];for(let i of r)if(i.equals1(e))return;r.push(e),this.arcTangencyPointsMap.set(t,r)}calculateArcsTangencyPoints(t,e){if(t.rx>e.rx){let d=this.calculateArcsTangencyPoints(e,t);return{arc1Tangency:d.arc2Tangency,arc2Tangency:d.arc1Tangency}}let r=new Array,i=new Array,n=t.rx,s=e.rx,a=t.center.distance1(e.center);if(ne.eq(a,0))return{arc1Tangency:r,arc2Tangency:i};if(ne.eq(n,s)){let d=t.center.sub(e.center).normalize(),p=d.rotate(S.ORIGIN,Math.PI/2),m=d.rotate(S.ORIGIN,-Math.PI/2),g=t.center.add(p.mul(n)),y=t.center.add(m.mul(n)),b=e.center.add(p.mul(s)),P=e.center.add(m.mul(s));if(to(t,g)&&r.push(g),to(t,y)&&r.push(y),to(e,b)&&i.push(b),to(e,P)&&i.push(P),ne.greater(a,n+s)){let T=Math.acos(2*n/a),I=d.rotate(S.ORIGIN,T),C=d.rotate(S.ORIGIN,-T),E=t.center.add(I.mul(n)),O=t.center.add(C.mul(n)),_=e.center.add(I.mul(-s)),R=e.center.add(C.mul(-s));to(t,E)&&r.push(E),to(t,O)&&r.push(O),to(e,_)&&i.push(_),to(e,R)&&i.push(R)}return{arc1Tangency:r,arc2Tangency:i}}let l=a/(s/n-1);if(ne.greatereq(n,l))return{arc1Tangency:r,arc2Tangency:i};let c=n/l,h=Math.acos(c),u=t.center.sub(e.center).normalize();if(this.calculateArcTangencys(u,h,t,r),this.calculateArcTangencys(u,h,e,i),a>n+s){let d=a/(s/n+1),p=n/d,m=Math.acos(p);this.calculateArcTangencys(u.mul(-1),m,t,r),this.calculateArcTangencys(u,m,e,i)}return{arc1Tangency:r,arc2Tangency:i}}calculateArcTangencys(t,e,r,i){let n=t.rotate(S.ORIGIN,e),s=t.rotate(S.ORIGIN,-e),a=r.center.add(n.mul(r.rx)),l=r.center.add(s.mul(r.rx));to(r,a)&&i.push(a),to(r,l)&&i.push(l)}collectArcToArcTangencyPoints(){for(let t=0;t<this.ccwArcs.length;t++){let r=this.ccwArcs[t].arc;for(let i=t+1;i<this.ccwArcs.length;i++){let s=this.ccwArcs[i].arc,a=this.calculateArcsTangencyPoints(r,s),l=new Set;for(let c=0;c<a.arc1Tangency.length;c++){let h=a.arc1Tangency[c];for(let u=0;u<a.arc2Tangency.length;u++){let d=a.arc2Tangency[u],p=new M(h,d);this.canMove(p)&&(l.has(h)||(this.addArcTangencyPoint(r,h),l.add(h)),l.has(d)||(this.addArcTangencyPoint(s,d),l.add(d)))}}}}}};var oze={1:"PREPROCESS",2:"PROJECT_STARTEND",4:"PROJECT_OBSTACLES",8:"SIMPLIFY",16:"TANGENCY",32:"GRAPH_BUILD",64:"DIJKSTRA"},sze={enabled:!1,stages:127,logEnabled:!0,visualEnabled:!0,timingEnabled:!0,validationEnabled:!0,throwOnValidationError:!1,skippedEdgeEnabled:!0},pq=class extends Error{constructor(e){super(`Graph validation failed with ${e.length} error(s)`);this.validationErrors=e;this.name="GraphValidationError"}};var rle=class{validate(t,e,r,i,n,s){let a=[],l=[],c=new Map,h=0;for(let d of t){let p=this.nodeKey(d.x,d.y);c.set(p,{inCount:0,outCount:d.edges.length}),h+=d.edges.length}this.checkEdgeIntegrity(t,i,a,c),this.checkBidirectionality(t,a),this.checkIndexConsistency(e,r,a),this.checkNonNegativeWeights(t,a),this.checkIsolatedNodes(c,n,s,l),this.checkGeometryConsistency(t,l);let u=0;return c.forEach(d=>{d.inCount===0&&d.outCount===0&&u++}),{valid:a.length===0,errors:a,warnings:l,stats:{nodeCount:t.length,edgeCount:h,isolatedNodes:u}}}nodeKey(t,e){return`${t.toFixed(6)},${e.toFixed(6)}`}checkEdgeIntegrity(t,e,r,i){for(let s of t)for(let a of s.edges){let l=a.end,c=this.nodeKey(l.x,l.y),h=new ut(l.x-1e-4,l.x+1e-4,l.y-1e-4,l.y+1e-4);if(!e.search(h).some(d=>Math.abs(d.x-l.x)<1e-4&&Math.abs(d.y-l.y)<1e-4))r.push({type:"EDGE_MISSING_END",message:"\u8FB9\u7EC8\u70B9\u8282\u70B9\u4E0D\u5B58\u5728",location:{point:{x:l.x,y:l.y},edge:{start:{x:s.x,y:s.y},end:{x:l.x,y:l.y},len:a.len}}});else{let d=i.get(c);d&&d.inCount++}}}checkBidirectionality(t,e){let i=new Map;for(let n of t)i.set(this.nodeKey(n.x,n.y),n);for(let n of t)for(let s of n.edges){let a=s.end,l=this.nodeKey(a.x,a.y),c=!1,h=i.get(l);if(h){for(let u of h.edges)if(Math.abs(u.end.x-n.x)<1e-4&&Math.abs(u.end.y-n.y)<1e-4){c=!0;break}}if(!c){let u={endNodeExists:h!==void 0,endNodeEdgeCount:h==null?void 0:h.edges.length,endNodeOutgoingEdges:h==null?void 0:h.edges.slice(0,5).map(d=>({to:{x:d.end.x,y:d.end.y},len:d.len}))};e.push({type:"EDGE_MISSING_REVERSE",message:"\u65E0\u5411\u56FE\u7F3A\u5C11\u53CD\u5411\u8FB9",location:{edge:{start:{x:n.x,y:n.y},end:{x:a.x,y:a.y},len:s.len}},diagnosis:u})}}}checkIndexConsistency(t,e,r){e.forEach((n,s)=>{let a=new ut(s.x-1e-4,s.x+1e-4,s.y-1e-4,s.y+1e-4);t.search(a).some(c=>c.equals(s,5))||r.push({type:"INDEX_INCONSISTENT",message:"pointMap \u4E2D\u7684\u70B9\u4E0D\u5728 pointTree \u4E2D",location:{point:{x:s.x,y:s.y}}})})}checkNonNegativeWeights(t,e){for(let r of t)for(let i of r.edges)i.len<-1e-6&&e.push({type:"NEGATIVE_WEIGHT",message:`\u8FB9\u6743\u91CD\u4E3A\u8D1F: ${i.len}`,location:{edge:{start:{x:r.x,y:r.y},end:{x:i.end.x,y:i.end.y},len:i.len}}})}checkIsolatedNodes(t,e,r,i){let n=new Set;for(let s of e)n.add(this.nodeKey(s.x,s.y));for(let s of r)n.add(this.nodeKey(s.x,s.y));t.forEach((s,a)=>{if(!n.has(a)&&s.inCount===0&&s.outCount===0){let[l,c]=a.split(",").map(parseFloat);i.push({type:"ISOLATED_NODE",message:"\u53D1\u73B0\u5B64\u7ACB\u8282\u70B9",location:{point:{x:l,y:c}}})}})}checkGeometryConsistency(t,e){for(let r of t)for(let i of r.edges){if(!(i.pt instanceof M))continue;let n=i.end.x-r.x,s=i.end.y-r.y,a=Math.sqrt(n*n+s*s),l=Math.abs(a-i.len),c=Math.max(i.len*.01,1e-4);l>c&&e.push({type:"GEOMETRY_MISMATCH",message:"\u8FB9\u51E0\u4F55\u957F\u5EA6\u4E0D\u4E00\u81F4",location:{point:{x:r.x,y:r.y}}})}}};var FEe=class{send(t){var i;let e=(i=oze[t.stage])!=null?i:"UNKNOWN",r=(t.timestamp/1e3).toFixed(3);switch(t.type){case"validation":this.logValidation(t.payload,e,r);break;case"stats":console.log(`[${r}][${e}] Stats:`,t.payload);break;case"skipped_edge":this.logSkippedEdge(t.payload,e,r);break;case"visual":break;default:console.log(`[${r}][${e}]`,t.payload)}}logValidation(t,e,r){console.group(`[${r}][${e}] \u{1F50D} Creepage \u56FE\u9A8C\u8BC1`),t.valid?console.log("\u2705 \u9A8C\u8BC1\u901A\u8FC7",t.stats):(console.error("\u274C \u9A8C\u8BC1\u5931\u8D25"),this.logErrorsWithDiagnosis(t.errors),t.warnings.length>0&&(console.warn("\u26A0\uFE0F \u8B66\u544A"),console.table(t.warnings))),console.groupEnd()}logErrorsWithDiagnosis(t){var e,r;for(let i of t){if(console.group(`${this.getErrorIcon(i.type)} ${i.type}: ${i.message}`),(e=i.location)!=null&&e.edge){let n=i.location.edge;console.log(`\u4F4D\u7F6E: (${n.start.x.toFixed(2)}, ${n.start.y.toFixed(2)}) \u2192 (${n.end.x.toFixed(2)}, ${n.end.y.toFixed(2)}), len=${n.len.toFixed(2)}`)}if(i.diagnosis&&(console.log("\u8BCA\u65AD\u4FE1\u606F:"),console.log(`  \u7EC8\u70B9\u8282\u70B9\u5B58\u5728: ${i.diagnosis.endNodeExists?"\u2713":"\u2717"}`),i.diagnosis.endNodeExists&&(console.log(`  \u7EC8\u70B9\u8282\u70B9\u8FB9\u6570: ${i.diagnosis.endNodeEdgeCount}`),(r=i.diagnosis.endNodeOutgoingEdges)!=null&&r.length))){console.log("  \u7EC8\u70B9\u8282\u70B9\u51FA\u8FB9:");for(let n of i.diagnosis.endNodeOutgoingEdges)console.log(`    \u2192 (${n.to.x.toFixed(2)}, ${n.to.y.toFixed(2)}), len=${n.len.toFixed(2)}`)}console.groupEnd()}}getErrorIcon(t){switch(t){case"EDGE_MISSING_END":return"\u{1F517}";case"EDGE_MISSING_REVERSE":return"\u2194\uFE0F";case"INDEX_INCONSISTENT":return"\u{1F5C3}\uFE0F";case"NEGATIVE_WEIGHT":return"\u2696\uFE0F";default:return"\u274C"}}logSkippedEdge(t,e,r){console.warn(`[${r}][${e}] \u26A0\uFE0F \u8FB9\u88AB\u8DF3\u8FC7: ${t.reason}`);let i=t.primitive;console.log(`  \u56FE\u5143: (${i.start.x.toFixed(2)}, ${i.start.y.toFixed(2)}) \u2192 (${i.end.x.toFixed(2)}, ${i.end.y.toFixed(2)}), len=${i.len.toFixed(2)}`),t.startNode&&console.log(`  \u8D77\u70B9: (${t.startNode.x.toFixed(2)}, ${t.startNode.y.toFixed(2)})`),t.endNode&&console.log(`  \u7EC8\u70B9: (${t.endNode.x.toFixed(2)}, ${t.endNode.y.toFixed(2)})`)}};var fq=class{send(t){}},XD=class XD{constructor(t){this.stageTimers=new Map;this.bridgeExplicitlySet=!1;this.config={...sze},this.messageBridge=t!=null?t:new fq,this.validator=new rle}static getInstance(){return XD.instance||(XD.instance=new XD),XD.instance}static setInstance(t){XD.instance=t}configure(t){this.config={...this.config,...t},this.config.enabled?!this.bridgeExplicitlySet&&this.messageBridge instanceof fq&&(this.messageBridge=new FEe):this.messageBridge=new fq}setMessageBridge(t){this.messageBridge=t,this.bridgeExplicitlySet=!0}getConfig(){return this.config}isEnabled(){return this.config.enabled}isStageEnabled(t){return this.config.enabled&&(this.config.stages&t)!==0}isSkippedEdgeEnabled(){return this.config.enabled&&this.config.skippedEdgeEnabled}logSkippedEdge(t,e,r,i){if(!this.config.enabled||!this.config.skippedEdgeEnabled||!this.isStageEnabled(t))return;let n=e.start(),s=e.end();this.send("skipped_edge",t,{reason:r,primitive:{start:{x:n.x,y:n.y},end:{x:s.x,y:s.y},len:n.distance1(s)},...i})}startTimer(t,e){!this.config.enabled||!this.config.timingEnabled||this.isStageEnabled(t)&&(this.stageTimers.set(t,performance.now()),this.log(t,`\u5F00\u59CB${e!=null?e:""}`))}endTimer(t,e){if(!this.config.enabled||!this.config.timingEnabled||!this.isStageEnabled(t))return 0;let r=this.stageTimers.get(t);if(r!==void 0){let i=performance.now()-r;return this.logStats(t,{[`${e!=null?e:"duration"}(ms)`]:i.toFixed(2)}),this.stageTimers.delete(t),i}return 0}log(t,e){!this.config.enabled||!this.config.logEnabled||this.isStageEnabled(t)&&this.send("log",t,e)}logStats(t,e){!this.config.enabled||!this.config.logEnabled||this.isStageEnabled(t)&&this.send("stats",t,e)}validateGraphFromMap(t,e,r,i,n,s){if(!this.config.enabled||!this.config.validationEnabled)return{valid:!0,errors:[],warnings:[],stats:{nodeCount:0,edgeCount:0,isolatedNodes:0}};let a=[],l=t.entries();for(;l.hasNext();){let c=l.next();a.push({x:c.key.x,y:c.key.y,edges:c.value})}return this.validateGraph(a,e,r,i,n,s)}validateGraph(t,e,r,i,n,s){if(!this.config.enabled||!this.config.validationEnabled)return{valid:!0,errors:[],warnings:[],stats:{nodeCount:0,edgeCount:0,isolatedNodes:0}};let a=this.validator.validate(t,e,r,i,n,s);if(this.isStageEnabled(32)&&(this.send("stats",32,{nodes:a.stats.nodeCount,edges:a.stats.edgeCount,isolatedNodes:a.stats.isolatedNodes}),this.send("validation",32,a)),!a.valid&&this.config.throwOnValidationError)throw new pq(a.errors);return a}logValidation(t){if(this.config.enabled&&(this.send("validation",32,t),!t.valid&&this.config.throwOnValidationError))throw new pq(t.errors)}visualPoints(t,e,r){if(!this.config.enabled||!this.config.visualEnabled||!this.isStageEnabled(t))return;let i={tag:e,points:r.map(n=>[n.x,n.y])};this.send("visual",t,i)}visualLines(t,e,r){if(!this.config.enabled||!this.config.visualEnabled||!this.isStageEnabled(t))return;let i={tag:e,lines:r.map(n=>({x1:n.start().x,y1:n.start().y,x2:n.end().x,y2:n.end().y}))};this.send("visual",t,i)}visualArcs(t,e,r){if(!this.config.enabled||!this.config.visualEnabled||!this.isStageEnabled(t))return;let i={tag:e,arcs:r.map(n=>({cx:n.center.x,cy:n.center.y,r:n.rx,startAngle:n.startAngle,endAngle:n.startAngle+n.sweepAngle}))};this.send("visual",t,i)}visualPrimitives(t,e,r){if(!this.config.enabled||!this.config.visualEnabled||!this.isStageEnabled(t))return;let i=[],n=[];for(let a of r)a instanceof M?i.push({x1:a.start().x,y1:a.start().y,x2:a.end().x,y2:a.end().y}):a instanceof q&&n.push({cx:a.center.x,cy:a.center.y,r:a.rx,startAngle:a.startAngle,endAngle:a.startAngle+a.sweepAngle});let s={tag:e,lines:i,arcs:n};this.send("visual",t,s)}visualPolyline(t,e,r){this.visualPrimitives(t,e,r.primitives)}visualBBox(t,e,r){if(!this.config.enabled||!this.config.visualEnabled||!this.isStageEnabled(t))return;let i={tag:e,bboxes:[{minX:r.minX,minY:r.minY,maxX:r.maxX,maxY:r.maxY}]};this.send("visual",t,i)}visualPath(t,e,r){this.visualPrimitives(t,e,r)}stageStart(t,e){this.startTimer(t,e)}stageEnd(t,e){this.endTimer(t,e)}clear(){this.stageTimers.clear()}send(t,e,r){let i={type:t,stage:e,payload:r,timestamp:performance.now()};this.messageBridge.send(i)}};XD.instance=null;var VEe=XD,Gu=VEe.getInstance();var mq=class extends S{constructor(t){super(t.x,t.y),this.point=t}bbox(){return super.bbox().extendOfSize(1e-4)}},ile=class o{constructor(t,e,r,i=!1){this.cost=0;this.mark=!1;this.start=t,this.end=e,this.pt=r,this.len=r.length(),this.isReverse=i}reverse(){return new o(this.end,this.start,this.pt,!this.isReverse)}},aze=(o,t)=>o.cost-t.cost,nle=class{constructor(t){this.obstacleTree=new nn(7);this.edgeMapSource=new Map;this.simplifyMap=new Map;this.solidMap=new Map;this.newMapOld=new Map;this.simplifyMapnewEdge=new Map;this.changedOldPrimitives=new Set;this.originMapSplit=new Map;this.obstaclesTangencys=new Map;this.pointTree=new lP(5);this.pointMap=new Map;this.queue=new p3(aze);this.nodeMap=new nn(5);this.graph=new Bd;let e=t.items,r=t.getOutMostPolyline(),i=e.map(n=>n!=r);this.preprocessor=new tle(e,i),this.preprocessor.preprocess(),r=this.preprocessor.getOutline();for(let n of this.preprocessor.getAllPolyline()){for(let s of n.primitives)this.obstacleTree.add(s),this.edgeMapSource.set(s,n);n==r?this.solidMap.set(n,!1):this.solidMap.set(n,!0)}}getPrimitiveTree(t){let e=new nn(7);for(let r of t)for(let i of r.primitives)e.add(i);return e}creepageDistance(t,e,r){Gu.stageStart(1,"creepageDistance"),t.area()>0&&(t=t.reverse()),e.area()>0&&(e=e.reverse()),this.pointTree=new lP(5),this.pointMap=new Map,this.queue=new p3(aze),this.nodeMap=new nn(5),this.graph=new Bd,Gu.visualPolyline(1,"start_polyline",t),Gu.visualPolyline(1,"end_polyline",e),Gu.logStats(1,{clearance:r});let i=t.bbox().extendOfSize(r).intersect(e.bbox().extendOfSize(r));if(i==null)return Gu.log(1,"interBBox \u4E3A\u7A7A\uFF0C\u63D0\u524D\u8FD4\u56DE"),null;Gu.visualBBox(1,"interBBox",i),Gu.stageEnd(1);let{obstaclesEdges:n,obstacles:s,isSolid:a}=this.search(i);Gu.logStats(1,{obstaclesEdges:n.length,obstacles:s.length});let l=[this.getPrimitiveTree([t,e]),this.obstacleTree];Gu.stageStart(2);let c=this.projectStartEnd(t,e,l,r,i);c!=null&&(this.addMap(c),Gu.visualLines(2,"minLine",[c]),r=c.length(),i=t.bbox().extendOfSize(r).intersect(e.bbox().extendOfSize(r)),n=this.search(i).obstaclesEdges),Gu.stageEnd(2),Gu.stageStart(4);let h=this.project(t,n,l,r,i),u=this.project(e,n,l,r,i);c!=null&&(u.push(c.end()),h.push(c.start())),h=this.removeRepeat(h),u=this.removeRepeat(u),Gu.visualPoints(4,"project_starts",h),Gu.visualPoints(4,"project_ends",u),Gu.logStats(4,{startPoints:h.length,endPoints:u.length}),Gu.stageEnd(4),Gu.stageStart(8),s.map(y=>this.getSimplify(y)),Gu.stageEnd(8),Gu.stageStart(16);let d=s.filter(y=>this.solidMap.get(y));for(let y=0,b=d.length;y<b;y++){for(let T=y+1;T<b;T++){let I=this.getSimplifysTangency(d[y],d[T]);for(let C of I)i.isContainsBBox(C.bbox())&&(this.addMap(C),this.addMap(C.reverse()))}let P=this.simplifyMapnewEdge.get(this.simplifyMap.get(d[y]));if(P!=null)for(let T of P)i.isContainsBBox(T.bbox())&&this.addMap(T)}Gu.stageEnd(16);let p=this.splitOld(s),m=new Map;for(let y of h)m.set(y,!0);for(let y of u)m.set(y,!1);m.size>0&&this.checkPoint(m,p,a,r,i,l);for(let y of p)for(let b of y.primitives)i.isContainsBBox(b.bbox())&&this.addMap(b);Gu.stageStart(32);for(let[y]of this.pointMap)this.nodeMap.add(new mq(y));for(let y of h)this.nodeMap.add(new mq(y));for(let y of u)this.nodeMap.add(new mq(y));for(let[y,b]of this.pointMap){let P=this.getNode(y);if(P!=null)for(let T of b){let I=T.end(),C=this.getNode(I);if(C==null){Gu.logSkippedEdge(32,T,"END_NODE_NOT_FOUND",{startNode:y,endNode:I});continue}let E=new ile(P,C,T),O=new ile(C,P,T,!0);this.graph.computeIfAbsent(P,_=>new Array).push(E),this.graph.computeIfAbsent(C,_=>new Array).push(O)}}Gu.validateGraphFromMap(this.graph,this.pointTree,this.pointMap,this.nodeMap,h,u),Gu.stageEnd(32),Gu.stageStart(64);let g=this.find(h,u,r);return Gu.stageEnd(64),g}getAll(){let t=new Array;for(let[e,r]of this.pointMap)for(let i of r)t.push(i);return t}find(t,e,r){let i=new Array;for(let a of t){let l=this.graph.get(this.getNode(a));l!=null&&Re.addAll(i,l)}let n=new Set;for(let a of i)a.cost=a.len,this.queue.add(a),n.add(a);let s=0;for(;this.queue.size()>0;){let a=this.queue.poll();if(a.mark=!0,s++,this.isEnd(a.end,e)){let c=this.connect(a);return Gu.visualPath(64,"result_path",c),Gu.logStats(64,{iterations:s,pathLength:a.cost,pathSegments:c.length,found:"true"}),a}let l=this.findNeighbor(a);for(let c of l){let h=a.cost+c.len;(c.cost==0||h<c.cost)&&(c.cost=h,c.prev=a),n.has(c)&&this.queue.remove(c),ne.lesseq(c.cost,r)&&this.queue.add(c),n.add(c)}}return Gu.logStats(64,{iterations:s,found:"false"}),null}isEnd(t,e){for(let r of e)if(r.equals1(t))return!0;return!1}connect(t){let e=new Array;for(;t!=null;)t.isReverse?e.push(t.pt.reverse()):e.push(t.pt),t=t.prev;return e.reverse()}getNode(t){let e=this.nodeMap.search(t.bbox().extendOfSize(1e-4));for(let r of e)if(r.equals(t,5))return r;return null}search(t){let e=new Array,r=new Set;if(t==null)return{obstaclesEdges:e,obstacles:[],isSolid:[]};let i=this.obstacleTree.search(t);for(let a of i)e.push(a),r.add(this.edgeMapSource.get(a));let n=Array.from(r),s=n.map(a=>this.solidMap.get(a));return{obstaclesEdges:e,obstacles:n,isSolid:s}}project(t,e,r,i,n){return new JV(t,e,r,i,n).points}projectStartEnd(t,e,r,i,n){let s=new JV(t,e.primitives,r,i,n,!0),a=this.filterTangency(s.result),l=Number.MAX_SAFE_INTEGER,c;for(let d of a){let p=d.length();p<l&&(l=p,c=d)}i>l&&(i=l);let h=new JV(e,t.primitives,r,i,n,!0),u=this.filterTangency(h.result);for(let d of u){let p=d.length();p<l&&(l=p,c=d.reverse())}return c}getSimplify(t){let e=this.simplifyMap.get(t);if(e==null){let r=new Jae,i=r.simplifyOnePolygon(t);for(let[a,l]of r.newMapOld)this.newMapOld.set(a,l),this.changedOldPrimitives.add(l);let n=new Array;for(let a of i)r.newMapOld.has(a)||n.push(a);e=fe.build2(i),this.simplifyMap.set(t,e);let s=this.filterTangency(n);this.simplifyMapnewEdge.set(e,s)}return e}getCacheSimplifysTangency(t,e){let r=this.obstaclesTangencys.get(t);if(r!=null)return r.get(e);{let i=this.obstaclesTangencys.get(e);return i!=null?i.get(t):null}}setCacheSimplifysTangency(t,e,r){let i=this.obstaclesTangencys.get(t);i==null&&(i=new Map,this.obstaclesTangencys.set(t,i)),i.set(e,r)}getSimplifysTangency(t,e){let r=this.getCacheSimplifysTangency(t,e);if(r!=null)return r;let i=this.getSimplify(t),n=this.getSimplify(e),a=new Qae().getTangency(i,n),l=this.dealTangency(a,i,n);this.simplifyMap.set(t,l.left),this.simplifyMap.set(e,l.right);let c=this.simplifyMapnewEdge.get(i),h=this.simplifyMapnewEdge.get(n);this.simplifyMapnewEdge.set(l.left,c),this.simplifyMapnewEdge.set(l.right,h);let u=this.filterTangency(this.getLine(a));return this.setCacheSimplifysTangency(t,e,u),u}filterTangency(t,e=r=>this.obstacleTree.search(r)){let r=new Array;e:for(let i of t){let n=i.bbox(),s=e(n);for(let a of s){let l=Tt(i,a);for(let c=0;c<l;c+=2){let h=new S(Ee[c],Ee[c+1]);if(!h.equals1(i.start())&&!h.equals1(i.end()))continue e}}r.push(i)}return r}getLine(t){let e=[];for(let r of t)e.push(new M(r.start,r.end));return e}dealTangency(t,e,r){let i=new Map,n=new Map;for(let s of t)this.add2Map(s.leftIndex,s.start,i),this.add2Map(s.rightIndex,s.end,n);return e=this.splitPolyline(i,e),r=this.splitPolyline(n,r),{left:e,right:r}}splitPolyline(t,e){let r=new Map;for(let[n,s]of t){let a=e.primitives[n];dn(s,a);let l=nD(a,s);this.replaceMap(a,l),r.set(n,l)}let i=new Array;for(let n=0,s=e.primitives.length;n<s;n++){let a=r.get(n);a!=null?i.push(...a):i.push(e.primitives[n])}return fe.build2(i)}replaceMap(t,e){let r=this.newMapOld.get(t);if(r!=null){this.newMapOld.delete(t),this.changedOldPrimitives.add(r);for(let i of e)this.newMapOld.set(i,r)}}add2Map(t,e,r){let i=r.get(t);i==null&&(i=[],r.set(t,i)),i.push(e)}isCollide(t,e){let r=t.bbox(),i=e.search(r);for(let n of i)if(Tt(t,n)>0)return!0;return!1}splitOld(t){if(this.changedOldPrimitives.size===0){let i=[],n=!0;for(let s of t){let a=this.originMapSplit.get(s);if(a!=null)i.push(a);else{n=!1;break}}if(n)return i}let e=new Map;for(let[i,n]of this.newMapOld){let s=i.start(),a=i.end();for(let l of[s,a])if(!l.equals1(n.start())&&!l.equals1(n.end())){let c=e.get(n);c==null&&(c=[],e.set(n,c)),c.push(l)}}let r=new Array;for(let i of t){let n=new Array;for(let a of i.primitives){let l=e.get(a);if(l==null)n.push(a);else{dn(l,a),l=this.removeRepeat(l);let c=nD(a,l);n.push(...c)}}let s=fe.build2(n);this.originMapSplit.set(i,s),r.push(s)}return this.changedOldPrimitives.clear(),r}removeRepeat(t){let e=new Array,r=new nn(7);for(let n of t)r.add(n);let i=new Set;for(let n of t){if(i.has(n))continue;let s=r.search(n.bbox().extendOfSize(1e-6));for(let a of s)i.add(a);e.push(n)}return e}getConvexArcs(t,e,r){let i=new Array;for(let n=0;n<t.length;n++){let s=t[n],a=e[n];for(let l of s.primitives)l instanceof q&&(a?!l.isCCW:l.isCCW)&&!r.isSeparated(l.bbox())&&i.push(l)}return i}checkPoint(t,e,r,i,n,s){let a=new ele(this.preprocessor),l=a.calculateTangency(t,i,n,this.getConvexArcs(e,r,n));l=this.filterTangency(l,h=>{let u=new Array;for(let d of s)Re.addAll(u,d.search(h));return u});let c=new Map;for(let h of l)if(n.isContainsBBox(h.bbox())){this.addMap(h);let u=h.start(),d=h.end(),p=[];t.has(u)||p.push(u),t.has(d)||p.push(d);for(let m of p){let g=a.tangencyMap.get(m);if(g!=null){for(let y of g)if(!y.start().equals1(m)&&!y.end().equals1(m)){let b=c.get(y);b==null&&(b=[],c.set(y,b)),b.push(m)}}}}if(c.size>0)for(let h=0,u=e.length;h<u;h++){let d=e[h],p=new Array;for(let g of d.primitives){let y=c.get(g);if(y==null)p.push(g);else{dn(y,g);let b=nD(g,y);p.push(...b)}}let m=fe.build2(p);e[h]=m}}addMap(t){let e=this.getPoint(t.start());e==null&&(e=t.start(),this.pointTree.insert(e));let r=this.pointMap.get(e);r==null&&(r=new Array,this.pointMap.set(e,r));for(let i of r)if(i instanceof M&&t instanceof M){if(i.equals2(t))return}else if(i instanceof q&&t instanceof q&&i.equals1(t))return;r.push(t)}getPoint(t){let e=this.pointTree.search(t.bbox().extendOfSize(1e-4));for(let r of e)if(r.equals(t,5))return r;return null}findNeighbor(t){let e=this.graph.get(t.end),r=new Array;if(e!=null)for(let i of e)i.mark||t.pt==i.pt||r.push(i);return r}};var ole=class{constructor(t,e,r,i,n,s,a){this.path=t;this.model1=e;this.layerId1=r;this.model2=i;this.layerId2=n;this.rule=s;this.dis=a}getErrorInfo(){let t=this.path[0].start().add(this.path[this.path.length-1].end()).mul(.5);return{shape1:this.model1,shape2:this.model2,position:t,realDistance:this.dis,ruleDistance:this.rule.clearance,ruleName:this.rule.rule.name,ruleType:"Creepage Distance",layers:[this.model1.layerId,this.model2.layerId],path:this.path}}};var gq=class{constructor(){this.minDistance=1/0;this.bestPoints=null;this.currentClearance=1/0;this.currentInterBBox=null;this.originalStart=null;this.originalEnd=null;this.obstaclesEdges=new Mb(7)}calculateReflectionPath(t,e,r,i){if(this.minDistance=1/0,this.bestPoints=null,this.currentClearance=i,this.originalStart=e,this.originalEnd=r,this.obstaclesEdges=new Mb(7),this.currentInterBBox=e.bbox().extendOfSize(i).intersect(r.bbox().extendOfSize(i)),this.currentInterBBox==null)return this.bestPoints;let{obstaclesEdges:n}=t.search(this.currentInterBBox);this.obstaclesEdges=this.getPrimitiveTree(n);for(let s of e.primitives)if((s instanceof M||s instanceof q)&&!(this.currentInterBBox&&this.currentInterBBox.isSeparated(s.bbox()))){for(let a of r.primitives)if(!(!(a instanceof M||a instanceof q)||this.currentInterBBox&&this.currentInterBBox.isSeparated(a.bbox())||this.estimateMinDistance(s,a)>this.currentClearance))for(let c of n)(c instanceof M||c instanceof q)&&(this.currentInterBBox&&!this.currentInterBBox.isIntersect(c.bbox())||this.processEdgeCombination(s,a,c))}return this.bestPoints}getPrimitiveTree(t){let e=new Mb(7);for(let r of t)e.add(r);return e}estimateMinDistance(t,e){return new ir(t,e).getDistance()}processEdgeCombination(t,e,r){r instanceof M?this.processWithLineMirror(t,e,r):this.processWithArcMirror(t,e,r)}processWithLineMirror(t,e,r){let i=this.mirrorEdgeAboutLine(t,r),{point1:n,point2:s,distance:a}=this.findClosestPointsBetweenEdges(i,e);if(a>this.currentClearance)return;let l=this.findReflectionPointOnLine(r,i,n,s,e);if(!l||this.currentInterBBox&&!this.currentInterBBox.isContains(l))return;let c=this.findClosestPointOnEdge(i,l),h=this.findClosestPointOnEdge(e,l),u=this.reflectPointAboutLine(c,r);if(!this.validateLineIntersectsEdge(new M(u,l),r))return;let d=u.distance1(l)+l.distance1(h);d>this.currentClearance||this.updateBestResult(d,u,h,l)}isValid(t){for(let e of t){let r=e.bbox(),i=this.obstaclesEdges.search(r);for(let n of i){let s=Tt(e,n);for(let a=0;a<s;a+=2){let l=new S(Ee[a],Ee[a+1]);if(!l.equals1(e.start())&&!l.equals1(e.end()))return!1}}}return!0}findReflectionPointOnLine(t,e,r,i,n){let s=this.findDirectIntersection(t,r,i);return s||this.ternarySearchOnLine(t,e,n)}findDirectIntersection(t,e,r){if(xE(new M(e,r),t)>0){let n=new S(Ee[0],Ee[1]);if(uT(t,n)>0)return n}return null}processWithArcMirror(t,e,r){if(this.estimateMinDistance(t,e)>this.currentClearance)return;let n=this.ternarySearchOnArc(r,t,e);if(n){if(this.currentInterBBox&&!this.currentInterBBox.isContains(n.reflectionPoint)||n.distance>this.currentClearance)return;this.updateBestResult(n.distance,n.pointA,n.pointB,n.reflectionPoint)}}ternarySearchOnLine(t,e,r){let i=t.start(),n=t.length();if(n<1e-8)return t.start();let s=t.direct,a=1e-6,l=c=>{let h=i.add(s.mul(c)),u=this.findClosestPointOnEdge(e,h),d=this.findClosestPointOnEdge(r,h);return u.distance1(h)+h.distance1(d)};return this.executeTernarySearch1D(0,n,l,a,i,s)}ternarySearchOnArc(t,e,r){let[i,n]=this.getArcSearchRange(t),s=1e-5,a=l=>{let c=t.pointOn(l),h=this.findClosestPointOnEdge(e,c),u=this.findClosestPointOnEdge(r,c);return{distance:h.distance1(c)+c.distance1(u),pointA:h,pointB:u,reflectionPoint:c}};return this.executeTernarySearchOnArc(i,n,a,s)}getArcSearchRange(t){let e=t.startAngle,r=t.endAngle();return t.sweep()===le.CW&&([e,r]=[r,e]),r<e&&(r+=2*Math.PI),[e,r]}executeTernarySearch1D(t,e,r,i,n,s){let a=0,l=r(0),c=r(e);for(c<l&&(a=e,l=c);e-t>i;){let h=(e-t)/3,u=t+h,d=e-h,p=r(u),m=r(d);p<m?(e=d,p<l&&(a=u,l=p)):(t=u,m<l&&(a=d,l=m))}return n.add(s.mul(a))}executeTernarySearchOnArc(t,e,r,i){let n=r(t),s=r(e);for(s.distance<n.distance&&(n=s);e-t>i;){let a=(e-t)/3,l=t+a,c=e-a,h=r(l),u=r(c);h.distance<u.distance?(e=c,h.distance<n.distance&&(n=h)):(t=l,u.distance<n.distance&&(n=u))}return n}reflectPointAboutLine(t,e){let r=e.start(),n=e.end().sub(r),s=new S(-n.y,n.x).normalize(),l=t.sub(r).dot(s);return t.sub(s.mul(2*l))}mirrorEdgeAboutLine(t,e){if(t instanceof M)return new M(this.reflectPointAboutLine(t.start(),e),this.reflectPointAboutLine(t.end(),e));{let r=this.reflectPointAboutLine(t.center,e);if(t.isCircle())return q.build2(r,0,360,t.rx,t.ry,t.sweep());let i=this.reflectPointAboutLine(t.start(),e),n=this.reflectPointAboutLine(t.end(),e),s=t.isCCW?le.CW:le.CCW;return q.build4(i,n,r,t.rx,t.ry,s)}}findClosestPointOnEdge(t,e){if(t instanceof M){let r=t.start(),i=t.direct,n=t.length(),s=r.add(i.mul(e.sub(r).dot(i))),a=e.sub(r).dot(i);return a<0?r:a>n?t.end():s}else{let r=t.center.add(e.sub(t.center).normalize().mul(t.rx));if(vm(t,r))return r;let i=e.distance1(t.start()),n=e.distance1(t.end());return i<n?t.start():t.end()}}findClosestPointsBetweenEdges(t,e){let r=new ir(t,e),i=r.getLine();return{point1:i.start(),point2:i.end(),distance:r.getDistance()}}validateLineIntersectsEdge(t,e){if(e instanceof M){if(xE(t,e)>0){let i=new S(Ee[0],Ee[1]);return uT(e,i)>0}return!1}else{let r=Tt(t,e);for(let i=0;i<r;i+=2){let n=new S(Ee[i],Ee[i+1]);if(vm(e,n))return!0}return!1}}updateBestResult(t,e,r,i){let n=[new M(e,i),new M(i,r)];t<this.minDistance&&this.isValid(n)&&(this.minDistance=t,this.bestPoints={distance:t,pointA:e,pointB:r,reflectionPoint:i},t<this.currentClearance&&(this.currentClearance=t,this.originalStart&&this.originalEnd&&(this.currentInterBBox=this.originalStart.bbox().extendOfSize(t).intersect(this.originalEnd.bbox().extendOfSize(t)))))}};var QV=class{getRuleInfos(t,e){let r=sn.getInstance(),i=r.ruleHelper.getRuleItem(t),n=r.ruleHelper.getRuleItem(e),s=r.ruleHelper.generateConstraints("creepage",i,n);return s instanceof zI?r.ruleHelper.getCreepageRuleInfos(i,n,s):r.ruleHelper.getCreepageRuleInfos(i,n)}};var sle=class{constructor(t,e,r){this._rtree=null;this.model=t,this.layerId=e,this.outline=r,this._bbox=t.bbox}bbox(){return this._bbox}getRTree(){if(this.outline instanceof fe)return null;if(this._rtree===null){this._rtree=new nn(7);for(let t of this.outline.items)this._rtree.add(t)}return this._rtree}searchRTree(t,e=0){let r=this.getRTree();return r?r.search(t.extendOfSize(e)):this.outline instanceof fe&&!t.extendOfSize(e).isSeparated(this.outline.bbox())?[this.outline]:[]}},yq=class{constructor(t){this.layerIds=$e.getInstance().getAllCopperLayerId4Order();this.outlineCache=new Map;this.typeInfoCache=new Map;this.strokeRTreeCache=new Map;this.layerThicknessCache=new Map;this.sortedPhysLayers=null;this.layerIdToIndex=new Map;this.currentLayerThickness=0;this.context=void 0;this.ruleHelper=new QV;this.debugCb=void 0;this.creepageAl=new nle(t)}setDebugCb(t){this.debugCb=t}display(){if(this.debugCb!=null){let t=this.creepageAl.getAll();this.debugCb(t)}}initPhysLayersCache(){if(this.sortedPhysLayers!==null)return;let t=$e.getInstance();this.sortedPhysLayers=t.getLayerPhys(),this.layerIdToIndex.clear();for(let e=0;e<this.sortedPhysLayers.length;e++)this.layerIdToIndex.set(this.sortedPhysLayers[e].layerId,e)}getLayerThickness(t,e){if(t===e)return 0;let r=t<e?`${t}_${e}`:`${e}_${t}`,i=this.layerThicknessCache.get(r);if(i!==void 0)return i;let n=this.calculateLayerThickness(t,e);return this.layerThicknessCache.set(r,n),n}calculateLayerThickness(t,e){this.initPhysLayersCache();let r=this.layerIdToIndex.get(t),i=this.layerIdToIndex.get(e);if(r===void 0||i===void 0)return 0;let n=Math.min(r,i),s=Math.max(r,i),a=0;for(let l=n+1;l<s;l++)a+=this.sortedPhysLayers[l].thickness;return a}clearLayerThicknessCache(){this.layerThicknessCache.clear(),this.sortedPhysLayers=null,this.layerIdToIndex.clear()}calculate(t,e){if(t.cluster1.bbox.extendOfSize(e).isSeparated(t.cluster2.bbox))return null;let i={minConstraint:e,bestResult:null,bestRuleInfo:null,bestResultType:null},n=this.buildLayerData(t.cluster1.models,t.nearestEndpoints[0].id),s=this.buildLayerData(t.cluster2.models,t.nearestEndpoints[1].id);this.calculateFromNearestEndpoints(n,s,i),this.currentLayerThickness=0;for(let a of this.layerIds){let l=n.layerMap.get(a),c=s.layerMap.get(a);!l||!c||l.length===0||c.length===0||this.calculateBetweenLayers(l,c,!0,i)}for(let a of this.layerIds){let l=n.layerMap.get(a);if(!(!l||l.length===0))for(let c of this.layerIds){if(a===c)continue;let h=s.layerMap.get(c);!h||h.length===0||(this.currentLayerThickness=this.getLayerThickness(a,c),this.calculateBetweenLayers(l,h,!1,i))}}if(i.bestResult&&i.bestRuleInfo){if(t.actualDistance=i.bestResult.distance,ne.less(i.bestResult.distance,i.bestRuleInfo.clearance)){let a=new ole(i.bestResult.path,i.bestResult.model1,i.bestResult.layerId1,i.bestResult.model2,i.bestResult.layerId2,i.bestRuleInfo,i.bestResult.distance);return t.checkResult=a,a}return null}else return null}measure(t,e,r){let i={minConstraint:r,bestResult:null,bestRuleInfo:null,bestResultType:null},n=this.buildLayerData(new Set([t]),t.globalIndex),s=this.buildLayerData(new Set([e]),e.globalIndex);if(this.calculateFromNearestEndpoints(n,s,i),i.bestResult==null){let a=Math.min(t.bbox.center().distance1(e.bbox.center()),this.getMaxDistance());for(;a<=r&&(i.minConstraint=a,this.calculateFromNearestEndpoints(n,s,i,!0),!(a==r||i.bestResult!=null));)a=Math.min(a*2+1,r)}return i}getMaxDistance(){let t=0;for(let e of te.getInstance().getAllCreepageSpacing())e.creepageDistance>t&&(t=e.creepageDistance);return t}calculateFromNearestEndpoints(t,e,r,i=!1){for(let[n,s]of t.layerToItem)for(let[a,l]of e.layerToItem){let c=n===a;this.currentLayerThickness=this.getLayerThickness(n,a);let h=this.calculatePair(s,l,r.minConstraint,c,r,i);h&&(r.bestResult===null||h.distance<r.bestResult.distance)&&(r.bestResult=h,r.bestRuleInfo=h.ruleInfo,r.minConstraint=h.distance,r.bestResultType=h.pathType)}}calculateBetweenLayers(t,e,r,i){let n=this.buildRTree(e);for(let s of t){let a=s.model.bbox.extendOfSize(i.minConstraint),l=n.search(a),c=i.minConstraint,h=a;for(let u of l){if(i.bestResult&&c!==i.bestResult.distance&&!h.isIntersect(u.bbox()))continue;let d=this.calculatePair(s,u,i.minConstraint,r,i);d&&(i.bestResult===null||d.distance<i.bestResult.distance)&&(i.bestResult=d,i.bestRuleInfo=d.ruleInfo,i.minConstraint=d.distance,i.bestResultType=d.pathType,h=s.model.bbox.extendOfSize(i.minConstraint))}}}buildLayerData(t,e){let r=new Map,i=new Map;for(let n of t)if(gr(n.layerId))for(let s of this.layerIds){let a=this.getOutline(n,s);if(!a)continue;let l=new sle(n,s,a),c=r.get(s)||[];c.push(l),r.set(s,c),n.globalIndex==e&&!i.has(s)&&i.set(s,l)}else{let s=this.getOutline(n,n.layerId);if(!s)continue;let a=new sle(n,n.layerId,s),l=r.get(n.layerId)||[];l.push(a),r.set(n.layerId,l),n.globalIndex==e&&i.set(n.layerId,a)}return{layerMap:r,layerToItem:i}}buildRTree(t){let e=new Sd(10);for(let r of t)e.insert(r);return e}calculatePair(t,e,r,i,n,s=!1){this.context=n;let a=this.getShapeTypeInfo(t.model,t.layerId),l=this.getShapeTypeInfo(e.model,e.layerId),c=this.ruleHelper.getRuleInfos(t.model,e.model);if(!s&&!c||!s&&c.clearance<=0||!s&&c.rule instanceof zI&&c.rule.ignoreLayer&&(Ms(t.layerId)||Ms(e.layerId)))return null;if(i){let u=bh.getCache(t.model,t.layerId),d=bh.getCache(e.model,e.layerId);if(u&&d){let p=new CC,m=p.checkCache(u,d,0);if(m&&m.relate!==3){let g=p.adjustCollisionLine(m.line,u,d);return{distance:0,path:g?[g]:[],model1:t.model,layerId1:t.layerId,model2:e.model,layerId2:e.layerId,ruleInfo:c,pathType:"creepage"}}}}if(r=s?r:Math.min(r,c.clearance),a.isTrack){if(l.isTrack)return this.simpleCreepage(t,e,r,i,c);if(l.isPad)return this.simpleCreepage(t,e,r,i,c);if(l.isVia)return this.simpleCreepage(t,e,r,i,c);if(l.isProfile)return this.calculateToProfile(t,e,r,i,c);if(l.isFill)return this.calculateToPlane(t,e,r,i,c)}if(a.isPad){if(l.isTrack)return this.simpleCreepage(t,e,r,i,c);if(l.isPad)return this.simpleCreepage(t,e,r,i,c);if(l.isVia)return this.simpleCreepage(t,e,r,i,c);if(l.isProfile)return this.calculateToProfile(t,e,r,i,c);if(l.isFill)return this.calculateToPlane(t,e,r,i,c)}if(a.isVia){if(l.isTrack)return this.simpleCreepage(t,e,r,i,c);if(l.isPad)return this.simpleCreepage(t,e,r,i,c);if(l.isVia)return this.simpleCreepage(t,e,r,i,c);if(l.isProfile)return this.calculateToProfile(t,e,r,i,c);if(l.isFill)return this.calculateToPlane(t,e,r,i,c)}if(a.isProfile){if(l.isTrack)return this.calculateToProfile(e,t,r,i,c);if(l.isPad)return this.calculateToProfile(e,t,r,i,c);if(l.isVia)return this.calculateToProfile(e,t,r,i,c);if(l.isProfile)return this.calculateProfiles(t,e,r,i,c);if(l.isFill)return this.calculateProfilePlane(t,e,r,i,c)}if(a.isFill){if(l.isTrack)return this.calculateToPlane(e,t,r,i,c);if(l.isPad)return this.calculateToPlane(e,t,r,i,c);if(l.isVia)return this.calculateToPlane(e,t,r,i,c);if(l.isProfile)return this.calculateProfilePlane(e,t,r,i,c);if(l.isFill)return this.calculatePlanes(t,e,r,i,c)}let h=this.creepage(t.outline,e.outline,r,i);return h?{distance:h.dis,path:h.path,model1:t.model,layerId1:t.layerId,model2:e.model,layerId2:e.layerId,ruleInfo:c,pathType:h.type}:null}getOutline(t,e){let r=`${t.globalIndex}_${e}`,i=this.outlineCache.get(r);if(i)return i;let n=t.getMathGraphics(e);return n&&this.outlineCache.set(r,n),n}getShapeTypeInfo(t,e){let r=`${t.globalIndex}_${e}`,i=this.typeInfoCache.get(r);if(i)return i;let n={isTrack:t instanceof yt,isVia:t instanceof It,isPad:t instanceof Je,padShapeType:null,isProfile:t instanceof lr,profileType:null,isCircleProfile:!1,isFill:t instanceof dc};if(n.isPad){let s=this.getPadStyleByLayer(t,e);s&&(n.padShapeType=s.type)}if(n.isProfile){let s=t;n.profileType=s.type,n.isCircleProfile=s.modelType==="Circle"}return this.typeInfoCache.set(r,n),n}getPadStyleByLayer(t,e){var r;return t.isUnuseLayer&&t.isUnuseLayer(e)?null:(r=t.getPad(e))!=null?r:null}isCircleProfile(t){return t instanceof lr&&t.modelType==="Circle"}getOvalParamsFromStyle(t,e){let{width:r,height:i}=t;if(Math.abs(r-i)<1e-8)return{line:null,center:e,radius:r/2};if(r>i){let n=(r-i)/2,s=e.add(new S(-n,0)),a=e.add(new S(n,0));return{line:new M(s,a),center:e,radius:i/2}}else{let n=(i-r)/2,s=e.add(new S(0,-n)),a=e.add(new S(0,n));return{line:new M(s,a),center:e,radius:r/2}}}calculateCircleToCircle(t,e,r,i){let n=t.distance1(r);if(n<1e-8)return null;let s=Math.max(0,n-e-i),a=r.sub(t).normalize(),l=t.add(a.mul(e)),c=r.sub(a.mul(i));return{distance:s,line:new M(l,c)}}calculateOvalToCircle(t,e,r){let{line:i,center:n,radius:s}=t;if(i==null)return this.calculateCircleToCircle(n,s,e,r);let a=Zu.foot(i,e),l=e.distance1(a),c=s+r;if(i.bbox().extendOfSize(1e-8).isContains(a)){let p=Math.max(0,l-c),m=e.sub(a).normalize(),g=a.add(m.mul(s)),y=e.sub(m.mul(r));return{distance:p,line:new M(g,y)}}let u=e.distance1(i.start()),d=e.distance1(i.end());if(u<d){let p=Math.max(0,u-c),m=e.sub(i.start()).normalize(),g=i.start().add(m.mul(s)),y=e.sub(m.mul(r));return{distance:p,line:new M(g,y)}}else{let p=Math.max(0,d-c),m=e.sub(i.end()).normalize(),g=i.end().add(m.mul(s)),y=e.sub(m.mul(r));return{distance:p,line:new M(g,y)}}}calculateOvalToOval(t,e){let{line:r,center:i,radius:n}=t,{line:s,center:a,radius:l}=e;if(r==null&&s==null)return this.calculateCircleToCircle(i,n,a,l);if(r==null)return this.calculateOvalToCircle(e,i,n);if(s==null)return this.calculateOvalToCircle(t,a,l);let c=new Zu(r,s),h=c.getDistance(),u=n+l,d=Math.max(0,h-u),p=c.getLine(),m=p.end().sub(p.start()).normalize(),g=p.start().add(m.mul(n)),y=p.end().sub(m.mul(l));return{distance:d,line:new M(g,y)}}calculateTrackToOval(t,e,r){let{line:i,center:n,radius:s}=r;if(i==null){let h=new M(n,n),u=new Zu(t,h),d=u.getDistance();return{distance:Math.max(0,d-e/2-s),line:u.getLine()}}let a=new Zu(t,i),l=a.getDistance();return{distance:Math.max(0,l-e/2-s),line:a.getLine()}}calculateToProfile(t,e,r,i,n){let s=e.model;return s.type==="Fill Region"?this.calculateToRegion(t,e,r,i,n):s.type==="Line"?this.calculateToLine(t,e,r,i,n):null}calculateToRegion(t,e,r,i,n){if(e.outline instanceof Gt){let s=this.creepageIterateGroup(e.outline,t.outline,r,i);return this.createResult(s,t,e,n)}else return this.simpleCreepage(t,e,r,i,n)}calculateToLine(t,e,r,i,n){let s=e.model,a=this.creepageIterateStroke(e,s.strokeWidth,t.outline,r,i);return this.createResult(a,t,e,n)}calculateToPlane(t,e,r,i,n){let s=t.outline,a=e.model;if(a instanceof Pn&&a.style=="solid"){let l=this.handleSolidCopperRelation(s,a,r,i);if(!l)return null;if(!i&&l.relation!=3)return this.creepageWithRTree(s,e.getRTree(),r,i,t,e,n);if(l.optimi>0){let h=l.optimi*2,u=this.getStrokeRTree(l.outline,h);return this.creepageWithRTree(s,u,r,i,t,e,n)}let c=this.creepage(s,l.outline,l.limit,i);return c&&ne.less(c.dis,l.limit)?{distance:c.dis-l.optimi,path:c.path,model1:t.model,layerId1:t.layerId,model2:e.model,layerId2:e.layerId,ruleInfo:n,pathType:c.type}:null}else return this.creepageWithRTree(s,e.getRTree(),r,i,t,e,n)}calculateProfiles(t,e,r,i,n){let s=t.model,a=e.model,l=s.type==="Fill Region",c=s.type==="Line",h=a.type==="Fill Region",u=a.type==="Line";return l&&h?this.calculateRegions(t,e,r,i,n):l&&u?this.calculateRegionLine(t,e,r,i,n):c&&h?this.calculateRegionLine(e,t,r,i,n):c&&u?this.calculateLines(t,e,r,i,n):null}calculateRegions(t,e,r,i,n){let s=t.outline instanceof fe,a=e.outline instanceof fe;if(s&&a)return this.simpleCreepage(t,e,r,i,n);if(!s&&a){let l=this.creepageIterateGroup(t.outline,e.outline,r,i);return this.createResult(l,t,e,n)}else if(s&&!a){let l=this.creepageIterateGroup(e.outline,t.outline,r,i);return this.createResult(l,t,e,n)}else{let l=this.creepageIterateGroupPair(t.outline,e.outline,r,i);return this.createResult(l,t,e,n)}}calculateRegionLine(t,e,r,i,n){let s=e.model;if(t.outline instanceof fe){let l=this.creepageIterateStroke(e,s.strokeWidth,t.outline,r,i);return this.createResult(l,t,e,n)}else{let l=this.creepageStrokeToGroup(e,s.strokeWidth,t.outline,r,i);return this.createResult(l,t,e,n)}}calculateLines(t,e,r,i,n){let s=t.model,a=e.model,l=null;for(let c of t.outline.primitives){let h=c.stroke(s.strokeWidth,kr.ROUND,le.CW);for(let u of e.outline.primitives){let d=this.creepage(h,u.stroke(a.strokeWidth,kr.ROUND,le.CW),r,i);d&&(l==null||d.dis<l.distance)&&(l={distance:d.dis,path:d.path,pathType:d.type})}}return this.createResult(l,t,e,n)}calculateProfilePlane(t,e,r,i,n){let s=t.model,a=s.type==="Fill Region",l=s.type==="Line";return a?this.calculateRegionPlane(t,e,r,i,n):l?this.calculateLinePlane(t,e,r,i,n):null}calculateRegionPlane(t,e,r,i,n){let s=e.model;if(t.outline instanceof fe){let l=t.outline;if(s instanceof Pn&&s.style=="solid"){let c=this.handleSolidCopperRelation(l,s,r,i);if(!c)return null;if(!i&&c.relation!=3)return this.creepageWithRTree(l,e.getRTree(),r,i,t,e,n);if(c.optimi>0){let u=c.optimi*2,d=this.getStrokeRTree(c.outline,u);return this.creepageWithRTree(l,d,r,i,t,e,n)}let h=this.creepage(l,c.outline,c.limit,i);return h&&ne.less(h.dis,c.limit)?{distance:h.dis-c.optimi,path:h.path,model1:t.model,layerId1:t.layerId,model2:e.model,layerId2:e.layerId,ruleInfo:n,pathType:h.type}:null}else return this.creepageWithRTree(l,e.getRTree(),r,i,t,e,n)}else{let l=t.outline;if(s instanceof Pn&&s.style=="solid"){let c=this.creepageGroupToSolidCopper(l,s,r,i,t,e,n);return c?{distance:c.distance,path:c.path,model1:t.model,layerId1:t.layerId,model2:e.model,layerId2:e.layerId,ruleInfo:n,pathType:c.pathType}:null}else return this.creepageGroupToFillWithRTree(l,e,r,i,t,n)}}calculateLinePlane(t,e,r,i,n){let s=t.model,a=e.model;if(a instanceof Pn&&a.style=="solid"){let l=new fc(t.outline,new Gt(a.pls),r);if(i&&l.relation!==3)return null;let c=a.optimization?a.optimizationWidth/2:0,h=l.pt2Parent;if(c>0){let p=c*2,m=this.getStrokeRTree(h,p);return this.creepageStrokePrimitivesToRTree(t.outline.primitives,s.strokeWidth,m,r,i,t,e,n)}let u=r+c,d=null;for(let p of t.outline.primitives){let m=p.stroke(s.strokeWidth,kr.ROUND,le.CW),g=this.creepage(m,h,u,i);g&&(d==null||g.dis<d.distance)&&(d={distance:g.dis,path:g.path,pathType:g.type})}return d?{distance:d.distance-c,path:d.path,model1:t.model,layerId1:t.layerId,model2:e.model,layerId2:e.layerId,ruleInfo:n,pathType:d.pathType}:null}else return this.creepageStrokePrimitivesToRTree(t.outline.primitives,s.strokeWidth,e.getRTree(),r,i,t,e,n)}calculatePlanes(t,e,r,i,n){let s=t.model,a=e.model;return s instanceof Pn&&a instanceof Pn?this.calculateCopperToCopper(s,a,t,e,r,i,n):s instanceof Pn&&a instanceof Cn?this.calculateCopperToPlaneZone(s,a,t,e,r,i,n):s instanceof Cn&&a instanceof Pn?this.calculateCopperToPlaneZone(a,s,e,t,r,i,n):s instanceof Cn&&a instanceof Cn?this.calculatePlaneZoneToPlaneZone(s,a,t,e,r,i,n):null}calculateCopperToCopper(t,e,r,i,n,s,a){return t.style==="solid"&&e.style==="solid"?this.calculateSolidCopperToSolidCopper(t,e,r,i,n,s,a):t.style==="solid"&&e.style!=="solid"?this.calculateSolidCopperToGridFill(t,e,r,i,n,s,a):t.style!=="solid"&&e.style==="solid"?this.calculateSolidCopperToGridFill(e,t,i,r,n,s,a):this.calculateGridFillToGridFill(t,e,r,i,n,s,a)}calculateSolidCopperToSolidCopper(t,e,r,i,n,s,a){let l=null;if(!i.getRTree())return null;let h=r.outline,u=new fc(r.outline,i.outline,n);if(u.relation!=3&&s)return{distance:0,path:[u.line],model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:"creepage"};let d=u.pt1Parent,p=u.pt2Parent,m=t.optimization?t.optimizationWidth/2:0,g=e.optimization?e.optimizationWidth/2:0;if(m>0&&g>0){let y=m*2,b=this.getStrokeRTree(d,y),P=g*2,T=this.getStrokeRTree(p,P),I=b.bbox().extendOfSize(n).intersect(T.bbox()),C=null;if(I==null)return C;let E=n;for(let O of b.search(I)){let _=O.bbox(),R=T.search(_.extendOfSize(E));for(let v of R){if(C&&!v.bbox().isIntersect(_.extendOfSize(E)))continue;let D=this.creepage(O,v,E,s);D&&(C===null||C.distance>D.dis)&&(C=this.createResultFromCreepage(D,r,i,a),E=D.dis)}}return C}else if(m>0&&g<=0){let y=m*2,b=this.getStrokeRTree(d,y);return this.creepageWithRTree(p,b,n,s,r,i,a)}else if(m<=0&&g>0){let y=g*2,b=this.getStrokeRTree(p,y);return this.creepageWithRTree(d,b,n,s,r,i,a)}else{let y=this.creepage(d,p,n,s);return y&&(l==null||l.distance>y.dis)&&(l={distance:y.dis,path:y.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:y.type}),l}}calculateSolidCopperToGridFill(t,e,r,i,n,s,a){let l=null,c=n,h=i.getRTree();if(!h)return null;for(let u of t.pls){let d=u.bbox(),p=h.search(d.extendOfSize(c));for(let m of p){if(l&&!m.bbox().isIntersect(d.extendOfSize(c)))continue;let g=new fc(u,m,n);switch(g.relation){case 3:{let y=t.optimization?t.optimizationWidth/2:0,b=g.pt2Parent,P=n+y,T=this.creepage(u,b,P,s);T&&ne.less(T.dis,P)&&(l==null||l.distance>T.dis-y)&&(l={distance:T.dis-y,path:T.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:T.type},c=T.dis-y);break}default:{if(s)return{distance:0,path:[],model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:"creepage"};let y=t.optimization?t.optimizationWidth/2:0,b=g.pt2Parent,P=n+y,T=this.creepage(u,b,P,s);T&&ne.less(T.dis,P)&&(l==null||l.distance>T.dis-y)&&(l={distance:T.dis-y,path:T.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:T.type},c=T.dis-y)}break}}}return l}calculateGridFillToGridFill(t,e,r,i,n,s,a){let l=null,c=n,h=i.getRTree();if(!h)return null;let u=r.outline instanceof Gt?r.outline:t.getMathGraphics();for(let d of u.items){let p=d.bbox(),m=h.search(p.extendOfSize(c));for(let g of m){if(l&&!g.bbox().isIntersect(p.extendOfSize(c)))continue;if(new fc(d,g,n).relation!==3&&s)return{distance:0,path:[],model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:"creepage"};let b=this.creepage(d,g,n,s);b&&(l==null||l.distance>b.dis)&&(l={distance:b.dis,path:b.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:b.type},c=b.dis)}}return l}calculateCopperToPlaneZone(t,e,r,i,n,s,a){let l=null,c=i.getRTree();if(!c)return null;if(t.style==="solid")for(let h of t.pls){let u=n,d=h.bbox(),p=c.search(d.extendOfSize(u));for(let m of p){if(l&&!m.bbox().isIntersect(d.extendOfSize(u)))continue;let g=new fc(h,m,n);if(g.relation!==3&&s)return{distance:0,path:[],model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:"creepage"};let y=t.optimization?t.optimizationWidth/2:0,b=g.pt2Parent,P=u+y,T=this.creepage(h,b,P,s);if(T&&ne.less(T.dis,P)){let I=T.dis-y;(l==null||l.distance>I)&&(l={distance:I,path:T.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:T.type},u=I)}}}else{if(!r.getRTree())return null;let u=r.outline instanceof Gt?r.outline:t.getMathGraphics();for(let d of u.items){let p=n,m=d.bbox(),g=c.search(m.extendOfSize(p));for(let y of g){if(l&&!y.bbox().isIntersect(m.extendOfSize(p)))continue;if(new fc(d,y,n).relation!==3&&s)return{distance:0,path:[],model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:"creepage"};let P=this.creepage(d,y,p,s);P&&(l==null||l.distance>P.dis)&&(l={distance:P.dis,path:P.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:P.type},p=P.dis)}}}return l}calculatePlaneZoneToPlaneZone(t,e,r,i,n,s,a){let l=null,c=i.getRTree();if(!c)return null;let h=r.outline instanceof Gt?r.outline:t.getMathGraphics();for(let u of h.items){let d=n,p=u.bbox(),m=c.search(p.extendOfSize(d));for(let g of m){if(l&&!g.bbox().isIntersect(p.extendOfSize(d)))continue;if(new fc(u,g,n).relation!==3&&s)return{distance:0,path:[],model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:"creepage"};let b=this.creepage(u,g,d,s);b&&(l==null||l.distance>b.dis)&&(l={distance:b.dis,path:b.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:b.type},d=b.dis)}}return l}creepage(t,e,r,i){let n=this.creepageAl.creepageDistance(t,e,r);if(n!=null){let s=this.creepageAl.connect(n),a=n.cost+this.currentLayerThickness;if(ne.less(a,r)){if(i)return{dis:a,path:s,type:"creepage"};if(s.length===1){let c=new gq().calculateReflectionPath(this.creepageAl,t,e,r);if(c!=null)return{dis:c.distance+this.currentLayerThickness,path:[new M(c.pointA,c.reflectionPoint),new M(c.reflectionPoint,c.pointB)],type:"reflection"}}else return{dis:a,path:s,type:"creepage"}}}else{if(this.context!=null&&this.context.bestResult!=null&&this.context.bestResultType=="creepage")return null;if(!i){let a=new gq().calculateReflectionPath(this.creepageAl,t,e,r);if(a!=null)return{dis:a.distance+this.currentLayerThickness,path:[new M(a.pointA,a.reflectionPoint),new M(a.reflectionPoint,a.pointB)],type:"reflection"}}}return null}createResult(t,e,r,i){return t?{distance:t.distance,path:t.path,model1:e.model,layerId1:e.layerId,model2:r.model,layerId2:r.layerId,ruleInfo:i,pathType:t.pathType}:null}createResultFromCreepage(t,e,r,i){return t?{distance:t.dis,path:t.path,model1:e.model,layerId1:e.layerId,model2:r.model,layerId2:r.layerId,ruleInfo:i,pathType:t.type}:null}simpleCreepage(t,e,r,i,n){let s=this.creepage(t.outline,e.outline,r,i);return this.createResultFromCreepage(s,t,e,n)}creepageIterateGroup(t,e,r,i){let n=r,s=null,a=null;for(let l of t.items){let c=this.creepage(e,l,n,i);c&&c.dis<=n&&(n=c.dis,s=c.path,a=c.type)}return s?{distance:n,path:s,pathType:a}:null}creepageIterateGroupPair(t,e,r,i){let n=r,s=null,a=null;for(let l of t.items)for(let c of e.items){let h=this.creepage(l,c,n,i);h&&h.dis<=n&&(n=h.dis,s=h.path,a=h.type)}return s?{distance:n,path:s,pathType:a}:null}creepageIterateStroke(t,e,r,i,n){let s=i,a=null,l=null;for(let c of t.outline.primitives){let h=c.stroke(e,kr.ROUND,le.CW),u=this.creepage(h,r,s,n);u&&u.dis<=s&&(s=u.dis,a=u.path,l=u.type)}return a?{distance:s,path:a,pathType:l}:null}creepageStrokeToGroup(t,e,r,i,n){let s=i,a=null,l=null;for(let c of t.outline.primitives){let h=c.stroke(e,kr.ROUND,le.CW);for(let u of r.items){let d=this.creepage(h,u,s,n);d&&d.dis<=s&&(s=d.dis,a=d.path,l=d.type)}}return a?{distance:s,path:a,pathType:l}:null}handleSolidCopperRelation(t,e,r,i){let n=new fc(t,new Gt(e.pls),r);switch(n.relation){case 3:{let c=e.optimization?e.optimizationWidth/2:0,h=n.pt2Parent,u=r+c;return{optimi:c,outline:h,limit:u,relation:n.relation}}default:if(i)return null;let s=e.optimization?e.optimizationWidth/2:0,a=n.pt2Parent,l=r+s;return{optimi:s,outline:a,limit:l,relation:n.relation}}}creepageWithRTree(t,e,r,i,n,s,a){if(!e)return null;let l=null,c=r,h=t.bbox(),u=e.search(h.extendOfSize(c));for(let d of u){if(l&&!d.bbox().isIntersect(h.extendOfSize(c)))continue;let p=this.creepage(t,d,c,i);p&&(l===null||l.distance>p.dis)&&(l=this.createResultFromCreepage(p,n,s,a),c=p.dis)}return l}creepageGroupToSolidCopper(t,e,r,i,n,s,a){let l=null;for(let c of t.items){let h=this.handleSolidCopperRelation(c,e,r,i);if(!h)continue;if(!i&&h.relation!=3){let d=this.creepageWithRTree(c,s.getRTree(),r,i,n,s,a);d&&(!l||d.distance<l.distance)&&(l={distance:d.distance,path:d.path,pathType:d.pathType});continue}if(h.optimi>0){let d=h.optimi*2,p=this.getStrokeRTree(h.outline,d),m=this.creepageWithRTree(c,p,r,i,n,s,a);m&&(!l||m.distance<l.distance)&&(l={distance:m.distance,path:m.path,pathType:m.pathType});continue}let u=this.creepage(c,h.outline,h.limit,i);if(u&&ne.less(u.dis,h.limit)){let d=u.dis-h.optimi;(!l||d<l.distance)&&(l={distance:d,path:u.path,pathType:u.type})}}return l}creepageGroupToFillWithRTree(t,e,r,i,n,s){let a=e.getRTree();if(!a)return null;let l=null,c=r;for(let h of t.items){let u=h.bbox(),d=a.search(u.extendOfSize(c));for(let p of d){if(l&&!p.bbox().isIntersect(u.extendOfSize(c)))continue;let m=this.creepage(h,p,c,i);m&&(l===null||l.distance>m.dis)&&(l=this.createResultFromCreepage(m,n,e,s),c=m.dis)}}return l}creepageStrokePrimitivesToRTree(t,e,r,i,n,s,a,l){if(!r)return null;let c=null,h=i;for(let u of t){let d=u.stroke(e,kr.ROUND,le.CW),p=d.bbox(),m=r.search(p.extendOfSize(h));for(let g of m){if(c&&!g.bbox().isIntersect(p.extendOfSize(h)))continue;let y=this.creepage(d,g,h,n);y&&(c===null||c.distance>y.dis)&&(c=this.createResultFromCreepage(y,s,a,l),h=y.dis)}}return c}getStrokeRTree(t,e){let r=this.strokeRTreeCache.get(t);if(r===void 0){r=new nn(7);for(let i of t.primitives){let n=i.stroke(e,kr.ROUND,le.CW);r.add(n)}this.strokeRTreeCache.set(t,r)}return r}clearCache(){this.outlineCache.clear(),this.typeInfoCache.clear(),this.strokeRTreeCache.clear(),this.clearLayerThicknessCache()}};var bq=class{constructor(){this.ruleHelper=new QV;this.mstBuilder=new Zae;this.results=[]}analyze(t,e,r){this.results=[];let n=new qae().aggregate(t);if(n.length<2)return this.results;let s=this.mstBuilder.buildCandidateEdges(n,r);if(te.getInstance().betweenNetRule.rule.some(c=>c.creepageRule!=null)&&this.addNetworkToNetworkEdges(s,n,r),s.length===0)return this.results;let a=new yq(e);for(let c of s)a.calculate(c,r);let l=this.mstBuilder.computeMSTFromActualDistances(s,n.length);for(let c of l)c.checkResult&&this.results.push(c.checkResult);return this.results}measure(t,e,r,i){let n=new yq(r),s=n.measure(t,e,(r.bbox().width()+r.bbox().height())*2);return n.setDebugCb(i),n.display(),s.bestResult!=null?{realDistance:s.bestResult.distance,path:s.bestResult.path}:null}getRuleForClusterPair(t){let e=t.cluster1.models.values().next().value,r=t.cluster2.models.values().next().value;if(!(!e||!r))return this.ruleHelper.getRuleInfos(e,r)}addNetworkToNetworkEdges(t,e,r){if(!te.getInstance().betweenNetRule.rule.some(l=>l.creepageRule!=null))return;let n=te.getInstance().betweenNetRule.rule.filter(l=>l.creepageRule!=null);if(n.length===0)return;let s=new Set;for(let l of t)s.add(l.getPairKey());let a=new Map;for(let l of e){let c=l.net;a.has(c)||a.set(c,[]),a.get(c).push(l)}for(let l of n){let c=l.net1,h=l.net2;if(!c||!h)continue;let u=l.getNets(c),d=l.getNets(h),p=[];for(let g of u){let y=a.get(g);y&&p.push(...y)}let m=[];for(let g of d){let y=a.get(g);y&&m.push(...y)}for(let g of p){let y=g.bbox.extendOfSize(r);for(let b of m){if(g.id===b.id||g.net===b.net||y.isSeparated(b.bbox))continue;let P=g.id<b.id?`${g.id}|${b.id}`:`${b.id}|${g.id}`;if(s.has(P))continue;let T=this.getEstimatedDistance(g,b),I=g.bbox.center(),C=b.bbox.center(),E=new gl(I),O=new gl(C),_=new ZV(g,b,T,[E,O]);t.push(_),s.add(P)}}}}getEstimatedDistance(t,e){let r=t.bbox.center(),i=e.bbox.center(),n=r.distance1(i),s=Math.max(t.bbox.width(),t.bbox.height())/2,a=Math.max(e.bbox.width(),e.bbox.height())/2;return Math.max(0,n-s-a)}};var eG=class{constructor(){this.result=new Array}test(){let t=this.calculateBoard(),e=this.calculateSlot(t),r=this.getMaxDistance(),i=sn.getInstance();i.initialEnv_Worker();let n=i.drcMap;this.getModelPair(n,r,e)}checkCreepage(){if(this.isOpenDRCCustomCheck())return null;let t=this.calculateBoard(),e=this.calculateSlot(t),r=this.getMaxDistance();if(r==0)return null;let n=sn.getInstance().drcMap;this.getModelPair(n,r,e);for(let s of this.result)this.addCreepageError(s)}isOpenDRCCustomCheck(){var e;let t=Qa.getInstance();return t.isOpenDRCCustomCheck?!((e=t.creepageDistance.Creepage)!=null&&e.enforce):!1}calculateBoard(){let t=new nn(7),e=mVe();if(e.length>0){let r=new Array,i=new Map,n=new _e;for(let s of e){n.ext1(s.bbox);let a=s.getMathGraphics(s.layerId,0),l=s.strokeWidth;for(let c of a.primitives)r.push(c),i.set(c,l)}if(n.valid()){n.ext7(20);let s=n.build1(),l=new oh(s,2,.1,new Gi(1),r).detect3(i).items;for(let c of l)t.add(c)}}return t}calculateSlot(t){let e=gVe(),r=new Map;for(let s of e){let a=s.getMathGraphics(s.layerId,0),l=t.search(a.bbox());for(let c of l){let h=r.get(c);h==null&&(h=new Set,r.set(c,h)),a instanceof fe?h.add(a):Re.addAllSet(h,a.items)}}let i=new nn(7),n=new Kc;for(let s of t.itemList){let a=r.get(s);if(a==null)i.add(s.toPolylineGroup());else{let l=n.getSubtraction(Array.from(s.items),Array.from(a));for(let c of l)i.add(c)}}return i}getMaxDistance(){let t=0;for(let e of te.getInstance().getAllCreepageSpacing())e.creepageDistance>t&&(t=e.creepageDistance);return t}getModelPair(t,e,r){let i=new Set([0,1,2,3,4,5,6,7,9,13,14]);for(let n of r.itemList){let s=n.bbox(),a=t.searchItems(3,s,(d,p)=>i.has(p)),l=new nn(7);for(let d of n.items)for(let p of d.primitives)l.add(p);let c=[];for(let d of a){if(A_(d)==null)continue;let m=this.getModelReferPoint(d);if(m!=null&&Jr.inPolygon(m,n.items)){c.push(d);continue}let g=d.getMathGraphics(),y=!1;for(let b of g.primitives){let P=l.search(b.bbox());for(let T of P)if(Tt(b,T)>0){y=!0;break}if(y)break}y&&c.push(d)}let u=new bq().analyze(c,n,e);this.result.push(...u)}}measure(t,e,r,i){let n=this.calculateBoard(),s=this.calculateSlot(n),a=new bq,l=ut.extend2(t.bbox,e.bbox),c=s.search(l),h=new nn(7);for(let d of s.items())for(let p of d.primitives)h.add(p);let u;for(let d of c){let p=[];for(let m of[t,e]){let g=this.getModelReferPoint(m);if(g!=null&&Jr.inPolygon(g,d.items)){p.push(m);continue}let y=m.getMathGraphics(),b=!1;for(let P of y.primitives){let T=h.search(P.bbox());for(let I of T)if(Tt(P,I)>0){b=!0;break}if(b)break}b&&p.push(m)}if(p.length==2){u=d;break}}return u!=null?a.measure(t,e,u,r):(i(t,e),null)}getModelReferPoint(t){return t instanceof yt?t.start:t instanceof Je||t instanceof It?t.center:t instanceof ss||t instanceof Aa?t.start:t instanceof Po?t.center.add1(t.radius,0):t instanceof dc?t.start:null}addCreepageError(t){let e=t.getErrorInfo(),r=sn.getInstance();pi.getInstance().getCreepageError(e.shape1.globalIndex,e.shape2.globalIndex)==null&&(r.checkEnv==0?pi.getInstance().addCreepageError(e.position,e.ruleName,e.shape1.globalIndex,Zg(e.shape1),e.shape2.globalIndex,Zg(e.shape2),e.realDistance,e.ruleDistance,e.ruleType,e.layers,e.path):pi.getInstance().errorRecordBuffer.add({type:"CreepageError",data:{position:e.position,name:e.ruleName,obj1:e.shape1.globalIndex,obj1Type:Zg(e.shape1),obj2:e.shape2.globalIndex,obj2Type:Zg(e.shape2),minDistance:e.realDistance,clearance:e.ruleDistance,errorType:e.ruleType,layerIds:e.layers,path:e.path.map(n=>{if(n instanceof M)return{...n,type:"Line"};if(n instanceof q)return{...n,type:"Arc"}})}}))}};var ale=class extends CC{checkCache(t,e,r){let i=null;function n(s){s!==null&&(i===null||s.distance<i.distance)&&(i=s)}if(t instanceof Ud){if(e instanceof Ud){let s=(t.width+e.width)/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}else if(e instanceof Pp){let s=(t.width+e.width)/2;for(let a=0,l=e.shape.length;a<l;a++)n(this.getResSubWidth(this.check(t.shape,e.shape[a],s+r),s))}else if(e instanceof ud){let s=t.width/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}else if(e instanceof Cd){let s=(t.width+e.width)/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}}else if(t instanceof Pp){let s=t.shape;if(e instanceof Ud){let a=(t.width+e.width)/2;for(let l=0,c=s.length;l<c;l++)n(this.getResSubWidth(this.check(e.shape,s[l],a+r),a))}else if(e instanceof Pp){let a=(t.width+e.width)/2,l=a+r;this.checkPolylines(t,e,a,l,n)}else if(e instanceof ud){let a=t.width/2;for(let l=0,c=s.length;l<c;l++)n(this.getResSubWidth(this.check(e.shape,s[l],a+r),a))}else if(e instanceof Cd){let a=(t.width+e.width)/2;for(let l=0,c=s.length;l<c;l++)n(this.getResSubWidth(this.check(e.shape,s[l],a+r),a))}}else if(t instanceof ud){if(e instanceof Ud){let s=e.width/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}else if(e instanceof Pp){let s=e.width/2;for(let a=0,l=e.shape.length;a<l;a++)n(this.getResSubWidth(this.check(t.shape,e.shape[a],s+r),s))}else if(e instanceof ud)n(this.check(t.shape,e.shape,r));else if(e instanceof Cd){let s=e.width/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}}else if(t instanceof Cd){if(e instanceof Ud){let s=(t.width+e.width)/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}else if(e instanceof Pp){let s=(t.width+e.width)/2;for(let a=0,l=e.shape.length;a<l;a++)n(this.getResSubWidth(this.check(t.shape,e.shape[a],s+r),s))}else if(e instanceof ud){let s=t.width/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}else if(e instanceof Cd){let s=(t.width+e.width)/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}}return i}check(t,e,r){let i=t.bbox(),n=e.bbox();if(i.minX===0&&i.maxX===0&&i.minY===0&&i.maxY===0||n.minX===0&&n.maxX===0&&n.minY===0&&n.maxY===0)return null;if(!t.bbox().isIntersect(e.bbox().extendOfSize(r)))return new ed(3,Number.MAX_VALUE);if(t instanceof Tl){if(e instanceof Tl)return this.checkPts(t,e,r);if(e instanceof fe)return this.checkPt2Pl(t,e,r);if(e instanceof Gt)return this.checkPt2PlGrp(t,e,r)}else if(t instanceof fe){if(e instanceof Tl)return this.checkPt2Pl(e,t,r);if(e instanceof fe)return this.checkPls(t,e,r);if(e instanceof Gt)return this.checkPl2PlGrp(t,e,r)}else if(t instanceof Gt){if(e instanceof Tl)return this.checkPt2PlGrp(e,t,r);if(e instanceof fe)return this.checkPl2PlGrp(e,t,r);if(e instanceof Gt)return this.checkPlGrps(t,e,r)}}checkPts(t,e,r){let i=new ir(t,e),n=i.getDistance(),s=ne.lesseq(n,r)?0:3;return new ed(s,i.getDistance(),i.getLine())}checkPt2Pl(t,e,r){let i=!0,n=Mu.Position.pip(t.start(),e);if(n||(n=Mu.Position.pip(t.end(),e),i=!1),n){let s=i?t.start():t.end();return new ed(0,0,new M(s,s))}else{let s=3,a=Number.MAX_VALUE,l=null,c=t.bbox().extendOfSize(r);for(let h of e.primitives){if(this.isPoints(h)||!c.isIntersect(h.bbox()))continue;let u=new ir(h,t),d=u.getDistance(),p=u.getLine();if(ne.less(d,a)&&(a=d,l=p),ne.lesseq(a,r)&&(s=0),ne.eq(a,0))break}return new ed(s,a,l)}}checkPt2PlGrp(t,e,r){let i=Mu.Position.pips(t.start(),e.items);if(i||(i=Mu.Position.pips(t.end(),e.items)),i){let n=t.start().add(t.end()).mul(.5);return new ed(0,0,new M(n,n))}else{let n=3,s=Number.MAX_VALUE,a=null,l=t.bbox().extendOfSize(r),h=this.getRtree(e).search(l);for(let u of h){if(this.isPoints(u)||!l.isIntersect(u.bbox()))continue;let d=new ir(u,t),p=d.getDistance(),m=d.getLine();if(ne.less(p,s)&&(s=p,a=m),ne.lesseq(s,r)&&(n=0),ne.eq(s,0))break}return new ed(n,s,a)}}checkPls(t,e,r){let i=Mu.Position.pip(t.start(),e);if(i||(i=Mu.Position.pip(e.end(),t)),i)return new ed(0,0,new M(t.start(),t.start()));{let n=3,s=Number.MAX_VALUE,a=null;for(let l of t.primitives){if(this.isPoints(l))continue;let c=l.bbox().extendOfSize(r);if(c.isIntersect(e.bbox())){for(let h of e.primitives){if(this.isPoints(h)||!c.isIntersect(h.bbox()))continue;let u=new ir(l,h),d=u.getDistance(),p=u.getLine();if(ne.less(d,s)&&(s=d,a=p),ne.lesseq(s,r)&&(n=0),ne.eq(s,0))break}if(ne.eq(s,0))break}}return new ed(n,s,a)}}checkPl2PlGrp(t,e,r){let i=Mu.Position.pips(t.start(),e.items);if(i||(i=Mu.Position.pip(e.items[0].start(),t)),i)return new ed(0,0,new M(t.start(),t.start()));{let n=3,s=Number.MAX_VALUE,a=null,l=this.getRtree(e);for(let c of t.primitives){if(this.isPoints(c))continue;let h=c.bbox().extendOfSize(r),u=l.search(h);for(let d of u){if(this.isPoints(d)||!h.isIntersect(d.bbox()))continue;let p=new ir(d,c),m=p.getDistance(),g=p.getLine();if(ne.less(m,s)&&(s=m,a=g),ne.lesseq(s,r)&&(n=0),ne.eq(s,0))break}if(ne.eq(s,0))break}return new ed(n,s,a)}}checkPlGrps(t,e,r){let i=Mu.Position.pips(t.items[0].start(),e.items),n=new M(t.items[0].start(),t.items[0].start());if(i||(i=Mu.Position.pips(e.items[0].start(),t.items),n=new M(e.items[0].start(),e.items[0].start())),i)return new ed(0,0,n);{let s=3,a=Number.MAX_VALUE,l=null;if(t.bbox().area()>e.bbox().area()){let c=this.getRtree(t);for(let h of e.items)for(let u of h.primitives){if(this.isPoints(u))continue;let d=u.bbox().extendOfSize(r),p=c.search(d);for(let m of p){if(this.isPoints(m)||!d.isIntersect(m.bbox()))continue;let g=new ir(m,u),y=g.getDistance(),b=g.getLine();if(ne.less(y,a)&&(a=y,l=b),ne.lesseq(a,r)&&(s=0),ne.eq(a,0))break}}}else{let c=this.getRtree(e);for(let h of t.items)for(let u of h.primitives){if(this.isPoints(u))continue;let d=u.bbox().extendOfSize(r),p=c.search(d);for(let m of p){if(this.isPoints(m)||!d.isIntersect(m.bbox()))continue;let g=new ir(m,u),y=g.getDistance(),b=g.getLine();if(ne.less(y,a)&&(a=y,l=b),ne.lesseq(a,r)&&(s=0),ne.eq(a,0))break}}}return new ed(s,a,l)}}checkPolylines(t,e,r,i,n){let s=t.shape,a=e.shape,l=s.length,c=a.length;if(t.rtree&&e.rtree)l<=c?this.checkWithRtree(s,e.rtree,i,(h,u)=>this.check(h,u,i),n,r):this.checkWithRtree(a,t.rtree,i,(h,u)=>this.check(u,h,i),n,r);else if(e.rtree)this.checkWithRtree(s,e.rtree,i,(h,u)=>this.check(h,u,i),n,r);else if(t.rtree)this.checkWithRtree(a,t.rtree,i,(h,u)=>this.check(u,h,i),n,r);else for(let h=0;h<l;h++)for(let u=0;u<c;u++)n(this.getResSubWidth(this.check(a[u],s[h],i),r))}checkWithRtree(t,e,r,i,n,s){for(let a of t){let l=a.bbox().extendOfSize(r),c=e.search(l);for(let h of c)this.isPoints(h)||n(this.getResSubWidth(i(h,a),s))}}};var qD=class extends R3{constructor(){super(...arguments);this.collisionAl=new ale}commonCheck(e,r,i=e.layerId,n=r.layerId){let s=this.getRuleInfos(e,r,i,n),a=oi.isProhibit(e)||oi.isProhibit(r),l=Math.max(xe(s.clearance,2),0);if(!a&&l===0)return;let c=bh.getCache(e,i),h=bh.getCache(r,n),[u,d]=this.getSmallerCacheFirst(c,h),p=this.collisionAl.checkCache(u,d,l);return p&&(p.ruleInfos=s),p}singlesCheck(e,r,i=e.layerId){let n=this.drcEnv.ruleHelper.getShape2Clearance(e,r,void 0,this._holeStatus,i),s=oi.isProhibit(e)||oi.isProhibit(r),a=Math.max(xe(n.clearance,2),0);if(!s&&a===0)return;let l=bh.getCache(e,i),c=bh.getCache(r,i),h=this.collisionAl.checkCache(l,c,a);return h&&(h.ruleInfos=n),h}getSmallerCacheFirst(e,r){if(e instanceof ud&&r instanceof ud){let i=e.shape.bbox().area(),n=r.shape.bbox().area();if(i>n)return[r,e]}return[e,r]}curryCommonCheck(e,r){return(i,n)=>{let s=this.commonCheck(e,r,i,n);return s!=null&&(this._holeStatus!==void 0&&(s._holeState=this._holeStatus),s.syncCollideLayerIds([i,n])),s}}};var lle=class extends qD{checkShapeRelation(t,e,r){let i=this.initCheckFunc(t,e);if(r!==void 0&&(r==0&&(r=1),this._holeStatus=r),!(e instanceof lr&&oi.isProhibit(e)&&!e.component.copper))if(e instanceof Je){if((this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||e.layerId==12&&this._holeStatus==1&&i(t.layerId,12))return}else return e instanceof It?(!e.isContains(t.layerId)||(this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||this._holeStatus==1&&i(t.layerId,12),void 0):i(t.layerId,t.layerId)}};var cle=class extends qD{checkShapeRelation(t,e,r){let i=this.initCheckFunc(t,e);if(r!==void 0&&(r==0&&(r=1),this._holeStatus=r),!(e instanceof lr&&oi.isProhibit(e)&&!e.component.planzone)){if(e instanceof Cn)return i(t.layerId,e.layerId);if(e instanceof Je){if((this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||e.layerId==12&&this._holeStatus==1&&i(t.layerId,12))return}else return e instanceof It?(!e.isContains(t.layerId)||(this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||this._holeStatus==1&&i(t.layerId,12),void 0):i(t.layerId,e.layerId)}}};var hle=class extends qD{checkShapeRelation(t,e,r){if(r!==void 0&&(this._holeStatus=r),this.checkError2Result=this.initCheckFunc(t,e),this._checkProhibit(t,e)||this.dispatchOutline(t,e))return;let i=oi.isSingleLayerShape(t),n=oi.isSingleLayerShape(e);i&&n?this.checkSingleSingle(t,e):!i&&!n?this.dispatchMultiMulti(t,e):i?this.checkSingleMulti(t,e):(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkSingleMulti(e,t))}_checkProhibit(t,e){if(oi.isProhibit(t)||oi.isProhibit(e)){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}return!1}dispatchOutline(t,e){return oi.isBoardOutline(t)?(oi.isSingleLayerShape(e)?this.checkOutlineSingle(t,e):this.dispatchOutlineMulti(t,e),!0):oi.isBoardOutline(e)?(oi.isSingleLayerShape(t)?this.checkOutlineSingle(e,t):(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.dispatchOutlineMulti(e,t)),!0):!1}checkOutlineSingle(t,e){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([e.layerId]),this.check2Result(t,e,r)}dispatchOutlineMulti(t,e){e instanceof Je?this.checkOutlinePad(t,e):e instanceof It?this.checkOutlineVia(t,e):oi.isSlot(e)&&this.checkOutlineSlot(t,e)}checkOutlinePad(t,e){if(!(this._holeStatus==1&&this.checkError2Result(t.layerId,12))&&(this._holeStatus===void 0||this._holeStatus===3)){for(let r of this.copperLayerIds)if(!e.isUnuseLayer(r)&&this.checkError2Result(t.layerId,r))return}}checkOutlineVia(t,e){if(this._holeStatus===void 0||this._holeStatus===3){for(let r of this.copperLayerIds)if(!e.isUnuseLayer(r))return this.checkError2Result(t.layerId,r)}this._holeStatus===1&&this.checkError2Result(t.layerId,12)}checkOutlineSlot(t,e){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}checkSingleSingle(t,e){let r=this.singlesCheck(t,e,t.layerId);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}checkSingleMulti(t,e){if(!(e instanceof It&&!e.isContains(t.layerId))){if(this._holeStatus===void 0||this._holeStatus==3){if(e instanceof Je){if(e.isUnuseLayer(t.layerId))return;if(t instanceof vi){let r=e.getParent();if(r instanceof vi){let i=Mg(r.layerId);return i===t.layerId?this.checkError2Result(i,i):void 0}}return this.checkError2Result(t.layerId,t.layerId)}else if(e instanceof It&&e.isContains(t.layerId)&&!e.isUnuseLayer(t.layerId))return this.checkError2Result(t.layerId,t.layerId)}(this._holeStatus==1||e instanceof lr)&&this.checkError2Result(t.layerId,12)}}dispatchMultiMulti(t,e){t instanceof Je?this.dispatchPad(t,e):t instanceof It?this.dispatchVia(t,e):this.dispatchMulti(t,e)}dispatchPad(t,e){e instanceof Je?this.checkPadPad(t,e):e instanceof It?this.checkPadVia(t,e):this.checkPadMulti(t,e)}dispatchVia(t,e){e instanceof Je?(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkPadVia(e,t)):e instanceof It?this.checkViaVia(t,e):this.checkViaMulti(t,e)}dispatchMulti(t,e){e instanceof Je?(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkPadMulti(e,t)):e instanceof It?(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkViaMulti(e,t)):this.checkMultiMulti(t,e)}checkPadPad(t,e){let r=this._holeStatus===0,i=this._holeStatus===1,n=this._holeStatus===2,s=this._holeStatus===void 0||this._holeStatus===3;for(let a of this.copperLayerIds){if([1,2].includes(a)){if(r&&this.checkError2Result(12,a)||i&&this.checkError2Result(a,12))break}else if(r&&!e.isUnuseLayer(a)&&this.checkError2Result(12,a)||i&&!t.isUnuseLayer(a)&&this.checkError2Result(a,12))break;if(s&&!t.isUnuseLayer(a)&&!e.isUnuseLayer(a)&&this.checkError2Result(a,a))break}n&&this.checkError2Result(12,12)}checkPadVia(t,e){let r=this._holeStatus===0,i=this._holeStatus===1,n=this._holeStatus===2,s=this._holeStatus===void 0||this._holeStatus===3;for(let a of this.copperLayerIds){if([1,2].includes(a)){if(r&&this.checkError2Result(12,a)||i&&this.checkError2Result(a,12))break}else if(r&&!e.isUnuseLayer(a)&&this.checkError2Result(12,a)||i&&!t.isUnuseLayer(a)&&this.checkError2Result(a,12))break;if(s&&!t.isUnuseLayer(a)&&!e.isUnuseLayer(a)&&this.checkError2Result(a,a))break}n&&this.checkError2Result(12,12)}checkPadMulti(t,e){if(this._holeStatus===void 0||this._holeStatus==3){for(let r of this.copperLayerIds)if(this.checkError2Result(r,e.layerId))break}this._holeStatus==0&&this.checkError2Result(12,12)}checkViaVia(t,e){let r=this._holeStatus===0,i=this._holeStatus===1,n=this._holeStatus===2,s=this._holeStatus===void 0||this._holeStatus===3;for(let a of this.copperLayerIds)if(r&&!e.isUnuseLayer(a)&&this.checkError2Result(12,a)||i&&!t.isUnuseLayer(a)&&this.checkError2Result(a,12)||s&&!t.isUnuseLayer(a)&&!e.isUnuseLayer(a)&&this.checkError2Result(a,a))break;n&&this.checkError2Result(12,12)}checkViaMulti(t,e){if(this._holeStatus===void 0||this._holeStatus==3){for(let r of this.copperLayerIds)if(!t.isUnuseLayer(r)&&this.checkError2Result(r,12))break}this._holeStatus!==void 0&&this._holeStatus!==3&&this.checkError2Result(12,12)}checkMultiMulti(t,e){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}};var tG=class{constructor(){this.copperCheck=new lle;this.planeCheck=new cle;this.safeCheck=new hle}check(t){let[e,r,i]=t;return e instanceof Pn?this.copperCheck.checkShapeRelation(e,r,i):r instanceof Pn?this.copperCheck.checkShapeRelation(r,e,i):e instanceof Cn?this.planeCheck.checkShapeRelation(e,r,i):r instanceof Cn?this.planeCheck.checkShapeRelation(r,e,i):this.safeCheck.checkShapeRelation(e,r,i),this}check1(t,e,r){return t instanceof Pn?this.copperCheck.checkShapeRelation(t,e,r):e instanceof Pn?this.copperCheck.checkShapeRelation(e,t,r):t instanceof Cn?this.planeCheck.checkShapeRelation(t,e,r):e instanceof Cn?this.planeCheck.checkShapeRelation(e,t,r):this.safeCheck.checkShapeRelation(t,e,r),this}getResult(){function t(e){return e.result.map(r=>r.getResult())}return{copper:t(this.copperCheck),plane:t(this.planeCheck),safe:t(this.safeCheck),other:void 0}}};function lze(o,t){let e=!1,r=0;class i{check(m){e?m.globalIndex<this.shape.globalIndex&&t(this.shape,m):t(this.shape,m)}}let n=new i,s=[{type:16,field:"device"},{type:6,field:"fill"},{type:0,field:"track"},{type:13,field:"copper"},{type:14,field:"planzone"}];function a(){let p=o.singleLayerMap.get(15);if(p){for(let[g,y]of p)if(y.items.size!=0){for(let b of y.items){n.shape=b.item;let P=n.shape.component,T=n.shape.buildBBox();for(let{type:I,field:C}of s)if(P[C]){let E=o.getTree(1,I,g);if(E==null)continue;E.search(T,n.check.bind(n))}}y.recycle()}o.singleLayerMap.delete(15)}let m=o.multiLayerMap.get(15);if(m){for(let[,g]of m)if(g.items.size!=0){for(let y of g.items){n.shape=y.item;let b=n.shape.component,P=n.shape.buildBBox();for(let{type:T,field:I}of s)if(b[I]){let C=o.singleLayerMap.get(T);if(C==null)continue;for(let[,E]of C)E&&E.search(P,n.check.bind(n))}}g.recycle()}o.multiLayerMap.delete(15)}}a();function l(){var p;for(let m of[1,2]){let g=(p=o.singleLayerMap.get(16))==null?void 0:p.get(m);if(g!=null){let y=new Map,b=new Set([16,2]);for(let P of b){if(e=P==16,r=JA.getShapePairMaxClearance(16,P,e?m:12),r==0){b.delete(P);continue}y.set(P,r)}if(b.size==0)continue;for(let P of b){e=P==16;let T=o.getTree(e?1:2,P,e?m:12);if(T!=null)for(let I of g.items){n.shape=I.item;let C=n.shape.buildBBox();r=y.get(P),T.search(C.extendOfSize(r),n.check.bind(n))}}g.recycle()}}o.singleLayerMap.delete(16)}l();function c(){let p=new Set(o.singleLayerMap.keys());for(let[m,g]of o.singleLayerMap){let y=new Set(p);for(let[b,P]of g){let T=new Map;for(let I of y){if(r=JA.getShapePairMaxClearance(m,I,b),r==0){y.delete(I);continue}T.set(I,r)}if(y.size!=0)for(let I of y){e=I==m,r=T.get(I);let C=o.getTree(1,I,b);if(C!=null)for(let E of P.items){n.shape=E.item;let O=n.shape.buildBBox().extendOfSize(r);C.search(O,n.check.bind(n))}}}p.delete(m)}}c();function h(){let p=o.getTree(2,11,11);if(p==null)return;let m=new Map,g=new Set(o.multiLayerMap.keys());for(let y of g)r=JA.getShapePairMaxClearance(11,y),m.set(y,r);for(let y of p.items){let b=y.item,P=[b.buildBBox()];b.bbox.area()>500&&(b instanceof Aa?P=b.getAllLinesInOrder().map(I=>I.bbox()):b instanceof ss&&(P=b.outline.primitives.map(I=>I.bbox())));let T=new Set;for(let[I,C]of o.singleLayerMap)for(let[E,O]of C)I!=16&&O!=null&&(r=JA.getShapePairMaxClearance(11,I,E),r!=0&&P.forEach(_=>O.search(_.extendOfSize(r),R=>{let v=R.globalIndex;T.has(v)||(t(b,R),T.add(v))})));T.clear();for(let I of g){e=I==11;let C;e?C=E=>{if(E.globalIndex<b.globalIndex){let O=E.globalIndex;T.has(O)||(t(b,E),T.add(O))}}:C=E=>{let O=E.globalIndex;T.has(O)||(t(b,E),T.add(O))},r=m.get(I),P.forEach(E=>o.searchByType(3,E.extendOfSize(r),I,C))}T.clear()}p.recycle(),o.multiLayerMap.delete(11)}function u(){let p=new Set(o.multiLayerMap.keys());for(let[m,g]of o.multiLayerMap){for(let[,y]of g)for(let[b,P]of o.singleLayerMap)for(let[T,I]of P)if(I!=null)for(let C of y.items){let E=C.item;r=JA.getShapePairMaxClearance(m,b,T),r!=0&&I.search(E.buildBBox().extendOfSize(r),O=>{t(E,O)})}p.delete(m)}}function d(){let p=new Set(o.multiLayerMap.keys());for(let[m,g]of o.multiLayerMap){for(let[,y]of g){let b=new Map;for(let P of p)r=JA.getShapePairMaxClearance(m,P),b.set(P,r);for(let P of p){e=P==m;for(let T of y.items)n.shape=T.item,r=b.get(P),o.searchByType(2,n.shape.buildBBox().extendOfSize(r),P,n.check.bind(n))}}p.delete(m)}}h(),u(),d()}var ule=class{constructor(t){this.filter=new K1;this.isOpenDRCCustomCheck=t}run(t){return this.filter.checkSameNet=t.spacingCheckSameNet,this.excludeCheckPair=t.excludeCheckPair,this}updates(t){let e=new tG,r=sn.getInstance().drcMap,i=0,n=null,s=r.size;lze(r,(a,l)=>{n!==a&&(i++,n=a),this.getModelPair(a,l).forEach(c=>e.check(c)),t(i/s)})}getModelPair(t,e){let r=[];if(this.excludeCheckPair&&!this.excludeCheckPair([t,e]))return r;this.filter.check(t,e)&&r.push([t,e,3]);let i=oi.getModelPairHoleStatus(t,e);if(i!==3){let n=s=>{(this.isOpenDRCCustomCheck?this.filter.checkHole(t,e,s):this.filter.commonCheck(t,e,s))&&r.push([t,e,s])};n(i),i===2&&(n(1),n(0))}return r}};var GEe=class{constructor(){this.progress=new D3}flush(){return this.shapes=new RT().shapes,this}initConfig(){u9.init(),ND.init(),Uf.init(),A5.init()}checkSpecifications(t=this.shapes){return this.initConfig(),this.checkSpecs(),ND.checkNetLength(t),xV.checkNetLength(t),A5.checkNetLengthTolerance(t),m9&&new eG().checkCreepage(),this.shapes.length=0,this}spacingError(t={},e=Qa.getInstance().isOpenDRCCustomCheck){this.progress.reset(),this.progress.onProgress(r=>{var i;(i=t.onProgress)==null||i.call(t,r),!t.disableProgressFromWorker&&this.handleUpdateProgressFromWorker(r,t.maxProgressFromWorker)}),new ule(e).run(t).updates(r=>this.progress.updateProgress(r))}handleUpdateProgressFromWorker(t,e){self.workerBus!=null&&(e=e||1,t=t*e,self.workerBus.publish("progressUpdate",{ratio:t,descripte:"Design rule check"}))}checkSpecs(){let t=sn.getInstance().drcMap,e=t.singleLayerMap.get(0),r=t.multiLayerMap.get(5);if(e)for(let[,i]of e)for(let n of i.items){let s=n.item;if(oi.getShapeNetDiff(s)!=null){ND.checkDiffWidth(s);continue}u9.checkTrackWidth(s)}if(r)for(let[,i]of r)for(let n of i.items)MD.checkBindVia(n.item),Uf.checkVia(n.item)}},cze=new GEe;function Ivt(o){let t=[],e=Qa.getInstance(),r=sn.getInstance().ruleHelper.getRuleForViaRadius(o),i=e.isCheck(e.holeSize.minViaSize),n=e.isCheck(e.holeSize.maxViaSize),s=o.center,a=o.globalIndex,l=r.name,c=xe(o.radius*2,2),h=xe(o.holeRadius*2,2);return n&&c>xe(r.maxRadius*2,2)||i&&c<xe(r.minRadius*2,2)?t.push({position:s,name:l,obj1:a,type:!0,radius:o.radius,minRadius:r.minRadius,maxRadius:r.maxRadius,layerIds:oi.getMultiShapeEffectLayers(o)}):(n&&h>xe(r.maxInner*2,2)||i&&h<xe(r.minInner*2,2))&&t.push({position:s,name:l,obj1:a,type:!1,radius:o.holeRadius,minRadius:r.minInner,maxRadius:r.maxInner,layerIds:oi.getMultiShapeEffectLayers(o)}),t}function hze(o){let t=[];for(let e=0;e<o.length;e++)Ivt(o[e]).forEach(r=>{t.push(r)});return t}function Cvt(o){let t=[],e=sn.getInstance().ruleHelper.getRuleForBlind(o);if(o.type!==1)return t;let r=o.name,i=e.name,n=e.getBlindVia(r);return n!=null&&(n.startLayer==o.startLayer&&n.endLayer==o.endLayer||t.push({position:o.center,name:i,obj:o.globalIndex,startLayer:o.startLayer,endLayer:o.endLayer,layerIds:oi.getMultiShapeEffectLayers(o)})),t}function uze(o){let t=[];for(let e=0;e<o.length;e++)Cvt(o[e]).forEach(r=>{t.push(r)});return t}var dle=(e=>(e[e.new=1]="new",e[e.log=!window["META-PANELIZE-ENV"]&&/\bRealTimeDRCLog\b/.test($().location.search)?1:0]="log",e))(dle||{});function UEe(o){o=o instanceof Set?Array.from(o):o;let t=new Set;for(let e of o)if(!e.model.isEmpty)if(e instanceof Ph){let r=e.getItems();for(let i of r)t.add(i);UEe(r)}else if(e instanceof Me){t.add(e);let r=e.getItems();for(let i of r)t.add(i)}else if(e instanceof mt){let r=e.getParent();r instanceof ct&&t.add(r)}else if(e instanceof vt){let r=e.getParent();r instanceof ct&&t.add(r)}else t.add(e);return Array.from(t)}var Pb=class{static runWithStrategy(t,e){if(!ce.pcbConfig.displayComponentSpacing)return;let r=this.activeContext;this.activeContext=t;try{e()}finally{this.activeContext=r}}static getCurrentStrategy(){return this.activeContext||vC.createDefault()}};Pb.activeContext=null;var vC=class{static createSingleComponentStrategy(){return{checkSpecifications:!1,preFilter:(t,e)=>!!(e&&e=="Component")}}static createMultiItemStrategy(t){return{checkSpecifications:!1,preFilter:(e,r)=>!!(r&&r=="Component"),postFilter:e=>t.selectedItems.has(e)}}static createDefault(){return{checkSpecifications:!0}}};function ple(o){let t=Svt(o);return Avt(t)}function Svt(o){let t=new Map,{preFilter:e,postFilter:r}=Pb.getCurrentStrategy();return o.forEach(i=>{let n=i.model,s=Vt.search(n.buildBBox().extendOfSize(Rie.getShapeMaxClearance(n)),(a,l)=>(e?e(a,l):!0)&&HEe(a,l)&&Evt(n.layerId,a),!0).getAllItems();for(let a of s)if(a.globalIndex!==i.globalIndex){if(r&&r(a))continue;t.has(i)?t.get(i).shape.add(a):t.set(i,{shape:new Set().add(a)}),a.model instanceof lr&&a.model.type==="Constraint Region"&&(!t.get(i).constraint||n.globalIndex<t.get(i).constraint.globalIndex)&&(t.get(i).constraint=a)}}),t}function HEe(o,t){return!!(t&&t!="Ratline"&&Ovt(o))}function Evt(o,t){return o===12||o===11?!0:t==o||t==12||t==11}function Ovt(o){return mp(o)||o==11}function Avt(o){let t=new Map,e=[];return o.forEach((r,i)=>{let{shape:n,constraint:s}=r;t.set(i,n),s&&s.model instanceof lr&&e.push({constraint:s.model,shape:i.model})}),sn.getInstance().realeTime(e),t}function fle(o){let t=new Map;return o.forEach((e,r)=>{let i=dze(r);t.has(i)||t.set(i,new Set),e.forEach(n=>t.get(i).add(dze(n)))}),t}function dze(o){return o.model}function pze(o,t){return o?o.filter(t?e=>e&&!(e instanceof Pn):e=>e).filter(e=>{let r=be.getLayer(e.layerId);return!(e.layerId!=null&&e.layerId!=12&&e.layerId!=11&&r&&!r.isCopperLayer())}).filter(e=>{if(e instanceof Ye){switch(e.type){case"Line":case"Prohibited Region":case"Fill Region":case"Board Outline":case"Slot Region":case"TearDrop":return!0}return!1}return!0}):[]}function rG(o,t,e){let r=[];o.check(t,e)&&r.push(3);let i=oi.getModelPairHoleStatus(t,e);if(i!==3){let n=s=>{(Qa.getInstance().isOpenDRCCustomCheck?o.checkHole(t,e,s):o.commonCheck(t,e,s))&&r.push(s)};n(i),i===2&&(n(1),n(0))}return r}function fze(o){this.isOpenDRCCustomCheck=Qa.getInstance().isOpenDRCCustomCheck,Qa.getInstance().isOpenDRCCustomCheck=!1;let t=[],e=new K1;return o.forEach((r,i)=>{r.forEach(n=>{rG(e,i,n).forEach(s=>{t.push([i,n,s])})})}),Qa.getInstance().isOpenDRCCustomCheck=this.isOpenDRCCustomCheck,t}function Y5(o){let t=new tG;return o.forEach(e=>t.check(e)),t.getResult()}var _vt="realtime_drc",mze="=================="+_vt+"==================";function WEe(o,t,e=dle.log){if(o instanceof Set&&(o=Array.from(o)),!o.length||x.getInstance().doctype!=3)return!0;e&&(console.log(mze),console.log("cin:",o),console.time("time")),Eo.deleteByPcbItem(o),o=o.filter(c=>HEe(c.layerId,c.model.modelType)),o=UEe(o),o=pze(o,t);let r=ple(o),i=fle(r),n=fze(i),s=Y5(n),a=uf.checkSpacing(s),l=vvt(o);return Eo.syncFromContentModel(),Eo.deleteCopperClearanceError(),sn.getInstance().clear(),e&&(console.timeEnd("time"),console.log("error",{...s,...a,...l}),console.log(mze)),!o.find(c=>pi.getInstance().hasSafeErrorIgnoreCopper(c.globalIndex))}function vvt(o){let t=n(),e=s(),r=hze(t),i=uze(t);return r.forEach(a=>{pi.getInstance().addRadiusError(a.position,a.name,a.obj1,a.type,a.radius,a.minRadius,a.maxRadius,a.layerIds,!1)}),i.forEach(a=>{pi.getInstance().addBlindError(a.position,a.name,a.obj,a.startLayer,a.endLayer,a.layerIds)}),e.forEach(a=>{u9.checkTrackWidth(a)}),{viaSize:r,blindVia:i};function n(){let a=[];return o.forEach(l=>{l.model instanceof It&&a.push(l.model)}),a}function s(){let a=[];return o.forEach(l=>{l.model instanceof yt&&a.push(l.model)}),a}}var iG=class{constructor(t){this._switch=!1;this.initPCB=!1;t&&(this.initPCB=!0)}get switch(){return this._switch}set switch(t){this._switch=t}realtimeCheckItems(t){return this._switch?(ie.publish("updateRtree",""),WEe(t,this.initPCB?(this.initPCB=!1,!0):!1)):!0}realtimeCheckItemsIgnoreSwitch(t){return WEe(t,this.initPCB?(this.initPCB=!1,!0):!1)}checkItems(t){if(x.getInstance().doctype!=3)return!0;let e=new Set;if(t.forEach(s=>{this.getCheckItems(s,e)}),Eo.deleteByPcbItem(e),e=this.filterItems4Layer(e),e.size==0)return!0;let r=new Nf(nP()),i=[];this.initPCB?(e.forEach(s=>{let a=s.model;a instanceof ki&&a&&!(a instanceof Pn)&&i.push(a)}),this.initPCB=!1):e.forEach(s=>{let a=s.model;a instanceof ki&&a&&i.push(a)}),sn.getInstance().initialEnv(r),this.checkDispatch(e),cze.flush().spacingError({},!1);let n=!0;for(let s of e)if(pi.getInstance().hasSafeErrorIgnoreCopper(s.globalIndex)){n=!1;break}return Eo.syncFromContentModel(),Eo.deleteCopperClearanceError(),sn.getInstance().clear(),n}checkDispatch(t){for(let e of t)e instanceof Ue?u9.checkTrackWidth(e.model):e instanceof Ge&&(Uf.checkVia(e.model),MD.checkBindVia(e.model))}checkNetLength(t){let e=this.getModels(t),r=new Map;for(let i of t){let n=i.model,s=n?n.modelType:void 0;if(n&&(s==="ArcTrack"||s==="Track"||s=="Pad"&&i.getParent()!=null)){let a=i.net;if(a!=""&&r.get(a)===void 0){let c=ze.getNetLength(a);r.set(a,c)}}}xV.checkNetLength(e,r)}checkNetLengthTolerance(t){let e=this.getModels(t),r={};for(let i of t)if(i instanceof Ue){let n=i.net;if(n!=""&&r[n]===void 0){let a=ze.getNetLength(n);r[n]=a}}A5.checkNetLengthTolerance(e,r)}checkDifferentPairLength(t){let e=this.getModels(t);ND.checkNetLength(e)}checkConnect(){Yae.checkConnect()}getCheckItems(t,e){if(!t.isEmpty)if(t instanceof Ph)t.getItems().forEach(i=>{this.getCheckItems(i,e)});else if(t instanceof Me)e.add(t),t.getItems().forEach(i=>{e.add(i)});else if(t instanceof mt){let r=t.getParent();r instanceof ct&&e.add(r)}else if(t instanceof vt){let r=t.getParent();r instanceof ct&&e.add(r)}else e.add(t)}filterItems4Layer(t){let e=new Set;for(let r of t){let i=be.getLayer(r.layerId);r.layerId!=null&&r.layerId!=12&&r.layerId!=11&&i&&!i.isCopperLayer()||e.add(r)}return e}getModels(t){let e=Array.isArray(t)?t.length:t.size,r=new Array(e),i=-1;for(let n of t)i++,r[i]=n.model;return r}checkClearanceFast(t,e=!1){if(t.isEmpty||!(t.model instanceof ki))return!0;let r=G1(t.model),i=te.getInstance().getItemMaxClearance(r),n=t.buildBBox().extendOfSize(i),s=Vt.search4Types(n,Z8e).getAllItems(),a=[];s.forEach(p=>{let m=p.model;p.isEmpty||p==t||!(m instanceof ki)||a.push(m)});let l=this.getConstrToShapeMap(a);sn.getInstance().ruleHelper.constraintMap.updateMap(l);let h=new _V,u=new K1(e),d=!0;for(let p of a){let m=[t.model,p];if(!u.check(m[0],m[1]))continue;let g=h.check([m]),{fail:y}=uf.checkSpacing(g);if(y.length){d=!1;break}h.clearResult()}return sn.getInstance().clear(),d}getConstrToShapeMap(t){let e=new Set(t),r={};for(let i of e)i instanceof lr&&i.type==="Constraint Region"&&(r[i.globalIndex]=[],e.delete(i));for(let i of Object.keys(r))r[i]=e;return r}};var bze=nd(Lb());var xvt=Date.now()-performance.now(),yze=new ArrayBuffer(10),Rvt=new Float64Array(yze,0,1),zEe=new Uint8Array(yze),gze=-1,YEe=0;function Dvt(){let o=xvt+performance.now();return Rvt[0]=o,o===gze?YEe++:(YEe=0,gze=o),zEe[8]=Math.random()*1e3,zEe[9]=YEe,btoa(String.fromCharCode(...zEe))}var mle=class{constructor(t,e=Dvt()){this.rpcTicket=0;this.callBack=new Map;this.service=new Map;this.busy=!1;this.push=new Array;this.worker=t,this.uuid=e,this.worker.onmessage=r=>{let{topic:i,message:n,replyTopic:s}=r.data,a=this.service.get(i);if(a==null){let l=this.callBack.get(s);l!=null&&l(n),this.callBack.delete(s),this.busy=!1,this.next()}else{let l=null;try{l={success:!0,result:a(n)}}catch(c){l={success:!1,err:c}}this.worker.postMessage({topic:i,message:l,replyTopic:s})}},this.worker.onerror=r=>{throw new Error(r.message)}}next(){if(this.push.length>0){let t=this.push.shift();this.busy=!0,this.worker.postMessage(t)}}rpcService(t,e){e==null?this.service.delete(t):this.service.set(t,e)}rpcCall(t,e){return new Promise((i,n)=>{let s=`ThreadTool-${this.uuid}-${t}-${this.rpcTicket++}`;this.callBack.set(s,a=>{a.success?i(a.result):n(new Error(a.err))}),this.busy?this.push.push({topic:t,message:e,replyTopic:s}):(this.busy=!0,this.worker.postMessage({topic:t,message:e,replyTopic:s}))})}};var $D=class $D extends wi{constructor(){super(...arguments);this.busMap={};this.ratlineWorker=new Map;this.workerBus=new Map;this.i=0;this.id=0;this._workerStateMap={}}static getInstance(){return $D.manager==null&&($D.manager=new $D,$D.manager.initPool()),$D.manager}initPool(){}createWorker(e,r=void 0){let n=`&channel=${x.getInstance().channel}&cll=${self.PRO_LOG_LEVEL}`,s=e+n,a=new Worker(s,{name:r});return this.map.set(this.id,a),this.workerBus.set(this.i,new mle(a)),this.ratlineWorker.set(this.i++,a),a}addWorker(e,r=!1,i=void 0){let n=r?"":`&cll=${self.PRO_LOG_LEVEL}`,s=e+n,a=new Worker(s,{name:i});this.map.set(this.id,a);let l=new bze.WorkerMessageBridge(A.messageBus,a);return l.publish("workerName",this.id),this.busMap[this.id]=l,this.id++,l}deleteWorker(e){let r=this.map.get(e);r&&(r.terminate(),this.map.delete(e),delete this.busMap[e],this.clearWorkerState(e))}getLastWorkerId(){return this.id-1}hasWorker(e){return this.map.has(e)}getWorkerState(e,r){let i=this._workerStateMap[e];return i&&i[r]}setWorkerState(e,r,i){if(!this.hasWorker(e))return;let n=this._workerStateMap[e];n||(n=this._workerStateMap[e]={}),n[r]=i}clearWorkerState(e){delete this._workerStateMap[e]}};$D.manager=null;var pf=$D;var xC=class{encode(){var r;let t=x.getInstance(),e={uuid:t.id,docType:t.doctype,projectId:t.projectId,env:{tabId:t.tabId,windowTabId:(r=$())==null?void 0:r._TAB_ID_}};return this.initDrcRuleCustomConfig(e),e}initDrcRuleCustomConfig(t){if(t.options||(t.options={}),!t.options.ruleCustomConfig){let{config:e,isOpenDRCCustomCheck:r}=Qa.getInstance();t.options.ruleCustomConfig={config:e,isOpenDRCCustomCheck:r}}}};var jEe=class{filterD3Shell(t){let e=[];for(let r of t)if(r instanceof Ye)switch(r.type){case"3D Shell - Outline":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":case"3D Shell - Screw Pillar":case"3D Shell - Side Datum Line":e.push(r);break}return e}getAllItems(){let t=Xt.getAllItem(),e=pt.getAllItem(),r=Zt.getAllItem();return new Set([].concat(t,e,r))}},j5=new jEe;var X5=class X5{constructor(){this.openPcb=!1;this.init=!1}static getInstance(){return X5.manager==null&&(X5.manager=new X5),X5.manager}get bus(){return this._bus}set bus(t){this._bus=t}startPcb(t=!0){this.openPcb||(this.openPcb=!0,this.toggle(ce.pcbConfig.isRebuildCopperAuto,t))}modifyDynamicCopper(t){let e=!0;Wo.getInstance().getAllItem().length>0?e=!1:e=!0,this.toggle(t,e)}async toggle(t,e=!0){!this.openPcb||x.getInstance().isReadOnlyMode||(t===!0?await this.openDynamicCopper(e):this.closeDynamicCopper())}handleDynamicCopperResult(t){this.time?(clearTimeout(this.time),this.time=null):A.publish("progressUpdate",[1,"copper build"],$()),t.hasRebuildCopper&&A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}handleDynamicCopperCalTime(){this.time=setTimeout(()=>{this.time=null,this.copperMask()},3e3)}copperMask(){A.publish("progressUpdate",[.5,"copper build"],$())}async openDynamicCopper(t=!0){this.workerName==null&&await this.addWorker(t)}closeDynamicCopper(){this.workerName!=null&&this.deleteWorker()}async addWorker(t=!0){var c;let e=x.getInstance(),r=e.id,i=e.projectId,n={uuid:r,docType:e.doctype,projectId:i,env:{tabId:e.tabId,windowTabId:(c=$())==null?void 0:c._TAB_ID_},options:{data:{rebuildCopper:t,currClient:e.compiler.consistencyManager.getClient()}}},s=pf.getInstance(),a=s.addWorker(`editor?entry=pcb-worker.js${$().location.search.replace(/\?/,"&")}`);this.bus=a;let l="dynamicCopperInWorker";this.workerName=s.getLastWorkerId(),await a.rpcCall(l,{world:n})}deleteWorker(){pf.getInstance().deleteWorker(this.workerName),this.workerName=null}async saveCopper(){return this.workerName?(await this._bus.rpcCall("dynamicCopperSaveInWorker",{})).message:{success:!0}}};X5.manager=null;var RC=X5;function XEe(o,t=0){setTimeout(()=>{if(Ya.modelIsBuilt){let e;typeof o=="string"?e=JSON.parse(o):e=o,o=null,wvt(e)}else XEe(o,50)},t)}function wvt(o){console.log("dealRatlineResultFromWorker","======================>","start",new Date().getTime());let t="ratlineResultFromWorker-time";pn(t);let{workerName:e,ratlineRes:r}=o,i=pf.getInstance(),n=i.getWorkerState(e,"mainThreadRunEnd"),s=i.getWorkerState(e,"delayCopper");i.deleteWorker(e);let a=r.map(u=>u.net);Mh.input(r);let l=Vh,c=new Array;for(let u of a){let d=l.getNet(u);d!=null&&(c.push(d.name),d.showRatline=d.showRatline)}c.length&&A.publish("updateRatlineNet",fX(c),$()),Mn.getInstance().allowPull=!0,Ya.rebuildingRatlineInWorker=!1,Ya.needFlushService&&A.publish("flushService",""),console.log("\u98DE\u7EBF\u7ED3\u679C\u5904\u7406\u5B8C\u6BD5"),s&&A.publish("DelayCopper",""),n&&A.publish("hideLoading","",$()),RC.getInstance().startPcb(!!s),Bi(t);let h="createPcbEditorToRendered-time";bre(h)&&(Bi(h),Pre())}var Mvt=An.getInstance(),Nvt=Tn.getInstance(),qEe=(()=>{let o=Math.PI/4,t=o*3,e=o*5,r=o*7;return{ANGLE45:o,ANGLE135:t,ANGLE225:e,ANGLE315:r}})(),rp={UP:new S(0,1),LOW:new S(0,-1),LEFT:new S(-1,0),RIGHT:new S(1,0),LEFT_UP:new S(-1,1).normalize(),LEFT_LOW:new S(-1,-1).normalize(),RIGHT_UP:new S(1,1).normalize(),RIGHT_LOW:new S(1,-1).normalize()},Pq=class{static createId(){return"DRCWorkerBatchFanout"+this.id++}};Pq.id=0;var Tq=class{constructor(t,e,r){this.tracks=[];this.padId=t,this.tracks.push(...e),this.via=r}getAll(){return[].concat(this.tracks,[this.via])}getLastTrack(){return this.tracks[this.tracks.length-1]}getEnd(){return this.tracks[this.tracks.length-1]}getFanoutDirect(){return this.getLastTrack().direct}getViaMaxRadius(){return Math.max(this.via.radius,this.via.holeRadius)}},gle=class{constructor(t){this.env=t}fanoutGenerate(t,e,r){if(!this.validBeforeFanout(t))return null;let i=this.getFanoutPath(t,e,r);if(i.length){let n=[],s=this.getTrackLayerId(t),a=this.getTrackWidth(t);for(let u of i){let d=Mvt.addTrack(Pq.createId(),s,u.start(),u.end(),a,!1,t.net);n.push(d)}let l=this.createVia(t),c=i[i.length-1].end();return l.center=c,this.modifyViaSize(l,s),new Tq(t.globalIndex,n,l)}return null}modifyViaSize(t,e){let{config:r}=this.env;if(r.via.sizeType==="FollowRule"){let i=t.startLayer,n=t.endLayer,s=Jl.getInstance();s.init();let a=s.searchConstraint(t.center.bbox());if(i!==1||n!==2){let c=i===1,h=n===2,u=$e.getInstance().getAllCopperLayer().map(g=>g.layerId);u.sort((g,y)=>g==1||y==1?g==1?-1:1:g==2||y==2?g==2?1:-1:g-y);let d=u.indexOf(i),p=u.indexOf(n),m=u.slice(d,p+1);c||(m=m.filter(g=>g!=1)),h||(m=m.filter(g=>g!=2)),a=a.filter(g=>{let y=g.layerId;return m.indexOf(y)>=0||y==12})}let l=JF(a);l&&(t.radius=l.radius,t.holeRadius=l.innerRadius),s.clear()}}validBeforeFanout(t,e=!0){let r=this.env.needFanoutSet,i=this.env.config,n=i.via;if(!r.has(t)||!i.includeNoNet&&!t.net)return!1;let s=null;if(n.type==="Blind"&&(s=this.getBlindViaRule(t),s==null))return!1;if(e){let a=this.getTrackLayerId(t);if(t.layerId!==12&&a!==t.layerId||s&&!Ub(a,1,s.startLayer,s.endLayer))return!1}else if(t.layerId!==12&&s&&!Ub(t.layerId,1,s.startLayer,s.endLayer))return!1;return!0}getFanoutPath(t,e,r){let i=[],n=t.bbox,s=t.center,a=Math.max(n.width(),n.height());if(this.isOrthoDirect(e)){let l=new M(s,s.add(e.mul(a))),c=this.getInters(t,l);xr(c,(d,p)=>p.distance2(s)-d.distance2(s));let u=c[0].add(e.mul(r));l=new M(s,u),i.push(l)}else{let l=e.angleX(),c;ne.eq(l,qEe.ANGLE45)?c=n.UR():ne.eq(l,qEe.ANGLE135)?c=n.UL():ne.eq(l,qEe.ANGLE225)?c=n.LL():c=n.LR();let h=new no,u=h.degree45(e,s,c),d=h.degree45(u[2].sub(u[1]).normalize(),s,c),p=new M(d[0],d[1]),m=new M(d[1],d[2]);ne.eq(p.direct.cross(m.direct),0)?i.push(new M(p.start(),m.end())):ne.eq(m.length(),0)?i.push(p):i.push(p,m);let g=i[i.length-1],y=this.getInters(t,g);xr(y,(T,I)=>I.distance2(s)-T.distance2(s));let b=y[0];b==null&&(b=m.start());let P=b.add(e.mul(r));g=new M(g.start(),P),i[i.length-1]=g}return i.filter(l=>ne.greater(l.length(),0))}getInters(t,e){let r=[];if(t.layerId===12){let n=[1,t.getOneInnerInUse(),2].filter(Boolean);for(let s of n){let a=bh.getPadCache(t,s);r.push(a)}}else{let n=bh.getPadCache(t,t.layerId);r.push(n)}let i=[];for(let n of r){let s=n.shape.primitives;for(let a=0;a<s.length;a++){let l=Tt(e,s[a]);ig(l,i)}}return i}isOrthoDirect(t){return ne.eq(t.x,0)||ne.eq(t.y,0)}createVia(t){let i=this.env.config.via.type==="Blind"?1:0,n=t.net,s="",a=1,l=2;if(i===1){let m=this.getBlindViaRule(t);s=m.name,a=m.startLayer,l=m.endLayer}let c=t.center,{radius:h,holeRadius:u}=this.getViaSize(t),d=te.getInstance().getSolderExpansionByNet(n);return Nvt.addVia(Pq.createId(),i,s,a,l,n,h,c,u,!1,1,d.viaTopExpansion,d.viaBottomExpansion)}getTrackLayerId(t){if(t.layerId!==12)return t.layerId;let e=$e.getInstance(),r=e.activeLayer;return gs(e.getLayer(r).type)?r:1}getBlindViaRule(t){let{config:e,ruleHelper:r}=this.env,i={net:t.net},n=r.getRuleForBlind(i);return n.isDefault?n.getBlindVia(e.via.blindName):null}getTrackWidth(t){let{config:e,ruleHelper:r}=this.env,i=1;if(e.track.widthRuleType==="Custom")i=e.track.width;else{let n={id:t.globalIndex,net:t.net,shapeType:t.layerId==12?2:1,layerId:this.getTrackLayerId(t)};oi.getShapeNetDiff(n)?i=r.getRuleForDiffWidth(n).getStrokeWidthDefault(this.getTrackLayerId(t)):i=r.getRuleForTrackWidth(n).getDefaultWidth(this.getTrackLayerId(t))}return i}getViaSize(t){let{config:e,ruleHelper:r}=this.env,i=1,n=1;if(e.via.sizeType==="Custom")i=e.via.outsideDiameter,n=e.via.insideDiameter;else{let s={id:t.globalIndex,net:t.net,shapeType:t.layerId==12?2:1,layerId:null},a=r.getRuleForViaRadius(s);i=a.defalutRadius*2,n=a.defalutInner*2}return{radius:i/2,holeRadius:n/2}}};var yle=class{constructor(t){this.env=t,this.tool=new gle(t)}bgaFanout(t){let e=this.tool,r=this.env.config,i=r.bgaFanoutDirect==="45";t=this.filterDiffSizePads(t);let n=this.getMeanSize(t),s=this.getGroupBBox(t),a,l;i?(a=this.getOrthoSubregion(t,s),l={leftUp:rp.LEFT_UP,rightUp:rp.RIGHT_UP,leftLow:rp.LEFT_LOW,rightLow:rp.RIGHT_LOW}):(a=this.getObliqueSubregion(t,s),l={up:rp.UP,low:rp.LOW,left:rp.LEFT,right:rp.RIGHT});let c=new Set;r.fanoutOuter2Rows||(c=this.getOuterRowPadSet(2,t,s,n,!i));let h=p=>{let m=i?this.getOrthoRegionKey(a,p):this.getObliqueRegionKey(a,p);return l[m]},u=this.calcViaPadSpacing(t,h),d={};for(let p of Object.keys(a))for(let m of a[p]){if(c.has(m))continue;let g=l[p],y=e.fanoutGenerate(m,g,u);y&&(d[m.globalIndex]=y)}return d}getOrthoRegionKey(t,e){return t.leftUp.has(e)?"leftUp":t.rightUp.has(e)?"rightUp":t.leftLow.has(e)?"leftLow":"rightLow"}getObliqueRegionKey(t,e){return t.up.has(e)?"up":t.low.has(e)?"low":t.left.has(e)?"left":"right"}getOrthoSubregion(t,e){let r=new _e;t.forEach(u=>r.ext1(u.bbox));let i=e.center(),n=(u,d)=>new _e().ext2(u).ext2(d).build1(),s=n(i,e.UL()),a=n(i,e.LL()),l=n(i,e.UR()),c=n(i,e.LR()),h={leftUp:new Set,leftLow:new Set,rightUp:new Set,rightLow:new Set};for(let u of t){let d=u.bbox;s.intersection1(d)?h.leftUp.add(u):l.intersection1(d)?h.rightUp.add(u):a.intersection1(d)?h.leftLow.add(u):c.intersection1(d)&&h.rightLow.add(u)}return h}getGroupBBox(t){let e=new _e;return t.forEach(r=>e.ext1(r.bbox)),e.build1()}filterDiffSizePads(t){let e=1/0,r=t.map(s=>{let a=this.getPadSize(s);return e=Math.min(e,a),{pad:s,size:a}});xr(r,(s,a)=>s.size-a.size);let i=[[r[0]]];for(let s=1;s<r.length;s++){let a=i[i.length-1];Math.abs(a[0].size-r[s].size)<=e?a.push(r[s]):i.push([r[s]])}return xr(i,(s,a)=>a.length-s.length),i[0].map(s=>s.pad)}getMeanSize(t){let e=0;return t.forEach(i=>{e+=this.getPadSize(i)}),e/t.length}getPadSize(t){return Math.max(t.bbox.width(),t.bbox.height())}getOuterRowPadSet(t,e,r,i,n=!1){let s=(C,E)=>{let O=new S(E.direct.y,-E.direct.x).normalize(),_=E.start().sub(C);return Math.abs(O.dot(_))},a=new M(r.UR(),r.UL()),l=new M(r.LL(),r.LR()),c=new M(r.UL(),r.LL()),h=new M(r.LR(),r.UR());if(n){let C=a.center().add(new S(0,1).mul(a.length()/2)),E=l.center().add(new S(0,-1).mul(l.length()/2)),O=c.center().add(new S(-1,0).mul(c.length()/2)),_=h.center().add(new S(1,0).mul(h.length()/2));a=new M(C,_),l=new M(E,O),c=new M(O,C),h=new M(_,E)}let u=1/0,d=new Array(t).fill(u),p=new Array(t).fill(u),m=new Array(t).fill(u),g=new Array(t).fill(u);for(let C=0;C<t;C++)for(let E of e){let O=E.center,_=s(O,a),R=s(O,l),v=s(O,c),D=s(O,h);(C===0||_>d[C-1]+i)&&(d[C]=Math.min(d[C],_)),(C===0||R>p[C-1]+i)&&(p[C]=Math.min(p[C],R)),(C===0||v>m[C-1]+i)&&(m[C]=Math.min(m[C],v)),(C===0||D>g[C-1]+i)&&(g[C]=Math.min(g[C],D))}for(let C=t-1;C>=1;C--)isFinite(d[d.length-1])||d.pop(),isFinite(p[p.length-1])||p.pop(),isFinite(m[m.length-1])||m.pop(),isFinite(g[g.length-1])||g.pop();let y=d[d.length-1]+i/2,b=p[p.length-1]+i/2,P=m[m.length-1]+i/2,T=g[g.length-1]+i/2,I=new Set;for(let C of e){let E=C.center,O=s(E,a),_=s(E,l),R=s(E,c),v=s(E,h);(ne.greatereq(y,O)||ne.greatereq(b,_)||ne.greatereq(P,R)||ne.greatereq(T,v))&&I.add(C)}return I}viaInPadFanout(t){let e=this.tool;t=this.filterDiffSizePads(t);let r={};for(let i of t)if(e.validBeforeFanout(i,!1)){let n=e.createVia(i);n!=null&&(r[i.globalIndex]=new Tq(i.globalIndex,[],n))}return r}commonFanout(t){let e=this.tool;t=this.filterDiffSizePads(t);let r=this.getCommonFanoutDirect(),i=this.calcViaPadSpacing(t,r),n={};for(let s of t){let a=e.fanoutGenerate(s,r,i);a&&(n[s.globalIndex]=a)}return n}getCommonFanoutDirect(){switch(this.env.config.fanoutType){case"Top":return rp.UP;case"Bottom":return rp.LOW;case"Left":return rp.LEFT;case"Right":return rp.RIGHT;case"UpperLeft":return rp.LEFT_UP;case"UpperRight":return rp.RIGHT_UP;case"LowerLeft":return rp.LEFT_LOW;case"LowerRight":return rp.RIGHT_LOW}return rp.UP}inOutFanout(t){let e=this.tool,r=this.env.config;t=this.filterDiffSizePads(t);let i=this.getMeanSize(t),n=this.getGroupBBox(t),s=this.getInOutSubregion(t,n,i),a=this.env.config.viaPadSpacing,l={up:rp.UP,low:rp.LOW,left:rp.LEFT,right:rp.RIGHT};r.fanoutType==="Inward"&&(l={up:rp.UP.mul(-1),low:rp.LOW.mul(-1),left:rp.LEFT.mul(-1),right:rp.RIGHT.mul(-1)});let c={};for(let h of Object.keys(s)){let u=0;for(let d of s[h]){let p=l[h];r.fanoutType==="OutOrIn"&&u%2!=0&&(p=p.mul(-1));let m=e.fanoutGenerate(d,p,a);m&&(c[d.globalIndex]=m,u++)}}return this.applyInOutMinChannelSpace(c,s),c}applyInOutMinChannelSpace(t,e){let r=this.env.config.minChannelSpace;for(let i of Object.keys(e)){let n=e[i].filter(s=>t[s.globalIndex]!=null);for(let s=1;s<n.length;s++){let a=n[s-1],l=n[s],c=t[a.globalIndex],h=t[l.globalIndex],u=c.via,d=h.via,p=c.getViaMaxRadius(),m=h.getViaMaxRadius(),g=u.center.distance1(d.center);if(ne.less(g-(p+m),r)){let y=r+(p+m),b=Math.sqrt(y*y-g*g),P=h.getLastTrack(),T=h.getFanoutDirect(),I=d.center.add(T.mul(b));d.center=I,P.end=I}}}}getInOutSubregion(t,e,r){let i=new Set(t),n=this.getPadHorizontalMatrix(i),s=this.getPadVerticalMatrix(i),a={up:[],low:[],left:[],right:[]},l=(()=>{var b,P,T,I;let d=n.length,p=s.length,m=(b=n[0][0])==null?void 0:b.center,g=(P=n[0][1])==null?void 0:P.center,y=(I=(T=n[1])==null?void 0:T[0])==null?void 0:I.center;return!(p==1&&d>2||p==2&&(d>2||d==2&&m&&g&&y&&ne.less(m.distance2(y),m.distance2(g))||d==1))})(),c=new Set,h=()=>{n[0].forEach(d=>{c.has(d)||(a.up.push(d),c.add(d))}),n[n.length-1].forEach(d=>{c.has(d)||(a.low.push(d),c.add(d))})},u=()=>{s[0].forEach(d=>{c.has(d)||(a.left.push(d),c.add(d))}),s[s.length-1].forEach(d=>{c.has(d)||(a.right.push(d),c.add(d))})};return l?(h(),u()):(u(),h()),a}getPadHorizontalMatrix(t){let e=this.env.fanoutMap,r=e.bbox(),i=[],n=new Set;for(let s of t){if(n.has(s))continue;let a=s.center,l=s.bbox.height()/4,c=new S(r.minX,a.y),h=new S(r.maxX,a.y);c=c.add(new S(0,1).mul(l)),h=h.add(new S(0,1).mul(-l));let d=new _e().ext2(c).ext2(h).build1(),p=e.searchByLayer(d),m=[s];n.add(s);for(let g of p)t.has(g)&&!n.has(g)&&m.push(g),n.add(g);this.sortPads(m,new S(1,0),g=>g),i.push(m)}return this.sortPads(i,new S(0,-1),s=>s[0]),i}getPadVerticalMatrix(t){let e=this.env.fanoutMap,r=e.bbox(),i=[],n=new Set;for(let s of t){if(n.has(s))continue;let a=s.center,l=s.bbox.width()/4,c=new S(a.x,r.minY),h=new S(a.x,r.maxY);c=c.add(new S(1,0).mul(l)),h=h.add(new S(1,0).mul(-l));let d=new _e().ext2(c).ext2(h).build1(),p=e.searchByLayer(d),m=[s];n.add(s);for(let g of p)t.has(g)&&!n.has(g)&&m.push(g),n.add(g);this.sortPads(m,new S(0,-1),g=>g),i.push(m)}return this.sortPads(i,new S(1,0),s=>s[0]),i}sortPads(t,e,r){let i=r(t[0]).center;return e=e.normalize(),xr(t,(n,s)=>{let a=r(n).center.sub(i),l=r(s).center.sub(i);return a.dot(e)-l.dot(e)}),t}getObliqueSubregion(t,e){let r=(d,p)=>{let m=new S(p.direct.y,-p.direct.x).normalize(),g=p.start().sub(d);return Math.abs(m.dot(g))},i=new M(e.UR(),e.UL()),n=new M(e.LL(),e.LR()),s=new M(e.UL(),e.LL()),a=new M(e.LR(),e.UR()),l=e.width(),h=e.height()/l,u={up:new Set,low:new Set,left:new Set,right:new Set};for(let d of t){let p=d.center,m=r(p,i),g=r(p,n),y=r(p,s),b=r(p,a),P=ne.lesseq(m,g),T=ne.lesseq(y,b),I=(P?m:g)/(T?y:b);ne.greatereq(h,I)?P?u.up.add(d):u.low.add(d):T?u.left.add(d):u.right.add(d)}return u}calcViaPadSpacing(t,e){if(!this.isPadCenter())return this.env.config.viaPadSpacing;let r=1,i=this.tool,{fanoutMap:n}=this.env,s=n.bbox(),a=Math.max(s.width(),s.height()),l=1/0,c=(u,d,p)=>{let m=p.start(),g=i.getInters(d,p);xr(g,(b,P)=>b.distance2(m)-P.distance2(m));let y=g[0];if(y){let b=m.distance1(y);if(ne.greater(b,0))return b}return 1/0};for(let u of t){let d=e instanceof S?e:e(u),p=i.getFanoutPath(u,d,0);if(!p.length)continue;let m=p[p.length-1].end(),g=new M(m,m.add(d.mul(a))),y=Math.max(u.bbox.width(),u.bbox.height())/2;if(i.isOrthoDirect(d)){let P=new _e().ext2(g.start()).ext2(g.end()).build1(),T=this.searchSameLayerPads(P,u);for(let I of T){let C=c(u,I,g);l=Math.min(l,C)}}else{let b=Math.min(y*2,3),P=Math.min(10,Math.ceil(g.length()/b)),T=g.length()/P,I=m;for(let C=0;C<P;C++){let E=I.add(d.mul(T)),_=new _e().ext2(I).ext2(E).build1(),R=this.searchSameLayerPads(_,u);for(let v of R){let D=c(u,v,g);l=Math.min(l,D)}if(isFinite(l))break;I=E}}}let h=l/2;return isFinite(h)?h:r}searchSameLayerPads(t,e){let r=e.layerId,i=this.env.fanoutMap,n=[];return r!==12?n=i.searchByLayer(t,r):n=i.searchByLayer(t),n=n.filter(s=>e!==s),n}isPadCenter(){let t=this.env.config;return["Inward","Outward","OutOrIn"].includes(t.fanoutType)?!1:t.viaPadSpacingType==="PadCenter"}};var Bvt=$n.getInstance(),Pio=te.getInstance(),ble=class{constructor(t){this.needFanoutSet=new Set;this.config=t}get fanoutMap(){return this._fanoutMap}set fanoutMap(t){this._fanoutMap=t}get ruleHelper(){return this._ruleHelper}set ruleHelper(t){this._ruleHelper=t}initialEnv(t,e){bh.clear();let r=Bvt.getAllItem();this.fanoutMap=new Nf(nP(r)),this.ruleHelper=new $S,this.updateConstraintMap(t),this.needFanoutSet=e}updateConstraintMap(t){let e=new Set,r=O4("Constraint Region"),i=new Nf(nP(r));for(let n of t){let s=new _e;n.forEach(l=>s.ext1(l.bbox)),i.searchByLayer(s.build1()).forEach(l=>e.add(l))}this.ruleHelper.constraintMap.updateByDRCMap(this.fanoutMap,Array.from(e))}};var Kio=$n.getInstance(),Zio=te.getInstance(),$Ee=class{constructor(t){this.progress=new D3;this.env=new ble(t)}fanout(t,e){this.initialProgress();let r=this.env.config,i=this.getPadGroups(t),n=this.getNeedFanoutSet(t,e);this.env.initialEnv(i,n),this.progress.updateProgress(.2);let s=this.fanoutGroups(i);r.ignoreDRC||this.deleteViolateDRCResult(s);let a=this.getFanoutModels(s);return this.progress.updateProgress(1),a}fanoutGroups(t){let e=new yle(this.env),r=this.env.config,i={},n=t.map(a=>a.length).reduce((a,l)=>a+l),s=0;for(let a of t){let l;switch(r.fanoutType){case"BGA":l=e.bgaFanout(a);break;case"ViaInPad":l=e.viaInPadFanout(a);break;case"Top":case"Bottom":case"Left":case"Right":case"UpperLeft":case"UpperRight":case"LowerLeft":case"LowerRight":l=e.commonFanout(a);break;case"Outward":case"Inward":case"OutOrIn":l=e.inOutFanout(a);break;default:l=e.bgaFanout(a)}for(let c of Object.keys(l))i[c]=l[c];s+=a.length,this.progress.updateProgress(.2+.55*(s/n))}return i}getNeedFanoutSet(t,e){let r=new Set(e),i=new Set;for(let n of t)n instanceof Je?r.has(n.globalIndex)||i.add(n):n instanceof vi&&n.getPads().forEach(s=>{r.has(s.globalIndex)||i.add(s)});return i}getPadGroups(t){let e=new Set,r=new Map;for(let i of t){if(i instanceof Je){let n=i.getParent();n instanceof vi&&(i=n)}if(!e.has(i)){if(i instanceof Je){let n=r.get("")||[];r.set("",n),n.push(i)}else if(i instanceof vi){let n=r.get(i.globalIndex)||[];r.set(i.globalIndex,n),n.push(...i.getPads())}e.add(i)}}return Array.from(r.values())}getFanoutModels(t){let e=[];for(let r of Object.keys(t)){let i=t[r].getAll();e.push(...i)}return e}deleteViolateDRCResult(t){let{config:e}=this.env,r=new Nf(nP());sn.getInstance().initialEnv(r),pi.getInstance().deleteAllError();let i=this.getFanoutModels(t),n=c=>this.progress.updateProgress(.75+.25*c);for(let c of i)c instanceof yt?e.track.widthRuleType==="FollowRule"&&u9.checkTrackWidth(c):c instanceof It&&(MD.checkBindVia(c),e.via.sizeType==="FollowRule"&&Uf.checkVia(c));let s=c=>c[0]instanceof Pn||c[1]instanceof Pn?!1:!(c[0]instanceof Cn||c[1]instanceof Cn);kD.checkSpacingError(i,{disableProgressFromWorker:!0,excludeCheckPair:s,onProgress:n}),sn.getInstance().clear();let a=new Set,l=pi.getInstance().getAllItem();for(let c of l)c instanceof sf||c instanceof eC?(a.add(c.obj1),a.add(c.obj2)):c instanceof rb?a.add(c.obj1):c instanceof Qy?a.add(c.obj):c instanceof Zy?(a.add(c.obj1),a.add(c.obj2)):c instanceof rP?a.add(c.obj):c instanceof tb&&a.add(c.obj1);for(let c of Object.keys(t)){let h=t[c];h.getAll().some(d=>a.has(d.globalIndex))&&(h.tracks.forEach(d=>{An.getInstance().delete(d,d.globalIndex)}),Tn.getInstance().delete(h.via,h.via.globalIndex),delete t[c])}pi.getInstance().deleteAllError()}initialProgress(){let t=this.progress;t.reset(),t.onProgress(e=>{self.workerBus!=null&&self.workerBus.publish("progressUpdate",{ratio:e,descripte:"batchFanout"})})}};function Pze(o,t,e){return new $Ee(t).fanout(o,e)}var Ple=class extends H1{constructor(e,r,i,n,s,a){super(e,r,i,s,a);this._octagon=null;this._mortonCode=null;this.width=n}get mortonCode(){return this._mortonCode===null&&(this._mortonCode=a3((this._startPoint.x+this._endPoint.x)/2,(this._startPoint.y+this._endPoint.y)/2)),this._mortonCode}get octagon(){if(this._octagon===null){let e=this.width/2,r=this._startPoint.x-this._endPoint.x,i,n;r<0?(i=this._startPoint,n=this._endPoint):(i=this._endPoint,n=this._startPoint);let s=i.x,a=i.y,l=n.x,c=n.y,h=a-c,u=s-e,d=l+e,p=e,m=-e;if(h<0?(m+=a,p+=c):(m+=c,p+=a),r===0||h===0)return new tC(u,d,m,p,m+u,d-m,u-p,p+d);{let g,y,b,P,T,I,C,E,O;return h<0?(g=1,y=1,C=Math.sqrt(e*e*(g*g+y*y)),E=g*s+y*a,O=g*l+y*c,b=Math.min(C+E,-C+E),P=Math.max(C+O,-C+O),g=-1,y=1,C=Math.sqrt(e*e*(g*g+y*y)),E=g*s+y*a,O=g*l+y*c,(c-a)/(l-s)>1?(T=Math.min(-C-O,C-O),I=Math.max(-C-E,C-E)):(T=Math.min(-C-E,C-E),I=Math.max(-C-O,C-O))):(g=-1,y=1,C=Math.sqrt(e*e*(g*g+y*y)),E=g*s+y*a,O=g*l+y*c,T=Math.min(-C-E,C-E),I=Math.max(-C-O,C-O),g=1,y=1,C=Math.sqrt(e*e*(g*g+y*y)),E=g*s+y*a,O=g*l+y*c,(c-a)/(l-s)>-1?(b=Math.min(C+E,-C+E),P=Math.max(C+O,-C+O)):(b=Math.min(C+O,-C+O),P=Math.max(C+E,-C+E))),new tC(u,d,m,p,b,I,T,P)}}return this._octagon}};var J1=class{static shore(t,e=new S(0,0)){return new ut(-t+e.x,t+e.x,-t+e.y,t+e.y)}static num(t,e,r,i){let n=[];for(;r--;)n.push(i?Math.floor(Math.random()*(e-t)+t):Math.random()*(e-t)+t);return n}static point(t,e){let r=this.num(t.minX,t.maxX,e),i=this.num(t.minY,t.maxY,e),n=[];for(let s=0;s<e;s++)n.push(new S(r[s],i[s]));return n}static line(t,e){let r=this.point(t,2*e),i=[];for(let n=0;n<e*2;n+=2)i.push(new M(r[n],r[n+1]));return i}static foTrack(t,e,r,i){let n=this.line(r,i),s=this.num(t,e,i),a=[];for(let l=0;l<i;l++)a.push(new Ple(null,null,null,s[l],new i0(n[l].start().x,n[l].start().y),new i0(n[l].end().x,n[l].end().y)));return a}static bbox(t,e,r,i){let n=this.point(t,i),s=this.num(e,r,i),a=[];for(let l=0;l<i;l++)a.push(this.shore(s[l],n[l]));return a}};var Tle=class{constructor(t){this.capacity=t}},Ile=class{constructor(){this.items=new Set;this.addItems=new Set;this.removeItems=new Set}insert(t){return this.items.has(t)?this:(this.addItems.add(t),this)}remove(t){return this.items.has(t)?(this.removeItems.add(t),this):this}bbox(){return this.flush(),this.root.bbox()}search(t){return this.flush(),this.root.search(t)}recycle(){this.items.clear(),this.addItems.clear(),this.removeItems.clear(),this.root.recycle()}flush(){this.chang&&(this.removeItems.forEach(e=>this.items.delete(e)),this.addItems.forEach(e=>this.items.add(e)),this.root=this.buildRoot(),this.removeItems.clear(),this.addItems.clear())}get chang(){return this.removeItems.size+this.addItems.size===0?0:(this.removeItems.forEach(t=>{this.addItems.has(t)&&(this.addItems.delete(t),this.removeItems.delete(t))}),this.removeItems.size+this.addItems.size)}};var Cle=class extends Tle{constructor(e,r){super(e);this._octagon=null;Array.isArray(r)?this.nodes=r:this.item=r}get octagon(){if(this._octagon===null)if(this.item===void 0){let e=this.nodes[0].octagon;for(let r=1;r<this.nodes.length;r++)e=e.union(this.nodes[r].octagon);this._octagon=e}else this._octagon=this.item.octagon;return this._octagon}search(e){let r=e instanceof ut?nh.converBBox(e):e;if(this.item===void 0){let i=[];return this.nodes.forEach(n=>{n.octagon.isIntersectOctagon(r)&&n.search(r).forEach(s=>i.push(s))}),i}else if(this.item.octagon.isIntersectOctagon(r))return[this.item]}recycle(){this._octagon=null,this.item=void 0,this.nodes=void 0}remove(e){throw new Error("Method not implemented.")}insert(e){throw new Error("Method not implemented.")}bbox(){throw new Error("Method not implemented.")}},Iq=class extends Ile{constructor(t){super(),this.capacity=t}buildRoot(){let t=Array.from(this.items).sort((e,r)=>e.mortonCode-r.mortonCode).map(e=>new Cle(this.capacity,e));for(;t.length!==1;){let e=[];for(let r=0;r<t.length;r+=this.capacity){let i=[],n=this.capacity+r>=t.length?t.length:r+this.capacity;for(let s=r;s<n;s++)i.push(t[s]);e.push(new Cle(this.capacity,i))}t=e}return this.root=t[0],t[0]}};var Sle=class{getAllPCBItem(){return new RT().shapes}getAllTrack(){return this.getAllPCBItem().filter(t=>t.modelType==="Track")}};function Tze(o,t=!0){if(t){console.log("throw new Error"+o?o:"");return}throw new Error(o||"")}var Ele=class{constructor(t){this._octagon=null;this.item=null;t instanceof qr?this.item=t:Tze()}octagon(){return this._octagon===null&&(this._octagon=nh.trackToOctagon(this.item.start,this.item.end,this.item.width)),this._octagon}},KEe=class extends Sle{main(){}mordonCode(){Ko.init(A);let e=[];for(let r=0;r<1e3;r++)for(let i=0;i<1e3;i++)e.push(new S(r,i));e.sort((r,i)=>a3(r.x,r.y)-a3(i.x,i.y));for(let r=0;r<999;r++)Ko.auto(new M(e[r],e[r+1]),ee.GREEN)}dynamicOctagonRtree(){let t=new NT(10),e=this.getAllTrack();e.forEach(r=>{t.insert(new Ele(r))}),console.log(e),Ko.init(A),t.items.forEach(r=>{let i=r.octagon().outline();Ko.auto(i)}),t.itor(r=>{},!0)}aa(){Ko.init(A);let t=J1.point(J1.shore(200,new S(0,0)),50);Ko.auto(t,ee.GREEN),t.sort((l,c)=>a3(l.x,l.y)-a3(c.x,c.y));let e=new _e;t.forEach(l=>{e.ext2(l)}),Ko.auto(e.build());let r=e.build(),i=r.UR(),n=r.LL(),s=t[0],a=t[0];t.forEach(l=>{l.distance1(i)<s.distance1(i)&&(s=l),l.distance1(n)<a.distance1(n)&&(a=l)}),Ko.auto(t[0],ee.BLUE),Ko.auto(t[t.length-1],ee.RED),Ko,a==t[0]&&console.log("ll: true"),s==t[t.length-1]&&console.log("lr: true")}a(){Ko.init(A),Ko.clear();let t=(()=>{let e=[];return Vt.map.forEach(r=>{r.forEach(i=>{i instanceof x0&&e.push(i)})}),e})().forEach(e=>{e.itor((r,i)=>{},!0)})}main1(){let t=new x0(10),e=this.getAllTrack();e.forEach(r=>{t.insert(new Ele(r))}),console.log(e),Ko.init(A),t.items.forEach(r=>{let i=r.octagon().outline();Ko.auto(i)}),t.itor(r=>{})}bvhSPilt(){Ko.init(js.getBus());let t=J1.foTrack(3,6,J1.shore(1e3),10),e=new Iq(3);t.forEach(r=>{Ko.auto(r.conver(),ee.WHITE),r.octagon.get().forEach(i=>{Ko.auto(i.conver(),ee.WHITE)}),e.insert(r)}),e.flush(),this.drawOct(e.root.octagon,ee.GREEN),e.root.nodes.forEach(r=>{r.nodes.forEach(i=>{this.drawOct(i.octagon,ee.RED)})})}drawOct(t,e){t.get().forEach(r=>{Ko.auto(r.conver(),e)})}bvhSearch(){Ko.init(js.getBus());let t=J1.foTrack(3,6,J1.shore(500),10),e=new Iq(3);t.forEach(i=>{Ko.auto(i.conver(),ee.WHITE),i.octagon.get().forEach(n=>{Ko.auto(n.conver(),ee.WHITE)}),e.insert(i)});let r=J1.bbox(J1.shore(500),60,100,1)[0];Ko.auto(r,ee.GREEN),e.search(r).forEach(i=>{Ko.auto(i.conver(),ee.RED),i.octagon.get().forEach(n=>{Ko.auto(n.conver(),ee.RED)})})}converBBox(){Ko.init(js.getBus());let t=J1.bbox(J1.shore(500),60,100,1)[0];Ko.auto(t,ee.GREEN),Ko.clear(),nh.converBBox(t).get().forEach(e=>{Ko.auto(e.conver(),ee.BLUE)})}union(){Ko.init(js.getBus());let t=J1.foTrack(3,6,J1.shore(100),2);Ko.auto(t[0].conver(),ee.GREEN),Ko.auto(t[1].conver(),ee.BLUE),t[0].octagon.get().forEach(e=>{Ko.auto(e.conver(),ee.WHITE)}),t[1].octagon.get().forEach(e=>{Ko.auto(e.conver(),ee.WHITE)}),t[0].octagon.union(t[1].octagon).get().forEach(e=>{Ko.auto(e.conver(),ee.RED)})}intersectionTest(){Ko.init(js.getBus());let t=J1.foTrack(3,6,J1.shore(100),2);Ko.auto(t[0].conver(),ee.GREEN),Ko.auto(t[1].conver(),ee.BLUE);let e=t[0].octagon.isIntersectOctagon(t[1].octagon)?ee.RED:ee.WHITE;t[0].octagon.get().forEach(r=>{Ko.auto(r.conver(),e)}),t[1].octagon.get().forEach(r=>{Ko.auto(r.conver(),e)})}},Ize=new KEe;var dYe=nd(Lb());function Cze(o=!1){let t=new Array,e=Cr.getAllItem();if(o)for(let d of e){let p=d.getItems();for(let m of p)(3==m.layerId||4==m.layerId)&&d.silkColor!=null&&t.push(m)}else for(let d of e)d.silkColor!=null&&t.push(d);let r=Ln.getAllItem();for(let d of r)(3==d.layerId||4==d.layerId)&&d.getParent()==null&&d.silkColor!=null&&t.push(d);let i=Go.getAllItem();for(let d of i)(3==d.layerId||4==d.layerId)&&d.getParent()==null&&d.silkColor!=null&&t.push(d);let n=ti.getAllItem();for(let d of n)(3==d.layerId||4==d.layerId)&&d.silkColor!=null&&(d.getParent()==null||d.getParent()!=null&&d.key!="")&&t.push(d);let s=Xt.getAllItem(),a=pt.getAllItem(),l=Zt.getAllItem(),c=[].concat(s,a,l);for(let d of c)(3==d.layerId||4==d.layerId)&&d.getParent()==null&&d.silkColor!=null&&t.push(d);let h=Uo.getAllItem();for(let d of h)(3==d.layerId||4==d.layerId)&&d.getParent()==null&&d.silkColor!=null&&t.push(d);let u=is.getAllItem();for(let d of u)(3==d.layerId||4==d.layerId)&&d.getParent()==null&&d.silkColor!=null&&t.push(d);return t}function Cq(o=!1){let t=new Array,e=new Array,r=new Array,i=new Array,n=xs.getInstance().getAllItem();for(let T of n){let I=T.attributes;for(let C of I)(3==C.layerId||4==C.layerId)&&C.getText()!=""&&t.push(C)}let s=rn.getInstance().getAllItem(),a=Mi.getInstance().getAllItem(),l=zi.getInstance().getAllItem(),c=Sl.getInstance().getAllItem(),h=Za.getInstance().getAllItem(),u=Ka.getInstance().getAllItem(),d=mo.getInstance().getAllItem(),p=Qs.getInstance().getAllItem(),m=new Map,g=[].concat(s,a,l,c,h,u,d,p);for(let T of g)if((3==T.layerId||4==T.layerId)&&T.getParent()==null){if(T instanceof Li)if(m.has(T.value)){let I=m.get(T.value);if(I.some(E=>!!d.find(_=>_.globalIndex==E).equals(T)))continue;I.push(T.globalIndex)}else m.set(T.value,[T.globalIndex]);r.push(T)}for(let T of n){let I=T.getItems();for(let C of I)(3==C.layerId||4==C.layerId)&&e.push(C)}let y=e0.getInstance().getAllItem();for(let T of y)(3==T.layerId||4==T.layerId)&&i.push(T);let b=(T,I)=>{let C=T.getParent(),E=I.getParent();return C!=null&&E!=null?C.globalIndex.length>E.globalIndex.length?1:C.globalIndex.length<E.globalIndex.length?-1:C.zIndex-E.zIndex:C!=null&&E==null?C.globalIndex.length>I.globalIndex.length?1:C.globalIndex.length<I.globalIndex.length?-1:C.zIndex-I.zIndex:C==null&&E!=null?T.globalIndex.length>E.globalIndex.length?1:T.globalIndex.length<E.globalIndex.length?-1:T.zIndex-E.zIndex:T.globalIndex.length>I.globalIndex.length?1:T.globalIndex.length<I.globalIndex.length?-1:T.zIndex-I.zIndex};t.sort(b),e.sort(b),r.sort(b),i.sort(b);let P=new Array;return Re.addAll(P,i),Re.addAll(P,r),Re.addAll(P,e),Re.addAll(P,t),o?P:P.reverse()}var Sq=nd(Lb());function Sze(o,t=.05){if(o.length<3)return o.slice();let e=o[0],r=[e];for(let l=1;l<o.length;l++){let c=o[l];e.equals1(c)||r.push(c),e=c}if(e!==r[r.length-1]&&(r.length!==1&&r.pop(),r.push(e)),t<0)return r;let i=r[1],n=i.sub(r[0]).normalize(),s=0,a=[r[0]];for(let l=2;l<r.length;l++){let c=r[l],h=c.sub(i).normalize();s+=Math.acos(Math.min(1,Math.max(-1,n.dot(h)))),s>t&&(a.push(i),s=0),i=c,n=h}return a.push(i),a}function Fvt(o,t,e=.01){let r=[],i=[];for(let u of o)if(u instanceof M)r.length===0&&r.push(u.start()),r.push(u.end());else{let d=Sze(r,e);r.length=0;let p=d[0];for(let m=1;m<d.length;m++){let g=d[m];i.push(new M(p,g)),p=g}i.push(u)}let n=Sze(r,e),s=n[0];for(let u=1;u<n.length;u++){let d=n[u];i.push(new M(s,d)),s=d}let a=[],l,c=[];for(let u of i){if(!(u instanceof M)){h(),c.push(u);continue}if(a.length===0){a.push(u.start(),u.end());continue}if(!u.start().equals1(a[a.length-1])){h(),a.push(u.start(),u.end());continue}a.push(u.end());let d=a[a.length-3],p=a[a.length-2],m=a[a.length-1],g=d.distance2(p)/m.distance2(p);if(g>4||g<.25){h(),a.push(u.start(),u.end());continue}let y=d.sub(p).normalize(),b=m.sub(p).normalize(),P=y.dot(b);if(ne.eq(P,-1)||P>-.95){h(),a.push(u.start(),u.end());continue}let T=y.cross(b);if(l&&l.sweepAngle*T>0){h(),a.push(u.start(),u.end());continue}let I=a[0];if(I.equals1(m)){l?(l=q.build3(l.center,0,-360,l.rx,l.rx),h()):(h(),a.push(u.start(),u.end()));continue}let C=I.add(m).scale(.5),E=I.sub(m),O=-E.y,_=E.x,R=0,v=0,D=0,w=0;for(let N of a)R+=N.x,v+=N.y,D+=N.x**2,w+=N.y**2;R/=a.length,v/=a.length,D/=a.length,w/=a.length;let F=I.x,H=I.y,z=2*O*(R-F)+2*_*(v-H);if(ne.eq(z,0)){h(),a.push(u.start(),u.end());continue}let G=(D-F**2-2*C.x*(R-F)+w-H**2-2*C.y*(v-H))/z,W=new S(C.x+G*O,C.y+G*_),L=I.distance1(W),B;for(let N of a){let U=Math.abs(N.distance1(W)-L),k=B?Math.abs(N.add(B).scale(.5).distance1(W)-L):0;if(U>t||k>t){h(),a.push(u.start(),u.end());break}B=N}a.length!==2&&(l=q.build2(W,I.angleD(W),a[a.length-1].angleD(W),L,L,T>0?le.CW:le.CCW))}return h(),c;function h(){l?(c.push(l),l=null,a.length=0):a.length!==0&&(c.push(new M(a[0],a[1])),a.length=0)}}var Vvt=typeof window>"u"||window["META-PANELIZE-ENV"]?!1:/\bpcbBoolDebug\b/.test($().location.search),ZEe;Vvt&&(typeof window<"u"?ZEe=window._MSG_BUS_=window._MSG_BUS_||new Sq.MessageBus:ZEe=new Sq.WorkerMessageBridge(new Sq.MessageBus,self));var Eq=class{constructor(){this.union1=[]}addPolyline(t){this.union([t]).forEach(e=>this.union1.push(e))}addPolylineGroup(t){this.union(t.items).forEach(e=>this.union1.push(e))}transform(t){for(let e=0;e<this.union1.length;e++)this.union1[e]=this.union1[e].multiply3(t)}getUnion(){if(this.union1.length===0)return[];if(this.union1.length===1)return this.union1[0].toPolylineGroup();let t=[Gl.UNION];return this.union1.forEach(r=>{t.push(r)}),this.run(t).toPolylineGroups()}union(t){let e=new dT(!1),r=new FI(vY.rule,new Gi(1),e);for(let n of t)r.addPolyline(n.asClose());r.simplify();let i=[];return e.plGrps.forEach(n=>{let s=[Qf(n.items[0])];if(s[0]){for(let a=1;a<n.items.length;a++){let l=Qf(n.items[a]);l&&s.push(l)}i.push(new hs(s))}}),i.length?i:this.unionByNormalizePts(t)}unionByNormalizePts(t,e=.01,r=.01){let i=new dT(!1),n=new FI(vY.rule,new Gi(1),i);for(let a of t)n.addPolyline(fe.build7(Fvt(a.asClose().primitives,e,r)));n.simplify();let s=[];return i.plGrps.forEach(a=>{let l=[Qf(a.items[0])];if(l[0]){for(let c=1;c<a.items.length;c++){let h=Qf(a.items[c]);h&&l.push(h)}s.push(new hs(l))}}),s}gnrBooleanRules(t){let e=[Gl.UNION],r=[Gl.UNION];for(let i of t){let n=fv(i),s=e.length,a=r.length;for(let l of n){if(l.primitives.length===0){console.error("ply.primitives.length === 0");continue}l.area(.1)>0?r.push(l.reverse()):e.push(l)}s!==e.length&&a!==r.length&&e.push([Gl.DIFF,[Gl.UNION,...e.splice(s)],[Gl.UNION,...r.splice(a)]])}return e.length===1?(console.warn("unionPls.length === 1"),null):this.run(r.length===1?e:[Gl.DIFF,e,r]).items}run(t){let e=EO(),r=HP(t,ZEe);return I2.runBoolean+=pI(e),r}};var Oq=class{constructor(){this.conversion=new ft;this.outlines=new Array;this.topSolder=new Array;this.bottomSolder=new Array;this.topSolderBool=new Eq;this.bottomSolderBool=new Eq;this.topSilkSVG=new Array;this.bottomSilkSVG=new Array;this.boardOutlineSVG=new Array;this.matrix=Qe.translate1(x.getInstance().origin.mul(-1));this.allItemBBox=N0();this.allItemOutline=fe.build4([this.allItemBBox.LL(),this.allItemBBox.UL(),this.allItemBBox.UR(),this.allItemBBox.LR(),this.allItemBBox.LL()]);this.bbox=this.allItemBBox.transform(this.matrix);this.pl=fe.build4([this.bbox.LL(),this.bbox.UL(),this.bbox.UR(),this.bbox.LR(),this.bbox.LL()]);this.expansion=this.conversion.conversion("mm","mil",.02)}generate(t,e){let r=Cq(!0);this.generateUniversal(),this.collectCircularOutlines(),this.getOutline();for(let a of r)a instanceof lr?(this.getProfilePolyline(a,5,this.topSolderBool,this.expansion),this.getProfilePolyline(a,6,this.bottomSolderBool,this.expansion),this.getProfileSVG(a,3,this.topSilkSVG),this.getProfileSVG(a,4,this.bottomSilkSVG)):a instanceof Je?(this.getPadPolyline(a,5,this.topSolderBool,this.expansion),this.getPadPolyline(a,6,this.bottomSolderBool,this.expansion)):a instanceof Li?(this.getTextPolyline(a,5,this.topSolder,this.topSolderBool,0),this.getTextPolyline(a,6,this.bottomSolder,this.bottomSolderBool,0),this.getTextSVG(a,3,this.topSilkSVG,!1),this.getTextSVG(a,4,this.bottomSilkSVG,!1)):a instanceof ql?(this.getImagePolyline(a,5,this.topSolder,this.topSolderBool,0),this.getImagePolyline(a,6,this.bottomSolder,this.bottomSolderBool,0),this.getImageSVG(a,3,this.topSilkSVG,!1),this.getImageSVG(a,4,this.bottomSilkSVG,!1)):a instanceof Xy?(this.getDimensionSVG(a,3,this.topSilkSVG),this.getDimensionSVG(a,4,this.bottomSilkSVG)):a instanceof It?(this.getViaPolyline(a,5,this.topSolderBool,this.expansion),this.getViaPolyline(a,6,this.bottomSolderBool,this.expansion)):a instanceof bm&&(this.getPictureSVG(a,3,this.topSilkSVG),this.getPictureSVG(a,4,this.bottomSilkSVG));let i=this.generateSVG(this.topSolder,this.topSolderBool,this.topSilkSVG,t,e),n=this.generateSVG(this.bottomSolder,this.bottomSolderBool,this.bottomSilkSVG,t,e,!0),s=this.generateBoardOutlineSVG();return{TOPSILK:i,BOTTOMSILK:n,BOARDOUTLINE:s}}generateSVG(t,e,r,i,n,s=!1){var P;for(let T=0;T<t.length;T++){let I=t[T];for(let C=0;C<I.length;C++)I[C]=I[C].multiply3(this.matrix)}e.transform(this.matrix);let a=n?n.map(T=>[T.x,T.y].join(" ")).join(" "):"",l=new ft,c=i!=null&&i.success&&!(i!=null&&i.onlyOutline)?ai.getInstance().outerBBox.transform(this.matrix):((P=nG())==null?void 0:P.transform(this.matrix))||this.bbox,h=l.conversion1("mil","mm",c.width()*10),u=l.conversion1("mil","mm",c.height()*10),d=`<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg
        width="${h}mm"
        height="${u}mm"
		boardBox="${c.minX} ${-c.maxY} ${c.width()} ${c.height()}"
        viewBox="${c.minX} ${-c.maxY} ${c.width()} ${c.height()}"
        version="1.1"
		eda-version="2.3(2026-04-10)"
		mark-points="${a}"
        xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
        xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
        xmlns:xlink="http://www.w3.org/1999/xlink"
        xmlns="http://www.w3.org/2000/svg"
        xmlns:svg="http://www.w3.org/2000/svg">`,{clipPath:p,name:m}=this.genarateClipPath(t,e);d+=p;let g=i==null?void 0:i.success,y=ai.getInstance().getDefaultPanelize(),b=y.onlyOutline;if(g&&!b){let T=y.row,I=y.column,C=ai.getInstance().offset,E=nG().transform(this.matrix),O=E.width(),_="";for(let D=0;D<T;D++)for(let w=0;w<I;w++)_+=`<use xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#multiSilk" x="${c.minX+1*w*C.x}" y="${-c.maxY-D*C.y}" width="${c.width()}" height="${c.height()}" />`;d+=`<defs><symbol id="multiSilk" viewBox="${c.minX} ${-c.maxY} ${c.width()} ${c.height()}"><g clip-path='url(#${m})' transform="scale(${s?-1:1} 1) translate(${s?-(E.minX*2+O):0} 0)">`;let R=s?we.bottomBoardColor:we.topBoardColor,v=this.getPolylineSVG(this.pl,R,"none","background",0);d+=v;for(let D of r)d+=D;return d+=`</g></symbol></defs>${_}</svg>`,d}else{d+=`<g clip-path='url(#${m})' transform="scale(${s?-1:1} 1) translate(${s?-(c.minX*2+c.width()):0} 0)">`;let T=s?we.bottomBoardColor:we.topBoardColor,I=this.getPolylineSVG(this.pl,T,"none","background",0);d+=I;for(let C of r)d+=C;return d+="</g></svg>",d}}generateBoardOutlineSVG(){let{outlines:t,bbox:e}=this.getRawOutline(),r=new ft,i=e.width(),n=e.height(),s=r.conversion1("px(100)","mm",i),a=r.conversion1("px(100)","mm",n),l=`<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg
        width="${s}mm"
        height="${a}mm"
        viewBox="${e.minX} ${-e.maxY} ${i} ${n}"
        version="1.1"
        xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
        xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
        xmlns:xlink="http://www.w3.org/1999/xlink"
        xmlns="http://www.w3.org/2000/svg"
        xmlns:svg="http://www.w3.org/2000/svg">`;return t.forEach(c=>{let h=this.getPolylineSVG(c,"none","green","boardOutline",2);l+=h}),l+="</svg>",l}genarateClipPath(t,e){let r="",i=new Array,n=0,s=`clipPath${n}`,a=s;for(let g of this.outlines)if(g.length>0){let y=`<defs><clipPath id='${s}'>`,b=TP(g);n==0?y+=`<path d="${b.join(" ")}" id="outline${n}" stroke="none"  style="fill-opacity:1;fill-rule:nonzero;fill:block;"/>`:y+=`<path d="${b.join(" ")}" id="outline${n}" stroke="none"  style="fill-opacity:1;fill-rule:nonzero;fill:block;" clip-path='url(#${a})'/>`,y+="</clipPath></defs>",r+=y,n++,a=s,s=`clipPath${n}`}for(let g of t)if(Array.isArray(g)){let y=`<defs><clipPath id='${s}'>`,b=TP(g);n==0?y+=`<path d="${b.join(" ")}" id="solder${n}" stroke="none"  style="fill-opacity:1;fill-rule:nonzero;fill:block;"/>`:y+=`<path d="${b.join(" ")}" id="solder${n}" stroke="none"  style="fill-opacity:1;fill-rule:nonzero;fill:block;" clip-path='url(#${a})'/>`,y+="</clipPath></defs>",r+=y,n++,a=s,s=`clipPath${n}`}let l=e.getUnion(),c=new Array;if(l instanceof Gt)c.push(l.items);else for(let g of l)c.push(g.items);let u=new Kc().getSubtraction2([[this.pl]],c,[[2],c.map(g=>2)]);t.length==0&&a==s?r+=`<defs><clipPath id='${s}'>`:r+=`<defs><clipPath id='${s}' clip-path='url(#${a})'>`;let d=new Array;for(let g of u)Re.addAll(d,g.items);let m=`<path d="${TP(d).join(" ")}" id="solder${n}" stroke="none"  style="fill-opacity:1;fill-rule:nonzero;fill:block"/>`;return r+=m,r+="</clipPath></defs>",{clipPath:r,name:s}}mergeNoneZero(t){let e=new Kc,r=25,i=new Array;for(let s=0;s<t.length;s+=r){let a=s+r;t.length<a&&(a=t.length);let l=e.getUnion(t.slice(s,a));for(let c of l)Re.addAll(i,c.items)}let n=new Array;if(i.length==1)Re.addAll(n,i);else{let s=e.getUnion(i);for(let a of s)Re.addAll(n,a.items)}return n}generateUniversal(){let t=Mi.getInstance().getAllItem(),e=rn.getInstance().getAllItem(),r=zi.getInstance().getAllItem(),i=$n.getInstance().getAllItem(),n=mo.getInstance().getAllItem(),s=Qs.getInstance().getAllItem(),a=Tn.getInstance().getAllItem(),l=[].concat(t,e,r);for(let c of l)this.getProfilePolyline(c,5,this.topSolderBool,this.expansion),this.getProfilePolyline(c,6,this.bottomSolderBool,this.expansion);for(let c of i)this.getPadPolyline(c,5,this.topSolderBool,this.expansion),this.getPadPolyline(c,6,this.bottomSolderBool,this.expansion),this.getPadPolyline(c,47,this.topSolderBool,this.expansion),this.getPadPolyline(c,47,this.bottomSolderBool,this.expansion);for(let c of n)this.getTextPolyline(c,5,this.topSolder,this.topSolderBool,0),this.getTextPolyline(c,6,this.bottomSolder,this.bottomSolderBool,0);for(let c of s)this.getImagePolyline(c,5,this.topSolder,this.topSolderBool,0),this.getImagePolyline(c,6,this.bottomSolder,this.bottomSolderBool,0);for(let c of a)this.getViaPolyline(c,5,this.topSolderBool,this.expansion),this.getViaPolyline(c,6,this.bottomSolderBool,this.expansion)}collectCircularOutlines(){let t=uu(),e=6.5;for(let r of t)if(r instanceof Po){let i=r.radius;if(on(D2(i*2,10,39.37),3)<=e){let s=r.getMathGraphics();s instanceof fe&&(this.topSolderBool.addPolyline(s),this.bottomSolderBool.addPolyline(s))}}}getRawOutline(){let t=uu(),e=[],r=new _e;for(let i of t){let n=i.getMathGraphics();n instanceof fe?e.push(n):e.push(...n.items),r.ext1(n.bbox())}return{outlines:e,bbox:r.build1()}}getOutline(){let t=uu(),e=new Array;for(let h of t){let u=h.getMathGraphics();Re.addAll(e,u.primitives)}let i=new oh(this.allItemBBox.extendOfSize(10),2,.1,new Gi(4),e).detect(),n=new Array,s=1e4,a=!1,l=0;i.items.some(h=>(l+=h.primitives.length,l>s?(a=!0,!0):!1));let c=D2(-.2,39.37,10);for(let h of i.items)vh(h)&&(h=h.reverse()),h=h.multiply3(this.matrix),a?n.push(h):gy.getExtendPolyLine(h,c).forEach(u=>n.push(u));this.outlines.push(n)}getProfilePolyline(t,e,r,i=0){if(t.layerId==e||t.layerId==12)switch(t.type){case"Line":{let n=t.getMathGraphics(),s=t.strokeWidth;for(let a of n.primitives)r.addPolyline(a.stroke(s+i*2,kr.ROUND,le.CW));break}case"Slot Region":{let n=t.getMathGraphics(),s=n instanceof Gt?n.items:[n],a=new Array;s.forEach(c=>{if(a.push(c),i>0)for(let h of c.primitives)a.push(h.stroke(i*2,kr.ROUND,le.CW))});let l=this.mergeNoneZero(a);for(let c of l)r.addPolyline(c);break}case"Fill Region":{let n=t.getMathGraphics();if(n instanceof Gt){let s=n.getOutMostPolyline();if(vh(s)){let l=new Array;for(let c of n.items)l.push(c.reverse());r.addPolylineGroup(new Gt(l))}else r.addPolylineGroup(n)}else vh(n)&&(n=n.reverse()),r.addPolyline(n);break}}}getTextPolyline(t,e,r,i,n=0){if(t.layerId==e){let s=t.getRealOutline();if(t.type==1){let a=new Array,l=new Array,c=!1;for(let h of s)if(h.order==0){vh(h.pl)?c=!1:c=!0;break}for(let h of s)h.order==0&&l.push(h.pl.asClose()),c?a.push(h.pl.reverse()):a.push(h.pl);if(a.length>0&&(a.push(this.allItemOutline),r.push(a)),n>0)for(let h of s)for(let u of h.pl.primitives)i.addPolyline(u.stroke(n*2,kr.ROUND,le.CW))}else{let a=t.strokeWidth;for(let l of s)for(let c of l.primitives)i.addPolyline(c.stroke(a+n*2,kr.ROUND,le.CW))}}}getImagePolyline(t,e,r,i,n=0){if(t.layerId==e){let s=t.getPath(),a=new Array,l=new Array,c=!1;for(let h of s)if(h.order==0){vh(h.pl)?c=!1:c=!0;break}for(let h of s)h.order==0&&a.push(h.pl.asClose()),c?l.push(h.pl.reverse()):l.push(h.pl);if(l.length>0&&(l.push(this.allItemOutline),r.push(l)),n>0)for(let h of s)for(let u of h.pl.primitives)i.addPolyline(u.stroke(n*2,kr.ROUND,le.CW))}}getPadPolyline(t,e,r,i=0){let n=t.getMathGraphics(e,i);n!=null&&r.addPolyline(n)}getViaPolyline(t,e,r,i=0){let n=t.getMathGraphics(e,i);n!=null&&r.addPolyline(n)}getProfileSVG(t,e,r,i=0){let n=this.getColor(t,e);if(t.layerId==e)switch(t.type){case"Line":{let s=t.getMathGraphics().multiply3(this.matrix),a=t.strokeWidth;for(let l of s.primitives)if(l instanceof M){let c=this.getLineSVG(l,"none",n,t.globalIndex,i+a);r.push(c)}else if(l instanceof q){let c=this.getArcSVG(l,"none",n,t.globalIndex,i+a);r.push(c)}else if(l instanceof Mr){let c=this.getBezierSVG(l,"none",n,t.globalIndex,i+a);r.push(c)}break}case"Fill Region":{let s=t.getMathGraphics().multiply3(this.matrix),a=s instanceof Gt?s.items:[s],c=`<path d="${TP(a).join(" ")}" id="${t.globalIndex}" stroke="none" layerid="${t.layerId}" style="fill-opacity:1;fill-rule:nonzero;fill:${n}"/>`;r.push(c),a.forEach(h=>{if(i>0){for(let u of h.primitives)if(u instanceof M){let d=this.getLineSVG(u,"none",n,t.globalIndex,i);r.push(d)}else if(u instanceof q){let d=this.getArcSVG(u,"none",n,t.globalIndex,i);r.push(d)}else if(u instanceof Mr){let d=this.getBezierSVG(u,"none",n,t.globalIndex,i);r.push(d)}}});break}}}getPadSVG(t,e,r,i=0){let n=t.getMathGraphics(e,i);if(n!=null){let s=this.getPolylineSVG(n,"block","none",t.globalIndex,0);r.push(s);let{type:a}=t.getPad(e);if(i>0&&a=="POLYGON"){for(let l of n.primitives)if(l instanceof M){let c=this.getLineSVG(l,"none","block",t.globalIndex,i);r.push(c)}else if(l instanceof q){let c=this.getArcSVG(l,"none","block",t.globalIndex,i);r.push(c)}else if(l instanceof Mr){let c=this.getBezierSVG(l,"none","block",t.globalIndex,i);r.push(c)}}}}getTextSVG(t,e,r,i,n=0){if(t.layerId==e){let s=i?"block":this.getColor(t,e),a=t.getTextOutline().map(l=>l.multiply3(this.matrix));if(t.type==1){let c=`<path xmlns="http://www.w3.org/2000/svg" d="${TP(a).join()}" id="${t.globalIndex}" stroke="none" layerid="${t.layerId}" style="fill-opacity:1;fill-rule:nonzero;fill:${s}"/>`;if(r.push(c),n>0){for(let h of a)for(let u of h.primitives)if(u instanceof M){let d=this.getLineSVG(u,"none",s,t.globalIndex,n);r.push(d)}else if(u instanceof q){let d=this.getArcSVG(u,"none",s,t.globalIndex,n);r.push(d)}else if(u instanceof Mr){let d=this.getBezierSVG(u,"none",s,t.globalIndex,n);r.push(d)}}}else for(let l of a)for(let c of l.primitives)if(c instanceof M){let h=this.getLineSVG(c,"none",s,t.globalIndex,t.strokeWidth);r.push(h)}else if(c instanceof q){let h=this.getArcSVG(c,"none",s,t.globalIndex,t.strokeWidth);r.push(h)}else if(c instanceof Mr){let h=this.getBezierSVG(c,"none",s,t.globalIndex,t.strokeWidth);r.push(h)}}}getImageSVG(t,e,r,i,n=0){if(t.layerId==e){let s=i?"block":this.getColor(t,e),a=t.getRealPath().map(h=>h.multiply3(this.matrix)),c=`<path d="${TP(a).join(" ")}" id="${t.globalIndex}" stroke="none" layerid="${t.layerId}" style="fill-opacity:1;fill-rule:nonzero;fill:${s}"/>`;if(r.push(c),n>0){for(let h of a)for(let u of h.primitives)if(u instanceof M){let d=this.getLineSVG(u,"block",s,t.globalIndex,n);r.push(d)}else if(u instanceof q){let d=this.getArcSVG(u,"block",s,t.globalIndex,n);r.push(d)}else if(u instanceof Mr){let d=this.getBezierSVG(u,"block",s,t.globalIndex,n);r.push(d)}}}}getViaSVG(t,e,r,i=0){let n=t.getMathGraphics(e,i);if(n!=null){let s=this.getPolylineSVG(n,"block","none",t.globalIndex,0);r.push(s)}}getPictureSVG(t,e,r,i=0){if(t.layerId==e){let n=Yd.getItem(t.hashId),s=n.source.src,a=t.start.sub(x.getInstance().origin),l=n.source.width,c=n.source.height,h=t.width/l,u=t.height/c,d;t.needMirror()?d=Ae.scale(-h,u,1).rotateZ(t.rotation).translate1(a.x,-a.y,0).toMatrix3():d=Ae.scale(h,u,1).rotateZ(-t.rotation).translate1(a.x,-a.y,0).toMatrix3();let p=`<image width = "${l}" height ="${c}" preserveAspectRatio="none" xlink:href="${s}" transform="matrix(${d.data[0]} ${d.data[1]} ${d.data[3]} ${d.data[4]} ${d.data[6]} ${d.data[7]})"/>`;r.push(p)}}getDimensionSVG(t,e,r,i=0){if(t.layerId==e){let n=t.getBaseGraphics();for(let s of n)for(let a of s)if(a instanceof M){a=a.multiply3(this.matrix);let l=`<line
                        x1 = "${a.start().x}"
                        x2 ="${a.end().x}"
                        y1 = "${-a.start().y}"
                        y2 = "${-a.end().y}"
                        fill = "none"
                        stroke="${this.getColor(t,e)}"
                        stroke-width="${t.strokeWidth}"
                        stroke-linecap="round"
                        id ="${t.globalIndex}" />`;r.push(l)}else if(a instanceof q){let l=q.build2(a.center,a.startAngle/Math.PI*180,a.endAngle()/Math.PI*180,a.rx,a.ry,a.sweep()).multiply3(this.matrix),c=new f9;c.encPt(l);let u=`<path d="${c.toString()}" stroke="${this.getColor(t,e)}" fill = "none"  stroke-width="${t.strokeWidth}" stroke-linecap="round" id ="${t.globalIndex}" />`;r.push(u)}}}getColor(t,e){if(t.silkColor!=null)return t.silkColor.toString();{let r=t.getParent();return r!=null&&"silkColor"in r&&r.silkColor!=null?r.silkColor.toString():e==3?we.topSilkscreenColor:we.bottomSilkscreenColor}}getPolylineSVG(t,e,r,i,n){return`<path d="${TP([t])}" fill="${e}" stroke="${r}" stroke-width="${n.toString()}" id ="${i}" />`}getLineSVG(t,e,r,i,n){return`<line
        x1 = "${t.start().x}"
        x2 ="${t.end().x}"
        y1 = "${-t.start().y}"
        y2 = "${-t.end().y}"
        fill="${e}"
        stroke="${r}"
        stroke-linecap = "round"
        stroke-width="${n.toString()}"
        id ="${i}" />`}getArcSVG(t,e,r,i,n){let s=new f9;return s.encPt(t),`<path d="${s.toString()}" fill="${e}" stroke="${r}" stroke-width="${n.toString()}" stroke-linecap="round" id ="${i}" />`}getBezierSVG(t,e,r,i,n){let s=new f9;return s.encPt(t),`<path d="${s.toString()}" fill="${e}" stroke="${r}" stroke-width="${n.toString()}" stroke-linecap="round" id ="${i}" />`}};var Gvt=`-----BEGIN PUBLIC KEY-----
 MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzPtuUqJecaR/wWtctGT8
 QuVslmDH3Ut3s8c1Ls4A+M9rwpeLjgDUqfcrSrTHBrl5k/dOeJEWMeNF7STWS5jo
 WZE0H60cvf2bhormC9S6CRwq4Lw0ua0YQMo66R/qCtLVa5w6WkaPCz4b0xaHWtej
 JH49C0T67rU2DkepXuMPpwNCflMU+WgEQioZEldUTD6gYpu2U5GrW4AE0AQiIo+j
 e7tgN8PlBMbMaEfu0LokZyth1ugfuLAgyogWnedAegQmPZzAUe36Sni94AsDlhxm
 mjFl+WQZzD3MclbEY6KQB5XL8zCR/J6pCUUwfHantLxY/gQi0XJG5hWWtDyH/fR2
 lwIDAQAB
 -----END PUBLIC KEY-----
 `;var Ole=class{constructor(){if(!crypto||!crypto.subtle)throw new Error("\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301crypto api");this.tool=crypto.subtle}str2buffer(t,e=0){let r,i;switch(e){case 0:r=new ArrayBuffer(t.length),i=new Uint8Array(r);break;case 1:r=new ArrayBuffer(t.length*2),i=new Uint16Array(r);break;default:console.warn("bufType\u53C2\u6570\u9519\u8BEF\uFF0C\u4F7F\u7528\u9ED8\u8BA4uint8"),r=new ArrayBuffer(t.length),i=new Uint8Array(r);break}for(let n=0,s=t.length;n<s;n++)i[n]=t.charCodeAt(n);return r}buffer2str(t,e=0){let r;switch(e){case 0:r=new Uint8Array(t);break;case 1:r=new Uint16Array(t);break;default:console.warn("bufType\u53C2\u6570\u9519\u8BEF\uFF0C\u4F7F\u7528\u9ED8\u8BA4uint8"),r=new Uint8Array(t);break}return String.fromCharCode.apply(null,r)}},JEe=class extends Ole{constructor(){super();this.CONTENT_SPLIT_LENGTH=190;this.DECRYPT_SPLIT_LENGTH=256}async init(e){return this.key=await this.setPublicKey(e.publicKey),e.privateKey!=null&&(this.privateKey=await this.setPrivateKey(e.privateKey)),console.log("RSACryptoHelper\u521D\u59CB\u5316\u5B8C\u6BD5\uFF01"),this}setPublicKey(e){let r=["-----BEGIN PUBLIC KEY-----","-----END PUBLIC KEY-----","\\s"],i=new RegExp(r.join("|"),"ig"),n=e.replace(i,""),s=atob(n),a=this.str2buffer(s,0);return this.tool.importKey("spki",a,{name:"RSA-OAEP",hash:"SHA-256"},!0,["encrypt"])}setPrivateKey(e){let r=["-----BEGIN PRIVATE KEY-----","-----END PRIVATE KEY-----","\\s"],i=new RegExp(r.join("|"),"ig"),n=e.replace(i,""),s=atob(n),a=this.str2buffer(s,0);return this.tool.importKey("pkcs8",a,{name:"RSA-OAEP",hash:"SHA-256"},!0,["decrypt"])}async decrypt(e){if(this.privateKey==null)throw new Error("\u6CA1\u6709\u79C1\u94A5\u6570\u636E\uFF0C\u4E2D\u6B62\u89E3\u5BC6\u64CD\u4F5C");let r=e instanceof ArrayBuffer?e:this.str2buffer(e),i=[];for(let a=0,l=r.byteLength;a<l;a+=this.DECRYPT_SPLIT_LENGTH){let c=a,h=Math.min(a+this.DECRYPT_SPLIT_LENGTH,l);i.push(r.slice(c,h))}let n=[];for(let a of i)n.push(this.tool.decrypt({name:"RSA-OAEP"},this.privateKey,a));let s=await Promise.all(n);return Ale(s)}async encrypt(e,r){let i=e instanceof ArrayBuffer?e:this.str2buffer(e),n=[];for(let a=0,l=i.byteLength;a<l;a+=this.CONTENT_SPLIT_LENGTH){let c=a,h=Math.min(a+this.CONTENT_SPLIT_LENGTH,l);n.push(this.tool.encrypt({name:"RSA-OAEP"},this.key,i.slice(c,h)).then(u=>(r&&r(h/l),u),u=>{throw console.error("encrypt error",u),u}))}let s=await Promise.all(n);return r&&r(1),Ale(s)}},QEe=class extends Ole{constructor(){super()}async init(t){return this.keyBuffer=typeof t.key=="string"?this.str2buffer(t.key,0):t.key,this.key=await this.setKey(this.keyBuffer),this.iv=await this.setIV(t.iv),console.log("AESCryptoHelper\u521D\u59CB\u5316\u5B8C\u6BD5\uFF01"),this}setKey(t){let e=typeof t=="string"?this.str2buffer(t,0):t;return this.tool.importKey("raw",e,"AES-GCM",!0,["encrypt","decrypt"])}setIV(t){return typeof t=="string"?this.str2buffer(t,0):t}encrypt(t){let e=t instanceof ArrayBuffer?t:this.str2buffer(t);return this.tool.encrypt({name:"AES-GCM",iv:this.iv},this.key,e)}decrypt(t){let e=t instanceof ArrayBuffer?t:this.str2buffer(t);return this.tool.decrypt({name:"AES-GCM",iv:this.iv},this.key,e)}getKey(){return this.keyBuffer}getIV(){return this.iv}};function Ale(o){let t=o.reduce((i,n)=>i+n.byteLength,0),e=new Uint8Array(t),r=0;for(let i of o)e.set(new Uint8Array(i),r),r+=i.byteLength;return e.buffer}async function e3e(o,t){switch(o){case 0:return t=t||{key:crypto.getRandomValues(new Uint8Array(16)).buffer,iv:crypto.getRandomValues(new Uint8Array(16)).buffer},await new QEe().init(t);case 1:return t=t||{publicKey:Gvt},await new JEe().init(t)}}var Aq=class Aq extends Worker{constructor(t,e){t.startsWith("//")&&(t=self.location.protocol+t);let r=t;if(/^[\w-]+:/.test(t)&&self.location.origin!=new URL(t).origin&&(r=Aq.proxyMap[t],!r)){let i=`importScripts('${t}');`;r=URL.createObjectURL(new Blob([i],{type:"application/javascript"})),Aq.proxyMap[t]=r}super(r,e)}};Aq.proxyMap={};var _le=Aq;var _q=class{constructor(){this.integer=2;this.decimals=6;this.layersInfo=[]}addLayersId(t,e,r,i){if(e!=null)r=Gae(e);else if(r==null){console.warn("error add");return}this.layersInfo.push({fileName:t,layerId:e,gerberLayerName:r,isDrill:i})}setUnit(t){this.unit=t}setFormate(t,e){this.integer=t,this.decimals=e}exportText(){let t=[];for(let r of this.layersInfo)t.push({FileName:r.fileName,LayerName:r.gerberLayerName,Format:r.isDrill?"excellon2":"gerber274x",NumberFormat:`${this.integer}:${this.decimals}`,Units:this.unit=="IN"?"inch":"mm",ZeroesOmitted:"none",Decimal:"no",Coordinates:"absolute"});return JSON.stringify({IsOdb:!1,isGerber:!0,GerberFiles:t},void 0,4)}};var g9=class{constructor(){}exportText(t){return""}};var Lm=class extends g9{constructor(){super()}};Lm.endSign="*";var vle={column:1,row:1,stepX:0,stepY:0};var sG=class{};function xle(o,t){return{x:o.x+t.x,y:o.y+t.y}}var B0=class extends sG{constructor(e){super();this.num=0;this.hasUnit=!0;this.num=e}format(e){return e.formatDecimalNumber(this.num)}},aG=class extends sG{constructor(e){super();this.num=0;this.hasUnit=!1;this.num=e}format(e){return e.formatPureDecimalNumber(this.num)}};var __=class o extends sG{constructor(e){super();this.hasUnit=!0;if(this.num=e,!e)throw new Error("Invalid XYNumber parameters")}get xy(){return this.num}applyOffset(e){this.num=xle(this.num,e)}offsetClone(e){return new o(xle(this.num,e))}format(e){return e.formatPointXY(this.num)}},y9=class o extends sG{constructor(e,r){super();this.hasUnit=!0;if(this.numXY=e,this.numIJ=r,!e||!r)throw new Error("Invalid ArcData parameters")}get xy(){return this.numXY}applyOffset(e){this.numXY=xle(this.numXY,e)}offsetClone(e){return new o(xle(this.numXY,e),this.numIJ)}format(e){return e.formatPointXY(this.numXY)+e.formatPointIJ(this.numIJ)}};var v_=class v_ extends g9{constructor(){super();this.code="";this.modifiers=[]}exportText(e){let r=v_.delimiter+this.code,i=r.length;for(let n of this.modifiers){let s;typeof n=="string"?s=n:typeof n.format=="function"?s=n.format(e):s=String(n),i+s.length<=v_.maxLength?(r+=s,i+=s.length):(r+=`
`,r+=s,i=s.length)}return r+=v_.endSign,r}static create(e,r){let i=new v_;return i.code=e,i.modifiers=r?r.slice():[],i}};v_.maxLength=4096,v_.delimiter="%",v_.endSign="*%";var a2=v_;var KD=class KD extends a2{constructor(){super()}static createLayer(t){if(/[*]|[^\t\x20-\x7e]/.test(t))throw new Error("Invalid Layer Name");if(t.length>100)throw new Error("Layer Name is too long");let r=new KD;return r.code="LN",r.modifiers[0]=t,r}static createPolarity(t){let e=new KD;return e.code="LP",e.modifiers[0]=t,e}};KD.PolarityClear=KD.createPolarity("C"),KD.PolarityDark=KD.createPolarity("D");var xp=KD;var ff=class ff extends Lm{constructor(e=1){super();this._number=1;if(!this.isValidNumber(e))throw new Error("D-code number is out of range");this._number=e}get name(){return"D"+String(this._number).padStart(2,"0")}get number(){return this._number}set number(e){if(!this.isValidNumber(e))throw new Error("D-code number is out of range");this._number=e}isValidNumber(e){return e===ff.numberExposureOn||e===ff.numberExposureOff||e===ff.numberExposureFlash||e>=ff.customNumberMin&&e<=ff.customNumberMax}next(){if(this._number<ff.customNumberMin)throw new Error("This method is not available for built-in D codes");if(this._number>ff.customNumberMax)throw new Error("D-code number is out of range");return new ff(this._number+1)}exportText(){return this.name+Lm.endSign}static isDCode(e){return e instanceof ff||e===ff.ExposureOn||e===ff.ExposureOff||e===ff.ExposureFlash}};ff.customNumberMin=10,ff.customNumberMax=8191,ff.numberExposureOn=1,ff.numberExposureOff=2,ff.numberExposureFlash=3,ff.ExposureOn="D01",ff.ExposureOff="D02",ff.ExposureFlash="D03";var Q1=ff;var wa=class wa extends Lm{constructor(e,...r){super();this.modifiers=[];this.code=e,r.length&&this.addModifier(...r)}addModifier(...e){this.modifiers.push(...e)}isSimpleLinear(){return this.code=="G01"&&this.modifiers.length===2&&this.modifiers[0]instanceof __&&Q1.isDCode(this.modifiers[1])}isSimpleArc(){return(this.code=="G02"||this.code=="G03")&&this.modifiers.length<=2&&this.modifiers[0]&&this.modifiers[0]instanceof y9&&(!this.modifiers[1]||Q1.isDCode(this.modifiers[1]))}isSimpleLinearOrArc(){return this.isSimpleLinear()||this.isSimpleArc()}isComment(){return this.code=="G04"}applyOffset(e){for(let r of this.modifiers)(r instanceof __||r instanceof y9)&&r.applyOffset(e)}offsetClone(e){if(["G04","G36","G37","G54"].includes(this.code))return new wa(this.code,...this.modifiers);let r=this.modifiers.map(i=>i instanceof __||i instanceof y9?i.offsetClone(e):i);return new wa(this.code,...r)}hasDCodeOfExposureOn(){let e=this.modifiers;if(!e.length)return!1;let r=e[e.length-1];return r=="D01"||r instanceof Q1&&r.name=="D01"}formatXY(e){if(this.isSimpleLinearOrArc()){let r=this.modifiers[0];if(r instanceof __||r instanceof y9)return e.formatPointXY(r.xy)}return""}exportText(e,r){let i;if(r instanceof wa&&this.isSimpleLinearOrArc()&&r.isSimpleLinearOrArc()){let n=r.modifiers[0];(n instanceof __||n instanceof y9)&&(i=n.xy)}return this.code+this.modifiers.map((n,s,a)=>{if(typeof n=="string")return i=null,n==Lm.endSign?s===0||s===a.length-1?"":n+`
`:n;if(typeof n.format=="function")if(i){e.lastXY=i;let l=n.format(e);return e.lastXY=null,i=null,l}else return n.format(e);else return i=null,String(n)}).join("")+Lm.endSign}static flashAt(e){return wa.linearTo(e,"D03")}static linearTo(e,r){let i=new wa("G01",new __(e));return r&&i.addModifier(r),i}static line(e,r){return[wa.linearTo(e,"D02"),wa.linearTo(r,"D01")]}static circleLine(e,r){let i={x:e.x-r,y:e.y},n={x:e.x+r,y:e.y},s={x:r,y:0},a={x:-r,y:0};return[wa.linearTo(i,"D02"),wa.counterclockwiseArcTo(n,s,"D01"),wa.counterclockwiseArcTo(i,a,"D01")]}static circleFill(e,r){return[].concat([wa.TurnOnPolygonFill],wa.circleLine(e,r),wa.TurnOffPolygonFill)}static KitsuneLine(e,r,i){if(!e||!e.length)return null;let n=[],s=!0,a;for(let l of e){let c=l.start().multiply3(r),h=l.end().multiply3(r);if((!a||!a.equals(c))&&(s=!0),s&&(s=!1,n.push(wa.linearTo(c,"D02"))),l instanceof M)n.push(wa.linearTo(h,"D01"));else if(l instanceof q){let u=l.center.multiply3(r).sub(c),p=(i?!l.isCCW:l.isCCW)?"G03":"G02";n.push(new wa(p,new y9(h,u),"D01"))}a=h}return n}static primitivesToPoints(e,r=.02){if(!e||!e.length)return null;let i=[];for(let n of e){let s=n.start(),a=n.end();i.length===0&&i.push(s);let l=i[i.length-1],c=s.equals2(l,1e-5),h=a.equals(l);if(!c)throw new Error("Not continuous primitive line");if(n instanceof M)h||i.push(a);else if(n instanceof q)if(e.length>1&&l.distance1(a)<.1)i.push(a);else{let d=n.points1(r);d[0]&&d[0].equals(l)&&d.shift(),d[d.length-1]&&!d[d.length-1].equals(a)&&d.push(a),i=i.concat(d)}else if(n instanceof Mr){let u=n.points(.1);u[0]&&u[0].equals(l)&&u.shift(),u[u.length-1]&&!u[u.length-1].equals(a)&&u.push(a),i=i.concat(u)}else throw new Error("Unexpected line");l=a}return i}static primitivesLine(e){if(!e||!e.length)return null;let r=[],i=!0,n;for(let s of e){let a=s.start(),l=s.end();if(i&&(i=!1,r.push(wa.linearTo(a,"D02")),n=a),s instanceof M)r.push(wa.linearTo(l,"D01"));else if(s instanceof q)if(Math.abs(s.sweepAngle)<.5||e.length>1&&n.distance1(l)<.1&&(s.bbox().width()<.1||s.bbox().height()<.1))r.push(wa.linearTo(l,"D01"));else{let h=s.center.sub(a);r.push(new wa(s.isCCW?"G03":"G02",new y9(l,h),"D01"))}else if(s instanceof Mr){let c=s.points(.1);for(let h of c)r.push(wa.linearTo(h,"D01"))}else throw new Error("Unexpected line");n=l}return r}static polygonLine(e){return wa.primitivesLine(e==null?void 0:e.primitives)}static polygonFill(e){let r=e==null?void 0:e.primitives;if(!r||!r.length)return null;let i=wa.primitivesLine(r);if(!i||!i.length)return null;let n=new wa("G36"),s=new wa("G37");return[].concat([n],i,[s])}static polygonFillWithHoles(e){let r,i=0,n=0;for(let l of e){let c=l.bbox(),h=c.width(),u=c.height();h>i&&u>n&&(i=h,n=u,r=l)}if(!r)return null;let s=wa.polygonFill(r);if(!s)return null;let a=[];for(let l of e)if(l!==r){let c=wa.polygonFill(l);a=a.concat(c)}return a.length&&(a.unshift(xp.PolarityClear),a.push(xp.PolarityDark)),s.concat(a)}static rawPolygonFill(e){if(!e||!e.length||e.length<3)return null;let r=e.map((s,a)=>wa.linearTo(s,a===0?"D02":"D01")),i=new wa("G36"),n=new wa("G37");return[].concat([i],r,[n])}static arcTo(e,r,i,n){let s=new wa(e?"G02":"G03");return s.addModifier(new y9(r,i)),n&&s.addModifier(n),s}static clockwiseArcTo(e,r,i){return wa.arcTo(!0,e,r,i)}static counterclockwiseArcTo(e,r,i){return wa.arcTo(!1,e,r,i)}static useAperture(e){let r=new wa("G54");return r.addModifier(e),r}static enable360Circular(){return wa.TurnOn360Circular}};wa.TurnOn360Circular=new wa("G75"),wa.TurnOff360Circular=new wa("G74"),wa.TurnOnPolygonFill=new wa("G36"),wa.TurnOffPolygonFill=new wa("G37");var gi=wa;function Eze(){let o=x.getInstance().clientOnlineService.match(/"https:\/\/(\S*)\"\//),t=o&&o[1]?o[1]:"",e=s2?t:location.host;return!["pro.lceda.cn","pro.easyeda.com"].includes(e)}function vq(o){if(!o)return"";let t=(o.name||o.layerName||"").replace(/ /g,"");switch(o.type||o.layerType){case"SIGNAL":case"PLANE":for(var e=15,r=1;e<=46;e++,r++)(o.layerID==e||o.layerId==e)&&(t="InnerLayer"+r);break;case"CUSTOM":for(var e=71,r=1;e<=270;e++,r++)(o.layerID==e||o.layerId==e)&&(t="CustomLayer"+r);break}return t}function q5(o,t,e){return`Drill_${o}_${t||(e?"Through_Via":"Through")}.DRL`}function t3e(o){let t=Oze(),e=o.includes("TopStiffenerLayer")?58:59,r=`Gerber_${o}.${t[e]}`;return r=r.trim().replace(/\s+/g,"_"),r}function r3e(){return"Fabrication_ColorfulBoardOutlineMark.FCBM"}var Hvt=(()=>{let o={};return Bg.forEach(t=>{o[t.layerId]=t}),_8e.forEach(t=>{o[t.layerId]=t}),o})();function Oze(){let o={11:"GKO",1:"GTL",2:"GBL",3:"GTO",4:"GBO",5:"GTS",6:"GBS",7:"GTP",8:"GBP",58:"GTSL",59:"GBSL",14:"GME",9:"GTA",10:"GBA",56:"GDD",13:"GDL"};for(var t=15,e=1;t<=46;t++,e++)o[t]="G"+e;for(var t=71,e=1;t<=270;t++,e++)o[t]="GCL";return o}function i3e(o){let t=Hvt[o],e=vq(t);if(!e)throw new Error("Invalid layerId "+o);let r=Oze();if(!r.hasOwnProperty(o))throw new Error("invalid layerId "+o);let i=`Gerber_${e}.${r[o]}`;return i=i.trim().replace(/\s+/g,"_"),i}function xq(o,t){for(let e of o)e instanceof gi&&e.applyOffset(t)}function Aze(o,t){if(!o.length)return"";let e=`
`;return o.map(i=>i.exportText(t)).join(e)+e}function b9(o){let t=new Array;for(let e of o){let r=Mm(e);r!=null&&t.push(r)}return t}function Mm(o){if(o==null)return null;let t=new Array,e=o,r=e.length;for(let i=0;i<r;i+=6)switch(e[i]){case 0:{let n=new M(new S(e[i+1],e[i+2]),new S(e[i+3],e[i+4]));t.push(n);break}case 1:{let n=q.build3(new S(e[i+1],e[i+2]),e[i+3],e[i+4],e[i+5],e[i+5]);t.push(n);break}case 2:{let n=q.build3(new S(e[i+1],e[i+2]),e[i+3],e[i+4],e[i+5],e[i+5]);t.push(n);break}case 3:{let n=e[i+1],s=Math.ceil(n/2);if(n<2||e.length<i+s*6)throw new Error("invalid data");let a=[];for(let c=0;c<s;c++){let h=c*6+i;if(c>0&&e[h+1]!==0||e[h]!==3)throw new Error("invalid data");a.push(new S(e[h+2],e[h+3])),a.push(new S(e[h+4],e[h+5]))}if(i+=(s-1)*6,a.length>n&&(a=a.slice(0,n)),a.length!==n)throw new Error("invalid data");let l=new Mr(a);t.push(l);break}}return t.length>0?fe.build2(t):null}function $5(o){return o.map(WT)}function WT(o){let t=[];function e(r){t.push(...r)}for(let r of o.primitives)if(r instanceof M){let i=r.start(),n=r.end();e([0,i.x,i.y,n.x,n.y,0])}else if(r instanceof Q9){let{rx:i,center:n,startAngle:s,sweepAngle:a}=r;e([1,n.x,n.y,s,a,i])}else if(r instanceof q){let{rx:i,center:n,startAngle:s,sweepAngle:a}=r;e([2,n.x,n.y,s,a,i])}else if(r instanceof Mr){let{controls:i}=r,n=[3,i.length];for(let s of i)n.length%6===0&&n.push(3,0),n.push(s.x,s.y);for(;n.length%6;)n.push(0);e(n)}return t}var n3e=class{getConfig(t){let e={fpcStiffeners:this.getStiffenerConfig(t)},r="jlcpcb.json";return e.fpcStiffeners.length?{fileName:r,config:JSON.stringify(e,null,2)}:null}getStiffenerConfig(t){let e=[],{stiffeners:r}=t,i=ai.getInstance().getDefaultPanelize(),n=x.getInstance().origin;if(!i.success||i.onlyOutline){let s=S.ORIGIN.sub(n);r.forEach(a=>{let l=this.getStiffenerData(a,"",s);e.push(l)})}else{let s=Ii.offset||new S(0,0),a=i.row,l=i.column,c=0;for(let h=0;h<a;h++)for(let u=0;u<l;u++){let d=new S(s.x*u,s.y*h);d=d.sub(n),r.forEach(p=>{let m=c?`_${c}`:"",g=this.getStiffenerData(p,m,d);e.push(g)}),c++}}return e}getStiffenerData(t,e="",r=S.ORIGIN){let i=58===t.layerId,n={Polyimide:"pi",FR4:"fr4","Stainless Steel":"steel",Tape:"tape","EMI Shielding Film":"EMI Shielding Film"},s={"3M468":"3m468","3M9077":"3m9077",TESA8854:"tesa8854"},a=t.getComponent();return{id:`${ur}${t.number}`+e,gerber:this.getGerberFPCGroupName(t),layer:t.layerId===58?"top":"bottom",material:n[a.material],model:s[a.fpcModel],thickness:`${a.thickness}`,path:[this.getShapeInfo(t,r)]}}getShapeInfo(t,e){let r=Ae.translate(e.x,e.y,0);if(t instanceof Sr){let i=t.center.multiply4(r);return $b(0,{center:i,radius:t.radius})}else if(t instanceof nr){let i=t.start.multiply4(r),{width:n,height:s,rotation:a,cornerRadius:l}=t,c={start:i,width:n,height:s,rotation:a,radius:l};return $b(1,c)}else if(t instanceof ct){let i=t.getMathGraphics(t.layerId,0);return i=i.multiply3(r.toMatrix3()),$b(2,{pl:i})}}getGerberFPCGroupName(t){let e=t.getComponent(),r=t.layerId===58,i=r?"TopStiffenerLayer":"BottomStiffenerLayer",n={Polyimide:"pi",FR4:"fr4","Stainless Steel":"gp",Tape:"ps","EMI Shielding Film":r?"csa":"ssa"},s={"3M468":"3m468","3M9077":"3m9077",TESA8854:"tesa8854"},a=r?"t":"b",l=n[e.material],c=s[e.fpcModel]?s[e.fpcModel]:"",h=e.thickness,u="";e.material==="Tape"?u=`${l}${a}_${c}`:e.material==="EMI Shielding Film"?u=`${l}_${h}`:u=`${l}${a}_${h}`;let d=`G${a.toUpperCase()}SL`;return`Gerber_${i}_${u}.${d}`}},_ze=new n3e;var Rle=class extends hu{encodeRule(){let t=te.getInstance(),e=t.getAllPasteExpansion(),r=t.getAllSolderExpansion(),i=[];return e.forEach(n=>{i.push(or.getInstance().encode("RULE",n))}),r.forEach(n=>{i.push(or.getInstance().encode("RULE",n))}),i}encodePads(t){return t.map(r=>{let i=or.getInstance().encode("PAD",r);return i.id=r.globalIndex,i.number=r.number,i})}};var Rq=class{constructor(t){this.filterTypes=null;this.planeLayerIds=[];this.options=t,this.filterTypes=this.filterObject();for(let e of t.layerConfigs)e.layerType==="PLANE"&&this.planeLayerIds.push(e.layerId)}include(t){return this.options.objectConfigs.includes(t)}getLayerInfo(t){return this.options.layerConfigs.find(r=>r.layerId==t)}isPlaneLayer(t){return this.planeLayerIds.includes(t)}filterObject(){let t=[];return this.options.objectConfigs?(this.options.objectConfigs.forEach(e=>{e==="BoardOutline"?t.push("Board Outline"):e==="BoardCutout"?t.push("Slot Region"):e==="CopperOutline"||e==="CopperFilled"?t.push("Copper Region"):e==="SolidRegion"?t.push("Fill Region"):e==="ProhibitedRegion"?t.push("Prohibited Region"):e==="Line"?t.push("Line"):e==="FPCStiffener"&&t.push("FPC Stiffener")}),t):null}filterTypesInclude(t){return!this.filterTypes||this.filterTypes.includes(t)}isUsedLayerId(t){return this.options.layerConfigs.some(e=>e.layerId==t)}isSilkLayer(t){return t==3||t==4}getFPCInfo(t){let{material:e,thickness:r,fpcModel:i}=t;return{material:e,thickness:r,fpcModel:i}}getPanelize(){let t=[],e=ai.getInstance(),r=e.items.concat(e.outlines);for(let i of r){let n;n=i.layerId;let s=gr(n);if(i instanceof ys){if(!s&&!this.isUsedLayerId(n))continue;let a=i.primitive;t.push({type:"line",layerId:n,start:a.start(),end:a.end()})}else if(i instanceof Li){if(!s&&!this.isUsedLayerId(n))continue;let{strokeWidth:a,fontFamily:l,key:c,value:h,showKey:u,showValue:d}=i;if(!u&&!d)continue;let p=[],m=[],g=[],y=[],b=[],P=[],T=!1,I=!1,C=i.getRealOutline();for(let E of C)E instanceof Kp?(T=!E.flag,b.push(E.pl),m.push(E.flag),g.push(E.order),y.push(E.group)):P.push(E);if(!b.length&&!P.length)continue;i.type==1?(p=$5(b),I=!1):(p=P.map(WT),I=!0),t.push({type:"text",layerId:n,strokeWidth:a,fontFamily:l,key:c,value:h,isOutlineFont:I,hasHole:T,outlinesData:p,outlinesFlag:m,outlinesOrder:g,outlinesGroup:y})}else if(i instanceof Je){let{center:a,pasteExpansion:l,topSolderExpansion:c,bottomSolderExpansion:h}=i,u={layerId:n,center:a,pasteExpansion:l,topSolderExpansion:c,bottomSolderExpansion:h};if(s||Io(n)){let d=i.top;d.type=="ELLIPSE"&&t.push({type:"pad",side:"top",width:d.width,...u})}if(s||Sx(n)){let d=i.bottom;d.type=="ELLIPSE"&&t.push({type:"pad",side:"bottom",width:d.width,...u})}}else if(i instanceof Po){let a=i.type=="Slot Region",{center:l,radius:c,strokeWidth:h}=i;if(!a&&!this.isUsedLayerId(n))continue;t.push({type:"circle",layerId:n,isSlot:a,center:l,radius:c,strokeWidth:h})}else if(i instanceof nl){if(!s&&!this.isUsedLayerId(n))continue;let a=i.length>1e-8&&i.end.distance1(i.start)<.1&&i.getAngle()>Math.PI,{center:l,startAngle:c,sweepAngle:h,rx:u,ry:d}=i.primitive;t.push({type:"arc",layerId:n,needSplit:a,width:i.width,center:l,startAngle:c,sweepAngle:h,rx:u,ry:d})}}return t}getColorSilkBoard(){}getCopper(){let t=[];if(!this.include("CopperFilled"))return t;let r=Wo.getInstance().getAllItem();for(let i of r){let{layerId:n,isSolid:s,optimization:a,optimizationWidth:l,gridLineWidth:c}=i;if(!this.isUsedLayerId(n))continue;let h=i.getOutline();if(!(h!=null&&h.length))continue;let u=$5(h),d=i.number,p={layerId:n,isSolid:s,optimization:a,optimizationWidth:l,gridLineWidth:c,outline:u,order:d};t.push(p)}return t}getPlaneZone(){let t=[];if(!this.include("PlaneZone"))return t;let e=Ho.getInstance().getAllItem();e=e.sort((r,i)=>i.bbox.width()-r.bbox.width()||i.bbox.height()-r.bbox.height());for(let r of e){let{layerId:i,style:n}=r;if(!r.style||!this.isUsedLayerId(i))continue;let s=r.getOutline();if(!(s!=null&&s.length))continue;let a=$5(s),l={layerId:i,style:n,outline:a};t.push(l)}return t}getImage(t=Qs.getInstance().getAllItem()){let e=[];if(!this.include("ComponentSilkscreen")&&!this.include("Image"))return e;let r=t;xr(r,(i,n)=>n.buildBBox().area()-i.buildBBox().area(),0,r.length);for(let i of r){let{layerId:n}=i;if(!this.isUsedLayerId(n))continue;let s=!!i.getParent();if(n!=56){if(s){if(this.isSilkLayer(n)){if(!this.include("ComponentSilkscreen"))continue}else if(!this.include("Image"))continue}else if(!this.include("Image"))continue}let a=$5(i.template);if(!(a!=null&&a.length))continue;let l=i.getViewMatrix().toMatrix3(),c={layerId:n,template:a,matrix:l,hasParent:s};e.push(c)}return e}getDrillDrawing(){return GWe()}getDrillTable(t){let e=[];t.textModels&&t.textModels.length&&(e=this.getText(t.textModels));let r=[];t.imageModels&&t.imageModels.length&&(r=this.getImage(t.imageModels));let i=[];return t.polygonModels&&t.polygonModels.length&&(i=this.getPolygon(t.polygonModels)),{dataTextArr:e,dataImageArr:r,dataPolyArr:i}}getText(t=mo.getInstance().getAllItem()){let e=[],r=t;if(!r.length)return e;for(let i of r){let{layerId:n,strokeWidth:s,fontFamily:a,key:l,value:c,showKey:h,showValue:u}=i,d=i.getParent(),p=!!l;if(n!=56){if(d&&d instanceof vi){if(p){if(!this.include("ComponentProperty"))continue}else if(this.isSilkLayer(n)&&!this.include("ComponentSilkscreen"))continue}else if(!this.include("Text"))continue}if(!this.isUsedLayerId(n)||!h&&!u)continue;let m=[],g=[],y=[],b=[],P=[],T=[],I=!1,C=!1,E=i.getRealOutline();for(let O of E)O instanceof Kp?(I||(I=!O.flag),P.push(O.pl),g.push(O.flag),y.push(O.order),b.push(O.group)):T.push(O);!P.length&&!T.length||(i.type==1?(m=$5(P),C=!0):(m=T.map(WT),C=!1),e.push({layerId:n,strokeWidth:s,fontFamily:a,key:l,value:c,isOutlineFont:C,hasHole:I,outlinesData:m,outlinesFlag:g,outlinesOrder:y,outlinesGroup:b}))}return e}getPolygon(t=Mi.getInstance().getAllItem()){let e=[],r=t;if(!r.length)return e;r=(n=>{let s=[],a=[];return n.forEach(l=>{l.outline instanceof Gt?s.push(l):a.push(l)}),s.concat(a)})(r);for(let n of r){let{layerId:s,type:a,strokeWidth:l}=n;if(n.getParent()){if(this.isSilkLayer(s)){if(!this.include("ComponentSilkscreen"))continue}else if(!this.filterTypesInclude(n.type))continue}else if(!this.filterTypesInclude(n.type))continue;if(!gr(s)&&!this.isUsedLayerId(s)||this.isPlaneLayer(s))continue;let u;switch(a=="FPC Stiffener"&&(u=this.getFPCInfo(n.component)),a){case"Board Outline":case"Line":{let d=n.getMathGraphics(s,0);if(!d)continue;let p=WT(d);e.push({layerId:s,type:a,strokeWidth:l,polylineData:p});break}case"FPC Stiffener":case"Fill Region":{let d=n.getMathGraphics(s,0);if(!d)continue;let p;if(d instanceof fe){let m=WT(d);e.push({layerId:s,type:a,strokeWidth:l,polylineData:m,fpc:u})}else{p=[];let m=d.items.map(WT);e.push({layerId:s,type:a,strokeWidth:l,polylineGroupData:m,fpc:u})}break}case"Slot Region":{let d=n.getMathGraphics(s,0);if(!d)continue;let p=WT(d);e.push({layerId:s,type:a,strokeWidth:l,polylineData:p});break}case"Prohibited Region":case"Copper Region":break;default:break}}return e}getRect(){let t=[],e=rn.getInstance().getAllItem();for(let r of e){let{layerId:i,type:n,strokeWidth:s}=r,a=r.getParent(),l=!!a;if(a){if(this.isSilkLayer(i)){if(!this.include("ComponentSilkscreen"))continue}else if(!this.filterTypesInclude(n))continue}else if(!this.filterTypesInclude(n))continue;if(!gr(i)&&!this.isUsedLayerId(i)||this.isPlaneLayer(i))continue;let h;switch(n=="FPC Stiffener"&&(h=this.getFPCInfo(r.component)),n){case"Board Outline":case"Line":case"FPC Stiffener":case"Fill Region":case"Slot Region":{let u=r.getMathGraphics(i);if(!u)continue;let d=WT(u),p={layerId:i,type:n,strokeWidth:s,hasParent:l,polylineData:d,fpc:h};t.push(p);break}case"Prohibited Region":case"Copper Region":continue;default:continue}}return t}getCircle(){let t=[],e=zi.getInstance().getAllItem();for(let r of e){let{layerId:i,type:n,center:s,radius:a,strokeWidth:l}=r,c=r.getParent(),h=!!c;if(c){if(this.isSilkLayer(i)){if(!this.include("ComponentSilkscreen"))continue}else if(!this.filterTypesInclude(n))continue}else if(!this.filterTypesInclude(n))continue;if(!gr(i)&&!this.isUsedLayerId(i)||this.isPlaneLayer(i))continue;let d;switch(n=="FPC Stiffener"&&(d=this.getFPCInfo(r.component)),n){case"Board Outline":case"Line":case"FPC Stiffener":case"Fill Region":case"Slot Region":{let p={layerId:i,type:n,strokeWidth:l,hasParent:h,center:s,radius:a,fpc:d};t.push(p);break}case"Prohibited Region":case"Copper Region":break;default:break}}return t}getDimension(){let t=[];if(!this.include("Dimension"))return t;let e=Ka.getInstance().getAllItem(),r=Za.getInstance().getAllItem(),i=Sl.getInstance().getAllItem(),n=s=>{for(let a of s){let{layerId:l,strokeWidth:c}=a;if(!this.isUsedLayerId(l))continue;let h=a.getBaseGraphics(),u=$5(h.map(fe.build7)),d=a instanceof zd?a.getDegree():null,p={layerId:l,strokeWidth:c,linesData:u,degreeObject:d};t.push(p)}};return n(e),n(r),n(i),t}getTearDrop(){let t=[],e=Mi.getInstance().getAllItem();for(let r of e){let{layerId:i,type:n}=r;if(n=="TearDrop"){if(!this.include("TearDrop")||!this.isUsedLayerId(i))continue;let s=r.getMathGraphics(i,0);if(!s)continue;let a=WT(s),l={layerId:i,type:n,polylineData:a};t.push(l)}}return t}getPad(){let t=[];return this.include("Pad")&&$n.getInstance().iterator(e=>{let r=e.layerId,i=gr(r),{pasteExpansion:n,topSolderExpansion:s,bottomSolderExpansion:a,plated:l,center:c,rotation:h,holeShape:u,holeLength:d,holeOffset:p,holeRadius:m,holeRotation:g,unusedInnerLayers:y}=e,b;if(e.isPolygon()){let C=e.polygonPl;if(!C)return;b=WT(C)}let P,T,I;(i||1==r)&&(P=this.getPadStyle(e,1,s,!i&&n)),(i||2==r)&&(I=this.getPadStyle(e,2,a,!i&&n)),i&&(T=this.getPadStyle(e,15)),t.push({layerId:r,pasteExpansion:n,topSolderExpansion:s,bottomSolderExpansion:a,plated:l,center:c,rotation:h,holeShape:u,holeLength:d,holeOffset:p,holeRadius:m,holeRotation:g,top:P,inner:T,bottom:I,polylineData:b,unusedInnerLayers:y})}),t}getPadStyle(t,e,r,i){let n,s=t.getPad(e);if(s){let a=t.isPolygon(),l=this.getExpansionLayer(e),c=a&&l&&t.getMathGraphics(l[0]),h=a&&l&&t.getMathGraphics(l[1]),{type:u,width:d,height:p,ratio:m}=s;n={type:u,width:d,height:p,ratio:m,solderExpansionRatio:r!=null&&t.getExpansionRatio(m,d,p,r),pasteExpansionRatio:i!=null&&t.getExpansionRatio(m,d,p,i),solderPolyData:r!=null&&c&&WT(c),pastePolyData:i!=null&&h&&WT(h)}}return n}getExpansionLayer(t){switch(t){case 1:return[5,7];case 2:return[6,8]}}getVia(){let t=[];return this.include("Via")&&Tn.getInstance().iterator(e=>{let{center:r,radius:i,holeRadius:n,topExpansion:s,bottomExpansion:a}=e,{startLayer:l,endLayer:c,type:h,unusedInnerLayers:u}=e;t.push({startLayer:l,endLayer:c,type:h,center:r,radius:i,holeRadius:n,topExpansion:s,bottomExpansion:a,unusedInnerLayers:u})}),t}getTrack(){let t=[];if(!this.include("Track"))return t;let e=x.getInstance().origin;return An.getInstance().iterator(r=>{let{layerId:i,width:n,start:s,end:a}=r;if(!this.isUsedLayerId(i))return;let l=!1;if(r instanceof Oi){l=!0;let{sweepAngle:c,center:h,isCCW:u,radius:d}=r,p=Math.abs(c),m=h.sub(e);if(p>0&&p<Jte&&(1-Math.cos(p/2))/p<.01||Math.abs(m.x)>1e4||Math.abs(m.y)>1e4){let y=q.build4(s,a,h,d,d,u?le.CCW:le.CW).points(.01);for(let b=1,P=y.length;b<P;b++){let T=y[b];t.push({layerId:i,width:n,start:s,end:T,isArc:!1}),s=T}}else t.push({layerId:i,width:n,start:s,end:a,isArc:l,sweepAngle:c,center:h,isCCW:u,radius:d})}else t.push({layerId:i,width:n,start:s,end:a,isArc:l})}),t}};var o3e="FlyingProbeTesting.json";function vze(o){let t=new Date,e=t.getFullYear(),r=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),n=`${e}-${r}-${i}`;return`FlyingProbeTesting_${(o||"PCB").replace(/[^\w\u0082-\ufffc]+/g," ").replace(/[\s_]+/g," ").trim().replace(/\s/g,"_")}_${n}.json`}function Wvt(o){return o=="GND"?"GND":""}function zvt(o){switch(o){case"RECT":return"R";case"ELLIPSE":return"C";case"OVAL":return"O";case"POLYGON":return"P";default:return""}}function Yvt(o,t){let{width:e,height:r}=o;switch(o.type){case"RECT":return[e,r];case"ELLIPSE":return[e,e];case"OVAL":return[e,r];case"POLYGON":let i=Fg(t,o,0).bbox();return[i.width(),i.height()];default:return[0,0]}}function jvt(o){return+o.toFixed(3)}function Dq(o){console.time("exportFlyingProbeJSON time");let t=G=>+(G*10).toFixed(4),e=G=>jvt(Ht.regularD(Ht.toDegrees(G))),r=x.getInstance().origin,i=Cr.getAllItem(),n=0,s={},a=0,l=0,c=1,h=(G,W,L,B,N)=>{u.push([u.length+1,G,W,t(L),t(B),e(N)])},u=i.map((G,W)=>{let{globalIndex:L,designator:B,layerId:N,position:U,rotation:k}=G;if(U=U.sub(r),B=B.replace(/[:;<>\/\\#*?"|]/g,"_").replace(/__+/g,"_"),B=B||"PRENULL"+ ++n,s[L]=B,!G.getPads().length){a++;return}return[W+1,B,N==gp.TOPLAYER?"T":"B",t(U.x),t(U.y),e(k),W]});a>0&&(u=u.filter(G=>G)),u=Pd(u,c+""),u.forEach((G,W)=>G[l]=W+1);let d=!1,p=!1,m="TPJLC",g="TPJLC2",y={[m]:1,[g]:1};u.forEach((G,W)=>{let L=G[c];y[L]?y[L]++:y[L]=1});let b=[],P=0,T={},I=0,C=/^NET[_:;<>\/\\#*?"|]+(\d+)$/i,E=$n.getInstance().getAllItem().filter(G=>{var L;T[G.net]=!0;let W=(L=G.net.match(C))==null?void 0:L[1];return W&&+W>I&&(I=+W),!(G.getParent()instanceof Me)&&!!G.net}),O={},_=(G,W,L)=>{let{holeShape:B,holeRadius:N,holeLength:U,net:k}=G;if(k&&O[k])k=O[k];else{let me=k.replace(/[:;<>\/\\#*?"|]/g,"_").replace(/__+/g,"_"),Oe=!me||me.length>10||/[^\x20-\x7f]/.test(me);Oe=Oe||me!=k&&!!T[me];let Ie=me;Oe&&(Ie="NET_"+ ++I),k&&k!=Ie&&(O[k]=Ie),T[Ie]=!0,k=Ie}let V=!L&&G.padType==1,Y=!L&&G.padType!=1,X=G.num;X||(X="999");let Z=L?W+"_"+X:"",Q=0,ae=0;(B=="ROUND"||B=="SLOT")&&(Q=N*2||0,ae=U||0);let he=V?"TP":Q>0?"DIP":"SMD",re=[],{top:se,bottom:K}=G;if(se&&re.push(se),K&&re.push(K),!!re.length){if(V){let me=G.center.sub(r);se&&!d&&(d=!0,h(m,"T",me.x,me.y,0)),K&&!p&&(p=!0,h(g,"B",me.x,me.y,0))}re.forEach(me=>{let[Oe,Ie]=Yvt(me,G),ue=G.center.sub(r),Pe=me==se?"T":"B";if(V)Pe=="T"?Z=m+"_"+X:Z=g+"_"+X;else if(Y){let j=G.center.sub(r);h(W,Pe,j.x,j.y,0),Z=W+"_"+X}b.push([++P,Z,t(ue.x),t(ue.y),Pe,he,k,Wvt(k),zvt(me.type),t(Oe),t(Ie),t(Q),t(ae),e(G.rotation)])})}},R=(G,W)=>{let L=/^\d+$/,B=L.test(G.num+""),N=L.test(W.num+"");return B&&N?+G.num-+W.num:B?-1:N?1:G.num==W.num?0:G.num<W.num?-1:1};if(u.forEach((G,W)=>{let L=G.pop(),U=i[L].getPads().map(V=>V.model),k=G[c];U.sort(R);for(let V of U)_(V,k,!0)}),E.length){let G=E,W=G.filter(N=>N.padType!=1),L=G.filter(N=>N.padType==1),B=0;for(let N of W){let U="";for(;;)if(U="PAD"+ ++B,!y[U]){y[U]=1;break}_(N,U,!1)}for(let N of L)_(N,"",!1)}function v(G,W,L){let B=W<L.length-1?",":"";return`
		[${G[0]}, "${G[1]}", "${G[2]}", ${G[3]}, ${G[4]}, ${G[5]}]${B}`}function D(G,W,L){let B=W<L.length-1?",":"";return`
		[${G[0]}, "${G[1]}", ${G[2]}, ${G[3]}, "${G[4]}", "${G[5]}", "${G[6]}", "${G[7]}", "${G[8]}", ${G[9]}, ${G[10]}, ${G[11]}, ${G[12]}, ${G[13]}]${B}`}let w=u.map(v).join(""),F=b.map(D).join(""),z=`{
"lengthUnit": "mil",
"remark": ${PT.getInstance().itemsCount==0?"[]":'["fly_line"]'},
"components": {
	"fields": ["COMPONENT_NO", "COMPONENT_NAME", "LAYER", "X_COORDINATE", "Y_COORDINATE", "ANGLE"],
	"rows": [${w}
	]
},
"pins": {
	"fields": ["PIN_NO", "PIN_NAME", "PIN_X", "PIN_Y", "LAYER", "PIN_TYPE", "NET_NAME", "NET_TYPE", "PAD_SHAPE", "PAD_SIZEX", "PAD_SIZEY", "HOLE_SIZE", "HOLE_LEN", "PAD_ANGLE"],
	"rows": [${F}
	]
}
}`;return console.timeEnd("exportFlyingProbeJSON time"),{fileContent:z}}var Dle=null,l3e=new ArrayBuffer(8),s3e=new Float64Array(l3e),a3e=new Uint32Array(l3e),xze=new Uint16Array(l3e),Xvt=self[["e","v","a","l"].join("")],ip=class o{static repeat(t,e){let r=new Array(e);for(;e-- >0;)r[e]=t;return r.join("")}static lpad(t,e,r){let i=r-t.length;return i>0?this.repeat(e,i)+t:t}static rpad(t,e,r){let i=r-t.length;return i>0?t+this.repeat(e,i):t}static strHashcode(t){if(t.length>0){let e=0;for(let r=0;r<t.length;r++)e=31*e+t.charCodeAt(r)|0;return e}else return 0}static arraycopy(t,e,r,i,n){if(t.length>=e+n&&r.length>=i+n)for(;n-- >0;)r[i++]=t[e++];else throw new Error("arraycopy out of range")}static undefAsNull(t){return null}static reverse(t,e){for(let r=0,i=t.length-1;i>=0;r++,i--)e[r]=t[i];return e}static sortAsc(t,e){return t-e}static xmlDecode(t){let e=t.length,r=new Array,i=-1;for(let n=0;n<e;n++){let s=t.charAt(n);if(i>=0){if(s===";"){let a=t.substring(i+1,n);switch(a){case"lt":r.push("<");break;case"gt":r.push(">");break;case"quot":r.push('"');break;case"apos":r.push("'");break;case"amp":r.push("&");break;default:if(a.charAt(0)==="#"){let l=parseInt(a.substring(1));r.push(String.fromCharCode(l))}else r.push("&"+a+";")}i=-1}}else s==="&"?i=n:r.push(s)}return i>=0&&r.push(t.substring(i)),r.join("")}static addAll(t,e){for(let r of e)t.push(r)}static equals(t,e){if(t.length==e.length){for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}else return!1}static remove(t,e){let r=0,i=t.length;for(let n=0;n<i;n++)t[n]===e&&(t.splice(n,1),n--,i--,r++);return r}static getUrlVars(){for(var t={},e=location.href.slice(location.href.indexOf("?")+1).split("&"),r=0;r<e.length;r++){var i=e[r].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}static prefix(){if(!Dle){let t=this.getUrlVars().version;t?Dle="/analyzer/v"+t:Dle="/analyzer"}return Dle}static add2objS(t,e,r){if(e in t)return t[e];{let i=r(e);return t[e]=i,i}}static downloadFile(t,e){let r=document.createElement("a"),i=URL.createObjectURL(e);r.download=t,r.href=i,r.click(),URL.revokeObjectURL(i)}static downloadFileASCII(t,e,r=""){r||(r=o.getFileExt(t));let i=o.textToBlob(e,o.extToType(r));o.downloadFile(t,i)}static getFileExt(t){let e=t.split(".");return e.length>1?e[e.length-1]:""}static textToBlob(t,e){return new Blob([t],{type:e,endings:"native"})}static extToType(t){let e=";charset=utf-8";switch(t==null?void 0:t.toLocaleLowerCase()){case"json":return"application/json"+e;case"svg":return"image/svg+xml"+e;case"xml":return"text/xml"+e;case"txt":return"text/plain"+e;case"html":return"text/html"+e;case"htm":return"text/html"+e;default:return}}static uuid(){let t=new Array;s3e[0]=new Date().getTime(),t.push(a3e[1].toString(16)),s3e[0]=Math.random(),t.push(xze[3].toString(16));let e=xze[2].toString(16);t.push("4"+e.substr(0,3)),s3e[0]=performance.now();let r=a3e[0].toString(16)+a3e[1].toString(16);return t.push("0"+r.substr(0,3)),t.push(r.substr(3)),t.join("-")}static funcCopy(t){return Xvt("("+t.toString()+")")}static NVL(...t){for(let e of t)if(e!==null)return e;return null}static stringToUint8Array(t){let e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}};var Xs=new ft;var Rze={},qvt=(function(o,t,e,r,i){var n=new Worker(Rze[t]||(Rze[t]=URL.createObjectURL(new Blob([o+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return n.onmessage=function(s){var a=s.data,l=a.$e$;if(l){var c=new Error(l[0]);c.code=l[1],c.stack=l[2],i(c,null)}else i(null,a)},n.postMessage(e,r),n}),tc=Uint8Array,l2=Uint16Array,Mq=Int32Array,fG=new tc([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),mG=new tc([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),wq=new tc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mze=function(o,t){for(var e=new l2(31),r=0;r<31;++r)e[r]=t+=1<<o[r-1];for(var i=new Mq(e[30]),r=1;r<30;++r)for(var n=e[r];n<e[r+1];++n)i[n]=n-e[r]<<5|r;return{b:e,r:i}},Nze=Mze(fG,2),g3e=Nze.b,kle=Nze.r;g3e[28]=258,kle[258]=28;var kze=Mze(mG,0),Bze=kze.b,h3e=kze.r,Lq=new l2(32768);for(du=0;du<32768;++du)x_=(du&43690)>>1|(du&21845)<<1,x_=(x_&52428)>>2|(x_&13107)<<2,x_=(x_&61680)>>4|(x_&3855)<<4,Lq[du]=((x_&65280)>>8|(x_&255)<<8)>>1;var x_,du,wC=(function(o,t,e){for(var r=o.length,i=0,n=new l2(t);i<r;++i)o[i]&&++n[o[i]-1];var s=new l2(t);for(i=1;i<t;++i)s[i]=s[i-1]+n[i-1]<<1;var a;if(e){a=new l2(1<<t);var l=15-t;for(i=0;i<r;++i)if(o[i])for(var c=i<<4|o[i],h=t-o[i],u=s[o[i]-1]++<<h,d=u|(1<<h)-1;u<=d;++u)a[Lq[u]>>l]=c}else for(a=new l2(r),i=0;i<r;++i)o[i]&&(a[i]=Lq[s[o[i]-1]++]>>15-o[i]);return a}),D_=new tc(288);for(du=0;du<144;++du)D_[du]=8;var du;for(du=144;du<256;++du)D_[du]=9;var du;for(du=256;du<280;++du)D_[du]=7;var du;for(du=280;du<288;++du)D_[du]=8;var du,pG=new tc(32);for(du=0;du<32;++du)pG[du]=5;var du,Fze=wC(D_,9,0),Vze=wC(D_,9,1),Gze=wC(pG,5,0),Uze=wC(pG,5,1),Lle=function(o){for(var t=o[0],e=1;e<o.length;++e)o[e]>t&&(t=o[e]);return t},DC=function(o,t,e){var r=t/8|0;return(o[r]|o[r+1]<<8)>>(t&7)&e},Mle=function(o,t){var e=t/8|0;return(o[e]|o[e+1]<<8|o[e+2]<<16)>>(t&7)},gG=function(o){return(o+7)/8|0},W3=function(o,t,e){return(t==null||t<0)&&(t=0),(e==null||e>o.length)&&(e=o.length),new tc(o.subarray(t,e))};var Hze=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],el=function(o,t,e){var r=new Error(t||Hze[o]);if(r.code=o,Error.captureStackTrace&&Error.captureStackTrace(r,el),!e)throw r;return r},y3e=function(o,t,e,r){var i=o.length,n=r?r.length:0;if(!i||t.f&&!t.l)return e||new tc(0);var s=!e,a=s||t.i!=2,l=t.i;s&&(e=new tc(i*3));var c=function(se){var K=e.length;if(se>K){var me=new tc(Math.max(K*2,se));me.set(e),e=me}},h=t.f||0,u=t.p||0,d=t.b||0,p=t.l,m=t.d,g=t.m,y=t.n,b=i*8;do{if(!p){h=DC(o,u,1);var P=DC(o,u+1,3);if(u+=3,P)if(P==1)p=Vze,m=Uze,g=9,y=5;else if(P==2){var E=DC(o,u,31)+257,O=DC(o,u+10,15)+4,_=E+DC(o,u+5,31)+1;u+=14;for(var R=new tc(_),v=new tc(19),D=0;D<O;++D)v[wq[D]]=DC(o,u+D*3,7);u+=O*3;for(var w=Lle(v),F=(1<<w)-1,H=wC(v,w,1),D=0;D<_;){var z=H[DC(o,u,F)];u+=z&15;var T=z>>4;if(T<16)R[D++]=T;else{var G=0,W=0;for(T==16?(W=3+DC(o,u,3),u+=2,G=R[D-1]):T==17?(W=3+DC(o,u,7),u+=3):T==18&&(W=11+DC(o,u,127),u+=7);W--;)R[D++]=G}}var L=R.subarray(0,E),B=R.subarray(E);g=Lle(L),y=Lle(B),p=wC(L,g,1),m=wC(B,y,1)}else el(1);else{var T=gG(u)+4,I=o[T-4]|o[T-3]<<8,C=T+I;if(C>i){l&&el(0);break}a&&c(d+I),e.set(o.subarray(T,C),d),t.b=d+=I,t.p=u=C*8,t.f=h;continue}if(u>b){l&&el(0);break}}a&&c(d+131072);for(var N=(1<<g)-1,U=(1<<y)-1,k=u;;k=u){var G=p[Mle(o,u)&N],V=G>>4;if(u+=G&15,u>b){l&&el(0);break}if(G||el(2),V<256)e[d++]=V;else if(V==256){k=u,p=null;break}else{var Y=V-254;if(V>264){var D=V-257,X=fG[D];Y=DC(o,u,(1<<X)-1)+g3e[D],u+=X}var Z=m[Mle(o,u)&U],Q=Z>>4;Z||el(3),u+=Z&15;var B=Bze[Q];if(Q>3){var X=mG[Q];B+=Mle(o,u)&(1<<X)-1,u+=X}if(u>b){l&&el(0);break}a&&c(d+131072);var ae=d+Y;if(d<B){var he=n-B,re=Math.min(B,ae);for(he+d<0&&el(3);d<re;++d)e[d]=r[he+d]}for(;d<ae;++d)e[d]=e[d-B]}}t.l=p,t.p=k,t.b=d,t.f=h,p&&(h=1,t.m=g,t.d=m,t.n=y)}while(!h);return d!=e.length&&s?W3(e,0,d):e.subarray(0,d)},H3=function(o,t,e){e<<=t&7;var r=t/8|0;o[r]|=e,o[r+1]|=e>>8},lG=function(o,t,e){e<<=t&7;var r=t/8|0;o[r]|=e,o[r+1]|=e>>8,o[r+2]|=e>>16},Nle=function(o,t){for(var e=[],r=0;r<o.length;++r)o[r]&&e.push({s:r,f:o[r]});var i=e.length,n=e.slice();if(!i)return{t:ZD,l:0};if(i==1){var s=new tc(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(C,E){return C.f-E.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],c=0,h=1,u=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=i-1;)a=e[e[c].f<e[u].f?c++:u++],l=e[c!=h&&e[c].f<e[u].f?c++:u++],e[h++]={s:-1,f:a.f+l.f,l:a,r:l};for(var d=n[0].s,r=1;r<i;++r)n[r].s>d&&(d=n[r].s);var p=new l2(d+1),m=Ble(e[h-1],p,0);if(m>t){var r=0,g=0,y=m-t,b=1<<y;for(n.sort(function(E,O){return p[O.s]-p[E.s]||E.f-O.f});r<i;++r){var P=n[r].s;if(p[P]>t)g+=b-(1<<m-p[P]),p[P]=t;else break}for(g>>=y;g>0;){var T=n[r].s;p[T]<t?g-=1<<t-p[T]++-1:++r}for(;r>=0&&g;--r){var I=n[r].s;p[I]==t&&(--p[I],++g)}m=t}return{t:new tc(p),l:m}},Ble=function(o,t,e){return o.s==-1?Math.max(Ble(o.l,t,e+1),Ble(o.r,t,e+1)):t[o.s]=e},u3e=function(o){for(var t=o.length;t&&!o[--t];);for(var e=new l2(++t),r=0,i=o[0],n=1,s=function(l){e[r++]=l},a=1;a<=t;++a)if(o[a]==i&&a!=t)++n;else{if(!i&&n>2){for(;n>138;n-=138)s(32754);n>2&&(s(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(s(i),--n;n>6;n-=6)s(8304);n>2&&(s(n-3<<5|8208),n=0)}for(;n--;)s(i);n=1,i=o[a]}return{c:e.subarray(0,r),n:t}},cG=function(o,t){for(var e=0,r=0;r<t.length;++r)e+=o[r]*t[r];return e},b3e=function(o,t,e){var r=e.length,i=gG(t+2);o[i]=r&255,o[i+1]=r>>8,o[i+2]=o[i]^255,o[i+3]=o[i+1]^255;for(var n=0;n<r;++n)o[i+n+4]=e[n];return(i+4+r)*8},d3e=function(o,t,e,r,i,n,s,a,l,c,h){H3(t,h++,e),++i[256];for(var u=Nle(i,15),d=u.t,p=u.l,m=Nle(n,15),g=m.t,y=m.l,b=u3e(d),P=b.c,T=b.n,I=u3e(g),C=I.c,E=I.n,O=new l2(19),_=0;_<P.length;++_)++O[P[_]&31];for(var _=0;_<C.length;++_)++O[C[_]&31];for(var R=Nle(O,7),v=R.t,D=R.l,w=19;w>4&&!v[wq[w-1]];--w);var F=c+5<<3,H=cG(i,D_)+cG(n,pG)+s,z=cG(i,d)+cG(n,g)+s+14+3*w+cG(O,v)+2*O[16]+3*O[17]+7*O[18];if(l>=0&&F<=H&&F<=z)return b3e(t,h,o.subarray(l,l+c));var G,W,L,B;if(H3(t,h,1+(z<H)),h+=2,z<H){G=wC(d,p,0),W=d,L=wC(g,y,0),B=g;var N=wC(v,D,0);H3(t,h,T-257),H3(t,h+5,E-1),H3(t,h+10,w-4),h+=14;for(var _=0;_<w;++_)H3(t,h+3*_,v[wq[_]]);h+=3*w;for(var U=[P,C],k=0;k<2;++k)for(var V=U[k],_=0;_<V.length;++_){var Y=V[_]&31;H3(t,h,N[Y]),h+=v[Y],Y>15&&(H3(t,h,V[_]>>5&127),h+=V[_]>>12)}}else G=Fze,W=D_,L=Gze,B=pG;for(var _=0;_<a;++_){var X=r[_];if(X>255){var Y=X>>18&31;lG(t,h,G[Y+257]),h+=W[Y+257],Y>7&&(H3(t,h,X>>23&31),h+=fG[Y]);var Z=X&31;lG(t,h,L[Z]),h+=B[Z],Z>3&&(lG(t,h,X>>5&8191),h+=mG[Z])}else lG(t,h,G[X]),h+=W[X]}return lG(t,h,G[256]),h+W[256]},Wze=new Mq([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ZD=new tc(0),zze=function(o,t,e,r,i,n){var s=n.z||o.length,a=new tc(r+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(r,a.length-i),c=n.l,h=(n.r||0)&7;if(t){h&&(l[0]=n.r>>3);for(var u=Wze[t-1],d=u>>13,p=u&8191,m=(1<<e)-1,g=n.p||new l2(32768),y=n.h||new l2(m+1),b=Math.ceil(e/3),P=2*b,T=function(Oe){return(o[Oe]^o[Oe+1]<<b^o[Oe+2]<<P)&m},I=new Mq(25e3),C=new l2(288),E=new l2(32),O=0,_=0,R=n.i||0,v=0,D=n.w||0,w=0;R+2<s;++R){var F=T(R),H=R&32767,z=y[F];if(g[H]=z,y[F]=H,D<=R){var G=s-R;if((O>7e3||v>24576)&&(G>423||!c)){h=d3e(o,l,0,I,C,E,_,v,w,R-w,h),v=O=_=0,w=R;for(var W=0;W<286;++W)C[W]=0;for(var W=0;W<30;++W)E[W]=0}var L=2,B=0,N=p,U=H-z&32767;if(G>2&&F==T(R-U))for(var k=Math.min(d,G)-1,V=Math.min(32767,R),Y=Math.min(258,G);U<=V&&--N&&H!=z;){if(o[R+L]==o[R+L-U]){for(var X=0;X<Y&&o[R+X]==o[R+X-U];++X);if(X>L){if(L=X,B=U,X>k)break;for(var Z=Math.min(U,X-2),Q=0,W=0;W<Z;++W){var ae=R-U+W&32767,he=g[ae],re=ae-he&32767;re>Q&&(Q=re,z=ae)}}}H=z,z=g[H],U+=H-z&32767}if(B){I[v++]=268435456|kle[L]<<18|h3e[B];var se=kle[L]&31,K=h3e[B]&31;_+=fG[se]+mG[K],++C[257+se],++E[K],D=R+L,++O}else I[v++]=o[R],++C[o[R]]}}for(R=Math.max(R,D);R<s;++R)I[v++]=o[R],++C[o[R]];h=d3e(o,l,c,I,C,E,_,v,w,R-w,h),c||(n.r=h&7|l[h/8|0]<<3,h-=7,n.h=y,n.p=g,n.i=R,n.w=D)}else{for(var R=n.w||0;R<s+c;R+=65535){var me=R+65535;me>=s&&(l[h/8|0]=c,me=s),h=b3e(l,h+1,o.subarray(R,me))}n.i=s}return W3(a,0,r+gG(h)+i)},$vt=(function(){for(var o=new Int32Array(256),t=0;t<256;++t){for(var e=t,r=9;--r;)e=(e&1&&-306674912)^e>>>1;o[t]=e}return o})(),P3e=function(){var o=-1;return{p:function(t){for(var e=o,r=0;r<t.length;++r)e=$vt[e&255^t[r]]^e>>>8;o=e},d:function(){return~o}}},Yze=function(){var o=1,t=0;return{p:function(e){for(var r=o,i=t,n=e.length|0,s=0;s!=n;){for(var a=Math.min(s+2655,n);s<a;++s)i+=r+=e[s];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}o=r,t=i},d:function(){return o%=65521,t%=65521,(o&255)<<24|(o&65280)<<8|(t&255)<<8|t>>8}}},Nq=function(o,t,e,r,i){if(!i&&(i={l:1},t.dictionary)){var n=t.dictionary.subarray(-32768),s=new tc(n.length+o.length);s.set(n),s.set(o,n.length),o=s,i.w=n.length}return zze(o,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(o.length)))*1.5):20:12+t.mem,e,r,i)},Gle=function(o,t){var e={};for(var r in o)e[r]=o[r];for(var r in t)e[r]=t[r];return e},Dze=function(o,t,e){for(var r=o(),i=o.toString(),n=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),s=0;s<r.length;++s){var a=r[s],l=n[s];if(typeof a=="function"){t+=";"+l+"=";var c=a.toString();if(a.prototype)if(c.indexOf("[native code]")!=-1){var h=c.indexOf(" ",8)+1;t+=c.slice(h,c.indexOf("(",h))}else{t+=c;for(var u in a.prototype)t+=";"+l+".prototype."+u+"="+a.prototype[u].toString()}else t+=c}else e[l]=a}return t},wle=[],Kvt=function(o){var t=[];for(var e in o)o[e].buffer&&t.push((o[e]=new o[e].constructor(o[e])).buffer);return t},Zvt=function(o,t,e,r){if(!wle[e]){for(var i="",n={},s=o.length-1,a=0;a<s;++a)i=Dze(o[a],i,n);wle[e]={c:Dze(o[s],i,n),e:n}}var l=Gle({},wle[e].e);return qvt(wle[e].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",e,l,Kvt(l),r)},T3e=function(){return[tc,l2,Mq,fG,mG,wq,g3e,Bze,Vze,Uze,Lq,Hze,wC,Lle,DC,Mle,gG,W3,el,y3e,axt,jze,txt]},Jvt=function(){return[tc,l2,Mq,fG,mG,wq,kle,h3e,Fze,D_,Gze,pG,Lq,Wze,ZD,wC,H3,lG,Nle,Ble,u3e,cG,b3e,d3e,gG,W3,zze,Nq,$ze,jze]};var Qvt=function(){return[Xze,ixt]};var ext=function(){return[qze]},jze=function(o){return postMessage(o,[o.buffer])},txt=function(o){return o&&{out:o.size&&new tc(o.size),dictionary:o.dictionary}};var JD=function(o){return o.ondata=function(t,e){return postMessage([t,e],[t.buffer])},function(t){t.data.length?(o.push(t.data[0],t.data[1]),postMessage([t.data[0].length])):o.flush()}},Ule=function(o,t,e,r,i,n,s){var a,l=Zvt(o,r,i,function(c,h){c?(l.terminate(),t.ondata.call(t,c)):Array.isArray(h)?h.length==1?(t.queuedSize-=h[0],t.ondrain&&t.ondrain(h[0])):(h[1]&&l.terminate(),t.ondata.call(t,c,h[0],h[1])):s(h)});l.postMessage(e),t.queuedSize=0,t.push=function(c,h){t.ondata||el(5),a&&t.ondata(el(4,0,1),null,!!h),t.queuedSize+=c.length,l.postMessage([c,a=h],[c.buffer])},t.terminate=function(){l.terminate()},n&&(t.flush=function(){l.postMessage([])})},hG=function(o,t){return o[t]|o[t+1]<<8},uG=function(o,t){return(o[t]|o[t+1]<<8|o[t+2]<<16|o[t+3]<<24)>>>0},c3e=function(o,t){return uG(o,t)+uG(o,t+4)*4294967296},np=function(o,t,e){for(;e;++t)o[t]=e,e>>>=8},rxt=function(o,t){var e=t.filename;if(o[0]=31,o[1]=139,o[2]=8,o[8]=t.level<2?4:t.level==9?2:0,o[9]=3,t.mtime!=0&&np(o,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),e){o[3]=8;for(var r=0;r<=e.length;++r)o[r+10]=e.charCodeAt(r)}},Xze=function(o){(o[0]!=31||o[1]!=139||o[2]!=8)&&el(6,"invalid gzip data");var t=o[3],e=10;t&4&&(e+=(o[10]|o[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!o[e++]);return e+(t&2)},ixt=function(o){var t=o.length;return(o[t-4]|o[t-3]<<8|o[t-2]<<16|o[t-1]<<24)>>>0},nxt=function(o){return 10+(o.filename?o.filename.length+1:0)},oxt=function(o,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(o[0]=120,o[1]=r<<6|(t.dictionary&&32),o[1]|=31-(o[0]<<8|o[1])%31,t.dictionary){var i=Yze();i.p(t.dictionary),np(o,2,i.d())}},qze=function(o,t){return((o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31)&&el(6,"invalid zlib data"),(o[1]>>5&1)==+!t&&el(6,"invalid zlib data: "+(o[1]&32?"need":"unexpected")+" dictionary"),(o[1]>>3&4)+2};function kq(o,t){return typeof o=="function"&&(t=o,o={}),this.ondata=t,o}var R_=(function(){function o(t,e){if(typeof t=="function"&&(e=t,t={}),this.ondata=e,this.o=t||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new tc(98304),this.o.dictionary){var r=this.o.dictionary.subarray(-32768);this.b.set(r,32768-r.length),this.s.i=32768-r.length}}return o.prototype.p=function(t,e){this.ondata(Nq(t,this.o,0,0,this.s),e)},o.prototype.push=function(t,e){this.ondata||el(5),this.s.l&&el(4);var r=t.length+this.s.z;if(r>this.b.length){if(r>2*this.b.length-32768){var i=new tc(r&-32768);i.set(this.b.subarray(0,this.s.z)),this.b=i}var n=this.b.length-this.s.z;this.b.set(t.subarray(0,n),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(t.subarray(n),32768),this.s.z=t.length-n+32768,this.s.i=32766,this.s.w=32768}else this.b.set(t,this.s.z),this.s.z+=t.length;this.s.l=e&1,(this.s.z>this.s.w+8191||e)&&(this.p(this.b,e||!1),this.s.w=this.s.i,this.s.i-=2)},o.prototype.flush=function(){this.ondata||el(5),this.s.l&&el(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},o})();var sxt=(function(){function o(t,e){Ule([Jvt,function(){return[JD,R_]}],this,kq.call(this,t,e),function(r){var i=new R_(r.data);onmessage=JD(i)},6,1)}return o})();function $ze(o,t){return Nq(o,t||{},0,0)}var zT=(function(){function o(t,e){typeof t=="function"&&(e=t,t={}),this.ondata=e;var r=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:r?r.length:0},this.o=new tc(32768),this.p=new tc(0),r&&this.o.set(r)}return o.prototype.e=function(t){if(this.ondata||el(5),this.d&&el(4),!this.p.length)this.p=t;else if(t.length){var e=new tc(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length),this.p=e}},o.prototype.c=function(t){this.s.i=+(this.d=t||!1);var e=this.s.b,r=y3e(this.p,this.s,this.o);this.ondata(W3(r,e,this.s.b),this.d),this.o=W3(r,this.s.b-32768),this.s.b=this.o.length,this.p=W3(this.p,this.s.p/8|0),this.s.p&=7},o.prototype.push=function(t,e){this.e(t),this.c(e)},o})();var Kze=(function(){function o(t,e){Ule([T3e,function(){return[JD,zT]}],this,kq.call(this,t,e),function(r){var i=new zT(r.data);onmessage=JD(i)},7,0)}return o})();function axt(o,t){return y3e(o,{i:2},t&&t.out,t&&t.dictionary)}var alo=(function(){function o(t,e){this.c=P3e(),this.l=0,this.v=1,R_.call(this,t,e)}return o.prototype.push=function(t,e){this.c.p(t),this.l+=t.length,R_.prototype.push.call(this,t,e)},o.prototype.p=function(t,e){var r=Nq(t,this.o,this.v&&nxt(this.o),e&&8,this.s);this.v&&(rxt(r,this.o),this.v=0),e&&(np(r,r.length-8,this.c.d()),np(r,r.length-4,this.l)),this.ondata(r,e)},o.prototype.flush=function(){R_.prototype.flush.call(this)},o})();var p3e=(function(){function o(t,e){this.v=1,this.r=0,zT.call(this,t,e)}return o.prototype.push=function(t,e){if(zT.prototype.e.call(this,t),this.r+=t.length,this.v){var r=this.p.subarray(this.v-1),i=r.length>3?Xze(r):4;if(i>r.length){if(!e)return}else this.v>1&&this.onmember&&this.onmember(this.r-r.length);this.p=r.subarray(i),this.v=0}zT.prototype.c.call(this,e),this.s.f&&!this.s.l&&!e&&(this.v=gG(this.s.p)+9,this.s={i:0},this.o=new tc(0),this.push(new tc(0),e))},o})();var lxt=(function(){function o(t,e){var r=this;Ule([T3e,Qvt,function(){return[JD,zT,p3e]}],this,kq.call(this,t,e),function(i){var n=new p3e(i.data);n.onmember=function(s){return postMessage(s)},onmessage=JD(n)},9,0,function(i){return r.onmember&&r.onmember(i)})}return o})();var llo=(function(){function o(t,e){this.c=Yze(),this.v=1,R_.call(this,t,e)}return o.prototype.push=function(t,e){this.c.p(t),R_.prototype.push.call(this,t,e)},o.prototype.p=function(t,e){var r=Nq(t,this.o,this.v&&(this.o.dictionary?6:2),e&&4,this.s);this.v&&(oxt(r,this.o),this.v=0),e&&np(r,r.length-4,this.c.d()),this.ondata(r,e)},o.prototype.flush=function(){R_.prototype.flush.call(this)},o})();var f3e=(function(){function o(t,e){zT.call(this,t,e),this.v=t&&t.dictionary?2:1}return o.prototype.push=function(t,e){if(zT.prototype.e.call(this,t),this.v){if(this.p.length<6&&!e)return;this.p=this.p.subarray(qze(this.p,this.v-1)),this.v=0}e&&(this.p.length<4&&el(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),zT.prototype.c.call(this,e)},o})();var cxt=(function(){function o(t,e){Ule([T3e,ext,function(){return[JD,zT,f3e]}],this,kq.call(this,t,e),function(r){var i=new f3e(r.data);onmessage=JD(i)},11,0)}return o})();var wze=(function(){function o(t,e){this.o=kq.call(this,t,e)||{},this.G=p3e,this.I=zT,this.Z=f3e}return o.prototype.i=function(){var t=this;this.s.ondata=function(e,r){t.ondata(e,r)}},o.prototype.push=function(t,e){if(this.ondata||el(5),this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var r=new tc(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length)}else this.p=t;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,e),this.p=null)}},o})();var clo=(function(){function o(t,e){wze.call(this,t,e),this.queuedSize=0,this.G=lxt,this.I=Kze,this.Z=cxt}return o.prototype.i=function(){var t=this;this.s.ondata=function(e,r,i){t.ondata(e,r,i)},this.s.ondrain=function(e){t.queuedSize-=e,t.ondrain&&t.ondrain(e)}},o.prototype.push=function(t,e){this.queuedSize+=t.length,wze.prototype.push.call(this,t,e)},o})();var Zze=function(o,t,e,r){for(var i in o){var n=o[i],s=t+i,a=r;Array.isArray(n)&&(a=Gle(r,n[1]),n=n[0]),n instanceof tc?e[s]=[n,a]:(e[s+="/"]=[new tc(0),a],Zze(n,s,e,r))}},Lze=typeof TextEncoder<"u"&&new TextEncoder,m3e=typeof TextDecoder<"u"&&new TextDecoder,Jze=0;try{m3e.decode(ZD,{stream:!0}),Jze=1}catch{}var Qze=function(o){for(var t="",e=0;;){var r=o[e++],i=(r>127)+(r>223)+(r>239);if(e+i>o.length)return{s:t,r:W3(o,e-1)};i?i==3?(r=((r&15)<<18|(o[e++]&63)<<12|(o[e++]&63)<<6|o[e++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|o[e++]&63):t+=String.fromCharCode((r&15)<<12|(o[e++]&63)<<6|o[e++]&63):t+=String.fromCharCode(r)}},hlo=(function(){function o(t){this.ondata=t,Jze?this.t=new TextDecoder:this.p=ZD}return o.prototype.push=function(t,e){if(this.ondata||el(5),e=!!e,this.t){this.ondata(this.t.decode(t,{stream:!0}),e),e&&(this.t.decode().length&&el(8),this.t=null);return}this.p||el(4);var r=new tc(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length);var i=Qze(r),n=i.s,s=i.r;e?(s.length&&el(8),this.p=null):this.p=s,this.ondata(n,e)},o})();var ulo=(function(){function o(t){this.ondata=t}return o.prototype.push=function(t,e){this.ondata||el(5),this.d&&el(4),this.ondata(Tb(t),this.d=e||!1)},o})();function Tb(o,t){if(t){for(var e=new tc(o.length),r=0;r<o.length;++r)e[r]=o.charCodeAt(r);return e}if(Lze)return Lze.encode(o);for(var i=o.length,n=new tc(o.length+(o.length>>1)),s=0,a=function(h){n[s++]=h},r=0;r<i;++r){if(s+5>n.length){var l=new tc(s+8+(i-r<<1));l.set(n),n=l}var c=o.charCodeAt(r);c<128||t?a(c):c<2048?(a(192|c>>6),a(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|o.charCodeAt(++r)&1023,a(240|c>>18),a(128|c>>12&63),a(128|c>>6&63),a(128|c&63)):(a(224|c>>12),a(128|c>>6&63),a(128|c&63))}return W3(n,0,s)}function hxt(o,t){if(t){for(var e="",r=0;r<o.length;r+=16384)e+=String.fromCharCode.apply(null,o.subarray(r,r+16384));return e}else{if(m3e)return m3e.decode(o);var i=Qze(o),n=i.s,e=i.r;return e.length&&el(8),n}}var eYe=function(o){return o==1?3:o<6?2:o==9?1:0};var uxt=function(o,t){for(;hG(o,t)!=1;t+=4+hG(o,t+2));return[c3e(o,t+12),c3e(o,t+4),c3e(o,t+20)]},dG=function(o){var t=0;if(o)for(var e in o){var r=o[e].length;r>65535&&el(9),t+=r+4}return t},Fle=function(o,t,e,r,i,n,s,a){var l=r.length,c=e.extra,h=a&&a.length,u=dG(c);np(o,t,s!=null?33639248:67324752),t+=4,s!=null&&(o[t++]=20,o[t++]=e.os),o[t]=20,t+=2,o[t++]=e.flag<<1|(n<0&&8),o[t++]=i&&8,o[t++]=e.compression&255,o[t++]=e.compression>>8;var d=new Date(e.mtime==null?Date.now():e.mtime),p=d.getFullYear()-1980;if((p<0||p>119)&&el(10),np(o,t,p<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),t+=4,n!=-1&&(np(o,t,e.crc),np(o,t+4,n<0?-n-2:n),np(o,t+8,e.size)),np(o,t+12,l),np(o,t+14,u),t+=16,s!=null&&(np(o,t,h),np(o,t+6,e.attrs),np(o,t+10,s),t+=14),o.set(r,t),t+=l,u)for(var m in c){var g=c[m],y=g.length;np(o,t,+m),np(o,t+2,y),o.set(g,t+4),t+=4+y}return h&&(o.set(a,t),t+=h),t},tYe=function(o,t,e,r,i){np(o,t,101010256),np(o,t+8,e),np(o,t+10,e),np(o,t+12,r),np(o,t+16,i)},Vle=(function(){function o(t){this.filename=t,this.c=P3e(),this.size=0,this.compression=0}return o.prototype.process=function(t,e){this.ondata(null,t,e)},o.prototype.push=function(t,e){this.ondata||el(5),this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},o})();var dlo=(function(){function o(t,e){var r=this;e||(e={}),Vle.call(this,t),this.d=new R_(e,function(i,n){r.ondata(null,i,n)}),this.compression=8,this.flag=eYe(e.level)}return o.prototype.process=function(t,e){try{this.d.push(t,e)}catch(r){this.ondata(r,null,e)}},o.prototype.push=function(t,e){Vle.prototype.push.call(this,t,e)},o})();var rYe=(function(){function o(t,e){var r=this;e||(e={}),Vle.call(this,t),this.d=new sxt(e,function(i,n,s){r.ondata(i,n,s)}),this.compression=8,this.flag=eYe(e.level),this.terminate=this.d.terminate}return o.prototype.process=function(t,e){this.d.push(t,e)},o.prototype.push=function(t,e){Vle.prototype.push.call(this,t,e)},o})();var iYe=(function(){function o(t){this.ondata=t,this.u=[],this.d=1}return o.prototype.add=function(t){var e=this;if(this.ondata||el(5),this.d&2)this.ondata(el(4+(this.d&1)*8,0,1),null,!1);else{var r=Tb(t.filename),i=r.length,n=t.comment,s=n&&Tb(n),a=i!=t.filename.length||s&&n.length!=s.length,l=i+dG(t.extra)+30;i>65535&&this.ondata(el(11,0,1),null,!1);var c=new tc(l);Fle(c,0,t,r,a,-1);var h=[c],u=function(){for(var y=0,b=h;y<b.length;y++){var P=b[y];e.ondata(null,P,!1)}h=[]},d=this.d;this.d=0;var p=this.u.length,m=Gle(t,{f:r,u:a,o:s,t:function(){t.terminate&&t.terminate()},r:function(){if(u(),d){var y=e.u[p+1];y?y.r():e.d=1}d=1}}),g=0;t.ondata=function(y,b,P){if(y)e.ondata(y,b,P),e.terminate();else if(g+=b.length,h.push(b),P){var T=new tc(16);np(T,0,134695760),np(T,4,t.crc),np(T,8,g),np(T,12,t.size),h.push(T),m.c=g,m.b=l+g+16,m.crc=t.crc,m.size=t.size,d&&m.r(),d=1}else d&&u()},this.u.push(m)}},o.prototype.end=function(){var t=this;if(this.d&2){this.ondata(el(4+(this.d&1)*8,0,1),null,!0);return}this.d?this.e():this.u.push({r:function(){t.d&1&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3},o.prototype.e=function(){for(var t=0,e=0,r=0,i=0,n=this.u;i<n.length;i++){var s=n[i];r+=46+s.f.length+dG(s.extra)+(s.o?s.o.length:0)}for(var a=new tc(r+22),l=0,c=this.u;l<c.length;l++){var s=c[l];Fle(a,t,s,s.f,s.u,-s.c-2,e,s.o),t+=46+s.f.length+dG(s.extra)+(s.o?s.o.length:0),e+=s.b}tYe(a,t,this.u.length,r,e),this.ondata(null,a,!0),this.d=2},o.prototype.terminate=function(){for(var t=0,e=this.u;t<e.length;t++){var r=e[t];r.t()}this.d=2},o})();function Bq(o,t){t||(t={});var e={},r=[];Zze(o,"",e,t);var i=0,n=0;for(var s in e){var a=e[s],l=a[0],c=a[1],h=c.level==0?0:8,u=Tb(s),d=u.length,p=c.comment,m=p&&Tb(p),g=m&&m.length,y=dG(c.extra);d>65535&&el(11);var b=h?$ze(l,c):l,P=b.length,T=P3e();T.p(l),r.push(Gle(c,{size:l.length,crc:T.d(),c:b,f:u,m,u:d!=s.length||m&&p.length!=g,o:i,compression:h})),i+=30+d+y+P,n+=76+2*(d+y)+(g||0)+P}for(var I=new tc(n+22),C=i,E=n-i,O=0;O<r.length;++O){var u=r[O];Fle(I,u.o,u,u.f,u.u,u.c.length);var _=30+u.f.length+dG(u.extra);I.set(u.c,u.o+_),Fle(I,i,u,u.f,u.u,u.c.length,u.o,u.m),i+=16+_+(u.m?u.m.length:0)}return tYe(I,i,r.length,E,C),I}var dxt=(function(){function o(){}return o.prototype.push=function(t,e){this.ondata(null,t,e)},o.compression=0,o})();var plo=(function(){function o(){var t=this;this.i=new zT(function(e,r){t.ondata(null,e,r)})}return o.prototype.push=function(t,e){try{this.i.push(t,e)}catch(r){this.ondata(r,null,e)}},o.compression=8,o})();var flo=(function(){function o(t,e){var r=this;e<32e4?this.i=new zT(function(i,n){r.ondata(null,i,n)}):(this.i=new Kze(function(i,n,s){r.ondata(i,n,s)}),this.terminate=this.i.terminate)}return o.prototype.push=function(t,e){this.i.terminate&&(t=W3(t,0)),this.i.push(t,e)},o.compression=8,o})();var mlo=(function(){function o(t){this.onfile=t,this.k=[],this.o={0:dxt},this.p=ZD}return o.prototype.push=function(t,e){var r=this;if(this.onfile||el(5),this.p||el(4),this.c>0){var i=Math.min(this.c,t.length),n=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(n,!this.c):this.k[0].push(n),t=t.subarray(i),t.length)return this.push(t,e)}else{var s=0,a=0,l=void 0,c=void 0;this.p.length?t.length?(c=new tc(this.p.length+t.length),c.set(this.p),c.set(t,this.p.length)):c=this.p:c=t;for(var h=c.length,u=this.c,d=u&&this.d,p=function(){var b,P=uG(c,a);if(P==67324752){s=1,l=a,m.d=null,m.c=0;var T=hG(c,a+6),I=hG(c,a+8),C=T&2048,E=T&8,O=hG(c,a+26),_=hG(c,a+28);if(h>a+30+O+_){var R=[];m.k.unshift(R),s=2;var v=uG(c,a+18),D=uG(c,a+22),w=hxt(c.subarray(a+30,a+=30+O),!C);v==4294967295?(b=E?[-2]:uxt(c,a),v=b[0],D=b[1]):E&&(v=-1),a+=_,m.c=v;var F,H={name:w,compression:I,start:function(){if(H.ondata||el(5),!v)H.ondata(null,ZD,!0);else{var z=r.o[I];z||H.ondata(el(14,"unknown compression type "+I,1),null,!1),F=v<0?new z(w):new z(w,v,D),F.ondata=function(B,N,U){H.ondata(B,N,U)};for(var G=0,W=R;G<W.length;G++){var L=W[G];F.push(L,!1)}r.k[0]==R&&r.c?r.d=F:F.push(ZD,!0)}},terminate:function(){F&&F.terminate&&F.terminate()}};v>=0&&(H.size=v,H.originalSize=D),m.onfile(H)}return"break"}else if(u){if(P==134695760)return l=a+=12+(u==-2&&8),s=3,m.c=0,"break";if(P==33639248)return l=a-=4,s=3,m.c=0,"break"}},m=this;a<h-4;++a){var g=p();if(g==="break")break}if(this.p=ZD,u<0){var y=s?c.subarray(0,l-12-(u==-2&&8)-(uG(c,l-16)==134695760&&4)):c.subarray(0,a);d?d.push(y,!!s):this.k[+(s==2)].push(y)}if(s&2)return this.push(c.subarray(a),e);this.p=c.subarray(a)}e&&(this.c&&el(13),this.p=null)},o.prototype.register=function(t){this.o[t.compression]=t},o})();var SP=class extends a2{constructor(){super()}};SP.AS="AS",SP.FS="FS",SP.MI="MI",SP.MO="MO",SP.OF="OF",SP.SF="SF";var Fq=class extends SP{constructor(){super();this.code="FS";this.maxIntegerLength=4;this.maxDecimalLength=4;this.omitLeading=!0;this.absolute=!0;this.modifiers[0]="LAX4Y4"}setCoordinateFormat(e,r,i=!0,n=!0){this.maxIntegerLength=e,this.maxDecimalLength=r,this.omitLeading=i,this.absolute=n,this.updateModifiers()}updateModifiers(){this.modifiers.length=1,this.modifiers[0]=this.getOmitFlag()+this.getAbsoluteFlag()+`X${this.maxIntegerLength}${this.maxDecimalLength}Y${this.maxIntegerLength}${this.maxDecimalLength}`}getAbsoluteFlag(){return this.absolute?"A":"I"}getOmitFlag(){return this.omitLeading?"L":"T"}};Fq.ZeroOmission={Leading:"L",Trailing:"T"};var yG=class extends SP{constructor(){super();this.code="MO";this.useInch=!0;this.modifiers[0]="IN"}setUnitAsInch(){this.useInch=!0,this.updateModifiers()}setUnitAsMillimeter(){this.useInch=!1,this.updateModifiers()}updateModifiers(){this.modifiers.length=1,this.modifiers[0]=this.getUnitFlag()}getUnitFlag(){return this.useInch?"IN":"MM"}};var P9=class extends a2{constructor(){super()}};P9.AD="AD",P9.AM="AM";var gg=class gg extends P9{constructor(e,r,i=0){super();this.code=P9.AM;this.name="";this.modifierGroups=[];this.paramsCount=0;this.name=e,typeof r=="string"?this.modifierGroups=[[r]]:this.modifierGroups=r,this.paramsCount=i}exportText(e){let r=a2.delimiter+gg.code+this.name,i=r.length,n=s=>typeof s=="string"?s:typeof s.format=="function"?s.format(e):String(s);if(this.modifierGroups.length>0)for(let s of this.modifierGroups){let a="*"+s.map(n).join(",");i+a.length>a2.maxLength&&(r+=`
`,i=0),r+=a,i+=a.length}return r+=a2.endSign,r}static createOvalMacro(e="Oval"){return new gg(e,gg.OvalPrimitiveStr,5)}static createRectMacro(e="Rect"){return new gg(e,gg.RectPrimitiveStr,3)}static createRoundRectMacro(e="RoundRect"){return new gg(e,gg.RoundRectPrimitiveStr,5)}static createRegularPolygonMacro(e="RegularPolygon"){return new gg(e,gg.RegularPolygonPrimitiveStr,3)}static createOutlinePolygonMacro(e,r){if(r.length<3)throw new Error("polygon macro cannot have less than 3 points");let i=r[0],n=r[r.length-1];(n.x!=i.x||n.y!=i.y)&&r.push(i);let s=r.length-1,a=gg.MaxOutlinePolygonPoints;if(s>a)throw new Error(`polygon macro cannot have more than ${a} points`);let l=r.flatMap(h=>[new B0(h.x),new B0(h.y)]);l.unshift("4","1",String(s)),l.push("0");let c=[l];return new gg(e,c,0)}};gg.code=P9.AM,gg.MaxOutlinePolygonPoints=50,gg.OvalPrimitiveStr=["1,1,$1,$2,$3","1,1,$1,$4,$5","20,1,$1,$2,$3,$4,$5,0"].join("*"),gg.RectPrimitiveStr="21,1,$1,$2,0,0,$3",gg.RoundRectPrimitiveStr=["1,1,$1,$2,$3","1,1,$1,$4,$5","1,1,$1,0-$2,0-$3","1,1,$1,0-$4,0-$5","20,1,$1,$2,$3,$4,$5,0","20,1,$1,$4,$5,0-$2,0-$3,0","20,1,$1,0-$2,0-$3,0-$4,0-$5,0","20,1,$1,0-$4,0-$5,$2,$3,0","4,1,4,$2,$3,$4,$5,0-$2,0-$3,0-$4,0-$5,$2,$3,0"].join("*"),gg.RegularPolygonPrimitiveStr="5,1,$1,0,0,$2,$3";var YT=gg;var Vq=class o{constructor(){this.leftLength=5;this.rightLength=5;this.minNum=+("1e-"+(this.rightLength+1));this.omitLeadingZeroes=!0;this._unit="IN";this.toUnit=o.toUnitIN}get unit(){return this._unit}set unit(t){this._unit=t,this.toUnit=t=="IN"?o.toUnitIN:o.toUnitMM}static toUnitIN(t){return t/100}static toUnitMM(t){return t*.254}static toNoExponentialString(t){let e=t.toString();if(/[eE]/.test(e)){let r=e.split(/[eE]/),[i,n]=r,s=i[0]=="-"?"-":"";i=s?i.slice(1):i;let a=i,l="";a.includes(".")&&([a,l]=a.split("."));let c=Number(n);c>0?(l=l.padEnd(c,"0"),a+=l.slice(0,c),l=l.slice(c)):c<0&&(a=a.padStart(-c,"0"),l=a.slice(c)+l,a=a.slice(0,a.length+c)),a=a||"0",e=s+a+(l?"."+l:"")}return e}formatPureDecimalNumber(t,e=6){let r=o.toNoExponentialString(t),i=+("1e"+e);return r.includes(".")&&r.split(".")[1].length>e&&(r=o.toNoExponentialString(Math.round(t*i)/i)),r.includes(".")?r:r+".0"}formatDecimalNumber(t){return t=this.toUnit(t),this.formatPureDecimalNumber(t,this.rightLength)}formatDecimalXY(t){let e=this.formatDecimalNumber(t.x),r=this.formatDecimalNumber(t.y);return`X${e}Y${r}`}formatNumber(t){return this.formatNumberNew(t)}formatNumberNew(t){if(t=this.toUnit(t),t!=0){let h=this.rightLength+1,u=Number(t.toFixed(h));u>=-this.minNum&&u<=this.minNum?t=0:t=t+1e-12}if(t==0&&this.omitLeadingZeroes)return"0";let e=t<0,r=e?"-":"",i=(e?-t:t).toString(),n="",s="",a=!0,l=this.rightLength,c=i.length;for(let h=0;h<c;h++){let u=i[h];if(u=="."){a=!1;continue}if(a)n+=u;else if(l--,l==0||h==c-1){if(+i[h+1]>=5){let p=+u+1;p==10?(s=Math.round(+(s+u+"."+i[h+1])).toString(),s.length>this.rightLength?(n=(+n+1).toString(),s=s.slice(1)):l==0&&s.length<this.rightLength&&((n==""||n=="0")&&this.omitLeadingZeroes||(s=s.padStart(this.rightLength,"0")))):s+=p}else s+=u;break}else s+=u}return this.omitLeadingZeroes?n=n=="0"?"":n:n=n.padStart(this.leftLength,"0"),l>0&&(s=s.padEnd(this.rightLength,"0")),!n&&this.omitLeadingZeroes&&s[0]=="0"&&(s=(+s).toString()),r+n+s}formatPointXY(t){let e=this.formatNumber(t.x),r=t.x==t.y?e:this.formatNumber(t.y);if(this.lastXY){let i=this.lastXY.x==t.x?e:this.formatNumber(this.lastXY.x);if(e===i)return this.lastXY=null,`Y${r}`;let n=this.lastXY.y==t.y?r:this.formatNumber(this.lastXY.y);if(r===n)return this.lastXY=null,`X${e}`;this.lastXY=null}return`X${e}Y${r}`}formatPointIJ(t){let e=this.formatNumber(t.x),r=t.x==t.y?e:this.formatNumber(t.y);return`I${e}J${r}`}};function bG(o,t){return{x:o.x+t.x,y:o.y+t.y}}var I3e=class{constructor(t,e){this._repeatTimes=t,this._offset=e}exportText(t){let{x:e,y:r}=this._offset,i=t.formatDecimalNumber(e),n=t.formatDecimalNumber(r);return e&&r?`R${this._repeatTimes}X${i}Y${n}`:e?`R${this._repeatTimes}X${i}`:`R${this._repeatTimes}Y${n}`}},Hle=class{constructor(){}exportText(t){return""}},Gq=class o extends Hle{constructor(t,e,r=!1){super(),this._diameter=t,this._center=e,this._isNPTHSmallCircleSlot=r}get diameter(){return this._diameter}get center(){return this._center}get isNPTHSmallCircleSlot(){return this._isNPTHSmallCircleSlot}applyOffset(t){this._center=bG(this._center,t)}offsetClone(t){return new o(this._diameter,bG(this._center,t))}exportText(t){return t.formatDecimalXY(this.center)}},Wle=class o extends Hle{constructor(t,e,r){super(),this._diameter=t,this._start=e,this._end=r}get diameter(){return this._diameter}get start(){return this._start}get end(){return this._end}applyOffset(t){this._start=bG(this._start,t),this._end=bG(this._end,t)}offsetClone(t){let e=bG(this._start,t),r=bG(this._end,t);return new o(this._diameter,e,r)}exportText(t){let e=t.formatDecimalXY(this.start),r=t.formatDecimalXY(this.end);return e+w_.Slot+r}},op=class op{constructor(){this.headerComments=[];this.diameters=[];this.holes=[];this.bodyBlocks=[];this.currentDiameter=0;this._unit="MM";this._isThroughVia=!1;this.use42=!1;this._integerPlaces=4;this._decimalPlaces=2;this._panelizeFrom=1/0;this.panelizeParam=null;this.isMirror=!1}get unit(){return this._unit}set unit(t){this._unit=t}get holesCount(){return this.holes.length}get isThroughVia(){return this._isThroughVia}get panelizeFrom(){return this._panelizeFrom}setPanelizeFlag(){this._panelizeFrom=this.holes.length}addDiameterSize(t){t>0&&!this.diameters.includes(t)&&this.diameters.push(t)}addBodyHole(t,e){let{diameter:r}=t,i=this.diameters.indexOf(r);if(i>=0){if(r!==this.currentDiameter){let n=op.ToolSelection.replace("#",(i+1+"").padStart(2,"0"));this.addBody(n),this.currentDiameter=r}this.addBody(t.exportText(e))}}addBodyRepeat(t,e,r){let i=new I3e(t,e);this.addBody(i.exportText(r))}addCircle(t,e,r=!1,i=!1){this.addDiameterSize(t),this.holes.push(new Gq(t,e,i)),this._isThroughVia=r}addSlot(t,e,r){this.addDiameterSize(t),this.holes.push(new Wle(t,e,r))}addHeaderComment(t){this.headerComments.push(";"+t)}addBodyComment(t){this.addBody(";"+t)}addBody(t){this.bodyBlocks.push(t)}parseUnit(){if(this.unit=="IN")this._integerPlaces=2,this._decimalPlaces=4;else if(this.unit=="MM"){let t=999.999,e=-t,r=s=>s>t||s<e,i=s=>r(s.x)||r(s.y),n=!1;for(let s of this.holes)if(s instanceof Gq){if(i(s.center)){n=!0;break}}else if(s instanceof Wle){if(i(s.start)||i(s.end)){n=!0;break}}else throw new Error("unknown hole type");this._integerPlaces=n?4:3,this._decimalPlaces=n?2:3}else throw new Error("unknown unit")}getUnitBlock(){let t="";for(let r=1;r<=this._integerPlaces;r++)t=t+"0";t=t+".";for(let r=1;r<=this._decimalPlaces;r++)t=t+"0";return[this.unit=="IN"?op.UnitIN:op.UnitMM,op.LeadingZero,t].join(",")}getCommentBlock(t){return";"+t}exportText(t){let e=`
`,r=[].concat(this.headerComments);if(r.push(op.HeaderBegin),this._integerPlaces=t.leftLength,this._decimalPlaces=t.rightLength,this.unit=t.unit,this.unit=="IN"){if(this._integerPlaces<2)throw new Error("integerPlaces is too small");if(this._decimalPlaces<2)throw new Error("decimalPlaces is too small")}r.push(this.getUnitBlock()),t.omitLeadingZeroes=!1;let i=y=>(y/100+1e-10).toFixed(t.rightLength),n=y=>(y*.254+1e-10).toFixed(t.rightLength),s=this.unit=="IN"?i:n;this.diameters.sort((y,b)=>y-b);let a=this._panelizeFrom<this.holes.length,l=(y,b)=>this.panelizeParam&&(!this.panelizeParam.onlyOutline||b)&&a&&y>=this._panelizeFrom,c=this.holes.map((y,b)=>[y,l(b,y instanceof Gq&&y.isNPTHSmallCircleSlot)]);c.sort((y,b)=>y[0].diameter-b[0].diameter);let h=this.unit=="IN"?op.UnitIN:op.UnitMM,u=0,d=s(0),p=0;for(let y of this.diameters){if(s(y)!=d){p=y;break}u++}u>0&&this.diameters.splice(0,u);let m=0;for(let y of this.diameters){m++;let b=s(y),P=this.getCommentBlock(`Hole size ${m} = ${b} ${h}`),T=op.ToolSelection.replace("#",String(m).padStart(2,"0"))+op.ToolDiameter.replace("#",b);r.push(P,T)}r.push(op.HeaderEnd),this.bodyBlocks.length=0,this.addBody(op.ModeDrill),this.addBody(op.ModeAbsolute);for(let y of c){let[b,P]=y;if(!(b.diameter<p))if(P){let{offset:T,row:I,column:C}=this.panelizeParam,E=T.x,O=T.y;this.isMirror&&(E=-E);for(let _=0;_<C;_++)for(let R=0;R<I;R++){let v=b.offsetClone({x:E*_,y:O*R});this.addBodyHole(v,t)}}else this.addBodyHole(b,t)}return r.concat(this.bodyBlocks,op.ProgramEnd).join(e)}};op.HeaderBegin="M48",op.HeaderEnd="%",op.UnitIN="INCH",op.UnitMM="METRIC",op.LeadingZero="LZ",op.ModeDrill="G05",op.ModeAbsolute="G90",op.Slot="G85",op.ProgramEnd="M30",op.ToolSelection="T#",op.ToolDiameter="C#";var w_=op;var L_=class L_ extends P9{constructor(e,r){super();this.code=P9.AD;this.number=e,this.apertureType=r}get apertureName(){return"D"+this.dCodeNumber}get number(){return this.dCodeNumber}set number(e){if(e<L_.numberMin||e>L_.numberMax)throw new Error("D-code number is out of range");this.dCodeNumber=e}exportText(e){let r=a2.delimiter+this.code+this.apertureName+this.apertureType,i=n=>typeof n=="string"?n:typeof n.format=="function"?n.format(e):String(n);if(this.modifiers.length>0){r+=",";let n=L_.modifierDelimiter;r+=this.modifiers.map(i).join(n)}return r+=a2.endSign,r}appendModifier(e){this.modifiers.push(e)}clearModifiers(){this.modifiers.length=0}setHole(e,r){typeof e=="number"&&(this.modifiers.push(new B0(e)),typeof r=="number"&&this.modifiers.push(new B0(r)))}setCircleAperture(e,r,i){this.clearModifiers(),this.apertureType="C",this.modifiers.push(new B0(e)),this.setHole(r,i)}setRectangleAperture(e,r,i,n){this.apertureType="R",this.modifiers.push(new B0(e),new B0(r)),this.setHole(i,n)}setOvalAperture(e,r,i,n){this.apertureType="O",this.modifiers.push(new B0(e),new B0(r)),this.setHole(i,n)}setPolygonAperture(e,r,i,n,s){this.apertureType="P",this.modifiers.push(new B0(e),String(r)),typeof i=="number"&&(this.modifiers.push(new B0(i)),this.setHole(n,s))}setRectMacroAperture(e,r){this.apertureType=e,this.modifiers=[new B0(r[0]),new B0(r[1]),new aG(r[2])]}setRoundRectMacroAperture(e,r){this.apertureType=e,this.modifiers=r.map(i=>new B0(i))}setOvalMacroAperture(e,r){this.apertureType=e,this.modifiers=r.map(i=>new B0(i))}setOutlinePolygonMacroAperture(e){this.apertureType=e,this.modifiers=[]}setRegularPolygonMacroAperture(e,r){this.apertureType=e,this.modifiers=[new aG(r[0]),new B0(r[1]),new aG(r[2])]}};L_.numberMin=10,L_.numberMax=8191,L_.code="AD",L_.modifierDelimiter="X";var t1=L_;var PG=class PG extends Lm{constructor(e){super();this.content="";this.code="G04";this.content=e}exportText(){let e=this.content.replace(/\\/g,"\\\\").replace(/\*/g,"\\x2a");return e.includes(`
`)?PG.code+" "+e.replace(/\n/g,Lm.endSign+`
`+PG.code+" ")+Lm.endSign:PG.code+" "+e+Lm.endSign}};PG.code="G04";var Uq=PG;var QD=class QD extends Lm{constructor(t){super(),this.code=t}exportText(){return this.code+Lm.endSign}};QD.ProgramStop=new QD("M00"),QD.OptionalStop=new QD("M01"),QD.ProgramEnd=new QD("M02");var ew=QD;var M_=class{constructor(t){this.dataBlocks=[];this.headerBlocks=[];this.macroBlocks=[];this.apertureBlocks=[];this.bodyStartBlocks=[];this.bodyBlocks=[];this.docEndBlocks=[];this.targetOfAdd=null;this.defaultFormatter=null;this.bodyTextCache=[];this.apertureMap={};this.apertureMacroMap={};this.apertureNumber=10;this.polygonMacroNumber=1;this.currentAperture="";this.patternStart=-1;this.patternEnd=-1;this.stepRepeatConfig=vle;this.stepRepeatParameterOpened=!1;this.enableOptimizeXY=!0;this._layerId=t,this.targetOfAdd=this.dataBlocks,this.addBodyStartBlock([gi.enable360Circular(),new g9]),this.addDocEndBlock([new g9,ew.ProgramEnd])}get layerId(){return this._layerId}getApertureNumber(){return this.apertureNumber}getNewApertureNumber(){return this.apertureNumber++}newPolygonMacroName(){return"PolygonMacro"+this.polygonMacroNumber++}getApertureCircle(t,e=4){if(t<=0)return null;let r="C"+ka(t,e);if(this.apertureMap.hasOwnProperty(r))return this.apertureMap[r];let i=new t1(this.apertureNumber++,"C");return i.setCircleAperture(t),this.addApertureBlock(i,r),i.apertureName}getApertureRect(t,e,r=0,i=0,n=4){if(t=+ka(t,n),e=+ka(e,n),r=+ka(r,2),i=+ka(i,n+1),t<=0||e<=0)return null;r<0&&(r=(r%360+360)%360),r%=180,i===0&&r==90&&(r=0,[t,e]=[e,t]);let s="R"+[t,e,r,i].map(l=>ka(l,n)).join("x");if(this.apertureMap.hasOwnProperty(s))return this.apertureMap[s];let a=new t1(this.apertureNumber++,"");if(i>0){if(Math.min(t,e)<=i*2)return this.apertureNumber--,t==e?this.getApertureCircle(t):this.getApertureOval(t,e,r);let c="RoundRect";if(!this.hasMacro(c)){let b=YT.createRoundRectMacro();this.addMacroBlock(b)}let h=[-t/2+i,e/2-i],u=[t/2-i,e/2-i],d=new S(0,0),p=new S(h[0],h[1]),m=new S(u[0],u[1]),g=r?p.rotateD(d,r):p,y=r?m.rotateD(d,r):m;a.setRoundRectMacroAperture(c,[i*2,g.x,g.y,y.x,y.y])}else if(r%90){let l="Rect";if(!this.hasMacro(l)){let c=YT.createRectMacro();this.addMacroBlock(c)}a.setRectMacroAperture(l,[t,e,r])}else r%180?a.setRectangleAperture(e,t):a.setRectangleAperture(t,e);return this.addApertureBlock(a,s),a.apertureName}getApertureOval(t,e,r=0,i=4){if(t<=0||e<=0)return null;r<0&&(r=(r%360+360)%360),r%=180,r%180==0&&(r=0),r%180!==0&&r%90===0&&([e,t]=[t,e],r=0);let n="O"+[t,e,r].map(a=>ka(a,i)).join("x");if(this.apertureMap.hasOwnProperty(n))return this.apertureMap[n];let s=new t1(this.apertureNumber++,"");if(r==0)s.setOvalAperture(t,e);else{let a="Oval";if(!this.hasMacro(a)){let d=YT.createOvalMacro();this.addMacroBlock(d)}let l=Math.min(t,e),c=(t-e)/2,h,u;t>e?(h=new S(-c,0),u=new S(c,0)):(h=new S(0,-c),u=new S(0,c)),h=h.rotateD(new S(0,0),r),u=u.rotateD(new S(0,0),r),s.setOvalMacroAperture(a,[l,h.x,h.y,u.x,u.y])}return this.addApertureBlock(s,n),s.apertureName}getAperturePolygon(t,e=4){let r="P"+t.map(s=>ka(s.x,e)+"x"+ka(s.y,e)).join("x");if(this.apertureMap.hasOwnProperty(r))return this.apertureMap[r];let i=this.newPolygonMacroName();if(!this.hasMacro(i)){let s=YT.createOutlinePolygonMacro(i,t);this.addMacroBlock(s)}let n=new t1(this.apertureNumber++,i);return this.addApertureBlock(n,r),n.apertureName}useAperture(t){if(t&&t!=this.currentAperture){this.currentAperture=t;let e=gi.useAperture(t);this.addBodyBlock(e)}}existApertureDefinition(t){return this.apertureMap.hasOwnProperty(t)}setFormatter(t){this.defaultFormatter=t}setTargetAsHeader(){this.targetOfAdd=this.headerBlocks}setTargetAsMacro(){this.targetOfAdd=this.macroBlocks}setTargetAsAperture(){this.targetOfAdd=this.apertureBlocks}setTargetAsBody(){this.targetOfAdd=this.bodyBlocks}getTargetByBlock(t){return t instanceof ew?this.docEndBlocks:t instanceof Lm?this.bodyBlocks:t instanceof t1?this.apertureBlocks:t instanceof YT?this.macroBlocks:t instanceof SP?this.headerBlocks:this.bodyBlocks}setTargetByBlock(t){this.targetOfAdd=this.getTargetByBlock(t)}addBlock(t,e){if(e=e||this.targetOfAdd,Array.isArray(t)){e||(e=this.getTargetByBlock(t[0]));let r=e.length;e.length=r+t.length;for(let i of t)e[r++]=i}else t&&(e||(e=this.getTargetByBlock(t)),e.length++,e[e.length-1]=t);this.bodyBlocks.length>1e3&&this.flushBodyBlocks()}addBlockWithOffsets(t,e,r){if(e.length<=1){this.addBlock(t,r);return}if(r=r||this.bodyBlocks,Array.isArray(t))for(let i of e){let n=r.length;r.length+=t.length;for(let s of t)s instanceof gi?r[n++]=s.offsetClone(i):r[n++]=s}else if(t)if(t instanceof gi){let i=r.length;r.length+=e.length;for(let n of e)r[i++]=t.offsetClone(n)}else{let i=r.length;r.length=i+1,r[i]=t}}addHeaderBlock(t){this.addBlock(t,this.headerBlocks)}addMacroBlock(t){this.hasMacro(t.name)||(this.apertureMacroMap[t.name]=t,this.addBlock(t,this.macroBlocks))}addApertureBlock(t,e){e||(e=t.exportText(this.defaultFormatter)),!(e&&this.apertureMap.hasOwnProperty(e))&&(e&&(this.apertureMap[e]=t.apertureName),this.addBlock(t,this.apertureBlocks))}addBodyStartBlock(t){this.addBlock(t,this.bodyStartBlocks)}addBodyBlock(t){this.addBlock(t,this.bodyBlocks)}addDocEndBlock(t){this.addBlock(t,this.docEndBlocks)}addParameter(t,e){this.addBlock(t,e)}addComment(t,e){this.addBlock(new Uq(t),e)}addEmptyLine(t){this.addBlock(new g9,t)}initDataPatternStart(){this.patternStart<0&&(this.patternStart=this.dataBlocks.length)}initDataPatternEnd(){this.patternStart>=0&&this.patternEnd<0&&(this.patternEnd=this.dataBlocks.length)}initDataPattern(){if(this.patternStart>=0)return!0;let t=this.dataBlocks,e=t.findIndex(i=>i instanceof gi&&!i.isComment());if(e<-1)return!1;let r=t.length-1;for(;r>0&&t[r]instanceof ew;)r--;return this.patternStart=e,this.patternEnd=r,!0}repeatDataPattern(t){if(this.patternStart<0)return!1;let e=this.dataBlocks,r=e.length-1,i=[];for(;r>0&&e[r]instanceof ew;)r--,i.unshift(e.pop());let n=this.dataBlocks.slice(this.patternStart,this.patternEnd+1);for(let s of n)s instanceof gi?this.addBlock(s.offsetClone(t)):this.addBlock(s);return i.length&&this.addBlock(i),!0}hasAperture(){return!!this.currentAperture}hasMacro(t){return!!this.apertureMacroMap[t]}getBlocksText(t){return Aze(t,this.defaultFormatter)}getBodyBlocks(){return this.bodyBlocks.slice()}setBodyBlocks(t){throw this.bodyBlocks=t.slice(),new Error("do not call this function")}offsetBodyBlocks(t){xq(this.bodyBlocks,t)}flushBodyBlocks(){if(!this.bodyBlocks.length)return;let t=this.getBlocksText(this.bodyBlocks);this.bodyBlocks.length=0,this.bodyTextCache.push(t)}exportTextV2(t){if(t&&this.setFormatter(t),!this.hasAperture()){let s=this.getApertureCircle(1);this.useAperture(s)}if(this.flushBodyBlocks(),!this.macroBlocks.length){let s=Object.keys(this.apertureMacroMap).map(a=>this.apertureMacroMap[a]);this.macroBlocks=s}let e=`
`,r=[this.headerBlocks,this.macroBlocks,this.apertureBlocks,this.bodyStartBlocks].map(s=>this.getBlocksText(s)),i=this.getBlocksText(this.docEndBlocks),n=r.join("")+this.bodyTextCache.join("")+i+e;return this.bodyTextCache.length=0,n}exportText(t){return this.exportTextV2(t)}updateCopperComment(t){for(let e=0;e<this.headerBlocks.length;e++){let r=this.headerBlocks[e];if(r instanceof Uq&&r.content.startsWith("Copper Areas:")){r.content=t;break}}}};function C3e(o){let t=o.length;if(t<3)return 0;let e=o[0].x*(o[t-1].y-o[1].y);for(let r=1;r<t-1;r++)e+=o[r].x*(o[r-1].y-o[r+1].y);return e+=o[t-1].x*(o[t-2].y-o[0].y),Math.abs(e/2)}function pxt(o){let t=o[0].x,e=o[0].y,r=0,i=0;for(let n=1;n<o.length;n++){let s=o[n];s.x<t&&(t=s.x,r=n),s.y<e&&(e=s.y,i=n)}return{minX:t,minY:e,minXI:r,minYI:i}}function fxt(o,t,e){let r=null,i=n=>{r?n.point.x>r.point.x&&(r=n):r=n};for(let n=0;n<t.length;n++){let s=t[n],a=t[(n+1)%t.length];if(s.x===a.x&&s.y===a.y)continue;if(s.y==o.y&&s.x<=o.x){i({vertex:[n],point:s});continue}if(a.y==o.y||s.x>o.x&&a.x>o.x||s.y>o.y&&a.y>o.y||s.y<o.y&&a.y<o.y)continue;if(s.x===a.x){let c={edge:[n,(n+1)%t.length],point:new S(s.x,o.y)};i(c);continue}let l=s.x+(a.x-s.x)*(o.y-s.y)/(a.y-s.y);if(e&&(l=Math.round(l)),l<=o.x){let c={edge:[n,(n+1)%t.length],point:new S(l,o.y)};i(c);continue}}return r}function mxt(o,t){let e=[],{outer:r,holes:i}=o;if(!i.length)return r;let n=i.map(pxt),s=new Array(i.length).fill(0).map((a,l)=>l);s.sort((a,l)=>{let c=n[a],h=n[l],u=c.minX-h.minX,d=c.minY-h.minY;return u===0?d:u}),e=e.concat(r);for(let a of s){let l=i[a],c=n[a].minXI,h=l[c],u=l.slice(0,c+1),d=l.slice(c),p=fxt(h,e,t);if(!p){let m=Number.MAX_VALUE,g=[];for(let y=0;y<e.length;y++){let b=e[y];h.distance1(b)<m&&(g=[y,b])}p={vertex:[g[0]],point:g[1]}}if("vertex"in p){let{vertex:m,point:g}=p;d.concat(u,g).forEach((b,P)=>{e.splice(m[0]+1+P,0,b)})}else{let{edge:m,point:g}=p;[g].concat(d,u,g).forEach((b,P)=>{e.splice(m[0]+1+P,0,b)})}}return e}function LC(o,t=[],e=!1){return gxt(o,t,e)}function oYe(o){return gi.primitivesToPoints(o.primitives)}function gxt(o,t=[],e=!1){let r=new Kc,n=(e&&o.length==1?r.normalizeData(o[0],t[0]).toPolylineGroups():r.getUnionForSingle(o,t)).map(c=>({outer:oYe(c.items[0]),holes:c.items.slice(1).map(oYe)})),s=.01,a=!1;return n.forEach(c=>{let{outer:h,holes:u}=c,d=C3e(h);if(Math.abs(d)<s){c.outer=null,a=!0;return}if(!u.length)return;let p=!1;for(let m of u){let g=C3e(m);Math.abs(g)<s&&(m.length=0,p=!0)}p&&(c.holes=u.filter(m=>m.length>0))}),a&&(n=n.filter(c=>c.outer!=null)),n.map((c,h)=>mxt(c,!1))}var uYe=nd(cj());var tw=class extends xp{constructor(t){if(super(),this.code="SR",t){let[e,r,i,n]=t;this.modifiers.push("X"+e,"Y"+r,"I",new B0(i),"J",new B0(n))}}};var zle=[{char:"A",path:"M -1.831 -2.796 L -2.298 -2.618 L -0.227 2.796 L 0.24 2.796 L 2.298 -2.618 L 1.831 -2.796 L 1.146 -0.993 L -1.142 -0.993 Z M -0.95 -0.493 L 0.955 -0.493 L 0.005 2.007 Z"},{char:"B",path:"M -1.967 -2.841 L -1.967 2.841 L 0.503 2.841 L 1.321 2.587 L 1.671 2.276 L 1.967 1.712 L 1.965 0.997 L 1.715 0.507 L 1.421 0.192 L 1.297 0.126 L 1.421 0.058 L 1.715 -0.257 L 1.965 -0.747 L 1.967 -1.712 L 1.671 -2.276 L 1.321 -2.589 L 0.503 -2.841 Z M -1.467 -2.341 L 0.463 -2.341 L 1.108 -2.13 L 1.288 -1.952 L 1.493 -1.542 L 1.493 -0.921 L 1.288 -0.518 L 1.108 -0.339 L 0.463 -0.13 L -1.467 -0.13 Z M -1.467 0.37 L 0.462 0.37 L 1.108 0.589 L 1.288 0.769 L 1.493 1.171 L 1.493 1.54 L 1.288 1.952 L 1.108 2.13 L 0.463 2.341 L -1.467 2.341 Z"},{char:"C",path:"M -0.413 -2.841 L -1.079 -2.526 L -1.626 -1.96 L -1.88 -1.44 L -2.142 -0.62 L -2.142 0.62 L -1.866 1.47 L -1.579 2.026 L -1.013 2.575 L -0.413 2.841 L 0.578 2.841 L 1.246 2.526 L 1.792 1.96 L 2.142 1.245 L 1.693 1.026 L 1.363 1.702 L 0.921 2.144 L 0.521 2.341 L -0.354 2.341 L -0.755 2.144 L -1.196 1.702 L -1.411 1.265 L -1.642 0.579 L -1.642 -0.579 L -1.411 -1.265 L -1.196 -1.702 L -0.755 -2.143 L -0.354 -2.341 L 0.521 -2.341 L 0.921 -2.143 L 1.363 -1.702 L 1.693 -1.026 L 2.142 -1.245 L 1.792 -1.96 L 1.246 -2.526 L 0.578 -2.841 Z"},{char:"D",path:"M -1.98 -2.841 L -1.98 2.841 L -0.001 2.841 L 0.818 2.587 L 1.452 1.964 L 1.716 1.441 L 1.98 0.62 L 1.98 -0.62 L 1.702 -1.474 L 1.409 -2.024 L 0.818 -2.589 L -0.001 -2.841 Z M -1.48 -2.341 L -0.04 -2.341 L 0.605 -2.132 L 1.025 -1.702 L 1.249 -1.263 L 1.48 -0.579 L 1.48 0.579 L 1.249 1.263 L 1.025 1.702 L 0.605 2.132 L -0.04 2.341 L -1.48 2.341 Z"},{char:"E",path:"M -1.855 -2.841 L -1.855 2.841 L 1.855 2.841 L 1.855 2.341 L -1.355 2.341 L -1.355 0.37 L 0.624 0.37 L 0.624 -0.13 L -1.355 -0.13 L -1.355 -2.341 L 1.855 -2.341 L 1.855 -2.841 Z"},{char:"F",path:"M -1.855 -2.841 L -1.855 2.841 L -1.355 2.841 L 1.855 2.841 L 1.855 2.341 L -1.355 2.341 L -1.355 0.37 L 0.624 0.37 L 0.624 -0.13 L -1.355 -0.13 L -1.355 -2.841 Z"},{char:"G",path:"M -0.419 -2.841 L -1.085 -2.526 L -1.632 -1.96 L -1.886 -1.44 L -2.136 -0.7 L -2.136 0.7 L -1.872 1.47 L -1.585 2.026 L -1.019 2.575 L -0.419 2.841 L 0.572 2.841 L 1.24 2.526 L 1.786 1.96 L 2.136 1.245 L 1.687 1.026 L 1.357 1.702 L 0.915 2.144 L 0.515 2.341 L -0.36 2.341 L -0.761 2.144 L -1.202 1.702 L -1.417 1.265 L -1.647 0.579 L -1.647 -0.579 L -1.417 -1.265 L -1.202 -1.702 L -0.761 -2.143 L -0.36 -2.341 L 0.515 -2.341 L 0.915 -2.143 L 1.357 -1.702 L 1.552 -1.302 L 1.552 -0.87 L 0.322 -0.87 L 0.322 -0.37 L 2.052 -0.37 L 2.052 -1.36 L 1.74 -2.026 L 1.171 -2.575 L 0.572 -2.841 Z"},{char:"H",path:"M -1.98 -2.841 L -1.98 2.841 L -1.48 2.841 L -1.48 0.37 L 1.48 0.37 L 1.48 2.841 L 1.98 2.841 L 1.98 -2.841 L 1.48 -2.841 L 1.48 -0.13 L -1.48 -0.13 L -1.48 -2.841 Z"},{char:"I",path:"M -0.3 -2.841 L -0.3 2.841 L 0.3 2.841 L 0.3 -2.841 Z"},{char:"J",path:"M -0.246 -2.841 L -0.854 -2.575 L -1.166 -2.272 L -1.485 -1.36 L -1.485 -0.61 L -0.985 -0.61 L -0.985 -1.319 L -0.766 -1.968 L -0.596 -2.143 L -0.187 -2.341 L 0.188 -2.341 L 0.596 -2.143 L 0.766 -1.968 L 0.985 -1.319 L 0.985 2.841 L 1.485 2.841 L 1.485 -1.36 L 1.166 -2.272 L 0.854 -2.575 L 0.244 -2.841 Z"},{char:"K",path:"M 1.629 -2.942 L -0.578 -0.015 L -1.531 -0.966 L -1.531 -2.843 L -2.031 -2.843 L -2.031 2.839 L -1.531 2.839 L -1.531 -0.259 L 1.678 2.942 L 2.031 2.587 L -0.219 0.343 L 2.027 -2.642 Z"},{char:"L",path:"M -1.73 -2.841 L -1.73 2.841 L -1.23 2.841 L -1.23 -2.341 L 1.73 -2.341 L 1.73 -2.841 Z"},{char:"M",path:"M -2.225 -2.791 L -2.225 2.641 L -1.777 2.791 L 0.004 0.463 L 1.776 2.791 L 2.225 2.641 L 2.225 -2.791 L 1.725 -2.791 L 1.725 1.899 L 0.204 -0.101 L -0.193 -0.101 L -1.725 1.901 L -1.725 -2.791 Z"},{char:"N",path:"M -1.98 -2.841 L -1.98 2.591 L -1.523 2.73 L 1.48 -1.765 L 1.48 2.841 L 1.98 2.841 L 1.98 -2.591 L 1.523 -2.729 L -1.48 1.763 L -1.48 -2.841 Z"},{char:"O",path:"M -0.495 -2.828 L -1.095 -2.562 L -1.661 -2.013 L -1.948 -1.457 L -2.212 -0.687 L -2.212 0.713 L -1.962 1.454 L -1.708 1.973 L -1.161 2.539 L -0.604 2.827 L 0.607 2.827 L 1.164 2.539 L 1.664 2.039 L 1.951 1.483 L 2.212 0.713 L 2.212 -0.687 L 1.951 -1.457 L 1.664 -2.013 L 1.095 -2.562 L 0.496 -2.828 Z M -0.436 -2.328 L 0.439 -2.328 L 0.839 -2.13 L 1.281 -1.689 L 1.494 -1.252 L 1.726 -0.566 L 1.726 0.592 L 1.494 1.278 L 1.281 1.715 L 0.839 2.157 L 0.439 2.354 L -0.434 2.354 L -0.837 2.157 L -1.278 1.715 L -1.493 1.278 L -1.723 0.592 L -1.723 -0.566 L -1.493 -1.252 L -1.278 -1.689 L -0.837 -2.13 Z"},{char:"P",path:"M -1.98 -2.841 L -1.98 2.841 L 0.49 2.841 L 1.308 2.587 L 1.704 2.212 L 1.98 1.601 L 1.98 0.86 L 1.658 0.192 L 1.308 -0.118 L 0.49 -0.37 L -1.48 -0.37 L -1.48 -2.841 Z M -1.48 0.13 L 0.45 0.13 L 1.095 0.339 L 1.275 0.519 L 1.48 0.921 L 1.48 1.54 L 1.275 1.952 L 1.095 2.13 L 0.45 2.341 L -1.48 2.341 Z"},{char:"Q",path:"M 1.748 -2.891 L 1.213 -2.424 L 1.094 -2.524 L 0.495 -2.79 L -0.496 -2.79 L -1.096 -2.524 L -1.709 -1.909 L -1.963 -1.389 L -2.225 -0.569 L -2.225 0.671 L -1.949 1.521 L -1.662 2.077 L -1.096 2.626 L -0.496 2.892 L 0.495 2.892 L 1.163 2.577 L 1.709 2.011 L 1.961 1.492 L 2.225 0.671 L 2.225 -0.569 L 1.961 -1.389 L 1.709 -1.909 L 1.567 -2.071 L 2.079 -2.514 Z M -0.437 -2.29 L 0.438 -2.29 L 0.834 -2.094 L -0.107 -1.274 L 0.221 -0.897 L 1.19 -1.741 L 1.493 -1.214 L 1.725 -0.528 L 1.725 0.63 L 1.493 1.316 L 1.28 1.753 L 0.838 2.195 L 0.438 2.392 L -0.435 2.392 L -0.838 2.195 L -1.279 1.753 L -1.494 1.316 L -1.725 0.63 L -1.725 -0.528 L -1.494 -1.214 L -1.279 -1.651 L -0.838 -2.092 Z"},{char:"R",path:"M 1.606 -2.888 L -0.185 -0.083 L -1.527 -0.083 L -1.527 -2.795 L -2.027 -2.795 L -2.027 2.888 L 0.442 2.888 L 1.26 2.633 L 1.656 2.258 L 1.932 1.647 L 1.932 1.157 L 1.654 0.553 L 1.262 0.18 L 0.408 -0.083 L 2.027 -2.62 Z M -1.527 0.417 L 0.401 0.417 L 1.047 0.635 L 1.227 0.816 L 1.432 1.218 L 1.432 1.587 L 1.227 1.998 L 1.047 2.176 L 0.402 2.388 L -1.527 2.388 Z"},{char:"S",path:"M -0.501 -2.841 L -1.317 -2.589 L -2.083 -1.847 L -1.727 -1.497 L -1.104 -2.132 L -0.46 -2.341 L 0.45 -2.341 L 1.095 -2.13 L 1.48 -1.747 L 1.48 -1.171 L 1.275 -0.768 L 1.081 -0.575 L 0.644 -0.35 L -0.819 0.132 L -1.417 0.442 L -1.704 0.749 L -1.979 1.36 L -1.979 1.851 L -1.909 2.025 L -1.317 2.587 L -0.501 2.841 L 0.49 2.841 L 1.408 2.526 L 2.083 1.851 L 1.73 1.497 L 1.095 2.13 L 0.45 2.341 L -0.46 2.341 L -1.104 2.132 L -1.479 1.747 L -1.479 1.419 L -1.274 1.009 L -1.093 0.825 L -0.645 0.601 L 0.818 0.118 L 1.343 -0.147 L 1.658 -0.442 L 1.98 -1.11 L 1.98 -1.85 L 1.908 -2.026 L 1.308 -2.589 L 0.49 -2.841 Z"},{char:"T",path:"M -0.251 -2.841 L -0.251 2.341 L -1.98 2.341 L -1.98 2.841 L 1.98 2.841 L 1.98 2.341 L 0.249 2.341 L 0.249 -2.841 Z"},{char:"U",path:"M -0.327 -2.834 L -1.169 -2.531 L -1.718 -1.938 L -1.98 -1.117 L -1.98 2.834 L -1.48 2.834 L -1.48 -1.076 L -1.261 -1.723 L -0.855 -2.139 L -0.21 -2.348 L 0.21 -2.348 L 0.855 -2.139 L 1.261 -1.723 L 1.48 -1.076 L 1.48 2.834 L 1.98 2.834 L 1.98 -1.117 L 1.716 -1.938 L 1.169 -2.531 L 0.327 -2.834 Z"},{char:"V",path:"M -0.227,-2.796 L -2.298,2.617 L -1.831,2.796 L 0.005,-2.007 L 1.831,2.796 L 2.298,2.618 L 0.24,-2.796 Z"},{char:"W",path:"M -1.002 -2.78 L -1.483 -2.758 L -2.772 2.663 L -2.283 2.78 L -1.2 -1.79 L -0.237 1.097 L 0.238 1.097 L 1.193 -1.788 L 2.285 2.78 L 2.772 2.663 L 1.472 -2.758 L 0.992 -2.78 L 0 0.226 Z"},{char:"X",path:"M -1.661,-2.936 L -2.077,-2.659 L -0.301,-0.002 L -2.077,2.659 L -1.661,2.937 L 0.001,0.45 L 1.661,2.937 L 2.077,2.659 L 0.302,-0.002 L 2.077,-2.659 L 1.661,-2.936 L 0.001,-0.45 Z"},{char:"Y",path:"M -0.247 -2.891 L -0.247 -0.018 L -2.326 2.578 L -1.938 2.891 L 0.003 0.471 L 1.935 2.891 L 2.326 2.58 L 0.253 -0.018 L 0.253 -2.891 Z"},{char:"Z",path:"M -1.73 -2.841 L -1.939 -2.452 L 1.263 2.341 L -1.98 2.341 L -1.98 2.841 L 1.73 2.841 L 1.939 2.45 L -1.263 -2.341 L 1.98 -2.341 L 1.98 -2.841 Z"}];var Yle=[{char:"A",path:"M -0.873 -1.52 L -1.248 -1.371 L -0.185 1.52 L 0.188 1.52 L 1.248 -1.371 L 0.875 -1.52 L 0.524 -0.558 L -0.521 -0.558 Z M -0.367 -0.142 L 0.37 -0.142 L 0 0.864 Z"},{char:"B",path:"M -1.054 -1.495 L -1.054 1.495 L 0.257 1.495 L 0.689 1.367 L 0.89 1.189 L 1.054 0.893 L 1.052 0.462 L 0.923 0.216 L 0.786 0.064 L 0.923 -0.091 L 1.052 -0.334 L 1.054 -0.891 L 0.89 -1.188 L 0.689 -1.364 L 0.257 -1.495 Z M -0.653 -1.094 L 0.224 -1.094 L 0.517 -0.998 L 0.677 -0.75 L 0.677 -0.479 L 0.517 -0.233 L 0.224 -0.139 L -0.653 -0.139 Z M -0.653 0.26 L 0.224 0.26 L 0.515 0.359 L 0.677 0.605 L 0.677 0.752 L 0.517 1.002 L 0.224 1.095 L -0.653 1.095 Z"},{char:"C",path:"M -0.219 -1.495 L -0.611 -1.315 L -0.898 -1.012 L -1.029 -0.741 L -1.158 -0.309 L -1.158 0.31 L -1.019 0.768 L -0.861 1.067 L -0.555 1.357 L -0.219 1.495 L 0.272 1.495 L 0.662 1.317 L 0.951 1.013 L 1.158 0.589 L 0.799 0.413 L 0.606 0.808 L 0.404 1.01 L 0.225 1.095 L -0.174 1.095 L -0.352 1.01 L -0.555 0.808 L -0.652 0.605 L -0.76 0.279 L -0.76 -0.278 L -0.652 -0.604 L -0.555 -0.807 L -0.352 -1.008 L -0.174 -1.094 L 0.225 -1.094 L 0.404 -1.008 L 0.606 -0.807 L 0.799 -0.411 L 1.158 -0.588 L 0.951 -1.012 L 0.607 -1.354 L 0.272 -1.495 Z"},{char:"D",path:"M -1.065 -1.495 L -1.065 1.495 L -0.006 1.495 L 0.057 1.486 L 0.428 1.367 L 0.506 1.317 L 0.755 1.067 L 0.795 1.013 L 0.915 0.768 L 0.925 0.748 L 1.055 0.377 L 1.065 0.31 L 1.065 -0.309 L 1.055 -0.375 L 0.925 -0.745 L 0.915 -0.766 L 0.795 -1.012 L 0.755 -1.065 L 0.506 -1.315 L 0.428 -1.364 L 0.057 -1.485 L -0.006 -1.495 Z M -0.664 -1.094 L -0.037 -1.094 L 0.258 -0.998 L 0.449 -0.807 L 0.551 -0.603 L 0.666 -0.276 L 0.666 0.276 L 0.551 0.603 L 0.449 0.808 L 0.258 1.002 L -0.037 1.095 L -0.664 1.095 Z"},{char:"E",path:"M -1 -1.495 L -1 1.495 L 1 1.495 L 1 1.095 L -0.6 1.095 L -0.6 0.26 L 0.39 0.26 L 0.39 -0.139 L -0.6 -0.139 L -0.6 -1.094 L 1 -1.094 L 1 -1.495 Z"},{char:"F",path:"M -1.005 -1.495 L -1.005 1.495 L 1.005 1.495 L 1.005 1.095 L -0.605 1.095 L -0.605 0.26 L 0.385 0.26 L 0.385 -0.139 L -0.605 -0.139 L -0.605 -1.495 Z"},{char:"G",path:"M -0.22 -1.495 L -0.61 -1.315 L -0.9 -1.012 L -1.03 -0.741 L -1.16 -0.309 L -1.16 0.31 L -1.02 0.768 L -0.86 1.067 L -0.56 1.357 L -0.22 1.495 L 0.27 1.495 L 0.61 1.357 L 0.95 1.013 L 1.16 0.589 L 0.8 0.413 L 0.61 0.808 L 0.4 1.01 L 0.22 1.095 L -0.17 1.095 L -0.35 1.01 L -0.55 0.808 L -0.65 0.605 L -0.76 0.279 L -0.76 -0.278 L -0.65 -0.604 L -0.55 -0.807 L -0.35 -1.008 L -0.17 -1.094 L 0.22 -1.094 L 0.4 -1.008 L 0.61 -0.807 L 0.69 -0.633 L 0.69 -0.508 L 0.07 -0.508 L 0.07 -0.111 L 1.09 -0.111 L 1.09 -0.679 L 1.07 -0.766 L 0.91 -1.065 L 0.61 -1.354 L 0.27 -1.495 Z"},{char:"H",path:"M -1.065 -1.495 L -1.065 1.495 L -0.665 1.495 L -0.665 0.26 L 0.665 0.26 L 0.665 1.495 L 1.065 1.495 L 1.065 -1.495 L 0.665 -1.495 L 0.665 -0.139 L -0.665 -0.139 L -0.665 -1.495 Z"},{char:"I",path:"M -0.2 -1.495 L -0.2 1.495 L 0.2 1.495 L 0.2 -1.495 Z"},{char:"J",path:"M -0.125 -1.495 L -0.215 -1.475 L -0.465 -1.354 L -0.525 -1.313 L -0.635 -1.188 L -0.685 -1.11 L -0.805 -0.741 L -0.815 -0.679 L -0.815 -0.229 L -0.415 -0.229 L -0.415 -0.647 L -0.315 -0.944 L -0.255 -1.01 L -0.075 -1.094 L 0.075 -1.094 L 0.255 -1.01 L 0.315 -0.944 L 0.415 -0.647 L 0.415 1.495 L 0.815 1.495 L 0.815 -0.679 L 0.805 -0.741 L 0.685 -1.11 L 0.645 -1.188 L 0.515 -1.313 L 0.465 -1.354 L 0.215 -1.475 L 0.125 -1.495 Z"},{char:"K",path:"M 0.785 -1.555 L -0.305 -0.117 L -0.705 -0.505 L -0.705 -1.491 L -1.105 -1.491 L -1.105 1.497 L -0.705 1.497 L -0.705 0.049 L 0.825 1.555 L 1.105 1.275 L -0.025 0.165 L 1.105 -1.318 Z"},{char:"L",path:"M -0.94 -1.495 L -0.94 1.495 L -0.54 1.495 L -0.54 -1.094 L 0.94 -1.094 L 0.94 -1.495 Z"},{char:"M",path:"M -1.19 -1.515 L -1.19 1.388 L -0.83 1.515 L 0 0.385 L 0.83 1.515 L 1.19 1.388 L 1.19 -1.515 L 0.79 -1.515 L 0.79 0.774 L 0.16 -0.085 L -0.16 -0.085 L -0.79 0.774 L -0.79 -1.515 Z"},{char:"N",path:"M -1.065 -1.496 L -1.065 1.416 L -0.695 1.539 L 0.665 -0.696 L 0.665 1.492 L 1.065 1.492 L 1.065 -1.416 L 0.695 -1.539 L -0.665 0.694 L -0.665 -1.496 Z"},{char:"O",path:"M -0.245 -1.495 L -0.585 -1.354 L -0.885 -1.065 L -1.045 -0.766 L -1.175 -0.371 L -1.175 0.373 L -1.045 0.768 L -0.885 1.067 L -0.585 1.357 L -0.245 1.495 L 0.245 1.495 L 0.585 1.357 L 0.885 1.067 L 1.045 0.768 L 1.175 0.373 L 1.175 -0.371 L 1.045 -0.766 L 0.885 -1.065 L 0.585 -1.354 L 0.245 -1.495 Z M -0.205 -1.094 L 0.205 -1.094 L 0.375 -1.008 L 0.575 -0.807 L 0.675 -0.604 L 0.785 -0.278 L 0.785 0.279 L 0.675 0.605 L 0.575 0.808 L 0.375 1.01 L 0.205 1.095 L -0.205 1.095 L -0.375 1.01 L -0.575 0.808 L -0.675 0.605 L -0.785 0.279 L -0.785 -0.278 L -0.675 -0.604 L -0.575 -0.807 L -0.375 -1.008 Z"},{char:"P",path:"M -1.065 -1.495 L -1.065 1.495 L 0.245 1.495 L 0.305 1.486 L 0.675 1.367 L 0.755 1.319 L 0.885 1.195 L 0.925 1.138 L 1.045 0.888 L 1.065 0.8 L 1.065 0.431 L 1.045 0.343 L 0.925 0.097 L 0.885 0.042 L 0.755 -0.083 L 0.675 -0.129 L 0.305 -0.248 L 0.245 -0.258 L -0.665 -0.258 L -0.665 -1.495 Z M -0.665 0.139 L 0.215 0.139 L 0.515 0.238 L 0.585 0.306 L 0.665 0.478 L 0.665 0.755 L 0.585 0.931 L 0.515 1 L 0.215 1.095 L -0.665 1.095 Z"},{char:"Q",path:"M 0.88 -1.536 L 0.6 -1.293 L 0.25 -1.454 L -0.25 -1.454 L -0.58 -1.311 L -0.88 -1.024 L -1.04 -0.726 L -1.18 -0.334 L -1.18 0.417 L -1.04 0.809 L -0.88 1.108 L -0.58 1.395 L -0.25 1.536 L 0.25 1.536 L 0.58 1.395 L 0.88 1.108 L 1.04 0.809 L 1.18 0.417 L 1.18 -0.334 L 1.04 -0.726 L 0.89 -1.014 L 1.14 -1.234 Z M -0.2 -1.053 L 0.2 -1.053 L 0.28 -1.014 L -0.16 -0.627 L 0.1 -0.328 L 0.59 -0.748 L 0.79 -0.236 L 0.79 0.317 L 0.67 0.643 L 0.58 0.849 L 0.37 1.051 L 0.2 1.135 L -0.2 1.135 L -0.37 1.051 L -0.58 0.849 L -0.67 0.643 L -0.79 0.317 L -0.79 -0.236 L -0.58 -0.766 L -0.37 -0.97 Z"},{char:"R",path:"M 0.765 -1.533 L -0.155 -0.101 L -0.705 -0.101 L -0.705 -1.457 L -1.105 -1.457 L -1.105 1.534 L 0.205 1.534 L 0.265 1.524 L 0.635 1.405 L 0.715 1.352 L 0.835 1.227 L 0.875 1.182 L 1.005 0.932 L 1.025 0.838 L 1.025 0.594 L 1.005 0.5 L 0.875 0.254 L 0.835 0.211 L 0.715 0.086 L 0.635 0.034 L 0.305 -0.078 L 1.105 -1.316 Z M -0.705 0.299 L 0.175 0.299 L 0.465 0.397 L 0.535 0.467 L 0.625 0.643 L 0.625 0.79 L 0.525 0.971 L 0.465 1.04 L 0.175 1.133 L -0.705 1.133 Z"},{char:"S",path:"M -0.255 -1.495 L -0.725 -1.344 L -1.145 -0.918 L -0.855 -0.641 L -0.515 -0.998 L -0.225 -1.094 L 0.215 -1.094 L 0.505 -0.998 L 0.665 -0.84 L 0.665 -0.604 L 0.495 -0.349 L 0.285 -0.245 L -0.435 -0.004 L -0.715 0.131 L -0.885 0.288 L -0.995 0.486 L -1.065 0.681 L -1.065 0.925 L -1.005 1.064 L -0.685 1.367 L -0.255 1.495 L 0.245 1.495 L 0.755 1.317 L 1.145 0.925 L 0.865 0.643 L 0.505 1.002 L 0.215 1.095 L -0.225 1.095 L -0.515 1.002 L -0.665 0.845 L -0.665 0.726 L -0.585 0.548 L -0.505 0.476 L -0.295 0.371 L 0.425 0.13 L 0.705 -0.004 L 0.875 -0.171 L 1.065 -0.554 L 1.065 -0.924 L 1.005 -1.065 L 0.675 -1.364 L 0.245 -1.495 Z"},{char:"T",path:"M -0.205 -1.495 L -0.205 1.095 L -1.065 1.095 L -1.065 1.495 L 1.065 1.495 L 1.065 1.095 L 0.195 1.095 L 0.195 -1.495 Z"},{char:"U",path:"M -0.125 -1.495 L -0.185 -1.485 L -0.555 -1.364 L -0.635 -1.315 L -0.885 -1.065 L -0.935 -0.985 L -1.055 -0.616 L -1.065 -0.554 L -1.065 1.495 L -0.665 1.495 L -0.665 -0.522 L -0.565 -0.817 L -0.385 -0.998 L -0.095 -1.094 L 0.095 -1.094 L 0.385 -0.998 L 0.565 -0.817 L 0.665 -0.52 L 0.665 1.495 L 1.065 1.495 L 1.065 -0.554 L 1.055 -0.62 L 0.925 -0.991 L 0.875 -1.063 L 0.635 -1.313 L 0.555 -1.364 L 0.185 -1.485 L 0.125 -1.495 Z"},{char:"V",path:"M -0.185 -1.527 L -1.245 1.378 L -0.875 1.527 L 0.005 -0.865 L 0.865 1.527 L 1.245 1.378 L 0.195 -1.527 Z"},{char:"W",path:"M -0.425 -1.52 L -0.805 -1.501 L -1.475 1.423 L -1.085 1.52 L -0.585 -0.689 L -0.185 0.566 L 0.195 0.566 L 0.585 -0.681 L 1.085 1.52 L 1.475 1.423 L 0.805 -1.501 L 0.425 -1.518 L 0.005 -0.169 Z"},{char:"X",path:"M -0.805 -1.573 L -1.145 -1.352 L -0.245 0 L -1.145 1.349 L -0.805 1.572 L 0.005 0.361 L 0.805 1.572 L 1.145 1.349 L 0.245 0 L 1.145 -1.352 L 0.805 -1.573 L 0.005 -0.362 Z"},{char:"Y",path:"M -0.2 -1.536 L -0.2 -0.049 L -1.27 1.286 L -0.96 1.536 L 0 0.339 L 0.96 1.536 L 1.27 1.286 L 0.2 -0.049 L 0.2 -1.536 Z"},{char:"Z",path:"M -0.865 -1.495 L -1.035 -1.182 L 0.495 1.095 L -1.065 1.095 L -1.065 1.495 L 0.865 1.495 L 1.035 1.185 L -0.495 -1.094 L 1.065 -1.094 L 1.065 -1.495 Z"}];var sYe=13.2,aYe=11.2,S3e=[{name:"Rect",path:"M 6 -6 L -6 -6 L -6 6 L 6 6 Z M 5 -5 L 5 5 L -5 5 L -5 -5 Z",hole:1},{name:"Circle",path:"M 0 -5.5 C 3.033 -5.5 5.5 -3.033 5.5 0 C 5.5 3.036 3.033 5.5 0 5.5 C -3.033 5.5 -5.5 3.036 -5.5 0 C -5.5 -3.033 -3.033 -5.5 0 -5.5 M 0 -6.6 C -3.645 -6.6 -6.6 -3.645 -6.6 0 C -6.6 3.641 -3.645 6.6 0 6.6 C 3.645 6.6 6.6 3.641 6.6 0 C 6.6 -3.645 3.645 -6.6 0 -6.6 Z",hole:1},{name:"Triangle",path:"M -7.277 5.153 L 7.277 5.153 L 0 -8.118 Z M -5.693 4.158 L 0 -5.859 L 5.705 4.158 Z",hole:1},{name:"Star6",path:"M 2.586 4.476 L 6.397 3.701 L 5.171 0 L 6.397 -3.687 L 2.586 -4.462 L 0 -7.373 L -2.573 -4.462 L -6.398 -3.687 L -5.158 0 L -6.398 3.687 L -2.573 4.476 L 0 7.373 Z M -0.01 5.86 L -1.93 3.68 L -5.09 2.93 L -4.15 -0.16 L -5.09 -2.94 L -1.93 -3.68 L -0.01 -5.87 L 1.93 -3.68 L 5.09 -2.94 L 4.16 0.15 L 5.09 2.94 L 1.93 3.67 Z",hole:1},{name:"Star4",path:"M -6.68 6.68 L 0 4.34 L 6.68 6.68 L 4.34 0 L 6.68 -6.68 L 0 -4.34 L -6.523 -6.68 L -4.34 0 Z M 5 -5 L 3.24 0 L 5 5 L 0 3.24 L -5 5 L -3.24 0 L -5 -5 L 0 -3.24 Z",hole:1},{name:"Plus",path:"M 3.72 -6 L -3.72 -6 L -3.72 -3.72 L -6 -3.72 L -6 3.72 L -3.72 3.72 L -3.72 6 L 3.72 6 L 3.72 3.72 L 6 3.72 L 6 -3.72 L 3.72 -3.72 Z M 2.72 -5 L 2.72 -2.72 L 5 -2.72 L 5 2.72 L 2.72 2.72 L 2.72 5 L -2.72 5 L -2.72 2.72 L -5 2.72 L -5 -2.72 L -2.72 -2.72 L -2.72 -5 Z",hole:1},{name:"X",path:"M 6 -6 L 1.636 -6 L 0 -4.364 L -1.636 -6 L -6 -6 L -6 -1.636 L -4.364 0 L -6 1.636 L -6 6 L -1.636 6 L 0 4.364 L 1.636 6 L 6 6 L 6 1.636 L 4.364 0 L 6 -1.636 Z M 5.004 -4.992 L 5.004 -2.054 L 2.938 0.002 L 5.004 2.054 L 5.004 4.995 L 2.054 4.995 L 0 2.938 L -2.054 4.995 L -5.004 4.995 L -5.004 2.054 L -2.938 0.002 L -5.004 -2.054 L -5.004 -4.992 L -2.054 -4.992 L 0 -2.938 L 2.054 -4.992 Z",hole:1},{name:"Diamond",path:"M 0 -7.8 L -7.8 0 L 0 7.8 L 7.8 0 Z M 0 -6.103 L 6.103 0 L 0 6.108 L -6.103 0 Z",hole:1},{name:"Rect2",path:"M 6 -6 L -6 -6 L -6 6 L -5.004 4.995 L -5 -5 L 5.004 -5 Z M 6 -6 L 5.004 -5 L 5.004 4.995 L -5.004 4.995 L -6 6 L 6 6 Z M 4.004 -4 L -4 -4 L -4 4.004 L -3 3.004 L -3 -3 L 3.004 -3 Z M 4.004 -4 L 3.004 -3 L 3.004 3.004 L -3 3.004 L -4 4.004 L 4.004 4.004 Z",hole:0}];function lYe(o,t,e){let{iconIndex:r,charIndex:i,char:n,hasIcon:s,hasChar:a,smallChar:l}=Pxt(t),c=[];if(s){let{apertureKey:h}=x3e(r);if(!o.existApertureDefinition(h)){let u=o.getNewApertureNumber(),d="D"+u,{apertureDefinition:p,apertureMacro:m}=yxt(r,e,void 0,u);m&&o.addMacroBlock(m),o.addApertureBlock(p,h),c.push(d)}}if(a){let{apertureKey:h}=R3e(i,l);if(!o.existApertureDefinition(h)){let u=o.getNewApertureNumber(),d="D"+u,{apertureDefinition:p,apertureMacro:m}=bxt(i,l,e,void 0,u);m&&o.addMacroBlock(m),o.addApertureBlock(p,h),c.push(d)}}return c}function yxt(o,t="mm",e=6,r){let{apertureType:i,macroName:n}=x3e(o),s=Txt(o,t,e),a=new t1(r,i),l;return n?l=new YT(n,s):a.appendModifier(s),{apertureDefinition:a,apertureMacro:l}}function bxt(o,t,e="mm",r=6,i){let{apertureType:n,macroName:s}=R3e(o,t),a=Ixt(o,t,e,r),l=new t1(i,n),c=new YT(s,a);return{apertureDefinition:l,apertureMacro:c}}function Pxt(o){if(typeof o!="number"||o<0)throw new Error("markIndex is invalid");o=o%269;let t=S3e.length,e=zle.length,r=Yle.length,i,n,s=!1,a=!1,l=!1,c="";if(o<t)i=o,s=!0;else if(o<t+e)n=o-t,a=!0,c=zle[n].char;else{let h=o-t-e;n=h%r,i=Math.floor(h/r),s=!0,a=!0,l=!0,c=Yle[n].char}return{iconIndex:i,charIndex:n,char:c,hasIcon:s,hasChar:a,smallChar:l}}function cYe(o="mm"){return(o.toLowerCase()=="mm"?.4:.01575)/12}function x3e(o){let{name:t,path:e,hole:r}=S3e[o]||{};if(!t)throw new Error("icon not exists");let i="Icon"+t,n=t=="Circle"?"":"Icon"+t,s=t=="Circle"?"C":n;return{name:t,path:e,hole:r,apertureType:s,apertureKey:i,macroName:n}}function R3e(o,t){let{char:e,path:r}=(t?Yle:zle)[o]||{};if(!e)throw new Error("char not exists");let i="Char"+e+(t?"s":"");return{char:e,name:i,path:r,apertureType:i,apertureKey:i,macroName:i}}function Txt(o,t="mm",e=6){let{name:r,path:i,hole:n}=x3e(o),s=cYe(t)*1.4;if(r=="Circle")return A3e(_3e([sYe,aYe],s),e).join("X");if(n){let a=v3e(i),l={outline:a[0],holes:a.length?a.slice(1):void 0};return hYe([l],s,e)}else{let a=v3e(i),l=u=>A3e(_3e(u,s),e);return a.map(O3e).map(l).map(u=>E3e(u,1)).join("*")}}function Ixt(o,t,e="mm",r=6){let{path:i}=R3e(o,t),n=cYe(e)*2*1.4*2,s=v3e(i),a={outline:s[0],holes:s.length?s.slice(1):void 0};return hYe([a],n,r)}function Cxt(o){return o.map(({outline:t,holes:e})=>({outline:O3e(t),holes:e?e.map(O3e):void 0}))}function hYe(o,t=1,e=2){let r=Cxt(o);return Sxt(r,t,e)}function Sxt(o,t=1,e=2){let r=[];for(let n of o)if(r.push(...n.outline),n.holes)for(let s of n.holes)r.push(...s);r=_3e(r,t),r=A3e(r,e);let i=[];for(let n of o){let s=r.splice(0,n.outline.length),a=E3e(s,1);if(i.push(a),n.holes)for(let l of n.holes){let c=r.splice(0,l.length),h=E3e(c,0);i.push(h)}}return i.join("*")}function E3e(o,t=1){let e=o.length;(o[0]!=o[e-2]||o[1]!=o[e-1])&&(o=o.concat(o[0],o[1]));let r=o.length/2-1;return`4,${t?1:0},${r},${o.join(",")},0`}function O3e(o){if(/[a-yHVA]/.test(o))throw new Error("not support this path");return[...o.match(/-?\d+(?:\.\d+)?/g)].map(Number)}function Ext(o,t=6){return+o.toFixed(t)}function A3e(o,t=6){return o.map(e=>Ext(e,t))}function _3e(o,t=1){return o.map(e=>e*t)}function v3e(o){return o.slice(1).split("M").map(t=>"M "+t.trim())}var Hq=class Hq{constructor(){this.documentMap={};this.elementUsedLayerMap={};this.commentStartLayerMap={};this.fpcDocumentMap={};this.colorSilkMarkDocumentMap={};this.drillMap=[];this.generateElementOffsets=[];this.drillLayerMap={};this.fpcLayerNameMap={};this._unit="MM";this._integerPlaces=4;this._decimalPlaces=2;this.saveUUID=!1;this.useCircleInsteadOfSquareDrill=!0;this.released=!1;this.fileUuid="";this.userUuid="";this.ignoreHash=!1;this.isImportedPCBDoc=!1;this.layerIds=null;this.layerConfigs=null;this.objectConfigs=null;this.stepRepeatConfig=vle;this.stepRepeatParameterOpened=!1;this.useOldBool=!1;this.origin=S.ORIGIN;this.colorSilkMark=[];this.colorSilkBoard={};this.polygonDataArrForColorSilkBoard=[];this.rectsDataArrForColorSilkBoard=[];this.circlesDataArrForColorSilkBoard=[];this.quickPanelizeEnabled=!0;this.uniquePadsTable=[];this.originOffset=new S(0,0);this.drillDocumentMap={PTH:new w_,NPTH:new w_,PTH_Via:new w_}}get unitName(){return this._unit=="IN"?"inches":"millimeters"}get unit(){return this._unit}set unit(t){this._unit=t}get integerPlaces(){return this._integerPlaces}set integerPlaces(t){this._integerPlaces=t}get decimalPlaces(){return this._decimalPlaces}set decimalPlaces(t){this._decimalPlaces=t}createDocumentMap(){let t=this.layerIds;this.docLayerIds=t.slice();let e=new Vq;e.leftLength=this.integerPlaces,e.rightLength=this.decimalPlaces,e.unit=this.unit,this.formatter=e;for(let r of t)r==58||r==59||(this.documentMap[r]=new M_(r),this.documentMap[r].setFormatter(e),this.generateHeader(r));this.addColorSilkDocument()}createPanelize(){let t=this.originOffset,e=ai.getInstance(),r=e.items.concat(e.outlines),i=(s,a)=>{this.autoCommentStart("Panelize",s,a)},n=this.getMatrix(11,t);for(let s of r){let a;a=s.layerId;let l=gr(a);if(s instanceof ys){if(!l&&!this.isUsedLayerId(a))continue;let c=this.getRealDoc(a);if(!c)continue;a==11&&(this.colorSilkBoard.panelizeLine||(this.colorSilkBoard.panelizeLine=[]),this.colorSilkBoard.panelizeLine.push(s));let h=s.primitive,u=fe.build2([h]);if(!u)continue;let d=u.multiply3(n);i(a,c);let p=c.getApertureCircle(1);c.useAperture(p);let m=gi.polygonLine(d);c.addBlock(m)}if(s instanceof Li){if(!l&&!this.isUsedLayerId(a))continue;let c=this.getRealDoc(a);if(!c)continue;let{strokeWidth:h,fontFamily:u,key:d,value:p,showKey:m,showValue:g}=s;if(!m&&!g)continue;let y,b=[];y=s.getRealOutline();for(let P of y)P instanceof Kp?P.pl=P.pl.multiply3(n):P=P.multiply3(n),b.push(P);if(!(b!=null&&b.length))continue;if(i(a,c),u=="default"||u==""){let P=c.getApertureCircle(h);c.useAperture(P);for(let T of b)if(T instanceof fe){let I=gi.polygonLine(T);c.addBlock(I)}}else{if(b.some(_=>_ instanceof Kp&&!_.flag)){let _=new Map,R=[];for(let w of b)_.has(w.order)?_.get(w.order).push(w.pl):(_.set(w.order,[w.pl]),R.push(1));let v=Array.from(_.values()),D=LC(v,R);for(let w of D){let F=gi.rawPolygonFill(w);c.addBlock(F)}continue}let T=()=>c.addBlock(xp.PolarityDark),I=()=>c.addBlock(xp.PolarityClear),C=!0,O=!!1;for(let _ of b)if(_ instanceof Kp){let R=_.flag===O;C!==R&&(C=R,R?T():I());let v=gi.polygonFill(_.pl);c.addBlock(v)}C||T()}}if(s instanceof Je){let c=(h,u)=>{this.autoCommentStart("Panelize",u);let d=this.getRealDoc(u);if(!d)return;let{center:p,pasteExpansion:m,topSolderExpansion:g,bottomSolderExpansion:y}=h,b=d.layerId,P=7,T=8,I=5,C=6,{top:E,bottom:O}=h,_=0,R=[1,5,7].includes(u)?E:O;switch(b){case P:case T:_=m;break;case I:_=g;break;case C:_=y;break}switch(R.type){case"ELLIPSE":{let v=R.width+_*2;if(v<=0)break;let D=d.getApertureCircle(v);d.useAperture(D),p=p.multiply3(n);let w=gi.flashAt(p);d.addBlock(w);break}}};if(!l&&!this.isUsedLayerId(a))continue;(l||Io(a))&&(c(s,1),c(s,5),l||c(s,7)),(l||2==a)&&(c(s,2),c(s,6),l||c(s,8))}if(s instanceof Po)if(s.type=="Slot Region"){let c=!1,h=s.radius*2,u=s.center;if(h<=0)continue;this.autoCommentStart("Panelize",a);let d=new M_(a),p=d.getApertureCircle(h);d.useAperture(p),u=u.multiply3(n);let m=gi.flashAt(u);d.addBlock(m),this.addDrillCircle(c,h,u)}else{if(!this.isUsedLayerId(a))continue;let c=this.getRealDoc(a,s.type);if(!c)continue;a==11&&(this.colorSilkBoard.panelizeCircle||(this.colorSilkBoard.panelizeCircle=[]),this.colorSilkBoard.panelizeCircle.push(s));let{center:h,radius:u,strokeWidth:d}=s;i(a,c);let p=c.getApertureCircle(d);c.useAperture(p),h=h.multiply3(n);let m=gi.circleLine(h,u);c.addBlock(m)}if(s instanceof nl){if(!l&&!this.isUsedLayerId(a))continue;let c=this.getRealDoc(a);if(!c)continue;this.colorSilkBoard.panelizeArc||(this.colorSilkBoard.panelizeArc=[]),this.colorSilkBoard.panelizeArc.push(s);let h=s.primitive,u=new Array;if(s.length>1e-8&&s.end.distance1(s.start)<.1&&s.getAngle()>Math.PI){let y=h.sweepAngle/2,b=h.startAngle+y,P=q.build3(h.center,h.startAngle,y,h.rx,h.ry),T=q.build3(h.center,b,y,h.rx,h.ry);u.push(P),u.push(T)}else u.push(h);let d=fe.build2(u);if(!d)continue;let p=d.multiply3(n);i(a,c);let m=c.getApertureCircle(s.width);c.useAperture(m);let g=gi.polygonLine(p);c.addBlock(g)}}if(this.autoCommentEndAllLayer("Panelize"),this.createColorSilkMarkPanelize(),this.stepRepeatParameterOpened=!1,!this.defaultParam.onlyOutline&&this.defaultParam.success){let s=this.defaultParam.offset||new S(0,0),a=this.defaultParam.row,l=this.defaultParam.column;if(this.stepRepeatConfig={column:l,row:a,stepX:s.x,stepY:s.y},this.quickPanelizeEnabled){for(let p of["PTH","NPTH","PTH_Via"]){let m=this.drillDocumentMap[p];m&&m.setPanelizeFlag()}let c=this.docLayerIds,h=new tw([l,a,s.x,s.y]);this.stepRepeatParameterOpened=!0;let u=p=>{p&&(p.addEmptyLine(),p.addParameter(h),p.stepRepeatParameterOpened=!0,p.stepRepeatConfig=this.stepRepeatConfig)};for(let p of c){let m=this.getRealDoc(p);u(m)}let d=this.colorSilkMarkDocumentMap.CSM;d&&u(d)}}}createColorSilkMarkPanelize(){if(!this.colorSilkMark.length)return;let t=this.originOffset,e=this.colorSilkMarkDocumentMap.CSM;e.setFormatter(this.formatter),e.setTargetAsBody();let r=this.getMatrix(11,t);e.addComment("colorScreenSilk_board Start");for(let i in this.colorSilkBoard){let n=this.colorSilkBoard[i];if(i=="panelizeLine"){e.addComment("panelizeLine Start");for(let s of n){let a=s.primitive,l=fe.build2([a]);if(!l)continue;let c=l.multiply3(r),h=e.getApertureCircle(1);e.useAperture(h);let u=gi.polygonLine(c);e.addBlock(u)}e.addComment("panelizeLine End")}if(i=="panelizeCircle"){e.addComment("panelizeCircle Start");for(let s of n){let a=e.getApertureCircle(s.strokeWidth);e.useAperture(a);let l=s.center.multiply3(r),c=gi.circleLine(l,s.radius);e.addBlock(c)}e.addComment("panelizeCircle End")}if(i=="panelizeArc"){e.addComment("panelizeArc Start");for(let s of n){let a=s.primitive,l=new Array;if(s.length>1e-8&&s.end.distance1(s.start)<.1&&s.getAngle()>Math.PI){let p=a.sweepAngle/2,m=a.startAngle+p,g=q.build3(a.center,a.startAngle,p,a.rx,a.ry),y=q.build3(a.center,m,p,a.rx,a.ry);l.push(g),l.push(y)}else l.push(a);let c=fe.build2(l);if(!c)continue;let h=c.multiply3(r),u=e.getApertureCircle(s.width);e.useAperture(u);let d=gi.polygonLine(h);e.addBlock(d)}e.addComment("panelizeArc End")}}}createPanelizeFast(t){let e=this.originOffset,r=this.getMatrix(11,e),i={panelizeLine:[],panelizeCircle:[],panelizeArc:[]},n=(h,u)=>{this.autoCommentStart("Panelize",h,u)},s=h=>h.addBlock(xp.PolarityDark),a=h=>h.addBlock(xp.PolarityClear),l=(h,u)=>{if(!this.isUsedLayerId(u))return;let{width:d,center:p,pasteExpansion:m,topSolderExpansion:g,bottomSolderExpansion:y}=h;this.autoCommentStart("Panelize",u);let b=this.getRealDoc(u);if(!b)return;this.elementUsedLayerMap[u]=!0;let P=b.layerId,T=0;switch(P){case 7:case 8:T=m;break;case 5:T=g;break;case 6:T=y;break}let I=d+T*2;if(I>0){let C=b.getApertureCircle(I);b.useAperture(C);let E=c(p);E=E.multiply3(r);let O=gi.flashAt(E);b.addBlock(O)}},c=h=>new S(h.x,h.y);for(let h of t){let{type:u,layerId:d}=h,p=gr(d);if(u=="line"){if(!p&&!this.isUsedLayerId(d))continue;let m=this.getRealDoc(d);if(!m)continue;this.elementUsedLayerMap[d]=!0,d==11&&i.panelizeLine.push(h);let{start:g,end:y}=h,b=c(g).multiply3(r),P=c(y).multiply3(r);n(d,m);let T=m.getApertureCircle(1);m.useAperture(T);let I=gi.line(b,P);m.addBlock(I)}if(u=="text"){if(!p&&!this.isUsedLayerId(d))continue;let m=this.getRealDoc(d);if(!m)continue;this.elementUsedLayerMap[d]=!0;let g=h,{strokeWidth:y,isOutlineFont:b,hasHole:P,outlinesData:T,outlinesFlag:I,outlinesOrder:C,outlinesGroup:E}=g;if(!T.length)continue;if(n(d,m),b){let D=m.getApertureCircle(y);m.useAperture(D);for(let w of T){let F=Mm(w),H=gi.polygonLine(F.multiply3(r));m.addBlock(H)}continue}if(P){let D=b9(T),w=new Map,F=[];for(let G=0;G<D.length;G++){let W=D[G].multiply3(r),L=I[G],B=W.area(.1)>0;L==B&&(D[G]=W.reverse()),w.has(E[G])?w.get(E[G]).push(W):(w.set(E[G],[W]),F.push(1))}let H=Array.from(w.values()),z=LC(H,F);for(let G of z){let W=gi.rawPolygonFill(G);m.addBlock(W)}continue}let O=!0,R=!!1,v=-1;for(let D of T){v++;let w=I[v],F=Mm(D),H=w===R;O!==H&&(O=H,H?s(m):a(m));let z=gi.polygonFill(F);m.addBlock(z)}O||s(m)}if(u=="pad"){let{side:m}=h,g=h;m=="top"?(l(g,1),l(g,5),p||l(g,7)):m=="bottom"&&(l(g,2),l(g,6),p||l(g,8))}if(u=="circle"){let m=h,{layerId:g,isSlot:y,center:b,radius:P,strokeWidth:T}=m;if(!p&&!this.isUsedLayerId(g))continue;if(y){let I=!1,C=P*2,E=c(b);if(C<=0)continue;this.autoCommentStart("Panelize",g);let O=new M_(g);this.elementUsedLayerMap[g]=!0;let _=O.getApertureCircle(C);O.useAperture(_),E=E.multiply3(r);let R=gi.flashAt(E);O.addBlock(R),this.addDrillCircle(I,C,E)}else{if(!p&&!this.isUsedLayerId(g))continue;let I=this.getRealDoc(g);if(!I)continue;this.elementUsedLayerMap[g]=!0,g==11&&i.panelizeCircle.push(h),n(g,I);let C=I.getApertureCircle(T);I.useAperture(C);let E=c(b);E=E.multiply3(r);let O=gi.circleLine(E,P);I.addBlock(O)}}if(u=="arc"){if(!p&&!this.isUsedLayerId(d))continue;let m=this.getRealDoc(d);if(!m)continue;this.elementUsedLayerMap[d]=!0,d==11&&i.panelizeArc.push(h);let g=h,{needSplit:y,width:b,center:P,startAngle:T,sweepAngle:I,rx:C,ry:E}=g,O=c(P),_=new Array;if(y){let F=I/2,H=T+F,z=q.build3(O,T,F,C,E),G=q.build3(O,H,F,C,E);_.push(z,G)}else{let F=q.build3(O,T,I,C,E);_.push(F)}let R=fe.build2(_);if(!R)continue;let v=R.multiply3(r);n(d,m);let D=m.getApertureCircle(b);m.useAperture(D);let w=gi.polygonLine(v);m.addBlock(w)}}this.autoCommentEndAllLayer("Panelize"),this.createColorSilkMarkPanelizeFast(i),this.initStepRepeatConfig(),this.handleSRFlag()}initStepRepeatConfig(){let t=this.defaultParam.offset||new S(0,0),e=this.defaultParam.row,r=this.defaultParam.column;this.stepRepeatConfig={column:r,row:e,stepX:t.x,stepY:t.y}}handleSRFlag(){if(this.stepRepeatParameterOpened=!1,!this.defaultParam.onlyOutline&&this.defaultParam.success&&this.quickPanelizeEnabled){for(let i of["PTH","NPTH","PTH_Via"]){let n=this.drillDocumentMap[i];n&&n.setPanelizeFlag()}let t=this.docLayerIds;this.stepRepeatParameterOpened=!0;let e=(i,n)=>{i&&(i.addEmptyLine(),i.addParameter(n),i.stepRepeatParameterOpened=!0,i.stepRepeatConfig=this.stepRepeatConfig)};for(let i of t){let n=this.getStepRepeat(i),s=this.getGerberLayerDocument(i);e(s,n)}let r=this.colorSilkMarkDocumentMap.CSM;if(r){let i=this.getStepRepeat(11);e(r,i)}}}getStepRepeat(t){let{column:e,row:r,stepX:i,stepY:n}=this.stepRepeatConfig;return this.getLayerIsMirror(t)&&(i=-i),new tw([e,r,i,n])}setOnlyOutLineSlotSR(t){if(this.defaultParam.success&&this.defaultParam.onlyOutline&&this.quickPanelizeEnabled){this.stepRepeatParameterOpened=!1;let e=this.getStepRepeat(t.layerId);this.stepRepeatParameterOpened=!0,t&&(t.addEmptyLine(),t.addParameter(e),t.stepRepeatParameterOpened=!0,t.stepRepeatConfig=this.stepRepeatConfig)}}closeOnlyOutLineSlotSR(t){if(this.defaultParam.success&&this.stepRepeatParameterOpened&&this.defaultParam.onlyOutline){let e=new tw;t&&t.stepRepeatParameterOpened&&(t.addParameter(e),t.stepRepeatParameterOpened=!1)}}setOnlyOutLineCircleSlotSR(t){this.defaultParam.success&&this.defaultParam.onlyOutline&&this.quickPanelizeEnabled&&t&&t.panelizeFrom==1/0&&t.setPanelizeFlag()}getRealDoc(t,e,r){let i=this.getGerberLayerDocument(t);if(e=="FPC Stiffener"){let{material:n,thickness:s,fpcModel:a}=r;i=this.addFPCDocument(t,n,s,a),this.handleFpcPanelize(i)}else e=="Slot Region"&&(i=this.getGerberLayerDocument(11));return i}isNPTHSlot(t,e){return t=="Slot Region"?new ft().conversion1("mil","mm",e)<=.65:!1}createColorSilkMarkPanelizeFast(t){if(!this.colorSilkMark.length)return;let e=this.originOffset,r=this.colorSilkMarkDocumentMap.CSM;r.setFormatter(this.formatter),r.setTargetAsBody();let i=this.getMatrix(11,e),n=a=>new S(a.x,a.y);if(Object.values(t).some(a=>a==null?void 0:a.length)){r.addComment("colorScreenSilk_board Start");for(let a in t){let l=t[a];if(a=="panelizeLine"){r.addComment("panelizeLine Start");for(let c of l){let{start:h,end:u}=c,d=n(h).multiply3(i),p=n(u).multiply3(i),m=r.getApertureCircle(1);r.useAperture(m);let g=gi.line(d,p);r.addBlock(g)}l&&r.addComment("panelizeLine End")}if(a=="panelizeCircle"){r.addComment("panelizeCircle Start");for(let c of l){let{center:h,radius:u,strokeWidth:d}=c,p=r.getApertureCircle(d);r.useAperture(p);let m=n(h).multiply3(i),g=gi.circleLine(m,u);r.addBlock(g)}r.addComment("panelizeCircle End")}if(a=="panelizeArc"){r.addComment("panelizeArc Start");for(let c of l){let{needSplit:h,width:u,center:d,startAngle:p,sweepAngle:m,rx:g,ry:y}=c,b=n(d),P=new Array;if(h){let O=m/2,_=p+O,R=q.build3(b,p,O,g,y),v=q.build3(b,_,O,g,y);P.push(R,v)}else{let O=q.build3(b,p,m,g,y);P.push(O)}let T=fe.build2(P);if(!T)continue;let I=T.multiply3(i),C=r.getApertureCircle(u);r.useAperture(C);let E=gi.polygonLine(I);r.addBlock(E)}r.addComment("panelizeArc End")}}}}getGerberLayerDocument(t){return this.documentMap[t]}getAllLayerIds(){return Object.keys(this.documentMap).map(Number)}getLayerInfo(t){return this.layerConfigs.find(r=>r.layerId==t)}isPlaneLayer(t){let e=this.getLayerInfo(t);return e&&Rh(e.layerType)}getUsedInnerLayerIds(){return this.docLayerIds.filter(t=>Ms(t))}isUsedLayerId(t){return this.docLayerIds.includes(t)}autoCommentStart(t,e,r){if(r=r||this.getGerberLayerDocument(e),!r)return;let i=this.commentStartLayerMap[e];i||(i={},this.commentStartLayerMap[e]=i),i[t]||(i[t]=!0,r.addEmptyLine(),r.addComment(`${t} Start`))}autoCommentEnd(t,e,r){if(r=r||this.getGerberLayerDocument(e),!r)return;let i=this.commentStartLayerMap[e];i!=null&&i[t]&&(r.addComment(`${t} End`),i[t]=!1)}autoCommentEndAllLayer(t){for(let e of this.docLayerIds)this.autoCommentEnd(t,e)}setTargetAsBodyAllLayer(){for(let t of this.docLayerIds){let e=this.getGerberLayerDocument(t);e&&e.setTargetAsBody()}}generateHeader(t,e){let r=this.getGerberLayerDocument(t);(t==58||t==59)&&(r=e);let i=vq(this.getLayerInfo(t));this.generateHeaderComment(r,i)}generateHeaderComment(t,e){let{fileUuid:r="",userUuid:i="",saveUUID:n}=this,{unitName:s,integerPlaces:a,decimalPlaces:l}=this;if(t.setTargetAsHeader(),t.addComment("Layer: "+e),t.addComment(`EasyEDA Pro v${this.mainVersion}, ${yte(new Date)}`),(r||i)&&n&&t.addComment(`UUID: ${r}, ${i}`),t.addComment("Gerber Generator version "+Hq.version),t.addComment("Scale: 100 percent, Rotated: No, Reflected: No"),t.addComment("Dimensions in "+s),t.addComment(`Leading zeros omitted, absolute positions, ${a} integers and ${l} decimals`),this.defaultParam.outerBBox){let c=this.panelizeComment();t.addComment(c)}t.addComment(this.isOneClick?"Generated by one-click":"Generated by\xA0custom\xA0config"),t.addComment(`Object Configs: ${this.objectConfigs.join(",")}`),t.addComment(`Layer Configs: ${this.docLayerIds.join(",")}`),t.addComment("Copper Areas: 0"),t.addParameter(this.generateFormatParameters())}generateColorSilkMarkHeader(){let t=this.colorSilkMarkDocumentMap.CSM;this.generateHeaderComment(t,"Fabrication_ColorfulBoardOutlineMark")}flushAllBodyBlocks(){for(let t of this.docLayerIds){let e=this.getGerberLayerDocument(t);e&&e.flushBodyBlocks()}}updateCopperComment(){var t;for(let e of this.layerIds){let r=this.getGerberLayerDocument(e);if(!r)continue;let n=`Copper Areas: ${(t=this.copperInfoMap[e])!=null?t:0}`;r.updateCopperComment(n)}}panelizeComment(){let t=this.defaultParam.outerBBox,e=this.defaultParam.singleBBox,r=this.defaultParam.onlyOutline?"Only Board Outline":"All Objects",i=this.defaultParam.column,n=this.defaultParam.row,s;this.defaultParam.stampRow&&this.defaultParam.stampColumn?s="Stamp Hole":!this.defaultParam.stampRow&&!this.defaultParam.stampColumn?s="V-CUT":s="V-CUT + Stamp Hole";let a=this.getPanelizeBox(t,"outerBox"),l=this.getPanelizeBox(e,"bBox");return`Panelize: ${s}, Column: ${i}, Row: ${n}, ${l}, ${a}, Panelized Method: ${r}`}generateColorSilkLocationHole(t){if(!this.colorSilkMark.length)return;let e=this.colorSilkMarkDocumentMap.CSM,r=this.getMatrix(11,t);for(let s in this.colorSilkBoard){let a=this.colorSilkBoard[s];if(s=="polygon"||s=="rect"){let l=s=="polygon"?"PolygonModel":"Rect";e.addComment(`${l} Start`);for(let c of a){let h=c.layerId,u=c.getMathGraphics(h,0);if(!u)continue;let d=u.multiply3(r),p=e.getApertureCircle(c.strokeWidth);e.useAperture(p);let m=gi.polygonLine(d);e.addBlock(m)}e.addComment(`${l} End`)}if(s=="circle"){e.addComment("Circle Start");for(let l of a){let c=e.getApertureCircle(l.strokeWidth);e.useAperture(c);let h=l.center.multiply3(r),u=gi.circleLine(h,l.radius);e.addBlock(u)}e.addComment("Circle End")}}e.addComment("colorScreenSilk_board End"),e.addEmptyLine(),e.addComment("colorScreenSilk_Mark Start"),e.addComment("Pad Start");let i=0,n=2;for(let s of this.colorSilkMark){s=new S(s.x,s.y);let a=n+i*2;if(a<=0)break;let l=e.getApertureCircle(a);e.useAperture(l),s=s.multiply3(r);let c=gi.flashAt(s);e.addBlock(c)}e.addComment("Pad End"),e.addComment("colorScreenSilk_Mark End"),e.addEmptyLine()}generateColorSilkLocationHoleFast(){if(!this.colorSilkMark.length){this.closeStepRepeatParameter();return}let t=this.polygonDataArrForColorSilkBoard,e=this.rectsDataArrForColorSilkBoard,r=this.circlesDataArrForColorSilkBoard;if(!t.length&&!e.length&&!r.length)return;let i=c=>new S(c.x,c.y),n=this.colorSilkMarkDocumentMap.CSM;n.setFormatter(this.formatter),n.setTargetAsBody();let s=this.generateElementOffsets;n.addComment("colorScreenSilk_board Start");for(let c of s){t.length&&n.addComment("PolygonModel Start");for(let h of t){let{layerId:u,strokeWidth:d,polylineData:p,polylineGroupData:m}=h,g=this.getMatrix(u,c),y=n.getApertureCircle(d);if(n.useAperture(y),p){let b=Mm(p).multiply3(g),P=gi.polygonLine(b);n.addBlock(P)}if(m){let b=b9(m);for(let P of b){let T=P.multiply3(g),I=gi.polygonLine(T);n.addBlock(I)}}n.flushBodyBlocks()}t.length&&n.addComment("PolygonModel End"),e.length&&n.addComment("Rect Start");for(let h of e){let{layerId:u,strokeWidth:d,polylineData:p}=h,m=this.getMatrix(u,c),g=n.getApertureCircle(d);n.useAperture(g);let y=Mm(p).multiply3(m),b=gi.polygonLine(y);n.addBlock(b)}e.length&&n.addComment("Rect End"),r.length&&n.addComment("Circle Start");for(let h of r){let{layerId:u,strokeWidth:d,center:p,radius:m}=h,g=this.getMatrix(u,c),y=n.getApertureCircle(d);n.useAperture(y);let b=i(p);b=b.multiply3(g);let P=gi.circleLine(b,m);n.addBlock(P)}r.length&&n.addComment("Circle End"),n.flushBodyBlocks()}n.addComment("colorScreenSilk_board End"),n.addEmptyLine(),this.closeStepRepeatParameter(),n.addComment("colorScreenSilk_Mark Start");let a=0,l=2;for(let c of this.colorSilkMark){c=new S(c.x,c.y);let h=l+a*2;if(h<=0)break;let u=n.getApertureCircle(h);n.useAperture(u);let d=gi.flashAt(c);n.addBlock(d)}n.addComment("colorScreenSilk_Mark End"),n.addEmptyLine()}getPanelizeBox(t,e){let r=ka((Math.abs(t.minX)+Math.abs(t.maxX))*10,1),i=ka((Math.abs(t.minY)+Math.abs(t.maxY))*10,1),n="inch";return this._unit=="MM"&&(r=ka(Di.convert(r,1,39.37),3),i=ka(Di.convert(i,1,39.37),3),n="mm"),`${e=="outerBox"?"Panelized Board Size:":"Board Size:"} ${r}${n} x ${i}${n}`}generateFormatParameters(){let t=new Fq;t.setCoordinateFormat(this.integerPlaces,this.decimalPlaces);let e=new yG;return this.unit=="IN"?e.setUnitAsInch():e.setUnitAsMillimeter(),[t,e]}addPadToDoc(t,e,r){let{center:i,rotation:n,pasteExpansion:s,topSolderExpansion:a,bottomSolderExpansion:l}=t,c=new S(i.x,i.y),h=e.layerId,u=7,d=8,p=5,m=6,g=this.getMatrix(h,r),y=Math.round(n/Math.PI*180*100)/100,b=0,{type:P,width:T,height:I,ratio:C}=this.getPad(t,h);switch(this.autoCommentStart("Pad",h,e),h){case u:case d:b=s;break;case p:b=a;break;case m:b=l;break;default:break}switch(P){case"ELLIPSE":{if(T+=b*2,T<=0)break;let E=e.getApertureCircle(T);e.useAperture(E),c=c.multiply3(g);let O=gi.flashAt(c);e.addBodyBlock(O);break}case"OVAL":{if(T+=b*2,I+=b*2,T<=0||I<=0)break;if(T==I){let _=e.getApertureCircle(T);e.useAperture(_),c=c.multiply3(g);let R=gi.flashAt(c);e.addBodyBlock(R);break}y%90===0&&y%180&&([I,T]=[T,I],y=0),y!==0&&this.getLayerIsMirror(h)&&(y=(Math.PI-n)%(Math.PI*2)*180/Math.PI);let E=e.getApertureOval(T,I,y,this.decimalPlaces);e.useAperture(E),c=c.multiply3(g);let O=gi.flashAt(c);e.addBodyBlock(O);break}case"RECT":{if(T+=b*2,I+=b*2,T<=0||I<=0)break;h==p?C=t.top.solderExpansionRatio:h==m?C=t.bottom.solderExpansionRatio:h==u?C=t.top.pasteExpansionRatio:h==d&&(C=t.bottom.pasteExpansionRatio);let E=Math.min(T,I)/2*C;this.getLayerIsMirror(h)&&(y=(Math.PI-n)%(Math.PI*2)*180/Math.PI);let O=e.getApertureRect(T,I,y,E,this.decimalPlaces);e.useAperture(O),c=c.multiply3(g);let _=gi.flashAt(c);e.addBodyBlock(_);break}case"POLYGON":{let E=this.getPolygonPadPl(h,t);if(E){if(E.primitives.every(R=>R instanceof M)&&E.primitives.length<3)return;let O=No(E),_=[E];if(O){if(_=YI(E),!_.length){console.log("[GerberDocument] \u591A\u8FB9\u5F62\u710A\u76D8\u53BB\u81EA\u76F8\u4EA4\u540E\u88AB\u5220\u9664",{layerId:h,\u53BB\u81EA\u76F8\u4EA4\u524D:E.primitives,\u53BB\u81EA\u76F8\u4EA4\u540E:_});return}let R=new Kc().getUnion(_);_=[];for(let v of R){let D=LC([v.items],[1]);for(let w of D)_.push(fe.build4(w))}}for(let R of _){let v=R.multiply3(g);if(v.primitives.some(W=>W instanceof q)){let W=gi.polygonFill(v);e.addBodyBlock(W);continue}let F=v.bbox().center(),H=v.multiply3(Qe.translate1(F.mul(-1))),z=.1,G=H.primitives.flatMap(W=>W.points(z).slice(1));if(G.length<=YT.MaxOutlinePolygonPoints){let W=e.getAperturePolygon(G,this.decimalPlaces);e.useAperture(W);let L=gi.flashAt(F);e.addBodyBlock(L)}else{let W=gi.polygonFill(v);e.addBodyBlock(W)}}}break}default:break}}getPolygonPadPl(t,e){var i,n,s,a;let r;switch(t){case 5:r=Mm((i=e.top)==null?void 0:i.solderPolyData);break;case 7:r=Mm((n=e.top)==null?void 0:n.pastePolyData);break;case 6:r=Mm((s=e.bottom)==null?void 0:s.solderPolyData);break;case 8:r=Mm((a=e.bottom)==null?void 0:a.pastePolyData);break;default:r=Mm(e.polylineData);break}return r}getPad(t,e){let r=[1,7,5],i=[2,8,6];return r.includes(e)?t.top:i.includes(e)?t.bottom:t.inner}generatePad(t){let e=(n,s)=>{this.getRealDoc(s)&&(this.elementUsedLayerMap[s]=!0)};if(!this.objectConfigs.includes("Pad"))return;let r=$n.getInstance();r.itemsCount&&(this.flushAllBodyBlocks(),r.iterator(n=>{let s=n.layerId,a=gr(s);if(!(!a&&!this.isUsedLayerId(s))&&((a||Io(s))&&(e(n,1),e(n,5),a||e(n,7)),(a||2==s)&&(e(n,2),e(n,6),a||e(n,8)),a)){let l=this.getUsedInnerLayerIds().filter(T=>!n.unusedInnerLayers.includes(T));for(let T of l)e(n,T);let{plated:c,center:h,rotation:u,holeShape:d,holeLength:p,holeOffset:m,holeRadius:g,holeRotation:y}=n,b=this.getMatrix(11,t);h=h.multiply3(b);let P=g*2;if(g>0){d!=="SLOT"&&(m=m.multiply3(Qe.rotate(u)));let T=h.add(m);switch(d){case"SLOT":let I=p/2-g,C=T.add1(I,0).rotate(T,y),E=T.add1(-I,0).rotate(T,y);C=C.rotate(h,u),E=E.rotate(h,u),this.addDrillSlot(c,P,C,E);break;case"ROUND":this.addDrillCircle(c,P,T);break;case"RECT":this.useCircleInsteadOfSquareDrill&&this.addDrillCircle(c,P,T);break;default:break}}}}),this.autoCommentEndAllLayer("Pad"),this.flushAllBodyBlocks())}generatePadFast(t){if(!t.length||!this.objectConfigs.includes("Pad"))return;let e,r=(n,s)=>{if(!this.isUsedLayerId(s))return;let a=this.getRealDoc(s);a&&(this.addPadToDoc(n,a,e),this.elementUsedLayerMap[s]=!0)};this.flushAllBodyBlocks();let i=this.generateElementOffsets;for(e of i){for(let n of t){let s=n.layerId,a=gr(s);if((a||Io(s))&&(r(n,1),r(n,5),a||r(n,7)),(a||2==s)&&(r(n,2),r(n,6),a||r(n,8)),a){let l=this.getUsedInnerLayerIds().filter(C=>!n.unusedInnerLayers.includes(C));for(let C of l)r(n,C);let{plated:c,center:h,rotation:u,holeShape:d,holeLength:p,holeOffset:m,holeRadius:g,holeRotation:y}=n,b=new S(h.x,h.y),P=new S(m.x,m.y),T=this.getMatrix(11,e);b=b.multiply3(T);let I=g*2;if(g>0){d!=="SLOT"&&(P=P.multiply3(Qe.rotate(u)));let C=b.add(P);switch(d){case"SLOT":let E=p/2-g,O=C.add1(E,0).rotate(C,y),_=C.add1(-E,0).rotate(C,y);O=O.rotate(b,u),_=_.rotate(b,u),this.addDrillSlot(c,I,O,_);break;case"ROUND":this.addDrillCircle(c,I,C);break;case"RECT":this.useCircleInsteadOfSquareDrill&&this.addDrillCircle(c,I,C);break;default:break}}}}this.flushAllBodyBlocks()}}generateVia(t){let e=1,r=2,i=5,n=6,s=15,a=46,l=(h,u,d)=>{if(d<=0)return;this.elementUsedLayerMap[h]=!0;let p=this.getMatrix(h,t);u=u.multiply3(p);let m=this.getRealDoc(h);if(!m)return;let g=m.getApertureCircle(d*2);this.autoCommentStart("Via",h,m),m.useAperture(g);let y=gi.flashAt(u);m.addBlock(y)};Tn.getInstance().itemsCount&&(this.flushAllBodyBlocks(),Tn.getInstance().iterator(h=>{let{startLayer:u,endLayer:d}=h,p=h.type,{center:m,radius:g,holeRadius:y,topExpansion:b,bottomExpansion:P}=h,T=y*2,I=!0,C=!0,E,O;if(I=Io(u)||Io(d),C=2==u||2==d,u==d)throw new Error("Invalid via data");if(I&&C&&p==1||!(I&&C)&&p!==1)throw new Error("Invalid via data");I&&C?this.objectConfigs.includes("Via")&&(u=e,d=r,E=s,O=a):I?(E=s,O=Ms(u)?u:d):C?(E=Ms(u)?u:d,O=a):(E=u<d?u:d,O=u>d?u:d),I&&(l(e,m,g),l(i,m,g+b)),C&&(l(r,m,g),l(n,m,g+P));let _=this.getUsedInnerLayerIds().filter(v=>!h.unusedInnerLayers.includes(v));for(let v of _)v>=E&&v<=O&&l(v,m,g);let R=this.getMatrix(11,t);m=m.multiply3(R),I&&C?this.objectConfigs.includes("Via")&&(this.addDrillCircle(!0,T,m,!0),this.addDrillCircle(!0,T,m)):I?this.addBlindDrillCircle(e,O,m,T):C?this.addBlindDrillCircle(E,r,m,T):this.addBlindDrillCircle(E,O,m,T)}),this.autoCommentEndAllLayer("Via"),this.flushAllBodyBlocks())}generateViaFast(t){if(!t.length)return;let e=1,r=2,i=5,n=6,s=15,a=46,l=(h,u,d,p)=>{if(p<=0||!this.isUsedLayerId(h))return;this.elementUsedLayerMap[h]=!0;let m=this.getRealDoc(h);if(!m)return;let g=m.getApertureCircle(p*2);this.autoCommentStart("Via",h,m),m.useAperture(g);let y=this.getMatrix(h,u);d=d.multiply3(y);let b=gi.flashAt(d);m.addBodyBlock(b)},c=this.generateElementOffsets;for(let h of c){for(let u of t){let{startLayer:d,endLayer:p,type:m,center:g,radius:y,holeRadius:b,topExpansion:P,bottomExpansion:T,unusedInnerLayers:I}=u,C=b*2,E,O,_=Io(d)||Io(p),R=2==d||2==p;if(d==p)throw new Error("Invalid via data");if(_&&R&&m==1||!(_&&R)&&m!==1)throw new Error("Invalid via data");_&&R?this.objectConfigs.includes("Via")&&(d=e,p=r,E=s,O=a):_?(E=s,O=Ms(d)?d:p):R?(E=Ms(d)?d:p,O=a):(E=d<p?d:p,O=d>p?d:p);let v=new S(g.x,g.y);_&&(l(e,h,v,y),l(i,h,v,y+P)),R&&(l(r,h,v,y),l(n,h,v,y+T));let D=this.getUsedInnerLayerIds().filter(H=>!I.includes(H));for(let H of D)H>=E&&H<=O&&l(H,h,v,y);let w=this.getMatrix(11,h),F=v.multiply3(w);_&&R?this.objectConfigs.includes("Via")&&(this.addDrillCircle(!0,C,F,!0),this.addDrillCircle(!0,C,F)):_?this.addBlindDrillCircle(e,O,F,C):R?this.addBlindDrillCircle(E,r,F,C):this.addBlindDrillCircle(E,O,F,C)}this.flushAllBodyBlocks()}}generateText(t){let e=mo.getInstance().getAllItem();if(!e.length)return;let r=new Map;for(let i=0;i<e.length;i++){let n=e[i],s=n.layerId,a=n.getParent(),l=!!n.key;if(s!=56){if(a&&a instanceof vi){if(l){if(!this.objectConfigs.includes("ComponentProperty"))continue}else if(this.isSilkLayer(s)&&!this.objectConfigs.includes("ComponentSilkscreen"))continue}else if(!this.objectConfigs.includes("Text"))continue}if(!this.isUsedLayerId(s))continue;this.elementUsedLayerMap[s]=!0;let{strokeWidth:c,fontFamily:h,key:u,value:d,showKey:p,showValue:m}=n;if(!p&&!m)continue;if(r.has(d)){let T=r.get(d);if(T.some(C=>e[C].equals(n)))continue;T.push(i)}else r.set(d,[i]);let g=this.getRealDoc(s);if(!g)continue;let y,b=[],P=this.getMatrix(s,t);y=n.getRealOutline();for(let T of y)T instanceof Kp?T.pl=T.pl.multiply3(P):T=T.multiply3(P),b.push(T);if(b!=null&&b.length)if(this.autoCommentStart("Text",s,g),h=="default"||h==""){let T=g.getApertureCircle(c);g.useAperture(T);for(let I of b)if(I instanceof fe){let C=gi.polygonLine(I);g.addBlock(C)}}else{if(b.some(R=>R instanceof Kp&&!R.flag)){let R=[];this.outlineToCWAndHoleToCCW(b,H=>R.push(H));let v=new Map,D=[];for(let H of b)v.has(H.order)?v.get(H.order).push(H.pl):(v.set(H.order,[H.pl]),D.push(1));let w=Array.from(v.values()),F=LC(w,D);for(let H of F){let z=gi.rawPolygonFill(H);g.addBlock(z)}continue}let I=()=>g.addBlock(xp.PolarityDark),C=()=>g.addBlock(xp.PolarityClear),E=!0,_=!!1;for(let R of b)if(R instanceof Kp){let v=R.flag===_;E!==v&&(E=v,v?I():C());let D=gi.polygonFill(R.pl);g.addBlock(D)}E||I()}}this.autoCommentEndAllLayer("Text")}generateTextFast(t){if(!t.length)return;let e=[],r=l=>l.addBlock(xp.PolarityDark),i=l=>l.addBlock(xp.PolarityClear),n=l=>{for(let c of e){let[h,u]=c;if(s(h,l))return u}return null},s=(l,c)=>{let h=l.outlinesData,u=c.outlinesData;if(h.length!=u.length)return!1;for(let d=0;d<h.length;d++){let p=h[d],m=u[d];for(let g=0;g<p.length;g++)if(p[g]!=m[g])return!1}return!0},a=this.generateElementOffsets;for(let l of a)for(let c of t){let{layerId:h,strokeWidth:u,isOutlineFont:d,hasHole:p,outlinesData:m,outlinesFlag:g,outlinesOrder:y,outlinesGroup:b}=c;if(!this.isUsedLayerId(h))continue;this.elementUsedLayerMap[h]=!0;let P=this.getRealDoc(h);if(!P)continue;let T=this.getMatrix(h,l);if(this.autoCommentStart("Text",h,P),!d){let _=P.getApertureCircle(u);P.useAperture(_);for(let R of m){let v=Mm(R),D=gi.polygonLine(v.multiply3(T));P.addBlock(D)}continue}if(p){let _,R=n(c);if(R)_=R;else{let v=b9(m),D=new Map,w=[];for(let H=0;H<v.length;H++){let z=v[H].multiply3(T),G=g[H],W=z.area(.1)>0;G==W&&(v[H]=z.reverse()),D.has(b[H])?D.get(b[H]).push(z):(D.set(b[H],[z]),w.push(1))}let F=Array.from(D.values());_=LC(F,w),e.push([c,_])}for(let v of _){let D=gi.rawPolygonFill(v);P.addBlock(D)}continue}let I=!0,E=!!1,O=-1;for(let _ of m){O++;let R=g[O],v=Mm(_),D=R===E;I!==D&&(I=D,D?r(P):i(P));let w=gi.polygonFill(v.multiply3(T));P.addBlock(w)}I||r(P)}e=null}generateDimension(t){let e=Ka.getInstance().getAllItem(),r=Za.getInstance().getAllItem(),i=Sl.getInstance().getAllItem(),n=s=>{for(let a of s){let l=a.layerId,c=this.getMatrix(l,t),h=this.getLayerIsMirror(l);if(!this.isUsedLayerId(l))continue;this.elementUsedLayerMap[l]=!0;let u=this.getRealDoc(l);if(!u)continue;this.autoCommentStart("Dimension",l,u);let d=a.getBaseGraphics(),p=u.getApertureCircle(a.strokeWidth);u.useAperture(p);for(let m of d){let g=gi.KitsuneLine(m,c,h);u.addBlock(g)}if(a instanceof zd){let m=a.getDegree(),{center:g,radius:y,width:b}=m,P=u.getApertureCircle(b);u.useAperture(P),g=g.multiply3(c);let T=gi.circleLine(g,y);u.addBlock(T)}}};n(e),n(r),n(i),this.autoCommentEndAllLayer("Dimension")}generateDimensionFast(t){if(!t.length)return;let e=this.generateElementOffsets;for(let r of e)for(let i of t){let{layerId:n,strokeWidth:s,linesData:a,degreeObject:l}=i,c=this.getMatrix(n,r),h=this.getLayerIsMirror(n);if(!this.isUsedLayerId(n))continue;this.elementUsedLayerMap[n]=!0;let u=this.getRealDoc(n);if(!u)continue;this.autoCommentStart("Dimension",n,u);let d=u.getApertureCircle(s);u.useAperture(d);let p=b9(a);for(let m of p){let g=m.primitives.filter(b=>b instanceof q||b instanceof M),y=gi.KitsuneLine(g,c,h);u.addBlock(y)}if(l){let{center:m,radius:g,width:y}=l,b=u.getApertureCircle(y);u.useAperture(b);let P=new S(m.x,m.y).multiply3(c),T=gi.circleLine(P,g);u.addBlock(T)}}}generatePolygonModel(t){let e=this.filterObject(),r=Mi.getInstance().getAllItem();if(!r.length)return;r=(n=>{let s=[],a=[];return n.forEach(l=>{l.outline instanceof Gt?s.push(l):a.push(l)}),s.concat(a)})(r);for(let n of r){let s=n.layerId,a=this.getMatrix(s,t);if(n.getParent()){if(this.isSilkLayer(s)){if(!this.objectConfigs.includes("ComponentSilkscreen"))continue}else if(e&&!e.includes(n.type))continue}else if(e&&!e.includes(n.type))continue;if(!gr(s)&&!this.isUsedLayerId(s)||this.isPlaneLayer(s))continue;let h=this.getGerberLayerDocument(s);if(!h)continue;if(s==11&&(this.colorSilkBoard.polygon||(this.colorSilkBoard.polygon=[]),this.colorSilkBoard.polygon.push(n)),n.type=="FPC Stiffener"){let m=n.component;h=this.addFPCDocument(s,m.material,m.thickness,m.fpcModel),this.handleFpcPanelize(h)}let u=(m,g)=>{this.autoCommentStart("PolygonModel",m,g)},{type:d,strokeWidth:p}=n;switch(d){case"Board Outline":case"Line":{let m=n.getMathGraphics(s,0);if(!m)continue;this.elementUsedLayerMap[s]=!0;let g=m.multiply3(a);u(s,h);let y=h.getApertureCircle(p);h.useAperture(y);let b=gi.polygonLine(g);h.addBlock(b);break}case"FPC Stiffener":case"Fill Region":{let m=n.getMathGraphics(s,0);if(!m)continue;this.elementUsedLayerMap[s]=!0;let g;if(m instanceof fe?g=m.multiply3(a):(g=[],m.items.forEach(y=>{g.push(y.multiply3(a))})),u(s,h),m instanceof Gt){let y=LC([g],[1]);for(let b of y){let P=gi.rawPolygonFill(b);h.addBlock(P)}}else{let y=gi.polygonFill(g);h.addBlock(y)}break}case"Slot Region":{let m=n.getMathGraphics(s,0);if(!m)continue;this.elementUsedLayerMap[s]=!0;let g=this.getMatrix(11,t),y=m.multiply3(g),b=this.getGerberLayerDocument(11);if(!b)continue;u(11,b);let P=b.getApertureCircle(p);b.useAperture(P);let T=gi.polygonLine(y);b.addBlock(T);break}case"Prohibited Region":case"Copper Region":break;default:break}}this.autoCommentEndAllLayer("PolygonModel")}generatePolygonFast(t){if(!t.length)return;let e=(i,n)=>{this.autoCommentStart("PolygonModel",i,n)},r=this.generateElementOffsets;for(let i of r)for(let n of t){let{layerId:s,type:a,strokeWidth:l,polylineData:c,polylineGroupData:h,fpc:u}=n,d=this.getMatrix(s,i),p=this.getRealDoc(s,a,a=="FPC Stiffener"?u:void 0);if(p)switch(s==11&&this.polygonDataArrForColorSilkBoard.push(n),a){case"Board Outline":case"Line":{this.elementUsedLayerMap[s]=!0,e(s,p);let m=p.getApertureCircle(l);p.useAperture(m);let g=Mm(c).multiply3(d),y=gi.polygonLine(g);p.addBlock(y),p.flushBodyBlocks();break}case"FPC Stiffener":case"Fill Region":{if(this.elementUsedLayerMap[s]=!0,e(s,p),c){let m=Mm(c).multiply3(d),g=gi.polygonFill(m);p.addBlock(g)}else if(h){let m=[],g=b9(h);for(let b of g)m.push(b.multiply3(d));let y=LC([m],[0],!0);for(let b of y){let P=gi.rawPolygonFill(b);p.addBlock(P)}}p.flushBodyBlocks();break}case"Slot Region":{if(!this.isUsedLayerId(11))continue;this.elementUsedLayerMap[11]=!0,e(11,p),this.setOnlyOutLineSlotSR(p);let m=p.getApertureCircle(l);p.useAperture(m);let g=this.getMatrix(11,i),y=Mm(c).multiply3(g),b=gi.polygonLine(y);p.addBlock(b),p.flushBodyBlocks(),this.closeOnlyOutLineSlotSR(p);break}case"Prohibited Region":case"Copper Region":break;default:break}}}generateImage(t){let e=Qs.getInstance().getAllItem();if(!e.length)return;let r=[],i=(l,c)=>{let h=l.template,u=c.template;if(h.length!=u.length)return!1;for(let d=0;d<h.length;d++){let p=h[d],m=u[d];if(!p.equals(m))return!1}return!0},n=l=>{for(let c of r){let[h,u]=c;if(i(h,l))return u}return null},s=l=>{let c=l.template.map(d=>d.clone());return new pm("",0,c).pls},a=l=>{let c=n(l);return c||(c=s(l),r.push([l,c])),l.getPathByTemplatePath(c)};for(let l of e){let c=l.layerId,h=l.getParent();if(c!=56){if(h){if(this.isSilkLayer(c)){if(!this.objectConfigs.includes("ComponentSilkscreen"))continue}else if(!this.objectConfigs.includes("Image"))continue}else if(!this.objectConfigs.includes("Image"))continue}if(!this.isUsedLayerId(c))continue;this.elementUsedLayerMap[c]=!0;let u=a(l),d=[],p=this.getMatrix(c,t),m=u.some(I=>!I.flag),g=new Set,y=[],b=[];for(let I of u)I.pl=I.pl.multiply3(p),d.push(I),m&&(I.order==0?(b=[I.pl],y.push(1),g.add(b)):I.order>0&&b.push(I.pl));let P=this.getRealDoc(c);if(!P)continue;if(this.autoCommentStart("Image",c,P),m){this.outlineToCWAndHoleToCCW(d);let I=LC(Array.from(g),y);for(let C of I){let E=gi.rawPolygonFill(C);P.addBlock(E)}continue}let T=!0;for(let I of d){T!==I.flag&&(T=I.flag,T?P.addBlock(xp.PolarityDark):P.addBlock(xp.PolarityClear));let C=gi.polygonFill(I.pl);P.addBlock(C)}T||P.addBlock(xp.PolarityDark)}this.autoCommentEndAllLayer("Image")}generateImageFast(t){if(!t.length)return;let e=new Map,r=new Map,i=[],n=(h,u)=>{let d=h.template,p=u.template;if(d.length!=p.length)return!1;for(let m=0;m<d.length;m++){let g=d[m],y=p[m];for(let b=0;b<g.length;b++)if(g[b]!=y[b])return!1}return!0},s=h=>{for(let u of i){let[d,p]=u;if(n(d,h))return p}return null},a=h=>{if(r.has(h))return r.get(h);let d=e.get(h).map(g=>g.clone()),m=new pm("",0,d).pls;return r.set(h,m),m},l=(h,u)=>{let d=s(h);d||(d=a(h),i.push([h,d]));let p=d;return p=p.map(m=>m.clone()),p.forEach(m=>{u=new Qe(u.data),m.pl=m.pl.multiply3(u)}),p},c=this.generateElementOffsets;for(let h of c)for(let u of t){let d=u.layerId;if(!this.isUsedLayerId(d))continue;if(d!=56){if(u.hasParent){if(this.isSilkLayer(d)){if(!this.objectConfigs.includes("ComponentSilkscreen"))continue}else if(!this.objectConfigs.includes("Image"))continue}else if(!this.objectConfigs.includes("Image"))continue}this.elementUsedLayerMap[d]=!0,e.set(u,b9(u.template));let p=l(u,u.matrix),m=[],g=this.getMatrix(d,h),y=p.some(E=>!E.flag),b=new Set,P=[],T=[];for(let E of p)E.pl=E.pl.multiply3(g),m.push(E),y&&(E.order==0?(T=[E.pl],P.push(0),b.add(T)):E.order>0&&T.push(E.pl));let I=this.getRealDoc(d);if(!I)continue;if(this.autoCommentStart("Image",d,I),y){this.outlineToCWAndHoleToCCW(m);let E=[];for(let O of b){let _=LC([O],[0],!0);for(let R of _)E.push(R)}for(let O of E){let _=gi.rawPolygonFill(O);I.addBlock(_)}continue}let C=!0;for(let E of m){C!==E.flag&&(C=E.flag,C?I.addBlock(xp.PolarityDark):I.addBlock(xp.PolarityClear));let O=gi.polygonFill(E.pl);I.addBlock(O)}C||I.addBlock(xp.PolarityDark),I.flushBodyBlocks()}e.clear(),r.clear(),i=null,t=null}generateDrillImage(t){let e=56;if(!this.isUsedLayerId(e))return;let r=this.drillDrawingLayerSymbol;if(!r||!r.length)return;let i=this.getRealDoc(e);if(!i)return;this.autoCommentStart("Drill Drawing",e,i),i.flushBodyBlocks();let n=.1,s=this.getMatrix(e,t);this.elementUsedLayerMap[e]=r&&r.length>0,r.forEach(a=>{let{positions:l}=a;l!=null&&l.length&&!(l[0]instanceof S)&&(a.positions=l.map(c=>new S(c.x,c.y)))}),r.forEach(a=>{let{positions:l,image:c,text:h}=a,u=c&&b9(c);if(!u)return;let d=this.convertPolylinesToGerberPolylines(u);for(let y of d)y.pl=y.pl.multiply3(s);let p=[];if(d.some(y=>!y.flag)){let y=new Map,b=[];for(let I of d)y.has(I.order)?y.get(I.order).push(I.pl):(y.set(I.order,[I.pl]),b.push(1));let P=Array.from(y.values()),T=LC(P,b);for(let I of T){let C=gi.rawPolygonFill(I);p.push(...C)}}else{let y=!0;for(let b of d){y!==b.flag&&(y=b.flag,y?p.push(xp.PolarityDark):p.push(xp.PolarityClear));let P=gi.polygonFill(b.pl);p.push(...P)}y||p.push(xp.PolarityDark)}let g=S.ORIGIN;for(let y of l){let b=y.multiply3(s);xq(p,b.sub(g)),i.addBlock(p),i.flushBodyBlocks(),g=b}}),r.forEach(a=>{let{positions:l,image:c,text:h}=a,u=h&&b9(h);if(!u)return;u=u.map(g=>g.multiply3(s));let d=[],p=i.getApertureCircle(n);i.useAperture(p);for(let g of u){let y=gi.polygonLine(g);d.push(...y)}let m=S.ORIGIN;for(let g of l)xq(d,g.sub(m)),i.addBlock(d),i.flushBodyBlocks(),m=g}),this.autoCommentEnd("Drill Drawing",e,i),i.flushBodyBlocks()}generateDrillImageFast(t){let e=56;if(!this.isUsedLayerId(e)||!(t!=null&&t.length))return;this.elementUsedLayerMap[e]=!0;let r=this.getRealDoc(e);if(!r)return;r.flushBodyBlocks(),this.autoCommentStart("Drill Drawing",e,r);let i=this.generateElementOffsets;for(let n of i){let s=this.getMatrix(e,n);for(let a of t){let{positions:l,markIndex:c}=a,h=lYe(r,c,this.unit),u=l.map(d=>new S(d.x,d.y).multiply3(s));for(let d of h){r.useAperture(d);for(let p of u){let m=gi.flashAt(p);r.addBodyBlock(m)}}r.flushBodyBlocks()}}}generateRect(t){let e=this.filterObject(),r=rn.getInstance().getAllItem();for(let i of r){let n=i.layerId,s=this.getMatrix(n,t);if(i.getParent()){if(this.isSilkLayer(n)){if(!this.objectConfigs.includes("ComponentSilkscreen"))continue}else if(e&&!e.includes(i.type))continue}else if(e&&!e.includes(i.type))continue;if(!gr(n)&&!this.isUsedLayerId(n)||this.isPlaneLayer(n))continue;let c=this.getGerberLayerDocument(n);if(!c)continue;if(n==11&&(this.colorSilkBoard.rect||(this.colorSilkBoard.rect=[]),this.colorSilkBoard.rect.push(i)),i.type=="FPC Stiffener"){let p=i.component;c=this.addFPCDocument(n,p.material,p.thickness,p.fpcModel),this.handleFpcPanelize(c)}let h=(p,m)=>{this.autoCommentStart("Rect",p,m)},{type:u,strokeWidth:d}=i;switch(u){case"Board Outline":case"Line":{let p=i.getMathGraphics(n);if(!p)continue;this.elementUsedLayerMap[n]=!0;let m=p.multiply3(s);h(n,c);let g=c.getApertureCircle(d);c.useAperture(g);let y=gi.polygonLine(m);c.addBlock(y);break}case"FPC Stiffener":case"Fill Region":{let p=i.getMathGraphics(n);if(!p)continue;this.elementUsedLayerMap[n]=!0;let m=p.multiply3(s);h(n,c);let g=gi.polygonFill(m);c.addBlock(g);break}case"Slot Region":{let p=i.getMathGraphics(n);if(!p)continue;this.elementUsedLayerMap[n]=!0;let m=this.getMatrix(11,t),g=p.multiply3(m),y=this.getGerberLayerDocument(11);if(!y)continue;h(11,y);let b=y.getApertureCircle(d);y.useAperture(b);let P=gi.polygonLine(g);y.addBlock(P);break}case"Prohibited Region":case"Copper Region":break;default:break}}this.autoCommentEndAllLayer("Rect")}generateRectFast(t){if(!t.length)return;let e=(i,n)=>{this.autoCommentStart("Rect",i,n)},r=this.generateElementOffsets;for(let i of r)for(let n of t){let{layerId:s,type:a,strokeWidth:l,hasParent:c,polylineData:h,fpc:u}=n,d=this.getMatrix(s,i),p=this.getRealDoc(s,a,a=="FPC Stiffener"?u:void 0);if(p)switch(s==11&&this.rectsDataArrForColorSilkBoard.push(n),a){case"Board Outline":case"Line":{this.elementUsedLayerMap[s]=!0,e(s,p);let m=p.getApertureCircle(l);p.useAperture(m);let g=Mm(h).multiply3(d),y=gi.polygonLine(g);p.addBlock(y),p.flushBodyBlocks();break}case"FPC Stiffener":case"Fill Region":{this.elementUsedLayerMap[s]=!0,e(s,p);let m=Mm(h).multiply3(d),g=gi.polygonFill(m);p.addBlock(g),p.flushBodyBlocks();break}case"Slot Region":{if(!this.isUsedLayerId(11))continue;this.elementUsedLayerMap[11]=!0,e(11,p),this.setOnlyOutLineSlotSR(p);let m=p.getApertureCircle(l);p.useAperture(m);let g=this.getMatrix(11,i),y=Mm(h).multiply3(g),b=gi.polygonLine(y);p.addBlock(b),p.flushBodyBlocks(),this.closeOnlyOutLineSlotSR(p);break}case"Prohibited Region":case"Copper Region":break;default:break}}}generateCircle(t){let e=this.filterObject(),r=zi.getInstance().getAllItem();for(let i of r){let n=i.layerId,s=this.getMatrix(n,t);if(i.getParent()){if(this.isSilkLayer(n)){if(!this.objectConfigs.includes("ComponentSilkscreen"))continue}else if(e&&!e.includes(i.type))continue}else if(e&&!e.includes(i.type))continue;if(!gr(n)&&!this.isUsedLayerId(n)||this.isPlaneLayer(n))continue;let c=this.getGerberLayerDocument(n);if(!c)continue;if(n==11&&(this.colorSilkBoard.circle||(this.colorSilkBoard.circle=[]),this.colorSilkBoard.circle.push(i)),i.type=="FPC Stiffener"){let g=i.component;c=this.addFPCDocument(n,g.material,g.thickness,g.fpcModel),this.handleFpcPanelize(c)}let h=(g,y)=>{this.autoCommentStart("Circle",g,y)},{type:u,center:d,radius:p,strokeWidth:m}=i;switch(u){case"Board Outline":case"Line":{this.elementUsedLayerMap[n]=!0,h(n,c);let g=c.getApertureCircle(m);c.useAperture(g),d=d.multiply3(s);let y=gi.circleLine(d,p);c.addBlock(y);break}case"FPC Stiffener":case"Fill Region":{this.elementUsedLayerMap[n]=!0,h(n,c);let g=c.getApertureCircle(p*2+m);c.useAperture(g),d=d.multiply3(s);let y=gi.flashAt(d);c.addBlock(y);break}case"Slot Region":{let g=p*2;if(new ft().conversion1("mil","mm",g)<=.65){this.elementUsedLayerMap[n]=!0;let y=!1,b=new M_(n);h(n,b);let P=b.getApertureCircle(g);b.useAperture(P),d=d.multiply3(s);let T=gi.flashAt(d);b.addBlock(T),this.addDrillCircle(y,g,d)}else{this.elementUsedLayerMap[n]=!0;let y=this.getGerberLayerDocument(11);if(!y)continue;let b=this.getMatrix(11,t);h(11,y);let P=y.getApertureCircle(m);y.useAperture(P),d=d.multiply3(b);let T=gi.circleLine(d,p);y.addBlock(T)}break}case"Prohibited Region":case"Copper Region":break;default:break}}this.autoCommentEndAllLayer("Circle")}generateCircleFast(t){if(!t.length)return;let e=(i,n)=>{this.autoCommentStart("Circle",i,n)},r=this.generateElementOffsets;for(let i of r)for(let n of t){let{layerId:s,type:a,strokeWidth:l,hasParent:c,center:h,radius:u,fpc:d}=n,p=this.getMatrix(s,i),m=this.getRealDoc(s,a,a=="FPC Stiffener"?d:void 0),g=this.isNPTHSlot(a,u*2);if(!m&&!g)continue;let y=new S(h.x,h.y);switch(s==11&&this.circlesDataArrForColorSilkBoard.push(n),a){case"Board Outline":case"Line":{this.elementUsedLayerMap[s]=!0,e(s,m);let b=m.getApertureCircle(l);m.useAperture(b),y=y.multiply3(p);let P=gi.circleLine(y,u);m.addBlock(P);break}case"FPC Stiffener":case"Fill Region":{this.elementUsedLayerMap[s]=!0,e(s,m);let b=m.getApertureCircle(u*2+l);m.useAperture(b),y=y.multiply3(p);let P=gi.flashAt(y);m.addBlock(P);break}case"Slot Region":{let b=u*2;if(g){this.elementUsedLayerMap[s]=!0;let P=!1;y=y.multiply3(p),this.addDrillCircle(P,b,y,void 0,!0)}else{if(!this.isUsedLayerId(11))continue;this.elementUsedLayerMap[11]=!0;let P=this.getMatrix(11,i);e(11,m),this.setOnlyOutLineSlotSR(m);let T=m.getApertureCircle(l);m.useAperture(T),y=y.multiply3(P);let I=gi.circleLine(y,u);m.addBlock(I),this.closeOnlyOutLineSlotSR(m)}break}case"Prohibited Region":case"Copper Region":break;default:break}}}generateTear(t){let e=Mi.getInstance().getAllItem();for(let r of e)if(r.type=="TearDrop"){let i=r.layerId,n=this.getMatrix(i,t);if(!this.objectConfigs.includes("TearDrop")||!this.isUsedLayerId(i))continue;this.elementUsedLayerMap[i]=!0;let s=this.getRealDoc(i);if(!s)continue;this.autoCommentStart("TearDrop",i,s);let a=r.getMathGraphics(i,0);if(!a)continue;let l=a.multiply3(n),c=gi.polygonFill(l);s.addBlock(c)}this.autoCommentEndAllLayer("TearDrop")}generateTearDropFast(t){if(!t.length)return;let e=this.generateElementOffsets;for(let r of e)for(let i of t){let{layerId:n,type:s,polylineData:a}=i;if(s=="TearDrop"){let l=this.getMatrix(n,r);this.elementUsedLayerMap[n]=!0;let c=this.getRealDoc(n);if(!c)continue;this.autoCommentStart("TearDrop",n,c);let h=Mm(a).multiply3(l),u=gi.polygonFill(h);c.addBlock(u),c.flushBodyBlocks()}}}generateTrack(t){let e={},r=a=>e[a],i=(a,l)=>e[a]=l;if(!this.objectConfigs.includes("Track"))return;let n=a=>{let l=a.layerId;if(!this.isUsedLayerId(l))return;this.elementUsedLayerMap[l]=!0;let c=this.getRealDoc(l);if(!c)return;this.autoCommentStart("Track",l,c);let h=c.getApertureCircle(a.width);c.useAperture(h);let u=this.getMatrix(l,t),d=a.start.multiply3(u),p=a.end.multiply3(u),m,g=r(l);if((!g||g.x!==d.x||g.y!==d.y)&&(m=gi.linearTo(d,Q1.ExposureOff),c.addBlock(m)),a instanceof Oi)if(Math.abs(a.sweepAngle)<.5)m=gi.linearTo(p,Q1.ExposureOn);else{let{center:y,isCCW:b}=a;y=y.multiply3(u);let P={x:y.x-d.x,y:y.y-d.y};this.getLayerIsMirror(l)&&(b=!b),b?m=gi.counterclockwiseArcTo(p,P,Q1.ExposureOn):m=gi.clockwiseArcTo(p,P,Q1.ExposureOn)}else m=gi.linearTo(p,Q1.ExposureOn);i(l,p),c.addBlock(m)};An.getInstance().itemsCount&&(An.getInstance().iterator(n),this.autoCommentEndAllLayer("Track"))}generateTrackFast(t){if(!t.length||!this.objectConfigs.includes("Track"))return;let e={},r=(s,a)=>{let l=e[s];if(!l)return null;let[c,h]=l;return h==a?c:null},i=(s,a,l)=>{e[s]=[a,l]},n=this.generateElementOffsets;for(let s of n)for(let a of t){let{layerId:l,width:c,start:h,end:u,isArc:d,sweepAngle:p,center:m,isCCW:g,radius:y}=a,b=this.getMatrix(l,s),P=this.getRealDoc(l);if(!P)continue;this.elementUsedLayerMap[l]=!0,this.autoCommentStart("Track",l,P);let T=new S(h.x,h.y).multiply3(b),I=new S(u.x,u.y).multiply3(b),C=P.getApertureCircle(c);P.useAperture(C);let E,O=r(l,c);if((!O||O.x!==T.x||O.y!==T.y)&&(E=gi.linearTo(T,Q1.ExposureOff),P.addBlock(E)),d)if(Math.abs(p)<Math.acos((y-.1)/y))E=gi.linearTo(I,Q1.ExposureOn);else{let _=new S(m.x,m.y).multiply3(b),R={x:_.x-T.x,y:_.y-T.y};this.getLayerIsMirror(l)&&(g=!g),g?E=gi.counterclockwiseArcTo(I,R,Q1.ExposureOn):E=gi.clockwiseArcTo(I,R,Q1.ExposureOn)}else E=gi.linearTo(I,Q1.ExposureOn);i(l,I,c),P.addBlock(E),P.flushBodyBlocks()}}recordDrillTableData(t){this.drillTableData=t}generateDrillTable(t=this.drillTableData){var e,r,i;for(let n of t)(e=n.dataTextArr)!=null&&e.length&&this.generateTextFast(n.dataTextArr),(r=n.dataImageArr)!=null&&r.length&&this.generateImageFast(n.dataImageArr),(i=n.dataPolyArr)!=null&&i.length&&this.generatePolygonFast(n.dataPolyArr)}generatePlaneZone(t){let e=Ho.getInstance().getAllItem();e=e.sort((r,i)=>i.bbox.width()-r.bbox.width()&&i.bbox.height()-r.bbox.height());for(let r of e){if(!this.objectConfigs.includes("PlaneZone"))continue;let i=r.layerId,n=this.getMatrix(i,t);if(!this.isUsedLayerId(i)||!r.style)continue;this.elementUsedLayerMap[i]=!0;let s=r.getOutline(),a=[];for(let h of s)a.push(h.multiply3(n));let l=this.getRealDoc(i);if(!l)continue;this.autoCommentStart("PlaneZone",i,l);let c=gi.polygonFillWithHoles(a);l.addBlock(c)}this.autoCommentEndAllLayer("PlaneZone")}generatePlaneZoneFast(t){if(!this.objectConfigs.includes("PlaneZone"))return;let e=this.generateElementOffsets;for(let r of e)for(let i of t){let n=i.layerId,s=this.getMatrix(n,r);if(!this.isUsedLayerId(n)||!i.style)continue;this.elementUsedLayerMap[n]=!0;let a=b9(i.outline),l=[];for(let u of a)l.push(u.multiply3(s));let c=this.getRealDoc(n);if(!c)continue;this.autoCommentStart("PlaneZone",n,c);let h=gi.polygonFillWithHoles(l);c.addBlock(h),c.flushBodyBlocks()}}generateCopper(t){var l;if(!this.objectConfigs.includes("CopperFilled"))return;let e=Wo.getInstance(),r=e.getAllItem(),i={},n=[],s=[],a=c=>{let h=new _e;return c.forEach(d=>{h.ext1(d.bbox())}),h.build1().minX};this.objectConfigs.includes("CopperFilled")&&(this.copperInfoMap||(this.copperInfoMap={}));for(let c=0;c<r.length;c++){let h=r[c],u=h.layerId,d=this.getMatrix(u,t);if(this.objectConfigs.includes("CopperFilled")&&(this.copperInfoMap[u]=((l=this.copperInfoMap[u])!=null?l:0)+1),!this.isUsedLayerId(u))continue;let p=h.getOutline(),m=[];for(let g of p)m.push(g.multiply3(d));if(!(!m||!m.length))if(this.elementUsedLayerMap[u]=!0,n[c]=m,h.isSolid){i[u]||(i[u]=[]);let g=a(m);i[u].push({i:c,left:g})}else s.push(c)}if(this.objectConfigs.includes("CopperFilled")){let c=Object.keys(i).map(Number),h=(d,p)=>d.left-p.left,u=new Set;for(let d of c){let p=i[d];p.sort(h);let m=[],g=[],y=this.getRealDoc(d);if(y){u.add(y),p.length&&(this.elementUsedLayerMap[d]=!0);for(let b of p){let{i:P}=b;this.autoCommentStart("Copper",d,y);let T=n[P],I=gi.polygonFillWithHoles(T);y.addBlock(I),r[P].optimization&&(m.push(T),g.push(P))}m.length>0&&m.forEach((b,P)=>{let T=r[g[P]];if(T.isSolid&&T.optimization&&T.optimizationWidth>0){let I=y.getApertureCircle(T.optimizationWidth);y.useAperture(I);for(let C of b){let E=gi.polygonLine(C);y.addBlock(E)}}})}}for(let d of s){let p=r[d],m=n[d],g=p.gridLineWidth,y=this.getRealDoc(p.layerId);if(!y)continue;let b=y.getApertureCircle(g);y.useAperture(b),u.add(y),this.autoCommentStart("Copper",p.layerId,y),this.elementUsedLayerMap[p.layerId]=!0;for(let P of m){let T=gi.polygonLine(P);y.addBlock(T)}}this.autoCommentEndAllLayer("Copper");for(let d of u)d.flushBodyBlocks();u.clear()}for(let c of r)e.delete(c,c.globalIndex);r=null,i=null,n=null,s=null,e.recycle(),e=null}generateCopperFast(t){var s;if(!this.objectConfigs.includes("CopperFilled"))return;let e={},r=[],i=[],n=this.generateElementOffsets;this.objectConfigs.includes("CopperFilled")&&(this.copperInfoMap||(this.copperInfoMap={}));for(let a of n){for(let c=0;c<t.length;c++){let h=t[c],u=h.layerId,d=this.getMatrix(u,a);if(this.objectConfigs.includes("CopperFilled")&&(this.copperInfoMap[u]=((s=this.copperInfoMap[u])!=null?s:0)+1),!this.isUsedLayerId(u))continue;let p=b9(h.outline),m=[];for(let g of p)m.push(g.multiply3(d));!m||!m.length||(this.elementUsedLayerMap[u]=!0,r[c]=m,h.isSolid?(e[u]||(e[u]=[]),e[u].push(c)):i.push(c))}let l=Object.keys(e).map(Number);for(let c of l){let h=e[c],u=[],d=[],p=this.getRealDoc(c);if(p){h.length&&(this.elementUsedLayerMap[c]=!0);for(let m of h){this.autoCommentStart("Copper",c,p);let g=r[m],y=LC([g],[1]);for(let b of y){let P=gi.rawPolygonFill(b);p.addBlock(P)}t[m].optimization&&(u.push(g),d.push(m))}u.length>0&&u.forEach((m,g)=>{let y=t[d[g]];if(y.isSolid&&y.optimization&&y.optimizationWidth>0){let b=p.getApertureCircle(y.optimizationWidth);p.useAperture(b);for(let P of m){let T=gi.polygonLine(P);p.addBlock(T)}}}),p.flushBodyBlocks()}}for(let c of i){let h=t[c],u=r[c],d=h.gridLineWidth,p=this.getRealDoc(h.layerId);if(!p)continue;let m=p.getApertureCircle(d);p.useAperture(m),this.autoCommentStart("Copper",h.layerId,p),this.elementUsedLayerMap[h.layerId]=!0;for(let g of u){let y=gi.polygonLine(g);p.addBlock(y)}p.flushBodyBlocks()}}t=null,e=null,r=null,i=null}generateElement(t){this.setTargetAsBodyAllLayer(),this.generateCopper(t),this.generatePlaneZone(t),this.generateImage(t),this.generateDrillImage(t),this.generateText(t),this.generatePolygonModel(t),this.generateRect(t),this.generateCircle(t),this.generateDimension(t),this.generateTear(t),this.generatePad(t),this.generateVia(t),this.generateTrack(t),this.generateColorSilkLocationHole(t)}generateElementAll(){let t=this.generateElementOffsets;for(let e of t)this.generateElement(e)}prepareGerberDocuments(){this.createDocumentMap(),this.setTargetAsBodyAllLayer()}closeStepRepeatParameter(){if(!this.stepRepeatParameterOpened)return;let t=new tw,e=i=>{i&&i.stepRepeatParameterOpened&&(i.addParameter(t),i.stepRepeatParameterOpened=!1)},r=this.docLayerIds;for(let i of r){let n=this.getGerberLayerDocument(i);e(n)}Fn(this.fpcDocumentMap,(i,n)=>{e(n)}),Fn(this.colorSilkMarkDocumentMap,(i,n)=>{e(n)})}handleFpcPanelize(t){if(!this.defaultParam.onlyOutline&&this.defaultParam.success){let e=this.defaultParam.offset||new S(0,0),r=this.defaultParam.row,i=this.defaultParam.column,n=new tw([i,r,e.x,e.y]);t&&(t.addEmptyLine(),t.addParameter(n))}}async progressUpdate(t){self.workerBus.publish("progressUpdate",{ratio:t,descripte:"Export Gerber..."}),await new Promise(e=>{setTimeout(e,30)})}filterObject(){let t=[];return(this.objectConfigs||[]).forEach(e=>{e==="BoardOutline"?t.push("Board Outline"):e==="BoardCutout"?t.push("Slot Region"):e==="CopperOutline"||e==="CopperFilled"?t.push("Copper Region"):e==="SolidRegion"?t.push("Fill Region"):e==="ProhibitedRegion"?t.push("Prohibited Region"):e==="Line"?t.push("Line"):e==="FPCStiffener"&&t.push("FPC Stiffener")}),this.objectConfigs||(t=null),t}isSilkLayer(t){return!![3,4].includes(t)}getLayerIsMirror(t){if(this.layerConfigs){let e=this.layerConfigs.findIndex(r=>r.layerId==t);return e>=0?this.layerConfigs[e].isMirror:!1}else return!1}getMatrix(t,e){let r;return this.getLayerIsMirror(t)&&(r=Qe.MIRROR_X),r=r?r.translate1(e):Qe.translate1(e),r}convertPolylinesToGerberPolylines(t){return new pm("",0,t).pls}outlineToCWAndHoleToCCW(t,e){for(let r of t)if(r instanceof Kp){let i=r.pl.area(.1)>0;r.flag?i&&(r.pl=r.pl.reverse()):i||(r.pl=r.pl.reverse()),e&&e(r)}}createDrillHeaderComments(t,e,r,i=!1){let{fileUuid:n="",userUuid:s="",saveUUID:a}=this,l=e?"PTH":"NPTH";if(t.addHeaderComment("TYPE="+(e?"PLATED":"NON_PLATED")),r)t.addHeaderComment("Layer: "+l+"_"+r);else{let h=i?"Layer: "+l+"_Through_Via":"Layer: "+l+"_Through";t.addHeaderComment(h)}let c=`EasyEDA Pro v${this.mainVersion}, ${yte(new Date)}`;nze&&(c=`EasyEDA Pro Client v${this.mainVersion}, ${yte(new Date)}`),t.addHeaderComment(c),(n||s)&&a&&t.addHeaderComment(`UUID: ${n}, ${s}`),t.addHeaderComment("Gerber Generator version "+Hq.version)}addBlindDrillCircle(t,e,r,i){let n=this.getLayerInfo(t),s=this.getLayerInfo(e),a=vq(n).replace("Layer",""),l=vq(s).replace("Layer",""),c=a+"_to_"+l,h=this.drillDocumentMap[c];h||(h=new w_,this.drillDocumentMap[c]=h,this.drillLayerMap[c]=[t,e],this.defaultParam.success&&!this.defaultParam.onlyOutline&&h.setPanelizeFlag()),h.addCircle(i,r)}addDrillCircle(t,e,r,i=!1,n=!1){let s=t?"PTH":"NPTH";i&&(s="PTH_Via");let a=this.drillDocumentMap[s];a||(a=new w_,this.drillDocumentMap[s]=a),n&&this.setOnlyOutLineCircleSlotSR(a),a.addCircle(e,r,i,n)}addColorSilkDocument(){if(!this.colorSilkMark.length)return;let t="CSM",e=this.colorSilkMarkDocumentMap[t];e||(e=new M_(11),this.colorSilkMarkDocumentMap[t]=e),this.generateColorSilkMarkHeader()}addDrillSlot(t,e,r,i){let n=t?this.drillDocumentMap.PTH:this.drillDocumentMap.NPTH;n&&n.addSlot(e,r,i)}isMustExportLayer(t){let e=1,r=2,i=5,n=6,s=11,a=3,l=4;return[s,e,r,a,l,i,n].includes(t)}addHashApertureToGerber(t){if(this.ignoreHash===!0||t.length>3e7)return t;let e=t.split(`
`),r=/^%ADD(\d{2,4})\D.*/m,i=/^%AD|^%AM/,n=[],s=[],a=!1;e.some((m,g)=>{if(g>200&&!i.test(m)||g>200+t1.numberMax*2)return!0;let y=m.match(r);return y&&(n.push(m),s.push(+y[1]),a=!0),y?!1:a}),e=null;let l=Math.min(5+Math.random()*5|0,s.length-1);s.length<=5&&(l=s.length);let c=n[l],h=s[l];c||(s.length<=0?h=10:s.length<=5&&(h=s[s.length-1]+1,h>=t1.numberMax&&(s.length>=2?h=s[s.length-2]+1:h=10)));let u=t.replace(/^(%ADD|G54D)(\d{2,4})(?=\D)/gm,(m,g,y)=>+y<h||+y==t1.numberMax?m:g+(+y+1));(!c||!/,([\d.]+)/.test(c))&&(c=`%ADD${h}C,${Math.random().toFixed(4)}*%`);let d=c.replace(/,([\d.]+)/,(m,g)=>{let y=(0,uYe.default)((this.isImportedPCBDoc?"494d":"")+u),P=(parseInt(y.slice(-2),16)%100+100+"").slice(-2),T=(+g).toFixed(2)+P;return+T==0&&(T="0.0100"),","+T}),p=u;if(u.match(new RegExp("^%ADD"+(h+1)+"(?=\\D)","m")))p=u.replace(new RegExp("^%ADD"+(h+1)+"(?=\\D)","m"),m=>d+`
`+m);else{let m=u.split(`
`);for(let g=0,y=0,b=0;g<m.length;g++){let P=m[g];if(!b)P.match(/^%MO/)&&(b=g);else if(P.match(/^%LP|^G/)){for(y=g;y>0&&!m[y-1];)y--;m.splice(y,0,d),p=m.join(`
`);break}}}return p}addFPCDocument(t,e,r,i){let n=this.getFpcDocumentNamePair(t,e,r,i),s=this.fpcDocumentMap[n];return s||(s=new M_(t),this.generateHeader(t,s),this.fpcDocumentMap[n]=s,this.fpcDocumentMap[n].setFormatter(this.formatter),this.fpcLayerNameMap[n]={layerId:t,material:e,thickness:r,model:i},s.setTargetAsBody()),s}getFpcDocumentNamePair(t,e,r,i){let n="",s=t==58,a={Polyimide:"pi",FR4:"fr4","Stainless Steel":"gp",Tape:"ps","EMI Shielding Film":s?"csa":"ssa"},l={"3M468":"3m468","3M9077":"3m9077",TESA8854:"tesa8854"};return s?n="TopStiffenerLayer_"+a[e]+(e=="EMI Shielding Film"?"":"t")+"_"+(l[i]||r):n="BottomStiffenerLayer_"+a[e]+(e=="EMI Shielding Film"?"":"b")+"_"+(l[i]||r),n}init(t){let{data:e,defaultParam:r,drillDrawingLayerSymbol:i,colorSilkMark:n,isImportedPCBDoc:s}=t,{fileUuid:a,userUuid:l,ignoreHash:c,unit:h,format:u,drillMap:d,layerConfigs:p,objectConfigs:m,mainVersion:g,useOldBool:y,origin:b,type:P}=e;this.isImportedPCBDoc=s,this.released=!0,this.mainVersion=g,this.drillDrawingLayerSymbol=i,this.colorSilkMark=n,this.fileUuid=a,this.userUuid=l,this.ignoreHash=c||!1,this.drillMap=d,this.isOneClick=P,h&&(this.unit=h),u&&(this.integerPlaces=+u.Integer,this.decimalPlaces=+u.Decimals);let T;p&&(T=p.map(C=>C.layerId),this.layerConfigs=p,this.layerIds=T),this.objectConfigs=m,this.defaultParam=r,this.useOldBool=y,this.origin=b;let I=new S(0,0).sub(this.origin);if(this.originOffset=I,this.generateElementOffsets=[I],!r.onlyOutline&&r.success){let{column:C,row:E,offset:O}=r;if(O=O||new S(0,0),this.stepRepeatConfig={column:C,row:E,stepX:O.x,stepY:O.y},!this.quickPanelizeEnabled){let _=[];for(let R=0;R<E;R++)for(let v=0;v<C;v++){let D=new S(O.x*v,O.y*R);D=D.add(I),_.push(D)}this.generateElementOffsets=_}}}createDocumentTextMap(){let t={},e=new Vq;e.leftLength=this.integerPlaces,e.rightLength=this.decimalPlaces,e.unit=this.unit,this.copperInfoMap&&this.updateCopperComment();for(let a of this.layerIds){let l=this.getGerberLayerDocument(a);if(l&&(this.elementUsedLayerMap[a]||this.isMustExportLayer(a))){let c=l.exportText(e);a!=56&&(c=this.addHashApertureToGerber(c)),t[a]=c}}let r=Object.keys(this.fpcDocumentMap);for(let a of r){let l=this.fpcDocumentMap[a];if(l){let c=l.exportText(e);c=this.addHashApertureToGerber(c),t[a]=c}}let i=Object.keys(this.colorSilkMarkDocumentMap);for(let a of i){let l=this.colorSilkMarkDocumentMap[a];if(l){let c=l.exportText(e);c=this.addHashApertureToGerber(c),t[a]=c}}let n=Object.keys(this.drillDocumentMap),s=this.drillMap;for(let a of n){let l=this.drillDocumentMap[a];if(!l||(l.unit=this.unit,l.holesCount<1))continue;if(this.defaultParam.success&&this.quickPanelizeEnabled){let m=this.defaultParam.offset||new S(0,0),g=this.defaultParam.row,y=this.defaultParam.column,b=this.defaultParam.onlyOutline;l.panelizeParam={offset:m,row:g,column:y,onlyOutline:b}}l.isMirror=this.getLayerIsMirror(1)&&this.getLayerIsMirror(2);let c,h,u=s&&s.includes("PTH"),d=s&&s.includes("NPTH"),p=l.isThroughVia;c=a!="NPTH",h=a=="NPTH"||a=="PTH"||a=="PTH_Via"?"":a,s&&(!u||!d)?u?a!="NPTH"&&(this.createDrillHeaderComments(l,c,h,p),t[a]=l.exportText(e)):d&&a=="NPTH"&&(this.createDrillHeaderComments(l,c,h,p),t[a]=l.exportText(e)):(this.createDrillHeaderComments(l,c,h,p),t[a]=l.exportText(e))}return t}async exportTextFast(){return this.generateColorSilkLocationHoleFast(),this.drillTableData&&this.generateDrillTable(this.drillTableData),this.createDocumentTextMap()}async exportText(t){return this.init(t),this.prepareGerberDocuments(),this.progressUpdate(.25),await hY(50),this.createPanelize(),this.generateElementAll(),this.closeStepRepeatParameter(),this.progressUpdate(.75),await hY(50),this.createDocumentTextMap()}};Hq.version="0.3";var jle=Hq;var pYe=rze?"https://prodocs.lceda.cn/cn/pcb/order-order-pcb/index.html":"https://prodocs.easyeda.com/en/pcb/order-order-pcb/index.html",Axt={name:"How-to-order-PCB.txt",content:`How to Order PCB

Please refer to:
${pYe}`},_xt={name:"PCB\u4E0B\u5355\u5FC5\u8BFB.txt",content:`\u5982\u4F55\u8FDB\u884CPCB\u4E0B\u5355

\u8BF7\u67E5\u770B\uFF1A
${pYe}`};function Xle(o){return G2(o)?"Fabrication_ColorfulTopSilkscreen.FCTS":"Fabrication_ColorfulBottomSilkscreen.FCBS"}function fYe(o){let t=new Date,e=t.getFullYear(),r=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),n=`${e}-${r}-${i}`;return`Gerber_${(o||"PCB").replace(/[^\w\u0082-\ufffc]+/g," ").replace(/\s\s+/g," ").trim().replace(/\s/g,"_")}_${n}.zip`}function mYe(){return CYe()}async function gYe(o){let t=await e3e(1),e=await e3e(0),r=await t.encrypt(e.getKey()),i=await t.encrypt(e.getIV()),n=await e.encrypt(o);return Ale([r,i,n])}var qle=class{constructor(){this.files={};this.transfer=[]}get workerURL(){return`editor?entry=pcb-zip-worker.js${$().location.search.replace(/\?/,"&")}`}generateAsync(t,e){return new Promise((r,i)=>{let n=a=>{let l=typeof a=="string"?a:(a==null?void 0:a.message)||"Failed to generate zip file.";ie.messageBus.publish("message",{type:"error",message:l}),i(l)},s=new _le(this.workerURL,{name:"pcb-zip-worker"});s.onmessage=a=>{s.terminate();let{err:l,blob:c}=a.data||{};c?r(c):n(l)},s.onerror=()=>{s.terminate(),n()},s.postMessage({zippable:t,level:e},this.transfer)})}};function yYe(...[o]){return TG(o).then(t=>{if(!t)return;let e=t.fileName;return s2?NC(t.blob,e,"zip"):ip.downloadFile(e,t.blob),t},t=>{debugger;throw t})}async function bYe(o){let t="generateGerber-time";pn(t),o=await IYe(o);let{title:e,language:r,fileName:i,silk:n,unUseWorkerZip:s}=o,l=o.isTestExport&&o.exportConfig?new _q:null,c={...ai.getInstance().getDefaultPanelize(),outerBBox:ai.getInstance().outerBBox,singleBBox:ai.getInstance().singleBBox,offset:ai.getInstance().offset},h=n?mYe():[],u=TYe(),d={data:o,defaultParam:c,colorSilkMark:h,isImportedPCBDoc:u},p=new jle;p.init(d),p.prepareGerberDocuments();let m=N=>o.objectConfigs.includes(N),g=new Rq(o),y,b,P,T,I,C,E,O,_,R,v,D,w,F,H=!0;y||(y=g.getPanelize()),(y.length||H&&c.success)&&(p.createPanelizeFast(y),p.autoCommentEndAllLayer("Panelize")),b||(b=g.getCopper()),b.length&&(p.generateCopperFast(b),p.autoCommentEndAllLayer("Copper")),P||(P=g.getPlaneZone()),P.length&&(p.generatePlaneZoneFast(P),p.autoCommentEndAllLayer("PlaneZone")),T||(T=g.getImage()),T.length&&(p.generateImageFast(T),p.autoCommentEndAllLayer("Image")),C||(C=g.getText()),C.length&&(p.generateTextFast(C),p.autoCommentEndAllLayer("Text")),E||(E=g.getPolygon()),E.length&&(p.generatePolygonFast(E),p.autoCommentEndAllLayer("Polygon")),O||(O=g.getRect()),O.length&&(p.generateRectFast(O),p.autoCommentEndAllLayer("Rect")),_||(_=g.getCircle()),_.length&&(p.generateCircleFast(_),p.autoCommentEndAllLayer("Circle")),R||(R=g.getDimension()),R.length&&(p.generateDimensionFast(R),p.autoCommentEndAllLayer("Dimension")),v||(v=g.getTearDrop()),v.length&&(p.generateTearDropFast(v),p.autoCommentEndAllLayer("TearDrop")),D||(D=g.getPad()),D.length&&(p.generatePadFast(D),p.autoCommentEndAllLayer("Pad")),w||(w=g.getVia()),w.length&&(p.generateViaFast(w),p.autoCommentEndAllLayer("Via")),F||(F=g.getTrack()),F.length&&(p.generateTrackFast(F),p.autoCommentEndAllLayer("Track")),I||(I=g.getDrillDrawing()),I.length&&(p.generateDrillImageFast(I),p.autoCommentEndAllLayer("Drill Drawing"));let z=await p.exportTextFast();if(!z)throw new Error("export gerber failed");let{drillLayerMap:G,fpcLayerNameMap:W}=p,L={};for(let N in z)if(Object.prototype.hasOwnProperty.call(z,N)){let U=z[N],k,V=+N,Y,X=!1;if(N=="PTH"||N=="NPTH")k=q5(N),X=!0,Y=U5(1,2,N==="PTH",!0,!1);else if(N=="PTH_Via")k=q5("PTH",void 0,!0);else if(N=="CSM")k=r3e(),Y=k;else if(isNaN(V)&&!N.includes("StiffenerLayer")){k=q5("PTH",N);let Z=G[N];X=!0,Z&&(Y=U5(Z[0],Z[1],!0,!0,!0))}else if(isNaN(V)&&N.includes("StiffenerLayer")){k=t3e(N);let Z=W[N];Z&&(Y=uq(Z.layerId,Z.material,Z.thickness,Z.model))}else k=i3e(V),Y=k;l&&Y&&l.addLayersId(k,isNaN(V)?void 0:V,Y,X),L[k]=typeof U=="string"?Tb(U):U}if(o.flyingProbe!=!1){let N=o3e,{fileContent:U}=await Dq();L[N]=Tb(U)}if(n){let N="generateColorSilkFiles-time";pn(N);let k=new Oq().generate(c,h);for(let V in k){let Y=V;if(Object.prototype.hasOwnProperty.call(k,V)){let X=k[Y],Z;if(V=="TOPSILK"?Z=Xle(3):V=="BOTTOMSILK"?Z=Xle(4):V=="BOARDOUTLINE"&&(Z="Fabrication_ColorfulBoardOutlineLayer.FCBO"),Sa.generateGerberUnEncryption){Z=Z.replace(/\.(.+)$/,".svg"),L[Z]=Tb(X);continue}let Q=await gYe(X);L[Z]=new Uint8Array(Q)}}Bi(N)}l&&(l.setUnit(o.unit),l.setFormate(o.format.Integer,o.format.Decimals),ip.downloadFileASCII(i.replace(".zip",".json"),l.exportText()));let B;try{if(s){let k=Bq(L,{level:6});B=new Blob([k],{type:"application/zip"})}else B=await new qle().generateAsync(L,6);i&&!i.toLowerCase().endsWith(".zip")&&(i="");let U=i||fYe(e);console.log(`zip file is generated: ${U} [${B.size} bytes]`),o.fileName=U}catch{return}return Bi(t),B?{...o,blob:B}:null}function PYe(...[o]){let{needDownLoad:t}=o;return TG(o).then(async e=>{if(!e)return;let{fileName:r,blob:i}=e,n=r;Eze()&&t&&(s2?NC(i,n,"zip"):ip.downloadFile(n,i));let s=await MC(i);return{fileInfo:o,data:s.data,error:null}},e=>{debugger;throw e})}function vxt(o){let t;o?t=new Worker(o):t=new Worker(`editor?entry=pcb-decode-worker.js${$().location.search.replace(/\?/,"&")}`,{name:"pcb-decode-worker"});let e=new dYe.WorkerMessageBridge(ie.messageBus,t);return{worker:t,messageBus:e}}function TYe(){let o=/^ie\d+$/,t=0;return Cr.iteratorBreakable(e=>{if(o.test(e.globalIndex)&&(t++,t>=1))return!1}),t>=1}async function TG(o){var w,F;let t="generateGerber-time";pn(t),o=await IYe(o);let{title:e,language:r,fileName:i,silk:n,workerJsUrl:s,unUseWorkerZip:a,drillTable:l}=o,c;if(l&&!SYe()){let H=Wq();if(H){let z=H.UR(),G=Xs.conversion("mm","mil",20)/10,W=z.add(new S(G,0)),L=sq();c=new zV(L,56).getStackTableModel(W)}}let u=o.isTestExport&&o.exportConfig?new _q:null,d={...ai.getInstance().getDefaultPanelize(),outerBBox:ai.getInstance().outerBBox,singleBBox:ai.getInstance().singleBBox,offset:ai.getInstance().offset},p=n?mYe():[],m=TYe(),g={data:o,defaultParam:d,colorSilkMark:p,isImportedPCBDoc:m},{worker:y,messageBus:b}=vxt(s);ie.messageBus.subscribe("cancelExportGerber",()=>{y.terminate()});let P;try{let H=12e5,z=await b.rpcCall("pcb/worker/exportGerber/init",{...g},H);if(g=null,!z||!z.message||z.message.error)throw((w=z==null?void 0:z.message)==null?void 0:w.error)||"init fail";let G=Se=>o.objectConfigs.includes(Se),W=new Rq(o),L=x.getInstance(),B=new Rle("2.0",L.doctype),N,U,k,V,Y,X,Z,Q,ae,he,re,se,K,me,Oe,Ie=0,ue=!1,Pe=1e4,j=(Se,De=Pe)=>Se.splice(0,De),J=!0,oe=new D3;xxt(oe);let pe=.25;for(;!ue;){if(Ie++>5e4)throw new Error("endless callback when export gerber");let Se=!1,De=[];if(!Se&&(N||(N=W.getPanelize()),N.length||J&&d.success)){Se=!0,J=!1;let tt=j(N),Ze=!N.length;De.push({label:"Panelize",type:"Panelize",dataArr:tt,end:Ze})}if(!Se&&(U||(U=W.getCopper()),U.length)){Se=!0;let tt=j(U),Ze=!U.length;De.push({label:"Copper",type:"Copper",dataArr:tt,end:Ze})}if(!Se&&(k||(k=W.getPlaneZone()),k.length)){Se=!0;let tt=j(k),Ze=!k.length;De.push({label:"PlaneZone",type:"PlaneZone",dataArr:tt,end:Ze})}if(!Se&&(V||(V=W.getImage()),V.length)){Se=!0;let tt=j(V,100),Ze=!V.length;De.push({label:"Image",type:"Image",dataArr:tt,end:Ze})}if(!Se&&(Z||(Z=W.getText()),Z.length)){Se=!0;let tt=j(Z),Ze=!Z.length;De.push({label:"Text",type:"Text",dataArr:tt,end:Ze})}if(!Se&&(Q||(Q=W.getPolygon()),Q.length)){Se=!0;let tt=j(Q),Ze=!Q.length;De.push({label:"Polygon",type:"Polygon",dataArr:tt,end:Ze})}if(!Se&&(ae||(ae=W.getRect()),ae.length)){Se=!0;let tt=j(ae),Ze=!ae.length;De.push({label:"Rect",type:"Rect",dataArr:tt,end:Ze})}if(!Se&&(he||(he=W.getCircle()),he.length)){Se=!0;let tt=j(he),Ze=!he.length;De.push({label:"Circle",type:"Circle",dataArr:tt,end:Ze})}if(!Se&&(re||(re=W.getDimension()),re.length)){Se=!0;let tt=j(re),Ze=!re.length;De.push({label:"Dimension",type:"Length Dimension",dataArr:tt,end:Ze})}if(!Se&&(se||(se=W.getTearDrop()),se.length)){Se=!0;let tt=j(se),Ze=!se.length;De.push({label:"TearDrop",type:"TearDrop",dataArr:tt,end:Ze})}if(!Se&&(K||(K=W.getPad()),K.length)){Se=!0;let tt=j(K),Ze=!K.length;De.push({label:"Pad",type:"Pad",dataArr:tt,end:Ze})}if(!Se&&(me||(me=W.getVia()),me.length)){Se=!0;let tt=j(me),Ze=!me.length;De.push({label:"Via",type:"Via",dataArr:tt,end:Ze})}if(!Se&&(Oe||(Oe=W.getTrack()),Oe.length)){Se=!0;let tt=j(Oe),Ze=!Oe.length;De.push({label:"Track",type:"Track",dataArr:tt,end:Ze})}if(!Se&&(Y||(Y=W.getDrillDrawing()),Y.length)){Se=!0;let tt=j(Y),Ze=!Y.length;De.push({label:"Drill Drawing",type:"DrillDrawing",dataArr:tt,end:Ze})}if(!Se&&(X||c&&(X=[W.getDrillTable(c)]),X!=null&&X.length)){Se=!0;let tt=j(X),Ze=!X.length;De.push({label:"Drill Table",type:"DrillTable",dataArr:tt,end:Ze})}if(Se&&De.length){let tt={tasks:De},Ze=await b.rpcCall("pcb/worker/exportGerber/addTask",tt,H);if(!((F=Ze==null?void 0:Ze.message)!=null&&F.success))throw new Error("export gerber failed");oe.updateProgress(pe+=.05),console.log("## taskItemsCounter #"+Ie)}else{ue=!0;break}}let ge=await b.rpcCall("pcb/worker/exportGerber/getFullText",null,H);if(!ge||!ge.message)throw new Error("export gerber failed");P=ge.message}catch(H){debugger;throw H}finally{y.terminate()}let{gerberTextData:T}=P;if(!T)throw new Error("export gerber failed");let{textMap:I,drillLayerMap:C,fpcLayerNameMap:E}=T,O={};for(let H in I)if(Object.prototype.hasOwnProperty.call(I,H)){let z=I[H],G,W=+H,L,B=!1;if(H=="PTH"||H=="NPTH")G=q5(H),B=!0,L=U5(1,2,H==="PTH",!0,!1);else if(H=="PTH_Via")G=q5("PTH",void 0,!0);else if(H=="CSM")G=r3e(),L=G;else if(isNaN(W)&&!H.includes("StiffenerLayer")){G=q5("PTH",H);let N=C[H];B=!0,N&&(L=U5(N[0],N[1],!0,!0,!0))}else if(isNaN(W)&&H.includes("StiffenerLayer")){G=t3e(H);let N=E[H];N&&(L=uq(N.layerId,N.material,N.thickness,N.model))}else G=i3e(W),L=G;u&&L&&u.addLayersId(G,isNaN(W)?void 0:W,L,B),O[G]=typeof z=="string"?Tb(z):z}if(o.flyingProbe!=!1){let H=o3e,{fileContent:z}=await Dq();O[H]=Tb(z)}if(n){let H="generateColorSilkFiles-time";pn(H);let G=new Oq().generate(d,p);for(let W in G){let L=W;if(Object.prototype.hasOwnProperty.call(G,W)){let B=G[L],N;if(W=="TOPSILK"?N=Xle(3):W=="BOTTOMSILK"?N=Xle(4):W=="BOARDOUTLINE"&&(N="Fabrication_ColorfulBoardOutlineLayer.FCBO"),Sa.generateGerberUnEncryption){N=N.replace(/\.(.+)$/,".svg"),O[N]=Tb(B);continue}let U=await gYe(B);O[N]=new Uint8Array(U)}}Bi(H)}let R=(r||"zh-cn").match(/^zh-/)?_xt:Axt;O[R.name]=Tb(R.content);let v=Rxt(o);v&&(O[v.fileName]=Tb(v.config)),u&&(u.setUnit(o.unit),u.setFormate(o.format.Integer,o.format.Decimals),ip.downloadFileASCII(i.replace(".zip",".json"),u.exportText()));let D;try{if(a){let G=Bq(O,{level:6});D=new Blob([G],{type:"application/zip"})}else D=await new qle().generateAsync(O,6);i&&!i.toLowerCase().endsWith(".zip")&&(i="");let z=i||fYe(e);console.log(`zip file is generated: ${z} [${D.size} bytes]`),o.fileName=z}catch{return}return Bi(t),D?{...o,blob:D}:null}function xxt(o){o.reset(),o.onProgress(t=>{ie.publish("progressUpdate",[t,"Export Gerber..."],$())})}async function IYe(o){var b;o||(o={});let{title:t,fileUuid:e,userUuid:r,language:i,fileName:n,unit:s,format:a,silk:l,drillMap:c,drillTable:h,flyingProbe:u,layerConfigs:d,objectConfigs:p,mainVersion:m,isTestExport:g}=o;if(!t){let P=x.getInstance().name;o.title=`Gerber_${P}_${H5(new Date,"yyyy-MM-dd")}.zip`}if(!n){let P=x.getInstance().name;o.fileName=`Gerber_${P}_${H5(new Date,"yyyy-MM-dd")}.zip`}a||(o.format={Integer:2,Decimals:6}),l==null&&(o.silk=!1);let y=(await ie.messageBus.rpcCall("gerberLayerConfig")).message;if(h!==!1){let P=be.getLayer(56);if(P)y.push({layerId:P.layerID,layerName:P.name,layerType:P.type,status:P.layerStatus});else{console.warn("generateGerber: cannot get drillLayer");debugger}}if(u!==!1&&(u=!0),d)for(let P of d){if(P.layerId==56){let I=be.getLayer(56);y.push({layerId:I.layerID,layerName:I.name,layerType:I.type,status:I.layerStatus})}let T=y.find(I=>I.layerId==P.layerId);if(T){let{layerName:I,layerType:C}=T;Object.assign(P,{layerName:I,layerType:C})}else throw new Error("unknown layerId: "+P.layerId)}else{o.layerConfigs=[];for(let P of y){let{layerId:T,layerName:I,layerType:C,status:E}=P;E!==0&&o.layerConfigs.push({layerId:T,layerName:I,layerType:C,isMirror:!1})}}if(o.layerConfigs=o.layerConfigs.filter(P=>{var T;return(T=$e.getInstance().getLayer(P.layerId))==null?void 0:T.config}),c||(o.drillMap=["PTH","NPTH"]),h==null&&(o.drillTable=!0),!p){o.objectConfigs=[];for(let P of MEe)o.objectConfigs.push(P.value)}return m||(o.mainVersion=((b=document.querySelector('meta[name="editorMainVersion"]'))==null?void 0:b.getAttribute("content"))||""),s||(o.unit="MM"),g==null&&(o.isTestExport=!1),g&&await vp.loadTextSuccess(),o.origin=x.getInstance().origin,o}async function MC(o){return new Promise((t,e)=>{let r=new FileReader;r.onload=i=>{t({data:r.result,error:null})},r.onerror=i=>{t({data:null,error:i})},r.readAsArrayBuffer(o)})}function Rxt(o){let t=Dxt(o);return _ze.getConfig({stiffeners:t})}function Dxt(o){let{layerConfigs:t,objectConfigs:e}=o,r=[];return o.type==="oneKeyExport"?r=[58,59]:e.includes("FPCStiffener")&&(r=t.filter(n=>_c(n.layerId)).map(n=>n.layerId)),ZS().filter(n=>n.type==="FPC Stiffener"&&r.includes(n.layerId))}var zq=null,$le;function OYe(o,t){if($le){$le[o]=String(t);return}try{localStorage.setItem(o,t)}catch{$le={},$le[o]=String(t)}}function D3e(){return _o.getAllItem().length}function AYe(){let o=D3e(),t=we.topSilkscreenColor!=="#000000"||we.bottomSilkscreenColor!=="#000000"||we.topBoardColor!=="#FFFFFF"||we.bottomBoardColor!=="#FFFFFF",e=rn.getInstance().getAllItem(),r=Mi.getInstance().getAllItem(),i=zi.getInstance().getAllItem(),n=Sl.getInstance().getAllItem(),s=Za.getInstance().getAllItem(),a=Ka.getInstance().getAllItem(),l=mo.getInstance().getAllItem(),c=Qs.getInstance().getAllItem(),h=xs.getInstance().getAllItem(),u=[].concat(e,r,i,n,s,a,l,c),d=ee.of3("#000000"),p=u.some(g=>(3==g.layerId||4==g.layerId)&&g.getParent()==null&&g.silkColor!=null&&g.silkColor!=d),m=h.some(g=>g.silkColor!=null&&g.silkColor!=d);return o||t||p||m}function _Ye(){return ce.pcbConfig.checkNetBeforeGerber?(OYe("checkRatlineNotShowAgain",""),zo.getAllItem().length>0):!1}function vYe(){let o=Xt.getAllItem(),t=Zt.getAllItem(),e=pt.getAllItem();return[].concat(o,t,e).some(i=>U2(i.layerId))}function xYe(){let o=ce.pcbConfig.checkDrcBeforeGerber;return o&&OYe("checkDrcNotShowAgain",""),o}function RYe(o){let{allItemBbox:t,outOfBoardBBoxItems:e}=wYe(),r={isQualified:!1,outOfArr:[],format:{Integer:"3",Decimals:"3"}},i=JSON.parse(JSON.stringify(t)),n=new S(0,0).sub(x.getInstance().origin);if(t!=null){if(o.type=="oneKeyExport"){let s=Math.max(Math.abs(t.maxX*.254),Math.abs(t.minX*.254)),a=Math.max(Math.abs(t.maxY*.254),Math.abs(t.minY*.254));Math.max(s,a)>1e3?(r.format={Decimals:"2",Integer:"4"},o.format=r.format):r.format=o.format}else r.format=o.format;if(e!=null&&e.length){zq={};for(let s of e)r.outOfArr.push(s.globalIndex),zq[s.globalIndex]=s}else zq=null;for(let s in i){switch(s){case"maxX":case"minX":i[s]=i[s]+n.x;break;case"maxY":case"minY":i[s]=i[s]+n.y;break}if(o.unit=="IN"){if(r.isQualified=EYe(i[s]/100,o.format),(o.format.Integer<2||o.format.Decimals<2)&&(r.isQualified=!1),!r.isQualified)return r}else if(o.unit=="MM"&&(r.isQualified=EYe(i[s]*.254,o.format),o.format.Integer<=2&&(r.isQualified=!1),!r.isQualified))return r}}else o.format&&Object.assign(r.format,o.format),r.isQualified=!0;return r}function DYe(o){let e=Wq().LR(),r=new ve("Gerber Out Of Item Translate"),i=new S(0,0);for(let n of o){let s=zq[n];i=e.sub(s.buildBBox().UL());let a=Ae.translate(i.x,i.y,0);r.addCommand(Te.dispatch(s,"modify")),zq[n].transform(a),ie.publish("hasModifyPcbItem",s)}r.length>0&&(je.executeCommand(r),ie.publish("flushService",""))}function EYe(o,t){let e=+("1e-"+(t.Decimals+1));o>-e&&o<e&&(o=0);let r=(o+1e-12).toFixed(t.Decimals);if(!1&&r.length<=t.Integer+t.Decimals)return r.startsWith("0.")?r=r.slice(1):r.startsWith("-0.")&&(r="-"+r.slice(2)),!0;let[n="",s=""]=r.split(".");return n=(n.startsWith("-")?"-":"")?n.slice(1):n,!(n.length>t.Integer)}var Xq=nd(Lb());function w3e(o,t){if(o instanceof q){let r=o.center,i=o.start().sub(r).normalize(),n=o.isCCW;t.sort((s,a)=>{let l=s.point.sub(r),c=a.point.sub(r);return e(i,l,n)-e(i,c,n)<=0?-1:1})}else if(o instanceof M){let r=o.start(),i=o.end(),n=new S(i.x+(r.x-i.x)*2,i.y+(r.y-i.y)*2);t.sort((s,a)=>s.point.distance2(n)-a.point.distance2(n)<=0?-1:1)}else if(o instanceof Mr)t.sort((r,i)=>o.getPercent(r.point)-o.getPercent(i.point)<=0?-1:1);else throw Error("not support the primitive type");function e(r,i,n){let s=r.cross(i)>0,a=Math.acos(Math.min(1,Math.max(-1,r.dot(i)/i.length())));return(n?!s:s)&&(a=u8e-a),a}}function L3e(o){if(!o.length)return 0;let t=o[0].length;for(let e=1;e<o.length;e++){let r=o[e].length;r>t&&(t=r)}return t}function Yq(o,t){let e=[],r=[];return o.getBezierPoints(t,i=>{if(!e.length){e.push(i);return}let n=e.pop();r.push(new M(n,i)),e.push(i)}),e.length=0,r}function Mc(o,t){if(o instanceof M)return o.direct.normalize();if(o instanceof q){let e=t.angle(o.center);return o.isCCW?e+=jIe:e-=jIe,new S(Math.cos(e),Math.sin(e)).normalize()}else throw new Error("not support")}function N_(o,t){return new S((o.x+t.x)/2,(o.y+t.y)/2)}function Ga(o,t,e=0){if(t.x===0&&t.y===0)throw Error("getEndOfExtendLine(line: Line, distance: number)");let r={x:t.normalize().x*e,y:t.normalize().y*e};return new S(o.x+r.x,o.y+r.y)}function NYe(o,t,e){if(o instanceof M||t.equals1(e))return new M(t,e);if(o instanceof q)return q.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?le.CCW:le.CW);if(o instanceof Mr){let r=o.getPercent(t),i=o.getPercent(e);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function kYe(o,t){if(o.layerId!==t.layerId)return;let e=o.primitive,r=t.primitive,i=e.length(),n=r.length(),s=o.width,a=t.width;if(qIe(e,r)&&i>n&&n>a&&s>n&&s>a)return!0;let c=o.getMathGraphics(o.layerId);if(!zf(t.start,o)||p(t.start,c)<t.width/2||zf(t.end,o))return!1;return p(t.end,c)>=t.width/2;function p(m,g){return g.primitives.reduce((y,b)=>{if(b instanceof M){let P=ir.foot(b,m);if(b.start().sub(P).dot(b.end().sub(P))>0)return;let T=b.distance(m);return T<y?T:y}else if(b instanceof q){let P=b.start(),T=b.end(),I=b.center;if(P.sub(I).cross(m.sub(I))*T.sub(I).cross(m.sub(I))>0)return;let C=Math.abs(b.rx-m.distance1(b.center));return C<y?C:y}else throw new Error("not support")},1/0)}}function zf(o,t){let e=t.primitive;if(e.distance(o)>t.width/2)return!1;let i=ir.foot(e,o);return e.start().sub(i).dot(e.end().sub(i))<=0?!0:Math.min(o.distance1(e.start()),o.distance1(e.end()))<=t.width/2}function K5(o,t){return!!t.getWindingNum(o)}function BYe(o,t){let e=o.layerId,r=o.getMathGraphics(e),i=t.getMathGraphics(e),n=r.bbox(),s=i.bbox();if(n.isContainsBBox(s)||s.isContainsBBox(n))return!0;let a=Mc(o.primitive,o.start).dot(Mc(t.primitive,t.start));return a>0?!(o.end.equals1(t.start)||t.end.equals1(o.start)):ne.eq(a,0)?!(o.start.equals1(t.start)||o.start.equals1(t.end)||o.end.equals1(t.start)||o.end.equals1(t.end)):!(o.start.equals1(t.start)||o.end.equals1(t.end))}function LYe(o,t){let r=o.dot(t)/(o.length()*t.length());return Math.acos(r)}function M3e(o,t,e){let r=e?t.start:t.end,i=t.width/2;return ne.lesseq(o.start.distance1(r),i)?-1:ne.lesseq(o.end.distance1(r),i)?1:0}function N3e(o,t,e){let r=t.angleD(o.center),i=e.angleD(o.center);if(r===i)return e;o.sweep()===le.CCW?i<=r&&(i+=360):i>=r&&(r+=360);let n=i-r,s;if(ne.eq(n,180)){let a=t.sub(o.center);s=o.isCCW?new S(-a.y,a.x):new S(a.y,-a.x)}else if(n>180){let a=N_(t,e);s=o.center.sub(a)}else s=N_(t,e).sub(o.center);return Ga(o.center,s,o.rx)}function k3e(o,t){return ne.eq(o.x,t.x)&&ne.eq(o.y,t.y)}function Kle(o){return ne.eq(o,1)?1:ne.eq(o,-1)?-1:ne.eq(o,0)?0:o}function B3e(o){return o.length>=o.width}function F3e(o,t,e=le.CW){let{point:r,refPt:i}=o,{point:n,refPt:s}=t,a;if(s instanceof M)a=s.distance(r);else if(s instanceof q)a=new M(s.center,n).distance(r);else throw new Error("not support");if(ne.eq(a,0))return new M(r,n);let l;if(i instanceof M)l=i.distance(n);else if(i instanceof q)l=new M(i.center,r).distance(n);else throw new Error("not support");if(ne.eq(l,0))return new M(r,n);let c=N_(r,n);if(a>l){let h=n.sub(r),u=Mc(i,r),d=new S(-u.y,u.x);d.dot(h)<0&&(d=new S(-d.x,-d.y));let p=LYe(h,d);if(ne.eq(p,Math.PI/2))return new M(r,n);let m=r.distance1(c)/Math.cos(p);return q.build1(r,n,m,m,!1,e)}else{let h=r.sub(n),u=Mc(s,n),d=new S(u.y,-u.x);d.dot(h)<0&&(d=new S(-d.x,-d.y));let p=LYe(h,d);if(ne.eq(p,Math.PI/2))return new M(r,n);let m=n.distance1(c)/Math.cos(p);return q.build1(r,n,m,m,!1,e)}}function jq(o,t){let e=o.primitive;return MYe(e.distance(t.start),0,.1)&&MYe(e.distance(t.end),0,.1)}function MYe(o,t,e=ne.eps){return Math.abs(o-t)<=e}function Zle(o,t){let e=t.start();return o.reduce((i,n)=>{let s=n.distance2(e);return s<i.nearDis?{nearPoint:n,nearDis:s}:i},{nearPoint:null,nearDis:1/0}).nearPoint}function IG(o,t){return o.length===1?o[0]:o.reduce((e,r)=>{let i=r.distance2(t);return i<e.nearDis?{nearPoint:r,nearDis:i}:e},{nearPoint:null,nearDis:1/0}).nearPoint}function FYe(o,t){let e=o.center.distance1(t),r=Math.sqrt(e**2-o.rx2),i=Math.asin(o.rx/e),n=o.center.rotate(t,i).sub(t),s=o.center.rotate(t,-i).sub(t);return[Ga(t,n,r),Ga(t,s,r)]}function EP(o,t,e){let r=o.getMathGraphics(t,e);if(!r)return null;let i=r.primitives.filter(s=>!n(s));return fe.build7(i);function n(s){if(s instanceof M)return s.direct.x===0&&s.direct.y===0||s.start().equals1(s.end());if(s instanceof q)return s.sweepAngle===0;if(s instanceof Mr){let a=new Set(s.controls.map(c=>c.x)),l=new Set(s.controls.map(c=>c.y));return a.size===1&&l.size===1}else throw new Error("not support")}}function V3e(o){let t=new _e;o.forEach(i=>{t.ext1(i.bbox())});let e=t.build();return Math.max(e.width(),e.height())}var OP;/\btearDebug\b/.test(location.search)&&(typeof window<"u"?OP=window._MSG_BUS_=window._MSG_BUS_||new Xq.MessageBus:OP=new Xq.WorkerMessageBridge(new Xq.MessageBus,self));var G3e="-",VYe=.001,Jle=class{constructor(t){this._Switch=!1;this.hideProgress=!1;this.ratio=0;this.delta=0;this.ttConnectIds={};this.tStartAndEndIds=new Map;this.padViaIds={};this.isInvalidTracks={};OP&&(this.drawDebug=new Ko(OP)),this.Switch=!0,this.operationType=t.operationType,this.applyScope=t.applyScope,this.tearShape=t.tearShape,this.ignoreDRC=t.ignoreDRC,this.hideProgress=t.hideProgress,this.circlePadViaChecked=t.circlePadViaChecked,this.roundWidth=t.roundWidth,this.roundeHeight=t.roundeHeight,this.specialShapedPadChecked=t.specialShapedPadChecked,this.otherWidth=t.otherWidth,this.otherHeight=t.otherHeight,this.routingChecked=t.routingChecked,this.routingWidth=t.routingWidth,this.routingHeight=t.routingHeight,this.TConnectionChecked=t.TConnectionChecked,this.TConnectionWidth=t.TConnectionWidth,this.TConnectionHeight=t.TConnectionHeight,this.ids=t.ids,this.subscribe()}get Switch(){return this._Switch}set Switch(t){this._Switch=t}subscribe(){}addTearDrop(){this.updateProgress2(1),this.updateProgress2(0);let t="addTearDrop-time";pn(t),this.delta=1/this.ids.length;let e=[];for(let r=0,i=this.ids.length,n=Math.ceil(i/10);r<i;r++){let s=pc(this.ids[r]);if(s instanceof Oi){if(!this.circlePadViaChecked&&!this.specialShapedPadChecked)continue;let a=s.buildBBox(),l=s.layerId,c=(u,d)=>{if(d=="Pad"||d=="Via")return l==12||u==12?!0:u==l};this.map.search(a,c).filter(u=>!(u instanceof It||u instanceof Je)||u instanceof It&&!u.isContains(l)?!1:u.net===s.net).forEach(u=>{this.isInvalidTrack(s)||this.isExistPadVia(u.globalIndex,s.globalIndex)||!EP(u,s.layerId,0)||(this.recordId(s,u),this.pushTearArrToContainer(u,s,e))})}else if(s instanceof qr){if(!this.routingChecked&&!this.TConnectionChecked||this.isInvalidTrack(s))continue;if(!B3e(s)){this.setTrackIsInvalid(s);continue}if(this.isExistTrack2End(s.globalIndex,!0)&&this.isExistTrack2End(s.globalIndex,!1))continue;let a=s,l=a.buildBBox(),c=a.layerId,h=(d,p)=>{if(p=="Pad"||p=="Track"||p=="ArcTrack"||p=="Via")return d==12?!0:d==c},u=this.map.search(l,h).filter(d=>d instanceof It?d.isContains(c):d instanceof yt?B3e(d):!0);u&&u.length&&this.getNode(a,u).forEach(p=>{this.recordId(a,p),this.pushTearArrToContainer(p,a,e)})}else if(s instanceof It||s instanceof Je){if(!this.circlePadViaChecked&&!this.specialShapedPadChecked)continue;let a=s.buildBBox(),l=s.layerId,c=(u,d)=>{if(d=="Track"||d=="ArcTrack")return l==12||u==12?!0:u==l};this.map.search(a,c).filter(u=>!(u instanceof qr||u instanceof Oi)||s instanceof It&&!s.isContains(u.layerId)?!1:ne.less(u.width,u.length)).forEach(u=>{if(this.isInvalidTrack(u)||s.net!==u.net||this.isExistPadVia(s.globalIndex,u.globalIndex))return;let d=EP(s,u.layerId,0);if(!d)return;let p=K5(u.start,d),m=K5(u.end,d);if(p&&m){this.setTrackIsInvalid(u);return}this.recordId(u,s);let g=e.length;this.pushTearArrToContainer(s,u,e),e.length>g&&(p?this.recordTEnd(u.globalIndex,!0):m&&this.recordTEnd(u.globalIndex,!1))})}(r+1)%n===0&&this.updateProgress2((r+1)/i)}return this.drawDebug&&this.drawDebug.draw(),this.complete2(),Bi(t),e}pushTearArrToContainer(t,e,r){let i=this.getWHT(t,e);if(!i)return;let{type:n,width:s,height:a,shape:l,routingConnect:c,tConnection:h,standardT:u}=i;if(l){let p=e.primitive;if(!(l instanceof fe)){if(OP)throw new Error("!(shape instanceof Polyline)");return}if(l=l.asClose(),!l.primitives.find(m=>{if(Pf(m,p))return!0}))return}let d=this.getTears(e,s,a,n,l,c,h,u);if(d){let p=this.getGlobalIndex(e,t);if(!p)return null;d.forEach(m=>{r.push({tear:Lh(m),net:e.net,layer:e.layerId,globalIndex:p})})}}getGlobalIndex(t,e){let r=[];if(e instanceof Je||e instanceof It)r=[t.globalIndex,e.globalIndex];else{let{type:i}=e;if(i==="T_CONNECTION"){let n=new Set,{cpList:s}=e;s.forEach(a=>{n.add(a[0].tItem.globalIndex)}),r=Array.from(n)}else if(i==="ROUTING"){let{track2:n}=e;r=[t.globalIndex,n.globalIndex]}else if(i==="STANDARD_T"){let{verticalTrack:n,parallels:s}=e;r.push(n.tItem.globalIndex),s.length===2&&s[0].tItem.globalIndex===s[1].tItem.globalIndex?r.push(s[0].tItem.globalIndex):s.forEach(a=>r.push(a.tItem.globalIndex))}else throw new Error("TrackShapeType not support")}if(OP&&r.length!==new Set(Array.from(r)).size)throw new Error("getGlobalIndex\u6CA1\u53BB\u91CD!!!");return r}recordId(t,e){let{type:r}=e;if(e instanceof Je||e instanceof It)this.padViaIds[e.globalIndex]=this.padViaIds[e.globalIndex]||[e.globalIndex],this.padViaIds[e.globalIndex].push(t.globalIndex);else{let i=e,n=this.tStartAndEndIds.get(t.globalIndex);if(n?n[i.isStart?"start":"end"]=!0:this.tStartAndEndIds.set(t.globalIndex,{start:i.isStart,end:!i.isStart}),r==="ROUTING"){let{track2:s}=e;this.recordTTConnectIds(t.globalIndex,s.globalIndex)}else if(r==="T_CONNECTION"){let{cpList:s}=e;s.forEach(a=>{this.recordTTConnectIds(a[0].tItem.globalIndex,a[1].tItem.globalIndex)})}else if(r==="STANDARD_T"){let{verticalTrack:s,parallels:a}=e;a.forEach(l=>{this.recordTTConnectIds(l.tItem.globalIndex,s.tItem.globalIndex)}),a.length===2&&a[0].tItem.globalIndex!==a[1].tItem.globalIndex&&this.recordTTConnectIds(a[0].tItem.globalIndex,a[1].tItem.globalIndex)}}}getNode(t,e){var l,c;let r,i=[],n=this.isExistTrack2End(t.globalIndex,!0)?null:[],s=this.isExistTrack2End(t.globalIndex,!1)?null:[],a=h=>{let u=EP(h,t.layerId,0);u&&(h instanceof Je||h instanceof It?K5(t.start,u)?n&&n.push(h):K5(t.end,u)?s&&s.push(h):i.push(h):h instanceof qr&&(zf(t.start,h)?n&&n.push(h):zf(t.end,h)&&s&&s.push(h)))};for(let h=0;h<e.length;h++){let u=e[h];if(!(t.globalIndex===u.globalIndex||t.net!==u.net)){if(u instanceof Je||u instanceof It){if(this.isExistPadVia(u.globalIndex,t.globalIndex))continue;let d=EP(u,t.layerId,0);if(!d)continue;if(K5(t.start,d)&&K5(t.end,d))return this.setTrackIsInvalid(t),[];a(u)}else if(u instanceof qr){if(this.isInvalidTrack(u)||this.isExistTTConnect(t.globalIndex,u.globalIndex)||zf(u.start,t)&&zf(u.end,t))continue;if(zf(t.start,u)&&zf(t.end,u)){if(kYe(u,t))return this.setTrackIsInvalid(t),[];continue}if(this.isIntersectAndParallel(u,t)&&BYe(t,u)){if(r)return[];r=u;continue}a(u)}}}if(r){if(n&&zf(t.start,r)){if(n.findIndex(u=>{if(u instanceof qr&&this.isIntersectAndParallel(r,u))return!0})!==-1)return[];n.push(r)}else if(s&&zf(t.end,r)){if(s.findIndex(u=>{if(u instanceof qr&&this.isIntersectAndParallel(r,u))return!0})!==-1)return[];s.push(r)}}return n&&((l=this.analysisGroup(t,n,!0))==null||l.forEach(h=>i.push(h))),s&&((c=this.analysisGroup(t,s,!1))==null||c.forEach(h=>i.push(h))),i}setTrackIsInvalid(t){this.isInvalidTracks[t.globalIndex]=t}analysisGroup(t,e,r){if(e.length){if(e.length===1)return this.node1v1(t,e[0],r);if(e.length>1)return this.node1vMore(t,e,r)}else return[]}node1v1(t,e,r){let i=[];if(e instanceof Je||e instanceof It)i.push(e);else if(e instanceof qr){let n=M3e(e,t,r);if(n)ne.greater(Math.abs(e.width-t.width),VYe)&&(i.push({track2:e,type:"ROUTING",isStart:r}),this.recordTEnd(e.globalIndex,n===-1));else{let s=this.splitTrack(e,t);if(!s.length||!this.TConnectionChecked)return;let a=[];s.forEach(l=>{a.push({tItem:l,isStart:!0})}),i.push({parallels:a,type:"STANDARD_T",verticalTrack:{tItem:t,isStart:r}})}}return i}node1vMore(t,e,r){let i=[],n=this.getTrackRelation(t,e,r);if(!n)return;let{nodes:s,containerTrack:a}=n,{maxNode:l,maxBBoxHeigth:c}=this.getMaxNode(t,s);if(a.length===1){let h=a[0],u=Math.max(h.tItem.width,t.width);if(!c||u>c){if(!this.routingChecked)return;ne.greater(Math.abs(t.width-h.tItem.width),VYe)?i.push({type:"ROUTING",track2:h.tItem,isStart:r}):i.push({type:"STANDARD_T",parallels:a,verticalTrack:{tItem:t,isStart:r}}),this.recordTEnd(h.tItem.globalIndex,h.isStart)}else c&&u<c&&i.push(l)}else if(a.length>1){let h=[],u=0;if(a.forEach(d=>{d.tItem.width>u&&(u=d.tItem.width),(!c||d.tItem.width>c)&&h.push(d)}),c&&l&&u<c&&i.push(l),h.length){if(!this.TConnectionChecked)return;let d;if(h.length===2){let p=h[0].tItem,m=h[1].tItem,g,y,b;jq(p,m)?jq(t,p)||(y=h[0],b=h[1],g={tItem:t,isStart:r}):jq(t,p)?(y=h[0],b={tItem:t,isStart:r},g=h[1]):jq(t,m)&&(y=h[1],b={tItem:t,isStart:r},g=h[0]),y&&y.tItem.width===b.tItem.width&&(d=!0,i.push({type:"STANDARD_T",parallels:[y,b],verticalTrack:g}),h.forEach(P=>{this.recordTEnd(P.tItem.globalIndex,P.isStart)}))}if(!d){let p=[],m=this.sortT(h,t,r);for(let g=0,y=m.length;g<y;g++){let b=m[g],P=m[(g+1)%y];p.push([b,P])}p.length&&(i.push({cpList:p,type:"T_CONNECTION",isStart:r}),h.forEach(g=>{this.recordTEnd(g.tItem.globalIndex,g.isStart)}))}}}else l&&i.push(l);return i}sortT(t,e,r){var p,m;let i=r?e.start:e.end,n=r?e.end.sub(e.start).normalize():e.start.sub(e.end).normalize(),s=new S(-n.y,n.x).normalize(),a=new Array,l=new Array;t.forEach(g=>{let y,b,P=g.tItem;if(g.isStart!==void 0?g.isStart?y=P.end.sub(P.start).normalize():(y=P.start.sub(P.end).normalize(),b=!0):P.start.distance1(i)<P.end.distance1(i)?y=P.end.sub(P.start).normalize():P.start.distance1(i)>P.end.distance1(i)&&(y=P.start.sub(P.end).normalize(),b=!0),y){let T=Ht.toDegrees(Math.acos(Kle(y.dot(s))));T<90?l.push({direct:y,trackInfo:g}):T>90?a.push({direct:y,trackInfo:g}):n.cross((b?P.start:P.end).sub(r?e.start:e.end))>0?l.push({direct:y,trackInfo:g}):a.push({direct:y,trackInfo:g})}});let c=(p=d(l,!0))==null?void 0:p.map(g=>g.trackInfo),h=(m=d(a,!1))==null?void 0:m.map(g=>g.trackInfo),u=[{tItem:e,isStart:r}];return c==null||c.forEach(g=>u.push(g)),h==null||h.forEach(g=>u.push(g)),u;function d(g,y){if(g.length)return g.length===1?g:g.sort((b,P)=>{let{direct:T}=b,{direct:I}=P,C=Ht.toDegrees(Math.acos(Kle(n.dot(T)))),E=Ht.toDegrees(Math.acos(Kle(n.dot(I))));if(Math.abs(C-E)<=.1){let G=function(W,L){let B,N=y?-1/0:1/0,U=k();for(let V of L.primitives){let Y=Pf(W,V);for(let X=0;X<Y;X+=2){let Z=new S(Ke[0],Ke[1]),Q=Z.distance1(W.start());U(Q,N)&&(B=Z,N=Q)}}function k(){return y?(V,Y)=>V>Y:(V,Y)=>V<Y}return B},O=(r?e.primitive:e.primitive.reverse()).panDistance(e.width/2),_=O.start(),R=new M(_,Ga(O.end(),O.direct,O.length())),v=b.trackInfo.tItem,D=P.trackInfo.tItem,w=EP(v,e.layerId,0),F=EP(D,e.layerId,0),H=G(R,w),z=G(R,F);if(H&&z)return y?z.distance1(_)-H.distance1(_):H.distance1(_)-z.distance1(_);if(H)return y?-1:1;if(z)return y?1:-1;{let W=Ga(b.trackInfo.isStart?v.start:v.end,new S(T.y,-T.x),v.width/2),L=Ga(P.trackInfo.isStart?D.start:D.end,new S(I.y,-I.x),D.width/2);return y?W.distance1(_)-L.distance1(_):L.distance1(_)-W.distance1(_)}}return y?C-E:E-C})}}getTrackRelation(t,e,r){let i=new Array,n=[],s=[];for(let l=0;l<e.length;l++){let c=e[l];if(c instanceof It||c instanceof Je)i.push(c);else if(c instanceof qr){let p=function(m,g){let y=[],b=!0;for(let P of m){let T=P instanceof qr?P:P.tItem;if(b&&zf(g.start,T)&&zf(g.end,T))return{isAllContainerPoint:!0};if(zf(T.start,g)&&zf(T.end,g)){b=!1;continue}y.push(P)}return y},h=p(n,c);if(h.isAllContainerPoint)continue;h.length!==n.length&&(n=h);let u=p(s,c);if(u.isAllContainerPoint)continue;u.length!==s.length&&(s=u);let d=M3e(c,t,r);if(d){let m=d===-1;n.push({tItem:c,isStart:m})}else s.push(c)}}s.forEach(l=>{let c=this.splitTrack(l,t),h=[];c.forEach(u=>{u!==null&&(a(l,u)||h.push({tItem:u,isStart:!0,notIsOriginTrack:!0}))}),h.forEach(u=>n.push(u))});function a(l,c){for(let h of n){let u=h instanceof qr?h:h.tItem;if(zf(c.start,u)&&zf(c.end,u))return!0}return s.findIndex(h=>{if(h!==l&&zf(c.start,h)&&zf(c.end,h))return!0})!==-1}return n.length===1&&n[0].tItem.width===t.width&&!n[0].notIsOriginTrack&&(n.length=0),{nodes:i,containerTrack:n}}distanceLessHalfWidth(t,e){let r=this.getTrackIntersPoint(t,e);if(!r)return null;let{start:i,end:n}=t,s=r.distance1(i),a=r.distance1(n),l=t.width/2;return s<=l||a<=l}splitTrack(t,e){let r=this.getTrackIntersPoint(t,e);if(!r)return[];let i=this.getLine(t),n=ir.foot(i,r);if(i.start().sub(n).dot(i.end().sub(n))>=0)return[];let{net:s,layerId:a,start:l,end:c,width:h,globalIndex:u,locked:d}=t,p=n.distance1(l),m=n.distance1(c),g=t.width/2;return p<g&&m<g?[]:p<g?[new qr(u,a,n,c,h,d,s)]:m<g?[new qr(u,a,n,l,h,d,s)]:[new qr(u,a,n,l,h,d,s),new qr(u,a,n,c,h,d,s)]}getMaxNode2(t,e){let i=t.end.sub(t.start).normalize().angle(S.ORIGIN),n=Ae.rotateZForPoint(t.start,-i),s,a;if(e.length){a=e[0],s=a.multiply3(n).bbox().height();for(let c=1;c<e.length;c++){let h=e[c],d=h.multiply3(n).bbox().height();s<d&&(a=h,s=d)}}return{maxNode:a,maxBBoxHeigth:s}}getMaxNode(t,e){let r=t.end.sub(t.start).normalize(),i,n;if(e.length){i=-1/0;for(let s=0;s<e.length;s++){let a=e[s],l=EP(a,t.layerId),c=l.primitives.length===1&&l.primitives[0]instanceof q?l.bbox().height():l.getMaxBBoxHeightByVec(r);c>i&&(n=a,i=c)}}return{maxNode:n,maxBBoxHeigth:i}}recordTTConnectIds(t,e){let r=[t,e].sort().join(G3e);this.ttConnectIds[r]=!0}recordTEnd(t,e){let r=this.tStartAndEndIds.get(t);r?r[e?"start":"end"]=!0:this.tStartAndEndIds.set(t,{start:e,end:!e})}removeTEnd(t,e){let r=this.tStartAndEndIds.get(t);r&&(r[e?"start":"end"]=!1)}isExistTTConnect(t,e){let r=[t,e].sort().join(G3e);return this.ttConnectIds[r]}removeTTConnect(t,e){let r=[t,e].sort().join(G3e);this.ttConnectIds[r]=!1}isExistTrack2End(t,e){let r=this.tStartAndEndIds.get(t);return r?e?r.start:r.end:!1}isExistPadVia(t,e){var r;return(r=this.padViaIds[t])==null?void 0:r.includes(e)}isInvalidTrack(t){return!!this.isInvalidTracks[t.globalIndex]}getWHT(t,e){let r,i,n;if(t instanceof Je){let s=e.layerId===1?t.top:e.layerId===2?t.bottom:t.inner;if(n=EP(t,e.layerId,0),!n)return null;let a=s.type;if(a=="ELLIPSE"){if(!this.circlePadViaChecked)return null;r=s.width*this.roundWidth,i=s.width*this.roundeHeight}else{if(!this.specialShapedPadChecked)return null;r=e.width*this.otherWidth,i=e.width*this.otherHeight}return{type:a,width:r,height:i,shape:n}}else if(t instanceof It){if(n=EP(t,e.layerId,0),!n)return null;let s="ELLIPSE";if(!this.circlePadViaChecked)return null;let a=t.radius*2;return r=a*this.roundWidth,i=a*this.roundeHeight,{type:s,width:r,height:i,shape:n}}else if(t.type==="ROUTING"){if(!this.routingChecked)return null;let{track2:s}=t,a=Math.max(e.width,s.width);return r=a*this.routingWidth,i=a*this.routingHeight,{type:t.type,width:r,height:i,routingConnect:{...t}}}else if(t.type==="T_CONNECTION"){if(!this.TConnectionChecked)return null;let{cpList:s}=t,a=[];return s.forEach(l=>{let c=Math.max(l[0].tItem.width,l[1].tItem.width);r=c*this.TConnectionWidth,i=c*this.TConnectionHeight,a.push({width:r,height:i,tracks:l})}),{type:t.type,tConnection:{tCPList:a,isStart:t.isStart}}}else if(t.type==="STANDARD_T"){if(!this.TConnectionChecked)return null;let{parallels:s,verticalTrack:a}=t,l=Math.max(...s.map(c=>c.tItem.width),a.tItem.width);return l===a.tItem.width&&this.TConnectionWidth<=1?null:(r=l*this.TConnectionWidth,i=l*this.TConnectionHeight,{type:t.type,width:r,height:i,standardT:t})}}getAngle(t,e){let r,i,n=Math.max(t.width,e.width);if(t.start.distance1(e.start)<n?(r=t.end.sub(t.start).normalize(),i=e.end.sub(e.start).normalize()):t.start.distance1(e.end)<n?(r=t.end.sub(t.start).normalize(),i=e.start.sub(e.end).normalize()):t.end.distance1(e.start)<n?(r=t.start.sub(t.end).normalize(),i=e.end.sub(e.start).normalize()):t.end.distance1(e.end)<n&&(r=t.start.sub(t.end).normalize(),i=e.start.sub(e.end).normalize()),r&&i)return Ht.toDegrees(Math.acos(r.dot(i)))}isIntersectAndParallel(t,e){let r=t.end.sub(t.start),i=e.end.sub(e.start);return this.isParallel(r,i)}getTears(t,e,r,i,n,s,a,l){if(i==="ROUTING"){let c=this.dispatchRouting(t,s,e,r);if(c)return[c]}else if(i==="T_CONNECTION"){let c=this.dispatchTConnection(t,a);if(c)return[c]}else if(i==="STANDARD_T"){let c=this.dispatchStandardT(l,e,r);if(c)return[c]}else return i!="ELLIPSE"?this.dispatch(n,t,e,r,i):this.dispatchArc(n,t,e,r)}dispatchStandardT(t,e,r){let i=[],{parallels:n,verticalTrack:s}=t,a=s.tItem,l=s.isStart?a.primitive:a.primitive.reverse(),c=l.direct,h=(e-a.width)/2,u,d,p;if(n.forEach(b=>{let P=b.isStart?b.tItem.primitive:b.tItem.primitive.reverse();u=u?N_(u,P.start()):P.start();let T=P.direct,I=c.cross(T),C,E,O;I<0?(E=l.panDistance(-a.width/2),C=P.panDistance(b.tItem.width/2),O=!1):(E=l.panDistance(a.width/2),C=P.panDistance(-b.tItem.width/2),O=!0);let _=Pf(C,E),R,v;if(_===0){if(R=r>E.length()?E.end():Ga(E.start(),c,r),v=h>C.length()?C.end():Ga(C.start(),T,h),O){if(T.cross(R.sub(C.start()))>0||c.cross(v.sub(E.start()))<0)return}else if(T.cross(R.sub(C.start()))<0||c.cross(v.sub(E.start()))>0)return}else if(_===2){let D=new S(Ke[0],Ke[1]),w=D.distance1(E.end()),F=D.distance1(C.end());R=r>w?E.end():Ga(D,c,r),v=h>F?C.end():Ga(D,T,h)}else throw new Error("dispatchStandardT_intersection");d?(g(d,u),g(u,v),this.tearShape==="line"?g(v,R):y({point:v,refPt:C},{point:R,refPt:E},O?le.CCW:le.CW),d=R):(this.tearShape==="line"?g(R,v):y({point:R,refPt:E},{point:v,refPt:C},O?le.CW:le.CCW),p=R,d=v)}),!i.length)return null;i.length===1?(g(d,u),g(u,p)):g(d,p);let m=fe.build2(i);if(OP&&m&&No(m))throw this.drawDebug.initColor(ee.RED).addPly(m),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");function g(b,P){k3e(b,P)||i.push(new M(b,P))}function y(b,P,T){i.push(F3e(b,P,T))}return m}dispatchTConnection(t,e){let r=[],{tCPList:i,isStart:n}=e,s,a,l;if(i.forEach((h,u)=>{let{tracks:[d,p],height:m}=h,g=d.tItem,y=p.tItem,b=d.isStart?g.primitive:g.primitive.reverse(),P=p.isStart?y.primitive:y.primitive.reverse(),T=b.panDistance(g.width/2),I=P.panDistance(-y.width/2),C,E,O=T,_=I,R=Pf(T,I),v;if(R===0){let w=function(F,H,z,G){if(G)return;let W,L,B,N=EP(F,F.layerId,0).primitives.filter(Q=>Q instanceof q);for(let Q of N){let ae,he=Pf(H,Q);if(he===2)ae={point:new S(Ke[0],Ke[1]),refPt:Q};else if(he===4){let re=new S(Ke[0],Ke[1]),se=new S(Ke[2],Ke[3]);ae={point:H.start().distance1(re)>H.start().distance1(se)?re:se,refPt:Q}}ae&&(!B||H.start().distance1(B.point)<H.start().distance1(ae.point))&&(B=ae)}if(!B)return;let{point:U,refPt:k}=B,V,Y=Mc(k,U),X=H.direct.cross(Y);if(ne.eq(X,0)&&H.direct.dot(Y)>0?k=k.reverse():z?X>0&&(k=k.reverse()):X<0&&(k=k.reverse()),V=k.end(),m>=k.rx)W=N3e(k,U,N3e(k,U,k.end()));else{let Q=U.sub(k.center),ae=Math.sqrt(k.rx2-m**2),he=Ga(k.center,Q,ae),re=new S(Q.y,-Q.x),se=Ga(he,re,m);z?W=V.sub(k.center).cross(se.sub(k.center))<0?V:se:W=V.sub(k.center).cross(se.sub(k.center))>0?V:se}let Z=U.distance1(H.end());return L=m>Z?H.end():Ga(U,H.direct,m),{points:[W,L],arcPt:k}};ne.neq(g.width,y.width)&&(this.removeTTConnect(g.globalIndex,y.globalIndex),g!==t&&!d.notIsOriginTrack&&this.removeTEnd(g.globalIndex,d.isStart),y!==t&&!p.notIsOriginTrack&&this.removeTEnd(y.globalIndex,p.isStart)),v=!0;let D=w.call(this,y,T,!1,zf(T.end(),y));if(D)[E,C]=D.points,_=D.arcPt;else{let F=w.call(this,g,I,!0,zf(I.end(),g));if(F)[C,E]=F.points,O=F.arcPt;else{if(u<i.length-1||!l){let H=N_(b.start(),P.start());s&&c(s,H),s=H,a||(a=H),l=!0}return}}}else{let D;if(R===2)D=new S(Ke[0],Ke[1]);else if(R===4)D=N_(new S(Ke[0],Ke[1]),new S(Ke[2],Ke[3]));else throw new Error("dispatchTConnection2!!!");if(ne.eq(T.direct.cross(I.direct),0))C=D,E=D;else{let w=D.distance1(T.end()),F=D.distance1(I.end());C=m>w?T.end():Ga(D,T.direct,m),E=m>F?I.end():Ga(D,I.direct,m)}}C&&E&&(a||(a=C),s&&c(s,C),s=E,this.tearShape==="line"||v?c(C,E):r.push(F3e({point:C,refPt:O},{point:E,refPt:_})))}),r.length<2)return null;if(c(s,a),r.length){let h=fe.build2(r);if(OP&&h&&No(h))throw this.drawDebug.initColor(ee.RED).addPly(h),this.drawDebug.draw(),new Error("selfIntersectionCheck");return h}function c(h,u){k3e(h,u)||r.push(new M(h,u))}}dispatchRouting(t,e,r,i){let n,{track2:s}=e,a,l;t.width>s.width?(a=EP(t,s.layerId,0),l=s):(a=EP(s,t.layerId,0),l=t,t.width===s.width&&(l.width=l.width-1));let c=a.area(.1)>0,h=this.calculate4PointsForPadAndVia(a,c,l,r,i,e.type);return h==null||h.forEach(u=>{let{topLeft:d,topRight:p,bottomLeft:m,bottomRight:g}=u;if(this.tearShape==="line"){let y=fe.build4([d.point,m.point,g.point,p.point]).asClose();if(OP&&y&&No(y))throw this.drawDebug.initColor(ee.RED).addPly(y),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");n=y}else{let y=this.jointPointByArc(a,u,t.width,e.type);y&&(n=y)}}),n}translationLine(t,e,r){if(t instanceof M){let i=r.mul(e);return new M(t.start().add(i),t.end().add(i))}else{let i=t.rx;return i<=e?null:q.build2(t.center,t.startAngle,t.endAngle(),i-e,i-e,t.sweep())}}getTrackIntersPoint(t,e){let r=this.getLine(t),i=this.getLine(e),n=this.getInters(r,i),s;if(n.length===1)s=n[0];else return this.getShapePoint(t,e);return s}getShapePoint(t,e){let r=this.getLine(e),i,n=this.getPoints(EP(t,e.layerId,0),r);if(n.length===1)i=n[0].point;else if(n.length===2&&n[0].point.equals(n[1].point))i=n[0].point;else return;return i}dispatch(t,e,r,i,n){if(t!=null){let s=[];return t.primitives[0]instanceof q&&ne.eq(Math.abs(t.primitives[0].sweepAngle),360)?s=this.calculateCirclePadAndVia(t.primitives[0],e,r,i):s=this.calculatePadAndViaToTrack(t,e,r,i,n),s.length?s:null}return null}calculatePadAndViaToTrack(t,e,r,i,n){let s=V3e([t,e.getMathGraphics()]),a=t.area(.1)>0,l=this.calculate4PointsForPadAndVia(t,a,e,r,i,n),c=[];return l==null||l.forEach(h=>{let{topLeft:u,topRight:d,bottomLeft:p,bottomRight:m,trackInterInfo:g}=h;if(u!=null&&d!=null&&p!=null&&m!=null)if(this.tearShape==="line"){let y=fe.build4([u.point,p.point,m.point,d.point]).asClose();if(OP&&y&&No(y))throw this.drawDebug.initColor(ee.RED).addPly(y),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");c.push(y)}else{let y;if(n&&n==="OVAL"?y=this.jointPointByBezier(a,h,e.width,n,s,void 0):y=this.jointPointByArc(t,h,e.width,n),OP&&y&&No(y))throw this.drawDebug.initColor(ee.RED).addPly(y),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");y&&c.push(y)}else return null}),c}calculate4PointsForPadAndVia(t,e,r,i,n,s){let a=this.getLine(r),l=this.getPointsAndRefPt(t,a);if(!l.length)return[];let c=(a instanceof M?a.panDistance:a.panDistance1).bind(a),h=c(r.width/2),u=c(-r.width/2),d=this.getPointsAndRefPt(t,h),p=this.getPointsAndRefPt(t,u);if(!d.length&&!p.length)return[];let m=L3e([l,d,p]),g=[];for(let P=0;P<m;P++){let T=l[P],I=d[P],C=p[P];if(!I&&!C)break;if(!T){if(T=l[P-1],!T)return;T.refPt.length<2&&(g.pop(),(I&&I.refPt.length<2||C&&C.refPt.length<2)&&(I||(I=d[P-1]),C||(C=p[P-1])))}let E,O,_;if(T.refPt.length===1){let R=T.refPt[0];E={point:T.point,refPt:R},I&&(O={point:I.point,refPt:I.refPt.length===1?I.refPt[0]:R}),C&&(_={point:C.point,refPt:C.refPt.length===1?C.refPt[0]:R})}else if(T.refPt.length===2){let R;if(I){if(I.refPt.length!==1)throw new Error("leftInter.refPt.length !== 1");R=I.refPt[0],O={point:I.point,refPt:R}}if(C){if(C.refPt.length!==1)throw new Error("leftInter.refPt.length !== 1");R=C.refPt[0],_={point:C.point,refPt:R}}E={point:T.point,refPt:R}}else throw new Error("midInter.refPt.size!!!");g.push({left:O,mid:E,right:_})}let y=[],b=i/2;return g.forEach(P=>{let{mid:T,left:I,right:C}=P,E=Mc(T.refPt,T.point).cross(Mc(a,T.point));if(E===0){if(s!=="POLYGON"&&I&&C)throw new Error("leftInterInfo && rightInterInfo");E=I?Mc(I.refPt,I.point).cross(Mc(h,I.point)):Mc(C.refPt,C.point).cross(Mc(u,C.point))}let O=e?E<0:E>0,_=a,R=h,v=u,D,w,F,H,z,G;if(!O){let k=I;I=C,C=k;let V=R.reverse();R=v.reverse(),v=V,_=a.reverse()}if(I&&C){if(ne.eq(I.point.distance1(C.point),T.refPt.start().distance1(T.refPt.end())))return;if(I.refPt===C.refPt){let k=T.refPt,V=T.point,Y=C.point.sub(I.point).normalize(),X=Y.dot(Mc(k,V))>0,Z,Q;if(X?(Z=k.start(),Q=k.end()):(Z=k.end(),Q=k.start()),k instanceof M){let ae=I.point;b<V.distance1(ae)?D=ae.distance1(Z)>b?Ga(ae,Y,-b):Z:D=V.distance1(Z)>b?Ga(V,Y,-b):Z;let he=C.point;b<V.distance1(he)?w=he.distance1(Q)>b?Ga(he,Y,b):Q:w=V.distance1(Q)>b?Ga(V,Y,b):Q}else if(k instanceof q){let ae=V.sub(k.center).normalize(),he=new S(ae.y,-ae.x);if(k.rx<b)D=Ga(k.center,he,-k.rx),w=Ga(k.center,he,k.rx);else{let re=Math.sqrt(k.rx2-b**2),se=Ga(k.center,ae,re);D=Ga(se,he,-b),w=Ga(se,he,b),Z.sub(k.center).normalize().cross(D.sub(k.center).normalize())>0&&(D=Z),Q.sub(k.center).normalize().cross(w.sub(k.center).normalize())<0&&(w=Q)}}else throw new Error("not support")}else{let k=i/2-r.width/2;D=U(I,!0,k,T.point),w=U(C,!1,k,T.point)}z={point:D,refPt:I.refPt},G={point:w,refPt:C.refPt}}else if(I)D=U(I,!0,i/2-r.width/2,T.point),w=U(T,!1,i/2,I.point),z={point:D,refPt:I.refPt},G={point:w,refPt:T.refPt};else if(C)D=U(T,!0,i/2,C.point),w=U(C,!1,i/2-r.width/2,T.point),z={point:D,refPt:T.refPt},G={point:w,refPt:C.refPt};else throw new Error("!leftInterInfo && !rightInterInfo");let W,L;if(R instanceof q){let k=D.distance2(R.center);W=R.isCCW?k>=R.rx2:k<=R.rx2}else R instanceof M&&(W=R.direct.cross(D.sub(R.start()))<=0);if(v instanceof q){let k=w.distance2(v.center);L=v.isCCW?k<=v.rx2:k>=v.rx2}else R instanceof M&&(L=v.direct.cross(w.sub(v.start()))>=0);if(W&&L)return;let B=new M(D,w),N=this.getTearTop2Point(_,R,v,D,w,T.point,n,r.width,t);if(!N||([F,H]=N,B.direct.cross(F.sub(B.start()))<=0||B.direct.cross(H.sub(B.start()))<=0))return;y.push({topLeft:{point:F,refPt:R},topRight:{point:H,refPt:v},bottomLeft:z,bottomRight:G,middleLine:_,trackInterInfo:{left:I,right:C}});function U(k,V,Y,X){let Z=k.refPt,Q=k.point,ae,he=Mc(Z,Q),re=Q.sub(X).dot(he)>0,se=re?Z.end():Z.start();if(Z instanceof q){let K=Q.sub(Z.center);if(Z.rx<Y)return se;let me=Math.sqrt(Z.rx2-Y**2),Oe=Ga(Z.center,K,me),Ie=V?new S(-K.y,K.x):new S(K.y,-K.x);ae=Ga(Oe,Ie,Y),V?se.sub(Z.center).normalize().cross(ae.sub(Z.center).normalize())>0&&(ae=se):se.sub(Z.center).normalize().cross(ae.sub(Z.center).normalize())<0&&(ae=se)}else if(Z instanceof M){let K=V?R:v,me=re?he:new S(-he.x,-he.y),Oe=Mc(K,Q),ue=Oe.dot(he)>0?he:new S(-he.x,-he.y),Pe=Math.acos(ue.dot(Oe)/(ue.length()*Oe.length())),j=ne.eq(Math.sin(Pe),0)?0:Y/Math.sin(Pe);Q.distance1(se)>j?ae=Ga(Q,me,j):ae=se}else throw new Error("not support");return ae}}),y}jointPointByBezier(t,e,r,i,n,s=.01){let{topLeft:a,topRight:l,bottomLeft:c,bottomRight:h,trackInterInfo:u}=e,d=Mc(l.refPt.reverse(),l.point),p=Mc(a.refPt.reverse(),a.point),m=Mc(t?c.refPt.reverse():c.refPt,c.point),g=Mc(t?h.refPt:h.refPt.reverse(),h.point),y=this.getTop2PointLink(a,l,p,d,r),b=this.getLimit(l.point,d,h.point,g,n,!0),P=[l.point,l.point.add(d.mul(b[0])),h.point.add(g.mul(b[1])),h.point],T=this.getBezier(P),I=this.getBot2PointLink(h,c,g,m,u,i),C=this.getLimit(a.point,p,c.point,m,n,!0),E=[c.point,c.point.add(m.mul(C[1])),a.point.add(p.mul(C[0])),a.point],O=this.getBezier(E),_=Yq(T,s),R=Yq(O,s),v=fe.build2([].concat(y,_,I,R));if(OP&&v&&No(v))throw this.drawDebug.initColor(ee.RED).addPly(v),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");return v}jointPointByArc(t,e,r,i){let{topLeft:n,topRight:s,bottomLeft:a,bottomRight:l,trackInterInfo:c}=e,h=Mc(s.refPt.reverse(),s.point),u=Mc(n.refPt.reverse(),n.point),d=Mc(a.refPt,a.point),p=Mc(l.refPt,l.point),m=s.point.sub(n.point);d.dot(m)<0&&(d=new S(-d.x,-d.y)),p.dot(m)>0&&(p=new S(-p.x,-p.y));let g=this.getTop2PointLink(n,s,u,h,r),y=I(s.point,l,!0,!1,h,p),b=this.getBot2PointLink(l,a,p,d,c,i),P=I(n.point,a,!1,!0,u,d),T=fe.build2([].concat(g,y,b,P)).asClose();if(OP&&T&&No(T))throw this.drawDebug.initColor(ee.RED).addPly(T),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");return T;function I(C,E,O,_,R,v){let D=[],w=E.point,F=N_(C,w),H=!!t.getWindingNum(F),z=_?[le.CW,le.CCW]:[le.CCW,le.CW],G=O?z[0]:z[1];if(H){let Y=NYe(Mc(E.refPt,w).dot(C.sub(E.point))>=0?E.refPt:E.refPt.reverse(),w,F);w=Y.end(),Y=O?Y.reverse():Y,D.push(Y),F=N_(C,w)}let[W,L]=O?[C,w]:[w,C],B=new M(C,C.add(R)),N=B.distance2(w);if(ne.eq(N,0))return[new M(W,L)];if(new M(w,w.add(v)).distance2(C)>N){let Y=w.sub(C),X=new S(R.y,-R.x);X.dot(Y)<0&&(X=new S(-X.x,-X.y));let Z=V(Y,X);if(ne.eq(Z,Math.PI/2))return D.push(new M(W,L)),D;let Q=C.distance1(F)/Math.cos(Z);D.push(q.build1(W,L,Q,Q,!1,G))}else{let Y=C.sub(w),X=new S(v.y,-v.x);X.dot(Y)<0&&(X=new S(-X.x,-X.y));let Z=V(Y,X);if(ne.eq(Z,Math.PI/2))return D.push(new M(W,L)),D;let Q=w.distance1(F)/Math.cos(Z);D.push(q.build1(W,L,Q,Q,!1,G))}return O?D.reverse():D;function V(Y,X){let Q=Y.dot(X)/(Y.length()*X.length());return Math.acos(Q)}}}getBot2PointLink(t,e,r,i,n,s){let{point:a,refPt:l}=t,{point:c,refPt:h}=e,{left:u,right:d}=n;if(s!=="POLYGON")return[new M(a,c)];let p,m=a;if(d)if(m=d.point,l instanceof M)p=new M(a,m);else if(l instanceof q)p=q.build1(a,m,l.rx,l.ry,l.isLarge(),le.CCW);else throw new Error("not support");let g,y=c;if(u)if(y=u.point,h instanceof M)g=new M(y,c);else if(h instanceof q)g=q.build1(y,c,h.rx,h.ry,h.isLarge(),le.CCW);else throw new Error("not support");return[p,new M(m,y),g].filter(b=>b)}dispatchArc(t,e,r,i){if(t!=null&&t.primitives[0]instanceof q){let n=this.calculateCirclePadAndVia(t.primitives[0],e,r,i);return n.length?n:null}return null}calculateCirclePadAndVia(t,e,r,i){let n=this.getLine(e),s=P(t,n);if(!s.length)return[];let a=(n instanceof M?n.panDistance:n.panDistance1).bind(n),l=a(e.width/2),c=a(-e.width/2),h=P(t,l),u=P(t,c),d=t.isCCW;if(!h.length&&!u.length)return[];let p=L3e([s,h,u]),m=[];for(let T=0;T<p;T++){let I=s[T],C=h[T],E=u[T];if(!C&&!E)break;I||(I=s[T-1]);let O,_,R;O=I.point,C&&(_=C.point),E&&(R=E.point),m.push({left:_,mid:O,right:R})}let g=[],y=r/2,b=V3e([fe.build7([t]),e.getMathGraphics()]);m.forEach(T=>{let{mid:I,left:C,right:E}=T,O=Mc(t,I).cross(Mc(n,I));if(O===0){if(C&&E)throw new Error("leftInterPoint && rightInterPoint");O=C?Mc(t,C).cross(Mc(l,C)):Mc(t,E).cross(Mc(c,E))}let _=d?O<0:O>0,R=n,v=l,D=c,w,F,H,z;if(!_){let N=C;C=E,E=N;let U=v.reverse();v=D.reverse(),D=U,R=n.reverse()}if(C&&E){if(ne.eq(C.distance1(E),t.rx*2))return;let U=I.sub(t.center).normalize(),k=t.rx>=y?Math.sqrt(t.rx2-y**2):t.rx;if(y<=e.width/2)w=B(t,C,!0,k,I,this.drawDebug),F=B(t,E,!1,k,I,this.drawDebug),i+=w.distance1(F)-r;else{let Y=new M(C,E).distance(t.center);(k>=Y||k===0)&&(k=Y/2,y=Math.sqrt(t.rx2-k**2));let X=Ga(t.center,U,k),Z=new S(U.y,-U.x);w=Ga(X,Z,-y),F=Ga(X,Z,y)}}else if(C)w=B(t,C,!0,Math.abs(r/2-e.width/2),I,this.drawDebug),F=B(t,I,!1,r/2,C,this.drawDebug);else if(E)w=B(t,I,!0,r/2,E,this.drawDebug),F=B(t,E,!1,Math.abs(r/2-e.width/2),I,this.drawDebug);else throw new Error("!leftInterInfo && !rightInterInfo");let G=new M(w,F),W=this.getTearTop2Point(R,v,D,w,F,I,i,e.width,fe.build2([t]));if(!W||([H,z]=W,G.direct.cross(H.sub(G.start()))<=0||G.direct.cross(z.sub(G.start()))<=0))return;let L=this.getTearByFourPoint(H,z,F,w,t,v,D,e.width,b);L&&g.push(L);function B(N,U,k,V,Y,X){let Z=U,Q=Y.sub(N.center),ae=k?new S(-Q.y,Q.x):new S(Q.y,-Q.x),he=Ga(N.center,ae,N.rx),re,se=Z.sub(N.center);if(N.rx<V)return he;let K=Math.sqrt(N.rx2-V**2),me=Ga(N.center,se,K),Oe=k?new S(-se.y,se.x):new S(se.y,-se.x);return re=Ga(me,Oe,V),k?he.sub(N.center).normalize().cross(re.sub(N.center).normalize())>0&&(re=he):he.sub(N.center).normalize().cross(re.sub(N.center).normalize())<0&&(re=he),re}});function P(T,I){let C=[],E=Pf(T,I);for(let O=0;O<E;O+=2)C.push({point:new S(Ke[O],Ke[O+1])});return w3e(I,C),C}return g}getTearTop2Point(t,e,r,i,n,s,a,l,c){let h,u,d=new M(i,n);if(t instanceof M){let p=function(m,g,y){let b=ir.foot(m,g);if(m.direct.dot(b.sub(m.start()))<0){if(b.distance1(m.start())>y)return m.start();if(b.distance1(m.end())<y)return m.end()}else{if(m.direct.dot(b.sub(m.end()))>0)return null;if(b.distance1(m.end())<y)return m.end()}return Ga(b,m.direct,y)};if(h=p(e,i,a),!h||(u=p(r,n,a),!u))return}else if(t instanceof q){let b=function(P,T){return T=Ht.regularD(T),P.sweepAngle>0?(T<P.startAngle&&(T+=360),P.endAngle()>T):(T>P.startAngle&&(T-=360),P.endAngle()<T)},p=Mc(t,s),m=new S(p.y,-p.x),g=new M(Ga(s,m,-d.length()),Ga(s,m,d.length())).panDistance(a),y=this.getInters(t,g);if(y.length===0){let P=this.getInters(e,g);if(P.length===0){let T=this.getInters(r,g);if(T.length===0)h=e.end(),u=r.end();else{u=Zle(T,g);let I=Mc(r,u),C=new S(-I.y,I.x);h=Ga(u,C,l)}}else{h=Zle(P,g);let T=Mc(e,h),I=new S(T.y,-T.x);u=Ga(h,I,l)}}else{let P=Zle(y,g),T=this.getInters(g,e),I=this.getInters(g,r);if(T.length&&I.length)return[IG(T,i),IG(I,n)];let C=d.length()+t.length()*2,E=new M(Ga(P,d.direct,-C),Ga(P,d.direct,C)),O=e.rx>r.rx,[_,R]=O?[e,r]:[r,e],v=this.getInters(E,_);if(!v.length){console.warn("\u5BFC\u7EBF\u5916\u4FA7\u8F6E\u5ED3\u6CA1\u6709\u627E\u5230\u4EA4\u70B9\uFF01\uFF01\uFF01");return}let D=IG(v,O?i:n),F=FYe(R,D).filter(z=>!c.getWindingNum(z)&&b(R,z.angleD(R.center))),H;if(F.length)H=IG(F,O?i:n);else{let z=this.getInters(E,R);if(z.length)H=IG(z,O?n:i);else{let G=Mc(t,P),W=O?new S(G.y,-G.x):new S(-G.y,G.x);H=Ga(P,W,l/2)}}[h,u]=O?[D,H]:[H,D]}e instanceof q&&(e.end().equals1(h)||b(e,h.angleD(e.center))||(h=e.end())),r instanceof q&&(r.end().equals1(u)||b(r,u.angleD(r.center))||(u=r.end()))}else throw new Error("not support");return[h,u]}getTearByFourPoint(t,e,r,i,n,s,a,l,c,h=.01){if(this.tearShape==="line")return fe.build4([t,e,r,i]).asClose();{let u=Mc(s.reverse(),t),d=Mc(a.reverse(),e),p=n.center.sub(r),m=n.center.sub(i),g=new S(p.y,-p.x).normalize(),y=new S(-m.y,m.x).normalize(),b=this.getTop2PointLink({point:t,refPt:s},{point:e,refPt:a},u,d,l),P=this.getLimit(e,d,r,g,c,!0),T=[e,e.add(d.mul(P[0])),r.add(g.mul(P[1])),r],I=this.getBezier(T),C=new M(r,i),E=this.getLimit(t,u,i,y,c,!0),O=[i,i.add(y.mul(E[1])),t.add(u.mul(E[0])),t],_=this.getBezier(O),R=Yq(I,h),v=Yq(_,h),D=fe.build2([].concat(b,R,[C],v));if(OP&&D&&No(D))throw this.drawDebug.initColor(ee.RED).addPly(D),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");return D}}getTop2PointLink(t,e,r,i,n){let{point:s,refPt:a}=t,{point:l,refPt:c}=e,h=[new M(s,l)];if(a instanceof q&&c instanceof q){let u=a.rx<c.rx?a:c;if(Pf(h[0],u)>2)if(a.rx<c.rx){let p=new S(r.y,-r.x),m=p.dot(s.sub(a.center))>0,g=Ga(s,m?p:p.scale(-1),n);h=[new M(s,g),new M(g,l)]}else{let p=new S(i.y,-i.x),m=p.dot(l.sub(c.center))>0,g=Ga(l,m?p:p.scale(-1),n);h=[new M(s,g),new M(g,l)]}}return h}getLimit(t,e,r,i,n,s=!1){let a=t.distance1(r),l=a*.5,c=new M(t,t.add(e.scale(n))),h=new M(r,r.add(i.scale(n))),u=this.getInters(c,h);if(u.length>0){let d=u[0],p=t.distance1(d),m=r.distance1(d),g=Math.min(l,p*.5),y=Math.min(l,m*.5);return[g,y]}else if(s){let d=ir.foot(c,r),p=t.distance1(d);return[Math.min(l,p*.4),a*.2]}else{let d=a*.3;return[d,d]}}getBezier(t){return new Mr(t)}getArc(t,e,r,i=!0){let n=new ro,{center:s,radius:a,startAngle:l,endAngle:c,sweep:h}=n.tangentToArc(t,e,r,i);return q.build2(s,Ht.toDegrees(l),Ht.toDegrees(c),a,a,h)}isStart(t,e){let r=t.start;return Jr.inPolyline(r,e)}isEnd(t,e){let r=t.end;return Jr.inPolyline(r,e)}getLine(t){return t.primitive}getPoints(t,e){let r=new Array;return e&&t.primitives.forEach(i=>{this.getInters(i,e).forEach(s=>{r.push({point:s,refPt:i})})}),r}getInters(t,e){let r=new Array,i={},n=Pf(t,e);if(n>0)for(let s=0;s<n;s+=2){let a=Ke[s],l=Ke[s+1];if(i[String(a)+String(l)])continue;i[String(a)+String(l)]=!0;let c=new S(a,l);r.push(c)}return r}getPointsAndRefPt(t,e){let r=[];return t.primitives.forEach(i=>{this.getInters(i,e).forEach(s=>{let a=r.find(l=>s.equals(l.point));if(a){if(a.refPt.find(l=>l===i||this.getInters(l,i).length>=2||l.start().equals(i.end())||l.end().equals(i.start())))return;a.refPt.push(i)}else r.push({point:s,refPt:[i]})})}),w3e(e,r),r}getLeft(t,e,r){if(e=e/2,t instanceof M){let i=t.direct,n;return r?n=new S(i.y,-i.x).mul(e):n=new S(-i.y,i.x).mul(e),new M(t.start().add(n),t.end().add(n))}else{let{start:i,direct:n}=this.getArcRightDirect(t,r),s=i.sub(n.mul(e)),a=t.center.distance1(s);return a?q.build2(t.center,t.startAngle,t.endAngle(),a,a,t.sweep()):null}}getRight(t,e,r){if(e=e/2,t instanceof M){let i=t.end().sub(t.start()).normalize(),n;return r?n=new S(-i.y,i.x).mul(e):n=new S(i.y,-i.x).mul(e),new M(t.start().add(n),t.end().add(n))}else{let{start:i,direct:n}=this.getArcRightDirect(t,r),s=i.add(n.mul(e)),a=t.center.distance1(s);return a?q.build2(t.center,t.startAngle,t.endAngle(),a,a,t.sweep()):null}}getArcRightDirect(t,e){let r,i,n;return e?(r=t.start(),n=t.sweep()):(r=t.end(),n=t.sweep()===le.CCW?le.CW:le.CCW),n===le.CW?(i=t.center.sub(r).normalize(),i=new S(-i.x,-i.y)):i=t.center.sub(r).normalize(),{start:r,direct:i}}getPoint4Distance(t,e,r,i){if(t instanceof M){let n=t.end().sub(t.start()).normalize();return i?e.distance1(t.end())>r?e.add(n.mul(r)):t.end():e.distance1(t.start())>r?e.add(n.mul(-r)):t.start()}else{let n=Math.abs(r/t.rx),s=e.sub(t.center).normalize(),a=Math.atan2(s.y,s.x),l;i?t.sweep()==le.CCW?l=a+n:l=a-n:t.sweep()==le.CCW?l=a-n:l=a+n,l=(l%Vr+Vr)%Vr/Math.PI*180;let c=t.pointOn(l);return to(t,c)?c:i?t.end():t.start()}}intersBBox(t,e,r,i,n){let s=this.getLimitPoints(t,r,i,n);return s.length==0&&(s=this.interPoints(t,e,e/2,r,i,0,n)),s}getLimitPoints(t,e,r,i){let n=new Array;t.primitives.forEach(a=>{this.getInters(a,r).length>0&&(n.push(a.start()),n.push(a.end()))});let s=null;if(e){if(r instanceof M){let a=0,l=r.end().sub(r.start()).normalize(),c;i?c=new S(l.y,-l.x):c=new S(-l.y,l.x),n.forEach(h=>{let u=ir.foot(r,h),d=h.sub(u);!this.isParallel(l,d)&&c.dot(d)>0&&d.length()>a&&(s=h,a=d.length())})}else if(r instanceof q){let{direct:a,start:l}=this.getArcRightDirect(r,i),c;n.forEach(h=>{let u=h.sub(l).normalize(),d=h.sub(r.center).length();u.dot(a)<0&&(!c||d<c)&&(s=h,c=d)})}}else if(r instanceof M){let a=0,l=r.end().sub(r.start()).normalize(),c;i?c=new S(-l.y,l.x):c=new S(l.y,-l.x),n.forEach(h=>{let u=ir.foot(r,h),d=h.sub(u);!this.isParallel(l,d)&&c.dot(d)>0&&d.length()>a&&(s=h,a=d.length())})}else if(r instanceof q){let{direct:a,start:l}=this.getArcRightDirect(r,i),c;n.forEach(h=>{let u=h.sub(l).normalize(),d=h.sub(r.center).length();u.dot(a)>0&&(!c||d<c)&&(s=h,c=d)})}return s==null?[]:[s]}isParallel(t,e){return ne.eq(Math.abs(t.cross(e)),0)}interPoints(t,e,r,i,n,s,a){let l;i?l=this.getLeft(n,e,a):l=this.getRight(n,e,a);let c=this.getPoints(t,l);if(s<6)if(c.length==0)c=this.interPoints(t,e/2,r/2,i,n,s+1,a);else{let h=this.interPoints(t,e+r,r/2,i,n,s+1,a);h.length>0&&(c=h)}return c}updateProgress2(t){throw new Error("not implemented updateProgress2")}complete2(){this.Switch=!1,this.updateProgress2(1)}interrupt(){this.Switch=!1}};var Qle=class extends Jle{constructor(t){if(super(t),!t.mapData)throw new Error("!data.mapData not exit ---> TearDropWorker.v4");this.map=new Nf(nP(t.mapData))}updateProgress2(t){this.hideProgress||A.publish("progressUpdate",[t,"add tear drop"],$())}};var HYe=nd(jD());var U3e=class extends mY{getScrewPillarSizeInIframe(t){return this.getScrewPillarSize(t)}getTopStiffDistance(t){let{stiffenerProps:e,height:r}=t;if(e){let i=r-e.height;return Math.max(i,0)}return 0}getDefaultScrewHeight(t){let e=LD.getOneOutline();if(e!=null){let r=qo*2,i=e.getComponent(),n=0;switch(i.type){case"T&B":{t===55?n=i.botShellHeight-r:n=i.shellHeight-i.botShellHeight;break}case"DRAWER":{t===55?n=i.shellHeight*2/3-r:n=i.shellHeight;break}}return Math.max(n,V2)}return xM/2}correctAllProps(t){let{height:e,holeDiameter:r,thickness:i,stiffenerProps:n,counterboreProps:s}=t;if(this.correctHeight(e,t),this.correctHoleDiameter(r,t),this.correctThickness(i,t),s){let{height:a,diameter:l}=s;this.correctCounterboreHeight(a,t),this.correctCounterboreDiameter(l,t)}if(n){let{topWidth:a,bottomWidth:l,height:c,stiffThickness:h}=n;this.correctStiffenerTopWidth(a,t),this.correctStiffenerBottomWidth(l,t),this.correctStiffenerHeight(c,t),this.correctStiffenerThickness(h,t)}}correctHeight(t,e){let r=e.height,i=V2,n=this.checkValueRange(t,i);return!n.check&&this.checkValueRange(r,i).check?e.height=r:e.height=n.value,r!==e.height}correctHoleDiameter(t,e){let r=e.holeDiameter,i=this.checkHoleDiameterRange(t,e);return!i.check&&this.checkHoleDiameterRange(r,e).check?e.holeDiameter=r:e.holeDiameter=i.value,r!==e.holeDiameter}correctThickness(t,e){let r=e.thickness,i=this.checkThicknessRange(t,e);return!i.check&&this.checkThicknessRange(r,e).check?e.thickness=r:e.thickness=i.value,r!==e.thickness}correctCounterboreHeight(t,e){var s;let{counterboreProps:r}=e;if(!r)return!1;let i=r.height,n=this.checkCounterboreHeightRange(t,e);return!n.check&&this.checkCounterboreHeightRange(i,e).check?e.updateCounterboreProps({height:i}):e.updateCounterboreProps({height:n.value}),i!==((s=e.counterboreProps)==null?void 0:s.height)}correctCounterboreDiameter(t,e){var s;let{counterboreProps:r}=e;if(!r)return!1;let i=r.diameter,n=this.checkCounterboreDiameterRange(t,e);return!n.check&&this.checkCounterboreDiameterRange(i,e).check?e.updateCounterboreProps({diameter:i}):e.updateCounterboreProps({diameter:n.value}),i!==((s=e.counterboreProps)==null?void 0:s.diameter)}correctStiffenerTopWidth(t,e){var s;let{stiffenerProps:r}=e;if(!r)return!1;let i=r.topWidth,n=this.checkStiffenerTopWidthRange(t,e);return!n.check&&this.checkStiffenerTopWidthRange(i,e).check?e.updateStiffenerProps({topWidth:i}):e.updateStiffenerProps({topWidth:n.value}),i!==((s=e.stiffenerProps)==null?void 0:s.topWidth)}correctStiffenerBottomWidth(t,e){var s;let{stiffenerProps:r}=e;if(!r)return!1;let i=r.bottomWidth,n=this.checkStiffenerBottomWidthRange(t,e);return!n.check&&this.checkStiffenerBottomWidthRange(i,e).check?e.updateStiffenerProps({bottomWidth:i}):e.updateStiffenerProps({bottomWidth:n.value}),i!==((s=e.stiffenerProps)==null?void 0:s.bottomWidth)}correctStiffenerHeight(t,e){var s;let{stiffenerProps:r}=e;if(!r)return!1;let i=r.height,n=this.checkStiffenerHeightRange(t,e);return!n.check&&this.checkStiffenerHeightRange(i,e).check?e.updateStiffenerProps({height:i}):e.updateStiffenerProps({height:n.value}),i!==((s=e.stiffenerProps)==null?void 0:s.height)}correctStiffenerThickness(t,e){var s;let{stiffenerProps:r}=e;if(!r)return!1;let i=r.stiffThickness,n=this.checkStiffenerThicknessRange(t,e);return!n.check&&this.checkStiffenerThicknessRange(i,e).check?e.updateStiffenerProps({stiffThickness:i}):e.updateStiffenerProps({stiffThickness:n.value}),i!==((s=e.stiffenerProps)==null?void 0:s.stiffThickness)}checkHoleDiameterRange(t,e){return this.checkValueRange(t,.01,39.37)}checkThicknessRange(t,e){let r=qo,i=qo*3;return this.checkValueRange(t,r,i)}checkCounterboreHeightRange(t,e){let{height:r,thickness:i}=e,n=0,s=Math.max(this.toFixValues(r,-i),n);return this.checkValueRange(t,n,s)}checkCounterboreDiameterRange(t,e){let{holeDiameter:r}=e,i=r+qo,n=Math.max(r+qo*20,i);return this.checkValueRange(t,i,n)}checkStiffenerTopWidthRange(t,e){let r=qo,i=qo*1e3;return this.checkValueRange(t,r,i)}checkStiffenerBottomWidthRange(t,e){let r=qo,i=qo*1e3;return this.checkValueRange(t,r,i)}checkStiffenerHeightRange(t,e){let{height:r}=e,i=V2,n=Math.max(r,i);return this.checkValueRange(t,i,n)}checkStiffenerThicknessRange(t,e){let r=qo,i=qo*3;return this.checkValueRange(t,r,i)}checkValueRange(t,e,r){let i=xh(e)?Xe(e):-Number.MAX_VALUE,n=xh(r)?Xe(r):Number.MAX_VALUE,s=Xe(t);if(i>n)throw new Error("checkValueRange error params");if(xh(e)){if(s<i)return{check:!1,value:e};t=Math.max(t,e)}if(xh(r)){if(s>n)return{check:!1,value:r};t=Math.min(t,r)}return{check:!0,value:t}}toFixValues(...t){let e=0;return t.forEach(r=>{e+=Xe(r)}),e=parseFloat(e.toString())/10,x.getInstance().unit!="mil"&&(e=new ft().conversion(x.getInstance().unit,"mil",e)),e}},ey=new U3e;function CG(o,t,e=!0){let r=[],i=e?x.getInstance().origin.mul(-1):S.ORIGIN,n=Qe.translate1(i),s=new ft;return t&&(a(["DOCTYPE","PREVIEW","1.0"]),a(["HEAD",{scale:new Di(10,o).ratio}]),Fn($e.getInstance().getfilterPhyLayers(),(y,b)=>l(y,b))),pt.getAllItem().forEach(y=>g(y,0)),Xt.getAllItem().forEach(y=>p(y,0)),Zt.getAllItem().forEach(y=>m(y,0)),r.join(`
`);function a(y){r.push(JSON.stringify(y))}function l(y,b){b.type!=="3D_SHELL_BOTTOM"&&b.type!=="3D_SHELL_OUTLINE"&&b.type!=="3D_SHELL_TOP"||a(["LAYER",parseInt(y),b.type,b.name,3,b.activeColor.toString(),b.activeColor.alpha,b.activeColor.toString(),b.activeColor.alpha])}function c(y){return y=Xe(y),y=s.conversion(x.getInstance().unit,"px(100)",y),y}function h(y,b){let P=y.getComponent(),T={};if(P.type==="T&B"?(T.BottomHeight=c(P.botShellHeight),T.TopInnerHeight=c(P.topInnerHeight),T.BottomInnerHeight=c(P.bottomInnerHeight)):P.type==="DRAWER"&&(P.pushCoverDir===1?T.Direction=[1,0]:P.pushCoverDir===2?T.Direction=[-1,0]:P.pushCoverDir===4?T.Direction=[0,1]:P.pushCoverDir===8&&(T.Direction=[0,-1])),y instanceof nr){let I=y.getUL().add(i);a(["SHELL",y.globalIndex,b,P.type,c(P.shellHeight),P.substrateHeight,c(y.strokeWidth),[["R",I.x,I.y,y.width,y.height,Ht.toDegrees(y.rotation),1,y.cornerRadius*2/Math.min(y.width,y.height)]],T,0])}else a(["SHELL",y.globalIndex,b,P.type,c(P.shellHeight),P.substrateHeight,c(y.strokeWidth),[kC(y.getMathGraphics(),n)],T,0])}function u(y,b){let P=y.getComponent();P.type==="Side"&&!P.lineId||(a(["SHELL_ENTITY",y.globalIndex,b,y.layerId,0,P.slotOption.reduce((T,I)=>T+I,0),P.slotDepth,y.strokeWidth,[kC(y.getMathGraphics(),n)],0]),P.type==="Side"&&a(["CONNECT",P.lineId,[y.globalIndex]]))}function d(y,b){let P=y.getComponent();P.type==="side"&&!P.lineId||(a(["SHELL_ENTITY",y.globalIndex,b,y.layerId,1,P.belong,P.stretchLength,y.strokeWidth,[kC(y.getMathGraphics(),n)],0]),P.type==="side"&&a(["CONNECT",P.lineId,[y.globalIndex]]))}function p(y,b){let{type:P}=y;switch(P){case"3D Shell - Outline":h(y,b);break;case"3D Shell - Top Slot Region":case"3D Shell - Side Slot Region":u(y,b);break;case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":d(y,b);break}}function m(y,b){let{type:P,layerId:T,radius:I}=y;if(!(isNaN(I)||!y.getMathGraphics(T)))switch(P){case"3D Shell - Outline":h(y,b);break;case"3D Shell - Top Slot Region":case"3D Shell - Side Slot Region":u(y,b);break;case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":d(y,b);break;case"3D Shell - Screw Pillar":let E=y.getComponent(),O=y.center.add(i),{counterboreProps:_,stiffenerProps:R}=E;a(["BOSS",y.globalIndex,b,y.layerId,O.x,O.y,E.height,E.thickness,E.holeDiameter,_?[_.height,_.diameter]:null,R?[R.topWidth,R.bottomWidth,ey.getTopStiffDistance(E),R.stiffThickness]:null,0]);break}}function g(y,b){switch(y.type){case"3D Shell - Outline":h(y,b);break;case"3D Shell - Side Datum Line":let P=y.getMathGraphics().primitives[0].multiply3(n);a(["CREASE",y.globalIndex,b,y.layerId,P.start().x,P.start().y,P.end().x,P.end().y,Ste,0]);break;case"3D Shell - Top Slot Region":case"3D Shell - Side Slot Region":u(y,b);break;case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":d(y,b);break}}}var qq=class{constructor(t,e){this.index=t,this.x=(e.minX+e.maxX)/2,this.y=(e.minY+e.maxY)/2,this._bbox=e}bbox(){return this._bbox}},k_=class{constructor(t){this.m_listTask=[];this.m_listDigHole=[];this.m_dictExtend={};this.m_dictHoleExtent={};this.outFpcFill=[];this.m_funEncFPCPolygon=t,this.m_treeHole=new Sd(10),this.m_treeTopHole=new Sd(10),this.m_treeBotHole=new Sd(10)}addTask(t,e){this.m_listTask.push([t,e])}addDigHolePly(t,e=0){for(let r of t){this.m_listDigHole.push(r);let i=this.m_listDigHole.length-1;this.m_treeHole.insert(new qq(i,r.bbox())),this.m_dictHoleExtent[i]=e}}addPad(t,e,r=0){let i=t?this.m_treeTopHole:this.m_treeBotHole;if(r===0)for(let n of e){this.m_listDigHole.push(n);let s=this.m_listDigHole.length-1;i.insert(new qq(s,n.bbox()))}else for(let n of e){this.m_listDigHole.push(n);let s=this.m_listDigHole.length-1;i.insert(new qq(s,n.bbox())),this.m_dictExtend[s]=r}}runTask(){for(let t of this.m_listTask){let I=function(C){return C.material==="Tape"?C.fpcModel:C.material},e=t[0],r=t[1],{type:i,strokeWidth:n,layerId:s}=e,a=s===58?this.m_treeTopHole:this.m_treeBotHole,l=e.getMathGraphics(s);if(!l)continue;let c,h=[];l instanceof Gt?l.items.reduce((C,E)=>{let O=E.bbox().area();if(O>C)return c&&h.push(c.reverse()),c=E,O;h.push(E.reverse())},0):c=l;let u=1,d=c.bbox(),p=d.width(),m=d.height(),g=new ut(d.minX-p/2*u,d.maxX+p/2*u,d.minY-m/2*u,d.maxY+m/2*u),y=this.m_treeHole.search(g);for(let C of y){let E=this.m_listDigHole[C.index];if(!E)continue;E=E.area(.1)<0?E:E.reverse();let O=this.m_dictHoleExtent[C.index];if(O){let _=Af(E,O);if(!_||_.length<=0)continue;for(let R of _)R.items.forEach((v,D)=>{D>0&&(v=v.reverse()),h.push(v)})}else h.push(E)}let b=a.search(g);for(let C of b){let E=this.m_listDigHole[C.index];if(!E)continue;E=E.area(.1)<0?E:E.reverse();let O=this.m_dictExtend[C.index];if(O){let _=Af(E,O);if(!_||_.length<=0)continue;for(let R of _)R.items.forEach((v,D)=>{D>0&&(v=v.reverse()),h.push(v)})}else h.push(E)}let P=[],T=e.getComponent();if(h.length<=0){this.m_funEncFPCPolygon(s,e.globalIndex,[c],r,I(T),T.thickness);continue}if(P=this.boolOperate([c],h),!(!P||P.length<=0))for(let C of P){let E=[];for(let O of C.items)E.push(O);this.m_funEncFPCPolygon(s,e.globalIndex,E,r,I(T),T.thickness)}}}boolOperate(t,e){let r=new Gi(2),i=new dT(!1),n=new FI(Kte.rule,r,i);for(let s of t){let a=Kte.weight(0);n.addPolyline(s,a)}for(let s of e){let a=Kte.weight(1);n.addPolyline(s,a)}if(n.simplify(),i.plGrps.length>0)return i.plGrps;console.error("\u5E03\u5C14\u5931\u8D25")}};k_.FPC_EXPANSION=0;var SG=class o extends Pa{constructor(t,e,r,i,n=""){super(n,t,e),this.type=r,this.outlines=i,this.__bbox=this._bbox()}multiply3(t){return new o(this.net,this.layer,this.type,this.outlines.multiply3(t),this.id)}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outlines:null}};var Z5=class{constructor(){this.triangle=new Array;this.item=null;this.width=0}addItem(t,e){this.item=t,this.width=e}addTriangle(t,e,r){this.triangle.push(t),this.triangle.push(e),this.triangle.push(r)}bbox(){if(this.item!=null){let t=new _e;return t.ext1(this.item.bbox()).ext7(this.width/2),t.build1()}else{let t=new _e;return this.triangle.forEach(e=>{t.ext2(e)}),t.build1()}}};var ece=class o extends Pa{constructor(e,r,i,n,s){super(e,r,i);this.rtree=new nn(50);this.shapeRtree=new nn(50);this.pointInLine=0;this.directs=new Set;if(this.method=n,this.outlines=s,this.method instanceof i_){this.addTriangleItems();let a=new Array;for(let l of s){a.push(l);for(let c of l.primitives)if(this.rtree.add(c),this.method.neckThickness>0){if(c instanceof M||c instanceof q){let u=new Z5;u.addItem(c,this.method.neckThickness),this.shapeRtree.add(u)}let h=c.stroke(this.method.neckThickness,kr.ROUND,le.CW).asClose();a.push(h),h.primitives.forEach(u=>{this.rtree.add(u)})}}this.shapes=new Gt(a)}else if(this.method instanceof JR){let a=new Array;for(let l of this.outlines)for(let c of l.primitives){if(c instanceof M||c instanceof q){let u=new Z5;u.addItem(c,this.method.gridWidth),this.shapeRtree.add(u)}let h=c.stroke(this.method.gridWidth,kr.ROUND,le.CW).asClose();h.primitives.forEach(u=>{this.rtree.add(u)}),a.push(h)}this.shapes=new Gt(a)}this.__bbox=this.calcBBox()}addTriangleItems(){for(let e of this.outlines){let r=new Array;e.points(.05,a=>{r.push(a)});let i=new Array,n=null;for(let a=0;a<r.length-2;a+=2){let l=r[a],c=r[a+1],h=r[a+2],u=new Z5;u.addTriangle(l,c,h),this.shapeRtree.add(u),i.push(l),n=h}r.indexOf(n)==r.length-2&&i.push(n);for(let a=0;a<i.length-2;a+=2){let l=i[a],c=i[a+1],h=i[a+2],u=new Z5;u.addTriangle(l,c,h),this.shapeRtree.add(u),i.push(l)}}}calcBBox(){let e=new _e;for(let r=0;r<this.outlines.length;r++)e.ext1(this.outlines[r].bbox());return e.build1()}inPolygons(e){this.pointInLine=0,this.directs.clear();let r=!1,i=this.shapeRtree.search(e.bbox().extendOfSize(1e-8));for(let n of i){if(n.item!=null){let s=n.item;if(s instanceof M&&s.inArea(e,n.width,kr.ROUND))return!0;if(s instanceof q&&s.inArea(e,n.width))return!0}n.triangle.length>0&&(r=this.getSelect(e,n.triangle[0],n.triangle[1],n.triangle[2],r))}return this.pointInLine/2%2>0&&(r=!r),this.pointInLine=0,r}shape(e,r){return e.equals(this.layer)?this.shapes:null}bbox(){return this.__bbox}multiply3(e){let r=new Array(this.outlines.length);for(let i=0;i<r.length;i++)r[i]=this.outlines[i].multiply3(e);return new o(this.id,this.net,this.layer,this.method,r)}getSelect(e,r,i,n,s){return this.checkEndpoint(e,r,i,n)||this.pointInTriangle(e,r,i,n)&&(s=!s),s}pointInTriangle(e,r,i,n){let s=this.inInner(e,r,i,n),a=this.inInner(e,i,n,r),l=this.inInner(e,n,r,i);if(s>=0&&a>=0&&l>=0&&!(s==0&&a==0&&l==0)){if(s==0||a==0||l==0){let c=null;s==0&&(c=this.getNormal(r,i,n)),a==0&&(c=this.getNormal(i,n,r)),l==0&&(c=this.getNormal(n,r,i));let h=!0;this.directs.forEach(u=>{u.equals(c)&&(h=!1,c=u)}),h?(this.directs.add(c),this.pointInLine++):(this.directs.delete(c),this.pointInLine--)}return!0}return!1}inInner(e,r,i,n){let s=i.sub(r).normalize(),a=n.sub(r).normalize(),l=e.sub(r).normalize(),c=s.cross(l),h=s.cross(a);return c*h}checkEndpoint(e,r,i,n){if(e.y==r.y){if(i.y>e.y&&n.y>e.y||i.y<e.y&&n.y<e.y)return!0}else if(e.y==i.y){if(r.y>e.y&&n.y>e.y||r.y<e.y&&n.y<e.y)return!0}else if(e.y==n.y){if(r.y>e.y&&i.y>e.y||r.y<e.y&&i.y<e.y)return!0}else{if(Math.abs(i.sub(r).cross(n.sub(i)))<1e-8)return!0;if(r.y>e.y&&i.y>e.y&&n.y>e.y)return!0;if(r.y<e.y&&i.y<e.y&&n.y<e.y)return!0}return!1}getNormal(e,r,i){let n=r.sub(e).normalize(),s=i.sub(e),a=new S(-n.y,n.x);return a.mul(s.dot(a)).normalize()}};var EG=class o extends Pa{constructor(t,e,r,i){super(t||"","",e),this.type=r,this.outlines=i,this.__bbox=this._bbox()}multiply3(t){return new o(this.id,this.layer,this.type,this.outlines.multiply3(t))}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outlines:null}};var tce=class o extends Pa{constructor(t,e,r){super("",t,o.checkPlane(e)),this.outline=r}static checkPlane(t){if(t.type===6)return t;throw new Error("plane zone must in plane layer")}multiply3(t){return new o(this.net,this.layer,this.outline.multiply3(t))}bbox(){return this.outline.bbox()}shape(t,e){return this.layer.equals(t)?this.outline:this.layer.equals($r.MULTI)?this.outline:null}};var T9=class{constructor(t,e,r,i){this._keepCollide=!0;this._sourceIndex=-1;this._sourceIndexs=[];this._isObstacle=!1;this.viaName="";this.regionId=null;this.id=t,this.layerId=e,this.shape=r,this.locked=i,this.type=this.getShapeType(r)}get isObstacle(){return this._isObstacle||this.locked}set isObstacle(t){this._isObstacle=t}set sourceIndex(t){this._sourceIndex=t,t>=0&&this._sourceIndexs.indexOf(t)<0&&this._sourceIndexs.push(t)}get sourceIndex(){return this._sourceIndex}getAllSource(){return Array.from(this._sourceIndexs)}set keepCollide(t){(this.type=="Track"||this.type=="ArcTrack"||this.type=="Via"||this.type=="BlindVia")&&(this._keepCollide=t)}get keepCollide(){return this._keepCollide}allowPush(){if(this.locked||this.primitive&&!Bt.checkIsInCanEdit([this.primitive]))return!1;switch(this.type){case"Track":return!0;case"ArcTrack":return!1;default:return!1}}getShapeType(t){return t instanceof Ns?"Track":t instanceof ag?"ArcTrack":t instanceof qy?"BlindVia":t instanceof of?"Outline":t instanceof U1?"BoxShape":t instanceof ece?"Copper":t instanceof Mf?"Line":t instanceof O0?"Pad":t instanceof tce?"PlaneZone":t instanceof S6?"Pour":t instanceof sP?"Prohibit":t instanceof vT?"Region":t instanceof SG?"Constraint":t instanceof $y?"Slot":t instanceof Ll?"Via":t instanceof EG?"Partition":"Shape"}bbox(){return this.shape.bbox()}get primitive(){switch(this.type){case"Track":{let t=this.shape;return new M(t.start,t.end)}case"ArcTrack":return this.shape.arc;default:return null}}};var H3e=class{converts(t,e,r){for(let i of t){let n=this.convert(i);n!=null&&(e.push(n),i instanceof Ye&&i.type==="Constraint Region"&&r&&r.push(i.model))}}convert(t){return t instanceof Ar?this.convertTrack(t):t instanceof Si?this.convertArcTrack(t):t instanceof Ge?this.convertVia(t):t instanceof Le?this.convertPad(t):t instanceof Ye?this.convertProfile(t):t instanceof fr?this.convertText(t):t instanceof Yn?this.convertImage(t):null}convertTrack(t){let e=new Ns(t.net,this.getLayer(t.layerId),t.start,t.end,t.width,t.gId);return new T9(t.globalIndex,t.layerId,e,t.locked||t.getParent()!=null)}convertArcTrack(t){let e=new ag(t.net,this.getLayer(t.layerId),t.primitive,t.width,t.gId);return new T9(t.globalIndex,t.layerId,e,t.locked||t.getParent()!=null)}convertVia(t){if(t.type!==1){let e=new Ll(t.globalIndex,t.net,t.center,t.holeRadius*2,t.radius*2,t.radius*2,t.radius*2,!1,aC(sC(t.unusedInnerLayers)));return new T9(t.globalIndex,12,e,t.locked||t.getParent()!=null)}else{let e=new qy(t.globalIndex,t.net,t.center,t.holeRadius*2,this.getLayer(t.startLayer),t.radius*2,t.radius*2,this.getLayer(t.endLayer),t.radius*2,!1,aC(sC(t.unusedInnerLayers))),r=new T9(t.globalIndex,12,e,t.locked||t.getParent()!=null);return r.viaName=t.name,r}}convertPad(t){let e=null,r=null,i=null,n=null;t instanceof fn?gr(t.layerId)?(e=this.getShape("POLYGON",0,0,0,t.primitives),r=this.getShape("POLYGON",0,0,0,t.primitives),i=this.getShape("POLYGON",0,0,0,t.primitives),n=this.getHoleShape(t)):Io(t.layerId)?e=this.getShape("POLYGON",0,0,0,t.primitives):i=this.getShape("POLYGON",0,0,0,t.primitives):t instanceof Ri&&(gr(t.layerId)?(e=this.getShape(t.topType,t.topWidth,t.topHeight,t.topRatio,null),r=this.getShape(t.innerType,t.innerWidth,t.innerHeight,t.innerRatio,null),i=this.getShape(t.bottomType,t.bottomWidth,t.bottomHeight,t.bottomRatio,null),n=this.getHoleShape(t)):Io(t.layerId)?e=this.getShape(t.topType,t.topWidth,t.topHeight,t.topRatio,null):i=this.getShape(t.bottomType,t.bottomWidth,t.bottomHeight,t.bottomRatio,null));let s=new JI(this.getLayer(t.layerId),e,r,i),a=new O0(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,W2(t.rotation),s,n,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),aC(sC(t.unusedInnerLayers)));return new T9(t.globalIndex,t.layerId,a,t.locked||t.getParent()!=null)}toPadRule(t){if(t==null)return null;let e=t.toJSON();return new E6(e.connectMode,e.lineWidth,e.lineClearance,e.lineAngle)}getShape(t,e,r,i,n){i=i*100;let s;switch(t){case"ELLIPSE":s=new tP(0,e,r,i,null);break;case"OVAL":s=new tP(3,e,r,i,null);break;case"RECT":s=new tP(1,e,r,i,null);break;case"POLYGON":s=new tP(4,e,r,i,fe.build2(n));break}return s}getHoleShape(t){return t.holeShape=="ROUND"?new _T(0,t.holeRadius*2,t.holeLength,W2(t.holeRotation),t.holeOffset.x,t.holeOffset.y):new _T(2,t.holeRadius*2,t.holeLength,W2(t.holeRotation),t.holeOffset.x,t.holeOffset.y)}getType(t){return t instanceof ct?2:t instanceof nr?1:0}getMethod(t){switch(t.style){case"90grid":return new JR(t.gridLineWidth,t.clearance,90);case"45grid":return new JR(t.gridLineWidth,t.clearance,45);case"solid":return t.optimization?new i_(.8):new i_(0);default:return new i_(0)}}convertProfile(t){let e=t.type,r=null;switch(e){case"Line":t.layerId==11?r=new of(t.globalIndex,this.getType(t),t.getMathGraphics(t.layerId,0)):r=new Mf(t.net,this.getLayer(t.layerId),this.getType(t),t.strokeWidth,t.getMathGraphics(t.layerId,0),t.globalIndex);break;case"Copper Region":{let i=te.getInstance().getCopperPlaneByNet(t.net),n=te.getInstance().getSafeSpacingByNet(t.net,13),s=t.layerId,a=t.getComponent(),l=a.order;r=new S6(t.globalIndex,t.net,this.getLayer(t.layerId),this.getMethod(a),n.getClearance(13,11,s),this.getClearanceMap(13,s,n),i.getSingleConnectMode(s)!=1,a.keepIsland,l,!1,t.getMathGraphics(t.layerId,0).primitives,[],a.name);break}case"Prohibited Region":{let i=t.getComponent();r=new sP(t.globalIndex,this.getLayer(t.layerId),this.getType(t),i.copper,i.track,i.device,i.planzone,i.fill,t.getMathGraphics(t.layerId,0));break}case"Partition":{r=new EG(t.globalIndex,this.getLayer(t.layerId),this.getType(t),t.getMathGraphics(t.layerId,0));break}case"Fill Region":{r=new vT(t.net,this.getLayer(t.layerId),this.getType(t),t.getMathGraphics(t.layerId,0));break}case"Constraint Region":{r=new SG(t.net,this.getLayer(t.layerId),this.getType(t),t.getMathGraphics(t.layerId,0));break}case"TearDrop":{r=new vT(t.net,this.getLayer(t.layerId),2,t.getMathGraphics(t.layerId,0));break}case"Board Outline":{r=new of(t.globalIndex,this.getType(t),t.getMathGraphics(t.layerId,0));break}case"Slot Region":{r=new $y(t.globalIndex,this.getType(t),t.getMathGraphics(t.layerId,0));break}}return r!=null?new T9(t.globalIndex,t.layerId,r,t.locked||t.getParent()!=null):null}getClearanceMap(t,e,r){let i=[10,7,15,6,11,8,1,3,2,4,0,5],n={};return i.forEach(s=>{n[s]=r.getClearance(t,s,e)}),n}convertText(t){let e=t.model.box,r=new U1(this.getLayer(t.layerId),e.leftLow,e.leftUp,e.rightLow,e.rightUp,t.globalIndex);return new T9(t.globalIndex,t.layerId,r,t.locked||t.getParent()!=null)}convertImage(t){let e=t.model.box,r=new U1(this.getLayer(t.layerId),e.leftLow,e.leftUp,e.rightLow,e.rightUp,t.globalIndex);return new T9(t.globalIndex,t.layerId,r,t.locked||t.getParent()!=null)}getLayer(t){switch(t){case 1:return $r.TOP_COPPER;case 3:return $r.TOP_SILK;case 5:return $r.TOP_SOLDER_MASK;case 7:return $r.TOP_PASTE;case 2:return $r.BOT_COPPER;case 4:return $r.BOT_SILK;case 6:return $r.BOT_SOLDER_MASK;case 8:return $r.BOT_PASTE;case 11:return $r.OUTLINE;case 12:return $r.MULTI;case 13:return $r.DOCUMENT;default:if(Ms(t)){let e=$e.getInstance().getLayer(t);if(gs(e.type)){let r=t2(t);return new $r(5,r)}else{let r=t2(t);return new $r(6,r)}}else return $r.OTHER}}},W3e=new H3e;var GYe,wxt=/\b3DStreamDebug\b/.test((GYe=$())==null?void 0:GYe.location.search),z3e=!0,tl=new Gi(0),Ia=class{};Ia.LogExport=!1;async function rce(o,t=10*1024*1024,e=1,r=!0,i=!0,n=!0,s=!0,a=ce.pcbConfig.isUsedJLCColorSilk,l=!1,c=!1,h=!1,u=!1,d=ce.pcbConfig.isAutoGenerate3dModel,p={holeAvoid:{isAvoid:!1},solderAvoid:{isAvoid:!1},padAvoid:{isAvoid:!1},viaAvoid:{isAvoid:!1}},m,g){var Zi,Fi,$i,yo,Ha,da,Ic,kp,Cc,Dt,Al;let y="create3DSourceStream-time";pn(y);let b=1*new Di(1,10).ratio,P=s?x.getInstance().origin.mul(-1):S.ORIGIN,T=Qe.translate1(P),I=[],C=0,E=a?{}:null,O={},_=1,R=2,v=5,D=6,w=7,F=8,H=15,z=46,G=12,W=11,L=[],B=new k_(qe);p&&((Zi=p.holeAvoid)!=null&&Zi.ext&&(p.holeAvoid.ext=((Fi=p.holeAvoid)==null?void 0:Fi.ext)*39.37/10),($i=p.padAvoid)!=null&&$i.ext&&(p.padAvoid.ext=((yo=p.padAvoid)==null?void 0:yo.ext)*39.37/10),(Ha=p.solderAvoid)!=null&&Ha.ext&&(p.solderAvoid.ext=((da=p.solderAvoid)==null?void 0:da.ext)*39.37/10),(Ic=p.viaAvoid)!=null&&Ic.ext&&(p.viaAvoid.ext=((kp=p.viaAvoid)==null?void 0:kp.ext)*39.37/10));let N=[],U=0,k=(ht,_t=!1)=>{if(!_t&&(!ht||(U+=ht.length+1,N.push(ht),U<t)))return;let rr=N.join(`
`),Qr=o.write(`${rr}
`);return N.length=0,U=0,Qr},V;V=k(r1(["DOCTYPE","PREVIEW","1.0"])),V instanceof Promise&&await V,V=k(r1(["HEAD",{scale:new Di(10,e).ratio}])),V instanceof Promise&&await V;let Y=$e.getInstance(),X=Number.NEGATIVE_INFINITY;for(let[ht,_t]of Object.entries(Y.getfilterPhyLayers()))X=Math.max(X,parseInt(ht)),V=k(tt(ht,_t)),V instanceof Promise&&await V;let Z={MULTI:G};if(!h){Ia.LogExport&&tl.info1("viaManager start");let ht=Y.getLayer(12);for(let _t of Hr.getAllItem()){let{startLayer:rr,endLayer:Qr}=_t,Vi=Math.min(rr,Qr),jn=Math.max(rr,Qr);if(Vi===_&&jn===R)continue;let wn=`MULTI-${Vi}-${jn}`;Z[wn]||(Z[wn]=++X,V=k(r1(["LAYER",X,wn,wn.toLocaleLowerCase(),3,ht.activeColor.toString(),ht.activeColor.alpha,ht.activeColor.toString(),ht.activeColor.alpha])),V instanceof Promise&&await V)}Ia.LogExport&&tl.info1("viaManager end")}let Q=!1;for(let ht of Y.getLayerPhys())m&&(ht.layerId===v||ht.layerId===D)?(V=k(r1(["LAYER_PHYS",ht.layerId,`solder_mask_${m.color}`,(Cc=m.thickness)!=null?Cc:ht.thickness,ht.permittivity,ht.lossTangent,ht.isKeepIsland])),Q=!0):V=k(Ze(ht)),V instanceof Promise&&await V;!Q&&m&&(V=k(r1(["LAYER_PHYS",v,`solder_mask_${m.color}`,(Dt=m.thickness)!=null?Dt:0])),V=k(r1(["LAYER_PHYS",D,`solder_mask_${m.color}`,(Al=m.thickness)!=null?Al:0])),V instanceof Promise&&await V),a&&(V=Y.getLayer(3)&&k(r1(["SILK_OPTS",3,we.topSilkscreenColor,we.topBoardColor])),V instanceof Promise&&await V,V=Y.getLayer(4)&&k(r1(["SILK_OPTS",4,we.bottomSilkscreenColor,we.bottomBoardColor])),V instanceof Promise&&await V);let ae=null;if(n){let ht=ai.getInstance().getDefaultPanelize();if(ht.success){let _t=Ii.offset,rr=ht.onlyOutline?0:1;for(let Vi=0;Vi<ht.row;Vi++)for(let jn=0;jn<ht.column;jn++)Vi===0&&jn===0||(V=k(r1(["PANELIZE",[1,0,_t.x*jn,0,1,_t.y*Vi],rr])),V instanceof Promise&&await V);V=k(Ie()),V instanceof Promise&&await V;let Qr=Ii.bBox;ae=[kC(fe.build4([Qr.LL(),Qr.LR(),Qr.UR(),Qr.UL(),Qr.LL()]),T)]}}Ia.LogExport&&tl.info1("getSilkItems start");let he=new Set,re=[],se=(function(){return a?(ht,_t)=>he&&he.has(ht)?(re.push(_t),!0):!1:()=>!1})();a&&(Cze(!0).forEach(ht=>O[ht.globalIndex]=ht.silkColor||ht.getParent().silkColor),Cq().forEach(ht=>he.add(ht.globalIndex))),Ia.LogExport&&tl.info1("getSilkItems end");let K=[53,54,55];function me(ht){return c&&!K.includes(ht)||ht===1004}Ia.LogExport&&tl.info1("polygonModelManager start");for(let ht of pt.getAllItem()){if(me(ht.layerId))continue;let _t=it(ht,0);se(ht.globalIndex,_t)||(V=k(_t),V instanceof Promise&&await V)}Ia.LogExport&&tl.info1("polygonModelManager end"),Ia.LogExport&&tl.info1("rectManager start");for(let ht of Xt.getAllItem()){if(me(ht.layerId))continue;let _t=Ut(ht,0);se(ht.globalIndex,_t)||(V=k(_t),V instanceof Promise&&await V)}Ia.LogExport&&tl.info1("rectManager end"),Ia.LogExport&&tl.info1("circleManager start");for(let ht of Zt.getAllItem()){if(me(ht.layerId))continue;let _t=ar(ht,0);se(ht.globalIndex,_t)||(V=k(_t),V instanceof Promise&&await V)}Ia.LogExport&&tl.info1("circleManager end"),Ia.LogExport&&tl.info1("trackManager start");for(let ht of pr.getAllItem()){if(me(ht.layerId))continue;let _t=ye(ht,0);se(ht.globalIndex,_t)||(V=k(_t),V instanceof Promise&&await V)}Ia.LogExport&&tl.info1("trackManager end"),Ia.LogExport&&tl.info1("textManager start");for(let ht of ti.getAllItem()){if(me(ht.layerId))continue;let _t=ke(ht,0);se(ht.globalIndex,_t)||(V=k(_t),V instanceof Promise&&await V)}Ia.LogExport&&tl.info1("textManager end"),Ia.LogExport&&tl.info1("copperManager start");for(let ht of Ei.getAllItem()){let _t=Rr(ht,0);se(ht.globalIndex,_t)||(V=k(_t),V instanceof Promise&&await V)}Ia.LogExport&&tl.info1("copperManager end"),Ia.LogExport&&tl.info1("planeZoneManager start");for(let ht of Qn.getAllItem()){let _t=Dr(ht,0);se(ht.globalIndex,_t)||(V=k(_t),V instanceof Promise&&await V)}Ia.LogExport&&tl.info1("planeZoneManager end"),Ia.LogExport&&tl.info1("imageManager start");for(let ht of Ln.getAllItem()){let _t=Lr(ht,0);se(ht.globalIndex,_t)||(V=k(_t),V instanceof Promise&&await V)}Ia.LogExport&&tl.info1("imageManager end"),Ia.LogExport&&tl.info1("dimensionManager start");for(let ht of Go.getAllItem()){let _t=Wt(ht,0);se(ht.globalIndex,_t)||(V=k(_t),V instanceof Promise&&await V)}Ia.LogExport&&tl.info1("dimensionManager end"),Ia.LogExport&&tl.info1("protractorManager start");for(let ht of is.getAllItem()){let _t=Wt(ht,0);se(ht.globalIndex,_t)||(V=k(_t),V instanceof Promise&&await V)}Ia.LogExport&&tl.info1("protractorManager end"),Ia.LogExport&&tl.info1("radiusManager start");for(let ht of Uo.getAllItem()){let _t=Wt(ht,0);se(ht.globalIndex,_t)||(V=k(_t),V instanceof Promise&&await V)}if(Ia.LogExport&&tl.info1("radiusManager end"),!h){Ia.LogExport&&tl.info1("viaManager start");for(let ht of Hr.getAllItem()){let _t=De(ht,0);se(ht.globalIndex,_t)||(V=k(_t),V instanceof Promise&&await V)}Ia.LogExport&&tl.info1("viaManager end")}Ia.LogExport&&tl.info1("padManager start");for(let ht of Kt.getAllItem()){let _t=ge(ht,0);se(ht.globalIndex,_t)||(V=k(_t),V instanceof Promise&&await V)}if(Ia.LogExport&&tl.info1("padManager end"),Ia.LogExport&&tl.info1("polygonPadManager start"),Ia.LogExport&&tl.info1("polygonPadManager end"),Ia.LogExport&&tl.info1("fpcHandler start"),B.runTask(),B.outFpcFill.length)for(let ht of B.outFpcFill)V=k(ht),V instanceof Promise&&await V;if(B=null,Ia.LogExport&&tl.info1("fpcHandler end"),Ia.LogExport&&tl.info1("trueColorPictureManager start"),a){for(let _t of _o.getAllItem()){let rr=Nr(_t,0);se(_t.globalIndex,rr)||(V=k(rr),V instanceof Promise&&await V)}let ht=[];Cq().forEach(_t=>{var rr;return(rr=E[_t.globalIndex])==null?void 0:rr.forEach(Qr=>ht.push(Qr))}),V=k(r1(["ITEM_ORDER",ht])),V instanceof Promise&&await V;for(let _t of re)V=k(_t),V instanceof Promise&&await V}if(E=null,Ia.LogExport&&tl.info1("trueColorPictureManager end"),C!==0){let ht=UYe(x.getInstance().doctype==23);if(I.length===0||l)V=k(et(W,"",new M(ht.LL(),ht.UL()),b,0)),V instanceof Promise&&await V,V=k(et(W,"",new M(ht.UL(),ht.UR()),b,0)),V instanceof Promise&&await V,V=k(et(W,"",new M(ht.UR(),ht.LR()),b,0)),V instanceof Promise&&await V,V=k(et(W,"",new M(ht.LR(),ht.LL()),b,0)),V instanceof Promise&&await V;else{let _t=(b/2)**2;for(let rr of new oh(ht,2,b,new Gi(4),I).getDeltaLines().filter(Qr=>Qr.start().distance2(Qr.end())>_t))V=k(et(W,"",rr,b,0)),V instanceof Promise&&await V}}if(Ia.LogExport&&tl.info1("withModel start"),r){let ht="";u?ht=(await z3(e,!1,s,u,d,g)).dataStr:ht=await z3(e,!1,s,void 0,void 0,g),wxt&&console.log("===componentDataStr:",ht),V=k(ht),V instanceof Promise&&await V}Ia.LogExport&&tl.info1("withModel end"),Ia.LogExport&&tl.info1("withShell start"),i&&(V=k(CG(e,!1,s)),V instanceof Promise&&await V),Ia.LogExport&&tl.info1("withShell end"),Ia.LogExport&&tl.info1("slotToPanelize start"),V=k(Fe()),V instanceof Promise&&await V,L.length=0,Ia.LogExport&&tl.info1("slotToPanelize end"),await k("",!0),Ia.LogExport&&tl.info1("writeDataStr end"),Bi(y);function Oe(ht){let _t=`e${++C}`;return E&&wy(E,ht).push(_t),_t}function Ie(){let rr=[];for(let Qr of Ii.getClosures())ea(r1(["POLYS",Oe(""),1,"",W,1,Qr.map(Vi=>kC(Vi,T)),0]),rr);for(let Qr of Ii.getOthers())if(Qr instanceof Li)ea(Yt(Qr,2),rr);else if(Qr instanceof ys)ea(et(Qr.layerId,"",new M(Qr.start,Qr.end),Qr.width,2),rr);else if(Qr instanceof Po)ea(de(Qr.layerId,"",Se(Qr.center,Qr.radius),2),rr);else if(Qr instanceof Je)ea(ue(Qr,2),rr);else throw new Error("Unsupported type!");return rr.join(`
`)}function ue(ht,_t){let{center:rr,layerId:Qr,topSolderExpansion:Vi,bottomSolderExpansion:jn}=ht,wn=Qr==1,ta=Qr==2,Na=wn?Vi:jn,{type:Us,width:ra,height:mu}=wn?ht.top:ta?ht.bottom:ht.inner,nc=ra+Na*2,id=mu+Na*2,Sc=[];switch(Us){case"ELLIPSE":{let Pl=ra/2;Pl>0&&(ea(de(_,"",fe.build2([q.build3(rr,0,-360,Pl,Pl)]),_t),Sc),ea(de(R,"",fe.build2([q.build3(rr,0,-360,Pl,Pl)]),_t),Sc));let Fl=nc/2;Fl>0&&(ea(de(v,"",fe.build2([q.build3(rr,0,-360,Fl,Fl)]),_t),Sc),ea(de(D,"",fe.build2([q.build3(rr,0,-360,Fl,Fl)]),_t),Sc));break}case"OVAL":{if(ra===mu){let Pl=ra/2;ea(de(_,"",fe.build2([q.build3(rr,0,-360,Pl,Pl)]),_t),Sc),ea(de(R,"",fe.build2([q.build3(rr,0,-360,Pl,Pl)]),_t),Sc);let Fl=nc/2;ea(de(v,"",fe.build2([q.build3(rr,0,-360,Fl,Fl)]),_t),Sc),ea(de(D,"",fe.build2([q.build3(rr,0,-360,Fl,Fl)]),_t),Sc)}else if(ra>mu){let Pl=(ra-mu)/2,Fl=new M(rr.add1(-Pl,0),rr.add1(Pl,0));ea(et(_,"",Fl,mu,_t),Sc),ea(et(R,"",Fl,mu,_t),Sc);let d1=(nc-id)/2,G0=new M(rr.add1(-d1,0),rr.add1(d1,0));ea(et(v,"",G0,id,_t),Sc),ea(et(D,"",G0,id,_t),Sc)}else{let Pl=(mu-ra)/2,Fl=new M(rr.add1(0,-Pl),rr.add1(0,Pl));ea(et(_,"",Fl,ra,_t),Sc),ea(et(R,"",Fl,ra,_t),Sc);let d1=(id-id)/2,G0=new M(rr.add1(0,-d1),rr.add1(0,d1));ea(et(v,"",G0,nc,_t),Sc),ea(et(D,"",G0,nc,_t),Sc)}break}case"RECT":{let Pl=rr.x,Fl=rr.y,d1=ra/2,G0=mu/2,NP=fe.build5([Pl-d1,Fl+G0,Pl+d1,Fl+G0,Pl+d1,Fl-G0,Pl-d1,Fl-G0]);ea(de(_,"",NP,_t),Sc),ea(de(R,"",NP,_t),Sc);let nI=nc/2,iv=id/2,IH=fe.build5([Pl-nI,Fl+iv,Pl+nI,Fl+iv,Pl+nI,Fl-iv,Pl-nI,Fl-iv]);ea(de(v,"",IH,_t),Sc),ea(de(D,"",IH,_t),Sc);break}case"POLYGON":throw new Error("Does not support polygon!!");default:break}return Sc.join(`
`)}function Pe(ht,_t,rr){var Qr,Vi;(Qr=p==null?void 0:p.padAvoid)!=null&&Qr.isAvoid&&B.addPad(ht,_t,(Vi=rr!=null?rr:p.padAvoid.ext)!=null?Vi:k_.FPC_EXPANSION)}function j(ht,_t,rr){var Qr,Vi;(Qr=p==null?void 0:p.solderAvoid)!=null&&Qr.isAvoid&&B.addPad(ht,_t,(Vi=rr!=null?rr:p.solderAvoid.ext)!=null?Vi:k_.FPC_EXPANSION)}function J(ht,_t){var rr,Qr;(rr=p==null?void 0:p.holeAvoid)!=null&&rr.isAvoid&&B.addDigHolePly(ht,(Qr=_t!=null?_t:p.holeAvoid.ext)!=null?Qr:k_.FPC_EXPANSION)}function oe(ht,_t){var rr,Qr;(rr=p==null?void 0:p.viaAvoid)!=null&&rr.isAvoid&&B.addDigHolePly(ht,(Qr=_t!=null?_t:p.viaAvoid.ext)!=null?Qr:k_.FPC_EXPANSION)}function pe(ht,_t,rr){var ta;let Qr=H<=_t&&_t<=z,Vi,jn;if(_t===_?(Vi=$r.TOP_COPPER,jn=!0):_t===R&&(Vi=$r.BOT_COPPER,jn=!1),(ta=p==null?void 0:p.padAvoid)!=null&&ta.isAvoid&&Vi){let ra=W3e.convertPad(ht).shape.getOutsideShapeWithHole(Vi,0);Pe(jn,ra)}let wn;if(ht instanceof fn){let{topSolderOutline:Na,bottomSolderOutline:Us,topPasteOutline:ra,bottomPasteOutline:mu}=ht;if(_t===_||_t===R||Qr){let nc=ht.getMathGraphics(_t);wn=de(_t,ht.globalIndex,nc,rr)}else if(_t===w&&(ra==null?void 0:ra.length)>0){let nc=fe.build2(ra);wn=de(_t,ht.globalIndex,nc,rr)}else if(_t===F&&(mu==null?void 0:mu.length)>0){let nc=fe.build2(mu);wn=de(_t,ht.globalIndex,nc,rr)}else if(_t===v&&(Na==null?void 0:Na.length)>0){let nc=fe.build2(Na);wn=de(_t,ht.globalIndex,nc,rr)}else if(_t===D&&(Us==null?void 0:Us.length)>0){let nc=fe.build2(Us);wn=de(_t,ht.globalIndex,nc,rr)}}else{let Na,Us,ra,mu,{topType:nc,topWidth:id,topHeight:Sc,topRatio:Pl,bottomType:Fl,bottomWidth:d1,bottomHeight:G0,bottomRatio:NP,innerType:nI,innerWidth:iv,innerHeight:IH,innerRatio:R_e,center:z9,rotation:DK,pasteExpansion:D_e,topSolderExpansion:w_e,bottomSolderExpansion:nv}=ht;if(_t===_||_t==w||_t==v)[Na,Us,ra,mu]=[nc,id,Sc,Pl];else if(_t===R||_t==F||_t==D)[Na,Us,ra,mu]=[Fl,d1,G0,NP];else if(Qr)[Na,Us,ra,mu]=[nI,iv,IH,R_e];else return;let oI=0;switch(_t){case w:case F:oI=D_e;break;case v:oI=w_e;break;case D:oI=nv;break;default:break}if(Us+=oI*2,ra+=oI*2,Us<=0||ra<=0)return;switch(Na){case"ELLIPSE":{let sI=Us/2;sI>0&&(wn=de(_t,ht.globalIndex,fe.build2([q.build3(z9,0,-360,sI,sI)]),rr));break}case"OVAL":{let sI=Qe.rotate(DK).setOrigin1(z9);if(Us===ra){let hO=Us/2;wn=de(_t,ht.globalIndex,fe.build2([q.build3(z9,0,-360,hO,hO)]),rr)}else if(Us>ra){let hO=(Us-ra)/2,wK=new M(z9.add1(-hO,0).multiply3(sI),z9.add1(hO,0).multiply3(sI));wn=et(_t,ht.globalIndex,wK,ra,rr)}else{let hO=(ra-Us)/2,wK=new M(z9.add1(0,-hO).multiply3(sI),z9.add1(0,hO).multiply3(sI));wn=et(_t,ht.globalIndex,wK,Us,rr)}break}case"RECT":{let sI=z9.add(new S(-Us/2,ra/2)).multiply3(Qe.rotate(DK).setOrigin1(z9)).multiply3(T);wn=vr(ht.globalIndex,rr,_t,[["R",sI.x,sI.y,Us,ra,Ht.toDegrees(DK),0,Math.max((Math.min(Us,ra)/2-oI)*mu+oI,0)/(Math.min(Us,ra)/2)]]);break}case"POLYGON":throw new Error("Does not support polygon!!");default:break}}return wn}function ge(ht,_t){let{layerId:rr}=ht,Qr=[];if((rr===G||rr===_)&&(ea(pe(ht,_,_t),Qr),ea(pe(ht,v,_t),Qr),rr!==G&&ea(pe(ht,w,_t),Qr)),(rr===G||rr===R)&&(ea(pe(ht,R,_t),Qr),ea(pe(ht,D,_t),Qr),rr!==G&&ea(pe(ht,F,_t),Qr)),rr===G){for(let nc=H;nc<=z;nc++){let id=Y.getLayer(nc);id&&id.config&&!ht.unusedInnerLayers.includes(nc)&&ea(pe(ht,nc,_t),Qr)}let{center:Vi,rotation:jn,holeShape:wn,holeLength:ta,holeOffset:Na,holeRadius:Us,holeRotation:ra}=ht,mu=Us*2;if(Us>0){let nc=Qe.rotate(ra).translate1(Na).rotate(jn).translate1(Vi);switch(wn){case"SLOT":let id=ta/2-Us,Sc=new M(new S(-id,0),new S(id,0)).multiply3(nc);ea(et(G,ht.globalIndex,Sc,Us*2,_t),Qr);break;case"RECT":case"ROUND":let Pl=mu/2,Fl=q.build3(S.ORIGIN,0,-360,Pl,Pl).multiply3(nc);ea(de(G,ht.globalIndex,fe.build2([Fl]),_t),Qr);break;default:break}}}return Qr.join(`
`)}function Se(ht,_t){let rr=q.build3(ht,0,-360,_t,_t);return fe.build2([rr])}function De(ht,_t){var d1;let{center:rr,radius:Qr,holeRadius:Vi,topExpansion:jn,bottomExpansion:wn,startLayer:ta,endLayer:Na}=ht,Us,ra,mu,nc;if(ta===_||Na===_?(Us=_,mu=$r.TOP_COPPER):(Us=Number.POSITIVE_INFINITY,ta!==R&&(Us=Math.min(Us,ta)),Na!==R&&(Us=Math.min(Us,Na))),ta===R||Na===R?(ra=R,nc=$r.BOT_COPPER):ra=Math.max(ta,Na),(d1=p==null?void 0:p.viaAvoid)!=null&&d1.isAvoid&&(mu||nc)){let NP=W3e.convertVia(ht).shape;if(mu){let nI=NP.getOutsideShapeWithHole(mu,0);oe([nI])}if(nc){let nI=NP.getOutsideShapeWithHole(nc,0);oe([nI])}}let id=[],Sc=Se(rr,Qr),Pl=H,Fl=z;Us===_?ea(de(_,ht.globalIndex,Sc,_t),id):Pl=Us,ra===R?ea(de(R,ht.globalIndex,Sc,_t),id):Fl=ra;for(let G0=Pl;G0<=Fl;G0++){let NP=Y.getLayer(G0);NP&&NP.config&&!ht.unusedInnerLayers.includes(G0)&&ea(de(G0,ht.globalIndex,Sc,_t),id)}return Us===_&&Qr+jn>0&&ea(de(v,ht.globalIndex,Se(rr,Qr+jn),_t),id),ra===R&&Qr+wn>0&&ea(de(D,ht.globalIndex,Se(rr,Qr+wn),_t),id),ea(de(Us===_&&ra===R?G:Z[`MULTI-${Math.min(ta,Na)}-${Math.max(ta,Na)}`],ht.globalIndex,Se(rr,Vi),_t),id),id.join(`
`)}function tt(ht,_t){return r1(["LAYER",parseInt(ht),_t.type==="PLANE"?"SIGNAL":_t.type,_t.name,3,_t.activeColor.toString(),_t.activeColor.alpha,_t.activeColor.toString(),_t.activeColor.alpha])}function Ze(ht){return r1(["LAYER_PHYS",ht.layerId,ht.material,ht.thickness,ht.permittivity,ht.lossTangent,ht.isKeepIsland])}function Wt(ht,_t){let{layerId:rr,width:Qr}=ht;if(Qr){let Vi=[];for(let jn of ht.getBaseGraphics())ea(bt(rr,ht.globalIndex,jn,Qr,_t),Vi);return Vi.join(`
`)}}function Nr(ht,_t){let rr=ht.model.box,Qr=[rr.leftLow.x+P.x,rr.leftLow.y+P.y,rr.leftUp.x+P.x,rr.leftUp.y+P.y,rr.rightUp.x+P.x,rr.rightUp.y+P.y,rr.rightLow.x+P.x,rr.rightLow.y+P.y];return r1(["TEXTURE",Oe(ht.globalIndex),_t,"blob:"+ht.hashId,ht.layerId,Qr,0,ae])}function Lr(ht,_t){return lt(ht.layerId,ht.globalIndex,ht.getRealPath(),_t)}function Dr(ht,_t){return lt(ht.layerId,ht.globalIndex,ht.getOutline(),_t)}function Rr(ht,_t){let{layerId:rr,optimizationWidth:Qr,gridLineWidth:Vi,optimization:jn}=ht,wn=ht.getOutline(),ta=[];if(ht.isSolid){if(ea(lt(rr,ht.globalIndex,wn,_t),ta),jn)for(let Na of wn)ea(zt(rr,ht.globalIndex,Na,Qr,_t),ta)}else for(let Na of wn)ea(zt(rr,ht.globalIndex,Na,Vi,_t),ta);return ta.join(`
`)}function ke(ht,_t){let rr=ht.layerId;if(ht.model.type==0){let Qr=[],Vi=ht.strokeWidth;for(let jn of ht.getTextOutline())if(jn instanceof fe)for(let wn of jn.primitives)ea(Ne(rr,ht.globalIndex,wn,Vi,_t),Qr);return Qr.join(`
`)}else return lt(rr,ht.globalIndex,ht.getTextOutline(),_t)}function Yt(ht,_t){let rr=ht.layerId;if(ht.type==0){let Qr=[],Vi=ht.strokeWidth;for(let jn of ht.getTextOutline())if(jn instanceof fe)for(let wn of jn.primitives)ea(Ne(rr,ht.globalIndex,wn,Vi,_t),Qr);return Qr.join(`
`)}else return lt(rr,ht.globalIndex,ht.getTextOutline(),_t)}function Ut(ht,_t){let{layerId:rr,type:Qr,strokeWidth:Vi}=ht;if(!Y.getLayer(rr).config)return;let jn;switch(Qr){case"Line":if(Rh(Y.getLayer(rr).type))return;case"Board Outline":jn=zt(rr,ht.globalIndex,ht.getMathGraphics(rr),Vi,_t);break;case"Fill Region":case"Slot Region":let wn=ht.globalIndex,ta=ht.getMathGraphics(rr);jn=de(rr,wn,ta,_t),Qr==="Slot Region"&&(L.push({layerId:rr,globalIndex:wn,pl:ta}),J([ht.getMathGraphics(rr)]));break;case"FPC Stiffener":B.addTask(ht,_t);break}return jn}function ar(ht,_t){let{type:rr,strokeWidth:Qr,layerId:Vi,radius:jn}=ht;if(isNaN(jn)||!Y.getLayer(Vi).config)return;let wn=ht.getMathGraphics(Vi);if(!wn)return;let ta;switch(rr){case"Line":if(Rh(Y.getLayer(Vi).type))return;case"Board Outline":ta=zt(Vi,ht.globalIndex,wn,Qr,_t);break;case"Fill Region":case"Slot Region":let Na=ht.globalIndex;ta=de(Vi,Na,wn,_t),rr==="Slot Region"&&(L.push({layerId:Vi,globalIndex:Na,pl:wn}),J([wn]));break;case"FPC Stiffener":B.addTask(ht,_t);break}return ta}function Fe(){if(n&&L.length){let ht=ai.getInstance().getDefaultPanelize();if(ht.success){let _t=Ii.offset,rr=[];for(let Qr=0;Qr<ht.row;Qr++)for(let Vi=0;Vi<ht.column;Vi++){if(Qr===0&&Vi===0)continue;let jn=Qe.translate(_t.x*Vi,_t.y*Qr);for(let wn of L){let{layerId:ta,globalIndex:Na,pl:Us}=wn;Us instanceof Gt?ea(lt(ta,Na,Us.items.map(ra=>ra.multiply3(jn)),2),rr):ea(de(ta,Na,Us.multiply3(jn),2),rr)}}return rr.join(`
`)}}}function it(ht,_t){if(!Y.getLayer(ht.layerId).config)return;let rr;switch(ht.type){case"Line":if(Rh(Y.getLayer(ht.layerId).type))return;case"Board Outline":rr=zt(ht.layerId,ht.globalIndex,ht.getMathGraphics(),ht.strokeWidth,_t);break;case"Fill Region":case"Slot Region":let Qr=ht.layerId,Vi=ht.globalIndex,jn=ht.getMathGraphics();if(jn instanceof Gt){let wn=jn.getOutMostPolyline(),ta=jn.items.filter(Na=>Na!=wn);ht.type==="Slot Region"&&(L.push({layerId:Qr,globalIndex:Vi,pl:new Gt([].concat([wn],ta))}),J([].concat([wn],ta))),rr=lt(Qr,Vi,[].concat([wn],ta),_t)}else ht.type==="Slot Region"&&(L.push({layerId:Qr,globalIndex:Vi,pl:jn}),J([jn])),rr=de(Qr,Vi,jn,_t);break;case"FPC Stiffener":B.addTask(ht,_t);break;case"TearDrop":rr=de(ht.layerId,ht.globalIndex,ht.getMathGraphics(ht.layerId),_t);break}return rr}function ye(ht,_t){return Ne(ht.layerId,ht.globalIndex,ht.primitive,ht.width,_t)}function bt(ht,_t,rr,Qr,Vi){return zt(ht,_t,fe.build2(rr),Qr,Vi)}function zt(ht,_t,rr,Qr,Vi){if(ht===W){for(let jn of rr.primitives)I.push(jn);z3e&&(Qr=b)}else(ht===v||ht===D)&&j(ht===v,[rr]);return dr(_t,Vi,ht,Qr,kC(rr,T))}function de(ht,_t,rr,Qr){if(ht===W)for(let Vi of rr.primitives)I.push(Vi);else(ht===v||ht===D)&&j(ht===v,[rr]);return vr(_t,Qr,ht,[kC(rr,T)])}function qe(ht,_t,rr,Qr,Vi,jn){if(ht===W)for(let wn of rr)for(let ta of wn.primitives)I.push(ta);B.outFpcFill.push(Zr(_t,Qr,ht,rr.map(wn=>kC(wn,T)),Vi,jn))}function lt(ht,_t,rr,Qr){if(ht===W)for(let Vi of rr)for(let jn of Vi.primitives)I.push(jn);return vr(_t,Qr,ht,rr.map(Vi=>kC(Vi,T)))}function Ne(ht,_t,rr,Qr,Vi){if(rr instanceof M)return et(ht,_t,rr,Qr,Vi);if(rr instanceof q)return At(ht,_t,rr,Qr,Vi);{let jn=[];return rr.points(.1).reduce((wn,ta)=>(ta.equals(wn)||jn.push(et(ht,_t,new M(wn,ta),Qr,Vi)),ta)),jn.join(`
`)}}function et(ht,_t,rr,Qr,Vi){return ht===W&&(Vi===0&&I.push(rr),z3e&&(Qr=b)),rr=rr.multiply3(T),dr(_t,Vi,ht,Qr,[rr.start().x,rr.start().y,"L",rr.end().x,rr.end().y])}function At(ht,_t,rr,Qr,Vi){return ht===W&&(I.push(rr),z3e&&(Qr=b)),rr=rr.multiply3(T),dr(_t,Vi,ht,Qr,Math.abs(rr.sweepAngle)<360?[rr.start().x,rr.start().y,"ARC",rr.sweepAngle,rr.end().x,rr.end().y]:["CIRCLE",rr.center.x,rr.center.y,rr.rx])}function dr(ht,_t,rr,Qr,Vi){let jn=Oe(ht),wn=r1(["POLY",jn,_t,"",rr,Qr,Vi,0]),ta=xi(ht,jn);return[wn,ta].join(`
`)}function vr(ht,_t,rr,Qr){let Vi=Oe(ht),jn=r1(["FILL",Vi,_t,"",rr,0,0,Qr,0]),wn=xi(ht,Vi);return[jn,wn].join(`
`)}function Zr(ht,_t,rr,Qr,Vi,jn){let wn=Oe(ht),ta=r1(["FPC_FILL",wn,_t,rr,Vi,jn,Qr,0]),Na=xi(ht,wn);return[ta,Na].join(`
`)}function xi(ht,_t){let rr="";return O[ht]&&(rr=r1(["PROP",_t,O[ht].toString()])),rr}}function ea(o,t){o&&t.push(o)}function r1(o){return JSON.stringify(o)}function kC(o,t){let e=0;return o.multiply3(t).primitives.reduce((r,i)=>(i instanceof M||i instanceof q&&i.rx===i.ry?r.push(i):i.points(.1).reduce((n,s)=>(s.equals(n)||r.push(new M(n,s)),s)),r),[]).reduce((r,i)=>{if(i instanceof M){switch(e){case 0:r.push(i.start().x,i.start().y,"L",i.end().x,i.end().y);break;case 1:r.push(i.end().x,i.end().y);break;default:r.push("L",i.end().x,i.end().y)}e=1}else if(i instanceof q){if(o.primitives.length>1||Math.abs(i.sweepAngle)<360)switch(e){case 0:r.push(i.start().x,i.start().y,"ARC",i.sweepAngle,i.end().x,i.end().y);break;case 2:r.push(i.sweepAngle,i.end().x,i.end().y);break;default:r.push("ARC",i.sweepAngle,i.end().x,i.end().y)}else r.push("CIRCLE",i.center.x,i.center.y,i.rx);e=2}return r},[])}function Y3e(){let o="create3DBlobSource-time";pn(o);let t=Yd.getAllItem(),e=new Array;e.push('["DOCTYPE", "BLOB", "1.0"]');for(let r of t)e.push(`["BLOB","${r.hashId}","${r.fileName}","${r.source.src}"]`);return Bi(o),e.join(`
`)}async function z3(o,t,e=!0,r=!1,i,n){let s=1,a=9,l=10,c=[];if(t){P(["DOCTYPE","PREVIEW","1.0"]),P(["HEAD",{scale:new Di(10,o).ratio}]);for(let T of[a,l]){let I=$e.getInstance().getLayer(T);P(["LAYER",T,I.type,I.name,3,I.activeColor.toString(),I.activeColor.alpha,I.activeColor.toString(),I.activeColor.alpha])}}let h=await $q();console.debug("components 2 model",h);let u=e?x.getInstance().origin.mul(-1):S.ORIGIN,d=[],p=[],m=[],g=n?Object.entries(n):null,y=T=>g?g.some(([I,C])=>{let E=T.attrKeyValue[I];return E?E.indexOf(C)!==-1:!1}):!1;Cr.getAllItem().forEach(T=>{var F;if(y(T))return;let C=T.attrKeyValue["3D Model Title"]?T.attrKeyValue["3D Model"]:"",E=T.attrKeyValue["3D Model Transform"];console.debug("handling 3d model",T.globalIndex,"compoent",C,"with",E);let{uuid:O,path:_}=OG(C),R=C?h[`${O}|${_}`]:"",v=((F=Ji.getItem(T.footprintUUID))==null?void 0:F.getBBox())||T.model.bbox,D=T.attrKeyValue.Height,w=0;if(!Number.isNaN(parseFloat(D))){let H=D.replace(/MIL|MM/gi,W=>W.toLowerCase()),z=/(\d+(\.\d+)?)(\s*)(mm|mil)/.exec(H);z||(z=/\b\d+(\.\d+)?\b/.exec(H));let G=z[0];w=+G||Bs(G,"mil")||0}if(w=isNaN(w)?0:w/10,R||i&&w>0){R?d.push(T.globalIndex):m.push(T.globalIndex);let H,z;if(w){let B=Lxt(T);B&&(z=[[kC(B,Qe.ORIGIN)]])}if(E&&E.trim().startsWith("v2:")){let B=JSON.parse(E.trim().slice(3)),U=new Ae([B[0],B[1],B[2],0,B[3],B[4],B[5],0,B[6],B[7],B[8],0,B[9],B[10],B[11],1]).scale(1/10).data;H={uuid:R||"default_model",dx:v.width(),dy:v.height(),dz:w,transformV2:JSON.stringify([U[0],U[1],U[2],U[4],U[5],U[6],U[8],U[9],U[10],U[12],U[13],U[14]]),outline:z,path:_}}else{let B=E?E.split(",").map(k=>parseFloat(k)):new Array(9).fill(0),N=Ji.getItem(T.footprintUUID).getOrigin(),U=R&&(B[0]||B[1]||B[2]);H={uuid:R||"default_model",dx:U?B[0]/10:v.width(),dy:U?B[1]/10:v.height(),dz:U?B[2]/10:w,rz:B[3],rx:B[4],ry:B[5],x:B[6]/10-N.x,y:B[7]/10-N.y,z:B[8]/10,outline:z,height:w,path:_}}(!R||!E)&&Object.assign(H,{rz:0,rx:0,ry:0,x:0,y:0,z:0}),H.Footprint=T.attrKeyValue.Footprint,H.Designator=T.attrKeyValue.Designator,H.Device=T.attrKeyValue.Device,H["3D Model Title"]=T.attrKeyValue["3D Model Title"];let W=T.layerId===s?a:l,L=T.position.add(u);P(["COMPONENT",T.globalIndex,0,W,L.x,L.y,Ht.toDegrees(T.layerId===s?T.rotation:(3*Math.PI-T.rotation)%(2*Math.PI)),H,0])}else p.push(T.globalIndex)});let b=c.join(`
`);if(console.debug("export components",b),r)return{dataStr:b,normalComponentIndexs:d,generatedComponentIndexs:m,unboundComponentIndexs:p};return b;function P(T){c.push(JSON.stringify(T))}}async function $q(){let o=new Set;Cr.getAllItem().forEach(e=>{e.attrKeyValue["3D Model Title"]&&e.attrKeyValue["3D Model"]&&o.add(e.attrKeyValue["3D Model"])});let t={};for(let e of o){let{uuid:r,path:i}=OG(e),n=(await A.windowBridge.rpcCall("ui/getD3ModelItem",{d3modelPath:i,d3modelUuid:r},$())).message;if(n&&n.dataStr){let s=n.dataStr;t[`${r}|${i}`]=JSON.parse(s).model}else/^[^|]+\.ste?p\|[^|]+$/i.test(e)?t[`${r}|${i}`]=e:t[`${r}|${i}`]=r}return t}function OG(o){let[t,e]=(o==null?void 0:o.split("|"))||[];return{uuid:t,path:e||"0819f05c4eef4c71ace90d822a990e87"}}function Lxt(o){let t=new Array,e=[],r=o.layerId==2;r&&(o.layerId=1);for(let s of o.getSilkLines())s instanceof nr||s instanceof Sr?t.push(s.getMathGraphics()):s instanceof ct&&(s.isClose()?t.push(s.getMathGraphics()):e.push(s));if(e.length){let s=Mxt(e);s&&t.push(s)}let i,n=0;for(let s of t){let a=s.bbox().area();a>n&&(i=s,n=a)}if(i&&o.getPads().every(l=>{let c=l.getMathGraphics();return new Fs(c,i,0).relation==2})){let l=Qe.translate1(o.position.mul(-1)).rotate(-o.rotation);return r&&(o.layerId=2),i.multiply3(l)}return r&&(o.layerId=2),null}function Mxt(o){let t=new _e;for(let s of o)t.ext1(s.buildBBox());let e=t.build(),r=[];o.forEach(s=>Re.addAll(r,s.getMathGraphics().primitives));let n=new oh(e,2,.1,new Gi(4),r).detect();if(n&&n.bbox().area()<=e.area())return n.items[0]}var ice=class{constructor(){this.endFlag="END";this.IDFVersion="3.0";this.originFlag="EasyEDA Pro ";this.editorVersion="";this.content=[];this.tempFile="";this.lineItems=[];this.groupsItems=[];this.pcbName="";this.SPACE="  ";this.NEWLINE=`
`;this.zip=new HYe.default;this.projectName="";this.fileName="";this.unit="THOU";this.precision=1;this.libData=new Map;this.offsetArr=[];this.init()}init(){this.editorVersion=x.getInstance().editorVersion,this.pcbName=x.getInstance().name,this.projectName=x.getInstance().projectTitle;let t=this.getCurrentTimeFormatted("-"),e=`IDF-3.0_${this.pcbName}_${this.projectName}_${t}`;this.fileName=e,this.unit=x.getInstance().unit=="mil"?"THOU":"MM",this.precision=this.unit=="THOU"?1:3,this.matrix=Qe.translate1(S.ORIGIN.sub(x.getInstance().origin)),this.panelizeDefaultParam=this.getDefaultPanelize(),this.panelizeDefaultParam.on&&this.panelizeDefaultParam.success&&(this.offsetArr=this.getOffsetArr())}getDefaultPanelize(){let t=ai.getInstance().getDefaultPanelize();return{on:t.on,success:t.success,row:t.row,column:t.column,rowSpacing:t.rowSpacing,columnSpacing:t.columnSpacing,onlyOutline:t.onlyOutline,singleBBox:ai.getInstance().singleBBox,outerBBox:ai.getInstance().outerBBox,offset:ai.getInstance().offset}}getOffsetArr(){let t=[];if(this.panelizeDefaultParam.on&&this.panelizeDefaultParam.success){let{row:e,column:r,offset:i}=this.panelizeDefaultParam;for(let n=0;n<e;n++)for(let s=0;s<r;s++){if(n===0&&s===0)continue;let a=new S(i.x*s,i.y*n),l=Xs.conversion("mil",x.getInstance().unit,a.x*10).toFixed(this.precision),c=Xs.conversion("mil",x.getInstance().unit,a.y*10).toFixed(this.precision),h=new S(+l,+c);t.push(h)}}return t}panelizeCraft(t,e,r){let i=ai.getInstance().getClosures();for(let h of i)for(let u of h)this.addDataItem(t),this.addDataItem("UNOWNED",!0),this.addDataItem(e,!0,10),u=u.multiply3(this.matrix),this.handlePolygonItem(u,0),this.addDataItem(r,!0),this.groupsToContent();let n=ai.getInstance().positionHoles;this.addDataItem(".DRILLED_HOLES",!0);let a=ai.getInstance().stampGroups,l=n.concat(...a);for(let h of l)this.padOrViaData(h.radius,h.center,"NPTH",null,"Other");let c=`.${this.endFlag}_DRILLED_HOLES`;this.addDataItem(c,!0),this.groupsToContent()}panelizeData(t,e,r,i){let n=1;for(let s of this.offsetArr){for(let a of t)a.forEach((l,c)=>{if(this.getConditionByType(e,a.length-1,c))l=l.map((h,u)=>(e=="PLACEMENT"&&c%2!==0&&c!==a.length-1&&u==l.length-1&&(h=h+`_${n}`),h)),this.addData(l);else{let u=new S(l[r],l[i]).multiply3(Qe.translate1(s)),d=[];l.forEach((p,m)=>{m==r?d.push(u.x.toFixed(this.precision)):m==i?d.push(u.y.toFixed(this.precision)):(e=="DRILLED_HOLES"&&m==7&&p!=="BOARD"&&(p=p+`_${n}`),d.push(p))}),this.addData(d)}});n++}}getConditionByType(t,e,r){switch(t){case"BOARD_OUTLINE":case"ROUTE_KEEPOUT":return[0,1,e].includes(r);case"DRILLED_HOLES":return[0,e].includes(r);case"PLACEMENT":return[0,e].includes(r)||r%2!==0;default:return[0,e].includes(r)}}addData(t){this.content.push(t)}addGroupData(t){this.groupsItems.push(t)}addDataItem(t,e=!1,r=0){r&&this.lineItems.push("".padStart(r,this.SPACE));let i=t;this.lineItems.push(i),e&&(this.addGroupData(this.lineItems),this.lineItems=[])}groupsToContent(){for(let t of this.groupsItems)this.addData(t);this.groupsItems=[]}generateHeader(t){this.addDataItem(".HEADER",!0);let r=t,i=this.getCurrentTimeFormatted(":"),n="1";this.addDataItem(r),this.addDataItem(this.IDFVersion,!1,10);let s=`"${this.originFlag}${this.editorVersion}"`;this.addDataItem(s),this.addDataItem(i),this.addDataItem(n,!0),t=="BOARD_FILE"&&(this.addDataItem(this.formatName(this.pcbName)),this.addDataItem(this.unit,!0));let a=`.${this.endFlag}_HEADER`;this.addDataItem(a,!0),this.groupsToContent()}generateOutlineProfile(){let t=".BOARD_OUTLINE",r=be.getLayerPhys().reduce((a,l)=>(a+=l.thickness*10,a),0);r=this.toFixedByUnit(r);let i=`.${this.endFlag}_BOARD_OUTLINE`,n=this.outlineGrouping(),s=this.generateOutlineDataByList(n,t,r,i);this.panelizeDefaultParam.on&&this.panelizeDefaultParam.success&&(this.panelizeCraft(t,r,i),this.offsetArr.length&&this.panelizeData(s,"BOARD_OUTLINE",2,4))}generateOutlineDataByList(t,e,r,i){let n=[];for(let s of t){this.addDataItem(e),this.addDataItem("UNOWNED",!0),this.addDataItem(r,!0,10);let a=s[0],l=s.slice(1),c=1;this.handleItemOutline(a,0);for(let h of l)this.handleItemOutline(h,c),c++;this.addDataItem(i,!0),n.push([...this.groupsItems]),this.groupsToContent()}return n}outlineGrouping(){let t=[],e=this.getSlotRegion(),r=uu();r=r.sort((n,s)=>s.bbox.area()-n.bbox.area());let i=n=>{let a=n.splice(0,1)[0];if(!a)return t;let l=[a],c=[];n.forEach(h=>{h.bbox.isSeparated(a.bbox)?c.push(h):l.push(h)});for(let h=0;h<e.length;h++){let u=e[h];u.bbox.isSeparated(a.bbox)||(l.push(u),e.splice(h,1),h--)}t.push(l),c.length&&i(c)};return i(r),t}getSlotRegion(){let t=Mi.getInstance().getAllItem().filter(n=>n.type=="Slot Region"&&!n.isEmpty),e=rn.getInstance().getAllItem().filter(n=>n.type=="Slot Region"&&!n.isEmpty),r=zi.getInstance().getAllItem().filter(n=>n.type=="Slot Region"&&!n.isEmpty),i=[];return Re.addAll(i,t),Re.addAll(i,e),Re.addAll(i,r),i}handleItemOutline(t,e){if(t instanceof Po){let r=t.center,i=t.radius,n=r.add1(i,0),s=[r,n];e==null&&(e=t.getMathGraphics().area(.1)>0?0:1);for(let a=0;a<s.length;a++){let l=s[a].multiply3(this.matrix);this.handleAddDataItem(e,l.x,l.y,a>0?360:0)}}else if(t instanceof ss||t instanceof Aa){let r=t.getMathGraphics();if(r instanceof fe)e==null&&(e=r.area(.1)>0?0:1),r=r.multiply3(this.matrix),this.handlePolygonItem(r,e);else for(let i of r.items)e==null&&(e=i.area(.1)>0?0:1),i=i.multiply3(this.matrix),this.handlePolygonItem(i,e)}}handlePolygonItem(t,e){let r=t.area(.1)>0;!!e==r&&(t=t.reverse()),this.handlePolygonData(t,e)}handlePolygonData(t,e){for(let r=0;r<t.primitives.length;r++){let i=t.primitives[r],n=i.end();if(i instanceof M)this.handleAddDataItem(e,n.x,n.y,0),r==t.primitives.length-1&&this.asClose(t,e);else if(i instanceof q){if(t.primitives.length==1&&i.start().equals1(i.end())&&i.rx>0){let a=[i.center,n];for(let l=0;l<a.length;l++){let c=a[l];this.handleAddDataItem(e,c.x,c.y,l>0?360:0)}continue}this.handleAddDataItem(e,n.x,n.y,i.sweepAngle),r==t.primitives.length-1&&this.asClose(t,e)}}}asClose(t,e){let r=t.primitives[0],i=r.end(),n=0;r instanceof M?n=0:r instanceof q&&(n=r.sweepAngle),this.handleAddDataItem(e,i.x,i.y,n)}handleAddDataItem(t,e,r,i){this.addDataItem(t),this.addDataItem(this.toFixedByUnit(e*10),!1,10),this.addDataItem(this.toFixedByUnit(r*10),!1,10),this.addDataItem(this.toFixedByUnit(i,3,"mil"),!0,10)}generateRouteKeepOutProfile(){let t=this.getProhibitArea(),e=[];for(let[r,i]of t){if(r=="track")for(let n of i){this.addDataItem(".ROUTE_KEEPOUT"),this.addDataItem("ECAD",!0);let a=this.getLayer(n.layerId,r);this.addDataItem(a,!0),this.handleItemOutline(n);let l=`.${this.endFlag}_ROUTE_KEEPOUT`;this.addDataItem(l,!0),e.push([...this.groupsItems]),this.groupsToContent()}if(r=="device")for(let n of i){if(Ms(n.layerId))continue;this.addDataItem(".PLACE_KEEPOUT"),this.addDataItem("ECAD",!0);let a=this.getLayer(n.layerId,r);this.addDataItem(a),this.addDataItem("0.0",!0,10),this.handleItemOutline(n);let l=`.${this.endFlag}_PLACE_KEEPOUT`;this.addDataItem(l,!0),e.push([...this.groupsItems]),this.groupsToContent()}}!this.panelizeDefaultParam.onlyOutline&&this.offsetArr.length&&this.panelizeData(e,"ROUTE_KEEPOUT",2,4)}getProhibitArea(){let t=Mi.getInstance().getAllItem().filter(l=>l.type=="Prohibited Region"&&!l.isEmpty),e=rn.getInstance().getAllItem().filter(l=>l.type=="Prohibited Region"&&!l.isEmpty),r=zi.getInstance().getAllItem().filter(l=>l.type=="Prohibited Region"&&!l.isEmpty),i=[];Re.addAll(i,t),Re.addAll(i,e),Re.addAll(i,r);let n=new Map,s=[],a=[];for(let l of i){let c=l.component;c.device&&a.push(l),c.track&&s.push(l)}return s.length&&n.set("track",s),a.length&&n.set("device",a),n}getLayer(t,e){let r="";switch(t==1?r="TOP":t==2&&(r="BOTTOM"),e){case"track":t==12?r="ALL":Ms(t)&&(r="INNER");break;case"device":t==12&&(r="BOTH");break}return r}generateDrillHolesArea(){let t=[];this.addDataItem(".DRILLED_HOLES",!0),this.handleViaData(),this.handlePadData();let r=`.${this.endFlag}_DRILLED_HOLES`;this.addDataItem(r,!0),t.push([...this.groupsItems]),this.groupsToContent(),!this.panelizeDefaultParam.onlyOutline&&this.offsetArr.length&&this.panelizeData(t,"DRILLED_HOLES",3,5)}handleViaData(){Tn.getInstance().iterator(t=>{let r=t.getParent();this.padOrViaData(t.holeRadius,t.center,"PTH",r,"VIA")})}handlePadData(){$n.getInstance().iterator(t=>{if(t.layerId==12){let e=t.plated?"PTH":"NPTH",r=t.getParent(),i=r&&r instanceof vi?"PIN":"Other";this.padOrViaData(t.holeRadius,t.center,e,r,i)}})}padOrViaData(t,e,r,i,n){let s=t*2;e=e.multiply3(this.matrix);let a=i&&i instanceof vi?i.designator:"BOARD",l="ECAD";this.addDataItem(this.toFixedByUnit(s*10),!1,10),this.addDataItem(this.toFixedByUnit(e.x*10),!1,10),this.addDataItem(this.toFixedByUnit(e.y*10),!1,10),this.addDataItem(r),this.addDataItem(a),this.addDataItem(n),this.addDataItem(l,!0)}async generatePlacementArea(){let t=[];this.addDataItem(".PLACEMENT",!0),await this.handleComponentData();let r=`.${this.endFlag}_PLACEMENT`;this.addDataItem(r,!0),t.push([...this.groupsItems]),this.groupsToContent(),!this.panelizeDefaultParam.onlyOutline&&this.offsetArr.length&&this.panelizeData(t,"PLACEMENT",1,3)}async handleComponentData(){let t=await $q(),e=xs.getInstance().getAllItem(),r=new Map;for(let i of e){let n=i.attrKeyValue.Footprint,s=i.attrKeyValue.Device,a=i.attrKeyValue.Designator,l=i.position.multiply3(this.matrix),c=i.attrKeyValue.Height;c=c?this.extractNumberAndUnit(c):await this.getFootprintHeightBy3D(i,t);let u=i.getComponentShapes().map(P=>P.getMathGraphics()),p=Ji.getItem(i.footprintUUID).getSource(),m=r.get(n);m?(m.dataStr!=p||m.deviceName!=i.attrKeyValue.Device)&&(n=`${a}_${n}`):r.set(n,{dataStr:p,deviceName:i.attrKeyValue.Device});let g={footprintName:n,deviceName:s,center:l,height:c,bbox:i.box.getMathGraphics(),polys:u,rotation:i.rotation};this.libData.set(n,g),this.addDataItem(this.formatName(n)),this.addDataItem(this.formatName(s)),this.addDataItem(this.formatName(a),!0),this.addDataItem(this.toFixedByUnit(l.x*10),!1,10),this.addDataItem(this.toFixedByUnit(l.y*10),!1,10),this.addDataItem(this.toFixedByUnit(0),!1,10);let y=i.rotation*(180/Math.PI);this.addDataItem(this.toFixedByUnit(y,3,"mil"),!1,10);let b=i.layerId==1?"TOP":"BOTTOM";this.addDataItem(b),this.addDataItem("PLACED",!0)}}formatName(t){return t.includes(" ")?`"${t}"`:t}async getFootprintHeightBy3D(t,e){let i=t.attrKeyValue["3D Model Title"]?t.attrKeyValue["3D Model"]:"",n=t.attrKeyValue["3D Model Transform"];console.debug("handling 3d model",t.globalIndex,"compoent",i,"with",n);let{uuid:s,path:a}=OG(i),l=e[`${s}|${a}`]||i||"",c=Ji.getItem(t.footprintUUID).getBBox(),h=t.attrKeyValue.Height,u=0;Number.isNaN(parseFloat(h))||(u=+h||h&&Bs(h,"mil")||0);let d=n&&n.trim().startsWith("v2:"),p;if(d){let g=JSON.parse(n.trim().slice(3)),b=new Ae([g[0],g[1],g[2],0,g[3],g[4],g[5],0,g[6],g[7],g[8],0,g[9],g[10],g[11],1]).scale(1/10).data;p={uuid:l||"default_model",dx:c.width(),dy:c.height(),dz:u,transformV2:JSON.stringify([b[0],b[1],b[2],b[4],b[5],b[6],b[8],b[9],b[10],b[12],b[13],b[14]])}}else{let g=n?n.split(",").map(P=>parseFloat(P)):new Array(9).fill(0),y=l&&(g[0]||g[1]||g[2]),b=Ji.getItem(t.footprintUUID).getOrigin();p={uuid:l||"default_model",dx:y?g[0]/10:c.width(),dy:y?g[1]/10:c.height(),dz:y?g[2]/10:u,rz:g[3],rx:g[4],ry:g[5],x:g[6]/10-b.x,y:g[7]/10-b.y,z:g[8]/10}}return(await(await A.windowBridge.rpcCall("/engine/getComponentInfo/height3D",p,$())).message/10).toString()}generateLibData(){let t=".ELECTRICAL",e=`.${this.endFlag}_ELECTRICAL`;for(let[r,i]of this.libData.entries()){this.addDataItem(t,!0);let{footprintName:n,deviceName:s,height:a,bbox:l,center:c,polys:h,rotation:u}=i;this.addDataItem(this.formatName(n)),this.addDataItem(this.formatName(s)),this.addDataItem(this.unit),this.addDataItem(this.toFixedByUnit(+a*10),!0,10);let d=this.matrix.translate(-c.x,-c.y).rotate(-u);if(h&&h.length)for(let p of h)if(p instanceof fe)p=p.multiply3(d),this.handleLibPolygonItem(p);else for(let m of p.items)m=m.multiply3(d),this.handleLibPolygonItem(m);else{let p=l.multiply3(d);this.handleLibPolygonItem(p)}this.addDataItem(e,!0),this.groupsToContent()}}handleLibPolygonItem(t){let r=t.area(.1)>0?0:1;this.handlePolygonData(t,r)}async exportIDFFile(){await this.generateBoardFile(),this.generateLibFile(),await this.downLoadFile()}async generateBoardFile(){this.generateHeader("BOARD_FILE"),this.generateOutlineProfile(),this.generateRouteKeepOutProfile(),this.generateDrillHolesArea(),await this.generatePlacementArea(),this.exportData(),this.saveIDFFile("BOARD_FILE")}generateLibFile(){this.generateHeader("LIBRARY_FILE"),this.generateLibData(),this.exportData(),this.saveIDFFile("LIBRARY_FILE")}exportData(){for(let t=0;t<this.content.length;t++){let e=this.content[t];this.content[t]=[e.join(this.SPACE)]}this.tempFile=this.content.join(this.NEWLINE),this.content=[]}saveIDFFile(t){let e;t=="BOARD_FILE"?e=this.fileName+".emn":t=="LIBRARY_FILE"&&(e=this.fileName+".emp"),this.zip.file(e,this.tempFile),this.tempFile=""}async downLoadFile(){let t=this.fileName;await this.zip.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}}).then(function(e){let r=t+".zip";s2?NC(e,r,"zip"):ip.downloadFile(r,e)})}getCurrentTimeFormatted(t){let e=new Date,r=e.getFullYear(),i=("0"+(e.getMonth()+1)).slice(-2),n=("0"+e.getDate()).slice(-2),s=("0"+e.getHours()).slice(-2),a=("0"+e.getMinutes()).slice(-2),l=("0"+e.getSeconds()).slice(-2);return t==":"?`${r}/${i}/${n}.${s}:${a}:${l}`:`${r}-${i}-${n}`}toFixedByUnit(t,e,r=x.getInstance().unit,i=new ft){e||(e=this.precision);let n=i||new ft;return r!="mil"&&(t=n.conversion("mil",r,t)),t.toFixed(e)}extractNumberAndUnit(t){let r=/(\d+(\.\d+)?)\s+([a-zA-Z]+)/i.exec(t);if(r){let i=r[1],n=r[3];return n.toLocaleLowerCase()!==x.getInstance().unit&&(i=(new ft().conversion(this.exchange(n),x.getInstance().unit,Number(i))/10).toString()),i}else return null}exchange(t){let e;switch(t){case"MM":e="mm";break;case"THOU":case"MILS":case"MIL":e="mil";break}return e}};var nce=class{exportText(t,e=6){return""}getMaxNumber(){return 0}},Kq=class extends nce{constructor(t){super(),this.oldUnit=t,this.newUnit=1e3}exportText(t,e=6){t=Math.abs(t);let r=Di.convert(t,this.oldUnit,this.newUnit);r=r*1e4;let i=r.toFixed(0),n="";if(i.length<e){let a=e-i.length;for(let l=0;l<a;l++)n+="0"}return n+i}getMaxNumber(){return Di.convert(99.9999,this.newUnit,this.oldUnit)}},Zq=class extends nce{constructor(t){super(),this.oldUnit=t,this.newUnit=39.37}exportText(t,e=6){t=Math.abs(t);let r=Di.convert(t,this.oldUnit,this.newUnit);r=r*1e3;let i=r.toFixed(0),n="";if(i.length<e){let a=e-i.length;for(let l=0;l<a;l++)n+="0"}return n+i}getMaxNumber(){return Di.convert(999.999,this.newUnit,this.oldUnit)}};var oce=class{constructor(t){this.unit=t}flagData(t){return xd(t,3)}solderData(t){let e=t.toString();return"S"+xd(e,1)}layerData(t){let e="L";return e+=j3e(t,2),e}infoData(t,e,r){return t=t||"",e=e||"",r=r||"",t+r+e}netData(t){return t=t||"N/C",xd(t,14)}emptyData(t=3){return xd("",t)}compIdentity(t,e,r){let i="",n="";return t?n=xd("VIA",6):n=xd(r||"",6),i+=n,i+=xd("-",1),i+=xd(e||"",4),i+=" ",i}holeIdentity(t,e){let r=this.unit,i="";return t==null?i+=xd("",5):(i+="D",i+=r.exportText(t,4)),e==null?i+=xd("",1):e?i+="P":i+="U",i}testPointAccess(t){let e="A";return e+=j3e(t,2),e}testPoint(t){let e=this.unit,r="X";return t.x<0?r+="-":r+=" ",r+=e.exportText(t.x),r+="Y",t.y<0?r+="-":r+=" ",r+=e.exportText(t.y),r}shapeData(t,e,r){let i=this.unit;t!=null&&e==null&&(r=null);let n="";return t!=null?(n+="X",n+=i.exportText(t,4)):n+=xd(" ",5),n+="Y",e!=null?n+=i.exportText(e,4):n+=xd(" ",4),r!=null?(n+="R",n+=j3e(Ht.regularD(r))):n+=xd(" ",4),n+=xd("",1),n}xNumber(t){let e=this.unit,r="X";return t<0&&(r+="-"),r+=e.exportText(t,-1),r}yNumber(t){let e=this.unit,r="Y";return t<0&&(r+="-"),r+=e.exportText(t,-1),r}};function xd(o,t,e=!0){let r=o.length;if(r<t){let i=t-r;for(let n=0;n<i;n++)o+=" "}else e&&r>t&&(o=o.slice(0,t));return o}function j3e(o,t=3){let e=o.toFixed(0),r="",i=e.length;if(i<t){let n=t-i;for(let s=0;s<n;s++)r+="0"}return r+e}var Rp=class o{constructor(t){this.data=[];this.data=t}exportText(){let t="";return this.data.forEach(e=>{t+=e}),t}static create(t){return new o(t)}};var sce=class{constructor(t){this.c_columnData=[];this.p_columnData=[];this.columnData=[];this.nameNum=0;this.desNum=0;this.padNum=0;this.layerNum={};this.netNameMap=new Xl;this.desNameMap=new Xl;this.padNameMap=new Xl;this.convert=new oce(t),this._unit=t}checkValidBbox(t,e){this.matrix=e,t=t.transform(e);let r=this._unit.getMaxNumber();if(!(Math.abs(t.minX)<r&&Math.abs(t.minY)<r&&Math.abs(t.maxX)<r&&Math.abs(t.maxY)<r)){let i;return t.width()<r&&t.height()<r?i=t.LL():i=t.center(),this.matrix=this.matrix.translate1(i.mul(-1)),!1}return!0}getNewNetData(t){let e=this.convert.flagData("P");this.nameNum++;let r=xd("NNAME"+this.nameNum,10);return this.addPRow(Rp.create([e,this.convert.infoData(r,t,this.convert.emptyData(1))])),this.convert.netData(r)}getNewDesData(t){let e=this.convert.flagData("C");this.desNum++;let r="UT"+this.desNum;return this.addCRow(Rp.create([e,this.convert.infoData(r,t,this.convert.emptyData(1)+"replaces"+this.convert.emptyData(1))])),r}getNewPadData(t){let e=this.convert.flagData("C");this.padNum++;let r="T"+this.padNum;return this.addCRow(Rp.create([e,this.convert.infoData(r,t,this.convert.emptyData(1)+"replaces"+this.convert.emptyData(1))])),r}set pcbName(t){this._pcbName=t}set projectName(t){this._projectName=t}getFileName(){let t=this._pcbName,e=this._projectName;return`IPC_${t}_${e}_${H5(new Date,"yyyy-MM-dd")}.356a`}addPcbComment(t){let e=this.convert.flagData("C");for(let r in t){let i=this.convert.infoData(r,t[r],":");this.addCRow(Rp.create([e,i]))}}addEnd(){let t=this.convert.flagData("C");this.addCRow(Rp.create([t,this.convert.infoData("--------------------------------------------------")])),this.addRow(Rp.create([this.convert.flagData("999")]))}addCRow(t){this.c_columnData.push(t)}addPRow(t){this.p_columnData.push(t)}addRow(t){this.columnData.push(t)}addPcbLayerComment(t){let e=this.convert.flagData("C"),r=this.convert.infoData("--------------- Layer Stackup --------------------");this.addCRow(Rp.create([e,r])),this.layerNum={12:0};let i=1;for(let n of t)r=this.convert.infoData(n.layerName,"",""),this.layerNum[n.layerId]=i,this.addCRow(Rp.create([e,r])),i++;r=this.convert.infoData("------------- Replace The Group ------------------"),this.addCRow(Rp.create([e,r]))}addHeader(t){let e=this._unit.newUnit,r=this.convert.flagData("P"),i=this.convert.emptyData(2);this.addPRow(Rp.create([r,this.convert.infoData(xd("JOB",4,!1))])),this.addPRow(Rp.create([r,this.convert.infoData(xd("CODE",4,!1),"UTF-8",i)])),this.addPRow(Rp.create([r,this.convert.infoData(xd("UNITS",4,!1),e==1e3?"CUST 0":"CUST 1",i)])),this.addPRow(Rp.create([r,this.convert.infoData(xd("TITLE",4,!1),t,i)])),this.addPRow(Rp.create([r,this.convert.infoData(xd("NUM",4,!1),"1.0",i)])),this.addPRow(Rp.create([r,this.convert.infoData(xd("REV",4,!1),"A",i)])),this.addPRow(Rp.create([r,this.convert.infoData(xd("VER",4,!1),"IPC-D-356A",i)]))}addPad(t){let{flag:e,net:r,des:i,padNum:n,hole:s,layerId:a,loc:l,xSize:c,ySize:h,rotate:u,topSolder:d,botSolder:p,isPlated:m}=t,g=this.layerNum[a],y=0;d==null&&(y+=1),p==null&&(y+=2);let b=[this.convert.flagData(e),this.getNetData(r),this.convert.emptyData(),this.convert.compIdentity(!1,this.getPadData(n),this.getDesData(i)),this.convert.holeIdentity(s,m),this.convert.testPointAccess(g),this.convert.testPoint(l.multiply3(this.matrix)),this.convert.shapeData(c,h,u),this.convert.solderData(y)],P=Rp.create(b);this.addRow(P)}addPadHole(t){let{flag:e,net:r,hole:i,layerId:n,loc:s,isPlated:a}=t,l=this.layerNum[n],c=[this.convert.flagData(e),this.getNetData(r),this.convert.emptyData(),this.convert.compIdentity(!1,null,null),this.convert.holeIdentity(i,a),this.convert.testPointAccess(l),this.convert.testPoint(s.multiply3(this.matrix))],h=Rp.create(c);this.addRow(h)}addBoard(t,e){let r=[this.convert.flagData("389"),xd("BOARD_EDGE",14),xd("",5),this.convert.xNumber(e),this.convert.yNumber(e),xd("",1)],i=this.addVector2(t,r,74);for(let n of i)this.addRow(n)}addVector2(t,e,r,i="089"){let n=[],s=0;for(let c of e)s+=c.length;let a,l;for(let c of t){c=c.multiply3(this.matrix);let h=[];a!=null?(ne.eq(a,c.x)||h.push(this.convert.xNumber(c.x)),ne.eq(l,c.y)||h.push(this.convert.yNumber(c.y))):(h.push(this.convert.xNumber(c.x)),h.push(this.convert.yNumber(c.y)));let u=0;for(let d of h)u+=d.length;if(s+u>r){n.push(Rp.create(e));let d=this.convert.flagData(i);e=[d,this.convert.emptyData(1)],s=d.length+1}s+=u,Re.addAll(e,h),a=c.x,l=c.y,e.push(this.convert.emptyData(1)),s+=1}return e.pop(),n.push(Rp.create(e)),n}addVia(t){let{flag:e,net:r,hole:i,loc:n,topSolder:s,botSolder:a,isPlated:l,startLayer:c,endLayer:h,layerId:u,xSize:d}=t,p=this.layerNum[u||c],m=0;s==null&&(m+=1),a==null&&(m+=2);let g=e=="307"?null:d,y=[this.convert.flagData(e),this.getNetData(r),this.convert.emptyData(),this.convert.compIdentity(!0),this.convert.holeIdentity(i,l),this.convert.testPointAccess(p),this.convert.testPoint(n.multiply3(this.matrix)),this.convert.shapeData(g,null,null),this.convert.solderData(m)];e=="307"&&(y.push(this.convert.layerData(this.layerNum[c])),y.push(this.convert.layerData(this.layerNum[h])));let b=Rp.create(y);if(this.addRow(b),e=="307"){let P=[this.convert.flagData("027"),xd("",14),this.convert.emptyData(),this.convert.compIdentity(!0),this.convert.holeIdentity(null,null),this.convert.testPointAccess(p),this.convert.testPoint(n.multiply3(this.matrix)),this.convert.shapeData(d,null,null)],T=Rp.create(P);this.addRow(T)}}addTracks(t){let{layerId:e,width:r,vectors:i,net:n}=t,s="378",a=[this.convert.flagData(s),this.getNetData(n),this.convert.emptyData(1),this.convert.layerData(this.layerNum[e]),this.convert.emptyData(1),this.convert.xNumber(r),this.convert.emptyData(1)],l=this.addVector2(i,a,74,"078");for(let c of l)this.addRow(c)}addVector(t){let e=[],r,i;for(let n of t)n=n.multiply3(this.matrix),r!=null?(ne.eq(r,n.x)||e.push(this.convert.xNumber(n.x)),ne.eq(i,n.y)||e.push(this.convert.yNumber(n.y))):(e.push(this.convert.xNumber(n.x)),e.push(this.convert.yNumber(n.y))),r=n.x,i=n.y,e.push(this.convert.emptyData(1));return e.pop(),e}getNetData(t){let e=this.netNameMap.get(t);return e||(t=t||"",t.length>14?e=this.getNewNetData(t):e=this.convert.netData(t),this.netNameMap.put(t,e)),e}getDesData(t){let e=this.desNameMap.get(t);return e||(t=t||"",t.length>6?e=this.getNewDesData(t):e=t,this.desNameMap.put(t,e)),e}getPadData(t){let e=this.padNameMap.get(t);return e||(t=t||"",t.length>4?e=this.getNewPadData(t):e=t,this.desNameMap.put(t,e)),e}exportText(){let t="";return this.c_columnData.forEach(e=>{t+=e.exportText()+`
`}),this.p_columnData.forEach(e=>{t+=e.exportText()+`
`}),this.columnData.forEach(e=>{t+=e.exportText()+`
`}),t}};var ace=class{constructor(t){this.document=t}getCommentInfo(){let t={name:x.getInstance().name},e=[],r=$e.getInstance().getLayerPhys(),i=["TOP","BOTTOM","SIGNAL","PLANE"];for(let n of r)i.includes(n.layerType)&&e.push({layerName:n.layerName,layerId:n.layerId});return{pcbInfo:t,stackupLayer:e}}checkBBox(){let t=new _e,e=$n.getInstance().getAllItem();for(let a of e)t.ext2(a.center);let r=Tn.getInstance().getAllItem();for(let a of r)t.ext2(a.center);this.getPolyItemBBox(Mi.getInstance().getAllItem(),t),this.getPolyItemBBox(rn.getInstance().getAllItem(),t),this.getPolyItemBBox(zi.getInstance().getAllItem(),t);let i=An.getInstance().getAllItem();for(let a of i)t.ext1(a.bbox);let n=t.build1(),s=x.getInstance().origin;return this.document.checkValidBbox(n,Qe.translate1(s.mul(-1)))}getPolyItemBBox(t,e){for(let r of t)this.filterOutline(r)&&e.ext1(r.bbox)}generatePad(){let t=$n.getInstance().getAllItem(),e=$e.getInstance();for(let r of t)e.getLayer(r.layerId).type=="MULTI"?r.type==1?this.parseMultiCommonPad(r):this.parseCustomPad(r):this.parseSinglePad(r)}generateVia(){let t=Tn.getInstance().getAllItem();for(let e of t){let r=e.radius*2,i,n,s,a,l=e.topExpansion+e.radius,c=e.bottomExpansion+e.radius;ne.lesseq(l,0)&&(l=null),ne.lesseq(c,0)&&(c=null),e.type==1?(i="307",s=e.startLayer,a=e.endLayer,s!==1&&(l=null),a!==2&&(c=null),n=1,a==2&&(n=2)):(i="317",n=e.layerId),this.document.addVia({flag:i,net:this.hasConnect(e)?e.net:"",hole:e.holeRadius*2,loc:e.center,startLayer:s,endLayer:a,layerId:n,topSolder:l,botSolder:c,isPlated:!0,xSize:r})}}hasConnect(t){let e=!1;t0.useWireClusterCache=!0;let r=t.net,i=XS(r);for(let n of i)if(n.has(t.globalIndex)){e=n.size>1;break}return t0.useWireClusterCache=!1,e}generateBoard(){let t=Mi.getInstance().getAllItem();Re.addAll(t,rn.getInstance().getAllItem()),Re.addAll(t,zi.getInstance().getAllItem());let e=[];for(let r of t)this.filterOutline(r)&&e.push(r);for(let r of e){let i=r.getMathGraphics();i.area()<0&&(i=i.reverse());let s=i.primitives,a=[];for(let l of s)Re.addAll(a,l.points(.1));this.document.addBoard(a,r.strokeWidth)}}filterOutline(t){return t.layerId==11}parseCustomPad(t){let e;t.plated?e="317":e="367";let r=t.topSolderExpansion+Math.min(t.top.width,t.top.height)/2,i=t.bottomSolderExpansion+Math.min(t.bottom.width,t.bottom.height)/2;ne.lesseq(r,0)&&(r=null),ne.lesseq(i,0)&&(i=null);let n=this.hasConnect(t)?t.net:"";this.parseSinglePadShape(t,1,e,r,i,n),this.parseSinglePadShape(t,t.layerId,"017",r,i,n),this.parseSinglePadShape(t,2,"017",r,i,n)}parseCustomPadHole(t,e){let r=this.getHole(t),s=$e.getInstance().getLayer(t.layerId).type=="TOP"?t.top:t.bottom,a,l;s.type=="OVAL"||s.type=="ELLIPSE"?(a=Math.min(s.width,s.height),l=null):(a=s.width,l=s.height);let c=t.getParent()==null?"":t.net,h=t.center;this.document.addPadHole({flag:e,net:c,hole:r,layerId:t.layerId,loc:h,isPlated:t.plated})}parseSinglePadShape(t,e,r,i,n,s){let a=this.getHole(t),c=$e.getInstance().getLayer(e),h,u;if(c.type=="MULTI")h=0,u=null;else{let b=c.type=="TOP"?t.top:t.bottom,P=this.getPadSize(b,t,e);h=P.xSize,u=P.ySize}let d="",p=t.getParent();p&&(d=p.designator);let m=t.num,g=t.center,y=Ht.toDegrees(t.rotation);this.document.addPad({flag:r,net:s,des:d,padNum:m,hole:a,layerId:e,loc:g,xSize:h,ySize:u,rotate:y,topSolder:i,botSolder:n,isPlated:t.plated})}getPadMinDis(t,e){let r=t.primitives,i=null;for(let n of r){let a=new ir(n,new M(e,e)).getDistance();(!i||i>a)&&(i=a)}return i||0}parseSinglePad(t){let e=$e.getInstance(),r="327",i=e.getLayer(t.layerId),n=null,s,a,l=i.type=="TOP"?t.top:t.bottom,c=this.getPadSize(l,t,t.layerId);s=c.xSize,a=c.ySize;let h=Math.min(l.width,l.height),u=t.topSolderExpansion,d=t.bottomSolderExpansion;i.type=="TOP"?(u=u+h/2,d=null,ne.lesseq(u,0)&&(u=null)):(u=null,d=d+h/2,ne.lesseq(d,0)&&(d=null));let p=this.hasConnect(t)?t.net:"",m="",g=t.getParent();g&&(m=g.designator);let y=t.num,b=i.layerId,P=t.center,T=Ht.toDegrees(t.rotation);this.document.addPad({flag:r,net:p,des:m,padNum:y,hole:n,layerId:b,loc:P,xSize:s,ySize:a,rotate:T,topSolder:u,botSolder:d,isPlated:!0})}getPadSize(t,e,r){let i=t.type,n=null,s=null;switch(i){case"ELLIPSE":n=Math.min(t.width,t.height),s=null;break;case"OVAL":{let c=Math.min(t.width,t.height);n=c,t.width>c*2&&(n=t.width-c,s=c),t.height>c*2&&(s=t.height-c)}break;case"POLYGON":let a=e.getMathGraphics(r);n=this.getPadMinDis(a,e.center)*2,s=null;break;default:n=t.width,s=t.height;break}return{xSize:n,ySize:s}}parseMultiCommonPad(t){let e=$e.getInstance(),r,i,n=e.getLayer(t.layerId),s,a,l=!0,c=Ht.toDegrees(t.rotation),h=t.topSolderExpansion,u=t.bottomSolderExpansion;t.plated?r="317":(r="367",l=!1),i=this.getHole(t);let d=this.getPadSize(t.top,t,1);s=d.xSize,a=d.ySize;let p=Math.min(t.top.width,t.top.height);h=h+p/2,u=u+p/2,ne.lesseq(h,0)&&(h=null),ne.lesseq(u,0)&&(u=null);let m=this.hasConnect(t)?t.net:"",g="",y=t.getParent();y&&(g=y.designator);let b=t.num,P=n.layerId,T=t.center;this.document.addPad({flag:r,net:m,des:g,padNum:b,hole:i,layerId:P,loc:T,xSize:s,ySize:a,rotate:c,topSolder:h,botSolder:u,isPlated:l})}generateTrack(){let t=An.getInstance().getAllItem(),e={};for(let r of t)if(r instanceof yt){if(e[r.globalIndex])continue;let i=this.findTracks(r,e),n=[];for(let s of i)Re.addAll(n,s.points(.1));t.forEach(()=>{}),this.document.addTracks({layerId:r.layerId,width:r.width,vectors:n,net:r.net})}}findTracks(t,e){let r=[t],i=t instanceof Oi?[q.build3(t.center,Ht.toDegrees(t.startAngle),Ht.toDegrees(t.sweepAngle),t.radius,t.radius)]:[new M(t.start,t.end)],n=t.end,s=Mh.getNode(t.net);for(;r.length>0;){let a=r.pop();e[a.globalIndex]=!0;let l=this.getConnect(a,n,s,e),c=l.nextItem;if(c){r.push(c),n=l.nextPoint;let h=c instanceof Oi?q.build3(c.center,Ht.toDegrees(c.startAngle),Ht.toDegrees(c.sweepAngle),c.radius,c.radius):new M(c.start,c.end);l.isStart?i.push(h):i.push(h.reverse())}}for(r.push(t),n=t.start;r.length>0;){let a=r.pop();e[a.globalIndex]=!0;let l=this.getConnect(a,n,s,e),c=l.nextItem;if(c){r.push(c),n=l.nextPoint;let h=c instanceof Oi?q.build3(c.center,Ht.toDegrees(c.startAngle),Ht.toDegrees(c.sweepAngle),c.radius,c.radius):new M(c.start,c.end);l.isStart?i.unshift(h.reverse()):i.unshift(h)}}return i}getConnect(t,e,r,i){let s,a,l=r.map.get(t);if(l){let h=Array.from(l.near).find(u=>{let d=u.item;if(d instanceof yt&&!i[d.globalIndex]&&ne.eq(t.width,d.width)){if(d.start.distance2(e)<1e-4)return s=d.end,a=!0,!0;if(d.end.distance2(e)<1e-4)return s=d.start,a=!1,!0}return!1});return{nextItem:h==null?void 0:h.item,nextPoint:s,isStart:a}}return{nextItem:null,nextPoint:s,isStart:a}}getHole(t){return t.hole.holeShape=="ROUND"?t.hole.holeLength:Math.min(t.holeLength,t.holeRadius*2)}};var Jq=class{constructor(t){this.checked=!1;this.document=new sce(t),this.modelHandle=new ace(this.document)}checkBBox(){return this.checked=!0,this.modelHandle.checkBBox()}buildData(t){this.checked||this.modelHandle.checkBBox(),this.document.pcbName=x.getInstance().name,this.document.projectName=t.projectName,this.generateComment(t.projectName,t.boardName),this.document.addHeader(t.title),this.modelHandle.generatePad(),this.modelHandle.generateVia(),this.modelHandle.generateTrack(),this.modelHandle.generateBoard(),this.document.addEnd()}generateComment(t,e){let{pcbInfo:r,stackupLayer:i}=this.modelHandle.getCommentInfo(),n=new Date,s={"Project Name":t,"Board Name":e,"PCB Name":r.name,Date:DIe(n,"yyyy/MM/dd"),Time:DIe(n,"hh:mm:ss")};this.document.addPcbComment(s),this.document.addPcbLayerComment(i)}getCommentInfo(){let t={name:x.getInstance().name},e=[],r=$e.getInstance().getLayerPhys(),i=["TOP","BOTTOM","SIGNAL","PLANE"];for(let n of r)i.includes(n.layerType)&&e.push(n.layerName);return{pcbInfo:t,stackupLayer:e}}exportText(){this.document.exportText()}};function WYe(o){let t=x.getInstance().unit=="mm"?new Zq(10):new Kq(10),e=new Jq(t);if(e.checkBBox())r();else{let i=new _0("Found board is far away from the origin. Will it be output in relative origin coordinates?",()=>{r()});A.publish("openMsgbox",i)}function r(){e.buildData({projectName:o.projectTitle,boardName:o.boardTitle,title:o.title}),ip.downloadFileASCII(e.document.getFileName(),e.document.exportText(),".txt")}return!0}function zYe(o){let t=x.getInstance().unit=="mm"?new Zq(10):new Kq(10),e=new Jq(t);return e.buildData({projectName:o.projectTitle,boardName:o.boardTitle,title:o.title}),{fileName:e.document.getFileName(),text:e.document.exportText()}}var lce=class{constructor(){this._highlightItems=new Set;let t=new er;A.subscribe("pcb/tempHightLightItems",e=>{let{ids:r=[],highlight:i=!0,cancelLastHighLight:n=!0}=e||{};n&&this.clearHighLight();let s=!1;r.forEach(a=>{let l=t.getItem(a);!l||l.isEmpty||!l.isVisible||(s=!0,i?l.isHighLight||(this._highlightItems.add(l),l.highLight(!0)):(this._highlightItems.delete(l),l.visible()))}),s&&A.publish("updateFrame","")},$())}clearHighLight(){let t=!1;this._highlightItems.forEach(e=>{!e.isEmpty&&e.isVisible&&(e.visible(),t=!0)}),this._highlightItems.clear(),t&&A.publish("updateFrame","")}};function YYe(o){let{projectTitle:t,boardTitle:e,title:r}=o,i="OEM",n="oem",s=x.getInstance().name,a={},l=Cr.getAllItem();for(let u of l)[...Object.keys(u.attrsMap)].forEach(p=>{!a[p]&&(p.indexOf(i)>=0||p.indexOf(n)>=0)&&(a[p]={text:p,value:p})});let c=Object.values(a),h=kxt();return{data:{projectTitle:t,pcbName:s,boardTitle:e,title:r,oem:c,isEmptyDesignator:h}}}function kxt(){let o=Cr.getAllItem();for(let t of o)if(!t.designator)return!0;return!1}var J5=class J5{constructor(){this.map=new Map;this.repeatMap=new Map;this.enptyNum=0;this._auto=!1}static getInstance(){return J5.instance===null&&(J5.instance=new J5),J5.instance}set auto(t){this._auto=t}init(t=!1){this.auto=t}clear(){this.map.clear(),this.repeatMap.clear(),this.enptyNum=0,this.auto=!1}get(t){let e=t.globalIndex,r=this.map.get(e);if(!r){r=t.designator,!r&&this._auto&&(r="NONE"+this.enptyNum++);let i=this.repeatMap.get(r);i?(this.repeatMap.set(r,i+1),r=r+"-repeat"+i,this.map.set(e,r)):(this.map.set(e,r),this.repeatMap.set(r,1))}return r}};J5.instance=null;var jT=J5;function Bxt(){let t=[];for(let e=0;e<10;e++)t[e]="  ".repeat(e);return t}var Fxt={FunctionMode:()=>`    <FunctionMode mode="USERDEF" />
`,StepRef:o=>'    <StepRef name="'+o+`" />
`,BomRef:()=>`    <BomRef name="BOM" />
`,DictionaryColor:o=>{let t=(r,{r:i,g:n,b:s})=>'      <EntryColor id="'+r+`">
        <Color r="`+i+'" g="'+n+'" b="'+s+`"/>
      </EntryColor>
`;return`    <DictionaryColor>
`+o.map(r=>t(r.layerName,{r:r.color.r,g:r.color.g,b:r.color.b})).join("")+`    </DictionaryColor>
`},LayerRef:o=>'    <LayerRef name="'+o+`"/>
`,EntryColor:(o,t)=>'      <EntryColor id="LAYER_COLOR_'+o+`">
        <Color r="`+t.r+'" g="'+t.g+'" b="'+t.b+`"/>
      </EntryColor>
`},Vxt={LogisticHeader:()=>`  <LogisticHeader>
    <Role id="Owner" roleFunction="ENGINEER"/>
    <Enterprise id="Enterprise" code="UNKNOWN"/>
    <Person name="Unknown" enterpriseRef="Enterprise" roleRef="Owner"/>
  </LogisticHeader>
`},Gxt={HistoryRecord:(o,t,e,r,i,n)=>'  <HistoryRecord number="'+o+'" origination="'+t+'" software="'+e+'" lastChange="'+r+`">
    <FileRevision fileRevisionId="NONE" comment="NONE">
      <SoftwarePackage name="`+i+'" revision="A" vendor="JLC" model="'+n+`">
        <Certification certificationStatus="CERTIFIED" certificationCategory="OTHER"/>
      </SoftwarePackage>
    </FileRevision>
  </HistoryRecord>
`},q3e={BomHeader:o=>`    <BomHeader assembly="Assembly" revision="Revision">
      <StepRef name="`+o+`"/>
    </BomHeader>
`,BomItem:o=>{let t=[];o.forEach((s,a)=>{(typeof s=="string"||typeof s=="number")&&t.push(` ${a}="${s}"`)});let r=o.get("RefDes").map(s=>q3e.RefDes(s.RefDes)).join(""),i=o.get("Characteristics"),n=q3e.Characteristics(i);return"    <BomItem"+t.join("")+`>
`+n+r+`    </BomItem>
`},RefDes:o=>{let{name:t,packageRef:e,layerRef:r}=o;return'      <RefDes name="'+t+'" packageRef="'+e+'" layerRef="'+r+`"/>
`},Characteristics:o=>{let{category:t}=o;return'      <Characteristics category="'+t+`"/>
`}},XYe={CadHeader:(o,t)=>{let e=t.map(r=>XYe.Spec(r)).join("");return'    <CadHeader units="'+o.toUpperCase()+`">
`+e+`    </CadHeader>
`},Spec:o=>{let t=o.get("name"),r=o.get("General").Property;return r?'      <Spec name="'+t+`">
        <General type="MATERIAL">
          <Property text="`+r.text+`"/>
        </General>
      </Spec>
`:'      <Spec name="'+t+`">
        <General type="MATERIAL"/>
      </Spec>
`},Layer:o=>{let{name:t,layerFunction:e,side:r,polarity:i}=o;return'      <Layer name="'+t+'" layerFunction="'+e+'" side="'+r+'" polarity="'+i+`" />
`},StackupLayer:o=>{let t=o.get("layerOrGroupRef"),e=o.get("thickness"),r=o.get("tolPlus"),i=o.get("tolMinus"),n=o.get("sequence");return'          <StackupLayer layerOrGroupRef="'+t+'" thickness="'+e+'" tolPlus="'+r+'" tolMinus="'+i+'" sequence="'+n+`">
            <SpecRef id="`+t+`" />
          </StackupLayer>
`},Datum:({x:o,y:t})=>'        <Datum x="'+o+'" y="'+t+`"/>
`,StepRepeat:o=>{let{stepRef:t,x:e,y:r,nx:i,ny:n,dx:s,dy:a,angle:l,mirror:c}=o;return'        <StepRepeat stepRef="'+t+'" x="'+e+'" y="'+r+'" nx="'+i+'" ny="'+n+'" dx="'+s+'" dy="'+a+'" angle="'+l+'" mirror="'+c+`" />
`}},Uh={Content:Fxt,LogistHeader:Vxt,HistoryRecord:Gxt,Bom:q3e,Ecad:XYe,indent:Bxt()};var Qq=1,cce=-1,qYe=new TextEncoder,hce=new TextDecoder,sa=class o{constructor(t,e){this.name=t,this.attributes=new Map,this.children=[],e&&e.appendChild(this)}delete(t,e){let r=this.search(t,e);r&&this.deleteNode(r)}deleteNode(t){let e=this.children.indexOf(t);e>-1&&this.children.splice(e,1)}getName(){return this.name}getChildren(){return this.children}appendChild(t){this.children.push(t)}clear(){this.children.length=0,this.attributes.clear(),this.xmlStr=null}setAttribute(t,e){if(typeof t=="string")this.attributes.set(t,e);else for(let r in t)this.attributes.set(r,t[r])}get xmlStr(){return this._xmlStr}set xmlStr(t){this._xmlStr=this.toBuffer(t),this.attributes.clear(),this.children=[],this.name=null}formatTextValue(t){return typeof t=="string"?function(r){return r.replace(/[\x00-\x1F\x7F]/g,(i,n)=>i.charCodeAt(0))}(t):t}search(t,e){return this.children.find(r=>{if(r.name===t)if(e){for(let i in e){let n=r.attributes.get(i);if(!n||n!==e[i])return!1}return!0}else return r.attributes.size===0})}filter(t){return this.children.filter(e=>e.name===t)}getAttribute(t){return this.attributes.get(t)}parseXmlStr(t=0){let e=[];this.toString(e,t);let r=e.map(i=>hce.decode(i));return this.xmlStr=r.join(""),this.xmlStr}toString(t,e=0){let r=[];for(r.push({node:this,state:Qq});r.length>0;){let{node:i,state:n}=r.pop(),s=i.children,a=s&&s.length>0;if(Object.getPrototypeOf(i)!==o.prototype){i.toString(t,e);continue}if(n===Qq){let l=i.toXml(e,n,!a);t.push(l),a&&(e++,r.push({node:i,state:cce}));for(let c=s.length-1;c>=0;c--)r.push({node:s[c],state:Qq})}else{e--;let l=i.toXml(e,cce);t.push(l)}this.children.length=0,this.attributes.clear()}return t}toXml(t=0,e=Qq,r=!1){if(this.xmlStr){let a=this.xmlStr;return this.clear(),a}let i=Uh.indent[t],n=[];for(let[a,l]of this.attributes)n.push(` ${a}="${this.formatTextValue(l)}"`);let s;return e===Qq?s=`${i}<${this.name}${n.join("")}${r?"/":""}>
`:e===cce&&(s=`${i}</${this.name}>
`),(e===cce||r)&&this.clear(),this.toBuffer(s)}toBuffer(t){return qYe.encode(t)}mergeSource(t){let e=t.map(r=>hce.decode(r));return qYe.encode(e.join(""))}};var uce=class extends sa{constructor(e){super("Content",e);this.map=new Map;this.standard=new Map}init(e,r){this.unit=e,this.handel=r}addLayer(e,r={isSpan:!0}){this.map.set(e,r)}deleteLayer(e){this.map.delete(e)}getAllLayers(){let e=[];for(let[r,i]of this.map){let n=i.model;n&&e.push(n)}return e}addStandard(e,r){this.standard.set(e,r)}findStandard(e){return!!this.standard.has(e)}needPanelize(){let e=Ii.toJSON();return e!=null&&e.success?!e.onlyOutline:!1}toString(e){let r=[],i=[];r.push(`  <Content roleRef="Owner">
`);let n=Uh.Content.FunctionMode();r.push(n);let s=Uh.Content.StepRef(x.getInstance().name);if(r.push(s),this.needPanelize()){let l=Uh.Content.StepRef("Panels");r.push(l)}let a=Uh.Content.BomRef();r.push(a),i.push(`    <DictionaryColor>
`);for(let[l,c]of this.map){let h=Uh.Content.LayerRef(l);if(!c.isSpan){let u=Uh.Content.EntryColor(l,c);i.push(u)}r.push(h)}return i.push(`    </DictionaryColor>
`),r.push(i.join("")),e.push(this.toBuffer(r.join(""))),this.getStandard(e),e.push(this.toBuffer(`  </Content>
`)),this.clear(),e}clear(){super.clear(),this.map.clear(),this.standard.clear()}getStandard(e){let r=this.unit,i=3;r=="mm"&&(r="millimeter"),e.push(this.toBuffer('    <DictionaryStandard units="'+r.toUpperCase()+`">
`));for(let[n,s]of this.standard){let a=[];this.handel.encode.feed("EntryStandard",s).toString(a,i),e.push(this.mergeSource(a))}e.push(this.toBuffer(`    </DictionaryStandard>
`))}};var dce=class extends sa{constructor(e){super("SupportNode",e);this.params=null}async init(){this.params=await this.historyRecordParams()}clear(){super.clear()}toString(e){let r=Uh.LogistHeader.LogisticHeader(),i=this.getHistoryRecord(),n=r+i;return e.push(this.toBuffer(n)),this.clear(),e}async historyRecordParams(){let e=x.getInstance().id,r=(await A.windowBridge.rpcCall("getIPCOrigination",e,$())).message,i=new Date().getTime(),n=1;r&&(i=r.origination,n=r.number+1),await A.windowBridge.rpcCall("setIPCOrigination",{key:e,value:{origination:i,number:n}},$());let s=new Date().getTime(),a="yyyy-MM-ddThh:mm:ss",{version:l,packageName:c,packageVersion:h}=(await A.windowBridge.rpcCall("getIPCVersion",e,$())).message;return{number:n,origination:i,currentTime:s,format:a,version:l,packageName:c,packageVersion:h}}getHistoryRecord(){let{number:e,origination:r,currentTime:i,format:n,version:s,packageName:a,packageVersion:l}=this.params;return Uh.HistoryRecord.HistoryRecord(e,this.dateFormat(new Date(r),n),s,this.dateFormat(new Date(i),n),a,l)}dateFormat(e,r){if(e==null||e==null)return"";var i={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),S:e.getMilliseconds()};/(y+)/.test(r)&&(r=r.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(var n in i)new RegExp("("+n+")").test(r)&&(r=r.replace(RegExp.$1,RegExp.$1.length==1?i[n]:("00"+i[n]).substr((""+i[n]).length)));return r}};var pce=class extends sa{constructor(t,e,r){super("Bom",r),this.oem=t,this.handel=e}generate(t){let e=Cr.getAllItem();this.getBomList(e).forEach(i=>{let n=this.handel.encode.feed2Attr("BomItem",{item:i,number:this.oem});t.push(this.toBuffer(this.bomTemplate(n)))})}getBomList(t){let e=new Map;return t.forEach(r=>{let i=r.model,n=i.attrsMap,s={device:i.device,oem:n[this.oem],value:n.value,supplier:n["Supplier Part"]},a=e.get(JSON.stringify(s));a||e.set(JSON.stringify(s),a=new Array),a.push(r)}),e}bomTemplate(t){return Uh.Bom.BomItem(t)}toString(t){let e=`  <BOM name="BOM">
`,r=`  </BOM>
`,i=e+Uh.Bom.BomHeader(x.getInstance().name);return t.push(this.toBuffer(i)),this.generate(t),t.push(this.toBuffer(r)),this.clear(),t}};var fce=class extends sa{constructor(e){super("Ecad",e);this._cadHeader=null;this._cadData=null;this._padStack=null;this._layers=null}get cadHeader(){return this._cadHeader}set cadHeader(e){this._cadHeader=e}get layerNode(){return this._layers}set layerNode(e){this._layers=e}get padStack(){return this._padStack}set padStack(e){this._padStack=e}get cadData(){return this._cadData}set cadData(e){this._cadData=e}toString(e,r){let i=`  <Ecad name="output PCB cad-data">
`,n=`  </Ecad>
`;return e.push(this.toBuffer(i)),this.children.map(s=>s.toString(e,r+1)),e.push(this.toBuffer(n)),e}};var mce=class{getContent(){return this.Content}getBom(){return this.Bom}getEcad(){return this.Ecad}constructor(){let t=new sa("IPC-2581");t.setAttribute("revision","C"),t.setAttribute("xmlns","http://webstds.ipc.org/2581"),t.setAttribute("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance"),t.setAttribute("xmlns:xsd","http://www.w3.org/2001/XMLSchema"),this.root=t}createContent(){this.Content=new uce(this.root)}async createSupportInfo(){await new dce(this.root).init()}createBom(t,e){this.Bom=new pce(t,e,this.root)}initEcad(){this.Ecad=new fce(this.root)}export(){let t=[];return t.push(new TextEncoder().encode(`<?xml version="1.0" encoding="UTF-8"?>
`)),this.root.toString(t),t}clear(){this.root=null,this.Content=null,this.Bom=null,this.Ecad=null}};var gce=class{getConfig(){return{VIA:this.getVIA(),PAD:this.getPAD(),HOLE:this.getHOLE(),SLOT:this.getSLOT(),PROFILE:this.getPROFILE(),PACKAGE:this.getPACKAGE(),COMPONENT:this.getCOMPONENT(),TRACK:this.getTRACK(),TEXT:this.getTEXT(),FONT:this.getTEXT(),LINE:this.getTRACK(),TEARDROP:this.getTEARDROP(),REGION:this.getREGION(),IMAGE:this.getIMAGE(),COPPER:this.getCOPPER(),SIZE:this.getSIZE(),BomItem:this.getBomItem(),LayerRef:this.getLayerRef(),EntryStandard:this.getEntryStandard(),Spec:this.getLayerSpec(),Layer:this.getLayer(),Stackup:this.getStackup(),StackupGroup:this.getStackupGroup(),StackupLayer:this.getStackupLayer(),LayerFeature:this.getLayerFeature(),LayerColor:this.getLayerColor(),LogicalNet:this.getLogicalNet(),PadStackDef:this.getPadStackDef()}}getVIA(){return[]}getLayerFeature(){return["layerRef","Set"]}getLayerColor(){return["id","Color"]}getPAD(){return["padstackDefRef","Xform","Location","StandardPrimitiveRef","PinRef"]}getHOLE(){return["name","diameter","platingStatus","plusTol","minusTol","x","y"]}getSLOT(){return["name","minusTol","Outline","platingStatus","plusTol"]}getPROFILE(){return["Polygon","Cutout"]}getPACKAGE(){return["name","height","Outline","Pin","pinOneOrientation","type"]}getCOMPONENT(){return["Location","packageRef","part","refDes","Xform","layerRef"]}getTRACK(){return["Polyline"]}getTEXT(){return["UserSpecial","Contour","Xform"]}getTEARDROP(){return["Contour"]}getREGION(){return["Contour"]}getCOPPER(){return["Contour"]}getIMAGE(){return["Contour"]}getSIZE(){return["UserSpecial"]}getBomItem(){return["category","Characteristics","description","internalPartNumber","OEMDesignNumberRef","pinCount","quantity","RefDes"]}getLayerRef(){return["name"]}getEntryStandard(){return["id","Circle","Contour","RectCenter","RectRound"]}getLayerSpec(){return["name","General"]}getLayer(){return["name","layerFunction","side","polarity"]}getStackup(){return["name","overallThickness","tolPlus","tolMinus","whereMeasured"]}getStackupGroup(){return["name","thickness","tolMinus","tolPlus"]}getStackupLayer(){return["layerOrGroupRef","thickness","tolPlus","tolMinus","sequence","SpecRef"]}getPadStackDef(){return["name","PadstackHoleDef","PadstackPadDef"]}getLogicalNet(){return["name","netClass","PinRef"]}};var cs=class{constructor(t){this.unit=t}convertUnit(t){return Math.round(Bs(t*10,"mil",this.unit)*1e8)/1e8}toFix(t,e=8){let r=Number(t.toFixed(e))%360;return r<0&&(r+=360),r}startPoint(t){return{PolyBegin:{x:this.convertUnit(t.x),y:this.convertUnit(t.y)}}}lineto(t){return{PolyStepSegment:{x:this.convertUnit(t.x),y:this.convertUnit(t.y)}}}arcto(t,e,r=!0){return{PolyStepCurve:{x:this.convertUnit(t.x),y:this.convertUnit(t.y),centerX:this.convertUnit(e.x),centerY:this.convertUnit(e.y),clockwise:r}}}lineDesc(t,e="ROUND",r="SOLID"){return{lineEnd:e,lineWidth:t,lineProperty:r}}formatTextValue(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}};var bce=class extends cs{constructor(t){super(t)}getData(t,e){var r;switch(t){case"name":if(e instanceof Je){let s=e.hole;return eN(e.globalIndex,(r=e.getParent())==null?void 0:r.designator,e.num)}return"Hole_Via_"+e.globalIndex;case"diameter":if(e instanceof Je){let s=e.hole.holeLength;return this.convertUnit(s)}let i=e.holeRadius||e.radius;return this.convertUnit(i*2);case"platingStatus":let n="PLATED";return e instanceof Je?n=e.plated?"PLATED":"NONPLATED":e instanceof It&&e.type===1&&(n="VIA"),n;case"minusTol":return 0;case"plusTol":return 0;case"x":return this.convertUnit(e.center.x);case"y":return this.convertUnit(e.center.y)}}},Pce=class extends cs{constructor(t){super(t)}getData(t,e){var r;switch(t){case"name":if(e instanceof Je){let T=e.hole;return eN(e.globalIndex,(r=e.getParent())==null?void 0:r.designator,e.num)}return"Hole_Via_"+e.globalIndex;case"platingStatus":return"VIA";case"minusTol":return 0;case"plusTol":return 0;case"Outline":let i=e.hole,n=e.rotation,s=e.center,{holeOffset:a,holeRotation:l,holeLength:c,holeRadius:h,holeShape:u}=i;u==="ROUND"&&(c=h*2);let d=c/2-h,p=s.add(new S(1,0).mul(-1*d).rotate(S.ORIGIN,l+n)),m=s.add(new S(1,0).mul(d).rotate(S.ORIGIN,l+n)),g=[p.add(new S(0,h).rotate(S.ORIGIN,l+n)),p.add(new S(0,-1*h).rotate(S.ORIGIN,l+n))],y=[m.add(new S(0,h).rotate(S.ORIGIN,l+n)),m.add(new S(0,-1*h).rotate(S.ORIGIN,l+n))],b=a.rotate(S.ORIGIN,n),P=[];return P.push(this.startPoint(g[0].add(b))),P.push(this.lineto(y[0].add(b))),P.push(this.arcto(y[1].add(b),m.add(b))),P.push(this.lineto(g[1].add(b))),P.push(this.arcto(g[0].add(b),p.add(b))),{Polygon:{polylines:P}}}}};var K3e=[{name:"Top Layer",name_zn:"\u9876\u5C42",layerFunction:"SIGNAL",side:"TOP",polarity:"POSITIVE"},{name:"Bottom Layer",name_zn:"\u5E95\u5C42",layerFunction:"SIGNAL",side:"BOTTOM",polarity:"POSITIVE"},{name:"Top Silkscreen Layer",name_zn:"\u9876\u5C42\u4E1D\u5370\u5C42",layerFunction:"SILKSCREEN",side:"TOP",polarity:"POSITIVE"},{name:"Bottom Silkscreen Layer",name_zn:"\u5E95\u5C42\u4E1D\u5370\u5C42",layerFunction:"SILKSCREEN",side:"BOTTOM",polarity:"POSITIVE"},{name:"Top Solder Mask Layer",name_zn:"\u9876\u5C42\u963B\u710A\u5C42",layerFunction:"SOLDERMASK",side:"TOP",polarity:"POSITIVE"},{name:"Bottom Solder Mask Layer",name_zn:"\u5E95\u5C42\u963B\u710A\u5C42\u200B",layerFunction:"SOLDERMASK",side:"BOTTOM",polarity:"POSITIVE"},{name:"Top Paste Mask Layer",name_zn:"\u9876\u5C42\u9521\u818F\u5C42",layerFunction:"PASTEMASK",side:"TOP",polarity:"POSITIVE"},{name:"Bottom Paste Mask Layer",name_zn:"\u5E95\u5C42\u9521\u818F\u5C42",layerFunction:"PASTEMASK",side:"BOTTOM",polarity:"POSITIVE"},{name:"Top Assembly Layer",name_zn:"\u9876\u5C42\u88C5\u914D\u5C42",layerFunction:"DOCUMENT",side:"TOP",polarity:"POSITIVE"},{name:"Bottom Assembly Layer",name_zn:"\u5E95\u5C42\u88C5\u914D\u5C42",layerFunction:"DOCUMENT",side:"BOTTOM",polarity:"POSITIVE"},{name:"Board Outline Layer",name_zn:"\u677F\u6846\u5C42",layerFunction:"DOCUMENT",side:"INTERNAL",polarity:"POSITIVE"},{name:"Document Layer",name_zn:"\u6587\u6863\u5C42",layerFunction:"DOCUMENT",side:"NONE",polarity:"POSITIVE"},{name:"Mechanical Layer",name_zn:"\u673A\u68B0\u5C42",layerFunction:"DOCUMENT",side:"INTERNAL",polarity:"POSITIVE"},{name:"Component Shape Layer",name_zn:"\u5143\u4EF6\u5916\u5F62\u5C42",layerFunction:"DOCUMENT",side:"NONE",polarity:"POSITIVE"},{name:"Drill Drawing Layer",name_zn:"\u94BB\u5B54\u56FE\u5C42",layerFunction:"DOCUMENT",side:"INTERNAL",polarity:"POSITIVE"}];function rRt(o){return{name:o,name_zn:"\u5185\u5C42",layerFunction:"SIGNAL",side:"INTERNAL",polarity:"POSITIVE"}}function iRt(o){return{name:o,name_zn:"\u4ECB\u8D28",layerFunction:"DIELCORE",side:"NONE",polarity:"POSITIVE"}}function nRt(o){return{name:o,name_zn:"\u81EA\u5B9A\u4E49",layerFunction:"DOCUMENT",side:"NONE",polarity:"POSITIVE"}}function oRt(o){return{name:o,name_zn:"\u591A\u5C42",layerFunction:"DRILL",side:"ALL",polarity:"POSITIVE"}}function tje(o,t){let e=K3e.find(r=>r.name===o);if(!e)switch(t){case"SIGNAL":case"PLANE":return rRt(o);case"SUBSTRATE":return iRt(o);case"MULTI":return oRt(o);default:return nRt(o)}return e}var Tce=class extends cs{constructor(t){super(t),this.layerMap=K3e}getData(t,e){let r=tje(e.name,e.type);switch(t){case"name":return r.name;case"layerFunction":return r.layerFunction;case"side":return r.side;case"polarity":return r.polarity}}};var Ice=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"layerId":return e.layerName}}};var Cce=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"name":return e.layerName}}};var Sce=class extends cs{constructor(t){super(t)}getData(t,e){var s;let r=jT.getInstance(),{pad:i,layer:n}=e;switch(t){case"padstackDefRef":return i instanceof It?"Via_"+i.globalIndex:rw(i.globalIndex,(s=i.getParent())==null?void 0:s.designator,i.num);case"Location":let a=i.center;return{x:this.convertUnit(a.x),y:this.convertUnit(a.y)};case"StandardPrimitiveRef":{let h=i,u=0;i instanceof Je?(n===5?u=i.topSolderExpansion:n===6?u=i.bottomSolderExpansion:(n===7||n===8)&&(u=i.pasteExpansion),h=B_(i,n)):n===5?u=i.topExpansion:n===6&&(u=i.bottomExpansion);let d=ty(h,u);return{id:d}}case"PinRef":let l=i.getParent();return l&&i instanceof Je?{pin:i.num,componentRef:r.get(l)}:null;case"Xform":let c=null;return i instanceof Je&&B_(i,n).type!=="POLYGON"&&(c={rotation:this.toFix(i.rotation*180/Math.PI)}),c}}};var Ece=class extends cs{constructor(t){super(t)}getData(t,e){let r=["TOP","BOTTOM","SIGNAL"],i=["TOP_SOLDER_MASK","BOT_SOLDER_MASK"],n="SUBSTRATE";switch(t){case"name":return e.name;case"General":let s="";e.type===n?s="FR-4":i.indexOf(e.type)>=0?s="Solder Resist":r.indexOf(e.type)>=0&&(s="copper");let a={type:"MATERIAL"};return s&&(a.Property={text:s}),a;case"material":return e.type===n?"FR-4":i.indexOf(e.type)>=0?"Solder Resist":r.indexOf(e.type)>=0?"copper":null;case"other":case"electrical":case"thermal":case"instruction":case"standard":case"configuration":return null}}};var Oce=class extends cs{constructor(e){super(e);this.stackupName="Stackup"}getData(e,r){let i=$e.getInstance().getLayerPhys(),n=0;switch(i.forEach(s=>n+=s.thickness),e){case"name":return this.stackupName;case"tolPlus":return 0;case"tolMinus":return 0;case"overallThickness":return this.convertUnit(n);case"whereMeasured":return"OTHER"}}};var Ace=class extends cs{constructor(t){super(t)}getData(t,e){let r=$e.getInstance().getLayerPhys(),i=0;switch(r.forEach(n=>i+=n.thickness),t){case"name":return e;case"thickness":return this.convertUnit(i);case"tolPlus":return 0;case"tolMinus":return 0}}};var _ce=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"layerOrGroupRef":return e.name;case"sequence":return 1;case"thickness":let i=$e.getInstance().getLayerPhys(),n=0,s=i.find(a=>a.layerId===e.layerId);return s&&(n=s.thickness||0),this.convertUnit(n);case"tolMinus":return 0;case"tolPlus":return 0;case"SpecRef":return{id:e.name}}}};var vce=class extends cs{constructor(t){super(t)}getData(t,e){}};var xce=class extends cs{constructor(e){super(e);this.viaPrefix="Via_"}getData(e,r){var s,a;let{item:i,layers:n}=r;switch(e){case"name":return i instanceof Je?rw(i.globalIndex,(s=i.getParent())==null?void 0:s.designator,i.num):this.viaPrefix+i.globalIndex;case"PadstackHoleDef":if(i.layerId!==12)return null;if(i instanceof Je){let c=i.hole;return{name:eN(i.globalIndex,(a=i.getParent())==null?void 0:a.designator,i.num),diameter:this.convertUnit(c.holeRadius*2),platingStatus:"PLATED",plusTol:0,minusTol:0,x:this.convertUnit(i.center.x),y:this.convertUnit(i.center.y)}}else return{name:`Hole_Via_${i.globalIndex}`,diameter:this.convertUnit(i.holeRadius*2),platingStatus:"VIA",plusTol:0,minusTol:0,x:this.convertUnit(i.center.x),y:this.convertUnit(i.center.y)};case"PadstackPadDef":let l=$e.getInstance();if(i instanceof Je){let c=[];for(let h of n){let u=0,d=h.layerId;d==5?u=i.topSolderExpansion:d==6?u=i.bottomSolderExpansion:(d==8||d==7)&&(u=i.pasteExpansion);let p=B_(i,d),m=[{Location:{x:0,y:0},StandardPrimitiveRef:{id:ty(p,u)}}],g={layerRef:h.name,padUse:"REGULAR",shapes:m};c.push({PadstackPadDef:g})}return c}else{let c=[];if(i.type===1){let u=l.getLayer(i.startLayer),d=l.getLayer(i.endLayer),p=u.name+" to "+d.name;c.push({PadstackPadDef:{layerRef:p,padUse:"REGULAR",Location:{x:0,y:0},StandardPrimitiveRef:{id:ty(i)}}})}for(let u of n){let d=0;u.layerId==5?d=i.topExpansion:u.layerId==6&&(d=i.bottomExpansion);let p={layerRef:u.name,padUse:"REGULAR",shapes:[{Location:{x:0,y:0},StandardPrimitiveRef:{id:ty(i,d)}}]};c.push({PadstackPadDef:p})}return c}}}};var Rce=class extends cs{constructor(t){super(t)}getData(t,e){let r=e.profiles,i=e.cutouts;switch(t){case"Polygon":return r?this.getPolygon(r):null;case"Cutout":return this.getCutout(i)}}getPolygon(t){return this.parseShape(t)}getCutout(t){let e=[];return t.forEach(r=>e.push({Cutout:this.parseShape(r)})),e}parseShape(t){let e=[],r={polygons:e},i=t.primitives;i[0]&&e.push(this.startPoint(i[0].start()));for(let n=0;n<i.length;n++){let s=i[n];s instanceof M?e.push(this.lineto(s.end())):s instanceof q&&e.push(this.arcto(s.end(),s.center,!s.isCCW))}return r}};var Dce=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"name":return e.id+"_"+e.uuid;case"type":return e.id.split("_")[0];case"pinOneOrientation":return"LOWER_LEFT";case"height":return 0;case"Outline":return this.getOutline(e);case"Pin":return this.getPins(e)}}getOutline(t){let e=t.getBBox();if(!e){let l=[];t.iterator(h=>(l.push(h),!0));let c=new _e;l.forEach(h=>{h.isEmpty||c.ext1(h.buildBBox())}),e=c.build1()}let r=e.LL(),i=e.UL(),n=e.UR(),s=e.LR(),a=[this.startPoint(r),this.lineto(i),this.lineto(n),this.lineto(s),this.lineto(r)];return{outline:[{Polygon:{polygons:a}},{LineDesc:{lineEnd:"ROUND",lineWidth:"0",lineProperty:"SOLID"}}]}}getPins(t){let e=[],r=t.getOrigin(),i=new S(-r.x,-r.y);t.iterator(s=>(s instanceof Je&&e.push(s),!0));let n=[];return e.forEach((s,a)=>n.push(this.getPin(s,i))),n}getPin(t,e){let r="THRU",i="THROUGH_HOLE_PIN",n=t.center.add(e),s="ELECTRICAL",a=t.layerId,l=null;a===2?l=t.bottom:l=t.top;let c=ty(l);t.layerId!==12&&(r="SURFACE",i="SURFACE_MOUNT_PIN");let h={Pin:{number:t.num,name:t.num,type:r,electricalType:s,mountType:i,Location:{x:this.convertUnit(n.x),y:this.convertUnit(n.y)},StandardPrimitiveRef:{id:c}}};return t.rotation&&l.type!=="POLYGON"&&(h.Pin.Xform={rotation:this.toFix(t.rotation*180/Math.PI)}),h}};var wce=class extends cs{constructor(t){super(t)}getData(t,e){let r=jT.getInstance();switch(t){case"refDes":return r.get(e);case"packageRef":return e.footprintId+"_"+e.footprintUUID;case"part":return e.footprintId+"_"+e.footprintUUID;case"mountType":return"OTHER";case"layerRef":return $e.getInstance().getLayer(e.layerId).name;case"weight":return e.bbox.width();case"height":return e.bbox.height();case"standoff":return 0;case"Location":return{x:this.convertUnit(e.position.x),y:this.convertUnit(e.position.y)};case"Xform":let i={},n=e.layerId;return e.rotation&&(i.rotation=this.toFix(e.rotation*180/Math.PI)),n===2&&(i.rotation=this.toFix(i.rotation?-(i.rotation+180):-180),i.mirror=!0),i.rotation||i.mirror?i:null}}};var Lce=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"layerRef":return e.name;case"Set":return{ColorRef:{id:"LAYER_COLOR_"+e.name}}}}};var Mce=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"Polyline":return{lines:this.getLine(e)}}}getLine(t){let e=[],{connect:r,track:i}=t,n=r[0].start();return e.push(this.startPoint(n)),r.forEach(s=>{s instanceof M?e.push(this.lineto(s.end())):s instanceof q&&e.push(this.arcto(s.end(),s.center,!s.isCCW))}),e.push({LineDesc:this.lineDesc(this.convertUnit(i.width))}),e}};var Nce=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"UserSpecial":{let n=e.strokeWidth,s=[],a=e.outline;return e instanceof Li&&(a=e.getRealOutline()),a.forEach(l=>{l.primitives.forEach(h=>{s.push(this.getLine(h,n))})}),{lines:s}}case"Xform":let r=e.rotation,i=null;return r&&(i={rotation:this.toFix(r*180/Math.PI)}),i}return null}getLine(t,e){if(t instanceof M){let r=t.start(),i=t.end();return{Line:{startX:this.convertUnit(r.x),startY:this.convertUnit(r.y),endX:this.convertUnit(i.x),endY:this.convertUnit(i.y),LineDesc:this.lineDesc(this.convertUnit(e))}}}else if(t instanceof q){let r=t.start(),i=t.end(),n=t.center,s=t.isCCW;return{Arc:{startX:this.convertUnit(r.x),startY:this.convertUnit(r.y),endX:this.convertUnit(i.x),endY:this.convertUnit(i.y),centerX:this.convertUnit(n.x),centerY:this.convertUnit(n.y),clockwise:!s,LineDesc:this.lineDesc(this.convertUnit(e))}}}}},kce=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"Contour":{let n=e.group;return this.getOutLine(n)}case"Xform":let r=e.text.rotation,i=null;return r&&(i={rotation:this.toFix(r*180/Math.PI)}),i}return null}getOutLine(t){let e=[];return t.forEach(r=>{let i=r.pl.primitives,n=r.flag,s=[],a=i[0].start();s.push(this.startPoint(a)),i.forEach(l=>{l instanceof M?s.push(this.lineto(l.end())):l instanceof q&&s.push(this.arcto(l.end(),l.center,!l.isCCW))}),n?e.push({Polygon:{polygon:s}}):e.push({Cutout:{polygon:s}})}),{Counter:e}}};var Bce=class extends cs{constructor(t){super(t)}getData(t,e){let{item:r,expansion:i,model:n}=e,s=r.type,a=ty(r,i);if(i<0&&(i=0),t=="id")return a;if(r instanceof VI)switch(t){case"Circle":return s!=="ELLIPSE"?null:{diameter:this.convertUnit(Math.max(r.width+2*i,0))};case"RectCenter":return s==="RECT"&&r.ratio==0&&i<=0?{width:this.convertUnit(Math.max(r.width+2*i,0)),height:this.convertUnit(Math.max(r.height+2*i,0))}:null;case"RectRound":let l=this.convertUnit(Math.max(r.width+2*i,0)),c=this.convertUnit(Math.max(r.height+2*i,0)),h={upperRight:"true",upperLeft:"true",lowerLeft:"true",lowerRight:"true"};return s==="OVAL"?{width:l,height:c,radius:Math.min(l,c)/2,...h}:s==="RECT"&&r.ratio!==0?{width:l,height:c,radius:Math.min(l,c)*r.ratio/2,...h}:s==="RECT"&&r.ratio==0&&i>0?{width:l,height:c,radius:this.convertUnit(i),...h}:null;case"Contour":if(s!=="POLYGON")return null;let u=n.center,d=Fg(n,r,i),p=(d==null?void 0:d.primitives)||r.pl.primitives,m=[],g=p[0].start();m.push(this.startPoint(g.add(u.mul(-1))));for(let y=0;y<p.length;y++){let b=p[y];b instanceof M?m.push(this.lineto(b.end().add(u.mul(-1)))):b instanceof q&&m.push(this.arcto(b.end().add(u.mul(-1)),b.center.add(u.mul(-1)),!b.isCCW))}return{Polygon:{polygons:m}}}else return t==="Circle"?{diameter:this.convertUnit(Math.max((r.radius+i)*2,0))}:null}};var Fce=class extends cs{constructor(t){super(t)}getData(t,e){let r=e.item,i=jT.getInstance(),n=r[0],s=e.number;switch(t){case"OEMDesignNumberRef":let a=this.getAttrs(r,s);return a.length?this.formatTextValue(a.join(",")):":";case"category":return"ELECTRICAL";case"description":let l=this.getAttrs(r,"value");return l.length?this.formatTextValue(l.join(",")):":";case"internalPartNumber":let c=this.getAttrs(r,"Supplier Part");return c.length?this.formatTextValue(c.join(",")):":";case"pinCount":return n.getPads().length;case"quantity":return r.length;case"Characteristics":return{category:"ELECTRICAL"};case"RefDes":return r.map(u=>({RefDes:{name:i.get(u.model),packageRef:u.footprintId+"_"+u.footprintUUID,layerRef:$e.getInstance().getLayer(u.layerId).name}}))}}getAttrs(t,e){let r=new Set;return t.forEach(i=>{let s=i.model.attrsMap[e];s&&r.add(s)}),Array.from(r)}};var Vce=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"Polyline":return{lines:this.getPolyline(e)}}}getPolyline(t){let e=[],r=t.getMathGraphics().primitives,i=r[0].start();return e.push(this.startPoint(i)),r.forEach(n=>{if(n instanceof M)e.push(this.lineto(n.end()));else if(n instanceof q){let{center:s,rx:a,ry:l,isCCW:c}=n;if(t instanceof Po){let h=s.add(new S(-1,0).mul(a)),u=s.add(new S(1,0).mul(a));e.push(this.arcto(h,s)),e.push(this.arcto(u,s))}else e.push(this.arcto(n.end(),s,!c))}}),e.push({LineDesc:this.lineDesc(this.convertUnit(t.strokeWidth))}),e}};var Gce=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"Contour":return this.region(e);default:return null}}region(t){if(t instanceof fe)return{Polygon:{lines:this.getLines(t)}};if(t instanceof Gt){let e=t.items,r,i=[];return e.forEach((n,s)=>{s==0?r={lines:this.getLines(n)}:i.push({Cutout:{polygons:this.getLines(n)}})}),{Polygon:r,Cutouts:i}}}getLines(t){let e=t.primitives,r=[],i=e[0].start();return r.push(this.startPoint(i)),e.forEach(n=>{n instanceof M?r.push(this.lineto(n.end())):n instanceof q&&r.push(this.arcto(n.end(),n.center,!n.isCCW))}),r}};var Uce=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"Contour":return this.getOutLine(e);case"Xform":return null}return null}getOutLine(t){let e=[];return t.forEach(r=>{let i=r.pl.primitives,n=r.flag,s=i.length,a=[],l=i[0].start();a.push(this.startPoint(l)),i.forEach((c,h)=>{c instanceof M?a.push(this.lineto(c.end())):c instanceof q?a.push(this.arcto(c.end(),c.center,!c.isCCW)):c instanceof Mr&&c.points(.1).forEach(d=>{a.push(this.lineto(d))}),s===h+1&&(c.end().equals1(l)||a.push(this.lineto(l)))}),n?e.push({Polygon:{polygon:a}}):e.push({Cutout:{polygon:a}})}),{Counter:e}}};var Hce=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"Contour":return this.getCopperRegion(e)}}getCopperRegion(t){let e=[];return t.forEach((r,i)=>{let n=r.primitives,s=[],a=n[0].start();s.push(this.startPoint(a)),n.forEach(l=>{l instanceof M?s.push(this.lineto(l.end())):l instanceof q&&s.push(this.arcto(l.end(),l.center,!l.isCCW))}),i==0?e.push({Polygon:{polygon:s}}):e.push({Cutout:{polygon:s}})}),{Counter:e}}};var Wce=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"UserSpecial":return this.getPolygon(e)}return null}getPolygon(t){let e=[],r=t.getBaseGraphics();for(let i of r)for(let n of i)if(n instanceof M){let s=n.start(),a=n.end(),l={Line:{startX:this.convertUnit(s.x),startY:this.convertUnit(s.y),endX:this.convertUnit(a.x),endY:this.convertUnit(a.y),LineDesc:this.lineDesc(this.convertUnit(t.strokeWidth))}};e.push(l)}else if(n instanceof q){let s=n.start(),a=n.end(),l=n.center,c=n.isCCW,h={Arc:{startX:this.convertUnit(s.x),startY:this.convertUnit(s.y),endX:this.convertUnit(a.x),endY:this.convertUnit(a.y),centerX:this.convertUnit(l.x),centerY:this.convertUnit(l.y),clockwise:!c,LineDesc:this.lineDesc(this.convertUnit(t.strokeWidth))}};e.push(h)}return{polygons:e}}};var zce=class extends cs{constructor(t){super(t)}getData(t,e){switch(t){case"id":return e.layerName;case"Color":let{r,g:i,b:n}=e.color;return{r,g:i,b:n}}}};var Yce=class extends cs{constructor(t){super(t)}getData(t,e){let r=e[0],i=e[1];switch(t){case"name":return r||"NoNet";case"netClass":return this.netRule(r);case"PinRef":return this.pinRefs(i)}}netRule(t){let e="UNUSED";if(!t)return e;let i=s9e(!0).find(n=>n.value===t);return i?i.text:e}pinRefs(t){let e=[];for(let[r,i]of t)i.forEach(n=>{e.push({PinRef:{pin:n,componentRef:r}})});return e}};var jce=class{constructor(t){this.format=new gce().getConfig(),this.pad=new Sce(t),this.via=new vce(t),this.layerPhys=new Ice(t),this.hole=new bce(t),this.slot=new Pce(t),this.profile=new Rce(t),this.package=new Dce(t),this.component=new wce(t),this.track=new Mce(t),this.line=new Vce(t),this.text=new Nce(t),this.font=new kce(t),this.region=new Gce(t),this.bom=new Fce(t),this.image=new Uce(t),this.copper=new Hce(t),this.size=new Wce(t),this.layer=new Tce(t),this.entryStandard=new Bce(t),this.layerRef=new Cce(t),this.spec=new Ece(t),this.stackup=new Oce(t),this.stackupGroup=new Ace(t),this.stackupLayer=new _ce(t),this.padStack=new xce(t),this.layerFeature=new Lce(t),this.layerColor=new zce(t),this.logicalNet=new Yce(t)}feedItems(t,e,r){let i=[];return e.forEach(n=>{n instanceof zs&&(n=n.model),n.getParent()==null&&(!t&&(t=this.getFileType(n)),i.push(this.feed(t,n,r)))}),i}feedItems2Attr(t,e){let r=[];return e.forEach(i=>{i instanceof zs&&(i=i.model),i.getParent()==null&&(!t&&(t=this.getFileType(i)),r.push(this.feed2Attr(t,i)))}),r}feedLayerItems(t,e,r){let i=[];return e.forEach(n=>{i.push(this.feed(t,n,r))}),i}feedLayerItems2Attr(t,e){let r=[];return e.forEach(i=>{r.push(this.feed2Attr(t,i))}),r}getFileType(t){if(t instanceof Je)return"PAD";if(t instanceof It)return"VIA";if(t instanceof RA)return"Layer"}getItemFormat(t){return this.format[t]}getData(t,e,r){return e.getData(t,r)}getEncode(t){switch(t){case"VIA":return this.hole;case"PAD":return this.pad;case"HOLE":return this.hole;case"SLOT":return this.slot;case"PROFILE":return this.profile;case"PACKAGE":return this.package;case"COMPONENT":return this.component;case"TRACK":return this.track;case"FONT":return this.font;case"TEXT":return this.text;case"LINE":return this.line;case"REGION":return this.region;case"IMAGE":return this.image;case"COPPER":return this.copper;case"SIZE":return this.size;case"BomItem":return this.bom;case"EntryStandard":return this.entryStandard;case"LayerColor":return this.layerColor;case"LayerRef":return this.layerRef;case"Spec":return this.spec;case"Layer":return this.layer;case"Stackup":return this.stackup;case"StackupGroup":return this.stackupGroup;case"StackupLayer":return this.stackupLayer;case"PadStackDef":return this.padStack;case"LayerFeature":return this.layerFeature;case"LogicalNet":return this.logicalNet}}getTag(t){switch(t){case"PAD":return"Pad";case"VIA":return"Hole";case"Stackup":return"Stackup";case"StackupGroup":return"StackupGroup";case"Layer":return"Layer";case"LayerColor":return"EntryColor";case"HOLE":return"Hole";case"SLOT":return"SlotCavity";case"PadStackDef":return"PadStackDef";case"PROFILE":return"Profile";case"PACKAGE":return"Package";case"COMPONENT":return"Component";case"LogicalNet":return"LogicalNet";case"LayerFeature":return"LayerFeature";case"EntryStandard":return"EntryStandard";case"BomItem":return"BomItem";case"StackupLayer":return"StackupLayer";case"Spec":return"Spec";case"FONT":case"TEXT":case"TRACK":case"LINE":case"REGION":case"COPPER":case"IMAGE":case"SIZE":return"Features"}}feed(t,e,r){let i=this.getItemFormat(t),n=this.getEncode(t),s=new Map;for(let l of i){let c=this.getData(l,n,e);c!==null&&s.set(l,c)}let a=new sa(this.getTag(t),r);return this.addAttribute(a,s),a}feed2Attr(t,e){let r=this.getItemFormat(t),i=this.getEncode(t),n=new Map;for(let s of r){let a=this.getData(s,i,e);a!==null&&n.set(s,a)}return n}addAttribute(t,e){if(e instanceof Map)for(let[r,i]of e)if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")t.setAttribute(r,i.toString());else if(i instanceof Array)i.forEach(n=>{for(let s in n){let a=new sa(s,t);this.addAttribute(a,n[s])}});else{let n=new sa(r,t);this.addAttribute(n,i)}else for(let r in e){let i=e[r];if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")t.setAttribute(r,i.toString());else if(i instanceof Array)i.forEach(n=>{for(let s in n){let a=new sa(s,t);this.addAttribute(a,n[s])}});else{let n=new sa(r,t);this.addAttribute(n,i)}}}};function ty(o,t=0){if(t<0&&(t=0),o instanceof VI){let e=o.type;if(e=="RECT"&&o.ratio===0&&t<=0){let r=AG(Math.max(o.width+2*t,0)),i=AG(Math.max(o.height+2*t,0));return"RECTANGLE_"+r+"X"+i}else{if(e==="ELLIPSE")return"CIRCLE_"+AG(Math.max(o.width+2*t,0));if(e==="POLYGON"){let r=o.pl.primitives,i=r[0].start();return"POLYGON_"+i.x+"X"+i.y+"_"+r.length+"_"+t}else if(e==="OVAL"||e==="RECT"&&o.ratio!==0||e==="RECT"&&t>0){let r=AG(Math.max(o.width+2*t,0)),i=AG(Math.max(o.height+2*t,0)),n=0;return e==="OVAL"?n=Math.min(r,i)/2:o.ratio?n=Math.min(r,i)*o.ratio/2:t>0&&(n=t),"RECTROUND_"+r+"X"+i+"X"+n}}}else if(o instanceof It)return"CIRCLE_"+AG(Math.max((o.radius+t)*2,0));return""}function AG(o){return Math.round(o*1e9)/1e8}function rw(o,t="NONE",e="NONE"){return t+"_"+e+"_"+o}function eN(o,t="NONE",e="NONE"){return`Hole_${t}_${e}_${o}`}function B_(o,t){return t===1||t==5||t===7?o.top:t===2||t==6||t===8?o.bottom:o.inner||o.padStyle}var Xce=class extends sa{constructor(e,r,i){super("CadHeader",i);this.layers=new Array;this.layers=e,this.unit=r}add(e,r="MATERIAL",i){let n={type:r};i&&(n.Property={text:i});let s=new Map;s.set("name",e),s.set("General",n),this.layers.push(s)}delete(e){let r=this.layers.findIndex(i=>i.get("name")===e);r>=0&&this.layers.splice(r,1)}clear(){super.clear(),this.layers.length=0}toString(e){let r=Uh.Ecad.CadHeader(this.unit,this.layers);return e.push(this.toBuffer(r)),this.clear(),e}};var qce=class extends sa{constructor(e,r){super("Footprint",r);this.components=[];this.packages=[];this.handel=e,this.logicalNet=new Map}init(){let r=Wi.getInstance().getAllItem();for(;r.length>0;)this.parse(r.splice(0,10))}parse(e){for(let r=0;r<e.length;r++){let i=e[r];this.parsePackage(i);for(let n of i.components)this.parseComponent(n),this.addLogicalNet(n);this.parsePads(i)}}parsePackage(e){let r=3,n=this.handel.encode.feed("PACKAGE",e),s=[];n.toString(s,r),this.packages.push(this.mergeSource(s))}parseComponent(e){let r=3,n=this.handel.encode.feed("COMPONENT",e),s=[];n.toString(s,r),this.components.push(this.mergeSource(s))}parsePads(e){let r=e.getPads();this.handel.createPinStandard(r)}parseLogicalNet(){let e=3,r=this.handel.encode,i=[];for(let n of this.logicalNet){let s=[];r.feed("LogicalNet",n).toString(s,e),i.push(this.mergeSource(s))}return i}addLogicalNet(e){let i=jT.getInstance().get(e),n=e.getPads();for(let s of n){let a=s.net,l=s.num,c=this.logicalNet.get(a);c||this.logicalNet.set(a,c=new Map);let h=c.get(i);h||c.set(i,h=new Set),h.add(l)}}clear(){super.clear(),this.logicalNet.clear(),this.components.length=0,this.packages.length=0}toString(e){let r=this.parseLogicalNet();return e.push(...this.packages),e.push(...this.components),e.push(...r),this.logicalNet.clear(),this.packages.length=0,this.components.length=0,this.clear(),e}};var $ce=class extends sa{constructor(e,r){super("PadStackDef",e);this.padStacks=new Array;this.handel=null;this.handel=r}add(e){this.padStacks.push(this.getTemplate(e))}clear(){super.clear(),this.padStacks.length=0}toString(e,r){for(;this.padStacks.length>0;){let n=this.padStacks.shift();e.push(n)}return this.clear(),e}getTemplate(e){var u,d;let{item:r,layers:i}=e,n=[],a=`        <PadStackDef name="${r instanceof Je?rw(r.globalIndex,(u=r.getParent())==null?void 0:u.designator,r.num):"Via_"+r.globalIndex}">
`,l=`        </PadStackDef>
`;n.push(a);let c=null;if(r.layerId===12){let p=r.hole;c=r instanceof Je?{name:eN(r.globalIndex,(d=r.getParent())==null?void 0:d.designator,r.num),diameter:this.convertUnit(p.holeRadius*2),platingStatus:"PLATED",plusTol:0,minusTol:0,x:this.convertUnit(r.center.x),y:this.convertUnit(r.center.y)}:{name:`Hole_Via_${r.globalIndex}`,diameter:this.convertUnit(r.holeRadius*2),platingStatus:"VIA",plusTol:0,minusTol:0,x:this.convertUnit(r.center.x),y:this.convertUnit(r.center.y)}}if(c){let{diameter:p,minusTol:m,name:g,platingStatus:y,plusTol:b,x:P,y:T}=c;n.push(`          <PadstackHoleDef name="${g}" diameter="${p}" platingStatus="${y}" plusTol="${b}" minusTol="${m}" x="${P}" y="${T}"/>
`)}return this.getPadDefs(e).forEach(p=>{let{layerRef:m,padUse:g}=p,y=p.shapes,b=y.Location,P=y.StandardPrimitiveRef;n.push(`          <PadstackPadDef layerRef="${m}" padUse="${g}">
	          <Location x="${b.x}" y="${b.y}"/>
	          <StandardPrimitiveRef id="${P.id}"/>
	        </PadstackPadDef>
`)}),n.push(l),this.toBuffer(n.join(""))}getPadDefs(e){let{item:r,layers:i}=e,n=$e.getInstance();if(r instanceof Je){let s=[];for(let a of i){let l=0,c=a.layerId;c==5?l=r.topSolderExpansion:c==6?l=r.bottomSolderExpansion:(c==8||c==7)&&(l=r.pasteExpansion);let h=B_(r,c),u={Location:{x:0,y:0},StandardPrimitiveRef:{id:ty(h,l)}},d={layerRef:a.name,padUse:"REGULAR",shapes:u};s.push(d)}return s}else{let s=[];if(r.type===1){let l=n.getLayer(r.startLayer),c=n.getLayer(r.endLayer),h=l.name+" to "+c.name;s.push({layerRef:h,padUse:"REGULAR",shapes:{Location:{x:0,y:0},StandardPrimitiveRef:{id:ty(r)}}})}for(let l of i){let c=0;l.layerId==5?c=r.topExpansion:l.layerId==6&&(c=r.bottomExpansion);let h={layerRef:l.name,padUse:"REGULAR",shapes:{Location:{x:0,y:0},StandardPrimitiveRef:{id:ty(r,c)}}};s.push(h)}return s}}convertUnit(e){return Math.round(Bs(e*10,"mil",this.handel.unit)*1e8)/1e8}};var Kce=class extends sa{constructor(e,r){super("Layers",e);this.layers=new Array;this.panelize=!1;this.handel=null;this.handel=r}init(e,r=!1){this.panelize=r;for(let i=0;i<e.length;i++){let n=e[i],s=n.name,a={item:n,layerRefName:s};n.layerId===12&&(a={isSpan:!0,layerRefName:s,from:"Top Layer",to:"Bottom Layer",startLayer:1,endLayer:2}),this.add(a)}}add(e){let r=e.layerRefName;r?this.layers.find(n=>n.layerRefName===r)||this.layers.push(e):this.layers.push(e)}deleteLayer(e){let r=this.layers.findIndex(i=>i.layerRefName===e);r>=0&&this.layers.splice(r,1)}clear(){super.clear(),this.layers.length=0}toString(e,r){let i=[],n=[];for(let s=1;s<=this.layers.length;s++){let a=this.layers[s-1],{item:l,isSpan:c,layerRefName:h,stiffener:u}=a;if(l){i.push(this.handel.encode.feed("Layer",l).parseXmlStr(3));let d=this.handel.encode.feed("StackupLayer",l);d.setAttribute("sequence",s.toString());let p=d.parseXmlStr(4);n.push(p)}else if(c){i.push(this.parseSpanLayer(a));let d=new sa("StackupLayer"),p={layerOrGroupRef:h,thickness:"0",tolMinus:"0",tolPlus:"0",sequence:s.toString()};d.setAttribute(p),new sa("SpecRef",d).setAttribute("id",h);let g=d.parseXmlStr(4);n.push(g)}else if(u){let{name:d,layerFunction:p,side:m,polarity:g,thickness:y}=u,b=`      <Layer name="${d}" layerFunction="${p}" side="${m}" polarity="${g}"/>
`;i.push(this.toBuffer(b));let P=new sa("StackupLayer"),T={layerOrGroupRef:d,thickness:y||0,tolMinus:"0",tolPlus:"0",sequence:s.toString()};P.setAttribute(T),new sa("SpecRef",P).setAttribute("id",d);let C=P.parseXmlStr(4);n.push(C)}}return e.push(this.mergeSource(i)),e.push(this.createStackUp(n)),this.clear(),e}createStackUp(e){let i=this.handel.encode.feed2Attr("Stackup",this.layers).get("overallThickness"),s=e.map(h=>new TextDecoder().decode(h)).join(""),a=`      <Stackup name="Stackup" overallThickness="${i}" tolPlus="0" tolMinus="0" whereMeasured="OTHER">
`,l=`      </Stackup>
`,c=[a];return c.push(this.createGroup(x.getInstance().name,s,i)),this.panelize&&c.push(this.createGroup("Panels",s,i)),c.push(l),this.toBuffer(c.join(""))}createGroup(e,r,i){return'        <StackupGroup name="'+e+'_AllStackupLayers" thickness="'+i+`" tolMinus="0" tolPlus="0">
`+r+`        </StackupGroup>
`}parseSpanLayer(e){let{item:r,isSpan:i,from:n,to:s,startLayer:a,endLayer:l,layerRefName:c}=e,h="NONE";a==1&&l==2?h="ALL":a==1?h="TOP":l==2?h="BOTTOM":h="INTERNAL";let u={name:c,layerFunction:"DRILL",side:h,polarity:"POSITIVE"},d={fromLayer:n,toLayer:s},p=new sa("Layer"),m=new sa("Span",p);return p.setAttribute(u),m.setAttribute(d),p.parseXmlStr(3)}};var c2=class extends sa{constructor(t,e){super("polygon",e),this.unit=t}parse(t,e,r=0){let{header:i,lineDesc:n}=e,s=[],a=i.pop();for(let c=0;c<i.length;c++){let h=i[c],{tag:u,children:d}=h,p=[];for(let m in h){if(m==="tag")continue;let g=h[m];(typeof g=="string"||typeof g=="number")&&p.push(` ${m}="${g}"`)}if(s.push(`${Uh.indent[r+c]}<${u}${p.join("")}>
`),(d==null?void 0:d.length)>0)for(let m of d){let g=m.parseXmlStr(r+c+2);s.push(hce.decode(g))}}t.forEach((c,h)=>{h==0?(s.push(`${Uh.indent[r+i.length]}<${a.tag}>
`),s.push(this.getPolygon(c,r+i.length+1)),n&&s.push(this.lineDescTemplate(n,r+i.length+1)),s.push(`${Uh.indent[r+i.length]}</${a.tag}>
`)):(s.push(`${Uh.indent[r+i.length]}<Cutout>
`),s.push(this.getPolygon(c,r+i.length+1)),n&&s.push(this.lineDescTemplate(n,r+i.length+1)),s.push(`${Uh.indent[r+i.length]}</Cutout>
`))});for(let c=i.length-1;c>=0;c--)s.push(`${Uh.indent[r+c]}</${i[c].tag}>
`);let l=s.join("");this.xmlStr=l}getPolygon(t,e){let r=[],i=t[0].start();return r.push(this.startPoint(i,e)),t.forEach(n=>{if(n instanceof M)r.push(this.lineto(n.end(),e));else if(n instanceof q)if(ne.greatereq(Math.abs(n.sweepAngle),360)){let s=n.center.sub(n.start());r.push(this.arcto(n.start().add(s.mul(2)),n.center,!n.isCCW,e)),r.push(this.arcto(n.end(),n.center,!n.isCCW,e))}else r.push(this.arcto(n.end(),n.center,!n.isCCW,e));else n instanceof Mr&&n.points(.1).forEach(a=>{r.push(this.lineto(a,e))})}),r.join("")}clear(){super.clear()}toString(t,e){return t.push(this.xmlStr),this.clear(),t}startPoint(t,e){let r=this.convertUnit(t.x),i=this.convertUnit(t.y);return`${Uh.indent[e]}<PolyBegin x="${r}" y="${i}"/>
`}lineto(t,e){let r=this.convertUnit(t.x),i=this.convertUnit(t.y);return`${Uh.indent[e]}<PolyStepSegment x="${r}" y="${i}"/>
`}arcto(t,e,r,i){let n=this.convertUnit(t.x),s=this.convertUnit(t.y),a=this.convertUnit(e.x),l=this.convertUnit(e.y);return`${Uh.indent[i]}<PolyStepCurve x="${n}" y="${s}" centerX="${a}" centerY="${l}" clockwise="${r}"/>
`}lineDescTemplate(t,e){return`${Uh.indent[e]}<LineDesc lineEnd="ROUND" lineWidth="${this.convertUnit(t)}" lineProperty="SOLID"/>
`}convertUnit(t){return Math.round(Bs(t*10,"mil",this.unit)*1e8)/1e8}};var J3e="millimeter",Zce=class{constructor(t,e,r){this.NoNet="NoNet";this.tip=.07;this.progress=0,this.document=t,this.unit=e,this.OEMNumber=r,this.IPCEncode=new jce(this.unit),this.pcbName=x.getInstance().name,this.isPanelize()}get encode(){return this.IPCEncode}isPanelize(){if(Ii.offset){let e=Ii.bBox,r=Ii.outerBBox,i=e.LL(),n=r.LL(),s=Ii.toJSON();if(s!=null&&s.success){let a={x:this.convertUnit(n.x),y:this.convertUnit(n.y),pcbX:this.convertUnit(i.x),pcbY:this.convertUnit(i.y),nx:s.column,ny:s.row,dx:this.convertUnit(e.width()+s.columnSpacing),dy:this.convertUnit(e.height()+s.rowSpacing),angle:0,mirror:!1,name:"Panels",onlyOutline:s.onlyOutline};this.panelizeMsg=a}}}generateContent(){let t=this.document.getContent();t.init(this.unit,this),this.getLayers().forEach(r=>{let i=r.activeColor,n={r:Math.round(i.r*255),g:Math.round(i.g*255),b:Math.round(i.b*255),model:r};t.addLayer(r.name,n)})}getLayers(){let t=["3D_MODEL","3D_SHELL_BOTTOM","3D_SHELL_OUTLINE","3D_SHELL_TOP","OTHER"],e=$e.getInstance(),r=e.getUseLayer().filter(a=>{if(t.indexOf(a.type)<0)return!0}),n=e.getLayerPhys().filter(a=>a.layerType==="SUBSTRATE").map(a=>e.getLayer(a.layerId));return r.concat(n)}generateEcad(){this.parseCadHeader();let t=this.initCadData();this.generatePcbStep(t),this.needPanelize()&&this.generatePanelStep(t)}parseCadHeader(){let t=this.document.getEcad(),e=this.document.getContent().getAllLayers(),r=this.IPCEncode.feedLayerItems2Attr("Spec",e),i=this.unit;i=="mm"&&(i=J3e);let n=i.toUpperCase(),s=new Xce(r,n,t);this.document.getEcad().cadHeader=s}initCadData(){let t=this.document.getEcad(),e=new sa("CadData",t);return t.cadData=e,this.parseLayerStackup(e),e}parseLayerStackup(t){let e=this.document.getContent().getAllLayers(),r=this.sortLayers(e),i=this.needPanelize(),n=new Kce(t,this);this.document.getEcad().layerNode=n,n.init(r,i)}sortLayers(t){let e=$e.getInstance(),i=e.getLayerPhys().map(n=>e.getLayer(n.layerId));return t.forEach(n=>{i.indexOf(n)<0&&i.push(n)}),i}generatePcbStep(t){let e=this.document.getEcad(),r=new sa("Step",t);this.IPCEncode.addAttribute(r,{name:this.pcbName});let i=new $ce(r,this);e.padStack=i;let n=new sa("Datum",r);n.xmlStr=Uh.Ecad.Datum(this.getDatum()),this.parseProfile(r),this.parseFeature(r),this.parseFootprints(r)}getAllProfile(t=!1){let e=new Array;rn.getInstance().iterator(s=>n(s)),zi.getInstance().iterator(s=>n(s));let{closePls:r,polys:i}=this.connectPolygonOutLine();return r.forEach(s=>e.push(s.pl)),t||i.forEach(s=>e.push(s.pl)),e;function n(s){(s.type=="Board Outline"||s.type=="Line"&&s.layerId==11)&&e.push(s.getMathGraphics())}}connectPolygonOutLine(){var l;let r=[],i=[],n=Mi.getInstance().getAllItem(),s={},a=new _e;n.forEach(c=>{if(c.layerId==11){let h=c.strokeWidth.toFixed(2).toString();s[h]||(s[h]=[]),s[h].push(c)}});for(let c in s){let h=[],u=s[c],d=(l=u[0])==null?void 0:l.strokeWidth;if(u.forEach(P=>{a.ext1(P.bbox);let T=P.outline;if(P.isClose()){i.push({pl:T,strokeWidth:P.strokeWidth,bbox:P.bbox,layerId:11});return}h.push(...T.primitives)}),h.length<=0)continue;let p=a.build1().extendOfSize(2),m=new oh(p,2,.1,new Gi(1),h),g=p.extendOfSize(p.width()),y=m.detect().items.filter(P=>P.bbox().width()<g.width());for(let P of y)P.isClose(.001)&&YI(P).forEach(I=>{let C={pl:I.asClose(),strokeWidth:d,bbox:I.bbox(),layerId:11};i.push(C)});let b=this.filterPrimitives(y,h,d);for(let P of b){let T=fe.build2([P]),I={pl:T,strokeWidth:d,bbox:T.bbox(),layerId:11};r.push(I)}}return{polys:r,closePls:i}}filterPrimitives(t,e,r){if(t.length==0)return e;let i=new nn(10);e.forEach(s=>{i.add(s)});let n=new Set;return t.forEach(s=>{s.primitives.forEach(a=>{let l=i.search(a.bbox().extendOfSize(r));a instanceof q?l.filter(h=>h instanceof q).forEach(h=>{this.inArcShape(a.start(),r,h)&&this.inArcShape(a.end(),r,h)&&n.add(h)}):a instanceof M&&l.filter(h=>h instanceof M).forEach(h=>{this.inLineShape(a.start(),r,h.start(),h.end())&&this.inLineShape(a.end(),r,h.start(),h.end())&&n.add(h)})})}),e.filter(s=>!n.has(s))}inArcShape(t,e,r){let i=t.x,n=t.y,s=r.sweep(),a=r.rx,l=r.center,c=s==le.CW,h=c?r.endAngle():r.startAngle,u=c?r.startAngle:r.endAngle();h%=Vr,h<0&&(h+=Vr),u%=Vr,u<0&&(u+=Vr);let d=a-e/2,p=a+e/2,m=i-l.x,g=n-l.y,y=Math.atan2(g,m);if(y<0&&(y+=Vr),h<=u&&y>=h&&y<=u||h>u&&(y>=h&&y<=Vr||y>=0&&y<=u)||h==u){var b=Math.sqrt(m*m+g*g);return b<=p&&b>=d}else{var b=(p+d)/2,P=new S(l.x+Math.cos(h)*b,l.y+Math.sin(h)*b),T=new S(l.x+Math.cos(u)*b,l.y+Math.sin(u)*b),I=i-P.x,C=n-P.y,E=i-T.x,O=n-T.y;return I*I+C*C<=e*e/4?!0:E*E+O*O<=e*e/4}}inLineShape(t,e,r,i){let n=t.x,s=t.y,a=n-r.x,l=s-r.y,c=n-i.x,h=s-i.y,u=i.x-r.x,d=i.y-r.y,p=new S(-d,u).normalize(),m=u+p.x*e/2,g=d+p.y*e/2,y=m*m+g*g,b=a*a+l*l,P=c*c+h*h,T=Math.abs(a*d-l*u)/2,C=Math.sqrt(u*u+d*d)*e/4;if(T<=C&&b<=y&&P<=y)return!0;{let E=e/2;return b<=E*E?!0:P<=E*E}}getBoardBBox(){let t=this.getAllProfile(),e=new _e;return t.forEach(i=>{e.ext1(i.bbox())}),e.build1()}getSlotRegion(){let t=Mi.getInstance().getAllItem().filter(n=>n.type=="Slot Region"&&!n.isEmpty),e=rn.getInstance().getAllItem().filter(n=>n.type=="Slot Region"&&!n.isEmpty),r=zi.getInstance().getAllItem().filter(n=>n.type=="Slot Region"&&!n.isEmpty),i=[];return Re.addAll(i,t),Re.addAll(i,e),Re.addAll(i,r),i}getDatum(){let t=null;if(this.panelizeMsg)t={x:this.panelizeMsg.x,y:this.panelizeMsg.pcbY};else{let e=this.getBoardBBox().LL();t={x:this.convertUnit(e.x),y:this.convertUnit(e.y)}}return t}parseProfile(t){var n;let e=this.getAllProfile(!0),r=this.getSlotRegion();if((n=this.panelizeMsg)!=null&&n.onlyOutline)this.panelBorder(t);else{let s=-1,a=null,l=0;for(let c=0;c<e.length;c++){let h=e[c].bbox().area();h>=l&&(l=h,s=c,a=e[c])}this.IPCEncode.feed("PROFILE",{profiles:a,cutouts:r.map(c=>c.getMathGraphics())},t)}this.document.getContent().getAllLayers().forEach(s=>{this.IPCEncode.feed("LayerFeature",s,t)});for(let s=0;s<e.length;s++){let a=e[s],l=this.getLayerFeature(t,$e.getInstance().getLayer(11).name),c=[{tag:"Set"},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}];new c2(this.unit,l).parse(this.getRegionPrimitive(a),{header:c},5)}}parseFootprints(t){new qce(this,t).init()}parseFeature(t){this.parsePadData(t),this.parseVias(t),this.parseTracks(t),this.parseText(t),this.parseLines(t),this.parseTearDrops(t),this.parseFillRegion(t),this.parseStiffener(t),this.parseImage(t),this.parseCopper(t),this.parseSize(t),this.parsePlaneZone(t),this.panelizeMsg&&this.parsePanelsData(Ii.getSourceData(),t)}parsePadData(t){let e=$n.getInstance().getAllItem(),r=500;for(;e.length>0;){let i=e.splice(0,r);this.parsePads(i,t)}}createPadForLayer(t,e,r){let i={name:"PADSTACK_USAGE",value:e.layerId===2||e.layerId===1?"Smd":"Through",type:"STRING"};this.createPad(t,e,r,i)}createPad(t,e,r,i){let n=this.createSet(t,e);i&&this.nonstandardAttribute(i,n),this.IPCEncode.feed("PAD",{pad:e,layer:r},n),n.parseXmlStr(5)}parseHole(t,e){let r=t.hole.holeOffset;t.hole.holeShape==="SLOT"||!r.equals(S.ORIGIN)?this.IPCEncode.feed("SLOT",t,e).parseXmlStr(5):t.hole.holeShape==="ROUND"&&this.IPCEncode.feed("HOLE",t,e).parseXmlStr(5)}createLayerSpan(t,e,r){let i=new sa("Span",t),n={fromLayer:e,toLayer:r};return i.setAttribute(n),i}getHoleSet(t,e){let r={},i=e.net||this.NoNet;if(e instanceof Je){let s=e.getParent();if(r={net:i,testPoint:e.isTestPad,geometry:rw(e.globalIndex,s==null?void 0:s.designator,e.num)},s){let a={componentRef:s==null?void 0:s.designator};Object.assign(r,a)}else{let a=e.layerId,l={plate:e.plated,padUsage:a!==1&&a!==2?"VIA":"NONE"};Object.assign(r,l)}}else e instanceof It&&(r={net:i,testPoint:"false",plate:"true",padUsage:"VIA",geometry:"Via_"+e.globalIndex});let n=new sa("Set",t);return n.setAttribute(r),n}createSet(t,e){let r=this.getSetAttr(e),i=new sa("Set",t);return i.setAttribute(r),i}getSetAttr(t){let e={},r=(t==null?void 0:t.net)||this.NoNet;if(t instanceof Je){if(e={net:r,testPoint:t.isTestPad},!t.getParent()){let i=t.layerId,n={plate:t.plated,padUsage:i!==1&&i!==2?"VIA":"NONE"};Object.assign(e,n)}}else t instanceof It?e={net:r,testPoint:"false",plate:"true",padUsage:"VIA"}:t instanceof Pn||t instanceof Cn?e={net:r}:t instanceof Li?e={geometryUsage:"TEXT"}:t instanceof yt?e={net:r}:(t==null?void 0:t.type)==="Line"?e={net:r}:(t==null?void 0:t.type)==="TearDrop"?e={net:r,geometryUsage:"TEARDROP"}:(t==null?void 0:t.type)==="Fill Region"&&(e={net:r});return e}nonstandardAttribute(t,e){let r=new sa("NonstandardAttribute",e);return r.xmlStr=`            <NonstandardAttribute name="PADSTACK_USAGE" value="${t.value}" type="STRING"/>
`,r}parseVias(t){let e=Tn.getInstance().getAllItem(),r=$e.getInstance(),i=n=>{for(let s=0;s<n.length;s++){let a=n[s],l=this.getCrossLayer();if(a.type===1){let h=r.getLayer(a.startLayer),u=r.getLayer(a.endLayer),d=this.getBlindLayers(a),p=h.name+" to "+u.name;this.document.getContent().addLayer(p,{isSpan:!0});let m={isSpan:!0,layerRefName:p,from:h.name,to:u.name,startLayer:h.layerId,endLayer:u.layerId};this.document.getEcad().layerNode.add(m);let g=this.getLayerFeature(t,p),y=this.getFeatureSet(g,"net",a.net);this.IPCEncode.feed("HOLE",a,y).parseXmlStr(5),l=d}else{let h=this.getLayerFeature(t,"Multi-Layer"),u=this.getHoleSet(h,a);this.IPCEncode.feed("HOLE",a,u),u.parseXmlStr(5)}l=l.filter(h=>this.filterUnuseLayer(h.layerId,a.unusedInnerLayers));for(let h of l){let u=this.getLayerFeature(t,h.name);this.createPad(u,a,h.layerId),this.addStandard(a,h.layerId)}this.document.getEcad().padStack.add({item:a,layers:l})}};for(;e.length>0;){let n=e.splice(0,500);i(n)}this.updateProgress()}filterUnuseLayer(t,e=[]){return t!==7&&t!==8&&e.indexOf(t)<0}getBlindLayers(t){let e=$e.getInstance(),r=t.startLayer,i=t.endLayer,n=e.getAllCopperLayerId4Order(),s=n.findIndex(c=>c==r),a=n.findIndex(c=>c==i);s>a&&([s,a]=[a,s]);let l=n.slice(s,a+1);return(r===1||i===1)&&(l=l.concat(5,7)),(i===2||r===2)&&(l=l.concat(6,8)),l.map(c=>e.getLayer(c))}formatTextValue(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}parseText(t){let e=mo.getInstance().getAllItem();for(let r of e){let i={name:"TEXT",value:this.formatTextValue(r.value),type:"STRING",font:r.fontFamily},n=$e.getInstance().getLayer(r.layerId).name,s=this.getLayerFeature(t,n),a=this.createSet(s,r),l=this.nonstandardAttribute(i,a);if(r.type===0)this.IPCEncode.feed("TEXT",r,a);else if(r.type===1){let c=r.getRealOutline(),h=[];c.forEach(u=>{let d=u.group,p=h[d];p||(p=h[d]=[]),p.push(u)}),h.forEach(u=>{let d=new c2(this.unit,a),p={tag:"Features"};if(r.rotation){let g=this.toFix(r.rotation*180/Math.PI),y=new sa("Xform");y.setAttribute({rotation:g}),p.children=[y]}let m=[p,{tag:"Contour"},{tag:"Polygon"}];d.parse(u.map(g=>g.pl.primitives),{header:m},6)})}}this.updateProgress()}parseTracks(t){let e=this.generateTrack();for(let[r,i]of e)this.parseTrack(r,i,t);this.updateProgress()}parseTrack(t,e,r){let{layerId:i}=t,n=$e.getInstance().getLayer(i).name,s=this.getLayerFeature(r,n),a=new c2(this.unit,s),l=[{tag:"Set",net:t.net||this.NoNet},{tag:"Features"},{tag:"Polyline"}];a.parse([e],{header:l,lineDesc:t.width},5)}generateTrack(){let t=An.getInstance().getAllItem(),e={},r=new Map;for(let i of t)if(i instanceof yt){if(e[i.globalIndex])continue;let n=this.findTracks(i,e),s=[];for(let a of n)Re.addAll(s,a.points(.1));r.set(i,n)}return r}findTracks(t,e){let r=[t],i=t instanceof Oi?[q.build3(t.center,Ht.toDegrees(t.startAngle),Ht.toDegrees(t.sweepAngle),t.radius,t.radius)]:[new M(t.start,t.end)],n=t.end,s=Mh.getNode(t.net);for(;r.length>0;){let a=r.pop();e[a.globalIndex]=!0;let l=this.getConnect(a,n,s,e),c=l.nextItem;if(c){r.push(c),n=l.nextPoint;let h=c instanceof Oi?q.build3(c.center,Ht.toDegrees(c.startAngle),Ht.toDegrees(c.sweepAngle),c.radius,c.radius):new M(c.start,c.end);l.isStart?i.push(h):i.push(h.reverse())}}for(r.push(t),n=t.start;r.length>0;){let a=r.pop();e[a.globalIndex]=!0;let l=this.getConnect(a,n,s,e),c=l.nextItem;if(c){r.push(c),n=l.nextPoint;let h=c instanceof Oi?q.build3(c.center,Ht.toDegrees(c.startAngle),Ht.toDegrees(c.sweepAngle),c.radius,c.radius):new M(c.start,c.end);l.isStart?i.unshift(h.reverse()):i.unshift(h)}}return i}getConnect(t,e,r,i){let s,a,l=r.map.get(t);if(l){let h=Array.from(l.near).find(u=>{let d=u.item;if(d instanceof yt&&!i[d.globalIndex]&&ne.eq(t.width,d.width)){if(d.start.distance2(e)<1e-4)return s=d.end,a=!0,!0;if(d.end.distance2(e)<1e-4)return s=d.start,a=!1,!0}return!1});return{nextItem:h==null?void 0:h.item,nextPoint:s,isStart:a}}return{nextItem:null,nextPoint:s,isStart:a}}parseLines(t){let e=[];Mi.getInstance().iterator(n=>i(n)),rn.getInstance().iterator(n=>i(n)),zi.getInstance().iterator(n=>i(n));let r={name:"FILLET",value:"true",type:"STRING"};function i(n){n.type==="Line"&&e.push(n)}for(let n of e){let{layerId:s}=n;if(n.type=="Line"){let a=$e.getInstance().getLayer(s).name,l=this.getLayerFeature(t,a),c=this.nonstandardAttribute(r),h=n.getMathGraphics().primitives,u=new c2(this.unit,l),d=[{tag:"Set",net:this.NoNet,children:[c]},{tag:"Features"},{tag:"Polyline"}];u.parse([h],{header:d,lineDesc:n.strokeWidth},5)}}this.updateProgress()}parseTearDrops(t){let e=Mi.getInstance().getAllItem(),r={name:"FILLET",value:"true",type:"STRING"};e.forEach(i=>{if(i.type=="TearDrop"){let{layerId:n}=i,s=$e.getInstance().getLayer(n).name,a=this.getLayerFeature(t,s),l=[{tag:"Set",net:i.net||this.NoNet,geometryUsage:"TEARDROP"},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}];new c2(this.unit,a).parse(this.getRegionPrimitive(i.getMathGraphics()),{header:l},5)}}),this.updateProgress()}parseFillRegion(t){let e=[];Mi.getInstance().iterator(n=>i(n)),rn.getInstance().iterator(n=>i(n)),zi.getInstance().iterator(n=>i(n));let r={name:"FILLET",value:"true",type:"STRING"};e.forEach(n=>{let{layerId:s}=n,a=$e.getInstance().getLayer(s).name,l=this.getLayerFeature(t,a),c=this.nonstandardAttribute(r),h=[{tag:"Set",net:n.net||this.NoNet,children:[c]},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}];new c2(this.unit,l).parse(this.getRegionPrimitive(n.getMathGraphics()),{header:h},5)});function i(n){n.type=="Fill Region"&&e.push(n)}this.updateProgress()}parseImage(t){let e=Qs.getInstance().getAllItem();for(let i of e){let{layerId:n}=i,s=$e.getInstance().getLayer(n).name,a=this.getLayerFeature(t,s),l=this.createSet(a),c=i.getPath(),h=r(c);for(let u of h){let d=[{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}],p=new c2(this.unit,l),m=u.map(g=>g.pl.primitives);p.parse(m,{header:d},6)}}function r(i){let n=[],s=[],a=[];for(let l of i){let c=l.group;a[c]||(a[c]=[]),a[c].push(l)}for(let l of a)if(l&&l.length){for(let c of l)c.flag?(s.length>0&&n.push(s),s=[c]):s.push(c);s.length>0&&n.push(s)}return n}this.updateProgress()}parseCopper(t){let e=Wo.getInstance().getAllItem();for(let r of e){let{layerId:i}=r,n=$e.getInstance().getLayer(i).name,s=this.getLayerFeature(t,n),a=r.getOutline(),l=r.style;if(l=="45grid"||l==="90grid"){let c=r.gridLineWidth;a.forEach(h=>{let u=h.primitives;u&&u.forEach(d=>{let p=d.stroke(c,kr.ROUND,le.CW);new c2(this.unit,s).parse([p.primitives],{header:[{tag:"Set",net:r.net||this.NoNet},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}]},5)})})}else new c2(this.unit,s).parse(a.map(h=>h.primitives),{header:[{tag:"Set",net:r.net||this.NoNet},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}]},5),r.optimization&&r.optimizationWidth!==0&&r.getMathGraphics().items.slice(a.length).forEach(u=>{new c2(this.unit,s).parse([u.primitives],{header:[{tag:"Set",net:r.net||this.NoNet},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}]},5)})}this.updateProgress()}parseSize(t){let e=Ka.getInstance().getAllItem(),r=Sl.getInstance().getAllItem(),i=Za.getInstance().getAllItem();[...e,...r,...i].forEach(n=>{let{text:s,layerId:a}=n,l=$e.getInstance().getLayer(a).name,c=this.getLayerFeature(t,l),h=this.createSet(c,s);this.IPCEncode.feed("SIZE",n,h)}),this.updateProgress()}parsePlaneZone(t){Ho.getInstance().getAllItem().forEach(r=>{let{layerId:i}=r,n=$e.getInstance().getLayer(i).name,s=this.getLayerFeature(t,n),a=r.getOutline(),l=[{tag:"Set",net:r.net||this.NoNet},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}];new c2(this.unit,s).parse(a.map(h=>h.primitives),{header:l},5)}),this.updateProgress()}parseStiffener(t){let e=new Map,r=new Map;Mi.getInstance().iterator(a=>s(a)),rn.getInstance().iterator(a=>s(a)),zi.getInstance().iterator(a=>s(a));let i=this.unit;i=="mm"&&(i=J3e);let n=a=>{let l=a===e;for(let[c,h]of a)for(let[u,d]of h){let p=this.convertUnit(u),m=`${l?"Top":"Bottom"}StiffenerLayer_${c}_${p}`;this.document.getContent().addLayer(m),this.document.getEcad().cadHeader.add(m,"MATERIAL",c);let g={stiffener:{name:m,layerFunction:"STIFFENER",side:l?"TOP":"BOTTOM",polarity:"POSITIVE",thickness:p}};this.document.getEcad().layerNode.add(g);let y={name:"FILLET",value:"true",type:"STRING"};d.forEach(b=>{let P=this.getLayerFeature(t,m),T=this.nonstandardAttribute(y),I=[{tag:"Set",net:b.net||this.NoNet,children:[T]},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}];new c2(this.unit,P).parse(this.getRegionPrimitive(b.getMathGraphics()),{header:I},5)})}};function s(a){if(a.type=="FPC Stiffener"){let l=a.layerId,{material:c,thickness:h}=a.component,u=e;l===59&&(u=r);let d=u.get(c);d||u.set(c,d=new Map);let p=d.get(h);p||d.set(h,p=new Set),p.add(a)}}n(e),n(r),this.updateProgress()}getLayerFeature(t,e){let r="layerRef".toString(),i=t.search("LayerFeature",{[r]:e});return i||(i=new sa("LayerFeature",t),i.setAttribute(r,e)),i}getFeatureSet(t,e,r){let i=t.search("Set",r?{[e]:r}:null);return i||(i=new sa("Set",t),r&&this.IPCEncode.addAttribute(i,{[e]:r})),i}addStandard(t,e){if(t instanceof Je){let r=0;e==5?r=t.topSolderExpansion:e==6?r=t.bottomSolderExpansion:(e==8||e==7)&&(r=t.pasteExpansion);let i=B_(t,e),n=ty(i,r);this.document.getContent().findStandard(n)||this.document.getContent().addStandard(n,{item:i,expansion:r,model:t})}else if(t instanceof It){let r=0;e==5?r=t.topExpansion:e==6&&(r=t.bottomExpansion);let i=ty(t,r);this.document.getContent().findStandard(i)||this.document.getContent().addStandard(i,{item:t,expansion:r,model:null})}}generatePanelStep(t){let r=Ii.getSourceData(),i=new sa("Step",t);this.IPCEncode.addAttribute(i,{name:this.panelizeMsg.name});let n=new sa("Datum",i);n.xmlStr=Uh.Ecad.Datum({x:this.panelizeMsg.x,y:this.panelizeMsg.y});let s=new sa("StepRepeat",i),a={stepRef:this.pcbName,x:this.panelizeMsg.x,y:this.panelizeMsg.y,nx:this.panelizeMsg.nx,ny:this.panelizeMsg.ny,dx:this.panelizeMsg.dx,dy:this.panelizeMsg.dy,angle:this.panelizeMsg.angle,mirror:this.panelizeMsg.mirror};s.xmlStr=Uh.Ecad.StepRepeat(a),this.panelBorder(i),this.parsePanelsData(r,i)}parsePanelsData(t,e){let r=t.holes;this.parseHoles(r,e);let i=t.pads;this.parsePads(i,e);let n=t.texts;this.parsePanelText(n,e);let s=Ii.getProfileGroup(13);this.parseArrow(s,e)}parseHoles(t,e){t.forEach(r=>{let i=this.getLayerFeature(e,"Multi-Layer"),n=this.getFeatureSet(i,"net");this.IPCEncode.feed("HOLE",r,n).parseXmlStr(5)})}parsePads(t,e){t.forEach(r=>{let i=this.getCrossLayer(this.getLayerSide(r.layerId));if(r.layerId===12){let n=this.getLayerFeature(e,"Multi-Layer"),s=this.getHoleSet(n,r);this.parseHole(r,s),i=i.filter(a=>this.filterUnuseLayer(a.layerId,r.unusedInnerLayers))}for(let n of i){let s=n.layerId,a=this.getLayerFeature(e,n.name);this.createPadForLayer(a,r,s),this.addStandard(r,s)}this.document.getEcad().padStack.add({item:r,layers:i})})}parsePanelText(t,e){for(let r of t){let i={name:"TEXT",value:r.value,type:"STRING",font:r.fontFamily},n=$e.getInstance().getLayer(r.layerId).name,s=this.getLayerFeature(e,n),a=this.createSet(s,r);this.nonstandardAttribute(i,a),this.IPCEncode.feed("TEXT",r,a)}}parseArrow(t,e){for(let r of t){let{primitives:i,strokeWidth:n}=r,s=$e.getInstance().getLayer(13).name,a=this.getLayerFeature(e,s),l=this.createSet(a,r);this.IPCEncode.feed("TEXT",{outline:[{primitives:i}],strokeWidth:n},l)}}convertUnit(t){return Math.round(Bs(t*10,"mil",this.unit)*1e8)/1e8}panelBorder(t){let e=Ii.toJSON(),{column:r,row:i,columnSpacing:n,rowSpacing:s}=e,a=Ii.bBox;n+=a.width(),s+=a.height();let c=Ii.getClosures(),h=this.getAllProfile(),u=this.getSlotRegion(),{borders:d,cutouts:p}=this.panelizeRegion(h,u,i,r,n,s),g=this.panelizeOutline(d,c,t)[0].items,y=g.splice(0,1)[0];p.push(...g),this.IPCEncode.feed("PROFILE",{profiles:y,cutouts:this.needPanelize()?g:p},t),d.push(y);let b=this.getLayerFeature(t,"Board Outline Layer");d.forEach(P=>{let T=this.createSet(b);this.IPCEncode.feed("REGION",P,T)})}panelizeRegion(t,e,r,i,n,s){let a=[],l=[];for(let u=0;u<i;u++){let d=new Qe().translate(n*u,0);t.forEach(p=>{l.push(p.clone().multiply3(d))}),e.forEach(p=>{a.push(p.getMathGraphics().clone().multiply3(d))})}let c=[],h=[];for(let u=0;u<r;u++){let d=new Qe().translate(0,s*u);l.forEach(p=>{c.push(p.clone().multiply3(d))}),a.forEach(p=>{h.push(p.clone().multiply3(d))})}return{borders:c,cutouts:h}}panelizeOutline(t,e,r){let i=new Kc,n=[];return t.forEach(a=>{n.push([a])}),e.forEach(a=>{let l=a[0];l&&Af(fe.build2(l.primitives),.1).forEach(h=>{h.items.forEach(u=>{n.push([u])})})}),i.getUnionForSingle(n)}sortLayersequence(t){let e=t.getChildren();for(let r=1;r<=e.length;r++)e[r-1].setAttribute("sequence",r.toString())}onlyColorRef(t){let e=t.length;if(!e)return!0;let r=t[0];return e==1&&r.getName()==="Set"}needPanelize(){return this.panelizeMsg&&!this.panelizeMsg.onlyOutline}getLayerSide(t){if(t===1)return 1;if(t===2)return-1;if(t===12)return 0}getCrossLayer(t=0){let e=$e.getInstance(),r=[];if(t===1)r=[e.getLayer(7),e.getLayer(5),e.getLayer(1)];else if(t===-1)r=[e.getLayer(8),e.getLayer(6),e.getLayer(2)];else if(t===0){let i=[e.getLayer(7),e.getLayer(5)],n=[e.getLayer(6),e.getLayer(8)],s=e.getAllCopperLayerId4Order().map(a=>$e.getInstance().getLayer(a));r=i.concat(s).concat(n)}return r}createPinStandard(t){for(let e of t){let r=this.getCrossLayer(this.getLayerSide(e.layerId));for(let i of r)this.addStandard(e,i.layerId)}}filterEmptyLayer(){let t=["TOP","BOTTOM","SIGNAL","PLANE","SUBSTRATE","TOP_SILK","BOT_SILK","TOP_SOLDER_MASK","BOT_SOLDER_MASK","TOP_PASTE_MASK","BOT_PASTE_MASK"];this.panelizeMsg&&t.push("DOCUMENT","OUTLINE");let e=this.document.getContent().getAllLayers(),r=[],i=this.document.getEcad(),n=i.cadData,s=this.unit;s=="mm"&&(s=J3e);let a=i.cadHeader,l=n.search("Step",{name:this.pcbName});l.getChildren().forEach(u=>{let d=u.getChildren();if(u.getName()==="LayerFeature"&&this.onlyColorRef(d)){let p=u.getAttribute("layerRef"),m=e.find(g=>g.name===p);m&&t.indexOf(m.type)<0&&r.push(u)}});let h=this.document.getContent();r.forEach(u=>{let d=u.getAttribute("layerRef");h.deleteLayer(d),i.cadHeader.delete(d),i.layerNode.deleteLayer(d),l.deleteNode(u)})}toFix(t,e=8){let r=Number(t.toFixed(e))%360;return r<0&&(r+=360),r}getRegionPrimitive(t){if(t instanceof fe)return[t.primitives];{let e=t.items,r=[];return e.forEach(i=>{r.push(i.primitives)}),r}}updateProgress(){this.progress+=this.tip,A.publish("progressUpdate",[this.progress,"ipc2581c"],$())}};var Jce=class{constructor(t,e,r){this.ext=".xml";A.publish("progressUpdate",[0,"ipc2581c"],$()),this.unit=t,this.OEMNumber=e,this.document=new mce,this.modelHandel=new Zce(this.document,t,e),jT.getInstance().init(r)}async buildData(){this.document.createContent(),this.modelHandel.generateContent(),await this.document.createSupportInfo(),this.document.createBom(this.OEMNumber,this.modelHandel),this.document.initEcad(),this.modelHandel.generateEcad(),this.modelHandel.filterEmptyLayer(),jT.getInstance().clear()}async export(t){A.publish("progressUpdate",[.95,"ipc2581c"],$());let e=await this.getSource();ip.downloadFile(t+this.ext,e),A.publish("progressUpdate",[1,"ipc2581c"],$())}async getSource(){let t=this.document.export();return this.clear(),this.getSourceStream(t)}clear(){this.document.clear(),this.document=null,this.modelHandel=null}async getSourceStream(t){let e=new ReadableStream({start(s){n(t,s)}}),i=await new Response(e).blob();function n(s,a){for(let l=0;l<s.length;l++)a.enqueue(s[l]);a.close()}return i}};async function rje(o){let t=o.fileName,e=o.selectOption,r=o.selectValue,i=o.auto,n=new Jce(e,r,i);await n.buildData(),await n.export(t)}var Qce=class extends w3{constructor(){super(),A.subscribe("PcbEditFootprint",this.editUpdate.bind(this))}editUpdate(t){let e=new Set,r=new Array;if(t.component!=null){let i=new Set;for(let n of t.component){let s=Ji.getItem(n.footprintUUID),a=t.type==2?s.uuid.includes("_")?s.source:s.uuid:s.uuid.length<=32?x.getInstance().id+"_"+n.globalIndex:s.uuid;i.add(a),e.add(s.uuid.includes("_")?s.source:s.uuid)}r=Array.from(i)}A.publish("editFootprint",{type:t.type,uuids:r,sources:Array.from(e)},$())}};var _G=class{constructor(){this.needEncodeLayers=new Set;this.allLayerMap=new Map;this.map=new Map;this.rules={};this.shapes=new Array;this.body=new Map;this.layerMaxClearance=new Map}encode(){return this.encodeLayers(),this.encodeRules(),this.encodeShapes(),this.encodeDoc()}encodeHead(){let t=Vt.bbox(),e=Array.from(this.allLayerMap.values());return JSON.stringify({bbox:[t.minX,t.minY,t.maxX,t.maxY],layerStack:e,rules:this.rules,shapes:this.shapes})}encodeBody(){let t=[];for(let[e,r]of this.body)t.push([e,this.layerMaxClearance.get(e),JSON.stringify(r)]);return t}encodeDoc(){let t=this.encodeHead(),e=this.encodeBody();return this.clear(),{head:t,body:e}}clear(){this.needEncodeLayers.clear(),this.allLayerMap.clear(),this.map.clear(),this.rules=null,this.shapes.length=0,this.body.clear(),this.body=null}getSafeSpaceing(t,e){let r=e==null?null:te.getInstance().getSafeSpacing(e);return r==null&&(r=te.getInstance().getSafeSpacing(t)),r==null&&(r=te.getInstance().getDefaultSafeSpacing()),r}encodeLayers(){for(let t of be.getAllLayer()){if(!t.config)continue;let e=t.layerID,r=0;switch(t.type){case"SIGNAL":r=t2(e);break;case"MECHANICAL":r=1;break;case"PLANE":r=t2(e);break;default:r=0;break}this.needEncodeLayers.has(e)&&this.map.set(e,`${t.type}_${r}`),this.allLayerMap.set(e,{type:t.type,order:r})}}encodeRules(){for(let[t,e]of this.map)this.rules[e]=[],this.layerMaxClearance.set(e,0);this.getNetRule(),this.getBetweenNetworkRule(),this.getRegionRule()}updateMaxClearance(t,e){let r=this.layerMaxClearance.get(e);r=Math.max(r,t),this.layerMaxClearance.set(e,r)}getClearanceMap(t,e,r){let i=[0,1,2,3,4,5,6,7,8,8,9,10,11,12],n={},s=this.map.get(e),a=this.layerMaxClearance.get(s);return i.forEach(l=>{let c=r.getClearance(t,l,e);n[l]=c,a=Math.max(a,c)}),this.layerMaxClearance.set(s,a),n}encodeShapes(){this.getVias(),this.getPads(),this.getProfiles(),this.getTracks(),this.getTexts(),this.getImages(),this.getPlaneZone()}add2Body(t,e){let r=this.map.get(t),i=this.body.get(r);i==null&&(i=[],this.body.set(r,i)),i.push(e)}getVias(){Hr.getAllItem().forEach(e=>{let r=e.getParent()!=null;if(e.type==1){let i={PcbBlindVia:{id:e.globalIndex,net:e.net,center:e.center,holeDiameter:e.holeRadius*2,startLayer:this.allLayerMap.get(e.startLayer),startLayerPad:e.radius*2,innerPad:e.radius*2,endLayer:this.allLayerMap.get(e.endLayer),endLayerPad:e.radius*2,mask:!1,locked:e.locked||r,unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.shapes.push(i)}else{let i={PcbVia:{id:e.globalIndex,net:e.net,center:e.center,holeDiameter:e.holeRadius*2,topPad:e.radius*2,innerPad:e.radius*2,botPad:e.radius*2,mask:!1,locked:e.locked||r,unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.shapes.push(i)}})}getUnuseLayers(t){let e=new Array;for(let r of t){let i=this.allLayerMap.get(r);i&&e.push(i)}return e}getTracks(){pr.getAllItem().forEach(e=>{if(this.needEncodeLayers.has(e.layerId))if(e instanceof Si){let r=q.build2(e.center,e.startAngle/Math.PI*180,e.endAngle/Math.PI*180,e.radius,e.radius,e.sweep),i={PcbarcTrack:{net:e.net,layer:this.allLayerMap.get(e.layerId),arc:r,width:e.width,id:e.globalIndex,locked:e.locked}};this.add2Body(e.layerId,i)}else{let r={PcbTrack:{net:e.net,layer:this.allLayerMap.get(e.layerId),start:e.start,end:e.end,width:e.width,id:e.globalIndex,locked:e.locked}};this.add2Body(e.layerId,r)}})}getTexts(){ti.getAllItem().forEach(e=>{if(!this.needEncodeLayers.has(e.layerId))return;let r=e.model.box;if(!r||r.height==0||r.width==0)return;let i={PcbboxShape:{layer:this.allLayerMap.get(e.layerId),leftLow:r.leftLow,leftUp:r.leftUp,rightLow:r.rightLow,rightUp:r.rightUp,id:e.globalIndex}};this.add2Body(e.layerId,i)})}getImages(){Ln.getAllItem().forEach(e=>{if(!this.needEncodeLayers.has(e.layerId))return;let r=e.model.box,i={PcbboxShape:{layer:this.allLayerMap.get(e.layerId),leftLow:r.leftLow,leftUp:r.leftUp,rightLow:r.rightLow,rightUp:r.rightUp,id:e.globalIndex}};this.add2Body(e.layerId,i)})}getPads(){Kt.getAllItem().forEach(e=>{if(e instanceof Ri){if(gr(e.layerId)){let r=this.getShape(e.topType,e.topWidth,e.topHeight,e.topRatio,null),i=this.getShape(e.innerType,e.innerWidth,e.innerHeight,e.innerRatio,null),n=this.getShape(e.bottomType,e.bottomWidth,e.bottomHeight,e.bottomRatio,null),s=this.getHoleShape(e),a={PcbPad:{id:e.globalIndex,net:e.net,layer:this.allLayerMap.get(e.layerId),center:e.center,rotation:e.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.allLayerMap.get(e.layerId),top:r,inner:i,bot:n}},hole:s,pasteMaskEx:e.pasteExpansion,topSolderMaskEx:e.topSolderExpansion,bottomSolderMaskEx:e.bottomSolderExpansion,type:e.model.padType,designator:"",plated:e.plated,padRule:e.toPadRuleJson(),unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.shapes.push(a)}else if(Io(e.layerId)){if(!this.needEncodeLayers.has(e.layerId))return;let r=this.getShape(e.topType,e.topWidth,e.topHeight,e.topRatio,null),i={PadHole:{type:0,size:0,length:0,rotation:e.rotation/Math.PI*180,offsetX:0,offsetY:0}},n={PcbPad:{id:e.globalIndex,net:e.net,layer:this.allLayerMap.get(e.layerId),center:e.center,rotation:e.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.allLayerMap.get(e.layerId),top:r,inner:null,bot:null}},hole:i,pasteMaskEx:e.pasteExpansion,topSolderMaskEx:e.topSolderExpansion,bottomSolderMaskEx:e.bottomSolderExpansion,type:e.model.padType,designator:"",plated:e.plated,padRule:e.toPadRuleJson(),unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.add2Body(e.layerId,n)}else if(2==e.layerId){if(!this.needEncodeLayers.has(e.layerId))return;let r=this.getShape(e.bottomType,e.bottomWidth,e.bottomHeight,e.bottomRatio,null),i={PadHole:{type:0,size:0,length:0,rotation:e.rotation/Math.PI*180,offsetX:0,offsetY:0}},n={PcbPad:{id:e.globalIndex,net:e.net,layer:this.allLayerMap.get(e.layerId),center:e.center,rotation:e.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.allLayerMap.get(e.layerId),top:null,inner:null,bot:r}},hole:i,pasteMaskEx:e.pasteExpansion,topSolderMaskEx:e.topSolderExpansion,bottomSolderMaskEx:e.bottomSolderExpansion,designator:"",plated:e.plated,padRule:e.toPadRuleJson(),unuseLayers:this.getUnuseLayers(e.unusedInnerLayers),type:e.model.padType}};this.add2Body(e.layerId,n)}}else if(e instanceof fn){if(gr(e.layerId)){let r=this.getShape("POLYGON",0,0,0,e.primitives),i=this.getShape("POLYGON",0,0,0,e.primitives),n=this.getShape("POLYGON",0,0,0,e.primitives),s=this.getHoleShape(e),a={PcbPad:{id:e.globalIndex,net:e.net,layer:this.allLayerMap.get(e.layerId),center:e.center,rotation:e.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.allLayerMap.get(e.layerId),top:r,inner:i,bot:n}},hole:s,pasteMaskEx:e.pasteExpansion,topSolderMaskEx:e.topSolderExpansion,bottomSolderMaskEx:e.bottomSolderExpansion,designator:"",plated:e.plated,padRule:e.toPadRuleJson(),unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.shapes.push(a)}else if(Io(e.layerId)){if(!this.needEncodeLayers.has(e.layerId))return;let r=this.getShape("POLYGON",0,0,0,e.primitives),i={PadHole:{type:0,size:0,length:0,rotation:e.rotation/Math.PI*180,offsetX:0,offsetY:0}},n={PcbPad:{id:e.globalIndex,net:e.net,layer:this.allLayerMap.get(e.layerId),center:e.center,rotation:e.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.allLayerMap.get(e.layerId),top:r,inner:null,bot:null}},hole:i,pasteMaskEx:e.pasteExpansion,topSolderMaskEx:e.topSolderExpansion,bottomSolderMaskEx:e.bottomSolderExpansion,designator:"",plated:e.plated,padRule:e.toPadRuleJson(),unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.add2Body(e.layerId,n)}else if(2==e.layerId){if(!this.needEncodeLayers.has(e.layerId))return;let r=this.getShape("POLYGON",0,0,0,e.primitives),i={PadHole:{type:0,size:0,length:0,rotation:e.rotation/Math.PI*180,offsetX:0,offsetY:0}},n={PcbPad:{id:e.globalIndex,net:e.net,layer:this.allLayerMap.get(e.layerId),center:e.center,rotation:e.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.allLayerMap.get(e.layerId),top:null,inner:null,bot:r}},hole:i,pasteMaskEx:e.pasteExpansion,topSolderMaskEx:e.topSolderExpansion,bottomSolderMaskEx:e.bottomSolderExpansion,designator:"",plated:e.plated,padRule:e.toPadRuleJson(),unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.add2Body(e.layerId,n)}}})}getProfiles(){Zt.getAllItem().forEach(i=>{let n=i.getComponent();if(!(this.needEncodeLayers.has(i.layerId)||12==i.layerId||11==i.layerId))return;let s=this.getProfileShape(i.globalIndex,i.type,i.net,i.layerId,0,i.getMathGraphics(i.layerId,0),i.strokeWidth,n,n);i.layerId==12||i.layerId==11?this.shapes.push(s):this.add2Body(i.layerId,s)}),Xt.getAllItem().forEach(i=>{let n=i.getComponent();if(!(this.needEncodeLayers.has(i.layerId)||12==i.layerId||11==i.layerId))return;let s=this.getProfileShape(i.globalIndex,i.type,i.net,i.layerId,1,i.getMathGraphics(i.layerId,0),i.strokeWidth,n,n);i.layerId==12||i.layerId==11?this.shapes.push(s):this.add2Body(i.layerId,s)}),pt.getAllItem().forEach(i=>{if(!(this.needEncodeLayers.has(i.layerId)||12==i.layerId||11==i.layerId))return;let n=i.getComponent(),s=this.getProfileShape(i.globalIndex,i.type,i.net,i.layerId,2,i.getMathGraphics(i.layerId,0),i.strokeWidth,n,n,n);i.layerId==12||i.layerId==11?this.shapes.push(s):this.add2Body(i.layerId,s)})}getShape(t,e,r,i,n){let s;switch(t){case"ELLIPSE":s={PadShape:{type:0,xSize:e,ySize:r,cornerRadius:i*100,outline:null}};break;case"OVAL":s={PadShape:{type:3,xSize:e,ySize:r,cornerRadius:i*100,outline:null}};break;case"RECT":s={PadShape:{type:1,xSize:e,ySize:r,cornerRadius:i*100,outline:null}};break;case"POLYGON":s={PadShape:{type:4,xSize:e,ySize:r,cornerRadius:0,outline:ef([fe.build2(n)])}}}return s}getHoleShape(t){return t.holeShape=="ROUND"?{PadHole:{type:0,size:t.holeRadius*2,length:t.holeLength,rotation:t.holeRotation/Math.PI*180,offsetX:t.holeOffset.x,offsetY:t.holeOffset.y}}:{PadHole:{type:2,size:t.holeRadius*2,length:t.holeLength,rotation:t.holeRotation/Math.PI*180,offsetX:t.holeOffset.x,offsetY:t.holeOffset.y}}}getProfileShape(t,e,r,i,n,s,a,l,c,h){switch(e){case"Line":return i==11?{PcbBoardOutline:{id:t,type:n,outlines:Lh(s)}}:{PcbLine:{id:t,net:r,layer:this.allLayerMap.get(i),type:n,width:a,outlines:Lh(s)}};case"Copper Region":let u=te.getInstance().getCopperPlaneByNet(r),d=te.getInstance().getSafeSpacingByNet(r,13),p=te.getInstance().getRegion(t);p!=null?(p.copperPlane&&(u=te.getInstance().getCopperPlane(p.copperPlane)),d=te.getInstance().getSafeSpacing(p.safeCopperPlane||p.safeClearance)):u==null&&(u=te.getInstance().getDefaultCopperPlane()),d==null&&(d=te.getInstance().getDefaultSafeSpacing());let m=gn.getOrder(t),g=this.needCopper(t),y=this.allLayerMap.get(i);return{PcbPolygonPour:{id:t,net:r,layer:y,method:this.getMethod(l),outlineClearance:d.getClearance(13,11,i),clearance:this.getClearanceMap(13,i,d),thermal:u.getSingleConnectMode(i)!=1,multiLayerThermal:u.getMultiConnectMode(i)!=1,keepIsland:l.keepIsland,pourIndex:m,needCopper:g,outlines:Lh(s),coppered:[],name:l.name}};case"Prohibited Region":return{PcbProhibit:{id:t,layer:this.allLayerMap.get(i),type:n,copper:c.copper,track:c.track,device:c.device,plane:c.planzone,region:c.fill,outlines:Lh(s)}};case"Fill Region":return l instanceof ln?{BridgingCopper:{id:t,net:r,layer:this.allLayerMap.get(i),type:n,outlines:Lh(s),networkList:l.networkList}}:{PcbRegion:{id:t,net:r,layer:this.allLayerMap.get(i),type:n,outlines:Lh(s)}};case"Constraint Region":return{PcbConstraint:{id:t,net:r,layer:this.allLayerMap.get(i),type:n,outlines:Lh(s)}};case"Board Outline":return{PcbBoardOutline:{id:t,type:n,outlines:Lh(s)}};case"Slot Region":return{PcbSlot:{id:t,type:n,outlines:Lh(s)}};case"TearDrop":return{PcbTearDrop:{id:t,net:r,layer:this.allLayerMap.get(i),outline:Lh(s),connect:h.connects}}}}getMethod(t){switch(t.style){case"90grid":return ne.eq(t.clearance,0)?{SolidPourMethod:{neckThickness:t.gridLineWidth}}:{HatchedPourMethod:{gridWidth:t.gridLineWidth,gridClearance:t.clearance,angle:90}};case"45grid":return ne.eq(t.clearance,0)?{SolidPourMethod:{neckThickness:t.gridLineWidth}}:{HatchedPourMethod:{gridWidth:t.gridLineWidth,gridClearance:t.clearance,angle:45}};case"solid":return t.optimization?{SolidPourMethod:{neckThickness:t.optimizationValue}}:{SolidPourMethod:{neckThickness:0}};default:return{SolidPourMethod:{neckThickness:0}}}}getPlaneZone(){}};var e$=class extends _G{constructor(t,e){super(),e?this.needEncodeLayers=new Set(be.getAllPlaneLayerIds()):this.needEncodeLayers=new Set(t)}needCopper(t){return!1}getNetRule(){te.getInstance().getAllNets().forEach(i=>{let n=te.getInstance().getInnerPlane(i.innerPlane),s=this.getSafeSpaceing(i.safeSpacing,i.safeInnerPlane);for(let[a,l]of this.map){let c=this.rules[l],h=this.getClearanceMap(7,a,s);if(!n.isDefault||!s.isDefault){let u=n.getMultiConnectMode(a),d={PlaneRule:{Selector:{NetSelector:i.name},clearance:h,boardClearance:h[11],multiLayerThermal:n.getMultiConnectMode(a)!=1,multiLayerSpokeWidth:n.getMultiLineWidth(a),multiLayerSpokeSpace:n.getMultiLineClearance(a),multiLayerMode:u}};this.updateMaxClearance(n.getMultiLineClearance(a),l),c.push(d)}}});let e=te.getInstance().getDefaultInnerPlane(),r=te.getInstance().getDefaultSafeSpacing();for(let[i,n]of this.map){let s=this.rules[n],a=this.getClearanceMap(7,i,r),l=e.getMultiConnectMode(i),c={PlaneRule:{Selector:{AllSelector:{}},clearance:a,boardClearance:a[11],multiLayerThermal:l!=1,multiLayerSpokeWidth:e.getMultiLineWidth(i),multiLayerSpokeSpace:e.getMultiLineClearance(i),multiLayerMode:l}};this.updateMaxClearance(e.getMultiLineClearance(i),n),s.push(c)}}getBetweenNetworkRule(){te.getInstance().betweenNetRule.rule.forEach(e=>{if(!(!e.ruleName&&!e.safeCopperPlane&&!e.safeInnerPlane))for(let[r,i]of this.map){let n=this.rules[i],s=this.getSafeSpaceing(e.ruleName,e.safeInnerPlane),a=e.getNets(e.net1),l=e.getNets(e.net2),c=this.getClearanceMap(7,r,s);for(let h of a)for(let u of l){let d={PlaneRule:{Selector:{OrSelector:[h,u]},clearance:c,boardClearance:c[11]}};n.push(d)}}})}getRegionRule(){te.getInstance().getAllRegions().forEach(e=>{let r=W1(e.name);if(!r)return;let i=r.layerId,n=new Map;if(i==12?n=this.map:this.map.has(i)&&n.set(i,this.map.get(i)),n.size==0)return;if(e.innerPlane!=null){let a=te.getInstance().getInnerPlane(e.innerPlane);for(let[l,c]of n){let h=this.rules[c],u={PlaneRule:{Selector:{IdSelector:e.name,type:2},multiLayerThermal:a.getMultiConnectMode(l)!=1,multiLayerSpokeWidth:a.getMultiLineWidth(l),multiLayerSpokeSpace:a.getMultiLineClearance(l)}};this.updateMaxClearance(a.getMultiLineClearance(l),c),h.push(u)}}let s=this.getSafeSpaceing(e.safeClearance,e.safeInnerPlane);s!=null&&this.getClearanceRule(s,n,e.name,1)})}getClearanceRule(t,e,r,i){for(let[n,s]of e){let a=this.rules[s],l=this.getClearanceMap(7,n,t),c={PlaneRule:{Selector:{IdSelector:r,type:i},clearance:l,boardClearance:l[11]}};a.push(c)}}getOutline(){let t=new Array;if(Zt.getAllItem().forEach(n=>{(n.type=="Board Outline"||n.layerId==11)&&t.push(n)}),Xt.getAllItem().forEach(n=>{(n.type=="Board Outline"||n.layerId==11)&&t.push(n)}),pt.getAllItem().forEach(n=>{(n.type=="Board Outline"||n.layerId==11)&&t.push(n)}),t.length>0){let n=new _e,s=new Array;for(let c of t){let h=c.getMathGraphics();Re.addAll(s,h.primitives),n.ext1(c.buildBBox())}let a=n.build();return new oh(n.build(),2,.1,new Gi(4),s).detect().items.filter(c=>!c.bbox().isContainsBBox(a))}else return[]}getPlaneZone(){let t=this.getOutline();t.length!=0&&this.map.forEach((e,r)=>{let i=this.allLayerMap.get(r),n=Qn.layerMapSet[r];if(n!=null&&n.size>0)n.forEach(s=>{let a=te.getInstance().getInnerPlaneByNet(s.net),l=te.getInstance().getSafeSpacingByNet(s.net,14),c=te.getInstance().getRegion(s.globalIndex);c!=null&&(c.innerPlane&&(a=te.getInstance().getInnerPlane(c.innerPlane)),l=this.getSafeSpaceing(c.safeClearance,c.safeInnerPlane));let h=s.getOutline();xr(h,(p,m)=>m.bbox().area()-p.bbox().area(),0,h.length);let u=this.getClearanceMap(14,s.layerId,l),d={PcbPlaneZone:{id:s.globalIndex,net:s.net,layer:i,outlineClearance:u[11],clearance:u,thermal:a.getMultiConnectMode(s.layerId)!=1,outline:Lh(h[0]),coppered:s.copperPath}};this.add2Body(r,d)});else{t.forEach(l=>{let c=te.getInstance().getNet("GND"),h,u="GND",d;c!=null?(h=te.getInstance().getInnerPlane(c.innerPlane),d=this.getSafeSpaceing(c.safeSpacing,c.safeInnerPlane)):(u="",h=te.getInstance().getDefaultInnerPlane(),d=te.getInstance().getDefaultSafeSpacing());let p=this.getClearanceMap(14,r,d),m={PcbPlaneZone:{net:u,layer:i,outlineClearance:p[11],clearance:p,thermal:h.getMultiConnectMode(r)!=1,outline:Lh(l),coppered:[Lh(l)]}};this.add2Body(r,m)});let s=this.map.get(r),a=this.body.get(s);a==null&&(a=[],this.body.set(s,a))}})}};var tN=class extends _G{constructor(e,r){super();this.coppers=new Map;let i;if(r)i=vD();else{i=[];for(let n of e){let s=W1(n);s!=null&&i.push(s)}}for(let n of i)this.coppers.set(n.globalIndex,n),this.needEncodeLayers.add(n.layerId)}needCopper(e){return this.coppers.has(e)}getNetRule(){te.getInstance().getAllNets().forEach(n=>{let s=this.getThermalRule(n.copperPlane),a=this.getSafeSpaceing(n.safeSpacing,n.safeCopperPlane);for(let[l,c]of this.map){let h=this.getClearanceMap(7,l,a),u=this.rules[c];if(!s.isDefault||!a.isDefault){let d=s.getMultiConnectMode(l),p=s.getSingleConnectMode(l),m={CopperRule:{Selector:{NetSelector:n.name},clearance:h,boardClearance:h[11],thermal:p!=1,spokeWidth:s.getSingleLineWidth(l),spokeSpace:s.getSingleLineClearance(l),multiLayerThermal:d!=1,multiLayerSpokeWidth:s.getMultiLineWidth(l),multiLayerSpokeSpace:s.getMultiLineClearance(l),trackConnect:s.getTrackConnect(l).toString(),singleLayerMode:p,multiLayerMode:d}};this.updateMaxClearance(s.getSingleLineClearance(l),c),this.updateMaxClearance(s.getMultiLineClearance(l),c),u.push(m)}}});let r=te.getInstance().getDefaultCopperPlane(),i=te.getInstance().getDefaultSafeSpacing();for(let[n,s]of this.map){let a=this.rules[s],l=this.getClearanceMap(7,n,i),c=r.getMultiConnectMode(n),h=r.getSingleConnectMode(n),u={CopperRule:{Selector:{AllSelector:{}},clearance:l,boardClearance:l[11],thermal:h!=1,spokeWidth:r.getSingleLineWidth(n),spokeSpace:r.getSingleLineClearance(n),multiLayerThermal:c!=1,multiLayerSpokeWidth:r.getMultiLineWidth(n),multiLayerSpokeSpace:r.getMultiLineClearance(n),trackConnect:r.getTrackConnect(n).toString(),singleLayerMode:h,multiLayerMode:c}};this.updateMaxClearance(r.getSingleLineClearance(n),s),this.updateMaxClearance(r.getMultiLineClearance(n),s),a.push(u)}}getBetweenNetworkRule(){te.getInstance().betweenNetRule.rule.forEach(r=>{if(!(!r.ruleName&&!r.safeCopperPlane&&!r.safeInnerPlane))for(let[i,n]of this.map){let s=this.rules[n],a=this.getSafeSpaceing(r.ruleName,r.safeCopperPlane),l=r.getNets(r.net1),c=r.getNets(r.net2),h=this.getClearanceMap(7,i,a);for(let u of l)for(let d of c){let p={CopperRule:{Selector:{OrSelector:[u,d]},clearance:h,boardClearance:h[11]}};s.push(p)}}})}getRegionRule(){te.getInstance().getAllRegions().forEach(r=>{let i=W1(r.name);if(!i)return;let n=i.layerId,s=new Map;if(n==12?s=this.map:this.map.has(n)&&s.set(n,this.map.get(n)),s.size!=0){if(r.copperPlane!=null){let a=this.getThermalRule(r.copperPlane);for(let[l,c]of s){let h=this.rules[c],u={CopperRule:{Selector:{IdSelector:r.name,type:2},thermal:a.getSingleConnectMode(l)!=1,spokeWidth:a.getSingleLineWidth(l),spokeSpace:a.getSingleLineClearance(l),multiLayerThermal:a.getMultiConnectMode(l)!=1,multiLayerSpokeWidth:a.getMultiLineWidth(l),multiLayerSpokeSpace:a.getMultiLineClearance(l),trackConnect:a.getTrackConnect(l).toString()}};this.updateMaxClearance(a.getSingleLineClearance(l),c),this.updateMaxClearance(a.getMultiLineClearance(l),c),h.push(u)}}if(r.safeClearance!=null){let a=this.getSafeSpaceing(r.safeClearance,r.safeCopperPlane);a!=null&&this.getClearanceRule(a,s,r.name,1)}}})}getThermalRule(e){return te.getInstance().getCopperPlane(e)}getClearanceRule(e,r,i,n){for(let[s,a]of r){let l=this.rules[a],c=this.getClearanceMap(7,s,e),h={CopperRule:{Selector:{IdSelector:i,type:n},clearance:c,boardClearance:c[11]}};l.push(h)}}};var rN=class{constructor(){this.tree=new tF(10)}bbox(){let t=Vt.bbox();if(this.tree.size()>0){let e=this.tree.bbox();return new _e().ext1(e).ext1(t).build()}return t}search(t,e,r){let i=this.tree.search(t,e),n=Vt.search(t,e);for(let s of n.getAllItems())i.push(s.model);return i}searchInside(t,e,r){let i=this.tree.searchInside(t,e),n=Vt.searchInside(t,e);for(let s of n.getAllItems())i.push(s.model);return i}search4Types(t,e,r){let i=this.tree.search4Types(t,e,r),n=Vt.search4Types(t,e,r);for(let s of n.getAllItems())i.push(s.model);return i}searchByType(t,e){let r=this.tree.searchByType(t,e),i=Vt.searchByType(t,e);for(let n of i.getAllItems())r.push(n.model);return r}searchByTypes(t,e){let r=this.tree.searchByTypes(t,e),i=Vt.searchByTypes(t,e);for(let n of i.getAllItems())r.push(n.model);return r}searchByLayer(t,e){let r=this.tree.searchByLayer(t,e),i=Vt.searchByLayer(t,e);for(let n of i.getAllItems())r.push(n.model);return r}searchByLayers(t,e){let r=this.tree.searchByLayers(t,e),i=Vt.searchByLayers(t,e);for(let n of i.getAllItems())r.push(n.model);return r}insert(t){this.tree.insert(t)}remove(t,e){this.tree.remove(t)}flushDeleteWhenNeed(){this.tree.flushDeleteWhenNeed()}flushWhenNeed(){this.tree.flushWhenNeed()}recycle(){this.tree.recycle()}};function ije(o){x.getInstance().isactive&&23!=x.getInstance().doctype&&A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$());let t=x.getInstance().compiler;o.forEach(e=>{if(t.setTicket(),$e.getInstance().getLayer(e).type=="PLANE"){let r=or.getInstance().encode("INNER",Array.from(Ho.getInstance().layerMapSet[e]));t.uploadLayerFill(e,r)}else t.deleteLayerFill(e)})}function ehe(o){x.getInstance().isactive&&23!=x.getInstance().doctype&&A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$());let t=x.getInstance().compiler;o.forEach(e=>{if(t.setTicket(),e){let r=or.getInstance().encode("POURED",Array.from(e.copperResultMap||[]));t.uploadPoured(e.globalIndex,r)}else t.deletePoured(e.globalIndex)})}function F_(o,t,e){if(!o)return null;var r=arguments.length,i,n,s,a;if(o.tagName){if(typeof t=="string")return r===2?o.getAttribute(t):(t.indexOf(":")>0?(n=t.substr(0,t.indexOf(":")),n in EA&&(s=t.substr(n.length+1),l9?o.setAttributeNS(EA[n],t,e):o.setAttributeNS(EA[n],s,e))):(o.setAttribute(t,e),(e===""||e===null||e===void 0)&&(t==="transform"&&o.setAttribute(t,""),o.removeAttribute(t))),o);for(i in t)Ef(t,i)&&(i.indexOf(":")>0?(n=i.substr(0,i.indexOf(":")),n in EA&&(s=i.substr(n.length+1),t[i]===""?o.hasAttributeNS(EA[n],s)&&o.removeAttributeNS(EA[n],s):l9?o.setAttributeNS(EA[n],i,t[i]):o.setAttributeNS(EA[n],s,t[i]))):t[i]===""?o.hasAttribute(i)&&(i==="transform"&&o.setAttribute(i,""),o.removeAttribute(i)):o.setAttribute(i,t[i]));return o}if(Array.isArray(o)||o instanceof NodeList||o instanceof HTMLCollection||RX&&typeof o.length=="number"){if(typeof t=="string"&&r==2)return o[0]?F_(o[0],t):null;if(r==2)for(a=0;a<o.length;a++)F_(o[a],t);else if(r>=3)for(a=0;a<o.length;a++)F_(o[a],t,e);return o}}function nje(o){if(window.frameElement)return TA.windowBridge.publish("showMessager",[o],$());TA.messageBus.publish("showMessager",[o])}function cRt(o){return o?o.replace(/\.\w+$/,"")||o:""}function xG(o,t="UTF-8"){return new Promise((e,r)=>{var i=new FileReader,n=o.name,s=cRt(n);i.onload=function(a){e({name:n,title:s,content:a.target.result})},i.onerror=function(){r(`Failed to read file ${RIe(n)}`)},i.readAsText(o,t)})}var Q3e=class o{static instance(){let t=o._instance;if(!t){o._instance=t=new o,t.options={};let e=document.createElement("input");t._input=e,F_(e,"type","file"),F_(e,"multiple",""),e.addEventListener("change",function(){if(t.options.onSelectFiles){var r=t._input.files;if(r.length)if(t.options.fileFilter){var i=[].slice.call(r,0).filter(function(n){return t.options.fileFilter(n)!==!1});t.options.onValidate&&t.options.onValidate(i.length>0),i.length?t.options.onSelectFiles(i):console.log("Files cannot pass fileFilter")}else t.options.onSelectFiles(r)}})}return t}config(t){return uCe(this.options,t),"multiple"in t&&(this._input.multiple=t.multiple),"accept"in t&&(this._input.accept=t.accept),this}openSelect(){return this._input.value="",this._input.click(),this}},vG=class{constructor(t,e,r=!1){let i=t.split(",");i=i.map(s=>s.trim().replace(".",""));let n={multiple:r,accept:t,fileFilter:function(s){return!t||t.indexOf(".")<0?!0:new RegExp(".("+i.join("|")+")$","i").test(s.name)},onValidate:function(s){s||nje({type:"warn",message:"Please select a "+i.join(", ")+" file."})},onSelectFiles:e};this.fs=Q3e.instance().config(n),this.run()}run(){this.fs.openSelect()}};var t$=class extends HV{constructor(e="_self"){super();this.headFlag="";this._currentSegment=[{json:{},buff:""}];this._segmentBuff=new WV;this._startFlagNums=0;this.headFlag=e}feed(e){switch(e){case 40:this.on(0);break;case 41:this.on(2);break;default:this._segmentBuff.write(e);break}return!0}on(e){switch(e){case 0:this.startNewSegment();break;case 2:this.endSegment();break;default:break}return!0}startNewSegment(){let e=(this._segmentBuff.toString()||"").trim();e&&(this.getArrayLast(this._currentSegment).buff+=e),this._segmentBuff.clear(),this._currentSegment.push({json:{},buff:""}),this._startFlagNums++}getArrayLast(e){return e[e.length-1]}endSegment(){if(--this._startFlagNums<0)return this.parseError();let e=this._currentSegment.pop(),r=(e.buff+" "+this._segmentBuff.toString()||"").trim();this._segmentBuff.clear();let i=r.split(/\s+/);if(!i[0])return this.parseError();let n=e.json,s=i.shift();n[this.headFlag]=i;let a=this.getArrayLast(this._currentSegment).json;if(!a)return this.parseError();wy(a,s).push(n)}initState(){this._currentSegment.length=0,this._currentSegment.push({json:{},buff:""}),this._segmentBuff.clear(),this._startFlagNums=0}finish(){if(this._startFlagNums!=0)return this.initState(),this.parseError();this.data=this._currentSegment.shift().json,this.initState()}parseError(e){throw new Error(e||this._segmentBuff.toString())}};var oje,hRt=(oje=document.querySelector('meta[name="editorMainVersion"]'))==null?void 0:oje.getAttribute("content"),XT="  ",pu="    ",Wn=`
`,ry="      ",eOe="        ";var sje=0;var Tr=class Tr{static getAllTexts(){let t=ti.getAllItem(),e=[];return t.forEach(r=>{r.getParent()==null&&r.isVisible&&r.value&&(r.layerId==1||r.layerId==2)&&e.push(r)}),e}static async initData(){Tr.padStackCache=[],Tr.padStackMap={},Tr.layers=Tr.config.layers.length?Tr.config.layers:[1],Tr.layers=Tr.layers.filter(n=>{if(n!=12)return n}),Tr.PCBOutline=Tr.getBoardBBox(),await the(.2),Tr.skipNetArr=Tr.config.skipNets.split(" ")||[],Tr.pads=iw();var t=[];if(Tr.pads.forEach(function(n){n instanceof Ri&&(gr(n.layerId)?(!n.topWidth||!n.topHeight||!n.bottomWidth||!n.bottomHeight||!n.innerWidth||!n.innerHeight)&&t.push(n):Io(n.layerId)?(!n.topWidth||!n.topHeight)&&t.push(n):Sx(n.layerId)&&(!n.bottomWidth||!n.bottomHeight)&&t.push(n))}),t.length>0){var e="";let n=[];return t.forEach(function(a){e+='<p><b class="i18n">ID:</b>'+a.globalIndex+' <b class="i18n">Net:</b>'+a.net+' <b class="i18n">Location:</b>('+on(a.model.center.x,2)+","+on(a.model.center.y,2)+")</p>",n.push({text:a.globalIndex,attr:{id:a.globalIndex,pcbid:x.getInstance().tabId}}),n.push(", ")}),n.pop(),A.windowBridge.publish("ui/toastMsg",{type:"error",msg:"Export DSN failed! Found abnormal pad(s) data, please modify the pad width and height to fix, the pads(s) please refer at the log.",bottomBarMsg:{type:"error",msg:["<span class='i18n'>Export DSN failed! Found abnormal pad(s) data, please modify the pad width and height to fix:</span>",...n]},timer:3},$()),!1}await the(.4),Tr.vias=Hr.getAllItem(),Tr.tracks=pr.getAllItem(),Tr.pads.push(...Tr.getAllTexts()),Tr.vias.forEach(function(n){Tr.pads&&(!n.net||!n.type)&&Tr.pads.push(n)}),await the(.6);let r=Tr.PCBOutline?new ut(Tr.PCBOutline.minX,Tr.PCBOutline.maxX,Tr.PCBOutline.minY,Tr.PCBOutline.maxY):null,i=["Prohibited Region","Slot Region","Fill Region","Line"];return new Array().concat(Xt.getAllItem(),Zt.getAllItem(),pt.getAllItem()).forEach(n=>{var h;let{type:s,layerId:a,strokeWidth:l}=n,c=n.buildBBox();if(!(!((h=be.getLayer(a))!=null&&h.isSignalLayer())&&!gr(a)||c&&r&&!c.isIntersect(r))&&i.includes(s)){let u=n.getComponent();if(s==="Prohibited Region"&&u instanceof fd&&!u.track||!n.getMathGraphics(void 0,l/2))return;Tr.pads&&Tr.pads.push(n)}}),!0}static jointPoints(t,e){var r=0,i=0,n=[];for(e||(e={x:0,y:0}),r=0,i=t.length;r<i;r++)n.push(Id((t[r].x-e.x)*Tr.scale)),n.push(Id((t[r].y-e.y)*Tr.scale));return n.join(" ")}static jointPoints1(t,e){var r=0,i=0,n=[];for(e||(e={x:0,y:0}),r=0,i=t.length;r<i;r++)n.push(Id((t[r][0]-e.x)*Tr.scale)),n.push(Id((t[r][1]-e.y)*Tr.scale));return n.join(" ")}static initRouterConfig(t){Tr.config=t||{},Tr.config.layers=be.getAllSignalLayerIds(),console.log(te.getInstance().getDefaultRadiusPhysics()),Tr.config.clearance=te.getInstance().getDefaultSafeSpacing().getItemsMaxClearance([0,1,2,3,4,5],[0,1,2,3,4,5]),Tr.config.smdClearance=Tr.config.clearance,Tr.config.viaDiameter=te.getInstance().getViaDiameter(),Tr.config.viaHoleD=te.getInstance().getViaHoleD(),Tr.config.width=te.getInstance().getTrackWidth(),Tr.config.netClass=te.getInstance().getSpecctraNetClass(),Tr.config.skipNets=""}static async exportDSN(t,e){try{return await Tr.exportDSN1(t,e)}catch(r){console.error(r);let i="Error";q0({type:"error",message:i,shortMsg:i})}}static async exportDSN1(t,e){let r="exportDSN-time";if(pn(r),Tr.initRouterConfig(t),!await Tr.initData())return Bi(r),!1;var n=function(d){return Id((d+Tr.adjustment)*Tr.scale)},s=n(Tr.config.width),a=n(Tr.config.clearance),l=n(Tr.config.smdClearance),c=Tr.createLibrary(),h=Tr.createStructure(a,s,l);if(!h||!Tr.pads.length)return A.windowBridge.publish("message",{type:"error",message:"Board outlines are not closed."},$()),Bi(r),!1;await the(.8);let u=`(PCB "${e}"`+Wn+XT+"(parser"+Wn+pu+'(host_cad "EasyEDA Pro")'+Wn+pu+`(host_version "${hRt}")`+Wn+XT+")"+Wn+XT+"(resolution mil "+Tr.resolution+")"+Wn+h+Wn+Tr.createPlace()+Wn+c+Wn+Tr.createNetwork()+Wn+Tr.createWiring()+")"+Wn;return Tr.net2Pads={},Tr.pads=[],Bi(r),u}static async saveFile(t){let e=(await A.windowBridge.rpcCall("getTabTitle",void 0,$())).message,r=new Date,i=r.getFullYear()+"-"+(r.getMonth()+1)+"-"+r.getDate();ip.downloadFileASCII("Autorouter_"+e+"_"+i+".dsn",t)}static createPlace(){var t=XT+"(placement"+Wn;return t+=Tr.createComponent(),t+=XT+")",t}static createComponent(){var t=pu+"(component u1"+Wn;return t+=ry+"(place u1 0 0 front 0"+Wn,t+=ry+")"+Wn,t+=pu+")"+Wn,t}static createLibrary(){var t=Tr.createAllPadStack(),e=XT+"(library"+Wn;return e+=Tr.createImage()+Wn,e+=Tr.createViaStack()+Wn,e+=t+Wn,e+=XT+")",e}static createImage(){var t=pu+"(image u1"+Wn;let e=Tr.PCBOutline;return Tr.pads.forEach(function(r){if(r.layerId==12||Tr.layers.indexOf(+r.layerId)!=-1){var i=Tr.remove_e(r.globalIndex);let a;r instanceof Le||r instanceof Ge?a=r.center:r instanceof fr?a=r.model.box.center:(r instanceof nr||r instanceof Sr||r instanceof ct)&&(a=r.buildBBox().center());var n=" "+Id((a.x-e.x)*Tr.scale)+" "+Id((a.y-e.y)*Tr.scale),s=Tr.padStackMap[i];s&&(t+=ry+"(pin p"+s+" "+i+n+")"+Wn)}}),t+=pu+")"+Wn,t}static createAllPadStack(){var t=[];return Tr.pads.forEach(function(e){if(e.layerId==12||Tr.layers.indexOf(+e.layerId)!=-1){var r=Tr.createPadStack(e);r&&t.push(r)}}),t.join(Wn)}static createPadStack(t){var e=Tr.grap*Tr.scale;e=Id(e);var r=Tr.remove_e(t.globalIndex),i=pu+"(padstack p"+r+Wn,n="",s=" 0 0";if(t instanceof Ri?t.layerId==12?Tr.layers.forEach(function(u){l(t,u)}):l(t,t.layerId):t instanceof fn?t.layerId==12?Tr.layers.forEach(function(u){h(t.getMathGraphics(u).primitives,t.center,u)}):h(t.getMathGraphics(t.layerId).primitives,t.center,t.layerId):t instanceof fr?h(t.getMathGraphics(t.layerId).primitives,t.model.box.center,t.layerId):t instanceof Ge?Tr.layers.forEach(function(u){c(t.radius*2,u)}):(t instanceof nr||t instanceof Sr||t instanceof ct)&&(t.layerId==12?Tr.layers.forEach(function(u){t instanceof Sr?c(t.radius*2,u):h(t.getMathGraphics(u).primitives,t.buildBBox().center(),u)}):t instanceof Sr?c(t.radius*2,t.layerId):h(t.getMathGraphics(t.layerId).primitives,t.buildBBox().center(),t.layerId)),!n)return"";var a=Tr.padStackCache[n];if(a)return Tr.padStackMap[r]=a,"";return Tr.padStackCache[n]=r,Tr.padStackMap[r]=r,i+n+pu+")";function l(u,d){d==1?p(u,u.topType,d):d==2?p(u,u.bottomType,d):15<=d&&d<=46&&p(u,u.innerType,d);function p(m,g,y){let b=m.getMathGraphics(y);if(g=="ELLIPSE"){let P=b.bbox().maxX-b.bbox().minX;c(P,y)}else["OVAL","RECT"].includes(g)&&h(m.getMathGraphics(y).primitives,m.center,y)}}function c(u,d){n+=ry+"(shape(circle "+DY[d]+" "+Id(u*Tr.scale)+s+"))"+Wn}function h(u,d,p){let m=[];for(let y=0;y<u.length;y++)u[y]instanceof q?m.push(...u[y].points(.01)):u[y]instanceof M&&m.push(...u[y].points(2));if(m.length<=2)return;let g=Tr.jointPoints(m,d);n+=ry+"(shape(polygon "+DY[p]+" "+e+" "+g+"))"+Wn}}static netClass(){var t="";return typeof Tr.config.netClass=="object"&&Tr.config.netClass.forEach(function(e){var r=e.width,i=e.clearance;r=Id(r*Tr.scale),i=Id(i*Tr.scale);var n=Tr.viaNetMap&&Tr.viaNetMap[e.net],s=Wn+eOe+"(use_via "+n+")",a=n?ry+"(circuit "+s+Wn+ry+")"+Wn:"";t+=pu+"(class "+e.net+` '${e.net}'`+Wn+a+ry+"(rule "+Wn+eOe+"(width "+r+")"+Wn+eOe+"(clearance "+i+")"+Wn+ry+")"+Wn+pu+")"+Wn}),t}static netSpecialCharReplace(t){if(!t)return t;for(let r in Tr.specailCharEscapeMap)t.indexOf(r)>=0&&(t=t.replace(r,Tr.specailCharEscapeMap[r]));let e=new RegExp("[^\0-\x7F]","g");return e.test(t)&&(t=t.replace(e,function(r){return"%U"+r.codePointAt(0).toString(16)+"%"})),t}static createNetwork(){var t=ze.getAllNets(),e="",r=[],i,n,s=Tr.skipNetArr;let a=Tr.pads.length;for(let l=0;l<a;l++){let c=Tr.pads[l];if(!("net"in c))continue;let h=c.net;Tr.net2Pads[h]?Tr.net2Pads[h].push(c):Tr.net2Pads[h]=[c]}for(let l=0;l<t.length;l++){let c=t[l];c&&(n=Tr.netSpecialCharReplace(c),i=Tr.connectPins(c),i&&(e=pu+"(net "+n+Wn,e+=ry+"(pins "+i+")"+Wn,s.indexOf(c)!=-1&&(e+=ry+"(type protect)"+Wn),e+=pu+")"),r.push(e))}return XT+"(network"+Wn+r.join(Wn)+Wn+Tr.netClass()+XT+")"+Wn}static connectPins(t){var e=[];let r=Tr.net2Pads[t];if(r)for(let i=0;i<r.length;i++){let n=r[i];n.net==t&&(n.layerId==12||Tr.layers.indexOf(+n.layerId)!=-1)&&e.push("u1-"+Tr.remove_e(n.globalIndex))}return e.join(" ")}static createWiring(){function t(i){var n=pu+"(wire(path "+i.layerId+" "+Id(Tr.scale*i.width)+" "+Tr.jointPoints([i.start,i.end],Tr.PCBOutline)+" )"+Wn;return n+=ry+"(net "+i.net+")"+Wn,n+=ry+"(type protect)"+Wn,n+=pu+")"+Wn,n}function e(i){var n="via"+Tr.viaStack[Id(i.radius*2)],s=pu+"(via "+n+" "+Tr.jointPoints([i.center],Tr.PCBOutline)+Wn+ry+"(net "+i.net+")"+Wn+ry+"(type protect)"+Wn+pu+")"+Wn;return s}var r=XT+"(wiring"+Wn;return Tr.tracks.forEach(function(i){i.length>=1&&Tr.layers.indexOf(+i.layerId)!=-1&&(r+=t(i))}),Tr.vias.forEach(function(i){i.net&&!i.locked&&(r+=e(i))}),r+=XT+")"+Wn,r}static remove_e(t){return(t||"").replace("e","")}static createViaStack(){var t=Tr.config.viaDiameter;t=Id(t);var e="",r=0;Tr.viaStack[t]=r,r++;for(var i=0,n=Tr.vias.length;i<n;i++)typeof Tr.viaStack[Id(Tr.vias[i].radius*2)]>"u"&&(Tr.viaStack[Id(Tr.vias[i].radius*2)]=r++);Tr.viaNetMap={},(function(l){for(var c=Tr.viaNetMap,h=0;h<l.netClass.length;h++){var u=l.netClass[h],d=Id(u.viaHoleDiameter);if(Ef(Tr.viaStack,d)){c[u.net]="via"+Tr.viaStack[d];continue}c[u.net]="via"+r,Tr.viaStack[d]=r++}return c})(Tr.config);function s(l){var c="";return Tr.layers.forEach(function(h){c+=ry+"(shape(circle "+DY[h]+" "+Id(Tr.scale*l)+"))"+Wn}),c}r=0,Tr.padStackVia=[];for(var a in Tr.viaStack)Ef(Tr.viaStack,a)&&(Tr.padStackVia.push("via"+Tr.viaStack[a]),e+=pu+"(padstack via"+Tr.viaStack[a]+Wn+s(a)+pu+")"+Wn);return e}static getBoardBBox(){let t=uu();if(t.length<1)return{minX:0,minY:0,maxX:0,maxY:0,x:0,y:0};let e={};for(let r=0;r<t.length;r++){let i=t[r].getMathGraphics().bbox();Object.keys(e).length<1?e={minX:i.minX,minY:i.minY,maxX:i.maxX,maxY:i.maxY}:(e.minX=Math.min(e.minX,i.minX),e.minY=Math.min(e.minY,i.minY),e.maxX=Math.max(e.maxX,i.maxX),e.maxY=Math.max(e.maxY,i.maxY))}return{...e,x:e.minX,y:e.minY}}static _getBoardOutlinePointStr(){let t=uu(),e=null;if(!t||t.length===0){let c="Please draw a board outline first!";q0({type:"error",message:c,shortMsg:c});return}else if(t.length>1){let c=new _e,h=[];t.forEach(d=>{c.ext1(d.buildBBox()),h.push(...d.getMathGraphics().primitives)});let u=new oh(c.build1(),2,1.2,new Gi(2),h).detect();if(u.items.length===1)e=u.items[0];else{let d="Found multiple board outlines, please change the extra board outlines as solt regions or delete them. All board outlines",p=[d+":"];t.forEach((m,g)=>{p.push(g==0?" ":", "),p.push({attr:{id:m.globalIndex,pcbid:x.getInstance().tabId},text:m.globalIndex})}),q0({type:"error",message:p,shortMsg:d});return}}let r=10,i=39.37,n=S.ORIGIN,s=Di.convert(1,r,r),a=Qe.translate(-n.x*s,-n.y*s).scale(s),l=AP.autoPangolinPoints(e||t[0].getMathGraphics(),a);return Tr.jointPoints1(l,Tr.PCBOutline)}static createStructure(t,e,r){var i=Tr._getBoardOutlinePointStr();if(!i)return console.error("no broad outline in Specctra"),!1;var n=pu+"(boundary(path signal 0 "+i+" )"+Wn+pu+")"+Wn;console.log(AP.getConfig());function s(){var c="";return Tr.layers.forEach(function(h){c+=pu+"(layer "+DY[h]+Wn+ry+"(type signal)"+Wn+pu+")"+Wn}),c}var a=Tr.grid;a=Di.convert(a,1,10);var l=XT+"(structure"+Wn+n+pu+"(via "+(Tr.padStackVia||["via0"]).join(" ")+Wn+pu+")"+Wn+pu+"(grid via   "+a+")"+Wn+pu+"(grid wire   "+a+")"+Wn+pu+"(grid place   "+a+")"+Wn+pu+"(rule(clear "+t+"))"+Wn+pu+"(rule(clear "+r+" (type default_smd)))"+Wn+pu+"(rule(clear "+r+" (type smd_smd)))"+Wn+pu+"(rule(width "+e+"))"+Wn+s()+XT+")"+Wn;return l}static isOKPCBForAutorouter(){var t=Tr.PCBOutline;if(Math.abs(t.minX-t.maxX)<1||Math.abs(t.minY-t.maxY)<1)return!1;function e(n){return n.x>t.minX&&n.x<t.maxX&&n.y>t.minY&&n.y<t.maxY}for(var r=iw(),i=0;i<r.length;i++)if(!e(r[i].center))return!1;return!0}static exportPins(){var t=ze.getAllNets(),e=[],r=Tr.skipNetArr;for(let i=0;i<t.length;i++){let n=t[i];r.indexOf(n)==-1&&Tr.pads.forEach(function(s){"net"in s&&s.net==n&&(s.layerId==12||Tr.layers.indexOf(+s.layerId)!=-1)&&e.push(Tr.remove_e(s.globalIndex))})}return e}};Tr.resolution=1e3,Tr.scale=10,Tr.grap=.01,Tr.grid=2.5,Tr.adjustment=.005,Tr.specailCharEscapeMap={"&":"&AMP;","(":"&LP;",")":"&GP;","{":"&LOT;","}":"&ROT;","'":"&APS;","`":"&DOT;",'"':"&DBQ;","|":"&ORO;"},Tr.specailCharReverseEscapeMap={},Tr.layers=[],Tr.skipNetArr=[],Tr.net2Pads={},Tr.viaStack={},Tr.padStackCache={},Tr.padStackMap={},Tr.viaNetMap={},Tr.importSession=(function(){var t=!1,e=0,r=0,i=[],n=[],s=[],a=null;function l(m,g,y,b){e=0,r=setTimeout(function(){c(m,g,y,b)},0)}function c(m,g,y,b){if(r=0,g||g===0){var P=[];for(var T in m)m[T].vias&&(P=P.concat(m[T].vias));var I=Tr.exportPins().length,C=I-g,E=I===0?"":" ( "+(C/I*100).toFixed(2)+"% )",O=C+E}t=!1,a=null}function h(m,g,y,b){e=setTimeout(function(){l(m,g,y,b)},0)}function u(m){var g;for(var y in m);}function d(m){a&&u(a);var g={},y=(function(H){var z={};z.viaRadius=Id(H.viaDiameter/2),z.viaHoleRadius=Id(H.viaHoleD/2),z.trackWidth=Id(H.width),z.netTrackWidth={};for(var G=0;G<H.netClass.length;G++){var W=H.netClass[G];z.netTrackWidth[W.net]=Id(W.width),W.net&&(g[W.net]={viaRadius:Id(W.viaHoleDiameter/2),viaHoleRadius:Id(W.viaHoleD/2)})}return z})(Tr.config),b=function(H){return H&&y.netTrackWidth[H]||y.trackWidth},P={},T=new RegExp("%U[0-9a-f]{1,5}%","g");let I=new mi;I.createGroup("Auto Router");var C=Tr.PCBOutline;for(var E in m)if(Ef(m,E)){var O=m[E].net,_=m[E].wires||{},R=m[E].vias||{};if(!O||Tr.skipNetArr.indexOf(O)!=-1)continue;for(var v in Tr.specailCharReverseEscapeMap)O.indexOf(v)!==-1&&(O=O.replace(v,Tr.specailCharReverseEscapeMap[v]));T.test(O)&&(O=O.replace(T,function(H){var z,G=H.replace("%","").replace("U","");try{z=String.fromCodePoint(parseInt(G,16))}catch{z=""}return z}));for(var D in _)if(Ef(_,D)){let H=_[D];for(let z=3;z<H.points.length;z=z+2){let G=pr.addTrack(H.layerid,new S(H.points[z-3]+C.x,H.points[z-2]+C.y),new S(H.points[z-1]+C.x,H.points[z]+C.y),b(O),!1,O);I.addCommand4Item(G,"add")}}for(D in R)if(Ef(R,D)){console.log(R[D]);var w=R[D],F=g[O]||g[""];if(!F)continue;let H=rt.getDefaultVia(new S(w.x+C.x,w.y+C.y),F.viaRadius,F.viaHoleRadius);H.net=O,I.addCommand4Item(H,"add")}}I.execute(),a=m}function p(m,g,y,b,P,T){if(t){if(g=="start"){A.windowBridge.publish("message",{type:"error",message:"Cannot start again before previous activity is stopped"},$());return}}else{if(g!="start")return;t=!0,a=null}s.length=0,Tr.initRouterConfig(),Tr.PCBOutline=Tr.getBoardBBox();var I=typeof m=="string"&&m!==""?JSON.parse(m):m;I&&(d(I),h(m,b,P,T)),g=="end"&&h(m,b,P,T)}return p})();var I9=Tr;(function(){var o=I9.specailCharEscapeMap,t="";for(var e in o){if(e=="&"){t=o[e];continue}I9.specailCharReverseEscapeMap[o[e]]=e}I9.specailCharReverseEscapeMap[t]="&"})();function aje(){new vG(".ses",function(o){let t=o[0];xG(t).then(e=>{let r=e.name||e.title||"";var i="_self",n=new t$(i).parse(e.content),s=n.data||{},a=P(s,"session"),l=P(a,"routes");if(!l){A.windowBridge.publish("message",{type:"error",message:"Invalid file format"},$());return}var c=P(l,"resolution"),h=c&&c[i]&&c[i][0];LY(h)||(h=1);var u=parseFloat(c&&c[i]&&c[i][1])||1,p=new ft().conversion(h,"mil",1)*u*10,m=P(l,"network_out"),g=m&&m.net||[],y={a:"routingResult",data:{},complete:1,inCompleteNetNum:0};let b=new i5(new Gi(1),[]);g.forEach(function(I,C){var E=(I[i]||[]).join("");if(!E){console.warn("network was empty!",I);return}E.startsWith('"')&&E[E.length-1]=='"'&&(E=E.slice(1,E.length-1));var O={net:E,vias:[],wires:[]},_=I.via||[];_.forEach(function(v){v=v[i]||[],!(v.length<3)&&O.vias.push({x:T(v[1],p),y:T(v[2],p)})});var R=I.wire||[];R.forEach(function(v){var D=(P(v,"path")||{})[i];if(!(!D||D.length<6)){var w={layerid:1,width:10,points:[]};D.forEach(function(F,H){H==0?w.layerid=+cje(F.toString().replace(/"/g,""),b)||1:H==1?w.width=T(F,p):w.points.push(T(F,p))}),O.wires.push(w)}}),y.data[C]=O}),I9.importSession(y.data,"start","","",sje);function P(I,C,E){return I&&I[C]&&I[C][E||0]}function T(I,C){return Id(parseFloat(I)/C)}},function(e){A.messageBus.publish("message",{type:"error",message:e})})})}function lje(o){return new Promise((t,e)=>{xG(o).then(r=>{let i=r.name||r.title||"";var n="_self",s=new t$(n).parse(r.content),a=s.data||{},l=T(a,"session"),c=T(l,"routes");if(!c){A.windowBridge.publish("message",{type:"error",message:"Invalid file format"},$()),t(!1);return}var h=T(c,"resolution"),u=h&&h[n]&&h[n][0];LY(u)||(u=1);var d=parseFloat(h&&h[n]&&h[n][1])||1,m=new ft().conversion(u,"mil",1)*d*10,g=T(c,"network_out"),y=g&&g.net||[],b={a:"routingResult",data:{},complete:1,inCompleteNetNum:0};let P=new i5(new Gi(1),[]);y.forEach(function(C,E){var O=(C[n]||[]).join("");if(!O){console.warn("network was empty!",C);return}O.startsWith('"')&&O[O.length-1]=='"'&&(O=O.slice(1,O.length-1));var _={net:O,vias:[],wires:[]},R=C.via||[];R.forEach(function(D){D=D[n]||[],!(D.length<3)&&_.vias.push({x:I(D[1],m),y:I(D[2],m)})});var v=C.wire||[];v.forEach(function(D){var w=(T(D,"path")||{})[n];if(!(!w||w.length<6)){var F={layerid:1,width:10,points:[]};w.forEach(function(H,z){z==0?F.layerid=+cje(H.toString().replace(/"/g,""),P)||1:z==1?F.width=I(H,m):F.points.push(I(H,m))}),_.wires.push(F)}}),b.data[E]=_}),I9.importSession(b.data,"start","","",sje),t(!0);function T(C,E,O){return C&&C[E]&&C[E][O||0]}function I(C,E){return Id(parseFloat(C)/E)}},function(r){A.messageBus.publish("message",{type:"error",message:r})})})}function the(o){return new Promise(t=>{A.publish("progressUpdate",[o,"exportAutoRouterDSN"],$()),setTimeout(()=>{t(!0)},20)})}function cje(o,t){let e=t.iterator();for(;e.hasNext();){let r=e.next();if(r.name===o)return r.id}return o}var rhe=o=>{let t=Ve.getSelects();switch(o){case"boolIntersection":case"boolAggregate":{fRt(t,o);break}case"boolSubtraction":{mRt(t);break}case"boolExclusive":{gRt(t);break}case"boolSplit":{let{newPolygons:e,groupCommand:r}=iN(t);r.length>0&&(ie.publish("autoFill",""),ie.publish("updateRtree",""),je.executeCommand(r),ie.publish("onlySelect",e));break}}};function iN(o,t){let e=[];t=t||new ve("Execute Bool Split");let r=o.filter(s=>s instanceof ct&&["Fill Region","FPC Stiffener"].includes(s.type)&&s.isComplexPolygon()),i=new io,n=m_(r);for(let s=0;s<r.length;s++){let a=r[s],l=a instanceof Le?0:a.strokeWidth;ihe(a).items.slice(1).map(d=>(d=vh(d)?d.reverse():d,i.plToShapes(d,a.layerId,l))).forEach((d,p)=>{let m=pt.addPolygon(a.type,a.layerId,[d],a.strokeWidth,a.net,!1);if(a.type=="FPC Stiffener"||a.type=="Fill Region"&&n){let y=JSON.stringify(a.getComponent());new Nl(y,m.type).rebuildComponent(m)}let g=Te.dispatch(m,"add");t.addCommand(g),e.push(m),m.click()});let u=Te.dispatch(a,"modify");t.addCommand(u),a.keepOutline(),ie.publish("hasModifyPcbItem",a),a.click(),e.push(a)}return{newPolygons:e,groupCommand:t}}function uRt(o){let t={Pad:{items:new Array,is:e=>e instanceof Le},"Board Outline":{items:new Array,is:e=>e instanceof Ye&&e.type=="Board Outline"},"Copper Region":{items:new Array,is:e=>e instanceof Ye&&e.type=="Copper Region"},"Fill Region":{items:new Array,is:e=>e instanceof Ye&&e.type=="Fill Region"},"Slot Region":{items:new Array,is:e=>e instanceof Ye&&e.type=="Slot Region"},"Prohibited Region":{items:new Array,is:e=>e instanceof Ye&&e.type=="Prohibited Region"},"FPC Stiffener":{items:new Array,is:e=>e instanceof Ye&&e.type=="FPC Stiffener"},"Constraint Region":{items:new Array,is:e=>e instanceof Ye&&e.type=="Constraint Region"}};return uje(o,t)}function hje(o){let t={"Fill Region":{items:[],is:e=>e instanceof Ye&&e.type=="Fill Region"},"FPC Stiffener":{items:[],is:e=>e instanceof Ye&&e.type=="FPC Stiffener"}};return uje(o,t)}function uje(o,t){for(let r of o)if(!(r.getParent()&&r.getParent()instanceof Me))for(let i in t)t[i].is(r)&&t[i].items.push(r);let e=new Array;for(let r in t){let i=t[r].items;if(i.length>=2){let n={};for(let s of i)n[s.layerId]||(n[s.layerId]=[]),n[s.layerId].push(s);e.push(...Object.values(n).filter(s=>s.length>=2))}}return e}function dRt(o){let t=o[0];for(let e=1;e<o.length;e++)t.bbox().area()<o[e].bbox().area()&&(t=o[e]);for(let e=0;e<o.length;e++){if(o[e]==t)continue;let{relation:r}=new fc(t,o[e],0);if(r!=1)return null}return t}function pRt(o){let t=o.map(i=>{let n=ihe(i);return n instanceof Gt?n:new Gt([vh(n)?n.reverse():n])}),e=dRt(t);if(e==null){let i=0,n=o[0];for(let s=1;s<o.length;s++){let a=o[s],l=Ve.selectionOrder.get(a.globalIndex),c=Ve.selectionOrder.get(n.globalIndex);(l<c||l==c&&a.zIndex<n.zIndex)&&(i=s,n=a)}e=t[i]}let r=e.getOutMostPolyline();return[[r],t.map(i=>i.items).flat(1).filter(i=>i!=r)]}function tOe(o){if(!o.length)return;let t=o.map(r=>r.buildBBox().area()),e=t.reduce((r,i,n)=>i>t[r]?n:r,0);return o[e]}function fRt(o,t){let e=[],r=new ve("Execute Boolean Operation"),i=new Kc,n=uRt(o),s=[];for(let a of n){let l=tOe(a),c=m_(a),h=a.map(d=>{let p=ihe(d);return p instanceof Gt?p:new Gt([vh(p)?p.reverse():p])}),u;t=="boolIntersection"?u=i.getIntersectionForSingle(h.map(d=>d.items)):(u=i.getUnionForSingle(h.map(d=>d.items)),["Fill Region","FPC Stiffener"].includes(a[0].type)||(u=u.map(d=>d.items.length>1?new Gt([d.getOutMostPolyline()]):d))),u.forEach(d=>{let p;if(l instanceof Le){let g=d.items[0],y=new Sm(g.primitives);p=Kt.addPolygonPad(l.layerId,l.num,y.center,0,g,l.net,!1,l.expansionType,l.pasteExpansion,l.topSolderExpansion,l.bottomSolderExpansion,l.unusedInnerLayers,l.plated,y.high*.6,y.high*.3,"ROUND",0,rt.defalutPad.holeOffset,l.padRule)}else if(p=new au().create4PlGrp(l.type,l.layerId,d,l.strokeWidth,l.net,!1),l.type=="FPC Stiffener"||l.type=="Fill Region"&&c){let y=JSON.stringify(l.getComponent());new Nl(y,p.type).rebuildComponent(p)}else if(l.type=="Copper Region"&&te.getInstance().getRegion(a[0].globalIndex)){let b=te.getInstance().addRegionSelector(p.globalIndex),P=te.getInstance().getSafeSpacingByNet(a[0].net,13);b.safeClearance=P.name,ky.getInstance().set("Main"),Xp.getInstance().publish("modify",P)}p instanceof Ye&&p.type=="Copper Region"&&s.push(p.globalIndex),gn.addOrder(p,r),e.push(p);let m=Te.dispatch(p,"add");r.addCommand(m)}),a.forEach(d=>{r.addCommand(Te.dispatch(d,"delete")),ie.publish("hasModifyPcbItem",d),d.remove(),ie.publish("delete",d)})}ie.publish("rebuildConnectCopper",s),ie.publish("autoFill",""),ie.publish("updateRtree",""),ie.publish("updateFrame",""),r.length>0&&(je.executeCommand(r),ie.publish("onlySelect",e))}function mRt(o){let t=[],e=new ve("Execute Boolean Operation"),r=new Kc,i=hje(o);for(let n of i){let s=r.getSubtraction(...pRt(n)),a=m_(n),l=tOe(n),c=new au;s.forEach(h=>{let u=c.create4PlGrp(l.type,l.layerId,h,l.strokeWidth,l.net,!1);if(l.type=="FPC Stiffener"||l.type=="Fill Region"&&a){let p=JSON.stringify(l.getComponent());new Nl(p,u.type).rebuildComponent(u)}let d=Te.dispatch(u,"add");e.addCommand(d),t.push(u),u.click()}),n.forEach(h=>{e.addCommand(Te.dispatch(h,"delete")),ie.publish("hasModifyPcbItem",h),h.remove(),ie.publish("delete",h)})}ie.publish("autoFill",""),ie.publish("updateRtree",""),ie.publish("updateFrame",""),e.length>0&&(je.executeCommand(e),ie.publish("onlySelect",t))}function gRt(o){let t=[],e=new ve("Execute Boolean Operation"),r=new Kc,i=hje(o);for(let n of i){let s=tOe(n),a=m_(n),l=n.map(u=>{let d=ihe(u);return d instanceof Gt?d:new Gt([vh(d)?d.reverse():d])}),c=r.getMutuallyExclusiveForSingle(l.map(u=>u.items)),h=new au;c.forEach(u=>{let d=h.create4PlGrp(s.type,s.layerId,u,s.strokeWidth,s.net,!1);if(s.type=="FPC Stiffener"||s.type=="Fill Region"&&a){let m=JSON.stringify(s.getComponent());new Nl(m,d.type).rebuildComponent(d)}let p=Te.dispatch(d,"add");e.addCommand(p),t.push(d),d.click()}),n.forEach(u=>{e.addCommand(Te.dispatch(u,"delete")),ie.publish("hasModifyPcbItem",u),u.remove(),ie.publish("delete",u)})}ie.publish("autoFill",""),ie.publish("updateRtree",""),ie.publish("updateFrame",""),e.length>0&&(je.executeCommand(e),ie.publish("onlySelect",t))}function ihe(o){return o instanceof Le&&o.layerId==12?o.getMathGraphics(1):o.getMathGraphics()}var nhe=class{constructor(t){this.direct=null;this.shape=t,this.oldStart=t.start,this.oldEnd=t.end,this.direct=Yf(t.end.sub(t.start).normalize())}};function Yf(o){let t;Math.abs(o.x)<1e-8?t=0:t=o.x;let e;return Math.abs(o.y)<1e-8?e=0:e=o.y,new S(t,e)}function Nm(o){return o.filter(t=>t.length>1e-8?!0:(t.remove(),!1))}function nw(o){if(o instanceof ct){let e=o.getChildrens().map(r=>iy(r));o.getChildrens().length=0,o.setChildrens(e),be.getLayer(o.layerId).isSignalLayer()&&(o.color=null)}else if(o instanceof fn){let t=o.createPreviewChildrens(),r=iy(t).map(i=>{let n=i.primitive;return i.remove(),n});o.setChildrens(fe.build2(r))}}function iy(o){let t=[];o=Nm(o);for(let n=0;n<o.length;n++){let s=o[n];if(s instanceof mt){let a=s.end,l=s.end.sub(s.start),c=Yf(l.normalize());for(;n<o.length-1&&o[n+1]instanceof mt;){let h=o[n],u=o[n+1],d=u.end.sub(u.start),p=Yf(d.normalize()),m=h.end.distance1(u.start)<1e-8,g=rOe(c,p);if(u instanceof mt&&m&&g)a=u.end;else break;n++}s.end=a,t.push(s)}else t.push(s)}let e=t[0],r=t[t.length-1];if(t.length>=2&&e instanceof mt&&r instanceof mt){let n=e.direct,s=r.direct;if(Math.abs(n.cross(s))<1e-8&&n.dot(s)>=0){let{start:l,end:c}=r,{start:h,end:u}=e;n.dot(h.sub(l))>=0&&n.dot(u.sub(c))>=0&&n.dot(c.sub(h))>=0&&(r.end=e.end,t.shift())}}let i=new Set(t);return o.forEach(n=>{n&&!i.has(n)&&n.remove()}),t}function rOe(o,t){return!!ne.less(Math.abs(o.cross(t)),Rl)}var RG=class{constructor(){this.type=null;this.shapes=new Array;this.width=.02;this.minSpace=.5;this.net="";this.locked=!1;this.isMergeCoincide=!1}setType(t){return this.type=t,this}setLayerId(t){return this.layerId=t,this}get length(){return this.shapes.length}addChilds(t){return this.shapes=[].concat(this.shapes,t),this}addChild(t){return this.shapes.push(t),this}setWidth(t){return this.width=t,this}setMinSpace(t){return this.minSpace=t,this}setNet(t){return this.net=t,this}setLocked(t){return this.locked=t,this}check(){return!(this.type==null||this.layerId==null||this.shapes.length==0||this.width==null||this.net==null||this.locked==null)}get start(){return this.shapes.length>0?this.shapes[0].start:null}get end(){return this.shapes.length>0?this.shapes[this.shapes.length-1].end:null}getShapes(){return this.shapes}insertHead(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e==0){let r=new Array;for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n)}r[r.length-1].end=this.shapes[0].start,this.shapes=[].concat(r,this.shapes)}else e==1&&(t[t.length-1].end=this.shapes[0].start,this.shapes=[].concat(t,this.shapes));return this}insertHead1(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e==4){let r=new Array;for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n);let s=r.findIndex(a=>a.globalIndex==n.globalIndex);s-1>=0&&!r[s].start.equals2(r[s-1].end,this.minSpace)&&(r[s].start=r[s-1].end)}!r[r.length-1].end.equals(this.shapes[0].start,this.minSpace)&&(r[r.length-1].end=this.shapes[0].start),this.shapes=[].concat(r,this.shapes),this.isMergeCoincide=!0}else e==3&&(!t[t.length-1].end.equals(this.shapes[0].start,this.minSpace)&&(t[t.length-1].end=this.shapes[0].start),this.shapes=[].concat(t,this.shapes),this.isMergeCoincide=!0);return this}insertHead2(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e.connect==0){let r=new Array;t=t.slice(0),this.shapes[0].start=t[e.startIndex].end,t.splice(0,e.startIndex+1);for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n)}this.shapes=[].concat(r,this.shapes),this.isMergeCoincide=!0}else e.connect==1&&(t=t.slice(0),this.shapes[0].start=t[e.startIndex].start,t.splice(e.startIndex,t.length-e.startIndex),this.shapes=[].concat(t,this.shapes),this.isMergeCoincide=!0);return this}insertEnd(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e==2)this.shapes[this.shapes.length-1].end=t[0].start,this.shapes=[].concat(this.shapes,t);else if(e==3){let r=new Array;for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n)}this.shapes[this.shapes.length-1].end=r[0].start,this.shapes=[].concat(this.shapes,r)}return this}insertEnd1(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e==2)!this.shapes[this.shapes.length-1].end.equals(t[0].start,this.minSpace)&&(this.shapes[this.shapes.length-1].end=t[0].start),this.shapes=[].concat(this.shapes,t),this.isMergeCoincide=!0;else if(e==5){let r=new Array;for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n);let s=r.findIndex(a=>a.globalIndex==n.globalIndex);s-1>=0&&!r[s].start.equals(r[s-1].end,this.minSpace)&&(r[s].start=r[s-1].end)}!this.shapes[this.shapes.length-1].end.equals(r[0].start,this.minSpace)&&(this.shapes[this.shapes.length-1].end=r[0].start),this.shapes=[].concat(this.shapes,r),this.isMergeCoincide=!0}return this}insertEnd2(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e.connect==2)t=t.slice(0),this.shapes[this.shapes.length-1].end=t[0].end,t.splice(0,e.endIndex+1),this.shapes=[].concat(this.shapes,t),this.isMergeCoincide=!0;else if(e.connect==3){let r=new Array;t=t.slice(0),this.shapes[this.shapes.length-1].end=t[e.endIndex].start,t.splice(e.endIndex,t.length-e.endIndex);for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n)}this.shapes=[].concat(this.shapes,r),this.isMergeCoincide=!0}return this}insertLoop(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e==4){let r=new Array;for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n)}r[r.length-1].end=this.shapes[0].start,r[0].start=this.shapes[this.shapes.length-1].end,this.shapes=[].concat(this.shapes,r)}else e==5&&(t[t.length-1].end=this.shapes[0].start,t[0].start=this.shapes[this.shapes.length-1].end,this.shapes=[].concat(this.shapes,t));return this}updateShape(t,e){return t.length==0?this:(this.shapes.length==0?this.shapes=Array.from(t):e.connect==4&&(this.shapes.length<t.length&&(this.shapes=Array.from(t)),this.isMergeCoincide=!0),this)}insertShape(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e)this.start.equals(t[t.length-1].end)?(t=t.slice(0),this.shapes=[].concat(t,this.shapes),this.isMergeCoincide=!0):this.end.equals(t[0].start)&&(this.shapes=[].concat(this.shapes,t),this.isMergeCoincide=!0);else{let r=new Array;for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n)}this.start.equals(r[r.length-1].end)?(r=r.slice(0),this.shapes=[].concat(r,this.shapes),this.isMergeCoincide=!0):this.end.equals(r[0].start)&&(this.shapes=[].concat(this.shapes,r),this.isMergeCoincide=!0)}return this}updateModelShape(t,e,r,i){return e=="nextItemStartInPlItem"?r?this.shapes[i].end=t.end:this.shapes[i].start=t.end:r?this.shapes[i].start=t.start:this.shapes[i].end=t.start,this.isMergeCoincide=!0,this}overlappingUpdateModelShape(t){return t.length==0?this:(this.shapes.length==0?this.shapes=Array.from(t):this.shapes=Array.from(t),this)}selfIntersectionPoints(){let t=[];for(let e=0;e<this.shapes.length;e++){let r=this.shapes[e];for(let i=e+1;i<this.shapes.length;i++){let n=this.shapes[i];if(r.buildBBox().isSeparated(n.buildBBox()))continue;let s=new S(Xe(r.start.x),Xe(r.start.y)),a=new S(Xe(r.end.x),Xe(r.end.y)),l=new S(Xe(n.start.x),Xe(n.start.y)),c=new S(Xe(n.end.x),Xe(n.end.y)),h=Xte(s,a,l,c);h&&!t.includes(h)&&t.push(h)}}return t}selfIntersectionPoints2(){let t=new Set,e=!1;for(let r=0;r<this.shapes.length;r++){let i=this.shapes[r];t.add(i);for(let n=r+1;n<this.shapes.length;n++){let s=this.shapes[n];if(t.add(s),(s.end.equals(i.start)||s.end.equals(i.end))&&this.shapes[n+1]&&s.end.equals(this.shapes[n+1].start)){e=!0;let a=Array.from(t).findIndex(c=>c.start.equals(s.end));return Array.from(t).slice(a,n+1)}}}if(!e)return[]}splitSelfIntersectionPolyline(){let t=[],e=this.selfIntersectionPoints();if(e.length){let r=new io;e.forEach(i=>{for(let s=0;s<this.shapes.length;s++){let a=this.shapes[s];if(_Y(i,a.start,a.end,a.width/Ni().getScale())&&!i.equals(a.start)&&!i.equals(a.end)){let l=r.clone4(a.model),c=r.clone4(a.model);l.start=i,c.end=i,this.shapes.splice(s,1,l),this.shapes.splice(s,0,c),l.hidden(),c.hidden()}}let n=[];for(let s=0;s<this.shapes.length;s++){let a=this.shapes[s];if(!n.some(l=>l&&l.lineIsEqual(a))&&(n.push(a),a.end.equals(i))){for(let l=s+1;l<this.shapes.length;l++){let c=!1,h=this.shapes[l];h.start.equals(a.end)&&!OA([a.start,a.end],[h.start,h.end])&&(n.push(h),c=!0),c&&(n.some(u=>u&&u.lineIsEqual(h))||n.push(h)),l==this.shapes.length-1&&(t.push(...n),n=[])}break}}})}else{let r=new io,i=this.selfIntersectionPoints2();i.length&&(i=i.map(n=>r.clone4(n.model)),t.push(...i))}return t.length&&t.forEach(r=>{let i=this.shapes.findIndex(n=>n.lineIsEqual(r));i!==-1&&this.shapes.splice(i,1)}),t}reverseModel(t){if(t instanceof mt){let e=t.start,r=t.end;return t.start=r,t.end=e,t}else{let e=t.sweep;e==le.CCW?e=le.CW:e=le.CCW;let r=t.startAngle,i=t.endAngle;return t.sweep=e,t.setStartAngleAndEndAngle(i,r),t}}isClose(){if(this.shapes.length>1){let t=this.shapes[0],e=this.shapes[this.shapes.length-1];if(t.start.distance2(e.end)<this.width/Ni().getScale())return!0}return!1}correctPoint(){if(this.shapes.length>1){let t=this.shapes[0],e=this.shapes[this.shapes.length-1];t.start.equals1(e.end)||(t.start=e.end)}}build(){if(pd(this.type)&&!xu(this.shapes.map(r=>r.primitive)))return null;let t=new Array,e=new io;return this.shapes.forEach(r=>{let i=e.clone4(r.model);t.push(i)}),t=Nm(t),pt.addPolygon(this.type,this.layerId,[t],this.width,this.net,this.locked)}build1(t){return pd(this.type)&&!xu(t.map(e=>e.primitive))||(t=Nm(t),!t.length)?null:pt.addPolygon(this.type,this.layerId,[t],this.width,this.net,this.locked)}};var iOe=class{constructor(t){this.shape=t;this._bbox=t.buildBBox()}bbox(){return this._bbox}},C9=class o{constructor(t,e){this.minSpaceRoughly=.5;this.result=[];this.mergedModels=[];this.addModels=[];t!=null&&(this.minSpacePrecise=t),e!=null&&(this.minSpaceRoughly=e),this.result.length=0,this.mergedModels.length=0,this.addModels.length=0}build(t,e){let r=new o(this.minSpacePrecise,this.minSpaceRoughly),i=r.getGroupPolygon(t),n=!1,s=[],a=[];for(let c=0,h=i.length;c<h;c++){let u=i[c];if(u){n=r.filterMultiPolygon(u).isMultiConnect;let p=r.merge1(u);p.mergedModels&&(s=s.concat(p.mergedModels)),p.addModels&&(a=a.concat(p.addModels))}}let l=[];return t.forEach(c=>{s.indexOf(c)===-1&&l.push(c)}),this.result=l.concat(a),s.length&&(this.mergedModels=s),a.length&&(this.addModels=a),e&&e(s,a,n),{mergedModels:s,addModels:a,isMultiConnect:n}}filterMultiPolygon(t){let e=this.getModelsPoint(t),r=[],i=[],n=!1;for(let s=0,a=e.length;s<a;s++){let l=e[s],c=0,h=0,u=0,d=null;if(!ohe(l,t[s])){for(let p=0;p<e.length;p++){let m=e[p];if(s==p||ohe(m,t[p]))continue;let g=this.checkIsSmallestAffairs(this.getPortsConnectInfo(l,m,this.minSpaceRoughly),l,m);d=this.checkCoincidence(l,m,t[s],t[p]),g==0||g==1?c++:g==2||g==3?h++:(g==5||g==4)&&(c++,h++),d.connect&&u++}u!=1&&c<=1&&h<=1&&r.push(t[s]),(c>=2||h>=2||u>1)&&(n=!0),u<=1&&i.push({model:t[s],coincidenceInfo:d})}}return{singleConnectModels:r,isMultiConnect:n,singleCoinConnectModels:i}}flatten(t){return t.reduce((e,r)=>(e.push(...r),e),[])}merge1(t){let e=new Set,r=new Set,i=[],n={},s=new ve("merge polygon");t.forEach(h=>{if(h instanceof ct){let u=Te.dispatch(h,"delete");n[h.globalIndex]=u}});let a=this.sortModels(t,r,n,s);t=a.models;let{flattenTree:l,rtree:c}=a;for(let h=0,u=t.length;h<u;h++){let d=t[h];if(d.isEmpty)continue;let p=new RG;p.setMinSpace(this.minSpacePrecise).setType(d.type).setLayerId(d.layerId).setWidth(d.strokeWidth).setNet(d.net).addChilds(l.get(d).itemList.map(g=>g.shape));let m=!1;do m=this.add2Factory3(d,e,p,c,r,l);while(m);if(p.isMergeCoincide){let g=p.splitSelfIntersectionPolyline();if(g.length){let b=p.build1(g);b&&s.addCommand(Te.dispatch(b,"add"))}let y=p.build();y!=null&&r.size&&(r.forEach(b=>{n[b.globalIndex]&&(s.addCommand(n[b.globalIndex]),delete n[b.globalIndex]),A.publish("delete",b),b.remove()}),i.push(y),s.addCommand(Te.dispatch(y,"add")),A.publish("hasModifyPcbItem",y))}}return s.length&&je.executeCommand(s),{mergedModels:Array.from(r),addModels:i}}add2Factory3(t,e,r,i,n,s){let a=!1,l=[t];for(;l.length;){let c=l.pop();if(!c.isEmpty)for(let h of i.search(c.buildBBox())){let u=[c.globalIndex,h.globalIndex].sort().join("|");if(e.has(u))continue;e.add(u);let d=h&&h||h;if(d.isEmpty||d&&c.equals1(d))continue;let p=r.getShapes(),m=s.get(d);for(let g=0;g<p.length;g++){let y=p[g],b=y.start,P=y.end,T=P.sub(b);for(let I of m.search(y.buildBBox())){let E=I.shape,O=E.start,_=E.end,R=_.sub(O),v=T.dot(R)>=0,D=OA([b,P],[O,_])&&y instanceof mt&&E instanceof mt;this.isInside(E,y)?(n.add(c),n.add(h),l.push(h),r.isMergeCoincide=!0,m.remove(I),a=!0):this.isInside(y,E)?(v?p[g]=E:p[g]=r.reverseModel(E),n.add(c),n.add(h),l.push(h),r.isMergeCoincide=!0,m.remove(I),a=!0):this.pointsInLineOrArc(O,y)?D?(v?p[g].end=_:p[g].start=_,n.add(c),n.add(h),l.push(h),m.remove(I),r.isMergeCoincide=!0,a=!0):(this.equals2(O,P,y.width)||this.equals2(O,b,y.width)||(n.delete(c),n.delete(h),r.isMergeCoincide=!1),a=!1):this.pointsInLineOrArc(_,y)&&(D?(v?p[g].start=O:p[g].end=O,n.add(c),n.add(h),l.push(h),m.remove(I),r.isMergeCoincide=!0,a=!0):(this.equals2(_,b,y.width)||this.equals2(_,P,y.width)||(n.delete(c),n.delete(h),r.isMergeCoincide=!1),a=!1))}}if(m.size()){let g=m.itemList.map(b=>b.shape),y=this.checkIsEndToEnd1(r,g[0].start,g[g.length-1].end);if(y)switch(y){case 2:r.insertEnd1(g,2),n.add(c),n.add(h),l.push(h),a=!0;break;case 3:r.insertHead1(g,3),n.add(c),n.add(h),l.push(h),a=!0;break;case 4:r.insertHead1(g,4),n.add(c),n.add(h),l.push(h),a=!0;break;case 5:r.insertEnd1(g,5),n.add(c),n.add(h),l.push(h),a=!0;break}}if(r.isClose())return r.correctPoint(),!1}}return a}checkIsEndToEnd1(t,e,r){var a;let i=(a=this.minSpacePrecise)!=null?a:t.width/Ni().getScale(),n=Number.POSITIVE_INFINITY,s=!1;if(this.equals2(t.end,e,i)){let l=t.end.distance1(e);l<n&&(n=l,s=2)}if(this.equals2(t.start,r,i)){let l=t.start.distance1(r);l<n&&(n=l,s=3)}if(this.equals2(t.start,e,i)){let l=t.start.distance1(e);l<n&&(n=l,s=4)}if(this.equals2(t.end,r,i)){let l=t.end.distance1(r);l<n&&(n=l,s=5)}return s}sortModels(t,e,r,i){let n=new Set,s=new Set,a=new nn(10),l=new Map,c=new Map;for(let p of t){a.add(p),n.add(p);let m=this.flatten(p.getChildrens()),g=new nn(10);for(let y of m)g.add(new iOe(y));l.set(p,g),c.set(p,m.every(y=>y instanceof mt))}let h=new Set,u=new Set;function d(p){A.publish("delete",p),p.remove(),h.add(p),u.add(p)}for(let p=0;p<t.length;p++){let m=t[p];if(!h.has(m)){h.add(m);for(let g of a.search(m.buildBBox())){if(h.has(g))continue;let y=OA([m.start,m.end],[g.start,g.end])&&c.get(m)&&c.get(g),b=new Set;if(y){let P=l.get(g);for(let T of l.get(m).items())for(let I of P.search(T.bbox())){this.isInside(I,T)&&b.add(I.shape);break}}if(b.size&&b.size==l.get(g).size())e.add(g),s.add(m),r[g.globalIndex]&&(i.addCommand(r[g.globalIndex]),delete r[g.globalIndex]),d(g);else{if(b=new Set,y){let P=l.get(m);for(let T of l.get(g).items())for(let I of P.search(T.bbox())){this.isInside(I,T)&&b.add(I.shape);break}}b.size&&b.size==l.get(m).size()&&(e.add(m),s.add(g),r[m.globalIndex]&&(i.addCommand(r[m.globalIndex]),delete r[m.globalIndex]),d(m))}}}}for(let p of e)n.delete(p),l.delete(p),a.remove(p);for(let p of u)n.delete(p),l.delete(p),a.remove(p);return Array.from(s).forEach(p=>e.add(p)),{models:Array.from(n),flattenTree:l,rtree:a}}getGroupPolygon(t){let e={},r,i=[];return t.forEach(n=>{if(n instanceof mt||n instanceof vt){let s,a=n.getParent();a!=null&&a instanceof Ye&&(s=a.type),i=[s,n.layerId,on(n.width,2),"",n.locked],r=i.join("@"),lY(e,r,()=>[n],(l,c)=>l[c].concat([n]))}else n instanceof ct&&this.flatten(n.getChildrens()).length&&(i=[n.type,n.layerId,on(n.strokeWidth,2),n.net,n.locked],r=i.join("@"),lY(e,r,()=>[n],(a,l)=>a[l].concat([n])))}),Object.values(e)}getModelsPoint(t){let e=[];for(let r=0,i=t.length;r<i;r++){let n=t[r],s=she(n);s&&e.push(s)}return e}getPortsConnectInfo(t,e,r){let i=this.equals2(t[0],e[0],r),n=this.equals2(t[1],e[1],r),s=this.equals2(t[0],e[1],r),a=this.equals2(t[1],e[0],r);if(i&&n)return 4;if(s&&a)return 5;if(i)return 0;if(n)return 3;if(s)return 1;if(a)return 2}equals2(t,e,r){return t instanceof S&&e instanceof S?Math.abs(t.x-e.x)<=r&&Math.abs(t.y-e.y)<=r:!1}isInside(t,e){if(!(t instanceof mt&&e instanceof mt||t instanceof vt&&e instanceof vt))return!1;let r=t.start,i=t.end,n=this.pointsInLineOrArc(r,e)&&this.pointsInLineOrArc(i,e);if(t instanceof mt&&e instanceof mt)return n;if(t instanceof vt&&e instanceof vt){let h=function(){let d=Math.max(a,c)-Math.min(s,l);return Math.abs(d-2*Math.PI)<Number.EPSILON};if(!n||!t.center.equals1(e.center)||!H2(t.radius,e.radius,.001))return!1;let s=t.startAngle%(2*Math.PI),a=t.endAngle%(2*Math.PI);a<s&&(a+=2*Math.PI);let l=e.startAngle%(2*Math.PI),c=e.endAngle%(2*Math.PI);return c<l&&(c+=2*Math.PI),!(h()||!(s>=l&&a<=c))}return!1}pointsInLineOrArc(t,e){var r;return e instanceof mt?_Y(t,e.start,e.end,(r=this.minSpacePrecise)!=null?r:e.width/Ni().getScale()):wVe(t,e)}checkIsSmallestAffairs(t,e,r){function i(n,s,a){return Math.abs(n.x-s.x)<=a&&Math.abs(n.y-s.y)<=a}if(t!==null&&e[0].distance1(e[1])<=this.minSpaceRoughly){let s=e[0].distance2(r[0]),a=e[0].distance2(r[1]),l=e[1].distance2(r[0]),c=e[1].distance2(r[1]),h=i(e[0],r[0],this.minSpaceRoughly),u=i(e[0],r[1],this.minSpaceRoughly),d=i(e[1],r[0],this.minSpaceRoughly),p=i(e[1],r[1],this.minSpaceRoughly);u&&h&&(s<a?t=0:t=1),d&&p&&(l<c?t=2:t=3),u&&p&&(a<c?t=1:t=3),d&&h&&(s<l?t=0:t=2)}return t}checkCoincidence(t,e,r,i){let[n,s]=t,[a,l]=e,c={start:!1,end:!1,startIndex:void 0,endIndex:void 0,startItem:null,endItem:null},h={start:!1,end:!1,startIndex:void 0,endIndex:void 0,startItem:null,endItem:null},u=this.flatten(r.getChildrens()),d=this.flatten(i.getChildrens());for(let p=0;p<d.length;p++){let m=d[p];m.pointIsContain(n)&&(c.start=!0,c.startItem=m,c.startIndex=p),m.pointIsContain(s)&&(c.end=!0,c.endItem=m,c.endIndex=p)}for(let p=0;p<u.length;p++){let m=u[p];if(m instanceof Array){for(let g=0;g<m.length;g++)m[g].pointIsContain(a)&&(h.start=!0,h.startItem=m[g],h.startIndex=p),m[g].pointIsContain(l)&&(h.end=!0,h.endItem=m[g],h.endIndex=p);continue}m.pointIsContain(a)&&(h.start=!0,h.startItem=m,h.startIndex=p),m.pointIsContain(l)&&(h.end=!0,h.endItem=m,h.endIndex=p)}return c.start&&!c.end&&h.start&&!h.end?this.isSSCoincidence(c,h,d)&&(c.connect=0):!c.start&&c.end&&h.start&&!h.end?this.isESCoincidence(c,h,u,d)&&(c.connect=2):c.start&&!c.end&&!h.start&&h.end?this.isSECoincidence(c,h,d)&&(c.connect=1):!c.start&&c.end&&!h.start&&h.end?this.isEECoincidence(c,h,u,d)&&(c.connect=3):c.start&&c.end&&!h.start&&!h.end?this.isSSEECoincidence(c,u)&&!i.isClose()&&(c.connect=4):!c.start&&!c.end&&h.start&&h.end?this.isSSEECoincidence(h,d)&&!i.isClose()&&(c.connect=4):c.start&&c.end&&h.start&&h.end&&u.length===d.length&&this.isSSEECoincidence(c,u)&&!i.isClose()&&(c.connect=4),c}getPrevious(t){return t.getParent().getConnect(t,!0)}getNext(t){return t.getParent().getConnect(t,!1)}isSSCoincidence(t,e,r){let i=!0;if(t.startIndex===e.startIndex){let n=e.startItem,s=r[0];do{if(!this.getPrevious(s)){if(!(s.end.equals1(n.start)||Math.abs(s.direct.cross(n.direct))<Rl&&(s.pointIsContain(n.start)||n.pointIsContain(s.end)))){i=!1;break}n=this.getPrevious(n),s=this.getNext(s);continue}if(!this.getPrevious(n)){if(!(s.start.equals1(n.end)||Math.abs(s.direct.cross(n.direct))<Rl&&(s.pointIsContain(n.end)||n.pointIsContain(s.start)))){i=!1;break}n=this.getPrevious(n),s=this.getNext(s);continue}if(!n.lineIsEqual(s)){i=!1;break}n=this.getPrevious(n),s=this.getNext(s)}while(n&&s)}else i=!1;return i}isESCoincidence(t,e,r,i){let n=!0;if(r.length-t.endIndex===e.startIndex+1){let s=e.startItem,a=i[0];do{if(!this.getPrevious(a)){if(!(a.end.equals1(s.end)||Math.abs(a.direct.cross(s.direct))<Rl&&(a.pointIsContain(s.end)||s.pointIsContain(a.end)))){n=!1;break}s=this.getNext(s),a=this.getNext(a);continue}if(!this.getNext(s)){if(!(a.start.equals1(s.start)||Math.abs(a.direct.cross(s.direct))<Rl&&(a.pointIsContain(s.start)||s.pointIsContain(a.start)))){n=!1;break}s=this.getNext(s),a=this.getNext(a);continue}if(!s.lineIsEqual(a)){n=!1;break}s=this.getNext(s),a=this.getNext(a)}while(s&&a)}else n=!1;return n}isSECoincidence(t,e,r){let i=!0;if(t.startIndex+1===r.length-e.endIndex){let n=e.endItem,s=r[r.length-1];do{if(!this.getNext(s)){if(!(s.start.equals1(n.start)||Math.abs(s.direct.cross(n.direct))<Rl&&(s.pointIsContain(n.start)||n.pointIsContain(s.start)))){i=!1;break}n=this.getPrevious(n),s=this.getPrevious(s);continue}if(!this.getPrevious(n)){if(!(s.end.equals1(n.end)||Math.abs(s.direct.cross(n.direct))<Rl&&(s.pointIsContain(n.end)||n.pointIsContain(s.end)))){i=!1;break}n=this.getPrevious(n),s=this.getPrevious(s);continue}if(!n.lineIsEqual(s)){i=!1;break}n=this.getPrevious(n),s=this.getPrevious(s)}while(n&&s)}else i=!1;return i}isEECoincidence(t,e,r,i){let n=!0;if(r.length-t.endIndex===i.length-e.endIndex){let s=e.endItem,a=i[i.length-1];do{if(!this.getNext(a)){if(!(a.start.equals1(s.end)||Math.abs(a.direct.cross(s.direct))<Rl&&(a.pointIsContain(s.end)||s.pointIsContain(a.start)))){n=!1;break}s=this.getNext(s),a=this.getPrevious(a);continue}if(!this.getNext(s)){if(!(a.start.equals1(s.end)||Math.abs(a.direct.cross(s.direct))<Rl&&(a.pointIsContain(s.end)||s.pointIsContain(a.start)))){n=!1;break}s=this.getNext(s),a=this.getPrevious(a);continue}if(!s.lineIsEqual(a)){n=!1;break}s=this.getNext(s),a=this.getPrevious(a)}while(s&&a)}else n=!1;return n}isSSEECoincidence(t,e){let r=!0,i=new Set;if(e.length===Math.abs(t.endIndex-t.startIndex)+1){let n=t.startItem,s=e[0];if(i.add(n),i.add(s),t.endIndex-t.startIndex>=0)do{if(!this.getPrevious(s)){if(!(s.end.equals1(n.end)||Math.abs(s.direct.cross(n.direct))<Rl&&(s.pointIsContain(n.end)||n.pointIsContain(s.end)))){r=!1;break}if(n=this.getNext(n),s=this.getNext(s),i.has(n)||i.has(s))break;i.add(n),i.add(s);continue}if(!this.getNext(s)){if(!(s.start.equals1(n.start)||Math.abs(s.direct.cross(n.direct))<Rl&&(s.pointIsContain(n.start)||n.pointIsContain(s.start)))){r=!1;break}if(n=this.getNext(n),s=this.getNext(s),i.has(n)||i.has(s))break;i.add(n),i.add(s);continue}if(!n.lineIsEqual(s)){r=!1;break}if(n=this.getNext(n),s=this.getNext(s),i.has(n)||i.has(s))break;i.add(n),i.add(s)}while(n&&s);else{s=e[e.length-1],i.add(s);do{if(!this.getNext(s)){if(!(s.end.equals1(n.start)||Math.abs(s.direct.cross(n.direct))<Rl&&(s.pointIsContain(n.start)||n.pointIsContain(s.end)))){r=!1;break}if(n=this.getPrevious(n),s=this.getPrevious(s),i.has(n)||i.has(s))break;i.add(n),i.add(s);continue}if(!this.getNext(s)){if(!(s.start.equals1(n.end)||Math.abs(s.direct.cross(n.direct))<Rl&&(s.pointIsContain(n.end)||n.pointIsContain(s.start)))){r=!1;break}if(n=this.getPrevious(n),s=this.getNext(s),i.has(n)||i.has(s))break;i.add(n),i.add(s);continue}if(n.lineIsEqual(s)){r=!1;break}if(n=this.getPrevious(n),s=this.getNext(s),i.has(n)||i.has(s))break;i.add(n),i.add(s)}while(n&&s)}}else r=!1;return r}};function r$(o){if(o instanceof vt||o instanceof mt){let t=o.getParent();if(t!=null&&t instanceof Ye&&t.type==="Line")return!1}else if(o instanceof ct&&!o.isClose())return!1;return!0}function ohe(o,t){if(t instanceof ct){if(t.getChildrens().every((s,a)=>t.isClose(a)))return!1;let[i,n]=o;if(i.x===n.x&&i.y===n.y)return!0}return!1}var ahe=class{constructor(t){this.shape=t;this._bbox=t.buildBBox()}bbox(){return this._bbox}},nOe=class{convertProfile(t,e,r,i=!0){let n=[];r=r||new ve("convert profile type");for(let p of t)A.publish("hasModifyPcbItem",p);let s=new Array,a=new C9,{mergedModels:l,addModels:c}=a.build(t.filter(p=>!(p instanceof ct&&p.isClose())));t.forEach(p=>{p instanceof ct&&l.includes(p)||s.push(p)}),c.forEach(p=>{s.push(p)});let h=this.groupIntersectionPls(s);for(let{layerId:p,pls:m,items:g}of h){let y=Array.from(g)[0],b=this.createPolygonsByMergePls(m,e,p,Bo(y)||void 0,y.strokeWidth);for(let P of b)gn.addOrder(P,r),r.addCommand(Te.dispatch(P,"add")),n.push(P);for(let P of g)P.isEmpty||(r.addCommand(Te.dispatch(P,"delete")),A.publish("delete",P),P.remove())}let u=new Set;for(let{items:p}of h)p.forEach(m=>u.add(m.globalIndex));let d=[];for(let p of s)u.has(p.globalIndex)||d.push(p);if(d.length&&Fn(d,(p,m)=>{if(m instanceof ct)if(m.isClose())r.addCommand(Te.dispatch(m,"modify")),m.type=e,gn.addOrder(m,r),m.fill(),A.publish("hasModifyPcbItem",m),n.push(m);else{let g=m.getEdgePolylines(),y=this.createPolygonsByMergePls(g,e,m.layerId,m.net,m.strokeWidth)[0];gn.addOrder(y,r),r.addCommand(Te.dispatch(y,"add")),r.addCommand(Te.dispatch(m,"delete")),A.publish("delete",m),m.remove(),n.push(y)}else(m instanceof nr||m instanceof Sr)&&(r.addCommand(Te.dispatch(m,"modify")),m.type=e,gn.addOrder(m,r),m.fill(),A.publish("hasModifyPcbItem",m),n.push(m))}),e=="Copper Region"&&A.publish("rebuildConnectCopper",n.map(p=>p.globalIndex)),r.length&&i){let p=new mi;p.addGroup(r),p.checkOutlines(n),A.publish("flushSelectingInfo","")}return n}convertCopperResult2FillRegion(t,e=!1,r){if(t.length<=0)return[];let i=r||new ve("convert to fill region"),n=[],s=new Kc;for(let a=0;a<t.length;a++){let l=t[a],c=l.getParent(),h=c.layerId,u=c.net,d=c.locked,p=qu(-1,"Fill Region"),m=[];if(l.style==="solid"){let g=new Gt(l.getOutline()),y=g.getOutMostPolyline(),b=g.items.filter(_=>_!=y),P=l.getRealOutline().filter(_=>!g.items.includes(_)).map(_=>[_]),T=[[y,...b],...P],I=s.getUnionForSingle(T,T.map(_=>2)),C=new Array;for(let _ of I)for(let R of _.items)R.isClose()&&C.push(R);let O=new au().create4Pls("Fill Region",h,C,p,u,d);O.fill(),i.addCommand(Te.dispatch(O,"add")),n.push(O)}else if(l.style==="45grid"||l.style==="90grid"){let g=l.getRealOutline(),y=new au;g.forEach(b=>{let P=y.create4Pl("Fill Region",h,b,p,u,d);P.fill(),i.addCommand(Te.dispatch(P,"add")),n.push(P)})}!e&&!ce.pcbConfig.isRebuildCopperAuto&&(i.addCommand(Te.dispatch(l,"delete")),A.publish("delete",l),l.remove())}return i.length&&!r&&(je.executeCommand(i),A.publish("flushService",""),A.publish("flushSelectingInfo","")),n}filterHasInsideBoundaryInCopperResults(t){let e=[];for(let r=0;r<t.length;r++){let i=t[r];i.getRealOutline().length>=2&&i.style==="solid"||e.push(i)}return e}createPolygonsByMergePls(t,e,r,i="",n=1){let s=[],a=nC(t),l=new Array;for(let h of a)(!pd(e)||h.isClose())&&l.push(h);let c=new au;for(let h of l){let u=c.create4Pl(e,r,h,n,i,!1);u.fill(),s.push(u)}return s}isNeedSegmentLine(t){return!(t==="Line"||t==="Board Outline"||t==="Slot Region"||t==="3D Shell - Outline"||t==="3D Shell - Side Slot Region"||t==="3D Shell - Top Slot Region")}groupIntersectionPls(t){let e=[],i={};for(let a of t){let l=a.layerId,c=i[l];if(c||(c=new Mb(10),i[l]=c),a instanceof ct&&!a.isClose()){let h=a.getChildrens();for(let u of h)for(let d of u)c.add(new ahe(d))}else c.add(new ahe(a))}let n=new Map;function s(a,l){let c=n.get(a);c==null&&(c=new Set,n.set(a,c)),c.add(l)}for(let a of Object.keys(i)){let l=new Map,c=i[a];for(let h of c.itemList){let u=h.shape;if(l.has(u))continue;let d=[h],p={layerId:+a,pls:[],items:new Set};l.set(u,p);let m=n.get(h);for(;d.length>0;){let g=d.shift();m=n.get(h),u=g.shape;let y=this.getMathGraphics(u);p.items.add(this.getAssociationItem(u)),y instanceof Gt?p.pls.push(...y.items):p.pls.push(y);for(let b of c.search(h.bbox())){if(m!=null&&m.has(b))continue;let P=b.shape;if(l.has(P))continue;let T=this.getMathGraphics(P),{relation:I}=y.primitives.length<T.primitives.length?new fc(y,T,0):new fc(T,y,0);I==0?(d.push(b),l.set(P,p)):(s(g,b),s(b,g))}}}e.push(...new Set(l.values()))}return e.filter(a=>a.items.size>1)}getAssociationItem(t){return t instanceof mt||t instanceof vt?t.getParent():t}getMathGraphics(t){if(t instanceof Le)if(gr(t.layerId)){if(t instanceof Ri)return t.getMathGraphics(1);if(t instanceof fn)return t.getMathGraphics()}else return t.getMathGraphics();else return t.getMathGraphics()}},V_=new nOe;function dje(o){if(!x.getInstance().isactive)return;let t=Ve.getSelects().filter(n=>n instanceof Ye&&["Fill Region","FPC Stiffener"].includes(n.type)&&n instanceof ct&&n.isComplexPolygon()),e=Ve.getSelects().filter(n=>!t.includes(n)),{newPolygons:r,groupCommand:i}=iN(t);nN(o,e,i),r.forEach(n=>nN(o,[n],i))}function pje(o){let{cmd:t}=typeof o=="string"?{cmd:o}:o;if(Ve.getSelects().filter(r=>r instanceof Ye&&["Fill Region","FPC Stiffener"].includes(r.type)&&r instanceof ct&&r.isComplexPolygon()).length>0&&!["CONVERT_TO_FILL_REGION","CONVERT_TO_FPC_STIFFENER"].includes(t)){let r;switch(t){case"CONVERT_TO_2D_LINE":r="Line";break;case"CONVERT_TO_BOARD_OUTLINE":r="Board Outline";break;case"CONVERT_TO_CONSTRAINT_REGION":r="Constraint Region";break;case"CONVERT_TO_COPPER_REGION":r="Copper Region";break;case"CONVERT_TO_SLOT_REGION":r="Slot Region";break;case"CONVERT_TO_PROHIBITED_REGION":r="Prohibited Region";break;case"CONVERT_TO_PAD":r="Pad";break;case"CONVERT_TO_D3_SHELL_OUTLINE":r="3D Shell - Outline";break;case"CONVERT_TO_D3_SHELL_SLOT_REGION":r="3D Shell - Slot Region";break;case"CONVERT_TO_D3_SHELL_ENTITY":r="3D Shell - Entity";break}A.publish("confirmSplitWhenConvertPolygon",{type:r,cmd:o},$())}else nN(o,Ve.getSelects())}function nN(o,t,e){let{cmd:r,isOnlyProfile:i=!1}=typeof o=="string"?{cmd:o}:o,n=_P(t.slice());switch(i&&(n=n.filter(a=>a instanceof Ye)),n=n.map((a,l)=>[a.buildBBox().center(),l]).sort((a,l)=>a[0].x!=l[0].x?a[0].x-l[0].x:a[0].y-l[0].y).map(a=>n[a[1]]),r){case"CONVERT_TO_TRACK":{e=e||new ve("conver2Track lines length is"+n.length),A.publish("clearSelect","");let a=[];for(let l of n){let c=l,h=gs(be.getLayer(l.layerId).type)?l.layerId:1;if(c.type=="Line"){let u=c.getMathGraphics().primitives;e.addCommand(Te.dispatch(c,"delete")),A.publish("hasModifyPcbItem",c),c.remove(),A.publish("delete",c);for(let d of u){let p;if(d instanceof M)p=pr.addTrack(h,d.start(),d.end(),c.strokeWidth,!1,c.net);else if(d instanceof q){let m=Ht.toRadians(d.startAngle),g=Ht.toRadians(d.endAngle());p=pr.addArcTrack(h,d.center,d.rx,m,g,d.sweep(),c.strokeWidth,!1,c.net)}a.push(p),e.addCommand(Te.dispatch(p,"add")),A.publish("hasModifyPcbItem",p)}}}A.publish("onlySelect",a),e.length&&(je.executeCommand(e),A.publish("flushService",""));break}case"CONVERT_TO_PAD":{e=e||new ve("conver2pad lines length is"+n.length);let a={num:0};A.publish("clearSelect","");let l=n[0],c=r0.getNumberManager().getMaxNum();if(n.length===1&&n[0]instanceof ct&&!l.isClose()){let h=l.getEdgePolylines(),d=nC(h)[0],p=0,m=!0,g=new Sm(d.primitives),y=be.getLayer(l.layerId).type,b=l.layerId;y!="TOP"&&y!="BOTTOM"&&y!="MULTI"&&(b=1);let P=Kt.addPolygonPad(b,(c++).toString(),g.center,p,d,l.net||"",!1,1,.4,.4,.4,[],m,g.high*.6,g.high*.3,"ROUND",0,rt.defalutPad.holeOffset);A.publish("onlySelect",P),e.addCommand(Te.dispatch(P,"add")),e.addCommand(Te.dispatch(l,"delete")),A.publish("hasModifyPcbItem",l),l.remove(),A.publish("delete",l),a.num=1}else bRt(n,e,a,c);e.length&&(je.executeCommand(e),A.publish("showPcbSlideMsg",["{0} pad convert completed",[a.num]],$()),A.publish("flushService",""));break}case"CONVERT_TO_2D_LINE":{n.every(l=>l instanceof Ue)?yRt(n,e):S9(n,"Line",e);break}case"CONVERT_TO_BOARD_OUTLINE":{S9(n,"Board Outline",e);break}case"CONVERT_TO_CONSTRAINT_REGION":{S9(n,"Constraint Region",e);break}case"CONVERT_TO_COPPER_REGION":{S9(n,"Copper Region",e);break}case"CONVERT_TO_SLOT_REGION":{S9(n,"Slot Region",e);break}case"CONVERT_TO_FILL_REGION":{S9(n,"Fill Region",e);break}case"CONVERT_TO_PROHIBITED_REGION":{S9(n,"Prohibited Region",e);break}case"CONVERT_TO_D3_SHELL_OUTLINE":{S9(n,"3D Shell - Outline",e),A.windowBridge.publish("/ui/promptToOpen3DViewWindow",[x.getInstance().tabId],$());break}case"CONVERT_TO_D3_SHELL_SLOT_REGION":{S9(n,"3D Shell - Top Slot Region",e),A.windowBridge.publish("/ui/promptToOpen3DViewWindow",[x.getInstance().tabId],$());break}case"CONVERT_TO_D3_SHELL_ENTITY":{S9(n,"3D Shell - Top/Bottom Entity",e),A.windowBridge.publish("/ui/promptToOpen3DViewWindow",[x.getInstance().tabId],$());break}case"CONVERT_TO_FPC_STIFFENER":{A.publish("checkOpenStiffenerLayer",""),S9(n,"FPC Stiffener",e);break}default:}}function yRt(o,t){t=t||new ve("converTrack2Profile"+o.length);let e=new Set,r=new Set;A.publish("clearSelect","");for(let n of o)r.add(n.globalIndex);let i=[];for(let n of o){if(e.has(n.globalIndex))continue;let s=xt.getInstance().getListNode(n.model),a=[s.item],l=s,c=s.item.width;for(;l&&(l.prev&&r.has(l.prev.item.globalIndex)&&ne.eq(c,l.prev.item.width));)l=l.prev,a.unshift(l.item);let h=s;for(;h&&(h.next&&r.has(h.next.item.globalIndex)&&ne.eq(c,h.next.item.width));)h=h.next,a.push(h.item);let u=[];for(let m of a)e.add(m.globalIndex),u.push(m.primitive);let p=new au().create4Pts("Line",s.item.layerId,u,s.item.width,s.item.net,!1);t.addCommand(Te.dispatch(p,"add")),A.publish("hasModifyPcbItem",n),i.push(p)}i.length>0&&A.publish("onlySelect",i);for(let n of o)t.addCommand(Te.dispatch(n,"delete")),A.publish("hasModifyPcbItem",n),n.remove(),A.publish("delete",n);t.length&&(je.executeCommand(t),A.publish("flushService",""))}function S9(o,t,e){let r=[],i=[],n=[];o.forEach(a=>{a instanceof ii?i.push(a):r.push(a)});let s=V_.convertProfile(r,t,e);if(t==="Fill Region"){let a=V_.convertCopperResult2FillRegion(i);s.push(...a)}return s.length&&A.publish("onlySelect",s),s}function bRt(o,t,e,r){let i={};o.forEach(u=>{h(i,u.layerId,u)});let n=[];for(let[u,d]of Object.entries(i)){u=Number(u);let p=new C9;p.build(d,()=>{let m=new Map;for(let y of p.result)m.set(y,y.getMathGraphics());let g=new Array;for(let y=0;y<p.result.length;y++){let b=p.result[y];for(let P=y+1;P<p.result.length;P++){let T=p.result[P];if(g.some(C=>C.has(b)&&C.has(T)))continue;if(new Fs(m.get(b),m.get(T),0).relation==0){let C=g.find(E=>E.has(b)||E.has(T));C?(C.add(b),C.add(T)):g.push(new Set([b,T]))}}}p.result.forEach(y=>{g.some(b=>b.has(y))||s(y)}),g.forEach(y=>a([...y],m));for(let y of p.result)if(!(!(y instanceof ct)||y.isEmpty)&&!y.isClose()){let b=y.getEdgePolylines(),T=nC(b)[0],I=0,C=!0,E=new Sm(T.primitives),O=be.getLayer(y.layerId).type,_=y.layerId;O!="TOP"&&O!="BOTTOM"&&O!="MULTI"&&(_=1);let R=Kt.addPolygonPad(_,(r++).toString(),E.center,I,T,"",!1,1,.4,.4,.4,[],C,E.high*.6,E.high*.3,"ROUND",0,rt.defalutPad.holeOffset);t.addCommand(Te.dispatch(R,"add")),t.addCommand(Te.dispatch(y,"delete")),y.remove(),A.publish("delete",y),e.num++,n.push(R)}}),n.forEach(m=>{m.click()}),A.publish("select",n),A.publish("flushSelectingInfo","")}function s(u){let d=be.getLayer(u.layerId).type,p=u.layerId;if(d!="TOP"&&d!="BOTTOM"&&d!="MULTI"&&(p=1),u instanceof nr){let m=u.getUL().add(u.getLR()).mul(.5),g=u.rotation,y=!0,b=u.realCornerRadius/Math.min(u.width,u.height)*2,P=Kt.addPad(p,1,(r++).toString(),m,"RECT",u.width,u.height,b,"RECT",u.width,u.height,b,"RECT",u.width,u.height,b,g,!1,u.net,1,rt.defalutPad.pasteExpansion,rt.defalutPad.topSolderExpansion,rt.defalutPad.bottomSolderExpansion,[],y,Math.min(u.width,u.height)*.6,Math.min(u.width,u.height)*.3,rt.defalutPad.holeShape,rt.defalutPad.holeRotation,rt.defalutPad.holeOffset);l(t,u,P),u.remove(),e.num++,n.push(P)}else if(u instanceof Sr){let y=Kt.addPad(p,1,(r++).toString(),u.center,"ELLIPSE",u.radius*2,u.radius*2,0,"ELLIPSE",u.radius*2,u.radius*2,0,"ELLIPSE",u.radius*2,u.radius*2,0,0,!1,u.net,1,rt.defalutPad.pasteExpansion,rt.defalutPad.topSolderExpansion,rt.defalutPad.bottomSolderExpansion,[],!0,u.radius*1.2,u.radius*.6,rt.defalutPad.holeShape,rt.defalutPad.holeRotation,rt.defalutPad.holeOffset);l(t,u,y),u.remove(),e.num++,n.push(y)}else if(u instanceof ct&&u.isClose()){let m;if(c(u)){let g=_s([u]),y,b;g.valid()&&(b=g.build1(),y=b.center()),m=Kt.addPad(u.layerId,1,(r++).toString(),y,"OVAL",b.width(),b.height(),0,"OVAL",b.width(),b.height(),0,"OVAL",b.width(),b.height(),0,0,!1,u.net,1,rt.defalutPad.pasteExpansion,rt.defalutPad.topSolderExpansion,rt.defalutPad.bottomSolderExpansion,[],!0,Math.min(b.width(),b.height())*.6,Math.min(b.width(),b.height())*.3,rt.defalutPad.holeShape,rt.defalutPad.holeRotation,rt.defalutPad.holeOffset)}else{let g=u.primitives,y=0,b=!0,P=new Sm(g);m=Kt.addPolygonPad(u.layerId,(r++).toString(),P.center,y,fe.build2(g),u.net,!1,1,.4,.4,.4,[],b,P.high*.6,P.high*.3,"ROUND",0,rt.defalutPad.holeOffset)}l(t,u,m),u.remove(),e.num++,n.push(m)}}function a(u,d){u=u.filter(T=>!(T instanceof ct&&!T.isClose()));let p=be.getLayer(u[0].layerId).type,m=u[0].layerId;p!="TOP"&&p!="BOTTOM"&&p!="MULTI"&&(m=1);let g=u.map(T=>d.get(T)),y=nC(g),b=new Array;for(let T of y)T.isClose()&&b.push(T);e.num+=b.length,b=b.map((T,I)=>[new _e().ext1(T.bbox()).build1().center(),I]).sort((T,I)=>T[0].x!=I[0].x?T[0].x-I[0].x:T[0].y-I[0].y).map(T=>b[T[1]]),b.forEach(T=>{let I=0,C=!0,E=new Sm(T.primitives),O=Kt.addPolygonPad(m,(r++).toString(),E.center,I,T,u[0].net,!1,1,.4,.4,.4,[],C,E.high*.6,E.high*.3,"ROUND",0,rt.defalutPad.holeOffset);t.addCommand(Te.dispatch(O,"add")),n.push(O)}),u.forEach(T=>{t.addCommand(Te.dispatch(T,"delete")),T.remove(),A.publish("delete",T)})}function l(u,d,p){u.addCommand(Te.dispatch(d,"delete")),A.publish("delete",d),A.publish("hasModifyPcbItem",d),u.addCommand(Te.dispatch(p,"add"))}function c(u){let d=new C9,p=[],m=[],g=[];function y(P){p.forEach(T=>{T.remove(),pt.delete(T)})}if(u.getAllChildrens().forEach(P=>{if(P instanceof vt&&(m.push(Math.floor(P.radius)),g.push(P)),P instanceof mt&&P.length>1e-8){let T=pt.addPolygon(u.type,P.layerId,[[P]],P.width,"",P.locked);p.push(T)}}),m=Array.from(new Set(m)),m.length!==1)return y(p),!1;let b=!1;return d.build(p,(P,T)=>{if(T.length===2&&P.length===p.length){let I=T[0].getChildrens()[0].start,C=T[0].getChildrens()[T[0].getChildrens().length-1].end,E=T[1].getChildrens()[0].start,O=T[1].getChildrens()[T[1].getChildrens().length-1].end;if(T.forEach(R=>R.remove()),Hte(I,C,E,O))return y(p),!1;let{d:_}=d8e(I,E,O);_===m[0]*2&&(b=!0)}}),y(p),b}function h(u,d,p){lY(u,d,()=>[p],(m,g,y)=>(y.push(p),y))}}var oN,gje=Di.convert(.1,39.37,10);function DG(o){let{type:t,targetIds:e,expansion:r,clearCache:i,checkingFPCNeedAvoid:n}=o||{},s=xh(r),a=!n;if(i){oN=null;return}if(s&&oN){fje(oN,r),oN=null;return}oN=null;let l=[];e&&e.length>0?e.forEach(p=>{let m=W1(p);l.push(m)}):n?l=ZS():l=Ve.getSelects();let c=sOe(l,n);if(c.some(p=>p.locked)&&!n){a&&CRt();return}let u=PRt(c,t,n);if(!u||u.size==0){a&&yje();return}let d=Array.from(u.keys());return n?(oN=u,d):(s?fje(u,r):(oN=u,IRt(o)),d)}function fje(o,t){let e=!1,r=new Kc,i=new ve("Cutout to avoid"),n=new au,s=[];if(o.forEach((a,l)=>{let c=W1(l);if(!c)return;let h=c.getMathGraphics(),u=c.getGroupID(),d=mje(h),p=null,m=a.length;if(a.some((g,y)=>{if(d.length==0)return!0;let b=mje(g);if(t!=0){let T=[];b.forEach(I=>{let C=AT.zoomPolygon(I,t);C&&T.push(C)}),b=T}if(b.length==0)return!0;let P=r.getSubtraction(d,b);return y==m-1?p=P:(d=[],P.forEach(T=>{d=d.concat(T.items)})),!1}),!!p){if(i.addCommand(Te.dispatch(c,"delete")),c.remove(),ie.publish("delete",c),p.length>0){let g=c.type,y=c.layerId,b=c.net,P=c.strokeWidth,T=m_([c]);p.forEach((I,C)=>{let E=n.create4PlGrp(g,y,I,P,b,!1);if(u&&(kt.joinCombination([E],u),E.setGroupID(u)),g=="FPC Stiffener"||g=="Fill Region"&&T){let O=JSON.stringify(c.getComponent());new Nl(O,g).rebuildComponent(E)}i.addCommand(Te.dispatch(E,"add")),E.click(),s.push(E)})}e=!0}}),e)s.length>0&&ie.publish("onlySelect",s),ie.publish("autoFill",""),ie.publish("updateRtree",""),i.length>0&&je.executeCommand(i);else return yje();return gje=t,SRt()}function sOe(o,t){return o.filter(e=>{if(e instanceof Ye){let r=e.type;return t?r=="FPC Stiffener":r=="FPC Stiffener"||r=="Fill Region"}return!1})}function oOe(o){let t=12;return G2(o)?t=1:ms(o)?t=2:Ms(o)&&(t=15),t}function PRt(o,t,e=!1){if(!o||o.length==0)return null;let r=new Set;o.forEach(s=>{let a=s.layerId,l=oOe(a);r.add(l)});let i=TRt(t,r,e),n=new Map;return i.size>0&&o.forEach(s=>{let a=s.layerId,l=oOe(a),c=i.get(l)||[],h=l!=12?i.get(12)||[]:[],u=c.concat(h);if(u.length>0){let d=s.globalIndex,p=s.getMathGraphics(),m=0,g=new e8,y;u.forEach(b=>{g.check(p,b,m)&&(y||(y=[],n.set(d,y)),y.push(b))})}}),n}function TRt(o,t,e=!1){let r=new Map;if(o=="avoidSlots"||e){let i=ZS(),n=[],s=[];i.forEach(u=>{let d=u.layerId;if(u.type=="Slot Region"){let m=u.getMathGraphics();i$(m,n)}else d==11&&s.push(u)});let a=new _e,l=[],c=[];if(s.forEach(u=>{a.ext1(u.buildBBox());let d=u.getMathGraphics();if(d.isClose())l.push(d);else{let p=u.strokeWidth;d.primitives.forEach(g=>{c.push(g.stroke(p,kr.ROUND,le.CCW))})}}),l.length>1){let u=l.sort((d,p)=>d.bbox().area()-p.bbox().area());u.pop(),u.forEach(d=>{n.push(d)})}c.forEach(u=>{n.push(u)}),iw().forEach(u=>{if(u.layerId==12){let p=u.getMathGraphics(47);i$(p,n)}}),n.length>0&&r.set(12,n)}if(o=="avoidPads"||e){let i=iw();t.forEach(a=>{r.set(a,[])});let n=t.has(1),s=t.has(2);i.forEach(a=>{let l=a.layerId,c=oOe(l),h=r.get(c);if(l==1&&n){let u=a.getMathGraphics(l);i$(u,h)}else if(l==2&&s){let u=a.getMathGraphics(l);i$(u,h)}else l==12&&t.forEach(u=>{let d=a.getMathGraphics(u),p=r.get(u);i$(d,p)})}),r.forEach((a,l)=>{a.length==0&&r.delete(l)})}return r}function IRt(o){let t=x.getInstance(),e={expansion:gje,canvasUnitName:t.unit,...o};ie.publish("openMainDialog",{cmd:50,data:e})}function CRt(){ie.publish("ui/toastMsg",{type:"error",msg:"Locked objects found, please try again after unlock"},$())}function yje(){ie.publish("ui/toastMsg",{type:"error",msg:"Cutout failed. Please check and try again."},$())}function SRt(){ie.publish("ui/toastMsg",{type:"success",msg:"Cutout operation complete. Please inspect the resulting geometry."},$())}function i$(o,t){return o&&(t||(t=[]),t.push(o)),t}function mje(o,t){return o&&(t||(t=[]),o instanceof fe?t.push(o):o.items.forEach(e=>{t.push(e)})),t}var lhe=class{constructor(){this.autoSave=!1;this.debugInfo=new Array;this.workerManager=pf.getInstance();this.logger=new Gi(1);this.buildingCopperMap=new Set;this.tearDropWorker=null;new Fse,new eae,new Qce,new iae,new rae,new oae,new lce,A.subscribe("dynamicCopperResultFromWorker",i=>{RC.getInstance().handleDynamicCopperResult(i)}),A.subscribe("dynamicCopperCalTimeFromWorker",i=>{RC.getInstance().handleDynamicCopperCalTime()}),A.subscribe("openReuseTemplateDialog",()=>{let i=new Bse;A.publish("openDialog",i)}),A.subscribe("getPcbInfo",()=>{if(!x.getInstance().isactive||x.getInstance().doctype!==3)return;let i=new RD;A.publish("openPCBInfomationDlg",JSON.stringify(i),$())}),A.messageBus.rpcService("sensorsGetPcbInfo",i=>{if(!x.getInstance().isactive||x.getInstance().doctype!==3)return;if(i==="3DInfo")return bUe();let n=new RD,s=!!Ii.offset;return{...n,is_panelize:s}}),A.messageBus.rpcService("pcbOrderGetPcbInfo",()=>new Promise((i,n)=>{if(!x.getInstance().isactive||x.getInstance().doctype!==3)return;let s=new RD,a=Ii.outerBBox,l,c;if(a)l=(a.maxX-a.minX)*10,c=(a.maxY-a.minY)*10,l=ka(Di.convert(l,1,39.37),3),c=ka(Di.convert(c,1,39.37),3);else{let[u,d]=JSON.parse(JSON.stringify(s)).info.BoardSize.split("x");l=parseFloat(u),c=parseFloat(d),x.getInstance().unit=="mil"&&(l=ka(Di.convert(l,1,39.37),3),c=ka(Di.convert(c,1,39.37),3))}i({...s,...{outerBBoxW:l,outerBBoxH:c}})})),A.messageBus.rpcService("placeDevice",i=>new Promise(async n=>{if(!x.getInstance().isactive||x.getInstance().doctype!==3)return;let s=x.getInstance().compilerChannel,a=await Ji.add(i.footprint.uuid,s);if(a.isEmpty()){A.publish("ui/toastMsg",{type:"error",msg:{value:"Footprint {package_name} has no content",options:{package_name:a.id}}},$()),n({success:!1});return}let l=await this.parseDevice(i.device.uuid);A.publish("toggle",{command:"placeComponent",device:l,source:i.device.source}),n({deviceItemId:l.uuid,success:!0})})),A.subscribe("toggleRealTimeDRC",()=>{!x.getInstance().isactive||23==x.getInstance().doctype||che(!ah.switch)}),A.subscribe("DesignRuler",this.openDesignRuleDialog.bind(this)),A.subscribe("pcbBatchFanout",this.openBatchFanoutDialog.bind(this)),A.subscribe("EditPadsPairGroupDialog",this.openEditPadsPairGroupDialog.bind(this)),A.subscribe("insertImage",this.insertImage.bind(this)),A.subscribe("autoPlaceTestPad",this.openAutoPlaceTestPadDialog.bind(this)),A.subscribe("deleteDevice",i=>{let n=ps.getItem(i);n!=null&&ps.delete(n)},$()),A.subscribe("copperAreaManagerDialog",this.openCopperDialog.bind(this)),A.subscribe("padLenManageDialog",this.openPadLenDialog.bind(this)),A.subscribe("buttomCommand",this.buttonCommand.bind(this),$()),A.subscribe("viaFenceManageDialog",()=>{!x.getInstance().isactive||x.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:12,data:{}})}),A.subscribe("rebuildCopperRegionDialog",i=>{ce.pcbConfig.isRebuildCopperAuto&&!i.isManual||A.publish("rebuildCopperRegionDialog",i.msg,$())}),A.subscribe("rebuildPlanezone",this.rebuildPlanezone.bind(this)),A.subscribe("rebuildCopper",this.rebuildCopper.bind(this)),A.subscribe("rebuildSingleCopper",this.rebuildSingleCopper.bind(this)),A.subscribe("RebuildCopperResult",this.RebuildCopperResult.bind(this)),A.subscribe("copperResult",this.buildCopper.bind(this)),A.subscribe("rebuildPlane",i=>{if(ce.pcbConfig.isRebuildCopperAuto&&!(i!=null&&i.isManual)||!x.getInstance().isactive||x.getInstance().doctype!=3||be.getAllPlaneLayer().length==0)return;Mn.getInstance().allowPull=!1,this.rebuildPlaneLayerObserver=null;let n=new e$([],!0),s=this.workerManager.addWorker(`editor?entry=pcb-worker.js${$().location.search.replace(/\?/,"&")}`),a=JSON.stringify(n.encode());function l(c,h){s.rpcCall("planeDocument",c).then(u=>{h.buildPlaneCopper(u.message,!ce.pcbConfig.isRebuildCopperAuto),Mn.getInstance().allowPull=!0})}l(a,this)});let t=new Ase(this.workerManager);A.subscribe("rebuildSinglePlane",i=>{let n,s=!1;if(i instanceof Array?n=i:(s=i.isManual,n=i.message),!(ce.pcbConfig.isRebuildCopperAuto&&!s)&&!(!x.getInstance().isactive||x.getInstance().doctype!=3||be.getAllPlaneLayer().length==0)&&(this.rebuildPlaneLayerObserver=new Set(n),Mn.getInstance().allowPull=!1,n.length>0)){let h=function(u,d){l.rpcCall("planeDocument",u).then(p=>{d.buildPlaneCopper(p.message,!ce.pcbConfig.isRebuildCopperAuto),Mn.getInstance().allowPull=!0})},a=new e$(n,!1),l=this.workerManager.addWorker(`editor?entry=pcb-worker.js${$().location.search.replace(/\?/,"&")}`),c=JSON.stringify(a.encode());h(c,this),c=null}}),A.subscribe("clearSinglePlane",i=>{!x.getInstance().isactive||x.getInstance().doctype!=3||i.forEach(n=>{Qn.layerMapSet[n].forEach(a=>{a.remove(),A.publish("delete",a)}),x.getInstance().compiler.setTicket(),x.getInstance().compiler.deleteLayerFill(n)})}),A.subscribe("docNeedUpdate",this.docNeedUpdate.bind(this)),A.subscribe("clearAllRoute",i=>hhe(i)),A.subscribe("openTearDrop",this.tearDropDialog.bind(this)),A.subscribe("toggleElementFilter",this.toggleElementFilter.bind(this)),A.messageBus.rpcService("pcb/getNetList",async i=>Cr.generateNetList(i==null?void 0:i.uniqueIdKey,i==null?void 0:i.autoUniqueId)),A.subscribe("pcb/partSourseStr2Canvas",async i=>{if(!(!x.getInstance().isactive||x.getInstance().doctype!==3))try{await xD.getInstance().partDxf(i),A.publish("toggle",{command:"importDxf"})}catch(n){this.logger.error2(n)}}),A.subscribe("deleteElementDialog",()=>{!x.getInstance().isactive||x.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:4})}),A.subscribe("open2DlineWornDialog",()=>{!x.getInstance().isactive||x.getInstance().doctype!==3||Cse.getInstance().open()}),A.subscribe("needUpdateFootprint",this.needUpdateFootprint.bind(this),$()),new Ise,A.messageBus.rpcService("checkFormatBeforeGerber",RYe),A.messageBus.rpcService("checkTrueColorPicture",D3e),A.messageBus.rpcService("checkTrueColor",AYe),A.messageBus.rpcService("checkRatlineBeforeGerber",_Ye),A.messageBus.rpcService("checkDrcBeforeGerber",xYe),A.messageBus.rpcService("checkBorderBeforeGerber",vYe),A.messageBus.rpcService("checkFpcNeedToAvoid",i=>(i=Object.assign({checkingFPCNeedAvoid:!0},i||{}),DG(i))),A.messageBus.rpcService("setCoordToOriginLowerRightCorner",DYe),A.messageBus.rpcService("exportGerber",async i=>await yYe(i).catch(n=>({error:(n==null?void 0:n.message)||n}))),A.messageBus.rpcService("getExportGeberAttachmentData",i=>TG(i).then(async n=>{if(!n)return;let s=await MC(n.blob);return delete n.blob,{fileInfo:n,...s}}).catch(n=>({error:(n==null?void 0:n.message)||n}))),A.messageBus.rpcService("getNewAutoRouteJson",i=>AP.autoRouting(i,!0)),A.messageBus.rpcService("getNewAutoRouteJsonForJR",i=>AP.autoRoutingForJR(i)),A.messageBus.rpcService("importNewAutoLayoutJson",async i=>t.importLayoutResult2(i)),A.messageBus.rpcService("getNewAutoLayoutJson",async()=>await t.autoLayouting2(!0)),A.messageBus.rpcService("exportOdb",async i=>await LEe(i).then(n=>{if(!n)return;let s=n.fileName,a=n.blob;if(a){let c=s.match(/\.([^.]+)$/),h="";c&&(h=c[1]),i.isZip?h!="zip"&&(s=s+".zip"):h!="tgz"&&(s=s+".tgz"),ip.downloadFile(s,a)}let l=n.jsonFile;return l&&ip.downloadFileASCII(s.replace(/\.([^.]+)$/,".json"),l),n}).catch(n=>({error:(n==null?void 0:n.message)||n}))),A.messageBus.rpcService("exportOdbData",async i=>await LEe(i).then(async n=>{if(!n)return;let s=n.fileName,a=n.blob;if(a){let l=await MC(a);return{fileInfo:i,data:l.data,error:null}}return n}).catch(n=>({error:(n==null?void 0:n.message)||n}))),A.messageBus.rpcService("pcb_IPC-D-356A",async i=>WYe(i)),A.messageBus.subscribe("pcb/set-project-permission",async i=>{let{disable:n}=i;x.getInstance().isReadOnlyMode=n,Bf.getInstance().refreshLayerPanel(),Y3(!1),we.synchronize(),A.publish("flushSelectingInfo","")}),A.messageBus.subscribe("pcb/adaptAll",i=>{A.publish("adaptAll",i)}),A.messageBus.subscribe("createAnnotation",i=>{Lo.getInstance().getAuthority()&&Lo.getInstance().getNeedAnnotation()&&(Lo.getInstance().hasConnectItem()?Lo.getInstance().createAnnotationByItems():A.messageBus.publish("tool","draw(annotation)"))}),A.messageBus.subscribe("changeShowCanvasAnnotation",i=>{$t.setVisible(38,i.show),A.publish("updateFrame","")}),A.messageBus.rpcService("exportGerberData",async i=>await PYe(i).catch(n=>({error:(n==null?void 0:n.message)||n}))),A.messageBus.rpcService("gerberLayerConfig",()=>new Promise((i,n)=>{let s=[],a=be.getAllLayer(),l=[12,47,52,48,49,50,51,53,54,55,56,57],c=[],h=[];for(let d=15;d<=46;d++)c.push(d);for(let d of a)if(!l.includes(d.layerID)){let p={layerId:d.layerID,layerType:d.type,layerName:d.name,status:d.layerStatus};c.includes(d.layerID)?h.push(p):s.push(p)}let u=s.findIndex(d=>d.layerId==2);s.splice(u,0,...h),i(s)})),A.subscribe("Find",i=>{A.publish("showFindItemInBottomBar",{selectFirstRow:!1,doNotShowTable:!0,data:E9.objMatched("Component",[],[{attrName:"Designator",mode:"equal",attrValue:i[1]}])},$())}),A.messageBus.rpcService("getAllDeviceKey",this.getAllDeviceKey.bind(this)),A.messageBus.rpcService("getBomInfo",this.getBomInfo.bind(this)),A.subscribe("printPaths",i=>{for(let n of i){let s=new Sse(n);this.debugInfo.push(s)}}),A.subscribe("hiddenDebug",this.hiddenDebug.bind(this)),A.subscribe("showDebug",this.showDebug.bind(this)),A.subscribe("rebuildDRC",i=>{if(!x.getInstance().isactive||x.getInstance().doctype!=3)return;Mn.getInstance().allowPull=!1;let n=new Ese().shapes,s=te.getInstance().getMaxSafe();this.workerManager.addWorker(`editor?entry=pcb-worker.js${$().location.search.replace(/\?/,"&")}`).publish("DRCDocument",JSON.stringify({shapes:n,ids:i,maxClearance:s}))}),A.subscribe("/worker/teardrop/progress/onclose",()=>{this.tearDropWorker&&(this.tearDropWorker.discard(),this.tearDropWorker=null)},$()),A.subscribe("addTearDrop",async i=>{if(!(!x.getInstance().isactive||x.getInstance().doctype!=3))if(i.useWorker){Mn.getInstance().allowPull=!1;let n=new xC().encode();this.tearDropWorker=this.workerManager.addWorker(`editor?entry=pcb-worker.js${$().location.search.replace(/\?/,"&")}`),i.world=n,this.tearDropWorker.publish("addTearInWorker",i)}else{i.mapData=SVe();let n=new Qle(i),s=await new Promise(l=>l(null)).then(()=>n.addTearDrop()),a=i;a.tears=s,A.publish("tearDropResult",a)}}),A.subscribe("tearDropResult",i=>{var c;console.log(1111111111111,"tearDropResult",i),this.workerManager.deleteWorker(i.workerName),Mn.getInstance().allowPull=!0,this.tearDropWorker=null;let n=new ve("add tear drop"+i.applyScope),s=i.addTeardropAutomatically,a=(c=i.tears)==null?void 0:c.map(h=>{let u=Yb(h.tear);if(!xu(u.primitives)||!Bt.checkIsInCanEdit(u.primitives))return;let d=pt.addPolygon("TearDrop",h.layer,[],.001,h.net,!1,u);if(d.fill(),new Nl(JSON.stringify({connects:h.globalIndex}),d.type).modifyComponent(d),d)return d}).filter(Boolean),l;if(!i.ignoreDRC){new iG().realtimeCheckItemsIgnoreSwitch(a);let u=pi.getInstance();l=u.hasSafeErrorIgnoreCopper.bind(u)}for(let h of a)if(l&&l(h.globalIndex))h.remove(),A.publish("delete",h);else{let u=Te.dispatch(h,"add");s&&je.stack!==null?je.stack.addCommand(u):n.addCommand(u),A.publish("hasModifyPcbItem",h)}A.publish("flushService",""),n.length&&je.executeCommand(n)}),A.messageBus.rpcService("batchFanout",async({items:i,config:n})=>{if(n.operationType==="Remove")return new dq().fanoutRemove(i),!0;let s=!1,a=[];if(i.forEach(d=>{(d instanceof Le||d instanceof Me&&d.getPads().length)&&(s=!0,a.push(d.model))}),!s)return!1;let l="batchFanout-time";pn(l),A.publish("progressUpdate",[.05,"batchFanout"],$());let c=new dq().getHasFanoutIds(i),h=Pze(a,n,c),u=new mi;return u.addGroup(new ve("batch fanout")),h.forEach(d=>{if(d.modelType=="Track"){let p=pr.addTrackByModel(d,!0);p.partition=x.getInstance().partitionId,u.addCommand4Item(p,"add")}else if(d.modelType=="Via"){let p=Hr.addViaByModel(d,!0);p.partition=x.getInstance().partitionId,u.addCommand4Item(p,"add")}else console.warn("That are not supported:",d.modelType)}),u.execute(),A.publish("progressUpdate",[1,"batchFanout"],$()),Bi(l),!0}),A.messageBus.rpcService("drc",async i=>{console.time("drc_check"),Mn.getInstance().allowPull=!1,$t.setVisible(35,!0);let{items:n,option:s={}}=i;Eo.deleteByPcbItem(n),Eo.deleteAllNetLengthError(),Eo.deleteAllNetLengthToleranceError(),Eo.deleteNetlistError();let a=this.workerManager.addWorker(`editor?entry=pcb-drc-worker.js${$().location.search.replace(/\?/,"&")}`,!0),l=new xC().encode(),c=Qa.getInstance(),h=new K1().isOpenDRCCustomCheck(),u=!0;if(h&&!c.schematicNetlist.netList.enforce&&(u=!1),u){let g=x.getInstance().id,{message:y}=await A.windowBridge.rpcCall("getSchematicIdByPcbId",g,$());if(y){let b=y;b&&(await A.windowBridge.rpcCall("compareNetList",{pcbId:g,schematicId:b},$())).message||(u=!1)}else u=!1}let{message:d}=await a.rpcCall("DRC",{world:l,option:s}),{workerName:p}=d;if(this.workerManager.deleteWorker(p),Mn.getInstance().allowPull=!0,u){let g=pi.getInstance().addNetlistError(),y=new u5().decode([{type:"NetlistError",data:g}]);Eo.syncFromContentModel(y)}A.publish("progressUpdate",[1,"Design rule check"],$()),$t.flush(),A.publish("flushSelectingInfo",""),console.timeEnd("drc_check")}),A.messageBus.rpcService("unusedLayer",async i=>{Mn.getInstance().allowPull=!1;let n=this.workerManager.addWorker(`editor?entry=pcb-drc-worker.js${$().location.search.replace(/\?/,"&")}`,!0),s=new xC().encode(),{message:a}=await n.rpcCall("UnusedLayer",{world:s,netAndIds:i}),{unusedInnerLayerMap:l,workerName:c}=a;return this.workerManager.deleteWorker(c),Mn.getInstance().allowPull=!0,l}),A.subscribe("debug_clear_Pl",i=>{let{clearAll:n}=i;n&&O5.clear()}),A.subscribe("debug_showPl_dis",i=>{let{pls:n,layerIdOrColor:s,option:a={}}=i;a.clearAll&&O5.clear();let l=n.flatMap(c=>Yb(c).primitives);O5.dis(l,s,a),O5.log(l)}),A.subscribe("creepage_debug",i=>{var h,u;let{type:n,stage:s,payload:a,timestamp:l}=i,c=(h={1:"PREPROCESS",2:"PROJECT_STARTEND",4:"PROJECT_OBSTACLES",8:"SIMPLIFY",16:"TANGENCY",32:"GRAPH_BUILD",64:"DIJKSTRA"}[s])!=null?h:"UNKNOWN";switch(n){case"validation":console.group("\u{1F50D} Creepage \u56FE\u9A8C\u8BC1"),a.valid?console.log("\u2705 \u9A8C\u8BC1\u901A\u8FC7",a.stats):(console.error("\u274C \u9A8C\u8BC1\u5931\u8D25"),console.table(a.errors),((u=a.warnings)==null?void 0:u.length)>0&&(console.warn("\u26A0\uFE0F \u8B66\u544A"),console.table(a.warnings))),console.groupEnd();break;case"visual":if(a.lines){let d=a.lines.map(p=>new M(new S(p.x1,p.y1),new S(p.x2,p.y2)));O5.dis(d)}if(a.points){let d=a.points.map(p=>new S(p[0],p[1]));O5.dis(d)}break;case"stats":console.log(`[${c}] Stats:`,a);break;case"log":console.log(`[${c}]`,a);break}}),A.subscribe("DRCResult",i=>{let n=i.workerName,s=new Ose(i.drc);this.workerManager.deleteWorker(n),Mn.getInstance().allowPull=!0}),A.subscribe("ratlineResultFromWorker",i=>{XEe(i)}),A.messageBus.rpcService("sutureViaDrc",async i=>{Mn.getInstance().allowPull=!1;let n=i.maxProgress||1,s=i.vias;for(let C of s)Eo.deleteClearanceError(C.globalIndex),Eo.deleteBlindError(C.globalIndex),Eo.deleteRadiusError(C.globalIndex);let a=i.checkSameNet,l=i.profile,c=i.layerId,u=new hu("2.0",3).getItems(s),d=s.map(C=>C.globalIndex),p=new xC().encode(),g=await this.workerManager.addWorker(`editor?entry=pcb-drc-worker.js${$().location.search.replace(/\?/,"&")}`,!0).rpcCall("sutureViaDRC",{world:p,ids:d,vias:u,checkSameNet:a,profile:l,layerId:c,mode:i.mode,maxProgress:n}),{errorData:y,excludeIds:b,workerName:P,hasSameNetCoppers:T}=g.message,I=new u5().decode(y);return Eo.syncFromContentModel(I),this.workerManager.deleteWorker(P),Mn.getInstance().allowPull=!0,A.publish("progressUpdate",[n,"Design rule check"],$()),{filterIds:b,hasSameNetCoppers:T}}),A.messageBus.rpcService("checkHasBoardBeforeExport3DShell",this.checkHasBoardBeforeExport3DShell.bind(this)),A.messageBus.rpcService("checkHas3DPrimitiveBeforeExport3DShell",this.checkHas3DPrimitiveBeforeExport3DShell.bind(this)),A.messageBus.rpcService("Component3DData",this.get3DMangerData.bind(this)),A.subscribe("Component3DDataResult",this.modifyComponentData.bind(this)),A.messageBus.rpcService("CopperSource",()=>new AV().getAllPourResult()),A.subscribe("refreshElementFilter",()=>{A.publish("refreshHighLigth",""),$t.refreshHidden()}),A.subscribe("dealMultLayer",i=>{let n=Kt.getAllItem(),s=Hr.getAllItem();for(let l of n)gr(l.layerId)&&a(l);for(let l of s)a(l);function a(l){l.resetReadRender(),l.refreshRender()}}),A.messageBus.rpcService("pcb/decode",async i=>{if(i!==null){let n=x.getInstance(),s=new SV(n.compiler);return await s.parseSourceByCompiler(i),s.build()}return!1}),A.messageBus.rpcService("pcbRefDesignator",async({range:i,operation:n,order:s,initialRefdes:a})=>CUe(i,s,n,a)),A.messageBus.rpcService("pcbClearDesignator",async({range:i})=>SUe(i)),A.messageBus.rpcService("pcbResetUniqueId",()=>{EUe()}),A.messageBus.rpcService("pcb/getPanelizeConfig",i=>ai.getInstance().getDefaultPanelize()),A.messageBus.rpcService("pcb/exportFlyingProbeFile",async({pcbTitle:i})=>{let{fileContent:n}=await Dq(),s=vze(i),a=Bq({[s]:Tb(n)},{level:6}),l=new Blob([a],{type:"application/zip"});return s=s.replace(/\.json$/,".zip"),{fileContent:l,fileName:s}});let e={},r=null;A.subscribe("clearSupplierPart",i=>{e[i.id]=i,r!=null&&clearTimeout(r),r=setTimeout(()=>{let n=x.getInstance().tabId,s=[],a=[];for(let l in e){let c=e[l],h=`${c.designator}(${c["Supplier Part"]})`;s.push(h);let u={attr:{id:c.id,pcbid:n},text:h};a.push(u)}A.publish("ui/toastMsg",{type:"info",msg:['Component have been modified the property "Value", the property "Supplier Part" was cleared by automatically:',...s],bottomBarMsg:{type:"info",msg:['<span class="i18n">Component have been modified the property "Value", the property "Supplier Part" was cleared by automatically:</span>',...a]}},$()),e={},r=null},0)}),A.messageBus.rpcService("pro-pcb/pcbEncodeForWorld",i=>{let{tabId:n}=i||{},s=x.getInstance();if(!([23].includes(s.doctype)||(n?s.tabId!=n:!s.isactive)))return new xC().encode()}),A.subscribe("exportIDF",()=>{!x.getInstance().isactive||23==x.getInstance().doctype||new ice().exportIDFFile()}),A.messageBus.subscribe("pcb/updateTitle",i=>{x.getInstance().name=i}),A.messageBus.rpcService("pcb_IPC2851C",async i=>YYe(i)),A.messageBus.rpcService("exportIpc2581c",async i=>{rje(i)}),A.messageBus.rpcService("pcb_getComponentAttr",async()=>{let i=new Set,n=Cr.getAllItem();for(let s of n){let a=Object.keys(s.attrKeyValue);for(let l of a)i.add(l)}return Array.from(i)}),A.subscribe("importAutoRouteRes",()=>{!x.getInstance().isactive||23==x.getInstance().doctype||new vG(".json",function(i){let n=i[0];xG(n).then(s=>{try{let a=JSON.parse(s.content);if(a.board||a.json){let l=a.json||a;AP.previewJsonInCanvas(l)}else{let l=a;l.finish=!0,AP.routerReady(),AP.routerResult(l)}}catch(a){A.messageBus.publish("message",{type:"error",message:a})}},function(s){A.messageBus.publish("message",{type:"error",message:s})})})}),A.messageBus.rpcService("pcb/importAutoRouteFile",async i=>{let n=await xG(i);try{let s=JSON.parse(n.content);if(s.board||s.json){let a=s.json||s;AP.previewJsonInCanvas(a)}else{let a=s;a.finish=!0,AP.routerReady(),AP.routerResult(a)}}catch{return!1}return!0}),A.messageBus.rpcService("pcb/importAutoRouteSesFile",async i=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return!1;try{return await lje(i)}catch(n){return console.error("\u5BFC\u5165\u5931\u8D25",n),!1}}),A.messageBus.rpcService("pcb/autoRouterRules",i=>new Promise((n,s)=>{var a;n((a=te.getInstance().getDefaultAutoRouter())==null?void 0:a.config)})),A.subscribe("pcb/updateAutoRouterRule",i=>{!x.getInstance().isactive||23==x.getInstance().doctype||!i||!i.config||(!i.name||i.isDefault?te.getInstance().getDefaultAutoRouter().updateConfig(i.config):te.getInstance().addAutoRouter(i.name,i.config))},$()),A.subscribe("exportSpecctraFile",async()=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;A.publish("progressUpdate",[.1,"exportAutoRouterDSN"],$());let i=await new Promise(n=>{setTimeout(async()=>{let s=await I9.exportDSN(AP.getConfig(),x.getInstance().name);n(s)},20)});if(A.publish("progressUpdate",[.9,"exportAutoRouterDSN"],$()),!i){A.publish("progressUpdate",[1,"exportAutoRouterDSN"],$());return}await I9.saveFile(i),A.publish("progressUpdate",[1,"exportAutoRouterDSN"],$())}),A.messageBus.rpcService("exportSpecctraFileRPC",async()=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return null;A.publish("progressUpdate",[.1,"exportAutoRouterDSN"],$());let i=await new Promise(n=>{setTimeout(async()=>{let s=await I9.exportDSN(AP.getConfig(),x.getInstance().name);n(s)},20)});return A.publish("progressUpdate",[.9,"exportAutoRouterDSN"],$()),i?(A.publish("progressUpdate",[1,"exportAutoRouterDSN"],$()),{dataStr:i}):(A.publish("progressUpdate",[1,"exportAutoRouterDSN"],$()),null)}),A.subscribe("importSpecctraSession",()=>{!x.getInstance().isactive||23==x.getInstance().doctype||aje()})}modifyComponentData(t){this.logger.debug1("=============PCB \u63A5\u6536\u52303D\u7BA1\u7406\u5668\u8FD4\u56DE\u6570\u636E==============="),this.logger.debug2(t);let e=t.selectedDeviceList,r=new ve("update component 3d model data");if(e!=null&&Array.isArray(e))for(let i of e){let n=i.id,s=Cr.getItem(n);if(s!=null){r.addCommand(Te.dispatch(s,"modify")),s.modifyATTRMap("3D Model",i.i3DModelId||""),s.modifyATTRMap("3D Model Title",i.i3DModelName||""),s.modifyATTRMap("3D Model Transform",i.transform||"");let a=s.attrKeyText["3D Model"];a!=null&&(a.value=s.attrKeyValue["3D Model"]);let l=s.attrKeyText["3D Model Title"];l!=null&&(l.value=s.attrKeyValue["3D Model Title"]);let c=s.attrKeyText["3D Model Transform"];c!=null&&(c.value=s.attrKeyValue["3D Model Transform"])}}r.length>0&&je.executeCommand(r),A.publish("flushSelectingInfo","")}get3DMangerData(){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let t=Cr.getAllItem(),e=Ve.getComponents(),r=new Array,i=x.getInstance().isReadOnlyMode;for(let n of t){let s=n.globalIndex,a=n.name,l=n.device,c=n.deviceUUID,h=n.footprintId,u=n.footprintUUID,d=n.attrKeyValue["3D Model Title"],p=n.attrKeyValue["3D Model"],m=n.attrKeyValue["3D Model Transform"],g=!1;e.indexOf(n)>-1&&(g=!0);let y=n.partition,b=Ji.getItem(n.footprintUUID),P=b.getSource(),T=b.getOrigin(),I=n.attrKeyValue,C={id:s,designator:a,deviceName:l,deviceId:c,footprintName:h,footprintId:u,i3DModelName:d,i3DModelId:p,transform:m,isSelected:g,dataStr:P,canvasOrigin:T,attrs:I,disabledRow:i||y!==""};r.push(C)}return r}checkHasBoardBeforeExport3DShell(){return LD.getOneOutline()!=null}checkHas3DPrimitiveBeforeExport3DShell(){return!!j5.filterD3Shell(Array.from(j5.getAllItems())).length}getAllDeviceKey(){let t=Cr.getAllItem(),e=new Set;return t.forEach(r=>{let i=r.attrKeyValue;for(let n in i)e.add(n)}),Array.from(e)}getBomInfo(){let t=Cr.getAllItem(),e=new Array;return t.forEach(r=>{let i=Ls(r.attrKeyValue);i.Name=r.getFormulaName(),i.Layer=r.layerId===1?"T":"B",i.Device=r.deviceUUID,i["Mounting Style"]="SMT";let n=r.getPads(),s=new Array;n.forEach(l=>{let c={num:l.num};l.model.layerId===12&&(i["Mounting Style"]="DIP"),s.push(c)});let a={attrs:i,displayDevice:r.device,displayFootPrint:r.footprintId,displaySymbolName:"",partId:null,pins:s};e.push([a])}),e}toggleElementFilter(t){if(!x.getInstance().isactive||x.getInstance().doctype!==3)return;let e=t.primitive;e.value=="all"?$t.setElement(0,e.isChecked,e.isVisible,e.group):$t.setElement(parseInt(e.value),e.isChecked,e.isVisible)}tearDropDialog(){!x.getInstance().isactive||x.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:24})}docNeedUpdate(t){we.docNeedUpdate=t}hiddenDebug(t){this.debugInfo.forEach(e=>{e.info.num==t&&e.hidden()})}showDebug(t){this.debugInfo.forEach(e=>{e.info.num==t&&e.show()})}rebuildCopper(t){if(ce.pcbConfig.isRebuildCopperAuto&&!(t!=null&&t.isManual)||(Ize.main(),!x.getInstance().isactive||x.getInstance().doctype!=3))return;let e="rebuildAllCopper-time";pn(e);let r=t==null?void 0:t.autoSave;if(r!=null&&(this.autoSave=r),this.buildingCopperMap.has("all"))return;if(vD().length==0){Bi(e);return}Mn.getInstance().allowPull=!1,A.windowBridge.publish("pcbUpdateProgress",{ratio:0,descripte:"copper"},$());let n=new tN([],!0);this.buildingCopperMap.add("all");let s=this.workerManager.addWorker(`editor?entry=pcb-worker.js${$().location.search.replace(/\?/,"&")}`),a=JSON.stringify(n.encode());function l(c,h){s.rpcCall("pourDocument",c).then(u=>{h.buildCopper(u.message,void 0,!ce.pcbConfig.isRebuildCopperAuto),h.buildingCopperMap.delete("all"),Mn.getInstance().allowPull=!0,Bi(e)})}l(a,this),a=null}RebuildCopperResult(t){if(!x.getInstance().isactive||x.getInstance().doctype!=3||Array.isArray(t)&&t.length==0||ce.pcbConfig.isRebuildCopperAuto&&!t.isManual)return;let e="rebuildSelectedCopper-time";pn(e);let r=new Set,i=[];t.id.map(a=>Ei.getItem(a)).filter(a=>!!a).forEach(a=>{if(a instanceof ii){let l=a.getParent();if(!l){i.push(a);return}r.has(l.globalIndex)||(r.add(l.globalIndex),i.push(l));return}i.push(a)}),i.forEach(a=>{a.click()}),A.publish("select",i),!this.rebuildSingleCopper({ids:Array.from(r),isLast:!1,isManual:t.isManual})&&Bi(e)}rebuildSingleCopper(t){if(ce.pcbConfig.isRebuildCopperAuto&&!t.isManual)return;if(!x.getInstance().isactive||x.getInstance().doctype!=3)return!1;let{ids:e,isLast:r}=t;if(Array.isArray(e)&&e.length==0)return!1;for(let l of this.buildingCopperMap)if(l!="all"){let c=!0;if(l.isLast==t.isLast&&t.ids.length==l.ids.length){for(let h=0;h<l.ids.length;h++)if(t.ids[h]!=l.ids[h]){c=!1;break}}else c=!1;if(c)return!1}Mn.getInstance().allowPull=!1;let i="rebuildSelectedCopper-time";pn(i,!0),A.windowBridge.publish("pcbUpdateProgress",{ratio:0,descripte:"copper"},$());let n=new tN(e,!1);this.buildingCopperMap.add(t);let s=this.workerManager.addWorker(`editor?entry=pcb-worker.js${$().location.search.replace(/\?/,"&")}`),a=JSON.stringify(n.encode());return s.rpcCall("pourDocument",a).then(l=>{this.buildCopper(l.message,r,!ce.pcbConfig.isRebuildCopperAuto),this.buildingCopperMap.delete(t),Mn.getInstance().allowPull=!0,Bi(i)}),a=null,!0}buildCopper(t,e=!1,r=!0){if(!x.getInstance().isactive||x.getInstance().doctype!=3)return;let i=JSON.parse(t),n=i.workerName;this.workerManager.deleteWorker(n),Mn.getInstance().allowPull=!0;let s=i.pours,a=new er,l=r?e&&je.stack?je.stack:new ve("rebuild copper"):null,c=new Array;for(let P in s){let T=s[P];if(!T.needCopper)continue;let I=a.getItem(P);if(!(I instanceof Ye))continue;let C=I.getComponent();C instanceof Vn&&(C.copperResult=T.paths,l&&Te.dispatchCoppers(I,"delete",l),I.fillCopper(),c.push(I),A.publish("hasModifyPcbItem",I),I.refreshRender())}console.time("generate thermal");let h=new DV(new Nf(new rN)),u=Object.keys(s);u.forEach(P=>h.generateThermal(P)),h.removeIsland(u).forEach(P=>{let T=Ei.getItem(P),I=a.getItem(T.getParent().globalIndex);T.remove(),I.deleteCopperById(P),A.publish("delete",T)});let p=h.getResult(),m=Wo.getInstance();if(h.complete(),p.forEach(P=>{let T=P.getParent();T.deleteCopper(P.globalIndex),m.delete(P,P.globalIndex);let I=cr();P.globalIndex=I,T.addCopper(I),m.addModel(P),a.getItem(P.getParent().globalIndex).addNewCopperModel(P)}),console.timeEnd("generate thermal"),l)for(let P of c)Te.dispatchCoppers(P,"add",l);r?!e&&l.length>0&&(l.setCheckFilter(!1),je.executeCommand(l)):ehe(c),$t.getVisible(21)||A.publish("showPcbSlideMsg",['Copper pour completed! Please set the "Copper Region(Filled)" to visible in the "Right Hand Panel - Filter - Display".'],$());let y=Ve.getItems().filter(P=>!P.isEmpty);A.publish("select",y),this.autoSave||A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),A.publish("flushService","");let b=Ei.getAllItem();this.autoSave&&(b.length>0&&A.windowBridge.rpcCall("save",{tabId:x.getInstance().tabId},$()),this.autoSave=!1),console.timeEnd()}buildPlaneCopper(t,e=!0){if(!x.getInstance().isactive||x.getInstance().doctype!=3)return;ky.getInstance().set("Main");let r=JSON.parse(t),i=r.workerName;i!=null&&this.workerManager.deleteWorker(i);let n=r.pours,s=r.ids,a=r.layers,l=r.nets,c=r.styles,h=e?new ve("rebuild plane zone"):null,u=Qn.getAllItem(),d={},p=new Set,m=new Map;u.forEach(E=>{if(!this.rebuildPlaneLayerObserver||this.rebuildPlaneLayerObserver.has(E.layerId)){let O=te.getInstance().getRegion(E.globalIndex);O&&O.innerPlane&&(d[E.globalIndex]=O.innerPlane);let _=m.get(E.layerId);_||(_=[],m.set(E.layerId,_)),_.push(E)}});for(let[E,O]of m){h?Te.dispatchPlanezones(O,"delete",h):p.add(E);for(let _ of O)_.remove(),A.publish("delete",_)}for(let E=0,O=n.length;E<O;E++){let _=Qn.addCopper(a[E],l[E],!0,n[E]);A.publish("hasModifyPcbItem",_);let R=d[s[E]];if(R!=null){let v=te.getInstance().addRegionSelector(_.globalIndex);v.innerPlane=R,Xp.getInstance().publish("modify",v)}}let g=Qn.getAllItem();g=g.filter(E=>!a.length||a.indexOf(E.layerId)>=0);let y=new Jse(new Nf(new rN));g.forEach(E=>{a.indexOf(E.layerId)>=0&&y.generateThermal(E.globalIndex)});let b=y.getResult();kUe(b);let P={};g.forEach(E=>{let O=String(E.layerId);P[O]||(P[O]=[]),P[O].push(E)});let T=[];Object.keys(P).forEach(E=>{let O=[],_=!0,R=[];P[E].forEach(D=>{y.isTheraml(D.model)||R.push(D.model)});let v=y.getIslandsByCoppers(R);if(v.length!=R.length&&(_=!1),v.forEach(D=>{O.push(Qn.getItem(D.globalIndex))}),_){P[E].shift(),T=[].concat(T,P[E]);return}T=[].concat(T,O)}),y.complete(),T.forEach(E=>{let O=Xd.fetchProfileItem(E.layerId);(!O||!O.keepIsland)&&BUe(E)});let I=Qn.getAllItem();for(let E in Qn.layerMapSet){let O=parseInt(E);if(a.indexOf(O)>=0){let _=Array.from(Qn.layerMapSet[E]||[]);h?Te.dispatchPlanezones(_,"add",h):p.add(O);for(let R of _)A.publish("hasModifyPcbItem",R)}}let C=Ve.getItems();if(C.length>0){let E=C.filter(O=>!O.isEmpty);A.publish("select",E)}h?je.executeCommand(h):ije(p),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),A.publish("flushService",""),A.publish("flushSelectingInfo","")}async parseDevice(t){return await ps.add(t,x.getInstance().compilerChannel)}rebuildPlanezone(t){if(ce.pcbConfig.isRebuildCopperAuto&&!t.isManual)return;let e="rebuildAllPlaneZone-time";pn(e);let r=t.data.id;if(Array.isArray(r)){let i=new Set;r.forEach(n=>{let s=Qn.getItem(n);s!=null&&i.add(s.layerId)}),A.publish("rebuildSinglePlane",{message:Array.from(i),isManual:t.isManual})}else{let i=Qn.getItem(r);i!=null&&A.publish("rebuildSinglePlane",{message:[i.layerId],isManual:t.isManual})}Bi(e)}buttonCommand(t){var e;if(!(!x.getInstance().isactive||x.getInstance().doctype!==3)){if(t.action=="rebuildCopperArea"){let r=t.data.id;Array.isArray(r)?A.publish("rebuildSingleCopper",{ids:r,isLast:!1,isManual:!0}):A.publish("rebuildSingleCopper",{ids:[r],isLast:!1,isManual:!0})}else if(t.action=="rebuildCopperAreaByResult"){let r=t.data.id;Array.isArray(r)?A.publish("RebuildCopperResult",{id:r,isManual:!0}):A.publish("RebuildCopperResult",{id:[r],isManual:!0})}else if(t.action=="autoPlaceSutureVias"){let r=t.data.ids,i=te.getInstance().getDefaultRadiusPhysics(),n=i.defalutRadius,s=i.defalutInner,a=rt.defaultSutureVia.lineSpacing,l=rt.defaultSutureVia.columnSpacing;A.publish("openMainDialog",{cmd:40,data:{option:{ids:r,radius:n,innerRadius:s,lineSpacing:a,columnSpacing:l}}})}else if(t.action=="rebuildPlanezone")t.isManual=!0,this.rebuildPlanezone(t);else if(t.action=="callFootprintDialog"){let r=t.data.attrId,n=new er().getItem(r);if(n!=null&&n instanceof Ri){let s=n.getParent();s!=null&&s instanceof Me&&(n=s)}n!=null&&n instanceof Me&&A.publish("openMainDialog",{cmd:10,data:{device:n}})}else if(t.action=="netSelect")A.publish("toggle",{command:"netSelect",pcbBridgingCopperIndex:(e=t.data)==null?void 0:e.pcbBridgingCopperIndex});else if(t.action=="differentailNetSelect")A.publish("toggle",{command:"differentailNetSelect",formData:t.formData,type:t.type});else if(t.action=="PadsPairPadSelect")A.publish("toggle",{command:"PadsPairPadSelect",formData:t.formData});else if(t.action=="selectDatumLine"){let r=t.data.id;Array.isArray(r)||(r=[r]);let i=new mi;i.createGroup("modify DaTumLine of 3D REGION"),uh.toggleTool(),uh.setGroup(i.getCommand()),uh.setOnceCallback(()=>{A.publish("tool","dropdrag")});for(let n of r){let s=Xt.getItem(n)||Zt.getItem(n)||pt.getItem(n);s!=null&&(uh.addItem(n),i.addCommand4Item(s,"modify"))}}else if(t.action=="editPadShape"){let r=Ve.getSelects();r.length==1&&r[0]instanceof fn&&A.publish("tool","editPadShape")}else if(t.action=="recoverFootprint"){let r=new ve("recover footprint"),i=t.data.id,n=new er;if(Array.isArray(i))for(let s of i){let a=n.getItem(s);a instanceof Me&&n$(a,r)}else{let s=n.getItem(i);s instanceof Me&&n$(s,r)}r.length>0&&je.executeCommand(r),A.publish("flushService","")}else if(t.action=="convertToFillRegion"){let r=[],i=[pt,Ei,Xt,Zt];for(let n of t.data.ids)for(let s of i){let a=s.getItem(n);if(a){r.push(a);break}}nN("CONVERT_TO_FILL_REGION",r)}else if(t.action=="addSolderMaskRegion")Ve.addSolderMaskRegionByTeardrop();else if(t.action=="parentSelect"){let{data:r}=t;if(!r||!r.ids||!r.ids.length)return;Ve.selectParentOfCopperResult(r.ids)}}}openCopperDialog(){!x.getInstance().isactive||x.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:2})}openPadLenDialog(){!x.getInstance().isactive||x.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:46})}openDesignRuleDialog(t){this.logger.debug3("%s %s","===========================>>>",t),!(!x.getInstance().isactive||x.getInstance().doctype!==3)&&A.publish("openMainDialog",{cmd:5,data:{option:t}})}openBatchFanoutDialog(t){!x.getInstance().isactive||x.getInstance().doctype!==3||(A.publish("tool","dropdrag"),A.publish("openMainDialog",{cmd:6,data:{option:t}}))}openEditPadsPairGroupDialog(t){this.logger.debug3("%s %s","===========================>>>",t),!(!x.getInstance().isactive||x.getInstance().doctype!==3)&&A.publish("openMainDialog",{cmd:41,data:{option:t}})}openAutoPlaceTestPadDialog(){!x.getInstance().isactive||x.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:47})}insertImage(t){!x.getInstance().isactive||x.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:14,data:{data:t}})}needUpdateFootprint(t){t.forEach(e=>{let r=Ji.getItem(e);ce.showUpdateBox&&r!=null&&r.components.forEach(i=>{let n=Cr.getItem(i.globalIndex);n.updateView=!0,n.refreshRender()})}),A.publish("updateFrame","")}};function bje(){ie.messageBus.rpcService("getFootprintPng",async o=>(await ie.messageBus.rpcCall("loadFootprint",o),Do.modify(),mf.scene.getCaptureImageData1(o.width,o.height,()=>ie.publish("adaptAll",""),()=>ie.publish("adaptAll",""))))}function uhe(o,t){let e=Tje(o,t);return e?(A.windowBridge.rpcCall("createSubPcb",e,$()),!0):!1}async function Pje(o,t,e,r){let i=Tje(o,t,e,r);if(!i)return!1;je.executeCommand(t);let{message:n}=await A.windowBridge.rpcCall("createSubPcb",i,$());return n}function Tje(o,t,e,r){let i=Dn.getInstance().getItemById(o);if(!ARt(i))return i.remove(),A.publish("delete",i),!1;let n=i.buildBBox(),s=i.getMathGraphics(i.layerId),a=Vt.search4Types(n,oj),l=new Array,c=a.getAllItems().filter(d=>{let p=d.getParent();return d!=i&&(p==null||d instanceof Le)});for(let d of c)if(!d.isEmpty&&d.buildBBox().relation(n)!=1){let p=d instanceof Ue?fe.build2([d.primitive]):d.getMathGraphics(d.layerId),m=new fc(s,p,0);m.relation==1?l.push(d):m.relation==0&&d instanceof Ue&&ORt(d,i,t,l)}let h=[];return l.forEach(d=>{t.addCommand(Te.dispatch(d,"modify")),d.partition=i.globalIndex,h.push(d),A.publish("hasModifyPcbItem",d)}),r=r||Jm(),t.addCommand(Te.dispatch(i,"modify")),i.model.component.fileUuid=r,A.windowBridge.rpcCall("save",{tabId:x.getInstance().tabId},$()),A.subscribe("refreshPcbItemView",()=>{let d=Dn.getInstance().getAllItem(),p=h.length?h.concat(...d):d;aOe(p)},$()),Dn.getInstance().syncPartitionStatus(),{mainPcbUuid:x.getInstance().id,newSubPcbUuid:r,oldSubPcbUuid:e,id:o,title:i.model.component.name}}function aOe(o=[]){if(!(o!=null&&o.length)){let t=Lc();o.push(...t)}o.forEach(t=>{t instanceof Ye&&t.iteratorCopper(e=>{e.refreshRender()}),t.refreshRender()}),A.publish("updateFrame","")}function ORt(o,t,e,r){let i=t.getMathGraphics(t.layerId),n=o.primitive,s=[];for(let d of i.primitives){let p=Tt(n,d);for(let m=0;m<p;m+=2){let g=new S(Ee[m],Ee[m+1]);s.push(g)}}if(!s.length)return;s=dn(s,n);let a=[].concat([n.start()],s,[n.end()]),l=[a[0]];for(let d=1;d<a.length;d++){let p=a[d-1],m=a[d];p.equals1(m)||l.push(m)}let c=new Array;for(let d=1;d<l.length;d++){let p=l[d-1],m=l[d],g;if(n instanceof M)g=pr.addTrack(o.layerId,p,m,o.width,o.locked,o.net);else{let y=p.angle(n.center),b=m.angle(n.center);g=pr.addArcTrack(o.layerId,o.center,o.radius,y,b,n.sweep(),o.width,o.locked,o.net,o.arcType)}t.model.isInside(g.midPoint)&&r.push(g),c.push(g),e.addCommand(Te.dispatch(g,"add"))}let h=pt.getTears(o.globalIndex),u=new Map;if(h instanceof Set){for(let d of h)if(d){let p=_Rt(n,d.getMathGraphics());p&&u.set(p,d)}}if(u.size){let d=dn([].concat(l,Array.from(u.keys())),n);for(let p=1;p<l.length;p++){let m=d.indexOf(l[p-1]),g=d.indexOf(l[p]);for(let y=m;y<=g-m;y++){let b=u.get(d[y]);if(b){e.addCommand(Te.dispatch(b,"modify"));let P=b.component.connects,T=P.indexOf(o.globalIndex);T>=0&&P.splice(T,1,c[p-1].globalIndex)}}}}e.addCommand(Te.dispatch(o,"delete")),o.remove(),A.publish("delete",o)}function ARt(o){let t=Dn.getInstance().getAllItem().filter(i=>i!=o),e=o.getMathGraphics(o.layerId),r=!1;for(let i of t){let n=i.getMathGraphics(i.layerId);if(n.bbox().isSeparated(e.bbox()))continue;if(new Fs(e,n,0).relation!=3){r=!0;break}}if(r){let i={value:"It is detected that the {name} partition overlaps with other partitions, and the sub-picture cannot be separated",options:{name:o.model.component.name}};return A.publish("ui/toastMsg",{type:"warn",msg:i,bottomBarMsg:{type:"warn",msg:[cY(i.value,{params:i.options})]}},$()),!1}return!0}function _Rt(o,t){for(let e of t.primitives)if(e instanceof M&&Tt(o,e)>=2)return new S(Ee[0],Ee[1])}var lOe=["Polygon","Rect","Circle"],vRt=["Length Dimension","Radius Dimension","Protractor Dimension"],xRt=["Component","Image","Length Dimension","Radius Dimension","Protractor Dimension","Text","Rect","Polygon","Circle"],j3=class{constructor(){this.attrs=new Set;this.padNet=new Set;this.componentMap=new Map;this.dimensionMap=new Map;this.imageMap=new Map;this.tearMap=new Map;this.strMap=new Map;this.attrMap=new Map;this.polyAndFillMap=new Map;this.reuseBlocks=new Map;this.pouredMap=new Map;this.proxy=null;this.attrUtils=null}setProxy(t){this.proxy=t}setAttrUtils(t){this.attrUtils=t}onNumber(t,e,r){let i=this.getModelBy(t,e);return i!=null?(i.number=r,!0):!1}getProfile(t){for(let e of lOe){let r=this.getModelBy(e,t);if(r!=null)return r}return null}getDimension(t){for(let e of vRt){let r=this.getModelBy(e,t);if(r!=null)return r}return null}getSilkItem(t){for(let e of xRt){let r=this.getModelBy(e,t);if(r!=null)return r}return null}getModelBy(t,e){return this.proxy!=null?this.proxy.getModelBy(t,e):WA(t,e)}getLayer(t){return this.proxy!=null?this.proxy.getLayer(t):$e.getInstance().getLayer(t)}getLayerPhy(t){return this.proxy!=null?this.proxy.getLayerPhy(t):$e.getInstance().getLayerPhy(t)}getNetModel(t){return this.proxy!=null?this.proxy.getNetModel(t):te.getInstance().getNet(t)}getCombination(t){return this.proxy!=null?this.proxy.getCombination(t):Ip.getInstance().getItem(t)}setLayerDecode(t){let e=this.getLayer(t.layerId);return e!=null?(t.model=e,t.load()):e=t.finish(),this.proxy!=null&&this.proxy.addLayer(e,t),e}setLAYER_PHYS(t){let e=this.getLayerPhy(t.layerId);return e!=null?(t.model=e,t.load()):e=t.finish(),this.proxy!=null&&this.proxy.addLayerPhy(e,t),e}setNet(t){let e=this.getNetModel(t.name);return e!=null?(t.model=e,t.load()):e=t.finish(),this.proxy!=null&&e!=null&&this.proxy.addNet(e),e}setPrimitive(t){}setGroup(t){let e=this.getCombination(t.id);return e!=null?(t.model=e,t.load()):e=t.finish(),this.proxy!=null&&this.proxy.addCombination(e),e}addModel(t,e){this.proxy!=null&&t!=null&&this.proxy.addModel(t,e)}loadModel(t,e){let r=this.getModelBy(t,e.index);return r!=null?(e.model=r,e.netModifyInter=this.proxy,e.load()):r=e.finish(),this.addModel(r,e),r}setVia(t){return this.loadModel("Via",t)}setPad(t){return this.loadModel("Pad",t)}setLine(t){return this.loadModel("Track",t)}setArc(t){return this.loadModel("ArcTrack",t)}loadProfile(t){let e=this.getProfile(t.index);return e!=null?(t.model=e,t.netModifyInter=this.proxy,t.load()):e=t.finish(),this.addModel(e,t),e}setFill(t){return this.loadProfile(t)}setFPCFill(t){return this.loadProfile(t)}setPoly(t){return this.loadProfile(t)}setRegion(t){return this.loadProfile(t)}setPartition(t){return this.loadProfile(t)}setPour(t){let e=this.loadProfile(t),r=this.pouredMap.get(t.index);return r&&(this.loadPoured(r,e),this.pouredMap.delete(t.index)),e}setPoured(t){if(t.index!=null){let e=this.getProfile(t.index);e?this.loadPoured(t,e):this.pouredMap.set(t.index,t)}}setInner(t){if(!t.resultNeedToBeCached)return;let e=new Set,r=t.coppers;for(let n of r)e.add(n.index);let i=Ho.getInstance().layerMapSet[t.layerId]||[];for(let n of i)e.has(n.globalIndex)||this.deleteModel("Inner",n.globalIndex);for(let n of r)this.loadModel("Inner",n)}deleteInner(t){let e=Ho.getInstance().layerMapSet[t];for(let r of e)this.deleteModel("Inner",r.globalIndex)}loadPoured(t,e){t.finish1(e);let r=new Set,i=t.coppers;for(let n of i)r.add(n.index);e.iteratorCopper(n=>{r.has(n)||this.deleteModel("Copper",n)});for(let n of i)this.loadModel("Copper",n)}setImage(t){return this.loadModel("Image",t)}loadObj(t,e){let r=this.getModelBy(t,e.index);return r!=null?(e.model=r,e.netModifyInter=this.proxy,e.load()):r=e.finish(),this.addModel(r,e),r}async loadBlob(t){await t.finish()}async setObj(t){return this.loadObj("Picture",t)}async setBlob(t){return await this.loadBlob(t)}setBoard(t){this.proxy.modifyBoard(t)}deleteBoard(){this.proxy.deleteBoard()}setTeardrop(t){return this.loadProfile(t)}setFont(t){t.finish()}setString(t){return this.loadModel("Text",t)}setReuseBlock(t){let e=this.getModelBy("Component",t.shapeIndex);e!=null?(e.combinationID=t.groupId,e.channelID=t.channelId):this.reuseBlocks.set(t.shapeIndex,t)}async deleteAttr(t){if(this.attrUtils==null)return this.deleteModel("Text",t);let e=this.getModelBy("Text",t);if(e){let r=e.getParent(),i=this.getModelBy("Component",r.globalIndex);if(i instanceof vi){this.attrUtils.deleteAttr(e,i);return}}return this.deleteModel("Text",t)}async setAttr(t){var e;if(this.attrUtils==null)return this.loadAttr("Text",t);if(t.key=="Device"){let r=this.getModelBy("Component",t.parentIndex);if(r==null)return this.attrUtils&&await this.parseFootAndDeviceByAttr(t),this.addAttr(t);if(r.deviceUUID==t.value)return this.loadAttr("Text",t,r);await this.replaceAttr(r,t)}else if(t.key=="Footprint"){let r=this.getModelBy("Component",t.parentIndex);if(r==null)return this.attrUtils&&await this.parseFootAndDeviceByAttr(t),this.addAttr(t);if(r.footprintUUID==t.value)return this.loadAttr("Text",t,r);await this.replaceAttr(r,t)}else{let r=this.getModelBy("Component",t.parentIndex);if(r==null)return this.addAttr(t);{let i=this.loadAttr("Text",t,r);return r.addAttribute(i),(e=this.proxy)==null||e.bindParent(i,r),i}}}setAttrSync(t){var r;if(this.attrUtils==null)return this.loadAttr("Text",t);let e=this.getModelBy("Component",t.parentIndex);if(t.key=="Device"){if(e&&e.deviceUUID==t.value)return this.loadAttr("Text",t,e)}else if(t.key=="Footprint"){if(e&&e.footprintUUID==t.value)return this.loadAttr("Text",t,e)}else{if(e==null)return this.addAttr(t);{let i=this.loadAttr("Text",t,e);return e.addAttribute(i),(r=this.proxy)==null||r.bindParent(i,e),i}}return null}loadAttr(t,e,r){let i=this.getModelBy(t,e.index);return i!=null?(e.model=i,e.netModifyInter=this.proxy,e.load(),this.attrUtils&&r!=null&&this.attrUtils.loadAttr(e,r)):i=e.finish(),this.addModel(i,e),i}async parseFootAndDeviceByAttr(t){this.attrUtils!=null&&await this.attrUtils.parseFootAndDeviceByAttr(t)}async replaceAttr(t,e){this.attrUtils!=null&&await this.attrUtils.replaceAttr(t,e)}addAttr(t){let e=this.componentMap.get(t.parentIndex);if(e!=null){if(e.addAttribute(t),e.canBuild()){let r=e.finish();if(r!=null)return this.componentMap.delete(t.parentIndex),this.addModel(r,t),r}}else this.attrs.add(t)}addDimension(t){let e=t.finish();return this.addModel(e,t),e}setDimension(t){let e=this.getDimension(t.index);if(e!=null)t.model=e,t.load();else return this.addDimension(t);return this.addModel(e,t),e}addComponent(t){let e=new Set;for(let i of this.attrs)i.parentIndex==t.index&&(t.addAttribute(i),e.add(i));for(let i of e)this.attrs.delete(i);let r=new Set;for(let i of this.padNet)i.parentIndex==t.index&&(t.addPadNet(i),r.add(i));for(let i of r)this.padNet.delete(i);if(t.canBuild()){let i=t.finish();if(i!=null)return this.addModel(i,t),i}return this.componentMap.set(t.index,t),null}setComponent(t){let e=this.getModelBy("Component",t.index);if(e!=null)t.model=e,t.load();else return this.addComponent(t);return this.addModel(e,t),e}addPadNet(t){let e=this.componentMap.get(t.parentIndex);if(e!=null){if(e.addPadNet(t),e.canBuild()){let r=e.finish();if(r!=null)return this.addModel(r,t),this.componentMap.delete(e.index),r}}else this.padNet.add(t);return null}setPadNet(t){let e=this.getModelBy("Component",t.parentIndex);if(e!=null){let r=this.getModelBy("Pad",t.getPadId())||this.getModelBy("Via",t.getPadId());return t.parentModel=e,t.model=r,t.netModifyInter=this.proxy,t.load(),this.addModel(r,t),r}else return this.addPadNet(t)}setSHell(t){return this.loadProfile(t)}setSHellCut(t){return this.loadProfile(t)}setShellEntity(t){return this.loadProfile(t)}setCrease(t){return this.loadProfile(t)}setBoss(t){return this.loadProfile(t)}setRuleTemplate(t){t.load()}setRule(t){if(!t.resultNeedToBeCached)return;let e=t.finish();this.proxy!=null&&e!=null&&this.proxy.addRule(e)}getRuleSelector(t){return this.proxy!=null?this.proxy.getRuleSelector(t.select):Lj(t.select)}setRuleSelector(t){if(!t.resultNeedToBeCached)return;let e=this.getRuleSelector(t);return e!=null?(t.model=e,t.load()):e=t.finish(),this.proxy!=null&&e!=null&&this.proxy.addRuleSelector(e),e}setEqlenGrp(t){if(!t.resultNeedToBeCached)return;let e=te.getInstance().getPadsPairGroupItemByGroupName(t.groupName);return e!=null?(t.model=e,t.load()):e=t.finish(),this.proxy!=null&&e!=null&&this.proxy.addRuleSelector(e),e}addPanelize(t,e){this.proxy!=null&&t!=null&&this.proxy.addPanelize(t,e)}setPanelize(t){if(!t.resultNeedToBeCached)return;let e=ai.getInstance();if(e)return t.model=e,t.load(),this.addPanelize(e,t),e}setPanelizeStamp(t){if(!t.resultNeedToBeCached)return;let e=ai.getInstance();if(e)return t.model=e,t.load(),this.addPanelize(e,t),e}setPanelizeSide(t){if(!t.resultNeedToBeCached)return;let e=ai.getInstance();if(e)return t.model=e,t.load(),this.addPanelize(e,t),e}setSilkOpt(t){t.resultNeedToBeCached&&t.load()}setPreference(t){t.resultNeedToBeCached&&t.load()}setCanvas(t){let e;return this.proxy!=null?e=this.proxy.getCanvas():e=x.getInstance(),e!=null&&(t.model=e,t.load()),this.proxy!=null&&this.proxy.updateOrigin(),e}deleteCombination(t){let e=this.getCombination(t);return this.proxy!=null&&e!=null&&this.proxy.deleteCombination(e),e!=null}deleteCopper(t){let e;for(let r of lOe)if(e=this.getModelBy(r,t),e){e.iteratorCopper(i=>{this.deleteModel("Copper",i)});break}}deleteModel(t,e){let r=this.getModelBy(t,e);return this.proxy!=null&&r!=null&&this.proxy.deleteModel(r),r!=null}deleteProfileModel(t){for(let e of lOe)if(this.deleteModel(e,t))return!0;return!1}deleteLayer(t){return this.proxy!=null&&this.proxy.deleteLayer(t),!0}deleteLayerPhys(t){return this.proxy!=null&&this.proxy.deleteLayerPhys(t),!0}deleteNet(t){return this.proxy!=null&&this.proxy.deleteNet(t),!0}deleteEQLenGrp(t){return this.proxy!=null&&this.proxy.deleteEQLenGrp(t),!0}deleteRule(t,e){return this.proxy!=null&&this.proxy.deleteRule(nR(t),e),!0}deleteRuleSelector(t){return this.proxy!=null&&this.proxy.deleteRuleSelector(t),!0}deletePadNet(t,e,r){return this.proxy!=null&&this.proxy.deletePadNet(t,e,r),!0}};var ow=class extends pR{constructor(e=new ng){super();this.clientTool=new j3;this.blobTask=new Array;this.resultNeedToBeCached=!0;this.types=["Rect","Circle","Polygon"];this.tool=e}setProxy(e,r=!0){this.clientTool.setProxy(e),this.resultNeedToBeCached=r}destory(){this.tool=null,this.clientTool=null,this.blobTask,length=0}getDecode(e,r,i,n,s){let a=this.tool.clientParse(e,r,i,n,s);return a&&(a.resultNeedToBeCached=this.resultNeedToBeCached),a}needOnNumber(e,r,i){if(Array.isArray(e)){for(let n of e)if(this.clientTool.onNumber(n,r,i))break}else this.clientTool.onNumber(e,r,i)}onLayerFill(e,r,i,n,s){}onDelLayerFill(e,r,i,n){}onBlob(e,r,i,n,s){if(this.needOn(r,i))return;let a=this.getDecode("BLOB",n,i,e),l=this.clientTool.setBlob(a);this.blobTask.push(l)}onDelBlob(e,r,i,n){this.needOn(r,i)}onFont(e,r,i,n){if(this.needOn(e,r))return;let s=this.getDecode("FONT",i,r);this.clientTool.setFont(s)}onDelFont(e,r,i,n){this.needOn(r,i)}async awaitBlobPromise(){await Promise.all(this.blobTask),this.blobTask.length=0}needParse(e){return e&&!x.getInstance().isHistoryMode}onString(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("STRING",s,n,e,r),c=this.clientTool.setString(l)}onDelString(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Text",e)}async onAttr(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("ATTR",s,n,e,r),c=await this.clientTool.setAttr(l)}onDelAttr(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Text",e)}onPanelize(e,r,i,n){if(this.needParse(n)||this.needOn(e,r))return;let s=this.getDecode("PANELIZE",i,r),a=this.clientTool.setPanelize(s)}onDelPanelize(e,r,i){this.needParse(i)||this.needOn(e,r)||console.warn("[FootprintClient] Method not implemented.")}onRuleSelector(e,r,i,n){if(this.needParse(n)||this.needOn(e,r))return;let s=this.getDecode("RULE_SELECTOR",i,r),a=this.clientTool.setRuleSelector(s)}onDelRuleSelector(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteRuleSelector(e)}onRule(e,r,i,n){if(this.needParse(n)||this.needOn(e,r))return;let s=this.getDecode("RULE",i,r),a=this.clientTool.setRule(s)}onDelRule(e,r,i,n,s){this.needParse(s)||this.needOn(i,n)||this.clientTool.deleteRule(e,r)}onRuleTemplate(e,r,i,n){if(this.needParse(n)||this.needOn(e,r))return;let s=this.getDecode("RULE_TEMPLATE",i,r),a=this.clientTool.setRuleTemplate(s)}onDimension(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("DIMENSION",s,n,e,r),c=this.clientTool.setDimension(l)}onDelDimension(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Length Dimension",e)}onBoss(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("BOSS",s,n,e,r),c=this.clientTool.setBoss(l)}onDelBoss(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Circle",e)}onShellEntity(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("SHELL_ENTITY",s,n,e,r),c=this.clientTool.setShellEntity(l)}onDelShellEntity(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onShellCut(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("SHELLCUT",s,n,e,r),c=this.clientTool.setSHellCut(l)}onDelShellCut(e,r,i,n){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onCrease(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("CREASE",s,n,e,r),c=this.clientTool.setCrease(l)}onDelCrease(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onShell(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("SHELL",s,n,e,r),c=this.clientTool.setSHell(l)}onDelShell(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onFpcFill(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("FPC_FILL",s,n,e,r),c=this.clientTool.setFPCFill(l)}onDelFpcFill(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onTeardrop(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("TEARDROP",s,n,e,r),c=this.clientTool.setTeardrop(l)}onDelTeardrop(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onImage(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("IMAGE",s,n,e,r),c=this.clientTool.setImage(l)}onDelImage(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Image",e)}onPoured(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("POURED",s,n,e,r),c=this.clientTool.setPoured(l)}onDelPoured(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onPour(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("POUR",s,n,e,r),c=this.clientTool.setPour(l)}onDelPour(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onRegion(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("REGION",s,n,e,r),c=this.clientTool.setRegion(l)}onDelRegion(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onFill(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("FILL",s,n,e,r),c=this.clientTool.setFill(l)}onDelFill(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)||this.clientTool.deleteModel("Inner",e)}onPoly(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("POLY",s,n,e,r),c=this.clientTool.setPoly(l)}onDelPoly(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onEQLenGrp(e,r,i,n,s){if(this.needParse(s)||this.needOn(r,i))return;let a=this.getDecode("EQLEN_GRP",n,i,e),l=this.clientTool.setEqlenGrp(a)}onDelEQLenGrp(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteEQLenGrp(e)}async onObj(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;this.blobTask.length>0&&await this.awaitBlobPromise();let l=this.getDecode("OBJ",s,n,e,r),c=this.clientTool.setObj(l)}onDelObj(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Picture",e)}onArc(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("ARC",s,n,e,r),c=this.clientTool.setArc(l)}onDelArc(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("ArcTrack",e)}onLine(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("LINE",s,n,e,r),c=this.clientTool.setLine(l)}onDelLine(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Track",e)}onPad(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("PAD",s,n,e,r),c=this.clientTool.setPad(l)}onDelPad(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Pad",e)}onVia(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("VIA",s,n,e,r),c=this.clientTool.setVia(l)}onDelVia(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Via",e)}onPreference(e,r,i,n){if(this.needParse(n)||this.needOn(e,r))return;let s=this.getDecode("PREFERENCE",i,r),a=this.clientTool.setPreference(s)}onSilkOpts(e,r,i,n,s){if(this.needParse(s)||this.needOn(r,i))return;n.layerId=e;let a=this.getDecode("SILK_OPTS",n,i),l=this.clientTool.setSilkOpt(a)}onDelSilkOpts(e,r,i,n){this.needParse(n)||this.needOn(r,i)||console.warn("[FootprintClient] Method not implemented.")}onGroup(e,r,i,n,s){if(this.needParse(s)||this.needOn(r,i))return;let a=this.getDecode("GROUP",n,i,e),l=this.clientTool.setGroup(a)}onDelGroup(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteCombination(e)}onPrimitive(e,r,i,n,s){this.needParse(s)||this.needOn(r,i)}onDelPrimitive(e,r,i,n){this.needParse(n)||this.needOn(r,i)||console.warn("[FootprintClient] Method not implemented.")}onNet(e,r,i,n,s){if(this.needParse(s)||this.needOn(r,i))return;n.netName=e;let a=this.getDecode("NET",n,i),l=this.clientTool.setNet(a)}onDelNet(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteNet(e)}onPartition(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("PARTITION",s,n,e,r),c=this.clientTool.setPartition(l)}onDelPartition(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onActiveLayer(e,r,i,n){this.needParse(n)||this.needOn(e,r)}onLayerPhys(e,r,i,n,s){if(this.needParse(s)||this.needOn(r,i))return;n.layerId=e;let a=this.getDecode("LAYER_PHYS",n,i),l=this.clientTool.setLAYER_PHYS(a)}onDelLayerPhys(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteLayerPhys(e)}onLayer(e,r,i,n,s){if(this.needParse(s)||this.needOn(r,i))return;n.layerId=e;let a=this.getDecode("LAYER",n,i),l=this.clientTool.setLayerDecode(a)}onDelLayer(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteLayer(e)}onCanvas(e,r,i,n){if(this.needParse(n)||this.needOn(e,r))return;let s=this.getDecode("CANVAS",i,r),a=this.clientTool.setCanvas(s)}onDocDetail(e,r,i){}onDimensionNum(e,r){this.needOnNumber("Length Dimension",e,r)}onBossNum(e,r){this.needOnNumber("Circle",e,r)}onShellEntityNum(e,r){this.needOnNumber(this.types,e,r)}onCreaseNum(e,r){this.needOnNumber("Polygon",e,r)}onShellNum(e,r){this.needOnNumber(this.types,e,r)}onFpcFillNum(e,r){this.needOnNumber(this.types,e,r)}onTeardropNum(e,r){this.needOnNumber("Polygon",e,r)}onImageNum(e,r){this.needOnNumber("Image",e,r)}onPouredNum(e,r){this.needOnNumber(this.types,e,r)}onPourNum(e,r){this.needOnNumber(this.types,e,r)}onRegionNum(e,r){this.needOnNumber(this.types,e,r)}onFillNum(e,r){this.needOnNumber(this.types,e,r)}onPolyNum(e,r){this.needOnNumber(this.types,e,r)}onObjNum(e,r){this.needOnNumber("Image",e,r)}onArcNum(e,r){this.needOnNumber("ArcTrack",e,r)}onCArcNum(e,r){console.warn("Method not implemented.")}onLineNum(e,r){this.needOnNumber("Track",e,r)}onPadNum(e,r){this.needOnNumber("Pad",e,r)}onViaNum(e,r){this.needOnNumber("Via",e,r)}onPartitionNum(e,r){this.needOnNumber(this.types,e,r)}onComponentNum(e,r){this.needOnNumber("Component",e,r)}onStringNum(e,r){this.needOnNumber("Text",e,r)}};var cOe=1.6,s$=.035,hOe=.01,dhe=3.3,a$=4.5,phe=.02,l$=0,Cje=[3,7,5,1,361,2,6,8,4],fhe=[{"Layer Id":3,Layer:"Top Silkscreen Layer",Type:"Silk Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:1},{"Layer Id":7,Layer:"Top Paste Mask Layer",Type:"PasteMask Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:2},{"Layer Id":5,Layer:"Top Solder Mask Layer",Type:"SolderMask Layer",Material:"",Thickness:.03937007,Permittivity:dhe,"Loss Tangent":phe,IsKeepIsLand:1,zIndex:3},{"Layer Id":1,Layer:"Top Layer",Type:"Copper",Material:null,Thickness:.137895245,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:1e3},{"Layer Id":361,Layer:"\u4ECB\u75351",Type:"Substrate",Material:"FR4",Thickness:5.94488057,Permittivity:a$,"Loss Tangent":l$,IsKeepIsLand:1,zIndex:1001},{"Layer Id":2,Layer:"Bottom Layer",Type:"Copper",Material:null,Thickness:.137795245,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:9e3},{"Layer Id":6,Layer:"Bottom Solder Mask Layer",Type:"SolderMask Layer",Material:"",Thickness:.03937007,Permittivity:dhe,"Loss Tangent":phe,IsKeepIsLand:1,zIndex:1e4},{"Layer Id":8,Layer:"Bottom Paste Mask Layer",Type:"PasteMask Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:10001},{"Layer Id":4,Layer:"Bottom Silkscreen Layer",Type:"Silk Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:10002}],Sje=[{"Layer Id":3,Layer:"Top Silkscreen Layer",Type:"Silk Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:1},{"Layer Id":7,Layer:"Top Paste Mask Layer",Type:"PasteMask Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:2},{"Layer Id":5,Layer:"Top Solder Mask Layer",Type:"SolderMask Layer",Material:"",Thickness:.10629927,Permittivity:dhe,"Loss Tangent":phe,IsKeepIsLand:1,zIndex:3},{"Layer Id":1,Layer:"Top Layer",Type:"Copper",Material:null,Thickness:.04724412,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:1e3},{"Layer Id":361,Layer:"\u4ECB\u75351",Type:"Substrate",Material:"FR4",Thickness:.09842525,Permittivity:a$,"Loss Tangent":l$,IsKeepIsLand:1,zIndex:1001},{"Layer Id":2,Layer:"Bottom Layer",Type:"Copper",Material:null,Thickness:.04724412,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:9e3},{"Layer Id":6,Layer:"Bottom Solder Mask Layer",Type:"SolderMask Layer",Material:"",Thickness:.10629927,Permittivity:dhe,"Loss Tangent":phe,IsKeepIsLand:1,zIndex:1e4},{"Layer Id":8,Layer:"Bottom Paste Mask Layer",Type:"PasteMask Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:10001},{"Layer Id":4,Layer:"Bottom Silkscreen Layer",Type:"Silk Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:10002}];var X3=class{constructor(){this.models=new Set;this.layers=new Map;this.nets=new Set;this.combination=new Set;this.map=new Map;this.netModifyMap=new Map;this.panelizes=new Map}addModel(t,e){this.models.add(t),this.map.set(t,e);let r=ky.getInstance().get();ky.getInstance().set("Client"),this.build(),ky.getInstance().set(r)}getModelBy(t,e){return WA(t,e)}deleteModel(t){this.models.delete(t),this.map.delete(t)}addLayer(t,e){this.layers.set(t,e),this.build()}deleteLayer(t){for(let[e]of this.layers)e.layerId==t&&this.layers.delete(e)}addLayerPhy(t,e){}deleteLayerPhys(t){}getLayerPhy(t){return $e.getInstance().getLayerPhy(t)}addNet(t){this.nets.add(t),this.build()}getNetModel(t){return te.getInstance().getNet(t)}addNetModify(t,e){this.netModifyMap.set(e,t)}deleteNet(t){for(let e of this.nets)e.name==t&&this.nets.delete(e)}deleteCombination(t){this.combination.delete(t)}addCombination(t){this.combination.add(t),this.build()}getCombination(t){return Ip.getInstance().getItem(t)}addPanelize(t,e){let r=this.panelizes.get(t);r?(r.add(e),this.panelizes.set(t,r)):(r=new Set().add(e),this.panelizes.set(t,r)),this.build()}modifyBoard(t){}deleteBoard(){}clear(){this.layers.clear(),this.nets.clear(),this.models.clear(),this.combination.clear(),this.map.clear(),this.netModifyMap.clear(),this.panelizes.clear()}getCanvas(){return x.getInstance()}updateOrigin(){}bindParent(t,e){}deleteEQLenGrp(t){}addRule(t){}deleteRule(t,e){}getRuleSelector(t){}addRuleSelector(t){}deleteRuleSelector(t){}deletePadNet(t,e,r){}replaceFootprint(t,e){}};function q3(o,t=o.globalIndex){switch(o.modelType){case"Track":case"ArcTrack":{Ib(pr,t);break}case"Pad":{Ib(Kt,t);break}case"Via":{Ib(Hr,t);break}case"Image":{Ib(Ln,t);break}case"Picture":{Ib(_o,t);break}case"Length Dimension":{Ib(Go,t);break}case"Protractor Dimension":{Ib(is,t);break}case"Radius Dimension":{Ib(Uo,t);break}case"Polygon":{Ib(pt,t);break}case"Rect":{Ib(Xt,t);break}case"Circle":{Ib(Zt,t);break}case"Copper":{Ib(Ei,t);break}case"Inner":{Ib(Qn,t);break}case"Combination":{Ib(kt,t);break}case"Component":{Ib(Cr,t);break}case"Text":{Ib(ti,t);break}default:break}}function Ib(o,t){let e=o.getItem(t);if(e!=null){let r=e.getParent();r!=null&&r instanceof Me&&r.deleteItem(e),A.publish("hasModifyPcbItem",e),e.remove(),A.publish("delete",e)}}var uOe=class{constructor(){this.debounceInstance=new h5;this.ruleDebounceInstance=new h5;this.refreshLeftTreeTypes=new Set;this._changeSelect=!1;this.hasUpdateExpansion=!1;this.flushService1=()=>{ie.publish("flushService","")};this.refreshRuleService=()=>{te.getInstance().getMaxSafe(),this.hasUpdateExpansion&&(ie.publish("updateExpansion",""),this.hasUpdateExpansion=!1);for(let t of this.refreshLeftTreeTypes)this.forceRenderTree(t)};this.historyFlushService1=()=>{ie.publish("flushTearDrop",""),ie.publish("HistoryFlushService",{openPcb:!0,isOtherUser:!0,delayRatline:!0}),this._changeSelect&&(ie.publish("flushSelectingInfo",{}),this._changeSelect=!1),this.updateLayerInfo()}}set changeSelect(t){this._changeSelect=this._changeSelect||t}flushService(){this.debounceInstance.debounce(this.flushService1,100)}historyFlushService(){this.debounceInstance.debounce(this.historyFlushService1,100)}refreshRule(t,e=""){this.hasUpdateExpansion=this.hasUpdateExpansion||t,e!=""&&this.refreshLeftTreeTypes.add(e),this.ruleDebounceInstance.debounce(this.refreshRuleService,100)}updateLayerInfo(){let t=be.configInnerLayers.size;Bf.getInstance().updateLayerInfo(),ga.getInstance().viaShowPair&&t!=be.configInnerLayers.size&&Hr.iterator(e=>e.refreshRender())}forceRenderTree(t){ie.publish("forceRenderTree",t,$())}},km=new uOe;function sw(o,t=!1){if(o!=null)if(t&&!o.isHighLight&&zb.getInstance().updateSelect(o),o instanceof ct){let e=o.getChildrens(),r=new Map;for(let n of e)for(let s of n)r.set(s.globalIndex,s);let i=new Array;for(let n of o.model.childrens){let s=new Array,a;for(let l of n)if(a=r.get(l.globalIndex),a)r.delete(l.globalIndex),s.push(a);else{let c=$c(l);s.push(c)}i.push(s)}o.setChildrens(i);for(let[n,s]of r)s.remove(),q3(s.model);o.model.childrens.length>0&&(o.model.update4Childs(),t&&zb.getInstance().updateSelect(o)),o.type=="TearDrop"&&new Nl(JSON.stringify({connects:o.getComponent().connects}),"TearDrop").modifyComponent(o)}else if(o instanceof fr){let e=o.model;e instanceof H8&&(e.outlineModified=e.model.outlineModified),o.refreshFamily(o.fontFamily),o.hasHelpLine&&o.updateHelpLine()}else o instanceof ii&&o.getParent().refreshRender()}var Eje=new RegExp(/(_([0-9]+))$/),aw=class extends X3{build(){for(let r of this.nets)Vh.addNetByModel(r);for(let[r]of this.layers){let i=be.getLayer(r.layerId);i==null&&(i=be.addPcbLayerByModel(r)),i.refreshRender()}let t=Ve.getItems(),e=!1;for(let r of this.models){let i=$c(r),n=this.netModifyMap.get(r);n!=null&&(ze.delete(i,n),ze.addItem(i),ie.publish("hasModifyNet",n)),Eo.deleteByPcbItem(i),sw(i,!0),$t.updateElementFilterVisible(i),this.addGroup(i),i.refreshRender(),ie.publish("hasModifyPcbItem",i),!e&&t.includes(i)&&(e=!0)}this.panelizes.size&&new _p().applyPanelize(void 0,!1,!1),this.clear(),km.changeSelect=e,km.historyFlushService()}addGroup(t){let e=t.model.getGroupID();if(e!=null){let r=kt.getItem(e);if(r==null)r=kt.rebuild(e,[t]);else if(r.hasItem(t.globalIndex)||r.addItem(t),t instanceof Me&&t.attrsMap["Reuse Block"]==null){let i=r.name;i!=null&&Eje.test(i)&&(t.reuseBlock=i.replace(Eje,""),t.combinationID==""&&(t.combinationID=i.replace(t.reuseBlock+"_","")))}}}getLayer(t){return $e.getInstance().getLayer(t)}deleteModel(t){super.deleteModel(t),q3(t),km.historyFlushService()}modifyBoard(t){t.load(),km.historyFlushService()}deleteBoard(){let t=Cs.getInstance().board;t&&(t.remove(),Cs.getInstance().deleteBoard(t)),km.historyFlushService()}deleteCombination(t){super.deleteCombination(t);let e=kt.getItem(t.globalIndex);e&&(ie.publish("hasModifyPcbItem",e),e.remove(),ie.publish("delete",e)),km.historyFlushService()}deleteLayer(t){super.deleteLayer(t);let e=be.getLayer(t);if(e.config){let{active:r,layerStatus:i}=this.isDefault(t);be.modifyLayer(e.layerID,e.type,e.name,e.order,e.activeColor,e.deactiveColor,r,i)}}isDefault(t){return v8e.includes(t)?{active:!1,layerStatus:1}:{active:!1,layerStatus:0}}deleteLayerPhys(t){be.getLayerPhy(t)&&!Cje.includes(t)&&be.modelManager.deleteLayerPhy(t)}deleteNet(t){te.getInstance().getNet(t)&&te.getInstance().deleteNet(t)}addRule(t){t instanceof Bx?km.refreshRule(!0):km.refreshRule(!1)}deleteRule(t,e){OVe(t,e)&&AVe(t,e)}getRuleSelector(t){return Lj(t)}addRuleSelector(t){let e="";t instanceof Eu?e=tn.NetClasses:t instanceof q2?e=tn.Differentials:t instanceof Vd?e=tn.EqualLengthGroups:t instanceof WI&&(e=tn.PadsPairGroups),km.refreshRule(!1,e)}deleteRuleSelector(t){let e=Lj(t);if(e){let r="";e instanceof Eu?r=tn.NetClasses:e instanceof q2?r=tn.Differentials:e instanceof Vd?r=tn.EqualLengthGroups:e instanceof WI&&(r=tn.PadsPairGroups),EVe(t),km.refreshRule(!1,r)}}deletePadNet(t,e,r){let i=Cr.getItem(t);if(i){let n=i.getPads();if(n.length){let a=t+r,l=n.find(c=>c.globalIndex==a)||n.find(c=>c.num==e);l&&i.model.isCachePadNet()&&i.deleteNet(l.num,l.globalIndex)}let s=i.getVias();if(s.length){let a=s.find(l=>l.globalIndex==e);a&&i.model.isCachePadNet()&&i.deleteNet(a.globalIndex,a.globalIndex)}}}bindParent(t,e){let r=$c(t),i=wT("Component",e.globalIndex);i!=null&&(r.getParent()==null&&(r instanceof fr&&r.key!=""?i.addAttribute(r):(r instanceof Le&&e.isCachePadNet()&&(r.net=e.getNet(r.num,r.globalIndex)),i.addCompositionItem(r))),r instanceof fr&&r.key=="Name"&&i.refreshNameValue())}};var wG=class extends pR{constructor(){super(...arguments);this.clientTool=new j3;this.debug=new URLSearchParams($().location.search).get("cll")=="debug";this.componentTask=new Array;this.blobTask=new Array;this.types=["Rect","Circle","Polygon"]}setProxy(e){this.clientTool.setProxy(e)}setTool(e){this.tool=e}setAttrUtils(e){this.clientTool.setAttrUtils(e)}destory(){this.tool=null,this.clientTool=null,this.componentTask.length=0,this.blobTask.length=0}getDecode(e,r,i,n,s){let a=this.tool.clientParse(e,r,i,n,s);return this.debug&&console.log({fileType:e,data:r,id:n,number:s}),a}needOnNumber(e,r,i){if(Array.isArray(e)){for(let n of e)if(this.clientTool.onNumber(n,r,i))break}else this.clientTool.onNumber(e,r,i)}onLayerFill(e,r,i,n,s){if(this.needOn(r,i))return;let a=this.getDecode("INNER",n,i,e),l=this.clientTool.setInner(a)}onDelLayerFill(e,r,i,n){this.needOn(r,i)||this.clientTool.deleteInner(e)}onBoard(e,r,i,n){if(x.getInstance().isHistoryMode){let s=this.getDecode("BOARD",e,i);this.clientTool.setBoard(s)}}onDelBoard(e,r,i){x.getInstance().isHistoryMode&&this.clientTool.deleteBoard()}onBlob(e,r,i,n,s){if(this.needOn(r,i))return;let a=this.getDecode("BLOB",n,i,e),l=this.clientTool.setBlob(a);this.blobTask.push(l)}onDelBlob(e,r,i,n){this.needOn(r,i)}onFont(e,r,i,n){if(this.needOn(e,r))return;let s=this.getDecode("FONT",i,r);this.clientTool.setFont(s)}onDelFont(e,r,i,n){this.needOn(r,i)}onString(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("STRING",s,n,e,r),l=this.clientTool.setString(a)}onDelString(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Text",e)}async onAttr(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("ATTR",s,n,e,r);if(!this.clientTool.setAttrSync(a)){let c=this.clientTool.setAttr(a);this.componentTask.push(c),c.then(()=>{let h=this.componentTask.indexOf(c);h>=0&&this.componentTask.splice(h,1)})}}async onDelAttr(e,r,i){this.needOn(r,i)||(this.componentTask.length>0&&await this.awaitPromise(),this.clientTool.deleteAttr(e))}async onPadNet(e,r,i){if(this.needOn(e,r))return;this.componentTask.length>0&&await this.awaitPromise();let n=this.getDecode("PAD_NET",i,r),s=this.clientTool.setPadNet(n)}async onDelPadNet(e,r,i,n,s){this.needOn(n,s)||(this.componentTask.length>0&&await this.awaitPromise(),this.clientTool.deletePadNet(e,r,i))}async awaitPromise(){await Promise.all(this.componentTask),this.componentTask.length=0}async awaitBlobPromise(){await Promise.all(this.blobTask),this.blobTask.length=0}async onComponent(e,r,i,n,s){this.componentTask.length>0&&await this.awaitPromise();let a=this.getDecode("COMPONENT",s,n,e,r);this.clientTool.setComponent(a)}async onDelComponent(e,r,i){this.needOn(r,i)||(this.componentTask.length>0&&await this.awaitPromise(),this.clientTool.deleteModel("Component",e))}onPanelize(e,r,i){let n=this.getDecode("PANELIZE",i,r),s=this.clientTool.setPanelize(n)}onDelPanelize(e,r){console.warn("Method not implemented.")}onRuleSelector(e,r,i){if(this.needOn(e,r))return;let n=this.getDecode("RULE_SELECTOR",i,r),s=this.clientTool.setRuleSelector(n)}onDelRuleSelector(e,r,i){this.needOn(r,i)||this.clientTool.deleteRuleSelector(e)}onRule(e,r,i){if(this.needOn(e,r))return;let n=this.getDecode("RULE",i,r),s=this.clientTool.setRule(n)}onDelRule(e,r,i,n){this.needOn(i,n)||this.clientTool.deleteRule(e,r)}onRuleTemplate(e,r,i){if(this.needOn(e,r))return;let n=this.getDecode("RULE_TEMPLATE",i,r),s=this.clientTool.setRuleTemplate(n)}onDimension(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("DIMENSION",s,n,e,r),l=this.clientTool.setDimension(a)}onDelDimension(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Length Dimension",e)}onBoss(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("BOSS",s,n,e,r),l=this.clientTool.setBoss(a)}onDelBoss(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Circle",e)}onShellEntity(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("SHELL_ENTITY",s,n,e,r),l=this.clientTool.setShellEntity(a)}onDelShellEntity(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onShellCut(e,r,i,n,s){}onDelShellCut(e,r,i){}onCrease(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("CREASE",s,n,e,r),l=this.clientTool.setCrease(a)}onDelCrease(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onShell(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("SHELL",s,n,e,r),l=this.clientTool.setSHell(a)}onDelShell(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onFpcFill(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("FPC_FILL",s,n,e,r),l=this.clientTool.setFPCFill(a)}onDelFpcFill(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onTeardrop(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("TEARDROP",s,n,e,r),l=this.clientTool.setTeardrop(a)}onDelTeardrop(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onImage(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("IMAGE",s,n,e,r),l=this.clientTool.setImage(a)}onDelImage(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Image",e)}onPoured(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("POURED",s,n,e,r),l=this.clientTool.setPoured(a)}onDelPoured(e,r,i){this.needOn(r,i)||this.clientTool.deleteCopper(e)}onPour(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("POUR",s,n,e,r),l=this.clientTool.setPour(a)}onDelPour(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onRegion(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("REGION",s,n,e,r),l=this.clientTool.setRegion(a)}onDelRegion(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onFill(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("FILL",s,n,e,r),l=this.clientTool.setFill(a)}onDelFill(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)||this.clientTool.deleteModel("Inner",e)}onPoly(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("POLY",s,n,e,r),l=this.clientTool.setPoly(a)}onDelPoly(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onEQLenGrp(e,r,i,n){if(this.needOn(r,i))return;let s=this.getDecode("EQLEN_GRP",n,i,e),a=this.clientTool.setEqlenGrp(s)}onDelEQLenGrp(e,r,i){this.needOn(r,i)||this.clientTool.deleteEQLenGrp(e)}async onObj(e,r,i,n,s){if(this.needOn(i,n))return;this.blobTask.length>0&&await this.awaitBlobPromise();let a=this.getDecode("OBJ",s,n,e,r),l=this.clientTool.setObj(a)}onDelObj(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Picture",e)}onArc(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("ARC",s,n,e,r),l=this.clientTool.setArc(a)}onDelArc(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("ArcTrack",e)}onLine(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("LINE",s,n,e,r),l=this.clientTool.setLine(a)}onDelLine(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Track",e)}onPad(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("PAD",s,n,e,r),l=this.clientTool.setPad(a)}onDelPad(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Pad",e)}onVia(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("VIA",s,n,e,r),l=this.clientTool.setVia(a)}onDelVia(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Via",e)}onPreference(e,r,i){if(this.needOn(e,r))return;let n=this.getDecode("PREFERENCE",i,r),s=this.clientTool.setPreference(n)}onSilkOpts(e,r,i,n){if(this.needOn(r,i))return;n.layerId=e;let s=this.getDecode("SILK_OPTS",n,i),a=this.clientTool.setSilkOpt(s)}onDelSilkOpts(e,r,i){console.warn("Method not implemented.")}onGroup(e,r,i,n){if(this.needOn(r,i))return;n.id=e;let s=this.getDecode("GROUP",n,i),a=this.clientTool.setGroup(s)}onDelGroup(e,r,i){this.needOn(r,i)||this.clientTool.deleteCombination(e)}onPrimitive(e,r,i,n){}onDelPrimitive(e,r,i){console.warn("Method not implemented.")}onNet(e,r,i,n){if(this.needOn(r,i))return;n.netName=e;let s=this.getDecode("NET",n,i),a=this.clientTool.setNet(s)}onDelNet(e,r,i){this.needOn(r,i)||this.clientTool.deleteNet(e)}onPartition(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("PARTITION",s,n,e,r),l=this.clientTool.setPartition(a)}onDelPartition(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onActiveLayer(e,r,i){}onLayerPhys(e,r,i,n){if(this.needOn(r,i))return;n.layerId=e;let s=this.getDecode("LAYER_PHYS",n,i),a=this.clientTool.setLAYER_PHYS(s)}onDelLayerPhys(e,r,i){this.needOn(r,i)||this.clientTool.deleteLayerPhys(e)}onLayer(e,r,i,n){if(this.needOn(r,i))return;n.layerId=e;let s=this.getDecode("LAYER",n,i),a=this.clientTool.setLayerDecode(s)}onDelLayer(e,r,i){this.needOn(r,i)||this.clientTool.deleteLayer(e)}onCanvas(e,r,i){if(this.needOn(e,r))return;let n=this.getDecode("CANVAS",i,r),s=this.clientTool.setCanvas(n)}onDimensionNum(e,r){this.needOnNumber("Length Dimension",e,r)}onBossNum(e,r){this.needOnNumber("Circle",e,r)}onShellEntityNum(e,r){this.needOnNumber(this.types,e,r)}onCreaseNum(e,r){this.needOnNumber("Polygon",e,r)}onShellNum(e,r){this.needOnNumber(this.types,e,r)}onFpcFillNum(e,r){this.needOnNumber(this.types,e,r)}onTeardropNum(e,r){this.needOnNumber("Polygon",e,r)}onImageNum(e,r){this.needOnNumber("Image",e,r)}onPouredNum(e,r){this.needOnNumber(this.types,e,r)}onPourNum(e,r){this.needOnNumber(this.types,e,r)}onRegionNum(e,r){this.needOnNumber(this.types,e,r)}onFillNum(e,r){this.needOnNumber(this.types,e,r)}onPolyNum(e,r){this.needOnNumber(this.types,e,r)}onObjNum(e,r){this.needOnNumber("Picture",e,r)}onArcNum(e,r){this.needOnNumber("ArcTrack",e,r)}onCArcNum(e,r){console.warn("Method not implemented.")}onLineNum(e,r){this.needOnNumber("Track",e,r)}onPadNum(e,r){this.needOnNumber("Pad",e,r)}onViaNum(e,r){this.needOnNumber("Via",e,r)}onPartitionNum(e,r){this.needOnNumber(this.types,e,r)}onComponentNum(e,r){this.needOnNumber("Component",e,r)}onStringNum(e,r){this.needOnNumber("Text",e,r)}onDocDetail(e,r,i){}};var mhe=class{constructor(){this.deviceTask=new Map;this.footprintTask=new Map}async replaceAttr(t,e){this.preAdjust(t);let i=new z1("2.0").save(t);this.remove(t),await this.build(i,e)}async parseFootAndDeviceByAttr(t){let e=t.key,r=t.value,i=x.getInstance().compilerChannel;if(e=="Device"){let n=gh.getInstance().getItem(r);if(n||(this.deviceTask.get(r)||this.deviceTask.set(r,gh.getInstance().add(r,i)),n=await this.deviceTask.get(r),this.deviceTask.delete(r)),n){let s=n.footprintUUID;s!=null&&await this.addFootprint(s,i)}}else e=="Footprint"&&await this.addFootprint(r,i)}async addFootprint(t,e){if(!Wi.getInstance().getItem(t)){if(!this.footprintTask.get(t)){let i;t.indexOf("_")>-1?i=Wi.getInstance().addCustomFootprint(t,e):i=Wi.getInstance().add(t,e),this.footprintTask.set(t,i)}await this.footprintTask.get(t),this.footprintTask.delete(t)}}loadAttr(t,e){let r=e.attrKeyValue[t.key],i=t.getNameValueById(t.key,t.value);r!=null?this.updateAttr(t,t.key,i,t.showKey,t.showValue,e):typeof r>"u"&&t.model.value===He||(i!=null&&(i=i.toString()),e.modifyATTRMap(t.key,i),this.createATTR(e,t))}updateAttr(t,e,r,i,n,s){let a=t.model,l=!1,c=gh.getInstance().getItem(s.deviceUUID);if(a==null){let h=s.attrKeyValue[e];(h==null||h===He)&&(h=""),a=this.createATTR(s,t),c.has(e)&&(l=!0)}a&&(a.value!=null&&a.value!==He&&a.value!==r&&s.modifyATTRMap(e,r),a.showKey!=i&&(a.showKey=i),r!=null&&r!==He&&a.value!=r&&(a.value=r.toString()),a.showValue!=n&&(a.showValue=n),s.resetAttr(a),l&&c.addAttr(e,c.getAttrData(s,a)),(!a.outline||!a.outline.length)&&a.showValue&&this.syncTextPath(a))}createATTR(t,e){var i;let r=mo.getInstance().addText(e.index,e.layerId,e.key,e.showKey,e.value,e.showValue,e.fontFamily,e.fontSize,e.angle,e.locked,e.getPosition(),e.origin,e.strokeWidth,e.reverse,e.reverseExpansion,e.mirror,e.positionIsNull,null,(i=e.props)==null?void 0:i.color);return t.addAttribute(r),r}syncTextPath(t){if(t.outline&&t.outline.length>0)return;let e=t.getText();if(e==""||e==null){t.outline=[],t.updateBox4(0,0);return}let r=MA(t.globalIndex,t.fontFamily,e,t.fontSize,t.reverse,t.reverseExpansion,t.strokeWidth);r&&r.path&&(t.outline=r.path,t.updateBox4(r.width,r.height));let i=t.fontFamily,n=i==""||["","default","default2","Serif","Sans Serif"].includes(i);n&&!Vy.everyCharHasDefaultFontPath(e)&&(t.fontFamily="\u9ED1\u4F53",n=!1),n?t.type=0:t.type=1}};var lw=class extends mhe{preAdjust(t){let e=Cr.getItem(t.globalIndex);new oP(e,"modify"),Te.dispatch(e,"delete"),A.publish("hasModifyPcbItem",e)}deleteAttr(t,e){let r=Cr.getItem(e.globalIndex);new EV().restoreAttr(t.key,r)}remove(t){let e=Cr.getItem(t.globalIndex);A.publish("delete",e),e.remove()}async build(t,e){await new Y1(t).replaceDecode(e)}};var ghe=class{constructor(){St.getInstance().visible=T1.NOTSHOW,St.getInstance().setMultiStyle(bS.None),A.messageBus.rpcService("loadFootprint",this.loadFootprint.bind(this)),A.messageBus.rpcService("loadPCB",this.loadPCB.bind(this)),A.subscribe("AdaptPrimitive",this.adaptPrimitive.bind(this)),A.subscribe("delayAdaptAll",()=>{if(OT.asyncText==0){A.publish("adaptAll","");return}this.antiShake==null&&(this.antiShake=this.adaptAll())}),A.subscribe("updateSilkScreenColor",t=>{let{layer:e,color:r}=t;e==3?we.topSilkscreenColor=r:we.bottomSilkscreenColor=r}),A.messageBus.rpcService("generateGerberResult",t=>bYe(t).then(async e=>{if(!e)return;let r=await MC(e.blob);return delete e.blob,{fileInfo:e,...r}}).catch(e=>({error:(e==null?void 0:e.message)||e}))),A.messageBus.rpcService("gerberLayerConfig",()=>new Promise((t,e)=>{let r=[],i=be.getAllLayer(),n=[12,47,52,48,49,50,51,53,54,55,56,57],s=[],a=[];for(let c=15;c<=46;c++)s.push(c);for(let c of i)if(!n.includes(c.layerID)){let h={layerId:c.layerID,layerType:c.type,layerName:c.name,status:c.layerStatus};s.includes(c.layerID)?a.push(h):r.push(h)}let l=r.findIndex(c=>c.layerId==2);r.splice(l,0,...a),t(r)})),A.subscribe("pro-pcb/layerConfigurationReplacement",this.layerConfigurationReplacement.bind(this)),bje()}async loadPCB(t){if(t&&t!=null){A.publish("clearAll",""),t.isPartitionDlg&&Bt.setIsChildPcb(t.pcbLevelType=="CHILD"),A.publish("updateModify",""),A.publish("previewClearAll",""),await use.deleteTemplate(),await x.getInstance().resetCompiler(),x.getInstance().id=t.tabId.split("@")[0],x.getInstance().tabId=t.tabId,x.getInstance().doctype=t.docType,x.getInstance().isPreview=!0,x.getInstance().envFlag=t.envFlag;let e=x.getInstance().compiler,r=new L0(e);t.dataStr!=null?await r.parseSourceByCompiler(t.dataStr||""):await r.init(),r.build();let i=new wG;i.setProxy(new aw),i.setTool(new ob),i.setAttrUtils(new lw),e.setHandle(i);let n=be.getAllLayer(),s=DA.concat(FM);for(let a of n)a.config&&(s.indexOf(a.layerID)>=0?a.visible=!1:a.visible=!0);if(be.setActiveLayerId($e.getInstance().activeLayer),t.isPartitionDlg){let l=Dn.getInstance().getAllItem().find(c=>c.model instanceof lr&&c.model.component instanceof Dc&&c.model.component.fileUuid==x.getInstance().id);if(l){let c=new _e;if(c.ext1(l.buildBBox()),c.valid()){let h=c.build1();A.publish("adaptBBox",h)}return}}A.publish("delayAdaptAll","")}}async loadFootprint(t){if(!t){A.publish("clearAll","");return}let{tabId:e,docType:r,dataStr:i,isOldDataString:n}=t;if(!e)return;let s=e.split("@"),a=s[0],l=s[1];if((!a||!l)&&!i){console.error("Package preview parameter error: tabId is invalid!",t);return}let c=x.getInstance();c.id=a,c.tabId=e,c.doctype=r,c.isPreview=!0,c.currOpenProjectId=t.currOpenProjectId,A.publish("updateModify",""),A.publish("previewClearAll",""),be.checkDefault(),await c.resetCompiler();let h=new L0(c.compiler);i?n?await h.parseSourceByCompiler(i,n):await h.parseSourceByCompiler(i):await h.init(),h.build();let u=new ow(new ob);u.setProxy(new aw),c.compiler.setHandle(u);let d=x.getInstance().envFlag==="cnc-preview",p=be.getAllLayer(),m=d?DA:DA.concat(FM);for(let g of p)g.config&&(m.indexOf(g.layerID)>=0?g.visible=!1:g.visible=!0);$t.setVisible(2,!0),$t.setVisible(2,!1),A.publish("delayAdaptAll",""),t.hideDxfLoading&&A.publish("toggleDxfLoadingState",!1,$()),be.setActiveLayerId($e.getInstance().activeLayer)}adaptAll(){return setTimeout(()=>{OT.asyncText>0?(this.antiShake!=null&&clearTimeout(this.antiShake),this.antiShake=this.adaptAll()):(A.publish("adaptAll",""),this.antiShake=null)},10)}adaptPrimitive(t){let{primitiveId:e,fileUuid:r,pcbLevelType:i}=t.message,s=Dn.getInstance().getAllItem().find(a=>a.model instanceof lr&&a.model.component instanceof Dc&&a.model.component.fileUuid==r);if(s){let a=new _e;if(a.ext1(s.buildBBox()),a.valid()){let l=a.build1();A.publish("adaptBBox",l)}}else A.publish("adaptAll","");x.getInstance().id=r,Bt.setIsChildPcb(i=="CHILD"),aOe()}layerConfigurationReplacement(t){let{defaultStroke:e,layerExchangeMap:r}=t,i=!1;if(e&&!isNaN(e)&&(Xt.iterator(n=>{n.width=e}),Zt.iterator(n=>{n.strokeWidth=e}),pt.iterator(n=>{n.strokeWidth=e}),i=!0),r){for(let n in r){let{layerCode:s,toLayerCode:a,visible:l}=r[n],c=s&&be.getLayer(s);if(!c)continue;let h=a&&be.getLayer(a);h&&(c.activeColor=h.activeColor),c.visible=l}i=!0}i&&(A.publish("updateModify",""),A.publish("adaptAll",""))}};function yhe(o,t,e,r){if(x.getInstance().doctype===0){x.getInstance().doctype=o,x.getInstance().isPreview=e,x.getInstance().envFlag=r;let i=r=="cnc-preview",n=r=="silk-preview";e||i||n?new ghe:o===4?new Tse:o===3&&new lhe,BM.getInstance().attach(Oo.getInstance())}x.getInstance().tabId===""&&(x.getInstance().tabId=t,x.getInstance().id=t.split("@")[0])}function Aje(o,t,e,r){r||(r=x.getInstance().doctype),ce.updateSystemConfig(o,e),r===3&&x3.updateConfig(t)}function bhe(o){o&&x.getInstance().doctype===3&&A.publish("INIT_PCB_CONFIG",o)}function che(o,t=!1){ah.switch=o,we.realTimeDRC=o,A.publish("TOGGLE_REALTIME_DRC",o,$()),o?o&&!t&&A.publish("showCheckDRCDlg","",$()):Eo.deleteAll()}function BC(o,t=!0,e=!0){x.getInstance().isactive=o,o&&23!=x.getInstance().doctype&&(Bf.getInstance().updateLayerInfo(),Y3(e),we.synchronize(),A.publish("flushSelectingInfo",""),t&&A.publish("reInitDesignTree",x.getInstance().tabId,$())),23==x.getInstance().doctype&&(x.getInstance().isactive=!0)}async function Y3(o=!0){let t=await $t.updateGetConfig(o),e=$t.getElementFilters();A.publish("renderElementPanel",{data:e,config:t},$())}async function _je(){m9&&A.windowBridge.rpcCall("getAnnotationAuthority",{},$()).then(async o=>{let t=o.message;if(Lo.getInstance().setAuthority(t),t){let e=(await A.windowBridge.rpcCall("getShowAnnotation",{},$())).message||!1;$t.setVisible(38,e),setTimeout(()=>{A.windowBridge.rpcCall("getAllAnnotationBlock",{path:x.getInstance().id},$()).then(r=>{console.time("create annotation");let i=r.message;if(!Array.isArray(i))return;let n={uuid:x.getInstance().id,nameMap:{}},s=!1;for(let a of i){let c=Lo.getInstance().update(a).getComponent();c.type==1&&(n.nameMap=Object.assign(n.nameMap,Lo.getInstance().getConnectsName({objects:c.connects})),s=!0)}Lo.getInstance().hasCreateAll=!0,Lo.getInstance().openSelect(),s&&A.windowBridge.publish("updateAnnotationBlockName",n,$()),console.timeEnd("create annotation")})})}})}var Lo=class o{constructor(){this.needAnnotation=!1;this.connectAnnotation=new Map;this.hasCreateAll=!1;A.subscribe("cancelCreateAnnotation",this.cancel.bind(this)),A.subscribe("confirmAnnotation",this.success.bind(this)),A.subscribe("deleteAnnotation",this.deleteItem.bind(this)),A.subscribe("selectAnnotation",this.selectPcbAnnotation.bind(this)),A.subscribe("doubleSelectAnnotation",this.doubleSelectAnnotation.bind(this)),A.subscribe("updatePcbAnnotation",this.update.bind(this)),A.subscribe("getShowTitleInAnnotation",this.getConnectsName.bind(this)),A.subscribe("highlightAnnotation",this.highlightAnnotation.bind(this)),A.subscribe("unHighlightAnnotation",this.unHighlightAnnotation.bind(this)),A.subscribe("addAnnotation",this.update.bind(this))}get canDrawing(){return this.annotationId==null}static getInstance(){return o.instance||(o.instance=new o),o.instance}openSelect(){this.openSelectAnn&&this.doubleSelectAnnotation(this.openSelectAnn),this.openSelectAnn=void 0}waitData(t){this.cancel();let e=Xt.getItem(t);if(e==null)return;e.click();let r=e.getUL(),i=e.getLR();setTimeout(()=>{A.windowBridge.publish("addAnnotationBlock",{path:x.getInstance().id,customArea:{minX:r.x,maxX:i.x,minY:i.y,maxY:r.y}},$()),this.annotationId=t},100)}cancel(){this.annotationId&&this.deleteItem(this.annotationId),this.annotationId=void 0,A.publish("updateFrame","")}success(t){let e;if(t.path==x.getInstance().id)return t.objects&&t.objects.length>0?e=this.createAnnotationByConnect(t.objects,t.uuid):(e=this.createAreaAnnotation(t.customArea,t.uuid),this.deleteItem(this.annotationId)),this.selectPcbAnnotation2(e.globalIndex,!0,!1),this.annotationId=void 0,A.publish("updateFrame",""),e}update(t){if(t.path==x.getInstance().id){let e;t.objects&&t.objects.length>0?e=this.createAnnotationByConnect(t.objects,t.uuid):e=this.createAreaAnnotation(t.customArea,t.uuid);let r=e.getComponent();return r.type==1&&this.updateTitle(r.connects),e.initVisible(),A.publish("updateFrame",""),e}}interrupt(t){this.deleteItem(t),A.publish("updateFrame","")}deleteItem(t){if(t){let e=Xt.getItem(t);if(e){let r=e.getComponent();if(r.connects)for(let i of r.connects)this.connectAnnotation.get(i).delete(e.globalIndex);e.remove(),A.publish("delete",e)}}}static isAnnotation(t){return t instanceof nr&&t.type=="Annotation"}setAuthority(t){this.needAnnotation=t}getAuthority(){return this.needAnnotation}getNeedAnnotation(){return this.needAnnotation&&m9&&x.getInstance().doctype==3}hasConnectItem(){return this.getConnectItem(Ve.getSelects()).length>0}getConnectItem(t){return t.filter(e=>this.needAnnotationItem(e))}createAnnotationByItems(){let e=this.getConnectItem(Ve.getSelects()).map(r=>r.globalIndex);A.windowBridge.publish("addAnnotationBlock",{path:x.getInstance().id,objects:e},$()),this.updateTitle(e)}createAreaAnnotation(t,e){let{minX:r,maxX:i,minY:n,maxY:s}=t,a=Xt.getItem(e);return a||(a=Xt.addRect("Annotation",1,new S(r,s),i-r,s-n,"",!1,1,void 0,void 0,void 0,e)),a}createAnnotationByArea(t){return this.createAreaAnnotation(t)}createAnnotationByConnect(t,e){let r=this.getConnectBBox(t),i=Xt.getItem(e);if(!i){i=Xt.addRect("Annotation",1,r.UL(),r.width(),r.height(),"",!1,1,void 0,void 0,void 0,e);let n=i.getComponent();n.connects=t,t.forEach(s=>{let a=this.connectAnnotation.get(s);a||(a=new Set,this.connectAnnotation.set(s,a)),a.add(i.globalIndex)})}return i}changeElements(t){if(t.size==0||this.connectAnnotation.size==0)return;let e="annotationModify-time";pn(e);let r=[],i=[];for(let n of t){let s=n.globalIndex,a=this.connectAnnotation.get(s);if(a){for(let l of a){let c=Xt.getItem(l);c&&i.push(c)}r.push(s)}}for(let n=0;n<i.length;n++)this.updateRectBBox(i[n]);r.length>0&&this.updateTitle(r),Bi(e,.01)}updateTitle(t){let e={uuid:x.getInstance().id,nameMap:{}};e.nameMap=Object.assign(e.nameMap,o.getInstance().getConnectsName({objects:t})),A.windowBridge.publish("updateAnnotationBlockName",e,$())}updateRectBBox(t){if(!t.isEmpty&&o.isAnnotation(t)&&t.getComponent().type==1){let i=this.getRectBBox(t);t.width=i.width(),t.height=i.height();let n=i.UL().sub(t.getUL()),s=Ae.translate(n.x,n.y,0);t.transform(s),t.updateFilterVisible=!0,t.visible()}return null}selectAnnotationBlock(t){A.windowBridge.publish("selectAnnotationBlock",{uuid:t.globalIndex},$())}doubleSelectAnnotation(t){this.hasCreateAll||(this.openSelectAnn=t),this.selectPcbAnnotation2(t,!0)}selectPcbAnnotation(t){this.selectPcbAnnotation2(t)}selectPcbAnnotation2(t,e=!1,r=!0){let i=Xt.getItem(t);if(i&&i.type=="Annotation"){let n=i.getComponent(),s=n.connects;if(n.type==1&&!s.find(c=>{let u=new er().getItem(c);return!!(u&&!u.isEmpty)}))return;A.publish("clearSelect",{});let a=[i];s.forEach(l=>{let h=new er().getItem(l);if(h&&!h.isEmpty){let d=h.model.layerId,p=be.getLayer(d);p.visible||(p.visible=!0),$t.setVisibleByItem(h,!0),a.push(h)}}),Bf.getInstance().updateLayerInfo(),Y3(!1),a.forEach(l=>{l.click()}),A.publish("select",a),r&&A.publish("AdaptBBox2",{box:i.buildBBox(),onlyMove:!e}),A.publish("updateFrame","")}}highlightAnnotation(t){let e=Xt.getItem(t);if(e&&e.type=="Annotation"){let r=e.getComponent(),i=r.connects;if(r.type==1&&!i.find(a=>{let c=new er().getItem(a);return!!(c&&!c.isEmpty)}))return;let n=[e];i.forEach(s=>{let l=new er().getItem(s);l&&!l.isEmpty&&n.push(l)}),n.forEach(s=>{s.click()}),A.publish("updateFrame","")}}unHighlightAnnotation(t){let e=Xt.getItem(t);if(e&&e.type=="Annotation"){let r=e.getComponent(),i=r.connects;if(r.type==1&&!i.find(h=>{let d=new er().getItem(h);return!!(d&&!d.isEmpty)}))return;let n=[e],s=[],a=Ve.getItems(),l=Ve.getAnnotationItems();s=s.concat(a).concat(l),i.forEach(c=>{let u=new er().getItem(c);u&&!u.isEmpty&&!a.includes(u)&&n.push(u)}),n.forEach(c=>{c.updateFilterVisible=!0,c.visible()}),s.forEach(c=>{c.click()}),A.publish("updateFrame","")}}getConnectsName(t){let{objects:e}=t,r={},i=new er;for(let n of e){let s=i.getItem(n);!s||s.isEmpty?r[n]=null:r[n]=this.getName(s)}return r}getName(t){if(t instanceof Me)return t.name;if(t instanceof Ye)return t.type=="Copper Region"?t.getComponent().name||this.getGlobalIndexName(t):this.getGlobalIndexName(t);if(t instanceof Ue)return`${t.net||"None"}_${this.getGlobalIndexName(t)}`;if(t instanceof Le){let e=t.getParent();return e instanceof Me?`${e.name}:${t.num}`:this.getGlobalIndexName(t)}return this.getGlobalIndexName(t)}getConnectBBox(t){let e=new _e;return t.forEach(i=>{let n=pc(i);n&&!n.isEmpty&&e.ext1(n.bbox)}),e.ext7(1),e.build1()}getGlobalIndexName(t){return`${ur}${t.number}`}getRectBBox(t){let r=t.getComponent().connects;return this.getConnectBBox(r)}needAnnotationItem(t){return t instanceof Me||t instanceof fr&&t.key==""||t instanceof Le||t instanceof Ge||t instanceof Ye&&t.type!=="Annotation"||t instanceof A0||t instanceof n0||t instanceof va||t instanceof Ue}};function _P(o){let t=new Array,e=new Set,r=new Set;o.forEach(s=>{s instanceof ct?(e.add(s),t.push(s)):s instanceof mt||s instanceof vt?r.add(s):t.push(s)});let i=new Set,n=e.size+r.size;return r.forEach(s=>{let a=s.getParent();a!=null&&a instanceof ct&&!e.has(a)&&!i.has(a)&&(n>0||a.onlyOneChilds()!=null?t.push(a):t.push(s),i.add(a))}),t}function vje(o){let t=new Array,e=new Set,r=new Set;for(let a of o)a instanceof ct?(e.add(a),t.push(a)):a instanceof mt||a instanceof vt?r.add(a):t.push(a);let i=new Set,n=new Set,s=e.size+r.size;for(let a of r){let l=a.getParent();l!=null&&l instanceof ct&&i.has(l)&&(l.getChildrens().forEach(u=>{u.forEach(d=>{n.delete(d)})}),t.indexOf(l)<0&&t.push(l)),l!=null&&l instanceof ct&&!e.has(l)&&!i.has(l)&&(l.onlyOneChilds()==null?n.add(a):t.push(a),i.add(l))}for(let a of n)t.push(a);return t}var sN=class{constructor(t,e,r=!1){this.isBBox=!1;this.result=new $1;this.copperParent={};this.copperFills={};this.insideCopperParent={};this.range=t,this.pl=e,this.isBBox=r,this.bbox=e.bbox()}setResult(t){this.result=t}getResult(){return this.result}doAction(t){if(t.isEmpty)return;let e=t.getParent(),r=t.model;if(r instanceof ki)if(e==null){let i=r.modelType;if(this.isBBox&&t.buildBBox().isInside(this.bbox)){switch(i){case"Polygon":case"Rect":case"Circle":if(t.type=="Copper Region"&&t.getViewState()=="Not Shown")return}return this.result.doAction(t)}switch(i){case"Track":case"ArcTrack":case"Image":case"Picture":case"Length Dimension":case"Smart Dimension":case"Protractor Dimension":case"Radius Dimension":case"Component":case"Text":{let n=t.getMathGraphics(t.layerId,0);return this.checkRange(n)?this.result.doAction(t):void 0}case"Pad":{if(gr(t.layerId)){let n=t.getMathGraphics(1,0);if(this.checkRange(n))return this.result.doAction(t);let s=t.getMathGraphics(2,0);if(this.checkRange(s))return this.result.doAction(t);let a=t.getOneInnerInUse();if(a){let l=t.getMathGraphics(a,0);if(this.checkRange(l))return this.result.doAction(t)}}else{let n=t.getMathGraphics(t.layerId,0);if(this.checkRange(n))return this.result.doAction(t)}return}case"Via":{let n=t.getMathGraphics(t.startLayer,0);return this.checkRange(n)?this.result.doAction(t):void 0}case"Polygon":case"Rect":case"Circle":{let n=t,s=n.getMathGraphics(n.layerId,0);if(n.type=="Line"||n.type=="Board Outline"||n.type=="3D Shell - Outline"||n.type=="Copper Region"||n.type=="Annotation"){if(n.type=="Copper Region"&&n.getViewState()=="Not Shown")return;let a=new Array;for(let l of s.primitives){let c=l.stroke(n.strokeWidth,kr.ROUND,le.CCW);a.push(c)}if(this.checkRange1(a))return this.result.doAction(n)}else{let a=s instanceof Gt?s.items:[s];if(this.checkRange1(a))return this.result.doAction(n)}return}case"Copper":return;case"Inner":{let n=t.model.getOutline();return this.checkRange1(n)?this.result.doAction(t):void 0}case"Ratline":{let n=t;if(this.range=="Inside"){if(this.bbox.isContains(n.start)&&this.bbox.isContains(n.end))return this.result.doAction(t)}else{if(this.bbox.isContains(n.start)||this.bbox.isContains(n.end))return this.result.doAction(t);{let s=new M(n.start,n.end);for(let a of this.pl.primitives)if(Tt(a,s)>0)return this.result.doAction(t)}}return}default:return}}else{if(t instanceof ii){if(!t.isVisible)return;if(this.range==="Inside"){let n=this.copperFills[e.globalIndex];n||(n=this.copperFills[e.globalIndex]=new Set,this.insideCopperParent[e.globalIndex]=e),n.add(t.globalIndex);return}else if(this.isBBox){if(this.copperParent[e.globalIndex])return;if(t.buildBBox().isInside(this.bbox))return this.copperParent[e.globalIndex]=!0,this.result.doAction(e);let n=t.model.getOutline();this.checkRange1(n)&&(this.result.doAction(e),this.copperParent[e.globalIndex]=!0);return}}let i=!1;if(this.isBBox&&e!=null&&e.buildBBox().isInside(this.bbox)&&(i=!0),e instanceof ct){if(e.getViewState()=="Not Shown")return;if(e.getParent()==null){if(i)return this.result.doAction(e);let s=t.getMathGraphics(t.layerId,0),a=s instanceof Gt?s.items:[s];if(this.checkRange1(a))return this.result.doAction(t)}}else if(t instanceof fr){let n=!1;if(this.isBBox&&t.buildBBox().isInside(this.bbox))n=!0;else{let s=t.getMathGraphics(t.layerId,0);n=this.checkRange(s)}if(n)return e instanceof Me&&!t.key?void 0:this.result.doAction(t)}else if(t instanceof Le){if(i)return this.result.doAction(t);if(this.isBBox&&t.buildBBox().isInside(this.bbox))return this.result.doAction(t);if(gr(t.layerId)){let n=t.getMathGraphics(1,0);if(this.checkRange(n))return this.result.doAction(t);let s=t.getMathGraphics(2,0);if(this.checkRange(s))return this.result.doAction(t);let a=t.getOneInnerInUse();if(a){let l=t.getMathGraphics(a,0);if(this.checkRange(l))return this.result.doAction(t)}}else{let n=t.getMathGraphics(t.layerId,0);if(this.checkRange(n))return this.result.doAction(t)}}else if(t instanceof Ge){if(i)return this.result.doAction(t);if(this.isBBox&&t.buildBBox().isInside(this.bbox))return this.result.doAction(t);let n=t.getMathGraphics(t.startLayer);if(this.checkRange(n))return this.result.doAction(t)}}}doCopperAction(){for(let t in this.copperFills){let e=this.insideCopperParent[t].getCopperResult();(e?e.size:0)===this.copperFills[t].size&&this.result.doAction(this.insideCopperParent[t])}}checkRange(t){return this.range=="NotOutSide"?this.intersection(t):this.inner(t)}checkRange1(t){return this.range=="NotOutSide"?this.intersection1(t):this.inner1(t)}intersection(t){return yb.build2(this.pl,t).intersection()}intersection1(t){return yb.build3([this.pl],t).intersection()}inner(t){return yb.build2(this.pl,t).inInner()}inner1(t){return new fc(this.pl,new Gt(t),0).relation==1}};var RRt=["Track","ArcTrack","Pad","Via","Polygon","Circle","Rect","Copper","Inner"],Wr=class o{static getSelectInside(t,e={}){let{boxChoose:r=!0,isBBox:i=!1,model:n=dm}=e;if(t==null)return[];let a=o.rtreeSearchInside(t,i,r).getResult(o.validType||n);return a=o.filterComponentVisible(a,t,"inside"),$t.filterElement(a,{boxChoose:!0})}static filterComponentVisible(t,e,r){let i=new Set,n={};t.forEach(l=>{let c=l,h=l.getParent();if(h!==null&&h instanceof Me&&(c=h),c instanceof Me){let u=Ol(c.buildBBox()),d=new Fs(u,e,0);d.relation==2?i.add(c):d.relation!=3&&(n[c.globalIndex]||(n[c.globalIndex]=c))}l instanceof Me||i.add(l)});let s=Object.values(n),a={};s.forEach(l=>{a[l.footprintUUID]?a[l.footprintUUID].push(l):a[l.footprintUUID]=[l]});for(let l in a){let c=a[l];for(let h of c)h.isBoxSelect(e,r)&&i.add(h)}return i}static rtreeSearchInside(t,e=!1,r=!0){let i=t.bbox(),n=r?r4:oj,s=Vt.searchInside(i,(h,u)=>n.includes(u),!1),a=new sN("Inside",t,e);s.setAction(a),s.doAction(n),a.doCopperAction();let{lines:l,arcs:c}=this.rtreeSearchNotOutsideChildren(i);return l.forEach(h=>{a.getResult().lines.add(h)}),c.forEach(h=>{a.getResult().arcs.add(h)}),a.getResult()}static rtreeSearchNotOutsideChildren(t,e=!1,r=!0){let i=Vt.searchIntersectByType(t,["Polygon"]),n=[],s=[],a=l=>{l.model.bbox.isInside(t)&&(l instanceof mt?n.push(l):s.push(l))};for(let l of i.polygons)if(l.getViewState()!=="Not Shown")for(let c of l.childrens)if(Array.isArray(c))for(let h of c)a(h);else a(c);return{lines:n,arcs:s}}static rtreeSearchNotOutside(t,e=!1,r=!0){let i=t.bbox(),n=r?r4:oj,s=Vt.search(i,(l,c)=>c&&n.includes(c),!1),a=new sN("NotOutSide",t,e);return s.setAction(a),s.doAction(n),a.getResult()}static rtreeSearchNotOutsideForComponent(t,e,r=!1){let i=e.bbox(),n=Vt.search(i,(a,l)=>a===t&&l==="Component",!1),s=new sN("NotOutSide",e,r);return n.setAction(s),n.doAction(["Component"]),s.getResult().components}static getSelectContect(t,e={}){let{boxChoose:r=!0,isBBox:i=!1}=e;if(t==null)return new Set;let s=o.rtreeSearchNotOutside(t,i,r).getResult(o.validType||dm);return s=o.filterComponentVisible(s,t,"contact"),s}static pointSelectBeforeFilter(t,e){let r=Ni().getScale(),i=1;isNaN(r)||(i=1/r,i=i<1?1:i),r>10&&(i=.1);let n=new ut(t,t,e,e),s=n.extendOfSize(i),a=Vt.search(s,void 0,!1),l=new $1,c=new sN("NotOutSide",Ol(n),!0);return c.setResult(l),a.setFilter(new vd).setFilter(new a0(t,e,!0)).setAction(l),a.doAction(o.validType||dm),a.clearFilter(),a.clearAction(),a.setAction(c),a.doAction(S0),l}static wirePointSelect(t,e){let r=Ni().getScale(),i=1;isNaN(r)||(i=1/r,i=i<1?1:i);let n=new ut(t,t,e,e).extendOfSize(i);r>10&&(n=new ut(t,t,e,e).extendOfSize(.1));let s=Vt.search(n,(l,c)=>c&&Tre.includes(c),!1),a=new $1;return s.setFilter(new vd).setFilter(new a0(t,e,!0)).setAction(a),s.doAction(r4),a}static handleClickPourOutline(t,e){if(t)for(let r of t){let i=r.getParent()?r.getParent():r;i instanceof ct&&i.type=="Copper Region"&&(i.isSelectPolygon=e)}}static handleClickPour(t,e){if(t.length!==1)return t;let r=t[0];if(!(r instanceof ii))return t;let i=!1,n=new Set,s=r.getParent().globalIndex;e.forEach(l=>{var c;if(l.globalIndex==s){i=!0;return}l instanceof ii&&((c=l.getParent())==null?void 0:c.globalIndex)==s&&n.add(l)});let a=n.size;return i?a==0?[r]:n.has(r)?[r.getParent()]:[r]:a==0?[r.getParent()]:n.has(r)?[r.getParent()]:[r]}static handleCtrlClickPour(t,e){if(t.length!==1)return t;let r=t[0];if(!(r instanceof ii))return t;if(e.length===0)return[r.getParent()];{let i=!1,n=!1;for(let s of e){if(s instanceof ii){i=!0;break}if(s instanceof Ye&&s.type=="Copper Region"){n=!0;break}}return i&&n?[r.getParent()]:i?t:[r.getParent()]}}static pointSelect(t,e,r,i){let n=o.pointSelectBeforeFilter(t,e),s=new Set;if($t.getVisible(35)&&$t.getPick(35)&&(s=n.drcs),s.size&&(typeof r>"u"||r===!1))return Array.from(s);let a=Array.from(n.getResult(r4));x.getInstance().envFlag==="cnc-preview"&&(a=a.filter(m=>{let g=!1;if(m instanceof ct?g=m.isClose():m instanceof Sr&&(g=!0),g){let y=m instanceof ct||m instanceof Sr?m:m.getParent();if(y instanceof ct||y instanceof Sr){let b=y.getComponent();return!(b&&b instanceof wl)}return!0}return!1}));let c=new Array,h=new Array;for(let m of a)m.isSelect(t,e)?c.push(m):h.push(m);let u;c.length>0?(u=$t.pointFilter(t,e,c,r,i),u.length==0&&(u=$t.pointFilter(t,e,h,r,i))):u=$t.pointFilter(t,e,h,r,i);let d=[].concat(r===!0?Array.from(s):[],u),p=new Set;if(r)d.forEach(m=>{if(m instanceof ii){let g=m.getParent();g&&p.add(g)}p.add(m)});else return d;return Array.from(p)}static getDrcAssoicItems(t){let e=new Set,r=new er;for(let i of t){if(!(i instanceof qp))continue;let n=i.contentModel;if(n instanceof Ky){let d=n.obj1,p=r.getItem(d);p&&e.add(p);continue}if(n instanceof Jy){let d=r.getItemsByNet([n.net_P]),p=r.getItemsByNet([n.net_N]);for(let m of d)e.add(m);for(let m of p)e.add(m);continue}if(n instanceof eb){let d=r.getItemsByNet([n.net]);for(let p of d)e.add(p);continue}if(n instanceof xT){let d=r.getItemsByNet([n.net]);for(let p of d)e.add(p);continue}let s=n.obj,a=r.getItem(s);a&&e.add(a);let l=n.obj1,c=n.obj2,h=r.getItem(l);h&&e.add(h);let u=r.getItem(c);u&&e.add(u)}return Array.from(e)}static filterPartiton(t){let e=[];for(let r=0;r<t.length;r++){let i=t[r];if((i instanceof nr||i instanceof Sr||i instanceof ct)&&i.type==="Partition")continue;let n=i.getParent();n&&(n instanceof nr||n instanceof Sr||n instanceof ct)&&n.type==="Partition"||e.push(t[r])}return e}static selectNet(t,e){let r=new Array,i=Ni().getScale(),n=1;isNaN(i)||(n=1/i,n=n<1?1:n),i>10&&(n=.1);let s=new ut(t,t,e,e).extendOfSize(n),a=Vt.search(s,void 0,!1),l=new $1;return a.setFilter(new vd).setFilter(new a0(t,e)).setAction(l),a.doAction(dm),$t.selectNetFilter(t,e,l.getResult(dm))}static selectPad(t,e){let r=new Array,i=Ni().getScale(),n=1;isNaN(i)||(n=1/i,n=n<1?1:n);let s=new ut(t,t,e,e).extendOfSize(n),a=Vt.search(s,(l,c)=>c=="Pad",!1);for(let l of a.pads)l.isEmpty||!l.isVisible||l.isSelect(t,e)&&r.push(l);return r}static selectPadCenter(t,e){let r,i=Ni().getScale(),n=1;isNaN(i)||(n=1/i,n=n<1?1:n);let s=new ut(t,t,e,e).extendOfSize(n),a=Vt.search(s,(c,h)=>h=="Pad",!1),l=0;for(let c of a.pads){if(c.isEmpty||!c.isVisible||!c.isSelect(t,e))continue;let h=c.center.distance1(new S(t,e));(!l||h<l)&&(l=h,r=c)}return r}static checkIntersection(t,e){let r=new Set;return e.forEach(i=>{Jx(t.model,i.model,!1)&&r.add(i)}),r}static getTouchItems(t){_u.getInstance().clear();let e=new Set;t=[$t.filterActiveLayer(t)];let r=new Array,i=new Map,n=be.getActiveLayerID(),s=new Map;function a(l){if(!e.has(l)){let c=s.get(l.net);c==null&&(c=Mh.getConnect(l.net),s.set(l.net,c));let h=l instanceof Le&&!l.plated;for(let u of c)if(u.set.has(l.globalIndex)){let d=new er,p=!0;for(let[m,g]of u.padMap){let y=i.get(m);if(y==null){if(h){g.has(n)?i.set(m,g):p=!1;continue}i.set(m,g)}else{if(h){g.has(n)?Re.addAllSet(y,g):p=!1;continue}Re.addAllSet(y,g)}}if(!p)continue;for(let m of u.set){let g=d.getConnectNode(m);g instanceof ds&&!e.has(g)&&(e.add(g),r.push(g))}}}}for(let l of t){let c=be.getLayer(l.layerId);(l instanceof Ue||l instanceof Ge||l instanceof Le||l instanceof Ye&&c&&c.isSignalLayer())&&(e.has(l)||a(l),e.add(l),r.push(l))}for(;r.length>0;){let c=function(g,y){if(l instanceof Ue)return g==l.layerId||g==12;if(l instanceof Le){if(!l.plated){let b=i.get(l.globalIndex);if(b!=null)return g==12||b.has(g)}return l.layerId==12||l.layerId==g}else return l instanceof Ge?l.isContains(g)||g==12:l instanceof Ye?g==l.layerId||g==12:l instanceof A0?g==l.layerId||g==12:!1},d=function(g,y,b=!0){let P=new Hd;return P.whetherCheckNet=b,P.needCheckIntersection(g,y)?new Uy().checkIntersection(g,y):!1},p=function(g,y){let b=new Set;return y.forEach(P=>{d(g.model,P.model,!1)&&b.add(P)}),b},l=r.shift();l.net!=""&&l.net!=null&&!e.has(l)&&a(l),e.add(l);let h=Vt.search4Types(l.buildBBox(),RRt,c),u=new Array;for(let g of h.getResult(dd))g instanceof ds&&!e.has(g)&&u.push(g);let m=p(l,u);for(let g of m)g instanceof ds&&!e.has(g)&&r.push(g)}return e}};function Phe(o,t,e=!1,r){let i=new Set;Ve.getSelects().forEach(a=>{i.add(a)}),Wr.handleClickPourOutline(r,!0);let n=Array.from(Wr.pointSelect(o,t));r&&(n=Wr.handleCtrlClickPour(n,r)),Wr.handleClickPourOutline(r,!1),n=n.filter(a=>!Lo.isAnnotation(a));let s=!0;for(let a of n){if(a instanceof mt||a instanceof vt){let l=a.getParent();if(i.has(l))continue}else if(a instanceof ct){let l=a.selectChild(o,t);if(i.has(l))continue}if(!i.has(a)){s=!1;break}}if(s){for(let a of n){if(a.visible(),a instanceof mt||a instanceof vt){let l=a.getParent();l!=null&&i.has(l)&&(l.visible(),i.delete(l))}else if(a instanceof ct){let l=a.selectChild(o,t);i.has(l)&&(l.visible(),i.delete(l))}i.delete(a)}i.forEach(a=>{a.click()}),A.publish("select",i),Pr.model=1}else{for(let l of n)i.add(l);let a=$t.filterParent(new Set(_P(i)));e&&(a=i),a.forEach(l=>{l.click()}),A.publish("select",a),Pr.model=1}}var The=class{constructor(t){this.id=t}};function cw(){return A.windowBridge.rpcCall("getLanguage","",j0())}function Dp(o,t,e){let i=new er().getItem(o),n=e!=null?e:i.net?`(${i.net})`:"",s;if(i instanceof ii?s=`${ur}${i.getParent().number}${ur}${i.number}`:s=`${ur}${i.number}`,i instanceof Ri){let a=i.getParent();a instanceof Me?s=`${a.name}_${i.num}`:i.isTestPad&&(s=`${ur}${i.number}`)}else i instanceof Me&&(s=i.name);return{typeName:t,suffix:`${n}: ${s}`}}function xje(o,t){let e=i(o),r=i(t);return e&&r&&e==r;function i(n){let a=new er().getItem(n);if(a){let l=a.getParent();if(l){if(l instanceof Me)return l;let c=l.getParent();if(c&&c instanceof Me)return c}}return!1}}function LG(o){let t=o.contentModel,e=xje(t.obj1,t.obj2),r=la(t.minDistance,x.getInstance().unit),i=">= "+la(t instanceof sf?t.clearance:t.distance,x.getInstance().unit),n;if(t.obj1Type=="Prohibited Region"||t.obj2Type=="Prohibited Region"){let l=typeof t.obj1<"u"?Dp(t.obj1,t.obj1Type).suffix:"",c=typeof t.obj2<"u"?Dp(t.obj2,t.obj2Type).suffix:"";return n={str:"{obj1} and {obj2} overlap",param:{obj1:"Object 1",obj2:"object 2"},errData:{...t.toJSON(),obj1Suffix:l,obj2Suffix:c}},n}let s=typeof t.obj1<"u"?Dp(t.obj1,t.obj1Type).suffix:"",a=typeof t.obj2<"u"?Dp(t.obj2,t.obj2Type).suffix:"";return n={str:e?"{obj1} to {obj2} in the same footprint distance is {minDistance}, should be {shouldBe}":"{obj1} to {obj2} distance is {minDistance}, should be {shouldBe}",param:{minDistance:r,shouldBe:i,obj1:"Object 1",obj2:"object 2",type:"ClearanceError"},errData:{...t.toJSON(),obj1Suffix:s,obj2Suffix:a}},n}function DRt(o){let t=o.contentModel,e=la(t.minDistance,x.getInstance().unit),r=">= "+la(t.clearance,x.getInstance().unit),i=typeof t.obj1<"u"?Dp(t.obj1,t.obj1Type).suffix:"",n=typeof t.obj2<"u"?Dp(t.obj2,t.obj2Type).suffix:"";return{str:"{obj1} to {obj2} creepage is {minDistance}, should be {shouldBe}",param:{minDistance:e,shouldBe:r,obj1:"Object 1",obj2:"object 2",type:"CreepageError"},errData:{...t.toJSON(),obj1Suffix:i,obj2Suffix:n}}}function wRt(o){let t=o.contentModel,e=">= "+la(t.clearance,x.getInstance().unit),r=la(t.minDistance,x.getInstance().unit),i=typeof t.obj1<"u"?Dp(t.obj1,t.obj1Type).suffix:"",n=typeof t.obj2<"u"?Dp(t.obj2,t.obj2Type).suffix:"";return{str:"{obj1} to {obj2} distance is {minDistance}, should be {shouldBe}",param:{minDistance:r,shouldBe:e,obj1:"Object 1",obj2:"object 2",type:"ClearanceError"},errData:{...t.toJSON(),obj1Suffix:i,obj2Suffix:n}}}function dOe(o){let t=o.contentModel,e=la(t.width,x.getInstance().unit),r=la(t.minWidth,x.getInstance().unit),i=la(t.maxWidth,x.getInstance().unit),n=`${r} ~ ${i}`;return{str:"{obj1} stroke width is {width}, should be {shouldBe}",param:{width:e,shouldBe:n,obj1:"Object 1",type:"TrackError"},errData:{...t.toJSON()}}}function pOe(o){let t=o.contentModel,e=la(t.width,x.getInstance().unit),r=la(t.minWidth,x.getInstance().unit),i=la(t.maxWidth,x.getInstance().unit),n=`${r} ~ ${i}`;return{str:"{obj1} stroke width is {width}, should be {shouldBe}",param:{width:e,shouldBe:n,obj1:"Object 1",type:"DifferentPairWidthError"},errData:{...t.toJSON()}}}function fOe(o){let t=o.contentModel,e=Math.abs(t.value_P-t.value_N),r=la(e,x.getInstance().unit),n=`<=${la(t.toleranceScope,x.getInstance().unit)}`;return{str:"{obj1} to {obj2} length tolerance is {width}, should be {shouldBe}",param:{width:r,shouldBe:n,obj1:"Object 1",obj2:"object 2",type:"DifferentPairLengthError"},errData:{...t.toJSON()}}}function mOe(o){let t=o.contentModel;return{str:"{obj1} layer pair is {startLayer} - {endLayer}, which is not allowed by the rule",param:{startLayer:be.getLayer(t.startLayer).name,endLayer:be.getLayer(t.endLayer).name,obj1:"Object 1",type:"BlindError"},errData:{...t.toJSON()}}}function gOe(o){let t=o.contentModel,e=la(t.maxRadius*2,x.getInstance().unit),r=la(t.minRadius*2,x.getInstance().unit),i=la(t.radius*2,x.getInstance().unit),n=t.type?"outer":"inner",s=`${r} ~ ${e}`;return{str:t.type?"The outer diameter of the via hole of {obj1} is {diameter}, which should be {shouldBe}":"The inner diameter of the via hole of {obj1} is {diameter}, which should be {shouldBe}",param:{outerOrInner:n,diameter:i,shouldBe:s,obj1:"object 1",type:"RadiusError"},errData:{...t.toJSON()}}}function yOe(o){let t=o.contentModel,e=la(t.minNetLength,x.getInstance().unit),r=la(t.maxNetLength,x.getInstance().unit),i=la(t.netLength,x.getInstance().unit),n=`${e} ~ ${r}`;return{str:"{obj1} net length is {netLength}, should be {shouldBe}",param:{netLength:i,shouldBe:n,obj1:"Object 1",type:"NetLengthError"},errData:{...t.toJSON()}}}function bOe(o){let t=o.contentModel,e=typeof t.obj1<"u"?Dp(t.obj1,t.obj1Type).suffix:"";return{str:t.errInfo,param:{obj1:"Object 1",type:"ConnectError"},errData:{...t.toJSON(),obj1Suffix:e}}}function LRt(o){let t=o.contentModel,e=typeof t.obj1<"u"?Dp(t.obj1,t.obj1Type).suffix:"";return{str:"{obj1} is copper bridge, but has no connected to {net} net",param:{obj1:"Object 1",type:"ConnectError",net:t.net},errData:{...t.toJSON(),obj1Suffix:e}}}function Rje(o){let t=o.contentModel;return{str:"PCB Netlist and schematic netlist does not match",param:{},errData:{...t.toJSON()}}}function MRt(o,t){let e=t.getItem(o.obj1).model,r=t.getItem(o.obj2).model,i=oi.isBridgingCopper(e),n=oi.isBridgingCopper(r),s=Dp(o.obj1,o.obj1Type),a=Dp(o.obj2,o.obj2Type);if(i&&n){let l=e.component.networkList,c=r.component.networkList,h=o.net,u=(d,p)=>{s=Dp(o.obj1,o.obj1Type,d),a=Dp(o.obj2,o.obj2Type,p)};l.includes(h)&&!c.includes(h)?u(h,c[0]):!l.includes(h)&&c.includes(h)?u(l[0],h):l.includes(h)&&c.includes(h)&&u(h,c.find(d=>d!==h))}else if(i||n){let l=o.net;i?s=Dp(o.obj1,o.obj1Type,l):a=Dp(o.obj2,o.obj2Type,l)}return{obj1:s,obj2:a}}function Ihe(o){return new Promise(async(t,e)=>{let r="$$ getAllDrcErrors-time";pn(r);let{isOpenDRCCustomCheck:i}=o||{};x3.isOpenDRCCustomCheck=i;let n=new Set;Vt.itoratorAllItems(D=>{n.add(D.item)}),Au.reset(),sn.getInstance().language=(await cw()).message||"zh-cn",A.publish("progressUpdate",[0,"Design rule check"],$()),await A.messageBus.rpcCall("drc",{items:n,option:{maxProgressFromWorker:.9}}),Eo.deleteAllConnectError(),Yae.checkConnect();let s=[];for(let D of pi.getInstance().idMapConnect.values())s.push(D);Eo.syncFromContentModel(s),A.publish("progressUpdate",[1,"Design rule check"],$());let a=Eo.getAllErrors(),l={},c={},h=[],u={},d=D=>{let w=D.layerIds.length==1?D.layerIds[0]:By(D.layerIds[0],D.layerIds[1]);return be.getLayerName(w)},p=new er;a.clearance.forEach(D=>{let w=D.contentModel,F=xje(w.obj1,w.obj2),H=F?c:l,z=[w.obj1Type,w.obj2Type].sort().join(" to ");H[z]||(H[z]={name:z,list:[]});let G=LG(D),{obj1:W,obj2:L}=MRt(w,p);H[z].list.push({visible:D.isVisible,errorType:F?"Clearance Error in the same footprint":"Clearance Error",errorObjType:z,ruleName:w.name,ruleTypeName:w.errorType,obj1:W,obj2:L,layer:d(w),explanation:G,objs:[w.obj1,w.obj2],globalIndex:w.globalIndex,pos:w.position})}),a.creepage.forEach(D=>{let w=D.contentModel,F=[w.obj1Type,w.obj2Type].sort().join(" to ");u[F]||(u[F]={name:F,list:[]});let H=DRt(D);u[F].list.push({visible:D.isVisible,errorType:"Creepage Error",errorObjType:F,ruleName:w.name,ruleTypeName:w.errorType,obj1:Dp(w.obj1,w.obj1Type),obj2:Dp(w.obj2,w.obj2Type),layer:d(w),explanation:H,objs:[w.obj1,w.obj2],globalIndex:w.globalIndex,pos:w.position})}),a.diff.forEach(D=>{let w=D.contentModel,F=[w.obj1Type,w.obj2Type].sort().join(" to ");h.push({visible:D.isVisible,errorType:"Differential Pair Error",errorObjType:F,ruleName:w.name,ruleTypeName:"Differential Pair",obj1:Dp(w.obj1,w.obj1Type),obj2:Dp(w.obj2,w.obj2Type),layer:d(w),explanation:wRt(D),objs:[w.obj1,w.obj2],globalIndex:w.globalIndex,pos:w.position})});let m=a.track.map(D=>{let w=D.contentModel;return{visible:D.isVisible,errorType:"Physical Error",errorObjType:"Track",ruleName:w.name,obj1:Dp(w.obj1,"Track"),layer:d(w),explanation:dOe(D),objs:[w.obj1],globalIndex:w.globalIndex,pos:w.position}}),g=a.diffPairTrack.map(D=>{let w=D.contentModel;return{visible:D.isVisible,errorType:w.errorType,errorObjType:"Track",ruleName:w.name,ruleTypeName:"Differential Pair",obj1:Dp(w.obj,"Track"),layer:d(w),explanation:pOe(D),objs:[w.obj],globalIndex:w.globalIndex,pos:w.position}}),y=new Set;a.diffPairLength.map(D=>{let w=D.contentModel;y.has(w)||(y.add(w),h.push({visible:D.isVisible,errorType:w.errorType,errorObjType:"Track to Track",ruleName:w.name,ruleTypeName:"Differential Pair",obj1:{suffix:`(${w.net_P})`,typeName:"Track"},obj2:{suffix:`(${w.net_N})`,typeName:"Track"},explanation:fOe(D),objs:[w.net_P,w.net_N],globalIndex:w.globalIndex,globalIndexIsNet:!0,pos:w.position}))});let b=a.blind.map(D=>{let w=D.contentModel;return{visible:D.isVisible,errorType:"Physical Error",errorObjType:"Blind",ruleName:w.name,obj1:Dp(w.obj,"Via"),explanation:mOe(D),objs:[w.obj],globalIndex:w.globalIndex,pos:w.position}}),P=a.radius.map(D=>{let w=D.contentModel;return{visible:D.isVisible,errorType:"Physical Error",errorObjType:"Via Size",ruleName:w.name,obj1:Dp(w.obj1,"Via"),explanation:gOe(D),objs:[w.obj1],globalIndex:w.globalIndex,pos:w.position}}),T=a.netLength.map(D=>{let w=D.contentModel;return{visible:D.isVisible,errorType:"Physical Error",errorObjType:"Net Length Range",ruleName:w.name,obj1:{typeName:"Net",suffix:`: ${w.net}`},explanation:yOe(D),objs:[w.net],globalIndex:w.globalIndex,globalIndexIsNet:!0,pos:w.position}}),I=a.netLengthTolerance.map(D=>{let w=D.contentModel,F=la(w.netLengthDiff,x.getInstance().unit),H=la(w.netLengthTolerance,x.getInstance().unit),z=`\xB1${H}`;return{visible:D.isVisible,errorType:"Physical Error",errorObjType:"Net Length Tolerance",ruleName:w.name,obj1:{typeName:"Net",suffix:`: ${w.net}`},explanation:{str:"{obj1} net length tolerance is {netLengthDiff}, should be {shouldBe}",param:{obj1:"Object 1",netLengthDiff:F,shouldBe:z}},objs:[w.net],globalIndex:w.globalIndex,globalIndexIsNet:!0,pos:w.position}}),C={};a.connect.forEach(D=>{let w=D.contentModel;if(C[w.net]||(C[w.net]={name:w.net,list:[],doNotTranslate:!0}),w.obj1Type=="Bridging Copper"){C[w.net].list.push({visible:!0,errorType:"Connection Error",errorObjType:"Fill Region",ruleName:"Common",obj1:{suffix:`(${w.net})`,typeName:"Fill Region"},obj2:{suffix:`(${w.net})`,typeName:"Net"},layer:d(w),isFree:!0,net:w.net,explanation:LRt(D),objs:[w.obj1],globalIndex:w.globalIndex,pos:w.position});return}let F={};w.obj1==""?F={suffix:`(${w.net})`,typeName:w.obj1Type}:F=Dp(w.obj1,w.obj1Type),C[w.net].list.push({visible:!0,errorType:"Connection Error",errorObjType:w.obj1Type,ruleName:"Common",obj1:F,isFree:w.isFree,net:w.net,explanation:bOe(D),objs:[w.obj1],globalIndex:w.globalIndex,pos:w.position})});let E=[{name:"Track",list:m},{name:"Net Length Range",list:T},{name:"Net Length Tolerance",list:I},{name:"Blind/Buried Via",list:b},{name:"Via Diameter",list:P}].filter(D=>D.list.length>0),O=[{name:"Track",list:g},{name:"Track to Track",list:h}].filter(D=>D.list.length>0);A.publish("updateFrame","");let _=[],R=a.netlist[0];R&&_.push({name:"Netlist Error",list:[{visible:R.isVisible,errorType:"Netlist Error",errorObjType:"Netlist Error",ruleName:"Import Changes",ruleTypeName:"Import Changes",obj1:{typeName:"Schematic Netlist",suffix:""},obj2:{typeName:"PCB Netlist",suffix:""},objs:[R.globalIndex],explanation:{str:'PCB and schematic netlist does not match. You can click on the rule name "Import Changes" to view the difference.',param:{}},globalIndex:R.globalIndex}]});let v=[{name:"Clearance Error",list:Object.values(l),visible:!0},{name:"Clearance Error in the same footprint",list:Object.values(c),visible:!0},{name:"Physical Error",list:E,visible:!0},{name:"Differential Pair Error",list:O,visible:!0},{name:"Connection Error",list:Object.values(C),visible:!0},{name:"Netlist Error",list:Object.values(_),visible:!0},{name:"Creepage Error",list:Object.values(u),visible:!0}];t(v),Bi(r)})}var Che=class extends The{constructor(){super(...arguments);this._openTimeOut=null;this._closeTimeOut=null;this.openFlag=!1}open(e,r,i){this.openFlag=!0;let n=Fo(new S(e,r));A.windowBridge.publish("openDialogWithTest",{data:i,position:n},$()),clearTimeout(this._closeTimeOut),this._closeTimeOut=setTimeout(()=>{this.destroy()},5e3)}interrupt(){this.openFlag&&(A.windowBridge.publish("closeDialogWithTest","",$()),clearTimeout(this._closeTimeOut),clearTimeout(this._openTimeOut),this.openFlag=!1)}destroy(){this.interrupt()}rerender(e,r){this.openFlag=!0;let i=this;clearTimeout(this._openTimeOut),this._openTimeOut=setTimeout(()=>{if(!ce.pcbConfig.displayProperty)return;let n=this.getData(e,r);n.length>0&&this.open(e,r,n)},500)}getData(e,r){let i=new Array,n=Wr.pointSelect(e,r,void 0,!0);if(n.length<=0)return i;if(n[0]instanceof qp){let s=n[0],a=s.contentModel,l={str:"",param:{}};a instanceof sf?l=LG(s):a instanceof Ky?l=bOe(s):a instanceof Zy?l=LG(s):a instanceof Jy?l=fOe(s):a instanceof Qy?l=pOe(s):a instanceof eC?l=LG(s):a instanceof eb?l=yOe(s):a instanceof eV?l=LG(s):a instanceof tb?l=gOe(s):a instanceof rb?l=dOe(s):a instanceof rP?l=mOe(s):a instanceof s3&&(l=Rje(s)),i.push({title:"DRC",hiddenTitle:!0,id:"",content:[{module:"DRC",label:"DRC",value:"",sourceData:l,needTranslate:!0}]})}else{let s=null;for(let c=0;c<n.length;c++)if(n[c].net!==void 0){s=n[c].net;break}let a=[7,8,12],l=n[0].getGroupID();for(let c of a)if($t.getPick(c)){let h=this.getContent4Element(c,s,l);h.length>0&&i.push({title:this.getTitle4Element(c),id:"",content:h})}if(i.length==0)for(let c of n){let h=this.getContent4PcbItem(c);h.length>0&&i.push({title:this.getTitle4PcbItem(c),id:c.globalIndex,content:h})}}return i}getContent4Element(e,r,i){let n=new Array;switch(e){case 7:{if(r){let s=this.getContent("Net",r);n.push(s)}return n}case 8:{let s=ze.getNetLength(r),a=this.getContent("Net",r),l=this.getContent("Net Length",Xe(s)+x.getInstance().unit);return n.push(a),n.push(l),n}case 12:{if(i!=null){let s=this.getContent("Group Name",kt.getGroupNameByGroupId(i));n.push(s)}return n}default:return[]}}getTitle4Element(e){switch(e){case 7:return"Pad Pair";case 8:return"Net";case 12:return"Combination";default:return""}}getTitle4PcbItem(e){if(e instanceof Ue)return"Track";if(e instanceof Ge)return"Via";if(e instanceof Le)return e.isTestPad?"Test Point":"Pad";if(e instanceof Me)return"Component";if(e instanceof Ye)return this.getProfiltTitle(e);if(e instanceof mt||e instanceof vt){let r=e.getParent();return r!=null&&r instanceof Ye?this.getProfiltTitle(r):""}else{if(e instanceof fr)return"Text";if(e instanceof va)return"Dimension";if(e instanceof Yn)return"Image";if(e instanceof Rs)return"Colorful Image";if(e instanceof Ki)return"Plane Zone";if(e instanceof ii)return"Copper Fills"}}getContent4PcbItem(e){if(e instanceof Ue)return this.getTrackContent(e);if(e instanceof Ge)return this.getViaContent(e);if(e instanceof Le)return this.getPadContent(e);if(e instanceof Me)return this.getComponentContent(e);if(e instanceof Ye)return this.getProfileContent(e);if(e instanceof mt||e instanceof vt){let r=e.getParent();return r!=null&&r instanceof Ye?this.getProfileContent(r):[]}else{if(e instanceof fr)return this.getTextContent(e);if(e instanceof va)return this.getDimensionContent(e);if(e instanceof Yn)return this.getImageContent(e);if(e instanceof Rs)return this.getImageContent(e);if(e instanceof Ki)return this.getPlaneZoneContent(e);if(e instanceof ii)return this.getCopperResultContent(e)}return[]}is2DLine(e){return e=="Board Outline"||e=="Slot Region"||e=="Copper Region"||e=="Fill Region"||e=="Prohibited Region"||e=="Line"}getProfiltTitle(e){let r=e.type;return this.is2DLine(r)?"Outline Object":r=="3D Shell - Outline"?"3D Shell - Outline":r=="3D Shell - Screw Pillar"?"3D Shell - Screw Pillar":r=="3D Shell - Side Datum Line"?"3D Shell - Side Datum Line":r=="3D Shell - Top Slot Region"||r=="3D Shell - Side Slot Region"?"3D Shell - Slot Region":r=="3D Shell - Top/Bottom Entity"||r=="3D Shell - Side Entity"?"3D Shell - Entity":r=="FPC Stiffener"?"FPC Stiffener":r=="TearDrop"?"Teardrop":""}getContent(e,r){return{label:e,value:r,module:"COMMON"}}getTrackContent(e){let r=ze.getNetLength(e.net),i=this.getContent("Width",Xe(e.width)+x.getInstance().unit),n=this.getContent("Net",e.net),s=this.getContent("Layer",be.getLayerName(e.layerId)),a=this.getContent("Net Length",Xe(r)+x.getInstance().unit);return[i,n,s,a]}getViaContent(e){let r=this.getContent("Outside Diameter",Xe(e.radius*2)+x.getInstance().unit),i=this.getContent("Inside Diameter",Xe(e.holeRadius*2)+x.getInstance().unit),n=this.getContent("Layer Pair",be.getLayerName(e.startLayer)+" to "+be.getLayerName(e.endLayer));return[r,i,n]}getPadContent(e){let r=this.getContent("Number",e.num);if(x.getInstance().doctype==3){let i=this.getContent("Net",e.net);return[r,i]}return[r]}getComponentContent(e){let r=this.getContent("Designator",e.designator),i=this.getContent("Footprint",e.footprintId),n=this.getContent("Device",e.device);return[r,i,n]}getProfileContent(e){var i;let r=e.type;if(this.is2DLine(r))return[this.getContent("Type",r)];if(r=="3D Shell - Outline"){let n=e.getComponent(),s=n.type;s=="T&B"?s="Upper and lower shell":s=="DRAWER"&&(s="Push cover");let a=this.getContent("Type",s),l=this.getContent("Overall height of shell",Xe(n.shellHeight)+x.getInstance().unit);return[a,l]}else if(r=="3D Shell - Screw Pillar"){let n=e.getComponent(),s=this.getContent("Screw specifications",n.specification),a=this.getContent("Layer",be.getLayerName(e.layerId));return[s,a]}else{if(r=="3D Shell - Side Datum Line")return[this.getContent("Layer",be.getLayerName(e.layerId))];if(r=="3D Shell - Top Slot Region")return[this.getContent("Type",e.type)];if(r=="3D Shell - Side Slot Region")return[this.getContent("Type",e.type)];if(r=="3D Shell - Top/Bottom Entity"||r=="3D Shell - Side Entity")return[this.getContent("Type",e.type)];if(r==="FPC Stiffener"){let n=e.getComponent(),a=(i=Qu.getMaterialOptions().filter(l=>l.value===n.material)[0])==null?void 0:i.text;return[this.getContent("FPCMaterial",a)]}else if(r=="TearDrop")return this.getTearDropContent(e)}return[]}getTextContent(e){return[this.getContent("Layer",be.getLayerName(e.layerId))]}getDimensionContent(e){let r=this.getContent("Dimension Type",e.type),i=this.getContent("Layer",be.getLayerName(e.layerId));return[r,i]}getImageContent(e){return[this.getContent("Layer",be.getLayerName(e.layerId))]}getPlaneZoneContent(e){return[this.getContent("Net",e.net)]}getTearDropContent(e){return[this.getContent("Net",e.net)]}getCopperResultContent(e){return[this.getContent("Net",e.net)]}};var She=class{constructor(){this.mouseX=0;this.mouseY=0;this.deltaX=0;this.deltaY=0;this.sceneDeltaX=0;this.sceneDeltay=0;this.keyCode=0;this.shiftKey=!1;this.ctrlKey=!1;this.altKey=!1;this.metaKey=!1}};var aN=class aN extends She{constructor(e,r){super();this.realSceneX=0;this.realSceneY=0;this.realSceneDeltaX=0;this.realSceneDeltay=0;this.sceneX=0;this.sceneY=0;this.sceneDeltaX=0;this.sceneDeltaY=0;this.lastSceneX=0;this.lastSceneY=0;this.adsorb=!0;this.adsorbGrid=!0;this.leftDown=!1;this.leftClick=!1;this.rightDown=!1;this.middleDown=!1;this.downTime=0;this.openMenu=!1;this.autoCutSilk=!0;this.boxSelection=!1;this.point=null;this.extensionCord=[];this.crossFlagMax=8;this.crossFlags=[];this.tool=new Che("");this._hovering=!1;this._mouseInFrame=!0;this.canvasWidth=e||0,this.canvasHeight=r||0}static getInstance(){return aN.instance==null&&(aN.instance=new aN(1,1)),aN.instance}get mouseInFrame(){return this._mouseInFrame}set mouseInFrame(e){this._mouseInFrame=e,this.tool.destroy()}get triggerSource(){return this._triggerSource}set triggerSource(e){this._triggerSource=e}get hovering(){return this._hovering}set hovering(e){this._hovering=e,this.tool.destroy()}getShowPoint(){return this.point}showPoint(){this.point!=null?(this.point.visible(),this.point.setPosition(new S(this.sceneX,this.sceneY))):this.point=new qi(1002,new S(this.sceneX,this.sceneY),!1,ee.WHITE)}hidePoint(){this.point!=null&&this.point.hidden()}removePoint(){this.point!=null&&(this.point.remove(),this.point=null)}addCrossFlag(e,r){if(this.hasRepeatCrossFlag(e,r))return;let i=new nF(e,1002,r);this.crossFlags.push(i),this.crossFlags.length>this.crossFlagMax&&(this.crossFlags[0].remove(),this.crossFlags.shift())}clearCrossFlag(){for(let e of this.crossFlags)e.remove();this.crossFlags=[]}hasRepeatCrossFlag(e,r){for(let i of this.crossFlags)if(i.isRepeat(e,r))return!0;return!1}getCrossFlags(){return this.crossFlags}addExtensionCord(e,r=!1){if(this.extensionCord){for(let i of this.extensionCord)i.remove();this.extensionCord=[]}for(let i of[].concat(e))this.extensionCord.push(new Gie(i.start(),i.end(),1002,r))}removeExtensionCord(){for(let e of this.extensionCord)e.remove();this.extensionCord=[]}getExtensionCord(){return this.extensionCord}setIsBoxSelection(e=!1){this.boxSelection=!!e}getIsBoxSelection(){return this.boxSelection}hover(){this._mouseInFrame&&this._hovering&&!this.leftDown&&!this.rightDown?this.tool.rerender(this.realSceneX,this.realSceneY):this.tool.destroy()}};aN.instance=null;var Pi=aN;var POe=Math.sqrt(2)/2,Dje=Math.sqrt(4+2*Math.sqrt(2)),NRt=1/Dje,Cb=Math.PI/2,qT=Math.PI/4,Ehe=Math.PI/8;var Ohe=class{constructor(){this.tool=new no}octagonCenter(t,e,r,i){let n=i==le.CCW?Ehe*5:-Ehe*5,s=e.rotate(S.ORIGIN,n);return t.add(s.mul(r))}octagonRadius(t){let e=Math.sin(Ehe);return t/2/e}octagonDelta(t){let e=Math.cos(Ehe);return t/e}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}isLimit45(t,e,r,i=0){let n=e.sub(t);if(ne.less(n.length(),Dje*i)){let c=e.sub(t).normalize().dot(r);return!!ne.greatereq(c,NRt)}let a=e.sub(t).normalize().dot(r);return!!ne.greatereq(a,POe)}isLimit90(t,e,r,i=0){let n=e.sub(t);if(ne.less(n.length(),POe*i)){let c=e.sub(t).normalize().dot(r);return!!ne.greatereq(c,POe)}let a=e.sub(t).normalize().dot(r);return!!ne.greatereq(a,0)}rectCenter(t,e,r,i){let n=this.rectRadius(r),s=i==le.CCW?Cb+qT:-(Cb+qT),a=e.rotate(S.ORIGIN,s);return t.add(a.mul(n))}rectRadius(t){let e=Math.sin(qT);return t/2/e}getSweep(t,e){return t.cross(e)>0?le.CCW:le.CW}degree45_v1(t){this.fixEnd(t);let{lastDirect:e,start:r,end:i}=t.directInfo;if(t.node.isRight||r.equals1(i)){let d=t.edgeParam.edgeLength*Math.cos(t.edgeParam.angle*2);if(ne.lesseq(t.node.dis,d))return t.directInfo.lastDirect.dot(t.directInfo.nextDirect)>.99?[r,r]:[r,r.add(e.mul(t.edgeParam.delta))]}let n=new Array;n.push(r),r=r.add(e.mul(t.edgeParam.delta)),n.push(r);let s=this.octagonRadius(t.edgeParam.edgeLength),a=this.octagonCenter(r,e,s,t.node.sweep),l=r,c=t.node.sweep==le.CCW?qT:-qT,h=0,u=t.edgeParam.min;for(;!this.isLimit45(l,i,e,u)&&h<8;){let d=l.sub(a).normalize();d=d.rotate(S.ORIGIN,c),e=e.rotate(S.ORIGIN,c),l=a.add(d.mul(s)),n.push(l),h++}return n}degree45_v2(t,e){let{lastDirect:r,start:i}=t.directInfo,n=e.directInfo.start,s=e.directInfo.lastDirect,a=new Array;a.push(i),i=i.add(r.mul(t.edgeParam.delta)),a.push(i);let l=new Array;l.push(n),n=n.add(s.mul(e.edgeParam.delta)),l.push(n);let c=this.octagonRadius(t.edgeParam.edgeLength),h=this.octagonCenter(i,r,c,t.node.sweep),u=this.octagonRadius(e.edgeParam.edgeLength),d=this.octagonCenter(n,s,u,e.node.sweep),p=i,m=n,g=t.node.sweep==le.CCW?qT:-qT,y=e.node.sweep==le.CCW?qT:-qT,b=0,P=this.needRotate(p,m,r),T=this.needRotate(m,p,s);for(;P||T;){if(P){let I=p.sub(h).normalize();I=I.rotate(S.ORIGIN,g),r=r.rotate(S.ORIGIN,g),p=h.add(I.mul(c)),a.push(p),b++}if(T=this.needRotate(m,p,s),T){let I=m.sub(d).normalize();I=I.rotate(S.ORIGIN,y),s=s.rotate(S.ORIGIN,y),m=d.add(I.mul(u)),l.push(m),b++}if(P=this.needRotate(p,m,r),b>16)break}return[a,l]}getDirection(t,e,r){let i=this.tool.degree45(t,e,r);return ia(t,i)[0]}degree45_v3(t,e,r,i){let n=t.direct,s;i?(n=this.getDirection(t.direct,t.start.point,t.end.point),s=eX(t.end.point,t.start.point)):s=t.direct.mul(-1);let a=!t.start.fix&&this.needRotate(t.start.point,t.end.point,t.start.direct)&&!this.isAcuteAngle(t.start.direct,n);(a||t.start.direct.dot(n)<.99&&!t.start.fix)&&(t.start=t.start.getSameDirect(e.edgeParam.delta)),a=!t.start.fix&&this.needRotate(t.start.point,t.end.point,t.start.direct)&&!this.isAcuteAngle(t.start.direct,n);let l=!t.end.fix&&this.needRotate(t.end.point,t.start.point,t.end.direct)&&!this.isAcuteAngle(t.end.direct,s);if(l)t.end=t.end.getSameDirect(r.edgeParam.delta);else{let y;i?y=this.tool.degree45(t.direct,t.start.point,t.end.point):y=this.tool.degree45(t.end.direct,t.end.point,t.start.point);let b=ia(t.end.direct,y),P=i?b[1].mul(-1):b[0];t.end.direct.dot(P)<.99&&!t.end.fix&&(t.end=t.end.getSameDirect(r.edgeParam.delta))}l=!t.end.fix&&this.needRotate(t.end.point,t.start.point,t.end.direct);let c=this.octagonRadius(e.edgeParam.edgeLength),h=this.octagonCenter(t.start.point,t.start.direct,c,e.node.sweep),u=this.octagonRadius(r.edgeParam.edgeLength),d=this.octagonCenter(t.end.point,t.end.direct,u,r.node.sweep),p=e.node.sweep==le.CCW?qT:-qT,m=r.node.sweep==le.CCW?qT:-qT,g=0;for(;a||l;){if(a=!t.start.fix&&this.needRotate(t.start.point,t.end.point,t.start.direct)&&!this.isAcuteAngle(t.start.direct,n),a){let y=t.start.point.sub(h).normalize();y=y.rotate(S.ORIGIN,p);let b=t.start.direct.rotate(S.ORIGIN,p);t.start=t.start.getNext(h.add(y.mul(c))),t.start.direct=b,g++}if(l=!t.end.fix&&this.needRotate(t.end.point,t.start.point,t.end.direct)&&(i&&g==0||!this.isAcuteAngle(t.end.direct,s)),l){let y=t.end.point.sub(d).normalize();y=y.rotate(S.ORIGIN,m);let b=t.end.direct.rotate(S.ORIGIN,m);t.end=t.end.getNext(d.add(y.mul(u))),t.end.direct=b,g++}if(g>16)break}}needRotate90(t,e,r){let i=this.tool.degree90Model(t,e),n=i[0].sub(t),s=i[1].sub(t),a=Math.abs(n.x)<1e-4&&Math.abs(n.y)<1e-4,l=Math.abs(s.x)<1e-4&&Math.abs(s.y)<1e-4,c=n.normalize(),h=s.normalize();return a&&l?!1:(!a&&l?h=c:a&&!l&&(c=h),this.isObtuseAngle(r,c)||this.isObtuseAngle(r,h))}isObtuseAngle(t,e){return t.dot(e)<-.01}needRotate(t,e,r){let i=this.tool.degree45Model(t,e),n=i[0].sub(t),s=i[1].sub(t),a=Math.abs(n.x)<1e-4&&Math.abs(n.y)<1e-4,l=Math.abs(s.x)<1e-4&&Math.abs(s.y)<1e-4,c=n.normalize(),h=s.normalize();if(a&&l)return!1;!a&&l?h=c:a&&!l&&(c=h);let u=this.isAcuteAngle(r,c),d=this.isAcuteAngle(r,h);return!(u&&d)}isAcuteAngle(t,e){return t.dot(e)>.01}fixEnd(t){if(ne.eq(t.node.dis,0))return;let{lastDirect:e,end:r}=t.directInfo;if(t.node.isRight){let i=this.getPoints(t);this.inInner(i,r,t.node.sweep)&&this.fixRightEndpoint(t)}else{let i=1+Math.cos(t.edgeParam.angle*2)*2,n=t.edgeParam.dis2+t.edgeParam.min*i,s=t.edgeParam.dis2+t.directInfo.width;if(ne.less(t.node.dis,n)&&ne.greatereq(t.node.dis,s))t.modifyMin((t.node.dis-t.edgeParam.dis2)/i);else if(ne.less(t.node.dis,s)){t.modifyMin(t.directInfo.width/i);let a=t.node.sweep==le.CCW?new S(-e.y,e.x):new S(e.y,-e.x);t.modifyEnd(r.add(a.mul(s-t.node.dis)))}}}getPoints(t){let e=new Array,r=t.directInfo.start,i=t.directInfo.lastDirect,n=t.edgeParam.delta,s=t.edgeParam.min,a=t.node.sweep;e.push(r);let l=a==le.CCW?t.edgeParam.angle*2:-t.edgeParam.angle*2,c=0,h=s+n*2;r=r.add(i.mul(n)),i=i.rotate(S.ORIGIN,l),e.push(r);do r=r.add(i.mul(h)),i=i.rotate(S.ORIGIN,l),e.push(r),c++;while(c<3);return r=r.add(i.mul(n)),e.push(r),e}inInner(t,e,r){let i=t.length,n=!0;for(let s=0;s<i-1;s++){let a=t[s],c=t[s+1].sub(a),h=e.sub(a);if(n&&(n=r==le.CCW?ne.greatereq(c.cross(h),0):ne.lesseq(c.cross(h),0)),!n)break}if(n){let s=t[0],a=t[i-1],l=s.sub(a),c=e.sub(a);n=r==le.CCW?ne.greatereq(l.cross(c),0):ne.lesseq(l.cross(c),0)}return n}fixRightEndpoint(t){let{start:e,lastDirect:r,end:i}=t.directInfo,{sweep:n}=t.node,{delta:s,min:a}=t.edgeParam,l=n==le.CCW?t.edgeParam.angle*2:-t.edgeParam.angle*2,c=n==le.CCW?-Cb:Cb,h=0,u=a+s*2,d=new Array,[p,m]=this.getProject(e,r,i),g=i.add(r.rotate(S.ORIGIN,c).mul(p)),y=r;e=e.add(r.mul(s)),r=r.rotate(S.ORIGIN,l);do{let[b,P]=this.getProject(e,r,i);b<p&&ne.greater(P,s)&&ne.greater(P,u)&&(g=i.add(r.rotate(S.ORIGIN,c).mul(b)),p=b,y=r),d.push([b,P]),e=e.add(r.mul(u)),r=r.rotate(S.ORIGIN,l),h++}while(h<4);t.modifyEnd(g),t.modifyNextDirect(y)}getProject(t,e,r){let i=r.sub(t),n=Math.abs(e.cross(i)),s=e.dot(i);return[n,s]}degree90_v1(t){this.fixEnd(t);let{lastDirect:e,start:r,end:i}=t.directInfo;if(r.equals1(i))return[r,r];if(t.node.isRight){let d=t.edgeParam.edgeLength*Math.cos(t.edgeParam.angle*2);if(ne.lesseq(t.node.dis,d))return t.directInfo.lastDirect.dot(t.directInfo.nextDirect)>.99?[r,r]:[r,r.add(e.mul(t.edgeParam.delta))]}let n=new Array;n.push(r),r=r.add(e.mul(t.edgeParam.delta)),n.push(r);let s=this.rectRadius(t.edgeParam.edgeLength),a=this.rectCenter(r,e,t.edgeParam.edgeLength,t.node.sweep),l=r,c=t.node.sweep==le.CCW?Cb:-Cb,h=0,u=t.edgeParam.min;for(;!this.isLimit90(l,i,e,u)&&h<4;){let d=l.sub(a).normalize();d=d.rotate(S.ORIGIN,c),e=e.rotate(S.ORIGIN,c),l=a.add(d.mul(s)),n.push(l),h++}return n}degree90_v3(t,e,r){if(t.start.point.equals1(t.end.point))return;let i=t.direct,n=t.direct.mul(-1),s=!t.start.fix&&this.needRotate(t.start.point,t.end.point,t.start.direct)&&!this.isAcuteAngle(t.start.direct,i);(s||t.start.direct.dot(t.direct)<.99&&!t.start.fix)&&(t.start=t.start.getSameDirect(e.edgeParam.delta)),s=!t.start.fix&&this.needRotate(t.start.point,t.end.point,t.start.direct)&&!this.isAcuteAngle(t.start.direct,i);let a=!t.end.fix&&this.needRotate(t.end.point,t.start.point,t.end.direct)&&!this.isAcuteAngle(t.end.direct,n);if(a)t.end=t.end.getSameDirect(r.edgeParam.delta);else{let g=this.tool.degree90(t.direct,t.start.point,t.end.point),y=ia(t.end.direct,g),b=Math.abs(t.end.point.sub(t.start.point).dot(t.end.direct));t.end.direct.dot(y[1].mul(-1))<.99&&!t.end.fix&&b>r.edgeParam.delta&&(t.end=t.end.getSameDirect(r.edgeParam.delta))}a=!t.end.fix&&this.needRotate(t.end.point,t.start.point,t.end.direct)&&!this.isAcuteAngle(t.end.direct,n);let l=this.rectRadius(e.edgeParam.edgeLength),c=this.rectCenter(t.start.point,t.start.direct,e.edgeParam.edgeLength,e.node.sweep),h=this.rectRadius(r.edgeParam.edgeLength),u=this.rectCenter(t.end.point,t.end.direct,r.edgeParam.edgeLength,r.node.sweep),d=e.node.sweep==le.CCW?Cb:-Cb,p=r.node.sweep==le.CCW?Cb:-Cb,m=0;for(;s;){if(s=!t.start.fix&&this.needRotate90(t.start.point,t.end.point,t.start.direct)&&!this.isAcuteAngle(t.start.direct,i),s){let g=t.start.point.sub(c).normalize();g=g.rotate(S.ORIGIN,d);let y=t.start.direct.rotate(S.ORIGIN,d);t.start=t.start.getNext(c.add(g.mul(l))),t.start.direct=y,m++}if(m>4)break}for(m=0;a;){if(a=!t.end.fix&&this.needRotate90(t.end.point,t.start.point,t.end.direct)&&!this.isAcuteAngle(t.end.direct,n),a){let g=t.end.point.sub(u).normalize();g=g.rotate(S.ORIGIN,p);let y=t.end.direct.rotate(S.ORIGIN,p);t.end=t.end.getNext(u.add(g.mul(h))),t.end.direct=y,m++}if(m>4)break}}degree90ByDirect(t,e,r){if(e.equals1(r))return[e,r,r];let n=r.sub(e).dot(t),s=e.add(t.mul(n));return[e,s,r]}getCornerFreeDirect(t,e,r,i){let n=t.start.point,s=r.sub(n).normalize();if(e!==t&&!s.equals1(t.start.direct)){let a=e.start.point,l=r.sub(a),c=l.length();if(ne.lesseq(c,i)){let C=a.sub(n).normalize(),E=r.sub(n).dot(C);return ne.greater(E,i)?C:s}let h=Math.sqrt(c**2-i**2),u=Math.asin(i/c),d=l.normalize().mul(-1),p=d.rotate(S.ORIGIN,u),m=d.rotate(S.ORIGIN,-u),g=p.mul(h).add(r),y=m.mul(h).add(r),b=g,P=t.start.direct,T=g.sub(n).normalize().dot(P),I=y.sub(n).normalize().dot(P);(T<=0&&I>=0||T<0&&I<0&&Math.abs(T)>Math.abs(I)||T>0&&I>0&&T<I)&&(b=y),s=r.sub(b).normalize()}return s}degree90CornerFree(t,e,r){let i=t.direct,n=t.direct.mul(-1),s=!t.start.fix&&this.isObtuseAngle(t.start.direct,i);(s||t.start.direct.dot(t.direct)<.99&&!t.start.fix)&&(t.start=t.start.getSameDirect(e.edgeParam.delta)),s=!t.start.fix&&this.isObtuseAngle(t.start.direct,i);let a=!t.end.fix&&this.isObtuseAngle(t.end.direct,n);if(a)t.end=t.end.getSameDirect(r.edgeParam.delta);else{let g=this.degree90ByDirect(t.start.direct,t.start.point,t.end.point),y=ia(t.end.direct,g);t.end.direct.dot(y[1].mul(-1))<.99&&!t.end.fix&&(t.end=t.end.getSameDirect(r.edgeParam.delta))}a=!t.end.fix&&this.isObtuseAngle(t.end.direct,n);let l=this.rectRadius(e.edgeParam.edgeLength),c=this.rectCenter(t.start.point,t.start.direct,e.edgeParam.edgeLength,e.node.sweep),h=this.rectRadius(r.edgeParam.edgeLength),u=this.rectCenter(t.end.point,t.end.direct,r.edgeParam.edgeLength,r.node.sweep),d=e.node.sweep==le.CCW?Cb:-Cb,p=r.node.sweep==le.CCW?Cb:-Cb,m=0;for(;s;){if(s=!t.start.fix&&this.isObtuseAngle(t.start.direct,i),s){let g=t.start.point.sub(c).normalize();g=g.rotate(S.ORIGIN,d);let y=t.start.direct.rotate(S.ORIGIN,d);t.start=t.start.getNext(c.add(g.mul(l))),t.start.direct=y,m++}if(m>4)break}for(m=0;a;){if(a=!t.end.fix&&this.isObtuseAngle(t.end.direct,n),a){let g=t.end.point.sub(u).normalize();g=g.rotate(S.ORIGIN,p);let y=t.end.direct.rotate(S.ORIGIN,p);t.end=t.end.getNext(u.add(g.mul(h))),t.end.direct=y,m++}if(m>4)break}}getFreeArcDirect(t,e){let r=new ro,{center:i,radius:n,startAngle:s,endAngle:a,sweep:l}=r.tangentToArc(t.start.direct,t.start.point,e);if(n>0){let c=e.sub(i).normalize(),h=l===le.CCW?Cb:-Cb;return c.rotate(S.ORIGIN,h)}return t.start.direct}getFreeArc(t,e,r){let i=new ro,{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=i.tangentToArc(t,e,r);if(s>0)return q.build2(n,Ht.toDegrees(a),Ht.toDegrees(l),s,s,c)}arcPoints(t,e){let r=new Array(e+1),i=t.sweepAngle/e,n=t.startAngle;for(let s=0;s<=e;s++)r[s]=t.pointOn(n),n+=i;return r}};var Ahe=class extends Bh{constructor(e){super();this.ps=new Array;this.lines=new Array;this.info=e}addPoint(e){this.ps.push(e)}display(){let e=this.ps.length;for(let r=1;r<e;r++){let i=new M(this.ps[r-1],this.ps[r]),n=new eo(i,this.info);n.display(),this.lines.push(n)}}remove(){for(let e of this.lines)e.remove();this.lines.length=0}};var _he=class extends Bh{constructor(e){super();this.ps=new Array;this.lines=new Array;this.info=e}addPoint(e){this.ps.push(e)}display(){let e=this.ps.length;for(let r of this.ps){let i=new M(r,r),n=new eo(i,this.info);n.display(),this.lines.push(n)}for(let r=1;r<e;r++){let i=new M(this.ps[r-1],this.ps[r]),n=new eo(i,this.info);n.display(),this.lines.push(n)}}remove(){for(let e of this.lines)e.remove();this.lines.length=0}};var lN=class lN{constructor(){this.canEndWire=!1;this.redraw=!1;this.needOptimization=!1;this.startPoints=new Map}static getInstance(){return lN.tool==null&&(lN.tool=new lN),lN.tool}setStatus(t,e){this.canEndWire=t,this.wireTool=e}clear(){this.canEndWire=!1,this.wireTool=null,this.needOptimization=!1,this.redraw=!1,this.startPoints.clear()}checkEndWireSpace(t){if(!this.canEndWire){this.clear();return}if(this.wireTool.wire!=="Differential pair wiring"||tr.getInstance().mode==="WIRING_MODE_IGNORE"){this.clear();return}let e=tr.getInstance().type;if(!["WIRING_CORNER_LINE45","WIRING_CORNER_ARC45"].includes(e)){this.clear();return}if(this.canEndWire&&this.needOptimization){this.redraw=!1;return}if(this.checkDRC()){this.needOptimization=!0,this.redraw=!0;let i=Un.getInstance().current;for(let n=0;n<t.tracks.length;n++){let s=t.tracks[n],a=i.tracks[n];this.startPoints.set(a,s.start.point)}return}this.clear()}checkDRC(){let t=Un.getInstance(),e=lu.getInstance().getDrcCheckRoute(t,!1),r=new As;for(let i of e)for(let n of i)if(r.check(n).length>0)return!0;return!1}optimization(){if(!this.needOptimization)return;hi.getInstance().update();let e=Un.getInstance().current.result,r=e.command,i=new ri,n=new no,s=new As,a=_r.getInstance().current;for(let[l,c]of e.wireMap){if(c.size()<=2)continue;let h=this.startPoints.get(l),u=c.getLast().end,d=c.getLastNode(),p=d.prev,m=c.listIterator(),g,y=!1;for(;m.hasNext();){g=m.next();let b=Fr.getInstance().getStatus(g),P=g.item;if(!b.isInput){(P.start.equals1(h)||uT(P.primitive,h))&&(y=!0);continue}if(g===p)break;if(P.start.equals1(h)&&(y=!0),!y||P.width!==p.item.width)continue;let T=P.start,I=Ot(P.primitive,T),C=n.degree45(I,T,u),E=this.getRangeModels(g,d),O=new M(C[0],C[1]);if(s.blockTrackGraphics(P,O,!0,E).length>0)continue;let R=new M(C[1],C[2]);if(s.blockTrackGraphics(P,R,!0,E).length>0)continue;let D=i.createTrack(P.layerId,C[0],C[1],P.width,P.net,r,P.getGroupID()),w=i.createTrack(P.layerId,C[1],C[2],P.width,P.net,r,P.getGroupID()),F=xt.getInstance().createList();e.setInputStatus(F),i.addList(D,F,r),i.addList(w,F,r),F.replace(g,d),r.addCommand(new Ti(F)),hi.getInstance().update();break}}this.clear()}getRangeModels(t,e){let r=new Array,i=t;for(;i!=null&&(r.push(i.item),i!=e);)i=i.next;return r}};lN.tool=null;var G_=lN;var vhe=class{constructor(){this.degreeTool=new no}getStartFanoutPoints(t,e,r){return this.degreeTool.degree45(t,e,r)}setLastFanoutInfo(t){this.lastFanoutInfo=t}needFanoutStyle(t,e){var r,i,n,s;if(t instanceof Je){let a=t.pads,l=["RECT","OVAL"];if(a.length===1)return l.includes((r=a[0])==null?void 0:r.type);if(e==1)return l.includes((i=a[0])==null?void 0:i.type);if(e==2)return l.includes((n=a[1])==null?void 0:n.type);if(e>15&&e<46)return l.includes((s=a[2])==null?void 0:s.type)}}getFanoutEnd(t,e,r){let[i,n]=this.getCornerPositionOfFirstpin(t.bbox,e);return i.add(n.normalize().mul(r*1.414))}singleWireIsNeedFanout(t,e,r){let i=tr.getInstance().mode;if(!r&&!we.adsorb)return!1;if(i!="WIRING_MODE_OBSTRUCT"){if(!Ss.getInstance().routeAutoFanoutEnd||i=="WIRING_MODE_IGNORE")return!1}if(e.length){let[n,s]=e;if(n===s)return!1;let a=Un.getInstance().current,l=a.node.width;if(r&&n&&n instanceof Je&&!s){let c=this.getFanoutEnd(n,a.position,l),h=a.position.distance1(c),u=a.position.distance1(n.center);return 4*l>=h||h>u?!1:this.needFanoutStyle(n,t)}else if(!r&&n instanceof Je&&s instanceof Je){let c=n.center.distance1(s.center),h=this.getFanoutEnd(n,s.center,l),u=this.getFanoutEnd(s,n.center,l),d=n.center.distance1(h),p=s.center.distance1(u);return d+p+2*1.414*l>=c?!1:this.isParrelAndVerticalDirect(n,s)?!0:this.needFanoutStyle(s,t)}else if(!r&&s instanceof Je){let c=n?this.getPoint(n):a.position,h=this.getFanoutEnd(s,c,l),u=c.distance1(h),d=c.distance1(s.center);return 4*l>=u||u>d?!1:this.needFanoutStyle(s,t)}}return!1}getFanoutResults(t,e,r,i,n){var h;let[s,a]=this.fanoutCalculate(t,e,r,i,n),l=((h=i.node.start.model)==null?void 0:h.globalIndex)==e.globalIndex,c=(u,d,p)=>{let m=this.degreeTool.degree45(u,d,p),g=ia(u,m);return this.degreeTool.degree45(g[1],d,p)};return l?this.startPoints=c(s,t,a):this.endPoints=c(s,t,a).reverse(),[s,a]}fanoutCalculate(t,e,r,i,n){var a,l;if(tr.getInstance().mode!=="WIRING_MODE_IGNORE"){let P=function(z,G){return e.layerId==12?G=="Track"||G=="ArcTrack"?!0:G=="Via"||G=="Pad":(G=="Track"||G=="ArcTrack")&&z==e.layerId?!0:(z==12||z==e.layerId)&&(G=="Via"||G=="Pad")},c=(a=i.node.end)==null?void 0:a.model,h=i.node.width,u=(l=i.node.start)==null?void 0:l.model,d=(u==null?void 0:u.globalIndex)!==e.globalIndex,p=e.buildBBox(),[m,g]=this.getCornerPositionOfFirstpin(p,r),y=eX(t,r);if(!d&&((z=!1)=>{var G;if(d&&(c=i.node.start.model),z||n){if(c instanceof Je)return this.isParrelAndVerticalDirect(e,c);if(c instanceof qr){let W=(G=Math.abs(c.direct.dot(e.center.sub(i.node.start.point))))!=null?G:0,L=e.bbox.width()/2;return W<L}}})())return this.lastFanoutInfo;let T=()=>{let z=[[],[]],G,W=m.add(g.normalize().mul(h*1.414)),B=this.interHalfLineToBBox(t,y,p).distance1(t),N=t.add(y.mul(B+h)),U=[W,N],k=0;for(let Y of U){let X=this.degreeTool.degree45(y,t,Y);for(let Z=0;Z<X.length&&Z+1!=X.length;Z++){let Q=new M(X[Z],X[Z+1]),ae=nh.trackToOctagon(X[Z],X[Z+1],h),re=Vt.search(ae,P).getTPV().map(K=>K.model).filter(K=>p.isContainsBBox(K.bbox)?!1:K instanceof qr?!K.start.equals(e.center)&&!K.end.equals(e.center)&&K.net!==e.net&&K.layerId==e.layerId:K instanceof Je?(gr(K.layerId)||K.layerId==e.layerId)&&!K.center.equals(e.center)&&K.net!==e.net:K instanceof It?K.isContains(e.layerId)&&!K.center.equals(e.center)&&K.net!==e.net:!1);if(re.filter(K=>K.globalIndex!==e.globalIndex).length==0)continue;let se=Os.getInstance();for(let K of re){let me={id:"",net:e.net,layerId:e.layerId,shapeType:0},Oe=_a(K),Ie=te.getInstance().getSafeClearance(me,Oe),ue=se.getModelObstacle(K,Ie+h/2,K.layerId);ue.checkCollide(Q),ue.checkCollide(Q)&&z[k].push(K)}}k++}let V=y;if(G=N,z[0].length==0&&z[1].length==0){let Y=g.normalize(),X,Z;d?(X=this.getDrawDirect(i.node.direct,r,U[0],d).mul(-1),Z=this.getDrawDirect(i.node.direct,r,U[1],d).mul(-1)):(X=this.getDrawDirect(i.node.direct,U[0],r,d),Z=this.getDrawDirect(i.node.direct,U[1],r,d));let Q=this.degreeTool.degree45(X,U[0],r),ae=this.degreeTool.degree45(Z,U[1],r),he=ia(X,Q),re=ia(Z,ae),se=Y.dot(he[0]),K=y.dot(re[0]);ne.less(se,.99)&&ne.less(K,.99)?(d?V=this.getDrawDirect(i.node.direct,r,t,d).mul(-1):V=this.getDrawDirect(i.node.direct,t,r,d),G=t):Y.dot(he[0])>y.dot(re[0])?(V=Y,G=U[0]):(V=y,G=U[1])}else z[0].length<z[1].length&&(V=g.normalize(),G=U[0]);return[V,G,z]},[I,C,E]=T();if(E[0].length==0||E[1].length==0)return[I,C];y=this.getPerpendicularDirection(g,y);let[O,_,R]=T(),v=Math.min(...E.map(z=>z.length)),w=Math.min(...R.map(z=>z.length))<v;return[w?O:I,w?_:C]}}getDrawDirect(t,e,r,i){let n=this.degreeTool.degree45(t,e,r),s=ia(t,n);return i?s[1]:s[0]}isParrelAndVerticalDirect(t,e){if(t&&e){let r=e.center.sub(t.center).normalize(),i=Math.abs(e.center.x-t.center.x)>Math.abs(e.center.y-t.center.y),n=i?new S(0,1):new S(1,0),s=i?new S(0,1):new S(1,0),a=Math.abs(n.dot(r))<.01,l=Math.abs(s.dot(r))<.01;return a&&l}}getPoint(t){return t instanceof Je||t instanceof It?t.center:t instanceof yt?t.end:t.buildBBox().center()}isLessThanFanoutProjection(t,e,r,i,n,s){let a=this.getPoint(t),l=this.getPoint(e);if(!a||!l)return;let c=t instanceof yt?n:eX(a,l),h=l.sub(a),u=s.sub(i?a:l),d=this.getNormalOffset(c,h).length(),p=this.getNormalOffset(c,u).length();return d<p}getBBoxCenter(t){let e=t.bbox.UL().add(t.bbox.LL()).mul(.5),r=t.bbox.LR().add(t.bbox.UR()).mul(.5),i=t.bbox.UL().add(t.bbox.UR()).mul(.5),n=t.bbox.LL().add(t.bbox.LR()).mul(.5);return[e,r,i,n]}getPerpendicularDirection(t,e){return t.cross(e)>0?new S(e.y,-e.x):new S(-e.y,e.x)}getCornerPositionOfFirstpin(t,e){let r={UL:t.UL(),UR:t.UR(),LL:t.LL(),LR:t.LR()},i=t.center(),n=e.sub(i).normalize(),s=null,a=null,l=1/0,c=null;for(let h in r){let u=r[h].sub(i).normalize(),d=n.dot(u);d>1?d=1:d<-1&&(d=-1);let p=Math.acos(d);p<l&&(l=p,c=h)}switch(c){case"UL":s=t.UL(),a=new S(-1,1);break;case"UR":s=t.UR(),a=new S(1,1);break;case"LL":s=t.LL(),a=new S(-1,-1);break;case"LR":s=t.LR(),a=new S(1,-1);break}return[s,a]}interHalfLineToBBox(t,e,r){let i=Math.max(r.width(),r.height())*2,n=[r.UL(),r.UR(),r.LR(),r.LL(),r.UL()],s=new M(t,t.add(e.mul(i)));for(let a=1;a<n.length;a++){let l=new M(n[a-1],n[a]),c=Tt(s,l);if(c==2)return ig(c,[])[0]}return null}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}};var xhe=class{constructor(){this.interrupt=!1;this.degreeTool=new no;this.fac=new ri;this.maxIterations=30;this.success=!1}optimizePath(t){let e=txe(t).slice(),r,i=0;do{r=!1;for(let n=e.length-2;n>0;n--){let s=e[n+1].sub(e[n]).normalize(),a=e[n-1].sub(e[n]).normalize();if(s.dot(a)>=-.01&&s.dot(a)<=.01){let l=n-1;for(;l>=1&&ne.eq(e[l-1].sub(e[l]).dot(e[l+1].sub(e[l])),0);)l--;let c=n+1,h=this.create45DegreeSegment(e,l,c,l===n);for(;c<e.length-1;){let u=e[c+1].sub(h[h.length-1]).normalize(),d=h[h.length-2].sub(h[h.length-1]).normalize();if(u.dot(d)>0)c++,h=this.create45DegreeSegment(e,l,c,l===n);else break}e.splice(l,c-l+1,...h),r=!0,this.success=!0;break}}i++}while(r&&!this.interrupt&&i<this.maxIterations);return e}create45DegreeSegment(t,e,r,i){let n=t[e],s=t[r],a;return e==0?a=t[e+1].sub(n).normalize():a=n.sub(t[e-1]).normalize(),this.degreeTool.degree45(a,n,s)}calcListLength(t){let e=0;for(let r=1;r<t.length;r++)e+=t[r-1].distance1(t[r]);return e}isCurvePath(t,e,r=1.25){let i=t.getFirstNode().item,n=t.getLastNode().item,s=this.degreeTool.degree45(e,i.start,n.end),a=this.calcListLength(s);return this.calcListLength(t.getAllItems().flatMap(c=>[c.start,c.end]))>a*r}changePath(t,e,r,i){let n=this.fac.createList();for(let s=1;s<e.length;s++){let a=e[s-1],l=e[s],c=this.fac.createTrack(r.layerId,a,l,r.width,r.net,i);this.fac.addList(c,n,i)}n.replace(t.getFirstNode(),t.getLastNode()),i.addCommand(new Ti(n))}};var Rhe=class{constructor(){this.tool=new Ohe;this.degreeTool=new no;this.factory=new ri;this.alignTool=new cf;this.map=new Map;this.freeArcIsAcuteAngle=!1;this.viaFanoutIgnoreLimit=!1;this.viaFanoutOutShape=!0;this.needOptimizePath=!0}redraw(t,e){let r=xt.getInstance().createList(),i=t.result.wireVia.get(t.node);i!=null&&(t.node.via.viaPosition==="lastInflectionPoint"?r.viaNode.prev=i:r.viaNode.next=i);let n=t.node;if(n.startAlignMap.size>0){let s=n.startAlignMap.get(n);this.drawArcAlignPath(s,n,t.result.command,r)}return this.drawCorner(r,t,e),r}redrawMulti(t,e){t.modifySpacing(2);let r=t.result.command;for(let u of t.tracks){let d=t.result.creataList(u),p=t.result.wireVia.get(u);p!=null&&(d.viaNode.next=p)}this.map.clear(),this.fixFanoutDirect(t,e);let i=tr.getInstance().type,s=new zne().getEvent(t);new Xne().fanout_v2(s);let l=s.getResultNodes(),c=new ri;for(let u=0;u<l.length;u++){let d=t.tracks[u],p=s.nodes[u],m=t.result.wireMap.get(d);c.drawFanoutTrack(l[u],t.tracks[u],t.result,m);let g=uC.build1(p,d,e);this.map.set(d,g)}switch(i){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_ARC45":{let u=t.node,d=t.result.wireMap.get(u),p=this.getInnerDistance(u,e),{path:m,tool:g}=new cf().alignAngle(this.map.get(u),Math.PI/4,p,45),y=this.tool.degree45_v1(g),b=this.degreeTool.degree45(g.directInfo.nextDirect,y[y.length-1],g.directInfo.end),P=ia(g.directInfo.nextDirect,b),T=o_(b[1],b[2],P[0]),I=this.getSweep(b[1].sub(b[0]),b[2].sub(b[1])),C=this.calInnerDistance(u,I),E=(u.width+zg(g.edgeParam.angle,C))*Math.sqrt(2)/2;if(E=this.getLimit(t,I,g,E),u.direct=P[0],u.end.direct=P[1],g.modifyNextDirect(P[0]),Math.abs(T)<E){u.end.direct=P[0],this.verifyProjection(u,g,b,y,P);let O=this.tool.degree45_v1(g),_=this.degreeTool.degree45(g.directInfo.nextDirect,O[O.length-1],g.directInfo.end);this.factory.drawWireTrack(m,u,r,d),this.factory.drawWireTrack(Ku(O.concat(_)),u,r,d),this.drawMulti45(t,g,new S(P[0].y,-P[0].x))}else{let O=this.tool.degree45_v1(g),_=this.degreeTool.degree45(g.directInfo.nextDirect,O[O.length-1],g.directInfo.end);this.factory.drawWireTrack(m,u,r,d),this.factory.drawWireTrack(Ku(O.concat(_)),u,r,d),this.drawMulti45(t,g,new S(P[1].y,-P[1].x))}break}case"WIRING_CORNER_LINE90":case"WIRING_CORNER_ARC90":{let u=t.node,d=t.result.wireMap.get(u),p=this.getInnerDistance(u,e),{path:m,tool:g}=new cf().alignAngle(this.map.get(u),Math.PI/2,p,90),y=this.tool.degree90_v1(g),b=this.degreeTool.degree90(u.direct,y[y.length-1],g.directInfo.end),P=ia(u.direct,b),T=o_(b[1],b[2],P[0]),I=this.getSweep(b[1].sub(b[0]),b[2].sub(b[1])),C=this.calInnerDistance(u,this.getSweep(b[1].sub(b[0]),b[2].sub(b[1]))),E=u.width+zg(g.edgeParam.angle,C);if(E=this.getLimit(t,I,g,E),u.direct=P[0],u.end.direct=P[1],g.modifyNextDirect(P[0]),Math.abs(T)<E){u.end.direct=P[0],this.verifyProjection(u,g,b,y,P);let O=this.tool.degree90_v1(g),_=this.degreeTool.degree90(g.directInfo.nextDirect,O[O.length-1],g.directInfo.end);this.factory.drawWireTrack(m,u,r,d),this.factory.drawWireTrack(Ku(O.concat(_)),u,r,d),this.drawMulti90(t,g,new S(P[0].y,-P[0].x))}else{let O=this.tool.degree90_v1(g),_=this.degreeTool.degree90(g.directInfo.nextDirect,O[O.length-1],g.directInfo.end);this.factory.drawWireTrack(m,u,r,d),this.factory.drawWireTrack(Ku(O.concat(_)),u,r,d),this.drawMulti90(t,g,new S(P[1].y,-P[1].x))}break}case"WIRING_CORNER_ARC":case"WIRING_CORNER_FREEANGLE":}c.drawViaFanout(t);let h=new y3;for(let u=0;u<t.tracks.length;u++){let d=t.tracks[u],p=t.result.wireMap.get(d);h.optimization(p,d,r)}for(let u of t.tracks){let p=t.result.wireMap.get(u).getAllItems(),m=p[p.length-1].end,g=t.result.wireVia.get(u);g!=null&&(g.item.center=m)}}getMinCornerLimit(t,e,r){let i=na.getInstance().trackMinCorner*t.node.width;if(Ss.getInstance().wireMode!=="Differential pair wiring")return i;let n=t.node;if(n.isReverse)return i;let a=e.node.start.point,l=n.start.direct,c=r.sub(a),h=l.cross(c);if(ne.greater(c.dot(l),0)||ne.eq(h,0))return i;let d=al.getInstance().getTrackWidth(10).value;switch(isNaN(d)||(d=n.width),tr.getInstance().type){case"WIRING_CORNER_ARC45":case"WIRING_CORNER_LINE45":{i=Math.max(d,i);break}case"WIRING_CORNER_LINE90":case"WIRING_CORNER_ARC":case"WIRING_CORNER_FREEANGLE":case"WIRING_CORNER_ARC90":{i=Math.max(d*2,i);break}}return i}fixEnd(t,e){let r=new _he({net:t.node.net,color:ee.RED});this.map.clear(),r.addPoint(e);let i=tr.getInstance().type,n=t.getCornerEvent();new m3(t.position).fanout_v3(n),this.addFonoutDebug(n.node);let a=Math.PI/4;["WIRING_CORNER_LINE90","WIRING_CORNER_ARC90"].includes(i)&&(a=Math.PI/2),e=this.fixEndpoint(t,n.node.start.point,n.node.start.direct,e,a),r.addPoint(e);for(let c=0;c<n.tracks.length;c++){let h=t.tracks[c],u=n.tracks[c],d=uC.build2(u,e);this.map.set(h,d)}let l=this.getMinCornerLimit(t,n,e);switch(i){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_ARC45":{let c=t.node,h=c.isReverse?0:this.getInnerDistance(c,e),{path:u,tool:d}=new cf().alignAngle(this.map.get(c),Math.PI/4,h,45,l,c.isReverse?0:this.calInnerDistance.bind(this,c)),p=this.tool.degree45_v1(d),m=this.degreeTool.degree45(d.directInfo.nextDirect,c.isReverse?d.directInfo.start:p[p.length-1],d.directInfo.end),g=ia(d.directInfo.nextDirect,m),y=o_(m[1],m[2],g[0]),b=this.getSweep(m[1].sub(m[0]),m[2].sub(m[1])),P=c.isReverse?0:this.calInnerDistance(c,b),T=(na.getInstance().trackMinCorner*c.width+zg(d.edgeParam.angle,P))*Math.sqrt(2)/2;if(T=this.getLimit(t,b,d,T),c.isReverse&&(g[0]=c.start.direct.mul(-1),g[1]=c.start.direct.mul(-1)),c.direct=g[0],c.end.direct=g[1],d.modifyNextDirect(g[0]),Math.abs(y)<T){c.end.direct=g[0],this.verifyProjection(c,d,m,p,g),c.end.point=d.directInfo.end,c.direct=d.directInfo.nextDirect;let I=c.isReverse?new S(-g[0].y,g[0].x):new S(g[0].y,-g[0].x);this.alignEnd_v1(t,I)}else{c.end.point=d.directInfo.end,c.direct=d.directInfo.nextDirect;let I=c.isReverse?new S(-g[1].y,g[1].x):new S(g[1].y,-g[1].x);this.alignEnd_v1(t,I)}t.realTimeLimit=d.edgeParam.min;break}case"WIRING_CORNER_LINE90":case"WIRING_CORNER_ARC90":{let c=t.node,h=c.start.direct,u=c.isReverse?0:this.getInner90Distance(c,e),{path:d,tool:p}=new cf().alignAngle(this.map.get(c),Math.PI/2,u,90,l);h=this.getDirect(d,h),r.addPoint(p.directInfo.end);let m=this.tool.degree90_v1(p);h=this.getDirect(m,h),r.addPoint(p.directInfo.end);let g=this.degreeTool.degree90(c.direct,c.isReverse?p.directInfo.start:m[m.length-1],p.directInfo.end);r.addPoint(p.directInfo.end),this.addResultPath(d.concat(m).concat(g),{net:c.net,color:ee.BLUE});let y=ia(c.direct,g),b=o_(g[1],g[2],y[0]),P=this.getSweep(g[1].sub(g[0]),g[2].sub(g[1])),T=c.isReverse?0:this.calInnerDistance(c,this.getSweep(g[1].sub(g[0]),g[2].sub(g[1]))),I=y[0];ne.eq(h.cross(y[0]),0)&&(I=y[1]);let C=c.isReverse?0:this.calInnerDistance(c,this.getSweep(h,I)),E=zg(p.edgeParam.angle,C),O=zg(p.edgeParam.angle,T),_=na.getInstance().trackMinCorner*c.width+O;_=this.getLimit(t,P,p,_),c.direct=y[0],c.end.direct=y[1],p.modifyNextDirect(y[0]),r.addPoint(p.directInfo.end),g[0].distance1(g[1])<E||Math.abs(b)<_?(c.end.direct=y[0],this.verifyProjection(c,p,g,m,y),r.addPoint(p.directInfo.end),c.end.point=p.directInfo.end,c.direct=p.directInfo.nextDirect,this.alignEnd_v1(t,c.isReverse?new S(-y[0].y,y[0].x):new S(y[0].y,-y[0].x)),r.addPoint(c.end.point)):(c.end.point=p.directInfo.end,c.direct=p.directInfo.nextDirect,this.alignEnd_v1(t,c.isReverse?new S(-y[1].y,y[1].x):new S(y[1].y,-y[1].x)),r.addPoint(c.end.point)),t.realTimeLimit=p.edgeParam.min,Yr.debug&&Yr.inputDebugGraphics(r);break}case"WIRING_CORNER_ARC":{let c=t.node;c.end.point=e;let h=n.node;if(e.equals1(c.start.point)){for(let P of t.tracks){let T=P.end.signalLayers;P.end=P.start.clone(),P.end.signalLayers=T}break}let u=h.start.point,d=c.start.direct,p=e.sub(u),m=d.cross(p),g=m>0?le.CCW:le.CW,y=this.calInnerDistance(c,g);if(ne.greater(p.dot(c.start.direct),0)){if(this.freeArcIsAcuteAngle=!0,y>0){let I=this.getInnerCornerNode(c,e,n).start.point;if(e.distance1(I)<y){let E=e.sub(I).normalize();e=I.add(E.mul(y)),c.end.point=e}}let P=this.tool.getFreeArcDirect(h,e);c.direct=P,c.end.direct=P,this.alignEnd_v1(t,new S(P.y,-P.x))}else if(this.freeArcIsAcuteAngle=!1,ne.eq(m,0)){let P;P=e.sub(u).normalize(),c.isReverse&&(P=d.mul(-1)),c.direct=P,c.end.direct=P,this.alignEnd_v1(t,c.isReverse?new S(-P.y,P.x):new S(P.y,-P.x))}else{if(y>0){let E=c.start.direct,O=g==le.CCW?new S(-E.y,E.x):new S(E.y,-E.x),_=Math.abs(p.dot(O));if(_<2*y){let R=y;_>y&&(R=2*y-_),e=e.add(O.mul(R)),c.end.point=e,p=e.sub(u)}}let P=d.cross(p),T=d.rotate(S.ORIGIN,Math.PI/2),I=u.add(T.mul(P)),C=e.sub(I).normalize();c.isReverse&&(C=d.mul(-1)),e.similarEquals(I,1e-7)&&(C=this.tool.getFreeArcDirect(h,e),c.end.point=I),c.direct=C,c.end.direct=C,this.alignEnd_v1(t,c.isReverse?new S(-C.y,C.x):new S(C.y,-C.x))}break}case"WIRING_CORNER_FREEANGLE":{let c=t.node;c.end.point=e;let h=n.node,u=this.getInnerCornerNode(c,e,n),d=c.isReverse?0:this.getInnerDistance(c,e),p=this.tool.getCornerFreeDirect(h,u,e,d);if(ne.greater(p.dot(c.start.direct),0))c.direct=p,c.end.direct=p,this.alignEnd_v1(t,new S(p.y,-p.x));else{let g=c.isReverse?0:this.getInnerDistance(c,e),y=this.map.get(c),b=h_.build1(y,Math.PI/2,g,l),P=this.tool.degree90_v1(b),T=P[P.length-1],I=P[P.length-2],C=T.sub(I).normalize();T.equals1(I)&&(C=T.sub(c.start.point));let E=this.tool.degree90ByDirect(C,c.isReverse?b.directInfo.start:T,b.directInfo.end),O=ia(c.direct,E),_=o_(E[1],E[2],O[0]),R=this.getSweep(E[1].sub(E[0]),E[2].sub(E[1])),v=c.isReverse?0:this.calInnerDistance(c,this.getSweep(E[1].sub(E[0]),E[2].sub(E[1]))),D=c.width+zg(b.edgeParam.angle,v);D=this.getLimit(t,R,b,D),c.isReverse&&(O[0]=c.start.direct.mul(-1),O[1]=c.start.direct.mul(-1)),c.direct=O[0],c.end.direct=O[1],b.modifyNextDirect(O[0]),Math.abs(_)<D?(c.end.direct=O[0],this.verifyProjection(c,b,E,P,O),c.end.point=b.directInfo.end,c.direct=b.directInfo.nextDirect,this.alignEnd_v1(t,c.isReverse?new S(-O[0].y,O[0].x):new S(O[0].y,-O[0].x))):(c.end.point=b.directInfo.end,c.direct=b.directInfo.nextDirect,this.alignEnd_v1(t,c.isReverse?new S(-O[1].y,O[1].x):new S(O[1].y,-O[1].x))),t.realTimeLimit=b.edgeParam.min}break}}this.viaFanout(t,e)}viaFanout(t,e){var I,C,E,O;this.viaFanoutIgnoreLimit=!1,this.viaFanoutOutShape=!0;let i=new G6().fanout(t);if(i==null)return;let n=null,s=0,a=this.getCornerEvent(t,!1),l=t.node,c=l.isReverse?l.end.direct.mul(-1):l.end.direct,{map:h,command:u}=this.redrawMulti3(a,t,!1);for(let[_,R]of h){if(R.size()<=0)continue;s=Math.max(s,R.size());let v=R.getLastNode(),D=0;for(;;){let w=v.item;if(w instanceof Oi){n=0;break}if(w.length<.001&&v.prev){v=v.prev;continue}if(!Ot(w.primitive).similarEquals(c,1e-5)){v===R.getLastNode()&&(n=0);break}if(D+=w.length,v.prev&&v.prev.item)v=v.prev;else break}D>0&&(n=n===null?D:Math.min(n,D))}u.undo();let d=Math.floor(t.tracks.length/2);for(let _=0;_<t.tracks.length;_++){let R=t.tracks[_],v=R.end;if(_<d){let D=l.isReverse?new S(v.direct.y,-v.direct.x):new S(-v.direct.y,v.direct.x);v.point=v.point.add(D.mul(i[_])),v.model=(I=t.result.wireVia.get(R))==null?void 0:I.item}else{let D=l.isReverse?new S(-v.direct.y,v.direct.x):new S(v.direct.y,-v.direct.x);v.point=v.point.add(D.mul(i[_])),v.model=(C=t.result.wireVia.get(R))==null?void 0:C.item}}let p=this.getCornerEvent(t,!1),m=null;if(Ss.getInstance().wireMode=="Differential pair wiring"&&s<=1){for(let _ of t.tracks){let R=_.start.model;R instanceof qr&&R.direct.similarEquals(c,1e-5)&&(m=m===null?R.length:Math.min(m,R.length))}m=+m+n}this.viaFanoutIgnoreLimit=ne.greater(m,0);let y=new m3(e,this.viaFanoutIgnoreLimit);if(y.checkstart=!1,i.every(_=>_<=0)){let _=y.getOutShapeLength(p);this.viaFanoutOutShape=ne.less(m,_)}y.fanout_v3(p,this.viaFanoutOutShape);let b=p.node,P=b.end.connect().reverse().map(_=>_.point),T=b.end.direct.mul(-1);if(n===null){let _=l.start.point;n=Math.abs(_.sub(e).dot(T))}if(P.length>=2){let _=P[0],R=P[P.length-1],v=Math.abs(_.sub(R).dot(T));if(l.isReverse){l.isReverse=!1;let D=l.end.direct.mul(-1);l.end.direct=D,l.direct=D;let F=l.start.point.add(D.mul(v));l.end.point=F;let H=new S(D.y,-D.x);this.alignEnd_v1(t,H);for(let z=0;z<t.tracks.length;z++){let G=t.tracks[z],W=G.end;if(z<d){let L=l.isReverse?new S(W.direct.y,-W.direct.x):new S(-W.direct.y,W.direct.x);W.point=W.point.add(L.mul(i[z])),W.model=(E=t.result.wireVia.get(G))==null?void 0:E.item}else{let L=l.isReverse?new S(-W.direct.y,W.direct.x):new S(W.direct.y,-W.direct.x);W.point=W.point.add(L.mul(i[z])),W.model=(O=t.result.wireVia.get(G))==null?void 0:O.item}}}else if(ne.less(n,v)){let D=v-n;for(let w=0;w<t.tracks.length;w++){let F=t.tracks[w].end;F.point=F.point.add(F.direct.mul(D))}}}}getDirect(t,e){if(t.length>0){let r=t[t.length-1];for(let i=t.length-2;i>=0;i--){let n=t[i],s=r.sub(n);if(Math.abs(s.x)<1e-8&&Math.abs(s.y)<1e-8)r=n;else return s.normalize()}}return e}addFonoutDebug(t){if(Yr.debug){let e=t.start.connect(),r=new Ahe({net:t.net,color:ee.GREEN});for(let i of e)r.addPoint(i.point);Yr.inputDebugGraphics(r)}}addResultPath(t,e){if(Yr.debug){let r=t.length,i=[];for(let s=1;s<r;s++){let a=new M(t[s-1],t[s]),l=new eo(a,e);i.push(l)}let n=new Kd(i);Yr.inputDebugGraphics(n)}}fixEndpoint(t,e,r,i,n){let s=t.node,a=i.sub(e),l=a.normalize(),c=r.cross(l)>0?le.CCW:le.CW,h=this.calInnerDistance(s,c),u=a.cross(r),d=na.getInstance().trackMinCorner*(1+Math.cos(n)*2)/2*s.width;if(Math.abs(u)-h<d){let p=a.dot(r);return p>.01?(s.direct=r,e.add(r.mul(p))):this.isLineStyle()?(s.isReverse=!0,s.direct=r.mul(-1),e.add(r.mul(p))):e}return i}isLineStyle(){switch(tr.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":case"WIRING_CORNER_FREEANGLE":return!0;default:return!1}}calcSweepResult(t){let e=new Array;for(let r of t.tracks)if(r.drawing==0){let i=this.getSweep4Node(r.end,r.start),n=this.getSweep4Node(r.start,r.end);e.push([i,n])}return e}redrawMulti3(t,e,r){let i=new Map,n=new Br,s=new ri;for(let y=0;y<t.tracks.length;y++){let b=t.tracks[y],P=s.createList();if(i.set(b,P),b.startAlignMap.size>0){let T=e.tracks[y],I=b.startAlignMap.get(T);this.drawArcAlignPath(I,T,n,P)}if(b.alignMap.size>0){let T=e.tracks[y],I=b.alignMap.get(T);this.drawArcAlignPath(I,T,n,P)}}let a=tr.getInstance().type,l=this.viaFanoutIgnoreLimit&&!r,c=new m3(e.position,l);c.fanout_v3(t),c.fixFanoutTrackWidth(t,e),c.checkstart=!1;let h=r||this.viaFanoutOutShape;if(!G_.getInstance().needOptimization&&c.fanout_v3(t,h),this.checkFanoutLoop(t)){t=this.getCornerEvent(e,r),i.clear();for(let y of t.tracks){let b=s.createList();i.set(y,b)}}let d=this.calcSweepResult(t);switch(a){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_ARC45":{for(let y of t.tracks)if(y.drawing==0){let b=y.isReverse?0:this.getInnerDistance2(y,t,!0,d),P=new cf().alignAngle_v1(y,Math.PI/4,b,t.realTimeLimit,45,this.calInnerDistance2.bind(this,y,t)),T=this.getInnerDistance2(y,t,!1,d),I=new cf().alignAngle_v2(y,Math.PI/4,T,t.realTimeLimit,45);P.node.sweep=this.getSweep1(y.start.direct,y.start.point,y.end.point),I.node.sweep=this.getSweep1(y.end.direct,y.end.point,y.start.point),y.isReverse||this.tool.degree45_v3(y,P,I,r);let C=this.degreeTool.degree45(y.direct,y.start.point,y.end.point),E=ia(y.direct,C);y.direct=E[0],s.drawCornerNodeTrack(y.start.connect(),y,n,i.get(y)),s.drawCornerTrack(C,y,n,i.get(y))}break}case"WIRING_CORNER_LINE90":case"WIRING_CORNER_ARC90":{for(let y of t.tracks)if(y.drawing==0){let b=y.isReverse?0:this.getInner90Distance2(y,t,!0),P=new cf().alignAngle_v1(y,Math.PI/2,b,t.realTimeLimit,90),T=y.isReverse?0:this.getInner90Distance2(y,t,!1),I=new cf().alignAngle_v2(y,Math.PI/2,T,t.realTimeLimit,90);P.node.sweep=this.getSweep1(y.start.direct,y.start.point,y.end.point),I.node.sweep=this.getSweep1(y.end.direct,y.end.point,y.start.point),y.isReverse||this.tool.degree90_v3(y,P,I);let C=this.degreeTool.degree90(y.direct,y.start.point,y.end.point),E=ia(y.direct,C);y.direct=E[0],y.end.direct=E[1],s.drawCornerNodeTrack(y.start.connect(),y,n,i.get(y)),s.drawCornerTrack(C,y,n,i.get(y))}break}case"WIRING_CORNER_ARC":{if(this.freeArcIsAcuteAngle)for(let y=0;y<t.tracks.length;y++){let b=t.tracks[y],P=e.tracks[y];if(P.freeArcInfo=null,b.drawing==0){s.drawCornerNodeTrack(b.start.connect(),b,n,i.get(b));let T=b.end.point,I=b.start.point;if(I.equals1(T))continue;let C=this.tool.getFreeArc(b.start.direct,I,T),E=[I,T];if(C&&Math.abs(C.sweepAngle)>=1){let O=s.createArcTrackByArc(b.layerId,C,b.width,b.net,n);s.addList(O,i.get(b),n)}else s.drawCornerTrack(E,b,n,i.get(b))}}else for(let y=0;y<t.tracks.length;y++){let b=t.tracks[y],P=e.tracks[y];if(P.freeArcInfo=null,b.drawing!=0)continue;s.drawCornerNodeTrack(b.start.connect(),b,n,i.get(b));let T=b.start.point,I=b.end.point;if(T.equals1(I))continue;let C=I.sub(T),E=b.start.direct,O=E.cross(C);if(ne.eq(O,0)){let _=[b.start.point,I];s.drawCornerTrack(_,b,n,i.get(b))}else{let _=E.rotate(S.ORIGIN,Math.PI/2),R=T.add(_.mul(O)),v=this.tool.getFreeArc(b.start.direct,T,R),D=[T,R];if(v&&Math.abs(v.sweepAngle)>=1){let w=s.createArcTrackByArc(b.layerId,v,b.width,b.net,n);s.addList(w,i.get(b),n)}else s.drawCornerTrack(D,b,n,i.get(b));I.similarEquals(R,1e-7)||s.drawCornerTrack([R,I],b,n,i.get(b))}}break}case"WIRING_CORNER_FREEANGLE":{let y=t.node;if(ne.greater(y.direct.dot(y.start.direct),0)){for(let P of t.tracks)if(P.drawing==0){s.drawCornerNodeTrack(P.start.connect(),P,n,i.get(P));let T=P.end.point,I=P.start.point,C=[I,T];if(ne.eq(P.end.direct.cross(P.start.direct),0))C=[I,T];else{let E=Vb(I,I.add(P.start.direct),T,T.add(P.end.direct));if(!E){s.drawCornerTrack(C,P,n,i.get(P));continue}(I.equals1(E)||ne.greater(E.sub(I).dot(P.start.direct),0))&&(C=[I,E,T])}s.drawCornerTrack(C,P,n,i.get(P))}}else for(let P of t.tracks)if(P.drawing==0){let T=P.isReverse?0:this.getInnerDistance2(P,t,!0,d),I=pP.build1(P,Math.PI/2,T,length),C=P.isReverse?0:this.getInnerDistance2(P,t,!1,d),E=pP.build2(P,Math.PI/2,C,length);I.node.sweep=this.getSweep1(P.start.direct,P.start.point,P.end.point),E.node.sweep=this.getSweep1(P.end.direct,P.end.point,P.start.point),this.tool.degree90CornerFree(P,I,E);let O=this.tool.degree90ByDirect(P.direct,P.start.point,P.end.point),_=ia(P.direct,O);P.isReverse&&(_[0]=P.start.direct.mul(-1),_[1]=P.start.direct.mul(-1)),P.direct=_[0],P.end.direct=_[1],s.drawCornerNodeTrack(P.start.connect(),P,n,i.get(P)),s.drawCornerTrack(O,P,n,i.get(P))}break}}for(let y of t.tracks){let b=y.end.connect().reverse().map(I=>I.point),P=y.end.connect().reverse(),T=new Set;for(let I of P)I.reverse(),I.change!=null&&T.add(I.change);for(let I of T)I.reverse();s.drawCornerNodeTrack(P,y,n,i.get(y))}let p=new y3,m=new Map,g=new xhe;for(let y=0;y<t.tracks.length;y++){let b=t.tracks[y],P=e.tracks[y],T=i.get(b);if(T.size()==0)continue;p.optimization(T,b,n);let I=Ku(T.getAllItems().flatMap(E=>[E.start,E.end])),C=this.isMoreThanRightAngleLimit(I);if(r&&this.isNeedOptimizePath(P)){let E=P.end.model instanceof qr?P.end.model:void 0;if(E){let O=xt.getInstance().getListNode(E);if(O&&O.parent){let R=O.parent.getAllItems().flatMap(v=>[v.start,v.end]);if(I.length){let v=I[I.length-1],D=R[0];if(v.equals(D))Re.addAll(I,R);else for(let w=R.length-1;w>=0;w--)I.push(R[w])}}}if(C){let O=g.optimizePath(I);if(g.success&&g.changePath(T,O,P,n),g.isCurvePath(T,P.direct)){let R=this.degreeTool.degree45(P.direct,P.start.point,P.end.point);g.changePath(T,R,P,n)}}}m.set(T,P)}return{event:t,map:i,command:n}}isNeedOptimizePath(t){return!(!this.needOptimizePath||Ss.getInstance().wireMode=="Differential pair wiring")}isMoreThanRightAngleLimit(t,e=2){let r=0;for(let i=0;i<t.length-2;i++){let n=t[i].sub(t[i+1]).normalize(),s=t[i+2].sub(t[i+1]).normalize();if(n.dot(s)>=-.01&&(r++,r>=e))return!0}return!1}getCornerEvent(t,e){let r=t.getCornerEvent();if(e)for(let i of r.tracks)i.end.model==null&&(i.end.fix=!0);for(let i=0;i<t.tracks.length;i++){let n=t.tracks[i];n.startAlignMap.size>0&&(r.tracks[i].startAlignMap=n.startAlignMap),n.alignMap.size>0&&(r.tracks[i].alignMap=n.alignMap)}return r}checkFanoutLoop(t){for(let e of t.tracks){let r=e.start.connect().map(l=>l.point),i=e.end.connect().reverse().map(l=>l.point),n=fe.build4(r),s=fe.build4(i);if(VB(n,s))return!0}return!1}fixFanoutDirect(t,e){if(t.node.start.allowModifyDirect){let r=e.sub(t.node.start.point).normalize();if(t.node.start.direct.dot(r)<0){let n=t.node.start.direct.mul(-1);for(let s of t.tracks)s.start.direct=n;t.reverse()}}}getLimit(t,e,r,i){let s=new G6().fanout(t);if(s==null)return i;if(e==le.CCW){let a=t.tracks[0],l=0,c=a.next,h=1,u=s[0];for(;c!=null;){l+=c.width+a.width/2+c.next.width/2;let d=zg(r.edgeParam.angle,l);d<s[h]&&(u=Math.max(u,s[h]-d)),a=c.next,c=a.next,h++}return u*Math.sin(r.edgeParam.angle*2)+i}else{let a=0,l=t.tracks[t.tracks.length-1],c=l.previous,h=t.tracks.length-2,u=s[t.tracks.length-1];for(;c!=null;){a+=c.width+l.width/2+c.previous.width/2;let d=zg(r.edgeParam.angle,a);d<s[h]&&(u=Math.max(u,s[h]-d)),l=c.previous,c=l.previous}return u*Math.sin(r.edgeParam.angle*2)+i}}modifyWireDirection(t,e,r){let i=ia(e,r);!t.start.point.equals1(r[0])&&i[1].equals1(e)?(t.direct=i[1],e=i[1],t.end.direct=i[0]):(t.direct=i[0],e=i[0],t.end.direct=i[1])}drawCorner(t,e,r){var a,l;let i=e.result.command;this.map.clear(),this.map.set(e.node,uC.build(e.node,r));let n=(a=go.autoEndItem(r,e.node.layerId,e.node.net))==null?void 0:a.model;e.node.end.model=n&&Bt.checkIsCanEditByItem(n)?n:null;let s=new vhe;switch((l=this.lastFanoutInfo)!=null&&l.length&&s.setLastFanoutInfo(this.lastFanoutInfo),tr.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_ARC45":{let c=e.node,h=c.start,u=!1,d=!0;if(h.allowModifyDirect){let p=h.model;u=s.singleWireIsNeedFanout(c.layerId,[p,n],!1);let m=[];if(s.singleWireIsNeedFanout(c.layerId,[p,void 0],!0)){let g=h.point,y=h.model;if(y.inOutline(e.position))return;let b=P=>{let[T,I]=s.getFanoutResults(g,y,P||e.position,e,u);if(this.lastFanoutInfo=[T,I],u){let E=n,[,O]=s.getFanoutResults(E.center,E,I,e);r=O}h.direct=T,m=m.concat(s.startPoints);let C=this.getBlockPoints(c.direct,I,r,c);d=!1,this.modifyWireDirection(c,h.direct,C),m=Ku(m.concat(C)),u&&(m=Ku(m.concat(s.endPoints)))};b(),s.endPoints&&s.endPoints.length>0&&this.isMoreThanRightAngleLimit(m,1)&&(m=[],b(s.endPoints[0]))}else if(u){let g=n,[,y]=s.getFanoutResults(g.center,g,h.point,e);m=this.getBlockPoints(c.direct,h.point,y,c),d=!1,this.modifyWireDirection(c,h.direct,m),m=m.concat(s.endPoints)}else m=this.getBlockPoints(c.direct,h.point,r,c),this.lastFanoutInfo=[c.direct,m[1]];d&&this.modifyWireDirection(c,h.direct,m),this.factory.drawWireTrack(m,c,i,t)}else{this.fixEndpoint(e,c.start.point,c.start.direct,r,Math.PI/4);let{path:p,tool:m}=this.alignTool.alignAngle(this.map.get(c),Math.PI/4,0,45);c.isReverse&&(m.edgeParam.edgeLength=0),this.factory.drawWireTrack(p,c,i,t);let g=this.tool.degree45_v1(m),y=this.getBlockPoints(m.directInfo.nextDirect,g[g.length-1],m.directInfo.end,c),b=ia(m.directInfo.nextDirect,y);c.isReverse&&(b[0]=c.start.direct.mul(-1),b[1]=c.start.direct.mul(-1));let P=o_(y[1],y[2],b[0]),I=na.getInstance().trackMinCorner*c.width*Math.sqrt(2)/2;Math.abs(P)<I&&!e.node.end.model&&m.modifyEnd(y[1].add(b[0].mul(Math.abs(Qj(y[1],y[2],b[0]))))),c.direct=b[0],c.end.direct=b[1],m.modifyNextDirect(b[0]),this.draw1(m,c,e,t,s)}break}case"WIRING_CORNER_LINE90":case"WIRING_CORNER_ARC90":{let c=e.node,h=c.start;if(h.allowModifyDirect){let u=this.degreeTool.degree90(c.direct,h.point,r),d=ia(h.direct,u);c.direct=d[0],h.direct=d[0],c.end.direct=d[1],this.factory.drawWireTrack(u,c,i,t)}else{let u=c.width,{path:d,tool:p}=this.alignTool.alignAngle(this.map.get(c),Math.PI/2,0,90);this.factory.drawWireTrack(d,c,i,t);let m=this.tool.degree90_v1(p),g=this.degreeTool.degree90(p.directInfo.nextDirect,m[m.length-1],p.directInfo.end),y=ia(p.directInfo.nextDirect,g),b=o_(g[1],g[2],y[0]),P=u/2;Math.abs(b)<P&&!e.node.end.model&&p.modifyEnd(g[1].add(y[0].mul(Math.abs(Qj(g[1],g[2],y[0]))))),c.direct=y[0],c.end.direct=y[1],p.modifyNextDirect(y[0]),this.draw90_v1(p,c,i,t)}break}case"WIRING_CORNER_ARC":{let c=e.node,h=c.start.point,u=r.sub(h).normalize();c.start.allowModifyDirect&&c.start.direct.dot(u)<=Math.sqrt(2)/2&&(c.start.direct=LGe(u));let d=c.start.direct,p=ne.greater(u.dot(d),0);if(c.freeArcInfo=null,p){let m=c.start.point,g=this.tool.getFreeArc(d,m,r),y=r.sub(m).normalize();if(g&&Math.abs(g.sweepAngle)>=1){y=AF(g);let b=this.factory.createArcTrackByArc(c.layerId,g,c.width,c.net,i);this.factory.addList(b,t,i)}else{let b=[m,r];this.factory.drawWireTrack(b,c,i,t)}c.end.direct=y}else{let m=c.start.point,g=r.sub(m),y=c.start.direct,b=y.cross(g),P=r.sub(m).normalize();if(ne.eq(b,0)){let T=[c.start.point,r];this.factory.drawWireTrack(T,c,i,t)}else{let T=y.rotate(S.ORIGIN,Math.PI/2),I=m.add(T.mul(b)),C=this.tool.getFreeArc(c.start.direct,m,I),E=[m,I];if(C&&Math.abs(C.sweepAngle)>=1){let O=this.factory.createArcTrackByArc(c.layerId,C,c.width,c.net,i);this.factory.addList(O,t,i),P=AF(C)}else this.factory.drawWireTrack(E,c,i,t),P=I.sub(m).normalize();r.similarEquals(I,1e-7)||(this.factory.drawWireTrack([I,r],c,i,t),P=r.sub(I).normalize())}c.end.direct=P}break}case"WIRING_CORNER_FREEANGLE":{let c=e.node,h=c.start.point,u=[h,r];c.end.direct=r.sub(h).normalize(),this.factory.drawWireTrack(u,c,i,t);break}}}getBlockPoints(t,e,r,i){let n=this.degreeTool.degree45(t,e,r);if(tr.getInstance().mode=="WIRING_MODE_OBSTRUCT"){let s=new As,a=new qr("",i.layerId,n[0],n[1],i.width,!1,i.net),l=Nt.filter;Nt.setPushFilter(),Nt.pushFilter.trackfilter.setMode(!0),Nt.pushFilter.setNetAndLayerId(i.net,i.layerId);let c=s.blockTrackPrimitive(a,a.primitive,!0,!1);if(a.remove(),c.length!=0){let h=ia(t,n),u=this.degreeTool.degree45(h[1],e,r),d=new qr("",i.layerId,u[0],u[1],i.width,!1,i.net);s.blockTrackPrimitive(d,d.primitive,!0,!1).length==0&&(n=u)}Nt.filter=l}return n}alignEnd_v1(t,e){let r=t.node,i=r.end.point,n=r.direct,s=r.previous,a=r.next,l=r,c=r,h=0,u=0,d=r.end.direct;for(;s!=null||a!=null;)s!=null&&(h=h-(l.width/2+s.width+s.previous.width/2),l=s.previous,s=l.previous,l.direct=n,l.end.direct=d,l.end.point=this.alignEnd(i,e,h),l.isReverse=r.isReverse),a!=null&&(u=u+(c.width/2+a.width+a.next.width/2),c=a.next,a=c.next,c.direct=n,c.end.direct=d,c.end.point=this.alignEnd(i,e,u),c.isReverse=r.isReverse)}drawMulti45(t,e,r){let i=t.result.command,n=t.node,s=n.previous,a=n.next,l=n,c=n,h=0,u=0,d=e.directInfo.end,p=e.directInfo.end,m=e.directInfo.nextDirect,g=n.end.direct;for(;s!=null||a!=null;){if(s!=null){h=h-(l.width/2+s.width+s.previous.width/2),l=s.previous,s=l.previous,l.direct=m,l.end.direct=g,d=this.alignEnd(e.directInfo.end,r,h);let y=this.getInnerDistance(l,d),b=this.map.get(l).modifyEnd(d),{path:P,tool:T}=new cf().alignAngle(b,Math.PI/4,y,45);T.modifyNextDirect(m);let I=this.tool.degree45_v1(T),C=this.degreeTool.degree45(T.directInfo.nextDirect,I[I.length-1],T.directInfo.end),E=t.result.wireMap.get(l);this.factory.drawWireTrack(P,l,i,E),this.factory.drawWireTrack(I.concat(C),l,i,E)}if(a!=null){u=u+(c.width/2+a.width+a.next.width/2),c=a.next,a=c.next,c.direct=m,c.end.direct=g,p=this.alignEnd(e.directInfo.end,r,u);let y=this.getInnerDistance(c,p),b=this.map.get(c).modifyEnd(p),{path:P,tool:T}=new cf().alignAngle(b,Math.PI/4,y,45);T.modifyNextDirect(m);let I=this.tool.degree45_v1(T),C=this.degreeTool.degree45(T.directInfo.nextDirect,I[I.length-1],T.directInfo.end),E=t.result.wireMap.get(c);this.factory.drawWireTrack(P,c,i,E),this.factory.drawWireTrack(I.concat(C),c,i,E)}}}drawMulti90(t,e,r){let i=t.result.command,n=t.node,s=n.previous,a=n.next,l=n,c=n,h=0,u=0,d=e.directInfo.end,p=e.directInfo.end,m=e.directInfo.nextDirect,g=n.end.direct;for(;s!=null||a!=null;){if(s!=null){h=h-(l.width/2+s.width+s.previous.width/2),l=s.previous,s=l.previous,l.direct=m,l.end.direct=g,d=this.alignEnd(e.directInfo.end,r,h);let y=this.getInnerDistance(l,d),b=this.map.get(l).modifyEnd(d),{path:P,tool:T}=new cf().alignAngle(b,Math.PI/2,y,90);T.modifyNextDirect(m);let I=this.tool.degree90_v1(T),C=this.degreeTool.degree90(T.directInfo.nextDirect,I[I.length-1],T.directInfo.end),E=t.result.wireMap.get(l);this.factory.drawWireTrack(P,l,i,E),this.factory.drawWireTrack(I.concat(C),l,i,E)}if(a!=null){u=u+(c.width/2+a.width+a.next.width/2),c=a.next,a=c.next,c.direct=m,c.end.direct=g,p=this.alignEnd(e.directInfo.end,r,u);let y=this.getInnerDistance(c,p),b=this.map.get(c).modifyEnd(p),{path:P,tool:T}=new cf().alignAngle(b,Math.PI/2,y,90);T.modifyNextDirect(m);let I=this.tool.degree90_v1(T),C=this.degreeTool.degree90(T.directInfo.nextDirect,I[I.length-1],T.directInfo.end),E=t.result.wireMap.get(c);this.factory.drawWireTrack(P,c,i,E),this.factory.drawWireTrack(I.concat(C),c,i,E)}}}alignEnd(t,e,r){return t.add(e.mul(r))}calInnerDistance2(t,e,r){let i=e.tracks.indexOf(t);if(r==le.CCW){let n=0,s=t.previous;for(;s!=null;)n+=s.width+t.width/2+s.previous.width/2,t=e.tracks[i-1],s=t.previous,i--;return n}else{let n=0,s=t.next;for(;s!=null;)n+=s.width+t.width/2+s.next.width/2,t=e.tracks[i+1],s=t.next,i++;return n}}calInnerDistance3(t,e,r){let i=e.tracks.indexOf(t);if(r==le.CCW){let n=0,s=t.next;for(;s!=null;)n+=s.width+t.width/2+s.next.width/2,t=e.tracks[i+1],s=t.next,i++;return n}else{let n=0,s=t.previous;for(;s!=null;)n+=s.width+t.width/2+s.previous.width/2,t=e.tracks[i-1],s=t.previous,i--;return n}}calInnerDistance(t,e){if(e==le.CCW){let r=0,i=t.previous;for(;i!=null;)r+=i.width+t.width/2+i.previous.width/2,t=i.previous,i=t.previous;return r}else{let r=0,i=t.next;for(;i!=null;)r+=i.width+t.width/2+i.next.width/2,t=i.next,i=t.next;return r}}getSweep(t,e){return t.cross(e)>0?le.CCW:le.CW}getSweep1(t,e,r){return t.cross(r.sub(e).normalize())>0?le.CCW:le.CW}verifyProjection(t,e,r,i,n){let s=r[1].add(n[0].mul(Math.abs(Qj(r[1],r[2],n[0]))));if(s.distance1(r[0])<e.edgeParam.delta){let l=t.start.direct,c=t.start.point;if(i.length>1){c=i[i.length-1];let u=c.sub(i[i.length-2]);Math.abs(u.x)<1e-8&&Math.abs(u.y)<1e-8?l=e.directInfo.lastDirect:l=u.normalize()}let h=r[2].sub(c).dot(l);s=c.add(l.mul(h)),t.direct=l,t.end.direct=l,e.modifyNextDirect(l),n[0]=l}e.modifyEnd(s)}getInnerDistance2(t,e,r,i){let n;return r?(n=this.getFinalSweep(t.end,t.start,!0,i),this.calInnerDistance2(t,e,n)):(n=this.getFinalSweep(t.start,t.end,!1,i),this.calInnerDistance3(t,e,n))}getSweep4Node(t,e){let r=t.point.sub(e.point).normalize();return e.direct.cross(r)>0?le.CCW:le.CW}getFinalSweep(t,e,r,i){let n=t.point.sub(e.point).normalize(),s=e.direct,a,l=s.cross(n);return-XIe<=l&&l<=XIe?r?a=K6(i.flatMap(c=>c[0])):a=K6(i.flatMap(c=>c[1])):a=l>0?le.CCW:le.CW,a}getInner90Distance2(t,e,r){let i;if(r)return i=this.getSweep4Node90(t.direct,t.start,t.end),this.calInnerDistance2(t,e,i);{let n=this.degreeTool.degree90(t.direct,t.end.point,t.start.point),s=ia(t.direct,n);return i=this.getSweep4Node90(s[1],t.end,t.start),this.calInnerDistance3(t,e,i)}}getSweep4Node90(t,e,r){let i=e.direct,n=r.point.sub(e.point).normalize(),s=new S(i.x,0).normalize(),a=new S(0,i.y).normalize(),l;if(ne.eq(i.cross(new S(1,0)),0)||ne.eq(i.cross(new S(0,1)),0)){let c=s.cross(n),h=s.cross(a),u=a.cross(n),d;c*h>0&&c*u<0?(d=i.cross(t),ne.eq(d,0)&&(d=i.cross(n))):d=i.cross(n),l=ne.greater(d,0)?le.CCW:le.CW}else{let c=new S(n.x,0).normalize(),h=new S(0,n.y).normalize();i.x*i.y>0?n.x*n.y<=0?l=ne.greater(i.cross(n),0)?le.CCW:le.CW:l=ne.greater(i.cross(t),0)?le.CCW:le.CW:n.x*n.y>=0?l=ne.greater(i.cross(n),0)?le.CCW:le.CW:l=ne.greater(i.cross(t),0)?le.CCW:le.CW}return l}getInnerDistance(t,e){let r=this.map.get(t),i=e.sub(r.start).normalize(),n=r.lastDirect,s=ne.greater(n.cross(i),0)?le.CCW:le.CW;return this.calInnerDistance(t,s)}getInner90Distance(t,e){let r=this.map.get(t),i=t.direct,n=r.lastDirect,s=e.sub(r.start).normalize(),a=new S(n.x,0).normalize(),l=new S(0,n.y).normalize(),c;if(ne.eq(n.cross(new S(1,0)),0)||ne.eq(n.cross(new S(0,1)),0)){let h=a.cross(s),u=a.cross(l),d=l.cross(s),p;h*u>0&&h*d<0?(p=n.cross(i),ne.eq(p,0)&&(p=n.cross(s))):p=n.cross(s),c=ne.greater(p,0)?le.CCW:le.CW}else n.x*n.y>0?s.x*s.y<=0?c=ne.greater(n.cross(s),0)?le.CCW:le.CW:c=ne.greater(n.cross(i),0)?le.CCW:le.CW:s.x*s.y>=0?c=ne.greater(n.cross(s),0)?le.CCW:le.CW:c=ne.greater(n.cross(i),0)?le.CCW:le.CW;return this.calInnerDistance(t,c)}getInnerDistance1(t,e,r){let i=r.sub(e.start).normalize(),s=e.lastDirect.cross(i)>0?le.CCW:le.CW;return this.calInnerDistance(t,s)}getInnerCornerNode(t,e,r){let i=this.map.get(t),n=e.sub(i.start).normalize();return(i.lastDirect.cross(n)>0?le.CCW:le.CW)==le.CCW?r.tracks[0]:r.tracks[r.tracks.length-1]}testMulti(t,e){let r=t.node,i=r.start;if(i.allowModifyDirect){let n=this.degreeTool.degree45(i.direct,i.point,e),s=ia(i.direct,n);r.direct=s[0],i.direct=s[0],r.end.direct=s[1]}else{let{path:n,tool:s}=new cf().alignAngle(this.map.get(r),Math.PI/4,2,45),a=this.tool.degree45_v1(s),l=this.degreeTool.degree45(s.directInfo.nextDirect,a[a.length-1],s.directInfo.end),c=ia(s.directInfo.nextDirect,l),h=o_(l[1],l[2],c[0]),d=(r.width+zg(s.edgeParam.angle,2))*Math.sqrt(2)/2,p,m;Math.abs(h)<d?(s.modifyEnd(l[1].add(c[0].mul(Math.abs(Qj(l[1],l[2],c[0]))))),p=s.directInfo.end.add(new S(-c[0].y,c[0].x).mul(2)),m=s.directInfo.end.add(new S(c[0].y,-c[0].x).mul(2))):(p=s.directInfo.end.add(new S(-c[1].y,c[1].x).mul(2)),m=s.directInfo.end.add(new S(c[1].y,-c[1].x).mul(2))),r.direct=c[0],r.end.direct=c[1],s.modifyNextDirect(c[0]);let g=new S(-s.directInfo.lastDirect.y,s.directInfo.lastDirect.x),y=s.directInfo.lastDirect.cross(s.directInfo.end.sub(i.point)),b=s.clone(s.directInfo.start.add(g.mul(2)),p,y<0?4:0),P=s.clone(s.directInfo.start.add(g.mul(-2)),m,y<0?0:4);this.draw(s),this.draw(b),this.draw(P)}}draw1(t,e,r,i,n){let s=r.result.command,a=t.directInfo.end,l=e.end.model,c=!1,h;(l instanceof Je||l instanceof It)&&l instanceof Je&&l.net==e.net&&(c=n.singleWireIsNeedFanout(e.layerId,[e.start.model,l],!1));let u=this.fixEndpoint(r,e.start.point,e.start.direct,a,Math.PI/4);if(u.equals1(e.start.point))h=this.degreeTool.degree45(t.directInfo.nextDirect,e.start.point,u);else{e.isReverse&&(t.edgeParam.edgeLength=0);let d=this.tool.degree45_v1(t);if(c){let p,m=Un.getInstance().getLastEvent();m?p=m.node.end.point:p=e.start.point;let[,g]=n.getFanoutResults(t.directInfo.end,l,p,r,c),y=this.degreeTool.degree45(t.directInfo.nextDirect,d[d.length-1],g);this.modifyWireDirection(e,e.start.direct,y),h=Ku(d.concat([].concat(y,n.endPoints)));let b=!0;if(h.length>2){let P=h.slice(h.length-3),T=ia(t.directInfo.nextDirect,P);b=T[0].dot(T[1])>.1}if(!b||this.hasObstacle(h,e)){let P=this.degreeTool.degree45(t.directInfo.nextDirect,d[d.length-1],t.directInfo.end);h=Ku(d.concat(P))}}else{let p=this.degreeTool.degree45(t.directInfo.nextDirect,d[d.length-1],t.directInfo.end);h=Ku(d.concat(p))}}this.factory.drawWireTrack(h,e,s,i)}hasObstacle(t,e){if(tr.getInstance().mode=="WIRING_MODE_OBSTRUCT"){let r=new As,i=Nt.filter;Nt.setPushFilter(),Nt.pushFilter.trackfilter.setMode(!0),Nt.pushFilter.setNetAndLayerId(e.net,e.layerId);for(let n=1;n<t.length;n++){let s=new qr("",e.layerId,t[n-1],t[n],e.width,!1,e.net),a=r.blockTrackPrimitive(s,s.primitive,!0,!1);if(s.remove(),a.length!=0)return Nt.filter=i,!0}Nt.filter=i}return!1}draw(t){let e=this.tool.degree45_v1(t);this.degreeTool.degree45(t.directInfo.nextDirect,e[e.length-1],t.directInfo.end)}draw90_v1(t,e,r,i){let n=this.tool.degree90_v1(t),s=this.degreeTool.degree90(t.directInfo.nextDirect,n[n.length-1],t.directInfo.end);this.factory.drawWireTrack(n.concat(s),e,r,i)}drawArcAlignPath(t,e,r,i){t.primitives.forEach(n=>{let s;if(n instanceof M){s=this.factory.createTrack(e.layerId,n.start(),n.end(),e.width,e.net,r);let a=this.factory.addList(s,i,r);a.ignoreArcOptimization=!0}else if(n instanceof q){s=this.factory.createArcTrack(e.layerId,n.center,n.rx,n.startAngle*(Math.PI/180),(n.startAngle+n.sweepAngle)*(Math.PI/180),n.isCCW?1:0,e.width,e.net,r);let a=this.factory.addList(s,i,r);a.ignoreArcOptimization=!0}})}};var Dhe=new S(1,0),whe=new S(1,1).normalize(),Lhe=new S(0,1),Mhe=new S(-1,1).normalize(),Nhe=class extends HF{constructor(e,r){super();this.map=new Map;this.map1=new Map;this.event=e;let i=hf.getInstance(),n,s=e.tracks.map(p=>p.start.model).filter(Boolean),a=s.map(p=>p.globalIndex),l=a,c=Ss.getInstance().wireMode=="Multi-route wiring";if(c&&i.startItems.length){for(let p of i.startItems)if(p instanceof yt){let m=xt.getInstance().getListNode(p).parent.getAllItems();m.length&&m.forEach(g=>{l.includes(g.globalIndex)||l.push(g.globalIndex)})}}this.resetDrawStatus(e);let h=(()=>{let p=e.tracks.map(b=>b.net),m=p.every(b=>b==null),g=p[0],y=p.every(b=>b===g);return m||y})(),u=go.getSingleItems(r.x,r.y);u instanceof _n||(r=go.getItemAndPoint(u,r.x,r.y,!0,!1).point);let d=e.tracks.some(p=>p.start.point.equals(r));if(h){if(u instanceof _n||!(u instanceof Le||u instanceof Ue||u instanceof Ge))return;let p=e.tracks.reduce((y,b)=>(y.set(b.net,(y.get(b.net)||0)+1),y),new Map);if(!p.has(u.net))return;let m=r,g=new Set([u]);for(let y of e.tracks){if(u!=null&&c&&l.includes(u.globalIndex))return;let b=new Set(g);if(g.size==e.tracks.length)break;if(!((Array.from(g).reduce((T,I)=>(T.set(I.net,(T.get(I.net)||0)+1),T),new Map).get(y.net)||0)>=(p.get(y.net)||0)))for(let T of b){let I=this.getNearItem1(T,y.net,y.layerId,m,C=>C.filter(E=>{if(a.includes(E.globalIndex))return!1;if(!g.has(E))return!0}));if(I&&!g.has(I)){m=this.fixPosition(I,m,c),g.add(I);break}}}this.findOptimalMatch(e,g,r)}else{for(let m of e.tracks){let g=this.getEndpoint(m,r);if(g!=null&&!d){if(c&&l.includes(g.globalIndex))break;this.map.set(m,g);let y=this.fixPosition(g,r,c);this.map1.set(m,y),n=y}}if(this.map.size==0)return;let p=null;for(let m of e.tracks){let g=this.map.get(m);if(g==null){let y=p;if(p==null&&(y=this.getNextReferItem(m)),y!=null){let b=this.map.get(y);if(g=this.getNearItem1(b,m.net,m.layerId,n,P=>P.filter(T=>a.includes(T.globalIndex)&&T.getParent()?!s.map(I=>I.getParent()).includes(T.getParent().model):!0)),this.isResult(g,m)){let P=this.fixPosition(g,r,c);this.map.set(m,g),this.map1.set(m,P)}else g=null}}g!=null&&(p=m)}}if(this.map1.size>1){this.map1=this.filterByStandardDeviation(this.map1,3);for(let[p,m]of this.map)this.map1.get(p)||this.map.delete(p)}}resetDrawStatus(e){for(let r of e.tracks)r.end.model=null,r.drawing!=1&&(r.drawing=0)}sortItems(e,r){let i=r.length;if(i===0)return r;let n=r.map(I=>this.fixPosition(I,e)),s=n[0];for(let I=1;I<i;I++)s=s.add(n[I]);s=s.mul(1/i);let a=0,l=0,c=0,h=0;for(let I of n){let C=I.sub(s).normalize();a+=Math.abs(Dhe.cross(C)),l+=Math.abs(whe.cross(C)),c+=Math.abs(Lhe.cross(C)),h+=Math.abs(Mhe.cross(C))}let u=[{sum:a,dir:Dhe},{sum:l,dir:whe},{sum:c,dir:Lhe},{sum:h,dir:Mhe}];u.sort((I,C)=>I.sum-C.sum);let d=u[0].dir,p=new S(-d.y,d.x).normalize(),m=n.map((I,C)=>({item:r[C],project:I.sub(s).dot(d)}));m.sort((I,C)=>{let E=I.project-C.project;if(Math.abs(E)<1e-4){let O=n[r.indexOf(I.item)].sub(s).dot(p),_=n[r.indexOf(C.item)].sub(s).dot(p);return O-_}else return E});let g=m.map(I=>I.item),y=this.event.tracks.map(I=>I.start.point),b=y[0],T=y[y.length-1].sub(b).normalize();return d.dot(T)<0?g.reverse():g}findOptimalMatch(e,r,i){let n=e.tracks,s=Array.from(r),a=(h,u,d,p)=>Hte(h,u,d,p),c=((h,u)=>{let d=h.length,p=u.length,m=Array.from({length:d+1},()=>Array(p+1).fill(0)),g=Array.from({length:d+1},()=>Array(p+1).fill(null));for(let T=1;T<=d;T++)for(let I=1;I<=p;I++){let C=h[T-1],E=u[I-1];if(C.net===E.net&&C.layerId===E.layerId){let O=!0;for(let _=0;_<T-1;_++){let R=h[_],v=g[_+1][I-1];if(v&&a(R.start.point,this.fixPosition(v,i),C.start.point,this.fixPosition(E,i))){O=!1;break}}O?(m[T][I]=m[T-1][I-1]+1,g[T][I]=E):m[T][I]=Math.max(m[T-1][I],m[T][I-1])}else m[T][I]=Math.max(m[T-1][I],m[T][I-1])}let y=[],b=d,P=p;for(;b>0&&P>0;)m[b][P]===m[b-1][P]?b--:(m[b][P]===m[b][P-1]||(y.push({track:h[b-1],item:g[b][P]}),b--),P--);return y.reverse()})(n,this.sortItems(i,s));if(c){for(let{track:h,item:u}of c)if(u){this.map.set(h,u);let d=this.fixPosition(u,i);this.map1.set(h,d)}}}isPointsCollinear(e){if(e.length<=2||Hne(e))return!0;let r=e[1].sub(e[0]);for(let i=2;i<e.length;i++){let n=e[i].sub(e[0]),s=r.cross(n);if(!ne.eq(s,0))return!1}return!0}filterByStandardDeviation(e,r){let i=[];for(let p of e.values())i.push(p);if(i.length>1&&this.isPointsCollinear(i))return e;let n=0,s=0;e.forEach(p=>{n+=p.x,s+=p.y});let a=n/e.size,l=s/e.size,c=0;e.forEach(p=>{c+=(p.x-a)**2+(p.y-l)**2});let h=c/e.size,u=Math.sqrt(h),d=new Map;return e.forEach((p,m)=>{Math.sqrt((p.x-a)**2+(p.y-l)**2)<=r*u&&d.set(m,p)}),d}getEndPoint(){if(this.map.size==0)return!1;let e=new Array;for(let a=0;a<this.event.tracks.length;a++){let l=this.event.tracks[a];if(l.drawing==1)continue;l.end.point=l.start.point,l.drawing=2;let c=this.map.get(l);if(c!=null){let h=this.map1.get(l),{direct:u,allowModify:d}=go.getDirect(h,c);d?l.end.allowModifyDirect=!0:l.end.direct=u,l.end.point=this.map1.get(l),e.push({info:l,item:c,project:0})}}let i=this.sort(e).map(a=>a.info),n=this.findMaxCommonSubsequence(this.event.tracks,i),s=this.findMaxCommonSubsequence(this.event.tracks,i.reverse());if(n.length>s.length){for(let a of n)a.end.direct=a.end.direct.mul(-1),a.end.allowModifyDirect=!1,a.drawing=0;return!0}else{for(let a of s)a.drawing=0,a.end.allowModifyDirect=!1;return!0}}getEndPoint_v1(){if(this.map.size==0)return!1;let e=new Array;for(let u=0;u<this.event.tracks.length;u++){let d=this.event.tracks[u];if(d.drawing==1)continue;d.end.point=d.start.point,d.drawing=2;let p=this.map.get(d);if(p!=null){let m=this.map1.get(d),{direct:g,allowModify:y}=go.getDirect(m,p);y?d.end.allowModifyDirect=!0:d.end.direct=g,d.end.point=m,d.end.model=Bt.checkIsCanEditByItem(p)?p.model:void 0,e.push({info:d,item:p,project:0})}}let i=this.sort(e).map(u=>u.info),n=i.map(u=>this.map1.get(u)),s=!0,a=i.map(u=>u.start.point);if(i.map(u=>u.net).some(u=>Vh.getNet(u).netDifferentail))s=!1;else if(n.some(u=>!u))s=!1;else for(let u=0;u<i.length;u++){let d=a[u],m=n[u].sub(d).normalize(),g=i[u].direct;if(Math.abs(m.cross(g))>.0875){s=!1;break}}if(s){for(let u=0;u<i.length;u++){let d=i[u],p=this.map.get(d),m=this.map1.get(d);d.end.point=m,d.drawing=0,d.end.direct=p instanceof Ue?go.getDirect(m,p).direct:d.direct,d.end.allowModifyDirect=!1,d.end.model=Bt.checkIsCanEditByItem(p)?p.model:void 0}return this.clearWaitInfoModel(),!0}let c=this.findMaxCommonSubsequence(this.event.tracks,i),h=this.findMaxCommonSubsequence(this.event.tracks,[...i].reverse());if(c.length>h.length)for(let u of c)u.end.allowModifyDirect=!1,u.drawing=0;else for(let u of h)u.drawing=0,u.end.direct=u.end.direct.mul(-1).normalize(),u.end.allowModifyDirect=!1;return this.clearWaitInfoModel(),!0}clearWaitInfoModel(){for(let e of this.event.tracks)e.drawing==2&&(e.end.model=null)}getEndEvent(e){let r=e.length,i=new Array;for(let s=0;s<r;s++){let a=e[s];if(s==0&&(a.previous=null),s+1<r){let l=e[s+1],c=a.next,h=c.width,u=c.next;for(;u!=l;)h+=u.width,c=u.next,h+=c.width,u=c.next;let d=new pC(h);i.push(d)}else a.next=null}let n=new fC(e,i,e[0]);return n.linked(e,i),n}findMaxCommonSubsequence(e,r){let i=e.length,n=r.length,s=new Array(i+1);for(let h=0;h<=i;h++)s[h]=new Array(n+1).fill(0);for(let h=1;h<=i;h++)for(let u=1;u<=n;u++)e[h-1]===r[u-1]?s[h][u]=s[h-1][u-1]+1:s[h][u]=Math.max(s[h-1][u],s[h][u-1]);let a=[],l=i,c=n;for(;l>0&&c>0;)e[l-1]===r[c-1]?(a.unshift(e[l-1]),l--,c--):s[l-1][c]>=s[l][c-1]?l--:c--;return a}sort(e){let r=e.length;if(r==0)return;let i=e[0].info.end.point;for(let d=1;d<r;d++)i=i.add(e[d].info.end.point);i=i.mul(1/r);let n=0,s=0,a=0,l=0;for(let d of e){let p=d.info.end.point.sub(i).normalize();n+=Math.abs(Dhe.cross(p)),s+=Math.abs(whe.cross(p)),a+=Math.abs(Lhe.cross(p)),l+=Math.abs(Mhe.cross(p))}let c=[{sum:n,dir:Dhe},{sum:s,dir:whe},{sum:a,dir:Lhe},{sum:l,dir:Mhe}];c.sort((d,p)=>d.sum-p.sum);let h=c[0].dir,u=new S(-h.y,h.x).normalize();for(let d of e)d.project=d.info.end.point.sub(i).dot(h);if(e.sort((d,p)=>{let m=d.project-p.project;if(Math.abs(m)<1e-4){let g=d.info.end.point.sub(i).dot(u),y=p.info.end.point.sub(i).dot(u);return g-y}else return d.project-p.project}),!e[0].info.end.allowModifyDirect)h.cross(e[0].info.end.direct)<0&&(e=e.reverse());else for(let d of e)d.info.end.direct=u;return e}getNextReferItem(e){let r=e.next;for(;r!=null;)if(e=r.next,r=e.next,this.map.get(e)!=null)return e;return null}isResult(e,r){if(e instanceof Le){if((e.layerId==12||e.layerId==r.layerId)&&r.net==e.net)return!0}else if(e instanceof Ue){if(e.layerId==r.layerId&&r.net==e.net)return!0}else if(e instanceof Ge&&e.isContains(r.layerId)&&r.net==e.net)return!0;return!1}getEndpoint(e,r){let i=go.click4ConnectNode(r.x,r.y,["Pad","Via","Track","ArcTrack"]),n=new Array,s=new Array,a=new Array;for(let l of i)l instanceof Le?(l.layerId==12||l.layerId==e.layerId)&&e.net==l.net&&n.push(l):l instanceof Ue?l.layerId==e.layerId&&e.net==l.net&&s.push(l):l instanceof Ge&&l.isContains(e.layerId)&&e.net==l.net&&a.push(l);return n.length>0?n[0]:a.length>0?a[0]:s.length>0?s[0]:null}hightEnd(){this.map.forEach(e=>{ji.getInstance().setHightItem(e),_r.getInstance().current.setHight(e.globalIndex)})}};var khe=class{constructor(){this.startItemsConnects={}}setStartConnect(t){if(t){let e=this.startItemsConnects[t.globalIndex];if(!e){let r=t.globalIndex,n=new er().getItem(r);if(n instanceof ds){let s=n.searchAllConnectNode1(),a=Array.from(s).map(l=>l.globalIndex);a.push(r),e=this.startItemsConnects[r]=a}else e=this.startItemsConnects[r]=[]}return e}return[]}getStartConnect(t){return this.startItemsConnects[t.globalIndex]}};var MG=class{constructor(t){this.clusters=new Array;this.ratline=[];this.startNodes=new Set;this.startNodeIds=[];this.net=t}highlight(){ze.highlightNet(this.net,!0),this.hideDelNodes()}hideDelNodes(){hf.getInstance().oldStartItems.forEach(e=>{e instanceof yt&&gc.getInstance().has(e.globalIndex)&&pr.getItem(e.globalIndex).iteratorRatlines(i=>{i.hidden()})})}static hightRatlineNets(t){Ya.useWebgl||zo.bulkUpdatesVisible(!1,t),zo.highlightNets(t)}static unhighlight(){ze.unhighlightNet(""),zo.unHighlightNet(""),zo.clearHighlightNet()}setStartItems(t){this.highlight();let e=this.net,r=new er;t0.useWireClusterCache=!0;let i=XS(e)||[];t0.useWireClusterCache=!1,this.startNodeIds=Array.from(t),this.startNodeIds.forEach(n=>{let s=r.getItem(n);s&&this.startNodes.add(s)});for(let n of i){let s=!0;for(let a of t)if(n.has(a)){s=!1;break}if(s){let a=jS.get(n);a&&this.clusters.push(a)}}}getEndpoint(t,e){let r,i=Number.MAX_SAFE_INTEGER;for(let n of e.junctions){let s=t.point.distance2(n.point);s<i&&(i=s,r=n)}return r}generateRatline(t,e){if(this.clear(),this.clusters.length+t.length>1){let i=new Array,n=[],s=0;for(let a of t){let l=new Array;s++;let c=new gl(a);l.push(c),n.push(new yR(l,s))}for(let a=0;a<n.length;a++){let l=n[a],c=n[a+1];if(c){let h=new Kb(c,l,c.junctions[0],l.junctions[0]);i.push(h)}}for(let a=0;a<this.clusters.length;a++){let l=this.clusters[a];for(let c of n){let h=new Kb(c,l,c.junctions[0],this.getEndpoint(c.junctions[0],l));i.push(h)}}if(xr(i,(a,l)=>a.length2-l.length2,0,i.length),i.length>0)for(let a=0;a<t.length;a++){let l=i[a];if(!l)return;let c=l.left,h=l.right;c.id&&this.hideRatline(c.id),h.id&&this.hideRatline(h.id);let u=ze.getSpecialColor(e),d=new hr(57,c.point,h.point,!0,u);d.click(),this.ratline.push(d)}}}hideRatline(t){let r=new er().getItem(t);if(!r)return;let i=r;this.startNodes.forEach(n=>{n.iteratorRatlines(s=>{i.hasRatline(s)?s.hidden():s.visible()})})}clear(){this.ratline.forEach(t=>{t.remove()}),this.ratline.length=0}};var NG=class{static getViaPos(t){if(!t)return null;let e=t.viaNode;if(e!=null){let r=t.getAllItems(),n=t.getFirst().start,s=r.length-1;return r.length>0&&(e.next?(Ss.getInstance().wireConfirmType=="previous"&&r.length>1&&(s=r.length-2),n=r[s].end):s=0),n}return null}};var wje=Math.PI,S7o=Math.PI/2,Lje=Math.PI/4,kje=Math.PI/8;var Mje=Math.sin(kje),Nje=Math.tan(kje),kRt=Mje*Nje/(Nje-Mje),c$=class c${constructor(t,e,r,i){this.sameCornerRef=[];this.models=[];let n=r.item.start,s=r.item.end,a=i.item.end;this.delta=t,this.corner=s,this.style=e,this.SC=s.sub(n).normalize(),this.CE=a.sub(s).normalize();let l=this.SC.cross(this.CE);this.sweep=l>0?le.CCW:le.CW,c$.cornerType===0?this.angle=this.sweep===le.CCW?Lje:-Lje:(l<-1?l=-1:l>1&&(l=1),this.angle=Math.asin(l));let c=this.angle>0?(wje-this.angle)/2:-(wje+this.angle)/2;this.bisectorDirect=this.CE.rotate(S.ORIGIN,c),this.models.push(r.item,i.item)}getModels(){return this.models}get factor(){if(c$.cornerType===0)return kRt;let t=Math.abs(this.angle)/2,e=Math.sin(t),r=Math.tan(t);return e*r/(r-e)}getArcCenter(){let t=this.bisectorDirect.mul(this.delta/this.factor);return this.corner.add(t)}getLine(){let t=this.getArcCenter();return new M(this.corner,t)}getLine1(t){let e=this.delta/this.factor,r=this.corner.add(this.bisectorDirect.mul(e+t));return new M(this.corner,r)}getArcStartAndEnd(){if(this.delta==0)return[this.corner,this.corner];let t=this.corner.add(this.SC.mul(-this.delta)),e=this.corner.add(this.CE.mul(this.delta));return[t,e]}calcDelta(t){return this.factor*t}isSame(t){if(this.sweep!==t.sweep||!this.bisectorDirect.similarEquals(t.bisectorDirect,1e-7))return!1;let e=this.corner.sub(t.corner).normalize();if(e.similarEquals(this.bisectorDirect,.001)||e.mul(-1).similarEquals(this.bisectorDirect,.001))return!0}getOutsideTargetDelta(t){let r=this.corner.sub(t.corner).length()*Math.sin(Math.abs(this.angle/2));return this.delta+r}getInnerTargetDelta(t){let r=this.corner.sub(t.corner).length()*Math.sin(Math.abs(this.angle/2));return this.delta>r?this.delta-r:0}getNeedFilterNodes(){let t=[],e=this.sameCornerRef;return this.innerCornerRef&&(t.push(...this.innerCornerRef.models),e=this.innerCornerRef.sameCornerRef),e&&e.forEach(r=>{t.push(...r.models)}),new Set(t)}};c$.cornerType=0;var Sb=c$,h$=class{constructor(){this.arc=new ro;this.blockShape=new As;this.wireStatusManager=Fr.getInstance();this.fac=new ri,this.cornerMap=new Map,this.sourceCornerMap=new Map}optimization(t){this.result=t;let e=tr.getInstance().type;this.command=t.command,hi.getInstance().update();let r=!1;switch(e){case"WIRING_CORNER_ARC45":{Sb.cornerType=0;break}case"WIRING_CORNER_ARC":{Sb.cornerType=1;break}case"WIRING_CORNER_ARC90":Sb.cornerType=1;break;case"WIRING_CORNER_LINE45":{if(ce.pcbConfig.autoChamferTrack=="off")return;Sb.cornerType=0,r=!0;break}case"WIRING_CORNER_LINE90":case"WIRING_CORNER_FREEANGLE":if(ce.pcbConfig.autoChamferTrack=="off")return;Sb.cornerType=1,r=!0;break;default:return}let i=this.getLists(t);for(let n of i){let s=n.listIterator(),a;s.hasNext()&&(a=s.next());let l=this.wireStatusManager.getStatus(a);for(;!l.isInput&&s.hasNext();)a=s.next(),l=this.wireStatusManager.getStatus(a);let c;if(s.hasNext()&&(c=s.next()),r&&(a!=null&&a.prev)){let h=this.getArcCornerInfo(a.prev,a,c);this.addCornerInfo2SourceMap(n,h)}for(;s.hasNext();){let h=s.next(),u=this.getArcCornerInfo(a,c,h);this.addCornerInfo2SourceMap(n,u),a=c,c=h}if(c){let h=this.getArcCornerInfo(a,c);this.addCornerInfo2SourceMap(n,h)}}this.buildInnerCornerRef(i),tr.getInstance().mode!=="WIRING_MODE_IGNORE"&&this.fixObstacleAroundDelta(),this.fixOutsideCornerDelta(i),this.maximumRadius(i),this.gnrArcCorner(i),this.cornerMap=null,e==="WIRING_CORNER_ARC"&&this.optimizeArcLineCorner(i),Ss.getInstance().wireConfirmType==="previous"&&this.fixViaPosition()}maximumRadius(t){let e=tr.getInstance().type,r=ce.pcbConfig.autoChamferTrack!="off"&&["WIRING_CORNER_LINE45","WIRING_CORNER_LINE90"].includes(e)?ce.pcbConfig.filletRadiusTrack:al.getInstance().getMaximumRadius()/10;for(let i of t){let n=this.sourceCornerMap.get(i);if(n)for(let s of n){let a=Math.tan(Math.abs(s.angle/2));s.delta/a>r&&(s.delta=r*a)}}}addCornerInfo2SourceMap(t,e){if(!e)return;let r=this.sourceCornerMap.get(t);r||(r=[],this.sourceCornerMap.set(t,r)),r.push(e)}getArcCornerInfo(t,e,r){let i=t.item.start,n=t.item.end,s=e.item.end;if(this.isCollinear(i,n,s)||t.ignoreArcOptimization||e.ignoreArcOptimization||t.item instanceof Oi||e.item instanceof Oi||t.item.width!==e.item.width||Sb.cornerType===0&&!(this.isDirect45(t.item.direct)&&this.isDirect45(e.item.direct)))return;if(!r){let m=n.sub(i).length(),g=s.sub(n).length(),y=this.cornerMap.get(t);y&&(m=m-y.delta);let b=m-g,P;return b>0?P=new Sb(g,0,t,e):P=new Sb(m,1,t,e),this.cornerMap.set(e,P),P}let a=r.item.end,l=n.sub(i).length(),c=this.cornerMap.get(t);c&&(l=l-c.delta);let h=s.sub(n).length(),u=a.sub(s).length(),d=l-h,p;return this.isCollinear(n,s,a)?(d>0?p=new Sb(h,0,t,e):p=new Sb(l,1,t,e),this.cornerMap.set(e,p),p):(h>=l+u?p=new Sb(l,1,t,e):l<h/2?p=new Sb(l,1,t,e):u<h/2?p=new Sb(h-u,2,t,e):p=new Sb(h/2,2,t,e),this.cornerMap.set(e,p),p)}buildInnerCornerRef(t){let e=this;for(let i=0;i<t.length-1;i++){let n=t[i],s=this.sourceCornerMap.get(n);if(s)for(let a=0;a<s.length;a++){let l=s[a];!l||l.innerCornerRef||l.sweep===le.CCW&&r(l,!0,i)}}for(let i=t.length-1;i>0;i--){let n=t[i],s=this.sourceCornerMap.get(n);if(s)for(let a=0;a<s.length;a++){let l=s[a];!l||l.innerCornerRef||l.sweep===le.CW&&r(l,!1,i)}}function r(i,n,s){let a=0,l=s;for(n&&(a=s+1,l=t.length);a<l;a++){let c=t[a],h=e.sourceCornerMap.get(c);if(h)for(let u of h){if(u.innerCornerRef)continue;i.isSame(u)&&(u.innerCornerRef=i,i.sameCornerRef.push(u))}}}}fixObstacleAroundDelta(){let t=new As;this.cornerMap.forEach((e,r)=>{let i=this.getArcByCornerInfo(e);if(!i){e.delta=0;return}let n=e.getNeedFilterNodes(),s=(c,h,u,d=!1)=>{let p=t.blockTrackPrimitive(c,h,u,d);return p=p.filter(m=>!(m.obstacle instanceof yt&&n.has(m.obstacle)||m.source instanceof yt&&n.has(m.source))),p},a=s(r.item,i,!1,!1),l=!1;if(a.length>0){let c=a[0].clearance,h=e.getLine1(c),u=s(r.item,h,!1,!1);if(u.length>0){let d=u[0].point;if(d.equals1(e.corner))e.delta=0;else{let p=d.sub(e.corner).length(),m=e.calcDelta(p);m<e.delta&&(e.delta=m,e.style=2)}}l=!0}if(l&&e.delta>0){let c=0,h=0,u=e.delta;for(;c<8;){c++;let d=this.getArcByCornerInfo(e);if(!d){e.delta=0;return}if(s(r.item,d,!1,!1).length>0&&(u=e.delta,e.delta=(h+e.delta)/2,e.style=2),c===1)break;h=e.delta,e.delta=(e.delta+u)/2}c>=8&&(e.delta=h,e.style=2)}})}fixOutsideCornerDelta(t){for(let e=0;e<t.length;e++){let r=t[e],i=this.sourceCornerMap.get(r);if(i)for(let n=0;n<i.length;n++){let s=i[n];if(!s||s.sameCornerRef.length<=0)continue;let a=Array.from(s.sameCornerRef);a.sort((u,d)=>{let p=u.corner.sub(s.corner).length(),m=d.corner.sub(s.corner).length();return p-m});let l=a[a.length-1];s.corner.sub(l.corner).normalize().similarEquals(s.bisectorDirect.mul(-1),1e-7)&&(a.pop(),a.unshift(s),a.reverse(),s=l);let h=s;for(let u=0;u<a.length;u++){let d=a[u],p=h.getOutsideTargetDelta(d);if(d.delta>p)d.delta=p,d.style=2;else if(d.delta<p){let m=d.getInnerTargetDelta(h);m>0&&(h.delta=m,h.style=2)}h=d}if(Ss.getInstance().wireMode=="Differential pair wiring"){let u=a[a.length-1],d=al.getInstance().getMaximumRadius()/10*Math.tan(Math.abs(u.angle/2));if(d<u.delta){u.delta=d;let p=Array.from(a);p.reverse(),p.push(s);let m=null;for(let g of p){if(m!=null){let y=m.getInnerTargetDelta(g);g.delta=y}m=g}}}}}}gnrArcCorner(t){for(let e of t){let r=e.listIterator(),i;for(r.hasNext()&&(i=r.next());r.hasNext();){let n=r.next();if(i.item instanceof Oi||i.ignoreArcOptimization){i=n;continue}i=this.optimizationArc45PathNode(i,n)}}}optimizationArc45PathNode(t,e){let r=this.cornerMap.get(e);if(this.cornerMap.delete(e),!r)return e;let i=t.item,n=e.item,s=i.start,a=i.end,l=n.end,c=this.command,h=a.sub(s).length(),u=l.sub(a).length(),d=r.style,p=r.delta,m=1.2,y=Ot(i.primitive).equals1(Ot(n.primitive))&&(h<m*i.width||u<m*n.width);if(p<=0||y)return e;switch(h>p&&u>p?d=2:h>p?d=0:u>p?d=1:(p=Math.min(h,u),d=2),d){case 0:{let b=s.sub(a).normalize().mul(p).add(a),P=r.angle,T=this.creatArc(b,l,P);if(T!=null){let I=t.item,C=xt.getInstance().createList(),E=this.fac.createTrack(I.layerId,s,b,I.width,I.showNet,c,I.getGroupID());this.fac.addList(E,C,c);let O=this.createLineArcTrack(T,I,C,c);this.result.setInputStatus(C),C.replace(t,e),c.addCommand(new Ti(C)),e=O}break}case 1:{let b=l.sub(a).normalize().mul(p).add(a),P=r.angle,T=this.creatArc(s,b,P),I=t.item,C=xt.getInstance().createList();if(T!=null){let E=this.createLineArcTrack(T,I,C,c);if(p>=u)this.result.setInputStatus(C),C.replace(t,e),c.addCommand(new Ti(C)),e=E;else{let O=this.fac.createTrack(I.layerId,b,l,I.width,I.showNet,c,I.getGroupID()),_=this.fac.addList(O,C,c);this.result.setInputStatus(C),C.replace(t,e),c.addCommand(new Ti(C)),e=_}}break}case 2:{let b=s.sub(a).normalize().mul(p).add(a),P=l.sub(a).normalize().mul(p).add(a),T=r.angle,I=this.creatArc(b,P,T),C=t.item,E=xt.getInstance().createList();if(I!=null){let O=this.fac.createTrack(C.layerId,s,b,C.width,C.showNet,c,C.getGroupID());this.fac.addList(O,E,c),this.createLineArcTrack(I,C,E,c);let _=this.fac.createTrack(C.layerId,P,l,C.width,C.showNet,c,C.getGroupID()),R=this.fac.addList(_,E,c);this.result.setInputStatus(E),E.replace(t,e),c.addCommand(new Ti(E)),e=R}break}default:break}return e}getArcByCornerInfo(t){let e=t.style,r=t.getModels(),i=r[0],n=r[1],s=i.start,a=i.end,l=n.end,c=t.delta,h=t.angle;switch(e){case 0:{let u=s.sub(a).normalize().mul(c).add(a);return this.creatArc(u,l,h)}case 1:{let u=l.sub(a).normalize().mul(c).add(a);return this.creatArc(s,u,h)}case 2:{let u=s.sub(a).normalize().mul(c).add(a),d=l.sub(a).normalize().mul(c).add(a);return this.creatArc(u,d,h)}default:return null}}getLists(t){let e=[];for(let[r,i]of t.wireMap)e.push(i);return e}fixViaPosition(){let t=Un.getInstance().current;for(let e of t.tracks){let r=t.result.wireMap.get(e);if(!r)continue;let i=r.getAllItems(),n=t.result.wireVia.get(e);if(i.length>=0&&n){let s=i.length===0?e.start.point:NG.getViaPos(r);n.item.center=s}}}optimizeArcLineCorner(t){for(let e of t){let r=e.listIterator(),i;r.hasNext()&&(i=r.next());let n=this.wireStatusManager.getStatus(i);for(;!n.isInput&&r.hasNext();)i=r.next(),n=this.wireStatusManager.getStatus(i);for(;r.hasNext();){let s=r.next();if(!this.checkArcLineCorner(i,s)){i=s;continue}i=this.roundArcLineCorner(i,s)}}}checkArcLineCorner(t,e){if(t.item.width!==e.item.width)return!1;let r,i;if(t.item instanceof qr?i=t.item:t.item instanceof Oi&&(r=t.item),e.item instanceof qr?i=e.item:e.item instanceof Oi&&(r=e.item),!(r&&i))return!1;let n=i.direct;if(e.item instanceof Oi){let a=Ot(r.primitive,r.start);if(n.equals1(a))return!1}else if(t.item instanceof Oi){let a=Ot(r.primitive);if(n.equals1(a))return!1}let s=i.width;return i.length>s&&r.length>Math.PI*s}roundArcLineCorner(t,e){let r,i;t.item instanceof qr?i=t.item:t.item instanceof Oi&&(r=t.item),e.item instanceof qr?i=e.item:e.item instanceof Oi&&(r=e.item);let n=this.calcArcLineDelta(t,e),s=Ht.toDegrees(2*Math.asin(n/(2*r.radius))),a=this.command;if(t.item instanceof qr&&e.item instanceof Oi){let l=r.primitive,c=i.direct,h=l.sweep()===le.CCW?l.startAngle+s:l.startAngle-s,u=l.pointOn(h),d=Ot(r.primitive,u);if(c.equals1(d)||u.equals1(l.end()))return e;let p=i.start.add(c.mul(i.length-n)),m=this.creatArc1(p,u,c),g=q.build4(u,l.end(),l.center,l.rx,l.rx,l.sweep());if(m&&g){if(this.blockTrackPrimitive(r,m))return e;let b=t.item,P=xt.getInstance().createList(),T=this.fac.createTrack(b.layerId,i.start,p,b.width,b.showNet,a,b.getGroupID());this.fac.addList(T,P,a),this.createLineArcTrack(m,b,P,a);let I=this.createLineArcTrack(g,b,P,a);P.replace(t,e),a.addCommand(new Ti(P)),e=I}}else if(t.item instanceof Oi&&e.item instanceof qr){let l=r.primitive,c=i.direct,h=l.sweep()===le.CCW?l.endAngle()-s:l.endAngle()+s,u=l.pointOn(h),d=Ot(r.primitive,u);if(c.equals1(d)||u.equals1(l.start()))return e;let p=i.start.add(c.mul(n)),m=q.build4(l.start(),u,l.center,l.rx,l.rx,l.sweep()),g=this.creatArc1(u,p,d);if(m&&g){if(this.blockTrackPrimitive(r,g))return e;let b=t.item,P=xt.getInstance().createList();this.createLineArcTrack(m,b,P,a),this.createLineArcTrack(g,b,P,a);let T=this.fac.createTrack(b.layerId,p,i.end,b.width,b.showNet,a,b.getGroupID()),I=this.fac.addList(T,P,a);P.replace(t,e),a.addCommand(new Ti(P)),e=I}}return e}calcArcLineDelta(t,e){let r,i;if(t.item instanceof qr&&e.item instanceof Oi){let l=e.item;r=t.item.direct,i=Ot(l.primitive,l.start)}else if(t.item instanceof Oi&&e.item instanceof qr){let l=t.item;r=Ot(l.primitive),i=e.item.direct}let n=Math.min(t.item.start.distance1(t.item.end),e.item.start.distance1(e.item.end)),s=r.dot(i),a=t.item.width;return s<0&&(a=(1+Math.abs(s)*1.2)*a),n<a&&(a=n),a}blockTrackPrimitive(t,e){let r=this.blockShape.blockTrackPrimitive(t,e,!1);return r.length>0?r.some(i=>!i.isSameNet):!1}createLineArcTrack(t,e,r,i){let n;ce.pcbConfig.autoChamferTrack=="chamfer"?n=this.fac.createTrack(e.layerId,t.start(),t.end(),e.width,e.showNet,i,e.getGroupID()):n=this.fac.createArcTrack(e.layerId,t.center,t.rx,Ht.toRadians(t.startAngle),Ht.toRadians(t.endAngle()),t.sweep(),e.width,e.net,i,void 0,e.getGroupID());let s=this.fac.addList(n,r,i);return s.ignoreArcOptimization=!0,s}createTrack(){}creatArc(t,e,r){if(Math.abs(r)<.01)return null;let{center:i,radius:n,startAngle:s,endAngle:a,sweep:l}=this.arc.pointToAngle(t,e,r);return n>0?q.build2(i,Ht.toDegrees(s),Ht.toDegrees(a),n,n,l):null}creatArc1(t,e,r){let{center:i,radius:n,startAngle:s,endAngle:a,sweep:l}=this.arc.tangentToArc(r,t,e);return n>0?q.build2(i,Ht.toDegrees(s),Ht.toDegrees(a),n,n,l):null}isCollinear(t,e,r){let i=e.sub(t).normalize(),n=r.sub(e).normalize(),s=i.cross(n);return Math.abs(s)<1e-6}isDirect45(t){function e(i,n){return Math.abs(i-n)<=1e-5}if(e(t.x,0)||e(t.y,0))return!0;let r=Math.abs(t.x/t.y);return!!e(r,1)}};var U_=class{constructor(t,e,r,i,n,s,a,l,c,h){this._state="Only Main";this.globalIndex=su(),this.fonts=t,this.position=e,this.angle=r,this.limitMin=i,this.limitMax=n,this.fontWidth=s,this.fontHeight=a,this.layerId=l,this.color=c,this.layerIds=h,this.refreshRender()}get highlightColor(){return ee.BLACK}get highLightType(){return null}get viewGroupId(){if(this.layerIds&&this.layerId==1001)return"DRCError"+this.layerIds.toString()}setPosition(t){let e=t.sub(this.position),r=Ae.translate(e.x,e.y,0);this.transform(r)}getPosition(){return this.position}setAngle(t){this.angle=t,this.refreshRender()}getAngle(){return this.angle}setLineWidth(t){this.fontHeight=t,this.refreshRender()}getLineWidth(){return this.fontHeight}setLineLength(t){this.fontWidth=t,this.refreshRender()}getLineLength(){return this.fontHeight}remove(){this._state="Not Shown",this.refreshRender()}getText(){return this.fonts}modifyText(t){this.fonts=t,this.refreshRender()}transform(t){this.position=this.position.multiply4(t),this.refreshRender()}getType(){return 32}refreshRender(){Do.attach(this,this.getType())}getViewState(){return this._state}getRenderData(){return this}};var cN=class cN{constructor(){this.shapes=new Array;this.color=ee.of3("#7F7F7F");this.layerId=1002;this.width=.3;this.LENGTH_RATIO=1.5;this.PI4=Math.PI/4}static getInstance(){return cN.tool==null&&(cN.tool=new cN),cN.tool}refresh(t){this.remove();let e=t.end.direct,r=t.end.point,i=e.angleX()+this.PI4,n=new U_("\xD7",r,i,10,30,20,20,this.layerId);this.shapes.push(n)}clear(){this.remove()}remove(){for(let t of this.shapes)t.remove();this.shapes.length=0}};cN.tool=null;var O9=cN;var Bhe=class extends Ou{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e){super(),this.tool=e,this.mode=t}redo(){throw new Error("Method not implemented.")}undo(){this.tool.modifyWireMode(this.mode)}};var Fhe=class extends mC{constructor(){super();this.found=new Map}run(e){for(let[r,i]of e.wireMap){let n=this.split2(i);n.length>0&&e.command.addCommand(n)}}split(e){let r=new Br,i=e.getFirstNode(),n=e.getLastNode();for(;i!=null;){let s=i.item;if(!this.needCheck(s.globalIndex)){i=i.next;continue}let a=s.primitive,l=a.bbox().extendOfSize(s.width/2),c=Nt.searchPartition(l),h=this.getBlockInfo(a,c,n.item.end);if(h.length>0){let u=s.primitive,d=h[0].inter,p=h[0].pl,m=h[0].foot,g=h[0].globalIndex;if(d.equals1(a.start())){let C=this.partitionExtend(c,s.width/2,g);if(this.getBlockInfo1(a,C,n.item.end).length)d=m;else{i=i.next;continue}}let y=new ri,b;if(u instanceof M)b=y.createTrack(s.layerId,u.start(),d,s.width,s.showNet,r,s.getGroupID());else{let C=q.build4(u.start(),d,u.center,u.rx,u.rx,u.sweep());b=y.createArcTrackByArc(s.layerId,C,s.width,s.showNet,r,s.getGroupID())}let P=y.createList(),T=y.addList(b,P,r),I=Fr.getInstance().getStatus(i);Fr.getInstance().setStatus(T,I.clone()),P.replace(i,e.getLastNode()),r.addCommand(new Ti(P));break}else i=i.next}return r}split1(e){let r=new Br,i=e.getFirstNode(),n=e.getLastNode(),s=i.item.start;for(;i!=null;){let a=i.item;if(!this.needCheck(a.globalIndex)){s=a.end,i=i.next;continue}let l=a.primitive,c=l.bbox().extendOfSize(a.width/2),h=Nt.searchPartition(c),u=this.getBlockInfo(l,h,n.item.end);if(u.length>0){let d=a.primitive,p=u[0].inter,m=u[0].pl,g=u[0].foot,y=u[0].globalIndex;if(p.equals1(l.start())){let E=this.partitionExtend(h,1e-4,y);if(this.getBlockInfo1(l,E,n.item.end).length)p=g;else{s=a.end,i=i.next;continue}}let b=new ri,P;if(d instanceof M)P=b.createTrack(a.layerId,s,p,a.width,a.showNet,r,a.getGroupID());else{let E=q.build4(s,p,d.center,d.rx,d.rx,d.sweep());P=b.createArcTrackByArc(a.layerId,E,a.width,a.showNet,r,a.getGroupID())}let T=b.createList(),I=b.addList(P,T,r),C=Fr.getInstance().getStatus(i);Fr.getInstance().setStatus(I,C.clone()),T.replace(i,i),r.addCommand(new Ti(T)),s=p,i=i.next}else s=a.end,i=i.next}return r}split2(e){let r=new Br,i=e.getFirstNode();for(;i!=null;){let n=i.item;if(!this.needCheck(n.globalIndex)){i=i.next;continue}let s=n.primitive,a=s.bbox().extendOfSize(n.width/2),l=Nt.searchPartition(a),c=this.blockShape.blockTrack4Shapes(n,s,!0,l);if(c.length>0){let h=n.primitive,u=c[0].point,d=new ri,p;if(h instanceof M)p=d.createTrack(n.layerId,h.start(),u,n.width,n.showNet,r,n.getGroupID());else{let b=q.build4(h.start(),u,h.center,h.rx,h.rx,h.sweep());p=d.createArcTrackByArc(n.layerId,b,n.width,n.showNet,r,n.getGroupID())}let m=d.createList(),g=d.addList(p,m,r),y=Fr.getInstance().getStatus(i);Fr.getInstance().setStatus(g,y.clone()),m.replace(i,e.getLastNode()),r.addCommand(new Ti(m));break}else i=i.next}return r}needCheck(e){let r=ji.getInstance().getMap;return r.size?!Array.from(r.keys()).includes(e):!0}getBlockInfo(e,r,i){let n=[];for(let s of r.profiles)if(s.type=="Partition"&&s.component.isPartitionSplitOut()){let c=s.getMathGraphics().primitives;for(let h of c){let u=Tt(h,e);if(u>0){let d=ig(u,[]);xr(d,(y,b)=>y.distance2(e.start())-b.distance2(e.start()));let m=new ir(h,new M(i,i)).getLine(),g;m.start().equals1(i)?g=m.end():m.end().equals1(i)&&(g=m.start()),n.push({inter:d[0],foot:g,pl:h,globalIndex:s.globalIndex})}}}return n.length&&xr(n,(s,a)=>s.inter.distance2(e.start())-a.inter.distance2(e.start())),n}getBlockInfo1(e,r,i){let n=[];for(let s in r){let a=s,c=r[s].primitives;for(let h of c){let u=Tt(h,e);if(u>0){let d=ig(u,[]);xr(d,(y,b)=>y.distance2(e.start())-b.distance2(e.start()));let m=new ir(h,new M(i,i)).getLine(),g;m.start().equals1(i)?g=m.end():m.end().equals1(i)&&(g=m.start()),n.push({inter:d[0],foot:g,pl:h,globalIndex:a})}}}return n.length&&xr(n,(s,a)=>s.inter.distance2(e.start())-a.inter.distance2(e.start())),n}partitionExtend(e,r,i){let n={},s;for(let a of e.profiles)if(a.globalIndex==i){let c=a.getMathGraphics().primitives,h=fe.build2(c);a.globalIndex==x.getInstance().partitionId?s=Af(h,r):s=Af(h,-r),n[a.globalIndex]=s[0]}return n}drawTrack(e,r){let i=new ri,n=i.createList(),s=e[0],a=e[0],l=e.length;for(let c=1;c<l;c++){a=e[c];let h;if(r.type=="line")h=i.createTrack(r.layerId,s,a,r.width,r.showNet,r.command);else{let u=q.build4(s,a,r.center,r.rx,r.rx,r.sweep);h=i.createArcTrackByArc(r.layerId,u,r.width,r.showNet,r.command)}i.addList(h,n,r.command),s=a}return n}};var Vhe=class extends bC{constructor(e,r,i){var a;super(e);this.tool=new no;this.change=!1;this.nodes=r,this.blockShape=i;let n=((a=r[0])==null?void 0:a.item.net)||"",s=te.getInstance().getNet(n);this.isDiff=s!=null&&s.netDifferential!=null}optimize1(){if(this.nodes.length==0)return this.nodes;let e=this.nodes;for(;this.endtime>performance.now()&&(this.change=!1,e=this.merge(e),e=this.optimizeCorner(e),!!this.change););return e}replaceNodes(e,r,i,n){return n.length()>1e-8&&(i.direction==0?i.pt=new M(n.start(),n.end()):i.pt=new M(n.end(),n.start()),e.insertBefore(r,i)),i}cloneOrderNode(e){let r=new Op(e.item,e.pt);return r.direction=e.direction,r.newDirection=e.newDirection,r.status=e.status.clone(),r}isCollide(e,r){if(r.length()<1e-8)return!1;let i=e instanceof Op?e.item:e.item.item;return this.blockShape.checkDRC4Primitive(i,r)}optimizeCorner(e){if(e.length==0)return e;this.addDebug(e,ee.BLUE);let r=new On;for(let a of e)r.add(a);let n=r.listIterator().next();e:for(;n!=null;){let a=n.item.getPathPrimitive(),l=Ot(a),c=a.start(),h=a.end(),u=new Array,d=n.next;for(;d!=null;){if(u.push(d),u.length>1){let p=d.item.getPathPrimitive(),m=Ot(p);h=p.end();let g=this.tool.degree45(l,c,h),y=ia(l,g),b=d.item.item.width,P=u[u.length-2].item.item.width;if(jSe(l,y[0])&&jSe(m,y[1])&&b===P){let T=new M(g[0],g[1]),I=new M(g[1],g[2]),C=new M(g[1],p.start());if(!this.isCollide(n,T)&&!this.isCollide(d,C)){let E=d,O=l.cross(m);if(ne.eq(O,0)&&Yg(h.sub(c.normalize()),m)){let _=new M(c,h),R;_.direct.dot(m)>.99?R=this.cloneOrderNode(E.item):R=this.cloneOrderNode(n.item),this.replaceNodes(r,n,R,_)}else{let _=this.cloneOrderNode(n.item);T.direct.dot(l)<.99&&(_.status.isSource=!1);let R=this.cloneOrderNode(E.item);I.direct.dot(m)<.99&&(R.status.isSource=!1),this.addDebug([n.item,...u.map(v=>v.item)],ee.BLUE),this.replaceNodes(r,n,_,T),this.replaceNodes(r,n,R,I),this.addDebug([_,R],ee.GREEN)}this.change=!0,r.remove(n);for(let _ of u)r.remove(_);n=d==null?void 0:d.prev;continue e}}}else{let p=n.item.item.width,m=d.item.item.width;if(p!==m){n=n.next;continue e}if(n.item.status.isSource&&!d.item.status.isSource&&d.next!=null){let g=d.next.item.getPathPrimitive(),y=d.item.getPathPrimitive(),b=Ot(g);if((!d.next.item.status.isSource||Fd(y)<.5)&&Yg(l,b)){let P=Ot(y);h=y.end();let T=this.tool.degree45(P,c,h),I=new M(T[0],T[1]),C=new M(T[1],T[2]);if(!this.isCollide(n,I)&&!this.isCollide(d,C)){let E=d,O=l.cross(P);if(ne.eq(O,0)&&Yg(h.sub(c.normalize()),P)){let _=new M(c,h),R;_.direct.dot(P)>.99?R=this.cloneOrderNode(E.item):R=this.cloneOrderNode(n.item),this.replaceNodes(r,n,R,_)}else{let _=this.cloneOrderNode(n.item);I.direct.dot(l)<.99&&(_.status.isSource=!1);let R=this.cloneOrderNode(E.item);C.direct.dot(P)<.99&&(R.status.isSource=!1),this.addDebug([n.item,...u.map(v=>v.item)],ee.BLUE),this.replaceNodes(r,n,_,I),this.replaceNodes(r,n,R,C),this.addDebug([_,R],ee.GREEN)}this.change=!0,r.remove(n);for(let _ of u)r.remove(_);n=d==null?void 0:d.prev;continue e}}}}if(this.isDiff&&u.length>=2)break;d=d.next}n=n.next}let s=r.toArray();return this.addDebug(s,ee.GREEN),s}};var Ghe=class{constructor(t,e,r){this.utils=new Ep;this.blockShape=new As;this.command=new Br;this.interrupt=!1;this.level="WEAK";this.originListMap=new Map;this.adsorption=e,this.lists=t,this.command=new Br("shove"),this.timeout=r,this.endTime=performance.now()+this.timeout}initShoveEnvironment(){Ju.getInstance().clear(),hi.getInstance().update(),t9.getInstance().clear()}shoveMain(){let t=new Map;this.initShoveEnvironment();let e=0,r=Array.from(this.lists);for(let s of r)s instanceof Kn&&t.set(s,s.getAllItems());let i=this.getAwaitShoveTracks(this.lists);Nt.useShoveTree=!1,jg("freeArc");do{this.setFilter4Solid(r);let s=this.initAroundPath(r);if(Re.addAllSet(s.awaitShove,i),i.clear(),this.blockLists(r,s),Nt.pushFilter.setNet(null,null),hi.getInstance().update(),e++,this.filterAwaitShoveItem(s.awaitShove),s.awaitShove.size==0||e>=8)break;Re.addAllSet(i,s.awaitShove),r=r.reverse()}while(this.endTime>performance.now()&&!this.interrupt);for(let s of this.lists)s instanceof Kn&&s.size()>0&&(this.sycnVia(s,this.command),this.resetViaChangePosition(s));Xg();let n=r.filter(s=>s instanceof Kn);this.getCollideList(t,n)}getCollideList(t,e){for(let r of e){let i=t.get(r),n=i.length,s=this.getChangeTracks(r);if(s.length==0)this.originListMap.set(r,i);else{let a=s[s.length-1],l=i.findIndex(c=>c.start.equals2(a.end,1e-5));i.splice(0,l),n!==i.length&&this.originListMap.set(r,i)}}}blockLists(t,e){let r=Array.from(t);for(;r.length>0&&!this.interrupt&&this.endTime>performance.now();){e.awaitingVias.clear();let i=r.shift();if(Nt.pushFilter.addAroundList(i),i instanceof Kn){if(this.adsorption){jg("free");let n=this.adsorp(i,e,this.command);Xg(),n&&this.optimize(this.getChangeTracks(i),this.command),this.collideNext(i,e),Nt.pushFilter.setNet(null,null)}this.block(i,e,this.command),this.collideNext(i,e)}else if(e.awaitShove.has(i)){let n=!1;for(let[s,a]of i.connectTrack)this.getViaCollideTracks(s,a,e,this.command).length>0&&(n=!0);if(!n){let s=i.item,a=new Br,l=new p_(i,a,e,this.endTime,e.completes);l.offset(),Nt.pushFilter.addAroundTracks(i),l.success?(this.command.addCommand(a),hi.getInstance().deleteShoveTree(s),hi.getInstance().addShoveTree(i.item),l.checkShove(i.item),this.updateNextOrder(i,r,e)):(a.undo(),a=new Br,e.awaitShove.add(i))}}Nt.pushFilter.setNet(null,null)}}isObstacle(t,e){return!(t instanceof yt&&e.canShove(t)&&!t.locked&&!Ps(t)&&t.getParent()==null&&e.awaitShove.has(t))}updateNextOrder(t,e,r){try{if(e.length>0){let i=0;for(;i<e.length&&t!=null;){let n=e[i];if(n instanceof Kn){let s=new s9(n.toArray());t instanceof bs?s.getViaShoveTracks(t.item,r.awaitShove):t.length>0&&s.getShoveTracks(t,r);break}i++}}}catch(i){this.interrupt=!0,console.log(i)}}collideNext(t,e){if(this.lists.length==1)return;let r=this.getChangeTracks(t);for(let i of r){let n=this.blockShape.blockOtherTrackOnlyTrack(i);for(let s of n){let a=s.source;a instanceof yt&&e.canShove(a)&&e.awaitShove.add(a)}}}optimize(t,e){if(t.length==0||this.level=="WEAK")return;let r=new Set,i=new Array;for(let p of t){let m=new Op(p,p.primitive),g=xt.getInstance().getNode(p);m.status=Fr.getInstance().getStatus(g).clone(),i.push(m),r.add(m)}let s=new Vhe(performance.now()+this.timeout,i,this.blockShape).optimize1();for(let p of s)r.has(p)?p.source=!0:p.source=!1;let a=new Array,l=new ri,c=xt.getInstance(),h=null,u=null,d=null;for(let p of s)if(p.source){a.push(p.item);let m=c.getNode(p.item);h!=null&&(m!=null&&m.prev!=null&&(d=m.prev),h.replace(u,d),e.addCommand(new Ti(h))),u=m.next,h=null,d=null}else{let m=p.item,g=p.getPathPrimitive();u==null&&(u=c.getNode(m)),d=c.getNode(m);let y;g instanceof M?y=l.createTrack(m.layerId,g.start(),g.end(),m.width,m.showNet,e,m.getGroupID()):y=l.createArcTrackByArc(m.layerId,g,m.width,m.showNet,e,m.getGroupID()),h==null&&(h=c.createList());let b=l.addList(y,h,e);Fr.getInstance().setStatus(b,p.status.clone()),a.push(y)}if(h!=null){let p=c.getNode(t[t.length-1]);p!=null&&(d=p),h.replace(u,d),e.addCommand(new Ti(h))}return h=null,u=null,d=null,a}getViaCollideTracks(t,e,r,i){let n=new Array;if(e){let a=t.getFirstNode();for(;a!=null;){if(r.awaitShove.has(a.item))n.push(a);else{let l=a.item;if(this.blockShape.blockTrackOnlyTrack(l,l.primitive,!0).length>0)n.push(a);else break}a=a.next}}else{let a=t.getLastNode();for(;a!=null;){if(r.awaitShove.has(a.item))n.unshift(a);else{let l=a.item;if(this.blockShape.blockTrackOnlyTrack(l,l.primitive,!0).length>0)n.unshift(a);else break}a=a.prev}}let s=new Array;if(n.length>0){for(let l of n)Fr.getInstance().getStatus(l).change(),s.push(l.item);let a=new n9(s,e?t.viaNode.prev.item:t.viaNode.next.item,i,!e,this.endTime,!0,r);a.offset(),a.getResult()}return s}adsorp(t,e,r){if(t.size()==0)return!1;let i=this.getChangeTracks(t);if(Yr.debug){let s=new Array;for(let l of i){let c=new eo(l.primitive,{color:ee.BLUE,net:l.net});s.push(c)}let a=new Kd(s);Yr.inputDebugGraphics(a),Yr.inputClear()}this.deleteAwaitShove(i,e),Nt.pushFilter.setNet(t.getFirst().net,new Set(i));let n=new Set(i);for(let s of i){let a=this.blockShape.blockTrackOtherObstruct(s,n);for(let l of a){let c=l.obstacle,h=l.block.obstalce.outline.pointInHull(l.point,"free");if(!h&&c instanceof yt){let d=xt.getInstance().getListNode(c).parent,p=d.toArray().map(b=>b.primitive),m=i[i.length-1],g=this.getEndCollide(i,l.point,d),y=m.end;g!=null&&(m=g.source,y=g.point),this.adsorpPath(s,m,p,l.point,y,r)}else if(!h&&c instanceof lr)if(c.type=="Line"||c.type=="Board Outline"||c.type=="Partition"){let u=c.getMathGraphics(),d=i[i.length-1],p=this.getEndCollide(i,l.point,t),m=d.end;p!=null&&(d=p.source,m=p.point),this.adsorpPath(s,d,u.primitives,l.point,m,r)}else{let u=i[i.length-1];this.block4Obstacle(s,u,l.point,r)}else{let u=i[i.length-1];this.block4Obstacle(s,u,l.point,r)}return!0}}return!1}getEndCollide(t,e,r){for(let i=t.length-1;i>=0;i--){let n=t[i],s=this.blockShape.blockTrackPrimitive(n,n.primitive.reverse(),!0,!1);for(let a of s){let l=a.obstacle;if(l instanceof yt){let c=xt.getInstance().getListNode(l);if(r==c.parent){let h=new pb(r.toArray().map(p=>p.primitive),e),u=h.calculateDirect(e),d=h.calculateDirect(a.point);return u==d?c.next==null&&ne.eq(a.point.distance1(l.end),(n.width+l.width)/2+a.clearance)||c.prev==null&&ne.eq(a.point.distance1(l.start),(n.width+l.width)/2+a.clearance)?null:a:null}else return null}else if(l instanceof lr)if(r==l){let c=new pb(l.getMathGraphics().primitives,e),h=c.calculateDirect(e),u=c.calculateDirect(a.point);return h==u?a:null}else return null;else continue}}return null}block(t,e,r){if(t.size()==0)return;let i=this.getChangeTracks(t);this.deleteAwaitShove(i,e),Nt.pushFilter.setNet(t.getFirst().net,new Set(i));let n=new Set(i);for(let s of i){let a=this.blockShape.blockTrackOtherObstruct(s,n);for(let l of a)if(this.isObstacle(l.obstacle,e)){let c=i[i.length-1];this.block4Obstacle(s,c,l.point,r);return}}}sycnVia(t,e){if(t.viaNode.next!=null&&!t.viaNode.next.isSource){let r=t.getLast().end;t.viaNode.next.item.center.equals1(r)||iV(t.viaNode.next.item,r,e,[])}}resetViaChangePosition(t){t.viaNode.next!=null&&!t.viaNode.next.isSource&&(Es.getInstance().remove(t.viaNode.next.item),Es.getInstance().changeViaPosition(t.viaNode.next.item,t.viaNode.next.item.center))}deleteAwaitShove(t,e){for(let r of t)e.awaitShove.delete(r)}filterAwaitShoveItem(t){let e=Array.from(t);for(let r of e)if(r instanceof yt){let i=xt.getInstance().getNode(r);i!=null&&i.ignore&&t.delete(r)}}initAroundPath(t){let e=new S3;for(let r of t)r instanceof bs?e.canShoveVia.add(r):e.canShovePath.add(r);return e}getAwaitShoveTracks(t){let e=new Set;for(let r of t)if(r instanceof Kn){let i=this.getChangeTracks(r);Re.addAllSet(e,i)}else e.add(r);return e}isChangeViaNode(t){return!t.isSource}setFilter4Solid(t){Nt.setPushFilter(),Nt.pushFilter.setAroundMode();for(let e of t)Nt.pushFilter.addWaitList(e)}adsorpPath(t,e,r,i,n,s){let a=new bc(i,n,r,null,t.primitive,e.primitive);function l(g,y,b){if(g!=null&&b.length>0){let P=b[0],T=Tt(g,P);if(T>0){let I=new Array;for(let C=0;C<T;C+=2)I.push(new S(Ee[C],Ee[C+1]));dn(I,g),i=I[0]}else if(P instanceof M){let I=new _e().ext1(g.bbox()).ext1(P.bbox()).build(),C=I.width()+I.height(),E=new M(P.start().sub(P.direct.mul(C)),P.end()),O=Tt(g,E);if(O>0){let _=new Array;for(let R=0;R<O;R+=2)_.push(new S(Ee[R],Ee[R+1]));dn(_,g),i=_[0]}}}if(y!=null&&b.length>0){let P=b[b.length-1],T=Tt(y,P);if(T>0){let I=new Array;for(let C=0;C<T;C+=2)I.push(new S(Ee[C],Ee[C+1]));dn(I,y),n=I[I.length-1]}else if(P instanceof M){let I=new _e().ext1(y.bbox()).ext1(P.bbox()).build(),C=I.width()+I.height(),E=new M(P.start(),P.end().add(P.direct.mul(C))),O=Tt(y,E);if(O>0){let _=new Array;for(let R=0;R<O;R+=2)_.push(new S(Ee[R],Ee[R+1]));dn(_,y),n=_[_.length-1]}}}}l(t.primitive,e.primitive,a.result);let c=gd(t.primitive,i)[0],h=null;for(let g of a.result)if(Fd(g)>1e-8){h=this.getSweep(t.primitive,i,g);break}let u=a.result.length>0?hg(a.result[a.result.length-1],e.end,null,null):null;if(a.result.length>0&&!a.result[0].start().equals1(i)&&(a.result.length=0),a.result.unshift(c),Yr.debug){let g=new Array;for(let b of a.result){let P=new eo(b,{color:ee.GREEN,net:t.net});g.push(P)}let y=new Kd(g);Yr.inputDebugGraphics(y),Yr.inputClear()}if(a.result.length>0&&!a.result[a.result.length-1].end().equals1(n)&&h==u){let g=a.result.pop(),b=gd(g,n).shift();a.result.push(b)}if(a.result[a.result.length-1].end().equals1(n)&&!a.result[a.result.length-1].end().equals1(e.end)){let y=gd(e.primitive,n).pop();a.result.push(y)}let d=this.getList(t,a.result,s,h);if(d.size()==0)return;let p=xt.getInstance().getListNode(t),m=xt.getInstance().getListNode(e);d.replace(p,m),s.addCommand(new Ti(d))}getSweep(t,e,r){let i=Ot(t,e),n=Ot(r,e),s=i.cross(n);return ne.greater(s,0)?le.CCW:ne.less(s,0)?le.CW:null}block4Obstacle(t,e,r,i){let n=gd(t.primitive,r)[0],s=this.getList(t,[n],i),a=xt.getInstance().getListNode(t),l=xt.getInstance().getListNode(e);if(s.size()==0){let c=foe(a,l),h=a.parent;for(let u of c)i.addCommand(new aV(u,!1)),i.addCommand(new lV(h,u.prev,u)),J6(u,!1),h.remove(u)}else s.replace(a,l),i.addCommand(new Ti(s))}getList(t,e,r,i=null){let n=xt.getInstance().getListNode(t),s=Fr.getInstance().getStatus(n),a=new ri,l=a.createList();for(let c of e){if(Fd(c)<1e-8)continue;let h=a.createTrack4Pt(c,t,r),u=a.addList(h,l,r),d=s.clone();i!=null&&d.setPushDirect(null,i),d.change(),c.start().equals1(t.start)&&Yg(Ot(t.primitive,t.start),Ot(c,c.start()))&&(d.isSource=s.isSource),Fr.getInstance().setStatus(u,d)}return l}getChangeTracks(t){let e=t.getFirstNode(),r=t.getLastNode();for(;e!=null&&!(this.isChangeNode(e)||(e=e.next,e==r)););for(;r!=null&&!(this.isChangeNode(r)||(r=r.prev,e==r)););let i=e,n=[];for(;i!=null&&(n.push(i.item),i!=r);)i=i.next;return n}isChangeNode(t){let e=Fr.getInstance().getStatus(t);return!e.checkDRC&&(e.isInput||!e.notChange)}};var Uhe=class extends mC{constructor(e=300){super();this.hasToggleStyle=!1;this.level="NONE";this.isWire=!1;this.adsorp=!0;this.originListMap=new Map;this.timeout=e}run(e){Ju.getInstance().clear(),hi.getInstance().update();let r=new Ghe(this.getLists(e),this.adsorp,this.timeout);r.level=this.level,r.shoveMain(),r.command.length>0&&e.command.addCommand(r.command),this.sycnLists(e),this.originListMap=this.getBlockListMap(r.originListMap,e)}getLists(e){let r=[];for(let[i,n]of e.wireMap)i.drawing==0&&n.size()>0&&r.push(n);return r}sycnLists(e){let r=[];for(let[i,n]of e.wireMap)if(i.end.model!=null&&i.drawing==0){let s=!1;n.size()>0&&n.getLast().end.equals1(i.end.point)&&(s=!0),s||(i.end.model=null,n.otherNode.next=null,n.viaNode.next!=null&&n.viaNode.next.isSource&&(n.viaNode.next=null))}return r}getBlockListMap(e,r){if(e&&e.size){this.pointInObstacle=!0,lu.getInstance().pointInObstacle=!0;let i=new Map;for(let[n,s]of r.wireMap){let a=e.get(s);i.set(n,a)}return i}}};var d$=class{constructor(){this.preview=new Map;this.command=new Br;this.config=Ss.getInstance()}delPreviewList(t,e,r){this.config.wireConfirmType=="previous"&&e.result.wireMap.forEach((i,n)=>{let s=e.result.wireVia.get(n),a={pathList:i,isVia:!1,pathLen:i.size()};if(this.preview.set(n,a),s&&n.via.viaPosition=="currentInflectionPoint"&&(a.isVia=!0),s&&n.via.viaPosition=="currentInflectionPoint"&&t.size()>1){let l=new ri().createList(),c=t.getLastNode();a.previewModel=[c.item.clone()],l.replace(c,c),s.item.center=t.getLast().end,r.addCommand(new Ti(l))}})}showPreviewList(t,e){this.preview.forEach((r,i)=>{let{pathList:n,isVia:s,previewModel:a,pathLen:l}=r;if(s){if(!a||!a[0])return;let c=n.viaNode.next,h=a[0].start,u=a[0].end;if(c.item.center.equals(h)){let d=a[0];r.previewModel=[this.createPreviewList(d)]}else{let d=this.getWireEvent(),p=e.redraw(d,u);r.previewModel=null,p.size()>0&&(r.previewModel=p.getAllItems(),r.previewModel.forEach(m=>{_r.getInstance().current.setTrackWhite(m.globalIndex)})),this.command.addCommand(d.result.command)}}else if(n.size()-l>1){if(go.fixEndPosition(i.end.point).select)return;let h=n.getLastNode(),u=new ri().createList(),d=h.item.clone();u.replace(h,h),i.end.model=n.getLast(),t.addCommand(new Ti(u)),r.previewModel=[this.createPreviewList(d)]}})}createPreviewList(t){let e=this.command,r=new ri,i=r.createList(),n;return t instanceof qr?n=r.createTrack(t.layerId,t.start,t.end,t.width,t.showNet,this.command):t instanceof Oi&&(n=r.createArcTrack(t.layerId,t.center,t.radius,t.startAngle,t.endAngle,t.sweep,t.width,t.showNet,this.command)),n.layerId=be.getActiveLayerID(),r.addList(n,i,e),_r.getInstance().current.setTrackVisible(n.globalIndex),_r.getInstance().current.setTrackWhite(n.globalIndex),n}getWireEvent(){let t=Un.getInstance().getNext();return Un.getInstance().current=Un.getInstance().events.pop(),t}undo(){this.command.undo(),this.command=new Br}addCommand(t){t.addCommand(this.command),this.command=new Br}};var Hhe=class extends mD{constructor(t){super(),this.layerId=t}doAction(t){return t instanceof Le?t.layerId==12||t.layerId==this.layerId:t instanceof Ue?t.layerId==this.layerId:t instanceof Ge?t.isContains(this.layerId):t.layerId==this.layerId}};var kG=class{};var Whe=class extends kG{isNeedItem(t){if(!(t instanceof Ye))return!0;let e=!1;return(t.type==="Line"||t.type==="Fill Region"&&!((t==null?void 0:t.getComponent())instanceof ln))&&(e=!0),e}doAction(t){return t instanceof Ge?!0:!!(this.isNeedItem(t)&&!(t instanceof Me))}};function BG(o,t,e){let r=t,i=e.end().sub(e.start()),n=e.end().sub(o),s=r.cross(i);if(ne.eq(s,0))return ne.eq(n.cross(r),0)&&ne.greater(n.dot(r),0)?o.distance1(e.start())<o.distance2(e.end())?e.start():e.end():null;{let a=n.cross(i)/s,l=n.cross(r)/-s;return ne.greatereq(a,0)&&ne.greatereq(l,0)&&ne.lesseq(l,1)?o.add(t.mul(a)):null}}var Bje=1e-5,zhe=class{constructor(t,e){this.remove=t,this.wire=e}removeLoop(t){if(this.event=t,!this.remove)return;this.autoBackRemove();let{pathLists:e,pathReverse:r}=this.getAllPath(),i=[];e.forEach((n,s)=>{if(n.length>0){let a=this.event.tracks[s];this.calcLoopPaths(n,r[s],a)&&i.push(a)}}),i.length>0&&this.optiomRemoveloopAngle()}getPathNode(t){return xt.getInstance().getNode(t)}autoBackRemove(){if(this.wire==="Differential pair wiring"){let t=new _e,e=new _e;if(this.event.tracks.forEach(r=>{let i=r.end.model;((i==null?void 0:i.modelType)==="Pad"||(i==null?void 0:i.modelType)==="Via")&&t.ext1(i.buildBBox()),e.ext2(r.start.point)}),t.valid()&&e.valid()){let r=t.build(),i=e.build();r.isIntersect(i)&&this.event.tracks.forEach(n=>{let s=n.end.model,a=n.start.model;if(a instanceof qr&&((s==null?void 0:s.modelType)==="Pad"||(s==null?void 0:s.modelType)==="Via")){let l=this.event.result.wireMap.get(n);this.calcAutoBackPath(l,a,n)}})}}}calcAutoBackPath(t,e,r){let i=r.end.point,s=r.start.point.sub(i),a=e.direct,l=t.getAllItems(),c=s.dot(a),h=a.normalize(),u=l.indexOf(e);if(c>0){let d=new S(h.y,-h.x);s.dot(d)<0&&(d=new S(-h.y,h.x));for(let p=u;p>=0;p--){let m=l[p];if(m instanceof qr){let g=BG(i,d,m.primitive);if(g){this.optiomBackTrack([m.start,g,i],r,m,this.getPathNode(m),t.getLastNode());return}}}}else if(u>=0)for(let d=l.length-1;d>u;d--){let p=l[d];if(this.isBackTrack(e,p,i)){let g=new no().degree45(e.direct,e.start,i);this.optiomBackTrack(g,r,p,this.getPathNode(e),t.getLastNode());return}}}optiomBackTrack(t,e,r,i,n){let s=this.event.result.command,a=this.createListForPoint(t,r);a.replace(i,n,n.parent),s.addCommand(new Ti(a)),this.optiomPath(e)}isBackTrack(t,e,r){let i=t.end.sub(t.start),n=e.start.sub(t.start),s=e.end.sub(t.start);return!!(this.checkHotizontal(i,n)||this.checkHotizontal(i,s)||this.checkVectical(t,e.start,r,i)||this.checkVectical(t,e.end,r,i))}checkHotizontal(t,e){let r=t.dot(e),i=t.length();return!!ne.less(r/i,i)}checkVectical(t,e,r,i){let n=r.sub(t.start),s=e.sub(t.start),a=i.cross(n),l=i.cross(s);return a*l<0}createListForPoint(t,e){let r=new ri,i=this.event.result.command,n=r.createList();for(let s=0;s<t.length-1;s++){let a=t[s],l=t[s+1];if(ne.lesseq(a.distance1(l),0))continue;let c=r.createTrack(e.layerId,a,l,e.width,e.showNet,i);r.addList(c,n,i)}return this.event.result.setInputStatus(n),n}calcLoopPaths(t,e,r){let i=t.pop();if(i==null)return!1;e.pop();let n=i.getAllItems();if(n.length==1&&n[0].start.equals1(n[0].end)||n.length<=0)return!1;let s=this.calcInterMessage(t,i,e);if(this.needRemove(s)){this.replaceLoopVia(s,i,t,e);let a=this.replaceLoopPath(s,t,r,e);return a&&!a.equals1(new S(0,0))&&(r.end.direct=a),!0}}needRemove(t){if(!(t!=null&&t.point))return!1;let{p1:e,p2:r,point:i,reverse:n}=t,s=!0,a=e.parent.getAllItems(),c=r.parent.getAllItems().indexOf(r.item),h=a.indexOf(e.item),u=Ot(e.item.primitive),d=Ot(r.item.primitive),p=e.parent===r.parent,m=e.item.start.equals(i),g=e.item.end.equals(i),y=r.item.start.equals(i);return n?m&&y&&c==0&&h==0&&!this.inEsp(u,d)&&(s=!1):g&&y&&!this.inEsp(d.mul(-1),u)&&(c==0&&h==a.length-1||p&&c===h+1)&&(s=!1),s}replaceLoopPath(t,e,r,i){let{index:n,p1:s,p2:a,point:l,reverse:c,tracks:h}=t;if(h)return this.changePath(h,s,a,a.parent,e,n,c,i);if(s.item instanceof qr&&a.item instanceof qr){let u=this.replaceSameDirectPath(t,e,r);if(u)return u}return this.replace(s,a,l,r,e,n,c)}sameDirectPreTrack(t,e){let r=new ri,i=this.event.result.command,n=t.start,s=e.end,a=s.sub(n).normalize(),c=t.direct.dot(a)>=0?t.width:e.width;return r.createTrack(e.layerId,n,s,c,e.showNet,i,e.getGroupID())}replaceSameDirectPath(t,e,r){let{index:i,p1:n,p2:s,point:a,reverse:l}=t,c=this.event.result.command,h=n.parent===s.parent,u=new ri,d=this.removePathDirect(n,s),p=u.createList(),m=s.item,g=n.item;if(d){let y=this.sameDirectPreTrack(g,m);if(u.addList(y,p,c),this.event.result.setInputStatus(p),h)return p.replace(n,s),c.addCommand(new Ti(p)),n.item===r.end.model&&(r.end.model=this.event.result.wireMap.get(r).getLast()),y.direct;{let b=u.createList();this.event.result.setInputStatus(b),l?b.replace(n.parent.getFirstNode(),n):b.replace(n,n.parent.getLastNode()),c.addCommand(new Ti(b,l)),this.deleteMiddlePathList(e,i);let P=l?u.createTrack(m.layerId,g.end,m.end,m.width,m.showNet,c,m.getGroupID()):u.createTrack(m.layerId,g.start,m.end,m.width,m.showNet,c,m.getGroupID());return u.addList(P,p,c),this.event.result.setInputStatus(p),p.replace(s.parent.getFirstNode(),s),c.addCommand(new Ti(p)),n.item===r.end.model&&(r.end.model=this.event.result.wireMap.get(r).getLast()),P.direct}}}replaceLoopVia(t,e,r,i){let{index:n,p1:s,p2:a}=t,l=this.event.result.command;s.parent!==a.parent&&this.removeVia(n,r,e,i,l)}removeVia(t,e,r,i,n){let s=new Array,a;for(let h=t;h<e.length;h++){let u=e[h],d=i[h],p=u.viaNode,m;h===t&&(a=d?p.prev:p.next),m=d?p.prev:p.next,m&&s.push(m.item)}let l=r.viaNode.prev,c=s.map(h=>h.globalIndex);l&&(c.indexOf(l.item.globalIndex)<0&&(a&&a.item.globalIndex===l.item.globalIndex||s.push(l.item)),r.viaNode.prev=null),s.forEach(h=>{let u=_i.getInstance(),d=u.getNode(h),p=new db(h,"delete");n.addCommand(new rV(h,d,"delete")),n.addCommand(p),p.remove(),u.delete(h),u.nodeMap.delete(h)})}calcInterMessage(t,e,r){let i=e.getAllItems();for(let n=0;n<t.length;n++){let s=t[n],a=r[n],l=s.getAllItems();a&&this.reversePaths(l);let c=this.checkIntersection(l,i,n,r);if(c)return c}return this.calcCurrent(e,r)}initPaths(){if(ny.canRemoveLoop===null){let t=ny.firstEvent||this.event,e=t.tracks,r=0;e.forEach((i,n)=>{let s=i.start.model;if((s instanceof It||s instanceof Je)&&this.wire==="Single wiring"){ny.canRemoveLoop=0;return}let a=t.result.wireMap.get(i);if(a&&a.size()>0){r++;let l=a.otherNode;if(l.prev&&l.prev instanceof Kn){let c;l.prev.size()>0&&(c=l.prev.getLast().end);let h=a.getFirst().start;if(c&&c.equals1(h))return;ny.canRemoveLoop=0;return}}}),ny.canRemoveLoop===null&&r>0&&(ny.canRemoveLoop=1)}}initPathList(t,e,r){let i=this.event.tracks.length;t.forEach(n=>{for(let s=0;s<i;s++){let a=n.tracks[s],l=n.result.wireMap.get(a),c=e[s].indexOf(l);l&&l.size()>0&&c<0&&(e[s].push(l),r[s].push(!1))}});for(let n=0;n<i;n++){let s=this.event.tracks[n],a=this.event.result.wireMap.get(s),l=e[n].indexOf(a);a&&a.size()>0&&l<0&&(e[n].push(a),r[n].push(!1))}}getLoopPath(){let t=[],e=[],r=Un.getInstance(),i=r.current,n=r.events,s=i.tracks.length;for(let a=0;a<s;a++)t[a]=[],e[a]=[];return this.initPathList(n,t,e),{pathLists:t,pathReverse:e}}allLoopPath(t,e,r,i){let n=t.otherNode.prev,s=t.viaNode.prev,a=n||s,l=!1;for(;a;){let c;if(a instanceof It&&(a=_i.getInstance().getNode(a)),a instanceof bs){let h=a.item.globalIndex,u=_i.getInstance().getItem(h);u||(new lC(a.item).generateList(),u=a.item);let p=_i.getInstance().getNode(u).connectTrack,m=Array.from(p);if(m=m.filter((y,b)=>{let P=y[0];return!(e[i].indexOf(P)>=0)}),m.length!=1)return;c=m[0][0];let g=m[0][1];l!=g&&(l=!l)}else return;if(e[i].unshift(c),r[i].unshift(l),l){let h=c.otherNode.next,u=c.viaNode.next;a=h||u}else{let h=c.otherNode.prev,u=c.viaNode.prev;a=h||u}}}getAllPath(){this.wire==="Multi-route wiring"&&(ny.canRemoveLoop=1),this.initPaths();let r=Un.getInstance().current;if(ny.canRemoveLoop===0)return this.getLoopPath();let i=[],n=[];return r.tracks.forEach((s,a)=>{let l=r.result.wireMap.get(s);if(!l)return[];i[a]=[],n[a]=[];let c=!1;i[a].unshift(l),n[a].unshift(c),this.allLoopPath(l,i,n,a)}),{pathLists:i,pathReverse:n}}vertIntersection(t,e,r,i,n){let s=e.end.add(t.mul(n/2)),a=this.interPoint(r,new M(e.end,s));return a&&!Jr.inEdge4Polyline(a,i)&&Jr.inPolyline(a,i),a}calcCurrent(t,e){let{p2:r}=this.sortCurrentPath(t),i=t.getAllItems();for(let n=r.length-1;n>=0;n--){let s=r[n],a=i.indexOf(s),l=i.slice(0,a),c=this.checkIntersection(l,[s],a,e);if(c)return c}}getRemoveMsg(t,e,r,i,n){let s={index:t,point:e,p1:r,p2:i,reverse:n};return this.needRemove(s)?s:null}removePathDirect(t,e){let r=t.item.direct,i=e.item.direct;return!!this.inEsp(i.mul(-1),r)}replace(t,e,r,i,n,s,a=!1){let l=t.parent===e.parent,c=this.createPrevList(t.item,r,a),h=this.createNextList(e.item,r);if(l?this.replaceCurrent(c,h,t,e):this.replaceLists(c,h,t,e,i,n,s,a),this.wire==="Differential pair wiring"&&_r.getInstance().current.deleteHight(t.item.globalIndex),t.item===i.end.model){let u=this.event.result.wireMap.get(i);u.size()?i.end.model=u.getLast():i.end.model=null}return Ot(e.parent.getLastNode().item.primitive)}replaceCurrent(t,e,r,i){let n=this.event.result.command;GF(t,e),this.event.result.setInputStatus(t),t.replace(r,i),this.event.result.setInputStatus(t),n.addCommand(new Ti(t))}replaceLists(t,e,r,i,n,s,a,l){let c=r.parent,h=i.parent,u=this.event.result.command;this.event.result.setInputStatus(t),l?(this.reverseLists(r,t),t.replace(c.getFirstNode(),h.getLastNode())):t.replace(r,r.parent.getLastNode()),u.addCommand(new Ti(t,l)),this.event.result.setInputStatus(e),e.replace(h.getFirstNode(),i),u.addCommand(new Ti(e,!0)),this.event.result.mergeLists(c,h),this.event.result.wireMap.set(n,c),this.deleteMiddlePathList(s,a)}reverseLists(t,e){let r=new ri,i=this.event.result.command,n=t.next;for(;n;){let s=n.item;if(s instanceof qr){let a=r.createTrack(s.layerId,s.end,s.start,s.width,s.showNet,i,s.getGroupID());r.addFirst(a,e,i)}else if(s instanceof Oi){let a=s.primitive.reverse(),l=r.createArcTrackByArc(s.layerId,a,s.width,s.showNet,i,s.getGroupID());r.addFirst(l,e,i)}n=n.next}}deleteMiddlePathList(t,e){let r=new ri,i=this.event.result.command;for(let n=e+1;n<t.length;n++){let s=t[n],a=r.createList();a.replace(s.getFirstNode(),s.getLastNode()),i.addCommand(new Ti(a))}}createPrevList(t,e,r=!1){let i=new ri,n=this.event.result.command,s=i.createList();if(t instanceof qr){let a=r?t.end:t.start;if(!a.equals1(e)){let l=i.createTrack(t.layerId,a,e,t.width,t.showNet,n,t.getGroupID());i.addList(l,s,n)}}else if(t instanceof Oi){let a=r?t.sweep==le.CCW?le.CW:le.CCW:t.sweep,l=r?t.end:t.start,c=q.build4(l,e,t.center,t.radius,t.radius,a);if(!c.end().equals1(c.start())){let h=i.createArcTrackByArc(t.layerId,c,t.width,t.showNet,n,t.getGroupID());i.addList(h,s,n)}}return s}createNextList(t,e){let r=new ri,i=this.event.result.command,n=r.createList();if(t instanceof qr){if(!t.end.equals1(e)){let s=r.createTrack(t.layerId,e,t.end,t.width,t.showNet,i,t.getGroupID());r.addList(s,n,i)}}else if(t instanceof Oi){let a=t.start.distance1(e)>t.start.distance1(t.end)?t.sweep==le.CCW?le.CW:le.CCW:t.sweep,l=q.build4(e,t.end,t.center,t.radius,t.radius,a),c=Math.abs(l.sweepAngle)%360;if(!l.end().equals1(l.start())&&!ne.eq(c,0)&&!ne.eq(c,360)){let h=r.createArcTrackByArc(t.layerId,l,t.width,t.showNet,i,t.getGroupID());r.addList(h,n,i)}}return n}changePath(t,e,r,i,n,s,a=!1,l){if(t.length<=0)return;let c=new ri,h=e.item.width,u=e.item.net,d=e.item.layerId,p=e.parent===r.parent,m=this.event.result.command,g=e.parent,y=c.createList();p||(this.removeVia(s,n,i,l,m),a?y.replace(g.getFirstNode(),e):y.replace(e,g.getLastNode()),m.addCommand(new Ti(y,a))),this.deleteMiddlePathList(n,s);let b=c.createList();for(let P=0;P<t.length-1;P++){let T=t[P],I=t[P+1];if(T.distance1(I)>1e-8){let C=c.createTrack(d,T,I,h,e.item.showNet,m);c.addList(C,b,m)}h=r.item.width}this.event.result.setInputStatus(b),p?b.replace(e,r):b.replace(r.parent.getFirstNode(),r),m.addCommand(new Ti(b,p))}sortCurrentPath(t){let e=Fr.getInstance(),r=t.getAllItems(),i=r.length;for(let a=0;a<r.length;a++){let l=r[a];if(e.getStatus(xt.getInstance().getNode(l)).isInput){i=a;break}}let n=r.slice(0,i),s=r.slice(i);return{p1:n,p2:s}}reversePaths(t){t=t.map(e=>this.getModel(e,!0)).reverse()}getModel(t,e=!1){if(t instanceof qr){let r=e?t.end:t.start,i=e?t.start:t.end;return new qr(t.globalIndex,t.layerId,r,i,t.width,!1,t.net)}else if(t instanceof Oi){let r=e?t.sweep==le.CW?le.CCW:le.CW:t.sweep,i=e?t.endAngle:t.startAngle,n=e?t.startAngle:t.endAngle;return new Oi(t.globalIndex,t.layerId,t.center,t.radius,t.width,i,n,r,!1,t.net,1)}}inEsp(t,e){let r=Math.abs(t.x-e.x),i=Math.abs(t.y-e.y);return r<Bje&&i<Bje}getNodes(t){let e=t.getFirstNode(),r=[];for(;e;)r.push(e),e=e.next;return r}optiomPath(t){if(tr.getInstance().type==="WIRING_CORNER_LINE45"){let e=this.event.result.wireMap.get(t);if(!e)return;let r=new ri,i=this.event.result.command,n=r.createList(),{startNode:s,endNode:a,points:l}=this.getOptiomPoint(e,t);if(s&&a){let c=s.item.width;for(let h=0;h<l.length-1;h++){let u=l[h],d=l[h+1];if(u.distance1(d)>1e-8){let p=r.createTrack(t.layerId,u,d,c,t.net,i);r.addList(p,n,i)}c=t.width}this.event.result.setInputStatus(n),n.replace(s,a),i.addCommand(new Ti(n))}}}optiomRemoveloopAngle(){this.event.tracks.forEach(t=>{this.optiomPath(t)})}reverseTracks(t,e,r){let i=Math.abs(t.length*r),n=Math.abs(e.length*r),s=n<i,a=e.primitive,l=t.primitive;if(s){let u=new M(l.end(),l.start());l=new M(a.end(),a.start()),a=u,[i,n]=[n,i]}let c=a.direct,h=l.direct;return{height:i,height2:n,line1:a,line2:l,reverse:s,dir1:c,dir2:h}}optVerticalAngle(t,e,r,i,n){let s=i.direct,a=r.direct,l=r.length,c=i.length,h=Math.min(n*(Math.sqrt(2)/2),l,c),u=i.end.add(s.mul(-h)),d=r.start.add(a.mul(h));return{startNode:t,endNode:e,points:[i.start,u,d,r.end]}}optAcuteAngleStyle1(t,e,r,i,n,s){let{height:a,height2:l,line1:c,line2:h,reverse:u,dir1:d,dir2:p}=this.reverseTracks(r,i,n);if(a-s<=1e-8&&l-s<=1e-8){let b=new no;return{startNode:t,endNode:e,points:this.reversePoints(!1,b.degree45(c.direct,c.start(),h.end()))}}let m=new M(h.end(),h.end().add(new S(-d.y,d.x))),g=Vb(c.start(),c.end(),m.start(),m.end());if(g==null)return;let y=g.add(d.mul(-a));return{startNode:t,endNode:e,points:this.reversePoints(u,[c.start(),y,h.end()])}}optAcuteAngleStyle2(t,e,r,i,n,s){let{height:a,height2:l,line1:c,line2:h,reverse:u,dir1:d,dir2:p}=this.reverseTracks(r,i,n),m=h.end(),g=new M(m,m.add(new S(-d.y,d.x))),y=Vb(c.start(),c.end(),g.start(),g.end());if(y==null)return;let b=m.sub(y).normalize(),P=y.add(d.mul(-s));if(c.start().sub(P).normalize().dot(d)>0)return{};let I=y.add(b.mul(s));return{startNode:t,endNode:e,points:this.reversePoints(u,[c.start(),P,I,m])}}optAcuteAngleStyle3(t,e,r,i,n,s,a){let l=i.direct,c=r.direct,h=r.end,u=Math.abs((s+a)/n),d=r.start.add(c.mul(u)),p=new M(d,d.add(new S(-l.y,l.x))),m=Vb(i.start,i.end,p.start(),p.end());if(m==null)return;let g=d.sub(m).normalize(),y=m.add(l.mul(-s)),b=m.add(g.mul(s));return{startNode:t,endNode:e,points:this.reversePoints(!1,[i.start,y,b,d,h])}}getOptiomPoint(t,e){let r=this.getNodes(t),i=e.width;for(let n=r.length-1;n>0;n--){let s=r[n-1],a=r[n],l=s.item,c=a.item,h=Fr.getInstance().getStatus(s),u=Fr.getInstance().getStatus(a);if(h.isInput&&u.isInput&&l instanceof qr&&c instanceof qr){let d=l.direct,p=c.direct,m=d.dot(p);if(m>1e-8)continue;if(Math.abs(m)<=1e-8){let g=c.length,y=l.length,b=Math.min(i*(Math.sqrt(2)/2),g,y),P=l.end.add(d.mul(-b)),T=c.start.add(p.mul(b));return{startNode:s,endNode:a,points:[l.start,P,T,c.end]}}if(m<0){let g=i*(Math.sqrt(2)/2),y=Math.abs(c.length*m),b=Math.abs(l.length*m);if(y<=g||b<=g){let{height:P,height2:T,line1:I,line2:C,reverse:E,dir1:O,dir2:_}=this.reverseTracks(c,l,m);if(P-g<=1e-8&&T-g<=1e-8){let w=new no;return{startNode:s,endNode:a,points:this.reversePoints(!1,w.degree45(I.direct,I.start(),C.end()))}}let R=new M(C.end(),C.end().add(new S(-O.y,O.x))),D=Vb(I.start(),I.end(),R.start(),R.end()).add(O.mul(-P));return{startNode:s,endNode:a,points:this.reversePoints(E,[I.start(),D,C.end()])}}else if(y<=g+i||b<=g+i){let{height:P,height2:T,line1:I,line2:C,reverse:E,dir1:O,dir2:_}=this.reverseTracks(c,l,m),R=C.end(),v=new M(R,R.add(new S(-O.y,O.x))),D=Vb(I.start(),I.end(),v.start(),v.end()),w=R.sub(D).normalize(),F=D.add(O.mul(-g));if(I.start().sub(F).normalize().dot(O)>0)break;let z=D.add(w.mul(g));return{startNode:s,endNode:a,points:this.reversePoints(E,[I.start(),F,z,R])}}else{let P=c.end,T=Math.abs((g+i)/m),I=c.start.add(p.mul(T)),C=new M(I,I.add(new S(-d.y,d.x))),E=Vb(l.start,l.end,C.start(),C.end()),O=I.sub(E).normalize(),_=E.add(d.mul(-g)),R=E.add(O.mul(g));return{startNode:s,endNode:a,points:this.reversePoints(!1,[l.start,_,R,I,P])}}}}}return{}}reversePoints(t,e){return t?e.reverse():e}isPolylineInter(t,e){let r=t.getMathGraphics(),i=e.getMathGraphics();if(r&&i){if(VB(r,i))return!0;let s=Ax(t.start,i)||Ax(t.end,i),a=Ax(e.start,r)||Ax(e.end,r);return s||a}return!1}checkIntersection(t,e,r,i){let n=i[r];for(let s=e.length-1;s>=0;s--)for(let a=0;a<t.length;a++){let l=t[a],c=e[s],h=l.getMathGraphics(),u=c.getMathGraphics(),d=this.isPolylineInter(l,c);if(c.layerId!==l.layerId||!d)continue;let p=this.getPathNode(l),m=this.getPathNode(c),g;p.parent==m.parent&&(p.next==m?g=l.end:p.prev==m&&(g=l.start));let y=this.interPoint(l.primitive,c.primitive,g),b=this.getRemoveMsg(r,y,p,m,n);if(b)return b;if(!y)if(l instanceof qr&&c instanceof qr){let P=l.direct,T=c.direct;if(ne.eq(P.cross(T),0)){let I=this.horizontalInterPoints(l,c);if(I.length>0)return{index:r,point:I[0],p1:p,p2:m,reverse:n,tracks:I}}else{let I=this.getExtendsInter(l,c,r,g,n),C=this.getExtendsInter(l,c,r,g,n,!1);if(I||C)return I||C}}else{let P=Ot(c.primitive),T=c.width/Math.cos(Math.PI/4),I=c.end.add(P.mul(T)),C=c.end,E=this.interPoint(l.primitive,new M(C,I),g);if(E&&!Jr.inEdge4Polyline(E,u)&&Jr.inPolyline(E,u)){let O=this.getRemoveMsg(r,E,p,m,n);if(O)return O}else{let O=new S(P.y,-P.x),_=new S(-P.y,P.x),R=this.vertIntersection(O,c,l.primitive,u,T),v=this.vertIntersection(_,c,l.primitive,u,T),D=this.getRemoveMsg(r,R,p,m,n),w=this.getRemoveMsg(r,v,p,m,n);if(D||w)return D||w}}}return null}getExtendsInter(t,e,r,i,n=!1,s=!0){let a=t.direct,l=e.direct.mul(s?1:-1),c=this.getPathNode(t),h=this.getPathNode(e),u=s?e.start:e.end,d=s?e.end:e.start,p=Math.abs(l.dot(a)),m=p==0?t.width*2:t.width*2/p,g=d.add(l.mul(m)),y=this.interPoint(new M(t.start,t.end),new M(u,g),i);return this.getRemoveMsg(r,y,c,h,n)}interPoint(t,e,r){let i=Tt(t,e),n=null;for(let s=0;s<i;s+=2){let a=new S(Ee[s],Ee[s+1]);r&&a.equals1(r)||(n=a)}return n}horizontalInterPoints(t,e){let r=[],i=t.start,n=e.end,{pointPre:s,pointNext:a}=this.getHorizontalPoints(t,e);return s&&a?r=[s,a]:s?r=[i,s,n]:a&&(r=[i,a,n]),r}getHorizontalPoints(t,e){let r=t.direct,i=t.start,n=t.end,s=e.start,a=e.end,l=new S(r.y,-r.x),c=BG(a,l,new M(i,n)),h=BG(a,l.mul(-1),new M(i,n)),u=c||h,d=null;if(!u){let p=BG(i,l,new M(s,a)),m=BG(i,l.mul(-1),new M(s,a));d=p||m}return{pointPre:u,pointNext:d}}};var H_=class H_ extends ko{constructor(e,r){super();this.command=new Br;this.changeCommand=new ve("wire");this.templateNetCommand=new ve("change net");this.startConnect=new khe;this.partitionEdgeNets=new Set;this.previewTool=new d$;this.originViaSize=new Map;this.oldMode=r,this.wire=r,this.event=e,this.wiretool=new Rhe,this.config=Ss.getInstance(r),this.silkLayerTrans(),this.initNearNode(),this.wirePanelInstance=na.getInstance(),this.placeViaByDiff(),Jl.getInstance().init(),Es.getInstance().clear()}silkLayerTrans(){be.getGrayIndex()==0&&[be.getTopSilkLayer(),be.getBottomSilkLayer()].forEach(i=>{i.setTransparency(1-(1-i.transparency)*.5,!0)})}initNearNode(){this.nearNodes&&this.clearRatline(),this.nearNodes={};let r=(Un.getInstance().events[0]||Un.getInstance().current).tracks,i=new Set;if(r.forEach(n=>{let s=n.net;if(s&&n.start.model){let a=this.nearNodes[s];a||(a=this.nearNodes[s]={startModels:new Set,nearNode:new MG(s)},i.add(s));let l=n.start.model.globalIndex;l&&a.startModels.add(l)}}),this.wire=="Single wiring"){i=new Set;let n=Un.getInstance().current.node.net;n&&i.add(n)}MG.hightRatlineNets(i),i.forEach(n=>{let s=this.nearNodes[n];s?s.nearNode.setStartItems(s.startModels):(this.partitionEdgeNets.add(n),ze.highlightNet(n))})}publishViolateDRCMsg(){lu.getInstance().pointInObstacle&&A.publish("ui/toastMsg",{type:"warn",msg:"Track DRC violation detected,track could not be generated,please check the white DRC border"},$())}samePositionClickLock(){let e=()=>{let r=!1;for(let[i,n]of this.event.result.wireMap)i.drawing==0&&n.size()==0&&(r=!0);return r?(this.publishViolateDRCMsg(),!0):!1};if(this.wire=="Single wiring"){let r=this.event.node,i=Pi.getInstance(),n,s=new S(i.sceneX,i.sceneY);if(i.adsorb)s=go.fixEndPosition(s,!1).point;else return!1;let a=this.event.result.wireVia.get(r);if(a&&r.via.viaPosition==="lastInflectionPoint"?n=a.item:n=r.start.model,n instanceof Je&&ce.adsorptionConfig.isNeedPadObj()||n instanceof It&&ce.adsorptionConfig.isNeedViaObj()){if(n.inOutline(s))return n}else if(n instanceof yt&&!(a&&a.item.inOutline(r.end.point)))return n.end.equals1(r.end.point)}return e()}isInVia(){let e=[],r;for(let s of this.event.tracks){let a,l=this.event.result.wireVia.get(s);l&&this.event.node.via.viaPosition==="lastInflectionPoint"?a=l.item:a=s.start.model,s===this.event.node&&(r=a),e.push(a)}let i=this.event.position||this.event.node.start.point;return e.some(s=>{if((s instanceof It||s instanceof Je)&&s.inOutline(i))return s})?r:!1}clearAlignMapCache(){let e=["Differential pair wiring","Multi-route wiring"].includes(this.wire);e&&this.lastMode=="Single wiring"&&this.event.tracks.forEach(i=>{i.alignMap.size>0&&i.alignMap.clear()}),e&&this.event.tracks.forEach(i=>{i.startAlignMap.size>0&&i.startAlignMap.clear()})}onMouseLeftDown(e){let r=new S(e.sceneX,e.sceneY);if(this.reDraw(r),this.samePositionClickLock()){this.publishViolateDRCMsg();return}let i=this.viewTrackUpdate(),n=Un.getInstance();_r.getInstance().current.clearPreview(),_r.getInstance().current.unHightAll();let s=ji.getInstance().view4Status(_r.getInstance().current);this.event.result.command.addCommand(s),this.command.addCommand(this.event.result.command),this.wireModeCommand&&(this.wireModeCommand=null),Rm.getInstance().executeCommand(this.command),this.command=new Br;let a=this.event.gaps,l=["Differential pair wiring","Multi-route wiring"].includes(this.lastMode)&&this.wire=="Single wiring";n.events.length==0&&l&&n.current.tracks.forEach(u=>{u!==n.current.node&&(u.end=u.start.clone())});let c=!1;this.event.node.isReverse&&(c=!0),this.event.saveWirePanelInfo(this.wire);let h=this.event.node.layerId;if(this.event=n.getNext(),this.updateByRule(this.event,h),c&&i9e(this.event.tracks,!1),this.clearAlignMapCache(),_r.getInstance().getNext(),this.previewTool.addCommand(this.event.result.command),ji.getInstance().restoreTrackColor(i),this.handleNetCommand(),lu.getInstance().needRedraw2ShowObstaclePl){let{sceneX:u,sceneY:d}=Pi.getInstance();this.reDraw(new S(u,d))}this.initSketcherAttrPanel(this.wire)}viewTrackUpdate(){let e=_r.getInstance().current,r=[].concat(Un.getInstance().events,[Un.getInstance().current]),i=new Set,n=new Set,s=new Set;r.forEach(a=>{a.result.wireMap.forEach(l=>{l.size()>0&&l.getAllItems().forEach(c=>{n.add(c.globalIndex)})}),a.result.wireVia.forEach(l=>{l.item&&n.add(l.item.globalIndex)})});for(let[a,l]of e.trackStatus)!l||n.has(a)||i.add(a);for(let[a,l]of e.viaStatus)!l||n.has(a)||s.add(a);return{updateTracks:i,updateVias:s}}handleNetCommand(){this.templateNetCommand.commands.forEach(e=>{this.changeCommand.addCommand(e)}),this.templateNetCommand=new ve("change net")}toggleRouteMode(e){if(this.wireModeCommand!=null)this.wireModeCommand.undo(),this.wireModeCommand=null;else{this.wireModeCommand=new Bhe(this.wire,e);let r=this.wire=="Single wiring"?this.oldMode=="Single wiring"?"Differential pair wiring":this.oldMode:"Single wiring";e.modifyWireMode(r)}}onMouseMove(e){if(Yr.pause){Yr.play4Next();return}let r=new S(e.sceneX,e.sceneY);this.reDraw(r)}reDraw(e){Yr.replay?e=Yr.position||e:Yr.position=e,VGe.clear(),Nt.filter=null,Ra.getInstance().clear(),Fr.getInstance().clear(),this.clearViaCache(),lu.getInstance().pointInObstacle=!1,this.event.result.command.undo(),this.templateNetCommand.undo(),this.previewTool.undo(),this.previewTool=new d$,this.templateNetCommand=new ve("change net"),_r.getInstance().current.unHightAll(),ji.getInstance().view4Status(_r.getInstance().current);let r=this.viewTrackUpdate();switch(this.event.result.command=new Br,this.event.position=e,nX(tr.getInstance().type),this.event.resetInfo(),Yr.init(),this.event.nextEvent=null,Os.getInstance().clear(),O9.getInstance().clear(),this.restorePathListEndPoint(),this.pathComplete(),this.wire){case"Single wiring":{let a=this.event.node,l=this.event.result.wireVia.get(a);this.event.result.wireMap.delete(a);let c;a.via.viaPosition==="lastInflectionPoint"&&l!=null?c=this.event.result.creataList(a):c=this.event.result.initList(a),this.changeNet(this.event,e);let h=this.wiretool.redraw(this.event,e);this.previewTool.delPreviewList(h,this.event,this.event.result.command),this.event.node.end.point=e;let d=new T3().runSingle(this.event,h);if(d&&(d.replace(h.getFirstNode(),h.getLastNode()),this.event.result.command.addCommand(new Ti(d))),H_.firstEvent===null&&(H_.firstEvent=this.event),this.event.result.setInputStatus(h),c.size()>0){let p=this.event.node,m=c.getLast(),g=p.start.model;m!==g&&(c=new ri().createList(),this.event.result.wireMap.set(p,c))}if(this.event.result.mergeLists(c,h),l!=null)if(a.via.viaPosition==="lastInflectionPoint"){this.event.result.initViaNode(a),c.viaNode.prev=l;let p=!0;l.addConnectTrack(c,p),this.event.result.command.addCommand(new GT(l,c,p,!0))}else{c.viaNode.next=l;let p=!1;l.addConnectTrack(c,p),this.event.result.command.addCommand(new GT(l,c,p,!0))}break}case"Differential pair wiring":{let a=this.event.node.start.model;if(a!=null&&(a.modelType=="Pad"||a.modelType=="Via")&&a.inShape(e.x,e.y))return}case"Multi-route wiring":{this.fixFanoutDirect(this.event,e);let a=new Nhe(this.event,e),l=a.getEndPoint_v1();this.event.isCanEndWire=l,a.hightEnd();let c;l||this.wiretool.fixEnd(this.event,e),c=this.wiretool.getCornerEvent(this.event,l),G_.getInstance().setStatus(l,this);let h=this.wiretool.redrawMulti3(c,this.event,l),u=0;for(let[,g]of h.map){let y=this.event.tracks[u],b=this.event.result.wireVia.get(y);b!=null&&(g.viaNode.next=b),u++}let d=null,p=new T3,m=this.getList(h.map);if(this.wire==="Differential pair wiring"){let g=[];if(m.forEach((y,b)=>{y.size()>0&&g.push({path:y,index:b})}),g.length==2)d=p.run(this.event,m);else if(g.length==1){let y=p.runSingle(this.event,g[0].path),b=new Array(2);y&&(b[g[0].index]=y,b[g[0].index===0?1:0]=m[g[0].index===0?1:0],d={result:b,command:null})}}else d=p.run(this.event,m);if(d!=null){h.command.undo();let g=this.event.tracks.length;for(let y=0;y<g;y++){let b=this.event.result.initList(this.event.tracks[y]);if(this.event.result.setInputStatus(d.result[y]),b.size()>0){let P=this.event.tracks[y],T=b.getLast(),I=P.start.model;T!==I&&(b=new ri().createList(),this.event.result.wireMap.set(P,b))}this.event.result.mergeLists(b,d.result[y])}}else{let g=new y3,y=h.map,b=h.event;for(let I=0;I<b.tracks.length;I++){let C=b.tracks[I],E=y.get(C);g.optimization(E,C,h.command)}this.event.result.command.addCommand(h.command);let P=this.getList(h.map),T=this.event.tracks.length;for(let I=0;I<T;I++){let C=this.event.result.initList(this.event.tracks[I]);if(this.event.result.setInputStatus(P[I]),C.size()>0){let E=this.event.tracks[I],O=C.getLast(),_=E.start.model;O!==_&&(C=new ri().createList(),this.event.result.wireMap.set(E,C))}this.event.result.mergeLists(C,P[I])}}if(G_.getInstance().checkEndWireSpace(h.event),G_.getInstance().redraw){let g=ji.getInstance().view4Status(_r.getInstance().current);this.event.result.command.addCommand(g),this.reDraw(e);return}for(let g of this.event.tracks){let y=this.event.result.wireMap.get(g),b=this.event.result.wireVia.get(g);if(y.size()>=0&&b){y.viaNode.next=b;let P=!1;b.addConnectTrack(y,P),this.event.result.command.addCommand(new GT(b,y,P,!0))}}break}}for(let a of this.event.tracks){let l=this.event.result.wireMap.get(a);if(!l)continue;this.event.result.bind4Info(a);let c=this.event.result.wireVia.get(a);if(l.size()>=0&&c&&a.via.viaPosition!=="lastInflectionPoint"){let h=l.size()===0?a.start.point:NG.getViaPos(l);c.item.center=h}}this.constraintModifyViaSize(),new h$().optimization(this.event.result);let i=tr.getInstance().mode,n=new zhe(this.wirePanelInstance.removeLoop,this.wire);switch(n.removeLoop(this.event),i){case"WIRING_MODE_IGNORE":{let a=new Fhe;this.event.result.direct=this.event.node.direct;try{a.run(this.event.result)}catch(l){throw new Error(l)}break}case"WIRING_MODE_OBSTRUCT":{let a=new Uhe;this.sycnMode(a);try{if(a.run(this.event.result),lu.getInstance().originListMap=a.originListMap,this.event.result.wireVia.size>0){let l=new fb;this.sycnMode(l);try{l.run(this.event.result),this.event.publish||l.publish(),this.event.publish=l.pointInObstacle}catch(c){throw new Error(c)}break}n.removeLoop(this.event),this.event.publish=a.pointInObstacle}catch(l){throw new Error(l)}break}case"WIRING_MODE_SURROUND":{let a=new fb;this.sycnMode(a);try{a.run(this.event.result),n.removeLoop(this.event),this.event.publish||a.publish(),this.event.publish=a.pointInObstacle}catch(l){throw new Error(l)}break}case"WIRING_MODE_PUSHAWAY":case"WIRING_MODE_SURROUND_AND_PUSHAWAY":{let a=new dg(i=="WIRING_MODE_SURROUND_AND_PUSHAWAY");switch(this.sycnMode(a),this.wirePanelInstance.pushVia){case"OPTIMIZA_OPEN":{a.canPushViaLevel=2;break}case"OPTIMIZA_NONE":{a.canPushViaLevel=0;break}}switch(this.wirePanelInstance.pathOptimization4BePushed){case 1:{a.level="SUPER";break}case 0:{a.level="STRONG";break}case 2:{a.level="WEAK";break}}try{a.run(this.event.result),this.event.publish||a.publish(),this.event.publish=a.pointInObstacle}catch(l){throw new Error(l)}break}}G_.getInstance().optimization(),new h$().optimization(this.event.result);for(let[a,l]of this.event.result.wireMap)l.size()>0&&(l.viaNode.next!=null?(a.end.model=a.end.model==null?l.viaNode.next.item:a.end.model,a.end.point=l.viaNode.next.item.center):(a.end.model=a.end.model==null?l.getLast():a.end.model,a.end.point=l.getLast().end));this.wire!=="Single wiring"&&(O9.getInstance().refresh(this.event.node),this.updateEndDirect(this.event)),this.realRatline(),this.setPreTrackView(),this.previewTool.showPreviewList(this.event.result.command,this.wiretool),lu.getInstance().realTimeCheckRule(this.wire=="Single wiring");let s=ji.getInstance().view4Status(_r.getInstance().current);ji.getInstance().restoreTrackColor(r),this.event.result.command.addCommand(s),hi.getInstance().update(),Ap.updateNetLengthMsg(this.event,this.wire),hf.getInstance().hight()}updateEndDirect(e){let r=e.node.start.direct,i,n=!0;for(let s of e.tracks)if(s.end.model instanceof yt){let a=Ot(s.end.model.primitive);if(!a.equals1(s.end.direct))i==null?i=a:i.equals1(a)||(n=!1);else{i=s.end.direct,n=!0;break}}if(n||(i=e.node.start.direct),i)for(let s of e.tracks)s.end.direct=i}clearViaCache(){for(let[e,r]of this.event.result.wireVia)Es.getInstance().remove(r.item);Es.getInstance().fanoutCenter=null}sycnMode(e){if(lu.getInstance().recordEndPoints(this.event,this.wire=="Single wiring"),this.event.result.direct=this.event.node.direct,e.isWire=!0,e instanceof dg)switch(this.wirePanelInstance.currentPathOptimization4BePushed){case"OPTIMIZA_STRONG":{e.inputLevel="SUPER";break}case"OPTIMIZA_WEAK":{e.inputLevel="STRONG";break}case"OPTIMIZA_NONE":{e.inputLevel="WEAK";break}default:{e.inputLevel="NONE";break}}else switch(this.wirePanelInstance.currentPathOptimization4BePushed){case"OPTIMIZA_STRONG":{e.level="SUPER";break}case"OPTIMIZA_WEAK":{e.level="STRONG";break}case"OPTIMIZA_NONE":{e.level="WEAK";break}default:{e.level="NONE";break}}}restorePathListEndPoint(){let e=this.event.result.wireMap;for(let[r,i]of e){let n=i.otherNode.next,s=r.end.point;n instanceof Je&&n.inShape(s.x,s.y)||(i.otherNode.next=null)}}handlePartitionBlock(e,r){let i,n=r.getAllItems(),s=ji.getInstance().getMap;if(s.size){let d=Array.from(s.keys());n=n.filter(p=>!d.includes(p.globalIndex))}if(!n.length)return i;let a,l=new _e;for(let d of n)l.ext1(d.bbox);l.valid()&&(a=l.build());let c=Nt.search1(a),h=[],u=this.event.node.start.point;for(let d of n){let p=d.primitive;for(let m of c.profiles)if(m.type=="Partition"&&m.component.isPartitionSplitOut()){let b=m.getMathGraphics().primitives;for(let P of b){let T=Tt(P,p);if(T>0){let I=Zu.foot(new M(P.start(),P.end()),e),C=ig(T,[]);xr(C,(E,O)=>E.distance2(u)-O.distance2(u)),h.push({inter:C,foot:I})}}}}if(h.length){if(xr(h,(m,g)=>m.inter[0].distance2(u)-g.inter[0].distance2(u)),u.equals1(h[0].inter[0])){if(Bt.checkIsInCanEdit(n.map(m=>m.primitive),void 0,"track"))return i;if(Bt.isChildPcb()){let m=h[h.length-1].foot;if(Bt.checkIsCanEditByPoint(m))return m}else{let m=h[0].foot;if(Bt.checkIsCanEditByPoint(m))return m}}let d=h[0].inter[0],p=h[h.length-1].inter[h[h.length-1].inter.length-1];i=Bt.isChildPcb()?p:d}return i}setPreTrackView(){let e=this.event;if(e!=null){let r=e.result.wireMap,i=e.result.wireVia;e.tracks.forEach(n=>{let s=r.get(n),a=i.get(n);s&&s.getAllItems().forEach(c=>{_r.getInstance().current.setTrackPreview(c.globalIndex)}),a&&_r.getInstance().current.setViaPreview(a.item.globalIndex)})}}viaRunModeWhenRestoreInit(e){if(e.size>0){let r=[];for(let[,i]of e)i.isSource=!1,r.push(i);switch(tr.getInstance().mode){case"WIRING_MODE_PUSHAWAY":let i=new dg(!1);switch(this.sycnMode(i),this.wirePanelInstance.pushVia){case"OPTIMIZA_OPEN":{i.canPushViaLevel=2;break}case"OPTIMIZA_NONE":{i.canPushViaLevel=0;break}}switch(this.wirePanelInstance.pathOptimization4BePushed){case 1:{i.level="SUPER";break}case 0:{i.level="STRONG";break}case 2:{i.level="WEAK";break}}try{i.run1(r,this.event.result.command,this.event.node.direct),this.event.publish||i.publish(),this.event.publish=i.pointInObstacle}catch(n){throw new Error(n)}break}}}restoreCurrentInitState(e){if(Ra.getInstance().clear(),Fr.getInstance().clear(),this.clearViaCache(),lu.getInstance().pointInObstacle=!1,this.event.result.command.undo(),this.templateNetCommand.undo(),this.previewTool.undo(),this.templateNetCommand=new ve("change net"),this.event.node.via.viaPosition!=="lastInflectionPoint")this.command.undo();else{let i=this.event.result.wireVia;this.event.result.command=new Br;let n=this.event.node;this.event.result.wireVia.get(n)!=null&&this.event.result.initViaNode(n),this.viaRunModeWhenRestoreInit(i);let a=ji.getInstance().view4Status(_r.getInstance().current);a.length>0&&this.event.result.command.addCommand(a),this.event.result.command.length>0&&this.command.addCommand(this.event.result.command),this.command.length>0&&Rm.getInstance().executeCommand(this.command)}this.command=new Br,this.event.result.command=new Br;let r=this.viewTrackUpdate();ji.getInstance().view4Status(_r.getInstance().current),ji.getInstance().restoreTrackColor(r),this.event=Un.getInstance().restoreCurrentInitState(Un.getInstance().getLastEvent()),this.lastMode=e,lu.getInstance().clear()}complete(){this.previewTool.undo(),ji.getInstance().view4Status(_r.getInstance().current)}realRatline(){if(Object.keys(this.nearNodes).length==0)return;let e={},r=this.event,i=r.tracks;this.wire=="Single wiring"&&(i=[r.node]),i.forEach(n=>{if(n.drawing!=1&&n.net){e[n.net]||(e[n.net]=[]);let s=r.result.wireMap.get(n);if(s!=null&&s.size()){let a=s.getLast().end;e[n.net].push(a)}else e[n.net].push(n.start.point)}});for(let n in e){let s=this.nearNodes[n],a=e[n]||[];s.nearNode.generateRatline(a,n)}}getList(e){let r=new Array;for(let[,i]of e)r.push(i);return r}changeNet(e,r){if(e.node.allowModifyNet){let i=this.isTouch(r,e.node.layerId),n=i&&Bo(i)||"";if(e.node.net=n,n=="")return;let s=Array.from(Un.getInstance().events).reverse(),a=e.node.start.model,l=e.result.wireVia.get(e.node),c=e.result.command;if(l!=null&&l.item){let d=l==null?void 0:l.item;c.addCommand(new db(d,"modify")),d.net=n,_r.getInstance().current.setViaVisible(d.globalIndex)}let h=Zl.getInstance(),u=new Set;if(s.forEach(d=>{var p;for(let m of d.tracks)if(((p=m.end.model)==null?void 0:p.globalIndex)==(a==null?void 0:a.globalIndex)){a=m.start.model;let g=d.result.wireVia.get(m);if(g!=null&&g.item){let P=g==null?void 0:g.item;c.addCommand(new db(P,"modify")),P.net=n,_r.getInstance().current.setViaVisible(P.globalIndex)}let y=d.result.wireMap.get(m);if(u.has(y))continue;u.add(y),y.toArray().forEach(P=>{let T=h.getItem(P.globalIndex);c.addCommand(new a_(T,"modify")),T.net=n,_r.getInstance().current.setTrackUpdate(P.globalIndex)});break}}),a){let d=this.startConnect.getStartConnect(a),p;d||(d=this.startConnect.setStartConnect(a),p=d.map(m=>new er().getItem(m))),p||(p=d.map(m=>new er().getItem(m))),p.forEach(m=>{this.templateNetCommand.addCommand(Te.dispatch(m,"modify"))}),p.forEach(m=>{m.net=n})}}else{let i=this.isTouch(r,e.node.layerId);if((i instanceof Ue||i instanceof Le||i instanceof Ge)&&(i&&Bo(i)||"")==""&&e.node.net&&go.canModifyNet(i)){let a=bie(i);a.add(i),a.forEach(l=>{this.templateNetCommand.addCommand(Te.dispatch(l,"modify")),l.net=e.node.net})}}}isTouch(e,r){let i=s=>{if(!(s instanceof Ye))return!0;let a=!1;return(s instanceof nr||s instanceof Sr||s instanceof ct)&&(s.type==="Line"||s.type==="Fill Region"&&!((s==null?void 0:s.component)instanceof ln))&&(a=!0),a},n=Vt.search(new ut(e.x,e.x,e.y,e.y));return n.setFilter(new a0(e.x,e.y)).setFilter(new vd).setFilter(new Hhe(r)),n.setOnceAction(new Whe),n.once(["Via","Track","ArcTrack","Pad","Polygon","Rect","Circle"])}fixFanoutDirect(e,r){if(e.node.start.allowModifyDirect){let i=r.sub(e.node.start.point).normalize();if(e.node.start.direct.dot(i)<0){let s=e.node.start.direct.mul(-1);for(let a of e.tracks)a.start.direct=s;e.reverse()}}else for(let i of e.tracks)i.start.allowModifyDirect&&(i.start.direct=e.node.start.direct)}backspace(){var s;if(this.event.tracks.some(a=>this.event.result.wireVia.get(a))){this.placeVia();return}let r=Un.getInstance().current;this.event.result.command.undo(),this.command.undo(),this.command=new Br,this.event=Un.getInstance().undo();let i=!1;this.event||(r.gaps.forEach(a=>{a.width=a.preWidth}),this.event=Un.getInstance().current=r.clone(),i=!0),this.backspaceVia(this.event),_r.getInstance().undo(),Rm.getInstance().undo(),this.event.result.command=new Br,be.setActiveLayerId(this.event.node.layerId),i&&hf.getInstance().backspace(this.wire=="Single wiring",this.event.position)&&this.backspaceVia(this.event),this.event.wirePanelInfo&&((s=this.event.wirePanelInfo)==null||s.resetWirePanelData(),this.wire=this.event.wirePanelInfo.wireMode,this.config.wireMode=this.wire),this.initNearNode(),this.placeViaByDiff(),this.wireModeCommand&&this.toggleRouteMode(null);let n=Pi.getInstance();this.event.position=new S(n.sceneX,n.sceneY),this.event.position!=null&&this.reDraw(this.event.position)}backspaceVia(e){let r=this.command;e.tracks.forEach(i=>{if(i.via.viaPosition=="currentInflectionPoint")e.result.wireVia.delete(i);else{let s=e.result.wireVia.get(i);if(s){let a=new i9,l=a.cloneVia(s.item,r),c=a.createNode(l,r);c.isSource=s.isSource,e.result.wireVia.set(i,c)}}})}toggleFanOutMode(){}placeViaByDiff(){if(this.wire=="Differential pair wiring"){let e=this.event.node.layerId,r=!0,i=this.event.node;for(let n of this.event.tracks)if(n.layerId!=e){r=!1,i=n;break}if(!r){let n=this.command,{radius:s,inner:a}=i.via,l=new i9,c=l.addVia(i.start.point,s,a,i.net,n),h=l.createNode(c,n);h.isSource=!1,this.event.result.wireVia.set(i,h),i.via.viaPosition=this.config.viaPosition,i.end.signalLayers=new Set(go.getSignalLayerIds(c,i.end.layerId))}}}placeVia(e=!0){if(!e&&this.isInVia())return;let r=this.event.node.layerId;switch(this.wire){case"Single wiring":{let i=this.event.tracks.indexOf(this.event.node),n=this.placeViaHandle(this.event,i);n!=null&&be.setActiveLayerId(n);break}case"Multi-route wiring":case"Differential pair wiring":{let i;this.event.tracks.forEach((n,s)=>{if(n.drawing==1)return;let a=this.placeViaHandle(this.event,s);this.event.tracks[s]==this.event.node&&(i=a)}),i!=null&&be.setActiveLayerId(i);break}}if(this.updateByRule(this.event,r),this.initSketcherAttrPanel(this.wire),this.event.position!=null)this.reDraw(this.event.position);else{let i=this.event.node.start.point;this.reDraw(i)}lu.getInstance().checkViaDRC({cbCancel:()=>H_.firstEvent&&this.placeVia()})}updateByRule(e,r){let i=e.node.layerId;r!=i&&e.updateSpacing()}placeViaHandle(e,r,i,n=!1){let s=T=>{let I=te.getInstance().getRadiusPhysicsByNet(T.net);I&&(T.via.resetViaSizes={radius:I.defalutRadius,inner:I.defalutInner})},a=e.tracks[r],l=this.event.result.wireVia.get(a),c=this.command,h=a.via.viaPosition;if(l){if(this.event.result.wireVia.delete(a),this.event.result.command.undo(),this.event.result.command=new Br,c.undo(),this.command=new Br,h=="lastInflectionPoint"){let T=a.start.layerId;a.end.signalLayers=new Set([T]),a.end.layerId=T,a.layerId=T,a.start.signalLayers=new Set([T]),a.start.allowModifyDirect=!1,ce.pcbConfig.startTrackWidth=="rule"&&T3.syncEventRule(a)}else a.end.signalLayers=new Set([a.layerId]);return h=="lastInflectionPoint"?a.start.layerId:a.layerId}let u=ce.pcbConfig.startViaSize,d=new i9,{radius:p,inner:m}=a.via,g,y=!1;if(i!=null&&(this.config.placeBlind||n)){let T=this.getBlind(a,i);T&&(g=d.addBlind(a.start.point,T.name,T.startLayer,T.endLayer,p,m,a.net,c),u==="rule"&&(y=!0))}g||(g=d.addVia(a.start.point,p,m,a.net,c));let b=d.createNode(g,c);tr.getInstance().mode!=="WIRING_MODE_PUSHAWAY"&&h=="lastInflectionPoint"?b.isSource=!0:b.isSource=!1,this.event.result.wireVia.set(a,b);let P;if(i!=null)P=i;else{let T=e.node.layerId;P=this.getLayerAfterPlaceVia(T)}if(this.config.viaPosition=="lastInflectionPoint"&&(this.changeViaTrackWidth(g,P,a),ce.pcbConfig.startTrackWidth==="rule")){let I=a.width;we.prevTrackWidth=I}return a.via.viaPosition=this.config.viaPosition,this.config.viaPosition=="lastInflectionPoint"?(a.layerId=P,a.end.layerId=P,a.end.signalLayers=new Set([P]),a.start.signalLayers=new Set(go.getSignalLayerIds(g,a.end.layerId)),a.start.allowModifyDirect=!0):a.end.signalLayers=new Set(go.getSignalLayerIds(g,a.end.layerId)),u==="rule"&&(this.changeViaSize(a),y&&s(a)),P}changeViaSize(e){let r=this.event.result.wireVia.get(e),i=r.item,n=this.getViaSize(i,e.layerId);if(n!=null){r.item.viaBaseInfo=Ea.getViaBaseInfo(r.item.startLayer,r.item.endLayer,n.radius,n.innerRadius),e.via.radius=r.item.radius,e.via.inner=r.item.holeRadius,e.via.restrainViaSize=!0;return}if(i.name!==""){let a=te.getInstance().getDefaultBlindPhysics().getBlindVia(i.name);if(a.viaSizeRule!==""){e.via.restrainViaSize=!1;let l=te.getInstance().getRadiusPhysicsByName(a.viaSizeRule);r.item.viaBaseInfo=Ea.getViaBaseInfo(r.item.startLayer,r.item.endLayer,l.defalutRadius,l.defalutInner),e.via.radius=r.item.radius,e.via.inner=r.item.holeRadius;return}}if(e.via.restrainViaSize){e.via.restrainViaSize=!1;let s=te.getInstance().getRadiusPhysicsByNet(e.net);r.item.viaBaseInfo=Ea.getViaBaseInfo(r.item.startLayer,r.item.endLayer,s.defalutRadius,s.defalutInner),e.via.radius=r.item.radius,e.via.inner=r.item.holeRadius}}changeViaTrackWidth(e,r,i){let n=e.center;if(ce.pcbConfig.startTrackWidth=="rule"){let s=Ds(n,r),a=i.net,l=xm(s,a,i.layerId);if(l!=null)i.width=l;else{let c=go.getWidth(null,"rule",null,!1,i.start.point,r,i.net);c!=null&&(i.width=c)}return i.width}else return i.width=we.prevTrackWidth,we.prevTrackWidth}getBlind(e,r){let i=this.getBlinds(e),n,s=60,a=$e.getInstance().getAllCopperLayerId4Order();return i!=null&&i.forEach(l=>{if(l.isContains(r)){let c=0,h=a.indexOf(l.startLayer),u=a.indexOf(l.endLayer);c=Math.abs(h-u),c<s&&(n=l,s=c)}}),n}getBlinds(e){let r=te.getInstance().getDefaultBlindPhysics();return r!=null?r.getContainsLayerVias(e.layerId):te.getInstance().getDefaultBlindPhysics().getContainsLayerVias(e.layerId)}getLayerAfterPlaceVia(e){return this.config.autoChangeLayerWhileRoutingVias?this.wirePanelInstance.AfterPlacingTheViaSwitch2Layer?this.wirePanelInstance.AfterPlacingTheViaSwitch2Layer:2==e?1:2:e}placeBlind(e){var l;let r=this.event.node,n=te.getInstance().getDefaultBlindPhysics().getBlindVia(e);if(!n)return;if(n.viaSizeRule!==""){let c=te.getInstance().getRadiusPhysicsByName(n.viaSizeRule);r.via.radius=c.defalutRadius,r.via.inner=c.defalutInner}let s=r.layerId,a=this.getLayerAfterPlaceVia(s);if(n.isContains(s)){switch(a!==s&&n.isContains(a)?a=a:n.startLayer===s?a=n.endLayer:n.endLayer===s?a=n.startLayer:n.isContains(a)||(a=n.endLayer),this.wire){case"Single wiring":{let c=this.event.tracks.indexOf(this.event.node),h=this.placeViaHandle(this.event,c,a,!0);h!=null&&(a=h);break}case"Multi-route wiring":case"Differential pair wiring":{this.event.tracks.forEach((c,h)=>{let u=this.placeViaHandle(this.event,h,a,!0);this.event.tracks[h]==this.event.node&&(a=u)});break}}if(this.config.autoChangeLayerWhileRoutingVias&&be.setActiveLayerId(a),this.initSketcherAttrPanel(this.wire),this.event.position!=null)this.reDraw(this.event.position);else{let c=this.event.node.start.point;this.reDraw(c)}for(let c of this.event.tracks){let h=(l=c.via)==null?void 0:l.resetViaSizes;if(h){let{radius:u,inner:d}=h;c.via.radius=u,c.via.inner=d}}lu.getInstance().checkViaDRC({cbCancel:()=>H_.firstEvent&&this.placeBlind(e)})}}dblClickPlaceVia(){let e=be.getActiveLayerID(),r=this.event.node.layerId,i=this.getLayerAfterPlaceVia(r);if(this.config.placeBlind&&e!==i){if(this.isInVia())return;this.toggleLayer(i)}else this.placeVia(!1)}toggleLayer(e){var h;let r=be.getLayer(e),i=this.event.node;if(!r.isSignalLayer()){be.setActiveLayerId(i.layerId);return}let n=Un.getInstance().events,s=new Map,a=this.event.node.layerId;switch(this.wire){case"Single wiring":{let u=this.event.tracks.indexOf(this.event.node);l.call(this,this.event.node,u,!0);break}case"Multi-route wiring":case"Differential pair wiring":{let u=this.event.tracks.every(d=>d.drawing==1?!0:c.call(this,d));this.event.tracks.forEach((d,p)=>{d.drawing!=1&&l.call(this,d,p,u)});break}}this.updateByRule(this.event,a);function l(u,d,p=!1){let m=u.layerId,g=this.event.result.wireVia.get(u);if(p&&u.start.signalLayers.has(e)&&!g&&(u.end.layerId=e,u.end.signalLayers=new Set([e]),u.layerId=e,this.event.updateSpacing()),e===u.layerId&&!g){let b=ce.pcbConfig.startTrackWidth;if(e!==m&&b==="rule"){let P=go.getWidth(null,b,null,!1,u.start.point,e,u.net);u.width=P,we.prevTrackWidth=P}return}this.placeViaHandle(this.event,d,e)!==e&&s.set(u,!0)}function c(u){let d=this.event.result.wireVia.get(u);return!!(u.start.signalLayers.has(e)&&!d)}if(this.event.tracks.forEach((u,d)=>{s.get(u)&&this.placeViaHandle(this.event,d,e)}),be.setActiveLayerId(e),this.initSketcherAttrPanel(this.wire),this.event.position!=null)this.reDraw(this.event.position);else{let u=this.event.node.start.point;this.reDraw(u)}for(let u of this.event.tracks){let d=(h=u.via)==null?void 0:h.resetViaSizes;if(d){let{radius:p,inner:m}=d;u.via.radius=p,u.via.inner=m}}lu.getInstance().checkViaDRC({cbCancel:()=>H_.firstEvent&&this.placeVia()})}getWireWidth(){return this.event!=null?this.event.node.width:null}getViaRadius(){if(this.event!=null){let e=this.event.node;return{radius:e.via.radius,innerRadius:e.via.inner}}return null}wireCorner(){}wireMode(){}wireWidth(e,r){let i=Un.getInstance().events.length!==0,n=te.getInstance(),s=new l3,a=0,l=0,c=d=>{let p=d.start.point,m,g,y=n.getNet(d.net),b=d.layerId,P=Ds(p,b),T=_oe(P,d.net,d.layerId),I=voe(P,d.net,d.layerId),C=xm(P,d.net,b);if(r==="WIRING_WIDTH_FOLLOWRULES"&&C!=null&&(e=C),T!=null&&I!=null)return[xe(T,2),xe(I,2)];if(y&&y.netDifferential!=null){let E=n.getDifferentialPhysicsByNet(d.net);m=E.getStrokeWidthMin(b),g=E.getStrokeWidthMax(b),r==="WIRING_WIDTH_FOLLOWRULES"&&(e=E.getStrokeWidthDefault(b))}else{let E=n.getTrackPhysicsByNet(d.net);m=E.getMinWidth(b),g=E.getMaxWidth(b),r==="WIRING_WIDTH_FOLLOWRULES"&&(e=E.getDefaultWidth(b))}return[xe(m,2),xe(g,2)]},[h,u]=c(this.event.node);if(xe(e,2)<h||xe(e,2)>u)return A.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},$()),!1;for(let d of this.event.tracks){let[p,m]=c(d);if(xe(e,2)>=p&&xe(e,2)<=m){if(i){d.width=e;continue}if(e>d.preWidth){let g=(e-d.preWidth)/2,y=d.previous;if(y&&y.previous){let P=y.preWidth-g-a,T=s.getSafeClearance2(0,0,d.net,y.previous.net,[],d.layerId);P>=T?y.width=P:y.width=T}let b=d.next;if(b&&b.next){let P=b.preWidth-g,T=s.getSafeClearance2(0,0,d.net,b.next.net,[],d.layerId);P>=T?b.width=P:b.width=T,a=g}}else if(this.wire!=="Differential pair wiring"){let y=(d.preWidth-e)/2,b=d.previous;if(b&&b.previous){let T=b.preWidth+l+y;b.width=T}let P=d.next;if(P&&P.next){let T=P.preWidth+y;P.width=T,l=y}}d.width=e}}return!0}modifySpacing(e){this.event.modifySpacing1(e)}viaSize(e,r,i){let n=i||this.event,s=te.getInstance().getRadiusPhysicsByNet(n.node.net);if(r!=null&&Uf.inValidRadius(s,r)){A.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},$());return}else if(e!=null&&Uf.inValidInnerRadius(s,e)){A.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},$());return}let a=(l,c=!1)=>{r!=null&&(l.radius=r),e!=null&&(c?l.inner=e:l.holeRadius=e)};a(n.node.via,!0);for(let[l,c]of n.result.wireVia){let h=c.item;a(h)}for(let l of n.tracks)l.via.radius=r==null?l.via.radius:r,l.via.inner=e==null?l.via.inner:e;this.initSketcherAttrPanel(this.wire),this.onMouseMove(Pi.getInstance())}modifyViaSize(e){let r=e||this.event,i=te.getInstance();if(this.constraintModifyViaSize(r))return!0;for(let[s,a]of r.result.wireVia){let l=a.item,c=i.getNet(l.net),h=i.getRadiusPhysicsByNet(c==null?void 0:c.name);h||(h=i.getDefaultRadiusPhysics()),l.viaBaseInfo=Ea.getViaBaseInfo(l.startLayer,l.endLayer,h.defalutRadius,h.defalutInner),rt.defaultVia.radius=h.defalutRadius,rt.defaultVia.innerRadius=h.defalutInner}for(let s of r.tracks)s.via.radius=rt.defaultVia.radius,s.via.inner=rt.defaultVia.innerRadius;this.onMouseMove(Pi.getInstance())}constraintModifyViaSize(e){if(ce.pcbConfig.startViaSize!=="rule")return;let r=e||this.event,i=r.result.wireVia,n=r.result.wireMap,s=r.tracks,a=i.size,l=te.getInstance();if(a<=0)return;let c=!1;return s.forEach(h=>{let u=i.get(h),d=n.get(h);if(!u||!d)return;let p=u.item;if(d.size()==0)return;let m=this.getViaSize(p,h.layerId);if(m!=null){this.originViaSize.has(p)||this.originViaSize.set(p,{radius:p.radius,holeRadius:p.holeRadius}),p.viaBaseInfo=Ea.getViaBaseInfo(p.startLayer,p.endLayer,m.radius,m.innerRadius),h.via.radius=p.radius,h.via.inner=p.holeRadius,h.via.restrainViaSize=!0,c=!0;return}if(!c){if(this.originViaSize.has(p)){let g=this.originViaSize.get(p);p.viaBaseInfo=Ea.getViaBaseInfo(p.startLayer,p.endLayer,g.radius,g.holeRadius),this.originViaSize.delete(p),h.via.restrainViaSize=!1,h.via.radius=p.radius,h.via.inner=p.holeRadius}else if(h.via.restrainViaSize){h.via.restrainViaSize=!1;let g=te.getInstance().getRadiusPhysicsByNet(p.net);p.viaBaseInfo=Ea.getViaBaseInfo(p.startLayer,p.endLayer,g.defalutRadius,g.defalutInner),h.via.radius=p.radius,h.via.inner=p.holeRadius}}}),this.modifyViaPosition(e,c),c}getViaSize(e,r){let i=e.startLayer,n=e.endLayer,s=Ds(e.center,r,!0,!0);if(i!==1||n!==2){let l=i===1,c=n===2,h=be.getSortCopperLayer().map(m=>m.layerID),u=h.indexOf(i),d=h.indexOf(n),p=h.slice(u,d+1);l||(p=p.filter(m=>m!=1)),c||(p=p.filter(m=>m!=2)),s=s.filter(m=>{let g=m.layerId;return p.indexOf(g)>=0||g==12})}return JF(s)}modifyViaPosition(e,r=!1){if(!r)return;let i=new T3,n=e||this.event,s=n.result.wireVia,a=n.result.wireMap,l=n.tracks,c=n.node.layerId;if(s.size<=1)return;let u=[],d=[];l.forEach(g=>{d.push(s.get(g)),u.push(a.get(g))});let p=i.calcViaPosition(d,u);this.changeViaPosition(p);let m=new y3;for(let g=0;g<l.length;g++){let y=l[g],b=a.get(y);m.optimization(b,y,n.result.command)}}changeViaPosition(e,r){let i=r||this.event,n=i.result.wireVia,s=i.result.wireMap,a=i.tracks,l=i.node.layerId,c=n.size,h=new T3,u=i.result.command,d=new ri,p=[];a.forEach(g=>{p.push(n.get(g))});let m=h.getViasCenter(p);a.forEach(g=>{let y=s.get(g),b=n.get(g),P=e.get(b);if(!P)return;let T=m.sub(P.rawPosi).normalize(),I=P.direct,C=T.rotate(new S(0,0),Math.PI/2),E=C.cross(I),O=C.cross(T),_=E*O;if(_/=Math.abs(_),_>0)return;let R=y.getLast(),v=y.getLastNode(),D=d.createList(),w=d.createTrack(R.layerId,R.start,R.end,R.width,R.net,u,R.getGroupID()),F=d.createTrack(R.layerId,R.end,P.posi,R.width,R.net,u,R.getGroupID());d.addList(w,D,u),d.addList(F,D,u),D.replace(v,v),u.addCommand(new Ti(D));let H=new BT(F.direct,-1);y.getLastNode().fanoutInfo=H,b.item.center=P.posi})}flipPath(){for(let e of this.event.tracks){let r=e.direct;e.direct=e.end.direct,e.end.direct=r}this.event.position!=null&&this.reDraw(this.event.position)}interrupt(){Ap.updateNetLengthMsg(this.event,this.wire),this.clearRatline(),this.clearPartitionEdgeNets(),this.resetSilkLayerTrans(),Jl.getInstance().clear(),mC.lastPublishTime=0}clearPartitionEdgeNets(){if(this.partitionEdgeNets.size)for(let e of this.partitionEdgeNets)ze.unhighlightNet(e)}clearRatline(){for(let e in this.nearNodes)this.nearNodes[e].nearNode.clear();MG.unhighlight(),this.nearNodes={}}resetSilkLayerTrans(){[be.getTopSilkLayer(),be.getBottomSilkLayer()].forEach(r=>{r.setActiveColor(null,!0)})}startPathComplete(e=!1){let r=new u_(this.event),i=Un.getInstance().getLastEvent(),n=hf.getInstance().startItems;if(this.wire=="Differential pair wiring"&&!i)try{if(!r.needComplete(this.event.node,n))return;let s=r.getDiffStartRoutes();if(!s)return null;let[a,l]=s,c=new Map;for(let h=0;h<a.length;h++){let u=a[h],d=this.event.tracks[h];d!==this.event.node&&(d.end.point=u.end(),d.start.point=u.end(),e?c.set(d,u):d.startAlignMap.set(d,u)),d.end.direct=l,d.start.direct=l}return e&&c.size>0?c:!0}catch{return null}}pathComplete(){let e=Un.getInstance().getLastEvent(),r=this.event.node;if(this.wire!=="Single wiring"&&!e){if(this.event.tracks.some(n=>n.startAlignMap.size>0))return;this.startPathComplete()&&i9e(this.event.tracks,!1);return}else if(!this.lastMode||!e)return;let i=this.lastMode=="Single wiring"&&this.wire!=="Single wiring";if(!cf.isAlign(this.event.tracks)&&i&&!this.event.isCanEndWire){if(this.event.tracks.some(n=>n.alignMap.size>0))return;try{let s=new u_(this.event).getRoutes(this),a=this.event.tracks.findIndex(c=>c==r),l=s[a];s.forEach((c,h)=>{let u=this.event.tracks[h];if(e.tracks[h]!==e.node){let d=c.primitives[c.primitives.length-1].end();u.end.point=d,u.start.point=d,u.alignMap.set(u,c)}u.end.direct=Ot(l.primitives)||r.end.direct,u.start.direct=Ot(l.primitives)||r.start.direct})}catch(n){console.log(n)}}this.lastMode=null}initSketcherAttrPanel(e,r=!1){let i=_F(e);A.publish("FlushSketcherAttrView",{type:i,isInitAllParams:!0,switchTab:r})}};H_.firstEvent=null,H_.canRemoveLoop=null;var ny=H_;var jf=class{constructor(t,e){this.all=new Set;this.all.add(t),this.track=t,this.branch=e;let r=this.getConnectTracks(t);for(this.addAll(r,this.all);r.size>0;){let i=new Set;r.forEach(n=>{let s=this.getConnectTracks(n);this.addAll(s,this.all),this.addAll(s,i)}),r=i}}addAll(t,e){t.forEach(r=>{e.add(r)})}getConnectTracks(t){let e=new Set,r=t.searchCycleNode(),i=this.getEnds(t,r);return i.length>0?r.forEach(n=>{n instanceof Ue&&!this.all.has(n)&&!this.isSelect(n,i)&&e.add(n)}):r.forEach(n=>{n instanceof Ue&&!this.all.has(n)&&e.add(n)}),e}getEnds(t,e){let r=new Array,i=0,n=0;return e.forEach(s=>{(s instanceof Le||s instanceof Ge)&&r.push(s.center),!this.branch&&s instanceof Ue&&((s.start.equals1(t.start)||s.end.equals1(t.start))&&i++,(s.start.equals1(t.end)||s.end.equals1(t.end))&&n++,i>1&&r.push(t.start),n>1&&r.push(t.end))}),r}isSelect(t,e){for(let r of e)if(t.isVisible&&t.isSelect(r.x,r.y))return!0;return!1}};var p$=class{autoAssignTrackNet(t){if(!Ss.getInstance().isAssignNetForFreeTrack)return;let e=ze.getAllNets(),r=[],i="",n=Un.getInstance().events,s=[].concat(n,Un.getInstance().current),a=this.getEvenTrackSort(s),l=s[0].tracks.length;s[0].tracks.forEach((c,h)=>{var P;if(c.net)return;let u=c.start.model,d=s[s.length-1],p=h;if(a[s.length-1]!=a[0]&&(p=l-1-h),d.tracks[p].net)return;let m=d.tracks[p].end.point,g=(P=go.getSingleItems(m.x,m.y))==null?void 0:P.model;if(u&&u instanceof Je||g&&g instanceof Je){let T=u==null?void 0:u.getParent(),I=g==null?void 0:g.getParent(),C=T&&T.designator,E=I&&I.designator,O=u?`${ur}${u.number}`:void 0,_=g?`${ur}${g.number}`:void 0;if(C&&E){let R=[C,E].sort((v,D)=>this.sortRule(v,D,!0));i="$"+R[0]+"_"+(R[0]==C?u.num:g.num)}else!C&&!E?u instanceof Je&&g instanceof Je?i="$"+[O,_].sort((v,D)=>this.sortRule(v,D,!1))[0]:u instanceof Je?i="$"+O:g instanceof Je&&(i="$"+_):(C&&(i="$"+C+"_"+u.num),E&&(i="$"+E+"_"+g.num));u&&u instanceof Je&&u.net&&(i=u.net),g&&g instanceof Je&&g.net&&(i=g.net)}else e.forEach(T=>{if(T.includes("$")){let I=Number(T.split("$")[1]);!isNaN(I)&&r.push(I)}}),r.length?(r=r.sort((T,I)=>T-I),i="$"+(r[r.length-1]+1)):i="$1";if(i=i.toUpperCase(),u&&!u.net){let T=be.getLayer(u.layerId);(T.isSignalLayer()||T.type=="MULTI")&&this.changeModelNet(u,i,t)}if(g&&!g.net){let T=be.getLayer(g.layerId);if(T.isSignalLayer()||T.type=="MULTI")if(g instanceof yt){let C=new er().getItem(g.globalIndex);new jf(C,!1).all.forEach(O=>{this.changeModelNet(O.model,i,t)})}else this.changeModelNet(g,i,t)}let y=u instanceof Je&&g instanceof Je,b=new Set;s.forEach((T,I)=>{let C=h;a[I]!=a[0]&&(C=l-1-h);let E=T.tracks[C],O=T.result.wireMap.get(E),_=T.result.wireVia.get(E);_!=null&&_.item&&(_.item.net=i),((O==null?void 0:O.getAllItems())||[]).forEach(v=>{y&&this.getPad(v,b),v.net=i})}),b.forEach(T=>{this.changeModelNet(T,i,t)})})}getPad(t,e){let r=Nt.search4RtreePad(t.bbox),i=new Hd;r.forEach(n=>{e.has(n)||i.needCheckIntersection(t,n)&&t.inShape(n.center.x,n.center.y)&&e.add(n)})}changeModelNet(t,e,r){let n=new er().getItem(t.globalIndex);r.addCommand(Te.dispatch(n,"modify")),n.net=e,A.publish("hasModifyPcbItem",n)}sortRule(t,e,r){var i=/[^a-zA-Z]/g,n=/[^0-9]/g,s=parseInt(t,10),a=parseInt(e,10);if(isNaN(s)&&isNaN(a)){var l=r?t.replace(i,""):t.replace(n,""),c=r?e.replace(i,""):e.replace(n,"");if(l===c){var h=parseInt(r?t.replace(n,""):t.replace(i,""),10),u=parseInt(r?e.replace(n,""):e.replace(i,""),10);return h===u?0:h>u?1:-1}else return l===""?1:c===""?-1:l>c?1:-1}else return isNaN(s)?1:isNaN(a)?-1:s>a?1:-1}getEvenTrackSort(t){let e=[],r=!0,i;return t.forEach(n=>{var s,a;i&&((s=n.tracks[0].start.model)==null?void 0:s.globalIndex)!=((a=i.tracks[0].end.model)==null?void 0:a.globalIndex)&&(r=!r),i=n,e.push(r)}),e}getTrackInfoPath2(t){let e={},r=Un.getInstance().events,i=[].concat(r,[Un.getInstance().current]),n=this.getEvenTrackSort(i),s=i[0].tracks.length,a=new Set;return i[0].tracks.forEach((l,c)=>{let h=[],u=[],d="";i.forEach((p,m)=>{var C,E;let g=[],y=[],b=c;n[m]!=n[0]&&(b=s-1-c);let P=p.tracks[b],T=p.result.wireMap.get(P),I=p.result.wireVia.get(P);if(!a.has(T)&&T&&T.size()>0){let O=(T==null?void 0:T.getAllItems())||[],_=P.start.point,R=O.findIndex(v=>v.start.equals(_));R!=-1&&O.splice(0,R),d=(C=O[0])==null?void 0:C.net,_=(E=O[0])==null?void 0:E.start,O.forEach(v=>{let D=v.primitive,w=D.start().distance2(_),F=D.end().distance2(_);w<F||(D=Hp(D)),_=D.end(),t[v.globalIndex]&&(y.push(D),g.push({id:t[v.globalIndex],width:v.width,isTrack:!0,layer:v.layerId}))}),a.add(T)}I&&(d==""&&(d=I.item.net),t[I.item.globalIndex]&&(P.via.viaPosition=="currentInflectionPoint"?(g.push({id:t[I.item.globalIndex],isTrack:!1}),y.push(null)):(g.unshift({id:t[I.item.globalIndex],isTrack:!1}),y.unshift(null)))),h.push(...y),u.push(...g)}),e[d]||(e[d]=[]),e[d].push({path:h,tracks:u,net:d})}),e}};var Yhe=class{constructor(t,e){this.oldSimilarStartPath=new Array;this.oldSimilarEndPath=new Array;this.newSimilarStartPath=new Array;this.newSimilarEndPath=new Array;this.old=t,this.path=e,this.similarity=this.getSimilarity(t,e)}comparison(){let t=0,e=0;for(let i=this.old.length;t<i;t++){let n=this.old[t],s=this.getLength(n),a=0,l=new Array;for(let c=this.path.length;e<c;){let h=this.path[e],u=this.getLength(h);if(this.overlap(n,h))l.push(h),a+=u,e++;else break;if(ne.eq(a,s))break}if(ne.eq(a,s))this.oldSimilarStartPath.push(n),Re.addAll(this.newSimilarStartPath,l);else break}let r=this.path.length-1;for(let i=this.old.length-1;i>t;i--){let n=this.old[i],s=this.getLength(n),a=0,l=new Array;for(;r>e;){let c=this.path[r],h=this.getLength(c);if(this.overlap(n,c))l.push(c),a+=h,r--;else break;if(ne.eq(a,s))break}if(ne.eq(a,s))this.oldSimilarEndPath.push(n),Re.addAll(this.newSimilarEndPath,l);else break}}getSimilarity(t,e){let r=this.getPathLength(t),i=0;for(let n of t){let s=this.getLength(n);for(let a of e)if(this.overlap(n,a)){let l=this.getLength(a);s<l?i+=s:i+=l}}return i/r}getPathLength(t){let e=0;for(let r of t)e+=this.getLength(r);return e}getNewModifyPath(){let t=this.newSimilarStartPath.length,e=this.path.length-this.newSimilarEndPath.length;return this.path.slice(t,e)}getLength(t){let e=0;if(t instanceof M)e=t.length();else if(t instanceof q){let r=t.rx,i=Math.abs(mh(t.sweepAngle));e=r*i}return e}overlap(t,e){let r=t.bbox().isInside(e.bbox()),i=e.bbox().isInside(t.bbox());if(r||i){if(t instanceof M&&e instanceof M){let n=t.end().sub(t.start()).normalize(),s=e.end().sub(e.start()).normalize(),a=n.cross(s),l=n.dot(s);if(ne.eq(a,0)&&ne.greater(l,0)){let c=ir.foot(t,e.start());if(ne.eq(c.distance2(e.start()),0))return!0}}else if(t instanceof q&&e instanceof q){let n=t.center,s=e.center;if(ne.eq(n.distance2(s),0)&&t.rx==e.rx&&t.sweep()==e.sweep()){let a=t.sweepAngle,l=e.sweepAngle;if(Math.abs(a)>=Math.abs(l)){let c=t.pointOn(e.startAngle),h=t.pointOn(e.endAngle());if(ne.eq(c.distance2(e.start()),0)&&ne.eq(h.distance2(e.end()),0))return!0}else{let c=e.pointOn(t.startAngle),h=e.pointOn(t.endAngle());if(ne.eq(c.distance2(t.start()),0)&&ne.eq(h.distance2(t.end()),0))return!0}}}}return!1}similar(t,e){if(t instanceof M&&e instanceof M){let r=t.end().sub(t.start()).normalize(),i=e.end().sub(e.start()).normalize(),n=r.cross(i),s=r.dot(i);if(ne.eq(n,0)&&ne.greater(s,0))return!0}else if(t instanceof q&&e instanceof q){let r=t.center,i=e.center;if(ne.eq(r.distance2(i),0)&&t.sweep()==e.sweep())return!0}return!1}equals(t,e){let r=t.start(),i=t.end(),n=e.start(),s=e.end();if(ne.eq(r.distance2(n),0)&&ne.eq(i.distance2(s),0)){if(t instanceof M&&e instanceof M)return!0;if(t instanceof q&&e instanceof q){let a=t.center,l=e.center;if(ne.eq(a.distance2(l),0)&&t.sweep()==e.sweep())return!0}return!1}else return!1}getStart(t){for(let e of t)return e.start();return null}getEnd(t){let e=t[t.length-1];return e!=null?e.end():null}};var W_=class{constructor(t,e,r){this.text=t,this.action=e,this.buttomData=r}};var FG=class o extends KR{constructor(e,r,i,n,s,a=!1,l=400){super(n||2);this.title="Warning";this.buttoms=new Array;this.callbacks=new Array;this.checked=!1;this.msg=e,this.id=s,this.buttoms=r,this.checked=a||!1,this.callbacks.push(i),this.msgBoxWidth=l||400}equal(e){return e instanceof o&&this.type==e.type&&this.msg==e.msg}open(e){let r=new Array;for(let i of this.buttoms){let n={text:i.text,actionTag:i.action};i.buttomData!=null&&(n.btnData=i.buttomData),r.push(n)}return{type:this.type,id:this.id,option:{contentText:this.msg,title:this.title,btns:r,checked:this.checked,centered:!1,msgBoxWidth:this.msgBoxWidth},extra:{}}}close(e){let r=e.action;this.callbacks.forEach(i=>{i(r,e.checked)})}};var jhe=class extends i8{constructor(e,r,i,n){super(e);this.map=new Map;this.checkModelConnect=new r9(!0);this.needUpdateConnect=!0;this.excludesItem=new Set;this.maxNum=1e3;this.modifyItem=new Set;this.connectOther=null,this.init(r,i,n)}setModify(e){this.needUpdateConnect=!0,this.modifyItem.add(e)}hasExceed(){return!!this.connectOther}setReplaceTrack(e,r){if(this.connectOther&&this.connectOther.has(e)){this.connectOther.delete(e);for(let i of r)this.connectOther.add(i)}}isPoint(e){return this.connectOther?this.connectOther.has(e):!1}clearSearchCondition(){Qx.model=null}insertPlatedPad2Rtree(e){this.rtree==null&&(this.rtree=new Sd(this.capacity)),this.rtree.insert(e)}netShapes(){let e=[];return this.net?ze.getSameNetItems(this.net,r=>r.model instanceof ki&&e.push(r.model)&&!1):ze.getAllNoneNetsItems().forEach(r=>r.model instanceof ki&&e.push(r.model)),e.filter(r=>this.validItem(r))}getNeedCalculationItem(e,r,i){let n=this,s=Mh.getNode(this.net);s.trim();let a=s.map,l=[];h(a.get(e)).forEach(u=>{l.push(u)}),h(a.get(r)).forEach(u=>{l.push(u)}),i.forEach(u=>{l.push(a.get(u))});let c=new Set(l);function h(u){let d=[u],p=new Set,m=new Set;for(p.add(u);d.length;){let g=d.pop(),y=[],b=[];for(let P of g.near)n.validItem(P.item)&&(P.item instanceof qr&&y.push(P),b.push(P));if(y=y.sort((P,T)=>{let I=P.item,C=T.item;return ne.eq(C.length,I.length)?C.width-I.width:C.length-I.length}),y.length>15)for(let P=0;P<y.length;P++){let I=y[P].item.clone(),C=I.width;for(let E=P+1;E<y.length;E++){let O=y[E].item;I.width=C+O.width/2,I.inShape(O.start.x,O.start.y)&&I.inShape(O.end.x,O.end.y)&&m.add(y[E])}}for(let P of b)!p.has(P)&&!m.has(P)&&(d.unshift(P),p.add(P));if(p.size>n.maxNum){n.connectOther||(n.connectOther=new Set);for(let P of d){let T=[],I=!1;for(let C of P.near)p.has(C)?T.push(C.item.globalIndex):I=!0;if(I)for(let C of T)n.connectOther.add(C)}break}}return Array.from(p)}if(Yr.debug){let u=[];Array.from(c).map(p=>{p.item instanceof qr&&u.push(new eo(new M(p.item.start,p.item.end),{color:ee.BLUE}))});let d=new Kd(u);Yr.inputDebugGraphics(d)}return c}init(e,r,i){let n=this.getNeedCalculationItem(e,r,i),s=Mh.getNode(this.net),a=s.map.keys(),l=new Set;for(let h of a){let u=s.map.get(h);if(n.has(u)){l.add(h);let d=new Xhe(h);this.map.set(h,d)}else this.excludesItem.add(h)}let c=s.getConditionMap();l.forEach(h=>{let u=s.map.get(h),d=this.map.get(h);u.near.forEach(m=>{let g=this.map.get(m.item);g&&d.addNear(g)});let p=c.get(h.globalIndex);if(p){let m=new Map;this.conditionMap.set(h.globalIndex,m),p.forEach((g,y)=>{m.set(y,g)})}})}validItem(e){return e instanceof Je||e instanceof It||e instanceof yt}updateConnect(e=!0){this.trim(!1,null,e)}getConnectStatus(e){return this.trim(),this.map.get(e.model)}getCluster(){this.trim();let e=Array.from(this.map.keys());e.forEach(n=>{let s=this.map.get(n);s.directConnect||this.updateLoopData(s)});let r=new er,i=new Array;for(let n of e)i.push(r.getLoopNode(n.globalIndex));return i}trim(e,r,i=!0){if(!this.needUpdateConnect)return!1;let{add:n,remove:s}=this.vary();return this.excludesItem.forEach(a=>{n.has(a)&&n.delete(a)}),this.needUpdateConnect=!1,this.modifyItem.clear(),n.size==0&&s.size==0?!1:(s.forEach(a=>{this.remove4Rtree(this.map.get(a)),this.map.get(a).near.forEach(c=>c.deleteNear(this.map.get(a)));let l=this.map.get(a);l.directConnect&&i&&(l.directConnect.forEach(c=>{let h=this.map.get(c.model);if(h){let u=h.directConnect.values();for(let d of u)if(d.globalIndex==a.globalIndex){h.directConnect.delete(d);break}h.startConnect=null,h.endConnect=null}}),l.otherConnect.forEach(c=>{let h=this.map.get(c.model);if(h){let u=h.otherConnect.values();for(let d of u)if(d.globalIndex==a.globalIndex){h.otherConnect.delete(d);break}}})),this.map.delete(a)}),n.forEach(a=>{let l=new Xhe(a);this.map.set(a,l)}),n.forEach(a=>{let c=new er().getLoopNode(a.globalIndex);Qx.model=a;let h=this.search(a.buildBBox()).filter(d=>this.condition(a,d.item)),u=this.map.get(a);u.deleteAllNear();for(let d of h)u.addNear(d),d.addNear(u);i&&(this.updateLoopData(this.map.get(a)),this.map.get(a).directConnect.forEach(d=>{var m;(m=this.map.get(d.model).directConnect)==null||m.add(c)}),this.map.get(a).otherConnect.forEach(d=>{var m;(m=this.map.get(d.model).otherConnect)==null||m.add(c)}))}),!0)}vary(e){let r=new Set,i=new Set;if(this.map.size===0){let{shapes:n,platPads:s}=this.shapes();for(let a of n)r.add(a);return{add:r,remove:i,platPads:s}}else{let n=new Set;for(let a of this.modifyItem)a.isEmpty?i.add(a):n.add(a);let s=!1;for(let a of n)s=this.map.has(a),a.layerOrBoxModified?(s&&i.add(a),r.add(a),e&&(a.layerOrBoxModified=!1)):s||r.add(a);return{add:r,remove:i,platPads:new Set}}}updateLoopData(e){let r=e.near,i=new er,n=e.item;e.directConnect=new Set,e.otherConnect=new Set,e.startConnect=null,e.endConnect=null,r.forEach(s=>{let a=s.item;if(!(a instanceof Je||a instanceof It||a instanceof yt))return;let l=i.getLoopNode(a.globalIndex);if(this.checkModelConnect.isConnect(a,n)||this.checkPadConnectHole(a,n)){e.directConnect.add(l);return}this.validSearchModelNode(n,a)&&e.otherConnect.add(l)})}isPadAndVia(e){return e instanceof Je||e instanceof It}checkPadConnectHole(e,r){if(this.isPadAndVia(e)&&this.isPadAndVia(r)){let i=e,n=r;return i.center.distance2(n.center)<1e-4}return!1}validSearchModelNode(e,r){if(e instanceof Je||e instanceof It){if(r instanceof Oi)return e.inShape(r.start.x,r.start.y)||e.inShape(r.end.x,r.end.y);if(r instanceof qr)return!0;if(e instanceof Je&&(e.layerId==1||e.layerId==2)){if(r instanceof Je&&r.layerId==12){let i=r.holeRadius;return e.center.distance1(r.center)<i}if(r instanceof It&&r.isContains(e.layerId)){let i=r.holeRadius;return e.center.distance1(r.center)<i}}else if(r instanceof Je&&(r.layerId==1||r.layerId==2)){let i=e.holeRadius;return e.center.distance1(r.center)<i}return!1}else{if(e instanceof Oi)return r instanceof Je||r instanceof It?r.inShape(e.start.x,e.start.y)||r.inShape(e.end.x,e.end.y):!0;if(e instanceof qr)return!0}return!1}isConnect(e,r){if(e instanceof It){let i=e.radius;if(new ir(r.primitive,new M(e.center,e.center)).getDistance()>=i)return!1}else if(!(e.inShape(r.start.x,r.start.y)||e.inShape(r.end.x,r.end.y))){let n=e.getMathGraphics(),s;n instanceof fe&&(s=n);let a=fe.build4([r.start,r.end]);return new Fs(s,a,0).relation==0}return!0}search(e){this.trim();let r=Vt.search4Types(e,dd,Qx.keep),i=new Array;for(let n of dd){let s=r.getResults(n);for(let a of s){let l=a.model;if(l instanceof ki){let c=this.map.get(l);c!=null&&i.push(c)}}}if(this.rtree!=null){let n=this.rtree.search(e);for(let s of n)i.push(s)}return i}end(){this.rtree=null}},Xhe=class extends K2{constructor(t){super(t)}bbox(){return this.item.bbox}};var hN=class hN{getRatlineNet(){return this.ratlineNet}static getInstance(){return hN.manager==null&&(hN.manager=new hN),hN.manager}getRTree(){return this.ratlineNet.clearSearchCondition(),this.ratlineNet}clear(){this.ratlineNet=null}hasItem(t){return this.ratlineNet?this.ratlineNet.getModel(t.globalIndex)!=null:!1}setModify(t){this.ratlineNet&&(t instanceof Ue||t instanceof Le||t instanceof Ge)&&(this.ratlineNet.net==t.net,this.ratlineNet.setModify(t.model))}set(t,e,r,i){let n=!0;if(this.ratlineNet&&this.ratlineNet.net==t&&(n=!i.every(s=>!!this.ratlineNet.getModel(s.globalIndex))),n){t==""&&Mh.updateEmptyNet();let s=new jhe(t,e,r,i);this.ratlineNet=s,s.updateConnect(!1)}return n}init(t,e,r,i){return this.set(t,r,i,e.map(s=>s.model))?this.ratlineNet.getCluster():(this.ratlineNet.trim(),[])}searchTrackConnectTrack(t){return this.searchNode(t).filter(e=>e instanceof Ue)}getDirectConnect(t){return this.getConnectStatus(t)}getConnectStatus(t){return this.ratlineNet.getConnectStatus(t)}trackConnect(t){let e=this.getDirectConnect(t);return e.startConnect==null&&(e.startConnect=!1,e.endConnect=!1,e.directConnect.forEach(r=>{if(e.startConnect&&e.endConnect&&!r)return;let i=this.generateConnect(t,r);e.startConnect=i.startConnect||e.startConnect,e.endConnect=i.endConnect||e.endConnect})),{startConnect:e.startConnect,endConnect:e.endConnect}}getTrackConnectType(t){let r=this.searchCycleNode(t),i=[],n,s,a=r.filter(p=>p instanceof Le||p instanceof Ge),l=t.start,c=t.end;a.find(p=>(l.distance2(p.center)<1e-4?n=p:c.distance2(p.center)<1e-4&&(s=p),!1));let h,u;if(n&&(h=n instanceof Ge?2:1),s&&(u=s instanceof Ge?2:1),n&&s)return{startType:h,endType:u};if(!n){let p=d(l);h=p.type,n=p.nextTrack}if(!s){let p=d(c);u=p.type,s=p.nextTrack}return{startType:h,endType:u,startNode:n,endNode:s};function d(p){let m,g,y=null;return i.every(P=>{let T=null;return p.distance2(P.start)<1e-4?(T=!0,y=!0):p.distance2(P.end)<1e-4&&(T=!1,y=!1),g&&T!=null?(m=11,!1):(T!=null&&(g=P),!0)})&&g?m=y?g instanceof Ar?5:7:g instanceof Ar?6:8:g||(m=0),{type:m,nextTrack:g}}}generateConnect(t,e){let r=!1,i=!1,n=1e-4;return t instanceof Ue&&(e instanceof Ue?t.start.distance2(e.start)<n||t.start.distance2(e.end)<n?r=!0:(t.end.distance2(e.start)<n||t.end.distance2(e.end)<n)&&(i=!0):t.start.distance2(e.center)<n?r=!0:t.end.distance2(e.center)<n&&(i=!0)),{startConnect:r,endConnect:i}}searchNode(t){let e=this.getConnectStatus(t);return this.getNode(t,e)}getNode(t,e,r=!0,i=!0){let n=[];if(r&&(n=Array.from(e.directConnect)),i&&(n=n.concat(Array.from(e.otherConnect))),t instanceof Le||t instanceof Ge){let s=new Set;return n.filter(a=>{if(a instanceof Le||a instanceof Ge){let l=this.getConnectStatus(a),c=[];r&&(c=Array.from(l.directConnect)),i&&(c=c.concat(Array.from(l.otherConnect))),c.filter(h=>{h instanceof Ue&&s.add(h)})}else s.add(a)}),Array.from(s)}return n}searchCycleNodeTrack(t){let e=this.getDirectConnect(t);return this.getNode(t,e,!0,!1).filter(r=>r instanceof Ue)}searchCycleNode(t){let e=this.getDirectConnect(t);return this.getNode(t,e,!0,!1)}searchOtherNode(t){let e=this.getConnectStatus(t);return this.getNode(t,e,!1,!0)}};hN.manager=null;var Pc=hN;function Fje(o,t){let e=[],r=[],i=cr(),n=cr(),s=Pc.getInstance().getRatlineNet();s=s.hasExceed()?s:null,o.cycles.forEach((m,g)=>{let y=Array.from(m.cycle),b=[];y.forEach((P,T)=>{P instanceof Le?b.push({item:P.globalIndex,index:T}):T==0?b.push({item:i,index:T-1}):T==y.length-1?b.push({item:n,index:T+1}):s&&s.isPoint(P.globalIndex)&&b.push({item:P.globalIndex,index:T})}),b.length==1&&b.push({item:n,index:1});for(let P=1;P<b.length;P++){let T=b[P-1],I=b[P],C=new qhe(T.item,I.item,y.slice(T.index+1,I.index));g==t?e.push(C):r.push(C)}});let a=o.getLeaves(),l=0;a.forEach(m=>{let g=Array.from(m).shift(),y=new qhe(g.globalIndex,l.toString(),m);e.push(y),l++}),r=r.sort((m,g)=>{if(m.hasVia==g.hasVia)return 0;if(m.hasVia)return-1;if(g.hasVia)return 1});let c=new Set,h=new Set;Re.addAll(e,r);let u=new Set;e.forEach(m=>{BRt(m,u)?c.add(m):h.add(m)});let d=new Set;c.forEach(m=>{m.path.forEach(g=>{d.add(g)})});let p=[];return h.forEach(m=>{p.push(m.path)}),{saves:d,deleteItems:p}}function BRt(o,t){let e=null,r=null;for(let i of t)i.has(o.cluster1)&&(e=i);for(let i of t)i.has(o.cluster2)&&(r=i);if(e==null&&r==null){let i=new Set;return i.add(o.cluster1),i.add(o.cluster2),t.add(i),!0}else{if(e!=null&&r==null)return e.add(o.cluster2),!0;if(e==null&&r!=null)return r.add(o.cluster1),!0;if(e!=r){t.delete(e),t.delete(r);let i=FRt(e,r);return t.add(i),!0}}return!1}function FRt(o,t){let e=new Set;for(let r of o)e.add(r);for(let r of t)e.add(r);return e}var qhe=class{constructor(t,e,r){this.cluster1=t,this.cluster2=e,this.path=r,this.hasVia=!!r.find(i=>i instanceof Ge),this.pathLen=0,r.forEach(i=>{i instanceof Ue&&(this.pathLen+=i.length)})}};var xP=class extends Bh{constructor(e){super();this.path=[];this.start=e}addLine(e){this.path.push(e)}displayPath(e){var r;(r=this.path[e])==null||r.display(),ie.publish("updateFrame","")}display(){var e;(e=this.start)==null||e.display();for(let r of this.path)r.display()}remove(){var e;(e=this.start)==null||e.remove();for(let r of this.path)r.remove()}};var hw=class{constructor(t,e,r,i){this.trunk=new Array;this.data=t,this.start=r,this.end=i,this.cycle=new Set(e),this.all=new Set(e)}getTrunk(t,e){Re.addAllSet(this.all,t),Re.addAllSet(this.all,e);let r=this.data,i=new Set,n=new Array;r.forEach((s,a)=>{let l=this.getIntersection(s,r[a+1]);s instanceof Le?n.length>0&&(this.trunk.push(n),n=new Array):n.push(s),l.length>0&&(n.length>0&&this.trunk.push(n),n=new Array),i=new Set(l)}),n.length>0&&this.trunk.push(n)}getIntersection(t,e){let r=new Array;if(e==null)return r;let i=Pc.getInstance(),n=new Set(i.searchNode(t)),s=new Set(i.searchNode(e));for(let a of n)!this.all.has(a)&&a!=t&&this.isNeed(a)&&s.has(a)&&r.push(a);return this.filterNodes(r)}filterNodes(t){let e=new Array,r=new Array;return t.forEach(i=>{i instanceof Le||i instanceof Ge?e.push(i):r.push(i)}),e.length==0?r:[...e]}isNeed(t){return t instanceof Ue||t instanceof Le||t instanceof Ge}cycleContainsPad(t,e,r=!1){for(let i of this.cycle)if(!t.has(i)&&!e.has(i)&&(i instanceof Le||r&&i instanceof Ge))return!0;return!1}reverse(){let t=new Array;for(let e=this.trunk.length-1;e>=0;e--)t.push(this.trunk[e]);this.trunk.length=0,t.forEach(e=>{this.trunk.push(e)})}};var VG=class{constructor(t,e,r){this.startIsLoop=null;this.endIsLoop=null;this._startIsLoop=0;this._endIsLoop=0;this.pathList=t,this.start=e,this.end=r}getFirst(){return this.pathList.getFirst()}getLast(){return this.pathList.getLast()}getLen(){let t=this.pathList.getAllItems(),e=0;return t.forEach(r=>{e+=r.length}),e}hasModel(t){return this.pathList.getAllItems().includes(t)}queryChannel(t){let e=this.getFirst().start,r=this.getLast().end,i=!0;return e.distance2(t)>r.distance2(t)&&(i=!1),i?this._startIsLoop:this._endIsLoop}queryChannelNext(t){let e=this.getFirst().start,r=this.getLast().end,i=r,n=this.startIsLoop;return e.distance2(t)>r.distance2(t)&&(n=this.endIsLoop,i=e),{nextConnectPoint:i,nextNode:n}}setNextSuccessChannel(t,e){if(t){if(this.startIsLoop)return;this.startIsLoop=e,this._startIsLoop=1}else{if(this.endIsLoop)return;this.endIsLoop=e,this._endIsLoop=1}}setNextFailChannel(t){t?this._startIsLoop=2:this._endIsLoop=2}},VRt=xt.getInstance(),dN=class o{static generateListByItem(t){if(!Pc.getInstance().hasItem(t.model))return[];if(t instanceof Ue){if($T.getInstance().getLoopPathList(t))return[];let{startNode:e,endNode:r}=o.generateList2(t),n=VRt.getNode(t.model).parent,s=new VG(n,e==null?void 0:e.model,r==null?void 0:r.model);return $T.getInstance().set(s),[s]}if(t instanceof Le||Ge){let e=t.searchNodeLoopType(),r=[];return e.forEach(i=>{i instanceof Ue&&r.push(...o.generateListByItem(i))}),r}return[]}static generateList(t,e){let r=xt.getInstance(),i=t.tracks,n=t.pts,s=r.createList(),a=i.findIndex(d=>d==e),l=a;for(let d=a;d>=0&&!r.getNode(i[d].model);d--)l=d;let c=a;for(let d=a+1;d<i.length&&!r.getNode(i[d].model);d++)c=d;for(let d=l;d<=c;d++){let p=i[d],m=n[d];p.start=m.start(),p.end=m.end(),p instanceof Si&&m instanceof q&&(p.center=m.center,p.radius=m.rx,p.startAngle=Ht.toRadians(m.startAngle),p.endAngle=Ht.toRadians(m.endAngle()),p.sweep=m.sweep());let g=p.model;r.createNode(g,s)}let h,u;return l==0&&(s.startType=t.startType,h=t.start),c==i.length-1&&(s.endType=t.endType,u=t.end),{startNode:h,endNode:u}}static generateList2(t){let e=[t],r=[t],i=[!1],n=o.getConnectItem(e,i,r,t.end),s=[t],a=[t],l=[!1],c=o.getConnectItem(s,l,a,t.start);for(a.shift(),l.shift();a.length>0;){let u=a.shift(),d=l.shift();r.unshift(u),i.unshift(!d)}let h=r.map((u,d)=>{let p=u.primitive;return i[d]&&(p=Hp(p)),p});return o.generateList({tracks:r,pts:h,startType:c.endNode?c.endNode instanceof Le?1:2:c.isMulti,endType:n.endNode?n.endNode instanceof Le?1:2:n.isMulti,start:c.endNode,end:n.endNode},t)}static getConnectItem(t,e,r,i){let s,a=null,l=Pc.getInstance(),c=new Set;for(;t.length>0;){let h=t.pop();c.add(h);let u=l.searchCycleNode(h),d=[],m=u.filter(P=>P instanceof Le||P instanceof Ge?!0:(c.has(P)||d.push(P),!1)).find(P=>i.distance2(P.center)<1e-4);if(m){s=m;break}let g,y=null;d.every(P=>{let T=null;return i.distance2(P.start)<1e-4?T=!0:i.distance2(P.end)<1e-4&&(T=!1),g&&T!=null?(a=11,!1):(T!=null&&(g=P,y=T),!0)})&&g&&(t.push(g),r.push(g),e.push(!y),i=y?g.end:g.start)}return{endNode:s,isMulti:a}}},uN=class uN{constructor(){this.map=new Map}static getInstance(){return uN.manager==null&&(uN.manager=new uN),uN.manager}set(t){let e=t.getFirst().globalIndex;this.map.set(e,t)}getLoopPathList(t){return this.getLoopPathListByModel(t.model)}getLoopPathListByModel(t){let e=xt.getInstance().getNode(t);if(e){let i=e.parent.getFirst().globalIndex;return this.getLoopPathListById(i)}return null}update(t,e){let r=this.map.get(t);this.map.delete(t),this.map.set(e,r)}getLoopPathListById(t){return this.map.get(t)}getAllLoops(){return[...this.map.values()]}clear(){this.map.clear()}};uN.manager=null;var $T=uN;var $3=$T.getInstance(),$he=class{constructor(t){this.curr=[];this.debug=new xP;this.cycles=new Array;this.leaves=new Array;this.leaveHasPad=!1;this.currIdex=0;this.saveVias=[];this.sameNetData=[];this.antenna=[];if(this.sameNetData=[...t.getPathByNet(t.getNet())],this.split=t,this.start=this.start1=t.getStart(),this.end=this.end1=t.getEnd(),this.startNodes=this.split.getLoopStartNodes(),this.endNodes=this.split.getLoopEndNodes(),this.oldStartNodes=this.split.getOldStartNodes(),this.oldEndNodes=this.split.getOldEndNodes(),this.process=new Set,this.needCycle()){let r=[...this.startNodes].map(i=>{let n=$3.getLoopPathList(i);return this.process.add(n),n});for(let i of r)i&&this.DFS(i,r,this.start);xr(this.cycles,(i,n)=>i.cycle.size-n.cycle.size,0,this.cycles.length)}}needCycle(){let t=this.split.getOldPath();if(!t||t.length==0)return!0;let e=0,r=this.start,i=new Set,n=t.filter(l=>l instanceof Ge).map(l=>l.model);if(t.find(l=>{if(l instanceof Ue){let c=$T.getInstance().getLoopPathList(l);c&&i.add(c)}}),[...this.startNodes].forEach(l=>{let c=$3.getLoopPathList(l);i.has(c)||e++}),[...this.endNodes].forEach(l=>{let c=$3.getLoopPathList(l);i.has(c)||e++}),e>=2)return!0;let s=Array.from(i);return!s.every((l,c)=>{let h=this.getNodes(l,r,i),u=s[c+1];if(u){let d=l.getFirst().start.distance2(r)<l.getLast().end.distance2(r);r=d?l.getLast().end:l.getFirst().start;let p=u.getFirst().start,m=u.getLast().end,g=p.distance2(r)<m.distance2(r)?m:p,y=this.getNodes(u,g,i),b=Array.from(h);if(Re.addAll(b,y),b.find(T=>!!(h.includes(T)&&y.includes(T))))e++;else{let T=d?l.end:l.start;T&&!n.includes(T)&&(e+=2)}}return!(e>=2)})}updateTrunk(){let t=[];Re.addAll(t,this.startNodes),Re.addAll(t,this.oldStartNodes);let e=[];Re.addAll(e,this.endNodes),Re.addAll(e,this.oldEndNodes),this.cycles.forEach(r=>{r.getTrunk(t,e)})}removeLoopAntenna(t){this.antenna.forEach(e=>{let{connectItem:r,antenna:i}=e;r.every(s=>t.includes(s))&&i.forEach(s=>{s.forEach(a=>{this.addDebug(a,3)}),this.finishDebug(),this.split.deleteTracks(s,new Set)})})}removeAllLoopAntenna(){this.antenna.forEach(t=>{let{antenna:e}=t;e.forEach(r=>{r=r.filter(i=>!i.isEmpty),r.forEach(i=>{this.addDebug(i,3)}),this.finishDebug(),this.split.deleteTracks(r,new Set)})})}DFS(t,e,r){let i=!1;if(this.curr.push(t),this.isEnd(t)){let n=t.getFirst().start,s=t.getLast().end;if(n.distance2(this.end)<s.distance2(this.end)&&([n,s]=[s,n]),r.distance2(n)>r.distance2(s))i=!1;else{i=!0;let a=[...this.curr],l=[...this.getLoopPathData(a)];if(this.cycles.push(new hw(l,l,this.start,this.end)),this.debug!=null){for(let c of l)this.addDebug(c,1);Yr.debug&&(Yr.inputDebugGraphics(this.debug),this.debug=new xP)}}}else{let n=this.getNodes(t,r,new Set([...this.curr,...e]));n.forEach(h=>{this.process.add(h)});let s=t.getFirst().start,a=t.getLast().end,l=s.distance2(r)<a.distance2(r),c=l?a:s;n.forEach(h=>{let u=h.queryChannel(c);u==0?this.DFS(h,n,c)&&(i=!0,t.setNextSuccessChannel(l,h)):u==1&&(i=!0,this.addCycleByChannel(this.curr,h,c)&&t.setNextSuccessChannel(l,h))}),i===!1&&t.setNextFailChannel(l),n.forEach(h=>{this.process.delete(h)})}return this.curr.pop(),i}addCycleByChannel(t,e,r){let i=[...t];for(;!this.isEnd(e);){i.push(e);let{nextConnectPoint:n,nextNode:s}=e.queryChannelNext(r);if(r=n,e=s,!e)return console.warn("loop find error"),!1}if(e){i.push(e);let n=[...this.getLoopPathData(i)];if(this.cycles.push(new hw(n,n,this.start,this.end)),this.debug!=null){for(let s of n)this.addDebug(s,1);Yr.debug&&(Yr.inputDebugGraphics(this.debug),this.debug=new xP)}return!0}return!1}getNodes(t,e,r){let i=this.searchCycleNode(t,e),n=new Set;return i.forEach(s=>{let a=$3.getLoopPathList(s);a&&!r.has(a)&&!this.process.has(a)&&a!=t&&n.add(a)}),[...n]}searchCycleNode(t,e){let r=t.getFirst().start,i=t.getLast().end,n=r.distance2(e)<i.distance2(e),s=n?t.end||t.getLast():t.start||t.getFirst(),l=new er().getLoopNode(s.globalIndex);if(!l)return[];let c;if(l instanceof Ue){c=Pc.getInstance().searchCycleNodeTrack(l);let h=this.split.searchNode(l),u=n?i:r,d=n?r:i,p=Pc.getInstance().trackConnect(l),m=n?p.endConnect:p.startConnect;h.forEach(g=>{if(!c.includes(g)&&g instanceof Ue){if(!this.connectPoint(g,u,d))return;if(!m){c.push(g);return}let y=Pc.getInstance().trackConnect(g);y.startConnect&&y.endConnect||c.push(g)}})}else c=this.split.searchNode(l);return c.filter(h=>h instanceof Ue)}connectPoint(t,e,r){let i=t.start,n=t.end,s=i.distance2(e),a=n.distance2(e),l=i.distance2(r),c=i.distance2(r);return Math.min(s,a)<Math.min(l,c)}finishDebug(){Yr.debug&&(Yr.inputDebugGraphics(this.debug),this.debug=new xP)}addDebug(t,e){if(this.debug!=null){let r;switch(e){case 1:r=ee.GREEN;break;case 2:r=ee.WHITE;break;case 3:r=ee.Golden;break}let i=null;t instanceof Ar?i=t.primitive:(t instanceof Le||t instanceof Ge)&&(i=new M(t.center,t.center)),i!=null&&this.debug.addLine(new eo(i,{color:r,id:t.globalIndex}))}}isEnd(t){return!![...this.endNodes].find(e=>t.hasModel(e.model))}getLoopPathData(t){let e=this.start,r=new er,i=[],n=new Set;return t.forEach(s=>{let a=s.getFirst().start,l=s.getLast().end,c=[];if(s.start){let h=r.getLoopNode(s.start.globalIndex);if(c.push(h),!n.has(s.start)){let u=this.removeRing(h,s,a,!0);u.length&&n.add(s.start);for(let d of u){let p=r.getLoopNode(d.globalIndex);c.push(p)}}}if(s.pathList.getAllItems().forEach(h=>{let u=r.getLoopNode(h.globalIndex);c.push(u)}),s.end){let h=r.getLoopNode(s.end.globalIndex);if(c.push(h),!n.has(s.end)){let u=this.removeRing(h,s,l,!1);u.length&&n.add(s.start);for(let d of u){let p=r.getLoopNode(d.globalIndex);c.push(p)}}}a.distance2(e)>l.distance2(e)?(c.reverse(),e=a):e=l,i.push(...c)}),new Set(i)}removeRing(t,e,r,i=!0){let n=this.split.searchOtherNode(t);for(let s of n)if(s instanceof Ue){let a=$3.getLoopPathList(s);if(a.start==a.end&&a.start==t.model&&e!=a){let c=a.getFirst().start,h=a.getLast().end;if(c.distance2(r)<1e-4)return i?a.pathList.getAllItems().reverse():a.pathList.getAllItems();if(h.distance2(r)<1e-4)return i?a.pathList.getAllItems():a.pathList.getAllItems().reverse()}}return[]}modifyCycle(t){if(this.cycles.length>1){let e=new Set,r=this.cycles.map((p,m)=>(p.cycleContainsPad(this.oldStartNodes,this.oldEndNodes,!0)||e.add(m),[...p.cycle])),i=t,n=i[i.length-1],s=!1;(n instanceof Le||n instanceof Ge)&&(s=!0);let a=i[0],l=!1;if((a instanceof Le||a instanceof Ge)&&(l=!0),!this.cycleContainsPad()){this.cycles.length=0,this.curr.length=0,r.push(t),r.forEach(p=>{p.length!=0&&this.cycles.push(new hw(p,p,this.start,this.end))}),this.currIdex=this.cycles.length-1;return}let c=[],h=this.end;for(;!s;){let p,m=!0;for(let g=0;g<r.length;g++){let y=r[g];if(!e.has(g)&&(p||(p=y[y.length-1]),y[y.length-1]!=p)){m=!1;break}}m?(c.push(p),p instanceof Le||p instanceof Ge?(s=!0,h=p.center):(p.start.distance2(h)<p.end.distance2(h)?h=p.end:h=p.start,r.forEach((g,y)=>{e.has(y)||g.pop()}))):s=!0}this.end1=h,e.forEach(p=>{r[p].push(...c)}),t.push(...c),n=i[i.length-1];let u=this.start,d=[];for(;!l;){let p,m=!0;for(let g=0;g<r.length;g++){let y=r[g];if(!e.has(g)&&(p||(p=y[0]),y[0]!=p)){m=!1;break}}m?(d.unshift(p),p instanceof Le||p instanceof Ge?(l=!0,u=p.center):(p.start.distance2(u)<p.end.distance2(u)?u=p.end:u=p.start,r.forEach((g,y)=>{e.has(y)||g.shift()}))):l=!0}a=d[0],a==n?(d.shift(),r.forEach((p,m)=>{e.has(m)||p.unshift(...d.reverse())})):(e.forEach(p=>{r[p].unshift(...d)}),t.unshift(...d),this.start1=u),this.cycles.length=0,this.curr.length=0,r.push(t),r.forEach(p=>{p.length!=0&&this.cycles.push(new hw(p,p,this.start,this.end))}),this.currIdex=this.cycles.length-1}else this.cycles.push(new hw(t,t,this.start,this.end)),this.currIdex=this.cycles.length-1;console.log("-------------------"),this.cycles.forEach(e=>{let r=e.data.filter(i=>i instanceof Le);console.log(r.map(i=>i.num))}),console.log(this.cycles),console.log("-------------------")}getCanDelVia(t){let e=new Set;return this.cycles.forEach((r,i)=>{if(i==this.currIdex)return;let n=r.data;n.forEach((s,a)=>{if(s instanceof Ge){let l=n[a-1],c=n[a+1];l&&c&&(!t.has(l)||!t.has(c))&&e.add(s)}})}),e}cycleContainsPad(){for(let t of this.cycles)if(t.cycleContainsPad(this.oldStartNodes,this.oldEndNodes))return!0;return this.leaveHasPad}getLoopBranch(){this.leaveHasPad=!1;let t=this.getAllCycleId(),e=this.cycles[this.currIdex];this.startNodes.forEach(i=>{t.add(i.globalIndex)}),this.endNodes.forEach(i=>{t.add(i.globalIndex)});let r=new Set;this.generateLeaves(e,t,e,r),this.cycles.forEach(i=>{i!=e&&this.generateLeaves(i,t,e,r)})}generateLeaves(t,e,r,i){let n=0,s,a=!(r.data[0]instanceof Ue),l=!(r.data[r.data.length-1]instanceof Ue),c=!0;a&&!l&&(c=!1);let h=this.start1,u=t.data;c==!1&&(h=this.end1,u=[...u].reverse()),u.forEach((d,p)=>{let m;d instanceof Ue&&(m=$3.getLoopPathList(d));let g=!1;if(m&&(s?s!=m&&(g=!0):s=m),g){let y=this.getIntersection2(s,m,h,e),b=y.loop;h=y.start;let P=!0;this.process=new Set,b.forEach(I=>{this.process.add(I)});let T=[];if(b.forEach(I=>{let C=this.deleteLoopAntenna(I,new Set,e,h,T,i);P&&(P=C)}),t==r&&this.process.forEach(I=>{I.pathList.getAllItems().forEach(C=>{e.add(C.globalIndex)})}),T.length>0&&this.antenna.push({connectItem:[y.lastNode,y.currNode],antenna:T}),!P)if(t!=r){let I=p;this.leaves.push(u.slice(n,I))}else{let I=new er;b.forEach(C=>{if(C.start instanceof It){let E=I.getLoopNode(C.start.globalIndex);E&&this.saveVias.push(E)}if(C.end instanceof It){let E=I.getLoopNode(C.end.globalIndex);E&&this.saveVias.push(E)}})}s=m}})}getInter(t,e){let r=a(t),i=a(e),n=Number.MAX_VALUE,s;for(let l of r)for(let c of i){let h=l.distance2(c);h<n&&(s=l,n=h)}return s;function a(l){return l instanceof Ue?[l.start,l.end]:[l.center]}}deleteLoopAntenna(t,e,r,i,n,s){if(this.split.searchHasPoint(t))return this.leaveHasPad=!0,!1;s.add(t);let a=!0,l=t.getFirst().start,c=t.getLast().end,h,u;l.distance2(i)<c.distance2(i)?(h=c,u=t.end):(h=l,u=t.start),u&&u.modelType=="Pad"?this.leaveHasPad=!0:e.add(t);let d=this.getNodes(t,i,new Set([...e]));d=d.filter(m=>{let g=m.getFirst();return!r.has(g.globalIndex)}),d.forEach(m=>{this.process.add(m)});let p=!1;if(d.length>0&&(d=d.filter(m=>s.has(m)?(p=!0,!1):!0)),p)return!1;if(d.length>1||u){for(let m of d){let g=this.deleteLoopAntenna(m,new Set,r,h,n,s);a=a&&g}if(d.forEach(m=>{this.process.delete(m)}),u)return!1;if(a){let g=[...this.getLoopPathData([...e])].filter(y=>y instanceof Ue);if(g.length>0&&n.push(g),e.size>0)return!0}return!1}else if(d.length==1){let m=this.deleteLoopAntenna(d[0],e,r,h,n,s);return d.forEach(g=>{this.process.delete(g)}),m}else{let g=[...this.getLoopPathData([...e])].filter(y=>y instanceof Ue);return g.length>0&&n.push(g),e.size>0}}findTrack(t,e,r,i){if(this.split.searchHasPoint(t))return[];let n=t.getFirst().start,s=t.getLast().end,a,l;if(n.distance2(i)<s.distance2(i)?(a=s,l=t.end):(a=n,l=t.start),l)return[];e.add(t);let c=this.getNodes(t,i,new Set([...e]));return c=c.filter(h=>{let u=h.getFirst();return!(r.has(u.globalIndex)||e.has(h)||this.process.has(h))}),c.forEach(h=>{this.process.add(h)}),c.length>1?[]:c.length==1?this.findTrack(c[0],e,r,a):[...this.getLoopPathData([...e])].filter(d=>d instanceof Ue)}getAllCycleId(){let t=new Set;return this.cycles.forEach(e=>{e.data.forEach(r=>{t.add(r.globalIndex)})}),this.sameNetData.forEach(e=>{t.add(e.globalIndex)}),t}getIntersection2(t,e,r,i){if(t&&e){let s=new Set,a=t.getFirst().start,l=t.getLast().end,c,h,u=new er;a.distance2(r)<l.distance2(r)?(c=l,h=u.getLoopNode((t.end||t.getLast()).globalIndex)):(c=a,h=u.getLoopNode((t.start||t.getFirst()).globalIndex));let d=e.getFirst().start,p=e.getLast().end,m,g;d.distance2(c)<p.distance2(c)?(m=p,g=u.getLoopNode((e.start||e.getFirst()).globalIndex)):(m=d,g=u.getLoopNode((e.end||e.getLast()).globalIndex));let y=new Set(this.getNodes(t,r,new Set)),b=new Set(this.getNodes(e,m,new Set));for(let P of y){let T=P.getFirst().globalIndex;!i.has(T)&&b.has(P)&&s.add(P)}return{start:c,loop:[...s],lastNode:h,currNode:g}}return{loop:[],start:r}}isNeed(t){return t instanceof Ue||t instanceof Le||t instanceof Ge}getLeaves(){return this.leaves||[]}deleteAntenna(t){if(this.cycles.length==0)return;let e=this.getAllCycleId();t=t.filter(s=>s&&!s.isEmpty);let r=this.cycles[this.cycles.length-1],i=(r==null?void 0:r.data)||[];A.publish("updateRtree",""),this.clearProcess(),[...this.endNodes].forEach(s=>{let a=$3.getLoopPathList(s);this.process.add(a)}),i[0]instanceof Le||i[0]instanceof Ge?this.deleteAntenna2(i[0],e):this.deleteAntenna2(t[0],e),this.clearProcess(),[...this.startNodes].forEach(s=>{let a=$3.getLoopPathList(s);this.process.add(a)});let n=i[i.length-1];n instanceof Le||n instanceof Ge?this.deleteAntenna2(n,e,!1):this.deleteAntenna2(t[t.length-1],e,!1)}clearProcess(){this.process=new Set}deleteAntenna2(t,e,r=!0){if(A.publish("updateRtree",""),t instanceof Le||t instanceof Ge){let i=this.getNodes2(t,e).filter(s=>s instanceof Ue),n=new Set;i.forEach(s=>{if(!s||s.isEmpty)return;let a=$3.getLoopPathList(s);a&&n.add(a)}),this.deleteAntenna3([...n],e,t.center);return}if(t instanceof Ue){let n=(r?[...this.startNodes]:[...this.endNodes]).map(s=>$3.getLoopPathList(s));n=n.filter(s=>{let a=s.getFirst().globalIndex;return!e.has(a)}),n.length>1&&this.deleteAntenna3(n,e,r?this.start:this.end)}}getCurrMap(){let t=new Set;return this.cycles[this.currIdex].data.forEach(r=>{t.add(r.globalIndex)}),t}deleteAntenna3(t,e,r){this.process=new Set,t.forEach(i=>{i&&this.process.add(i)}),t.forEach(i=>{let n=this.findTrack(i,new Set,e,r);n.length>0&&(n.forEach(s=>{this.addDebug(s,2)}),this.finishDebug(),this.split.deleteTracks(n,e))})}connectOther(t){return[1,2,11].includes(t)}getNodes2(t,e){let r=this.split.searchNode(t),i=new Array;return r.forEach(n=>{!e.has(n.globalIndex)&&n!=t&&this.isNeed(n)&&i.push(n)}),this.filterNodes2(i,t)}filterNodes2(t,e){let r=new Array,i=new Array;return t.forEach(n=>{n instanceof Le||n instanceof Ge?r.push(n):i.push(n)}),r.length==0?i:[...r]}};var Khe=class{constructor(t,e,r){this.dialogId="askRemoveLoopDialog";this.saveViaLoop=!1;this.popMsg=!0;this.debug=new xP;this.canDelVias=new Set;this.commands=t,this.splitTrack=e,this.splitTrack.initCurr(),this.path=e.getPrimitivePath();let i=e.getStart(),n=e.getEnd(),s=e.getNet(),a=e.getStartLayerId(),l=e.getEndLayerId(),c=this.getNodes(i,a,s),h=this.getNodes(n,l,s);this.splitTrack.findOldPathByCurr(c,h),this.cycle=new $he(e);let u=[...c].find(p=>p instanceof Le||p instanceof Ge),d=[...h].find(p=>p instanceof Le||p instanceof Ge);console.log(this.cycle.cycles),this.getPathNode(e,u,d),!(this.cycle.cycles.length==0&&!r)&&(this.cycle.modifyCycle(this.pathNode),this.pathNode.forEach(p=>{this.addDebug(p)}),this.finishDebug(),this.cycle.getLoopBranch(),this.cycle.updateTrunk(),this.getCanDelVias())}getCanDelVias(){let t=this.cycle.cycles[this.cycle.currIdex],e=new Set(t.data);this.canDelVias=this.cycle.getCanDelVia(e)}getSaveVia(){return this.cycle.saveVias}addDebug(t){if(this.debug!=null){let e=null;t instanceof Ar?e=t.primitive:(t instanceof Le||t instanceof Ge)&&(e=new M(t.center,t.center)),e!=null&&this.debug.addLine(new eo(e,{color:ee.BLUE,id:t.globalIndex}))}}finishDebug(){Yr.debug&&(Yr.inputDebugGraphics(this.debug),this.debug=new xP)}getPathNode(t,e,r){let i=t.getOldPath();if(i&&i.length>0){this.pathNode=[...i],e&&this.pathNode.unshift(e),r&&this.pathNode.push(r);return}let n=this.getCurrentPath(this.cycle);this.pathNode=[...n.data]}removeLoop(t=!1){let e=!0;if(this.cycle.cycles.length>1){let r=this.cycle.cycles[this.cycle.currIdex],i=this.cycle.currIdex||this.cycle.cycles.indexOf(r);if(this.popMsg&&this.needRemoveLoop()&&this.cycle.cycleContainsPad()){let s=[],a=0,l=0,c=this.getNextSelect(a,l,this.cycle,i);a=c.i,l=c.j,s=c.result,this.highLightItems(s),this.openRemoveLoopBox(a,l,this.cycle,s,i,t),e=!1}else{let s=new Set,a=Fje(this.cycle,i);if(a){let{saves:c,deleteItems:h}=a;h.forEach(u=>{let d=!0;this.saveViaLoop&&u.find(m=>m instanceof Ge)&&(d=!1),d&&u.forEach(p=>{!p.locked&&!c.has(p)&&s.add(p)})})}else this.cycle.cycles.forEach((c,h)=>{if(h!=i){let d=this.getSelect(h,0,this.cycle,i),p=!0;this.saveViaLoop&&d.find(g=>g instanceof Ge)&&(p=!1),p&&d.forEach(m=>{r.cycle.has(m)||s.add(m)})}});let l=[...s];this.deleteSelect(l)}let n=this.splitTrack.getNet();A.publish("updateNets",{updateNetLength:{[n]:ze.getNetLength(n)}},$())}return e}needRemoveLoop(){let t=0;this.cycle.cycles.forEach(n=>{t+=n.trunk.length});let e=0,r=0,i=0;for(let n=0;n<t;n++){let s=this.getNext(r,i,this.cycle);if(r=s.i,i=s.j,this.getSelect(r,i,this.cycle,this.cycle.currIdex).length>0&&e++,e>=2)break}return e>=2}hasVia(t){return!![...t].find(e=>e instanceof Ge)}getSelect(t,e,r,i){let n=this.cycle.cycles[t].trunk[e];if(t!=i){let s=r.cycles[i],a=new Array;for(let l of n)!l.locked&&!l.isEmpty&&s.data.indexOf(l)<0&&a.push(l);return this.saveViaLoop&&a.find(l=>l instanceof Ge)?[]:a}return[]}getFirstCycle(t,e){let r=this.cycle.cycles.length;return r>1&&this.cycle.cycles[t]==e?(t++,t==r?0:this.getFirstCycle(t,e)):t}reverse(t){this.cycle.cycles.forEach(e=>{t!=e&&e.reverse()})}removeLeave(){this.cycle.deleteAntenna(this.pathNode),this.cycle.removeAllLoopAntenna()}getDeleteItems(t,e){let r=new Set;return t.forEach(i=>{!i.isEmpty&&!(i instanceof Le)&&!e.cycle.has(i)&&!i.locked&&r.add(i)}),r}deleteSelect(t){let e=this.getSaveVia();t=t.filter(r=>r instanceof Ge?!e.includes(r)&&this.canDelVias.has(r):!0),t.forEach(r=>{!(r instanceof Le)&&!r.isEmpty&&r.getParent()==null&&(this.commands!=null&&(this.commands.addCommand(Te.dispatch(r,"delete")),A.publish("hasModifyPcbItem",r)),r.remove(),A.publish("delete",r))}),this.cycle.removeLoopAntenna([...t])}getNext(t,e,r){let i=r.cycles[t].trunk.length,n=r.cycles.length;return e+1<i?(e++,{i:t,j:e}):(t++,e=0,t>=n&&(t=0),{i:t,j:e})}highLightItems(t){let e=this.getSaveVia();t=t.filter(r=>!e.includes(r)),t.forEach(r=>{r.click()})}cancelItems(t){t.forEach(e=>{e.visible()})}openRemoveLoopBox(t,e,r,i,n,s=!1){let a=new W_("Confirm","confirm"),l=new W_("Next segment","next"),c=new W_("Ignore","ignore"),h=new FG("There is a loop, whether to remove the picked loop segment.",[a,l,c],(u,d)=>{if(this.popMsg=!d,u=="confirm")this.deleteSelect(i),d&&(Ss.getInstance().autoLoopUpMsgBox=this.popMsg),s&&A.publish("flushService","");else if(u=="next"){this.cancelItems(i);let{i:p,j:m,result:g}=this.getNextSelect(t,e,r,n);if(i=g,this.highLightItems(i),i.length>0){let y=_s(i);if(y.valid()){let b=y.build1(),P=ZR();if(!b.isInside(P)){let T=new _e().ext1(b).ext1(P).build1();A.publish("adaptBBox",T)}}}this.openRemoveLoopBox(p,m,r,i,n,s)}else(u=="ignore"||u=="cancel"||u=="close"||u==null)&&(d&&(Ss.getInstance().autoLoopUpMsgBox=this.popMsg),this.cancelItems(i),s&&A.publish("flushService",""))},3,this.dialogId,!this.popMsg,400);setTimeout(()=>{A.publish("openMsgbox",h)})}getNextSelect(t,e,r,i){let n=[],s,a,l=0;this.cycle.cycles.forEach(h=>{l+=h.trunk.length});let c=0;for(;n.length==0&&!(c>l);){let h=this.getNext(t,e,r);s=h.i,a=h.j,n=this.getSelect(s,a,this.cycle,i),t=s,e=a,c++}return{i:s,j:a,result:n}}getNodes(t,e,r){let n=this.searchNodes(t,e,r);for(let s of n)if(s instanceof Le||s instanceof Ge)return new Set([s]);return n}searchNodes(t,e,r){let i=new Set,n=this.splitTrack.getConnectItemsByBbox(new ut(t.x,t.x,t.y,t.y),{net:r,layer:e});for(let s of n)if(s.isSelect(t.x,t.y)){if(s instanceof Le)return new Set([s]);if(s instanceof Ue)i.add(s);else if(s instanceof Ge)return new Set([s])}return i}static getNodesByPoint(t,e,r,i){return t.getConnectItemsByBbox(new ut(e.x,e.x,e.y,e.y),{net:i,layer:r}).filter(s=>s instanceof Ue)}getCurrentPath(t,e){let r=0,i=null;return t.cycles.forEach(n=>{let s=this.equals(n.data);(s>r||xte(s,r)&&r!=0&&n.data.length<i.data.length)&&(r=s,i=n)}),e?r>e?i:null:(i==null&&Array.isArray(t.cycles)&&(i=t.cycles[0]),i)}equals(t){let e=this.splitTrack.getStart(),r=this.getPrimitive(t,e),i=this.path;return new Yhe(i,r).similarity}getPrimitive(t,e){let r=new Array;for(let i of t)if(i instanceof Ue){let n=i.primitive,s=n.start().distance2(e),a=n.end().distance2(e);if(s<a)r.push(n),e=n.end();else{let l=Hp(n);r.push(l),e=n.start()}}return r}};var TOe=xt.getInstance(),pN=$T.getInstance(),Zhe=class{constructor(t,e,r){this.debug=null;if(pN.clear(),this.oldStartNodes=t,this.oldEndNodes=e,this.split=r,this.start=r.getStart(),this.end=r.getEnd(),this.init(t,e),this.startNodes=this.getTracks(t,this.start),this.endNodes=this.getTracks(e,this.end),this.debug=new xP,this.debug!=null){for(let i of this.startNodes)this.addDebug(i,1);Yr.debug&&(Yr.inputDebugGraphics(this.debug),this.debug=new xP)}if(this.debug!=null){for(let i of this.endNodes)this.addDebug(i,1);Yr.debug&&(Yr.inputDebugGraphics(this.debug),this.debug=new xP)}this.updateLoopEnd(),this.breakInit(),this.breakLoopList2(pN.getAllLoops())}initPadSplit(t){for(let e of t)if(e instanceof Le||e instanceof Ge){let r=this.split.searchNode(e);for(let i of r)i instanceof Ar&&(e.isSelect(i.start.x,i.start.y)||e.isSelect(i.end.x,i.end.y)||this.split.splitTrack3(i,[],[e]))}}needSplitByPad(t,e){if(t.isSelect(e.start.x,e.start.y)||t.isSelect(e.end.x,e.end.y))return!0;let r=new M(t.center,t.center),n=new ir(e.primitive,r).getLine(),s=n.start();return n.start().equals(t.center)&&(s=n.end()),e.start.equals(s)||e.end.equals(s)}updateLoopEnd(){let t=new Set,e=pN.getAllLoops(),r=new er;e.forEach(i=>{i.pathList.getAllItems().forEach(s=>{let a=r.getLoopNode(s.globalIndex);this.split.searchNode(a).filter(c=>c instanceof Le||c instanceof Ge).forEach(c=>{if(t.has(c.globalIndex))return;let h=this.split.searchNode(c);h=h.filter(m=>this.needSplitByPad(c,m.model));let u=[];h=h.filter(m=>{let g=m.start.equals(c.center),y=m.end.equals(c.center);return g&&this.breakStart(m.model,c),y&&this.breakEnd(m.model,c),g||y?(u.push(m),!1):!0}),h=this.filterConnect(u,h);let d=[];h=h.filter(m=>{let g=Pc.getInstance().trackConnect(m),y=g.startConnect,b=g.endConnect,P=!1;return!y&&c.isSelect(m.start.x,m.start.y)&&(this.breakStart(m.model,c),P=!0),!b&&c.isSelect(m.end.x,m.end.y)&&(this.breakEnd(m.model,c),P=!0),P?(d.push(m),!1):!0}),h=this.filterConnect(d,h);let p=c.center;for(xr(h,(m,g)=>{let y=m.start.distance2(p)<m.end.distance2(p)?m.start:m.end,b=g.start.distance2(p)<g.end.distance2(p)?g.start:g.end;return y.distance2(p)-b.distance2(p)},0,h.length);h.length>0;){let m=h.shift();h=this.filterConnect2(m,h,p),m.start.distance2(p)>m.end.distance2(p)?this.breakEnd(m.model,c):this.breakStart(m.model,c)}t.add(c.globalIndex)})})})}breakInit(){let t=[...this.oldStartNodes].find(r=>r instanceof Le||r instanceof Ge);this.startNodes.forEach(r=>{r.start.distance2(this.start)<r.end.distance2(this.start)?this.breakStart(r.model,t):this.breakEnd(r.model,t)});let e=[...this.oldEndNodes].find(r=>r instanceof Le||r instanceof Ge);this.endNodes.forEach(r=>{r.start.distance2(this.end)<r.end.distance2(this.end)?this.breakStart(r.model,e):this.breakEnd(r.model,e)})}breakLoopList2(t){t.forEach(r=>{r.start||this.splitLoopByEnd(r,!0),r.end||this.splitLoopByEnd(r,!1)});let e=new er;t.forEach(r=>{r.pathList.getAllItems().forEach(n=>{if(n instanceof Oi)return;let s=e.getLoopNode(n.globalIndex);if(s){let a=[],l=this.split.searchOtherNode(s).filter(c=>{if((c instanceof Ge||c instanceof Le)&&!this.needSplitByPad(c,n))return!0;if(c instanceof Ue){let h=Pc.getInstance().trackConnect(c);if(!h.startConnect){let u=c.start;new ir(new M(u,u),n.primitive).getDistance()>(n.width+c.width)/2||a.push({point:u,isStart:!0,track:c.model})}if(!h.endConnect){let u=c.end;new ir(new M(u,u),n.primitive).getDistance()>(n.width+c.width)/2||a.push({point:u,isStart:!1,track:c.model})}}return!1});this.splitTrack(s,a,l)}})})}splitLoopByEnd(t,e){let r,i;e?(i=t.pathList.getFirst(),r=i.start):(i=t.pathList.getLast(),r=i.end);let s=new er().getLoopNode(i.globalIndex);Pc.getInstance().searchCycleNodeTrack(s).forEach(l=>{let c;l.start.distance2(r)<1e-4&&(c=!0),l.end.distance2(r)<1e-4&&(c=!1),c===!0?this.breakStart(l.model):c==!1&&this.breakEnd(l.model)})}splitTrack(t,e,r){let i=pN.getLoopPathList(t),n=t.model,s=this.split.splitTrack3(t,e,r);if(s){let a=new ri,l=i;if(!l)return;let{newTracks:c,points:h,isReplace:u}=s;if(u){this.replacePoint(t,c);let d=n.globalIndex;l.getFirst()==n&&pN.update(d,c[0].globalIndex);let p=a.createList();c.forEach(g=>{a.addList(g.model,p,new Br)});let m=TOe.getNode(n);p.replace(m,m)}for(let d of c)for(let p of h){let m=p.point;if(d.start.equals(m)){this.breakStart(d.model,p.end),p.end=null;continue}if(d.end.equals(m)){this.breakEnd(d.model,p.end),p.end=null;break}}}}replacePoint(t,e){if(this.startNodes.has(t))if(this.startNodes.delete(t),e.length>1){let r=this.start.distance2(t.start)<this.start.distance2(t.end)?t.start:t.end;r.equals(e[0].start)||r.equals(e[0].end)?this.startNodes.add(e[0]):this.startNodes.add(e[e.length-1])}else this.startNodes.add(e[0]);if(this.endNodes.has(t))if(this.endNodes.delete(t),e.length>1){let r=this.end.distance2(t.start)<this.end.distance2(t.end)?t.start:t.end;r.equals(e[0].start)||r.equals(e[0].end)?this.endNodes.add(e[0]):this.endNodes.add(e[e.length-1])}else this.endNodes.add(e[0])}breakStart(t,e){let r=pN.getLoopPathListByModel(t);if(!r)return;let i=TOe.getNode(t),n=i.parent;if(i==n.getFirstNode()){r.start=r.start||(e==null?void 0:e.model);return}let a=new ri().createList();a.replace(i,n.getLastNode());let l=new VG(a,e==null?void 0:e.model,r.end);return r.end=e==null?void 0:e.model,$T.getInstance().set(l),l}breakEnd(t,e){let r=pN.getLoopPathListByModel(t);if(!r)return;let i=TOe.getNode(t),n=i.parent;if(i==n.getLastNode()){r.end=r.end||(e==null?void 0:e.model);return}let a=new ri().createList();a.replace(i.next,n.getLastNode());let l=new VG(a,e==null?void 0:e.model,r.end);return r.end=e==null?void 0:e.model,$T.getInstance().set(l),l}addDebug(t,e){if(this.debug!=null){let r;switch(e){case 1:r=ee.GREEN;break;case 2:r=ee.WHITE;break;case 3:r=ee.Golden;break}let i=null;t instanceof Ar?i=t.primitive:(t instanceof Le||t instanceof Ge)&&(i=new M(t.center,t.center)),i!=null&&this.debug.addLine(new eo(i,{color:r,id:t.globalIndex}))}}init(t,e){this.initPadSplit(t),this.initPadSplit(e),t.forEach(r=>{this.generateLoopLists(r)}),e.forEach(r=>{this.generateLoopLists(r)})}generateLoopLists(t){let e=new er,r=dN.generateListByItem(t);for(;r.length>0;){let i=r.pop(),n=i.end;if(n){let a=e.getLoopNode(n.globalIndex);a&&this.split.searchNode(a).filter(c=>this.isNeed(c)).forEach(c=>{let h=dN.generateListByItem(c);r.push(...h)})}let s=i.start;if(s){let a=e.getLoopNode(s.globalIndex);a&&this.split.searchNode(a).filter(c=>this.isNeed(c)).forEach(c=>{let h=dN.generateListByItem(c);r.push(...h)})}i.pathList.getAllItems().forEach(a=>{let l=e.getLoopNode(a.globalIndex);l&&this.split.searchNode(l).filter(h=>this.isNeed(h)).forEach(h=>{let u=dN.generateListByItem(h);r.push(...u)})})}}isNeed(t){return t instanceof Ue||t instanceof Le||t instanceof Ge}getTracks(t,e){let r=new Set;return t.forEach(i=>{i instanceof Ue?r.add(i):this.split.searchNode(i).forEach(n=>{n instanceof Ue&&r.add(n)})}),this.filterNodes3([...r],e)}filterNodes3(t,e){let r=[],i=[],n=t.filter(s=>s.start.equals(e)||s.end.equals(e)?!0:(i.push(s),!1));for(r=[...n],i=this.filterConnect(n,i),xr(i,(s,a)=>{let l=s.start.distance2(e)<s.end.distance2(e)?s.start:s.end,c=a.start.distance2(e)<a.end.distance2(e)?a.start:a.end;return l.distance2(e)-c.distance2(e)},0,i.length);i.length>0;){let s=i.shift();i=this.filterConnect2(s,i,e),r.push(s)}return new Set(r)}filterConnect(t,e){for(;t.length>0;){let r=[];t=e.filter(i=>t.find(s=>!!(s.start.equals(i.start)||s.start.equals(i.end)||s.end.equals(i.start)||s.end.equals(i.end)))?!0:(r.push(i),!1)),e=r}return e}filterConnect2(t,e,r){let i=[t],n=t.start,s=t.end;for(t.start.distance2(r)>t.end.distance2(r)&&(n=t.end,s=t.start);i.length>0;){let a=[];i=e.filter(l=>i.find(h=>!!(s.equals(l.start)||s.equals(l.end)))?!0:(a.push(l),!1)),e=a}return e}};var IOe=class{constructor(t){this.inters=new Array;this.interSet=new Ba;this.track=t}addInter(t){!this.interSet.contains(t)&&t.distance2(this.track.start)>1e-8&&t.distance2(this.track.end)>1e-8&&(this.inters.push(t),this.interSet.add(t))}},Jhe=class extends wi{constructor(){super(...arguments);this.idMap={};this.tracks=new Array;this.arcTrack=new Array;this.result=new Array;this.modifyTracks=new Set;this.replaceTracks={}}update(e){let r="updateConnectRelation-time-loop";pn(r),this.removeCoincide(e),this.splitTrack(e),this.removeCoincide(e),this.removeZeroLengthTrack(e),this.clear(),Bi(r,.05)}splitTrack(e){for(let r of e)r instanceof Me?(r.getPads().forEach(s=>{this.dispatch(s,e)}),r.getVias().forEach(s=>{this.dispatch(s,e)})):this.dispatch(r,e);for(let r of this.modifyTracks)this.dispatch(r,e,!1);this.modifyTracks.clear(),this.split()}removeCoincide(e){e.forEach(r=>{r instanceof Ue&&this.autoRemoveCoincide(r)}),this.tracks.forEach(r=>{this.autoRemoveCoincide(r)})}removeZeroLengthTrack(e){for(let r of e)r instanceof Ue&&!r.isEmpty&&r.length<.01&&this.removeTrack1(r,[])}clear(){this.tracks.length=0,this.arcTrack.length=0,this.result.length=0,this.idMap={}}dispatch(e,r,i=!0){e.isEmpty||(e instanceof Le?this.dispatchPad(e,[...r]):e instanceof Ue?this.dispatchTrack(e,[...r],i):e instanceof Ge&&this.dispatchVia(e,[...r]))}dispatchPad(e,r){let i=Pc.getInstance().searchNode(e);for(let n of i)n instanceof Ue&&this.splitPadTrack(n,e)}dispatchTrack(e,r,i=!0){let n=Pc.getInstance().searchNode(e);for(let s of n)s instanceof Le?this.splitPadTrack(e,s):s instanceof Ue?this.splitTracks(e,s,i):s instanceof Ge&&this.splitViaTrack(e,s)}dispatchVia(e,r){let i=Pc.getInstance().searchNode(e);for(let n of i)n instanceof Ue&&this.splitViaTrack(n,e)}splitPadTrack(e,r){if(!e.isEmpty&&!r.isEmpty&&!r.isSelect4Layer(e.start.x,e.start.y,e.layerId)&&!r.isSelect4Layer(e.end.x,e.end.y,e.layerId)&&e.isSelect(r.center.x,r.center.y)){if(e instanceof Si){let i=r.center.sub(e.center).normalize(),n=new M(e.center,r.center.add(i.mul(e.radius))),s=e.primitive,a=Tt(n,s),l=s.bbox();if(a>0){let c=this.getSide(e);for(let h=0;h<a;h+=2){let u=new S(Ee[h],Ee[h+1]);l.isContains(u)&&c.addInter(u)}}}else if(e instanceof Ar){let i=e.primitive,n=i.bbox(),s=ir.foot(i,r.center);s!=null&&n.isContains(s)&&s.distance1(r.center)<Math.min(.01,e.width/2)&&this.getSide(e).addInter(s)}}}getTrackConnectState(e){let r=Pc.getInstance().trackConnect(e),i=!r.startConnect,n=!r.endConnect;return i&&n?0:i&&!n?1:!i&&n?2:3}modifyTrack(e,r,i){let n=e.track,s=r.track,a=s.end.sub(s.start),l=this.getLine(n.start,n.end),c=ir.foot(l,s.start),h=null,u=Pc.getInstance().trackConnect(e.track),d=!u.startConnect,p=!u.endConnect;if(!d&&(c.equals1(e.track.start)||c.add(a).equals1(e.track.start)))return h;if(!p&&(c.equals1(e.track.end)||c.add(a).equals1(e.track.end)))return h;let m=n.primitive.bbox();switch(i){case 0:{h=Te.dispatch(s,"modify"),s.start=c,s.end=c.add(a),m.isContains(c)&&e.addInter(c),m.isContains(s.end)&&e.addInter(s.end);break}case 1:{h=Te.dispatch(s,"modify"),s.start=c,m.isContains(c)&&e.addInter(c);break}case 2:{h=Te.dispatch(s,"modify"),s.start=c,s.end=c.add(a),m.isContains(s.end)&&e.addInter(s.end);break}default:}return h}splitTracks(e,r,i=!0){if(e.isEmpty||r.isEmpty)return;let n=null;if(e instanceof Ar&&r instanceof Ar){let u=e.direct,d=r.direct;if(Math.abs(u.cross(d))<.001&&e.length>.001&&r.length>.001){let m=Math.min(e.width,r.width)/4,g=this.getLine(e.start,e.end);if(ir.foot(g,r.start).distance1(r.start)<m){let b=this.getTrackConnectState(e),P=this.getTrackConnectState(r),T=this.getSide(e),I=this.getSide(r);if(b<3&&T.inters.length==0)if(i){this.modifyTracks.add(T.track);return}else n=this.modifyTrack(I,T,b);else if(P<3&&I.inters.length==0)if(i){this.modifyTracks.add(I.track);return}else n=this.modifyTrack(T,I,P)}}}let s=e.primitive,a=r.primitive,l=Tt(s,a),c=s.bbox(),h=a.bbox();if(l>0){je.stack!=null&&n!=null&&je.stack.addCommand(n);let u=this.getSide(e),d=this.getSide(r);for(let p=0;p<l;p+=2){let m=new S(Ee[p],Ee[p+1]);c.isContains(m)&&u.addInter(m),h.isContains(m)&&d.addInter(m)}}else n!=null&&n.undo()}splitViaTrack(e,r){if(!e.isEmpty&&!r.isEmpty&&!r.isSelect(e.start.x,e.start.y)&&!r.isSelect(e.end.x,e.end.y)&&e.isSelect(r.center.x,r.center.y)){if(e instanceof Si){let i=r.center.sub(e.center).normalize(),n=new M(e.center,r.center.add(i.mul(e.radius))),s=e.primitive,a=Tt(n,s),l=s.bbox();if(a>0){let c=this.getSide(e);for(let h=0;h<a;h+=2){let u=new S(Ee[h],Ee[h+1]);l.isContains(u)&&c.addInter(u)}}}else if(e instanceof Ar){let i=e.primitive,n=ir.foot(i,r.center),s=i.bbox();n!=null&&s.isContains(n)&&n.distance1(r.center)<Math.min(.01,e.width/2)&&this.getSide(e).addInter(n)}}}getSide(e){let r=this.idMap[e.globalIndex];return r==null&&(r=new IOe(e),this.idMap[e.globalIndex]=r),r}split(){Object.values(this.idMap).forEach(r=>{if(r.track instanceof Ar&&r.inters.length>0){xr(r.inters,(l,c)=>l.distance2(r.track.start)-c.distance2(r.track.start),0,r.inters.length),r.inters.push(r.track.end);let i=r.track.start,n=r.track.layerId,s=r.track.width,a=[];r.inters.forEach(l=>{if(!l.equals1(i)){let c=pr.addTrack(n,i,l,s,r.track.locked,r.track.net);c.updateFilterVisible=!0,c.visible(),this.joinCombination([c],r.track.getGroupID()),this.addTrack(c),a.push(c),i=l}}),Re.addAll(this.tracks,a),this.removeTrack1(r.track,a)}else if(r.track instanceof Si&&r.inters.length>0){dn(r.inters,r.track.primitive),r.inters.push(r.track.end);let i=r.track.start,n=r.track.layerId,s=r.track,a=r.track.width,l=s.startAngle,c=[];r.inters.forEach(h=>{if(!h.equals1(i)){let u=h.angle(s.center),d=pr.addArcTrack(n,s.center,s.radius,l,u,s.sweep,a,s.locked,s.net,s.arcType);d.updateFilterVisible=!0,d.visible(),this.joinCombination([d],r.track.getGroupID()),this.addTrack(d),c.push(d),i=h,l=u}}),Re.addAll(this.arcTrack,c),this.removeTrack1(r.track,c)}})}joinCombination(e,r){kt.getItem(r)!=null&&kt.joinCombination(e,r)}addTrack(e){je.stack!=null&&(e.partition=x.getInstance().partitionId,je.stack.addCommand(Te.dispatch(e,"add"))),A.publish("hasModifyPcbItem",e)}removeTrack(e){je.stack!=null&&je.stack.addCommand(Te.dispatch(e,"delete")),e.remove(),A.publish("delete",e)}autoRemoveCoincide(e){if(e.isEmpty)return;if(e.length<.001){this.removeTrack(e);return}let r=Pc.getInstance().searchTrackConnectTrack(e);for(let i of r)if(this.checkCoincide(e,i))if(i instanceof Ar)if(i.width<e.width)this.removeTrack1(i,[e]);else if(i.width==e.width)if(i.length>e.length){this.removeTrack1(e,[i]);return}else this.removeTrack1(i,[e]);else{this.removeTrack1(e,[i]);return}else this.removeTrack1(e,[i])}removeTrack1(e,r){let i=this.replaceTracks[e.globalIndex];i||(i=this.replaceTracks[e.globalIndex]=new Set),r.forEach(n=>{i.add(n.globalIndex)}),this.removeTrack(e)}checkTrackCoincide(e,r){if(e instanceof Ue&&r instanceof Ue){if(e.start.similarEquals(r.start,1e-5)&&e.end.similarEquals(r.end,1e-5))return!0;if(e.start.similarEquals(r.end,1e-5)&&e.end.similarEquals(r.start,1e-5))return!0}return!1}checkArcTrackCoincide(e,r){if(e instanceof Si&&r instanceof Si&&e.center.similarEquals(r.center,1e-5)&&xte(e.radius,r.radius)&&e.model.primitive.isLarge()===r.model.primitive.isLarge()){if(e.start.similarEquals(r.start,1e-5)&&e.end.similarEquals(r.end,1e-5))return!0;if(e.start.similarEquals(r.end,1e-5)&&e.end.similarEquals(r.start,1e-5))return!0}return!1}checkCoincide(e,r){return e.isEmpty||r.isEmpty?!1:!!(e instanceof Ar&&r instanceof Ar&&this.checkTrackCoincide(e,r)||e instanceof Si&&r instanceof Si&&this.checkArcTrackCoincide(e,r))}getLine(e,r){let i=r.sub(e).normalize().mul(1e3);return new M(e.sub(i),r.add(i))}};var Qhe=class{constructor(t){this.split=new Set;this.oldPath=[];this.saveVia=new Set;this.currIndex=0;this.paths=[];this.replaceTracks={};this.command=t}clearSplit(){this.split.clear()}setCurrIndex(t){this.currIndex=t}getStart(){return this.getPathInfo().path.find(e=>e!=null).start()}getEnd(){let t=this.getPathInfo().path;for(let e=t.length-1;e>=0;e--)if(t[e])return t[e].end()}init(t){this.paths=t}getPrimitivePath(){return this.getPathInfo().path.filter(t=>t!=null)}getStartLayerId(){return this.paths[this.currIndex].tracks.find(t=>t!=null).layer}getEndLayerId(){let t=this.paths[this.currIndex].tracks;for(let e=t.length-1;e>=0;e--)if(t[e])return t[e].layer}getNet(){return this.getNetByIndex(this.currIndex)}getNetByIndex(t){return this.paths[t].net}getWidth(){var t;return(t=this.paths[this.currIndex].tracks.find(e=>{if(e)return!0}))==null?void 0:t.width}getNeedSaveVia(){return this.saveVia}getPathInfo(){return this.paths[this.currIndex]}getOldPath(){return this.oldPath[this.currIndex]}getPathByNet(t){let e=[];return this.oldPath.forEach((r,i)=>{if(i==this.currIndex)return;let n=this.getNetByIndex(i);r&&t==n&&e.push(...r)}),new Set(e)}initCurr(){let t=this.currIndex,e=this.paths[t],r=[],{path:i,tracks:n,net:s}=e;if(i.forEach((m,g)=>{if(m==null){this.saveVia.add(n[g].id);return}let y=this.getTrackById(n[g].id);for(let b of y)b&&r.push(b)}),r.length==0)return;let a=r[0],l=r[r.length-1],c=Pc.getInstance().getRatlineNet(),h=!c||c.net!=s,u=Pc.getInstance().init(s,r,a.model,l.model);h&&(this.replaceTracks={},c=Pc.getInstance().getRatlineNet()),c.hasExceed()?this.nets=c:this.nets=null;let d=new Jhe;d.update(u.filter(m=>m instanceof Ue));let p=d.replaceTracks;Object.assign(this.replaceTracks,p);for(let m in p)this.setReplaceTrack(m,p[m]);this.pointSplitTracks(a.start,{net:s,width:a.width,layer:a.layerId}),this.pointSplitTracks(l.end,{net:s,width:l.width,layer:l.layerId})}setReplaceTrack(t,e){this.nets&&this.nets.setReplaceTrack(t,e)}getTrackById(t){let e=new er,r=e.getLoopNode(t),i=[];if(r)return[r];{let n=new Set,s=Array.from(this.replaceTracks[t]||[])||[];for(;s.length>0;){let a=s.shift();if(!n.has(a))if(n.add(a),this.replaceTracks[a])Re.addAll(s,this.replaceTracks[a]);else{let l=e.getLoopNode(a);i.push(l)}}}return i}findOldPathByCurr(t,e){this.loopTool=new Zhe(t,e,this);let r=this.currIndex,i=this.paths[r],n=this.getPath2(i);this.oldPath[r]=n;let s=this.getNetByIndex(r);for(let a=r+1;a<this.paths.length;a++)if(this.getNetByIndex(a)==s){let c=this.getPath2(this.paths[a]);this.oldPath[a]=c}}getLoopStartNodes(){return this.loopTool.startNodes}getLoopEndNodes(){return this.loopTool.endNodes}getOldStartNodes(){return this.loopTool.oldStartNodes}getOldEndNodes(){return this.loopTool.oldEndNodes}getPath2(t){let{path:e,tracks:r,net:i}=t,n=[];return e.forEach((s,a)=>{if(s==null){let u=new er().getLoopNode(r[a].id);u&&n.push(u);return}let l=this.getTrackById(r[a].id);l[0]&&Re.addAll(n,l)}),n}pointSplitTracks(t,e){let r=this.getConnectItemsByTrackPoint(t,e).filter(i=>i instanceof Ar);this.splitTracksByPoint(r,t)}splitTracksByPoint(t,e){t.forEach(r=>{if(uT(r.primitive,e)>0)e.equals(r.start)||e.equals(r.end)||this.changeTrack(r,[e],this.command);else{let n=new ir(r.primitive,new M(e,e)),s=e,a=n.getLine();n.getDistance()<r.width/2&&(s=a.start().equals(e)?a.end():a.start(),s.equals(r.start)||s.equals(r.end)||this.changeTrack(r,[s],this.command))}})}splitTrack3(t,e,r){let i=[];if(e.forEach(n=>{let a=new ir(t.primitive,new M(n.point,n.point)).getLine(),l=a.start(),c=a.end();uT(t.primitive,l)>0?i.push({point:l}):i.push({point:c})}),r.forEach(n=>{let a=new ir(t.primitive,new M(n.center,n.center)).getLine(),l=a.start(),c=a.end();uT(t.primitive,l)>0?i.push({point:l,end:n}):i.push({point:c,end:n})}),i.length>0){let n=t.start;xr(i,(h,u)=>h.point.distance2(n)-u.point.distance2(n),0,i.length);let s=[],a;i.forEach(h=>{if(this.validPoint(h.point,t.primitive,t.width)){if(!a){a=h.point,s.push(a);return}a.equals(h.point)||(a=h.point,s.push(a))}});let l=this.changeTrack(t,s,this.command);l.forEach(h=>{this.split.add(h.globalIndex)});let c=!0;return l.length==1&&l[0]==t&&(c=!1),{newTracks:l,points:i,isReplace:c}}else return this.split.add(t.globalIndex),null}validPoint(t,e,r){let i=r/2;return t.distance1(e.start())>=i&&t.distance1(e.end())>=i}changeTrack(t,e,r){let i=t.start,n=[];return e.length>0?(e=e.sort((s,a)=>s.distance2(i)-a.distance2(i)),e.push(t.end),e.forEach(s=>{let a=t.model.clone();a.start=i,a.end=s;let l=pr.addTrackByModel(a,!0);l.partition=x.getInstance().partitionId,i=s,l.updateFilterVisible=!0,l.visible(),n.push(l),r.addCommand(Te.dispatch(l,"add")),A.publish("hasModifyPcbItem",l)}),r!=null&&(r.addCommand(Te.dispatch(t,"delete")),A.publish("hasModifyPcbItem",t)),t.remove(),this.joinCombination(n,t.getGroupID()),A.publish("delete",t),A.publish("updateRtree",""),this.removeTrack1(t,n)):n.push(t),n}removeTrack1(t,e){let r=this.replaceTracks[t.globalIndex];r||(r=this.replaceTracks[t.globalIndex]=new Set),e.forEach(i=>{r.add(i.globalIndex)}),this.setReplaceTrack(t.globalIndex,r)}joinCombination(t,e){kt.getItem(e)!=null&&kt.joinCombination(t,e)}getConnectTrackByBbox(t,e){let r=Pc.getInstance().getRTree().search(t);r=r.filter(n=>n.item instanceof qr&&n.item.layerId==e.layer&&!ne.lesseq(n.item.length,0));let i=new er;return r.map(n=>i.getLoopNode(n.item.globalIndex))}getConnectItemsByBbox(t,e){let r=Pc.getInstance().getRTree().search(t);r=r.filter(n=>{let s=n.item,a=s.layerId;if(s instanceof Je){if(a==12||a==e.layer)return!0}else if(s instanceof It){if(s.isContains(e.layer))return!0}else if(s instanceof yt){if(ne.lesseq(s.length,0))return!1;if(a==e.layer)return!0}return!1});let i=new er;return r.map(n=>i.getLoopNode(n.item.globalIndex))}getConnectItemsByTrackPoint(t,e){return this.getConnectTrackByBbox(t.bbox().extendOfSize(e.width),e)}deleteTracks(t,e,r=!0){if(!t||t.length==0)return;let i=new Set(e);this.oldPath.forEach(n=>{n&&n.forEach(s=>{i.add(s.globalIndex)})}),t.forEach(n=>{n&&(r&&i.has(n.globalIndex)||n.isEmpty||(this.command.addCommand(Te.dispatch(n,"delete")),A.publish("hasModifyPcbItem",n),n.remove(),A.publish("delete",n)))}),A.publish("updateRtree","")}searchNode(t){return Pc.getInstance().searchNode(t)}searchOtherNode(t){return Pc.getInstance().searchOtherNode(t)}searchHasPoint(t){if(this.nets){let e=t.pathList.iterator();for(;e.hasNext();){let r=e.next();if(this.nets.isPoint(r.globalIndex))return!0}return!1}return!1}};var Vo=class extends ci{constructor(e){super();this.event=null;this.nextTool=null;this.changeControlStatus=!1;this.lastClick=null;this._wireMode=e,this.config=Ss.getInstance(e);let r=this.config.doubleClickItem;this.selectEndpointTool=new VT(e,this),sl.addTool(this),jr.addDrawTool(this),na.getInstance().setTool(this),this.initSketcherAttrPanel(e,!0),this.isHoldPCBAttrPanel=!0,r&&(this.config.userModifyWidth=!1,this.onMouseLeftDown(Pi.getInstance())),this.config.clear()}getWidth(){let e=Un.getInstance().current;return e?e.node.width:0}onKeyDown(e){let r;switch(this._wireMode=="Differential pair wiring"&&m3.changeFanOut?r=sr.getLocalAction(["changeDiffPairFanOutMode"],e):["Multi-route wiring","Single wiring"].includes(this._wireMode)&&(r=sr.getLocalAction(["decrease_routing_width","increase_routing_width"],e)),!r&&this._wireMode=="Multi-route wiring"&&(r=sr.getLocalAction(["IncreaseMultiSpace","decreaseMultiSpace"],e)),r||(r=sr.getAction(4,e)),r){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(jr.getNextType()),Hi();break;case"Change Track Width While Routing":ie.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"Switch Common Track Width":this.showCommonTrackWidthMenu(e);break;case"Switch Common Via Size While Routing/Placing Via":this.showCommonViaSizeMenu(e);break;case"Cancel":this.cancel();break;case"Finish":this.event?this.completed():(this.onMouseLeftDown(e),this.onMouseLeftUp(e));break;case"Backspace":this.backspace();break;case"Place Via":this.placeVia();break;case"changeDiffPairFanOutMode":this.toggleFanOutMode();break;case"Filp Path While Drawing":this.flipPath();break;case"displayRealTimeNetLengthAndLengthTolerance":{let i=ce.pcbConfig.showNetLength||ce.pcbConfig.showDiffLength;ce.pcbConfig.showNetLength=!i,ce.pcbConfig.showDiffLength=!i;break}case"decrease_routing_width":{let i=this.event.node.width-.2;i>=.1&&(this.setWireWidth(i),Hi())}break;case"increase_routing_width":{let i=this.event.node.width+.2;this.setWireWidth(i),Hi()}break;case"IncreaseMultiSpace":al.getInstance().increaseTracksGap(),this.initSketcherAttrPanel(this._wireMode);break;case"decreaseMultiSpace":al.getInstance().decreaseTracksGap(),this.initSketcherAttrPanel(this._wireMode);break}ie.publish("updateFrame","")}handleMultiSelectItem(e){if(e.length>0){let{sceneX:r,sceneY:i}=Pi.getInstance(),n=e.every(a=>a instanceof _n),s;n?s=go.multiSelectRatline(e,new S(r,i)):s=go.multiSelectEleFilter(e,new S(r,i)),s.length>1&&(this.selectEndpointTool.setSelectItems(s),this.selectEndpointTool.onMouseLeftDown(Pi.getInstance()),this.selectEndpointTool.clearSelectItems(),this.confirmResult())}}onMouseLeftDown(e){if(!this.lastClick||!this.event)this.onMouseLeftDown1(e);else{let{mouseX:i,mouseY:n}=this.lastClick.ctx,{mouseX:s,mouseY:a}=e;if(Math.max(Math.abs(s-i),Math.abs(a-n))>=10)this.onMouseLeftDown1(e);else{this.dblClickPlaceVia();return}}let r=setTimeout(()=>{this.lastClick&&(clearTimeout(this.lastClick.timer),this.lastClick=null)},400);this.lastClick={timer:r,ctx:{...e}}}dblClickPlaceVia(){this.lastClick&&(clearTimeout(this.lastClick.timer),this.lastClick=null),this.nextTool!=null&&Ss.getInstance().dblclickPlaceViasWhileRouting&&this.nextTool.dblClickPlaceVia()}onMouseLeftDown1(e){if(this.changeControlStatus){this.changeControlNode(e);return}if(this.event==null){if(!Bt.checkTrackCanEditByPoint(new S(e.sceneX,e.sceneY)))return;this.selectEndpointTool.onMouseLeftDown(e),this.confirmResult()}else if(this.nextTool!=null){if(!Bt.checkTrackCanEditByPoint(new S(this.event.node.end.point.x,this.event.node.end.point.y))){let i="Cannot be added beyond drawing range";Bt.showMassageTip(i,i);return}if(e.ctrlKey){this.completed();return}this.nextTool.onMouseLeftDown(e);let r=Un.getInstance().current;this.event=r,this._wireMode=="Single wiring"?this.singleAutoTerminate():this.multiAutoTerminate()}}confirmResult(){var e;this.event=this.selectEndpointTool.event,Un.getInstance().current=this.event,this.selectEndpointTool.event=null,this.autoToggle(),jt.getToleranceTargetNet((e=this.event)==null?void 0:e.node.net),this.nextTool&&this._wireMode!=="Differential pair wiring"&&this.nextTool.onMouseMove(Pi.getInstance()),this.event&&ce.pcbConfig.startTrackWidth==="last"&&(we.prevTrackWidth=this.event.node.width),this.initSketcherAttrPanel(this._wireMode)}multiAutoTerminate(){let e=Un.getInstance().current;if(!this.config.autoTerminateRouting)return!1;let r=0,i,n=e.tracks.findIndex(a=>a==e.node),s=!1;for(;r<e.tracks.length;){n=n%e.tracks.length;let a=e.tracks[n];if(r++,n++,a.drawing==1)continue;if(a.drawing==2&&!i){s=!0,a.drawing=0,i=a;continue}let l=a.start.point,c=go.autoEndItem(l,a.layerId,a.net,Array.from(a.start.signalLayers));if(c&&Un.getInstance().hasTrack(a)){a.drawing=1,c.visible();continue}i||(i=a)}if(i)s&&this.changeWireMode("Single wiring"),e.node=i;else return this.completed(),!0;return!1}async changeWireMode(e){let r;this.nextTool!=null&&(r=this.nextTool.wire,this.nextTool.wire=e,this.event=Un.getInstance().current,Ss.getInstance(e)),this._wireMode=e,this.config.wireMode=e;let i=_F(r);await ie.windowBridge.rpcCall("PCB2UIAboutUnmountedSketcherAttrView",{header:{action:i}},$()),this.initSketcherAttrPanel(this._wireMode)}singleAutoTerminate(){var s,a;let e=Un.getInstance().current,r=e.node.start.point,i=go.autoEndItem(r,e.node.layerId,e.node.net,Array.from(e.node.start.signalLayers)),n=this.config.autoTerminateRouting&&i&&Un.getInstance().hasTrack(e.node);if(!n)return i&&(e.node.start.allowModifyDirect=!0),!1;if(n){i.visible();let l=this.event.tracks.length;if(l>1&&this.nextTool.oldMode!="Single wiring"){e.node.drawing=1;let c=e.node.drawing;l--;let h=!0,u=e.tracks.indexOf(e.node),d=((s=e.tracks[u-1])==null?void 0:s.drawing)==1,p=((a=e.tracks[u+1])==null?void 0:a.drawing)==1;for((u==e.tracks.length-1||!d&&p)&&(h=!1);l>0&&c!=0;)h?this.toggleNext():this.togglePre(),c=e.node.drawing,c===2&&(c=e.node.drawing=0),l--;if(c!=0)return this._wireMode="Multi-route wiring",this.selectEndpointTool.wire="Multi-route wiring",this.completed(),!0;{let m=e.node.layerId;be.setActiveLayerId(m)}}else return this.completed(),!0}return!1}changeControlNode(e){let r=this.selectEndpointTool.getControlTrack(e);r&&r.find(i=>{let{find:n,sort:s,eventPos:a}=this.findControlByTrack(i);if(n!=-1){let l=s[a],c=Un.getInstance().current,h=s[0],u=n;return h!=l&&(u=c.tracks.length-1-n),c.changeControlNodeByIndex(u),this.changeControlStatus=!1,jt.cancel(),!0}return!1})}findControlByTrack(e){let r=Un.getInstance().events,i=[].concat(r,[Un.getInstance().current]).reverse(),n=[],s=!0,a,l=-1,c;return i.find((h,u)=>{var d;return l==-1&&(l=this.selectEndpointTool.getControlTrackIndex(e,h),c=u),a&&((d=h.tracks[0].end.model)==null?void 0:d.globalIndex)!=a.tracks[0].start.model.globalIndex&&(s=!s),a=h,n.push(s),l!=-1}),{find:l,sort:n,eventPos:c}}onMouseMove(e){if(this.inputInfo=e,this.changeControlStatus){jt.update(Pi.getInstance(),"Please click to select a track to serve as the control line.");return}this.event==null?this.selectEndpointTool.onMouseMove(e):this.nextTool!=null&&this.nextTool.onMouseMove(e)}onMouseLeftUp(e){this.changeControlStatus||(this.event==null?(this.selectEndpointTool.onMouseLeftUp(e),this.confirmResult()):this.nextTool!=null&&this.nextTool.onMouseLeftUp(e))}autoToggle(){this.event==null?this.nextTool=null:(this.start(),this.nextTool=new ny(this.event,this._wireMode))}wireCorner(e){tr.getInstance().type=e,we.synchronize(),this.nextTool!=null&&this.nextTool.wireCorner(),this.refresh(),this.initSketcherAttrPanel(this._wireMode)}wireMode(e){tr.getInstance().mode=e,we.synchronize(),this.nextTool!=null&&(this.nextTool.wireMode(),lu.getInstance().clearCollidePl()),this.initSketcherAttrPanel(this._wireMode)}async toggleRouteMode(){this.nextTool.toggleRouteMode(this);let e=_F(this.nextTool.lastMode);await ie.windowBridge.rpcCall("PCB2UIAboutUnmountedSketcherAttrView",{header:{action:e}},$()),this.initSketcherAttrPanel(this._wireMode)}toggleSingleRoute(){if(this._wireMode=="Single wiring"&&this.event!=null){this.toggleNext();let r=Un.getInstance().current.node.layerId;be.setActiveLayerId(r)}}toggleNext(){let e=Un.getInstance().current;e.toggleNext(),e.tracks.forEach(r=>{r!==e.node&&(r.end=r.start.clone()),e.result.wireMap.delete(r)}),this.nextTool.initNearNode()}togglePre(){Un.getInstance().current.togglePre(),this.nextTool.initNearNode()}changeControlRoute(){if(this._wireMode!="Single wiring"&&this.event!=null){if(this.event.tracks.length==2){this.toggleNext();return}this.changeControlStatus=!0,jt.update(Pi.getInstance(),"Please click to select a track to serve as the control line.")}}modifyWireMode(e){this.nextTool!=null&&(this.nextTool.wire=e,this.nextTool.restoreCurrentInitState(this._wireMode),this.nextTool.initNearNode(),this.event=Un.getInstance().current,Ss.getInstance(e)),this._wireMode=e,this.config.wireMode=e}backspace(){this.nextTool!=null&&(this.nextTool.backspace(),this._wireMode=this.nextTool.wire,this.initSketcherAttrPanel(this._wireMode))}placeVia(){this.nextTool!=null?this.nextTool.placeVia():ie.publish("tool","place_part(via)")}placeBlind(e){switch(e){case"VIA_TYPE_RULESSETTING":{let r={activeTab:"Rule",activeMenu:"Blind/Buried Via"};ie.publish("openMainDialog",{cmd:5,data:{option:r,tool:this}});break}default:this.nextTool!=null&&this.nextTool.placeBlind(e)}}toggleFanOutMode(){this.nextTool!=null&&(this.config.changeFanOutMode=!0,this.config.fanOutMode===2?this.config.fanOutMode=1:this.config.fanOutMode=2,this.refresh())}flipPath(){this.nextTool!=null&&this.nextTool.flipPath()}setWireWidth(e){if(!(e==null||isNaN(e)||e==0)){if(this.nextTool!=null)this.nextTool.wireWidth(e)&&ce.pcbConfig.startTrackWidth=="last"&&(this.config.width=e,we.prevTrackWidth=e),this.refresh();else{let r;if(this.event)r=this.event.node.layerId;else{let a=be.getActiveLayer();a.isCopperLayer()||(a=be.getTopLayer()),r=a.layerID}let i,n;if(this._wireMode=="Differential pair wiring"){let a=te.getInstance().getDefaultDifferentialPhysics();i=a.getStrokeWidthMin(r),n=a.getStrokeWidthMax(r)}else{let a=te.getInstance().getDefaultTrackPhysics();i=a.getMinWidth(r),n=a.getMaxWidth(r)}let s=x.getInstance().unit==="mm"?3:2;xe(e,s)<xe(i,s)||xe(e,s)>xe(n,s)?ie.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},$()):(this.config.width=e,we.prevTrackWidth=e,this.config.userModifyWidth=!0)}this.initSketcherAttrPanel(this._wireMode)}}cancel(){this.changeControlStatus?(this.changeControlStatus=!1,jt.cancel()):this.event==null?(jr.clearDrawTool(),ie.publish("tool","dropdrag"),this.config.reset(),na.getInstance().setTool(null)):(this.interrupt(),this.nextTool=null,this.event=null,this.initSketcherAttrPanel(this._wireMode))}getEventStatus(){return this.event}completed(){this.nextTool!=null&&(this.nextTool.complete(),this.complete2history(),this.nextTool=null,this.event=null,jt.cancel(),lu.getInstance().clear(),ny.firstEvent=null,ny.canRemoveLoop=null)}clear(){var e;(e=this.nextTool)==null||e.interrupt(),ji.getInstance().clear(),Zl.getInstance().deleteAll(),Rm.getInstance().clear(),Un.getInstance().clear(),_i.getInstance().clear(),hf.getInstance().clear(),D0.getInstance().clear(),hi.getInstance().clear(),xt.getInstance().clear(),Os.getInstance().clear(),_r.getInstance().clear(),O9.getInstance().clear(),gc.getInstance().clear(),Ra.getInstance().clear(),Es.getInstance().clear(),yc.getInstance().clear(),Fr.getInstance().clear()}complete2history(){var l;let e=new ve("wire");Bt.isChildPcb()||new p$().autoAssignTrackNet(e);let r=this.nextTool.changeCommand,{newIds:i}=ji.getInstance().complete(r),n=this.selectEndpointTool.clearDelteCommands(),s=new ve("wire");if(n.length)if(r.commands.length>0){let c=n==null?void 0:n.commands;if(c.length)for(let h=c.length-1;h>=0;h--){let u=c[h];s.addCommand(u)}}else this.selectEndpointTool.clearDelteCommands(!0);let a=r.commands;for(let c of a)s.addCommand(c);if(e.commands.forEach(c=>{s.addCommand(c)}),ie.publish("SetSuspend",!1),s.commands.length>0&&je.executeCommand(s),ie.publish("SetSuspend",!0),this.config.removeLoop)try{console.time("remove loop");let c=na.getInstance(),h=new p$().getTrackInfoPath2(i),u=[];for(let b in h)u.push(...h[b]);let d=new er;u.forEach(b=>{let P=b.tracks.map(T=>d.getItem(T.id));console.log(P)});let p=new Qhe(je.stack);p.init(u);let m=!0;xt.getInstance().clear(),_i.getInstance().clear(),$T.getInstance().clear();let y;u.forEach((b,P)=>{let T=!1;P==u.length-1&&(T=!0);let I=Array.from(b.path).filter(R=>R!=null);if(!(I&&I.length>0))return;p.setCurrIndex(P);let C=p.getNet(),E=p.getEndLayerId(),O=b.path[b.path.length-1].end();if(!y)y={net:C,end:O,layerId:E};else if(C==y.net&&O.equals(y.layerId)&&E==y.layerId)return;let _=new Khe(je.stack,p,c.removeAntenna);_.popMsg=this.config.autoLoopUpMsgBox,_.saveViaLoop=!c.removeCircuitsContainingVias,c.removeAntenna&&_.removeLeave(),m=_.removeLoop(T)&&m}),m&&(ie.publish("flushService",""),Pc.getInstance().clear()),console.timeEnd("remove loop")}catch(c){console.warn(c),ie.publish("flushService",""),Pc.getInstance().clear()}else ie.publish("flushService","");setTimeout(()=>{ie.publish("flushTearDrop",""),ie.publish("updateFrame","")},10),this.clear(),Ap.updateNetLengthMsg(this.event,this._wireMode),this._wireMode=(l=this.config.lastMode)!=null?l:this.nextTool.oldMode,this.config.wireMode=this._wireMode,this.selectEndpointTool.wire=this._wireMode,this.initSketcherAttrPanel(this._wireMode),ie.publish("clearSelect",""),this.end()}interrupt(){this.nextTool!=null&&(this.nextTool.restoreCurrentInitState(),this.complete2history()),ny.firstEvent=null,ny.canRemoveLoop=null,jt.cancel(),this.selectEndpointTool.interrupt()}toggleLayer(e,r){if(r!=null){let i=$e.getInstance().getSingleLayerId4Order(),n=be.getLastActiveLayerID(),s=i.indexOf(n);r=="next"?s>=i.length-1||s<0?s=0:s++:s<0?s=0:s==0?s=i.length-1:s--,e=i[s],be.setActiveLayerId(e)}this.nextTool!=null&&this.nextTool.toggleLayer(e)}updateTrackWidth(){if(ce.pcbConfig.startTrackWidth=="rule"&&this.event!=null){let e=0,r=this.event;r.node.net!=""?e=te.getInstance().getTrackPhysicsByNet(r.node.net).getDefaultWidth():e=te.getInstance().getDefaultTrackPhysics().getDefaultWidth(),this.setWireWidth(e)}}getWireWidth(){return this.nextTool!=null?this.nextTool.getWireWidth():this.config.width}toggleWidth(e){if(e==="WIRING_WIDTH_FOLLOWRULES"){let r=ce.pcbConfig.startTrackWidth=="rule"?"last":"rule";if(ce.pcbConfig.startTrackWidth=r,we.widthFollowRule=ce.pcbConfig.startTrackWidth=="rule",ce.pcbConfig.startTrackWidth=="rule"){this.nextTool!=null&&this.nextTool.wireWidth(0,"WIRING_WIDTH_FOLLOWRULES");let i,n,s;if(this.event){let a=this.event.node;n=a.layerId,s=a.net}else{let a=be.getActiveLayer();a.isCopperLayer()||(a=be.getTopLayer()),n=a.layerID,s=""}if(this._wireMode=="Single wiring"&&this.event){let l=this.event.node.start.point,c=Ds(l,n,!0),h=xm(c,s,n);if(h!=null)i=h;else{let u=te.getInstance().getNet(s);u!=null&&(u==null?void 0:u.netDifferential)!=null?i=te.getInstance().getDifferentialPhysicsByNet(s).getStrokeWidthDefault(n):i=te.getInstance().getTrackPhysicsByNet(s).getDefaultWidth(n)}}else if(this._wireMode=="Differential pair wiring"&&this.event){this.event.node.net!=""&&(i=te.getInstance().getDifferentialPhysicsByNet(this.event.node.net).getStrokeWidthDefault(n));let a=this.event.tracks;for(let l of a){let c=l.start.point,h=Ds(c,l.layerId),u=xm(h,l.net,l.layerId);if(u!=null){i=u;break}}}else this._wireMode=="Differential pair wiring"?i=te.getInstance().getDefaultDifferentialPhysics().getStrokeWidthDefault(n):i=te.getInstance().getDefaultTrackPhysics().getDefaultWidth(n);this.setWireWidth(i)}}else if(e=="WIRING_WIDTH_INPUT")ie.publish("openMainDialog",{cmd:26,data:{tool:this}});else if(e=="WIRING_WIDTH_RULESSETTING"){let r={activeTab:"Rule",activeMenu:"Track"};ie.publish("openMainDialog",{cmd:5,data:{option:r,tool:this}})}else if(e=="WIRING_WIDTH_COMMONLY_SSETTING")ie.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",$());else{let i=ce.trackConfig[e].getSizeAccordingToUnit();this.setWireWidth(i),we.prevTrackWidth=i}this.initSketcherAttrPanel(this._wireMode),this.refresh()}getTracksGap(){if(this.event!=null&&this._wireMode!=="Single wiring")return this.event.gaps}setTracksGap(e){this.event!=null&&this._wireMode!=="Single wiring"&&(this.event.modifySpacing1(e),this.nextTool!=null&&this.nextTool.modifySpacing(e),this.refresh())}getViaRadius(){return this.nextTool!=null?this.nextTool.getViaRadius():{innerRadius:this.config.innerRadius,radius:this.config.radius}}setViaSize(e,r,i){var n;if(this.nextTool!==null)this.nextTool.viaSize(e,r,i);else{let s=((n=this.event)==null?void 0:n.node.net)||"",a=te.getInstance().getRadiusPhysicsByNet(s);if(r!=null&&Uf.inValidRadius(a,r)){ie.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},$());return}else if(e!=null&&Uf.inValidInnerRadius(a,e)){ie.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},$());return}r&&(this.config.radius=r,rt.setDefaultVia({net:null,holeRadius:null,radius:r})),e&&(this.config.innerRadius=e,rt.setDefaultVia({net:null,holeRadius:e,radius:null})),this.config.userModifyViaSize=!0}this.initSketcherAttrPanel(this._wireMode)}modifyViaSize(e,r){this.setViaSize(e,r)}toggleViaSize(e){var i;let r=new ft;if(e[1]==="VIA_SIZE_RULESSETTING"){let n={activeTab:"Rule",activeMenu:"Via Size"};ie.publish("openMainDialog",{cmd:5,data:{option:n,tool:this}})}else if(e[1]==="VIA_SIZE_FOLLOWRULES"){let n=ce.pcbConfig.startViaSize=="rule"?"last":"rule";if(ce.pcbConfig.startViaSize=n,we.sizeFollowRule=ce.pcbConfig.startViaSize=="rule",ce.pcbConfig.startViaSize=="rule"){this.nextTool!=null&&this.nextTool.modifyViaSize();let s=te.getInstance().getRadiusPhysicsByNet(((i=this.event)==null?void 0:i.node.net)||"");this.setViaSize(s.defalutInner,s.defalutRadius)}}else if(e[1]=="VIA_SIZE_COMMONLY_SETTING")ie.publish("openSystemDialog","PCB_COMM_VIA_SIZE",$());else if(e[1]=="VIA_SIZE_INPUT")ie.publish("openMainDialog",{cmd:28,data:{tool:this}});else{let n=ce.viaConfig[e[1]].getSizeAccordingToUnit(),s=n.radius,a=n.innerRadius;this.setViaSize(a,s),rt.setDefaultVia({net:null,holeRadius:a,radius:s})}this.initSketcherAttrPanel(this._wireMode)}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"REGRESSION":this.backspace();break;case"PLACE_VIA":this.placeVia();break;case"PLACE_BURIEDHOLE":this.placeBlind(i[1]);break;case"REPLACE_LAYER":let n=parseInt(i[1].split("switchToLayer(")[1]);this.toggleLayer(n);break;case"WIRING_CORNER":this.wireCorner(i[1]),Hi();break;case"WIRING_MODE":this.wireMode(i[1]),Hi();break;case"WIRING_WIDTH":this.toggleWidth(i[1]),Hi();break;case"WIRING_WIDTH_COMMONLY_SSETTING":ie.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",$());break;case"VIA_SIZE":this.toggleViaSize(i),Hi();break;case"REMOVE_LOOP":pr.removeLoop=!pr.removeLoop,we.removeLoop=pr.removeLoop;break;case"toggleAdsorb":ie.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":ie.publish("openSystemDialog","ADSORPTION",$());break;case"VIA_SIZE_COMMONLY_SETTING":ie.publish("openSystemDialog","PCB_COMM_VIA_SIZE",$());break;case"SINGlE_ROUTE":this.toggleRouteMode();break;case"CHANGETRACK":this.toggleSingleRoute();break;case"CHANGECONTROLTRACK":this.changeControlRoute();break}ie.publish("updateFrame","")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:this.getMenu(e.adsorb).result};Qt.getInstance().menuData(r,this),this.drawing=!1}getWires(){let e=new Set;return this.event?(this._wireMode=="Single wiring"?e.add(this.event.node.net):this.event.tracks.forEach(r=>{e.add(r.net)}),Array.from(e)):[]}getShiftStartControl(){var e;return this._wireMode=="Single wiring"?(e=this.event)==null?void 0:e.node.start.point:null}getMenu(e){return bGe(e,this.event,this._wireMode=="Single wiring")}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,this.event!=null?r.filter=lg(this.event.node.width).result:r.filter=lg(we.prevTrackWidth).result,Qt.getInstance().menuData(r,this),this.drawing=!1}showCommonViaSizeMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=rF(this.config.innerRadius,this.config.radius).result,Qt.getInstance().menuData(r,this),this.drawing=!1}option1(e){switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}refresh(){this.onMouseMove(this.inputInfo)}getWireMode(){return this._wireMode}initSketcherAttrPanel(e,r=!1){let i=_F(e);ie.publish("FlushSketcherAttrView",{type:i,isInitAllParams:!0,switchTab:r})}};var al=class o{constructor(){this.tool=null;this.trackWidth=-1,this.asRuleMiniumSpacing=-1,this.viaRadius=-1,this.viaInnerRadius=-1,this.afterPlacingTheViaSwitch2Layer=[-1,-1],this.maximumRadius=100,this.pushViaOptimization="OPTIMIZA_OPEN",this.currentPathOptimization="OPTIMIZA_WEAK",this.pathOptimization=0,this.removeCircuitsContainingVias=!0,this.removeAntenna=!0,this.minimumTrackCorners=we.stretchTrackMinCorner,A.subscribe("updateMaximumRadius",this.setMaximumRadius.bind(this))}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}setTool(t){this.tool=t}get wireEvent(){var t;return(t=this.tool)==null?void 0:t.getEventStatus()}getStartTrackWidth(){return ce.pcbConfig.startTrackWidth}setStartTrackWidth(t){if(this.tool instanceof Vo)this.tool.toggleWidth("WIRING_WIDTH_FOLLOWRULES");else{if(t=="last"){let e=this.getTrackWidth(10).value;this.setTrackWidth(e)}ce.pcbConfig.startTrackWidth=t,we.widthFollowRule=ce.pcbConfig.startTrackWidth=="rule"}}getTrackWidth(t=1){let e=Ss.getInstance().wireMode=="Differential pair wiring",r,i,n=be.getActiveLayer();if(n.isCopperLayer()||(n=be.getTopLayer()),i=n.layerID,e?r=te.getInstance().getDifferentialPhysicsByNet("").getStrokeWidthDefault(i):r=te.getInstance().getTrackPhysicsByNet("").getDefaultWidth(i),this.tool instanceof Vo){let s=this.tool.getWireWidth();return s==null&&(s=ce.pcbConfig.startTrackWidth=="rule"?r:we.prevTrackWidth),{title:"Track Width",value:s*t}}else return{title:"Track Width",value:ce.pcbConfig.startTrackWidth=="rule"?r*t:we.prevTrackWidth*t}}getPanelTrackWidth(){if(this.tool instanceof Vo){let e=this.tool.getWireWidth();return e==null&&(e=ce.pcbConfig.startTrackWidth=="rule"?t():we.prevTrackWidth),e}return ce.pcbConfig.startTrackWidth=="rule"?t():we.prevTrackWidth;function t(){let e=be.getActiveLayer();e.isCopperLayer()||(e=be.getTopLayer());let r=e.layerID,i=Ss.getInstance().wireMode=="Differential pair wiring",n;return i?n=te.getInstance().getDifferentialPhysicsByNet("").getStrokeWidthDefault(r):n=te.getInstance().getTrackPhysicsByNet("").getDefaultWidth(r),n}}setTrackWidth(t){if(+t<=0)return;let e=bo(t/10);this.tool instanceof Vo?this.tool.setWireWidth(e):we.prevTrackWidth=e}getStartViaSize(){return ce.pcbConfig.startViaSize}setStartViaSize(t){if(this.tool instanceof Vo)this.tool.toggleViaSize(["VIA_SIZE","VIA_SIZE_FOLLOWRULES"]);else{if(t=="last"){let e=this.getViaOutsideDiameter().value,r=this.getViaInsideDiameter().value;this.setViaOutsideDiameter(e),this.setViaInsideDiameter(r)}ce.pcbConfig.startViaSize=t,we.sizeFollowRule=ce.pcbConfig.startViaSize=="rule"}}getViaOutsideDiameter(){let t=te.getInstance().getRadiusPhysicsByNet(""),e=ce.pcbConfig.startViaSize=="rule"?t.defalutRadius:rt.defaultVia.radius;if(this.tool instanceof Vo){let r=this.tool.getViaRadius().radius;return r&&(e=r),{title:"Via Outside Diameter",value:e*20}}else return{title:"Via Outside Diameter",value:e*20}}setViaOutsideDiameter(t){if(+t<=0)return;let e=t/20;e=bo(e*2)/2,this.tool instanceof Vo?this.tool.setViaSize(void 0,e):rt.setDefaultVia({net:null,holeRadius:null,radius:e})}getViaInsideDiameter(){let t=te.getInstance().getRadiusPhysicsByNet(""),e=ce.pcbConfig.startViaSize=="rule"?t.defalutInner:rt.defaultVia.innerRadius;if(this.tool instanceof Vo){let r=this.tool.getViaRadius().innerRadius;return r&&(e=r),{title:"Via Inside Diameter",value:e*20}}else return{title:"Via Inside Diameter",value:e*20}}setViaInsideDiameter(t){if(+t<=0)return;let e=t/20;e=bo(e*2)/2,this.tool instanceof Vo?this.tool.setViaSize(e,void 0):rt.setDefaultVia({net:null,holeRadius:e,radius:null})}getAfterPlacingTheViaSwitch2Layer(){let t=ce.pcbConfig.autoChangeLayerWhileRoutingVias,e=be.getActiveLayerID(),r=x.getInstance().doctype==bi.PCB&&be.getAllCopperLayer().length!==2&&ce.pcbConfig.autoChangeLayerWhileRoutingVias,i="",n=!1,s=[];if(t){s=be.getAllSignalLayer();let l=s.map(c=>c.layerId);if(n=!l.includes(e),!r||n)i="";else{let c=this.afterPlacingTheViaSwitch2Layer[0]!==-1&&this.afterPlacingTheViaSwitch2Layer[1]!==-1,[h,u]=this.afterPlacingTheViaSwitch2Layer||[],d=l.includes(u);c&&d&&e===h&&u?i=u:i=e===2?1:2}}let a=s.filter(l=>l.layerId!==e).map(l=>({value:l.layerId,text:l.name}));return{title:"switch2Layer",value:i,activeLayerId:e,options:a,visible:r,disabled:n}}setAfterPlacingTheViaSwitch2Layer(t){this.afterPlacingTheViaSwitch2Layer=t}getWiringCorner(){return tr.getInstance().type}setWiringCorner(t){this.tool instanceof Vo&&this.tool.wireCorner(t)}getMaximumRadius(){return this.maximumRadius}setMaximumRadius(t){t<0&&(t=0),this.maximumRadius=t,this.tool instanceof Vo&&this.wireEvent&&(this.tool.onMouseMove(Pi.getInstance()),this.tool.initSketcherAttrPanel(Ss.getInstance().wireMode))}getRoutingMode(){return tr.getInstance().mode}setRoutingMode(t,e=!1){this.tool instanceof Vo?this.tool.wireMode(t):(tr.getInstance().mode=t,we.synchronize()),e&&Hi()}getPushVia(){return this.pushViaOptimization}setPushVia(t,e=!1){this.pushViaOptimization=t,e&&Hi()}getPathOptimization4BePushed(){return this.pathOptimization}setPathOptimization4BePushed(t,e=!1){this.pathOptimization=t,e&&Hi()}getCurrentPathOptimization(){return this.currentPathOptimization}setCurrentPathOptimization(t,e=!1){this.currentPathOptimization=t,e&&Hi()}getRemoveCircuitsContainingVias(){return this.removeCircuitsContainingVias}getRemoveAntenna(){return this.removeAntenna}getRemoveLoop(){return{title:"Remove Loop",value:we.removeLoop,removeLoopOptions:[{value:we.removeLoop&&this.removeCircuitsContainingVias,text:"Remove Circuits Containing Vias"},{value:we.removeLoop&&this.removeAntenna,text:"Remove Antenna"}]}}setRemoveLoop(t,e,r=!1){if(!e)we.removeLoop=t;else switch(e){case"Remove Circuits Containing Vias":this.removeCircuitsContainingVias=t;break;case"Remove Antenna":this.removeAntenna=t;break}r&&Hi()}roundAndUniqueNumbers(t,e=!1){let r=new Set,i=t.map(n=>Math.round(n*1e3)/1e3);if(e){let n=i.filter(s=>r.has(s)?!1:(r.add(s),!0));if(n.length===1)return n}return i}increaseTracksGap(){if(this.tool instanceof Vo&&this.wireEvent){let t=this.tool.getTracksGap(),e=this.roundAndUniqueNumbers(t.map(n=>n.width*10)),r=this.wireEvent.isDiffGap(),i=e.map((n,s)=>r[s]?n:n+1);this.setTracksGap(i)}}decreaseTracksGap(){if(this.tool instanceof Vo&&this.wireEvent){let t=this.tool.getTracksGap(),e=this.roundAndUniqueNumbers(t.map(s=>s.width*10)),r=this.roundAndUniqueNumbers(this.getAsRuleMiniumSpacing()),i=this.wireEvent.isDiffGap(),n=e.map((s,a)=>{if(i[a])return s;let l=r[a];return s-1>=l?s-1:s});this.setTracksGap(n)}}setRuleMiniumSpacing(){if(this.tool instanceof Vo&&this.wireEvent){let t=this.getAsRuleMiniumSpacing();t=this.roundAndUniqueNumbers(t,!0),this.tool.setTracksGap(t.map(e=>e/10))}}getAsRuleMiniumSpacing(t){var e;if(this.tool instanceof Vo&&this.wireEvent){let r=new Array,i=t||this.wireEvent,n=new l3,s=i.tracks,a=te.getInstance();for(let l=0;l<s.length-1;l++){let c=n.isDiffPair(s[l].net,s[l+1].net),h=s[l].start,u=s[l+1].start,d=Ds(h.point,s[l].layerId,!0),p=Ds(u.point,s[l+1].layerId,!0),m=d.concat(p);QI(m);let g=fP(m,s[l].net,s[l+1].net,s[l].layerId);if(g==null)if(c){let y=n.getDiffPair(s[l].net);g=(e=a.getDifferentialPhysics(y.differentialPhysics))==null?void 0:e.getDifferentialPairSpacingDefault(s[l].layerId)}else g=te.getInstance().getSafeClearance({id:"",net:s[l].net,layerId:s[l].layerId,shapeType:0},{id:"",net:s[l+1].net,layerId:s[l+1].layerId,shapeType:0},s[l].layerId);r.push(g)}return r.map(l=>l*10)}}getTracksGap(){if(this.tool instanceof Vo&&this.wireEvent){let t=this.tool.getTracksGap();return this.roundAndUniqueNumbers(t.map(r=>r.width),!0).length!==1?"<...>":String(t[0].width*10)}else return"<...>"}setTracksGap(t){if(this.tool instanceof Vo&&this.wireEvent){let e=this.getAsRuleMiniumSpacing();if(e=this.roundAndUniqueNumbers(e,!0),e.some((i,n)=>t[n]<i)){A.publish("ui/toastMsg",{type:"warn",msg:"The set spacing is smaller than the minimum spacing specified by the design rules"},$()),this.tool.setTracksGap(e.map(i=>i/10));return}this.tool.setTracksGap(t.map(i=>i/10))}}getTrackMinCorner(){return parseInt(this.minimumTrackCorners.toString())}setTrackMinCorner(t,e=!1){t<0?t=0:t>1e3&&(t=1e3),this.minimumTrackCorners=parseInt(t.toString()),e&&Hi()}getHideCopper(){return!$t.getVisible(21)}setHideCopper(t,e=!1){$t.setVisible(21,!t),$t.flush(),e&&Hi()}getUnit(){return x.getInstance().unit}setUnit(t){FC(t)}getGridType(){return we.gridType}setGridType(t){we.gridType=t,A.messageBus.publish("switchGridType",t),A.publish("switchGridTypeBtn",t,$())}getBlodGridType(){return we.multiType}setBlodGridType(t){we.multiType=t,A.messageBus.publish("switchMultiGridType",t)}getBlodGridRatio(){return we.multiRatio}setBlodGridRatio(t){A.messageBus.publish("switchMultiGridRatio",t)}getGridSize(){let t=St.getInstance().getGridX()*10,e=St.getInstance().getGridY()*10;return t==e?String(t):`${t},${e}`}setGridSize(t,e){St.getInstance().setGridX(t/10),St.getInstance().setGridY(e/10),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),we.synchronize()}getSnapSize(){let t=St.getInstance().getSnapX()*10,e=St.getInstance().getSnapY()*10;return t==e?String(t):`${t},${e}`}setSnapSize(t,e){St.getInstance().setSnapX(t/10),St.getInstance().setSnapY(e/10),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}getSnap(){return{title:"Snap",value:we.adsorb}}setSnap(t,e=!1){e||A.publish("toggleAdsorb",t)}getAltSnapSize(){let t=x.getInstance().altGridSize,e=Xs.conversion1(t.GridX.unit,x.getInstance().unit,t.GridX.number),r=Xs.conversion1(t.GridY.unit,x.getInstance().unit,t.GridY.number);return e==r?String(e):`${e},${r}`}setAltSnapSize(t,e){let r={GridX:{number:t,unit:x.getInstance().unit},GridY:{number:e,unit:x.getInstance().unit}};x.getInstance().altGridSize=r}};function wp(){x.getInstance().compiler.uploadCanvas(or.getInstance().encode("CANVAS"))}var na=class o extends ZI{constructor(){super();this.tool=null;this.wiringRouterParams=al.getInstance(),this._isOpenedContextmenu=!1,this._hasSettingResult=!1}set(){return this}getTool(){return this.tool}setTool(e){this.wiringRouterParams.setTool(e)}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}get isOpenedContextmenu(){return this._isOpenedContextmenu}set isOpenedContextmenu(e){this._isOpenedContextmenu=e}get hasSettingResult(){return this._hasSettingResult}set hasSettingResult(e){this._hasSettingResult=e}get AfterPlacingTheViaSwitch2Layer(){return this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().value}get pushVia(){return this.wiringRouterParams.getPushVia()}get pathOptimization4BePushed(){return this.wiringRouterParams.getPathOptimization4BePushed()}get currentPathOptimization4BePushed(){return this.wiringRouterParams.getCurrentPathOptimization()}get removeLoop(){return this.wiringRouterParams.getRemoveLoop().value}get removeCircuitsContainingVias(){return this.wiringRouterParams.getRemoveCircuitsContainingVias()}get removeAntenna(){return this.wiringRouterParams.getRemoveAntenna()}get wiringTrackMinCorner(){return this.trackMinCorner*this.wiringRouterParams.getTrackWidth(10).value/10}get trackMinCorner(){return this.wiringRouterParams.getTrackMinCorner()}get viaOutsideDiameter(){return this.wiringRouterParams.getViaOutsideDiameter().value/10}get viaInsideDiameter(){return this.wiringRouterParams.getViaInsideDiameter().value/10}createHeader(e){let r=this.createBaseHeader();return r.id=e,r.action=e,r.tabId=x.getInstance().tabId,r}handleHeaderUpdate(e){}createBody(e){let r={};switch(e){case"SINGLE_WIRE":r=this.wirePanelDataAssemble("SINGLE_WIRE");break;case"DIFF_WIRE":r=this.wirePanelDataAssemble("DIFF_WIRE");break;case"MULTI_WIRE":r=this.wirePanelDataAssemble("MULTI_WIRE");break}return r}wirePanelDataAssemble(e){switch(e){case"SINGLE_WIRE":return{trackProperty:this.createProperty(),trackOptions:this.createOptions(),trackCanvas:this.createCanvas()};case"DIFF_WIRE":return{trackProperty:this.createProperty(),trackOptions:this.createOptions(),trackCanvas:this.createCanvas()};case"MULTI_WIRE":return{trackProperty:this.createMultiProperty(),trackOptions:this.createOptions(),trackCanvas:this.createCanvas()}}}handleBodyUpdate(e,r){let{trackProperty:i,trackOptions:n,trackCanvas:s}=r;switch(e){case"SINGLE_WIRE":this.updateProperty(i),this.updateOptions(n),this.updateCanvas(s);break;case"DIFF_WIRE":this.updateProperty(i),this.updateOptions(n),this.updateCanvas(s);break;case"MULTI_WIRE":this.updateMultiProperty(i),this.updateOptions(n),this.updateCanvas(s);break}A.publish("updateFrame","")}createProperty(){let e={};return e.startTrackWidth=this.wiringRouterParams.getStartTrackWidth(),e.trackWidth=this.wiringRouterParams.getTrackWidth(10),e.startViaSize=this.wiringRouterParams.getStartViaSize(),e.viaOutsideDiameter=this.wiringRouterParams.getViaOutsideDiameter(),e.viaInsideDiameter=this.wiringRouterParams.getViaInsideDiameter(),e.afterPlacingTheViaSwitch2Layer=this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer(),e}createMultiProperty(){let e={};return e.startTrackWidth=this.wiringRouterParams.getStartTrackWidth(),e.trackWidth=this.wiringRouterParams.getTrackWidth(10),e.tracksGap=this.wiringRouterParams.getTracksGap(),e.setAsRuleMiniumSpacing=this.wiringRouterParams.getAsRuleMiniumSpacing(),e.startViaSize=this.wiringRouterParams.getStartViaSize(),e.viaOutsideDiameter=this.wiringRouterParams.getViaOutsideDiameter(),e.viaInsideDiameter=this.wiringRouterParams.getViaInsideDiameter(),e.afterPlacingTheViaSwitch2Layer=this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer(),e}createOptions(){let e={};return e.routingCorner=this.wiringRouterParams.getWiringCorner(),e.maximumRadius=this.wiringRouterParams.getMaximumRadius(),e.routingMode=this.wiringRouterParams.getRoutingMode(),e.pushVia=this.wiringRouterParams.getPushVia(),e.pathOptimization4BePushed=this.wiringRouterParams.getPathOptimization4BePushed(),e.currentPathOptimization=this.wiringRouterParams.getCurrentPathOptimization(),e.removeLoop=this.wiringRouterParams.getRemoveLoop(),e.minimumTrackCorners=this.wiringRouterParams.getTrackMinCorner(),e.isHideCopperRegion=this.wiringRouterParams.getHideCopper(),e}createCanvas(){let e={};return e.unit=this.wiringRouterParams.getUnit(),e.gridType=this.wiringRouterParams.getGridType(),e.blodGridType=this.wiringRouterParams.getBlodGridType(),e.blodGridRatio=this.wiringRouterParams.getBlodGridRatio(),e.gridSize=this.wiringRouterParams.getGridSize(),e.snapSize=this.wiringRouterParams.getSnapSize(),e.snap=this.wiringRouterParams.getSnap(),e.altSnapSize=this.wiringRouterParams.getAltSnapSize(),e}isNeedUpdateAfterPlacingConfig(e,r){let i=n=>Array.isArray(n)&&n.length===2;if(i(e)&&i(r)){let[n,s]=e,[a,l]=r;return n!==a||s!==l}return!1}updateProperty(e){let{startTrackWidth:r,trackWidth:i,startViaSize:n,viaOutsideDiameter:s,viaInsideDiameter:a,afterPlacingTheViaSwitch2Layer:l}=e,c=this.wiringRouterParams.getStartTrackWidth(),h=this.wiringRouterParams.getTrackWidth(10).value,u=this.wiringRouterParams.getStartViaSize(),d=this.wiringRouterParams.getViaOutsideDiameter().value,p=this.wiringRouterParams.getViaInsideDiameter().value,m=[this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().activeLayerId,this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().value],g=!1;r!==c&&(g=!0,this.wiringRouterParams.setStartTrackWidth(r)),i.value!==h&&(g=!0,this.wiringRouterParams.setTrackWidth(i.value)),n!==u&&(g=!0,this.wiringRouterParams.setStartViaSize(n)),s.value!==d&&(g=!0,this.wiringRouterParams.setViaOutsideDiameter(s.value)),a.value!==p&&(g=!0,this.wiringRouterParams.setViaInsideDiameter(a.value)),this.isNeedUpdateAfterPlacingConfig(m,l.value)&&this.wiringRouterParams.setAfterPlacingTheViaSwitch2Layer(l.value),g&&Hi()}updateMultiProperty(e){let{startTrackWidth:r,trackWidth:i,setAsRuleMiniumSpacing:n,tracksGap:s,startViaSize:a,viaOutsideDiameter:l,viaInsideDiameter:c,afterPlacingTheViaSwitch2Layer:h}=e,u=this.wiringRouterParams.getStartTrackWidth(),d=this.wiringRouterParams.getTrackWidth(10).value,p=this.wiringRouterParams.getTracksGap(),m=this.wiringRouterParams.getStartViaSize(),g=this.wiringRouterParams.getViaOutsideDiameter().value,y=this.wiringRouterParams.getViaInsideDiameter().value,b=[this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().activeLayerId,this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().value],P=!1;r!==u&&(P=!0,this.wiringRouterParams.setStartTrackWidth(r)),i.value!==d&&(P=!0,this.wiringRouterParams.setTrackWidth(i.value));let T=s.split(",");T.length==1&&T[0]!=="<...>"?this.wiringRouterParams.setTracksGap([Number(s)]):Array.from(new Set(T))[0]!==p&&this.wiringRouterParams.setRuleMiniumSpacing(),a!==m&&(P=!0,this.wiringRouterParams.setStartViaSize(a)),l.value!==g&&(P=!0,this.wiringRouterParams.setViaOutsideDiameter(l.value)),c.value!==y&&(P=!0,this.wiringRouterParams.setViaInsideDiameter(c.value)),this.isNeedUpdateAfterPlacingConfig(b,h.value)&&this.wiringRouterParams.setAfterPlacingTheViaSwitch2Layer(h.value),P&&Hi()}updateOptions(e){let{routingCorner:r,maximumRadius:i,routingMode:n,pushVia:s,pathOptimization4BePushed:a,currentPathOptimization:l,removeLoop:c,minimumTrackCorners:h,isHideCopperRegion:u}=e,d=this.wiringRouterParams.getWiringCorner(),p=this.wiringRouterParams.getMaximumRadius(),m=this.wiringRouterParams.getRoutingMode(),g=this.wiringRouterParams.getPushVia(),y=this.wiringRouterParams.getPathOptimization4BePushed(),b=this.wiringRouterParams.getCurrentPathOptimization(),P=this.wiringRouterParams.getRemoveLoop().value,T=this.wiringRouterParams.getRemoveLoop().removeLoopOptions[0].value,I=this.wiringRouterParams.getRemoveLoop().removeLoopOptions[1].value,C=this.wiringRouterParams.getTrackMinCorner(),E=this.wiringRouterParams.getHideCopper(),O=!1;r!==d&&(O=!0,this.wiringRouterParams.setWiringCorner(r)),i!==p&&(O=!0,this.wiringRouterParams.setMaximumRadius(i)),n!==m&&(O=!0,this.wiringRouterParams.setRoutingMode(n)),s!==g&&(O=!0,this.wiringRouterParams.setPushVia(s)),a!==y&&(O=!0,this.wiringRouterParams.setPathOptimization4BePushed(a)),l!==b&&(O=!0,this.wiringRouterParams.setCurrentPathOptimization(l)),c.value!==P&&(O=!0,this.wiringRouterParams.setRemoveLoop(c.value)),c.removeLoopOptions[0].value!==T&&(O=!0,this.wiringRouterParams.setRemoveLoop(c.removeLoopOptions[0].value,"Remove Circuits Containing Vias")),c.removeLoopOptions[1].value!==I&&(O=!0,this.wiringRouterParams.setRemoveLoop(c.removeLoopOptions[1].value,"Remove Antenna")),h!==C&&(O=!0,this.wiringRouterParams.setTrackMinCorner(h)),u!==E&&(O=!0,this.wiringRouterParams.setHideCopper(u)),O&&Hi()}updateCanvas(e){let{unit:r,gridType:i,blodGridType:n,blodGridRatio:s,gridSize:a,snapSize:l,snap:c,altSnapSize:h}=e,u=this.wiringRouterParams.getUnit(),d=this.wiringRouterParams.getGridType(),p=this.wiringRouterParams.getBlodGridType(),m=this.wiringRouterParams.getBlodGridRatio(),g=String(this.wiringRouterParams.getGridSize()),y=String(this.wiringRouterParams.getSnapSize()),b=this.wiringRouterParams.getSnap().value,P=this.wiringRouterParams.getAltSnapSize(),T=!1;r!==u&&(T=!0,this.wiringRouterParams.setUnit(r)),i!==d&&(T=!0,this.wiringRouterParams.setGridType(i)),n!==p&&(T=!0,this.wiringRouterParams.setBlodGridType(n)),s!==m&&(T=!0,this.wiringRouterParams.setBlodGridRatio(s)),a!==g&&(T=!0,this.updateCanvasGirdSnap("attr-grid-size",a)),l!==y&&(T=!0,this.updateCanvasGirdSnap("attr-snap-size",l)),c.value!==b&&(T=!0,this.wiringRouterParams.setSnap(c.value)),h!==P&&(T=!0,this.updateCanvasGirdSnap("attr-alt-grid-size",h)),T&&wp()}updateCanvasGirdSnap(e,r){let i=r.toString().split(/,|，/),n,s;i.length==1?n=s=parseFloat(i[0]):i.length==2&&(n=parseFloat(i[0]),s=parseFloat(i[1])),!(isNaN(n)||isNaN(s))&&(e=="attr-grid-size"?this.wiringRouterParams.setGridSize(n,s):e=="attr-snap-size"?this.wiringRouterParams.setSnapSize(n,s):e=="attr-alt-grid-size"&&this.wiringRouterParams.setAltSnapSize(n,s))}};var mV=class extends Rn{getData(t,e){let r=na.getInstance();switch(t){case"startTrackWidthFollowLast":return e.trackWidthFollow=="last";case"lastTrackWidth":return xe(e.lastTrackWidth*10,4);case"startViaSizeFollowLast":return e.viaSizeFollow=="last";case"lastViaInnerDiameter":return xe(e.lastInnerRadius*20,4);case"lastViaDiameter":return xe(e.lastRadius*20,4);case"snap":return e.snap;case"routingMode":return jFe(e.routingMode);case"routingCorner":return tr.getInstance().getRoutingTypeByEnum(e.routingCorner);case"removeLoop":return e.removeLoop;case"rotatingObject":return e.rotatingObject=="single";case"trackFollow":return e.trackFollow=="moveKeep";case"stretchTrackMinCorner":return e.stretchTrackMinCorner;case"preferenceConfig":return e.preferenceConfig;case"realTimeUpdateUnusedLayers":return e.realTimeUpdateUnusedLayers;case"unusedPadRange":return qFe(e.unusedPadRange);case"pushVia":return KFe(r.pushVia);case"pathOptimization4BePushed":return JFe(r.pathOptimization4BePushed);case"currentPathOptimization4BePushed":return eVe(r.currentPathOptimization4BePushed);case"removeCircuitsContainingVias":return r.removeCircuitsContainingVias;case"removeAntenna":return r.removeAntenna}}};var tue=class extends nf{getData(t,e){let r=e.component;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Fa(e);case"layerId":return e.layerId;case"depth":return xe(r.slotDepth*10,4);case"strokeWidth":return xe(e.strokeWidth*10,4);case"path":return this.getShapeInfo(e);case"locked":return e.locked;case"zIndex":return e.zIndex;case"refs":return[r.lineId]}}};var fN=class fN{constructor(t){this.ignorePartitionId=!1;this.version=t,this.format=new Vg().getConfig(t)}static getInstance(){return fN.tool==null&&(fN.tool=new fN("2.0")),fN.tool}setIgnorePartitionId(t){this.ignorePartitionId=t}getEncode(t){switch(t){case"CANVAS":return new X8;case"LAYER":return new CR;case"LAYER_PHYS":return new xR;case"ACTIVE_LAYER":return new SR;case"NET":return new q8;case"PRIMITIVE":return new $8;case"GROUP":return new K8;case"VIA":return new $I;case"PAD":return new qE;case"LINE":return new JE;case"ARC":case"CARC":return new QE;case"POLY":return new e3;case"FILL":return new KI;case"FPC_FILL":return new YR;case"REGION":return new ER;case"PARTITION":return new jR;case"POUR":return new Z8;case"POURED":return new d3;case"INNER":return new t_;case"IMAGE":return new OR;case"OBJ":return new LR;case"TEARDROP":return new t3;case"FONT":return new KA;case"STRING":return new r3;case"ATTR":return new ST;case"DIMENSION":return new AR;case"DIMENSIONATTR":return new vR;case"COMPONENT":return new i3;case"PAD_NET":return new n3;case"RULE_TEMPLATE":return new zR;case"RULE":return new WR;case"RULE_SELECTOR":return new _R;case"EQLEN_GRP":return new NR;case"EQLEN":return new kR;case"SHELLCUT":return new tue;case"SHELL_ENTITY":return new MR;case"SHELL":return new RR;case"CREASE":return new DR;case"BOSS":return new wR;case"PANELIZE":return new J8;case"SILK_OPTS":return new Q8;case"PREFERENCE":return new mV;case"FONT":return new KA;case"INNER":return new t_;case"BOARD":return new fV}}feed(t,e){let r=t;r=="DIMENSIONATTR"&&(r="ATTR");let i=this.getItemFormat(r),n=this.getEncode(t),s={};for(let a of i)this.ignorePartitionId&&a=="partitionId"||(s[a]=this.getData(a,n,e));return s}getItemFormat(t){return this.format[t]}getData(t,e,r){return e.getData(t,r)}encode(t,e){return this.feed(t,e)}encodeProfile(t){switch(t.type){case"Board Outline":case"Line":return this.encode("POLY",t);case"Fill Region":case"Slot Region":return this.encode("FILL",t);case"Prohibited Region":case"Constraint Region":return this.encode("REGION",t);case"Copper Region":return this.encode("POUR",t);case"Partition":return this.encode("PARTITION",t);case"TearDrop":return this.encode("TEARDROP",t);case"FPC Stiffener":return this.encode("FPC_FILL",t);case"3D Shell - Outline":return this.encode("SHELL",t);case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return this.encode("SHELL_ENTITY",t);case"3D Shell - Side Datum Line":return this.encode("CREASE",t);case"3D Shell - Screw Pillar":return this.encode("BOSS",t);case"Board":return this.encode("BOARD",t)}return null}encodeComponent(t,e){if(!e)return;let r=this.feed(t,e),i=new Map,n=[],s=e.attributes,a=!0;for(let h of s)h.key=="Device"&&(a=!1),Cp(h,e)&&i.set(h.globalIndex,this.feed("ATTR",h));if(a)throw new Error("The device is missing device attributes, saving will lead to data loss, please contact the official customer service in time!");return e.getPads().forEach(h=>{n.push(this.feed("PAD_NET",h))}),e.getItems().filter(h=>h.modelType=="Via").forEach(h=>{n.push(this.feed("PAD_NET",h))}),{componentData:r,attrData:i,padNetData:n}}};fN.tool=null;var or=fN;var COe=new Map,GRt="The font was not found,has automatically switched to the browser's default font.",SOe=class{async getPath(t,e,r,i,n,s,a=!1,l=!1){typeof e!="string"&&(e="default");let c=Eb.getFontTemplate(t);if(c!=null&&Eb.isEqual(e,r,i,n,s,a,l,c)||(c=Eb.getFontCache(e,r,i,n,s,a,l),c!=null))return c.polylines;{if(r=="")return[];await this.hasFontFamily(e),A.publish("AwaitService",1);let h=a?"bold":"normal",u=l?"italic":"normal",d=r.split(`
`),p=new Array,m=0,g=0,y=0,b=i;for(let O=0,_=d.length;O<_;O++){let R=d[O];if(R.length==0){y=g,g+=b;continue}let v=(await A.windowBridge.rpcCall("/engine/extractFont",[R,{"font-family":e,"font-size":i,"font-weight":h,"font-style":u}],$())).message,D=v[0],w=v[1],F=v[2];b=F,m=Math.max(m,w),y=g,D.forEach(H=>{for(let z of H)for(let G=0,W=z.ys.length;G<W;G++)z.ys[G]-=y;p.push(H)}),g+=F}A.publish("AwaitService",-1);let P=new Array,T=p.length;for(let O=0;O<T;O++){let _=p[O],R=[];_.forEach(v=>{let D=v.xs.length,w=[];for(let H=0;H<D;H++){let z=new S(xe(v.xs[H],5),xe(v.ys[H],5));w.push(z)}let F=fe.build4(w);R.push(F)}),P=[].concat(P,R)}let I=Qe.translate(0,y);if(P=this.transform(P,I),n){let O=new ut(0,m,0,g),_=this.getReverse(O,s);m+=s*2,g+=s*2,P=P.map(v=>v.reverse()),P.push(_);let R=Qe.translate(s,s);P=this.transform(P,R)}P=vu(ef(P));let C=Eb.addFontCache(e,r,i,n,s,m,g,P,a,l),E=or.getInstance().encode("FONT",C);return x.getInstance().compiler.uploadFont(E),P}}async hasFontFamily(t){let e=!1;return COe.has(t)?e=COe.get(t):(e=await new FontFace(t,`local('${t}')`).load().then(i=>!0).catch(i=>!1),COe.set(t,e),e||A.publish("ui/toastMsg",{type:"info",msg:{text:GRt}},$())),e}transform(t,e){let r=new Array;for(let i of t){let n=i.multiply3(e);r.push(n)}return r}getReverse(t,e){return t=t.extendOfSize(e),fe.build4([t.LL(),t.LR(),t.UR(),t.UL(),t.LL()])}getSvg(t){let e="",r=new Set;for(let i=0;i<t.length;i++){let n=t[i],s="";Object.values(n).forEach(a=>{typeof a=="string"?r.add(a):typeof a=="number"&&(a=Math.round(a*1e4)/1e4),s=s+a+" "}),e=e+s+" "}return e}},Uje=new SOe;function rue(o){let t=o.getText();if(t==""||t==null)return o.updateTextOutlines([]),o.setTextBox(0,0),!0;let e=MA(o.globalIndex,o.fontFamily,t,o.fontSize,o.reverse,o.reverseExpansion,o.strokeWidth);return e!=null?(o.updateTextOutlines(e.path),o.setTextBox(e.width,e.height),!0):!1}var Gje=330;function URt(o,t){var h;let e=document.createElementNS("http://www.w3.org/2000/svg","svg"),r=document.createElementNS("http://www.w3.org/2000/svg","text");e.appendChild(r),r.textContent=o,r.style.whiteSpace="pre";let i=t,n=Number(i["font-size"]||"8");i["font-size"]=`${Gje}`,i["font-family"]=(h=i["font-family"])==null?void 0:h.split(",").map(u=>(u=u.trim(),u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'")?u:`"${u}"`)).join(",");for(let u in i)e.setAttribute(u,i[u]);document.body.appendChild(e);let s=e.getBBox();document.body.removeChild(e);let a=n/Gje,l=Math.ceil(s.width),c=Math.ceil(s.height);return{width:l*a,height:c*a}}function Hje(o,t,e,r,i,n,s,a=!1,l=!1){if(e==""||e==null)return{width:0,height:0};let c=MA(o,t,e,r,i,n,s);if(c!=null)return{width:c.width,height:c.height};{if(e=="")return{width:0,height:0};let h=a?"bold":"normal",u=l?"italic":"normal",d=e.split(`
`),p=0,m=0,g=0,y=r;for(let b=0,P=d.length;b<P;b++){let T=d[b];if(T.length==0){m+=y;continue}let I=URt(T,{"font-family":t,"font-size":r,"font-weight":h,"font-style":u}),C=I.width,E=I.height;y=E,p=Math.max(p,C),g=m,m+=E}return i&&(p+=n*2,m+=n*2),{width:p,height:m}}}var EOe=class{constructor(){this.list=new Set;this.timeout=null}addText(t){fm.ins.deleteFont(t.model),rue(t)||(this.list.add(t),this.timeout!=null&&(clearTimeout(this.timeout),this.timeout=null),this.timeout=setTimeout(async()=>{let r=new Set(this.list);this.list.clear(),await this.execute(r),this.timeout=null},0))}async execute(t){let e=new Array;this.promises=e;let r=new Set,i=new Set;for(let n of t)if(rue(n))r.add(n);else{let a=n.getText(),l=`${n.fontFamily}/${a}/${n.fontSize}/${n.reverse}/${n.reverseExpansion}/`;if(i.has(l))continue;i.add(l);let c=Uje.getPath(n.globalIndex,n.fontFamily,a,n.fontSize,n.reverse,n.reverseExpansion);e.push(c)}for(let n of r)t.delete(n);e.length>0&&await Promise.all(e);for(let n of t)rue(n);return t.clear(),this.promises=null,!0}async loadTextSuccess(){return this.promises&&await Promise.all(this.promises),!0}},vp=new EOe;var fr=class extends zs{constructor(e){super();this.textChange=!0;this.model=e,this.fixFontFamily(),this.textChange=!0,vp.addText(this),e.setModelWatcher(this),jo("editor/shape/PcbText")}get box(){return this.model.box}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId!=e&&(this.model.layerId=e,this.refreshRender())}set origin(e){this.model.origin!=e&&(this.model.origin=e,this.refreshRender())}get origin(){return this.model.origin}get mirror(){return this.model.mirror}set mirror(e){this.model.mirror!=e&&(this.model.mirror=e,this.refreshRender())}get rotation(){return this.model.rotation}set rotation(e){this.model.rotation!=e&&(this.model.rotation=e,this.refreshRender())}get key(){return this.model.key}set key(e){this.model.key!=e&&(this.model.key=e,this.textChange=!0,vp.addText(this))}get showKey(){return this.model.showKey}set showKey(e){this.model.showKey!=e&&(this.model.showKey=e,this.fixFontFamily(),this.textChange=!0,vp.addText(this))}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get value(){return this.model.value}set value(e){if(this.key==""&&e==""||this.model.value==e&&this.model.key!=="Name")return;this.model.value=e;let r=this.getParent();if(r!=null&&r instanceof Me)if(this.key=="Designator"&&r.name!=e)r.name=this.value;else if(this.key=="Name"){r.modifyATTRMap(this.key,e);let i=r.getFormulaName();this.model.value=i}else r.modifyATTRMap(this.key,e);this.fixFontFamily(),this.textChange=!0,vp.addText(this)}get showValue(){return this.model.showValue}set showValue(e){this.model.showValue!=e&&(this.model.showValue=e,this.fixFontFamily(),this.textChange=!0,vp.addText(this))}get position(){return this.model.position}set position(e){this.model.position.equals1(e)||(this.model.position=e,this.refreshRender())}set positionIsNull(e){this.model.positionIsNull=e}get positionIsNull(){return this.model.positionIsNull}get fontSize(){return this.model.fontSize}set fontSize(e){e=bo(e),this.model.type===0&&e<=this.strokeWidth&&(e=this.strokeWidth+e),this.model.fontSize!=e&&(this.model.fontSize!=e&&(this.model.fontSize=e),this.textChange=!0,vp.addText(this))}get textWidth(){return this.textChange&&this.updateCurrentBox(),this.model.box.width}get textHeight(){return this.textChange&&this.updateCurrentBox(),this.model.box.height}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){e>=this.fontSize&&(e=this.fontSize-.1),e=bo(e),this.model.strokeWidth!=e&&(this.model.strokeWidth=e,this.textChange=!0,vp.addText(this))}get fontFamily(){return this.model.fontFamily}set fontFamily(e){this.model.fontFamily!=e&&this.refreshFamily(e)}refreshFamily(e){let r=this.model,{key:i,value:n,showKey:s,showValue:a}=r,l=this.getTextValue(i,n,s,a),c=r.type,h=c,u=r.fontFamily;if(!Vy.everyCharHasDefaultFontPath(l)||!JB.everyCharHasDefaultFontPath(l)||e!=""&&!["default","default2","Serif","Sans Serif"].includes(e)?(h=1,u=aSe(e)):e==="default2"?(h=0,u=rt.defaultTextFamily[2]):e==="Serif"?(h=0,u=rt.defaultTextFamily[3]):e==="Sans Serif"?(h=0,u=rt.defaultTextFamily[4]):(h=0,u=rt.defaultTextFamily[0]),c!=h){let d=Do.remove(this,this.getType());r.type=h,d&&Do.attach(this,this.getType())}r.fontFamily=u,this.textChange=!0,vp.addText(this)}get reverse(){return this.model.reverse}set reverse(e){this.model.reverse!=e&&(this.model.reverse=e,this.textChange=!0,vp.addText(this))}get reverseExpansion(){return this.model.reverseExpansion}set reverseExpansion(e){this.model.reverseExpansion!=e&&(this.model.reverseExpansion=e,this.textChange=!0,vp.addText(this))}get path(){return this.model.outline}get matrix(){return this.model.matrix}get width(){return this.model.width}get height(){return this.model.height}get outlineModified(){return this.model.outlineModified}get hasHelpLine(){return this._helpLine&&this._helpLine.length>0||!1}updateCurrentBox(){let{globalIndex:e,fontFamily:r,fontSize:i,reverse:n,reverseExpansion:s,strokeWidth:a}=this,l=this.getText(),{width:c,height:h}=Hje(e,r,l,i,n,s,a);this.setTextBox(c,h)}fixFontFamily(){let e=LVe(this.getText(),this.model.fontFamily,this.model.type);this.model.fontFamily=e.fontFamily,this.model.type=e.type}getTextValue(e,r,i,n){let s="";return e!=""&&r===""&&x.getInstance().doctype!=3&&this.getParent()==null&&e!="Footprint"&&!we.footprintIsConnectDevice&&(r=`<${e}>`),i?n?s=e+":"+r:s=e:n?s=r:s="",s}removeHelpLine(){this._helpLine&&(this._helpLine.forEach(e=>{e.remove()}),this._helpLine.length=0)}createHelpLine(){let e=this.getParent();if(e!=null&&e instanceof Me&&this.key&&this.getText()!=""&&$t.getVisible(2)){this._helpLine||(this._helpLine=[]);let r=new hr(1002,e.position,this.position,!0);this._helpLine.push(r),this.createCross(this.position),this.createCross(e.position)}}createCross(e){let r=new S(2.5,0),i=new S(0,2.5),n=new hr(1002,e.add(r),e.sub(r),!0),s=new hr(1002,e.add(i),e.sub(i),!0);this._helpLine||(this._helpLine=[]),this._helpLine.push(n),this._helpLine.push(s)}getFontCache(){if(this.model.type==1){let e=Eb.getFontTemplate(this.globalIndex);return e==null&&(e=Eb.getFontCache(this.fontFamily,this.getText(),this.fontSize,this.reverse,this.reverseExpansion)),e}}getFlip(e){return!!ms(e)}setValue(e){this.model.value=e,this.fixFontFamily(),this.textChange=!0,vp.addText(this)}updateTextOutlines(e){this.model.outline=e,this.refreshRender()}setTextBox(e,r){this.model.updateBox4(e,r),this.textChange=!1}getText(){return this.getTextValue(this.model.key,this.model.value,this.model.showKey,this.model.showValue)}initVisible(){let e=$t.getElementFilterVisible(this);this.key!=""&&(e=$t.getVisible(2)),this.setDataState(0,e)}visible(e=!1){if(this.key!=""&&!$t.getVisible(2)){this.isVisible&&this.hidden();return}(this.key==""||this.key!=""&&$t.getVisible(2))&&(this.unHighLight(),this.removeHelpLine()),super.visible(e)}hidden(){this.removeHelpLine(),super.hidden()}click(e=!1,r=!1){this.isEmpty||this.key!=""&&!$t.getVisible(2)||((this.key==""||this.key!=""&&$t.getVisible(2))&&this.updateHelpLine(),this.key!=""?$t.getVisible(2)&&super.click(e,r):super.click(e,r))}updateHelpLine(){this.removeHelpLine(),this.createHelpLine()}deleteHelpLine(){this.removeHelpLine()}getType(){return this.model.type==0?21:6}getRenderData(){return this.textChange&&this.updateCurrentBox(),super.getRenderData()}getViewState(){return this.isEmpty?"Not Shown":!this.isVisible||this.model.getText()==""||!this.path||!this.path.length?"Not Shown":this.isHighLight?"Main And Highlight":"Only Main"}transform(e){this.model.transform(e),this.removeHelpLine(),this.refreshRender()}remove(){this.isEmpty||(this.getParent()==null?(this.textChange=!1,super.remove()):(this.isVisible=!1,this.model.showKey=!1,this.model.showValue=!1,this.textChange=!0,vp.addText(this),this.refreshRender()),this.removeHelpLine())}isSelect(e,r){return this.key==""&&this.getParent()!=null?!1:(this.textChange&&this.updateCurrentBox(),!!this.model.inShape(e,r))}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}getOffset(e){switch(e){case 3:return new S(0,0);case 2:return new S(0,.5);case 1:return new S(0,1);case 6:return new S(.5,0);case 5:return new S(.5,.5);case 4:return new S(.5,1);case 9:return new S(1,0);case 8:return new S(1,.5);case 7:return new S(1,1);default:return new S(0,0)}}getTextOutline(){this.textChange&&this.updateCurrentBox();let e=this.model.matrix,r=this.model.outline;return this.model.type==1?(r=r.map(i=>i.multiply3(e.toMatrix3())),r):r.map(i=>i.multiply3(e.toMatrix3()))}getRealOutline(){this.textChange&&this.updateCurrentBox();let e=this.model.matrix,r=this.model.outline;if(this.model.type==1){let i=HRt(this);return i.forEach(n=>{n.pl=n.pl.multiply3(e.toMatrix3())}),i}else return r.map(i=>i.multiply3(e.toMatrix3()))}getMathGraphics(e,r=0){return this.isEmpty?null:this.model.getMathGraphics(e,r)}buildBBox(){return this.isEmpty?null:(this.textChange&&this.updateCurrentBox(),this.model.buildBBox())}toJSON(){var i,n;let e=this.getFontCache();return{globalIndex:this.globalIndex,layerId:this.layerId,key:this.key,showKey:this.showKey,value:this.value,formulaName:(i=this.getParent())==null?void 0:i.attrsMapSource[this.key],showValue:this.showValue,fontFamily:this.fontFamily,fontSize:this.fontSize,rotation:this.rotation,locked:this.locked,position:this.position,origin:this.origin,strokeWidth:this.strokeWidth,reverse:this.reverse,reverseExpansion:this.reverseExpansion,silkColor:((n=this.silkColor)==null?void 0:n.toString())||null,mirror:this.mirror,font:e,positionIsNull:this.positionIsNull}}toJSON1(){var i;let e=this.getFontCache();return{globalIndex:this.globalIndex,layerId:this.layerId,key:"",showKey:!1,value:this.getText(),showValue:!0,fontFamily:this.fontFamily,fontSize:this.fontSize,rotation:this.rotation,locked:this.locked,position:this.position,origin:this.origin,strokeWidth:this.strokeWidth,reverse:this.reverse,reverseExpansion:this.reverseExpansion,silkColor:((i=this.silkColor)==null?void 0:i.toString())||null,mirror:this.mirror,font:e,positionIsNull:this.positionIsNull}}},iue=class extends fr{constructor(){super(...arguments);this._parent=void 0}};function HRt(o){let t=new Array,e=o.getText();if(e=="")return t;if(o.model.type==1){let r=o.getParent(),i=o.globalIndex;r!==null&&r instanceof Me&&(i.includes(r.globalIndex)||(i=r.globalIndex+i));let n=Eb.getFontTemplate(i);if(n!=null&&n.text==e){let s=n.polylines,a=new pm("",0,s);t=t.concat(a.pls)}else if(n=Eb.getFontCache(o.fontFamily,o.getText(),o.fontSize,o.reverse,o.reverseExpansion),n!=null){let s=n.polylines,a=new pm("",0,s);t=t.concat(a.pls)}}return t}var WRt=["Reuse Block","Add into BOM","Layer","Locked","Device","Footprint","3D Model","FootprintId","3D Model Transform","3D Model Title","ID"];function OOe(o,t,e){if(!AOe(o,t,e))return!1;let r=_Oe(e);return`={${r[0]}}`===e&&!WRt.includes(r[0])}function AOe(o,t,e){return!(o!==3||t!=="Name"||!e||!e.startsWith("="))}function _Oe(o){let t=/\{([^\}]+)\}/g,e=null,r=[];for(;e=t.exec(o);)r.push(e[1]);return r}function mN(o){let t=new _e,e=o.model.outline,r=o.model.matrix;for(let i of e)t.ext1(i.multiply3(r.toMatrix3()).bbox());return o.model.type==0&&t.ext7(o.strokeWidth/2),t.build1()}function Wje(o,t,e,r,i,n){return o?(zje(o,t,e,r),o.inShape(i,n)):!1}function zje(o,t,e,r){if(o)if(t==2){let n=Ae.getMatrix4(S.ORIGIN,(Math.PI-r)%yp,-1,e);o.transform(n)}else{let n=Ae.getMatrix4(S.ORIGIN,r,1,e);o.transform(n)}}function Yje(o,t,e,r,i,n){if(o){zje(o,t,e,r);let s=new Fs(o.getMathGraphics(),i,0);switch(n){case"inside":if(s.relation==2)return!0;break;case"contact":if(s.relation!=3)return!0;break}}return!1}var Me=class extends zs{constructor(e,r,i){super();this.pads=new Array(0);this.attrs={};this.others=new Array(0);this.model=i,i.setModelWatcher(this);for(let n of r)n instanceof Le?this.pads.push(n):this.others.push(n),n.setParent(this);for(let n of e)this.attrs[n.key]=n,n.setParent(this);A.publish("ComponentChanged",this),this.refreshRender(),jo("editor/shape/Component")}get attrsMap(){return this.model.attrsMap}get reuseBlock(){return this.model.reuseBlock}set reuseBlock(e){this.model.reuseBlock=e.trim()}get combinationID(){return this.model.combinationID}set combinationID(e){this.model.combinationID=e.trim()}get channelID(){return this.model.channelID}set channelID(e){this.model.channelID=e.trim()}get deviceUUID(){return this.model.deviceUUID}get footprintUUID(){return this.model.footprintUUID}set footprintUUID(e){this.model.footprintUUID=e}get numShape(){return this.attrs.Designator}set numShape(e){this.attrs.Designator=e,e.setParent(this)}get deviceShape(){return this.attrs.Device}set deviceShape(e){this.attrs.Device=e,e.setParent(this)}get idShape(){return this.attrs.Footprint}set idShape(e){this.attrs.Footprint=e,e.setParent(this)}get attributes(){return Array.from(Object.values(this.attrs))}get attrsObject(){return this.attrs}get attrKeyValue(){return this.model.attrKeyValue}get attrsMapSource(){return this.model.attrsMapSource}get attrKeyText(){return this.attrs}get locked(){return this.model.locked}set locked(e){this.model.locked=e}setNet(e,r,i){this.model.setNet(e,r,i)}getNet(e,r){return this.model.getNet(e,r)}deleteNet(e,r){this.model.deleteNet(e,r)}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId!=e&&(this.model.layerId=e,this.refreshRender()),A.publish("ComponentChanged",this)}get position(){return this.model.position}set position(e){e.x===this.position.x&&e.y===this.position.y||(this.model.position=e,this.refreshRender())}get name(){return this.model.name}set name(e){this.model.name!=e&&(this.modifyATTRMap("Designator",e),this.numShape.value=e)}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get footprintId(){return this.model.footprintId}set footprintId(e){this.idShape&&(this.idShape.value=e),this.modifyATTRMap("Footprint",e)}get device(){return this.model.device}set device(e){this.deviceShape.value=e,this.modifyATTRMap("Device",e);let r=ps.getItem(this.model.deviceUUID);if(r==null)throw new Error(`Device ${this.model.deviceUUID} loss!!!data error!!!`);r.add(this.model)}get designator(){return this.model.designator}get rotation(){return this.model.rotation}set rotation(e){this.model.rotation!=e&&(this.model.rotation=e,this.refreshRender()),this.model.rotation=e,A.publish("ComponentChanged",this)}set textOffset(e){this.model.textOffset=e}get textOffset(){return this.model.textOffset}get leftLow(){return this.model.box.leftLow}get leftUp(){return this.model.box.leftUp}get rightUp(){return this.model.box.rightUp}get rightLow(){return this.model.box.rightLow}getBoundFootprint(){return Wi.getInstance().getItem(this.footprintUUID)}getBasicLayerTable(){let r=this.model.getChildrenLayerIdSet(!0,!1);return this.getBoundFootprint().getBasicLayerTable(r)}getLayerIdReplacementTable(){return this.model.getLayerIdReplacementTable()}setLayerIdReplacementTable(e,r){let i=this.getLayerIdReplacementTable(),n=jy(i),s=jy(e);if(n&&s)return;let a=b4(i),l=b4(e),{less:c,more:h,same:u}=Fb(a,l),d=new Map;this.iterateAllChildren(p=>{Ug(d,p.layerId,[],!0).push(p)}),Rc(c,p=>{let m=i[p];if(!m)return;let g=parseInt(p),y=Ug(d,m);Rc(y,b=>{b.layerId=g})}),Rc(h,p=>{let m=e[p];if(!m)return;let g=parseInt(p),y=Ug(d,g);Rc(y,b=>{b.layerId=m})}),Rc(u,p=>{let m=i[p];if(!m)return;let g=e[p];if(!g||m==g)return;let y=Ug(d,m);Rc(y,b=>{b.layerId=g})}),r&&gm(e,p=>{fR(d,p)||delete e[p]}),this.model.setLayerIdReplacementTable(e,r,!0)}itemLayerIsOpened(e){let r=e.layerId;if(r){let i=be.getLayer(r);return i&&i.config}return!0}itemLayerIsOpenAndVisible(e){let r=e.layerId;if(r){let i=be.getLayer(r);return i&&i.config&&i.visible}return!0}iterateShapes(e){for(let r of this.pads)if(e(r))return!0;for(let r of this.others)if(e(r))return!0;return!1}generateValidId(){let e=this.getAllId(),r;for(;;){let i=cr();if(r=`${this.globalIndex}${i}`,!e.has(r))break}return r}getAllId(){let e=new Set;for(let r in this.attrs)e.add(this.attrs[r].globalIndex);return this.pads.forEach(r=>{e.add(r.globalIndex)}),this.others.forEach(r=>{e.add(r.globalIndex)}),e}getPads(){return this.pads}updatePads(e,r){r=="add"&&(this.pads.push(e),e.setParent(this)),r=="delete"&&(this.pads=this.pads.filter(i=>i!==e)),this.model.updatePads(e.model,r)}getVias(){let e=new Array;for(let r of this.others)r instanceof Ge&&e.push(r);return e}getItems(){let e=new Array;for(let r of this.pads)e.push(r);for(let r of this.others)e.push(r);return e}iterateItems(e){let r=Rc(this.pads,e);return r||Rc(this.others,e)}iterateAttrs(e){return gm(this.attrs,e)}iterateAllChildren(e){let r=this.iterateItems(e);return r||this.iterateAttrs(e)}getOutlines(){return this.others.filter(e=>e instanceof Ye&&e.layerId==11)}getTexts(){let e=new Array;for(let r of this.others)r instanceof fr&&e.push(r);for(let r in this.attrs)e.push(this.attrs[r]);return e}flip(e,r){this.model.flip(e,r),this.refreshRender(),A.publish("ComponentChanged",this)}addAttribute(e){this.attrs[e.key]=e;let r=/^=\{([^\}]+)\}/g;(e.key!=="Name"||e.key=="Name"&&!r.test(this.model.attrsMap[e.key]||""))&&this.modifyATTRMap(e.key,e.value),e.setParent(this),this.model.addAttribute(e.model),this.refreshRender(),A.publish("ComponentChanged",this)}removeAttribute(e){delete this.attrs[e.key],this.model.removeAttribute(e.model),e.setParent(void 0),e.remove(),ti.delete(e),A.publish("delete",e),A.publish("ComponentChanged",this)}getFormulaName(){return this.model.getFormulaName()}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}set manualHighLight(e){for(let r of this.pads)r.manualHighLight=e;for(let r of this.attributes)r.manualHighLight=e;for(let r of this.others)r.manualHighLight=e;super.manualHighLight=e}visible(e=!1){for(let r of this.pads)r.updateFilterVisible=!0,r.visible(),r.highlightByComponent=!1;for(let r of this.attributes)r.updateFilterVisible=!0,r.visible();for(let r of this.others)r.updateFilterVisible=!0,r.visible(),r instanceof Ye?r.fill():r instanceof Ge&&(r.highlightByComponent=!1);this.maskChildRender=!0,super.visible(e),this.maskChildRender=!1}hidden(){for(let e of this.pads)e.hidden(),e.highlightByComponent=!1;for(let e of this.attributes)e.hidden();for(let e of this.others)e.hidden(),e instanceof Ge&&(e.highlightByComponent=!1);this.maskChildRender=!0,super.hidden(),this.maskChildRender=!1}get maskChildRender(){return this.hasDataState(10)}set maskChildRender(e){this.setDataState(10,e)}click(e=!1,r=!1){var u;let i=(u=be.getLayer(this.layerId))==null?void 0:u.visible;if(!i){this.visible();return}let n=Ui.getInstance(),s=n.getItem(3).visible,a=n.getItem(9).visible,l=n.getItem(6).visible,c=n.getItem(5).visible,h=n.getItem(2).visible;this.maskChildRender=!0,super.click(e,r),this.maskChildRender=!1;for(let d of this.pads){if(!i||!c&&d.isTestPad||!d.isTestPad&&!l||!this.itemLayerIsOpenAndVisible(d)){d.unHighLight(),d.highlightByComponent=!1;continue}d.highlightByComponent=!0}for(let d of this.others){if(!i||!this.itemLayerIsOpenAndVisible(d)){d instanceof Ge&&(d.highlightByComponent=!1),(d instanceof ct||d instanceof Sr)&&(d.notShowFill=!0),d.unHighLight();continue}let p=!1;if((!s&&(d.model.layerId==3||d.model.layerId==4)||!a&&d instanceof Ge)&&(p=!0),p){d.unHighLight();continue}d instanceof Ge?d.highlightByComponent=!0:d.click(e,r)}for(let d of this.attributes){if(!i||!h||!this.itemLayerIsOpenAndVisible(d)){d.unHighLight();continue}d.click(e,r)}if(this.needUpdateBBox){let d=this.position,p=this.rotation,m=Ae.translate(-d.x,-d.y,0).rotateZ(-p),g=Ae.rotateZ(p).translate1(d.x,d.y,0);this.transform(m),this.updateComponentBBox(),this.transform(g),this.pads.forEach(y=>{let b=te.getInstance().getNet(y.net);if(b==null)throw new Error(`Net ${y.net} loss!!!`);y.iteratorRatlines(P=>{b.showRatline?P.visible():P.hidden()})}),this.needUpdateBBox=!1}}remove(){for(let e of this.pads)e.highlightByComponent=!1,e.remove(),A.publish("delete",e);this.pads.length=0;for(let e of this.attributes)e.setParent(void 0),e.remove(),A.publish("delete",e);this.attrs={};for(let e of this.others)e.setParent(void 0),e instanceof Ge&&(e.highlightByComponent=!1),e.remove(),A.publish("delete",e);this.others.length=0,this.model.remove(),super.remove(),A.publish("ComponentChanged",this),this.refreshRender()}updateComponentBBox(){let e=this.getItems(),r=[];for(let s of e)this.itemLayerIsOpened(s)&&!s.isEmpty&&r.push(s);let i=new _e;for(let s of r){let a=s.buildBBox();a!=null&&i.ext1(a)}let n=i.build1();this.model.box.leftLow=n.LL(),this.model.box.leftUp=n.UL(),this.model.box.rightLow=n.LR(),this.model.box.rightUp=n.UR()}transform(e){this.model.transform(e),A.publish("ComponentChanged",this),this.refreshRender(!0)}isSelect(e,r,i=!1){if(this.getParent()!=null)return!1;if(i){let n=this.getVisibleBBox(),s;return n&&(s=new vs(1,n.LL(),n.UL(),n.LR(),n.UR(),!1,n)),Wje(s,this.layerId,this.position,this.rotation,e,r)}return!!this.model.inShape(e,r)}isBoxSelect(e,r){let i=this.getVisibleBBox(),n;return i&&(n=new vs(1,i.LL(),i.UL(),i.LR(),i.UR(),!1,i)),Yje(n,this.layerId,this.position,this.rotation,e,r)}getVisibleBBox(){let e=Ji.getItem(this.footprintUUID),r=e==null?void 0:e.getLayeredBoxMap();if(r){let i,n=new _e;for(let s in r){let a;this.getLayerIsVisible(+s)&&(a=r[s],n.ext1(a))}if(n.valid())return i=n.build(),i}return null}getLayerIsVisible(e){let r=e;return this.layerId==2&&(r=Mg(e)),be.getLayer(r).visible}getAttrBBox(){let e=new _e,r=!1;for(let i in this.attrs){let n=this.attrs[i];if(n.showKey&&n.key!==""||n.showValue&&n.value!==""){r=!0;let s=n.buildBBox();s!=null&&e.ext1(s)}}if(r)return e.build1()}addATTRMap(e,r){this.model.addATTRMap(e,r)}modifyATTRMap(e,r){if(e=="Value"&&this.attrsMap[e]!=null&&this.attrsMap[e]!=r&&this.attrsMap["Supplier Part"]!=null&&this.attrsMap["Supplier Part"]!=""&&(A.publish("clearSupplierPart",{id:this.globalIndex,designator:this.designator,"Supplier Part":this.attrsMap["Supplier Part"]}),this.model.attrsMap["Supplier Part"]="",this.attrKeyText["Supplier Part"]!=null&&(this.attrKeyText["Supplier Part"].value="")),e=="Name"){if(this.model.attrsMap[e]==r)return;if(this.getFormulaName()==r)return}if(e=="Designator"&&this.model.name!=null&&r!=null){let i=Ji.getItem(this.model.footprintUUID);if(i==null)throw new Error(`Footprint loss:${this.model.footprintUUID}`);i.modifyName(this.model.name,r)}this.model.modifyATTRMap(e,r),this.attrs.Name!=null&&this.attrs.Name.value!=this.getFormulaName()&&(this.attrs.Name.value=this.getFormulaName()),A.publish("ComponentChanged",this)}deleteATTRMap(e){this.model.deleteATTRMap(e),A.publish("ComponentChanged",this)}clearMap(){this.model.clearMap()}getNewTextPosition(){return this.model.getNewTextPosition()}toJSON(){var g;let e=Ji.getItem(this.footprintUUID);e==null&&console.error(`Footprint loss:${this.model.footprintUUID}`);let r=e.uuid,i;if(e instanceof Xc){let y=Ji.getItem(e.source);y==null?console.error(`Custom Footprint Source loss:${e.source}`):(r=y.uuid,i=e.uuid)}let n=ps.getItem(this.model.deviceUUID),s;n!=null?s=n.uuid:console.error(`Device loss:${this.model.deviceUUID}`);let a=new Array,l=this.attributes;for(let y of l)a.push(y.toJSON());let c=this.getPads(),h=this.getVias(),u=[];for(let y=0;y<c.length;y++){let b=c[y];u.push({num:b.num,net:b.net,id:b.globalIndex.replace(this.globalIndex,""),padLen:as.getInstance().getPadLen(this.globalIndex,b.globalIndex)})}for(let y=0;y<h.length;y++){let b=h[y],P=b.getParent(),T;if(P!=null){let I=P.globalIndex,C=new RegExp(I);T=b.globalIndex.replace(C,"")}else T=b.globalIndex;u.push({num:T,net:b.net,id:T})}let d={},p=!1;for(let y of this.getPads())y.partition!=""&&(d[y.globalIndex]=y.partition,p=!0);for(let y of this.getVias())y.partition!=""&&(d[y.globalIndex]=y.partition,p=!0);let m={footprint:r,device:s,globalIndex:this.globalIndex,layerId:this.model.layerId,position:this.model.position,rotation:this.model.rotation,textOffset:this.model.textOffset,locked:this.model.locked,silkColor:((g=this.silkColor)==null?void 0:g.toString())||void 0,attrsMap:{...this.model.attrsMap},ATTR:a,pads:u};return p&&(m.childPartition=d),i!=null&&(m.custom=i),m}getMathGraphics(e=this.layerId,r=0){return this.model.getMathGraphics(e,r)}getFlip(e){return 2==e}modifyAttrPosition(e,r){if(!(e.showValue&&e.value||e.showKey&&e.key))return;let i=mN(e),n=this.buildBBox();if(n==null)throw new Error("this component was removed!!!");let s=n.LL(),a=n.LR(),l=n.UL(),c=n.UR();this.getFlip(this.model.layerId)&&(a=n.LL(),s=n.LR(),c=n.UL(),l=n.UR());let h=i.width()/2,u=i.height()/2,d=a.sub(s).normalize().mul(h),p=l.sub(s).normalize().mul(u),m;switch(r){case 3:m=s.sub(d).sub(p);break;case 2:m=s.add(l).mul(.5).sub(d);break;case 1:m=l.add(p).sub(d);break;case 6:m=s.add(a).mul(.5).sub(p);break;case 5:m=n.center();break;case 4:m=l.add(c).mul(.5).add(p);break;case 9:m=a.add(d).sub(p);break;case 8:m=a.add(c).mul(.5).add(d);break;case 7:m=c.add(d).add(p);break}let g=m.sub(i.center()),y=Ae.translate(g.x,g.y,0);e.transform(y)}refreshNameValue(){this.attrKeyText.Name!=null&&(this.attrKeyText.Name.value=this.getFormulaName())}resetAttr(e){e&&e.key!=""&&(e.showValue||e.showKey)&&e.positionIsNull&&(e.origin!=3&&(e.origin=3),e.position=this.getNewTextPosition(),e.positionIsNull=!1,e.key==="Name"&&(e.value=this.attrKeyValue.Name||""))}getType(){return 27}refreshRender(e=!1){if(this.maskChildRender){super.refreshRender();return}for(let i of this.pads)i.refreshRender();for(let i of this.others)e&&i instanceof Ye&&i.removeFill(),i.refreshRender();let r=this.isHighLight;for(let i in this.attrs){let n=this.attrs[i];r?n.updateHelpLine():n.deleteHelpLine(),n.refreshRender()}super.refreshRender()}buildBBox(){return this.model.buildBBox()}getPoints(){let{leftLow:e,leftUp:r,rightLow:i,rightUp:n}=this.model.box;return[e,e.add(r).mul(.5),r,r.add(n).mul(.5),n,n.add(i).mul(.5),i,i.add(e).mul(.5)]}getLines(){let{leftLow:e,leftUp:r,rightLow:i,rightUp:n}=this.model.box,s=[],a=new M(e,i),l=new M(i,n),c=new M(n,r),h=new M(r,e),u=new M(e.add(r).mul(.5),n.add(i).mul(.5)),d=new M(r.add(n).mul(.5),i.add(e).mul(.5));return s.push(a,l,c,h,u,d),s}getSilkLines(){let e=[];for(let r of this.others)r instanceof Ye&&[3,4].includes(r.layerId)&&e.push(r);return e}deleteItem(e){if(this.model.deleteModel(e.model),e instanceof Le){let r=this.pads.indexOf(e);r>=0&&this.pads.splice(r,1)}else if(e instanceof fr&&e.key!="")delete this.attrs[e.key];else{let r=this.others.indexOf(e);r>=0&&this.others.splice(r,1)}e.setParent(void 0)}addCompositionItem(e){this.model.addCompositionItem(e.model),e instanceof Ri||e instanceof fn?this.pads.push(e):this.others.push(e),e.setParent(this)}removeCompositionItemById(e){let r=-1,i=null,n=!1;for(let s=0;s<this.pads.length;s++)if(this.pads[s].globalIndex===e){n=!0,r=s,i=this.pads[s];break}if(r<=-1){n=!1;for(let s=0;s<this.others.length;s++)if(this.others[s].globalIndex===e){r=s,i=this.others[s];break}}return r<=-1?null:(n?this.pads.splice(r):this.others.splice(r),this.model.removeCompositionItemById(e,n),i)}};var KT=(i=>(i.TurnAround="turnAround",i.TurnUpsideDown="turnUpsideDown",i.TurnAroundByReferPoint="turnAroundByReferPoint",i.TurnUpsideDownByReferPoint="turnUpsideDownByReferPoint",i))(KT||{});var nue=class o{constructor(){this.hightIds=new Set;this.nets=new Set}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}itemHighlighted(t,e){let r=t;return!!(this.hightIds.has(r)||this.nets.has(e))}};var gN=class gN{constructor(){this.viewGroups=new Set}static getInstance(){return gN.manager==null&&(gN.manager=new gN),gN.manager}addViewGroup(t,e){this.mergeViewGroup(e,t,t.info),this.viewGroups.add(t)}removeViewGroup(t,e){let r=t.viewGroupId;this.viewGroups.has(t)&&(this.viewGroups.delete(t),this.deleteViewGroupIds(t,e,r))}mergeViewGroup(t,e,r){for(let i of t){let n=Object.assign({},r);for(let s of this.viewGroups)if(s!=e&&s.viewGroupId.has(i)){let a=s.info;for(let l in a){if(l=="highLightType"){n.highLightType==null&&(n.highLightType=a.highLightType);continue}n[l]=n[l]||a[l]}}Do.attachViewGroup(i,n)}}deleteViewGroupIds(t,e,r){this.mergeViewGroup(r,t,e)}};gN.manager=null;var uw=gN;var GG=class{constructor(t){this._viewGroupIds=new Set;this.info=t}get viewGroupId(){return this._viewGroupIds}addViewGroupId(t){for(let e of t)this._viewGroupIds.add(e)}deleteViewGroupId(t){for(let e of t)this._viewGroupIds.delete(e)}viewGroup(t){uw.getInstance().addViewGroup(this,t),this.addViewGroupId(t)}deleteViewGroup(t){uw.getInstance().deleteViewGroupIds(this,{visible:!0,doubleRgb:!1},t),this.deleteViewGroupId(t)}stash(){uw.getInstance().removeViewGroup(this,{visible:!0,doubleRgb:!1})}fresh(){this.restore()}restore(){uw.getInstance().addViewGroup(this,this._viewGroupIds)}clear(){uw.getInstance().removeViewGroup(this,{visible:!0,doubleRgb:!1}),this._viewGroupIds.clear()}};var UG=class{constructor(t,e){this.hightManage=nue.getInstance();this.tool=new er;this._viewGroup=e||new GG({visible:!0,isForceHighLight:!0,highLightType:0}),this.netGroupTool=t}get nets(){return this.hightManage.nets}get hightIds(){return this.hightManage.hightIds}get viewGroup(){return this._viewGroup}restore(){this.refresh()}stash(){this._viewGroup.stash()}refreshViewGroup(){this._viewGroup.fresh()}addHightId(t){return this.viewGroup.viewGroupId.has(t.viewGroupId)?!1:(this.hightIds.add(t.globalIndex),!0)}deleteHightId(t){if(!t)return!1;if(this.viewGroup.viewGroupId.has(t.viewGroupId)){let e=Bo(t);if(e!=null&&this.nets.has(e)){this.nets.delete(e);let r=this.netGroupTool;this.viewGroup.deleteViewGroup(r.getGroupIdByNets(new Set([e])));let i=r.filterItemsByNets(new Set([e]));for(let n of i)this.addHightId(n)}}return this.hightIds.delete(t.globalIndex),!0}addHightByNet(t){for(let r of t)this.nets.add(r);let e=this.netGroupTool.getGroupIdByNets(new Set(t));this._viewGroup.viewGroup(e),Jb.getInstance().setHighlight(t,!0)}deleteHightByNet(t){for(let r of t)this.nets.delete(r);let e=this.netGroupTool.getGroupIdByNets(new Set(t));this._viewGroup.deleteViewGroup(e),Jb.getInstance().setHighlight(t,!1)}refresh(){this.refreshHightIds(),this.refreshViewGroup()}itemHighlighted(t){let e=this.getItem(t);return e?this.itemHighlightedByItem(e):!1}itemHighlightedByItem(t){let e=t.globalIndex;if(this.hightIds.has(e))return!0;let r=this.netGroupTool.getGroupIds([t]);return!!(t!=null&&r.length>0&&this._viewGroup.viewGroupId.has(r[0]))}getItem(t){let e=this.tool.getItem(t);return e!=null?e:zo.getRatlineById(t)}replaceTool(t){let e=this.netGroupTool.getGroupIdByNets(t.nets);this._viewGroup.addViewGroupId(e),t.stash(),this.refresh()}clear(){Jb.getInstance().setHighlight(this.nets,!1),this.hightIds.clear(),this.nets.clear(),this._viewGroup.clear()}hasHightItem(){return this.hightIds.size!=0||this._viewGroup.viewGroupId.size!=0}};var f$=class{getGroupIds(t,e){let r=[];return t.forEach(i=>{if(i.isEmpty||e&&e(i))return;let n=i.viewGroupId;this.addSpecialGroupId(i,r),!(!n||r.includes(n))&&(i instanceof Ge?r.push(n,i.holeViewGroupId):(i instanceof Ue||i instanceof Le||i instanceof nr||i instanceof Sr||i instanceof ct||i instanceof _n||i instanceof ii)&&r.push(n))}),r}addSpecialGroupId(t,e){}getGroupIdByNet(t){return["Track"+t,"ArcTrack"+t,"Pad"+t+"_mask","Via"+t+"_mask","Rect"+t,"Circle"+t,"Polygon"+t,"Ratline"+t,"Copper"+t]}getGroupIdByNets(t){let e=[],r;for(let i of t){r=this.getGroupIdByNet(i);for(let n of r)e.push(n)}return e}filterItemsByNets(t){let e=[];return t.forEach(r=>{let i=ze.getItem(r)||ze.getNoneNetsItem(r);i!=null&&i.forEach(s=>{this.isNeedNet(s)&&e.push(s)});let n=zo.getRatlineByNetName(r);for(let s of n)e.push(s)}),e}isNeedNet(t){return t instanceof Ye&&t.type=="Copper Region"||t instanceof Ki?!1:t instanceof Ge||t instanceof Le?!0:be.getLayer(t.layerId).isSignalLayer()?!(t instanceof fr||t instanceof Yn||this.isLine2DTypeNoNetWork(t)||t instanceof ca):!1}isLine2DTypeNoNetWork(t){let e=!1;if(t instanceof Ye)switch(t.type){case"Board Outline":case"Slot Region":case"Prohibited Region":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Datum Line":e=!0;break}return e}},HG=class extends f${addSpecialGroupId(t,e){(t instanceof Le||t instanceof Ge)&&e.push(t.wireViewGroupId)}getGroupIdByNet(t){return["Track"+t,"ArcTrack"+t,"Pad"+t+"_mask","Pad"+t+"_mask_W","Via"+t+"_mask_W","Via"+t+"_mask","Via"+t+"_mask_hole","Rect"+t,"Circle"+t,"Polygon"+t,"Ratline"+t,"Copper"+t]}};var vOe=class extends UG{constructor(){super(new HG)}addHightId(t){return super.addHightId(t)&&(t.manualHighLight=!0,this.updateForceDeactive()),!0}updateForceDeactive(t=!0){be.forceDeactive(t)}deleteHightId(t){return super.deleteHightId(t)&&(t.manualHighLight=!1),this.hasHightItem()||this.updateForceDeactive(!1),!0}addHightByNet(t){super.addHightByNet(t),this.updateForceDeactive()}deleteHightByNet(t){super.deleteHightByNet(t),this.hasHightItem()||this.updateForceDeactive(!1)}stash(){be.forceDeactive(!1),this.hightIds.forEach(t=>{let e=this.getItem(t);!e||e.isEmpty||(e.manualHighLight=!1)}),super.stash()}removeAllHighLight(){this.hightIds.forEach(t=>{let e=this.getItem(t);e&&!e.isEmpty&&(e.manualHighLight=!1)}),this.clear()}refresh(){super.refresh(),this.hasHightItem()?this.updateForceDeactive():this.clear()}refreshHightIds(){let t=this.hightIds;for(let e of t){let r=this.getItem(e);!r||r.isEmpty?this.hightIds.delete(e):r.manualHighLight=!0}}clear(){super.clear(),be.forceDeactive(!1)}},xOe=new vOe;var ROe=class extends UG{constructor(){super(new f$);this.isHover=!0}addHightId(e){return super.addHightId(e)&&e.isVisible&&(e.manualHighLight=!0,e.click(this.isHover&&!e.highLightBySelect)),!0}deleteHightId(e){if(super.deleteHightId(e)){let r=new Set(Ve.getSelects()),i=e.globalIndex;this.hightIds.delete(i),e.manualHighLight=!1,r.has(e)||(e.updateFilterVisible=!0,e.visible())}return!0}stash(){let e=new Set(Ve.getSelects());this.hightIds.forEach(r=>{let i=this.getItem(r);!i||i.isEmpty||(i.manualHighLight=!1,e.has(i)||(i.updateFilterVisible=!0,i.visible()))}),super.stash()}refreshHightIds(){let e=this.hightIds;for(let r of e){let i=this.getItem(r);!i||i.isEmpty?this.hightIds.delete(r):(i.manualHighLight=!0,i.click(this.isHover&&!i.highLightBySelect))}}removeAllHighLight(){let e=new Set(Ve.getSelects());for(let r of this.hightIds){let i=this.getItem(r);i!=null&&!i.isEmpty&&(i.manualHighLight=!1,e.has(i)||(i.updateFilterVisible=!0,i.visible()))}this.clear()}},jje=new ROe;var A9=class o{constructor(){this.highlightUnselectIds=new Set;this.tool=new er;this.highLightTool=xOe;this.colorDarkened=!0}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}get isDarked(){return this.colorDarkened}addHightItem(t){this.addItem(t)}toggleHighLightNetsLoop(t){let e=!0,r=this.highLightTool.nets;for(let i of t)r.has(i)||(e=!1);e?this.unhighLightNets(t):this.highLightNets(t)}changeLightShow(t){let{isDark:e,force:r}=t;if(r!=x.getInstance().forceVisibleHighLightPt&&(x.getInstance().forceVisibleHighLightPt=r),e!=x.getInstance().highLightModeIsDark&&x.getInstance().setHighLightMode(e),e!=this.colorDarkened){if(e!=this.colorDarkened){let i=this.highLightTool;e?this.highLightTool=xOe:this.highLightTool=jje,this.highLightTool.replaceTool(i)}this.colorDarkened=e}}highLightNets(t){this.highLightTool.addHightByNet(t)}unhighLightNets(t){this.highLightTool.deleteHightByNet(t),t.clear()}addItem(t){t!=null&&!t.isEmpty&&(t.updateFilterVisible=!0,this.highLightTool.addHightId(t))}highLight(){this.highLightTool.refresh()}unhighLight(t){if(t==null){this.highLightTool.removeAllHighLight();return}t.forEach(e=>{let r=this.getItem(e);this.highLightTool.deleteHightId(r)}),t.clear()}highlightUnselect(t){this.highlightUnselectIds=t,t.forEach(e=>{let r=this.getItem(e);r!=null&&!r.isEmpty&&r.click()})}cancelHighlightUnselect(){this.highlightUnselectIds.forEach(t=>{let e=this.getItem(t);e!=null&&!e.isEmpty&&(e.updateFilterVisible=!0,e.visible())}),this.highlightUnselectIds.clear()}unhighLightDevice(t){t.forEach(e=>{let r=this.getItem(e);r!=null&&!r.isEmpty&&this.highLightTool.deleteHightId(r)}),t.clear()}unhighLigthAll(){this.unhighLight()}refreshHighLigth(){this.highLight()}isItemHighlighted(t){return this.highLightTool.itemHighlighted(t)}isItemHighlightedByItem(t){return this.highLightTool.itemHighlightedByItem(t)}getAllHighLightNets(){return this.highLightTool.nets}stash(){this.highLightTool.stash()}restore(){this.highLightTool.restore()}getItem(t){let e=this.tool.getItem(t);return e!=null?e:zo.getRatlineById(t)}};var dw=class{constructor(t){this.all=new Set;this.result=new Set;this.hasPad1=!1;this.hasPad2=!1;this.item=t,this.find()}find(){if(this.item instanceof Ue){this.findPath4Track(this.item);return}if(this.item instanceof Le)this.hasPad1=!0;else if(this.isEnd(this.item))return;this.all.add(this.item);let t=this.getItems(this.item);this.getRatlinesNodes(this.item,t);let e=this.getPad(t);e!=null&&(t=this.filter(t,e),this.addPad(e),this.hasPad2||(e=this.getPad(t),e!=null&&(t=this.filter(t,e),this.addPad(e)))),t.forEach(r=>{let i=this.findPath(r);i&&(this.hasPad1?this.hasPad2=i:this.hasPad1=i)}),this.hasPad1&&this.hasPad2?this.result.add(this.item):this.result.clear()}findPath4Track(t){if(this.isEnd(t))return;this.all.add(t);let r=this.getItems(t),i=new Set,n=new Set;t.iteratorRatlines(l=>{let c=this.getRatlineStartNode(l,t),h=this.getRatlineEndNode(l,t);c!=null&&(l.end.equals1(t.start)?i.add(c):n.add(c),this.all.add(c)),h!=null&&(l.start.equals1(t.start)?i.add(h):n.add(h),this.all.add(h))});for(let l of r)if(l instanceof Ue){let c=l.start.distance2(t.start),h=l.end.distance2(t.start),u=l.start.distance2(t.end),d=l.end.distance2(t.end);Math.min(c,h)<Math.min(u,d)?i.add(l):n.add(l)}else{let c=l.center.distance2(t.start),h=l.center.distance2(t.end);c<h?i.add(l):n.add(l)}let s=this.getPad(i);s!=null&&(i=this.filter(i,s),this.result.add(s),this.hasPad1=!0);let a=this.getPad(n);a!=null&&(n=this.filter(n,a),this.result.add(a),this.hasPad2=!0),i.forEach(l=>{this.findPath(l)&&(this.hasPad1=!0)}),n.forEach(l=>{this.findPath(l)&&(this.hasPad2=!0)}),this.hasPad1&&this.hasPad2?this.result.add(this.item):this.result.clear()}getRatlinesNodes(t,e){t.iteratorRatlines(r=>{let i=this.getRatlineStartNode(r,t),n=this.getRatlineEndNode(r,t);i!=null&&(e.add(i),this.all.add(i)),n!=null&&(e.add(n),this.all.add(n))})}getRatlineStartNode(t,e){return t.startNode!=e&&(t.startNode instanceof Ue||t.startNode instanceof Le||t.startNode instanceof Ge)&&!this.all.has(t.startNode)?t.startNode:null}getRatlineEndNode(t,e){return t.endNode!=e&&(t.endNode instanceof Ue||t.endNode instanceof Le||t.endNode instanceof Ge)&&!this.all.has(t.endNode)?t.endNode:null}getItems(t){let e=t.searchCycleNode(),r=this.filterItems(e);return r.size==0&&(e=t.searchNode(),r=this.filterItems(e)),r}filterItems(t){let e=new Set,r=new Set;for(let i of t)if(i instanceof Ge){let n=i.searchNode();for(let s of n)s instanceof Ue&&(j4.isEnd(s,s.start)||j4.isEnd(s,s.end))&&r.add(s)}return t.forEach(i=>{if(i!=this.item&&(i instanceof Ue||i instanceof Le||i instanceof Ge)&&!this.all.has(i)){if(i instanceof Ue&&r.has(i))return;e.add(i),this.all.add(i)}}),e}addPad(t){this.result.add(t),this.hasPad1?this.hasPad2=!0:this.hasPad1=!0}getPad(t){for(let e of t)if(e instanceof Le&&!e.isTestPad)return e;return null}filter(t,e){if(e==null)return t;{let r=new Set;return t.forEach(i=>{i.isSelect(e.center.x,e.center.y)||r.add(i)}),r}}findPath(t){if(this.isEnd(t))return t instanceof Le?(this.result.add(t),!0):!1;{let r=this.getItems(t);if(this.getRatlinesNodes(t,r),r.size==0)return!1;{let i=!1;if(r.forEach(n=>{n instanceof Le&&!n.isTestPad&&(i=!0,this.result.add(t),this.result.add(n))}),i)return i;{let n=!1;return r.forEach(s=>{this.findPath(s)&&(n=!0)}),n&&this.result.add(t),n}}}}isEnd(t){return t instanceof Ue?this.checkTrackIsEnd(t):t instanceof Le?!0:t instanceof Ge?!(this.getConnects(t).size>1):!0}getConnects(t){let e=t.searchNode(),r=new Set;return e.forEach(i=>{i!=t&&(i instanceof Ue||i instanceof Le||i instanceof Ge)&&r.add(i)}),t.iteratorRatlines(i=>{i.startNode!=t&&(i.startNode instanceof Ue||i.startNode instanceof Le||i.startNode instanceof Ge)&&r.add(i.startNode),i.endNode!=t&&(i.endNode instanceof Ue||i.endNode instanceof Le||i.endNode instanceof Ge)&&r.add(i.endNode)}),r}checkTrackIsEnd(t){let e=t.searchNode(),r=!1,i=!1;for(let n of e)if(n!=t&&(n instanceof Ue||n instanceof Le||n instanceof Ge)&&(n.isSelect(t.start.x,t.start.y)&&(r=!0),n.isSelect(t.end.x,t.end.y)&&(i=!0)),r&&i)return!1;return t.iteratorRatlines(n=>{if(n.startNode!=t&&(n.startNode instanceof Ue||n.startNode instanceof Le||n.startNode instanceof Ge)&&(n.end.sub(t.start).length()<1e-8?r=!0:i=!0),n.endNode!=t&&(n.endNode instanceof Ue||n.endNode instanceof Le||n.endNode instanceof Ge)&&(n.start.sub(t.start).length()<1e-8?r=!0:i=!0),r&&i)return!1}),!0}};function Xf(o=!1){let t=new Jt;return t.add("MOVE_BY_CENTER_POINT"),o&&t.add("MOVE_BY_ORIGIN_POINT"),t.add("MOVE_BY_REFERENCE_POINT"),t}function Bm(){let o=new Jt;return o.add("HIGHLIGHT_NET"),o.add("HIGHLIGHT_COMPONENT"),o.add("HIGHLIGHT_SELECTED_OBJECTS",!0),o.add("HIGHLIGHT_CANCEL_NET"),o.add("HIGHLIGHT_CANCEL_COMPONENT"),o.add("HIGHLIGHT_CANCEL_SELECTED_OBJECTS"),o.add("HIGHLIGHT_CANCELALL",!0),o}function yg(){let o=new Jt;return o.add("OFFSET_ABSOLUTE"),o.add("OFFSET_RELATIVE"),o}function i1(){let o=new Jt;return o.add("rotate_left"),o.add("rotate_right"),o.add("rotate_reference_point"),o}function h2(){let o=new Jt;return o.add("DUPLICATE_TO_CURSOR"),o.add("DUPLICATE_TO_OTHER_LAYER"),o}function Ob(o=!0){let t=new Jt;return t.add("FLIP_LEFTANDRIGHT"),t.add("FLIP_UPANDDOWN"),o&&(t.add("FLIP_LEFTANDRIGHT_BY_REFER_POINT"),t.add("FLIP_UPANDDOWN_BY_REFER_POINT")),t}function oy(){let o=new Jt,t=Ve.getSelects();Ve.getSelectedGroups().length>0&&(o.add("COMBINATION_MOVE_OUT"),o.add("COMBINATION_CANCEL")),t.length>0&&o.add("COMBINATION_SELECT");let r=kt.getAllGroupId().length>0,i=t.some(n=>n.getGroupID()==null);return r&&i&&o.add("COMBINATION_JOIN"),Ve.getComponents().length>0&&o.add("REUSE_LAYOUT_ROUTE"),o}function oue(o){let t=new Jt,e=Ve.getSelects();return t.add("ADDWITH_TRACK"),t.add("ADDWITH_VIA"),!o&&t.add("ADDWITH_TESTPOINTER"),t.add("ADDVIA_FENCE"),t.add("ADDWITH_TEARS"),t}function K3(){let o=new Jt,e=Ve.getItems().reduce((n,s)=>((s instanceof Ue||s instanceof Le||s instanceof Ge||s instanceof _n)&&s.net&&n.add(s.net),n),new Set);if(o.add("NET_COLOR",e.size>0),!e.size)return o;let r=[...e].map(n=>te.getInstance().getNet(n));return r.some(n=>!n.netClass)&&(o.add("new-net-class"),te.getInstance().getAllNetClass().size&&o.add("join-net-class")),r.some(n=>n.netClass)&&o.add("remove-from_net-class",!0),r.some(n=>!n.equalLengthGroup)&&(o.add("new-equal-length-group"),te.getInstance().getAllEqualLengthGroups().size&&o.add("join-equal-length-group")),r.some(n=>n.equalLengthGroup)&&o.add("remove-from_equal-length-group",!0),r.length==2&&r.every(n=>!n.netDifferential)&&o.add("new-differentialPair"),r.some(n=>n.netDifferential?n.netDifferential.getAllNets().every(s=>r.includes(s)):!1)&&o.add("delete-differentialPair"),o}function Fm(){let o=new Jt;return o.add("selectedBSSaveAsCloud"),o.add("selectedBSSaveAsLocal"),o}function m$(){let o=Ve.getItems(),t=[];for(let e of o)(e instanceof Ye&&Cs.getValidProfile(e.type)||e instanceof Ue)&&t.push(e);zRt.generateBoard(t),A.publish("updateFrame","")}function WG(){Cs.getInstance().board&&A.publish("openMainDialog",{cmd:49})}function Xje(){let o=Ve.getItems();for(let t of o)if(t instanceof Ye&&Cs.getValidProfile(t.type)||t instanceof Ue)return!0;return!1}var DOe=class{collectValidItem(t){let e=Cs.getInstance();if(e.autoGenerate){for(let r of t)if(r instanceof Ye&&Cs.getValidProfile(r.type)&&(e.outlineCollect.delete(r.globalIndex),r.layerId==11&&!r.isEmpty)){let i=[],n;if(r.model.modelType=="Polygon")n=this.getProfile(r,i);else return this.addRectOrCircleToBoard(r.model,!1);if(!n){e.outlineCollect.set(r.globalIndex,i);let s=[],a=e.outlineCollect.values();for(let c of a)for(let h of c)s.push(h);e.bbox.ext1(r.bbox());let l=e.bbox.build1().extendOfSize(2);n=this.checkIsClosed(s,l)}if(n){this.addPolyToBoard(n,!1);break}}}}getProfile(t,e){let r,i=t.getMathGraphics();if(i instanceof Gt?r=i[0]:r=i,pd(t.type)||r.isClose())return r;let n=r.primitives;for(let s of n)e.push(s);return null}checkIsClosed(t,e){var a;if(t.length<=1)return null;let r=new oh(e,2,.1,new Gi(1),t),i=e.extendOfSize(e.width()),s=(a=r.detect2().items[0])==null?void 0:a.items[0];return s.bbox().width()>=i.width()&&(s=null),s}generateBoard(t){if(t&&t.length>0){let e,r=new Map,i,n=new _e;for(let l of t){if(e)break;if(i=r.get(l.layerId),i||(i=[],r.set(l.layerId,i)),l instanceof Ye)if(l.model.modelType=="Polygon")e=this.getProfile(l,i);else return this.addRectOrCircleToBoard(l.model);else i.push(l.primitive);n.ext1(l.bbox())}if(e){this.addPolyToBoard(e);return}let s=n.build1().extendOfSize(2);for(let[,l]of r)if(e=this.checkIsClosed(l,s),e)break;if(e){this.addPolyToBoard(e);return}let a=new _0("The selected shape is not closed,Should the automatically closed shape be converted to a board shape?",()=>{let l,c=t[0];if(c instanceof Ue)l=c.getMathGraphics(c.layerId);else{let h=nC(c.getEdgePolylines());for(let u of h)if(u.isClose()){l=u;break}}this.addPolyToBoard(l)});A.publish("openMsgbox",a)}}addPolyToBoard(t,e=!0){if(t){let r="Polygon",i=e?new ve("board"):je.stack,n=new io().plToShapes(t),s=Cs.getInstance(),a=s.board;if(r==(a==null?void 0:a.model.modelType)){i.addCommand(this.getBoardCommand(s.board,"modify"));let c=s.board.getChildrens();for(let h of c)for(let u of h)u.remove();s.board.setChildrens(n)}else{a&&(i.addCommand(this.getBoardCommand(a,"delete")),a.remove());let c=new Jp(Cs.id,"Board",1006,[],Cs.width,null,!1,null,null,null);s.board=new ct(c,[]),s.board.setChildrens(n),i.addCommand(this.getBoardCommand(s.board,"add"))}e&&je.executeCommand(i)}}getBoardCommand(t,e){if(t instanceof nr)return new mF(t,e);if(t instanceof Sr)return new gF(t,e);if(t instanceof ct)return new fF(t,e)}addRectOrCircleToBoard(t,e=!0){if(t){let r=e?new ve("board"):je.stack,i=Cs.getInstance(),n=i.board;if(t.modelType==(n==null?void 0:n.model.modelType))if(r.addCommand(this.getBoardCommand(n,"modify")),t instanceof Zp){let a=n;a.start=t.start,a.width=t.width,a.height=t.height,a.cornerRadius=t.radius,a.rotation=t.rotation}else{let a=n;a.center=t.center,a.radius=t.radius}else{n&&(r.addCommand(this.getBoardCommand(n,"delete")),n.remove());let a;t instanceof Zp?a=this.getRectByModel(t):a=this.getCircleByModel(t),i.addBoard(a,!0),r.addCommand(this.getBoardCommand(i.board,"add"))}e&&je.executeCommand(r)}}getRectByModel(t){return new Zp(Cs.id,"Board",1006,t.start,t.width,t.height,t.rotation,t.radius,"",Cs.width,!1,null,null)}getCircleByModel(t){return new $p(Cs.id,"Board",1006,t.center,t.radius,Cs.width,!1,"",null,null)}},zRt=new DOe;function zG(){let o=new Jt;return o.add("convertToBoard"),o.add("convertToLineFromBoard",!1,void 0,void 0,!Cs.getInstance().board),o}function n1(o,t){let e=new Jt;e.add("copyToSvg"),e.add("copyToPng"),o.addExtend("copyToImage",e)}function qje(o){let t=Ve.getSelects(),e=new Jt;e.add("CANCEL",!0);let r=!0,i=!1,n=!1,s=!1,a=t.some(u=>u instanceof Le||u instanceof Ge||u instanceof Ue||u instanceof _n),l=!1;x.getInstance().doctype==3&&(t.forEach(u=>{if(u instanceof Me)r=!1,n=!0;else if(u instanceof Le){let d=u.getParent();d!=null&&d instanceof Me&&(r=!1),i=!0}else if(u instanceof fr){let d=u.getParent();d!=null&&d instanceof Me&&(s=!0)}}),l=!0),l&&bb&&e.add("CROSSPROBE",!0),r?(e.add("COPY"),n1(e,we),e.add("CUT")):n1(e,we),e.addExtend("DUPLICATE",h2()),e.addExtend("MOVE",Xf()),e.add("DELETE"),n&&(e.add("component_distribute_by_region"),e.add("SAVE_TO_LIBRARY")),r&&(s||e.add("ARRAYS"));let c=new Jt;if(we.canIntersectionAggregate&&(c.add("boolIntersection"),c.add("boolAggregate")),we.canSubtractionExclusive&&(c.add("boolSubtraction"),c.add("boolExclusive")),we.canBooleanSplit&&c.add("boolSplit"),(we.canIntersectionAggregate||we.canSubtractionExclusive||we.canBooleanSplit)&&e.addExtend("boolOperation",c),o<2&&e.add("LOCKED",o==0),o>0&&e.add("LOCKED_CANCEL",!0),x.getInstance().doctype==3&&Xje()&&e.addExtend("opensubmenu-boardshape",zG()),we.canSplit&&e.add("SPLIT"),we.canCutout||we.canAvoidSlotsOrPads){let u=new Jt;we.canCutout&&(u.add("CUTOUT_RECT"),u.add("CUTOUT_CIRCLE"),u.add("CUTOUT_POLYGON")),we.canAvoidSlotsOrPads&&(u.add("avoidSlots"),u.add("avoidPads")),e.addExtend("CUTOUT",u,!0)}return e.add("ADAPT_SELECTED"),e.addExtend("HIGHLIGHT",Bm(),!a),a&&e.addExtend("NET_MENU",K3(),!0),i&&e.addExtend("ADD",oue(!1)),e.addExtend("COMBINATION",oy()),l&&e.add("BATCH_FANOUT"),e.addExtend("OFFSET",yg()),e.addExtend("ROTATE",i1(),!1),e.addExtend("FLIP",Ob()),l&&e.add("TURNOVER",!0),Lo.getInstance().getNeedAnnotation()&&l&&e.add("ANNOTATION"),e.add("ATTRIBUTE"),x.getInstance().doctype==3&&!x.getInstance().isPreview&&e.addExtend("REUSE_BLOCK",Fm()),e}var Ih=class{};Ih.pcbConfig={Common:{COMPONENT:!0,ATTR:!0,TRACK:!0,FPC_STIFFENER:!0,PAD_TEST:!0,PAD:!0,VIA:!0,SUTUREVIA:!0,TEXT:!0,IMAGE:!0,PICTURE:!0,DIMENSION:!0,SHEETBOARD:!0,SLOT:!0,POUR:!0,REGION:!0,PROHIBIT:!0,LINE:!0,CONSTRAINT:!0,PADSPAIR:!1,NETWORK:!1,TEARDROP:!0,DRCTAGGING:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!0,BOSS:!0,CREASE:!0,SIDESHELLCUT:!0,TOPSHELLCUT:!0,TOPBOTTOMENTITY:!0,SIDEENTITY:!0},"Only Component":{COMPONENT:!0,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Component Attribute":{COMPONENT:!1,ATTR:!0,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Track":{COMPONENT:!1,ATTR:!1,TRACK:!0,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Via":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!0,SUTUREVIA:!0,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Pad Pair":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!0,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Net":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!0,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Group":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!0,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Image":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!0,PICTURE:!0,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1}},Ih.silkViewerPcbConfig={"Only Image":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!0,PICTURE:!0,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Text":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!0,IMAGE:!1,PICTURE:!0,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Image And Text":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!0,IMAGE:!0,PICTURE:!0,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only FPC STIFFENER":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!0,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1}},Ih.footprintConfig={Common:{PAD:!0,VIA:!0,TEXT:!0,ATTR:!0,IMAGE:!0,PICTURE:!0,DIMENSION:!0,SLOT:!0,REGION:!0,PROHIBIT:!0,LINE:!0,CONSTRAINT:!0,LOCKED:!0,UNLOCKED:!0},"Only Pad":{PAD:!0,VIA:!1,TEXT:!1,ATTR:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SLOT:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,LOCKED:!0,UNLOCKED:!0},"Only Line":{PAD:!1,VIA:!1,TEXT:!1,ATTR:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SLOT:!1,REGION:!1,PROHIBIT:!1,LINE:!0,CONSTRAINT:!1,LOCKED:!0,UNLOCKED:!0}},Ih.operation={"Save As Config...":{disabled:!1},"Set as default config":{disabled:!1},"Rename Config...":{disabled:!0},"Save Config":{disabled:!0},"Delete Config":{disabled:!0}};function $je(){var r,i;let o=new Jt,t=$t.userConfig||{},e=$t.currentSelected||t.pcbConfigDefault||{configName:"Common",configType:"systemConfig"};if(x.getInstance().doctype==3){let n=Object.assign({},Ih.pcbConfig),s=$t.getPcbDefault()||"Common",a={};n[s]?(a[s]=n[s],delete n[s]):(r=t.pcb)!=null&&r[s]&&(a[s]=t.pcb[s],delete t.pcb[s]);let l=Object.keys(a),c=Object.keys(n||{}),h=Object.keys(t.pcb||{});YG(o,l,void 0,e.configName),YG(o,c,void 0,e.configName),YG(o,h,!0,e.configName)}else if(x.getInstance().doctype==4){let n=Object.assign({},Ih.footprintConfig),s=$t.getFootprintDefault()||"Common",a={};n[s]?(a[s]=n[s],delete n[s]):(i=t.footprint)!=null&&i[s]&&(a[s]=t.footprint[s],delete t.footprint[s]);let l=Object.keys(a),c=Object.keys(n||{}),h=Object.keys(t.footprint||{});YG(o,l,void 0,e.configName),YG(o,c,void 0,e.configName),YG(o,h,!0,e.configName)}return o.add("MORE"),o}function YG(o,t,e=!1,r=""){t.map((i,n)=>{n==t.length-1?o.add(i,!0,r?r===i:void 0,void 0,void 0,e):o.add(i,void 0,r?r===i:void 0,void 0,void 0,e)})}function Kje(){let o=new Jt;return St.getInstance().currentCoord?ce.gridConfig.forEach(e=>{let r=e.getMenu(),i=!1;St.getInstance().getGridX()==e.milDeltaX&&St.getInstance().getGridY()==e.milDeltaY&&(i=!0),o.addObj(r,!1,i)}):ce.polarConfig.forEach(e=>{let r=e.getMenu(),i=!1;St.getInstance().angleDelta==e.angleDelta&&St.getInstance().radius==e.milStep&&(i=!0),o.addObj(r,!1,i)}),o.result.length>0&&(o.result[o.result.length-1].separate=!0),o.add("GRID_SNAP_KEEP_RATIO",!1,!!ce.getAssociationPCBCanvasGridAndSnap()),o.add("GRID_SETTING"),o.add("GRID_RANGE_SETTING"),o}function Zje(){let o=new Jt,t=we.gridType;return o.add("GRID_COORDINATE",!1,St.getInstance().currentCoord),o.add("POLAR_COORDINATE",!0,!St.getInstance().currentCoord),o.add("GRID_TYPE_DOT",!1,t==="outlets"),o.add("GRID_TYPE_GRID",!1,t==="grid"),o.add("GRID_TYPE_NONE",!1,t==="none"),o}function Jje(){let o=new Jt,t=ce.gridConfig,e=new ft;return t.forEach(r=>{let i=r.getMenu(),n=!1,s=x.getInstance().unit=="mil"?r.milDeltaX:e.conversion("mm","mil",r.mmDeltaX),a=x.getInstance().unit=="mil"?r.milDeltaY:e.conversion("mm","mil",r.mmDeltaY);ne.eq(St.getInstance().getSnapX(),s)&&ne.eq(St.getInstance().getSnapY(),a)&&(n=!0),o.addObj(i,!1,n)}),o.result.length>0&&(o.result[o.result.length-1].separate=!0),o.add("GRID_SNAP_KEEP_RATIO",!1,!!ce.getAssociationPCBCanvasGridAndSnap()),o.add("GRID_SETTING"),o}function Qje(o){let t=new Jt;return t.add("LOOKUP",!0),x.getInstance().doctype==3&&t.add("HIGHLIGHT_CANCELALL",!0),t.add("PASTE",!0),t.addExtend("FILTER",$je(),!0),t.addExtend("MOVE",Xf(!0)),t.add("ENLARGE"),t.add("NARROW"),t.add("ADAPT_ALL"),t.addExtend("GRID",Kje()),St.getInstance().currentCoord&&t.addExtend("SNAP_SIZE",Jje()),t.addExtend("GRIDTYPE",Zje(),!0),x.getInstance().doctype==4&&t.add("RENUMBER",!0),we.docNeedUpdate&&x.getInstance().doctype==3&&t.add("REFRESH"),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),!Ve.getSelects().length&&x.getInstance().isConcurrentStrictMode&&(t.add("CHECK_OUT"),t.add("CHECK_IN")),Lo.getInstance().getNeedAnnotation()&&t.add("ANNOTATION"),t}function jG(o,t=!1,e=!1,r,i=!1){let n=new Jt;return r.getIsBoxSelection()||n.add("OVERLAP"),n.add("PRIMITIV_PADPAIR"),e&&n.add("PRIMITIV_TRACK"),t||n.add("CONNECT"),i&&n.add("CONNECTED_COPPER",void 0,void 0,!1),n.add("NET"),o&&n.add("SECOND_COMBINATION"),n}function pw(){let o=new Jt;return o.add("align_left"),o.add("align_right"),o.add("align_top"),o.add("align_bottom"),o.add("align_horizontal_center"),o.add("align_vertical_center"),o.add("align_grid"),o}function fw(){let o=new Jt;return o.add("distribute_horizontal_equidistant"),o.add("distribute_vertical_equidistant"),o.add("distribute_left_side_edge_equidistant"),o.add("distribute_top_side_edge_equidistant"),o.add("distribute_horizontal_by_center_distance"),o.add("distribute_vertical_by_center_distance"),o.add("distribute_horizontal_by_edges_distance"),o.add("distribute_vertical_by_edges_distance"),o.add("distribute"),o.add("component_distribute_by_region"),o}function eXe(){let o=new Jt;return Bt.isChildPcb()||o.add("ONLY_SELECT"),o.add("ALL_PROJECT"),o}function tXe(o){return o=="0"?"1":o}function rXe(o,t,e,r){let i=new Jt,n=Ve.getSelects();return i.add("CANCEL",!0),i.add("LOOKUP",!0),bb&&i.add("CROSSPROBE",!0),i.addExtend("SELECT",jG(t,!0,void 0,r)),i.add("COPY",void 0,void 0,void 0,Bt.isChildPcb()),n1(i,we),i.add("CUT",void 0,void 0,void 0,Bt.isChildPcb()),i.addExtend("DUPLICATE",h2(),void 0,void 0,Bt.isChildPcb()),n.length==1?i.addExtend("MOVE",Xf(!0)):(i.addExtend("MOVE",Xf()),i.add("MOVE_SEQUENTIAL")),i.add("DELETE",void 0,void 0,void 0,Bt.isChildPcb()),e<2&&i.add("LOCKED",e==0),e>0&&i.add("LOCKED_CANCEL",!0),i.add("ADAPT_SELECTED"),i.addExtend("HIGHLIGHT",Bm(),!0),i.add("ADDWITH_TEARS"),i.add("ADDVIA_FENCE"),i.add("BATCH_FANOUT",!0),i.add("UNROUTE_ATTACHED_SEGMENTS"),i.add("UNROUTE_CONNECTIONS",!0),i.addExtend("COMBINATION",oy()),n.length==2&&i.add("EXCHANGE_LOCATION"),i.add("ATTR_LOCATION"),i.addExtend("OFFSET",yg()),i.addExtend("ROTATE",i1()),n.length>1&&(i.addExtend("ALIGNMENT",pw()),i.addExtend("DISTRIBUTION",fw())),i.add("TURNOVER",!0),n.length==1&&i.addExtend("PACKAGE_EDIT",eXe()),o&&!Bt.isChildPcb()&&i.add("RECOVER_FOOTPRINT"),n.length==1&&(ce.getSymbolLibManageMode()=="1"?i.add("EASY_DEVICE_EDIT"):i.add("DEVICE_EDIT")),i.add("SAVE_TO_LIBRARY"),i.add("UPDATE_COMPONENT",!0),Lo.getInstance().getNeedAnnotation()&&i.add("ANNOTATION"),i.add("IPC2552"),i.add("ATTRIBUTE"),x.getInstance().isPreview||i.addExtend("REUSE_BLOCK",Fm()),i}function wOe(o=!1,t,e,r){let i=new Jt;i.add("CANCEL",!0),i.add("LOOKUP",!0);let n=Ve.getSelects();if(x.getInstance().doctype==3){bb&&i.add("CROSSPROBE",!0);let s=jG(!1,!1,!1,e,!0);if(s.add("PRIMITIV_COMPONENT"),i.addExtend("SELECT",s),o?(i.add("COPY"),n1(i,we),i.add("CUT"),i.addExtend("DUPLICATE",h2()),i.addExtend("MOVE",Xf())):(i.addExtend("MOVE",Xf()),i.addExtend("OFFSET",yg(),r)),o||!r){i.add("DELETE"),n.length==1&&n[0]instanceof fn&&i.add("EDIT_BOUNDARY");let l=new Jt;we.canIntersectionAggregate&&(l.add("boolIntersection"),l.add("boolAggregate")),we.canSubtractionExclusive&&(l.add("boolSubtraction"),l.add("boolExclusive")),we.canBooleanSplit&&l.add("boolSplit"),(we.canIntersectionAggregate||we.canSubtractionExclusive||we.canBooleanSplit)&&i.addExtend("boolOperation",l),t<2&&i.add("LOCKED",t===0),t>0&&i.add("LOCKED_CANCEL",!0)}i.add("BATCH_FANOUT",!0),i.addExtend("ADD",oue(o)),i.addExtend("COMBINATION",oy()),i.add("ADAPT_SELECTED"),i.addExtend("HIGHLIGHT",Bm()),i.addExtend("NET_MENU",K3(),!0),o||(i.add("RATLINES_SHOW"),i.add("RATLINES_HIDE",!0)),o&&i.addExtend("OFFSET",yg(),!0),Lo.getInstance().getNeedAnnotation()&&i.add("ANNOTATION"),i.add("ATTRIBUTE"),i.addExtend("REUSE_BLOCK",Fm())}else if(x.getInstance().doctype==4){e.getIsBoxSelection()||i.add("SELECTOVERLAP"),i.add("COPY"),n1(i,we),i.add("CUT"),i.addExtend("DUPLICATE",h2()),i.addExtend("MOVE",Xf()),i.add("DELETE"),n.length==1&&n[0]instanceof fn&&i.add("EDIT_BOUNDARY");let s=0;n.forEach(a=>{a instanceof Le&&s++}),i.add("ARRAYS",s<2),s>=2&&i.add("MERGE_PADS",!0),i.addExtend("COMBINATION",oy()),i.add("ADAPT_SELECTED",!0),i.addExtend("OFFSET",yg()),i.addExtend("ROTATE",i1()),i.addExtend("FLIP",Ob()),i.add("TURNOVER",!0),n.length>1&&(i.addExtend("ALIGNMENT",pw()),i.addExtend("DISTRIBUTION",fw(),!0)),i.add("RENUMBER",!0),i.add("ATTRIBUTE")}return i}function iXe(){let o=new Jt;return o.add("WIRING_CLEAR_CONNECT"),o.add("WIRING_CLEAR_NET"),o.add("WIRING_CLEAR_ALL"),o}function nXe(){let o=new Jt,t=Ve.getSelects();Pr.model==0&&(o.add("ADDWITH_VIA"),o.add("ADDWITH_TESTPOINTER"),o.add("ADDWITH_TRACK")),o.add("ADD_FILLET"),o.add("ADD_CHAMFER"),o.add("ADDVIA_FENCE");let e=!0;return t.forEach(r=>{r instanceof Ue?!Io(r.layerId)&&2!=r.layerId&&(e=!1):e=!1}),e?(o.add("ADDWITH_TEARS"),o.add("SETUP_WINDOWINGAREA",!0)):o.add("ADDWITH_TEARS",!0),o}function oXe(o,t,e){let r=new Jt;if(r.add("CANCEL",!0),r.add("LOOKUP",!0),x.getInstance().doctype==3){let s=Ve.getSelects();Bo(s[0])&&$t.getPick(8)&&bb&&r.add("CROSSPROBE",!0)}let i=jG(o,!1,!0,e,!0);if(r.addExtend("SELECT",i),r.add("COPY"),n1(r,we),r.add("CUT"),r.addExtend("DUPLICATE",h2()),r.addExtend("MOVE",Xf()),r.add("INSERT_NODE"),r.add("DELETE"),t<2&&r.add("LOCKED",t==0),t>0&&r.add("LOCKED_CANCEL",!0),x.getInstance().doctype==3&&r.addExtend("opensubmenu-boardshape",zG()),we.canSplit&&r.add("SPLIT"),we.canCutout||we.canAvoidSlotsOrPads){let s=new Jt;we.canCutout&&(s.add("CUTOUT_RECT"),s.add("CUTOUT_CIRCLE"),s.add("CUTOUT_POLYGON")),we.canAvoidSlotsOrPads&&(s.add("avoidSlots"),s.add("avoidPads")),r.addExtend("CUTOUT",s,!0)}return Pr.model==0&&r.add("STRETCHING"),r.addExtend("WIRING_CLEAR",iXe(),!0),r.add("ADAPT_SELECTED"),r.addExtend("HIGHLIGHT",Bm()),r.addExtend("NET_MENU",K3(),!0),Pr.model==0&&r.add("ADDWITH_EQUALLENGTHTUNING"),r.add("CONVERT_TO_2D_LINE"),r.addExtend("ADD",nXe()),r.addExtend("OFFSET",yg()),r.addExtend("COMBINATION",oy(),!0),r.addExtend("FLIP",Ob()),r.add("TURNOVER",!0),Lo.getInstance().getNeedAnnotation()&&r.add("ANNOTATION"),r.add("ATTRIBUTE"),x.getInstance().doctype==3&&!x.getInstance().isPreview&&r.addExtend("REUSE_BLOCK",Fm()),r}function sXe(){let o=new Jt,t=Ve.getSelects();return o.add("ADDWITH_TRACK"),o.add("ADDWITH_VIA",!0),o}function aXe(){let o=new Jt;o.add("CANCEL",!0);let t=new Jt;return t.add("NET"),o.addExtend("SELECT",t,!0),o.add("ADAPT_SELECTED"),o.add("RATLINES_HIDE"),o.addExtend("NET_MENU",K3(),!0),Ve.getSelects().length==1&&o.addExtend("ADD",sXe()),o}function lXe(){let o=new Jt;return Ve.getSelects().length==1&&o.add("ADDWITH_TRACK"),o.add("ADDWITH_TEARS",!0),o}function cXe(o,t,e,r){let i=new Jt,n=Ve.getSelects();i.add("CANCEL",!0),i.add("LOOKUP",!0),x.getInstance().doctype==3&&Bo(n[0])&&$t.getPick(8)&&bb&&i.add("CROSSPROBE",!0);let s=new Jt;return e.getIsBoxSelection()||s.add("OVERLAP"),x.getInstance().doctype==3&&(s.add("CONNECT"),s.add("CONNECTED_COPPER",void 0,void 0,!1),s.add("NET")),o&&s.add("SECOND_COMBINATION"),s.result.length>0&&i.addExtend("SELECT",s),i.add("COPY"),n1(i,we),r||i.add("CUT"),i.add("DUPLICATE_TO_CURSOR"),i.addExtend("MOVE",Xf()),r||(i.add("DELETE"),t<2&&i.add("LOCKED",t==0),t>0&&i.add("LOCKED_CANCEL",!0)),i.addExtend("ADD",lXe()),i.add("ADAPT_SELECTED"),i.addExtend("HIGHLIGHT",Bm()),x.getInstance().doctype==3&&i.addExtend("NET_MENU",K3(),!0),i.addExtend("COMBINATION",oy()),i.addExtend("OFFSET",yg(),!0),Lo.getInstance().getNeedAnnotation()&&i.add("ANNOTATION"),i.add("ATTRIBUTE"),x.getInstance().doctype==3&&!x.getInstance().isPreview&&i.addExtend("REUSE_BLOCK",Fm()),i}function hXe(){let o=new Jt;return o.add("HIDE_SELECTED_COPPER_FILLS"),o.add("SHOW_SELECTED_COPPER_FILLS"),o.add("HIDE_COPPER_FILLS"),o.add("SHOW_COPPER_FILLS"),o.add("REBUILD_SELECTED"),o.add("REBUILD_ALL",!0),o.add("RAISE_PRIORITY"),o.add("LOWER_PRIORITY",!0),o.add("COPPER_MANAGER"),o}var sue=te.getInstance(),Z3=class{constructor(t){this.oldItem=t}extendOldItem(t){if(t===this.oldItem)return;let e=this.oldItem,r=JSON.stringify(e.getComponent());new Nl(r,t.type).rebuildComponent(t);let n=t.getComponent();if(t instanceof ct&&n instanceof K0&&n.type=="DRAWER"&&(n.type="T&B"),t.type==="Constraint Region"&&e.type==="Constraint Region"){let s=sue.getRegion(t.globalIndex);s==null&&(s=sue.addConstraintSelector(t.globalIndex));let a=this.getOldRegionSelector();sue.updateRegionSelector(t.globalIndex,a,!0)}}extendOldCopperOrder(t){if(t===this.oldItem)return;let e=this.oldItem;t.type==="Copper Region"&&e.type==="Copper Region"&&(t.getComponent().order=e.getComponent().order)}getOldRegionSelector(){let t=this.oldItem;return sue.getRegion(t.globalIndex)}};var g$=class{constructor(t,e,r){this.shapes=[];this.otherShapes=[];this.controlLines=[];this.originItem=t,this.fac=r,this.cutItemByPoint(e)}mouseMove(t){if(this.controlLines){let[e,r]=this.controlLines;e.end=t,r.start=t}}completed(){let t=new ve("Insert Node");this.fac.addGroup(t);let e=this.getResult();if(e==null){A.publish("delete",this.originItem),this.fac.addCommand4Item(this.originItem,"delete"),this.originItem.remove(),this.originItem=null;return}let r=[e];this.shapes.length&&No(e.getMathGraphics())&&(r=Vm(e),e.remove());let i=new Z3(this.originItem);r.length==1?i.extendOldCopperOrder(r[0]):r.forEach(n=>{gn.addOrder(n,this.fac.getCommand())}),r.forEach(n=>{i.extendOldItem(n),A.publish("hasModifyPcbItem",n),this.fac.addCommand4Item(n,"add")}),A.publish("delete",this.originItem),this.fac.addCommand4Item(this.originItem,"delete"),this.originItem.remove(),this.originItem=null,this.fac.checkOutlines(r,new Set)}getResult(){let t=this.originItem,e=pd(this.originItem.type);if(e&&!xu(this.shapes.map(d=>d.primitive),t.strokeWidth)){for(let d of this.shapes)d.remove();return this.shapes.length=0,this.otherShapes.length=0,null}e&&!xu(this.shapes.map(d=>d.primitive))&&t instanceof ct&&this.shapes.push(Yi.build(t.layerId,t.end,t.start,t.strokeWidth));let r=[],i=new io;this.shapes.forEach(d=>{let p=i.clone4(d.model);r.push(p),d.remove()});let n=this.otherShapes.map(d=>d.map(p=>{let m=i.clone4(p.model);return p.remove(),m}));r=iy(r);let{type:s,layerId:a,strokeWidth:l,net:c,locked:h}=t,u=pt.addPolygon(s,a,[].concat([r],n),l,c,h);return u.fill(),u}check(){let t=this.shapes.map(r=>this.getPt(r));return!t.length||!No(fe.build2(t))}interrupt(){this.shapes.forEach(t=>{t.remove()}),this.shapes.length=0,this.otherShapes.length=0,this.controlLines.length=0}cutItemByPoint(t){let e=this.originItem;if(e instanceof Ye){let r=e.layerId,{shapes:i,otherShapes:n}=this.convertToShape(e,t);this.otherShapes=n;let s=!1;for(let a=0;a<i.length;a++){let l=i[a];if(!l.isSelect(t.x,t.y)||s)this.shapes.push(l);else{s=!0;let c=l.width;if(l instanceof Yi){let h=Yi.build(r,l.start,t,c),u=Yi.build(r,t,l.end,c);this.controlLines=[h,u],this.shapes.push(h,u);let d=a>0?i[a-1].end.sub(i[a-1].start).angle(S.ORIGIN):0,p=a<i.length-1?i[a+1].end.sub(i[a+1].start).angle(S.ORIGIN):0;di.handleAddSnapFlagData(void 0,void 0,[{center:l.start,rotation:d},{center:l.end,rotation:p}])}else{let{center:h,radius:u,startAngle:d,endAngle:p,sweep:m}=l,g=t.angleX(h),y=Zo.build(r,h,u,c,d,g,m),b=Zo.build(r,h,u,c,g,p,m);this.controlLines=[y,b],this.shapes.push(y,b)}l.remove()}}this.shapes.forEach(a=>{a.color=e.color||null}),this.otherShapes.flat(1).forEach(a=>{a.color=e.color||null})}}convertToShape(t,e){let{layerId:r,strokeWidth:i}=t,n=new Array,s=new Array;if(t instanceof nr)t.getAllLinesInOrder().forEach(a=>{a instanceof M?n.push(Yi.build(r,a.start(),a.end(),i)):a instanceof q&&n.push(Zo.build(r,a.center,a.rx,i,Ht.toRadians(a.startAngle),Ht.toRadians(a.endAngle()),a.sweep()))});else if(t instanceof Sr){let a=Math.PI,l=[a/2,0,-a/2,a,a/2],{center:c,radius:h}=t;for(let u=0;u<l.length-1;u++){let d=Zo.build(r,c,h,i,l[u],l[u+1],le.CW);n.push(d)}}else if(t instanceof ct){let a=t.getChildrens();for(let l of a){let c=new Array;for(let u of l)if(u instanceof mt){let d=Yi.build(r,u.start,u.end,i);c.push(d)}else{let{center:d,radius:p,startAngle:m,endAngle:g,sweep:y}=u,b=Zo.build(r,d,p,i,m,g,y);c.push(b)}c.some(u=>u.isSelect(e.x,e.y))?n=c:s.push(c)}}return{shapes:n,otherShapes:s}}getPt(t){if(t instanceof Yi)return new M(t.start,t.end);{let{center:e,startAngle:r,endAngle:i,radius:n,sweep:s}=t,a=r/Math.PI*180,l=i/Math.PI*180;return q.build2(e,a,l,n,n,s)}}};var y$=class{constructor(t,e,r){this.shoveEvent=new tD;this.block=new df;this.numberOfIterator=0;this.lastBlockEnd=null;this.shapes=[];this.controlLines=[];this.controlArcs=[];let i=this.correctSelectPoint(t,e);this.originItem=t,this.fac=r,this.cutItemByPoint(i),this.originItem instanceof Ar&&(this.chain=this.shoveEvent.getChain(this.originItem),this.shoveEvent.shoveFun.result.sourceTrackChain.push(this.chain.tracks),this.shoveEvent.shoveFun.result.shovePathMap[0]=this.chain)}mouseMove(t){if(this.originItem instanceof Si){let[e,r]=this.controlArcs;e.end=t,r.start=t}else{let[e,r,i]=this.controlLines,n=45,s=e.start,a=i.end,l=a.sub(s),h=t.sub(s).cross(l)<0?1:-1,u=Math.PI*n/180,p=l.multiply4(Ae.rotateZ(u*h)).normalize().mul(l.length()*Math.cos(u)),m=s.add(p),g=this.getVectorProjection(t.sub(s),l),y=t.sub(s).sub(g),b=new M(s.add(y),a.add(y)),P=new M(s,m),T=new M(a,m),I=this.getIntersection(P,b)[0],C=this.getIntersection(T,b)[0];I&&C?(e.end=I,r.start=I,r.end=C,i.start=C):(e.end=m,r.start=m,r.end=m,i.start=m),this.blockTrack()}}blockTrack(){if(!(this.originItem instanceof Ar))return;if(this.numberOfIterator++,this.numberOfIterator>100){this.numberOfIterator=0,this.lastBlockEnd=null;return}let[t,e,r]=this.controlLines;if(this.isBlock()){this.block.adsorp=null;let i=this.block.blockBaseTrack(t,!0);if(i.distance2(t.end)>1e-8)this.mouseMove(i);else{let n=this.block.blockBaseTrack(r,!1);if(n.distance2(r.start)>1e-8)this.mouseMove(n);else if(this.block.blockBaseTrack(e).distance2(e.end)>1e-8){let a=this.block.getEnd4Block(e.direct,e.layerId,e.width,e.net);a=a.filter(c=>this.lastBlockEnd?!c.equals1(this.lastBlockEnd):!0);let l=this.getEnd(this.originItem.primitive,a);this.lastBlockEnd=l,this.mouseMove(l)}}}else if(this.isPush()){this.shove();for(let i of this.controlLines)i.hidden()}}shove(){let t=this.splitPath(this.chain),e=this.shoveEvent.getNewChainFactory(this.chain,t).build();this.shoveEvent.shoveFun.remove4Rtree([this.chain]),this.shoveEvent.shoveFun.shoveMain(e),this.shoveEvent.shoveFun.add4Rtree([this.chain]);let r=this.shoveEvent.shoveFun.result;r.sourceTrackChain[0]=this.chain.tracks,this.shoveEvent.current=r,this.shoveEvent.preview(r)}splitPath(t){let e=0,r=new Array,i=new Array,n=new Array;for(let a of t.path)switch((a.equals1(this.originItem.start)||a.equals1(this.originItem.end))&&e++,e){case 0:r.push(a);break;case 1:i.push(a);break;case 2:i.push(a),e++;break;default:n.push(a);break}let s=new Array;s.push(this.shapes[0].start);for(let a of this.shapes)s.push(a.end);return s[0].equals1(i[0])?[].concat(r,s,n):s[s.length-1].equals1(i[0])?[].concat(r,s.reverse(),n):[].concat(r,[i[0]],s,i[1],n)}shoveInterrupt(){this.shoveEvent.shoveTrackInterrupt()}getEnd(t,e){let r=Number.MAX_VALUE,i=e[0];for(let n of e){let a=ir.foot(t,n).distance2(n);a<r&&(r=a,i=n)}return i}isBlock(){let t=tr.getInstance();return t.mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"||t.mode=="WIRING_MODE_SURROUND"||t.mode=="WIRING_MODE_OBSTRUCT"}isPush(){return tr.getInstance().mode=="WIRING_MODE_PUSHAWAY"}completed(){let t=this.getResult(),e=new ve("Insert Node");this.fac.addGroup(e),this.shoveEvent.shoveTrackGroupComplete(e),t.forEach(r=>{A.publish("hasModifyPcbItem",r),this.fac.addCommand4Item(r,"add")}),A.publish("delete",this.originItem),this.fac.addCommand4Item(this.originItem,"delete"),this.originItem.remove(),this.originItem=null,this.fac.execute()}getResult(){return this.shapes.map(e=>{let r=this.createTrack(e);return e.remove(),r})}check(){return!0}createTrack(t){let{layerId:e,width:r,net:i}=t;if(t instanceof $d)return pr.addTrack(e,t.start,t.end,r,!1,i);if(t instanceof yD){let{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=t;return pr.addArcTrack(e,n,s,a,l,c,r,!1,i)}}interrupt(){this.shoveInterrupt(),this.shapes.forEach(t=>{t.remove()}),this.shapes.length=0,this.controlLines.length=0,this.controlArcs=[]}getIntersection(t,e){let r=Tt(t,e);return ig(r,[])}correctSelectPoint(t,e){if(t instanceof Si)return e;{let r=e.sub(t.start),i=t.end.sub(t.start),n=this.getVectorProjection(r,i);return t.start.add(n)}}cutItemByPoint(t){let e=this.originItem,r=e.layerId;if(e instanceof Ar){let{start:i,end:n,net:s,width:a}=e,c=(i.distance2(t)>n.distance2(t)?n:i).sub(t).mul(.5),h=t.add(c),u=t.sub(c);h.distance2(i)>u.distance2(i)&&(h=t.sub(c),u=t.add(c));let d=$d.build(r,h,h,a,s),p=$d.build(r,h,u,a,s),m=$d.build(r,u,u,a,s),g=$d.build(r,i,h,a,s),y=$d.build(r,u,n,a,s);this.controlLines.push(d,p,m),this.shapes.push(g,...this.controlLines,y)}else if(e instanceof Si){let{center:i,radius:n,startAngle:s,endAngle:a,sweep:l,width:c,net:h}=e,u=t.angleX(i),d=yD.build(r,i,n,s,u,l,c,h),p=yD.build(r,i,n,u,a,l,c,h);this.controlArcs=[d,p],this.shapes.push(...this.controlArcs)}}getVectorProjection(t,e){let r=e.normalize(),i=r.dot(t);return r.mul(i)}};var aue=class{constructor(t,e,r){this.selectLines=[null,null];this.clickRectPointType=0;let i=new ve("Move Item Node");this.originItem=t,this.fac=r,this.fac.addGroup(i),this.init(e),t instanceof nr||t instanceof Sr?this.fac.addCommand4Item(t,"modify"):this.filterItem(this.selectLines).forEach(s=>{this.fac.addCommand4Item(s,"modify")})}getFilterItems(){let t=[].concat([this.originItem],this.selectLines);return t=t.filter(e=>e),new Set(t)}mouseMove(t){let e=this.originItem;e instanceof nr?this.moveRect(t):e instanceof Sr?e.radius=e.center.distance1(t):this.selectLines.forEach((r,i)=>{r&&(this.clickPointType[i]==0?r.start=t:this.clickPointType[i]==1&&(r.end=t))})}completed(){if(this.originItem instanceof Ye){if(this.originItem instanceof ct&&(nw(this.originItem),this.originItem.getChildrens().length&&No(this.originItem.getMathGraphics()))){let e=Vm(this.originItem,this.fac.getCommand());this.fac.checkOutlines(e,new Set);return}this.originItem.fill()}A.publish("hasModifyPcbItem",this.originItem),this.fac.checkOutlines([this.originItem],new Set)}check(){if(this.originItem instanceof ct){let e=this.originItem.getChildrens().every(r=>{let i=r.map(n=>this.getPt(n));return!i.length||!No(fe.build2(i))});if(!e){A.publish("ui/toastMsg",{type:"warn",msg:"This object has self-intersection, please modify"},$());return}return e}return!0}interrupt(){this.fac.undo()}clear(){}moveRect(t){let e=this.originItem,r=[e.getUL(),e.getUR(),e.getLR(),e.getLL()],i=Ae.rotateZForPoint(e.getUL(),-e.rotation),n=Ae.rotateZForPoint(e.getUL(),e.rotation),s=(this.clickRectPointType+2)%r.length,a=t.multiply4(i),l=r[s].multiply4(i),c=new _e;c.ext2(a).ext2(l);let h=c.build1(),u=[h.UL(),h.UR(),h.LR(),h.LL()];u=u.map(d=>d.multiply4(n)),e.setUL(u[0]),e.setUR(u[1]),e.setLR(u[2]),e.setLL(u[3]),this.isSamePoint(t,e.getUL())?this.clickRectPointType=0:this.isSamePoint(t,e.getUR())?this.clickRectPointType=1:this.isSamePoint(t,e.getLR())?this.clickRectPointType=2:this.isSamePoint(t,e.getLL())&&(this.clickRectPointType=3)}getPt(t){if(t instanceof mt)return new M(t.start,t.end);{let{center:e,startAngle:r,endAngle:i,radius:n,sweep:s}=t,a=r/Math.PI*180,l=i/Math.PI*180;return q.build2(e,a,l,n,n,s)}}init(t){let e=this.originItem;if(e instanceof nr)this.isSamePoint(t,e.getUL())?this.clickRectPointType=0:this.isSamePoint(t,e.getUR())?this.clickRectPointType=1:this.isSamePoint(t,e.getLR())?this.clickRectPointType=2:this.isSamePoint(t,e.getLL())&&(this.clickRectPointType=3);else if(!(e instanceof Sr)){if(e instanceof ct){let r=e.getChildrens().map(i=>i.map(n=>n));for(let i=0;i<r.length;i++){let n=r[i],s=[],a=n.length;for(let l=0;l<a;l++)if(this.isSamePoint(n[l].start,t)){s.push(l-1,l);break}else if(this.isSamePoint(n[l].end,t)){s.push(l,l+1);break}s[0]>=0&&s[0]<a&&(this.selectLines[0]=n[s[0]]),s[1]>=0&&s[1]<a&&(this.selectLines[1]=n[s[1]]),e.isClose(i)&&this.isSamePoint(n[0].start,t)&&(this.selectLines=[n[a-1],n[0]])}this.clickPointType=[1,0]}else if(e instanceof Ue){let r=this.isSelectTrackEndPoint(e,t)===-1,i=new Nu(e),{startType:n,endType:s,startNodes:a,endNodes:l}=i,c=r?n:s,h=r?a[0]:l[0],u=r?0:1;switch(c){case 5:case 7:this.selectLines=[e,h],this.clickPointType=[u,0];break;case 6:case 8:this.selectLines=[e,h],this.clickPointType=[u,1];break;case 0:this.selectLines=[e,null],this.clickPointType=[u,2]}}}}isSelectTrackEndPoint(t,e){let r=t.width/2,i=ne.greatereq(r,t.start.distance1(e)),n=ne.greatereq(r,t.end.distance1(e));return i?-1:n?1:0}isSamePoint(t,e){return t.distance1(e)<1e-8}filterItem(t){let e=new Set;return t.forEach(r=>{if(r instanceof zs){let i=r.getParent();i?e.add(i):e.add(r)}}),Array.from(e)}};var lue=class extends ci{constructor(e={},r){super();this.tool=null;this.originItem=null;this.selects=[];this.ready=!1;this.drawing=!0;let{selects:i=Ve.getSelects()}=e;this.selects=XG(i),this.fac=r,this.start()}changeToReady(e){this.checkToReady(this.selects,e),this.ready||this.cancel()}checkToReady(e,r){var n;let i=(n=e.filter(s=>this.isSelectItem(s,r)))==null?void 0:n[0];if(i){let s=XG([i]);this.originItem=s[0];let a=this.originItem;a&&(this.ready=!0,this.selects=e,jt.cancel(),this.isSelectEndPoint(a,r)?(Pr.model=3,a instanceof Ye&&a.removeFill(),this.tool=new aue(a,r,this.fac),this.filterItems=this.tool.getFilterItems()):(A.publish("clearSelect",""),a.hidden(),a instanceof Ye?(a.removeFill(),this.tool=new g$(a,r,this.fac)):this.tool=new y$(a,r,this.fac)))}}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);this.ready?this.tool&&this.completed():this.checkToReady(this.selects,r)}onMouseMove(e){if(!this.drawing||!this.ready||!this.tool){this.ready||jt.update(e,"Please select a node to insert");return}this.tool instanceof g$&&di.snapToSnapFlag(e,void 0,!0);let r=new S(e.sceneX,e.sceneY);this.tool instanceof y$&&(this.tool.numberOfIterator=0,this.tool.lastBlockEnd=null),this.tool.mouseMove(r)}completed(){!this.tool||!this.originItem||(this.tool.completed(),this.interrupt())}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":{this.cancel();break}case"Finish":this.onEnterPlace(e);break}}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}cancel(){this.interrupt(),A.publish("onlySelect",this.selects)}interrupt(){this.ready=!1,this.tool&&this.tool.interrupt(),jt.cancel(),A.publish("tool","dropdrag"),this.end()}isSelectItem(e,r){return e instanceof nr||e instanceof Sr?e.isSelectOnlyLine(r.x,r.y):e instanceof ct?e.onlyOutline(r.x,r.y):e instanceof Ue?this.isSelectTrack(e,r):e.isSelect(r.x,r.y)}isSelectTrack(e,r){let i=this.isSelectTrackEndPoint(e,r);if(i){let n=i===-1,s=new Nu(e);switch(n?s.startType:s.endType){case 5:case 7:case 6:case 8:case 0:return!0}return!1}return e.isSelect(r.x,r.y)}isSelectEndPoint(e,r){if(e instanceof nr)return[e.getUL(),e.getUR(),e.getLR(),e.getLL()].some(n=>n.distance1(r)<1e-8);if(e instanceof Sr){let{center:i,radius:n}=e,{x:s,y:a}=i;return[new S(s,a-n),new S(s,a+n),new S(s-n,a),new S(s+n,a)].some(c=>c.distance1(r)<1e-8)}else{if(e instanceof ct)return e.getChildrens().some(n=>n.some(s=>s.start.distance1(r)<1e-8||s.end.distance1(r)<1e-8));if(e instanceof Ue)return!!this.isSelectTrackEndPoint(e,r)}}isSelectTrackEndPoint(e,r){let i=e.width/2,n=ne.greatereq(i,e.start.distance1(r)),s=ne.greatereq(i,e.end.distance1(r));return n?-1:s?1:0}};function XG(o){let t=new Set;return o.forEach(e=>{if(!(e instanceof ii)&&e instanceof zs){let r=e.getParent();r?t.add(r):t.add(e)}}),o=Array.from(t),o.length===1&&o[0]instanceof Ye&&o[0].type!=="3D Shell - Screw Pillar"||o.every(r=>r instanceof Ue)?o:[]}function uXe(o){let t=new Jt,e=Ve.getSelects(),r=e.some(i=>i instanceof Ye&&i.type==="3D Shell - Screw Pillar");return!r&&t.add("ADD_FILLET"),!r&&t.add("ADD_CHAMFER"),o&&t.add("SETUP_WINDOWINGAREA"),x.getInstance().doctype===bi.PCB&&e.every(n=>n instanceof Ye&&(n.type=="Line"||n.type=="Fill Region"||n.type=="Board Outline"||n.layerId==11))&&t.add("ADDVIA_FENCE"),t}function dXe(o,t,e){let r=Ve.getSelects(),i=new Jt;if(i.add("CANCEL",!0),i.add("LOOKUP",!0),x.getInstance().doctype==bi.PCB){let b=Ve.getSelects();Bo(b[0])&&$t.getPick(8)&&bb&&i.add("CROSSPROBE",!0)}let n=new Jt;e.getIsBoxSelection()||n.add("OVERLAP"),n.add("PRIMITIV_2DLINE"),o&&n.add("SECOND_COMBINATION"),i.addExtend("SELECT",n),i.add("COPY"),n1(i,we),i.add("CUT"),i.add("DELETE"),i.addExtend("DUPLICATE",h2()),i.addExtend("MOVE",Xf());let s=r.some(b=>b instanceof Ye&&b.type==="3D Shell - Screw Pillar"),a=j5.filterD3Shell(r).length===0,l=0,c=!1,h=new Set;if(r.forEach(b=>{if(r$(b)||l++,b instanceof vt||b instanceof mt){let T=b.getParent();T instanceof ct&&T.getAllChildrens().length>0&&(c=!0),T instanceof Ye&&h.add(T.type)}else b instanceof ct?(b.getAllChildrens().length>0&&(c=!0),h.add(b.type)):(b instanceof Sr||b instanceof nr)&&(c=!0,h.add(b.type))}),XG(r).length&&!s&&i.add("INSERT_NODE"),c&&!s&&i.add("EDIT_BOUNDARY"),r.length===1&&x.getInstance().doctype==bi.PCB){let b=r[0];(b instanceof vt||b instanceof mt)&&(b=b.getParent()),b instanceof Ye&&b.type==="Board Outline"&&i.add("GENERATE_D3_SHELL_OUTLINE")}if(l>=2&&i.add("MERGE_AS_CLOSED_OBJECT"),r.length>=1){let b=r.filter(P=>{let T=P;return(P instanceof mt||P instanceof vt)&&(T=P.getParent()),T.type=="Line"});a&&i.add("DISPERSED_AS_INDEPENDENT_LIEN")}let u=new Jt;if(we.canIntersectionAggregate&&(u.add("boolIntersection"),u.add("boolAggregate")),we.canSubtractionExclusive&&(u.add("boolSubtraction"),u.add("boolExclusive")),we.canBooleanSplit&&u.add("boolSplit"),(we.canIntersectionAggregate||we.canSubtractionExclusive||we.canBooleanSplit)&&i.addExtend("boolOperation",u),x.getInstance().doctype==bi.PCB&&i.addExtend("opensubmenu-boardshape",zG()),we.canSplit&&i.add("SPLIT"),we.canCutout||we.canAvoidSlotsOrPads){let b=new Jt;we.canCutout&&(b.add("CUTOUT_RECT"),b.add("CUTOUT_CIRCLE"),b.add("CUTOUT_POLYGON")),we.canAvoidSlotsOrPads&&(b.add("avoidSlots"),b.add("avoidPads")),i.addExtend("CUTOUT",b)}let d=new Jt,p=h.size!=1;h.has("Line")&&x.getInstance().doctype==bi.PCB&&d.add("CONVERT_TO_TRACK"),d.add("CONVERT_TO_PAD"),r.length>=1&&((p||!h.has("Line"))&&d.add("CONVERT_TO_2D_LINE"),(p||!h.has("Slot Region"))&&d.add("CONVERT_TO_SLOT_REGION"),(p||!h.has("Fill Region"))&&d.add("CONVERT_TO_FILL_REGION"),x.getInstance().doctype==bi.PCB&&(p||!h.has("Copper Region"))&&d.add("CONVERT_TO_COPPER_REGION"),(p||!h.has("Prohibited Region"))&&d.add("CONVERT_TO_PROHIBITED_REGION"),x.getInstance().doctype==bi.PCB&&((p||!h.has("Board Outline"))&&d.add("CONVERT_TO_BOARD_OUTLINE"),(p||!h.has("Constraint Region"))&&d.add("CONVERT_TO_CONSTRAINT_REGION"),(p||!h.has("3D Shell - Outline"))&&d.add("CONVERT_TO_D3_SHELL_OUTLINE"),(p||!h.has("3D Shell - Side Slot Region")&&!h.has("3D Shell - Top Slot Region"))&&d.add("CONVERT_TO_D3_SHELL_SLOT_REGION"),(p||!h.has("3D Shell - Side Entity")&&!h.has("3D Shell - Top/Bottom Entity"))&&d.add("CONVERT_TO_D3_SHELL_ENTITY")),(p||!h.has("FPC Stiffener"))&&d.add("CONVERT_TO_FPC_STIFFENER")),i.addExtend("CONVERT_TO",d),t<2&&i.add("LOCKED",t==0),t>0&&i.add("LOCKED_CANCEL",!0),i.add("ADAPT_SELECTED"),i.addExtend("HIGHLIGHT",Bm(),!0);let m=!1,g=!0;return r.forEach(b=>{if(b instanceof Ye)b.type=="Copper Region"?(m=!0,g=!1):(b.type=="Fill Region"||b.type=="Line")&&!(b.getParent()&&b.getParent()instanceof Me)?!Io(b.layerId)&&2!=b.layerId&&(g=!1):g=!1;else if(b instanceof vt||b instanceof mt){let P=b.getParent();P!=null&&P instanceof Ye&&(P.type=="Copper Region"?(m=!0,g=!1):(P.type=="Fill Region"||P.type=="Line")&&!(P.getParent()&&P.getParent()instanceof Me)?!Io(P.layerId)&&2!=P.layerId&&(g=!1):g=!1)}}),s||i.addExtend("ADD",uXe(g)),m&&i.addExtend("COPPER_AREA",hXe()),i.result[i.result.length-1].separate=!0,i.addExtend("COMBINATION",oy()),s?i.addExtend("OFFSET",yg(),!0):(i.addExtend("OFFSET",yg()),i.addExtend("ROTATE",i1()),i.addExtend("FLIP",Ob()),i.add("TURNOVER",!0)),Lo.getInstance().getNeedAnnotation()&&i.add("ANNOTATION"),i.add("ATTRIBUTE"),x.getInstance().doctype==bi.PCB&&!x.getInstance().isPreview&&i.addExtend("REUSE_BLOCK",Fm()),i}function pXe(o,t,e){let r=Ve.getSelects(),i=new Jt;i.add("CANCEL",!0),i.add("LOOKUP",!0);let n=new Jt;e.getIsBoxSelection()||n.add("OVERLAP");let s=!1;return r.forEach(l=>{let c=l.getParent();c!=null&&c instanceof Me&&(s=!0)}),s&&n.add("PRIMITIV_COMPONENT"),o&&n.add("SECOND_COMBINATION"),i.addExtend("SELECT",n),i.add("COPY"),n1(i,we),i.add("CUT"),i.addExtend("DUPLICATE",h2()),i.addExtend("MOVE",Xf()),i.add("DELETE"),s||i.add("ARRAYS"),t<2&&i.add("LOCKED",t==0),t>0&&i.add("LOCKED_CANCEL",!0),i.add("ADAPT_SELECTED"),i.addExtend("HIGHLIGHT",Bm(),!0),i.addExtend("COMBINATION",oy()),i.addExtend("OFFSET",yg()),i.addExtend("ROTATE",i1()),i.addExtend("FLIP",Ob()),i.add("TURNOVER"),r.length>1&&(i.addExtend("ALIGNMENT",pw()),i.addExtend("DISTRIBUTION",fw(),!0)),Lo.getInstance().getNeedAnnotation()&&i.add("ANNOTATION"),i.add("ATTRIBUTE"),x.getInstance().doctype==3&&!x.getInstance().isPreview&&i.addExtend("REUSE_BLOCK",Fm()),i}function fXe(o,t,e){let r=new Jt;r.add("CANCEL",!0),r.add("LOOKUP",!0);let i=new Jt;i.add("OVERLAP"),o&&i.add("SECOND_COMBINATION"),r.addExtend("SELECT",i),r.add("COPY"),n1(r,we),r.add("CUT"),r.addExtend("DUPLICATE",h2()),r.addExtend("MOVE",Xf()),r.add("DELETE");let n=Ve.getSelects();return r.add("ARRAYS"),t<2&&r.add("LOCKED",t==0),t>0&&r.add("LOCKED_CANCEL",!0),r.add("ADAPT_SELECTED"),r.addExtend("HIGHLIGHT",Bm(),!0),r.addExtend("COMBINATION",oy()),r.addExtend("OFFSET",yg()),r.addExtend("ROTATE",i1()),r.addExtend("FLIP",Ob()),r.add("TURNOVER"),n.length>1&&(r.addExtend("ALIGNMENT",pw()),r.addExtend("DISTRIBUTION",fw(),!0)),Lo.getInstance().getNeedAnnotation()&&r.add("ANNOTATION"),r.add("ATTRIBUTE"),x.getInstance().doctype==3&&!x.getInstance().isPreview&&r.addExtend("REUSE_BLOCK",Fm()),r}function mXe(o){let t=new Jt;return t.add("CANCEL",!0),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),Lo.getInstance().getNeedAnnotation()&&t.add("ANNOTATION"),t}var u2=class{constructor(t,e,r){this.items=new Array;t.forEach(i=>{i instanceof Ye&&i.type=="Prohibited Region"&&i.getParent()!=null||this.items.push(i)}),this._referX=e,this._referY=r}setReferPointSuccess(t,e){return!0}setReferPoint(t,e){this._referX=t,this._referY=e;let r={command:"batchMoveItem",refer:this,menu:"MOVE_BY_REFERENCE_POINT"};A.publish("toggle",r)}get referX(){return this._referX}set referX(t){this._referX=t}get referY(){return this._referY}set referY(t){this._referY=t}};var LOe=null,ZT=class o{static filter(t){return LOe==null&&(LOe=new o),LOe.filter(t)}constructor(){}isUnique(t){if(t instanceof _n||t instanceof ii||t instanceof Ki)return!0;if(t instanceof Le&&t.getParent()==null||t instanceof fr||t instanceof Ge)return!1;if(t instanceof Nh)return!0;let e=t.getParent();if(e!=null){if(e instanceof Me)return!0;if(e instanceof ct)return!0}return!1}filter(t){let e=new Set;return t.forEach(r=>{if(!this.isUnique(r))e.add(r);else if(r instanceof mt||r instanceof vt){let i=r.getParent();i instanceof ct&&i.getParent()==null&&e.add(i)}}),Array.from(e)}};var cue=class{};var MOe=class extends cue{deleteModel(t){let e=t[0].getParent();if(t.some(r=>r.getParent()!==e))throw new Error("models has different parent");if(e instanceof ct)return e.type==="Line"?this.deleteLine(t,e):this.delete2DLine(t,e);throw new Error(`Not allowed to delete ${t.map(r=>r.globalIndex)}`)}delete2DLine(t,e){let r=e.getChildrens(),i=new io,n=new Array,s=!1;for(let a=0;a<r.length;a++){let l=r[a],c=[...l];n[a]=c;let h=l.length;if(h>3&&e.isClose()&&t.length==1){let u=t[0],d=e.getConnect(u,!0),p=l.indexOf(u);if(p==-1)continue;c.length=0;let m=l.indexOf(d);if(p==0)for(let y=p+1;y<m;y++)c.push(l[y]);else{for(let y=p+1;y<h;y++)c.push(l[y]);for(let y=0;y<m;y++)c.push(l[y])}s=!0;let g=i.addLine(d.start,u.end,u.layerId,u.width,u.locked);c.push(g)}}if(s){let a=this.getPolygon(n,e);if(n.flat(1).forEach(l=>l.remove()),a!=null)return[a]}return null}deleteLine(t,e){let r=new Array,i=e.getChildrens(),n=new Set(t);for(let s of i){let a=s.length;if(n.size==a||a<=1)return r;let l=0;if(e.isClose())for(let c=0;c<a&&!n.has(s[c]);c++)l++;for(let c=l;c<a+l;c++){let h=new Array;for(;c<a+l&&!n.has(s[c%a]);)h.push(s[c%a]),c++;if(h.length){let u=this.getPolygon([h],e);u&&r.push(u)}}}return r}getPolygon(t,e){let r=new Array;for(let i=0;i<t.length;i++){let n=t[i];if(t.length>0){if(pd(e.type)&&!xu(n.map(a=>a.primitive))){for(let a of n)a.remove(),ie.publish("delete",a);return null}let s=this.conversionModel(n);s=Nm(s),s.length>0&&r.push(s)}}return r.length>0?pt.addPolygon(e.type,e.layerId,r,e.strokeWidth,e.net,e.locked):null}conversionModel(t){let e=new Array,r=new io;return t.forEach(i=>{let n=r.clone4(i.model);e.push(n)}),e}delete(t){}deleteItems(t){}},gXe=new MOe;function yXe(){let o=new Jt;if(o.add("CANCEL",!0),x.getInstance().doctype==3){let e=Ve.getSelects();Bo(e[0])&&$t.getPick(8)&&bb&&o.add("CROSSPROBE",!0)}return o.add("CONVERT_TO_FILL_REGION"),o.add("ADAPT_SELECTED"),o.addExtend("HIGHLIGHT",Bm(),!0),o.add("DELETE"),o.add("SETUP_WINDOWINGAREA",!0),Lo.getInstance().getNeedAnnotation()&&o.add("ANNOTATION"),o.add("ATTRIBUTE"),x.getInstance().doctype==3&&!x.getInstance().isPreview&&o.addExtend("REUSE_BLOCK",Fm()),o}var hue=class{constructor(){this.isTabSwitch=!1}switchItemSelect(t){A.publish("clearSelect","");for(let e of t)e.click();A.publish("select",t),Ve.crossWindow()}};var uue=class extends hue{switchRange(){let t=this.tabSwitchMsg,e=t.selectItem;switch(t.type){case"Track":t.range=this.switchByTrack(t.range,e);break;case"Pad":t.range=this.switchByPad(t.range,e);break;case"PcbText":t.range=this.switchByAtrr(t.range,e);break;case"Component":t.range=this.switchByComponent(t.range,e);break;case"LineModel":t.range=this.switchByLine(t.range,e);break}this.isTabSwitch=!0,this.tabSwitchMsg=t}switchByTrack(t,e){switch(t){case"single track":let r=new jf(e,!1).all;return this.switchItemSelect(r),"whole track";case"whole track":let i=e.net;if(i){let n=ze.getSameNetItemsWithoutPourAndPlaneZone(i);return this.switchItemSelect(n),"whole net"}case"whole net":return this.switchRangeItem(e,"single track")}}switchByPad(t,e){switch(t){case"pad":return this.switchRangeItem(e,"single component",void 0,!0);case"single component":return this.switchRangeItem(e,"component group","pad",void 0,!0);case"component group":return this.switchRangeItem(e,"pad")}}switchByAtrr(t,e){switch(t){case"attr":return this.switchRangeItem(e,"single component",void 0,!0);case"single component":return this.switchRangeItem(e,"component group","attr",void 0,!0);case"component group":return this.switchRangeItem(e,"attr")}}switchByComponent(t,e){switch(t){case"single component":return this.switchRangeItem(e,"component group",void 0,void 0,!0);case"component group":return this.switchRangeItem(e,"single component")}}switchByLine(t,e){switch(t){case"single line":return this.switchRangeItem(e,"whole line",void 0,!0);case"whole line":return this.switchRangeItem(e,"single line")}}startSwitch(t){let e=t[0];e instanceof Ue?this.tabSwitchMsg=this.singleSelect(e,"Track","whole track"):e instanceof Le?this.tabSwitchMsg=this.singleSelect(e,"Pad","single component"):e instanceof fr&&e.key!=""?this.tabSwitchMsg=this.singleSelect(e,"PcbText","single component"):e instanceof Me?this.tabSwitchMsg=this.singleSelect(e,"Component","component group"):(e instanceof mt||e instanceof vt)&&(this.tabSwitchMsg=this.singleSelect(e,"LineModel","whole line")),this.isTabSwitch=!0}switchRangeItem(t,e,r,i=!1,n=!1){var s;if(i){let a=t.getParent();a&&this.switchItemSelect([a])}else if(n){let a=r?(s=t.getParent())==null?void 0:s.getGroupID():t.getGroupID();if(a){let l=kt.getItem(a).getItems();this.switchItemSelect(l)}else if(r)return this.switchItemSelect([t]),r}else this.switchItemSelect([t]);return e}singleSelect(t,e,r){if(t instanceof Ue){let i=new jf(t,!1).all;this.switchItemSelect(i)}else if(t instanceof Me){let i=t.getGroupID();if(i){let n=kt.getItem(i).getItems();this.switchItemSelect(n)}else r="single component"}else{let i=t.getParent();i&&this.switchItemSelect([i])}return{selectItem:t,type:e,range:r}}};var due=class{constructor(){this.components=new Set}add(t){let e=t.getParent();e instanceof Me&&!Ve.highlight.isItemHighlighted(e.globalIndex)&&!Ve.getSelects().includes(e)&&(this.components.add(e),e.click())}clear(){this.components.forEach(t=>t.visible()),this.components.clear()}};var NOe=class{constructor(t,e){this.items=new Array;this.pls=new Array;this.items=t,this.pls=e}},pue=class{mergePads(t){let e=new mi;e.createGroup("merge pads");let r=this.getMergeGroup(t);for(let i of r)i.items.length>1&&this.mergePadGroup(i,e);e.execute()}getMergeGroup(t){let e=new Array,r={};for(let n=0,s=t.length;n<s;n++){let a=t[n],l=r[a.globalIndex];l==null&&(l=new Set,r[a.globalIndex]=l),l.add(a);let c=this.getPadMathGraphics(a);for(let h=n+1;h<s;h++){let u=t[h],d=r[u.globalIndex];if(d==null&&(d=new Set,r[u.globalIndex]=d),d.add(u),u.buildBBox().isIntersect(a.buildBBox())){let p=this.getPadMathGraphics(u),{relation:m}=new fc(c,p,0);m!==3&&(l.add(u),d.add(a))}}}let i=new Set;for(let n in r)if(!i.has(n)){let s=new Array,a=new Set;for(s.push(n);s.length>0;){let u=s.pop();i.add(u);let d=r[u];for(let p of d)i.has(p.globalIndex)||s.push(p.globalIndex),a.add(p)}let l=new Array,c=new Array;for(let u of a)c.push(u),l.push(this.getPadMathGraphics(u));let h=new NOe(c,l);e.push(h)}return e}getPadMathGraphics(t){if(gr(t.layerId)){if(t instanceof Ri){let e=1;return t.getMathGraphics(e)}if(t instanceof fn){let e=1;return t.getMathGraphics(e)}}else return t.getMathGraphics()}mergePadGroup(t,e){let r=nC(t.pls),i=new Array;for(let y of r)y.isClose()&&i.push(y);let n=i[0],s=0,a=!0,l=new Sm(n.primitives),c=Pd(t.items.map(y=>y.num))[0],u=t.items.filter(y=>y.layerId===12).length?12:t.items[0].layerId;t.items.forEach(y=>{e.addCommand4Item(y,"delete"),A.publish("delete",y),y.remove()});let d=l.high*.3,p=fe.build2([q.build2(l.center,0,360,d,d,le.CCW)]),m=!0;do{let y=!1;Fn(n.primitives,(b,P)=>{let T=P.stroke(.1,kr.ROUND,le.CW);if(new Fs(T,p,0).relation===0&&d>0){if(y=!0,d=d*.9,d=d<.01?0:d,d==0)return;p=fe.build2([q.build2(l.center,0,360,d,d,le.CCW)])}}),y||(m=!1)}while(m);let g=Kt.addPolygonPad(u,`${c}`,l.center,s,n,"",!1,1,.4,.4,.4,[],a,1,d,"ROUND",0,rt.defalutPad.holeOffset);e.addCommand4Item(g,"add")}};var kOe=class{constructor(){this.preItems=Array();this.locked=!0;this.selectItem=null}onMouseLeftDown(t){let e=new S(t.realSceneX,t.realSceneY),r=Ve.getSelects();if(!t.ctrlKey&&this.selectItem?this.isSelectItem(this.selectItem,e)?this.locked=!1:this.resetStatus():this.resetStatus(),r.length&&!this.selectItem){let i=r.filter(n=>this.isSelectItem(n,e))[0];this.selectItem=i,this.selectItem&&!this.preItems.length&&(this.preItems=r)}}onDoubleClick(t){let{locked:e,selectItem:r}=this,i=this.preItems;this.resetStatus();let n=XG(i);if(!(e||t.ctrlKey||!r||!n.length)){for(let s of i)if(s.isEmpty){i=Ve.getSelects();break}A.publish("toggle",{command:"insertNode",selects:i,ready:!0,position:new S(t.realSceneX,t.realSceneY)})}}resetStatus(){this.locked=!0,this.selectItem=null,this.preItems=[]}isSelectItem(t,e){if(t.isEmpty)return!1;if(t instanceof nr||t instanceof Sr)return t.isSelectOnlyLine(e.x,e.y);if(t instanceof ct)return t.onlyOutline(e.x,e.y);if(t instanceof Ue){let r=t.start.distance1(e)<1e-8,i=t.end.distance1(e)<1e-8;return t.isSelect(e.x,e.y)&&!r&&!i||this.checkSelectTrackEndPoint(t,e)}return t.isSelect(e.x,e.y)}checkSelectTrackEndPoint(t,e){let r=t.start.distance1(e)<1e-8,i=t.end.distance1(e)<1e-8;if(r||i){let n=new Nu(t);switch(r?n.startType:n.endType){case 5:case 7:case 6:case 8:case 0:return!0}return!1}}},BOe=new kOe;function jRt(o){let t="";for(let e=0;e<o.length;e++){let r=o[e].getParent();if(!r)return!1;if(e===0){t=r.globalIndex;continue}if(t!==r.globalIndex)return!1}return!0}function bXe(o){let t=Ve.getSelects(),e=[];t.forEach(a=>{a instanceof ii&&e.push(a)});let r=new Jt;if(r.add("CANCEL",!0),x.getInstance().doctype==3){let a=Ve.getSelects();Bo(a[0])&&$t.getPick(8)&&bb&&r.add("CROSSPROBE",!0)}let i=new Jt;return jRt(e)&&i.add("SELECT_PARENT",!1),i.add("SELECT_CONNECTED_THERMALS",!1),r.addExtend("SELECT",i,!0),r.add("CONVERT_TO_FILL_REGION",!1),e.some(a=>a instanceof ii&&[1,2].includes(a.layerId))&&r.add("ADD_SOLDER_MASK"),r.add("ADAPT_SELECTED",!1),r.addExtend("HIGHLIGHT",Bm(),!0),r.add("DELETE"),Lo.getInstance().getNeedAnnotation()&&r.add("ANNOTATION"),r.add("ATTRIBUTE"),x.getInstance().doctype==3&&!x.getInstance().isPreview&&r.addExtend("REUSE_BLOCK",Fm()),r}var FOe=class{constructor(){this.timeOut=null;this.objs=new Array;this.groups=new Array}addObj(t,e){this.objs.push({attr:{id:t,pcbid:x.getInstance().tabId},text:`${ur}${e}`})}addGroup(t,e){this.groups.push({attr:{id:t,pcbid:x.getInstance().tabId},text:`${e} (${t})`})}execute(){this.timeOut!=null&&(clearTimeout(this.timeOut),this.timeOut=null),this.timeOut=setTimeout(()=>{ie.publish("ui/toastMsg",{type:"error",msg:"Object has been deleted, exited group",bottomBarMsg:{type:"warn",msg:['<span class="i18n">Object</span>',...this.objs,'<span class="i18n">has been deleted, exited group </span>',...this.groups]}},$()),this.objs.length=0,this.groups.length=0,this.timeOut=null},10)}executeTrack(){this.timeOut!=null&&(clearTimeout(this.timeOut),this.timeOut=null),this.timeOut=setTimeout(()=>{ie.publish("ui/toastMsg",{type:"error",msg:"Track has been stretched, exited group",bottomBarMsg:{type:"warn",msg:['<span class="i18n">Track</span>',...this.objs,'<span class="i18n">has been stretched, exited group </span>',...this.groups]}},$()),this.objs.length=0,this.groups.length=0,this.timeOut=null},10)}},VC=new FOe;function XRt(){let o=document.querySelector(window.canvas_2d_selector||"#canvas-2d")||document.getElementById("canvas");return o instanceof HTMLCanvasElement||(o=document.createElement("canvas")),o.style.width="100%",o.style.height="100%",o}var z_=XRt();function bd(o){z_.style.cursor=o,document.documentElement.style.cursor=o}var fue=class{constructor(t,e,r){this.shape=t,this.layer=e,this.clearance=r}getPolylines(){let t=new Array;if(this.shape instanceof Ns||this.shape instanceof ag){let e=this.shape.shape(this.layer,this.clearance).closeEndpoint();t.push(e)}else if(this.shape instanceof O0){if(this.layer.equals($r.MULTI)&&this.layer.equals(this.shape.layer)){let e=this.shape.shape(this.layer,this.clearance).closeEndpoint();t.push(e)}else if(!this.shape.isUnuseLayers(this.layer)){let e=this.shape.shape(this.layer,this.clearance).closeEndpoint();t.push(e)}}else if(this.shape instanceof Ll||this.shape instanceof qy){if(this.layer.equals($r.MULTI)){let e=this.shape.shape($r.MULTI,this.clearance).closeEndpoint();t.push(e)}else if(!this.shape.isUnuseLayers(this.layer)){let e=this.shape.shape(this.layer,this.clearance).closeEndpoint();t.push(e)}}else if(this.shape instanceof vT||this.shape instanceof $y||this.shape instanceof of){let e=this.shape.shape(this.layer,this.clearance).closeEndpoint();for(let r of e.primitives){let i=r.stroke(this.clearance*2,kr.ROUND,le.CCW).closeEndpoint();t.push(i)}}else if(this.shape instanceof Mf){let e=this.shape.shape(this.layer,this.clearance);for(let r of e.primitives){let i=r.stroke(this.clearance*2+this.shape.width,kr.ROUND,le.CCW).closeEndpoint();t.push(i)}}else if(this.shape instanceof U1){let e=this.shape.shape(this.layer,this.clearance).closeEndpoint();t.push(e)}else if(this.shape instanceof sP){let e=this.shape.shape(this.layer,0).closeEndpoint();t.push(e)}return t.filter(e=>e)}};var VOe=class{constructor(){this._infos=new Array;this._backup=new Array;this.lines=new Array;this.sourceOutlines=new Array}add(t,e,r){let i=new fue(t,e,r);this._infos.push(i)}backup(){this._backup=this._infos,this._infos=new Array}recover(){this._infos=this._backup,this._backup=new Array}clear(){this._infos.length=0;for(let t of this.lines)t.remove();this.lines.length=0}getInfos(){return Array.from(this._infos)}displayCollideInfo(){for(let t of this.lines)t.remove();this.lines.length=0;for(let t of this._infos){let e=t.getPolylines();for(let r of e)this.displayPolyline(r)}}displayPolyline(t){if(t!=null){let e=dP(t.primitives,1002);for(let r of e)r.color=ee.WHITE,this.lines.push(r)}}displaySource(){for(let t of d2.sourceOutlines)d2.displayPolyline(t)}},d2=new VOe;var mue=class{constructor(t,e){this.shapeBool=new Kc;this.mergeInstance=new C9(.1,.1);this.hasLockedItems=!1;this.selectCache=t,this.selectedItems=t.filter(r=>r.locked?(this.hasLockedItems=!0,!1):!(r instanceof Me)),this.groupCommand=e||new ve("Execute Clip Polyline"),this.newPolygons=[],this.splitLineSubscribe=A.messageBus.subscribe("sendSplitLine",this.sendSplitLine.bind(this)),this.selectedItems&&A.publish("selecting",{items:this.selectedItems,triggerFrom:"COMMON"})}getSplitLine(){return this.polylines}sendSplitLine(t){if(!t||t.length==0)return;let e=t[0];if(t.some(i=>i.isEmpty))return;let r=t.flatMap(i=>i.getMathGraphics().primitives);this.polylines=r.map(i=>i.stroke(e.strokeWidth,kr.ROUND,le.CW).asClose());for(let i of t)i.remove(),A.publish("delete",i)}handleSplitLine(){let t=this.shapeBool.normalizeData(this.polylines,3).items;t[0].items.length&&(this.polylines=t.flatMap(e=>e.items))}runSplit(){if(this.hasLockedItems&&A.publish("ui/toastMsg",{type:"error",msg:"The element is locked. Please unlock it and try again."},$()),this.selectedItems=this.selectedItems.filter(r=>!r.isEmpty),this.selectedItems.length==0)return;let t=this.getFilteredItems(UOe),e=this.getFilteredItems(HOe);this.runBooleanItems(t),this.handleSplitLine(),this.runIntersectItems(e),A.publish("autoFill",""),A.publish("updateRtree",""),A.publish("updateFrame",""),A.publish("flushSelectingInfo",""),this.groupCommand.length>0&&(A.publish("selecting",{items:this.selectedItems,triggerFrom:"COMMON"}),je.executeCommand(this.groupCommand)),this.clearCache()}getFilteredItems(t){return this.selectedItems.filter(t)}runBooleanItems(t){for(let e of t){if(e.isEmpty||this.polylines.every(a=>!e.buildBBox().intersection1(a.bbox())))continue;let r=e.getMathGraphics(),i;r instanceof fe?i=[r]:i=r.items;let n=this.shapeBool.getSubtraction(i,this.polylines);if(!["FPC Stiffener","Fill Region"].includes(e.type)&&n.some(a=>a.items.length>1)){A.publish("ui/toastMsg",{type:"error",msg:"Split failed, non-stiffener region and non-fill region doesn't support for internal split."},$());continue}this.processClippedPolylines(n,e),this.newPolygons.length>0&&this.resetSelectedItems(this.newPolygons,e),this.newPolygons=[]}}resetSelectedItems(t,e){let r=this.selectedItems.indexOf(e);t.forEach((i,n)=>{r!==-1&&(n==0?this.selectedItems.splice(r,1,i):this.selectedItems.splice(r+n,0,i))}),this.selectedItems.forEach(i=>!i.isEmpty&&i.click())}runIntersectItems(t){let e=new Map;for(let r of t){if(r.isEmpty)continue;let i=this.clipWithIntersection(r);if(i){let{items:n,profileItems:s}=i;s&&s.forEach((a,l)=>{if(e.has(l)){let c=e.get(l)||[];e.set(l,[...c,...a])}else e.set(l,a)}),n.length>0&&r instanceof Ue&&this.resetSelectedItems(n,r)}}this.mergePolygon(e)}mergePolygon(t){if(t&&t.size>0)for(let[e,r]of t){let i=r.map(s=>s.getGroupID()).filter(Boolean),n=i.length>0?i[0]:null;this.mergeInstance.build(r,(s,a)=>{var l;if(je.stack&&je.stack.description=="merge polygon"&&(je.stack.commands.forEach(c=>this.groupCommand.addCommand(c)),je.stack=null),s.forEach(c=>{A.publish("delete",c),c.remove()}),r.length!==s.length&&r.filter(h=>!s.includes(h)).forEach(h=>{h instanceof ct&&a.push(h)}),this.resetSelectedItems(a,e),n){let c=(l=kt.getItem(n))==null?void 0:l.name;kt.joinCombination(a,n),a.forEach(h=>{h.setGroupID(n);let u=this.groupCommand.commands.find(d=>d.gId==h.globalIndex);u&&(u.groupId=n,u.groupName=c)})}})}}add2Command(t,e="add"){let r=Te.dispatch(t,e);this.groupCommand.addCommand(r)}clipWithIntersection(t){if(this.polylines.every(n=>!t.buildBBox().intersection1(n.bbox())))return;let e;t instanceof Ue?e=[t.primitive]:t instanceof Ye&&(e=t.getMathGraphics().primitives);let r=!1,i=[];for(let n=0;n<e.length;n++){let s=e[n];if(!s.start().equals1(s.end())){let u=this.getPointRelation(s.start()),d=this.getPointRelation(s.end());if(u===1&&d===1||u===1&&d===2||u===2&&d===2){r=!0;continue}}let l=new Array;for(let u of this.polylines)this.findIntersections(s,u).forEach(p=>{l.push(p)});if(this.polylines[0].start().equals1(this.polylines[0].end())&&dn(l,s),l.length===0){i.push(s);continue}let h=this.breakPrimitive(s,l);if(h.length>0){r=!0;for(let u of h)i.push(u)}}if(r){let n=new Array,s=new Map;if(t instanceof Ye){let a=new au;i.forEach(l=>{let c=a.create4Pt("Line",t.layerId,l,t.strokeWidth,t.net,!1);n.push(c)}),n.forEach(l=>{let c=s.get(t)||[];s.set(t,[...c,l])})}else t instanceof Ue&&i.forEach(a=>{if(a instanceof M){let l=pr.addTrack(t.layerId,a.start(),a.end(),t.width,!1,t.net);n.push(l)}else if(a instanceof q){let l=pr.addArcTrack(t.layerId,a.center,a.rx,Ht.toRadians(a.startAngle),Ht.toRadians(a.endAngle()),a.sweep(),t.width,!1,t.net);n.push(l)}});return this.adjustCombinationInfo(t,n),this.add2Command(t,"delete"),n.forEach(a=>this.add2Command(a)),t.remove(),A.publish("delete",t),{items:n,profileItems:s}}}breakPrimitive(t,e){let i=[],n=t.start(),s=t.end(),a=this.polylines.length>1,l=e.filter(h=>!this.equals(h,n,1e-6)&&!this.equals(h,s,1e-6)),c=h=>{let u=[];if(h instanceof M){let d=h.start().add(h.end()).mul(.5);u.push(h.start(),h.end(),d)}else if(h instanceof q){let d=h.pointOn(h.startAngle+h.sweepAngle/2);u.push(d)}if(a){let d=this.polylines[0],p=u[u.length-1];return this.pip(p,d)&&!this.polylines.slice(1).some(m=>this.pip(p,m))}else return u.every(d=>this.polylines.every(p=>this.pip(d,p)))};if(t instanceof q&&t.sweepAngle===360)for(let h=0;h<l.length;h++){let u=(h+1)%l.length,d=q.build4(l[h],l[u],t.center,t.rx,t.ry,t.sweep());d&&!c(d)&&i.push(d)}else{let h=n;for(let d of l){let p;t instanceof M?p=new M(h,d):t instanceof q&&(p=q.build4(h,d,t.center,t.rx,t.ry,t.sweep())),p&&!c(p)&&i.push(p),h=d}let u;t instanceof M?u=new M(h,s):t instanceof q&&(u=q.build4(h,s,t.center,t.rx,t.ry,t.sweep())),u&&!c(u)&&i.push(u)}return i}equals(t,e,r){return t.distance2(e)<r}pip(t,e){return Jr.inPolyline(t,e,void 0,void 0,.001)}getPointRelation(t){for(let e of this.polylines){let r=Jr.inEdge4Polyline(t,e),i=this.pip(t,e);return r?1:i?2:3}}findIntersections(t,e){let r=t.end(),i=t.bbox(),n=new Ba;n.add(r);for(let a of e.primitives){let l=a.bbox();if(!i.isIntersect(l))continue;let c=Tt(t,a);for(let h=0;h<c;h+=2){let u=new S(Ee[h],Ee[h+1]);n.add(u)}}let s=this.sortInters(n,t);if(s.length>0)return s.filter(a=>!a.equals1(r))}sortInters(t,e){let r=t.iterator(),i=new Array;for(;r.hasNext();){let n=r.next();i.push(n)}return dn(i,e)}getCopper(){return[...Zt.getAllItem(),...Xt.getAllItem(),...pt.getAllItem()].filter(e=>e.type=="Copper Region")}adjustCopperInfo(t){if(t.type!=="Copper Region"||this.newPolygons.length==0)return;this.newPolygons.sort((n,s)=>{let a=n.buildBBox().area();return s.buildBBox().area()-a});let e=this.newPolygons[0],r=t.getComponent();Ei.nameManager.deleteNum(r.name),e.component.name=r.name,e.component.order=r.order,Ei.nameManager.add(r.name);let i=this.getCopper().filter(n=>!(n instanceof ct&&this.newPolygons.includes(n))).map(n=>n.component.name);gn.insertAfter(this.newPolygons.slice(1),e,this.groupCommand),this.newPolygons.slice(1).forEach((n,s)=>{let a=`${r.name}-${s+1}`,l=s+1;for(;i.includes(a);)l++,a=`${r.name}-${l}`;n.component.name=a,i.push(a),Ei.nameManager.add(a)})}adjustCombinationInfo(t,e){let r=c=>c instanceof mt?{id:c.getParent().getGroupID(),globalIndex:c.getParent().globalIndex,number:c.getParent().number}:{id:c.getGroupID(),globalIndex:c.globalIndex,number:c.number},{id:i,globalIndex:n,number:s}=r(t);if(i==null)return;let a=kt.getItem(i),l=a.getItems();if(e.length===0&&l.length>=1){let c=a.name;VC.addObj(n,s),VC.addGroup(i,c),VC.execute()}kt.joinCombination(e.filter(c=>c!==t),i),e.length===0&&l.length<=1&&(this.add2Command(a,"delete"),setTimeout(()=>{A.publish("delete",a)},10))}processClippedPolylines(t,e){let r=new au;this.add2Command(e,"modify"),t.forEach(i=>{let n=r.create4PlGrp(e.type,e.layerId,i,e.strokeWidth,e.net,!1);if(["FPC Stiffener","Fill Region","3D Shell - Side Slot Region"].includes(e.type)){let s=JSON.stringify(e.getComponent());new Nl(s,n.type).rebuildComponent(n)}this.newPolygons.push(n)}),this.adjustCopperInfo(e),this.adjustCombinationInfo(e,this.newPolygons),this.newPolygons.forEach(i=>this.add2Command(i)),this.add2Command(e,"delete"),e.remove(),A.publish("delete",e),e instanceof ct&&e.keepOutline(),A.publish("hasModifyPcbItem",e)}clearCache(){this.polylines=null,this.groupCommand=new ve("Execute Clip Polyline")}clearView(){d2.clear(),[...this.selectedItems,...this.selectCache].forEach(t=>!t.isEmpty&&t.visible())}clearSubscribe(){this.splitLineSubscribe.cancel()}};function UOe(o){return["Fill Region","FPC Stiffener","Copper Region","Slot Region","Prohibited Region","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Side Entity","3D Shell - Top/Bottom Entity"].includes(o.type)}function HOe(o){if(o instanceof Ue)return!0;if(o instanceof Ye)return["Line","Board Outline"].includes(o.type);let t=o.getParent();return t instanceof Ye?["Line","Board Outline"].includes(t.type):!1}var PXe=new Set(["Board Outline","Copper Region","Fill Region","Slot Region","Prohibited Region","FPC Stiffener","Constraint Region"]),gue=new Set(["Fill Region","FPC Stiffener"]);function yue(o,t,e,r,i,n){let s=!1,a=!1,l=new ZT;for(let V of o)if(!s&&!(V instanceof Ki||V instanceof _n)&&(s=!0),!a&&!l.isUnique(V)&&(a=!0),s&&a)break;let c=a,h=s,u=o.length>1,d=t.length>0,p=!1,m=$t.getPick(8),g=0,y=new Array,b=o.length>0,P=!1,T=!1,I=0,C={},E={},O=0,_=0;for(let V of o)if(V instanceof Le)g++,p=m&&!0,b=!1,P=P||V.getParent()==null,T=T||V.getParent()==null;else if(V instanceof Ge)p=m&&!0,b=!1,T=!0;else if(V instanceof Ue)p=m&&!0,P=!0,T=!0,_++;else if(V instanceof Ye)p=m&&!0,P=!0,T=!0,y.push(V),I<2&&!r$(V)&&I++,V.getParent()==null&&PXe.has(V.type)&&(C[V.type+V.layerId]?C[V.type+V.layerId]+=1:C[V.type+V.layerId]=1),gue.has(V.type)&&(E[V.type+V.layerId]?E[V.type+V.layerId]+=1:E[V.type+V.layerId]=1),V instanceof ct&&gue.has(V.type)&&V.isComplexPolygon()&&O++;else if(V instanceof A0)p=m&&!0,b=!1,T=!0;else if(V instanceof mt||V instanceof vt){if(p=m&&!0,P=!0,T=!0,V instanceof mt||V instanceof vt){let Y=V.getParent();Y instanceof Ye&&(y.push(Y),I<2&&!r$(Y)&&I++,Y.getParent()==null&&PXe.has(Y.type)&&(C[Y.type+Y.layerId]?C[Y.type+Y.layerId]+=1:C[Y.type+Y.layerId]=1),gue.has(Y.type)&&(E[Y.type+Y.layerId]?E[Y.type+Y.layerId]+=1:E[Y.type+Y.layerId]=1),Y instanceof ct&&gue.has(Y.type)&&Y.isComplexPolygon()&&O++)}}else p=p||m&&Bo(V)!=null,b=!1,V instanceof _n||V instanceof Nh||(P=!0,T=!0);let R=_==o.length,v=g>0,D=t.length==o.length&&t.length>0,w=t.length==o.length&&t.length==2;i=i&&t.length!==o.length;let F=y.length>0,H=F&&j5.filterD3Shell(y).length===0,z=I>=2,G=Object.values(C).some(V=>V>=2)||g>=2,W=Object.values(E).some(V=>V>=2),L=O>0,B=qRt(o),N=$Rt(o),U=y.some(V=>UOe(V))||o.some(V=>HOe(V)),k=y.some(V=>V.type=="Line");return{hasSelected:s,rotate:c,canCopy:a,flipMenu:h,hasMoreThanOneSelected:u,hasSelectedDevice:d,hasSelectedPad:v,hasSelectedNet:p,onlyAbstractProfile:b,canDupToOtherLayer:P,canDupToCursor:T,onlyDevice:D,twoDevice:w,joinGroup:e,ungroupSelected:r,route:n,flip:i,has2DLine:F,canDispersedLine:H,hasMultiUnCloseLine:z,canIntersectionAggregate:G,canSubtractionExclusive:W,canBooleanSplit:L,canSplit:U,canCutout:B,hasPoly2DLine:k,canConvert2dLine:R||F,hasBoard:!!Cs.getInstance().board,canAvoidSlotsOrPads:N}}function qRt(o=Ve.getSelects()){if(!o.length)return!1;let t=o.every(a=>((a instanceof mt||a instanceof vt)&&(a=a.getParent()),a instanceof Ye&&a.type=="Copper Region")),e=o.every(a=>a instanceof Ki),r=o.every(a=>((a instanceof mt||a instanceof vt)&&(a=a.getParent()),a instanceof Ye&&a.type=="Fill Region")),i=o.every(a=>((a instanceof mt||a instanceof vt)&&(a=a.getParent()),a instanceof Ye&&a.type=="FPC Stiffener")),n=o.every(a=>a instanceof Ue);return t||e||r||i||n}function $Rt(o){return o||(o=Ve.getSelects()),o.length==0?!1:sOe(o).length>0}var WOe=class{getCrossProbeData(t=Ve.getItems()){let e={pad:[],component:[],designator:[]};return $t.getPick(8)&&(e.nets=[]),t.length&&(t=t.filter(r=>{if(e.nets){let i=Bo(r);i&&!e.nets.includes(i)&&e.nets.push(i)}return r instanceof Le||r instanceof Me}),Fn(t,(r,i)=>{if(i instanceof Le){let n=i.getParent();if(n!=null&&n instanceof Me){let s=n.attrKeyValue["Unique ID"],a=n.attrKeyValue.Designator;(s||a)&&e.pad.push({groupUniqueId:s,padNum:i.num,groupDesignator:a})}}i instanceof Me&&(i.attrKeyValue["Unique ID"]&&e.component.push(i.attrKeyValue["Unique ID"]),i.attrKeyValue.Designator&&e.designator.push(i.attrKeyValue.Designator))})),e}notifySchToCrossProbe(t=!1){ie.messageBus.rpcCall("getPcbCrossProbeToSchData").then(e=>{let{rule:r,hasSelected:i}=e.message,n={isManualTrigger:!0,isCrossProbeTool:t};ie.windowBridge.publish("cross-window",{selectObj:r,otherData:n,cmd:"crossProbeBetweenWindows"},$())})}},mw=new WOe;var bue=class{constructor(t){let e=t.filter(r=>this.validItems(r));this.selectItems=new Set(t),this.backspaceItems=new Set(e),this.deleteItems=new Set}validItems(t){return t instanceof Ue||t instanceof Ge}backspace(t){let e=this.filter=new Set,r=Array.from(this.backspaceItems);this.backspaceItems=new Set,r.forEach(i=>{e.has(i.globalIndex)||this.backspaceItem(i)}),this.deleteItem(t),this.completeOneBack()}completeOneBack(){this.filter=new Set,this.deleteItems=new Set}getSelectItem(){let t=new Set;return this.backspaceItems.forEach(e=>{t.add(e)}),this.selectItems.forEach(e=>{e.isEmpty||t.add(e)}),t}deleteItem(t){this.deleteItems.forEach(e=>{t.addCommand(Te.dispatch(e,"delete")),e.remove(),ie.publish("delete",e),ie.publish("hasModifyPcbItem",e)})}backspaceItem(t){t instanceof Ue?this.backsSpaceTrack(t):t instanceof Ge&&this.backSpaceVia(t)}backsSpaceTrack(t){var a,l,c;let e=xt.getInstance().getNode(t.model);e||(new ku(t.model).generateList(),e=xt.getInstance().getNode(t.model));let r=e.parent,i=new er,n=!0,s=!0;if(r.viaNode.prev&&r.viaNode.prev==r.viaNode.next||r.otherNode.prev&&r.otherNode.prev==r.otherNode.next){let h=((a=r.viaNode.next)==null?void 0:a.item)||r.otherNode.next,u=r.getFirst().start.distance2(h.center),d=r.getLast().end.distance2(h.center);ne.eq(u,d)||(ne.less(u,d)?s=!1:n=!1)}if(e.next==null&&(!s||!this.validEnd(r.endType))&&(e.prev||this.validEnd(r.startType))){this.addFilterData(t),r.pop(),this.deleteItems.add(t);let h=r.getLastNode(),u=(h==null?void 0:h.item)||((l=r.viaNode.prev)==null?void 0:l.item)||r.otherNode.prev;if(u){let d=i.getItem(u.globalIndex);this.backspaceItems.add(d)}}else if(e.prev==null&&(!s||!this.validEnd(r.startType))&&(e.next||this.validEnd(r.endType))){this.addFilterData(t),r.shift(),this.deleteItems.add(t);let h=r.getFirstNode(),u=(h==null?void 0:h.item)||((c=r.viaNode.next)==null?void 0:c.item)||r.otherNode.next;if(u){let d=i.getItem(u.globalIndex);this.backspaceItems.add(d)}}}addFilterData(t){let r=xt.getInstance().getNode(t.model).parent;if(r.getAllItems().forEach(i=>{this.filter.add(i.globalIndex)}),r.viaNode.prev){let i=r.viaNode.prev.item;this.filter.add(i.globalIndex)}if(r.viaNode.next){let i=r.viaNode.next.item;this.filter.add(i.globalIndex)}}validEnd(t){return t==1||t==2}backSpaceVia(t){var r,i;let e=t.searchCycleNodeTrack().filter(n=>n instanceof Ue);if(e.length==1){this.deleteItems.add(t);let n=e[0];this.backspaceItems.add(n);let s=xt.getInstance().getNode(n.model);if(s){let a=s.parent;((r=a.viaNode.prev)==null?void 0:r.item)==t.model?a.viaNode.prev==null:((i=a.viaNode.next)==null?void 0:i.item)==t.model&&a.viaNode.next==null}}}complete(){xt.getInstance().clear(),_i.getInstance().clear()}};var TXe={0:"ns-resize",1:"ew-resize",2:"nesw-resize",3:"nwse-resize",5:"move"};var zOe=class{switch(t){if(t===4){z_.style.removeProperty("cursor"),document.documentElement.style.removeProperty("cursor");return}bd(TXe[t])}switchByPointType(t,e=0){let r=[3,1,2,0],i=Math.floor((e+Tu/8)%Vr/(Tu/4)%4);switch(t){case 3:return this.switch(r[i]);case 0:return this.switch(r[(i+3)%4]);case 1:return this.switch(r[(i+1)%4]);case 2:return this.switch(r[(i+2)%4])}}},YOe=new zOe;var ws=class{constructor(){this.mouseLeftDown=!1;this.moveStartPoint=null;this.lastPosition=S.ORIGIN;this.shiftMoveHelpLine=null}onMouseUpMove(t){return!1}onKeyDown(t){return!1}onMouseRightDown(t){return!1}onMouseRightUp(t){return!1}onDoubleClick(t){return!1}parse(t){}changleMouseStyle(t){bd(t)}changeNativeCursor(t){z_.style.cursor!=="grabbing"&&YOe.switch(t)}changeNativeCursor1(t,e){YOe.switchByPointType(t,e)}rotate(t){}createShiftMoveHelpLine(t,e){this.shiftMoveHelpLine?this.shiftMoveHelpLine.end=e:this.shiftMoveHelpLine=new hr(1002,t,e,!0)}removeShiftMoveHelpLine(){this.shiftMoveHelpLine&&(this.shiftMoveHelpLine.remove(),this.shiftMoveHelpLine=null)}shiftControl(t){this.moveStartPoint===null&&(this.moveStartPoint=new S(t.lastSceneX,t.lastSceneY),this.lastPosition=this.moveStartPoint);let e=new S(t.sceneX,t.sceneY),r=e.sub(this.lastPosition);if(t.shiftKey){let i=e.sub(this.moveStartPoint),n;Math.abs(i.x)>=Math.abs(i.y)?(n=new S(t.sceneX,this.moveStartPoint.y),r=n.sub(this.lastPosition)):(n=new S(this.moveStartPoint.x,t.sceneY),r=n.sub(this.lastPosition)),this.createShiftMoveHelpLine(this.moveStartPoint,n)}else this.shiftMoveHelpLine!=null&&this.removeShiftMoveHelpLine();return this.lastPosition=this.lastPosition.add(r),r}};var Pue=class extends oV{constructor(e,r,i,n,s,a=new Set){super(r,i,n,a);this.layerMap=new Map;this.via=e,this.constraintPoint=new Jg(this.via,s,S.ORIGIN,!0);let l=_i.getInstance().getViaNode(this.via);this.directFilter=n,this.directFilter.awaitShove.has(l)&&(this.directFilter.awaitShove.delete(l),this.directFilter.awaitingVias.add(l))}get net(){return this.via.net}closeShapeOnlyDrc(e){if(e.layerId==11){for(let[,r]of this.layerMap)if(r)return!1;return!0}else return e.layerId==1004?!1:e.layerId!=12&&!this.layerMap.get(e.layerId)}getPoint(){return this.constraintPoint.point}onlyDrc(e){return this.layerMap.get(e.layerId)?this.isWire?this.isInput(e):!1:!0}trackCheck(e,r,i,n){let s=Es.getInstance().getFirstPosition(this.via),a=this.block.blockTrackOnlyTrack(e,r?new M(this.constraintPoint.point,s||e.start):new M(s||e.end,this.constraintPoint.point),!0),l=this.constraintPoint.parentMap.get(e.layerId);if(l==null&&(l=new Jg(this.via,s,S.ORIGIN,!0),this.constraintPoint.setParent(e.layerId,l)),a.length>0)for(let c of a){let h=c.obstacle;if(!c.isSameNet&&h instanceof yt){let d=xt.getInstance().getListNode(h).parent;if(this.obstacles.has(d))continue;return this.addObstacle(d),i.set(n,a),!0}}return!1}init(){let e=0,r=_i.getInstance().getViaNode(this.via),i=new Map;for(let[c,h]of r.connectTrack)if(h){let d=c.getLastNode().item;if(this.trackCheck(d,h,i,c))break}else{let d=c.getFirstNode().item;if(this.trackCheck(d,h,i,c))break}let n=$e.getInstance().getAllCopperLayerIds(),s=Es.getInstance().getFirstPosition(this.via);for(let c of n)if(this.constraintPoint.parentMap.get(c)==null){this.layerMap.set(c,!1);let h=new Jg(this.via,s,S.ORIGIN,!0);this.constraintPoint.setParent(c,h)}else this.layerMap.set(c,!0);let a=!1,l=new Ba;do{a=!1;for(let[c]of r.connectTrack){let h=i.get(c);if(h!=null)for(let u of h){let d=u.obstacle;new gC(d,this.onlyDrc(d)).constraint(this.constraintPoint)&&!l.contains(this.constraintPoint.point)&&(a=!0,l.add(this.constraintPoint.point),this.constraintPoint.setConstraintObstacle(d))}}e++}while(a&&e<20)}getSize(){return Math.max(this.via.radius,this.via.holeRadius)}};function jOe(o){let t=new Set,e=new Set;for(let r of o){let i=n=>{t.has(n)?e.add(n):t.add(n)};if(r.viaNode){let n=r.viaNode.next,s=r.viaNode.prev;n&&i(n),s&&i(s)}}return Array.from(e)}function ZRt(o,t){for(let[e,r]of o.connectTrack)cn.lockedMap.set(e,!r),t&&t.push(e)}function J3(o,t,e,r=!1,i){let n=new i9;if(o.every(s=>s instanceof Ge)){let s=[];return o.forEach(a=>{let l=a.model,c=_i.getInstance().getNode(l);if(c==null){let h=new lC(l);h.generateList(),c=h.viaNode}if(c.isSource){i==null||i.set(a,c);let h=n.cloneVia(l,t),u=new g5(c,c.item,h);_i.getInstance().replace(l,h),t.addCommand(u),c.isSource=!1}r&&c.connectTrack.size>0?ZRt(c,s):s.push(c)}),s}else{if(o.every(s=>s instanceof Ue))return[];{let{tracks:s,vias:a}=o.reduce((u,d)=>(d instanceof Ue?u.tracks.push(d):d instanceof Ge&&u.vias.push(d),u),{tracks:[],vias:[]}),l=[];s.forEach(u=>{let d=xt.getInstance().getListNode(u.model);if(d&&d.parent){let p=d.parent;l.includes(p)||l.push(p)}});let c=u=>{let d=a.map(p=>p.model.globalIndex).findIndex(p=>p==u.item.globalIndex);d!==-1&&(b$(u.item,t),u.isSource=!1,e==null||e.set(u,!0),i==null||i.set(a[d],u))},h=jOe(l);h.forEach(u=>{c(u)});for(let u=0;u<l.length;u++){let d=l[u];if(d.viaNode.next||d.viaNode.prev){let m=d.viaNode.next,g=d.viaNode.prev;m&&!h.includes(m)&&c(m),g&&!h.includes(g)&&c(g)}}return a.forEach(u=>{let d=u.model;if(_i.getInstance().getNode(d)==null){let m=new lC(d);if(!m.starts.length&&!m.ends.length){let g=m.viaNode;c(g),l.push(g)}}}),l}}}function Tue(o){if(ce.pcbConfig.isPlaceViasAutoShove){let{newIds:t}=ji.getInstance().complete(o);return t}}function Q3(){ce.pcbConfig.isPlaceViasAutoShove&&(Jl.getInstance().clear(),ji.getInstance().clear(),Zl.getInstance().deleteAll(),hi.getInstance().clear(),xt.getInstance().clear(),_i.getInstance().clear(),_r.getInstance().clear(),gc.getInstance().clear())}function Iue(){cn.clear(),Fr.getInstance().clear(),_r.getInstance().clear(),Ra.getInstance().clear(),Es.getInstance().clear(),Os.getInstance().clear()}function b$(o,t,e){let r=_i.getInstance().getNode(o),n=new i9().cloneVia(o,t);e instanceof Function&&(n=e(n));let s=new g5(r,r.item,n);_i.getInstance().replace(r.item,n),t.addCommand(s)}function XOe(o,t,e,r=!1,i,n){let s=new ri,a=s.createList(),l=t,c=new Map;if(l.forEach(h=>{let u;if(h instanceof qr?u=s.createTrack(h.layerId,h.start,h.end,h.width,h.showNet,e,h.getGroupID()):h instanceof Oi&&(u=s.createArcTrack(h.layerId,h.center,h.radius,h.startAngle,h.endAngle,h.sweep,h.width,h.net,e,void 0,h.getGroupID())),n instanceof Function&&(u=n(u)),i){let d=Array.from(i).find(p=>p.globalIndex==h.globalIndex);c.set(d,u)}s.addList(u,a,e),r&&_r.getInstance().current.setTrackSelect(u.globalIndex)}),o.getFirstNode()&&o.getLastNode()&&a.replace(o.getFirstNode(),o.getLastNode(),o),e.addCommand(new Ti(a)),i)return c}function CXe(o){if(!o.every(e=>e instanceof Ue||e instanceof Ge))return!1;let t=o.filter(e=>e instanceof Ge);return!(t.length>20||!Hne(t.map(e=>e.center),78.65))}function JRt(o){var t,e;for(let r of o)if(r instanceof Kn){let i=((t=r.viaNode.prev)==null?void 0:t.isSource)==!1,n=((e=r.viaNode.next)==null?void 0:e.isSource)==!1;i&&Fr.getInstance().addInputStatus(r.getFirstNode()),n&&Fr.getInstance().addInputStatus(r.getLastNode())}else Fr.getInstance().addInputStatus(r)}function Cue(o,t,e){let r=t.item.center,i=Ae.translate(o.x,o.y,0);b$(t.item,e,n=>(n.transform(i),n)),t.isSource=!1,Es.getInstance().changeViaPosition(t.item,r)}function QRt(o){return["WIRING_MODE_PUSHAWAY"].includes(o)}function Sue(o,t){if(this.shoveData&&this.shoveData.length>0){let e=o.sub(t),r=tr.getInstance().mode,i=QRt(r);if(r!=="WIRING_MODE_IGNORE"){i&&(Nt.setPushFilter(),this.canPushViaLevel==0?Nt.pushFilter.setSolidViaFilterMode(!this.hugPrefered):Nt.pushFilter.setSolidFilterMode(!this.hugPrefered));let n=this.via.center.add(e),s=new Pue(this.node.item,performance.now()+20,!1,new S3,n);s.offset(),e=e.add(s.getPoint().sub(n)),i&&(Nt.filter=null)}return e}return o.sub(t)}function qG(o){o.remove(),pt.delete(o)}function _9(o,t,e=!1,r){let i=tr.getInstance().mode;if(["WIRING_MODE_SURROUND_AND_PUSHAWAY","WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"].includes(i)&&e)return;let n=na.getInstance(),s=o.filter(c=>c instanceof Kn),a;if(o.length&&s.length==o.length){let c=s.map(h=>{var d;let u=h.getFirstNode().item;if(u instanceof yt)return(d=Ot(u.primitive))==null?void 0:d.mul(-1).normalize()}).filter(Boolean);a=K6(c)}switch(i){case"WIRING_MODE_IGNORE":break;case"WIRING_MODE_OBSTRUCT":case"WIRING_MODE_SURROUND":{let c=new fb;try{JRt(o),c.run1(o,t,a)}catch(h){throw new Error(h)}break}case"WIRING_MODE_PUSHAWAY":case"WIRING_MODE_SURROUND_AND_PUSHAWAY":{let c=new dg(i=="WIRING_MODE_SURROUND_AND_PUSHAWAY");switch(n.pushVia){case"OPTIMIZA_OPEN":{c.canPushViaLevel=2;break}case"OPTIMIZA_NONE":{c.canPushViaLevel=0;break}default:c.canPushViaLevel=2}switch(n.pathOptimization4BePushed){case 1:{c.level="SUPER";break}case 0:{c.level="STRONG";break}case 2:{c.level="WEAK";break}default:c.level="WEAK"}c.inputLevel="NONE";try{c.run1(o,t,a)}catch(h){throw new Error(h)}break}}let l=ji.getInstance().view4Status(_r.getInstance().current);t.addCommand(l),hi.getInstance().update(),r&&lu.getInstance().showViaObstaclePl(r.item)}function Ab(){return te.getInstance().getDefaultOtherSpacing().deviceClearance}function gf(o,t){let e={isColliding:!0},r=SXe(o),i=SXe(t),n=[],s=[].concat(r,i);for(let c of s){let{mid:h,direct:u}=c,d=new S(-u.y,u.x),p=EXe(o,h,d),m=EXe(t,h,d),g=qOe(p,h,d),y=qOe(m,h,d),b=eDt(g,y,h,d);if(b==null)return e.isColliding=!1,e;n.push(b)}n.sort((c,h)=>c[0].distance1(c[1])-h[0].distance1(h[1]));let a=n[0],l=a[0].sub(a[1]);return e.isColliding=!0,e.penetrationVector=l,console.log("\u78B0\u649E\u7684\u65B9\u5411",e.penetrationVector),e}function SXe(o){return[{mid:o.leftLow.add(o.leftUp).mul(.5),direct:o.leftLow.sub(o.leftUp).normalize()},{mid:o.rightLow.add(o.leftLow).mul(.5),direct:o.rightLow.sub(o.leftLow).normalize()},{mid:o.rightUp.add(o.rightLow).mul(.5),direct:o.rightUp.sub(o.rightLow).normalize()},{mid:o.leftUp.add(o.rightUp).mul(.5),direct:o.leftUp.sub(o.rightUp).normalize()}]}function EXe(o,t,e){let r=[o.leftLow,o.rightLow,o.rightUp,o.leftUp],i=[];return r.forEach(n=>{let s=n.sub(t).dot(e),a=t.add(e.mul(s));i.push(a)}),i}function qOe(o,t,e){return o.sort((r,i)=>{let n=e.dot(r.sub(t)),s=e.dot(i.sub(t));return n-s})}function eDt(o,t,e,r){let i=[].concat(o,t);qOe(i,e,r);let n=Number.MAX_VALUE,s=-1,a=Number.MAX_VALUE,l=-1;for(let c of o){let h=i.indexOf(c);h<n&&(n=h),h>s&&(s=h)}for(let c of t){let h=i.indexOf(c);h<a&&(a=h),h>l&&(l=h)}if(n>l||a>s)return null;if(n>a&&s<l){let c=i[l].sub(i[n]),h=i[a].sub(i[s]);return c.length()>h.length()?[i[a],i[s]]:[i[l],i[n]]}else if(a>n&&l<s){let c=i[a].sub(i[s]),h=i[l].sub(i[n]);return c.length()>h.length()?[i[l],i[n]]:[i[a],i[s]]}else{let c,h;return n>a?c=n:h=a,s<l?c=s:h=l,[i[h],i[c]]}}var GC={},gw={},Eue=!0;function OXe(o,t,e){let r=Array.from(Wr.rtreeSearchNotOutsideForComponent(o.layerId,o.getMathGraphics(o.layerId,t))).filter(i=>!e.some(n=>i.globalIndex===n.globalIndex));r&&r.forEach(i=>{let n=Object.keys(gw),s=n==null?void 0:n.reduce((a,l)=>a.length>l.length?a:l,"");Eue=!s.includes(i.globalIndex),Eue||(GC[s]={initBox:gw[s].initBox}),!GC[i.globalIndex]&&Eue&&(GC[i.globalIndex]={initBox:i.model.box}),gw[i.globalIndex]||(gw[i.globalIndex]={initBox:i.model.box})})}function $G(o,t,e){console.log("movedMap",gw),console.log("blockMap",GC),console.log("components",e),GC={},gw={};let r={};OXe(o,t,e);let i=Object.keys(GC);for(;i.length>0;){let n=i.shift(),s=GC[n],a=new vs(o.layerId,o.leftLow,o.leftUp,o.rightLow,o.rightUp,o.locked).extendOfSize(t);console.log("movedBox",a),console.log("components",e);let l=gf(s.initBox,a);if(l.isColliding){let c=Ae.translate(-l.penetrationVector.x,-l.penetrationVector.y,0),h=!1;e.forEach(u=>{gf(s.initBox,u.model.box).isColliding&&(h=!0)}),h&&(e.forEach(u=>{u.transform(c)}),o.transform(c),OXe(o,t,e))}if(r[n]=(r[n]||0)+1,r[n]>1){let c=Object.keys(r),h=c.join(""),u=[];c.forEach(b=>{let P=gw[b].initBox,T=new vs(P.layerId,P.leftLow,P.leftUp,P.rightLow,P.rightUp,P.locked);u.push(T)});let d=new S(u[0].bbox.minX,u[0].bbox.minY),p=new S(u[0].bbox.maxX,u[0].bbox.maxY);u.forEach(b=>{d=new S(Math.min(d.x,b.bbox.minX),Math.min(d.y,b.bbox.minY)),p=new S(Math.max(p.x,b.bbox.maxX),Math.max(p.y,b.bbox.maxY))});let m=new S(d.x,p.y),g=new S(p.x,d.y),y=new vs(u[0].layerId,d,m,g,p,u[0].locked);GC={},gw[h]={initBox:y},GC[h]={initBox:y},r={},i=Object.keys(GC)}else Eue=!0,delete GC[n],i=Object.keys(GC)}}var KG=class extends ws{constructor(e,r){super();this.wireCommands=new Br;this.shoveCommands=new Br;this.addHistory=!0;this.items=new Set;this.repairTracks=new Set;this.associationItem=null;this.alreadyRotate=!1;this.revokeMove=!1;this.firstMove=!0;this.position=S.ORIGIN;this.moveViasMap=new Map;this.originViaMap=new Map;e.forEach(i=>{i instanceof _n||i instanceof ii||i instanceof nr&&i.type=="Annotation"||(i instanceof Ge&&(this.via=i),this.items.add(i))}),this.position=this.via.center,this.fac=new mi,r?this.fac.addGroup(r):this.fac.createGroup("Batch move pcb item")}customSyncAssociation(e){this.associationItem=e}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;this.addHistory=!0;for(let s of this.items)if(s.isSelect(r,i))return!0;let n=Wr.pointSelect(r,i);if(n.length>0){let s=n[0];if(this.items.has(n[0]))return!0;if(s.getParent()!=null&&this.items.has(s.getParent()))return!0}return!1}init(){if(this.associationItem==null){this.associationItem=new cl(this.items);let e=pt.getTears(this.via.globalIndex);if(e&&e.size>0)for(let r of e)this.fac.addCommand4Item(r,"delete"),qG(r)}if(this.addHistory){let e=this.associationItem.getAllItem(),r=Array.from(e).filter(i=>i instanceof Ge);this.shoveData=J3(r,this.wireCommands,void 0,!0),Jl.getInstance().init()}}fixMousePosition(e){this.moveStartPoint===null&&(this.moveStartPoint=new S(e.lastSceneX,e.lastSceneY),this.lastPosition=this.moveStartPoint);let r=new S(e.sceneX,e.sceneY);if(e.adsorbGrid&&(r=di.adsorpGrid(r)),e.shiftKey){let i=r.sub(this.moveStartPoint);Math.abs(i.x)>=Math.abs(i.y)?r=new S(r.x,this.moveStartPoint.y):r=new S(this.moveStartPoint.x,r.y),this.createShiftMoveHelpLine(this.moveStartPoint,r)}else this.shiftMoveHelpLine!=null&&this.removeShiftMoveHelpLine();return r}getViaOffset(e){return Sue.bind(this,e,this.moveStartPoint)()}getTrackOffset(e){return e.sub(this.moveStartPoint)}undoShoveHistory(){var e,r,i;l0.needclearWireCache=!1,Iue(),(e=this.shoveCommands)==null||e.undo(),this.shoveCommands=new Br,(r=this.associationItem.getRepairToolCommand())==null||r.undo(),this.associationItem.setRepairToolCommand(new Br),(i=this.wireCommands)==null||i.undo(),this.wireCommands=new Br}setConstraintLocks(){for(let[e,r]of this.node.connectTrack)cn.lockedMap.set(e,!r)}movePathList(e){let r=this.associationItem.itemConnectTrack;if(r.tracks.size!==0){e=this.position.sub(this.lastPosition);let i=Ae.translate(e.x,e.y,0);this.alreadyRotate||this.associationItem.moveConnectTrack(i),this.items.forEach(n=>{!n.locked&&!r.tracks.has(n.globalIndex)&&!(n instanceof Ge)&&n.transform(i)})}else{let i=Ae.translate(e.x,e.y,0);for(let[n]of this.node.connectTrack){let s=n.getAllItems();if(s.length>0)return XOe(n,s,this.wireCommands,!1,Array.from(this.items),a=>(a.transform(i),a))}}}onMouseMove(e,r=null){this.addHistory&&(this.node=_i.getInstance().getViaNode(this.via.model),this.init());let i=this.fixMousePosition(e),n=this.getViaOffset(i);this.position=this.moveStartPoint.add(n);let s=this.getTrackOffset(this.position);Pr.mouseAltDown&&!e.altKey&&(this.revokeMove=!0),this.associationItem==null&&(this.associationItem=new cl(this.items)),this.associationItem.setUpConnectTrack();let a=new Set;for(let h of this.associationItem.items)a.add(h);let l=this.associationItem.getAllItem();if(this.addHistory)for(let h of l)a.has(h)&&!h.locked&&this.fac.addCommand4Item(h,"modify");this.firstMove&&(this.firstMove=!1),this.undoShoveHistory(),this.setConstraintLocks(),Cue(n,this.node,this.wireCommands),this.associationItem.setAllAssociationRatlinesVisible();let c=this.movePathList(s);if(_9(this.shoveData,this.shoveCommands,!1,this.node),this.shoveData&&(this.via.iteratorRatlines(h=>{h.startNode==this.via&&(h.start=this.node.item.center),h.endNode==this.via&&(h.end=this.node.item.center)}),c&&c.size>0)){for(let h of this.items)if(h instanceof Ue){let u=c.get(h);if(!u)continue;h.iteratorRatlines(d=>{d.startNode==h&&(d.start=u.start),d.endNode==h&&(d.end=u.end)})}}return this.revokeMove&&this.associationItem!=null&&this.associationItem.interrupt(),this.addHistory&&(this.addHistory=!1),this.changeNativeCursor(5),this.lastPosition=this.position,!0}onMouseUpMove(e){return this.setCursor(e),!1}removeConnectTrack(){this.node!=null&&(this.undoShoveHistory(),this.associationItem.itemConnectTrack.tracks.clear(),this.node.connectTrack.clear(),this.shoveData=[this.node],ji.getInstance().view4Status(_r.getInstance().current))}setCursor(e){for(let r of this.items)if(!r.isEmpty&&r.isSelect(e.sceneX,e.sceneY))return this.changeNativeCursor(5);this.changeNativeCursor(4)}onMouseLeftUp(e){return this.fac.getCommand().length>0&&(A.publish("isMoveSwitch",!0),this.associationItem.complete(this.fac.getCommand()),this.fac.checkOutlines(Array.from(this.associationItem.items),new Set),this.fac=new mi,this.fac.createGroup("Batch move pcb item"),this.wireCommands=new Br,this.shoveCommands=new Br,Q3(),A.publish("autoFill",""),this.flushModify(),A.publish("isMoveSwitch",!1)),Ve.highlightComponentWhenMoveText.clear(),this.associationItem=null,this.removeShiftMoveHelpLine(),A.publish("flushSelectingInfo",""),this.filterRemove(),this.revokeMove=!1,!0}rotate(e=ce.pcbConfig.rotate){if(this.associationItem.itemConnectTrack.tracks.size===0&&this.shoveData.length>0){let r=new _e;if(this.items.forEach(i=>{r.ext1(i.buildBBox())}),this.alreadyRotate=!0,r.valid()){let n=r.build1().center(),s=Ae.rotateZForPoint(n,e),a=this.associationItem.getAllItem();for(let l of a)l.locked||this.fac.addCommand4Item(l,"modify");this.items.forEach(l=>{l.transform(s)}),this.onMouseMove(Pi.getInstance()),this.addHistory&&(this.addHistory=!1)}}}transformShoveData(e){if(this.shoveData&&this.shoveData.length>0){let r=this.shoveData.filter(s=>s instanceof Kn),i=[];for(let s of this.shoveData)if(s instanceof bs)s.connectTrack.size==0&&i.push(s);else{let a=s.getAllItems();a.length>0&&XOe(s,a,this.shoveCommands,!1),s.viaNode.prev!=null&&i.push(s.viaNode.prev),s.viaNode.next!=null&&i.push(s.viaNode.next)}let n=jOe(r);i.forEach(s=>{let a=!0;this.moveViasMap.size>0&&(a=this.moveViasMap.get(s)),!n.includes(s)&&a&&(b$(s.item,this.shoveCommands,l=>(l.transform(e),l)),Es.getInstance().changeViaPosition(s.item,this.moveStartPoint),s.isSource=!1)}),n.length&&n.forEach(s=>{s instanceof bs&&(b$(s.item,this.shoveCommands,a=>(a.transform(e),a)),Es.getInstance().changeViaPosition(s.item,this.moveStartPoint),s.isSource=!1)}),_9(this.shoveData,this.shoveCommands),this.originViaMap.size>0&&this.associationItem.getAllItem().forEach(a=>{if(a instanceof Ge){let l=this.originViaMap.get(a).item;a.iteratorRatlines(c=>{c.startNode==a&&(c.start=l.center),c.endNode==a&&(c.end=l.center)})}})}}interrupt(){var e,r,i;return(e=this.fac.getCommand())==null||e.undo(),(r=this.shoveCommands)==null||r.undo(),(i=this.wireCommands)==null||i.undo(),ji.getInstance().view4Status(_r.getInstance().current),lu.getInstance().clear(),this.associationItem!=null&&(this.associationItem.interrupt(),this.associationItem=null),this.items.clear(),this.changeNativeCursor(4),this.removeShiftMoveHelpLine(),!0}filterRemove(){let e=new Set;this.items.forEach(r=>{r.isEmpty||e.add(r)}),this.items=e}flushModify(){let e=new cl(this.items),r=e.items;for(let n of r)if(n instanceof Ue)A.publish("hasModifyPcbItem",n);else if(n instanceof Le){let s=n.getParent();s!=null&&s instanceof Me?A.publish("hasModifyPcbItem",s):A.publish("hasModifyPcbItem",n)}else n instanceof Ge?A.publish("hasModifyPcbItem",n):n instanceof Yn?A.publish("hasModifyPcbItem",n):n instanceof fr?A.publish("hasModifyPcbItem",n):n instanceof Ye?A.publish("hasModifyPcbItem",n):n instanceof Me?A.publish("hasModifyPcbItem",n):n instanceof va&&A.publish("hasModifyPcbItem",n);e.getAllRepairTracks().forEach(n=>{A.publish("hasModifyPcbItem",n)})}};var sp=class o{constructor(){this.highlighted=!1}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}highlight(t){if(ce.hightShowConfig.dragDarked){this.highlighted&&this.unhighlight();let e=new Set,r=!1;t.forEach(i=>{i instanceof Ue||i instanceof Le||i instanceof Ge?(r=!0,e.add(i.net)):i instanceof Me&&(r=!0,i.getPads().forEach(n=>{e.add(n.net)}))}),r&&(this.highlightedItems=t,ze.dragHighlightNets(Array.from(e)),this.highlighted=!0,t.forEach(i=>{i.manualHighLight=!0}))}}unhighlight(){if(ce.hightShowConfig.dragDarked&&x.getInstance().forceDeactive&&this.highlighted){let t=this.highlightedItems||[];this.highlighted=!1,t.forEach(e=>{e.manualHighLight=!1}),this.highlightedItems=null,ze.dragUnhighlightNet()}}};var $Oe=class o{constructor(){this.movedMap={};this.blockMap={};this.shouldAdd=!0}static getInstance(){return o.instance||(o.instance=new o),o.instance}initAllMap(){this.movedMap={},this.blockMap={}}setShouldAdd(t){this.shouldAdd=t}getShouldAdd(){return this.shouldAdd}addMovedMap(t,e){this.movedMap[t]={initBox:e}}getMovedMap(t){return this.movedMap[t]}getMovedMapKeys(){return Object.keys(this.movedMap)}removeMovedMap(t){delete this.movedMap[t]}addBlockMap(t,e){this.blockMap[t]={initBox:e}}getBlockMap(t){return this.blockMap[t]}getBlockMapKeys(){return Object.keys(this.blockMap)}removeBlockMap(t){delete this.blockMap[t]}clearBlockMap(){this.blockMap={}}},La=$Oe.getInstance();function AXe(o,t,e){let r=Array.from(Wr.rtreeSearchNotOutsideForComponent(o.layerId,o.getMathGraphics(o.layerId,t))).filter(i=>!e.some(n=>`${ur}${i.number}`==`${ur}${n.number}`));r&&r.forEach(i=>{let n=`${ur}${i.number}`,s=La.getMovedMapKeys(),a=s==null?void 0:s.reduce((l,c)=>l.length>c.length?l:c,"");if(La.setShouldAdd(!a.includes(n)),!La.getShouldAdd()){let l=La.getMovedMap(a).initBox;La.addBlockMap(a,l)}!La.getBlockMap(n)&&La.getShouldAdd()&&La.addBlockMap(n,i.model.box),La.getMovedMap(n)||La.addMovedMap(n,i.model.box)})}function _Xe(o,t,e,r){console.log("components",e),La.initAllMap();let i={};AXe(o,t,e);let n=La.getBlockMapKeys();for(;n.length>0;){let s=n.shift(),a=La.getBlockMap(s),l=new vs(o.layerId,o.leftLow,o.leftUp,o.rightLow,o.rightUp,o.locked).extendOfSize(t);console.log("movedBox",l),console.log("components",e);let c=gf(a.initBox,l);if(c.isColliding){let h=Ae.translate(-c.penetrationVector.x,-c.penetrationVector.y,0),u=!1;e.forEach(d=>{gf(a.initBox,d.model.box).isColliding&&(u=!0)}),u&&(e.forEach(d=>{d.transform(h)}),o.transform(h),AXe(o,t,e))}if(i[s]=(i[s]||0)+1,i[s]>1){let h=Object.keys(i),u=h.join(""),d=[];h.forEach(P=>{let T=La.getMovedMap(P).initBox,I=new vs(T.layerId,T.leftLow,T.leftUp,T.rightLow,T.rightUp,T.locked);(I.locked||!r)&&d.push(I)});let p=new S(d[0].bbox.minX,d[0].bbox.minY),m=new S(d[0].bbox.maxX,d[0].bbox.maxY);d.forEach(P=>{p=new S(Math.min(p.x,P.bbox.minX),Math.min(p.y,P.bbox.minY)),m=new S(Math.max(m.x,P.bbox.maxX),Math.max(m.y,P.bbox.maxY))});let g=new S(p.x,m.y),y=new S(m.x,p.y),b=new vs(d[0].layerId,p,g,y,m,d[0].locked);La.clearBlockMap(),La.addMovedMap(u,b),La.addBlockMap(u,b),i={},n=La.getBlockMapKeys()}else La,La.setShouldAdd(!0),La.removeBlockMap(s),n=La.getBlockMapKeys()}}var KOe=class o{constructor(){this.moveMap={};this.pushIdMap={};this.lockMap={};this.collisionCountMap={};this.combinedMap={};this.filterComponentIds=[];this.orderNumber=0;this.multiComponentUniqueId=`${ur}99999`}static getInstance(){return o.instance||(o.instance=new o),o.instance}initAllMap(){this.moveMap={},this.pushIdMap={},this.lockMap={},this.combinedMap={},this.collisionCountMap={},this.filterComponentIds=[]}setOrderNumber(t){this.orderNumber=t}addOrderNumber(){return this.orderNumber++,this.orderNumber}getOrderNumber(){return this.orderNumber}setFilterComponentIds(t){this.filterComponentIds=t}addFilterComponentIds(t){this.filterComponentIds=[...new Set([...this.filterComponentIds,...t])]}getFilterComponentIds(){return this.filterComponentIds}getMultiComponentUniqueId(){return this.multiComponentUniqueId}addMoveMap(t,e,r){this.moveMap[t]={component:e,order:r}}getMoveMap(t){return this.moveMap[t]}removeMoveMap(t){delete this.moveMap[t]}addPushIdMap(t,e,r){this.pushIdMap[t]={moveId:e,pushIds:r}}getPushIdMap(t){return this.pushIdMap[t]}getPushIdMapKeys(){return Object.keys(this.pushIdMap)}removePushIdMap(t){delete this.pushIdMap[t]}addLockMap(t,e,r){this.lockMap[t]||(this.lockMap[t]={}),this.lockMap[t].hasOwnProperty(r)||(this.lockMap[t][r]={lockedBox:e})}getLockMap(t){return this.lockMap[t]}getLockCombinedBox(t,e){let r=e instanceof Me?new S(e.model.buildBBox().minX,e.model.buildBBox().minY):e.leftLow,i=e instanceof Me?new S(e.model.buildBBox().maxX,e.model.buildBBox().maxY):e.rightUp,n=this.lockMap[t];Object.entries(n).forEach(([c,h])=>{let u=h.lockedBox;r=new S(Math.min(r.x,u.leftLow.x),Math.min(r.y,u.leftLow.y)),i=new S(Math.max(i.x,u.rightUp.x),Math.max(i.y,u.rightUp.y))});let s=new S(r.x,i.y),a=new S(i.x,r.y);return new vs(e.layerId,r,s,a,i,e.locked)}removeLockMap(t){delete this.lockMap[t]}addCombinedMap(t,e){this.combinedMap[t]={box:e}}getCombinedMap(t){return this.combinedMap[t]}removeCombinedMap(t){delete this.combinedMap[t]}getCollisionCountMapEntries(t){return this.collisionCountMap[t]}getCollisionCountMapValue(t,e){var r;return(r=this.collisionCountMap[t])==null?void 0:r[e]}updateCollisionCountMap(t,e){var r;if(!this.collisionCountMap[t])this.collisionCountMap[t]={[e]:1};else if(this.collisionCountMap[t][e])this.collisionCountMap[t][e]++;else{let i=((r=e.match(/[a-zA-Z]+\d+/g))==null?void 0:r.sort())||[],n=!1;for(let s in this.collisionCountMap[t]){let a=s.match(/[a-zA-Z]+[0-9]+/g)||[];if(i.every(c=>a.includes(c))){this.collisionCountMap[t][s]++,n=!0;break}}n||(this.collisionCountMap[t][e]=1)}}removeCollisionCountMap(t,e){e?this.collisionCountMap[t]&&(delete this.collisionCountMap[t][e],Object.keys(this.collisionCountMap[t]).length===0&&delete this.collisionCountMap[t]):delete this.collisionCountMap[t]}},In=KOe.getInstance();function tDt(o){return(o.match(/[a-zA-Z]+/g)||[]).length>1}function rDt(o){return o.reduce((t,e)=>e.match(/[a-zA-Z]+\d+/g)?t.concat(e.match(/[a-zA-Z]+\d+/g)):(t.push(e),t),[])}function ZG(o,t,e,r,i){A.publish("updateRtree",""),i&&In.addFilterComponentIds(rDt(i));let n=Array.from(Wr.rtreeSearchNotOutsideForComponent(o.layerId,o.getMathGraphics(o.layerId,r))).filter(s=>{let a=`${ur}${s.number}`,l=o instanceof Me?`${ur}${o.number}`:In.getMultiComponentUniqueId(),c=t instanceof Me?`${ur}${t.number}`:In.getMultiComponentUniqueId();return a!==l&&a!==c&&!In.getFilterComponentIds().includes(a)});if(n.length>0){let s=[];n.forEach(c=>{let h=`${ur}${c.number}`;if(c.number!==-1&&(s.push(h),!In.getMoveMap(h))){let u=e.get(c);u==null&&(u=In.addOrderNumber(),e.set(c,u)),In.addMoveMap(h,c,u)}});let a=o instanceof Me?`${ur}${o.number}`:In.getMultiComponentUniqueId(),l=`${a}, ${s}`;In.getPushIdMap(l)||In.addPushIdMap(l,a,s)}}function JG(o,t,e,r,i,n){let s=r.size>0?Math.max(...Array.from(r.values())):0;In.setOrderNumber(s+1),In.initAllMap(),In.setFilterComponentIds(i),ZG(o,o,r,e);let a=In.getPushIdMapKeys();for(;a.length>0;){let l=a.shift(),c=l,h=In.getPushIdMap(c).moveId;In.getPushIdMap(c).pushIds.forEach(d=>{let p=In.getMoveMap(d),m=new vs(p.component.model.box.layerId,p.component.model.box.leftLow,p.component.model.box.leftUp,p.component.model.box.rightLow,p.component.model.box.rightUp,p.component.model.box.locked),g=In.getMoveMap(h)?In.getMoveMap(h).component:o,y=g instanceof Me?new vs(g.model.box.layerId,g.model.box.leftLow,g.model.box.leftUp,g.model.box.rightLow,g.model.box.rightUp,g.model.box.locked).extendOfSize(e):new vs(g.layerId,g.leftLow,g.leftUp,g.rightLow,g.rightUp,g.locked).extendOfSize(e);if(g!=o&&p.order<In.getMoveMap(h).order){console.log("\u53CD\u5E8F\u903B\u8F91\u7684\u88AB\u63A8\u6324\u5668\u4EF6\u7684id",`${ur}${p.component.number}`),In.updateCollisionCountMap(h,d);let P=0,T=[],I=Object.keys(In.getCollisionCountMapEntries(h));for(let C of I)if(In.getCollisionCountMapValue(h,C)>=2&&(T.push(C),P++,P>=2))break;if(P>=2){let C=[],E=T.sort().join("");In.updateCollisionCountMap(h,E),console.log("\u8FDB\u5165\u53CD\u5E8F\u903B\u8F91\u5408\u5E76,\u6B64\u65F6\u6EE1\u8DB3\u6761\u4EF6\u7684moveId\u548CpushId",h,T),T.forEach(F=>{let H=In.getMoveMap(F)?In.getMoveMap(F).component.model.box:In.getCombinedMap(F).box,z=new vs(H.layerId,H.leftLow,H.leftUp,H.rightLow,H.rightUp,H.locked);C.push(z)});let O=new S(C[0].bbox.minX,C[0].bbox.minY),_=new S(C[0].bbox.maxX,C[0].bbox.maxY);C.forEach(F=>{O=new S(Math.min(O.x,F.bbox.minX),Math.min(O.y,F.bbox.minY)),_=new S(Math.max(_.x,F.bbox.maxX),Math.max(_.y,F.bbox.maxY))});let R=new S(O.x,_.y),v=new S(_.x,O.y),D=new vs(C[0].layerId,O,R,v,_,C[0].locked);In.removeCollisionCountMap(h,T[0]),In.removeCollisionCountMap(h,T[1]),In.getCombinedMap(E)||In.addCombinedMap(E,D);let w=gf(y,D);if(w.isColliding){let F=Ae.translate(w.penetrationVector.x,w.penetrationVector.y,0);g.transform(F),g instanceof Me&&g.buildBBox(),ZG(g,g,r,e,T)}}else{let C=!1,E="";for(let O in In.getCollisionCountMapEntries(h))if(C=O.includes(`${ur}${p.component.number}`),C){E=O;break}if(C&&tDt(E)){console.log("\u8FDB\u5165\u53CD\u5E8F\u975E\u5408\u5E76\u903B\u8F911111111111111111");let O=In.getCombinedMap(E).box,_=gf(y,O);if(_.isColliding){let R=Ae.translate(_.penetrationVector.x,_.penetrationVector.y,0);g.transform(R),g instanceof Me&&g.buildBBox(),ZG(g,g,r,e)}}else{console.log("\u8FDB\u5165\u53CD\u5E8F\u975E\u5408\u5E76\u903B\u8F9122222222222222");let O=gf(y,m);if(O.isColliding){let _=Ae.translate(O.penetrationVector.x,O.penetrationVector.y,0);g.transform(_),g instanceof Me&&g.buildBBox(),ZG(g,p.component,r,e)}}}return}let b=gf(m,y);if(b.isColliding){p!=null&&p.component!=o&&t.addCommand(Te.dispatch(p.component,"modify"));let P=p.component.partition,T=x.getInstance().partitionId,I=P==T;if(p.component.locked||!I){let C=g instanceof Me?`${ur}${g.number}`:In.getMultiComponentUniqueId(),E=`${ur}${p.component.number}`;if(In.getLockMap(C)||In.addLockMap(C,m,E),!In.getMoveMap(C))console.log("\u8FDB\u5165\u9501\u5B9A\u903B\u8F911111111111111111"),_Xe(o,e,n,I);else{console.log("\u8FDB\u5165\u9501\u5B9A\u903B\u8F91-\u975E\u8DDF\u968F\u9F20\u6807\u7684\u79FB\u52A8\u5668\u4EF6\u88AB\u5939\u51FB 22222222222222");let O=`${ur}${p.component.number}`;if(console.log("\u6B64\u65F6\u88AB\u79FB\u52A8\u7684\u5668\u4EF6",C),In.addLockMap(C,m,O),I){let _=In.getLockCombinedBox(C,o),R=[];Object.entries(In.getLockMap(C)).forEach(([D])=>{R.push(D)});let v=gf(y,_);if(v.isColliding){let D=Ae.translate(v.penetrationVector.x,v.penetrationVector.y,0);g.transform(D),g instanceof Me&&g.buildBBox(),ZG(g,g,r,e,R)}}}}else{let C=Ae.translate(b.penetrationVector.x,b.penetrationVector.y,0);p.component.transform(C),p.component.buildBBox(),ZG(p.component,g,r,e)}}}),In.removePushIdMap(l),a=In.getPushIdMapKeys()}}var Ch=class extends ws{constructor(e,r=!1){super();this.commandFactory=new ve("push component");this.addHistory=!0;this.items=new Set;this.associationItem=null;this.alreadyRotate=!1;this.revokeMove=!1;this.firstMove=!0;e.forEach(i=>{i instanceof _n||i instanceof ii||i instanceof nr&&i.type=="Annotation"||this.items.add(i)}),!r&&this.isNeedShove()&&(this.isNeedShoveVia=!0,this.viaShoveTool=new KG(this.items)),this.fac=new mi,this.fac.createGroup("Batch move pcb item")}isNeedShove(){let e=Array.from(this.items),r=e.filter(n=>n instanceof Ge);if(r.length!==1)return!1;let i=r[0];for(let n of e)if(!(n instanceof Ge||n instanceof ct&&n.type=="TearDrop"))if(n instanceof Ue){if(n.net==i.net&&i.isContains(n.layerId)&&(i.isSelect(n.start.x,n.start.y)||i.isSelect(n.end.x,n.end.y)))continue;return!1}else return!1;return!0}onKeyDown(e){let r=new S(e.realSceneX,e.realSceneY),i=yi.getScene();switch(sr.getAction(i,e)){case"Flip Right and Left":{this.items.size&&Array.from(this.items).every(s=>s instanceof Me)&&qf.flipComponent("Flip Right and Left",r,Array.from(this.items),this.fac.getCommand());break}case"Flip Up and Down":{this.items.size&&Array.from(this.items).every(s=>s instanceof Me)&&qf.flipComponent("Flip Up and Down",r,Array.from(this.items),this.fac.getCommand());break}}return A.publish("showAndUpdateCross",e),!1}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;this.addHistory=!0;for(let s of this.items)if(!s.isEmpty&&s.buildBBox().isContains1(r,i)&&s.isSelect(r,i))return!0;let n=Wr.pointSelect(r,i);if(n.length>0){let s=n[0];if(this.items.has(n[0]))return!0;if(s.getParent()!=null&&this.items.has(s.getParent()))return!0}return!1}moveComponent(){let e=Array.from(this.items).filter(n=>n instanceof Me);if(this.items.size==e.length&&e.length>0&&ce.pcbConfig.moveComponent!=="ignore"){let n=e[0],s=n.position,a=[],l=Ab(),c=e[0].model.buildBBox(),h=new S(c.minX,c.minY),u=new S(c.maxX,c.maxY);if(e.forEach(y=>{a.push(`${ur}${y.number}`);let b=y.model.buildBBox();h=new S(Math.min(h.x,b.minX),Math.min(h.y,b.minY)),u=new S(Math.max(u.x,b.maxX),Math.max(u.y,b.maxY))}),new Set(a).size!==a.length)return;let d=new S(h.x,u.y),p=new S(u.x,h.y),m=new vs(e[0].layerId,h,d,p,u,e[0].locked);switch(ce.pcbConfig.moveComponent){case"push":this.commandFactory.undo(),this.commandFactory=new ve("push component");let y=new Map;JG(m,this.commandFactory,l,y,a,e),y.clear();break;case"block":$G(m,l,e);break}let g=n.position.sub(s);this.lastPosition=this.lastPosition.add(g)}let r=Array.from(this.items).filter(n=>n instanceof Me||n.getParent()instanceof Me),i=new Set(r.map(n=>n.getParent()instanceof Me?n.getParent():n));Pb.runWithStrategy(vC.createMultiItemStrategy({selectedItems:i}),async()=>{sn.getInstance().language=(await cw()).message||"zh-cn",A.publish("updateDRC",i)})}onMouseMove(e,r=null){if(this.isNeedShoveVia)return this.viaShoveTool.onMouseMove(e,r);r=r||this.shiftControl(e);let i=this.lastPosition;Pr.mouseAltDown&&!e.altKey&&(this.revokeMove=!0);let n=Ae.translate(r.x,r.y,0),s=[];for(let c of this.items)c instanceof Le&&c.getParent()?Bt.checkIsCanEditByItem(c.getParent())&&s.push(c):this.isNeedShoveVia&&c instanceof ct&&c.type=="TearDrop"?(this.items.delete(c),this.fac.addCommand4Item(c,"delete"),qG(c)):s.push(c);this.associationItem==null&&(this.associationItem=new cl(s)),this.associationItem.setUpConnectTrack();let a=new Set;for(let c of this.associationItem.items){if(c instanceof fr){let h=c.getParent();if(h!=null&&this.associationItem.items.has(h))continue}a.add(c)}if(this.addHistory){let c=this.associationItem.getAllItem();for(let h of c)a.has(h)&&!h.locked&&(this.fac.addCommand4Item(h,"modify"),h instanceof Ye&&h.type==="Copper Region"&&(Te.dispatchCoppers(h,"delete",this.fac.getCommand()),h.clearCopper()))}this.firstMove&&(a.forEach(c=>{c instanceof fr&&Ve.highlightComponentWhenMoveText.add(c)}),this.firstMove=!1,sp.getInstance().highlight(Array.from(a))),this.alreadyRotate||this.associationItem.moveConnectTrack(n),this.associationItem.setAllAssociationRatlinesVisible();let l=this.associationItem.itemConnectTrack;if(this.tool==null){let c=new Array;for(let h of a)!h.locked&&!l.tracks.has(h.globalIndex)&&c.push(h);this.tool=new ep(c),this.tool.recordStyle()}return this.tool.transform(n),a.forEach(c=>{!c.locked&&!l.tracks.has(c.globalIndex)&&c instanceof fr&&c.updateHelpLine()}),this.moveComponent(),this.revokeMove&&this.associationItem!=null&&this.associationItem.interrupt(),this.addHistory&&(this.addHistory=!1),this.changeNativeCursor(5),!0}onMouseUpMove(e){return this.setCursor(e),!1}setCursor(e){for(let r of this.items)if(!r.isEmpty&&r.isSelect(e.sceneX,e.sceneY))return this.changeNativeCursor(5);this.changeNativeCursor(4)}onMouseLeftUp(e){var r;if(this.isNeedShoveVia)return this.viaShoveTool.onMouseLeftUp(e);if((r=this.tool)==null||r.complete(),sp.getInstance().unhighlight(),this.fac.getCommand().length>0){if(A.publish("isMoveSwitch",!0),this.associationItem.complete(this.fac.getCommand()),ce.pcbConfig.moveComponent=="push")for(let i of this.commandFactory.commands)this.fac.addCommand(i);this.fac.checkOutlines(Array.from(this.associationItem.items),new Set),this.fac=new mi,this.commandFactory=new ve("push component"),this.fac.createGroup("Batch move pcb item"),this.associationItem.items.forEach(i=>{i instanceof ct&&i.fill()}),A.publish("autoFill",""),this.flushModify(),A.publish("isMoveSwitch",!1)}return Ve.highlightComponentWhenMoveText.clear(),this.associationItem=null,this.removeShiftMoveHelpLine(),A.publish("flushSelectingInfo",""),this.filterRemove(),this.revokeMove=!1,!0}rotate(e=ce.pcbConfig.rotate){var r;if(this.isNeedShoveVia)return this.viaShoveTool.rotate(e);if(this.associationItem.itemConnectTrack.tracks.size===0&&this.items.size>0){this.alreadyRotate=!0;let i=_s(this.items);if(i.valid()){let s=i.build1().center(),a=Ae.rotateZForPoint(s,e);this.associationItem==null&&(this.associationItem=new cl(this.items)),this.associationItem.interrupt();let l=this.associationItem.items;if(this.associationItem.setUpConnectTrack(),this.addHistory){let h=this.associationItem.getAllItem();for(let u of h)u.locked||this.fac.addCommand4Item(u,"modify")}this.alreadyRotate||this.associationItem.moveConnectTrack(a),this.associationItem.setAllAssociationRatlinesVisible();let c=this.associationItem.itemConnectTrack;if(this.tool==null){let h=new Array;for(let u of l)!u.locked&&!c.tracks.has(u.globalIndex)&&h.push(u);this.tool=new ep(h),this.tool.recordStyle()}this.tool!=null&&(this.tool.isMoveBox()&&(a=this.tool.matrix.getInverseMatrix().multiply4(a).multiply4(this.tool.matrix)),(r=this.tool)==null||r.transform(a)),this.addHistory&&(this.addHistory=!1)}}}interrupt(){var e,r;if(sp.getInstance().unhighlight(),this.isNeedShoveVia)return this.viaShoveTool.interrupt();if(this.tool!=null&&this.tool.cancel(),!qf.getStatus()&&((e=this.fac.getCommand())==null||e.undo()),this.associationItem!=null&&this.associationItem.interrupt(),ce.pcbConfig.moveComponent=="push"&&((r=this.commandFactory)==null||r.undo()),!this.firstMove){let i=Array.from(this.items).filter(s=>s instanceof Me||s.getParent()instanceof Me),n=new Set(i.map(s=>s.getParent()instanceof Me?s.getParent():s));Pb.runWithStrategy(vC.createMultiItemStrategy({selectedItems:n}),()=>{A.publish("updateDRC",n)})}return this.items.clear(),this.changeNativeCursor(4),this.removeShiftMoveHelpLine(),!0}setCommand(e){for(let r of e)this.fac.getCommand().addCommand(r)}filterRemove(){let e=new Set;this.items.forEach(r=>{r.isEmpty||e.add(r)}),this.items=e}flushModify(){let e=new cl(this.items),r=e.items;for(let n of r)if(n instanceof Ue)A.publish("hasModifyPcbItem",n);else if(n instanceof Le){let s=n.getParent();s!=null&&s instanceof Me?A.publish("hasModifyPcbItem",s):A.publish("hasModifyPcbItem",n)}else n instanceof Ge?A.publish("hasModifyPcbItem",n):n instanceof Yn?A.publish("hasModifyPcbItem",n):n instanceof fr?A.publish("hasModifyPcbItem",n):n instanceof Ye?A.publish("hasModifyPcbItem",n):n instanceof Me?A.publish("hasModifyPcbItem",n):n instanceof va&&A.publish("hasModifyPcbItem",n);e.getAllRepairTracks().forEach(n=>{A.publish("hasModifyPcbItem",n)})}};var UC=class{constructor(t){if(this.component=t,di.pointInPolar(t.position)){let e=t.position.angle(x.getInstance().origin);e=e>=0?e:e+Vr,this.startAngle=t.rotation-e}else this.startAngle=t.rotation}fixPosition(t,e){return di.pointInPolar(e)&&!di.pointInPolar(t)&&(t=e),t}getMatrix(t,e){t=this.fixPosition(t,e);let r=this.getRealTimeAngle(t);return Ae.rotateZForPoint(t,r)}getRealTimeAngle(t){if(di.pointInPolar(t)){let e=t.angle(x.getInstance().origin);return e=e>=0?e:e+Vr,this.startAngle+e-this.component.rotation}else return this.startAngle-this.component.rotation}};function vXe(o,t,e){let r=e||o,i=Array.from(Wr.rtreeSearchNotOutsideForComponent(r.layerId,r.getMathGraphics(r.layerId,t))).filter(n=>`${ur}${n.number}`!=`${ur}${o.number}`);i&&i.forEach(n=>{let s=`${ur}${n.number}`,a=La.getMovedMapKeys(),l=a==null?void 0:a.reduce((c,h)=>c.length>h.length?c:h,"");if(La.setShouldAdd(!l.includes(s)),!La.getShouldAdd()){let c=La.getMovedMap(l).initBox;La.addBlockMap(l,c)}!La.getBlockMap(s)&&La.getShouldAdd()&&La.addBlockMap(s,n.model.box),La.getMovedMap(s)||La.addMovedMap(s,n.model.box)})}function xXe(o,t,e){La.initAllMap();let r={};vXe(o,t);let i=La.getBlockMapKeys();for(;i.length>0;){let n=i.shift(),s=La.getBlockMap(n),a=new vs(o.model.box.layerId,o.model.box.leftLow,o.model.box.leftUp,o.model.box.rightLow,o.model.box.rightUp,o.model.box.locked).extendOfSize(t),l=gf(s.initBox,a);if(l.isColliding){let c=Ae.translate(-l.penetrationVector.x,-l.penetrationVector.y,0);o.transform(c),vXe(o,t)}if(r[n]=(r[n]||0)+1,r[n]>1){let c=Object.keys(r),h=c.join(""),u=[];c.forEach(b=>{let P=La.getMovedMap(b).initBox,T=new vs(P.layerId,P.leftLow,P.leftUp,P.rightLow,P.rightUp,P.locked);(T.locked||!e)&&u.push(T)});let d=new S(u[0].bbox.minX,u[0].bbox.minY),p=new S(u[0].bbox.maxX,u[0].bbox.maxY);u.forEach(b=>{d=new S(Math.min(d.x,b.bbox.minX),Math.min(d.y,b.bbox.minY)),p=new S(Math.max(p.x,b.bbox.maxX),Math.max(p.y,b.bbox.maxY))});let m=new S(d.x,p.y),g=new S(p.x,d.y),y=new vs(u[0].layerId,d,m,g,p,u[0].locked);La.clearBlockMap(),La.addMovedMap(h,y),La.addBlockMap(h,y),r={},i=La.getBlockMapKeys()}else La.setShouldAdd(!0),La.removeBlockMap(n),i=La.getBlockMapKeys()}}function iDt(o){return(o.match(/[a-zA-Z]+/g)||[]).length>1}function nDt(o){return o.reduce((t,e)=>e.match(/[a-zA-Z]+\d+/g)?t.concat(e.match(/[a-zA-Z]+\d+/g)):(t.push(e),t),[])}function QG(o,t,e,r,i){A.publish("updateRtree",""),i&&In.addFilterComponentIds(nDt(i));let n=Array.from(Wr.rtreeSearchNotOutsideForComponent(o.layerId,o.getMathGraphics(o.layerId,r))).filter(s=>{let a=`${ur}${s.number}`,l=`${ur}${o.number}`,c=`${ur}${t.number}`;return a!==l&&a!==c&&!In.getFilterComponentIds().includes(a)});if(n.length>0){let s=[];n.forEach(c=>{let h=`${ur}${c.number}`;if(c.number!==-1&&(s.push(h),!In.getMoveMap(h))){let u=e.get(c);u==null&&(u=In.addOrderNumber(),e.set(c,u)),In.addMoveMap(h,c,u)}});let a=`${ur}${o.number}`,l=`${a}, ${s}`;In.getPushIdMap(l)||In.addPushIdMap(l,a,s)}}function yw(o,t,e,r){let i=r.size>0?Math.max(...Array.from(r.values())):0;In.setOrderNumber(i+1),In.initAllMap(),QG(o,o,r,e);let n=In.getPushIdMapKeys();for(;n.length>0;){let s=n.shift(),a=s,l=In.getPushIdMap(a).moveId;In.getPushIdMap(a).pushIds.forEach(h=>{let u=In.getMoveMap(h),d=new vs(u.component.model.box.layerId,u.component.model.box.leftLow,u.component.model.box.leftUp,u.component.model.box.rightLow,u.component.model.box.rightUp,u.component.model.box.locked),p=In.getMoveMap(l)?In.getMoveMap(l).component:o,m=new vs(p.model.box.layerId,p.model.box.leftLow,p.model.box.leftUp,p.model.box.rightLow,p.model.box.rightUp,p.model.box.locked).extendOfSize(e);if(p!=o&&u.order<In.getMoveMap(l).order){console.log("\u53CD\u5E8F\u903B\u8F91\u7684\u88AB\u63A8\u6324\u5668\u4EF6\u7684id",`${ur}${u.component.number}`),In.updateCollisionCountMap(l,h);let y=0,b=[],P=Object.keys(In.getCollisionCountMapEntries(l));for(let T of P)if(In.getCollisionCountMapValue(l,T)>=2&&(b.push(T),y++,y>=2))break;if(y>=2){let T=[],I=b.sort().join("");In.updateCollisionCountMap(l,I),console.log("\u8FDB\u5165\u53CD\u5E8F\u903B\u8F91\u5408\u5E76,\u6B64\u65F6\u6EE1\u8DB3\u6761\u4EF6\u7684moveId\u548CpushId",l,b),b.forEach(D=>{let w=In.getMoveMap(D)?In.getMoveMap(D).component.model.box:In.getCombinedMap(D).box,F=new vs(w.layerId,w.leftLow,w.leftUp,w.rightLow,w.rightUp,w.locked);T.push(F)});let C=new S(T[0].bbox.minX,T[0].bbox.minY),E=new S(T[0].bbox.maxX,T[0].bbox.maxY);T.forEach(D=>{C=new S(Math.min(C.x,D.bbox.minX),Math.min(C.y,D.bbox.minY)),E=new S(Math.max(E.x,D.bbox.maxX),Math.max(E.y,D.bbox.maxY))});let O=new S(C.x,E.y),_=new S(E.x,C.y),R=new vs(T[0].layerId,C,O,_,E,T[0].locked);In.removeCollisionCountMap(l,b[0]),In.removeCollisionCountMap(l,b[1]),In.getCombinedMap(I)||In.addCombinedMap(I,R);let v=gf(m,R);if(v.isColliding){let D=Ae.translate(v.penetrationVector.x,v.penetrationVector.y,0);p.transform(D),p.buildBBox(),QG(p,p,r,e,b)}}else{let T=!1,I="";for(let C in In.getCollisionCountMapEntries(l))if(T=C.includes(`${ur}${u.component.number}`),T){I=C;break}if(T&&iDt(I)){console.log("\u8FDB\u5165\u53CD\u5E8F\u975E\u5408\u5E76\u903B\u8F911111111111111111");let C=In.getCombinedMap(I).box,E=gf(m,C);if(E.isColliding){let O=Ae.translate(E.penetrationVector.x,E.penetrationVector.y,0);p.transform(O),p.buildBBox(),QG(p,p,r,e)}}else{console.log("\u8FDB\u5165\u53CD\u5E8F\u975E\u5408\u5E76\u903B\u8F9122222222222222");let C=gf(m,d);if(C.isColliding){let E=Ae.translate(C.penetrationVector.x,C.penetrationVector.y,0);p.transform(E),p.buildBBox(),QG(p,u.component,r,e)}}}return}let g=gf(d,m);if(g.isColliding){u!=null&&u.component!=o&&t.addCommand(Te.dispatch(u.component,"modify"));let y=u.component.partition,b=x.getInstance().partitionId,P=y==b;if(u.component.locked||!P){let T=`${ur}${p.number}`;if(!In.getMoveMap(T))console.log("\u8FDB\u5165\u9501\u5B9A\u903B\u8F911111111111111111"),xXe(o,e,P);else{console.log("\u8FDB\u5165\u9501\u5B9A\u903B\u8F91-\u975E\u8DDF\u968F\u9F20\u6807\u7684\u79FB\u52A8\u5668\u4EF6\u88AB\u5939\u51FB 22222222222222");let I=`${ur}${u.component.number}`;if(console.log("\u6B64\u65F6\u88AB\u79FB\u52A8\u7684\u5668\u4EF6",T),In.addLockMap(T,d,I),P){let C=In.getLockCombinedBox(T,o),E=[];Object.entries(In.getLockMap(T)).forEach(([_])=>{E.push(_)});let O=gf(m,C);if(O.isColliding){let _=Ae.translate(O.penetrationVector.x,O.penetrationVector.y,0);p.transform(_),p.buildBBox(),QG(p,p,r,e,E)}}}}else{let T=Ae.translate(g.penetrationVector.x,g.penetrationVector.y,0);u.component.transform(T),u.component.buildBBox(),QG(u.component,p,r,e)}}}),In.removePushIdMap(s),n=In.getPushIdMapKeys()}}var HC={},bw={},Oue=!0;function RXe(o,t,e){let r=e||o,i=Array.from(Wr.rtreeSearchNotOutside(r.getMathGraphics(r.layerId,t)).components).filter(n=>n.layerId==o.layerId&&n.globalIndex!==o.globalIndex);i&&i.forEach(n=>{let s=Object.keys(bw),a=s==null?void 0:s.reduce((l,c)=>l.length>c.length?l:c,"");Oue=!a.includes(n.globalIndex),Oue||(HC[a]={initBox:bw[a].initBox}),!HC[n.globalIndex]&&Oue&&(HC[n.globalIndex]={initBox:n.model.box}),bw[n.globalIndex]||(bw[n.globalIndex]={initBox:n.model.box})})}function j_(o,t){console.log("movedMap",bw),console.log("blockMap",HC),HC={},bw={};let e={};RXe(o,t);let r=Object.keys(HC);for(;r.length>0;){let i=r.shift(),n=HC[i],s=new vs(o.model.box.layerId,o.model.box.leftLow,o.model.box.leftUp,o.model.box.rightLow,o.model.box.rightUp,o.model.box.locked).extendOfSize(t),a=gf(n.initBox,s);if(a.isColliding){let l=Ae.translate(-a.penetrationVector.x,-a.penetrationVector.y,0);o.transform(l),RXe(o,t)}if(e[i]=(e[i]||0)+1,e[i]>1){let l=Object.keys(e),c=l.join(""),h=[];l.forEach(y=>{let b=bw[y].initBox,P=new vs(b.layerId,b.leftLow,b.leftUp,b.rightLow,b.rightUp,b.locked);h.push(P)});let u=new S(h[0].bbox.minX,h[0].bbox.minY),d=new S(h[0].bbox.maxX,h[0].bbox.maxY);h.forEach(y=>{u=new S(Math.min(u.x,y.bbox.minX),Math.min(u.y,y.bbox.minY)),d=new S(Math.max(d.x,y.bbox.maxX),Math.max(d.y,y.bbox.maxY))});let p=new S(u.x,d.y),m=new S(d.x,u.y),g=new vs(h[0].layerId,u,p,m,d,h[0].locked);HC={},bw[c]={initBox:g},HC[c]={initBox:g},e={},r=Object.keys(HC)}else Oue=!0,delete HC[i],r=Object.keys(HC)}}var Pw=class extends ws{constructor(e){super();this.commandFactory=new ve("push component");this.addHistory=!0;this.associationItem=null;this.alreadyRotate=!1;this.position=S.ORIGIN;this.pad=e,this.command=new ve("single select Component");let r=this.pad.getParent();r!=null&&r instanceof Me&&(this.util=new UC(r)),this.moveTool=new Ch([this.pad]),this.position=this.pad.center}onKeyDown(e){if(this.pad.getParent()||this.pad.getGroupID()){let r=this.pad.getParent();r&&r instanceof Me&&(e.sceneX=r.position.x,e.sceneY=r.position.y,A.publish("showAndUpdateCross",e))}else e.sceneX=this.pad.center.x,e.sceneY=this.pad.center.y,A.publish("showAndUpdateCross",e);return!1}onMouseLeftDown(e){let r=e.sceneX,i=e.sceneY;return this.pad.isSelect(r,i)}onMouseMove(e){if(this.pad.locked)return!1;let r=this.shiftControl(e);if(this.position=this.lastPosition,this.addHistory&&sp.getInstance().highlight([this.pad]),this.pad.getParent()||this.pad.getGroupID()){if(e.adsorbGrid&&this.addHistory&&ce.pcbConfig.snapToCenterWhileDragPadOrVia&&(r=new S(e.sceneX-this.pad.center.x,e.sceneY-this.pad.center.y)),ce.pcbConfig.alignToNearComponentOrPadWhileDrag&&e.adsorb){let h=ce.pcbConfig.snapToCenterWhileDragPadOrVia?new S(e.sceneX,e.sceneY):this.pad.center.add(r),u=di.snapToOtherComponent(this.pad,r,h,e);u&&(this.lastPosition=this.lastPosition.sub(r),h=u,r=h.sub(this.pad.center),this.lastPosition=this.lastPosition.add(r))}let i=Ae.translate(r.x,r.y,0);if(!St.getInstance().currentCoord&&this.util!=null){let h=new S(e.sceneX,e.sceneY),u=this.util.getMatrix(this.position,h);i=i.multiply4(u)}if(this.pad.getParent()&&!Bt.checkIsCanEditByItem(this.pad.getParent()))return!0;this.associationItem==null&&(this.associationItem=new cl(this.pad.getParent()?[this.pad.getParent()]:[this.pad]));let n=this.associationItem.items;if(this.associationItem.setUpConnectTrack(),this.addHistory){let h=this.associationItem.getAllItem();for(let u of h)u.locked||(this.command.addCommand(Te.dispatch(u,"modify")),A.publish("hasModifyPcbItem",this.pad))}this.alreadyRotate||this.associationItem.moveConnectTrack(i),this.associationItem.setAllAssociationRatlinesVisible();let s=this.associationItem.itemConnectTrack;if(this.tool==null){let h=new Array;for(let u of n)!u.locked&&!s.tracks.has(u.globalIndex)&&h.push(u);this.tool=new ep(h),this.tool.recordStyle()}this.tool.transform(i);let a=this.pad.getParent();if(a&&a instanceof Me){let h=new S(e.sceneX,e.sceneY).sub(a.position);if(e.sceneX=a.position.x,e.sceneY=a.position.y,A.publish("showAndUpdateCross",e),ce.pcbConfig.moveComponent=="push"&&this.pad.getParent()instanceof Me&&!a.model.getGroupID()){let u=Ab();this.commandFactory.undo(),this.commandFactory=new ve("push component");let d=this.pad.getParent(),p=new Map;p.set(d,0),yw(d,this.commandFactory,u,p),p.clear(),this.lastPosition=d.position.add(h)}if(ce.pcbConfig.moveComponent=="block"&&!a.model.getGroupID()&&this.pad.getParent()instanceof Me){let u=Ab(),d=this.pad.getParent();j_(d,u),this.lastPosition=d.position.add(h)}}let l=Array.from(n).filter(h=>h instanceof Me||h.getParent()instanceof Me),c=new Set(l.map(h=>h.getParent()instanceof Me?h.getParent():h));Pb.runWithStrategy(vC.createMultiItemStrategy({selectedItems:c}),async()=>{sn.getInstance().language=(await cw()).message||"zh-cn",A.publish("updateDRC",c)})}else{this.addHistory&&(this.command.addCommand(Te.dispatch(this.pad,"modify")),A.publish("hasModifyPcbItem",this.pad)),ce.pcbConfig.snapToCenterWhileDragPadOrVia&&(r=new S(e.sceneX,e.sceneY).sub(this.pad.center));let i=ce.pcbConfig.snapToCenterWhileDragPadOrVia?new S(e.sceneX,e.sceneY):this.pad.center.add(r);if(e.adsorbGrid&&(i=di.adsorpGrid(i),r=i.sub(this.pad.center)),ce.pcbConfig.alignToNearComponentOrPadWhileDrag&&e.adsorb){let l=di.snapToOtherComponent(this.pad,r,i,e);l&&(this.lastPosition=this.lastPosition.sub(r),i=l,r=i.sub(this.pad.center),this.lastPosition=this.lastPosition.add(r))}let n=Ae.translate(r.x,r.y,0);this.associationItem==null&&(this.associationItem=new cl([this.pad]));let s=this.associationItem.items;if(this.associationItem.setUpConnectTrack(),this.addHistory){let l=this.associationItem.getAllItem();for(let c of l)!c.locked&&c!=this.pad&&this.command.addCommand(Te.dispatch(c,"modify"))}this.alreadyRotate||this.associationItem.moveConnectTrack(n),this.associationItem.setAllAssociationRatlinesVisible();let a=this.associationItem.itemConnectTrack;s.forEach(l=>{!l.locked&&!a.tracks.has(l.globalIndex)&&l.transform(n)}),e.sceneX=this.pad.center.x,e.sceneY=this.pad.center.y,A.publish("showAndUpdateCross",e)}return this.addHistory&&(this.addHistory=!1),this.changeNativeCursor(5),!0}onMouseUpMove(e){return this.pad.isSelect(e.sceneX,e.sceneY)?this.changeNativeCursor(5):this.changeNativeCursor(4),!1}onMouseLeftUp(e){var r;if((r=this.tool)==null||r.complete(),this.position=this.pad.center,sp.getInstance().unhighlight(),this.command.length>0){if(this.associationItem!=null){if(this.associationItem.complete(this.command),ce.pcbConfig.moveComponent=="push"&&this.pad.getParent()instanceof Me)for(let i of this.commandFactory.commands)this.command.addCommand(i);this.associationItem.getAllItem().forEach(i=>{A.publish("hasModifyPcbItem",i)})}je.executeCommand(this.command),this.command=new ve("select pad"),this.commandFactory=new ve("push component")}return this.associationItem=null,this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),A.publish("autoFill",""),!0}rotate(e=ce.pcbConfig.rotate){var i;if(this.pad.getParent()!=null){this.alreadyRotate=!0;let n=_s([this.pad]);if(n.valid()){let a=n.build1().center(),l=Ae.rotateZForPoint(a,e);this.associationItem==null&&(this.associationItem=new cl([this.pad])),this.associationItem.interrupt();let c=this.associationItem.items;if(this.associationItem.setUpConnectTrack(),this.addHistory){let u=this.associationItem.getAllItem();for(let d of u)d.locked||this.command.addCommand(Te.dispatch(d,"modify"))}if(this.addHistory){let u=this.associationItem.getAllItem();for(let d of u)d.locked||this.command.addCommand(Te.dispatch(d,"modify"))}this.alreadyRotate||this.associationItem.moveConnectTrack(l),this.associationItem.setAllAssociationRatlinesVisible();let h=this.associationItem.itemConnectTrack;if(this.tool==null){let u=new Array;for(let d of c)!d.locked&&!h.tracks.has(d.globalIndex)&&u.push(d);this.tool=new ep(u),this.tool.recordStyle()}this.tool!=null&&(this.tool.isMoveBox()&&(l=this.tool.matrix.getInverseMatrix().multiply4(l).multiply4(this.tool.matrix)),(i=this.tool)==null||i.transform(l)),this.addHistory&&(this.addHistory=!1)}}else{this.addHistory&&(this.command=new ve("select pad"),this.command.addCommand(Te.dispatch(this.pad,"modify")),this.addHistory=!1);let n=_s([this.pad]);if(n.valid()){let a=n.build1().center();ao.rotate(a,e,[this.pad])}}}interrupt(){var r,i;this.tool!=null&&this.tool.cancel(),(r=this.command)==null||r.undo(),ce.pcbConfig.moveComponent=="push"&&((i=this.commandFactory)==null||i.undo()),this.associationItem!=null&&(this.associationItem.interrupt(),this.associationItem=null),sp.getInstance().unhighlight(),this.removeShiftMoveHelpLine(),this.moveTool.interrupt(),this.changeNativeCursor(4);let e=this.pad.getParent()instanceof Me?new Set([this.pad.getParent()]):null;return Pb.runWithStrategy(vC.createMultiItemStrategy({selectedItems:e}),()=>{A.publish("updateDRC",e)}),!0}};var eU=class extends Pw{constructor(e){super(e);this.firstMove=!0;this.pad=e}onMouseLeftDown(e){return!1}onMouseMove(e){Vs.cancel();let r=this.shiftControl(e);return this.position=this.lastPosition,Y8.move(this.pad.globalIndex,r,this.firstMove),this.firstMove=!1,!0}onMouseLeftUp(e){return Vs.executeCommand(),this.command=null,!0}onMouseUpMove(e){return Vs.move(e),!1}interrupt(){return super.interrupt(),this.firstMove=!0,!0}rotate(e=ce.pcbConfig.rotate){Vs.addCommand(this.pad,"modify"),super.rotate(e)}};var tU=class extends ws{constructor(t){super(),this.dimension=t}onMouseLeftDown(t){let e=t.sceneX,r=t.sceneY,i=this.dimension.isSelect(e,r);return i&&this.dimension.length>0&&Vs.reAddRestriction(this.dimension),i}onMouseMove(t){return Vs.move(t),!0}onMouseLeftUp(t){return Vs.build(),!0}interrupt(){return!0}};var rU=class extends ci{constructor(e){super();this.template=null;this.hashId="";this.image=null;this.option="OPTIONLEFTUP",this.setSize(e),this.hashId=e.hashId,this.drawing=!0,Yo.setTool(this),this.start()}onKeyDown(e){switch(sr.getAction(5,e)){case"Cancel":this.cancel();break;case"Rotate Left":this.image!=null&&(this.image.rotateFor(this.image.start,ce.pcbConfig.rotate),rt.defaultImage.rotation+=ce.pcbConfig.rotate);break;case"rotate_right":this.image!=null&&(this.image.rotateFor(this.image.start,-ce.pcbConfig.rotate),rt.defaultImage.rotation-=ce.pcbConfig.rotate);break;case"Flip Right and Left":A.publish("turn","turnAround");break;case"Flip Up and Down":A.publish("turn","turnUpsideDown");break}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(this.image!=null){if(this.image.start=r,!Bt.checkIsInCanEdit(this.image)){let n="beyond drawing range";Bt.showMassageTip(n,n);return}this.image.partition=x.getInstance().partitionId,A.publish("onlySelect",[this.image]);let i=new ve("insert image");i.addCommand(Te.dispatch(this.image,"add")),je.executeCommand(i),A.publish("hasModifyPcbItem",this.image),this.image=null,this.drawing=!0}A.publish("flushService","")}onMouseMove(e){if(this.drawing){let r=new S(e.sceneX,e.sceneY);if(this.image!=null)this.image.layerId!=this.getLayer()&&(this.image.layerId=this.getLayer()),this.image.start=r;else{let{hashId:i,width:n,height:s}=this,a=this.getLayer(),l=rt.defaultImage.rotation;this.image=_o.addImage(a,r,n,s,l,!1,!1,i)}}}interrupt(){this.image!==null&&(this.image.remove(),A.publish("delete",this.image),this.image=null,A.publish("flushService","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}getLayer(){let e=be.getActiveLayer();switch(e.layerID){case 3:case 4:case 13:return e.layerID;default:return 3}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"FLIP":i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"&&this.turn("turnUpsideDown");break}A.publish("updateFrame","")}turn(e){if(!(!x.getInstance().isactive||23==x.getInstance().doctype))switch(e){case"turnAround":Yo.turn([this.image],!1,!1);break;case"turnUpsideDown":Yo.turn([this.image],!0,!1);break}}setSize(e){let r=new ft;e.unit!=="mil"?(this.width=r.conversion(e.unit,"mil",+e.width)/10,this.height=r.conversion(e.unit,"mil",+e.height)/10):(this.width=+e.width/10,this.height=+e.height/10)}};var Aue=class{constructor(){this.higtLightItems=new Set;this.allHightTimeId=[];this._ignoreItemCheck=!1;this._selectionByDRCHover=!1;let t=new er;A.subscribe("realTimeHighlight",e=>{this.cancelhighLight(),this.higtLightItems.clear(),e.forEach(r=>{let i=t.getItem(r);i&&this.higtLightItems.add(i)}),this.highLight()}),A.subscribe("cancelRealTimeHighlight",()=>this.cancelhighLight())}highLight(){let t=Ve.getSelects();this.higtLightItems.forEach(e=>{if(e instanceof mt||e instanceof vt){let r=e.getParent();if(!r.isEmpty&&t.indexOf(r)>=0)return}!e.isEmpty&&t.indexOf(e)<0&&e.isVisible&&!Ve.highlight.isItemHighlighted(e.globalIndex)&&this.itemClickOrVisible(e,!0,Ve.realTimeHighlight)}),A.publish("updateFrame","")}interrupt(){this.allHightTimeId.forEach(t=>{clearTimeout(t)}),this.allHightTimeId=[]}cancelhighLight(){this.allHightTimeId.shift(),this.highlightTimeId&&this.allHightTimeId.pop(),clearTimeout(this.highlightTimeId),this.highlightTimeId=null;let t=Ve.getSelects();this.higtLightItems.forEach(e=>{if(e instanceof mt||e instanceof vt){let r=e.getParent();if(!r.isEmpty&&t.indexOf(r)>=0)return}if(!e.isEmpty&&t.indexOf(e)<0&&e.isVisible&&!Ve.highlight.isItemHighlighted(e.globalIndex)&&this.itemClickOrVisible(e,!1),e instanceof Le||e instanceof Ge){let r=e.getParent();r!=null&&!r.isEmpty&&t.indexOf(r)>=0&&this.itemClickOrVisible(r,!0)}else if(e instanceof Me){let r=e.getItems();for(let i of r)!i.isEmpty&&t.indexOf(i)>=0&&this.itemClickOrVisible(i,!0)}}),A.publish("updateFrame","")}select(t){this.highlightTimeId=setTimeout(()=>{if(Ve.dragging)return;let e=t.realSceneX,r=t.realSceneY;this.cancelhighLight(),this.higtLightItems.clear(),this._ignoreItemCheck=!1,this._selectionByDRCHover=!1;let i=new Set;if(!t.leftDown&&!t.rightDown){let s=Wr.pointSelect(e,r,!1,!0);if(s[0]instanceof qp){this._ignoreItemCheck=!0,this._selectionByDRCHover=!0;let a=Wr.getDrcAssoicItems(s);for(let l of a)i.add(l)}else ce.pcbConfig.highLight&&(i=new Set(this.filter(s)))}let n=!1;i.forEach(s=>{!n&&!this.higtLightItems.has(s)&&(n=!0)}),n&&(this.higtLightItems=i,this.highLight())},120),this.allHightTimeId.push(this.highlightTimeId)}filter(t){let e=[];for(let r of t)if(!(r instanceof Ye&&r.type=="Copper Region")){if(r instanceof ii)continue;e.push(r)}if(e.length==1){let r=e[0];if(r instanceof Ue)return $t.filterTrack(r,ce.pcbConfig.clickTrackSelect)}return e}itemClickOrVisible(t,e,r){if(t&&!(Bo(t)&&ce.pcbConfig.highLightNet&&r)){if(this._selectionByDRCHover){e?(t.highLight(r),t.click(r)):(t.unHighLight(),t.visible());return}e?t.click(r):t.visible()}}};var _ue=class{constructor(){this.highLightItems=new Set;this.allHightTimeId=[];this._viewGroup=new GG({visible:!0,highLightType:0})}selectFilter(t){let e=[];for(let r of t)if(!(r instanceof Ye&&r.type=="Copper Region")){if(r instanceof ii)continue;e.push(r)}if(e.length==1){let r=e[0];if(r instanceof Ue)return $t.filterTrack(r,ce.pcbConfig.clickTrackSelect)}return e}isBridgingCopper(t){return(t.getComponent()instanceof ln&&t.getComponent()).isBridgingCopper}itemTypeCheck(t){return t instanceof Ue||t instanceof Le||t instanceof Ge||t instanceof ct&&t.type=="TearDrop"?!0:((t instanceof mt||t instanceof vt)&&(t=t.getParent()),(t instanceof ct||t instanceof Sr||t instanceof nr)&&(t.type=="Line"||t.type=="Fill Region"&&!this.isBridgingCopper(t))&&!(t.getParent()&&t.getParent()instanceof Me))}select(t){let e=null,r=t.realSceneX,i=t.realSceneY;this.net=null,this.highlightTimeId=setTimeout(()=>{if(this.cancelHighLight(),!we.drawing){if(ce.pcbConfig.highLightNet&&!t.leftDown&&!t.rightDown&&this.highlightTimeId!=null){let n=this.selectFilter(Wr.pointSelect(r,i,!1,!0));if(n[0]instanceof qp)return;{let s=[];n.forEach(a=>{var l;if(this.itemTypeCheck(a)){(a instanceof mt||a instanceof vt)&&(a=a.getParent());let c=a&&Bo(a);c&&!s.includes(c)&&(e=c,s.push(c),(l=ze.getItem(c))==null||l.forEach(h=>{h instanceof ct&&h.type=="TearDrop"||this.highLightItems.add(h)}))}})}}this.net=e,this.highLight()}},120),this.allHightTimeId.push(this.highlightTimeId)}highLight(){let t=[],e=[],r=Ve.getSelects();this.highLightItems.forEach(i=>{if(i instanceof mt||i instanceof vt){let l=i.getParent();if(l&&!l.isEmpty&&r.indexOf(l)>=0)return;l&&(i=l)}let n=i.viewGroupId;if(!n||t.includes(n))return;let s=i.layerId;if(e.includes(s))return;let a=be.getLayer(s);if(a&&!a.visible){e.push(s);return}!i.isEmpty&&r.indexOf(i)<0&&i.isVisible&&!Ve.highlight.isItemHighlighted(i.globalIndex)&&this.itemTypeCheck(i)&&t.push(n)}),this.net&&zo.highlightByNets([this.net],Ve.realTimeHighlight,(i,n)=>{let s=i.viewGroupId;!s||t.includes(s)||t.push(s)}),t.length>0&&this._viewGroup.viewGroup(t),A.publish("updateFrame","")}cancelHighLight(){this.firstHighlightTimeId=this.allHightTimeId.shift(),this.highlightTimeId&&this.allHightTimeId.pop(),this.highLightItems.clear(),this._viewGroup.clear()}interrupt(){this.allHightTimeId.forEach(t=>{clearTimeout(t)}),clearTimeout(this.firstHighlightTimeId),clearTimeout(this.highlightTimeId),this.highlightTimeId=null,this.firstHighlightTimeId=null,this.allHightTimeId.length=0,this.cancelHighLight()}};var dh=class extends ko{constructor(){super();this.realdTimeHighLight=new Aue;this.realTimeHighLightNet=new _ue;yi.dropDrag=!0,Ve.getSelects().length>0?yi.setSelect():yi.setNonSelect()}getCanUndo(){return!0}onKeyDown(e){Ve.onKeyDown(e)}onEnterPlace(e){this.onMouseLeftUp(e)}onMouseLeftDown(e){Ve.realTimeHighlight=!1,this.realdTimeHighLight.cancelhighLight(),this.realTimeHighLightNet.cancelHighLight(),Ve.onMouseLeftDown(e)}onMouseLeftUp(e){Ve.onMouseLeftUp(e)}onMouseRightDown(e){Ve.realTimeHighlight=!1,this.realdTimeHighLight.cancelhighLight(),this.realTimeHighLightNet.cancelHighLight(),Ve.onMouseRightDown(e)}onMouseRightUp(e){Ve.onMouseRightUp(e)}onMouseMove(e){Ve.realTimeHighlight=!0,this.realdTimeHighLight.select(e),this.realTimeHighLightNet.select(e),Ve.onMouseMove(e)}onMouseWheel(e){Ve.onMouseWheel(e)}onMouseLeave(e){setTimeout(()=>{Ve.realTimeHighlight=!1,this.realdTimeHighLight.cancelhighLight(),this.realTimeHighLightNet.cancelHighLight()},120)}onDoubleClick(e){Ve.onDoubleClick(e)}clear(){this.realdTimeHighLight.interrupt(),this.realTimeHighLightNet.interrupt(),this.realdTimeHighLight.cancelhighLight(),this.realTimeHighLightNet.cancelHighLight()}interrupt(){this.clear(),Ve.interrupt()}};var ZOe=class{constructor(){this._measureMode="MeasureObjectDistance";this._showRichInfo=!1}get measureMode(){return this._measureMode}set measureMode(t){this._measureMode=t}get showRichInfo(){return this._showRichInfo}set showRichInfo(t){this._showRichInfo=t}},Hh=new ZOe;function DXe(o,t=!1){let e=new Jt;return e.add("CANCEL",!0),e.add("MeasuringDistance"),e.add("OBJECT_PRIORITY",t),m9&&e.add("CreepageDistance",!0),e.add("toggleAdsorb",!1,o),e.add("ADSORBENT_CONFIG"),e.result}var vue=class{constructor(){this._startTarget=this.createTargetReult("DOT",null),this._endTarget=this.createTargetReult("DOT",null),this._measureResult=this.createMeasureReult()}get startTarget(){return this._startTarget}set startTarget(t){this._startTarget=t}get endTarget(){return this._endTarget}set endTarget(t){this._endTarget=t}get measureResult(){return this._measureResult}set measureResult(t){this._measureResult=t}reset(){this.startTarget=this.createTargetReult("DOT",null),this.endTarget=this.createTargetReult("DOT",null),this.measureResult=this.createMeasureReult()}toJSON(){return{startTarget:this.startTarget,endTarget:this.endTarget,measureResult:this.measureResult}}createTargetReult(t,e){let r={};return r.allElements=[],r.elementId=e,r.type=t,r.x=0,r.y=0,r.sourceX=0,r.sourceY=0,r.layerId=1,r.layerOptions=[],r.position="EDGE",r.elementShowData={},r.isBeFilledType=!0,r}createMeasureReult(){let t={};return t.angle="0(0)",t.distance="0(0)",t.dx="0(0)",t.dy="0(0)",t}};function sDt(o){return!(o instanceof Ar||o instanceof Sr&&o.type==="Line"||o instanceof nr&&o.type==="Line"||o.type==="Board Outline"||o instanceof vt||o instanceof mt||o instanceof ct&&o.type==="Line")}function P$(o,t=x.getInstance().unit){return t==="mil"?on(o*10,1,!0):t==="mm"?on(Xs.conversion("mil","mm",o)*10,3,!0):0}function T$(o,t){let e=be.getAllLayer(),r=be.getAllEnableInnerLayers(),i=new Set,n=be.getActiveLayerID(),s=!1,a=null;for(let h=0;h<o.length;h++){let u=o[h],d=u.layerId,p=JSON.parse(JSON.stringify(u.toJSON()))||{};t.elementShowData=p,t.elementShowData.DISTPLAY_TITLE=u.type||u.model.modelType||"Object",+d&&i.add(+d),u instanceof Le?(s=!0,u.isTestPad?t.elementShowData.DISTPLAY_TITLE="Test Point":t.elementShowData.DISTPLAY_TITLE="Pad",aDt(u,r).forEach(m=>{i.add(m)}),u.unusedInnerLayers.indexOf(n)>=0&&(a=47)):u instanceof Ge&&(s=!0,t.elementShowData.DISTPLAY_TITLE="Via",lDt(u,r).forEach(m=>{i.add(m)}),u.unusedInnerLayers.indexOf(n)>=0&&(a=47)),u instanceof ii&&(t.elementShowData.DISTPLAY_TITLE="Copper Region(Filled)"),(!sDt(u)||u instanceof ii&&u.style!=="solid")&&(t.isBeFilledType=!1)}t.layerOptions.length=0,i.forEach(h=>{if(Number.isNaN(h))return;let u={text:"",value:h};if(!(s&&u.value===12)){for(let d=0;d<e.length;d++)if(e[d].layerID===h){u.text=e[d].name,u.showOriginalText=Ms(h)&&!/^Inner\d+$/.test(u.text);break}t.layerOptions.push(u)}});let l=new Set(Array.from(i).sort((h,u)=>h-u)),c=l.size>0?l.has(n)?n:Array.from(l)[0]:1;a!==null&&l.has(a)&&(c=a),t.layerId=c}function aDt(o,t){let e=new Set,r=o.layerId;if(+r===1)e.add(1),eO(o,5)&&e.add(5),eO(o,7)&&e.add(7);else if(+r===2)e.add(2),eO(o,6)&&e.add(6),eO(o,8)&&e.add(8);else{let i=o.unusedInnerLayers||[];e.add(1),e.add(2),t.forEach(n=>{i.indexOf(n.layerID)<=-1&&e.add(n.layerID)}),e.add(47),eO(o,5)&&e.add(5),eO(o,6)&&e.add(6),eO(o,7)&&e.add(7),eO(o,8)&&e.add(8)}return e}function lDt(o,t){let e=t.map(i=>i.layerID),r=new Set;if(o.startLayer===1&&o.endLayer===2||o.endLayer===1&&o.startLayer===2)r.add(1),t.forEach(i=>{o.unusedInnerLayers.indexOf(i.layerID)<=-1&&r.add(i.layerID)}),r.add(2);else if(e.indexOf(o.startLayer)>=0&&e.indexOf(o.endLayer)>=0){let i=o.startLayer>o.endLayer?o.endLayer:o.startLayer,n=i===o.endLayer?o.startLayer:o.endLayer;for(let s=0;s<t.length;s++)t[s].layerID>=i&&t[s].layerID<=n&&o.unusedInnerLayers.indexOf(t[s].layerID)<=-1&&r.add(t[s].layerID)}else{let i=o.startLayer>o.endLayer?o.endLayer:o.startLayer,n=i===o.endLayer?o.startLayer:o.endLayer;if(i===1){r.add(1);for(let s=0;s<t.length;s++)t[s].layerID<=n&&o.unusedInnerLayers.indexOf(t[s].layerID)<=-1&&r.add(t[s].layerID)}if(i===2){for(let s=0;s<t.length;s++)t[s].layerID>=n&&o.unusedInnerLayers.indexOf(t[s].layerID)<=-1&&r.add(t[s].layerID);r.add(2)}}return r.add(47),r.has(1)&&eO(o,5)&&r.add(5),r.has(2)&&eO(o,6)&&r.add(6),r}function eO(o,t){return!!o.getMathGraphics(t)}var JOe=class{to16(t){return Array.from(t).map(e=>{let r=e.toString(16).toUpperCase();return r.length===1?"0"+r:r})}toAsii(t){return Array.from(t).map(e=>String.fromCharCode(e))}async readFileAsDataURL(t){let e=this;return new Promise((r,i)=>{let n=new FileReader;n.onload=async function(){r(this.result)},n.onerror=function(){r("")},n.readAsDataURL(t)})}async readImageSrcAsBlob(t){return new Promise((e,r)=>{fetch(t).then(i=>{if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return i.blob()}).then(i=>{console.log("\u56FE\u7247\u5DF2\u8F6C\u6362\u4E3ABlob:",i),e(i)}).catch(i=>{console.error("\u56FE\u7247\u8F6C\u6362\u4E3ABlob\u65F6\u51FA\u9519:",i)})})}async readFileAsUint8(t,e=t.size){e=Math.min(e,t.size);let r=[],i=2*1024*1024,n=0,s=Math.min(i,e);for(;n<e;){let a=new Promise((l,c)=>{let h=new FileReader;h.onload=function(){if(this.result instanceof ArrayBuffer){let u=new Uint8ClampedArray(this.result);l(u)}},h.readAsArrayBuffer(t.slice(n,s))});r.push(a),n=s,s=Math.min(n+i,e)}return Promise.all(r).then(a=>{let l=new Uint8ClampedArray(e);for(let c=0,h=0;c<a.length;c++){let u=a[c];l.set(u,h),h+=u.byteLength}return Promise.resolve(l)})}},tAe=5*1024*1024,Rue=class extends JOe{async getImageType(t){let e=await this.readFileAsUint8(t,64),r=this.to16(e),i=l=>{for(let c=0;c<l.length;c++)if(r[c].trim()!==l[c].trim().toUpperCase())return!1;return!0};if(i(["FF","D8"]))return"jpg";if(i(["89","50","4E","47","0D","0A","1A","0A"]))return"png";let n=["47","49","46","38","39","61"],s=["47","49","46","38","37","61"];if(i(n)||i(s))return"gif";if(i(["42","4D"]))return"bmp";let a=this.toAsii(e).join("");return i(["52","49","46","46"])&&a.indexOf("WEBP")>-1?"webp":null}replaceDataUrlMineType(t,e){var i;let r=/^(data:image\/)(.{1,10})(;)/;return((i=t.match(r))==null?void 0:i[2])!==e?t.replace(r,`$1${e}$3`):t}async readFileAsDataURL(t,e){let r=await super.readFileAsDataURL(t);if(r&&e){let i=await this.getImageType(t);i&&(r=this.replaceDataUrlMineType(r,i))}return r}async readImageSrcAsBlob(t){return new Promise((e,r)=>{fetch(t).then(i=>{if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return i.blob()}).then(i=>{console.log("\u56FE\u7247\u5DF2\u8F6C\u6362\u4E3ABlob:",i),e(i)}).catch(i=>{console.error("\u56FE\u7247\u8F6C\u6362\u4E3ABlob\u65F6\u51FA\u9519:",i)})})}readUrlAsImage(t){return new Promise((e,r)=>{let i=new Image;i.onload=function(n){e({image:i,msg:""})},i.onerror=function(n){e({image:null,msg:"Read image file error."})},i.src=t})}async compressImageByCanvas(t,e=tAe,r,i=.92,n=!1){if(!n&&(r||t.length)<e)return t;{let s=new QOe;return await s.drawImageByUrl(t),await s.getDataUrlWithCompress(e,i)}}},QOe=class{constructor(){this.reset()}readCanvasAsDataURL(t=.92){return this.canvas.toDataURL("image/jpeg",t)}async readCanvasAsBlob(t=.92){return new Promise((e,r)=>{this.canvas.toBlob(i=>e(i),"image/jpeg",t)})}async getDataUrlWithCompress(t,e=.92){let r=!0;for(;e>=.1||r;){r=!1;let i=this.readCanvasAsDataURL(e);if(i.length<=t)return i;e=e-.1}return null}async drawImageByUrl(t){let{canvas:e,ctx:r}=this,i=new Image,n=!1;return new Promise((s,a)=>{i.onload=function(){n||(n=!0,this.width>0&&this.height>0&&(e.width=this.width,e.height=this.height),r.drawImage(i,0,0),s(!0))},i.src=t})}reset(){this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d")}};async function LXe(o){let t=new TextEncoder().encode(o),e=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(e)).map(n=>n.toString(16).padStart(2,"0")).join("")}function MXe(o,t){let e=o.width,r=o.height,i=t.naturalWidth,n=t.naturalHeight,s=i/n,a=e/10,l=r/10,c=0,h=0,u=0,d=0;return s>a/l?(c=l*s,h=l):(c=a,h=a/s),u=(e-c)/2,d=(r-h)/2,{boardWidth:e,boardHeight:r,sourceMarginLeft:0,sourceMarginTop:0,sourceImageWidth:i,sourceImageHeight:n,drawMarginLeft:u,drawMarginTop:d,drawImageWidth:c,drawImageHeight:h}}function Due(o,t,e){let r=o.width,i=o.height,n=t.naturalWidth,s=t.naturalHeight,a=e.width,l=e.height,c=(r-a)/2,h=(i-l)/2;return{boardWidth:r,boardHeight:i,sourceMarginLeft:0,sourceMarginTop:0,sourceImageWidth:n,sourceImageHeight:s,drawMarginLeft:c,drawMarginTop:h,drawImageWidth:a,drawImageHeight:l}}function I$(o){let e=/(\d+(\.\d+)?)([*x ]?)(\d+(\.\d+)?)?\s*([a-zA-Z]+)/i.exec(o);if(e){let r=parseFloat(e[1]),i=parseFloat(e[4])||0,n=e[6].trim(),s=new ft;return n!=="mil"?(i=s.conversion("mm","mil",i)/10,r=s.conversion("mm","mil",r)/10):(i=i/10,r=r/10),{width:i,height:r,unit:"mm"}}else return null}function C$(o,t){let e=new ft;return t!=="mil"?o=e.conversion(t,"mil",o)/10:o=o/10,o}var eAe=class{constructor(){this.components={};this.initial()}update(t,e){this.isFontAppend(e,t.id)||this.render(t,e);let r=this.components[e][t.id].node;Object.keys(t).forEach(i=>{switch(i){case"transform":{r.style.transform=this.transform(r,t.transform);break}case"content":r.querySelectorAll(".triangleToolFont-content").forEach(s=>{s.textContent=t.content})}})}delete(t,e){this.isFontAppend(t,e)&&(this.components[t][`${e}`].node.remove(),delete this.components[t][e])}render(t,e){if(this.parent||(this.parent=document.querySelector("#canvas-2d").parentNode),this.components[t.id])return console.warn("TriangleToolFont: id duplicate");this.components[e]||(this.components[e]={});let r=this.components[e],i=r[t.id];if(!i){let n=this.createRender(t,e);i={node:n.children[0]},r[t.id]=i,this.parent.appendChild(n)}}isFontAppend(t,e){return this.components[t]&&this.components[t][e]}transform(t,e){let[r,i,n]=e;switch(r){case"leftCenter":{n=n-t.offsetHeight/2;break}case"rightCenter":{i=i-t.offsetWidth,n=n-t.offsetHeight/2;break}case"topCenter":{i=i-t.offsetWidth/2;break}case"bottomCenter":{i=i-t.offsetWidth/2,n=n-t.offsetHeight;break}case"rightTop":{i=i-t.offsetWidth;break}case"rightBottom":{i=i-t.offsetWidth,n=n-t.offsetHeight;break}case"leftBottom":{n=n-t.offsetHeight;break}}return`translate(${i}px, ${n}px)`}initial(){let t=this.components[x.getInstance().id]||{};Object.keys(t).forEach(e=>{t[e]&&(t[e].node.style.display="block")})}createRender(t,e){let r=`
			<div 
				class="TriangleToolFont-${t.id}"
				style="
					position: absolute; 
					left: 0; 
					top: 0;
					z-index: 999;
					padding: 4px 9px;
					background-color: rgba(0, 0, 0, 0.9); 
					color: white;
					border: 1px solid rgb(80, 80, 80, 0.5); 
					box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 10px 5px; 
					letter-spacing: 1px;
					pointer-events: none;
					width: auto; 
					height: auto;
				"
				${e?'data-host-id="'+e+'"':""}
			>
				<span class="triangleToolFont-content">${t.content}</span>
			</div>
    	`;return document.createRange().createContextualFragment(r)}},wXe=new eAe;function rAe(o){let t=x.getInstance().id;o.options.forEach(e=>{if(e.transform){let[r,i,n]=e.transform;e.transform[1]=e.transform[1],e.transform[2]=e.transform[2]}switch(e.operate){case"update":{wXe.update(e,t);break}case"delete":{wXe.delete(t,e.id);break}}})}var iAe=class{constructor(){this.unitConversion=new ft;this.start=null;this.end=null;this.line1=null;this.line2=null;this.line3=null;this.arc=null;this.lines=new Array;this.fonts=new Array;this.statisticFontsId=new Set;this.dx="";this.dy="";this.length="";this.angle="";this.isFilpPath=!1;this.oldScale=0;this.isRuning=!1;this.creepageDistanceIns=null}getOriginPoint(t,e){let r=e.sub(t),i;return this.isFilpPath?i=this.start.add(new S(0,r.y)):i=this.start.add(new S(r.x,0)),i}calculateCreepageDistance(t,e){var P;if(this.creepageDistanceIns!=null){for(let T of this.creepageDistanceIns.lines)T.remove();this.creepageDistanceIns.font.remove(),this.creepageDistanceIns=null}let r=t.elements[0],i=e.elements[0];if(!r||!i)return;let n=A_(r.model),s=A_(i.model),a=r.model,l=i.model;if(!n||!s||n===""||s==="")return;let h=new eG().measure(r.model,i.model,void 0,(T,I)=>{ie.publish("ui/toastMsg",{type:"error",msg:"Selection failed. Selected object is not within the board outline."},j0())});if(h===null)return;let u=h.path,d=this.getLengthInfo(h.realDistance),p=h.realDistance,m=[],g=new _e;for(let T of u){if(T instanceof M){let I=Yi.build(1001,T.start(),T.end(),.01);m.push(I)}else if(T instanceof q){let I=Zo.build(1001,T.center,T.rx,.01,mh(T.startAngle),mh(T.endAngle()),T.sweep());m.push(I)}g.ext1(T.bbox())}let y=(P=g.build())==null?void 0:P.center(),b=new U_(this.getDisplayText(p),y,0,10,20,30,40,1001);this.creepageDistanceIns={lines:m,font:b,path:u,pathDistance:d,realDistance:p,showRichInfo:Hh.showRichInfo}}modifyTriangle(t,e,r=!1){this.isRuning=!0,this.start!=null&&(this.end!=null&&!r&&this.end.equals(t)?this.modifyRule(this.start,t,e,r):(this.modifyLine(this.start,t,e),this.modifyRule(this.start,t,e,r),this.modifyStatisticFonts(this.start,t,e)))}modifyRule(t,e,r,i=!1){let n=Ni().getScale();if(!i&&Math.abs(n-this.oldScale)<1e-8&&this.end!=null)return;this.oldScale=n;let{startAngle:s,endAngle:a}=this.getStartAndEndAngle(this.start,e);if(this.arc!=null){(this.arc.center.x!==e.x||this.arc.center.y!==e.y)&&(this.arc.center=e),this.arc.startAngle!==s&&(this.arc.startAngle=s),this.arc.endAngle!==a&&(this.arc.endAngle=a);let E=this.getSweep(t,e);this.arc.sweep!==E&&(this.arc.sweep=E)}else this.arc=ns.build(1002,e,40/n,s,a,this.getSweep(t,e),this.getColor());this.lines.forEach(E=>{E.remove()}),this.lines.length=0,this.fonts.forEach(E=>{E.remove()}),this.fonts.length=0;let l=0,c=n;for(;;)if(c>=1){if(c=c/10,c<1)break;l++}else if(c=c*10,l--,c>=1)break;let h=n/Math.pow(10,l),u;h>=1&&h<2?u=Math.pow(10,l):h>=2&&h<5?u=2*Math.pow(10,l):u=5*Math.pow(10,l);let d=10/u,p=t.distance1(r),m=e.distance1(r),g=e.sub(r).normalize(),y=t.sub(r).normalize(),b=1,P=20/n,T=14/n,I=8/n,C=20/n;for(let E=d;E<=p;E+=d){let O=r.add(y.mul(E)),_;if(b%10==0){_=O.add(g.mul(P));let v=new U_(this.conversion(E),_,0,5,15,1e5,C,1002);this.fonts.push(v)}else b%5==0?_=O.add(g.mul(T)):_=O.add(g.mul(I));let R=new hr(1002,O,_,!0,this.getColor());this.lines.push(R),b++}b=1;for(let E=d;E<=m;E+=d){let O=r.add(g.mul(E)),_;if(b%10==0){_=O.add(y.mul(P));let v=this.conversion(E),D=new U_(v,_.add(y.mul(P)),0,5,15,1e5,C,1002);this.fonts.push(D)}else b%5==0?_=O.add(y.mul(T)):_=O.add(y.mul(I));let R=new hr(1002,O,_,!0,this.getColor());this.lines.push(R),b++}}getStartAndEndAngle(t,e){let r=0,i=0;return e.x>t.x?(r=e.y<=t.y?90*(Math.PI/180):-90*(Math.PI/180),i=this.getAngle(t,e)):e.x<t.x&&(r=this.getAngle(t,e),i=e.y<=t.y?90*(Math.PI/180):-90*(Math.PI/180)),{startAngle:r,endAngle:i}}modifyStatisticFonts(t,e,r){let n=x.getInstance().getRatio()/Ni().getScale(),s=t,a=e;this.isFilpPath&&(s=e,a=t);let l=s.distance1(r),c=a.distance1(r);this.dx=this.getLengthInfo(l),this.dy=this.getLengthInfo(c),this.length=this.getLengthInfo(t.distance1(e));let{startAngle:h,endAngle:u}=this.getStartAndEndAngle(this.start,e);this.angle=(Math.abs(h-u)/Math.PI*180).toFixed(3)+"\xB0";let d=s.sub(r).normalize(),p=a.sub(r).normalize(),m=this.arc.radius,g=s.add(r).mul(.5),y=a.add(r).mul(.5),b=t.add(e).mul(.5).add(d.mul(10*n)),P=e,T=d.dot(new S(we.flipBoard?-1:1,0))>0,I=p.dot(new S(0,1))>0,C=I?"topCenter":"bottomCenter",E=T?"rightCenter":"leftCenter",O=Number(I)^Number(this.isFilpPath)?"bottomCenter":"topCenter",_=T?"leftBottom":"rightBottom";!I&&(_=T?"leftTop":"rightTop");let R=this.dx,v=this.dy,D=this.length,w=this.angle;if(this.isFilpPath?P=e.sub(p.mul(23*n)):I||(O=T?"leftTop":"rightTop"),this.isFilpPath?l>.1&&c<.1?(E=T?"rightTop":"leftTop",P=P.add(new S(0,1).mul(43*n))):l<.1&&c>.1&&(E="rightCenter",g=g.sub(p.mul(43*n)),I?(O="leftTop",C="leftTop"):(O="leftBottom",C="leftBottom")):l>.1&&c<.1?(T?(E="rightTop",y=y.sub(d.mul(m+10*n))):E="leftTop",P=P.add(new S(0,1).mul(65*n))):l<.1&&c>.1&&(I?(O="rightBottom",C="rightTop"):(O="rightTop",C="rightBottom")),l<.1&&c<.1&&(P=r.add(new S(0,1).mul(m)),g=r.add(new S(-1,0).mul(m)),y=r.add(new S(1,0).mul(m)),O="bottomCenter",C="rightCenter",E="leftCenter"),c>.1&&l>.1){let z=24*n,G,W=!1;if(this.isFilpPath?(T&&c<m||!T&&l<m)&&(G=s.add(new S(1,0).mul(m)),W=!0):(!T&&c<m||T&&l<m)&&(G=I?a:r,G=G.add(new S(1,0).mul(m)),W=!0),W){let L=window["SILKVIEWER-SOURCE"]=="FOREIGN-TRADE";G=G.add(new S(0,1).mul(z)),C="leftTop",E="leftTop",O="leftTop",_="leftTop",g=G,y=g.add(new S(0,-1).mul(z)),P=y.add(new S(0,-1).mul(z)),b=P.add(new S(0,-1).mul(z)),R="DX: "+R,v="DY: "+v,w=L?"R":"\u89D2\u5EA6: "+w,D=L?"L":"\u957F\u5EA6: "+D}}let F=[];if(this.pushStatisticFontData(F,"dX",C,g,R),this.pushStatisticFontData(F,"dY",E,y,v),this.pushStatisticFontData(F,"angle",O,P,w),Math.abs(l)<1e-8||Math.abs(c)<1e-8?this.deleteStatisticFonts("length"):this.pushStatisticFontData(F,"length",_,b,D),x.getInstance().envFlag=="silk-preview"){rAe({options:F});return}ie.windowBridge.publish("RenderTriangleToolFont",{options:F},j0())}deleteStatisticFonts(t){if(!this.statisticFontsId.has(t))return;if(x.getInstance().envFlag=="silk-preview"){rAe({options:[{operate:"delete",id:t}]});return}ie.windowBridge.publish("RenderTriangleToolFont",{options:[{operate:"delete",id:t}]},j0()),this.statisticFontsId.delete(t)}pushStatisticFontData(t,e,r,i,n){i=Fo(i);let s=[r,i.x,i.y];t.push({operate:"update",id:e,transform:s,content:n}),this.statisticFontsId.add(e)}getColor(){return ce.pcbConfig.graphicEffectMode=="effectFirst"?ee.WHITE:ee.build(1,1,1,.7)}modifyLine(t,e,r){this.line1!=null?(this.line1.start=r,this.line1.end=t):this.line1=new hr(1002,r,t,!0,this.getColor()),this.line2!=null?(this.line2.start=r,this.line2.end=e):this.line2=new hr(1002,r,e,!0,this.getColor()),this.line3!=null?(this.line3.start=t,this.line3.end=e):this.line3=new hr(1002,t,e,!0,this.getColor())}getAngle(t,e){let r=t.sub(e).normalize();return Math.atan2(r.y,r.x)}getSweep(t,e){let r=t.sub(e).normalize();return new S(1,0).cross(r)>=0?le.CCW:le.CW}conversion(t){let e=this.unitConversion.conversion("mil",x.getInstance().unit,t);return e=Math.round(e*1e4)/1e3,e.toString()}getLengthInfo(t){let e=this.unitConversion.conversion("mil","mm",t)*10;e=Math.round(e*1e3)/1e3;let r=Math.round(t*100)/10;return e.toFixed(3)+"mm"+"("+r.toFixed(1)+"mil)"}getDisplayText(t){if(!Hh.showRichInfo){let e=this.unitConversion.conversion("mil","mm",t)*10;return e=Math.round(e*1e3)/1e3,e.toFixed(3)+"mm"}return this.getLengthInfo(t)}updateSavedMeasurementsDisplay(){var t;if(this.creepageDistanceIns!=null&&this.creepageDistanceIns.showRichInfo===Hh.showRichInfo){this.creepageDistanceIns.font.remove();let e=this.getDisplayText(this.creepageDistanceIns.realDistance),r=new _e;for(let n of this.creepageDistanceIns.path)r.ext1(n.bbox());let i=(t=r.build())==null?void 0:t.center();this.creepageDistanceIns.font=new U_(e,i,0,10,20,30,40,1001)}}destroy(){this.start=null,this.end=null,this.line1!=null&&(this.line1.remove(),this.line1=null),this.line2!=null&&(this.line2.remove(),this.line2=null),this.line3!=null&&(this.line3.remove(),this.line3=null),this.arc!=null&&(this.arc.remove(),this.arc=null),this.lines.forEach(t=>{t.remove()}),this.lines.length=0,this.fonts.forEach(t=>{t.remove()}),this.fonts.length=0;for(let t of this.statisticFontsId)this.deleteStatisticFonts(t);if(this.creepageDistanceIns!=null){for(let t of this.creepageDistanceIns.lines)t.remove();this.creepageDistanceIns.font.remove(),this.creepageDistanceIns=null}this.isRuning=!1}},hn=new iAe;var nAe=class{constructor(){}getMinDistResultAboutDotAndElement(t,e,r="CENTER",i){let n={minDistValue:0,minline:null},s=this.getCalcOutline(t,r,+i),a=this.createPrimitiveSet(s),l=Number.MAX_SAFE_INTEGER;for(let c of a){let h=new Zu(e,c),u=h.getDistance();l>=u&&(l=u,n.minDistValue=l,n.minline=h.getLine())}return n}getMinDistResultAboutElementAndElement(t,e,r="CENTER",i="CENTER",n,s){let a={minDistValue:0,minline:null,swap:!1},l=this.getCalcOutline(t,r,+n),c=this.getCalcOutline(e,i,+s),h=this.createPrimitiveSet(l),u=this.createPrimitiveSet(c),d=null,p=!1;h.size<=1e3&&u.size<=1e3?d=this.findMinDistItemByLoop(h,u):(p=!0,d=this.findMinDistItemBySearch(h,u)),p&&(d===null||typeof d>"u")&&(d=this.findMinDistItemByLoop(h,u));let m=!1,g=null;if(d){g=d.getLine().start();let y=new Zu(new M(g,g),d.pt1),b=new Zu(new M(g,g),d.pt2),P=y.getDistance()>b.getDistance()?b:y;(u.has(P.pt1)||u.has(P.pt2))&&(m=!0),a.minDistValue=d.getDistance(),a.minline=d.getLine()}return a.swap=m,a}createPrimitiveSet(t){let e=new Set;if(!t)return e;if(t instanceof Tl)return e.add(t),e;if(t instanceof fe){for(let r of t.primitives)e.add(r);return e}if(t instanceof Gt){for(let r of t.items)for(let i of r.primitives)e.add(i);return e}for(let r of t)for(let i of r.primitives)e.add(i);return e}getCalcOutline(t,e,r){if(t instanceof Ue)return e=="CENTER"?t.primitive:t.getMathGraphics(t.layerId);if(t instanceof Le){if(e=="CENTER"){let i=t.getMathGraphics(r);return i===null?null:new M(i.bbox().center(),i.bbox().center())}return t.getMathGraphics(r)}if(t instanceof Ge)return e=="CENTER"?new M(t.center,t.center):t.getMathGraphics(r);if(t instanceof n0||t instanceof fr){if(e=="CENTER"){let n=t.buildBBox().center();return new M(n,n)}return t.getMathGraphics(t.layerId,0)}if(t instanceof A0){if(e=="CENTER"){if(t instanceof ii){let s=t.getOutline(),a=new Array;if(t.style=="solid"){let c=t.buildBBox().center();return new M(c,c)}for(let l of s)a.push(l);return a}let n=t.buildBBox().center();return new M(n,n)}if(t instanceof ii){let i=t.getOutline(),n=new Array;if(t.style=="solid"){if(Re.addAll(n,i),t.optimization)for(let s of i)for(let a of s.primitives){let l=a.stroke(t.optimizationWidth,kr.ROUND,le.CCW);n.push(l)}}else for(let s of i)for(let a of s.primitives){let l=a.stroke(t.gridLineWidth,kr.ROUND,le.CCW);n.push(l)}return n}return t instanceof Ki?t.getOutline():null}if(t instanceof Me)return e=="CENTER"?new M(t.position,t.position):t.getMathGraphics(t.layerId,0);if(t instanceof mt||t instanceof vt)return e=="CENTER"?t.primitive:t.getMathGraphics(t.layerId,0);if(t instanceof Ye){let i=t.getMathGraphics();if(e=="CENTER"){if(t.type=="Fill Region"||t.type=="Constraint Region"||t.type=="Slot Region"||t.type=="Prohibited Region"||t.type=="FPC Stiffener"||t.type=="3D Shell - Top Slot Region"||t.type=="3D Shell - Side Slot Region"||t.type=="3D Shell - Side Entity"||t.type=="TearDrop"){let a=t.buildBBox().center();return new M(a,a)}return i}if(t instanceof Sr){let s=i.primitives[0],a=q.build3(s.center,0,180,s.rx,s.ry),l=q.build3(s.center,180,360,s.rx,s.ry);i=fe.build2([a,l])}let n=new Array;if(["Copper Region","Fill Region","Slot Region","Prohibited Region","Constraint Region","FPC Stiffener","3D Shell - Outline","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Top/Bottom Entity","3D Shell - Side Entity"].includes(t.type))for(let s of i.primitives){let a=fe.build4([s.start(),s.end()]);n.push(a)}else for(let s of i.primitives){let a=s.stroke(t.strokeWidth,kr.ROUND,le.CCW);n.push(a)}return n}return null}buildStaticRTree(t){let e=new nn(10);for(let r of t)e.add(r);return e}findMinDistItemByLoop(t,e){let r=null,i=Number.MAX_SAFE_INTEGER;for(let n of t)for(let s of e){let a=new Zu(n,s),l=a.getDistance();i>=l&&(i=l,r=a)}return r}findMinDistItemBySearch(t,e){return t.size>=e.size?this.searchRtree(t,e):this.searchRtree(e,t)}searchRtree(t,e){let r=null,i=.01,n=N0(),s=n.width(),a=n.height(),l=a>=s?a:s,c=this.buildStaticRTree(t),h=(d,p,m)=>{let g=null,y=!0;for(let b of p){let P=b.bbox().extendOfSize(m),T=d.search(P);for(let I of T){let C=new Zu(b,I),E=C.getDistance();if(y){y=!1,m=E,g=C;continue}m>=E&&(m=E,g=C)}}return g},u=1e-5;for(;u<=l;){if(r=h(c,e,u),r)return r;u+=i}return r}},X_=new nAe;var Uu=class o extends ZI{static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}constructor(){super(),this._distMeasureParams=new vue,this._isOpenedContextmenu=!1,this._hasSettingResult=!1}get distMeasureParams(){return this._distMeasureParams}set distMeasureParams(t){this._distMeasureParams=t}get isOpenedContextmenu(){return this._isOpenedContextmenu}set isOpenedContextmenu(t){this._isOpenedContextmenu=t}get hasSettingResult(){return this._hasSettingResult}set hasSettingResult(t){this._hasSettingResult=t}setAllElementsInitStatus(){let t=this.getAllElements();for(let e=0;e<t.length;e++)[this.distMeasureParams.startTarget.elementId,this.distMeasureParams.endTarget.elementId].indexOf(t[e].globalIndex)>=0&&t[e].visible()}createMeasureResulBySelectTarget(t,e){this.distMeasureParams.startTarget.allElements=t.elements,this.distMeasureParams.startTarget.elementId=null,this.distMeasureParams.startTarget.isBeFilledType=!0,this.distMeasureParams.startTarget.x=0,this.distMeasureParams.startTarget.y=0,this.distMeasureParams.startTarget.sourceX=t.x,this.distMeasureParams.startTarget.sourceY=t.y,this.distMeasureParams.startTarget.type="DOT",this.distMeasureParams.startTarget.position="EDGE",this.distMeasureParams.endTarget.allElements=e.elements,this.distMeasureParams.endTarget.elementId=null,this.distMeasureParams.endTarget.isBeFilledType=!0,this.distMeasureParams.endTarget.x=0,this.distMeasureParams.endTarget.y=0,this.distMeasureParams.endTarget.sourceX=e.x,this.distMeasureParams.endTarget.sourceY=e.y,this.distMeasureParams.endTarget.type="DOT",this.distMeasureParams.endTarget.position="EDGE",this.distMeasureParams.measureResult.dx=hn.dx,this.distMeasureParams.measureResult.dy=hn.dy,this.distMeasureParams.measureResult.distance=hn.length,this.distMeasureParams.measureResult.angle=hn.angle+"",Hh.measureMode==="CreepageDistance"?(this.distMeasureParams.measureResult.distance=hn.creepageDistanceIns.pathDistance,console.log(this.distMeasureParams.measureResult.distance),t.elements.length&&(this.distMeasureParams.startTarget.type="CREEPAGE",T$(t.elements,this.distMeasureParams.startTarget)),e.elements.length&&(this.distMeasureParams.endTarget.type="CREEPAGE",T$(e.elements,this.distMeasureParams.endTarget))):(t.elements.length&&(this.distMeasureParams.startTarget.type="OBJECT",T$(t.elements,this.distMeasureParams.startTarget)),e.elements.length&&(this.distMeasureParams.endTarget.type="OBJECT",T$(e.elements,this.distMeasureParams.endTarget))),this.refreshMeasureResultBySelectedElements()}createHeader(t){let e=this.createBaseHeader();return e.id=t,e.action=t,e.tabId=x.getInstance().tabId,e}createBody(t=!1){let e={};return e.measureMode=Hh.measureMode,e.showRichInfo=Hh.showRichInfo,e.canvas=this.createCanvas(),t&&this.distMeasureParams.reset(),e={...e,...this.distMeasureParams.toJSON()},e}correct(t,e){this.distMeasureParams.startTarget.allElements=t,this.distMeasureParams.endTarget.allElements=e}handleHeaderUpdate(t){}handleBodyUpdate(t){this.updateCommon(t),this.updateCanvas(t.canvas),this.updateTarget("startTarget",t.startTarget),this.updateTarget("endTarget",t.endTarget),A.publish("flushService",""),A.publish("updateFrame","")}refreshMeasureResultBySelectedElements(){let t=new S(this.distMeasureParams.startTarget.sourceX,this.distMeasureParams.startTarget.sourceY),e=new S(this.distMeasureParams.endTarget.sourceX,this.distMeasureParams.endTarget.sourceY);if(this.distMeasureParams.startTarget.allElements.length<=0&&this.distMeasureParams.endTarget.allElements.length<=0){this.flushResult(t,e,null,null);return}let r=Number.MAX_SAFE_INTEGER,i=null,n=null,s=null,a=null;if(this.distMeasureParams.startTarget.allElements.length<=0&&this.distMeasureParams.endTarget.allElements.length>0){for(let c=0;c<this.distMeasureParams.endTarget.allElements.length;c++){let h=X_.getMinDistResultAboutDotAndElement(this.distMeasureParams.endTarget.allElements[c],new M(t,t),this.distMeasureParams.endTarget.position,this.distMeasureParams.endTarget.layerId);h.minline&&r>=h.minDistValue&&(r=h.minDistValue,i=h.minline.start(),n=h.minline.end(),a=this.distMeasureParams.endTarget.allElements[c])}i&&n&&(t.x===n.x&&t.y===n.y?e=i:e=n),this.flushResult(t,e,s,a);return}if(this.distMeasureParams.startTarget.allElements.length>0&&this.distMeasureParams.endTarget.allElements.length<=0){for(let c=0;c<this.distMeasureParams.startTarget.allElements.length;c++){let h=X_.getMinDistResultAboutDotAndElement(this.distMeasureParams.startTarget.allElements[c],new M(e,e),this.distMeasureParams.startTarget.position,this.distMeasureParams.startTarget.layerId);h.minline&&r>=h.minDistValue&&(r=h.minDistValue,i=h.minline.start(),n=h.minline.end(),s=this.distMeasureParams.startTarget.allElements[c])}i&&n&&(e.x===i.x&&e.y===i.y?t=n:t=i),this.flushResult(t,e,s,a);return}let l=!1;for(let c=0;c<this.distMeasureParams.startTarget.allElements.length;c++)for(let h=0;h<this.distMeasureParams.endTarget.allElements.length;h++){let u=X_.getMinDistResultAboutElementAndElement(this.distMeasureParams.startTarget.allElements[c],this.distMeasureParams.endTarget.allElements[h],this.distMeasureParams.startTarget.position,this.distMeasureParams.endTarget.position,this.distMeasureParams.startTarget.layerId,this.distMeasureParams.endTarget.layerId);u.minline&&r>=u.minDistValue&&(r=u.minDistValue,i=u.minline.start(),n=u.minline.end(),l=!!u.swap,s=this.distMeasureParams.startTarget.allElements[c],a=this.distMeasureParams.endTarget.allElements[h])}i&&n&&(l?(t=n,e=i):(t=i,e=n)),this.flushResult(t,e,s,a)}createCanvas(){let t=x.getInstance().unit,e=Xs.conversion1("mil",t,St.getInstance().getGridX()*10),r=Xs.conversion1("mil",t,St.getInstance().getGridY()*10),i=e===r?e+"":e+","+r,n=Xs.conversion1("mil",t,St.getInstance().getSnapX()*10),s=Xs.conversion1("mil",t,St.getInstance().getSnapY()*10),a=n===s?n+"":e+","+s,l={};return l.unit=t,l.gridType=we.gridType,l.blodGridType=we.multiType,l.gridSize=i+"",l.snapSize=a+"",l.adsorb=we.adsorb?"yes":"no",l}updateCommon(t){Hh.showRichInfo!=t.showRichInfo&&(Hh.showRichInfo=t.showRichInfo,hn.updateSavedMeasurementsDisplay());let e=Hh.measureMode;Hh.measureMode=t.measureMode,this.handleToolSwitching(t,e)}handleToolSwitching(t,e){if(t.measureMode!==e&&t.measureMode)switch(A.publish("resetToolLastCmd",""),t.measureMode){case"MeasureDistance":A.publish("tool","MeasureDistance");break;case"CreepageDistance":A.publish("tool","CreepageDistance");break;case"MeasureObjectDistance":A.publish("tool","MeasureObjectDistance");break}}updateTarget(t,e){let r=!1;t==="startTarget"&&(this.distMeasureParams.startTarget.layerId!==e.layerId&&(this.distMeasureParams.startTarget.layerId=e.layerId,r=!0),this.distMeasureParams.startTarget.position!==e.position&&(this.distMeasureParams.startTarget.position=e.position,r=!0)),t==="endTarget"&&(this.distMeasureParams.endTarget.layerId!==e.layerId&&(this.distMeasureParams.endTarget.layerId=e.layerId,r=!0),this.distMeasureParams.endTarget.position!==e.position&&(this.distMeasureParams.endTarget.position=e.position,r=!0)),r&&(Hh.measureMode==="CreepageDistance"?this.recalculateCreepageDistance():this.refreshMeasureResultBySelectedElements())}updateCanvas(t){let e=x.getInstance().unit,r=Xs.conversion1("mil",e,St.getInstance().getGridX()*10),i=Xs.conversion1("mil",e,St.getInstance().getGridY()*10),n=r===i?r+"":r+","+i,s=Xs.conversion1("mil",e,St.getInstance().getSnapX()*10),a=Xs.conversion1("mil",e,St.getInstance().getSnapY()*10),l=s===a?s+"":r+","+a,c=we.gridType,h=we.multiType,u=we.adsorb;t.unit!==e&&FC(t.unit),t.gridType!==c&&(we.gridType=t.gridType,A.messageBus.publish("switchGridType",t.gridType),A.publish("switchGridTypeBtn",t.gridType,$())),t.blodGridType!==h&&(we.multiType=t.blodGridType,A.messageBus.publish("switchMultiGridType",t.blodGridType)),t.gridSize!==n&&this.updateCanvasGirdSnap("gridSize",t.gridSize),t.snapSize!==l&&this.updateCanvasGirdSnap("snapSize",t.gridSize);let d=t.adsorb==="yes";d!==u&&A.publish("toggleAdsorb",d)}updateCanvasGirdSnap(t,e){let r=e.split(/,|，/),i=0,n=0;r.length==1?i=n=parseFloat(r[0]):r.length==2&&(i=parseFloat(r[0]),n=parseFloat(r[1])),!(isNaN(i)||isNaN(n))&&(i=ka(i,x.getInstance().unit=="mil"?1:3),n=ka(n,x.getInstance().unit=="mil"?1:3),t==="gridSize"&&(St.getInstance().setGridX(Xs.conversion(x.getInstance().unit,"mil",i)/10),St.getInstance().setGridY(Xs.conversion(x.getInstance().unit,"mil",n)/10),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())),t==="snapSize"&&(St.getInstance().setSnapX(Xs.conversion(x.getInstance().unit,"mil",i)/10),St.getInstance().setSnapY(Xs.conversion(x.getInstance().unit,"mil",n)/10),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())),wp())}flushResult(t,e,r,i){let n=x.getInstance().origin;if(Hh.measureMode=="CreepageDistance")hn.start=t,hn.end=e,hn.creepageDistanceIns!=null&&(this.distMeasureParams.measureResult.distance=hn.creepageDistanceIns.pathDistance);else{hn.destroy(),hn.start=t,hn.end=e;let s=hn.getOriginPoint(hn.start,hn.end);hn.modifyTriangle(hn.end,s,!0),hn.modifyStatisticFonts(hn.start,hn.end,s),this.distMeasureParams.measureResult.dx=hn.dx,this.distMeasureParams.measureResult.dy=hn.dy,this.distMeasureParams.measureResult.distance=hn.length,this.distMeasureParams.measureResult.angle=hn.angle+""}r&&(this.distMeasureParams.startTarget.elementId=`${ur}${r.number}`),this.distMeasureParams.startTarget.x=P$(t.x-n.x),this.distMeasureParams.startTarget.y=P$(t.y-n.y),i&&(this.distMeasureParams.endTarget.elementId=`${ur}${i.number}`),this.distMeasureParams.endTarget.x=P$(e.x-n.x),this.distMeasureParams.endTarget.y=P$(e.y-n.y),A.publish("updateFrame",""),A.publish("FlushSketcherAttrView",{type:"DIST_MEASURE"})}recalculateCreepageDistance(){let t={x:this.distMeasureParams.startTarget.sourceX,y:this.distMeasureParams.startTarget.sourceY,hasValue:!0,elements:this.distMeasureParams.startTarget.allElements},e={x:this.distMeasureParams.endTarget.sourceX,y:this.distMeasureParams.endTarget.sourceY,hasValue:!0,elements:this.distMeasureParams.endTarget.allElements};hn.calculateCreepageDistance(t,e),hn.creepageDistanceIns!=null&&(this.distMeasureParams.measureResult.distance=hn.creepageDistanceIns.pathDistance),A.publish("updateFrame",""),A.publish("FlushSketcherAttrView",{type:"DIST_MEASURE"})}getAllCopperResults(t){let e=new Set;for(let r=0;r<t.length;r++)if(t[r].coppers){let i=t[r].coppers;for(let n=0;n<i.length;n++)e.add(i[n])}return e}getAllElements(){let t=Lc(),e=new Set(Lc()),r=new Set(iw()),i=this.getAllCopperResults(t),n=new Array;return Re.addAll(n,e),Re.addAll(n,r),Re.addAll(n,i),n}};var iU=class extends ci{constructor(e){super();this.isMouseRightDown=!1;this.isMouseMidDown=!1;this.isHoldPCBAttrPanel=!0,this.isMouseLeftDown=!1,this.mouseRightDownPageX=0,this.mouseRightDownPageY=0,this.selectedItems=e,this.hoverItems=new Set,this.initSelectTarget(),this.option="OPTIONLEFTUP",this.initSketcherAttrPanel()}updateSelectedItems(e){this.selectedItems=e}getSelctedItems(){return this.selectedItems}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Filp Path While Drawing":hn.isFilpPath=!hn.isFilpPath,this.onMouseMove(e);break;case"Scroll Right":case"Scroll Left":case"Scroll Up":case"Scroll Down":if(hn.start){let i=hn.end||new S(e.sceneX,e.sceneY);hn.modifyStatisticFonts(hn.start,i,hn.getOriginPoint(hn.start,i))}break;case"Finish":this.onEnterPlace(e);break}ie.publish("updateFrame","")}onMouseLeftDown(e){this.isMouseLeftDown=!0,this.startTarget.hasValue&&this.endTarget.hasValue&&(this.selectTargetReset(),Uu.getInstance().distMeasureParams.reset(),Uu.getInstance().setAllElementsInitStatus(),Uu.getInstance().hasSettingResult=!1,ie.publish("FlushSketcherAttrView",{type:"DIST_MEASURE"}),this.end())}onMouseLeftUp(e){this.isMouseLeftDown=!1;let r=this.startTarget.hasValue?this.endTarget:this.startTarget,i=this.getFilteredPcbItemByClickedPoint(e);r.x=e.sceneX,r.y=e.sceneY,r.elements=i.target,r.hasValue=!0;let n=new S(e.sceneX,e.sceneY);if(hn.start==null)this.start(),hn.start=n;else if(hn.end==null)switch(hn.end=n,Hh.measureMode){case"MeasureDistance":case"MeasureObjectDistance":{ie.publish("MeasureDistance",{dx:hn.dx,dy:hn.dy,length:hn.length,angle:hn.angle},$());let s=hn.getOriginPoint(hn.start,hn.end);Uu.getInstance().hasSettingResult=!0,hn.modifyTriangle(hn.end,s),hn.modifyStatisticFonts(hn.start,hn.end,s),Uu.getInstance().createMeasureResulBySelectTarget(this.startTarget,this.endTarget),ie.publish("updateFrame","");break}case"CreepageDistance":{if(Uu.getInstance().hasSettingResult=!0,hn.calculateCreepageDistance(this.startTarget,this.endTarget),hn.creepageDistanceIns==null){this.selectTargetReset(),hn.destroy(),Uu.getInstance().hasSettingResult=!1,ie.publish("updateFrame","");break}ie.publish("MeasureDistance",{length:hn.creepageDistanceIns.pathDistance},$()),Uu.getInstance().createMeasureResulBySelectTarget(this.startTarget,this.endTarget),ie.publish("updateFrame","");break}}else hn.destroy(),hn.start=n}onMouseRightDown(e){this.isMouseRightDown=!0,this.mouseRightDownPageX=e.mouseX,this.mouseRightDownPageY=e.mouseY}onMouseRightUp(e){if(this.isMouseRightDown=!1,!(e.mouseX!==this.mouseRightDownPageX||e.mouseY!==this.mouseRightDownPageY)){if(ce.pcbConfig.endDrawing==="ctrl+rightClick"){if(e.ctrlKey){this.isMouseRightDown=!1,e.clearCrossFlag(),this.cancel();return}this.rightClickMenuData(e);return}if(e.ctrlKey){this.rightClickMenuData(e);return}e.clearCrossFlag(),this.cancel(),Uu.getInstance().hasSettingResult=!1}}onMouseWheel(e){if(this.isMouseMidDown=e.middleDown,hn.start!=null){let r=new S(e.sceneX,e.sceneY),i=hn.end||r,n=hn.getOriginPoint(hn.start,i);hn.statisticFontsId.size&&hn.modifyStatisticFonts(hn.start,i,n)}}onMouseMove(e){this.cancelHightlightHoverItems();let r=Hh.measureMode=="CreepageDistance"?dd:dm;if(Hh.measureMode=="CreepageDistance"){let i=$t.measureFilter(e.realSceneX,e.realSceneY,this.filterCreepageItems(Wr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).getResult(r)));e:for(let n=0;n<i.length;n++){let s=i[n];if(!(s instanceof Ye&&s.type==="Copper Region")){if(s instanceof Me){let a=s.getPads();for(let l=0;l<a.length;l++)if(i.indexOf(a[l])>=0)continue e}this.hoverItems.add(s)}}}else{if(Hh.measureMode=="MeasureObjectDistance"){let n=$t.measureFilter(e.realSceneX,e.realSceneY,this.filterCreepageItems(Wr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).getResult(r)));e:for(let s=0;s<n.length;s++){let a=n[s];if(!(a instanceof Ye&&a.type==="Copper Region")){if(a instanceof Me){let l=a.getPads();for(let c=0;c<l.length;c++)if(n.indexOf(l[c])>=0)continue e}this.hoverItems.add(a)}}}let i=new S(e.sceneX,e.sceneY);if(hn.start!=null){let n=hn.end||i,s=hn.getOriginPoint(hn.start,n);this.drawing&&hn.modifyTriangle(n,s),(this.isMouseRightDown||this.isMouseMidDown)&&hn.statisticFontsId.size&&hn.modifyStatisticFonts(hn.start,n,s)}}this.hightlightHoverItems()}onEnterPlace(e){this.onMouseLeftUp(e),this.onMouseLeftDown(e)}interrupt(){hn.destroy(),this.end()}cancel(){this.interrupt(),this.selectTargetReset(),this.cancelHightlightHoverItems(),ie.publish("tool","dropdrag"),ie.publish("destoryCanvasCross",null),ie.publish("ExitSketcherAttrView",{type:"DIST_MEASURE"})}rightClickMenuData(e){if(this.isMouseLeftDown)return;let r={state:"show",left:e.mouseX,top:e.mouseY,filter:DXe(e.adsorb,Hh.measureMode=="MeasureObjectDistance")};Qt.getInstance().menuData(r,this),this.drawing=!1,Uu.getInstance().isOpenedContextmenu=!0}parse(e){let r=e.cmdKey;this.drawing=!0;let i=r.split(":"),n={CreepageDistance:"CreepageDistance",MeasuringDistance:"MeasureDistance",OBJECT_PRIORITY:"MeasureObjectDistance"};switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":ie.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":ie.publish("openSystemDialog","ADSORPTION",$());break;case"CreepageDistance":case"MeasuringDistance":case"OBJECT_PRIORITY":{Hh.measureMode=n[i[0]],ie.publish("FlushSketcherAttrView",{type:"DIST_MEASURE"});break}}Uu.getInstance().isOpenedContextmenu=!1,ie.publish("updateFrame","")}initSelectTarget(){this.startTarget={x:-1,y:-1,hasValue:!1,elements:[]},this.endTarget={x:-1,y:-1,hasValue:!1,elements:[]}}selectTargetReset(){this.startTarget.elements.forEach(e=>{e.visible()}),this.startTarget.elements=[],this.startTarget.x=this.startTarget.y=-1,this.startTarget.hasValue=!1,this.endTarget.elements.forEach(e=>{e.visible()}),this.endTarget.x=this.endTarget.y=-1,this.endTarget.hasValue=!1,this.endTarget.elements=[]}filterCreepageItems(e){if(Hh.measureMode=="CreepageDistance"){let r=new Set;for(let i of e)i instanceof ds&&mp(i.layerId)&&r.add(i);return r}else return e}getFilteredPcbItemByClickedPoint(e){let r={target:[]};if(Hh.measureMode=="MeasureDistance")return r;let i=Hh.measureMode=="CreepageDistance"?dd:dm,n=$t.measureFilter(e.realSceneX,e.realSceneY,this.filterCreepageItems(Wr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).getResult(i)));if(n.length===1&&n[0]instanceof Le){let s=this.findOtherPadsByPadsPairs(n[0]);n=[].concat(n,s)}return r.target=n,r}initSketcherAttrPanel(){let e=this.getSelctedItems(),r=[];for(let a=0;a<e.length;a++){let l=e[a];l instanceof _n||l instanceof Zx||l instanceof va||l instanceof Xy||l instanceof Ye&&l.type==="Copper Region"||r.push(l)}let i=[],n=[],s=-1;for(let a=0;a<r.length;a++)if(!(i.indexOf(r[a])>=0)){if(r[a]instanceof Ue){s++,n[s]||(n[s]=[]);let l=$t.filterTrack(r[a],"whole");for(let c=0;c<l.length;c++)r.indexOf(l[c])>=0&&(n[s].push(l[c]),i.push(l[c]));continue}s++,n[s]||(n[s]=[]),n[s].push(r[a])}if(n.length===2){if(this.startTarget.elements=n[0],this.startTarget.elements.length===1&&this.startTarget.elements[0]instanceof Le){let a=this.findOtherPadsByPadsPairs(this.startTarget.elements[0]);this.startTarget.elements=[].concat(this.startTarget.elements,a)}if(this.startTarget.hasValue=!0,this.endTarget.elements=n[1],this.endTarget.elements.length===1&&this.endTarget.elements[0]instanceof Le){let a=this.findOtherPadsByPadsPairs(this.endTarget.elements[0]);this.endTarget.elements=[].concat(this.endTarget.elements,a)}this.endTarget.hasValue=!0,Hh.measureMode="MeasureObjectDistance",Uu.getInstance().createMeasureResulBySelectTarget(this.startTarget,this.endTarget),Uu.getInstance().hasSettingResult=!0;return}ie.publish("FlushSketcherAttrView",{type:"DIST_MEASURE",isInitAllParams:!0})}hightlightHoverItems(){this.hoverItems.forEach(e=>{e.click()})}cancelHightlightHoverItems(){this.hoverItems.forEach(e=>{this.startTarget.elements.indexOf(e)<=-1&&this.endTarget.elements.indexOf(e)<=-1&&(e.visible(),this.hoverItems.delete(e))}),this.hoverItems.clear()}findOtherPadsByPadsPairs(e){let r=[],i=[],n=te.getInstance().getAllPadsPairGroupsInstances();e:for(let s=0;s<n.length;s++){let a=n[s].toJSON_ofDeatails();for(let l=0;l<a.length;l++){let c=Object.values(a[l]).map(u=>u.id),h=c.indexOf(e.globalIndex);if(h>=0){c.splice(h,1),i=Array.from(c);break e}}}for(let s=0;s<i.length;s++){let a=Kt.getItem(i[s]);a&&r.push(a)}return r}};var RP=class o extends ko{constructor(){super();this.editedColor=ee.of3("#FF9700");this.selectedColor=ee.of3("3673FE");this.items=[];this.hoverItems=new Set;this.counterBoresMap=new Map;this.counterBoresLabelMap=new Map}static getInstance(){return o._instance||(o._instance=new o),o._instance}initEditedItems(e){for(let r of e){let{position:i}=r,{x:n,y:s}=this.convertToMil(i),a=this.getItemByPosition(n,s);a.color=this.editedColor,this.counterBoresMap.set(a.globalIndex,r),this.renderCounterBoreLabel(a,r)}}onMouseLeftDown(e){this.clearItems();let r=e.realSceneX,i=e.realSceneY,n=this.getItemByPosition(r,i),s=be.getActiveLayerID();if(n){this.items.push(n),n.color=this.selectedColor;let a=Fo(n.center),l={position:{x:Xe(n.center.x,null,"mm"),y:Xe(n.center.y,null,"mm")},smallHoleSize:Xe(n.radius*2,null,"mm"),layerId:s,isPTH:n instanceof Ge,screenPosition:{x:a.x,y:a.y}};if(this.counterBoresMap.has(n.globalIndex)){let c=this.counterBoresMap.get(n.globalIndex);Object.assign(l,c)}A.messageBus.publish("transCounterBore",l)}}onMouseMove(e){let r=e.realSceneX,i=e.realSceneY,n=this.getItemByPosition(r,i);if(n)this.hoverItems.add(n),n.color=this.selectedColor;else{for(let s of this.hoverItems)this.items.find(a=>a.globalIndex==s.globalIndex)?s.color=this.selectedColor:this.counterBoresMap.has(s.globalIndex)?s.color=this.editedColor:s.color=null;this.hoverItems=new Set}}updateSelectedCounterBore(e){if(!e)return!1;let{position:r}=e;if(!r)return!1;let{x:i,y:n}=this.convertToMil(r),s=this.getItemByPosition(i,n);if(!s)return!1;if(e.holeLabel&&this.renderCounterBoreLabel(s,e),this.counterBoresMap.has(s.globalIndex)){let a=this.counterBoresMap.get(s.globalIndex);Object.assign(a,e)}else this.counterBoresMap.set(s.globalIndex,e);return!0}renderCounterBoreLabel(e,r){this.getLabel(e.globalIndex)||this.renderSvg(e,r.holeLabel.toString()),this.updateSvg(e)}getLabel(e){return this.counterBoresLabelMap.get(e)}renderSvg(e,r){let i=this.createSVG(e,r),n=i.children[0];return document.querySelector("#canvas-2d").parentNode.appendChild(i),this.counterBoresLabelMap.set(e.globalIndex,n),n}createSVG(e,r){let i=`<svg t="1726762356052" style="position:absolute;top:0;left:0;pointer-events: none" class="holeLabel-${e.globalIndex}" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1341"
    width="80" height="80">
    <path
        d="M918.884 408.584c0-210.684-170.788-381.028-381.476-381.028-210.676 0-381.476 171.944-381.476 382.628 0 113.168 49.296 213.82 127.564 285.82h-1.216s162.356 144.04 228.036 272.836c0 0 11.252 35.628 27.088 35.628 15.828 0 26.836-37.392 26.836-37.392C629.964 838.22 792.2 692 792.2 692h-0.48c78.032-68 127.164-170.436 127.164-283.416z"
        fill="#FFF" p-id="1342"></path>
   <circle cx="535" cy="410" r="300" fill="#1871ff"></circle>
    
    <text x="450" y="480" fill="#fff" font-size="300px">${r}</text>
</svg>`;return document.createRange().createContextualFragment(i)}updateSvg(e){let r=Fo(e.center.add1(0,4)),i=this.counterBoresLabelMap.get(e.globalIndex);i.style.transform=`translate(${r.x-40}px, ${r.y-80}px)`}deleteEditedCounterBore(e){if(!e)return!1;let{position:r}=e;if(!r)return!1;let{x:i,y:n}=this.convertToMil(r),s=this.getItemByPosition(i,n);if(!s)return!1;if(this.counterBoresMap.has(s.globalIndex)){s.color=null,this.counterBoresMap.delete(s.globalIndex);let a=this.getLabel(s.globalIndex);return a&&(a.remove(),this.counterBoresLabelMap.delete(s.globalIndex)),this.items=this.items.filter(l=>l.globalIndex!==s.globalIndex),!0}else return!1}convertToMil(e){let r=Xs.conversion("mm","mil",e.x)/10,i=Xs.conversion("mm","mil",e.y)/10;return{x:r,y:i}}getItemByPosition(e,r){let i=Array.from(Wr.pointSelectBeforeFilter(e,r).getResult(["Circle","Via"]));return i=i.filter(s=>s instanceof Sr&&s.layerId==12||s instanceof Ge),i[0]}clearItems(){if(this.items.length)for(let e of this.items)this.counterBoresMap.has(e.globalIndex)?e.color=this.editedColor:e.color=null;this.items.length=0}onMouseWheel(){for(let[e,r]of this.counterBoresLabelMap.entries())if(r.style.display!=="none"){let i=this.counterBoresMap.get(e).position,{x:n,y:s}=this.convertToMil(i),a=this.getItemByPosition(n,s);this.updateSvg(a)}}};var cDt=Xs.conversion("mm","mil",10)/10,h0=class o extends ci{constructor(){super();this.template=new Array;this.image=null;this.unit="mm";A.subscribe("updateULSize",this.updateULSize.bind(this))}static getInstance(){return o._instance||(o._instance=new o),o._instance}init(e){this.start(),this.clearUL(),this.initialWidth=e.width,this.initialHeight=e.height,this.initialRotation=e.rotation,this.initialCenter=e.center,this.template=F3(e.path)}place(){let e=Qe.translate(-this.initialWidth/2,this.initialHeight/2),r=this.initialCenter.multiply3(e);this.image=Ln.addImage(this.getLayer(),r,this.initialWidth,this.initialHeight,rt.defaultImage.rotation,!1,!1,this.template),this.initialRotation&&(this.image.rotation=this.initialRotation),this.image.center=this.initialCenter}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY),i=new ve("insert ULLogo");this.image!=null&&(this.image.start=r,A.publish("onlySelect",[this.image]),i.addCommand(Te.dispatch(this.image,"add")),je.executeCommand(i),A.publish("hasModifyPcbItem",this.image),this.drawing=!1),A.messageBus.publish("updateCode",this.getCurrentULInfo()),A.publish("flushService",""),A.publish("tool","dropdrag")}onMouseMove(e){if(this.drawing){let r=new S(e.sceneX,e.sceneY);this.image!=null?(this.image.layerId!=this.getLayer()&&(this.image.layerId=this.getLayer()),this.image.start=r):this.image=Ln.addImage(this.getLayer(),r,this.initialWidth,this.initialHeight,this.initialRotation,!1,!1,this.template)}}interrupt(){this.image!==null&&(this.image.remove(),A.publish("delete",this.image),this.image=null,A.publish("flushService","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}getLayer(){return be.getActiveLayer().layerID}updateULSize(e){this.image&&(e.width&&(this.image.width=e.width),e.height&&(this.image.height=e.height),(e.width||e.height)&&(A.messageBus.publish("updateCode",this.getCurrentULInfo()),Pr.model=Pr.model,A.publish("tool","dropdrag"),A.publish("updateFrame","")))}getULData(){let e=this.image;if(e){let r=e.layerId,i=e.model.box,n=S$(i,this.unit),s=e.width/cDt,a=n,l={x:Xe(e.center.x,null,this.unit),y:Xe(e.center.y,null,this.unit)},c=uc(xe(-(e.rotation/Math.PI)*180,3)),h=Xe(e.width,null,this.unit),u=Xe(e.height,null,this.unit);return{layerId:r,ratio:s,bbox:a,rotation:c,center:l,width:h,height:u}}else return null}getCurrentULInfo(){if(this.image){let{layerId:r,rotation:i,center:n,width:s,height:a}=this.getULData(),l=2,c,h=this.checkULPosValid();return h&&(c=h),{layerId:r,dataType:l,rotation:i,center:n,width:s,height:a,posCheckedInfo:c}}else return null}checkULPosValid(){if(!JT.isChecked){console.warn("\u672A\u5F00\u542F\u4F4D\u7F6E\u68C0\u6D4B");return}let e=window["SILKVIEWER-SOURCE"]=="FOREIGN-TRADE",r=JT.outlineInfoForQRCode;if(!r)return console.log("\u5F00\u542F\u68C0\u6D4B\uFF0C\u4F46\u662F\u5E76\u6CA1\u6709\u83B7\u53D6\u5230\u76F8\u5173\u677F\u6846\u6570\u636E\uFF0C\u65E0\u6CD5\u8FDB\u884C\u68C0\u6D4B"),{posValid:!1,reason:this.getReason("\u5F00\u542F\u68C0\u6D4B\uFF0C\u4F46\u662F\u5E76\u6CA1\u6709\u83B7\u53D6\u5230\u76F8\u5173\u677F\u6846\u6570\u636E\uFF0C\u65E0\u6CD5\u8FDB\u884C\u68C0\u6D4B",e)};let i=this.image,n;if(i)n=i.getMathGraphics(i.layerId,0).bbox();else return console.log("\u672A\u68C0\u6D4BUL\u6807\u8BC6\u653E\u7F6E\u7684\u60C5\u51B5"),{posValid:!1,reason:this.getReason("\u672A\u68C0\u6D4B\u5230UL\u6807\u8BC6\u653E\u7F6E\u7684\u60C5\u51B5",e)};let s=r.bbox().area(),a=Math.abs(r.area(.1));if(s===a){if(!r.bbox().isContainsBBox(n))return console.log("\u68C0\u6D4B\u5230UL\u6807\u8BC6\u4E0D\u5728\u677F\u6846\u5185"),{posValid:!1,reason:this.getReason("\u68C0\u6D4B\u5230UL\u6807\u8BC6\u4E0D\u5728\u677F\u6846\u5185",e)}}else{let u=HP([Gl.INTERSECT,r,fe.build6(n)]).bbox().area();if(u!==n.area()||ne.eq(u,a))return console.log("\u68C0\u6D4B\u5230UL\u6807\u8BC6\u4E0D\u5728\u677F\u6846\u5185"),{posValid:!1,reason:this.getReason("\u68C0\u6D4B\u5230UL\u6807\u8BC6\u4E0D\u5728\u677F\u6846\u5185",e)}}let l=G2(i.layerId)?[3,5,12]:[4,6,12],c=Vt.searchByLayers(n,l).getAllItems().filter(h=>h===this.image?!1:h instanceof Sr&&h.layerId===12?JT.coverOil:!!h.getParent());if(c.length>=1){let h=fe.buildBBox(n).primitives,u=this;for(let d of c){let p=function(){return console.log("UL\u6807\u8BC6\u68C0\u6D4B\u4F4D\u7F6E\u4E0D\u901A\u8FC7, \u4E0E\u5176\u5B83\u56FE\u5143\u5B58\u5728\u91CD\u53E0",d),{posValid:!1,reason:u.getReason("UL\u6807\u8BC6\u68C0\u6D4B\u4F4D\u7F6E\u4E0D\u901A\u8FC7, \u4E0E\u5176\u5B83\u56FE\u5143\u5B58\u5728\u91CD\u53E0",e)}};if(d instanceof mt||d instanceof vt){let m=d.width/2,g=d.primitive;if(n.extendOfSize(m).isContainsBBox(g.bbox()))return p();for(let y of h)if(ir.getMinDistance(y,g)<=m)return p()}else return p()}}return console.log("UL\u6807\u8BC6\u4F4D\u7F6E\u68C0\u6D4B\u901A\u8FC7"),{posValid:!0,reason:this.getReason("UL\u6807\u8BC6\u4F4D\u7F6E\u68C0\u6D4B\u901A\u8FC7",e)}}clearUL(){this.image&&(this.image.remove(),A.publish("delete",this.image),this.image=null)}getReason(e,r){let i=e;return r&&(i=this.commonToFT(e)),i}commonToFT(e){switch(e){case"\u68C0\u6D4B\u5230UL\u6807\u8BC6\u4E0D\u5728\u677F\u6846\u5185":return"i18n_shared_ul_mark_outline_tip";case"UL\u6807\u8BC6\u68C0\u6D4B\u4F4D\u7F6E\u4E0D\u901A\u8FC7, \u4E0E\u5176\u5B83\u56FE\u5143\u5B58\u5728\u91CD\u53E0":return"i18n_shared_ul_mark_overlap_tip";default:return""}}};var Lp=class Lp{static destroy(){var t,e;Lp.id==="adsorption"&&uDt(),Lp.editingWhat="",Lp.data=null,Lp.lockX=0,Lp.lockY=0,Lp.isWidthRulerLocked=!1,Lp.isHeightRulerLocked=!1,Lp.startPoint=null,Lp.cursorPoint=null,Lp.priority=0,Lp.lineLockedLength=null,Lp.lineLockedAngle=null,(t=Lp.auxiliaryLine1)==null||t.remove(),(e=Lp.auxiliaryLine2)==null||e.remove(),A.publish("showFloatingInputBox",{show:!1},$())}static create(t,e="",r=!1){Lo.getInstance().canDrawing&&(Lp.data=t,r||(Lp.id=e),Lp.id==="adsorption"?hDt(1e3)&&A.publish("showFloatingInputBox",t,$()):A.publish("showFloatingInputBox",t,$()))}static updateUnit(t){if(!Lp.data)return;let e=new ft;(Lp.data.data||[]).forEach(r=>{r.info.value=e.conversion(r.info.unit,t,r.info.value),r.info.unit=t}),A.publish("showFloatingInputBox",Lp.data,$())}};Lp.editingWhat="",Lp.priority=0,Lp.id="";var dt=Lp;var oAe=!1,sAe=null;function hDt(o){if(oAe){if(Date.now()-sAe>=o)return!0}else return oAe=!0,sAe=Date.now(),!1;return!1}function uDt(){oAe=!1,sAe=null}var q_=class extends so{constructor(){super(...arguments);this.partitionNeedAskBeforeDelete=!0;this.othersCommand=new ve("Create partition!!!")}getItem(){return"ignore"}rebuild(){}remove(){}modify(){}updateData(){}addOthersCommand(e){this.othersCommand.addCommand(e)}undo(){this.partitionNeedAskBeforeDelete&&this.othersCommand.undo(),this.partitionNeedAskBeforeDelete=!1}redo(){this.othersCommand.redo()}hasFileUUID(){for(let e of this.othersCommand.commands)if(e instanceof Wg){let r=e.getItem();if(r!=null&&r instanceof Ye&&r.type=="Partition"){let i=r.getComponent();if(i instanceof Dc&&i.fileUuid!="")return!0}}return!1}upload(e){this.othersCommand!=null&&this.othersCommand.upload(e)}};var Tw=class o{static getInstance(){return o.instance||(o.instance=new o),o.instance}constructor(){}placeSuccess(t,e){let r;if(t==="Rect"&&(r=Xt.getItem(e)),t==="Circle"&&(r=Zt.getItem(e)),!r)return;r.notShowFill=!1,Dn.getInstance().addItem(r);let i=new ve("create partition"),n=new q_;uhe(e,n.othersCommand)?(r.refreshRender(),i.addCommand(Te.dispatch(r,"add")),i.addCommand(n),je.executeCommand(i),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),A.publish("updateRtree","")):Dn.getInstance().deleteItemById(r.globalIndex)}createRectPartitionByArea(t,e){let{minX:r,maxX:i,minY:n,maxY:s}=t;return Xt.addRect("Partition",1004,new S(r,s),i-r,s-n,"",!1,.01,void 0,void 0,void 0,e)}createCirclePartitionByArea(t,e){let{center:r,width:i}=t;return Zt.addCircle("Partition",1004,r,.01,i,!1,"")}interrupt(t,e){this.deleteItem(t,e),A.publish("updateFrame","")}deleteItem(t,e){if(!e)return;let r;t==="Rect"&&(r=Xt.getItem(e)),t==="Circle"&&(r=Zt.getItem(e)),r&&(r.remove(),Dn.getInstance().deleteItemById(r.globalIndex))}};var v9=class o{static getInstance(){return o.instance||(o.instance=new o),o.instance}constructor(){}placeSuccess(t,e){let r,i;if(t===1&&(r=Xt.getItem(e),i="draw Rect"),t===0&&(r=Zt.getItem(e),i="draw Circle"),t===2&&(r=pt.getItem(e),i="draw Polygon",this.isSelfIntersectionCheck(r)),!r)return;let n=this.getType(),s=Ve.getSelects(),a=this.getIntersectionSelectItems(r,s);if(a.some(h=>h.locked)&&A.publish("ui/toastMsg",{type:"error",msg:"Locked objects found, please try again after unlock"},$()),a=a.filter(h=>!h.locked),!a.length){r.remove(),A.publish("delete",r);return}let l=new Array,c=new Map;if(n=="Copper Region"||n==0){let h=new mi;h.createGroup(i);let u=r.getComponent();if(u.device=!1,u.track=!1,u.fill=!1,n=="Copper Region"?u.copper=!0:u.copper=!1,n==0?u.planzone=!0:u.planzone=!1,r.isEmpty||l.push(r),this.addMultiLayerProhibitArea(a,r,h,t,n),h.execute(),n=="Copper Region"){let d=a.filter(p=>p instanceof Ye&&p.type=="Copper Region");A.publish("rebuildConnectCopper",d.map(p=>p.globalIndex))}else{let d=a.filter(p=>p instanceof Ki);A.publish("rebuildSinglePlane",d.map(p=>p.layerId))}}else if(n=="Fill Region"||n=="FPC Stiffener")this.boolSubtraction(r,a,c),c.size&&this.tipForGroup(c),r.remove(),A.publish("delete",r);else if(n==1){let h=new mi;h.createGroup(i);let u=h.getCommand(),d=new Set;Re.addAllSet(d,s);for(let p of a)this.splitTrack(p,r,u,c,d);d.size&&A.publish("onlySelect",Array.from(d)),c.size&&this.tipForGroup(c),h.execute(),r.remove(),A.publish("delete",r)}else r.remove(),A.publish("delete",r)}addMultiLayerProhibitArea(t,e,r,i,n){let s=r.getCommand(),a=new Set,l=-1;for(let c of t){l++;let h=c.layerId;if(l==0)e.layerId=h,gn.addOrder(e,r.getCommand()),r.addCommand4Item(e,"add"),this.splitCutout(e,s);else{if(a.has(h)||n=="Copper Region"&&!(c instanceof Ye&&c.type=="Copper Region")||n==0&&!(c instanceof Ki))continue;let u;switch(i){case 1:u=Xt.addRect("Prohibited Region",h,e.start,e.width,e.height,"",!1,e.strokeWidth);break;case 0:u=Zt.addCircle("Prohibited Region",h,e.center,e.radius,e.strokeWidth,!1,"");break;case 2:let d=e.model.clone();d.layerId=h;let p=new Array;for(let m of d.childrens){let g=new Array;for(let y of m)y instanceof ys&&g.push($u.addByModel(y,!0)),y instanceof nl&&g.push(qc.addArcByModel(y,!0));p.push(g)}u=pt.addPolygonByModel(d,p,!0);break}gn.addOrder(u,r.getCommand()),r.addCommand4Item(u,"add"),this.splitCutout(u,s)}a.add(h)}}isSelfIntersectionCheck(t,e=!0){let r=No(t.getMathGraphics());return e&&r&&A.publish("ui/toastMsg",{type:"info",msg:"There is a self-intersection and will be split automatically"},$()),r}splitCutout(t,e){if(t instanceof ct){let r=t?[t]:[],i=!1;i=this.isSelfIntersectionCheck(t,!1),i&&(r=Vm(t,e)),r.length&&r.forEach(n=>{n.fill()})}}getIntersectionSelectItems(t,e){let r=new Set;return e.forEach(i=>{t.buildBBox().isIntersect(i.buildBBox())&&r.add(i)}),Array.from(r)}boolSubtraction(t,e,r){let i=[],n=new ve("Execute Boolean Operation"),s=new Kc,a=t.getMathGraphics(),l=[a];a instanceof Gt&&(l=a.items);let c=m_(e);for(let h of e){let u=h.getMathGraphics(),d=[u];u instanceof Gt&&(d=u.items);let p=this.checkItemIsInner(d,a),m=h.getGroupID();if(p){m&&r.set(`${ur}${h.number}`,m),n.addCommand(Te.dispatch(h,"delete")),h.remove(),A.publish("delete",h);continue}let g=s.getSubtraction(d,l),y=new au;g.forEach(b=>{let P=y.create4PlGrp(h.type,h.layerId,b,h.strokeWidth,h.net,!1);if(m&&(kt.joinCombination([P],m),P.setGroupID(m)),h.type=="FPC Stiffener"||h.type=="Fill Region"&&c){let I=JSON.stringify(h.getComponent());new Nl(I,P.type).rebuildComponent(P)}let T=Te.dispatch(P,"add");n.addCommand(T),i.push(P),P.click()}),n.addCommand(Te.dispatch(h,"delete")),A.publish("hasModifyPcbItem",h),h.remove(),A.publish("delete",h)}A.publish("autoFill",""),A.publish("updateRtree",""),n.length>0&&(je.executeCommand(n),A.publish("onlySelect",i))}splitTrack(t,e,r,i,n){let s=e.getMathGraphics(),a=t.primitive,l=this.checkTrackIsInner(a,s),c=t.getGroupID();if(l){c&&i.set(`${ur}${t.number}`,c),r.addCommand(Te.dispatch(t,"delete")),t.remove(),A.publish("delete",t),n.delete(t);return}let h=[];for(let p of s.primitives){let m=Tt(a,p);for(let g=0;g<m;g+=2){let y=new S(Ee[g],Ee[g+1]);h.push(y)}}if(!h.length)return;h=dn(h,a);let u=[].concat([a.start()],h,[a.end()]),d=new Array;for(let p=1;p<u.length;p++){let m=u[p-1],g=u[p];if(m.distance2(g)<1e-8)continue;let y;if(a instanceof M){let b=new M(m,g);if(this.checkTrackIsInner(b,s))continue;y=pr.addTrack(t.layerId,m,g,t.width,t.locked,t.net)}else{let b=m.angle(a.center),P=g.angle(a.center),T=q.build2(t.center,b,P,t.radius,t.radius,a.sweep());if(this.checkTrackIsInner(T,s))continue;y=pr.addArcTrack(t.layerId,t.center,t.radius,b,P,a.sweep(),t.width,t.locked,t.net,t.arcType)}c&&y.setGroupID(c),d.push(y),r.addCommand(Te.dispatch(y,"add"))}Re.addAllSet(n,d),n.delete(t),r.addCommand(Te.dispatch(t,"delete")),t.remove(),A.publish("delete",t)}tipForGroup(t){let e=[],r=[];for(let[i,n]of t.entries()){e.push({attr:{id:i,pcbid:x.getInstance().tabId},text:i});let s=kt.getItem(n).name;r.push({attr:{id:n,pcbid:x.getInstance().tabId},text:`${s} (${n})`})}A.publish("ui/toastMsg",{type:"error",msg:"Object has been deleted, exited group",bottomBarMsg:{type:"warn",msg:['<span class="i18n">Object</span>',...e,'<span class="i18n">has been deleted, exited group </span>',...r]}},$())}checkItemIsInner(t,e){let r=!0,i=[];for(let n of t){let s=n.primitives.flatMap(a=>a.points(1));Re.addAll(i,s)}return e instanceof Gt?r=i.some(n=>!Jr.inPolygon(n,e.items)):r=i.some(n=>!Jr.inPolyline(n,e)),!r}checkTrackIsInner(t,e){let r=!1,i=[t.start(),t.midPoint,t.end()];return e instanceof Gt?r=i.every(n=>Jr.inPolygon(n,e.items)):r=i.every(n=>Jr.inPolyline(n,e)),r}handleCutout(t,e,r,i){let n="Cutout",s=this.getType();(s=="Copper Region"||s==0)&&(n="Prohibited Region");let a;switch(t){case 1:a=Xt.addRect(n,r,e,1,1,"",!1,i);break;case 0:a=Zt.addCircle(n,r,e,.1,i,!1,"");break;case 2:a=pt.addPolygon(n,r,e,i,"",!1);break}return a}getType(){let t,r=Ve.getSelects()[0];return(r instanceof mt||r instanceof vt)&&(r=r.getParent()),r instanceof Ye&&(t=r.type),r instanceof Ki&&(t=0),r instanceof Ue&&(t=1),t}};var nU=class nU extends ci{constructor(e){super();this._pcbCircle=null;this._width=1;this.drawMode=0;this.dialogHandler=null;this.subline=null;this.lockProcess=!1;this.timer=null;this.option="OPTIONLEFTUP",we.drawing=!0,this.type=e,e=="Line"?x.getInstance().doctype==bi.FOOTPRINT?this._width=we.prevTrackWidth||rt.defaultOutlineWidth:this._width=al.getInstance().getTrackWidth().value||rt.defaultOutlineWidth:e=="Board Outline"||e=="3D Shell - Outline"?this._width=rt.defaultOutlineWidth:this._width=.02,e=="3D Shell - Outline"&&(this._width=qu(-1,e)),e=="Partition"&&(this._width=.01,this.partitionTool=Tw.getInstance()),e=="Cutout"&&(this.cutoutTool=v9.getInstance()),jr.addDrawTool(this),sl.addTool(this),Ua.changeTool(this),Wh.setTool(this),nU._readyType=e}static get readyType(){return this._readyType}set pcbCircle(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._pcbCircle=e}get pcbCircle(){return this._pcbCircle}onKeyDown(e){if(this.lockProcess)return;let r;switch((this.type==="Line"||this.type==="Board Outline")&&(r=sr.getLocalAction(["decrease_routing_width","increase_routing_width"],e)),r||(r=sr.getAction(4,e)),r){case"Cancel":this.cancel();break;case"Switch Common Track Width":this.type==="Line"&&this.showCommonTrackWidthMenu(e);break;case"decrease_routing_width":{let n=this._width-.2;n>=.1&&(this.setWireWidth(n),Hi())}break;case"increase_routing_width":{let n=this._width+.2;this.setWireWidth(n),Hi()}break;case"Change Track Width While Routing":{this.canChangeWhileRouting(this.type)&&A.publish("openMainDialog",{cmd:26,data:{tool:this}});break}case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}setDialogHandler(e){this.dialogHandler=e}onMouseLeftUp(e){if(this.lockProcess)return;if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},$());return}let r=new S(e.sceneX,e.sceneY);if(this.drawMode==0)if(this.pcbCircle==null){if(!Bt.checkIsCanEditByPoint(new S(e.sceneX,e.sceneY)))return;this.start(),this.startDraw(r)}else{if(!Bt.checkIsCanEditByPoint(new S(e.sceneX,e.sceneY))){let i="Cannot be added beyond drawing range";Bt.showMassageTip(i,i);return}dt.editingWhat?dt.editingWhat="":(this.confirmWindow(),dt.destroy(),this.subline.remove(),this.subline=null)}else this.netSelect(e)}onMouseRightUp(e){this.lockProcess||super.onMouseRightUp(e)}startDraw(e){this.type=="Partition"?this.pcbCircle=Tw.getInstance().createCirclePartitionByArea({center:e,width:this._width}):this.type=="Cutout"?this.pcbCircle=v9.getInstance().handleCutout(0,e,this.getLayerIdByCanvasDocType(),this._width):this.pcbCircle=Zt.addCircle(this.type,this.getLayerIdByCanvasDocType(),e,.1,this._width,!1,""),this.drawing=!0,this.subline=new hr(1002,e,e,!0,ee.WHITE)}onMouseMove(e){if(!this.lockProcess){if(this.drawMode==0&&this.pcbCircle!==null&&this.drawing){let r=new S(e.sceneX,e.sceneY),i=r.sub(this.pcbCircle.center);this.pcbCircle.radius=Math.max(i.length(),.1),this.pcbCircle.notShowFill=!0,dt.startPoint=this.pcbCircle.center,dt.cursorPoint=r,this.subline&&(this.subline.end=r);let n=Gf(),s=dt.startPoint,a=dt.cursorPoint,l=Fo(dt.cursorPoint),c=Fo(dt.startPoint),h={data:[{startPoint:s,cursorPoint:a,frameStartPoint:c,frameCursorPoint:l,info:{type:"circle",tagName:"radius",value:Xe(this.pcbCircle.radius),unit:x.getInstance().unit,onlyPositive:!0}}],show:!0,type:"circle",frameInfo:n},u=9;u>=dt.priority&&(dt.priority=u,dt.create(h))}this.drawMode==1?jt.update(e,"Please select a network"):jt.cancel()}}applyInputAtCursorValue(e){let{editing:r}=e;if(r){dt.editingWhat="circle";return}this.applyValue(e)}applyValue(e){console.log(e);let{value:r,keyCode:i,cursorPoint:n,startPoint:s,type:a}=e;if(r===void 0)return;r=new ft().conversion(x.getInstance().unit,"mil",r/10);let c;if(a==="free"){let h=new S(n.x-s.x,n.y-s.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+s.x,h.y+s.y);if(this.pcbCircle==null){this.startDraw(u),dt.destroy();return}else c=this.pcbCircle.center.distance1(u)}else c=r;this.pcbCircle.radius=c,A.publish("flushService",""),(i===108||i===13)&&(this.confirmWindow(),this.subline.remove(),this.subline=null,dt.destroy())}restore(){var e;dt.destroy(),this.pcbCircle.remove(),this.dialogHandler!=null&&this.dialogHandler.closeOpenDialog(),A.publish("delete",this.pcbCircle),this.drawMode=0,this.pcbCircle=null,this.drawing=!0,(e=this.subline)==null||e.remove(),this.subline=null,A.publish("updateRtree","")}interrupt(){var e;this.pcbCircle!==null&&(dt.destroy(),this.pcbCircle.remove(),this.dialogHandler!=null&&this.dialogHandler.closeOpenDialog(),A.publish("delete",this.pcbCircle),this.drawMode=0,this.pcbCircle=null,(e=this.subline)==null||e.remove(),this.subline=null,A.publish("updateRtree","")),jr.clearDrawTool(),nU._readyType=null,this.end()}cancel(){if(!this.timer)if(this.drawMode==0){let e=!!this.pcbCircle;this.interrupt(),e||(A.publish("tool","dropdrag"),nU._readyType=null)}else this.drawMode=0,this.confirmWindow()}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=lg(this._width).result,Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",$());break;case"INHERIT_NET":this.handleChangeCircleNet(i[1]);break}A.publish("updateFrame","")}toggleWidth(e){let r=ce.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit()),Hi()}getWidth(){return this._width}setWireWidth(e){this.pcbCircle!=null&&(this.pcbCircle.strokeWidth=e),this._width=e,we.prevTrackWidth=e,A.publish("flushSelectingInfo","")}confirmWindow(){if(this.timer=setTimeout(()=>{this.timer=null},500),this.pcbCircle!=null){if(this.pcbCircle.type!=="Partition"&&!Bt.checkIsInCanEdit(this.pcbCircle)){let e="Cannot be added beyond drawing range";Bt.showMassageTip(e,e),this.interrupt();return}this.type=="Copper Region"||this.type=="Prohibited Region"||this.type=="Constraint Region"||this.type=="Fill Region"?(this.drawing=!1,A.publish("openMainDialog",{cmd:17,data:{shape:this.pcbCircle,tool:this}})):(nb(this.pcbCircle),this.modify(!0))}}placeSuccess(){if(this.pcbCircle.partition=x.getInstance().partitionId,(this.pcbCircle.type=="Line"||this.pcbCircle.type=="Board Outline")&&(this._width=this.pcbCircle.strokeWidth,rt.defaultOutlineWidth=this.pcbCircle.strokeWidth),this.pcbCircle.type=="Partition"){this.pcbCircle.fill(),this.partitionTool.placeSuccess("Circle",this.pcbCircle.globalIndex),this.pcbCircle=null,this.drawing=!0,A.publish("updateFrame",""),this.end();return}if(this.type=="Cutout"){this.pcbCircle.fill(),this.cutoutTool.placeSuccess(0,this.pcbCircle.globalIndex),this.pcbCircle=null,this.drawing=!0,A.publish("updateFrame",""),this.end();return}let e=new mi;e.createGroup("draw 2DLine Circle"+this.type),gn.addOrder(this.pcbCircle,e.getCommand()),e.addCommand4Item(this.pcbCircle,"add"),e.checkOutlines([this.pcbCircle],new Set),this.pcbCircle.type=="Copper Region"&&A.publish("rebuildConnectCopper",[this.pcbCircle.globalIndex]),!vE(this.pcbCircle.layerId)&&this.type!=="3D Shell - Side Slot Region"&&A.publish("onlySelect",[this.pcbCircle]),A.publish("hasModifyPcbItem",this.pcbCircle),this.pcbCircle.fill(),this.pcbCircle=null,this.drawing=!0,A.publish("flushService",""),this.end()}modify(e){if(e&&this.pcbCircle!=null)if(ah.realtimeCheckItems([this.pcbCircle]))this.placeSuccess();else{this.lockProcess=!0;let r=()=>{this.placeSuccess(),this.lockProcess=!1},i=()=>{this.lockProcess=!1},n=new _0("Violation of DRC rules, whether to ignore?",r,i);A.publish("openMsgbox",n),this.drawing=!0,this.drawMode=0}else this.pcbCircle!=null&&(this.pcbCircle.remove(),A.publish("delete",this.pcbCircle)),A.publish("updateRtree",""),this.pcbCircle=null,this.drawing=!0,this.end()}toggleMode(e,r){this.drawMode=e,this.drawing=!0;let{pcbBridgingCopperIndex:i}=r;i&&(this.pcbBridgingCopperIndex=i)}toggleLayer(e){if(this.type==="Fill Region"){let r=be.getLastActiveLayerID(),i=be.getAllPinLayerIds();if(i.includes(e)!==i.includes(r))return be.setActiveLayerId(r)}this.pcbCircle!=null&&this.pcbCircle.layerId!=e&&(this.pcbCircle.layerId=e)}netSelect(e){let r=e.sceneX,i=e.sceneY;if(this.pcbCircle!=null&&this.drawMode==1){let n=Wr.selectNet(r,i);if(n!==null){let s=this.getNearNetPcbItems(n,r,i);this.handleNets(e,s)}}}handleChangeCircleNet(e){this.pcbCircle.net=e,DD(this.pcbCircle,e,this.pcbBridgingCopperIndex),this.drawMode=0,this.confirmWindow()}getNearNetPcbItems(e,r,i){let n=new Set,s=new Set,a=new Set;return e.forEach(l=>{if(l instanceof Ye&&l.type=="Fill Region"){let h=l.getComponent();if(h instanceof ln&&h.isBridgingCopper)return}let c=l.net;if(l instanceof Ye&&l.type=="Copper Region"){let h=!1;if(l.iteratorCopper(u=>{h||u.inCopper(r,i)&&u.isVisible&&(h=!0)}),!h)return}c&&(a.add(l),s.add(c))}),n.add({group:a,nets:s}),n}handleNets(e,r){let i=new Set;r.forEach(n=>{i=n.nets}),i.size&&(i.size===1?i.forEach(n=>{this.handleChangeCircleNet(n)}):(jt.cancel(),this.showNetsMenu(e,i)))}showNetsMenu(e,r){let i={};i.state="show",i.left=e.mouseX,i.top=e.mouseY,i.filter=this.getNetsMenuData(r).result,Qt.getInstance().menuData(i,this),this.drawing=!1}getNetsMenuData(e){let r=new Jt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}getLayerIdByCanvasDocType(){let e=be.getActiveLayerID();return x.getInstance().doctype!==bi.FOOTPRINT&&Cx(e)&&(e=1),e}wireCorner(e){}wireMode(e){}};nU._readyType=null;var Sh=nU;var oU=class oU extends ci{constructor(e){super();this._start=null;this._rect=null;this._width=1;this.drawMode=0;this.dialogHandler=null;this.blockRight=!1;this.lockProcess=!1;this.option="OPTIONLEFTUP",we.drawing=!0,this.type=e,e=="Line"?x.getInstance().doctype==4?this._width=we.prevTrackWidth||rt.defaultOutlineWidth:this._width=al.getInstance().getTrackWidth().value||rt.defaultOutlineWidth:e=="Board Outline"||e=="3D Shell - Outline"?this._width=rt.defaultOutlineWidth:this._width=.02,e=="3D Shell - Outline"&&(this._width=qu(-1,e)),e=="Annotation"&&(this._width=1,this.annotationUtils=Lo.getInstance()),e=="Partition"&&(this._width=.01,this.partitionTool=Tw.getInstance()),e=="Cutout"&&(this.cutoutTool=v9.getInstance()),jr.addDrawTool(this),sl.addTool(this),Ua.changeTool(this),Wh.setTool(this),oU._readyType=e}static get readyType(){return this._readyType}set rect(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._rect=e}get rect(){return this._rect}setDialogHandler(e){this.dialogHandler=e}onKeyDown(e){if(this.lockProcess)return;let r;switch((this.type==="Line"||this.type==="Board Outline")&&(r=sr.getLocalAction(["decrease_routing_width","increase_routing_width"],e)),r||(r=sr.getAction(4,e)),r){case"Cancel":this.cancel();break;case"Switch Common Track Width":this.type==="Line"&&this.showCommonTrackWidthMenu(e);break;case"decrease_routing_width":{let n=this._width-.2;n>=.1&&(this.setWireWidth(n),Hi())}break;case"increase_routing_width":{let n=this._width+.2;this.setWireWidth(n),Hi()}break;case"Change Track Width While Routing":{this.canChangeWhileRouting(this.type)&&A.publish("openMainDialog",{cmd:26,data:{tool:this}});break}case"Finish":{this.onEnterPlace(e);break}}A.publish("updateFrame","")}onMouseLeftUp(e){if(this.lockProcess)return;let r=new S(e.sceneX,e.sceneY);if(this.drawMode==0)if(this.rect===null){if(this.start(),!Bt.checkIsCanEditByPoint(new S(e.sceneX,e.sceneY)))return;this.startDraw(r)}else{if(!Bt.checkIsCanEditByPoint(new S(e.sceneX,e.sceneY))){let i="Cannot be added beyond drawing range";Bt.showMassageTip(i,i);return}dt.editingWhat==="horizontal"||dt.editingWhat==="vertical"?dt.editingWhat="":(ne.eq(this.rect.buildBBox().area(),0)||this.confirmWindow(),this.widthLocked=!1,this.heightLocked=!1,dt.destroy())}else this.netSelect(e)}onMouseRightUp(e){this.lockProcess||super.onMouseRightUp(e)}onMouseMove(e){if(!this.lockProcess){if(this.drawMode==0){let r=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(r)}this.drawMode==1?jt.update(e,"Please select a network"):jt.cancel()}}showFloatingInputBox(e,r=!1){if(this.rect!==null&&this.drawing){let i=e.x,n=e.y;r||(this.widthLocked&&(i=this.cursorPoint.x),this.heightLocked&&(n=this.cursorPoint.y)),this.cursorPoint=new S(i,n);let s=new _e().ext2(this._start).ext2(this.cursorPoint).build1();this.rect instanceof nr?(this.rect.width=s.width(),this.rect.height=s.height()):this.createChamferRect(this._start,s.width(),s.height());let a=this.rect.getMathGraphics().bbox().UL(),l=s.UL().sub(a),c=Ae.translate(l.x,l.y,0);this.rect.transform(c),dt.startPoint=new S(this._start.x,this._start.y),dt.cursorPoint=new S(i,n);let h=Gf(),u=dt.startPoint,d=dt.cursorPoint,p=Fo(dt.cursorPoint),m=Fo(dt.startPoint),g=s.width(),y=s.height();u.x>d.x&&(g=-g),u.y>d.y&&(y=-y);let b={data:[{startPoint:u,cursorPoint:d,frameStartPoint:m,frameCursorPoint:p,info:{type:"horizontal",value:Xe(g),unit:x.getInstance().unit}},{startPoint:u,cursorPoint:d,frameStartPoint:m,frameCursorPoint:p,info:{type:"vertical",value:Xe(y),unit:x.getInstance().unit}}],type:"rect",show:!0,frameInfo:h},P=9;P>=dt.priority&&(dt.priority=P,dt.create(b))}}lockUnlock(e){dt.editingWhat="";let{value:r,type:i,locked:n,unlocked:s}=e,a=new ft;if(i==="vertical")if(n){this.heightLocked=!0;let l=dt.startPoint.y+a.conversion(x.getInstance().unit,"mil",r/10);this.cursorPoint=new S(this.cursorPoint.x,l),this.applyValue(e)}else s&&(this.heightLocked=!1);else if(i==="horizontal")if(n){this.widthLocked=!0;let l=dt.startPoint.x+a.conversion(x.getInstance().unit,"mil",r/10);this.cursorPoint=new S(l,this.cursorPoint.y),this.applyValue(e)}else s&&(this.widthLocked=!1)}startDraw(e){if(this.type=="Annotation")this.rect=Lo.getInstance().createAnnotationByArea({minX:e.x,maxX:e.x+1,minY:e.y-1,maxY:e.y});else if(this.type=="Partition")this.rect=Tw.getInstance().createRectPartitionByArea({minX:e.x,maxX:e.x+1,minY:e.y-1,maxY:e.y});else if(this.type=="Cutout")this.rect=v9.getInstance().handleCutout(1,e,this.getLayerIdByCanvasDocType(),this._width);else if(this.isChamferRect())this.createChamferRect(e,1,1);else{let r=this.canFillet()&&ce.pcbConfig.autoChamfer2DLine=="fillet"?ce.pcbConfig.filletRadius2DLine:0;this.rect=Xt.addRect(this.type,this.getLayerIdByCanvasDocType(),e,1,1,"",!1,this._width,0,r)}this._start=e,this.drawing=!0}createChamferRect(e,r,i){this.rect!=null&&this.rect.remove();let n=Math.min(ce.pcbConfig.filletRadius2DLine,r/2,i/2),s=[e.add1(n,0),e.add1(r-n,0),e.add1(r,-n),e.add1(r,-i+n),e.add1(r-n,-i),e.add1(n,-i),e.add1(0,-i+n),e.add1(0,-n),e.add1(n,0)],a=new au,l=fe.build4(s);this.rect=a.create4Pl(this.type,this.getLayerIdByCanvasDocType(),l,this._width,"",!1)}isChamferRect(){return ce.pcbConfig.autoChamfer2DLine=="chamfer"&&this.canFillet()&&ce.pcbConfig.filletRadius2DLine>0}canFillet(){return ce.pcbConfig.autoChamfer2DLine!="off"&&["Line","Copper Region","Fill Region","Slot Region","Prohibited Region","Constraint Region","Board Outline"].includes(this.type)}applyValue(e){let{value:r,type:i,startPoint:n,cursorPoint:s,keyCode:a}=e;if(r===void 0)return;r=new ft().conversion(x.getInstance().unit,"mil",r/10);let c;if(i==="vertical")c=new S(dt.cursorPoint.x,dt.startPoint.y+r);else if(i==="horizontal")c=new S(dt.startPoint.x+r,dt.cursorPoint.y);else if(i==="free"){let h=new S(s.x-n.x,s.y-n.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+n.x,h.y+n.y);if(this.rect==null){this.startDraw(u),dt.destroy();return}else c=u}console.log(c),this.showFloatingInputBox(c,a===108||a===13),A.publish("updateFrame",""),(a===108||a===13)&&(this.confirmWindow(),this.widthLocked=!1,this.heightLocked=!1,dt.destroy())}applyInputAtCursorValue(e){console.log(e);let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l}=e;if(a){dt.editingWhat=i;return}if(n||s)return this.lockUnlock(e);this.applyValue(e)}restore(){dt.destroy(),this.dialogHandler!=null&&this.dialogHandler.closeOpenDialog(),this.rect.remove(),A.publish("delete",this.rect),this.drawing=!0,this.drawMode=0,this.rect=null,this._start=null,this.widthLocked=!1,this.heightLocked=!1,A.publish("updateRtree","")}interrupt(){var r;let e=(r=this.rect)==null?void 0:r.globalIndex;this.rect!==null&&(dt.destroy(),this.dialogHandler!=null&&this.dialogHandler.closeOpenDialog(),this.rect.remove(),A.publish("delete",this.rect),this.drawMode=0,this.rect=null,this._start=null,this.widthLocked=!1,this.heightLocked=!1,A.publish("updateRtree","")),this.annotationUtils&&this.annotationUtils.interrupt(e),jr.clearDrawTool(),jt.cancel(),oU._readyType=null,this.end()}cancel(){if(this.drawMode==0){if(this.blockRight)return;let e=!!this.rect;this.interrupt(),e||(A.publish("tool","dropdrag"),oU._readyType=null)}else this.drawMode=0,ne.eq(this.rect.buildBBox().area(),0)||this.confirmWindow();jt.cancel()}rightClickMenuData(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=vo(e.adsorb),Qt.getInstance().menuData(r,this),this.drawing=!1}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=lg(this._width).result,Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",$());break;case"INHERIT_NET":this.handleChangeRectNet(i[1]);break}A.publish("updateFrame","")}toggleWidth(e){let r=ce.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit()),Hi()}getWidth(){return this._width}setWireWidth(e){this.rect!=null&&(this.rect.strokeWidth=e),this._width=e,we.prevTrackWidth=e,A.publish("flushSelectingInfo","")}confirmWindow(){if(this.rect!=null){if(this.rect.type!=="Partition"&&!Bt.checkIsInCanEdit(this.rect)){let e="Cannot be added beyond drawing range";Bt.showMassageTip(e,e),this.interrupt();return}this.type=="Copper Region"||this.type=="Prohibited Region"||this.type=="Constraint Region"||this.type=="Fill Region"?(this.drawing=!1,A.publish("openMainDialog",{cmd:17,data:{shape:this.rect,tool:this}}),this.blockRight=!0):(nb(this.rect),this.modify(!0))}}placeSuccess(){if(this.rect.partition=x.getInstance().partitionId,(this.rect.type=="Line"||this.rect.type=="Board Outline")&&(this._width=this.rect.strokeWidth,rt.defaultOutlineWidth=this.rect.strokeWidth),this.type=="Cutout"){this.rect.fill(),this.cutoutTool.placeSuccess(1,this.rect.globalIndex),this.rect=null,this.drawing=!0,this._start=null,this.widthLocked=!1,this.heightLocked=!1,A.publish("updateFrame",""),this.end();return}if(this.rect.type=="Annotation"){this.rect.fill(),this.annotationUtils.waitData(this.rect.globalIndex),this.rect=null,this.drawing=!0,this._start=null,this.widthLocked=!1,this.heightLocked=!1,A.publish("updateFrame",""),this.end();return}if(this.rect.type=="Partition"){this.rect.fill(),this.partitionTool.placeSuccess("Rect",this.rect.globalIndex),this.rect=null,this.drawing=!0,this._start=null,this.widthLocked=!1,this.heightLocked=!1,A.publish("updateFrame",""),this.end();return}!vE(this.rect.layerId)&&this.type!=="3D Shell - Side Slot Region"&&A.publish("onlySelect",[this.rect]);let e=new mi;e.createGroup("draw Rect"),this.rect.type=="Copper Region"&&gn.addOrder(this.rect,e.getCommand()),e.addCommand4Item(this.rect,"add"),e.checkOutlines([this.rect],new Set),this.rect.type=="Copper Region"&&A.publish("rebuildConnectCopper",[this.rect.globalIndex]),this.rect.fill(),this.rect=null,this.drawing=!0,this._start=null,this.widthLocked=!1,this.heightLocked=!1,A.publish("flushService",""),this.end()}modify(e){if(this.blockRight=!1,e&&this.rect!=null)if(ah.realtimeCheckItems([this.rect]))this.placeSuccess();else{this.lockProcess=!0;let r=()=>{this.placeSuccess(),this.lockProcess=!1},i=()=>{this.lockProcess=!1},n=new _0("Violation of DRC rules, whether to ignore?",r,i);A.publish("openMsgbox",n),this.drawing=!0,this.drawMode=0}else this.rect!=null&&(this.rect.remove(),A.publish("delete",this.rect)),A.publish("updateRtree",""),this.rect=null,this.drawing=!0,this._start=null,this.end()}toggleMode(e,r){this.drawMode=e,this.drawing=!0;let{pcbBridgingCopperIndex:i}=r;i&&(this.pcbBridgingCopperIndex=i)}toggleLayer(e){if(this.type==="Fill Region"){let r=be.getLastActiveLayerID(),i=be.getAllPinLayerIds();if(i.includes(e)!==i.includes(r))return be.setActiveLayerId(r)}this.rect!=null&&this.rect.layerId!=e&&(this.rect.layerId=e)}netSelect(e){if(this.rect!=null&&this.drawMode==1){let r=Wr.selectNet(e.sceneX,e.sceneY);if(r!==null){let i=this.getNearNetPcbItems(r,e.sceneX,e.sceneY);this.handleNets(e,i)}}}handleChangeRectNet(e){this.rect.net=e,DD(this.rect,e,this.pcbBridgingCopperIndex),this.drawMode=0,ne.eq(this.rect.buildBBox().area(),0)||this.confirmWindow()}getNearNetPcbItems(e,r,i){let n=new Set,s=new Set,a=new Set;return e.forEach(l=>{if(l instanceof Ye&&l.type=="Fill Region"){let h=l.getComponent();if(h instanceof ln&&h.isBridgingCopper)return}let c=l.net;if(l instanceof Ye&&l.type=="Copper Region"){let h=!1;if(l.iteratorCopper(u=>{h||u.inCopper(r,i)&&u.isVisible&&(h=!0)}),!h)return}c&&(a.add(l),s.add(c))}),n.add({group:a,nets:s}),n}handleNets(e,r){let i=new Set;r.forEach(n=>{i=n.nets}),i.size&&(i.size===1?i.forEach(n=>{this.handleChangeRectNet(n)}):(jt.cancel(),this.showNetsMenu(e,i)))}showNetsMenu(e,r){let i={};i.state="show",i.left=e.mouseX,i.top=e.mouseY,i.filter=this.getNetsMenuData(r).result,Qt.getInstance().menuData(i,this),this.drawing=!1}getNetsMenuData(e){let r=new Jt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}getLayerIdByCanvasDocType(){let e=be.getActiveLayerID();return x.getInstance().doctype!==4&&Cx(e)&&(e=1),e}wireCorner(e){}wireMode(e){}proportionalZoom(){}};oU._readyType=null;var Tc=oU;function o1(o,t,e,r=!1,i=!1,n){let s=new Jt;return e?(s.add("COMPLETE"),s.add("CANCEL"),s.add("REGRESSION",!0)):s.add("CANCEL",!0),r?(s.addExtend("WIRING_CORNER",KS(o)),i&&(s.addExtend("WIDTH",lg(n)),s.add("WIRING_WIDTH_INPUT",!0)),x.getInstance().doctype===bi.FOOTPRINT&&s.add("AUTO_TRIM_SILKSCREEN",!1,we.autoTrimSilkscreen)):s.addExtend("WIRING_CORNER",KS(o),!0),s.add("toggleAdsorb",!1,t),s.add("ADSORBENT_CONFIG"),s}var Hu=class{constructor(){this.commands=null;this._width=1;this.shape=new Array;this.cutSilkLines=new Array;this.start=null;this.last=null;this.curr=null;this.lastDirect=new S(1,0);this.closeLine=null;this.completing=!1;this.needClose=!0;this.drawMode=0;this.drawScene=null;this.isEditOutLine=!1;this.drawHistory=[]}convert(){let t=new Array;for(let e of this.shape){let r=e.width;if(e instanceof Yi||e instanceof hr){let i=new M(e.start,e.end);t.push({primitive:i,width:r})}else{let[i,n,s,a,l]=[e.center,e.startAngle/Math.PI*180,e.endAngle/Math.PI*180,e.radius,e.sweep],c=q.build2(i,n,s,a,a,l);t.push({primitive:c,width:r})}}return t}setAdsorptionDrawingLine(){let t=this.convert();di.drawingLines=t}clearAdsorptionDrawingLine(){di.drawingLines=[]}clearDrawHistory(){this.drawHistory.length=0}newData(){return this.convert().filter(({primitive:t})=>!t.start().equals(t.end()))}drawHistoryRecord(){this.drawHistory.push(this.newData())}historyBack(t){var n;this.drawHistory.pop(),this.drawHistory.length==0&&(this.shape.length&&(this.start=this.shape[0].start,this.last=this.shape[0].start),td.canCut()&&(this.cutSilkLines.length=0)),this.shape.forEach(s=>{s.remove()}),this.shape.length=0;let{lineColor:e,lineSolid:r}=Ys.getInstance().getRegionLineStyle2(this.drawScene,((n=this.shape[0])==null?void 0:n.color)||ee.BLACK),i=this.drawHistory[this.drawHistory.length-1];i&&(i.forEach(({primitive:s,width:a})=>{let l;if(s instanceof M)l=this.createSceneLine(t,s.start(),s.end(),e,r,a);else{let c=s.startAngle/180*Math.PI,h=s.endAngle()/180*Math.PI;l=this.createSceneArc(t,s.center,s.rx,c,h,s.sweep(),e,a)}this.shape.push(l)}),this.start=this.shape[this.shape.length-1].end,this.last=this.shape[this.shape.length-1].end,td.canCut()&&this.rebuildCutSilkLines())}createSceneLine(t,e,r,i,n=!1,s=this._width){let a=this.drawScene==="Segment",l;return a?l=new hr(t,e,r,n,i):l=Yi.build(t,e,r,s),l}createSceneArc(t,e,r,i,n,s,a,l){let c=this.drawScene==="Segment",h;return c?h=ns.build(t,e,r,i,n,s,a):h=Zo.build(t,e,r,l,i,n,s),h}rebuildCutSilkLines(){let t=this.shape,e=[];for(let r=0;r<t.length;r++){let i=[t[r]];for(;t[r+1]&&t[r].end.equals1(t[r+1].start);)i.push(t[r+1]),r++;e.push(i)}this.cutSilkLines=e}};var DP=class{};var bg=class extends DP{constructor(e){super();this.profile=null;this.profiles=[];this.shouldAddHistory=!0;this.type=e}getResult(e){if((be.getActiveLayerID()===3||be.getActiveLayerID()===4)&&e.cutSilkLines.length>0)return this.getResult1(e);let r=new Array;e.shape.forEach(i=>{let n=this.getModel(e,i);r.push(n),i.remove()}),r=iy(r),this.validChilds(this.type,r)?r.length>0&&(this.type=="Cutout"?(this.profile=v9.getInstance().handleCutout(2,[r],this.getLayerIdByCanvasDocType(),e._width),e.drawScene=this.profile.type):this.profile=pt.addPolygon(this.type,this.getLayerIdByCanvasDocType(),[r],e._width,"",!1)):r.forEach(i=>{i.remove()}),e.shape.length=0}validChilds(e,r){return!(pd(e)&&!xu(r.map(i=>i.primitive)))}getPrimitive(e){if(e instanceof Yi||e instanceof Zo)return e.primitive;if(e instanceof hr)return new M(e.start,e.end);if(e instanceof ns)return q.build2(e.center,MM(e.startAngle),MM(e.endAngle),e.radius,e.radius,e.sweep)}getResult1(e){let r=new Array;e.cutSilkLines.forEach(i=>{let n=new Array,s=!0;pd(this.type)&&!xu(i.map(a=>this.getPrimitive(a)))&&(s=!1);for(let a=0;a<i.length;a++){if(s){let l=this.getModel(e,i[a]);n.push(l)}i[a].remove()}s&&r.push(n)}),e.shape.forEach(i=>{i.remove()});for(let i=0;i<r.length;i++){let n=iy(r[i]);n.length!=0&&this.profiles.push(pt.addPolygon(this.type,this.getLayerIdByCanvasDocType(),[n],e._width,"",!1))}e.shape.length=0,e.cutSilkLines.length=0}getModel(e,r){let i=be.getActiveLayerID();return new io().clone4Shape(this.getPrimitive(r),i,e._width)}confirmWindow(e,r){if(this.profile!=null){if(this.profile.type!=="Partition"&&!Bt.checkIsInCanEdit(this.profile)){let i="Cannot be added beyond drawing range";Bt.showMassageTip(i,i),this.profile.remove(),A.publish("delete",this.profile);return}this.type=="Copper Region"||this.type=="Prohibited Region"||this.type=="Constraint Region"||this.type=="Fill Region"?A.publish("openMainDialog",{cmd:17,data:{shape:this.profile,tool:r}}):this.type=="Line"&&this.profile.layerId===11?(this.profile.isClose()&&(this.profile.type="Board Outline"),this.modify(e,r,!0)):this.type=="Cutout"?v9.getInstance().placeSuccess(2,this.profile.globalIndex):(nb(this.profile),this.modify(e,r,!0))}else this.profiles.length>0&&this.modify(e,r,!0)}modify(e,r,i){if(this.profiles.length>0)return this.modify1(e,r,i);if(i&&this.profile!=null){e._width=this.profile.strokeWidth;let n=new mi;gn.addOrder(this.profile,e.commands),this.shouldAddHistory&&(n.addGroup(e.commands),n.addCommand4Item(this.profile,"add"));let s=this.profile?[this.profile]:[],a=!1,l=new Array,c=this.profile.layerId;if(this.profile instanceof ct&&(a=No(this.profile.getMathGraphics()),a)){if(this.type==="Partition"){n.addCommand4Item(this.profile,"delete"),this.profile.remove(),A.publish("delete",this.profile),A.publish("ui/toastMsg",{type:"info",msg:"There is a self-intersection and please redraw a polygon"},$());return}s=Vm(this.profile,e.commands)}if(this.profile.isEmpty||l.push(this.profile),s.length&&this.type!=="Partition"&&(this.shouldAddHistory?(n.checkOutlines(s),s.forEach(h=>{h.fill()}),Re.addAll(l,s)):s.forEach(h=>h.hidden())),!vE(c)&&!("3D Shell - Side Slot Region","Partition").includes(this.type)&&this.shouldAddHistory&&A.publish("onlySelect",l),this.type=="Copper Region"){let h=l.map(u=>u.globalIndex);A.publish("rebuildConnectCopper",h)}if(this.shouldAddHistory&&(e.commands=new ve("draw 2DLine - "+this.type)),this.type==="Partition"){let h=new q_;Array.from(new Set(l)).every(d=>(Dn.getInstance().addItem(d),uhe(d.globalIndex,h.othersCommand)))?(je.stack.addCommand(h),je.increaseUpload()):Array.from(new Set(l)).forEach(d=>{Dn.getInstance().deleteItemById(d.globalIndex)})}s.forEach(h=>h.partition=x.getInstance().partitionId),this.profileRes=s,!this.shouldAddHistory&&A.publish("sendSplitLine",s),this.profile=null,r.drawing=!0,this.type!=="Partition"&&A.publish("flushService","")}else this.profile!=null&&(this.profile.remove(),A.publish("delete",this.profile)),A.publish("updateRtree",""),this.profile=null,r.drawing=!0,A.publish("updateFrame","")}modify1(e,r,i){if(i&&this.profiles.length>0){!this.shouldAddHistory&&A.publish("sendSplitLine",this.profiles),A.publish("onlySelect",this.profiles.filter(s=>!s.isEmpty)),e._width=this.profiles[0].strokeWidth,e.commands=new ve("draw 2DLine - "+this.type);let n=new mi;n.addGroup(e.commands);for(let s=0;s<this.profiles.length;s++)n.addCommand4Item(this.profiles[s],"add"),this.profiles[s].fill();n.checkOutlines(Array.from(this.profiles),new Set),this.profiles.length=0,r.drawing=!0,A.publish("flushService","")}else{if(this.profiles!=null)for(let n=0;n<this.profiles.length;n++)this.profiles[n].remove(),A.publish("delete",this.profiles[n]);A.publish("updateRtree",""),this.profiles=[],r.drawing=!0,A.publish("updateFrame","")}}getLayerIdByCanvasDocType(){let e=be.getActiveLayerID();return x.getInstance().doctype!==bi.FOOTPRINT&&Cx(e)&&(e=1),e}};var x9=class extends DP{constructor(){super(...arguments);this.pad=null}getResult(e){let r=new Array;e.shape.forEach(n=>{let s=this.getModel(e,n);r.push(s),n.remove(),A.publish("delete",n)}),r=iy(r);let i=r.map(n=>n.primitive);if(r.forEach(n=>{n.remove(),A.publish("delete",n)}),!(i.length==2&&i[0]instanceof M&&i[1]instanceof M)){if(r.length>0){let n=new Sm(i);this.pad=Kt.addPolygonPad(be.getActiveLayerID(),"",n.center,0,fe.build2(i),"",!1,1,.4,.4,.4,[],!0,n.high*.6,n.high*.3,"ROUND",0,new S(0,0))}}e.shape.length=0}getPrimitive(e){if(e instanceof Yi||e instanceof Zo)return e.primitive;if(e instanceof hr)return new M(e.start,e.end);if(e instanceof ns)return q.build2(e.center,e.startAngle,e.endAngle,e.radius,e.radius,e.sweep)}getModel(e,r){let i=be.getActiveLayerID();return new io().clone4Shape(this.getPrimitive(r),i,e._width)}confirmWindow(e,r){this.pad!=null&&A.publish("openMainDialog",{cmd:21,data:{shape:this.pad,tool:r}})}modify(e,r,i){if(i&&this.pad!=null){let n=No(this.pad.getMathGraphics()),s=[];n?s=Lue(this.pad,e.commands,{onlyMove:!0}):(e.commands.addCommand(Te.dispatch(this.pad,"add")),A.publish("hasModifyPcbItem",this.pad),s=[this.pad],A.publish("onlySelect",s)),ah.realtimeCheckItems(s),je.executeCommand(e.commands),e.commands=new ve("draw polygon pad"),A.publish("flushService",""),this.pad=null,r.drawing=!0,this.notifyPadReset(r)}else this.pad!=null&&(this.pad.remove(),A.publish("delete",this.pad)),A.publish("updateRtree",""),this.pad=null,r.drawing=!0,this.notifyPadReset(r)}notifyPadReset(e){A.publish("PolygonPadReset",e)}};var p2=class extends bg{constructor(e,r){super(e.type);this.nextShape=new Array;this.profile=e,this.index=r}getResult(e){let r=new Array;if(e.shape.forEach(i=>{let n=this.getModel(e,i);n!=null&&r.push(n),i.remove()}),this.nextShape.forEach(i=>{let n=this.getModel(e,i);n!=null&&r.push(n),i.remove()}),r=iy(r),this.validChilds(this.profile.type,r)){let i=this.profile.getChildrens(),n=i[this.index];n&&(this.profile instanceof ct&&n.length===2&&(r[r.length-1].end=n[1].end),n.forEach(s=>{s.remove()}),n.length=0),r.forEach(s=>{s.setParent(this.profile)}),i[this.index]=r,this.profile.setChildrens(i),this.profile.strokeWidth=e._width}else{for(let i of r)i.remove();e.commands.addCommand(Te.dispatch(this.profile,"delete")),this.profile.remove(),A.publish("delete",this.profile),this.profile=null}e.shape.length=0,this.nextShape.length=0,A.publish("hasModifyPcbItem",this.profile)}getModel(e,r){let i=this.profile.layerId,n=new io;return r.length>0?n.clone4Shape(this.getPrimitive(r),i,e._width):null}confirmWindow(e,r){this.modify(e,r,!0)}modify(e,r,i){let n=new mi;n.addGroup(e.commands);let s=this.profile?[this.profile]:[];this.profile.model.update4Childs(),this.profile instanceof ct&&No(this.profile.getMathGraphics())&&(s=Vm(this.profile,e.commands)),s.length&&(ah.realtimeCheckItems(s),n.checkOutlines(s),s.forEach(a=>{a.fill()})),this.profile!=null&&(this.profile.visible(),this.profile.fill(),this.profile=null),r.drawing=!1,A.publish("updateRtree",""),A.publish("tool","dropdrag"),A.publish("flushService","")}};var Iw=class extends DP{constructor(e,r){super();this.profile=null;this.type=e,this.confirmWindowCb=r}getResult(e){let r=new Array;e.shape.forEach(i=>{let n=this.getModel(i);r.push(n),i.remove()}),r.length>0&&(this.profile=fe.build2(r)),e.shape.length=0}getModel(e){if(e instanceof Yi||e instanceof Zo)return e.primitive;if(e instanceof hr)return new M(e.start,e.end);if(e instanceof ns)return q.build4(e.start,e.end,e.center,e.radius,e.radius,e.sweep)}confirmWindow(e,r){this.profile!=null&&(this.type=="Line"||this.type=="Prohibited Region"||this.type=="Fill Region"&&(this.confirmWindowCb(this.profile),A.publish("tool","dropdrag")))}modify(e,r,i){}};var Cw=class extends DP{constructor(e,r){super();this.profile=null;this.type=e,this.confirmWindowCb=r}getResult(e){let r=new Array;e.shape.forEach(i=>{let n=this.getModel(i);r.push(n),i.remove()}),r.length>0&&(this.profile=fe.build2(r)),e.shape.length=0}getModel(e){if(e instanceof Yi||e instanceof Zo)return e.primitive;if(e instanceof hr)return new M(e.start,e.end);if(e instanceof ns)return q.build4(e.start,e.end,e.center,e.radius,e.radius,e.sweep)}confirmWindow(e,r){if(this.profile!=null){if(this.type=="Line"){let i=new Array,n=new Array;this.profile.primitives.forEach(a=>{let l=a.stroke(e._width,kr.ROUND,le.CCW);i.push(l);let c=Wr.getSelectContect(l);n=n.concat(Array.from(c))});let s=$t.filterElement(n,{boxChoose:!0});s.forEach(a=>{a.click()}),A.publish("select",s),Pr.model=1,A.publish("tool","dropdrag")}else if(this.type=="Prohibited Region"){let i=new Set(Lc());Wr.getSelectContect(this.profile).forEach(a=>{i.delete(a)});let s=$t.filterElement(i,{boxChoose:!0});s.forEach(a=>{a.click()}),A.publish("select",s),Pr.model=1,A.publish("tool","dropdrag")}else if(this.type=="Fill Region"){let i=Wr.getSelectInside(this.profile);i=$t.filterElement(i,{boxChoose:!0}),i.forEach(n=>{n.click()}),A.publish("select",i),Pr.model=1,A.publish("tool","dropdrag")}this.confirmWindowCb&&this.confirmWindowCb(this.profile)}}modify(e,r,i){}};function FXe(o){let t=new Jt;return o?(t.add("EDIT_BOUNDARY"),t.add("EDIT_NODE"),t.add("MOVE_NODE"),t.add("DELETE_NODE"),t.add("INSERT_NODE")):t.add("COMPLETE"),t}var Sw=class extends ws{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.selectIndex=NaN;this.position=null;this.circle=e,this.commands=new ve("select Circle 2D line -"+this.circle.type);let r=this.circle.center.add(new S(-this.circle.radius,0)),i=this.circle.center.add(new S(this.circle.radius,0)),n=this.circle.center.add(new S(0,this.circle.radius)),s=this.circle.center.add(new S(0,-this.circle.radius)),a=this.circle.layerId;this.right=new qi(a,i),this.top=new qi(a,n),this.left=new qi(a,r),this.bottom=new qi(a,s),this.center=new qi(a,this.circle.center),this.moveTool=new Ch([this.circle])}flushPoint(){let e=this.circle.center.add(new S(-this.circle.radius,0)),r=this.circle.center.add(new S(this.circle.radius,0)),i=this.circle.center.add(new S(0,this.circle.radius)),n=this.circle.center.add(new S(0,-this.circle.radius));this.center.setPosition(this.circle.center),this.left.setPosition(e),this.right.setPosition(r),this.top.setPosition(i),this.bottom.setPosition(n)}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY,n=NaN;this.mouseLeftDown=!0;let s=!1;if(this.top.isSelect(r,i)&&(n=0,s=!0),this.right.isSelect(r,i)&&(n=1,s=!0),this.bottom.isSelect(r,i)&&(n=2,s=!0),this.left.isSelect(r,i)&&(n=3,s=!0),this.center.isSelect(r,i)&&(this.controlPointMove=!0,s=!0),isNaN(n)||(this.selectIndex=n),x.getInstance().envFlag=="silk-preview"&&this.circle.type==="FPC Stiffener"){let l=this.circle.buildBBox().width(),c=this.circle.buildBBox().height();l=Xe(l,void 0,"mm"),c=Xe(c,void 0,"mm"),A.messageBus.publish("changeFPCSize",`${c}*${l}`);let h=this.circle.getComponent(),u={id:this.circle.globalIndex,layerid:this.circle.layerId,material:h==null?void 0:h.material,model:h==null?void 0:h.fpcModel,thickness:h==null?void 0:h.thickness};A.messageBus.publish("changeCheckFPCComponent",u)}return this.addHistory=!0,s||this.circle.isSelect(r,i)}onMouseMove(e){if(this.circle.locked)return!1;let r=this.shiftControl(e),i=this.lastPosition;if(this.addHistory&&(this.commands.addCommand(Te.dispatch(this.circle,"modify")),this.addHistory=!1,Te.dispatchCoppers(this.circle,"delete",this.commands),this.circle.clearCopper()),this.circle.removeFill(),this.left.status()){let s=new S(i.x,this.left.y);this.left.setPosition(s),this.circle.radius=this.circle.center.distance1(s);let a=new S(this.circle.center.x*2-s.x,this.circle.center.y),l=new S(this.circle.center.x,this.circle.center.y+this.circle.radius),c=new S(this.circle.center.x,this.circle.center.y-this.circle.radius);return this.right.setPosition(a),this.top.setPosition(l),this.bottom.setPosition(c),!0}if(this.right.status()){let s=new S(i.x,this.right.y);this.right.setPosition(s),this.circle.radius=this.circle.center.distance1(s);let a=new S(this.circle.center.x*2-s.x,this.circle.center.y),l=new S(this.circle.center.x,this.circle.center.y+this.circle.radius),c=new S(this.circle.center.x,this.circle.center.y-this.circle.radius);return this.left.setPosition(a),this.top.setPosition(l),this.bottom.setPosition(c),!0}if(this.top.status()){let s=new S(this.top.x,i.y);this.top.setPosition(s),this.circle.radius=this.circle.center.distance1(s);let a=new S(this.circle.center.x,this.circle.center.y*2-s.y),l=new S(this.circle.center.x-this.circle.radius,this.circle.center.y),c=new S(this.circle.center.x+this.circle.radius,this.circle.center.y);return this.right.setPosition(c),this.left.setPosition(l),this.bottom.setPosition(a),!0}if(this.bottom.status()){let s=new S(this.top.x,i.y);this.bottom.setPosition(s),this.circle.radius=this.circle.center.distance1(s);let a=new S(this.circle.center.x,this.circle.center.y*2-s.y),l=new S(this.circle.center.x-this.circle.radius,this.circle.center.y),c=new S(this.circle.center.x+this.circle.radius,this.circle.center.y);return this.right.setPosition(c),this.left.setPosition(l),this.top.setPosition(a),!0}if(this.center.status()){this.circle.center=i,this.center.setPosition(i);let s=this.circle.center.add(new S(-this.circle.radius,0)),a=this.circle.center.add(new S(this.circle.radius,0)),l=this.circle.center.add(new S(0,this.circle.radius)),c=this.circle.center.add(new S(0,-this.circle.radius));return this.right.setPosition(a),this.top.setPosition(l),this.left.setPosition(s),this.bottom.setPosition(c),!0}this.changeNativeCursor(5);let n=Ae.translate(r.x,r.y,0);return this.circle.getGroupID()!=null?(this.commands=new ve("select Circle 2D line -"+this.circle.type),this.moveTool.onMouseMove(e)):this.circle.transform(n),this.center.transform(n),this.right.transform(n),this.top.transform(n),this.left.transform(n),this.bottom.transform(n),!0}onMouseLeftUp(e){if(this.commands.length>0){let r=new mi;r.addGroup(this.commands),r.checkOutlines([this.circle],new Set),this.commands=new ve("select Circle 2D line -"+this.circle.type),A.publish("hasModifyPcbItem",this.circle)}return this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),WC.ready&&!isNaN(this.selectIndex)&&(this.editNode(this.selectIndex),this.clearSelectIndex()),!0}interrupt(){return this.commands.undo(),this.left.remove(),this.right.remove(),this.top.remove(),this.bottom.remove(),this.center.remove(),this.moveTool.interrupt(),this.changeNativeCursor(4),this.removeShiftMoveHelpLine(),A.publish("updateRtree",""),!0}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.selectPoint(r,i),!1}onMouseRightUp(e){if(e.openMenu){let r=NaN;if(this.top.isSelect(e.realSceneX,e.realSceneY)&&(r=0),this.right.isSelect(e.realSceneX,e.realSceneY)&&(r=1),this.bottom.isSelect(e.realSceneX,e.realSceneY)&&(r=2),this.left.isSelect(e.realSceneX,e.realSceneY)&&(r=3),!isNaN(r))return this.selectIndex=r,this.position=new S(e.realSceneX,e.realSceneY),this.rightClickMenuData(e),!0}return!1}clearSelectIndex(){this.selectIndex=NaN}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:FXe(!0).result};Qt.getInstance().menuData(r,this)}selectPoint(e,r){this.left.inTop(e,r)||this.right.inTop(e,r)?this.changeNativeCursor(1):this.top.inTop(e,r)||this.bottom.inTop(e,r)?this.changeNativeCursor(0):this.center.inTop(e,r)?this.changeNativeCursor(5):this.circle.isInProfile(e,r)?this.changeNativeCursor(5):this.changeNativeCursor(4)}getArcModel(e,r,i){let n=new yh(this.circle.globalIndex,this.circle.center,this.circle.radius,e,r,i,{layerId:this.circle.layerId,strokeWidth:this.circle.strokeWidth,locked:!1});return new vt(n)}deleteNode(){isNaN(this.selectIndex)||ls.getInstance().init([this.circle],"delete circle node check lock",(e,r)=>{let i=new Array,n=this.circle.center.add(new S(-this.circle.radius,0)),s=this.circle.center.add(new S(this.circle.radius,0)),a=this.circle.center.add(new S(0,this.circle.radius)),l=this.circle.center.add(new S(0,-this.circle.radius)),c=new io;if(this.selectIndex===2||this.selectIndex===0){let h=this.selectIndex===0?le.CW:le.CCW,u=this.selectIndex===0?-Math.PI:Math.PI,d=c.addLine(n,s,this.circle.layerId,this.circle.strokeWidth),p=qc.addArc(this.circle.layerId,this.circle.center,this.circle.radius,this.circle.strokeWidth,0,u,h,!1);i.push(d,p)}if(this.selectIndex===1||this.selectIndex===3){let h=this.selectIndex===1?le.CW:le.CCW,u=-Math.PI/2,d=this.selectIndex===1?-3*Math.PI/2:Math.PI/2,m=new io().addLine(a,l,this.circle.layerId,this.circle.strokeWidth),g=qc.addArc(this.circle.layerId,this.circle.center,this.circle.radius,this.circle.strokeWidth,u,d,h,!1);i.push(m,g)}if(i=Nm(i),i.length>0){let h=pt.addPolygon(this.circle.type,this.circle.layerId,[i],this.circle.strokeWidth,"",!1);r.addCommand4Item(h,"add"),r.addCommand4Item(this.circle,"delete"),A.publish("delete",this.circle),this.circle.remove()}this.clearSelectIndex(),A.publish("flushSelectingInfo",""),A.publish("updateRtree",""),r.execute()})}editNode(e){let r=new Array,i=this.circle.center.add(new S(-this.circle.radius,0)),n=this.circle.center.add(new S(this.circle.radius,0)),s=this.circle.center.add(new S(0,this.circle.radius)),a=this.circle.center.add(new S(0,-this.circle.radius)),l,c,h,u;e===1&&(u=this.getArcModel(Math.PI/2,3*Math.PI/2,le.CCW),l=a,c=s,h=n),e===2&&(u=this.getArcModel(0,Math.PI,le.CCW),l=i,c=n,h=a),e===3&&(u=this.getArcModel(Math.PI/2,3*Math.PI/2,le.CW),l=a,c=s,h=i),e===0&&(u=this.getArcModel(0,Math.PI,le.CW),l=i,c=n,h=s),r.push(u),A.publish("redrawPolygon",{shapes:r,last:l,start:c,curr:h,profile:this.circle})}parse(e){switch(e.cmdKey.split(":")[0]){case"INSERT_NODE":{A.publish("toggle",{command:"insertNode"});break}case"EDIT_NODE":this.editNode(this.selectIndex);break;case"MOVE_NODE":A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.circle],inputInfo:this.position,commands:this.commands});break;case"DELETE_NODE":this.deleteNode();break;case"EDIT_BOUNDARY":A.publish("toggle",{command:"editOutline",item:this.circle});break}}rotate(e=ce.pcbConfig.rotate){if(!this.controlPointMove){let r=this.circle.getParent();if(r!=null&&r.getGroupID()!=null)this.commands=new ve("select Circle 2D line -"+this.circle.type),this.moveTool.rotate(e);else{this.addHistory&&(this.commands=new ve("select Circle 2D line -"+this.circle.type),this.commands.addCommand(Te.dispatch(this.circle,"modify")),this.addHistory=!1);let i=_s([this.circle]);if(i.valid()){let s=i.build1().center();ao.rotate(s,e,[this.circle]),this.flushPoint()}}}}};function VXe(o){let t=new Jt;return o?(t.add("EDIT_BOUNDARY"),t.add("EDIT_NODE"),t.add("MOVE_NODE"),t.add("DELETE_NODE"),t.add("INSERT_NODE")):t.add("COMPLETE"),t}var Z_=class extends ws{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.selectIndex=NaN;this.curr=null;this.position=null;this.ratio=NaN;this.rect=e,this.commands=new ve("select RECT 2D line -"+e.type);let r=this.rect.layerId;this.width=this.rect.width,this.height=this.rect.height,this.matrix=Ae.rotateZ(-this.rect.rotation),this.matrix1=Ae.rotateZ(this.rect.rotation),this.leftLow=new qi(r,this.rect.getLL()),this.rightLow=new qi(r,this.rect.getLR()),this.leftUp=new qi(r,this.rect.getUL()),this.rightUp=new qi(r,this.rect.getUR()),this.top=new qi(r,this.rect.getUR().add(this.rect.getUL()).mul(.5),!0),this.bottom=new qi(r,this.rect.getLL().add(this.rect.getLR()).mul(.5),!0),this.left=new qi(r,this.rect.getLL().add(this.rect.getUL()).mul(.5),!0),this.right=new qi(r,this.rect.getUR().add(this.rect.getLR()).mul(.5),!0),this.moveTool=new Ch([this.rect]),this.topDirect=Yf(this.leftUp.getPosition().sub(this.rightUp.getPosition()).normalize()),this.leftDirect=Yf(this.leftUp.getPosition().sub(this.leftLow.getPosition()).normalize())}flushPoint(){this.leftLow.setPosition(this.rect.getLL()),this.rightLow.setPosition(this.rect.getLR()),this.leftUp.setPosition(this.rect.getUL()),this.rightUp.setPosition(this.rect.getUR()),this.top.setPosition(this.rect.getUR().add(this.rect.getUL()).mul(.5)),this.bottom.setPosition(this.rect.getLL().add(this.rect.getLR()).mul(.5)),this.left.setPosition(this.rect.getLL().add(this.rect.getUL()).mul(.5)),this.right.setPosition(this.rect.getUR().add(this.rect.getLR()).mul(.5))}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY,n=NaN;if(this.controlPointMove=!1,this.leftUp.isSelect(r,i)&&(this.controlPointMove=!0,n=3,this.curr=this.leftUp.getPosition()),this.rightUp.isSelect(r,i)&&(this.controlPointMove=!0,n=2,this.curr=this.rightUp.getPosition()),this.rightLow.isSelect(r,i)&&(this.controlPointMove=!0,n=1,this.curr=this.rightLow.getPosition()),this.leftLow.isSelect(r,i)&&(this.controlPointMove=!0,n=0,this.curr=this.leftLow.getPosition()),this.top.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.top.getPosition()),this.bottom.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.bottom.getPosition()),this.left.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.left.getPosition()),this.right.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.right.getPosition()),isNaN(n)||(this.selectIndex=n),x.getInstance().envFlag=="silk-preview"&&this.rect.type==="FPC Stiffener"){let c=this.width,h=this.height;c=Xe(c,void 0,"mm"),h=Xe(h,void 0,"mm"),A.messageBus.publish("changeFPCSize",`${h}*${c}`);let u=this.rect.getComponent(),d={id:this.rect.globalIndex,layerid:this.rect.layerId,material:u==null?void 0:u.material,model:u==null?void 0:u.fpcModel,thickness:u==null?void 0:u.thickness};A.messageBus.publish("changeCheckFPCComponent",d)}this.mouseLeftDown=!0,this.addHistory=!0;let a=this.rect.getLL().distance1(this.rect.getUL()),l=this.rect.getLL().distance1(this.rect.getLR());return this.ratio=l/a,this.controlPointMove?this.controlPointMove:this.rect.isSelect(r,i)}onMouseMove(e){if(this.rect.locked)return!1;let r=this.shiftControl(e),i=this.lastPosition;if(this.addHistory&&(this.commands.addCommand(Te.dispatch(this.rect,"modify")),this.addHistory=!1,Te.dispatchCoppers(this.rect,"delete",this.commands),this.rect.clearCopper()),e.shiftKey){if(this.proportionRect(r,e))return!0}else{if(this.leftLow.status())return this.changeNativeCursor1(2,this.rect.rotation),this.leftLow.setPosition(i),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0;if(this.rightLow.status())return this.changeNativeCursor1(3,this.rect.rotation),this.rightLow.setPosition(i),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0;if(this.rightUp.status())return this.changeNativeCursor1(2,this.rect.rotation),this.rightUp.setPosition(i),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0;if(this.leftUp.status())return this.changeNativeCursor1(3,this.rect.rotation),this.leftUp.setPosition(i),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0;if(this.top.status()){this.changeNativeCursor1(0,this.rect.rotation);let s=this.rightUp.getPosition().sub(this.leftUp.getPosition()).normalize();r=this.getNormalOffset(s,r);let a=this.rightUp.getPosition().add(r),l=this.leftUp.getPosition().add(r);return Yf(l.sub(this.leftLow.getPosition()).normalize()).dot(this.leftDirect)<=0&&(a=this.rightLow.getPosition(),l=this.leftLow.getPosition()),this.rightUp.setPosition(a),this.leftUp.setPosition(l),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0}if(this.bottom.status()){this.changeNativeCursor1(0,this.rect.rotation);let s=this.rightLow.getPosition().sub(this.leftLow.getPosition()).normalize();r=this.getNormalOffset(s,r);let a=this.rightLow.getPosition().add(r),l=this.leftLow.getPosition().add(r);return Yf(this.leftUp.getPosition().sub(l).normalize()).dot(this.leftDirect)<=0&&(a=this.rightUp.getPosition(),l=this.leftUp.getPosition()),this.rightLow.setPosition(a),this.leftLow.setPosition(l),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0}if(this.right.status()){this.changeNativeCursor1(1,this.rect.rotation);let s=this.rightUp.getPosition().sub(this.rightLow.getPosition()).normalize();r=this.getNormalOffset(s,r);let a=this.rightUp.getPosition().add(r),l=this.rightLow.getPosition().add(r);return Yf(this.leftUp.getPosition().sub(a).normalize()).dot(this.topDirect)<=0&&(l=this.leftLow.getPosition(),a=this.leftUp.getPosition()),this.rightUp.setPosition(a),this.rightLow.setPosition(l),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0}if(this.left.status()){this.changeNativeCursor1(1,this.rect.rotation);let s=this.leftUp.getPosition().sub(this.leftLow.getPosition()).normalize();r=this.getNormalOffset(s,r);let a=this.leftUp.getPosition().add(r),l=this.leftLow.getPosition().add(r);return Yf(a.sub(this.rightUp.getPosition()).normalize()).dot(this.topDirect)<=0&&(a=this.rightUp.getPosition(),l=this.rightLow.getPosition()),this.leftUp.setPosition(a),this.leftLow.setPosition(l),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0}}this.changeNativeCursor(5);let n=Ae.translate(r.x,r.y,0);return this.rect.getGroupID()!=null?(this.commands=new ve("select RECT 2D line -"+this.rect.type),this.moveTool.onMouseMove(e,r)):this.rect.transform(n),this.leftLow.transform(n),this.rightLow.transform(n),this.rightUp.transform(n),this.leftUp.transform(n),this.top.transform(n),this.bottom.transform(n),this.left.transform(n),this.right.transform(n),!0}onMouseLeftUp(e){let r=this.isZeroLenLine(this.leftUp,this.rightUp),i=this.isZeroLenLine(this.leftUp,this.leftLow);if(!r&&i?this.rect.height=0:r&&!i?this.rect.width=0:r&&i&&(this.commands.undo(),this.commands=new ve("select RECT 2D line -"+this.rect.type),A.publish("autoFill",""),A.publish("hasModifyPcbItem",this.rect)),this.commands.length>0){let n=new mi;n.addGroup(this.commands),n.checkOutlines([this.rect],new Set),this.commands=new ve("select RECT 2D line -"+this.rect.type),A.publish("autoFill",""),A.publish("hasModifyPcbItem",this.rect)}return this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushSelectingInfo",""),WC.ready&&!isNaN(this.selectIndex)&&(this.editNode(this.selectIndex),this.clearSelectIndex()),!0}isZeroLenLine(e,r){return e.getPosition().distance1(r.getPosition())<1e-8}interrupt(){return this.commands.undo(),this.leftLow.remove(),this.rightLow.remove(),this.rightUp.remove(),this.leftUp.remove(),this.top.remove(),this.bottom.remove(),this.left.remove(),this.right.remove(),this.moveTool.interrupt(),this.changeNativeCursor(4),this.removeShiftMoveHelpLine(),A.publish("updateRtree",""),!0}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.selectPoint(r,i),!1}onMouseRightUp(e){if(e.openMenu){let r=NaN;if(this.leftUp.isSelect(e.realSceneX,e.realSceneY)&&(r=3),this.rightUp.isSelect(e.realSceneX,e.realSceneY)&&(r=2),this.rightLow.isSelect(e.realSceneX,e.realSceneY)&&(r=1),this.leftLow.isSelect(e.realSceneX,e.realSceneY)&&(r=0),!isNaN(r))return this.selectIndex=r,this.position=new S(e.realSceneX,e.realSceneY),this.rightClickMenuData(e),!0}return!1}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:VXe(!0).result};Qt.getInstance().menuData(r,this)}clearSelectIndex(){this.selectIndex=NaN}selectIndexToPoint(e){switch(e){case 0:return this.rect.getLL();case 3:return this.rect.getUL();case 1:return this.rect.getLR();case 2:return this.rect.getUR();default:throw"selectSide is illegal"}}getOtherLinesExcept(e){let r=this.rect.getAllLinesInOrder(),i=r.length,n=new Array;if(this.rect.cornerRadius<=0){let s=e+1;for(let a=s;a<s+2;a++)n.push(r[a%i])}else for(let s=e*2+2;s<e*2-1+i;s++)n.push(r[s%i]);return n}editNode(e){let r=new Array,i={layerId:this.rect.layerId,strokeWidth:this.rect.strokeWidth,locked:!1};this.getOtherLinesExcept(e).forEach(n=>{if(n instanceof M){let s=new ih(this.rect.globalIndex,n.start(),n.end(),i);r.push(new mt(s))}else if(n instanceof q){let s=new yh(this.rect.globalIndex,n.center,n.rx,Ht.toRadians(n.startAngle),Ht.toRadians(n.endAngle()),n.sweep(),i);r.push(new vt(s))}}),A.publish("redrawPolygon",{shapes:r,last:r[r.length-1].end,start:r[0].start,curr:this.selectIndexToPoint(e),profile:this.rect})}deleteNode(){isNaN(this.selectIndex)||ls.getInstance().init([this.rect],"delete rect node check lock",(e,r)=>{let i=new io,n=i.ptsToShapes(this.getOtherLinesExcept(this.selectIndex),this.rect.layerId,this.rect.strokeWidth);if(n.push(i.addLine(n[n.length-1].end,n[0].start,this.rect.layerId,this.rect.strokeWidth)),n=Nm(n),n.length>0){let s=pt.addPolygon(this.rect.type,this.rect.layerId,[n],this.rect.strokeWidth,"",!1);r.addCommand4Item(s,"add")}r.addCommand4Item(this.rect,"delete"),A.publish("delete",this.rect),this.rect.remove(),this.selectIndex=NaN,A.publish("flushSelectingInfo",""),A.publish("updateRtree",""),r.execute()})}parse(e){switch(e.cmdKey.split(":")[0]){case"INSERT_NODE":{A.publish("toggle",{command:"insertNode"});break}case"EDIT_NODE":this.editNode(this.selectIndex);break;case"MOVE_NODE":A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.rect],inputInfo:this.position,commands:this.commands});break;case"DELETE_NODE":this.deleteNode();break;case"EDIT_BOUNDARY":A.publish("toggle",{command:"editOutline",item:this.rect});break}}getNormalOffset(e,r){let i=new S(-e.y,e.x);return i.mul(r.dot(i))}selectPoint(e,r){this.leftLow.inTop(e,r)||this.rightUp.inTop(e,r)?this.changeNativeCursor1(2,this.rect.rotation):this.rightLow.inTop(e,r)||this.leftUp.inTop(e,r)?this.changeNativeCursor1(3,this.rect.rotation):this.top.inTop(e,r)||this.bottom.inTop(e,r)?this.changeNativeCursor1(0,this.rect.rotation):this.left.inTop(e,r)||this.right.inTop(e,r)?this.changeNativeCursor1(1,this.rect.rotation):this.rect.isInProfile(e,r)?this.changeNativeCursor(5):this.changeNativeCursor(4)}getBBox(e,r){let i=new _e;return i.ext2(e).ext2(r),i.build1()}getTop(){return this.rightUp.getPosition().add(this.leftUp.getPosition()).mul(.5)}getBottom(){return this.leftLow.getPosition().add(this.rightLow.getPosition()).mul(.5)}getLeft(){return this.leftLow.getPosition().add(this.leftUp.getPosition()).mul(.5)}getRight(){return this.rightUp.getPosition().add(this.rightLow.getPosition()).mul(.5)}updateRect(){let e=Ae.rotateZForPoint(this.rect.getUL(),-this.rect.rotation),r=Ae.rotateZForPoint(this.rect.getUL(),this.rect.rotation),i=this.leftLow.getPosition().multiply4(e),n=this.rightUp.getPosition().multiply4(e),s=this.getBBox(i,n);this.rect.setLL(this.getPoint(s.LL().multiply4(r))),this.rect.setLR(this.getPoint(s.LR().multiply4(r))),this.rect.setUR(this.getPoint(s.UR().multiply4(r))),this.rect.setUL(this.getPoint(s.UL().multiply4(r))),this.rect.removeFill()}getPoint(e){let r=Number.MAX_VALUE,i=e,n=e.distance2(this.leftLow.getPosition());n<r&&(r=n,i=this.leftLow.getPosition());let s=e.distance2(this.leftUp.getPosition());s<r&&(r=s,i=this.leftUp.getPosition());let a=e.distance2(this.rightLow.getPosition());a<r&&(r=a,i=this.rightLow.getPosition());let l=e.distance2(this.rightUp.getPosition());return l<r&&(r=l,i=this.rightUp.getPosition()),i}updateLeftLow(){let e=Ae.rotateZForPoint(this.rect.getUL(),-this.rect.rotation),r=Ae.rotateZForPoint(this.rect.getUL(),this.rect.rotation),i=this.leftLow.getPosition().multiply4(e),n=this.rightUp.getPosition().multiply4(e),s=new S(i.x,n.y),a=new S(n.x,i.y);this.rightLow.setPosition(a.multiply4(r)),this.leftUp.setPosition(s.multiply4(r))}updateLeftUp(){let e=Ae.rotateZForPoint(this.rect.getUL(),-this.rect.rotation),r=Ae.rotateZForPoint(this.rect.getUL(),this.rect.rotation),i=this.leftUp.getPosition().multiply4(e),n=this.rightLow.getPosition().multiply4(e),s=new S(i.x,n.y),a=new S(n.x,i.y);this.leftLow.setPosition(s.multiply4(r)),this.rightUp.setPosition(a.multiply4(r))}updateMids(){this.top.setPosition(this.getTop()),this.bottom.setPosition(this.getBottom()),this.left.setPosition(this.getLeft()),this.right.setPosition(this.getRight())}rotate(e=ce.pcbConfig.rotate){if(!this.controlPointMove){let r=this.rect.getParent();if(r!=null&&r.getGroupID()!=null)this.commands=new ve("select RECT 2D line -"+this.rect.type),this.moveTool.rotate(e);else{this.addHistory&&(this.commands=new ve("select RECT 2D line -"+this.rect.type),this.commands.addCommand(Te.dispatch(this.rect,"modify")),this.addHistory=!1);let i=_s([this.rect]);if(i.valid()){let s=i.build1().center();ao.rotate(s,e,[this.rect]),this.flushPoint()}}}}proportionRect(e,r){let i=new S(r.sceneX,r.sceneY);if(this.leftLow.status()){let n=this.curr.sub(this.rightUp.getPosition()).multiply4(this.matrix),s=new S(n.x,0).normalize().multiply4(this.matrix1),a=new S(0,n.y).normalize().multiply4(this.matrix1),l=i.sub(this.curr),c=l.dot(s),h=l.dot(a);c!=0&&Math.abs(c)>Math.abs(h)?h=(c+this.width)/this.ratio-this.height:h!=0&&Math.abs(h)>Math.abs(c)&&(c=(h+this.height)*this.ratio-this.width);let u=s.mul(c).add(a.mul(h)),d=this.curr.add(u);return this.leftLow.setPosition(d),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0}if(this.rightLow.status()){let n=this.curr.sub(this.leftUp.getPosition()).multiply4(this.matrix),s=new S(n.x,0).normalize().multiply4(this.matrix1),a=new S(0,n.y).normalize().multiply4(this.matrix1),l=i.sub(this.curr),c=l.dot(s),h=l.dot(a);c!=0&&Math.abs(c)>Math.abs(h)?h=(c+this.width)/this.ratio-this.height:h!=0&&Math.abs(h)>Math.abs(c)&&(c=(h+this.height)*this.ratio-this.width);let u=s.mul(c).add(a.mul(h)),d=this.curr.add(u);return this.rightLow.setPosition(d),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0}if(this.rightUp.status()){let n=this.curr.sub(this.leftLow.getPosition()).multiply4(this.matrix),s=new S(n.x,0).normalize().multiply4(this.matrix1),a=new S(0,n.y).normalize().multiply4(this.matrix1),l=i.sub(this.curr),c=l.dot(s),h=l.dot(a);c!=0&&Math.abs(c)>Math.abs(h)?h=(c+this.width)/this.ratio-this.height:h!=0&&Math.abs(h)>Math.abs(c)&&(c=(h+this.height)*this.ratio-this.width);let u=s.mul(c).add(a.mul(h)),d=this.curr.add(u);return this.rightUp.setPosition(d),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0}if(this.leftUp.status()){let n=this.curr.sub(this.rightLow.getPosition()).multiply4(this.matrix),s=new S(n.x,0).normalize().multiply4(this.matrix1),a=new S(0,n.y).normalize().multiply4(this.matrix1),l=i.sub(this.curr),c=l.dot(s),h=l.dot(a);c!=0&&Math.abs(c)>Math.abs(h)?h=(c+this.width)/this.ratio-this.height:h!=0&&Math.abs(h)>Math.abs(c)&&(c=(h+this.height)*this.ratio-this.width);let u=s.mul(c).add(a.mul(h)),d=this.curr.add(u);return this.leftUp.setPosition(d),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0}if(this.top.status()){let n=this.top.getPosition().sub(this.bottom.getPosition()).multiply4(this.matrix),s=new S(1,0).normalize().multiply4(this.matrix1),a=new S(0,n.y).normalize().multiply4(this.matrix1),c=i.sub(this.curr).dot(a),h;a.y<0?h=(-c+this.height)*this.ratio/2:h=(c+this.height)*this.ratio/2;let u=a.mul(c).add(s.mul(-h)),d=a.mul(c).add(s.mul(h)),p=this.curr.add(d),m=this.curr.add(u);return this.rightUp.setPosition(p),this.updateLeftLow(),this.leftUp.setPosition(m),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0}if(this.bottom.status()){let n=this.bottom.getPosition().sub(this.top.getPosition()).multiply4(this.matrix),s=new S(1,0).normalize().multiply4(this.matrix1),a=new S(0,n.y).normalize().multiply4(this.matrix1),c=i.sub(this.curr).dot(a),h;a.y<0?h=(c+this.height)*this.ratio/2:h=(-c+this.height)*this.ratio/2;let u=a.mul(c).add(s.mul(-h)),d=a.mul(c).add(s.mul(h)),p=this.curr.add(d),m=this.curr.add(u);return this.leftLow.setPosition(m),this.updateLeftLow(),this.rightLow.setPosition(p),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0}if(this.right.status()){let n=this.right.getPosition().sub(this.left.getPosition()).multiply4(this.matrix),s=new S(n.x,0).normalize().multiply4(this.matrix1),a=new S(0,1).normalize().multiply4(this.matrix1),c=i.sub(this.curr).dot(s),h;s.x<0?h=(-c+this.width)/this.ratio/2:h=(c+this.width)/this.ratio/2;let u=s.mul(c).add(a.mul(-h)),d=s.mul(c).add(a.mul(h)),p=this.curr.add(u),m=this.curr.add(d);return this.rightUp.setPosition(p),this.updateLeftLow(),this.rightLow.setPosition(m),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0}if(this.left.status()){let n=this.left.getPosition().sub(this.right.getPosition()).multiply4(this.matrix),s=new S(n.x,0).normalize().multiply4(this.matrix1),a=new S(0,1).normalize().multiply4(this.matrix1),c=i.sub(this.curr).dot(s),h;s.x<0?h=(c+this.width)/this.ratio/2:h=(-c+this.width)/this.ratio/2;let u=s.mul(c).add(a.mul(-h)),d=s.mul(c).add(a.mul(h)),p=this.curr.add(u),m=this.curr.add(d);return this.leftUp.setPosition(p),this.updateLeftUp(),this.leftLow.setPosition(m),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0}return!1}isControlPoint(){return this.leftLow.status()||this.leftUp.status()||this.rightLow.status()||this.rightUp.status()}};function Mue(o,t=!1,e=NaN){let r=new Jt;return o?(r.add("EDIT_BOUNDARY"),isNaN(e)?r.add("MOVE_NODE"):(r.add("EDIT_NODE"),r.add("MOVE_NODE"),t||r.add("DELETE_NODE")),r.add("INSERT_NODE")):r.add("COMPLETE"),r}var Nue=class{constructor(){this.event=new Array}getOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}getLine(t,e,r=1e4,i){i=i||Yf(t.sub(e).normalize());let n=i.normalize().mul(r+e.sub(t).length());return new M(t.sub(n),e.add(n))}getInterestPoint(t,e){return xE(t,e)>0?new S(Ee[0],Ee[1]):null}isEqualSlope(t,e){return rOe(t,e)}};var E$=class extends Nue{constructor(t){super(),this.polygon=t,this.event=t.getChildrens().map(e=>e.map(r=>new nhe(r)))}moveOffset(t,e,r){let i=this.event[t][e].shape,n=i.getParent(),s=n.getConnect(i,!0),a=n.getConnect(i,!1),l=this.event[t][e].direct,c=this.getOffset(l,r),h=i.start.sub(i.end),u=i.start.add(c),d=i.end.add(c),p=this.getLine(u,u.add(l),void 0,l);return s!=null&&a!=null?[u,d]=this.has2Line(t,e,u,d,s,a,p,l,h):s!=null&&a==null&&s instanceof mt?[u,d]=this.updateByPrev(t,e,u,d,s,h,p,l):s==null&&a!=null&&a instanceof mt&&([u,d]=this.updateByNext(t,e,u,d,a,h,p,l)),this.child=i,this.selectIndex=[t,e],[u,d]}has2Line(t,e,r,i,n,s,a,l,c){return n instanceof mt&&s instanceof mt?[r,i]=this.updateBy2Line(t,e,r,i,n,s,a,l):n instanceof vt&&s instanceof mt?[r,i]=this.updateByNext(t,e,r,i,s,c,a,l,n):n instanceof mt&&s instanceof vt&&([r,i]=this.updateByPrev(t,e,r,i,n,c,a,l,s)),[r,i]}updateBy2Line(t,e,r,i,n,s,a,l){let c=this.event[t],h=e===c.length-1?c[0].direct:c[e+1].direct,u=e==0?c[c.length-1].direct:c[e-1].direct;if(this.isEqualSlope(l,h)||this.isEqualSlope(l,u))return[c[e].oldStart,c[e].oldEnd];let d=this.getLine(s.start,s.end,void 0,h),p=this.getLine(n.start,n.end,void 0,u),m=this.getInterestPoint(a,d),g=this.getInterestPoint(a,p);if(m!=null&&g!=null&&Yf(m.sub(g).normalize()).dot(l)<=0){let b=this.getInterestPoint(p,d);b!=null&&(m=b,g=b)}return m!=null&&g!=null&&(Yf(g.sub(n.start).normalize()).dot(u)<=0&&(g=n.start,a=this.getLine(g.add(l),g),m=this.getInterestPoint(a,d)),Yf(s.end.sub(m).normalize()).dot(h)<=0&&(m=s.end,a=this.getLine(m.add(l),m),g=this.getInterestPoint(a,p))),m!=null&&g!=null&&(r=g,i=m),[r,i]}updateByPrev(t,e,r,i,n,s,a,l,c){let h=this.event[t],u=e==0?h[h.length-1].direct:h[e-1].direct,d=h[e];if(this.isEqualSlope(l,u))return[d.oldStart,d.oldEnd];let p=this.getLine(n.start,n.end,void 0,u),m=this.getLine(d.oldEnd,i,void 0,new S(-l.y,l.x)),g=this.getInterestPoint(a,p);if(g!=null){if(Yf(i.sub(g).normalize()).dot(l)<=0){let P=m?this.getInterestPoint(p,m):null;P!=null?(i=c?P:n.end,r=c?P:n.end,g=P):(i=n.end,r=n.end)}if(Yf(g.sub(n.start).normalize()).dot(u)<=0){g=n.start;let P=g.sub(d.oldStart),T=this.getOffset(l,P);i=c?d.oldEnd.add(T):g.sub(s)}r=g}return[r,i]}updateByNext(t,e,r,i,n,s,a,l,c){let h=this.event[t],u=e===h.length-1?h[0].direct:h[e+1].direct,d=h[e];if(this.isEqualSlope(l,u))return[d.oldStart,d.oldEnd];let p=this.getLine(n.start,n.end,void 0,u),m=this.getLine(d.oldStart,r,void 0,new S(-l.y,l.x)),g=this.getInterestPoint(a,p);if(g!=null){if(Yf(g.sub(r).normalize()).dot(l)<=0){let P=m?this.getInterestPoint(m,p):null;P!=null?(i=c?P:n.start,r=c?P:n.start,g=P):(i=n.start,r=n.start)}if(Yf(n.end.sub(g).normalize()).dot(u)<=0){g=n.end;let P=g.sub(d.oldEnd),T=this.getOffset(l,P);r=c?d.oldStart.add(T):g.add(s)}i=g}return[r,i]}removeZeroLenLine(t,e,r){let[i,n]=e,s=this.child;if(!s&&!e)return!0;if(!s&&e)return this.updateChildren(t),!0;s&&([i,n]=this.selectIndex);let a=this.event[i].length,l=s.getParent(),c=l.getConnect(s,!0),h=l.getConnect(s,!1);if(a===3&&s instanceof mt&&h!=null&&h instanceof mt&&c!=null&&c instanceof mt&&this.polygon.isClose(i)&&(s.length<=1e-8||h.length<=1e-8||c.length<=1e-8))return t.undo(),!1;if(a===4&&r&&r!="Line"&&s instanceof mt&&h!=null&&h instanceof mt&&c!=null&&c instanceof mt&&h!=null&&h instanceof mt&&this.polygon.isClose(i)){let u=!0;for(let d=0;d<3;d++)if(!this.isEqualSlope(this.event[i][d].direct,this.event[i][d+1].direct)){u=!1;break}if(u)return t.undo(),!1}return this.updateChildren(),!0}updateChildren(t){let e=this.polygon.getChildrens(),r=new Array;for(let i of e){r.push([]);for(let n of i)if(!ne.eq(n.length,0))r[r.length-1].push(n);else{if(t&&i.length===1){t.undo();return}n.remove()}}e.length=0,this.polygon.setChildrens(r)}getClickPosition(t){let[e,r]=t,i=this.event[e][r].oldStart,n=this.event[e][r].oldEnd;return[i,n]}};var dDt=.1,pDt=ee.WHITE,fDt=[new S(1,0),new S(0,1)],mDt=[new S(1,0).rotate(S.ORIGIN,Math.PI/4),new S(1,0).rotate(S.ORIGIN,-Math.PI/4)],sU=class extends ws{constructor(e,r=!0,i){super();this.polygon=null;this._points=new Array;this._mids=new Array;this.insertMsg="Please select a node to insert";this.polygonPad=null;this._nodeInsert=!1;this.selectPolyIndex=[NaN,NaN];this._selectIndex=[NaN,NaN];this._controlPointMove=!1;this._letfSelectIndex=[NaN,NaN];this._mouseLeftSelectIndex=[NaN,NaN];this.insertCb=null;this.obliqueLine=[];this.polygon=e,this.showAllPoints=r;let n=this.getChildrens(this.polygon),s=this.polygon.layerId;n.forEach((a,l)=>{if(this._points[l]=[],this._mids[l]=[],a.forEach((c,h)=>{let u=new qi(s,c.start);this._points[l].push(u);let d=new qi(s,c.midPoint,!0);this._mids[l].push(d),c===i&&(this.selectPolyIndex=[l,h])}),!this.polygon.isClose(l)){let c=new qi(s,a[a.length-1].end);this._points[l].push(c)}}),this.dragPolygon=new E$(e)}getChildrens(e){return this.showAllPoints?e.getChildrens():e.filterOutMostChildren().slice(0,1)}get nodeInsert(){return this._nodeInsert}set nodeInsert(e){this._nodeInsert=e}get points(){return this._points}get mids(){return this._mids}get letfSelectIndex(){return this._letfSelectIndex}set letfSelectIndex(e){this._letfSelectIndex=e}get selectIndex(){return this._selectIndex}set selectIndex(e){this._selectIndex=e}get controlPointMove(){return this._controlPointMove}get mouseLeftSelectIndex(){return this._mouseLeftSelectIndex}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;if(this._controlPointMove=!1,this.nodeInsert)return!1;for(let s=0;s<this._points.length;s++)for(let a=0;a<this._points[s].length;a++)this._points[s][a].isSelect(r,i)&&(this._controlPointMove=!0,this._letfSelectIndex=[s,a]);for(let s=0;s<this._mids.length;s++)for(let a=0;a<this._mids[s].length;a++)this._mids[s][a].isSelect(r,i)&&(this._controlPointMove=!0);this._controlPointMove&&this.polygon.removeFill();let n=aU(this.polygon);this._mouseLeftSelectIndex=[NaN,NaN];for(let s=0;s<this._points.length;s++)for(let a=0;a<this._points[s].length;a++){let c=this._points[s][a].isSelect(r,i);c&&(this._mouseLeftSelectIndex=[s,a]),!(n==3&&(a==0||a==this._points[s].length-1))&&c&&(this.selectIndex=[s,a])}return this.mouseLeftDown=!0,this.lastPosition=new S(r,i),this._controlPointMove?this._controlPointMove:this.polygon.isSelect(r,i)}onMouseMove(e){if(this.polygon.locked)return!1;this.removeObliqueLine(),Ve.lastItems=[],di.snapToSnapFlag(e,void 0,!0);let r=this.shiftControl(e),i=this.lastPosition,n=this.getChildrens(this.polygon);for(let s=0;s<n.length;s++){let a=n[s],l=a.length,c=this._points[s],h=this._mids[s];for(let u=0;u<l;u++){let d=a[u],p=c[u];if(p.status()){this.changleMouseStyle("pointer");let m=this.hasCArc(d,s,u,l),g=this.polygon.getConnect(d,!0);if(m===-1||m===u){if(m===-1)d.start=i,p.setPosition(i),h[u].setPosition(d.midPoint);else{d=d;let y=i.angle(d.center);d.startAngle=y,p.setPosition(d.start),i=d.start,h[u].setPosition(d.midPoint)}g!=null&&(g.end=i,u==0?h[l-1].setPosition(g.midPoint):h[u-1].setPosition(g.midPoint)),this.handelObliqueLineData(p,c),di.handleAddSnapFlagData(g,d)}else{let y=a[m];y=y;let b=i.angle(y.center);y.endAngle=b,p.setPosition(y.end),i=y.end,h[m].setPosition(y.midPoint);let P=this.polygon.getConnect(y,!1);P.start=i;let T=m+1===l?0:m+1;h[T].setPosition(P.midPoint)}return!0}}if(c.length>l){let u=c[c.length-1];if(u.status()){this.changleMouseStyle("pointer");let d=a[l-1];if(d instanceof vt&&d.arcType===2&&this.selectPolyIndex[1]==l-1){let p=i.angle(d.center);d.endAngle=p,u.setPosition(d.end),h[l-1].setPosition(d.midPoint)}else a[l-1].end=i,u.setPosition(i),h[l-1].setPosition(a[l-1].midPoint),this.handelObliqueLineData(u,c),di.handleAddSnapFlagData(d);return!0}}for(let u=0;u<l;u++){let d=h[u];if(d.status()){this.changleMouseStyle("pointer");let p=a[u];if(p instanceof mt){if(a.length<=1)continue;let[m,g]=this.dragPolygon.moveOffset(s,u,r);p.start=m,p.end=g,c[u].setPosition(m),d.setPosition(p.midPoint);let y=this.polygon.getConnect(p,!1);y!=null?(y.start=g,u==l-1?c[0].setPosition(g):c[u+1].setPosition(g),u==l-1?h[0].setPosition(y.midPoint):h[u+1].setPosition(y.midPoint)):c.length>l&&c[l].setPosition(g);let b=this.polygon.getConnect(p,!0);b!=null&&(b.end=m,u==0?h[l-1].setPosition(b.midPoint):h[u-1].setPosition(b.midPoint))}else if(Math.abs(p.start.sub(i).cross(p.end.sub(i)))>1e-8){let m=new ro,{center:g,radius:y,startAngle:b,endAngle:P,sweep:T}=m.point2Angle(p.start,p.end,i);p.center=g,p.radius=y,p.startAngle=b,p.endAngle=P,p.sweep=T,d.setPosition(p.midPoint)}return!0}}}return!1}onMouseUpMove(e){if(this.nodeInsert)return jt.update(e,this.insertMsg),!1;let r=e.sceneX,i=e.sceneY;for(let n of this.points)for(let s of n)if(s.inTop(r,i))return this.changleMouseStyle("pointer"),!0;for(let n of this.mids)for(let s of n)if(s.inTop(r,i))return this.changleMouseStyle("pointer"),!0;return this.polygon.isInProfile(r,i)?this.changeNativeCursor(5):this.changleMouseStyle("default"),!0}onMouseLeftUp(e){return this.mouseLeftDown=!1,this.removeObliqueLine(),di.clearSnapFlag(),this.nodeInsert&&this.insert(e),!0}onMouseRightUp(e){return!0}interrupt(){return this._points.forEach(e=>e.forEach(r=>r.remove())),this._mids.forEach(e=>e.forEach(r=>r.remove())),this._points.length=0,this._mids.length=0,this.removeShiftMoveHelpLine(),this.removeObliqueLine(),!0}flushPoint(){let e=this.getChildrens(this.polygon),r=this.polygon.layerId;for(let i=0,n=e.length;i<n;i++){let s=e[i],a=this.points[i],l=this.mids[i],c=s.length;for(let h=0;h<c;h++){let u=s[h];a[h].setPosition(u.start),l[h].setPosition(u.midPoint)}if(a.length==c){let h=new qi(r,s[c-1].end);a.push(h)}else a[c].setPosition(s[c-1].end)}}editNode(e){let[r,i]=e,s=this.getChildrens(this.polygon)[r],a=s.length,l=new Array,c=new Array,h=this.polygon.isClose();if(i>0)if(h){for(let g=i+1;g<a;g++)l.push(s[g]);for(let g=0;g<i-1;g++)l.push(s[g])}else{for(let g=0;g<i-1;g++)l.push(s[g]);for(let g=i+1;g<a;g++)c.push(s[g])}else for(let g=i+1;g<a-1;g++)l.push(s[g]);let u,d,p,m=this.polygon.getConnect(s[i],!0);return this.polygon.type=="Line"&&!this.polygon.isClose(r)?s.length==1?i==0?(u=s[0].end,d=s[0].end,p=s[0].start):(u=s[0].start,d=s[0].start,p=s[0].end):i==s.length?(u=s[i-1].start,d=s[i-1].start,p=s[i-1].end):this.selectIndex[1]==0?(u=s[0].end,d=s[0].end,p=s[0].start):(u=m.start,d=s[i].end,p=s[i].start):(u=m.start,d=s[i].end,p=s[i].start),this.handelObliqueLineData(this.points[r][i],this.points[r]),di.handleAddSnapFlagData(m,s[i]),{shapes:l,nextshapes:c,last:u,start:d,curr:p}}insert(e){var l;let r=e.realSceneX,i=e.realSceneY,n=new S(r,i),s=this.polygon.primitives,a=-1;for(let c=0;c<s.length;c++)if(s[c].inArea(n,.2,kr.ROUND)){a=c;break}if(a>=0){let c=new Array;for(let u=a+1;u<s.length;u++)c.push(s[u]);for(let u=0;u<a;u++)c.push(s[u]);let h=[];jt.cancel(),(l=this.insertCb)==null||l.call(this,{shapes:c,last:c[c.length-1].end(),start:c[0].start(),curr:n,profile:this.polygonPad,padDrillModels:h})}}insertNode(e,r){if(this.nodeInsert=!0,this.polygonPad=e,this.insertCb=r,!e)return A.publish("toggle",{command:"insertNode"})}deletePoint(){!isNaN(this.selectIndex[0])&&!isNaN(this.selectIndex[1])&&(this.polygon.deletePoint(this.selectIndex),this.flushPoint())}cancel(){this.nodeInsert&&(jt.cancel(),this.nodeInsert=!1,this.polygonPad=null)}hasCArc(e,r,i,n){let s=this.polygon.getConnect(e,!0),a=-1;return[e,s].find((c,h)=>{if(c&&c instanceof vt&&c.arcType==2&&(a=h===0?i:i-1,a===-1&&(a=n-1),a===this.selectPolyIndex[1]))return!0})?a:-1}handelObliqueLineData(e,r){ce.adsorptionConfig.getConfig("Extended Line")&&this.checkOblique(e,r)}checkOblique(e,r){let{orthogonal:i,oblique:n}=this.getObliquePoints(e,r);r.filter(s=>s!==e).forEach(s=>{di.handelAddSnapFlagPoint(s.position)}),i.forEach(s=>{s.length>0&&this.generateAdsorbLine(e.position,s)}),n.forEach(s=>{s.length>0&&this.generateAdsorbLine(e.position,s)})}inEps(e,r){return Math.abs(e-r)<=1e-5}getObliquePoints(e,r){let i=[[],[]],n=[[],[]];return r.forEach(s=>{let a=s.position.sub(e.position);if(ne.greater(a.length(),0)){let l=a.normalize();fDt.forEach((c,h)=>{let u=Math.abs(c.dot(l));if(this.inEps(u,1))return i[h].push(s.position)}),mDt.forEach((c,h)=>{let u=Math.abs(c.dot(l));if(this.inEps(u,1))return n[h].push(s.position)})}}),{orthogonal:i,oblique:n}}generateAdsorbLine(e,r){let i=[];i.push(e);for(let l of r)i.push(l);let n=i[1].sub(i[0]);xr(i,(l,c)=>n.x!==0?l.x-c.x:l.y-c.y);let s=i[0],a=i[i.length-1];this.addObliqueLine(s,a)}addObliqueLine(e,r){let i=Yi.build(this.polygon.layerId,e,r,dDt,pDt);i.manualHighLight=!0,this.obliqueLine.push(i)}removeObliqueLine(){for(let e of this.obliqueLine)e.remove();this.obliqueLine=[]}updatePoints(){this.dragPolygon=new E$(this.polygon),this.interrupt();let e=this.polygon.layerId;this.getChildrens(this.polygon).forEach((i,n)=>{if(this._points[n]=[],this._mids[n]=[],i.forEach((s,a)=>{let l=new qi(e,s.start);this._points[n].push(l);let c=new qi(e,s.midPoint,!0);this._mids[n].push(c),this.selectPolyIndex=[NaN,NaN]}),!this.polygon.isClose(n)){let s=new qi(e,i[i.length-1].end);this._points[n].push(s)}}),this.polygon.manualHighLight=!1,this.selectPolyIndex=[NaN,NaN],this._selectIndex=[NaN,NaN],this._controlPointMove=!1,this._letfSelectIndex=[NaN,NaN],this._mouseLeftSelectIndex=[NaN,NaN],this.polygon.manualHighLight=!0}removeZeroLenLine(e){return this.dragPolygon.removeZeroLenLine(e,this.letfSelectIndex,this.polygon.type)}};var f2=class extends ws{constructor(e,r){super();this.addHistory=!0;this.position=null;this.polygon=e,this.commands=new ve("select Polygon 2D line -"+e.type),this.showAllPoints=Ve.lastItems&&Ve.lastItems.length==1&&Ve.lastItems[0].globalIndex==e.globalIndex,this.controlPointTool=new sU(e,this.showAllPoints),this.moveTool=new Ch([this.polygon])}get selectIndex(){return this.controlPointTool.selectIndex}set selectIndex(e){this.controlPointTool.selectIndex=e}onMouseLeftDown(e){let r=this.controlPointTool.onMouseLeftDown(e);if(x.getInstance().envFlag=="silk-preview"&&this.polygon.type==="FPC Stiffener"){let n=this.polygon.buildBBox().width(),s=this.polygon.buildBBox().height();n=Xe(n,void 0,"mm"),s=Xe(s,void 0,"mm"),A.messageBus.publish("changeFPCSize",`${s}*${n}`);let a=this.polygon.getComponent(),l={id:this.polygon.globalIndex,ayerid:this.polygon.layerId,material:a==null?void 0:a.material,model:a==null?void 0:a.fpcModel,thickness:a==null?void 0:a.thickness};A.messageBus.publish("changeCheckFPCComponent",l)}return this.addHistory=!0,r}onMouseMove(e){if(this.polygon.locked)return!1;Ve.lastItems=[];let r=this.shiftControl(e);if(this.addHistory&&(this.commands.addCommand(Te.dispatch(this.polygon,"modify")),this.addHistory=!1,Te.dispatchCoppers(this.polygon,"delete",this.commands),this.polygon.clearCopper()),!this.controlPointTool.onMouseMove(e)){let n=Ae.translate(r.x,r.y,0);this.polygon.getGroupID()==null&&this.polygon.transform(n),this.controlPointTool.points.forEach(s=>{s.forEach(a=>a.transform(n))}),this.controlPointTool.mids.forEach(s=>{s.forEach(a=>a.transform(n))})}return!0}flushPoint(){this.controlPointTool.flushPoint()}onMouseLeftUp(e){if(this.polygon.isEmpty)return;let r=this.getChildrens(this.polygon);for(let a=0;a<r.length;a++){let l=r[a];if(this.polygon.isClose(a)&&this.polygon.type=="Line"&&this.polygon.layerId==11&&this.controlPointTool.points.length>l.length){let h=l.length-1;isNaN(this.controlPointTool.letfSelectIndex[1])||(this.controlPointTool.letfSelectIndex[1]===0?l[0].start=l[h].end:this.controlPointTool.letfSelectIndex[1]===h+1&&(l[h].end=l[0].start),this.controlPointTool.letfSelectIndex=[a,NaN]),this.polygon.type="Board Outline"}}let i=this.controlPointTool.removeZeroLenLine(this.commands),n=this.polygon.layerId,s=this.polygon.getMathGraphics(n,0);if(this.commands.length>0&&i){let a=No(s),l=[this.polygon];nw(this.polygon),a&&(l=Vm(this.polygon,this.commands)),A.publish("autoFill",""),A.publish("hasModifyPcbItem",this.polygon);let c=new mi;c.addGroup(this.commands),c.checkOutlines(l,new Set),this.commands=new ve("select Polygon 2D line -"+this.polygon.type)}return this.commands.length>0&&!i&&(this.commands=new ve("select Polygon 2D line -"+this.polygon.type)),WC.ready&&!isNaN(this.selectIndex[0])&&!isNaN(this.selectIndex[1])?(this.editNode(this.selectIndex),this.selectIndex=[NaN,NaN],!0):(this.moveTool.onMouseLeftUp(e),this.controlPointTool.onMouseLeftUp(e),this.polygon.fill(),this.removeShiftMoveHelpLine(),di.clearSnapFlag(),A.publish("flushSelectingInfo",""),!0)}onMouseUpMove(e){return this.controlPointTool.onMouseUpMove(e),!1}selectPoint(e,r){for(let i of this.controlPointTool.points)for(let n of i)if(n.inTop(e,r)){this.changleMouseStyle("pointer");return}for(let i of this.controlPointTool.mids)for(let n of i)if(n.inTop(e,r)){this.changleMouseStyle("pointer");return}this.polygon.isInProfile(e,r)?this.changeNativeCursor(5):this.changleMouseStyle("default")}interrupt(){var e;return this.controlPointTool.interrupt(),(e=this.commands)==null||e.undo(),this.removeShiftMoveHelpLine(),this.polygon.fill(),this.moveTool.interrupt(),this.changleMouseStyle("default"),A.publish("updateRtree",""),!0}onDoubleClick(e){if(A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},$()),this.polygon.type!="Line"){let r=e.sceneX,i=e.sceneY;for(let n=0;n<this.controlPointTool.points.length;n++)for(let s=0;s<this.controlPointTool.points[n].length;s++)if(this.controlPointTool.points[n][s].isSelect(r,i))return this.editNode([n,s]),!0}return!1}deleteNode(){isNaN(this.selectIndex[0])||isNaN(this.selectIndex[1])||ls.getInstance().init([this.polygon],"delete Polygon node check lock",(e,r)=>{let i=r.getCommand();this.polygon.removeFill();let s=this.getChildrens(this.polygon)[this.selectIndex[0]],a=!1;if(this.polygon.type=="Line")if(this.polygon.isClose())if(s.length==3){let c=!1;s.forEach(h=>{h instanceof vt&&(c=!0)}),c||(this.removePolygon(i,this.selectIndex[0]),a=!0)}else s.length==2&&(this.removePolygon(i,this.selectIndex[0]),a=!0);else s.length==1?(this.removePolygon(i,this.selectIndex[0]),a=!0):(this.selectIndex[1]==s.length&&(this.selectIndex[1]=this.selectIndex[1]-1),this.selectIndex[1]==0&&(this.selectIndex[1]=1));else if(s.length==3){let l=!1;s.forEach(c=>{c instanceof vt&&(l=!0)}),l||(this.removePolygon(i,this.selectIndex[0]),a=!0)}else s.length==2&&(this.removePolygon(i,this.selectIndex[0]),a=!0);this.polygon.isEmpty?(A.publish("clearSelect",""),A.publish("delete",this.polygon)):(a||(i.addCommand(Te.dispatch(this.polygon,"modify")),this.polygon.deletePoint(this.selectIndex)),nw(this.polygon),this.selectIndex=[NaN,NaN],this.polygon.fill(),A.publish("flushSelectingInfo","")),A.publish("updateRtree",""),A.publish("tool","dropdrag"),r.addGroup(i),r.checkOutlines([this.polygon],new Set),r.execute()})}editNode(e){let[r]=e,{shapes:i,last:n,start:s,curr:a,nextshapes:l}=this.controlPointTool.editNode(e);A.publish("redrawPolygon",{shapes:i,last:n,start:s,curr:a,profile:this.polygon,nextshapes:l,index:r}),this.interrupt()}onMouseRightUp(e){if(e.openMenu){let r=aU(this.polygon);for(let i=0,n=this.controlPointTool.points.length;i<n;i++)for(let s=0,a=this.controlPointTool.points[i].length;s<a;s++){let l=this.controlPointTool.points[i][s];if(l.isSelect(e.realSceneX,e.realSceneY))return r==3&&(s==0||s==a-1)||(this.selectIndex=[i,s]),this.rightClickMenuData(e),this.position=l.getPosition(),!0}}return!1}rightClickMenuData(e){let r=this.getIsEndpoint(),i={state:"show",left:e.mouseX,top:e.mouseY,filter:Mue(!0,r,this.selectIndex[1]).result};Qt.getInstance().menuData(i,this)}getIsEndpoint(){if(!isNaN(this.selectIndex[0])&&!isNaN(this.selectIndex[1])&&this.polygon.type=="Line"){let e=this.getChildrens(this.polygon),r=this.polygon.isClose();for(let i=0;i<e.length;i++)if(!r&&(this.selectIndex[1]==0||this.selectIndex[1]==this.controlPointTool.mids[i].length))return!0}return!1}parse(e){switch(e.cmdKey.split(":")[0]){case"INSERT_NODE":{this.controlPointTool.insertNode();break}case"CANCEL":{this.controlPointTool.cancel();break}case"EDIT_NODE":!isNaN(this.selectIndex[0])&&!isNaN(this.selectIndex[1])&&(this.editNode(this.selectIndex),this.selectIndex=[NaN,NaN]);break;case"MOVE_NODE":{let n=this.getChildrens(this.polygon);for(let s of n){let a=s.filter(l=>!l.isSelect(this.position.x,this.position.y));if(a.length>0){this.setAdsorptionDrawingLine(a);break}}A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.polygon],inputInfo:this.position,commands:this.commands});break}case"DELETE_NODE":this.deleteNode();break;case"EDIT_BOUNDARY":A.publish("toggle",{command:"editOutline",item:this.polygon});break}A.publish("updateFrame","")}removePolygon(e,r){if(this.polygon.outMostChildrenIndex()==r){e.addCommand(Te.dispatch(this.polygon,"delete")),this.polygon.remove();return}e.addCommand(Te.dispatch(this.polygon,"modify")),this.polygon.getChildrens().splice(r,1)[0].forEach(s=>{s.remove(),A.publish("delete",s)}),this.polygon.setChildrens([])}rotate(e=ce.pcbConfig.rotate){if(!this.controlPointTool.controlPointMove){let r=this.polygon.getParent();if(r!=null&&r.getGroupID()!=null)this.commands=new ve("select Polygon 2D line -"+this.polygon.type),this.moveTool.rotate(e);else{this.addHistory&&(this.commands=new ve("select Polygon 2D line -"+this.polygon.type),this.commands.addCommand(Te.dispatch(this.polygon,"modify")),this.addHistory=!1);let i=_s([this.polygon]);if(i.valid()){let s=i.build1().center();ao.rotate(s,e,[this.polygon]),this.flushPoint()}}}}removeZeroLenLine(){let[e,r]=this.controlPointTool.mouseLeftSelectIndex;if(isNaN(e)||isNaN(r))return!1;let i,n,s,a;return r&&(i=this.controlPointTool.points[e][r-1]),r+1<=this.controlPointTool.points[e].length-1&&(n=this.controlPointTool.points[e][r+1]),i&&(s=this.controlPointTool.points[e][r].getDistance(i.x,i.y)),n&&(a=this.controlPointTool.points[e][r].getDistance(n.x,n.y)),a===0&&this.polygon.removeChild([e,r]),s===0&&this.polygon.removeChild([e,r-1]),!0}setAdsorptionDrawingLine(e){let r=new Array;for(let i of e){let n=i.width;if(i instanceof mt){let s=new M(i.start,i.end);r.push({primitive:s,width:n})}else{let[s,a,l,c,h]=[i.center,i.startAngle/Math.PI*180,i.endAngle/Math.PI*180,i.radius,i.sweep],u=q.build2(s,a,l,c,c,h);r.push({primitive:u,width:n})}}di.drawingLines=r}getChildrens(e){return this.showAllPoints?e.getChildrens():e.filterOutMostChildren().slice(0,1)}isControlPoint(){return this.controlPointTool.points.some(e=>e.some(r=>r.status()))}};var yN=class extends ws{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.position=null;this.arc=e,this.command=new ve("select 2dLine - arc");let r=this.arc.layerId;this.start=new qi(r,this.arc.start),this.mid=new qi(r,this.arc.midPoint,!0),this.end=new qi(r,this.arc.end),this.center=new qi(r,this.arc.center),this.moveTool=new Ch([this.arc])}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;return this.controlPointMove=!1,this.start.isSelect(r,i)&&(this.controlPointMove=!0),this.mid.isSelect(r,i)&&(this.controlPointMove=!0),this.end.isSelect(r,i)&&(this.controlPointMove=!0),this.center.isSelect(r,i)&&(this.controlPointMove=!0),this.mouseLeftDown=!0,this.addHistory=!0,this.controlPointMove}onMouseMove(e){if(this.arc.getParent().locked)return!1;let r=this.shiftControl(e),i=this.lastPosition;if(this.addHistory&&(this.command.addCommand(Te.dispatch(this.arc.getParent(),"modify")),this.addHistory=!1),this.start.status()){if(this.changleMouseStyle("pointer"),this.arc.arcType==1)this.start.setPosition(i),this.arc.start=i,this.mid.setPosition(this.arc.midPoint),this.center.setPosition(this.arc.center);else{let a=i.angle(this.arc.center);this.arc.startAngle=a,this.start.setPosition(this.arc.start),this.mid.setPosition(this.arc.midPoint)}return!0}if(this.mid.status()){if(this.changleMouseStyle("pointer"),Math.abs(this.arc.start.sub(i).cross(this.arc.end.sub(i)))>1e-8){let a=new ro,{center:l,radius:c,startAngle:h,endAngle:u,sweep:d}=a.point2Angle(this.arc.start,this.arc.end,i);this.arc.center=l,this.arc.radius=c,this.arc.startAngle=h,this.arc.endAngle=u,this.arc.sweep=d,this.mid.setPosition(this.arc.midPoint),this.center.setPosition(this.arc.center)}return!0}if(this.end.status()){if(this.changleMouseStyle("pointer"),this.arc.arcType==1)this.end.setPosition(i),this.arc.end=i,this.mid.setPosition(this.arc.midPoint),this.center.setPosition(this.arc.center);else{let a=i.angle(this.arc.center);this.arc.endAngle=a,this.end.setPosition(this.arc.end),this.mid.setPosition(this.arc.midPoint)}return!0}if(this.center.status())return this.changleMouseStyle("pointer"),this.arc.center=i,this.center.setPosition(i),this.start.setPosition(this.arc.start),this.mid.setPosition(this.arc.midPoint),this.end.setPosition(this.arc.end),!0;let n=Ae.translate(r.x,r.y,0),s=this.arc.getParent();return s!=null&&s.getGroupID()!=null?(this.command=new ve("select 2dLine - arc"),this.moveTool.onMouseMove(e)):this.arc.transform(n),this.flushPoint(),!0}flushPoint(){this.start.setPosition(this.arc.start),this.mid.setPosition(this.arc.midPoint),this.end.setPosition(this.arc.end),this.center.setPosition(this.arc.center)}onMouseLeftUp(e){if(this.command.length>0){let r=this.arc.getParent(),i=new mi;i.addGroup(this.command),i.checkOutlines([r],new Set),this.command=new ve("select 2dLine - arc"),A.publish("hasModifyPcbItem",this.arc)}return this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}interrupt(){return this.command.undo(),this.start.remove(),this.mid.remove(),this.end.remove(),this.center.remove(),this.moveTool.interrupt(),this.changleMouseStyle("default"),this.removeShiftMoveHelpLine(),!0}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.selectPoint(r,i),!1}onMouseRightUp(e){return e.openMenu&&(this.start.isSelect(e.sceneX,e.sceneY)||this.end.isSelect(e.sceneX,e.sceneY))?(this.position=e,this.rightClickMenuData(e),!0):!1}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Mue(!0,!0).result};Qt.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"INSERT_NODE":{A.publish("toggle",{command:"insertNode"});break}case"MOVE_NODE":A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.arc],inputInfo:this.position,commands:this.command});break}}selectPoint(e,r){let i=!1;if(this.start.inTop(e,r)&&(i=!0),this.mid.inTop(e,r)&&(i=!0),this.end.inTop(e,r)&&(i=!0),this.center.inTop(e,r)){this.changeNativeCursor(5);return}i?this.changleMouseStyle("pointer"):this.arc.isSelect(e,r)?this.changeNativeCursor(5):this.changleMouseStyle("default")}rotate(e=ce.pcbConfig.rotate){if(!this.controlPointMove){let r=this.arc.getParent();if(r!=null&&r.getGroupID()!=null)this.command=new ve("select 2dLine - arc"),this.moveTool.rotate(e);else{this.addHistory&&(this.command=new ve("select 2dLine - arc"),this.command.addCommand(Te.dispatch(this.arc,"modify")),this.addHistory=!1);let i=_s([this.arc]);if(i.valid()){let s=i.build1().center();ao.rotate(s,e,[this.arc]),this.flushPoint()}}}}};var WC=class o extends ci{constructor(e){super();this.leftDown=!1;if(this.option="OPTIONLEFTUP",e.click(),e instanceof Sr)this.control=new Sw(e),this.profile=e;else if(e instanceof nr)this.control=new Z_(e),this.profile=e;else if(e instanceof mt){let r=e.getParent();this.profile=r,this.control=new f2(r)}else if(e instanceof vt){let r=e.getParent();this.profile=r,r instanceof ct&&(r.onlyOneChilds()!=null?this.control=new yN(e):this.control=new f2(r))}else e instanceof ct&&(this.control=new f2(e),this.profile=e);this.profile.removeFill(),this.drawing=!0,this.msg="Please select a point",o.ready=!0,this.start()}static status(){return this.ready}static exit(){o.ready=!1}onKeyDown(e){if(!this.control.onKeyDown(e)){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);return}A.publish("updateFrame","")}}onMouseLeftDown(e){this.control.onMouseLeftDown(e)&&(this.leftDown=!0)}onMouseMove(e){this.drawing&&jt.update(e,this.msg),this.leftDown&&this.drawing&&this.control.onMouseMove(e)}onMouseLeftUp(e){this.control.onMouseLeftUp(e),this.leftDown=!1,this.profile.removeFill()}interrupt(){this.control.interrupt(),this.profile.fill(),jt.cancel(),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}onMouseRightDown(e){this.control.onMouseRightDown(e)}onMouseRightUp(e){!this.control.onMouseRightUp(e)&&e.openMenu&&super.onMouseRightUp(e)}onDoubleClick(e){this.control.onDoubleClick(e)}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var lU=class extends bg{constructor(e){super(e.type);this.nextShape=new Array;this.profile=e}getResult(e){let r=new Array;if(e.shape.forEach(i=>{let n=this.getModel(e,i);n!=null&&r.push(n),i.remove()}),r=iy(r),this.validChilds(this.profile.type,r)){let i=this.profile;this.profile=pt.addPolygon(this.profile.type,this.profile.layerId,[r],this.profile.strokeWidth,this.profile.net,!1),this.profile.strokeWidth=e._width;let n=new Z3(i);n.extendOldItem(this.profile),e.commands.addCommand(Te.dispatch(i,"delete")),n.extendOldCopperOrder(this.profile),A.publish("delete",i),i.remove(),e.commands.addCommand(Te.dispatch(this.profile,"add"))}else{for(let i of r)i.remove();e.commands.addCommand(Te.dispatch(this.profile,"delete")),this.profile.remove(),A.publish("delete",this.profile),this.profile=null}e.shape.length=0,A.publish("hasModifyPcbItem",this.profile)}getPrimitive(e){if(e instanceof Yi||e instanceof Zo)return e.primitive;if(e instanceof hr)return new M(e.start,e.end);if(e instanceof ns)return q.build2(e.center,e.startAngle,e.endAngle,e.radius,e.radius,e.sweep)}getModel(e,r){let i=this.profile.layerId,n=new io;return r.length>0?n.clone4Shape(this.getPrimitive(r),i,e._width):null}confirmWindow(e,r){this.modify(e,r,!0)}modify(e,r,i){let n=new mi;n.addGroup(e.commands);let s=this.profile?[this.profile]:[];this.profile instanceof ct&&No(this.profile.getMathGraphics())&&(s=Vm(this.profile,e.commands)),s.length&&(ah.realtimeCheckItems(s),n.checkOutlines(s),s.forEach(a=>{a.fill()})),this.profile=null,r.drawing=!1,A.publish("updateRtree",""),A.publish("tool","dropdrag"),A.publish("flushService","")}};var cU=class extends bg{constructor(e){super(e.type);this.nextShape=new Array;this.profile=e}getResult(e){let r=new Array;if(e.shape.forEach(i=>{let n=this.getModel(e,i);n!=null&&r.push(n),i.remove()}),r=iy(r),this.validChilds(this.profile.type,r)){let i=this.profile;this.profile=pt.addPolygon(this.profile.type,this.profile.layerId,[r],this.profile.strokeWidth,this.profile.net,!1);let n=new Z3(i);n.extendOldItem(this.profile),e.commands.addCommand(Te.dispatch(i,"delete")),n.extendOldCopperOrder(this.profile),A.publish("delete",i),i.remove(),e.commands.addCommand(Te.dispatch(this.profile,"add"))}else{for(let i of r)i.remove();e.commands.addCommand(Te.dispatch(this.profile,"delete")),this.profile.remove(),A.publish("delete",this.profile),this.profile=null}e.shape.length=0,A.publish("hasModifyPcbItem",this.profile)}getModel(e,r){let i=this.profile.layerId,n=new io;return r.length>0?n.clone4Shape(this.getPrimitive(r),i,e._width):null}confirmWindow(e,r){this.modify(e,r,!0)}modify(e,r,i){let n=new mi;n.addGroup(e.commands);let s=this.profile?[this.profile]:[];this.profile instanceof ct&&No(this.profile.getMathGraphics())&&(s=Vm(this.profile,e.commands)),s.length&&(ah.realtimeCheckItems(s),n.checkOutlines(s),s.forEach(a=>{a.fill()})),this.profile=null,r.drawing=!1,A.publish("updateRtree",""),A.publish("tool","dropdrag"),A.publish("flushService","")}};function UXe(o,t){if(o.x===0&&o.y===0||t.x===0&&t.y===0)throw new Error("\u96F6\u5411\u91CF\u4E0D\u80FD\u8BA1\u7B97\u5939\u89D2");let e=(o.x*t.x+o.y*t.y)/(o.length()*t.length());return e>1?e=1:e<-1&&(e=-1),Math.acos(e)}function GXe(o,t){let e;if(o.x===t.x)e=es;else{let r=new S(t.x-o.x,t.y-o.y),i=new S(Math.abs(o.x-t.x),0);e=UXe(r,i)}return t.y<o.y&&(e=Vr-e),e}function O$(o,t,e,r){if(o.equals(t)||t.equals(e))return{canAddFillet:!1};let i=1,n=!0,s=o.sub(t),a=e.sub(t),l=UXe(s,a)/2;if(Math.abs(l-es)<.001)return{canAddFillet:!1};let c=r/Math.sin(l>es?Math.PI-l:l),h=r/Math.tan(l>es?Math.PI-l:l),u=h/s.length();if(ne.greater(u,i))return{canAddFillet:!1};let d=new S(s.x*u,s.y*u),p=new S(d.x+t.x,d.y+t.y);if(u=h/a.length(),ne.greater(u,i))return{canAddFillet:!1};let m=new S(a.x*u,a.y*u),g=new S(m.x+t.x,m.y+t.y);u=s.length()/a.length(),a=new S(a.x*u,a.y*u);let y=new S(a.x+t.x,a.y+t.y),b=(o.x+y.x)/2,P=(o.y+y.y)/2,T=new S(b-t.x,P-t.y);if(T.length()===0)throw new Error("v3\u662F\u96F6\u5411\u91CF");u=c/T.length();let I=new S(T.x*u,T.y*u),C=I.x+t.x,E=I.y+t.y,O=new S(C,E),_=GXe(O,p),R=GXe(O,g),v;return _>R&&_-R<Math.PI||_<R&&R-_>Math.PI?v=le.CW:v=le.CCW,{radius:r,circleCenter:O,tangencyPoint1:p,tangencyPoint2:g,startAngle:_,endAngle:R,sweep:v,canAddFillet:n}}var tO=class extends ko{constructor(e,r,i,n){super();this._abortLast=!0;this.isDrawingInflection=!1;this.dialogHandler=null;this.event=e,this.param=r,this.resultEvent=i,this.drawing=!0,this.lineType=n}get abortLast(){return this._abortLast}set abortLast(e){this._abortLast=e}get shape(){return this.event.shape}setDialogHandler(e){this.dialogHandler=e}onKeyDown(e){switch(sr.getAction(4,e)){case"Finish":this._abortLast=!1,this.completed(!1);break;case"Cancel":this.event.shape&&this.event.shape.length?(this.abortLast=!0,this.completed(!1)):this.cancel();break;case"Backspace":this.backspace();break;case"Filp Path While Drawing":this.flipPath();break}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(this.event.curr=r,this.event.drawMode==0){if(this.event.start==null){if(!Bt.checkIsCanEditByPoint(new S(e.sceneX,e.sceneY)))return;this.event.start=r}else if(this.event.last!=null&&this.event.last.distance1(r)>1e-8){if(!Bt.checkIsCanEditByPoint(new S(e.sceneX,e.sceneY))){let i="Cannot be added beyond drawing range";Bt.showMassageTip(i,i);return}if(this.isDrawingInflection=!0,e.ctrlKey){this._abortLast=!1,this.completed(!1);return}this.asMouseLeftUp(r)}}else this.netSelect(e)}asMouseLeftUp(e){this.draw(this.event.last,e,tr.getInstance().type),this.asClose(e),this.isSelectStart(e)?(this.abortLast=!1,this.completed(!0)):(this.drawLineCoincideAutoDeal(),this.addShape(e))}onMouseMove(e,r=!1){if(this.event.drawMode==0){let i=tr.getInstance().type,n=new S(e.sceneX,e.sceneY);if(this.event.curr=n,this.isDrawingInflection){let s=this.event.shape[this.event.shape.length-1];s&&s.end.distance1(n)>this.event._width&&(this.isDrawingInflection=!1)}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),!this.isDrawingInflection&&this.event.setAdsorptionDrawingLine(),this.draw(this.event.last,n,i),this.asClose(n)),di.snapToSnapFlag(e,void 0,r)}this.event.drawMode==1?jt.update(e,"Please select a network"):jt.cancel()}clearEvent(){let e=this.event.shape;this.event.closeLine!=null&&!e.includes(this.event.closeLine)&&(this.event.closeLine.remove(),this.event.closeLine instanceof Yi&&A.publish("delete",this.event.closeLine)),this.event.closeLine=null,this.event.start=null,this.event.last=null,this.event.curr=null,this.event.lastDirect=new S(1,0),this.event.completing=!1,this.event.clearAdsorptionDrawingLine(),this.event.clearDrawHistory()}interrupt(){this.dialogHandler!=null&&this.dialogHandler.closeOpenDialog(),this.clear(),this.clearEvent(),this.event.shape.forEach(e=>{e.remove()}),this.event.shape.length=0,WC.exit()}cancel(){this.event.drawMode==0?(this.interrupt(),A.publish("tool","dropdrag")):(this.event.drawMode=0,this.confirmResult())}flipPath(){}isSelectStart(e){return this.event.shape.length>0&&this.confirmStart().distance1(e)<=this.event._width/2}getPt(e){if(e instanceof Yi||e instanceof Zo)return e.primitive;if(e instanceof hr)return new M(e.start,e.end);if(e instanceof ns)return q.build4(e.start,e.end,e.center,e.radius,e.radius,e.sweep)}getLayer(){if(this.lineType==="Partition")return 1004;if(this.resultEvent instanceof bg)return sg(this.resultEvent.type,be.getActiveLayerID(),2);if(this.resultEvent instanceof x9){let e=be.getActiveLayerID();return e!=1&&e!=2&&e!=12&&(e=1),e}else return this.resultEvent instanceof Iw||this.resultEvent instanceof Cw?1002:be.getActiveLayerID()}getLayerId(){if(this.resultEvent instanceof bg)return sg(this.resultEvent.type,be.getActiveLayerID(),2);if(this.resultEvent instanceof x9){let e=be.getActiveLayerID();return e!=1&&e!=2&&e!=12&&(e=1),e}else return this.resultEvent instanceof Iw||this.resultEvent instanceof Cw?1002:be.getActiveLayerID()}getColor(){var e;return this.resultEvent&&this.resultEvent.type==="Partition"?Ys.getInstance().getRegionLineStyle2("Partition").lineColor:this.event.drawScene=="Segment"?this.event.isEditOutLine?ee.of3("#00FFFF"):Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((e=this.event.shape[0])==null?void 0:e.color)||ee.BLACK).lineColor:this.resultEvent instanceof lU||this.resultEvent instanceof p2||this.resultEvent instanceof cU?this.resultEvent.profile.color:this.resultEvent instanceof Iw||this.resultEvent instanceof Cw?ee.WHITE:ee.BLACK}confirmResult(){this.resultEvent.getResult(this.event),this.resultEvent.confirmWindow(this.event,this)}modify(e){this.resultEvent.modify(this.event,this,e)}toggleMode(e,r){this.event.drawMode=e;let{pcbBridgingCopperIndex:i}=r;i&&(this.event.pcbBridgingCopperIndex=i)}netSelect(e){let r=e.sceneX,i=e.sceneY;if(this.resultEvent instanceof bg){if(this.resultEvent.profile!=null&&this.event.drawMode==1){let n=Wr.selectNet(r,i);if(n!==null){this.nextTool;let s=this.getNearNetPcbItems(n,r,i);this.handleNets(e,s)}}}else if(this.resultEvent instanceof x9&&this.resultEvent.pad!=null&&this.event.drawMode==1){let n=Wr.selectNet(r,i);if(n!==null){let s=this.getNearNetPcbItems(n,r,i);this.handleNets(e,s)}for(let s of n)if(s.isSelect(r,i)&&s.net!=null){this.resultEvent.pad.net=s.net,this.event.drawMode=0,this.resultEvent.confirmWindow(this.event,this);break}}}handleChangePolygonNet(e){this.resultEvent instanceof bg?(this.resultEvent.profile.net=e,DD(this.resultEvent.profile,e,this.event.pcbBridgingCopperIndex)):this.resultEvent instanceof x9&&(this.resultEvent.pad.net=e),this.event.drawMode=0,this.resultEvent.confirmWindow(this.event,this)}getNearNetPcbItems(e,r,i){let n=new Set,s=new Set,a=new Set;return e.forEach(l=>{if(l instanceof Ye&&l.type=="Fill Region"){let h=l.getComponent();if(h instanceof ln&&h.isBridgingCopper)return}let c=l.net;if(l instanceof Ye&&l.type=="Copper Region"){let h=!1;if(l.iteratorCopper(u=>{h||u.inCopper(r,i)&&u.isVisible&&(h=!0)}),!h)return}c&&(a.add(l),s.add(c))}),n.add({group:a,nets:s}),n}handleNets(e,r){let i=new Set;r.forEach(n=>{i=n.nets}),i.size&&(i.size===1?i.forEach(n=>{this.handleChangePolygonNet(n)}):(jt.cancel(),this.showNetsMenu(e,i)))}showNetsMenu(e,r){let i={};i.state="show",i.left=e.mouseX,i.top=e.mouseY,i.filter=this.getNetsMenuData(r).result,Qt.getInstance().menuData(i,this),this.drawing=!1}getNetsMenuData(e){let r=new Jt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"INHERIT_NET":this.handleChangePolygonNet(i[1]);break}A.publish("updateFrame","")}toggleLayer(e){if(e==null)return;let r=this.getLayer();this.event.shape.forEach(i=>{i.layerId=r}),this.toggleCurrentShape(r)}confirmStart(){return this.resultEvent instanceof p2&&this.resultEvent.nextShape.length>0?this.resultEvent.nextShape[0].start:this.event.shape.length?this.event.shape[0].start:null}canFillet(){return this.event.drawScene==="Split Line"?!1:ce.pcbConfig.autoChamfer2DLine!="off"&&["Line","Copper Region","Fill Region","Slot Region","Prohibited Region","Constraint Region","Board Outline"].includes(this.lineType)}getArcKeyPoint2(e,r,i,n){return this.canFillet()?O$(e,r,i,n):{canAddFillet:!1}}};var Eh=class extends tO{constructor(){super(...arguments);this.tool=new no;this.lineArcs=new Array;this.autoAddedLines=new Array}flipPath(){if(this.event.drawMode==0){let e=tr.getInstance().type;if(this.lineArcs.length){let r=this.lineArcs[0].start,i=this.lineArcs.at(-1).end,n;switch(e){case"WIRING_CORNER_LINE45":{n=this.tool.degree45(this.event.lastDirect,r,i);break}case"WIRING_CORNER_LINE90":{n=this.tool.degree90(this.event.lastDirect,r,i);break}}let s=n[2].sub(n[1]).normalize();(s.x!=0||s.y!=0)&&(this.event.lastDirect=s),this.draw(r,i,e)}}}check(e=!1){let{shape:r,needClose:i,closeLine:n}=this.event,s=[...r,...this.lineArcs].filter(a=>a.getViewState()!="Not Shown").map(a=>this.getPt(a));if(this.resultEvent instanceof p2){let a=this.resultEvent.nextShape,l=[];if(a.forEach(c=>l.push(this.getPt(c))),e&&i&&n){let c=this.getPt(n);return s.push(c,...l),!s.length||!No(fe.build2(s))}else return!tR([s,l])}else return e&&i&&n&&s.push(this.getPt(n)),!s.length||!No(fe.build2(s))}drawLineCoincideAutoDeal(e=!1){if(this.lineArcs=this.lineArcs.filter(c=>c.getViewState()!="Not Shown"),!this.lineArcs.length)return!0;let r=this.event.shape,i=r.map(c=>this.getPt(c)),n=this.lineArcs.map(c=>this.getPt(c)),{coincideLines:s,coincidePoint:a,drawCoincideLines:l}=o8(i,n);if(s.length){let c=s.pop(),h=r[c],u=new Set(s);c==0?this.lineArcs[0].start.equals(h.end)?h.end=a:(h.start=a,this.event.start=a,this.event.closeLine!=null&&(this.event.closeLine.end=a)):h.end=a;for(let g=0;g<l.length;g++)g==l.length-1?this.lineArcs[g].start=a:this.lineArcs[g].start=this.lineArcs[g].end;let d=this.getLayerId(),p=this.event.drawScene;!td.canCut()||!(d==3||d!==4)||p!=="Line"?r.push(...this.lineArcs):r.push(...this.autoTrimSilkscreen()),this.event.shape=r.filter((g,y)=>g instanceof Yi&&(u.has(y)||g.length<1e-8)?(g.remove(),!1):!0),td.canCut()&&(d==3||d==4)&&this.event.rebuildCutSilkLines(),this.event.drawHistoryRecord(),this.lineArcs.length=0,this.autoAddedLines.length=0;let m=this.event.shape.length;this.event.last=m?this.event.shape[m-1].end:this.event.curr}}autoTrimSilkscreen(){let e=this.getLayer(),r=this.getLayerId(),i=this.getColor();return td.cut(e,r,i,this)}addShape(e,r){let i=r||this.getColor(),n=this.canFillet();if(n&&(this.lineArcs=this.lineArcs.filter(s=>s.getViewState()=="Not Shown"?(s.remove(),!1):!0)),this.lineArcs.length){n&&(this.event.shape=this.event.shape.filter(c=>c.getViewState()!="Not Shown"));let s=[],a=this.getLayerId(),l=this.event.drawScene;if(td.canCut()&&(a==3||a==4)&&l==="Line"){let c=this.getLayer();s=td.cut(c,a,i,this),s.length>0&&(this.event.shape.push(...s),this.event.drawHistoryRecord())}else for(let c=0;c<this.lineArcs.length;c++){let h=this.lineArcs[c],u=this.lineArcs[c+1];if(h.length>1e-8){if(this.event.shape.push(h),this.event.isEditOutLine&&(h instanceof hr||h instanceof ns)&&(h.isSolid=!0),h.color=i,this.autoAddedLines.includes(h)&&(u instanceof Yi||u instanceof hr))continue;this.event.drawHistoryRecord()}else h.remove()}this.lineArcs.length=0,this.autoAddedLines.length=0,this.event.last=null,this.event.start=e,this.event.shape.forEach(c=>{c.color=i})}}draw(e,r,i,n=!1){if(!(e==null||r==null))switch(i){case"WIRING_CORNER_LINE45":{let s=this.tool.degree45(this.event.lastDirect,e,r);this.modifyLine(s,n);break}case"WIRING_CORNER_LINE90":{let s=this.tool.degree90(this.event.lastDirect,e,r);this.modifyLine(s,n);break}}}asClose(e){var r,i;if(this.event.needClose){let n=this.isSegmentLine(),{lineColor:s,lineSolid:a}=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((r=this.event.shape[0])==null?void 0:r.color)||ee.BLACK);if(this.event.closeLine==null){let l=this.getLayer();this.event.closeLine=this.createSceneLine(l,e,this.event.start,s,a)}else this.event.closeLine.start=e;this.event.closeLine&&(this.event.closeLine.color=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((i=this.event.shape[0])==null?void 0:i.color)||ee.BLACK).lineColor)}}clear(){let e=this.event.shape;this.lineArcs.forEach(r=>{e.includes(r)||r.remove()}),this.lineArcs.length=0,this.autoAddedLines.length=0}completed(e,r){let i=this.getColor();if(this.event.drawMode==0){if(!this.abortLast&&(this.drawLineCoincideAutoDeal(),this.lineArcs.length)){this.event.shape.push(...this.lineArcs);let n=this.getLayer(),s=this.event.drawScene;td.canCut()&&(n==3||n==4)&&s==="Line"&&(this.autoTrimSilkscreen(),this.event.shape=this.event.shape.filter(a=>!a.isEmpty),this.event.shape.push(...this.lineArcs))}if(this.event.needClose||e){let n=this.event.shape,s=n.length,a=s?n[s-1].end:this.event.last;if(e&&(this.event.start=this.confirmStart()||a,this.asClose(a)),this.event.needClose&&this.event.closeLine){if(this.abortLast){let l=this.event.closeLine.end;this.draw(a,l,tr.getInstance().type,!0),this.check()||this.flipPath(),this.addShape(l,r)}else if(n.length>0){let l=n[0].color;this.event.closeLine.color=l,this.event.shape.push(this.event.closeLine)}}}this.confirmResult(),this.clear(),this.clearEvent(),this.drawCompleteModify(),this.event.shape.forEach(n=>{n.color=i})}}backspace(){this.event.drawMode==0&&(this.event.historyBack(this.getLayer()),this.draw(this.event.last,this.event.curr,tr.getInstance().type))}drawCompleteModify(){pt.getAllItem().forEach(e=>{e.type==="Partition"&&(e.color=Ys.getInstance().getRegionLineStyle2("Partition").lineColor)})}isSegmentLine(){return this.event.drawScene==="Segment"}createLineAndPush(e,r,i,n,s=!1,a=this.event._width,l=2,c=3){if(r.equals(i))return;let h=this.createSceneLine(e,r,i,n,s,a,l,c);this.lineArcs.push(h)}createSceneLine(e,r,i,n,s=!1,a=this.event._width,l=2,c=3){let h=this.isSegmentLine(),u;return h?u=new hr(e,r,i,s,n,l,c):u=Yi.build(e,r,i,a,n),u}createSceneArc(e,r,i,n,s,a,l,c=this.event._width){let h=this.isSegmentLine(),u;return h?u=ns.build(e,r,i,n,s,a,l):u=Zo.build(e,r,i,c,n,s,a),u}modifyLine(e,r){var u;let i=this.event.shape.at(-1);this.lineArcs.forEach(d=>d.remove()),this.lineArcs.length=0,this.autoAddedLines.length=0;let n=this.getLayer(),{lineColor:s,lineSolid:a}=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((u=this.event.shape[0])==null?void 0:u.color)||ee.BLACK),l,c;if(this.event.isEditOutLine&&(n=1002,s=ee.of3("#F0F0F0"),a=!1,l=13,c=28),!this.canFillet()||!(i&&(i instanceof Yi||i instanceof hr))){let d=this.createSceneLine(n,e[0],e[1],s,a,this.event._width,l,c);d.color=s,this.lineArcs.push(d);let p=this.lineArcs.at(-1),{radius:m,circleCenter:g,tangencyPoint1:y,tangencyPoint2:b,startAngle:P,endAngle:T,sweep:I,canAddFillet:C}=this.getArcKeyPoint2(e[0],e[1],r?this.event.closeLine.end:e[2],ce.pcbConfig.filletRadius2DLine);if(C){if(p.hidden(),this.createLineAndPush(n,p.start,y,s,a,this.event._width,l,c),ce.pcbConfig.autoChamfer2DLine=="fillet"){let E=this.createSceneArc(n,g,m,P,T,I,s);this.lineArcs.push(E),this.autoAddedLines.push(E)}else{let E=this.createSceneLine(n,y,b,s,a,this.event._width,l,c);this.lineArcs.push(E),this.autoAddedLines.push(E)}this.createLineAndPush(n,b,e[2],s,a,this.event._width,l,c)}else p.visible(),this.createLineAndPush(n,e[1],e[2],s,a,this.event._width,l,c)}else{let{radius:d,circleCenter:p,tangencyPoint1:m,tangencyPoint2:g,startAngle:y,endAngle:b,sweep:P,canAddFillet:T}=this.getArcKeyPoint2(i.start,i.end,e[1],ce.pcbConfig.filletRadius2DLine);if(T){if(i.hidden(),this.createLineAndPush(n,i.start,m,s,a,this.event._width,l,c),ce.pcbConfig.autoChamfer2DLine=="fillet"){let F=this.createSceneArc(n,p,d,y,b,P,s);this.lineArcs.push(F),this.autoAddedLines.push(F)}else{let F=this.createSceneLine(n,m,g,s,a,this.event._width,l,c);this.lineArcs.push(F),this.autoAddedLines.push(F)}this.createLineAndPush(n,g,e[1],s,a,this.event._width,l,c)}else i.visible(),this.createLineAndPush(n,e[0],e[1],s,a,this.event._width,l,c);let I=this.lineArcs.at(-1),{radius:C,circleCenter:E,tangencyPoint1:O,tangencyPoint2:_,startAngle:R,endAngle:v,sweep:D,canAddFillet:w}=this.getArcKeyPoint2(I.start,I.end,e[2],ce.pcbConfig.filletRadius2DLine);if(w){if(I.hidden(),this.createLineAndPush(n,I.start,O,s,a,this.event._width,l,c),ce.pcbConfig.autoChamfer2DLine=="fillet"){let F=this.createSceneArc(n,E,C,R,v,D,s);this.lineArcs.push(F),this.autoAddedLines.push(F)}else{let F=this.createSceneLine(n,O,_,s,a,this.event._width,l,c);this.lineArcs.push(F),this.autoAddedLines.push(F)}this.createLineAndPush(n,_,e[2],s,a,this.event._width,l,c)}else I.visible(),this.createLineAndPush(n,e[1],e[2],s,a,this.event._width,l,c);if(r){let F=this.event.shape[0],H=this.lineArcs.at(-1);if((H instanceof Yi||H instanceof hr)&&(F instanceof Yi||F instanceof hr)){let{radius:z,circleCenter:G,tangencyPoint1:W,tangencyPoint2:L,startAngle:B,endAngle:N,sweep:U,canAddFillet:k}=this.getArcKeyPoint2(H.start,F.start,F.end,ce.pcbConfig.filletRadius2DLine);if(k){if(H.end=W,ce.pcbConfig.autoChamfer2DLine=="fillet"){let V=this.createSceneArc(n,G,z,B,N,U,s);this.lineArcs.push(V),this.autoAddedLines.push(V)}else{let V=this.createSceneLine(n,W,L,s,a,this.event._width,l,c);this.lineArcs.push(V),this.autoAddedLines.push(V)}F.start=L}else F.start=H.end}}}let h=this.lineArcs[0].end.sub(this.lineArcs[0].start).normalize();(h.x!=0||h.y!=0)&&(this.event.lastDirect=h)}wireWidth(e){this.lineArcs.length&&this.lineArcs.forEach(r=>r.width=e),this.event.closeLine!=null&&(this.event.closeLine.width=e),this.event.shape.forEach(r=>{r.width=e}),this.event._width=e,rt.defaultOutlineWidth=e}toggleCurrentShape(e){this.lineArcs.length&&this.lineArcs.forEach(r=>r.layerId=e),this.event.closeLine&&(this.event.closeLine.layerId=e)}getLine(){return this.lineArcs[0]}updateAssisLineColor(e){e&&this.lineArcs.length&&this.lineArcs.forEach(r=>r.color=e)}getPreviewOutline(){return[...this.lineArcs]}};var hl=class extends tO{constructor(){super(...arguments);this.adjustAngle=!1;this.arc=null;this.helpLine=null}getArc(){return this.arc}check(e=!1){let{shape:r,needClose:i,closeLine:n}=this.event,s=r.map(a=>this.getPt(a));if(this.arc&&s.push(this.getPt(this.arc)),this.resultEvent instanceof p2){let a=this.resultEvent.nextShape,l=[];if(a.forEach(c=>l.push(this.getPt(c))),e&&i&&n){let c=this.getPt(n);return s.push(c,...l),!s.length||!No(fe.build2(s))}else return!tR([s,l])}else return e&&i&&n&&s.push(this.getPt(n)),!s.length||!No(fe.build2(s))}drawLineCoincideAutoDeal(e=!1){return!1}addShape(e){var n;let{lineColor:r,lineSolid:i}=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((n=this.event.shape[0])==null?void 0:n.color)||ee.BLACK);if(this.event.isEditOutLine&&(r=ee.of3("#00FFFF")),!this.adjustAngle)this.helpLine!=null&&(this.helpLine.end=e,this.helpLine.color=r,this.adjustAngle=!0);else{let s=this.getLayerId(),a=this.arc;a||(a=this.createSceneLine(s,this.helpLine.start,this.helpLine.end,r,i),this.helpLine.remove(),this.helpLine=null),this.event.shape.push(a),this.event.drawHistoryRecord(),td.canCut()&&(s==3||s==4)&&(this.event.cutSilkLines.length==0?this.event.cutSilkLines.push([a]):this.event.cutSilkLines[this.event.cutSilkLines.length-1].push(a)),a.color=r,this.event.last=null,this.event.start=a.end,this.arc=null,this.adjustAngle=!1,this.event.completing&&this.completed(!1)}this.event.shape.forEach(s=>{s.color=r})}draw(e,r,i){var a;if(e==null||r==null)return;let{lineColor:n,lineSolid:s}=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((a=this.event.shape[0])==null?void 0:a.color)||ee.BLACK);if(this.event.isEditOutLine&&(n=ee.of3("#F0F0F0"),s=!1),this.adjustAngle){let l=new ro;if(this.helpLine!=null){if(Math.abs(this.helpLine.start.sub(r).cross(this.helpLine.end.sub(r)))>1e-8){let{center:c,radius:h,startAngle:u,endAngle:d,sweep:p}=l.point2Angle(this.helpLine.start,this.helpLine.end,r);if(this.arc==null){let m=this.getLayer();this.event.isEditOutLine&&(m=1002),this.arc=this.createSceneArc(m,c,h,u,d,p,n,s)}this.helpLine.remove(),this.helpLine=null}}else if(this.arc!=null&&Math.abs(this.arc.start.sub(r).cross(this.arc.end.sub(r)))>1e-8){let{center:c,radius:h,startAngle:u,endAngle:d,sweep:p}=l.point2Angle(this.arc.start,this.arc.end,r);this.arc.center=c,this.arc.radius=h,this.arc.startAngle=u,this.arc.endAngle=d,this.arc.sweep=p}}else if(this.helpLine==null){let l=this.getLayer();this.event.isEditOutLine&&(l=1002),this.helpLine=this.createSceneLine(l,e,r,n,s)}else this.helpLine.end=r}isSelectStart(e){return this.adjustAngle?!1:super.isSelectStart(e)}createSceneLine(e,r,i,n,s=!1,a=this.event._width){let l=this.isSegmentLine(),c;return l?c=new hr(e,r,i,s,n):c=Yi.build(e,r,i,a,n),c}createSceneArc(e,r,i,n,s,a,l,c=!1,h=this.event._width){let u=this.isSegmentLine(),d;return u?d=ns.build(e,r,i,n,s,a,l):d=Zo.build(e,r,i,h,n,s,a,l),d}asClose(e){var r;if(this.event.needClose){let i=this.isSegmentLine(),{lineColor:n,lineSolid:s}=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((r=this.event.shape[0])==null?void 0:r.color)||ee.BLACK);if(this.event.closeLine==null){let a=this.getLayer();this.event.closeLine=this.createSceneLine(a,e,this.event.start,n,s),i||(this.event.closeLine.color=ee.WHITE)}else this.adjustAngle||(this.event.closeLine.start=e)}}clear(){let e=this.event.shape;this.arc!=null&&!e.includes(this.arc)&&this.arc.remove(),this.arc=null,this.helpLine!=null&&(this.helpLine.remove(),this.helpLine=null),this.adjustAngle=!1}completed(e){var r,i;if(this.event.completing=e,this.event.drawMode==0){!this.abortLast&&this.arc&&this.event.shape.push(this.arc);let n=this.event.needClose;if(this.event.drawScene==="Line"&&(this.event.needClose=e),this.event.needClose||e){let s=this.event.shape,a=s.length,l=a?s[a-1].end:this.event.last;if(e&&(this.event.start=this.confirmStart()||l,this.asClose(l)),this.event.needClose&&this.event.closeLine){if(this.abortLast){let{lineColor:c,lineSolid:h}=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((i=this.event.shape[0])==null?void 0:i.color)||ee.BLACK),u=this.event.closeLine.end,d=this.getLayer(),p=this.createSceneLine(d,l,u,c,h);this.event.shape.push(p);let m=this.arc;this.arc=null,this.arc=m;let g=this.getLayerId();td.canCut()&&(g==3||g==4)&&this.event.cutSilkLines[this.event.cutSilkLines.length-1].push(p)}else if(s.length>0&&!s[s.length-1].end.equals1(this.event.start))return(r=this.event.closeLine)==null||r.remove(),this.event.needClose=n,this.addShape(this.event.start)}}this.event.needClose=n,this.confirmResult(),this.clear(),this.clearEvent(),this.drawCompleteModify()}}backspace(){this.event.drawMode==0&&(this.helpLine!=null&&(this.helpLine.remove(),this.helpLine=null),this.arc!=null&&(this.arc.remove(),this.arc=null),this.adjustAngle=!1,this.event.historyBack(this.getLayer()),this.draw(this.event.last,this.event.curr,tr.getInstance().type))}drawCompleteModify(){pt.getAllItem().forEach(e=>{e.type==="Partition"&&(e.color=Ys.getInstance().getRegionLineStyle2("Partition").lineColor)})}wireWidth(e){this.arc!=null&&(this.arc.width=e),this.event.closeLine!=null&&(this.event.closeLine.width=e),this.helpLine!=null&&(this.helpLine.width=e),this.event.shape.forEach(r=>{r.width=e}),this.event._width=e,rt.defaultOutlineWidth=e}toggleCurrentShape(e){this.helpLine!=null&&(this.helpLine.layerId=e),this.arc!=null&&(this.arc.layerId=e),this.event.closeLine&&(this.event.closeLine.layerId=e)}hasArc(){return!!this.arc}getArcAngle(){let e=new ro,{angle:r}=e.angleToPoint(this.arc.center,this.arc.radius,this.arc.startAngle,this.arc.endAngle,this.arc.sweep);return xe(r/Math.PI*180,3)}getArcStartAngle(){return this.arc.startAngle}getArcEndAngle(){return this.arc.endAngle}getArcRadius(){return this.arc.radius}getArcCenter(){return this.arc.center}getArcSweep(){return this.arc.sweep}getArcEnd(){return this.arc.end}getArcStart(){return this.arc.start}updateAssisLineColor(e){e&&this.arc&&(this.arc.color=e)}getPreviewOutline(){return[this.arc,this.helpLine]}isSegmentLine(){return this.event.drawScene==="Segment"}};var Bl=class extends tO{constructor(){super(...arguments);this.lineArcs=new Array;this.autoAddedLines=new Array}check(e=!1){let{shape:r,needClose:i,closeLine:n}=this.event,s=[...r,...this.lineArcs].map(a=>this.getPt(a));if(this.resultEvent instanceof p2){let a=this.resultEvent.nextShape,l=[];if(a.forEach(c=>l.push(this.getPt(c))),e&&i&&n){let c=this.getPt(n);return s.push(c,...l),!s.length||!No(fe.build2(s))}else return!tR([s,l])}else return e&&i&&n&&s.push(this.getPt(n)),!s.length||!No(fe.build2(s))}drawLineCoincideAutoDeal(e=!1){if(!this.lineArcs.length)return!0;let r=this.event.shape,i=r.filter(h=>h.getViewState()!="Not Shown").map(h=>this.getPt(h)),n=this.lineArcs.map(h=>this.getPt(h)),{coincideLines:s,coincidePoint:a,drawCoincideLines:l}=o8(i,n),c=this.getLayerId();if(s.length){let h=s.pop(),u=r[h],d=new Set(s);h==0?this.lineArcs[0].start.equals(u.end)?u.end=a:(u.start=a,this.event.start=a,this.event.closeLine!=null&&(this.event.closeLine.end=a)):u.end=a;let p=this.event.drawScene;for(let g=0;g<l.length;g++)g==l.length-1?this.lineArcs[g].start=a:this.lineArcs[g].start=this.lineArcs[g].end;!td.canCut()&&(c==3||c==4)||p!=="Line"?r.push(...this.lineArcs):r.push(...this.autoTrimSilkscreen()),this.event.shape=r.filter((g,y)=>g instanceof Yi&&(d.has(y)||g.length<1e-8)?(g.remove(),!1):!0),td.canCut()&&(c==3||c==4)&&this.event.rebuildCutSilkLines(),this.event.drawHistoryRecord(),this.lineArcs.length=0,this.autoAddedLines.length=0;let m=this.event.shape.length;this.event.last=m?this.event.shape[m-1].end:this.event.curr}}autoTrimSilkscreen(){let e=this.getLayer(),r=this.getLayerId(),i=this.getColor();return td.cut(e,r,i,this)}addShape(e,r){let i=r||this.getColor(),n=this.getLayerId();if(this.lineArcs.length){this.event.shape=this.event.shape.filter(l=>l.getViewState()!="Not Shown");let s=[],a=this.event.drawScene;if(td.canCut()&&(n==3||n==4)&&a==="Line"){let l=this.getLayer(),c=this.getLayerId();s=td.cut(l,c,i,this),s.length>0&&(this.event.shape.push(...s),this.event.drawHistoryRecord())}else{this.lineArcs=this.lineArcs.filter(l=>l.length>0);for(let l=0;l<this.lineArcs.length;l++){let c=this.lineArcs[l],h=this.lineArcs[l+1];c.color=i,this.event.isEditOutLine&&(c instanceof hr||c instanceof ns)&&(c.isSolid=!0),this.event.shape.push(c),!(this.autoAddedLines.includes(c)&&(h instanceof Yi||h instanceof hr))&&this.event.drawHistoryRecord()}}this.lineArcs.length=0,this.autoAddedLines.length=0,this.event.last=null,this.event.start=e,this.event.shape.forEach(l=>{l.color=i})}}draw(e,r,i,n=!1){var d;if(e==null||r==null)return;let s,a,l=this.event.shape.at(-1);this.lineArcs.forEach(p=>p.remove()),this.lineArcs.length=0,this.autoAddedLines.length=0;let c=this.getLayer(),{lineColor:h,lineSolid:u}=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((d=this.event.shape[0])==null?void 0:d.color)||ee.BLACK);if(this.event.isEditOutLine&&(c=1002,h=ee.of3("#F0F0F0"),u=!1,s=13,a=28),!this.canFillet()||!(l&&(l instanceof Yi||l instanceof hr)))this.lineArcs.push(this.createSceneLine(c,e,r,h,u,this.event._width,s,a));else{let{radius:p,circleCenter:m,tangencyPoint1:g,tangencyPoint2:y,startAngle:b,endAngle:P,sweep:T,canAddFillet:I}=O$(l.start,l.end,n?this.event.closeLine.end:r,ce.pcbConfig.filletRadius2DLine);if(I){if(l.hidden(),this.lineArcs.push(this.createSceneLine(c,l.start,g,h,u,this.event._width,s,a)),ce.pcbConfig.autoChamfer2DLine=="fillet"){let C=this.createSceneArc(c,m,p,b,P,T,h);this.lineArcs.push(C),this.autoAddedLines.push(C)}else{let C=this.createSceneLine(c,g,y,h,u,this.event._width,s,a);this.lineArcs.push(C),this.autoAddedLines.push(C)}this.lineArcs.push(this.createSceneLine(c,y,r,h,u,this.event._width,s,a))}else l.visible(),this.lineArcs.push(this.createSceneLine(c,e,r,h,u,this.event._width,s,a));if(n){let C=this.event.shape[0],E=this.lineArcs.at(-1);if((E instanceof Yi||E instanceof hr)&&(C instanceof Yi||C instanceof hr)){let{radius:O,circleCenter:_,tangencyPoint1:R,tangencyPoint2:v,startAngle:D,endAngle:w,sweep:F,canAddFillet:H}=O$(E.start,C.start,C.end,ce.pcbConfig.filletRadius2DLine);if(H){if(E.end=R,ce.pcbConfig.autoChamfer2DLine=="fillet"){let z=this.createSceneArc(c,_,O,D,w,F,h);this.lineArcs.push(z),this.autoAddedLines.push(z)}else{let z=this.createSceneLine(c,R,v,h,u,this.event._width,s,a);this.lineArcs.push(z),this.autoAddedLines.push(z)}C.start=v}}}}}createSceneLine(e,r,i,n,s=!1,a=this.event._width,l=2,c=3){let h=this.isSegmentLine(),u;return h?u=new hr(e,r,i,s,n,l,c):u=Yi.build(e,r,i,a,n),u}createSceneArc(e,r,i,n,s,a,l,c=this.event._width){let h=this.isSegmentLine(),u;return h?u=ns.build(e,r,i,n,s,a,l):u=Zo.build(e,r,i,c,n,s,a),u}asClose(e){var r,i;if(this.event.needClose){let n=this.isSegmentLine(),{lineColor:s,lineSolid:a}=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((r=this.event.shape[0])==null?void 0:r.color)||ee.BLACK);if(this.event.last!=null)if(this.event.closeLine==null){let l=this.getLayer();this.event.closeLine=this.createSceneLine(l,e,this.event.start,s,a),n||(this.event.closeLine.color=ee.WHITE)}else this.event.closeLine.start=e;this.event.closeLine&&(this.event.closeLine.color=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((i=this.event.shape[0])==null?void 0:i.color)||ee.BLACK).lineColor)}}clear(){let e=this.event.shape;this.lineArcs.forEach(r=>{e.includes(r)||r.remove()}),this.lineArcs.length=0,this.autoAddedLines.length=0}completed(e,r){if(this.event.drawMode==0){let i=this.getLayerId();if(!this.abortLast&&(this.drawLineCoincideAutoDeal(),this.lineArcs.length)){this.event.shape.push(...this.lineArcs);let n=this.event.drawScene;td.canCut()&&(i==3||i==4)&&n==="Line"&&this.autoTrimSilkscreen()}if(this.event.needClose||e){let n=this.event.shape,s=n.length,a=s?n[s-1].end:this.event.last;if(e&&(this.event.start=this.confirmStart()||a,this.asClose(a)),this.event.needClose&&this.event.closeLine){if(this.abortLast){let l=this.event.closeLine.end;this.draw(a,l,tr.getInstance().type,!0),this.addShape(l,r)}else if(n.length>0){let l=this.event.shape[0].color;this.event.closeLine.color=l,this.event.shape.push(this.event.closeLine)}}}this.confirmResult(),this.clear(),this.clearEvent()}}backspace(){this.event.drawMode==0&&(this.event.historyBack(this.getLayer()),this.draw(this.event.last,this.event.curr,tr.getInstance().type))}wireWidth(e){this.lineArcs.length&&this.lineArcs.forEach(r=>r.width=e),this.event.closeLine!=null&&(this.event.closeLine.width=e),this.event.shape.forEach(r=>{r.width=e}),this.event._width=e,rt.defaultOutlineWidth=e}toggleCurrentShape(e){this.lineArcs.length&&this.lineArcs.forEach(r=>r.layerId=e),this.event.closeLine&&(this.event.closeLine.layerId=e)}updateAssisLineColor(e){e&&this.lineArcs.length&&this.lineArcs.forEach(r=>r.color=e)}getPreviewOutline(){return[...this.lineArcs]}isSegmentLine(){return this.event.drawScene==="Segment"}};var fu=class extends tO{constructor(){super(...arguments);this.tool=new no;this.line=null;this.line1=null}flipPath(){if(this.event.drawMode==0){let e=tr.getInstance().type;if(this.line!=null){let r=this.line.start,i;this.line1!=null?i=this.line1.end:i=this.line.end;let n=i.sub(r),s=Math.abs(n.x),a=Math.abs(n.y);if(ne.eq(s,a)){let h=null;if(this.line instanceof Zo?h=this.line:this.line1 instanceof Zo&&(h=this.line1),h){let u=le.CCW==h.sweep?le.CW:le.CCW,d=this.mirrorPoint(r,i,h.center),p=h.startAngle,m=h.endAngle;h.center=d,h.sweep=u,h.startAngle=m+Math.PI,h.endAngle=p+Math.PI;return}}let l=this.tool.degree45(this.event.lastDirect,r,i),c=l[2].sub(l[1]).normalize();(c.x!=0||c.y!=0)&&(this.event.lastDirect=c),this.tool.arcFirst=!this.tool.arcFirst,this.draw(r,i,e)}}}mirrorPoint(e,r,i){let n=r.x-e.x,s=r.y-e.y,a=Math.sqrt(n*n+s*s);if(a===0)return null;let l=n/a,c=s/a,h=i.x-e.x,u=i.y-e.y,d=h*l+u*c,p=e.x+d*l,m=e.y+d*c,g=2*p-i.x,y=2*m-i.y;return new S(g,y)}getModel(e){if(e instanceof Yi||e instanceof Zo)return e.primitive;if(e instanceof hr)return new M(e.start,e.end);if(e instanceof ns)return q.build2(e.center,e.startAngle,e.endAngle,e.radius,e.radius,e.sweep)}check(e=!1){let{shape:r,needClose:i,closeLine:n}=this.event,s=r.map(a=>this.getModel(a));if((this.line||this.line)&&(this.line&&s.push(this.getPt(this.line)),this.line1&&s.push(this.getPt(this.line1))),this.resultEvent instanceof p2){let a=this.resultEvent.nextShape,l=[];if(a.forEach(c=>l.push(this.getPt(c))),e&&i&&n){let c=this.getPt(n);return s.push(c,...l),!s.length||!No(fe.build2(s))}else return!tR([s,l])}else return e&&i&&n&&s.push(this.getPt(n)),!s.length||!No(fe.build2(s))}drawLineCoincideAutoDeal(e=!1){if(!this.line)return!0;let r=this.event.shape,i=r.map(h=>this.getPt(h)),n=[this.line,this.line1].filter(Boolean).map(h=>this.getPt(h)),{coincideLines:s,coincidePoint:a,drawCoincideLines:l}=o8(i,n);if(s.length){let h=s.pop(),u=r[h],d=new Set(s);h==0?this.line.start.equals(u.end)?u instanceof Yi||u instanceof hr?u.end=a:u.endAngle=c(u):(u instanceof Yi||u instanceof hr?u.start=a:u.startAngle=c(u),this.event.start=a,this.event.closeLine!=null&&(this.event.closeLine.end=a)):u instanceof Yi||u instanceof hr?u.end=a:u.endAngle=c(u),l.length==1?this.line instanceof Yi||this.line instanceof hr?this.line.start=a:this.line.startAngle=c(this.line):l.length==2&&(this.line.remove(),this.line=null,this.line1 instanceof Yi||this.line1 instanceof hr?this.line1.start=a:this.line1.startAngle=c(this.line1)),r.push(this.line,this.line1),this.event.shape=r.filter((g,y)=>g?d.has(y)||g.start.distance1(g.end)<1e-8?(g.remove(),!1):!0:!1);let p=this.getLayerId();td.canCut()&&(p==3||p==4)&&this.event.rebuildCutSilkLines(),this.event.drawHistoryRecord(),this.line=null,this.line1=null;let m=this.event.shape.length;this.event.last=m?this.event.shape[m-1].end:this.event.curr}function c(h){let u=a.sub(h.center),d=Math.atan2(u.y,u.x);return d<0&&(d=Math.PI*2+d),d}}addShape(e,r){let i=r||this.getColor();if(this.line!=null){if(this.line1==null){let l=this.getLayer();this.line1=Yi.build(l,e,e,this.event._width)}let n=l=>{l.length>1e-8&&(this.event.shape.push(l),this.event.drawHistoryRecord(),l.color=i)},s=l=>{l!=null&&(this.event.shape.push(l),this.event.drawHistoryRecord(),l.color=i,this.event.last=null,this.event.start=l.end,l=null,this.event.completing&&this.completed(!1,r))},a=this.getLayerId();td.canCut()&&(a==3||a==4)&&(this.event.cutSilkLines.length==0?this.event.cutSilkLines.push([this.line,this.line1]):this.event.cutSilkLines[this.event.cutSilkLines.length-1].push(this.line,this.line1)),this.line instanceof Yi||this.line instanceof hr?(n(this.line),s(this.line1)):(s(this.line),n(this.line1)),this.line=null,this.line1=null,this.event.last=null,this.event.start=e}}draw(e,r,i){if(!(e==null||r==null))switch(i){case"WIRING_CORNER_ARC90":{let n=this.tool.degree45(this.event.lastDirect,e,r);this.modifyArc90(n);break}case"WIRING_CORNER_ARC45":{let n=this.tool.arc45(this.event.lastDirect,e,r);this.modifyArc45(n);break}}}asClose(e){var r,i;if(this.event.needClose){let n=this.isSegmentLine();if(this.event.closeLine==null){let s=this.getLayer(),{lineColor:a,lineSolid:l}=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((r=this.event.shape[0])==null?void 0:r.color)||ee.BLACK);this.event.closeLine=this.createSceneLine(s,e,this.event.start,a,l),n||(this.event.closeLine.color=ee.WHITE)}else this.event.closeLine.start=e;this.event.closeLine&&(this.event.closeLine.color=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((i=this.event.shape[0])==null?void 0:i.color)||ee.BLACK).lineColor)}}clear(){let e=this.event.shape;this.line!=null&&!e.includes(this.line)&&this.line.remove(),this.line=null,this.line1!=null&&!e.includes(this.line1)&&this.line1.remove(),this.line1=null}completed(e,r){if(this.event.drawMode==0){if(!this.abortLast){this.drawLineCoincideAutoDeal();let i=[this.line,this.line1].filter(n=>n);if(this.line&&i.length){this.event.shape.push(...i);let n=this.getLayerId();td.canCut()&&(n==3||n==4)&&(this.event.cutSilkLines.length==0?this.event.cutSilkLines.push(i):this.event.cutSilkLines[this.event.cutSilkLines.length-1].push(...i))}}if(this.event.needClose||e){let i=this.event.shape,n=i.length,s=n?i[n-1].end:this.event.last;if(e&&(this.event.start=this.confirmStart()||s,this.asClose(s)),this.event.needClose&&this.event.closeLine){if(this.abortLast){let a=this.event.closeLine.end;this.draw(s,a,tr.getInstance().type),this.check()||this.flipPath(),this.addShape(a,r)}else if(i.length>0){let a=this.event.shape[0].color;this.event.closeLine.color=a,this.event.shape.push(this.event.closeLine)}}}this.confirmResult(),this.clear(),this.clearEvent(),this.drawCompleteModify()}}backspace(){this.event.drawMode==0&&(this.event.historyBack(this.getLayer()),this.draw(this.event.last,this.event.curr,tr.getInstance().type))}drawCompleteModify(){pt.getAllItem().forEach(e=>{e.type==="Partition"&&(e.color=Ys.getInstance().getRegionLineStyle2("Partition").lineColor)})}createSceneLine(e,r,i,n,s=!1,a=this.event._width){let l=this.isSegmentLine(),c;return l?c=new hr(e,r,i,s,n):c=Yi.build(e,r,i,a,n),c}createSceneArc(e,r,i,n,s,a,l,c=!1,h=this.event._width){let u=this.isSegmentLine(),d;return u?d=ns.build(e,r,i,n,s,a,l):d=Zo.build(e,r,i,h,n,s,a,l),d}createLine(e,r,i,n){var l;let{lineColor:s,lineSolid:a}=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((l=this.event.shape[0])==null?void 0:l.color)||ee.BLACK);return this.event.isEditOutLine&&(e=1002,s=ee.of3("#F0F0F0"),a=!1),r==null?r=this.createSceneLine(e,i,n,s,a):r instanceof Zo||r instanceof ns?(r.remove(),r=this.createSceneLine(e,i,n,s,a)):(r.start=i,r.end=n),r}createArc(e,r,i,n,s,a=es){var T;let l=new ro,c=i[1].sub(i[0]),h=i[2].sub(i[1]),u=c.cross(h);if(u>0)a=a;else if(u==0)if((r instanceof Yi||r instanceof hr)&&c.length()>0&&Math.abs(c.x)>0&&Math.abs(c.y)>0)r.end.sub(r.start).cross(c)>0?a=a:a=-a;else if(r==null&&c.length()>0&&Math.abs(c.x)>0&&Math.abs(c.y)>0)a=a;else if((r instanceof Zo||r instanceof ns)&&c.length()>0&&Math.abs(c.x)>0&&Math.abs(c.y)>0)a=(r.sweep===le.CW?-1:1)*(r.getAngle()%Math.PI);else return a=0,r;else a=-a;let{center:d,radius:p,startAngle:m,endAngle:g,sweep:y}=l.pointToAngle(n,s,a),{lineColor:b,lineSolid:P}=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((T=this.event.shape[0])==null?void 0:T.color)||ee.BLACK);if(this.event.isEditOutLine&&(e=1002,b=ee.of3("#F0F0F0"),P=!1),r==null)r=this.createSceneArc(e,d,p,m,g,y,b,P);else if(r instanceof Yi||r instanceof hr)r.remove(),r=this.createSceneArc(e,d,p,m,g,y,b,P);else{let I=r.getAngle(),C=r.start,E=r.end;(!C.equals(n)||!E.equals(s)||!ne.eq(a,I))&&(r.center=d,r.radius=p,r.startAngle=m,r.endAngle=g,r.sweep=y)}return r}modifyArc90(e){var a;let r=this.getLayer(),i=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((a=this.event.shape[0])==null?void 0:a.color)||ee.BLACK).lineColor;this.event.isEditOutLine&&(r=1002,i=ee.of3("#F0F0F0"));let n=e[1].sub(e[0]),s=e[2].sub(e[1]);if(ne.greater(n.length(),0)&&ne.greater(s.length(),0)?Math.abs(n.x)<1e-5||Math.abs(n.y)<1e-5?(this.line=this.createLine(r,this.line,e[0],e[1]),this.line1=this.createArc(r,this.line1,e,e[1],e[2])):(this.line=this.createArc(r,this.line,e,e[0],e[1]),this.line1=this.createLine(r,this.line1,e[1],e[2])):ne.greater(n.length(),0)&&ne.lesseq(s.length(),0)?(Math.abs(n.x)<1e-5||Math.abs(n.y)<1e-5?this.line=this.createLine(r,this.line,e[0],e[1]):this.line=this.createArc(r,this.line,e,e[0],e[1]),this.line1&&(this.line1.remove(),this.line1=null)):ne.lesseq(n.length(),0)&&ne.greater(s.length(),0)&&(Math.abs(s.x)<1e-5||Math.abs(s.y)<1e-5?this.line=this.createLine(r,this.line,e[1],e[2]):this.line=this.createArc(r,this.line,e,e[1],e[2]),this.line1&&(this.line1.remove(),this.line1=null)),this.line&&(this.line.color=i),this.line1&&(this.line1.color=i),this.line!=null){let l=this.line.end.sub(this.line.start).normalize();(l.x!=0||l.y!=0)&&(this.event.lastDirect=l)}}modifyArc45(e){var l;let r=this.getLayer(),i=Ys.getInstance().getRegionLineStyle2(this.resultEvent.type,((l=this.event.shape[0])==null?void 0:l.color)||ee.BLACK).lineColor;this.event.isEditOutLine&&(r=1002,i=ee.of3("#F0F0F0"));let n=Math.PI/4,s=e[1].sub(e[0]),a=e[2].sub(e[1]);if(s.length()!=0&&a.length()!=0?this.tool.arcFirst?(this.line=this.createArc(r,this.line,e,e[0],e[1],n),this.line1=this.createLine(r,this.line1,e[1],e[2])):(this.line=this.createLine(r,this.line,e[0],e[1]),this.line1=this.createArc(r,this.line1,e,e[1],e[2],n)):s.length()!=0&&a.length()==0?(Math.abs(s.x)<1e-5||Math.abs(s.y)<1e-5||s.length()>0&&Math.abs(Math.abs(s.x)-Math.abs(s.y))<1e-5?this.line=this.createLine(r,this.line,e[0],e[1]):this.line=this.createArc(r,this.line,e,e[0],e[1],n),this.line1!=null&&(this.line1.remove(),this.line1=null)):s.length()==0&&a.length()!=0&&(Math.abs(a.x)<1e-5||Math.abs(a.y)<1e-5||s.length()>0&&Math.abs(Math.abs(s.x)-Math.abs(s.y))<1e-5?this.line=this.createLine(r,this.line,e[1],e[2]):this.line=this.createArc(r,this.line,e,e[1],e[2],n),this.line1!=null&&(this.line1.remove(),this.line1=null)),this.line&&(this.line.color=i),this.line1&&(this.line1.color=i),this.line!=null){let c=this.line.end.sub(this.line.start).normalize();if(this.line instanceof Zo||this.line instanceof ns){let h=this.line.start.sub(this.line.center).normalize();c=new S(-h.y,h.x),this.line.sweep==le.CW&&(c=c.mul(-1))}this.event.lastDirect=c}}wireWidth(e){this.line!=null&&(this.line.width=e),this.line1!=null&&(this.line1.width=e),this.event.closeLine!=null&&(this.event.closeLine.width=e),this.event.shape.forEach(r=>{r.width=e}),this.event._width=e,rt.defaultOutlineWidth=e}toggleLineOrArc(e,r){return r instanceof Yi||r instanceof hr?this.createSceneLine(e,r.start,r.end,r.color,!0,r.width):this.createSceneArc(e,r.center,r.radius,r.startAngle,r.endAngle,r.sweep,r.color,!0,r.width)}toggleCurrentShape(e){this.line&&(this.line.layerId=e),this.line1&&(this.line1.layerId=e),this.event.closeLine&&(this.event.closeLine.layerId=e)}updateAssisLineColor(e){e&&(this.line&&(this.line.color=e),this.line1&&(this.line1.color=e))}getPreviewOutline(){return[this.line,this.line1]}isSegmentLine(){return this.event.drawScene==="Segment"}};var Ew=class{constructor(t,e,r,i){this.lines=[];let n=new hr(1002,t,e,!0),s=ns.build(1002,t,r,0,i,le.CCW);this.lines.push(n),this.lines.push(s)}update(t,e,r,i){if(this.lines.length)this.lines[0].start=t,this.lines[0].end=e,this.lines[1].center=t,this.lines[1].startAngle=0,this.lines[1].endAngle=i,this.lines[1].radius=r;else{let n=new hr(1002,t,e,!0),s=ns.build(1002,t,r,0,i,le.CCW);this.lines.push(n),this.lines.push(s)}}remove(){for(let t=0;t<this.lines.length;t++)this.lines[t].remove();this.lines.length=0}},Ow=class{constructor(t,e,r,i,n,s,a){this.line1=new hr(1002,r,t,!0),this.line2=new hr(1002,r,e,!0),this.line3=ns.build(1002,r,i,n,s,a)}update(t,e,r,i,n,s,a){this.line1&&this.line2&&this.line3?(this.line1.start=r,this.line1.end=t,this.line2.start=r,this.line2.end=e,this.line3.center=r,this.line3.startAngle=n,this.line3.endAngle=s,this.line3.radius=i,this.line3.sweep=a):(this.line1=new hr(1002,r,t,!0),this.line2=new hr(1002,r,e,!0),this.line3=ns.build(1002,r,i,n,s,a))}remove(){var t,e,r;(t=this.line1)==null||t.remove(),(e=this.line2)==null||e.remove(),(r=this.line3)==null||r.remove(),this.line1=null,this.line2=null,this.line3=null}};var hU=class hU extends ci{constructor(e){super();this.widthFollowRule=!1;this.event=new Hu;this.started=!1;switch(this.lineType=e,this.event=new Hu,we.drawing=!0,this.lineType=="Line"?x.getInstance().doctype==4?this.event._width=we.prevTrackWidth||rt.defaultOutlineWidth:this.event._width=al.getInstance().getTrackWidth().value||rt.defaultOutlineWidth:this.lineType=="Board Outline"||this.lineType=="3D Shell - Outline"?this.event._width=rt.defaultOutlineWidth:this.event._width=.02,this.lineType=="3D Shell - Outline"&&(this.event._width=qu(-1,this.lineType)),this.lineType=="Partition"&&(this.event._width=.01),this.resultEvent=new bg(this.lineType),this.lineType==="Line"&&(this.event.needClose=!1),this.event.drawScene=this.lineType,tr.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent,this.lineType);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent,this.lineType);break}this.event.commands=new ve("draw 2DLine - "+this.lineType),jr.addDrawTool(this),Ua.changeTool(this),Wh.setTool(this),hU._readyType=this.lineType}static get readyType(){return this._readyType}getWidth(){return this.event._width}onKeyDown(e){let r;switch((this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline")&&(r=sr.getLocalAction(["decrease_routing_width","increase_routing_width"],e)),r||(r=sr.getAction(4,e)),r){case"changeRoutingAngle":case"Routing Corner":let i=jr.getNextType();if(this.wireCorner(i),i==="WIRING_CORNER_FREEANGLE"||i==="WIRING_CORNER_ARC"){let s=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(s)}else dt.destroy();Hi();break;case"Switch Common Track Width":(this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline")&&this.showCommonTrackWidthMenu(e);break;case"Change Track Width While Routing":let n=tr.getInstance().type;this.canChangeWhileRouting(this.resultEvent.type)&&(!ce.pcbConfig.useDynamicInputBox||n!=="WIRING_CORNER_FREEANGLE")&&(this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline")&&A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"decrease_routing_width":{let a=this.event._width-.2;a>=.1&&(this.setWireWidth(a),Hi())}break;case"increase_routing_width":{let a=this.event._width+.2;this.setWireWidth(a),Hi()}break}r==="Cancel"?this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel():r==="Finish"?this.next(e):this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){this.next(e)}onEnterPlace(e){}next(e){if(dt.editingWhat){dt.editingWhat="";return}this.started||(this.started=!0,this.start()),this.dealLocked(e),this.drawPolygon.onMouseLeftUp(e),this.lineType==="Partition"&&this.drawPolygon.shape.forEach(r=>{r.color=Ys.getInstance().getRegionLineStyle2("Partition").lineColor}),dt.destroy()}dealLocked(e){if(typeof dt.lineLockedLength=="number"){let r=dt.startPoint,i=new S(e.sceneX,e.sceneY),n=new S(i.x-r.x,i.y-r.y).normalize(),s=new S(n.x*dt.lineLockedLength,n.y*dt.lineLockedLength);i=new S(s.x+r.x,s.y+r.y),e.sceneX=i.x,e.sceneY=i.y}if(typeof dt.lineLockedAngle=="number"){let r=dt.startPoint,i=new S(e.sceneX-r.x,e.sceneY-r.y),n=A$(i),s=lAe(i,dt.lineLockedAngle-n);e.sceneX=s.x+r.x,e.sceneY=s.y+r.y}}onMouseMove(e){this.dealLocked(e),this.drawing&&this.drawPolygon.onMouseMove(e);let r=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(r),this.lineType==="Partition"&&this.drawPolygon.updateAssisLineColor(Ys.getInstance().getRegionLineStyle2("Partition").lineColor)}showFloatingInputBox(e){if(ce.pcbConfig.useDynamicInputBox&&this.started&&this.event.last&&(this.drawPolygon instanceof Bl||this.drawPolygon instanceof hl)){let r=Gf(),i=this.event.last;dt.startPoint=i;let n=i.distance1(e);if(!n)return;let s=Fo(e),a=Fo(i),l=new S(e.x-i.x,e.y-i.y),c=A$(l);if(this.drawPolygon instanceof Bl||this.drawPolygon instanceof hl&&!this.drawPolygon.hasArc()){let h=c/180*Math.PI,u=new S(i.x+n,i.y);dt.id!=="adsorption"&&(dt.auxiliaryLine1?dt.auxiliaryLine1.update(i,u,n,h):dt.auxiliaryLine1=new Ew(i,u,n,h));let d=9;if(d>=dt.priority){dt.priority=d;let p={data:[{startPoint:i,cursorPoint:e,frameStartPoint:a,frameCursorPoint:s,info:{type:"free",value:Xe(n),unit:x.getInstance().unit}},{startPoint:i,cursorPoint:e,frameStartPoint:a,frameCursorPoint:s,info:{type:"circle",value:c,tagName:"angle"}}],type:"rect",show:!0,frameInfo:r};dt.create(p)}}else if(this.drawPolygon instanceof hl&&this.drawPolygon.hasArc()){let h=this.drawPolygon.getArcAngle(),u=this.event.start,d=this.drawPolygon.getArcEnd(),p=this.drawPolygon.getArcCenter(),m=this.drawPolygon.getArcRadius(),g=this.drawPolygon.getArcStartAngle(),y=this.drawPolygon.getArcEndAngle(),b=this.drawPolygon.getArcSweep();dt.id!=="adsorption"&&(dt.auxiliaryLine2?dt.auxiliaryLine2.update(u,d,p,m/10,g,y,b):dt.auxiliaryLine2=new Ow(u,d,p,m,g,y,b)),dt.id!=="Free Arc"&&dt.destroy();let P=9;if(P>=dt.priority){dt.priority=P;let T={data:[{startPoint:u,center:p,frameStartPoint:a,frameCursorPoint:Fo(p),info:{type:"circle",value:h,tagName:"angle",canNotLock:!0}}],type:"rect",show:!0,frameInfo:r};dt.create(T,"Free Arc")}}}else this.started&&dt.id!=="adsorption"&&dt.destroy()}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l,startPoint:c}=e;if(a){dt.editingWhat=i;return}let h=!1;if((dt.editingWhat||typeof dt.lineLockedLength=="number"||typeof dt.lineLockedAngle=="number")&&(h=!0),dt.editingWhat="",n||s){this.drawPolygon instanceof hl?this.drawPolygon.getArc()||this.lockUnlock(e):this.lockUnlock(e);return}let u=this.applyValue(e);(l===108||l===13)&&(u?h?(this.drawPolygon.asMouseLeftUp(u),dt.destroy()):(this.drawPolygon.addShape(u),this.completed()):dt.destroy())}lockUnlock(e){let{value:r,type:i,locked:n,unlocked:s}=e,a=new ft;i==="free"?n?(this.applyValue(e),r=a.conversion(x.getInstance().unit,"mil",r/10),dt.lineLockedLength=r):s&&(dt.lineLockedLength=null):i==="circle"&&(n?(dt.lineLockedAngle=r,this.applyValue(e)):s&&(dt.lineLockedAngle=null))}applyValue(e){let{value:r,type:i,startPoint:n,cursorPoint:s}=e,a=new ft,l,c;if(i==="free")if(r=a.conversion(x.getInstance().unit,"mil",r/10),dt.id==="adsorption"){let h=new S(s.x-n.x,s.y-n.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+n.x,h.y+n.y);if(this.started)c=u;else{this.event.start=u,this.started=!0;return}}else{let h=new S(this.event.curr.x-this.event.last.x,this.event.curr.y-this.event.last.y).normalize();l=new S(h.x*r,h.y*r),c=new S(l.x+this.event.last.x,l.y+this.event.last.y)}else if(i==="circle"&&this.drawPolygon instanceof hl){let h=this.drawPolygon.getArc();if(h){let u=h.start,d=h.end,p=new S((u.x+d.x)/2,(u.y+d.y)/2),m=new S(d.x-u.x,d.y-u.y),g=m.length(),y=g/2/Math.sin(r/2/180*Math.PI),b=g/2/Math.tan(r/2/180*Math.PI),P=m.normalize(),T=new S(-P.y,P.x),I=new S(T.x*b+p.x,T.y*b+p.y);c=new S(-T.x*y+I.x,-T.y*y+I.y)}else{let u=dt.startPoint;s=this.event.curr||s;let d=new S(s.x-u.x,s.y-u.y),p=A$(d),m=lAe(d,r-p);c=new S(m.x+u.x,m.y+u.y)}}else if(i==="circle"&&this.drawPolygon instanceof Bl){let h=dt.startPoint;s=this.event.curr||s;let u=new S(s.x-h.x,s.y-h.y),d=A$(u),p=lAe(u,r-d);c=new S(p.x+h.x,p.y+h.y)}return this.showFloatingInputBox(c),this.event.curr=c,this.drawPolygon.draw(this.event.last,this.event.curr,tr.getInstance().type),this.drawPolygon.asClose(c),A.publish("updateFrame",""),c}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel();break}}}interrupt(){this.drawPolygon.interrupt(),dt.destroy(),this.started=!1,hU._readyType=null,this.end()}cancel(){let{drawPolygon:e}=this;this.started?this.interrupt():(jr.clearDrawTool(),e.cancel(),hU._readyType=null),dt.destroy(),this.started=!1}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){if(this.resultEvent.type==="Fill Region"){let r=be.getLastActiveLayerID(),i=be.getAllPinLayerIds();if(i.includes(e)!==i.includes(r))return be.setActiveLayerId(r)}this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent,this.lineType);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent,this.lineType);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),tr.getInstance().type=e,we.synchronize()}completed(){let e;this.lineType==="Partition"&&(e=Ys.getInstance().getRegionLineStyle2("Partition").lineColor),this.drawPolygon.completed(!1,e),dt.destroy(),this.started=!1,this.end()}backspace(){this.drawPolygon.backspace(),dt.destroy(),this.started=!1}wireMode(e){}rightClickMenuData(e){let r=this.event.start!=null,i=this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline",n={state:"show",left:e.mouseX,top:e.mouseY,filter:o1(tr.getInstance().type,e.adsorb,r,!0,i,this.event._width).result};Qt.getInstance().menuData(n,this),this.drawing=!1}showCommonTrackWidthMenu(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:lg(this.event._width).result};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"AUTO_TRIM_SILKSCREEN":A.publish("autoTrimSilkscreen","");break;case"COMPLETE":this.drawPolygon.abortLast=!1,this.completed();break;case"CANCEL":this.event.shape&&this.event.shape.length?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]),Hi();break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"WIDTH":i[1]==="WIRING_WIDTH"?this.toggleWidth(i[2]):i[1]==="WIRING_WIDTH_COMMONLY_SSETTING"&&A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",$());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",$());break}A.publish("updateFrame","")}toggleWidth(e){if(this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline"){let r=ce.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit()),Hi()}}setWireWidth(e){this.drawPolygon.wireWidth(e),this.widthFollowRule=!1,we.prevTrackWidth=e,A.publish("flushSelectingInfo","")}getFirstLine(){if(this.drawPolygon instanceof Eh)return this.drawPolygon.getLine()}};hU._readyType=null;var rc=hU;function A$(o){if(o.length()<=0)return 0;let t=new S(1,0),e=Math.atan(o.y/o.x);return e=e/Math.PI*180,o.x<0?e=180+e:o.y<0&&(e=360+e),e}function lAe(o,t){let e=o.length(),r=A$(o),i=Math.cos((t+r)/180*Math.PI)*e,n=Math.sin((t+r)/180*Math.PI)*e;return new S(i,n)}var kue=class{constructor(t){this.tool=t,A.subscribe("tool",this.update.bind(this)),A.subscribe("DrawImage",this.drawImage.bind(this)),A.subscribe("DrawTrueColorPictureBySilkViewer",this.drawTrueColorPictureBySilkViewer.bind(this)),A.subscribe("PlaceQRCodeBySilkViewer",this.placeQRCodeBySilkViewer.bind(this)),A.subscribe("draw(RectFPCStiffener)",this.drawRectFPCStiffener.bind(this)),A.subscribe("draw(CirFPCStiffener)",this.drawCircleFPCStiffener.bind(this)),A.subscribe("draw(PolyFPCStiffener)",this.drawPolygonFPCStiffener.bind(this)),A.subscribe("updateQRCodeSize",this.updateQRCodeSize.bind(this)),A.subscribe("toggleQRCodeLayer",this.toggleQRCodeLayer.bind(this)),A.subscribe("toggleCounterBoreLabelLayer",this.toggleCounterBoreLabelLayer.bind(this)),A.subscribe("updateRotation",this.updateRotation.bind(this)),A.subscribe("updateFPCComponent",this.updateFPCComponent.bind(this)),A.subscribe("updateTextDirection",this.updateTextDirection.bind(this)),A.messageBus.rpcService("getQRCodePosition",()=>this.getQRCodePosition()),A.messageBus.rpcService("getCounterBoreData",()=>this.getCounterBoreData()),A.messageBus.rpcService("getDiagram",()=>this.getDiagram()),A.messageBus.rpcService("getCommentInfo",()=>this.getCommentInfo()),A.messageBus.rpcService("getULData",()=>h0.getInstance().getULData()),A.messageBus.rpcService("getFPCCollect",()=>this.getFPCCollect())}getQRCodePosition(){let t={},e=Kr.QRCode,r=Kr.plainCode,i=be.getActiveLayerID();if(t.layerId=i,e){let n=e.model.box,s=S$(n,Kr.imgUnit);t.qrCodeBbox={...s,rotation:uc(xe(-(e.rotation/Math.PI)*180,3))},t.qrCodeSize=uU(Kr.imgHeight,Kr.imgUnit,Kr.imgWidth),t.qrCode=Kr.base64,t.qrCodeStart={x:Xe(e.start.x,null,Kr.imgUnit),y:Xe(e.start.y,null,Kr.imgUnit)}}if(r){let n=r.model.box,s=S$(n,Kr.textUnit);t.plainCodeBbox={...s,rotation:uc(xe(-(r.rotation/Math.PI)*180,3))},t.plainCodeHeight=Xe(r.fontSize,null,Kr.textUnit),t.plainCodeSize=uU(r.textHeight,Kr.textUnit,r.textWidth),t.plainCode=r.value,t.direction=Kr.textDirection,t.plainCodePosition={x:Xe(r.position.x,null,Kr.textUnit),y:Xe(r.position.y,null,Kr.textUnit)}}return!e&&!r&&(t=null),t}getResultPlainBox(t,e){let r=e.model.box;if(t){let i=t.model.box,n=new _e,s=r.bbox;n.ext1(s),n.ext1(i.bbox);let l=n.build().center(),c=r.layerId==3?e.rotation:-e.rotation,h=Ae.rotateZForPoint(l,-c),u=Ae.rotateZForPoint(l,c);i.transform(h),r.transform(h),r.leftLow=new S(i.leftLow.x,r.leftLow.y),r.leftUp=new S(i.leftUp.x,r.leftUp.y),r.rightLow=new S(i.rightLow.x,r.rightLow.y),r.rightUp=new S(i.rightUp.x,r.rightUp.y),i.transform(u),r.transform(u)}return r}getCounterBoreData(){let t=RP.getInstance().counterBoresMap;return Array.from(t.values())}async getDiagram(){be.forceDeactive(!0),x.getInstance().forceDeactive=!0,Ve.getSelects().length&&Ve.clearSelect();let t=(await A.messageBus.rpcCall("exportPCBPng",{width:1920,height:1360})).message,e=t.data,r=null;if(e instanceof Uint8ClampedArray)r=e;else{r=new Uint8ClampedArray(t.width*t.height*4);for(let u in t.data)r[u]=t.data[u]}let i=document.createElement("canvas");i.width=t.width,i.height=t.height,i.getContext("2d").putImageData(new ImageData(r,t.width,t.height),0,0);let n=100,s=300*1024,a=null,l={quality:100,size:s},c={quality:10,size:0},h;for(;(!a||a.size>s)&&(h=i.toDataURL("image/webp",n),!(n<=c.quality));)l.quality=n,n=Math.floor((l.quality+c.quality)/2);return h}async downloadImage(t,e){let r=await this.canvas2Blob(t,"image/webp",e);ip.downloadFile("aaa",r)}canvas2Blob(t,e,r){return new Promise((i,n)=>{try{t.toBlob(s=>{i(s)},e,r/100)}catch(s){n(s)}})}getFPCCollect(){let t=[],e=zi.getInstance().getAllItem(),r=rn.getInstance().getAllItem(),i=Mi.getInstance().getAllItem();for(let n of e)if(Lf("FPC Stiffener",n.component,n.layerId)){let s=n.component,a={fpcModel:s.fpcModel,material:s.material,thickness:s.thickness,layerId:n.layerId};t.push(a)}for(let n of r)if(Lf("FPC Stiffener",n.component,n.layerId)){let s=n.component,a={fpcModel:s.fpcModel,material:s.material,thickness:s.thickness,layerId:n.layerId};t.push(a)}for(let n of i)if(Lf("FPC Stiffener",n.component,n.layerId)){let s=n.component,a={fpcModel:s.fpcModel,material:s.material,thickness:s.thickness,layerId:n.layerId};t.push(a)}return t}getCommentInfo(){let t={},e=Kr.plainCode;if(e){t.layerId=e.layerId,t.rotation=uc(xe(e.rotation/Math.PI*180,3)),t.comment=e.value;let r=e.model.box,i=S$(r,Kr.textUnit);t.commentBbox=i,t.commentSize=uU(e.textHeight,Kr.textUnit,e.textWidth),t.commentPosition={x:Xe(e.position.x,null,Kr.textUnit),y:Xe(e.position.y,null,Kr.textUnit)}}else t=null;return t}update(t){if(!x.getInstance().isactive||23==x.getInstance().doctype||this.lastCmd===t)return;this.lastCmd=t,Pr.model=3,jr.clearDrawTool(),Wh.setTool(null);let e=this.tool.getNextTool();switch(yi.setDraw(),yi.dropDrag=!1,t){case"dropdrag":{this.tool.setNextTool(new dh),Ve.dragging=!1,Ve.getSelects().length==0?yi.setNonSelect():A.publish("flushSelectingInfo",""),yi.dropDrag=!0;break}case"MeasureDistance":{let r=Ve.getSelects(),i=new iU(r);i.drawing=!0,this.tool.setNextTool(i);break}}A.publish("refreshNextTool",""),A.publish("updateFrame","")}drawImage(t){h0.getInstance().init(t),t.hasPosition?this.drawUL():h0.getInstance().place(),A.publish("updateFrame","")}drawUL(){yi.dropDrag=!1,this.lastCmd="PlaceQRCode",this.tool.interrupt();let t=h0.getInstance();t.drawing=!0,this.tool.setNextTool(t),A.publish("refreshNextTool","")}drawTrueColorPicture(t){yi.dropDrag=!1,this.lastCmd="DrawImage",this.tool.interrupt();let e=new rU(t);this.tool.setNextTool(e),A.publish("refreshNextTool","")}drawTrueColorPictureBySilkViewer(t){let{hashId:e,dataUrl:r}=t;if(Yd.getItem(e))this.drawTrueColorPicture(t);else{let n=new Image;n.src=r,n.onload=()=>{Yd.addTemplate(e,"aaa",n),this.drawTrueColorPicture(t)}}}drawCircleFPCStiffener(){yi.dropDrag=!1,this.lastCmd="draw(CirFPCStiffener)",this.tool.interrupt();let t=new Sh("FPC Stiffener");t.drawing=!0,this.tool.setNextTool(t),A.publish("refreshNextTool",""),A.publish("updateFrame","")}drawRectFPCStiffener(){yi.dropDrag=!1,this.lastCmd="draw(RectFPCStiffener)",this.tool.interrupt();let t=new Tc("FPC Stiffener");t.drawing=!0,this.tool.setNextTool(t),A.publish("refreshNextTool",""),A.publish("updateFrame","")}drawPolygonFPCStiffener(){yi.dropDrag=!1,this.lastCmd="draw(PolyFPCStiffener)",this.tool.interrupt();let t=new rc("FPC Stiffener");t.drawing=!0,sl.addTool(t),this.tool.setNextTool(t),A.publish("refreshNextTool",""),A.publish("updateFrame","")}updateFPCComponent(t){let e=Ve.getSelects();if(e.length===0)return;let r=e[0];if(t.layerid!=null&&(r.layerId=t.layerid),t.material!=null){let i=t.material;Qu.correctMaterial(i,r.getComponent())}if(t.model!=null){let i=t.model;Qu.correctModel(i,r.getComponent())}if(t.thickness!=null){let i=+t.thickness;Qu.correctThickness(i,r.getComponent())}Qu.correctAllProps(r.getComponent()),A.publish("updateFrame","")}placeQRCode(t){yi.dropDrag=!1,this.lastCmd="PlaceQRCode",this.tool.interrupt();let e=new Kr(t);this.tool.setNextTool(e),A.publish("refreshNextTool","")}placeQRCode1(t){if(t.imageData){let{position:e}=t.imageData;e&&Kr.placeQRCode(t.imageData)}if(t.textData){let{position:e}=t.textData;e&&Kr.placePlainCode(t.textData)}Kr.QRCode&&Kr.plainCode?(kt.combination([Kr.QRCode,Kr.plainCode],"qr_code_group"),Kr.QRCode.rotation=t.imageData.qrCodeRotation,Kr.plainCode.rotation=t.textData.plainCodeRotation,Kr.textDirection=t.textData.textDirection,Kr.plainCode.position=Kr.getTextPosition(Kr.plainCode.position)):Kr.QRCode?Kr.QRCode.rotation=t.imageData.qrCodeRotation:Kr.plainCode&&(Kr.plainCode.rotation=t.textData.plainCodeRotation),A.publish("updateFrame",""),Kr.updateCodeInfo()}placeQRCodeBySilkViewer(t){if(Kr.clearAll(),t.imageData){let{hashId:e,dataUrl:r,base64:i}=t.imageData;if(Yd.getItem(e))Kr.base64=i,t.imageData.position?this.placeQRCode1(t):this.placeQRCode(t);else{let s=new Image;s.src=r,s.onload=()=>{Yd.addTemplate(e,"aaa",s),Kr.base64=i,t.imageData.position?this.placeQRCode1(t):this.placeQRCode(t)}}}else t.textData&&(t.textData.position?this.placeQRCode1(t):this.placeQRCode(t))}updateQRCodeSize(t){let{img:e,text:r}=t;if(e&&r){if(Kr.QRCode&&(Kr.QRCode.width=e.width,Kr.QRCode.height=e.height,Kr.imgWidth=e.width,Kr.imgHeight=e.height),Kr.plainCode){Kr.plainCode.fontSize=r.height,Kr.textHeight=r.height,Kr.textWidth=Kr.plainCode.textWidth;let i=Kr.getTextTopCenterByRotation(r.height);i&&(Kr.plainCode.position=i)}}else if(e){if(Kr.QRCode&&(Kr.QRCode.width=e.width,Kr.QRCode.height=e.height,Kr.imgWidth=e.width,Kr.imgHeight=e.height),Kr.plainCode){let i=Kr.getTextPosition();i&&(Kr.plainCode.position=i)}}else if(r&&Kr.plainCode){Kr.plainCode.fontSize=r.height,Kr.textHeight=r.height,Kr.textWidth=Kr.plainCode.textWidth;let i=Kr.getTextPosition();i&&(Kr.plainCode.position=i)}(Kr.QRCode||Kr.plainCode)&&A.messageBus.publish("updateCode",Kr.getCurrentCodeInfo()),Pr.model=Pr.model,A.publish("tool","dropdrag"),A.publish("updateFrame","")}updateRotation(t){switch(t.type){case 1:let e=Kr.QRCode,r=Kr.plainCode;if(e&&r){let n=Kr.QRCode.center;Kr.QRCode.rotation=t.angle.QRCodeAngle,Kr.plainCode.rotation=t.angle.plainCodeAngle+t.angle.QRCodeAngle,Kr.QRCode.center=n,Kr.plainCode.position=Kr.getTextPosition(Kr.plainCode.position)}else e?this.changeRotation(t.angle.QRCodeAngle,e):r&&this.changeRotation(t.angle.plainCodeAngle+t.angle.QRCodeAngle,r);(e||r)&&A.messageBus.publish("updateCode",Kr.getCurrentCodeInfo());break;case 2:let i=h0.getInstance().image;i&&(this.changeRotation(t.angle,i),A.messageBus.publish("updateCode",h0.getInstance().getCurrentULInfo()));break}Pr.model=Pr.model,A.publish("tool","dropdrag"),A.publish("updateFrame","")}updateTextDirection(t){let e=Kr.QRCode,r=Kr.plainCode;e&&r&&(Kr.textDirection=t,Kr.plainCode.position=Kr.getTextPosition(Kr.plainCode.position),Kr.updateCodeInfo(),A.publish("updateFrame",""))}changeRotation(t,e){let r=e.center;e.rotation=t,e.center=r}toggleCounterBoreLabelLayer(t){RP.getInstance().onMouseWheel()}toggleQRCodeLayer(t){if(Kr.QRCode&&Kr.plainCode){let e=Kr.QRCode.center;Kr.QRCode.layerId=t,Kr.plainCode.layerId=t,Kr.QRCode.center=e,Kr.plainCode.position=Kr.getTextPosition(Kr.plainCode.position)}else{if(Kr.QRCode){let e=Kr.QRCode.center;Kr.QRCode.layerId=t,Kr.QRCode.center=e}Kr.plainCode&&(Kr.plainCode.layerId=t)}}};function uU(o,t,e,r){let i,n;if(e&&(i=Xe(e,null,t)),n=r?2:Xe(o,null,t),i&&n)return`${n}*${i}${t}`;if(n)return`${n}${t}`}function S$(o,t){let{leftLow:e,leftUp:r,rightLow:i,rightUp:n}=o,s={x:Xe(e.x,null,t),y:Xe(e.y,null,t)},a={x:Xe(r.x,null,t),y:Xe(r.y,null,t)},l={x:Xe(i.x,null,t),y:Xe(i.y,null,t)},c={x:Xe(n.x,null,t),y:Xe(n.y,null,t)};return{leftDown:s,leftUp:a,rightDown:l,rightUp:c}}var si=class si extends ci{constructor(e){super();this.hashId="";this.lastText="";this.initialQRCodeRotation=0;this.initialPlainCodeRotation=0;this.start(),this.option="OPTIONLEFTUP";let{imageData:r,textData:i}=e;if(r){let{hashId:n,width:s,height:a,unit:l,qrCodeRotation:c}=r;this.hashId=n,si.imgWidth=s,si.imgHeight=a,si.imgUnit=l,this.initialQRCodeRotation=c,this.drawing=!0}if(i){let{text:n,height:s,unit:a,plainCodeRotation:l,textDirection:c}=i;this.lastText=n,si.textHeight=s,si.textUnit=a,si.textDirection=c||"bottom",this.initialPlainCodeRotation=l,this.drawing=!0}Yo.setTool(this)}static placeQRCode(e){let{hashId:r,width:i,height:n,position:s,unit:a,layerId:l,rotation:c}=e,h=l||this.getLayer();si.imgUnit=a,si.imgWidth=i,si.imgHeight=n;let u=new S(s.x,s.y);si.QRCode=_o.addImage(h,u,i,n,rt.defaultImage.rotation,!1,!1,r)}static placePlainCode(e){let{text:r,position:i,height:n,unit:s,layerId:a}=e;si.textUnit=s,si.plainCode=ti.addText(a||this.getLayer(),"",!1,r,!0,"\u5B8B\u4F53",n,ti.textAttr["attr-rotation"],!1,i,5,.8,!1,0,!1,void 0,"#ffffff"),si.textHeight=n,si.textWidth=si.plainCode.textWidth}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY),i=[],n=new ve("insert QRCode");si.QRCode!=null&&(si.QRCode.start=r,i.push(si.QRCode),n.addCommand(Te.dispatch(si.QRCode,"add")),A.publish("hasModifyPcbItem",si.QRCode),this.drawing=!1),si.plainCode!=null&&(i.push(si.plainCode),n.addCommand(Te.dispatch(si.plainCode,"add")),this.drawing=!1,A.publish("updateRtree","")),i.length&&(A.publish("onlySelect",i),si.QRCode&&si.plainCode&&kt.combination([si.QRCode,si.plainCode],"qr_code_group")),n.length&&je.executeCommand(n),A.messageBus.publish("updateCode",si.getCurrentCodeInfo()),A.publish("flushService",""),A.publish("tool","dropdrag")}static updateCodeInfo(){function e(){setTimeout(()=>{if(vp.list.size==0){let r=si.plainCode.textHeight;if(Math.abs(r-si.textHeight)>1e-5){si.plainCode.fontSize=si.plainCode.fontSize/r*si.textHeight,e();return}A.messageBus.publish("updateCode",si.getCurrentCodeInfo())}else e()},5)}si.plainCode?e():A.messageBus.publish("updateCode",si.getCurrentCodeInfo())}static getCurrentCodeInfo(){let e={},r=si.QRCode,i=si.plainCode,n=be.getActiveLayerID();e.layerId=n,e.dataType=1,r&&(e.imgSize=uU(si.imgHeight,si.imgUnit,si.imgWidth),e.qrCodeRotation=uc(xe(-(r.rotation/Math.PI)*180,3)),e.img=si.base64,e.imgPosition={x:Xe(r.start.x,null,si.imgUnit),y:Xe(r.start.y,null,si.imgUnit)}),i&&(e.textSize=uU(i.textHeight,si.textUnit,i.textWidth),e.plainCodeRotation=uc(xe(-(i.rotation/Math.PI)*180,3)),e.text=i.value,e.direction=si.textDirection,e.textPosition={x:Xe(i.position.x,null,si.textUnit),y:Xe(i.position.y,null,si.textUnit)});let s=si.checkQRCodePosVaild();return s&&(e.posCheckedInfo=s),!r&&!i&&(e=null),e}static checkQRCodePosVaild(){if(!JT.isChecked){console.warn("\u672A\u5F00\u542F\u4F4D\u7F6E\u68C0\u6D4B");return}let e=JT.outlineInfoForQRCode;if(!e)return console.log("\u5F00\u542F\u68C0\u6D4B\uFF0C\u4F46\u662F\u5E76\u6CA1\u6709\u83B7\u53D6\u5230\u76F8\u5173\u677F\u6846\u6570\u636E\uFF0C\u65E0\u6CD5\u8FDB\u884C\u68C0\u6D4B"),{posValid:!1,reason:"\u5F00\u542F\u68C0\u6D4B\uFF0C\u4F46\u662F\u5E76\u6CA1\u6709\u83B7\u53D6\u5230\u76F8\u5173\u677F\u6846\u6570\u636E\uFF0C\u65E0\u6CD5\u8FDB\u884C\u68C0\u6D4B"};let r=new _e,i=[1,3,5,58],n=[2,4,6,8],s,a;if(si.QRCode!=null){let g=si.QRCode.layerId;s=i.includes(g)||(n.includes(g)?!1:void 0),r.ext1(si.QRCode.getMathGraphics(g,0).bbox())}if(si.plainCode!=null){let g=si.plainCode.layerId;a=i.includes(g)||(n.includes(g)?!1:void 0),r.ext1(si.plainCode.getMathGraphics(g,0).bbox())}if(!r.valid())return console.log("\u672A\u68C0\u6D4B\u5230\u4E8C\u7EF4\u7801\u548C\u660E\u7801\u653E\u7F6E\u7684\u60C5\u51B5"),{posValid:!1,reason:"\u672A\u68C0\u6D4B\u5230\u4E8C\u7EF4\u7801\u548C\u660E\u7801\u653E\u7F6E\u7684\u60C5\u51B5"};let l=si.QRCode&&si.plainCode?"\u4E8C\u7EF4\u7801+\u660E\u7801":si.QRCode?"\u4E8C\u7EF4\u7801":"\u660E\u7801",c=s!=null?s:a;c===void 0&&(console.warn("QRCode: \u4E8C\u7EF4\u7801\u6216\u660E\u7801\u540C\u65F6\u4E0D\u5B58\u5728\u4E8E\u9876\u5C42\u6216\u5E95\u5C42"),c=!0);let h=r.build(),u=e.bbox().area(),d=Math.abs(e.area(.1));if(u===d){if(!e.bbox().isContainsBBox(h))return console.log(`\u68C0\u6D4B\u5230${l}\u4E0D\u5728\u677F\u6846\u5185`),{posValid:!1,reason:`\u68C0\u6D4B\u5230${l}\u4E0D\u5728\u677F\u6846\u5185`}}else{let y=HP([Gl.INTERSECT,e,fe.build6(h)]).bbox().area();if(y!==h.area()||ne.eq(y,d))return console.log(`\u68C0\u6D4B\u5230${l}\u4E0D\u5728\u677F\u6846\u5185`),{posValid:!1,reason:`\u68C0\u6D4B\u5230${l}\u4E0D\u5728\u677F\u6846\u5185`}}let p=c?[3,5,12]:[4,6,12],m=Vt.searchByLayers(h,p).getAllItems().filter(g=>g===si.QRCode||g===si.plainCode?!1:g instanceof Sr&&g.layerId===12?JT.coverOil:!!g.getParent());if(m.length>=1){let g=fe.buildBBox(h).primitives;for(let y of m){let P=function(){return console.log(`${l}\u68C0\u6D4B\u4F4D\u7F6E\u4E0D\u901A\u8FC7, \u4E0E\u5176\u5B83\u56FE\u5143\u5B58\u5728\u91CD\u53E0`,b),{posValid:!1,reason:`${l}\u68C0\u6D4B\u4F4D\u7F6E\u4E0D\u901A\u8FC7, \u4E0E\u5176\u5B83\u56FE\u5143\u5B58\u5728\u91CD\u53E0`}},b=y;if(b instanceof mt||b instanceof vt){let T=b.width/2,I=b.primitive;if(h.extendOfSize(T).isContainsBBox(I.bbox()))return P();for(let C of g)if(ir.getMinDistance(C,I)<=T)return P()}else return P()}}return console.log(`${l}\u4F4D\u7F6E\u68C0\u6D4B\u901A\u8FC7`),{posValid:!0,reason:`${l}\u4F4D\u7F6E\u68C0\u6D4B\u901A\u8FC7`}}onMouseMove(e){if(this.drawing){let r=new S(e.sceneX,e.sceneY);if(this.hashId)if(si.QRCode!=null)si.QRCode.layerId!=si.getLayer()&&(si.QRCode.layerId=si.getLayer()),si.QRCode.start=r;else{let{hashId:i}=this,n=si.getLayer(),s=this.initialQRCodeRotation;si.QRCode=_o.addImage(n,r,si.imgWidth,si.imgHeight,s,!1,!1,i)}if(this.lastText)if(si.plainCode!==null)si.plainCode.layerId!=si.getLayer()&&(si.plainCode.layerId=si.getLayer()),si.textWidth=si.plainCode.textWidth,si.plainCode.position=si.getTextPosition(r);else{let i=si.getTextPosition(r,si.textHeight);this.createText(i,void 0,void 0,si.textHeight),si.textWidth=si.plainCode.textWidth,si.plainCode.position=si.getTextPosition(r,si.textHeight)}}}static getTextPosition(e,r=(i=>(i=si.plainCode)==null?void 0:i.height)()){let n=e;return si.QRCode&&(si.plainCode&&(r=HXe(si.QRCode.width,si.plainCode),si.plainCode.fontSize=r,si.textHeight=r,si.textWidth=si.QRCode.width),n=this.getTextTopCenterByRotation(r)),n}static getTextTopCenterByRotation(e){var y,b;let r,i=si.QRCode.height,n=si.QRCode.rotation,s=n/Math.PI*180+360||0,a=((y=si.plainCode)==null?void 0:y.rotation)/Math.PI*180+360+s||0,l=((b=si.plainCode)==null?void 0:b.model.box.width)||si.textWidth,c=(i+(a%360%180===0?l:e))/2,h=(i+(a%360%180===0?e:l))/2,u=si.QRCode.center,d=si.textDirection,p=ms(si.QRCode.layerId),m=Xs.conversion("mm","mil",.3)/10;switch(d){case"top":r=Ae.translate(-u.x,-u.y,0).rotateZ(-n).translate1(0,m+h,0).rotateZ(p?-n:n).translate1(u.x,u.y,0);break;case"bottom":r=Ae.translate(-u.x,-u.y,0).rotateZ(-n).translate1(0,-(m+h),0).rotateZ(p?-n:n).translate1(u.x,u.y,0);break;case"left":r=Ae.translate(-u.x,-u.y,0).rotateZ(-n).translate1(p?m+c:-(m+c),0,0).rotateZ(p?-n:n).translate1(u.x,u.y,0);break;case"right":r=Ae.translate(-u.x,-u.y,0).rotateZ(-n).translate1(p?-(m+c):m+c,0,0).rotateZ(p?-n:n).translate1(u.x,u.y,0);break;default:break}return u.multiply4(r)}static clearAll(){si.QRCode!==null&&(si.QRCode.remove(),A.publish("delete",si.QRCode),si.QRCode=null,A.publish("flushService","")),si.plainCode!==null&&(si.plainCode.remove(),A.publish("delete",si.plainCode),si.plainCode=null,A.publish("updateRtree",""))}interrupt(){si.QRCode!==null&&(si.QRCode.remove(),A.publish("delete",si.QRCode),si.QRCode=null,A.publish("flushService",""),this.drawing=!1),si.plainCode!==null&&(si.plainCode.remove(),A.publish("delete",si.plainCode),this.drawing=!1,si.plainCode=null,A.publish("updateRtree","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}static getLayer(){let e=be.getActiveLayer();switch(e.layerID){case 3:case 4:case 13:return e.layerID;default:return 3}}createText(e,r="\u5B8B\u4F53",i=ti.textAttr["attr-text-stroke-width"],n=ti.textAttr["attr-text-size"]){si.plainCode=ti.addText(si.getLayer(),"",!1,this.lastText,!0,r,n,this.initialPlainCodeRotation,!1,e,5,i,ti.textAttr["attr-reversed-phase"],ti.textAttr["attr-reversed-phase-extend"],ti.textAttr["attr-mirror"],void 0,"#ffffff")}};si.QRCode=null,si.plainCode=null;var Kr=si;var Bue=class{constructor(t,e,r){this.via=new $I;this.pad=new qE;this.line=new JE;this.arc=new QE;this.poly=new e3;this.fill=new KI;this.fpcFill=new YR;this.region=new ER;this.partition=new jR;this.copper=new d3;this.image=new OR;this.obj=new LR;this.tear=new t3;this.font=new KA;this.str=new r3;this.attr=new ST;this.inner=new t_;this.dimension=new AR;this.dimensionAttr=new vR;this.component=new i3;this.padNet=new n3;this.shell=new RR;this.shellEntity=new MR;this.crease=new DR;this.boss=new wR;this.source=!1;this.version=t,this.doctype=e,this.compiler=r,this.format=new Vg().getConfig(t),this.compiler==null&&(this.encoder=new Bk(x.getInstance().id))}get ignorePartitionId(){return this.doctype!=3}saveCommonData(){this.feed("CANVAS"),$e.getInstance().getAllItem().forEach(D=>{this.feed("LAYER",D)}),$e.getInstance().getLayerPhys().forEach(D=>{this.feed("LAYER_PHYS",D)}),this.feed("ACTIVE_LAYER");let r=te.getInstance(),i=r.getAllSafeSpacing(),n=r.getAllOtherSpacing(),s=r.getAllTrackPhysics(),a=r.getAllNetLengthPhysics(),l=r.getAllNetLengthTolerancePhysics(),c=r.getAllDifferentialPhysics(),h=r.getAllBlindPhysics(),u=r.getAllRadiusPhysics(),d=r.getAllInnerPlane(),p=r.getAllCopperPlane(),m=r.getAllPasteExpansion(),g=r.getAllSolderExpansion(),y=r.getAllAutoRouterRules(),b=r.getAllNetClass(),P=r.getAllNets(),T=r.getAllNetDifferentials(),I=r.getAllEqualLengthGroups(),C=r.getAllPadsPairGroups(),E=r.getAllRegions(),O=r.getAllCreepageSpacing();P.forEach(D=>{this.feed("NET",D)}),this.feed("RULE_TEMPLATE"),i.forEach(D=>{this.feed("RULE",D)}),n.forEach(D=>{this.feed("RULE",D)}),O.forEach(D=>{this.feed("RULE",D)}),s.forEach(D=>{this.feed("RULE",D)}),a.forEach(D=>{this.feed("RULE",D)}),l.forEach(D=>{this.feed("RULE",D)}),c.forEach(D=>{this.feed("RULE",D)}),h.forEach(D=>{this.feed("RULE",D)}),u.forEach(D=>{this.feed("RULE",D)}),d.forEach(D=>{this.feed("RULE",D)}),p.forEach(D=>{this.feed("RULE",D)}),m.forEach(D=>{this.feed("RULE",D)}),g.forEach(D=>{this.feed("RULE",D)}),y.forEach(D=>{this.feed("RULE",D)}),C.forEach(D=>{this.feed("EQLEN_GRP",D)});let _=[];C.forEach(D=>{D.details.forEach(w=>{_.push(w)})}),_.forEach(D=>{this.feed("EQLEN",D)}),b.forEach(D=>{this.feed("RULE_SELECTOR",D)}),P.forEach(D=>{this.feed("RULE_SELECTOR",D)}),T.forEach(D=>{this.feed("RULE_SELECTOR",D)}),I.forEach(D=>{this.feed("RULE_SELECTOR",D)}),r.betweenNetRule.rule.forEach(D=>{this.feed("RULE_SELECTOR",D)}),E.forEach(D=>{this.feed("RULE_SELECTOR",D)}),this.getPrimitives().forEach(D=>{this.feed("PRIMITIVE",D)}),this.feed("SILK_OPTS",$e.getInstance().getLayer(3)),this.feed("SILK_OPTS",$e.getInstance().getLayer(4))}getFile(){return this.encoder.getDataStr()}getItems(t){return this.feedItems(t),this.getFile()}feed(t,e){let r=this.getItemFormat(t),i=this.getEncode(t),n={};for(let s of r)this.ignorePartitionId&&s=="partitionId"||(n[s]=this.getData(s,i,e));return this.upload2Compiler(t,n,e),this.uploadSource(t,n,e),n}feedFromGerber(t,e){let r=this.getItemFormat(t),i=this.getEncode(t),n={};for(let s of r)this.ignorePartitionId&&s=="partitionId"||(n[s]=this.getData(s,i,e));this.uploadSource(t,n,e)}feedItem(t){let e=this.getFileType(t);this.feed(e,t)}feedCopper(t){let e=new Map,r,i=[];for(let n of t)r=n.getParent().globalIndex,i=e.get(r),i||(i=[],e.set(r,i)),i.push(n);e.forEach((n,s)=>{this.feed("POURED",n)})}feedInner(t){let e=new Map,r,i=[];for(let n of t)r=n.layerId,i=e.get(r),i||(i=[],e.set(r,i)),i.push(n);e.forEach((n,s)=>{this.feed("INNER",n)})}feedComponent(t){this.feed("COMPONENT",t);let e=t.attributes,r=!0;for(let s of e)s.key=="Device"&&(r=!1),Cp(s,t)&&this.feed("ATTR",s);if(r)throw new Error("The device is missing device attributes, saving will lead to data loss, please contact the official customer service in time!");t.getPads().forEach(s=>{this.feed("PAD_NET",s)}),t.getItems().filter(s=>s instanceof It).forEach(s=>{this.feed("PAD_NET",s)})}feed4Type(t){switch(t){case"CANVAS":return this.feed(t);case"ACTIVE_LAYER":return this.feed(t);default:break}}feedItems(t){t.forEach(e=>{if(e.getParent()==null){let r=this.getFileType(e);this.feed(r,e)}})}feedPanelize(){let t=ai.getInstance(),e=JSON.parse(JSON.stringify(t.getDefaultPanelize()));this.feed("PANELIZE",e)}getFileType(t){if(t instanceof qr)return"LINE";if(t instanceof Je)return"PAD";if(t instanceof It)return"VIA";if(t instanceof Oi)return"ARC";if(t instanceof lr)switch(t.type){case"Line":case"Board Outline":return"POLY";case"Fill Region":case"Slot Region":return"FILL";case"TearDrop":return"TEARDROP";case"FPC Stiffener":return"FPC_FILL";case"Prohibited Region":case"Constraint Region":return"REGION";case"Partition":return"PARTITION";case"Copper Region":return"POUR";case"3D Shell - Outline":return"SHELL";case"3D Shell - Screw Pillar":return"BOSS";case"3D Shell - Side Datum Line":return"CREASE";case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":return"SHELL_ENTITY"}else{if(t instanceof Li)return t.key!=""?"ATTR":"STRING";if(t instanceof zd)return"DIMENSION";if(t instanceof Rf)return"DIMENSION";if(t instanceof Df)return"DIMENSION";if(t instanceof vi)return"COMPONENT";if(t instanceof ql)return"IMAGE";if(t instanceof bm)return"OBJ";if(t instanceof YS)return"GROUP";if(t instanceof Cn)return"FILL";if(t instanceof Pn)return"POURED";throw new Error("not support this shape:"+t)}}getItemFormat(t){return this.format[t]}getEncode(t){switch(t){case"VIA":return this.via;case"PAD":return this.pad;case"LINE":return this.line;case"ARC":return this.arc;case"POLY":return this.poly;case"FILL":return this.fill;case"FPC_FILL":return this.fpcFill;case"REGION":return this.region;case"PARTITION":return this.partition;case"POURED":return this.copper;case"IMAGE":return this.image;case"OBJ":return this.obj;case"TEARDROP":return this.tear;case"FONT":return this.font;case"STRING":return this.str;case"ATTR":return this.attr;case"DIMENSION":return this.dimension;case"COMPONENT":return this.component;case"PAD_NET":return this.padNet;case"SHELL_ENTITY":return this.shellEntity;case"SHELL":return this.shell;case"CREASE":return this.crease;case"BOSS":return this.boss}}getData(t,e,r){return e.getData(t,r)}getPrimitives(){return["ALL","COMPONENT","PROPERTY","COMPONENTSILK","TRACK","VIA","TESTPOINT","PAD","PADSPAIR","NETWORK","SUTUREHOLE","TEARDROP","RATLINE","GROUP","TEXT","IMAGE","PICTURE","DIMENSION","BOARDOUTLINE","SLOTREGION","FILLREGIEN","COPPEROUTLINE","COPPERFILLED","PROHIBITEDREGION","CONSTRAINT","PARTITION","LINE","LOCKED","UNLOCKED","SHELL","BOSS","CREASE","TOPSHELLCUT","SIDESHELLCUT","TOPBOTTOMENTITY","SIDEENTITY","FPC_STIFFENER"]}uploadSource(t,e,r){var i;if(this.encoder!=null)switch(t){case"CANVAS":return this.encoder.uploadCanvas(e);case"LAYER":return this.encoder.uploadLayer(r.layerId,e);case"LAYER_PHYS":return this.encoder.uploadLayerPhys(r.layerId,e);case"ACTIVE_LAYER":return this.encoder.uploadActiveLayer(e);case"NET":return this.encoder.uploadNet(r.name,e);case"PRIMITIVE":return this.encoder.uploadPrimitive(r,e);case"GROUP":return this.encoder.uploadGroup(r.globalIndex,e);case"VIA":return this.encoder.uploadVia(r.globalIndex,e);case"PAD":return this.encoder.uploadPad(r.globalIndex,e);case"LINE":return this.encoder.uploadLine(r.globalIndex,e);case"ARC":case"CARC":return this.encoder.uploadArc(r.globalIndex,e);case"POLY":return this.encoder.uploadPoly(r.globalIndex,e);case"FILL":return this.encoder.uploadFill(r.globalIndex,e);case"FPC_FILL":return this.encoder.uploadFpcFill(r.globalIndex,e);case"REGION":return this.encoder.uploadRegion(r.globalIndex,e);case"PARTITION":return this.encoder.uploadPartition(r.globalIndex,e);case"POUR":return this.encoder.uploadPour(r.globalIndex,e);case"POURED":return this.encoder.uploadPoured((i=r[0])==null?void 0:i.getParent().globalIndex,e);case"IMAGE":return this.encoder.uploadImage(r.globalIndex,e);case"OBJ":return this.encoder.uploadObj(r.globalIndex,e);case"TEARDROP":return this.encoder.uploadTeardrop(r.globalIndex,e);case"STRING":return this.encoder.uploadString(r.globalIndex,e);case"ATTR":return this.encoder.uploadAttr(r.globalIndex,e);case"DIMENSION":return this.encoder.uploadDimension(r.globalIndex,e);case"COMPONENT":return this.encoder.uploadComponent(r.globalIndex,e);case"PAD_NET":return this.encoder.uploadPadNet(e);case"RULE_TEMPLATE":return this.encoder.uploadRuleTemplate(e);case"RULE":return this.encoder.uploadRule(e);case"RULE_SELECTOR":return this.encoder.uploadRuleSelector(e);case"EQLEN_GRP":return this.encoder.uploadEQLenGrp(r.number,e);case"SHELLCUT":return this.encoder.uploadShellCut(r.globalIndex,e);case"SHELL_ENTITY":return this.encoder.uploadShellEntity(r.globalIndex,e);case"SHELL":return this.encoder.uploadShell(r.globalIndex,e);case"CREASE":return this.encoder.uploadCrease(r.globalIndex,e);case"BOSS":return this.encoder.uploadBoss(r.globalIndex,e);case"PANELIZE":return this.encoder.uploadPanelize(e);case"SILK_OPTS":return this.encoder.uploadSilkOpts(r.layerId,e);case"PREFERENCE":return this.encoder.uploadPreference(e);case"INNER":return this.encoder.uploadLayerFill(r[0].layerId,e)}}upload2Compiler(t,e,r){var n,s;if(this.compiler==null)return;let i=this.doctype!=3;switch(t){case"PAD":{(i||r.getParent()==null)&&this.compiler.uploadPad(r.globalIndex,e);break}case"POLY":{(i||r.getParent()==null)&&this.compiler.uploadPoly(r.globalIndex,e);break}case"POUR":{(i||r.getParent()==null)&&this.compiler.uploadPour(r.globalIndex,e);break}case"POURED":{((s=(n=r[0])==null?void 0:n.getParent())==null?void 0:s.globalIndex)!=null&&this.compiler.uploadPour(r.globalIndex,e);break}case"INNER":{e[0]&&this.compiler.uploadLayerFill(e[0].layerId,e);break}case"FILL":{(i||r.getParent()==null)&&this.compiler.uploadFill(r.globalIndex,e);break}case"FPC_FILL":{(i||r.getParent()==null)&&this.compiler.uploadFpcFill(r.globalIndex,e);break}case"REGION":{(i||r.getParent()==null)&&this.compiler.uploadRegion(r.globalIndex,e);break}case"PARTITION":{this.compiler.uploadPartition(r.globalIndex,e);break}case"ARC":{(i||r.getParent()==null)&&this.compiler.uploadArc(r.globalIndex,e);break}case"LINE":{(i||r.getParent()==null)&&this.compiler.uploadLine(r.globalIndex,e);break}case"VIA":{(i||r.getParent()==null)&&this.compiler.uploadVia(r.globalIndex,e);break}case"STRING":{(i||r.getParent()==null)&&this.compiler.uploadString(r.globalIndex,e);break}case"ATTR":{this.compiler.uploadAttr(r.globalIndex,e);break}case"FONT":this.compiler.uploadFont(e);break;case"IMAGE":{(i||r.getParent()==null)&&this.compiler.uploadImage(r.globalIndex,e);break}case"OBJ":{(i||r.getParent()==null)&&this.compiler.uploadObj(r.globalIndex,e);break}case"DIMENSION":{(i||r.getParent()==null)&&this.compiler.uploadDimension(r.globalIndex,e);break}case"DIMENSIONATTR":{this.compiler.uploadAttr(r.globalIndex,e);break}case"LAYER":{this.compiler.uploadLayer(r.layerId,e);break}case"LAYER_PHYS":{this.compiler.uploadLayerPhys(r.layerId,e);break}case"ACTIVE_LAYER":{this.compiler.uploadActiveLayer(e);break}case"COMPONENT":{this.compiler.uploadComponent(r.globalIndex,e);break}case"CANVAS":{this.compiler.uploadCanvas(e);break}case"PAD_NET":{this.compiler.uploadPadNet(e);break}case"PRIMITIVE":{this.compiler.uploadPrimitive(r,e);break}case"GROUP":{this.compiler.uploadGroup(r.globalIndex,e);break}case"NET":{this.compiler.uploadNet(r,e);break}case"TEARDROP":{this.compiler.uploadTeardrop(r.globalIndex,e);break}case"FONT":break;case"RULE_TEMPLATE":{this.compiler.uploadRuleTemplate(e);break}case"RULE":{this.compiler.uploadRule(e);break}case"RULE_SELECTOR":{this.compiler.uploadRuleSelector(e);break}case"SHELL":{this.compiler.uploadShell(r.globalIndex,e);break}case"CREASE":{this.compiler.uploadCrease(r.globalIndex,e);break}case"SHELLCUT":{this.compiler.uploadShellCut(r.globalIndex,e);break}case"SHELL_ENTITY":{this.compiler.uploadShellEntity(r.globalIndex,e);break}case"BOSS":{this.compiler.uploadBoss(r.globalIndex,e);break}case"PANELIZE":{this.compiler.uploadPanelize(e);break}case"SILK_OPTS":{this.compiler.uploadSilkOpts(r.layerId,e);break}case"EQLEN":case"EQLEN_GRP":{this.compiler.uploadEQLenGrp(r.number,e);break}case"PREFERENCE":{this.compiler.uploadPreference(e);break}default:break}}};function Aw(o,t,e){let r=new Bue("2.0",t),i=e!=null?e:r.getFileType(o),n=r.feed(i,o);return new ng().parse(i,n,1,o.globalIndex,o.number)}function _$(o){if(o instanceof ki)switch(o.modelType){case"Pad":case"Via":return"PAD_NET";case"Text":return o instanceof Li&&o.key!=""?"ATTR":null;default:return null}return null}function v$(o,t,e,r,i=!0){if(e==null)return null;switch(e){case"ATTR":return Cp(o,r,i)?Aw(o,t,e):null;default:return Aw(o,t,e)}}function uAe(o,t,e){let r=gh.getInstance().getItem(t.deviceUUID);if(r!=null&&(r.overlapValue(o),e)){let i=t.attrKeyValue[o.key];i!=null&&i!=o.value&&o.key!="Name"&&(o.value=i)}}function WXe(o,t){switch(t.modelType){case"Via":return o.deleteVia(t.globalIndex);case"Pad":return o.deletePad(t.globalIndex);case"Track":return o.deleteLine(t.globalIndex);case"ArcTrack":return o.deleteArc(t.globalIndex);case"Image":return o.deleteImage(t.globalIndex);case"Picture":return o.deleteObj(t.globalIndex);case"Text":return t.key!=""?o.deleteAttr(t.globalIndex):o.deleteString(t.globalIndex);case"Length Dimension":case"Protractor Dimension":case"Radius Dimension":return o.deleteDimension(t.globalIndex);case"Component":return o instanceof dz?o.deleteComponent(t.globalIndex):void 0;case"Rect":case"Circle":case"Polygon":{let e=t,r=e.type,i=e.globalIndex;switch(r){case"Board Outline":case"Line":return o.deletePoly(i);case"Fill Region":case"Slot Region":return o.deleteFill(i);case"Prohibited Region":case"Constraint Region":return o.deleteRegion(i);case"Copper Region":return o.deletePour(i);case"Partition":return o instanceof dz?o.deletePartition(i):void 0;case"TearDrop":return o.deleteTeardrop(i);case"FPC Stiffener":return o.deleteFpcFill(i);case"3D Shell - Outline":return o.deleteShell(i);case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return o.deleteShellEntity(i);case"3D Shell - Side Datum Line":return o.deleteCrease(i);case"3D Shell - Screw Pillar":return o.deleteBoss(i);case"Board":return o.deleteBoard()}}default:console.warn(`deleteUpload: \u672A\u77E5\u7684 modelType ${t.modelType}`);break}}function Fue(o,t,e,r){let i=t instanceof Je||t instanceof It;o.deleteItem(t);let n=o.getComponents();for(let s of n){i&&s.initPadNet();let a=s.globalIndex+t.globalIndex,l=WA(t.modelType,a);if(l==null&&t instanceof Li&&t.key!=""&&(l=s.attrKeyText[t.key]),l!=null)if(l instanceof Li&&l.key!=""){let c=_$(l);if(v$(l,3,c,s,!1)==null&&l.key!="Device"&&l.key!="Footprint"){let u=null;s.attrKeyValue[l.key]!=t.value&&(u=s.attrKeyValue[l.key]),e(t,a),u!=null&&s.addATTRMap(l.key,u)}}else e(t,a);s.initBox(),r(s.modelType,s.globalIndex,t)}t instanceof Li&&t.key!=""&&o.deleteAttrDecode(t.key)}var zXe=new RegExp(/(_([0-9]+))$/),dU=class extends X3{constructor(t){super(),this.footprint=t,this.origin=t.origin}build(){let t=this.footprint.getComponents(),{restoreMap:e,moveMap:r}=this.getMatrixMap();for(let i of this.models){if(this.footprint.getModelBy(i.modelType,i.globalIndex)==null){this.footprint.addItem(i);for(let s of t)s.initBox(),this.updateShape(wT(s.modelType,s.globalIndex))}else{this.footprint.updateBBox();for(let s of t)s.initBox()}for(let s of t){let a=s.globalIndex+i.globalIndex,l=WA(i.modelType,a);l==null&&i instanceof Li&&i.key!=""&&(l=s.attrKeyText[i.key]);let c;if(l==null){l=this.footprint.clone(i,a),l instanceof Li&&l.key!=""&&uAe(l,s,!0);let h=r.get(s);l.transform(h),1!==s.layerId&&s.flipShape(l),l.globalIndex=a,this.bindParent(l,s)}else{this.updateTearDropInfo(l.modelType,a,"modify");let h=s.layerId!=1;h&&s.flipShape(l);let u=e.get(s);if(l.transform(u),!this.update4Template(i,l)){let p=_$(l),m=v$(l,3,p,s),g=this.map.get(i);g.model=l,g.load(),m!=null?(m instanceof uR&&(m.parentModel=s),m.model=l,m.load()):p=="ATTR"&&uAe(l,s,!1)}let d=r.get(s);l.transform(d),h&&s.flipShape(l),l instanceof Li&&l.key!=""&&s.modifyATTRMap(l.key,l.value),c=wT(l.modelType,a)}this.updateShape(c),this.refreshComponentItemStatus(s)}if(i instanceof Li&&(i.outlineModified=!1),i instanceof Li&&i.key!=""){let s=this.map.get(i);if(s!=null&&this.footprint.updateAttrDecode(s),i.key==="Footprint"&&i.value!=this.footprint.id){this.footprint.id=i.value;for(let a of t){a.modifyATTRMap("Footprint",i.value);let l=a.attrKeyText.Footprint;l&&(l.value=i.value);let c=wT("Component",a.globalIndex);c&&ie.publish("hasModifyPcbItem",c)}}}}for(let[,i]of this.layers)this.footprint.updateLayer(i);km.historyFlushService(),this.clear()}update4Template(t,e){if(!H4.isRender4GPU)return!1;switch(t.modelType){case"Pad":return e.model=t,e.updateShapeData(),!0;case"Via":return e.model=t,e.updateShapeData(),!0;case"Image":return e.model=t,e.updateShapeData(),!0;case"Picture":return e.model=t,e.updateShapeData(),!0;case"Polygon":{let r=e,i=r.childrens;for(let s of i)for(let a of s)a.remove();r.model=t,r.updateShapeData();let n=[];for(let s of t.childrens){let a=new Array;for(let l of s)if(l instanceof ys){let c=new G8(l.globalIndex,l,r);a.push(c)}else if(l instanceof nl){let c=new U8(l.globalIndex,l,r);a.push(c)}n.push(a)}return r.childrens=n,!0}case"Rect":return e.model=t,e.updateShapeData(),!0;case"Circle":return e.model=t,e.updateShapeData(),!0;case"Text":return t.key!=""?!1:(e.model=t,e.updateShapeData(),!0);default:return!1}}getModelBy(t,e){return this.footprint.getModelBy(t,e)}getCombination(t){}addCombination(t){}getCanvas(){return this.footprint}updateOrigin(){let t=this.footprint.getComponents(),e=this.origin.sub(this.footprint.origin),r=Ae.translate(e.x,e.y,0),{restoreMap:i,moveMap:n}=this.getMatrixMap(),s=this.footprint.getItems();for(let a of t){let l=i.get(a),c=n.get(a);for(let[,h]of s){let u=a.globalIndex+h.globalIndex,d=WA(h.modelType,u);if(d==null&&h instanceof Li&&h.key!=""&&(d=a.attrKeyText[h.key]),d==null)continue;this.updateTearDropInfo(d.modelType,u,"modify");let p=a.layerId!=1;if(p&&a.flipShape(d),d.transform(l),!this.update4Template(h,d))if(d instanceof Li&&d.key!=""){let g=_$(d);v$(d,3,g,a)==null&&d.transform(r)}else d.transform(r);d.transform(c),p&&a.flipShape(d);let m=wT(d.modelType,u);this.updateShape(m)}a.initBox(),this.refreshComponentItemStatus(a)}km.historyFlushService(),this.clear(),this.origin=this.footprint.origin}bindParent(t,e){let r=$c(t),i=wT("Component",e.globalIndex);i!=null&&r.getParent()==null&&(r instanceof fr&&r.key!=""?i.addAttribute(r):(r instanceof Le&&e.isCachePadNet()&&(r.net=i.getNet(r.num,r.globalIndex)),i.addCompositionItem(r)))}refreshComponentItemStatus(t){let e=wT("Component",t.globalIndex);e&&(e.updateView=!1)}updateTearDropInfo(t,e,r){let i=wT(t,e);(i instanceof Le||i instanceof Ar||i instanceof Si||i instanceof Ge)&&ie.publish("cheakTearDrop",new Em(r,i.toJSON(),i))}updateShape(t){t!=null&&(sw(t),this.addGroup(t),t.refreshRender(),ie.publish("hasModifyPcbItem",t))}getMatrixMap(){let t=this.footprint.getComponents(),e=this.footprint.origin,r=new Map,i=new Map;for(let n of t){let s=n.layerId==2?(Math.PI-n.rotation)%Vr:n.rotation,a=Ae.translate(-e.x,-e.y,0).rotateZ(s).translate1(n.position.x,n.position.y,0),l=Ae.translate(-n.position.x,-n.position.y,0).rotateZ(-s).translate1(e.x,e.y,0);r.set(n,l),i.set(n,a)}return{restoreMap:r,moveMap:i}}addGroup(t){let e=t.model.getGroupID();if(e!=null){let r=kt.getItem(e);if(r==null)r=kt.rebuild(e,[t]);else if(r.addItem(t),t instanceof Me&&t.attrsMap["Reuse Block"]==null){let i=r.name;i!=null&&zXe.test(i)&&(t.reuseBlock=i.replace(zXe,""),t.combinationID==""&&(t.combinationID=i.replace(t.reuseBlock+"_","")))}}}getLayer(t){return null}addNet(t){}getLayerPhy(t){}getNetModel(t){}deleteModel(t){super.deleteModel(t),Fue(this.footprint,t,q3,(e,r,i)=>{this.updateShape(wT(e,r))}),t instanceof Li&&t.key!=""&&this.footprint.deleteAttrDecode(t.key)}deleteLayer(t){super.deleteLayer(t),this.footprint.deleteLayer(t)}};var x$=class extends so{constructor(e,r,i){super();this.changeList=new Array;this.changes=new Map;this.footprint=e,this.action=r;for(let[n,s]of i){if(n!="add"){let a=s.clone();this.changes.set(s.globalIndex,a)}this.changeList.push([n,s.globalIndex])}}snapshotModel(e){let r=Aw(e,4);return r.clearFootExcludeProps(),this.extractData(r)}extractData(e){let r={},i=e;for(let n of Object.keys(e)){let s=i[n];typeof s!="function"&&(r[n]=s)}return r}applyData(e,r){if(!r)return;let i=Aw(e,4);i.model=e;let n=i;for(let s of Object.keys(r))s in i&&(n[s]=r[s]);i.load()}rebuild(){Wi.getInstance().getItem(this.footprint)!=null&&this.modify()}remove(){this.modify()}modify(){let e=Wi.getInstance().getItem(this.footprint),r=new Array,i=new Map;for(let[n,s]of this.changeList){let a=this.changes.get(s),l=e.getItems().get(s);switch(n!="add"&&a==null&&console.error("Custom footprint shape lossed!!!"),n){case"add":{i.set(s,l.clone()),r.push(["delete",s]),e.deleteItem(l),Fue(e,l,q3,(c,h,u)=>{let d=wT(c,h);d!=null&&(sw(d),d.refreshRender(),A.publish("hasModifyPcbItem",d))});break}case"modify":{let c=this.snapshotModel(a);r.push(["modify",s]),i.set(s,l.clone()),this.applyData(l,c);break}default:{r.push(["add",s]);let c=Aw(a,4),h=new dU(e);h.addModel(a.clone(),c),h.build();break}}}r.reverse(),this.changeList=r,this.changes=i}getItem(){return"ignore"}async upload(e=!1){let r=Wi.getInstance().getItem(this.footprint);if(r==null)return;let i=r.getInstance(),n=new hu("2.0",4,i);for(let[s,a]of this.changeList)if(s!="delete"){let l=r.getItems().get(a);n.feedItem(l)}else{let l=this.changes.get(a);WXe(i,l)}i==null||i.save()}updateData(){}};var $f=class{constructor(){this.refreshService=!1}async updateCustomFootprint(t,e,r){let i=Wi.getInstance().getItem(t.footprintUUID),n=i.getOrigin(),s=t.layerId;t.layerId=1;let a=t.position,l=t.rotation,c=Ae.translate(-a.x,-a.y,0).rotateZ(-l).translate1(n.x,n.y,0),h=Ae.translate(-n.x,-n.y,0).rotateZ(l).translate1(a.x,a.y,0);t.transform(c);let u="modify",d=new Array;if(!(i instanceof Xc)){let p=x.getInstance().id+"_"+t.globalIndex,m=Wi.getInstance().getItem(p);m!=null&&(await m.destroy(),Wi.getInstance().deleteById(p)),u="add";let g=await Wi.getInstance().cloneFootprint(i,p);if(g){t.footprintUUID=p,g.add(t.model),i.delete(t.model),g.modifyName(t.name,t.name),i=g,this.saveCommonData(i,n);let y=new hu("2.0",bi.PCB,x.getInstance().compiler);x.getInstance().compiler.setTicket(),y.feedItem(t.attrKeyText.Footprint.model)}}this.generateFootprint(t,i,d,r),t.transform(h),t.layerId=s,e!=null&&!(u=="modify"&&d.length==0)&&e.addCommand(new x$(i.uuid,u,d)),this.refreshService&&ie.publish("hasModifyPcbItem",t),this.refreshService&&ie.publish("flushService","")}saveCommonData(t,e){let r=x.getInstance().origin;x.getInstance().origin=e;let i=new hu("2.0",bi.FOOTPRINT,t.getInstance());i.feed("CANVAS"),$e.getInstance().getAllItem().forEach(a=>{i.feed("LAYER",a)}),$e.getInstance().getLayerPhys().forEach(a=>{i.feed("LAYER_PHYS",a)}),i.feed("ACTIVE_LAYER"),x.getInstance().origin=r}deletePad(t,e,r){let i=Wi.getInstance().getItem(e.footprintUUID);if(i instanceof Xc&&t.globalIndex.startsWith(e.globalIndex)){let n=t.globalIndex.replace(new RegExp("^"+e.globalIndex),""),s=i.getModelBy("Pad",n);r.addCommand(new x$(i.uuid,"modify",[["delete",s.clone()]])),i.deleteItem(s)}}generateFootprint(t,e,r,i){if(i!=null&&i.length>0){let n=this.removePrefix(i,t);for(let s of i){let a=s.model.clone();if(!(a instanceof ki))continue;let l=e.getModelBy(a.modelType,s.globalIndex);l==null?(l=a,r.push(["add",l.clone()]),e.addItem(a)):r.push(["modify",l.clone()]);let c=Aw(a,bi.FOOTPRINT);c.clearFootExcludeProps(),c.model=l,c.load();let h=s.model;(h instanceof HS||h instanceof U4)&&h.reset4Model(l)}this.recoverPrefix(i,n),this.replaceModel(t,e)}}replaceModel(t,e){let r=t.getItems(),i=this.removePrefix(r,t);for(let n of r)if(n instanceof Le||n instanceof Ge){let s=e.getModelBy(n.model.modelType,n.globalIndex),a=n.model;(a instanceof HS||a instanceof U4)&&a.reset4Model(s)}this.recoverPrefix(r,i)}removePrefix(t,e){let r={};for(let i of t)if(i.globalIndex.startsWith(e.globalIndex)){let n=i.globalIndex.replace(new RegExp("^"+e.globalIndex),"");r[n]=i.globalIndex,i.globalIndex=n}return r}recoverPrefix(t,e){for(let r of t){let i=e[r.globalIndex];i!=null&&(r.globalIndex=i)}}};var Vue=class{constructor(){this._hightType="darked";this._tempHight=!0;this._dragDarked=!0}get hightType(){return this._hightType}set hightType(t){this._hightType=t}get tempHight(){return this._tempHight}set tempHight(t){this._tempHight=t}get dragDarked(){return this._dragDarked}set dragDarked(t){this._dragDarked=t}};var R9=class{constructor(t,e,r,i){this.cbs=new Array;this._referX=t,this._referY=e,r.forEach(n=>{this.cbs.push(n)}),this.checkCb=i}setReferPointSuccess(t,e){return this.checkCb!=null?this.checkCb(t,e):!0}setReferPoint(t,e){this._referX=t,this._referY=e,this.cbs.forEach(r=>{r(t,e)})}get referX(){return this._referX}set referX(t){this._referX=t}get referY(){return this._referY}set referY(t){this._referY=t}};function YXe(o){switch(o){case"OFFSET_ABSOLUTE":{ie.publish("openMainDialog",{cmd:0,data:{option:{unit:x.getInstance().unit}}});break}case"OFFSET_RELATIVE":{let t=new R9(0,0,[(r,i)=>{let n=x.getInstance().unit;ie.publish("openMainDialog",{cmd:22,data:{option:{unit:n,refPoint:{x:Bs(r-x.getInstance().origin.x,"mil",n)*10,y:Bs(i-x.getInstance().origin.y,"mil",n)*10}}}})}]),e={command:"referencePoint",program:t,msg:"Please select a reference point"};ie.publish("toggle",e);break}}}function jXe(o){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let t=!1,e=new ve("flip to "+be.getLayer(o).name);for(let r of this.components)if(r.layerId!=o){ie.publish("hasModifyPcbItem",r);let i=Te.dispatch(r,"modify");e.addCommand(i),r.layerId=o,r.click(),t=!0}t&&(je.executeCommand(e),ie.publish("flushService",""))}function R$(o=!0){J_(o)}function J_(o=!0,t=Ve.getSelects()){!x.getInstance().isactive||23==x.getInstance().doctype||ls.getInstance().init(t,"flip to OppositeLayer",(e,r)=>{let i=new Set;for(let l of e)if(l instanceof Le)l.getParent()==null&&i.add(l);else if(l instanceof mt||l instanceof vt){let c=l.getParent();c!=null&&c instanceof ct&&c.getParent()==null&&i.add(c)}else l instanceof Ye?l.getParent()==null&&i.add(l):l instanceof Ph||i.add(l);i.forEach(l=>r.addCommand4Item(l,"modify"));let n=new _e;for(let l of i)n.ext1(l.buildBBox());let a=n.build1().center();for(let l of i){let c=l.layerId,h;(G2(c)||ms(c))&&(h=Mg(c)),c==12&&l instanceof Le&&l.oppositeLayer();let u;l instanceof Me||l instanceof fr?u=l.position:l instanceof n0?u=l.start:u=l.buildBBox().center();let d=Ae.translate((a.x-u.x)*2,0,0),p=Ae.translate(-a.x,-a.y,0).scale(-1,1,1).translate1(a.x,a.y,0),m=[];if(l instanceof Me)h&&(l.layerId=h),l.transform(d);else if(l instanceof fr||l instanceof n0){let g=l.getParent();(g==null||!i.has(g))&&(h&&(l.layerId=h),l.transform(d))}else if(l instanceof Le)l.getParent()==null&&(h&&(l.layerId=h),l.transform(p));else if(l instanceof mt||l instanceof vt){let g=l.getParent();if(g!=null&&g instanceof ct){let y=g.globalIndex;if(g.getParent()==null){if(!m.includes(y))m.push(y);else continue;h&&(g.layerId=h),g.transform(p)}}}else l instanceof Ye?l.getParent()==null&&(h&&(l.layerId=h,gn.changeModelLayer(l,void 0,r.getCommand())),l instanceof nr?(l.start=l.getUR().multiply4(p),l.rotation=Math.PI*2-l.rotation):l.transform(p)):(h&&(l.layerId=h),l.transform(p));l.click()}o&&(r.checkOutlines(Array.from(i),new Set),ie.publish("flushSelectingInfo","")),Pr.model=Pr.model})}function D$(o){!x.getInstance().isactive||23==x.getInstance().doctype||ls.getInstance().init(Ve.getComponents(),"flip to OppositeLayer",(t,e)=>{let r=!1;for(let i of t)i instanceof Me&&i.layerId!=o&&(e.addCommand4Item(i,"modify"),i.layerId=o,i.click(),r=!0);be.setActiveLayerId(o),r&&(e.execute(),ie.publish("flushSelectingInfo",""))})}function XXe(o){switch(o){case"MOVE_BY_CENTER_POINT":Ve.moveByCenterPoint();break;case"MOVE_BY_ORIGIN_POINT":Ve.moveByOriginPoint();break;case"MOVE_BY_REFERENCE_POINT":Ve.toggleMoveByRefer();break}}var bN=class bN extends wi{constructor(){super(...arguments);this.updateIds=new Set}static getInstance(){return bN.manager==null&&(bN.manager=new bN),bN.manager}updateItem(e){let r=e.globalIndex;this.updateIds.has(r)&&this.map.set(r,e)}addItem(e){let r=e.globalIndex;this.map.set(r,e),this.updateIds.add(r)}recycle(){super.recycle(),this.updateIds.clear()}delete(e,r){this.updateIds.has(r)&&(e instanceof mt||e instanceof kB)&&this.map.delete(r)}};bN.manager=null;var vb=bN;var PN=class PN{constructor(){this.selectIds=new Map;this.hasRecode=!1}static getInstance(){return PN.tool==null&&(PN.tool=new PN),PN.tool}modify(){this.hasRecode&&(this.hasRecode=!1,this.selectIds.clear(),vb.getInstance().recycle())}stash(){if(this.hasRecode)return;let t=Ve.getSelects(),e;if(t.length>0){let i,n=vb.getInstance();this.hasRecode=!0;for(let s of t){if(e=s.model,i=e.modelType,i=="Line"||i=="Arc"){n.addItem(s);continue}this.addMap(this.selectIds,i,e.globalIndex)}}let r=Ve.getAnnotationItems();if(r.length>0){this.hasRecode=!0;for(let i of r)e=i.model,this.addMap(this.selectIds,e.modelType,e.globalIndex)}}addMap(t,e,r){if(e==null)return;let i=t.get(e);i==null&&(i=new Set,t.set(e,i)),i.add(r)}pop(){if(this.hasRecode){let r=function(i){i&&(i.updateFilterVisible=!0,i.click(),t.push(i))},t=[],e=new er;this.selectIds.forEach((i,n)=>{let s;if(n=="Ratline"){let l=zo;for(let c of i)s=l.getRatlineById(c),r(s);return}let a=e.getManageByType(n);if(a)for(let l of i)s=a.getItem(l),r(s)}),vb.getInstance().iterator(i=>{r(i)}),Ve.select(t,void 0,!1)}}};PN.tool=null;var TN=PN;var gDt=["Board Outline","Copper Region","Fill Region","Slot Region","Prohibited Region","Constraint Region","FPC Stiffener","3D Shell - Outline","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Side Entity","3D Shell - Top/Bottom Entity"];function pU(o){let t,e=o||Ve.getSelects();for(let r of e)if(pAe(r)){t=r;break}t==null?A.publish("tool","SelectHelp"):A.publish("toggle",{command:"editOutline",item:t})}function pAe(o){return o instanceof fn?!0:o instanceof Ye?o.type==="Line"?!!(o instanceof nr||o instanceof Sr||o instanceof ct&&o.isClose()):gDt.includes(o.type):!1}function fAe(o,t){let e,r=Number.MAX_SAFE_INTEGER;for(let i of o){let n;i instanceof mt?n=LM(t.x,t.y,i.start.x,i.start.y,i.end.x,i.end.y):n=yDt(t,i),n<r&&(r=n,e=i)}return e}var qXe=new th(.01);function Gue(o,t,e=.02){return!!(qXe.eq(o.direct.cross(t.sub(o.start())),0)&&o.bbox().extendSize(e).isContains(t))}function Uue(o,t,e=.02){let r=t.sub(o.center);if(qXe.eq(r.length(),o.rx)&&o.bbox().extendOfSize(e).isContains(t)){r=r.normalize();let i=o.start().sub(o.center).normalize(),n=o.end().sub(o.center).normalize();return Math.abs(o.sweepAngle)<180?kT(r,i,n):!kT(r,i,n)}return!1}function yDt(o,t){let{center:e,radius:r,startAngle:i,endAngle:n,sweep:s}=t,a=o.x-e.x,l=o.y-e.y,c=Math.sqrt(a*a+l*l);if(c<1e-8)return r;let h=dAe(Math.atan2(l,a)),u=dAe(i),d=dAe(n),p=new S(e.x+r*Math.cos(u),e.y+r*Math.sin(u)),m=new S(e.x+r*Math.cos(d),e.y+r*Math.sin(d));if(bDt(h,u,d,s))return Math.abs(c-r);{let y=o.distance1(p),b=o.distance1(m);return Math.min(y,b)}}function dAe(o){return o=o%(2*Math.PI),o<0?o+2*Math.PI:o}function bDt(o,t,e,r){return Math.abs(t-e)<1e-8?!0:r?t<=e?o>=t&&o<=e:o>=t||o<=e:e<=t?o>=e&&o<=t:o>=e||o<=t}var s1=class s1 extends wi{constructor(){super();this.items=new Array;this.logger=new Gi(1);this.selections=new Array;this.mouseLeftDown=!1;this.mouseLeftUp=!1;this.mouseLeftUpX=0;this.mouseLeftUpY=0;this.mouseLeftX=0;this.mouseLeftY=0;this.mouseFrameX=0;this.mouseFrameY=0;this.mouseRightX=0;this.mouseRightY=0;this.mouseRightFrameX=0;this.mouseRightFrameY=0;this.components=new Array;this.tracks=new Array;this.lines=new Set;this.rectSelectId=null;this.currentPointSelectedItems=Array();this.target="click-canvas-blank";this.highlight=A9.getInstance();this.highlightComponentWhenMoveText=new due;this.readyToCopyDragging=!1;this.keepSelection=!1;this.isSpecialPaste=!1;this.selectAnnotations=[];this.hasBottomTipIds=new Set;this.realTimeHighlight=!1;this.tabSwitch=new uue;this.selectionOrder=new Map;this.selectionOrderNumber=0;this.dragging=!1;this.drcItems=new Set;this.isClick=!1;this.selectRepeater=!0;ie.subscribe("removeSelect",this.delete.bind(this)),ie.subscribe("select",this.select.bind(this)),ie.subscribe("onlySelect",this.onlySelect.bind(this)),ie.messageBus.rpcService("copyItems",this.copy.bind(this)),ie.subscribe("clearSelect",this.clearSelect.bind(this)),ie.subscribe("flushSelectingInfo",this.flushSelect.bind(this)),ie.subscribe("updateNetwork",this.updateNetwork.bind(this)),ie.subscribe("updateHightShow",this.updateHightLightShow.bind(this)),ie.subscribe("highLight",this.highLight.bind(this)),ie.subscribe("restoreHight",this.restoreHighLight.bind(this)),ie.subscribe("highlightValue",this.highlightValue.bind(this)),ie.subscribe("changeHighlightValue",this.changeHighlightValue.bind(this)),ie.subscribe("stashHight",this.stashHighLight.bind(this)),ie.subscribe("selectAll",this.selectAll.bind(this)),ie.subscribe("updatePCBDeviceFootprint",this.modifyCurrentTemplate.bind(this)),ie.subscribe("refreshHighLigth",()=>{this.highlight.refreshHighLigth()}),ie.subscribe("rotation",e=>{this.rotation(e)}),ie.messageBus.rpcService("pcb/closePcbPage",this.closePcbPage.bind(this))}get dialog(){return this._dialog}set dialog(e){e?Wr.validType=e.tool.validType:Wr.validType=null,this._dialog=e}getDRCItems(){return this.drcItems}onKeyDown(e){let r=yi.getScene(),i=sr.getAction(r,e);if(Bt.isChildPcb()&&this.target=="select-device"&&i!=null&&["Copy","cut","Delete Selected","Duplicate","DuplicateToCursor","DuplicateToOtherLayer","editArray"].includes(i))return;let n=new S(e.realSceneX,e.realSceneY);if(this.mouseLeftDown){if(this.items.length>0){yi.setArea(["Scroll Right","Scroll Up","Scroll Down","Scroll Left","place","switchToLayer(1)","switchToLayer(2)"]);let a=yi.getScene();i=sr.getAction(a,e)}switch(i){case"Rotate Left":{Pr.rotate();break}case"rotate_right":{Pr.rotate(-ce.pcbConfig.rotate);break}case"switchToLayer(1)":{Pr.onMouseLeftUp(e),D$(1),Pr.onMouseLeftDown(e);break}case"switchToLayer(2)":{Pr.onMouseLeftUp(e),D$(2),Pr.onMouseLeftDown(e);break}case"flip2OppositeSide":{Pr.onMouseLeftUp(e),R$(),Pr.onMouseLeftDown(e);break}case"Scroll Down":{ie.publish("Scroll Down",{});break}case"Scroll Up":{ie.publish("Scroll Up",{});break}case"Scroll Right":{ie.publish("Scroll Right",{});break}case"Scroll Left":{ie.publish("Scroll Left",{});break}case"Cancel":{this.cancel({clearSelect:!1});break}case"place":{this.onMouseLeftUp(e);break}default:{Pr.onKeyDown(e);break}}Qg.set(e);return}let s=!0;switch(i){case"convertToBoard":{m$();break}case"Backspace":{let a=this.getSelects(),l=new bue(Array.from(a)),c=new ve("backspace track");l.backspace(c),je.executeCommand(c);let h=l.getSelectItem();h.forEach(u=>{u.click()}),ie.publish("select",h),ie.publish("flushService",""),l.complete()}break;case"Delete Selected":{this.delete();break}case"Rotate Left":{this.rotation(ce.pcbConfig.rotate);break}case"rotate_right":{this.rotation(-ce.pcbConfig.rotate);break}case"Undo":{ie.publish("undo","");break}case"Redo":{ie.publish("redo","");break}case"Move by Center Point":{ie.publish("batchMove","MOVE_BY_CENTER_POINT");break}case"Flip Right and Left":{ie.publish("turn","turnAround");break}case"Flip Up and Down":{ie.publish("turn","turnUpsideDown");break}case"selectedBSSaveAsCloud":case"selectedBSSaveAsLocal":{ie.publish("Pcb/doCommand",i,$());break}case"Copy":{ie.publish("tool","COPY");break}case"copyToSvg":ie.publish("copyToSvg","");break;case"copyToPng":ie.publish("copyToPng","");break;case"cut":{ie.publish("tool","CLIP");break}case"Paste":{this.isSpecialPaste=!1;try{navigator.clipboard.read().then(a=>{if(a.length>0){let l=a[0].types;if(l&&!l.length)return;for(let c of l)if(!c)return}ie.publish("tool","PASTE")}).catch(()=>ie.publish("tool","PASTE"))}catch{ie.publish("tool","PASTE")}break}case"specialPaste":{this.changeLayerStatus();break}case"Select All":{s=!1,this.selectAll();break}case"Highlight Selected Objects":{this.highLight("HIGHLIGHT_SELECTED_OBJECTS"),s=!1;break}case"Show/Hide Selected Ratline":{ie.publish("toggleSelectedRatline",{type:"allSelected",isCycleSwitch:!0});break}case"Hide Selected Ratline":{this.hideRatlines();break}case"Show Selected Ratline":{this.showRatlines();break}case"Group Selected":{ie.publish("combination",""),s=!1;break}case"displayRealTimeNetLengthAndLengthTolerance":{let a=ce.pcbConfig.showNetLength||ce.pcbConfig.showDiffLength;ce.pcbConfig.showNetLength=!a,ce.pcbConfig.showDiffLength=!a;break}case"Ungroup Selected":{ie.publish("dissolution",""),s=!1;break}case"Join Group":{ie.publish("joinCombination","");break}case"Align Right":{ie.publish("align","align_right");break}case"Align Top":{ie.publish("align","align_top");break}case"Align Vertical Centers":{ie.publish("align","align_vertical_center");break}case"Align Bottom":{ie.publish("align","align_bottom");break}case"Align Grid":{ie.publish("align","align_grid");break}case"Horizontal Equidistant Distribution":{ie.publish("distribute","distribute_horizontal_equidistant");break}case"Vertical Equidistant Distribution":{ie.publish("distribute","distribute_vertical_equidistant");break}case"Component Distribute By Region":{ie.publish("distribute","component_distribute_by_region");break}case"Align Left":{ie.publish("align","align_left");break}case"Align Horizontal Centers":{ie.publish("align","align_horizontal_center");break}case"Select Overlap":{this.selectOverlap(e);break}case"Highlight Or Unhighlight Net":{this.highLight("HIGHLIGHT_NET_LOOP");break}case"changeRoutingAngle":case"Routing Corner":{tr.getInstance().type=jr.getNextType(),we.synchronize();break}case"Cancel":{this.cancel();break}case"Move Selected Left":{let a=St.getInstance().flip?-1:1,l=Ae.translate(-St.getInstance().getSnapX()*a,0,0);_w(e,l),Pr.model=Pr.model;break}case"move_selected_left_by_alt_grid":{let a=St.getInstance().flip?-1:1,{snapX:l}=x.getInstance().getAltGridSize(),c=Ae.translate(-l*a,0,0);_w(e,c),Pr.model=Pr.model;break}case"Move Selected Right":{let a=St.getInstance().flip?-1:1,l=Ae.translate(St.getInstance().getSnapX()*a,0,0);_w(e,l),Pr.model=Pr.model;break}case"move_selected_right_by_alt_grid":{let a=St.getInstance().flip?-1:1,{snapX:l}=x.getInstance().getAltGridSize(),c=Ae.translate(l*a,0,0);_w(e,c),Pr.model=Pr.model;break}case"Move Selected Down":{let a=Ae.translate(0,-St.getInstance().getSnapY(),0);_w(e,a),Pr.model=Pr.model;break}case"move_selected_down_by_alt_grid":{let{snapY:a}=x.getInstance().getAltGridSize(),l=Ae.translate(0,-a,0);_w(e,l),Pr.model=Pr.model;break}case"Move Selected Up":{let a=Ae.translate(0,St.getInstance().getSnapY(),0);_w(e,a),Pr.model=Pr.model;break}case"move_selected_up_by_alt_grid":{let{snapY:a}=x.getInstance().getAltGridSize(),l=Ae.translate(0,a,0);_w(e,l),Pr.model=Pr.model;break}case"showAbsoluteOffsetDialog":{ie.publish("offset","OFFSET_ABSOLUTE");break}case"showRelativeOffsetDialog":{ie.publish("offset","OFFSET_RELATIVE");break}case"toggleLocked":{let a=new cl(this.items,void 0,!0).items;a.size>0&&(Array.from(a).every(c=>c.locked)?this.unlockAllSelect():this.lockAll());break}case"pcbCrossProbe":{ie.messageBus.rpcCall("getPcbCrossProbeToSchData").then(a=>{let{rule:l,hasSelected:c}=a.message;if(!c)ie.publish("tool","crossProbeTool");else{let h={isManualTrigger:!0};ie.windowBridge.publish("cross-window",{selectObj:l,otherData:h,cmd:"crossProbeBetweenWindows"},$())}});break}case"Switch Selected Range When Object Is Selected":{!this.tabSwitch.isTabSwitch&&this.items.length===1?this.tabSwitch.startSwitch(this.items):this.tabSwitch.isTabSwitch&&this.tabSwitch.tabSwitchMsg&&this.tabSwitch.switchRange();break}case"MOVE_BY_REFERENCE_POINT":{ie.publish("batchMove","MOVE_BY_REFERENCE_POINT");break}case"switchToLayer(1)":{D$(1);break}case"switchToLayer(2)":{D$(2);break}case"expandAndModifyProperties":{ie.publish("expandAndModifyProperties","",$());break}default:s=!1;break}Qg.set(e),s&&ie.publish("clearDimension",""),ie.publish("updateFrame","")}onMouseLeftDown(e){e.setIsBoxSelection(!1),this.bbox=void 0;let r=e.realSceneX,i=e.realSceneY;this.mouseLeftDown=!0,this.mouseLeftUp=!1,this.mouseLeftX=r,this.mouseLeftY=i,this.mouseFrameX=e.mouseX,this.mouseFrameY=e.mouseY,BOe.onMouseLeftDown(e);let n=Wr.pointSelectBeforeFilter(r,i).getResult(dm),s=$t.pointFilter(r,i,n);this.classifyTrack(),this.lastItems=Array.from(this.items),this.leftDowSelect=Array.from(this.items),this.currentPointSelectedItems=Array.from(s);let a=e.ctrlKey,l=e.altKey;if(a&&!l)s[0]&&(!(s[0]instanceof Le)||!s[0].getParent())&&ce.pcbConfig.isCtrlDragToCopy&&(this.readyToCopyDragging=!0);else if(Qg.set(e),Pr.onMouseLeftDown(e)||this.pointSelect(r,i,e,"MouseLeftDown"),this.smartSelection(Array.from(n),s),we.smartMode){let c=this.getSelects();c.length==0&&!Vs.justSelectOnePoint?Vs.cancel():c.length==1&&c[0]instanceof Nh&&Vs.state!=2&&Vs.needMoreClickToDrag&&(Vs.needMoreClickToDrag=!1,this.onMouseLeftDown(e))}s[0]||(this.readyToCopyDragging=!1)}onMouseLeftUp(e){if(!e.leftDown)return;let r=this.dragging,i=!1;this.dragging=!1;let n=e.realSceneX,s=e.realSceneY;if(this.mouseLeftDown=!1,this.mouseLeftUp=!0,this.mouseLeftUpX=n,this.mouseLeftUpY=s,this.selections.length>0){this.bbox=new _e().ext6(n,s).ext6(this.mouseLeftX,this.mouseLeftY).build1();let a=this.bbox;this.mouseLeftX>n?St.getInstance().flip?this.boxSelect(a,!0,e.ctrlKey):this.boxSelect(a,!1,e.ctrlKey):St.getInstance().flip?this.boxSelect(a,!1,e.ctrlKey):this.boxSelect(a,!0,e.ctrlKey),this.clearSelectBox(),e.setIsBoxSelection(!0)}else(!e.ctrlKey||r)&&Pr.onMouseLeftUp(e),e.setIsBoxSelection(!1),i=!0,e.ctrlKey&&!r&&(this.selectAnnotations.forEach(a=>{a.visible()}),this.selectAnnotations.length=0,Phe(n,s,!0,this.leftDowSelect),this.crossWindow(),this.mouseSelectedForAPI());!e.ctrlKey&&e.leftClick&&!e.shiftKey&&this.pointSelect(n,s,e,"MouseLeftUp"),!r&&i&&(this.isClick=!e.ctrlKey,this.selectWholeOrSingleTrack(n,s),this.shiftHighLight(e)),we.smartMode&&(Vs.needMoreClickToDrag=!0),Qg.set(e),ie.publish("flushService",!0),this.flushSelect(),bd("default"),this.mouseLeftUp=!1,this.isClick=!1}shiftHighLight(e){let r=e.ctrlKey,i=e.altKey,n=e.shiftKey;if(x.getInstance().doctype==3&&n)if(this.items.length==0)this.highlight.unhighLigthAll();else{r||this.highlight.unhighLigthAll();let s=new Set,a=new Set,l=[],c=[];for(let h of this.items)if(this.highlight.isItemHighlighted(h.globalIndex)){let u=Bo(h);u!=null&&a.add(u),c.push(h)}else{let u=Bo(h);u!=null&&s.add(u),l.push(h)}this.highlight.highLightNets(s),this.addHightObj(l),this.highlight.unhighLightNets(a),this.unHightObj(c),this.clearSelect()}}onMouseMove(e){let r=e.realSceneX,i=e.realSceneY;if(e.hovering=!0,e.hover(),this.mouseLeftDown)if(e.ctrlKey&&this.readyToCopyDragging){if(new Date().getTime()-e.downTime>200){let n=this.mouseLeftX,s=this.mouseLeftY;this.logger.debug3("%s,%s ,%s",333,this.items,this.items.filter(c=>{c.isSelect(n,s)}));let a=Wr.pointSelect(n,s);Ve.getSelects().some(c=>c===a[0])||(this.tempSelects=[a[0]]),ie.publish("updateFlag",!1),ie.publish("toggle",{command:"PASTE2"}),ie.publish("updateFlag",!0),this.readyToCopyDragging=!1,this.mouseLeftDown=!1}}else if(this.selections.length==0&&(!e.ctrlKey||e.ctrlKey&&e.altKey)||this.dragging){if(we.smartMode&&this.getSelects().filter(s=>s instanceof Le||s instanceof Nh).length>1){this.interrupt(),ie.publish("showPcbSlideMsg",["Under smart dimension mode, only one pad or dimension can be dragged at a time!"],$());return}Qg.set(e),Pr.onMouseMove(e)?(this.tracks.length=0,this.lines.clear(),this.rectSelectId=null,this.dragging=!0):this.updateSelectBox(r,i)}else this.updateSelectBox(r,i);else{if(Ta)Ta.onMouseMove(e);else if(we.smartMode){let n=Pr.getControl();return Vs.control=n,(n instanceof eU||n instanceof tU)&&(Vs.control=null),Vs.move(e)}Pr.onMouseUpMove(e)}}onMouseRightDown(e){Pr.onMouseRightDown(e),this.closeActionDialog()}onMouseRightUp(e){if(!(x.getInstance().envFlag=="silk-preview"||!e||!e.openMenu)){if(this.dragging)e.openMenu=!1,this.cancel({clearSelect:!1});else if(!Pr.onMouseRightUp(e)){if($()!==window.parent)return;this.rightClickMenuData(e)}}}onMouseWheel(e){Pr.onMouseWheel(e)}onDoubleClick(e){if(x.getInstance().isReadOnlyMode)return!1;if(!Pr.onDoubleClick(e)){let i=e.realSceneX,n=e.realSceneY,s=Wr.pointSelect(i,n);for(let a of s){let l=a;if(l.isSelect(i,n)){if(l instanceof fr){if(l.key!=""&&x.getInstance().doctype==4&&!we.footprintIsConnectDevice)return;let c=this.getRatio(),h=!0;Bt.isChildPcb()&&l.getParent()&&l.getParent()instanceof Me&&(h=!1),h&&ie.publish("openMainDialog",{cmd:25,data:{text:l,x:e.mouseX/c,y:e.mouseY/c}});for(let u of this.items)u.visible();this.clearItems(),l.click(),this.select([l]);return}else if(!e.ctrlKey&&x.getInstance().doctype===3&&(l instanceof Le||l instanceof Ge)&&this.initialSelect!=null){this.onlySelect([this.initialSelect]);let c=Ss.getInstance("Single wiring");c.doubleClickItem=l,this.addTrack()}BOe.onDoubleClick(e)}if(we.smartMode&&l instanceof Nh){ie.publish("openMainDialog",{cmd:32,data:{option:{value:l.length+l.unit,rulerId:l.globalIndex,unit:l.unit,isNew:!1}}});return}}}}getRatio(e=1){return x.getInstance().getRatio()}interrupt(){var r;let e=new Array;for(let i of this.items)i.isEmpty?ie.publish("delete",i):e.push(i);for(let i of e)if(i.isEmpty)ie.publish("delete",i);else{i.updateFilterVisible=!0;let n=i.getParent();n instanceof ct?(n.iteratorChildren(s=>{s.visible()}),i.visible()):i instanceof _n?(r=te.getInstance().getNet(i.net))!=null&&r.showRatline&&i.visible():i.visible()}for(let i of this.selectAnnotations)i.isEmpty?ie.publish("delete",i):i.isVisible&&(i.updateFilterVisible=!0,i.visible());Bt.cancelHightLightAll(),this.highlight.cancelHighlightUnselect(),this.clearPadAndItemSelect(),this.items.length=0,this.selectAnnotations.length=0,this.components.length=0,this.mouseLeftDown=!1,Pr.model=3,this.clearSelectBox()}cancel({clearSelect:e=!0}={}){let r=e?[]:Array.from(this.items);this.interrupt(),this.items.push(...r),this.flushSelect(),e&&this.crossWindow(),e&&this.mouseSelectedForAPI()}getLastClickPosition(){return new S(this.mouseLeftX,this.mouseLeftY)}getLastUpPosition(){return new S(this.mouseLeftUpX,this.mouseLeftUpY)}isShowCursorMsg(e){ZT.filter(this.items).length>0&&jt.update(e,"Please select a reference point")}selectedConnectedCopper(e,r,i=!1,n){let s=n||Wr.pointSelectBeforeFilter(e,r).getResult(dm),a=new Set;for(let u of s)l(u)&&(u instanceof mt||u instanceof vt?a.add(u.getParent()):a.add(u));if(!a.size)return;function l(u){if(u instanceof Ue||u instanceof Ge||u instanceof Le)return!0;if(u instanceof Ye){let d=be.getLayer(u.layerId);if(d&&d.isSignalLayer())return!0}return!1}let c=Wr.getTouchItems(Array.from(a)),h=new Set;c.forEach(u=>{u instanceof Ye?(u.type=="Fill Region"||u.type=="Line"||u.type=="TearDrop")&&h.add(u):h.add(u)}),i&&this.items.forEach(u=>{h.add(u)}),this.clearSelect(),h=$t.filter(h),h.forEach(u=>{u.click()}),this.select(h),ie.publish("updateFrame",""),Pr.model=1}pointSelect(e,r,i,n){let s=k1.getInstance(),a=!0,l=Wr.pointSelect(e,r);l=Array.from($t.filter(l));let c=Wr.filterPartiton(l);s.setTargetDRCItemsVisible(this.drcItems),this.drcItems.clear(),this.keepSelection&&(this.items.some(d=>c.includes(d))&&(c=this.items,a=!1),this.keepSelection=!1);let h,u=[];if(a){let d=this.mouseLeftDown;Wr.handleClickPourOutline(this.leftDowSelect,!0),this.interrupt(),this.mouseLeftDown=d,c=l,c=Wr.handleClickPour(Wr.filterPartiton(c),this.leftDowSelect),Wr.handleClickPourOutline(this.leftDowSelect,!1),h=c.find(p=>Lo.isAnnotation(p)),c=c.filter(p=>p instanceof Gy?(u.push(p),!1):!0),this.currentPointSelectedItems=c,h?Lo.getInstance().selectPcbAnnotation2(h.globalIndex,void 0,!1):(c.forEach(p=>{p.click()}),ie.publish("selectSource",0),this.select(c))}if(h?Pr.model=1:c.length==1?Pr.model=0:c.length>1?i.ctrlKey?Pr.model=0:Pr.model=1:Pr.model=3,this.drcItems=new Set(u),this.drcItems.size>0){if(n==="MouseLeftDown"){let[d]=this.drcItems;s.setTargetDRCItemsClicked([d])}}else s.resetClickStatus();this.crossWindow(),this.mouseSelectedForAPI()}boxSelect(e,r,i){if(!i){let s=this.mouseLeftDown;this.interrupt(),this.mouseLeftDown=s}let n=new Array;if(r?n=this.leftToRight(e):n=this.rightToLeft(e),n=Wr.filterPartiton(n),n=n.filter(s=>!this.isAnnotation(s)),i){let s=new Set;this.items.forEach(l=>{s.add(l)}),n.forEach(l=>{s.add(l)}),n.length=0;let a=this.mouseLeftDown;this.interrupt(),this.mouseLeftDown=a,s.forEach(l=>{this.isAnnotation(l)||(l.click(),n.push(l))})}this.select(n),n.length==1?Pr.model=0:Pr.model=1,this.crossWindow(),this.mouseSelectedForAPI()}isAnnotation(e){return Lo.isAnnotation(e)}getPrimitiveType(e){let r="";return e instanceof Ri?r="Pad":e instanceof Me?r="Component":e instanceof ca?r="Dimension":e instanceof Rs?r="Picture":e instanceof Yn?r="Image":e instanceof fr?r="Text":e instanceof nr||e instanceof Sr||e instanceof ct?r=e.model.type:e instanceof Ar?r="Track":e instanceof Ge&&(r="Via"),r}crossWindow(){if(window.BroadcastChannel){let e=mw.getCrossProbeData(this.items),r={isManualTrigger:!1};if(ie.publish("cross-window-top",{props:e},$()),!we.isCheckedCrossProbeMode)return;ie.windowBridge.publish("cross-window",{selectObj:e,otherData:r,cmd:"crossProbeBetweenWindows"},$())}}mouseSelectedForAPI(){if(this.items.length>0){let e=[];this.items.forEach(r=>{if(r instanceof Me){let i={primitiveId:r.globalIndex,primitiveType:this.getPrimitiveType(r),net:Bo(r),designator:r instanceof Me?r.model.attrsMap.Designator:null};e.push(i)}else{let i={primitiveId:r.globalIndex,primitiveType:this.getPrimitiveType(r),net:Bo(r)};e.push(i)}}),ie.extensionApiMessageBus2().publish("extensionApi.PCB_Event.mouseEvent",{eventType:"selected",props:e})}}getSelectsById(e){return this.items.find(i=>i.globalIndex==e)}getSelects(){var e;return this.tempSelects&&((e=this.tempSelects)==null?void 0:e.length)>0?this.tempSelects:Array.from(this.items)}getSelectedGroups(){return this.items.filter(e=>{let r=e;return(e instanceof mt||e instanceof vt)&&(r=e.getParent()),!!r.getGroupID()})}clipHandleSelectItem(){let e=this.items.map(r=>((r instanceof mt||r instanceof vt)&&(r=r.getParent()),r));this.items=e}exitLeftDown(){this.mouseLeftDown=!1}updateHightLightShow(){let r=ce.hightShowConfig.hightType=="darked";this.highlight.changeLightShow({isDark:r,force:ce.hightShowConfig.tempHight})}updateNetwork(e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r=new ve("update select item network");for(let i of this.items)if(i instanceof mt||i instanceof vt){let n=i.getParent();n!=null&&n instanceof ct&&(ie.publish("hasModifyPcbItem",n),r.addCommand(Te.dispatch(n,"modify")),n.net=e,ie.publish("hasModifyPcbItem",n))}else i.net!=null&&(ie.publish("hasModifyPcbItem",i),r.addCommand(Te.dispatch(i,"modify")),i.net=e,ie.publish("hasModifyPcbItem",i));r.length>0&&(je.executeCommand(r),ie.publish("flushService","")),this.flushSelect()}flushSelect(e={triggerFrom:"COMMON"}){var n,s;if(x.getInstance().isPreview||this.items.length>0&&this.mouseLeftDown&&this.dragging)return;let r=new Array;for(let a of this.items)a.isEmpty?ie.publish("delete",a):(a.updateFilterVisible=!0,a.click(),r.push(a));for(let a of this.selectAnnotations)a.isEmpty?ie.publish("delete",a):(a.updateFilterVisible=!0,a.click(),r.push(a));ie.publish("selectSource",1);let i=(s=(n=this.tool)==null?void 0:n.getSplitItems())!=null?s:r;this.select(i,e),this.tabSwitch.isTabSwitch=!1,this.tabSwitch.tabSwitchMsg=null,Pr.model=Pr.model}clearTempSelect(){this.tempSelects&&(this.tempSelects.length=0)}clearSelect(e){let{tabId:r}=e||{},i=x.getInstance();if(!([23].includes(i.doctype)||(r?i.tabId!=r:!i.isactive))){for(let n of this.items)n.isEmpty?ie.publish("delete",n):(n.updateFilterVisible=!0,n instanceof _n?te.getInstance().getNet(n.net).showRatline&&n.visible():n.visible());for(let n of this.selectAnnotations)n.isEmpty?ie.publish("delete",n):(n.updateFilterVisible=!0,n.visible());this.clearItems(),this.tabSwitch.isTabSwitch=!1,this.tabSwitch.tabSwitchMsg=null,this.select(new Array)}}onlySelect(e){let r=new Set(Array.from(e)),i=new Array;for(let n of this.items)r.has(n)||(i.push(n),this.selectionOrder.delete(n.globalIndex),n.isEmpty?ie.publish("delete",n):(n.updateFilterVisible=!0,n.visible()));for(let n of this.selectAnnotations)r.has(n)||(n.isEmpty?ie.publish("delete",n):(n.updateFilterVisible=!0,n.visible()));if(r.size==0)this.clearSelect();else{if(this.items.length==r.size&&i.length==0)return;zo.unHighlightAll(i),this.select(e),this.crossWindow(),this.mouseSelectedForAPI();for(let n of r)n!=null&&!n.isEmpty&&(n.updateFilterVisible=!0,n.click())}}rotation(e){let r=new cl(this.items,null,!0);ls.getInstance().init(r.items,"rotation items",(i,n)=>{let s=[],a=i.some(h=>h instanceof Ue);if(ce.pcbConfig.rotateWhole=="whole"||a){let h=new _e;i.forEach(p=>{h.ext1(p instanceof va?p.getLineBBox():p.buildBBox())});let d=h.build1().center();s=i.map(p=>i.length==1&&p instanceof Me?p.position:d)}else s=i.map(h=>h instanceof Me?h.position:h.buildBBox().center());r.getAllRepairTracks().forEach(h=>{n.addCommand4Item(h,"modify")}),i.forEach((h,u)=>{this.rotatable(h)&&(n.addCommand4Item(h,"modify"),ao.rotate(s[u],e,[h]))}),x.getInstance().envFlag=="silk-preview"&&((i.includes(Kr.QRCode)||i.includes(Kr.plainCode))&&ie.messageBus.publish("updateCode",Kr.getCurrentCodeInfo()),i.includes(h0.getInstance().image)&&ie.messageBus.publish("updateCode",h0.getInstance().getCurrentULInfo())),n.checkOutlines(this.items,new Set),Pr.model=Pr.model,ie.publish("selecting",{items:this.items}),ie.publish("flushService","")})}rotatable(e){return!(e instanceof _n||e instanceof ii||e instanceof Ki)}calFindResultSelected(){let e=new Map,r=new Set,i=new Array;for(let n of this.items){let s=n.getGroupID();if(s!=null&&s!=""){r.add(s);let a=e.get(s)||0;e.set(s,++a)}i.push(n.globalIndex)}for(let[n,s]of e)kt.getItem(n).size==s&&i.push(n);return i}setSelect(e,r=!0){if(r){this.select(e);return}e.forEach(i=>{i.click(!r),this.items.push(i)})}cancelNetSelect(e){let r=this.items.filter(i=>!e.includes(i.net));this.clearSelect(),this.items=r}select(e,r={triggerFrom:"COMMON"},i=!0){i&&TN.getInstance().modify();let{triggerFrom:n}=r;e=new Set(e),this.clearPadAndItemSelect(),this.items.length=0,this.selectAnnotations.length=0;let s=new Array;for(let l of e)if(l!=null){if(!Bt.checkIsCanEditByItem(l)){Bt.hightItems([l]);continue}if(l instanceof nr&&l.type=="Annotation"){this.selectAnnotations.push(l);continue}this.dialog?this.dialog.tool.validItem(l)?(this.items.push(l),s.push(l)):l.visible():(this.items.push(l),s.push(l)),this.selectionOrder.get(l.globalIndex)==null&&this.selectionOrder.set(l.globalIndex,this.selectionOrderNumber)}this.dialog&&this.dialog.update(),this.arrtDialog&&this.arrtDialog.update(),this.selectionOrderNumber++,this.category(this.items),this.enableMenuItems(),ie.publish("selecting",this.selectAnnotations.length>0?{items:[].concat(this.selectAnnotations,s),triggerFrom:n||"COMMON"}:{items:this.items,triggerFrom:n||"COMMON"}),this.addPadAndItemSelect(),ie.publish("findResultSelected",this.calFindResultSelected(),$()),this.items.length==0?(Pr.model=3,yi.dropDrag&&yi.setNonSelect(),this.selectionOrderNumber=0,this.selectionOrder.clear()):(this.items.length+this.selectAnnotations.length==1?Pr.model=0:Pr.model=1,yi.dropDrag&&yi.setSelect());let a=x.getInstance();if(!a.isReadOnlyMode&&a.compiler instanceof Pu&&a.compiler.getSelectHandle()&&this.selectRepeater){let l=a.compiler.getSelectHandle(),c=a.compiler.canvasSelected();c!=l.lastStr&&(l.lastTime&&clearTimeout(l.lastTime),l.lastTime=setTimeout(()=>{l.lastTime=null,l.lastStr=c,a.compiler.getHandle()!=null&&a.compiler.publishSelected(c)},0))}this.components.length>0&&yi.setArea(["switchToLayer(1)","switchToLayer(2)"]),mU("pcb-copper-manager")&&this.refreshCopperMangerDialog(),ie.publish("refreshHighLigth",""),this.tabSwitch.isTabSwitch=!1,this.tabSwitch.tabSwitchMsg=null}getSelectStr(){let e=[],r,i,n=0,s=this.items.length;for(let l=0;l<s&&!(n>=1e3);l++){if(r=this.items[l],r.model instanceof ki)i=r.model.modelType;else continue;i!="Ratline"&&(n++,e.push({type:i,id:r.globalIndex}))}return JSON.stringify({action:"select",data:e})}async copy(e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r=ZT.filter(this.items),i=(await ie.messageBus.rpcCall("copy",r)).message;return ie.publish("referPosition",null),i&&we.updatePartialState({refreshPasteState:!0}),i}existGroupAndShowLog(e,r){let i,n,s,a,l;if(e instanceof mt?(i=e.getParent().getGroupID(),n=e.getParent().globalIndex,l=e.getParent().number):(i=e.getGroupID(),n=e.globalIndex,l=e.number),i!=null){let c=x.getInstance().tabId;if(s=kt.getItem(i),a=s.getItems(),a.length>=1){let h=kt.getItem(i).name;VC.addObj(n,l),VC.addGroup(i,h),VC.execute()}}a!=null&&a.length<=1&&(r.addCommand4Item(s,"delete"),setTimeout(()=>{ie.publish("delete",s)},10))}updateBridgingCopperNetLists(e,r){let i=ZS().filter(n=>n.type==="Fill Region"&&n.component instanceof ln&&n.component.isBridgingCopper);for(let n of i){let s=n.component.networkList;s.includes(e)&&(r.addCommand4Item(n,"modify"),s.splice(s.indexOf(e),1))}}delete(e){!x.getInstance().isactive||23==x.getInstance().doctype||this.mouseLeftDown||ls.getInstance().init(this.items,"delete select item",(r,i)=>{var y,b,P;e&&e();let n=new Set,s=new Array,a=new Map;if(r.forEach(T=>{if(T instanceof Le)T.getParent()==null?n.add(T):s.push(T);else if(!(T instanceof _n)){if(T instanceof ii)n.add(T);else if(!(T instanceof Ki))if(T instanceof mt||T instanceof vt){let I=T.getParent();I!=null&&I instanceof Ye&&I.type!=="3D Shell - Side Datum Line"?(a.has(I)||a.set(I,[]),a.get(I).push(T)):n.add(T)}else n.add(T)}}),n.size==0&&a.size==0){i.undo();return}let l="deleteItems-time";pn(l),Pr.interrupt(),Pr.model=3;let c=new Set,h=new Array,u=new Map,d=new Set,p=new Array;for(let[T,I]of a){let C=gXe.deleteModel(I);if(C==null){this.clearSelect();continue}this.existGroupAndShowLog(T,i),i.addCommand4Item(T,"delete"),T.remove(),ie.publish("delete",T);for(let E of C)p.push(E),i.addCommand4Item(E,"add")}for(let T of n){let I=T.getParent();if(I!=null){if(T instanceof fr||T instanceof ii)continue;c.has(I)||(i.addCommand4Item(I,"delete"),c.add(I))}}for(let T of n)if(this.existGroupAndShowLog(T,i),T instanceof fr)if(T.key!==""){let I=T.getParent();if(I!=null&&(n.has(I)||c.has(I)))continue;i.addCommand4Item(T,"modify"),h.push(T)}else i.addCommand4Item(T,"delete"),c.add(T);else if(T instanceof ii)i.addCommand4Item(T,"delete"),c.add(T);else{let I=T.getParent();I!=null?T instanceof fr?(i.addCommand4Item(T,"modify"),h.push(T)):c.has(I)||(i.addCommand4Item(I,"delete"),c.add(I)):(i.addCommand4Item(T,"delete"),c.add(T))}let m=[];for(let T of h)T.showKey=!1,T.showValue=!1,T.visible();let g=x.getInstance().envFlag=="silk-preview";for(let T of c){if(g){if(T instanceof fr)if(T.globalIndex==((y=Kr.plainCode)==null?void 0:y.globalIndex))Kr.plainCode=null;else continue;if(T instanceof Rs)if(T.globalIndex==((b=Kr.QRCode)==null?void 0:b.globalIndex))Kr.QRCode=null;else continue;if(T instanceof Yn)if(T.globalIndex==((P=h0.getInstance().image)==null?void 0:P.globalIndex))h0.getInstance().image=null;else continue}T instanceof Me&&m.push(T.globalIndex),T instanceof ii&&T.getParent().deleteCopperById(T.globalIndex),T.remove();let I=Bo(T);if(I!=null&&I!=""){let C=(u.get(I)||0)+1;u.set(I,C),ze.getSameNetItems(I).length==0&&this.updateBridgingCopperNetLists(I,i)}ie.publish("delete",T)}ie.publish("deviceRemoved",m,$());for(let T of this.items)T.visible();this.clearItems(),s.forEach(T=>{T.isEmpty||T.visible()}),this.enableMenuItems(),i.checkOutlines(p,d),ie.publish("selecting",{items:this.items}),ie.publish("flushService",""),ie.publish("rebuildRatline",{nets:u}),x.getInstance().doctype===4&&ie.publish("flushAttrPlane",""),this.crossWindow(),this.mouseSelectedForAPI(),Bi(l,.05)},{isDelete:!0})}deleteItem(e){let r=$Xe(e);if(r&&e.isEmpty){this.items=this.items.filter(n=>n!==e);let i=r.getItem(e.globalIndex);i&&!i.isEmpty&&this.items.push(i)}}refreshCopperMangerDialog(){let e=this.items,r=[];e.forEach(i=>{i instanceof Ye&&i.type=="Copper Region"&&r.push(i.globalIndex)}),ie.publish("pcbdialogModify",{dialogType:"pcb-copper-manager",action:"refreshCopperMangerDialog",data:r})}enableMenuItems(){let e=this.items,r=kt.getAllGroupId().length>0,i=e.some(s=>s.getGroupID()==null),n=yue(this.items,this.components,r&&i,this.canDissolute(e).length>0,this.canFlipDevice(),["select-device","select-pad","select-via","select-track","select-blend-objects"].includes(this.target));we.select(n)}canDissolute(e){if(e.every(n=>!n.getGroupID()))return[];let i=new Set;return e.forEach(n=>{let s;n instanceof mt||n instanceof vt?s=n.getParent().getGroupID():s=n.getGroupID(),s&&i.add(s)}),Array.from(i)}category(e){this.components.length=0;let r=!1;for(let i of e)i instanceof _n||(r=!0),i instanceof Me&&this.components.push(i);if(r&&(e=e.filter(i=>!(i instanceof _n))),e.length==0)we.smartMode&&Vs.state==2?this.target="select-smart-dimension":this.target="click-canvas-blank";else{let i=null;e.forEach(n=>{if(n instanceof Me)i=this.getTarget("select-device",i);else if(n instanceof Le){let s=n.isTestPad?"select-test-pad":"select-pad";i=this.getTarget(s,i)}else n instanceof Ue?i=this.getTarget("select-track",i):n instanceof _n?i=this.getTarget("select-ratlines",i):n instanceof Ye?n.type=="TearDrop"?i=this.getTarget("select-teardrop",i):i=this.getTarget("select-2dline",i):n instanceof fr?i=this.getTarget("select-text",i):n instanceof Yn||n instanceof Rs?i=this.getTarget("select-image",i):n instanceof ca||n instanceof ol||n instanceof xa?i=this.getTarget("select-dimension",i):n instanceof Ge?i=this.getTarget("select-via",i):n instanceof mt||n instanceof vt?i=this.getTarget("select-2dline",i):n instanceof Nh?i="select-smart-dimension":n instanceof ii?i=this.getTarget("select-copperresult",i):i="select-blend-objects"}),i!=null?this.target=i:this.target="select-blend-objects"}}getTarget(e,r){return r==null?e:r!=e?"select-blend-objects":e}clearItems(){this.clearPadAndItemSelect(),this.selectAnnotations.length=0,this.components.length=0,this.target="click-canvas-blank",zo.unHighlightAll(this.items),this.items.length=0}clearPadAndItemSelect(){if(Oo.getInstance().selectOpen())for(let e of this.items)(e instanceof Le||e instanceof Ge)&&(e.selectItem=!1)}addPadAndItemSelect(){if(Oo.getInstance().selectOpen())for(let e of this.items)(e instanceof Le||e instanceof Ge)&&(e.selectItem=!0)}canFlipDevice(){return this.items.length==this.components.length&&this.components.length!=0}lockedStatus(e=this.items){let r=new cl(e,null,!0).items,i=!1,n=!1;for(let s of r)if(!i&&s.locked?i=!0:!n&&!s.locked&&(n=!0),i&&n)return 1;if(i)return 2;if(n)return 0}lockAll(){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e=new ve("unlock all"),r=new cl(this.items,null,!0).items;for(let i of r)if(!i.locked){let n=Te.dispatch(i,"modify");e.addCommand(n),i.locked=!0}e.length>0&&(je.executeCommand(e),ie.publish("flushSelectingInfo",""))}unlockAllSelect(){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e=new ve("unlock select all"),r=new cl(this.items,null,!0).items;for(let i of r)if(i.locked){let n=Te.dispatch(i,"modify");e.addCommand(n),i.locked=!1}e.length>0&&(je.executeCommand(e),ie.publish("flushSelectingInfo",""))}checkCombination(e=this.items){for(let r of e){if(r.getGroupID()!=null)return!0;{let n=r.getParent();if(n!=null&&n.getGroupID()!=null)return!0}}return!1}checkHasCustomFootprint(e=this.items){for(let r of e)if(r instanceof Me&&r.footprintUUID.indexOf("_")>-1)return!0;return!1}recoverFootprintTemplate(e=this.items){let r=[];for(let n of e)n instanceof Me&&n.footprintUUID.indexOf("_")>-1&&r.push(n.globalIndex);let i={action:"recoverFootprint",data:{id:r}};ie.messageBus.publish("buttomCommand",i)}clearSelectBox(){for(let e of this.selections)e.remove();this.selections.length=0}updateSelectBox(e,r){let i=ce.themeConfig.canvasTheme,n=i.isSolidLine(i.selectBoxLineStyle),s=i.selectBoxColor;if(this.selections.length>0)this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(e,this.mouseLeftY),this.selections[1].start=new S(e,this.mouseLeftY),this.selections[1].end=new S(e,r),this.selections[2].start=new S(e,r),this.selections[2].end=new S(this.mouseLeftX,r),this.selections[3].start=new S(this.mouseLeftX,r),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY);else{let a=new hr(1002,new S(this.mouseLeftX,this.mouseLeftY),new S(e,this.mouseLeftY),n,s),l=new hr(1002,new S(e,this.mouseLeftY),new S(e,r),n,s),c=new hr(1002,new S(e,r),new S(this.mouseLeftX,r),n,s),h=new hr(1002,new S(this.mouseLeftX,r),new S(this.mouseLeftX,this.mouseLeftY),n,s);this.selections.push(a),this.selections.push(l),this.selections.push(c),this.selections.push(h)}}leftToRight(e){let r=$t.filterElement(Wr.getSelectInside(Ol(e),{boxChoose:!0,isBBox:!0}),{boxChoose:!0});return Array.from(r)}rightToLeft(e){let r=$t.filterElement(Wr.getSelectContect(Ol(e),{boxChoose:!0,isBBox:!0}),{boxChoose:!0});return _P(r)}dispatch(e,r,i){switch(r){case"click-canvas-blank":i.filter=Qje(e.adsorb).result;break;case"select-device":i.filter=rXe(this.checkHasCustomFootprint(),this.checkCombination(),this.lockedStatus(),e).result;break;case"select-pad":i.filter=wOe(!1,0,e,this.hasParent()).result;break;case"select-test-pad":i.filter=wOe(!0,this.lockedStatus(),e,this.hasParent()).result;break;case"select-track":i.filter=oXe(this.checkCombination(),this.lockedStatus(),e).result;break;case"select-ratlines":i.filter=aXe().result;break;case"select-via":i.filter=cXe(this.checkCombination(),this.lockedStatus(),e,this.hasParent()).result;break;case"select-2dline":i.filter=dXe(this.checkCombination(),this.lockedStatus(),e).result;break;case"select-text":i.filter=pXe(this.checkCombination(),this.lockedStatus(),e).result;break;case"select-dimension":case"select-image":i.filter=fXe(this.checkCombination(),this.lockedStatus(),e).result;break;case"select-smart-dimension":i.filter=mXe(we.adsorb).result;break;case"select-teardrop":i.filter=yXe().result;break;case"select-blend-objects":i.filter=qje(this.lockedStatus()).result;break;case"select-copperresult":i.filter=bXe(e).result;break}}hasParent(){for(let e of this.items)if(e.getParent()!=null)return!0;return!1}rightClickMenuData(e){if(this.mouseLeftDown)return;let r={state:"show",left:e.mouseX,top:e.mouseY,filter:[]};this.dispatch(e,this.target,r),this.updateMouseRightPosition(e),this.lastClickHasCtrlKey=e.ctrlKey,Qt.getInstance().menuData(r,this)}group(e){switch(e){case"COMBINATION_SELECT":ie.publish("combination","");break;case"COMBINATION_CANCEL":ie.publish("dissolution","");break;case"COMBINATION_JOIN":ie.publish("joinCombination","");break;case"REUSE_LAYOUT_ROUTE":ie.publish("tool","reuseLayoutRoute");break;case"COMBINATION_MOVE_OUT":ie.publish("removeFromCombination","");break}}parse(e){let r=e.cmdKey,i=r.split(":",r.length),{targetItemBoundingRect:n}=e,s=!0;switch(i[0]){case"opensubmenu-boardshape":i[1]=="convertToBoard"?m$():i[1]=="convertToLineFromBoard"&&WG();break;case"ANNOTATION":Lo.getInstance().getNeedAnnotation()&&(Lo.getInstance().hasConnectItem()?Lo.getInstance().createAnnotationByItems():ie.messageBus.publish("tool","draw(annotation)"));break;case"DELETE":this.menuDelete();break;case"COPY":this.menuCopy();break;case"copyToImage":{switch(i[1]){case"copyToSvg":ie.publish("copyToSvg","");break;case"copyToPng":ie.publish("copyToPng","");break}break}case"DUPLICATE":this.duplicate(i[1]);break;case"DUPLICATE_TO_CURSOR":ie.publish("duplicateToCursor","");break;case"PASTE":this.paste();break;case"ENLARGE":s=!1,this.zoomIn();break;case"NARROW":s=!1,this.zoomOut();break;case"CUT":this.menuCut();break;case"ADAPT_ALL":s=!1,this.fitAll();break;case"ADAPT_SELECTED":s=!1,this.fitSelect();break;case"ADDWITH_ROUTING":this.addTrack();break;case"BATCH_FANOUT":ie.publish("pcbBatchFanout","");break;case"COMBINATION":this.group(i[1]);break;case"GRID":this.grid(i[1]);break;case"SNAP_SIZE":this.snapSize(i[1]);break;case"GRIDTYPE":this.gridType(i[1]);break;case"OFFSET":ie.publish("clearDimension",!0),s=!1,ie.publish("offset",i[1]);break;case"RATLINES_SHOW":this.showRatlines();break;case"RATLINES_HIDE":this.hideRatlines();break;case"WIRING_CLEAR":this.menuClearRouting(i[1]);break;case"TURNOVER":ie.publish("clearDimension",!0),s=!1,R$();break;case"ROTATE":ie.publish("clearDimension",!0),s=!1,this.menuRotation(i[1]);break;case"LOCKED":this.lockAll();break;case"LOCKED_CANCEL":this.unlockAllSelect();break;case"MOVE":ie.publish("batchMove",i[1]);break;case"MOVE_SEQUENTIAL":this.moveSequential();break;case"CANCEL":this.menuCancel();break;case"STRETCHING":this.menuStretching();break;case"ALIGNMENT":ie.publish("align",i[1]);break;case"DISTRIBUTION":ie.publish("distribute",i[1]);break;case"component_distribute_by_region":ie.publish("distribute","component_distribute_by_region");break;case"PACKAGE_EDIT":{this.modifyTemplate(i[1],"PcbEditFootprint");break}case"RECOVER_FOOTPRINT":{this.recoverFootprintTemplate();break}case"UPDATE_COMPONENT":{ie.publish("updateComponent",{type:2,component:this.components});break}case"DEVICE_EDIT":{ie.publish("pcbEditDevice",{type:2,component:this.components});break}case"SAVE_TO_LIBRARY":{let h=new Set,u=new Set,d={},p=new Set(["Device","Footprint","Designator","Unique ID"]);for(let m of this.components)if(m.footprintUUID&&u.add(m.footprintUUID),m.deviceUUID&&h.add(m.deviceUUID),!!m.deviceUUID)for(let g in m.attrsObject)p.has(g)||(d[m.deviceUUID]=d[m.deviceUUID]||{},d[m.deviceUUID][g]=m.attrsObject[g].value);ie.publish("saveToLibrary",{devices:Array.from(h),footprints:Array.from(u),changeDeviceAttributes:d},$());break}case"ATTR_LOCATION":{ie.publish("attrData","");break}case"EXCHANGE_LOCATION":{ie.publish("interchange","");break}case"WIRING_MODE":{tr.getInstance().mode=i[1],we.synchronize(),ie.publish("flushSelectingInfo","");break}case"INSERT_NODE":{ie.publish("toggle",{command:"insertNode"});break}case"EDIT_BOUNDARY":{pU(this.items);break}case"GENERATE_D3_SHELL_OUTLINE":{let h=new ft;ie.publish("openMainDialog",{cmd:33,data:{option:{value:h.conversion1("mm",x.getInstance().unit,5),unit:x.getInstance().unit}}});break}case"FILTER":this.filter(i[1]);break;case"HIGHLIGHT":s=!1,this.highLight(i[1]);break;case"HIGHLIGHT_CANCELALL":s=!1,this.highLight(i[0]);break;case"NET_MENU":{let h=this.items.reduce((u,d)=>((d instanceof Ue||d instanceof Le||d instanceof Ge||d instanceof _n)&&d.net&&u.add(d.net),u),new Set);switch(i[1]){case"NET_COLOR":{let u=this.items.map(p=>Bo(p)).filter(p=>!!p),d=ze.getSpecialColor(u[0]).toString();ie.publish("showColorPicker",{nets:u,color:d,targetItemBoundingRect:n},$());break}case"new-net-class":case"new-equal-length-group":{let u=[...h].filter(d=>{let p=te.getInstance().getNet(d);return i[1].includes("net-class")?!p.netClass:!p.equalLengthGroup});ie.publish("showEditNetClassDlg",{type:i[1],nets:[...u]});break}case"remove-from_net-class":case"remove-from_equal-length-group":{let u=[...h].map(d=>{let p=te.getInstance().getNet(d);if(i[1].includes("net-class")){if(p.netClass)return{netClassName:p.netClass.name,netName:d}}else if(p.equalLengthGroup)return{netClassName:p.equalLengthGroup.name,netName:d};return null}).filter(Boolean);ie.publish("remove-from-net-group",{isNetClass:i[1].includes("net-class"),nets:[...u]},$());break}case"join-net-class":case"join-equal-length-group":{let u=[...h].filter(d=>{let p=te.getInstance().getNet(d);return i[1].includes("net-class")?!p.netClass:!p.equalLengthGroup});ie.publish("joinNetGroupDlg",{isNetClass:i[1].includes("net-class"),nets:[...u]});break}case"new-differentialPair":{let u=t5(),d=[...h].filter(p=>!te.getInstance().getNet(p).netDifferential);ie.publish("openDifferentailPairDlg",{differentailPairName:r5(),differentailPairPositiveNet:d[0],differentailPairNegativeNet:d[1],differentailPairList:o9e(),netOptions:u},$());break}case"delete-differentialPair":{let u=[...h].reduce((p,m)=>{let g=te.getInstance().getNet(m);return g.netDifferential&&p.add(g.netDifferential),p},new Set),d=new Array;for(let p of u)p.getAllNets().every(m=>h.has(m.name))&&d.push(p.name);ie.publish("delete-differential-pair",d,$());break}}break}case"ADDWITH_TEARS":ie.publish("openTearDrop","");break;case"ADDVIA_FENCE":{ie.publish("openMainDialog",{cmd:12,data:{}});break}case"SETUP_WINDOWINGAREA":this.createWindowArea();break;case"ADDWITH_EQUALLENGTHTUNING":ie.publish("equalLengthTuning",!1);break;case"INCREASE_GAP":break;case"REFRESH":ie.publish("Pcb/doCommand","checkDocTicket",$());break;case"REUSE_BLOCK":ie.publish("Pcb/doCommand",i[1],$());break;case"RENUMBER":let a=Kt.getAllItem().length,l=0;this.items.forEach(h=>{h instanceof Le&&l++}),ie.publish("openMainDialog",{cmd:16,data:{selectPadsNum:l,allPadsNum:a}});break;case"SELECTOVERLAP":{this.selectOverlap();break}case"SELECT":{switch(i[1]){case"OVERLAP":{let{mouseLeftX:h,mouseLeftY:u,mouseFrameX:d,mouseFrameY:p}=this.getMousePosition(),m=Wr.pointSelect(h,u,!0);m.length>0&&this.cacheMousePosition(),ie.publish("openMainDialog",{cmd:18,data:{items:m,x:d,y:p}});break}case"PRIMITIV_PADPAIR":{let h=new Set;for(let u of this.items)u instanceof Ue||u instanceof Le||u instanceof Ge?new dw(u).result.forEach(p=>{h.add(p)}):u instanceof Me&&u.getPads().forEach(p=>{new dw(p).result.forEach(g=>{h.add(g)})});h=$t.filter(h),this.clearSelect(),h.forEach(u=>{u.click()}),this.select(h),h.size==0&&ie.publish("ui/toastMsg",{type:"info",msg:"No pad pair found."},$()),h.size==1?Pr.model=0:h.size>1?Pr.model=1:Pr.model=3;break}case"CONNECT":{let h=Hue(this.items);for(let u of h){let d=pt.getTears(u.globalIndex);d!=null&&d.forEach(p=>h.add(p))}this.clearSelect(),h=$t.filter(h),h.forEach(u=>{u.click()}),this.select(h),ie.publish("updateFrame",""),Pr.model=1;break}case"NET":{let h=new Set,u=new Set;this.items.forEach(d=>{let p=Bo(d);p!=null?(u.add(p),ze.getSameNetItemsWithoutPourAndPlaneZoneByItem(d).forEach(g=>{h.add(g)})):d instanceof Me&&d.getPads().forEach(g=>{u.add(g.net),ze.getSameNetItemsWithoutPourAndPlaneZoneByItem(g).forEach(b=>{h.add(b)})})}),this.clearSelect(),zo.highlightByNets(u,!1),h=$t.filter(h),h.forEach(d=>{d.click()}),this.select(h),Pr.model=1;break}case"PRIMITIV_COMPONENT":{let h=new Set;this.items.forEach(u=>{if(u instanceof Me)h.add(u);else if(u instanceof Le){let d=u.getParent();d!=null&&h.add(d)}else if(u instanceof fr){let d=u.getParent();d!=null&&h.add(d)}else h.add(u)}),this.clearSelect(),h=$t.filter(h),h.forEach(u=>{u.click()}),this.select(h),Pr.model=1;break}case"PRIMITIV_2DLINE":{let h=this.getSelects(),u=new Set;this.clearSelect(),h.forEach(d=>{let p=d.getParent();p!=null&&p instanceof Ye?(p.click(),u.add(p)):d instanceof Ye&&(d.click(),u.add(d))}),this.select(u),Pr.model=1;break}case"SECOND_COMBINATION":{let h=new Set;this.items.forEach(u=>{let d=u.getGroupID();if(d==null){let p=u.getParent();p!=null&&(d=p.getGroupID())}d!=null?kt.getItem(d).getItems().forEach(m=>{h.add(m)}):h.add(u)}),this.clearSelect(),h=$t.filter(h),h.forEach(u=>{u.click()}),this.select(h),Pr.model=1;break}case"PRIMITIV_TRACK":{let h=new Set;this.items.forEach(u=>{u instanceof Ue&&new jf(u,!0).all.forEach(p=>{h.add(p)})}),this.clearSelect(),h=$t.filter(h),h.forEach(u=>{u.click()}),this.select(h),Pr.model=1;break}case"CONNECTED_COPPER":{this.selectedConnectedCopper(this.mouseLeftX,this.mouseLeftY,this.lastClickHasCtrlKey,this.items);break}case"SELECT_PARENT":{let h=[];this.items.forEach(u=>{u instanceof ii&&h.push(u.globalIndex)}),this.selectParentOfCopperResult(h);break}case"SELECT_CONNECTED_THERMALS":{this.selectThermalWhenSelectCopperFill();break}}break}case"toggleAdsorb":ie.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":ie.publish("openSystemDialog","ADSORPTION",$());break;case"CHECK_OUT":ie.publish("CheckInAndOut","check_out",$());break;case"CHECK_IN":ie.publish("CheckInAndOut","check_in",$());break;case"COPPER_AREA":{this.copperFunction(i[1]);break}case"ARRAYS":{ie.publish("openCreateArrayDialog","");break}case"FLIP":{ie.publish("clearDimension",!0),s=!1,i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"?this.turn("turnUpsideDown"):i[1]=="FLIP_LEFTANDRIGHT_BY_REFER_POINT"?this.turn("turnAroundByReferPoint"):i[1]=="FLIP_UPANDDOWN_BY_REFER_POINT"&&this.turn("turnUpsideDownByReferPoint");break}case"ATTRIBUTE":{ie.publish("openAttributePlane","",$());break}case"IPC2552":{ie.publish("Pcb/doCommand","openIpcDac2552Dlg",$());break}case"MERGE_AS_CLOSED_OBJECT":{ie.publish("mergeAsClosedLine","");break}case"DISPERSED_AS_INDEPENDENT_LIEN":{ie.publish("dispersedAsIndependentLine","");break}case"boolOperation":{rhe(i[1]);break}case"SPLIT":{ie.publish("tool","Split");break}case"CUTOUT":{switch(i[1]){case"CUTOUT_RECT":ie.publish("tool","draw(RCutout)");break;case"CUTOUT_CIRCLE":ie.publish("tool","draw(CCutout)");break;case"CUTOUT_POLYGON":ie.publish("tool","draw(PCutout)");break;case"avoidPads":case"avoidSlots":ie.publish("cutoutToAvoid",{type:i[1]});break}break}case"CONVERT_TO":{ie.publish("convertTo",i[1]);break}case"CONVERT_TO_2D_LINE":{ie.publish("convertTo",i[0]);break}case"CONVERT_TO_FILL_REGION":{ie.publish("convertTo","CONVERT_TO_FILL_REGION");break}case"ADD_SOLDER_MASK":{this.createWindowArea();break}case"MERGE_PADS":let c=_P(this.items.slice()).filter(h=>h instanceof Le);this.mergePads(c);break;case"LOOKUP":{ie.publish("findObjects_PCB","");break}case"UNROUTE_ATTACHED_SEGMENTS":{let h=new ve("UNROUTE_ATTACHED_SEGMENTS");for(let u=0;u<this.items.length;u++){let d=this.items[u];if(d instanceof Me){let p=d.getPads();for(let m=0;m<p.length;m++){let g=p[m].searchNode();for(let y=0;y<g.length;y++)g[y]instanceof Ue&&(h.addCommand(Te.dispatch(g[y],"delete")),g[y].remove(),ie.publish("delete",g[y]))}}}je.executeCommand(h),ie.publish("flushService","");break}case"UNROUTE_CONNECTIONS":{let h=new ve("UNROUTE_CONNECTIONS");for(let u=0;u<this.items.length;u++){let d=this.items[u];if(d instanceof Me){let p=d.getPads();for(let m=0;m<p.length;m++){let g=FUe(p[m]);for(let y=0;y<g.length;y++)h.addCommand(Te.dispatch(g[y],"delete")),g[y].remove(),ie.publish("delete",g[y])}}}je.executeCommand(h),ie.publish("flushService","");break}case"CROSSPROBE":{mw.notifySchToCrossProbe();break}case"ADD":switch(i[1]){case"ADD_FILLET":{let u={command:"AddChamfer",items:Array.from(this.items),type:"fillet"};ie.publish("toggle",u);break}case"ADD_CHAMFER":{let u={command:"AddChamfer",items:Array.from(this.items),type:"chamfer"};ie.publish("toggle",u);break}case"ADDWITH_TEARS":{ie.publish("openTearDrop","");break}case"SETUP_WINDOWINGAREA":{this.createWindowArea();break}case"ADDWITH_VIA":{this.addVia();break}case"ADDVIA_FENCE":{ie.publish("openMainDialog",{cmd:12,data:{}});break}case"ADDWITH_TESTPOINTER":{this.addTestPad();break}case"ADDWITH_TRACK":{ie.publish("tool","draw(track)");break}default:}default:s=!1;break}s&&ie.publish("clearDimension","")}updateMousePosition(){this.mouseLeftX=s1.lastMouseLeftX,this.mouseLeftY=s1.lastMouseLeftY,this.mouseFrameX=s1.lastMouseFrameX,this.mouseFrameY=s1.lastMouseFrameY}updateMouseRightPosition(e){this.mouseLeftX=e.realSceneX,this.mouseLeftY=e.realSceneY,this.mouseFrameX=e.mouseX,this.mouseFrameY=e.mouseY}getMousePosition(){let e=this.mouseLeftX,r=this.mouseLeftY,i=this.mouseFrameX,n=this.mouseFrameY;return!e&&!r&&!i&&!n&&(e=this.mouseRightX,r=this.mouseRightY,i=this.mouseRightFrameX,n=this.mouseRightFrameY),{mouseLeftX:e,mouseLeftY:r,mouseFrameX:i,mouseFrameY:n}}cacheMousePosition(){s1.lastMouseLeftX=this.mouseLeftX,s1.lastMouseLeftY=this.mouseLeftY,s1.lastMouseFrameX=this.mouseFrameX,s1.lastMouseFrameY=this.mouseFrameY}selectOverlap(e){if(this.bbox)return;e=e||{},this.getSelects().length&&(e={});let i=e.realSceneX||this.mouseLeftX,n=e.realSceneY||this.mouseLeftY,s=e.mouseX||this.mouseFrameX,a=e.mouseY||this.mouseFrameY,l=Wr.pointSelect(i,n,!0);l.length&&(s1.lastMouseLeftX=i,s1.lastMouseLeftY=n,s1.lastMouseFrameX=s,s1.lastMouseFrameY=a),ie.publish("openMainDialog",{cmd:18,data:{items:l,x:s,y:a}})}createWindowArea(){let e=new ve("Create a windows area");this.items.forEach(r=>{if(r.getParent()instanceof Ye&&!(r instanceof ii)&&(r=r.getParent()),r instanceof Ue){let i=null;if(Io(r.layerId)?i=5:2==r.layerId&&(i=6),i!=null){let n=new io,s=new Array,a=n.clone4Shape(r.model.primitive,i,r.width);if(s.push(a),s=Nm(s),s.length==0)return;let l=pt.addPolygon("Line",i,[s],r.width,"",!1);e.addCommand(Te.dispatch(l,"add"))}}else if(r instanceof Ye&&(r.type=="Fill Region"||r.type=="Line")){let i=null;if(Io(r.layerId)?i=5:2==r.layerId&&(i=6),i!=null){let n=JSON.stringify(r),s=null;r instanceof Sr?s=Zt.copy(JSON.parse(n)):r instanceof nr?s=Xt.copy(JSON.parse(n)):r instanceof ct&&(s=pt.copy(JSON.parse(n))),s!=null&&(s.layerId=i,s.net="",s.fill(),e.addCommand(Te.dispatch(s,"add")))}}else if(r instanceof Ye&&r.type=="TearDrop"){let i=null;if(Io(r.layerId)?i=5:2==r.layerId&&(i=6),i!=null){let n=r.getMathGraphics();if(!xu(n.primitives))return;let a=new io().plToShapes(n,i);if(a=Nm(a),a.length==0)return;let l=pt.addPolygon("Fill Region",i,[a],0,"",!1);l.layerId=i,l.net="",l.fill(),e.addCommand(Te.dispatch(l,"add"))}}else if(r instanceof ii){let i;if(Io(r.layerId))i=5;else if(2==r.layerId)i=6;else return;V_.convertCopperResult2FillRegion([r],!0,e).forEach(s=>{(s.layerId!=i||!s.net)&&(e.addCommand(Te.dispatch(s,"modify")),s.layerId=i,s.net=null)})}}),e.length>0&&(ie.publish("showPcbSlideMsg",["Successfully added solder mask region!"],$()),je.executeCommand(e)),ie.publish("flushService","")}highLight(e){if(!(!x.getInstance().isactive||23==x.getInstance().doctype)){if(e=="HIGHLIGHT_NET"){let r=this.getSelectItemsNets();this.highlight.highLightNets(r)}else if(e==="HIGHLIGHT_NET_LOOP"){let r=this.getSelectItemsNets();this.highlight.toggleHighLightNetsLoop(r)}else if(e=="HIGHLIGHT_COMPONENT")this.items.forEach(r=>{if(r instanceof Me)this.highlight.addHightItem(r);else if(r instanceof Le){let i=r.getParent();i!=null&&this.highlight.addHightItem(i)}else if(r instanceof fr){let i=r.getParent();i!=null&&this.highlight.addHightItem(i)}});else if(e=="HIGHLIGHT_SELECTED_OBJECTS")this.addHightObj(this.items);else if(e=="HIGHLIGHT_CANCEL_NET"){let r=this.getSelectItemsNets();this.highlight.unhighLightNets(r)}else if(e=="HIGHLIGHT_CANCEL_COMPONENT"){let r=new Set;this.items.forEach(i=>{if(i instanceof Me)r.add(i.globalIndex);else if(i instanceof Le){let n=i.getParent();n!=null&&r.add(n.globalIndex)}else if(i instanceof fr){let n=i.getParent();n!=null&&r.add(n.globalIndex)}}),this.highlight.unhighLightDevice(r)}else if(e=="HIGHLIGHT_CANCEL_SELECTED_OBJECTS"){let r=new Set;this.items.forEach(i=>{if(i instanceof mt||i instanceof vt){let n=i.getParent();n!=null&&n instanceof ct&&r.add(n.globalIndex)}else r.add(i.globalIndex)}),this.highlight.unhighLight(r)}else if(e=="HIGHLIGHT_CANCELALL")this.highlight.unhighLigthAll();else if(e=="INCREASE_BRIGHTNESS"){let r=x.getInstance().forceValue;r=on(r+.1,3),r>1&&(r=1),this.highlightValue(r),ie.publish("flushSelectingInfo","")}else if(e=="DECREASE_BRIGHTNESS"){let r=x.getInstance().forceValue;r=on(r-.1,3),r<0&&(r=0),this.highlightValue(r),ie.publish("flushSelectingInfo","")}ie.publish("refreshHighLigth",""),ie.publish("updateFrame","")}}restoreHighLight(){!x.getInstance().isactive||23==x.getInstance().doctype||this.highlight.restore()}changeHighlightValue(e){x.getInstance().forceValue=e,be.forceDeactive(x.getInstance().forceDeactive),ie.publish("updateFrame","")}highlightValue(e){x.getInstance().forceValue=e,be.forceDeactive(x.getInstance().forceDeactive),wp(),ie.publish("restoreHight","")}stashHighLight(){!x.getInstance().isactive||23==x.getInstance().doctype||this.highlight.stash()}addHightObj(e){e.forEach(r=>{if(r instanceof mt||r instanceof vt){let i=r.getParent();i!=null&&i instanceof ct&&this.highlight.addHightItem(i)}else this.highlight.addHightItem(r)})}unHightObj(e){let r=new Set;e.forEach(i=>{if(i instanceof mt||i instanceof vt){let n=i.getParent();n!=null&&n instanceof ct&&r.add(n.globalIndex)}else r.add(i.globalIndex)}),this.highlight.unhighLight(r)}getSelectItemsNets(){let e=new Set;return this.items.forEach(r=>{if(r instanceof Me)r.getPads().forEach(n=>{e.add(n.net)}),r.getVias().forEach(n=>{e.add(n.net)});else if(r instanceof mt||r instanceof vt){let i=r.getParent();i!=null&&i instanceof ct&&e.add(i.net)}else if(r instanceof Ye)switch(r.type){case"Copper Region":case"TearDrop":{e.add(r.net);break}case"Fill Region":case"Line":{let i=r.model.component;if(i instanceof ln&&i.isBridgingCopper)break;be.getLayer(r.layerId).isSignalLayer()&&e.add(r.net);break}}else{let i=Bo(r);i!=null&&e.add(i)}}),e}copperFunction(e){var r,i;switch(e){case"HIDE_SELECTED_COPPER_FILLS":{let n={ids:this.getSelects().map(s=>s.globalIndex),isLayer:!1,visible:!1};ie.publish("toggleCopper",n),ie.publish("clearSelect","");break}case"SHOW_SELECTED_COPPER_FILLS":{let n={ids:this.getSelects().map(s=>s.globalIndex),isLayer:!1,visible:!0};ie.publish("toggleCopper",n);break}case"HIDE_COPPER_FILLS":{ie.publish("clearSelect",""),((r=Ui.getInstance().getItem(21))==null?void 0:r.visible)==!1?(ie.publish("toggleCopper",{all:!0,visible:!1,ids:[]}),ie.publish("getAllItems","Copper Region")):$t.setVisible(21,!1),Y3();break}case"SHOW_COPPER_FILLS":{((i=Ui.getInstance().getItem(21))==null?void 0:i.visible)==!0?(ie.publish("toggleCopper",{all:!0,visible:!0,ids:[]}),ie.publish("getAllItems","Copper Region")):$t.setVisible(21,!0),Y3();break}case"REBUILD_SELECTED":{this.getSelects().forEach(s=>{if(s instanceof Ye&&s.type=="Copper Region")ie.publish("rebuildSingleCopper",{ids:[s.globalIndex],isLast:!1,isManual:!0});else if(s instanceof mt||s instanceof vt){let a=s.getParent();a!=null&&a instanceof Ye&&a.type=="Copper Region"&&ie.publish("rebuildSingleCopper",{ids:[a.globalIndex],isLast:!1,isManual:!0})}});break}case"REBUILD_ALL":{ie.publish("rebuildCopper",{isManual:!0}),ie.publish("rebuildPlane",{isManual:!0});break}case"RAISE_PRIORITY":{let n=new ve("toHighest"),s=this.getSelects(),a=new Array;for(let l of s)l instanceof Ye&&l.type=="Copper Region"&&(n.addCommand(Te.dispatch(l,"modify")),a.push(l));a.length>0&&(gn.toHighest(s,n),n.openSendCopperOrder(),je.executeCommand(n));break}case"LOWER_PRIORITY":{let n=new ve("toLowest"),s=this.getSelects(),a=new Array;for(let l of s)l instanceof Ye&&l.type=="Copper Region"&&(n.addCommand(Te.dispatch(l,"modify")),a.push(l));a.length>0&&(gn.toLowest(a),n.openSendCopperOrder(),je.executeCommand(n));break}case"COPPER_MANAGER":ie.publish("copperAreaManagerDialog","");break}}getComponents(){return this.components}getItems(){return this.items}getItemsByBBox(e,r){return this.boxSelect(e,r,!1),this.items}getAnnotationItems(){return this.selectAnnotations}changeLayerStatus(){this.isSpecialPaste=!0,ie.publish("tool","PASTE")}getCombination(e){let r=new Array;for(let i of e){let n=this.getGroupId(i);n!=null&&r.push(n)}return r}getGroupId(e){let r=e.getGroupID();if(r!=null)return r;{let i=e.getParent();if(i!=null)return this.getGroupId(i)}return null}filter(e){switch(e){case"MORE":{ie.publish("setActiveTab",{tabName:"ELEMENT",determinedAsTruthClick:!0},$());break}case"ATTRIBUTE":ie.publish("openAttributePlane","",$());case"PRIMITIV_PAD":{let r={primitive:{value:0,isChecked:!1}};ie.publish("toggleElementFilter",r);let i={primitive:{value:6,isChecked:!0}};ie.publish("toggleElementFilter",i);break}default:{ie.publish("filterConfig",e);break}}}fitSelect(){ie.publish("adaptSelect","")}zoomIn(){ie.publish("zoom","in")}zoomOut(){ie.publish("zoom","out")}fitAll(){ie.publish("adaptAll","1")}grid(e){switch(e){case"GRID_CUSTOM":break;case"GRID_SNAP_KEEP_RATIO":{ie.windowBridge.publish("toggleAndSaveUserPreferences",[],$()),ie.publish("flushSelectingInfo","");break}case"GRID_SETTING":ie.publish("openSystemDialog","PCB_COMM_GRID_SIZE",$());break;case"GRID_RANGE_SETTING":{ie.publish("gridRangeSetting",{startAngle:W2(we.startAngle),endAngle:W2(we.endAngle),minRadius:QF(we.minRadius),maxRadius:QF(we.maxRadius),unit:x.getInstance().unit},$());break}default:if(St.getInstance().currentCoord){let r=ce.gridConfig[e],{gridX:i,gridY:n}=r.getSizeAccordingToUnit();ie.publish("GridSetting",{gridX:`${i*10}mil`,gridY:`${n*10}mil`})}else{let r=ce.polarConfig[e];ce.gridSetting.polarSetting({angleDelta:r.angleDelta,milStep:r.getSizeAccordingToUnit()})}ie.publish("flushSelectingInfo","");break}ie.publish("flushService","")}snapSize(e){switch(e){case"GRID_SETTING":ie.publish("openSystemDialog","PCB_COMM_GRID_SIZE",$());break;case"GRID_SNAP_KEEP_RATIO":{ie.windowBridge.publish("toggleAndSaveUserPreferences",[],$()),ie.publish("flushSelectingInfo","");break}default:if(St.getInstance().currentCoord){let r=ce.gridConfig[e],{gridX:i,gridY:n}=r.getSizeAccordingToUnit();ie.publish("SnapSizeSetting",{snapX:`${i*10}mil`,snapY:`${n*10}mil`})}break}ie.publish("flushService","")}gridType(e){switch(e){case"GRID_CUSTOM":break;case"GRID_COORDINATE":St.getInstance().currentCoord=!0,ie.publish("switchCoordinateBtn","cartesian",$()),we.synchronize(),ie.publish("flushSelectingInfo","");break;case"POLAR_COORDINATE":St.getInstance().currentCoord=!1,ie.publish("switchCoordinateBtn","polar",$()),we.synchronize(),ie.publish("flushSelectingInfo","");break;case"GRID_TYPE_DOT":ie.publish("switchGridTypeBtn","outlets",$()),ie.messageBus.publish("switchGridType","outlets");break;case"GRID_TYPE_GRID":ie.publish("switchGridTypeBtn","grid",$()),ie.messageBus.publish("switchGridType","grid");break;case"GRID_TYPE_NONE":ie.publish("switchGridTypeBtn","none",$()),ie.messageBus.publish("switchGridType","none");break;default:break}ie.publish("flushService","")}menuCopy(){ie.publish("tool","COPY")}menuCut(){ie.publish("tool","CLIP")}paste(){ie.publish("tool","PASTE")}menuDelete(){this.delete()}showRatlines(){ie.publish("toggleSelectedRatline",{type:"allSelected",visible:!0})}hideRatlines(){ie.publish("toggleSelectedRatline",{type:"allSelected",visible:!1});let e=!1,r=this.items.filter(i=>i instanceof _n?(e=!0,!1):!0);e&&(this.items=r)}menuRotation(e){if(!(!x.getInstance().isactive||23==x.getInstance().doctype)&&(e==="rotate_left"&&this.rotation(ce.pcbConfig.rotate),e==="rotate_right"&&this.rotation(-ce.pcbConfig.rotate),e==="rotate_reference_point")){let r=new cl(this.items,null,!0);ls.getInstance().init(r.items,"Rotate By Reference Point",(i,n)=>{this.rotateAssociationItem=new cl(i,null,!0);let s={items:new ep(Array.from(this.rotateAssociationItem.items)),executeCommand:!0,commands:n.getCommand()};ao.rotateReferPoint(s,this,null,null,this.rotateReferPointCallback.bind(this))})}}rotateReferPointCallback(e,r,i,n={}){this.items.forEach(s=>{ie.publish("hasModifyPcbItem",s)}),i?this.rotateAssociationItem.interrupt():this.rotateAssociationItem.complete(n.commands),this.rotateAssociationItem=null,ie.publish("updateCross",""),ie.publish("flushService",""),ie.publish("flushSelectingInfo","")}menuClearRouting(e){switch(e){case"WIRING_CLEAR_CONNECT":ie.publish("unrouteClearConnect","");break;case"WIRING_CLEAR_NET":ie.publish("unrouteClearNetwork","");break;case"WIRING_CLEAR_ALL":ie.publish("clearAllRoute","");break}}menuCancel(){let e=this.getSelects();e&&e.length&&this.clearSelect(),we.smartMode&&Vs.exit()}menuStretching(){ie.publish("tool","draw(stretchtrack)")}addVia(){if(this.items.length==1){let e=this.items[0];e instanceof Le?rt.defaultVia.net=e.net:e instanceof Ue?rt.defaultVia.net=e.net:e instanceof _n&&(rt.defaultVia.net=e.net)}else this.items.length>1&&this.items.find(r=>r instanceof Le)&&(rt.defaultVia.net=this.items[0].net);ie.publish("tool","place_part(via)")}addTestPad(){if(this.items.length==1){let e=this.items[0];(e instanceof Le||e instanceof Ue)&&(rt.defalutTestPad.net=e.net)}else this.items.length>1&&this.items.find(r=>r instanceof Le)&&(rt.defalutTestPad.net=this.items[0].net);ie.publish("tool","place_part(testPad)")}addTrack(){ie.publish("tool","draw(track)")}turn(e){if(!(!x.getInstance().isactive||23==x.getInstance().doctype)){switch(e){case"turnAround":Yo.turn(this.items,!1,!0);break;case"turnUpsideDown":Yo.turn(this.items,!0,!0);break;case"turnAroundByReferPoint":Yo.turnByReferPoint({items:this.items,isTurnUpsideDown:!1,executeCommand:!0},this);break;case"turnUpsideDownByReferPoint":Yo.turnByReferPoint({items:this.items,isTurnUpsideDown:!0,executeCommand:!0},this);break}ie.publish("flushSelectingInfo",""),Pr.model=Pr.model,ie.publish("updateFrame","")}}selectAll(){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;this.clearSelect();let e=$t.filterElement(mAe(),{boxChoose:!0}),r=Array.from(e).filter(i=>!Lo.isAnnotation(i));r.forEach(i=>{i.click()}),this.selectRepeater=!1,this.select(r),this.selectRepeater=!0,Pr.model=1,this.crossWindow(),this.mouseSelectedForAPI(),ie.publish("updateFrame","")}closePcbPage(){this.items.length&&(this.clearSelect(),this.crossWindow(),this.mouseSelectedForAPI())}duplicate(e){switch(e){case"DUPLICATE_TO_CURSOR":ie.publish("duplicateToCursor","");break;case"DUPLICATE_TO_OTHER_LAYER":ie.publish("duplicateToOtherLayer","");break}}moveByReferPoint(e,r){this.toggleMove(e,r,"MOVE_BY_REFERENCE_POINT")}nextSignalLayer(e){let r=be.getActiveLayerID(),i=[1];for(let l=15;l<=46;l++){let c=be.getLayer(l);c.config&&(c.isSignalLayer()||c.isPlaneLayer())&&i.push(l)}i.push(2),e!="next"&&(i=i.reverse());let n,s=i.indexOf(r);s>=i.length-1&&(s=-1),s>-1?n=s+1:n=0;let a=i[n];ie.publish("toggleLayerSelected",{layerid:a,toggleType:e})}nextLayer(e){let r=be.getAllConfigLayerSortByRightPanel(),i=be.getActiveLayerID(),n;e!=="next"&&(r=r.reverse());let s=r.findIndex(l=>l.layerID==i);s>=r.length-1&&(s=-1),s>-1?n=s+1:n=0;let a=r[n].layerID;ie.publish("toggleLayerSelected",{layerid:a})}mouseSeleceMove(e,r){switch(e){case"MOVE_BY_CENTER_POINT":this.moveByCenterPoint(r);break;case"MOVE_BY_ORIGIN_POINT":this.moveByOriginPoint(r);break;case"MOVE_BY_REFERENCE_POINT":this.toggleMoveByRefer(r);break}}moveByCenterPoint(e=!1){this.toggleMove(this.mouseLeftX,this.mouseLeftY,"MOVE_BY_CENTER_POINT",e)}moveByOriginPoint(e=!1){if(this.items.length==0){ie.publish("toggle",{command:"MouseSelect",cmd:"MOVE_BY_ORIGIN_POINT"});return}if(this.items.length==1){let i=this.items[0];if(i instanceof Me){let n=i.position;this.toggleMove(n.x,n.y,"MOVE_BY_ORIGIN_POINT",e);return}}ie.publish("ui/toastMsg",{type:"warn",msg:"Selected elements has no origin, select a reference point and then move"},$());let r={command:"referencePoint",program:new u2(this.items,0,0),isContinuousMode:e,msg:"Please select a reference point"};ie.publish("toggle",r)}toggleMoveByRefer(e=!1){if(this.items.length==0)ie.publish("toggle",{command:"MouseSelect",cmd:"MOVE_BY_REFERENCE_POINT"});else{let r={command:"referencePoint",program:new u2(this.items,0,0),isContinuousMode:e,msg:"Please select a reference point"};ie.publish("toggle",r)}}toggleMove(e,r,i,n=!1){let s={command:"batchMoveItem",refer:new u2(this.items,e,r),menu:i,isContinuousMode:n};s.refer.items.length>0?ie.publish("toggle",s):ie.publish("toggle",{command:"MouseSelect",cmd:i})}moveSequential(){this.toggleMoveItem(this.items,this.mouseLeftX,this.mouseLeftY,"MOVE_SEQUENTIAL")}toggleMoveItem(e,r,i,n){let s={command:"BatchMoveSequentialItem",refer:new u2(e,r,i),menu:n};ie.publish("toggle",s)}getType(e){let r=2;switch(e){case"ONLY_SELECT":{r=0;break}case"CURRENT_PCB":{r=1;break}case"ALL_PROJECT":{r=2;break}}return r}async modifyTemplate(e,r){let i=this.getType(e);if(i==0){let n=new Array;for(let s of this.components){let a=new $f;a.refreshService=!0;let l=a.updateCustomFootprint(s);n.push(l)}await Promise.all(n)}ie.publish(r,{type:i,component:this.components}),this.clearSelect()}modifyCurrentTemplate(e){if(e.type===1){let r=Cr.getAllItem();e.action===1&&ie.publish("pcbUpdateDevice",{type:1,component:r}),e.action===3&&ie.publish("updateComponent",{type:1,component:r}),this.clearSelect()}else e.type===0&&(e.action===1&&ie.publish("pcbUpdateDevice",{type:0,component:this.components}),e.action===3&&ie.publish("updateComponent",{type:0,component:this.components}),this.clearSelect())}smartSelectionForFilterPadPairOrNet(e){let r=this.getSelects(),i=$t.filterActiveLayer(e),n=Bo(i);if(i&&n){let s=!1;if($t.getPick(8))s=r.every(a=>Bo(a)==n);else if($t.getPick(7)&&(i instanceof Le||i instanceof Ge||i instanceof Ue)){let a=new dw(i);a.result.size>0&&(s=r.every(l=>l instanceof Le||l instanceof Ge||l instanceof Ue?a.result.has(l):!1))}if(s)return[i]}return null}smartSelection(e,r){let i=e.filter(s=>r.includes(s)),n=this.smartSelectionForFilterPadPairOrNet(i);n&&n.length>0&&(this.onlySelect(n),Pr.model=n.length>1?1:0)}selectWholeOrSingleTrack(e,r){this.initialSelect=this.items[0];let i=[],n=[],s=ce.pcbConfig.realTimeTrackSelectStats=="single";this.currentPointSelectedItems.forEach(a=>{if(a instanceof Ue){let l=$t.filterTrack(a,"whole");if(l.filter(h=>this.items.includes(h)).length==1){let h=l.every(p=>this.tracks.includes(p.globalIndex)),u=this.tracks.includes(a.globalIndex)&&l.every(p=>a==p||!this.tracks.includes(p.globalIndex));i.push(...l);let d=ce.pcbConfig.realTimeTrackSelectStats=="single";h?!d&&n.push(a):u?d&&n.push(...l):d?n.push(a):n.push(...l)}}else if(a instanceof ct){if(this.items.includes(a)){i.push(a);let l=a.selectChild(e,r);if(l!=null){let c=a.childrens.length==1&&a.childrens[0]==l;!this.lines.has(a.globalIndex)&&!this.lines.has(l.globalIndex)?s&&!c?n.push(l):n.push(a):c||(s?this.lines.has(l.globalIndex)&&n.push(a):this.lines.has(a.globalIndex)&&n.push(l))}else n.push(a)}}else if(a instanceof mt||a instanceof vt){i.push(a);let l=a.getParent();!this.lines.has(a.globalIndex)&&!this.lines.has(l.globalIndex)?s?n.push(l):n.push(a):this.lines.has(l.globalIndex)?n.push(a):n.push(l)}else a instanceof nr&&this.items.includes(a)&&(n.push(a),i.push(a),this.lines.has(a.globalIndex)?this.rectSelectId==null?a.selectChild(e,r):a.clearSelectChildId():s?a.selectChild(e,r):a.clearSelectChildId())}),this.items.forEach(a=>{i.includes(a)||n.push(a)}),n.push(...this.selectAnnotations),n=n.filter(a=>Bt.checkIsCanEditByItem(a)),this.onlySelect(n),this.items.length==0&&(this.lines.clear(),this.rectSelectId=null),this.currentPointSelectedItems.length=0;for(let a of this.items)a instanceof nr&&(a.isSelectChild()?console.log(`Rect is Select Child:${a.selectChildId}`):console.log("Rect is All"))}selectThermalWhenSelectCopperFill(){let e=this.items.filter(n=>n instanceof ii&&!(n.style!="solid"&&n.copperPath.length==1)),r={};for(let n of e){let s=n.getParent();r[s.globalIndex]||(r[s.globalIndex]={coppers:[],outline:s}),r[s.globalIndex].coppers.push(n)}let i=Array.from(e);for(let n in r){let s=r[n].coppers;r[n].outline.iteratorCopper(a=>{if(s.includes(a))return;s.some(c=>Jx(c.model,a.model))&&(s.push(a),i.push(a))})}this.onlySelect(new Set([].concat(this.items,i)))}mergePads(e){new pue().mergePads(e),this.flushSelect()}crossProbe(e=this.items,r=""){let i=mw.getCrossProbeData(e);ie.publish("NotifySchCrossProbe",{pcbUuid:x.getInstance().id,rule:i,selectTabId:r},$())}classifyTrack(){if(this.tracks.length=0,this.items.every(i=>i instanceof Ue)&&(this.tracks=this.items.map(i=>i.globalIndex)),this.lines.clear(),this.rectSelectId=null,this.items.every(i=>i instanceof mt||i instanceof vt||i instanceof ct||i instanceof nr)){let i=new Set;for(let n of this.items)n instanceof nr&&n.isSelectChild()&&(this.rectSelectId=n.selectChildId),i.add(n.globalIndex);this.lines=i}}addSolderMaskRegionByTeardrop(){this.createWindowArea()}selectParentOfCopperResult(e){let r=e[0],i=$t.filterElement(mAe(),{boxChoose:!0}),n=[];i.forEach(s=>{let a=s.copperResultMap||new Set,l=!1;a.forEach(c=>{if(!l&&c.globalIndex===r){n.push(s),l=!0;return}}),s.visible()}),ie.publish("clearSelect",""),this.cancel(),window.setTimeout(()=>{n.forEach(s=>{s.click()}),ie.publish("select",n),ie.publish("updateFrame","")})}selectNet(){$t.filterNetItems1(this.items).length>0&&ie.publish("toggle",{command:"netSelect"})}closeActionDialog(){ie.publish("DialogCloseByAction",{action:"display-overlap-primitive"})}cancelAllElementsHightlight(e=!1){this.highlight.unhighLigthAll(),e&&Lc().forEach(r=>{r.visible()})}setTool(e){this.tool=e}};s1.lastMouseLeftX=null,s1.lastMouseLeftY=null,s1.lastMouseFrameX=null,s1.lastMouseFrameY=null;var fU=s1;function PDt(o){let t=o.filter(r=>r instanceof Ge);if(t.length!==1)return!1;let e=t[0];for(let r of o)if(!(r instanceof Ge||r instanceof ct&&r.type=="TearDrop"))if(r instanceof Ue){if(r.net==e.net&&e.isContains(r.layerId)&&(e.isSelect(r.start.x,r.start.y)||e.isSelect(r.end.x,r.end.y)))continue;return!1}else return!1;return!0}var _w=(function(){let o=null,t=[],e=null,r=null;return function(i,n){o||(t=Ve.getSelects());let s=PDt(t),a=new cl(t);ls.getInstance().init(a.items,"offset Items",(l,c)=>{o&&window.clearTimeout(o),o||(e=new cl(l),r=c,e.items.forEach(d=>{c.addCommand4Item(d,"modify")}),e.getAllRepairTracks().forEach(d=>{c.addCommand4Item(d,"modify")})),e.setUpConnectTrack(),e.moveConnectTrack(n);let h=e.itemConnectTrack;e.items.forEach(u=>{h.tracks.has(u.globalIndex)||u.transform(n)}),e.items.forEach(u=>{ie.publish("hasModifyPcbItem",u)}),o=setTimeout(()=>{if(s){let u=l.filter(g=>g instanceof Ge),d=new Br,p=J3(u,d,void 0,!0);Jl.getInstance().init();let m=tr.getInstance().mode;["WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"].includes(m)?jg("freeArc"):jg("45"),_9(p,d,!1),Xg(),ji.getInstance().complete(r.getCommand()),Q3()}o=null,e.complete(r.getCommand()),r.execute(),c.checkOutlinesNoExecute(Array.from(e.items),new Set),l=[],e=null,r=null,ie.publish("autoFill",""),ie.publish("flushService",""),ie.publish("flushSelectingInfo","")},200)})}})();var Ve=new fU;var gAe=class{getDefaultTopSlotDepth(){let t=this.getOutline();return t!=null?t.getComponent().shellHeight/2:xM/2}getDefaultSideSlotDepth(t){let e=this.getOutline();if(e!=null){let i=new er().getItem(t);if(i!=null&&i.getChildrens().length>0)return ir.foot(i.getChildrens()[0][0].primitive,e.buildBBox().center()).distance1(e.buildBBox().center())}return xM/2}getDefaultSubstrateHeight(t,e){let r=new ft().conversion("mm","mil",2)/10,{shellHeight:i,botShellHeight:n}=e;return t==="T&B"&&typeof n=="number"?n-r:t==="DRAWER"&&typeof i=="number"?i*2/3-r:0}getTopInnerHeight(t,e,r){let i=e-r;return i<0?t:t<0?0:t>i?i:t}getBottomInnerHeight(t,e,r){let i=e-r;return i<0?t:t<0?0:t>i?i:t}getOutline(){let t=[].concat(Zt.getAllItem(),Xt.getAllItem(),pt.getAllItem());for(let e of t)if(e.type==="3D Shell - Outline")return e;return null}},D9=new gAe;var wP=class{modifyName(t,e){return!1}syncLatestData(t){}updateModelLatestData(t){}};var Wue=class extends wP{syncLatestData(t){Tm.syncProhibitData(t)}updateModelLatestData(t){Tm.updateProhibitComponent(t)}};var zue=class extends wP{modifyName(t,e){let r=wf.getInstance();return e!=t.name&&!r.hasName(e)?(r.deleteName(t.name),wf.getInstance().addName(e),!0):!1}};var Yue=class extends wP{syncLatestData(t){Tm.syncFillData(t)}updateModelLatestData(t){Tm.updateFillComponent(t)}modifyName(t,e){return Ei.nameManager.has(e)?!1:(Ei.nameManager.deleteNum(t.name),Ei.nameManager.add(e),!0)}};var jue=class extends wP{syncLatestData(t){Tm.syncD3ShellScrewPillarData(t)}};var Xue=class extends wP{syncLatestData(t){Tm.syncD3ShellSlotRegionComponentData(t)}};var que=class extends wP{modifyName(t,e){return e!=t.name&&!Dn.getInstance().hasName(e)?(Dn.getInstance().deleteName(t.name),Dn.getInstance().addName(e),!0):!1}};function eP(o){o instanceof fd?o.setWatcher(new Wue):o instanceof nu?o.setWatcher(new zue):o instanceof Vn?o.setWatcher(new Yue):o instanceof um?o.setWatcher(new jue):o instanceof ou?o.setWatcher(new Xue):o instanceof Dc&&o.setWatcher(new que)}function V1(o,t){let{type:e,layerId:r,strokeWidth:i=.1}=t;switch(e){case"Prohibited Region":{let{device:n,track:s,copper:a,fill:l,planzone:c}=Tm.prohibitComponent;return new fd(n,s,a,l,c)}case"Constraint Region":{let n=wf.getInstance().getName();return wf.getInstance().addName(n),new nu(n)}case"Copper Region":{let n=Ei.nameManager.getNum("pour1");Ei.nameManager.add(n);let{style:s,gridLineWidth:a,clearance:l,keepIsland:c,optimization:h,optimizationValue:u}=Tm.fillComponent,d=gn.getNextOrders4Layer(r);return new Vn(s,a,l,c,h,n,d,u)}case"Fill Region":{let n="",s=Ve.getSelects();return s.length===1&&s[0]instanceof Le&&(n=s[0].globalIndex),new ln(n)}case"FPC Stiffener":{let{material:n,fpcModel:s}=Qu.default,a=new Du(n,s);return Qu.correctAllProps(a),a}case"3D Shell - Outline":{let n=i;return new K0("T&B",xM,0,0,n)}case"3D Shell - Screw Pillar":{if(o===0){let n=r===55,s=r!==55,{specification:a}=Tm.d3ShellScrewPillarComponent,l=new um(a,ey.getDefaultScrewHeight(r));return aT.updatePropsBySpecification(l,a,n,s),l}break}case"3D Shell - Side Slot Region":{let n,s=uh.getBaseLine();s&&(n=s.globalIndex);let a=D9.getDefaultSideSlotDepth(n),{slotOption:l}=Tm.d3ShellSlotRegionComponent;return new ou("Side",a,l,n)}case"3D Shell - Top Slot Region":{let n=D9.getDefaultTopSlotDepth(),{slotOption:s}=Tm.d3ShellSlotRegionComponent;return new ou("Top",n,s,null)}case"3D Shell - Top/Bottom Entity":{let n=D9.getDefaultTopSlotDepth();return new wl("top_bottom",n,null)}case"3D Shell - Side Entity":{let n,s=uh.getBaseLine();s&&(n=s.globalIndex);let a=D9.getDefaultTopSlotDepth();return new wl("side",a,n)}case"TearDrop":return new J2([]);case"Annotation":return new sR;case"Partition":{let n=Dn.getInstance().getName();return Dn.getInstance().addName(n),new Dc(n)}default:return}}function Lf(o,t,e){switch(o){case"Prohibited Region":return t instanceof fd;case"Constraint Region":return t instanceof nu;case"Copper Region":return t instanceof Vn;case"Fill Region":return t instanceof ln;case"FPC Stiffener":return t instanceof Du;case"3D Shell - Outline":return t instanceof K0;case"3D Shell - Screw Pillar":return t instanceof um;case"3D Shell - Top Slot Region":case"3D Shell - Side Slot Region":return t instanceof ou;case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return t instanceof wl;case"TearDrop":return t instanceof J2;case"Annotation":return t instanceof sR;case"Partition":return t instanceof Dc;default:return t==null}}var Sr=class extends Ye{constructor(e){super();this._notShowFill=!1;if(this.model=e,e.setModelWatcher(this),this.layerId=sg(this.type,this.layerId,0),this.net=wu(this.net,this.layerId,this.type),Lf(this.type,this.model.component,this.model.layerId)||(this.model.component=V1(0,this.model)),this.type==="Constraint Region"){let r=te.getInstance().addConstraintSelector(this.globalIndex);Xp.getInstance().publish("modify",r)}eP(this.model.component),this.initRefreshRender()}get component(){return this.getComponent()}get color(){return super.color||$A.getLineColor(this)}set color(e){super.color=e,this.refreshRender()}get type(){return this.model.type}set type(e){if(this.model.type!=e){if(this.hiddenCopperResult=!1,this.model.type=="Copper Region"?(Ei.nameManager.deleteNum(this.component.name),this.deleteRegionRuleSelector()):this.model.type==="Constraint Region"&&(wf.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()),e==="Constraint Region"){let i=te.getInstance().addConstraintSelector(this.globalIndex);Xp.getInstance().publish("modify",i)}let r=this.model.type;this.model.type=e,this.model.component=V1(0,this.model),this.layerId=sg(e,this.layerId,0),this.strokeWidth=n8(this.strokeWidth,this.model.type,r),this.net=wu(this.net,this.layerId,this.type),eP(this.model.component),this.refreshRender()}}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=sg(this.type,e,0,this.layerId),this.checkRegion(0),this.refreshRender()}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e,this.type=="3D Shell - Outline"&&(this.component.shellThickness=this.strokeWidth),this.refreshRender()}get center(){return this.model.center}set center(e){this.model.center=e,this.refreshRender()}get radius(){return this.model.radius}set radius(e){this.model.radius=e,this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get primitive(){return q.build2(this.center,0,360,this.radius,this.radius,le.CCW)}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}get showNet(){return this.model.net}set net(e){if(this.net!=e){ze.delete(this),this.model.net=e;let r=be.getLayer(this.layerId);r&&r.isSignalLayer()&&ze.addItem(this),this.refreshRender()}}get start(){return new S(this.center.x-this.radius,this.center.y)}get viewColor(){var n,s;let e=this.color,r=(s=(n=ce)==null?void 0:n.themeConfig)==null?void 0:s.canvasTheme;r&&(e=r.getRegionColor(this,e));let i=Bt.getTransparencyByPcbType(this,e);return e!=null&&i!=null&&e.alpha!=i&&(e=ee.of6(e,i)),e}get fillColor(){var n,s;let e=super.color||$A.getFillColor(this),r=(s=(n=ce)==null?void 0:n.themeConfig)==null?void 0:s.canvasTheme;r&&(e=r.getRegionColor(this,e));let i=Bt.getTransparencyByPcbType(this,e);return i!=null&&e.alpha!=i&&(e=ee.of6(e,i)),e}get partitionName(){return this.component instanceof Dc?this.component.name:""}get constrainName(){return this.component instanceof nu?this.component.name:""}get fpcMaterial(){return this.component instanceof Du?this.component.material:""}get fpcThickness(){return this.component instanceof Du?this.component.thickness:""}get viewGroupId(){return this.model.component instanceof ln&&this.model.component.isBridgingCopper?this.model.modelType+null:this.model.modelType+this.net}get viewGroupIdModified(){return this.netModified}getShape(){return this.model}fill(){this.isEmpty||!this.notShowFill||(this.notShowFill=!1,this.refreshRender())}removeFill(){this.notShowFill=!0,this.refreshRender()}setCustomColor(e){this.color=e}getComponent(){return this.model.component}setComponent(e){Lf(this.type,e,this.model.layerId)&&(this.model.component=e,eP(this.model.component))}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}visible(e=!1){this.fill(),super.visible(e)}hidden(){this.fill(),super.hidden()}click(e=!1,r=!1){this.fill(),super.click(e,r)}remove(){this.type=="Copper Region"?(Ei.nameManager.deleteNum(this.component.name),this.clearCopper(),this.deleteRegionRuleSelector()):this.type=="Constraint Region"?(wf.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()):this.type=="Partition"&&(Dn.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()),super.remove()}transform(e){this.removeFill(),this.model.transform(e),this.refreshRender()}refreshRender(){var e;this.model!=null&&((e=be.getLayer(57))!=null&&e.visible)&&this.iteratorRatlines(i=>{i.isVisible&&(i.startNode==this&&!i.start.equals(this.start)&&(i.start=this.start,i.click()),i.endNode==this&&!i.end.equals(this.start)&&(i.end=this.start,i.click()))}),super.refreshRender()}isSelect(e,r,i){if(this.getParent()!=null)return!1;let n=this.model.inShape(e,r,i?Ni():void 0);return this.type=="Copper Region"&&(this.needShowOutline()||(n=!1)),this.type=="Copper Region"&&this.isHighLight?n||this.isInInnerArea(e,r):n}isInInnerArea(e,r){return this.model.InnerArea(e,r)}isSelectOnlyLine(e,r){return!this.isVisible||this.getParent()!=null?!1:this.model.isSelectOnlyLine(e,r)}isInProfile(e,r){return this.isVisible?this.model.inShape(e,r):!1}isSignalLayer(){throw new Error("Method not implemented.")}buildBBox(){return this.model.buildBBox()}toJSON(){var s;let e;this.type==="Constraint Region"&&(e=te.getInstance().getRegion(this.globalIndex).clone());let r=this.getComponent(),i=r&&typeof r.toJSON=="function"?r.toJSON():null;return{globalIndex:this.globalIndex,partition:this.partition,type:this.type,layerId:this.layerId,center:this.center,radius:this.radius,strokeWidth:this.strokeWidth,locked:this.locked,net:this.net,silkColor:((s=this.silkColor)==null?void 0:s.toString())||null,componentData:i,regionRuleSelector:e}}getType(){return 3}getMathGraphics(e=this.layerId,r=0){return this.isEmpty?null:this.layerId==e||gr(this.layerId)||11==this.layerId?fe.build2([q.build2(this.center,0,360,this.radius+r,this.radius+r,le.CCW)]):null}getViewState(){return this.isEmpty?"Not Shown":this.isVisible?this.notShowFill?this.needShowOutline()?"Not Show Fill":"Not Shown":this.isHighLight?"Main And Highlight":this.needShowOutline()?"Only Main":"Not Shown":"Not Shown"}};var w9=class o extends KR{constructor(e,r={}){super(0);this.title="Warning";this.msg=e,this.extra=r}equal(e){return e instanceof o&&this.type==e.type&&this.msg==e.msg}open(e){return{type:this.type,option:{msg:this.msg,title:this.title},extra:this.extra}}close(e){}};function w$(o,t){if(o==1||o==2||Ms(o)){let e=te.getInstance().getAllBlindPhysics();for(let r of e){let i=r.getAllVias();for(let n of i)n.isContains(o)&&(n.status.setVisible(o,t),Jb.getInstance().setLayer(n.name,n.status.isVisible()))}}}function Lc(){let o=new Array,t=Kt.getAllItem(),e=Cr.getAllItem(),r=pr.getAllItem(),i=Hr.getAllItem(),n=pt.getAllItem(),s=Xt.getAllItem(),a=Zt.getAllItem(),l=ti.getAllItem(),c=is.getAllItem(),h=Go.getAllItem(),u=Uo.getAllItem(),d=Ln.getAllItem(),p=_o.getAllItem();return t.forEach(m=>{m.getParent()==null&&o.push(m)}),e.forEach(m=>{m.getParent()==null&&o.push(m)}),r.forEach(m=>{m.getParent()==null&&o.push(m)}),i.forEach(m=>{m.getParent()==null&&o.push(m)}),n.forEach(m=>{m.getParent()==null&&o.push(m)}),s.forEach(m=>{m.getParent()==null&&o.push(m)}),a.forEach(m=>{m.getParent()==null&&o.push(m)}),l.forEach(m=>{(m.key!=""||m.getParent()==null)&&o.push(m)}),c.forEach(m=>{m.getParent()==null&&o.push(m)}),h.forEach(m=>{m.getParent()==null&&o.push(m)}),u.forEach(m=>{m.getParent()==null&&o.push(m)}),d.forEach(m=>{m.getParent()==null&&o.push(m)}),p.forEach(m=>{m.getParent()==null&&o.push(m)}),o}function yAe(o){Kt.iterator(o),Cr.iterator(o),pr.iterator(o),Hr.iterator(o),pt.iterator(o),Xt.iterator(o),Zt.iterator(o),ti.iterator(o),is.iterator(o),Go.iterator(o),Uo.iterator(o),Ln.iterator(o),_o.iterator(o),Ei.iterator(o),Qn.iterator(o)}function mAe(){let o=new Array;return Vt.itoratorAllItems(t=>{let e=t.item;e.isEmpty||o.push(e)}),o}function iw(){return Kt.getAllItem()}function wYe(){let o=new Set,t=Wq(),e=new _e,r;if(t){let O=t.width()*5,_=t.height()*5,R=t.minX-O,v=t.maxX+O,D=t.minY-_,w=t.maxY+_;e.ext5(R,v,D,w),r=e.build1()}let i=new _e,n=Kt.getAllItem(),s=Cr.getAllItem(),a=pr.getAllItem(),l=Hr.getAllItem(),c=pt.getAllItem(),h=Xt.getAllItem(),u=Zt.getAllItem(),d=ti.getAllItem(),p=is.getAllItem(),m=Go.getAllItem(),g=Uo.getAllItem(),y=Ln.getAllItem(),b=_o.getAllItem(),P=Ei.getAllItem(),T=[...n,...s,...a,...l,...c,...h,...u,...d,...p,...m,...g,...y,...b,...P],I=new Set,C=ai.getInstance().getDefaultPanelize();for(let O of T){if(O.type=="Board Outline"||O.type=="Line"&&O.layerId==11||O instanceof fr&&!O.showKey&&!O.showValue)continue;let _=O.buildBBox();if(i.ext1(_),r)if(!_.isInside(r))o.add(O),O instanceof Me&&I.add(O);else continue;if(C.success&&!C.onlyOutline){let R=ai.getInstance().offset,v=C.row,D=C.column;for(let w=0;w<v;w++)for(let F=0;F<D;F++){if(w===0&&F===0)continue;let H=Ae.translate(R.x*F,R.y*w,0);O.transform(H),_=O.buildBBox(),i.ext1(_),r&&(_.isInside(r)||(o.add(O),O instanceof Me&&I.add(O)));let z=Ae.translate(-R.x*F,-R.y*w,0);O.transform(z)}}}let E=Array.from(o).filter(O=>O.getParent()?!I.has(O.getParent()):O);return i.valid()?{allItemBbox:i.build1(),outOfBoardBBoxItems:E}:{allItemBbox:null,outOfBoardBBoxItems:E}}function N0(){let o=new _e;mo.getInstance().getAllItem().forEach(r=>{if(r.getText()!=""){let i=r.buildBBox();i&&o.ext1(i)}});let e=Vt.getIgnoreTextBBox();return e&&(o.ext1(e),o.valid())?o.build1():null}function $ue(){var t;let o=ai.getInstance();return(t=o.getDefaultPanelize())!=null&&t.success?ut.extend2(o.bbox,N0()):N0()}function nG(){let o=uu(),t=new _e;for(let e of o){let r=e.getMathGraphics();t.ext1(r.bbox())}return t.valid()?t.build1():null}function CYe(){let o=uu(),t=new S(0,0).sub(x.getInstance().origin),e=Qe.translate1(t),r=nG().transform(e);if(!r)return[];let i=[];o.forEach(p=>Re.addAll(i,p.getMathGraphics().primitives.map(m=>m.multiply3(e))));let s=new oh(r.extendOfSize(10),2,.1,new Gi(4),i).detect(),a=new Array;for(let p of s.items)vh(p)&&(p=p.reverse()),gy.getExtendPolyLine(p,-3).forEach(m=>a.push(m));let l=[];for(let p of a)p.points(1,m=>{l.push(m)});let c=l[0],h=l[0],u=l[0];for(let p=1;p<l.length;p++){let m=l[p];(m.x<c.x||m.x===c.x&&m.y<c.y)&&!Qd(m,h)&&!Qd(m,u)&&(c=m),(m.x<h.x||m.x===h.x&&m.y>h.y)&&!Qd(m,c)&&!Qd(m,u)&&(h=m),(m.x>u.x||m.x===u.x&&m.y>u.y)&&!Qd(m,c)&&!Qd(m,h)&&(u=m)}if(Qd(c,h)||Qd(h,u)||Qd(c,u))for(let p of l)Qd(c,h)&&!Qd(p,c)&&p.y>h.y&&(h=p),Qd(h,u)&&!Qd(p,h)&&p.x>u.x&&(u=p),Qd(c,u)&&!Qd(p,u)&&p.x+p.y<c.x+c.y&&(c=p);let d=ai.getInstance().getDefaultPanelize();if(d.success&&!d.onlyOutline&&(d.column>1||d.row>1)){let p=ai.getInstance().offset;if(d.row==1){let m=Qe.translate1(new S(p.x*(d.column-1),p.y*(d.row-1)));u=c.multiply3(m)}else if(d.column==1){let m=Qe.translate1(new S(p.x*0,p.y*(d.row-1)));h=c.multiply3(m)}else{let m=Qe.translate1(new S(p.x*0,p.y*(d.row-1)));h=c.multiply3(m);let g=Qe.translate1(new S(p.x*(d.column-1),p.y*(d.row-1)));u=c.multiply3(g)}}return[c,h,u]}function Wq(){let o=uu(),t=new _e;for(let e of o){let r=e.getMathGraphics();t.ext1(r.bbox())}if(ai.getInstance().getDefaultPanelize().success){let e=ai.getInstance().outerBBox;t.ext1(e)}return t.valid()?t.build1():null}function SYe(){let o=Xt.getAllItem().filter(n=>n.layerId==56),t=Zt.getAllItem().filter(n=>n.layerId==56),e=pt.getAllItem().filter(n=>n.layerId==56),r=ti.getAllItem().filter(n=>n.layerId==56),i=Ln.getAllItem().filter(n=>n.layerId==56);return!!(o.length||t.length||e.length||r.length||i.length)}function $Xe(o){if(o instanceof Ue)return pr;if(o instanceof Ri)return Kt;if(o instanceof Ge)return Hr;if(o instanceof Sr)return Zt;if(o instanceof nr)return Xt;if(o instanceof fr)return ti;if(o instanceof ol)return is;if(o instanceof ca)return Go;if(o instanceof xa)return Uo;if(o instanceof Me)return Cr;if(o instanceof ct)return pt;if(o instanceof mt)return pt;if(o instanceof vt)return pt;if(o instanceof fn)return Kt;if(o instanceof Yn)return Ln;if(o instanceof Ki)return Qn;if(o instanceof ii)return Ei;if(o instanceof Rs)return _o}function vD(){let o=new Array;return pt.getAllItem().forEach(i=>{i.type=="Copper Region"&&o.push(i)}),Xt.getAllItem().forEach(i=>{i.type=="Copper Region"&&o.push(i)}),Zt.getAllItem().forEach(i=>{i.type=="Copper Region"&&o.push(i)}),o}function uu(){let o=new Array;return[Mi.getInstance().getAllItem(),rn.getInstance().getAllItem(),zi.getInstance().getAllItem()].forEach(t=>{t.forEach(e=>{!e.isEmpty&&(e.type=="Board Outline"||e.type=="Line"&&e.layerId==11)&&o.push(e)})}),o}function dUe(){let o=new Array;return[pt.getAllItem(),Xt.getAllItem(),Zt.getAllItem()].forEach(t=>{t.forEach(e=>{!e.isEmpty&&(e.type=="Board Outline"||e.type=="Line"&&e.layerId==11)&&o.push(e)})}),o}function gV(){let o=new Array;return[Mi.getInstance().getAllItem(),rn.getInstance().getAllItem(),zi.getInstance().getAllItem()].forEach(t=>{t.forEach(e=>{!e.isEmpty&&e.type=="Slot Region"&&o.push(e)})}),o}function aU(o){if(o instanceof mt||o instanceof vt||o instanceof ct){let t;return o instanceof ct?t=o:t=o.getParent(),t.isClose()?2:3}return 2}function Kue(){pr.recycle(),Kt.recycle(),Hr.recycle(),Zt.recycle(),Xt.recycle(),ti.recycle(),is.recycle(),Go.recycle(),Uo.recycle(),Cr.recycle(),pt.recycle(),Ln.recycle(),Ei.recycle(),Qn.recycle(),Eb.recycle(),ze.recycle(),kt.recycle(),Vh.recycle(),be.recycle(),Vt.recycle()}function _s(o){let t=new _e;return o.forEach(e=>{t.ext1(e.buildBBox())}),t}function she(o){return o instanceof vt||o instanceof mt?[o.start,o.end]:o instanceof ct?[o.start,o.end]:o instanceof RG?[o.start,o.end]:null}function nUe(o,t){let e=[{point:o.center.add(new S(-o.radius,0)),distance:0,order:3},{point:o.center.add(new S(o.radius,0)),distance:0,order:1},{point:o.center.add(new S(0,-o.radius)),distance:0,order:2},{point:o.center.add(new S(0,o.radius)),distance:0,order:4}];for(let a of e)a.distance=t.distance1(a.point);e=e.sort((a,l)=>a.distance-l.distance);let r=e[0].order,i=e[1].order,n=e[0].point,s=e[1].point;return r<i?r==1&&i==4&&(n=e[1].point,s=e[0].point):(r!==4||i!==1)&&(n=e[1].point,s=e[0].point),[n,s]}function ZR(){let o=Ni(),t=o.getWidth(),e=o.getHeight(),r=new S(0,0),i=new S(t,-e),n=new S(t/2,-e/2),s=r.sub(n),a=i.sub(n),l=s.multiply4(o.get2dCameraMatrix().inverse()),c=a.multiply4(o.get2dCameraMatrix().inverse());return new _e().ext2(l).ext2(c).build1()}function ZXe(){let o=Hr.getAllItem(),t={};for(let e of o)if(e.type==1){let r=te.getInstance().getNet(e.net),n=te.getInstance().getDefaultBlindPhysics().name,s=t[n];s==null&&(s={},t[n]=s);let a=s[e.name];a==null&&(a=[],s[e.name]=a),a.push(e)}return t}function JXe(){let o=Hr.getAllItem();for(let e of o)if(e.type==1){let i=te.getInstance().getDefaultBlindPhysics().getBlindVia(e.name);i!=null&&i.status.used.add(e.globalIndex)}let t=be.getAllCopperLayer();for(let e of t)w$(e.layerID,e.visible)}function _3(o,t){let e=ti.getAllItem();e=e.filter(n=>n.key!=""&&!n.showKey&&!n.showValue);let r=t||new ve("modify Frame Origin"),i=new yV;r.addCommand(i),x.getInstance().doctype==4&&e.forEach(n=>{r.addCommand(Te.dispatch(n,"modify"));let s=n.position.sub(x.getInstance().origin).add(o);n.position=s}),!t&&je.executeCommand(r),x.getInstance().origin=o,wp()}function IN(o,t,e=.5){if(o.length==0)return o;let r=t*e,i=r*(Math.sqrt(2)/2),n=[o[0]];for(let s=1;s<o.length;s++){let a=n[n.length-1],l=o[s],c=o[s+1],h=!1;if(a instanceof M&&a.length()>=1e-8&&l instanceof M){let u=a.direct,d=a,p=null;if(Math.abs(u.dot(l.direct))<1e-4?p=l:c instanceof M&&Math.abs(u.dot(c.direct))<1e-4&&(p=c,s++),p){let m=d.direct,g=p.direct,y=p.start().sub(d.end()),b=Math.abs(m.dot(y)),P=Math.abs(g.dot(y)),T=d.length()+b,I=p.length()+P,C=Math.min(T,I),E=Math.max(b,P);if(C>=r+i+1e-8)E=JBe(E,i,C-r).value;else{E=Math.max(E,C-r);let v=t*.5,D=r*(Math.sqrt(2)/2);if(E<D){let w=v/3;if(C-D>=w)E=D;else{E=C;let F=n[n.length-2],H=o[s+1],z=!1;if(F instanceof M&&T-E<w&&Math.abs(F.direct.dot(m))<=1e-8&&(z=!0),H instanceof M&&I-E<w&&Math.abs(H.direct.dot(g))<=1e-8&&(z=!0),z){let G=D/(v+D);E=C*G}}}}let O=d.start().add(m.mul(T-E)),_=p.end().sub(g.mul(I-E)),R=fe.build4([d.start(),O,_,p.end()]);n.pop(),n.push(...R.primitives),h=!0}}h||n.push(l)}return n}function TDt(o){if(o.primitives.length<2)return fe.build2(o.primitives);let t=o.primitives[0],e=new Array;for(let r=1;r<o.primitives.length+1;r++){let i=o.primitives[r],n=!1;if(i instanceof M&&t instanceof M){let s=t.direct,a=i.direct;n=Math.abs(s.cross(a))<1e-8&&s.dot(a)>=0}n?(e.pop(),t=new M(t.start(),i.end()),e.push(t)):(e.push(t),t=i)}return fe.build2(e)}function IDt(o,t,e){let r=o.layerId,i=o.getMathGraphics(r,0),n=o.strokeWidth,s=o.locked,a=o.net,l=o.type;Object.is(e,void 0)&&(e=l!="Line");let c;if(i instanceof fe&&!xu(i.primitives,1e-5)){let{unclose:d,close:p}=EDt(i);c=[],p!=null&&(c=YI(p)),c.push(d)}else c=(i instanceof Gt?i.items:[i]).map(d=>YI(d)).flat(2);c=c.map(d=>TDt(d)),t&&(t.addCommand(Te.dispatch(o,"delete")),A.publish("delete",o),o.remove());let h=[],u=new io;return c.forEach(d=>{if(e&&!d.isClose()||d.isClose()&&d.primitives.length==2&&d.primitives[0]instanceof M&&d.primitives[1]instanceof M||pd(l)&&!xu(d.primitives))return;let p=Nm(u.plToShapes(d,r,n,s));if(p.length==0)return;let m=pt.addPolygon(l,r,[p],n,a,s);m.fill(),h.push(m),m.type=="Copper Region"&&gn.addOrder(m,t),t&&(t.addCommand(Te.dispatch(m,"add")),A.publish("hasModifyPcbItem",m))}),A.publish("ui/toastMsg",{type:"info",msg:"There is a self-intersection and will be split automatically"},$()),h}function Vm(o,t,e){let r=o.getMathGraphics();if(r instanceof fe)return IDt(o,t,e);let i=r.items.filter(d=>!vh(d))[0],n=r.getOutMostPolyline(),s=i;if(n!=i){let{relation:d}=new Fs(s,n,0);d==2&&(s=n)}let l=new Kc().getSubtraction([s],r.items.filter(d=>d!=s),[2,0]),c=o,h=[],u=new au;return l.forEach(d=>{let p=u.create4PlGrp(c.type,c.layerId,d,c.strokeWidth,c.net,!1);if(t){let m=Te.dispatch(p,"add");t&&t.addCommand(m)}h.push(p)}),t&&(t.addCommand(Te.dispatch(o,"delete")),A.publish("hasModifyPcbItem",o),o.remove(),A.publish("delete",o)),A.publish("ui/toastMsg",{type:"info",msg:"There is a self-intersection and will be split automatically"},$()),h}function Lue(o,t,e){let r=o.layerId,i=o.getMathGraphics(r,0),n=o.getParent(),s=-1;o.num&&(s=parseInt(o.num)||s);let a=YI(i),l=[];a.forEach(h=>{if(h.primitives.length<=1||!h.isClose()||h.primitives.length==2&&h.primitives[0]instanceof M&&h.primitives[1]instanceof M)return;let u=h,d=new Sm(u.primitives),p=u;p.area()>0&&(p=p.reverse());let m=$o.getStyle("POLYGON",-1,-1,-1,p),g=null,y=null,b=null,P=null;r===1?g=m:r===2?y=m:(g=m,y=m.clone(),b=m.clone(),P=vc.getHoleStyle(d.high*.6,d.high*.3,"ROUND",0,S.ORIGIN));let T=o.padRule?o.padRule.clone():void 0,I=$n.getInstance().addPad(cr(),r,1,s>-1?(s++).toString():o.num,d.center,o.rotation,o.locked,o.showNet,o.expansionType,o.pasteExpansion,o.topSolderExpansion,o.bottomSolderExpansion,o.unusedInnerLayers,o.plated,g,y,b,P,T);l.push(I)});let c=new Array;if(n!=null&&n instanceof Me){t&&t.addCommand(Te.dispatch(n,"modify")),A.publish("hasModifyPcbItem",n);for(let h of l){h.globalIndex=n.globalIndex+h.globalIndex;let u=Kt.addPolygonPadByModel(h);u.fill(),n.updatePads(u,"add"),c.push(u),A.publish("hasModifyPcbItem",u)}}else for(let h of l){let u=Kt.addPolygonPadByModel(h);u.fill(),c.push(u),t&&(t.addCommand(Te.dispatch(u,"add")),A.publish("hasModifyPcbItem",u))}return t&&(e!=null&&e.onlyMove||(n&&n instanceof Me?n.updatePads(o,"delete"):t.addCommand(Te.dispatch(o,"delete")),A.publish("hasModifyPcbItem",o)),o.remove(),A.publish("delete",o)),A.publish("ui/toastMsg",{type:"info",msg:"There is a self-intersection and will be split automatically"},$()),c}function dP(o,t){let e=$e.getInstance().getLayer(t);e==null&&(e=$e.getInstance().getHelpLayer(t));let r=e==null?void 0:e.activeColor,i=new Array;for(let n of o)if(n instanceof M)i.push(new hr(1002,n.start(),n.end(),!1,r));else if(n instanceof q)i.push(ns.build(1002,n.center,n.rx,mh(n.startAngle),mh(n.endAngle()),n.sweep(),r));else if(n instanceof Mr){let s=n.points(.1),a=s[0];for(let l=1,c=s.length;l<c;l++){let h=s[l];i.push(new hr(1002,a,h,!1,r)),a=h}}return i}function hhe(o,t=!0,e,r,i=!0){if(!x.getInstance().isactive||x.getInstance().doctype!==3)return;o=o||new ve("Clear all route!");let n=[],s=[],a=[];e?e==="track"?(n=pr.getAllItem(),Re.addAll(a,n)):e==="via"&&(s=Hr.getAllItem(),Re.addAll(a,s)):(n=pr.getAllItem(),s=Hr.getAllItem(),Re.addAll(a,[].concat(s,n)));for(let l=0;l<n.length;l++){let c=n[l];c.getParent()==null&&!c.locked&&!Ps(c.model)&&(!r||r.includes(c.net))&&(o.addCommand(Te.dispatch(c,"delete")),A.publish("hasModifyPcbItem",c),c.sendDeleteMsg=!1,c.remove(),A.publish("delete",c))}for(let l=0;l<s.length;l++){let c=s[l];c.locked||Ps(c.model)||c.getParent()==null&&(!r||r.includes(c.net))&&(o.addCommand(Te.dispatch(c,"delete")),A.publish("hasModifyPcbItem",c),c.sendDeleteMsg=!1,c.remove(),A.publish("delete",c))}t&&je.executeCommand(o),i&&A.publish("flushService",""),A.publish("clearSelect","")}function QXe(o){let t=o.net?ze.getSameNetItems(o.net):CDt(o),e=new Set;for(let n of t)n instanceof ds&&e.add(n);let r=new Set(o.searchNowNode()),i=new Set;for(let n of r)e.delete(n),i.add(n);for(r.add(o),e.delete(o);i.size>0&&e.size>0;)for(let n of i){let s=n.searchNowNode();s=SDt(s);for(let a of s)r.has(a)||a instanceof Le||(i.add(a),r.add(a),i.has(a)||e.delete(a));i.delete(n);break}return r}function CDt(o){let t=o.searchAllConnectNode(),e=new Array;for(let r of t)r instanceof Ue&&e.push(r);return e}function Hue(o){let t=new Set,e=new Map;for(let i of o)if(i instanceof ds){let n=e.get(i.net);n==null&&(n=new Set,e.set(i.net,n)),n.add(i)}let r=new er;for(let[i,n]of e){let s=XS(i);for(let a of s)for(let l of n)if(a.has(l.globalIndex)&&!t.has(l)){for(let c of a){let h=r.getConnectNode(c);t.add(h)}break}}return t}function SDt(o){let t=!1,e=[],r=new Array;for(let i of o)i instanceof Le&&(i.searchCycleNode().forEach(s=>{e.push(s.globalIndex)}),t=!0);if(t)for(let i of o)e.includes(i.globalIndex)||r.push(i);else r=o;return r}function UYe(o){let t=Lc(),e=new _e;for(let r of t)o&&!r.isVisible||(r instanceof fr?r.getText()!=""&&e.ext1(r.buildBBox()):r instanceof Ri?e.ext1(r.model.getBBox()):e.ext1(r.buildBBox()));return e.valid()?e.build1():new ut(1,1,1,1)}function L9(){let o=St.getInstance().getGridX(),t=St.getInstance().getGridY(),e=St.getInstance().getSnapX(),r=St.getInstance().getSnapY();return{xRatio:o/e,yRatio:t/r,gridX:o,gridY:t,snapX:e,snapY:r}}function eqe(o,t){if(o!=t){let e=ce.gridConfig,r=new ft;for(let i of e){let n=o=="mil"?i.milDeltaX:r.conversion("mm","mil",i.mmDeltaX),s=o=="mil"?i.milDeltaY:r.conversion("mm","mil",i.mmDeltaY);if(ne.eq(St.getInstance().getSnapX(),n)&&ne.eq(St.getInstance().getSnapY(),s)){let a=t=="mil"?i.milDeltaX:r.conversion("mm","mil",i.mmDeltaX),l=t=="mil"?i.milDeltaY:r.conversion("mm","mil",i.mmDeltaY),c=L9();St.getInstance().setSnapX(a),St.getInstance().setSnapY(l),ce.getAssociationPCBCanvasGridAndSnap()===1&&(St.getInstance().setGridX(a*c.xRatio),St.getInstance().setGridY(l*c.yRatio));break}if(ne.eq(St.getInstance().getGridX(),n)&&ne.eq(St.getInstance().getGridY(),s)){let a=t=="mil"?i.milDeltaX:r.conversion("mm","mil",i.mmDeltaX),l=t=="mil"?i.milDeltaY:r.conversion("mm","mil",i.mmDeltaY),c=L9();St.getInstance().setGridX(a),St.getInstance().setGridY(l),ce.getAssociationPCBCanvasGridAndSnap()===1&&(St.getInstance().setSnapX(a/c.xRatio),St.getInstance().setSnapY(l/c.yRatio));break}}}}function TGe(o){let t=Lc(),e=!0;for(let r of t){let i=r.model;!(i instanceof Je)&&!(i instanceof vi)&&!(i instanceof It)&&i instanceof ki&&i.layerId==o&&(!(i instanceof Li)||i.getText()!="")&&(e=!1)}return e}function bAe(o,t){let e="",r=!0;return t?((o==="Constraint Region"&&wf.getInstance().hasName(t)||o==="Copper Region"&&Ei.nameManager.has(t))&&(e="The name already exists, please modify",r=!1),o==="Partition"&&Dn.getInstance().hasName(t)&&(e="The name already exists, please modify",r=!1)):(e="The name cannot be empty, please modify",r=!1),r||A.publish("openMsgbox",new w9(e)),r}function tqe(){let o=be.getLayer(58),t=be.getLayer(59);return o.layerStatus===1&&t.layerStatus===1}function mU(o){let t=rqe.getIdMapHandler();return Object.values(t).findIndex(r=>r.dialogType===o)!==-1}function PAe(o){let t={};o.forEach(e=>{t[e.globalIndex]=!0});for(let e of o){let r;e.net==""?r=e.searchNode():r=e.searchNowNode();for(let i of r)if(!t[i.globalIndex])return!0}return!1}var KXe=Xs.conversion("mm","mil",2)/10;function HXe(o,t){let e=t.model.box.width||1,r=o/e,i=t.fontSize*r;return i>KXe?KXe:i}function L$(o,t,e){if(t==null)return;let r=o.get(t);r==null&&(r=new Array,o.set(t,r)),r.push(e)}function EDt(o){let t=o.primitives,e=t.length,r=new Map;for(let c=0;c<e;c++){let h=t[c];for(let u=c+1;u<e;u++){let d=t[u];if(h.bbox().isSeparated(d.bbox()))continue;let p=Tt(h,d);for(let m=0;m<p;m+=2){let g=new S(Ee[m],Ee[m+1]);g.equals1(h.end())&&g.equals(d.start())||(L$(r,h,g),L$(r,d,g))}}}for(let[c,h]of r)dn(h,c);let i=new Map,n=0,s=new Map;for(let c of t){let h=n++;L$(i,c.start(),h),s.set(h,c);let u=r.get(c);if(u!=null&&u.length>0)for(let d of u){let p=n++;s.set(p,c),L$(i,d,p)}}L$(i,t[e-1].end(),n++);let a=null,l=0;for(let[c,h]of i)if(h.length>1){let u=Math.max(...h)-Math.min(...h);u>l&&(l=u,a=c)}if(a!=null){let c=i.get(a),h=Math.max(...c),u=Math.min(...c),d=s.get(u),p=s.get(h),m=t.indexOf(d),g=t.indexOf(p),y=new Array,b=new Array;for(let P=0;P<e;P++)if(P<m)y.push(t[P]);else if(P==m){let T=gd(t[P],a);y.push(T[0]),b.push(T[1])}else if(P<g)b.push(t[P]);else if(P==g){let T=gd(t[P],a);b.push(T[0]),y.push(T[1])}else y.push(t[P]);return{unclose:fe.build2(y),close:fe.build2(b)}}return{unclose:o,close:null}}function Xj(o){return Vt.search(o,(t,e)=>cF(e)||e=="Polygon")}function cF(o){return o=="ArcTrack"||o=="Arc"||o=="Circle"||o=="Rect"}var ve=class extends Ou{constructor(e){super();this._commands=new Array;this.refreshService=!1;this.needCheckFilterCommand=!0;this._partitionNeedAskBeforeDelete=!1;this.createPartitionFile=!1;this.idMap=new Map;this.waitingUploadStack=new Array;this.sendCopperOrderChange=!1;this.description=e}openSendCopperOrder(){this.sendCopperOrderChange=!0}get commands(){return this._commands}undo(){let e=this._commands.length;if(e!=0){for(let r=e-1;r>=0;r--){let i=this._commands[r];i&&(!we.smartMode&&i instanceof mT||i.undo())}this.refreshService&&ie.publish("HistoryFlushService",""),this.refresh(),this.sendInfo2Proxy("undo"),this.sendCopperOrderChange&&ie.publish("CopperOrderUndo","")}}redo(){if(this._commands.length!=0){for(let r of this._commands)r&&(!we.smartMode&&r instanceof mT||r.redo());this.refreshService&&ie.publish("HistoryFlushService",""),this.refresh(),this.sendInfo2Proxy("redo"),this.sendCopperOrderChange&&ie.publish("CopperOrderRedo","")}}upload(e=!1){let r=this._commands.length;if(this.idMap.clear(),r!=0){if(e)for(let i=r-1;i>=0;i--){let n=this._commands[i];n&&(!we.smartMode&&n instanceof mT||n.upload(e))}else for(let i of this._commands)i&&(!we.smartMode&&i instanceof mT||i.upload(e));JS.getInstance().upload(),LT.getInstance().upload(),C6.getInstance().upload()}}addConnectChangeCommand(e){if(e.hasConnectChange()){let r=e.getConnnectChangeCommand();for(let i of r)this.addCommand(i)}}updateData(){}addCommand(e){if(e!=null){if(this.addConnectChangeCommand(e),this.refreshService&&this.waitingUploadStack.push(e),e.gId!=null){let r=this.idMap.get(e.gId);if(r!=null){if(!this.refreshService&&r.getAction()=="add"&&e.getAction()=="modify")return;r.updateData()}this.idMap.set(e.gId,e)}e instanceof q_&&(this._partitionNeedAskBeforeDelete=!0,this.createPartitionFile=!0),this._commands.push(e)}}get partitionNeedAskBeforeDelete(){if(this._partitionNeedAskBeforeDelete)return!0;if(this.createPartitionFile){for(let e of this.commands)if(e instanceof q_){if(e.hasFileUUID())return!0}else if(e instanceof Wg){let r=e.getItem();if(r!=null&&r instanceof Ye&&r.type=="Partition"){let i=r.getComponent();if(i instanceof Dc&&i.fileUuid!="")return!0}}}return!1}setCheckFilter(e){this.needCheckFilterCommand=e}increaseUpload(){if(this.waitingUploadStack.length>0){let e=Array.from(this.waitingUploadStack);this.waitingUploadStack.length=0;for(let r of e)r&&(!we.smartMode&&r instanceof mT||r.upload(!1))}JS.getInstance().upload(),LT.getInstance().upload(),C6.getInstance().upload()}checkFilterCommand(){let e=new Array,r=new Array,{canEditArr:i,hasCanNotEdit:n}=this.checkItemsAreCanEdit(),s=!1,a=new Array;for(let c of this._commands)if(c){if(n)if(c instanceof C_){if(!c.getStackTableIsCanEdit()&&!s){let u="beyond drawing range";Bt.showMassageTip(u,u),s=!0}continue}else{let h=i.get(c.gId);if(a.unshift(c),!h&&!s){let u="beyond drawing range";Bt.showMassageTip(u,u),s=!0}continue}this.needCheckFilterCommand&&c instanceof Wg?c.compareDataChange(r)&&e.push(c):e.push(c)}for(let c=0;c<a.length;c++)a[c].undo();this._commands=new Array(e.length+r.length);let l=0;for(let c=0;c<e.length;c++,l++)this._commands[l]=e[c];for(let c=0;c<r.length;c++,l++)this._commands[l]=r[c];return e.length=0,r.length=0,this._commands}checkItemsAreCanEdit(){let e=new Map,r=!1;if(x.getInstance().projectId==""&&!Dn.getInstance().hasSpiltOutPartition())return{canEditArr:e,hasCanNotEdit:r};for(let i of this._commands){if(!i)continue;if(i instanceof C_){i.getStackTableIsCanEdit()||(r=!0);continue}let n=Te.getManager(i),s=n&&n.getItem(i.gId);if(s){let a=Bt.checkIsInCanEdit(s);if(s instanceof fr&&s.getParent()instanceof Me&&(!s.showKey&&!s.showValue&&(a=!0),s.showKey&&!s.key&&(a=!0),s.showValue&&!s.value&&(a=!0)),s instanceof Me){let c=!0;for(let h of s.attributes){if(!h.showKey&&!h.showValue||h.showKey&&!h.key||h.showValue&&!h.value)continue;let u=Bt.checkIsInCanEdit(h);u||(c=u)}for(let h of s.getPads())Bt.checkIsInCanEdit(h)&&(h.partition=x.getInstance().partitionId);a&&!c&&(a=c)}this.description=="create partition"&&(a=!0),(this.description=="line break up"||this.description=="merge polygon")&&(a=!0),["clear-Designator","refDesignator","resetUniquId"].indexOf(this.description)>=0&&(a=!0);let l=a?1:0;e.set(i.gId,l),r===!1&&l===0&&(r=!0)}}return{canEditArr:e,hasCanNotEdit:r}}needSendInfo(){let e=[];for(let r of this._commands)if(r&&r instanceof Wg){let{action:i,data:n}=r.needSendInfo(r);if(i=="fullUpdate")return{action:i};if(i=="notUpdate"){if(this._commands.length==1)return{action:"notUpdate"};continue}if(i=="halfUpdate"){e.push(n);continue}}if(e.length>0)return{action:"halfUpdate",data:e};if(e.length==0)return{action:"notUpdate"}}refresh(){let e=!1;for(let r of this._commands)if(r&&r instanceof Wg&&r.tool.is3DShell()){e=!0;break}e&&ie.publish("needRefresh3DWindow","")}sendInfo2Proxy(e){if(mU("pcb-copper-manager")&&this._commands.some(r=>r instanceof Wg)){let{action:r,data:i}=this.needSendInfo();if(r=="notUpdate")return;if(r=="fullUpdate")ie.publish("pcbdialogModify",{dialogType:"pcb-copper-manager",action:"modifyCopperMangerDialogParams"});else{if(i.length>0)for(let n of i){if(e=="execute"&&n.key=="layerId")return;n.command=e}ie.publish("pcbdialogModify",{dialogType:"pcb-copper-manager",action:"modifyCopperMangerDialogParams",data:i})}}}get length(){return this._commands.length}warnDeleteSubPcbBeforeRemove(){let e;if(this._commands.forEach(n=>{n.type=="Partition"&&(e=n.gId)}),!e)return;let r=Dn.getInstance().getItemById(e);if(!r)return;let i=r.model.component.fileUuid;ie.publish("deletePartitionItemAndSubPcb",{subPcbUuid:i,mainPcbUuid:x.getInstance().id},$())}};var Zue=class{constructor(){this.undoCommand=new Array;this.redoCommand=new Array;this.stack=null}executeCommand(t){if(t instanceof ve&&!t.checkFilterCommand().length)return;t instanceof ve&&(t.refreshService=!0),x.getInstance().isactive&&23!=x.getInstance().doctype&&A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),this.stack!=null&&(this.undoCommand.push(this.stack),this.stack=null),t instanceof ve?(this.stack=t,t.refresh()):this.undoCommand.push(t),this.redoCommand.length>0&&(this.redoCommand.length=0),!(t instanceof ve&&t.description=="create partition")&&A.publish("flushTearDrop",""),t instanceof ve&&t.sendInfo2Proxy("execute");let e=50;for(this.stack!=null&&(e=49);this.undoCommand.length>e;)this.undoCommand.shift();this.updateTop(),t.upload(),t instanceof ve&&this.sendMessageToExtensionApi(t)}increaseUpload(){this.stack!=null&&this.stack.increaseUpload()}redo(){if(this.stack!=null&&(this.undoCommand.push(this.stack),this.stack instanceof ve&&this.sendMessageToExtensionApi(this.stack),this.stack=null),this.redoCommand.length>0){let t=this.redoCommand.pop();t!=null&&(t.redo(),t.upload(),this.undoCommand.push(t),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),t instanceof ve&&this.sendMessageToExtensionApi(t))}this.updateTop()}undo(){if(this.stack!=null)this.singleUndo(this.stack)&&(this.stack=null);else if(this.undoCommand.length>0){let t=this.undoCommand.pop();t!=null&&(this.singleUndo(t)||this.undoCommand.push(t))}this.updateTop()}singleUndo(t){return t instanceof ve&&t.partitionNeedAskBeforeDelete?(t.warnDeleteSubPcbBeforeRemove(),!1):(t.undo(),t.upload(!0),this.redoCommand.push(t),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),t instanceof ve&&this.sendMessageToExtensionApi(t,!0),!0)}clear(){this.undoCommand.length=0,this.redoCommand.length=0,this.stack=null,this.updateTop()}updateTop(){(x.getInstance().doctype===3||x.getInstance().doctype===4)&&(this.stack!=null?we.undo=!0:this.undoCommand.length>0?we.undo=!0:we.undo=!1,this.redoCommand.length>0?we.redo=!0:we.redo=!1)}sendMessageToExtensionApi(t,e=!1){var s,a;let r=t.commands[0].getAction();if(e)switch(r){case"add":r="delete";break;case"delete":r="add";break}let i=[],n=t.commands;for(let l=0;l<n.length;l++){let c=n[l],h=this.getCommandType(c);c instanceof oP&&r=="delete"?i.push({primitiveId:c.gId,primitiveType:h,designator:(s=c==null?void 0:c.data)==null?void 0:s.attrsMap.Designator}):"gId"in c&&i.push({primitiveId:c.gId,primitiveType:h})}(a=A.extensionApiMessageBus2())==null||a.publish("extensionApi.PCB_Event.primitiveEvent",{eventType:r,props:i})}getCommandType(t){let e="";return t instanceof n6?e="Dimension":t instanceof mT?e="SmartDimension":t instanceof o6?e="Pad":t instanceof P6?e="PolygonPad":t instanceof QA?e="PcbCircle":t instanceof a6?e="Protractor":t instanceof e_?e="Rect":t instanceof l6?e="Text":t instanceof c6?e="Track":t instanceof b6?e="ArcTrack":t instanceof h6?e="Via":t instanceof f6?e="RadiusMark":t instanceof MT?e="Polygon":t instanceof oP?e="Component":t instanceof T6?e="Image":t instanceof I6?e="TrueColorPicture":t instanceof pF?e="PlaneZone":t instanceof GR&&(e="CopperResult"),e}set partitionNeedAskBeforeDelete(t){if(this.stack!=null)this.stack._partitionNeedAskBeforeDelete=t;else if(this.undoCommand.length>0){let e=this.undoCommand[this.undoCommand.length-1];e instanceof ve&&(e._partitionNeedAskBeforeDelete=t)}}};var m2=class{constructor(t,e,r,i=!1,n){this._needGray=!1;this._beforeGrayHidden=null;this._isUnderGrid=!1;this.model=t,this._active=e,this._order=r,(t.layerId==1||t.layerId==2)&&(n=r+10),this._copperOrder=n,this._isUnderGrid=i,this._active?this._status=!0:this._status=!1,(this.layerID==57||this.layerID==1001||this.layerID==1002)&&(this._status=!0),w$(this.layerID,this.visible),this.refreshRender()}refreshRender(){Do.attachLayer(this)}getOrder(t){return t==null?1e3+this.model.layerId:t}get layerID(){return this.model.layerId}get state(){return this.model.state}get layerStatus(){return this.model.config?this.model.visible?1:2:0}set layerStatus(t){t==0?(this.config=!1,this.visible=!1):t==2?(this.config=!0,this.visible=!1):(this.config=!0,this.visible=!0),this.refreshRender()}get needGray(){return this._needGray}set needGray(t){this._needGray=t,this.refreshRender()}get isColorful(){return this._needGray?!!this._active:!0}get beforeGrayHidden(){return this._beforeGrayHidden}set beforeGrayHidden(t){this._beforeGrayHidden=t}get type(){return this.model.type}set type(t){this.model.type=t}get status(){return this._status}set status(t){if(this._status=t,this.model.config&&this.model.layerId==12){let e=be.getHoleLayer();e!=null&&(e.status=t)}(this.layerID==57||this.layerID==1001||this.layerID==1002)&&(this._status=!0),this.refreshRender()}get order(){return this._order}set order(t){t=this.getOrder(t),this._order=t,this.refreshRender()}get copperOrder(){return this._copperOrder}set copperOrder(t){t=this.getOrder(t),this._copperOrder=t,this.refreshRender()}set isUnderGrid(t){this._isUnderGrid=t}get isUnderGrid(){return this._isUnderGrid}get name(){return this.model.name}set name(t){this.model.name=t}get activeColor(){return this.model.activeColor}set activeColor(t){this.model.setActiveColor(t),this.refreshRender()}get deactiveColor(){return this.model.deactiveColor}set deactiveColor(t){this.model.deactiveColor=t,this.deactiveAlpha=t.alpha*this.model.activeColor.alpha,this.refreshRender()}set deactiveAlpha(t){this.model.deactiveColor=ee.of6(this.model.deactiveColor,t),this.refreshRender()}get color(){return this.model.activeColor}get visible(){return this.model.visible}set visible(t){if(this.model.visible=t,this.model.config){if(this.layerID==47){let e=be.getMultLayer();e!=null&&(t=e.visible)}if(this.model.layerId==12){let e=be.getHoleLayer();e!=null&&(e.visible=t)}}w$(this.layerID,t),this.refreshRender()}get locked(){return this.model.locked}set locked(t){this.model.locked=t}get active(){return this._active}set active(t){if(this._active=t,this._status=t,this.model.layerId==12){let e=be.getHoleLayer();e!=null&&(e.active=t)}(this.layerID==57||this.layerID==1001||this.layerID==1002)&&(this._status=!0),this.refreshRender()}get config(){return this.model.config}set config(t){this.model.config=t,this.refreshRender()}get transparency(){return 1-this.model.activeColor.alpha}set transparency(t){this.setTransparency(t,!1)}setTransparency(t,e){let r=1-t,i=ee.build(this.model.activeColor.r,this.model.activeColor.g,this.model.activeColor.b,r);this.model.setActiveColor(i,e),this.refreshRender()}setActiveColor(t,e){this.model.setActiveColor(t,e),this.refreshRender()}isSignalLayer(){return gs(this.model.type)}isPlaneLayer(){return Rh(this.model.type)}isCopperLayer(){return Lte(this.model.type)}isDrillLayer(){return e8e(this.model.type)}isInnerLayer(){return this.layerID>=15&&this.layerID<=46}getMenu(){return{name:this.name,cmd:`switchToLayer(${this.layerID})`,tips:""}}getRenderData(){let t=vB.build(this.config,this.visible,this._status,this.isColorful,this.isPlaneLayer());return{layerId:this.model.layerId,order:this._order,copperOrder:this._copperOrder,activeColor:this.model.activeColor,deactiveColor:this.model.deactiveColor,layerState:t,highlightColor:ee.BLACK,highLightType:null,isUnderGrid:this._isUnderGrid}}getType(){return 26}getViewState(){return this.config?this.visible?this.isColorful?"Main And Highlight":"Only Main":"Not Shown":"Not Shown"}};var Jue=class extends wi{constructor(){super(...arguments);this.modelManager=$e.getInstance();this.grayIndex=0;this._layerMap={};this.lastActiveLayer=0;this.activeOrder=10;this.configInnerLayers=new Set}get activeLayer(){return $e.getInstance().activeLayer}set activeLayer(e){$e.getInstance().activeLayer=e}get ratlineLayer(){return this.getLayer(57)}get layerMap(){return this._layerMap}set layerMap(e){this._layerMap=e}refreshConfigInnerLayers(e,r){r.isInnerLayer()&&(r.config?this.configInnerLayers.add(e):this.configInnerLayers.delete(e))}addPcbLayer(e,r,i,n,s,a,l,c){let h=vf.build(c!=0,c==1,!1),u=$e.getInstance().addLayer(e,r,i,h,s,a),d=new m2(u,l,n);return this.layerMap[e]=d,l&&(this.lastActiveLayer=this.activeLayer,this.activeLayer=e),this.refreshConfigInnerLayers(e,d),d}addPcbLayerByModel(e,r=!1,i=lCe[e.layerId.toString()]){let n=e.layerId;i=i==null?this.getCustomLayerOrder(n):i;let s=new m2(e,r,i);return this.layerMap[n]=s,r&&(this.lastActiveLayer=this.activeLayer,this.activeLayer=n),this.refreshConfigInnerLayers(n,s),s}modifyLayer(e,r,i,n,s,a,l,c){let h=this.layerMap[e];return h==null?this.addPcbLayer(e,r,i,n,s,a,l,c):(h.type=r,h.order=n,h.name=i,h.activeColor=s,this.activeLayer!=e?(h.active=l,l&&(this.lastActiveLayer=this.activeLayer,this.activeLayer=e)):h.active=!0,h.layerStatus=c,(this.activeLayer==1&&e==3||this.activeLayer==2&&e==4)&&(h.status=!0),this.refreshConfigInnerLayers(e,h),h)}getTopSilkLayer(){return this.getLayer(3)}getBottomSilkLayer(){return this.getLayer(4)}getTopLayer(){return this.getLayer(1)}getBottomLayer(){return this.getLayer(2)}getAllLayer(){let e=new Array;for(let r in this.layerMap)e.push(this.layerMap[r]);return e}getLayer(e){let r=this.layerMap[e];return r==null?null:r}setLayer(e){let r=e.layerID;this.layerMap[r]=e}hiddenAllPlanes(){let e=this.activeLayer;this.getLayer(e).isPlaneLayer()||A.publish("endAllPlane",null)}setActiveLayer(e,r){let i=this.activeLayer;this.getLayer(i).isPlaneLayer()&&A.publish("endPlane",i),e.isPlaneLayer()&&A.publish("startPlane",e.layerID);let n=this.layerMap[i].status;if(this.layerMap[i].active=!1,ms(i)?(this.rostoreBottom(),(i==2||i==4)&&this.rostoreBottomColor()):G2(i)?(this.rostoreTop(),(i==1||i==3)&&this.rostoreTopColor()):this.restoreLayer(i),this.grayIndex==2){let s=[{layerId:e.layerID,show:!0}];[12,47,11,57].includes(i)||(e.layerID!=i&&s.push({layerId:i,show:!1}),this.layerMap[i].needGray=!1,this.layerMap[i].visible=!1),e.needGray=!1,e.visible=!0,A.publish("layerStatus",s,$())}this.lastActiveLayer=i,this.activeLayer=e.layerID,i=e.layerID,ms(i)?(this.setBottomActive(i),i==2?this.setBottomActiveColor(n):e.order=this.activeOrder):G2(i)?(this.setTopActive(i),i==1?this.setTopActiveColor(n):e.order=this.activeOrder):i==12||i==47||(e.order=this.activeOrder),this.setActiveLayerTopAfterGray(),e.active=!0,e.status=n,this.grayIndex==1&&this.setGray(1),x.getInstance().isactive&&23!=x.getInstance().doctype&&A.publish("setActive",{activeLayer:i,LayerBartoggleLayer:r},$())}setActiveLayerId(e){let r=this.getLayer(e);r!=null&&this.setActiveLayer(r)}getActiveLayer(){return this.layerMap[this.activeLayer]}getOutlineLayer(){return this.getLayer(11)}getActiveLayerID(){return this.activeLayer}getLastActiveLayerID(){return this.lastActiveLayer}getHoleLayer(){return this.layerMap[47]}getMultLayer(){return this.layerMap[12]}getRatlineLayer(){return this.ratlineLayer}getLayerName(e){return this.layerMap[e].name}getLayerOptions(){let e=new Array;for(let r in this.layerMap){let i=this.layerMap[r];if(i.config){let n={};n.text=i.name,n.value=r,e.push(n)}}return e}getSignalLayerOptions(e=!0){let r=new Array;for(let i in this.layerMap){let n=this.layerMap[i];if(n.config&&(n.isSignalLayer()||e&&n.isPlaneLayer())){let s={};s.text=n.name,s.value=i,s.color=n.color.toString(),r.push(s)}}return r}getAllEnableInnerLayers(){let e=new Array;for(let r in this.layerMap){let i=this.layerMap[r];(i.isSignalLayer()||i.isPlaneLayer())&&i.layerID!==1&&i.layerID!==2&&String(i.layerStatus)!=="0"&&e.push(i)}return e}getAllSignalLayer(){let e=new Array;for(let r in this.layerMap){let i=this.layerMap[r];i.config&&i.isSignalLayer()&&e.push(i)}return e}getAllSignalLayerIds(){return this.getAllSignalLayer().map(e=>e.layerID)}getAllPlaneLayer(){let e=new Array;for(let r in this.layerMap){let i=this.layerMap[r];i.config&&i.isPlaneLayer()&&e.push(i)}return e}getAllPlaneLayerIds(){return this.getAllPlaneLayer().map(e=>e.layerID)}getAllPinLayer(){return[this.layerMap[50],this.layerMap[51]]}getAllPinLayerIds(){return[50,51]}getAllCopperLayer(){let e=new Array;for(let r in this.layerMap){let i=this.layerMap[r];i.config&&i.isCopperLayer()&&e.push(i)}return e}getSortCopperLayer(){return this.copperLayerSort(this.getAllCopperLayer())}copperLayerSort(e){return e.sort((r,i)=>Ms(r.layerID)!==Ms(i.layerID)?r.layerID===1?-1:i.layerID===1?1:Ms(r.layerID)?-1:1:r.layerID>i.layerID?1:-1)}getAllCopperLayerIds(){return this.getAllCopperLayer().map(e=>e.layerID)}setTopActive(e){let r=this.getLayer(3),i=this.getLayer(1),n=this.getLayer(5),s=this.getLayer(7),a=this.getLayer(9),l=this.getLayer(58);r&&(r.order=12),i&&(i.order=13),n&&(n.order=14),s&&(s.order=16),a&&(a.order=17),l&&(l.order=18),i&&(i.copperOrder=19)}setBottomActive(e){let r=this.getLayer(4),i=this.getLayer(2),n=this.getLayer(6),s=this.getLayer(8),a=this.getLayer(10),l=this.getLayer(59);r&&(r.order=12),i&&(i.order=13),n&&(n.order=14),s&&(s.order=16),a&&(a.order=17),l&&(l.order=18),i&&(i.copperOrder=19)}setTopActiveColor(e){let r=this.getLayer(3),i=this.getLayer(1);r&&(r.status=e),i&&(i.status=e)}setBottomActiveColor(e){let r=this.getLayer(4),i=this.getLayer(2);r&&(r.status=e),i&&(i.status=e)}restoreLayer(e){let r=this.getLayer(e);r!==null&&(r.order=lCe[e.toString()])}getAllConfigLayerSortByRightPanel(){let e=this.getAllEnableLayer(),r={top:new Array,bottom:new Array,inner:new Array,other:new Array,component:new Array,shell3D:new Array},i=new Array;for(let n of e){let s=n.layerID;G2(s)?r.top.push(n):ms(s)?r.bottom.push(n):Ms(s)?r.inner.push(n):this.inOther(s)?r.other.push(n):Mte(s)?r.component.push(n):ba(s)&&r.shell3D.push(n)}return i.push(...r.top,...r.bottom,...r.inner,...r.other,...r.component,...r.shell3D),i}inOther(e){return!!(e==11||e==12||e==13||e==14||e==56||e==57||this.modelManager.isCustomLayer(e))}getLayersByOrder(){let e=new Array;for(let i in this.layerMap){let n=this.layerMap[i];n.config&&e.push(n)}xr(e,(i,n)=>i.order-n.order,0,e.length);let r=new Array;for(let i of e)r.push(i.layerID);return r}rostoreTop(){this.restoreLayer(3),this.restoreLayer(1),this.restoreLayer(5),this.restoreLayer(7),this.restoreLayer(9),this.restoreLayer(58);let e=this.getLayer(3),r=this.getLayer(1);e&&(e.status=!1),r&&(r.status=!1),r&&(r.copperOrder=r.order+10)}rostoreTopColor(){let e=this.getLayer(3),r=this.getLayer(1);e&&(e.status=!1),r&&(r.status=!1)}rostoreBottom(){this.restoreLayer(4),this.restoreLayer(2),this.restoreLayer(6),this.restoreLayer(8),this.restoreLayer(10),this.restoreLayer(59);let e=this.getLayer(4),r=this.getLayer(2);e&&(e.status=!1),r&&(r.status=!1),r&&(r.copperOrder=r.order+10)}rostoreBottomColor(){let e=this.getLayer(4),r=this.getLayer(2);e&&(e.status=!1),r&&(r.status=!1)}setGrayIndex(e){this.grayIndex=e}getGrayIndex(){return this.grayIndex}setGray(e){let r=this.grayIndex,i=isNaN(parseInt(e.toString()))?(this.grayIndex+1)%3:parseInt(e.toString());if(r===i)return;let n=!1;i!=0&&(n=!0),x.getInstance().forceVisibleHighRange=n,Jb.getInstance().setForceHightRange(n),this.grayIndex=i,we.grayState=this.getGrayIndex();let s=this.getAllLayer(),a=new Array;this.grayIndex==0?s.forEach(l=>{if(l.layerID!=12&&l.layerID!=47&&l.layerID!=11&&l.layerID!=57&&l.layerID!=this.activeLayer){l.visible=l.beforeGrayHidden!=null?l.beforeGrayHidden:l.visible;let c={layerId:l.layerID,show:l.visible};a.push(c)}l.beforeGrayHidden=null,l.needGray=!1}):this.grayIndex==1?s.forEach(l=>{if(l.layerID!=12&&l.layerID!=47&&l.layerID!=11&&l.layerID!=57){l.needGray=!0,l.visible=l.beforeGrayHidden!=null?l.beforeGrayHidden:l.visible;let c={layerId:l.layerID,show:l.visible};a.push(c)}}):s.forEach(l=>{if(l.layerID!=12&&l.layerID!=47&&l.layerID!=11&&l.layerID!=57&&(l.needGray=!1,l.beforeGrayHidden=l.visible,l.layerID!=this.activeLayer)){l.visible=!1;let c={layerId:l.layerID,show:!1};a.push(c)}}),(r==0&&this.grayIndex!=0||r!=0&&this.grayIndex==0)&&(this.setActiveLayerTopAfterGray(),this.setActiveLayerId(this.activeLayer)),A.publish("dealMultLayer",this.grayIndex),A.publish("layerStatus",a,$())}setActiveLayerTopAfterGray(){let e=this.getActiveLayer();this.grayIndex!=0&&(e.layerID==1||e.layerID==2?(e.order=8,this.getLayer(e.layerID).copperOrder=9):e.order=9)}getLayerPhy(e){return this.modelManager.getLayerPhy(e)}getLayerPhys(){return this.modelManager.getLayerPhys()}setLayerPhys(e,r=!1){let i=new Set(this.modelManager.getLayerPhys());for(let n of e){let s=this.modelManager.modifyLayerPhy(n["Layer Id"],n.Material,n.Thickness,n.Permittivity,n["Loss Tangent"],n.IsKeepIsLand==null?!0:n.IsKeepIsLand==1,n.zIndex);i.delete(s),r&&uF(s)}for(let n of i)this.modelManager.deleteLayerPhy(n.layerId),r&&uF(n,!0)}checkLayerPhys(){if(this.getLayerPhys().length==0){this.setDefaultLayerPhys();return}let e=this.getSortCopperLayer();this.sortLayerPhys(e)}sortLayerPhys(e){let r=["TOP_SILK","TOP_PASTE_MASK","TOP_SOLDER_MASK","TOP","SUBSTRATE","BOTTOM","BOT_SOLDER_MASK","BOT_PASTE_MASK","BOT_SILK"],i=new Array(r.length),n=r.indexOf("SUBSTRATE"),s=0;this.iteratorLayerPhysical((c,h)=>{let u=h.layerType;Ms(c)&&s++;let d=r.indexOf(u);return d<0&&(d=n),i[d]||(i[d]=[]),i[d].push(h),!0}),Fn(i,(c,h,u)=>{if(u==n)return!0;if(!h){let d=this.createPcbLayerPhy(fhe[u]);d&&(i[u]=[d])}});let a=e.filter(c=>!!c.isInnerLayer());if(s<a.length){let c=i[n];c||(c=[]);let h={};c.forEach(u=>{h[u.layerId]=u}),Fn(a,(u,d)=>{h[d.layerID]||c.push(this.getPhyByLayer(d))}),c=this.sortInnerPhy(c),i[n]=c}let l=i.flat();return this.resetLayerPhy(l),i[n]}resetLayerPhy(e){let r=this.modelManager.getLayerPhys();for(let i of r)this.modelManager.deleteLayerPhy(i.layerId);for(let i of e)this.modelManager.addLayerPhyModel(i)}checkInnerPhy(e,r,i){e=e||[];let n=-1,s=-1,a=361,l=new ft().mm2mil(cOe-s$*r-hOe*2)/(r-1)/10,c=[];if(Fn(e,(h,u,d)=>{if(Ms(u.layerId)){if(s++,d-n-1<=0){let m=this.getDefPhys(s,i,l,a);a=m.substrateLayerId,c.push(m.phy)}n=d}c.push(u)}),n!=-1&&n==e.length-1||n==-1&&e.length==0){let h=this.getDefPhys(s,i,l,a);c.push(h.phy)}return c}getDefPhys(e,r,i,n){let s,a=n;for(;this.layerMap[a]!=null;)a++;let l=a-361+1;return s=this.createPcbLayerPhy({"Layer Id":a,Layer:`\u4ECB\u7535${l}`,Type:"Substrate",Material:e===r/2-1?"FR4":"PP",Thickness:i,Permittivity:a$,"Loss Tangent":l$,IsKeepIsLand:1,zIndex:999+l*2}),this.layerMap[a]==null&&(this.addPcbLayer(a,"SUBSTRATE",`Dielectric${l}`,a,ee.of1(0),ee.of1(0),!1,0),a++),{phy:s,substrateLayerId:a}}sortInnerPhy(e){return e.sort((r,i)=>Ms(r.layerId)&&Ms(i.layerId)?r.layerId>i.layerId?1:-1:1)}createPcbLayerPhy(e){if(e)return new xA(e["Layer Id"],e.Material,e.Thickness,e.Permittivity,e["Loss Tangent"],e.IsKeepIsLand,e.zIndex)}getPhyByLayer(e){return this.createPcbLayerPhy({"Layer Id":e.layerID,Layer:e.name,Type:"Copper",Material:null,Thickness:new ft().mm2mil(s$)/10,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:this.getCopperLayerPhyZInde(e.layerID)})}getCopperLayerPhyZInde(e){return e==1?1e3:e==2?9e3:(e-15+1)*2+1e3}iteratorLayerPhysical(e){Fn(this.getLayerPhys(),(r,i,n)=>{e(i.layerId,i)})}setDefaultLayerPhys(){this.delAllSubstrateLayers();let e=this.getSortCopperLayer(),r=e.length===2?fhe:this.getLayerPhySettingByLayer(e);for(let i=1;i<e.length;i++)this.addPcbLayer(361+i-1,"SUBSTRATE",`Dielectric${i}`,361+i-1,ee.of1(0),ee.of1(0),!1,0);this.setLayerPhys(r)}getLayerPhySettingByLayer(e){let r=QGe(fhe),i=new ft().mm2mil(cOe-s$*e.length-hOe*2)/(e.length-1)/10,n=e.reduce((s,a,l,c)=>(s.push({"Layer Id":a.layerID,Layer:a.name,Type:"Copper",Material:null,Thickness:new ft().mm2mil(s$)/10,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:this.getCopperLayerPhyZInde(a.layerID)}),l!==c.length-1&&s.push({"Layer Id":361+l,Layer:`\u4ECB\u7535${l+1}`,Type:"Substrate",Material:l===c.length/2-1?"FR4":"PP",Thickness:i,Permittivity:a$,"Loss Tangent":l$,IsKeepIsLand:1,zIndex:1001+l*2}),s),[]);return r.splice(3,3,...n),r}delAllSubstrateLayers(){Fn(this.layerMap,(e,r,i)=>{Number(e)>=361&&delete this.layerMap[e]})}getInnerLayerOrder(e){let r=15;return Ms(e)?e-r+1:0}getCustomLayerOrder(e){return 1e3+e}getAllEnableLayer(){return this.getAllLayer().filter(e=>e.config)}checkDefault(){let e=this.defaultLayerID();for(let r of e){let i=this.getLayer(r);if(i!=null&&i.layerStatus==0&&(i.layerStatus=1),i==null){for(let n of Bg)if(n.layerId==r){let s=this.addPcbLayer(n.layerId,n.type,n.name,n.order,n.activeColor,n.deactiveColor,n.active,n.layerStatus);s.locked=!0}}}this.setActiveLayerId(this.activeLayer),this.checkLayerPhys()}defaultLayerID(){return[1,2,3,4,5,6,7,8,9,10,11,12,13,14,47,48,49,50,51,53,54,55,56,57]}getfilterPhyLayers(){let e={};for(let r in this.layerMap){let i=this.layerMap[r];i.type=="SUBSTRATE"?this.getLayerPhy(i.layerID)!=null&&(e[r]=i):e[r]=i}return e}updatePlanzoneLayerKeepIsland(e,r){let i=this.getLayerPhy(e);i&&(i.isKeepIsland=r)}fetchPlanzoneLayerKeepIsland(e){let r=this.getLayerPhy(e);return r?r.isKeepIsland:!1}forceDeactive(e){x.getInstance().forceDeactive!=e&&(x.getInstance().forceDeactive=e,this.refreshRender())}refreshRender(){for(let e in this.layerMap){let r=this.layerMap[e];r.config&&r.refreshRender()}}getLayerNameMap(){let e=this.layerMap,r=new Map;return gm(e,i=>{let{layerID:n,name:s}=i;mR(r,s,n,!1)}),r}enableLayer(e){let r=this.getLayer(e);return r?(r.config||(r.config=!0,r.visible=!0),r):null}isLayerEnabled(e){let r=this.getLayer(e);return!!(r!=null&&r.config)}getBasicLayerTable(e){let r={};return e.forEach(i=>{let n=this.getLayer(i);if(!n)return;let{name:s,type:a}=n,l={layerId:i,layerType:a,layerName:s};r[i]=l}),r}detectDisabledLayerTable(e){let r=null,i={},n={};return gm(e,s=>{let{layerId:a,layerType:l,layerName:c}=s;r||(r=this.getLayerNameMap());let h;if(l=="CUSTOM"){let u=r.get(c);u&&(h=this.getLayer(u),u!=a&&(n[a]=u))}else h=this.getLayer(a);(!h||!h.config)&&(i[a]=s)}),{disabledLayerTable:i,layerIdReplacementTable:n}}detectDisabledLayerTables(e){let r={};return gm(e,(i,n)=>{let s=this.detectDisabledLayerTable(i);r[n]=s}),r}enableLayers(e,r){if(jy(e))return null;let i=this.getLayerNameMap(),n=new Map,s=[];gm(e,d=>{let{layerName:p,layerType:m}=d;if(m!="CUSTOM")return;let g=i[p];g?mR(n,p,g,!1):U8e(p,s,!1)});let a=s.length;if(a>0){let d=-1;UA(i,p=>{let m=this.getLayer(p),{name:g,type:y,config:b}=m;if(y=="CUSTOM"&&!b&&!fR(n,g)){let P=s[++d];n.set(P,p)}return a==d+1})}let l={},c={},h=QCe(i),u=[];if(gm(e,d=>{let{layerId:p,layerName:m,layerType:g}=d;if(r&&g!="CUSTOM"||u.includes(p)||BA(l,m))return;let y=p;if(g=="CUSTOM")y=n.get(m),y!=p&&FA(l,m,y);else if(g=="SIGNAL"||g=="PLANE")u.push(y);else if(g=="TOP_STIFFENER"||g=="BOTTOM_STIFFENER"){let P=this.enableLayer(g=="TOP_STIFFENER"?59:58);P&&Sp(P.layerID)}let b=r?this.getLayer(y):this.enableLayer(y);if(b){let P=this.resetLayerName(b,i);if(P!=m){let T=i.get(m);!T||T==y?b.name=m:m!=P&&(c[m]={layerId:b.layerID,layerType:g,layerName:P})}i.set(b.name,y),h.push(m),b.type=g,Sp(b.layerID)}}),u.length%2!=0){let d=null;Rc(u.sort(),m=>{if(m%2!=0){let y=m+1;if(!this.isLayerEnabled(y))return d=y,!0}else if(!d){let y=m-1;this.isLayerEnabled(y)||(d=y)}});let p=d;if(!p)for(p=15;this.isLayerEnabled(p);)p+=1;if(!r){let m=this.enableLayer(p);this.resetLayerName(m,i),i.set(m.name,p),m&&Sp(m.layerID)}}return this.checkLayerPhys(),{layerIdReplacementTableByName:l,repeatedNameLayers:c}}resetLayerName(e,r){if(!e)return"";r||(r=this.getLayerNameMap());let{name:i,layerID:n}=e,s=r.get(i);if(!s||s==n)return i;let a=this.getDefaultLayerName(n),l=r.get(a);if(!l||l==n)return e.name=a,a;let c=QCe(r),h=UBe(i,c);return e.name=h,h}getDefaultLayerName(e){let r="";return Rc(Bg,i=>{if(i.layerId==e)return r=i.name,!0}),r||(e>=71?r=`Custom${e-71+1}`:r="UnknownLayerName"),r}};var Que=class{constructor(){this.GGEIDs=new Set;this.id=0}addId(t){this.GGEIDs.add(t)}has(t){return this.GGEIDs.has(t)}getID(t="e"){let e=x.getInstance().partitionId;for(;;){let r=e?`${this.id}_partition_${e}`:this.id;this.id++;let i=t+r;if(!this.GGEIDs.has(i))return r}}delete(t){this.GGEIDs.delete(t)}};var zh=class extends wi{getItem(t){var e;return(e=this.mgr.getItem(t))==null?void 0:e.stateWatcher}getAllItem(){let t=[],e=0;return this.mgr.iterator(r=>{r.stateWatcher&&(t[e]=r.stateWatcher,e++)}),t}iterator(t){this.mgr.iterator((e,r)=>{e.stateWatcher&&t(e.stateWatcher,r)})}iteratorBreakable(t){this.mgr.iteratorBreakable((e,r)=>{if(e.stateWatcher)return t(e.stateWatcher,r)})}get itemsCount(){return this.mgr.itemsCount}deleteById(t){return this.mgr.deleteById(t)}};var CN=class extends zh{constructor(){super(...arguments);this.mgr=An.getInstance();this.last=null;this.removeLoop=!0}addTrackByModel(e,r=!1){if(r){let i=e.globalIndex;An.getInstance().getItem(i)==e&&An.getInstance().delete(e,i),e.globalIndex=cr(),An.getInstance().addModel(e)}return e.modelType=="Track"?this.last=new Ar(e):e.modelType=="ArcTrack"&&(this.last=new Si(e)),this.addControllerCache(this.last),this.last}addControllerCache(e){ze.addItem(e),e.model.modelType=="Track"?Vt.insert(e):Vt.insert(e)}addTrack(e,r,i,n,s,a){let l=cr(),c=An.getInstance().addTrack(l,e,r,i,n,s,a),h=new Ar(c);return this.addControllerCache(h),h}addArcTrack(e,r,i,n,s,a,l,c,h,u=1){let d=cr(),p=An.getInstance().addArcTrack(d,e,r,i,n,s,a,l,c,h,u),m=new Si(p);return this.addControllerCache(m),m}rebuild(e,r,i,n,s,a,l){let c=An.getInstance().addTrack(e,r,i,n,s,a,l),h=new Ar(c);return this.addControllerCache(h),h}rebuildArcTrack(e,r,i,n,s,a,l,c,h,u,d=1){let p=An.getInstance().addArcTrack(e,r,i,n,s,a,l,c,h,u,d),m=new Si(p);return this.addControllerCache(m),m}copy(e){if(Object.values(e).length>9)return this.copyArc(e);let{globalIndex:i,layerId:n,start:s,end:a,width:l,locked:c,net:h}=e,u=new S(s.x,s.y),d=new S(a.x,a.y),p=i.slice(0,-16)+cr();return this.rebuild(p,n,u,d,l,c,h)}copyArc(e){let{globalIndex:r,layerId:i,center:n,radius:s,startAngle:a,endAngle:l,sweep:c,width:h,locked:u,net:d,arcType:p}=e;n=new S(n.x,n.y);let m=r.slice(0,-16)+cr();return this.rebuildArcTrack(m,i,n,s,a,l,c,h,u,d,p)}delete(e){(e.model.modelType==="ArcTrack"||e.model.modelType==="Track")&&An.getInstance().delete(e.model,e.model.globalIndex)}};var ede=class extends zh{constructor(){super(...arguments);this.mgr=$n.getInstance()}addControllerCache(e){ze.addItem(e),Vt.insert(e)}addPad(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v,D,w,F,H,z,G,W){let L=r0.getNumberManager();r0.isStart&&(i==""&&(i=x.getInstance().doctype===3?"":"1"),r0.isStart=!1),i=x.getInstance().doctype===3?L.getIncrementalNumber(i):L.getNum(i),L.add(i);let B=cr(),N=null,U=null,k=null,V=null;if(e===1)N=$o.getStyle(s,a,l,c,null);else if(e===2)U=$o.getStyle(h,u,d,p,null);else{N=$o.getStyle(s,a,l,c,null),U=$o.getStyle(h,u,d,p,null),k=$o.getStyle(m,g,y,b,null);let Z=Math.min(a,l)*.6;D=D||Z,w=w||Z/2,F=F||"ROUND",H=H||0,z=z||new S(0,0),V=vc.getHoleStyle(D,w,F,H,z)}let Y=$n.getInstance().addPad(B,e,r,i,n,P,T,I,C,E,O,_,R,v,N,U,k,V,G,W),X=new Ri(Y);return this.addControllerCache(X),X}addPadByModel(e,r=!1){let i=e.num;if(r0.getNumberManager().add(i),r){let a=e.globalIndex;$n.getInstance().getItem(a)==e&&$n.getInstance().delete(e,a),e.globalIndex=cr(),$n.getInstance().addModel(e)}let s=new Ri(e);return this.addControllerCache(s),s}rebuild(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v,D,w,F,H,z,G,W=!1,L,B,N){let U=null,k=null,V=null,Y=null;r===1?U=$o.getStyle(a,l,c,h,null):r===2?k=$o.getStyle(u,d,p,m,null):(U=$o.getStyle(a,l,c,h,null),k=$o.getStyle(u,d,p,m,null),V=$o.getStyle(g,y,b,P,null),Y=vc.getHoleStyle(w,F,H,z,G));let X=$n.getInstance().addPad(e,r,i,n,s,T,I,C,E,O,_,R,v,D,U,k,V,Y,L,void 0,B,N),Z=new Ri(X);return r0.getNumberManager().add(Z.num),Z.isTestPad=W,Z.smartPad||(Z.smartPad=we.smartMode?new qA(Z.buildBBox(),e):null),this.addControllerCache(Z),Z}copy(e){if(e.shapes!=null)return this.copyPolygon(e);let{globalIndex:r,layerId:i,type:n,num:s,center:a,topType:l,topWidth:c,topHeight:h,topRatio:u,bottomType:d,bottomWidth:p,bottomHeight:m,bottomRatio:g,innerType:y,innerWidth:b,innerHeight:P,innerRatio:T,rotation:I,locked:C,net:E,expansionType:O,pasteExpansion:_,topSolderExpansion:R,bottomSolderExpansion:v,unusedInnerLayers:D,plated:w,holeLength:F,holeRadius:H,holeShape:z,holeRotation:G,holeOffset:W,isTestPad:L,padRule:B,padLen:N,attrsMap:U}=e;a=new S(a.x,a.y);let k=new S(W.x,W.y),V=r.slice(0,-16)+cr();return this.rebuild(V,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v,D,w,F,H,z,G,k,L,_f.buildByJson(B),N,U)}delete(e){e instanceof Le&&(r0.getNumberManager().deleteNum(e.num),$n.getInstance().delete(e.model,e.model.globalIndex))}updateExpansion(){this.iterator(e=>{if(e.expansionType===1){let r=e.net,i=te.getInstance().getSolderExpansionByNet(r),n=te.getInstance().getPasteExpansionByNet(r),s=e.isTestPad?i.testPointTopExpansion:i.padTopExpansion,a=e.isTestPad?i.testPointBottomExpansion:i.padBottomExpansion;e.padExpansion=ju.getPadExpansion(e.model.expansionType,e.queryPasteExpansion(n),s,a)}})}getAllTestPad(){let e=super.getAllItem();return e=e.filter(r=>r.isTestPad),e}allAddSmartPad(){this.iterator(e=>{e.smartPad||(e.smartPad=new qA(e.buildBBox(),e.globalIndex))})}removeAllSmartPad(){this.iterator(e=>{e.smartPad&&(e.smartPad.remove(),e.smartPad=null)})}allSmartPadVisible(e){let r=!1;return this.iterator(i=>{i.smartPad&&(!r&&i.smartPad.isVisible!=e&&(r=!0),e?i.smartPad.visible():i.smartPad.hidden())}),r}addPolygonPad(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I){let C=r0.getNumberManager();r0.isStart&&(r==""&&(r="1"),r0.isStart=!1),r=C.getNum(r),C.add(r);let E=cr();e=this.getLayerId(e);let O=this.createModel(E,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I),_=new fn(O);return this.addControllerCache(_),_}addPolygonPadByModel(e,r=!1){let i=e.num;if(r0.getNumberManager().add(i),r){let l=e.globalIndex;$n.getInstance().getItem(l)==e&&$n.getInstance().delete(e,l),e.globalIndex=cr(),$n.getInstance().addModel(e)}let s=this.getLayerId(e.layerId);e.layerId!=s&&(e.layerId=s);let a=new fn(e);return this.addControllerCache(a),a}createModel(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E){let O=null,_=null,R=null,v=null,D=a;D.area()>0&&(D=D.reverse());let w=$o.getStyle("POLYGON",-1,-1,-1,D);return r===1?O=w:r===2?_=w:(O=w,_=w.clone(),R=w.clone(),v=vc.getHoleStyle(y,b,P,T,I)),$n.getInstance().addPad(e,r,1,i,n,s,c,l,h,u,d,p,m,g,O,_,R,v,C,void 0,void 0,E)}rebuildPolygonPad(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E){let O=this.createModel(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E),_=new fn(O);return this.addControllerCache(_),_}copyPolygon(e){let{globalIndex:r,layerId:i,num:n,center:s,rotation:a,shapes:l,net:c,locked:h,expansionType:u,pasteExpansion:d,topSolderExpansion:p,bottomSolderExpansion:m,unusedInnerLayers:g,plated:y,holeLength:b,holeRadius:P,holeShape:T,holeRotation:I,holeOffset:C,padRule:E,attrsMap:O}=e,_=fe.build2(this.parseShape(l));s=new S(s.x,s.y),C=new S(C.x,C.y);let R=r.slice(0,-16)+cr();return this.rebuildPolygonPad(R,i,n,s,a,_,c,h,u,d,p,m,g,y,b,P,T,I,C,_f.buildByJson(E),O)}parseShape(e){let r=new Array;for(let i of e)for(let n in i){let s=i[n];if(n=="LINE"){let a=new S(s.start.x,s.start.y),l=new S(s.end.x,s.end.y),c=new M(a,l);r.push(c)}if(n=="ARC"){let a=new S(s.center.x,s.center.y),l=q.build2(a,s.startAngle,s.endAngle,s.rx,s.rx,s.sweep);r.push(l)}}return r}getLayerId(e){return e==1||e==2||e==12?e:1}};var tde=class extends zh{constructor(){super(...arguments);this.mgr=Tn.getInstance()}addControllerCache(e){if(e.type==1){let i=te.getInstance().getDefaultBlindPhysics().getBlindVia(e.name);i==null||i.status.used.add(e.globalIndex)}ze.addItem(e),Vt.insert(e)}addViaByModel(e,r=!1){if(r){let n=e.globalIndex;Tn.getInstance().getItem(n)==e&&Tn.getInstance().delete(e,n),e.globalIndex=cr(),Tn.getInstance().addModel(e)}let i=new Ge(e);return this.addControllerCache(i),i}initAddViaByModel(e){let r=new Ge(e);if(e.type==1){let n=te.getInstance().getDefaultBlindPhysics().getBlindVia(r.name);n==null||n.status.used.add(e.globalIndex)}return ze.addInitItem(r),Vt.insert(r),r}addVia(e,r,i,n,s,a,l,c,h,u,d,p,m=new Array,g=!1){let y=cr();a=bo(a),c=bo(c),e==0&&g&&(e=2);let b=Tn.getInstance().addVia(y,e,r,i,n,s,a,l,c,h,u,d,p,m,g),P=new Ge(b);return this.addControllerCache(P),P}rebuild(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y=!1){l=bo(l),h=bo(h),r==0&&y&&(r=2);let b=Tn.getInstance().addVia(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y),P=new Ge(b);return this.addControllerCache(P),P}copy(e){let{globalIndex:r,type:i,name:n,startLayer:s,endLayer:a,net:l,radius:c,center:h,holeRadius:u,locked:d,expansion:p,topExpansion:m,bottomExpansion:g,unusedInnerLayers:y,isSuture:b}=e,P=new S(h.x,h.y),T=r.slice(0,-16)+cr();return this.rebuild(T,i,n,s,a,l,c,P,u,d,p,m,g,y,b)}delete(e){e instanceof Ge&&Tn.getInstance().delete(e.model,e.model.globalIndex)}getSameSizeVias(e){let r=new Array;r.push(e);let i=this.getAllItem();for(let n of i)n!=e&&n.radius==e.radius&&n.holeRadius==e.holeRadius&&r.push(n);return r}updateExpansion(){this.iterator(e=>{if(e.expansionType===1){let r=e.net,i=te.getInstance().getSolderExpansionByNet(r);e.viaExpansion=I0.getViaExpansion(e.expansionType,i.viaTopExpansion,i.viaBottomExpansion)}})}};function g2(o,t){let e=o.component;if(e&&(e instanceof ln||e instanceof ou||e instanceof wl)){let r=e instanceof ln?e.padId:e.lineId;switch(t){case"add":$a.getInstance().addConnectRelatedId(r,o.globalIndex);break;case"delete":$a.getInstance().delConnectRelatedId(r,o.globalIndex);break}}}var rde=class extends zh{constructor(){super(...arguments);this.mgr=zi.getInstance()}addCircle(e,r,i,n,s,a,l,c){l=wu(l,r,e);let h=cr();(c==null||!Lf(e,c,r))&&(c=V1(1,{type:e,layerId:r,strokeWidth:s}));let u=zi.getInstance().addCircle(h,e,r,i,n,s,a,l,null,c),d=new Sr(u);return this.addControllerCache(d),g2(d.model,"add"),d}addControllerCache(e){ze.addItem(e),Vt.insert(e)}addCircleByModel(e,r=!1){if(r){let n=e.globalIndex;zi.getInstance().getItem(n)==e&&zi.getInstance().delete(e),e.globalIndex=cr(),zi.getInstance().addModel(e)}let i=new Sr(e);return this.addControllerCache(i),g2(i.model,"add"),i}rebuild(e,r,i,n,s,a,l,c,h,u){c=wu(c,i,r),(u==null||!Lf(r,u,i))&&(u=V1(1,{type:r,layerId:i,strokeWidth:a}));let d=zi.getInstance().addCircle(e,r,i,n,s,a,l,c,h,u),p=new Sr(d);return this.addControllerCache(p),p}copy(e){let{globalIndex:r,type:i,layerId:n,center:s,radius:a,strokeWidth:l,locked:c,net:h,silkColor:u}=e,d=e.componentData,p=new Nl(d,i),m=new S(s.x,s.y),g=r.slice(0,-16)+cr(),y=this.rebuild(g,i,n,m,a,l,c,h,ee.of7(u));return p!=null&&p.rebuildComponent(y),this.modifyRegionSelector(y,e.regionRuleSelector),y}delete(e){e instanceof Sr&&(g2(e.model,"delete"),e.type=="Partition"&&Dn.getInstance().deleteItemById(e.globalIndex),zi.getInstance().delete(e.model))}autoFill(){let e=this.getAllItem();for(let r of e)r.isVisible&&r.fill()}autoRefreshAll(){let e=this.getAllItem();for(let r of e)r.isVisible&&r.refreshRender()}modifyRegionSelector(e,r){if(e.type==="Constraint Region"){let i=e.globalIndex,n=te.getInstance().addRegionSelector(i);te.getInstance().updateRegionSelector(i,r,!0)}}};var ide=class extends zh{constructor(){super(...arguments);this.mgr=rn.getInstance()}addControllerCache(e){ze.addItem(e),Vt.insert(e)}addRect(e,r,i,n,s,a,l,c=1,h=0,u=0,d,p){let m=p||cr(),g=this.buildModel(m,e,r,i,n,s,a,l,c,h,u,void 0,d),y=new nr(g);return this.addControllerCache(y),g2(y.model,"add"),y}addRectByModel(e,r=!1){if(r){let n=e.globalIndex;rn.getInstance().getItem(n)==e&&rn.getInstance().delete(e,n),e.globalIndex=cr(),rn.getInstance().addModel(e)}let i=new nr(e);return this.addControllerCache(i),g2(i.model,"add"),i}rebuild(e,r,i,n,s,a,l,c,h=1,u=0,d=0,p=null,m){let g=this.buildModel(e,r,i,n,s,a,l,c,h,u,d,p,m),y=new nr(g);return this.addControllerCache(y),y}copy(e){let{globalIndex:r,type:i,layerId:n,start:s,width:a,height:l,net:c,locked:h,strokeWidth:u,rotation:d,cornerRadius:p,silkColor:m}=e,g=e.componentData,y=new Nl(g,i),b=new S(s.x,s.y),P=r.slice(0,-16)+cr(),T=this.rebuild(P,i,n,b,a,l,c,h,u,d,p,ee.of7(m));return y!=null&&y.rebuildComponent(T),this.modifyRegionSelector(T,e.regionRuleSelector),T}delete(e){if(e instanceof nr){g2(e.model,"delete");let r=e.globalIndex;e.type=="Partition"&&Dn.getInstance().deleteItemById(r),rn.getInstance().delete(e.model,r)}}autoFill(){let e=this.getAllItem();for(let r of e)r.isVisible&&r.fill()}autoRefreshAll(){let e=this.getAllItem();for(let r of e)r.isVisible&&r.refreshRender()}modifyRegionSelector(e,r){if(e.type==="Constraint Region"){let i=e.globalIndex,n=te.getInstance().addRegionSelector(i);te.getInstance().updateRegionSelector(i,r,!0)}}buildModel(e,r,i,n,s,a,l,c,h=1,u=0,d=0,p=null,m){return i=sg(r,i,1),l=wu(l,i,r),(m==null||!Lf(r,m,i))&&(m=V1(1,{type:r,layerId:i,strokeWidth:h})),rn.getInstance().addRect(e,r,i,n,s,a,l,c,h,u,d,p,m)}};var SN=class extends zh{constructor(){super();this.mgr=mo.getInstance();this.textAttr={"attr-layerid":be.getActiveLayerID(),"attr-text-typeface":"default","attr-text-size":12,"attr-rotation":0,"attr-locked":!1,"attr-origin":3,"attr-text-stroke-width":.8,"attr-reversed-phase":!1,"attr-reversed-phase-extend":0,"attr-mirror":!1}}addControllerCache(e){Vt.insert(e)}addtextByModel(e,r=!1){if(r){let n=e.globalIndex;mo.getInstance().getItem(n)==e&&mo.getInstance().delete(e),e.globalIndex=cr(),mo.getInstance().addModel(e)}let i=e.getParent()!==void 0?new iue(e):new fr(e);return this.addControllerCache(i),i}addText(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y=!1,b=!1,P=KH){let T=cr();l=bo(l),p=bo(p);let I=mo.getInstance().addText(T,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,null,ee.of7(P)),C=new fr(I);return this.addControllerCache(C),C}rebuild(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b=!1,P=!1,T=KH){let I=mo.getInstance().addText(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,null,ee.of7(T)),C=new fr(I);return this.addControllerCache(C),C}copy(e,r){let{globalIndex:i,layerId:n,key:s,showKey:a,value:l,showValue:c,fontFamily:h,fontSize:u,rotation:d,locked:p,position:m,origin:g,strokeWidth:y,reverse:b,reverseExpansion:P,mirror:T,font:I,silkColor:C,positionIsNull:E}=e;return r==null&&(r=i.slice(0,-16)+cr()),I!=null&&Eb.copy(I,r),m=new S(m.x,m.y),this.rebuild(r,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,E,C)}delete(e){if(e instanceof fr){let r=this.getItem(e.globalIndex);(r==null&&e.isEmpty||r===e)&&mo.getInstance().delete(e.model)}}changeTextAttribute(e){let r=new ft;for(let i of e)for(let n in i)if(Object.prototype.hasOwnProperty.call(i,n)){let s=i[n],a;if(n in this.textAttr){switch(n){case"attr-layerid":let l=parseInt(i["attr-layerid"]);isNaN(l)||(a=l);break;case"attr-text-typeface":a=i["attr-text-typeface"];break;case"attr-text-size":let c=parseFloat(i["attr-text-size"])/10;x.getInstance().unit!="mil"&&(c=r.conversion(x.getInstance().unit,"mil",c)),a=c;break;case"attr-rotation":let h=parseFloat(i["attr-rotation"])/180*Math.PI;isNaN(h)||(a=h);break;case"attr-locked":case"attr-mirror":case"attr-reversed-phase":a=s=="yes";break;case"attr-origin":let u=parseInt(i["attr-origin"]);isNaN(u)||(a=u);break;case"attr-text-stroke-width":let d=parseFloat(i["attr-text-stroke-width"])/10;x.getInstance().unit!="mil"&&(d=r.conversion(x.getInstance().unit,"mil",d)),a=d;break;case"attr-reversed-phase-extend":let p=parseFloat(i["attr-reversed-phase-extend"])/10;x.getInstance().unit!="mil"&&(p=r.conversion(x.getInstance().unit,"mil",p)),a=p;break}this.textAttr[n]=a}}}};var nde=class extends zh{constructor(){super(...arguments);this.mgr=Za.getInstance()}addProtractorByModel(e,r=!1){if(r){let s=e.globalIndex;Za.getInstance().getItem(s)==e&&Za.getInstance().delete(e),e.globalIndex=cr(),Za.getInstance().addModel(e)}let i=e.globalIndex,n=new ol(e);return this.addControllerCache(n),n}addControllerCache(e){Vt.insert(e)}addProtractor(e,r,i,n,s,a,l,c){let h=cr(),u=Za.getInstance().addProtractor(h,e,r,i,n,s,a,l,c),d=new ol(u);return this.lastPrecision=d.precision,this.addControllerCache(d),d}rebuild(e,r,i,n,s,a,l,c,h){let u=Za.getInstance().addProtractor(e,r,i,n,s,a,l,c,h),d=new ol(u);return this.addControllerCache(d),d}copy(e){let{globalIndex:r,layerId:i,width:n,fontsize:s,precision:a,center:l,end1:c,end2:h,locked:u,textPosition:d,silkColor:p}=e,m=new S(l.x,l.y),g=new S(c.x,c.y),y=new S(h.x,h.y),b=new S(d.x,d.y),P=r.slice(0,-16)+cr(),T=this.rebuild(P,i,n,s,a,m,g,y,u);return T.textPosition=b,T.silkColor=ee.of7(p),T}delete(e){e instanceof ol&&Za.getInstance().delete(e.model)}};var ode=class extends zh{constructor(){super(...arguments);this.mgr=Ka.getInstance()}addControllerCache(e){Vt.insert(e)}addDimensionByModel(e,r=!1){if(r){let n=e.globalIndex;Ka.getInstance().getItem(n)==e&&Ka.getInstance().delete(e,n),e.globalIndex=cr(),Ka.getInstance().addModel(e)}let i=new ca(e);return this.addControllerCache(i),i}addDimension(e,r,i,n,s,a,l,c,h,u){let d=cr(),p=Ka.getInstance().addDimension(d,e,r,i,n,s,a,l,c,h,u),m=new ca(p);return this.lastPrecision=m.precision,this.addControllerCache(m),m}rebuild(e,r,i,n,s,a,l,c,h,u,d){let p=Ka.getInstance().addDimension(e,r,i,n,s,a,l,c,h,u,d),m=new ca(p);return this.addControllerCache(m),m}copy(e){let{globalIndex:r,layerId:i,start:n,end:s,precision:a,height:l,width:c,unit:h,locked:u,leftPoint:d,rightPoint:p,silkColor:m}=e,g=new S(n.x,n.y),y=new S(s.x,s.y),b=new S(d.x,d.y),P=new S(p.x,p.y),T=r.slice(0,-16)+cr(),I=this.rebuild(T,i,g,y,b,P,a,l,c,h,u);return I.silkColor=ee.of7(m),I}delete(e){if(e instanceof ca){let r=e.globalIndex;Ka.getInstance().delete(e.model,r)}}};var sde=class extends wi{constructor(){super();this.rubbish=new Set;this.netLength=new Map;this.netModify=new Map;this.netOptions=new Array;this.noneNetMap=new Map;this.updateNets={addNet:[],deleteNet:[],updateNetLength:{}};this.ratlineVisibleBeforeGray={};this.debounce=new h5;A.subscribe("cycleNetwork",this.clear.bind(this))}isBridgingCopper(e){return(e.getComponent()instanceof ln&&e.getComponent()).isBridgingCopper}updateLeftTreeNets(){let e=x.getInstance().unit,r=this.updateNets.addNet.map(s=>({name:s,color:ze.getSpecialColor(s).toString(),netLength:this.getNetLength(s,!0)}));this.updateNets.addNet=[];let i=[...this.updateNets.deleteNet];this.updateNets.deleteNet=[];let n={...this.updateNets.updateNetLength};this.updateNets.updateNetLength={},A.publish("updateNets",{addNet:r,deleteNet:i,updateNetLength:n,unit:e},$()),this.updateLeftTree=null}notifyUpdateNets(){this.updateLeftTree==null&&(this.updateLeftTree=()=>{this.updateLeftTreeNets()});let e=this.updateLeftTree;this.debounce.debounce(e,200)}addItem(e){let r=e.net?e.net.toUpperCase():"";if(!(e instanceof Ye&&(["Constraint Region","Prohibited Region"].includes(e.type)||this.isBridgingCopper(e))))if(r!=""&&r!=null){let i=this.map.get(r);i==null&&(i=new Set,this.map.set(r,i),this.updateNets.addNet.push(r),this.notifyUpdateNets()),i.add(e),Vh.getNet(r)==null&&(Vh.addNet(r),Ql(r)),this.netModify.set(r,!0)}else{let i=e.model;if(r==""&&i instanceof ki&&mp(i.layerId)&&this.isCopperModel(e)){let n=this.noneNetMap.get(r);n==null&&n==null&&(n=new Set,this.noneNetMap.set(r,n)),n.add(e),Vh.getNet(r)==null&&(Vh.addNet(r),Ql(r))}}}addInitItem(e){let r=e.net?e.net.toUpperCase():"";if(r!=""&&r!=null){let i=this.map.get(r);i==null&&(i=new Set,this.map.set(r,i)),i.add(e)}else{let i=e.model;if(r==""&&mp(i.layerId)&&this.isCopperModel(e)){let n=this.noneNetMap.get(r);n==null&&n==null&&(n=new Set,this.noneNetMap.set(r,n)),n.add(e)}}}finishInit(){for(let[e]of this.map)Vh.getNet(e)==null&&(Vh.addNet(e),Ql(e)),this.netModify.set(e,!0)}isCopperModel(e){return e instanceof ds?e instanceof Ye?e.type=="Fill Region"||e.type=="Line"||e.type=="TearDrop":!0:!1}updateNetLength(e,r=!1){let i=this.getNetLen(e);this.netLength.get(e)!=i&&(this.netLength.set(e,i),this.updateNets.updateNetLength[e]=i,!r&&this.notifyUpdateNets())}getNetLen(e){let r=0,i=this.getSameNetItems(e);for(let n=0;n<i.length;n++){let s=i[n];if(s instanceof Ue)r+=s.length;else if(s instanceof Le){let a=as.getInstance().getPadLenByModel(s.model);a!=null&&(r+=a)}}return r}getSpecialColor(e,r=ee.BLACK){if(e!=null){let i=e.toUpperCase(),n=te.getInstance().getNet(i);return(n==null?void 0:n.color)||r}return r}getAllNets(){let e=new Array(this.map.size),r=0;for(let[i]of this.map)e[r]=i.toString(),r++;return e}getNetCount(){let e=new Map;for(let[r,i]of this.map)e.set(r.toString(),i.size);return e}getAllNoneNets(){let e=new Array,r=this.noneNetMap.keys();for(let i of r)e.push(i);return e}getNoneNetsItem(e){return this.noneNetMap.get(e)}getAllNoneNetsItems(){let e=[],r=this.noneNetMap.keys();for(let i of r)this.noneNetMap.get(i).forEach(s=>e.push(s));return e}getNetLength(e,r=!1){let i=e.toUpperCase();this.netModify.get(i)&&(this.updateNetLength(i,r),this.netModify.set(i,!1));let s=this.netLength.get(i);return s==null&&(s=0),s}modifyNet(e){let r=e.toUpperCase();this.netModify.set(r,!0)}isNetSelectFilterObj(e){return e instanceof Ye&&e.type=="Copper Region"||e instanceof Ki||e instanceof ii}getSameNetItemsWithoutPourAndPlaneZoneByItem(e){return this.isNetSelectFilterObj(e)?[]:this.getSameNetItemsWithoutPourAndPlaneZone(Bo(e))}getSameNetItemsWithoutPourAndPlaneZone(e){let r=e?e.toUpperCase():null,i=r==null?null:this.map.get(r)||this.noneNetMap.get(r),n=new Array;if(i!=null)for(let s of i)this.isNetSelectFilterObj(s)||n.push(s);return n}getSameNetItems(e,r){let i=e.toUpperCase(),n=this.map.get(i),s=new Array,a=!!r;if(n!=null&&n!=null)for(let l of n)a?r(l)&&s.push(l):s.push(l);return s}dragHighlightNets(e){ce.hightShowConfig.dragDarked&&this.highlightNets(e)}dragUnhighlightNet(){ce.hightShowConfig.dragDarked&&this.unhighlightNet("")}getHighlightIds(e,r=!1,i=!1){e=e.toUpperCase();let n=Array.from(this.map.get(e)||[]);i&&(n=n.concat(Array.from(this.noneNetMap.get(e)||[])));let s,a=new HG,l=new Set;return l.add("Copper"),r&&(l.add("ArcTrack"),l.add("Track")),s=a.getGroupIds(n,c=>{let h=c.model.modelType;return!!l.has(h)}),s.push("Ratline"+e),r&&["ArcTrack","Track"].forEach(h=>{let u=h+e;s.includes(u)||(bn.getInstance().getEngineGroupId(u),s.push(u))}),s}highlightById(e){e.forEach(r=>{Do.attachViewGroup(r,{visible:!0,doubleRgb:!0})}),this._viewGroupIds?this._viewGroupIds=this._viewGroupIds.concat(e):this._viewGroupIds=e}highlightNets(e,r=!1,i=!1){A.publish("stashHight",""),be.forceDeactive(!0);let n=[];for(let s of e)s&&Re.addAll(n,this.getHighlightIds(s,r,i));this.highlightById(n)}highlightNet(e,r=!1,i=!1){if(A.publish("stashHight",""),be.forceDeactive(!0),!e)return;let n=this.getHighlightIds(e,r,i);this.highlightById(n)}unhighlightNet(e,r=!1){var i;be.forceDeactive(!1),(i=this._viewGroupIds)==null||i.forEach(n=>{Do.attachViewGroup(n,{visible:!0,doubleRgb:!1})}),delete this._viewGroupIds,A.publish("restoreHight","")}getNet(){return this.updateNetOptions(),this.netOptions}updateNetOptions(){let e=new Array,r=new Set;for(let i of this.getAllNets()){let n=e5(i);n&&r.add(n)}for(let i of r){let n={};n.value=i,n.text=i,e.push(n)}this.netOptions=e}delete(e,r=e.net?e.net.toUpperCase():""){A.publish("hasModifyPcbItem",e);let i=this.map.get(r)||this.noneNetMap.get(r);i!=null&&(i.delete(e),i.size==0&&this.rubbish.add(r),this.netModify.set(r,!0))}clear(){for(let e of this.rubbish){let r=this.map.get(e)||this.noneNetMap.get(e);r!=null&&r.size==0&&(Vh.deleteNet(e),Ql(e,!0),this.map.delete(e),this.updateNets.deleteNet.push(e),this.notifyUpdateNets())}this.rubbish.clear()}};var ODt=Ip.getInstance(),ade=class extends wi{addControllerCache(t){this.map.set(t.globalIndex,t)}combination(t,e){let r=Ip.getInstance().combination(t.map(n=>n.model),e),i=new Ph(r);return this.addControllerCache(i),i}getGroupByName(t){for(let e of this.map.values())if(e.name==t)return e;return null}getGroupNameByGroupId(t){return Ip.getInstance().getGroupNameByGroupId(t)}getDefaultName(){let t=x.getInstance().partitionId,e="";return t&&(e=`partition_${t}_`),e+Ip.getInstance().getDefaultName()}joinCombination(t,e){let r=this.map.get(e);return Ip.getInstance().joinCombination(t.map(i=>i.model),e),r}removeFromCombination(t,e){let r=this.map.get(e);return Ip.getInstance().removeFromCombination(t.map(i=>i.model),e),r}getAllGroupId(){return Ip.getInstance().getAllGroupId()}getCombin(){return Ip.getInstance().getCombin()}copy(t){}rebuild(t,e,r){let i=Ip.getInstance().rebuild(t,e.map(s=>s.model),r),n=new Ph(i);return this.map.set(t,n),n}rebuildByModel(t){let e=t.globalIndex,r=new Ph(t);return this.addControllerCache(r),r}delete(t){let e=t.globalIndex;ODt.delete(t.model,e),t instanceof Ph&&this.map.delete(e)}};var vw=class extends va{constructor(e,r,i,n,s,a,l,c,h,u,d,p){super();this.type="Check Dimension";this._globalIndex=e,this.model=new HA(e,"Help Dimension",r,n,s,a,l,c,h,u,d,!0,.2,1.3,.1,i),Vt.insert(this),this.initRefreshRender()}get globalIndex(){return this._globalIndex}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=e,this.refreshRender()}getLength(){return this.model.length*10}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get textPosition(){return this.model.textPosition}get width(){return this.model.strokeWidth}set width(e){this.model.strokeWidth=e,this.refreshRender()}get unit(){return this.model.unit}set unit(e){this.model.unit=e,this.refreshRender()}get precision(){return this.model.precision}set precision(e){this.model.precision=e,this.refreshRender()}get start(){return this.model.start}set start(e){this.model.calibrateLine([this.start,this.left,this.start,e],!0,!1,0),this.model.start=e,this.refreshRender()}get end(){return this.model.end}set end(e){this.model.calibrateLine([this.end,this.right,this.end,e],!0,!0,1),this.model.end=e,this.refreshRender()}get strokeWidth(){return this.model.strokeWidth}modifyEnd(e){this.model.end=e,this.model.right=e,this.refreshRender()}modifyDimension(e,r){this.model.start=e,this.model.end=r,this.refreshRender()}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get length(){let e=this.model.length*10;this.unit!="mil"&&(e=new ft().conversion1("mil",this.unit,e));let r=Math.pow(10,this.precision);return e=Math.round(e*r)/r,e}set length(e){this.model.length=e,this.refreshRender()}set height(e){this.model.fontSize=e,this.refreshRender()}get height(){return this.model.fontSize}set left(e){this.model.calibrateLine([this.right,this.end,this.left,e],!1,!1,2),this.model.left=e,this.refreshRender()}get left(){return this.model.left}set right(e){this.model.calibrateLine([this.left,this.start,this.right,e],!1,!0,3),this.model.right=e,this.refreshRender()}get right(){return this.model.right}click(){}get highlightColor(){return ee.RED}hightlight(e=!1){this.dimensionIsSelect=e,super.visible()}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}transform(e){this.model.transform(e),this.refreshRender()}buildBBox(){return this.model.buildBBox()}getLineBBox(){return wB(this.start,this.end,this.left,this.right,this.strokeWidth,this.lineLen,this.arrLineLen)}isSelect(e,r){return!this.isVisible||this.getParent()!=null?!1:this.model.inShape(e,r)}toJSON(){return{globalIndex:this.globalIndex,layerId:this.layerId,start:this.start,end:this.end,precision:this.precision,height:this.height,width:this.width,unit:this.unit,locked:this.locked,leftPoint:this.left,rightPoint:this.right}}getType(){return 5}get textPath(){return this.model.text.outline}get textMatrix(){return this.model.text.matrix}get viewWidth(){return this.model.text.width}get viewHeight(){return this.model.text.height}get lineLen(){return .2}get arrLineLen(){return 1.3}get outlineModified(){return this.model.text.outlineModified}flip(e){}};var lde=class extends L0{async buildDevice(t){let{uuid:e,ticket:r}=t,i=new oR(e,x.getInstance().compilerChannel);await i.parse(!1,async n=>{try{return await n.onDocDetail("",r,t),{success:!0}}catch{return{success:!1}}}),ps.addDevice(e,i)}async buildFootPrint(t){if(!t)return!1;let{uuid:e,canvas:r,project_uuid:i,ticket:n}=t,s=x.getInstance().compilerChannel,a,l=!1;e.indexOf("_")>-1?(l=!0,a=new Xc(e,s,i)):a=new XI(e,s,i),await a.parse(!1,c=>{new IC(c).parseFull(r),c.onDocDetail("",n,t,!1)}),l&&(await Ji.add(a.source,s)).addChild(a),Ji.addFootPrint(e,a)}};function _Dt(o){let t=new Array(o.childrens.length);if(!o.isSimplify){let e=0;for(let r of o.childrens){let i=new Array(r.length),n=0;for(let s of r)s instanceof ys?i[n++]=new mt(s):i[n++]=new vt(s);t[e++]=i}}return new ct(o,t)}var cde=class{constructor(){this.position=null;this.data=null;A.subscribe("referPosition",this.setPosition.bind(this)),A.messageBus.rpcService("copy",this.copy.bind(this)),A.subscribe("pcb/paste",this.paste.bind(this),$()),A.messageBus.rpcService("pcb/editor/pasteTemplates",this.pasteTemplate.bind(this))}setPosition(t){this.position=t}extractCopyInfo(t,e){let r={position:e,copyTime:new Date().getTime(),layerInfos:{}},i=[],n=[],s=[],a=new Set;for(let E of t)E instanceof Nh||E instanceof vw||(E instanceof ct&&E.type==="TearDrop"&&!E.getChildrens().length&&E.refreshChildrenByOutline(),E.type==="Copper Region"?n.push(E):E instanceof fr?E.getParent()?s.push(E):(E.showKey||E.showValue)&&i.push(E):Bt.isChildPcb()?E instanceof Me||i.push(E):(i.push(E),E instanceof Me&&a.add(E)));let l;for(let E of s)l=E.getParent(),l!=null&&l instanceof Me&&!a.has(l)&&i.push(E);C(n),i.push(...n);let c={},h=new Set,u=[],d=new Map,p,m,g,y=[];for(let E of i)E instanceof Me&&(p=Ji.getItem(E.footprintUUID),p instanceof Xc&&y.push({customFootprintUuid:E.footprintUUID,componentGlobalIndex:E.globalIndex}));let b=new Map;for(let{customFootprintUuid:E}of y)b.set(E,(b.get(E)||0)+1);let P=new Set;for(let[E,O]of b)O>1&&P.add(E);let T=new Set;for(let E of i){let O=E.layerId||(E==null?void 0:E.startLayer);if(O&&(E instanceof Me||!T.has(O))){let{name:R,type:v}=be.getLayer(O);if(r.layerInfos[O]={name:R,type:v},T.add(O),E instanceof Me)for(let D of E.getItems()){let w=D.layerId||(D==null?void 0:D.startLayer);if(w&&!T.has(w)){let{name:F,type:H}=be.getLayer(w);r.layerInfos[w]={name:F,type:H},T.add(w)}}}let _=this.getFlag(E);if(c[_]||(c[_]=[]),E instanceof Me){p=Ji.getItem(E.footprintUUID);let R=null;p instanceof Xc&&(R=E.footprintUUID,p=Ji.getItem(p.source)),p||(p=Wi.getInstance().getItem(m.footprintUUID)),m=ps.getItem(E.deviceUUID);let v=R&&P.has(R);u.push({deviceUuid:(m==null?void 0:m.uuid)||"",footprintUuid:p.uuid,customFootprintUuid:R,componentGlobalIndex:v?E.globalIndex:void 0})}if(E instanceof Rs){let R=Yd.getItem(E.hashId);d.set(E.hashId,{hashId:E.hashId,fileName:R.fileName})}if(l=E.getParent(),E instanceof fr&&E.key!=="")g=JSON.stringify(E.toJSON1()),c[_].push(g);else if(l!=null&&l instanceof ct&&l.type!="TearDrop"&&l.type!="Board Outline")h.has(l)||(h.add(l),g=JSON.stringify(l.toJSON()),c[_].push(g));else{let R=E.toJSON();E instanceof Me&&p&&(R.projectId=p.projectId),g=JSON.stringify(R),c[_].push(g)}}let I=Array.from(d.values());return{head:r,data:c,template:u,blobTemplete:I,doctype:x.getInstance().doctype};function C(E){let O=E.map(_=>({item:_,order:gn.getOrder(_.globalIndex)}));O.sort((_,R)=>_.order-R.order);for(let _=0;_<E.length;_++)E[_]=O[_].item}}async copy(t){return this.data=this.extractCopyInfo(t,this.position),this.data.head.type="copy",this.data.head.uuid=x.getInstance().compiler.uuid,(await A.windowBridge.rpcCall("copyData",this.data,$())).message}getData(){return this.data}async paste(t){var s;let e=x.getInstance().doctype;if(!x.getInstance().isactive||23==e)return;if(t==null){A.publish("getPasteData",t);return}let r=t.copyData,i=(s=t.copyData)==null?void 0:s.componentParts,n=t.copyData.doctype==3&&e==4;try{i&&await this.createTempComponentParts(i),(i||n)&&this.handleAcrossDocType(r)}finally{i&&this.recycleTempComponentParts(t.copyData)}if(e==3&&await this.pasteTemplate(t,n),r.head!=null&&this.data!=null&&r.head.copyTime<this.data.head.copyTime){r=this.data;for(let a of Object.keys(r.data)){let l=r.data[a];for(let c=0;c<l.length;c++){let h=JSON.parse(l[c]);if(h.custom){let u=Wi.getInstance().getItem(h.custom),d=await Wi.getInstance().cloneFootprint(u),p=d==null?void 0:d.uuid;p||console.error(`add footprint error footprintUuid: ${h.custom.uuid}`),h.custom.uuid=p}r.data[a][c]=JSON.stringify(h)}}}else if(t.map.blobMap&&Object.keys(t.map.blobMap).length>0){let a=[];for(let l in t.map.blobMap){let c=t.map.blobMap[l];if(!Yd.getItem(c))try{let u=(await A.windowBridge.rpcCall(us.BLOB.GET,[c,x.getInstance().projectId],$())).message;a.push({hashId:c,dataUrl:u.content,fileName:u.fileName})}catch(u){console.error(`Failed to load blob image with hashId: ${c}`,u)}}V8(a).then(()=>{A.publish("getPasteData",t)}).catch(l=>{console.error("Failed to add picture template from blobMap:",l),A.publish("getPasteData",t)});return}A.publish("getPasteData",t)}async createTempComponentParts(t){let{footprints:e,devices:r}=t,i=new lde(x.getInstance().compiler);for(let n of r)await i.buildDevice(n);for(let n of e)await i.buildFootPrint(n)}recycleTempComponentParts(t){let{footprints:e,devices:r}=t.componentParts||{footprints:[],devices:[]};for(let i of e)Ji.deleteById(i.uuid);for(let i of r)ps.deleteById(i.uuid);t.componentParts=null}async pasteTemplate(t,e=!1){var l,c;let r=t.map||{},i=r.customMap||{},n=i.componentGids||{},s=i.gidMap||{},a=(l=t.copyData)==null?void 0:l.data[15];try{if(r.deviceMap){let h=x.getInstance().compilerChannel;for(let u in r.deviceMap){let d=r.deviceMap[u];await ps.add(d,h)}}if(r.footprintMap||Object.keys(s).length){let h=x.getInstance().compilerChannel;if(e&&!a)throw new Error("Missing components data for PCB2 footprint paste.");let u=new Set,d=m=>{if(!e)return;let g,y=new RegExp(`"footprint":"${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}".*?"projectId":"([^"]+)"`);for(let b of a){let P=b.match(y);if(P){g=P[1];break}}Wi.curProjectUuid=g},p=async(m,g)=>{!g||u.has(g)||(d(m),g.indexOf("_")>-1?await Wi.getInstance().addCustomFootprint(g,h):await Wi.getInstance().add(g,h),u.add(g))};if(r.footprintMap)for(let m in r.footprintMap){if((c=n[m])!=null&&c.length)continue;let g=r.footprintMap[m];await p(m,g)}if(Object.keys(n).length&&Object.keys(s).length&&(a!=null&&a.length)){for(let m in n){let g=r.footprintMap[m];if(!g)continue;await p(m,g);let y=n[m]||[];for(let b of y){let P=s[b];await p(g,P)}}for(let m=0;m<a.length;m++){let g=JSON.parse(a[m]),y=g.globalIndex?s[g.globalIndex]:void 0;g.custom&&y&&(g.footprint=y,g.custom=y,a[m]=JSON.stringify(g))}}}}finally{Wi.curProjectUuid=x.getInstance().projectId}return a}handleAcrossDocType(t){let e={},r={reviver:(i,n)=>n&&(i==="start"||i==="end"||i==="center"||i==="position")?new S(n.x,n.y):n};for(let[i,n]of Object.entries(t.data))for(let s=n.length-1;s>=0;s--){let a=JSON.parse(n[s],r.reviver);if(!a)continue;let l=Number(i)===15,c=this.convertElementData(l,{data:l?a:{...a,flag:Number(i)},flag:Number(i)});if(c){n.splice(s,1);for(let[h,u]of Object.entries(c)){let d=Number(h);e[d]=e[d]||[],e[d].push(...u)}}}for(let[i,n]of Object.entries(e)){let s=Number(i);t.data[s]=t.data[s]||[],t.data[s].push(...n)}}convertElementData(t,e){let r=[],i=[],n={},s=null;try{if(t){let{footprint:a,custom:l,device:c,rotation:h,textOffset:u,position:d,ATTR:p}=e.data;if(!a||!c)return;let m=ps.getItem(c);if(!m)return;let g=new e2,y=m.createComponent(cr(),l!=null?l:a);y.resultNeedToBeCached=!1;let b=g.build(y,S.ORIGIN);if(!(b instanceof Me))return;s=b,b.rotation=h,b.textOffset=u,b.position=d;for(let P of p){let T=P.key,I=b.attrKeyText[T];if(I!=null&&b.removeAttribute(I),P.showKey||P.showValue){let C=this.createTempController(10,P);b.addAttribute(C)}}for(let P in b.attrKeyText){let T=b.attrKeyText[P];if(T.showKey||T.showValue){let I=JSON.stringify(T.toJSON1());r.push(I),i.push(this.getFlag(T))}}}else if(s=this.createTempController(e.flag,e.data),!s)return;if(s){let a=t?s.getItems():[s],l=t?new Set:null;for(let c of a){if(c instanceof Rs)continue;let h=c.getParent();if(t&&h&&c instanceof fr||!t&&c instanceof fr){let u=JSON.stringify(c.toJSON1());r.push(u),i.push(this.getFlag(c))}else if(h&&h instanceof ct&&l){if(!l.has(h)){l.add(h);let u=JSON.stringify(h);r.push(u),i.push(this.getFlag(h))}}else if(c instanceof Ar){let u={globalIndex:cr(),layerId:c.layerId,start:c.start,end:c.end,width:c.width,locked:c.locked,isSegment:c.width==0},d={globalIndex:c.globalIndex,type:"Line",layerId:c.layerId,shapes:[[{LINE:u}]],strokeWidth:c.width,locked:c.locked,net:c.net,silkColor:null,componentData:null,regionRuleSelector:null};r.push(JSON.stringify(d)),i.push(16)}else if(c instanceof Ye)if(c.type=="TearDrop"){let u=c.toJSON();u.type="Fill Region",u.componentData=null,r.push(JSON.stringify(u)),i.push(this.getFlag(c))}else if(c.type=="Board Outline"){let u=c.toJSON();u.type="Line",r.push(JSON.stringify(u)),i.push(this.getFlag(c))}else r.push(JSON.stringify(c)),i.push(this.getFlag(c));else r.push(JSON.stringify(c)),i.push(this.getFlag(c))}}for(let a=0;a<i.length;a++){let l=i[a];n[l]=n[l]||[],n[l].push(r[a])}return n}finally{s&&(!t&&(s.sendDeleteMsg=!1),s.remove(),A.publish("delete",s))}}createTempController(t,e){switch(t){case 1:{let{globalIndex:r,layerId:i,start:n,end:s,width:a,locked:l,net:c}=e,h=new qr(r,i,n,s,a,l,c,null),u=new Ar(h);return u.update(),u}case 4:{let{globalIndex:r,layerId:i,center:n,radius:s,width:a,startAngle:l,endAngle:c,sweep:h,locked:u,net:d,arcType:p}=e,m=new Oi(r,i,n,s,a,l,c,h,u,d,p,null),g=new Si(m);return g.update(),g}case 6:{let{globalIndex:r,type:i,layerId:n,center:s,radius:a,strokeWidth:l,locked:c,net:h,silkColor:u,componentData:d}=e,p=new $p(r,i,n,s,a,l,c,h,ee.of7(u),null,null);if(p){let m=new Sr(p);if(m.update(),d){let g=new Nl(d,i);g!=null&&g.rebuildComponent(m)}return m}}case 9:{let{globalIndex:r,type:i,layerId:n,start:s,width:a,height:l,net:c,locked:h,strokeWidth:u,rotation:d,cornerRadius:p,silkColor:m,componentData:g}=e,y=new Zp(r,i,n,s,a,l,d,p,c,u,h,ee.of7(m),null,null);if(y){let b=new nr(y);if(b.update(),g){let P=new Nl(g,i);P!=null&&P.rebuildComponent(b)}return b}}case 10:{let{globalIndex:r,layerId:i,key:n,showKey:s,value:a,showValue:l,fontFamily:c,fontSize:h,rotation:u,locked:d,position:p,origin:m,strokeWidth:g,reverse:y,reverseExpansion:b,mirror:P,positionIsNull:T,silkColor:I}=e,C=bo(h),E=bo(g),O=n!==""?YE:Ed,_=new O(cr(),i,0,n,s,a,l,c,C,u,p,m,E,y,b,P,T,[],0,0,d,ee.of7(I));return new fr(_)}case 16:{let{globalIndex:r,type:i,layerId:n,shapes:s,strokeWidth:a,net:l,locked:c,silkColor:h,componentData:u,bbox:d,outline:p}=e,m={layerId:n,strokeWidth:a,locked:c},g=s.map(b=>b.map(P=>{for(let T in P){if(T=="LINE"){let{start:I,end:C}=P[T];return new ih(cr(),I,C,m)}if(T=="ARC"){let{layerId:I,center:C,radius:E,width:O,startAngle:_,endAngle:R,sweep:v,locked:D,arcType:w}=P[T];return new yh(cr(),C,E,_,R,v,m,w)}}}).filter(P=>P!=null)),y=new Jp(r,i,n,g,a,l,c,ee.of7(h),null,d,p);if(y){let b=_Dt(y);if(b.update(),u){let P=new Nl(u,i);P!=null&&P.rebuildComponent(b)}return b}}}}getCombinationInfo(t){let e=new Array;for(let i of t){let n=i.getGroupID();n!=null&&e.indexOf(n)<0&&e.push(n)}let r=new Array;for(let i of e){let s=kt.getItem(i).getItems(),a=new Array;for(let l of s){let c=t.indexOf(l);if(c>=0)a.push(c);else break}s.length==a.length&&r.push(a)}return r}getFlag(t){if(t instanceof Ar)return 1;if(t instanceof Ri)return 2;if(t instanceof Ge)return 3;if(t instanceof Si)return 4;if(t instanceof Sr)return 6;if(t instanceof nr)return 9;if(t instanceof fr)return 10;if(t instanceof ol)return 11;if(t instanceof ca)return 12;if(t instanceof xa)return 14;if(t instanceof Me)return 15;if(t instanceof ct)return 16;if(t instanceof mt)return 16;if(t instanceof vt)return 16;if(t instanceof fn)return 17;if(t instanceof Yn)return 18;if(t instanceof Rs)return 19}getManager(t){switch(t){case 1:return pr;case 2:return Kt;case 3:return Hr;case 4:return pr;case 6:return Zt;case 9:return Xt;case 10:return ti;case 11:return is;case 12:return Go;case 14:return Uo;case 15:return Cr;case 16:case 16:case 16:return pt;case 17:return Kt;case 18:return Ln;case 19:return _o}}};var hde=class extends zh{constructor(){super(...arguments);this.mgr=Sl.getInstance()}addControllerCache(e){Vt.insert(e)}addRadiusMarkByModel(e){let r=new xa(e);return this.addControllerCache(r),r}addRadius(e,r,i,n,s,a,l,c,h){let u=cr(),d=Sl.getInstance().addRadius(u,e,r,i,n,s,a,l,c,h),p=new xa(d);return this.lastPrecision=p.precision,this.addControllerCache(p),p}rebuild(e,r,i,n,s,a,l,c,h,u){let d=Sl.getInstance().addRadius(e,r,i,n,s,a,l,c,h,u),p=new xa(d);return this.addControllerCache(p),p}copy(e){let{globalIndex:r,layerId:i,start:n,end:s,width:a,height:l,length:c,precision:h,unit:u,locked:d,textPosition:p,silkColor:m}=e,g=new S(n.x,n.y),y=new S(s.x,s.y);p=new S(p.x,p.y);let b=r.slice(0,-16)+cr(),P=this.rebuild(b,i,g,y,a,l,c,h,u,d);return P.textPosition=p,P.silkColor=ee.of7(m),P}delete(e){e instanceof xa&&Sl.getInstance().delete(e.model)}};var ude=class{add(t,e,r,i,n){let s=cr(),a=new ih(s,e,r,{layerId:t,strokeWidth:i,locked:n}),l=new mt(a);return vb.getInstance().updateItem(l),l}addByModel(t,e=!1){e&&(t.globalIndex=cr());let r=new mt(t);return vb.getInstance().updateItem(r),r}rebuild(t,e,r,i,n,s){let a=new ih(t,r,i,{layerId:e,strokeWidth:n,locked:s}),l=new mt(a);return vb.getInstance().updateItem(l),l}copy(t){let{globalIndex:e,layerId:r,start:i,end:n,width:s,locked:a}=t,l=new S(i.x,i.y),c=new S(n.x,n.y);return this.add(r,l,c,s,a)}};var dde=class{constructor(){this._arcType=1}set arcType(t){this._arcType=t}get arcType(){return this._arcType}addArc(t,e,r,i,n,s,a,l,c=1){let h=cr(),u=new yh(h,e,r,n,s,a,{layerId:t,strokeWidth:i,locked:l},c),d=new vt(u);return vb.getInstance().updateItem(d),d}addArcByModel(t,e=!1){e&&(t.globalIndex=cr());let r=new vt(t);return vb.getInstance().updateItem(r),r}rebuild(t,e,r,i,n,s,a,l,c,h=1){let u=new yh(t,r,i,s,a,l,{layerId:e,strokeWidth:n,locked:c},h),d=new vt(u);return vb.getInstance().updateItem(d),d}copy(t){let{globalIndex:e,layerId:r,center:i,radius:n,width:s,startAngle:a,endAngle:l,sweep:c,locked:h,arcType:u}=t,d=new S(i.x,i.y);return this.addArc(r,d,n,s,a,l,c,h,u)}};var pde=class extends zh{constructor(){super(...arguments);this.mgr=Mi.getInstance();this.idMapTears=new Map}clearIdMapTear(e){let r=this.idMapTears.get(e);r!=null&&r.size===0&&this.idMapTears.delete(e)}addControllerCache(e){ze.addItem(e),Vt.insert(e)}addPolygon(e,r,i,n,s,a,l,c){let h=cr(),u=i.map(m=>m.map(g=>g.model));s=wu(s,r,e),(c==null||!Lf(e,c,r))&&(c=V1(1,{type:e,layerId:r,strokeWidth:n}));let d=Mi.getInstance().addPolygon(h,e,r,u,n,s,a,null,c,null,l),p=new ct(d,i);return p.updateFilterVisible=!0,p.refreshFilterVisible(),this.addControllerCache(p),p}addPolygonByModel(e,r,i=!1){if(i){let s=e.globalIndex;Mi.getInstance().getItem(s)==e&&Mi.getInstance().delete(e,s),e.globalIndex=cr(),Mi.getInstance().addModel(e)}let n=new ct(e,r);return this.addControllerCache(n),g2(n.model,"add"),n.fill(),n}rebuild(e,r,i,n,s,a,l,c,h){let u=n.map(m=>m.map(g=>g.model));a=wu(a,i,r),(h==null||!Lf(r,h,i))&&(h=V1(1,{type:r,layerId:i,strokeWidth:s}));let d=Mi.getInstance().addPolygon(e,r,i,u,s,a,l,c,h),p=new ct(d,n);return this.addControllerCache(p),p}copy(e){let r=e.globalIndex,i=e.type,n=parseInt(e.layerId),s=e.shapes,a=parseFloat(e.strokeWidth),l=e.net,c=e.locked,h=e.componentData,u=e.silkColor,d=new Nl(h,i),p=s.map(y=>y.map(b=>{for(let P in b){if(P=="LINE")return $u.copy(b[P]);if(P=="ARC")return qc.copy(b[P])}}).filter(b=>b!=null)),m=r.slice(0,-16)+cr(),g=this.rebuild(m,i,n,p,a,l,c,ee.of7(u));return d!=null&&d.rebuildComponent(g),this.modifyRegionSelector(g,e.regionRuleSelector),g}delete(e){if(e instanceof ct){let r=e.globalIndex;if(g2(e.model,"delete"),e.type=="Partition"&&Dn.getInstance().deleteItemById(r),Mi.getInstance().delete(e.model,r),e.type=="TearDrop"){let i=e.getComponent().connects;for(let n=0;n<i.length;n++){let s=this.idMapTears.get(i[n]);typeof s<"u"&&s.delete(e)}}}}autoFill(){let e=this.getAllItem();for(let r of e)r.isVisible&&r.notShowFill&&!["Line","Copper Region","Board Outline"].includes(r.type)&&r.fill()}autoRefreshAll(){let e=this.getAllItem();for(let r of e)r.isVisible&&r.refreshRender()}getTears(e){return this.idMapTears.get(e)}idMapTearsIsNull(){return this.idMapTears.size===0}deleteConnects(e,r){r.forEach(i=>{var n;(n=this.idMapTears.get(i))==null||n.delete(e)})}addConncect(e,r){r.forEach(i=>{let n=this.idMapTears.get(i);n==null&&(n=new Set,this.idMapTears.set(i,n)),n.add(e)})}modifyConnect(e,r){let n=e.getComponent().connects;n.forEach(s=>{var a;(a=this.idMapTears.get(s))==null||a.delete(e)}),n.length=0,Re.addAll(n,r),n.forEach(s=>{let a=this.idMapTears.get(s);a==null&&(a=new Set,this.idMapTears.set(s,a)),a.add(e)})}modifyRegionSelector(e,r){if(e.type==="Constraint Region"){let i=e.globalIndex,n=te.getInstance().addRegionSelector(i);te.getInstance().updateRegionSelector(i,r,!0)}}};function iqe(){An.getInstance().recycle(),$n.getInstance().recycle(),Tn.getInstance().recycle(),Qs.getInstance().recycle(),e0.getInstance().recycle(),Ka.getInstance().recycle(),Za.getInstance().recycle(),Sl.getInstance().recycle(),Mi.getInstance().recycle(),rn.getInstance().recycle(),zi.getInstance().recycle(),Wo.getInstance().recycle(),Ho.getInstance().recycle(),PT.getInstance().recycle(),mo.getInstance().recycle(),xs.getInstance().recycle(),Ip.getInstance().recycle(),$e.getInstance().recycle(),te.getInstance().recycle(),$a.getInstance().recycle(),Dn.getInstance().recycle()}var fde=class{constructor(){this.groupCommand=null;A.subscribe("clearElements",this.clearElements.bind(this)),A.subscribe("clearAll",this.clearAll.bind(this)),A.subscribe("previewClearAll",this.previewClearAll.bind(this))}clearElements(t){if(!(!x.getInstance().isactive||23==x.getInstance().doctype)){this.groupCommand=new ve("clearElements"),A.publish("clearSelect","");for(let e of t)switch(e){case"track":this.delete(pr);break;case"via":this.delete(Hr);break;case"suture via":this.deleteSutureVia();break;case"text":this.delete(ti);break;case"attr":this.deleteAttr(ti);break;case"device":this.delete(Cr);break;case"testPoint":this.delete(Kt,!0);break;case"pad":this.delete(Kt);break;case"boardOutline":case"boardCutout":case"region":case"fpcStiffener":case"prohibit":case"constraint":case"pour":case"line":case"3dShellOutline":case"3dShellScrewPillar":case"3dShellSideSlotDatumLine":case"3dShellSideSlotRegion":case"3dShellTopSlotRegion":case"3dShellTopBottomEntity":case"3dShellSlotEntity":{this.delete2Dline(pt,e),this.delete2Dline(Zt,e),this.delete2Dline(Xt,e);break}case"image":this.delete(Ln);break;case"trueColorPicture":this.delete(_o);break;case"dimension":{this.delete(Uo),this.delete(Go),this.delete(is);break}case"teardrop":this.delete2Dline(pt,e);default:}this.groupCommand.length>0&&(je.executeCommand(this.groupCommand),A.publish("flushService","")),this.groupCommand=null,Ve.crossWindow()}}clearAll(t,e,r=!0,i=!0){!x.getInstance().isactive||23==x.getInstance().doctype||(this.groupCommand=t||new ve("clear all"),A.publish("clearSelect",""),this.deleteAll(Cr,r,e),this.deleteAll(pr,r,e),this.deleteAll(Hr,r,e),this.deleteAttrAll(ti,r,e),this.deleteAll(Kt,r,e),this.deleteAll(pt,r,e),this.deleteAll(Zt,r,e),this.deleteAll(Xt,r,e),this.deleteAll(Uo,r,e),this.deleteAll(Go,r,e),this.deleteAll(is,r,e),this.deleteAll(Ln,r,e),this.deleteAll(_o,r,e),this.groupCommand.length>0&&i&&(je.executeCommand(this.groupCommand),A.publish("flushService","")),this.groupCommand=null,Ve.crossWindow(),A.messageBus.publish("RestoreToolStatus",void 0))}previewClearAll(){if(23!=x.getInstance().doctype)return;this.groupCommand=null,A.publish("clearSelect",""),iqe(),Kue(),Do.clear();let t=[];for(let r of be.getAllLayer())t.push(r.layerID);for(let r of $e.getInstance().getAllHelpLayer())t.push(r);let e=bn.getInstance();for(let r of t){let i=e.getLayer(r);i&&i.clear()}ay.clear(),be.layerMap={},this.groupCommand=null}async deleteTemplate(){await Ji.clear(),await ps.clear(),Eb.clear()}deleteAll(t,e=!0,r,i=!1){let n=t.getAllItem(),s=typeof r=="function";for(let a of n)if(!(s&&r(a))&&!(!i&&(!Bt.checkIsCanEditByItem(a)||Bt.isChildPcb()&&(a instanceof Me||a instanceof Ye&&a.type=="Partition")))&&(e&&!a.locked||!e)&&a.getParent()==null){if(this.groupCommand!=null){let l=Te.dispatch(a,"delete");this.groupCommand.addCommand(l)}A.publish("hasModifyPcbItem",a),a.remove(),A.publish("delete",a)}}deleteAttrAll(t,e=!0,r,i=!1){let n=t.getAllItem(),s=typeof r=="function";for(let a of n)if(!(s&&r(a))&&!(!i&&(!Bt.checkIsCanEditByItem(a)||Bt.isChildPcb()&&(a instanceof Me||a instanceof Ye&&a.type=="Partition")))&&(e&&!a.locked||!e)&&a.getParent()==null){if(x.getInstance().doctype==4&&a.key=="Footprint"){this.hiddenAttr(a);continue}if(this.groupCommand!=null){let l=Te.dispatch(a,"delete");this.groupCommand.addCommand(l)}A.publish("hasModifyPcbItem",a),a.remove(),A.publish("delete",a)}}deleteAttr(t){let e=t.getAllItem();for(let r of e){if(!Bt.checkIsCanEditByItem(r))continue;let i=r.getGroupID(),n=r.getParent();if(!r.locked&&n instanceof Me){if(x.getInstance().doctype==4&&r.key=="Footprint"){this.hiddenAttr(r);continue}if(this.groupCommand!=null){let s=Te.dispatch(r,"modify");this.groupCommand.addCommand(s)}this.deleteCombinationMsg(i,r.globalIndex,r.number),A.publish("hasModifyPcbItem",r),r.showKey=!1,r.showValue=!1}}}hiddenAttr(t){if(this.groupCommand!=null){let e=Te.dispatch(t,"modify");this.groupCommand.addCommand(e)}A.publish("hasModifyPcbItem",t),t.showKey=!1,t.showValue=!1}delete(t,e=!1){let r=t.getAllItem(),i=[];for(let n of r){if(n instanceof Le){if(n.isTestPad===e){i.push(n);continue}continue}i.push(n)}for(let n of i){if(!Bt.checkIsCanEditByItem(n))continue;let s=n.getGroupID();if(!n.locked&&n.getParent()==null){if(x.getInstance().doctype==4&&n instanceof fr&&n.key=="Footprint"){this.hiddenAttr(n);continue}if(this.groupCommand!=null){let a=Te.dispatch(n,"delete");this.groupCommand.addCommand(a)}this.deleteCombinationMsg(s,n.globalIndex,n.number),A.publish("hasModifyPcbItem",n),n.remove(),A.publish("delete",n)}}}deleteCombinationMsg(t,e,r){if(t!=null){let i=kt.getItem(t).name;VC.addObj(e,r),VC.addGroup(t,i),VC.execute()}}deleteSutureVia(){let t=Hr.getAllItem();for(let e of t){if(!Bt.checkIsCanEditByItem(e))continue;let r=e.getGroupID();if(!e.locked&&e.getParent()==null&&e.isSuture){if(this.groupCommand!=null){let i=Te.dispatch(e,"delete");this.groupCommand.addCommand(i)}this.deleteCombinationMsg(r,e.globalIndex,e.number),A.publish("hasModifyPcbItem",e),e.remove(),A.publish("delete",e)}}}delete2Dline(t,e){let r=t.getAllItem();for(let i of r){if(!Bt.checkIsCanEditByItem(i))continue;let n=i.getGroupID(),s=this.getType(i),a=i.getParent();if(!i.locked&&s==e&&a==null){if(this.groupCommand!=null){let l=Te.dispatch(i,"delete");this.groupCommand.addCommand(l)}this.deleteCombinationMsg(n,i.globalIndex,i.number),A.publish("hasModifyPcbItem",i),i.remove(),A.publish("delete",i)}}}getType(t){if(t instanceof Ar)return"track";if(t instanceof Ge)return"via";if(t instanceof fr)return"text";if(t instanceof Me)return"device";if(t instanceof Ri){if(t.getParent()==null)return"pad"}else if(t instanceof fn){if(t.getParent()==null)return"polygonpad"}else if(t instanceof Sr)switch(t.type){case"Line":return"line";case"Copper Region":return"pour";case"Prohibited Region":return"prohibit";case"Constraint Region":return"constraint";case"Partition":return"partition";case"Fill Region":return"region";case"FPC Stiffener":return"fpcStiffener";case"Board Outline":return"boardOutline";case"Slot Region":return"boardCutout";case"3D Shell - Outline":return"3dShellOutline";case"3D Shell - Screw Pillar":return"3dShellScrewPillar";case"3D Shell - Side Datum Line":return"3dShellSideSlotDatumLine";case"3D Shell - Top Slot Region":return"3dShellTopSlotRegion";case"3D Shell - Side Slot Region":return"3dShellSideSlotRegion";case"3D Shell - Top/Bottom Entity":return"3dShellTopBottomEntity";case"3D Shell - Side Entity":return"3dShellSlotEntity"}else if(t instanceof nr)switch(t.type){case"Line":return"line";case"Copper Region":return"pour";case"Prohibited Region":return"prohibit";case"Constraint Region":return"constraint";case"Partition":return"partition";case"Fill Region":return"region";case"FPC Stiffener":return"fpcStiffener";case"Board Outline":return"boardOutline";case"Slot Region":return"boardCutout";case"3D Shell - Outline":return"3dShellOutline";case"3D Shell - Screw Pillar":return"3dShellScrewPillar";case"3D Shell - Side Datum Line":return"3dShellSideSlotDatumLine";case"3D Shell - Top Slot Region":return"3dShellTopSlotRegion";case"3D Shell - Side Slot Region":return"3dShellSideSlotRegion";case"3D Shell - Top/Bottom Entity":return"3dShellTopBottomEntity";case"3D Shell - Side Entity":return"3dShellSlotEntity"}else if(t instanceof ct)switch(t.type){case"Line":return"line";case"Copper Region":return"pour";case"Prohibited Region":return"prohibit";case"Constraint Region":return"constraint";case"Partition":return"partition";case"Fill Region":return"region";case"FPC Stiffener":return"fpcStiffener";case"Board Outline":return"boardOutline";case"Slot Region":return"boardCutout";case"3D Shell - Outline":return"3dShellOutline";case"3D Shell - Screw Pillar":return"3dShellScrewPillar";case"3D Shell - Side Datum Line":return"3dShellSideSlotDatumLine";case"3D Shell - Top Slot Region":return"3dShellTopSlotRegion";case"3D Shell - Side Slot Region":return"3dShellSideSlotRegion";case"3D Shell - Top/Bottom Entity":return"3dShellTopBottomEntity";case"3D Shell - Side Entity":return"3dShellSlotEntity";case"TearDrop":return"teardrop"}else{if(t instanceof ca)return"dimension";if(t instanceof ol)return"dimension";if(t instanceof xa)return"dimension";if(t instanceof Yn)return"image";if(t instanceof Rs)return"trueColorPicture"}return""}};function nqe(o,t,e=!0,r,i,n,s,a){let l="getNetListOfPcb-time";pn(l);let{pageId:c}=n||{},h={netList:{version:"2.0.0",components:{}},repeatMap:{},noneMap:[],componentPinIdMap:{}},{netList:u,repeatMap:d,noneMap:p,componentPinIdMap:m}=h,g=u.components,y=0,b=[];o.forEach(v=>{var L;let D=v instanceof vi?v:v.model,w=bVe(D),F=Object.assign({},w);t=t||"Unique ID";let H=F[t];if(e){let B=!1;for(H||(H="$"+ ++y,B=!0);b.includes(H);)H="$"+ ++y,B=!0;B&&r&&r(v,t,H)}F.FootprintName=D.footprintId||"",F.DeviceName=D.device||"",F.SymbolName=w.Symbol,F.Device=v.deviceUUID,F.Designator=((L=v.numShape)==null?void 0:L.value)||v.name,F["Group ID"]=v.combinationID,F["Channel ID"]=v.channelID,F["Reuse Block"]=v.reuseBlock;let z=a?a(v):null;F.Footprint=z||v.footprintUUID,F["PCB Layer"]=v.layerId==1?"TopLayer":"BottomLayer",i&&i(v,F);let G={};H&&(m[H]={}),v.getPads().forEach(B=>{let U=B.num,k=B.showNet;if(G[B.num]={name:"",number:U,net:k},H){let V=m[H][B.num];V?Array.isArray(V)?V.push(B.globalIndex):m[H][B.num]=[V,B.globalIndex]:m[H][B.num]=B.globalIndex}});let W={props:F,pinInfoMap:G,source:{pageId:c,componentId:v.globalIndex,isPartition:s?s(v):!1,displayId:ur+v.number}};z&&(W.source.id=v.footprintUUID),H?b.includes(H)?(d[H]||(d[H]=[g[H]]),d[H].push(W)):(g[H]=W,b.push(H)):p.push(W)});let P=te.getInstance();u.designRule={trackPhysics:{},netRule:{}};let T=u.designRule.trackPhysics,I=10;P.getAllTrackPhysics().forEach(v=>{let D=v.unit,w=bL(D,I),F={name:v.name,isDefault:v.isDefault,unit:D,strokeValue:{}},H=F.strokeValue;v.iterateTable((z,G)=>{let W={default:D2(z.defaultValue,I,w),min:D2(z.minValue,I,w),max:D2(z.maxValue,I,w)};H[G.toString()]=W}),T[F.name]=F});let C=u.designRule.netRule;P.getAllNets().forEach(v=>{let D=v.name;D&&(C[D]={net:D,ruleMap:{TrackPhysics:R(v.trackPhysics)}})});let E=u.netClass={};P.getAllNetClass().forEach(v=>{let D=v.name;D&&(E[D]={name:D,nets:Array.from(v._nets),netRule:{}})});let O=u.equalLengthNetGroup={};P.getAllEqualLengthGroups().forEach(v=>{let D=v.name;D&&(O[D]={name:D,nets:Array.from(v.getNets()),useRuleName:R(v.netLengthPhysics)})});let _=u.differentialPair={};return P.getAllNetDifferentials().forEach(v=>{var F,H;let D=v.name,w={name:D,positiveNet:((F=v.positiveNet)==null?void 0:F.name)||"",negativeNet:((H=v.negativeNet)==null?void 0:H.name)||""};_[D]=w}),Bi(l),h;function R(v){return!v||v=="default"?"":v}}var xw=class extends zh{constructor(){super(...arguments);this.mgr=xs.getInstance()}isEmpty(){return this.mgr.itemsCount==0}addControllerCache(e){this.add2Template(e),Vt.insert(e)}addComponentByModel(e,r,i,n=!1){if(n){let a=i.globalIndex;xs.getInstance().getItem(a)==i&&xs.getInstance().delete(i,a),i.globalIndex=cr(),xs.getInstance().addModel(i)}let s=new Me(e,r,i);return this.addControllerCache(s),s}add(e,r,i,n,s,a,l,c,h,u,d){let p=cr();h.locked=c;let m=a.map(P=>P.model),g=new Array;for(let P of l){let T=P.model;T instanceof ki&&g.push(T)}let y=xs.getInstance().add(p,e,r,i,n,s,m,g,h,u,d),b=new Me(a,l,y);return this.addControllerCache(b),b}rebuild(e,r,i,n,s,a,l,c,h,u,d,p){u.locked=h;let m=l.map(P=>P.model),g=new Array;for(let P of c){let T=P.model;T instanceof ki&&g.push(T)}let y=xs.getInstance().add(e,r,i,n,s,a,m,g,u,d,p),b=new Me(l,c,y);return this.addControllerCache(b),b}copy(e,r){let{footprint:i,device:n,globalIndex:s,layerId:a,position:l,rotation:c,textOffset:h,locked:u,attrsMap:d,ATTR:p,pads:m,custom:g,silkColor:y}=e,b=new Array;l=new S(l.x,l.y),h=new S(h.x,h.y);let P=Ji.getItem(i),T=null;if(g!=null){let v=g;T=v.split("_")[1],P=Ji.getItem(v)}let I,C;T==null&&(T=cr()),n!=null?(C=ps.getItem(n),I=C.copy(P.uuid,T)):(I=new jE(P.uuid,"",T,P.getBBox()),I=P.generate(I)),I.attrsMap=d;let O=new e2().build(I,S.ORIGIN,!0,r);O.layerId=a,O.rotation=c,O.textOffset=h,O.locked=u,O.position=l,y&&(O.silkColor=y);let _=O.getAllId();p.forEach(v=>{let D=[...v.globalIndex.matchAll(/[a-zA-Z]+[0-9]+/g)],w="",F="";D.length==2?(w=D[0][0],F=D[1][0]):F=D[D.length-1][0];let H;for(;H=`${O.globalIndex}${F}`,!!_.has(H);)F=s.slice(0,-16)+cr();_.add(H);let z=ti.copy(v,H);z.key=v.key,z.showKey=v.showKey,b.push(z)}),b.forEach(v=>{if(v.key=="Designator"){let D=d.Designator;d.Designator=D,v.value=D}else v.key=="Footprint"?(d.Footprint=P.footprintId,v.value=P.footprintId):v.key=="Device"&&C!=null&&(d.Device=C.name,v.value=C.name);O.addAttribute(v)}),this.add2Template(O);let R=Qp(v=>v.num,m);if(O.getPads().forEach(v=>{let D=R.get(v.num);if(D!=null)if(D.length==1)v.net=D[0].net,D[0].padLen!=null&&as.getInstance().setPadLen(O.globalIndex,v.globalIndex,D[0].padLen);else{let w=v.globalIndex.replace(O.globalIndex,"");for(let F of D)F.id==w&&(v.net=F.net,F.padLen!=null&&as.getInstance().setPadLen(O.globalIndex,v.globalIndex,F.padLen))}}),O.getVias().forEach(v=>{let D=v.getParent(),w;if(D!=null){let H=D.globalIndex,z=new RegExp(H);w=v.globalIndex.replace(z,"")}else w=v.globalIndex;let F=R.get(w);if(F!=null)if(F.length==1)v.net=F[0].net;else for(let H of F)H.id==w&&(v.net=H.net)}),C!=null)for(let v of O.attributes){let D=C.getAttrData(O.model,v.model);C.addAttr(v.key,D)}return O}delete(e){if(e instanceof Me){let r=e.globalIndex;xs.getInstance().delete(e.model,r)}}getName(e){let r=e.replace(/[?\d]+$/,""),i=+e.replace(r,"")||0;return[r,i]}getPrefix(e){var i;let r=e.match(/\b(\d*[A-Za-z]+\d*)/);if(r==null){let n=(i=e.match(/^(\d+)/))==null?void 0:i[1];if(n==null){let s=e.match(/^(.*?)(?:_|$)/);return s?s[1]:e.includes("_")?e.split("_")[0]:e}else return n}else return r[0]}getNewNum(e){let r=1,i=this.getAllItem(),n={};i.forEach(l=>{let c=l.attrKeyValue.Designator,[h,u]=this.getName(c);!n[h]&&(n[h]=[]),!n[h].includes(u)&&n[h].push(u)});for(let l in n)if(Object.prototype.hasOwnProperty.call(n,l)){let c=n[l];c=c.sort((h,u)=>u-h)}let[s,a]=this.getName(e);return r=n[s]?n[s][0]+1:r,s+r}generateNetList(e,r=!0){var i;return nqe(this.getAllItem(),e,r,(n,s,a)=>{n instanceof Me&&this.updateDeviceAttr(n,s,a)},null,{pageId:(i=x.getInstance().tabId)==null?void 0:i.replace(/\@.+$/,"")},n=>n.partition!="",n=>{let s=Ji.getItem(n.footprintUUID);return s instanceof Xc?s.source:null})}add2Template(e){let r=Ji.getItem(e.footprintUUID);r.add(e.model),r.modifyName(e.name,e.name);let i=ps.getItem(e.deviceUUID);i!=null&&i.add(e.model)}updateDeviceAttr(e,r,i){e.modifyATTRMap(r,i);let n=e.attrKeyText;i!==null&&n[r]&&(n[r].value=i)}autoDesignator(e,r){if(ce.pcbConfig.autoDesignator){this.handleSameDesignator(e);for(let i of e){let n=this.getPrefix(i.attrsMap.Designator),[s]=this.getName(n);ce.pcbConfig.designatorAnnocationType==="2"&&(s=s.toUpperCase());let a=this.getNumber(s,r);r&&r.delete(i),this.updateDesignator([{component:i,prefix:s,suffix:a}])}}}placeCBBAutoSuffix(e,r){if(ce.pcbConfig.autoDesignator&&e.size){this.handleSameDesignator(r);for(let[,i]of e){let n=[],s=this.getSuffixNum(new Set(i));for(let a of i){let l=a.attrsMap.Designator,c=this.getPrefix(l);n.push({component:a,prefix:c+"_",suffix:s})}this.updateDesignator(n)}}}handleSameDesignator(e){let r=new Map;for(let n of e){let s=this.getPrefix(n.attrsMap.Designator);r.has(s)||r.set(s,new Set),r.get(s).add(n)}let i=new Set;for(let[,n]of r)if(n.size>1){let s=n.values();s.next();for(let a of s)i.add(a)}i.size>0&&this.autoDesignator(i,i)}getNumber(e,r){let i=ce.pcbConfig.designatorAnnocationType,n=this.getAllItem(),s=new Map;for(let c of n){if(r&&r.has(c))continue;let[h,u]=this.getName(this.getPrefix(c.attrsMap.Designator));ce.pcbConfig.designatorAnnocationType==="2"&&(h=h.toUpperCase()),s.has(h)||s.set(h,new Set),s.get(h).add(u)}let a=s.get(e)||new Set().add(0),l=1;switch(i){case"1":return Math.max(...a)+1;case"2":for(;;){if(!a.has(l))return l;l++}}}getSuffixNum(e){let r=this.getAllItem(),i=new Set().add(0);for(let n of r){if(e&&e.has(n))continue;let s=n.attrsMap.Designator;if(s.includes("_")){let[,a]=this.getName(s);i.add(a)}}return Math.max(...i)+1}updateDesignator(e){for(let r of e){let i=r.component.designator,n=r.prefix+r.suffix;r.component.modifyATTRMap("Designator",n),Ji.getItem(r.component.footprintUUID).addName(i);let a=r.component.attrKeyText;a.Designator&&(a.Designator.value=n)}}};var TAe=class{constructor(t){this.inters=new Array;this.interSet=new Ba;this.track=t}addInter(t){!this.interSet.contains(t)&&t.distance2(this.track.start)>1e-8&&t.distance2(this.track.end)>1e-8&&(this.inters.push(t),this.interSet.add(t))}},mde=class extends wi{constructor(){super(...arguments);this.idMap={};this.tracks=new Array;this.arcTrack=new Array;this.result=new Array;this.modifyTracks=new Set;this.stateMap=new Map;this.splitMap=new Map;this.mergeMap=new Map}update(e){if(pr.getAllItem().length==0)return;this.splitMap.clear(),this.mergeMap.clear();let r="updateConnectRelation-time";pn(r);let i=new Array;for(let n of e)(n instanceof Me||n instanceof Ue||n instanceof Ge||n instanceof Le)&&i.push(n);i.length<4e3&&(this.stateMap.clear(),this.removeCoincide(i),this.splitTrack(i),this.removeCoincide(i),this.mergeParallelTrack(i),this.removeZeroLengthTrack(i),this.updateSelect()),this.clear(),Bi(r,.05)}splitTrack(e){for(let r of e)if(r instanceof Me){let i=r.getPads();for(let s=0;s<i.length;s++)this.dispatch(i[s],e);let n=r.getVias();for(let s=0;s<n.length;s++)this.dispatch(n[s],e)}else this.dispatch(r,e);for(let r of this.modifyTracks)this.dispatch(r,e,!1);this.modifyTracks.clear(),this.split()}removeCoincide(e){for(let r of e)r instanceof Ue&&this.autoRemoveCoincide(r);for(let r of this.tracks)this.autoRemoveCoincide(r)}removeZeroLengthTrack(e){for(let r of e)r instanceof Ue&&!r.isEmpty&&r.getParent()==null&&r.length<.01&&this.removeTrack(r)}mergeParallelTrack(e){for(let r of e)r instanceof Ar&&this.autoMergeTrack(r);for(let r of this.tracks)this.autoMergeTrack(r);for(let r of this.result)this.autoRemoveCoincide(r)}updateSelect(){let e=new Set(Ve.getSelects());if(e.size>0){let r=!1;for(let[i,n]of this.splitMap)e.has(i)&&(e.delete(i),Re.addAllSet(e,n),r=!0);for(let[i,n]of this.mergeMap)for(let s of i)if(e.has(s)){for(let a of i)e.delete(a);e.add(n),r=!0;break}if(r){let i=new Array;for(let n of e)n.isEmpty||i.push(n);Ve.select(i),A.publish("flushSelectingInfo","")}}}clear(){this.tracks.length=0,this.arcTrack.length=0,this.result.length=0,this.idMap={},this.splitMap.clear(),this.mergeMap.clear()}dispatch(e,r,i=!0){e.isEmpty||(e instanceof Le?this.dispatchPad(e,r):e instanceof Ue?this.dispatchTrack(e,r,i):e instanceof Ge&&this.dispatchVia(e,r))}dispatchPad(e,r){let i=e.searchNode(!0);for(let n of i)n instanceof Ue&&this.splitPadTrack(n,e)}dispatchTrack(e,r,i=!0){if(e.isEmpty||e.getParent()!=null)return;let n=e.searchNode(!0);for(let s of n)s instanceof Le?this.splitPadTrack(e,s):s instanceof Ue?this.splitTracks(e,s,i):s instanceof Ge&&this.splitViaTrack(e,s)}dispatchVia(e,r){let i=e.searchNode(!0);for(let n of i)n instanceof Ue&&this.splitViaTrack(n,e)}splitPadTrack(e,r){if(!(e.isEmpty||e.getParent()!=null)&&!r.isEmpty&&!r.isSelect4Layer(e.start.x,e.start.y,e.layerId)&&!r.isSelect4Layer(e.end.x,e.end.y,e.layerId)&&e.isSelect(r.center.x,r.center.y)){if(e instanceof Si){let i=r.center.sub(e.center).normalize(),n=new M(e.center,r.center.add(i.mul(e.radius))),s=e.primitive,a=Tt(n,s),l=s.bbox();if(a>0){let c=this.getSide(e);for(let h=0;h<a;h+=2){let u=new S(Ee[h],Ee[h+1]);l.isContains(u)&&c.addInter(u)}}}else if(e instanceof Ar){let i=e.primitive,n=i.bbox(),s=ir.foot(i,r.center);s!=null&&n.isContains(s)&&s.distance1(r.center)<Math.min(.01,e.width/2)&&this.getSide(e).addInter(s)}}}getTrackConnectState(e){let r=this.stateMap.get(e);if(r!=null)return r;let i=new Nu(e),n=i.startType==0||i.startType==4,s=i.endType==0||i.endType==4;return n&&s?(this.stateMap.set(e,0),0):n&&!s?(this.stateMap.set(e,1),1):!n&&s?(this.stateMap.set(e,2),2):(this.stateMap.set(e,3),3)}modifyTrack(e,r,i){let n=e.track,s=r.track,a=s.end.sub(s.start),l=this.getLine(n.start,n.end),c=ir.foot(l,s.start),h,u=new Nu(e.track),d=u.startType==0||u.startType==4,p=u.endType==0||u.endType==4;if(!d&&(c.equals1(e.track.start)||c.add(a).equals1(e.track.start)))return h;if(!p&&(c.equals1(e.track.end)||c.add(a).equals1(e.track.end)))return h;let m=n.primitive.bbox();switch(i){case 0:{h=Te.dispatch(s,"modify"),s.start=c,s.end=c.add(a),m.isContains(c)&&e.addInter(c),m.isContains(s.end)&&e.addInter(s.end);break}case 1:{h=Te.dispatch(s,"modify"),s.start=c,m.isContains(c)&&e.addInter(c);break}case 2:{h=Te.dispatch(s,"modify"),s.start=c,s.end=c.add(a),m.isContains(s.end)&&e.addInter(s.end);break}default:}return h}splitTracks(e,r,i=!0){if(e.isEmpty||e.getParent()!=null||r.isEmpty||r.getParent()!=null)return;let n;if(e instanceof Ar&&r instanceof Ar){let u=e.direct,d=r.direct;if(Math.abs(u.cross(d))<.001&&e.length>.001&&r.length>.001){let m=Math.min(e.width,r.width)/4,g=this.getLine(e.start,e.end);if(ir.foot(g,r.start).distance1(r.start)<m){let b=this.getTrackConnectState(e),P=this.getTrackConnectState(r),T=this.getSide(e),I=this.getSide(r);if(b<3&&T.inters.length==0)if(i){this.modifyTracks.add(T.track);return}else n=this.modifyTrack(I,T,b);else if(P<3&&I.inters.length==0)if(i){this.modifyTracks.add(I.track);return}else n=this.modifyTrack(T,I,P)}}}let s=e.primitive,a=r.primitive,l=Tt(s,a),c=s.bbox(),h=a.bbox();if(l>0){je.stack!=null&&n!=null&&je.stack.addCommand(n);let u=this.getSide(e),d=this.getSide(r);for(let p=0;p<l;p+=2){let m=new S(Ee[p],Ee[p+1]);c.isContains(m)&&u.addInter(m),h.isContains(m)&&d.addInter(m)}}else n!=null&&n.undo()}splitViaTrack(e,r){if(!(e.isEmpty||e.getParent()!=null)&&!r.isEmpty&&!r.isSelect(e.start.x,e.start.y)&&!r.isSelect(e.end.x,e.end.y)&&e.isSelect(r.center.x,r.center.y)){if(e instanceof Si){let i=r.center.sub(e.center).normalize(),n=new M(e.center,r.center.add(i.mul(e.radius))),s=e.primitive,a=Tt(n,s),l=s.bbox();if(a>0){let c=this.getSide(e);for(let h=0;h<a;h+=2){let u=new S(Ee[h],Ee[h+1]);l.isContains(u)&&c.addInter(u)}}}else if(e instanceof Ar){let i=e.primitive,n=ir.foot(i,r.center),s=i.bbox();n!=null&&s.isContains(n)&&n.distance1(r.center)<Math.min(.01,e.width/2)&&this.getSide(e).addInter(n)}}}getSide(e){let r=this.idMap[e.globalIndex];return r==null&&(r=new TAe(e),this.idMap[e.globalIndex]=r),r}split(){Object.values(this.idMap).forEach(r=>{if(r.track instanceof Ar&&r.inters.length>0){xr(r.inters,(l,c)=>l.distance2(r.track.start)-c.distance2(r.track.start),0,r.inters.length),r.inters.push(r.track.end);let i=r.track.start,n=r.track.layerId,s=r.track.width,a=new Set;r.inters.forEach(l=>{if(!l.equals1(i)){let c=pr.addTrack(n,i,l,s,r.track.locked,r.track.net);c.partition=r.track.partition,a.add(c),c.updateFilterVisible=!0,c.visible(),this.joinCombination([c],r.track.getGroupID()),je.stack!=null&&(A.publish("addAutoServiceModify",c),je.stack.addCommand(Te.dispatch(c,"add"))),this.tracks.push(c),i=l}}),this.removeTrack(r.track),this.splitMap.set(r.track,a)}else if(r.track instanceof Si&&r.inters.length>0){dn(r.inters,r.track.primitive),r.inters.push(r.track.end);let i=r.track.start,n=r.track.layerId,s=r.track,a=r.track.width,l=s.startAngle,c=new Set;r.inters.forEach(h=>{if(!h.equals1(i)){let u=h.angle(s.center),d=pr.addArcTrack(n,s.center,s.radius,l,u,s.sweep,a,s.locked,s.net,s.arcType);if(d.length>s.length){d.remove();return}d.partition=r.track.partition,d.updateFilterVisible=!0,d.visible(),c.add(d),this.joinCombination([d],r.track.getGroupID()),je.stack!=null&&(A.publish("addAutoServiceModify",d),je.stack.addCommand(Te.dispatch(d,"add"))),this.arcTrack.push(d),i=h,l=u}}),this.removeTrack(r.track),this.splitMap.set(r.track,c)}})}joinCombination(e,r){(r?kt.getItem(r):null)!=null&&kt.joinCombination(e,r)}removeTrack(e){je.stack!=null&&(A.publish("addAutoServiceModify",e),je.stack.addCommand(Te.dispatch(e,"delete"))),e.sendDeleteMsg=!1,e.remove(),A.publish("delete",e)}autoRemoveCoincide(e){if(e.isEmpty||e.getParent()!=null)return;if(e.length<.001){this.removeTrack(e);return}let r=e.searchNode();for(let i of r)if(this.checkCoincide(e,i))if(i instanceof Ar)if(i.width<e.width)this.removeTrack(i);else if(i.width==e.width)if(i.length>e.length){this.removeTrack(e);return}else this.removeTrack(i);else{this.removeTrack(e);return}else this.removeTrack(e)}checkTrackCoincide(e,r){if(e instanceof Ue&&r instanceof Ue){if(e.start.similarEquals(r.start,1e-5)&&e.end.similarEquals(r.end,1e-5))return!0;if(e.start.similarEquals(r.end,1e-5)&&e.end.similarEquals(r.start,1e-5))return!0;if(e instanceof Ar&&r instanceof Ar){let i=e.direct,n=r.direct;if(Math.abs(i.cross(n))<.001){let a=e.start,l=e.end.angle(e.start),c=Ae.translate(-a.x,-a.y,0).rotateZ(-l),h=e.end.multiply4(c),u=r.start.multiply4(c),d=r.end.multiply4(c),p=new _e().ext2(u).ext2(d).ext7(r.width/2).build(),m=new _e().ext2(S.ORIGIN).ext2(h).ext7(e.width/2).build();return m.isInside(p.extendOfSize(1e-4))||p.isInside(m.extendOfSize(1e-4))}}}return!1}checkArcTrackCoincide(e,r){if(e instanceof Si&&r instanceof Si&&e.center.similarEquals(r.center,1e-5)&&P8e(e.radius,r.radius)&&e.model.primitive.isLarge()===r.model.primitive.isLarge()){if(e.start.similarEquals(r.start,1e-5)&&e.end.similarEquals(r.end,1e-5))return!0;if(e.start.similarEquals(r.end,1e-5)&&e.end.similarEquals(r.start,1e-5))return!0}return!1}checkCoincide(e,r){return e.isEmpty||e.getParent()!=null||r.isEmpty||r.getParent()!=null?!1:!!(e instanceof Ar&&r instanceof Ar&&this.checkTrackCoincide(e,r)||e instanceof Si&&r instanceof Si&&this.checkArcTrackCoincide(e,r))}autoMergeTrack(e){if(e.isEmpty||e.getParent()!=null)return;let r=new Nu(e),i=r.startType,n=r.endType,s=e.end,a=null,l=null,c=e.start,h=null,u=null;if(i==5||i==6){let d=r.startNodes[0],p=e.end.sub(e.start).normalize(),m=d.end.sub(d.start).normalize();Math.abs(p.cross(m))<Rl&&e.width==d.width&&!d.isEmpty&&(i==5?(a=d.end,l=d):i==6&&(a=d.start,l=d))}if(n==5||n==6){let d=r.endNodes[0],p=e.end.sub(e.start).normalize(),m=d.end.sub(d.start).normalize();Math.abs(p.cross(m))<Rl&&e.width==d.width&&!d.isEmpty&&(n==5?(h=d.end,u=d):n==6&&(h=d.start,u=d))}if(a!=null&&h!=null&&l!=null&&u!=null){if(!this.checkTrackPartition(e,l,u))return;let d=pr.addTrack(e.layerId,a,h,e.width,e.locked,e.net);d.partition=e.partition,d.updateFilterVisible=!0,d.visible(),e.getGroupID()!=null&&e.getGroupID()==l.getGroupID()&&e.getGroupID()==u.getGroupID()&&this.joinCombination([d],e.getGroupID()),je.stack!=null&&(d.isEmpty||(A.publish("addAutoServiceModify",d),je.stack.addCommand(Te.dispatch(d,"add")))),this.result.push(d);let p=new Set([e,l,u]);this.mergeMap.set(p,d),this.removeTrack(e),this.removeTrack(l),this.removeTrack(u)}else if(a!=null&&h==null&&l!=null){if(!this.checkTrackPartition(e,l,u))return;let d=pr.addTrack(e.layerId,s,a,e.width,e.locked,e.net);d.partition=e.partition,d.updateFilterVisible=!0,d.visible(),e.getGroupID()!=null&&e.getGroupID()==l.getGroupID()&&this.joinCombination([d],e.getGroupID()),this.mergeTrack(e,l,d)}else if(a==null&&h!=null&&u!=null){if(!this.checkTrackPartition(e,l,u))return;let d=pr.addTrack(e.layerId,c,h,e.width,e.locked,e.net);d.partition=e.partition,d.updateFilterVisible=!0,d.visible(),e.getGroupID()!=null&&e.getGroupID()==u.getGroupID()&&this.joinCombination([d],e.getGroupID()),this.mergeTrack(e,u,d)}}checkTrackPartition(e,r,i){let n=!0;return e&&(Bt.checkIsCanEditByItem(e)||(n=!1)),r&&(Bt.checkIsCanEditByItem(r)||(n=!1)),i&&(Bt.checkIsCanEditByItem(i)||(n=!1)),n}mergeTrack(e,r,i){je.stack!=null&&(i.isEmpty||(A.publish("addAutoServiceModify",i),je.stack.addCommand(Te.dispatch(i,"add")))),this.result.push(i),this.removeTrack(e),this.removeTrack(r);let n=new Set([e,r]);this.mergeMap.set(n,i)}getLine(e,r){let i=r.sub(e).normalize().mul(1e3);return new M(e.sub(i),r.add(i))}};var gU=class extends ws{constructor(e){super();this.commandFactory=new ve("push component");this.position=S.ORIGIN;this.addHistory=!0;this.associationItem=null;this.alreadyRotate=!1;this.revokeMove=!1;this.component=e,this.util=new UC(e),this.commands=new ve("single select Component"),this.position=this.component.position}onKeyDown(e){e.sceneX=this.component.position.x,e.sceneY=this.component.position.y;let r=new S(e.realSceneX,e.realSceneY),i=yi.getScene();switch(sr.getAction(i,e)){case"Flip Right and Left":{qf.flipComponent("Flip Right and Left",r,[this.component],this.commands),this.commands=new ve("single select Component");break}case"Flip Up and Down":{qf.flipComponent("Flip Up and Down",r,[this.component],this.commands),this.commands=new ve("single select Component");break}}return A.publish("showAndUpdateCross",e),!1}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;return this.component.isSelect(r,i)}onMouseMove(e){this.addHistory&&sp.getInstance().highlight([this.component]);let r=this.shiftControl(e);this.position=this.lastPosition;let i=this.position.sub(r);ce.pcbConfig.snapToOriginWhileDragFootprint&&(r=new S(e.sceneX,e.sceneY).sub(this.component.position));let n=ce.pcbConfig.snapToOriginWhileDragFootprint?new S(e.sceneX,e.sceneY):this.component.position.add(r);if(e.adsorbGrid&&(n=di.adsorpGrid(n),r=n.sub(this.component.position)),ce.pcbConfig.alignToNearComponentOrPadWhileDrag&&e.adsorb){let d=di.snapToOtherComponent(this.component,r,n,e);d&&(this.lastPosition=this.lastPosition.sub(r),n=d,r=n.sub(this.component.position),this.lastPosition=this.lastPosition.add(r))}let s=Ae.translate(r.x,r.y,0);if(!St.getInstance().currentCoord){let d=new S(e.sceneX,e.sceneY),p=this.util.getMatrix(n,d);s=s.multiply4(p)}this.associationItem==null&&(this.associationItem=new cl([this.component]),this.associationItem.moveInit());let a=this.associationItem.items;if(this.associationItem.setUpConnectTrack(),this.addHistory){let d=this.associationItem.getAllItem();for(let p of d)p.locked||(this.commands.addCommand(Te.dispatch(p,"modify")),A.publish("hasModifyPcbItem",p))}let l=this.component.position;this.associationItem.setAllAssociationRatlinesVisible();let c=this.associationItem.itemConnectTrack;a.forEach(d=>{!d.locked&&!c.tracks.has(d.globalIndex)&&d.transform(s)});let h=new S(this.position.x,this.position.y).sub(this.component.position),u=Ab();if(ce.pcbConfig.moveComponent=="block"&&!this.component.model.getGroupID()&&(j_(this.component,u),this.lastPosition=this.component.position.add(h)),e.sceneX=this.component.position.x,e.sceneY=this.component.position.y,ce.pcbConfig.moveComponent=="push"&&!this.component.model.getGroupID()){this.commandFactory.undo(),this.commandFactory=new ve("push component");let d=new Map;d.set(this.component,0),yw(this.component,this.commandFactory,u,d),d.clear(),this.lastPosition=this.component.position.add(h)}if(!this.alreadyRotate)if((ce.pcbConfig.moveComponent=="block"||ce.pcbConfig.moveComponent=="push")&&!this.component.model.getGroupID()){let d=this.component.position.sub(l),p=Ae.translate(d.x,d.y,0);this.associationItem.moveConnectTrack(p)}else this.associationItem.moveConnectTrack(s);return A.publish("showAndUpdateCross",e),this.revokeMove&&this.associationItem!=null&&this.associationItem.interrupt(),this.addHistory&&(this.addHistory=!1),this.changeNativeCursor(5),Pb.runWithStrategy(vC.createSingleComponentStrategy(),async()=>{sn.getInstance().language=(await cw()).message||"zh-cn",A.publish("updateDRC",[this.component])}),!0}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.component.isSelect(r,i)?this.changeNativeCursor(5):this.changeNativeCursor(4),!1}onMouseLeftUp(e){if(!qf.getStatus()){if(sp.getInstance().unhighlight(),this.position=this.component.position,this.commands.length>0){if(this.associationItem.complete(this.commands),ce.pcbConfig.moveComponent=="push")for(let r of this.commandFactory.commands)this.commands.addCommand(r);je.executeCommand(this.commands),this.commands=new ve("single select Component"),this.commandFactory=new ve("push component"),this.addHistory=!0,this.flushModify()}return this.removeShiftMoveHelpLine(),this.associationItem=null,A.publish("flushSelectingInfo",""),A.publish("autoFill",""),this.revokeMove=!1,!0}}interrupt(){return sp.getInstance().unhighlight(),this.associationItem!=null&&(this.associationItem.interrupt(),this.associationItem=null),!qf.getStatus()&&this.commands.undo(),ce.pcbConfig.moveComponent=="push"&&this.commandFactory.undo(),this.changeNativeCursor(4),this.removeShiftMoveHelpLine(),Pb.runWithStrategy(vC.createSingleComponentStrategy(),()=>{A.publish("updateDRC",[this.component])}),!0}flushModify(){let e=new cl([this.component]);A.publish("hasModifyPcbItem",this.component),e.getAllRepairTracks().forEach(i=>{A.publish("hasModifyPcbItem",i)})}rotate(e=ce.pcbConfig.rotate){let r=_s([this.component]);if(r.valid()){this.alreadyRotate=!0;let n=r.build1().center(),s=Ae.rotateZForPoint(n,e);this.associationItem==null&&(this.associationItem=new cl([this.component])),this.associationItem.interrupt();let a=this.associationItem.items;if(this.associationItem.setUpConnectTrack(),this.addHistory){let c=this.associationItem.getAllItem();for(let h of c)h.locked||this.commands.addCommand(Te.dispatch(h,"modify"))}this.alreadyRotate||this.associationItem.moveConnectTrack(s),this.associationItem.setAllAssociationRatlinesVisible();let l=this.associationItem.itemConnectTrack;a.forEach(c=>{!c.locked&&!l.tracks.has(c.globalIndex)&&c.transform(s)}),this.addHistory&&(this.addHistory=!1)}}};var yU=class extends ws{constructor(e){super();this.commandFactory=new ve("push component");this.addHistory=!0;this.position=S.ORIGIN;this.associationItem=null;this.wireCommands=new Br;this.shoveCommands=new Br;this.via=e,this.commands=new ve("select via");let r=this.via.getParent()!=null||this.via.getGroupID()!=null;this.moveTool=new Ch([this.via],r),this.position=this.via.center}onKeyDown(e){if(this.via.getParent()!=null||this.via.getGroupID()!=null){let r=this.via.getParent();r&&r instanceof Me&&(e.sceneX=r.position.x,e.sceneY=r.position.y,A.publish("showAndUpdateCross",e))}else{let{x:r,y:i}=this.node.item.center;e.sceneX=r,e.sceneY=i,A.publish("showAndUpdateCross",e)}return!1}onMouseLeftDown(e){return!1}init(){if(this.associationItem==null&&(this.associationItem=new cl([this.via],this.commands)),this.addHistory&&!(!this.associationItem.hasConnectTrack()&&!ce.pcbConfig.isPlaceViasAutoShove)){let i=pt.getTears(this.via.globalIndex);if(i&&i.size>0)for(let l of i)this.commands.addCommand(Te.dispatch(l,"delete")),qG(l);let n=this.associationItem.getAllItem(),s=Array.from(n).filter(l=>l instanceof Ge),a=Qg.getTrackFollowViaStatus();this.shoveData=J3(s,this.wireCommands,void 0,a),Jl.getInstance().init()}}fixMousePosition(e){this.moveStartPoint===null&&(this.moveStartPoint=new S(e.lastSceneX,e.lastSceneY),this.lastPosition=this.moveStartPoint,ce.pcbConfig.snapToCenterWhileDragPadOrVia&&(this.moveStartPoint=this.via.center,this.lastPosition=this.via.center));let r=new S(e.sceneX,e.sceneY);if(e.adsorbGrid){r=di.adsorpGrid(r);let i=this.via.getParent()==null&&this.via.getGroupID()==null;this.addHistory&&i&&(this.commands.addCommand(Te.dispatch(this.via,"modify")),A.publish("hasModifyPcbItem",this.via),ce.pcbConfig.snapToCenterWhileDragPadOrVia||(this.via.center=di.adsorpGrid(this.via.center)))}if(e.shiftKey){let i=r.sub(this.moveStartPoint);Math.abs(i.x)>=Math.abs(i.y)?r=new S(r.x,this.moveStartPoint.y):r=new S(this.moveStartPoint.x,r.y),this.createShiftMoveHelpLine(this.moveStartPoint,r)}else this.shiftMoveHelpLine!=null&&this.removeShiftMoveHelpLine();return r}getViaOffset(e){return Sue.bind(this,e,this.moveStartPoint)()}getTrackOffset(e){return e.sub(this.lastPosition)}undoShoveHistory(){var e,r,i;l0.needclearWireCache=!1,Iue(),(e=this.shoveCommands)==null||e.undo(),this.shoveCommands=new Br,(r=this.associationItem.getRepairToolCommand())==null||r.undo(),this.associationItem.setRepairToolCommand(new Br),(i=this.wireCommands)==null||i.undo(),this.wireCommands=new Br}setConstraintLocks(){for(let[e,r]of this.node.connectTrack)cn.lockedMap.set(e,!r)}onMouseUpMove(e){return this.via.isSelect(e.sceneX,e.sceneY)?this.changeNativeCursor(5):this.changeNativeCursor(4),!1}moveComponent(e,r){if(!e.model.getGroupID()){let i=new S(r.sceneX,r.sceneY).sub(e.position),n=Ab(),s=this.via.getParent();switch(ce.pcbConfig.moveComponent){case"push":{this.commandFactory.undo(),this.commandFactory=new ve("push component");let a=new Map;a.set(s,0),yw(s,this.commandFactory,n,a),a.clear();break}case"block":{j_(s,n);break}}this.lastPosition=s.position.add(i)}}moveVia(e){let r=this.position,{trackOffset:i,viaOffset:n}=e;if(!this.associationItem.hasConnectTrack()&&!ce.pcbConfig.isPlaceViasAutoShove){this.associationItem.setAllAssociationRatlinesVisible();let l=this.associationItem.itemConnectTrack;this.associationItem.items.forEach(c=>{!c.locked&&!l.tracks.has(c.globalIndex)&&c.transform(Ae.translate(i.x,i.y,0))}),r=r.add(this.node.item.center.sub(r))}else{this.undoShoveHistory(),this.setConstraintLocks(),Cue(n,this.node,this.wireCommands),this.associationItem.moveConnectTrack(Ae.translate(i.x,i.y,0));let l=this.node.item.center;_9(this.shoveData,this.shoveCommands,!1,this.node),this.associationItem.setAllAssociationRatlinesVisible();let c=this.node.item.center.sub(l),h=r.add(c);r=ce.pcbConfig.snapToCenterWhileDragPadOrVia?h:h.add(this.node.item.center.sub(h)),this.via.iteratorRatlines(u=>{u.startNode==this.via&&(u.start=this.node.item.center),u.endNode==this.via&&(u.end=this.node.item.center)})}return r}onMouseMove(e){if(this.via.locked)return!1;if(this.via.getParent()==null&&this.via.getGroupID()==null&&this.addHistory&&this.associationItem==null&&(this.associationItem=new cl([this.via],this.commands),this.associationItem.moveInit()),this.addHistory){this.node=_i.getInstance().getViaNode(this.via.model);let s=tr.getInstance().mode,a=!1;["WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"].includes(s)&&(a=!0),this.node.connectTrack.size==0&&a?jg("freeArc"):jg("45"),this.via.getGroupID()==null&&this.init(),sp.getInstance().highlight([this.via])}let r=this.fixMousePosition(e),i=this.getViaOffset(r);this.position=this.moveStartPoint.add(i);let n=this.getTrackOffset(this.position);if(this.lastPosition=this.position,this.via.getParent()!=null||this.via.getGroupID()!=null){this.commands=new ve("select group via"),this.moveTool.onMouseMove(e,n);let s=this.via.getParent();s&&s instanceof Me&&(this.moveComponent(s,e),e.sceneX=s.position.x,e.sceneY=s.position.y,A.publish("showAndUpdateCross",e))}else{if(this.associationItem==null&&(this.associationItem=new cl([this.via],this.commands)),this.associationItem.setUpConnectTrack(),this.addHistory){let a=this.associationItem.getAllItem();for(let l of a)l.locked||(this.commands.addCommand(Te.dispatch(l,"modify")),A.publish("hasModifyPcbItem",l))}let s=this.moveVia({trackOffset:n,viaOffset:i});e.sceneX=s.x,e.sceneY=s.y,A.publish("showAndUpdateCross",e)}return this.changeNativeCursor(5),this.addHistory&&(this.addHistory=!1),!0}onMouseLeftUp(e){this.position=this.via.center;let r=this.commands.length;return Xg(),this.associationItem!=null&&(this.associationItem.complete(this.commands),ce.pcbConfig.moveComponent=="push"&&this.via.getParent()instanceof Me&&this.moveTool.setCommand(this.commandFactory.commands)),sp.getInstance().unhighlight(),je.executeCommand(this.commands),this.commands=new ve("select via"),this.commandFactory=new ve("push component"),this.wireCommands=new Br,this.shoveCommands=new Br,r&&A.publish("hasModifyPcbItem",this.via),this.associationItem=null,this.moveTool.onMouseLeftUp(e),Q3(),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}rotate(e){let r=this.via.getParent();r!=null&&r.getGroupID()!=null&&(this.commands=new ve("select group text"),this.moveTool.rotate(e))}interrupt(){var e,r,i,n;return Xg(),sp.getInstance().unhighlight(),(e=this.commands)==null||e.undo(),ce.pcbConfig.moveComponent=="push"&&((r=this.commandFactory)==null||r.undo()),(i=this.shoveCommands)==null||i.undo(),(n=this.wireCommands)==null||n.undo(),ji.getInstance().view4Status(_r.getInstance().current),lu.getInstance().clear(),this.associationItem!=null&&(this.associationItem.interrupt(),this.associationItem=null),this.moveTool.interrupt(),this.removeShiftMoveHelpLine(),this.changeNativeCursor(4),!0}};var vDt=Math.sin(Math.PI/180),EN=class extends Dm{constructor(e,r,i,n){super(n);this.adsorb=!0;this.block=new df;let s=new _e;s.ext1(e.buildBBox()).ext1(r.buildBBox()),this.bbox=s.build1(),this.findTrack=new Bu(this.event.track,!0);let a=this.findTrack.tracks.indexOf(e),l=this.findTrack.tracks.indexOf(r);a>l&&this.findTrack.reverseResult(),this.track1=e,this.track2=r,this.angleType=i,this.event=n,this.index1=this.findTrack.tracks.indexOf(this.track1),this.index2=this.findTrack.tracks.indexOf(this.track2);let c=this.findTrack.pts[this.index1],h=this.findTrack.pts[this.index2];this.direct1=c.direct,this.direct2=h.direct,this.endDirect1=h.direct,this.endDirect2=c.direct;let u=c.direct.cross(h.direct);switch(i){case 0:{if(Math.abs(this.direct1.x)<1e-8||Math.abs(this.direct2.x)<1e-8)this.endDirect1=new S(1,0);else if(Math.abs(this.direct1.y)<1e-8||Math.abs(this.direct2.y)<1e-8)this.endDirect1=new S(0,1);else{let p=new S(-this.direct1.y,this.direct1.x);this.endDirect1=p.mul(this.direct2.dot(p)).normalize()}let d=c.direct.cross(this.endDirect1);u*d<0&&(this.endDirect1=this.endDirect1.mul(-1));break}case 1:{this.endDirect1=c.direct.add(h.direct);break}case 2:default:break}if(this.rangeEnd1=c.start(),this.rangeStart=c.end(),this.rangeEnd2=h.end(),this.angleType==0||this.angleType==1){let d=this.generateLine(c,this.bbox),p=this.generateLine(h,this.bbox),m=this.bbox.width()+this.bbox.height()+1e4,g=this.getLine(this.rangeEnd1,this.endDirect1,m),y=this.getLine(this.rangeEnd2,this.endDirect1,m),b=this.getIntersection(d,y),P=this.getIntersection(p,g);b!=null&&this.inRange(b,this.track1.start,this.track1.end)?this.rangeEnd1=b:this.rangeEnd2=P}this.blockPrev=this.block.checkIntersection(this.track1),this.blockNext=this.block.checkIntersection(this.track2),this.templine1=this.createBaseTrack(this.rangeStart,this.rangeStart,this.track1),this.templine2=this.createBaseTrack(this.rangeStart,this.rangeStart,this.track2)}generateLine(e,r){let i=r.width()+r.height()+1e3,n=e.direct.mul(i),s=e.start().sub(n),a=e.end().add(n);return new M(s,a)}move(e){if(this.adsorb&&(e=this.event.adsorb(e,Math.max(this.event.track.width/2,.1),this.event.track.layerId)),this.track1.locked||this.track2.locked)return;let r=!1;this.angleType==1&&this.event.addHistory&&(r=!0),this.recordHistory([this.track1,this.track2]),r&&this.fixRightAngleLine();let i=new _e().ext1(this.bbox).ext2(e).build1(),n=i.width()+i.height()+1e4,s=this.generateLine(this.findTrack.pts[this.index1],i),a=this.generateLine(this.findTrack.pts[this.index2],i),l=this.getLine(e,this.endDirect1,n),c=null;this.angleType==2?c=this.getLine(e,this.endDirect2,n):(this.angleType==1||this.angleType==0)&&(c=l);let h=this.getIntersection(l,s),u=this.getIntersection(c,a);if(h!=null||u!=null){let d=this.inRange(h,this.rangeEnd1,this.rangeStart),p=this.inRange(u,this.rangeStart,this.rangeEnd2),m=this.rangeStart.sub(h).normalize(),g=u.sub(this.rangeStart).normalize(),y=m.dot(this.direct1),b=g.dot(this.direct2);if(d&&!p?b>0?((this.angleType==1||this.angleType==0)&&(h=this.rangeEnd1),u=this.rangeEnd2):(h=this.rangeStart,u=this.rangeStart):!d&&p?y>0?((this.angleType==1||this.angleType==0)&&(u=this.rangeEnd2),h=this.rangeEnd1):(h=this.rangeStart,u=this.rangeStart):!d&&!p&&(y>0&&b>0?(h=this.rangeEnd1,u=this.rangeEnd2):(h=this.rangeStart,u=this.rangeStart)),this.angleType==2){l=this.getLine(h,this.endDirect1,n),c=this.getLine(u,this.endDirect2,n);let P=this.getIntersection(l,c);this.changeBaseTrack(this.templine1,h,P),this.changeBaseTrack(this.templine2,P,u)}else this.changeBaseTrack(this.templine1,h,u),this.changeBaseTrack(this.templine2,u,u);this.changeBaseTrack(this.track1,this.findTrack.pts[this.index1].start(),h),this.changeBaseTrack(this.track2,u,this.findTrack.pts[this.index2].end()),this.blockEndpoint()}}fixRightAngleLine(){let e=this.direct1,r=this.direct2,i=Math.sqrt(2)/2,n=new S(1,0),s=new S(i,i),a=new S(0,1),l=new S(-i,i),c=[n,s,a,l],h=[e,r],u=e,d=!0,p=!0;for(let C=0;C<2;C++){let E=h[C];for(let O of c){let _=O.cross(E);if(this.kit.lesseq(Math.abs(_),vDt)){u=O,d=!1,C==0?p=!0:p=!1;break}}if(!d)break}let m=this.bbox.width()+this.bbox.height()+1e4,g=new S(-u.y,u.x),y=this.findTrack.pts[this.index1],b=this.findTrack.pts[this.index2],P=this.getLine(y.start(),p?u:g,m),T=this.getLine(b.end(),p?g:u,m),I=this.getIntersection(P,T);if(I!=null){let C=new M(y.start(),I),E=new M(I,b.end());this.findTrack.pts.splice(this.index1,1,C),this.findTrack.pts.splice(this.index2,1,E),this.changeBaseTrack(this.track1,y.start(),I),this.changeBaseTrack(this.track2,I,b.end()),this.changeBaseTrack(this.templine1,I,I),this.changeBaseTrack(this.templine1,I,I),this.rangeStart=I,this.endDirect1=C.direct.add(E.direct)}}realTimePath(){let e=new Array,r=!1,i=this.getLines(this.findTrack.pts);for(let n=0,s=i.length;n<s;n++){let a=i[n];n<this.index1?e.push(a.start()):n>this.index2?e.push(a.end()):r||(e.push(this.track1.start,this.track1.end,this.templine1.end,this.templine2.end,this.track2.start,this.track2.end),r=!0)}return e}moveOffset(e){}blockEndpoint(){let e=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.adsorb=!1,this.isBlock())if((!this.blockPrev||!this.blockNext||!this.event.blockTrack)&&(this.blockPrev=this.block.checkIntersection(this.track1),this.blockNext=this.block.checkIntersection(this.track2),this.event.blockTrack=this.block.checkBaseIntersection(this.templine1)),this.block.adsorp=null,this.angleType==2){let r=this.block.blockTrack(this.track1),i=this.track1.end;if(r.distance2(i)>1e-8&&this.blockPrev)this.move(r);else{let n=this.block.blockTrack(this.track2),s=this.track2.end;if(n.distance2(s)>1e-8&&this.blockNext)this.move(n);else{let a=this.block.blockBaseTrack(this.templine1),l=this.block.blockBaseTrack(this.templine2,!1),c=a.distance2(this.templine1.end)>1e-8,h=l.distance2(this.templine2.start)>1e-8;if(c&&h){let u=a.sub(this.templine1.start),d=this.rangeStart.sub(this.templine1.start),p=l.sub(this.templine2.end),m=this.rangeStart.sub(this.templine1.end);Math.abs(u.cross(d))>Math.abs(p.cross(m))?this.move(a):this.move(l)}else c&&!h?this.move(a):!c&&h&&this.move(l)}}}else{let r=new Array;if(this.blockBaseTrack(this.block,this.track1,this.blockPrev,this.endDirect1,this.templine1,r),this.blockBaseTrack(this.block,this.track2,this.blockNext,this.endDirect1,this.templine1,r),this.blockBaseTrack(this.block,this.templine1,this.event.blockTrack,this.endDirect1,this.templine1,r),r.length>0){let i=new M(this.rangeStart,this.rangeStart.add(this.endDirect1)),s=this.event.getEnd(i,r).sub(i.start());this.moveOffset(s)}}else this.isPush()&&(this.shove(),this.track1.hidden(),this.track2.hidden(),this.templine1.hidden(),this.templine2.hidden());this.adsorb=!0,this.event.adsorpTrackSetting=e}complete(){this.shoveEvent.shoveTrackComplete(this.event)||(this.optimization(),this.mapBase2Track(),A.publish("hasModifyPcbItem",this.track1),A.publish("hasModifyPcbItem",this.track2)),this.recycleBaseTrack(),this.templine1=null,this.templine2=null,this.shoveEvent.clearCache()}optimization(){this.templine1!=null&&this.templine1.length<=this.event.track.width&&this.move(this.rangeStart),this.templine2!=null&&this.templine2.length<=this.event.track.width&&this.angleType==2&&this.move(this.rangeStart),this.track1.length!==0&&this.track1.length<=this.track1.width&&this.move(this.rangeEnd1),this.track2.length!==0&&this.track2.length<=this.track2.width&&this.move(this.rangeEnd2)}interrupt(){this.recycleBaseTrack(),this.templine1=null,this.templine2=null,this.shoveInterrupt()}getLine(e,r,i=1e4){let n=r.normalize().mul(i+r.length());return new M(e.sub(n),e.add(n))}inRange(e,r,i){return!!(this.sameDirect(e,r,i)&&this.sameDirect(e,i,r))}sameDirect(e,r,i){let n=e.sub(r).normalize(),s=i.sub(r).normalize();return n.dot(s)>=0}};var ON=class extends Dm{constructor(e){super(e);this.follow=!1;this.block=new df;this.reverse=!1;this.findTrack=new Bu(this.event.track,!0),this.findTrack.tracks.indexOf(this.event.track)!=0&&this.findTrack.reverseResult(),this.event.blockTrack=this.block.checkIntersection(this.event.track),this.next=this.createBaseTrack(this.event.track.start,this.event.track.start,this.event.track)}movePointOffset(e,r){if(r){let i=this.event.oldStart.add(e);this.modifyStart(i)}else{let i=this.event.oldEnd.add(e);this.modifyEnd(i)}}moveByIntercept(e,r,i,n){if(this.event.track.locked)return;this.visible(),this.recordHistory([this.event.track]);let s=this.event.track,a=this.next;if(e.some(l=>l.length()>1e-8)){let l=this.findTrack.tracks.indexOf(s),c=this.findTrack.pts[l],h=ir.foot(new M(c.start(),c.end()),e[0].start()),u=new bc(h,r,e).result;if(u.length){let d=u[0].end(),p=n?this.event.oldEnd:this.event.oldStart,m=d.sub(p);if(i.dot(m)>-1e-8&&Math.abs(i.cross(m))<1e-8)return n?s.start=d:s.end=d,a.start=d,a.end=u[0].end(),u.length>=2&&(a.start=d,a.end=u[1].end()),!0}}}modifyStart(e){if(this.follow||(e=this.event.adsorb(e,this.event.track.width,this.event.track.layerId)),this.event.track.locked)return;this.visible(),this.recordHistory([this.event.track]),this.findTrack.pts[0].start().equals(this.event.oldEnd)&&this.findTrack.reverseResult();let i=this.event.track.end,n=this.event.track.direct;n.x==0&&n.y==0&&(n=this.event.direct);let s=this.draw(i,e,n.mul(-1));this.event.track.start=s[1],this.changeBaseTrack(this.next,s[1],s[2]),this.blockEndPoint(!1)}modifyEnd(e){if(this.follow||(e=this.event.adsorb(e,this.event.track.width,this.event.track.layerId)),this.event.track.locked)return;this.visible(),this.recordHistory([this.event.track]),this.findTrack.pts[0].start().equals(this.event.oldStart)&&this.findTrack.reverseResult();let i=this.event.track.start,n=this.event.track.direct;n.x==0&&n.y==0&&(n=this.event.direct);let s=this.draw(i,e,n);this.event.track.end=s[1],this.changeBaseTrack(this.next,s[1],s[2]),this.blockEndPoint(!0)}move(e){}moveOffset(e){}draw(e,r,i){return new no().degree45(i,e,r)}realTimePath(){let e=this.getLines(this.findTrack.pts),r=[this.next.end,this.next.start];for(let i of e)r.push(i.end());return r}blockEndPoint(e){let r=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.isBlock()&&!this.follow){this.block.adsorp=null;let i=this.block.blockTrack(this.event.track,e),n=this.event.track.end;if(e||(n=this.event.track.start),i.distance2(n)>1e-8&&this.event.blockTrack)e?this.modifyEnd(i):this.modifyStart(i);else if(this.next!=null){let s=this.block.blockBaseTrack(this.next);s.distance2(this.next.end)>1e-8&&(e?this.modifyEnd(s):this.modifyStart(s))}}else this.isPush()&&!this.follow&&(this.shove(),this.event.track.hidden(),this.next.hidden());this.event.adsorpTrackSetting=r}complete(){this.event.clearAdsorpPoint(),this.shoveEvent.shoveTrackComplete(this.event)||(this.mapBase2Track(!0),A.publish("hasModifyPcbItem",this.event.track)),this.recycleBaseTrack(),this.next=null,this.shoveEvent.clearCache()}interrupt(){this.recycleBaseTrack(),this.next=null,this.shoveInterrupt()}};function bU(o){let t=new Jt;return o&&(t.add("MOVE_NODE"),t.add("INSERT_NODE")),t}var PU=class extends ws{constructor(e){super();this.tool=null;this.repair1=null;this.repair2=null;this.position=null;this.rightUpSelectType=null;this.addHistory=!0;this.controlPointMove=!1;this.event=new CD(e);let r=()=>e.layerId;this.commands=new ve("select Track"),this.start=this.addPoint(r,e.start),this.end=this.addPoint(r,e.end),this.canDragStart=this.event.identify.canDrag(this.event.identify.startType),this.canDragEnd=this.event.identify.canDrag(this.event.identify.endType),this.canDragPoint=this.event.track.length>this.event.track.width*1.5}get getRepair1(){return this.repair1}get getRepair2(){return this.repair2}onMouseLeftDown(e){this.currPos=e;let r=e.realSceneX,i=e.realSceneY;this.event.lastMousePosition=new S(e.sceneX,e.sceneY),this.event.lastRealMousePosition=new S(r,i);let n=!1,s=this.event.track.width;return this.controlPointMove=!1,this.canDragPoint?(this.start.isSelectWidth(r,i,s)&&(n=!0,this.controlPointMove=!0),this.end.isSelectWidth(r,i,s)&&(n=!0,this.controlPointMove=!0)):this.event.identify.startType==0?this.start.isSelectWidth(r,i,s)&&(n=!0,this.controlPointMove=!0):this.event.identify.endType==0&&this.end.isSelectWidth(r,i,s)&&(n=!0,this.controlPointMove=!0),this.addHistory=!0,this.event.addHistory=!0,this.event.track.isEmpty?!1:n}realTimeDiffPairLengthErr(){let e=this.event.track.net,r=te.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;ze.modifyNet(n),ze.modifyNet(s);let a=ze.getNetLength(n),l=ze.getNetLength(s),c=this.getIncrement(this.tool,n,s),h=this.getIncrement(this.repair1,n,s),u=this.getIncrement(this.repair2,n,s);return tr.getInstance().mode=="WIRING_MODE_PUSHAWAY"?(a=a+c[0]+h[0]+u[0],l=l+c[1]+h[1]+u[1]):this.event.track.net==n?a=a+c[2]+h[2]+u[2]:l=l+c[2]+h[2]+u[2],a-l}return 0}realTimeNetLength(){let e=this.event.track.net,r=te.getInstance().getNet(e);if(r!=null&&r.netLengthPhysics!=null){ze.modifyNet(e);let i=ze.getNetLength(e),n=this.tool==null?0:this.tool.getLengthIncrement(),s=this.repair1==null?0:this.repair1.getLengthIncrement(),a=this.repair2==null?0:this.repair2.getLengthIncrement();return i+n+s+a}return 0}getIncrement(e,r,i){if(e!=null){let n=e.shoveEvent.getNetDelta(r),s=e.shoveEvent.getNetDelta(i),a=e.getLengthIncrement();return[n,s,a]}return[0,0,0]}snapExtendedLine(e){if(!e.adsorb||!ce.adsorptionConfig.getConfig("Extended Line"))return;let r=new S(this.end.x,this.end.y),i=new S(e.realSceneX,e.realSceneY),n=new S(this.start.x,this.start.y),s=n.sub(r).angle(S.ORIGIN);di.getExtendedLinePointInfo(i,r,n,s,e)}onMouseMove(e){if(this.changeNativeCursor(5),this.event.adsorbtion=e.adsorbGrid,this.addHistory=!1,this.currPos=e,this.event.isPush()?(this.start.hidden(),this.end.hidden()):(this.start.visible(),this.end.visible()),this.start.status()&&this.end.status()){this.snapExtendedLine(e);let r=e.sceneX,i=e.sceneY,n=new S(r,i),s=this.start.getPosition().distance2(n);this.end.getPosition().distance2(n)>s?this.end.setStatus(!1):this.start.setStatus(!1)}if(this.event.numberOfIterator=0,this.start.status()&&this.canDragStart){this.snapExtendedLine(e);let r=e.sceneX,i=e.sceneY,n=new S(r,i);if([0,4,1].includes(this.event.identify.startType))this.changleMouseStyle(this.getMouseStyle(this.event.oldEnd.sub(this.event.oldStart))),this.repair1==null&&(this.repair1=new ON(this.event)),this.repair1.modifyStart(n);else{let s=this.event.identify.startNodes[0];this.repair2==null&&(this.repair2=new EN(this.event.track,s,this.event.identify.startAngleType,this.event)),this.repair2.move(n)}this.start.setPosition(this.event.track.start),this.end.setPosition(this.event.track.end)}else if(this.end.status()&&this.canDragEnd){this.snapExtendedLine(e);let r=e.sceneX,i=e.sceneY,n=new S(r,i);if([0,4,1].includes(this.event.identify.endType))this.changleMouseStyle(this.getMouseStyle(this.event.oldEnd.sub(this.event.oldStart))),this.repair1==null&&(this.repair1=new ON(this.event)),this.repair1.modifyEnd(n);else{let s=this.event.identify.endNodes[0];this.repair2==null&&(this.repair2=new EN(this.event.track,s,this.event.identify.endAngleType,this.event)),this.repair2.move(n)}this.start.setPosition(this.event.track.start),this.end.setPosition(this.event.track.end)}else{let r=e.sceneX,i=e.sceneY,n=new S(r,i);this.tool==null&&(this.tool=this.event.getTool()),this.event.numberOfIterator=0,this.tool.move(n,e),this.start.setPosition(this.event.track.start),this.end.setPosition(this.event.track.end)}return jt.updateNetLengthMsg(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength:this.realTimeNetLength(),net:this.event.track.net}),!0}onMouseUpMove(e){let r=e.realSceneX,i=e.realSceneY;return this.selectPoint(r,i),!1}onMouseLeftUp(e){return this.mouseLeftDown=!1,this.tool!=null&&(this.tool.complete(),this.tool=null),this.repair2!=null&&(this.repair2.complete(),this.repair2=null),this.repair1!=null&&(this.repair1.complete(),this.repair1=null),this.commands.length>0?(je.executeCommand(this.commands),this.commands=new ve("select Arc Track"),this.event.commands=null):this.event.commands!=null&&this.event.commands.length>0&&(je.executeCommand(this.event.commands),this.event.commands=null),(this.start.status()&&this.canDragStart||this.end.status()&&this.canDragEnd)&&A.publish("clearSelect",""),A.publish("flushService",""),this.removeShiftMoveHelpLine(),di.clearSnapFlag(),!0}interrupt(){return this.event.commands!=null&&this.event.commands.undo(),this.start.remove(),this.end.remove(),this.tool!=null&&(this.tool.interrupt(),this.tool=null),this.repair2!=null&&(this.repair2.interrupt(),this.repair2=null),this.repair1!=null&&(this.repair1.interrupt(),this.repair1=null),this.mouseLeftDown=!1,jt.cancel(),this.changleMouseStyle("default"),this.removeShiftMoveHelpLine(),di.clearSnapFlag(),!0}onMouseRightUp(e){if(this.canDragPoint){if(e.openMenu){let r=e.realSceneX,i=e.realSceneY,n=this.event.track.width,s=this.start.isSelectWidth(r,i,n),a=this.end.isSelectWidth(r,i,n);if(s||a){this.position=e,this.rightUpSelectType=s?0:1;let l=new Nu(this.event.track),c;if(s&&(l==null?void 0:l.startNodes.length)===1&&(c=l.startNodes[0]),a&&(l==null?void 0:l.endNodes.length)===1&&(c=l.endNodes[0]),(s||a)&&!(c instanceof Le))return this.rightClickMenuData(e),!0}}return!1}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:bU(!0).result};Qt.getInstance().menuData(r,this)}getTrackCenter(){return this.event.track.start.add(this.event.track.end).mul(.5)}addPoint(e,r){return new qi(e(),r)}selectPoint(e,r){if(this.start.inTop(e,r)&&this.canDragStart){this.changleMouseStyle("pointer");return}if(this.end.inTop(e,r)&&this.canDragEnd){this.changleMouseStyle("pointer");return}this.event.track.isSelect(e,r)?this.changeNativeCursor(5):this.changleMouseStyle("default")}getMouseStyle(e){let r=Math.atan2(e.y,e.x);return r>=Math.PI/8*1&&r<Math.PI/8*3||r>=-(Math.PI/8)*7&&r<-(Math.PI/8)*5?"ne-resize":r>=Math.PI/8*3&&r<Math.PI/8*5||r>=-(Math.PI/8)*5&&r<-(Math.PI/8)*3?"n-resize":r>=Math.PI/8*5&&r<Math.PI/8*7||r>=-(Math.PI/8)*3&&r<-(Math.PI/8)*1?"nw-resize":"w-resize"}parse(e){switch(e.cmdKey.split(":")[0]){case"INSERT_NODE":{A.publish("toggle",{command:"insertNode"});break}case"MOVE_NODE":let n=this.canDragStart&&this.start.status()?this.event.identify.startNodes[0]:this.event.identify.endNodes[0];A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.event.track,n],inputInfo:this.position,commands:this.event.commands,options:{track:this.event.track,selectType:this.rightUpSelectType,controlPoint:this.rightUpSelectType===0?this.start:this.end}});break}}rotate(e=ce.pcbConfig.rotate){if(this.tool==null&&(this.tool=this.event.getTool()),!this.controlPointMove&&this.tool instanceof uV){this.addHistory?(this.commands=new ve("select Track"),this.commands.addCommand(Te.dispatch(this.event.track,"modify")),this.addHistory=!1):this.event.commands.length>0&&(this.commands=this.event.commands);let r=_s([this.event.track]);if(r.valid()){let l=r.build1().center();ao.rotate(l,e,[this.event.track]),this.flushPoint()}this.event.addHistory=!1;let i=this.currPos,n=i.realSceneX,s=i.realSceneY;this.event.lastMousePosition=new S(i.sceneX,i.sceneY),this.event.lastRealMousePosition=new S(n,s),this.event.oldStart=this.event.track.start,this.event.oldEnd=this.event.track.end}}flushPoint(){this.start.setPosition(this.event.track.start),this.end.setPosition(this.event.track.end)}};var gde=class extends ws{constructor(e){super();this.tool=null;this.repair1=null;this.repair2=null;this.position=null;this.rightUpSelectType=null;this.initMove=!0;this.event=new cu(e);let r=()=>e.layerId;this.start=this.addPoint(r,e.start),this.end=this.addPoint(r,e.end),this.canDragStart=this.event.identify.canDrag(this.event.identify.startType),this.canDragEnd=this.event.identify.canDrag(this.event.identify.endType),this.canDragPoint=this.event.track.length>this.event.track.width*1.5}get getRepair1(){return this.repair1}get getRepair2(){return this.repair2}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;this.event.lastMousePosition=new S(e.sceneX,e.sceneY),this.event.lastRealMousePosition=new S(r,i);let n=!1;if(!this.event.track)return!1;jt.getToleranceTargetNet(this.event.track.net);let s=this.event.track.width;return this.canDragPoint?(this.start.isSelectWidth(r,i,s)&&(n=!0),this.end.isSelectWidth(r,i,s)&&(n=!0)):this.event.identify.startType==0?this.start.isSelectWidth(r,i,s)&&(n=!0):this.event.identify.endType==0&&this.end.isSelectWidth(r,i,s)&&(n=!0),n||(n=this.event.track.isSelect(r,i)),n}realTimeDiffPairLengthErr(){let e=this.event.track.net,r=te.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;ze.modifyNet(n),ze.modifyNet(s);let a=Ap.getNetLengthDelta(n),l=Ap.getNetLengthDelta(s);return{len_P:a,len_N:l}}return null}realTimeNetLength(){let e=this.event.track.net,r=te.getInstance().getNet(e);return r!=null&&r.netLengthPhysics!=null?(ze.modifyNet(e),Ap.getNetLengthDelta(e)):0}snapExtendedLine(e){if(!e.adsorb||!ce.adsorptionConfig.getConfig("Extended Line"))return;let r=new S(this.end.x,this.end.y),i=new S(e.realSceneX,e.realSceneY),n=new S(this.start.x,this.start.y),s=n.sub(r).angle(S.ORIGIN);di.getExtendedLinePointInfo(i,r,n,s,e)}onMouseMove(e){this.changeNativeCursor(5),this.event.adsorbtion=e.adsorbGrid;let r=Ss.getInstance();if(this.event.isPush()?(this.start.hidden(),this.end.hidden()):(this.start.visible(),this.end.visible()),this.initMove&&(ze.dragHighlightNets([this.event.track.net]),this.event.track.manualHighLight=!0,this.initMove=!1),this.start.status()&&this.end.status()){this.snapExtendedLine(e);let i=e.sceneX,n=e.sceneY,s=new S(i,n),a=this.start.getPosition().distance2(s);this.end.getPosition().distance2(s)>a?this.end.setStatus(!1):this.start.setStatus(!1)}if(this.start.status()&&this.canDragStart){let i=this.event,n,s=i.adsorb(new S(e.realSceneX,e.realSceneY),i.track.width,i.track.layerId,!0);if(s)n=s;else{this.snapExtendedLine(e);let a=e.sceneX,l=e.sceneY;n=new S(a,l)}[0,4,1].includes(this.event.identify.startType)||this.event.needModifyRepair1(this.event.identify.startType,this.event.identify.startNodes[0])?(this.changleMouseStyle(this.getMouseStyle(this.event.oldEnd.sub(this.event.oldStart))),this.repair1==null&&(this.repair1=this.event.getRepairEndTool()),this.repair1.modifyPoint(n,!0)):(this.repair2==null&&(this.repair2=this.event.getLineTool(this.event.identify.startAngleType,!0)),this.repair2.move(n)),this.flushPoint()}else if(this.end.status()&&this.canDragEnd){let i=this.event,n,s=i.adsorb(new S(e.realSceneX,e.realSceneY),i.track.width,i.track.layerId,!0);if(s)n=s;else{this.snapExtendedLine(e);let a=e.sceneX,l=e.sceneY;n=new S(a,l)}[0,4,1].includes(this.event.identify.endType)||this.event.needModifyRepair1(this.event.identify.endType,this.event.identify.endNodes[0])?(this.changleMouseStyle(this.getMouseStyle(this.event.oldEnd.sub(this.event.oldStart))),this.repair1==null&&(this.repair1=this.event.getRepairEndTool()),this.repair1.modifyPoint(n,!1)):(this.repair2==null&&(this.repair2=this.event.getLineTool(this.event.identify.endAngleType,!1)),this.repair2.move(n)),this.flushPoint()}else{let i=e.sceneX,n=e.sceneY,s=new S(i,n);this.tool==null&&(this.tool=this.event.getTool()),this.tool.move(s,e),this.flushPoint()}return jt.updateNetLengthMsg2(e,{diffPairLength:r.showDiffLength?this.realTimeDiffPairLengthErr():null,netLength:r.showNetLength?this.realTimeNetLength():null,net:this.event.track.net}),!0}onMouseUpMove(e){let r=e.realSceneX,i=e.realSceneY;return this.selectPoint(r,i),!1}onMouseLeftUp(e){this.mouseLeftDown=!1;let r=!1;if(this.initMove=!0,this.event.track.manualHighLight=!1,ze.dragUnhighlightNet(),!ji.getInstance().checkTrackIsCanEdit())return this.interrupt(),!0;this.tool!=null&&(r=!0,this.tool.complete(),this.tool=null),this.repair2!=null&&(r=!0,this.repair2.complete(),this.repair2=null),this.repair1!=null&&(r=!0,this.repair1.complete(),this.repair1=null);let n=new ve("");return this.event.complete(n),r&&(cu.complete2(n),cu.clear()),n.commands.length>0&&(je.executeCommand(n),this.event.commands=null),(this.start.status()&&this.canDragStart||this.end.status()&&this.canDragEnd)&&A.publish("clearSelect",""),A.publish("flushService",""),this.removeShiftMoveHelpLine(),di.clearSnapFlag(),!0}interrupt(){let e=!1;return this.initMove=!0,this.event.track.manualHighLight=!1,ze.dragUnhighlightNet(),this.start.remove(),this.end.remove(),this.tool!=null&&(this.tool.interrupt(),this.tool=null,e=!0),this.repair2!=null&&(this.repair2.interrupt(),this.repair2=null,e=!0),this.repair1!=null&&(this.repair1.interrupt(),this.repair1=null,e=!0),this.event.interrupt(),e&&cu.clear(),this.mouseLeftDown=!1,jt.cancel(),this.changleMouseStyle("default"),this.removeShiftMoveHelpLine(),di.clearSnapFlag(),!0}onMouseRightUp(e){if(this.canDragPoint){if(e.openMenu){let r=e.realSceneX,i=e.realSceneY,n=this.event.track.width,s=this.start.isSelectWidth(r,i,n),a=this.end.isSelectWidth(r,i,n);if(s||a){this.position=e,this.rightUpSelectType=s?0:1;let l=new Nu(this.event.track),c;if(s&&(l==null?void 0:l.startNodes.length)===1&&(c=l.startNodes[0]),a&&(l==null?void 0:l.endNodes.length)===1&&(c=l.endNodes[0]),(s||a)&&!(c instanceof Le))return this.rightClickMenuData(e),!0}}return!1}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:bU(!0).result};Qt.getInstance().menuData(r,this)}addPoint(e,r){return new qi(e(),r)}selectPoint(e,r){if(this.start.inTop(e,r)&&this.canDragStart){this.changleMouseStyle("pointer");return}if(this.end.inTop(e,r)&&this.canDragEnd){this.changleMouseStyle("pointer");return}this.event.track.isSelect(e,r)?this.changeNativeCursor(5):this.changleMouseStyle("default")}getMouseStyle(e){let r=Math.atan2(e.y,e.x);return r>=Math.PI/8*1&&r<Math.PI/8*3||r>=-(Math.PI/8)*7&&r<-(Math.PI/8)*5?"ne-resize":r>=Math.PI/8*3&&r<Math.PI/8*5||r>=-(Math.PI/8)*5&&r<-(Math.PI/8)*3?"n-resize":r>=Math.PI/8*5&&r<Math.PI/8*7||r>=-(Math.PI/8)*3&&r<-(Math.PI/8)*1?"nw-resize":"w-resize"}parse(e){switch(e.cmdKey.split(":")[0]){case"INSERT_NODE":{A.publish("toggle",{command:"insertNode"});break}case"MOVE_NODE":let n=this.canDragStart&&this.start.status()?this.event.identify.startNodes[0]:this.event.identify.endNodes[0];A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.event.track,n],inputInfo:this.position,commands:this.event.commands,options:{track:this.event.track,selectType:this.rightUpSelectType,controlPoint:this.rightUpSelectType===0?this.start:this.end}});break}}rotate(e=ce.pcbConfig.rotate){this.tool.rotate(e),this.flushPoint()}flushPoint(){this.start.setPosition(this.event.start),this.end.setPosition(this.event.end)}};var Rw=class{constructor(t){this.shoveEvent=new tD;this.event=t}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}getLine(t,e){let r=e.sub(t),i=r.normalize().mul(1e3+r.length());return new M(t.sub(i),t.add(i))}getIntersection(t,e){return Tt(t,e)>0?new S(Ee[0],Ee[1]):null}getNewTrackEnd(t,e,r,i){i||(e=e.mul(-1));let n=r.sub(t),s=this.getNormalOffset(e,n);return t.add(s.add(e.mul(s.length())))}createTrack(t,e,r){return pr.addTrack(r.layerId,t,e,r.width,!1,r.net)}lock(){return!1}isBlock(){return this.event.isBlock()}isPush(){return this.event.isPush()}};var yde=class extends Rw{getLengthIncrement(){return 0}constructor(t){super(t),this.event.commands=new ve("repair line - drag single arcTrack"),this.start=this.event.oldStart,this.end=this.event.oldEnd}move(t){if(this.lock())return;t=this.event.adsorpTrack(t,this.event.track.width,this.event.track.layerId,new Set([this.event.track]));let e=t.sub(this.event.track.start);this.moveOffset(e)}moveOffset(t){this.event.addHistory&&(this.event.commands.addCommand(Te.dispatch(this.event.track,"modify")),this.event.addHistory=!1);let e=Ae.translate(t.x,t.y,0);this.event.track.transform(e)}complete(){this.event.commands!=null&&this.event.commands.length>0&&A.publish("hasModifyPcbItem",this.event.track)}interrupt(){}};var bde=class extends Rw{constructor(e,r,i,n,s){super(e);this.block=new df;this.prev=r,this.next=i,this.angle=this.event.track.angle,this.prevDirect=this.event.optimizationDirect(r.end.sub(r.start).normalize()),this.nextDirect=this.event.optimizationDirect(i.end.sub(i.start).normalize());let a=this.prevDirect.mul(1e3+r.length);this.prevLine=new M(r.start.sub(a),r.start.add(a));let l=this.nextDirect.mul(1e3+i.length);this.nextLine=new M(i.start.sub(l),i.start.add(l)),this.prevConnect=n,this.nextConnect=s,this.event.commands=new ve("repair arc - connnect Track"),this.blockPrev=this.block.checkIntersection(this.prev),this.blockNext=this.block.checkIntersection(this.next),this.event.blockTrack=this.block.checkIntersection(this.event.track),this.arcTrans=new ro}getLengthIncrement(){return 0}move(e){if(this.lock())return;e=this.event.adsorpTrack(e,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.prev,this.next]));let r=e.sub(this.event.track.start);this.moveOffset(r)}moveOffset(e){this.event.addHistory&&(this.event.commands.addCommand(Te.dispatch(this.event.track,"modify")),this.event.commands.addCommand(Te.dispatch(this.prev,"modify")),this.event.commands.addCommand(Te.dispatch(this.next,"modify")),this.event.addHistory=!1);let r=this.getNormalOffset(this.event.direct,e),i=this.event.track.start.add(r),n=this.getLine(i,i.add(this.event.direct)),s=this.getIntersection(n,this.prevLine),a=this.getIntersection(n,this.nextLine);if(s!=null&&a!=null){if(this.event.optimizationDirect(a.sub(s).normalize()).dot(this.event.direct)<=0){let c=this.getIntersection(this.prevLine,this.nextLine);s=c,a=c}if(s!=null&&a!=null){if(this.getNewDirect(this.prevConnect,s,this.prev).dot(this.prevDirect)<=0){let u=this.getPoint(this.prevConnect,this.prev);n=this.getLine(u.add(this.event.direct),u),s=u,a=this.getIntersection(n,this.nextLine)}if(this.getNewDirect(this.nextConnect,a,this.next).dot(this.nextDirect)<=0){let u=this.getPoint(this.nextConnect,this.next);n=this.getLine(u.add(this.event.direct),u),s=this.getIntersection(n,this.prevLine),a=u}s!=null&&a!=null&&(this.modify(this.prevConnect,s,this.prev),this.modify(this.nextConnect,a,this.next),this.modifyArc(s,a))}}this.blockTrack()}modifyArc(e,r){let i=this.event.track,{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=this.arcTrans.pointToAngle(e,r,this.angle);i.center=n,i.radius=s,i.startAngle=a,i.endAngle=l,i.sweep=c}blockTrack(){}complete(){this.event.commands!=null&&this.event.commands.length>0&&(this.optimization(),this.event.track.start.equals(this.event.track.end)?(this.event.commands.addCommand(Te.dispatch(this.event.track,"delete")),this.event.track.remove(),A.publish("delete",this.event.track)):A.publish("hasModifyPcbItem",this.event.track),this.event.commands.addCommand(Te.dispatch(this.prev,"modify")),A.publish("hasModifyPcbItem",this.prev),this.event.commands.addCommand(Te.dispatch(this.next,"modify")),A.publish("hasModifyPcbItem",this.next))}optimization(){if(this.event.track.length<=.01){let e=this.getIntersection(this.prevLine,this.nextLine);e!=null&&this.move(e)}else{let e=this.event.adsorpTrack(this.event.track.start,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.prev,this.next]));e.distance2(this.event.track.start)>1e-8&&this.move(e);let r=this.event.adsorpTrack(this.event.track.end,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.prev,this.next]));r.distance2(this.event.track.end)>1e-8&&this.move(r)}if(this.prev.length<=.01){let e=this.getPoint(this.prevConnect,this.prev);this.move(e)}if(this.next.length<=.01){let e=this.getPoint(this.nextConnect,this.next);this.move(e)}}interrupt(){}getNewDirect(e,r,i){switch(e){case 2:case 0:return this.event.optimizationDirect(i.end.sub(r).normalize());case 3:case 1:return this.event.optimizationDirect(r.sub(i.start).normalize())}}getCheckEnd(e,r){switch(e){case 2:case 0:return!1;case 3:case 1:return!0}}getBlockEnd(e,r){switch(e){case 2:case 0:return r.start;case 3:case 1:return r.end}}getPoint(e,r){switch(e){case 2:case 0:return r.end;case 3:case 1:return r.start}}modify(e,r,i){switch(e){case 2:case 0:i.start=r;break;case 3:case 1:i.end=r;break}}};var M$=class extends Rw{constructor(e,r,i,n){super(e);this.newLine=null;this.block=new df;this.track=r,this.angle=e.track.angle,this.arcTrans=new ro,this.direct=this.event.optimizationDirect(r.end.sub(r.start).normalize());let s=n.sub(this.event.track.center).normalize();this.direct1=new S(s.y,-s.x);let a=s.cross(this.direct1);i==0||i==1?this.event.track.sweep==le.CCW&&a>=0?this.direct1=new S(-s.y,s.x):this.event.track.sweep==le.CW&&a<=0&&(this.direct1=new S(-s.y,s.x)):this.event.track.sweep==le.CW&&a>=0?this.direct1=new S(-s.y,s.x):this.event.track.sweep==le.CCW&&a<=0&&(this.direct1=new S(-s.y,s.x));let l=this.direct.mul(1e3+r.length),c=this.direct1.mul(1e3+r.length);this.event.startTangent?(this.prevLine=new M(r.start.sub(l),r.start.add(l)),this.nextLine=new M(n.sub(c),n.add(c))):(this.prevLine=new M(n.sub(c),n.add(c)),this.nextLine=new M(r.start.sub(l),r.start.add(l))),this.line=new M(r.start.sub(c),r.start.add(c)),this.connect=i,this.center=n,this.event.commands=new ve("repair arc - connnect Track and other"),this.blockPrev=this.block.checkIntersection(this.track),this.event.blockTrack=this.block.checkIntersection(this.event.track)}getLengthIncrement(){return this.newLine!=null?this.newLine.length:0}move(e){if(this.lock())return;let r=e.sub(this.event.track.start);this.moveOffset(r)}moveOffset(e){this.event.addHistory&&(this.event.commands.addCommand(Te.dispatch(this.event.track,"modify")),this.event.commands.addCommand(Te.dispatch(this.track,"modify")),this.event.addHistory=!1);let r=this.getNormalOffset(this.event.direct,e);if(r!=null){let i=this.event.track.start.add(r),n=this.getLine(i,i.add(this.event.direct)),s=this.getIntersection(n,this.prevLine),a=this.getIntersection(n,this.nextLine);if(s!=null&&a!=null){if(this.event.optimizationDirect(a.sub(s).normalize()).dot(this.event.direct)<=0){let c=this.getIntersection(this.prevLine,this.nextLine);s=c,a=c}if(s!=null&&a!=null)if(this.event.startTangent){if(this.getNewDirect(this.connect,s,this.track).dot(this.direct)<=0){let u=this.getPoint2(this.connect,this.track);n=this.getLine(u.add(this.event.direct),u),s=u,a=this.getIntersection(n,this.nextLine)}if(this.event.optimizationDirect(a.sub(this.center).normalize()).dot(this.direct1)<=0){let u=this.center;n=this.getLine(u.add(this.event.direct),u),s=this.getIntersection(n,this.prevLine),a=u}}else{if(this.getNewDirect(this.connect,a,this.track).dot(this.direct)<=0){let u=this.getPoint2(this.connect,this.track);n=this.getLine(u.add(this.event.direct),u),a=u,s=this.getIntersection(n,this.prevLine)}if(this.event.optimizationDirect(s.sub(this.center).normalize()).dot(this.direct1)<=0){let u=this.center;n=this.getLine(u.add(this.event.direct),u),a=this.getIntersection(n,this.nextLine),s=u}}s!=null&&a!=null&&(this.modifyArc(s,a),this.event.startTangent?(this.modify(this.connect,s,this.track),this.updateLine(this.center,a,this.event.track)):(this.modify(this.connect,a,this.track),this.updateLine(this.center,s,this.event.track)))}}}modifyArc(e,r){let i=this.event.track,{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=this.arcTrans.pointToAngle(e,r,this.angle);i.center=n,i.radius=s,i.startAngle=a,i.endAngle=l,i.sweep=c}blockTrack(){}complete(){if(this.event.commands!=null&&this.newLine!=null&&(this.optimization(),this.event.commands!=null&&this.newLine!=null)){let e=this.createTrack(this.newLine.start,this.newLine.end,this.event.track);this.event.commands.addCommand(Te.dispatch(e,"add")),A.publish("hasModifyPcbItem",e),A.publish("hasModifyPcbItem",this.track),this.event.track.start.equals(this.event.track.end)?(this.event.commands.addCommand(Te.dispatch(this.event.track,"delete")),this.event.track.remove(),A.publish("delete",this.event.track)):A.publish("hasModifyPcbItem",this.event.track),this.newLine.remove(),this.newLine=null}}optimization(){if(this.event.track.length<=this.event.track.width&&this.event.track.length<1){let e=this.getPoint(),r=this.getLine(e,e.add(this.direct)),i=this.getNewTrackEnd(this.center,this.event.direct,this.event.track.start,!0),n=this.getLine(this.center,i);i=this.getIntersection(r,n),i!=null&&(i=this.event.adsorpTrack(i,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.track])),this.move(i))}else{let e=this.event.adsorpTrack(this.event.track.start,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.track]));e.distance2(this.event.track.start)>1e-8&&this.move(e);let r=this.event.adsorpTrack(this.event.track.end,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.track]));r.distance2(this.event.track.end)>1e-8&&this.move(r)}if(this.track.length<=this.track.width){let e=this.event.adsorpTrack(this.getPoint(),this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.track]));this.move(e)}if(this.newLine!=null&&this.newLine.length<=this.event.track.width&&this.event.track.length<1){let e=this.event.adsorpTrack(this.center,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.track]));this.move(e)}}interrupt(){this.newLine!=null&&(this.newLine.remove(),this.newLine=null)}updateLine(e,r,i){this.newLine!=null?e.equals(r)?(this.newLine.remove(),this.newLine=null):(this.newLine.start=e,this.newLine.end=r):this.newLine=$d.build(i.layerId,e,r,i.width,i.net)}getPoint(){switch(this.connect){case 2:case 0:return this.track.end;case 3:case 1:return this.track.start}}modify(e,r,i){switch(e){case 2:case 0:i.start=r;break;case 3:case 1:i.end=r;break}}getNewDirect(e,r,i){switch(e){case 2:case 0:return this.event.optimizationDirect(i.end.sub(r).normalize());case 3:case 1:return this.event.optimizationDirect(r.sub(i.start).normalize())}}getPoint2(e,r){switch(e){case 2:case 0:return r.end;case 3:case 1:return r.start}}};var Pde=class{constructor(t){this.commands=null;this.addHistory=!0;this.identify=null;this.track=null;this.direct=null;this.adsorbtion=!1;this.point=null;this.blockTrack=!0;this.resultTrack=null;this.isCoSelect=!1;this.isMultiRepair=!1;this.startTangent=!1;this.endTangent=!1;this.track=t,this.oldStart=t.start,this.oldEnd=t.end,this.direct=this.optimizationDirect(this.oldEnd.sub(this.oldStart).normalize()),this.identify=new Nu(t),this.arc=this.track.primitive,this.isCoSelect=this.isCoSelect,this.startTangent=this.identify.startTangent,this.endTangent=this.identify.endTangent,this.commands=null,this.lastMousePosition=t.start,jt.getToleranceTargetNet(this.track.net)}get coSelect(){return this.isCoSelect}set coSelect(t){this.isCoSelect=t}getTool(){let t=this.identify.startType,e=this.identify.endType;if(this.startTangent){let r=this.identify.startNodes[0],i=this.identify.endNodes[0];return this.endTangent?new bde(this,r,i,this.getConnect(!0,t),this.getConnect(!1,e)):new M$(this,r,this.getConnect(!0,t),this.oldEnd)}else if(this.endTangent){let r=this.identify.endNodes[0];return new M$(this,r,this.getConnect(!1,e),this.oldStart)}else return new yde(this)}setMultiRepair(t){this.isMultiRepair=t}isBlock(){return this.isMultiRepair?!1:tr.getInstance().mode=="WIRING_MODE_SURROUND"}isPush(){return this.isMultiRepair?!1:tr.getInstance().mode=="WIRING_MODE_PUSHAWAY"}optimizationDirect(t){let e;Math.abs(t.x)<1e-8?e=0:e=t.x;let r;return Math.abs(t.y)<1e-8?r=0:r=t.y,new S(e,r)}getConnect(t,e){return t?e==5?0:1:e==5?2:3}adsorb(t,e,r){this.clearAdsorpPoint();let i=new _e().ext2(t).ext7(e).build1(),n=Vt.search(i,(l,c)=>(c=="ArcTrack"||c=="Track")&&l==r||c=="Pad"&&(l==12||l==r)||c=="Via");n.setFilter(new a0(t.x,t.y)).setFilter(new vd);let s=new $1;n.setAction(s),n.doAction(["Track","ArcTrack","Pad","Via"]);let a=new Array;for(let l of s.pads)if(l.net==this.track.net)return this.showAdsorpPoint(l.center),l.center;for(let l of s.vias)if(l.net==this.track.net)return this.showAdsorpPoint(l.center),l.center;for(let l of s.tracks)l!=this.track&&a.push(l);return a.length>0?di.adsorpTrack(t,a[0]):t}showAdsorpPoint(t){this.point=new qi(1002,t),setTimeout(()=>{this.point!=null&&(this.point.remove(),this.point=null)},2e3)}clearAdsorpPoint(){this.point!=null&&(this.point.remove(),this.point=null)}adsorpTrack(t,e,r,i){let n=new _e().ext2(t).ext7(e).build1(),s=Vt.search(n,(l,c)=>l==r&&(c=="Track"||c=="ArcTrack")),a=new Array;for(let l of s.getTracks())!i.has(l)&&l.isSelect(t.x,t.y)&&l.isVisible&&l.layerId==r&&a.push(l);return a.length>0?di.adsorpTrack(t,a[0]):t}getEnd(t,e){let r=Number.MAX_VALUE;return e[0]}};var Tde=class extends ws{constructor(e){super();this.addHistory=!0;this.arcTransition=new ro;this.tool=null;this.controlPointMove=!1;this.startTangent=!1;this.endTangent=!1;this.position=null;this.rightUpSelectType=null;this.arc=e,this.event=new Pde(e),this.commands=new ve("select Arc Track");let r=this.arc.layerId;this.start=new qi(r,this.arc.start),this.mid=new qi(r,this.arc.midPoint),this.end=new qi(r,this.arc.end),this.moveTool=new Ch([this.arc]),this.startTangent=this.event.identify.startTangent,this.endTangent=this.event.identify.endTangent}onMouseLeftDown(e){let r=e.sceneX,i=e.sceneY;return this.controlPointMove=!1,this.mouseLeftDown=!0,this.start.isSelect(r,i)&&(this.controlPointMove=!0),this.mid.isSelect(r,i)&&(this.controlPointMove=!0),this.end.isSelect(r,i)&&(this.controlPointMove=!0),this.controlPointMove}onMouseMove(e){if(this.arc.locked)return!1;this.changeNativeCursor(5);let r=new S(e.sceneX,e.sceneY);if(this.start.status()){if(this.addHistory&&(this.commands.addCommand(Te.dispatch(this.arc,"modify")),this.addHistory=!1),this.changleMouseStyle("pointer"),this.arc.arcType===2){let i=r.angle(this.arc.center);this.arc.startAngle=i,this.start.setPosition(this.arc.start),this.mid.setPosition(this.arc.midPoint)}else{let i=this.getTangent(this.arc.end).mul(-1),{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=this.moveEndpoint(i,this.arc.end,r,!1);this.arc.center=n,this.arc.radius=s,this.arc.startAngle=l,this.arc.endAngle=a,this.arc.sweep=c==le.CCW?le.CW:le.CCW,this.start.setPosition(this.arc.start),this.mid.setPosition(this.arc.midPoint)}this.handleArcConnect(this.event.identify.startNodes[0],this.arc.start,this.event.identify.startType)}else if(this.end.status()){if(this.addHistory&&(this.commands.addCommand(Te.dispatch(this.arc,"modify")),this.addHistory=!1),this.changleMouseStyle("pointer"),this.arc.arcType===2){let i=r.angle(this.arc.center);this.arc.endAngle=i,this.end.setPosition(this.arc.end),this.mid.setPosition(this.arc.midPoint)}else{let i=this.getTangent(this.arc.start),{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=this.moveEndpoint(i,this.arc.start,r);this.arc.center=n,this.arc.radius=s,this.arc.startAngle=a,this.arc.endAngle=l,this.arc.sweep=c,this.end.setPosition(this.arc.end),this.mid.setPosition(this.arc.midPoint)}this.handleArcConnect(this.event.identify.endNodes[0],this.arc.end,this.event.identify.endType)}else if(this.mid.status()){if(this.addHistory&&(this.commands.addCommand(Te.dispatch(this.arc,"modify")),this.addHistory=!1),this.changleMouseStyle("pointer"),this.event.startTangent||this.event.endTangent)this.stretchingHandle(e);else if(Math.abs(this.arc.start.sub(r).cross(this.arc.end.sub(r)))>1e-8){let{center:i,radius:n,startAngle:s,endAngle:a,sweep:l}=this.arcTransition.point2Angle(this.arc.start,this.arc.end,r);this.arc.center=i,this.arc.radius=n,this.arc.startAngle=s,this.arc.endAngle=a,this.arc.sweep=l,this.mid.setPosition(this.arc.midPoint)}}else this.stretchingHandle(e);return jt.updateNetLengthMsg(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength:this.realTimeNetLength(),net:this.event.track.net}),!0}handleArcConnect(e,r,i){switch(i){case 7:case 5:this.commands.addCommand(Te.dispatch(e,"modify")),e.start=r;break;case 8:case 6:this.commands.addCommand(Te.dispatch(e,"modify")),e.end=r;break}}stretchingHandle(e){this.tool==null&&(this.tool=this.event.getTool());let r=new S(e.realSceneDeltaX,e.realSceneDeltay);this.tool.moveOffset(r),this.flushPoint()}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.selectPoint(r,i),!1}selectPoint(e,r){let i=!1;this.start.inTop(e,r)&&(i=!0),this.mid.inTop(e,r)&&(i=!0),this.end.inTop(e,r)&&(i=!0),i?this.changleMouseStyle("pointer"):this.event.track.isSelect(e,r)?this.changeNativeCursor(5):this.changleMouseStyle("default")}realTimeDiffPairLengthErr(){let e=this.event.track.net,r=te.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;ze.modifyNet(n),ze.modifyNet(s);let a=ze.getNetLength(n),l=ze.getNetLength(s),c=this.getIncrement(this.tool,n,s);return tr.getInstance().mode=="WIRING_MODE_PUSHAWAY"?(a=a+c[0],l=l+c[1]):this.event.track.net==n?a=a+c[2]:l=l+c[2],a-l}return 0}realTimeNetLength(){let e=this.event.track.net,r=te.getInstance().getNet(e);if(r!=null&&r.netLengthPhysics!=null){ze.modifyNet(e);let i=ze.getNetLength(e),n=this.tool==null?0:this.tool.getLengthIncrement();return i+n}return 0}getIncrement(e,r,i){if(e!=null){let n=e.shoveEvent.getNetDelta(r),s=e.shoveEvent.getNetDelta(i),a=e.getLengthIncrement();return[n,s,a]}return[0,0,0]}flushPoint(){this.start.setPosition(this.arc.start),this.mid.setPosition(this.arc.midPoint),this.end.setPosition(this.arc.end)}onMouseLeftUp(e){return this.mouseLeftDown=!1,this.tool!=null&&(this.tool.complete(),this.tool=null),this.commands.length>0&&(je.executeCommand(this.commands),this.commands=new ve("select Arc Track"),A.publish("hasModifyPcbItem",this.arc)),this.event.commands!=null&&this.event.commands.length>0&&(je.executeCommand(this.event.commands),this.event.commands=null),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}onMouseRightUp(e){if(e.openMenu){let r=e.realSceneX,i=e.realSceneY,n=this.event.track.width,s=this.start.isSelectWidth(r,i,n),a=this.end.isSelectWidth(r,i,n);if(s||a){this.position=e,this.rightUpSelectType=s?0:1;let l=new Nu(this.event.track);if(s&&(l==null?void 0:l.startNodes.length)==1||a&&(l==null?void 0:l.endNodes.length)==1)return this.rightClickMenuData(e),!0}}return!1}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:bU(!0).result};Qt.getInstance().menuData(r,this)}interrupt(){return this.commands!=null&&this.commands.undo(),this.start.remove(),this.mid.remove(),this.end.remove(),this.moveTool.interrupt(),this.changleMouseStyle("default"),this.event.commands!=null&&this.event.commands.undo(),this.tool!=null&&(this.tool.interrupt(),this.tool=null),this.mouseLeftDown=!1,jt.cancel(),!0}moveEndpoint(e,r,i,n=!0){return this.arcTransition.tangentToArc(e,r,i,n)}getDirect(e){return this.arc.sweep==le.CCW?new S(-e.y,e.x):new S(e.y,-e.x)}getTangent(e){let r=e.sub(this.arc.center).normalize();return this.getDirect(r)}rotate(e=ce.pcbConfig.rotate){if(!this.controlPointMove){let r=this.arc.getParent();if(r!=null&&r.getGroupID()!=null)this.commands=new ve("select Arc Track"),this.moveTool.rotate(e);else{this.addHistory&&(this.commands=new ve("select Arc Track"),this.commands.addCommand(Te.dispatch(this.arc,"modify")),this.addHistory=!1);let i=_s([this.arc]);if(i.valid()){let s=i.build1().center();ao.rotate(s,e,[this.arc]),this.flushPoint()}}}}parse(e){switch(e.cmdKey.split(":")[0]){case"MOVE_NODE":let n=this.start.status()&&(this.event.identify.startType==0||this.event.identify.startType==4)?this.event.identify.startNodes[0]:this.event.identify.endNodes[0];A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.event.track,n],inputInfo:this.position,commands:this.event.commands,options:{track:this.event.track,selectType:this.rightUpSelectType,controlPoint:this.rightUpSelectType===0?this.start:this.end,midPoint:this.mid}});break}}};var Ide=class extends ws{constructor(e){super();this.tool=null;this.modifyEndTool=null;this.controlPointMove=!1;this.initMove=!0;this.event=new TC(e);let r=e.layerId;this.start=new qi(r,e.start),this.mid=new qi(r,e.midPoint),this.end=new qi(r,e.end)}onMouseLeftDown(e){this.event.lastMousePosition=new S(e.sceneX,e.sceneY);let r=e.sceneX,i=e.sceneY;return this.controlPointMove=!1,this.mouseLeftDown=!0,jt.getToleranceTargetNet(this.event.track.net),this.start.isSelect(r,i)&&(this.controlPointMove=!0),this.mid.isSelect(r,i)&&(this.controlPointMove=!0),this.end.isSelect(r,i)&&(this.controlPointMove=!0),this.controlPointMove}onMouseMove(e){this.initMove&&(sp.getInstance().highlight([this.event.track]),this.initMove=!1),this.changeNativeCursor(5);let r=new S(e.sceneX,e.sceneY);return this.start.status()?(this.changleMouseStyle("pointer"),this.modifyEndTool||(this.modifyEndTool=this.event.getEndTool(0)),this.modifyEndTool.move(r),this.flushPoint()):this.end.status()?(this.changleMouseStyle("pointer"),this.modifyEndTool||(this.modifyEndTool=this.event.getEndTool(2)),this.modifyEndTool.move(r),this.flushPoint()):this.mid.status()?(this.changleMouseStyle("pointer"),this.event.startTangent||this.event.endTangent?this.stretchingHandle(e):Math.abs(this.event.start.sub(r).cross(this.event.end.sub(r)))>1e-8&&(this.modifyEndTool||(this.modifyEndTool=this.event.getEndTool(1)),this.modifyEndTool.move(r),this.flushPoint())):this.stretchingHandle(e),jt.updateNetLengthMsg2(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength:this.realTimeNetLength(),net:this.event.track.net}),!0}stretchingHandle(e){this.tool==null&&(this.tool=this.event.getTool());let r=new S(e.sceneX,e.sceneY);this.tool.move(r),this.flushPoint()}onMouseLeftUp(e){var r,i;if(this.mouseLeftDown=!1,sp.getInstance().unhighlight(),this.initMove=!0,this.tool!=null||this.modifyEndTool!=null){(r=this.tool)==null||r.complete(),(i=this.modifyEndTool)==null||i.complete(),this.tool=null,this.modifyEndTool=null;let n=new ve("repair Arc track");this.event.complete(n);let s=TC.complete2(n),a=this.event.resultId,l=s[a];if(l){let h=new er().getItem(l);A.publish("select",[h])}n.commands.length>0&&je.executeCommand(n),TC.clear()}return A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.selectPoint(r,i),!1}selectPoint(e,r){let i=!1;this.start.inTop(e,r)&&(i=!0),this.mid.inTop(e,r)&&(i=!0),this.end.inTop(e,r)&&(i=!0),i?this.changleMouseStyle("pointer"):this.event.track.isSelect(e,r)?this.changeNativeCursor(5):this.changleMouseStyle("default")}realTimeDiffPairLengthErr(){let e=this.event.track.net,r=te.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;ze.modifyNet(n),ze.modifyNet(s);let a=Ap.getNetLengthDelta(n),l=Ap.getNetLengthDelta(s);return{len_P:a,len_N:l}}return null}realTimeNetLength(){let e=this.event.track.net,r=te.getInstance().getNet(e);return r!=null&&r.netLengthPhysics!=null?(ze.modifyNet(e),Ap.getNetLengthDelta(e)):0}flushPoint(){this.start.setPosition(this.event.start),this.mid.setPosition(this.event.midPoint),this.end.setPosition(this.event.end)}interrupt(){var e,r;return sp.getInstance().unhighlight(),this.initMove=!0,this.start.remove(),this.mid.remove(),this.end.remove(),this.changleMouseStyle("default"),(this.tool!=null||this.modifyEndTool!=null)&&((e=this.tool)==null||e.interrupt(),(r=this.modifyEndTool)==null||r.interrupt(),this.tool=null,this.modifyEndTool=null,this.event.interrupt(),TC.clear()),this.mouseLeftDown=!1,jt.cancel(),!0}rotate(){this.tool&&(this.tool.rotate(),this.flushPoint())}};var Cde=class extends ws{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.dimension=e,this.commands=new ve("select dimension");let r=this.dimension.layerId;this.start=new qi(r,e.start),this.end=new qi(r,e.end),this.left=new qi(r,e.left),this.right=new qi(r,e.right),this.moveTool=new Ch([this.dimension]);let i=_s([this.dimension]);if(i.valid()){let n=i.build1();this.rotateCenter=n.center()}else this.rotateCenter=e.start}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;return this.controlPointMove=!1,this.mouseLeftDown=!0,this.left.isSelect(r,i)&&(this.controlPointMove=!0),this.right.isSelect(r,i)&&(this.controlPointMove=!0),this.start.isSelect(r,i)&&(this.controlPointMove=!0),this.end.isSelect(r,i)&&(this.controlPointMove=!0),this.dimension.length===0&&(this.right.remove(),this.left.remove()),this.addHistory=!0,this.controlPointMove}onMouseMove(e){if(this.dimension.locked)return!1;let r=this.shiftControl(e),i=this.lastPosition;if(this.addHistory&&(this.commands.addCommand(Te.dispatch(this.dimension,"modify")),this.addHistory=!1),this.start.status())return this.start.setPosition(i),this.dimension.start=i,this.end.setPosition(this.dimension.end),this.left.setPosition(this.dimension.left),!0;if(this.end.status())return this.end.setPosition(i),this.dimension.end=i,this.start.setPosition(this.dimension.start),this.right.setPosition(this.dimension.right),!0;if(this.left.status())return this.left.setPosition(i),this.dimension.left=i,this.start.setPosition(this.dimension.start),!0;if(this.right.status())return this.right.setPosition(i),this.dimension.right=i,this.end.setPosition(this.dimension.end),!0;let n=Ae.translate(r.x,r.y,0);return this.dimension.getGroupID()!=null?(this.commands=new ve("select dimension"),this.moveTool.onMouseMove(e)):(this.dimension.transform(n),this.rotateCenter=this.rotateCenter.multiply4(n)),this.flushPoint(),!0}flushPoint(){this.start.setPosition(this.dimension.start),this.end.setPosition(this.dimension.end),this.left.setPosition(this.dimension.left),this.right.setPosition(this.dimension.right)}onMouseLeftUp(e){return this.commands.length>0&&(je.executeCommand(this.commands),this.commands=new ve("select 2dLine - arc")),this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}interrupt(){var e,r;return this.commands.undo(),this.start.remove(),this.end.remove(),(e=this.left)==null||e.remove(),(r=this.right)==null||r.remove(),this.moveTool.interrupt(),this.removeShiftMoveHelpLine(),!0}rotate(e=ce.pcbConfig.rotate){if(!this.controlPointMove){let r=this.dimension.getParent();r!=null&&r.getGroupID()!=null?(this.commands=new ve("select dimension"),this.moveTool.rotate(e)):(this.addHistory&&(this.commands=new ve("select dimension"),this.commands.addCommand(Te.dispatch(this.dimension,"modify")),this.addHistory=!1),ao.rotate(this.rotateCenter,e,[this.dimension]),this.flushPoint())}}};var Sde=class extends ws{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.protractor=e,this.commands=new ve("select dimension");let r=this.protractor.layerId;this.start=new qi(r,e.start),this.end=new qi(r,e.end),this.center=new qi(r,e.center),this.text=new qi(r,e.textPosition),this.moveTool=new Ch([this.protractor])}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;return this.controlPointMove=!1,this.mouseLeftDown=!0,this.text.isSelect(r,i)&&(this.controlPointMove=!0),this.center.isSelect(r,i)&&(this.controlPointMove=!0),this.start.isSelect(r,i)&&(this.controlPointMove=!0),this.end.isSelect(r,i)&&(this.controlPointMove=!0),this.addHistory=!0,this.controlPointMove}onMouseMove(e){if(this.protractor.locked)return!1;let r=this.shiftControl(e),i=this.lastPosition;if(this.addHistory&&(this.commands.addCommand(Te.dispatch(this.protractor,"modify")),this.addHistory=!1),this.start.status())return this.start.setPosition(i),this.protractor.start=i,this.text.setPosition(this.protractor.textPosition),!0;if(this.end.status())return this.end.setPosition(i),this.protractor.end=i,this.text.setPosition(this.protractor.textPosition),!0;if(this.text.status())return this.text.setPosition(i),this.protractor.textPosition=i,!0;if(this.center.status())return this.center.setPosition(i),this.protractor.center=i,this.text.setPosition(this.protractor.textPosition),!0;let n=Ae.translate(r.x,r.y,0);return this.protractor.getGroupID()!=null?(this.commands=new ve("select dimension"),this.moveTool.onMouseMove(e)):this.protractor.transform(n),this.flushPoint(),!0}flushPoint(){this.start.setPosition(this.protractor.start),this.end.setPosition(this.protractor.end),this.center.setPosition(this.protractor.center),this.text.setPosition(this.protractor.textPosition)}onMouseLeftUp(e){return this.commands.length>0&&(je.executeCommand(this.commands),this.commands=new ve("select 2dLine - arc")),this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}interrupt(){var e;return(e=this.commands)==null||e.undo(),this.removeShiftMoveHelpLine(),this.start.remove(),this.end.remove(),this.center.remove(),this.text.remove(),this.moveTool.interrupt(),!0}rotate(e=ce.pcbConfig.rotate){if(!this.controlPointMove){let r=this.protractor.getParent();if(r!=null&&r.getGroupID()!=null)this.commands=new ve("select dimension"),this.moveTool.rotate(e);else{this.addHistory&&(this.commands=new ve("select dimension"),this.commands.addCommand(Te.dispatch(this.protractor,"modify")),this.addHistory=!1);let i=_s([this.protractor]);if(i.valid()){let s=i.build1().center();ao.rotate(s,e,[this.protractor]),this.flushPoint()}}}}};var Ede=class extends ws{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.selectControlPointType=null;this.arc=null;this.radius=e,this.commands=new ve("select radius");let r=this.radius.layerId;this.start=new qi(r,this.radius.start),this.end=new qi(r,this.radius.end),this.text=new qi(r,this.radius.textPosition),this.moveTool=new Ch([this.radius])}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY,n=!1,s=null;return this.start.isSelect(r,i)&&(n=!0,s=0),this.end.isSelect(r,i)&&(n=!0,s=1),this.text.isSelect(r,i)&&(n=!0,s=2),this.updateLinkArcInfo(),this.controlPointMove=n,this.selectControlPointType=s,this.mouseLeftDown=!0,this.addHistory=!0,n}onMouseMove(e){if(this.radius.locked)return!1;let r=this.shiftControl(e),i=this.lastPosition;if(this.addHistory&&(this.commands.addCommand(Te.dispatch(this.radius,"modify")),this.addHistory=!1),this.selectControlPointType===0){let s=Ute(this.radius.start,this.radius.end,i),a=new S(s.x,s.y);return this.radius.start=a,this.start.setPosition(a),this.text.setPosition(this.radius.textPosition),!0}if(this.selectControlPointType===2)return this.radius.textPosition=i,this.text.setPosition(this.radius.textPosition),!0;if(this.selectControlPointType===1){if(this.arc){let s=new S(e.sceneX,e.sceneY),a=s.sub(this.arc.center).normalize().mul(this.arc.radius).add(this.arc.center);if(this.arc.isSelect(a.x,a.y))if(a.distance1(s)>this.radius.getRadiusLength())this.radius.updateRadius(s,a);else{let c=s.sub(a).normalize().mul(this.radius.getRadiusLength()).add(a);this.radius.updateRadius(c,a)}else if(this.arc instanceof vt){let l=s.sub(this.arc.center).normalize(),c=this.arc.start.sub(this.arc.center),h=this.arc.end.sub(this.arc.center),u=c.dot(l),d=h.dot(l);u>d?a=this.arc.start:a=this.arc.end;let p=this.radius.start.sub(this.radius.end).length();if(s.distance1(this.arc.center)>this.arc.radius){let m=a.add(a.sub(this.arc.center).normalize().mul(p));this.radius.updateRadius(m,a)}else{let m=a.add(this.arc.center.sub(a).normalize().mul(p));this.radius.updateRadius(m,a)}}}else this.radius.layerId===4?this.radius.updateRadius(this.radius.start,i):this.radius.end=i;return this.flushPoint(),!0}let n=Ae.translate(r.x,r.y,0);return this.radius.getGroupID()!=null?(this.commands=new ve("select radius"),this.flushPoint(),this.moveTool.onMouseMove(e)):(this.radius.transform(n),this.flushPoint()),!0}onMouseLeftUp(e){return this.commands.length>0&&(je.executeCommand(this.commands),this.commands=new ve("select radius"),A.publish("hasModifyPcbItem",this.radius)),this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.selectControlPointType=null,this.arc=null,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}flushPoint(){this.start.setPosition(this.radius.start),this.end.setPosition(this.radius.end),this.text.setPosition(this.radius.textPosition)}getLinkArc(e){let r=e.end,i=new ut(r.x,r.x,r.y,r.y),n=Vt.search(i,(a,l)=>l=="ArcTrack"||l=="Arc"||l=="Circle"),s=null;for(let a of n.getArcs())if(a.isSelect(r.x,r.y)){s=a;break}return s}updateLinkArcInfo(){let e=this.getLinkArc(this.radius);return e?(this.arc=e,!0):(this.arc=null,!1)}rotate(e=ce.pcbConfig.rotate){let r=this.radius.getParent();if(r!=null&&r.getGroupID()!=null)this.commands=new ve("select radius"),this.moveTool.rotate(e);else{this.addHistory&&(this.commands=new ve("select radius"),this.commands.addCommand(Te.dispatch(this.radius,"modify")),this.addHistory=!1);let i=_s([this.radius]);if(i.valid()){let s=i.build1().center();ao.rotate(s,e,[this.radius])}}}interrupt(){var e;return(e=this.commands)==null||e.undo(),this.removeShiftMoveHelpLine(),this.start.remove(),this.end.remove(),this.text.remove(),this.moveTool.interrupt(),!0}};var Ode=class extends ws{constructor(e){super();this.addHistory=!0;this.position=S.ORIGIN;this.firstMove=!0;this.text=e,this.command=new ve("select Text"),this.moveTool=new Ch([this.text]),this.position=this.text.position}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;return this.text.isSelect(r,i)}onMouseMove(e){if(this.text.locked)return!1;this.addHistory&&(this.command.addCommand(Te.dispatch(this.text,"modify")),this.addHistory=!1),this.firstMove&&(Ve.highlightComponentWhenMoveText.add(this.text),this.firstMove=!1);let r=this.shiftControl(e);if(this.position=this.lastPosition,this.text.getGroupID()!=null)this.command=new ve("select group text"),this.moveTool.onMouseMove(e);else{if(e.adsorbGrid){let n=this.text.position.add(r);n=di.adsorpGrid(n),r=n.sub(this.text.position)}let i=Ae.translate(r.x,r.y,0);this.text.transform(i),this.text.updateHelpLine()}return!0}onMouseLeftUp(e){var r;return this.position=this.text.position,this.command.length>0&&(je.executeCommand(this.command),this.command=new ve("select text"),A.publish("hasModifyPcbItem",this.text)),Ve.highlightComponentWhenMoveText.clear(),this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),this.text.globalIndex==((r=Kr.plainCode)==null?void 0:r.globalIndex)&&A.messageBus.publish("updateCode",Kr.getCurrentCodeInfo()),!0}rotate(e=ce.pcbConfig.rotate){if(this.text.getGroupID()!=null)this.command=new ve("select group text"),this.moveTool.rotate(e);else{this.addHistory&&(this.command=new ve("select text"),this.command.addCommand(Te.dispatch(this.text,"modify")),this.addHistory=!1);let r=_s([this.text]);if(r.valid()){let n=r.build1().center();ao.rotate(n,e,[this.text])}}}interrupt(){var e;return(e=this.command)==null||e.undo(),Ve.highlightComponentWhenMoveText.clear(),this.moveTool.interrupt(),this.removeShiftMoveHelpLine(),!0}};var N$=class extends ws{constructor(e){super();this.events=[];this.tools=new Array;this.repair1=new Array;this.repair2=new Array;this.canDragStarts=[];this.canDragEnds=[];this.startArr=[];this.endArr=[];this.currentSelectIndex=null;this.SelectIndex=0;this.tool=null;e.forEach(r=>{let i=new CD(r);i.setMultiRepair(!0);let n=()=>r.layerId,s=this.addPoint(n,r.start),a=this.addPoint(n,r.end);this.events.push(i),this.startArr.push(s),this.endArr.push(a);let l=i.identify.canDrag(i.identify.startType),c=i.identify.canDrag(i.identify.endType);this.canDragStarts.push(l),this.canDragEnds.push(c)})}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;this.events.forEach(s=>{s.lastMousePosition=new S(e.sceneX,e.sceneY),s.lastRealMousePosition=new S(r,i)}),this.events.forEach((s,a)=>{this.startArr[a].isSelect(r,i)||this.endArr[a].isSelect(r,i)?s.isClickPoint=!0:s.isClickPoint=!1});let n=this.getCurrentIndex(e);if(this.currentSelectIndex!=null&&ce.pcbConfig.clickTrackSelect=="whole"){let s=this.events[this.currentSelectIndex].track,a=$t.filterTrack(s,"whole"),l=!0;for(let c of this.events)if(a.indexOf(c.track)<0){l=!1;break}l&&(this.tool!=null&&(this.tool.interrupt(),this.tool=null),this.tool=new PU(s),this.tool.onMouseLeftDown(e))}return n!==null}getCurrentIndex(e){let r=e.realSceneX,i=e.realSceneY,n=null;return this.events.forEach((s,a)=>{s.track.isSelect(r,i)&&(n=a),this.startArr[a].isSelect(r,i)&&(n=a),this.endArr[a].isSelect(r,i)&&(n=a),this.events[a].addHistory=!0,this.events[a].track.isEmpty&&(n=null)}),this.currentSelectIndex=n==null?this.events.length-1:n,n}realTimeNetLength(){let e=this.events[0].track.net,r=te.getInstance().getNet(e);if(r!=null&&r.netLengthPhysics!=null){ze.modifyNet(e);let i=ze.getNetLength(e),n=[].concat(this.tools,this.repair1,this.repair2);for(let s of n){let a=s==null?0:s.getLengthIncrement();i=i+a}return i}return 0}realTimeDiffPairLengthErr(){let e=this.events[0].track.net,r=te.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;ze.modifyNet(n),ze.modifyNet(s);let a=ze.getNetLength(n),l=ze.getNetLength(s),c=[0,0,0,0],h=[].concat(this.tools,this.repair1,this.repair2);for(let d of h){let p=this.getIncrement(d,n,s);c[0]+=p[0],c[1]+=p[1],d.event.track.net==n?c[2]+=p[2]:c[3]+=p[2]}return tr.getInstance().mode=="WIRING_MODE_PUSHAWAY"?(a=a+c[0],l=l+c[1]):(a=a+c[2],l=l+c[3]),a-l}return 0}getIncrement(e,r,i){if(e!=null){let n=e.shoveEvent.getNetDelta(r),s=e.shoveEvent.getNetDelta(i),a=e.getLengthIncrement();return[n,s,a]}return[0,0,0]}onMouseMove(e){if(this.changeNativeCursor(5),this.tool!=null)return this.tool.onMouseMove(e),this.events.forEach((u,d)=>{this.startArr[d].hidden(),this.endArr[d].hidden()}),!0;let r=this.currentSelectIndex;this.events[r].adsorbtion=e.adsorbGrid;let i=this.startArr[r],n=this.endArr[r],s=e.sceneX,a=e.sceneY,l=new S(s,a);this.getAllCoCurrentTrack(this.events[r]);let c=i.status()&&this.canDragStarts[r],h=n.status()&&this.canDragEnds[r];if(c||h)return this.repairByControlPoint(e,c),!0;if(this.filterWholeTrack(r),this.move2Position(l,r),this.inSameNetDifferential())jt.updateNetLengthMsg(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength2:this.realTimeNetLength(),net:this.events[0].track.net});else if(this.tools.length===1)return jt.updateNetLengthMsg(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength:this.realTimeNetLength(),net:this.events[0].track.net}),!0;return!0}snapExtendedLine(e,r){if(!r.adsorb||!ce.adsorptionConfig.getConfig("Extended Line"))return null;let i=e.track,n=new S(i.end.x,i.end.y),s=new S(r.realSceneX,r.realSceneY),a=new S(i.start.x,i.start.y),l=a.sub(n).angle(S.ORIGIN),{point:c}=di.getExtendedLinePointInfo(s,n,a,l,r);return c}repairByControlPoint(e,r){let i=this.currentSelectIndex,n=this.events[i],s=!1,a=r?n.oldStart:n.oldEnd,l=new S(e.sceneX,e.sceneY),c=l.sub(a);u.call(this,n,i),this.events.forEach((d,p)=>{i!==p&&u.call(this,d,p)});let h=this.repair2.map(d=>d.event);this.events.forEach((d,p)=>{h.indexOf(d)>=0?(this.startArr[p].setPosition(d.track.start),this.endArr[p].setPosition(d.track.end)):(this.startArr[p].hidden(),this.endArr[p].hidden())});function u(d,p){if(!d.isCoSelect)return;let m=r;n.direct.dot(d.direct)<0&&(m=!r);let g=d.identify.startType,y=d.identify.startNodes[0],b=d.identify.startAngleType;if(m||(g=d.identify.endType,y=d.identify.endNodes[0],b=d.identify.endAngleType),[0,4,1].includes(g)){if(p===i&&this.snapExtendedLine(n,e)&&(l=new S(e.sceneX,e.sceneY),c=l.sub(a)),this.changleMouseStyle(this.getMouseStyle(d.oldEnd.sub(d.oldStart))),this.repair1[p]==null&&(this.repair1[p]=new ON(d)),p!==i&&s){let P=n.track,T=this.repair1[i].next,I=n.direct;if(I.dot(P.direct)>-1e-8||Math.abs(I.cross(P.direct))<1e-8){let C=r?I.mul(-1):I,E=r?P.end:P.start,O=r?P.start:P.end,_=[new M(E,O),new M(T.start,T.end)];if(this.repair1[p].moveByIntercept(_,T.end,C,m))return}}this.repair1[p].movePointOffset(c,m),p===i&&(s=!0)}else if(y instanceof Ue){let P=l;if(p!==i&&(P=(m?d.oldStart:d.oldEnd).add(c)),this.repair2[p]==null){let T=y;this.repair2[p]=new EN(d.track,T,b,d)}this.repair2[p].move(P)}}}move2Position(e,r){let i=new Array,n=e.sub(this.events[r].oldEnd),s=this.events[r].oldEnd;this.tools[this.SelectIndex].moveOffset(n);let a=this.events[r].track.end.sub(s);a.length()>0&&this.tools.forEach((h,u)=>{if(u!=this.SelectIndex){let d=h.event.oldEnd;h.moveOffset(a);let m=h.event.track.end.sub(d);i.push(m)}else i.push(a)});let l=Array.from(i);xr(i,(h,u)=>h.length()-u.length(),0,i.length);let c=new Set;l.forEach((h,u)=>{let d=this.tools[u];d.moveOffset(i[0]),c.add(d.event)}),this.events.forEach((h,u)=>{c.has(h)?(this.startArr[u].setPosition(h.track.start),this.endArr[u].setPosition(h.track.end)):(this.startArr[u].hidden(),this.endArr[u].hidden())})}inSameNetDifferential(){let e=this.events.reduce((i,n)=>i.add(n.track.net),new Set),r=Array.from(e);if(r.length==1||r.length==2){let i=r[0],n=te.getInstance().getNet(i);if(n!=null&&n.netDifferential!=null){if(r.length==1)return!0;let s=n.netDifferential;return r[1]==s.positiveNet.name||r[1]==s.negativeNet.name}}return!1}getAllCoCurrentTrack(e){let r=u=>u.direct,i=r(e),n=Ae.translate(-e.oldStart.x,-e.oldStart.y,0).rotateZ(-i.angle(S.ORIGIN)),s=e.oldEnd.multiply4(n),a=new ut(Math.min(0,s.x),Math.max(0,s.x),0,0),l=new Array;this.events.forEach((u,d)=>{let p=r(u);if(p.length()>0&&Math.abs(i.cross(p))<.001&&(u.isCoSelect=!0,u!=e)){let m=u.oldStart.multiply4(n),g=u.oldEnd.multiply4(n),y=new ut(Math.min(m.x,g.x),Math.max(m.x,g.x),0,0),b=a.intersection1(y);l.push({event:u,interBox:b})}}),xr(l,(u,d)=>u.interBox!=null&&d.interBox!=null?d.interBox.width()-u.interBox.width():u.interBox==null&&d.interBox!=null?d.interBox.width():u.interBox!=null&&d.interBox==null?-u.interBox.width():1,0,l.length);let c=new Set,h=new jf(e.track,!1);for(let u of h.all)u instanceof Ar&&c.add(u);for(let u of l){if(c.has(u.event.track)){u.event.isCoSelect=!1;continue}let d=new jf(u.event.track,!1);for(let p of d.all)p instanceof Ar&&c.add(p)}}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY,n=this.getCurrentIndex(e);return this.selectPoint(r,i,n),!1}onMouseLeftUp(e){if(this.tool!=null)return this.tool.onMouseLeftUp(e);this.mouseLeftDown=!1;let r=[],i=[];this.tools.forEach(u=>{u.complete()}),this.repair2.forEach(u=>{u.complete()}),this.repair1.forEach(u=>{u.complete()});let n=new ve("Multi repair line"),s=[],a,l=this.events.filter(u=>u.isCoSelect),c=this.events.filter(u=>!u.isCoSelect),h=this.currentSelectIndex;if(this.events[h].setMultiRepair(!0),this.events.forEach(u=>{if(u.isCoSelect){if(u.commands){for(let d of u.commands.commands)n.addCommand(d);u.commands=null}u.resultTrack?r.push(u.resultTrack):!u.track.isEmpty&&r.push(u.track)}else!u.track.isEmpty&&i.push(u.track)}),n.length>0&&je.executeCommand(n),A.publish("clearSelect",""),l.length<2)l.length>0&&(this.events[h].isClickPoint?(i.forEach(u=>{u.click()}),A.publish("select",i)):(c.forEach(u=>{let d=this.events[h];a=d.oldStart.equals1(u.oldStart)||d.oldStart.equals1(u.oldEnd)||d.oldEnd.equals1(u.oldStart)||d.oldEnd.equals1(u.oldEnd),a||(u.track.click(),s.push(u.track))}),A.publish("select",s)));else{if(this.events[h].isClickPoint)r.push(...i),r.forEach(u=>{u.click()}),A.publish("select",r);else{let u=[];l.forEach(d=>{d.track.isEmpty||(d.track.click(),u.push(d.track))}),i.forEach(d=>{d.click()}),A.publish("select",[].concat(u,i))}r.forEach(u=>{u=null}),Pr.model=0}return A.publish("flushService",""),this.removeShiftMoveHelpLine(),!0}interrupt(){return this.tool!=null&&(this.tool.interrupt(),this.tool=null),jt.cancel(),this.events.forEach((e,r)=>{this.events[r].commands!=null&&this.events[r].commands.undo(),this.startArr[r].remove(),this.endArr[r].remove()}),this.tools.forEach(e=>{e!=null&&(e.interrupt(),e=null)}),this.repair2.forEach(e=>{e!=null&&(e.interrupt(),e=null)}),this.repair1.forEach(e=>{e!=null&&(e.interrupt(),e=null)}),this.changleMouseStyle("default"),this.removeShiftMoveHelpLine(),this.mouseLeftDown=!1,!0}addPoint(e,r){return new qi(e(),r)}selectPoint(e,r,i){let n=this.currentSelectIndex;if(this.startArr[n].inTop(e,r)&&this.canDragStarts[n]){this.changleMouseStyle("pointer");return}if(this.endArr[n].inTop(e,r)&&this.canDragEnds[n]){this.changleMouseStyle("pointer");return}i!=null?this.changeNativeCursor(5):this.changleMouseStyle("default")}getMouseStyle(e){let r=Math.atan2(e.y,e.x);return r>=Math.PI/8*1&&r<Math.PI/8*3||r>=-(Math.PI/8)*7&&r<-(Math.PI/8)*5?"ne-resize":r>=Math.PI/8*3&&r<Math.PI/8*5||r>=-(Math.PI/8)*5&&r<-(Math.PI/8)*3?"n-resize":r>=Math.PI/8*5&&r<Math.PI/8*7||r>=-(Math.PI/8)*3&&r<-(Math.PI/8)*1?"nw-resize":"w-resize"}setSupportPushOrBlock(e){if(!this.events[e].isMultiRepair)return[this.events[e]];let r=$t.filterTrack(this.events[e].track,"whole"),i=this.events.slice(0);for(let n=0;n<i.length;n++){let s=i[n],a=r.findIndex(l=>s.track===l&&this.events[e].track!==s.track);a>=0&&(i.splice(n,1),r.splice(a,1),n--)}return i.length===1&&this.events[e].setMultiRepair(!1),i}filterWholeTrack(e){let r=this.setSupportPushOrBlock(e);this.tools.length==0&&r.forEach((i,n)=>{if(i.isCoSelect){let s=i.getTool();this.tools.push(s)}}),this.tools.forEach((i,n)=>{this.events[e].track===i.event.track&&(this.SelectIndex=n)})}};var Dw=class{constructor(){this.repairLineBlockMax=100;this.blockNum=-1;this.map=new Map;this.wireResult=new Kg,this.command=new Br}static isPush(){return tr.getInstance().mode=="WIRING_MODE_PUSHAWAY"}static isBlock(){let t=tr.getInstance();return t.mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"||t.mode=="WIRING_MODE_SURROUND"||t.mode=="WIRING_MODE_OBSTRUCT"}initClear(){_r.getInstance().clear(),Ra.getInstance().clear(),Os.getInstance().clear(),Fr.getInstance().clear()}addPathListByTool(t,e=!0){let i=t.getPathList();e&&t.shoveHandle(this.command);let n=t.generateTrackInfoByItem(i.getFirst(),i.getLast());this.map.set(n,t),this.wireResult.wireMap.set(n,i)}addDirect(t){this.wireResult.direct=t}generateDirect(t,e){let r=new S(-t.y,t.x),n=r.mul(e.dot(r)).normalize();return this.addDirect(n),n}shove(){if(this.wireResult.command=this.command,this.wireResult.wireMap.size<=0)return;let t=new dg,e=na.getInstance();switch(e.pushVia){case"OPTIMIZA_OPEN":{t.canPushViaLevel=2;break}case"OPTIMIZA_NONE":{t.canPushViaLevel=0;break}}switch(e.pathOptimization4BePushed){case 1:{t.level="SUPER";break}case 0:{t.level="STRONG";break}case 2:{t.level="WEAK";break}}switch(e.currentPathOptimization4BePushed){case"OPTIMIZA_STRONG":{t.inputLevel="SUPER";break}case"OPTIMIZA_WEAK":{t.inputLevel="STRONG";break}case"OPTIMIZA_NONE":{t.inputLevel="WEAK";break}default:{t.inputLevel="NONE";break}}try{t.run(this.wireResult)}catch(i){throw new Error(i)}ji.getInstance().view4Status(_r.getInstance().current).commands.forEach(i=>{this.command.addCommand(i)}),this.wireResult.wireMap.forEach((i,n)=>{let s=this.map.get(n);s instanceof a9&&s.updatePointByPathList(i)}),_r.getInstance().clear()}obstruct(t=!1){if(this.wireResult.command=this.command,this.wireResult.wireMap.size<=0)return;let e=new fb;if(t)switch(na.getInstance().currentPathOptimization4BePushed){case"OPTIMIZA_STRONG":{e.level="SUPER";break}case"OPTIMIZA_WEAK":{e.level="STRONG";break}case"OPTIMIZA_NONE":{e.level="WEAK";break}default:{e.level="NONE";break}}try{e.run(this.wireResult)}catch(i){throw new Error(i)}ji.getInstance().view4Status(_r.getInstance().current).commands.forEach(i=>{this.command.addCommand(i)}),this.wireResult.wireMap.forEach((i,n)=>{let s=this.map.get(n);s instanceof a9&&s.updatePointByPathList(i)}),_r.getInstance().clear()}obstruct2(t,e){if(Nt.setPushFilter(),this.wireResult.wireMap.forEach(a=>{Nt.pushFilter.addWaitList(a)}),hi.getInstance().update(),this.blockNum>this.repairLineBlockMax)return this.blockNum=-1,null;let r,i,n=new S(-t.y,t.x);return e.find(a=>{if(!a||!a.repairBlock)return!1;if(a.repairBlock.updateBlock(),a.repairBlock.isBlock())return!0})?(e.forEach(a=>{a.shoveHandle(this.command)}),this.obstruct(),null):(e.forEach(a=>{if(a&&a.repairBlock){let l=a.repairBlock.block();if(!l)return;let c=n.dot(l),h=n.mul(c);r?h.length()<r.length()&&(r=h,i=l):(r=h,i=l)}}),i?this.blockNum++:this.blockNum=-1,Nt.setPushFilter(),i)}obstructEnd(t){t.forEach(e=>{if(e&&e.repairBlock){let r=e.repairBlock.block();if(!r)return;e.modifyPoint(r,e.moveStart)}})}undo(){this.command.undo(),this.command=new Br,this.wireResult=new Kg,ji.getInstance().view4Status(_r.getInstance().current),l0.needclearWireCache=!1,this.initClear()}};var k$=class extends ws{constructor(e,r=!1,i=!1){super();this.events=[];this.arcEvent=[];this.tools=new Array;this.repair1=new Array;this.repair2=new Array;this.canDragStarts=[];this.canDragEnds=[];this.startArr=[];this.endArr=[];this.currentSelectIndex=null;this.filter=!1;this.multiRepairLinePushTool=new Dw;this.repairMultiLine=!1;this.initMove=!0;this.isClick=!1;this.allData=[];e.filter(s=>s instanceof Ar?!0:(this.arcEvent.push(new TC(s)),!1)).forEach(s=>{let a=new cu(s);a.setMultiRepair(!0);let l=()=>s.layerId,c=this.addPoint(l,s.start),h=this.addPoint(l,s.end);this.events.push(a),this.startArr.push(c),this.endArr.push(h);let u=a.identify.canDrag(a.identify.startType),d=a.identify.canDrag(a.identify.endType);this.canDragStarts.push(u),this.canDragEnds.push(d)}),i&&(this.allData=e),this.isClick=r}onMouseLeftDown(e){var a;let r=!1,i=e.realSceneX,n=e.realSceneY;if(this.events.forEach((l,c)=>{this.startArr[c].isSelect(i,n)||this.endArr[c].isSelect(i,n)?(l.isClickPoint=!0,r=!0):l.isClickPoint=!1}),r&&(this.moveTool=null),this.moveTool)return this.moveTool.onMouseLeftDown(e);if(this.events.forEach(l=>{l.lastMousePosition=new S(e.sceneX,e.sceneY),l.lastRealMousePosition=new S(i,n)}),jt.getToleranceTargetNet((a=this.events[0])==null?void 0:a.track.net),this.filter)return!1;let s=this.getCurrentIndex(e);return!r&&this.allData.length>0&&s!==null?(this.moveTool=new Ch(this.allData),this.moveTool.onMouseLeftDown(e)):(this.moveTool=null,s!==null)}getCurrentIndex(e){let r=e.realSceneX,i=e.realSceneY,n=null;return this.events.forEach((s,a)=>{var l;(l=s.track)!=null&&l.isSelect(r,i)&&(n=a),this.startArr[a].isSelect(r,i)&&(n=a),this.endArr[a].isSelect(r,i)&&(n=a),this.events[a].track.isEmpty&&(n=null)}),this.currentSelectIndex=n==null?this.events.length-1:n,n}realTimeNetLength(){let e=this.events[0].track.net,r=te.getInstance().getNet(e);return r!=null&&r.netLengthPhysics!=null?(ze.modifyNet(e),Ap.getNetLengthDelta(e)):0}realTimeDiffPairLengthErr(){let e=this.events[0].track.net,r=te.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;ze.modifyNet(n),ze.modifyNet(s);let a=Ap.getNetLengthDelta(n),l=Ap.getNetLengthDelta(s);return{len_P:a,len_N:l}}return null}onMouseMove(e){if(this.moveTool){let d=this.moveTool.onMouseMove(e);return this.events.forEach((p,m)=>{let g=p.track;g.isEmpty?(this.startArr[m].hidden(),this.endArr[m].hidden()):(this.startArr[m].setPosition(g.start),this.endArr[m].setPosition(g.end))}),d}this.initMove&&(this.initMove=!1,sp.getInstance().highlight(this.events.map(d=>d.track))),this.changeNativeCursor(5);let r=this.currentSelectIndex,i=e.sceneX,n=e.sceneY,s=new S(i,n);this.getAllCoCurrentTrack(this.events[r],s),r=this.currentSelectIndex,this.events[r].adsorbtion=e.adsorbGrid;let a=this.startArr[r],l=this.endArr[r],c=a.status()&&this.canDragStarts[r],h=l.status()&&this.canDragEnds[r];c||h?this.repairByControlPoint(e,c):(this.filterWholeTrack(r),this.repairMultiLine?this.move2PositionMulti(s,r):this.move2Position(s,r));let u=this.events.filter(d=>d.isCoSelect);return this.inSameNetDifferential()?jt.updateNetLengthMsg2(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength2:this.realTimeNetLength(),net:this.events[0].track.net}):u.length===1&&jt.updateNetLengthMsg2(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength:this.realTimeNetLength(),net:this.events[0].track.net}),!0}snapExtendedLine(e,r){if(!r.adsorb||!ce.adsorptionConfig.getConfig("Extended Line"))return null;let i=e,n=new S(i.end.x,i.end.y),s=new S(r.realSceneX,r.realSceneY),a=new S(i.start.x,i.start.y),l=a.sub(n).angle(S.ORIGIN),{point:c}=di.getExtendedLinePointInfo(s,n,a,l,r);return c}repairByControlPoint(e,r){this.isMultiMode()&&this.multiRepairLinePushTool.undo();let i=this.currentSelectIndex,n=this.events[i],s=!1,a=r?n.oldStart:n.oldEnd,l=new S(e.sceneX,e.sceneY),c=l.sub(a),h;d.call(this,n,i),this.events.forEach((p,m)=>{i!==m&&d.call(this,p,m)}),this.isMultiMode()&&(this.repair1.forEach(p=>{p&&this.multiRepairLinePushTool.addPathListByTool(p)}),this.repair2.forEach(p=>{p&&this.multiRepairLinePushTool.addPathListByTool(p)}),this.isPush()?this.multiRepairLinePushTool.shove():(this.multiRepairLinePushTool.obstructEnd(this.repair1),this.repair2.length&&this.multiRepairLinePushTool.obstruct()));let u=this.repair2.map(p=>p.event);this.events.forEach((p,m)=>{u.indexOf(p)>=0?(this.startArr[m].setPosition(p.start),this.endArr[m].setPosition(p.end)):(this.startArr[m].hidden(),this.endArr[m].hidden())});function d(p,m){if(!p.isCoSelect)return;let g=r;n.direct.dot(p.direct)<0&&(g=!r);let y=p.identify.startType,b=p.identify.startNodes[0],P=p.identify.startAngleType;if(g||(y=p.identify.endType,b=p.identify.endNodes[0],P=p.identify.endAngleType),[0,4,1].includes(y)||p.needModifyRepair1(y,b)&&(m===i||s)){if(m===i){let T,I=p.adsorb(new S(e.realSceneX,e.realSceneY),n.track.width,n.track.layerId,!0);I?T=I:T=this.snapExtendedLine(n,e),T&&(l=new S(e.sceneX,e.sceneY),c=l.sub(a))}if(this.changleMouseStyle(this.getMouseStyle(p.oldEnd.sub(p.oldStart))),this.repair1[m]==null&&(this.repair1[m]=p.getRepairEndTool()),m!==i&&s){let T=this.repair1[i].next,I=n.direct,C=n.end.sub(n.start);if(I.dot(C)>-1e-8||Math.abs(I.cross(C))<1e-8){let E=r?I.mul(-1):I,O=r?n.end:n.start,_=r?n.start:n.end,R=[new M(O,_),new M(T.start(),T.end())];if(this.repair1[m].moveByIntercept(R,T.end(),E,g))return}}this.repair1[m].movePointOffset(c,g),m===i&&(s=!0)}else if(b instanceof Ue&&(m===i||!s)){let T=l;m!==i&&(T=(g?p.oldStart:p.oldEnd).add(c)),this.repair2[m]==null&&(this.repair2[m]=p.getLineTool(P,g)),this.repair2[m].move(T)}}}move2PositionMulti(e,r){this.isMultiMode()&&this.multiRepairLinePushTool.undo();let i=this.tools[r],n=this.events[r],s=n.direct,a=e.sub(n.lastMousePosition);if(a.length()){if(i.moveOffset(a),this.isMultiMode()){let l=this.multiRepairLinePushTool;this.isPush()?(l.addPathListByTool(i),l.generateDirect(s,a),l.shove()):(l.addPathListByTool(i,!1),l.obstruct(!1))}this.events.forEach((l,c)=>{this.startArr[c].hidden(),this.endArr[c].hidden()})}}move2Position(e,r){this.isMultiMode()&&this.multiRepairLinePushTool.undo();let i=new Array,n=e.sub(this.events[r].oldEnd),s=this.events[r].oldEnd,a=this.events[r].direct;this.tools[r].moveOffset(n);let l=this.events[r].end.sub(s);if(l.length()>0&&this.tools.forEach((h,u)=>{if(h)if(u!=r){let d=h.event.oldEnd;h.moveOffset(l);let m=h.event.end.sub(d);i.push(m)}else i.push(l)}),!i.length)return;xr(i,(h,u)=>h.length()-u.length(),0,i.length);let c=new Set;if(this.tools.forEach(h=>{h&&(h.moveOffset(i[0]),c.add(h.event))}),this.isMultiMode()){let h=this.multiRepairLinePushTool;if(this.isPush())this.tools.forEach(u=>{u&&h.addPathListByTool(u)}),h.generateDirect(a,i[0]),h.shove();else{this.tools.forEach(d=>{d&&h.addPathListByTool(d,!1)});let u=h.obstruct2(a,this.tools);for(;u;)this.tools.forEach(d=>{d&&d.moveOffset(u)}),u=h.obstruct2(a,this.tools)}}this.events.forEach((h,u)=>{c.has(h)?(this.startArr[u].setPosition(h.start),this.endArr[u].setPosition(h.end)):(this.startArr[u].hidden(),this.endArr[u].hidden())})}isMultiMode(){return tr.getInstance().mode!="WIRING_MODE_IGNORE"}isPush(){return tr.getInstance().mode=="WIRING_MODE_PUSHAWAY"}inSameNetDifferential(){let e=this.events.reduce((i,n)=>(n.isCoSelect&&i.add(n.track.net),i),new Set),r=Array.from(e);if(r.length==1||r.length==2){let i=r[0],n=te.getInstance().getNet(i);if(n!=null&&n.netDifferential!=null){if(r.length==1)return!0;let s=n.netDifferential;return r[1]==s.positiveNet.name||r[1]==s.negativeNet.name}}return!1}getAllCoCurrentTrack(e,r){if(this.filter)return;this.filter=!0;let i=u=>u.direct,n=i(e),s=Ae.translate(-e.oldStart.x,-e.oldStart.y,0).rotateZ(-n.angle(S.ORIGIN)),a=e.oldEnd.multiply4(s),l=new ut(Math.min(0,a.x),Math.max(0,a.x),0,0),c=new Array;this.events.forEach((u,d)=>{let p=i(u);if(p.length()>0&&Math.abs(n.cross(p))<.001&&(u.isCoSelect=!0,u!=e)){let m=u.oldStart.multiply4(s),g=u.oldEnd.multiply4(s),y=new ut(Math.min(m.x,g.x),Math.max(m.x,g.x),0,0),b=l.intersection1(y);c.push({event:u,interBox:b})}}),xr(c,(u,d)=>u.interBox!=null&&d.interBox!=null?d.interBox.width()-u.interBox.width():u.interBox==null&&d.interBox!=null?d.interBox.width():u.interBox!=null&&d.interBox==null?-u.interBox.width():1,0,c.length);let h=new Set;xt.getInstance().getListNode(e.track.model).parent.getAllItems().map(u=>u.globalIndex).forEach(u=>{h.add(u)});for(let u of c){if(h.has(u.event.track.globalIndex)){u.event.isCoSelect=!1;continue}let d=xt.getInstance().getListNode(u.event.track.model).parent.getAllItems();for(let p of d)p instanceof qr&&h.add(p.globalIndex)}this.sortEvents(r)}sortEvents(e){let r=this.events,i=[],n=[],s=new Map,a=0;for(let g of r)g.isCoSelect?i.push(g):n.push(g),s.set(g.track.globalIndex,a),a++;if(i.length<=1)return;let l=this.events[this.currentSelectIndex],c=l.lastRealMousePosition||l.track.start,h=e.sub(c),u=l.track.direct,d=this.generateDirect(u,h),p=this.sortItemsByEvent(i,d);this.events.length=0;let m=[];for(let g of p)g.event==l&&(this.currentSelectIndex=this.events.length),this.events.push(g.event),m.push(g.event.track.globalIndex);for(let g of n)this.events.push(g),m.push(g.track.globalIndex);this.updateData(s,m)}generateDirect(e,r){let i=new S(-e.y,e.x);return i.mul(r.dot(i)).normalize()}updateData(e,r){let i=this.startArr.length,n=new Array(i),s=new Array(i),a=new Array(i),l=new Array(i),c=0;for(let h of r){let u=e.get(h);n[c]=this.startArr[u],s[c]=this.endArr[u],a[c]=this.canDragStarts[u],l[c]=this.canDragEnds[u],c++}this.startArr=n,this.endArr=s,this.canDragStarts=a,this.canDragEnds=l}sortItemsByEvent(e,r){let n=e[0].track.start,s=[];for(let a of e)s.push({event:a,project:a.track.start.sub(n).dot(r)});return s.sort((a,l)=>a.project-l.project),s}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY,n=this.getCurrentIndex(e);return this.selectPoint(r,i,n),!1}onMouseLeftUp(e){if(this.moveTool){let b=this.moveTool.onMouseLeftUp(e);return this.moveTool=null,b}if(!ji.getInstance().checkTrackIsCanEdit())return this.interrupt(),!0;sp.getInstance().unhighlight(),this.initMove=!0,this.mouseLeftDown=!1;let i=[],n=[],s=!1;this.tools.forEach((b,P)=>{b&&(s=!0),b==null||b.complete()}),this.repair2.forEach((b,P)=>{b&&(s=!0),b==null||b.complete()}),this.repair1.forEach((b,P)=>{b&&(s=!0),b==null||b.complete()});let a=new ve("Multi repair line"),l=[],c,h=this.events.filter(b=>b.isCoSelect),u=this.events.filter(b=>!b.isCoSelect),d=this.currentSelectIndex;this.events[d].setMultiRepair(!0);let p=[];if(this.events.forEach(b=>{b.isCoSelect?(b.complete(a),b.resultId&&p.push(b.resultId)):n.push(b.track.globalIndex)}),s){let b=cu.complete2(a);for(let P of p)b[P]&&i.push(b[P]);p.length=0,cu.clear()}a.length>0&&je.executeCommand(a),A.publish("clearSelect","");let m=[],g=new er;n.forEach(b=>{let P=g.getItem(b);P&&m.push(P)});let y=[];if(i.forEach(b=>{let P=g.getItem(b);P&&y.push(P)}),h.length<2)h.length>0&&(this.events[d].isClickPoint?(m.forEach(b=>{b.click()}),A.publish("select",m)):(u.forEach(b=>{let P=this.events[d];c=P.oldStart.equals1(b.oldStart)||P.oldStart.equals1(b.oldEnd)||P.oldEnd.equals1(b.oldStart)||P.oldEnd.equals1(b.oldEnd),c||(b.track.click(),l.push(b.track))}),A.publish("select",l)));else{if(this.events[d].isClickPoint)y.push(...m),y.forEach(b=>{b.click()}),A.publish("select",y);else{let b=[];y.forEach(P=>{P.click(),b.push(P)}),m.forEach(P=>{P.click()}),A.publish("select",[].concat(b,m))}y.forEach(b=>{b=null}),Pr.model=0}return A.publish("flushService",""),this.removeShiftMoveHelpLine(),!0}interrupt(){this.moveTool&&this.moveTool.interrupt(),this.moveTool=null,this.allData.length=0,jt.cancel(),sp.getInstance().unhighlight(),this.initMove=!0,this.events.forEach((r,i)=>{this.events[i].commands!=null&&(this.events[i].commands.undo(),this.events[i].commands=null),this.startArr[i].remove(),this.endArr[i].remove(),r.interrupt()});let e=!1;return this.tools.forEach(r=>{r!=null&&(e=!0,r.interrupt(),r=null)}),this.repair2.forEach(r=>{r!=null&&(e=!0,r.interrupt(),r=null)}),this.repair1.forEach(r=>{r!=null&&(e=!0,r.interrupt(),r=null)}),e&&cu.clear(),this.changleMouseStyle("default"),this.removeShiftMoveHelpLine(),this.mouseLeftDown=!1,!0}addPoint(e,r){return new qi(e(),r)}selectPoint(e,r,i){var s,a;let n=this.currentSelectIndex;if((s=this.startArr[n])!=null&&s.inTop(e,r)&&this.canDragStarts[n]){this.changleMouseStyle("pointer");return}if((a=this.endArr[n])!=null&&a.inTop(e,r)&&this.canDragEnds[n]){this.changleMouseStyle("pointer");return}i!=null?this.changeNativeCursor(5):this.changleMouseStyle("default")}getMouseStyle(e){let r=Math.atan2(e.y,e.x);return r>=Math.PI/8*1&&r<Math.PI/8*3||r>=-(Math.PI/8)*7&&r<-(Math.PI/8)*5?"ne-resize":r>=Math.PI/8*3&&r<Math.PI/8*5||r>=-(Math.PI/8)*5&&r<-(Math.PI/8)*3?"n-resize":r>=Math.PI/8*5&&r<Math.PI/8*7||r>=-(Math.PI/8)*3&&r<-(Math.PI/8)*1?"nw-resize":"w-resize"}setSupportPushOrBlock(e){if(!this.events[e].isMultiRepair)return[this.events[e]];let r=this.events;return r.length===1&&this.events[e].setMultiRepair(!1),r}filterWholeTrack(e){let r=this.setSupportPushOrBlock(e);if(this.tools.length==0){let i=r.filter(n=>n.isCoSelect);if(i.length==1&&r.length>1){let n=i[0];if(!this.isClick){let s=this.multiConnect(n,r);if(s){this.repairMultiLine=!0,r.forEach((a,l)=>{if(a.isCoSelect){a.setConnectTrack(s);let c=a.getMultiTool();this.tools[l]=c}});return}}}r.forEach((n,s)=>{if(n.isCoSelect){let a=n.getTool();this.tools[s]=a}})}}multiConnect(e,r){let i=r.map(h=>h.track.model),a=xt.getInstance().getListNode(e.track.model).parent.getFirstNode(),l=!1,c=[];for(;a;){let h=a.item,u=i.includes(h);if(u&&(l=!0,c.push(h)),l&&!u)break;a=a.next}return c.length==i.length?c:null}};var AN=class AN{constructor(){this.initAction=new Array;this.isQR=null}static getInstance(){return AN.ins==null&&(AN.ins=new AN),AN.ins}addInitAction(t){return this.initAction.push(t)}addIsQR(t){this.isQR=t}init(){for(let t of this.initAction)t()}isQr(){var t;return((t=this.isQR)==null?void 0:t.call(this))||!1}};AN.ins=null;var QT=AN;var Ade=class extends ws{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.selectIndex=NaN;this.curr=null;this.ratio=NaN;this.image=e,this.command=new ve("select pcbImage");let r=this.image.layerId;this.width=this.image.width,this.height=this.image.height,this.oldWidth=this.image.width,this.oldHeight=this.image.height,this.ratio=this.oldWidth/this.oldHeight,this.rotation=this.image.rotation,this.mirror=this.image.mirror,this.matrix=Ae.rotateZ(-this.image.rotation),this.matrix1=Ae.rotateZ(this.image.rotation);let i=this.image.model.box;this.leftLow=new qi(r,i.leftLow),this.rightLow=new qi(r,i.rightLow),this.leftUp=new qi(r,i.leftUp),this.rightUp=new qi(r,i.rightUp),this.top=new qi(r,i.rightUp.add(i.leftUp).mul(.5),!0),this.bottom=new qi(r,i.leftLow.add(i.rightLow).mul(.5),!0),this.left=new qi(r,i.leftLow.add(i.leftUp).mul(.5),!0),this.right=new qi(r,i.rightUp.add(i.rightLow).mul(.5),!0),this.horizontalDirect=i.rightUp.sub(i.leftUp).normalize(),this.verticalDirect=i.leftLow.sub(i.leftUp).normalize(),this.moveTool=new Ch([this.image])}getNormal(e,r){let i=new S(-e.y,e.x),n=i.dot(r);return i.mul(n)}getSameDirect(e,r){let i=e.dot(r);return e.mul(i)}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY,n=NaN;return this.controlPointMove=!1,this.leftUp.isSelect(r,i)&&(this.controlPointMove=!0,n=0,this.curr=this.leftUp.getPosition()),this.rightUp.isSelect(r,i)&&(this.controlPointMove=!0,n=1,this.curr=this.rightUp.getPosition()),this.rightLow.isSelect(r,i)&&(this.controlPointMove=!0,n=2,this.curr=this.rightLow.getPosition()),this.leftLow.isSelect(r,i)&&(this.controlPointMove=!0,n=3,this.curr=this.leftLow.getPosition()),this.top.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.top.getPosition()),this.bottom.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.bottom.getPosition()),this.left.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.left.getPosition()),this.right.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.right.getPosition()),isNaN(n)||(this.selectIndex=n),this.mouseLeftDown=!0,this.addHistory=!0,this.controlPointMove?this.controlPointMove:this.image.isSelect(r,i)}getLimitValue(e){return ne.less(e,.01)?.01:e}onMouseMove(e){if(this.image.locked)return!1;this.addHistory&&(this.command.addCommand(Te.dispatch(this.image,"modify")),this.addHistory=!1),x.getInstance().envFlag=="silk-preview"&&QT.getInstance().isQr()&&(this.leftUp.status()||this.leftLow.status()||this.left.status()||this.top.status()||this.right.status()||this.bottom.status()||this.rightUp.status()||this.rightLow.status())&&(e.shiftKey=!0);let i=this.shiftControl(e),n=this.lastPosition,s=this.getSameDirect(this.horizontalDirect,i),a=this.getSameDirect(this.verticalDirect,i),l=this.horizontalDirect.dot(s),c=this.verticalDirect.dot(a);if(e.shiftKey){if(this.proportionImage(i,e))return!0}else{let u,d,p;if(this.curr&&(p=n.sub(this.curr),u=p.dot(this.horizontalDirect),d=p.dot(this.verticalDirect)),this.leftLow.status()){this.width=this.oldWidth-u,this.height=this.oldHeight+d;let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation,y=this.image.model.box.rightUp.add(this.horizontalDirect.mul(-this.width));return this.image.rotation=0,this.image.start=y,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}if(this.rightLow.status()){this.width=this.oldWidth+u,this.height=this.oldHeight+d;let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation;return this.image.rotation=0,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),this.rightLow.setPosition(n),!0}if(this.rightUp.status()){this.width=this.oldWidth+u,this.height=this.oldHeight-d;let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation,y=this.image.model.box.leftLow.add(this.verticalDirect.mul(-this.height));return this.image.rotation=0,this.image.start=y,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}if(this.leftUp.status()){this.width=this.oldWidth-u,this.height=this.oldHeight-d;let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation,y=this.image.model.box.rightLow.add(this.horizontalDirect.mul(-this.width)).add(this.verticalDirect.mul(-this.height));return this.image.rotation=0,this.image.start=y,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}if(this.top.status()){c<0?this.height+=a.length():c>0&&(this.height-=a.length());let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation,y=this.image.start.add(a);return this.image.rotation=0,this.image.start=y,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}if(this.bottom.status()){c>0?this.height+=a.length():c<0&&(this.height-=a.length());let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation;return this.image.rotation=0,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}if(this.right.status()){l>0?this.width+=s.length():l<0&&(this.width-=s.length());let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation;return this.image.rotation=0,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}if(this.left.status()){l<0?this.width+=s.length():l>0&&(this.width-=s.length());let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation,y=this.image.start.add(s);return this.image.rotation=0,this.image.start=y,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}}if(this.changeNativeCursor(5),this.image.getGroupID()!=null)this.command=new ve("select group image"),this.moveTool.onMouseMove(e,i);else{if(e.adsorbGrid){let d=this.image.start.add(i);d=di.adsorpGrid(d),i=d.sub(this.image.start)}let u=Ae.translate(i.x,i.y,0);this.image.transform(u)}let h=Ae.translate(i.x,i.y,0);return this.leftLow.transform(h),this.rightLow.transform(h),this.rightUp.transform(h),this.leftUp.transform(h),this.top.transform(h),this.bottom.transform(h),this.left.transform(h),this.right.transform(h),!0}onMouseLeftUp(e){var r,i;if(this.command.length>0&&(je.executeCommand(this.command),this.command=new ve("select image"),A.publish("hasModifyPcbItem",this.image)),this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),this.image.globalIndex==((r=Kr.QRCode)==null?void 0:r.globalIndex)){if(this.controlPointMove){let n=this.image.width,s=this.image.height;if(Kr.imgWidth=n,Kr.imgHeight=s,n=Xe(n,null,Kr.imgUnit),s=Xe(s,null,Kr.imgUnit),A.messageBus.publish("changeQRCodeSize",`${s}*${n}`),Kr.plainCode){let a=Kr.getTextPosition();a&&(Kr.plainCode.position=a)}}A.messageBus.publish("updateCode",Kr.getCurrentCodeInfo())}return this.image.globalIndex==((i=h0.getInstance().image)==null?void 0:i.globalIndex)&&A.messageBus.publish("updateCode",h0.getInstance().getCurrentULInfo()),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.selectPoint(r,i),!1}selectPoint(e,r){let i=xc(this.image.layerId,this.image.mirror),{leftLow:n,rightUp:s,rightLow:a,leftUp:l,top:c,bottom:h,left:u,right:d}=this,p=this.image.rotation;i&&(n=this.rightLow,u=this.right,l=this.rightUp,a=this.leftLow,d=this.left,s=this.leftUp,p=Vr-p),n.inTop(e,r)||s.inTop(e,r)?this.changeNativeCursor1(2,p):a.inTop(e,r)||l.inTop(e,r)?this.changeNativeCursor1(3,p):c.inTop(e,r)||h.inTop(e,r)?this.changeNativeCursor1(0,p):u.inTop(e,r)||d.inTop(e,r)?this.changeNativeCursor1(1,p):this.image.isSelect(e,r)?this.changeNativeCursor(5):this.changeNativeCursor(4)}changePointRealTime(){let e=this.image.model.box;this.rightUp.setPosition(e.rightUp),this.leftUp.setPosition(e.leftUp),this.rightLow.setPosition(e.rightLow),this.leftLow.setPosition(e.leftLow),this.top.setPosition(e.rightUp.add(e.leftUp).mul(.5)),this.bottom.setPosition(e.leftLow.add(e.rightLow).mul(.5)),this.left.setPosition(e.leftLow.add(e.leftUp).mul(.5)),this.right.setPosition(e.rightUp.add(e.rightLow).mul(.5))}clearSelectIndex(){this.selectIndex=NaN}getLineModel(e,r){}rotate(e=ce.pcbConfig.rotate){let r=this.image.getParent();if(r!=null&&r.getGroupID()!=null)this.command=new ve("select image"),this.moveTool.rotate(e);else{this.addHistory&&(this.command=new ve("select image"),this.command.addCommand(Te.dispatch(this.image,"modify")),this.addHistory=!1);let i=_s([this.image]);if(i.valid()){let s=i.build1().center();ao.rotate(s,e,[this.image]),this.changePointRealTime()}}}proportionImage(e,r){let i=new S(r.sceneX,r.sceneY);if(this.leftLow.status()){this.changeNativeCursor1(2,this.image.rotation);let n=i.sub(this.curr),s=n.dot(this.horizontalDirect),a=n.dot(this.verticalDirect);if(s!=0&&Math.abs(s)>=Math.abs(a)?(a=(-s+this.oldWidth)/this.ratio-this.oldHeight,this.width=-s+this.oldWidth,this.height=(-s+this.oldWidth)/this.ratio):a!=0&&(s=(a+this.oldHeight)*this.ratio-this.oldWidth,this.width=(a+this.oldHeight)*this.ratio,this.height=a+this.oldHeight),x.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(this.width<d.width&&(this.width=d.width),this.height<d.height&&(this.height=d.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation,u=this.image.model.box.rightUp.add(this.horizontalDirect.mul(-this.width));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.rightLow.status()){this.changeNativeCursor1(3,this.image.rotation);let n=i.sub(this.curr),s=n.dot(this.horizontalDirect),a=n.dot(this.verticalDirect);if(s!=0&&Math.abs(s)>=Math.abs(a)?(a=(s+this.oldWidth)/this.ratio-this.oldHeight,this.width=s+this.oldWidth,this.height=(s+this.oldWidth)/this.ratio):a!=0&&(s=(a+this.oldHeight)*this.ratio-this.oldWidth,this.width=(a+this.oldHeight)*this.ratio,this.height=a+this.oldHeight),x.getInstance().envFlag=="silk-preview"){let u=this.minMum();u&&(this.width<u.width&&(this.width=u.width),this.height<u.height&&(this.height=u.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation;return this.image.rotation=0,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.rightUp.status()){this.changeNativeCursor1(2,this.image.rotation);let n=i.sub(this.curr),s=n.dot(this.horizontalDirect),a=n.dot(this.verticalDirect);if(s!=0&&Math.abs(s)>=Math.abs(a)?(a=(s+this.oldWidth)/this.ratio-this.oldHeight,this.width=s+this.oldWidth,this.height=(s+this.oldWidth)/this.ratio):a!=0&&(s=(-a+this.oldHeight)*this.ratio-this.oldWidth,this.width=(-a+this.oldHeight)*this.ratio,this.height=-a+this.oldHeight),x.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(this.width<d.width&&(this.width=d.width),this.height<d.height&&(this.height=d.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation,u=this.image.model.box.leftLow.add(this.verticalDirect.mul(-this.height));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.leftUp.status()){this.changeNativeCursor1(3,this.image.rotation);let n=i.sub(this.curr),s=n.dot(this.horizontalDirect),a=n.dot(this.verticalDirect);if(s!=0&&Math.abs(s)>=Math.abs(a)?(a=(-s+this.oldWidth)/this.ratio-this.oldHeight,this.width=-s+this.oldWidth,this.height=(-s+this.oldWidth)/this.ratio):a!=0&&(s=(-a+this.oldHeight)*this.ratio-this.oldWidth,this.width=(-a+this.oldHeight)*this.ratio,this.height=-a+this.oldHeight),x.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(this.width<d.width&&(this.width=d.width),this.height<d.height&&(this.height=d.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation,u=this.image.model.box.rightLow.add(this.horizontalDirect.mul(-this.width)).add(this.verticalDirect.mul(-this.height));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.top.status()){this.changeNativeCursor1(0,this.image.rotation);let s=i.sub(this.curr).dot(this.verticalDirect),a=this.mirror,l;if(s!=0&&(l=(-s+this.oldHeight)*this.ratio,this.width=Math.abs(l),this.height=-s+this.oldHeight),x.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(l&&l<d.width&&(this.width=d.width),this.height<d.height&&(this.height=d.height))}(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(a=!a);let h=this.rotation,u=this.bottom.getPosition().add(this.verticalDirect.mul(-this.height)).add(this.horizontalDirect.mul(-(this.width/2)));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=a&&(this.image.mirror=a),this.mirror!=a&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.bottom.status()){this.changeNativeCursor1(0,this.image.rotation);let s=i.sub(this.curr).dot(this.verticalDirect),a;if(s!=0&&(a=(s+this.oldHeight)*this.ratio,this.width=Math.abs(a),this.height=s+this.oldHeight),x.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(a&&a<d.width&&(this.width=d.width),this.height<d.height&&(this.height=d.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation,u=this.top.getPosition().add(this.horizontalDirect.mul(-(this.width/2)));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.right.status()){this.changeNativeCursor1(1,this.image.rotation);let s=i.sub(this.curr).dot(this.horizontalDirect),a;if(s!=0&&(this.width=s+this.oldWidth,a=(s+this.oldWidth)/this.ratio,this.height=Math.abs(a)),x.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(this.width<d.width&&(this.width=d.width),a&&a<d.height&&(this.height=d.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation,u=this.left.getPosition().add(this.verticalDirect.mul(-(this.height/2)));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.left.status()){this.changeNativeCursor1(1,this.image.rotation);let s=i.sub(this.curr).dot(this.horizontalDirect),a;if(s!=0&&(this.width=-s+this.oldWidth,a=(-s+this.oldWidth)/this.ratio,this.height=Math.abs(a)),x.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(this.width<d.width&&(this.width=d.width),a&&a<d.height&&(this.height=d.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation,u=this.right.getPosition().add(this.verticalDirect.mul(-(this.height/2))).add(this.horizontalDirect.mul(-this.width));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}return!1}minMum(){var i,n;let e,r;if(this.image.globalIndex==((i=Kr.QRCode)==null?void 0:i.globalIndex)&&(e=5,r=5),this.image.globalIndex==((n=h0.getInstance().image)==null?void 0:n.globalIndex)&&(e=10,r=3),e&&r){let s=Xs.conversion("mm","mil",e)/10,a=Xs.conversion("mm","mil",r)/10;return{width:s,height:a}}else return null}interrupt(){return this.command.undo(),this.leftLow.remove(),this.rightLow.remove(),this.rightUp.remove(),this.leftUp.remove(),this.top.remove(),this.bottom.remove(),this.left.remove(),this.right.remove(),this.moveTool.interrupt(),this.changeNativeCursor(4),this.removeShiftMoveHelpLine(),!0}flushPoint(){this.changePointRealTime()}};var _de=class extends ws{constructor(e){super();this.addHistory=!0;this.circle=e,this.command=new ve("select screw pillar"),this.moveTool=new Ch([this.circle])}onMouseLeftDown(e){return!1}onMouseMove(e){if(this.circle.locked)return!1;this.addHistory&&(this.command.addCommand(Te.dispatch(this.circle,"modify")),this.addHistory=!1);let r=this.shiftControl(e);if(this.circle.getGroupID()!=null)this.command=new ve("select screw pillar"),this.moveTool.onMouseMove(e);else{if(e.adsorbGrid){let n=this.circle.center.add(r);n=di.adsorpGrid(n),r=n.sub(this.circle.center)}let i=Ae.translate(r.x,r.y,0);this.circle.transform(i)}return!0}onMouseLeftUp(e){return this.command.length>0&&(je.executeCommand(this.command),this.command=new ve("select screw pillar"),A.publish("hasModifyPcbItem",this.circle)),this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}rotate(e=ce.pcbConfig.rotate){this.addHistory&&(this.command=new ve("select screw pillar"),this.command.addCommand(Te.dispatch(this.circle,"modify")),this.addHistory=!1);let r=_s([this.circle]);if(r.valid()){let n=r.build1().center();ao.rotate(n,e,[this.circle])}}interrupt(){var e;return(e=this.command)==null||e.undo(),this.moveTool.interrupt(),this.removeShiftMoveHelpLine(),!0}};var vde=class extends ws{constructor(t){super(),this.rect=t}onMouseLeftDown(t){return!0}onMouseMove(t){return!0}onMouseLeftUp(t){return!0}interrupt(){return!0}onDoubleClick(t){return!0}};function sqe(o){let t=Ve.getSelects(),e=null;if(t.some(i=>{let n=i instanceof mt||i instanceof vt?i.getParent():i;return n.getGroupID()!=null&&(n instanceof Ue||n instanceof Ye)}))return e=new Ch(t),e;if(o==0){let i=t.every(n=>n instanceof Ue);if(t.length>1&&i)ce.changeRepairLineTool?e=new k$(t,!0,!PAe(t)):(t=t.filter(n=>n instanceof Ar),t.length>1&&(e=new N$(t)));else for(let n of t)if(!(n.getParent()!=null&&n instanceof Ye&&n.type=="Prohibited Region"||n.isEmpty))if(n instanceof Ar)ce.changeRepairLineTool?e=new gde(n):e=new PU(n);else if(n instanceof Si)ce.changeRepairLineTool?e=new Ide(n):e=new Tde(n);else if(n instanceof ca)e=new Cde(n);else if(n instanceof ol)e=new Sde(n);else if(n instanceof Sr)e=n.type==="3D Shell - Screw Pillar"?new _de(n):new Sw(n);else if(n instanceof nr)n.type!=="Annotation"?e=new Z_(n):e=new vde(n);else if(n instanceof mt){let s=n.getParent();e=new f2(s,n)}else if(n instanceof vt){let s=n.getParent();s instanceof ct&&(s.onlyOneChilds()!=null?e=new yN(n):e=new f2(s,n))}else if(n instanceof ct){let s=n.onlyOneChilds();s instanceof vt?e=new yN(s):e=new f2(n)}else n instanceof Me?e=new gU(n):n instanceof xa?e=new Ede(n):t.length==1&&n instanceof Le?we.smartMode?e=new eU(n):e=new Pw(n):t.length===1&&n instanceof Ge?e=new yU(n):t.length===1&&n instanceof fr?e=new Ode(n):t.length===1&&n instanceof n0?e=new Ade(n):t.length===1&&n instanceof Nh&&we.smartMode&&(e=new tU(n))}if(t.length>1&&e==null){let i=[],n;t.every(a=>(n=a.model.modelType,n=="Ratline"?!0:n=="ArcTrack"||n=="Track"?(i.push(a),!0):!1))?ce.changeRepairLineTool?e=new k$(i,Ve.isClick,!PAe(i)):e=new N$(i):e=new Ch(t)}return e}var xde=class{constructor(){this._model=3;this.control=null;this.lockedLayers=new Set;this.mouseMoveCheck=!1;this.mouseAltDown=!1;this.hasAlt=!1}get model(){return this._model}set model(t){this._model=t,this.control!=null&&(Mn.getInstance().noControl=!0,this.control.interrupt(),this.control=null),t!=3&&this.autoControlPoint()}getControl(){return this.control}onMouseLeftDown(t){return we.smartMode&&Vs.build()?!0:(this.mouseAltDown=t.altKey,this.control!=null?(Mn.getInstance().noControl=!1,this.mouseMoveCheck=!0,this.control.onMouseLeftDown(t)):!1)}onMouseMove(t){if(this.control!=null){if(this.mouseMoveCheck){this.mouseMoveCheck=!1;let{locked:i,hasItemInLockedLayer:n,items:s}=this.checkLockedItems();if(A.publish("clearDimension",""),n){let a=new _0("Certain layers of the dragged objects have been locked, do you want to unlock the corresponding layers?",()=>{let l=new Array;this.lockedLayers.forEach(c=>{let h=be.getLayer(+c);h.locked=!1,l.push({layerId:+c,locked:!1}),Sp(+c)}),A.publish("layerStatus",l,$())});return A.publish("openMsgbox",a),this.mouseMoveCheck=!0,!0}if(i){let a=Ve.getLastClickPosition();if(s.length==1&&(this.control instanceof Sw&&this.control.selectIndex>=0||this.control instanceof Z_&&this.control.selectIndex>=0||this.control instanceof f2&&this.control.selectIndex[0]>=0))return ls.getInstance().init(s,"item locked, control point move",(c,h)=>{A.publish("toggle",{command:"MOVE_NODE",filterItems:c,inputInfo:a,commands:h.getCommand(),options:{locked:c[0].locked}})}),this.mouseMoveCheck=!0,!0;let l={command:"batchMoveItem",refer:new u2(s,a.x,a.y),menu:"MOVE_BY_REFERENCE_POINT",from:"move-lock"};return A.publish("toggle",l),this.mouseMoveCheck=!0,!0}}let r=!x.getInstance().isReadOnlyMode&&this.control.onMouseMove(t);return r&&(Mn.getInstance().noControl=!1),r}return!1}onMouseUpMove(t){return this.control!=null?!x.getInstance().isReadOnlyMode&&this.control.onMouseUpMove(t):we.smartMode?Vs.move(t):!1}onMouseLeftUp(t){return this.mouseAltDown=!1,this.control!=null?this.control.onMouseLeftUp(t):(Mn.getInstance().noControl=!0,!1)}onMouseWheel(t){return this.control!=null&&t.leftDown&&(this.control instanceof gU||this.control instanceof yU||this.control instanceof Pw)?!x.getInstance().isReadOnlyMode&&this.control.onMouseMove(t):!1}interrupt(){return this.control!=null?(this.mouseMoveCheck=!1,this.control.interrupt()):(Mn.getInstance().noControl=!0,!1)}onKeyDown(t){return this.control!=null?this.control.onKeyDown(t):!1}onMouseRightDown(t){return this.control!=null?this.control.onMouseRightDown(t):!1}onMouseRightUp(t){return this.control!=null?this.control.onMouseRightUp(t):!1}onDoubleClick(t){return this.control!=null?!x.getInstance().isReadOnlyMode&&this.control.onDoubleClick(t):!1}checkLockedItems(){let t=Ve.getSelects(),e=this.control.moveTool,r=this.control.items||e&&e.items||t,i=be.getAllLayer().filter(l=>l.locked).map(l=>l.layerID),n=!1,s=i.length!=0,a=!1;if(this.lockedLayers=new Set,r){let l=new cl(r).items;for(let c of l)if(!a&&c.locked&&(a=!0),!n&&s){let h=c instanceof Ge?12:c.layerId;i.includes(h)&&(n=!0,this.lockedLayers.add(h.toString()))}}return{locked:a,hasItemInLockedLayer:n,items:[...r]}}checkDragItemsIsPolygon(){let t=!1;if(!(this.control instanceof f2)&&!(this.control instanceof Z_))return{dragIsPolygon:t,dragItems:[]};let e=this.control.moveTool,r=this.control.items||e&&e.items,i=this.control.moveStartPoint;return r&&i&&r.forEach(n=>{n instanceof mt||n instanceof vt||n instanceof ct?this.control.isControlPoint()&&(t=!0):n instanceof nr&&this.control.isControlPoint()&&(t=!0)}),t||(r=null),{dragIsPolygon:t,dragItems:r}}autoControlPoint(){this.control=sqe(this._model),this.control!=null&&!we.smartMode&&(this.control.onMouseLeftDown(Pi.getInstance()),this.mouseMoveCheck=!0)}rotate(t){if(this.control!=null)return!x.getInstance().isReadOnlyMode&&this.control.rotate(t)}refresh(){this.model=this.model}};var Rde=class extends wi{constructor(){super(...arguments);this.id=0;this.idMap=new Map;this.highLightNets=new Set;this.clickHighlightRatlines=new Set;this.hoverHighlightRatlines=new Set}addControllerCache(e){let r=this.map.get(e.net);r==null&&(r=new Array,this.map.set(e.net,r)),r.push(e),this.idMap.set(e.globalIndex,e),Vt.insert(e)}addRatlineByModel(e){let r=new _n(e);return this.addControllerCache(r),r}add(e,r,i,n,s){let a="rat"+this.id++,l=PT.getInstance().add(a,e,r,i,n,s),c=new _n(l);return this.addControllerCache(c),c}getRatlineByNetName(e){return this.map.get(e)||[]}highlightByNets(e,r,i){var s;this.clearHighlight(r),(s=be.getLayer(57))!=null&&s.visible&&e.forEach(a=>{this.getRatlineByNetName(a).forEach(l=>{if(l.isVisible&&!l.isEmpty){if(r&&l.isHighLight)return;i?i(l,r):((r?this.hoverHighlightRatlines:this.clickHighlightRatlines).add(l),l.click(r))}})})}clearHighlight(e=!1){this.hoverHighlightRatlines.forEach(r=>{r.isVisible&&!r.isEmpty&&!this.clickHighlightRatlines.has(r)&&r.visible()}),this.hoverHighlightRatlines.clear(),e||(this.clickHighlightRatlines.forEach(r=>{r.isVisible&&!r.isEmpty&&r.visible()}),this.clickHighlightRatlines.clear())}getRatlineLengthByName(e){let r=this.getRatlineByNetName(e),i=0;return r.forEach(n=>i+=n.getLength()),i}getRatlineById(e){return this.idMap.get(e)}highlightNet(e){var n;let r=this.getAllNets();this.highLightNets.add(e);let i=(n=be.getLayer(57))==null?void 0:n.visible;r.forEach(s=>{s.forEach(a=>{a.isEmpty||(i&&this.highLightNets.has(a.net)?(a.visible(),a.color=ee.WHITE):this.bulkHiddenFilterNets||a.hidden())})})}highlightNets(e){var n;let r=this.getAllNets();Re.addAllSet(this.highLightNets,e);let i=(n=be.getLayer(57))==null?void 0:n.visible;r.forEach(s=>{s.forEach(a=>{a.isEmpty||(i&&this.highLightNets.has(a.net)?(a.visible(),a.color=ee.WHITE):this.bulkHiddenFilterNets||a.hidden())})})}unHighlightNet(e){this.highLightNets.delete(e),this.bulkHiddenFilterNets!=null&&this.bulkHiddenFilterNets.has(e)&&(this.bulkHiddenFilterNets.delete(e),this.bulkHiddenFilterNets.size==0&&(this.bulkHiddenFilterNets=null));let r=!1;for(let[i,n]of this.map){let s=te.getInstance().getNet(i),a=!1;this.bulkHiddenFilterNets!=null&&this.bulkHiddenFilterNets.has(i)?r=!0:r=!1,s?a=!0:a=!1,!r&&!Ya.useWebgl?Do.attachViewGroup(n[0].viewGroupId,{visible:a}):n.forEach(l=>{l.isEmpty||(a&&s.showRatline?l.visible():l.hidden(),l.color=null)})}}clearHighlightNet(){this.highLightNets.clear()}removeNetRatlines(e){let r=this.map.get(e);if(r!=null)for(let n of r)n.sendDeleteMsg=!1,n.startNode.clearRatlines(),n.endNode.clearRatlines(),n.remove(),this.idMap.delete(n.globalIndex);PT.getInstance().delete(e);let i=Vt.ratlineMap.get(e);i!=null&&i.recycle(),this.map.delete(e)}unHighlightAll(e){if(this.highLightNets.size>0)return;let r={};this.clearHighlight();let i=[];e?e.forEach(n=>{n instanceof ds&&n.iteratorRatlines(s=>{i.push(s)})}):i=Object.values(Object.fromEntries(this.idMap.entries())),i.forEach(n=>{n.isEmpty?this.idMap.delete(n.globalIndex):(r[n.net]=r[n.net]||te.getInstance().getNet(n.net).showRatline,r[n.net]&&(n.isHighLight||!n.isVisible)&&n.visible())})}getAllNets(){let e=new Array(this.map.size),r=0;for(let i of this.map.values())e[r]=i,r++;return e}bulkUpdatesVisible(e,r){if(e)if(r!=null&&r.size>0&&this.bulkHiddenFilterNets!=null&&this.bulkHiddenFilterNets.size>0)for(let i of r)this.bulkHiddenFilterNets.delete(i);else delete this.bulkHiddenFilterNets;else this.bulkHiddenFilterNets=r||new Set;this.map.forEach((i,n)=>{if(!e&&(r!=null&&r.has(n.toString())))return;let s=e&&!(r!=null&&r.has(n.toString())),a=i[0];a&&Do.attachViewGroup(a.viewGroupId,{visible:s})})}};var B$=class{constructor(t){this.model=t}get name(){return this.model.name}set name(t){this.model.name=t}get showRatline(){return this.model.showRatline}set showRatline(t){this.model.showRatline=t;let e=zo.getRatlineByNetName(this.model.name);this.model.showRatline?e.forEach(r=>{r.visible()}):e.forEach(r=>{r.hidden()}),A.publish("updateFrame","")}get netClass(){return this.model.netClass}set netClass(t){this.model.netClass=t}get netDifferentail(){return this.model.netDifferential}set netDifferentail(t){this.model.netDifferential=t}remove(){this.model.remove()}};var Ci=te.getInstance(),a1=class{constructor(){this.unitConversion=new ft}getDesignRulers(){return{Rule:this.getRulerManager(),Net:this.getNetClassELGroupsData(),NetDifferentails:this.getNetDifferentailData(),NetnetList:this.getBetweenNetList(),Region:this.getRegionData(),constraintRegion:this.getConstraintRegionData(),option:this.getOptions(),ruleTemplateName:Ci.getRuleTemplateName()}}setDesignRulers(t){Ci.defaultRuleMap.clear();let e=t.Rule,r=t.Net,i=t.NetDifferentails,n=t.NetnetList,s=t.Region,a=t.constraintRegion,l=t.RuleTemplateName;this.setRulerManager(e),this.setNetRuler(r),this.setDifferentailRuler(i),this.setEqualLengthGroupRuler(r),this.setBetweenNetList(n),this.setRegionRuler(s),this.setConstraintRegionRuler(a),this.setRuleTemplateName(l),te.getInstance().getMaxSafe(),A.publish("updateExpansion",""),A.publish("updateFrame",""),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),Rie.clear()}setRulerManagerData(t){this.setRulerManager(t)}getOptions(){return be.getSignalLayerOptions()}getRulerManager(){return{Spacing:{"Safe Spacing":this.getSafeSpacingData(),"Other Spacing":this.getOtherSpacingData(),"Creepage Distance":this.getCreepageSpacingData()},Physics:{Track:this.getTrackData(),"Net Length Range":this.getNetLengthData(),"Net Length Tolerance":this.getNetLengthToleranceData(),"Differential Pair":this.getDifferentailData(),"Blind/Buried Via":this.getBlindData(),"Via Size":this.getRadiusData()},Plane:{"Plane Zone":this.getInnerData(),"Copper Zone":this.getCopperData()},Expansion:{"Solder Mask Expansion":this.getSolderData(),"Paste Mask Expansion":this.getPasteData()}}}setRulerManager(t){let e=t.Spacing["Safe Spacing"],r=t.Spacing["Other Spacing"],i=t.Spacing["Creepage Distance"],n=t.Physics.Track,s=t.Physics["Net Length Range"],a=t.Physics["Net Length Tolerance"],l=t.Physics["Differential Pair"],c=t.Physics["Blind/Buried Via"],h=t.Physics["Via Size"],u=t.Plane["Plane Zone"],d=t.Plane["Copper Zone"],p=t.Expansion["Solder Mask Expansion"],m=t.Expansion["Paste Mask Expansion"];this.setSafeSpacingData(e,d),this.setOtherSpacingData(r),this.setCreepageSpacingData(i),this.setTrackData(n),this.setNetLengthData(s),this.setNetLengthToleranceData(a),this.setDifferentailData(l),this.setBlindData(c),this.setRadiusData(h),this.setInnerData(u),this.setCopperData(d),this.setSolderData(p),this.setPasteData(m)}getNetRuler(){return this.getNetData()}getBetweenNetList(){let t=Ci.betweenNetRule,e=[],r=[];for(let i of t.rule){if(i.ruleName!=null||i.safeCopperPlane!=null||i.safeInnerPlane!=null){let n=this.getBetweenNetDataItem(i);n&&e.push(n)}if(i.creepageRule){let n=this.getBetweenNetCreepageDataItem(i);n&&r.push(n)}}return{"Safe Spacing":e,"Creepage Distance":r}}setBetweenNetList(t){let e=this.getBetweenNets(t["Safe Spacing"]),r=this.getBetweenNetsForCreepage(t["Creepage Distance"]),i=new Map;for(let l of e){let c=`${l._net1Type}:${l._net1}|${l._net2Type}:${l._net2}`;i.set(c,{safeRule:l})}for(let l of r){let c=`${l._net1Type}:${l._net1}|${l._net2Type}:${l._net2}`,h=i.get(c);h?h.creepageRule=l:i.set(c,{creepageRule:l})}let n=Ci.betweenNetRule,s=new Set;for(let l of n.rule){let c=`${l._net1Type}:${l._net1}|${l._net2Type}:${l._net2}`;s.add(c)}let a=[];for(let l of s)i.has(l)||a.push(l);for(let l of a){let[c,h]=l.split("|"),[u,d]=c.split(":"),[p,m]=h.split(":"),g=n.getRuleWithType(u,d,p,m);g&&(n.deleteRuleWithType(u,d,p,m),this.deleteBetweenRuleSelector(g.net1,g.net2))}for(let[l,c]of i.entries()){let[h,u]=l.split("|"),[d,p]=h.split(":"),[m,g]=u.split(":"),y=n.getRuleWithType(d,p,m,g);if(y)c.safeRule?(y.ruleName=c.safeRule.ruleName,y.safeCopperPlane=c.safeRule.safeCopperPlane,y.safeInnerPlane=c.safeRule.safeInnerPlane):(y.ruleName=null,y.safeCopperPlane=null,y.safeInnerPlane=null),c.creepageRule?y.creepageRule=c.creepageRule.creepageRule:y.creepageRule=null,x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",y));else{let b=c.safeRule||c.creepageRule,P=new kg(b._net1Type,p,b._net2Type,g);c.safeRule&&(P.ruleName=c.safeRule.ruleName,P.safeCopperPlane=c.safeRule.safeCopperPlane,P.safeInnerPlane=c.safeRule.safeInnerPlane),c.creepageRule&&(P.creepageRule=c.creepageRule.creepageRule),n.addRule(P),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",P))}}}deleteBetweenRuleSelector(t,e){x.getInstance().compiler.deleteRuleSelector([this.getRuleSelect(t),this.getRuleSelect(e)])}getRuleSelect(t){return t instanceof Eu?["NET_CLASS",t.name]:t instanceof Vd?["EQ_LEN_GRP",t.name]:t instanceof bp?["NET",t.name]:[]}getNet(t,e){switch(t){case"net":return Ci.getNet(e);case"netClass":return Ci.getNetClass(e);case"equalLengthGroup":return Ci.getEqualLengthGroup(e);default:return null}}getBetweenNetDataItem(t){let e=t.net1,r=t.net2;if(e==null||r==null)return null;let i={};return e instanceof Eu?i.net1={type:"netClass",name:e.name}:e instanceof Vd?i.net1={type:"equalLengthGroup",name:e.name}:e instanceof bp&&(i.net1={type:"net",name:e.name}),r instanceof Eu?i.net2={type:"netClass",name:r.name}:r instanceof Vd?i.net2={type:"equalLengthGroup",name:r.name}:r instanceof bp&&(i.net2={type:"net",name:r.name}),i.rule=t.ruleName,i.copperRuleName=t.safeCopperPlane,i.planeRuleName=t.safeInnerPlane,i}getBetweenNetCreepageDataItem(t){let e=t.net1,r=t.net2;if(e==null||r==null)return null;let i={};return e instanceof Eu?i.net1={type:"netClass",name:e.name}:e instanceof Vd?i.net1={type:"equalLengthGroup",name:e.name}:e instanceof bp&&(i.net1={type:"net",name:e.name}),r instanceof Eu?i.net2={type:"netClass",name:r.name}:r instanceof Vd?i.net2={type:"equalLengthGroup",name:r.name}:r instanceof bp&&(i.net2={type:"net",name:r.name}),i.rule=t.creepageRule,i}getBetweenNets(t){let e=new Array;for(let r of t){let i=r.net1,n=r.net2,s=r.rule,a=r.copperRuleName,l=r.planeRuleName,c=new kg(i.type,i.name,n.type,n.name);c.ruleName=s,c.safeCopperPlane=a,c.safeInnerPlane=l,e.push(c)}return e}getBetweenNetsForCreepage(t){let e=new Array;for(let r of t){let i=r.net1,n=r.net2,s=r.rule,a=new kg(i.type,i.name,n.type,n.name);a.creepageRule=s,e.push(a)}return e}setNetRuler(t){let e=Ci.getAllNetClass();for(let r of t){let i=r.type;if(i==="netClass"){let n=this.setNetClassInfo(r);e.delete(n)}else i==="net"&&this.setNetInfo(r)}for(let r of e)Ci.deleteNetClass(r.name),x.getInstance().compiler.deleteRuleSelector(["NET_CLASS",r.name])}setDifferentailRuler(t){let e=Ci.getAllNetDifferentials();for(let r of t)if(r.type==="netDifferentail"){let n=this.setNetDifferentailInfo(r);e.delete(n)}for(let r of e)Ci.deleteNetDifferential([r.name]),x.getInstance().compiler.deleteRuleSelector(["DIFF_PAIR",r.name])}setEqualLengthGroupRuler(t){let e=Ci.getAllEqualLengthGroups();for(let r of t){let i=r.type;if(i==="equalLengthGroup"){let n=this.setEqualLengthGroupInfo(r);e.delete(n)}else if(i==="net"){let n=Ci.getNet(r.name);n.equalLengthGroup==null&&(n.netLengthPhysics=r["Net Length Range"],n.netLengthTolerancePhysics=r["Net Length Tolerance"],x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",n)))}}for(let r of e)Ci.deleteEqualLengthGroup(r.name),x.getInstance().compiler.deleteRuleSelector(["EQ_LEN_GRP",r.name])}setRegionRuler(t){if(t==null)return;let e=Ci.getAllCopperPlaneRegions();for(let r of t){let i=r.type,n=this.setRegionInfo(r);e.delete(n)}for(let r of e)Ci.deleteRegion(r.name),x.getInstance().compiler.deleteRuleSelector(["REGION",r.name])}setConstraintRegionRuler(t){if(t==null)return;let e=Ci.getAllConstraintRegions();for(let r of t){let i=this.setConstraintRegionInfo(r);e.delete(i)}for(let r of e)Ci.deleteRegion(r.name),x.getInstance().compiler.deleteRuleSelector(["REGION",r.name])}setRuleTemplateName(t){t!=null&&(Ci.setRuleTemplateName(t),x.getInstance().compiler.uploadRuleTemplate(or.getInstance().encode("RULE_TEMPLATE")))}getNetData(){let t=Ci.getAllNetClass(),e=Ci.getAllNets(),r=new Array;for(let i of t){let n=this.getNetClassInfo(i);r.push(n)}for(let i of e)i.netClass==null&&i.name&&r.push(this.getNetInfo(i));return r}getNetClassELGroupsData(){let t=Ci.getAllNetClass(),e=Ci.getAllEqualLengthGroups(),r=Ci.getAllNets(),i=new Array;for(let n of t){let s=this.getNetClassInfo(n);i.push(s)}for(let n of e){let s=this.getEqualLengthGroupInfo(n);i.push(s)}for(let n of r)n.netClass==null&&n.equalLengthGroup==null&&n.name&&i.push(this.getNetInfo(n));return i}getRegionData(){let t=Ci.getAllCopperPlaneRegions(),e=new Array;for(let r of t){let i=this.getRegionInfo(r);i&&e.push(i)}return e}getConstraintRegionData(){let t=Ci.getAllConstraintRegions(),e=new Array;for(let r of t){let i=this.getConstraintRegionInfo(r);i&&e.push(i)}return e}getNetDifferentailData(){let t=Ci.getAllNetDifferentials(),e=Ci.getAllNets(),r=new Array;for(let i of t){let n=this.getNetDifferentailInfo(i);r.push(n)}for(let i of e)i.netDifferential==null&&i.name&&r.push(this.getNetInfo(i));return r}getEqualLengthGroupData(){let t=Ci.getAllEqualLengthGroups(),e=Ci.getAllNets(),r=new Array;for(let i of t){let n=this.getEqualLengthGroupInfo(i);r.push(n)}for(let i of e)i.equalLengthGroup==null&&i.name&&r.push(this.getNetInfo(i));return r}getNetClassInfo(t){let e=t.getAllNets(),r=new Array;for(let i of e)r.push(this.getNetInfo(i));return{type:"netClass",name:t.name,"Safe Spacing":t.safeSpacing,"Copper Safe Spacing":t.safeCopperPlane,"Plane Safe Spacing":t.safeInnerPlane,Track:t.trackPhysics,"Blind/Buried Via":t.blindViaPhysics,"Via Size":t.radiusPhysics,"Plane Zone":t.innerPlane,"Copper Zone":t.copperPlane,"Solder Mask Expansion":t.solderExpansion,"Paste Mask Expansion":t.pasteExpansion,"Net Length Range":t.netLengthPhysics,"Net Length Tolerance":t.netLengthTolerancePhysics,targetNet:t.targetNet,sub:r,"Creepage Distance":t.creepageSpacing}}setNetClassInfo(t){let e=t.name,r=t["Safe Spacing"],i=t["Copper Safe Spacing"],n=t["Plane Safe Spacing"],s=t.Track,a=t["Blind/Buried Via"],l=t["Via Size"],c=t["Plane Zone"],h=t["Copper Zone"],u=t["Solder Mask Expansion"],d=t["Paste Mask Expansion"],p=t["Net Length Range"],m=t["Net Length Tolerance"],g=t["Creepage Distance"],y=t.sub,b=Ci.getNetClass(e);b==null&&(b=Ci.addNetClass(e)),b.safeSpacing=r,b.safeCopperPlane=i,b.safeInnerPlane=n,b.trackPhysics=s,b.blindViaPhysics=a,b.radiusPhysics=l,b.innerPlane=c,b.copperPlane=h,b.solderExpansion=u,b.pasteExpansion=d,b.netLengthPhysics=p,b.netLengthTolerancePhysics=m,b.creepageSpacing=g,b.targetNet=t.targetNet,b.remove();for(let P of y){let T=P.name,I=Ci.getNet(T);I!=null&&(I.safeSpacing=P["Safe Spacing"],I.safeCopperPlane=P["Copper Safe Spacing"],I.safeInnerPlane=P["Plane Safe Spacing"],I.trackPhysics=P.Track,I.blindViaPhysics=P["Blind/Buried Via"],I.radiusPhysics=P["Via Size"],I.innerPlane=P["Plane Zone"],I.copperPlane=P["Copper Zone"],I.solderExpansion=P["Solder Mask Expansion"],I.pasteExpansion=P["Paste Mask Expansion"],I.netLengthPhysics=P["Net Length Range"],I.netLengthTolerancePhysics=P["Net Length Tolerance"],I.targetNet=P.targetNet,I.creepageSpacing=P["Creepage Distance"]),b.addNetwork(I),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",I)),x.getInstance().compiler.uploadNet(T,or.getInstance().encode("NET",I))}return x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",b)),b}getNetDifferentailInfo(t){let e=t.getAllNets(),r=new Array;for(let i of e)i.isPositiveNet?r.unshift({name:i.name,type:"net","Differential Pair":i.differentialPhysics}):r.push({name:i.name,type:"net","Differential Pair":i.differentialPhysics});return{type:"netDifferentail",name:t.name,"Differential Pair":t.differentialPhysics,sub:r}}setNetDifferentailInfo(t){let e=t.name,r=t["Differential Pair"],i=t.sub,n=Ci.getNetDifferential(e);n==null&&(n=Ci.addNetDifferential(e,i[0].name,i[1].name)),n.differentialPhysics=r,n.remove();for(let s=0;s<i.length;s++){let a=i[s].name,l=Ci.getNet(a);l!=null&&(l.differentialPhysics=r),s==0?n.fillPositiveNet(l):n.fillNegativeNet(l),x.getInstance().compiler.uploadNet(a,or.getInstance().encode("NET",l)),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",l))}return x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",n)),n}getEqualLengthGroupInfo(t){let e=t.getAllNets(),r=new Array;for(let i of e)r.push(this.getNetInfo(i));return{type:"equalLengthGroup",name:t.name,"Safe Spacing":t.safeSpacing,"Copper Safe Spacing":t.safeCopperPlane,"Plane Safe Spacing":t.safeInnerPlane,Track:t.trackPhysics,"Blind/Buried Via":t.blindViaPhysics,"Via Size":t.radiusPhysics,"Plane Zone":t.innerPlane,"Copper Zone":t.copperPlane,"Solder Mask Expansion":t.solderExpansion,"Paste Mask Expansion":t.pasteExpansion,"Net Length Range":t.netLengthPhysics,"Net Length Tolerance":t.netLengthTolerancePhysics,"Creepage Distance":t.creepageSpacing,targetNet:t.targetNet,sub:r}}setEqualLengthGroupInfo(t){let e=t.name,r=t["Safe Spacing"],i=t["Copper Safe Spacing"],n=t["Plane Safe Spacing"],s=t.Track,a=t["Blind/Buried Via"],l=t["Via Size"],c=t["Plane Zone"],h=t["Copper Zone"],u=t["Solder Mask Expansion"],d=t["Paste Mask Expansion"],p=t["Net Length Range"],m=t["Net Length Tolerance"],g=t["Creepage Distance"],y=t.sub,b=Ci.getEqualLengthGroup(e);b==null&&(b=Ci.addEqualLengthGroup(e)),b.safeSpacing=r,b.safeCopperPlane=i,b.safeInnerPlane=n,b.trackPhysics=s,b.blindViaPhysics=a,b.radiusPhysics=l,b.innerPlane=c,b.copperPlane=h,b.solderExpansion=u,b.pasteExpansion=d,b.netLengthPhysics=p,b.netLengthTolerancePhysics=m,b.creepageSpacing=g,b.targetNet=t.targetNet,b.remove();for(let P of y){let T=P.name,I=Ci.getNet(T);I!=null&&(I.safeSpacing=P["Safe Spacing"],I.safeCopperPlane=P["Copper Safe Spacing"],I.safeInnerPlane=P["Plane Safe Spacing"],I.trackPhysics=P.Track,I.blindViaPhysics=P["Blind/Buried Via"],I.radiusPhysics=P["Via Size"],I.innerPlane=P["Plane Zone"],I.copperPlane=P["Copper Zone"],I.solderExpansion=P["Solder Mask Expansion"],I.pasteExpansion=P["Paste Mask Expansion"],I.netLengthPhysics=P["Net Length Range"],I.netLengthTolerancePhysics=P["Net Length Tolerance"],I.targetNet=P.targetNet,I.creepageSpacing=P["Creepage Distance"]),b.addEqualLengthGroup(I),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",I)),x.getInstance().compiler.uploadNet(T,or.getInstance().encode("NET",I)),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",I))}return x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",b)),b}setNetInfo(t){let e=t.name,r=t["Safe Spacing"],i=t["Copper Safe Spacing"],n=t["Plane Safe Spacing"],s=t.Track,a=t["Net Length Range"],l=t["Net Length Tolerance"],c=t["Blind/Buried Via"],h=t["Via Size"],u=t["Plane Zone"],d=t["Copper Zone"],p=t["Solder Mask Expansion"],m=t["Paste Mask Expansion"],g=t["Creepage Distance"],y=Ci.getNet(e);return y!=null&&(y.safeSpacing=r,y.safeCopperPlane=i,y.safeInnerPlane=n,y.trackPhysics=s,y.netLengthPhysics=a,y.netLengthTolerancePhysics=l,y.blindViaPhysics=c,y.radiusPhysics=h,y.innerPlane=u,y.copperPlane=d,y.solderExpansion=p,y.pasteExpansion=m,y.creepageSpacing=g),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",y)),x.getInstance().compiler.uploadNet(e,or.getInstance().encode("NET",y)),y}getNetInfo(t){return{type:"net",name:t.name,"Safe Spacing":t.safeSpacing,"Copper Safe Spacing":t.safeCopperPlane,"Plane Safe Spacing":t.safeInnerPlane,Track:t.trackPhysics,"Net Length Range":t.netLengthPhysics,"Net Length Tolerance":t.netLengthTolerancePhysics,"Blind/Buried Via":t.blindViaPhysics,"Via Size":t.radiusPhysics,"Plane Zone":t.innerPlane,"Copper Zone":t.copperPlane,"Solder Mask Expansion":t.solderExpansion,"Paste Mask Expansion":t.pasteExpansion,"Creepage Distance":t.creepageSpacing,targetNet:t.targetNet}}getRegionInfo(t){return{type:"region",name:t.name,"Plane Zone":t.innerPlane,"Copper Zone":t.copperPlane,"Safe Spacing":t.safeClearance,"Creepage Distance":t.creepageClearance}}getConstraintRegionInfo(t){let e=pc(t.name);if(e==null||e.type!=="Constraint Region")return null;let r=e.component;return{type:"region",name:e.globalIndex,constraintName:r.name,"Safe Spacing":t.safeClearance,"Copper Safe Spacing":t.safeCopperPlane,"Plane Safe Spacing":t.safeInnerPlane,"Other Spacing":t.otherClearance,Track:t.track,"Differential Pair":t.diff,"Via Size":t.radius,"Plane Zone":t.innerPlane,"Copper Zone":t.copperPlane,"Creepage Distance":t.creepageClearance}}setRegionInfo(t){let e=t.name,r=t["Plane Zone"];Array.from(Ci.getAllInnerPlane()).some(d=>d.name==r)||(r="default");let n=t["Copper Zone"];Array.from(Ci.getAllCopperPlane()).some(d=>d.name==n)||(n="default");let a=t["Safe Spacing"];Array.from(Ci.getAllSafeSpacing()).some(d=>d.name==a)||(a="default");let c=t["Creepage Distance"];Array.from(Ci.getAllCreepageSpacing()).some(d=>d.name==c)||(c="default");let u=Ci.getRegion(e);return u!=null&&(u.innerPlane=r,u.copperPlane=n,u.safeClearance=a),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",u)),u}setConstraintRegionInfo(t){let e=Ci.getRegion(t.name);if(e==null)return null;let r={safeClearance:t["Safe Spacing"],safeCopperPlane:t["Copper Safe Spacing"],safeInnerPlane:t["Plane Safe Spacing"],otherClearance:t["Other Spacing"],track:t.Track,diff:t["Differential Pair"],radius:t["Via Size"],innerPlane:t["Plane Zone"],copperPlane:t["Copper Zone"],creepageClearance:t["Creepage Distance"]};Ci.updateRegionSelector(e.name,r);let n=pc(t.name).component;return n.name=t.constraintName,x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",e)),e}getSafeSpacingData(){let t=Ci.getAllSafeSpacing(),e={},r=(i,n)=>i.map(s=>s.map(a=>this.fromMil(n,a*10)));for(let i of t){let n={};n.editName=i.name,n.unit=i.unit,n.isSetDefault=i.isDefault,n.column=i.getRowLabel(),n.row=i.getColLabel(),n.status=i.status;let s=i.toJSON();n.tables={},s.forEach((a,l)=>{let c=r(a.table,i.unit);n.tables[l]={status:a.layerState,content:c}}),e[i.name]=n}return e}setSafeSpacingData(t,e){let r=this.ruleSet2Map(Ci.getAllSafeSpacing()),i=Object.values(e).find(n=>n.isSetDefault);for(let n in t){let s=t[n],a=s.unit,l=s.isSetDefault,c=s.tables,h=c[1].content,u=s.status,d=Ci.getSafeSpacing(n);if(h.length==8){s.row=["Track","SMD Pad","TH Pad","Via","Fill Region/Teardrop","Slot Region","Line","Text/Image","Board Outline","Hole"],s.column=["Track","SMD Pad","TH Pad","Via","Fill Region/Teardrop","Slot Region","Line","Text/Image","Board Outline"],h.splice(1,0,h[1].slice(0));for(let g=2;g<h.length;g++)h[g].splice(1,0,h[g][1]);h.push([].concat([h[1][0]],h.slice(1).map(g=>g[1])))}if(h.length==10){s.row=["Track","SMD Pad","TH Pad","SMD Test Point","TH Test Point","Via","Fill Region/Teardrop","Copper/Plane Zone","Slot Region","Line","Text/Image","Board Outline","Hole"],s.column=["Track","SMD Pad","TH Pad","SMD Test Point","TH Test Point","Via","Fill Region/Teardrop","Copper/Plane Zone","Slot Region","Line","Text/Image","Board Outline"],h.splice(3,0,[...h[1],h[2][1],h[1][1]],[...h[2],h[2][1],h[2][2]]);for(let g=5;g<h.length;g++)h[g].splice(3,0,h[g][1],h[g][2]);h.splice(7,0,Array(8).fill(i.form.networkSpacing));for(let g=8;g<h.length;g++)h[g].splice(7,0,i.form.networkSpacing);h[8][7]=i.form.distance2Border,h[11][7]=i.form.distance2Border}d==null&&(d=Ci.addSafeSpacing(n)),r.delete(d.name),d.unit=a,d.isDefault=l,d.status=u;let p=new Map,m=new Map;for(let g in c){let y=c[g],b=y.content.map(P=>P.map(T=>{let I=T/10;return a!="mil"&&(I=this.unitConversion.conversion(a,"mil",I)),I}));p.set(+g,b),m.set(+g,y.status)}d.overWriteTables(new qa(p,m)),x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",d))}for(let[n]of r)Ci.deleteSafeSpacing(n),x.getInstance().compiler.deleteRule(mm("1"),n)}getOtherSpacingData(){let t=Ci.getAllOtherSpacing(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault;let n=r.clearances,s=n[0]*10;s=this.fromMil(r.unit,s);let a=n[1]*10;a=this.fromMil(r.unit,a);let l=n[2]*10;l=this.fromMil(r.unit,l),i.form={device2device:s,thru2Smd:a,hole2Hole:l},e[r.name]=i}return e}setOtherSpacingData(t){let e=this.ruleSet2Map(Ci.getAllOtherSpacing());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form.device2device/10;a=this.toMil(n,a);let l=i.form.thru2Smd/10||0;l=this.toMil(n,l);let c=i.form.hole2Hole!=null?i.form.hole2Hole/10:this.toMil(n,.3);c=this.toMil(n,c);let h=Ci.getOtherSpacing(r);h==null&&(h=Ci.addOtherSpacing(r)),e.delete(h.name),h.unit=n,h.isDefault=s,h.clearances=[a,l,c],x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",h))}for(let[r]of e)Ci.deleteOtherSpacing(r),x.getInstance().compiler.deleteRule(mm("2"),r)}getCreepageSpacingData(){let t=Ci.getAllCreepageSpacing(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault;let s=r.creepageDistance*10;s=this.fromMil(r.unit,s);let a=r.ignoreLayer;i.form={creepageDistance:s,ignoreLayer:a},e[r.name]=i}return e}setCreepageSpacingData(t){let e=this.ruleSet2Map(Ci.getAllCreepageSpacing());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form.creepageDistance/10,l=i.form.ignoreLayer;a=this.toMil(n,a);let c=Ci.getCreepageSpacing(r);c==null&&(c=Ci.addCreepageSpacing(r)),e.delete(c.name),c.unit=n,c.isDefault=s,c.creepageDistance=a,c.ignoreLayer=l,x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",c));for(let[h]of e)Ci.deleteCreepageSpacing(h),x.getInstance().compiler.deleteRule(mm("14"),h)}}fromMil(t,e){return t!="mil"&&(e=this.unitConversion.conversion("mil",t,e)),e}toMil(t,e){return t!="mil"&&(e=this.unitConversion.conversion(t,"mil",e)),e}getTrackData(){let t=Ci.getAllTrackPhysics(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={status:r.getLayerStatus(),data:{}};for(let[n,s]of r.toJSON())i.form.data[n]={minValue:this.fromMil(r.unit,s.minValue*10),defaultValue:this.fromMil(r.unit,s.defaultValue*10),maxValue:this.fromMil(r.unit,s.maxValue*10)};e[r.name]=i}return e}setTrackData(t){let e=this.ruleSet2Map(Ci.getAllTrackPhysics());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form.data,l=i.form.status,c=Ci.getTrackPhysics(r);c==null&&(c=Ci.addTrackPhysics(r)),e.delete(c.name),c.unit=n,c.isDefault=s,c.setLayerStatus(l);let h=new Map;for(let u in a){let d=a[u];h.set(+u,{minValue:this.toMil(n,d.minValue/10),defaultValue:this.toMil(n,d.defaultValue/10),maxValue:this.toMil(n,d.maxValue/10)})}c.overWriteTables(new qa(h)),x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",c))}for(let[r]of e)Ci.deleteTrackPhysics(r),x.getInstance().compiler.deleteRule(mm("3"),r);A.publish("flushSelectingInfo","")}getNetLengthData(){let t=Ci.getAllNetLengthPhysics(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={netLengthMin:this.fromMil(r.unit,r.netLengthMin*10),netLengthMax:this.fromMil(r.unit,r.netLengthMax*10)},e[r.name]=i}return e}setNetLengthData(t){let e=this.ruleSet2Map(Ci.getAllNetLengthPhysics());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form,l=a.netLengthMin/10,c=a.netLengthMax/10,h=Ci.getNetLengthPhysics(r);h==null&&(h=Ci.addNetLengthPhysics(r)),e.delete(h.name),h.unit=n,h.isDefault=s,h.netLengthMin=this.toMil(n,l),h.netLengthMax=this.toMil(n,c),x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",h))}for(let[r]of e)Ci.deleteNetLengthPhysics(r),x.getInstance().compiler.deleteRule(mm("11"),r);A.publish("netLengthRuleChanged","")}getNetLengthToleranceData(){let t=Ci.getAllNetLengthTolerancePhysics(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={netLengthTolerance:this.fromMil(r.unit,r.netLengthTolerance*10)},e[r.name]=i}return e}setNetLengthToleranceData(t){let e=this.ruleSet2Map(Ci.getAllNetLengthTolerancePhysics());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,l=i.form.netLengthTolerance/10,c=Ci.getNetLengthTolerancePhysics(r);c==null&&(c=Ci.addNetLengthTolerancePhysics(r)),e.delete(c.name),c.unit=n,c.isDefault=s,c.netLengthTolerance=this.toMil(n,l),x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",c))}for(let[r]of e)Ci.deleteNetLengthTolerancePhysics(r),x.getInstance().compiler.deleteRule(mm("13"),r);A.publish("netLengthRuleChanged","")}getDifferentailData(){let t=Ci.getAllDifferentialPhysics(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={};let n=r.toJSON();for(let s in n){let a=n[s];i.form[s]={status:a.status,data:{}};for(let[l,c]of a.tables)i.form[s].data[l]={minValue:this.fromMil(r.unit,c.minValue*10),defaultValue:this.fromMil(r.unit,c.defaultValue*10),maxValue:c.maxValue==null?null:this.fromMil(r.unit,c.maxValue*10)}}i.form.differentailPairLenTolerMax=this.fromMil(r.unit,r.differentialPairLenTolerMax*10),e[r.name]=i}return e}setDifferentailData(t){let e=this.ruleSet2Map(Ci.getAllDifferentialPhysics());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form,l=Ci.getDifferentialPhysics(r);l==null&&(l=Ci.addDifferentialPhysics(r)),e.delete(l.name),l.unit=n,l.isDefault=s;for(let[c,h]of[[1,"diffPairSpacingTables"],[0,"strokeWidthTables"]]){let u=new Map,d=a[h].data;l.setLayerStatus(c,a[h].status);for(let p in d){let m=d[p];u.set(+p,{minValue:this.toMil(n,m.minValue/10),defaultValue:this.toMil(n,m.defaultValue/10),maxValue:m.maxValue==null?null:this.toMil(n,m.maxValue/10)})}l.overWriteTables(c,new qa(u))}l.differentialPairLenTolerMax=this.toMil(n,a.differentailPairLenTolerMax/10),x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",l))}for(let[r]of e)Ci.deleteDifferentialPhysics(r),x.getInstance().compiler.deleteRule(mm("10"),r)}getBlindData(){let t=zie(),e={};for(let r of t){let i={};i.editName=r.name,i.isSetDefault=r.isDefault,i.table=r.data,e[r.name]=i}return e}setBlindData(t){let e=this.batchModifyVias(t),r=this.ruleSet2Map(Ci.getAllBlindPhysics());for(let i in t){let n=t[i],s=n.isSetDefault,a=n.table,l=Ci.getBlindPhysics(i);l==null&&(l=Ci.addBlindPhysics(i)),r.delete(l.name),l.isDefault=s,l.data=a,x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",l))}for(let[i]of r)Ci.deleteBlindPhysics(i),x.getInstance().compiler.deleteRule(mm("4"),i);JXe(),e&&A.publish("flushService","")}batchModifyVias(t){let e=new ve("Synchronize Rule, Batch modify Vias"),r=ZXe();for(let i in t){let s=t[i].table,a=Ci.getBlindPhysics(i);if(a==null)continue;let l=r[i];if(l!=null)for(let c of s){let h=c.key,u=a.map.get(h);if(u==null)continue;let d=c.name,p=parseInt(c.startLayer),m=parseInt(c.endLayer),g=!1;u.name!=d&&(g=!0);let y=!1;u.startLayer==p&&u.endLayer==m||u.startLayer==m&&u.endLayer==p||(g=!0,y=!0);let b=l[u.name];if(b!=null&&g)for(let P of b)e.addCommand(Te.dispatch(P,"modify")),P.name=d,y&&(P.viaBaseInfo=Ea.getViaBaseInfo(p,m,P.radius,P.holeRadius),A.publish("hasModifyPcbItem",P))}}if(e.length>0)return je.executeCommand(e),!0}getRadiusData(){let t=Ci.getAllRadiusPhysics(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={viaOuterdiameterMin:this.fromMil(r.unit,r.minRadius*20),viaOuterdiameterMax:this.fromMil(r.unit,r.maxRadius*20),viaOuterdiameterDefault:this.fromMil(r.unit,r.defalutRadius*20),viaInnerdiameterMin:this.fromMil(r.unit,r.minInner*20),viaInnerdiameterMax:this.fromMil(r.unit,r.maxInner*20),viaInnerdiameterDefault:this.fromMil(r.unit,r.defalutInner*20)},e[r.name]=i}return e}setRadiusData(t){let e=this.ruleSet2Map(Ci.getAllRadiusPhysics());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form,l=a.viaOuterdiameterMin/20,c=a.viaOuterdiameterMax/20,h=a.viaOuterdiameterDefault/20,u=a.viaInnerdiameterMin/20,d=a.viaInnerdiameterMax/20,p=a.viaInnerdiameterDefault/20,m=Ci.getRadiusPhysics(r);m==null&&(m=Ci.addRadiusPhysics(r)),e.delete(m.name),m.unit=n,m.isDefault=s,m.minRadius=this.toMil(n,l),m.maxRadius=this.toMil(n,c),m.defalutRadius=this.toMil(n,h),m.minInner=this.toMil(n,u),m.maxInner=this.toMil(n,d),m.defalutInner=this.toMil(n,p),x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",m))}for(let[r]of e)Ci.deleteRadiusPhysics(r),x.getInstance().compiler.deleteRule(mm("5"),r);A.publish("flushSelectingInfo","")}getInnerData(){let t=Ci.getAllInnerPlane(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={status:r.getLayerStatus(),data:{}};let n=r.toJSON();for(let[s,a]of n.tables)i.form.data[s]={connectMode:a.connectMode,lineClearance:this.fromMil(r.unit,a.lineClearance*10),lineWidth:this.fromMil(r.unit,a.lineWidth*10),lineAngle:xe(r.getMultiLineAngle(s)/Math.PI*180,3)};e[r.name]=i}return e}setInnerData(t){let e=this.ruleSet2Map(Ci.getAllInnerPlane());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form.data,l=i.form.status,c=Ci.getInnerPlane(r);c==null&&(c=Ci.addInnerPlane(r)),e.delete(c.name),c.unit=n,c.isDefault=s,c.setLayerStatus(l);let h=new Map;for(let u in a){let d=a[u];h.set(+u,{connectMode:Number(d.connectMode),lineClearance:this.toMil(n,d.lineClearance/10),lineWidth:this.toMil(n,d.lineWidth/10),lineAngle:parseFloat(d.lineAngle)/180*Math.PI})}c.overWriteTables(new qa(h)),x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",c))}for(let[r]of e)Ci.deleteInnerPlane(r),x.getInstance().compiler.deleteRule(mm("6"),r)}getCopperData(){let t=Ci.getAllCopperPlane(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={};let n=r.toJSON();for(let s in n){let a=n[s];i.form[s]={status:a.status,data:{}};for(let[l,c]of a.tables)s!=="trackConnectModel"?i.form[s].data[l]={connectMode:c.connectMode,lineClearance:this.fromMil(r.unit,c.lineClearance*10),lineWidth:this.fromMil(r.unit,c.lineWidth*10),lineAngle:xe((s=="singleLayerPadModel"?r.getSingleLineAngle(l):r.getMultiLineAngle(l))/Math.PI*180,3)}:i.form[s].data[l]={trackConnectMode:c}}e[r.name]=i}return e}setCopperData(t){let e=this.ruleSet2Map(Ci.getAllCopperPlane());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form,l=Ci.getCopperPlane(r);l==null&&(l=Ci.addCopperPlane(r)),e.delete(l.name),l.unit=n,l.isDefault=s;for(let[c,h]of[[0,"singleLayerPadModel"],[1,"multiLayerPadModel"],[2,"trackConnectModel"]]){let u=new Map,d=a[h].data;l.setLayerStatus(c,a[h].status);for(let p in d){let m=d[p];h!=="trackConnectModel"?u.set(+p,{connectMode:Number(m.connectMode),lineClearance:this.process(this.toMil(n,m.lineClearance/10)),lineWidth:this.process(this.toMil(n,m.lineWidth/10)),lineAngle:parseFloat(m.lineAngle)/180*Math.PI}):u.set(+p,Number(m.trackConnectMode))}l.overWriteTables(new qa(u),c)}x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",l))}for(let[r]of e)Ci.deleteCopperPlane(r),x.getInstance().compiler.deleteRule(mm("7"),r)}process(t){return t>=0?t:0}getSolderData(){let t=Ci.getAllSolderExpansion(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={padToplayerExpansion:this.fromMil(r.unit,r.padTopExpansion*10),padBottomlayerExpansion:this.fromMil(r.unit,r.padBottomExpansion*10),viaToplayerExpansion:this.fromMil(r.unit,r.viaTopExpansion*10),viaBottomlayerExpansion:this.fromMil(r.unit,r.viaBottomExpansion*10),testPointToplayerExpansion:this.fromMil(r.unit,r.testPointTopExpansion*10),testPointBottomlayerExpansion:this.fromMil(r.unit,r.testPointBottomExpansion*10)},e[r.name]=i}return e}setSolderData(t){let e=this.ruleSet2Map(Ci.getAllSolderExpansion());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form,l=a.padToplayerExpansion/10,c=a.padBottomlayerExpansion/10,h=a.viaToplayerExpansion/10,u=a.viaBottomlayerExpansion/10,d=a.testPointToplayerExpansion/10,p=a.testPointBottomlayerExpansion/10,m=Ci.getSolderExpansion(r);m==null&&(m=Ci.addSolderExpansion(r)),e.delete(m.name),m.unit=n,m.isDefault=s,m.padTopExpansion=this.toMil(n,l),m.padBottomExpansion=this.toMil(n,c),m.viaTopExpansion=this.toMil(n,h),m.viaBottomExpansion=this.toMil(n,u),m.testPointTopExpansion=this.toMil(n,d),m.testPointBottomExpansion=this.toMil(n,p),x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",m))}for(let[r]of e)Ci.deleteSolderExpansion(r),x.getInstance().compiler.deleteRule(mm("9"),r)}getPasteData(){let t=Ci.getAllPasteExpansion(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={padToplayerExpansion:this.fromMil(r.unit,r.padTopExpansion*10),padBottomlayerExpansion:this.fromMil(r.unit,r.padBottomExpansion*10),testPointToplayerExpansion:this.fromMil(r.unit,r.testPointTopExpansion*10),testPointBottomlayerExpansion:this.fromMil(r.unit,r.testPointBottomExpansion*10)},e[r.name]=i}return e}setPasteData(t){let e=this.ruleSet2Map(Ci.getAllPasteExpansion());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form,l=a.padToplayerExpansion/10,c=a.padBottomlayerExpansion/10,h=a.testPointToplayerExpansion/10,u=a.testPointBottomlayerExpansion/10,d=Ci.getPasteExpansion(r);d==null&&(d=Ci.addPasteExpansion(r)),e.delete(d.name),d.unit=n,d.isDefault=s,d.padTopExpansion=this.toMil(n,l),d.padBottomExpansion=this.toMil(n,c),d.testPointTopExpansion=this.toMil(n,h),d.testPointBottomExpansion=this.toMil(n,u),x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",d))}for(let[r]of e)Ci.deletePasteExpansion(r),x.getInstance().compiler.deleteRule(mm("8"),r)}ruleSet2Map(t){let e=new Map;for(let r of t)e.set(r.name,r);return e}};var Dde=class{async initRuleData(){let t=await A.windowBridge.rpcCall("getUsrPcbProcessConfigProfile","",$());if(te.getInstance().deleteAll(),!t.message)return this.twoLayersBoard();let e=t.message.defaultPcbProcessConfigProfile,r=t.message.config.find(i=>i.name==e);try{if(r){new a1().setRulerManagerData(r.config),te.getInstance().setRuleTemplateName(e);return}}catch{e=null}switch(e){case qb.TWO_LAYERS_BOARD:this.twoLayersBoard();break;case qb.SINGLE_LAYER_BOARD:this.singleLayerBoard();break;case qb.MULTIPLE_LAYERS_BOARD:this.multipleLayersBoard();break;case qb.HIGH_FREQUENCY_BOARD:this.highFrequencyBoard();break;case qb.ALUMINUM_SUBSTRATE_BOARD:this.aluminumSubstrateBoard();break;case qb.COPPER_SUBSTRATE_BOARD:this.copperSubstrateBoard();break;default:this.twoLayersBoard();break}}twoLayersBoard(){this.initSafeSpacing(),this.initOtherSpacing(),this.initTrackPhysics(),this.initDifferentailPhysics(),this.initNetLengthPhysics(),this.initNetLengthTolerancePhysics(),this.initBlindPhysics(),this.initRadiusPhysics(),this.initInnerPlane(),this.initCopperPlane(),this.initSolderExpansion(),this.initPasteExpansion(),te.getInstance().setRuleTemplateName(qb.TWO_LAYERS_BOARD)}singleLayerBoard(){this.initSafeSpacing(),this.initOtherSpacing(),this.initTrackPhysics1(),this.initDifferentailPhysics(),this.initNetLengthPhysics(),this.initNetLengthTolerancePhysics(),this.initBlindPhysics(),this.initRadiusPhysics1(),this.initInnerPlane(),this.initCopperPlane(),this.initSolderExpansion(),this.initPasteExpansion(),te.getInstance().setRuleTemplateName(qb.SINGLE_LAYER_BOARD)}multipleLayersBoard(){this.initSafeSpacing("multi"),this.initOtherSpacing(),this.initTrackPhysics1("multi"),this.initDifferentailPhysics(),this.initNetLengthPhysics(),this.initNetLengthTolerancePhysics(),this.initBlindPhysics(),this.initRadiusPhysics2(),this.initInnerPlane(),this.initCopperPlane(),this.initSolderExpansion(),this.initPasteExpansion(),te.getInstance().setRuleTemplateName(qb.MULTIPLE_LAYERS_BOARD)}highFrequencyBoard(){this.initSafeSpacing1(),this.initOtherSpacing(),this.initTrackPhysics2(),this.initDifferentailPhysics(),this.initNetLengthPhysics(),this.initNetLengthTolerancePhysics(),this.initBlindPhysics(),this.initRadiusPhysics3(),this.initInnerPlane(),this.initCopperPlane(),this.initSolderExpansion(),this.initPasteExpansion(),te.getInstance().setRuleTemplateName(qb.HIGH_FREQUENCY_BOARD)}aluminumSubstrateBoard(){this.initSafeSpacing1(),this.initOtherSpacing(),this.initTrackPhysics2(),this.initDifferentailPhysics(),this.initNetLengthPhysics(),this.initNetLengthTolerancePhysics(),this.initBlindPhysics(),this.initRadiusPhysics4(),this.initInnerPlane(),this.initCopperPlane(),this.initSolderExpansion(),this.initPasteExpansion(),te.getInstance().setRuleTemplateName(qb.ALUMINUM_SUBSTRATE_BOARD)}copperSubstrateBoard(){this.initSafeSpacing1(),this.initOtherSpacing(),this.initTrackPhysics2(),this.initDifferentailPhysics(),this.initNetLengthPhysics(),this.initNetLengthTolerancePhysics(),this.initBlindPhysics(),this.initRadiusPhysics4(),this.initInnerPlane(),this.initCopperPlane(),this.initSolderExpansion(),this.initPasteExpansion(),te.getInstance().setRuleTemplateName(qb.COPPER_SUBSTRATE_BOARD)}initSafeSpacing(t){let e=te.getInstance().addSafeSpacing("copperThickness1oz",!0);e.unit="mm",e.setData(WCe,fT);let r=te.getInstance().addSafeSpacing("copperThickness2oz");if(r.unit="mm",r.setData(dVe,fT),t=="multi"){let i=te.getInstance().addSafeSpacing("copperThicknessInner0.5oz");i.unit="mm",i.setData(pVe,fT)}}initSafeSpacing1(){let t=te.getInstance().addSafeSpacing("safeClearance",!0);t.unit="mm",t.setData(WCe,fT)}initOtherSpacing(){let t=te.getInstance().addOtherSpacing("otherClearance");t.isDefault=!0,t.unit="mm"}initTrackPhysics(){let t=te.getInstance().addTrackPhysics("copperThickness1oz",!0);t.setDefaultWidth(1),t.setMaxWidth(10),t.setMinWidth(.5),t.unit="mm";let e=te.getInstance().addTrackPhysics("copperThickness2oz");e.isDefault=!1,e.setDefaultWidth(1),e.setMaxWidth(10),e.setMinWidth(.79921),e.unit="mm"}initTrackPhysics1(t){let e=te.getInstance().addTrackPhysics("copperThickness1oz",!0);e.setDefaultWidth(1),e.setMaxWidth(10),e.setMinWidth(.40157),e.unit="mm";let r=te.getInstance().addTrackPhysics("copperThickness2oz");if(r.isDefault=!1,e.setDefaultWidth(1),e.setMaxWidth(10),e.setMinWidth(.79921),r.unit="mm",t=="multi"){let i=te.getInstance().addTrackPhysics("copperThickness0.5oz");i.isDefault=!1,e.setDefaultWidth(1),e.setMaxWidth(10),e.setMinWidth(.35039),i.unit="mm"}}initTrackPhysics2(){let t=te.getInstance().addTrackPhysics("trackWidth",!0);t.setDefaultWidth(1),t.setMaxWidth(10),t.setMinWidth(.40157),t.unit="mm"}initDifferentailPhysics(){let t=te.getInstance().addDifferentialPhysics("differentialPair",!0);t.differentialPairLenTolerMax=this.getData("mm",.254),t.setDifferentialPairSpacingDefault(this.getData("mm",.152)),t.setDifferentialPairSpacingMax(this.getData("mm",0)),t.setDifferentialPairSpacingMin(this.getData("mm",.152)),t.setStrokeWidthDefault(this.getData("mm",.254)),t.setStrokeWidthMax(this.getData("mm",2.54)),t.setStrokeWidthMin(this.getData("mm",.127)),t.unit="mm"}initNetLengthPhysics(){let t=te.getInstance().addNetLengthPhysics("netLength");t.isDefault=!0,t.unit="mm"}initNetLengthTolerancePhysics(){let t=te.getInstance().addNetLengthTolerancePhysics("netLengthTolerance");t.isDefault=!0,t.unit="mm"}initBlindPhysics(){let t=te.getInstance().addBlindPhysics("blindVia");t.isDefault=!0}initRadiusPhysics(){let t=te.getInstance().addRadiusPhysics("viaSize");t.isDefault=!0,t.defalutInner=.60039,t.maxInner=12.40157,t.minInner=.59055,t.defalutRadius=1.20079,t.maxRadius=19.68504,t.minRadius=.98425,t.unit="mm"}initRadiusPhysics1(){let t=te.getInstance().addRadiusPhysics("viaSize");t.isDefault=!0,t.defalutInner=.98425,t.maxInner=12.40157,t.minInner=.59055,t.defalutRadius=1.9685,t.maxRadius=19.68504,t.minRadius=.98425,t.unit="mm"}initRadiusPhysics2(){let t=te.getInstance().addRadiusPhysics("viaSize");t.isDefault=!0,t.defalutInner=.60039,t.maxInner=12.40157,t.minInner=.3937,t.defalutRadius=1.20079,t.maxRadius=19.68504,t.minRadius=.59055,t.unit="mm"}initRadiusPhysics3(){let t=te.getInstance().addRadiusPhysics("viaSize");t.isDefault=!0,t.defalutInner=.60039,t.maxInner=11.81102,t.minInner=.49213,t.defalutRadius=1.20079,t.maxRadius=19.68504,t.minRadius=.98425,t.unit="mm"}initRadiusPhysics4(){let t=te.getInstance().addRadiusPhysics("viaSize");t.isDefault=!0,t.defalutInner=1.9685,t.maxInner=11.81102,t.minInner=1.9685,t.defalutRadius=3.93701,t.maxRadius=19.68504,t.minRadius=1.9685,t.unit="mm"}initInnerPlane(){let t=te.getInstance().addInnerPlane("innerPlane",!0);t.setMultiConnectMode(0),t.setMultiLineClearance(this.getData("mm",.254)),t.setMultiLineWidth(this.getData("mm",.254)),t.setMultiLineAngle(es),t.unit="mm"}initCopperPlane(){let t=te.getInstance().addCopperPlane("copperRegion",!0);t.setSingleConnectMode(0),t.setSingleLineClearance(this.getData("mm",.254)),t.setSingleLineWidth(this.getData("mm",.254)),t.setSingleLineAngle(es),t.setMultiConnectMode(0),t.setMultiLineClearance(this.getData("mm",.254)),t.setMultiLineWidth(this.getData("mm",.254)),t.setMultiLineAngle(es),t.unit="mm"}initSolderExpansion(){let t=te.getInstance().addSolderExpansion("solderMaskExpansion");t.isDefault=!0,t.padBottomExpansion=this.getData("mm",.051),t.padTopExpansion=this.getData("mm",.051),t.viaBottomExpansion=this.getData("mm",-25.4),t.viaTopExpansion=this.getData("mm",-25.4),t.unit="mm"}initPasteExpansion(){let t=te.getInstance().addPasteExpansion("pasteMaskExpansion");t.isDefault=!0,t.unit="mm"}getData(t,e){return t!="mil"&&(e=new ft().conversion1(t,"mil",e/10)),e}};var wde=class extends wi{async initRuleManager(){await new Dde().initRuleData()}addNet(t){if(t==null)return null;let e=this.map.get(t);if(e==null){let r=te.getInstance().addNet(t);e=new B$(r),this.map.set(t,e)}return e}addNetByModel(t){let e=t.name,r=this.map.get(e);return r==null?(r=new B$(t),this.map.set(e,r)):r.model=t,r}getNet(t){return this.map.get(t)}deleteNet(t){te.getInstance().deleteNet(t);let e=this.map.get(t);e&&(te.getInstance().betweenNetRule.deltetRule4Net(e.model),e!=null&&e.remove(),this.map.delete(t))}};var ww=class extends Gy{constructor(t){super(),this.model=t,this.initRefreshRender()}getType(){return 18}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}get start(){return this.model.start}set start(t){this.model.start=t,this.refreshRender()}get end(){return this.model.end}set end(t){this.model.end=t,this.refreshRender()}get text(){return this.model.text}set text(t){this.model.text=t,this.refreshRender()}get textWidth(){return this.model.textWidth}set textWidth(t){this.model.textWidth=t,this.refreshRender()}buildBBox(){return this.model.bbox}isSelect(t,e){return this.model.inShape(t,e)}get isVisible(){return this._parent.isVisible}set isVisible(t){this.isVisible!=t&&(this.setDataState(0,t),this.refreshRender())}get locked(){return!1}set locked(t){throw new Error("Method not implemented.")}visible(t=!1){super.visible(t),this.unHighLight()}transform(t){throw new Error("Method not implemented.")}rotateFor(t,e){throw new Error("Method not implemented.")}injectedBBox(t){this.model.injectedBBox(t)}};function Lde(){let o=ce.pcbConfig.drcErrorZoom==="keepConstantSize",t=i=>M9.mm2mil(i)/10,e={arrowWidth:3,arrowHeight:6,arrowLineLength:7.5,arrowLineWidth:1.5,arrowHeightMaxPxLimit:30,arrowHeightMinPxLimit:12},r={arrowWidth:t(.2),arrowHeight:t(.4),arrowLineLength:t(.5),arrowLineWidth:t(.1),arrowHeightMaxPxLimit:0,arrowHeightMinPxLimit:0};return o?e:r}var F$=class F${setupDrcArrowStyle(){var e,r;if(F$.arrowStyleInitialized)return;let t=(e=bn.getInstance())==null?void 0:e.getLayer(1001);if(!((r=t==null?void 0:t.layer)!=null&&r.plane)){console.warn("StyleConfigProxy: Failed to get layer 1001");return}try{let i=Lde();t.layer.plane.scene.setDrcArrowPtStyle(ee.of3("#FECC00"),i.arrowWidth,i.arrowHeight,i.arrowLineLength,i.arrowLineWidth,i.arrowHeightMaxPxLimit,i.arrowHeightMinPxLimit),F$.arrowStyleInitialized=!0}catch(i){console.error("StyleConfigProxy: Failed to set DRC arrow style:",i)}}};F$.arrowStyleInitialized=!1;var TU=F$;function CAe(o,t,e,r){let i=r.sub(t),n=e.sub(t),s=o.sub(t),a=i.dot(i),l=i.dot(n),c=i.dot(s),h=n.dot(n),u=n.dot(s),d=1/(a*h-l*l),p=(h*c-l*u)*d,m=(a*u-l*c)*d;return p>=0&&m>=0&&p+m<1}var Mde=class extends GE{constructor(e,r,i,n,s,a=1001){super();this.modelType="DrcComponentSpacing";this.startArrowPoints=null;this.endArrowPoints=null;this.lineWidth=0;this.globalIndex=e,this._start=r,this._end=i,this._text=n,this._textWidth=s,this._layerId=a,this.updateBox()}get layerId(){return this._layerId}set layerId(e){this._layerId!==e&&(this._layerId=e,this.layerModified=!0)}get start(){return this._start}set start(e){this._start.equals(e)||(this._start=e,this.updateBox())}get end(){return this._end}set end(e){this._end.equals(e)||(this._end=e,this.updateBox())}get text(){return this._text}set text(e){this._text!==e&&(this._text=e)}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth!==e&&(this._textWidth=e,this.updateBox())}updateBox(){return this._bbox||new ut(0,0,0,0)}getScaledValueWithLimits(e,r,i){let n=Ni().getScale();if(!(ce.pcbConfig.drcErrorZoom==="keepConstantSize"))return e;let a=Math.abs(e)*n;return i>0&&a>i?i/n:r>0&&a<r?0:e}calcArrowGeometries(){let e=Lde(),r=this.getScaledValueWithLimits(e.arrowHeight,e.arrowHeightMinPxLimit,e.arrowHeightMaxPxLimit),i=e.arrowHeightMinPxLimit/e.arrowHeight,n=e.arrowHeightMaxPxLimit/e.arrowHeight,s=this.getScaledValueWithLimits(e.arrowLineLength,e.arrowLineLength*i,e.arrowLineLength*n);this.lineWidth=this.getScaledValueWithLimits(e.arrowLineWidth,e.arrowLineWidth*i,e.arrowLineWidth*n);let a=r/2,l=this.end.sub(this.start),c=Math.atan2(l.y,l.x),h=new S(this.start.x+a*Math.cos(c),this.start.y+a*Math.sin(c)),u=new S(this.end.x+a*Math.cos(c+Math.PI),this.end.y+a*Math.sin(c+Math.PI));this.startArrowPoints=a>0?this.getArrowPoints(this.start,h,c,a):null,this.endArrowPoints=a>0?this.getArrowPoints(this.end,u,c+Math.PI,a):null,this.startLineSegment={start:h,end:h.add(l.normalize().mul(s))},this.endLineSegment={start:u,end:u.add(l.normalize().mul(-s))}}getArrowPoints(e,r,i,n){let s=new S(Math.cos(i+Math.PI/2),Math.sin(i+Math.PI/2)).mul(n),a=new S(Math.cos(i-Math.PI/2),Math.sin(i-Math.PI/2)).mul(n);return[e,r.add(s),r.add(a)]}getVirtualBBoxes(){let e=Lde(),r=this.end.sub(this.start),i=Math.atan2(r.y,r.x);return this.injectedBBoxes.map((n,s)=>s===0?Yx(n,e.arrowHeightMinPxLimit,e.arrowHeightMaxPxLimit,this.start):s===1?Yx(n,e.arrowHeightMinPxLimit,e.arrowHeightMaxPxLimit,this.end):Yx(n,e.arrowHeightMinPxLimit,e.arrowHeightMaxPxLimit))}inShape(e,r){this.calcArrowGeometries();let i=this.startArrowPoints===null&&this.endArrowPoints===null,n=this.lineWidth===0;if(i&&n)return!1;let s=new S(e,r),[a,l,c]=this.getVirtualBBoxes();return!!(c.isContains(s)||this.startArrowPoints&&a.isContains(s)&&(CAe(s,...this.startArrowPoints)||this.lineWidth>0&&Xa(s,this.startLineSegment.start,this.startLineSegment.end,this.lineWidth))||this.endArrowPoints&&l.isContains(s)&&(CAe(s,...this.endArrowPoints)||this.lineWidth>0&&Xa(s,this.endLineSegment.start,this.endLineSegment.end,this.lineWidth)))}get locked(){return!1}set locked(e){throw new Error("Method not implemented.")}clone(...e){throw new Error("Method not implemented.")}transform(e){throw new Error("Method not implemented.")}};var _N=class _N extends HE{static getInstance(){return _N.instance||(_N.instance=new _N),_N.instance}updateCache(t){this.map.set(t.globalIndex,t)}addItemByModel(t){let e=new ww(t);return this.updateCache(e),e}addItem(t,e,r,i,n=1001){let s=new Mde(cr(),e,r,i,200,n),a=this.addItemByModel(s);return a.setParent(t),a}};_N.instance=null;var V$=_N;var Nde=class extends GE{constructor(e,r,i,n=ee.of3("#FF0000"),s=1001){super();this.modelType="DrcComponentOverlap";this._zoomType=ce.pcbConfig.drcErrorZoom;this.globalIndex=e,this._radius=i,this._center=r,this._str=sn.getInstance().language==="zh-hans"?"\u78B0\u649E":"Collision",this._textPosition=r.add(new S(1.21*i,0));let a=new ft;this._textWidth=200,this._textHeight=this._zoomType==="keepConstantSize"?6:a.mm2mil(.5)/10,this._layerId=s,this._color=n,this.updateBox()}get layerId(){return this._layerId}set layerId(e){this._layerId!==e&&(this._layerId=e,this.layerModified=!0)}get center(){return this._center}set center(e){this._center!==e&&(this._center=e)}get radius(){return this._radius}set radius(e){this._radius!==e&&(this._radius=e)}get str(){return this._str}set str(e){this._str!==e&&(this._str=e)}get textPosition(){return this._textPosition}set textPosition(e){this._textPosition!==e&&(this._textPosition=e)}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth!==e&&(this._textWidth=e)}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight!==e&&(this._textHeight=e)}get color(){return this._color}set color(e){(this._color.r!==e.r||this._color.g!==e.g||this._color.b!==e.b||this._color.alpha!==e.alpha)&&(this._color=e)}updateBox(){return this._bbox||new ut(0,0,0,0)}inShape(e,r){let i=new S(e,r),[n,s]=this.injectedBBoxes;if(s.isContains(i))return!0;if(n.isContains(i)){let a=M9.mm2mil(.1)/10,l=Ni();a<.05&&l!=null&&(a=10/l.getScale());let c=this.center.distance1(i);return c<=this.radius+a/2&&c>=this.radius-a/2}return!1}get locked(){return!1}set locked(e){throw new Error("Method not implemented.")}clone(...e){throw new Error("Method not implemented.")}transform(e){throw new Error("Method not implemented.")}};var Lw=class extends Gy{constructor(t){super(),this.model=t,this.initRefreshRender()}getType(){return 19}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}get center(){return this.model.center}set center(t){this.model.center=t,this.refreshRender()}get radius(){return this.model.radius}set radius(t){this.model.radius=t,this.refreshRender()}get str(){return this.model.str}set str(t){this.model.str=t,this.refreshRender()}get textPosition(){return this.model.textPosition}set textPosition(t){this.model.textPosition=t,this.refreshRender()}get textWidth(){return this.model.textWidth}set textWidth(t){this.model.textWidth=t,this.refreshRender()}get textHeight(){return this.model.textHeight}set textHeight(t){this.model.textHeight=t,this.refreshRender()}get color(){return this.model.color}set color(t){this.model.color=t,this.refreshRender()}buildBBox(){return this.model.bbox}isSelect(t,e){return this.model.inShape(t,e)}get isVisible(){return this._parent.isVisible}set isVisible(t){this.isVisible!=t&&(this.setDataState(0,t),this.refreshRender())}get locked(){return!1}set locked(t){throw new Error("Method not implemented.")}transform(t){throw new Error("Method not implemented.")}rotateFor(t,e){throw new Error("Method not implemented.")}injectedBBox(t){this.model.injectedBBox(t)}};var vN=class vN extends HE{static getInstance(){return vN.instance||(vN.instance=new vN),vN.instance}updateCache(t){this.map.set(t.globalIndex,t)}addItemByModel(t){let e=new Lw(t);return this.updateCache(e),e}addItem(t,e,r,i=ee.of3("#FFCC00"),n=1001){let s=new Nde(cr(),e,r,i,n),a=this.addItemByModel(s);return a.setParent(t),a}};vN.instance=null;var G$=vN;var kde=class{isComponentError(t){return!(t.errorType!=="Other Spacing"||t.obj1Type!=="Device"||t.obj2Type!=="Device")}getRelatedComponentIds(t){return[t==null?void 0:t.obj1,t==null?void 0:t.obj2].filter(Boolean)}createComponentError(t,e){if(!this.isComponentError(t))return;let r=this.getRelatedComponentIds(t);if(!qM.registerError(t.globalIndex,r)){console.debug(`[DRC Limit] Skip ${t.globalIndex}, component exceeded limit`);return}t.minDistance>0?this.createSpacingError(t,e):this.createOverlapError(t,e)}deleteComponentError(t){let e=t.child;e instanceof ww?V$.getInstance().deleteItem(e):e instanceof Lw&&G$.getInstance().deleteItem(e),qM.unregisterError(t.contentModel.globalIndex),t.child=null}calcSpacingText(t){let e=x.getInstance().unit,r=t.length()*10;return e!="mil"&&(r=new ft().conversion1("mil",e,r)),r.toFixed(e=="mil"?1:3)+e}createSpacingError(t,e){let r=t.line,i=V$.getInstance().addItem(e,r.start(),r.end(),this.calcSpacingText(r));e.child=i}createOverlapError(t,e){let r=Cr.getItem(t.obj1),i=Cr.getItem(t.obj2),s=new _e().ext1(r.bbox()).ext1(i.bbox()).build(),a=s.UR().sub(s.LL()).length()*1.2/2,l=s.center(),c=G$.getInstance().addItem(e,l,a);e.child=c}};var Bde=class extends wi{constructor(){super(...arguments);this.highlightedError=[];this.componentErrorFactory=new kde}unHighlightAll(){}highlightError(e){}syncFromContentModel(e=pi.getInstance().getAllItem()){let r=[];for(let i of e){let n=i.globalIndex;if(this.getItem(n)==null){let s=this.addErrorByContentModel(i);r.push(s)}}return r}deleteAll(){pi.getInstance().deleteAllError();let e=this.map.keys();for(let r of e)this.delete(this.map.get(r))}deleteCopperClearanceError(){[].concat(Ei.getAllItem(),Qn.getAllItem()).forEach(e=>{let r=pi.getInstance().deleteClearanceError(e.globalIndex);this.deleteByModel(r)})}getAllErrors(){let e=this.modelRefItem2(pi.getInstance().idMapClearance),r=this.modelRefItem2(pi.getInstance().idMapInner);return{clearance:new Set([].concat(e,r)),diff:this.modelRefItem2(pi.getInstance().idMapDiffPairGap),track:this.modelRefItem(pi.getInstance().idMapTrack),diffPairTrack:this.modelRefItem(pi.getInstance().idMapDiffPairWidth),diffPairLength:this.modelRefItem(pi.getInstance().idMapDiffPairLength),blind:this.modelRefItem(pi.getInstance().idMapBlind),netLength:this.modelRefItem(pi.getInstance().idMapNetLength),netLengthTolerance:this.modelRefItem(pi.getInstance().idMapNetLengthTolerance),radius:this.modelRefItem(pi.getInstance().idMapRadius),connect:this.modelRefItem(pi.getInstance().idMapConnect),netlist:this.modelRefItem(pi.getInstance().idMapNetlist),creepage:this.modelRefItem2(pi.getInstance().idMapCreepage)}}modelRefItem(e){let r=new Set;for(let i of e.keys()){let n=e.get(i).globalIndex,s=this.getItem(n);s&&r.add(s)}return Array.from(r)}modelRefItem2(e){let r=new Set;for(let i of e.keys())e.get(i).forEach(n=>{let s=this.getItem(n.globalIndex);s&&r.add(s)});return Array.from(r)}getClearanceError(e,r){return pi.getInstance().getClearanceError(e,r)}getCreepageError(e,r){return pi.getInstance().getCreepageError(e,r)}existClearanceError(e,r){let i=pi.getInstance().idMapClearance.get(e),n={exsitError:!1,existClearanceError:!1};if(i==null)return n;let s=new er;for(let a of i){if(a.obj1!=e){let l=s.getItem(a.obj1);if(l instanceof A0&&l.layerId!=r){n.exsitError=!0;continue}}else if(a.obj2!=e){let l=s.getItem(a.obj2);if(l instanceof A0&&l.layerId!=r){n.exsitError=!0;continue}}n.existClearanceError=!0}return n}hasDiffLengthError(e){return pi.getInstance().hasDiffLengthError(e)}getDiffPairGapError(e,r){return pi.getInstance().getDiffPairGapError(e,r)}addErrorByContentModel(e){let{globalIndex:r,name:i,position:n,errorType:s,layerIds:a}=e,l=k1.getInstance().addItem(r,i,n,s,ce.pcbConfig.drcErrorZoom,a);return l.contentModel=e,l.model.content=e,this.map.set(e.globalIndex,l),l.model.loadViewGroupId(),s=="Creepage Distance"&&e instanceof iP&&this.createCreepageError(e,l),ce.pcbConfig.displayComponentSpacing&&e instanceof sf&&this.componentErrorFactory.createComponentError(e,l),l}createCreepageError(e,r){let i=e.path,n=this.formatDistanceValue(e.minDistance),s=this.formatDistanceValue(e.clearance),a=$M.getInstance().addItem(r,n,s,i);r.child=a}formatDistanceValue(e){let r=x.getInstance().unit,i=e*10;r!=="mil"&&(i=new ft().conversion1("mil",r,i));let n=r==="mil"?1:3;return i.toFixed(n)+r}deleteClearanceError(e){let r=pi.getInstance().deleteClearanceError(e);this.deleteByModel(r)}deleteCreepageError(e){let r=pi.getInstance().deleteCreepageError(e);this.deleteByModel(r)}addInnerError(e,r,i,n,s,a,l,c,h){let u=pi.getInstance().addInnerError(e,r,i,n,s,a,l,c,h);return this.addErrorByContentModel(u)}deleteInnerError(e){let r=pi.getInstance().deleteInnerError(e);this.deleteByModel(r)}addNetLengthError(e,r,i,n,s,a){let l=pi.getInstance().addNetLengthError(e,r,i,n,s,a);return this.addErrorByContentModel(l)}deleteNetLengthError(e){let r=pi.getInstance().deleteNetLengthError(e);this.deleteByModel(r)}addNetLengthToleranceError(e,r,i,n,s){let a=pi.getInstance().addNetLengthToleranceError(e,r,i,n,s);return this.addErrorByContentModel(a)}deleteNetLengthToleranceError(e){let r=pi.getInstance().deleteNetLengthToleranceError(e);this.deleteByModel(r)}addTrackWidthError(e,r,i,n,s,a,l){let c=pi.getInstance().addTrackWidthError(e,r,i,n,s,a,l);return this.addErrorByContentModel(c)}deleteTrackWidthError(e){let r=pi.getInstance().deleteTrackWidthError(e);this.deleteByModel(r)}addDiffPairTrackWidthError(e,r,i,n,s,a,l){let c=pi.getInstance().addDiffPairTrackWidthError(e,r,i,n,s,a,l);return this.addErrorByContentModel(c)}deleteDiffPairTrackWidthError(e){let r=pi.getInstance().deleteDiffPairTrackWidthError(e);this.deleteByModel(r)}addDiffPairTrackGapError(e,r,i,n,s,a,l,c,h){let u=pi.getInstance().addDiffPairTrackGapError(e,r,i,n,s,a,l,c,h);return this.addErrorByContentModel(u)}deleteDiffPairTrackGapError(e){let r=pi.getInstance().deleteDiffPairTrackGapError(e);this.deleteByModel(r)}addDiffPairTrackLengthError(e,r,i,n,s,a,l,c){let h=pi.getInstance().addDiffPairTrackLengthError(e,r,i,n,s,a,l);return this.addErrorByContentModel(h)}deleteDiffPairTrackLengthError(e){let r=pi.getInstance().deleteDiffPairTrackLengthError(e);this.deleteByModel(r)}addBlindError(e,r,i,n,s,a){let l=pi.getInstance().addBlindError(e,r,i,n,s,a);return this.addErrorByContentModel(l)}deleteBlindError(e){let r=pi.getInstance().deleteBlindError(e);this.deleteByModel(r)}addRadiusError(e,r,i,n,s,a,l,c,h){let u=pi.getInstance().addRadiusError(e,r,i,n,s,a,l,c,h);return this.addErrorByContentModel(u)}deleteRadiusError(e){let r=pi.getInstance().deleteRadiusError(e);this.deleteByModel(r)}addConnectError(e,r,i,n,s,a,l){let c=pi.getInstance().addConnectError(e,r,i,n,s,a,l);return this.addErrorByContentModel(c)}deleteConnectError(e){let r=pi.getInstance().deleteConnectError(e);this.deleteByModel(r)}deleteAllConnectError(){let e=pi.getInstance().idMapConnect;for(let r of e.keys()){let i=e.get(r);this.deleteByModel(i)}}deleteAllNetLengthError(){let e=pi.getInstance().idMapNetLength;for(let r of e.keys()){let i=e.get(r);this.deleteByModel(i)}}deleteAllNetLengthToleranceError(){let e=pi.getInstance().idMapNetLengthTolerance;for(let r of e.keys()){let i=e.get(r);this.deleteByModel([i])}}deleteNetlistError(){let e=pi.getInstance().idMapNetlist;for(let r of e.keys()){let i=e.get(r);this.deleteByModel([i])}}delete(e){e instanceof qp&&(e.child instanceof ww||e.child instanceof Lw?this.componentErrorFactory.deleteComponentError(e):e.child instanceof jx&&$M.getInstance().deleteCreepageError(e),k1.getInstance().deleteItem(e),pi.getInstance().deleteError(e.contentModel),this.map.delete(e.globalIndex))}deleteByModel(e){e!=null&&(e=Array.isArray(e)?e:[e],e.forEach(r=>{this.delete(this.getItem(r.globalIndex))}))}deleteByPcbItem(e,r=!1){let i=[be.getMultLayer().layerID,...be.getAllCopperLayerIds()];e=e instanceof Set||Array.isArray(e)?e:[e];for(let n of e){let s=n.globalIndex;if(this.deleteClearanceError(s),this.deleteCreepageError(s),r&&this.deleteConnectError(s),n instanceof ii)this.deleteClearanceError(s);else if(n instanceof Ge)this.deleteBlindError(s),this.deleteRadiusError(s);else if(n instanceof Ue)this.deleteTrackWidthError(s),this.deleteDiffPairTrackWidthError(s),this.deleteDiffPairTrackGapError(s),this.deleteDiffPairTrackLengthError(n.net);else if(n instanceof Ki)this.deleteInnerError(s);else if(n instanceof Me){let a=new Set(n.getPads()),l=new Set(n.getVias()),c=n.getItems();a.forEach(h=>{this.deleteClearanceError(h.globalIndex)}),l.forEach(h=>{this.deleteClearanceError(h.globalIndex),this.deleteBlindError(h.globalIndex),this.deleteRadiusError(h.globalIndex)}),c.forEach(h=>{!a.has(h)&&!l.has(h)&&i.includes(h.layerId)&&this.deleteClearanceError(h.globalIndex)})}}}};var IU=class o{constructor(){this.tool=null;this.property={paste2CurrentActiveLayer:!0,inheritNet:"InheritNetsfromTouchedObjects"};this.layout={isCursorChange:!1,isApply:!1,mouseX:0,mouseY:0,rotation:0};this.isInit=!0}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}getTool(){return this.tool}setTool(t){this.tool=t}async initPaste2CurrentActiveLayer(){this.isInit&&(this.setPaste2CurrentActiveLayer(!!(await A.windowBridge.rpcCall("UserPreferencesGetCacheObj","paste2CurrentActiveLayer",j0())).message),this.isInit=!1)}getPaste2CurrentActiveLayer(){return this.property.paste2CurrentActiveLayer}setPaste2CurrentActiveLayer(t){this.property.paste2CurrentActiveLayer=t}getInheritNet(){return this.property.inheritNet}setInheritNet(t){this.property.inheritNet=t}getIsCursorChange(){return this.layout.isCursorChange}setIsCursorChange(t){this.layout.isCursorChange=t}getIsApply(){return this.layout.isApply}setIsApply(t){if(this.layout.isApply=t,this.layout.isApply&&this.tool){Yh.type=null;let e=Pi.getInstance();e.sceneX=this.getMouseX(),e.sceneY=this.getMouseY(),this.tool.onMouseMove(e),this.tool.onMouseLeftUp(e),A.publish("adaptSelect","")}}getMouseX(){return this.layout.mouseX}setMouseX(t){this.layout.mouseX=t/10}getMouseY(){return this.layout.mouseY}setMouseY(t){this.layout.mouseY=t/10}getRotation(){return uc(xe(this.layout.rotation/Math.PI*180,3))}setRotation(t){let e=parseFloat((t/180).toString())*Math.PI;isNaN(e)||(this.layout.rotation=e),A.publish("rotateForAngle",this.layout.rotation)}getUnit(){return x.getInstance().unit}setUnit(t){FC(t)}getGridType(){return we.gridType}setGridType(t){we.gridType=t,A.messageBus.publish("switchGridType",t),A.publish("switchGridTypeBtn",t,j0())}getBlodGridType(){return we.multiType}setBlodGridType(t){we.multiType=t,A.messageBus.publish("switchMultiGridType",t)}getBlodGridRatio(){return we.multiRatio}setBlodGridRatio(t){A.messageBus.publish("switchMultiGridRatio",t)}getGridSize(){let t=St.getInstance().getGridX()*10,e=St.getInstance().getGridY()*10;return t==e?String(t):`${t},${e}`}setGridSize(t,e){St.getInstance().setGridX(t/10),St.getInstance().setGridY(e/10),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],j0()),we.synchronize()}getSnapSize(){let t=St.getInstance().getSnapX()*10,e=St.getInstance().getSnapY()*10;return t==e?String(t):`${t},${e}`}setSnapSize(t,e){St.getInstance().setSnapX(t/10),St.getInstance().setSnapY(e/10),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],j0())}getSnap(){return{title:"Snap",value:we.adsorb}}setSnap(t){A.publish("toggleAdsorb",t)}getAltSnapSize(){let t=x.getInstance().altGridSize,e=Xs.conversion1(t.GridX.unit,x.getInstance().unit,t.GridX.number),r=Xs.conversion1(t.GridY.unit,x.getInstance().unit,t.GridY.number);return e==r?String(e):`${e},${r}`}setAltSnapSize(t,e){let r={GridX:{number:t,unit:x.getInstance().unit},GridY:{number:e,unit:x.getInstance().unit}};x.getInstance().altGridSize=r}};var F0=class o extends ZI{static getInstance(){var t;return(t=o.instance)!=null?t:o.instance=new o}setTool(t){this.pastePanelParams.setTool(t),this.pastePanelParams.setIsApply(!1)}constructor(){super(),this.pastePanelParams=IU.getInstance()}get isUnmounted(){return this.pastePanelParams.getIsApply()}get paste2CurrentActiveLayer(){return this.pastePanelParams.getPaste2CurrentActiveLayer()}get inheritNet(){return this.pastePanelParams.getInheritNet()}get isCursorChange(){return this.pastePanelParams.getIsCursorChange()}get mouseX(){return this.pastePanelParams.getMouseX()*10}set mouseX(t){this.pastePanelParams.setMouseX(t)}get mouseY(){return this.pastePanelParams.getMouseY()*10}set mouseY(t){this.pastePanelParams.setMouseY(t)}get rotation(){return this.pastePanelParams.getRotation()}createHeader(t){return{...this.createBaseHeader(),id:t,action:t,tabId:x.getInstance().tabId}}handleHeaderUpdate(t){}createBody(t){return{PasteProperty:this.createProperty(),PasteLayout:this.createLayout(),PasteCanvas:this.createDocument()}}handleBodyUpdate(t,e){let{PasteProperty:r,PasteLayout:i,PasteCanvas:n}=e;this.updateProperty(r),this.updateLayout(i),this.updateDocument(n),A.publish("updateFrame","")}createProperty(){return{paste2CurrentActiveLayer:this.pastePanelParams.getPaste2CurrentActiveLayer(),inheritNet:this.pastePanelParams.getInheritNet()}}createLayout(){return{isCursorChange:this.pastePanelParams.getIsCursorChange(),isApply:this.pastePanelParams.getIsApply(),mouseX:this.mouseX,mouseY:this.mouseY,rotation:this.pastePanelParams.getRotation()}}createDocument(){return{unit:this.pastePanelParams.getUnit(),gridType:this.pastePanelParams.getGridType(),blodGridType:this.pastePanelParams.getBlodGridType(),blodGridRatio:this.pastePanelParams.getBlodGridRatio(),gridSize:this.pastePanelParams.getGridSize(),snapSize:this.pastePanelParams.getSnapSize(),snap:this.pastePanelParams.getSnap(),altSnapSize:this.pastePanelParams.getAltSnapSize()}}updateProperty(t){let{paste2CurrentActiveLayer:e,inheritNet:r}=t;e!==this.pastePanelParams.getPaste2CurrentActiveLayer()&&this.pastePanelParams.setPaste2CurrentActiveLayer(e),r!==this.pastePanelParams.getInheritNet()&&this.pastePanelParams.setInheritNet(r)}updateLayout(t){let{isCursorChange:e,isApply:r,mouseX:i,mouseY:n,rotation:s}=t;e!==this.pastePanelParams.getIsCursorChange()&&this.pastePanelParams.setIsCursorChange(e),r!==this.pastePanelParams.getIsApply()&&this.pastePanelParams.setIsApply(r),Math.abs(i-this.pastePanelParams.getMouseX())>.001&&this.pastePanelParams.setMouseX(i),Math.abs(n-this.pastePanelParams.getMouseY())>.001&&this.pastePanelParams.setMouseY(n),Math.abs(s-this.pastePanelParams.getRotation())>.1&&this.pastePanelParams.setRotation(s)}updateDocument(t){let{unit:e,gridType:r,blodGridType:i,blodGridRatio:n,gridSize:s,snapSize:a,snap:l,altSnapSize:c}=t,h=this.pastePanelParams.getUnit(),u=this.pastePanelParams.getGridType(),d=this.pastePanelParams.getBlodGridType(),p=this.pastePanelParams.getBlodGridRatio(),m=String(this.pastePanelParams.getGridSize()),g=String(this.pastePanelParams.getSnapSize()),y=this.pastePanelParams.getSnap().value,b=this.pastePanelParams.getGridSize(),P=!1;e!==h&&(P=!0,this.pastePanelParams.setUnit(e)),r!==u&&(P=!0,this.pastePanelParams.setGridType(r)),i!==d&&(P=!0,this.pastePanelParams.setBlodGridType(i)),n!==p&&(P=!0,this.pastePanelParams.setBlodGridRatio(n)),s!==m&&(P=!0,this.updateCanvasGirdSnap("attr-grid-size",s)),a!==g&&(P=!0,this.updateCanvasGirdSnap("attr-snap-size",a)),l.value!==y&&(P=!0,this.pastePanelParams.setSnap(l.value)),c!==b&&(P=!0,this.updateCanvasGirdSnap("attr-alt-grid-size",c)),P&&wp()}updateCanvasGirdSnap(t,e){let r=e.toString().split(/,|，/),i,n;r.length==1?i=n=parseFloat(r[0]):r.length==2&&(i=parseFloat(r[0]),n=parseFloat(r[1])),!(isNaN(i)||isNaN(n))&&(t=="attr-grid-size"?this.pastePanelParams.setGridSize(i,n):t=="attr-snap-size"?this.pastePanelParams.setSnapSize(i,n):t=="attr-alt-grid-size"&&this.pastePanelParams.setAltSnapSize(i,n))}isCrossLayers(t){let e=/"layerId"\s*:\s*(\d+)/g,r=new Set;for(let i of Object.values(t))for(let n of i){if(!n.trim())continue;e.lastIndex=0;let s;if((s=e.exec(n))!==null){let a=parseInt(s[1],10);if(r.add(a),r.size>1)return!0}}return!1}analyzePasteData(t,e){var c;if(!t||!t.data)return null;let r=(c=t.head)==null?void 0:c.layerInfos,i=Object.keys(t.data).some(h=>h===15 .toString()),n=Object.values(r).length>1;if(!i&&n||this.isCrossLayers(t.data))return null;let s=t.data,a=[],l=be.getActiveLayerID();for(let h of Object.keys(s)){let u=s[h];if(!u||u.length===0)continue;let d=/"globalIndex"\s*:\s*"([^"]+)"/g.exec(u[0]),p=d?e[d[1]]:null;if(!p)continue;let m=zC.getManager(Number(h));if(!m)continue;let g=m.getItem(p);if(!g||!Zn.canChangeLayer(g,l))continue;let y=[];for(let b of u){let P=/"globalIndex"\s*:\s*"([^"]+)"/g.exec(b),T=P?e[P[1]]:null;if(!T)continue;let I=zC.getManager(Number(h));if(!I)continue;let C=I.getItem(T);C&&y.push(C)}a.push({key:h,items:y})}return this.pastePanelParams.cachedAnalysisResult=a,a}filterAnalysisResult(t,e){let r=[];for(let i of t){let n=i.items[0];if(!n)continue;Zn.canChangeLayer(n,e)&&r.push(i)}return r}toggle2ActiveLayer(t,e,r=!1){let i=t?this.analyzePasteData(t,e):this.pastePanelParams.cachedAnalysisResult;if(!this.paste2CurrentActiveLayer||!i||i.reduce((a,l)=>a+l.items.length,0)>400&&!r)return;let s=be.getActiveLayerID();t||(i=this.filterAnalysisResult(i,s));for(let a of i)for(let l of a.items)l.layerId!=s&&(l.layerId=s)}reset(){this.pastePanelParams.setIsCursorChange(!1),this.pastePanelParams.setRotation(0),this.pastePanelParams.cachedAnalysisResult=null,this.pastePanelParams.setTool(null),A.publish("ExitSketcherAttrView",{type:"PASTE"})}};var Fde=class{constructor(){this.tool=null}toggleLayer(t,e,r){let i=be.getLayer(t);i.config&&(be.setActiveLayer(i,r),dF(),this.tool!=null&&this.tool.toggleLayer(t,e),Yh.type=="PASTE"&&F0.getInstance().toggle2ActiveLayer())}addTool(t){this.tool=t}};var Vde=class{constructor(){this.placingPad=null;this.defaultTextFamily=["default","\u9ED1\u4F53","default2","Serif","Sans Serif"];this.defalutPad={layerId:12,type:1,num:"",topType:"ELLIPSE",topWidth:6,topHeight:6,topRatio:0,bottomType:"ELLIPSE",bottomWidth:6,bottomHeight:6,bottomRatio:0,innerType:"ELLIPSE",innerWidth:6,innerHeight:6,innerRatio:0,rotation:0,net:"",expansionType:1,pasteExpansion:0,topSolderExpansion:.4,bottomSolderExpansion:.4,holeLength:3.6,holeRadius:1.8,holeShape:"ROUND",holeRotation:0,holeOffset:new S(0,0)};this.defalutTestPad={layerId:12,type:1,num:"",topType:"ELLIPSE",topWidth:2.4,topHeight:2.4,topRatio:0,bottomType:"ELLIPSE",bottomWidth:2.4,bottomHeight:2.4,bottomRatio:0,innerType:"ELLIPSE",innerWidth:2.4,innerHeight:2.4,innerRatio:0,rotation:0,net:"",expansionType:1,pasteExpansion:0,topSolderExpansion:.4,bottomSolderExpansion:.4,unusedInnerLayers:[],holeLength:3.6,holeRadius:.6,holeShape:"ROUND",holeRotation:0,holeOffset:new S(0,0)};this.defaultText={layerId:3,text:"text",fontFamily:"",strokeWidth:.8,fontSize:8,rotation:0,silkColor:"#000000"};this.defaultImage={rotation:0,silkColor:"#000000"};this.defaultMark={silkColor:"#000000"};this.defaultSmartDimension={silkColor:"#000000"};this.default2DLine={silkColor:"#000000"};this.defaultTable={lineWidth:1,fontSize:8};this.defaultVia={net:"",type:0,name:"",startLayer:1,endLayer:2,radius:1.20079,innerRadius:.60039};this.defaultSutureVia={lineSpacing:20,columnSpacing:20};this.LineTypeSutureVia=20;this.footprintDefault={idData:{key:"Footprint",value:"Name",ggeid:""},rotation:0};this.defaultOutlineWidth=1;this.defaultTrackWidth=[];this.defaultTearDrop={operationType:"add",applyScope:"all",tearShape:"arc",ignoreDRC:!1,circleWidth:75,circleHeight:35,circlePadViaChecked:!0,otherWidth:250,otherHeight:150,specialShapedPadChecked:!0,routingWidth:70,routingHeight:100,routingChecked:!0,TConnectionWidth:300,TConnectionHeight:300,TConnectionChecked:!0}}getDefaultPad(t,e=""){let r=this.defalutPad.net,i=te.getInstance().getSolderExpansionByNet(r);return Kt.addPad(this.defalutPad.layerId,this.defalutPad.type,e,t,this.defalutPad.topType,this.defalutPad.topWidth,this.defalutPad.topHeight,this.defalutPad.topRatio,this.defalutPad.bottomType,this.defalutPad.bottomWidth,this.defalutPad.bottomHeight,this.defalutPad.bottomRatio,this.defalutPad.innerType,this.defalutPad.innerWidth,this.defalutPad.innerHeight,this.defalutPad.innerRatio,this.defalutPad.rotation,!1,this.defalutPad.net,this.defalutPad.expansionType,this.defalutPad.pasteExpansion,i.padTopExpansion,i.padBottomExpansion,[],!0,this.defalutPad.holeLength,this.defalutPad.holeRadius,this.defalutPad.holeShape,this.defalutPad.holeRotation,this.defalutPad.holeOffset)}getDefaultTestPad(t){let e=this.defalutTestPad.net,r=te.getInstance().getSolderExpansionByNet(e);return Kt.addPad(this.defalutTestPad.layerId,this.defalutTestPad.type,this.defalutTestPad.num,t,this.defalutTestPad.topType,this.defalutTestPad.topWidth,this.defalutTestPad.topHeight,this.defalutTestPad.topRatio,this.defalutTestPad.bottomType,this.defalutTestPad.bottomWidth,this.defalutTestPad.bottomHeight,this.defalutTestPad.bottomRatio,this.defalutTestPad.innerType,this.defalutTestPad.innerWidth,this.defalutTestPad.innerHeight,this.defalutTestPad.innerRatio,this.defalutTestPad.rotation,!1,this.defalutTestPad.net,this.defalutTestPad.expansionType,this.defalutTestPad.pasteExpansion,r.testPointTopExpansion,r.testPointBottomExpansion,[],!0,this.defalutTestPad.holeLength,this.defalutTestPad.holeRadius,this.defalutTestPad.holeShape,this.defalutTestPad.holeRotation,this.defalutTestPad.holeOffset)}getDefaultVia(t,e,r){let i=this.defaultVia.net;(ze.getItem(i)==null||ze.getItem(i).size==0)&&(i="");let n=te.getInstance().getSolderExpansionByNet(i);return Hr.addVia(this.defaultVia.type,this.defaultVia.name,this.defaultVia.startLayer,this.defaultVia.endLayer,i,e,t,r,!1,1,n.viaTopExpansion,n.viaBottomExpansion)}getDefaultBaseVia(t,e,r){let i=this.defaultVia.net;(ze.getItem(i)==null||ze.getItem(i).size==0)&&(i="");let n=te.getInstance().getSolderExpansionByNet(i),s=uD.build(t,e,r,n.viaTopExpansion,n.viaBottomExpansion,ee.BLACK);return s.type=this.defaultVia.type,s.name=this.defaultVia.name,s.viaBaseInfo=Ea.getViaBaseInfo(this.defaultVia.startLayer,this.defaultVia.endLayer,e,r),s.net=i,s.expansionType=1,s}setDefaultSutureVia(t,e){this.defaultSutureVia.lineSpacing=t,this.defaultSutureVia.columnSpacing=e}setDefaultLineSutureVia(t){this.LineTypeSutureVia=t}setDefaultVia(t,e=!0){t.net!=null&&(this.defaultVia.net=t.net),t.holeRadius!=null&&(this.defaultVia.innerRadius=t.holeRadius),t.radius!=null&&(this.defaultVia.radius=t.radius),e&&A.publish("flushSelectingInfo","")}togglePadLayerId(t){this.defalutPad.layerId!=12&&this.defalutPad.layerId!=t&&(t==12?this.defalutPad.layerId==1?(this.defalutPad.bottomType=this.defalutPad.topType,this.defalutPad.bottomWidth=this.defalutPad.topWidth,this.defalutPad.bottomHeight=this.defalutPad.topHeight,this.defalutPad.bottomRatio=this.defalutPad.topRatio,this.defalutPad.innerType=this.defalutPad.topType,this.defalutPad.innerWidth=this.defalutPad.topWidth,this.defalutPad.innerHeight=this.defalutPad.topHeight,this.defalutPad.innerRatio=this.defalutPad.topRatio):(this.defalutPad.topType=this.defalutPad.bottomType,this.defalutPad.topWidth=this.defalutPad.bottomWidth,this.defalutPad.topHeight=this.defalutPad.bottomHeight,this.defalutPad.topRatio=this.defalutPad.bottomRatio,this.defalutPad.innerType=this.defalutPad.bottomType,this.defalutPad.innerWidth=this.defalutPad.bottomWidth,this.defalutPad.innerHeight=this.defalutPad.bottomHeight,this.defalutPad.innerRatio=this.defalutPad.bottomRatio):t==1?(this.defalutPad.topType=this.defalutPad.bottomType,this.defalutPad.topWidth=this.defalutPad.bottomWidth,this.defalutPad.topHeight=this.defalutPad.bottomHeight,this.defalutPad.topRatio=this.defalutPad.bottomRatio):(this.defalutPad.bottomType=this.defalutPad.topType,this.defalutPad.bottomWidth=this.defalutPad.topWidth,this.defalutPad.bottomHeight=this.defalutPad.topHeight,this.defalutPad.bottomRatio=this.defalutPad.topRatio)),this.defalutPad.layerId=t}setDefaultPad(t){this.defalutPad.layerId=t.layerId,this.defalutPad.type=t.type,this.defalutPad.num=t.num,this.defalutPad.topType=t.topType,this.defalutPad.topWidth=t.topWidth,this.defalutPad.topHeight=t.topHeight,this.defalutPad.topRatio=t.topRatio,this.defalutPad.bottomType=t.bottomType,this.defalutPad.bottomWidth=t.bottomWidth,this.defalutPad.bottomHeight=t.bottomHeight,this.defalutPad.bottomRatio=t.bottomRatio,this.defalutPad.innerType=t.innerType,this.defalutPad.innerWidth=t.innerWidth,this.defalutPad.innerHeight=t.innerHeight,this.defalutPad.innerRatio=t.innerRatio,this.defalutPad.rotation=t.rotation,this.defalutPad.net=t.net,this.defalutPad.expansionType=t.expansionType,this.defalutPad.pasteExpansion=t.pasteExpansion,this.defalutPad.topSolderExpansion=t.topSolderExpansion,this.defalutPad.bottomSolderExpansion=t.bottomSolderExpansion,this.defalutPad.holeLength=t.holeLength,this.defalutPad.holeRadius=t.holeRadius,this.defalutPad.holeShape=t.holeShape,this.defalutPad.holeRotation=t.holeRotation,this.defalutPad.holeOffset=t.holeOffset}setDefaultTestPad(t){let{layerId:e,type:r,num:i,topType:n,topWidth:s,topHeight:a,topRatio:l,bottomType:c,bottomWidth:h,bottomHeight:u,bottomRatio:d,innerType:p,innerWidth:m,innerHeight:g,innerRatio:y,rotation:b,net:P,expansionType:T,pasteExpansion:I,topSolderExpansion:C,bottomSolderExpansion:E,holeLength:O,holeRadius:_,holeShape:R,holeRotation:v,holeOffset:D}=t;this.defalutTestPad={...this.defalutTestPad,layerId:e,type:r,num:i,topType:n,topWidth:s,topHeight:a,topRatio:l,bottomType:c,bottomWidth:h,bottomHeight:u,bottomRatio:d,innerType:p,innerWidth:m,innerHeight:g,innerRatio:y,rotation:b,net:P,expansionType:T,pasteExpansion:I,topSolderExpansion:C,bottomSolderExpansion:E,holeLength:O,holeRadius:_,holeShape:R,holeRotation:v,holeOffset:D}}};var Gde=class{constructor(){this.numManager=new Q0;this.idMapHandler={};this.time=0;this.actions=new Map,A.subscribe("openDialog",this.open.bind(this)),A.subscribe("pcbdialogModify",this.modify.bind(this)),A.subscribe("pcbdialogClose",this.close.bind(this)),A.subscribe("DialogCloseByAction",this.closeByAction.bind(this)),A.subscribe("pcbdialogCMD",this.toggleMode.bind(this)),A.subscribe("TempMaskDialog",this.mask50ms.bind(this))}mask50ms(){this.time=new Date().getTime()+200}check(){return!(!x.getInstance().isactive||23==x.getInstance().doctype)}open(t){if(!(new Date().getTime()<=this.time)&&this.check()){let e=this.numManager.getNum("dialog1");t.id=e,this.numManager.add(e),this.idMapHandler[e]=t;let r=t.open(t.option,t);if(r.action){let i=this.actions.get(r.action)||[];this.actions.set(r.action,[].concat(i,[e]))}r.dialogId=e,A.publish("dialogPcbOpen",r,$()),A.publish("updateFrame","")}}modify(t){if(this.check()){let e=t.dialogId,r=this.idMapHandler[e];if(!e&&t.dialogType){let i=Object.keys(this.idMapHandler).find(n=>{var s;return((s=this.idMapHandler[n])==null?void 0:s.dialogType)===t.dialogType});r=this.idMapHandler[i]}if(r!=null){r.modify(t),r.type="modify";let i=r.open(r.option,r);i.dialogId=e,A.publish("PcbdialogDataFlush",i,$()),A.publish("updateFrame","")}}}close(t){if(this.check()){let e=t.dialogId,r=this.idMapHandler[e];if(r!=null){let i=r.close(t);A.publish("updateFrame",""),i&&(A.publish("PcbcloseDialog",t,$()),r=null,delete this.idMapHandler[e])}}}closeByAction({action:t}){(this.actions.get(t)||[]).forEach(r=>{let i={dialogId:r},n=this.idMapHandler[r];if(n!=null){let s=n.close(i);A.publish("updateFrame",""),s&&(A.publish("PcbcloseDialog",i,$()),n=null,delete this.idMapHandler[r])}}),this.actions.delete(t)}toggleMode(t){if(this.check()){let e=t.dialogId,r=this.idMapHandler[e];if(!r){A.publish("updateFrame",""),A.publish("PcbcloseDialog",t,$());return}r.command(t)&&(A.publish("updateFrame",""),A.publish("PcbcloseDialog",t,$()),r=null,delete this.idMapHandler[e])}}getIdMapHandler(){let t={};return Object.entries(this.idMapHandler).forEach(([e,r])=>{let{dialogType:i,id:n,type:s}=r,a={dialogType:i,id:n,type:s};t[e]=a}),t}};var Ude=class{constructor(){this.handler=null;this.stack=new Array;A.subscribe("openMsgbox",this.open.bind(this)),A.subscribe("msgboxClose",this.close.bind(this))}check(){return!(!x.getInstance().isactive||23==x.getInstance().doctype)}open(t){if(this.check)if(this.handler==null){this.handler=t;let e=this.handler.open();A.publish("msgboxPcbOpen",e,$()),A.publish("updateFrame","")}else this.handler.equal(t)||this.stack.push(t)}close(t){if(this.check&&(this.handler!=null&&(this.handler.close(t),A.publish("updateFrame","")),this.handler=null,this.stack.length>0)){let e=this.stack.shift();this.open(e)}}};var U$=class{static executable(){return!(!x.getInstance().isactive||23==x.getInstance().doctype)}};var Mw=class extends ec{constructor(){super();this.existingInDevice=!1;this.existPolygonPad=!0;this.unionAttribute=null;this.interAttribute=null;this.attrIdMap={};this._netLengthMap=new Map,this.pad=null}set(e){return this.pad=e,this}getExtra(){return{existingInDevice:this.existingInDevice,existPolygonPad:this.existPolygonPad}}getHtmlData(e){var b;this.idList.push(e.globalIndex),this.count++;let r=kt.getCombin(),i=x.getInstance().unit,n=x.getInstance().origin;this.attrlist==null&&(this.attrlist={});let s=this.attrlist;if(e.getParent()!=null){let P=e.getParent();P instanceof Me&&((s["attr-footprint-id"]==null||s["attr-footprint-id"].value!=He)&&(s["attr-footprint-id"]={title:"Footprint ID",value:this.getCompareValue("attr-footprint-id",P.footprintId)}),this.existingInDevice=!0)}else(s["attr-footprint-id"]==null||s["attr-footprint-id"].value!=He)&&(s["attr-footprint-id"]={title:"Footprint ID",value:this.getCompareValue("attr-footprint-id","")});(s["attr-select-net"]==null||s["attr-select-net"].value!=He)&&(s["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.showNet),options:this.poolCache.allNetOptions||ze.getNet()}),(s["attr-layerid"]==null||s["attr-layerid"].value!=He)&&(s["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Zn.abstractPad()}),(s["attr-combination"]==null||s["attr-combination"].value!=He)&&(s["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",kt.getGroupNameByGroupId(e.getGroupID())||""),options:r,hasParent:e.getParent()!=null}),(s["attr-number"]==null||s["attr-number"].value!=He)&&(s["attr-number"]={title:"Number",value:this.getCompareValue("attr-number",e.num)}),(s["attr-id"]==null||s["attr-id"].value!=He)&&(s["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${e.number}`),sourceId:e.globalIndex}),(s["attr-pad-shape-showtype"]==null||s["attr-pad-shape-showtype"].value!=He)&&(s["attr-pad-shape-showtype"]={title:"Type",value:this.getCompareValue("attr-pad-shape-showtype",3)}),(s["attr-x"]==null||s["attr-x"].value!=He)&&(s["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",Xe(e.center.x-n.x,void 0,i,this.unitConversion))}),(s["attr-y"]==null||s["attr-y"].value!=He)&&(s["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",Xe(e.center.y-n.y,void 0,i,this.unitConversion))}),(s["attr-rotation"]==null||s["attr-rotation"].value!=He)&&(s["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",uc(xe(e.rotation/Math.PI*180,3)))});let a=e.locked,l=e.getParent();l!=null&&l instanceof Me&&l.locked&&(a=l.locked),(s["attr-locked"]==null||s["attr-locked"].value!=He)&&(s["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",a?"yes":"no"),options:this.poolCache.lockSettingOptions}),(s["attr-pad-hole-shape"]==null||s["attr-pad-hole-shape"].value!=He)&&(s["attr-pad-hole-shape"]={title:"Shape",value:this.getCompareValue("attr-pad-hole-shape",e.holeShape),options:this.getHoleShapeOption()}),(s["attr-pad-hole-diameter"]==null||s["attr-pad-hole-diameter"].value!=He)&&(s["attr-pad-hole-diameter"]={title:"Hole Diameter",value:this.getCompareValue("attr-pad-hole-diameter",Xe(e.holeRadius*2,void 0,i,this.unitConversion))}),(s["attr-pad-hole-length"]==null||s["attr-pad-hole-length"].value!=He)&&(s["attr-pad-hole-length"]={title:"Hole Length",value:this.getCompareValue("attr-pad-hole-length",Xe(e.holeLength,void 0,i,this.unitConversion))}),(s["attr-pad-hole-width"]==null||s["attr-pad-hole-width"].value!=He)&&(s["attr-pad-hole-width"]={title:"Hole Width",value:this.getCompareValue("attr-pad-hole-width",Xe(e.holeRadius*2,void 0,i,this.unitConversion))}),(s["attr-pad-hole-rotation"]==null||s["attr-pad-hole-rotation"].value!=He)&&(s["attr-pad-hole-rotation"]={title:"Hole Rotation",value:this.getCompareValue("attr-pad-hole-rotation",xe(e.holeRotation/Math.PI*180,3))}),(s["attr-pad-offset-x"]==null||s["attr-pad-offset-x"].value!=He)&&(s["attr-pad-offset-x"]={title:"Offset X",value:this.getCompareValue("attr-pad-offset-x",Xe(e.holeOffset.x,void 0,i,this.unitConversion))}),(s["attr-pad-offset-y"]==null||s["attr-pad-offset-y"].value!=He)&&(s["attr-pad-offset-y"]={title:"Offset Y",value:this.getCompareValue("attr-pad-offset-y",Xe(e.holeOffset.y,void 0,i,this.unitConversion))}),(s["attr-pad-plated"]==null||s["attr-pad-plated"].value!=He)&&(s["attr-pad-plated"]={title:"Plated",value:this.getCompareValue("attr-pad-plated",e.plated?"yes":"no")}),(s["attr-soldermask-showtype"]==null||s["attr-soldermask-showtype"].value!=He)&&(s["attr-soldermask-showtype"]={title:"Solder Type",value:this.getCompareValue("attr-soldermask-showtype",e.expansionType)}),(s["attr-pastemask"]==null||s["attr-pastemask"].value!=He)&&(s["attr-pastemask"]={title:"Paste",value:this.getCompareValue("attr-pastemask",Xe(e.pasteExpansion,void 0,i,this.unitConversion))});let c=Xe(e.topSolderExpansion,void 0,i,this.unitConversion),h=Xe(e.bottomSolderExpansion,void 0,i,this.unitConversion),u=c;e.layerId==2&&(u=h),(s["attr-soldermask"]==null||s["attr-soldermask"].value!=He)&&(s["attr-soldermask"]={title:"Solder",value:this.getCompareValue("attr-soldermask",u)}),(s["attr-soldermask-toplayer"]==null||s["attr-soldermask-toplayer"].value!=He)&&(s["attr-soldermask-toplayer"]={title:"Top Solder",value:this.getCompareValue("attr-soldermask-toplayer",e.expansionType===1?"Follow Rule":c)}),(s["attr-soldermask-bottomlayer"]==null||s["attr-soldermask-bottomlayer"].value!=He)&&(s["attr-soldermask-bottomlayer"]={title:"Bottom Soler",value:this.getCompareValue("attr-soldermask-bottomlayer",e.expansionType===1?"Follow Rule":h)});let d=e.net,p=0;this._netLengthMap.has(d)?p=this._netLengthMap.get(d):(p=ze.getNetLength(d),this._netLengthMap.set(d,p)),(s["attr-net-length"]==null||s["attr-net-length"].value!=He)&&(s["attr-net-length"]={title:"Net Length",value:this.getCompareValue("attr-net-length",Xe(p,void 0,i,this.unitConversion))});let m=e.padRule;if(m?((s["attr-pad-thermal-type"]==null||s["attr-pad-thermal-type"].value!=He)&&(s["attr-pad-thermal-type"]={title:"Thermal",value:this.getCompareValue("attr-pad-thermal-type",2)}),(s["attr-pad-connection"]==null||s["attr-pad-connection"].value!=He)&&(s["attr-pad-connection"]={title:"Pad Connection",value:this.getCompareValue("attr-pad-connection",m.connectMode)}),(s["attr-spoke-angles"]==null||s["attr-spoke-angles"].value!=He)&&(s["attr-spoke-angles"]={title:"Spoke Angles",value:this.getCompareValue("attr-spoke-angles",xe(m.lineAngle/Math.PI*180,3))}),(s["attr-spoke-width"]==null||s["attr-spoke-width"].value!=He)&&(s["attr-spoke-width"]={title:"Spoke Width",value:this.getCompareValue("attr-spoke-width",Xe(m.lineWidth,void 0,i,this.unitConversion))}),(s["attr-spoke-spacing"]==null||s["attr-spoke-spacing"].value!=He)&&(s["attr-spoke-spacing"]={title:"Spoke Spacing",value:this.getCompareValue("attr-spoke-spacing",Xe(m.lineClearance,void 0,i,this.unitConversion))})):(s["attr-pad-thermal-type"]==null||s["attr-pad-thermal-type"].value!=He)&&(s["attr-pad-thermal-type"]={title:"Thermal",value:this.getCompareValue("attr-pad-thermal-type",1)}),l!=null&&l instanceof Me){let P=as.getInstance().getPadLenByModel(e.model);(s["attr-pad-len"]==null||s["attr-pad-len"].value!=He)&&(s["attr-pad-len"]={title:"Pin length",value:this.getCompareValue("attr-pad-len",Xe(P,void 0,i,this.unitConversion))})}else if(x.getInstance().doctype==bi.FOOTPRINT){let P=e.padLen;(s["attr-pad-len"]==null||s["attr-pad-len"].value!=He)&&(s["attr-pad-len"]={title:"Pin length",value:this.getCompareValue("attr-pad-len",Xe(P,void 0,i,this.unitConversion))})}let g=e.attrsMap,y=new Array;for(let P in g){let T=g[P],I={key:P,value:T,update:!1};!I.update&&l!=null&&l instanceof Me&&((b=Ji.getItem(l.footprintUUID).getModelBy(e.model.modelType,e.globalIndex.replace(l.globalIndex,"")).attrsMap)==null?void 0:b[P])==T?I.update=!1:I.update=!0,y.push(I)}return this.unionAttribute=this.getUnionAttrs(this.unionAttribute,y,e.globalIndex),this.interAttribute=this.getIntersectionAttrs(this.interAttribute,y),(s["attr-array"]==null||s["attr-array"].value!=He)&&(s["attr-array"]={title:"Attribute",value:Array.from(this.interAttribute.values())}),this}modifyBy(e,r){let i=new ft,n=x.getInstance().origin,s=e["attr-layerid"];s!=null&&(this.pad.layerId=parseInt(s));for(let a in e)if(a=="attr-layerid")this.pad.layerId=parseInt(e[a]);else if(a=="attr-select-net")this.pad.net=e[a],y_(this.pad,r);else if(a=="attr-combination"){let l=this.modifyCombination(e[a],this.pad);r&&l.forEach(c=>r.addCommand(c))}else if(a=="attr-number")this.pad.num=e[a];else if(a=="attr-x"||a=="attr-y"){if(this.pad.locked)continue;let l=parseFloat(e[a])/10;x.getInstance().unit!="mil"&&(l=i.conversion(x.getInstance().unit,"mil",l));let c;a=="attr-x"?c=new S(l+n.x,this.pad.center.y):c=new S(this.pad.center.x,l+n.y);let h=this.pad.getParent();if(tp.moveWhole&&h instanceof Me){r.addCommand(Te.dispatch(h,"modify"));let u=Ae.translate(c.x-this.pad.center.x,c.y-this.pad.center.y,0);this.pad.getParent().transform(u),A.publish("flushSelectingInfo","")}else this.pad.center=c}else if(a=="attr-rotation"){let l=parseFloat(e[a])/180*Math.PI;this.pad.rotation=l}else if(a=="attr-locked"){let l=e[a]=="yes",c=this.pad.getParent();c!=null&&c instanceof Me?(r.addCommand(Te.dispatch(c,"modify")),c.locked=l,this.pad.locked=l):this.pad.locked=l}else if(a=="attr-pad-hole-shape")this.pad.holeShape=e[a];else if(a=="attr-pad-hole-diameter"){let l=parseFloat(e[a])/10;x.getInstance().unit!="mil"&&(l=i.conversion(x.getInstance().unit,"mil",l)),this.pad.holeRadius=l/2}else if(a=="attr-pad-hole-length"){let l=parseFloat(e[a])/10;x.getInstance().unit!="mil"&&(l=i.conversion(x.getInstance().unit,"mil",l)),this.pad.holeLength=l}else if(a=="attr-pad-hole-width"){let l=parseFloat(e[a])/20;x.getInstance().unit!="mil"&&(l=i.conversion(x.getInstance().unit,"mil",l)),this.pad.holeRadius=l}else if(a=="attr-pad-hole-rotation"){let l=parseFloat(e[a])/180*Math.PI;this.pad.holeRotation=l}else if(a=="attr-pad-offset-x"){let l=parseFloat(e[a])/10;x.getInstance().unit!="mil"&&(l=i.conversion(x.getInstance().unit,"mil",l)),this.pad.holeOffset=new S(l,this.pad.holeOffset.y)}else if(a=="attr-pad-offset-y"){let l=parseFloat(e[a])/10;x.getInstance().unit!="mil"&&(l=i.conversion(x.getInstance().unit,"mil",l)),this.pad.holeOffset=new S(this.pad.holeOffset.x,l)}else if(a=="attr-pad-plated"){let l=e[a]=="yes";this.pad.plated=l}else if(a=="attr-soldermask-showtype")this.pad.expansionType=parseInt(e[a]);else if(a=="attr-pastemask"){let l=parseFloat(e[a])/10;isNaN(l)||(x.getInstance().unit!="mil"&&(l=i.conversion(x.getInstance().unit,"mil",l)),this.pad.pasteExpansion=l)}else if(a=="attr-soldermask"){let l=parseFloat(e[a])/10;isNaN(l)||(x.getInstance().unit!="mil"&&(l=i.conversion(x.getInstance().unit,"mil",l)),this.pad.layerId==1?this.pad.topSolderExpansion=l:this.pad.layerId==2&&(this.pad.bottomSolderExpansion=l))}else if(a=="attr-soldermask-toplayer"){let l=parseFloat(e[a])/10;isNaN(l)||(x.getInstance().unit!="mil"&&(l=i.conversion(x.getInstance().unit,"mil",l)),this.pad.topSolderExpansion=l)}else if(a=="attr-soldermask-bottomlayer"){let l=parseFloat(e[a])/10;isNaN(l)||(x.getInstance().unit!="mil"&&(l=i.conversion(x.getInstance().unit,"mil",l)),this.pad.bottomSolderExpansion=l)}else if(a=="attr-pad-thermal-type"){let l=parseInt(e[a]);this.pad.padRuleType=l}else if(a=="attr-pad-connection")if(+e[a]===0){let l=te.getInstance().getRuleByNet(this.pad.net,10),c=this.pad.layerId!==12,h=this.pad.layerId;this.pad.padRule=Su.getPadRule(+e[a],c?l.getSingleLineClearance(h):l.getMultiLineClearance(),c?l.getSingleLineWidth(h):l.getMultiLineWidth(),c?l.getSingleLineAngle(h):l.getMultiLineAngle())}else this.pad.padRule=Su.getPadRuleByconnectMode(+e[a],this.pad.padRule);else if(a=="attr-spoke-width"){let l=parseFloat(e[a])/10;isNaN(l)||(x.getInstance().unit!="mil"&&(l=i.conversion(x.getInstance().unit,"mil",l)),this.pad.padRule=Su.getPadRuleBylineWidth(l,this.pad.padRule))}else if(a=="attr-spoke-angles")this.pad.padRule=Su.getPadRuleBylineAngle(parseFloat(e[a])*Math.PI/180,this.pad.padRule);else if(a=="attr-spoke-spacing"){let l=parseFloat(e[a])/10;isNaN(l)||(x.getInstance().unit!="mil"&&(l=i.conversion(x.getInstance().unit,"mil",l)),this.pad.padRule=Su.getPadRuleBylineClearance(l,this.pad.padRule))}else if(a=="attr-pad-len"){let l=parseFloat(e[a])/10;isNaN(l)||(x.getInstance().unit!="mil"&&(l=i.conversion(x.getInstance().unit,"mil",l)),x.getInstance().doctype==bi.FOOTPRINT?this.pad.padLen=l:as.getInstance().setPadLenByModel(this.pad.model,l))}else if(a=="attr-array"){let l=e[a];for(let c of l)c.update==null||c.update?c.isAdd?this.updateAttr(c,this.pad):this.pad.attrsMap[c.key]!==void 0&&this.updateAttr(c,this.pad):this.restoreAttr(c,this.pad)}}updateAttr(e,r){e.value!==He&&r.modifyATTRMap(e.key,e.value||"")}restoreAttr(e,r){var n;let i=r.getParent();if(i&&i instanceof Me){let l=(n=Ji.getItem(i.footprintUUID).getModelBy(r.model.modelType,r.globalIndex.replace(i.globalIndex,"")).attrsMap)==null?void 0:n[e.key];l?r.modifyATTRMap(e.key,l.toString()):r.deleteATTRMap(e.key)}else r.deleteATTRMap(e.key)}isShapeChange(e){let r=["attr-layerid","attr-x","attr-y","attr-rotation","attr-pad-hole-shape","attr-pad-hole-diameter","attr-pad-hole-length","attr-pad-hole-width","attr-pad-hole-rotation","attr-pad-offset-x","attr-pad-offset-y","attr-pad-plated","attr-soldermask-showtype","attr-pastemask","attr-soldermask","attr-soldermask-toplayer","attr-soldermask-bottomlayer","attr-pad-thermal-type","attr-pad-connection","attr-spoke-angles","attr-spoke-spacing","attr-spoke-width"];for(let i in e){if(["attr-x","attr-y"].includes(i)&&tp.moveWhole)return!1;if(r.indexOf(i)>=0)return!0}return!1}getPrimitive(e){let r=new Array;for(let i of e)if(i instanceof mt)r.push(new M(i.start,i.end));else{let n=i.startAngle/Math.PI*180,s=i.startAngle===i.endAngle?360:i.endAngle/Math.PI*180,a=q.build2(i.center,n,s,i.radius,i.radius,i.sweep);r.push(a)}return r}checkDrillInInner(){let e=this.pad.pl,r=this.pad.getMathGraphics();return yb.build2(e,r).inInner()}getHoleShapeOption(){return[{value:"SLOT",text:"Slot"},{value:"ROUND",text:"Round"}]}clearCache(){var e,r;super.clearCache(),this._netLengthMap=new Map,this.existingInDevice=!1,(e=this.unionAttribute)==null||e.clear(),(r=this.interAttribute)==null||r.clear(),this.unionAttribute=null,this.interAttribute=null,this.attrIdMap={}}getUnionAttrs(e,r,i){e==null&&(e=new Map);for(let n of r){let s=e.get(n.key);this.attrIdMap[n.key]==null&&(this.attrIdMap[n.key]=[]),this.attrIdMap[n.key].push(i),s!=null?(n.value!=s.value&&(s.value=He),this.hasTrue(n.update,s.update)&&(s.update=!0)):e.set(n.key,n)}return e}getIntersectionAttrs(e,r){if(e==null||!e.size){e=new Map;for(let i of r)e.set(i.key,i);return e}else{let i=new Set(e.keys());for(let n of r){let s=e.get(n.key);s!=null&&(n.value!=s.value&&(s.value=He),this.hasTrue(n.update,s.update)&&(s.update=!0)),i.delete(n.key)}for(let n of i)e.delete(n);return e}}hasTrue(e,r){return e||r}updateAttrlist4OnlyPads(){this.attrlist["attr-array"]={title:"Attribute",value:Array.from(this.unionAttribute.values())}}};var Hde=class extends ec{constructor(){super(),this._netLengthMap=new Map,this.track=null}set(t){return this.track=t,this}getHtmlData(t){this.idList.push(t.globalIndex),this.count++;let e=x.getInstance().unit,r=x.getInstance().origin;this.attrlist==null&&(this.attrlist={});let i=this.attrlist;(i["attr-layerid"]==null||i["attr-layerid"].value!=He)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",t.layerId),options:this.poolCache.trackLayerOptions}),(i["attr-locked"]==null||i["attr-locked"].value!=He)&&(i["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",t.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(i["attr-id"]==null||i["attr-id"].value!=He)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${t.number}`),sourceId:t.globalIndex}),(i["attr-combination"]==null||i["attr-combination"].value!=He)&&(i["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",kt.getGroupNameByGroupId(t.getGroupID())||""),options:this.poolCache.combinationOptions,hasParent:t.getParent()!=null}),(i["attr-select-net"]==null||i["attr-select-net"].value!=He)&&(i["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",t.showNet),options:this.poolCache.allNetOptions||ze.getNet()}),(i["attr-stroke-width"]==null||i["attr-stroke-width"].value!=He)&&(i["attr-stroke-width"]={title:"Stroke Width",value:this.getCompareValue("attr-stroke-width",Xe(t.width,void 0,e,this.unitConversion).toString())}),(i["attr-track-length"]==null||i["attr-track-length"].value!=He)&&(i["attr-track-length"]={title:"Track Length",value:this.getCompareValue("attr-track-length",Xe(t.length,void 0,e,this.unitConversion))}),(i["attr-start-x"]==null||i["attr-start-x"].value!=He)&&(i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(t.start.x-r.x,void 0,e,this.unitConversion))}),(i["attr-start-y"]==null||i["attr-start-y"].value!=He)&&(i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(t.start.y-r.y,void 0,e,this.unitConversion))}),(i["attr-end-x"]==null||i["attr-end-x"].value!=He)&&(i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",Xe(t.end.x-r.x,void 0,e,this.unitConversion))}),(i["attr-end-y"]==null||i["attr-end-y"].value!=He)&&(i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",Xe(t.end.y-r.y,void 0,e,this.unitConversion))});let n=t.net,s=0;return this._netLengthMap.has(n)?s=this._netLengthMap.get(n):(s=ze.getNetLength(n),this._netLengthMap.set(n,s)),(i["attr-net-length"]==null||i["attr-net-length"].value!=He)&&(i["attr-net-length"]={title:"Net Length",value:this.getCompareValue("attr-net-length",Xe(s,void 0,e,this.unitConversion))}),this}clearCache(){super.clearCache(),this._netLengthMap.clear()}modifyBy(t,e,r){let i=new ft,n=x.getInstance().origin;for(let s in t)if(s=="attr-layerid"){if(this.track.locked)continue;let a=parseInt(t[s]);this.track.layerId=a}else if(s=="attr-locked"){let a=t[s]=="yes";this.track.locked=a}else if(s=="attr-stroke-width"){let a=parseFloat(t[s])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a>=nA&&(a=nA),a>=Qc&&(this.track.width=a,ce.pcbConfig.startTrackWidth=="last"&&(we.prevTrackWidth=this.track.width))}else if(s=="attr-track-length"){if(this.track.locked)continue;let a=parseFloat(t[s])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a>=oA&&(a=oA);let l=this.track.end.sub(this.track.start).normalize();if(a>=Qc)if(t.hasMultiTrack){if(r.type=="shorten"){if(r.currentIndex==r.modifyIndex){let c=r.sum-r.offset,h=this.track.start.add(l.mul(c));this.track.end=h}if(r.currentIndex>r.modifyIndex){let c=Te.dispatch(this.track,"delete");e.addCommand(c),A.publish("delete",this.track),this.track.remove()}}else if(r.currentIndex==r.modifyIndex){let c=this.track.length+(a-r.originLength),h=this.track.start.add(l.mul(c));this.track.end=h}}else{let c=this.track.start.add(l.mul(a));this.track.end=c}}else if(s=="attr-start-x"){if(this.track.locked)continue;let a=parseFloat(t[s])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a=a+n.x;let l=new S(a,this.track.start.y);this.track.start=l}else if(s=="attr-start-y"){if(this.track.locked)continue;let a=parseFloat(t[s])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a=a+n.y;let l=new S(this.track.start.x,a);this.track.start=l}else if(s=="attr-end-x"){if(this.track.locked)continue;let a=parseFloat(t[s])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a=a+n.x;let l=new S(a,this.track.end.y);this.track.end=l}else if(s=="attr-end-y"){if(this.track.locked)continue;let a=parseFloat(t[s])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a=a+n.y;let l=new S(this.track.end.x,a);this.track.end=l}else s=="attr-select-net"?this.track.net=t[s]:s=="attr-combination"&&this.modifyCombination(t[s],this.track).forEach(l=>{e.addCommand(l)})}isNeedAddVia(t){for(let e of t)if(e["attr-layerid"]!=null)return!0;return!1}};var Wde=class extends ec{constructor(){super(),this._netLengthMap=new Map,this.track=null}set(t){return this.track=t,this}getHtmlData(t){this.idList.push(t.globalIndex),this.count++;let e=x.getInstance().unit,r=x.getInstance().origin;this.attrlist==null&&(this.attrlist={});let i=this.attrlist;if((i["attr-track-type"]==null||i["attr-track-type"].value!=He)&&(i["attr-track-type"]={title:"Type",value:this.getCompareValue("attr-track-type",2)}),(i["attr-layerid"]==null||i["attr-layerid"].value!=He)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",t.layerId),options:this.poolCache.trackLayerOptions}),(i["attr-locked"]==null||i["attr-locked"].value!=He)&&(i["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",t.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(i["attr-id"]==null||i["attr-id"].value!=He)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${t.number}`),sourceId:t.globalIndex}),(i["attr-select-net"]==null||i["attr-select-net"].value!=He)&&(i["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",t.showNet),options:ze.getNet()}),i["attr-combination"]==null||i["attr-combination"].value!=He){let l=t.getGroupID();i["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",l!=null&&kt.getGroupNameByGroupId(l)||""),options:this.poolCache.combinationOptions,hasParent:t.getParent()!=null}}(i["attr-stroke-width"]==null||i["attr-stroke-width"].value!=He)&&(i["attr-stroke-width"]={title:"Line Width",value:this.getCompareValue("attr-stroke-width",Xe(t.width,void 0,e,this.unitConversion).toString())}),(i["attr-track-length"]==null||i["attr-track-length"].value!=He)&&(i["attr-track-length"]={title:"Length",value:this.getCompareValue("attr-track-length",Xe(t.length,void 0,e,this.unitConversion))}),(i["attr-track-outline-type"]==null||i["attr-track-outline-type"].value!=He)&&(i["attr-track-outline-type"]={title:"Type",value:this.getCompareValue("attr-track-outline-type",4)});let n=t.arcType;(i["attr-arc-type"]==null||i["attr-arc-type"].value!=He)&&(i["attr-arc-type"]={title:"Type",value:this.getCompareValue("attr-arc-type",n)}),n==1?((i["attr-start-x"]==null||i["attr-start-x"].value!=He)&&(i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(t.start.x-r.x,void 0,e,this.unitConversion))}),(i["attr-start-y"]==null||i["attr-start-y"].value!=He)&&(i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(t.start.y-r.y,void 0,e,this.unitConversion))}),(i["attr-end-x"]==null||i["attr-end-x"].value!=He)&&(i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",Xe(t.end.x-r.x,void 0,e,this.unitConversion))}),(i["attr-end-y"]==null||i["attr-end-y"].value!=He)&&(i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",Xe(t.end.y-r.y,void 0,e,this.unitConversion))}),(i["attr-arc-angle"]==null||i["attr-arc-angle"].value!=He)&&(i["attr-arc-angle"]={title:"Arc Angle",value:this.getCompareValue("attr-arc-angle",xe(t.angle/Math.PI*180,3))})):((i["attr-x"]==null||i["attr-x"].value!=He)&&(i["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",Xe(t.center.x-r.x,void 0,e,this.unitConversion))}),(i["attr-y"]==null||i["attr-y"].value!=He)&&(i["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",Xe(t.center.y-r.y,void 0,e,this.unitConversion))}),(i["attr-radius"]==null||i["attr-radius"].value!=He)&&(i["attr-radius"]={title:"Radius",value:this.getCompareValue("attr-radius",Xe(t.radius,void 0,e,this.unitConversion))}),(i["attr-start-arc-angle"]==null||i["attr-start-arc-angle"].value!=He)&&(i["attr-start-arc-angle"]={title:"Start Angle",value:this.getCompareValue("attr-start-arc-angle",xe(t.startAngle/Math.PI*180,3))}),(i["attr-end-arc-angle"]==null||i["attr-end-arc-angle"].value!=He)&&(i["attr-end-arc-angle"]={title:"End Angle",value:this.getCompareValue("attr-end-arc-angle",xe(t.endAngle/Math.PI*180,3))}));let s=t.net,a=0;return this._netLengthMap.has(s)?a=this._netLengthMap.get(s):(a=ze.getNetLength(s),this._netLengthMap.set(s,a)),(i["attr-net-length"]==null||i["attr-net-length"].value!=He)&&(i["attr-net-length"]={title:"Net Length",value:this.getCompareValue("attr-net-length",Xe(a,void 0,e,this.unitConversion))}),this}clearCache(){this._netLengthMap.clear(),super.clearCache()}modifyBy(t,e,r){if(this.track==null)return;let i=new ft,n=x.getInstance().origin;for(let s in t)if(s=="attr-layerid"){let a=parseInt(t[s]);this.track.layerId=a}else if(s=="attr-locked"){let a=t[s]=="yes";this.track.locked=a}else if(s=="attr-stroke-width"){let a=parseFloat(t[s])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a>=Qc&&(this.track.width=bo(a),ce.pcbConfig.startTrackWidth=="last"&&(we.prevTrackWidth=this.track.width))}else if(s=="attr-track-length"){let a=parseFloat(t[s])/10;if(x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a>=Qc){let l=this.track.end.sub(this.track.start).normalize();if(t.hasMultiTrack){if(r!=null&&r.type=="shorten"){if(r.currentIndex==r.modifyIndex){let c=r.sum-r.offset;this.track.length=c}if(r.currentIndex>r.modifyIndex&&e!=null){let c=Te.dispatch(this.track,"delete");e.addCommand(c),A.publish("delete",this.track),this.track.remove()}}else if(r!=null&&r.currentIndex==r.modifyIndex&&e!=null){let c=a-r.originLength,h=this.track.end.add(l.mul(c)),u=pr.addTrack(this.track.layerId,this.track.end,h,this.track.width,!1,this.track.net),d=Te.dispatch(u,"add");A.publish("hasModifyPcbItem",u),e.addCommand(d),this.handleSelectAddTrack(u)}}else{let c=this.track.start.add(l.mul(a));this.track.end=c}}}else if(s=="attr-start-x"){let a=parseFloat(t[s])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a=a+n.x;let l=new S(a,this.track.start.y);this.track.start=l}else if(s=="attr-start-y"){let a=parseFloat(t[s])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a=a+n.y;let l=new S(this.track.start.x,a);this.track.start=l}else if(s=="attr-end-x"){let a=parseFloat(t[s])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a=a+n.x;let l=new S(a,this.track.end.y);this.track.end=l}else if(s=="attr-end-y"){let a=parseFloat(t[s])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a=a+n.y;let l=new S(this.track.end.x,a);this.track.end=l}else if(s=="attr-select-net")this.track.net=t[s];else if(s=="attr-combination"){let a=this.modifyCombination(t[s],this.track);e!=null&&a.forEach(l=>{e.addCommand(l)})}else if(s=="attr-arc-angle"){let a=parseFloat(t[s])/180*Math.PI;isNaN(a)||(this.track.angle=a)}else if(s=="attr-arc-type")this.track.arcType=parseInt(t[s]);else if(s=="attr-start-arc-angle"){let a=parseFloat(t[s])/180*Math.PI;isNaN(a)||(this.track.startAngle=a)}else if(s=="attr-end-arc-angle"){let a=parseFloat(t[s])/180*Math.PI;isNaN(a)||(this.track.endAngle=a)}else if(s=="attr-x"){let a=parseFloat(t["attr-x"])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a=a+n.x,this.track.center=new S(a,this.track.center.y)}else if(s=="attr-y"){let a=parseFloat(t["attr-y"])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),a=a+n.y,this.track.center=new S(this.track.center.x,a)}else if(s=="attr-radius"){let a=parseFloat(t[s])/10;x.getInstance().unit!="mil"&&(a=i.conversion(x.getInstance().unit,"mil",a)),this.track.radius=a}}isNeedAddVia(t){for(let e of t)if(e["attr-layerid"]!=null)return!0;return!1}handleSelectAddTrack(t){let e=Ve.getSelects(),r=new Array;e.push(t),A.publish("clearSelect",""),e.forEach(i=>{r.push(i),i.click()}),A.publish("select",r)}};var zde=class extends ec{constructor(){super();this.existingInDevice=!1;this._netLengthMap=new Map,this.via=null}set(e){return this.via=e,this}getExtra(){return{existingInDevice:this.existingInDevice}}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=x.getInstance().unit,i=x.getInstance().origin;this.attrlist==null&&(this.attrlist={});let n=this.attrlist,s=e.getParent();if(e.getParent()!=null){let d=e.getParent();d instanceof Me&&((n["attr-footprint-id"]==null||n["attr-footprint-id"].value!=He)&&(n["attr-footprint-id"]={title:"Footprint ID",value:this.getCompareValue("attr-footprint-id",d.footprintId)}),this.existingInDevice=!0)}else(n["attr-footprint-id"]==null||n["attr-footprint-id"].value!=He)&&(n["attr-footprint-id"]={title:"Footprint ID",value:this.getCompareValue("attr-footprint-id","")});(n["attr-via-buriedhole-showtype"]==null||n["attr-via-buriedhole-showtype"].value!=He)&&(n["attr-via-buriedhole-showtype"]={title:"Type",value:this.getCompareValue("attr-via-buriedhole-showtype",e.type==1?2:1)}),(n["attr-start-layerid"]==null||n["attr-start-layerid"].value!=He)&&(n["attr-start-layerid"]={title:"Start Layer",value:this.getCompareValue("attr-start-layerid",e.startLayer),options:Zn.via()}),(n["attr-end-layerid"]==null||n["attr-end-layerid"].value!=He)&&(n["attr-end-layerid"]={title:"End Layer",value:this.getCompareValue("attr-end-layerid",e.endLayer),options:Zn.via()});let l=te.getInstance().getDefaultBlindPhysics().getOptions();e.type==1?(n["attr-via-buriedhole-type"]==null||n["attr-via-buriedhole-type"].value!=He)&&(n["attr-via-buriedhole-type"]={title:"Buried Hole Type",value:this.getCompareValue("attr-via-buriedhole-type",e.name),options:l,disabled:this.getCompareDisabledValue("attr-via-buriedhole-type",s!=null)}):(n["attr-via-buriedhole-type"]==null||n["attr-via-buriedhole-type"].value!=He)&&(n["attr-via-buriedhole-type"]={title:"Buried Hole Type",value:"",options:l,disabled:this.getCompareDisabledValue("attr-via-buriedhole-type",s!=null)}),(n["attr-select-net"]==null||n["attr-select-net"].value!=He)&&(n["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.showNet),options:this.poolCache.allNetOptions||ze.getNet()}),(n["attr-id"]==null||n["attr-id"].value!=He)&&(n["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${e.number}`),sourceId:e.globalIndex}),(n["attr-combination"]==null||n["attr-combination"].value!=He)&&(n["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",kt.getGroupNameByGroupId(e.getGroupID())||""),options:this.poolCache.combinationOptions,hasParent:e.getParent()!=null}),(n["attr-via-general-outerdiameter"]==null||n["attr-via-general-outerdiameter"].value!=He)&&(n["attr-via-general-outerdiameter"]={title:"Normal Outer Diameter",value:this.getCompareValue("attr-via-general-outerdiameter",Xe(e.radius*2,void 0,r,this.unitConversion))}),(n["attr-via-general-innerdiameter"]==null||n["attr-via-general-innerdiameter"].value!=He)&&(n["attr-via-general-innerdiameter"]={title:"Normal inner Diameter",value:this.getCompareValue("attr-via-general-innerdiameter",Xe(e.holeRadius*2,void 0,r,this.unitConversion))}),(n["attr-x"]==null||n["attr-x"].value!=He)&&(n["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",Xe(e.center.x-i.x,void 0,r,this.unitConversion))}),(n["attr-y"]==null||n["attr-y"].value!=He)&&(n["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",Xe(e.center.y-i.y,void 0,r,this.unitConversion))});let c=e.locked;s!=null&&s instanceof Me&&s.locked&&(c=s.locked),(n["attr-locked"]==null||n["attr-locked"].value!=He)&&(n["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",c?"yes":"no")}),(n["attr-soldermask-showtype"]==null||n["attr-soldermask-showtype"].value!=He)&&(n["attr-soldermask-showtype"]={title:"Solder Resist",value:this.getCompareValue("attr-soldermask-showtype",e.expansionType)}),(n["attr-soldermask-toplayer"]==null||n["attr-soldermask-toplayer"].value!=He)&&(n["attr-soldermask-toplayer"]={title:"TopLayer Solder Mask Expansion",value:this.getCompareValue("attr-soldermask-toplayer",e.expansionType===1?"Follow Rule":Xe(e.topExpansion,void 0,r,this.unitConversion))}),(n["attr-soldermask-bottomlayer"]==null||n["attr-soldermask-bottomlayer"].value!=He)&&(n["attr-soldermask-bottomlayer"]={title:"BottomLayer Solder Mask Expansion",value:this.getCompareValue("attr-soldermask-bottomlayer",e.expansionType===1?"Follow Rule":Xe(e.bottomExpansion,void 0,r,this.unitConversion))});let h=e.net,u=0;return this._netLengthMap.has(h)?u=this._netLengthMap.get(h):(u=ze.getNetLength(h),this._netLengthMap.set(h,u)),(n["attr-net-length"]==null||n["attr-net-length"].value!=He)&&(n["attr-net-length"]={title:"Net Length",value:this.getCompareValue("attr-net-length",Xe(u,void 0,r,this.unitConversion))}),this}clearCache(){super.clearCache(),this._netLengthMap.clear(),this.existingInDevice=!1}modifyBy(e,r){let i=x.getInstance().unit,n=x.getInstance().origin,s=new ft;for(let a in e)if(a=="attr-start-layerid"){let l=parseInt(e[a]);this.via.startLayer=l}else if(a=="attr-end-layerid"){let l=parseInt(e[a]);this.via.endLayer=l}else if(a=="attr-via-buriedhole-showtype"){let l=parseInt(e[a])==1?0:1;this.via.type=l,GM(this.via)}else if(a=="attr-via-buriedhole-type"){let l=e[a];l!=""?this.via.type=1:this.via.type=0,this.via.name=l,this.via.model.updateBox(),GM(this.via)}else if(a=="attr-select-net"){let l=e[a];this.via.net=l,rt.setDefaultVia({net:l,holeRadius:null,radius:null},!1)}else if(a=="attr-combination")this.modifyCombination(e[a],this.via).forEach(c=>{r.addCommand(c)});else if(a=="attr-via-general-outerdiameter"){let l=parseFloat(e[a])/20;x.getInstance().unit!="mil"&&(l=s.conversion(x.getInstance().unit,"mil",l)),l>=Qc/2&&(this.via.radius=l,ce.pcbConfig.startViaSize=="last"&&rt.setDefaultVia({net:null,holeRadius:null,radius:l},!1))}else if(a=="attr-soldermask-showtype"){let l=parseInt(e[a]);this.via.expansionType=l}else if(a=="attr-via-general-innerdiameter"){let l=parseFloat(e[a])/20;x.getInstance().unit!="mil"&&(l=s.conversion(x.getInstance().unit,"mil",l)),l>=Qc/2&&(this.via.holeRadius=l,ce.pcbConfig.startViaSize=="last"&&rt.setDefaultVia({net:null,holeRadius:l,radius:null},!1))}else if(a=="attr-x"){if(this.via.locked)continue;let l=parseFloat(e[a])/10;x.getInstance().unit!="mil"&&(l=s.conversion(x.getInstance().unit,"mil",l)),l=l+n.x;let c=new S(l,this.via.center.y);this.via.center=c}else if(a=="attr-y"){if(this.via.locked)continue;let l=parseFloat(e[a])/10;x.getInstance().unit!="mil"&&(l=s.conversion(x.getInstance().unit,"mil",l)),l=l+n.y;let c=new S(this.via.center.x,l);this.via.center=c}else if(a=="attr-locked"){let l=e[a]=="yes",c=this.via.getParent();c!=null&&c instanceof Me?(r.addCommand(Te.dispatch(c,"modify")),c.locked=l):this.via.locked=l}else if(a=="attr-soldermask-toplayer"){let l=parseFloat(e[a])/10;x.getInstance().unit!="mil"&&(l=s.conversion(x.getInstance().unit,"mil",l)),this.via.topExpansion=l}else if(a=="attr-soldermask-bottomlayer"){let l=parseFloat(e[a])/10;x.getInstance().unit!="mil"&&(l=s.conversion(x.getInstance().unit,"mil",l)),this.via.bottomExpansion=l}}check(e){let r=new Set;for(let i of e){let n=i["attr-id"],s=Hr.getItem(n);i["attr-select-net"]!=null}return r}isShapeChange(e){let r=["attr-via-general-outerdiameter","attr-soldermask-showtype","attr-via-general-innerdiameter","attr-x","attr-y","attr-soldermask-toplayer","attr-soldermask-bottomlayer"];for(let i in e)if(r.indexOf(i)>=0)return!0;return!1}isNeedOpenNetDialog(e){for(let r of e){let i=r["attr-id"],n=Hr.getItem(i),s=r["attr-select-net"];if(s!=null&&s!=n.net&&this.getConnect(n))return!0}return!1}getNewNet(e){for(let r of e){let i=r["attr-select-net"];if(i!=null)return i.toUpperCase()}return""}getConnect(e){let r=Vt.search4Types(e.buildBBox(),["Track","ArcTrack"]);for(let i of r.getTracks())if(r8(e.model,i.model)&&new Uy().checkIntersection(e.model,i.model))return!0;return!1}};var Yde=class{constructor(){this.cbs=new Array}addTask(t){this.cbs.push(t)}execute(){this.cbs.forEach(t=>{t()}),this.cbs.length=0}};var Nw=class{get pad(){return this._pad}set pad(t){this._pad=t,this.cb(t)}constructor(t){this.cb=t}};var CU=class extends ko{constructor(){super(...arguments);this.lastHightLightPad=new Array}onMouseMove(e){this.clear();let r=Wr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).pads,i=new Array;for(let n of r)n instanceof Le&&i.push(n);if(i.length>0){let n=i[0];n.click(),this.lastHightLightPad.push(n),A.windowBridge.publish("setHighlightRowByNumber",n.num,$())}else A.windowBridge.publish("setHighlightRowByNumber",null,$())}clear(){for(let e of this.lastHightLightPad)e.visible();this.lastHightLightPad.length=0}};var cqe=1.5,jde=class extends ko{constructor(){super();this.isMouseRightDown=!1;this.prevRightX=0;this.prevRightY=0;this.isMouseMidDown=!1;this.prevMidY=0;this.zoomCenter=Mt.ORIGIN;this.lastClickX=null;this.lastClickY=null;this.camera=Ni(),this.setNextTool(new dh),A.subscribe("adaptAll",()=>{if(!(!x.getInstance().isactive||23!=x.getInstance().doctype)){if(Vt.size()>0){let e=Lc(),r=new _e;e.forEach(n=>{if(n.isVisible){if(n instanceof fr&&n.getText()=="")return;r.ext1(n.buildBBox())}});let i=Ii.getBBox();if(i instanceof ut&&r.ext1(i),Ta){let n=Ta.buildBox();if(r.ext1(n),r.valid()){let s=r.build1();vI(this.camera,s,.8)}}else if(r.valid()){let n=r.build1();vI(this.camera,n,.8)}}A.publish("updateFrame","")}}),A.subscribe("adaptBBox",(e,r=.8)=>{vI(this.camera,e,r),A.publish("updateFrame","")}),A.messageBus.rpcService("FootprintPadSize",()=>new Promise((e,r)=>{let i=Kt.getAllItem(),n={};return i.forEach(s=>{let a=s.getDimensionBBox();n[s.num]={width:a.width()*10,height:a.height()*10,number:s.globalIndex}}),e(n)})),A.messageBus.rpcService("HighlightItemsInPreview",this.highlightItems.bind(this)),A.messageBus.rpcService("PreviewPanelize",e=>new _p().applyPanelize(e)),A.messageBus.subscribe("PreviewHighLightTool",()=>{let e=new CU;this.setNextTool(e)})}onKeyDown(e){A.publish("pcb_hotkey",{keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey},$())}onKeyUp(e){A.publish("pcb_hotkey",{keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey},$())}onMouseRightDown(e){this.prepare(e),e.realSceneDeltaX=0,e.realSceneDeltay=0,e.rightDown=!0,e.openMenu=!0,e.downTime=new Date().getTime(),this.isMouseRightDown=!0,this.prevRightX=e.mouseX,this.prevRightY=e.mouseY}onMouseLeftUp(e){e.leftDown=!1}onMouseRightUp(e){this.prepare(e),this.isMouseRightDown=!1,e.openMenu&&A.publish("showPreviewRightClickMenu",{x:e.mouseX,y:e.mouseY,iframeElementId:window.frameElement.id},$()),e.rightDown=!1,e.openMenu=!1}onMouseMove(e){let r=new Date().getTime();if(this.isMouseRightDown){let i=e.mouseX-this.prevRightX,n=e.mouseY-this.prevRightY;this.camera.addOffset1(i,n),this.prevRightX=e.mouseX,this.prevRightY=e.mouseY}if(this.isMouseMidDown){let n=1-(e.mouseY-this.prevMidY)/e.canvasHeight*20;n<0&&(n=1),this.setScale(n),this.prevMidY=e.mouseY}this.prepare(e),e.rightDown&&r-e.downTime<120?e.openMenu=!0:e.rightDown&&(e.realSceneDeltaX!=0||e.realSceneDeltay!=0)&&(e.openMenu=!1),Ta&&Ta.onMouseMove(e)}onMouseWheel(e){this.prepare(e);let r;e.deltaY<0?r=cqe:r=1/cqe,this.markZoomCenter(e),this.setScale(r),this.prepare(e)}onResize(e){x.getInstance().resize()}prepare(e){let r=this.mouseRealOffset(e);e.realSceneDeltaX=r.x-e.realSceneX,e.realSceneDeltay=r.y-e.realSceneY,e.realSceneX=r.x,e.realSceneY=r.y}markZoomCenter(e){this.zoomCenter=new Mt(e.mouseX,e.mouseY,0)}setScale(e){let r=this.camera.getScale();!isNaN(r)&&r!=0&&this.camera.scaleAtPoint1(e,this.zoomCenter.x,this.zoomCenter.y)}mouseRealOffset(e){let r=new Mt(e.mouseX,-e.mouseY,0),i=new Mt(e.canvasWidth/2,-e.canvasHeight/2,0);return r.sub(i).multiply4(this.camera.get2dCameraMatrix().inverse())}highlightItems(e){if(A.publish("clearSelect",""),e.length==0)return;let r=new er;e.forEach(i=>{let n=kt.getItem(i),s;if(n)n.getItems().forEach(a=>{a.click()});else{if(s=r.getItem(i),!s)return;$t.filter([s]).size>0&&(s instanceof Ki&&be.setActiveLayer(be.getLayer(s.layerId)),s.click())}}),A.publish("updateFrame","")}};function Xde(o){switch(o){case"autoLayout":return"autoLayout";case"printPDF":return"printPDF";case"openProject":return"OpenProject";case"createAnnotation":return"createAnnotation";case"placeDevice":return"placeDevice";case"newProject":return"NewProject";case"file_save":return"Save";case"close_tab":return"close_tab";case"close_all_tabs":return"close_all_tabs";case"save_all":return"SaveAll";case"tutorials":return"tutorials";case"operateBottomPanel":return"OperateBottomPanel";case"draw(arc)":return"DrawArc";case"draw(rect)":return"DrawRect";case"draw(circle)":return"DrawCircle";case"draw(polyline)":return"DrawPolyline";case"undo":return"Undo";case"redo":return"Redo";case"copy":return"Copy";case"copyToImage":return"copyToImage";case"copyToSvg":return"copyToSvg";case"copyToPng":return"copyToPng";case"cut":return"cut";case"duplicateToCursor":return"DuplicateToCursor";case"duplicateToOtherLayer":return"DuplicateToOtherLayer";case"paste":return"Paste";case"specialPaste":return"specialPaste";case"copySpecial":return"Copy Special";case"centerViewByCursor":return"CenterViewByCursor";case"MOVE_BY_CENTER_POINT":return"Move by Center Point";case"MOVE_BY_REFERENCE_POINT":return"MOVE_BY_REFERENCE_POINT";case"Delete":return"Delete Selected";case"full_screen":return"fullScreen";case"select_all":return"Select All";case"findObjects":return"Find and Replace";case"zoom(in)":return"Zoom In";case"zoom(out)":return"Zoom Out";case"fitview":return"Fit All in Window";case"Unit":return"Unit";case"showOrHideSelectedObjRatline":return"Show/Hide Selected Ratline";case"hideSelectedObjRatline":return"Hide Selected Ratline";case"showSelectedObjRatline":return"Show Selected Ratline";case"Highlight Selected Objects":return"HIGHLIGHT_SELECTED_OBJECTS";case"SwitchLayerBrightness":return"Switch Layer Brightness";case"Flip Board":return"Flip Board";case"PlaceSinglePad":return"Place Single Pad";case"place_part(testPad)":return"Place Test Point";case"PlaceVia":return"Place Via";case"PlaceViaFence":return"PlaceViaFence";case"groupSelected":return"Group Selected";case"ungroupSelected":return"Ungroup Selected";case"rotate_left":return"Rotate Left";case"align_left":return"Align Left";case"align_horizontal_center":return"Align Horizontal Centers";case"align_right":return"Align Right";case"align_top":return"Align Top";case"align_vertical_center":return"Align Vertical Centers";case"align_bottom":return"Align Bottom";case"align_grid":return"Align Grid";case"align_horizontal_equidistant":return"Horizontal Equidistant Distribution";case"align_vertical_equidistant":return"Vertical Equidistant Distribution";case"component_distribute_by_region":return"Component Distribute By Region";case"fliph":return"Flip Right and Left";case"flipv":return"Flip Up and Down";case"SingleRouting":return"Single Routing";case"MultiRouting":return"MultiRouting";case"IncreaseMultiSpace":return"IncreaseMultiSpace";case"decreaseMultiSpace":return"decreaseMultiSpace";case"draw(stretchtrack)":return"Stretch Track";case"RoutingCorner":return"Routing Corner";case"MeasureDistance":return"Measure Distance";case"Command":return"Command";case"RebuildAllCopperArea":return"Rebuild All Copper Area";case"finish":return"Finish";case"draw_end":return"Cancel";case"undoDraw":return"Backspace";case"SelectOverlap":return"Select Overlap";case"FilpPathWhileDrawing":return"Filp Path While Drawing";case"show_drawing_attr_dlg":return"Show Attribute Dialog When Placing Object";case"change_track_width_while_routing":return"Change Track Width While Routing";case"switch_common_track_width":return"Switch Common Track Width";case"switch_common_via_size":return"Switch Common Via Size While Routing/Placing Via";case"ChangetoTopLayer":return"ChangetoTopLayer";case"ChangetoBottomLayer":return"ChangetoBottomLayer";case"ChangetoInner1":return"ChangetoInner1";case"ChangetoInner2":return"ChangetoInner2";case"ChangetoInner3":return"ChangetoInner3";case"ChangetoInner4":return"ChangetoInner4";case"ChangetoInner5":return"ChangetoInner5";case"ChangetoInner6":return"ChangetoInner6";case"ChangeCopperZoneVisibleorInvisible":return"ChangeCopperZoneVisibleorInvisible";case"DisplayAllLayers":return"DisplayAllLayers";case"scrollLeft":return"Scroll Left";case"scrollRight":return"Scroll Right";case"scrollUp":return"Scroll Up";case"scrollDown":return"Scroll Down";case"highlightConnectedsByWire":return"Highlight Or Unhighlight Net";case"showOrHideNumberOrNetName":return"Show Or Hide Number Or Net Name";case"UnhighlightSelectedObjects":return"Unhighlight All";case"moveSelectedLeft":return"Move Selected Left";case"moveSelectedRight":return"Move Selected Right";case"moveSelectedUp":return"Move Selected Up";case"moveSelectedDown":return"Move Selected Down";case"switchToTheNextSignalLayer":return"Switch to the Next Signal Layer";case"switchToThePreviousSignalLayer":return"Switch to the Previous Signal Layer";case"switchToTheNextLayer":return"Switch to the Next Layer";case"switchToThePreviousLayer":return"Switch to the Previous Layer";case"crossProbe":return"pcbCrossProbe";case"increaseSnakeGap":return"increaseSnakeGap";case"decreaseSnakeGap":return"decreaseSnakeGap";case"changeDiffPairFanOutMode":return"changeDiffPairFanOutMode";case"switchSelectedRangeWhenObjectIsSelected":return"Switch Selected Range When Object Is Selected";case"switchNextDoc":return"switchNextDoc";case"switchPreDoc":return"switchPreDoc";case"setOriginByCoordinate":return"setOriginByCoordinate";case"draw(origin)":return"draw(origin)";case"placeOriginCenter":return"placeOriginCenter";case"draw(arcCenter)":return"draw(arcCenter)";case"layerOptionsSet":return"layerOptionsSet";case"displayRealTimeNetLengthAndLengthTolerance":return"displayRealTimeNetLengthAndLengthTolerance";case"draw(dimension)":return"draw(dimension)";case"draw(PCopper)":return"draw(PCopper)";case"switchToLayer(1)":return"switchToLayer(1)";case"switchToLayer(2)":return"switchToLayer(2)";case"placePad":return"placePad";case"changeRoutingAngle":return"changeRoutingAngle";case"changeRoutingMode":return"changeRoutingMode";case"importChangesFromSch":return"importChangesFromSch";case"importChangesFromPcb":return"importChangesFromPcb";case"reuseTemplateLayoutAndRoute":return"reuseTemplateLayoutAndRoute";case"showAbsoluteOffsetDialog":return"showAbsoluteOffsetDialog";case"showRelativeOffsetDialog":return"showRelativeOffsetDialog";case"expandAndModifyProperties":return"expandAndModifyProperties";case"toggleLocked":return"toggleLocked";case"toolbar_toggle(leftbar)":return"toolbar_toggle(leftbar)";case"toolbar_toggle(rightbar)":return"toolbar_toggle(rightbar)";case"switchPreDoc":return"switchPreDoc";case"switchNextDoc":return"switchNextDoc";case"switchNextDocByNatural":return"switchNextDocByNatural";case"switchPreDocByNatural":return"switchPreDocByNatural";case"draw(origin)":return"draw(origin)";case"setOriginByCoordinate":return"setOriginByCoordinate";case"draw(difftrack)":return"draw(difftrack)";case"equalLengthTuning":return"equalLengthTuning";case"toggleAdsorb":return"toggleAdsorb";case"openMenu(#mm-common-file)":return"openMenu(#mm-common-file)";case"openMenu(#mm-common-edit)":return"openMenu(#mm-common-edit)";case"openMenu(#mm-common-view)":return"openMenu(#mm-common-view)";case"openMenu(#mm-common-place)":return"openMenu(#mm-common-place)";case"openMenu(#mm-common-design)":return"openMenu(#mm-common-design)";case"openMenu(#mm-common-route)":return"openMenu(#mm-common-route)";case"openMenu(#mm-common-layout)":return"openMenu(#mm-common-layout)";case"openMenu(#mm-common-tools)":return"openMenu(#mm-common-tools)";case"openMenu(#mm-common-fabrication2)":return"openMenu(#mm-common-fabrication2)";case"openMenu(#mm-common-order)":return"openMenu(#mm-common-order)";case"openMenu(#mm-common-advanced)":return"openMenu(#mm-common-advanced)";case"openMenu(#mm-common-settings)":return"openMenu(#mm-common-settings)";case"openMenu(#mm-common-help)":return"openMenu(#mm-common-help)";case"new_board":return"new_board";case"new_schematic":return"new_schematic";case"new_PCB":return"new_PCB";case"new_Panel":return"new_Panel";case"new_device":return"new_device";case"new_NetFlag":return"new_NetFlag";case"new_NetPort":return"new_NetPort";case"new_Drawing":return"new_Drawing";case"new_Non_Electronic":return"new_Non_Electronic";case"new_schematicLib":return"new_schematicLib";case"new_footprint":return"new_footprint";case"new_3D_model":return"new_3D_model";case"new_CBB":return"new_CBB";case"standard_edition_migration":return"standard_edition_migration";case"projectSaveAsCloud":return"projectSaveAsCloud";case"projectSaveAsLocal":return"projectSaveAsLocal";case"docSaveAsCloud":return"docSaveAsCloud";case"docSaveAsLocal":return"docSaveAsLocal";case"selectedBSSaveAsCloud":return"selectedBSSaveAsCloud";case"selectedBSSaveAsLocal":return"selectedBSSaveAsLocal";case"backup":return"backup";case"version_management":return"version_management";case"new_node":return"new_node";case"new_branch":return"new_branch";case"recovery":return"recovery";case"cacheRecovery":return"cacheRecovery";case"importDXF":return"importDXF";case"insertImage":return"insertImage";case"importFile(easyeda)":return"importFile(easyeda)";case"file_open":return"file_open";case"importFile(altium)":return"importFile(altium)";case"importFile(eagle)":return"importFile(eagle)";case"importFile(kicad)":return"importFile(kicad)";case"importFile(pads)":return"importFile(pads)";case"importFile(protel)":return"importFile(protel)";case"importFile(ltspice)":return"importFile(ltspice)";case"importSes":return"importSes";case"importNetlist":return"importNetlist";case"exportBOM":return"exportBOM";case"pcb_fabrication":return"pcb_fabrication";case"pcb_export_coordinate_file":return"pcb_export_coordinate_file";case"export3DFile":return"export3DFile";case"export3DShellFile":return"export3DShellFile";case"openDxfExportDlg":return"openDxfExportDlg";case"export(filePdf)":return"export(filePdf)";case"exportTestPointReport":return"exportTestPointReport";case"exportManufacturingFilesForOneClick":return"exportManufacturingFilesForOneClick";case"export(altium)":return"export(altium)";case"exportDSN":return"exportDSN";case"closeProject":return"closeProject";case"clearRecentList":return"clearRecentList";case"source(easyEDA)":return"source(easyEDA)";case"MOVE_BY_ORIGIN_POINT":return"MOVE_BY_ORIGIN_POINT";case"delete-target":return"delete-target";case"delete-all":return"delete-all";case"continuousSelection":return"continuousSelection";case"rectangleOutside":return"rectangleOutside";case"rectangleInside":return"rectangleInside";case"polygonInside":return"polygonInside";case"polygonOutside":return"polygonOutside";case"lineTouched":return"lineTouched";case"connectedCopper":return"connectedCopper";case"editArray":return"editArray";case"ADD_FILLET":return"ADD_FILLET";case"ADD_CHAMFER":return"ADD_CHAMFER";case"unlockAll":return"unlockAll";case"connectPads":return"connectPads";case"Preview2D":return"Preview2D";case"Preview3D":return"Preview3D";case"Preview3DInNewWindow":return"Preview3DInNewWindow";case"fitview":return"fitview";case"adaptSelectionView":return"adaptSelectionView";case"adaptAreaSelectionView":return"adaptAreaSelectionView";case"fitBoard":return"fitBoard";case"switchView(normal)":return"switchView(normal)";case"switchView(outline)":return"switchView(outline)";case"brightness(0)":return"brightness(0)";case"brightness(1)":return"brightness(1)";case"brightness(2)":return"brightness(2)";case"gridSnapKeepRatio":return"gridSnapKeepRatio";case"setGridSize":return"setGridSize";case"setGridRange":return"setGridRange";case"switchGridType(outlets)":return"switchGridType(outlets)";case"switchGridType(grid)":return"switchGridType(grid)";case"switchGridType(none)":return"switchGridType(none)";case"hideSelectedComponentRatline":return"hideSelectedComponentRatline";case"hideAllRatline":return"hideAllRatline";case"showSelectedComponentRatline":return"showSelectedComponentRatline";case"showAllRatline":return"showAllRatline";case"HIGHLIGHT_COMPONENT":return"HIGHLIGHT_COMPONENT";case"HIGHLIGHT_SELECTED_OBJECTS":return"HIGHLIGHT_SELECTED_OBJECTS";case"HIGHLIGHT_CANCEL_COMPONENT":return"HIGHLIGHT_CANCEL_COMPONENT";case"HIGHLIGHT_CANCEL_SELECTED_OBJECTS":return"HIGHLIGHT_CANCEL_SELECTED_OBJECTS";case"toolbar_toggle(topbar)":return"toolbar_toggle(topbar)";case"boolIntersection":return"boolIntersection";case"boolAggregate":return"boolAggregate";case"boolSubtraction":return"boolSubtraction";case"boolExclusive":return"boolExclusive";case"boolSplit":return"boolSplit";case"draw(rectSutureVia)":return"draw(rectSutureVia)";case"draw(polygonSutureVia)":return"draw(polygonSutureVia)";case"draw(lineSutureVia)":return"draw(lineSutureVia)";case"place_part(line_pads)":return"place_part(line_pads)";case"place_part(rect_pads)":return"place_part(rect_pads)";case"draw(ROutline)":return"draw(ROutline)";case"draw(POutline)":return"draw(POutline)";case"draw(COutline)":return"draw(COutline)";case"Cutout":return"Cutout";case"draw(RCutout)":return"draw(RCutout)";case"draw(CCutout)":return"draw(CCutout)";case"draw(PCutout)":return"draw(PCutout)";case"avoidSlots":return"avoidSlots";case"avoidPads":return"avoidPads";case"draw(RCopper)":return"draw(RCopper)";case"draw(CCopper)":return"draw(CCopper)";case"draw(RRegion)":return"draw(RRegion)";case"draw(PRegion)":return"draw(PRegion)";case"draw(CRegion)":return"draw(CRegion)";case"draw(RectFPCStiffener)":return"draw(RectFPCStiffener)";case"draw(CirFPCStiffener)":return"draw(CirFPCStiffener)";case"draw(PolyFPCStiffener)":return"draw(PolyFPCStiffener)";case"draw(RSlot)":return"draw(RSlot)";case"draw(PSlot)":return"draw(PSlot)";case"draw(CSlot)":return"draw(CSlot)";case"draw(RProhibit)":return"draw(RProhibit)";case"draw(PProhibit)":return"draw(PProhibit)";case"draw(CProhibit)":return"draw(CProhibit)";case"draw(arc2)":return"draw(arc2)";case"place_part(testPad)":return"place_part(testPad)";case"place_part(autoTestPad)":return"place_part(autoTestPad)";case"showTextDialog_pcb":return"showTextDialog_pcb";case"draw(protractor)":return"draw(protractor)";case"draw(radius)":return"draw(radius)";case"place_part(stack_table)":return"place_part(stack_table)";case"place_part(drill_table)":return"place_part(drill_table)";case"placeOriginPad":return"placeOriginPad";case"draw(R3dShellOutline)":return"draw(R3dShellOutline)";case"draw(C3dShellOutline)":return"draw(C3dShellOutline)";case"draw(P3dShellOutline)":return"draw(P3dShellOutline)";case"place_part(3dShellScrewPillar)":return"place_part(3dShellScrewPillar)";case"draw(3dShellSideSlotDatumLine)":return"draw(3dShellSideSlotDatumLine)";case"draw(R3dShellSideSlotRegion)":return"draw(R3dShellSideSlotRegion)";case"draw(C3dShellSideSlotRegion)":return"draw(C3dShellSideSlotRegion)";case"draw(P3dShellSideSlotRegion)":return"draw(P3dShellSideSlotRegion)";case"draw(R3dShellTopSlotRegion)":return"draw(R3dShellTopSlotRegion)";case"draw(C3dShellTopSlotRegion)":return"draw(C3dShellTopSlotRegion)";case"draw(P3dShellTopSlotRegion)":return"draw(P3dShellTopSlotRegion)";case"draw(R3dShellSideEntity)":return"draw(R3dShellSideEntity)";case"draw(C3dShellSideEntity)":return"draw(C3dShellSideEntity)";case"draw(P3dShellSideEntity)":return"draw(P3dShellSideEntity)";case"draw(R3dShellTopBottomEntity)":return"draw(R3dShellTopBottomEntity)";case"draw(C3dShellTopBottomEntity)":return"draw(C3dShellTopBottomEntity)";case"draw(P3dShellTopBottomEntity)":return"draw(P3dShellTopBottomEntity)";case"pcb_DRC":return"pcb_DRC";case"checkERC":return"checkERC";case"checkDRCCustom":return"checkDRCCustom";case"clearErrors":return"clearErrors";case"toggleRealTimeDRC":return"toggleRealTimeDRC";case"ref_designator_annotate":return"ref_designator_annotate";case"netClassManager":return"netClassManager";case"differentialPairManager":return"differentialPairManager";case"equalLengthGroupManager":return"equalLengthGroupManager";case"EditPadsPairGroupDialog":return"EditPadsPairGroupDialog";case"updateComponent":return"updateComponent";case"updateReuseBlock":return"updateReuseBlock";case"trackWidthSetting(WIRING_WIDTH_FOLLOWRULES)":return"trackWidthSetting(WIRING_WIDTH_FOLLOWRULES)";case"trackWidthSetting(WIRING_WIDTH_RULESSETTING)":return"trackWidthSetting(WIRING_WIDTH_RULESSETTING)";case"trackWidthSetting(WIRING_WIDTH_INPUT)":return"trackWidthSetting(WIRING_WIDTH_INPUT)";case"removeLoop":return"removeLoop";case"autoTrimSilkscreen":return"autoTrimSilkscreen";case"unrouteClearConnect":return"unrouteClearConnect";case"unrouteClearNetwork":return"unrouteClearNetwork";case"diffPairEqualLengthTuning":return"diffPairEqualLengthTuning";case"clearAllRoute":return"clearAllRoute";case"joinGroup":return"joinGroup";case"reuseLayoutRoute":return"reuseLayoutRoute";case"ungroupAll":return"ungroupAll";case"set-attr-text-position":return"set-attr-text-position";case"swapLocation":return"swapLocation";case"flip2OppositeSide":return"flip2OppositeSide";case"absoluteOffset":return"absoluteOffset";case"relativeOffset":return"relativeOffset";case"distribute_left_side_edge_equidistant":return"distribute_left_side_edge_equidistant";case"distribute_top_side_edge_equidistant":return"distribute_top_side_edge_equidistant";case"distribute_horizontal_by_center_distance":return"distribute_horizontal_by_center_distance";case"distribute_vertical_by_center_distance":return"distribute_vertical_by_center_distance";case"distribute_horizontal_by_edges_distance":return"distribute_horizontal_by_edges_distance";case"distribute_vertical_by_edges_distance":return"distribute_vertical_by_edges_distance";case"distribute":return"distribute";case"component_distribute_by_region":return"component_distribute_by_region";case"rotate_right":return"rotate_right";case"rotate_reference_point":return"rotate_reference_point";case"fliph_reference_point":return"fliph_reference_point";case"flipv_reference_point":return"flipv_reference_point";case"smartSize":return"smartSize";case"checkDimension":return"checkDimension";case"renumberPads":return"renumberPads";case"teardrop":return"teardrop";case"openPanelizeDlg":return"openPanelizeDlg";case"removeUnusedPad":return"removeUnusedPadDlg";case"prioritizeObjectSelection":return"prioritizeObjectSelection";case"clearMeasureResults":return"clearMeasureResults";case"creepageDistance":return"creepageDistance";case"openDeviceManager":return"openDeviceManager";case"openDeviceStandardizationTab":return"openDeviceStandardizationTab";case"log-tool":return"log-tool";case"view3DModelManager":return"view3DModelManager";case"viewPinDelayManager":return"viewPinDelayManager";case"openPcbComparisonDlg":return"openPcbComparisonDlg";case"viewCopperAreaManager":return"viewCopperAreaManager";case"commonButtonsSetting(SYSTEM)":return"commonButtonsSetting(SYSTEM)";case"commonButtonsSetting(CATEGORY)":return"commonButtonsSetting(CATEGORY)";case"commonButtonsSetting(BASE_LIBRARY)":return"commonButtonsSetting(BASE_LIBRARY)";case"commonButtonsSetting(CANVAS)":return"commonButtonsSetting(CANVAS)";case"commonButtonsSetting(OBJECT)":return"commonButtonsSetting(OBJECT)";case"commonButtonsSetting(PCB_FOOTPRINT)":return"commonButtonsSetting(PCB_FOOTPRINT)";case"commonButtonsSetting(PCB_THEME)":return"commonButtonsSetting(PCB_THEME)";case"commonButtonsSetting(PCB_COMM_GRID_SIZE)":return"commonButtonsSetting(PCB_COMM_GRID_SIZE)";case"commonButtonsSetting(PCB_COMM_TRACK_WIDTH)":return"commonButtonsSetting(PCB_COMM_TRACK_WIDTH)";case"commonButtonsSetting(PCB_COMM_VIA_SIZE)":return"commonButtonsSetting(PCB_COMM_VIA_SIZE)";case"commonButtonsSetting(ADSORPTION)":return"commonButtonsSetting(ADSORPTION)";case"commonButtonsSetting(PANEL_CANVAS)":return"commonButtonsSetting(PANEL_CANVAS)";case"commonButtonsSetting(PANEL_THEME)":return"commonButtonsSetting(PANEL_THEME)";case"commonButtonsSetting(COMM_TYPEFACE)":return"commonButtonsSetting(COMM_TYPEFACE)";case"commonButtonsSetting(DESIGN)":return"commonButtonsSetting(DESIGN)";case"commonButtonsSetting(PROPERTY)":return"commonButtonsSetting(PROPERTY)";case"commonButtonsSetting(HOTKEY)":return"commonButtonsSetting(HOTKEY)";case"commonButtonsSetting(CUSTOM_TOOLBAR)":return"commonButtonsSetting(CUSTOM_TOOLBAR)";case"commonButtonsSetting(SAVE)":return"commonButtonsSetting(SAVE)";case"show_help_file(community)":return"show_help_file(community)";case"show_help_file(contact)":return"show_help_file(contact)";case"show_about":return"show_about";case"opensubmenu-move":return"opensubmenu-move";case"opensubmenu-new":return"opensubmenu-new";case"opensubmenu-import":return"opensubmenu-import";case"opensubmenu-selectobj":return"opensubmenu-selectobj";case"opensubmenu-gridsize-pcb":return"opensubmenu-gridsize-pcb";case"opensubmenu-drawline":return"opensubmenu-drawline";case"opensubmenu-dimension":return"opensubmenu-dimension";case"opensubmenu-export":return"opensubmenu-export";case"opensubmenu-recent":return"opensubmenu-recent";case"opensubmenu-pad":return"opensubmenu-pad";case"switchVersion":return"switchVersion";case"historicalRecords":return"historicalRecords";case"bom_order_parts":return"bom_order_parts";case"orderPCB":return"orderPCB";case"order3DShell":return"order3DShell";case"show_help_file(part_store)":return"show_help_file(part_store)";case"show_help_file(pcb_manu_facturing)":return"show_help_file(pcb_manu_facturing)";case"show_help_file(3d_cnc)":return"show_help_file(3d_cnc)";case"opensubmenu-delete":return"opensubmenu-delete";case"opensubmenu-duplicate":return"opensubmenu-duplicate";case"opensubmenu-snapsize":return"opensubmenu-snapsize";case"opensubmenu-gridtype-pcb":return"opensubmenu-gridtype-pcb";case"opensubmenu-ratline":return"opensubmenu-ratline";case"opensubmenu-highlight-pcb":return"opensubmenu-highlight-pcb";case"opensubmenu-suturevias":return"opensubmenu-suturevias";case"opensubmenu-boardoutline":return"opensubmenu-boardoutline";case"opensubmenu-testPad":return"opensubmenu-testPad";case"opensubmenu-saveas":return"opensubmenu-saveas";case"copperRegion":return"copperRegion";case"fillRegion":return"fillRegion";case"opensubmenu-fpcStiffener":return"opensubmenu-fpcStiffener";case"prohibitedRegion":return"prohibitedRegion";case"opensubmenu-slotRegion":return"opensubmenu-slotRegion";case"opensunmenu-3dShellOutline":return"opensunmenu-3dShellOutline";case"opensubmenu-3DShellSideSlotRegion":return"opensubmenu-3DShellSideSlotRegion";case"opensubmenu-3DShell-Top_Bottom-SlotRegion":return"opensubmenu-3DShell-Top_Bottom-SlotRegion";case"opensubmenu-3DShell-SideEntity":return"opensubmenu-3DShell-SideEntity";case"opensubmenu-3DShell-TopEntity":return"opensubmenu-3DShell-TopEntity";case"opensubmenu-unroute":return"opensubmenu-unroute";case"opensubmenu-offset":return"opensubmenu-offset";case"opensubmenu-group":return"opensubmenu-group";case"opensubmenu-align":return"opensubmenu-align";case"opensubmenu-distribute":return"opensubmenu-distribute";case"opensubmenu-rotate":return"opensubmenu-rotate";case"opensubmenu-flip":return"opensubmenu-flip";case"opensubmenu-canvasOrigin":return"opensubmenu-canvasOrigin";case"opensubmenu-system":return"opensubmenu-system";case"opensubmenu-schematic_symbol":return"opensubmenu-schematic_symbol";case"opensubmenu-pcb_footprint":return"opensubmenu-pcb_footprint";case"opensubmenu-panel":return"opensubmenu-panel";case"opensubmenu-tabmenu":return"opensubmenu-tabmenu";case"opensubmenu-routingWidth":return"opensubmenu-routingWidth";case"auto-routing":return"auto-routing";case"pcbBatchFanout":return"pcbBatchFanout";case"resetUniqueId":return"resetUniqueId";case"select_net":return"select_net";case"decrease_routing_width":return"decrease_routing_width";case"increase_routing_width":return"increase_routing_width";case"decrease_snap_size":return"decrease_snap_size";case"increase_snap_size":return"increase_snap_size";case"move_selected_left_by_alt_grid":return"move_selected_left_by_alt_grid";case"move_selected_right_by_alt_grid":return"move_selected_right_by_alt_grid";case"move_selected_up_by_alt_grid":return"move_selected_up_by_alt_grid";case"move_selected_down_by_alt_grid":return"move_selected_down_by_alt_grid";case"open_in_new_window":return"open_in_new_window";case"refresh":return"refresh";case"clone":return"clone";case"modifyFile":return"modifyFile";case"open_create_panel_lib_dialog":return"open_create_panel_lib_dialog";case"recycleBin":return"recycleBin";case"viewPCBInformation":return"viewPCBInformation";case"pcbOptimizedPath":return"pcbOptimizedPath";case"Split":return"Split";case"CONVERT_TO_PAD":return"CONVERT_TO_PAD";case"CONVERT_TO_TRACK":return"CONVERT_TO_TRACK";case"CONVERT_TO_2D_LINE":return"CONVERT_TO_2D_LINE";case"CONVERT_TO_SLOT_REGION":return"CONVERT_TO_SLOT_REGION";case"CONVERT_TO_FILL_REGION":return"CONVERT_TO_FILL_REGION";case"CONVERT_TO_COPPER_REGION":return"CONVERT_TO_COPPER_REGION";case"CONVERT_TO_PROHIBITED_REGION":return"CONVERT_TO_PROHIBITED_REGION";case"CONVERT_TO_BOARD_OUTLINE":return"CONVERT_TO_BOARD_OUTLINE";case"CONVERT_TO_CONSTRAINT_REGION":return"CONVERT_TO_CONSTRAINT_REGION";case"CONVERT_TO_D3_SHELL_OUTLINE":return"CONVERT_TO_D3_SHELL_OUTLINE";case"CONVERT_TO_D3_SHELL_SLOT_REGION":return"CONVERT_TO_D3_SHELL_SLOT_REGION";case"CONVERT_TO_D3_SHELL_ENTITY":return"CONVERT_TO_D3_SHELL_ENTITY";case"CONVERT_TO_FPC_STIFFENER":return"CONVERT_TO_FPC_STIFFENER";case"drawpartition(Rectangle)":return"drawpartition(Rectangle)";case"drawpartition(Circle)":return"drawpartition(Circle)";case"drawpartition(Polygon)":return"drawpartition(Polygon)";case"OPEN_PARTITION_MANAGER":return"OPEN_PARTITION_MANAGER";case"INCREASE_BRIGHTNESS":return"INCREASE_BRIGHTNESS";case"DECREASE_BRIGHTNESS":return"DECREASE_BRIGHTNESS";case"stop_video_capture":return"stop_video_capture";case"show_videocapture":return"show_videocapture";case"compareNetlist":return"compareNetlist";case"runScript":return"runScript";case"scriptManager":return"scriptManager";case"showExtensionsManager":return"showExtensionsManager";case"place":return"place";case"EDIT BOUNDARY":return"EDIT BOUNDARY";default:return null}}var qde=class extends iF{constructor(e){super();this.nextTool=null;this.mouseRightDownTimer=null;this.mouseDownStatus=null;this.lastPressTime=0;this.f12Count=0;this.canvas=e,this.camera=Ni(),this.inputInfo=Pi.getInstance(),this.inputInfo.canvasWidth=e.width||1,this.inputInfo.canvasHeight=e.height||1}setNextTool(e){this.nextTool=e,this.onResize()}handler(e,r){ie.publish("updateFrame",r),this.nextTool!=null&&e(this.nextTool)}getRatio(e=1){return x.getInstance().getRatio()}getInputInfo(){return this.inputInfo}onKeyDown1(e){sr.handleHotkeyAction=Xde(e.hotkeyCmd),this.inputInfo.subMenuFunc=e.func,this.inputInfo.keyCode=e.keyCode,this.inputInfo.shiftKey=e.shiftKey,this.inputInfo.realCtrlKey=e.ctrlKey,this.inputInfo.ctrlKey=e.ctrlKey||r2&&e.metaKey,this.inputInfo.altKey=e.altKey,Pr.hasAlt=e.altKey,this.inputInfo.metaKey=e.metaKey;let r=sr.getHotKey(this.inputInfo);(sr.hotkeys.has(r)||r==sr.getCtrlShift())&&Qt.getInstance().close(),this.handler(i=>{i.onKeyDown(this.inputInfo)})}checkF12(e){if(console.log(e),e==="F12"){let r=new Date().getTime();return r-this.lastPressTime>800?this.f12Count=1:this.f12Count++,this.lastPressTime=r,this.f12Count>=3?(this.f12Count=0,!0):!1}else this.f12Count>0&&(this.f12Count=0);return!0}onKeyDown(e){this.inputInfo.keyCode=e.keyCode,this.inputInfo.shiftKey=e.shiftKey,this.inputInfo.realCtrlKey=e.ctrlKey,this.inputInfo.ctrlKey=this.isCtrl(e),this.inputInfo.altKey=e.altKey,this.inputInfo.metaKey=e.metaKey,Pr.hasAlt=e.altKey;let r=sr.getHotKey(this.inputInfo);if(!this.checkF12(r)){e.preventDefault();return}sr.useBrowserHotkey(r)||((sr.hotkeys.has(r)||r==sr.getCtrlShift())&&(e.preventDefault(),Qt.getInstance().close()),sr.isAltAndDirection(r)&&e.preventDefault(),sr.shouldPreventHotkey(r)&&e.preventDefault()),ie.publish("iframeHotkey",{event:{keyCode:e.keyCode,metaKey:e.metaKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,target:{tagName:""}},fromDoctype:x.getInstance().doctype},$()),ie.publish("recordingIframeKeyDown",{event:{key:e.key},fromDoctype:x.getInstance().doctype},$()),this.dispatchEventMessage("keydown")}onKeyUp1(e){this.inputInfo.keyCode=e.keyCode,this.inputInfo.shiftKey=e.shiftKey,this.inputInfo.ctrlKey=e.ctrlKey,this.inputInfo.altKey=e.altKey,Pr.hasAlt=e.altKey,this.inputInfo.metaKey=e.metaKey,this.handler(r=>{r.onKeyUp(this.inputInfo)})}onKeyUp(e){this.inputInfo.keyCode=e.keyCode,this.inputInfo.shiftKey=e.shiftKey,this.inputInfo.realCtrlKey=e.ctrlKey,this.inputInfo.ctrlKey=this.isCtrl(e),this.inputInfo.altKey=e.altKey,Pr.hasAlt=e.altKey,this.inputInfo.metaKey=e.metaKey,this.handler(r=>{r.onKeyUp(this.inputInfo)}),ie.publish("iframeHotkeyup",{event:{keyCode:e.keyCode,metaKey:e.metaKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,target:{tagName:""}},fromDoctype:x.getInstance().doctype},$()),ie.publish("recordingIframeKeyUp",{event:{key:e.key},fromDoctype:x.getInstance().doctype},$()),this.dispatchEventMessage("keyup")}prepare(e){this.inputInfo.mouseX=e.offsetX*this.getRatio(),this.inputInfo.mouseY=e.offsetY*this.getRatio(),this.inputInfo.shiftKey=e.shiftKey,this.inputInfo.realCtrlKey=e.ctrlKey,this.inputInfo.ctrlKey=this.isCtrl(e),this.inputInfo.altKey=e.altKey,this.inputInfo.metaKey=e.metaKey}isCtrl(e){return e.ctrlKey||r2&&e.metaKey}onMouseMove(e){this.prepare(e),this.handler(r=>{r.onMouseMove(this.inputInfo)},"mousemove"),this.dispatchEventMessage("mousemove")}onMouseWheel(e){e.preventDefault(),this.isCtrl(e)&&(e.returnValue=!1);let r=1;switch(e.deltaMode){case 1:r=40;break;case 2:r=100}this.inputInfo.deltaX=e.deltaX*r,this.inputInfo.deltaY=e.deltaY*r,this.prepare(e),this.handler(i=>{i.onMouseWheel(this.inputInfo)}),this.dispatchEventMessage("mousewheel")}onDoubleClick(e){this.prepare(e),this.handler(r=>{r.onDoubleClick(this.inputInfo)})}onResize(){this.handler(e=>{e.onResize(this.inputInfo)}),this.inputInfo.canvasWidth=this.camera.getWidth()||1,this.inputInfo.canvasHeight=this.camera.getHeight()||1,this.handler(e=>{e.onMouseMove(this.inputInfo)}),ie.publish("moveCrosshair",this.inputInfo),ie.publish("updateFrame","")}onMouseDown(e){Mn.getInstance().mouseDown=!0,this.mouseDownStatus=e.button,this.prepare(e),e.button===0?this.handler(r=>{r.onMouseLeftDown(this.inputInfo)}):e.button===1?(e.preventDefault(),this.handler(r=>{r.onMouseMidDown(this.inputInfo)})):e.button===2&&(x.getInstance().doctype!=23&&e.preventDefault(),this.mouseRightDownTimer=setTimeout(()=>{bd("grabbing"),this.inputInfo.openMenu=!1},200),this.handler(r=>{r.onMouseRightDown(this.inputInfo)})),ie.publish("recordingIframeMouseDown",{event:{clientX:e.clientX,clientY:e.clientY},fromDoctype:x.getInstance().doctype},$()),this.dispatchEventMessage("mousedown")}onMouseUp(e){this.mouseDownStatus=null,this.prepare(e),e.button===0?this.handler(r=>{r.onMouseLeftUp(this.inputInfo)}):e.button===1?(bd("default"),this.handler(r=>{r.onMouseMidUp(this.inputInfo)})):e.button===2&&(clearTimeout(this.mouseRightDownTimer),bd("default"),this.handler(r=>{r.onMouseRightUp(this.inputInfo)})),ie.publish("recordingIframeMouseUp",{event:{clientX:e.clientX,clientY:e.clientY},fromDoctype:x.getInstance().doctype},$()),this.dispatchEventMessage("mouseup"),Mn.getInstance().mouseDown=!1}onMouseLeave(e){this.inputInfo.mouseInFrame=!1,this.handler(r=>{r.onMouseLeave(this.inputInfo)})}onMouseOut(e){this.inputInfo.mouseInFrame=!1,this.handler(r=>{r.onMouseOut(this.inputInfo)})}onMouseEnter(e){this.inputInfo.mouseInFrame=!0,this.handler(r=>{r.onMouseEnter(this.inputInfo)})}onMouseOver(e){this.inputInfo.mouseInFrame=!0,this.handler(r=>{r.onMouseOver(this.inputInfo)})}onIframeBlur(e){document.visibilityState=="hidden"&&(this.inputInfo.mouseInFrame=!1,clearTimeout(this.mouseRightDownTimer),bd("default"),this.handler(r=>{r.onMouseRightUp(this.inputInfo)}))}install(){let r=!!window.frameElement&&!window["USE-IFRAME-FOR-MAIN"]&&!window["META-PANELIZE-ENV"]&&window["SILKVIEWER-SOURCE"]!=="FOREIGN-TRADE"?document:this.canvas;window.addEventListener("beforeResize",this.onResize.bind(this),!1),window.addEventListener("resize",this.onResize.bind(this),!1),ie.subscribe("keydown",this.onKeyDown1.bind(this)),ie.subscribe("keyup",this.onKeyUp1.bind(this)),window.addEventListener("keydown",this.onKeyDown.bind(this),!1),window.addEventListener("keyup",this.onKeyUp.bind(this),!1),document.documentElement.addEventListener("pointerdown",function(i){i.currentTarget&&i.buttons&2&&bd("grabbing")}),document.documentElement.addEventListener("pointermove",function(i){let n=i.currentTarget}),document.documentElement.addEventListener("pointerup",function(i){bd("default")}),r.addEventListener("mousedown",this.onMouseDown.bind(this),!1),r.addEventListener("mouseup",this.onMouseUp.bind(this),!1),r.addEventListener("mousemove",this.onMouseMove.bind(this),!1),r.addEventListener("wheel",this.onMouseWheel.bind(this),{passive:!1}),r.addEventListener("dblclick",this.onDoubleClick.bind(this),!1),r.addEventListener("mouseleave",this.onMouseLeave.bind(this),!1),r.addEventListener("mouseout",this.onMouseOut.bind(this),!1),r.addEventListener("mouseenter",this.onMouseEnter.bind(this),!1),r.addEventListener("mouseover",this.onMouseOver.bind(this),!1),document.addEventListener("paste",async i=>{var a;let n=i.clipboardData.items,s;(a=n[0])!=null&&a.type.startsWith("image/")&&(s=n[0].getAsFile());try{if((await navigator.permissions.query({name:"clipboard-read"})).state=="granted"&&s){let c=await s.arrayBuffer();ie.publish("pasteImage",{buffer:c,name:s.name,type:s.type,lastModified:s.lastModified},$())}}catch(l){console.warn("\u6743\u9650\u68C0\u6D4B\u5931\u8D25:",l)}},!1),document.addEventListener("dragover",i=>i.preventDefault()),document.addEventListener("drop",async i=>{i.preventDefault();let n=i.dataTransfer.files[0];if(n&&n.type.startsWith("image/")){let s=await n.arrayBuffer();ie.publish("pasteImage",{buffer:s,name:n.name,type:n.type,lastModified:n.lastModified},$())}}),window.addEventListener("visibilitychange",this.onIframeBlur.bind(this),!1),document.oncontextmenu=()=>!1,ie.subscribe("main2iframe/trigger-event",i=>{let{type:n,button:s}=i[0]||{};n==="mouseup"&&s===this.mouseDownStatus&&(s===0?this.handler(a=>{a.onMouseLeftUp(this.inputInfo)}):s===1?(bd("default"),this.handler(a=>{a.onMouseMidUp(this.inputInfo)})):s===2&&(clearTimeout(this.mouseRightDownTimer),bd("default"),this.handler(a=>{a.onMouseRightUp(this.inputInfo)})))})}dispatchEventMessage(e){ie.windowBridge.publish("pcb/iframeOperate",{type:e},$())}};var $de=class{constructor(t,e){this.rtree1=new nn(10);this.rtree2=new nn(10);this.left=null;this.right=null;this.distance=Number.MAX_VALUE;t.itemList.length==1?this.left=t.itemList[0]:this.rtree1=t,e.itemList.length==1?this.right=e.itemList[0]:this.rtree2=e,this.find()}findNearXPoint(t,e){let r=Number.MAX_VALUE,i=e[0];for(let n of e){let s=Math.abs(n.point.x-t.point.x);s<r&&(r=s,i=n)}return i}findNearest(t,e){let r=t.bbox().extendOfSize(this.distance),i=e.search(r),n=null,s=this.distance*this.distance;for(let a of i){let l=a.point.distance2(t.point);l<s&&(s=l,n=a)}return this.distance=Math.sqrt(s),n}find(){if(this.rtree1.itemList.length==0&&this.rtree2.itemList.length==0){this.distance=this.left.point.distance1(this.right.point);return}else if(this.rtree1.itemList.length==0&&this.rtree2.itemList.length!=0){let t=this.findNearest(this.left,this.rtree2);t!=null&&(this.right=t)}else if(this.rtree1.itemList.length!=0&&this.rtree2.itemList.length==0){let t=this.findNearest(this.right,this.rtree1);t!=null&&(this.left=t)}else{let t=this.findNearXPoint(this.rtree1.itemList[0],this.rtree2.itemList),e=this.rtree1.itemList[0].point.distance1(t.point);e<this.distance&&(this.distance=e,this.left=this.rtree1.itemList[0],this.right=t)}for(let t of this.rtree1.itemList){let e=this.findNearest(t,this.rtree2);e!=null&&(this.left=t,this.right=e)}}};var Kde=class{constructor(t,e){this.cluster1=t,this.cluster2=e,this.nearest=new $de(t.junctions,e.junctions)}build(t){let e=this.nearest.left,r=this.nearest.right;return zo.add(e.point,r.point,t,e.node.globalIndex,r.node.globalIndex)}};var Rd=class o{constructor(t){this._node=null;this.point=t}hashCode(){return this.point.hashCode()}equals(t){return t instanceof o?this.point.equals(t.point):t instanceof S?this.point.equals(t):!1}bbox(){return this.point.bbox()}get node(){return this._node}set node(t){this._node=t}};var Zde=class{constructor(t,e){this.junctions=new nn(10);this.id=e,this.junctions=t}bbox(){return this.junctions.bbox()}};var Jde=class{constructor(t){this.map=new Map;this.capacity=t}add(t,e,r){let i=this.map.get(r);i==null&&(i=new Map,this.map.set(r,i));let n=i.get(e);n==null&&(n=new nn(this.capacity),i.set(e,n)),n.add(t)}search(t,e,r){for(let i of e){let n=this.map.get(i);if(n!=null){for(let[,s]of n)if(s.conditionQuery(t,r))return}}}search4Tracks(t,e,r){for(let i of e){let n=this.map.get(i);if(n!=null){let s=n.get("Track");if(s!=null&&s.conditionQuery(t,r)||(s=n.get("ArcTrack"),s!=null&&s.conditionQuery(t,r)))return}}}search4Others(t,e,r){for(let i of e){let n=this.map.get(i);if(n!=null){for(let[s,a]of n)if(s!="Track"&&s!="ArcTrack"&&a.conditionQuery(t,r))return}}}};var Qde=class{constructor(t){this.node=t}bbox(){return this.node.buildBBox()}},H$=class extends Qde{constructor(t,e){super(t),this.point=e,this.box=e.bbox().extendOfSize(.1)}bbox(){return this.box}},W$=class o{static getCluster(t,e){let r=new nn(10);if(t.size==1){for(let i of t)if(i instanceof Le||i instanceof Ge){let n=new Rd(i.center);n.node=i}else if(i instanceof Ue){let n=new Rd(i.start);n.node=i;let s=new Rd(i.end);s.node=i,r.add(n),r.add(s)}else if(i instanceof Sr){let n=new Rd(new S(i.center.x-i.radius,i.center.y));n.node=i,r.add(n)}else if(i instanceof nr){let n=new Rd(i.start);n.node=i,r.add(n)}else if(i instanceof ct){let n=new Rd(i.start);if(n.node=i,r.add(n),i.type=="Line"&&!i.isClose()){let s=new Rd(i.end);s.node=i,r.add(s)}}else if(i instanceof ii||i instanceof Ki){let n=new Rd(i.start);n.node=i,r.add(n)}}else{let i=new Array,n=new Jde(10);for(let c of t)if(c instanceof Ue){let h=new H$(c,c.start),u=new H$(c,c.end);n.add(h,c.model.modelType,c.layerId),n.add(u,c.model.modelType,c.layerId),i.push(h),i.push(u)}else if(c instanceof Le||c instanceof Ge){n.add(new Qde(c),c.model.modelType,c.model.layerId);let h=new Rd(c.center);h.node=c,r.add(h)}else if(c instanceof Sr){let h=new Rd(new S(c.center.x-c.radius,c.center.y));h.node=c,r.add(h)}else if(c instanceof nr){let h=new Rd(c.start);h.node=c,r.add(h)}else if(c instanceof ct){let h=new Rd(c.start);if(h.node=c,r.add(h),c.type=="Line"&&!c.isClose()){let u=new Rd(c.end);u.node=c,r.add(u)}}else if(c instanceof ii||c instanceof Ki){let h=new Rd(c.start);h.node=c,r.add(h)}let s=new Hd,a=new Set,l=!1;for(let c of i){let h=function(u){if(c==u||c.node==u.node||!s.needCheckIntersection(c.node.model,u.node.model))return!1;let d=u.node;if(u instanceof H$){if(c.point.distance1(u.point)<=.1)return a.add(u),a.add(c),l=!0,!0}else if(d.model.inOutline(c.point))return a.add(c),l=!0,!0;return!1};if(!a.has(c)&&(l=!1,n.search4Tracks(c.point.bbox().extendOfSize(.1),[c.node.layerId],h),l||n.search4Others(c.bbox(),[c.node.layerId,12],h),!l)){let u=new Rd(c.point);u.node=c.node,r.add(u)}}}if(xr(r.itemList,(i,n)=>i.point.x-n.point.x,0,r.itemList.length),r.size()==0){let i=o.getDefault(t);i!=null&&r.add(i)}return new Zde(r,e)}static getDefault(t){for(let e of t)if(e instanceof Le||e instanceof Ge){let r=new Rd(e.center);return r.node=e,r}else if(e instanceof Ue){let r=new Rd(e.start);return r.node=e,r}else if(e instanceof Sr){let r=new Rd(new S(e.center.x-e.radius,e.center.y));return r.node=e,r}else if(e instanceof nr){let r=new Rd(e.start);return r.node=e,r}else if(e instanceof ct){let r=new Rd(e.start);return r.node=e,r}else if(e instanceof ii||e instanceof Ki){let r=new Rd(e.start);return r.node=e,r}return null}};var ly=class{constructor(t,e=new Set){this.exclusions=new Set;this.connects=new Set;this.clusters=new Array;this.ratline=null;this.other=null;this.net=t.net,this.item=t;let r=ze.getSameNetItems(t.net);if(r.length==0)return;let i=XS(t.net),n=new er;for(let c of i){for(let h of e)if(c.has(h==null?void 0:h.globalIndex)){for(let u of c){let d=n.getConnectNode(u);d instanceof ds&&this.exclusions.add(d)}break}if(c.has(this.item.globalIndex))for(let h of c){let u=n.getConnectNode(h);u instanceof ds&&this.connects.add(u)}}this.connects.add(this.item);let s=new Set;s.add(t);let a=0;r=r.filter(c=>{let h=!0;return(c instanceof ds&&this.exclusions.has(c)||c instanceof ii||c instanceof Ki||c instanceof Ye&&c.type=="Copper Region")&&(h=!1),h});let l=new Map;for(let c of i)for(let h of c)l.set(h,c);for(let c of r)if(c instanceof ds&&!s.has(c)&&!e.has(c)){let h=new Set,u=l.get(c.globalIndex);if(u!=null)for(let d of u){let p=n.getConnectNode(d);p instanceof ds&&h.add(p)}if(h=this.filter(h),h.size>0){let d=W$.getCluster(h,a++);this.clusters.push(d);for(let p of h)s.add(p)}}this.ratline!=null&&this.ratline.remove()}filter(t){let e=new Array;t=this.filterCopper(t),t.forEach(i=>{e.push(i)}),e=e.filter(i=>{let n=!0;return this.exclusions.has(i)&&(n=!1),n});let r=new Set;return e.forEach(i=>{r.add(i)}),r}filterCopper(t){let e=new Set;return t.forEach(r=>{r instanceof ii||r instanceof Ki||r instanceof Ye&&r.type=="Copper Region"||e.add(r)}),e}generateRatline(){this.clear();let t=this.clusters.length;if(t>0){let e=new Array,r=this.connects,i=0,n=W$.getCluster(r,i++);if(this.item instanceof Ar||this.item instanceof Si){let s=-1,a=this.item.start;for(let l=0,c=n.junctions.itemList.length;l<c;l++){let h=n.junctions.itemList[l];h.point.x==a.x&&h.point.y==a.y&&(s=l)}s>=0&&n.junctions.itemList.splice(s,1)}for(let s=0;s<t;s++){let a=this.clusters[s],l=new Kde(n,a);e.push(l)}if(xr(e,(s,a)=>s.nearest.distance-a.nearest.distance,0,e.length),e.length>0){let s=e[0],a=s.nearest.left,l=s.nearest.right;if(this.item instanceof Ar||this.item instanceof Si){let c=ze.getSpecialColor(this.item.net);if(a.equals(this.item.start)){this.other=l.node,this.ratline=new hr(57,this.item.end,l.point,!0,c),this.ratline.click();return}else if(l.equals(this.item.start)){this.other=a.node,this.ratline=new hr(57,a.point,this.item.end,!0,c),this.ratline.click();return}}a.node==this.item?this.other=l.node:this.other=a.node,this.ratline=new hr(57,a.point,l.point,!0)}}this.ratline!=null&&this.ratline.click()}getOther(){return this.other}clear(){this.ratline!=null&&this.ratline.remove()}};var SU=class extends ci{constructor(){super();this._pads=null;this.startPoint=null;this.count=0;this.angle=0;this.fixAngle=!0;this.option="OPTIONLEFTUP",Yo.setTool(this),Ua.changeTool(this),sl.addTool(this)}set pads(e){if(this.filterItems.clear(),e!=null)for(let r of e)this.filterItems.add(r);this._pads=e}get pads(){return this._pads}get interval(){return this._interval?this._interval:new ft().conversion("mm","mil",2/10)}set interval(e){this._interval=e}onKeyDown(e){switch(sr.getAction(5,e)){case"Cancel":this.cancel();break}A.publish("updateFrame","")}checkPadRotate(e){let r=e.bbox(),i=r.width(),n=r.height();return i>n}onMouseLeftUp(e){if(dt.editingWhat){dt.editingWhat="";return}let r=new S(e.sceneX,e.sceneY);if(this.pads===null){this.start();let i=rt.getDefaultPad(r);rt.setDefaultPad(i),this.rotate90=this.checkPadRotate(i);let n=i.rotation;ne.eq(n%Math.PI,0)||(this.fixAngle=!1),i.hidden(),this.pads=[i],this.startPoint=r}else this.placeSuccess()}placeSuccess(){let e=new ve("Batch move pcb item");for(let r=0;r<this.count;r++)e.addCommand(Te.dispatch(this.pads[r],"add")),A.publish("hasModifyPcbItem",this.pads[r]);this.pads!=null&&A.publish("onlySelect",this.pads.slice(0,this.count)),je.executeCommand(e),this.end()}resetEndPoint(){let e=this.endPoint.x-this.startPoint.x,r=this.endPoint.y-this.startPoint.y;e>0&&(this.endPoint=new S(this.startPoint.x+this.count*this.interval,this.endPoint.y)),e<0&&(this.endPoint=new S(this.startPoint.x-this.count*this.interval,this.endPoint.y)),r>0&&(this.endPoint=new S(this.endPoint.x,this.startPoint.y+this.count*this.interval)),r>0&&(this.endPoint=new S(this.endPoint.x,this.startPoint.y-this.count*this.interval))}applyInputAtCursorValue(e){dt.editingWhat="";let{value:r,editing:i,type:n,index:s,keyCode:a,locked:l,unlocked:c}=e;if(i){dt.editingWhat=n;return}if(r){if(r=Math.abs(r),s===0){let h=new ft;this.interval=h.conversion(x.getInstance().unit,"mil",r/10)}else s===1&&(this.count=r,l?(this.locked=!0,this.resetEndPoint()):c&&(this.locked=!1));this.hidePads(),this.placePads(),A.publish("updateFrame",""),(a===108||a===13)&&this.placeSuccess()}}onMouseMove(e){this.drawing&&this.pads!==null&&(this.hidePads(),this.getState(e),this.placePads())}hidePads(){if(this.pads!=null)for(let e=0;e<this.pads.length;e++)this.pads[e].hidden()}getState(e){let r,i;Math.abs(e.sceneX-this.startPoint.x)>Math.abs(e.sceneY-this.startPoint.y)?(r=e.sceneX,i=this.startPoint.y):(r=this.startPoint.x,i=e.sceneY),this.locked||(this.endPoint=new S(r,i));let n=this.endPoint.x-this.startPoint.x,s=this.endPoint.y-this.startPoint.y;if(n>0?this.angle=0:n<0?this.angle=Math.PI:s>0?this.angle=Math.PI/2:s<0&&(this.angle=Math.PI*3/2),this.rotate90&&(this.angle=this.angle+Math.PI/2),!this.locked){let a=Math.max(Math.abs(this.endPoint.x-this.startPoint.x),Math.abs(this.endPoint.y-this.startPoint.y));this.count=Math.ceil(a/this.interval)}}placePads(){let e=this.pads.length;if(e<this.count)for(let a=0;a<this.count-e;a++){let l=rt.getDefaultPad(new S(0,0));l.hidden(),this.pads.push(l)}let r=this.startPoint.x,i=this.startPoint.y,n=this.endPoint,s=this.angle;for(let a=0;a<this.count;a++){n.x!==this.startPoint.x&&(r=this.interval*a+this.startPoint.x,n.x<this.startPoint.x&&(r=-this.interval*a+this.startPoint.x)),n.y!==this.startPoint.y&&(i=this.interval*a+this.startPoint.y,n.y<this.startPoint.y&&(i=-this.interval*a+this.startPoint.y));let l=this.pads[a];l.center=new S(r,i),this.fixAngle&&(l.rotation=s),l.visible()}if(this.count>1){dt.startPoint=new S(this.startPoint.x,this.startPoint.y);let a={data:[{startPoint:dt.startPoint,cursorPoint:new S(this.pads[1].center.x,this.pads[1].center.y),frameStartPoint:Fo(dt.startPoint),frameCursorPoint:Fo(new S(this.pads[1].center.x,this.pads[1].center.y)),info:{type:"distance",isLocked:!0,value:Xe(this.interval),unit:x.getInstance().unit}},{startPoint:dt.startPoint,cursorPoint:new S(this.pads[this.count-1].center.x,this.pads[this.count-1].center.y),frameStartPoint:Fo(dt.startPoint),frameCursorPoint:Fo(new S(this.pads[this.count-1].center.x,this.pads[this.count-1].center.y)),info:{type:"distance",tagName:"amount",value:this.count,polylineLength:270,middleLineHeight:135,onlyInteger:!0,onlyPositive:!0}}],type:"linePad",show:!0,frameInfo:Gf()};rt.setDefaultPad(this.pads[0]),dt.create(a),this.canSetInterval=!0}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:kw(rt.defalutPad.layerId,e.adsorb,this).result};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"REPLACE_LAYER":let n=parseInt(i[1].split("switchToLayer(")[1]);this.toggleLayer(n);break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}toggleLayer(e){if(e!=rt.defalutPad.layerId&&(e==1||e==2||e==12))if(this.pads!=null){for(let r=0;r<this.pads.length;r++)this.pads[r].layerId=e;rt.setDefaultPad(this.pads[0])}else rt.togglePadLayerId(e)}interrupt(){if(this.pads!==null){for(let e=0;e<this.pads.length;e++)A.publish("hasModifyPcbItem",this.pads[e]),this.pads[e].remove(),A.publish("delete",this.pads[e]);this.end()}}cancel(){let e=!!this.pads;this.interrupt(),e||(A.publish("tool","dropdrag"),Ve.keepSelection=!0)}end(){if(this.pads!=null)for(let e=this.count;e<this.pads.length;e++)A.publish("delete",this.pads[e]),this.pads[e].remove(),A.publish("hasModifyPcbItem",this.pads[e]);this.pads=null,this.locked=!1,this.canSetInterval=!1,dt.destroy(),A.publish("flushService",""),super.end()}};var EU=class extends ci{constructor(){super();this._pads=null;this.startPoint=null;this.endPoint=null;this.count=0;this.widthNum=0;this.heightNum=0;this.fixAngle=!0;this.widthFactor=1;this.heightFactor=1;this._widthInterval=0;this._heightInterval=0;this.option="OPTIONLEFTUP",Yo.setTool(this),Ua.changeTool(this),sl.addTool(this)}set pads(e){if(this.filterItems.clear(),e!=null)for(let r of e)this.filterItems.add(r);this._pads=e}get pads(){return this._pads}get widthInterval(){return this._widthInterval?this._widthInterval:new ft().conversion("mm","mil",2/10)}set widthInterval(e){this._widthInterval=e}set heightInterval(e){this._heightInterval=e}get heightInterval(){return this._heightInterval?this._heightInterval:new ft().conversion("mm","mil",2/10)}onKeyDown(e){switch(sr.getAction(5,e)){case"Cancel":this.cancel();break}A.publish("updateFrame","")}checkPadRotate(e){let r=e.bbox(),i=r.width(),n=r.height();return i>n}onMouseLeftUp(e){if(dt.editingWhat){dt.editingWhat="";return}let r=new S(e.sceneX,e.sceneY);if(this.pads===null){this.start();let i=rt.getDefaultPad(r);i.hidden(),rt.setDefaultPad(i),this.rotate90=this.checkPadRotate(i);let n=i.rotation;ne.eq(n%Math.PI,0)||(this.fixAngle=!1),this.pads=[i],this.startPoint=r}else this.placeSuccess()}placeSuccess(){let e=new ve("Batch move pcb item");for(let r=0;r<this.count;r++)this.pads[r].partition=x.getInstance().partitionId,e.addCommand(Te.dispatch(this.pads[r],"add")),A.publish("hasModifyPcbItem",this.pads[r]);A.publish("onlySelect",this.pads),je.executeCommand(e),this.end()}applyInputAtCursorValue(e){dt.editingWhat="";let{value:r,editing:i,type:n,index:s,keyCode:a,locked:l,unlocked:c}=e;if(i){dt.editingWhat=n;return}if(l?s===1?this.widthLocked=!0:s===3&&(this.heightLocked=!0):c&&(s===1?this.widthLocked=!1:s===3&&(this.heightLocked=!1)),r){let u=new ft().conversion(x.getInstance().unit,"mil",r/10);s===0?this.widthInterval=u:s===1?this.widthNum=r+1:s===2?this.heightInterval=u:s===3&&(this.heightNum=r+1),this.hidePads(),this.updateEndPoint(),this.placePads(),A.publish("updateFrame",""),(a===108||a===13)&&this.placeSuccess()}}onMouseMove(e){this.drawing&&this.pads!==null&&(this.hidePads(),this.getState(e),this.placePads())}hidePads(){if(this.pads!=null)for(let e=0;e<this.pads.length;e++){let r=this.pads[e];this.fixAngle&&(r.rotation=0),r.hidden()}}getState(e){this.widthLocked||(this.widthNum=Math.ceil(Math.abs((e.sceneX-this.startPoint.x)/this.widthInterval))),this.heightLocked||(this.heightNum=Math.ceil(Math.abs((e.sceneY-this.startPoint.y)/this.heightInterval))),e.sceneX<this.startPoint.x?this.widthFactor=-1:this.widthFactor=1,e.sceneY<this.startPoint.y?this.heightFactor=-1:this.heightFactor=1,this.endPoint=new S(this.startPoint.x+this.widthNum*this.widthInterval*this.widthFactor,this.startPoint.y+this.heightNum*this.heightInterval*this.heightFactor)}updateEndPoint(){this.endPoint=new S(this.startPoint.x+this.widthNum*this.widthInterval*this.widthFactor,this.startPoint.y+this.heightNum*this.heightInterval*this.heightFactor)}placePads(){this.addPads(),rt.setDefaultPad(this.pads[0]),this.addFloatingInputBox()}addPads(){let e=new S(Math.min(this.endPoint.x,this.startPoint.x),Math.min(this.endPoint.y,this.startPoint.y)),r=new S(Math.max(this.endPoint.x,this.startPoint.x),Math.max(this.endPoint.y,this.startPoint.y)),i=this.pads.length,n=(this.widthNum+this.heightNum)*2-4;if(this.widthNum<1?n=this.heightNum:this.heightNum<1&&(n=this.widthNum),i<n)for(let s=0;s<n-i;s++){let a=rt.getDefaultPad(new S(0,0));a.hidden(),this.pads.push(a)}this.count=0,this.widthNum>1&&this.heightNum>1?this.case1(e,r):this.widthNum>0&&this.heightNum==1?this.case2(e,r):this.widthNum==1&&this.heightNum>0?this.case3(e,r):this.widthNum>0&&this.heightNum==0?this.case4(e,r):this.widthNum==0&&this.heightNum>0&&this.case5(e,r)}case1(e,r){for(let i=1;i<this.widthNum;i++){let n=this.widthInterval*i+e.x,s=e.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=this.rotate90?Math.PI/2:0),a.visible()}for(let i=1;i<this.heightNum;i++){let n=r.x,s=this.heightInterval*i+e.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=Math.PI/2+(this.rotate90?Math.PI/2:0)),a.visible()}for(let i=1;i<this.widthNum;i++){let n=r.x-this.widthInterval*i,s=r.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=this.rotate90?Math.PI/2:0),a.visible()}for(let i=1;i<this.heightNum;i++){let n=e.x,s=r.y-this.heightInterval*i,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=Math.PI/2+(this.rotate90?Math.PI/2:0)),a.visible()}}case2(e,r){for(let i=1;i<this.widthNum;i++){let n=this.widthInterval*i+e.x,s=e.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=this.rotate90?Math.PI/2:0),a.visible()}for(let i=1;i<this.widthNum;i++){let n=r.x-this.widthInterval*i,s=r.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=this.rotate90?Math.PI/2:0),a.visible()}}case3(e,r){for(let i=1;i<this.heightNum;i++){let n=e.x,s=r.y-this.heightInterval*i,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=Math.PI/2+(this.rotate90?Math.PI/2:0)),a.visible()}for(let i=1;i<this.heightNum;i++){let n=r.x,s=this.heightInterval*i+e.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=Math.PI/2+(this.rotate90?Math.PI/2:0)),a.visible()}}case4(e,r){for(let i=1;i<this.widthNum;i++){let n=this.widthInterval*i+e.x,s=e.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=this.rotate90?Math.PI/2:0),a.visible()}}case5(e,r){for(let i=1;i<this.heightNum;i++){let n=e.x,s=r.y-this.heightInterval*i,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=Math.PI/2+(this.rotate90?Math.PI/2:0)),a.visible()}}addVerticalFloatingInputBox(e){let r=new S(this.pads[0].center.x,this.pads[0].center.y),i=r,n=r;if(this.heightNum>0){let s=this.pads[this.count-this.heightNum+1];this.widthNum<=1&&(s=this.pads[0]);let a=this.pads[this.count-1];this.heightNum==1&&(this.count-1>=0&&(s=this.pads[this.count-1]),a=this.pads[0]),r=new S(s.center.x,s.center.y),i=new S(s.center.x,s.center.y-this.heightInterval),n=i,a&&this.widthNum>3&&(n=new S(a.center.x,a.center.y))}e.data.push({startPoint:r,cursorPoint:i,frameStartPoint:Fo(r),frameCursorPoint:Fo(i),info:{type:"vertical",value:Xe(this.heightInterval),isLocked:!0,unit:x.getInstance().unit,direction:"left"}},{startPoint:r,cursorPoint:n,frameStartPoint:Fo(r),frameCursorPoint:Fo(n),info:{type:"vertical",isLocked:!1,tagName:"amount",value:this.heightNum-1,polylineLength:270,middleLineHeight:135,onlyInteger:!0,onlyPositive:!0,direction:"left"}})}addHorizontalFloatingInputBox(e){let r=new S(this.pads[0].center.x,this.pads[0].center.y),i=r,n=r;if(this.widthNum>0){let s=this.pads[this.widthNum*2+this.heightNum-4];this.heightNum<1&&(s=this.pads[0]),this.widthNum==1&&(s=this.pads[0]);let a=this.pads[this.count-this.heightNum-this.widthNum+2];r=new S(s.center.x,s.center.y),i=new S(s.center.x+this.widthInterval,s.center.y),n=i,a&&(n=new S(a.center.x,a.center.y))}e.data.push({startPoint:r,cursorPoint:i,frameStartPoint:Fo(r),frameCursorPoint:Fo(i),info:{type:"horizontal",value:Xe(this.widthInterval),isLocked:!0,unit:x.getInstance().unit}},{startPoint:r,cursorPoint:n,frameStartPoint:Fo(r),frameCursorPoint:Fo(n),info:{type:"horizontal",isLocked:!1,tagName:"amount",value:this.widthNum-1,polylineLength:100,middleLineHeight:50,onlyInteger:!0,onlyPositive:!0}})}addFloatingInputBox(){let e={type:"rectPad",show:!0,frameInfo:Gf(),data:[]};dt.startPoint=new S(this.startPoint.x,this.startPoint.y),this.addHorizontalFloatingInputBox(e),this.addVerticalFloatingInputBox(e),dt.create(e),(this.heightNum<1||this.widthNum<1)&&(e.data=[{hide:!1},{hide:!1},{hide:!1},{hide:!1}],this.widthNum<1&&(e.data[0].hide=!0,e.data[1].hide=!0),this.heightNum<1&&(e.data[2].hide=!0,e.data[3].hide=!0),dt.create(e))}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:kw(rt.defalutPad.layerId,e.adsorb,this).result};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"REPLACE_LAYER":let n=parseInt(i[1].split("switchToLayer(")[1]);this.toggleLayer(n);break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}toggleLayer(e){if(e!=rt.defalutPad.layerId&&(e==1||e==2||e==12))if(this.pads!=null){for(let r=0;r<this.pads.length;r++)this.pads[r].layerId=e;rt.setDefaultPad(this.pads[0])}else rt.togglePadLayerId(e)}turn(e){}interrupt(){if(this.pads!==null){for(let e=0;e<this.pads.length;e++)A.publish("hasModifyPcbItem",this.pads[e]),this.pads[e].remove(),A.publish("delete",this.pads[e]);this.resetStatus()}this.end()}cancel(){let e=!!this.pads;this.interrupt(),e||(A.publish("tool","dropdrag"),Ve.keepSelection=!0)}resetStatus(){this.pads=null,this.widthLocked=!1,this.heightLocked=!1,dt.destroy(),A.publish("flushService","")}end(){if(this.pads!==null)for(let e=this.count;e<this.pads.length;e++)A.publish("delete",this.pads[e]),this.pads[e].remove(),A.publish("hasModifyPcbItem",this.pads[e]);this.resetStatus(),super.end()}};function kw(o,t,e,r=!1){let i=new Jt;i.add("CANCEL",!0),!r&&!(e instanceof SU)&&!(e instanceof EU)&&i.add("PAD_NUMBER");let n=new Array;return n.push(be.getTopLayer()),n.push(be.getBottomLayer()),n.push(be.getMultLayer()),i.addExtend("REPLACE_LAYER",Vie(n,o),!0),i.add("toggleAdsorb",!1,t),i.add("ADSORBENT_CONFIG"),i}var rO=class extends ci{constructor(e=!1){super();this._pad=null;this.nearNode=null;this.isDrawTestPad=!1;this.option="OPTIONLEFTUP",Yo.setTool(this),this.isDrawTestPad=e,Ua.changeTool(this),this.start()}set pad(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._pad=e}get pad(){return this._pad}onKeyDown(e){switch(sr.getAction(5,e)){case"Cancel":this.cancel();break;case"Show Attribute Dialog When Placing Object":this.pad&&!this.pad.isTestPad&&this.openDialog();break;case"Rotate Left":this.pad!=null&&(this.pad.rotateFor(this.pad.center,ce.pcbConfig.rotate),rt.defalutPad.rotation+=ce.pcbConfig.rotate);break;case"rotate_right":this.pad!=null&&(this.pad.rotateFor(this.pad.center,-ce.pcbConfig.rotate),rt.defalutPad.rotation-=ce.pcbConfig.rotate);break;case"Flip Right and Left":A.publish("turn","turnAround");break;case"Flip Up and Down":A.publish("turn","turnUpsideDown");break}A.publish("updateFrame","")}openDialog(){this.pad!=null&&A.publish("openMainDialog",{cmd:19,data:{tool:this}})}getDialogData(){return{action:"attribute-for-place-pad",unit:x.getInstance().unit,number:this.pad.num}}modifyByDialog(e){if(e.action=="confirm"){let i=e.number,n=r0.getNumberManager();n!=null&&n.deleteNum(this.pad.num),n.add(i),this.pad.num=i,this.pad.isTestPad?rt.setDefaultTestPad(this.pad):rt.setDefaultPad(this.pad)}}applyValue(e){let{value:r,cursorPoint:i,startPoint:n}=e;r=new ft().conversion(x.getInstance().unit,"mil",r/10);let a=new S(i.x-n.x,i.y-n.y).normalize();a=new S(a.x*r,a.y*r);let l=new S(a.x+n.x,a.y+n.y);this.placePad(l),dt.destroy(),Pi.getInstance().clearCrossFlag()}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l,startPoint:c}=e;if(a){dt.editingWhat=i;return}this.applyValue(e)}onMouseLeftUp(e){if(!dt.editingWhat){if(this.isDrawTestPad){let r=new S(e.sceneX,e.sceneY);this.placePad(r)}else if(this.pad!==null){let r=new S(e.sceneX,e.sceneY);this.pad.center=r;let i=this.getNearNetPcbItems(e);this.handleNets(e,i)}}}getNearNetPcbItems(e){let r=new ib([this.pad]);r.updateScene();let{netsGroupSet:i}=r.getNetPcbItems(e);return i}handleNets(e,r){let i=[];r.forEach(n=>{i.push(...Array.from(n.nets))}),i.length?i.length===1?(i.forEach(n=>{this.pad.net=n,rt.defalutPad.net=n}),this.placePad(this.pad.center)):this.showNetsMenu(e,i):this.placePad(this.pad.center)}placePad(e){if(this.pad!==null){if(!Bt.checkIsInCanEdit(this.pad)){let s="beyond drawing range";Bt.showMassageTip(s,s);return}this.pad.partition=x.getInstance().partitionId;let r=e.sub(this.pad.center),i=Ae.translate(r.x,r.y,0);this.pad.transform(i),epe.update([this.pad]),A.publish("onlySelect",[this.pad]);let n=new ve("draw pad");n.addCommand(Te.dispatch(this.pad,"add")),je.executeCommand(n),this.nearNode.clear(),rt.placingPad=null,A.publish("hasModifyPcbItem",this.pad),A.publish("flushService",""),this.pad=this.isDrawTestPad?rt.getDefaultTestPad(e):rt.getDefaultPad(e,this.pad.num),rt.placingPad=this.pad,this.nearNode=new ly(this.pad),this.drawing=!0}}flushNear(){this.pad!=null&&this.pad.net!=this.nearNode.net&&(this.nearNode.clear(),this.nearNode=new ly(this.pad),this.nearNode.generateRatline())}onMouseMove(e,r){if(this.drawing){let i=new S(e.sceneX,e.sceneY);if(this.pad!==null){let n=i.sub(this.pad.center),s=Ae.translate(n.x,n.y,0);this.pad.transform(s),this.nearNode.generateRatline()}else this.pad=this.isDrawTestPad?rt.getDefaultTestPad(i):rt.getDefaultPad(i),r&&r(),this.isDrawTestPad?rt.setDefaultTestPad(this.pad):rt.setDefaultPad(this.pad),this.nearNode=new ly(this.pad)}}rightClickMenuData(e){let r=this.pad.isTestPad?rt.defalutTestPad.layerId:rt.defalutPad.layerId,i={state:"show",left:e.mouseX,top:e.mouseY,filter:kw(r,e.adsorb,this,this.pad.isTestPad).result};Qt.getInstance().menuData(i,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"PAD_NUMBER":this.openDialog();break;case"REPLACE_LAYER":let n=parseInt(i[1].split("switchToLayer(")[1]);this.toggleLayer(n);break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"FLIP":i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"&&this.turn("turnUpsideDown");break;case"INHERIT_NET":let s=i[1];this.pad.net=s,rt.defalutPad.net=s,this.placePad(this.pad.center);break}A.publish("updateFrame","")}showNetsMenu(e,r){let i=new Jt,n="INHERIT_NET:";for(let a of r){let l={name:a,cmd:n+a,tips:"",option:{disabledI18n:!0}};i.addObj(l,!1,!1)}let s={state:"show",left:e.mouseX,top:e.mouseY,filter:i.result};Qt.getInstance().menuData(s,this),this.drawing=!1}turn(e){if(!(!x.getInstance().isactive||23==x.getInstance().doctype))switch(e){case"turnAround":Yo.turn([this.pad],!1,!1);break;case"turnUpsideDown":Yo.turn([this.pad],!0,!1);break}}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}restore(){dt.destroy(),A.publish("hasModifyPcbItem",this.pad),this.pad.remove(),rt.placingPad=null,this.nearNode.clear(),A.publish("delete",this.pad),this.pad=null,this.drawing=!0,A.publish("flushService","")}interrupt(){this.pad!==null&&(dt.destroy(),A.publish("hasModifyPcbItem",this.pad),this.pad.remove(),rt.placingPad=null,this.nearNode.clear(),A.publish("delete",this.pad),this.pad=null,this.drawing=!1,A.publish("flushService","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}toggleLayer(e,r){if(!(e!=12&&e!=1&&e!=2)){if(this.pad.isTestPad){this.pad.layerId=e,rt.setDefaultTestPad(this.pad);return}e!=rt.defalutPad.layerId&&(this.pad.layerId=e,rt.setDefaultPad(this.pad))}}getPad(){return this.pad}};function hqe(o){let t=new Jt;if(t.add("VIA_TYPE_THROUGH_VIA"),x.getInstance().doctype!==bi.FOOTPRINT){let r=te.getInstance().getDefaultBlindPhysics().getAllVias();r!=null&&r.forEach(i=>{let n={name:i.name,cmd:i.name,tips:"",offTranslation:!0},s=!1;o!=null&&o.name==i.name&&(s=!0),t.addObj(n,!1,s)})}return t.addSeparate(),t.add("VIA_TYPE_RULESSETTING"),t}function tpe(o,t){let e=new Jt,r=x.getInstance().doctype!==bi.FOOTPRINT;return e.add("CANCEL",!0),e.addExtend("VIA_SIZE",Fie(o.holeRadius,o.radius),!r),r&&e.addExtend("VIA_TYPE",hqe(o),!0),e.add("toggleAdsorb",!1,t),e.add("ADSORBENT_CONFIG"),e}var cy=class extends ci{constructor(){super();this.commands=new ve("draw via");this._radius=te.getInstance().getDefaultRadiusPhysics().defalutRadius;this._innerRadius=te.getInstance().getDefaultRadiusPhysics().defalutInner;this.type=0;this.name="";this._via=null;this.nearNode=null;this.followRule=ce.pcbConfig.startViaSize=="rule";this.option="OPTIONLEFTUP",Ua.changeTool(this),Wh.setTool(this)}set via(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._via=e}get via(){return this._via}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,startPoint:l,keyCode:c}=e;if(a){dt.editingWhat=i;return}this.applyValue(e),c===13&&dt.destroy()}applyValue(e){let{value:r,startPoint:i,cursorPoint:n}=e,s=new ft,a=new S(n.x-i.x,n.y-i.y).normalize();r=s.conversion(x.getInstance().unit,"mil",r/10),a=new S(a.x*r,a.y*r);let l=new S(a.x+i.x,a.y+i.y);this.via.center=l,this.placeVia(l)}onKeyDown(e){switch(sr.getAction(5,e)){case"Cancel":this.cancel();break;case"Switch Common Via Size While Routing/Placing Via":this.showCommonViaSizeMenu(e);break;case"Show Attribute Dialog When Placing Object":this.via!=null&&A.publish("openMainDialog",{cmd:28,data:{tool:this,item:this.via}});break}A.publish("updateFrame","")}onMouseLeftUp(e){if(!dt.editingWhat&&this.via!==null){let r=new S(e.sceneX,e.sceneY);this.via.center=r,this.netsGroupSet=this.getNearNetPcbItems(e),this.handleNets(e)}}showNetsMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=this.getNetsMenuData().result,Qt.getInstance().menuData(r,this),this.drawing=!1}getNetsMenuData(){let e=new Jt,r="INHERIT_NET:";return this.nets.forEach(i=>{if(i){let n={name:i,cmd:`${r+i}`,tips:"",option:{disabledI18n:!0}};e.addObj(n,!1,!1)}}),e}getNearNetPcbItems(e){let r=new ib([this.via]);r.updateScene();let{netsGroupSet:i}=r.getNetPcbItems(e);return i}handleNets(e){this.nets=new Set,this.netsGroupSet.forEach(r=>{this.nets=r.nets}),this.nets.size?this.nets.size===1?(this.nets.forEach(r=>{this.via.net=r,rt.setDefaultVia({net:r,holeRadius:null,radius:null})}),this.placeVia(this.via.center)):this.showNetsMenu(e):this.placeVia(this.via.center)}placeVia(e){if(!Bt.checkIsInCanEdit(this.via)){let n="beyond drawing range";Bt.showMassageTip(n,n);return}let r=Hr.addViaByModel(this.via.model.clone(),!0);r.partition=x.getInstance().partitionId,this.nearNode.clear(),A.publish("onlySelect",[r]),A.publish("hasModifyPcbItem",r);let i=Te.dispatch(r,"add");this.commands.addCommand(i),je.executeCommand(this.commands),A.publish("flushService",""),this.commands=new ve("draw via"),this.drawing=!0,this.type=this.via.type,this.name=this.via.name,this.nearNode=new ly(this.via)}getViaRadius(){return this.via?{radius:this.via.radius,innerRadius:this.via.holeRadius}:{radius:this.radius,innerRadius:this.innerRadius}}updateViaRadius(){if(ce.pcbConfig.startViaSize=="rule"){let e;rt.defaultVia.net!=""&&ze.getSameNetItems(rt.defaultVia.net).length>0?e=te.getInstance().getRadiusPhysicsByNet(rt.defaultVia.net):e=te.getInstance().getDefaultRadiusPhysics(),this.modifyViaSize(e.defalutInner,e.defalutRadius,void 0,!0)}}onMouseMove(e){let r=new S(e.sceneX,e.sceneY);this.drawing&&(this.via!==null?(this.via.center=r,this.nearNode.generateRatline()):(this.start(),this.via=rt.getDefaultBaseVia(r,this.radius,this.innerRadius),this.via.type=this.type,this.via.name=this.name,this.nearNode=new ly(this.via)))}restore(){dt.destroy(),this.via.remove(),this.nearNode.clear(),A.publish("delete",this.via),this.drawing=!0,this.via=null,A.publish("updateRtree",""),A.publish("flushSelectingInfo","")}interrupt(){this.via!==null&&(dt.destroy(),this.via.remove(),this.nearNode.clear(),A.publish("delete",this.via),this.drawing=!1,this.via=null,A.publish("updateRtree",""),A.publish("flushSelectingInfo","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}flushNear(){this.via!=null&&this.via.net!=this.nearNode.net&&(this.nearNode.clear(),this.nearNode=new ly(this.via),this.nearNode.generateRatline())}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:tpe(this.via,e.adsorb).result};Qt.getInstance().menuData(r,this),this.drawing=!1}changeType(e){switch(e){case"VIA_TYPE_RULESSETTING":{let r={activeTab:"Rule",activeMenu:"Blind/Buried Via"};A.publish("openMainDialog",{cmd:5,data:{option:r,tool:this}});break}case"VIA_TYPE_THROUGH_VIA":{this.via!=null&&(this.via.type=0,this.via.name="");break}default:{this.via!=null&&(this.via.type=1,this.via.name=e);break}}GM(this.via)}modifyViaSize(e,r,i,n=!1){let s;if(this.via.name!==""){let l=te.getInstance().getDefaultBlindPhysics().getBlindVia(this.via.name);l.viaSizeRule!==""?s=te.getInstance().getRadiusPhysicsByName(l.viaSizeRule):s=te.getInstance().getRadiusPhysicsByNet(this.via.net)}else s=te.getInstance().getRadiusPhysicsByNet(this.via.net);if(!(x.getInstance().doctype===bi.FOOTPRINT)&&(Uf.inValidRadius(s,r)||Uf.inValidInnerRadius(s,e))){A.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},$());return}i!=null&&(this.followRule=i),r!=null&&(this.via.radius=r,this._radius=r),e!=null&&(this.via.holeRadius=e,this._innerRadius=e),this.type=this.via.type,this.name=this.via.name,rt.setDefaultVia(this.via),n&&Hi()}parse(e){this.drawing=!0;let i=e.cmdKey.split(":"),n=new ft;switch(i[0]){case"CANCEL":this.cancel();break;case"VIA_TYPE":this.changeType(i[1]);break;case"VIA_SIZE":if(i[1]==="VIA_SIZE_INPUT")A.publish("openMainDialog",{cmd:28,data:{tool:this,item:this.via}});else if(i[1]=="VIA_SIZE_COMMONLY_SETTING")A.publish("openSystemDialog","PCB_COMM_VIA_SIZE",$());else if(i[1]=="VIA_SIZE_RULESSETTING"){let a={activeTab:"Rule",activeMenu:"Via Size"};A.publish("openMainDialog",{cmd:5,data:{option:a,tool:this}})}else if(i[1]=="VIA_SIZE_FOLLOWRULES"){let a=ce.pcbConfig.startViaSize=="rule"?"last":"rule";ce.pcbConfig.startViaSize=a,we.sizeFollowRule=ce.pcbConfig.startViaSize=="rule",this.followRule=ce.pcbConfig.startViaSize=="rule",ce.pcbConfig.startViaSize=="rule"&&this.modifyViaSize(this.innerRadius,this.radius,void 0,!0)}else{this.followRule=!1;let a=ce.viaConfig[i[1]].getSizeAccordingToUnit();this.modifyViaSize(a.innerRadius,a.radius,void 0,!0)}break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"INHERIT_NET":let s=i[1];this.via.net=s,rt.setDefaultVia({net:s,holeRadius:null,radius:null}),this.placeVia(this.via.center),this.drawing=!0;break;case"VIA_SIZE_COMMONLY_SETTING":A.publish("openSystemDialog","PCB_COMM_VIA_SIZE",$());break}A.publish("updateFrame","")}getBlinds(){return this.via!=null&&te.getInstance().getDefaultBlindPhysics().getAllVias(),null}getBlindViaOptions(){let e=this.getBlinds(),r=new Array,i={name:"Through Via",cmd:"VIA_TYPE_THROUGH_VIA",tips:""};return r.push(i),e!=null&&e.forEach(n=>{let s={name:n.name,cmd:n.name,tips:""};this.via!=null&&this.via.name==n.name&&(s.selectedTag=!0),r.push(s)}),r}get radius(){let e=rt.defaultVia.net;(e==""||ze.getSameNetItems(e).length==0)&&(e="");let r=te.getInstance().getRadiusPhysicsByNet(e),i=r.defalutRadius,n=r.minRadius,s=r.maxRadius;return this.followRule||rt.defaultVia.radius==null?this._radius=i:rt.defaultVia.radius<n?this._radius=n:rt.defaultVia.radius>s?this._radius=s:this._radius=rt.defaultVia.radius,this._radius}set radius(e){let r=rt.defaultVia.net;(r==""||ze.getSameNetItems(r).length==0)&&(r="");let i=te.getInstance().getRadiusPhysicsByNet(r);if(e<i.minRadius||e>i.maxRadius){alert("The modified value is not within the DRC requirements");return}this._radius=e}get innerRadius(){let e=rt.defaultVia.net;(e==""||ze.getSameNetItems(e).length==0)&&(e="");let r=te.getInstance().getRadiusPhysicsByNet(e),i=r.defalutInner,n=r.minInner,s=r.maxInner;return this.followRule||rt.defaultVia.radius==null?this._innerRadius=i:rt.defaultVia.innerRadius<n?this._innerRadius=n:rt.defaultVia.innerRadius>s?this._innerRadius=s:this._innerRadius=rt.defaultVia.innerRadius,this._innerRadius}set innerRadius(e){this._innerRadius=e}showCommonViaSizeMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=rF(this.innerRadius,this.radius).result,Qt.getInstance().menuData(r,this),this.drawing=!1}};function uqe(o,t){let e=new Jt;return e.add("CANCEL"),e.add("toggleAdsorb",!1,o),e.add("ADSORBENT_CONFIG"),e.result}function dqe(o){return o<0&&(o=Vr+o),o}var YC=class extends ci{constructor(){super();this.state=0;this.defaultLineWidth=al.getInstance().getTrackWidth().value||1;this._pcbArc=null;this._polygon=null;this.option="OPTIONLEFTUP",jr.addDrawTool(this)}set pcbArc(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._pcbArc=e}get pcbArc(){return this._pcbArc}get polygon(){return this._polygon}getWidth(){return this.defaultLineWidth}set polygon(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._polygon=e}onKeyDown(e){let r=sr.getLocalAction(["decrease_routing_width","increase_routing_width"],e);switch(r||(r=sr.getAction([4],e)),r){case"Cancel":this.cancel();break;case"Switch Common Track Width":this.showCommonTrackWidthMenu(e);break;case"decrease_routing_width":{let n=this.defaultLineWidth-.2;n>=.1&&(this.setWireWidth(n),Hi())}break;case"increase_routing_width":{let n=this.defaultLineWidth+.2;this.setWireWidth(n),Hi()}break;case"Change Track Width While Routing":{A.publish("openMainDialog",{cmd:26,data:{tool:this}});break}case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseLeftUp(e){if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},$());return}let r=new S(e.sceneX,e.sceneY);if(this.state==0){if(!Bt.checkIsCanEditByPoint(r))return;this.start(),this.pcbArc=qc.addArc(be.getActiveLayerID(),r,.1,this.defaultLineWidth,0,Vr,le.CCW,!1,2),this.polygon=pt.addPolygon("Line",be.getActiveLayerID(),[[this.pcbArc]],this.defaultLineWidth,"",!1),this.state=1,this.drawing=!0}else if(this.pcbArc!==null)switch(this.pcbArc.partition=x.getInstance().partitionId,this.polygon.partition=x.getInstance().partitionId,this.state){case 1:if(!Bt.checkIsCanEditByPoint(r))return;let i=r.sub(this.pcbArc.center),n=dqe(Math.atan2(i.y,i.x));this.pcbArc.startAngle=n,this.pcbArc.endAngle=n,this.state=2;break;case 2:if(!Bt.checkIsInCanEdit(this.polygon)){let a="beyond drawing range";Bt.showMassageTip(a,a);return}r.distance1(this.pcbArc.start)<.1&&(this.pcbArc.sweep===le.CCW?this.pcbArc.endAngle=this.pcbArc.startAngle-1e-4:this.pcbArc.endAngle=this.pcbArc.startAngle+1e-4);let s=new mi;s.createGroup("draw center arc"),s.addCommand4Item(this.polygon,"add"),s.checkOutlines([this.polygon],new Set),nb(this.polygon),A.publish("onlySelect",[this.pcbArc]),A.publish("flushService",""),this.pcbArc=null,this.polygon=null,this.state=0,this.drawing=!0,this.end();break}}onMouseMove(e){if(this.state!==0&&this.pcbArc!==null&&this.drawing){let i=new S(e.sceneX,e.sceneY).sub(this.pcbArc.center);switch(this.state){case 1:{this.pcbArc.radius=Math.max(i.length(),.1);break}case 2:{let n=dqe(Math.atan2(i.y,i.x));this.pcbArc.endAngle=n;break}}}}restore(){this.state=0,this.pcbArc.remove(),this.polygon.remove(),A.publish("delete",this.pcbArc),A.publish("delete",this.polygon),this.pcbArc=null,this.drawing=!0,this.polygon=null,A.publish("updateRtree","")}interrupt(){this.pcbArc!==null&&(this.state=0,this.pcbArc.remove(),this.polygon.remove(),A.publish("delete",this.pcbArc),A.publish("delete",this.polygon),this.pcbArc=null,this.polygon=null,A.publish("updateRtree","")),this.state=0,jr.clearDrawTool(),this.end()}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:uqe(e.adsorb,this.defaultLineWidth)};Qt.getInstance().menuData(r,this),this.drawing=!1}toggleLayer(e){this._pcbArc!=null&&this._pcbArc.layerId!=e&&(this._pcbArc.layerId=e)}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=lg(this.defaultLineWidth).result,Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){let r=e.cmdKey;this.drawing=!0;let i=r.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",$());break}A.publish("updateFrame","")}toggleWidth(e){let r=ce.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit()),Hi()}setWireWidth(e){this.polygon!=null&&(this.polygon.strokeWidth=e),we.prevTrackWidth=e,this.defaultLineWidth=e,A.publish("flushSelectingInfo","")}cancel(){let e=this.pcbArc!=null;this.interrupt(),e||A.publish("tool","dropdrag")}wireCorner(e){}wireMode(e){}};var jC=class extends ci{constructor(){super();this.defaultLineWidth=al.getInstance().getTrackWidth().value||1;this._start=null;this._pcbArc=null;this._polygon=null;this.option="OPTIONLEFTUP",jr.addDrawTool(this)}set pcbArc(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._pcbArc=e}get pcbArc(){return this._pcbArc}getWidth(){return this.defaultLineWidth}get polygon(){return this._polygon}set polygon(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._polygon=e}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Switch Common Track Width":this.showCommonTrackWidthMenu(e);break;case"Change Track Width While Routing":{A.publish("openMainDialog",{cmd:26,data:{tool:this}});break}case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseLeftUp(e){if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},$());return}let r=new S(e.sceneX,e.sceneY);if(this.pcbArc==null){if(!Bt.checkIsCanEditByPoint(r))return;this.start(),this._start=r,this.pcbArc=qc.addArc(be.getActiveLayerID(),r,.1,this.defaultLineWidth,0,Math.PI,le.CCW,!1),this.polygon=pt.addPolygon("Line",be.getActiveLayerID(),[[this.pcbArc]],this.defaultLineWidth,"",!1),this.polygon.partition=x.getInstance().partitionId,this.drawing=!0}else{if(!Bt.checkIsInCanEdit(this.polygon)){let n="beyond drawing range";Bt.showMassageTip(n,n);return}let i=new mi;i.createGroup("draw Semicircle arc"),i.addCommand4Item(this.polygon,"add"),i.checkOutlines([this.polygon],new Set),nb(this.polygon),A.publish("onlySelect",[this.polygon]),A.publish("flushService",""),this.pcbArc=null,this._start=null,this.drawing=!0,this.end()}}onMouseMove(e){if(this.pcbArc!==null&&this.drawing){let i=new S(e.sceneX,e.sceneY).sub(this._start),n=i.length()/2,s=this._start.add(i.mul(.5)),a=Math.atan2(-i.y,-i.x),l=Math.atan2(i.y,i.x);this.pcbArc.center=s,this.pcbArc.radius=n,this.pcbArc.startAngle=a,this.pcbArc.endAngle=l}}interrupt(){this.pcbArc!==null&&(this.pcbArc.remove(),this.polygon.remove(),A.publish("delete",this.pcbArc),A.publish("delete",this.polygon),this._start=null,this.pcbArc=null,this.polygon=null,A.publish("updateRtree","")),jr.clearDrawTool(),this.end()}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.onMouseLeftUp(e):this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}cancel(){let e=this.pcbArc!=null;jt.cancel(),this.interrupt(),e||A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=lg(this.defaultLineWidth).result,Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",$());break}A.publish("updateFrame","")}toggleWidth(e){let r=ce.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit()),Hi()}setWireWidth(e){this.polygon!=null&&(this.polygon.strokeWidth=e),we.prevTrackWidth=e,this.defaultLineWidth=e,A.publish("flushSelectingInfo","")}toggleLayer(e){this._pcbArc!=null&&this._pcbArc.layerId!=e&&(this._pcbArc.layerId=e)}wireCorner(e){}wireMode(e){}};var AU=class extends ci{constructor(){super();this.commands=new ve("draw text");this.text=null;this.option="OPTIONLEFTUP",Yo.setTool(this)}onKeyDown(e){switch(sr.getAction(5,e)){case"Cancel":this.cancel();break;case"Rotate Left":this.text!=null&&(this.text.rotateFor(this.text.position,ce.pcbConfig.rotate),rt.defaultText.rotation+=ce.pcbConfig.rotate);break;case"rotate_right":this.text!=null&&(this.text.rotateFor(this.text.position,-ce.pcbConfig.rotate),rt.defaultText.rotation-=ce.pcbConfig.rotate);break;case"Flip Right and Left":A.publish("turn","turnAround");break;case"Flip Up and Down":A.publish("turn","turnUpsideDown");break;case"Show Attribute Dialog When Placing Object":A.publish("getLastText","");break}A.publish("updateFrame","")}toggleLayer(e){this.text.layerId!=this.getLayer()&&(this.text.layerId=this.getLayer())}onMouseLeftUp(e){if(!this.drawing)this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},$());else{if(this.text.partition=x.getInstance().partitionId,!Bt.checkIsInCanEdit(this.text,this.getLayer())){let l="beyond drawing range";Bt.showMassageTip(l,l);return}let r=new S(e.sceneX,e.sceneY);A.publish("onlySelect",[this.text]);let i=Te.dispatch(this.text,"add");this.commands.addCommand(i),je.executeCommand(this.commands),this.commands=new ve("draw text"),A.publish("hasModifyPcbItem",this.text),A.publish("flushService","");let n=N9("typeface"),s=N9("height"),a=N9("strokeWidth");this.createText(r,n,a,s),OU(this.getNextValue(Bw)),this.drawing=!0}}getNextValue(e){if(e.match(/\d+$/)){let r=e.match(/\d{1,15}$/)[0],i=e.split(new RegExp(r+"$"))[0],n;if(!Number.isNaN(+r)&&r.length>1){let s=r.match(/^0+/),a=Number(r);s&&(n=s[0],String(a+1).length!=String(a).length&&(n=n.substr(0,n.length-1)),i=i+n)}return`${i}${Number(r)+1}`}else return e}getLastValue(e){if(e.match(/\d+$/)){let r=e.match(/\d{1,15}$/)[0],i=e.split(new RegExp(r+"$"))[0],n;if(!Number.isNaN(+r)&&r.length>1){let s=r.match(/^0+/),a=Number(r);s&&(n=s[0],String(a+1).length!=String(a).length&&(n=n.substr(0,n.length-1)),i=i+n)}return`${i}${Number(r)-1}`}else return e}onMouseMove(e){if(this.drawing){let r=new S(e.sceneX,e.sceneY);if(this.text!==null)this.text.layerId!=this.getLayer()&&(this.text.layerId=this.getLayer()),this.text.position=r;else{let i=N9("typeface"),n=N9("height"),s=N9("strokeWidth");this.createText(r,i,s,n),OU(this.getNextValue(Bw))}}}interrupt(){this.text!==null&&(this.text.remove(),A.publish("delete",this.text),this.drawing=!1,this.text=null,A.publish("updateRtree","")),this.end()}cancel(){this.interrupt(),OU(this.getLastValue(Bw)),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"FLIP":i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"&&this.turn("turnUpsideDown");break}A.publish("updateFrame","")}createText(e,r=ti.textAttr["attr-text-typeface"],i=ti.textAttr["attr-text-stroke-width"],n=ti.textAttr["attr-text-size"]){this.start(),this.text=ti.addText(this.getLayer(),"",!1,Bw,!0,r,n,ti.textAttr["attr-rotation"],!1,e,ti.textAttr["attr-origin"],i,ti.textAttr["attr-reversed-phase"],ti.textAttr["attr-reversed-phase-extend"],ti.textAttr["attr-mirror"])}getLayer(){let e=$e.getInstance().activeLayer;return(7==e||8==e||57==e||U2(e)||gr(e)||Rh($e.getInstance().getLayer(e).type)||_E(e)||_c(e)||ba(e)||52===e)&&(e=3),e}turn(e){if(!(!x.getInstance().isactive||23==x.getInstance().doctype))switch(e){case"turnAround":Yo.turn([this.text],!1,!1);break;case"turnUpsideDown":Yo.turn([this.text],!0,!1);break}}};var rpe=class extends ci{constructor(){super();this.commands=new ve("draw protractor");this.line=null;this._start=null;this.state=0;this.length=0;this.protractor=null;this.option="OPTIONLEFTUP"}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(this.line===null&&this.protractor===null){this.start(),this._start=r,this.drawing=!0,this.state=0;let i=$4();this.line=Yi.build(i,r,r,1)}else switch(this.state){case 0:let i=is.lastPrecision?is.lastPrecision:x.getInstance().unit=="mil"?1:3;this.protractor=is.addProtractor($4(),.6,4.5,i,this.line.start,this.line.end,this.line.end,!1),this.length=this.line.length,this.state=1;break;case 1:this.protractor.partition=x.getInstance().partitionId,this.line.remove(),this.line=null,this._start=null,this.state=0,this.length=0,A.publish("onlySelect",[this.protractor]),this.commands.addCommand(Te.dispatch(this.protractor,"add")),je.executeCommand(this.commands),this.commands=new ve("draw protractor"),this.protractor=null,this.drawing=!0,A.publish("updateRtree",""),this.end();break;default:break}}onMouseMove(e){if(this.line!==null&&this.drawing)switch(this.state){case 0:this.line.end=new S(e.sceneX,e.sceneY);break;case 1:if(this.protractor!=null){let r=new S(e.sceneX,e.sceneY).sub(this._start).normalize().mul(this.length);this.protractor.end=this._start.add(r)}break;default:break}}interrupt(){this.line!==null&&(this.line.remove(),this.line=null,this.protractor!=null&&(this.protractor.remove(),A.publish("delete",this.protractor),this.protractor=null),this._start=null,this.state=0,this.length=0,this.drawing=!1,A.publish("updateRtree","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var ipe=class extends ci{constructor(){super();this.dimension=null;this.adjustText=!1;this._start=null;this._end=null;this.bbox=null;this.option="OPTIONLEFTUP"}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(this.dimension===null){this.start();let i=Go.lastPrecision?Go.lastPrecision:x.getInstance().unit=="mil"?1:3;this.dimension=Go.addDimension($4(),r,r,r,r,i,10,.6,x.getInstance().unit,!1),this.drawing=!0,this._start=r}else if(!this.adjustText)this.adjustText=!0,this._end=r,this.bbox=new _e().ext2(this._start).ext2(this._end).build1();else{this.dimension.partition=x.getInstance().partitionId,A.publish("onlySelect",[this.dimension]);let i=new ve("draw dimension");i.addCommand(Te.dispatch(this.dimension,"add")),je.executeCommand(i),this.dimension=null,this.reset(),this.drawing=!0,A.publish("updateRtree","")}}onMouseMove(e){if(this.dimension!==null&&this.drawing)if(!this.adjustText)this.dimension.modifyEnd(new S(e.sceneX,e.sceneY));else{let r=new S(e.sceneX,e.sceneY);if(this.bbox.isContainsX(r.x)&&!this.bbox.isContainsY(r.y)){let i=new S(this._start.x,r.y),n=new S(this._end.x,r.y);this.dimension.modifyDimension(i,n)}else if(!this.bbox.isContainsX(r.x)&&this.bbox.isContainsY(r.y)){let i=new S(r.x,this._start.y),n=new S(r.x,this._end.y);this.dimension.modifyDimension(i,n)}else{let i=this._end.sub(this._start).normalize(),n=new S(-i.y,i.x),s=r.sub(this._start).dot(n),a=this._start.add(n.mul(s)),l=a.add(this._end.sub(this._start));this.dimension.modifyDimension(a,l)}}}interrupt(){this.dimension!==null&&(this.dimension.remove(),A.publish("delete",this.dimension),this.dimension=null,this.drawing=!1,A.publish("updateRtree","")),this.end()}cancel(){this.interrupt(),this._start==null?A.publish("tool","dropdrag"):this.drawing=!0,this.reset()}reset(){this._start=null,this._end=null,this.adjustText=!1,this.bbox=null}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var _U=class extends ci{constructor(){super(),this.option="OPTIONLEFTUP",Ua.changeTool(this)}onKeyDown(t){switch(sr.getAction(4,t)){case"Cancel":this.cancel();break}A.publish("updateFrame","")}onMouseLeftUp(t){let e=new S(t.sceneX,t.sceneY);this.place(e)}place(t){_3(t),this.drawing=!1,A.publish("tool","dropdrag"),dt.destroy()}interrupt(){this.drawing=!1,this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}applyValue(t){let{value:e,cursorPoint:r,startPoint:i}=t;e=new ft().conversion(x.getInstance().unit,"mil",e/10);let s=new S(r.x-i.x,r.y-i.y).normalize();s=new S(s.x*e,s.y*e);let a=new S(s.x+i.x,s.y+i.y);this.place(a),dt.destroy()}applyInputAtCursorValue(t){let{value:e,type:r,locked:i,unlocked:n,editing:s,keyCode:a,startPoint:l}=t;if(s){dt.editingWhat=r;return}this.applyValue(t)}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:vo(t.adsorb)};Qt.getInstance().menuData(e,this),this.drawing=!1}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var Fw=class o extends ko{static copy(t){A.messageBus.rpcCall("copy",t).then(e=>e.message&&o.copySuccess()).then(()=>we.updatePartialState({refreshPasteState:!0})),A.publish("referPosition",null)}static copySuccess(){A.publish("ui/toastMsg",{type:"success",msg:"Copy Success!"},$())}constructor(){super(),this.drawing=!0,jt.update(Pi.getInstance(),"Please select a reference point"),Mn.getInstance().allowPull=!1}onKeyDown(t){let e=sr.getAction(3,t);switch(e==null&&(e=sr.getAction(4,t)),e){case"Cancel":this.cancel();break;case"Paste":let r=Ve.getSelects(),i=_s(r),n;i.valid()&&(n=i.build1()),A.publish("referPosition",new S(n.center().x,n.center().y)),A.messageBus.rpcCall("copyItems","").then(s=>{s.message&&o.copySuccess()}),A.publish("tool","PASTE"),A.publish("clearSelect",""),this.interrupt();break}A.publish("updateFrame","")}onEnterPlace(t){this.onMouseLeftUp(t)}onMouseMove(t){this.drawing&&(super.onMouseMove(t),jt.update(t,"Please select a reference point"))}onMouseLeftUp(t){this.drawing=!1,A.publish("referPosition",new S(t.sceneX,t.sceneY)),A.messageBus.rpcCall("copyItems","").then(e=>{e.message&&o.copySuccess()}),A.publish("clearSelect",""),A.publish("tool","dropdrag"),jt.cancel(),ic.nthTime=1}interrupt(){this.drawing=!1,jt.cancel(),Mn.getInstance().allowPull=!0}cancel(){this.interrupt(),A.publish("tool","dropdrag")}onMouseRightUp(t){if(t.openMenu){if(ce.pcbConfig.endDrawing=="ctrl+rightClick"){if(!t.ctrlKey){this.rightClickMenuData(t);return}}else if(t.ctrlKey){this.rightClickMenuData(t);return}this.cancel()}}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:vo(t.adsorb)};Qt.getInstance().menuData(e,this),this.drawing=!1}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var iO=class extends ko{constructor(){super(),A.publish("pasteData",{uuid:x.getInstance().compiler.uuid,title:x.getInstance().name,doctype:x.getInstance().doctype},$()),Ua.changeTool(this),ic.tool=this,Mn.getInstance().allowPull=!1}async initPastePanel(){Ve.isSpecialPaste||(await IU.getInstance().initPaste2CurrentActiveLayer(),F0.getInstance().setTool(this),A.publish("FlushSketcherAttrView",{type:"PASTE",isInitAllParams:!0,switchTab:!0}))}onKeyDown(t){ic.onKeyDown(t)}onEnterPlace(t){ic.onMouseLeftUp(t)}onKeyUp(t){ic.onKeyUp(t)}onMouseLeftUp(t){ic.onMouseLeftUp(t),x.getInstance().doctype===3&&A.windowBridge.rpcCall(xIe.LOG.SET,[{type:KTe.PRIMITIVE_PASTE_ACROSS_PROJECT,content:[{"PCB Name":x.getInstance().name}],project_uuid:x.getInstance().currOpenProjectId}],$())}applyInputAtCursorValue(t){let{type:e,editing:r,keyCode:i}=t;if(r){dt.editingWhat=e;return}ic.applyValue(t),i===13&&dt.destroy()}onMouseMove(t){ic.onMouseMove(t)}interrupt(){ic.interrupt(),ic.tool=null,Mn.getInstance().allowPull=!0}cancel(){ic.cancel(),ic.tool=null,Mn.getInstance().allowPull=!0}onMouseRightUp(t){ic.onMouseRightUp(t)}};var xN=class o extends ko{static clip(){let t=()=>{A.publish("referPosition",null),A.messageBus.rpcCall("copyItems","").then(e=>{e&&o.cutSuccess()}),A.publish("clearSelect","")};A.publish("removeSelect",t)}static cutSuccess(){A.publish("ui/toastMsg",{type:"success",msg:"Cut Success!"},$())}constructor(){super(),this.drawing=!0,jt.update(Pi.getInstance(),"Please select a reference point"),Mn.getInstance().allowPull=!1}onKeyDown(t){let e=sr.getAction(3,t);switch(e==null&&(e=sr.getAction(4,t)),e){case"Cancel":this.cancel();break;case"Paste":Ve.clipHandleSelectItem();let r=()=>{A.publish("referPosition",null),A.messageBus.rpcCall("copyItems","").then(i=>{i&&o.cutSuccess()}),A.publish("clearSelect",""),A.publish("tool","PASTE"),this.interrupt()};A.publish("removeSelect",r);break}A.publish("updateFrame","")}onEnterPlace(t){this.onMouseLeftUp(t)}onMouseMove(t){this.drawing&&(super.onMouseMove(t),jt.update(t,"Please select a reference point"))}onMouseLeftUp(t){this.drawing=!1,Ve.clipHandleSelectItem();let e=new S(t.sceneX,t.sceneY),r=()=>{A.publish("referPosition",e),A.messageBus.rpcCall("copyItems","").then(i=>{i&&o.cutSuccess()}),A.publish("clearSelect",""),A.publish("updateRtree",""),A.publish("tool","dropdrag"),jt.cancel()};A.publish("removeSelect",r)}onMouseRightUp(t){if(t.openMenu){if(ce.pcbConfig.endDrawing=="ctrl+rightClick"){if(!t.ctrlKey){this.rightClickMenuData(t);return}}else if(t.ctrlKey){this.rightClickMenuData(t);return}this.cancel()}}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:vo(t.adsorb)};Qt.getInstance().menuData(e,this),this.drawing=!1}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}interrupt(){this.drawing=!1,jt.cancel(),Mn.getInstance().allowPull=!0}cancel(){this.interrupt(),A.publish("tool","dropdrag")}};var npe=class extends ci{constructor(){super();this.selections=new Array;this.mouseLeftX=0;this.mouseLeftY=0;this.drawing=!0}option1(e){switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.completed():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.selections.length>0?this.reDraw():this.cancel();break}}}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.selections.length?this.reDraw():this.cancel();break}A.publish("updateFrame","")}onMouseLeftDown(e){}onMouseMove(e){let r=e.sceneX,i=e.sceneY;this.selections.length>0&&this.drawing&&(this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(r,this.mouseLeftY),this.selections[1].start=new S(r,this.mouseLeftY),this.selections[1].end=new S(r,i),this.selections[2].start=new S(r,i),this.selections[2].end=new S(this.mouseLeftX,i),this.selections[3].start=new S(this.mouseLeftX,i),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY))}onMouseLeftUp(e){let r=ce.themeConfig.canvasTheme,i=r.isSolidLine(r.selectBoxLineStyle),n=r.selectBoxColor;if(this.selections.length==0){this.start();let s=e.sceneX,a=e.sceneY;this.mouseLeftX=s,this.mouseLeftY=a,this.selections.push(new hr(1002,new S(this.mouseLeftX,this.mouseLeftY),new S(s,this.mouseLeftY),i,n)),this.selections.push(new hr(1002,new S(s,this.mouseLeftY),new S(s,a),i,n)),this.selections.push(new hr(1002,new S(s,a),new S(this.mouseLeftX,a),i,n)),this.selections.push(new hr(1002,new S(this.mouseLeftX,a),new S(this.mouseLeftX,this.mouseLeftY),i,n))}else{this.reDraw();let s=new _e().ext6(this.mouseLeftX,this.mouseLeftY).ext6(e.sceneX,e.sceneY).build1();A.publish("adaptBBox",s),A.publish("updateCrossDirect",e),this.end()}}reDraw(){for(let e of this.selections)e.remove();this.selections.length=0}interrupt(){for(let e of this.selections)e.remove();this.selections.length=0,this.drawing=!1,this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var ope=class extends ci{constructor(){super();this.commands=new ve("Place radius size");this.radius=null;this.arc=null;this.option="OPTIONLEFTUP"}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseMove(e){if(this.arc!=null&&this.radius!=null&&this.drawing){let r=new S(e.sceneX,e.sceneY),i;this.arc instanceof nr?i=this.rectArcCenter:i=this.arc.center;let n=r.sub(i).normalize().mul(this.arc.radius).add(i);if(this.arc.isSelect(n.x,n.y))if(n.distance1(r)>this.radius.getRadiusLength())this.radius.updateRadius(r,n);else{let a=r.sub(n).normalize().mul(this.radius.getRadiusLength()).add(n);this.radius.updateRadius(a,n)}else if(this.arc instanceof vt||this.arc instanceof Si){let s=r.sub(this.arc.center).normalize(),a=this.arc.start.sub(this.arc.center),l=this.arc.end.sub(this.arc.center),c=a.dot(s),h=l.dot(s);c>h?n=this.arc.start:n=this.arc.end;let u=this.radius.start.sub(this.radius.end).length();if(r.distance1(this.arc.center)>this.arc.radius){let d=n.add(n.sub(this.arc.center).normalize().mul(u));this.radius.updateRadius(d,n)}else{let d=n.add(this.arc.center.sub(n).normalize().mul(u));this.radius.updateRadius(d,n)}}}}onMouseLeftUp(e){if(this.arc==null&&this.radius==null){let r=new S(e.sceneX,e.sceneY),i=e.sceneX,n=e.sceneY,s=new ut(i,i,n,n),a=Xj(s);for(let l of a.getArcs())l.isSelect(i,n)&&($t.filter([l]).size&&l.click(),this.arc=l);for(let l of a.rects)if(l.isSelect(i,n)){if(l instanceof nr){let c=l.getHoveredArc(i,n);if(c)this.rectArcCenter=c.center;else continue}$t.filter([l]).size&&l.click(),this.arc=l}for(let l of a.polygons){let c=l.getAllChildrens();for(let h of c)h.isSelect(i,n)&&cF(h.model.modelType)&&($t.filter([h]).size&&h.click(),this.arc=h)}if(this.arc!=null){this.start();let l;this.arc instanceof nr?l=this.rectArcCenter:l=this.arc.center;let c=l.sub(r).normalize(),h=Uo.lastPrecision?Uo.lastPrecision:x.getInstance().unit=="mil"?1:3;this.radius=Uo.addRadius($4(),r.add(c),r,.6,8,this.arc.radius,h,x.getInstance().unit,!1)}this.arc&&$t.filter([this.arc]).size&&A.publish("onlySelect",[this.arc])}else{A.publish("onlySelect",[this.radius]),A.publish("updateRtree","");let r=Te.dispatch(this.radius,"add");this.commands.addCommand(r),je.executeCommand(this.commands),this.commands=new ve("Place radius size"),this.arc=null,this.radius=null,this.rectArcCenter=null,this.end()}}interrupt(){if(this.arc!=null&&this.radius!=null){A.publish("select",[]),this.radius.remove(),A.publish("delete",this.radius);let e=this.arc.getParent();e&&e instanceof ct?$t.filter([e]).size>0&&(e.visible(),e.getAllChildrens().forEach(r=>r.visible())):$t.filter([this.arc]).size>0&&this.arc.visible(),this.arc=null,this.radius=null,this.rectArcCenter=null,this.drawing=!1,A.publish("updateRtree","")}this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var XC=class extends ci{constructor(){super();this.helpLine=null;this.defaultLineWidth=al.getInstance().getTrackWidth().value||1;this._pcbArc=null;this._polygon=null;this.adjustAngle=!1;this.option="OPTIONLEFTUP",jr.addDrawTool(this)}set pcbArc(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._pcbArc=e}get pcbArc(){return this._pcbArc}get polygon(){return this._polygon}getWidth(){return this.defaultLineWidth}set polygon(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._polygon=e}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Switch Common Track Width":this.showCommonTrackWidthMenu(e);break;case"Change Track Width While Routing":{A.publish("openMainDialog",{cmd:26,data:{tool:this}});break}case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseLeftUp(e){if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},$());return}let r=new S(e.sceneX,e.sceneY);if(this.pcbArc==null&&this.helpLine==null){if(!Bt.checkIsCanEditByPoint(r))return;this.start();let i=be.getActiveLayerID();this.helpLine=Yi.build(i,r,r,this.defaultLineWidth,ee.WHITE),this.drawing=!0}else if(this.adjustAngle){if(this.polygon!=null){if(this.polygon.partition=x.getInstance().partitionId,this.pcbArc.partition=x.getInstance().partitionId,!Bt.checkIsInCanEdit(this.polygon)){let n="beyond drawing range";Bt.showMassageTip(n,n);return}let i=new mi;i.createGroup("draw three point arc"),i.addCommand4Item(this.polygon,"add"),i.checkOutlines([this.polygon],new Set),nb(this.polygon),A.publish("onlySelect",[this.pcbArc])}this.helpLine!=null&&(this.helpLine.remove(),this.helpLine=null),this.polygon=null,this.pcbArc=null,this.drawing=!0,this.adjustAngle=!1,this.end()}else{if(!Bt.checkIsCanEditByPoint(r))return;this.helpLine.end=r,this.helpLine.length>.01?(this.helpLine.color=ee.BLACK,this.adjustAngle=!0):(this.helpLine.remove(),this.helpLine=null)}}onMouseMove(e){if(this.drawing){let r=new S(e.sceneX,e.sceneY);if(this.adjustAngle){let i=new ro;if(this.pcbArc==null&&this.helpLine!=null){if((r.equals(this.helpLine.start)||r.equals(this.helpLine.end))&&(r=r.add(new S(.001,0))),Math.abs(this.helpLine.start.sub(r).cross(this.helpLine.end.sub(r)))>1e-8){let{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=i.point2Angle(this.helpLine.start,this.helpLine.end,r);this.pcbArc=qc.addArc(be.getActiveLayerID(),n,s,this.defaultLineWidth,a,l,c,!1),this.helpLine.remove(),this.helpLine=null,this.polygon=pt.addPolygon("Line",be.getActiveLayerID(),[[this.pcbArc]],this.defaultLineWidth,"",!1)}}else{let n=this.pcbArc.start,s=this.pcbArc.end;if(Math.abs(n.sub(r).cross(s.sub(r)))>1e-8){let{center:a,radius:l,startAngle:c,endAngle:h,sweep:u}=i.point2Angle(n,s,r);this.pcbArc.center=a,this.pcbArc.radius=l,this.pcbArc.startAngle=c,this.pcbArc.endAngle=h,this.pcbArc.sweep=u}}}else this.helpLine!=null&&(this.helpLine.end=r)}}interrupt(){this.helpLine!=null&&(this.helpLine.remove(),this.helpLine=null),this.pcbArc!==null&&(this.pcbArc.remove(),this.polygon.remove(),A.publish("delete",this.pcbArc),A.publish("delete",this.polygon),this.pcbArc=null,this.polygon=null,this.adjustAngle=!1,A.publish("updateRtree","")),jr.clearDrawTool(),this.end()}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}toggleLayer(e){this._pcbArc!=null&&this._pcbArc.layerId!=e&&(this._pcbArc.layerId=e)}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=lg(this.defaultLineWidth).result,Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",$());break}A.publish("updateFrame","")}toggleWidth(e){let r=ce.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit()),Hi()}setWireWidth(e){this.helpLine&&(this.helpLine.width=e),this.polygon&&(this.polygon.strokeWidth=e),we.prevTrackWidth=e,this.defaultLineWidth=e,A.publish("flushSelectingInfo","")}cancel(){let e=this.helpLine!=null||this.pcbArc!=null;jt.cancel(),this.interrupt(),e||A.publish("tool","dropdrag")}wireCorner(e){}wireMode(e){}};var vU=class extends ci{constructor(){super();this.event=new Hu;this.started=!1;switch(this.event=new Hu,this.event._width=.02,this.resultEvent=new x9,tr.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.event.commands=new ve("draw polygon pad"),jr.addDrawTool(this),A.subscribe("PolygonPadReset",this.onPolygonPadReset.bind(this))}onPolygonPadReset(e){e===this.drawPolygon&&(this.started=!1)}onKeyDown(e){switch(sr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":let i=jr.getNextType();if(this.wireCorner(i),i==="WIRING_CORNER_FREEANGLE"||i==="WIRING_CORNER_ARC"){let n=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(n)}else dt.destroy();Hi();break;case"Finish":if(!this.started){this.onEnterPlace(e);return}}this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){if(dt.editingWhat){dt.editingWhat="";return}this.started||(this.started=!0,this.start()),this.dealLocked(e),this.drawPolygon.onMouseLeftUp(e),dt.destroy()}dealLocked(e){if(typeof dt.lineLockedLength=="number"){let r=dt.startPoint,i=new S(e.sceneX,e.sceneY),n=new S(i.x-r.x,i.y-r.y).normalize(),s=new S(n.x*dt.lineLockedLength,n.y*dt.lineLockedLength);i=new S(s.x+r.x,s.y+r.y),e.sceneX=i.x,e.sceneY=i.y}if(typeof dt.lineLockedAngle=="number"){let r=dt.startPoint,i=new S(e.sceneX-r.x,e.sceneY-r.y),n=(i.angleD(S.ORIGIN)+360)%360,s=i.rotateD(S.ORIGIN,dt.lineLockedAngle-n);e.sceneX=s.x+r.x,e.sceneY=s.y+r.y}}showFloatingInputBox(e){if(ce.pcbConfig.useDynamicInputBox&&this.started&&this.event.last&&(this.drawPolygon instanceof Bl||this.drawPolygon instanceof hl)){let r=Gf(),i=this.event.last;dt.startPoint=i;let n=i.distance1(e);if(!n)return;let s=Fo(e),a=Fo(i),c=(new S(e.x-i.x,e.y-i.y).angleD(S.ORIGIN)+360)%360;if(this.drawPolygon instanceof Bl||this.drawPolygon instanceof hl&&!this.drawPolygon.hasArc()){let h=c/180*Math.PI,u=new S(i.x+n,i.y);dt.id!=="adsorption"&&(dt.auxiliaryLine1?dt.auxiliaryLine1.update(i,u,n,h):dt.auxiliaryLine1=new Ew(i,u,n,h));let d=9;if(d>=dt.priority){dt.priority=d;let p={data:[{startPoint:i,cursorPoint:e,frameStartPoint:a,frameCursorPoint:s,info:{type:"free",value:Xe(n),unit:x.getInstance().unit}},{startPoint:i,cursorPoint:e,frameStartPoint:a,frameCursorPoint:s,info:{type:"circle",value:c,tagName:"angle"}}],type:"rect",show:!0,frameInfo:r};dt.create(p)}}else if(this.drawPolygon instanceof hl&&this.drawPolygon.hasArc()){let h=this.drawPolygon.getArcAngle(),u=this.event.start,d=this.drawPolygon.getArcEnd(),p=this.drawPolygon.getArcCenter(),m=this.drawPolygon.getArcRadius(),g=this.drawPolygon.getArcStartAngle(),y=this.drawPolygon.getArcEndAngle(),b=this.drawPolygon.getArcSweep();dt.id!=="adsorption"&&(dt.auxiliaryLine2?dt.auxiliaryLine2.update(u,d,p,m/10,g,y,b):dt.auxiliaryLine2=new Ow(u,d,p,m,g,y,b)),dt.id!=="Free Arc"&&dt.destroy();let P=9;if(P>=dt.priority){dt.priority=P;let T={data:[{startPoint:u,center:p,frameStartPoint:a,frameCursorPoint:Fo(p),info:{type:"circle",value:h,tagName:"angle",canNotLock:!0}}],type:"rect",show:!0,frameInfo:r};dt.create(T,"Free Arc")}}}else this.started&&dt.id!=="adsorption"&&dt.destroy()}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l,startPoint:c}=e;if(a){dt.editingWhat=i;return}let h=!1;if((dt.editingWhat||typeof dt.lineLockedLength=="number"||typeof dt.lineLockedAngle=="number")&&(h=!0),dt.editingWhat="",n||s){this.drawPolygon.arc||this.lockUnlock(e);return}let u=this.applyValue(e);l===13&&(u?h?(this.drawPolygon.asMouseLeftUp(u),dt.destroy()):(this.drawPolygon.addShape(u),this.completed()):dt.destroy())}lockUnlock(e){let{value:r,type:i,locked:n,unlocked:s}=e,a=new ft;i==="free"?n?(this.applyValue(e),r=a.conversion(x.getInstance().unit,"mil",r/10),dt.lineLockedLength=r):s&&(dt.lineLockedLength=null):i==="circle"&&(n?(dt.lineLockedAngle=r,this.applyValue(e)):s&&(dt.lineLockedAngle=null))}applyValue(e){let{value:r,type:i,startPoint:n,cursorPoint:s}=e,a=new ft,l,c;if(i==="free")if(r=a.conversion(x.getInstance().unit,"mil",r/10),dt.id==="adsorption"){let h=new S(s.x-n.x,s.y-n.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+n.x,h.y+n.y);if(this.started)c=u;else{this.event.start=u,this.started=!0;return}}else{let h=new S(this.event.curr.x-this.event.last.x,this.event.curr.y-this.event.last.y).normalize();l=new S(h.x*r,h.y*r),c=new S(l.x+this.event.last.x,l.y+this.event.last.y)}else if(i==="circle"){let h=this.drawPolygon.arc;if(h){let u=h.getStart(),d=h.getEnd(),p=new S((u.x+d.x)/2,(u.y+d.y)/2),m=new S(d.x-u.x,d.y-u.y),g=m.length(),y=g/2/Math.sin(r/2/180*Math.PI),b=g/2/Math.tan(r/2/180*Math.PI),P=m.normalize(),T=new S(-P.y,P.x),I=new S(T.x*b+p.x,T.y*b+p.y);c=new S(-T.x*y+I.x,-T.y*y+I.y)}else{let u=dt.startPoint;s=this.event.curr||s;let d=new S(s.x-u.x,s.y-u.y),p=(d.angleD(S.ORIGIN)+360)%360,m=d.rotateD(S.ORIGIN,r-p);c=new S(m.x+u.x,m.y+u.y)}}return this.showFloatingInputBox(c),this.event.curr=c,this.drawPolygon.draw(this.event.last,this.event.curr,tr.getInstance().type),this.drawPolygon.asClose(c),A.publish("updateFrame",""),c}onMouseMove(e){this.dealLocked(e),this.drawing&&this.drawPolygon.onMouseMove(e);let r=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(r)}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel();break}}}interrupt(){this.drawPolygon.interrupt(),jr.clearDrawTool(),dt.destroy(),this.started=!1,this.end()}cancel(){this.drawPolygon.cancel(),dt.destroy(),this.started=!1}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.event.last!=null&&this.event.curr!=null&&(this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),tr.getInstance().type=e,we.synchronize()}wireMode(e){}completed(){this.drawPolygon.completed(!1),dt.destroy(),this.started=!1,this.end()}backspace(){this.drawPolygon.backspace(),dt.destroy(),this.started=!1}rightClickMenuData(e){let r=this.event.start!=null,i={state:"show",left:e.mouseX,top:e.mouseY,filter:o1(tr.getInstance().type,e.adsorb,r).result};Qt.getInstance().menuData(i,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.drawPolygon.abortLast=!1,this.completed();break;case"CANCEL":this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]),Hi();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};function SAe(o,t=!1,e=NaN,r=!1){let i=new Jt;return o&&(isNaN(e)?i.add("MOVE_NODE"):(i.add("EDIT_NODE"),i.add("MOVE_NODE"),t||i.add("DELETE_NODE")),i.add("INSERT_NODE")),r&&i.add("CANCEL"),i.addSeparate(),i.add("EXIT_EDIT_PAD_SHAPE_MOE"),i.add("toggleAdsorb"),i.add("ADSORBENT_CONFIG"),i}var RN=class o{constructor(t,e,r){this.primitives=t,this.drillPosition=e,this.padDrillSnapshots=r}static fromPolygon(t,e,r){let i=[];t.getAllChildrens().forEach(s=>{s instanceof mt?i.push({type:"line",start:s.start.clone(),end:s.end.clone(),layerId:s.layerId}):s instanceof vt&&i.push({type:"arc",center:s.center.clone(),radius:s.radius,startAngle:s.startAngle,endAngle:s.endAngle,sweep:s.sweep,arcType:s.arcType,layerId:s.layerId})});let n;return r&&r.length>0&&(n=r.map(s=>{if(s instanceof mt)return{type:"line",start:s.start.clone(),end:s.end.clone(),layerId:s.layerId};if(s instanceof vt)return{type:"arc",center:s.center.clone(),radius:s.radius,startAngle:s.startAngle,endAngle:s.endAngle,sweep:s.sweep,arcType:s.arcType,layerId:s.layerId};throw new Error("Unsupported drill primitive type")})),new o(i,e,n)}restore(t,e,r){this.clearPolygon(t);let i=this.primitives.map(n=>{let s=cr(),a={layerId:t.layerId,strokeWidth:0,locked:!1};if(n.type==="line"){let l=new ih(s,n.start.clone(),n.end.clone(),a),c=new mt(l);return c.setParent(t),c}else if(n.type==="arc"){let l=new yh(s,n.center.clone(),n.radius,n.startAngle,n.endAngle,n.sweep,a,n.arcType),c=new vt(l);return c.setParent(t),c}throw new Error(`Unsupported primitive type: ${n.type}`)});t.setChildrens(i),e&&this.drillPosition&&e.setPosition(this.drillPosition),this.padDrillSnapshots&&r&&(r.forEach(n=>n.remove()),r.length=0,this.padDrillSnapshots.forEach(n=>{let s=cr(),a={layerId:n.layerId,strokeWidth:0,locked:!1};if(n.type==="line"){let l=new ih(s,n.start.clone(),n.end.clone(),a),c=new mt(l);r.push(c)}else if(n.type==="arc"){let l=new yh(s,n.center.clone(),n.radius,n.startAngle,n.endAngle,n.sweep,a,n.arcType),c=new vt(l);r.push(c)}}))}serialize(){return JSON.stringify({primitives:this.primitives,drillPosition:this.drillPosition?{x:this.drillPosition.x,y:this.drillPosition.y}:void 0,padDrillSnapshots:this.padDrillSnapshots})}static deserialize(t){var e,r;try{let i=JSON.parse(t);return new o(i.primitives||[],new S(((e=i.drillPosition)==null?void 0:e.x)||0,((r=i.drillPosition)==null?void 0:r.y)||0),i.padDrillSnapshots)}catch(i){return console.error("Failed to deserialize PolygonMemento:",i),null}}clone(){return o.deserialize(this.serialize())}clearPolygon(t){let e=t.getChildrens();e.forEach(r=>{r.forEach(i=>i.remove())}),e.forEach(r=>{r.length=0})}};var spe=class{constructor(){this.undoStack=[];this.redoStack=[];this.initialSnapshot=null;this.activePolygon=null;this.activeDrillPoint=null;this.activeDrillModels=null;this._switchPadNodeTool=!1;this.editing=!1}get switchPadNodeTool(){return this._switchPadNodeTool}set switchPadNodeTool(t){this._switchPadNodeTool=t}getInitialMemento(){return this.initialSnapshot}beginSession(t,e,r){this.activePolygon=t,this.activeDrillPoint=e,this.activeDrillModels=r,this.editing=!0,this.initialSnapshot=RN.fromPolygon(t,e==null?void 0:e.position,r)}commit(){if(!this.editing||!this.activePolygon||!this.initialSnapshot)return;let t=this.getCurrentSnapshot();this.hasSnapshotChanged(this.initialSnapshot,t)&&this.undoStack.push(this.initialSnapshot),this.initialSnapshot=null,this.editing=!1,this.updateViewState()}cancel(){!this.editing||!this.initialSnapshot||!this.activePolygon||(this.initialSnapshot.restore(this.activePolygon,this.activeDrillPoint,this.activeDrillModels),this.initialSnapshot=null,this.editing=!1,this.updateViewState())}undo(){if(!this.activePolygon||this.undoStack.length===0)return!1;let t=this.getCurrentSnapshot();this.redoStack.push(t);let e=this.undoStack.pop();return e&&e.restore(this.activePolygon,this.activeDrillPoint,this.activeDrillModels),this.updateViewState(),!0}redo(){if(!this.activePolygon||this.redoStack.length===0)return!1;let t=this.getCurrentSnapshot();this.undoStack.push(t);let e=this.redoStack.pop();return e&&e.restore(this.activePolygon,this.activeDrillPoint,this.activeDrillModels),this.updateViewState(),!0}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}clear(){this.undoStack.length=0,this.redoStack.length=0,this.initialSnapshot=null,this.editing=!1,this.activePolygon=null,this.activeDrillModels=null,this.activeDrillPoint=null,this.activeTool=null,this.switchPadNodeTool=!1}hasSnapshotChanged(t,e){return t?t.serialize()!==e.serialize():!0}getCurrentSnapshot(){var t;return RN.fromPolygon(this.activePolygon,(t=this.activeDrillPoint)==null?void 0:t.position,this.activeDrillModels)}updateTop(){we.undo=this.canUndo(),we.redo=this.canRedo()}updateViewState(){this.updateTop(),this.activeTool&&this.activeTool.updatePolygon()}setActiceTool(t){this.activeTool=t}};var DN=class DN{constructor(){this.activeToolHistory=null;this.activeToolId=null}static getInstance(){return DN.instance||(DN.instance=new DN),DN.instance}canUndo(){return this.activeToolHistory?this.activeToolHistory.canUndo():!1}canRedo(){return this.activeToolHistory?this.activeToolHistory.canRedo():!1}registerToolHistory(t,e){return this.activeToolHistory!==null?(console.warn(`ToolHistoryState: \u5DF2\u5B58\u5728\u6CE8\u518C\u7684\u5DE5\u5177 [${this.activeToolId}]\uFF0C\u65E0\u6CD5\u6CE8\u518C [${t}]`),!1):(this.activeToolHistory=e,this.activeToolId=t,!0)}unregisterToolHistory(t){(!t||this.activeToolId===t)&&(this.activeToolHistory=null,this.activeToolId=null)}undo(){return this.activeToolHistory?this.activeToolHistory.undo():!1}redo(){return this.activeToolHistory?this.activeToolHistory.redo():!1}clear(){this.activeToolHistory&&this.activeToolHistory.clear()}hasActiveToolHistory(){return this.activeToolHistory!==null}getActiveToolId(){return this.activeToolId}};DN.instance=null;var hy=DN;var wN=class extends ci{constructor(e){super();this.mouseLeftX=0;this.mouseLeftY=0;this.mouseLeftDown=!1;this.drillPointIsSelect=!1;this.padDrillModels=new Array;this.isDragging=!1;this.position=null;this.controlPointTool=null;this.polygon=null;this.pcbPolygon=null;this.toolId="EditPPadTool";this.option="OPTIONLEFTUP",e?this.editHistory=e:(this.editHistory=new spe,hy.getInstance().registerToolHistory(this.toolId,this.editHistory)),this.editHistory.setActiceTool(this)}get points(){return this.controlPointTool.points[0]}get mids(){return this.controlPointTool.mids[0]}get pathModels(){return this.pcbPolygon.getAllChildrens()}get selectIndex(){return this.controlPointTool.selectIndex[1]}set selectIndex(e){isNaN(e)?this.controlPointTool.selectIndex=[NaN,NaN]:this.controlPointTool.selectIndex=[0,e]}async showEditPadTag(){ie.windowBridge.publish("editPadShape","",$())}async exitEditPadTag(){ie.windowBridge.publish("interuptEditPadMode","",$())}setPad(e){this.start(),this.polygon=e,this.polygon.removeFill(),this.polygon.hidden();let r=this.polygon.layerId;if(gr(r)){let n=this.polygon.getMathGraphics(),s=new io;n.primitives.forEach(l=>{let c=s.ptToShape(l,r,0);this.padDrillModels.push(c)}),this.padDrillModels.forEach(l=>l.visible());let a=n.bbox().center();this.padDrillPoint=new qi(r,a)}let i=this.polygon.createPreviewChildrens();this.pcbPolygon=pt.addPolygon("Line",r,[i],.02,"",!1),this.controlPointTool=new sU(this.pcbPolygon),this.startHide(),this.showEditPadTag(),this.beginSession(),this.editHistory.cancel()}startHide(){A9.getInstance().addHightItem(this.pcbPolygon)}resotreHight(){A9.getInstance().unhighLigthAll()}manualHighLight(){this.pcbPolygon.manualHighLight=!0}onKeyDown(e){switch(sr.getAction(3,e)){case"Cancel":case"Finish":this.completed();break;case"Undo":hy.getInstance().undo();break;case"Redo":hy.getInstance().redo()}}updatePolygon(){this.controlPointTool.updatePoints(),this.updateDrillPoint(),this.manualHighLight(),ie.publish("updateFrame","")}updateDrillPoint(){}getPolyLines(e){return e.map(i=>{if(i instanceof M)return $u.add(this.polygon.layerId,i.start(),i.end(),.02,!1);if(i instanceof q){let n=i.startAngle/180*Math.PI,s=i.endAngle()/180*Math.PI;return qc.addArc(this.polygon.layerId,i.center,i.rx,.02,n,s,i.sweep(),!1)}})}onMouseLeftDown(e){e.sceneX=e.realSceneX,e.sceneY=e.realSceneY,ie.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},$());let r=e.sceneX,i=e.sceneY;this.drillPointIsSelect=this.padDrillPoint&&this.padDrillPoint.isSelect(r,i),this.mouseLeftX=r,this.mouseLeftY=i,(this.controlPointTool.onMouseLeftDown(e)||this.drillPointIsSelect)&&(this.mouseLeftDown=!0,this.manualHighLight(),this.beginSession())}beginSession(){this.editHistory.beginSession(this.pcbPolygon,this.padDrillPoint,this.padDrillModels)}onMouseMove(e){this.mouseLeftDown?this.drillPointIsSelect?this.selectDrillMoving(e):this.selectPadMoving(e):this.controlPointTool.onMouseUpMove(e)}selectPadMoving(e){this.controlPointTool.onMouseMove(e)}selectDrillMoving(e){if(this.padDrillPoint.status()){let r=this.padDrillPoint.position;this.mouseLeftX=e.sceneX,this.mouseLeftY=e.sceneY;let i=new S(e.sceneX,e.sceneY);this.padDrillPoint.setPosition(i);let n=i.sub(r);this.padDrillModels.forEach(s=>{let a=Ae.translate(n.x,n.y,0);s.transform(a)})}}checkDrillInInner(e){if(gr(this.polygon.layerId)){let r=fe.build2(e),i=fe.build2(this.getPrimitive(this.padDrillModels));return yb.build2(r,i).inInner()}else return!0}getPrimitive(e){let r=new Array;for(let i of e)if(i instanceof mt)r.push(new M(i.start,i.end));else{let n=i.startAngle/Math.PI*180,s=i.startAngle===i.endAngle?360:i.endAngle/Math.PI*180,a=q.build2(i.center,n,s,i.radius,i.radius,i.sweep);r.push(a)}return r}onMouseLeftUp(e){var a;this.drillPointIsSelect=!1;let r=this.polygon,i=r.layerId;this.mouseLeftDown=!1;let n=new ve("zero line");if(this.controlPointTool.removeZeroLenLine(n)){nw(this.pcbPolygon);let l=this.pcbPolygon.getMathGraphics().primitives,c=!1;if(this.editHistory.getInitialMemento()){let h=RN.fromPolygon(this.pcbPolygon,(a=this.padDrillPoint)==null?void 0:a.position,this.padDrillModels);c=this.editHistory.getInitialMemento().serialize()!==h.serialize()}if(c){if(this.editHistory.commit(),gr(i)){let h=Ae.translate(-r.center.x,-r.center.y,0).rotateZ(-r.rotation);this.polygon.holeOffset=this.padDrillPoint.getPosition().multiply4(h)}this.polygon.setChildrens(fe.build2(l))}else this.editHistory.cancel()}else this.editHistory.cancel();this.controlPointTool.onMouseLeftUp(e),this.manualHighLight()}async completed(){this.addUndoHistory();let e=fe.build2(this.pcbPolygon.primitives),r=No(e),i=new ve("edit polygon pad");if(r){this.polygon.setChildrens(e);let n=new Sm(this.pcbPolygon.primitives);if(this.polygon.center=n.center,gr(this.polygon.layerId)){let l=Ae.translate(-this.polygon.center.x,-this.polygon.center.y,0).rotateZ(-this.polygon.rotation);this.polygon.holeOffset=this.padDrillPoint.getPosition().multiply4(l)}let s=this.polygon.getParent(),a=Lue(this.polygon,i);if(s!=null&&s instanceof Me){let l=new $f;await l.updateCustomFootprint(s,i,a),l.deletePad(this.polygon,s,i)}}else{let n=this.polygon;this.pathModels.forEach(a=>a.remove()),n.fill(),n.visible();let s=n.getParent();s!=null&&s instanceof Me&&(i.addCommand(Te.dispatch(s,"modify")),ie.publish("hasModifyPcbItem",s),await new $f().updateCustomFootprint(s,i,[n]))}this.clear(),this.editHistory.clear(),hy.getInstance().unregisterToolHistory(this.toolId),je.executeCommand(i),ie.publish("tool","dropdrag"),ie.publish("flushSelectingInfo",""),this.end()}addUndoHistory(){let e=[],r=0;for(;this.editHistory.canUndo();)r++,this.editHistory.undo();for(let i=0;i<r;i++){let n=new ve("edit pad shape");this.updatePadShape(),n.addCommand(Te.dispatch(this.polygon,"modify")),je.executeCommand(n),this.editHistory.redo()}e.forEach(i=>je.executeCommand(i))}updatePadShape(){let e=this.polygon,r=this.pcbPolygon.getMathGraphics().primitives;if(e.setChildrens(fe.build2(r)),nw(e),gr(this.polygon.layerId)){let i=this.padDrillPoint.getPosition(),n=e.center;e.holeOffset=i.sub(n)}}onDoubleClick(e){e.sceneX=e.realSceneX,e.sceneY=e.realSceneY,ie.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},$());let r=e.sceneX,i=e.sceneY;for(let n=0,s=this.points.length;n<s;n++)if(this.points[n].isSelect(r,i)){this.editNode(n);return}}editNode(e){this.isDragging=!0;let r=[],i=new io;this.padDrillModels.forEach(h=>{let u=i.clone4(h.model);r.push(u)});let{shapes:n,last:s,start:a,curr:l}=this.controlPointTool.editNode([0,e]),c={shapes:n.map(h=>h.primitive),last:s,start:a,curr:l,profile:this.polygon,padDrillModels:r};this.toggleRedrawPadTool(c)}onMouseRightUp(e){if(e.sceneX=e.realSceneX,e.sceneY=e.realSceneY,this.position=e,e.openMenu){for(let r=0,i=this.points.length;r<i;r++)if(this.points[r].isSelect(e.sceneX,e.sceneY)){this.selectIndex=r,this.rightClickMenuData(e);return}}if(this.selectIndex=NaN,e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.isDragging?this.onMouseLeftUp(e):this.completed():this.rightClickMenuData1(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData1(e):this.isDragging?this.onMouseLeftUp(e):this.rightClickMenuData1(e);break}}}rightClickMenuData1(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:SAe(!1,!1,NaN,this.controlPointTool.nodeInsert).result};this.position=e,Qt.getInstance().menuData(r,this)}rightClickMenuData(e){let i={state:"show",left:e.mouseX,top:e.mouseY,filter:SAe(!0,!1,this.selectIndex,this.controlPointTool.nodeInsert).result};this.position=e,Qt.getInstance().menuData(i,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"EDIT_NODE":isNaN(this.selectIndex)||(this.editNode(this.selectIndex),this.selectIndex=NaN);break;case"DELETE_NODE":isNaN(this.selectIndex)||(this.deletePoint(),this.selectIndex=NaN);break;case"MOVE_NODE":this.mouseLeftDown=!0;break;case"INSERT_NODE":this.insertNode();break;case"CANCEL":this.controlPointTool.cancel();break;case"COMPLETE":this.completed();break;case"EXIT_EDIT_PAD_SHAPE_MOE":this.exitEditPadTag(),this.completed();break;case"toggleAdsorb":ie.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":ie.publish("openSystemDialog","ADSORPTION",$());break}ie.publish("updateFrame","")}insertNode(){this.controlPointTool.insertNode(this.polygon,this.toggleRedrawPadTool.bind(this))}toggleRedrawPadTool(e){this.editHistory.switchPadNodeTool=!0;let{shapes:r,last:i,start:n,curr:s,profile:a,padDrillModels:l}=e;ie.publish("redrawPolygonPad",{shapes:r,last:i,start:n,curr:s,profile:a,padDrillModels:l,history:this.editHistory})}deletePoint(){this.beginSession(),this.controlPointTool.deletePoint(),this.editHistory.commit(),this.controlPointTool.updatePoints(),this.manualHighLight(),this.selectIndex=NaN}interrupt(){this.clear(),this.interruptTool(),this.polygon.isEmpty||(this.polygon.fill(),this.polygon.visible()),this.editHistory.switchPadNodeTool||(this.editHistory.clear(),hy.getInstance().unregisterToolHistory(this.toolId)),this.polygon=null,this.resotreHight(),this.exitEditPadTag(),this.editHistory.switchPadNodeTool=!1,this.editHistory.setActiceTool(null)}interruptTool(){this.controlPointTool.interrupt(),this.pathModels.forEach(e=>e.remove()),this.pathModels.length=0,this.pcbPolygon.remove(),pt.delete(this.pcbPolygon),this.pcbPolygon=null}clear(){this.padDrillPoint&&(this.padDrillPoint.remove(),this.padDrillPoint=null),this.padDrillModels.forEach(e=>e.remove()),this.padDrillModels.length=0}};var ape=class extends ci{constructor(){super();this.commands=new ve("draw suture via");this.net="";this._start=null;this.selections=[];this.hasEffectiveDrawn=!1;this.drawMode=null;this.option="OPTIONLEFTUP";let e=te.getInstance().getDefaultRadiusPhysics();this.radius=e.defalutRadius,this.innerRadius=e.defalutInner,this.lineSpacing=rt.defaultSutureVia.lineSpacing,this.columnSpacing=rt.defaultSutureVia.columnSpacing,A.publish("openMainDialog",{cmd:19,data:{tool:this}})}getDialogData(){let e=x.getInstance().unit,r=new ft;return{action:"attribute-for-place-sut-via",attrNet:this.net||"",netList:ze.getNet(),attrViaGeneralOuterdiameter:r.conversion("mil",e,this.radius*20),attrViaGeneralInnerdiameter:r.conversion("mil",e,this.innerRadius*20),attrRowSpacing:r.conversion("mil",e,this.lineSpacing*10),attrColSpacing:r.conversion("mil",e,this.columnSpacing*10),unit:e}}modifyByDialog(e){let r=e.action;if(r=="confirm"){this.drawMode=0;let i=new ft,n=e["attr-net"],s=parseFloat(e["attr-col-spacing"])/10,a=parseFloat(e["attr-row-spacing"])/10,l=parseFloat(e["attr-via-general-innerdiameter"])/20,c=parseFloat(e["attr-via-general-outerdiameter"])/20;this.net=n||"",this.columnSpacing=i.conversion(x.getInstance().unit,"mil",s),this.lineSpacing=i.conversion(x.getInstance().unit,"mil",a),this.radius=i.conversion(x.getInstance().unit,"mil",c),this.innerRadius=i.conversion(x.getInstance().unit,"mil",l),rt.setDefaultSutureVia(this.lineSpacing,this.columnSpacing)}else r=="cancel"&&this.cancel()}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}async onMouseLeftUp(e){if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},$());return}if(this.drawMode===1){this.netSelect(e.sceneX,e.sceneY);return}let r=e.sceneX,i=e.sceneY,n=new S(r,i);if(this.selections.length==0){this.start(),jt.cancel(),this._start=n;let s=new hr(1002,new S(this._start.x,this._start.y),new S(r,this._start.y),!1,ee.WHITE),a=new hr(1002,new S(r,this._start.y),new S(r,i),!1,ee.WHITE),l=new hr(1002,new S(r,i),new S(this._start.x,i),!1,ee.WHITE),c=new hr(1002,new S(this._start.x,i),new S(this._start.x,this._start.y),!1,ee.WHITE);this.selections.push(s),this.selections.push(a),this.selections.push(l),this.selections.push(c),this.drawing=!0}else{this.clearSelectBox();let s=new _e().ext2(this._start).ext2(n).build1(),a=await this.placeSutureVias(s),l=[];for(let c of a){A.publish("hasModifyPcbItem",c);let h=Te.dispatch(c,"add");this.commands.addCommand(h),l.push(c)}A.publish("onlySelect",l),je.executeCommand(this.commands),this.commands=new ve("draw suture via"),A.publish("flushService",""),this.end()}}onMouseMove(e){if(this.drawMode===0){let r=e.sceneX,i=e.sceneY;this.selections.length>0&&this.drawing?(this.selections[0].start=new S(this._start.x,this._start.y),this.selections[0].end=new S(r,this._start.y),this.selections[1].start=new S(r,this._start.y),this.selections[1].end=new S(r,i),this.selections[2].start=new S(r,i),this.selections[2].end=new S(this._start.x,i),this.selections[3].start=new S(this._start.x,i),this.selections[3].end=new S(this._start.x,this._start.y)):jt.update(e,"Please select an area")}else this.drawMode==1?jt.update(e,"Please select a network"):jt.cancel()}getLayerId(){let e=be.getActiveLayer();return e.isCopperLayer()?e.layerID:1}interrupt(){this.drawMode=0,this.clearSelectBox(),jt.cancel(),this.end()}cancel(){this.drawMode===null||this.drawMode==0?(this.interrupt(),this.hasEffectiveDrawn&&A.publish("rebuildCopperRegionDialog",{msg:""}),A.publish("tool","dropdrag")):(this.drawMode=0,this.confirmWindow())}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"INHERIT_NET":this.update(i[1]);break}A.publish("updateFrame","")}confirmWindow(){A.publish("openMainDialog",{cmd:19,data:{tool:this}})}modify(e){}clearSelectBox(){for(let e of this.selections)e.remove();this.selections.length=0}placeVia(e){(ze.getItem(this.net)==null||ze.getItem(this.net).size==0)&&(this.net="");let r=te.getInstance().getSolderExpansionByNet(this.net),i=new Gg(cr(),2,"",1,2,[],this.net,this.radius,e,this.innerRadius,1,r.viaTopExpansion,r.viaBottomExpansion,!1);return Tn.getInstance().addModel(i),i}async placeSutureVias(e){let r=new Array,i=new Array,n=e.width(),s=e.height(),a=this.radius*2;if(n>=a&&s>=a){let l=e.UL(),c=Math.floor((n-a)/this.columnSpacing)+1,h=Math.floor((s-a)/this.lineSpacing)+1,u=new Array,d=new Array,p=l.y-this.radius,m=l.x+this.radius;for(let P=0;P<h;P++){let T=p-this.lineSpacing*P;u.push(T)}for(let P=0;P<c;P++){let T=m+this.columnSpacing*P;d.push(T)}for(let P of u)for(let T of d){let I=new S(T,P),C=this.placeVia(I);r.push(C)}if(!r.length)return i;let g=this.getLayerId(),{message:y}=await A.messageBus.rpcCall("sutureViaDrc",{vias:r,checkSameNet:!0,profile:Lh(fe.build6(e)),layerId:g,mode:1,maxProgress:.9}),{filterIds:b}=y;r.forEach(P=>{let T=Eo.existClearanceError(P.globalIndex,g);if(!T.existClearanceError&&!b.includes(P.globalIndex)){T.exsitError&&(this.hasEffectiveDrawn=!0);let I=Hr.addViaByModel(P);i.push(I)}else P.remove(),Tn.getInstance().delete(P,P.globalIndex),Eo.deleteClearanceError(P.globalIndex),Eo.deleteBlindError(P.globalIndex),Eo.deleteRadiusError(P.globalIndex)}),A.publish("progressUpdate",[1,"Design rule check"],$()),i.length==0&&!y.hasSameNetCoppers&&A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before adding suture holes"},$())}return i}toggleMode(e){this.drawMode=e,this.drawing=!0}netSelect(e,r){let i=Wr.selectNet(e,r),n=new Set;for(let s of i)s.isSelect(e,r)&&s.net&&n.add(s.net);n.size>1?this.showNetsMenu(Array.from(n)):this.update(Array.from(n)[0])}update(e){this.net=e,this.drawMode=0,this.confirmWindow()}getNetsMenuData(e){let r=new Jt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}showNetsMenu(e){let r={},i=Pi.getInstance();r.state="show",r.left=i.mouseX,r.top=i.mouseY,r.filter=this.getNetsMenuData(e).result,Qt.getInstance().menuData(r,this),this.drawing=!1}};var lpe=class extends ci{constructor(e){super();this.template=new Array;this.image=null;this.option="OPTIONLEFTUP";let r=new ft;e.unit!=="mil"?(this.width=r.conversion(e.unit,"mil",+e.width)/10,this.height=r.conversion(e.unit,"mil",+e.height)/10):(this.width=+e.width/10,this.height=+e.height/10),this.template=F3(e.path);let i=new _e;this.template.forEach(n=>{i.ext1(n.bbox())}),this.box=i.build1(),this.drawing=!0,Yo.setTool(this),this.start()}onKeyDown(e){switch(sr.getAction(5,e)){case"Cancel":this.cancel();break;case"Rotate Left":this.image!=null&&(this.image.rotateFor(this.image.start,ce.pcbConfig.rotate),rt.defaultImage.rotation+=ce.pcbConfig.rotate);break;case"rotate_right":this.image!=null&&(this.image.rotateFor(this.image.start,-ce.pcbConfig.rotate),rt.defaultImage.rotation-=ce.pcbConfig.rotate);break;case"Flip Right and Left":A.publish("turn","turnAround");break;case"Flip Up and Down":A.publish("turn","turnUpsideDown");break}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(this.image!=null){if(this.image.start=r,!Bt.checkIsInCanEdit(this.image)){let n="beyond drawing range";Bt.showMassageTip(n,n);return}this.image.partition=x.getInstance().partitionId,A.publish("onlySelect",[this.image]);let i=new ve("insert image");i.addCommand(Te.dispatch(this.image,"add")),je.executeCommand(i),A.publish("hasModifyPcbItem",this.image),this.image=null,this.drawing=!0}A.publish("flushService","")}onMouseMove(e){if(this.drawing){let r=new S(e.sceneX,e.sceneY);this.image!=null?(this.image.layerId!=this.getLayer()&&(this.image.layerId=this.getLayer()),this.image.start=r):this.image=Ln.addImage(this.getLayer(),r,this.width,this.height,rt.defaultImage.rotation,!1,!1,this.template)}}interrupt(){this.image!==null&&(this.image.remove(),A.publish("delete",this.image),this.image=null,A.publish("flushService","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}getLayer(){let e=be.getActiveLayer();return e.isPlaneLayer()||12==e.layerID||11==e.layerID||7==e.layerID||8==e.layerID||47==e.layerID||ba(e.layerID)||52===e.layerID||_E(e.layerID)?3:e.layerID}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"FLIP":i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"&&this.turn("turnUpsideDown");break}A.publish("updateFrame","")}turn(e){if(!(!x.getInstance().isactive||23==x.getInstance().doctype))switch(e){case"turnAround":Yo.turn([this.image],!1,!1);break;case"turnUpsideDown":Yo.turn([this.image],!0,!1);break}}};var cpe=class extends ci{constructor(t,e,r,i,n){super(),this.start(),this.option="OPTIONLEFTUP",this.oldToolDrawing=e,this.drawing=!0,this.tool=t,this.lastTool=r,this.referPointProgram=i,this.msg=n}onKeyDown(t){switch(sr.getAction(4,t)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(t);return}A.publish("updateFrame","")}onMouseMove(t){jt.update(t,this.msg)}onMouseLeftUp(t){if(this.drawing){if(!this.referPointProgram.setReferPointSuccess(t.sceneX,t.sceneY))return;this.tool.setNextTool(this.lastTool),yi.resetLastScene(),this.tool.drawing=this.oldToolDrawing,this.referPointProgram.setReferPoint(t.sceneX,t.sceneY),jt.cancel(),this.end(),A.publish("flushService","")}}interrupt(){this.drawing=!1,this.tool.setNextTool(this.lastTool),yi.resetLastScene(),this.tool.drawing=this.oldToolDrawing,jt.cancel(),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:vo(t.adsorb)};Qt.getInstance().menuData(e,this),this.drawing=!1}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel(),(this.msg=="Please select a starting point"||this.msg=="Please select a center point")&&A.publish("showArrayDistributionDlg",null,$());break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var hpe=class extends ci{constructor(e,r,i,n,s,a=new Array,l,c){super();this.widthFollowRule=!1;this.event=new Hu;this.isDetermineLine=!1;this.start(),this.event._width=s.strokeWidth,s instanceof Sr?this.resultEvent=new cU(s):s instanceof ct?this.resultEvent=new p2(s,l):s instanceof nr&&(this.resultEvent=new lU(s)),this.event.commands=c||new ve("redraw polygon 2D LINE"+s.type),this.event.commands.addCommand(Te.dispatch(s,"modify")),Te.dispatchCoppers(s,"delete",this.event.commands),s.clearCopper();for(let h of e){let u=this.getShape(h,s.color);this.event.shape.push(u),this.event.drawHistoryRecord()}for(let h of a){let u=this.getShape(h,s.color);this.resultEvent.nextShape.push(u)}switch(be.setActiveLayerId(s.layerId),this.drawing=!0,this.event.start=i,this.event.last=r,s.type!="Line"?this.event.needClose=!0:r.equals(i)||(this.event.needClose=!0),s.hidden(),s.removeFill(),tr.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.drawPolygon.draw(this.event.last,n,tr.getInstance().type),this.drawPolygon.asClose(n),s instanceof Sr?e.forEach(h=>{h.remove()}):s instanceof nr&&e.forEach(h=>{h.remove()}),jr.addDrawTool(this),we.synchronize()}getWidth(){return this.event._width}getShape(e,r=ee.BLACK){let i=e.layerId;return e instanceof vt?Zo.build(i,e.center,e.radius,e.width,e.startAngle,e.endAngle,e.sweep,r):Yi.build(i,e.start,e.end,e.width,r)}onKeyDown(e){switch(sr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(jr.getNextType()),Hi();break;case"Cancel":this.completed(!0);break;case"Change Track Width While Routing":{A.publish("openMainDialog",{cmd:26,data:{tool:this}});break}case"Finish":this.onMouseLeftUp(e);break}this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){this.drawPolygon.onMouseLeftUp(e),this.isDetermineLine=!0}onMouseMove(e){this.drawing&&this.drawPolygon.onMouseMove(e,!0)}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.completed(!0):this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.completed(!0);break}}}interrupt(){jr.clearDrawTool(),this.drawPolygon.interrupt(),this.resultEvent.nextShape.forEach(e=>{e.remove()}),this.resultEvent.nextShape.length=0,this.resultEvent.profile!=null&&(this.resultEvent.profile.visible(),this.resultEvent.profile.fill(),this.event.commands.undo()),this.end()}cancel(){this.drawPolygon.cancel()}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr),tr.getInstance().type=e,we.synchronize(),Hi()}setWireWidth(e){this.drawPolygon.wireWidth(e),this.resultEvent.nextShape.forEach(r=>{r.width=e}),Hi()}completed(e=!1){if(e&&!this.isDetermineLine){this.interrupt(),A.publish("tool","dropdrag");return}this.resultEvent.profile&&(this.resultEvent.profile.visible(),this.resultEvent.profile.fill()),this.drawPolygon.abortLast=e,this.drawPolygon.completed(!1)}backspace(){this.drawPolygon.backspace()}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:o1(tr.getInstance().type,e.adsorb,!0,!0).result};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.completed(!0);break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]),Hi();break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}wireMode(e){}};var upe=class extends x9{constructor(t){super(),this.pad=t}getResult(t){let e=new Array;if(t.shape.forEach(r=>{let i=this.getModel(t,r);e.push(i),r.remove()}),e=iy(e),e.length>0){let r=e.map(i=>i.primitive);e.forEach(i=>i.remove()),this.pad.setChildrens(fe.build2(r)),this.pad.fill()}t.shape.length=0}getPrimitive(t){if(t instanceof Yi||t instanceof Zo)return t.primitive;if(t instanceof hr)return new M(t.start,t.end);if(t instanceof ns)return q.build2(t.center,t.startAngle,t.endAngle,t.radius,t.radius,t.sweep)}getModel(t,e){let r=this.pad.layerId;return new io().clone4Shape(this.getPrimitive(e),r,t._width)}confirmWindow(t,e){this.modify(t,e,!0)}async modify(t,e,r){let i=this.pad.getParent();i!=null&&i instanceof Me&&(t.commands.addCommand(Te.dispatch(i,"modify")),await new $f().updateCustomFootprint(i,t.commands,[this.pad])),ah.realtimeCheckItems([this.pad]),je.executeCommand(t.commands),A.publish("hasModifyPcbItem",this.pad),this.pad.fill(),this.pad.visible(),this.pad=null,e.drawing=!0,A.publish("tool","dropdrag"),A.publish("flushSelectingInfo",""),A.publish("flushService","")}};var xU=class extends ci{constructor(e,r,i,n,s,a,l,c){super();this.event=new Hu;this.padDrillModels=new Array;this.isDetermineLine=!1;this.selectPoint=null;this.pcbPolygon=null;this.editPadNodeShape=!1;this.start(),this.editHistory=c,this.resultEvent=new upe(s),this.event.commands=l||new ve("redraw polygon Pad"),this.event._width=.02;for(let u of e){let d=this.getShape(u,s.layerId);this.event.shape.push(d)}this.drawing=!0,this.event.start=i,this.event.last=r,this.selectPoint=n,tr.getInstance().type="WIRING_CORNER_FREEANGLE",this.event.needClose=!0,s.hidden(),s.removeFill(),be.setActiveLayerId(s.layerId),this.pad=s,this.padDrillModels=a;let h=this.pad.createPreviewChildrens();this.pcbPolygon=pt.addPolygon("Line",this.pad.layerId,[h],.02,"",!1),this.pcbPolygon.hidden(),this.drawPolygon=new Bl(this.event,jr,this.resultEvent),this.drawPolygon.draw(this.event.last,this.selectPoint,tr.getInstance().type),this.drawPolygon.asClose(this.selectPoint),ie.windowBridge.publish("editPadShape","",$()),jr.addDrawTool(this),we.synchronize(),this.startHide()}getShape(e,r){let i=r;if(e instanceof q){let n=e.startAngle/180*Math.PI,s=e.endAngle()/180*Math.PI;return Zo.build(i,e.center,e.rx,this.event._width,n,s,e.sweep())}else return Yi.build(i,e.start(),e.end(),this.event._width)}onKeyDown(e){switch(sr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(jr.getNextType()),Hi();break;case"Cancel":this.completed(!0);case"Finish":this.onEnterPlace(e);return}this.drawPolygon.onKeyDown(e)}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.completed(!0):this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.completed(!0);break}}}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY),i=this.isSelectStart(r);this.drawPolygon.onMouseLeftUp(e),this.isDetermineLine=!0,this.manualHighLight(),i&&(this.addCommand(),ie.publish("select",[this.pad]),ie.publish("editPadShape",{history:this.editHistory}))}isSelectStart(e){return this.event.shape.length>0&&this.event.shape[0].start.distance1(e)<=this.event._width/2}onMouseMove(e){this.drawing&&(this.drawPolygon.onMouseMove(e),this.manualHighLight())}interrupt(){this.drawPolygon.interrupt(),this.resultEvent.pad!=null&&(this.resultEvent.pad.visible(),this.resultEvent.pad.fill()),this.padDrillModels.forEach(e=>{e.remove()}),this.pcbPolygon.remove(),pt.delete(this.pcbPolygon),this.padDrillModels.length=0,ie.windowBridge.publish("interuptEditPadMode","",$()),this.resotreHight(),this.end()}cancel(){this.drawPolygon.cancel()}flipPath(){this.drawPolygon.flipPath()}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr),tr.getInstance().type=e,we.synchronize()}completed(e=!1){e&&!this.isDetermineLine&&this.drawPolygon.asMouseLeftUp(this.selectPoint),this.drawPolygon.abortLast=e,this.drawPolygon.completed(!1),this.addCommand(),this.padDrillModels.forEach(r=>{r.remove()}),this.padDrillModels.length=0,this.end(),this.pad.fill(),ie.publish("select",[this.pad]),ie.publish("editPadShape",{history:this.editHistory})}checkDrillInInner(){if(gr(this.pad.layerId)){let e=this.event.shape,r=fe.build2(this.getPrimitive(e)),i=fe.build2(this.getPrimitive1(this.padDrillModels));return yb.build2(r,i).inInner()}else return!0}getPrimitive(e){let r=new Array;for(let i of e)r.push(this.getModel(i));return r}getModel(e){if(e instanceof Yi||e instanceof Zo)return e.primitive;if(e instanceof hr)return new M(e.start,e.end);if(e instanceof ns)return q.build2(e.center,e.startAngle,e.endAngle,e.radius,e.radius,e.sweep)}getPrimitive1(e){let r=new Array;for(let i of e)if(i instanceof mt)r.push(new M(i.start,i.end));else{let n=i.startAngle/Math.PI*180,s=i.startAngle===i.endAngle?360:i.endAngle/Math.PI*180,a=q.build2(i.center,n,s,i.radius,i.radius,i.sweep);r.push(a)}return r}backspace(){this.drawPolygon.backspace()}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:o1(tr.getInstance().type,e.adsorb,!0).result};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.completed(!0);break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]),Hi();break;case"toggleAdsorb":ie.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":ie.publish("openSystemDialog","ADSORPTION",$());break}ie.publish("updateFrame","")}wireMode(e){}startHide(){ie.publish("stashHight",""),be.forceDeactive(!0),be.setActiveLayerId(be.getActiveLayerID()),this.manualHighLight()}manualHighLight(){this.event.shape.forEach(e=>e.manualHighLight=!0),this.drawPolygon.getPreviewOutline().forEach(e=>e&&(e.manualHighLight=!0)),this.event.closeLine&&(this.event.closeLine.manualHighLight=!0)}resotreHight(){be.forceDeactive(!1),be.setActiveLayerId(be.getActiveLayerID()),ie.publish("restoreHight","")}addCommand(){if(!this.editPadNodeShape){let e=this.pad.createPreviewChildrens();hy.getInstance().getActiveToolId()==="EditPPadTool"&&(this.editHistory.beginSession(this.pcbPolygon,null,this.padDrillModels),this.pcbPolygon.setChildrens(e),this.editHistory.commit()),this.editPadNodeShape=!0}}};function fqe(o){let t=new Jt;return t.add("CANCEL",!0),t.addExtend("ROTATE",i1()),t.add("TURNOVER",!0),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t}var dpe=class extends fi{constructor(e,r,i=!0){super();this.item=null;this.isTestPad=!1;this.item=e,this.tool=r,this.isVia=i,e instanceof Le&&(this.isTestPad=!0)}open(e){let r;return this.item!=null?r={action:"attribute-for-place-ind-via",attrNet:this.item.net,netList:ze.getNet(),isTestPad:this.isTestPad}:r={action:"attribute-for-place-ind-via",attrNet:"",netList:ze.getNet(),isTestPad:this.isTestPad},this.isTestPad&&(r.title="Test Point Property"),r}modify(e){}close(e){if(e.action=="confirm"){let i=e.net;i==null&&(i=""),i=i.toUpperCase(),this.isVia&&(rt.defaultVia.net=i),this.item!=null&&this.item instanceof Ge&&(this.item.net=i,rt.setDefaultVia(this.item)),this.isTestPad&&(this.item.net=i,rt.setDefaultPad(this.item)),(this.tool instanceof cy||this.tool instanceof rO)&&this.tool.flushNear()}return!0}};var Vw=class Vw extends rO{constructor(){super(!0)}get mouseLeftUpInfo(){return this._mouseLeftUpInfo}set mouseLeftUpInfo(t){this._mouseLeftUpInfo=t}onKeyDown(t){switch(super.onKeyDown(t),t.keyCode){case 9:let e=this.getPad();if(e){let r=new dpe(e,this);A.publish("openDialog",r)}break}}onMouseMove(t){this.mouseLeftUpInfo||super.onMouseMove(t,this.initTestPad.bind(this))}parse(t){switch(super.parse(t),this.mouseLeftUpInfo=null,t.cmdKey.split(":")[0]){case"INHERIT_NET":this.setPadIsTestPad();break}}onMouseLeftUp(t){let e=this.getPad();if(!e)return;let r=new S(t.sceneX,t.sceneY);e.center=r;let i=new ib([e]);i.updateScene();let{netsGroupSet:n}=i.getNetPcbItems(t),s=[];for(let l of n)s.push(...Array.from(l.nets));let a=s.length;a===1?(e.net=s[0],super.onMouseLeftUp(t),this.setPadIsTestPad()):a>1?(this.showNetsMenu(t,s),this.mouseLeftUpInfo={...t}):(super.onMouseLeftUp(t),this.setPadIsTestPad())}cancel(){Vw.num--,super.cancel()}setPadIsTestPad(){let t=this.getPad();t.isTestPad=!0,C0(t.model),t.num="TP"+Vw.num,Vw.num++}rightClickMenuData2(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:kw(rt.defalutTestPad.layerId,t.adsorb,this,!0).result};Qt.getInstance().menuData(e,this),this.drawing=!1}initTestPad(){let t=this.getPad();t.isTestPad=!0,t.num="TP"+Vw.num,Vw.num++;let e=be.getActiveLayer(),r=[2,12].includes(e.layerID)?e.layerID:1;t.layerId=r,C0(t.model),rt.setDefaultTestPad(t)}};Vw.num=1;var RU=Vw;function ppe(o,t){let e=new Jt;e.add("CANCEL",!0),e.addExtend("ROTATE",i1());let r=!0,i=!0;return o.forEach(n=>{n instanceof fr||n instanceof Yn?i=!1:n instanceof Me?r=!1:(r=!1,i=!1)}),e.addExtend("FLIP",Ob()),e.add("TURNOVER",!0),e.add("toggleAdsorb",!1,t),e.add("ADSORBENT_CONFIG"),e}var Gw=class extends ci{constructor(e,r,i,n,s){super();this.items=new Set;this.alreadyRotate=!1;this.isMoveInOrder=!1;this.curItem=null;this.util=null;this.pcbPlaceTransfer=null;this.firstMove=!0;this.logger=new Gi(4);if(this.start(),this.option="OPTIONLEFTUP",this.isContinuousMode=n,e.items.length==1&&r=="MOVE_BY_CENTER_POINT"){let u=e.items[0],d=u.getParent();if((u instanceof Ge||u instanceof Le)&&d!=null&&d instanceof Me){let p=u.center;e.referX=p.x,e.referY=p.y,r="MOVE_BY_ORIGIN_POINT"}}this.menu=r,this.fac=i,this.itemsSortByDesignator=new Array,this.associationItem=new cl(e.items);let a=this.associationItem.items;this.associationItem.setUpConnectTrack();let l=this.associationItem.itemConnectTrack,c=new Array;switch(a.forEach(u=>{if(s.includes(u))return;u.click(),this.items.add(u),(e.items.includes(u)||!l.tracks.has(u.globalIndex))&&c.push(u),this.addFilterItem(u),this.fac.addCommand4Item(u,"modify")}),this.tool=new ep(c),this.tool.recordStyle(),this.associationItem.getAllRepairTracks().forEach(u=>{this.fac.addCommand4Item(u,"modify")}),r){case"MOVE_BY_CENTER_POINT":this.isMoveInOrder=!1,this.moveByCenterPoint();break;case"MOVE_BY_ORIGIN_POINT":case"MOVE_BY_REFERENCE_POINT":this.isMoveInOrder=!1,this.oldX=e.referX,this.oldY=e.referY,this.referX=e.referX,this.refery=e.referY,ie.publish("updateLastMousePosition",new S(this.oldX,this.oldY));let u=new S(Ma.x-this.oldX,Ma.y-this.oldY),d=Ae.translate(u.x,u.y,0);this.alreadyRotate||this.associationItem.moveConnectTrack(d),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(d),this.oldX=Ma.x,this.oldY=Ma.y;break;case"MOVE_SEQUENTIAL":this.isMoveInOrder=!0,a.forEach(p=>{p instanceof Me&&this.itemsSortByDesignator.push({des:p.name,item:p})}),this.moveInOrder();break}if(bd("move"),this.drawing=!0,this.items.size==1){let u=Array.from(this.items)[0];u instanceof Me&&(this.util=new UC(u))}ao.setTool(this),Yo.setTool(this),Ua.changeTool(this)}addFilterItem(e){this.filterItems.add(e),e instanceof Me&&e.getItems().forEach(r=>{this.filterItems.add(r)})}moveByCenterPoint(){if(!this.items.size)return;let e=new _e;this.items.forEach(a=>{e.ext1(a.buildBBox())});let i=e.build1().center();this.oldX=i.x,this.oldY=i.y,this.referX=i.x,this.refery=i.y,ie.publish("updateLastMousePosition",new S(this.oldX,this.oldY));let n=new S(Ma.x-this.oldX,Ma.y-this.oldY),s=Ae.translate(n.x,n.y,0);this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(s)),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(s),this.items.forEach(a=>{var l,c;a instanceof fr&&(Ve.highlightComponentWhenMoveText.add(a),a.updateHelpLine()),(c=(l=Pr.getControl())==null?void 0:l.flushPoint)==null||c.call(l)}),this.oldX=Ma.x,this.oldY=Ma.y}moveInOrder(){if(this.isMoveInOrder&&this.itemsSortByDesignator.length){this.logger.debug3("%s,%s","\u6392\u5E8F\u524D...",this.itemsSortByDesignator),this.itemsSortByDesignator.sort(this.sortRule),this.logger.debug3("%s,%s","\u6392\u5E8F\u540E...",this.itemsSortByDesignator),this.fac=new mi,this.fac.createGroup("move select for "+this.menu),this.setCurItem();let r=this.curItem.buildBBox().center();this.oldX=r.x,this.oldY=r.y}}setCurItem(){this.itemsSortByDesignator.length?(this.curItem=this.itemsSortByDesignator[0].item,this.associationItem=new cl([this.curItem]),this.util=new UC(this.curItem),this.fac.addCommand4Item(this.curItem,"modify")):this.curItem=null}sortRule(e,r){var i=/[^a-zA-Z]/g,n=/[^0-9]/g,s=parseInt(e.des,10),a=parseInt(r.des,10);if(isNaN(s)&&isNaN(a)){var l=e.des.replace(i,""),c=r.des.replace(i,"");if(l===c){var h=parseInt(e.des.replace(n,""),10),u=parseInt(r.des.replace(n,""),10);return h===u?0:h>u?1:-1}else return l===""?1:c===""?-1:l>c?1:-1}else return isNaN(s)?1:isNaN(a)?-1:s>a?1:-1}onKeyDown(e){let r=sr.getAction(2,e),i=new S(e.realSceneX,e.realSceneY);switch(r){case"Flip Right and Left":this.items.size&&Array.from(this.items).every(n=>n instanceof Me)?qf.flipComponent("Flip Right and Left",i,Array.from(this.items),this.fac.getCommand()):ie.publish("turn","turnAround");break;case"Flip Up and Down":this.items.size&&Array.from(this.items).every(n=>n instanceof Me)?qf.flipComponent("Flip Up and Down",i,Array.from(this.items),this.fac.getCommand()):ie.publish("turn","turnUpsideDown");break;case"Cancel":this.cancel();break;case"Rotate Left":this.rotate("rotate_left");break;case"rotate_right":this.rotate("rotate_right");break;case"flip2OppositeSide":J_(void 0,Array.from(this.items));break;case"Switch Selected Range When Object Is Selected":{ie.publish("openMainDialog",{cmd:48,data:{position:{x:this.referX,y:this.refery},tool:this}});break}}ie.publish("updateFrame","")}onMouseMove(e){this.fac&&this.drawing&&(this.isMoveInOrder?this.itemMovingInOrder(e):this.itemsMoving(e),this.firstMove&&(this.items.forEach(r=>{r instanceof fr&&Ve.highlightComponentWhenMoveText.add(r)}),this.firstMove=!1))}onMouseLeftUp(e){var r;this.fac&&((r=this.tool)==null||r.complete(),this.isMoveInOrder?this.itemMovedInOrderMouseUp(e):this.itemsMovedMouseUp(e),Ve.highlightComponentWhenMoveText.clear(),qf.clear())}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l}=e;if(a){dt.editingWhat=i;return}this.applyValue(e),l===13&&dt.destroy()}applyValue(e){let r=new ft,{value:i,type:n,startPoint:s,cursorPoint:a}=e,l=new S(a.x-s.x,a.y-s.y).normalize();i=r.conversion(x.getInstance().unit,"mil",i/10),l=new S(l.x*i,l.y*i);let c=new S(l.x+s.x,l.y+s.y),h=new S(c.x-a.x,c.y-a.y),u=Ae.translate(h.x,h.y,0);this.items.forEach(d=>{this.fac.addCommand4Item(d,"modify")}),this.tool.transform(u),this.itemsMovedMouseUp(null)}itemsMoving(e){this.placeTransferbeforeMoving(),this.moveTo(e.sceneX,e.sceneY)}moveTo(e,r){let i=new S(e-this.oldX,r-this.oldY),n=Ae.translate(i.x,i.y,0);if(this.util!=null&&!St.getInstance().currentCoord){let s=new S(e,r),a=this.util.getMatrix(s,s);n=n.multiply4(a)}this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(n)),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(n),this.tool.isMoveBox()||this.items.forEach(s=>{var a,l;(l=(a=Pr.getControl())==null?void 0:a.flushPoint)==null||l.call(a),s instanceof fr&&s.updateHelpLine()}),this.oldX=e,this.oldY=r}moveToCenterWhenOutOfFrame(){let e=_s(this.items).build(),r=ZR();e.isInside(r)||ie.publish("adaptBBox",{bbox:e,needAdaptAll:!1})}placeTransferbeforeMoving(){if(!this.pcbPlaceTransfer)return;let e=this.pcbPlaceTransfer.positionMap||[],r=[],i=10,n=new _e;if(e.forEach(d=>{let p=d.offset,m=Di.convert(p.x,d.unit,i),g=Di.convert(p.y,d.unit,i);r.push({uniqueId:d.uniqueId,x:m,y:g}),n.ext6(m,g)}),!n.valid())return;let s=new BD({sourcePositionMap:r,targets:Array.from(this.items),config:{autoSpace:Di.convert(.5,39.37,i),maxSpace:Di.convert(3,39.37,i),minSpace:0}}).getLayouts(),a=new _e,l=n.build1().center(),h=Ma.sub(l);if(s.forEach(d=>{let p=d.component,m=d.position.sub(p.position).add(h);return p.transform(Ae.translate(m.x,m.y,0)),a.ext1(d.bbox.transform(Qe.translate1(h))),!0}),!a.valid())return;let u=a.build1().center();this.oldX=u.x,this.oldY=u.y,this.setPcbPlaceTransfer(null)}itemsMovedMouseUp(e){this.associationItem.complete(this.fac.getCommand()),this.fac.checkOutlines(Array.from(this.items),new Set),this.fac=new mi,this.fac.createGroup("move select for "+this.menu),bd("default");let r=new Array;this.items.forEach(i=>{r.push(i),ie.publish("hasModifyPcbItem",i)}),ie.publish("select",r),this.toggle(),ie.publish("flushService","")}itemMovingInOrder(e){if(this.curItem){let r=new S(e.sceneX-this.oldX,e.sceneY-this.oldY),i=Ae.translate(r.x,r.y,0);if(this.util!=null&&!St.getInstance().currentCoord){let n=new S(e.sceneX,e.sceneY),s=this.util.getMatrix(n,n);i=i.multiply4(s)}this.curItem.transform(i),this.curItem instanceof fr&&this.curItem.updateHelpLine(),this.oldX=e.sceneX,this.oldY=e.sceneY}}itemMovedInOrderMouseUp(e){if(this.curItem)if(this.fac.checkOutlines([this.curItem],new Set),ie.publish("hasModifyPcbItem",this.curItem),this.itemsSortByDesignator.length>1){this.itemsSortByDesignator.splice(0,1),ie.publish("refreshTearDrop",""),this.fac=new mi,this.fac.createGroup("move select for "+this.menu),this.setCurItem();let i=this.curItem.buildBBox().center();this.oldX=i.x,this.oldY=i.y,ie.publish("flushService","")}else{this.itemsSortByDesignator.splice(0,1),this.fac=new mi,this.fac.createGroup("move select for "+this.menu),this.setCurItem(),bd("default");let r=new Array;this.items.forEach(i=>{r.push(i)}),this.isMoveInOrder=!1,this.drawing=!1,ie.publish("select",r),this.toggle(),ie.publish("flushService","")}}interrupt(){var e;if(this.items.size>0){(e=this.tool)==null||e.cancel(),this.associationItem.interrupt();let r=new Array;this.items.forEach(i=>{r.push(i)}),this.tool.isMoveBox()||this.fac.undo(),setTimeout(()=>{let i=r.filter(n=>n.isEmpty?!1:(n.click(),!0));ie.publish("select",i),ie.publish("updateFrame","")},10),this.items.clear(),this.drawing=!1,this.fac=new mi,this.fac.createGroup("move select for "+this.menu),dt.destroy(),bd("default")}ao.setTool(null),this.end()}cancel(){this.interrupt(),this.toggle()}toggle(){this.isContinuousMode&&(this.menu=="MOVE_BY_CENTER_POINT"||this.menu=="MOVE_BY_ORIGIN_POINT"||this.menu=="MOVE_BY_REFERENCE_POINT")?ie.publish("toggle",{command:"MouseSelect",cmd:this.menu}):ie.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:ppe(this.items,e.adsorb).result};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"ROTATE":this.rotate(i[1]);break;case"FLIP":this.flip(i[1]);break;case"TURNOVER":this.flip2OppositeLayer();break;case"toggleAdsorb":ie.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":ie.publish("openSystemDialog","ADSORPTION",$());break}ie.publish("updateFrame","")}rotate(e){if(e==="rotate_left"){this.rotateFor(this.oldX,this.oldY,ce.pcbConfig.rotate);let r=new S(this.oldX,this.oldY),i=this.curItem?[this.curItem]:this.items;this.curItem?ao.rotate(r,ce.pcbConfig.rotate,i):this.tool.rotateFor(r,ce.pcbConfig.rotate)}if(e==="rotate_right"){this.rotateFor(this.oldX,this.oldY,-ce.pcbConfig.rotate);let r=new S(this.oldX,this.oldY),i=this.curItem?[this.curItem]:this.items;this.curItem?ao.rotate(r,-ce.pcbConfig.rotate,i):this.tool.rotateFor(r,-ce.pcbConfig.rotate)}if(e==="rotate_reference_point"){this.rotateReferPointCallback=(n,s,a,l)=>{this.rotateReferPointCallback=null},this.rotateFor(this.oldX,this.oldY,ce.pcbConfig.rotate);let r=this.curItem?[this.curItem]:this.items,i={x:this.oldX,y:this.oldY,items:this.tool,executeCommand:!1};ao.rotateAssignReferPoint(i,this,null,null,this.rotateReferPointCallback.bind(this))}}flip2OppositeLayer(){!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype||ls.getInstance().init(this.items,"flip to OppositeLayer",(e,r)=>{let i=!1;for(let n of e)n instanceof Me&&(r.addCommand4Item(n,"modify"),Io(n.layerId)?n.layerId=2:n.layerId=1,n.click(),i=!0);i&&r.execute()})}flip(e){var r;switch(Yo.setTool(this),(r=this.tool)==null||r.sycn(),e){case"FLIP_LEFTANDRIGHT":Yo.turn(this.items,!1,!1,new S(this.oldX,this.oldY));break;case"FLIP_UPANDDOWN":Yo.turn(this.items,!0,!1,new S(this.oldX,this.oldY));break;case"FLIP_LEFTANDRIGHT_BY_REFER_POINT":{let i={items:this.items};Yo.turnByReferPoint(i,this);break}case"FLIP_UPANDDOWN_BY_REFER_POINT":{let i={items:this.items,isTurnUpsideDown:!0};Yo.turnByReferPoint(i,this);break}}}setCenter(e,r){this.oldX=e,this.oldY=r}rotateFor(e,r,i){let n=Ae.translate(-e,-r,0).rotateZ(i).translate1(e,r,0);this.alreadyRotate=!0,this.associationItem.interrupt(),this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(n))}setPcbPlaceTransfer(e){this.pcbPlaceTransfer=e||null}};var LN=class extends ko{constructor(e,r,i,n,s){super();this.status=0;Mn.getInstance().allowPull=!1,this.oldToolDrawing=r,this.drawing=!0,this.tool=e,this.lastTool=i,this.positiveMsg="Please select a positive network",this.negativeMsg="Please select a negative network",this.name=n.differentailPairName,this.positiveNet=n.differentailPairPositiveNet,this.negativeNet=n.differentailPairNegativeNet,this.netOptions=n.netOptions,this.differentailPairList=n.differentailPairList,this.isEdit=n.isEdit,this.fromRule=n.fromRule,this.status=s=="positive"?0:1,this.oldData=n.oldData}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break}A.publish("updateFrame","")}onEnterPlace(e){this.onMouseLeftUp(e)}onMouseMove(e){let r=this.status===0?this.positiveMsg:this.negativeMsg;jt.update(e,r),this.isRightMouseMove=!0}onMouseLeftUp(e){if(this.drawing){let r=Ve.getSelects(),i=Wr.selectNet(e.sceneX,e.sceneY);this.selectItems=r;let n=!1;r!==null&&(this.netsGroupSet=this.getNearNetPcbItems(i,e.sceneX,e.sceneY),n=this.handleNets(e,r)),n&&this.successEvent()}}successEvent(){let e=[];te.getInstance().getAllNets().forEach(r=>{r.name&&e.push({value:r.name,text:r.name})}),this.status===0?this.handleMatchData(e,"pos"):this.handleMatchData(e,"neg"),this.differentailPairList.forEach(r=>{r.name==this.name&&(r.sub[0]?r.sub[0].name=this.positiveNet:r.sub.unshift({"Differential Pair":"default",name:this.positiveNet,type:"net"}),r.sub[1]?r.sub[1].name=this.negativeNet:r.sub.push({"Differential Pair":"default",name:this.negativeNet,type:"net"}))}),this.interrupt(),A.publish("openDifferentailDialog",{name:this.name,positiveNet:this.positiveNet,negativeNet:this.negativeNet,diffPairList:this.differentailPairList,netOptions:this.netOptions,isEdit:this.isEdit,fromRule:this.fromRule,oldData:this.oldData},$())}getNearNetPcbItems(e,r,i){let n=new Set,s=new Set,a=new Set;return e.forEach(l=>{let c=l.net;if(l instanceof Ye&&l.type=="Copper Region"){let h=!1;if(l.iteratorCopper(u=>{h||u.inCopper(r,i)&&u.isVisible&&(h=!0)}),!h)return}c&&(a.add(l),s.add(c))}),n.add({group:a,nets:s}),n}handleNets(e,r){let i=!1;return this.nets=new Set,this.netsGroupSet.forEach(n=>{this.nets=n.nets}),this.nets.size?this.nets.size===1?(this.nets.forEach(n=>{this.updateNetwork(n,r)}),i=!0):(jt.cancel(),this.showNetsMenu(e)):i=!1,i}showNetsMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=this.getNetsMenuData().result,Qt.getInstance().menuData(r,this),this.drawing=!1}getNetsMenuData(){let e=new Jt,r="INHERIT_NET:";return this.nets.forEach(i=>{if(i){let n={name:i,cmd:`${r+i}`,tips:"",option:{disabledI18n:!0}};e.addObj(n,!1,!1)}}),e}handleMatchData(e,r){let i=["_P","_N","+","-"],n=r=="pos"?this.positiveNet:this.negativeNet,s=i.find(l=>n.endsWith(l));if(!(r=="pos"?this.negativeNet:this.positiveNet)&&s){let l={_P:"_N",_N:"_P","+":"-","-":"+"};this.matchDiffPair({allNets:e,suffix:l[s],val:n,type:r})}}extractCommonPart(e,r){let i=e.lastIndexOf(r);return i===-1?null:e.substring(0,i)}matchDiffPair(e){var c;let r=e.val,i=["_P","_N","+","-"],n=null,s=null;for(let h of i)if(r.endsWith(h)){n=h,s=e.suffix;break}if(!n||!s)return;let a=this.extractCommonPart(r,n);if(a===null)return;let l=(c=e.allNets.find(h=>{let u=h.value;return u.endsWith(s)?this.extractCommonPart(u,s)===a:!1}))==null?void 0:c.value;l&&(e.type=="pos"?this.negativeNet=l:this.positiveNet=l)}updateNetwork(e,r){if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let i=this.differentailPairList.find(n=>{var s,a;return n.name!==this.name&&(((s=n.sub[0])==null?void 0:s.name)==e||((a=n.sub[1])==null?void 0:a.name)==e)});return i?(A.publish("showPcbSlideMsg",["The network {0} already exists in the Differentail-pair {1}, Unable to added success.",[e,i.name]],$()),!1):(A.publish("flushService",""),A.publish("flushSelectingInfo",""),this.status===0?this.positiveNet=e:this.status===1&&(this.negativeNet=e),!0)}checkConnect(e){let r=e.searchNode();for(let i of r)if(i instanceof Ue)return!0;return!1}interrupt(){this.drawing=!1,this.tool.setNextTool(this.lastTool),this.lastTool instanceof Vo&&this.lastTool.getWireMode()=="Differential pair wiring"&&we.setCommand("draw(difftrack)"),yi.resetLastScene(),this.tool.drawing=this.oldToolDrawing,jt.cancel(),Mn.getInstance().allowPull=!0}cancel(){this.interrupt(),A.publish("cancelDifferentailSelect","",$()),A.publish("tool","dropdrag")}onMouseRightDown(e){this.isRightMouseMove=!1}onMouseRightUp(e){if(ce.pcbConfig.endDrawing=="ctrl+rightClick"){if(!e.ctrlKey){this.rightClickMenuData(e);return}}else if(e.ctrlKey){this.rightClickMenuData(e);return}this.isRightMouseMove||(this.interrupt(),A.publish("openDifferentailDialog",{name:this.name,positiveNet:this.positiveNet,negativeNet:this.negativeNet,diffPairList:this.differentailPairList,netOptions:this.netOptions,isEdit:this.isEdit,oldData:this.oldData},$()))}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel(),A.publish("openDifferentailDialog",{name:this.name,positiveNet:this.positiveNet,negativeNet:this.negativeNet,diffPairList:this.differentailPairList,netOptions:this.netOptions,isEdit:this.isEdit,oldData:this.oldData},$());break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"INHERIT_NET":this.updateNetwork(i[1],this.selectItems),this.successEvent();break}A.publish("updateFrame","")}};var fpe=class o extends Sr{constructor(e,r){super(e);this.isBase=!0;super.color=r,this.sendDeleteMsg=!1}static build(e,r,i,n,s,a=ee.BLACK){s=qu(s,e),r=sg(e,r,0);let l=new $p(su(),e,r,i,n,s,!1,"",null,null);return new o(l,a)}setBBoxModify(){}setLayerModify(e){}};var DU=class extends ci{set circle(t){this.filterItems.clear(),this._circle=t}get circle(){return this._circle}constructor(){super(),this.option="OPTIONLEFTUP",this.setCircle(),Ua.changeTool(this),this.start()}onKeyDown(t){switch(sr.getAction(4,t)){case"Cancel":this.cancel();break}A.publish("updateFrame","")}onMouseLeftUp(t){this.place()}place(){if(this.circle){if(!Bt.checkIsInCanEdit(this.circle)){let r="beyond drawing range";Bt.showMassageTip(r,r);return}let t=new ve("draw screw pillar"),e=Zt.addCircle("3D Shell - Screw Pillar",this.circle.layerId,this.circle.center,this.circle.radius,this.circle.strokeWidth,!1,"");e.partition=x.getInstance().partitionId,e.layerId===54&&(e.strokeWidth=1,e.fill()),t.addCommand(Te.dispatch(e,"add")),je.executeCommand(t),A.publish("onlySelect",[e]),this.drawing=!0,A.publish("updateRtree",""),this.setCircle(),A.publish("updateFrame","")}}applyInputAtCursorValue(t){let{value:e,type:r,locked:i,unlocked:n,editing:s,keyCode:a,startPoint:l}=t;if(s){dt.editingWhat=r;return}this.applyValue(t),a===13&&dt.destroy()}applyValue(t){let{value:e,type:r,startPoint:i,cursorPoint:n}=t,s=new ft,a,l;if(e=s.conversion(x.getInstance().unit,"mil",e/10),dt.id==="adsorption"){let c=new S(n.x-i.x,n.y-i.y).normalize();c=new S(c.x*e,c.y*e);let h=new S(c.x+i.x,c.y+i.y);this.circle.center=h,this.place(),A.publish("updateFrame","")}}onMouseMove(t){this.circle!=null&&this.drawing&&(this.circle.visible(),this.circle.removeFill(),this.circle.center=new S(t.sceneX,t.sceneY))}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:vo(t.adsorb)};Qt.getInstance().menuData(e,this)}interrupt(){this.circle!=null&&(this.circle.remove(),this.circle=null,this.drawing=!1,A.publish("updateRtree","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}parse(t){switch(t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}setCircle(){if(this.circle==null){let t=new S(0,0),e=be.getActiveLayerID(),r=e!==55,{specification:i}=Tm.d3ShellScrewPillarComponent,n=Tx[i],a=(r?n.screwheadDiameter:n.holeDiameterWithoutSpigot)/2;this.circle=fpe.build("3D Shell - Screw Pillar",e,t,a,1),this.circle.hidden()}}toggleLayer(t){this.circle.layerId!==t&&[this.circle.layerId,t].includes(55)&&(this.interrupt(),this.drawing=!0,this.setCircle())}};var wU=class extends ci{constructor(){super();this.started=!1;this.option="OPTIONLEFTUP",Ua.changeTool(this)}set line(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._line=e}get line(){return this._line}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);this.line==null?this.startDraw(r):this.endDraw()}startDraw(e){if(!Bt.checkIsCanEditByPoint(e))return;this.start();let r=be.getActiveLayerID(),n=new io().addLine(e,e,r);this.line=pt.addPolygon("3D Shell - Side Datum Line",r,[[n]],1,"",!1),this.drawing=!0,this.started=!0}endDraw(){this.line.partition=x.getInstance().partitionId,A.publish("onlySelect",[this.line]);let e=new ve("draw datum line");e.addCommand(Te.dispatch(this.line,"add")),je.executeCommand(e),this.line=null,this.drawing=!0,this.started=!1,A.publish("updateRtree",""),this.end()}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l,startPoint:c}=e;if(a){dt.editingWhat=i;return}this.applyValue(e),l===13&&dt.destroy()}applyValue(e){let{value:r,type:i,startPoint:n,cursorPoint:s}=e,a=new ft,l,c;if(r=a.conversion(x.getInstance().unit,"mil",r/10),dt.id==="adsorption"){let h=new S(s.x-n.x,s.y-n.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+n.x,h.y+n.y);this.started?(this.line.getChildrens()[0][0].end=u,this.end()):this.startDraw(u),A.publish("updateFrame","")}}onMouseMove(e){this.line!=null&&this.drawing&&(this.line.getChildrens()[0][0].end=new S(e.sceneX,e.sceneY))}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this)}interrupt(){this.line!=null&&(this.line.remove(),A.publish("delete",this.line),this.line=null,this.drawing=!1,this.started=!1,A.publish("updateRtree","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var z$=class z$ extends ci{constructor(e,r,i){super();this.addHistory=!0;this.mouseLeftDown=!1;this.isTrack=!1;this.track=null;this.trackIdentify=null;this.connectNodes=new Array;this.isConnectStart=!1;this.lockedAfter=!1;if(this.start(),this.option="OPTIONLEFTUP",Ua.changeTool(this),this._ready=!0,this.drawing=!0,this.mouseLeftDown=!1,e?this.commands=e:this.commands=new ve("move outline"),this.filterItems.clear(),this.updateFilterItems(r),i&&(i!=null&&i.track)){this.track=i.track;let s=new Nu(this.track);i.selectType===0&&(this.connectNodes=s.startNodes),i.selectType===1&&(this.connectNodes=s.endNodes),this.trackIdentify=s,this.isConnectStart=i.selectType===0;let a=this.isConnectStart?this.trackIdentify.startNodes[0]:this.trackIdentify.endNodes[0];if(a instanceof Le&&i.controlPoint){let l=new S(i.controlPoint.x,i.controlPoint.y),c=this.addPoint(()=>this.track.layerId,l);c.click(),this.trackControlPoint=c}else this.trackControlPoint=i.controlPoint;if(i.track instanceof Si&&i.midPoint)if(a instanceof Le){let l=new S(i.midPoint.x,i.midPoint.y),c=this.addPoint(()=>this.track.layerId,l);c.click(),this.midPoint=c}else this.midPoint=i.midPoint}i!=null&&i.locked&&(this.filterItems.forEach(s=>s.locked=!1),this.lockedAfter=!0);let n=!1;this.filterItems.forEach(s=>{s instanceof Ue&&(n=!0)}),this.isTrack=n}get _ready(){return z$.ready}set _ready(e){z$.ready=e}updateFilterItems(e){e!=null&&e.forEach(r=>{this.filterItems.add(r)})}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l,startPoint:c}=e;if(a){dt.editingWhat=i;return}this.applyValue(e),l===13&&dt.destroy()}applyValue(e){let{value:r,type:i,startPoint:n,cursorPoint:s}=e,a=new ft,l,c;if(r=a.conversion(x.getInstance().unit,"mil",r/10),dt.id==="adsorption"){let h=new S(s.x-n.x,s.y-n.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+n.x,h.y+n.y);this.inputInfo.sceneX=u.x,this.inputInfo.sceneY=u.y,this.onMouseMove(this.inputInfo),this.onMouseLeftUp(this.inputInfo),A.publish("updateFrame","")}}onMouseLeftDown(e){this.mouseLeftDown||(this.mouseLeftDown=!0,Ve.onMouseLeftDown(e))}onMouseLeftUp(e){this._ready&&(this.isTrack||(Pr.onMouseMove(e),Pr.onMouseLeftUp(e)),this.completed(),this.commands.length&&je.executeCommand(this.commands))}checkIntersection(){let e=Ve.getSelects();for(let r of e)if(r instanceof Ye){if(No(r.getMathGraphics(r.layerId,0)))return!0}else if(r instanceof mt||r instanceof vt){let i=r.getParent();if(i instanceof Ye&&No(i.getMathGraphics(i.layerId,0)))return!0}return!1}onMouseRightDown(e){Ve.onMouseRightDown(e)}onMouseRightUp(e){if(this._ready&&e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}onMouseMove(e){if(!this._ready)return;this.inputInfo=e;let r=new S(e.sceneX,e.sceneY);if(this.isTrack){let i=this.isConnectStart?this.trackIdentify.startType:this.trackIdentify.endType,n=i===0?null:this.isConnectStart?this.trackIdentify.startNodes[0]:this.trackIdentify.endNodes[0];if(this.addHistory&&(this.commands.addCommand(Te.dispatch(this.track,"modify")),n&&this.commands.addCommand(Te.dispatch(n,"modify")),this.addHistory=!1),n)switch(i){case 5:n.start=r;break;case 6:n.end=r;break;case 7:n.start=r;break;case 8:n.end=r;break}this.isConnectStart?this.track.start=r:this.track.end=r,this.trackControlPoint.setPosition(r),this.track instanceof Si&&this.midPoint.setPosition(this.track.midPoint)}else Ve.onMouseMove(e)}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":{this.interrupt();break}case"Finish":{this.onMouseLeftUp(e);break}}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this)}interrupt(){var e,r;this.drawing=!1,this._ready=!1,(e=this.trackControlPoint)==null||e.remove(),(r=this.midPoint)==null||r.remove(),this.commands.length&&(this.commands.undo(),this.commands.commands.length=0),A.publish("tool","dropdrag"),this.lockedAfter&&(this.lockedAfter=!1,this.filterItems.forEach(i=>i.locked=!0)),Ve.exitLeftDown(),Pr.model=0,this.end()}completed(){var e,r;dt.destroy(),this.drawing=!1,this._ready=!1,(e=this.trackControlPoint)==null||e.remove(),(r=this.midPoint)==null||r.remove(),Ve.exitLeftDown(),this.commands.commands.length&&je.executeCommand(this.commands),this.commands=new ve("move outline"),A.publish("tool","dropdrag"),Pr.model=0,this.end()}addPoint(e,r){return new qi(e(),r)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}cancel(){dt.destroy(),this.interrupt()}};z$.ready=!1;var LU=z$;var EAe=class{toggleAllStateLoop(){let t=!0,e=ga.getInstance();e.padShowNet&&e.padShowNum&&e.trackShowNet&&e.viaShowNet&&e.viaShowPair?t=!1:t=!0,(e.padShowNum!=t||e.padShowNet!=t)&&(e.padShowNet=t,e.padShowNum=t,this.padFlushNumNet()),e.trackShowNet!=t&&(e.trackShowNet=t,this.trackFlushNet());let r=!1;e.viaShowNet!=t&&(e.viaShowNet=t,this.viaFlushNet(),r=!0),e.viaShowPair!=t&&(e.viaShowPair=t,!r&&this.viaFlushNet()),A.publish("updateFrame","")}padFlushNumNet(){Kt.getAllItem().forEach(t=>{t.refreshRender()})}trackFlushNet(){pr.getAllItem().forEach(t=>{t.refreshRender()})}viaFlushNet(){Hr.getAllItem().forEach(t=>{t.refreshRender()})}},Uw=new EAe;function Y$(o){let t=te.getInstance().getPadsPairGroupItemByGroupName(o);x.getInstance().compiler.uploadEQLenGrp(t.number,or.getInstance().encode("EQLEN_GRP",t))}function j$(o){x.getInstance().compiler.deleteEQLenGrp(o)}function eI(o,t={},e={},r=[],i=[],n="",s=""){var d;let a=o.includes("net-class"),l;for(let p of r)a?te.getInstance().renameNetClass(p.oldName,p.newName):te.getInstance().renameEqualLengthGroup(p.oldName,p.newName);let c=Object.keys(t),u=Object.keys(e).filter(p=>{let m=!c.includes(p),g=r.find(y=>y.oldName==p);if(m&&!g)return!0});if(u)for(let p of u)if(a){let m=te.getInstance().getNetClass(p).getAllNets().map(g=>g.name);l=te.getInstance().deleteNetClass(p);for(let g of m)Ql(g);x.getInstance().compiler.deleteRuleSelector(["NET_CLASS",p])}else{let m=te.getInstance().getEqualLengthGroup(p).getAllNets().map(g=>g.name);l=te.getInstance().deleteEqualLengthGroup(p);for(let g of m)Ql(g);x.getInstance().compiler.deleteRuleSelector(["EQ_LEN_GRP",p])}for(let p in t)if(Object.prototype.hasOwnProperty.call(t,p)){let m=t[p];a?l=te.getInstance().getNetClass(p)||te.getInstance().addNetClass(p):l=te.getInstance().getEqualLengthGroup(p)||te.getInstance().addEqualLengthGroup(p),m.forEach(y=>{let b=te.getInstance().getNet(y==null?void 0:y.toUpperCase());if(a){if(b.netClass==l)return}else if(b.equalLengthGroup==l)return;a?b.netClass&&(b.netClass.removeNetwork(b.name),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",b.netClass))):b.equalLengthGroup&&(b.equalLengthGroup.removeNetwork(b.name),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",b.equalLengthGroup)));let P=a?["safeSpacing","trackPhysics","differentailPhysics","blindViaPhysics","radiusPhysics","innerPlane","copperPlane","solderExpansion","pasteExpansion"]:["netLengthPhysics","netLengthTolerancePhysics"];for(let T of P)b[T]=l[T];x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",b)),a?l.addNetwork(b):l.addEqualLengthGroup(b),Ql(b.name)});let g=[];g=(d=e[p])==null?void 0:d.filter(y=>!m.includes(y)),g==null||g.forEach(y=>{l.removeNetwork(y);let b=te.getInstance().getNet(y);RDt(b,a),Ql(y)}),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",l))}return A.publish("forceRenderTree",a?tn.NetClasses:tn.EqualLengthGroups,$()),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),!0}function RDt(o,t){(t?["blindViaPhysics","copperPlane","pasteExpansion","innerPlane","safeSpacing","solderExpansion","trackPhysics","radiusPhysics"]:["netLengthPhysics","netLengthTolerancePhysics"]).forEach(r=>{o[r]="default"})}function Hw(o){let t=te.getInstance(),e=!1;return o.forEach(r=>{var n;let i=(n=t.getPadsPairGroupItemByGroupName(r.oldGroupName))==null?void 0:n.number;switch(r.action){case"CREATED":{e=!0;let s=new Array;for(let a of r.details){let l=rg.createPadItemShowTitle(a.pad1),c=rg.createPadItemShowTitle(a.pad2),h=new rg(l,c);s.push(h)}t.addPadsPairGroup(r.groupName,s),Y$(r.groupName);break}case"UPDATED":{e=!0;let s=new Array;for(let a of r.details){let l=rg.createPadItemShowTitle(a.pad1),c=rg.createPadItemShowTitle(a.pad2),h=new rg(l,c);s.push(h)}t.deletePadsPairGroup(r.oldGroupName),j$(i),t.addPadsPairGroup(r.groupName,s),Y$(r.groupName);break}case"DELETED":{e=!0,t.deletePadsPairGroup(r.oldGroupName),j$(i);break}default:}}),A.publish("forceRenderTree",tn.PadsPairGroups,$()),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),e}function mqe(){return Kt.getAllItem().map(t=>{let e=t.getParent();return{id:t.globalIndex,text:`${ur}${t.number}`,designator:e?e.designator||`${ur}${e.number}`:"",isDissociate:!e,number:t.num||"",nets:[t.net],belongDeiviceId:(e==null?void 0:e.globalIndex)||""}})}function nO(){return te.getInstance().getAllPadsPairGroupsInstances().map(e=>({groupName:e.groupName,oldGroupName:e.groupName,action:"UNCHANGED",details:e.toJSON_ofDeatails()}))}var mpe=class extends fi{constructor(t={},e){super(),this.option=t,this.tool=e}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let{selectedGroupName:e,isSettingAdding:r,isSettingEditing:i}=t,n=t.canvasReturnData||{},s=mqe(),a=this.createAllNetsParams(),l=nO(),c=n.selectedPadItem;n&&delete n.selectedPadItem;let h={action:"edit-pads-group",allPads:s,allNets:a,allGroups:l,isSettingAdding:!!r||!1,isSettingEditing:!!i||!1,selectedGroupName:e||(l.length?l[0].groupName:""),selectedNet:"",selectedPad1:"",selectedPad2:"",triggerBtn:"",...n||{}};return Object.keys(n).length&&(c&&(n.triggerBtn==="pad1-select-btn"&&(h.selectedPad1=c.globalIndex),n.triggerBtn==="pad2-select-btn"&&(h.selectedPad2=c.globalIndex),h.selectedNet=c.net||"Null network"),h.isSettingAdding=!1,h.isSettingEditing=!1),h}modify(t){if(!(!x.getInstance().isactive||23==x.getInstance().doctype))return this.handleModify(t)}close(t){if(!(!x.getInstance().isactive||23==x.getInstance().doctype))return this.handleModify(t)}flush(){A.publish("forceRenderTree",tn.PadsPairGroups,$()),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}handleModify(t){let{action:e,allGroups:r}=t,i=!1;return(e==="confirm"||e==="apply")&&(i=Hw(r),i&&this.flush()),!0}createAllNetsParams(){return ze.getAllNets()}};var MU=class extends ko{constructor(e,r,i,n){super();this.selectNets=new Array;this.drawing=!0,this.tool=e,this.lastTool=i,this.formData=n,this.cursorMessage="Please select a pad",this.oldToolDrawing=r,this.isRightMouseMove=!1,this.lastHightLightPad=[];let s=this.formData.selectedNet;s!="All nets"&&(s=="Null network"&&(s=""),ze.highlightNet(s,!0,!0),this.selectNets.push(s))}onMouseMove(e){jt.update(e,this.cursorMessage),this.isRightMouseMove=!0,this.clear();let r=Array.from($t.filterElement(Wr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).getResult(dm))),i=[];if(this.formData.selectedNet!=="All nets")for(let n of r)n instanceof Le&&(this.formData.selectedNet=="Null network"?n.net=="":n.net===this.formData.selectedNet)&&i.push(n);else for(let n of r)n instanceof Le&&i.push(n);if(i.length>0){let n=i[0];n.click(),this.lastHightLightPad.push(n)}}onMouseLeftUp(e){if(this.drawing){let r=Ve.getSelects(),i=Array.from($t.filterElement(Wr.selectPad(e.sceneX,e.sceneY)));if(this.formData.selectedNet==="All nets"){if(i.length){this.cancel(),this.clear(),this.openSourceDialog(i);return}this.clear();return}let n=i.filter(a=>this.formData.selectedNet=="Null network"?a.net=="":a.net===this.formData.selectedNet),s=n.filter(a=>{let l=!0;return this.formData.triggerBtn&&(this.formData.triggerBtn=="pad1-select-btn"?l=a.globalIndex!==this.formData.selectedPad2:this.formData.triggerBtn=="pad2-select-btn"&&(l=a.globalIndex!==this.formData.selectedPad1)),l});if(s.length==0&&n.length>0&&A.publish("ui/toastMsg",{type:"warn",msg:"Pad1 is the same as pad2, please re-select!"},$()),s.length){this.cancel(),this.clear(),this.openSourceDialog(s);return}this.clear()}}onMouseRightDown(e){this.isRightMouseMove=!1}onMouseRightUp(e){if(ce.pcbConfig.endDrawing=="ctrl+rightClick"){if(!e.ctrlKey){this.rightClickMenuData(e),this.isRightMouseMove=!1;return}}else if(e.ctrlKey){this.rightClickMenuData(e),this.isRightMouseMove=!1;return}this.isRightMouseMove||(this.interrupt(),this.openSourceDialog())}interrupt(){this.drawing=!1,this.tool.setNextTool(this.lastTool),yi.resetLastScene(),this.tool.drawing=this.oldToolDrawing;for(let e of this.selectNets)ze.unhighlightNet(e,!0);jt.cancel()}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel(),this.openSourceDialog();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}rightClickMenuData(e){if(this.isRightMouseMove)return;let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}cancel(){this.interrupt(),A.publish("tool","dropdrag")}openSourceDialog(e=[]){let r=e[0]||null;if(e.length>1){let i=e.find(n=>n.layerId==be.getActiveLayerID());i&&(r=i)}A.publish("EditPadsPairGroupDialog",{canvasReturnData:{...this.formData,selectedPadItem:r}})}clear(){for(let e of this.lastHightLightPad)e.visible();this.lastHightLightPad.length=0}};var tI=class o{constructor(t){this.matchList=new Array;this.allUse=!1;this.templateInfo=t}classify4Group(){let t=Qp(r=>r.groupId,this.matchList),e={};for(let[r,i]of t){let n=new o(this.templateInfo);e[r]=n,Re.addAll(n.matchList,i)}return e}classify4Channel(){let t=Qp(r=>r.channelId,this.matchList),e=new o(this.templateInfo);for(let[r,i]of t)(r==""||r==this.templateInfo.channelId)&&Re.addAll(e.matchList,i);return e.sortMatchList(),e}sortMatchList(){xr(this.matchList,(t,e)=>{let r=t.channelId!=""&&t.channelId==this.templateInfo.channelId,i=e.channelId!=""&&t.channelId==this.templateInfo.channelId;return r&&i||r&&!i?-1:!r&&i?1:0},0,this.matchList.length)}getIdMaps(t,e){let r=this.matchList[t],i=this.templateInfo.component.getPads(),n=r.component.getPads(),s=new Set;for(let c of i)for(let h of n)!s.has(h)&&c.num==h.num&&(e[c.globalIndex]=h.globalIndex,s.add(h));let a=this.templateInfo.component.getVias(),l=r.component.getVias();for(let c of a){let h=c.globalIndex.replace(this.templateInfo.component.globalIndex,"");for(let u of l){let d=u.globalIndex.replace(r.component.globalIndex,"");!s.has(u)&&h==d&&(e[c.globalIndex]=u.globalIndex,s.add(u))}}}};var qC=class{constructor(t){this.groupId="";this.channelId="";this.netMapNums={};this.id=t.globalIndex,this.uuid=t.footprintUUID;let e=Wi.getInstance().getItem(this.uuid);e instanceof Xc&&(this.uuid=e.source),this.component=t,this.groupId=t.combinationID,this.channelId=t.channelID;let r=t.getPads();for(let i of r){let n=i.num,s=i.net,a=this.netMapNums[s];a==null&&(a=new Array,this.netMapNums[s]=a),a.push(n)}this.sort()}sort(){for(let t in this.netMapNums){let e=this.netMapNums[t];xr(e,(r,i)=>r<i?-1:r==i?0:1,0,e.length)}}isMatch(t,e){if(this.component.attrsMap.Footprint.toUpperCase()===t.component.attrsMap.Footprint.toUpperCase()){let r=Object.keys(this.netMapNums),i=Object.keys(t.netMapNums);if(r.length==i.length){let n=new Set,s=!0;for(let a in this.netMapNums){let l=this.netMapNums[a],c=!1;for(let h in t.netMapNums){if(n.has(h))continue;let u=t.netMapNums[h];if(l.length==u.length){let d=!0;for(let p=0;p<l.length;p++)l[p]!=u[p]&&(d=!1);if(d){n.add(h),c=!0;break}}}c||(s=!1)}if(s)return!0;{let a=`template(${this.id}) and reuses(${t.id} are the same numbered pin n network does not match `;e.push(a)}}else{let n=`template(${this.id}) has ${r.length} nets,reuses(${t.id}) has ${i.length}  nets,the number of them is not match `;e.push(n)}}return!1}matchNums(t,e){if(t.length==e.length){let r=!0;for(let i=0;i<t.length;i++)t[i]!=e[i]&&(r=!1);return r}return!1}getNetMatchList(t){let e=new Map,r=new Set;for(let i in this.netMapNums){let n=this.netMapNums[i];for(let s in t.netMapNums){if(r.has(s))continue;let a=t.netMapNums[s];this.matchNums(n,a)&&(e.set(i,s),r.add(s))}}return e}getAllNets(){let t=[];for(let e in this.netMapNums)t.push(e);return t}};var oO=class o{constructor(t){this.reuseMap=new Array;this.netMaps=t}classify4GroupId(t){let e={};for(let i of t){let n=i.classify4Group();for(let s in n){let a=e[s];a==null&&(a=new Array,e[s]=a);let l=n[s];a.push(l)}}let r={};for(let i in e){let n=e[i];if(n.length==t.length){let s=new o(new Map);for(let[a,l]of this.netMaps)s.netMaps.set(a,l);Re.addAll(s.reuseMap,n),r[i]=s}}return r}classify4Group(){let t=Qp(a=>a.templateInfo.groupId,this.reuseMap),e={};for(let[a,l]of t){let c=this.classify4GroupId(l);e[a]=c}let r=Object.keys(e);if(r.length==0)return[];let i=1,n=r.length,s=Object.values(e[r[0]]);for(;i<n;i++){let a=r[i],l=e[a];s=this.getFullPermutation(s,l)}return s}getFullPermutation(t,e){let r=new Array;for(let i of t)for(let n in e){let s=e[n],a=new o(new Map(this.netMaps));Re.addAll(a.reuseMap,i.reuseMap),Re.addAll(a.reuseMap,s.reuseMap),r.push(a)}return r}hasMatchChannelID(){for(let t of this.reuseMap)for(let e of t.matchList)if(e.channelId==t.templateInfo.channelId)return!0;return!1}classify4Channel(){let t=new Array;for(let e of this.reuseMap){let r=e.classify4Channel();r.matchList.length>0&&t.push(r)}if(t.length==this.reuseMap.length){let e=new o(new Map);for(let[r,i]of this.netMaps)e.netMaps.set(r,i);return Re.addAll(e.reuseMap,t),e}return null}matchGroup(t){return this.matchNetMap(t.netMaps)?this.mergeGroup(t):null}mergeGroup(t){let e=new o(new Map);for(let[r,i]of t.netMaps)e.netMaps.set(r,i);for(let[r,i]of this.netMaps)e.netMaps.set(r,i);return Re.addAll(e.reuseMap,t.reuseMap),Re.addAll(e.reuseMap,this.reuseMap),e}matchNetMap(t){let e=new Set;for(let[r,i]of this.netMaps){e.add(i);let n=t.get(r);if(n!==void 0&&n!==i)return!1}for(let[r,i]of t)if(e.has(i)&&this.netMaps.get(r)!==i)return!1;return!0}};var gpe=class{constructor(){this.result=new Array}};var OAe=class{generateGroup(t){let e=this.classify4Infos(t.matchList),r=new Set,i=new Array,n=new Map;for(let a of t.matchList){if(r.has(a))continue;let l=t.templateInfo.getNetMatchList(a),c=new tI(t.templateInfo);if(Object.keys(Object.fromEntries(l)).length==0)for(let u of t.matchList)c.matchList.push(u),r.add(u);else{let u=this.getSameNetMapList(l,t.templateInfo,e);for(let d of u)c.matchList.push(d),r.add(d)}let h=new oO(l);for(let[u,d]of l){let p=n.get(u);p==null&&(p=new Set,n.set(u,p)),p.add(d)}h.reuseMap.push(c),i.push(h)}let s=0;for(let[,a]of n)s+=a.size;return{groups:i,allNetMaps:n,cnt:s}}generateGroup1(t){let e=this.classify4Infos(t.matchList),r=new Set,i=new Array,n=new Map;for(let s of t.matchList){if(r.has(s))continue;let a=t.templateInfo.getNetMatchList(s),l=new tI(t.templateInfo);if(Object.keys(a).length==0)for(let h of t.matchList)l.matchList.push(h),r.add(h);else{let h=this.getSameNetMapList(a,t.templateInfo,e);for(let u of h)l.matchList.push(u),r.add(u)}let c=new oO(a);for(let h in a){let u=a[h],d=n.get(h);d==null&&(d=new Set,n.set(h,d)),d.add(u)}c.reuseMap.push(l),i.push(c)}return i}getSameNetMapList(t,e,r){let i=new Set,n=!0;for(let[s,a]of t){let l=e.netMapNums[s],c=r[a];if(n)for(let h of c){let u=h.netMapNums[a];e.matchNums(l,u)&&i.add(h)}else{let h=new Set;for(let u of c)if(i.has(u)){let d=u.netMapNums[a];e.matchNums(l,d)&&h.add(u)}i=h}n=!1}return i}classify4Infos(t){let e={};for(let r of t)for(let i in r.netMapNums){let n=e[i];n==null&&(n=new Array,e[i]=n),n.push(r)}return e}},ype=class{constructor(){this.debugInfo=new Array}classify4Infos(t){let e={};for(let r of t)for(let i in r.netMapNums){let n=e[i];n==null&&(n=new Set,e[i]=n),n.add(r)}return e}generateGroupMap(t,e){let r=[];for(let m of t)r.push(new tI(new qC(m)));this.filter4UUID(r,e);for(let m of r)if(m.matchList.length==0)return this.debugInfo.push(`template component ID for ${m.templateInfo.component.globalIndex} has not match reuse component`),[];let i=this.getReuseGroups(r);if(i.length==0)return this.debugInfo.push("reuse not match template"),[];for(let m of i)if(m.groups.length==0)return this.debugInfo.push("Multiplexed element nets do not exactly match template nets "),[];let n=this.netFlush(i,"allMatch");n.sort((m,g)=>m.length-g.length);let s=this.getNetMapGroups(n),a=new Array,l=this.allHasMatchChannalID(n),c=new Set,h=new Array,u=n[0],d=0;for(let m=0;m<u.length;m++)if(u[m].netMaps.get("")===""){if(d===m)continue;{let g=u[d];u[d]=u[m],u[m]=g,d++}}else continue;let p=u.shift();for(;p!=null;){let m=!0;for(let y of p.reuseMap)for(let b of y.matchList)if(!c.has(b.component)){m=!1;break}if(m){p.reuseMap[0].allUse=!0,p=u.shift();continue}a.push(p);let g=this.DFS(p,n,1,a,l,s);if(g!=null){let y=this.groupByGroupId([[g]]),b=this.groupByChannelId(y,l);for(let T of b)for(let I of T)for(let C of I.result)this.generateUniqueMap(C,c,h);let P=!0;for(let T of g.reuseMap){let I=new Array,C=T.matchList.length;for(;T.matchList.length>0;){let E=T.matchList.shift();c.has(E.component)||I.push(E)}Re.addAll(T.matchList,I),I.length!=C&&(P=!1),I.length==0&&(T.allUse=!0)}P&&(p=u.shift())}else p=u.shift();a.pop()}return h}generateNotAllMatchGroupMap(t,e,r){let i=[];for(let d of t)i.push(new tI(new qC(d)));let n=this.getTemplateInfo(i),s=!0;this.filter4UUID2(i,e,r);for(let d of i)if(d.matchList.length>0){s=!1;break}if(s)return this.progressUpdate(r,1),{templateInfos:n,allReuseIDList:[],idMapMatchListObj:{},allNotMatch:s,allReuseGroupNetMaps:null};let a=new Set,l=new Map,{res:c,allResult:h}=this.getMatchResult(i);if(c){let d=this.allHasMatchChannalID(h);for(let p of e)a.add(p.globalIndex);this.FillTemplateInfo(c,n,l,a,r,d),this.handleOtherGroups(c,h,l,n,a)}else s=!0;if(this.progressUpdate(r,1),s)return{templateInfos:n,allReuseIDList:[],idMapMatchListObj:{},allNotMatch:s,allReuseGroupNetMaps:null};let u=new Map;for(let[d,p]of l)u.set(d,Array.from(p));return n=this.changeOrder(n),{templateInfos:n,allReuseIDList:Array.from(a),idMapMatchListObj:Object.fromEntries(u),allNotMatch:!1,allReuseGroupNetMaps:c.netMaps}}getMatchResult(t){let e=null,r=this.getReuseGroups(t),i=this.getReuseGroups(t),n=[],s=[];r=r.filter(d=>d.groups.length>0),this.getSameNetMap(r,n,s);let a=[];for(let d of r)a.push(d.groups);let l=[],c=[],h;if(n.length>0){let d=n.flat(1),p=d[0];for(let m=1;m<d.length;m++)p=p.matchGroup(d[m]);h=this.handleSpecialData(p,s,c),h==null&&(h=this.findMaxGroups([p],s,c,0))}this.netFlush(i,"notAllMatch");let u=[];for(let d of i)d.groups.length!==0&&u.push(d.groups);if(u.length===0)return{res:null};if(u.sort((d,p)=>p.length-d.length),e=this.findMaxGroups(u[0],u,l),h&&h.reuseMap.length>=e.reuseMap.length){if(e=h,c.length>0){let d=this.findMaxGroups(c[0],c,[]);e=this.mergeIntoGroup(e,d,s)}}else if(l.length>0){let d=this.findMaxGroups(l[0],l,[]);e=this.mergeIntoGroup(e,d,u),a=u}return{res:e,allResult:a}}handleSpecialData(t,e,r){e.sort((c,h)=>c.length-h.length);let i=[],n=[];for(let c of e)c.length==1?i.push(c):n.push(c);if(i.length===0||i.length<e.length/2)return null;let s=-1,a;for(let c=0;c<i.length;c++){let h=i.shift(),u=this.findMaxGroups(h,i,[],0);u.reuseMap.length>s&&(s=u.reuseMap.length,a=u),i.push(h)}let l=[t.matchGroup(a)];return l[0]==null?null:this.findMaxGroups(l,n,r,0)}changeOrder(t){let e=[],r=[];for(let i of t)i.match.id&&i.match.tag?e.push(i):r.push(i);return e.concat(r)}getReuseGroups(t){let e=[];for(let r of t){let i=new OAe().generateGroup(r);e.push(i)}return e}handleOtherGroups(t,e,r,i,n){let s=new Set;for(let l of t.reuseMap)s.add(l.templateInfo.id);let a=[];for(let l of e){if(l.length===0)continue;let c=l[0].reuseMap[0].templateInfo.id;s.has(c)||a.push(l)}if(a.length>0)for(let l of a)for(let c of l){let h=c.reuseMap[0].templateInfo.id,u=r.get(h);u==null&&(u=new Set,r.set(h,u));for(let d of i)if(d.id===h)for(let p of c.reuseMap[0].matchList){if(u.add(p.id),!n.has(p.id))continue;let m={id:"",tag:"",channelId:""};m.id=p.id,m.tag=p.component.attrsMap.Designator,m.channelId=p.channelId,d.matchList.push(m)}}}mergeIntoGroup(t,e,r){let i=new Map;for(let[s,a]of e.netMaps){let l=t.netMaps.get(s);if(l!=null&&a!==l)i.set(s,l);else for(let[c,h]of t.netMaps)c!==s&&a===h&&i.set(c,h)}let n=[];for(let s of r)for(let a of s){let l=!1;for(let[c,h]of a.netMaps)if(i.has(c)&&i.get(c)===h){n.push([a]),l=!0;break}if(l)break}if(e.reuseMap.length>n.length){for(let[s,a]of i)t.netMaps.delete(s);for(let s=t.reuseMap.length-1;s>=0;s--){let a=t.reuseMap[s],l=Object.keys(a.templateInfo.netMapNums),c=!1;for(let h of l)if(i.has(h)){c=!0;break}c&&t.reuseMap.splice(s,1)}for(let[s,a]of e.netMaps)t.netMaps.set(s,a);for(let s of e.reuseMap)t.reuseMap.push(s)}return t}getSameNetMap(t,e,r){for(let i=0;i<t.length;i++){let n=t[i],s=!1;for(let a of n.groups){let l=!0;for(let[c,h]of a.netMaps)if(c!==h){l=!1;break}if(l){s=!0,e.push([a]);break}}s||r.push(n.groups)}}findMaxGroups(t,e,r,i){let n=!1,s=-1,a=null,l=null,c=[];for(let h of t){a=h;let u=i==null?1:i;for(;u!==e.length;){let d=e[u],p=!1;for(let m of d){let g=a.matchGroup(m);if(g!=null){a=g,p=!0;break}}p||c.push(d),u++}if(a.reuseMap.length===e.length){n=!0;break}else if(a.reuseMap.length>s){l=a,s=a.reuseMap.length,r.length=0;for(let d of c)r.push(d)}c.length=0,a=null}return n||(a=l),a}netFlush(t,e){let r=!0,i=0,n=new Array;for(t.sort((s,a)=>s.cnt-a.cnt);i<10&&r;){r=!1;let s=t.reduce((l,c)=>l+c.cnt,0);this.filterNetMaps(t,e);let a=t.reduce((l,c)=>l+c.cnt,0);r=s!=a,i++}for(let s of t)n.push(s.groups);return n}progressUpdate(t,e){t!=null&&t({title:"reuseLayoutRoute",value:e})}FillTemplateInfo(t,e,r,i,n,s){let a=0;for(let l of t.reuseMap){let c=l.templateInfo.id;for(let h of e)if(h.id==c){let u=r.get(c);u==null&&(u=new Set,r.set(c,u));let d=!0;if(s){for(let p of l.matchList){if(u.add(p.id),!i.has(p.id))continue;let m={id:p.id,tag:p.component.attrsMap.Designator,channelId:p.channelId,uuid:p.uuid};h.match.id===""&&p.channelId===h.channelId?(h.match=m,i.delete(h.match.id)):h.matchList.push(m)}if(h.match.id===""&&h.matchList.length){let p=h.matchList.shift();h.match=p,i.delete(p.id)}}else this.matchFirst(l,i,u,d,h)}n&&n({title:"reuseLayoutRoute",value:a/t.reuseMap.length*.1+.7}),a++}for(let l of e)for(let c=l.matchList.length-1;c>=0;c--){let h=l.matchList[c];i.has(h.id)||l.matchList.splice(c,1)}}matchFirst(t,e,r,i,n){for(let s of t.matchList){if(!e.has(s.id))continue;let a={id:"",tag:"",channelId:""};a.id=s.id,a.tag=s.component.attrsMap.Designator,a.channelId=s.channelId,r.add(s.id),i?(n.match=a,i=!1,e.delete(a.id)):n.matchList.push(a)}}getTemplateInfo(t){let e=[];for(let r of t){let i={id:"",tag:"",channelId:"",uuid:"",match:{id:"",tag:"",channelId:""},matchList:[]},n=r.templateInfo.id,s=r.templateInfo.component.attrsMap.Designator,a=r.templateInfo.channelId,l=r.templateInfo.uuid;i.uuid=l,i.id=n,i.tag=s,i.channelId=a,e.push(i)}return e}filterNetMaps(t,e){for(let r=0;r<t.length;r++){let i=t[r],n=new Map;for(let[s,a]of i.allNetMaps)n.set(s,a);for(let s=r+1;s<t.length;s++){let a=t[s];for(let[l,c]of n){let h=a.allNetMaps.get(l);if(h!=null&&h.size>0){let u=new Set;for(let d of c)h.has(d)&&u.add(d);if(u.size===0)for(let d of c)u.add(d);if(e==="notAllMatch"&&i.groups.length<=1){this.deleteNets(h,u),this.delete4Nets(a.groups,l,u);continue}this.deleteNets(h,u),this.deleteNets(c,u),this.delete4Nets(i.groups,l,u),this.delete4Nets(a.groups,l,u)}}}}this.updateNetMap(t)}updateNetMap(t){for(let e of t){let r=new Map;for(let n of e.groups){let s=n.netMaps;for(let[a,l]of s){let c=r.get(a);c==null&&(c=new Set,r.set(a,c)),c.add(l)}}e.allNetMaps=r;let i=0;for(let[,n]of r)i+=n.size;e.cnt=i}}getNetMapGroups(t){let e=new Map;for(let r=0;r<t.length;r++){let i=t[r];for(let n of i)for(let[s,a]of n.netMaps){let l=e.get(s);l==null&&(l=new Map,e.set(s,l));let c=l.get(a);c==null&&(c=new Map,l.set(a,c));let h=c.get(r);h==null&&(h=new Set,c.set(r,h)),h.add(n)}}return e}deleteNets(t,e){for(let r of t)e.has(r)||t.delete(r)}delete4Nets(t,e,r){let i=Array.from(t);t.length=0;for(let n=0;n<i.length;n++){let s=i[n];s.netMaps.get(e)!=null?r.has(s.netMaps.get(e))&&t.push(s):t.push(s)}}allHasMatchChannalID(t){for(let e of t){if(e.length==0)continue;let r=!1;for(let i of e){let n=!1;for(let s of i.reuseMap){let a=!1;s.sortMatchList();for(let l of s.matchList)if(l.channelId==s.templateInfo.channelId){a=!0;break}if(a){n=!0;break}}if(n){r=!0;break}}if(!r)return!1}for(let e of t)xr(e,(r,i)=>{let n=r.hasMatchChannelID(),s=i.hasMatchChannelID();return n&&s||n?-1:s?1:0},0,e.length);return!0}DFS(t,e,r,i,n,s){if(e.length==1)return t;let l=this.getRangeMaps(t,s).get(r)||e[r];for(let c of l){if(c.reuseMap[0].allUse)continue;let h=t.matchGroup(c);if(h!=null){i.push(c);let u=r+1;if(u<e.length){let d=this.DFS(h,e,u,i,n,s);if(d!=null)return d;i.pop()}else{if(!(h.classify4Group().length>0&&n)||h.classify4Channel()!=null)return i.length=0,h;i.pop()}}}return null}getRangeMaps(t,e){let r=new Map,i=new Set,n=new Map;for(let[s,a]of t.netMaps)n.set(s,a);for(let[s,a]of n){let l=e.get(s);if(i.add(s),l.size==1)continue;let c=l.get(a);for(let[h,u]of c){let d=r.get(h);d==null&&(d=new Set,r.set(h,d));for(let p of u)for(let[m,g]of p.netMaps)n.get(m)==null&&t.matchNetMap(new Map().set(m,g))&&n.set(m,g);Re.addAllSet(d,u)}}return r}getFullPermutation(t,e){let r=new Array;for(let i of t){let n=new Array;for(let s of i)for(let a of e){let l=s.matchGroup(a);l!=null&&n.push(l)}n.length>0&&r.push(n)}return r}filterConnects(t,e,r){let i=this.classify4Infos(e),n=this.classify4Infos(r);for(let s of t){for(let a=s.matchList.length-1;a>=0;a--){let l=s.templateInfo.getNetMatchList(s.matchList[a]);for(let[c,h]of l){let u=i[c],d=n[h];if(u.size>d.size){let p=`map(${s.templateInfo.uuid}),id(${s.templateInfo.id}):templateNet(${c}) map reuseNet(${h}),templateConnect size(${u.size}) is greater reuseNet size(${d.size})`;this.debugInfo.push(p),s.matchList.splice(a,1);break}}}if(s.matchList.length==0){let a=`map(${s.templateInfo.uuid}),id(${s.templateInfo.id}):has not match list`;this.debugInfo.push(a);return}}}filter4UUID(t,e){let r=Qp(l=>l.templateInfo.uuid,t),i=Qp(l=>{let c=Wi.getInstance().getItem(l.footprintUUID);return c instanceof Xc?c.source:l.footprintUUID},e),n=new Set,s=new Set,a=new Set;for(let[l,c]of i){let h=r.get(l);if(h!=null){if(c.length<h.length){this.debugInfo.push(`the number of footprint UUID:${l} reuses(${c.length}) is less than the number of template(${h.length})`);return}let u=new Set,d=new Set;for(let p of c){let m=new qC(p);for(let g of h)g.templateInfo.isMatch(m,this.debugInfo)&&(g.matchList.push(m),d.add(m),a.add(p)),u.add(g.templateInfo)}this.filterConnects(h,u,d),Re.addAllSet(n,u);for(let p of h)Re.addAllSet(s,p.matchList);this.filterConnects(h,n,s)}}for(let l of e)if(!a.has(l))for(let c in r){let h=l.footprintUUID;if(c!==h){let u=r[c];if(this.isSameFootprint(u[0],l)){let p=new qC(l),m=new Set,g=new Set;for(let y of u)y.templateInfo.isMatch(p,this.debugInfo)&&(y.matchList.push(p),g.add(p)),m.add(y.templateInfo);this.filterConnects(u,m,g),Re.addAllSet(n,m);for(let y of u)Re.addAllSet(s,y.matchList);this.filterConnects(u,n,s);for(let y of t)if(y.matchList.length==0)return}}}}filter4UUID2(t,e,r){let i=Qp(a=>a.templateInfo.uuid,t),n=Qp(a=>{let l=Wi.getInstance().getItem(a.footprintUUID);return l instanceof Xc?l.source:a.footprintUUID},e),s=0;for(let[a,l]of n){let c=i.get(a);if(c!=null)for(let h of l){let u=new qC(h);this.templateMatchReuseInfo(c,u)}}for(let a of e){for(let[l,c]of i){let h=a.footprintUUID;if(l!==h&&this.isSameFootprint(c[0],a)){let d=new qC(a);this.templateMatchReuseInfo(c,d)}}s++,this.progressUpdate(r,s/e.length*.2)}}templateMatchReuseInfo(t,e){for(let r of t)r.templateInfo.isMatch(e,this.debugInfo)&&r.matchList.push(e)}isSameFootprint(t,e){let r=e.attrsMap.Footprint,i=t.templateInfo.component.attrsMap.Footprint;if(r===i){let n=e.getPads(),s=t.templateInfo.component.getPads();if(n.length===s.length){let a=n.map(c=>c.num),l=new Set(a);if(s.forEach(c=>{l.has(c.num)&&l.delete(c.num)}),l.size===0)return!0}}return!1}groupByGroupId(t){let e=new Array;for(let r of t){let i=new Array;for(let n of r){let s=n.classify4Group();if(s.length>0){let a=new gpe;Re.addAll(a.result,s),i.push(a)}}i.length>0&&e.push(i)}return e.length==0&&this.debugInfo.push("classify group ID fail,please check groupID!!"),e}groupByChannelId(t,e){let r=new Array;for(let i of t){let n=new Array;for(let s of i){let a=new gpe;for(let l of s.result){if(!e){a.result.push(l);continue}let c=l.classify4Channel();c!=null&&a.result.push(c)}a.result.length>0&&n.push(a)}n.length>0&&r.push(n)}return r.length==0&&this.debugInfo.push("classify channel ID fail,please check channel ID!!"),r}generateUniqueMap(t,e,r){let i=!1;for(let n of t.reuseMap){let s=!0;for(let a of n.matchList)if(!e.has(a.component)){s=!1;break}if(s){i=!0;break}}if(!i){let n=new Array;for(let a of t.reuseMap){let l=new Array;for(let c of a.matchList)if(!e.has(c.component)){let h=new tI(a.templateInfo);h.matchList.push(c),l.push(h)}n.push(l)}let s=0;for(;;){let a=new Array,l=new Set;for(let c of n){let h=c[s];if(h!=null&&(l.has(h.matchList[0].component)||e.has(h.matchList[0].component))){let u=s+1,d=c.length;for(;u<d&&(h=c[u],!!(l.has(h.matchList[0].component)||e.has(h.matchList[0].component)));u++);h!=null&&(l.has(h.matchList[0].component)||e.has(h.matchList[0].component))&&(h=null)}if(h!=null)a.push(h),l.add(h.matchList[0].component);else break}if(a.length==n.length){let c=new oO(new Map);for(let[h,u]of t.netMaps)c.netMaps.set(h,u);for(let h of a)c.reuseMap.push(h),e.add(h.matchList[0].component);r.push(c),s++}else break}}}};function gqe(o){let t=new Jt;return t.add("COLUMNS_INPUT",!0),t.add("CANCEL"),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var DDt="Please select a group",Ww=class extends ci{constructor(e){super();this._reuseComponent=new Array;this._reusing=!1;this._isDialogOpen=!1;this._highlightItems=new Array;this.result=new Array;this.coppers=new Array;this.lastX=0;this.lastY=0;this.layoutColumns=2;this.map=new Map;this.bbox=null;this.templates=new Array;Re.addAll(this._reuseComponent,e),this.drawing=!0,this.commandFactory=new mi,this.start()}getColumns(){return this.layoutColumns}setColumns(e){this.layoutColumns=e,this.result.length>0&&this.bbox!=null&&this.typesetting(this.bbox)}onKeyDown(e){switch(sr.getAction(5,e)){case"Cancel":this.cancel();break;case"Rotate Left":this.rotate(e);break;case"Show Attribute Dialog When Placing Object":A.publish("openMainDialog",{cmd:44,data:{tool:this}});break}A.publish("updateFrame","")}onMouseMove(e){if(this.unhighlightItems(),this._reusing)jt.cancel(),this.translate(e.sceneX-this.lastX,e.sceneY-this.lastY);else if(this._isDialogOpen)jt.cancel();else{jt.update(e,DDt);let r=Wr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).getResult(dm),i=$t.filterCombination(r),n=!1;for(let s of i)if(s instanceof Me){n=!0;break}n&&(Re.addAll(this._highlightItems,i),this.highlightItems())}this.lastX=e.sceneX,this.lastY=e.sceneY}highlightItems(){for(let e of this._highlightItems)e.click();A.publish("updateFrame","")}unhighlightItems(){let e=this._highlightItems.length>0;for(let r of this._highlightItems)r.updateFilterVisible=!0,r.visible();this._highlightItems.length=0,e&&A.publish("updateFrame","")}onMouseLeftUp(e){if(!this._isDialogOpen)if(this._reusing){for(let n of this.result)n.complete();this.addOtherItemCommand(),this.commandFactory.execute();let r="{value} group reuse completed",i={value:this.result.length};this.sendMessage(r,i),this.coppers.length>0&&A.publish("rebuildSingleCopper",{ids:this.coppers,isLast:!0}),A.publish("autoFill",""),A.publish("tool","dropdrag")}else{let r=Wr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).getResult(dm),i=$t.filterCombination(r),n=new Array,s=new Array,a=new _e,l=new S(e.sceneX,e.sceneY);for(let c of i)c instanceof Me?n.push(c):s.push(c),a.ext1(c.buildBBox());if(n.length>0){jt.cancel();let c=this.filterResult(this._reuseComponent);if(c.length===0){A.publish("tool","dropdrag");return}let h=this.getComponentModel(n),u=this.getComponentModel(c);if(n.length<500){let d=new ype,p=d.generateGroupMap(h,u);if(p.length==0){let{idMapTemplateMaps:m,idMapNetInfos:g}=this.idMapTemplateInfo(h,u),{templateInfos:y,allReuseIDList:b,allNotMatch:P,idMapMatchListObj:T,allReuseGroupNetMaps:I}=d.generateNotAllMatchGroupMap(h,u),C={templateInfos:y,allReuseIDList:b,allNotMatch:P,idMapMatchListObj:T};this.handleNotallMatchData(C,I,m,g,l,a,s)}else this.hasLock(p,l,a,s)}else{let d=new xC().encode(),p=pf.getInstance().addWorker(`editor?entry=pcb-decode-worker.js${$().location.search.replace(/\?/,"&")}`),m=this.getComponentID(n),g=this.getComponentID(c),{idMapTemplateMaps:y,idMapNetInfos:b}=this.idMapTemplateInfo(h,u);p.rpcCall("pcb/worker/reuseLayoutRoute",{world:d,templateIDs:m,reuseIDs:g}).then(P=>{let{workerName:T,data:I,type:C}=P.message;if(C=="allMatch"){let E=I,O=[];for(let _ of E){let R=new oO(new Map);for(let[v,D]of _.netMaps)R.netMaps.set(v,D);for(let v of _.reuseMaps){let D=y.get(v.templateID),w=new tI(D.templateInfo);w.matchList.push(b.get(v.reuseID)),R.reuseMap.push(w)}O.push(R)}this.hasLock(O,l,a,s)}else{let{templateData:E,allReuseGroupNetMaps:O}=I;this.handleNotallMatchData(E,O,y,b,l,a,s)}pf.getInstance().deleteWorker(T)}).catch(P=>{throw P})}}}}sendLockedMessage(e,r,i,n,s){let a=new _0("Locked components found, whether to reuse the locked components together?",()=>{this.reuse(e,r,i,n,s)});A.publish("openMsgbox",a)}idMapTemplateInfo(e,r){let i=e.map(l=>new tI(new qC(l))),n=r.map(l=>new qC(l)),s=new Map;for(let l of i)s.set(l.templateInfo.id,l);let a=new Map;for(let l of n)a.set(l.id,l);return{idMapTemplateMaps:s,idMapNetInfos:a}}handleNotallMatchData(e,r,i,n,s,a,l){let c;if(this.otherInfo={position:s,fac:a,others:l},e.allNotMatch)c=null;else{c=new oO(new Map);for(let[u,d]of r)c.netMaps.set(u,d);for(let u in e.idMapMatchListObj){let d=e.idMapMatchListObj[u],p=i.get(u),m=new tI(p.templateInfo);for(let g of d)m.matchList.push(n.get(g));c.reuseMap.push(m)}}if(this.isAllMatch(e.templateInfos)){let u=[],d=new oO(new Map(r));for(let p of e.templateInfos)for(let m of c.reuseMap)if(p.id===m.templateInfo.id){let g=new tI(m.templateInfo);for(let y of m.matchList)if(y.id===p.match.id){g.matchList.push(y);break}d.reuseMap.push(g)}u.push(d),this.hasLock(u,this.otherInfo.position,this.otherInfo.fac,this.otherInfo.others,e.templateInfos[0].id)}else A.publish("openMainDialog",{cmd:45,data:{info:{type:"reuse_layout_route",templateData:e},tool:this,allReuseGroupInfo:c}})}isAllMatch(e){for(let r of e)if(r.match.id==="")return!1;return!0}getComponentModel(e){let r=[];for(let i of e)r.push(i.model);return r}getComponentID(e){let r=[];for(let i of e)r.push(i.model.globalIndex);return r}reuse(e,r,i,n,s){this._reusing=!0,this.commandFactory.createGroup("Reuse layout route");let a=r.build1(),l=e;this.lastX=e.x,this.lastY=e.y;let c=zC.extractCopyInfo(n,l);if(i.length>0)for(let h of i){let u=this.sycnTemplate(h,c),d=new ep(u);d.recordStyle(),this.result.push(d)}else if(i.length==0){let h=new Array,u="";u=Cr.getItem(s).getGroupID();let{group:d}=ic.reuseRepeat(c);for(let P of d)P.visible(),P instanceof Ye&&P.type=="Copper Region"&&this.coppers.push(P.globalIndex),h.push(P);let p=new ep(h);p.recordStyle(),this.result.push(p);let m=new Q0,g=kt.getAllItem().map(P=>P.name);for(let P of g)m.add(P);let y=kt.getItem(u).name,b=kt.combination(h,m.getUniqueName(y));this.commandFactory.addCommand4Item(b,"add")}this.bbox=a,this.typesetting(a)}hasLock(e,r,i,n,s){let a=!1;for(let l of e)for(let c of l.reuseMap)for(let h of c.matchList)if(h.component.locked){a=!0;break}a?this.sendLockedMessage(r,i,e,n):this.reuse(r,i,e,n,s)}filterResult(e){let r=new Array;for(let i of e)if(i.getGroupID()!=null){let n=i.getGroupID(),s=kt.getItem(n),a="The selected object {objectID} already exists in group {groupName}, cannot be reused",l=x.getInstance().tabId,c={objectID:`${ur}${i.number}`,object:{attr:{id:i.globalIndex,pcbid:l},text:i.name},group:{attr:{id:n,pcbid:l},text:`${s.name} (${n})`},groupName:s.name,groupID:n},h={type:"warn",msg:['<span class="i18n">The selected object</span> ',c.object,' <span class="i18n">already exists in group</span> ',c.group,' <span class="i18n">cannot be reused</span>']};this.sendMessage(a,c,"warn",h)}else r.push(i);return r}translate(e,r){let i=Ae.translate(e,r,0);for(let n of this.result)n.transform(i)}typesetting(e){let r=e.width()+10,i=e.height()+10,n=this.result.length;for(let s=0;s<n;s++){let a=this.result[s],l=s%this.layoutColumns*r,c=-Math.floor(s/this.layoutColumns)*i,h=this.map.get(a);h==null&&(h=S.ORIGIN),h=h.mul(-1).add1(l,c);let u=Ae.translate(h.x,h.y,0);this.map.set(a,new S(l,c)),a.transform(u)}}sycnTemplate(e,r){let i=new Array,n="",s={};for(let d of e.reuseMap){let p=d.templateInfo.component,m=Cr.getItem(p.globalIndex),g=d.matchList[0].component,y=Cr.getItem(g.globalIndex);n=m.getGroupID(),d.getIdMaps(0,s),this.commandFactory.addCommand4Item(y,"modify"),y.layerId=m.layerId,y.position=m.position,y.rotation=m.rotation;for(let b in m.attrKeyText){let P=m.attrKeyText[b],T=y.attrKeyText[b];T!=null&&(T.layerId=P.layerId,T.position=P.position,T.rotation=P.rotation,T.fontSize=P.fontSize,T.strokeWidth=P.strokeWidth,T.reverse=P.reverse,T.reverseExpansion=P.reverseExpansion,T.origin=P.origin,T.mirror=P.mirror,T.positionIsNull=P.positionIsNull,T.fontFamily=P.fontFamily,vp.addText(T))}i.push(y)}let{group:a}=ic.reuseRepeat(r,s);for(let d of a){if(d.visible(),d.net!=null&&e.netMaps.get(d.net)!=null&&(d.net=e.netMaps.get(d.net)),d instanceof Ye&&d.type=="Copper Region"&&this.coppers.push(d.globalIndex),d.model instanceof lr&&d.model.component instanceof ln){let m=d.model.component.networkList,g=[];for(let y=0;y<m.length;y++){let b=e.netMaps.get(m[y]);b!=null?m[y]=b:ze.getItem(m[y])==null&&g.push(y)}for(let y=g.length-1;y>=0;y--)m.splice(g[y],1)}i.push(d)}let l=new Q0,c=kt.getAllItem().map(d=>d.name);for(let d of c)l.add(d);let h=kt.getItem(n).name,u=kt.combination(i,l.getUniqueName(h));return this.commandFactory.addCommand4Item(u,"add"),i}sendMessage(e,r,i="info",n){A.publish("ui/toastMsg",{type:i,msg:{value:e,options:r},bottomBarMsg:n},$())}interrupt(){this._reuseComponent.length=0,this.addOtherItemCommand(),jt.cancel(),this.commandFactory.undo(),this.unhighlightItems();for(let e of this.result)e.cancel();this.result.length=0,this.end()}addOtherItemCommand(){if(this._reusing)for(let e of this.result)for(let r of e.group)r instanceof Me||this.commandFactory.addCommand4Item(r,"add")}rotate(e){let r=new S(e.sceneX,e.sceneY);for(let i of this.result)i.rotateFor(r,ce.pcbConfig.rotate)}getReuseComponents(){return this._reuseComponent}cancel(){this._isDialogOpen||(this.interrupt(),A.publish("tool","dropdrag"))}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:gqe(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"COLUMNS_INPUT":A.publish("openMainDialog",{cmd:44,data:{tool:this}});break;case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var l1=class{constructor(t="offset commands",e={}){this.profiles=new Array;this.hasMovedItem=new Set;e={...{saveHistory:!0,rotateWhole:!1,movePadItSelf:!1},...e},this.commandFactory=typeof t=="string"?new mi().createGroup(t):t,this.saveHistory=e.saveHistory,this.rotateWhole=e.rotateWhole,this.movePadItSelf=e.movePadItSelf}reset(){this.hasMovedItem.clear()}execute(t,e,r,i=!1){if(t.length==0)return;let{noGroup:n,groupMap:s}=this.categoryByGroup(t);n.forEach(a=>{let l=Array.isArray(e)?e[a.originIndex]:e,c=Array.isArray(r)?r[a.originIndex]:r;this.transformOne(a.item,l,c,i)}),Object.values(s).forEach(a=>{let l=a.items[0].originIndex,c=Array.isArray(e)?e[l]:e,h=Array.isArray(r)?r[l]:r;this.transformOne(a.ULItem,c,h,a.rotateFromZero)}),this.commandFactory&&this.commandFactory.checkOutlinesNoExecute(this.profiles,new Set),this.saveHistory&&(this.commandFactory&&this.commandFactory.execute(),setTimeout(()=>{A.publish("autoFill",""),A.publish("flushService","")},0))}transformOne(t,e,r,i){let n=this.getGroupItems([t]),s=t.getGroupID()!=null;n.forEach(a=>{if(!this.hasMovedItem.has(a)){if(this.commandFactory&&this.commandFactory.addCommand4Item(a,"modify"),this.rotateWhole){if(r){let l=0;if("rotation"in a&&a.rotation!=null){let h=+a.rotation;typeof h=="number"&&!isNaN(h)&&(l=h)}let c=i?l:0;a.rotateFor(r.center,r.angle-c)}}else if(s)r&&a.rotateFor(yqe(t),i?r.angle:r.angle-t.rotation);else if(r&&"rotation"in a&&a.rotation!=null){let l=0;if("rotation"in a&&a.rotation!=null){let h=+a.rotation;typeof h=="number"&&!isNaN(h)&&(l=h)}let c=i?0:l;a.rotation=r.angle+c}a.transform(Ae.translate(e.x,e.y,0)),this.hasMovedItem.add(a),A.publish("hasModifyPcbItem",a),a instanceof Ye&&this.profiles.push(a)}})}getParentElements(t,e=!1){let r={},i=new Map;for(let n=0;n<t.length;n++){let s=t[n],a=s.getParent();a instanceof Me&&(s instanceof fr||s instanceof Le&&this.movePadItSelf)?t.includes(a)||i.set(s,n):a?e&&!r[a.globalIndex]?r[a.globalIndex]={item:s,index:n}:r[a.globalIndex]={item:a,index:n}:i.set(s,n)}return Object.values(r).forEach(n=>i.set(n.item,n.index)),i}getGroupItems(t){let e=[],r=new Set;return t.forEach(i=>{let n=i.getGroupID();n?r.add(n):e.push(i)}),r.forEach(i=>{let n=kt.getItem(i).getItems();e=e.concat(n)}),e}categoryByGroup(t){let e=this.getParentElements(t),r={},i=new Array;for(let[n,s]of e){let a=n.getGroupID();a!=null?(r[a]==null&&(r[a]={items:[],rotateFromZero:!1,ULItem:null}),r[a].items.push({item:n,originIndex:s})):i.push({item:n,originIndex:s})}for(let n in r){let s=r[n];s.rotateFromZero=s.items.length>1,s.ULItem=s.items.length==1?s.items[0].item:this.getULItem(n)}return{groupMap:r,noGroup:i}}getULItem(t){let e=kt.getItem(t),r=e.getItems();if(r.length==1)return r[0];let i=e.buildBBox().UL(),n={dist2:Number.MAX_SAFE_INTEGER,item:null};for(let s of r){let l=zw(s).UL().distance2(i);l<n.dist2&&(n.dist2=l,n.item=s)}return n.item}};var y2=class extends ci{constructor(){super();this.commands=new ve("draw via");this._radius=te.getInstance().getDefaultRadiusPhysics().defalutRadius;this._innerRadius=te.getInstance().getDefaultRadiusPhysics().defalutInner;this.type=0;this.name="";this._via=null;this.nearNode=null;this.followRule=ce.pcbConfig.startViaSize=="rule";this.option="OPTIONLEFTUP",Ua.changeTool(this),Wh.setTool(this)}set via(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._via=e}get via(){return this._via}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,startPoint:l,keyCode:c}=e;if(a){dt.editingWhat=i;return}this.applyValue(e),c===13&&dt.destroy()}applyValue(e){let{value:r,startPoint:i,cursorPoint:n}=e,s=new ft,a=new S(n.x-i.x,n.y-i.y).normalize();r=s.conversion(x.getInstance().unit,"mil",r/10),a=new S(a.x*r,a.y*r);let l=new S(a.x+i.x,a.y+i.y);this.via.center=l,this.placeVia(l)}onKeyDown(e){switch(sr.getAction(5,e)){case"Cancel":this.cancel();break;case"Switch Common Via Size While Routing/Placing Via":this.showCommonViaSizeMenu(e);break;case"Show Attribute Dialog When Placing Object":this.via!=null&&A.publish("openMainDialog",{cmd:28,data:{tool:this,item:this.via}});break}A.publish("updateFrame","")}onMouseLeftUp(e){if(!dt.editingWhat&&this.via!==null){let r=new S(e.sceneX,e.sceneY);this.via.center=r,this.netsGroupSet=this.getNearNetPcbItems(e),this.handleNets(e)}}showNetsMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=this.getNetsMenuData().result,Qt.getInstance().menuData(r,this),this.drawing=!1}getNetsMenuData(){let e=new Jt,r="INHERIT_NET:";return this.nets.forEach(i=>{if(i){let n={name:i,cmd:`${r+i}`,tips:"",option:{disabledI18n:!0}};e.addObj(n,!1,!1)}}),e}getNearNetPcbItems(e){let r=new ib([this.via]);r.updateScene();let{netsGroupSet:i}=r.getNetPcbItems(e);return i}handleNets(e){this.nets=new Set,this.netsGroupSet.forEach(r=>{this.nets=r.nets}),this.nets.size?this.nets.size===1?(this.nets.forEach(r=>{this.via.net=r,rt.setDefaultVia({net:r,holeRadius:null,radius:null})}),this.placeVia(this.via.center)):this.showNetsMenu(e):this.placeVia(this.via.center)}placeVia(e){if(!Bt.checkIsInCanEdit(this.via)){let a="beyond drawing range";Bt.showMassageTip(a,a);return}let r=Hr.addViaByModel(this.via.model.clone(),!0);r.partition=x.getInstance().partitionId,this.nearNode.clear(),A.publish("onlySelect",[r]),A.publish("hasModifyPcbItem",r),A.publish("updateRtree",""),this.wireCommands=new Br,this.shoveCommands=new Br,this.shoveData=J3([r],this.wireCommands),Jl.getInstance().init();let i=tr.getInstance().mode;["WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"].includes(i)?jg("freeArc"):jg("45"),_9(this.shoveData,this.shoveCommands,!0),Xg();let n=Te.dispatch(r,"add");this.commands.addCommand(n);let s=Tue(this.commands);je.executeCommand(this.commands),A.publish("flushService",""),this.commands=new ve("draw via"),this.shoveCommands=new Br,Q3(),r=this.getNewViaAfterShove(s),this.drawing=!0,this.type=this.via.type,this.name=this.via.name,this.nearNode=new ly(r)}getNewViaAfterShove(e){if(!e)return this.via;let r=Object.values(e);for(let i of r){let n=Hr.getItem(i);if(n&&n.center.equals1(this.via.center))return n}return this.via}getViaRadius(){return this.via?{radius:this.via.radius,innerRadius:this.via.holeRadius}:{radius:this.radius,innerRadius:this.innerRadius}}updateViaRadius(){if(ce.pcbConfig.startViaSize=="rule"){let e;rt.defaultVia.net!=""&&ze.getSameNetItems(rt.defaultVia.net).length>0?e=te.getInstance().getRadiusPhysicsByNet(rt.defaultVia.net):e=te.getInstance().getDefaultRadiusPhysics(),this.modifyViaSize(e.defalutInner,e.defalutRadius,void 0,!0)}}onMouseMove(e){let r=new S(e.sceneX,e.sceneY);this.drawing&&(this.via!==null?(this.via.center=r,this.nearNode.generateRatline()):(this.start(),this.via=rt.getDefaultBaseVia(r,this.radius,this.innerRadius),this.via.type=this.type,this.via.name=this.name,this.nearNode=new ly(this.via)))}interrupt(){this.via!==null&&(dt.destroy(),this.via.remove(),this.nearNode.clear(),A.publish("delete",this.via),this.drawing=!1,this.via=null,A.publish("updateRtree",""),A.publish("flushSelectingInfo","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}flushNear(){this.via!=null&&this.via.net!=this.nearNode.net&&(this.nearNode.clear(),this.nearNode=new ly(this.via),this.nearNode.generateRatline())}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:tpe(this.via,e.adsorb).result};Qt.getInstance().menuData(r,this),this.drawing=!1}changeType(e){switch(e){case"VIA_TYPE_RULESSETTING":{let r={activeTab:"Rule",activeMenu:"Blind/Buried Via"};A.publish("openMainDialog",{cmd:5,data:{option:r,tool:this}});break}case"VIA_TYPE_THROUGH_VIA":{this.via!=null&&(this.via.type=0,this.via.name="");break}default:{this.via!=null&&(this.via.type=1,this.via.name=e);break}}GM(this.via)}modifyViaSize(e,r,i,n=!1){let s;if(this.via.name!==""){let l=te.getInstance().getDefaultBlindPhysics().getBlindVia(this.via.name);l.viaSizeRule!==""?s=te.getInstance().getRadiusPhysicsByName(l.viaSizeRule):s=te.getInstance().getRadiusPhysicsByNet(this.via.net)}else s=te.getInstance().getRadiusPhysicsByNet(this.via.net);if(!(x.getInstance().doctype===bi.FOOTPRINT)&&(Uf.inValidRadius(s,r)||Uf.inValidInnerRadius(s,e))){A.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},$());return}i!=null&&(this.followRule=i),r!=null&&(this.via.radius=r,this._radius=r),e!=null&&(this.via.holeRadius=e,this._innerRadius=e),this.type=this.via.type,this.name=this.via.name,rt.setDefaultVia(this.via),n&&Hi()}parse(e){this.drawing=!0;let i=e.cmdKey.split(":"),n=new ft;switch(i[0]){case"CANCEL":this.cancel();break;case"VIA_TYPE":this.changeType(i[1]);break;case"VIA_SIZE":if(i[1]==="VIA_SIZE_INPUT")A.publish("openMainDialog",{cmd:28,data:{tool:this,item:this.via}});else if(i[1]=="VIA_SIZE_COMMONLY_SETTING")A.publish("openSystemDialog","PCB_COMM_VIA_SIZE",$());else if(i[1]=="VIA_SIZE_RULESSETTING"){let a={activeTab:"Rule",activeMenu:"Via Size"};A.publish("openMainDialog",{cmd:5,data:{option:a,tool:this}})}else if(i[1]=="VIA_SIZE_FOLLOWRULES"){let a=ce.pcbConfig.startViaSize=="rule"?"last":"rule";ce.pcbConfig.startViaSize=a,we.sizeFollowRule=ce.pcbConfig.startViaSize=="rule",this.followRule=ce.pcbConfig.startViaSize=="rule",ce.pcbConfig.startViaSize=="rule"&&this.modifyViaSize(this.innerRadius,this.radius,void 0,!0),A.publish("flushSelectingInfo","")}else{this.followRule=!1;let a=ce.viaConfig[i[1]].getSizeAccordingToUnit();this.modifyViaSize(a.innerRadius,a.radius,void 0,!0)}break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"INHERIT_NET":let s=i[1];this.via.net=s,rt.setDefaultVia({net:s,holeRadius:null,radius:null}),this.placeVia(this.via.center),this.drawing=!0;break;case"VIA_SIZE_COMMONLY_SETTING":A.publish("openSystemDialog","PCB_COMM_VIA_SIZE",$());break}A.publish("updateFrame","")}getBlinds(){return this.via!=null&&te.getInstance().getDefaultBlindPhysics().getAllVias(),null}getBlindViaOptions(){let e=this.getBlinds(),r=new Array,i={name:"Through Via",cmd:"VIA_TYPE_THROUGH_VIA",tips:""};return r.push(i),e!=null&&e.forEach(n=>{let s={name:n.name,cmd:n.name,tips:""};this.via!=null&&this.via.name==n.name&&(s.selectedTag=!0),r.push(s)}),r}get radius(){let e=rt.defaultVia.net;(e==""||ze.getSameNetItems(e).length==0)&&(e="");let r=te.getInstance().getRadiusPhysicsByNet(e),i=r.defalutRadius,n=r.minRadius,s=r.maxRadius;return this.followRule||rt.defaultVia.radius==null?this._radius=i:rt.defaultVia.radius<n?this._radius=n:rt.defaultVia.radius>s?this._radius=s:this._radius=rt.defaultVia.radius,this._radius}set radius(e){let r=rt.defaultVia.net;(r==""||ze.getSameNetItems(r).length==0)&&(r="");let i=te.getInstance().getRadiusPhysicsByNet(r);if(e<i.minRadius||e>i.maxRadius){alert("The modified value is not within the DRC requirements");return}this._radius=e}get innerRadius(){let e=rt.defaultVia.net;(e==""||ze.getSameNetItems(e).length==0)&&(e="");let r=te.getInstance().getRadiusPhysicsByNet(e),i=r.defalutInner,n=r.minInner,s=r.maxInner;return this.followRule||rt.defaultVia.radius==null?this._innerRadius=i:rt.defaultVia.innerRadius<n?this._innerRadius=n:rt.defaultVia.innerRadius>s?this._innerRadius=s:this._innerRadius=rt.defaultVia.innerRadius,this._innerRadius}set innerRadius(e){this._innerRadius=e}showCommonViaSizeMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=rF(this.innerRadius,this.radius).result,Qt.getInstance().menuData(r,this),this.drawing=!1}};var NU=class extends ci{constructor(e,r,i,n,s){super();this.commandFactory=new ve("push component");this.items=new Set;this.alreadyRotate=!1;this.isMoveInOrder=!1;this.curItem=null;this.util=null;this.pcbPlaceTransfer=null;this.firstMove=!0;this.logger=new Gi(4);this.allMoveComponents=null;if(this.start(),this.option="OPTIONLEFTUP",this.isContinuousMode=n,e.items.length==1&&r=="MOVE_BY_CENTER_POINT"){let u=e.items[0],d=u.getParent();if((u instanceof Ge||u instanceof Le)&&d!=null&&d instanceof Me){let p=u.center;e.referX=p.x,e.referY=p.y,r="MOVE_BY_ORIGIN_POINT"}}this.menu=r,this.fac=i,this.itemsSortByDesignator=new Array,this.associationItem=new cl(e.items);let a=this.associationItem.items;this.associationItem.setUpConnectTrack();let l=this.associationItem.itemConnectTrack,c=new Array;switch(a.forEach(u=>{if(s.includes(u))return;u.click(),this.items.add(u),(e.items.includes(u)||!l.tracks.has(u.globalIndex))&&c.push(u),this.addFilterItem(u),this.fac.addCommand4Item(u,"modify")}),this.tool=new ep(c),this.tool.recordStyle(),this.associationItem.getAllRepairTracks().forEach(u=>{this.fac.addCommand4Item(u,"modify")}),r){case"MOVE_BY_CENTER_POINT":this.isMoveInOrder=!1,this.moveByCenterPoint();break;case"MOVE_BY_ORIGIN_POINT":case"MOVE_BY_REFERENCE_POINT":this.isMoveInOrder=!1,this.oldX=e.referX,this.oldY=e.referY,this.referX=e.referX,this.refery=e.referY,ie.publish("updateLastMousePosition",new S(this.oldX,this.oldY));let u=new S(Ma.x-this.oldX,Ma.y-this.oldY),d=Ae.translate(u.x,u.y,0);this.alreadyRotate||this.associationItem.moveConnectTrack(d),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(d),this.oldX=Ma.x,this.oldY=Ma.y;break;case"MOVE_SEQUENTIAL":this.isMoveInOrder=!0,a.forEach(p=>{p instanceof Me&&this.itemsSortByDesignator.push({des:p.name,item:p})}),this.moveInOrder();break}if(bd("move"),this.drawing=!0,this.items.size==1){let u=Array.from(this.items)[0];u instanceof Me&&(this.util=new UC(u))}this.createShoveTool(Array.from(a)),ao.setTool(this),Yo.setTool(this),Ua.changeTool(this)}createShoveTool(e){let r=e.filter(i=>i instanceof Ge);if(e.length==1&&r.length==1&&(this.shoveVia=r[0],this.shoveVia&&!this.shoveVia.locked)){let i=new lC(this.shoveVia.model),n=Array.from(i.getConnectTracks()),s=e.filter(a=>a instanceof Ue);(n.length==0||s.length!==n.length)&&(this.shoveTool=new KG(e,this.fac.getCommand()),this.shoveTool.customSyncAssociation(this.associationItem))}}addFilterItem(e){this.filterItems.add(e),e instanceof Me&&e.getItems().forEach(r=>{this.filterItems.add(r)})}moveByCenterPoint(){if(!this.items.size)return;let e=new _e;this.items.forEach(a=>{e.ext1(a.buildBBox())});let i=e.build1().center();this.oldX=i.x,this.oldY=i.y,this.referX=i.x,this.refery=i.y,ie.publish("updateLastMousePosition",new S(this.oldX,this.oldY));let n=new S(Ma.x-this.oldX,Ma.y-this.oldY),s=Ae.translate(n.x,n.y,0);this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(s)),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(s),this.items.forEach(a=>{var l,c;a instanceof fr&&(Ve.highlightComponentWhenMoveText.add(a),a.updateHelpLine()),(c=(l=Pr.getControl())==null?void 0:l.flushPoint)==null||c.call(l)}),this.oldX=Ma.x,this.oldY=Ma.y}moveInOrder(){if(this.isMoveInOrder&&this.itemsSortByDesignator.length){this.logger.debug3("%s,%s","\u6392\u5E8F\u524D...",this.itemsSortByDesignator),this.itemsSortByDesignator.sort(this.sortRule),this.logger.debug3("%s,%s","\u6392\u5E8F\u540E...",this.itemsSortByDesignator),this.fac=new mi,this.fac.createGroup("move select for "+this.menu),this.setCurItem();let r=this.curItem.buildBBox().center();this.oldX=r.x,this.oldY=r.y}}setCurItem(){this.itemsSortByDesignator.length?(this.curItem=this.itemsSortByDesignator[0].item,this.associationItem=new cl([this.curItem]),this.util=new UC(this.curItem),this.fac.addCommand4Item(this.curItem,"modify")):this.curItem=null}sortRule(e,r){var i=/[^a-zA-Z]/g,n=/[^0-9]/g,s=parseInt(e.des,10),a=parseInt(r.des,10);if(isNaN(s)&&isNaN(a)){var l=e.des.replace(i,""),c=r.des.replace(i,"");if(l===c){var h=parseInt(e.des.replace(n,""),10),u=parseInt(r.des.replace(n,""),10);return h===u?0:h>u?1:-1}else return l===""?1:c===""?-1:l>c?1:-1}else return isNaN(s)?1:isNaN(a)?-1:s>a?1:-1}onKeyDown(e){let r=sr.getAction(2,e),i=new S(e.realSceneX,e.realSceneY);switch(r){case"Flip Right and Left":this.items.size&&Array.from(this.items).every(n=>n instanceof Me)?qf.flipComponent("Flip Right and Left",i,Array.from(this.items),this.fac.getCommand()):ie.publish("turn","turnAround");break;case"Flip Up and Down":this.items.size&&Array.from(this.items).every(n=>n instanceof Me)?qf.flipComponent("Flip Up and Down",i,Array.from(this.items),this.fac.getCommand()):ie.publish("turn","turnAround");break;case"Cancel":this.cancel();break;case"Rotate Left":this.rotate("rotate_left");break;case"rotate_right":this.rotate("rotate_right");break;case"flip2OppositeSide":J_(void 0,Array.from(this.items));break;case"Switch Selected Range When Object Is Selected":{ie.publish("openMainDialog",{cmd:48,data:{position:{x:this.referX,y:this.refery},tool:this}});break}}ie.publish("updateCross",""),ie.publish("updateFrame","")}onMouseMove(e){this.fac&&this.drawing&&(this.isMoveInOrder?this.itemMovingInOrder(e):this.itemsMoving(e),this.firstMove&&(this.items.forEach(r=>{r instanceof fr&&Ve.highlightComponentWhenMoveText.add(r)}),this.firstMove=!1))}onMouseLeftUp(e){var r;this.fac&&((r=this.tool)==null||r.complete(),this.isMoveInOrder?this.itemMovedInOrderMouseUp(e):this.itemsMovedMouseUp(e),Ve.highlightComponentWhenMoveText.clear(),qf.clear())}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l}=e;if(a){dt.editingWhat=i;return}this.applyValue(e),l===13&&dt.destroy()}applyValue(e){let r=new ft,{value:i,type:n,startPoint:s,cursorPoint:a}=e,l=new S(a.x-s.x,a.y-s.y).normalize();i=r.conversion(x.getInstance().unit,"mil",i/10),l=new S(l.x*i,l.y*i);let c=new S(l.x+s.x,l.y+s.y),h=new S(c.x-a.x,c.y-a.y),u=Ae.translate(h.x,h.y,0);this.items.forEach(d=>{this.fac.addCommand4Item(d,"modify")}),this.tool.transform(u),this.itemsMovedMouseUp(null)}itemsMoving(e){if(this.placeTransferbeforeMoving(),this.shoveTool)return e.adsorbGrid=!1,this.menu!=="MOVE_BY_REFERENCE_POINT"&&this.firstMove&&(e.lastSceneX=this.shoveVia.center.x,e.lastSceneY=this.shoveVia.center.y),this.shoveTool.onMouseMove(e);this.moveTo(e.sceneX,e.sceneY)}moveTo(e,r){let i=new S(e-this.oldX,r-this.oldY),n=Ae.translate(i.x,i.y,0);if(this.util!=null&&!St.getInstance().currentCoord){let a=new S(e,r),l=this.util.getMatrix(a,a);n=n.multiply4(l)}this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(n)),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(n);let s=Pr.getControl();this.tool.isMoveBox()||this.items.forEach(a=>{var l;(l=s==null?void 0:s.flushPoint)==null||l.call(s),a instanceof fr&&a.updateHelpLine()}),this.oldX=e,this.oldY=r,this.moveComponent()}moveToCenterWhenOutOfFrame(){let e=_s(this.items).build(),r=ZR();e.isInside(r)||ie.publish("adaptBBox",{bbox:e,needAdaptAll:!1})}placeTransferbeforeMoving(){if(!this.pcbPlaceTransfer)return;let e=this.pcbPlaceTransfer.positionMap||[],r=[],i=10,n=new _e;if(e.forEach(d=>{let p=d.offset,m=Di.convert(p.x,d.unit,i),g=Di.convert(p.y,d.unit,i);r.push({uniqueId:d.uniqueId,x:m,y:g}),n.ext6(m,g)}),!n.valid())return;let s=new BD({sourcePositionMap:r,targets:Array.from(this.items),config:{autoSpace:Di.convert(.5,39.37,i),maxSpace:Di.convert(3,39.37,i),minSpace:0}}).getLayouts(),a=new _e,l=n.build1().center(),h=Ma.sub(l);if(s.forEach(d=>{let p=d.component,m=d.position.sub(p.position).add(h);return p.transform(Ae.translate(m.x,m.y,0)),a.ext1(d.bbox.transform(Qe.translate1(h))),!0}),!a.valid())return;let u=a.build1().center();this.oldX=u.x,this.oldY=u.y,this.setPcbPlaceTransfer(null)}itemsMovedMouseUp(e){if(this.shoveTool){this.shoveTool.onMouseLeftUp(e),bd("default"),this.toggle();return}if(this.associationItem.complete(this.fac.getCommand()),ce.pcbConfig.moveComponent=="push"){for(let i of this.commandFactory.commands)this.fac.addCommand(i);this.commandFactory=new ve("push component")}this.fac.checkOutlines(Array.from(this.items),new Set),this.fac=new mi,this.fac.createGroup("move select for "+this.menu),bd("default");let r=new Array;this.items.forEach(i=>{r.push(i),ie.publish("hasModifyPcbItem",i)}),ie.publish("select",r),this.toggle(),ie.publish("flushService","")}itemMovingInOrder(e){if(this.curItem){let r=new S(e.sceneX-this.oldX,e.sceneY-this.oldY),i=Ae.translate(r.x,r.y,0);if(this.util!=null&&!St.getInstance().currentCoord){let n=new S(e.sceneX,e.sceneY),s=this.util.getMatrix(n,n);i=i.multiply4(s)}this.associationItem.setAllAssociationRatlinesVisible(),this.curItem.transform(i),this.curItem instanceof fr&&this.curItem.updateHelpLine(),this.oldX=e.sceneX,this.oldY=e.sceneY}}itemMovedInOrderMouseUp(e){if(this.curItem)if(this.fac.checkOutlines([this.curItem],new Set),ie.publish("hasModifyPcbItem",this.curItem),this.itemsSortByDesignator.length>1){this.itemsSortByDesignator.splice(0,1),ie.publish("refreshTearDrop",""),this.fac=new mi,this.fac.createGroup("move select for "+this.menu),this.setCurItem();let i=this.curItem.buildBBox().center();this.oldX=i.x,this.oldY=i.y,ie.publish("flushService","")}else{this.itemsSortByDesignator.splice(0,1),this.fac=new mi,this.fac.createGroup("move select for "+this.menu),this.setCurItem(),bd("default");let r=new Array;this.items.forEach(i=>{r.push(i)}),this.isMoveInOrder=!1,this.drawing=!1,ie.publish("select",r),this.toggle(),ie.publish("flushService","")}}interrupt(){var e,r;if(this.items.size>0){(e=this.tool)==null||e.cancel();let i=()=>{dt.destroy(),bd("default"),this.items.clear(),this.drawing=!1};if(this.shoveTool){this.shoveTool.interrupt(),i(),ao.setTool(null);return}this.associationItem.interrupt();let n=new Array;this.items.forEach(s=>{n.push(s)}),this.tool.isMoveBox()||this.fac.undo(),setTimeout(()=>{let s=n.filter(a=>a.isEmpty?!1:(a.click(),!0));ie.publish("select",s),ie.publish("updateFrame","")},10),i(),this.fac=new mi,this.fac.createGroup("move select for "+this.menu),ce.pcbConfig.moveComponent=="push"&&((r=this.commandFactory)==null||r.undo()),(ce.pcbConfig.moveComponent=="block"||ce.pcbConfig.moveComponent=="push")&&(this.subPosition=null)}ao.setTool(null),this.end()}cancel(){this.interrupt(),this.toggle()}toggle(){this.isContinuousMode&&(this.menu=="MOVE_BY_CENTER_POINT"||this.menu=="MOVE_BY_ORIGIN_POINT"||this.menu=="MOVE_BY_REFERENCE_POINT")?ie.publish("toggle",{command:"MouseSelect",cmd:this.menu}):ie.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:ppe(this.items,e.adsorb).result};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"ROTATE":this.rotate(i[1]);break;case"FLIP":this.flip(i[1]);break;case"TURNOVER":this.flip2OppositeLayer();break;case"toggleAdsorb":ie.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":ie.publish("openSystemDialog","ADSORPTION",$());break}ie.publish("updateFrame","")}moveItemsToCursor(e,r){let i=this.items;switch(e){case"MOVE_BY_CENTER_POINT":{this.moveByCenterPoint();break}case"MOVE_BY_ORIGIN_POINT":i.forEach(a=>{this.oldX=a.position.x,this.oldY=a.position.y});break;case"MOVE_BY_REFERENCE_POINT":r&&(this.oldX=r.x,this.oldY=r.y);break;case"MOVE_SEQUENTIAL":i=[this.curItem];break}let n=new S(Ma.x-this.oldX,Ma.y-this.oldY),s=Ae.translate(n.x,n.y,0);this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(s)),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(s),this.oldX=Ma.x,this.oldY=Ma.y}rotate(e){if(e==="rotate_left"){this.rotateFor(this.oldX,this.oldY,ce.pcbConfig.rotate);let r=new S(this.oldX,this.oldY),i=this.curItem?[this.curItem]:this.items;this.curItem?ao.rotate(r,ce.pcbConfig.rotate,i):this.tool.rotateFor(r,ce.pcbConfig.rotate)}if(e==="rotate_right"){this.rotateFor(this.oldX,this.oldY,-ce.pcbConfig.rotate);let r=new S(this.oldX,this.oldY),i=this.curItem?[this.curItem]:this.items;this.curItem?ao.rotate(r,-ce.pcbConfig.rotate,i):this.tool.rotateFor(r,-ce.pcbConfig.rotate)}if(e==="rotate_reference_point"){this.rotateReferPointCallback=(n,s,a,l)=>{this.rotateReferPointCallback=null},this.rotateFor(this.oldX,this.oldY,ce.pcbConfig.rotate);let r=this.curItem?[this.curItem]:this.items,i={x:this.oldX,y:this.oldY,items:this.tool,executeCommand:!1};ao.rotateAssignReferPoint(i,this,null,null,this.rotateReferPointCallback.bind(this))}}flipOppositeLayer(){(this.curItem?[this.curItem]:this.items).forEach(r=>{if(r instanceof Me){let i=new S(this.oldX,this.oldY).sub(r.position);Io(r.layerId)?r.layerId=2:r.layerId=1,r.position=r.position.add(i.add(new S(i.x,-i.y)))}})}flip2OppositeLayer(){!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype||ls.getInstance().init(this.items,"flip to OppositeLayer",(e,r)=>{let i=!1;for(let n of e)n instanceof Me&&(r.addCommand4Item(n,"modify"),Io(n.layerId)?n.layerId=2:n.layerId=1,n.click(),i=!0);i&&r.execute()})}flip(e){var r;switch(Yo.setTool(this),(r=this.tool)==null||r.sycn(),e){case"FLIP_LEFTANDRIGHT":Yo.turn(this.items,!1,!1,new S(this.oldX,this.oldY));break;case"FLIP_UPANDDOWN":Yo.turn(this.items,!0,!1,new S(this.oldX,this.oldY));break;case"FLIP_LEFTANDRIGHT_BY_REFER_POINT":{let i={items:this.items};Yo.turnByReferPoint(i,this);break}case"FLIP_UPANDDOWN_BY_REFER_POINT":{let i={items:this.items,isTurnUpsideDown:!0};Yo.turnByReferPoint(i,this);break}}}setCenter(e,r){this.oldX=e,this.oldY=r}rotateFor(e,r,i){let n=Ae.translate(-e,-r,0).rotateZ(i).translate1(e,r,0);this.alreadyRotate=!0,this.shoveTool!=null?this.shoveTool.removeConnectTrack():this.associationItem.interrupt(),this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(n))}moveComponent(){if(this.allMoveComponents==null&&(this.allMoveComponents=Array.from(this.items).filter(e=>e instanceof Me)),this.items.size==this.allMoveComponents.length&&this.allMoveComponents.length>0&&ce.pcbConfig.moveComponent!=="ignore"){let e=[],r=Ab(),i=this.allMoveComponents[0].model.buildBBox(),n=new S(i.minX,i.minY),s=new S(i.maxX,i.maxY);if(this.allMoveComponents.forEach(h=>{if(!this.subPosition){let d=h.position;this.subPosition=new S(this.oldX,this.oldY).sub(d)}e.push(`${ur}${h.number}`);let u=h.model.buildBBox();n=new S(Math.min(n.x,u.minX),Math.min(n.y,u.minY)),s=new S(Math.max(s.x,u.maxX),Math.max(s.y,u.maxY))}),new Set(e).size!==e.length)return;let a=new S(n.x,s.y),l=new S(s.x,n.y),c=new vs(this.allMoveComponents[0].layerId,n,a,l,s,this.allMoveComponents[0].locked);switch(ce.pcbConfig.moveComponent){case"push":this.commandFactory.undo(),this.commandFactory=new ve("push component");let h=new Map;JG(c,this.commandFactory,r,h,e,this.allMoveComponents),h.clear();break;case"block":$G(c,r,this.allMoveComponents);break}this.allMoveComponents.forEach(h=>{this.menu=="MOVE_BY_CENTER_POINT"?(this.oldX=h.position.x-this.subPosition.x,this.oldY=h.position.y-this.subPosition.y):(this.oldX=h.position.x+this.subPosition.x,this.oldY=h.position.y+this.subPosition.y)})}}setPcbPlaceTransfer(e){this.pcbPlaceTransfer=e||null}};var AAe=class{constructor(){this.line1=null;this.line2=null;this.line3=null;this.line4=null}getTimer(){return this.timer}setTimer(t){this.timer=t}show(t){let e=ce.themeConfig.canvasTheme,r=e.isSolidLine(e.cursorLineStyle),i=e.cursorColor;this.line1=new hr(1002,t.LL(),t.UL(),r,i),this.line2=new hr(1002,t.UL(),t.UR(),r,i),this.line3=new hr(1002,t.UR(),t.LR(),r,i),this.line4=new hr(1002,t.LR(),t.LL(),r,i)}click(){this.line1!=null&&this.line1.click(),this.line2!=null&&this.line2.click(),this.line3!=null&&this.line3.click(),this.line4!=null&&this.line4.click()}visible(){this.line1!=null&&this.line1.visible(),this.line2!=null&&this.line2.visible(),this.line3!=null&&this.line3.visible(),this.line4!=null&&this.line4.visible()}remove(){this.line1!=null&&(this.line1.remove(),this.line1=null),this.line2!=null&&(this.line2.remove(),this.line2=null),this.line3!=null&&(this.line3.remove(),this.line3=null),this.line4!=null&&(this.line4.remove(),this.line4=null)}},Yw=new AAe;var _Ae=class{constructor(){this.lineArr=[];this.circleArr=[];this.pointArr=[];this.rectArr=[];this.arcArr=[];this.fac=new _e}show(t,e={r:255,g:255,b:255,alpha:.8},r){let i=ee.build(e.r,e.g,e.b,e.alpha);switch(t.type){case"arc":let n=new S(t.startX/10,t.startY/10),s=new S(t.endX/10,t.endY/10),a=t.angle,l=new ro,{center:c,radius:h,startAngle:u,endAngle:d,sweep:p}=l.pointToAngle(n,s,a),m=new yh(cr(),c,h,u,d,p,{layerId:1002,strokeWidth:r/10,locked:!1}),g=new vt(m),y=new Jp(cr(),"Line",1002,[m],r/10,null,!1,null,null),b=new ct(y,[g]);b.color=i,this.arcArr.push(b),this.fac.ext1(b.buildBBox());break;case"circle":let P=new $p(cr(),"Line",1002,new S(t.x/10,t.y/10),t.r/10,r/10,!1,null,null,null),T=new Sr(P);T.color=i,this.circleArr.push(T),this.fac.ext1(T.buildBBox());break;case"line":let I=new ih(cr(),new S(t.startX/10,t.startY/10),new S(t.endX/10,t.endY/10),{layerId:1002,strokeWidth:r/10,locked:!1}),C=new mt(I),E=new Jp(cr(),"Line",1002,[I],r/10,null,!1,null,null),O=new ct(E,[C]);O.color=i,this.lineArr.push(O),this.fac.ext1(O.buildBBox());break;case"point":let _=new qi(1002,new S(t.x/10,t.y/10),!1,i);this.pointArr.push(_);let R=new ut(t.x/10,t.x/10,t.y/10,t.y/10);this.fac.ext1(R);break;case"rectangle":let v=t.top,D=t.bottom,w=t.left,F=t.right,H=(w+F)/2,z=(v+D)/2,G=Math.abs(w-F)/2,W=Math.abs(v-D)/2,L=new Zp(cr(),"Line",1002,new S(H/10-G/10,z/10+W/10),G/5,W/5,0,0,null,r/10,!1,null,null),B=new nr(L);B.color=i,this.rectArr.push(B),this.fac.ext1(B.buildBBox());break;default:break}}remove(){this.arcArr.length>0&&(this.arcArr.forEach(t=>{t.remove()}),this.arcArr=[]),this.circleArr.length>0&&(this.circleArr.forEach(t=>{t.remove()}),this.circleArr=[]),this.lineArr.length>0&&(this.lineArr.forEach(t=>{t.remove()}),this.lineArr=[]),this.pointArr.length>0&&(this.pointArr.forEach(t=>{t.remove()}),this.pointArr=[]),this.rectArr.length>0&&(this.rectArr.forEach(t=>{t.remove()}),this.rectArr=[]),this.fac.clear()}getAllTypesBBox(){return this.lineArr.length===0&&this.circleArr.length===0&&this.pointArr.length===0&&this.rectArr.length===0&&this.arcArr.length===0?null:this.fac.valid()?this.fac.build1():null}},bpe=new _Ae;function wDt(o,t,e,r=!1){let i=!ce.pcbConfig.isRebuildCopperAuto;if(!x.getInstance().isactive||x.getInstance().doctype!=3)return;let n=JSON.parse(t),s=n.workerName;o.deleteWorker(s);let a=n.pours,l=new er,c=i?r&&je.stack?je.stack:new ve("rebuild copper"):null,h=new Array;for(let T in a){let I=a[T];if(!I.needCopper)continue;let C=l.getItem(T);if(!(C instanceof Ye))continue;let E=C.getComponent();E instanceof Vn&&(E.copperResult=I.paths,c&&Te.dispatchCoppers(C,"delete",c),C.fillCopper(),h.push(C),ie.publish("hasModifyPcbItem",C),C.refreshRender())}console.time("generate thermal");let u=new DV(new Nf(new rN)),d=Object.keys(a);d.forEach(T=>u.generateThermal(T)),u.removeIsland(d).forEach(T=>{let I=Ei.getItem(T),C=l.getItem(I.getParent().globalIndex);I.remove(),C.deleteCopperById(T),ie.publish("delete",I)});let m=u.getResult(),g=Wo.getInstance();if(u.complete(),m.forEach(T=>{let I=T.getParent();I.deleteCopper(T.globalIndex),g.delete(T,T.globalIndex);let C=cr();T.globalIndex=C,I.addCopper(C),g.addModel(T),l.getItem(T.getParent().globalIndex).addNewCopperModel(T)}),console.timeEnd("generate thermal"),c)for(let T of h)Te.dispatchCoppers(T,"add",c);i?!r&&c.length>0&&(c.setCheckFilter(!1),je.executeCommand(c)):ehe(h),$t.getVisible(21)||ie.publish("showPcbSlideMsg",['Copper pour completed! Please set the "Copper Region(Filled)" to visible in the "Right Hand Panel - Filter - Display".'],$());let b=Ve.getItems().filter(T=>!T.isEmpty);ie.publish("select",b),e||ie.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),ie.publish("flushService","");let P=Ei.getAllItem();return e&&(P.length>0&&ie.windowBridge.rpcCall("save",{tabId:x.getInstance().tabId},$()),e=!1),P}function vAe(){ie.messageBus.rpcService("adaptAllAndGetBBox",o=>{let t=1,e="";typeof o=="object"?(t=o.ratio||1,e=o.tabId):o>0&&(t=o);let r=x.getInstance();if([23].includes(r.doctype))return;let i=N0();if(i!=null){let n=Ii.getBBox();if(n instanceof ut){let s=new _e;s.ext1(i),s.ext1(n),i=s.build1()}this.adaptAll(i,t),ie.publish("updateFrame","")}return this.camera.getBBox2()}),ie.messageBus.rpcService("pcbZoomToRegion",({minX:o,maxX:t,maxY:e,minY:r})=>{let i=new ut(o,t,r,e);this.adaptAll(i,1)}),ie.messageBus.rpcService("pcbZoomTo",({x:o,y:t,scaleRatio:e})=>{let r=new Mt(o,t,0);return this.camera.setTarget(r),this.camera.setScale(e),this.camera.getBBox2()}),ie.messageBus.rpcService("getPCBCanvasImg",async()=>{let{width:o,height:t}=this.camera.getCanvas();return{data:(await mf.scene.getCaptureImageData1(o,t,()=>{},()=>{})).data,width:o,height:t}}),ie.messageBus.rpcService("adaptSelectAndGetBbox",()=>{if(23==x.getInstance().doctype)return;let o=Ve.getSelects(),t=new _e;for(let e of o){if(e instanceof Me){let r=e.getAttrBBox();r&&t.ext1(r)}t.ext1(e.buildBBox())}if(t.valid()){let e=t.build1();this.adaptAll(e,.8,Math.pow(10,6))}return ie.publish("updateFrame",""),this.camera.getBBox2()}),ie.messageBus.rpcService("pcbGenerateIndicatorMarkers",o=>{let{markers:t,color:e,lineWidth:r,zoom:i}=o;if(t.forEach(n=>{bpe.show(n,e,r)}),i){let n=bpe.getAllTypesBBox();this.adaptAll(n,1)}ie.publish("updateFrame","")}),ie.messageBus.rpcService("pcbRemoveIndicatorMarkers",()=>{bpe.remove(),ie.publish("updateFrame","")}),ie.messageBus.rpcService("pcb/pcbRebuildCopperRegion",async o=>{let t=!1,e=new Set,r=pf.getInstance(),{ids:i,isLast:n}=o;if(!x.getInstance().isactive||x.getInstance().doctype!=3||Array.isArray(i)&&i.length==0)return!1;for(let u of e)if(u!="all"){let d=!0;if(u.isLast==o.isLast&&o.ids.length==u.ids.length){for(let p=0;p<u.ids.length;p++)if(o.ids[p]!=u.ids[p]){d=!1;break}}else d=!1;if(d)return!1}let s="rebuildSelectedCopper-time";pn(s,!0),ie.windowBridge.publish("pcbUpdateProgress",{ratio:0,descripte:"copper"},$());let a=new tN(i,!1);e.add(o);let l=r.addWorker(`editor?entry=pcb-worker.js${$().location.search.replace(/\?/,"&")}`),c=JSON.stringify(a.encode()),h=[];return await l.rpcCall("pourDocument",c).then(u=>{let d=wDt(r,u.message,t,n);e.delete(o),Bi(s),h=d.map(m=>({...m.toJSON(),pourPrimitiveId:m.getParent().globalIndex}))}),c=null,h})}var MN=class extends ci{constructor(e){super();this.mouseLeftX=0;this.mouseLeftY=0;this.selections=new Array;this.items=new Set;this.ctrlDown=!1;this.drawing=!0,this.cmd=e}onKeyDown(e){switch(this.ctrlDown=e.ctrlKey,sr.getAction(4,e)){case"Cancel":{this.cancel();break}case"Finish":{this.onEnterPlace(e);break}}}onKeyUp(e){this.ctrlDown&&!e.ctrlKey&&this.items.size>0&&!e.leftDown&&(A.publish("select",this.items),Ve.mouseSeleceMove(this.cmd,!0),this.end()),this.ctrlDown=e.ctrlKey}onMouseLeftDown(e){this.mouseLeftX=e.realSceneX,this.mouseLeftY=e.realSceneY,A.publish("clearSelect",""),this.start()}onMouseMove(e){let r=e.realSceneX,i=e.realSceneY;e.hovering=!0,e.hover(),e.leftDown&&this.updateSelectBox(r,i)}onMouseLeftUp(e){let r=e.realSceneX,i=e.realSceneY;if(this.selections.length>0){let n=new _e().ext6(r,i).ext6(this.mouseLeftX,this.mouseLeftY).build1();this.mouseLeftX>r?St.getInstance().flip?this.boxSelect(n,!0,e.ctrlKey):this.boxSelect(n,!1,e.ctrlKey):St.getInstance().flip?this.boxSelect(n,!1,e.ctrlKey):this.boxSelect(n,!0,e.ctrlKey),this.clearSelectBox(),e.setIsBoxSelection(!0)}else{let n=Wr.pointSelect(r,i);if(n=Array.from($t.filter(n)),!e.ctrlKey&&this.items.size==0&&n.length==1&&this.cmd=="MOVE_BY_REFERENCE_POINT"){this.select(n),A.publish("select",this.items);let s={command:"batchMoveItem",refer:new u2(Array.from(this.items),e.sceneX,e.sceneY),menu:"MOVE_BY_REFERENCE_POINT",isContinuousMode:!0};A.publish("toggle",s);return}else this.select(n)}!e.ctrlKey&&this.items.size>0&&(A.publish("select",this.items),Ve.mouseSeleceMove(this.cmd,!0),this.end())}select(e){for(let r of e)this.items.has(r)?(r.visible(),this.items.delete(r)):(r.click(),this.items.add(r))}boxSelect(e,r,i){let n=new Array;r?n=this.leftToRight(e):n=this.rightToLeft(e),n=Wr.filterPartiton(n),this.select(n)}clearSelectBox(){for(let e of this.selections)e.remove();this.selections.length=0}updateSelectBox(e,r){let i=ce.themeConfig.canvasTheme,n=i.isSolidLine(i.selectBoxLineStyle),s=i.selectBoxColor;if(this.selections.length>0)this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(e,this.mouseLeftY),this.selections[1].start=new S(e,this.mouseLeftY),this.selections[1].end=new S(e,r),this.selections[2].start=new S(e,r),this.selections[2].end=new S(this.mouseLeftX,r),this.selections[3].start=new S(this.mouseLeftX,r),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY);else{let a=new hr(1002,new S(this.mouseLeftX,this.mouseLeftY),new S(e,this.mouseLeftY),n,s),l=new hr(1002,new S(e,this.mouseLeftY),new S(e,r),n,s),c=new hr(1002,new S(e,r),new S(this.mouseLeftX,r),n,s),h=new hr(1002,new S(this.mouseLeftX,r),new S(this.mouseLeftX,this.mouseLeftY),n,s);this.selections.push(a),this.selections.push(l),this.selections.push(c),this.selections.push(h)}}leftToRight(e){let r=$t.filterElement(Wr.getSelectInside(Ol(e),{boxChoose:!1,isBBox:!0}),{boxChoose:!0});return Array.from(r)}rightToLeft(e){let r=$t.filterElement(Wr.getSelectContect(Ol(e),{boxChoose:!0,isBBox:!0}),{boxChoose:!0});return _P(r)}interrupt(){for(let e of this.items)e.visible();this.items.clear(),this.clearSelectBox()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var MDt=20,NDt=16,kDt=24,BDt={detectionSize:50,detectionAwaitingTime:300,detectionIgnoreRule:!1,panningStep:30,altPanningStep:100,panningFrequency:.5,panningFrequencyRange:[2,30],panningModel:0,variableSpeedRatioRange:[.5,2]},k9=class o{static getInstance(){return this._instance||(this._instance=new o),this._instance}constructor(){this.options=Object.assign({},BDt),this.initState()}initState(){this.env=null,this.state=0,this.lastAdsorb=!1,this.bindingAfterPanningCall(null)}checking(t,e,r){let i=this.state;if(!t||i==2)return!1;this.state=2,this.updateOptions(e),this.bindingAfterPanningCall(r);let{detectionSize:n,detectionAwaitingTime:s,detectionIgnoreRule:a,panningModel:l,variableSpeedRatioRange:c}=this.options,u=x.getInstance().openRuler,d=we.isShowBottomLayerScrollBarShow,p=a?0:MDt,m=NDt,g=kDt,y=u?p:0,b=0,P=u?p:0,T=(d?m:0)+g,{canvasWidth:I,canvasHeight:C,mouseX:E,mouseY:O,altKey:_}=t,R=E-y,v=I-E-b,D=O-P,w=C-O-T,F=0;this.isOneDetectionRange(R)?F=1:this.isOneDetectionRange(v)&&(F=-1);let H=0;this.isOneDetectionRange(D)?H=-1:this.isOneDetectionRange(w)&&(H=1);let z=F!=0||H!=0,G=1;if(l==1&&z){let W=Math.min(c[0],c[1]),L=Math.max(c[0],c[1]);if(F!=0){let B;F==1?B=(n-R)/n:B=(n-v)/n,G=W+(L-W)*B}else if(H!=0){let B;H==-1?B=(n-D)/n:B=(n-w)/n,G=W+(L-W)*B}}return this.refreshEnv({horizontalIndex:F,verticalIndex:H,variableSpeedRatio:G,hasAltKey:_}),this.state=i,i==0?(z||(this.state=1),!1):(i==1?z&&(this.state=3,this.awaitingTimer=setTimeout(()=>{this.panning()},s)):(i==3||i==4)&&(z||this.ending()),z)}getAutoPanningOptions(t){if(!t)return null;let e={},{type:r,speed:i,step:n,altStep:s}=t,a=r==null?void 0:r.value;a=="uniformTranslation"?e.panningModel=0:a=="variableSpeedTranslation"&&(e.panningModel=1);let l=i==null?void 0:i.value;l>=0&&l<=100&&(e.panningFrequency=l/100);let c=n==null?void 0:n.value;c>0&&(e.panningStep=c);let h=s==null?void 0:s.value;return h>0&&(e.altPanningStep=h),e}updateOptions(t){if(!t)return;let e=t.panningFrequency;(e||e==0)&&(e=Math.max(0,Math.min(e,1)),t.panningFrequency=e),this.options=Object.assign(this.options,t)}bindingAfterPanningCall(t){this.afterPanningCall=t}refreshEnv(t){this.env=t}refreshInputEnv(t){let e=this.env;if(!e||!t||this.state==0||this.state==1)return;let r=t.keyCode;if([27,123].includes(r)){this.ending();return}let s=r==18;s&&(e.hasAltKey=s)}isOneDetectionRange(t){let e=this.options.detectionSize;return t>=0&&t<=e}panning(){let{horizontalIndex:t,verticalIndex:e,variableSpeedRatio:r,hasAltKey:i}=this.env,{panningStep:n,altPanningStep:s,panningFrequency:a,panningFrequencyRange:l}=this.options,c=i?s:n,h=Math.min(l[0],l[1]),u=Math.max(l[0],l[1]),d=h+(u-h)*a,p=d*r,m=1/p*1e3;we.adsorb&&(we.adsorb=!1,A.publish("toggleAdsorb","isFalse"),this.lastAdsorb=!0),this.state=4;let y=t*c,b=e*c;Ni().addOffset1(y,-b),console.log("auto panning",{moveOffsetX:y,moveOffsetY:b,uniformPanningFrequency:d,variablePanningFrequency:p,finalPanningTime:m}),this.afterPanningCall&&this.afterPanningCall(),this.panningTimer=setTimeout(()=>{this.panning()},m)}ending(){this.state==0||this.state==1||(this.lastAdsorb&&(we.adsorb=!0,A.publish("toggleAdsorb","isTrue")),this.initState(),clearTimeout(this.awaitingTimer),clearTimeout(this.panningTimer))}};var Ppe=class{constructor(t,e){this.profile=t,this.groupCommand=e||new ve("Execute Edit outLine")}set polyline(t){this._polyline=t}get polyline(){return this._polyline}getSpiltInfo(t){let e=new Array,r=new Array,i=new Array,n=0;for(let s of t)if(s.inter.length>0){let a=nD(s.pt,s.inter);switch(n){case 0:{if(e.push(a[0]),a.length==2)r.push(a[1]),n=1;else if(a.length==3)r.push(a[1]),i.push(a[2]),n=2;else throw new Error("data error!!");break}case 1:{if(r.push(a[0]),a.length==2)i.push(a[1]),n=2;else throw new Error("data error!!");break}default:{i.push(s.pt);break}}}else switch(n){case 0:{e.push(s.pt);break}case 1:{r.push(s.pt);break}default:{i.push(s.pt);break}}return{firstPts:e,secondPts:r,lastPts:i}}getSpiltPts(t,e,r,i){if(t[t.length-1].end().equals1(i)){let n=fe.build2(t.concat(this.polyline.primitives).concat(r)),s=fe.build2(e),a=fe.build2(this.polyline.primitives.concat(s.reverse().primitives));return n.area()>0&&(n=n.reverse()),a.area()>0&&(a=a.reverse()),{polyline1:n,polyline2:a,needSavePl:a}}else{let n=fe.build2(t.concat(this.polyline.reverse().primitives).concat(r)),s=fe.build2(this.polyline.primitives.concat(e));return n.area()>0&&(n=n.reverse()),s.area()>0&&(s=s.reverse()),{polyline1:n,polyline2:s,needSavePl:n}}}handleEditResult(t,e,r,i){let n,s=this.handleOutLine(r,t,e),{firstPts:a,secondPts:l,lastPts:c}=this.getSpiltInfo(s),{polyline1:h,polyline2:u,needSavePl:d}=this.getSpiltPts(a,l,c,t),p=No(h),m=No(u);if(p&&m){this.sendMessage();return}if(p)n=this.createPolygon(u,i);else if(m)n=this.createPolygon(h,i);else{let g,y=Math.abs(h.area()),b=Math.abs(u.area());Math.abs(y-b)<1e-6?g=d:g=y>b?h:u,n=this.createPolygon(g,i)}this.inherit(n),(this.profile instanceof nr||this.profile instanceof Sr)&&(this.addCommand(n,"add"),this.addCommand(this.profile,"delete"),this.profile.remove(),A.publish("delete",this.profile)),A.publish("hasModifyPcbItem",this.profile),A.publish("autoFill",""),A.publish("updateRtree",""),A.publish("updateFrame",""),A.publish("select",[n]),je.executeCommand(this.groupCommand),this.resetState()}inherit(t){if(t instanceof Ye&&!(this.profile instanceof ct)){this.profile instanceof Ye&&this.profile.getComponent()&&t.setComponent(this.profile.getComponent().clone()),this.profile.net&&(t.net=this.profile.net);let e=te.getInstance().getRegion(this.profile.globalIndex);e&&te.getInstance().addRegionSelectorByRuleModel(t.globalIndex,e.clone());let r=kt.getItem(this.profile.getGroupID());if(r&&r.addItem(t),this.profile.type==="Copper Region"){let i=gn.getOrder(this.profile.globalIndex);i&&gn.setOrder(t,i,this.groupCommand)}}t instanceof Ye&&t.type=="Copper Region"&&A.publish("rebuildSingleCopper",{ids:[t.globalIndex],isLast:!1,isManual:!0})}sendMessage(){A.publish("ui/toastMsg",{type:"warn",msg:"Edit failed. Unable to determine the retained outline. Please try again!"},$())}handleOutLine(t,e,r){let i=new Array,n=!1,s=!1;for(let a of t.primitives){let l={pt:a,inter:[]};a instanceof M?(!n&&oD(a,e)&&(l.inter.push(e),n=!0),!s&&oD(a,r)&&(l.inter.push(r),s=!0),l.inter.length>1&&dn(l.inter,l.pt)):a instanceof q&&(sD(a,e)&&l.inter.push(e),sD(a,r)&&l.inter.push(r)),i.push(l)}return i}createPolygon(t,e){let r;if(this.addCommand(this.profile,"modify"),this.profile instanceof fn)this.profile.setChildrens(t);else if(this.profile instanceof nr||this.profile instanceof Sr)r=new au().create4Pl(this.profile.type,this.profile.layerId,t,this.profile.strokeWidth,this.profile.net,this.profile.locked);else if(this.profile instanceof ct){let i=new io;this.profile.removeChildByIndex(e);let n=this.profile.getChildrens();e&&(t=t.reverse());let s=[];for(let a of t.primitives){let l=i.ptToShape(a);s.push(l)}n[e]=s,this.profile.setChildrens(n)}return r||this.profile}addCommand(t,e="add"){let r=Te.dispatch(t,e);this.groupCommand.addCommand(r)}resetState(){this._polyline=null,this.profile=null,this.groupCommand=new ve("Execute Clip Polyline")}};function bqe(o,t){let e=new Jt;return t&&e.add("COMPLETE"),e.add("CANCEL"),t&&e.add("REGRESSION"),e.addExtend("WIRING_CORNER",KS(tr.getInstance().type)),e.add("toggleAdsorb",!1,o),e.add("ADSORBENT_CONFIG"),e.result}var kU=class extends ci{constructor(e){super();this.msg="Please select a starting point";this.started=!1;switch(this.type="Segment",e.click(),this.profile=e,this.event=new Hu,this.event.needClose=!1,this.resultEvent=new bg(this.type),this.resultEvent.shouldAddHistory=!1,tr.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.event.commands=new ve("draw 2DLine - "+this.type),this.event.drawScene=this.type,this.event.isEditOutLine=!0,jr.addDrawTool(this),this.drawing=!0}onMouseLeftUp(e){if(this.start(),this.started){if(this.isCanFinish(e)){this.drawPolygon.onMouseLeftUp(e),this.completed(e);return}}else this.startPoint=new S(e.sceneX,e.sceneY),this.getEditOutLine(),jt.cancel(),this.started=!0;this.drawPolygon.onMouseLeftUp(e)}onMouseMove(e){this.started?this.drawPolygon.onMouseMove(e):jt.update(e,this.msg)}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.started&&this.isCanFinish(e)?this.completed(e):this.onEnterPlace(e);break;case"Backspace":this.backspace();break;case"changeRoutingAngle":case"Routing Corner":this.wireCorner(jr.getNextType()),Hi();break;case"Filp Path While Drawing":this.drawPolygon.onKeyDown(e);break}}completed(e){var s;if(this.drawPolygon.completed(!1),!((s=this.resultEvent)!=null&&s.profileRes)||this.resultEvent.profileRes.length===0){console.warn("EditOutline2: \u8F6E\u5ED3\u6570\u636E\u672A\u751F\u6210\uFF0C\u672A\u8FDB\u884C\u79FB\u52A8\u64CD\u4F5C"),this.cancel();return}let r=this.resultEvent.profileRes[0],i=this.resultEvent.profileRes[0].getMathGraphics().primitives,n=fe.build2(i);r.remove(),A.publish("delete",r),q1.displayPolyline(n),this.editOutLineUtils.polyline=n,this.editOutLineUtils.handleEditResult(this.startPoint,this.endPoint,this.currentEditOutLine,this.outLineIndex),q1.clear(),jt.cancel(),this.resultEvent.profileRes.length=0,this.drawing=!1,A.publish("tool","dropdrag"),this.end()}interrupt(){let e=this.editOutLineUtils.polyline;q1.displayPolyline(e),q1.clear(),this.profile.visible(),jt.cancel(),this.drawPolygon.cancel(),this.drawing=!1}backspace(){this.drawPolygon.backspace()}cancel(){this.event.shape.length>0?this.backspace():(this.interrupt(),this.nextTool=null,this.event=null,this.drawPolygon.cancel())}restoreCurrentInitState(){var e;(e=this.event)==null||e.commands.undo(),this.event=new Hu}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.event.shape.length>0&&this.isCanFinish(e)?this.completed(e):this.interrupt():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.event.shape.length>0&&this.isCanFinish(e)?this.completed(e):this.interrupt();break}}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:bqe(e.adsorb,this.started)};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed(Pi.getInstance());case"CANCEL":this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":{this.wireCorner(i[1]),Hi();break}case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),tr.getInstance().type=e,we.synchronize()}wireMode(){}initUtils(e){this.editOutLineUtils=new Ppe(e)}isCanFinish(e){let r=new S(e.sceneX,e.sceneY);if(this.profile instanceof ct){for(let i of this.profile.getAllChildrens())if(this.getEndPoint(i.primitive,r),this.endPoint)return!0}else if(this.profile instanceof nr||this.profile instanceof Sr||this.profile instanceof fn){let i=this.profile.getMathGraphics().primitives;for(let n of i)if(this.getEndPoint(n,r),this.endPoint)return!0}return!1}getEndPoint(e,r){let i=!1;if(e instanceof M&&Gue(e,r,this.profile.strokeWidth)&&(i=!0),e instanceof q&&Uue(e,r,this.profile.strokeWidth)&&(i=!0),i){let s=new io().ptToShape(e);return this.endPoint=di.getNearestOutlineObjPointInfo(r,s,["Line Center"]).point,s.remove(),!0}return!1}getEditOutLine(){let e=this.profile.getMathGraphics();if(e instanceof fe)this.outLineIndex=0,this.currentEditOutLine=e;else for(let r=0;r<e.items.length;r++){let i=!1;for(let n of e.items[r].primitives)if(n instanceof M?i=oD(n,this.startPoint):n instanceof q&&(i=sD(n,this.startPoint)),i)break;if(i){this.outLineIndex=r,this.currentEditOutLine=e.items[r];break}}}};function Pqe(o){let t=new Jt;return t.add("CANCEL",!0),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t}var BU=class o{static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}constructor(){this.mode="ShortestPath",this._pushTrack=!0}set glossMode(t){this.mode=t}get glossMode(){return this.mode}get pushTrack(){return this._pushTrack}set pushTrack(t){this._pushTrack=t}};var Tpe=class{constructor(t,e=!1){this.events=[];this.commands=new ve("track average");let r=this.getAllCoCurrentTrack(t);if(!r)return;r=this.sortTracks(r),r.forEach(s=>{let a=new cu(s);a.setMultiRepair(!0),this.events.push(a)});let{average:i,direct:n}=this.getAverageAndDirect();this.move(i,n,e)}getAverageAndDirect(){let t=this.events[0].oldStart,e=this.events[this.events.length-1].oldStart,r=this.events[0].direct,i=r.cross(e.sub(t)),n;return i>0?n=new S(r.y,-r.x):n=new S(-r.y,r.x),{average:Math.abs(i)/(this.events.length-1),direct:n}}move(t,e,r=!1){let i=this.events,n=i[0],s=n.direct,a=new Dw;for(let l=1;l<i.length-1;l++){let c=i[l],u=Math.abs(s.cross(n.start.sub(c.start)))-t*l;c.lastRealMousePosition=c.start;let d=c.getTool();l0.needclearWireCache=!1,d.moveOffset(e.mul(u)),a&&a.addPathListByTool(d),d.complete()}r?a.shove():a.obstruct(),i.forEach(l=>{l.complete(this.commands)}),cu.complete2(this.commands),je.executeCommand(this.commands),cu.clear()}sortTracks(t){let e=t[0].direct,r=t[0].start,i=[];return t.forEach(n=>{let a=n.start.sub(r),l=e.cross(a);i.push({track:n,dis:l})}),xr(i,(n,s)=>n.dis-s.dis,0,i.length),i.map(n=>n.track)}getAllCoCurrentTrack(t){let e=a=>a.direct,r=[];if(t.forEach(a=>{let l=e(a),c=!1;if(r.forEach(h=>{let{tracksInfo:u,direct:d,matrix:p,bbox:m}=h;if(l.length()>0&&Math.abs(l.cross(d))<.001){let g=a.start.multiply4(p),y=a.end.multiply4(p),b=new ut(Math.min(g.x,y.x),Math.max(g.x,y.x),0,0),P=m.intersection1(b);u.push({track:a,interBox:P})}}),!c&&l.length()>0){let h=Ae.translate(-a.start.x,-a.start.y,0).rotateZ(-l.angle(S.ORIGIN)),u=a.end.multiply4(h),d=new ut(Math.min(0,u.x),Math.max(0,u.x),0,0),p=new Array;p.push({track:a,interBox:d}),r.push({tracksInfo:p,direct:l,bbox:d,matrix:h})}}),r.length<=0)return;xr(r,(a,l)=>l.tracksInfo.length-a.tracksInfo.length,0,r.length);let i=r[0].tracksInfo;if(i.length<=2)return;xr(i,(a,l)=>a.interBox!=null&&l.interBox!=null?l.interBox.width()-a.interBox.width():a.interBox==null&&l.interBox!=null?l.interBox.width():a.interBox!=null&&l.interBox==null?-a.interBox.width():1,0,i.length);let n=new Set;return i.filter(a=>{let{track:l}=a;if(n.has(l))return!1;let c=new jf(l,!1);for(let h of c.all)h instanceof Ar&&n.add(h);return!0}).map(a=>a.track)}};var Ipe=class{constructor(t,e=!1){this.extendsSize=10;this.events=[];this.commands=new ve("track average");let r=this.getValidTrack(t);!r||r.length<1||(r.forEach(i=>{let n=new cu(i);n.setMultiRepair(!0),this.events.push(n)}),this.move(e))}getValidTrack(t){let e=new Set;return t.filter(i=>{if(e.has(i))return!1;let n=new jf(i,!1);for(let s of n.all)s instanceof Ar&&e.add(s);return!0})}move(t=!1){let e=this.events,r=new Dw;r.initClear();for(let i=0;i<e.length;i++){let n=e[i],s=n.track,a=this.getTrackMoveDis(s);n.lastRealMousePosition=n.start;let l=n.getTool();l0.needclearWireCache=!1,l.moveOffset(a),r&&r.addPathListByTool(l),l.complete()}t?r.shove():r.obstruct(),e.forEach(i=>{i.complete(this.commands)}),cu.complete2(this.commands),je.executeCommand(this.commands),cu.clear()}getTrackMoveDis(t){let e=t.buildBBox();e=e.extendOfSize(this.extendsSize);let i=Vt.search(e,(h,u)=>u=="Pad").pads,n=[],s=[],a=t.direct,l=X_;if(i.forEach(h=>{let u=be.getLayer(h.layerId);if(h.layerId!=t.layerId&&u.type!="MULTI")return;let d=l.getMinDistResultAboutElementAndElement(t,h,"CENTER","EDGE",t.layerId,t.layerId),p=a.cross(h.center.sub(t.start)),m;if(!d.minline||ne.eq(d.minDistValue,0))m=0;else{let g=!!d.swap,y,b;g?(y=d.minline.start(),b=d.minline.end()):(y=d.minline.end(),b=d.minline.start()),m=a.cross(y.sub(b)),ne.lesseq(p*m,0)&&(m=0)}p<0?s.push({item:h,dis:Math.abs(m),area:p}):n.push({item:h,dis:m,area:p})}),n.length>0&&s.length>0){c(n),c(s);let h=n[0],u=s[0],d;if(ne.eq(h.dis,0)||ne.eq(u.dis,0)){if(!ne.eq(h.dis,u.dis)){let y=l.getMinDistResultAboutElementAndElement(h.item,u.item,"EDGE","EDGE",t.layerId,t.layerId),b,P;ne.eq(y.minDistValue,0)||(!!y.swap?(b=y.minline.end(),P=y.minline.start()):(b=y.minline.start(),P=y.minline.end()));let T=a.cross(b.sub(P));if(T>0){let I=T/2;if(ne.eq(h.dis,0)){let C=new S(a.y,-a.x),E=u.dis-I;return C.mul(E)}else{let C=new S(-a.y,a.x),E=h.dis-I;return C.mul(E)}}}d=Math.abs(h.area)+Math.abs(u.area),h.dis=h.area,u.dis=u.area}else d=Math.abs(h.dis)+Math.abs(u.dis);let p=d/2,m=new S(-a.y,a.x),g=h.dis-p;return m.mul(g)}return new S(0,0);function c(h){xr(h,(u,d)=>u.item.layerId==t.layerId&&u.item.layerId==d.item.layerId?u.dis-d.dis:u.item.layerId==t.layerId?-1:d.item.layerId==t.layerId?1:u.dis-d.dis,0,h.length)}}};var Cpe=class{constructor(t){this.bheap=new Array;this.count=0;this.comp=t}clear(){this.count=0,this.bheap.length=0}toArray(){return this.bheap}size(){return this.count}add(t){this.count>0?this.siftUp(this.count,t):this.bheap[0]=t,this.count++}poll(){for(;;)if(this.count>0){this.count--;let t=this.bheap[0];return this.count>0&&this.siftDown(0,this.bheap[this.count]),t}else return null}siftUp(t,e){for(;t>0;){let r=t-1>>>1,i=this.bheap[r];if(this.comp(e,i)>=0)break;this.bheap[t]=i,t=r}this.bheap[t]=e}siftDown(t,e){let r=this.count>>>1;for(;t<r;){let i=(t<<1)+1,n=this.bheap[i],s=i+1;if(s<this.count){let a=this.bheap[s];this.comp(n,a)>0&&(i=s,n=a)}if(this.comp(e,n)<=0)break;this.bheap[t]=n,t=i}this.bheap[t]=e}};var xAe=class extends S{constructor(e,r){super(e,r);this.F=0;this.G=0;this.H=0;this.index=0;this.direct=new S(1,0);this.parent=null;this.modCount=0;this.candidateNodes=new Array;this.jump=!1;this.draw=!0}calcF(){this.F=this.G+this.H}},X$=class{constructor(t){this.node=t,this.modCount=t.modCount}notChanged(){return this.modCount===this.node.modCount}};function VDt(o,t){return o.node.F-t.node.F}var GDt=Math.cos(Math.PI/4),FU=class{constructor(t,e,r,i,n,s=!1){this.queue=new Cpe(VDt);this.closeSet=new Set;this.tool=new no;this.lines=new Array;this.timeout=performance.now()+e,this.setting=r,this.canReach=i;let a=new Array,l=0,c=new S(1,0),h=null,u=null;for(let m of t){let g=new xAe(m.x,m.y);if(g.index=l,h!=null)switch(c=g.sub(h).normalize(),h.direct=c,this.setting){case"STRONG":break;case"WEAK":default:{if(u!=null){let y=c.dot(u.direct);ne.greatereq(y,GDt)&&(u.jump=!0,u.candidateNodes.push(h))}u=h;break}}a.push(g),h=g,l++}let d=a[0],p=a[a.length-1];for(s&&(d.direct=d.direct.multiply3(Qe.ROT_90));a.length>0;){let m=a.shift();m.jump||Re.addAll(m.candidateNodes,a)}this.end=this.findPath(d,p),n&&!p.equals1(this.end)&&(this.end=p)}connect(){let t=this.end,e=new Array;if(t!=null)for(e.push(t);t.parent!=null;)t=t.parent,e.push(t);let r=new Array,i=e.length;if(i>0){let n=e[0];for(let s=1;s<i;s++){let a=e[s],l=[];if(n.draw){let c=n.direct.mul(-1);l=this.tool.degree45(c,n,a)}else l=[n,a];for(let c of l)r.push(c.clone());n=a}r=Ku(r)}return r.reverse()}getLen(){return this.end.G}findPath(t,e){let r=null,i=Number.MAX_VALUE;for(this.queue.add(new X$(t));;){let n=this.findMinFNodeInOpneList();if(n!=null&&!n.equals(t)&&n.F+n.H<=i&&(i=n.F+n.H,r=n),n!==null){if(n.equals(e))return n;if(this.closeSet.has(n))continue;this.closeSet.add(n),n.modCount++;let s=this.findNeighborNodes(n);for(let a of s){let l=a.node;l.parent?this.foundPoint(n,l,a.direct,a.points):l=this.notFoundPoint(n,e,l,a.direct,a.points)}}else return r}}findMinFNodeInOpneList(){for(;;){let t=this.queue.poll();if(t===null)return null;if(t.notChanged())return t.node}}findNeighborNodes(t){let e=t.candidateNodes,r=new Array;for(let i of e)this.checkNextNode(t,r,i);if(r.length==0&&e[0]){e[0].draw=!1;let i=new S(e[0].x,e[0].y);r.push({node:e[0],direct:t.direct,points:[new S(t.x,t.y),i,i]})}return r}checkNextNode(t,e,r){let i=t.direct,n=this.degree45(i,t,r),s=n.points;if(!this.closeSet.has(r)){if(this.canReach(s[0],s[1],s[2]))e.push({node:r,direct:i,points:s});else if(n.other){s=n.other;let a=s[1].sub(s[0]).normalize();a.dot(i)>0&&this.canReach(s[0],s[1],s[2])&&e.push({node:r,direct:a,points:s})}}}degree45(t,e,r){let i=this.tool.degree45Model(e,r),n=i[0].sub(e);if(ne.eq(n.x,0)&&ne.eq(n.y,0))return{points:[e,i[1],r],other:null};let s=i[1].sub(e);if(ne.eq(s.x,0)&&ne.eq(s.y,0))return{points:[e,i[0],r],other:null};n=n.normalize(),s=s.normalize();let a=Math.acos(t.dot(n)),l=Math.acos(t.dot(s));return a>l?{points:[e,i[1],r],other:[e,i[0],r]}:{points:[e,i[0],r],other:[e,i[1],r]}}foundPoint(t,e,r,i){let n=this.calcG(t,r,i),s=n.G;s<e.G&&(e.parent=t,e.direct=n.lastDirect,e.G=s,e.calcF(),e.modCount++,this.queue.add(new X$(e)))}notFoundPoint(t,e,r,i,n){r.parent=t;let s=this.calcG(t,i,n);return r.G=s.G,r.direct=s.lastDirect,r.H=this.calcH(e,r),r.calcF(),r.modCount++,this.queue.add(new X$(r)),r}calcG(t,e,r){let i=r[0].distance1(r[1])+r[1].distance1(r[2]),n=0;!r[0].equals1(r[1])&&!r[1].equals1(r[2])&&(n+=.01);let s=r[2].equals1(r[1])?r[2].sub(r[0]).normalize():r[2].sub(r[1]).normalize();return ne.eq(t.direct.cross(e),0)||(n+=.01),{G:t.G+i+n,lastDirect:s}}calcH(t,e){return 0}};var VU=class extends Bh{constructor(){super();this.path=[];this.shortLine=[]}addLine(e,r,i,n){this.path.push([new eo(e,{color:ee.GREEN,info:{canReach:i}}),new eo(r,{color:ee.GREEN,info:{canReach:n}})])}addPreLine(e,r){let i=new M(e[0],e[1]),n=new M(e[1],e[2]);this.shortLine.push([new eo(i,{color:ee.GREEN,info:{len:r}}),new eo(n,{color:ee.GREEN})])}displayPath(e){var r;(r=this.path[e])==null||r.forEach(i=>{i.display()}),ie.publish("updateFrame","")}display(){for(let e of this.path)e.forEach(r=>{r.display()});for(let e of this.shortLine)e.forEach(r=>{r.display()})}remove(){for(let e of this.path)e.forEach(r=>{r.remove()});for(let e of this.shortLine)e.forEach(r=>{r.remove()})}};var Spe=class{constructor(){this.commands=new Br;this.optimizationList=[];this.blockShape=new As;this.canPush=!0}getCommand(){return this.commands}runChain(t,e,r=!0){this.init(),this.pathList=t,this.trackInfo=e,this.canPush=r,this.getMinList(),this.run(this.optimizationList);let i=ji.getInstance().view4Status(_r.getInstance().current);if(this.commands.addCommand(i),_r.getInstance().clear(),jg("45"),this.canPush){let a=this.pushWire();this.setPushFilter(),a||(this.run(this.optimizationList),this.getMinPathByBlock())}else this.setPushFilter(),this.getMinPathByBlock();_r.getInstance().clear(),hi.getInstance().update();let n=this.optimization2(this.commands),s=ji.getInstance().view4Status(_r.getInstance().current);return this.commands.addCommand(s),_r.getInstance().clear(),Jl.getInstance().clear(),Xg(),this.getResultIds(n)}optimization2(t){let e=Array.from(this.optimizationList);e.forEach(n=>{this.setInputStatus(n)});let i=new PC(e,"SUPER",new S(1,0),performance.now()+1e5).optimize(!0);return t.addCommand(i),this.pathList}optimization(t){let e=this.pathList.filter(i=>!this.optimizationList.includes(i));return this.generateMinList(t).forEach((i,n)=>{let s=this.optimizationList[n];i.replace(s.getFirstNode(),s.getLastNode()),t.addCommand(new Ti(i)),e.push(s)}),e}init(){Yr.init(),Ra.getInstance().clear(),Fr.getInstance().clear(),Os.getInstance().clear(),Jl.getInstance().init()}showPath(t){t.getAllItems().forEach(r=>{_r.getInstance().current.setTrackVisible(r.globalIndex)})}getResultIds(t){let e=[];return t.forEach(r=>{let i=r.getAllItems();e.push(...i.map(n=>n.globalIndex))}),e}generateMinList(t){let e=Array.from(this.optimizationList),r=0,i=[],n=new Br;return e.forEach(s=>{this.hidePath(s);let a=this.generateMinListPoints(s),l=a.path,c=s.getFirst(),h=this.getListByPoints(l,c,n);r+=a.len?a.len:this.getListLen(h),i.push(h)}),t.addCommand(n),i}getListLen(t){let e=0;return t.getAllItems().forEach(r=>{e+=r.length}),e}generateMinListPoints(t){let e=[];t.getAllItems().map(a=>a.primitive).forEach(a=>{Re.addAll(e,[a.start(),a.end()])});let n=t.getFirst();return this.generateMinPoints(e,n)}setInputStatus(t){let e=t.listIterator();for(;e.hasNext();){let r=e.next();Fr.getInstance().addInputStatus(r)}}getListByPoints(t,e,r){let i=new ri,n=i.createList();for(let s=1;s<t.length;s++){let a=i.createTrack(e.layerId,t[s-1],t[s],e.width,e.net,r);i.addList(a,n,r)}return n}generateMinPoints(t,e){t=Ku(t),this.debug=new VU;let r=this.getOptimalPath(t,e),i=r.connect(),n=0;return i.length>0&&(i=Ku(i),t=i,n=r.getLen()),this.debug&&Yr.inputDebugGraphics(this.debug),{path:t,len:n}}getOptimalPath(t,e,r=!1){return new FU(t,1e4,"STRONG",(i,n,s)=>{let a=new M(i,n),l=new M(n,s),c=this.canReach(e,a),h=this.canReach(e,l),u=c&&h;return this.debug&&this.debug.addLine(a,l,c,h),u},!0,r)}hidePath(t){t.getAllItems().forEach(r=>{_r.getInstance().current.setTrackHidden(r.globalIndex)})}setPushFilter(){Nt.setPushFilter()}run(t){this.wireResult=new Kg;let e=this.wireResult;return t.forEach(r=>{let i=this.trackInfo.get(r);e.setInputStatus(r),e.wireMap.set(i,r)}),e}getMinList(){let t=new no,e=this.pathList;this.optimizationList=e.filter(r=>{if(r.size()==1)return!1;let i=r.getFirst(),n=i.start,s=r.getLast().end,a=this.getDirect(i),l=t.degree45(a,n,s);if(l=Ku(l),l.length<=1&&l.push(l[0]),r.size()==2&&i.end.equals(l[1]))return!1;let c=this.getListByPoints(l,i,this.commands);return c.replace(r.getFirstNode(),r.getLastNode()),this.commands.addCommand(new Ti(c)),!0})}getMinList2(t,e){let r=new no,i=t.getFirst(),n=i.start,s=t.getLast().end,a=this.getDirect(i),l=r.degree45(a,n,s);l=Ku(l);let c=this.getListByPoints(l,i,e);c.replace(t.getFirstNode(),t.getLastNode()),e.addCommand(new Ti(c))}getDirect(t){if(t instanceof qr)return t.direct;if(t instanceof Oi){let e=t.center,r=t.start,i=e.sub(r).normalize();return t.sweep==le.CCW?new S(-i.y,i.x):new S(i.y,-i.x)}}pushWire(){new dg().run(this.wireResult);let e=this.isValidPath(new Br),r=ji.getInstance().view4Status(_r.getInstance().current);return this.commands.addCommand(this.wireResult.command),this.commands.addCommand(r),e}getMinPathByBlock(){new fb().run(this.wireResult),this.isValidPath()||this.getMinPathByBlock2();let r=ji.getInstance().view4Status(_r.getInstance().current);this.commands.addCommand(this.wireResult.command),this.commands.addCommand(r)}getMinPathByBlock2(){this.optimizationList.forEach(e=>{let r=new Br;this.getMinList2(e,r),this.run([e]),new fb().run(this.wireResult),this.isValidPath(r)&&this.commands.addCommand(r)});let t=ji.getInstance().view4Status(_r.getInstance().current);this.commands.addCommand(this.wireResult.command),this.commands.addCommand(t)}isValidPath(t){this.setPushFilter();let e=this.wireResult,r=this.blockShape,i=!0;return e.wireMap.forEach((n,s)=>{if(!i)return;let a=n.getAllItems(),l=s.start.point,c=s.end.point;a[0].start.equals(l)||(i=!1),a[a.length-1].end.equals(c)||(i=!1),i&&a.find(u=>r.checkDRC4Primitive(u,u.primitive))&&(i=!1)}),i?!0:(e.command.undo(),e.command=new Br,t?t.undo():(this.commands.undo(),this.commands=new Br),!1)}canReach(t,e){return!this.blockShape.checkDRC4Primitive(t,e)}};var Epe=class{constructor(){this.commands=new Br;this.optimizationList=[];this.blockShape=new As}getCommand(){return this.commands}runChain(t,e){this.init(),this.pathList=[t],this.trackInfo=new Map,this.trackInfo.set(t,e),this.getMinList(),this.run(this.optimizationList);let r=ji.getInstance().view4Status(_r.getInstance().current);this.commands.addCommand(r),_r.getInstance().clear(),jg("45"),this.setPushFilter(),this.getMinPathByBlock(),_r.getInstance().clear(),hi.getInstance().update(),this.optimization2(this.commands);let i=ji.getInstance().view4Status(_r.getInstance().current);this.commands.addCommand(i),_r.getInstance().clear(),Xg()}optimization2(t){let e=Array.from(this.optimizationList);e.forEach(n=>{this.setInputStatus(n)});let i=new PC(e,"SUPER",new S(1,0),performance.now()+1e5).optimize(!0);return t.addCommand(i),this.pathList}optimization(t){let e=this.pathList.filter(i=>!this.optimizationList.includes(i));return this.generateMinList(t).forEach((i,n)=>{let s=this.optimizationList[n];i.replace(s.getFirstNode(),s.getLastNode()),t.addCommand(new Ti(i)),e.push(s)}),e}init(){Yr.init(),Ra.getInstance().clear(),Fr.getInstance().clear(),Os.getInstance().clear()}generateMinList(t){let e=Array.from(this.optimizationList),r=0,i=[],n=new Br;return e.forEach(s=>{this.hidePath(s);let a=this.generateMinListPoints(s),l=a.path,c=s.getFirst(),h=this.getListByPoints(l,c,n);r+=a.len?a.len:this.getListLen(h),i.push(h)}),t.addCommand(n),i}getListLen(t){let e=0;return t.getAllItems().forEach(r=>{e+=r.length}),e}generateMinListPoints(t){let e=[];t.getAllItems().map(a=>a.primitive).forEach(a=>{Re.addAll(e,[a.start(),a.end()])});let n=t.getFirst();return this.generateMinPoints(e,n)}setInputStatus(t){let e=t.listIterator();for(;e.hasNext();){let r=e.next();Fr.getInstance().addInputStatus(r)}}getListByPoints(t,e,r){let i=new ri,n=i.createList();for(let s=1;s<t.length;s++){let a=i.createTrack(e.layerId,t[s-1],t[s],e.width,e.net,r);i.addList(a,n,r)}return n}generateMinPoints(t,e){t=Ku(t),this.debug=new VU;let r=this.getOptimalPath(t,e),i=r.connect(),n=0;return i.length>0&&(i=Ku(i),t=i,n=r.getLen()),this.debug&&Yr.inputDebugGraphics(this.debug),{path:t,len:n}}getOptimalPath(t,e,r=!1){return new FU(t,1e4,"STRONG",(i,n,s)=>{let a=new M(i,n),l=new M(n,s),c=this.canReach(e,a),h=this.canReach(e,l),u=c&&h;return this.debug&&this.debug.addLine(a,l,c,h),u},!0,r)}hidePath(t){t.getAllItems().forEach(r=>{_r.getInstance().current.setTrackHidden(r.globalIndex)})}setPushFilter(){Nt.setPushFilter()}run(t){this.wireResult=new Kg;let e=this.wireResult;return t.forEach(r=>{let i=this.trackInfo.get(r);e.setInputStatus(r),e.wireMap.set(i,r)}),e}getMinList(){let t=new no,e=this.pathList;this.optimizationList=e.filter(r=>{if(r.size()==1)return!1;let i=r.getFirst(),n=i.start,s=r.getLast().end,a=this.getDirect(i),l=t.degree45(a,n,s);if(l=Ku(l),l.length<=1&&l.push(l[0]),r.size()==2&&i.end.equals(l[1]))return!1;let c=this.getListByPoints(l,i,this.commands);return c.replace(r.getFirstNode(),r.getLastNode()),this.commands.addCommand(new Ti(c)),!0})}getMinList2(t,e){let r=new no,i=t.getFirst(),n=i.start,s=t.getLast().end,a=this.getDirect(i),l=r.degree45(a,n,s);l=Ku(l);let c=this.getListByPoints(l,i,e);c.replace(t.getFirstNode(),t.getLastNode()),e.addCommand(new Ti(c))}getDirect(t){if(t instanceof qr)return t.direct;if(t instanceof Oi){let e=t.center,r=t.start,i=e.sub(r).normalize();return t.sweep==le.CCW?new S(-i.y,i.x):new S(i.y,-i.x)}}getMinPathByBlock(){new fb(1e8).run(this.wireResult),this.isValidPath();let e=ji.getInstance().view4Status(_r.getInstance().current);this.commands.addCommand(this.wireResult.command),this.commands.addCommand(e)}isValidPath(t){this.setPushFilter();let e=this.wireResult,r=this.blockShape,i=!0;return e.wireMap.forEach((n,s)=>{if(!i)return;let a=n.getAllItems(),l=s.start.point,c=s.end.point;a[0].start.equals(l)||(i=!1),a[a.length-1].end.equals(c)||(i=!1),i&&a.find(u=>r.checkDRC4Primitive(u,u.primitive))&&(i=!1)}),i?!0:(e.command.undo(),e.command=new Br,t?t.undo():(this.commands.undo(),this.commands=new Br),!1)}canReach(t,e){return!this.blockShape.checkDRC4Primitive(t,e)}};var Ope=class{constructor(t,e=!0){this.pathList={};this.commands=null;this.init(),this.getPath2(t);let r=this.getSortTrackInfo();if(this.resultIds=[],e){let i=[];for(let a in this.pathList){let l=this.pathList[a],c=new Spe().runChain(l,r,e);Re.addAll(i,c)}let n=ji.getInstance().complete(this.commands),s=i.map(a=>n.newIds[a]).filter(a=>a!=null);Re.addAll(this.resultIds,s),ji.getInstance().clear()}else{for(let i in this.pathList){let n=this.pathList[i],s=this.getLen(n),l=performance.now()+1e10,c=n.length;for(;performance.now()-l<0&&c>=0;){n.forEach(u=>{new Epe().runChain(u,r.get(u))});let h=this.getLen(n);if(ne.eq(h,s)||n.length<2)break;s=h,n.reverse(),c--}}for(let i in this.pathList){let n=this.pathList[i],s=ji.getInstance().complete(this.commands),l=this.getResultIds(n).map(c=>s.newIds[c]).filter(c=>c!=null);Re.addAll(this.resultIds,l),ji.getInstance().clear()}}je.executeCommand(this.commands),this.clear(),A.publish("flushService","")}getResultIds(t){let e=[];return t.forEach(r=>{let i=r.getAllItems();e.push(...i.map(n=>n.globalIndex))}),e}getLen(t){let e=0;return t.forEach(r=>{r.getAllItems().forEach(i=>{e+=i.length})}),e}get glossItems(){return this.resultIds}getSortTrackInfo(){let t=new Map;for(let e in this.pathList){let r=this.pathList[e],i=r.map(h=>{let u=this.generateTrackInfoByItem(h.getFirst(),h.getLast());return t.set(h,u),u}),n=new er,s=i.map((h,u)=>{let d=r[u].getFirst(),p=n.getItem(d.globalIndex);return{info:h,item:p,project:0}}),l=VT.sort(s).map(h=>h.item.model),c=r.sort((h,u)=>{let d=h.getFirst(),p=u.getFirst(),m=l.findIndex(y=>y==d),g=l.findIndex(y=>y==p);return m-g});this.pathList[e]=c}return t}generateTrackInfoByItem(t,e){let r=t.layerId,i=t.end.sub(t.start).normalize(),n=!0,s=go.getSignalLayerIds(null,r),a=new hb(new Set(s),r,t.start,i,n,null),l=new hb(new Set(s),r,e.end,i,n,null),c=new lf(t.net,t.width,t.layerId,i,!1);return c.start=a,c.end=l,c}getPath2(t){let e=new Set,r;t.forEach(i=>{if(e.has(i.model))return;if(!xt.getInstance().getNode(i.model)){let c=new ku(i.model,1e-4),h=c.reverseTrack[0]?c.tracks[0].end:c.tracks[0].start;if(!r)r=h;else{let u=c.tracks.length-1,d=c.reverseTrack[u]?c.tracks[0].start:c.tracks[0].end;r.distance2(h)>r.distance2(d)&&c.reversePath()}c.generateList()}let n=xt.getInstance().getNode(i.model).parent;n.getAllItems().forEach(c=>{e.add(c)});let a=i.layerId,l=this.pathList[a];l||(l=this.pathList[a]=[]),l.push(n)})}clear(){ji.getInstance().clear(),Zl.getInstance().deleteAll(),Rm.getInstance().clear(),_i.getInstance().clear(),hi.getInstance().clear(),xt.getInstance().clear(),Os.getInstance().clear(),_r.getInstance().clear(),gc.getInstance().clear(),Ra.getInstance().clear(),Es.getInstance().clear(),yc.getInstance().clear(),Fr.getInstance().clear(),Es.getInstance().clear(),Jl.getInstance().clear()}init(){this.commands=new ve("wire"),xt.getInstance().clear(),_i.getInstance().clear()}};var Ape=class extends ko{constructor(){super();this.selectItems=[];this.hightItems=[];this.glossItems=[];this.params=BU.getInstance(),this.box=new yX}onMouseLeftDown(e){this.cancelHight(),this.box.isBBox()||this.box.start(e.sceneX,e.sceneY)}setSelectItems(e){this.selectItems=e.filter(r=>!r.locked)}onMouseMove(e){if(this.box.update(e.sceneX,e.sceneY),this.box.isBBox()){let r=this.box.getBBox(e.sceneX,e.sceneY);this.cancelHight(),this.hightItems=this.getBoxItem(r),this.hights()}else{let r=Wr.pointSelect(e.sceneX,e.sceneY).find(i=>i instanceof Ue);if(this.cancelHight(),r&&!r.locked)if(this.params.glossMode==="ShortestPath"){let n=new Bu(r,!1);this.hightItems.push(...n.tracks)}else this.hightItems.push(r);this.hights()}}getBoxItem(e){let r=[],i=this.boxSelect(e).filter(n=>!n.locked);return this.params.glossMode=="ShortestPath"?i.forEach(n=>{let s=new Bu(n,!1);r.push(...s.tracks)}):r.push(...i),r}cancelHight(){this.hightItems.forEach(e=>{this.glossItems.includes(e)||e.visible()}),this.hightItems=[]}hights(){this.hightItems.forEach(e=>{this.glossItems.includes(e)||e.click()})}cancelGloss(){this.glossItems.forEach(e=>{e.visible()}),this.glossItems=[]}clearBox(){this.box.interrupt()}glossHight(){setTimeout(()=>{this.glossItems.forEach(e=>{e.click()}),ie.publish("updateFrame","")})}onMouseLeftUp(e){let r=this.box.success(e.sceneX,e.sceneY);if(r){let i=this.getBoxItem(r.extendOfSize(.1));this.setSelectItems(i),this.handleSelectTracks()}else{let i=Wr.pointSelect(e.sceneX,e.sceneY).find(n=>n instanceof Ue);if(i&&!i.locked){if(this.params.glossMode==="ShortestPath"){let s=new Bu(i,!1);this.setSelectItems(s.tracks)}else this.setSelectItems([i]);this.handleSelectTracks(),this.box.interrupt()}}}complete(){this.selectItems=[]}handleSelectTracks(){this.selectItems=this.selectItems.filter(i=>!i.locked);let e=this.selectItems,r=this.params.glossMode;if(this.cancelGloss(),this.cancelHight(),e.length!=0){switch(r){case"ShortestPath":let i=new er,n=new Ope(e,this.params.pushTrack);this.glossItems=n.glossItems.map(s=>i.getItem(s)).filter(s=>s instanceof Ue);break;case"AverageSpacing":{let s=e.filter(a=>a instanceof Ar);new Tpe(s,this.params.pushTrack);break}case"PadCenter":{let s=e.filter(a=>a instanceof Ar);new Ipe(s,this.params.pushTrack);break}}this.glossHight()}}boxSelect(e){let r=Ol(e),i=Wr.rtreeSearchNotOutside(r,!0);return $t.filterWireElement(i.getResult(dd),!0).filter(s=>s instanceof Ue)}};var GU=class extends ko{constructor(){super();this.option="OPTIONCOMPLETE";this.initSketcherAttrPanel(),this.selectOptiTrackTool=new Ape}getCanUndo(){return!0}initSketcherAttrPanel(e=!0){A.publish("FlushSketcherAttrView",{type:"TRACK_OPTIMIZATION",isInitAllParams:!0,switchTab:e})}handleSelectItems(e){this.selectOptiTrackTool.setSelectItems(e.filter(r=>r instanceof Ue)),this.selectOptiTrackTool.handleSelectTracks(),this.completed()}onKeyDown(e){let r=sr.getAction(3,e);switch(r==null&&(r=sr.getAction(4,e)),r){case"Undo":A.publish("undo","");break;case"Cancel":this.cancel();break}A.publish("updateFrame","")}onEnterPlace(e){this.onMouseLeftDown(e),this.onMouseLeftUp(e)}onMouseLeftUp(e){this.selectOptiTrackTool.onMouseLeftUp(e),this.completed()}onMouseMove(e){this.selectOptiTrackTool.onMouseMove(e),jt.update(e,"Please click or select the track to be glossed")}onMouseWheel(e){this.onMouseMove(e)}onMouseLeftDown(e){this.selectOptiTrackTool.onMouseLeftDown(e)}onMouseRightUp(e){if(e.openMenu)switch(this.option){case"OPTIONCOMPLETE":{this.option1(e);break}case"OPTIONLEFTUP":{this.option2(e);break}}}option1(e){switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.completed():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}option2(e){switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.onMouseLeftUp(e):this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}completed(e){this.selectOptiTrackTool.complete(),A.publish("flushService","")}cancel(e){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:this.getMenu(e.adsorb).result};Qt.getInstance().menuData(r,this),this.drawing=!1}getMenu(e){return Pqe(e)}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}}interrupt(){this.selectOptiTrackTool.cancelHight(),this.selectOptiTrackTool.cancelGloss(),this.selectOptiTrackTool.clearBox(),jt.cancel()}};var Q_=class extends ko{constructor(t,e,r){super(),this.drawing=!0,Ua.changeTool(this)}async copyToCursor(t){if(t=ZT.filter(t),t.length<=0){A.publish("tool","dropdrag");return}let e=null,r=_s(t);r.valid()&&(e=r.build1().center());let i=zC.extractCopyInfo(t,e);i=await this.handleCustom(i);let n=ic.getPasteData({copyData:i});if(n){let{tool:s}=n;this.transformTool=s,ic.pastePosition(new S(Pi.getInstance().sceneX,Pi.getInstance().sceneY),!1),Mn.getInstance().allowPull=!1}}async copyToOtherLayer(t,e){if(t=ZT.filter(t),t.length<=0)return;let r=[];t.map(s=>{Zn.canChangeLayer(s,e)&&r.push(s)});let i,n=[];if(r.length>0){let s=null,a=_s(r);a.valid()&&(s=a.build1().center());let l=zC.extractCopyInfo(r,s);l=await this.handleCustom(l);let c=ic.getPasteData({copyData:l});if(!c)return;let{tool:h,position:u}=c;if(this.transformTool=h,this.transformTool.group.forEach(d=>{d instanceof Ye&&d.type=="3D Shell - Side Slot Region"&&(d.type="3D Shell - Top Slot Region")}),this.transformTool.group.length>0){let d=be.getLayer(e);this.transformTool.group.map(p=>{p.layerId=e,p.net&&!d.isCopperLayer()&&(p.net=""),p.click()}),be.setActiveLayer(d),dF(),i="{0} objects duplicated successfully",n.push(this.transformTool.group.length+"")}ic.pastePosition(s)}else i="Selected objects cannot be duplicated to {0}",n.push(be.getLayerName(e)),this.canPlace=!1;A.publish("message",{type:"show",message:i,replaceWords:n},$()),ic.complete(),this.cancelSelectRepeatResult()}async handleCustom(t){for(let e of Object.keys(t.data)){let r=t.data[e];for(let i=0;i<r.length;i++){let n=JSON.parse(r[i]);if(n.custom){let s=Wi.getInstance().getItem(n.custom),a=await Wi.getInstance().cloneFootprint(s),l=a==null?void 0:a.uuid;l||console.error(`add footprint error footprintUuid: ${n.custom}`),n.custom=l}t.data[e][i]=JSON.stringify(n)}}return t}onKeyDown(t){ic.onKeyDown(t)}onKeyUp(t){ic.onKeyUp(t)}onEnterPlace(t){ic.onMouseLeftUp(t)}onMouseLeftUp(t){Qt.getInstance().getMenuStatus()||(ic.onMouseLeftUp(t),this.cancelSelectRepeatResult())}applyInputAtCursorValue(t){let{type:e,editing:r,keyCode:i}=t;if(r){dt.editingWhat=e;return}ic.applyValue(t),i===13&&dt.destroy()}onMouseMove(t){ic.onMouseMove(t)}interrupt(){ic.interrupt(),Mn.getInstance().allowPull=!0}cancel(){ic.cancel(),Mn.getInstance().allowPull=!0}onMouseRightUp(t){ic.onMouseRightUp(t)}cancelSelectRepeatResult(){this.transformTool&&(this.transformTool.group.length&&A.publish("onlySelect",this.transformTool.group),this.transformTool.group.length=0)}};function Tqe(o){let t=new Jt;return t.add("CANCEL"),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var UU=class extends ko{constructor(){super()}onMouseLeftUp(t){let e,r=Wr.pointSelect(t.sceneX,t.sceneY);for(let i of r)if(pAe(i)){e=i;break}e==null?A.publish("tool","SelectHelp"):A.publish("toggle",{command:"editOutline",item:e}),this.completed()}onMouseMove(t){jt.update(t,"Please select a object")}onEnterPlace(t){this.onMouseLeftUp(t)}onKeyDown(t){switch(sr.getAction(4,t)){case"Cancel":this.cancel();break;case"Finish":this.completed();break}}onMouseRightUp(t){if(t.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{t.ctrlKey?this.cancel():this.rightClickMenuData(t);break}case"rightClick":{t.ctrlKey?this.rightClickMenuData(t):this.cancel();break}}}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:Tqe(t.adsorb)};Qt.getInstance().menuData(e,this),this.drawing=!1}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}cancel(){jt.cancel(),A.publish("tool","dropdrag")}completed(){jt.cancel()}};var Iqe=(a=>(a.ClearanceError="Clearance Error",a.ClearanceErrorInTheSameFootprint="Clearance Error in the same footprint",a.PhysicalError="Physical Error",a.DifferentialPairError="Differential Pair Error",a.ConnectionError="Connection Error",a.NetListError="Netlist Error",a.CreepageError="Creepage Error",a))(Iqe||{});function Cqe(o){if(o.list!==void 0){if(!o.list.length)return o.visible;let t=o.list.map(r=>Cqe(r));t.every(r=>r==t[0])&&(o.visible=t[0])}return o.visible}function Sqe(o){if(o.list!==void 0){let t=o.list.reduce((r,i)=>r+Sqe(i),0);o.count=t;let e=o.name.includes(" to ")?[o.name.split(" to ")[0],"to",o.name.split(" to ")[1]]:[o.name];return o.title=o.doNotTranslate?`${o.name} (${t})`:[...e,`(${t})`],t}else return 1}var LP=class{static create(t){return t.filter(e=>e!=null).join(this.separator)}static get(t){if(t==null)return null;let e=t.split(this.separator);return e[e.length-1]}};LP.separator="|_|";var Eqe=LP.create(["DRCTab","Errors"]);function wAe(o){let t={name:"All",list:o,count:0,title:[],visible:!0};return Sqe(t),Cqe(t),[{id:Eqe,title:t.title,args:{iconCls:"icon-eda-eye",eyeState:t.visible,treeNodeType:"errors"},children:o.filter(r=>r.list.length>0).map(r=>({id:LP.create(["DRCTab","Errors",r.name]),title:r.title,args:{iconCls:"icon-eda-eye",eyeState:r.visible,treeNodeType:"errorType"},children:r.list.map(i=>({id:LP.create(["DRCTab","Errors",r.name,i.name]),title:i.title,args:{iconCls:"icon-eda-eye",eyeState:i.visible,list:i.list,treeNodeType:tn.ErrorObjType}}))}))}]}var RAe=class{constructor(){this.cachedTreeData=null;this.errorTypeVisibilityMap=new Map;this.idToNodeMap=new Map;this.globalIndexToLeafMap=new Map;this.groupChange=!1}getErrorTree(t){return this.clearCache(),this.cachedTreeData=wAe(t),this.buildMaps(),this.cachedTreeData}buildMaps(){var r,i,n,s;if(!((i=(r=this.cachedTreeData)==null?void 0:r[0])!=null&&i.children))return;let t=[...this.cachedTreeData[0].children],e=new Set;for(;t.length;){let a=t.shift();if(!this.idToNodeMap.get(a.id)){if(this.idToNodeMap.set(a.id,a),!((n=a.children)!=null&&n.length)){let l=LP.get(a.id);l&&!e.has(l)&&(e.add(l),this.errorTypeVisibilityMap.set(l,!0))}if(((s=a.args)==null?void 0:s.treeNodeType)===tn.ErrorObjType&&a.args.list)for(let l of a.args.list)l.parentId=a.id,l.globalIndex!=null&&this.globalIndexToLeafMap.set(l.globalIndex,l);a.children&&t.push(...a.children)}}}updateDRCErrorVisibility(t,e){var h,u,d;if(!((u=(h=this.cachedTreeData)==null?void 0:h[0])!=null&&u.children))return;this.groupChange=!1;let r=t.id,i=this.cachedTreeData[0],n=LP.get(r),s=r===Eqe,a=this.isGroupType(n),l=((d=t.args)==null?void 0:d.treeNodeType)===tn.ErrorObjType,c=this.findNodeById(r)||t;c.args.eyeState=e,s?(i.args.eyeState=e,this.updateChildrenVisibility(i,e)):a?(this.errorTypeVisibilityMap.set(n,e),this.updateChildrenVisibility(c,e)):l&&n!=="Netlist Error"?this.updateLeafVisibility(c,e,!0):n=="Netlist Error"&&(l?this.updateLeafVisibility(c,e,!0):this.updateChildrenVisibility(c,e)),this.updateNodeStateChain(s?i:t),this.updateRootState(),(s||a||this.groupChange)&&Au.updateVisibility()}updateTableItemVisibility(t,e){var a,l;let r=this.globalIndexToLeafMap.get(t);if(!r)return;r.visible=e;let i=r.parentId?this.findNodeById(r.parentId):this.findParentNode(r);if(!i)return;this.groupChange=!1,this.updateLeaf(r,e,!0);let n=i.args.eyeState,s=(l=(a=i.args.list)==null?void 0:a.some(c=>c.visible))!=null?l:n;n!==s&&(i.args.eyeState=s,this.updateNodeStateChain(i),this.updateRootState(),Au.refreshRender()),this.groupChange&&Au.updateVisibility()}updateChildrenVisibility(t,e){var r,i,n;if(t.children)for(let s of t.children){s.args.eyeState=e;let a=LP.get(s.id);this.isGroupType(a)&&this.errorTypeVisibilityMap.set(a,e),(r=s.children)!=null&&r.length?this.updateChildrenVisibility(s,e):((i=s.args)==null?void 0:i.treeNodeType)===tn.ErrorObjType&&this.updateLeafVisibility(s,e,a=="Netlist Error"||e&&((n=s.args)==null?void 0:n.list.some(l=>!l.visible)))}}updateLeafVisibility(t,e,r=!1){var i;if((i=t.args)!=null&&i.list)for(let n of t.args.list)n.visible=e,this.updateLeaf(n,e,r)}updateLeaf(t,e,r=!1){let i=k1.getInstance().getItem(t.globalIndex);i&&(r?e?i.visible():i.hidden():i.onlySetVisibleState(e))}updateNodeStateChain(t){var r,i,n,s;let e=t;for(;e;){let a=e.id,l=(i=(r=a==null?void 0:a.split(LP.separator))==null?void 0:r.slice(0,-1))==null?void 0:i.join(LP.separator),c=l?this.findNodeById(l):void 0;if(!c)break;let h=(s=(n=c.children)==null?void 0:n.some(u=>u.args.eyeState&&this.nodeHasVisibleError(u)))!=null?s:!1;if(c.args.eyeState!==h){c.args.eyeState=h;let u=LP.get(c.id);this.isGroupType(u)&&(this.errorTypeVisibilityMap.set(u,h),this.groupChange=!0),e=c}else break}}updateRootState(){var i,n;let t=(i=this.cachedTreeData)==null?void 0:i[0];if(!t||!((n=t.children)!=null&&n.length))return;let e=!0;for(let s of t.children)if(s.args.eyeState&&this.nodeHasVisibleError(s)){e=!1;break}t.args.eyeState=!e;let r=Ui.getInstance().getItem(35);r.visible=!e,Au.refreshDRCLayer()}nodeHasVisibleError(t){var e,r,i,n,s;return((e=t.args)==null?void 0:e.treeNodeType)===tn.ErrorObjType?(i=(r=t.args.list)==null?void 0:r.some(a=>a.visible))!=null?i:!1:(s=(n=t.children)==null?void 0:n.some(a=>{var l;return a.args.eyeState&&((l=a.children)!=null&&l.length?this.nodeHasVisibleError(a):this.nodeHasVisibleError(a))}))!=null?s:!1}findNodeById(t){return this.idToNodeMap.get(t)||null}findParentNode(t){var i,n;if(t.parentId)return this.findNodeById(t.parentId);let r=(n=(i=(t.id||"").split(LP.separator))==null?void 0:i.slice(0,-1))==null?void 0:n.join(LP.separator);return r?this.findNodeById(r):null}isGroupType(t){return["Clearance Error","Clearance Error in the same footprint","Connection Error","Differential Pair Error","Physical Error","Creepage Error"].includes(t)}isErrorTypeVisible(t){var e;return(e=this.isGroupType(t)&&this.errorTypeVisibilityMap.get(t))!=null?e:!0}getAllStates(){return new Map(this.errorTypeVisibilityMap)}getAllState(){var t,e;return this.cachedTreeData===null?!0:(e=(t=this.cachedTreeData)==null?void 0:t[0])==null?void 0:e.args.eyeState}clearCache(){this.cachedTreeData=null,this.errorTypeVisibilityMap.clear(),this.idToNodeMap.clear(),this.globalIndexToLeafMap.clear()}},DAe=class{constructor(){this.layerVisibilityMap=new Map;this.copperVisibilityMap=new Map;this.multLayerVisible=!1;this.updateLayerVisibility()}updateLayerVisibility(){let t=[...be.getAllCopperLayer(),be.getMultLayer()];this.multLayerVisible=be.getMultLayer().visible,t.forEach(e=>{let{layerID:r,visible:i}=e;r!==12&&this.copperVisibilityMap.set(r,i),this.layerVisibilityMap.set(r,i)})}isLayerVisible(t){var e;return(e=this.layerVisibilityMap.get(t))!=null?e:!1}isCopperVisible(){return Array.from(this.copperVisibilityMap.values()).some(t=>t)}isMultiLayerVisible(){return this.multLayerVisible}shouldDisplayError(t){if(t.length===1)return this.isLayerVisible(t[0]);let e=t.includes(12);return t.length===2&&e?this.isLayerVisible(By(t[0],t[1])):e?this.isMultiLayerVisible()&&t.some(r=>r!==12&&this.isLayerVisible(r)):this.isMultiLayerVisible()&&t.some(r=>this.isLayerVisible(r))}},_pe=class{static generate(t,e){return!t||t.length==0?null:t.length===1?`L:${t[0]}|T:${e}`:`L:${[...t].sort().join(",")}|T:${e}`}static parse(t){if(!t)return null;let e=t.match(/L:([^|]+)\|T:(.+)/);if(!e)return{};let r=e[1].trim(),i=[];r.includes(",")?i=r.split(",").map(a=>Number(a.trim())):i=r?[Number(r)]:[];let n=e[2].trim(),s=Object.values(Iqe).find(a=>a===n);return{layerIds:i,errorType:s}}},vpe=class{constructor(){this.groupStates=new Map}initialize(){this.layeredGroup=new DAe,this.panelManager=new RAe}isInSameComponent(t,e){let r=n(t),i=n(e);return r&&i&&r==i;function n(s){let l=new er().getItem(s);if(l){let c=l.getParent();if(c){if(c instanceof Me)return c;let h=c.getParent();if(h&&h instanceof Me)return h}}return!1}}getErrorType(t){if(t instanceof sf)return this.isInSameComponent(t.obj1,t.obj2)?"Clearance Error in the same footprint":"Clearance Error";if(t instanceof rb||t instanceof eb||t instanceof xT||t instanceof rP||t instanceof tb)return"Physical Error";if(t instanceof Ky)return"Connection Error";if(t instanceof Zy||t instanceof Qy||t instanceof Jy)return"Differential Pair Error";if(t instanceof iP)return"Creepage Error"}async setGroupVisibility(t,e){this.groupStates.set(t,e),await Do.attachViewGroup(t,{visible:e})}generateViewGroupId(t){let e=t.referenceLayerIds;if(!e||e.length==0||t.errType=="Netlist Error")return null;let r=t.content,i=this.getErrorType(r),n=_pe.generate(e,i);if(n&&!this.groupStates.has(n)){let s=this.layeredGroup.shouldDisplayError(e)&&this.panelManager.isErrorTypeVisible(i);this.updateGroupStates(n,s)}return n}updateGroupStates(t,e){this.groupStates.set(t,e)}refreshRender(){let t=k1.getInstance().getAllItem();for(let e of t)e.refreshRender()}refreshDRCLayer(){let t=!$t.getVisible(35),e=!this.layeredGroup.isCopperVisible()&&!this.layeredGroup.isMultiLayerVisible(),r=!this.panelManager.getAllState(),i=t||e||r;if(i&&this.DRCLayer.visible){if(this.DRCLayer.visible=!i,e&&!t&&!r)return i;let n=k1.getInstance().getAllItem();for(let s of n)s.onlySetVisibleState(!i)}else!i&&!this.DRCLayer.visible&&(this.DRCLayer.visible=!0,this.refreshRender());return i}updateVisibility(t=!1){if(!this.refreshDRCLayer())for(let[e,r]of this.groupStates){let i=_pe.parse(e);if(!i)continue;let{layerIds:n,errorType:s}=i,a=this.layeredGroup.shouldDisplayError(n)&&this.panelManager.isErrorTypeVisible(s);(t||r!==a)&&this.setGroupVisibility(e,a)}}getActualVisibility(t){if(t instanceof Gy&&!(t instanceof qp))return this.getActualVisibility(t.getParent());let{referenceLayerIds:e}=t;if(!this.layeredGroup.shouldDisplayError(e))return!1;let i=this.getErrorType(t.model.content);return this.panelManager.isErrorTypeVisible(i)?t.isVisible:!1}reset(){var t,e,r;this.DRCLayer.visible||(this.DRCLayer.visible=!0);for(let[i]of this.groupStates)this.setGroupVisibility(i,!0);(t=this.groupStates)==null||t.clear(),(e=this.panelManager)==null||e.clearCache(),(r=qM)==null||r.reset()}};var Ma=S.ORIGIN,q$=1.5;var Oqe=new S(-1,-1),xpe=class extends ko{constructor(){super();this.lastClickX=null;this.lastClickY=null;this.isMouseRightDown=!1;this.prevRightX=0;this.prevRightY=0;this.prevMidX=0;this.prevMidY=0;this.isMouseMidDown=!1;this.zoomCenter=Mt.ORIGIN;this.mark=[];this.adsorb=!0;this.canMouseMove=!1;this.mouseX=0;this.mouseY=0;this.stepHandlePx=50;this.iframeLeftTopPosition=Oqe;this.wheelData={lastTime:Date.now(),x:0,y:0,clearTime:null};this.wheelTime=500;this.shiftMoveHelpLine=null;this.flag=!0;this.lastOffset=null;this.inputInfo=null;this._lastMousePosition=null,vAe.call(this),this.camera=Ni(),this.zoomCenter=new Mt(this.camera.getWidth()*.5,this.camera.getHeight()*.5,0),this.setNextTool(new dh),A.messageBus.subscribe("refreshDrawStatus",()=>{this.handler(e=>{e.interrupt(),A.publish("tool","dropdrag")})}),A.messageBus.subscribe("RestoreToolStatus",()=>{Pi.getInstance().clearCrossFlag(),this.handler(e=>{e.restore()})}),A.messageBus.rpcService("getHotKeyCmd",e=>{let r=new Pi(Ni().getWidth(),Ni().getHeight());r.subMenuFunc=e.func,r.keyCode=e.keyCode,r.shiftKey=e.shiftKey,r.ctrlKey=e.ctrlKey,r.altKey=e.altKey,r.metaKey=e.metaKey;let i=yi.getScene(),n=sr.getAction(i,r);return sr.getConfigHotkeyInfo(n)}),A.subscribe("setOrigin",e=>{!x.getInstance().isactive||23==x.getInstance().doctype||(_3(new S(e.originX,e.originY)),A.publish("updateFrame",""))}),A.subscribe("updateFlag",e=>{this.flag=e}),A.subscribe("Scroll Left",e=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r=St.getInstance().flip?-1:1;this.moveCamera1(this.getRulerScale()*r,0)}),A.subscribe("Scroll Right",e=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r=St.getInstance().flip?-1:1;this.moveCamera1(-this.getRulerScale()*r,0)}),A.subscribe("Scroll Up",e=>{!x.getInstance().isactive||23==x.getInstance().doctype||this.moveCamera1(0,-this.getRulerScale())}),A.subscribe("Scroll Down",e=>{!x.getInstance().isactive||23==x.getInstance().doctype||this.moveCamera1(0,this.getRulerScale())}),A.subscribe("toggleAdsorb",e=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;this.adsorb=typeof e=="boolean"?e:!this.adsorb;let r=!1;if(e=="isTrue"||e=="isFalse")switch(r=!0,e){case"isTrue":this.adsorb=!0;break;case"isFalse":this.adsorb=!1;break}if(this.nextTool instanceof AU&&(this.nextTool.drawing=!0),we.adsorb!==this.adsorb&&(we.adsorb=this.adsorb,Hi()),!r){let n=this.adsorb?"Open Snap Already!":"Close snap Already!";A.publish("ui/toastMsg",{type:"success",msg:n},$())}!Ve.getSelects().length&&A.publish("flushSelectingInfo",""),this.adsorptionAddFloatingInputBox(null,null)}),A.subscribe("adaptAll",e=>{let r=1,i="";typeof e=="object"?(r=e.ratio||1,i=e.tabId):e>0&&(r=e);let n=x.getInstance();if([23].includes(n.doctype)||(i?n.tabId!=i:!n.isactive))return;let s=N0();if(s!=null){let a=Ii.getBBox();if(a instanceof ut){let l=new _e;l.ext1(s),l.ext1(a),s=l.build1()}this.adaptAll(s,r),A.publish("updateFrame","")}},$()),A.subscribe("fitBoard",e=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;(e==null||e=="")&&(e=1);let r=uu();if(r.length>0){let i=new _e;if(r.forEach(n=>{i.ext1(n.buildBBox())}),i.valid()){let n=i.build1();this.adaptAll(n,e)}A.publish("updateFrame","")}}),A.subscribe("adaptSelect",()=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e=Ve.getSelects(),r=Ni(),i=new _e;for(let n of e){if(n instanceof Me){let a=n.getAttrBBox();a&&i.ext1(a)}let s=n.buildBBox();n instanceof _n&&(s.width()==0?s=s.extendSize(r.getPxLength(),0):s.height()==0&&(s=s.extendSize(0,r.getPxLength()))),i.ext1(s)}if(i.valid()){let n=i.build1();this.adaptAll(n,.8,Math.pow(10,6))}A.publish("updateFrame","")}),A.subscribe("highlightItems",this.highlightItems.bind(this),$()),A.subscribe("highlightError",this.highlightError.bind(this)),A.subscribe("highlightTrackInNets",({trackInNets:e,needAdaptAll:r,isHighlight:i})=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;A.publish("clearSelect","");let n=pr.getAllItem().filter(s=>e.includes(s.net)).map(s=>s.globalIndex);this.highlightItems({globalIndexArr:n,needAdaptAll:r,isHighlight:i})}),A.subscribe("highlightGroupPadsPairNets",({padsPairGroupName:e,needAdaptAll:r,isHighlight:i})=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;A.publish("clearSelect","");let n=[];for(let l=0;l<e.length;l++){let c=te.getInstance().getPadsPairGroupItemByGroupName(e[l]);c&&Re.addAll(n,c.details)}let{lostPads:s,globalIndexArr:a}=n9e(n);if(s.length&&A.publish("ui/toastMsg",{type:"warn",msg:{text:"Pad(s): {0} has been lost.",i18nParam:Array.from(new Set(s))}},$()),a.length){this.highlightItems({globalIndexArr:Array.from(new Set(a)),needAdaptAll:r,isHighlight:i});return}}),A.subscribe("highlightPadsPairNets",({padsPairNames:e,needAdaptAll:r,isHighlight:i})=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;A.publish("clearSelect","");let n=[];for(let l=0;l<e.length;l++){let c=e[l],h=HGe(c);n.push(h)}let{lostPads:s,globalIndexArr:a}=n9e(n);if(s.length&&A.publish("ui/toastMsg",{type:"warn",msg:{text:"Pad(s): {0} has been lost.",i18nParam:Array.from(new Set(s))}},$()),a.length){this.highlightItems({globalIndexArr:Array.from(new Set(a)),needAdaptAll:r,isHighlight:i});return}}),A.subscribe("setPadsPairGroupColor",({message:e})=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let{groupName:r,groupColor:i}=e;if(!r||!i)return;let s=te.getInstance().getPadsPairGroupItemByGroupName(r);s!=null&&(s.groupColor=i),A.publish("forceRenderTree",tn.PadsPairGroups,$()),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}),A.subscribe("highlightComponentInClassification",({type:e,componentClassifications:r,needAdaptAll:i,isHighlight:n})=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;A.publish("clearSelect","");let s=Cr.getAllItem().filter(a=>{let l;switch(e){case"Designator":l=a.name.match(/[^\d]*/)[0]||"None";break;case"Device":l=a.device;break;case"Footprint":l=a.footprintId;break;case"Name":l=a.getFormulaName()||"None";break;default:return!1}return r.some(c=>c===l)}).map(a=>a.globalIndex);this.highlightItems({globalIndexArr:s,needAdaptAll:i,isHighlight:n})}),A.subscribe("highlightRatlineNet",({ratlineNets:e,needAdaptAll:r,isHighlight:i})=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;A.publish("clearSelect",""),zo.unHighlightAll(),i&&x.getInstance().doctype==3&&Ve.highlight.unhighLigthAll();let n=[];if(e.forEach(s=>{n=n.concat(zo.getRatlineByNetName(s))}),n.length>0){let s=[],a=new _e;n.forEach(l=>{l.click(),s.push(l),[l.startNode,l.endNode].forEach(c=>{s.push(c),c.click(),a.ext1(c.buildBBox())})}),a.valid()&&(r?this.adaptAll(a.build1(),.6):this.locationMapItem(a.build1())),i&&x.getInstance().doctype==3&&(n.forEach(l=>{Ve.highlight.addHightItem(l)}),s.forEach(l=>{Ve.highlight.addHightItem(l)})),A.publish("select",s),A.publish("updateFrame","")}}),A.subscribe("adaptBBox",e=>{if(e instanceof ut||Array.isArray(e)){let r=.8;Array.isArray(e)&&(r=e[1]||1,e=e[0]),this.adaptAll(e,r)}else{let r=!1,{bbox:i,needAdaptAll:n}=e;n?this.adaptAll(i,.6,r?Number.MAX_SAFE_INTEGER:7):this.locationMapItem(i)}}),A.subscribe("AdaptBBox2",e=>{let{box:r,onlyMove:i,showCrossLines:n}=e,s=.8;if(Array.isArray(r)&&(s=r[1]||1,r=r[0]),n&&mc.show(new ut(r.minX,r.maxX,r.minY,r.maxY).center()),this.adaptAll(r,s,void 0,i),n){let a=window.setTimeout(()=>{mc.remove(),mc.setTimer(null),A.publish("updateFrame","")},1e3);mc.setTimer(a)}}),A.subscribe("SetCanvasCrossLine",e=>{let{box:r,delay:i=1e3,isAutoRemove:n=!0}=e,s=.8;if(Array.isArray(r)&&(s=r[1]||1,r=r[0]),mc.show(new ut(r.minX,r.maxX,r.minY,r.maxY).center()),mc.click(),A.publish("updateFrame",""),n){let a=window.setTimeout(()=>{mc.remove(),mc.setTimer(null),A.publish("updateFrame","")},i);mc.setTimer(a)}}),A.subscribe("HiddenCanvasCrossLine",()=>{window.clearTimeout(mc.getTimer()),mc.remove(),mc.setTimer(null),A.publish("updateFrame","")}),A.subscribe("showCanvasRectRegion",e=>{let{box:r,delay:i=1e3,isAutoRemove:n=!0}=e,s=.8;if(Array.isArray(r)&&(s=r[1]||1,r=r[0]),mc.show(new ut(r.minX,r.maxX,r.minY,r.maxY).center()),Yw.show(r),A.publish("updateFrame",""),n){let a=window.setTimeout(()=>{mc.remove(),mc.setTimer(null),Yw.remove(),Yw.setTimer(null),A.publish("updateFrame","")},i);mc.setTimer(a),Yw.setTimer(a)}}),A.subscribe("hiddenCanvasRectRegion",()=>{window.clearTimeout(mc.getTimer()),mc.remove(),mc.setTimer(null),window.clearTimeout(Yw.getTimer()),Yw.remove(),Yw.setTimer(null),A.publish("updateFrame","")}),A.subscribe("adaptBBox_OnlyMove",e=>{this.adaptAll(e,void 0,void 0,!0)}),A.subscribe("clearAllHight",()=>{!x.getInstance().isactive||23==x.getInstance().doctype||Ve.highlight.unhighLigthAll()}),A.subscribe("highlightNetClass",({netClasses:e,needAdaptAll:r,isHighlight:i})=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;A.publish("clearSelect","");let n=[];e.forEach(s=>{let a=te.getInstance().getNetClass(s);a&&(n=n.concat(a.getAllNets().map(l=>l.name)))}),this.highlightNet({nets:n,needAdaptAll:r,isHighlight:i})}),A.subscribe("highlightEqualLengthGroup",({equalLengthGroups:e,needAdaptAll:r,isHighlight:i})=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;A.publish("clearSelect","");let n=[];e.forEach(s=>{let a=te.getInstance().getEqualLengthGroup(s);a&&(n=n.concat(a.getAllNets().map(l=>l.name)))}),this.highlightNet({nets:n,needAdaptAll:r,isHighlight:i})}),A.subscribe("highlightDifferentails",({netDifferentails:e,needAdaptAll:r,isHighlight:i})=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;A.publish("clearSelect","");let n=[];e.forEach(s=>{let a=te.getInstance().getNetDifferential(s);a&&(n=n.concat(a.getAllNets().map(l=>l.name)))}),this.highlightNet({nets:n,needAdaptAll:r,isHighlight:i})}),A.subscribe("highlightNet",({nets:e,needAdaptAll:r,isHighlight:i,globalIndex:n})=>{!x.getInstance().isactive||23==x.getInstance().doctype||(A.publish("clearSelect",""),this.highlightNet({nets:e,needAdaptAll:r,isHighlight:i,globalIndex:n}))}),A.subscribe("highlightNetsByDataName",({dataTargetType:e,name:r,needAdaptAll:i,isHighlight:n,globalIndex:s})=>{var l,c;if(!x.getInstance().isactive||23==x.getInstance().doctype||!r)return;let a=[];if(e=="DifferentialPair"){let h=te.getInstance().getNetDifferential(r);if(h){let u=(l=h.positiveNet)==null?void 0:l.name,d=(c=h.negativeNet)==null?void 0:c.name;u&&a.push(u),d&&a.push(d)}}else if(e=="NetClass"){let h=te.getInstance().getNetClass(r);a=Array.from(h._nets)}else if(e=="EqualLengthNetGroup"){let h=te.getInstance().getEqualLengthGroup(r);a=Array.from(h.getNets())}a.length>0&&(A.publish("clearSelect",""),this.highlightNet({nets:a,needAdaptAll:i,isHighlight:n,globalIndex:s}))}),A.subscribe("toggleRatlineNet",({netName:e,visible:r})=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let i=ze.getAllNets(),n=e===""?i:[e],s={};n.forEach(a=>{let l=Vh.getNet(a);l.showRatline=r,Ql(a)}),i.forEach(a=>{let l=Vh.getNet(a);s[a]=l.showRatline}),A.publish("toggleSelectedRatlineNet",s,$()),A.publish("updateFrame","")}),A.subscribe("toggleSelectedRatline",({type:e,visible:r,isCycleSwitch:i})=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let n=Ve.getSelects(),s=new Set;n.forEach(c=>{c instanceof Me?c.getPads().forEach(u=>{s.add(u.net)}):e!=="DeviceOnly"&&(c instanceof Ri||c instanceof fn||c instanceof Ge||c instanceof Ar||c instanceof _n)&&s.add(c.net)});let a=Array.from(s);i&&(r=!a.every(h=>{let u=Vh.getNet(h);return u!=null?u.showRatline:!0}));let l={};a.forEach(c=>{let h=Vh.getNet(c);h!=null&&(h.showRatline=r,l[c]=r,Ql(c))}),A.publish("toggleSelectedRatlineNet",l,$()),A.publish("updateFrame","")}),A.subscribe("toggleDRCError",e=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let{item:r,visible:i,globalIndex:n}=e;n?Au.panelManager.updateTableItemVisibility(n,i):Au.panelManager.updateDRCErrorVisibility(r,i),$t.flush(),A.publish("updateFrame",""),A.publish("flushSelectingInfo","")}),A.subscribe("clearDRCError",()=>{!x.getInstance().isactive||23==x.getInstance().doctype||(Au.reset(),Eo.deleteAll(),A.publish("getAllErrorsBack",wAe([]),$()),A.publish("updateFrame",""))}),A.subscribe("toggleCopper",e=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r=[].concat(pt.getAllItem(),Xt.getAllItem(),Zt.getAllItem()).filter(a=>{var l;return a.type!="Copper Region"?!1:e.all?!0:e.isLayer?e.ids.includes((l=a.layerId)==null?void 0:l.toString()):e.ids.includes(a.globalIndex)});r.forEach(a=>{a.toggleCopperResult(e.visible)});let i=r.reduce((a,l)=>(a[l.globalIndex]=e.visible,a),{}),n=Ve.getItems(),s=n.filter(a=>!(!a.isVisible&&!a.isHighLight));s.length!=n.length&&A.publish("select",s),A.publish("toggleCopperEyeState",i,$()),A.publish("updateFrame","")}),A.subscribe("updateCopperStateByLeft",()=>{let e=[].concat(pt.getAllItem(),Xt.getAllItem(),Zt.getAllItem()),r=e.find(n=>n.type=="Copper Region"&&n.hiddenCopperResult),i=e.find(n=>n.type=="Copper Region"&&!n.hiddenCopperResult);if(r&&!i){let n=Ve.getItems(),s=n.filter(l=>l instanceof Ye&&l.type=="Copper Region"?(l.visible(),!1):!0);s.length!=n.length&&A.publish("select",s);let a=Ui.getInstance().getItem(21);a.visible=!1,$t.flush()}else if(!r&&i){let n=Ui.getInstance().getItem(21);n.visible=!0,$t.flush()}}),A.subscribe("zoom",e=>{!x.getInstance().isactive||23==x.getInstance().doctype||(e=="in"?this.zoomIn():this.zoomOut(),A.publish("updateFrame",""))}),A.subscribe("flipBoard",this.flip.bind(this)),A.subscribe("ToggleCanvasBottomLayerBarStatus",e=>{!x.getInstance().isactive||23==x.getInstance().doctype||(we.isShowBottomLayerScrollBarShow=e)}),A.subscribe("autoTrimSilkscreen",this.toggleAutoTrimSilkscreen.bind(this)),A.subscribe("updateLastMousePosition",e=>{this.lastMousePosition=e}),A.subscribe("removeLoop",()=>{!x.getInstance().isactive||23==x.getInstance().doctype||(pr.removeLoop=!pr.removeLoop,we.removeLoop=pr.removeLoop,Hi())}),A.subscribe("Absolute",this.absolute.bind(this)),A.subscribe("Relative",this.relative.bind(this)),A.subscribe("RelativeY",this.relativeY.bind(this)),A.subscribe("updateCross",this.updateCross.bind(this)),A.subscribe("updateCrossDirect",e=>{this.prepare(e)}),A.subscribe("showAndUpdateCross",e=>{this.showAndUpdateCross(e)}),A.subscribe("moveCrosshair",e=>{this.moveCrosshair(e)}),A.subscribe("destoryCanvasCross",()=>{this.destoryCanvasCross()}),A.messageBus.rpcService("getPcbCrossProbeToSchData",e=>{var n;let r=mw.getCrossProbeData(),i=(n=Ve.getItems())==null?void 0:n.length;return{rule:r,hasSelected:i}}),A.subscribe("CheckAndNotifySchCrossProbe",e=>{Ve.crossProbe(void 0,e.selectTabId)}),A.messageBus.subscribe("pcbCrossProbe",function(e){A.publish("updateFrame","");let r="[pcb]pcbCrossProbe";console.time(r);let{parts:i,pins:n,nets:s,pcbPlaceTransfer:a,otherData:l,partKey:c="Unique ID"}=e;if(!(l!=null&&l.isManualTrigger)&&!we.isCheckedCrossProbeMode)return;let h=[];n&&n.map(m=>{let g=m.pinNum.split(",");h.push(...g)});let u=[],d={},p=Cr.getAllItem();for(let m of p){let g=m.attrKeyValue[c];if(g!=null&&g!=""){let y=d[g];y==null&&(y=new Array,d[g]=y),y.push(m)}}if(i!=null&&i.length)for(let m of i){let g=d[m]||[];for(let y of g)y.click(),u.push(y)}if(n!=null&&n.length>0&&!a)for(let m of n){let g=m.groupUniqueId;if(!g)continue;let y=d[g]||[];for(let b of y){let P=b.getPads();for(let T of P)m.pinNum.split(",").includes(T.num)&&(T.click(),u.push(T))}}if(s!=null&&s.length){let m=ze.getAllItem();Fn(m,(g,y)=>{let b=Array.from(y),P=b[0].net;s.indexOf(P)!==-1&&Fn(b,(T,I)=>{I.click(),u.push(I)})})}if(Ve.clearSelect({tabId:x.getInstance().tabId}),Bt.cancelHightLightAll(),ce.pcbConfig.isOtherObjectsDimDuringCrossProbe){let m=x.getInstance().isactive;x.getInstance().isactive=!0,A.publish("highLight","HIGHLIGHT_CANCELALL"),x.getInstance().isactive=m}if(!u.length)l!=null&&l.isManualTrigger&&!(l!=null&&l.isCrossProbeTool)&&A.publish("showPcbSlideMsg",["Can't find matching objects"],$());else{let m=new Set,g=[];for(let y of u)if(y!=null&&!y.isEmpty){if(!Bt.checkIsCanEditByItem(y)){m.add(y);continue}g.push(y),y.click()}Bt.hightItems(Array.from(m)),A.publish("select",g),setTimeout(()=>{let y=null,b=new _e;if(g.forEach(P=>{b.ext1(P.buildBBox())}),m.forEach(P=>{b.ext1(P.buildBBox())}),b.valid()){let P=x.getInstance().isactive;x.getInstance().isactive=!0,y=b.build1(),ce.pcbConfig.isAutoMoveCanvasDuringCrossProbe&&A.publish("adaptBBox_OnlyMove",y),ce.pcbConfig.isAutoFitSelectionDuringCrossProbe&&A.publish("adaptBBox",y),ce.pcbConfig.isOtherObjectsDimDuringCrossProbe&&A.publish("highLight","HIGHLIGHT_SELECTED_OBJECTS"),x.getInstance().isactive=P}if(g.length&&a&&!x.getInstance().isReadOnlyMode){let P=x.getInstance().isactive;x.getInstance().isactive=!0,Ma=y.center(),A.publish("toggle",{command:"batchMoveItem",refer:new u2(g,Ma.x,Ma.y),menu:"MOVE_BY_CENTER_POINT",pcbPlaceTransfer:a}),x.getInstance().isactive=P}if(!a){let P;g.length==1&&!m.size?P=g[0].buildBBox().center():!g.length&&m.size==1&&(P=Array.from(m)[0].buildBBox().center()),P&&(mc.show(P),mc.click(),clearTimeout(this.timer),this.timer=setTimeout(()=>{mc.remove(),A.publish("updateFrame","")},1e3))}A.publish("updateFrame","")},0)}console.timeEnd(r)}),A.subscribe("clearSelected",function(){A.publish("clearSelect",""),A.publish("flushService","")}),A.subscribe("refreshNextTool",this.refreshNextTool.bind(this)),A.subscribe("main2iframe/trigger-event",e=>{var y;let{type:r,button:i,buttons:n,clientX:s,clientY:a}=e[0]||{},{x:l,y:c,width:h,height:u,top:d,bottom:p,left:m,right:g}=((y=window.frameElement)==null?void 0:y.getBoundingClientRect())||{};(i===1||n&4)&&r==="mouseup"&&this.onMouseMidUp(this.inputInfo),(i===1||n&4)&&r==="mousemove"&&(Pi.getInstance().mouseX=(s-m)*this.getRatio(),Pi.getInstance().mouseY=(a-d)*this.getRatio(),this.onMouseMove(Pi.getInstance()),A.publish("updateFrame",""))}),A.subscribe("from/ui/canvas/scale",({scale:e})=>{this.camera.setScale(e),A.publish("updateFrame","")}),A.subscribe("showAndUpdateCross2Pcb",e=>{let{x:r,y:i}=e,n=new _e;n.ext5(r-100,r+100,i-100,i+100),this.adaptAll(n.build1(),.6,void 0,!0);let s=Pi.getInstance();s.sceneX=r,s.sceneY=i,this.showAndUpdateCross(s),A.publish("updateModify",""),setTimeout(()=>{A.publish("destoryCanvasCross",""),A.publish("updateModify","")},1e3)},$())}get lastMousePosition(){return this._lastMousePosition==null?(this._lastMousePosition=x.getInstance().origin,this._lastMousePosition):this._lastMousePosition}set lastMousePosition(e){this._lastMousePosition=e}getRatio(e=1){return x.getInstance().getRatio()}setNextTool(e){this.nextTool=e,Pi.getInstance().hovering=!1,yi.currentCanUndoTool=e.getCanUndo()}getNextTool(){return this.nextTool}updateCross(){this.onMouseMove(Pi.getInstance())}showAndUpdateCross(e){let r=ce.themeConfig.canvasTheme.cursorColor;if(this.nextTool!=null&&this.nextTool instanceof ko&&ce.pcbConfig.crossCursor!="None"){let i=this.computeLength(new Mt(e.mouseX,0,0),e),n=this.computeLength(new Mt(e.mouseX,-e.canvasHeight,0),e),s=this.computeLength(new Mt(0,e.mouseY,0),e),a=this.computeLength(new Mt(e.canvasWidth,e.mouseY,0),e);if(ce.pcbConfig.crossCursor==="Small"){let c=30/this.camera.getScale();i=new Mt(e.sceneX,e.sceneY+c,0),n=new Mt(e.sceneX,e.sceneY-c,0),s=new Mt(e.sceneX-c,e.sceneY,0),a=new Mt(e.sceneX+c,e.sceneY,0)}if(this.mark.length==0){let l=ce.themeConfig.canvasTheme,c=l.isSolidLine(l.cursorLineStyle),h=new hr(1002,new S(e.sceneX,i.y),new S(e.sceneX,n.y),c,r),u=new hr(1002,new S(s.x,e.sceneY),new S(a.x,e.sceneY),c,r);this.mark.push(h),this.mark.push(u)}else this.mark[0].start=new S(e.sceneX,i.y),this.mark[0].end=new S(e.sceneX,n.y),this.mark[1].start=new S(s.x,e.sceneY),this.mark[1].end=new S(a.x,e.sceneY)}else this.mark.length!=0&&(this.mark[0].remove(),this.mark[1].remove(),this.mark.length=0);this.mark.forEach(i=>{i.color=r})}destoryCanvasCross(){this.mark.length!=0&&(this.mark[0].remove(),this.mark[1].remove(),this.mark.length=0)}highlightError({globalIndex:e,objs:r,pos:i,needAdaptAll:n}){let l=new ut(i.x-5,i.x+5,i.y-5,i.y+5);n?this.adaptAll(l,.6):this.locationMapItem(l),this.highlightItems({globalIndexArr:r,needAdaptAll:!1}),Eo.highlightError(e),A.publish("updateFrame","")}highlightItems({globalIndexArr:e,needAdaptAll:r,noNeedCrossLine:i,isHighlight:n}){if(!x.getInstance().isactive||23==x.getInstance().doctype||(zo.unHighlightAll(),Eo.unHighlightAll(),Bt.cancelHightLightAll(),Ve.highlight.cancelHighlightUnselect(),n&&x.getInstance().doctype==3&&Ve.highlight.unhighLigthAll(),A.publish("clearSelect",""),e.length==0))return;let s=new er,a=[],l=new Set,c=new _e,h=!1,u=new Set,d=!0;if(e.forEach(p=>{let m,g;typeof p=="object"?p.start&&p.end&&p.net?m=zo.getRatlineByNetName(p.net).filter(I=>I.startNode.globalIndex==p.start&&I.endNode.globalIndex==p.end)[0]:p.id&&p.visible!=null&&(g=p.id,d=p.visible):g=p;let y=kt.getItem(g),b=s.getItem(g);if(!b&&g&&(b=y),b&&!Bt.checkIsCanEditByItem(b)){u.add(b);return}let P;if(m)h=!0,Vh.getNet(m.net).showRatline&&(m.click(),a.push(m));else if(y)y.getItems().forEach(T=>{c.ext1(T.buildBBox()),a.push(T),T.click()});else{if(P=s.getItem(g),!P)return;P instanceof Ki&&be.setActiveLayer(be.getLayer(P.layerId));let T=new Set([P]);n&&x.getInstance().doctype==3&&x.getInstance().forceVisibleHighLightPt&&x.getInstance().forceVisibleHighRange||(T=$t.filter([P])),c.ext1(P.buildBBox()),T.size>0&&d&&(P instanceof Me&&P.attributes.forEach(I=>{I.key&&(I.showKey||I.showValue)&&c.ext1(I.buildBBox())}),!(P.getParent()instanceof Me)||P instanceof Le||P instanceof fr&&P.key?(a.push(P),P.click()):l.add(P.globalIndex))}}),c.valid()&&d&&(r?this.adaptAll(c.build1(),.6,h?Number.MAX_SAFE_INTEGER:7):this.locationMapItem(c.build1())),e.length==1&&!i){let p=typeof e[0]=="object"?e[0].id:e[0],m=s.getItem(p)||kt.getItem(p);if(!m)return;mc.show(m.buildBBox().center()),mc.click(),clearTimeout(this.timer),this.timer=setTimeout(()=>{mc.remove(),A.publish("updateFrame","")},1e3)}n&&x.getInstance().doctype==3&&a.forEach(p=>{Ve.highlight.addHightItem(p)}),Bt.hightItems(Array.from(u)),A.publish("select",a),Ve.highlight.highlightUnselect(l),this.moveCrosshair(Pi.getInstance()),A.publish("updateFrame",""),Ve.crossWindow(),Ve.mouseSelectedForAPI()}absolute(e){if(!(!x.getInstance().isactive||23==x.getInstance().doctype)&&e.length==3){let r=I3(parseFloat(e[1])),i=I3(parseFloat(e[2]));this.click4Command(r+x.getInstance().origin.x,i+x.getInstance().origin.y,"absolute")}}relative(e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(Ve.getSelects().length>1)if(e.length===3)this.relative4MultiMove(+e[1],+e[2]);else if(e.length===2)this.relative4MultiMove(+e[1],0);else return;else{let i=0,n=0;if(e.length===3)i=I3(parseFloat(e[1])),n=I3(parseFloat(e[2]));else if(e.length===2)i=I3(parseFloat(e[1]));else return;let s=this.lastMousePosition.x+i,a=this.lastMousePosition.y+n;this.click4Command(s,a,"relative")}}relativeY(e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(Ve.getSelects().length>1)if(e.length===2)this.relative4MultiMove(0,+e[1]);else return;else{let i=0,n=0;if(e.length===2)n=I3(parseFloat(e[1]));else return;let s=this.lastMousePosition.x+i,a=this.lastMousePosition.y+n;this.click4Command(s,a,"relative")}}click4Command(e,r,i){let n=new Pi(Ni().getWidth(),Ni().getHeight()),s=ce.pcbConfig.snapToOriginWhileDragFootprint,a=ce.pcbConfig.snapToOriginWhileDragFootprint;i=="relative"?(ce.pcbConfig.snapToOriginWhileDragFootprint=!1,ce.pcbConfig.snapToCenterWhileDragPadOrVia=!1):(ce.pcbConfig.snapToOriginWhileDragFootprint=!0,ce.pcbConfig.snapToCenterWhileDragPadOrVia=!0);let l=this.adsorb;this.adsorb=!1,this.update4Click(n,this.lastMousePosition.x,this.lastMousePosition.y),n.leftDown=!0,this.handler(c=>{c.onMouseLeftDown(n)}),this.update4Click(n,e,r),this.handler(c=>{c.onMouseMove(n)}),this.lastMousePosition=new S(e,r),this.handler(c=>{c.onMouseLeftUp(n)}),this.updateMousePosition(n),this.moveCrosshair(n),A.publish("updateFrame",""),n.removePoint(),ce.pcbConfig.snapToOriginWhileDragFootprint=s,ce.pcbConfig.snapToCenterWhileDragPadOrVia=a,this.adsorb=l}zoomIn(){this.setScale(q$)}zoomOut(){this.setScale(1/q$)}highlightNet({nets:e,needAdaptAll:r,isHighlight:i,globalIndex:n}){let s=new Set;zo.highlightByNets(e,!1),i&&x.getInstance().doctype==3&&Ve.highlight.unhighLigthAll();let a={eventType:"selected",props:e.map(h=>({net:h}))};if(A.windowBridge.publish("leftTree-net",a,$()),e.forEach(h=>{ze.getSameNetItemsWithoutPourAndPlaneZone(h.toUpperCase()).forEach(d=>{s.add(d)})}),n){let u=new er().getItem(n);s.add(u)}i&&x.getInstance().doctype==3&&(!x.getInstance().forceVisibleHighLightPt||!x.getInstance().forceVisibleHighRange)&&(s=$t.filter(s));let l=Array.from(s),c=new Set;if(l=l.filter(h=>Bt.checkIsCanEditByItem(h)?!0:(c.add(h),!1)),l.length>0||c.size>0){let h=new _e;l.forEach(u=>{u.click(),h.ext1(u.buildBBox()),h.valid()&&(r?this.adaptAll(h.build1(),.6):this.locationMapItem(h.build1())),l.length==1&&(mc.show(u.buildBBox().center()),mc.click(),clearTimeout(this.timer),this.timer=setTimeout(()=>{mc.remove(),A.publish("updateFrame","")},1e3))}),i&&x.getInstance().doctype==3&&l.forEach(u=>{Ve.highlight.addHightItem(u)}),Bt.cancelHightLightAll(),Bt.hightItems(Array.from(c)),A.publish("select",l),A.publish("updateFrame","")}}onKeyDown(e){this.prepare(e),k9.getInstance().refreshInputEnv(this.inputInfo);let r=yi.getScene(),i=sr.getAction(r,e);if(!i){let n=$$.getHotkeyInfo(r,e);n&&A.publish("Pcb/ui_hotkey",{function:n.uiAction,key:n.uiAction,cmd:"",keyStr:n.hotKey,keyCode:e.keyCode,funcE:""},$())}if(i!=null)switch(i){case"convertToLineFromBoard":{WG();break}case"place":{(this.nextTool&&this.nextTool instanceof ci||this.nextTool instanceof dh||this.nextTool instanceof GU||this.nextTool instanceof Fw||this.nextTool instanceof xN||this.nextTool instanceof iO||this.nextTool instanceof Q_||this.nextTool instanceof UU||this.nextTool instanceof LN)&&this.nextTool.onEnterPlace(e);break}case"decrease_snap_size":{let n=L9(),s=n.snapX*10-1,a=n.snapY*10-1,l=(s<1?s+1:s)+"mil",c=(a<1?a+1:a)+"mil";A.publish("SnapSizeSetting",{snapX:l,snapY:c});break}case"increase_snap_size":{let n=L9(),s=n.snapX*10+1+"mil",a=n.snapY*10+1+"mil";A.publish("SnapSizeSetting",{snapX:s,snapY:a});break}case"select_net":{Ve.selectNet();break}case"Fit All in Window":{A.publish("adaptAll","");break}case"Single Routing":{if(x.getInstance().doctype==3){A.publish("tool","draw(track)");return}break}case"MultiRouting":{if(x.getInstance().doctype==3){A.publish("tool","draw(multiTrack)");return}break}case"Save":{A.windowBridge.rpcCall("save",{tabId:x.getInstance().tabId},$());break}case"close_tab":{A.publish("Pcb/doCommand","close_tab",$());break}case"close_all_tabs":{A.publish("Pcb/doCommand","close_all_tabs",$());break}case"toolbar_toggle(leftbar)":{A.publish("Pcb/doCommand","toolbar_toggle(leftbar)",$());break}case"toolbar_toggle(rightbar)":{A.publish("Pcb/doCommand","toolbar_toggle(rightbar)",$());break}case"switchNextDoc":{A.publish("Pcb/doCommand","switchNextDoc",$());break}case"switchPreDoc":{A.publish("Pcb/doCommand","switchPreDoc",$());break}case"switchNextDocByNatural":{A.publish("Pcb/doCommand","switchNextDocByNatural",$());break}case"switchPreDocByNatural":{A.publish("Pcb/doCommand","switchPreDocByNatural",$());break}case"draw(origin)":{A.publish("Pcb/doCommand","draw(origin)",$());break}case"setOriginByCoordinate":{A.publish("Pcb/doCommand","setOriginByCoordinate",$());break}case"SaveAll":{A.publish("saveAll","",$());break}case"OperateBottomPanel":{A.publish("operateBottomPanel","",$());break}case"DrawArc":{A.publish("tool","draw(arc)");break}case"draw(arcCenter)":{A.publish("tool","draw(arcCenter)");break}case"DrawRect":{A.publish("tool","draw(rect)");break}case"DrawCircle":{A.publish("tool","draw(circle)");break}case"DrawPolyline":{A.publish("tool","draw(Line)");break}case"placePad":{A.publish("tool","PlaceSinglePad");break}case"Show Or Hide Number Or Net Name":{Uw.toggleAllStateLoop();break}case"placeOriginCenter":{A.publish("placeOrigin","center");break}case"ShowTextDialog":{A.publish("getLastText","");break}case"Stretch Track":{if(x.getInstance().doctype==3){A.publish("tool","draw(stretchtrack)");return}break}case"draw(difftrack)":{if(x.getInstance().doctype==3){A.publish("tool","draw(difftrack)");return}break}case"equalLengthTuning":{if(x.getInstance().doctype==3){A.publish("equalLengthTuning","");return}break}case"Place Via":{if((x.getInstance().doctype==3||x.getInstance().doctype==4)&&!(this.nextTool instanceof Vo&&this.nextTool.drawing)&&!(this.nextTool instanceof Vo&&this.nextTool.drawing)){Ve.parse({cmdKey:"ADD:ADDWITH_VIA"});return}break}case"PlaceViaFence":{if(x.getInstance().doctype==3){A.publish("openMainDialog",{cmd:12,data:{}});return}break}case"Switch Layer Brightness":{A.publish("layerNeedGray","");break}case"Find and Replace":{A.publish("doCommand_ui",["findObjects"],$());break}case"Zoom In":{this.markZoomCenter({positionX:e.mouseX,positionY:e.mouseY},e),this.zoomIn();break}case"Zoom Out":{this.markZoomCenter({positionX:e.mouseX,positionY:e.mouseY},e),this.zoomOut();break}case"Flip Board":{this.flip();break}case"Measure Distance":{A.publish("tool","MeasureDistance");break}case"creepageDistance":{A.publish("tool","CreepageDistance");break}case"Copy Special":{A.publish("tool","copySpecial");break}case"Place Single Pad":{A.publish("tool","PlaceSinglePad");break}case"Place Test Point":{A.publish("tool","place_part(testPad)");break}case"Rebuild All Copper Area":{A.publish("rebuildCopper",{isManual:!0}),A.publish("rebuildPlane",{isManual:!0});break}case"ChangeCopperZoneVisibleorInvisible":{$t.setVisible(21,!$t.getVisible(21)),A.publish("flushSelectingInfo",""),Yh.type&&A.publish("FlushSketcherAttrView",{type:Yh.type}),Y3();break}case"DisplayAllLayers":{A.publish("DisplayLayer",["DisplayLayer","all"]);break}case"OpenProject":{A.publish("Pcb/doCommand","openProject",$());break}case"tutorials":{A.publish("Pcb/doCommand","tutorials",$());break}case"NewProject":{A.publish("Pcb/doCommand","new_project",$());break}case"fullScreen":{A.publish("doCommand_ui",["fullScreen",{keyCode:e.keyCode}],$());break}case"Unit":{x.getInstance().unit=="mil"?FC("mm"):FC("mil");break}case"Command":{A.publish("Pcb/doCommand","command-tool",$());break}case"ChangetoTopLayer":{A.publish("toggleLayerSelected",{layerid:1});break}case"ChangetoBottomLayer":{A.publish("toggleLayerSelected",{layerid:2});break}case"ChangetoInner1":{A.publish("toggleLayerSelected",{layerid:15});break}case"ChangetoInner2":{A.publish("toggleLayerSelected",{layerid:16});break}case"ChangetoInner3":{A.publish("toggleLayerSelected",{layerid:17});break}case"ChangetoInner4":{A.publish("toggleLayerSelected",{layerid:18});break}case"ChangetoInner5":{A.publish("toggleLayerSelected",{layerid:19});break}case"ChangetoInner6":{A.publish("toggleLayerSelected",{layerid:20});break}case"Switch to the Next Signal Layer":{Ve.nextSignalLayer("next");break}case"Switch to the Previous Signal Layer":{Ve.nextSignalLayer("previous");break}case"Switch to the Next Layer":{Ve.nextLayer("next");break}case"Switch to the Previous Layer":{Ve.nextLayer("previous");break}case"Scroll Down":{r.indexOf(2)<0&&this.moveCamera1(0,this.getRulerScale());break}case"Scroll Up":{r.indexOf(2)<0&&this.moveCamera1(0,-this.getRulerScale());break}case"Scroll Right":{if(r.indexOf(2)<0){let n=St.getInstance().flip?-1:1;this.moveCamera1(-this.getRulerScale()*n,0)}break}case"Scroll Left":{if(r.indexOf(2)<0){let n=St.getInstance().flip?-1:1;this.moveCamera1(this.getRulerScale()*n,0)}break}case"CenterViewByCursor":{let n=new _e;n.ext5(e.realSceneX-100,e.realSceneX+100,e.realSceneY-100,e.realSceneY+100),this.adaptAll(n.build1(),.6,void 0,!0);break}case"DuplicateToCursor":{A.publish("duplicateToCursor","");break}case"DuplicateToOtherLayer":{A.publish("duplicateToOtherLayer","");break}case"changeRoutingMode":{A.publish("toggleRouteMode",tr.getInstance().getNextMode());break}case"layerOptionsSet":{A.publish("openLayerManagerDialog","");break}case"DrawCircle":{A.publish("tool","draw(circle)");break}case"draw(dimension)":{A.publish("tool","draw(dimension)");break}case"draw(PCopper)":{A.publish("tool","draw(PCopper)");break}case"Unhighlight All":{A.publish("highLight","HIGHLIGHT_CANCELALL");break}case"toggleAdsorb":{A.publish("toggleAdsorb","");break}case"openMenu(#mm-common-file)":case"opensubmenu-move":case"opensubmenu-new":case"opensubmenu-import":case"opensubmenu-selectobj":case"opensubmenu-booleanoperation":case"opensubmenu-gridsize-pcb":case"opensubmenu-drawline":case"opensubmenu-dimension":case"opensubmenu-export":case"opensubmenu-recent":case"opensubmenu-pad":case"opensubmenu-duplicate":case"opensubmenu-delete":case"opensubmenu-gridtype-pcb":case"opensubmenu-snapsize":case"opensubmenu-ratline":case"opensubmenu-highlight-pcb":case"opensubmenu-suturevias":case"opensubmenu-boardoutline":case"opensubmenu-testPad":case"opensubmenu-saveas":case"copperRegion":case"fillRegion":case"opensubmenu-fpcStiffener":case"prohibitedRegion":case"opensubmenu-slotRegion":case"opensunmenu-3dShellOutline":case"opensubmenu-3DShellSideSlotRegion":case"opensubmenu-3DShell-Top_Bottom-SlotRegion":case"opensubmenu-3DShell-SideEntity":case"opensubmenu-3DShell-TopEntity":case"opensubmenu-unroute":case"opensubmenu-group":case"opensubmenu-offset":case"opensubmenu-align":case"opensubmenu-rotate":case"opensubmenu-flip":case"opensubmenu-canvasOrigin":case"opensubmenu-system":case"opensubmenu-schematic_symbol":case"opensubmenu-pcb_footprint":case"opensubmenu-panel":case"opensubmenu-routingWidth":case"opensubmenu-tabmenu":case"opensubmenu-distribute":case"opensubmenu-boardshape":case"importChangesFromSch":case"importChangesFromPcb":case"reuseTemplateLayoutAndRoute":case"viewPCBInformation":case"createAnnotation":case"placeDevice":case"pcbOptimizedPath":case"Split":case"Cutout":case"draw(RCutout)":case"draw(PCutout)":case"draw(CCutout)":case"avoidSlots":case"avoidPads":case"CONVERT_TO_PAD":case"CONVERT_TO_2D_LINE":case"CONVERT_TO_SLOT_REGION":case"CONVERT_TO_FILL_REGION":case"CONVERT_TO_COPPER_REGION":case"CONVERT_TO_PROHIBITED_REGION":case"CONVERT_TO_BOARD_OUTLINE":case"CONVERT_TO_CONSTRAINT_REGION":case"CONVERT_TO_D3_SHELL_OUTLINE":case"CONVERT_TO_D3_SHELL_SLOT_REGION":case"CONVERT_TO_D3_SHELL_ENTITY":case"CONVERT_TO_FPC_STIFFENER":case"drawpartition(Rectangle)":case"drawpartition(Circle)":case"drawpartition(Polygon)":case"OPEN_PARTITION_MANAGER":case"copyToImage":case"INCREASE_BRIGHTNESS":case"DECREASE_BRIGHTNESS":{this.openTopMenu({cmd:i},e);break}case"openMenu(#mm-common-edit)":{this.openTopMenu({cmd:"openMenu(#mm-common-edit)"},e);break}case"openMenu(#mm-common-view)":{this.openTopMenu({cmd:"openMenu(#mm-common-view)"},e);break}case"openMenu(#mm-common-place)":{this.openTopMenu({cmd:"openMenu(#mm-common-place)"},e);break}case"openMenu(#mm-common-design)":{this.openTopMenu({cmd:"openMenu(#mm-common-design)"},e);break}case"openMenu(#mm-common-route)":{this.openTopMenu({cmd:"openMenu(#mm-common-route)"},e);break}case"openMenu(#mm-common-layout)":{this.openTopMenu({cmd:"openMenu(#mm-common-layout)"},e);break}case"openMenu(#mm-common-tools)":{this.openTopMenu({cmd:"openMenu(#mm-common-tools)"},e);break}case"openMenu(#mm-common-fabrication2)":{this.openTopMenu({cmd:"openMenu(#mm-common-fabrication2)"},e);break}case"openMenu(#mm-common-advanced)":{this.openTopMenu({cmd:"openMenu(#mm-common-advanced)"},e);break}case"openMenu(#mm-common-order)":{this.openTopMenu({cmd:"openMenu(#mm-common-order)"},e);break}case"openMenu(#mm-common-settings)":{this.openTopMenu({cmd:"openMenu(#mm-common-settings)"},e);break}case"openMenu(#mm-common-help)":{this.openTopMenu({cmd:"openMenu(#mm-common-help)"},e);break}case"prioritizeObjectSelection":{if(Yh.type==="DIST_MEASURE")switch(Hh.measureMode){case"MeasureDistance":Hh.measureMode="MeasureObjectDistance";break;case"MeasureObjectDistance":Hh.measureMode="CreepageDistance";break;default:Hh.measureMode="MeasureDistance";break}break}case"new_board":{A.publish("Pcb/doCommand","new_board",$());break}case"new_PCB":{A.publish("Pcb/doCommand","new_PCB",$());break}case"new_Panel":{A.publish("Pcb/doCommand","new_Panel",$());break}case"new_schematic":{A.publish("Pcb/doCommand","new_schematic",$());break}case"new_device":{let n={};n.cmd="new_device",n.args={docType:2},A.publish("Pcb/doCommand",n,$());break}case"new_NetFlag":{let n={};n.cmd="new_device",n.args={docType:18},A.publish("Pcb/doCommand",n,$());break}case"new_NetPort":{let n={};n.cmd="new_device",n.args={docType:19},A.publish("Pcb/doCommand",n,$());break}case"new_Drawing":{let n={};n.cmd="new_device",n.args={docType:20},A.publish("Pcb/doCommand",n,$());break}case"new_Non_Electronic":{let n={};n.cmd="new_device",n.args={docType:21},A.publish("Pcb/doCommand","new_schematic",$());break}case"new_schematicLib":{A.publish("Pcb/doCommand","new_schematicLib",$());break}case"new_footprint":{A.publish("Pcb/doCommand","new_footprint",$());break}case"new_3D_model":{A.publish("Pcb/doCommand","new_3D_model",$());break}case"new_CBB":{A.publish("Pcb/doCommand","new_CBB",$());break}case"Paste":{this.nextTool instanceof ci&&!dt.editingWhat&&A.publish("tool","PASTE");break}case"compareNetlist":{A.publish("doCommand_ui",["compareNetlist"],window.top);break}case"standard_edition_migration":case"projectSaveAsCloud":case"projectSaveAsLocal":case"docSaveAsCloud":case"docSaveAsLocal":case"backup":case"version_management":case"new_node":case"new_branch":case"recovery":case"cacheRecovery":case"importDXF":case"insertImage":case"importFile(easyeda)":case"file_open":case"importFile(altium)":case"importFile(eagle)":case"importFile(kicad)":case"importFile(pads)":case"importFile(protel)":case"importFile(ltspice)":case"importSes":case"importNetlist":case"exportBOM":case"pcb_fabrication":case"pcb_export_coordinate_file":case"export3DFile":case"export3DShellFile":case"openDxfExportDlg":case"export(filePdf)":case"exportTestPointReport":case"exportManufacturingFilesForOneClick":case"export(altium)":case"exportDSN":case"closeProject":case"clearRecentList":case"source(easyEDA)":case"MOVE_BY_ORIGIN_POINT":case"delete-target":case"delete-all":case"continuousSelection":case"rectangleOutside":case"rectangleInside":case"polygonInside":case"polygonOutside":case"lineTouched":case"connectedCopper":case"editArray":case"ADD_FILLET":case"ADD_CHAMFER":case"unlockAll":case"switchVersion":case"historicalRecords":case"connectPads":case"bom_order_parts":case"orderPCB":case"order3DShell":case"show_help_file(part_store)":case"show_help_file(pcb_manu_facturing)":case"show_help_file(3d_cnc)":case"Preview2D":case"Preview3D":case"Preview3DInNewWindow":case"fitview":case"adaptSelectionView":case"adaptAreaSelectionView":case"fitBoard":case"switchView(normal)":case"switchView(outline)":case"brightness(0)":case"brightness(1)":case"brightness(2)":case"gridSnapKeepRatio":case"setGridSize":case"setGridRange":case"switchGridType(outlets)":case"switchGridType(none)":case"hideSelectedComponentRatline":case"hideAllRatline":case"showSelectedComponentRatline":case"showAllRatline":case"HIGHLIGHT_COMPONENT":case"HIGHLIGHT_SELECTED_OBJECTS":case"HIGHLIGHT_CANCEL_COMPONENT":case"HIGHLIGHT_CANCEL_SELECTED_OBJECTS":case"toolbar_toggle(topbar)":case"boolIntersection":case"boolAggregate":case"boolSubtraction":case"boolExclusive":case"boolSplit":case"draw(rectSutureVia)":case"draw(polygonSutureVia)":case"draw(lineSutureVia)":case"place_part(line_pads)":case"place_part(rect_pads)":case"draw(ROutline)":case"draw(POutline)":case"draw(COutline)":case"draw(RCopper)":case"draw(CCopper)":case"draw(RRegion)":case"draw(PRegion)":case"draw(CRegion)":case"draw(RectFPCStiffener)":case"draw(CirFPCStiffener)":case"draw(PolyFPCStiffener)":case"draw(RSlot)":case"draw(PSlot)":case"draw(CSlot)":case"draw(RProhibit)":case"draw(PProhibit)":case"draw(CProhibit)":case"draw(arc2)":case"place_part(testPad)":case"place_part(autoTestPad)":case"showTextDialog_pcb":case"draw(protractor)":case"draw(radius)":case"place_part(stack_table)":case"place_part(drill_table)":case"placeOriginPad":case"draw(R3dShellOutline)":case"draw(C3dShellOutline)":case"draw(P3dShellOutline)":case"place_part(3dShellScrewPillar)":case"draw(3dShellSideSlotDatumLine)":case"draw(R3dShellSideSlotRegion)":case"draw(C3dShellSideSlotRegion)":case"draw(P3dShellSideSlotRegion)":case"draw(R3dShellTopSlotRegion)":case"draw(C3dShellTopSlotRegion)":case"draw(P3dShellTopSlotRegion)":case"draw(R3dShellSideEntity)":case"draw(C3dShellSideEntity)":case"draw(P3dShellSideEntity)":case"draw(R3dShellTopBottomEntity)":case"draw(C3dShellTopBottomEntity)":case"draw(P3dShellTopBottomEntity)":case"pcb_DRC":case"checkDRCCustom":case"clearErrors":case"toggleRealTimeDRC":case"ref_designator_annotate":case"netClassManager":case"differentialPairManager":case"equalLengthGroupManager":case"EditPadsPairGroupDialog":case"updateComponent":case"updateReuseBlock":case"trackWidthSetting(WIRING_WIDTH_FOLLOWRULES)":case"trackWidthSetting(WIRING_WIDTH_RULESSETTING)":case"trackWidthSetting(WIRING_WIDTH_INPUT)":case"removeLoop":case"autoTrimSilkscreen":case"unrouteClearConnect":case"unrouteClearNetwork":case"clearAllRoute":case"diffPairEqualLengthTuning":case"joinGroup":case"reuseLayoutRoute":case"ungroupAll":case"set-attr-text-position":case"swapLocation":case"flip2OppositeSide":case"absoluteOffset":case"relativeOffset":case"distribute_left_side_edge_equidistant":case"distribute_top_side_edge_equidistant":case"distribute_horizontal_by_center_distance":case"distribute_vertical_by_center_distance":case"distribute_horizontal_by_edges_distance":case"distribute_vertical_by_edges_distance":case"distribute":case"component_distribute_by_region":case"rotate_reference_point":case"fliph_reference_point":case"flipv_reference_point":case"smartSize":case"checkDimension":case"renumberPads":case"teardrop":case"openPanelizeDlg":case"removeUnusedPadDlg":case"log-tool":case"view3DModelManager":case"viewPinDelayManager":case"openPcbComparisonDlg":case"viewCopperAreaManager":case"openDeviceManager":case"openDeviceStandardizationTab":case"commonButtonsSetting(SYSTEM)":case"commonButtonsSetting(CATEGORY)":case"commonButtonsSetting(BASE_LIBRARY)":case"commonButtonsSetting(CANVAS)":case"commonButtonsSetting(OBJECT)":case"commonButtonsSetting(PCB_FOOTPRINT)":case"commonButtonsSetting(PCB_THEME)":case"commonButtonsSetting(PCB_COMM_GRID_SIZE)":case"commonButtonsSetting(PCB_COMM_TRACK_WIDTH)":case"commonButtonsSetting(PCB_COMM_VIA_SIZE)":case"commonButtonsSetting(ADSORPTION)":case"commonButtonsSetting(PANEL_CANVAS)":case"commonButtonsSetting(PANEL_THEME)":case"commonButtonsSetting(COMM_TYPEFACE)":case"commonButtonsSetting(DESIGN)":case"commonButtonsSetting(PROPERTY)":case"commonButtonsSetting(HOTKEY)":case"commonButtonsSetting(CUSTOM_TOOLBAR)":case"commonButtonsSetting(SAVE)":case"show_help_file(community)":case"show_help_file(contact)":case"show_about":case"printPDF":case"autoLayout":case"resetUniqueId":case"auto-routing":{!e.leftDown&&!e.rightDown&&A.publish("Pcb/doCommand",i,$());break}case"pcbBatchFanout":A.publish("pcbBatchFanout","");break;case"checkERC":{!e.leftDown&&!e.rightDown&&A.publish("Pcb/doCommand","checkDRC",$());break}case"stop_video_capture":{A.publish("Pcb/doCommand","stop_video_capture",$());break}case"show_videocapture":{A.publish("Pcb/doCommand","show_videocapture",$());break}case"EDIT BOUNDARY":{pU();break}}if(e.keyCode===27){dt.destroy(),we.smartMode&&Vs.exit();let n=Qt.getInstance().close();if(A.publish("closeLastDialog","",$()),n)return}else e.keyCode===49?A.publish("hiddenDebug",2):e.keyCode===50?A.publish("showDebug",2):e.keyCode===51?A.publish("hiddenDebug",3):e.keyCode===52?A.publish("showDebug",3):e.keyCode===53?A.publish("hiddenDebug",4):e.keyCode===54?A.publish("showDebug",4):e.keyCode===55?A.publish("hiddenDebug",5):e.keyCode===56?A.publish("showDebug",5):e.shiftKey&&(this.shiftControl(e),this.nextTool instanceof ko&&!(this.nextTool instanceof MN&&e.ctrlKey)&&this.canMouseMove&&this.nextTool.onMouseMove(e));this.handler(n=>{n.onKeyDown(e)})}onKeyUp(e){this.handler(r=>{r.onKeyUp(e)}),e.keyCode===16&&this.canMouseMove&&this.onMouseMove(e)}onMouseLeave(e){this.prepare(e),k9.getInstance().ending(),this.nextTool instanceof dh&&this.nextTool.onMouseLeave(e)}onMouseOut(e){this.prepare(e)}getRulerScale(){let e=1,r=new ft;x.getInstance().unit!="mil"&&(e=r.conversion(x.getInstance().unit,"mil",1));let i=this.camera.getScale(),n=e*i,s=0,a=n;for(;;)if(n>=1){if(n=n/10,n<1)break;s++}else if(n=n*10,s--,n>=1)break;let l=a/Math.pow(10,s);return l>=1&&l<2?10/Math.pow(10,s):l>=2&&l<5?5/Math.pow(10,s):2/Math.pow(10,s)}openCommandDialog(){A.publish("openMainDialog",{cmd:11})}onMouseRightDown(e){this.isMouseMidDown=!1,e.middleDown=!1,this.inputInfo=e,e.rightDown=!0,this.canMouseMove=!1,this.prepare(e),this.mouseX=e.mouseX,this.mouseY=e.mouseY,e.realSceneDeltaX=0,e.realSceneDeltay=0,e.openMenu=!0,e.downTime=new Date().getTime(),this.isMouseRightDown=!0,this.prevRightX=e.mouseX,this.prevRightY=e.mouseY,this.hideRightMenu(),k9.getInstance().ending(),this.handler(r=>{r.onMouseRightDown(e)}),A.publish("iframe2main/trigger-event",{type:"mouseRightDown"},$()),A.publish("CancelDelayAutoAdaptAll","")}onMouseRightUp(e){this.prepare(e),this.isMouseRightDown=!1,this.handler(r=>{r.onMouseRightUp(e)}),e.rightDown=!1,e.openMenu=!1,this.inputInfo=null,A.publish("iframe2main/trigger-event",{type:"mouseRightUp"},$())}onMouseLeftDown(e){this.isMouseMidDown=!1,e.middleDown=!1,this.inputInfo=e,this.canMouseMove=!1,this.mouseX=e.mouseX,this.mouseY=e.mouseY,this.prepare(e),this.lastMousePosition=new S(e.sceneX,e.sceneY),e.leftDown=!0,e.leftClick=!0,e.downTime=new Date().getTime(),this.nextTool instanceof dh&&(this.lastClickX=e.sceneX,this.lastClickY=e.sceneY),this.updateMousePosition(e),k9.getInstance().ending(),this.handler(r=>{r.onMouseLeftDown(e)}),A.publish("iframe2main/trigger-event",{type:"mouseLeftDown"},$()),A.publish("CancelDelayAutoAdaptAll","")}onMouseLeftUp(e){if(this.prepare(e),this.lastMousePosition=new S(e.sceneX,e.sceneY),k9.getInstance().ending(),this.handler(r=>{r.onMouseLeftUp(e)}),!(this.nextTool instanceof dh)&&(this.lastClickX=e.sceneX,this.lastClickY=e.sceneY,this.nextTool instanceof Vo)){let r=this.nextTool.getShiftStartControl();r&&(this.lastClickX=r.x,this.lastClickY=r.y)}this.removeShiftMoveHelpLine(),e.leftDown=!1,e.leftClick=!1,e.clearCrossFlag(),this.inputInfo=null,A.publish("iframe2main/trigger-event",{type:"mouseLeftUp"},$())}onMouseMidDown(e){e.rightDown||(this.inputInfo=e,this.isMouseMidDown=!0,this.canMouseMove=!1,this.mouseX=e.mouseX,this.mouseY=e.mouseY,this.prepare(e),e.realSceneDeltaX=0,e.realSceneDeltay=0,e.middleDown=!0,e.openMenu=!1,e.downTime=new Date().getTime(),this.prevMidX=e.mouseX,this.prevMidY=e.mouseY,e.clearCrossFlag(),k9.getInstance().ending(),this.handler(r=>{r.onMouseWheel(e)}),A.publish("iframe2main/trigger-event",{type:"mouseMiddleDown"},$()),A.publish("CancelDelayAutoAdaptAll",""))}onMouseMidUp(e){this.isMouseMidDown=!1,e&&(this.prepare(e),this.handler(r=>{r.onMouseRightUp(e)}),e.middleDown=!1,e.openMenu=!1,this.inputInfo=null,A.publish("iframe2main/trigger-event",{type:"mouseMiddleUp"},$()))}onMouseMove(e){var h;let r=this,i=ce.getSystemAutoPanning(),n=(h=i==null?void 0:i.type)==null?void 0:h.value,s=n&&n!="disabled",a=this.nextTool;s&&a&&(s=[dh,ci,Fw,iO].some(d=>a instanceof dh?e.leftDown:a instanceof d));let l=!1;if(s){let u=k9.getInstance(),d=u.getAutoPanningOptions(i);l=u.checking(e,d,()=>{c(!0)})}l||c(l);function c(u){u&&A.publish("updateFrame","");let d=new Date().getTime();if((Math.abs(e.mouseX-r.mouseX)>2||Math.abs(e.mouseY-r.mouseY)>2)&&(r.canMouseMove=!0),r.canMouseMove){if(r.isMouseRightDown&&!dt.editingWhat){let p=e.mouseX-r.prevRightX,m=e.mouseY-r.prevRightY;r.camera.addOffset1(p,m),r.prevRightX=e.mouseX,r.prevRightY=e.mouseY}if(r.isMouseMidDown){if(ce.getDragMiddleMouseButton()==="zoomCanvas"){let p=e.mouseY-r.prevMidY,m=1;p<0?m=Math.abs(p)/e.canvasHeight*3+1:p==0?m=1:m=1-Math.abs(p)/e.canvasHeight*3,m<=0&&(m=1),r.markZoomCenter({positionX:r.mouseX,positionY:r.mouseY},e),r.setScale(m),jt.update(e,null),r.prevMidX=e.mouseX,r.prevMidY=e.mouseY}else if(ce.getDragMiddleMouseButton()==="moveCanvas"&&(bd("grabbing"),!dt.editingWhat)){let p=e.mouseX-r.prevMidX,m=e.mouseY-r.prevMidY;r.camera.addOffset1(p,m),r.prevMidX=e.mouseX,r.prevMidY=e.mouseY}}r.prepare(e),e.rightDown&&(Math.abs(e.mouseX-r.mouseX)>5||Math.abs(e.mouseY-r.mouseY)>5)?e.openMenu=!1:e.rightDown&&d-e.downTime<120?e.openMenu=!0:e.rightDown&&(e.realSceneDeltaX!=0||e.realSceneDeltay!=0)&&(e.openMenu=!1),e.leftDown&&d-e.downTime<120?e.leftClick=!0:e.leftDown&&(e.realSceneDeltaX!=0||e.realSceneDeltay!=0)&&(e.leftClick=!1),r.handler(p=>{p.onMouseMove(e)})}Ve.dialog&&(Ve.getItems().length>0?jt.cancel():jt.update(e,"Please select the elements to which you want to add ground vias."))}}onMouseWheel(e){if(this.prepare(e),k9.getInstance().ending(),!(this.isMouseMidDown&&ce.getDragMiddleMouseButton()==="zoomCanvas")){if(ce.zoomType==="roller"){let r=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY;e.ctrlKey?this.moveCamera(0,r):e.shiftKey?this.moveCamera(-r,0):Math.abs(e.deltaX)>Math.abs(e.deltaY)?this.moveCamera(-e.deltaX,0):this.scaleCanvas1(e)}else if(e.ctrlKey)this.scaleCanvas1(e);else if(e.shiftKey){let r=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY;this.moveCamera(-r,0)}else this.moveCamera(-e.deltaX,e.deltaY);this.prepare(e),this.handler(r=>{r.onMouseWheel(e)}),A.publish("iframe2main/trigger-event",{type:"mouseWheel"},$()),A.publish("CancelDelayAutoAdaptAll","")}}scaleCanvas(e){let r;e.deltaY<0?r=q$:r=1/q$,this.markZoomCenter({positionX:e.mouseX,positionY:e.mouseY},e),this.setScale(r),jt.update(e,null),this.prepare(e)}needScale(e){let r=e.deltaX||0,i=e.deltaY||0;return e.detail&&!r&&!i&&(i=e.detail),{wheelX:r,wheelY:i}}scaleCanvas1(e,r=!1){let i=this.needScale(e);i&&this.scaleByWheel(i,e,r)}scaleByWheel(e,r,i=!1){let n,s=i?e.wheelX:e.wheelY,a=(q$-1)/100*Math.abs(s)+1;s<0?n=a:n=1/a,this.markZoomCenter({positionX:r.mouseX,positionY:r.mouseY},r),this.setScale(n),jt.update(r,null),this.prepare(r)}onResize(e){let r=window.parent.document.getElementsByTagName("iframe"),i;for(var n=0;n<r.length;n++)if(r[n].src==location.href){i=r[n];break}let s=i==null?void 0:i.getBoundingClientRect(),a=!this.iframeLeftTopPosition.equals1(Oqe),l=new S(s.x,s.y),c=S.ORIGIN;a&&(c=l.sub(this.iframeLeftTopPosition).mul(this.getRatio())),this.iframeLeftTopPosition=new S(s.x,s.y);let h=Ni().getWidth(),u=new S(Ni().getWidth(),Ni().getHeight());x.getInstance().resize();let d=Ni().getWidth(),m=new S(Ni().getWidth(),Ni().getHeight()).sub(u).mul(.5),g=new Mt(-m.x,m.y,0),y=new S(s.x,s.y);if(this.lastOffset!=null){let b=y.sub(this.lastOffset);(b.x<0&&d>h||b.x>0&&d<h)&&(g=new Mt(m.x,m.y,0))}this.lastOffset=y,a&&(e.mouseX!=null&&(e.mouseX-=c.x),e.mouseY!=null&&(e.mouseY-=c.y)),this.camera.addOffset1(g.x,-g.y)}adaptAll(e,r=1,i=Number.MAX_SAFE_INTEGER,n=!1){let s=e.center(),a=e.width(),l=e.height(),c=this.camera.getScale();if(c==0||a==0||l==0)return;let h=0,u=x.getInstance().openRuler?20:0,d=we.isShowBottomLayerScrollBarShow?40:24;r==1&&(h+=u,x.getInstance().doctype===4?h+=100:h+=20);let p=window.devicePixelRatio,m=(window.innerWidth*p-h)/a,g=(window.innerHeight*p-h-d)/l;m<=0&&(m=1),g<=0&&(g=1);let y=Math.min(m*r,g*r,i);y=Math.min(1e3,Math.max(y,.05)),y=y/c;let b=this.camera.getTarget();St.getInstance().flip&&(b=b.multiply4(Ae.flipY())),n&&(y=1);let P=s.x-u/2*this.getRatio()/(y*c),T=s.y+(u-d)/2*this.getRatio()/(y*c);Math.abs(P)>1e10&&(P=b.x),Math.abs(T)>1e10&&(T=b.y);let I=new Mt(P,T,0);this.camera.setTarget(I),this.camera.setScale(c*y),we.synchronize()}locationMapItem(e){let r=e.center(),i=x.getInstance().openRuler?20:0,n=we.isShowBottomLayerScrollBarShow?40:24,s=this.camera.getScale(),a=r.x-i/2*this.getRatio()/s,l=r.y+(i-n)/2*this.getRatio()/s,c=new Mt(a,l,0);this.camera.setTarget(c)}prepare(e){if(!e)return;e.lastSceneX=e.sceneX,e.lastSceneY=e.sceneY,e.hidePoint();let r=this.mouseRealOffset(e);e.realSceneDeltaX=r.x-e.realSceneX,e.realSceneDeltay=r.y-e.realSceneY,e.realSceneX=r.x,e.realSceneY=r.y,e.adsorb=this.adsorb,e.adsorbGrid=this.adsorb&&ce.adsorptionConfig.getConfig("Grid Point"),Pr.hasAlt=e.altKey;let i=!1;e.removeExtensionCord(),e.hovering=!1;let n=!0,s;if(this.adsorb){let{dragIsPolygon:a,dragItems:l}=Pr.checkDragItemsIsPolygon(),[c,h,u]=this.adsorption(e,a,l);if(h&&h.length&&(n=!h.find(p=>p.adsorptionObj instanceof Ue||p.adsorptionObj instanceof Le||p.adsorptionObj instanceof Ge)),c.x==r.x&&c.y==r.y||this.nextTool!=null&&this.nextTool instanceof dh&&!a){if(ce.adsorptionConfig.getConfig("Grid Point")){let d=new S(e.realSceneX,e.realSceneY);r=di.adsorpGrid(d)}}else if(r=c,this.nextTool!=null&&this.nextTool instanceof ko&&(this.nextTool.drawing||a)){if(i=!0,l)for(let d of l)h=h.filter(p=>{let m=p.adsorptionObj;return p.adsorptionObj instanceof mt||p.adsorptionObj instanceof vt?(m=p.adsorptionObj.getParent(),m.globalIndex!==d.globalIndex):p.adsorptionObj instanceof nr?p.adsorptionObj.globalIndex!==d.globalIndex:p.adsorptionObj});for(let d of h)this.judgeAndAddCrossFlag(d.adsorptionObj,e,new S(d.position.x,d.position.y),d.rotation,a);u&&e.addExtensionCord(u)}s=c}if(this.nextTool!=null&&this.nextTool instanceof kU)if(!this.nextTool.started)r=this.editOutLineAdsorption(e,this.nextTool.profile);else{let a=this.editOutLineAdsorption(e,this.nextTool.profile,!0);a?(r=a,i=!0):r=r||this.mouseRealOffset(e);let l=!1,c=s?new S(s.x,s.y):new S(e.realSceneX,e.realSceneY);for(let h of this.nextTool.currentEditOutLine.primitives)if(h instanceof M?l=Gue(h,c,this.nextTool.profile.strokeWidth):h instanceof q&&(l=Uue(h,c,this.nextTool.profile.strokeWidth)),l){i=!0;break}}e.sceneDeltaX=r.x-e.sceneX,e.sceneDeltaY=r.y-e.sceneY,e.sceneX=r.x,e.sceneY=r.y,n&&this.snapExtendedLine(e),i&&e.showPoint(),this.shiftControl(e),this.updateMousePosition(e),this.moveCrosshair(e),Ma=new S(e.sceneX,e.sceneY),we.realSynchronize(),this.camera.setScreenPosition(new S(e.mouseX-e.canvasWidth/2,e.canvasHeight/2-e.mouseY))}update4Click(e,r,i){if(!e)return;e.lastSceneX=e.sceneX,e.lastSceneY=e.sceneY,e.hidePoint();let n=new S(r,i);e.realSceneDeltaX=n.x-e.realSceneX,e.realSceneDeltay=n.y-e.realSceneY,e.realSceneX=n.x,e.realSceneY=n.y,e.adsorb=this.adsorb,e.adsorbGrid=this.adsorb&&ce.adsorptionConfig.getConfig("Grid Point"),Pr.hasAlt=e.altKey;let s=!1;e.removeExtensionCord(),e.hovering=!1;let a=!0;if(this.adsorb){let{dragIsPolygon:l,dragItems:c}=Pr.checkDragItemsIsPolygon(),[h,u,d]=this.adsorption(e,l,c);if(u&&u.length&&(a=!u.find(m=>m.adsorptionObj instanceof Ue||m.adsorptionObj instanceof Le||m.adsorptionObj instanceof Ge)),h.x==n.x&&h.y==n.y||this.nextTool!=null&&this.nextTool instanceof dh&&!l){if(ce.adsorptionConfig.getConfig("Grid Point")){let p=new S(e.realSceneX,e.realSceneY);n=di.adsorpGrid(p)}}else if(n=h,this.nextTool!=null&&this.nextTool instanceof ko&&(this.nextTool.drawing||l)){if(s=!0,c)for(let p of c)u=u.filter(m=>{let g=m.adsorptionObj;return m.adsorptionObj instanceof mt||m.adsorptionObj instanceof vt?(g=m.adsorptionObj.getParent(),g.globalIndex!==p.globalIndex):m.adsorptionObj instanceof nr?m.adsorptionObj.globalIndex!==p.globalIndex:m.adsorptionObj});for(let p of u)this.judgeAndAddCrossFlag(p.adsorptionObj,e,new S(p.position.x,p.position.y),p.rotation,l);d&&e.addExtensionCord(d)}}e.sceneDeltaX=n.x-e.sceneX,e.sceneDeltaY=n.y-e.sceneY,e.sceneX=n.x,e.sceneY=n.y,a&&this.snapExtendedLine(e),s&&e.showPoint(),this.shiftControl(e),this.updateMousePosition(e),this.moveCrosshair(e),Ma=new S(e.sceneX,e.sceneY),we.realSynchronize(),this.camera.setScreenPosition(new S(e.mouseX-e.canvasWidth/2,e.canvasHeight/2-e.mouseY))}shiftControl(e){if(e.shiftKey&&this.nextTool!=null&&this.nextTool instanceof ko&&this.nextTool.drawing&&this.lastClickX!=null&&this.lastClickY!=null){let r=new S(e.sceneX,e.sceneY);if(this.nextTool instanceof MN&&e.ctrlKey)return;if(this.nextTool instanceof Tc){let i=this.overrideStart(new S(this.lastClickX,this.lastClickY),r,Math.abs(e.sceneX-this.lastClickX));e.sceneX=i.x,e.sceneY=i.y}else{let i=new S(this.lastClickX,this.lastClickY),n=r.sub(i);Math.abs(n.x)>=Math.abs(n.y)?e.sceneY=this.lastClickY:e.sceneX=this.lastClickX}}e.shiftKey&&this.lastClickY!=null&&this.lastClickX!=null&&this.nextTool!=null&&this.nextTool instanceof ko&&this.nextTool.drawing?this.createShiftMoveHelpLine(new S(this.lastClickX,this.lastClickY),new S(e.sceneX,e.sceneY)):this.removeShiftMoveHelpLine()}snapExtendedLine(e){if(!(!e.adsorb||!ce.adsorptionConfig.getConfig("Extended Line"))&&this.nextTool!=null&&(this.nextTool instanceof Vo||this.nextTool instanceof rc)){let r=new S(this.lastClickX,this.lastClickY),i=r.x!==null&&r.y!==null,n=new S(e.realSceneX,e.realSceneY),s;if(this.nextTool instanceof rc){if(!this.nextTool.getFirstLine())return null;i||(r=this.nextTool.getFirstLine().start),s=this.nextTool.getFirstLine().end}else if(this.nextTool instanceof Vo){let l=Un.getInstance().current;if(l){let c=l.node,h=c.start.point,u=h.add(c.direct);r=h,s=u}else return null}let a=s?s.sub(r).angle(S.ORIGIN):null;return di.getExtendedLinePointInfo(n,r,s,a,e,!0)}}judgeAndAddCrossFlag(e,r,i,n,s=!1){if(this.nextTool instanceof ko&&(this.nextTool.drawing||s)&&!(this.nextTool instanceof Vo||this.nextTool instanceof O3||this.nextTool instanceof O3||this.nextTool instanceof LN||this.nextTool instanceof MU)){let a=ce.adsorptionConfig;if(e instanceof Me&&(a.getConfig("Footprint Origin")||a.getConfig("Footprint Center"))){let l=a.getConfig("Footprint Origin")?e.position:e.buildBBox().center();r.addCrossFlag(l,null)}if(e instanceof Ye&&a.getConfig("Region Center")){let l=e instanceof mt||e instanceof vt?e.getParent():e;if(l.type==="Slot Region"||l.type==="Fill Region"){let c=l.buildBBox().center();r.addCrossFlag(c,null)}}if(a.getConfig("Arc/Circle Center Point")&&(e instanceof vt||e instanceof Sr||e instanceof q||e instanceof nr))if(e instanceof nr){let l=e.getHoveredArc(r.sceneX,r.sceneY);l&&r.addCrossFlag(l.center,null)}else r.addCrossFlag(e.center,null);i&&!(e instanceof nF)&&!(e instanceof Ue&&!Qd(e.start,i)&&!Qd(e.end,i))&&r.addCrossFlag(i,n)}}moveCrosshair(e){if(ce.pcbConfig.crossCursor==="None"){this.mark.length!=0&&(this.mark[0].remove(),this.mark[1].remove(),this.mark.length=0);return}let r=ce.themeConfig.canvasTheme.cursorColor;if(this.nextTool!=null&&this.nextTool instanceof ko&&(this.nextTool.drawing||ce.pcbConfig.showCrossCursor)){let i=this.computeLength(new Mt(e.mouseX,0,0),e),n=this.computeLength(new Mt(e.mouseX,-e.canvasHeight,0),e),s=this.computeLength(new Mt(0,e.mouseY,0),e),a=this.computeLength(new Mt(e.canvasWidth,e.mouseY,0),e);if(ce.pcbConfig.crossCursor==="Small"){let c=30/this.camera.getScale();i=new Mt(e.sceneX,e.sceneY+c,0),n=new Mt(e.sceneX,e.sceneY-c,0),s=new Mt(e.sceneX-c,e.sceneY,0),a=new Mt(e.sceneX+c,e.sceneY,0)}if(this.mark.length==0){let l=ce.themeConfig.canvasTheme,c=l.isSolidLine(l.cursorLineStyle),h=new hr(1002,new S(e.sceneX,i.y),new S(e.sceneX,n.y),c,r),u=new hr(1002,new S(s.x,e.sceneY),new S(a.x,e.sceneY),c,r);this.mark.push(h),this.mark.push(u)}else this.mark[0].start=new S(e.sceneX,i.y),this.mark[0].end=new S(e.sceneX,n.y),this.mark[1].start=new S(s.x,e.sceneY),this.mark[1].end=new S(a.x,e.sceneY)}else this.mark.length!=0&&(this.mark[0].remove(),this.mark[1].remove(),this.mark.length=0);this.mark.forEach(i=>{i.color=r})}updateMousePosition(e){let r=x.getInstance().origin,i=new ft,n=(e.sceneX-r.x)*10,s=(e.sceneY-r.y)*10,a=(e.realSceneX-r.x)*10,l=(e.realSceneY-r.y)*10,c=(e.sceneX-this.lastMousePosition.x)*10,h=(e.sceneY-this.lastMousePosition.y)*10,u=this.camera.getScale(),d=x.getInstance().unit;x.getInstance().unit!="mil"&&(n=i.conversion("mil",x.getInstance().unit,n),s=i.conversion("mil",x.getInstance().unit,s),c=i.conversion("mil",x.getInstance().unit,c),h=i.conversion("mil",x.getInstance().unit,h)),n=xe(n,3),s=xe(s,3),c=xe(c,3),h=xe(h,3),A.publish("mouseAcoordinate",{mouseX:n,mouseY:s,realXMil:a,realYMil:l,deltaX:c,deltaY:h,scale:u,unit:d},$()),this.updatePastePanelPosition(a,l)}updatePastePanelPosition(e,r){Yh.type!=="PASTE"||F0.getInstance().isCursorChange||(F0.getInstance().mouseX=e,F0.getInstance().mouseY=r,A.publish("FlushSketcherAttrView",{type:"PASTE"}))}markZoomCenter(e,r){this.zoomCenter=new Mt(e.positionX,e.positionY,0)}moveCamera1(e,r){this.camera.addOffset(new Mt(-e,-r,0)),this.onMouseMove(Pi.getInstance())}moveCamera(e,r){this.camera.addOffset1(e,-r),this.onMouseMove(Pi.getInstance())}setScale(e){let r=this.camera.getScale();if(!isNaN(r)&&r!=0&&this.camera.scaleAtPoint1(e,this.zoomCenter.x,this.zoomCenter.y),dt.startPoint){let n={show:!0,frameInfo:Gf()};dt.create(n,"",!0)}Pi.getInstance().clearCrossFlag(),we.synchronize()}mouseRealOffset(e){let r=new Mt(e.mouseX,-e.mouseY,0),i=new Mt(e.canvasWidth/2,-e.canvasHeight/2,0);return r.sub(i).multiply4(this.camera.get2dCameraMatrix().inverse())}adsorption(e,r=!1,i=[]){if(yi.dropDrag&&!r)return[new Mt(e.realSceneX,e.realSceneY,0)];let n=new S(e.realSceneX,e.realSceneY),{nonPolygonNodes:s,polygonNodes:a}=di.filterNodes(n,this.nextTool,r,i),l=di.drawingLines,c=e.getCrossFlags(),h=ce.adsorptionConfig,u=ce.adsorptionConfig.getSnapDistanceValue();if(s.length==0&&a.length==0&&c.length==0&&l.length==0){n=di.adsorpGrid(n);let d=di.filterNodes(n,this.nextTool,r,i);s=d.nonPolygonNodes,a=d.polygonNodes,l=di.drawingLines,c=e.getCrossFlags(),h=ce.adsorptionConfig}if(s.length==0&&a.length==0&&c.length==0&&l.length==0)return this.adsorptionAddFloatingInputBox(null,null),[new Mt(e.realSceneX,e.realSceneY,0)];{let d=u,p=n.bbox().extendOfSize(d),m,g=[],y=!1,b=[];for(let O of s)if(O.buildBBox().intersect(p))if([d,m,g,y]=this.getAdsorptionInfo(d,m,g,O,n),O instanceof Me){if(this.nextTool instanceof Ww&&this.nextTool.getReuseComponents().find(R=>R.globalIndex==O.globalIndex))continue;this.judgeAndAddCrossFlag(O,e,void 0,void 0,r)}else(O instanceof Ye||O instanceof vt||O instanceof mt)&&(b.push(O),this.judgeAndAddCrossFlag(O,e,void 0,void 0,r));for(let O of a)O.buildBBox().intersect(p)&&this.judgeAndAddCrossFlag(O,e,void 0,void 0,r);let P=di.getDrawingLinePointInfo(n,ce.adsorptionConfig.getAdsorptionOutlines());P.distance&&P.distance<d?[d,m,g]=[P.distance,P.point,P.crossObjs.map(O=>({rotation:O.angle,adsorptionObj:O.adsorptionObj,position:P.point}))]:Qd(m,P.point)&&g.push(...P.crossObjs.map(O=>({rotation:O.angle,adsorptionObj:O.adsorptionObj,position:m})));let T=[];if(h.getConfig("Intersection")){let O=b.reduce((_,R)=>(_[R.layerId]?_[R.layerId].push(R):_[R.layerId]=[R],_),{});Fn(O,(_,R)=>{T.push(...di.getIntersectPoint(...R))})}for(let O of T){let _=u,{point:R,items:v}=O,D=Array.from(v)[0],w,F=D.primitive;F?w=F:w=D;let H=R.distance1(n);Qd(m,R)?g.push({adsorptionObj:w,rotation:null,position:m}):y&&H<_?(_=H,[d,m,g]=[H,R,[{adsorptionObj:w,rotation:null,position:R}]]):!y&&H<d&&([d,m,g]=[H,R,[{adsorptionObj:w,rotation:null,position:R}]])}let I=[];for(let O of c){let{point:_,distance:R,line:v}=di.getNearestCrossPointInfo(n,O);v&&m&&!I.length&&g.length&&g[0].adsorptionObj||(R<d?[d,m,g,I]=[R,_,[],v?[{line:v,cross:O}]:[]]:v&&I&&_.x===m.x&&_.y===m.y&&(Array.isArray(I)?I.push({line:v,cross:O}):I=[I,{line:v,cross:O}]))}let C=!1,E=di.getCrossLineIntersectPointsInfo(c,this.getCanvasDiagonalLen(e));if(I.length){let O=u;for(let _ of E){let{point:R,lines:v}=_,D=R.distance1(n);D<O&&(O=D,m=R,I=Array.from(v),C=!0)}}if(g.length&&!g[0].adsorptionObj){if(!C){let O=di.getCrossAndLineCenterIntersectPointsInfo(c,{prePosition:g[0].position,preRotation:g[0].rotation},this.getCanvasDiagonalLen(e)),_=u;for(let R of O){let v=R.distance1(n);v<_&&(_=v,m=R)}}g=[]}return this.adsorptionAddFloatingInputBox(m,I),m==null?[new Mt(e.realSceneX,e.realSceneY,0)]:[new Mt(m.x,m.y,0),g,I.length?I.map(O=>O.line):null]}}adsorptionAddFloatingInputBox(e,r=[]){if(e==null)dt.id==="adsorption"&&dt.destroy();else if(this.nextTool instanceof iO||this.nextTool instanceof cy||this.nextTool instanceof y2||this.nextTool instanceof rO||this.nextTool instanceof rc||this.nextTool instanceof vU||this.nextTool instanceof _U||this.nextTool instanceof RU||this.nextTool instanceof Gw||this.nextTool instanceof NU||this.nextTool instanceof Tc||this.nextTool instanceof Sh||this.nextTool instanceof DU||this.nextTool instanceof wU||this.nextTool instanceof LU||this.nextTool instanceof HU){if(!r.length){if(dt.id==="adsorption"){let n=dt.data;if(!n||!n.data)return;let s=n.data[0];s.cursorPoint=e;let{cursorPoint:a,startPoint:l}=s;s.frameStartPoint=Fo(l),s.frameCursorPoint=Fo(a),s.info.value=Xe(new S(a.x-l.x,a.y-l.y).length()),dt.create(n,"adsorption")}return}let i=!0;for(let n=1;n<r.length;n++)(r[n].line.start!==r[n-1].line.start||r[n].line.end!==r[n-1].line.end)&&(i=!1);if(i){let n=r[0].cross.position,s=e,a=Gf(),l=Fo(s),c=Fo(n),h=new S(s.x-n.x,s.y-n.y).length(),u=10;if(dt.id!=="adsorption"&&dt.destroy(),u>=dt.priority){dt.priority=u;let d={data:[{startPoint:n,cursorPoint:s,frameStartPoint:c,frameCursorPoint:l,info:{type:"free",value:Xe(h),unit:x.getInstance().unit}}],type:"rect",show:!0,frameInfo:a};dt.create(d,"adsorption")}}}}getCanvasDiagonalLen(e){return this.computeLength(new Mt(e.canvasWidth,e.canvasHeight,0),e).sub(this.computeLength(new Mt(0,0,0),e)).length()}padAdsorptionLayerIds(e){let r=new Array,i;if(e.layerId==12){for(let n of be.getAllEnableInnerLayers())if(!e.unusedInnerLayers.includes(n.layerID)){i=n.layerID;break}}if(e.layerId==12&&e instanceof Ri&&e.type==2)if(di.snapOnlyCurrentLayer()){let n=be.getActiveLayerID();n!=12&&r.push(n)}else r.push(1),e.topType=="ELLIPSE"?(e.bottomType=="ELLIPSE"&&e.topWidth==e.bottomWidth||r.push(2),i&&!(e.innerType=="ELLIPSE"&&e.topWidth==e.innerWidth)&&r.push(i)):e.topType=="OVAL"?(e.bottomType=="OVAL"&&e.topWidth==e.bottomWidth&&e.topHeight==e.bottomHeight||r.push(2),i&&!(e.innerType=="OVAL"&&e.topWidth==e.innerWidth&&e.topHeight==e.innerHeight)&&r.push(i)):e.topType=="RECT"&&(e.bottomType=="RECT"&&e.topWidth==e.bottomWidth&&e.topHeight==e.bottomHeight&&e.topRatio==e.bottomRatio||r.push(2),i&&!(e.innerType=="RECT"&&e.topWidth==e.innerWidth&&e.topHeight==e.innerHeight&&e.topRatio==e.innerRatio)&&r.push(i));else r.push(e.layerId==12?1:e.layerId);return r.filter(n=>n&&be.getLayer(n).layerStatus==1)}getAdsorptionInfo(e,r,i,n,s){let a=ce.adsorptionConfig.getSnapDistanceValue(),l=!1;if(n instanceof Le||n instanceof Ge){let c=e,h=n.center.distance1(s);if(this.nextTool instanceof Vo&&this.nextTool.getNextTool()){let d=!0;for(let p of i){let m=p.adsorptionObj;(m instanceof Le||m instanceof Ge)&&m.center.distance1(s)<h&&(d=!1)}d&&(c=Number.POSITIVE_INFINITY)}let u=new Array;if(n instanceof Le){if(ce.adsorptionConfig.getConfig("Pad Center")&&u.push(n.center),ce.adsorptionConfig.getConfig("Pad Vertices")&&!(this.nextTool instanceof Vo)){let d=this.padAdsorptionLayerIds(n);for(let p of d){let m=n.getMathGraphics(p==12?1:p).primitives;for(let g of m){if(g instanceof q&&ne.eq(g.sweepAngle%360,0)){let y=g.rx,b=g.center;u.push(b.add1(y,0)),u.push(b.add1(-y,0)),u.push(b.add1(0,y)),u.push(b.add1(0,-y));continue}(g instanceof M||g instanceof q)&&(u.push(g.start()),u.push(g.midPoint))}}}}else u.push(n.center);for(let d of u){if(Qd(r,d)){i.push({adsorptionObj:n,rotation:null,position:d});continue}h=d.distance1(s),h<=c&&(c=h,[e,r,i]=[h,d,[{adsorptionObj:n,rotation:null,position:d}]])}if(!r&&n instanceof Le&&ce.adsorptionConfig.getConfig("Pad Edges")&&!(this.nextTool instanceof Vo)){let d=this.padAdsorptionLayerIds(n),p=new Array;for(let m of d){let g=n.getMathGraphics(m==12?1:m).primitives;for(let y of g)y.bbox().extendSize(e).isContains(s)&&p.push(y)}for(let m of p){let g=di.handleLineCenter(m.start(),m.end(),m,s,1,m instanceof M?m.end().sub(m.start()).angle(S.ORIGIN):0),y=g[0].point.distance1(s);y<e&&([e,r,i]=[y,g[0].point,[{adsorptionObj:null,rotation:g[0].rotation,position:g[0].point}]])}}}else if(n instanceof Ue){let c=n.primitive,h=new ir(c,new M(s,s)).getDistance();h<e&&([e,r,i]=[h,di.adsorpTrack(s,n),[{adsorptionObj:n,rotation:null,position:di.adsorpTrack(s,n)}]])}else if(n instanceof Sr||n instanceof nr||n instanceof vt||n instanceof mt){let{point:c,distance:h,crossObjs:u}=di.getNearestOutlineObjPointInfo(s,n,ce.adsorptionConfig.getAdsorptionOutlines());if(Qd(r,c))for(let d of u){let p=d.adsorptionType!=="Line Center";i.push({adsorptionObj:p?n:null,rotation:d.angle,position:r})}else if(h&&h<e&&i.length==0){l=!0;for(let d of u){let p=d.adsorptionType!=="Line Center";!p&&l&&(l=!1),h<a&&([e,r,i]=[h,c,i.concat({adsorptionObj:p?n:null,rotation:d.angle,position:c})])}}}return[e,r,i,l]}clearCrossFlag(){Pi.getInstance().clearCrossFlag()}computeLength(e,r,i=1){let n=new Mt(r.canvasWidth/2,-r.canvasHeight/2,0);return e.sub(n).multiply4(this.camera.get2dCameraMatrix().inverse())}flip(){!x.getInstance().isactive||23==x.getInstance().doctype||(St.getInstance().flip=!St.getInstance().flip,this.camera.setCameraDirect(!St.getInstance().flip),A.publish("updateFrame",""),we.flipBoard=St.getInstance().flip,hn.destroy(),be.getAllLayer().forEach(e=>{e.order=e.order}),Au.DRCLayer.order=Au.DRCLayer.order,St.getInstance().flip?be.setActiveLayerId(2):be.setActiveLayerId(1),this.onMouseMove(Pi.getInstance()))}toggleAutoTrimSilkscreen(){we.autoTrimSilkscreen=!we.autoTrimSilkscreen}createShiftMoveHelpLine(e,r){this.shiftMoveHelpLine?this.shiftMoveHelpLine.end=r:this.shiftMoveHelpLine=new hr(1002,e,r,!0)}removeShiftMoveHelpLine(){this.shiftMoveHelpLine&&(this.shiftMoveHelpLine.remove(),this.shiftMoveHelpLine=null)}clearClickPos(){this.flag&&(this.lastClickX=null,this.lastClickY=null)}overrideStart(e,r,i){let{x:n,y:s}=r.sub(e);return n>=0?e.add1(i,s>=0?i:-i):e.add1(-i,s>=0?i:-i)}refreshNextTool(){yi.dropDrag||this.handler(e=>{e.onMouseMove(Pi.getInstance())})}openTopMenu(e,r){let i=r,n=this.getRatio();e.args={clientX:i.mouseX/n,clientY:i.mouseY/n},A.publish("Pcb/doCommand",e,$())}hideRightMenu(){A.publish("hideRightClickPcbMenu",{},$())}relative4MultiMove(e,r){let i=Ve.getSelects(),n=x.getInstance().unit,s=new S(Bs(e,n,"pixel"),Bs(r,n,"pixel"));ls.getInstance().init(i,"relative offset",(a,l)=>{tp.init(a,l,async(c,h)=>{if(new l1(h,{movePadItSelf:!tp.moveWhole,saveHistory:!1}).execute(c,s),!tp.moveWhole){let d=new Set;c.forEach(m=>{if(m instanceof Le){let g=m.getParent();g instanceof Me&&d.add(g)}});let p=new Array;for(let m of d){h.addCommand4Item(m,"modify");let y=new $f().updateCustomFootprint(m,h.getCommand(),c.filter(b=>b.getParent()==m));p.push(y)}await Promise.all(p)}h.execute(),setTimeout(()=>{A.publish("selecting",{items:c}),A.publish("flushService","")},0),Pr.refresh()})})}editOutLineAdsorption(e,r,i=!1){let n,s=new S(e.realSceneX,e.realSceneY),a=new Set(["Line Center","Arc/Circle Center Point","Region Center"]),l=ce.adsorptionConfig.getAdsorptionOutlines().filter(h=>!a.has(h)),c=h=>({point:di.getNearestOutlineObjPointInfo(s,h,["Line Center"]).point,tempPoint:di.getNearestOutlineObjPointInfo(s,h,l).point});if(r instanceof ct){let h=r.getAllChildrens(),u=fAe(h,s);n=c(u)}else if(r instanceof fn){let h=new io,u=[];for(let p of r.getChildrens().primitives){let m=h.ptToShape(p);u.push(m)}let d=fAe(u,s);n=c(d);for(let p of u)p.remove()}else n=c(r);return i&&!r.model.inShape(s.x,s.y)?s.distance1(n.point)<ce.adsorptionConfig.getSnapDistanceValue()?n.point:null:n.tempPoint&&n.tempPoint.distance1(n.point)<=ce.adsorptionConfig.getSnapDistanceValue()?n.tempPoint:n.point}};var HU=class extends ci{constructor(e,r){super();this.source=r;this.commandFactory=new ve("push component");this._component=null;this.nearNodes=new Array;this.option="OPTIONLEFTUP",this.device=e,this.drawing=!0,this.updateTopMenuRotateStatus(!0),ao.setTool(this),Ua.changeTool(this);let i=Pi.getInstance();this.start(),this.onMouseMove(i)}set component(e){this.filterItems.clear(),e!=null&&(this.filterItems.add(e),e.getItems().forEach(r=>{this.filterItems.add(r)})),this._component=e}get component(){return this._component}applyInputAtCursorValue(e){let{editing:r}=e;if(r){dt.editingWhat="component";return}this.applyValue(e)}applyValue(e){let{value:r,cursorPoint:i,startPoint:n}=e;r=new ft().conversion(x.getInstance().unit,"mil",r/10);let a=new S(i.x-n.x,i.y-n.y).normalize();a=new S(a.x*r,a.y*r);let l=new S(a.x+n.x,a.y+n.y);this.place(l),dt.destroy(),Pi.getInstance().clearCrossFlag()}onKeyDown(e){switch(sr.getAction(5,e)){case"Cancel":this.cancel();break;case"Rotate Left":this.component!=null&&(ao.rotate(this.component.position,ce.pcbConfig.rotate,[this.component]),rt.footprintDefault.rotation+=ce.pcbConfig.rotate);break;case"rotate_right":this.component!=null&&(ao.rotate(this.component.position,-ce.pcbConfig.rotate,[this.component]),rt.footprintDefault.rotation-=ce.pcbConfig.rotate);break;case"Scroll Up":if(this.component!=null){let i=Ae.translate(0,St.getInstance().getSnapY(),0);this.changeInputInfo(e,i),A.publish("moveCrosshair",e),this.onMouseMove(e)}break;case"Scroll Down":if(this.component!=null){let i=Ae.translate(0,-St.getInstance().getSnapY(),0);this.changeInputInfo(e,i),A.publish("moveCrosshair",e),this.onMouseMove(e)}break;case"Scroll Left":if(this.component!=null){let i=St.getInstance().flip?-1:1,n=Ae.translate(-St.getInstance().getSnapX()*i,0,0);this.changeInputInfo(e,n),A.publish("moveCrosshair",e),this.onMouseMove(e)}break;case"Scroll Right":if(this.component!=null){let i=St.getInstance().flip?-1:1,n=Ae.translate(St.getInstance().getSnapX()*i,0,0);this.changeInputInfo(e,n),A.publish("moveCrosshair",e),this.onMouseMove(e)}break;case"flip2OppositeSide":this.flip();break}A.publish("updateFrame","")}changeInputInfo(e,r){let i=new S(e.sceneX,e.sceneY);i=i.multiply4(r),e.sceneX=i.x,e.sceneY=i.y}onMouseLeftUp(e){if(dt.editingWhat)return;let r=new S(e.sceneX,e.sceneY);this.component===null||this.place(r)}place(e){if(ce.pcbConfig.moveComponent=="block"&&!this.component.model.getGroupID()){let a=Ab();j_(this.component,a)}if(!Bt.checkIsInCanEdit(this.component)){let a="beyond drawing range";Bt.showMassageTip(a,a);return}if(this.component.partition=x.getInstance().partitionId,!(ce.pcbConfig.moveComponent=="block"&&!this.component.model.getGroupID())){let a=e.sub(this.component.position),l=Ae.translate(a.x,a.y,0);this.component.transform(l)}for(let a of this.nearNodes)a.clear();this.nearNodes.length=0,A.publish("hasModifyPcbItem",this.component),A.publish("onlySelect",[this.component]);let r=new ve("draw component");if(r.addCommand(Te.dispatch(this.component,"add")),ce.pcbConfig.moveComponent=="push")for(let a of this.commandFactory.commands)r.addCommand(a);je.executeCommand(r),this.uploadPlaceDeviceLog(),this.commandFactory=new ve("push component"),A.publish("flushService",""),A.publish("deviceAdded",{globalIndex:this.component.globalIndex,name:this.component.name,attributes:{globalIndex:this.component.globalIndex,deviceName:this.component.name,pads:this.component.getPads().map(a=>({globalIndex:a.globalIndex,deviceName:this.component.name,num:a.num}))}},$());let i=new e2,n=cr();this.component=i.build(this.device.createComponent(n),e),this.component.visible(),this.checkEnableLayer(),this.asycnConfig(this.component);let s=this.component.getPads();for(let a of s){if(a.net=="")continue;let l=new ly(a);this.nearNodes.push(l)}this.drawing=!0}onMouseMove(e){var i;let r=new S(e.sceneX,e.sceneY);if(A.publish("updateRtree",""),this.drawing)if(this.component!==null){this.component.layerId!=this.getLayer()&&(this.component.layerId=this.getLayer());let n=r.sub(this.component.position),s=Ae.translate(n.x,n.y,0);this.component.transform(s);for(let l of this.nearNodes)l.generateRatline();let a=Ab();if(ce.pcbConfig.moveComponent=="push"&&!this.component.model.getGroupID()){(i=this.commandFactory)==null||i.undo(),this.commandFactory=new ve("push component");let l=new Map;l.set(this.component,0),yw(this.component,this.commandFactory,a,l),l.clear()}ce.pcbConfig.moveComponent=="block"&&!this.component.model.getGroupID()&&j_(this.component,a)}else{let n=new e2,s=cr();this.component=n.build(this.device.createComponent(s),r),this.component.visible(),this.checkEnableLayer(),this.asycnConfig(this.component);let a=this.component.getPads();for(let l of a){if(l.net=="")continue;let c=new ly(l);this.nearNodes.push(c)}}}async checkEnableLayer(){let e=this.component,r=e.footprintUUID,i=e.getBasicLayerTable(),n={[r]:i},s=await UX(n);if(!s)return;let{layerIdReplacementTableMapping:a}=s,l=a[r];e.setLayerIdReplacementTable(l)}asycnConfig(e){ao.rotate(this.component.position,rt.footprintDefault.rotation,[this.component]),e.attributes.forEach(r=>{let i=ce.attributeConfig.getAttribute(r.key);i!=null&&(r.showKey=i.showKey,r.showValue=i.showValue)})}restore(){dt.destroy(),this.component.remove();for(let e of this.nearNodes)e.clear();this.nearNodes.length=0,A.publish("delete",this.component),this.component=null,rt.footprintDefault.rotation=0,this.drawing=!0,A.publish("updateRtree","")}interrupt(){var e;if(this.component!==null){dt.destroy(),this.component.remove();for(let r of this.nearNodes)r.clear();this.nearNodes.length=0,A.publish("delete",this.component),this.component=null,rt.footprintDefault.rotation=0,this.drawing=!1,A.publish("updateRtree",""),ce.pcbConfig.moveComponent=="push"&&((e=this.commandFactory)==null||e.undo())}ao.setTool(null),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}getLayer(){let e=be.getActiveLayerID();return ms(e)?2:1}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:fqe(e.adsorb).result};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"ROTATE":this.rotate(i[1]);break;case"TURNOVER":this.flip();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}translateComp(e){let r=e.sub(this.component.position),i=Ae.translate(r.x,r.y,0);this.component.transform(i)}rotate(e){if(this.component!=null&&(e==="rotate_left"&&(ao.rotate(this.component.position,ce.pcbConfig.rotate,[this.component]),this.translateComp(Ma),rt.footprintDefault.rotation+=ce.pcbConfig.rotate),e==="rotate_right"&&(ao.rotate(this.component.position,-ce.pcbConfig.rotate,[this.component]),this.translateComp(Ma),rt.footprintDefault.rotation-=ce.pcbConfig.rotate),e==="rotate_reference_point")){let r={x:this.component.position.x,y:this.component.position.y,items:new ep([this.component]),executeCommand:!1};ao.rotateAssignReferPoint(r,this,null,null,this.rotateReferPointCallback.bind(this))}}rotateReferPointCallback(e,r,i,n={}){if(i)this.translateComp(Ma);else{let s=new S(e,r);this.translateComp(s),n.angle&&(rt.footprintDefault.rotation+=n.angle)}}flip(){this.component!=null&&(Io(this.component.layerId)?this.component.layerId=2:this.component.layerId=1,be.setActiveLayerId(this.component.layerId))}updateTopMenuRotateStatus(e){we.rotate=e}uploadPlaceDeviceLog(){try{let[e,r]=this.source.split("|");A.windowBridge.publish("addUploadPlaceLibLog",{uuid:e,path:r,lib_type:1},$())}catch(e){console.error(e)}}};var Rpe=class extends fi{constructor(e,r){super();this.items=new Array;this.allClonedItems=[];this.numManager=r0.getNumberManager();this.commandFactory=new mi().createGroup("Create Array");this.itemsMapOffset=new Map;this.itemsMapRotations=new Map;this.preAngle=0;this.selectedItems=[];this.numList=[];this.transformItems=new l1(null,{saveHistory:!1,rotateWhole:!0});this.originalNetsMap=new Map;this.inheritNet="KeepOriginNets";this.shouldToast=!1;this.tool=r;let i=Bt.isChildPcb();e.forEach(s=>{i&&s instanceof vi||(this.items.push(s),s.click())});let n=this.getSelectPosition(e);this.checkHasComponent(),this.option={pos:n,unit:x.getInstance().unit},this.recordOriginalNets()}recordOriginalNets(){this.selectedItems.forEach(e=>{this.originalNetsMap.set(e.globalIndex,e.net||"")})}checkHasComponent(){let e=!1;this.items.forEach(r=>{this.isPartOfComponent(r)&&!this.items.includes(r.getParent())?!e&&(e=!0):r.getParent()?this.selectedItems.push(r.getParent()):!r.isEmpty&&!(r instanceof _n)&&this.selectedItems.push(r)}),e&&A.publish("showPcbSlideMsg",["Objects within component cannot be arrayed"],$()),this.sortOrder();for(let r of this.selectedItems)r instanceof Le&&this.numList.push(r.num);if(this.selectedItems.length==1&&(this.selectedItems[0]instanceof Me||this.selectedItems[0]instanceof fr))this.selectionCenter=this.selectedItems[0].position,this.selectBBox=this.selectedItems[0].buildBBox();else{let r=new _e;for(let i of this.selectedItems){let n=i.buildBBox();r.ext1(n)}this.selectBBox=r.build1(),this.selectionCenter=this.selectBBox.center()}}sortOrder(){let e=new Map,r=this.selectedItems.filter(i=>i instanceof Ye&&i.type==="Copper Region"?(e.has(i.layerId)||e.set(i.layerId,[]),e.get(i.layerId).push(i),!1):!0);for(let i of e.values())i.sort((n,s)=>gn.getOrder(n.globalIndex)-gn.getOrder(s.globalIndex)),r.push(...i);this.selectedItems=r}getSelectPosition(e){if(e.length===0)return null;if(e.length===1){let r,i=e[0];return i instanceof Me||i instanceof fr?r=i.position:r=i.buildBBox().center(),r.sub(x.getInstance().origin)}else{let r=new _e;for(let n of e){let s=n.buildBBox();r.ext1(s)}return r.build1().center().sub(x.getInstance().origin)}}open(e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r={};return r.action="create-array",this.option!=null&&(r.extra=this.option),r}modify(e){this.createArrayPreview(e)}close(e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r=e.action;OT.on=!0;let i=this.allClonedItems.flat(1);if(i.forEach(n=>this.commandFactory.addCommand4Item(n,"add")),r=="confirm"){for(let n of this.selectedItems)i.push(n);A.publish("select",i),this.commandFactory.execute()}else if(r=="cancel"&&this.selectedItems.length){A.publish("select",this.selectedItems);let n=new _e;n.ext1(this.selectBBox),A.publish("adaptBBox",{bbox:n.build(),needAdaptAll:!1}),this.commandFactory.undo()}return this.tool.cancel(),this.allClonedItems.length=0,this.numList.length=0,this.itemsMapOffset=null,this.itemsMapRotations=null,this.originalNetsMap=null,!0}createArrayPreview(e){if(!this.selectedItems.length)return;this.transformItems.reset();let r;if(OT.on=!1,this.inheritNet=e.inheritNet,e["array-type"]==="matrix"){let a=e["distribute-by"],l={x:e["space-x"],y:e["space-y"]},c=+e.rotation,h=+e["per-row-count"],u=+e["per-column-count"],d=h*u,p=d-1;if(d!=this.allClonedItems.length)if(this.allClonedItems.length>p)this.removeItem(p);else{let m=this.allClonedItems.length;this.numList.length&&this.addPadNums(p);let g=this.cloneModel(this.selectedItems,p);this.generateItem(g),this.highLight(m)}this.preAngle!=c&&this.rotateSelectItem(c-this.preAngle),r=this.offestItemPosition(a,c,h,u,l),this.preAngle=c}else{let a={x:e["center-x"]+x.getInstance().origin.x,y:e["center-y"]+x.getInstance().origin.y},l=e.direction==="anti-clockwise"?1:-1,c=e["r-to-match"]=="yes",h=+e["start-degree"],u=+e["spacing-degree"],d=+e["start-rotation-degree"],p=new S(a.x,a.y).distance1(new S(this.selectionCenter.x,this.selectionCenter.y)),g=+e.quantity-1;if(this.allClonedItems.length!==g)if(this.allClonedItems.length>g)this.removeItem(g);else{let y=this.allClonedItems.length;this.numList.length&&this.addPadNums(g);let b=this.cloneModel(this.selectedItems,g);this.generateItem(b),this.highLight(y)}this.preAngle!=d&&this.rotateSelectItem(d-this.preAngle),r=this.offestCirleItemPosition(l,a,p,h,u,d,c),this.preAngle=d}let i=this.getBBox(r),n=new _e;n.ext1(i);let s=this.allClonedItems.flat(1).concat(this.selectedItems);this.shouldToast&&(this.shouldToast=!1,A.publish("ui/toastMsg",{type:"info",msg:"Some networks were not inherited, please check",timer:6,autoHeight:!0},$())),A.publish("adaptBBox",{bbox:n.build(),needAdaptAll:!0}),A.publish("selecting",{items:s}),A.publish("autoFill","")}isPartOfComponent(e){let r=e.getParent();if(r){if(r instanceof Me)return!0;let i=r.getParent();if(i&&i instanceof Me)return!0}return!1}restoreAllOriginalNets(e){this.selectedItems.forEach(r=>{this.originalNetsMap.has(r.globalIndex)&&(r.net=this.originalNetsMap.get(r.globalIndex))}),e.forEach((r,i)=>{i<this.selectedItems.length?r.net=this.selectedItems[i].net:r.net=""})}handleNets(e,r,i){switch(this.inheritNet){case"KeepOriginNets":this.restoreAllOriginalNets(e);break;case"ClearNets":[...this.selectedItems,...e].forEach(c=>{this.clearPrimitiveNet(c)});break;case"InheritNetsfromTouchedObjects":this.restoreAllOriginalNets(e);let n=new ib([...this.selectedItems,...e]);n.updateScene();let s=i.add(r),{netsGroupSet:a,isMoreThan2Nets:l}=n.getNetPcbItems({sceneX:s.x,sceneY:s.y});l&&(this.shouldToast=!0),a.forEach(c=>{let h=c.nets;h.size==1&&c.group.forEach(u=>{(u instanceof Ue||u instanceof Le||u instanceof Ge||u instanceof ct||u instanceof nr||u instanceof Sr||u instanceof Ki)&&(u.net=Array.from(h)[0])})});break}}clearPrimitiveNet(e){if(e instanceof Me){let r=e.getItems();for(let i of r)"net"in i&&i.net&&(i.net="")}else"net"in e&&e.net&&(e.net="")}resetID(e,r=cr()){if(e instanceof ss){for(let i of e.childrens)for(let n of i)n.globalIndex=cr();e.globalIndex=r}else if(e instanceof vi){let i=e.globalIndex;e.globalIndex=r;for(let n of e.getItems())if(n instanceof ss){let s=n.globalIndex,a=s.replace(i,r);for(let l of n.childrens)for(let c of l){let h=c.globalIndex.replace(s,a);h==c.globalIndex?c.globalIndex=cr():c.globalIndex=h}n.globalIndex=a}else{let s=n.globalIndex.replace(i,r);s==n.globalIndex?n.globalIndex=cr():n.globalIndex=s}for(let n of e.attributes){let s=n.globalIndex.replace(i,r);s==n.globalIndex?n.globalIndex=cr():n.globalIndex=s}}else e.globalIndex=r}generatePcbItemByModel(e){return this.resetID(e),e instanceof Je&&(e.num=this.allPadNums.shift()),zS(e),$c(e)}highLight(e){for(let r=e;r<this.allClonedItems.length;r++){let i=this.allClonedItems[r];for(let n of i)n.click()}}addPadNums(e){let r=this.allClonedItems.length;if(r>0){let i=this.allClonedItems[r-1];this.numList.length=0;for(let n of i)n instanceof Le&&this.numList.push(n.num)}this.allPadNums=this.numManager.getArrayPadNum(this.numList,e-r)}rotateSelectItem(e){this.selectedItems.forEach(r=>{this.commandFactory.addCommand4Item(r,"modify")}),this.transformItems.execute(this.selectedItems,new S(0,0),{center:this.selectionCenter,angle:e/180*Math.PI})}getBBox(e){let r=new _e;r.ext1(this.selectBBox);for(let i of e)for(let n of i){let s=n.buildBBox();r.ext1(s)}return r.build1()}removeItem(e){let r=this.allClonedItems.length-e,i=new mi().createGroup("remove item");for(let n=0;n<r;n++)this.allClonedItems.pop().forEach(a=>{a instanceof Le&&this.numManager.deleteNum(a.num),i.addCommand4Item(a,"add")});i.undo()}cloneModel(e,r){let i=r-this.allClonedItems.length,n=[];for(let s=0;s<i;s++){let a=[];for(let l of e){let c=l.model.clone();a.push(c)}n.push(a)}return n}generateItem(e){for(let r of e){let i=[],n=[],s=new Map,a=new Set;for(let l of r){let c=l.globalIndex,h=this.generatePcbItemByModel(l);if(h instanceof Ye)switch(h.type){case"Copper Region":n.push(h);break;case"3D Shell - Side Datum Line":s.set(c,h.globalIndex);break;case"3D Shell - Side Entity":case"3D Shell - Side Slot Region":h.getComponent().lineId&&a.add(h);break}i.push(h)}for(let l of a){let c=l.getComponent(),h=s.get(c.lineId);h&&(c.lineId=h)}gn.toLowest(n,!1),this.allClonedItems.push(i)}}offestItemPosition(e,r,i,n,s){let a=1,l=[],c=(r-this.preAngle)/180*Math.PI,h={center:this.selectionCenter,angle:c};for(let u of this.allClonedItems){let d;if(e==="row"?d=new S(a%i*s.x,-Math.floor(a/i)*s.y):e==="column"&&(d=new S(Math.floor(a/n)*s.x,-(a%n)*s.y)),(d.x===s.x*(i-1)&&d.y===0||d.x===0&&d.y===-s.y*(n-1))&&l.push(u),a++,this.itemsMapOffset.get(u))if(this.isChange(u,r,d))this.resetItemPosition(u);else{this.handleNets(u,d,this.selectionCenter);continue}this.autoDesignator(u),this.itemsMapOffset.set(u,d),this.transformItems.execute(u,d,h),this.handleNets(u,d,this.selectionCenter)}return l}isChange(e,r,i){let n=this.itemsMapOffset.get(e),s=!1;return this.preAngle!=r&&(s=!0),!(n.x===i.x&&n.y===i.y&&!s)}resetItemPosition(e){let r=e,i=this.itemsMapOffset.get(r),n=new S(-i.x,-i.y);this.transformItems.reset(),this.transformItems.execute(e,n),this.transformItems.reset()}offestCirleItemPosition(e,r,i,n,s,a,l){let c=1,h=1/0,u=1/0,d=-1/0,p=-1/0,m=[];for(let g=0;g<this.allClonedItems.length;g++){let y,b=a+(l?e*c*s:0);y=new S(r.x+i*Math.cos((n+e*c*s)/180*Math.PI)-this.selectionCenter.x,r.y+i*Math.sin((n+e*c*s)/180*Math.PI)-this.selectionCenter.y),y.x<h&&(h=y.x,m[0]=this.allClonedItems[g]),y.y<u&&(u=y.y,m[1]=this.allClonedItems[g]),y.x>d&&(d=y.x,m[2]=this.allClonedItems[g]),y.y>p&&(p=y.y,m[3]=this.allClonedItems[g]);let P=this.itemsMapRotations.get(this.allClonedItems[g])?b-this.itemsMapRotations.get(this.allClonedItems[g]).angle:b,T={center:this.selectionCenter,angle:P/180*Math.PI};if(c++,this.itemsMapOffset.get(this.allClonedItems[g]))if(this.isChange(this.allClonedItems[g],b,y))this.resetItemPosition(this.allClonedItems[g]);else{this.handleNets(this.allClonedItems[g],y,this.selectionCenter);continue}this.itemsMapOffset.set(this.allClonedItems[g],y),this.itemsMapRotations.set(this.allClonedItems[g],{center:this.selectionCenter,angle:b}),this.autoDesignator(this.allClonedItems[g]),this.transformItems.execute(this.allClonedItems[g],y,T),this.handleNets(this.allClonedItems[g],y,this.selectionCenter)}return m}autoDesignator(e){if(!ce.pcbConfig.autoDesignator)return;let r=new Set;for(let i of e)i instanceof Me&&r.add(i);Cr.autoDesignator(r)}};var Dpe=class extends fi{constructor(e,r){super();this.items=new Array;this.tool=r,e.forEach(i=>{this.items.push(i),i.click()}),this.option={quantity:e.length,unit:x.getInstance().unit}}open(e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r={};return r.action="distribute",this.option!=null&&(r.extra=this.option),r}modify(e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;e&&e.items&&(this.items=e.items),e.action=="apply"&&ls.getInstance().init(this.items,"relative offset",(i,n)=>{i=this.sortItems(i);let s=[],a=[],l=new l1(n);i.forEach((c,h)=>{let u;if(c instanceof Me||c instanceof fr?u=c.position:c instanceof n0?u=c.start:u=c.buildBBox().center(),e["distribute-type"]==="matrix"){let d=e["distribute-by"],p={x:e["space-x"],y:e["space-y"]},m=e["per-count"],g={x:e["start-x"]+x.getInstance().origin.x,y:e["start-y"]+x.getInstance().origin.y};a.push({center:u,angle:e.rotation/180*Math.PI}),d=="row"?s.push(new S(g.x+h%m*p.x-u.x,g.y-Math.floor(h/m)*p.y-u.y)):s.push(new S(g.x+Math.floor(h/m)*p.x-u.x,g.y-h%m*p.y-u.y))}else{let d={x:e["center-x"]+x.getInstance().origin.x,y:e["center-y"]+x.getInstance().origin.y},p=e.direction==="anti-clockwise"?1:-1,m=e["r-to-match"]=="yes",g=+e["start-degree"],y=+e["spacing-degree"],b=+e["start-rotation-degree"],P=e.radius,T=b+(m?p*h*y:0);(c instanceof fr||c instanceof n0)&&ms(c.layerId)&&(T=180-T),a.push({center:u,angle:T/180*Math.PI}),s.push(new S(d.x+P*Math.cos((g+p*h*y)/180*Math.PI)-u.x,d.y+P*Math.sin((g+p*h*y)/180*Math.PI)-u.y))}}),l.execute(i,s,a,!0),i.forEach(c=>c.click())})}close(e){return this.tool.cancel(),!0}sortItems(e){let r=[],i=[],n=[],s=[];return e.forEach(a=>{a instanceof Me?r.push(a):a instanceof Ri?i.push(a):a instanceof Ar?n.push(a):s.push(a)}),[].concat(Pd(r,"name"),Pd(i,"num"),n,s)}};var wpe=class extends ko{constructor(e,r){super();this.items=new Array;this.selections=new Array;this.mouseLeftDown=!1;this.mouseLeftX=0;this.mouseLeftY=0;Mn.getInstance().allowPull=!1,r.forEach(n=>{this.items.push(n)}),this.dialog=e=="createArrayTool"?new Rpe(r,this):new Dpe(r,this),A.publish("openDialog",this.dialog);let i=yue([],[],!1,!1,!1,!1);we.select(i)}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break}A.publish("updateFrame","")}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;this.mouseLeftDown=!0,this.mouseLeftX=r,this.mouseLeftY=i,e.ctrlKey?this.ctrlSelect(r,i,e):this.pointSelect(r,i,e)}onMouseLeftUp(e){if(this.mouseLeftDown=!1,this.selections.length>0){let r=new _e().ext6(e.realSceneX,e.realSceneY).ext6(this.mouseLeftX,this.mouseLeftY).build1();this.mouseLeftX>e.realSceneX?St.getInstance().flip?this.boxSelect(r,!0,e.ctrlKey):this.boxSelect(r,!1,e.ctrlKey):St.getInstance().flip?this.boxSelect(r,!1,e.ctrlKey):this.boxSelect(r,!0,e.ctrlKey),this.clearSelectBox()}}onMouseMove(e){let r=e.sceneX,i=e.sceneY;this.mouseLeftDown&&(e.realSceneDeltaX!=0||e.realSceneDeltay!=0)&&(this.selections.length==0&&!e.ctrlKey?this.updateSelectBox(r,i):this.updateSelectBox(r,i))}interrupt(e=!0){for(let r of this.items)r.buildBBox()!=null&&r.visible();this.items.length=0,A.publish("selecting",{items:this.items}),Mn.getInstance().allowPull=!0}cancel(){this.interrupt(!0),A.publish("tool","dropdrag")}select(e){this.items.length=0;let r=new Array;for(let n of e)n!=null&&(this.items.push(n),r.push(n));let i=Array.from(r);this.dialog.modify({items:i}),A.publish("selecting",{items:this.items})}ctrlSelect(e,r,i){let n=new Set;for(let a of this.items)n.add(a);for(let a of n)if(a.isSelect(e,r)){$t.filterElement([a],{boxChoose:!1}).forEach(c=>{c.visible(),n.delete(c)}),this.select(n);return}let s=Wr.pointSelect(e,r);for(let a of s)n.add(a);this.select(this.filter2DLine(n))}pointSelect(e,r,i){this.interrupt(!1);let n=Wr.pointSelect(e,r);n.forEach(s=>{s.click()}),this.select(n)}boxSelect(e,r,i){i||this.interrupt(!1);let n=new Array;if(r?n=this.leftToRight(e):n=this.rightToLeft(e),i){let s=new Set;this.items.forEach(a=>{s.add(a)}),n.forEach(a=>{s.add(a)}),n.length=0,this.interrupt(!1),s.forEach(a=>{a.click(),n.push(a)})}this.select(n)}clearSelectBox(){for(let e of this.selections)e.remove();this.selections.length=0}leftToRight(e){let r=$t.filterElement(Wr.getSelectInside(Ol(e)),{boxChoose:!0});return this.filter2DLine(r)}rightToLeft(e){let r=$t.filterElement(Wr.getSelectContect(Ol(e),{boxChoose:!0,isBBox:!0}),{boxChoose:!0});return this.filter2DLine(r)}updateSelectBox(e,r){if(this.selections.length>0)this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(e,this.mouseLeftY),this.selections[1].start=new S(e,this.mouseLeftY),this.selections[1].end=new S(e,r),this.selections[2].start=new S(e,r),this.selections[2].end=new S(this.mouseLeftX,r),this.selections[3].start=new S(this.mouseLeftX,r),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY);else{let i=be.getActiveLayerID(),n=new hr(i,new S(this.mouseLeftX,this.mouseLeftY),new S(e,this.mouseLeftY),!1),s=new hr(i,new S(e,this.mouseLeftY),new S(e,r),!1),a=new hr(i,new S(e,r),new S(this.mouseLeftX,r),!1),l=new hr(i,new S(this.mouseLeftX,r),new S(this.mouseLeftX,this.mouseLeftY),!1);this.selections.push(n),this.selections.push(s),this.selections.push(a),this.selections.push(l)}}filter2DLine(e){let r=new Array,i=new Array;return e.forEach(n=>{n instanceof ct&&i.push(n)}),i.forEach(n=>{n.getChildrens().forEach(a=>{a.forEach(l=>{e.delete(l)})})}),e.forEach(n=>{if(n instanceof mt||n instanceof vt){let s=n.getParent();s instanceof ct&&s.onlyOneChilds()!=null?(s.click(),r.push(s)):(n.click(),r.push(n))}else n.click(),r.push(n)}),r}};var c1=class extends ci{};var Lpe=class extends c1{onKeyDown(t){switch(sr.getAction(2,t)){case"Cancel":{this.cancel();break}}A.publish("updateFrame","")}onMouseLeftDown(t){this.start();let e=t.realSceneX,r=t.realSceneY;Phe(e,r)}onMouseRightUp(t){t.openMenu&&this.cancel()}interrupt(){A.publish("tool","dropdrag"),Pr.model=1,this.end()}cancel(){this.interrupt()}};var K$=class extends c1{constructor(e=!1){super();this._start=null;this.mouseLeftX=0;this.mouseLeftY=0;this.selections=new Array;this.isOnlyInsideTouch=e}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":{this.cancel();break}case"Finish":this.onEnterPlace(e);break;default:}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(!this.isSelectBoxExistence())this.start(),this.mouseLeftX=e.realSceneX,this.mouseLeftY=e.realSceneY,this.createSelectBox(e.realSceneX,e.realSceneY),this._start=r,this.drawing=!0;else{let i=new _e().ext2(this._start).ext2(new S(e.sceneX,e.sceneY)).build1();this.updateSelectBox(e.sceneX,e.sceneY);let n=new Set(Array.from(Ve.getSelects())),s;if(this.isOnlyInsideTouch)s=$t.filterElement(Wr.getSelectInside(Ol(i),{boxChoose:!1,isBBox:!0,model:r4}),{boxChoose:!0});else{let l=new Set(Lc());Wr.getSelectContect(Ol(i),{boxChoose:!1,isBBox:!0}).forEach(h=>{l.delete(h)}),s=$t.filterElement(l,{boxChoose:!0})}let a=new Set;Re.addAllSet(a,n),Re.addAllSet(a,s),s=a,s.forEach(l=>{l.click()}),A.publish("select",s),Pr.model=1,this._start=null,this.clearSelectBox(),this.end()}}onMouseMove(e){this.isSelectBoxExistence()&&this.drawing&&this.updateSelectBox(e.sceneX,e.sceneY)}interrupt(){this.isSelectBoxExistence()&&(this.drawing=!1,this._start=null,this.clearSelectBox()),Pr.model=1,this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":{this.cancel();break}case"toggleAdsorb":{A.publish("toggleAdsorb","");break}case"ADSORBENT_CONFIG":{A.publish("openSystemDialog","ADSORPTION",$());break}default:}A.publish("updateFrame","")}createSelectBox(e,r){let i=ce.themeConfig.canvasTheme,n=i.isSolidLine(i.selectBoxLineStyle),s=i.selectBoxColor,a=new hr(1002,new S(this.mouseLeftX,this.mouseLeftY),new S(e,this.mouseLeftY),n,s),l=new hr(1002,new S(e,this.mouseLeftY),new S(e,r),n,s),c=new hr(1002,new S(e,r),new S(this.mouseLeftX,r),n,s),h=new hr(1002,new S(this.mouseLeftX,r),new S(this.mouseLeftX,this.mouseLeftY),n,s);this.selections.push(a),this.selections.push(l),this.selections.push(c),this.selections.push(h)}updateSelectBox(e,r){if(this.isSelectBoxExistence()){this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(e,this.mouseLeftY),this.selections[1].start=new S(e,this.mouseLeftY),this.selections[1].end=new S(e,r),this.selections[2].start=new S(e,r),this.selections[2].end=new S(this.mouseLeftX,r),this.selections[3].start=new S(this.mouseLeftX,r),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY);return}this.createSelectBox(e,r)}clearSelectBox(){for(let e of this.selections)e.remove();this.selections.length=0}isSelectBoxExistence(){return this.selections.length>0}};var Mpe=class extends DP{constructor(e,r,i){super();this.profile=null;this.type=e,this.optionType=r,this.confirmWindowCb=i}getResult(e){let r=new Array;e.shape.forEach(i=>{let n=this.getModel(i);r.push(n),i.remove()}),r.length>0&&(this.profile=fe.build2(r)),e.shape.length=0}getModel(e){if(e instanceof Yi||e instanceof Zo)return e.primitive;if(e instanceof hr)return new M(e.start,e.end);if(e instanceof ns)return q.build4(e.start,e.end,e.center,e.radius,e.radius,e.sweep)}confirmWindow(e,r){if(this.profile!=null){if(this.optionType=="Line"){let i=new Set(Array.from(Ve.getSelects())),n=new Array,s=new Array;this.profile.primitives.forEach(l=>{let c=l.stroke(e._width,kr.ROUND,le.CCW);n.push(c);let h=Wr.getSelectContect(c,{boxChoose:!1});s=s.concat(Array.from(h))});let a=$t.filterElement(s,{boxChoose:!0});a=Rte(i,a),a.forEach(l=>{l.click()}),A.publish("select",a),Pr.model=1}else if(this.optionType=="Prohibited Region"){let i=new Set(Array.from(Ve.getSelects())),n=new Set(Lc()),s=Wr.getSelectContect(this.profile,{boxChoose:!1});s.forEach(l=>{n.delete(l)});let a=$t.filterElement(n,{boxChoose:!0});s=Rte(i,a),a.forEach(l=>{l.click()}),A.publish("select",s),Pr.model=1}else if(this.optionType=="Fill Region"){let i=new Set(Array.from(Ve.getSelects())),n=Wr.getSelectInside(this.profile,{boxChoose:!1});n=Rte(i,n),n.forEach(s=>{s.click()}),A.publish("select",n),Pr.model=1}this.confirmWindowCb&&this.confirmWindowCb(this.profile)}}modify(e,r,i){}};var jw=class extends c1{constructor(e,r){super();this.event=new Hu;switch(this.event=new Hu,this.resultEvent=new Mpe("Segment",e,r),e==="Line"&&(this.event.needClose=!1),tr.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.event.commands=new ve("draw 2DLine - "+e),this.event.drawScene="Segment",jr.addDrawTool(this)}onKeyDown(e){switch(sr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(jr.getNextType());break;case"Finish":this.onEnterPlace(e);return}this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){this.start(),this.drawPolygon.onMouseLeftUp(e)}onMouseMove(e){this.drawing&&this.drawPolygon.onMouseMove(e)}interrupt(){this.drawPolygon.interrupt(),jr.clearDrawTool(),Pr.model=1,this.end()}cancel(){this.drawPolygon.cancel()}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),tr.getInstance().type=e,we.synchronize()}wireWidth(e){this.drawPolygon.wireWidth(e)}completed(){this.drawPolygon.completed(!1)}backspace(){this.drawPolygon.backspace()}wireMode(e){}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.event.shape.length>0?this.completed():this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.event.shape.length>0?this.completed():this.cancel();break}}}rightClickMenuData(e){let r=this.event.start!=null,i={state:"show",left:e.mouseX,top:e.mouseY,filter:o1(tr.getInstance().type,e.adsorb,r,!0).result};Qt.getInstance().menuData(i,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]);break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var Npe=class extends jw{constructor(){super("Fill Region")}};var kpe=class extends jw{constructor(){super("Prohibited Region")}};var Bpe=class extends jw{constructor(){super("Line")}};function Fpe(o,t,e){let r=new Array,i=new Array;for(let n of o){let s=Hr.getItem(n);if(s!=null&&s.net!=t){let a=QXe(s);for(let l of a)l instanceof Ue&&r.push(l),l instanceof Ge&&l.globalIndex!==s.globalIndex&&i.push(l);e.addCommand(Te.dispatch(s,"modify")),A.publish("hasModifyPcbItem",s),s.net=t,A.publish("hasModifyPcbItem",s)}}A.windowBridge.rpcCall("tipsModalBackToPcb","syncViaConnectNet",$()).then(n=>{if(n.message.action=="yes"){for(let s of r)e.addCommand(Te.dispatch(s,"modify")),A.publish("hasModifyPcbItem",s),s.net=t,A.publish("hasModifyPcbItem",s);for(let s of i)e.addCommand(Te.dispatch(s,"modify")),A.publish("hasModifyPcbItem",s),s.net=t,A.publish("hasModifyPcbItem",s);A.publish("flushService","")}})}var Z$=class extends ci{constructor(t,e,r,i,n){super(),this.option="OPTIONLEFTUP",this.oldToolDrawing=r,this.drawing=!0,this.tool=t,this.lastTool=i,this.lastCmd=e,this.msg="Please select a network",this.pcbBridgingCopperIndex=n,this.start()}onKeyDown(t){switch(sr.getAction(4,t)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(t);break}A.publish("updateFrame","")}onMouseMove(t){jt.update(t,this.msg)}onMouseLeftUp(t){if(this.drawing){let e=Ve.getSelects(),r=Wr.selectNet(t.sceneX,t.sceneY);this.selectItems=e;let i=!1;e!==null&&(this.netsGroupSet=this.getNearNetPcbItems(r,t.sceneX,t.sceneY),i=this.handleNets(t,e)),i&&(this.tool.setNextTool(this.lastTool),yi.resetLastScene(),this.tool.drawing=this.oldToolDrawing,jt.cancel(),A.publish("resetToolLastCmd",this.lastCmd),A.publish("updateCrossDirect",Pi.getInstance()),A.publish("flushSelectingInfo",""),this.end())}}getNearNetPcbItems(t,e,r){let i=new Set,n=new Set,s=new Set;return t.forEach(a=>{if(a instanceof Ye&&a.type=="Fill Region"){let c=a.getComponent();if(c instanceof ln&&c.isBridgingCopper)return}let l=a.net;if(a instanceof Ye&&a.type=="Copper Region"){let c=!1;if(a.iteratorCopper(h=>{c||h.inCopper(e,r)&&h.isVisible&&(c=!0)}),!c)return}l&&(s.add(a),n.add(l))}),i.add({group:s,nets:n}),i}handleNets(t,e){let r=Vpe.getAttributePlaneFilterControl(),i=r.update(e).getStatus(e),n=[];for(let a=0;a<e.length;a++)i[r.getType(e[a])]&&n.push(e[a]);let s=!1;return this.nets=new Set,this.netsGroupSet.forEach(a=>{this.nets=a.nets}),this.nets.size?this.nets.size===1?(this.nets.forEach(a=>{this.updateNetwork(a,n)}),s=!0):(jt.cancel(),this.showNetsMenu(t)):s=!1,s}showNetsMenu(t){let e={};e.state="show",e.left=t.mouseX,e.top=t.mouseY,e.filter=this.getNetsMenuData().result,Qt.getInstance().menuData(e,this),this.drawing=!1}getNetsMenuData(){let t=new Jt,e="INHERIT_NET:";return this.nets.forEach(r=>{if(r){let i={name:r,cmd:`${e+r}`,tips:"",option:{disabledI18n:!0}};t.addObj(i,!1,!1)}}),t}updateNetwork(t,e){if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let r=new ve("update select item network"),i=new Array,n=new Set;e.forEach(s=>{s instanceof Ge&&this.checkConnect(s)?i.push(s.globalIndex):n.add(s)});for(let s of n)if(s instanceof mt||s instanceof vt){let a=s.getParent();a!=null&&a instanceof ct&&(A.publish("hasModifyPcbItem",a),r.addCommand(Te.dispatch(a,"modify")),a.net=t,A.publish("hasModifyPcbItem",a))}else if(s instanceof ds){let a=!1;s instanceof Ye&&s.getComponent()instanceof ln&&(a=s.getComponent().isBridgingCopper);let l=new mi;l.createGroup("modify Primitive Data By Select Net");let c=l.getCommand();if(a){let u=s,d=u.getComponent(),p=JSON.stringify(d);new Nl(p,u.type).rebuildComponent(u)}let h=Te.dispatch(s,"modify");if(c.addCommand(h),r.addCommand(Te.dispatch(s,"modify")),a){DD(s,t,this.pcbBridgingCopperIndex);continue}s.net=t,A.publish("hasModifyPcbItem",s),s instanceof Ye&&s.type=="Copper Region"&&A.publish("rebuildSingleCopper",{ids:[s.globalIndex],isLast:!0}),s instanceof Le&&y_(s,c)}i.length>0&&Fpe(i,t,r),je.executeCommand(r),A.publish("flushService",""),A.publish("flushSelectingInfo","")}checkConnect(t){let e=t.searchNowNode();for(let r of e)if(r instanceof Ue)return!0;return!1}interrupt(){this.drawing=!1,this.tool.setNextTool(this.lastTool),yi.resetLastScene(),this.tool.drawing=this.oldToolDrawing,jt.cancel(),A.publish("resetToolLastCmd",this.lastCmd),A.publish("updateCrossDirect",Pi.getInstance()),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:vo(t.adsorb)};Qt.getInstance().menuData(e,this),this.drawing=!1}parse(t){this.drawing=!0;let r=t.cmdKey.split(":");switch(r[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"INHERIT_NET":this.updateNetwork(r[1],this.selectItems),this.interrupt();break}A.publish("updateFrame","")}};var WU=class extends ci{constructor(e,r,i,n,s,a,l){super();this.lastRotateTool=null;this.start(),this.option="OPTIONLEFTUP",Ua.changeTool(this),this.oldToolDrawing=r,this.drawing=!0,this.tool=e,this.lastTool=i,this.referPointProgram=n,this.msg=s,this.clickCn=0,this.needInput=l,a&&this.assignReferPoint(a),this.lastRotateTool=ao.getTool(),ao.setTool(this)}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);return}A.publish("updateFrame","")}onMouseMove(e){switch(this.clickCn){case 0:this.drawing&&jt.update(e,this.msg);break;case 1:if(this.drawing){let r=this.referPointProgram.movePoint(e.sceneX,e.sceneY),i=Wte(r/Math.PI*180),n=Gf(),s=Fo(new S(e.sceneX,e.sceneY)),a={frameInfo:n,show:!0,type:"circle",data:[{frameCursorPoint:s,info:{type:"circle",tagName:"angle",value:i}}]};dt.create(a)}break}}onMouseLeftUp(e){if(this.clickCn!==void 0)switch(this.clickCn++,this.clickCn){case 1:this.drawing&&(this.referPointProgram.setReferPoint(e.sceneX,e.sceneY),jt.cancel());break;case 2:dt.editingWhat?(dt.editingWhat="",this.clickCn--):(this.completed({x:e.sceneX,y:e.sceneY}),dt.destroy());break}}interrupt(){this.referPointProgram.interrupt(),this.drawing=!1,this.tool.setNextTool(this.lastTool),yi.resetLastScene(),this.tool.drawing=this.oldToolDrawing,jt.cancel(),dt.destroy(),ao.setTool(this.lastRotateTool),this.end()}cancel(){this.interrupt()}completed(e){this.clickCn=void 0,this.tool.setNextTool(this.lastTool),yi.resetLastScene(),this.tool.drawing=this.oldToolDrawing,this.referPointProgram.setEndPoint(e.x,e.y),dt.destroy(),ao.setTool(this.lastRotateTool)}applyInputAtCursorValue(e){let{value:r,browserCursorPoint:i,editing:n}=e;if(n){dt.editingWhat="circle";return}A.publish("rotateAssignAngle",{angle:r,x:i.x,y:i.y})}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}assignReferPoint(e){this.clickCn=1,this.referPointProgram.setReferPoint(e.x,e.y)}};var Gpe=class extends c1{constructor(e,r){super();this.event=new Hu;switch(this.event=new Hu,this.resultEvent=new Iw(e,r),e==="Line"&&(this.event.needClose=!1),tr.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC45":case"WIRING_CORNER_ARC90":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.event.commands=new ve("draw 2DLine - "+e),jr.addDrawTool(this),this.drawing=!0}onKeyDown(e){switch(sr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(jr.getNextType());break;case"Finish":this.onEnterPlace(e);return}this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){this.start(),this.drawPolygon.onMouseLeftUp(e)}onMouseMove(e){this.drawing&&this.drawPolygon.onMouseMove(e)}interrupt(){this.drawPolygon.interrupt(),jr.clearDrawTool(),Pr.model=1,this.end()}cancel(){this.drawPolygon.cancel()}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC45":case"WIRING_CORNER_ARC90":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),tr.getInstance().type=e,we.synchronize()}wireWidth(e){this.drawPolygon.wireWidth(e)}completed(){this.drawPolygon.completed(!1)}backspace(){this.drawPolygon.backspace()}wireMode(e){}rightClickMenuData(e){let r=this.event.start!=null,i={state:"show",left:e.mouseX,top:e.mouseY,filter:o1(tr.getInstance().type,e.adsorb,r,!0).result};Qt.getInstance().menuData(i,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]);break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var Upe=class{static fillGrid(t,e,r=ee.Gray){let i=new Array,n=Qe.rotate(Math.PI/4),s=Qe.rotate(-Math.PI/4),a=t.multiply3(n),l=t.multiply3(s),c=a.bbox(),h=l.bbox(),u=new Array,d=new wE(new Gi(1));d.addPolyline(a);for(let g=c.minY;g<=c.maxY;g+=6){let y=new M(new S(c.minX,g),new S(c.maxX,g));Re.addAll(u,d.scan(g,y))}let p=new Array,m=new wE(new Gi(1));m.addPolyline(l);for(let g=h.minY;g<=h.maxY;g+=6){let y=new M(new S(h.minX,g),new S(h.maxX,g));Re.addAll(p,m.scan(g,y))}for(let g of u){let y=g.multiply3(s);i.push(new hr(e,y.start(),y.end(),!0,r))}for(let g of p){let y=g.multiply3(n);i.push(new hr(e,y.start(),y.end(),!0,r))}return i}static getGridPoint(t,e,r){let i=Qe.rotate(Math.PI/2),n=Qe.rotate(-Math.PI/2),s=t.multiply3(i),a=t,l=s.bbox(),c=a.bbox(),h=new Array,u=new wE(new Gi(1));u.addPolyline(s);for(let y=l.minY;y<=l.maxY;y+=r){let b=new M(new S(l.minX,y),new S(l.maxX,y));Re.addAll(h,u.scan(y,b))}let d=new Array,p=new wE(new Gi(1));p.addPolyline(a);for(let y=c.minY;y<=c.maxY;y+=e){let b=new M(new S(c.minX,y),new S(c.maxX,y));Re.addAll(d,p.scan(y,b))}let m=new Array;for(let y of h){let b=y.multiply3(n);m.push(b)}let g=new Array;for(let y of m)for(let b of d){let P=Tt(y,b);for(let T=0;T<P;T+=2){let I=new S(Ee[T],Ee[T+1]);g.push(I)}}return g}};var zU=class extends ci{constructor(e=!0){super();this.commands=new ve("draw suture via");this.net="";this.hasEffectiveDrawn=!1;this.drawMode=null;let r=te.getInstance().getDefaultRadiusPhysics();this.radius=r.defalutRadius,this.innerRadius=r.defalutInner,this.lineSpacing=rt.defaultSutureVia.lineSpacing,this.columnSpacing=rt.defaultSutureVia.columnSpacing,e&&A.publish("openMainDialog",{cmd:19,data:{tool:this}}),this.clickCn=0,this.drawing=!0}getDialogData(){let e=x.getInstance().unit,r=new ft;return{action:"attribute-for-place-sut-via",attrNet:this.net||"",netList:ze.getNet(),attrViaGeneralOuterdiameter:r.conversion("mil",e,this.radius*20),attrViaGeneralInnerdiameter:r.conversion("mil",e,this.innerRadius*20),attrRowSpacing:r.conversion("mil",e,this.lineSpacing*10),attrColSpacing:r.conversion("mil",e,this.columnSpacing*10),unit:e}}modifyByDialog(e){let r=e.action;if(r=="confirm"){this.drawMode=0;let i=new ft,n=e["attr-net"],s=parseFloat(e["attr-col-spacing"])/10,a=parseFloat(e["attr-row-spacing"])/10,l=parseFloat(e["attr-via-general-innerdiameter"])/20,c=parseFloat(e["attr-via-general-outerdiameter"])/20;this.net=n||"",this.columnSpacing=i.conversion(x.getInstance().unit,"mil",s),this.lineSpacing=i.conversion(x.getInstance().unit,"mil",a),this.radius=i.conversion(x.getInstance().unit,"mil",c),this.innerRadius=i.conversion(x.getInstance().unit,"mil",l),rt.setDefaultSutureVia(this.lineSpacing,this.columnSpacing)}else r=="cancel"&&this.cancel()}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break;default:this.drawPolygonSutureVia!=null&&this.drawPolygonSutureVia.onKeyDown(e)}A.publish("updateFrame","")}async onMouseLeftUp(e){if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},$());return}if(this.drawMode===1){this.netSelect(e.sceneX,e.sceneY);return}let r=e.sceneX,i=e.sceneY,n=new S(r,i);this.clickCn++,this.clickCn===1?(this.start(),jt.cancel(),this.drawPolygonSutureVia=new Gpe("Fill Region",await this.confirmWindow.bind(this)),this.drawPolygonSutureVia.onMouseLeftUp(e)):this.clickCn>=2&&this.drawPolygonSutureVia.onMouseLeftUp(e)}onMouseMove(e){if(this.drawMode===0){if(!this.drawing)return;let r=e.sceneX,i=e.sceneY;this.clickCn>=1?this.drawPolygonSutureVia.onMouseMove(e):this.clickCn===0&&jt.update(e,"Please select an area")}else this.drawMode==1?jt.update(e,"Please select a network"):jt.cancel()}interrupt(){this.drawMode=0,this.drawPolygonSutureVia&&(this.drawPolygonSutureVia.interrupt(),this.drawing=!1,this.clickCn=void 0,this.drawPolygonSutureVia=null),jt.cancel(),this.end()}cancel(){this.drawMode===null||this.drawMode==0?(this.drawPolygonSutureVia&&(this.drawPolygonSutureVia.cancel(),this.drawing=!1,this.clickCn=void 0,this.drawPolygonSutureVia=null),this.interrupt(),this.hasEffectiveDrawn&&A.publish("rebuildCopperRegionDialog",{msg:""}),A.publish("tool","dropdrag")):(this.drawMode=0,this.confirmWindow(null))}completed(){this.drawPolygonSutureVia.completed(),this.end(),this.clickCn=void 0}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.clickCn>=1?this.completed():this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.clickCn>=1?this.completed():this.cancel();break}}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:this.getMenu(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}getMenu(e){let r=new Jt;this.drawPolygonSutureVia&&r.add("COMPLETE"),r.add("CANCEL"),r.add("REGRESSION",!0);let i=tr.getInstance().type;return r.addExtend("WIRING_CORNER",KS(i)),r.add("toggleAdsorb",!1,e),r.result}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"REGRESSION":this.drawPolygonSutureVia!=null&&this.drawPolygonSutureVia.backspace();break;case"WIRING_CORNER":this.drawPolygonSutureVia!=null&&this.drawPolygonSutureVia.wireCorner(i[1]);break;case"INHERIT_NET":this.update(i[1]);break}A.publish("updateFrame","")}async confirmWindow(e){if(e!=null){let{vias:r}=await this.placeSutureVias([[e]]);for(let i of r){A.publish("hasModifyPcbItem",i);let n=Te.dispatch(i,"add");this.commands.addCommand(n)}A.publish("onlySelect",r),je.executeCommand(this.commands),this.commands=new ve("draw suture via"),A.publish("flushService","")}this.drawing=!1,this.clickCn=void 0,this.drawPolygonSutureVia=null}modify(e){}placeVia(e){let r=this.net;(ze.getItem(r)==null||ze.getItem(r).size==0)&&(r="");let i=te.getInstance().getSolderExpansionByNet(r),n=new Gg(cr(),2,"",1,2,[],this.net,this.radius,e,this.innerRadius,1,i.viaTopExpansion,i.viaBottomExpansion,!1);return Tn.getInstance().addModel(n),n}async placeSutureVias(e,r=!1){let i=new Array;for(let u of e){if(u.length==0)continue;let d=new Set(Upe.getGridPoint(u[0],this.lineSpacing,this.columnSpacing));if(d.size){if(u.length>1)for(let p of d)for(let m=1;m<u.length;m++){let g=u[m];if(Jr.inPolyline(p,g)){d.delete(p);break}}d.size&&i.push(...d)}}if(i.length===0)return{vias:[]};let n=i.map(u=>this.placeVia(u)),s=this.getLayerId(),{message:a}=await A.messageBus.rpcCall("sutureViaDrc",{vias:n,checkSameNet:!0,profile:e.flatMap(u=>ef(u)),layerId:s,mode:2,maxProgress:.9}),{filterIds:l}=a,c=n.filter(u=>{let d=Eo.existClearanceError(u.globalIndex,s);return!d.existClearanceError&&!l.includes(u.globalIndex)?(d.exsitError&&(this.hasEffectiveDrawn=!0),!0):(u.remove(),Tn.getInstance().delete(u,u.globalIndex),Eo.deleteClearanceError(u.globalIndex),Eo.deleteBlindError(u.globalIndex),Eo.deleteRadiusError(u.globalIndex),!1)}).map(u=>Hr.addViaByModel(u));A.publish("progressUpdate",[1,"Design rule check"],$());let h=a.hasSameNetCoppers;return r||(this.hasEffectiveDrawn&&A.publish("rebuildCopperRegionDialog",{msg:""}),c.length==0&&!h&&A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before adding suture holes"},$())),{vias:c,hasSameNetCoppers:h}}getLayerId(){let e=be.getActiveLayer();return e.isCopperLayer()||e.isPlaneLayer()?e.layerID:1}toggleMode(e){this.drawMode=e,this.drawing=!0}netSelect(e,r){let i=Wr.selectNet(e,r),n=new Set;for(let s of i)s.isSelect(e,r)&&s.net&&n.add(s.net);n.size>1?this.showNetsMenu(Array.from(n)):this.update(Array.from(n)[0])}update(e){this.net=e,this.drawMode=0,A.publish("openMainDialog",{cmd:19,data:{tool:this}})}getNetsMenuData(e){let r=new Jt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}showNetsMenu(e){let r={},i=Pi.getInstance();r.state="show",r.left=i.mouseX,r.top=i.mouseY,r.filter=this.getNetsMenuData(e).result,Qt.getInstance().menuData(r,this),this.drawing=!1}};var Hpe=class extends c1{constructor(e,r){super();this.event=new Hu;switch(this.event=new Hu,this.resultEvent=new Cw(e,r),e==="Line"&&(this.event.needClose=!1),tr.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.event.commands=new ve("draw 2DLine - "+e),jr.addDrawTool(this)}onKeyDown(e){switch(sr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(jr.getNextType());break;case"Finish":this.onEnterPlace(e);break}this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){this.start(),this.drawPolygon.onMouseLeftUp(e)}onMouseMove(e){this.drawing&&this.drawPolygon.onMouseMove(e)}interrupt(){this.drawPolygon.interrupt(),jr.clearDrawTool(),Pr.model=1,this.end()}cancel(){this.drawPolygon.cancel()}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),tr.getInstance().type=e,we.synchronize()}wireWidth(e){this.drawPolygon.wireWidth(e)}completed(){this.drawPolygon.completed(!1)}backspace(){this.drawPolygon.backspace()}wireMode(e){}rightClickMenuData(e){let r=this.event.start!=null,i={state:"show",left:e.mouseX,top:e.mouseY,filter:o1(tr.getInstance().type,e.adsorb,r,!0).result};Qt.getInstance().menuData(i,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]);break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}};var Wpe=class extends Hpe{constructor(t){super("Line",t)}};var zpe=class extends ci{constructor(){super();this.commands=new ve("draw suture via");this.net="";this.hasEffectiveDrawn=!1;this.drawMode=null;let e=te.getInstance().getDefaultRadiusPhysics();this.radius=e.defalutRadius,this.innerRadius=e.defalutInner,this.spacing=rt.LineTypeSutureVia,A.publish("openMainDialog",{cmd:19,data:{tool:this}}),this.drawing=!0}getDialogData(){let e=x.getInstance().unit,r=new ft;return{action:"attribute-for-place-sut-via",attrNet:this.net||"",netList:ze.getNet(),attrViaGeneralOuterdiameter:r.conversion("mil",e,this.radius*20),attrViaGeneralInnerdiameter:r.conversion("mil",e,this.innerRadius*20),attrSpacing:r.conversion("mil",e,this.spacing*10),unit:e,type:"lineSutureVia"}}modifyByDialog(e){let r=e.action;if(r=="confirm"){this.drawMode=0;let i=new ft,n=e["attr-net"],s=parseFloat(e["attr-spacing"])/10,a=parseFloat(e["attr-via-general-innerdiameter"])/20,l=parseFloat(e["attr-via-general-outerdiameter"])/20;this.net=n||"",this.spacing=i.conversion(x.getInstance().unit,"mil",s),this.radius=i.conversion(x.getInstance().unit,"mil",l),this.innerRadius=i.conversion(x.getInstance().unit,"mil",a),rt.setDefaultLineSutureVia(this.spacing)}else r=="cancel"&&this.cancel()}onKeyDown(e){let r=sr.getAction(4,e);if(r){switch(r){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break;default:this.lineTool!=null&&this.lineTool.onKeyDown(e)}A.publish("updateFrame","")}}async onMouseLeftUp(e){if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},$());return}if(this.drawMode===1){this.netSelect(e.sceneX,e.sceneY);return}let r=e.sceneX,i=e.sceneY,n=new S(r,i);!this.lineTool&&this.drawing?(this.start(),jt.cancel(),this.lineTool=new Wpe(await this.confirmWindow.bind(this)),this.lineTool.drawing=!0,this.lineTool.onMouseLeftUp(e)):this.lineTool.onMouseLeftUp(e)}onMouseMove(e){if(this.drawMode===0){let r=e.sceneX,i=e.sceneY;this.drawing&&(this.lineTool?this.lineTool.onMouseMove(e):jt.update(e,"Please draw a line"))}else this.drawMode==1?jt.update(e,"Please select a network"):jt.cancel()}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.lineTool?this.completed():this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.lineTool?this.completed():this.cancel();break}}}interrupt(){this.drawMode=0,this.lineTool&&(this.lineTool.interrupt(),this.lineTool=null,this.drawing=!1),jt.cancel(),this.end()}cancel(){this.drawMode===null||this.drawMode==0?(this.lineTool&&(this.lineTool.cancel(),this.lineTool=null,this.drawing=!1),this.interrupt(),this.hasEffectiveDrawn&&A.publish("rebuildCopperRegionDialog",{msg:""}),A.publish("tool","dropdrag")):(this.drawMode=0,this.confirmWindow(null))}completed(){this.lineTool.completed(),this.lineTool=null,this.end()}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:this.getMenu(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}getMenu(e){let r=new Jt;this.lineTool&&r.add("COMPLETE"),r.add("CANCEL"),r.add("REGRESSION",!0);let i=tr.getInstance().type;return r.addExtend("WIRING_CORNER",KS(i)),r.add("toggleAdsorb",!1,e),r.result}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"REGRESSION":this.lineTool!=null&&this.lineTool.backspace();break;case"WIRING_CORNER":this.lineTool!=null&&this.lineTool.wireCorner(i[1]);break;case"INHERIT_NET":this.update(i[1]);break}A.publish("updateFrame","")}async confirmWindow(e){if(e!=null){let r=await this.placeSutureVias(e);for(let i of r){A.publish("hasModifyPcbItem",i);let n=Te.dispatch(i,"add");this.commands.addCommand(n)}A.publish("onlySelect",r),je.executeCommand(this.commands),this.commands=new ve("draw suture via"),A.publish("flushService","")}this.drawing=!1,this.lineTool=null,this.end()}modify(e){}placeVia(e){let r=this.net;(ze.getItem(r)==null||ze.getItem(r).size==0)&&(r="");let i=te.getInstance().getSolderExpansionByNet(r),n=new Gg(cr(),2,"",1,2,[],this.net,this.radius,e,this.innerRadius,1,i.viaTopExpansion,i.viaBottomExpansion,!1);return Tn.getInstance().addModel(n),n}async placeSutureVias(e){let r=new Array,i=e.primitives,n=this.points(i),s=new Array;if(n.forEach(h=>{let u=this.placeVia(h);s.push(u)}),!s.length)return r;let a=this.getLayerId(),{message:l}=await A.messageBus.rpcCall("sutureViaDrc",{vias:s,checkSameNet:!0,profile:Lh(e),layerId:a,mode:0,maxProgress:.9}),{filterIds:c}=l;return s.forEach(h=>{let u=Eo.existClearanceError(h.globalIndex,a);if(!u.existClearanceError&&!c.includes(h.globalIndex)){u.exsitError&&(this.hasEffectiveDrawn=!0);let d=Hr.addViaByModel(h);r.push(d)}else h.remove(),Tn.getInstance().delete(h,h.globalIndex),Eo.deleteClearanceError(h.globalIndex),Eo.deleteBlindError(h.globalIndex),Eo.deleteRadiusError(h.globalIndex)}),A.publish("progressUpdate",[1,"Design rule check"],$()),this.hasEffectiveDrawn&&A.publish("rebuildCopperRegionDialog",{msg:""}),r.length==0&&!l.hasSameNetCoppers&&A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before adding suture holes"},$()),r}points(e){let r=new Array,i=0;return e.forEach((n,s)=>{if(n instanceof q){let a,l=1,c=n.length();for(;;){let h=this.spacing*l-i;if(c-h>=0){let u=this.arcPoint(n,h);r.push(u),a=u}else{i=c-(this.spacing*(l-1)-i),a=null;break}l++}}else if(n instanceof M){let a=n.start(),l=n.end(),c=l.sub(a).normalize(),h;for(i?(h=a.add(c.mul(this.spacing-i)),i=0):h=a,h.distance1(a)<=l.distance1(a)&&r.push(h);;){let u=l.distance1(h);if(u>=this.spacing){let d=h.add(c.mul(this.spacing));r.push(d),h=d}else{i=u,h=null;break}}}}),r}arcPoint(e,r){let i=e.rx*Vr,n=r,s=Ht.toDegrees(n/i*Vr),a=e.sweep()==le.CCW?e.startAngle+s:e.startAngle-s;return q.build2(e.center,e.startAngle,a,e.rx,e.ry,e.sweep()).end()}getLayerId(){let e=be.getActiveLayer();return e.isCopperLayer()?e.layerID:1}toggleMode(e){this.drawMode=e,this.drawing=!0}netSelect(e,r){let i=Wr.selectNet(e,r),n=new Set;for(let s of i)s.isSelect(e,r)&&s.net&&n.add(s.net);n.size>1?this.showNetsMenu(Array.from(n)):this.update(Array.from(n)[0])}update(e){this.net=e,this.drawMode=0,A.publish("openMainDialog",{cmd:19,data:{tool:this}})}getNetsMenuData(e){let r=new Jt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}showNetsMenu(e){let r={},i=Pi.getInstance();r.state="show",r.left=i.mouseX,r.top=i.mouseY,r.filter=this.getNetsMenuData(e).result,Qt.getInstance().menuData(r,this),this.drawing=!1}};function _qe(o){let t=new Jt;return t.add("CANCEL",!0),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t}var Ype=class extends ci{constructor(e,r,i){super();this.dragMode=!1;this.logger=new Gi(4);if(this.option="OPTIONLEFTUP",this.cornerType=i,Ua.changeTool(this),this.items=this.getLineAndRect(e),A.publish("onlySelect",e),this.dragMode=this.isDragMode(this.items),this.command=r||new ve("Add Corner"),this.dragMode)if(this.drawing=!0,this.items[0]instanceof Ar&&this.items[1]instanceof Ar)this.command.addCommand(Te.dispatch(this.corner.line1,"modify")),this.command.addCommand(Te.dispatch(this.corner.line2,"modify"));else{let n=new Set;this.items.forEach(s=>{if(s instanceof mt){let a=this.items[0].getParent();a instanceof ct&&(a.removeFill(),n.add(a))}}),n.forEach(s=>this.command.addCommand(Te.dispatch(s,"modify")))}else A.publish("valueInput",{title:"Fillet Radius",unit:x.getInstance().unit},$());this.start()}get corner(){return this._corner}set corner(e){this.filterItems.clear(),e!=null&&(this.filterItems.add(e.line1),this.filterItems.add(e.line2)),this._corner=e}getLineAndRect(e){let r=new Set;return e.forEach(i=>{if((i instanceof Ar||i instanceof mt)&&r.add(i),i instanceof ct&&(r.add(i),!i.isClose())){let n=i.getOutMostChildren(),s=n[0];if(s instanceof mt&&r.add(s),n.length>1){let a=n.at(-1);a instanceof mt&&r.add(a)}}i instanceof nr&&r.add(i)}),[...r]}onKeyDown(e){e.keyCode===27&&this.cancel(),A.publish("updateFrame","")}valueInputEnd(e){let r=[];if(e>0&&(e=new ft().conversion(x.getInstance().unit,"mil",e/10),r=this.addFillets(this.items,e)),this.end(),r.length>0)A.publish("onlySelect",[].concat(r,this.items.filter(i=>!i.isEmpty)));else if(!isNaN(e)){let i=e>0?`Failed to add ${this.cornerType}, please try again with a smaller number`:"Please enter a number larger than zero";A.publish("ui/toastMsg",{type:"warn",msg:i},$())}}applyInputAtCursorValue(e){let{value:r,browserCursorPoint:i,keyCode:n,editing:s}=e;if(s){dt.editingWhat="circle";return}let l=new ft().conversion(x.getInstance().unit,"mil",r/10);if(l>0){let c=this.addOrUpdateFillet(this.corner,l);n===13&&(c?this.endDrag():A.publish("ui/toastMsg",{type:"warn",msg:`Failed to add ${this.cornerType}, please try again with a smaller number`},$()))}else this.cancel()}addFillets(e,r){let i=[],n={};for(let s of e)n[s.layerId]==null&&(n[s.layerId]=new Array),n[s.layerId].push(s);for(let s of Object.values(n)){let{lineCorners:a,trackCorners:l,polygons:c,rects:h}=this.filter(s);l.forEach(u=>{if(u.points){let d=this.getArcKeyPoint(u,r),p=this.addOrUpdateTrackFillet(u,d,this.command,"add");p&&i.push(p)}}),c.forEach(u=>{let d=u.filterOutMostChildren()[0];if(d.length<2)return;let p=[];for(let m=0;m<d.length-1;m++)d[m]instanceof mt&&d[m+1]instanceof mt&&p.push(new xb(d[m],d[m+1]));u.isClose()&&d[d.length-1]instanceof mt&&d[0]instanceof mt&&p.push(new xb(d[d.length-1],d[0])),this.command.addCommand(Te.dispatch(u,"modify")),p.forEach(m=>{if(m.points){let g=this.getArcKeyPoint(m,r);this.addOrUpdateLineModelFillet(m,g,"add")}}),A.publish("hasModifyPcbItem",u),u.removeFill(),u.fill(),i.push(u)}),h.forEach(u=>{if(this.cornerType==="chamfer"){let d=u.cornerRadius;if(!ne.greater(r,d)||ne.greater(r,Math.min(u.width,u.height)/2))return;let p=u.getLL(),m=u.getLR(),g=u.getUL(),y=u.getUR(),b=new io,P=b.addLine(p,m,u.layerId,u.strokeWidth),T=b.addLine(m,y,u.layerId,u.strokeWidth),I=b.addLine(y,g,u.layerId,u.strokeWidth),C=b.addLine(g,p,u.layerId,u.strokeWidth),E=pt.addPolygon(u.type,u.layerId,[[P,T,I,C]],u.strokeWidth,u.net,!1),O=[];O.push(new xb(P,T)),O.push(new xb(T,I)),O.push(new xb(I,C)),O.push(new xb(C,P)),O.forEach(R=>{if(R.points){let v=this.getArcKeyPoint(R,r);this.addOrUpdateLineModelFillet(R,v,"add",!1)}});let _=new Z3(u);_.extendOldItem(E),this.command.addCommand(Te.dispatch(u,"delete")),_.extendOldCopperOrder(E),A.publish("delete",u),u.remove(),this.command.addCommand(Te.dispatch(E,"add")),A.publish("hasModifyPcbItem",E),E.removeFill(),E.fill(),E.type=="Copper Region"&&A.publish("rebuildSingleCopper",{ids:[E.globalIndex],isLast:!0}),i.push(E)}else this.command.addCommand(Te.dispatch(u,"modify")),u.cornerRadius=r,u.removeFill(),u.fill(),u.type=="Copper Region"&&A.publish("rebuildSingleCopper",{ids:[u.globalIndex],isLast:!0}),A.publish("hasModifyPcbItem",u),i.push(u)}),a.forEach(u=>{if(u.points){let d=this.getArcKeyPoint(u,r),p=this.addOrUpdateLineModelFillet(u,d,"add");p&&i.push(p)}})}return this.res=i,i}addOrUpdateFillet(e,r){if(e.line1 instanceof mt&&e.points){let i=this.getArcKeyPoint(e,r);if(!i.canAddFillet)return!1;this.addOrUpdateLineModelFillet(e,i)}else if(e.line1 instanceof Ar&&e.points){let i=this.getArcKeyPoint(e,r);if(!i.canAddFillet)return!1;this.addOrUpdateTrackFillet(e,i)}return this.filterItems.add(this.corner.arc),this.corner.arc&&this.corner.arc.click(),!0}addOrUpdateLineModelFillet(e,r,i,n=!0){let{radius:s,circleCenter:a,tangencyPoint1:l,tangencyPoint2:c,startAngle:h,endAngle:u,sweep:d,canAddFillet:p}=r;if(!p)return;let m=()=>(y==="fillet"?e.arc=qc.addArc(b.layerId,a,s,b.width,h,u,d,!1):y==="chamfer"&&(e.arc=$u.add(b.layerId,l,c,b.width,!1)),b.getParent().insertChildren(e.arc,[T[0],T[1]+1]),e.arc),g=()=>{if(e.arc instanceof vt||e.arc instanceof mt)return y==="fillet"?(e.arc.center=a,e.arc.radius=s,e.arc.startAngle=h,e.arc.endAngle=u):y==="chamfer"&&(e.arc.start=l,e.arc.end=c),e.arc},y=this.cornerType,b=e.line1,P=new Set;[e.line1,e.line2].forEach(C=>{P.add(C.getParent())}),P.forEach(C=>{n&&this.command.addCommand(Te.dispatch(C,"modify")),this.filterItems.add(C)}),this.fixCornerLines(e,l,c);let T=[0,0],I=b.getParent().getChildrens();for(let C=0;C<I.length;C++)for(let E=0;E<I[C].length;E++)if(I[C][E]===b){T=[C,E];break}return i==="add"?m():e.arc instanceof vt||e.arc instanceof mt?g():m()}addOrUpdateTrackFillet(e,r,i,n){let{circleCenter:s,tangencyPoint1:a,tangencyPoint2:l,startAngle:c,endAngle:h,sweep:u,radius:d,canAddFillet:p}=r,m=e.line1,g=e.line2;if(!p)return;this.command.addCommand(Te.dispatch(e.line1,"modify")),this.command.addCommand(Te.dispatch(e.line2,"modify")),this.fixCornerLines(e,a,l);let y=this.cornerType;if(n==="add")return b();if(e.arc instanceof Si||e.arc instanceof Ar)return P();return b();function b(){y==="fillet"?e.arc=pr.addArcTrack(m.layerId,s,d,c,h,u,m.width,!1,m.net):y==="chamfer"&&(e.arc=pr.addTrack(m.layerId,a,l,m.width,!1,m.net));let T=e.arc;return i&&i.addCommand(Te.dispatch(T,"add")),A.publish("hasModifyPcbItem",e.line1),A.publish("hasModifyPcbItem",e.line2),A.publish("hasModifyPcbItem",T),T}function P(){return y==="fillet"?(e.arc.center=s,e.arc.radius=d,e.arc.startAngle=c,e.arc.endAngle=h):y==="chamfer"&&(e.arc.start=a,e.arc.end=l),e.arc}}fixCornerLines(e,r,i){let n=e.line1,s=e.line2,a=e.midPoint;l(n,r),l(s,i);function l(c,h){c.start.distance2(a)<c.end.distance2(a)?c.start=h:c.end=h}}getArcKeyPoint(e,r){let i=this.dragMode?1:.5,n=!0,{startPoint:s,midPoint:a,endPoint:l}=e.points,c=s.sub(a),h=l.sub(a),u=Xw(c,h)/2;if(Math.abs(u-es)<.001)return this.logger.debug1("\u5E73\u89D2\u4E0D\u7528\u5012\u89D2"),{canAddFillet:!1};let d=r/Math.sin(u>es?Math.PI-u:u),p=r/Math.tan(u>es?Math.PI-u:u),m=p/c.length();if(ne.greater(m,i))return this.logger.debug1("\u5207\u70B91\u8D85\u51FA\u8303\u56F4\u4E0D\u505A\u5012\u89D2"),{canAddFillet:!1};let g=new S(c.x*m,c.y*m),y=new S(g.x+a.x,g.y+a.y);if(m=p/h.length(),ne.greater(m,i))return this.logger.debug1("\u5207\u70B92\u8D85\u51FA\u8303\u56F4\u4E0D\u505A\u5012\u89D2"),{canAddFillet:!1};let b=new S(h.x*m,h.y*m),P=new S(b.x+a.x,b.y+a.y);m=c.length()/h.length(),h=new S(h.x*m,h.y*m);let T=new S(h.x+a.x,h.y+a.y),I=(s.x+T.x)/2,C=(s.y+T.y)/2,E=new S(I-a.x,C-a.y);if(E.length()===0)throw new Error("v3\u662F\u96F6\u5411\u91CF");m=d/E.length();let O=new S(E.x*m,E.y*m),_=O.x+a.x,R=O.y+a.y,v=new S(_,R),D=vqe(v,y),w=vqe(v,P),F;if(D>w&&D-w<Math.PI||D<w&&w-D>Math.PI?F=le.CW:F=le.CCW,s.equals1(e.line2.start)||s.equals1(e.line2.end)){let H=y;y=P,P=H}return{radius:r,circleCenter:v,tangencyPoint1:y,tangencyPoint2:P,startAngle:D,endAngle:w,sweep:F,canAddFillet:n}}getRadius(e,r){let{startPoint:i,midPoint:n,endPoint:s}=e.points;if(n.equals1(r))return 0;let a=new S(r.x-n.x,r.y-n.y),l=new S(i.x-n.x,i.y-n.y),c=new S(s.x-n.x,s.y-n.y),h=Xw(a,l),u=Xw(a,c),d=Xw(l,c);if(h>=d||u>=d)return 0;let p=Math.sin(d/2),m=xqe(l,c),g=new S(r.x-n.x,r.y-n.y),y=Xw(m,g),b=g.length()*Math.cos(y),P=g.length()*Math.sin(y),T=1/(p*p)-1,I=-2*b/p,C=b*b+P*P,E;if(T!==0){let{x1:O,x2:_}=XDt(T,I,C);E=Math.max(O,_)}else E=-C/I;if(isNaN(E))throw new Error("\u534A\u5F84\u8BA1\u7B97\u51FA\u9519");return E}getRadius1(e,r){let{startPoint:i,midPoint:n,endPoint:s}=e.points;if(n.equals1(r))return 0;let a=new S(i.x-n.x,i.y-n.y),l=new S(s.x-n.x,s.y-n.y),c=xqe(a,l),h=qDt(c,n,r),u=new S(h.x-n.x,h.y-n.y),d=Xw(a,l)/2,p=u.length()/Math.cos(d)*Math.tan(d);if(isNaN(p))throw new Error("\u534A\u5F84\u8BA1\u7B97\u51FA\u9519");return p}filter(e){let r=new Array,i=new Array,n=new Array,s=new Array;for(let c=0;c<e.length;c++){let h=e[c];h instanceof mt?r.push(h):h instanceof Ar?i.push(h):h instanceof ct?n.push(h):h instanceof nr&&s.push(h)}let a=this.getCorners(r),l=this.getCorners(i);return{lineCorners:a,trackCorners:l,polygons:n,rects:s}}getCorners_(e){let r={};for(let i=0;i<e.length;i++)for(let n=i+1;n<e.length;n++){let s=jDt(e[i],e[n]);s&&(r[s.midPoint.toString()]?r[s.midPoint.toString()].push(s):r[s.midPoint.toString()]=[s])}return Object.values(r).reduce((i,n)=>(n.length==1&&i.push(n[0]),i),[])}getCorners(e){let r={},i=[];return e.forEach(n=>{if(n.start.equals(n.end))return;let s=n.start.clone(),a=n.end.clone(),l=n.layerId,c=i.find(u=>Rb(u[0],s)),h=i.find(u=>Rb(u[0],a));if(c){let u=c[1],d=u[l];d?(d.forEach(p=>{let m;Rb(p.start,s)?m=new xb(n,p):m=new xb(p,n),r[m.midPoint.toString()]?r[m.midPoint.toString()].push(m):r[m.midPoint.toString()]=[m]}),d.push(n)):u[l]=[n]}else i.push([s,{[l]:[n]}]);if(h){let u=h[1],d=u[l];d?(d.forEach(p=>{let m;Rb(p.end,a)?m=new xb(p,n):m=new xb(n,p),r[m.midPoint.toString()]?r[m.midPoint.toString()].push(m):r[m.midPoint.toString()]=[m]}),d.push(n)):u[l]=[n]}else i.push([a,{[l]:[n]}])}),Object.values(r).reduce((n,s)=>(s.length==1&&n.push(s[0]),n),[])}onMouseLeftUp(e){this.dragMode&&(dt.destroy(),this.endDrag())}endDrag(){if(this.corner.arc){if(this.items[0]instanceof mt){let e=this.items[0].getParent();e.fill(),A.publish("hasModifyPcbItem",e),A.publish("onlySelect",[e])}else this.items[0]instanceof Ar&&(this.command.addCommand(Te.dispatch(this.corner.arc,"add")),A.publish("hasModifyPcbItem",this.corner.line1),A.publish("hasModifyPcbItem",this.corner.line2),A.publish("hasModifyPcbItem",this.corner.arc),A.publish("onlySelect",[this.corner.line1,this.corner.line2,this.corner.arc]));dt.destroy(),this.end()}}end(){var r;this.dragMode=!1,this.drawing=!1;let e=(r=this.corner)==null?void 0:r.arc;if(e){let i=e.getParent();i instanceof ct&&i.removeSelect(e)}je.executeCommand(this.command),this.command=new ve("Add Corner"),A.publish("flushService",""),A.publish("tool","dropdrag"),A.publish("updateCross",""),this.res!=null&&A.publish("onlySelect",new Set([...this.items.filter(i=>!i.isEmpty),...this.res]))}onMouseMove(e){if(!this.dragMode)return;let r=this.getRadius1(this.corner,new S(e.sceneX,e.sceneY));r>0?this.addOrUpdateFillet(this.corner,r):r=0;let i=Gf(),n=Fo(new S(e.sceneX,e.sceneY)),s={frameInfo:i,show:!0,type:"circle",data:[{frameCursorPoint:n,info:{tagName:"Fillet Radius",value:Xe(r),unit:x.getInstance().unit,type:"circle"}}]};dt.create(s)}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:_qe(e.adsorb).result};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}interrupt(){dt.destroy(),this.end()}cancel(){if(this.fixCornerLines(this.corner,this.corner.midPoint,this.corner.midPoint),this.corner.arc instanceof vt||this.corner.arc instanceof mt){let e=this.corner.arc.getParent(),r=e.getChildrens();for(let i=0;i<r.length;i++)for(let n=0;n<r[i].length;n++)r[i][n]==this.corner.arc&&e.removeChild([i,n])}this.corner.arc!=null&&(this.corner.arc.remove(),A.publish("delete",this.corner.arc)),this.interrupt(),this.end()}isDragMode(e){this.logger.debug3("%s %s","111111",e);let r=e.filter(i=>i instanceof ct);if(e.length-r.length==2){let i=e.filter(a=>!(a instanceof ct)),n=r.map(a=>a.getChildrens()).flat(2);n.length==i.length&&n.every(a=>i.includes(a))&&(e=i)}if(e.length===2&&(e[0]instanceof mt&&e[1]instanceof mt||e[0]instanceof Ar&&e[1]instanceof Ar)&&YDt(e[0],e[1]))return this.corner=this.getCorners(e)[0],this.corner!=null;if(e.length===1&&e[0]instanceof ct){let i=e[0].getChildrens();if(i.length!=1)return!1;let n=i[0];if(n.length===2&&n[0]instanceof mt&&n[1]instanceof mt)return this.corner=this.getCorners(n)[0],this.corner!=null}return!1}};function Rb(o,t){return Math.abs(o.x-t.x)<1e-4&&Math.abs(o.y-t.y)<1e-4}function YDt(o,t){let e=o.start,r=o.end,i=t.start,n=t.end;return!!(Rb(e,i)||Rb(e,n)||Rb(r,i)||Rb(r,n))}function jDt(o,t){if(o.start.equals(o.end)||t.start.equals(t.end)||o.layerId!=t.layerId)return null;let e=o.start.clone(),r=o.end.clone(),i=t.start.clone(),n=t.end.clone(),s=0,a;return Rb(e,i)&&(s++,a=new xb(t,o)),Rb(e,n)&&(s++,a=new xb(t,o)),Rb(r,i)&&(s++,a=new xb(o,t)),Rb(r,n)&&(s++,a=new xb(t,o)),s===1?a:null}var xb=class{constructor(t,e){this.line1=t,this.line2=e,this.points=this.keyPoints(),this.points&&(this.startPoint=this.points.startPoint,this.midPoint=this.points.midPoint,this.endPoint=this.points.endPoint)}isConnect(){return!!this.keyPoints()}keyPoints(){let t=this.line1,e=this.line2;if(t.start.equals(t.end)||e.start.equals(e.end))return null;let r=t.start.clone(),i=t.end.clone(),n=e.start.clone(),s=e.end.clone(),a=0,l;return Rb(r,n)&&(a++,l={startPoint:i,midPoint:r,endPoint:s}),Rb(r,s)&&(a++,l={startPoint:n,midPoint:s,endPoint:i}),Rb(i,n)&&(a++,l={startPoint:r,midPoint:i,endPoint:s}),Rb(i,s)&&(a++,l={startPoint:r,midPoint:i,endPoint:n}),a===1?l:null}};function Xw(o,t){if(o.x===0&&o.y===0||t.x===0&&t.y===0)throw new Error("\u96F6\u5411\u91CF\u4E0D\u80FD\u8BA1\u7B97\u5939\u89D2");let e=(o.x*t.x+o.y*t.y)/(o.length()*t.length());return e>1?e=1:e<-1&&(e=-1),Math.acos(e)}function vqe(o,t){let e;if(o.x===t.x)e=es;else{let r=new S(t.x-o.x,t.y-o.y),i=new S(Math.abs(o.x-t.x),0);e=Xw(r,i)}return t.y<o.y&&(e=Vr-e),e}function xqe(o,t){let e=o.normalize(),r=t.normalize();return new S(e.x+r.x,e.y+r.y).normalize()}function XDt(o,t,e){try{if(t*t-4*o*e<0)throw new Error("\u65B9\u7A0B\u65E0\u89E3");let r=Math.sqrt(t*t-4*o*e),i=(-t+r)/(2*o),n=(-t-r)/(2*o);return{x1:i,x2:n}}catch(r){console.log(r)}}function qDt(o,t,e){let r=new S(e.x-t.x,e.y-t.y),i=Xw(o,r),n=r.length()*Math.cos(i),s=new S(o.x*n,o.y*n);return new S(s.x+t.x,s.y+t.y)}var jpe=class extends ci{constructor(t,e,r,i,n){super(),this.start(),this.option="OPTIONLEFTUP",this.oldToolDrawing=e,this.drawing=!0,this.tool=t,this.lastTool=r,this.selectPadProgram=i,this.msg=n}onKeyDown(t){switch(sr.getAction(4,t)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(t);return}A.publish("updateFrame","")}onMouseMove(t){if(this.drawing){jt.update(t,this.msg);let r=new _e().ext2(new S(t.realSceneX,t.realSceneY)).ext7(1).build1(),i=Vt.search(r,(s,a)=>a=="Pad");i.setFilter(new vd);let n=new $1;i.setAction(n),i.doAction(["Pad"]);for(let s of n.pads){s.click(),A.publish("onlySelect",[s]);return}A.publish("clearSelect","")}}onMouseLeftUp(t){if(this.drawing){let r=new _e().ext2(new S(t.realSceneX,t.realSceneY)).ext7(1).build1(),i=Vt.search(r,(s,a)=>a=="Pad");i.setFilter(new vd);let n=new $1;i.setAction(n),i.doAction(["Pad"]);for(let s of n.pads){this.toggleLastTool(),yi.resetLastScene(),jt.cancel(),s.click(),A.publish("select",[s]),this.selectPadProgram.pad=s;return}}}toggleLastTool(){this.tool.setNextTool(new dh),this.tool.drawing=this.oldToolDrawing}interrupt(){this.drawing=!1,this.toggleLastTool(),yi.resetLastScene(),this.selectPadProgram.pad=null,jt.cancel(),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:vo(t.adsorb)};Qt.getInstance().menuData(e,this),this.drawing=!1}};var Xpe=class extends ci{constructor(e,r,i,n){super();this.temDatumLine=null;this.start(),this.option="OPTIONLEFTUP",this.oldToolDrawing=r,this.drawing=!0,this.tool=e,this.lastTool=i,this.msg=n}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);return}A.publish("updateFrame","")}onMouseMove(e){if(this.drawing){jt.update(e,this.msg);let i=new _e().ext2(new S(e.realSceneX,e.realSceneY)).ext7(1).build1(),n=Vt.search(i,(a,l)=>l=="Polygon");n.setFilter(new vd).setFilter(new a0(e.sceneX,e.sceneY));let s=new s5;n.setAction(s),n.doAction(["Polygon"]),this.temDatumLine&&this.temDatumLine.visible();for(let a of s.d3SideSlotDatumLine){this.temDatumLine=a,a.click();return}A.publish("clearSelect","")}}onMouseLeftUp(e){if(this.drawing){let i=new _e().ext2(new S(e.realSceneX,e.realSceneY)).ext7(1).build1(),n=Vt.search(i,(a,l)=>l=="Polygon");n.setFilter(new vd).setFilter(new a0(e.sceneX,e.sceneY));let s=new s5;n.setAction(s),n.doAction(["Polygon"]);for(let a of s.d3SideSlotDatumLine){this.tool.setNextTool(new dh),yi.resetLastScene(),jt.cancel(),a.click(),A.publish("select",[a]),uh.pushBaseLine(a),uh.completed();return}}}interrupt(){this.drawing=!1,jt.cancel(),uh.interrupt(),this.temDatumLine&&(this.temDatumLine.visible(),this.temDatumLine=null),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}};var qpe=class extends ci{constructor(){super();this.commands=new ve("draw stacktable");this.stackTable=null;this.groupName="\u5C42\u5806\u53E0";this.option="OPTIONLEFTUP";let e=this.getPhysicalStackConfig();A.windowBridge.rpcCall("getPhysicalStackingConfig",[e],$()).then(i=>{this.stackConfig=i.message}),this.start()}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break}}onMouseLeftUp(e){Rqe(this.stackTable)||this.placeStackTable(e)}onMouseMove(e){let r=new S(e.sceneX,e.sceneY);if(this.drawing){if(this.stackTable!==null&&!this.stackTable.isUpdate()){let i=r.sub(this.stackTable.origin),n=Ae.translate(i.x,i.y,0);this.stackTable.transform(n)}else if(this.stackTable!==null&&(this.stackTable.remove(),A.publish("delete",this.stackTable),this.stackTable=null),this.stackConfig){let i=new B5(this.stackConfig,13,this.groupName);i.addStackTable(r),this.stackTable=i}}}placeStackTable(e){let r=!0;for(let a of this.stackTable.items)if(r&&!Bt.checkIsInCanEdit(a)){let l="beyond drawing range";Bt.showMassageTip(l,l),r=!1}if(!r){for(let a of this.stackTable.items)a.partition="";return}if(!this.stackTable.joinCombination())return;let i=this.stackTable.items;A.publish("onlySelect",i);for(let a of i)A.publish("hasModifyPcbItem",a);this.commands.addCommand(new C_(this.stackTable,"add")),je.executeCommand(this.commands),A.publish("flushService",""),this.commands=new ve("draw stacktable"),this.drawing=!0,this.stackTable=null;let n=new S(e.sceneX,e.sceneY),s=new B5(this.stackConfig,13,this.groupName);s.addStackTable(n),this.stackTable=s}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Eae(e.adsorb).result};Qt.getInstance().menuData(r,this),this.drawing=!1}cancel(){this.interrupt(),A.publish("tool","dropdrag")}interrupt(){this.stackTable!==null&&(this.stackTable.remove(),this.drawing=!1,this.stackTable=null,A.publish("updateRtree","")),this.end()}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"TABLE_SETTING":A.windowBridge.publish("openTableSetting",{cmd:"place_part(stack_table)"},$());break}}getPhysicalStackConfig(){let e=new ft,r=be.getLayerPhys().map(n=>({Layer:n.layerName,Type:n.layerType,Material:i(n.material),Thickness:n.thickness!=null?xe(e.mil2mm(n.thickness*10),3):"-",Permittivity:i(n.permittivity),"Loss Tangent":i(n.lossTangent)}));function i(n){return Rqe(n)?"-":n}return r}};function Rqe(o){return o==null}var $pe=class extends DP{constructor(e,r){super();this.profile=null;this.type=e,this.confirmWindowCb=r}getResult(e){let r=new Array;e.shape.forEach(i=>{let n=this.getModel(i);r.push(n),i.remove()}),r.length>0&&(this.profile=fe.build2(r)),e.shape.length=0}getModel(e){if(e instanceof Yi||e instanceof Zo)return e.primitive;if(e instanceof hr)return new M(e.start,e.end);if(e instanceof ns)return q.build2(e.center,e.startAngle,e.endAngle,e.radius,e.radius,e.sweep)}confirmWindow(e,r){if(this.profile!=null){let i=new Array;this.type=="Line"?(this.profile.primitives.forEach(n=>{let s=n.stroke(e._width,kr.ROUND,le.CCW),a=Wr.getSelectContect(s);if(n instanceof M){let l=n.start(),c=Array.from(a);xr(c,(h,u)=>h.buildBBox().center().distance2(l)-u.buildBBox().center().distance2(l),0,c.length),i=i.concat(c)}}),i=Array.from($t.filterElement(i,{boxChoose:!0})),i.forEach(n=>{n.click()}),A.publish("clearSelect",""),A.publish("select",i),Pr.model=1,A.publish("tool","dropdrag")):this.type=="Prohibited Region"||this.type=="Fill Region",this.confirmWindowCb&&this.confirmWindowCb(i)}}setConfirmWindowCb(e){this.confirmWindowCb=e}modify(e,r,i){}};var Kpe=class extends c1{constructor(e,r){super();this.event=new Hu;this.logger=new Gi(4);switch(this.event=new Hu,this.resultEvent=new $pe(e,r),e==="Line"&&(this.event.needClose=!1),tr.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.event.commands=new ve("draw 2DLine - "+e),jr.addDrawTool(this),td.disable=!0,this.start()}onKeyDown(e){switch(sr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(jr.getNextType());break}this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){this.drawPolygon.onMouseLeftUp(e)}onMouseMove(e){this.drawing&&this.drawPolygon.onMouseMove(e)}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?(this.drawPolygon.abortLast=!0,this.completed()):this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel();break}}}interrupt(){td.disable=!1,this.drawPolygon.interrupt(),jr.clearDrawTool(),Pr.model=1,this.end()}cancel(){td.disable=!1,A.publish("clearSelect",""),this.drawPolygon.cancel()}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),tr.getInstance().type=e,we.synchronize()}wireWidth(e){this.drawPolygon.wireWidth(e)}completed(){td.disable=!1,A.publish("clearSelect",""),this.drawPolygon.completed(!1)}backspace(){this.drawPolygon.backspace()}wireMode(e){}rightClickMenuData(e){let r=this.event.start!=null,i={state:"show",left:e.mouseX,top:e.mouseY,filter:o1(tr.getInstance().type,e.adsorb,r,!0).result};Qt.getInstance().menuData(i,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]);break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}setConfirmWindowCb(e){this.resultEvent.setConfirmWindowCb(e)}};var Zpe=class extends Kpe{constructor(){super("Line");this.oldSelect=new Set;this.setConfirmWindowCb(this.confirmWindowCb.bind(this)),this.oldSelect=new Set(Ve.getSelects())}confirmWindowCb(e){this.logger.debug3("%s %s","\u81EA\u5B9A\u4E49\u8DEF\u5F84\u91CD\u65B0\u7F16\u53F7\u9009\u62E9\u7ED3\u679C...",e);let r=NN.options;r.range!=="allPads"&&(e=e.filter(i=>this.oldSelect.has(i))),r.selectItems=e,NN.renumber(r),this.end()}};var $C=class o{constructor(t=!1,e=!1,r=1.6){this.isDiffRoute=e,this.diffPairSpacing=r,this.checkPath=t}draw(t,e,r,i,n,s,a,l,c,h,u,d){let{start:p,end:m,endX:g,endY:y,directX:b,directY:P,height:T}=t;Nt.setPushFilter(),this.isDiffRoute?(e=this.midLineLimitWidth(r,e),r=="arc90"&&(i+=this.diffPairSpacing)):Nt.pushFilter.setNetAndLayerId(l.item.net,l.item.layerId);let I=s*2;n=this.getMinWidth(r,s,n);let C=Math.max(Math.abs(T),i),E=new Array,O=p,_=!1,R=0,v=!1,D=0;for(;D<e;){let w=R%2==0||a?1:-1,F="1",H="1";(R==0||!_||a)&&(F="0"),a&&(H="0");let z=new LAe(O,b,P.mul(w),C,n,s,a,F,H,r),G=this.block(z,i,I,r,C,l,c,u,d),W=!G;if(O.distance1(z.end)+D>=e)G=!1;else if(v=this.isNeedSplit(E,z,W,l),v)return{splitBlockTrack:v};if(h!=null&&G&&(G=this.restrictByMaxLength(h,z,E,i,I,r,C,s,u,l,d,c).success),G)E.push(z),_=!0;else{let B=E.pop();for(;B!=null;)if(B.rightStyle="0",G=this.block(B,i,I,r,C,l,c,u,d),p.distance1(B.end)>=e&&(G=!1),h!=null&&G&&(G=this.restrictByMaxLength(h,B,E,i,I,r,C,s,u,l,d,c).success),G){E.push(B);break}else B=E.pop();_=!1}O=this.getNextPoint(z,r),D=p.distance1(O),z.result.length>0&&R++}if(Nt.filter=null,this.isDiffRoute){let w=[new Array,new Array],F=[];for(let H of E)H.diffResult.forEach((z,G)=>{let W=z[0].start();F[G]!=null&&W.distance2(F[G])>1e-8&&w[G].push(new M(F[G],W)),Re.addAll(w[G],z),F[G]=z[z.length-1].end()});return{paths:w.map(H=>this.mergeArcs(H).filter(z=>z.length()>1e-8)),templates:E}}else{let w=p,F=new Array;for(let H of E)H.start.distance2(w)>1e-8&&F.push(new M(w,H.start)),Re.addAll(F,H.result),w=H.end;return{path:this.mergeArcs(F).filter(H=>H.length()>1e-8),templates:E,splitBlockTrack:v}}}static lengthen(t,e=100){let r=t.length(),i=t.direct.mul(e*r);return new M(t.start().sub(i),t.end().add(i))}isNeedSplit(t,e,r,i){if(!r||!this.checkPath||t.length<0)return!1;let n=tr.getInstance().mode;if(n==="WIRING_MODE_SURROUND_AND_PUSHAWAY"||n==="WIRING_MODE_SURROUND"||n==="WIRING_MODE_OBSTRUCT"){let s=e.start,a=e.end,l=new qr(`TRACK${Vf.getInstance().getID()}`,i.item.layerId,s,a,i.item.width,!1,i.item.net);if(new As().blockTrack2(l).length>0)return!0}return!1}mergeArcs(t){if(t.length==0)return[];let e=[t[0]];for(let r=1;r<t.length;r++){let i=e[e.length-1],n=t[r];if(n instanceof q&&i instanceof q){let s=this.arcAngleMerge(i,n);s?(e.pop(),e.push(s)):e.push(n)}else e.push(n)}return e}arcAngleMerge(t,e){return!t.center.equals1(e.center)||!ne.eq(t.rx,e.rx)?null:q.build2(t.center,t.startAngle,t.sweepAngle*e.sweepAngle>0?e.endAngle():e.startAngle,t.rx,t.ry,t.sweep())}getMinWidth(t,e,r){switch(t){case"line45":return Math.max(r,e*2);case"line90":return Math.max(r,e);case"arc90":default:return Math.max(r,e)}}getNextPoint(t,e){let r=!1;switch(t.result.length||(r=!0),e){case"line45":{let i=t.lineWidth,n=t.gap-Math.min(i/Math.sqrt(2)*2,t.height);return r?t.start.add(t.referDirect.mul(n/2)):t.isSingleSide?(this.isDiffRoute&&(i=this.midLineWidth(i)),t.end.add(t.referDirect.mul(n))):t.end}case"line90":return r?t.start.add(t.referDirect.mul(t.gap/2)):t.isSingleSide?t.end.add(t.referDirect.mul(t.gap)):t.end;case"arc90":{if(r){let i=t.gap;return t.start.add(t.referDirect.mul(i/2))}return t.isSingleSide?t.end.add(t.referDirect.mul(t.gap-Math.min(t.height,t.gap))):t.end}default:return t.end}}block(t,e,r,i,n,s,a,l,c){t.height=n;let h=tr.getInstance().mode;if(a&&a.length>0){let d=this.collide(t,e,r,i,n,s,a,l,c);return d||(t.result.length=0,t.diffResult.forEach(p=>p.length=0)),d}let u=!1;switch(h){case"WIRING_MODE_IGNORE":return this.snake(t,i),!0;case"WIRING_MODE_PUSHAWAY":case"WIRING_MODE_SURROUND_AND_PUSHAWAY":case"WIRING_MODE_SURROUND":case"WIRING_MODE_OBSTRUCT":return u=this.collide(t,e,r,i,n,s,a,l,c),u||(t.result.length=0,t.diffResult.forEach(d=>d.length=0)),u}}collide(t,e,r,i,n,s,a,l,c){for(;!ne.less(t.height,e);){let d=this.blockTemplete(t,i,s,a,l,c);if(d.length>0){let p=this.getBlockMin(d,t);t.height=Math.min(p,n)}else return!0}return t.height=e,!(this.blockTemplete(t,i,s,a,l,c,!0).length>0)}getBlockMin(t,e){let r=Number.MAX_VALUE,i=e.normalDirect,n=e.referDirect,s=e.start,a=[];if(t.forEach(l=>{let c=l.point.sub(s),h=Math.abs(i.dot(c)),u=e.style,d=l.source,p=l.point;if(u==="line45")if(d.direct.equals(i)||d.direct.equals(i.mul(-1)))this.isDiffRoute?h+=this.midLineWidth2(e.lineWidth)/Math.sqrt(2):h+=e.lineWidth/Math.sqrt(2);else{let m=Math.abs(s.sub(p).dot(i));this.isDiffRoute&&(m-=this.diffPairSpacing/2);let g=e.height-m;h+=g}this.isDiffRoute&&(h-=this.diffPairSpacing/2),Math.abs(e.height-h)<=.001&&a.push(l),h<r&&(r=h)}),Math.abs(e.height-r)<=.001){let l=e.lineWidth/2;r-=l}return r}blockTemplete(t,e,r,i,n,s,a=!1){let l=new As,c=tr.getInstance().mode;this.snake(t,e,!0);let h=this.getSnakeShapes(t,r,s,n),u=[],d=r==null?void 0:r.parent.getAllItems(),p=s==null?void 0:s.parent.getAllItems();for(let m of h){let g=l.blockTrack2(m,c==="WIRING_MODE_PUSHAWAY");if(this.isDiffRoute&&(g=g.filter(y=>{let b=p.indexOf(y.obstacle)<0,P=d.indexOf(y.obstacle)<0;return b&&P})),u.push(...g),u.length&&a)return u;An.getInstance().delete(m,m.globalIndex)}return u}getSnakeShapes(t,e,r,i){let n;if(this.isDiffRoute){let s=e,a=r;if(i){let l=this.create4Path(t,t.diffResult[0],s),c=this.create4Path(t,t.diffResult[1],a);n=[].concat(l,c)}else{let l=this.create4Path(t,t.diffResult[1],s),c=this.create4Path(t,t.diffResult[0],a);n=[].concat(l,c)}}else n=this.create4Path(t,t.result,e);return n}snake(t,e,r=!1){this.isDiffRoute?this.diffPairSnake(t,e,r):this.singleSnake(t,e,r)}singleSnake(t,e,r=!1){switch(t.result.length=0,t.height==0&&t.result.push(new M(t.start,t.end)),e){case"line45":{this.degree45(t,r);break}case"line90":{this.degree90(t,r);break}case"arc90":default:{this.arc90(t,r);break}}}diffPairSnake(t,e,r=!1){t.diffResult.forEach(a=>a.length=0);let i=t.lineWidth;t.lineWidth=this.midLineWidth(i),this.singleSnake(t,e,r),t.lineWidth=i;let n=[-1,1].map(a=>{let l=new M(t.start,t.start.add(t.referDirect)),c=new M(t.end,t.end.add(t.referDirect)),h=[].concat([l],t.result,[c]);return h=h.filter(u=>u.length()>0),h.map(u=>u.panDistance(a*this.diffPairSpacing/2))}),s=[[],[]];n.forEach((a,l)=>{let c=s[l];for(let h=1;h<a.length;h++){let u=h==1?a[0]:c[h-1],d=a[h];if(u instanceof q&&d instanceof M)c[h]=new M(u.end(),d.end());else if(u instanceof M&&d instanceof q)c[h-1]=new M(u.start(),d.start()),c[h]=d;else if(u instanceof M&&d instanceof M)if(Tt(o.lengthen(u),o.lengthen(d))>0){let m=new S(Ee[0],Ee[1]);c[h-1]=new M(u.start(),m),c[h]=new M(m,d.end())}else c[h]=d;else c[h]=d}c.shift(),c.pop()}),t.diffResult=s}degree45(t,e=!1){let r=null;if(t.isSingleSide){let i=this.line45Model(t.start,t.referDirect,t.normalDirect,t.height,t.lineWidth,t.leftStyle,!1),n=t.referDirect.mul(t.gap-Math.min(t.lineWidth/Math.sqrt(2)*2,t.height)),s=i[i.length-1].add(n),a=this.line45Model(s,t.referDirect,t.normalDirect.mul(-1),t.height,t.lineWidth,t.rightStyle,!1);r=a[a.length-1],i.push(s),this.createLines(i,t.result),this.createLines(a,t.result)}else{let i=this.line45Model(t.start,t.referDirect,t.normalDirect,t.height,t.lineWidth,t.leftStyle,!1),n=t.referDirect.mul(t.gap-Math.min(t.lineWidth/Math.sqrt(2),t.height)*2),s=i[i.length-1].add(n),a=this.line45Model(s,t.referDirect,t.normalDirect.mul(-1),t.height,t.lineWidth,t.rightStyle,!0);r=a[a.length-1],i.push(s),this.createLines(i,t.result),this.createLines(a,t.result)}return t.end=r,r}degree90(t,e=!1){let r=t.referDirect.mul(t.gap),i=this.line90Model(t.start,t.normalDirect,t.height),n=i[i.length-1].add(r),s=this.line90Model(n,t.normalDirect.mul(-1),t.height),a=s[s.length-1];return i.push(n),this.createLines(i,t.result),this.createLines(s,t.result),t.end=a,a}arc90(t,e=!1){let r,i=this.arc90Model(t.start,t.referDirect,t.normalDirect,t.height,t.gap,t.leftStyle,!1),n=t.referDirect.mul(t.gap-Math.min(t.height,t.gap)),s=i[i.length-1].end().add(n),a=this.arc90Model(s,t.referDirect,t.normalDirect.mul(-1),t.height,t.gap,t.rightStyle,!0);return r=a[a.length-1].end(),Re.addAll(t.result,i),i[i.length-1].end().equals1(s)||t.result.push(new M(i[i.length-1].end(),s)),Re.addAll(t.result,a),t.end=r,r}line45Model(t,e,r,i,n,s,a){let l=e.add(r).normalize();if(n=n/Math.sqrt(2),s=="0"){let c=i-n*2;if(ne.less(c,0)){let m=i*Math.sqrt(2),g=t.add(l.mul(m));return[t,g]}let h=n*Math.sqrt(2),u=t.add(l.mul(h)),d=u.add(r.mul(c)),p=d.add(l.mul(h));return[t,u,d,p]}else{let c=i-n;if(ne.less(c,0)){let h=i*Math.sqrt(2),u=t.add(l.mul(h));return[t,u]}if(a){let h=n*Math.sqrt(2),u=t.add(l.mul(h)),d=u.add(r.mul(c));return[t,u,d]}else{let h=n*Math.sqrt(2),u=t.add(r.mul(c)),d=u.add(l.mul(h));return[t,u,d]}}}line90Model(t,e,r){return[t,t.add(e.mul(r))]}arc90Model(t,e,r,i,n,s,a){let l=new Array;if(s=="0"){let c=i-n,h=e.add(r).normalize();if(ne.less(c,0)){let P=i*Math.sqrt(2)/2,T=t.add(h.mul(P)),I=this.createArc(e,t,T),C=T.add(h.mul(P)),E=this.createArc(r,T,C);return l.push(I,E),l}let u=n*Math.sqrt(2)/2,d=t.add(h.mul(u)),p=d.add(r.mul(c)),m=p.add(h.mul(u)),g=this.createArc(e,t,d),y=new M(d,p),b=this.createArc(r,p,m);return l.push(g,y,b),l}else{let c=i-n/2,h=e.add(r).normalize();if(a){if(ne.less(i,n)){let y=i*Math.sqrt(2)/2,b=t.add(h.mul(y)),P=this.createArc(e,t,b),T=b.add(r.mul(i/2)),I=new M(b,T);return l.push(P,I),l}let u=n*Math.sqrt(2)/2,d=t.add(h.mul(u)),p=d.add(r.mul(c)),m=this.createArc(e,t,d),g=new M(d,p);return l.push(m,g),l}else{if(ne.less(i,n)){let y=i*Math.sqrt(2)/2,b=t.add(r.mul(i/2)),P=new M(t,b),T=b.add(h.mul(y)),I=this.createArc(r,b,T);return l.push(P,I),l}let u=n*Math.sqrt(2)/2,d=t.add(r.mul(c)),p=d.add(h.mul(u)),m=new M(t,d),g=this.createArc(r,d,p);return l.push(m,g),l}}}createLines(t,e){let r=t[0];for(let i=1,n=t.length;i<n;i++){let s=t[i],a=new M(r,s);e.push(a),r=s}}createArc(t,e,r){let i=new ro,{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=i.tangentToArc(t,e,r);return q.build2(n,a/Math.PI*180,l/Math.PI*180,s,s,c)}create4Path(t,e,r){let i=new Array;for(let n=0;n<e.length;n++){let s=e[n],a=!1,{style:l,isSingleSide:c}=t;switch(l){case"line45":if(c)n>=4?a=!0:a=!1;else{let h=t.leftStyle==="0"?1:0;n>=3+h?a=!0:a=!1}break;case"line90":c&&(n>=2?a=!0:a=!1);break;case"arc90":if(c)n>=3?a=!0:a=!1;else{let h=t.leftStyle==="0"?1:0;n>=2+h?a=!0:a=!1}break}if(a){if(s instanceof M){let h=new qr(`TRACK${Vf.getInstance().getID()}`,r.item.layerId,s.end(),s.start(),r.item.width,!1,r.item.net);i.push(h)}else if(s instanceof q){let h=new Oi(`TRACK${Vf.getInstance().getID()}`,r.item.layerId,s.center,s.rx,r.item.width,(s.startAngle+s.sweepAngle)*(Math.PI/180),s.startAngle*(Math.PI/180),s.isCCW?0:1,!1,r.item.net,1);i.push(h)}}else if(s instanceof M){let h=new qr(`TRACK${Vf.getInstance().getID()}`,r.item.layerId,s.start(),s.end(),r.item.width,!1,r.item.net);i.push(h)}else if(s instanceof q){let h=new Oi(`TRACK${Vf.getInstance().getID()}`,r.item.layerId,s.center,s.rx,r.item.width,s.startAngle*(Math.PI/180),(s.startAngle+s.sweepAngle)*(Math.PI/180),s.isCCW?1:0,!1,r.item.net,1);i.push(h)}}return i}midLineWidth(t){let e=(this.diffPairSpacing-t)/2;return t+(t+2*e)*Math.tan(Math.PI/8)}midLineWidth2(t){let e=this.diffPairSpacing-t/2;return t+(t+2*e)*Math.tan(Math.PI/8)}midLineLimitWidth(t,e){return t=="line90"?e-this.diffPairSpacing/2:t=="line45"?e-this.diffPairSpacing/2/Math.tan(Math.PI*3/8):e}restrictByMaxLength(t,e,r,i,n,s,a,l,c,h,u,d){let p=new Array;Re.addAll(p,r);let m=this.currentAdditionalLength(p,c);if(ne.eq(m-t,0))return{success:!1,maxHeight:0};let g=!0;p.push(e);let b=this.currentAdditionalLength(p,c)-t;if(ne.greater(b,0)){let P=this.heightDecreasedTo(s,e,b,l);ne.greater(i,Math.max(P,0))?g=!1:(e.height=P,g=this.block(e,i,n,s,P,h,d,c,u))}return{success:g,maxHeight:a}}currentAdditionalLength(t,e){return t.reduce((r,i)=>{let n=this.isDiffRoute?i.diffResult[e?1:0]:i.result,s=n[0].start().distance1(n[n.length-1].end());return r+n.reduce((a,l)=>a+l.length(),-s)},0)}heightDecreasedTo(t,e,r,i){switch(t){case"line90":return Math.max(0,e.height-r/2);case"line45":{let n=e.height-r/2;if(ne.greater(n,2*i))return n;r=r-(e.height-i*2)*2;let s=[e.leftStyle,e.rightStyle].reduce((c,h)=>c+(h=="0"?1:0),0),a=i*2-r/(s*(Math.sqrt(2)-1)+(2-s));if(ne.greater(a,i))return a;r=r-i*(s*(Math.sqrt(2)-1)+(2-s));let l=i-r/(2*(Math.sqrt(2)-1));return Math.max(0,l)}case"arc90":{let n=e.height-r/2;if(ne.greater(n,e.gap))return n;r=r-(e.height-e.gap)*2;let s=[e.leftStyle,e.rightStyle].reduce((l,c)=>l+(c=="0"?1:0),0),a=e.gap-r/((s+2)*(Math.PI/2-1)/2+(2-s)/2);return Math.max(0,a)}}}};var LAe=class{constructor(t,e,r,i,n,s,a,l,c,h){this.result=Array();this.end=null;this.diffResult=[Array(),Array()];this.start=t,this.referDirect=e,this.normalDirect=r,this.height=i,this.gap=n,this.lineWidth=s,this.isSingleSide=a,this.leftStyle=l,this.rightStyle=c,this.style=h}};function Jpe(o,t){let e=new Jt;return e.add("CANCEL",!0),e.add("INCREASE_GAP"),e.add("DECREASE_GAP"),e.add("GAP_STEP_VALUE",!0),e.add("EQUAL_LENGTH_TUNING_SETTING"),t&&e.add("DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING"),e.add("toggleAdsorb",!1,o),e.add("ADSORBENT_CONFIG"),e}var jh=class jh extends ci{constructor(e=jh.isSingleSide,r=jh.type,i=jh.width,n=jh.minHeight,s=null,a=null,l=!1,c=0,h=!1,u=null,d=!1){super();this.restrictLength=!1;this.rectHelpLine=[];this.init=!0;this.drawMode=0;this.option="OPTIONLEFTUP",(d||!jh.init)&&(jh.isSingleSide=e,jh.type=r,jh.width=i,jh.minHeight=n,jh.restrictLength=l,jh.additionalLength=c,jh.init=!0),this.isSingleSide=jh.isSingleSide,this.type=jh.type,this.width=jh.width,this.minHeight=jh.minHeight,this.restrictLength=jh.restrictLength,this.additionalLength=jh.additionalLength,this.addedTo=u,h&&s?(this.selectStartPoint(s.x,s.y),a&&(this.mouseXY=a,this.draw(new S(a.x,a.y)),this.moveEnd())):this.onMouseMove(Pi.getInstance())}onMouseMove(e){this.drawing=!0,this.mouseXY=new S(e.sceneX,e.sceneY),this.drawMode==1?jt.update(e,"Please select a network"):this.startPoint?(this.init==!1&&(this.start(),this.moveInit()),this.draw(this.mouseXY),this.moveEnd()):jt.update(e,"Please select a starting point for Track Tunning,press the tab key to set parameters")}onMouseLeftUp(e){let r=e.sceneX,i=e.sceneY;this.drawMode==0?this.startPoint?(this.finishDraw(),jt.cancel()):this.selectStartPoint(r,i):this.netSelect(e)}onKeyDown(e){switch(sr.getAction([6,4],e)){case"Cancel":this.cancel();break;case"Change Track Width While Routing":this.reOpenDialog();break;case"increaseSnakeGap":this.changeGap(this.stepSize,e);break;case"decreaseSnakeGap":this.changeGap(-this.stepSize,e);break;case"Finish":this.onEnterPlace(e);break}}cancel(){if(this.drawMode==1){this.drawMode=0,this.reOpenDialog();return}this.startPoint?this.interrupt():(ji.getInstance().clear(),Zl.getInstance().deleteAll(),Rm.getInstance().clear(),Un.getInstance().clear(),_i.getInstance().clear(),hf.getInstance().clear(),D0.getInstance().clear(),hi.getInstance().clear(),xt.getInstance().clear(),Os.getInstance().clear(),_r.getInstance().clear(),O9.getInstance().clear(),gc.getInstance().clear(),Ra.getInstance().clear(),Es.getInstance().clear(),yc.getInstance().clear(),A.publish("tool","dropdrag"))}interrupt(){var r,i,n;this.init===!1&&this.moveInit(),ze.unhighlightNet((r=this.targetTrack)==null?void 0:r.net),this.drawing=!1;let e=this.wireCommands;e==null||e.undo(),(i=this.wireResult)==null||i.command.undo(),(n=this.targetTrack)!=null&&n.net&&this.updateNetLengthMsg({restrictLength:this.restrictLength,netLengthAtBeginning:this.netLengthAtBeginning,additionalLength:this.additionalLength,net:this.targetTrack.net,showNetLength:!0}),this.wireResult=null,this.startPoint=null,this.mouseXY=null,this.targetTrack=null,this.pathList=null,this.wireCommands=null,this.commands=null,this.trackNode=null,this.pts=[],jt.cancel(),Jl.getInstance().clear(),this.rectHelpLine.forEach(s=>s.remove()),this.end()}toggleMode(e){this.drawMode=e,this.drawing=!0}netSelect(e){if(this.drawMode==1){let r=Wr.selectNet(e.sceneX,e.sceneY);if(r!==null){let i=this.getNearNetPcbItems(r,e.sceneX,e.sceneY);this.handleNets(e,i)}}}handleNets(e,r){let i=new Set;r.forEach(n=>{i=n.nets}),i.size&&(i.size===1?i.forEach(n=>{this.handleChangeSelectedNet(n)}):(jt.cancel(),this.showNetsMenu(e,i)))}handleChangeSelectedNet(e){var r;e!=((r=this.targetTrack)==null?void 0:r.net)&&this.reOpenDialog(e)&&(this.drawMode=0,jt.cancel())}showNetsMenu(e,r){let i={};i.state="show",i.left=e.mouseX,i.top=e.mouseY,i.filter=this.getNetsMenuData(r).result,Qt.getInstance().menuData(i,this),this.drawing=!1}getNetsMenuData(e){let r=new Jt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}getNearNetPcbItems(e,r,i){let n=new Set,s=new Set,a=new Set;return e.forEach(l=>{let c=l.net;if(l instanceof Ye&&l.type=="Copper Region"){let h=!1;if(l.iteratorCopper(u=>{h||u.inCopper(r,i)&&u.isVisible&&(h=!0)}),!h)return}c&&(a.add(l),s.add(c))}),n.add({group:a,nets:s}),n}selectStartPoint(e,r){var a;let i=go.getSingleItems(e,r);if(!i||!(i instanceof Ar))return;this.startPoint=new S(e,r),this.targetTrack=i,this.startTrackCenterPoint(this.startPoint,i),this.trackNode=this.getPathList(i),this.pathList=this.trackNode.parent;let n=this.pathList.getAllItems(),s=[];n.forEach(l=>s.push(l.primitive)),this.pts=s,ze.highlightNet((a=this.targetTrack)==null?void 0:a.net),this.netLengthAtBeginning=ze.getNetLength(this.targetTrack.net),Jl.getInstance().init(),jt.cancel(),jt.getToleranceTargetNet(this.targetTrack.net)}startTrackCenterPoint(e,r){let i=r.start,n=r.end,s=Ute(i,n,e);this.startPoint=new S(s.x,s.y)}getPathList(e){return this.wireCommands=new Br,this.commands=new ve("wire"),new ku(e.model).generateList(),xt.getInstance().getNode(e.model)}finishDraw(){var e;this.init=!0,ze.unhighlightNet((e=this.targetTrack)==null?void 0:e.net),ji.getInstance().complete(this.commands),Rm.getInstance().executeCommand(this.wireCommands),je.executeCommand(this.commands),A.publish("flushService",""),this.startPoint=null,this.mouseXY=null,this.targetTrack=null,this.pathList=null,this.wireCommands=null,this.commands=null,this.trackNode=null,this.pts=[],this.drawing=!1,this.wireResult=null,this.rectHelpLine.forEach(r=>r.remove()),ji.getInstance().clear(),Zl.getInstance().deleteAll(),Rm.getInstance().clear(),hi.getInstance().clear(),_r.getInstance().clear(),this.end()}moveInit(){var e,r;(e=this.wireResult)==null||e.command.undo(),(r=this.wireCommands)==null||r.undo(),ji.getInstance().view4Status(_r.getInstance().current),this.wireCommands=new Br,this.pathList=this.trackNode.parent,this.wireResult=null,this.init=!0}moveEnd(){let e=ji.getInstance().view4Status(_r.getInstance().current);this.wireCommands.addCommand(e),hi.getInstance().update(),this.init=!1,this.updateNetLengthMsg({restrictLength:this.restrictLength,netLengthAtBeginning:this.netLengthAtBeginning,additionalLength:this.additionalLength,net:this.targetTrack.net,showNetLength:!0})}reOpenDialog(e){var l;let r=(l=this.targetTrack)!=null&&l.net?this.targetTrack.net:"",i=te.getInstance().getNetLengthPhysicsByNet(r),n=te.getInstance().getNetLengthTolerancePhysicsByNet(r),s=new Array,a=r?ze.getNetLength(r):-1;if(ze.getAllNets().forEach(c=>{if(c!=r){let h=ze.getNetLength(c);h>a&&s.push({net:c,netLength:h})}}),r&&e){if(s.every(c=>c.net!=e))return A.publish("ui/toastMsg",{type:"warn",msg:{text:"Network {addToNet} is shorter than the current equal-length network and cannot be selected.",i18nParam:{addToNet:e}}},$()),!1;this.additionalLength=s.find(c=>c.net==e).netLength-a}A.publish("openMainDialog",{cmd:34,data:{reOpenDialog:!0,unit:x.getInstance().unit,type:this.type,isSingleSide:this.isSingleSide,width:this.width,minHeight:this.minHeight,startPoint:this.startPoint,mouseXY:this.mouseXY,restrictLength:this.restrictLength,netLengthMin:i.netLengthMin,netLengthMax:i.netLengthMax,netLengthTolerance:(n==null?void 0:n.netLengthTolerance)||0,additionalLength:this.additionalLength,lengthType:this.lengthType,longerNets:s,currentNetLength:a,addToNet:e,addedTo:this.addedTo,addedLength:this.addedLength}}),this.init==!1&&this.moveInit()}changeGap(e,r){let i=this.width+e;i<1e-6||(this.width=i,jh.width=this.width,r&&(this.init==!1&&this.moveInit(),this.draw(new S(r.sceneX,r.sceneY)),this.moveEnd()))}get stepSize(){return jh.stepSize}set stepSize(e){jh.stepSize=e}showRectHelpLine(e,r,i){let{endX:n,endY:s}=this.convertRectRegionInfo(e,r,i),a=[e,n,r,s,e],l=[];for(let c=1;c<a.length;c++)l.push(new M(a[c-1],a[c]));this.rectHelpLine.forEach(c=>c.remove()),this.rectHelpLine=dP(l,1002);for(let c of this.rectHelpLine)c.color=ee.WHITE}convertRectRegionInfo(e,r,i){let n=r.sub(e),s=new S(-i.y,i.x),a=i.dot(n),l=s.dot(n),c=i.mul(a).normalize(),h=s.mul(l).normalize(),u=Math.abs(a),d=Math.abs(l),p=e.add(c.mul(u)),m=e.add(h.mul(d));return{start:e,endX:p,end:r,endY:m,directX:c,directY:h,width:u,height:d}}getPathLength(e){return e.reduce((r,i)=>r+i.length(),0)}isPointInRect(e,r){let[i,n,s,a]=r,l=n.sub(i).normalize(),c=a.sub(i).normalize(),h=i.distance1(n),u=i.distance1(a),d=e.sub(i),p=d.dot(l),m=d.dot(c),g=1e-5;return p>=-g&&p<=h+g&&m>=-g&&m<=u+g}getRandomNet(e,r="id"){for(let i=0;i<100;i++){let n=`tempNet-${r}-${Math.random()*1e16}-${Date.now()}`;if(!e.has(n))return n}return""}createCollideTrack(e,r,i,n=this.trackNode.item.width){return new ri().createTrack(this.trackNode.item.layerId,e.start(),e.end(),n,r,i,this.trackNode.item.getGroupID())}createArcCollideTrack(e,r,i,n=this.trackNode.item.width){return new ri().createArcTrackByArc(this.trackNode.item.layerId,e,n,r,i,this.trackNode.item.getGroupID())}deleteCollideTrack(e,r){r.undo()}updateTrack(e,r,i,n=!1){let s=new ri,a=this.pathList.getAllItems().reverse();n||(a=a.reverse());let l=s.createList(),c=this.targetTrack,h=this.pathList,u=e.length-(a.length-i);e.forEach((d,p)=>{let m=c.width;p<=r?m=a[p].width:p>=u&&(m=a[p-u+i].width);let g;Fd(d)<1e-8||(d instanceof M?(g=s.createTrack(c.layerId,d.start(),d.end(),m,c.net,this.wireCommands,c.getGroupID()),s.addList(g,l,this.wireCommands)):d instanceof q&&(g=s.createArcTrack(c.layerId,d.center,d.rx,d.startAngle*(Math.PI/180),(d.startAngle+d.sweepAngle)*(Math.PI/180),d.isCCW?1:0,m,c.net,this.wireCommands,void 0,c.getGroupID()),s.addList(g,l,this.wireCommands)))}),l.replace(h.getFirstNode(),h.getLastNode(),h),this.wireCommands.addCommand(new Ti(l))}reverse(e){let r=new Array(e.length);for(let i=0,n=e.length-1;n>=0;i++,n--){let s=Hp(e[n]);r[i]=s}return r}calculateAdjustIndexAndLength(e,r,i,n){let s=this.startPoint,a=0,l=i,c=[],h=!0;for(let u=i,d=e.length;u<d;u++){let p=e[u],m=n.dot(p.start().sub(s)),g=n.dot(p.end().sub(s));if(p instanceof M&&ne.eq(p.direct.cross(n),0)&&m<g&&(l=u,r>g?a=g:(a=r,h=!1)),r<=g)break}if(h)for(let u=l+1;u<e.length;u++){let d=e[u];if(d instanceof M){let m=d.start().sub(s).dot(n);if(r>=m){c.push(u);break}}}return{length:a,resultIndex:l,extendResultIndexs:c}}baseLineLengthChange(e,r,i,n,s,a,l){let c=0;for(let g=r;g<=i;g++)c+=e[g].length();let h=e[r].start(),u=e[i].end(),d=Math.abs(u.sub(h).dot(n)),p=Math.abs(u.sub(h).dot(s)),m=l?Math.min(Math.max(p/a-Math.sqrt(2),0),2)*(Math.sqrt(2)-2)*a:0;return d+p-c+m}updateNetLengthMsg(e){let r=new Array;r.push(new lf(this.trackNode.item.net,this.trackNode.item.width,this.trackNode.item.layerId,this.trackNode.item.direct,!1));let i=this.trackNode.item.net,n=te.getInstance().getNet(i);if(n&&n.netDifferential){e.showDiffLength=!0;let a=n.netDifferential.positiveNet.name,l=n.netDifferential.negativeNet.name,c=this.trackNode.item.net==a?l:a;r.push(new lf(c,0,this.trackNode.item.layerId,this.trackNode.item.direct,!1))}let s=new fC(r,[],r[0]);Ap.updateNetLengthMsg2(s,"Single wiring",e)}rightClickMenuData(e){var s;let r=(s=this.targetTrack)==null?void 0:s.net,i=!1;if(r){let a=te.getInstance().getNet(r);a!=null&&a.netDifferential!=null&&(i=!0)}let n={};n.state="show",n.left=e.mouseX,n.top=e.mouseY,n.filter=Jpe(e.adsorb,i).result,Qt.getInstance().menuData(n,this)}parse(e){let r=e.cmdKey,i=r.split(":",r.length);switch(i[0]){case"CANCEL":this.cancel();break;case"INCREASE_GAP":this.changeGap(1);break;case"DECREASE_GAP":this.changeGap(-1);break;case"EQUAL_LENGTH_TUNING_SETTING":this.reOpenDialog();break;case"DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING":{let n={activeTab:"Rule",activeMenu:"Differential Pair"};A.publish("openMainDialog",{cmd:5,data:{option:n,tool:this}});break}case"GAP_STEP_VALUE":A.publish("openMainDialog",{cmd:37,data:{tool:this,stepSize:this.stepSize}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"INHERIT_NET":this.handleChangeSelectedNet(i[1]);break}}calculateSplitLength(e,r,i,n){let s=this.startPoint,a=0,l=i,c=[],h=!0;for(let u=i,d=e.length;u<d;u++){let p=e[u],m=n.dot(p.start().sub(s)),g=n.dot(p.end().sub(s));if(p instanceof M&&ne.eq(p.direct.cross(n),0)&&m<g&&(l=u,r>g?a=g:(a=r,h=!1)),r<=g)break}if(h)for(let u=l+1;u<e.length;u++){let d=e[u];if(d instanceof M){let m=d.start().sub(s).dot(n);if(r>=m){c.push(u);break}}}return{length:a,resultIndex:l,extendResultIndexs:c}}create4Path(e,r){let i=new Array;for(let n of e)if(n instanceof M){let s=new qr(`TRACK${Vf.getInstance().getID()}`,r.item.layerId,n.start(),n.end(),r.item.width,!1,r.item.net);i.push(s)}else if(n instanceof q){let s=new Oi(`TRACK${Vf.getInstance().getID()}`,r.item.layerId,n.center,n.rx,r.item.width,n.startAngle*(Math.PI/180),(n.startAngle+n.sweepAngle)*(Math.PI/180),n.isCCW?1:0,!1,r.item.net,1);i.push(s)}return i}getMaxLengthChange(e,r,i,n,s){if(!this.restrictLength||isNaN(this.additionalLength))return null;if(this.addedTo){let l=parseFloat(this.addedTo)/10-ze.getNetLength(this.targetTrack.net)||0;this.additionalLength=l>0?l:0}return this.additionalLength-this.baseLineLengthChange(e,r,i,n,s,this.targetTrack.width,jh.type!="line90")}draw(e){if(Yr.pause){Yr.play4Next();return}Yr.replay?e=Yr.position||e:Yr.position=e;let r=tr.getInstance().mode;this.clearCache();let{targetTrack:i,startPoint:n,type:s,minHeight:a,width:l,isSingleSide:c}=this,{reverse:h,pts:u,startIndex:d,startPt:p,direct:m,dir:g}=this.getTrackDirect(e,n),y=this.convertRectRegionInfo(n,e,m),{directX:b,directY:P}=y;if(b.x==0&&b.y==0||P.x==0&&P.y==0)return;let{length:T,resultIndex:I,extendResultIndexs:C}=this.calculateAdjustIndexAndLength(u,Math.abs(g),d,b),{shapes:E,command:O,prePath:_}=this.selfBlockTracks(u,d,I,C),R=this.getMaxLengthChange(u,d,I,b,P),v=new $C(!0),{path:D,templates:w,splitBlockTrack:F}=v.draw(y,T,s,a,l,i.width,c,this.trackNode,E,R);O.undo();let H=new Array;if(F){let W=I;C.forEach(L=>{L>W&&(W=L)}),H=this.splitTrackDraw(d,W,y,R,h),this.updateTrack(H,d,W,h)}else if(D.length>0){z.apply(this);let W=G.apply(this);this.updateTrack(H,d,W,h)}if(r==="WIRING_MODE_PUSHAWAY"){let W=new Kg;this.wireResult=W;let L=new lf(this.trackNode.item.net,this.trackNode.item.width,this.trackNode.item.layerId,this.trackNode.item.direct,!1);W.setInputStatus(this.pathList),W.wireMap.set(L,this.pathList);let B=new dg(!1);try{B.level="SUPER",B.inputLevel="NONE",B.run(W)}catch(N){throw new Error(N)}}this.showRectHelpLine(this.startPoint,e,this.targetTrack.direct);function z(){if(D.length>0){let W=u[I],L=W.start().sub(this.startPoint),B=P.mul(L.dot(P)),N=this.startPoint.add(b.mul(T)),U=N.add(B),k=u.slice(0,d),V=u.slice(I+1,u.length);Re.addAll(H,k);let Y=new Array,X=new M(p.start(),this.startPoint);Y.push(X),Y.push(...D);let Z=D[D.length-1].end(),Q=new M(Z,N),ae=new M(N,U),he=new M(U,W.end()),re=[Q,ae,he];s!=="line90"&&(re=IN(re,i.width,Math.sqrt(2))),Y.push(...re),Re.addAll(H,Y),Re.addAll(H,V)}else Re.addAll(H,u)}function G(){if(C.length){let L=null;if(this.restrictLength&&R){let B=this.getPathLength(H)-this.getPathLength(u);L=R-B}for(let B of w)_.push(...B.result);for(let B=0;B<C.length;B++){let N=u[C[B]],U=this.drawTemplateLimitInRect(N.start(),N.end(),y,L,_);if(U.length){let k=U[0].start(),V=U[U.length-1].end(),Y=new M(N.start(),k),X=new M(V,N.end()),Z=[].concat([Y],U,[X]),Q=H.indexOf(N);if(H.splice(Q,1,...Z),this.restrictLength&&R&&(L-=this.getPathLength(Z)-N.length(),L<=1e-8))break}}}let W=I;return C.forEach(L=>{L>W&&(W=L)}),W}}getTrackDirect(e,r){let i=this.pathList.getAllItems().indexOf(this.targetTrack.model),n=this.pts[i],s=n.direct,a=e.sub(r).dot(s),l=!1,c=this.pts;return a<0&&(l=!0,c=this.reverse(c),i=c.length-i-1,n=c[i],s=n.direct),{reverse:l,pts:c,startIndex:i,startPt:n,direct:s,dir:a}}clearCache(){Yr.init(),Ra.getInstance().clear(),Es.getInstance().clear(),Os.getInstance().clear(),Fr.getInstance().clear()}selfBlockTracks(e,r,i,n){let s=[];if(tr.getInstance().mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"||tr.getInstance().mode=="WIRING_MODE_SURROUND"||tr.getInstance().mode=="WIRING_MODE_OBSTRUCT"){let u=r,d=Math.max(r,i);for(let g=0;g<n.length;g++)n[g]>d&&(d=n[g]);let p=e.slice(0,u),m=e.slice(d+1,e.length);s=[].concat(p,m)}let a=[],l=new Set(ze.getAllNets()),c=new Br,h=this.getRandomNet(l,"prePath");for(let u of s){let d;if(u instanceof M)d=this.createCollideTrack(u,h,c);else if(u instanceof q)d=this.createArcCollideTrack(u,h,c);else throw new Error("not support others!!!!");a.push(d)}return{shapes:a,command:c,prePath:s}}updateNetLengthRuleInDialog(){var a;let e=(a=this.targetTrack)!=null&&a.net?this.targetTrack.net:"",r=te.getInstance().getNetLengthPhysicsByNet(e),i=r.netLengthMin*10,n=r.netLengthMax*10,s="updateNetLengthRule";A.publish("pcbdialogModify",{dialogType:"equal-length-tuning",action:s,netLengthMin:i,netLengthMax:n})}mergeLine(e){let r=new Array;if(!e.length)return[];r.push(e[0]);for(let i=1;i<e.length;i++){let n=r[r.length-1],s=e[i];if(n instanceof M&&s instanceof M&&this.getSweep(n.start(),n.end(),s.end())===0){let l=new M(n.start(),s.end());r.splice(r.length-1,1,l);continue}r.push(s)}return r}changeHistory(e,r){let i=e.commands,n=i.length;for(let s=n-1;s>=0;s--){let a=i[s];if(a instanceof Br)this.changeHistory(a,r);else if(a instanceof Ti){let c=a.list.parentNode.target;r===c&&(a.undo(),i.splice(s,1))}}}getSweep(e,r,i){let n=r.sub(e),s=i.sub(r);return Math.abs(n.cross(s))<1e-8?0:n.cross(s)>0?1:-1}splitTrackDraw(e,r,i,n,s){let a=this.pts,l=i.directY,c=this.pathList.getFirstNode(),h=new Array;for(;c;)h.push(c),c=c.next;s&&(a=this.reverse(a),h.reverse());let u=new Array;for(let p=0;p<e;p++){let m=a[p];u.push(m)}let d=!1;for(let p=e;p<=r;p++){let m=a[p],g=m.start(),y=m.end(),b=y.sub(g).normalize();if(d||Math.abs(b.cross(l))<1e-6){u.push(m);continue}let P=!1;p===e&&(P=!0,g=this.startPoint);let T=i,I=h[p],C=I.item;if(C instanceof qr){let O=s?C.end:C.start,_=s?C.start:C.end,R=_.sub(O),{start:v,endX:D,end:w,endY:F,directX:H,directY:z}=T,G=[v,D,w,F];if(!this.isPointInRect(O,G)||!this.isPointInRect(_,G)){let W=R.dot(z),L=O;ne.less(W,0)&&(L=O.add(z.mul(-Math.abs(W)))),T=this.convertRectRegionInfo(L,w,H)}}let E=this.drawTemplateLimitInRect(g,y,T,n,u,I,P);if(E.length){let O=E[0].start(),_=E[E.length-1].end(),R=new M(m.start(),O),v=new M(_,m.end()),D=[].concat([R],E,[v]);u.push(...D),this.restrictLength&&n&&(n-=this.getPathLength(D)-m.length(),n<=1e-8&&(d=!0))}else{let O=new M(m.start(),m.end());u.push(O)}}for(let p=r+1;p<a.length;p++){let m=a[p];u.push(m)}return u}drawTemplateLimitInRect(e,r,i,n,s=[],a=this.trackNode,l=!1){let{targetTrack:c,type:h,minHeight:u,width:d,isSingleSide:p}=this,m=l?0:this.targetTrack.width*1.5,{start:g,endX:y,end:b,endY:P,directX:T,directY:I}=i,C=[g,y,b,P],E=[e,r],O=new M(e,r);for(let R=1,v=C.length;R<=v;R++){let D=new M(C[R-1],C[R%v]),w=Tt(O,D),F=ig(w,[])[0];F&&E.push(F)}let _=[Number.MAX_VALUE,-Number.MAX_VALUE];for(let R of E)if(this.isPointInRect(R,C)){let v=e.distance1(R);_[0]=Math.min(_[0],v),_[1]=Math.max(_[1],v)}if(_[1]-_[0]>m*2){let R=r.sub(e).normalize(),v=e.add(R.mul(_[0]+m)),D=e.add(R.mul(_[1]-m)),w=D.sub(v).normalize(),F=new S(-w.y,w.x),H=0;w.dot(T)>=0?F.dot(I)<0&&(F=F.mul(-1)):F.dot(I)>0&&(F=F.mul(-1)),R.equals1(T)?H=LM(D.x,D.y,P.x,P.y,b.x,b.y):H=g.distance1(b);let z=D.add(F.mul(H)),G=this.convertRectRegionInfo(v,z,R),W=[],L=[],B=new Set(ze.getAllNets()),N=this.getRandomNet(B,"limitRect"),U=new Br;if(!R.equals1(T))for(let X=1,Z=C.length;X<=Z;X++){let Q=new M(C[X-1],C[X%Z]),ae=this.createCollideTrack(Q,N,U);W.push(ae),L.push(null)}let k=this.getRandomNet(B,"prePath");for(let X of s){let Z=this.createCollideTrack(X,k,U);W.push(Z),L.push(null)}let V=new $C,{path:Y}=V.draw(G,G.width,h,u,d,c.width,p,a,W,n);return this.deleteCollideTrack(W,U),Y}return[]}getCentroid(e){let r=0,i=0,n=e.length||1;return e.forEach(s=>{r+=s.x,i+=s.y}),new S(r/n,i/n)}};jh.init=!1,jh.isSingleSide=!0,jh.type="line45",jh.width=6,jh.minHeight=1,jh.stepSize=1,jh.restrictLength=!1,jh.additionalLength=0;var qw=jh;var Nc=class Nc extends ci{constructor(e=Nc.isSingleSide,r=Nc.type,i=Nc.width,n=Nc.minHeight,s=null,a=null,l=!1,c=0,h=!1,u=null,d=!1){super();this.restrictLength=!1;this.diffPairSpacing=1.6;this.targetTrack=null;this.init=!0;this.track_P=null;this.track_N=null;this.pathNode_P=null;this.pathNode_N=null;this.pathList_P=null;this.pathList_N=null;this.pts_P=[];this.pts_N=[];this.rectHelpLine=[];this.drawMode=0;this.option="OPTIONLEFTUP",(d||!Nc.init)&&(Nc.isSingleSide=e,Nc.type=r,Nc.width=i,Nc.minHeight=n,Nc.restrictLength=l,Nc.additionalLength=c,Nc.init=!0),this.isSingleSide=Nc.isSingleSide,this.type=Nc.type,this.width=Nc.width,this.minHeight=Nc.minHeight,this.restrictLength=Nc.restrictLength,this.additionalLength=Nc.additionalLength,this.addedTo=u,h&&s&&(this.selectStartPoint(s.x,s.y),a&&(this.mouseXY=a,this.draw(new S(a.x,a.y)),this.moveEnd()))}onMouseMove(e){this.drawing=!0,this.mouseXY=new S(e.sceneX,e.sceneY),this.drawMode==1?jt.update(e,"Please select a network"):this.startPoint?(this.init==!1&&(this.start(),this.moveInit()),this.draw(this.mouseXY),this.moveEnd()):jt.update(e,"Please select a starting point for Track Tunning,press the tab key to set parameters")}onMouseLeftUp(e){let r=e.sceneX,i=e.sceneY;this.drawMode==0?this.startPoint?(this.finishDraw(),jt.cancel()):this.selectStartPoint(r,i):this.netSelect(e)}finishDraw(){var e,r;this.init=!0,ze.unhighlightNet((e=this.track_N)==null?void 0:e.net),ze.unhighlightNet((r=this.track_P)==null?void 0:r.net),ji.getInstance().complete(this.commands),Rm.getInstance().executeCommand(this.commands),je.executeCommand(this.commands),A.publish("flushService",""),this.startPoint=null,this.mouseXY=null,this.targetTrack=null,this.startPoint_N=null,this.startPoint_P=null,this.track_P=null,this.track_N=null,this.wireCommands=null,this.commands=null,this.pathNode_P=null,this.pathNode_N=null,this.pathList_N=null,this.pathList_P=null,this.pts_P=null,this.pts_N=null,this.wireResult=null,this.drawing=!1,this.rectHelpLine.forEach(i=>i.remove()),ji.getInstance().clear(),Zl.getInstance().deleteAll(),Rm.getInstance().clear(),hi.getInstance().clear(),_r.getInstance().clear(),this.end()}onKeyDown(e){switch(sr.getAction([6,4],e)){case"Cancel":this.cancel();break;case"Change Track Width While Routing":this.reOpenDialog();break;case"increaseSnakeGap":this.changeGap(this.stepSize,e);break;case"decreaseSnakeGap":this.changeGap(-this.stepSize,e);break;case"Finish":this.onEnterPlace(e);break}}get stepSize(){return Nc.stepSize}set stepSize(e){Nc.stepSize=e}changeGap(e,r){let i=this.width+e;i<1e-6||(Nc.type=="line45"&&this.targetTrack&&(i=Math.max(i,this.targetTrack.width*2)),i!=this.width&&(this.width=Math.max(i,this.targetTrack.width*2),Nc.width=this.width,r&&(this.init==!1&&this.moveInit(),this.draw(new S(r.sceneX,r.sceneY)),this.moveEnd())),r&&(this.init==!1&&this.moveInit(),this.draw(new S(r.sceneX,r.sceneY)),this.moveEnd()))}reOpenDialog(e){var l;let r=(l=this.targetTrack)!=null&&l.net?this.targetTrack.net:"",i=te.getInstance().getNetLengthPhysicsByNet(r),n=te.getInstance().getNetLengthTolerancePhysicsByNet(r),s=new Array,a=r?ze.getNetLength(r):-1;if(ze.getAllNets().forEach(c=>{if(c!=r){let h=ze.getNetLength(c);h>a&&s.push({net:c,netLength:h})}}),r&&e){if(s.every(c=>c.net!=e))return A.publish("ui/toastMsg",{type:"warn",msg:{text:"Network {addToNet} is shorter than the current equal-length network and cannot be selected.",i18nParam:{addToNet:e}}},$()),!1;this.additionalLength=s.find(c=>c.net==e).netLength-a}A.publish("openMainDialog",{cmd:34,data:{reOpenDialog:!0,unit:x.getInstance().unit,isDiffPair:!0,type:this.type,isSingleSide:this.isSingleSide,width:this.width,minHeight:this.minHeight,startPoint:this.startPointSelected,mouseXY:this.mouseXY,restrictLength:this.restrictLength,netLengthMin:i.netLengthMin,netLengthMax:i.netLengthMax,netLengthTolerance:(n==null?void 0:n.netLengthTolerance)||0,additionalLength:this.additionalLength,lengthType:this.lengthType,longerNets:s,currentNetLength:a,addToNet:e,addedTo:this.addedTo,addedLength:this.addedLength}}),this.init==!1&&this.moveInit()}cancel(){var e;if(this.drawMode==1){this.drawMode=0,this.reOpenDialog((e=this.targetTrack)==null?void 0:e.net);return}this.startPoint?this.interrupt():(ji.getInstance().clear(),Zl.getInstance().deleteAll(),Rm.getInstance().clear(),Un.getInstance().clear(),_i.getInstance().clear(),hf.getInstance().clear(),D0.getInstance().clear(),hi.getInstance().clear(),xt.getInstance().clear(),Os.getInstance().clear(),_r.getInstance().clear(),O9.getInstance().clear(),gc.getInstance().clear(),Ra.getInstance().clear(),Es.getInstance().clear(),yc.getInstance().clear(),A.publish("tool","dropdrag"))}interrupt(){var i,n,s,a;this.init==!1&&this.moveInit(),ze.unhighlightNet((i=this.track_N)==null?void 0:i.net),ze.unhighlightNet((n=this.track_P)==null?void 0:n.net),this.drawing=!1;let e=this.wireCommands;e==null||e.undo();let r=ji.getInstance().view4Status(_r.getInstance().current);this.rectHelpLine.forEach(l=>l.remove()),(s=this.wireResult)==null||s.command.undo(),(a=this.targetTrack)!=null&&a.net&&this.updateNetLengthMsg({net:this.targetTrack.net,restrictLength:this.restrictLength,netLengthAtBeginning:this.netLengthAtBeginning,additionalLength:this.additionalLength,showNetLength:!0}),this.wireResult=null,this.startPoint=null,this.targetTrack=null,this.startPoint_P=null,this.startPoint_N=null,this.track_P=null,this.track_N=null,this.pathNode_P=null,this.pathNode_N=null,this.pathList_P=null,this.pathList_N=null,this.pts_P=[],this.pts_N=[],this.wireCommands=null,this.commands=null,this.rectHelpLine=[],Jl.getInstance().clear(),jt.cancel(),this.end()}toggleMode(e){this.drawMode=e,this.drawing=!0}netSelect(e){if(this.drawMode==1){let r=Wr.selectNet(e.sceneX,e.sceneY);if(r!==null){let i=this.getNearNetPcbItems(r,e.sceneX,e.sceneY);this.handleNets(e,i),this.drawMode=0}}}handleNets(e,r){let i=new Set;r.forEach(n=>{i=n.nets}),i.size&&(i.size===1?i.forEach(n=>{this.handleChangeSelectedNet(n)}):(jt.cancel(),this.showNetsMenu(e,i)))}handleChangeSelectedNet(e){var r;e!=((r=this.targetTrack)==null?void 0:r.net)&&this.reOpenDialog(e)&&(this.drawMode=0,jt.cancel())}showNetsMenu(e,r){let i={};i.state="show",i.left=e.mouseX,i.top=e.mouseY,i.filter=this.getNetsMenuData(r).result,Qt.getInstance().menuData(i,this),this.drawing=!1}getNetsMenuData(e){let r=new Jt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}getNearNetPcbItems(e,r,i){let n=new Set,s=new Set,a=new Set;return e.forEach(l=>{let c=l.net;if(l instanceof Ye&&l.type=="Copper Region"){let h=!1;if(l.iteratorCopper(u=>{h||u.inCopper(r,i)&&u.isVisible&&(h=!0)}),!h)return}c&&(a.add(l),s.add(c))}),n.add({group:a,nets:s}),n}syncSpacing(){let e=Ds(this.startPoint,this.targetTrack.layerId,!0),r=te.getInstance(),i=this.targetTrack.layerId,n=r.getDifferentialPhysicsByNet(this.targetTrack.net).getDifferentialPairSpacingDefault(i);for(let s=0;s<e.length;s++){let a=te.getInstance().getRegion(e[s].globalIndex);if(a.diff){n=r.getDifferentialPhysics(a.diff).getDifferentialPairSpacingDefault(i);break}}this.diffPairSpacing=n+this.targetTrack.width}selectStartPoint(e,r){let i=go.getSingleItems(e,r);if(!i||!(i instanceof Ar))return;let n=i,s=new S(e,r),a=te.getInstance().getNet(n.net);if(a!=null&&a.netDifferential!=null){let l=new WF(n,s,!1,!1);this.targetTrack=n,Nc.type=="line45"&&(this.width=Nc.width=Math.max(Nc.width,this.targetTrack.width*2)),this.wireCommands=new Br,this.commands=new ve("wire"),this.track_P=l.positive,this.track_N=l.negative,this.startPoint_P=l.start_P,this.startPoint_N=l.start_N,this.pathNode_P=this.getPathList(this.track_P),this.pathNode_N=this.getPathList(this.track_N),this.pathList_P=this.pathNode_P.parent,this.pathList_N=this.pathNode_N.parent;let c=this.pathList_P.getAllItems(),h=this.pathList_N.getAllItems(),u=[],d=[];c.forEach(p=>u.push(p.primitive)),h.forEach(p=>d.push(p.primitive)),this.pts_P=u,this.pts_N=d,this.startPointSelected=s,this.startPoint=l.start_P.add(l.start_N).mul(.5),Jl.getInstance().init(),this.syncSpacing(),jt.cancel(),ze.highlightNet(l.positive.net),ze.highlightNet(l.negative.net),this.netLengthAtBeginning=ze.getNetLength(this.targetTrack.net)}else{let l=new _0("No differential pair, do you want to create a differential pair?",()=>{A.publish("openDifferentailDialog",{name:r5(),positiveNet:n.net,negativeNet:"",netOptions:t5()},$())});A.publish("openMsgbox",l);return}}parse(e){let r=e.cmdKey,i=r.split(":",r.length);switch(i[0]){case"CANCEL":this.cancel();break;case"INCREASE_GAP":this.changeGap(1);break;case"DECREASE_GAP":this.changeGap(-1);break;case"EQUAL_LENGTH_TUNING_SETTING":this.reOpenDialog();break;case"DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING":{let n={activeTab:"Rule",activeMenu:"Differential Pair"};A.publish("openMainDialog",{cmd:5,data:{option:n,tool:this}});break}case"GAP_STEP_VALUE":A.publish("openMainDialog",{cmd:37,data:{tool:this,stepSize:this.stepSize}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"INHERIT_NET":this.handleChangeSelectedNet(i[1]);break}}getPathList(e){return this.wireCommands=new Br,this.commands=new ve("wire"),new ku(e.model).generateList(),xt.getInstance().getNode(e.model)}moveInit(){var e,r;(e=this.wireResult)==null||e.command.undo(),(r=this.wireCommands)==null||r.undo(),ji.getInstance().view4Status(_r.getInstance().current),this.wireCommands=new Br,this.pathList_P=this.pathNode_P.parent,this.pathList_N=this.pathNode_N.parent,this.wireResult=null,this.init=!0}moveEnd(){let e=ji.getInstance().view4Status(_r.getInstance().current);this.wireCommands.addCommand(e),hi.getInstance().update(),this.init=!1,this.updateNetLengthMsg({net:this.targetTrack.net,restrictLength:this.restrictLength,netLengthAtBeginning:this.netLengthAtBeginning,additionalLength:this.additionalLength,showNetLength:!0})}getMaxLengthChange(e,r,i,n,s,a,l,c,h,u,d){if(!this.restrictLength||isNaN(this.additionalLength))return null;if(this.addedTo){let m=parseFloat(this.addedTo)/10-ze.getNetLength(this.targetTrack.net);this.additionalLength=m>0?m:0}return this.additionalLength-this.baseLineLengthChange(e?r:i,e?n:s,e?a:l,c,h,this.targetTrack.width,Nc.type!="line90",u,d!=e)}draw(e){if(Yr.pause){Yr.play4Next();return}Yr.replay?e=Yr.position||e:Yr.position=e,Yr.init(),Ra.getInstance().clear(),Es.getInstance().clear(),Os.getInstance().clear();let r=!1,{targetTrack:i,startPoint:n,type:s,minHeight:a,width:l,isSingleSide:c}=this;l+=this.diffPairSpacing;let h=this.targetTrack.net===this.pathNode_P.item.net,u=this.pathList_P.getAllItems().indexOf(this.pathNode_P.item),d=this.pathList_N.getAllItems().indexOf(this.pathNode_N.item),p=this.pts_P[u],m=this.pts_N[d];if(!p.direct||!m.direct){let k=this.pathList_P.getAllItems(),V=this.pathList_N.getAllItems();k.forEach((Y,X)=>this.pts_P[X].direct=Y.direct),V.forEach((Y,X)=>this.pts_N[X].direct=Y.direct)}let g=p.direct,y=m.direct;if(!(Math.abs(g.cross(y))<1e-4))return;let b=e.sub(n).dot(g),P=e.sub(n).dot(y),T=this.pts_P,I=this.pts_N,C=!1,E=!1;b<0&&(C=!0,T=this.reverse(this.pts_P),u=T.length-u-1,p=T[u],g=p.direct),P<0&&(E=!0,I=this.reverse(this.pts_N),d=I.length-d-1,m=I[d],y=m.direct);let O=this.convertRectRegionInfo(n,e,h?g:y),{directX:_,directY:R}=O;if(_.x==0&&_.y==0||R.x==0&&R.y==0)return;let{length:v,resultIndex_P:D,resultIndex_N:w}=this.calculateAdjustIndexAndLengthForDiffPair(T,I,Math.abs(b),u,d,_),F=this.startPoint_N.sub(this.startPoint_P),H=_.rotate(new S(0,0),Math.PI/2).dot(F)>0,z=new $C(!1,!0,this.diffPairSpacing),{shapes:G,command:W}=this.selfBlockTracks(T,I,u,d,D,w),L=this.getMaxLengthChange(h,T,I,u,d,D,w,_,R,n,H),{paths:B,templates:N}=z.draw(O,v,s,a,l,i.width,c,this.pathNode_P,G,L,H,this.pathNode_N);if(W.undo(),tr.getInstance().mode==="WIRING_MODE_PUSHAWAY"){let{pathChange:k,resultPath:V}=this.pushAwaySnakeTrack(B);k&&(B=this.generateDiff(V,_))}let U=[];[I,T].forEach((k,V)=>{let Y=new Array,X=B[H?(V+1)%2:V],Z=F.dot(R)<0;if(X.length>0){let ae=V==0?d:u,he=V==0?w:D,re=V==0?m:p,se=k[he],K=V==0?this.pathNode_N:this.pathNode_P,me=X[0].start(),Oe=X.slice(-1)[0].end(),ue=B[H?V:(V+1)%2].slice(-1)[0].end(),Pe=Math.max(Oe.sub(this.startPoint).dot(_)),j=Math.max(ue.sub(this.startPoint).dot(_));if(ne.less(Pe,j)){let ke=Oe.add(_.mul(j-Pe));Y.push(new M(Oe,ke)),Oe=ke}let J=new As;for(;v>Math.max(Pe,j);){let ke=this.create4Path([new M(Oe,Oe.add(_.mul(v-Math.max(Pe,j))))],K),Yt=[];for(let Ut=0;Ut<ke.length;Ut++){let ar=ke[Ut],Fe=J.block(ar);Yt.push(...Fe)}if(Yt.length>0){let Ut=this.getBlockMin(Yt,this.startPoint,_);Math.abs(v-Ut)<=.001&&(Ut=Math.max(Ut-this.width/2,0)),v=Ut}else break;ke.forEach(Ut=>An.getInstance().delete(Ut,Ut.globalIndex))}v=Math.max(Pe,j,v);let oe=this.startPoint.add(_.mul(v)),pe=V==1?I:T,ge=V==1?w:D,Se=pe[ge],De=se.end().sub(Oe).dot(R),tt=Se.end().sub(ue).dot(R),Ze;if(!ne.eq(De,0)&&!ne.eq(tt,0)&&De*tt>0){let ke=(De<0==Z==(V==0)?-1:1)*this.diffPairSpacing/2,Yt=oe.add(_.mul(ke));Ze=new M(Yt,Yt.add(R))}else Ze=new M(oe,oe.add(R));let Wt=new M(Oe,Oe.add(_)),Nr=Tt($C.lengthen(Wt),$C.lengthen(Ze)),Lr;Nr>0?Lr=new S(Ee[0],Ee[1]):Lr=me.add(_.mul(v));let Dr=he,Rr;for(let ke=ae;ke<=he;ke++){let Yt=k[ke],Ut=new M(Lr,Lr.add(R.mul(-1))),ar=$C.lengthen(Ut);if(Tt(Yt,ar)){Dr=ke,Rr=new S(Ee[0],Ee[1]);break}}if(Rr){V==0?(w=Dr,he=Dr):(D=Dr,he=Dr);let ke=se.start().sub(me),Yt=R.mul(ke.dot(R)),Ut=Lr.add(Yt),ar=k.slice(0,ae),Fe=k.slice(he+1,k.length),it=Zu.foot(re,me),ye=new M(re.start(),it),bt=new M(it,me),zt=[ye,bt];s!=="line90"&&(zt=IN(zt,i.width,Math.sqrt(2)));let de=Array.from(Y);Y=[].concat(ar,zt),Re.addAll(Y,X),Y=Y.concat(de);let qe=k[Dr],lt=new M(Oe,Lr),Ne=new M(Lr,Rr),et=new M(Rr,qe.end()),At=[lt,Ne,et];s!=="line90"&&(At=IN(At,i.width,Math.sqrt(2))),Y.push(...At),Re.addAll(Y,Fe)}else{let ke=se.start().sub(me),Yt=R.mul(ke.dot(R)),Ut=Lr.add(Yt),ar=k.slice(0,ae),Fe=k.slice(he+1,k.length),it=Zu.foot(re,me),ye=new M(re.start(),it),bt=new M(it,me),zt=[ye,bt];s!=="line90"&&(zt=IN(zt,i.width,Math.sqrt(2)));let de=Array.from(Y);Y=[].concat(ar,zt),Re.addAll(Y,X),Y=Y.concat(de);let qe=new M(Oe,Lr),lt=new M(Lr,Ut),Ne=new M(Ut,se.end()),et=[qe,lt,Ne];s!=="line90"&&(et=IN(et,i.width,Math.sqrt(2))),Y.push(...et),Re.addAll(Y,Fe)}}else Re.addAll(Y,k);let Q=V===0?P:b;U[V]=Q<0?this.reverse(Y):Y}),U.forEach((k,V)=>{let Y=V===0?this.pathList_N:this.pathList_P,X=V===0?this.pathNode_N:this.pathNode_P,Z=V===0?d:u,Q=V===0?w:D,ae=V===0?E:C;this.updateTrack(k,Y,X,Z,Q,ae)}),this.showRectHelpLine(this.startPoint,e,this.targetTrack.direct)}selfBlockTracks(e,r,i,n,s,a){let l=[],c=new Br;return(tr.getInstance().mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"||tr.getInstance().mode=="WIRING_MODE_SURROUND"||tr.getInstance().mode=="WIRING_MODE_OBSTRUCT")&&(this.getBlockTrack(e,i,s,this.pathNode_P,l,c),this.getBlockTrack(r,n,a,this.pathNode_N,l,c)),{shapes:l,command:c}}createCollideTrack(e,r,i,n){return new ri().createTrack(this.track_N.item.layerId,e.start(),e.end(),i,r,n)}createArcCollideTrack(e,r,i,n){return new ri().createArcTrackByArc(this.track_N.item.layerId,e,i,r,n)}getRandomNet(e,r="id"){for(let i=0;i<100;i++){let n=`tempNet-${r}-${Math.random()*1e16}-${Date.now()}`;if(!e.has(n))return n}return""}getBlockTrack(e,r,i,n,s,a){let l=r,c=Math.max(r,i),h=e.slice(0,l),u=e.slice(c+1,e.length),d=[].concat(h,u),p=new Set(ze.getAllNets()),m=this.getRandomNet(p,"prePath");for(let g of d){let y;if(g instanceof M)y=this.createCollideTrack(g,m,n.item.width,a);else if(g instanceof q)y=this.createArcCollideTrack(g,m,n.item.width,a);else throw new Error("not support others!!!!");s.push(y)}return d}generateDiff(e,r){let i=e[0].start(),n=e[e.length-1].end(),s=[-1,1].map((l,c)=>{let h=new M(i,i.add(r)),u=new M(n,n.add(r)),d=[].concat([h],e,[u]);return d=d.filter(p=>p.length()>0),d.map(p=>p.panDistance(l*this.diffPairSpacing/2))}),a=[[],[]];return s.forEach((l,c)=>{let h=a[c];for(let u=1;u<l.length;u++){let d=u==1?l[0]:h[u-1],p=l[u];if(d instanceof q&&p instanceof M)h[u]=new M(d.end(),p.end());else if(d instanceof M&&p instanceof q)h[u-1]=new M(d.start(),p.start()),h[u]=p;else if(d instanceof M&&p instanceof M)if(Tt($C.lengthen(d),$C.lengthen(p))>0){let g=new S(Ee[0],Ee[1]);h[u-1]=new M(d.start(),g),h[u]=new M(g,p.end())}else h[u]=p;else h[u]=p}h.shift(),h.pop()}),a}reverse(e){let r=new Array(e.length);for(let i=0,n=e.length-1;n>=0;i++,n--){let s=Hp(e[n]);r[i]=s}return r}convertRectRegionInfo(e,r,i){let n=r.sub(e),s=new S(-i.y,i.x),a=i.dot(n),l=s.dot(n),c=i.mul(a).normalize(),h=s.mul(l).normalize(),u=Math.abs(a),d=Math.abs(l),p=e.add(c.mul(u)),m=e.add(h.mul(d));return{start:e,endX:p,end:r,endY:m,directX:c,directY:h,width:u,height:d}}calculateAdjustIndexAndLengthForDiffPair(e,r,i,n,s,a){let l=0,c=n,h=s,u=n,d=s;do{let p=e[c],m=r[h];for(;!(p instanceof M&&Math.abs(p.direct.cross(a))<1e-4)&&c<e.length-1;)c++,p=e[c];for(;!(m instanceof M&&Math.abs(m.direct.cross(a))<1e-4)&&h<r.length-1;)h++,m=r[h];if(!(p instanceof M&&Math.abs(p.direct.cross(a))<1e-4)||!(m instanceof M&&Math.abs(m.direct.cross(a))<1e-4))break;let g=p.start().sub(this.startPoint_P).dot(a),y=p.end().sub(this.startPoint_P).dot(a)-this.diffPairSpacing/2,b=m.start().sub(this.startPoint_N).dot(a),P=m.end().sub(this.startPoint_N).dot(a)-this.diffPairSpacing/2;if(y<b)if(c<e.length-1){c++;continue}else break;if(P<g&&h<r.length-1)if(h<r.length-1){h++;continue}else break;if(i<Math.max(g,b))break;if(i>Math.min(y,P))u=c,d=h,l=Math.min(y,P);else{u=c,d=h,l=i;break}if(y<P)if(c<e.length-1)c++;else break;else if(ne.eq(P,y))c++,h++;else if(h<r.length-1)h++;else break}while(c<e.length-1||h<r.length-1);return{length:Math.max(l,0),resultIndex_P:u,resultIndex_N:d}}showRectHelpLine(e,r,i){let{endX:n,endY:s}=this.convertRectRegionInfo(e,r,i),a=[e,n,r,s,e],l=[];for(let c=1;c<a.length;c++)l.push(new M(a[c-1],a[c]));this.rectHelpLine.forEach(c=>c.remove()),this.rectHelpLine=dP(l,1002);for(let c of this.rectHelpLine)c.color=ee.WHITE}baseLineLengthChange(e,r,i,n,s,a,l,c,h){let u=0;for(let C=r;C<=i;C++)u+=e[C].length();let d=e[r].start(),p=e[i].end(),m=Math.abs(p.sub(d).dot(n)),g=n.rotate(new S(0,0),Math.PI/2).dot(s)>0,y=(h==g?-1:1)*this.diffPairSpacing/2,b=Math.abs(d.sub(c).dot(s)+y),P=Math.abs(p.sub(c).dot(s)+y),T=l?Math.min(Math.max(b/a-Math.sqrt(2),0),1)*(Math.sqrt(2)-2)*a:0,I=l?Math.min(Math.max(P/a-Math.sqrt(2),0),2)*(Math.sqrt(2)-2)*a:0;return m+b+P-u+T+I}create4Path(e,r){let i=new Array;for(let n of e)if(n instanceof M){let s=new qr(`TRACK${Vf.getInstance().getID()}`,r.item.layerId,n.start(),n.end(),r.item.width,!1,r.item.net);i.push(s)}else if(n instanceof q){let s=new Oi(`TRACK${Vf.getInstance().getID()}`,r.item.layerId,n.center,n.rx,r.item.width,n.startAngle*(Math.PI/180),(n.startAngle+n.sweepAngle)*(Math.PI/180),n.isCCW?1:0,!1,r.item.net,1);i.push(s)}return i}getBlockMin(e,r,i){let n=Number.MAX_VALUE;for(let s of e){let a=s.point.sub(r),l=Math.abs(i.dot(a));l<n&&(n=l)}return n}updateTrack(e,r,i,n,s,a=!1){let l=new ri,c=l.createList(),h=i.item,u=r.getAllItems();a&&(n=u.length-n-1,s=u.length-s-1);let d=e.length-(u.length-s);e.forEach((p,m)=>{let g=h.width;m<=n?g=u[m].width:m>=d&&(g=u[m-d+s].width);let y;Fd(p)<1e-8||(p instanceof M?(y=l.createTrack(h.layerId,p.start(),p.end(),g,h.net,this.wireCommands,h.getGroupID()),l.addList(y,c,this.wireCommands)):p instanceof q&&(y=l.createArcTrack(h.layerId,p.center,p.rx,p.startAngle*(Math.PI/180),(p.startAngle+p.sweepAngle)*(Math.PI/180),p.isCCW?1:0,g,h.net,this.wireCommands,void 0,h.getGroupID()),l.addList(y,c,this.wireCommands)))}),c.replace(r.getFirstNode(),r.getLastNode(),r),this.wireCommands.addCommand(new Ti(c))}updateNetLengthMsg(e){let r=[];r.push(new lf(this.pathNode_P.item.net,this.pathNode_P.item.width,this.pathNode_P.item.layerId,this.pathNode_P.item.direct,!1)),r.push(new lf(this.pathNode_N.item.net,this.pathNode_N.item.width,this.pathNode_N.item.layerId,this.pathNode_N.item.direct,!1));let i=new fC(r,[],r[0]);Ap.updateNetLengthMsg2(i,"Differential pair wiring",e)}pushAway(){if(tr.getInstance().mode==="WIRING_MODE_PUSHAWAY"){let r=new Kg;this.wireResult=r;let i=new lf(this.pathNode_N.item.net,this.pathNode_N.item.width,this.pathNode_N.item.layerId,this.pathNode_N.item.direct,!1),n=new lf(this.pathNode_P.item.net,this.pathNode_P.item.width,this.pathNode_P.item.layerId,this.pathNode_P.item.direct,!1);r.setInputStatus(this.pathList_N),r.setInputStatus(this.pathList_P),r.wireMap.set(i,this.pathList_N),r.wireMap.set(n,this.pathList_P);let s=new dg;try{s.level="SUPER",s.inputLevel="NONE",FGe(this.type),s.run(r)}catch(a){throw new Error(a)}}}pushAwaySnakeTrack(e){let{tracks:r,width:i}=this.getMiddleLine(e);if(i<=0)return{resultPath:[],pathChange:!1};let n=new Br,s=new ri,a=s.createList(),l=this.pathNode_N.item;r.forEach(P=>{let T;Fd(P)<1e-8||(P instanceof M?(T=s.createTrack(l.layerId,P.start(),P.end(),i,l.net,n,l.getGroupID()),s.addList(T,a,n)):P instanceof q&&(T=s.createArcTrack(l.layerId,P.center,P.rx,P.startAngle*(Math.PI/180),(P.startAngle+P.sweepAngle)*(Math.PI/180),P.isCCW?1:0,i,l.net,n,void 0,l.getGroupID()),s.addList(T,a,n)))});let c=this.pathList_N,h=this.pathList_P,u=s.createList(),d=s.createList();u.replace(c.getFirstNode(),c.getLastNode()),d.replace(h.getFirstNode(),h.getLastNode()),n.addCommand(new Ti(u)),n.addCommand(new Ti(d));let p=new Kg;this.wireResult=p;let m=new lf(this.pathNode_N.item.net,i,this.pathNode_N.item.layerId,this.pathNode_N.item.direct,!1);p.setInputStatus(a),p.wireMap.set(m,a);let g=new dg(!1,300);try{g.level="SUPER",g.inputLevel="NONE",g.run(p)}catch(P){throw new Error(P)}let b={resultPath:a.getAllItems().map(P=>P.primitive),pathChange:!1};return this.changeHistory(p.command,a,b),n.undo(),b}changeHistory(e,r,i){let n=e.commands,s=n.length;for(let a=s-1;a>=0;a--){let l=n[a];if(l instanceof Br)this.changeHistory(l,r,i);else if(l instanceof Ti){let h=l.list.parentNode.target;r===h&&(i.pathChange=!0,l.undo(),n.splice(a,1))}}}getMiddleLine(e){let r=new Array(2),i=e[0].length,n=e[1].length;if(!i||!n)return{paths:e,width:0};if(e[0].length!==e[1].length)return{paths:e,width:0};let s=e[0].length,a=[],l=0;for(let c=0;c<s;c++){let h=e[0][c],u=e[1][c];if(c===0){let p=new Zu(new M(h.start(),h.start()),u),m=new Zu(new M(u.start(),u.start()),h),g=p.getDistance(),y=m.getDistance();l=(g<=y?g:y)+this.track_N.width/2+this.track_P.width/2}let d;if(h instanceof M&&u instanceof M){let p=h.start().add(u.start()).mul(.5),m=h.end().add(u.end()).mul(.5);if(d=new M(p,m),c!==0){let g=a[a.length-1];if(g instanceof M){let y=g.direct;d.direct.dot(y)>.99&&p.equals1(g.end())&&(d=new M(g.start(),m),a.pop())}}}else if(h instanceof q&&u instanceof q){let p=(h.rx+u.rx)/2,m=(h.ry+u.ry)/2;d=q.build2(h.center,h.startAngle,h.startAngle+h.sweepAngle,p,m,h.sweep())}a.push(d)}return{tracks:a,width:l}}rightClickMenuData(e){var s;let r=(s=this.targetTrack)==null?void 0:s.net,i=!1;if(r){let a=te.getInstance().getNet(r);a!=null&&a.netDifferential!=null&&(i=!0)}let n={state:"show",left:e.mouseX,top:e.mouseY,filter:Jpe(e.adsorb,i).result};Qt.getInstance().menuData(n,this)}updateNetLengthRuleInDialog(){var a;let e=(a=this.targetTrack)!=null&&a.net?this.targetTrack.net:"",r=te.getInstance().getNetLengthPhysicsByNet(e),i=r.netLengthMin*10,n=r.netLengthMax*10,s="updateNetLengthRule";A.publish("pcbdialogModify",{dialogType:"equal-length-tuning",action:s,netLengthMin:i,netLengthMax:n})}};Nc.init=!1,Nc.isSingleSide=!0,Nc.type="line45",Nc.width=6,Nc.minHeight=1,Nc.stepSize=1,Nc.restrictLength=!1,Nc.additionalLength=0;var $w=Nc;var Qpe=class extends ko{constructor(){super();this.selections=new Array;this.mouseLeftX=0;this.mouseLeftY=0;this.commandFactory=new mi;this.drawing=!0}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onMouseLeftUp(e);break}ie.publish("updateFrame","")}onMouseLeftDown(e){}onMouseMove(e){let r=e.sceneX,i=e.sceneY;this.selections.length>0&&this.drawing?(this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(r,this.mouseLeftY),this.selections[1].start=new S(r,this.mouseLeftY),this.selections[1].end=new S(r,i),this.selections[2].start=new S(r,i),this.selections[2].end=new S(this.mouseLeftX,i),this.selections[3].start=new S(this.mouseLeftX,i),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY)):this.drawing&&jt.update(e,"Please select an area")}onMouseLeftUp(e){let r=ce.themeConfig.canvasTheme,i=r.isSolidLine(r.selectBoxLineStyle),n=r.selectBoxColor;if(this.selections.length==0){Mn.getInstance().allowPull=!1;let s=e.sceneX,a=e.sceneY;this.mouseLeftX=s,this.mouseLeftY=a,this.selections.push(new hr(1002,new S(this.mouseLeftX,this.mouseLeftY),new S(s,this.mouseLeftY),i,n)),this.selections.push(new hr(1002,new S(s,this.mouseLeftY),new S(s,a),i,n)),this.selections.push(new hr(1002,new S(s,a),new S(this.mouseLeftX,a),i,n)),this.selections.push(new hr(1002,new S(this.mouseLeftX,a),new S(this.mouseLeftX,this.mouseLeftY),i,n)),jt.cancel()}else{let s=Ve.getSelects();s=s.slice(0),this.commandFactory.createGroup("modify by select arrange");let[a,l]=this.getCursor(this.selections),c=s.filter(h=>h instanceof Me);ls.getInstance().init(c,"flip to OppositeLayer",(h,u)=>{this.arrange(h,a,l),ie.publish("onlySelect",h),h.map(d=>d.click()),this.commandFactory.execute();for(let d of this.selections)d.remove();this.selections.length=0,ie.publish("updateCrossDirect",e)})}}getCursor(e){let r=e[0],i=r.start,n=r.end;for(let s=1;s<e.length;s++){r=e[s];let a=r.start,l=r.end;ne.greatereq(i.x,a.x)&&ne.lesseq(i.y,a.y)&&(i=a),ne.greatereq(i.x,l.x)&&ne.lesseq(i.y,l.y)&&(i=l),ne.lesseq(n.x,a.x)&&ne.lesseq(n.y,a.y)&&(n=a),ne.lesseq(n.x,l.x)&&ne.lesseq(n.y,l.y)&&(n=l)}return[i,n]}arrange(e,r,i){let n={};for(let s of e)if(s instanceof Me){let l=s.model.buildBBox().height(),c=n[l],h=s.footprintId;c?c[h]?c[h].push(s):c[h]=[s]:(n[l]={},n[l][h]=[s])}this.greedy(n,r,r,i)}greedy(e,r,i,n){if(Object.keys(e).length===0)return;let s=0,a=0,l=null,c=null,h=null;for(let u in e){let d=e[u];for(let p in d)if(d[p]instanceof Array){let m=d[p][0],g=parseFloat(u),b=m.buildBBox().width();(ne.greater(g,s)||ne.eq(g,s)&&ne.greater(b,a))&&(s=g,a=b,l=d[p],c=u,h=p)}}delete e[c][h],Object.keys(e[c]).length===0&&delete e[c];for(let u of l){let d=u.buildBBox(),p=d.width(),m=d.height(),g=u.position.x-d.minX,y=d.maxY-u.position.y,b=Di.convert(.05,39.37,1);this.commandFactory.addCommand4Item(u,"modify"),n.x>i.x&&Math.abs(n.x-i.x)>=p?(u.position=new S(i.x+g,i.y-y),i===r&&(r=new S(r.x,r.y-m-b)),i=new S(i.x+p+b,i.y)):(u.position=new S(r.x+g,r.y-y),i=new S(r.x+p+b,r.y),r=new S(r.x,r.y-m-b),n=new S(n.x,n.y-m-b))}this.greedy(e,r,i,n)}interrupt(){for(let e of this.selections)e.remove();this.selections.length=0,this.drawing=!1,jt.cancel(),Mn.getInstance().allowPull=!0}cancel(){this.interrupt(),ie.publish("tool","dropdrag");let e=Ve.getSelects();Pr.model=e.length>1?1:0}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":e.ctrlKey?this.cancel():this.rightClickMenuData(e);break;case"rightClick":e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vo(e.adsorb)};Qt.getInstance().menuData(r,this),jt.cancel(),this.drawing=!1}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":ie.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":ie.publish("openSystemDialog","ADSORPTION",$());break}ie.publish("updateFrame","")}};var e0e=class extends ci{constructor(t,e){super(),this.tool=t,this.lastTool=e}execute(t){ls.getInstance().init(t.refer.items,t.commandFactory||t.command,(e,r,i)=>{this.tool.interrupt(),t.refer.items=e,ce.pcbConfig.snapToOriginWhileDragFootprint&&e.length==1&&e[0]instanceof Me&&t.from=="move-lock"&&(t.refer.referX=e[0].position.x,t.refer.referY=e[0].position.y),A.publish("select",e);let n=ce.pcbConfig.isPlaceViasAutoShove||ce.pcbConfig.moveComponent=="push"||ce.pcbConfig.moveComponent=="block"?new NU(t.refer,t.menu,r,t.isContinuousMode||!1,i):new Gw(t.refer,t.menu,r,t.isContinuousMode||!1,i);A.publish("resetToolLastCmd",""),yi.setPlace(),this.tool.setNextTool(n),t.command=="batchMoveItem"&&t.pcbPlaceTransfer&&n.setPcbPlaceTransfer(t.pcbPlaceTransfer)})}interrupt(){this.lastTool!=null&&this.lastTool.interrupt()}};var J$={align_left:"selectRefObjectForAlignLeft",align_right:"selectRefObjectForAlignRight",align_top:"selectRefObjectForAlignTop",align_bottom:"selectRefObjectForAlignBottom",align_vertical_center:"selectCenterObjectForVertical",align_horizontal_center:"selectCenterObjectForHorizontal",selectRefObjectForAlignLeft:"align_left",selectRefObjectForAlignRight:"align_right",selectRefObjectForAlignTop:"align_top",selectRefObjectForAlignBottom:"align_bottom",selectCenterObjectForVertical:"align_vertical_center",selectCenterObjectForHorizontal:"align_horizontal_center"};function t0e(o,t){let e=new Jt;return e.add("CANCEL",!0),e.addExtend("ROTATE",i1()),e.addExtend("FLIP",Ob()),e.add("TURNOVER",!0),e.add("toggleAdsorb",!1,t),e.add("ADSORBENT_CONFIG"),e}var r0e=class extends ci{constructor(e){super();this.placing=!1;this.unCheckingEnableLayer=!1;this.start(),this.pcbModule=e}get groups(){var e;return((e=this.tool)==null?void 0:e.group)||[]}set groups(e){this.tool!=null&&this.tool.cancel(),this.tool=new ep(e),this.tool.recordStyle()}async hasItems(){for(let e in this.pcbModule){let r=this.pcbModule[e],i=new g_;if(await i.parseTemplate(r),i.hasItems())return!0}return!1}async getInstance(){this.placing=!0,this.groups.length=0;let r=new _e,i=new Array;this.filterItems.clear();let n=new Map,s=new Map,a=new Set;for(let l in this.pcbModule){let c=this.pcbModule[l],h=new g_;await h.parseTemplate(c);let u=h.copy(l,!0);A.publish("AutoServiceClear","");let d=u.buildBBox(),p=u.getItems(),m=l,g=p.filter(y=>!(y instanceof Me));for(let y of g)a.add(y.layerId);n.set(m,{items:p,group:u,bbox:d,decoder:h}),s.set(m,p)}if(!this.unCheckingEnableLayer){let l=await nae(s,(c,h)=>{let u=n.get(h);return u?u.decoder.getBasicLayerTable(c):{}});this.unCheckingEnableLayer=!0;for(let[c,h]of l){let u=n.get(c);u&&(u.items=h)}}for(let l of n.values()){let{items:c,group:h,bbox:u}=l;for(let d of c)this.filterItems.add(d);if(ce.pcbConfig.autoDesignator){let d=new Set;for(let p of c)p instanceof Me&&d.add(p);MAe(d)}Re.addAll(i,c),i.push(h),r.ext1(u)}this.tool=new ep(i),this.bbox=r.build1(),A.publish("onlySelect",this.groups),this.tool.recordStyle(),this.placing=!1}onKeyDown(e){if(e.keyCode===32){if(this.groups.length>0){let i=this.bbox.center();this.tool.rotateFor(i,ce.pcbConfig.rotate)}}else e.keyCode===9?A.publish("openMainDialog",{cmd:23,data:{option:{unit:x.getInstance().unit}}}):e.keyCode===27&&this.cancel();switch(sr.getAction(5,e)){case"Cancel":this.cancel();break;case"Flip Right and Left":{this.turn("turnAround");break}case"Flip Up and Down":{this.turn("turnUpsideDown");break}}A.publish("updateFrame","")}async onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(this.groups.length>0){this.moveTo(r),this.tool.complete();for(let n of this.groups)A.publish("hasModifyPcbItem",n);A.publish("onlySelect",this.groups);let i=new mi;i.createGroup("Place Pcb module");for(let n of this.groups)i.addCommand4Item(n,"add");i.execute(),this.uploadPlacePcbLog(),A.publish("flushService",""),A.publish("clearSelect",""),await this.getInstance(),this.moveTo(r),A.publish("updateFrame",""),this.drawing=!0}}async onMouseMove(e){if(this.placing)return;let r=new S(e.sceneX,e.sceneY);this.drawing&&(this.groups.length>0?this.moveTo(r):await this.getInstance())}moveTo(e){if(this.groups.length>0){let r=this.bbox.center(),i=e.sub(r),n=Ae.translate(i.x,i.y,0);this.tool.transform(n),this.bbox=this.bbox.transform(n.toMatrix3())}}interrupt(){if(this.groups.length>0){for(let e of this.groups)e.remove(),A.publish("delete",e);this.tool.cancel(),this.groups.length=0,this.drawing=!1,this.unCheckingEnableLayer=!1,A.publish("clearSelect",""),A.publish("updateRtree","")}this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:t0e(this.groups,e.adsorb).result};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"ROTATE":this.rotate(i[1]);break;case"FLIP":i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"?this.turn("turnUpsideDown"):i[1]=="FLIP_LEFTANDRIGHT_BY_REFER_POINT"?this.turn("turnAroundByReferPoint"):i[1]=="FLIP_UPANDDOWN_BY_REFER_POINT"&&this.turn("turnUpsideDownByReferPoint");break;case"TURNOVER":{J_(!1);break}}A.publish("updateFrame","")}rotate(e){let r=this.bbox.center();if(e==="rotate_left"&&this.tool.rotateFor(r,ce.pcbConfig.rotate),e==="rotate_right"&&this.tool.rotateFor(r,-ce.pcbConfig.rotate),e==="rotate_reference_point"){let i={x:r.x,y:r.y,items:this.tool,executeCommand:!1};ao.rotateAssignReferPoint(i,this,null,null,this.rotateReferPointCallback.bind(this))}}turn(e){var n;Yo.setTool(this),(n=this.tool)==null||n.sycn();let r=this.bbox.center(),i=this.groups.filter(s=>!(s instanceof Ph));switch(e){case"turnAround":Yo.turn(i,!1,!1,r);break;case"turnUpsideDown":Yo.turn(i,!0,!1,r);break;case"turnAroundByReferPoint":{let s={items:i};Yo.turnByReferPoint(s,this);break}case"turnUpsideDownByReferPoint":{let s={items:i,isTurnUpsideDown:!0};Yo.turnByReferPoint(s,this);break}}}rotateReferPointCallback(e,r,i,n){let s=this.bbox.center(),a=new Mt(Ma.x-s.x,Ma.y-s.y,0),l=Ae.translate1(a);this.tool.transform(l),this.bbox=this.bbox.transform(l.toMatrix3()),ah.realtimeCheckItems(this.groups),this.rotateReferPointCallback=null}uploadPlacePcbLog(){for(let e in this.pcbModule){let{uuid:r,projectId:i}=this.pcbModule[e];A.windowBridge.publish("addUploadPlaceLibLog",{uuid:r,path:i,lib_type:4},$())}}};function MAe(o){let t=new Map,e=new Set;for(let r of o)if(r.attrsMap["Reuse Block"]){let i=`${r.attrsMap["Reuse Block"]}_${r.attrsMap["Group ID"]}`;t.has(i)||t.set(i,new Set),t.get(i).add(r)}else e.add(r);t.size?Cr.placeCBBAutoSuffix(t,o):e.size&&Cr.autoDesignator(e)}var i0e=class extends ci{constructor(){super();this.ratline=null;this.pad1=null;this.mouseRightDown=!1;this.isNeedCancel=!0;this.drawing=!0,jt.update(Pi.getInstance(),"Please select a Pad")}onKeyDown(e){switch(sr.getAction(4,e)){case"Cancel":this.cancel();break}}onEnterPlace(e){this.onMouseLeftDown(e)}onMouseLeftDown(e){let r=Wr.selectPadCenter(e.realSceneX,e.realSceneY);if(r&&r instanceof Le)if(this.start(),this.pad1){let i=new ve("connect pads"),n=this.pad1.net,s=r.net;if(n&&s){if(n==s){this.interrupt();return}A.windowBridge.rpcCall("connectPadsToMergeNet",[[n,s]],$()).then(a=>{if(a.message.action=="ok"){let l=a.message.selectedVal,c=n==l?s:n,h=ze.getSameNetItems(c);for(let u of h)(u instanceof Le||u instanceof Ue||u instanceof Ge)&&(i.addCommand(Te.dispatch(u,"modify")),A.publish("hasModifyPcbItem",u),u.net=l,A.publish("hasModifyPcbItem",u));je.executeCommand(i),A.publish("flushService","")}})}else if(!n&&!s){let a=this.getAutoAssignNet(this.pad1,r);for(let l of[this.pad1,r])i.addCommand(Te.dispatch(l,"modify")),A.publish("hasModifyPcbItem",l),l.net=a,A.publish("hasModifyPcbItem",l)}else n?(i.addCommand(Te.dispatch(r,"modify")),A.publish("hasModifyPcbItem",r),r.net=n,A.publish("hasModifyPcbItem",r)):(i.addCommand(Te.dispatch(this.pad1,"modify")),A.publish("hasModifyPcbItem",this.pad1),this.pad1.net=s,A.publish("hasModifyPcbItem",this.pad1));je.executeCommand(i),this.interrupt(),A.publish("flushService",""),this.end()}else this.pad1=r}onMouseLeftUp(e){}onMouseRightDown(e){this.mouseRightDown=!0}onMouseRightUp(e){if(!this.isNeedCancel){this.isNeedCancel=!0;return}e.openMenu&&(this.ratline?this.interrupt():this.cancel())}onMouseMove(e){if(this.drawing){if(super.onMouseMove(e),e.rightDown&&(this.isNeedCancel=!1),this.pad1){this.ratline!=null&&this.ratline.remove();let r=new Rd(this.pad1.center),i=new Rd(new S(e.realSceneX,e.realSceneY));this.ratline=new hr(57,r.point,i.point,!0)}jt.update(e,"Please select a Pad")}}rightClickMenuData(e){}cancel(){this.interrupt(),jt.cancel(),A.publish("tool","dropdrag")}interrupt(){this.pad1=null,this.ratline&&(this.ratline.remove(),this.ratline=null),this.end()}getAutoAssignNet(e,r){let i=ze.getAllNets(),n=[],s="",a=e,l=r;if(a&&a instanceof Le||l&&l instanceof Le){let c=a==null?void 0:a.getParent(),h=l==null?void 0:l.getParent(),u=c&&c.designator.toUpperCase(),d=h&&h.designator.toUpperCase(),p=a&&`${ur.toUpperCase()}${a==null?void 0:a.number}`,m=l&&`${ur.toUpperCase()}${l==null?void 0:l.number}`;if(u&&d){let g=[u,d].sort((y,b)=>this.sortRule(y,b,!0));s="$"+g[0]+"_"+(g[0]==u?a.num:l.num)}else!u&&!d?a instanceof Le&&l instanceof Le?s="$"+[p,m].sort((y,b)=>this.sortRule(y,b,!1))[0]:a instanceof Le?s="$"+p:l instanceof Le&&(s="$"+m):(u&&(s="$"+u+"_"+a.num),d&&(s="$"+d+"_"+l.num))}else i.forEach(c=>{c.includes("S$")&&n.push(Number(c.split("S$")[1]))}),n.length?(n=n.sort((c,h)=>c-h),s="S$"+(n[n.length-1]+1)):s="S$1";return s}sortRule(e,r,i){var n=/[^a-zA-Z]/g,s=/[^0-9]/g,a=parseInt(e,10),l=parseInt(r,10);if(isNaN(a)&&isNaN(l)){var c=i?e.replace(n,""):e.replace(s,""),h=i?r.replace(n,""):r.replace(s,"");if(c===h){var u=parseInt(i?e.replace(s,""):e.replace(n,""),10),d=parseInt(i?r.replace(s,""):r.replace(n,""),10);return u===d?0:u>d?1:-1}else return c===""?1:h===""?-1:c>h?1:-1}else return isNaN(a)?1:isNaN(l)?-1:a>l?1:-1}parse(e){}};function Dqe(o){let t=new Jt;return t.add("CANCEL"),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var n0e=class extends c1{constructor(){super()}onMouseLeftUp(t){this.start();let e=t.sceneX,r=t.sceneY;Ve.selectedConnectedCopper(e,r,t.ctrlKey)}onMouseRightUp(t){if(t.openMenu){if(ce.pcbConfig.endDrawing=="ctrl+rightClick"){if(!t.ctrlKey){this.rightClickMenuData(t);return}}else if(t.ctrlKey){this.rightClickMenuData(t);return}this.cancel()}}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:Dqe(t.adsorb)};Qt.getInstance().menuData(e,this),this.drawing=!1}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}interrupt(){this.end(),this.drawing=!1}cancel(){this.interrupt(),A.publish("tool","dropdrag")}};var YU=class YU extends ci{constructor(){super();this.widthFollowRule=!1;this.event=new Hu;this.started=!1;this.shouldSplit=!1;switch(this.lineType="Line",this.event=new Hu,we.drawing=!0,this.event._width=al.getInstance().getTrackWidth().value||rt.defaultOutlineWidth,this.resultEvent=new bg(this.lineType),this.resultEvent.shouldAddHistory=!1,this.event.needClose=!1,this.event.drawScene="Split Line",tr.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent,this.lineType);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent,this.lineType);break}this.event.commands=new ve("draw 2DLine - "+this.lineType),jr.addDrawTool(this),Ua.changeTool(this),YU._readyType=this.lineType}static get readyType(){return this._readyType}get isShowProfileView(){return!0}get needClear(){return tr.getInstance().type!=="WIRING_CORNER_ARC"}getCanUndo(){return!0}initSplitUtils(e){this.splitUtils=new mue(e)}onKeyDown(e){let r=sr.getLocalAction(["decrease_routing_width","increase_routing_width","Undo","Redo"],e);switch(r||(r=sr.getAction(4,e)),r){case"changeRoutingAngle":case"Routing Corner":let i=jr.getNextType();if(this.wireCorner(i),i==="WIRING_CORNER_FREEANGLE"||i==="WIRING_CORNER_ARC"){let s=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(s)}else dt.destroy();Hi();break;case"Switch Common Track Width":(this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline")&&this.showCommonTrackWidthMenu(e);break;case"Change Track Width While Routing":tr.getInstance().type!=="WIRING_CORNER_FREEANGLE"&&(this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline")&&A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"decrease_routing_width":{let a=this.event._width-.2;a>=.1&&this.setWireWidth(a)}break;case"increase_routing_width":{let a=this.event._width+.2;this.setWireWidth(a)}break}if(r==="Cancel")this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel();else if(r==="Finish")this.next(e);else if(r==="Undo"){let i=je.stack.description=="Execute Clip Polyline"&&je.stack.length>0;A.publish("undo",""),i&&(this.splitUtils.selectedItems=new Array)}else r==="Redo"?A.publish("redo",""):(r=="Filp Path While Drawing"&&this.onMouseMove(e,!1),this.drawPolygon.onKeyDown(e),r=="Backspace"&&this.onMouseMove(e),r=="Filp Path While Drawing"&&(this.drawPolygon.clear(),this.onMouseMove(e)))}onMouseLeftUp(e){this.next(e)}next(e){if(dt.editingWhat){dt.editingWhat="";return}if(this.started||(this.started=!0,this.start()),this.dealLocked(e),this.drawPolygon.onMouseLeftUp(e),this.isShowProfileView){d2.clear();let r=[...this.drawPolygon.shape],i=this.drawPolygon.getPreviewOutline().filter(Boolean);i.length&&i.forEach(s=>r.push(s)),r.forEach(s=>{d2.displayPolyline(s.getMathGraphics()),s.hidden()}),this.needClear&&this.drawPolygon.clear();let n=this.splitUtils.getSplitLine();i.length==0&&r.length==0&&n&&(n.forEach(s=>{d2.displayPolyline(s)}),this.shouldSplit=!0)}dt.destroy()}getWidth(){return this.event._width}dealLocked(e){if(typeof dt.lineLockedLength=="number"){let r=dt.startPoint,i=new S(e.sceneX,e.sceneY),n=new S(i.x-r.x,i.y-r.y).normalize(),s=new S(n.x*dt.lineLockedLength,n.y*dt.lineLockedLength);i=new S(s.x+r.x,s.y+r.y),e.sceneX=i.x,e.sceneY=i.y}if(typeof dt.lineLockedAngle=="number"){let r=dt.startPoint,i=new S(e.sceneX-r.x,e.sceneY-r.y),n=o0e(i),s=wqe(i,dt.lineLockedAngle-n);e.sceneX=s.x+r.x,e.sceneY=s.y+r.y}}onMouseMove(e,r=!0){if(this.dealLocked(e),this.drawing){this.drawPolygon.onMouseMove(e);let n=this.drawPolygon.getPreviewOutline().filter(Boolean);this.isShowProfileView&&n.length>0&&(d2.clear(),this.drawPolygon.shape.length>0&&(n=n.concat(this.drawPolygon.shape)),n.forEach(s=>{d2.displayPolyline(s.getMathGraphics()),s.hidden()}),r&&this.needClear&&this.drawPolygon.clear())}let i=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(i)}showFloatingInputBox(e){if(ce.pcbConfig.useDynamicInputBox&&this.started&&this.event.last&&(this.drawPolygon instanceof Bl||this.drawPolygon instanceof hl)){let r=Gf(),i=this.event.last;dt.startPoint=i;let n=i.distance1(e);if(!n)return;let s=Fo(e),a=Fo(i),l=new S(e.x-i.x,e.y-i.y),c=o0e(l);if(this.drawPolygon instanceof Bl||this.drawPolygon instanceof hl&&!this.drawPolygon.hasArc()){let h=c/180*Math.PI,u=new S(i.x+n,i.y);dt.id!=="adsorption"&&(dt.auxiliaryLine1?dt.auxiliaryLine1.update(i,u,n,h):dt.auxiliaryLine1=new Ew(i,u,n,h));let d=9;if(d>=dt.priority){dt.priority=d;let p={data:[{startPoint:i,cursorPoint:e,frameStartPoint:a,frameCursorPoint:s,info:{type:"free",value:Xe(n),unit:x.getInstance().unit}},{startPoint:i,cursorPoint:e,frameStartPoint:a,frameCursorPoint:s,info:{type:"circle",value:c,tagName:"angle"}}],type:"rect",show:!0,frameInfo:r};dt.create(p)}}else if(this.drawPolygon instanceof hl&&this.drawPolygon.hasArc()){let h=this.drawPolygon.getArcAngle(),u=this.event.start,d=this.drawPolygon.getArcEnd(),p=this.drawPolygon.getArcCenter(),m=this.drawPolygon.getArcRadius(),g=this.drawPolygon.getArcStartAngle(),y=this.drawPolygon.getArcEndAngle(),b=this.drawPolygon.getArcSweep();dt.id!=="adsorption"&&(dt.auxiliaryLine2?dt.auxiliaryLine2.update(u,d,p,m/10,g,y,b):dt.auxiliaryLine2=new Ow(u,d,p,m,g,y,b)),dt.id!=="Free Arc"&&dt.destroy();let P=9;if(P>=dt.priority){dt.priority=P;let T={data:[{startPoint:u,center:p,frameStartPoint:a,frameCursorPoint:Fo(p),info:{type:"circle",value:h,tagName:"angle",canNotLock:!0}}],type:"rect",show:!0,frameInfo:r};dt.create(T,"Free Arc")}}}else this.started&&dt.id!=="adsorption"&&dt.destroy()}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l,startPoint:c}=e;if(a){dt.editingWhat=i;return}let h=!1;if((dt.editingWhat||typeof dt.lineLockedLength=="number"||typeof dt.lineLockedAngle=="number")&&(h=!0),dt.editingWhat="",n||s){this.drawPolygon.arc||this.lockUnlock(e);return}let u=this.applyValue(e);l===13&&(u?h?(this.drawPolygon.asMouseLeftUp(u),dt.destroy()):(this.drawPolygon.addShape(u),this.completed()):dt.destroy())}lockUnlock(e){let{value:r,type:i,locked:n,unlocked:s}=e,a=new ft;i==="free"?n?(this.applyValue(e),r=a.conversion(x.getInstance().unit,"mil",r/10),dt.lineLockedLength=r):s&&(dt.lineLockedLength=null):i==="circle"&&(n?(dt.lineLockedAngle=r,this.applyValue(e)):s&&(dt.lineLockedAngle=null))}applyValue(e){let{value:r,type:i,startPoint:n,cursorPoint:s}=e,a=new ft,l,c;if(i==="free")if(r=a.conversion(x.getInstance().unit,"mil",r/10),dt.id==="adsorption"){let h=new S(s.x-n.x,s.y-n.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+n.x,h.y+n.y);if(this.started)c=u;else{this.event.start=u,this.started=!0,this.start();return}}else{let h=new S(this.event.curr.x-this.event.last.x,this.event.curr.y-this.event.last.y).normalize();l=new S(h.x*r,h.y*r),c=new S(l.x+this.event.last.x,l.y+this.event.last.y)}else if(i==="circle"){let h=this.drawPolygon.arc;if(h){let u=h.getStart(),d=h.getEnd(),p=new S((u.x+d.x)/2,(u.y+d.y)/2),m=new S(d.x-u.x,d.y-u.y),g=m.length(),y=g/2/Math.sin(r/2/180*Math.PI),b=g/2/Math.tan(r/2/180*Math.PI),P=m.normalize(),T=new S(-P.y,P.x),I=new S(T.x*b+p.x,T.y*b+p.y);c=new S(-T.x*y+I.x,-T.y*y+I.y)}else{let u=dt.startPoint;s=this.event.curr||s;let d=new S(s.x-u.x,s.y-u.y),p=o0e(d),m=wqe(d,r-p);c=new S(m.x+u.x,m.y+u.y)}}return this.showFloatingInputBox(c),this.event.curr=c,this.drawPolygon.draw(this.event.last,this.event.curr,tr.getInstance().type),this.isShowProfileView&&(d2.clear(),[...this.drawPolygon.shape,...this.drawPolygon.getPreviewOutline()].forEach(u=>d2.displayPolyline(u.getMathGraphics())),this.needClear&&this.drawPolygon.clear()),this.drawPolygon.asClose(c),A.publish("updateFrame",""),c}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.shouldSplit?(this.splitUtils.runSplit(),this.shouldSplit=!1):this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.shouldSplit?(this.splitUtils.runSplit(),this.shouldSplit=!1):this.cancel();break}}}getSplitItems(){var e;return(e=this.splitUtils)==null?void 0:e.selectedItems}splitRelease(){this.splitUtils.clearCache(),this.splitUtils.clearView(),this.splitUtils.clearSubscribe(),this.splitUtils=null}interrupt(){if(this.drawPolygon.interrupt(),dt.destroy(),YU._readyType=null,this.end(),this.started&&this.event.shape.length==0){d2.clear(),this.started=!1;return}this.started=!1,this.splitRelease()}cancel(){let{drawPolygon:e}=this;this.started?this.interrupt():(jr.clearDrawTool(),e.cancel(),YU._readyType=null),dt.destroy(),this.started=!1,this.end()}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){if(this.resultEvent.type==="Fill Region"){let r=be.getLastActiveLayerID(),i=be.getAllPinLayerIds();if(i.includes(e)!==i.includes(r))return be.setActiveLayerId(r)}this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new Eh(this.event,jr,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new fu(this.event,jr,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC":this.drawPolygon=new hl(this.event,jr,this.resultEvent,this.lineType);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Bl(this.event,jr,this.resultEvent,this.lineType);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),tr.getInstance().type=e,we.synchronize()}wireWidth(e){this.drawPolygon.wireWidth(e),A.publish("flushSelectingInfo","")}completed(e){this.drawPolygon.completed(!1,void 0),d2.clear(),e=="CANCEL"?this.splitUtils.clearCache():(this.splitUtils.getSplitLine().forEach(i=>d2.displayPolyline(i)),this.splitUtils.runSplit()),dt.destroy(),this.started=!1,this.shouldSplit=!1,this.end()}backspace(){this.drawPolygon.backspace(),dt.destroy()}wireMode(e){}rightClickMenuData(e){let r=this.event.start!=null,i=this.resultEvent.type==="Line",n={state:"show",left:e.mouseX,top:e.mouseY,filter:o1(tr.getInstance().type,e.adsorb,r,!0,i,this.event._width).result};Qt.getInstance().menuData(n,this),this.drawing=!1}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=lg(this.event._width).result,Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"AUTO_TRIM_SILKSCREEN":A.publish("autoTrimSilkscreen","");break;case"COMPLETE":this.drawPolygon.abortLast=!1,this.completed();break;case"CANCEL":this.event.shape&&this.event.shape.length?(this.drawPolygon.abortLast=!0,this.completed("CANCEL")):this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]),Hi();break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"WIDTH":i[1]==="WIRING_WIDTH"?this.toggleWidth(i[2]):i[1]==="WIRING_WIDTH_COMMONLY_SSETTING"&&A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",$());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",$());break}A.publish("updateFrame","")}toggleWidth(e){if(this.resultEvent.type==="Line"){let r=ce.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit())}}setWireWidth(e){this.wireWidth(e),this.widthFollowRule=!1,we.prevTrackWidth=e,this.onMouseMove(Pi.getInstance()),A.publish("flushSelectingInfo","")}getFirstLine(){if(this.drawPolygon instanceof Eh)return this.drawPolygon.getLine()}};YU._readyType=null;var s0e=YU;function o0e(o){if(o.length()<=0)return 0;let t=new S(1,0),e=Math.atan(o.y/o.x);return e=e/Math.PI*180,o.x<0?e=180+e:o.y<0&&(e=360+e),e}function wqe(o,t){let e=o.length(),r=o0e(o),i=Math.cos((t+r)/180*Math.PI)*e,n=Math.sin((t+r)/180*Math.PI)*e;return new S(i,n)}function Lqe(){let o=[];return x.getInstance().doctype===3&&o.push({text:"Line",value:"Line"},{text:"Board Outline",value:"Board Outline"},{text:"Slot Region",value:"Slot Region"},{text:"Copper Region",value:"Copper Region"},{text:"Fill Region",value:"Fill Region"},{text:"Prohibited Region",value:"Prohibited Region"},{text:"Constraint Region",value:"Constraint Region"},{text:"FPC Stiffener",value:"FPC Stiffener"},{text:"3D Shell - Outline",value:"3D Shell - Outline"},{text:"3D Shell - Top Slot Region",value:"3D Shell - Top Slot Region"},{text:"3D Shell - Top/Bottom Entity",value:"3D Shell - Top/Bottom Entity"}),x.getInstance().doctype===4&&o.push({text:"Line",value:"Line"},{text:"Slot Region",value:"Slot Region"},{text:"Fill Region",value:"Fill Region"},{text:"Prohibited Region",value:"Prohibited Region"},{text:"FPC Stiffener",value:"FPC Stiffener"}),o.length<=0&&o.push({text:"Line",value:"Line"}),o}function a0e(o){let t=1;return Zn.fixLayerOptions(void 0,Zn.createLayerOptionsByType(o)).map(r=>({text:r.text,value:String(r.value)}))}var l0e=class{constructor(){this._primitiveType="Line",this._primitiveTypeList=Lqe(),this._layerList=a0e(this._primitiveTypeList[0].value),this._layerId=this._layerList[0].value,this._lineWidth=1,this._defaultLineWidth=1,this._isKeepNetProfile=!0,this._copyOperationType="ZoomIntByDist",this._zoomDist=1,this._defaultZoomDist=1,this._zoomRatio=2,this._defaultZoomRatio=2,this._isRemoveSourceTarget=!1}get primitiveType(){return this._primitiveType}set primitiveType(t){this._primitiveType=t}get primitiveTypeList(){return this._primitiveTypeList}set primitiveTypeList(t){this._primitiveTypeList=t}get layerId(){return this._layerId}set layerId(t){this._layerId=t}get layerList(){return this._layerList}set layerList(t){this._layerList=t}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t}get defaultLineWidth(){return this._defaultLineWidth}get isKeepNetProfile(){return this._isKeepNetProfile}set isKeepNetProfile(t){this._isKeepNetProfile=t}get copyOperationType(){return this._copyOperationType}set copyOperationType(t){this._copyOperationType=t}get zoomDist(){return this._zoomDist}set zoomDist(t){this._zoomDist=t}get defaultZoomDist(){return this._defaultZoomDist}get zoomRatio(){return this._zoomRatio}set zoomRatio(t){this._zoomRatio=t}get defaultZoomRatio(){return this._defaultZoomRatio}get isRemoveSourceTarget(){return this._isRemoveSourceTarget}set isRemoveSourceTarget(t){this._isRemoveSourceTarget=t}reset(){this.primitiveType="Line",this.primitiveTypeList=[],this.lineWidth=1,this.isKeepNetProfile=!0,this.copyOperationType="ZoomIntByDist",this.zoomDist=1,this.zoomRatio=1,this.isRemoveSourceTarget=!1}toJSON(){return{primitiveType:this.primitiveType,primitiveTypeList:this.primitiveTypeList,layerId:this.layerId,layerList:this.layerList,lineWidth:this.lineWidth,isKeepNetProfile:this.isKeepNetProfile,copyOperationType:this.copyOperationType,zoomDist:this.zoomDist,zoomRatio:this.zoomRatio,isRemoveSourceTarget:this.isRemoveSourceTarget}}};var os=class o extends ZI{static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}constructor(){super(),this._copySpecialParams=new l0e,this._hasSettingResult=!1}get copySpecialParams(){return this._copySpecialParams}set copySpecialParams(t){this._copySpecialParams=t}get hasSettingResult(){return this._hasSettingResult}set hasSettingResult(t){this._hasSettingResult=t}createHeader(t){let e=this.createBaseHeader();return e.id=t,e.action=t,e.tabId=x.getInstance().tabId,e.unit=x.getInstance().unit,e}createBody(t=!1){let e={};return t&&this.copySpecialParams.reset(),e={...e,...this.copySpecialParams.toJSON()},e.lineWidth*=10,e.zoomDist*=10,e.lineWidth=+on(e.lineWidth,3,!1),e.zoomDist=+on(e.zoomDist,3,!1),e.zoomRatio=+on(e.zoomRatio,6,!1),e}handleHeaderUpdate(t){}handleBodyUpdate(t,e){this.updateCommon(t,e),this.updateAttrParam(t,e),A.publish("flushService",""),A.publish("updateFrame","")}updateCommon(t,e){}updateAttrParam(t,e){let r=!1;this.copySpecialParams.primitiveType!==t.primitiveType&&(this.copySpecialParams.primitiveType=t.primitiveType,r=!0),this.copySpecialParams.layerId=t.layerId,this.copySpecialParams.lineWidth=t.lineWidth/10,this.copySpecialParams.isKeepNetProfile=t.isKeepNetProfile,this.copySpecialParams.copyOperationType=t.copyOperationType,this.copySpecialParams.zoomDist=+t.zoomDist/10,this.copySpecialParams.zoomRatio=+t.zoomRatio,this.copySpecialParams.isRemoveSourceTarget=t.isRemoveSourceTarget,this.copySpecialParams.zoomDist=isNaN(this.copySpecialParams.zoomDist)?1:this.copySpecialParams.zoomDist,this.copySpecialParams.zoomRatio=isNaN(this.copySpecialParams.zoomRatio)?1:this.copySpecialParams.zoomRatio,this.copySpecialParams.zoomDist=+on(this.copySpecialParams.zoomDist,4,!1),this.copySpecialParams.lineWidth=+on(this.copySpecialParams.lineWidth,4,!1),this.copySpecialParams.zoomRatio=+on(this.copySpecialParams.zoomRatio,6,!1),this.copySpecialParams.zoomRatio<1e-6&&(this.copySpecialParams.zoomRatio=this.copySpecialParams.defaultZoomRatio),e.unit==="mm"&&(this.copySpecialParams.lineWidth<.0039&&(this.copySpecialParams.lineWidth=Xs.mm2mil(this.copySpecialParams.defaultLineWidth)),this.copySpecialParams.zoomDist<0&&(this.copySpecialParams.zoomDist=Xs.mm2mil(this.copySpecialParams.defaultZoomDist))),e.unit==="mil"&&(this.copySpecialParams.lineWidth<.01&&(this.copySpecialParams.lineWidth=this.copySpecialParams.defaultLineWidth),this.copySpecialParams.zoomDist<0&&(this.copySpecialParams.zoomDist=this.copySpecialParams.defaultZoomDist)),r&&(this.copySpecialParams.layerList=a0e(this.copySpecialParams.primitiveType),this.copySpecialParams.layerId=this.copySpecialParams.layerList[0].value),A.messageBus.publish("copySpecialParamUpdate",null)}};function $Dt(o){return $t.filterElement(Wr.getSelectInside(Ol(o),{boxChoose:!1,isBBox:!0}),{boxChoose:!0})}function KDt(o){return $t.filterElement(Wr.getSelectContect(Ol(o),{boxChoose:!0,isBBox:!0}),{boxChoose:!0})}function Q$(o,t,e){let r=new Set;if(e?r=$Dt(o):r=KDt(o),r=new Set(Wr.filterPartiton(Array.from(r))),os.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||os.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"){let i=ZDt(t,Array.from(r));return new Set([i])}return r}function ZDt(o,t){let e=o,r=o,i=Number.MAX_SAFE_INTEGER,n=null,s=null,a=null;for(let l=0;l<t.length;l++){let c=X_.getMinDistResultAboutDotAndElement(t[l],new M(e,e),"EDGE",os.getInstance().copySpecialParams.layerId);c.minline&&i>=c.minDistValue&&(i=c.minDistValue,n=c.minline.start(),s=c.minline.end(),a=t[l])}return n&&s&&(o.x===s.x&&o.y===s.y?r=n:r=s),a}function c0e(o){let t=Dn.getInstance().getAllItem(),e=Number.MAX_SAFE_INTEGER;for(let r=0;r<t.length;r++)for(let i=0;i<o.length;i++){let n=X_.getMinDistResultAboutElementAndElement(t[r],o[i],"EDGE","EDGE",os.getInstance().copySpecialParams.layerId,os.getInstance().copySpecialParams.layerId);n.minline&&e>=n.minDistValue&&(e=n.minDistValue)}return e}function h0e(o){let t=Af(fe.build2(o.getMathGraphics().primitives),0),e=0;return t.forEach(r=>{r.items.forEach(i=>{e+=i.area()})}),Math.abs(e)}function kN(o,t){let e=t.sub(o),r=ne.eq(e.x,0),i=ne.eq(e.y,0);return r&&i?S.ORIGIN:e.normalize()}var u0e=class{constructor(t){this.start=null;this.end=null;this.pan=null;this.prev=null;this.next=null;this.valid=!0;this.visited=!1;this.primitive=t}updateValid(){if(this.start!=null)if(this.primitive instanceof M){let t=kN(this.start,this.end),e=this.primitive.direct,r=t.dot(e);ne.greatereq(r,0)?this.valid=!0:this.valid=!1}else{if(this.pan==null){this.valid=!1;return}let t=kN(this.start,this.pan.start()),e=Ot(this.primitive,this.primitive.start()),r=t.dot(e);if(ne.greatereq(r,0)){let i=Ot(this.primitive),s=kN(this.pan.end(),this.end).dot(i);ne.greatereq(s,0)?this.valid=!0:this.valid=!1}else this.valid=!1}}panDis(t){if(!(this.start==null||this.primitive==null))if(this.primitive instanceof M)this.pan=new M(this.start,this.end);else{if(ne.lesseq(this.primitive.rx+t,0))return;this.pan=this.primitive.panDistance(t);let e=ne.eq(this.start.distance1(this.pan.center),this.pan.rx)&&vm(this.pan,this.start),r=ne.eq(this.end.distance1(this.pan.center),this.pan.rx)&&vm(this.pan,this.end);e&&(this.pan=bc.modifyStart(this.start,this.pan)),r&&(this.pan=bc.modifyEnd(this.end,this.pan))}}};function JDt(o,t){let e=kN(o,t.start()),r=Ot(t,t.start());return ne.less(e.dot(r),0)}var d0e=class{extends(t,e){vh(t)&&(t=t.reverse());let r=this.getPts(t),i=r.length;if(i>1){for(let h=0;h<i;h++)r[h].start=this.getPoint4Pts(r[h],e),r[h].prev.end=r[h].start;for(let h of r)h.panDis(e),h.updateValid();for(let h of r)if(!h.valid&&h.primitive instanceof q&&h.pan!=null){let u=h.prev;if(!JDt(h.start,h.pan))continue;for(;u!=h;){if(u.valid&&u.primitive instanceof q&&!u.pan.end().equals1(u.end)){let m=new M(u.pan.end(),u.end),g=this.getInters(m,h.pan);if(g!=null&&!g.equals1(h.start)&&(h.start=g,h.panDis(e),h.updateValid(),h.valid))break}let d=u.primitive,p=this.getPointPts(d,h.primitive,e);if(p!=null&&!p.equals1(h.start)&&(h.start=p,h.panDis(e),h.updateValid(),h.valid))break;if(u.valid&&u.primitive instanceof q&&!u.pan.start().equals1(u.start)){let m=new M(u.start,u.pan.start()),g=this.getInters(m,h.pan);if(g!=null&&!g.equals1(h.start)&&(h.start=g,h.panDis(e),h.updateValid(),h.valid))break}u=u.prev}}let n=new Array;e:for(let h of r)if(!h.visited)if(h.visited=!0,h.valid)n.push(h);else{let u=this.getPrev(h),d=this.getNext(h),p=r.indexOf(u),m=r.indexOf(d);if(u==null||d==null)continue;if(m-p==2||m==0&&p==i-2||m==1&&p==i-1){let g=u.primitive.start().equals1(d.primitive.end())?this.getInters4BBox1(u.pan,d.pan):this.getInters4BBox(u.pan,d.pan);if(g!=null)u.end=g,d.start=g;else{let y=r.indexOf(h);for(let b=y;b!=m;b=(b+1)%i){let P=r[b];P.visited=!0}}}else{let g=r.indexOf(h),y=u.pan,b=d.pan;for(let T=g;T!=m;T=(T+1)%i){let I=r[T];I.visited=!0;let C=I.primitive.panDistance(e),E=this.getInters(y,C);E!=null&&(y=bc.modifyEnd(E,y),C instanceof q&&(I.start=E));let O=this.getInters(C,b);if(O!=null&&(b=bc.modifyStart(O,b),C instanceof q&&(I.end=O)),I.panDis(e),I.updateValid(),I.valid){n.push(I);continue e}}let P=this.getInters(y,b);if(P!=null)u.end=P,d.start=P;else{let T=new u0e(null);T.start=y.end(),T.end=b.start(),T.pan=new M(T.start,T.end),u.end=y.end(),d.start=b.start(),n.push(T)}}}for(let h of n)h.valid&&h.panDis(e);let s=new Array;for(let h of n)(h.primitive||h.pan)instanceof M?(h.pan=new M(h.start,h.end),s.push(h.pan)):(h.start.equals1(h.pan.start())||s.push(new M(h.start,h.pan.start())),s.push(h.pan),h.end.equals1(h.pan.end())||s.push(new M(h.pan.end(),h.end)));if(s.length==0)return[];let a=fe.build2(s).asClose();return new Kc().normalizeData([a],3).toPolylineGroups()}else{let s=r[0].primitive;if(s instanceof q){if(ne.lesseq(s.rx+e,0))return[];let a=s.panDistance(e);return fe.build2([a])}return t}}getPrev(t){if(!t.valid){let e=t.prev;for(;!e.valid&&e!=t;)e=e.prev;return e==t?null:e}return t}getNext(t){if(!t.valid){let e=t.next;for(;!e.valid&&e!=t;)e=e.next;return e==t?null:e}return t}getInters(t,e,r=!0){let i=Tt(t,e);if(i>0){let n=new Array;for(let s=0;s<i;s+=2){let a=new S(Ee[s],Ee[s+1]);n.push(a)}return r?(dn(n,t),n[0]):(dn(n,e),n[n.length-1])}return null}getInters1(t,e){let r=Tt(t,e);if(r>0){let i=new Array;for(let n=0;n<r;n+=2){let s=new S(Ee[n],Ee[n+1]);i.push(s)}return dn(i,t),i[i.length-1]}return null}getInters4BBox(t,e,r=!0){let i=new _e;i.ext1(t.bbox()).ext1(e.bbox());let n=i.build(),s=n.width()+n.height(),a=this.getExtendLine(t,s,!0),l=this.getExtendLine(e,s,!1);return this.getInters(a,l,r)}getInters4BBox1(t,e){let r=new _e;r.ext1(t.bbox()).ext1(e.bbox());let i=r.build(),n=i.width()+i.height(),s=this.getExtendLine(t,n,!0),a=this.getExtendLine(e,n,!1);return this.getInters1(s,a)}getExtendLine(t,e,r){return t instanceof M?r?new M(t.start(),t.end().add(t.direct.mul(e))):new M(t.start().sub(t.direct.mul(e)),t.end()):t}getPts(t){let e=new Array,r=null;for(let i of t.primitives)if(Fd(i)>1e-5&&(i instanceof M||i instanceof q)){let s=new u0e(i);r!=null&&(s.prev=r,r.next=s),r=s,e.push(s)}return e.length>0&&(e[0].prev=e[e.length-1],e[e.length-1].next=e[0]),e}getPoint4Pts(t,e){let r=t.prev.primitive,i=t.primitive;if(r instanceof M&&i instanceof M)return this.extend4Lines(r,i,e);if(r instanceof M&&i instanceof q)return this.extend4LineArc(r,i,e);if(r instanceof q&&i instanceof M)return this.extend4ArcLine(r,i,e);if(r instanceof q&&i instanceof q)return this.extend4Arcs(r,i,e);throw new Error("not support!!!")}getPointPts(t,e,r){if(t instanceof M&&e instanceof M)return this.extend4Lines(t,e,r);if(t instanceof M&&e instanceof q)return this.extend4LineArc(t,e,r);if(t instanceof q&&e instanceof M)return this.extend4ArcLine(t,e,r);if(t instanceof q&&e instanceof q)return this.extend4Arcs(t,e,r);throw new Error("not support!!!")}getPoint(t,e,r,i){let n=e.add(r);if(ne.eq(n.x,0)&&ne.eq(n.y,0))return t.add(new S(-r.y,r.x).mul(i));n=n.normalize();let s=r.cross(n);if(ne.eq(s,0))return t;let a=i/s;return t.add(n.mul(a))}extend4Lines(t,e,r){let i=t.direct.mul(-1),n=e.direct;return this.getPoint(t.end(),i,n,r)}extend4LineArc(t,e,r){let i=t.direct.mul(-1),n=Ot(e,e.start()),s=this.getPoint(t.end(),i,n,r),a=e.panDistance(r),l=kN(s,a.start()),c=Ot(a,a.start()),h=l.dot(c),u=s.sub(t.end()).normalize();if(ne.less(h,0))if(t.start().equals1(e.end())){let d=this.getInters4BBox1(t.panDistance(r),a);if(d!=null)return d}else{if(ne.less(u.dot(n),0)){let p=t.panDistance(r),m=e.panDistance(r),g=Tt(p,m);if(g>0){let y=new Array;for(let b=0;b<g;b+=2){let P=new S(Ee[b],Ee[b+1]);y.push(P)}return dn(y,m),y[0]}else{let y=new _e().ext1(p.bbox()).ext1(m.bbox()).build1(),b=y.width()+y.height(),P=i.mul(b),T=new M(p.start().sub(P),p.end().add(P)),I=Tt(T,m);if(I>0){let C=new Array;for(let E=0;E<I;E+=2){let O=new S(Ee[E],Ee[E+1]);C.push(O)}return dn(C,m),C[0]}}}let d=this.getInters4BBox(t.panDistance(r),a);if(d!=null)return d}return s}extend4ArcLine(t,e,r){let i=Ot(t).mul(-1),n=e.direct,s=this.getPoint(t.end(),i,n,r),a=s.sub(t.end()).normalize(),l=t.panDistance(r),c=kN(l.end(),s),h=Ot(l),u=c.dot(h);if(ne.less(u,0))if(t.start().equals1(e.end())){let d=this.getInters4BBox1(l,e.panDistance(r));if(d!=null)return d}else{if(ne.less(a.dot(n),0)){let p=e.panDistance(r),m=t.panDistance(r),g=Tt(p,m);if(g>0){let y=new Array;for(let b=0;b<g;b+=2){let P=new S(Ee[b],Ee[b+1]);y.push(P)}return dn(y,p),y[0]}else{let y=new _e().ext1(p.bbox()).ext1(m.bbox()).build1(),b=y.width()+y.height(),P=n.mul(b),T=new M(p.start().sub(P),p.end().add(P)),I=Tt(T,m);if(I>0){let C=new Array;for(let E=0;E<I;E+=2){let O=new S(Ee[E],Ee[E+1]);C.push(O)}return C.sort((E,O)=>E.distance2(p.start())-O.distance2(p.start())),C[0]}}}let d=this.getInters4BBox(l,vm(l,s)?bc.modifyStart(s,e.panDistance(r)):e.panDistance(r),!1);if(d!=null)return d}return s}extend4Arcs(t,e,r){let i=Ot(t).mul(-1),n=Ot(e,e.start()),s=this.getPoint(t.end(),i,n,r),a=t.panDistance(r),l=kN(a.end(),s),c=Ot(a),h=l.dot(c);if(ne.less(h,0)){let u=this.getStart(a,e.panDistance(r));if(u!=null)return u}return s}getStart(t,e){let r=Tt(t,e);if(r>0){let i=new Array;for(let n=0;n<r;n+=2){let s=new S(Ee[n],Ee[n+1]);i.push(s)}return dn(i,e),i[0]}return null}};var BAe=["Board Outline","Slot Region","Copper Region","Fill Region","Prohibited Region","Constraint Region","TearDrop","LINESUTUREVIA","3D Shell - Outline","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Top/Bottom Entity","3D Shell - Side Entity","3D Shell - Screw Pillar","FPC Stiffener"];function QDt(o,t){if(o instanceof nr){if((os.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||os.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist")&&h0e(o)<.1)return o.remove(),Xt.delete(o),t.ret=-1,t.msg="The scaled primitive is too small and cannot be generated",t.msgType="error",!1;if(Bt.checkIsCanEditByItem(o)){if(c0e([o])<=1e-8)return o.remove(),Xt.delete(o),t.ret=-1,t.msg="The newly generated primitive exceeds the partition range and cannot be generated",t.msgType="error",!1}else return o.remove(),Xt.delete(o),t.ret=-1,t.msg="The newly generated primitive exceeds the partition range and cannot be generated",t.msgType="error",!1;return!0}else if(o instanceof Sr){if((os.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||os.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist")&&h0e(o)<.1)return o.remove(),Zt.delete(o),t.ret=-1,t.msg="The scaled primitive is too small and cannot be generated",t.msgType="error",!1;if(Bt.checkIsCanEditByItem(o)){if(c0e([o])<=1e-8)return o.remove(),Zt.delete(o),t.ret=-1,t.msg="The newly generated primitive exceeds the partition range and cannot be generated",t.msgType="error",!1}else return o.remove(),Zt.delete(o),t.ret=-1,t.msg="The newly generated primitive exceeds the partition range and cannot be generated",t.msgType="error",!1;return!0}else if(o instanceof ct){if((os.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||os.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist")&&h0e(o)<.1)return o.remove(),pt.delete(o),t.ret=-1,t.msg="The scaled primitive is too small and cannot be generated",t.msgType="error",!1;if(Bt.checkIsCanEditByItem(o)){if(c0e([o])<=1e-8)return o.remove(),pt.delete(o),t.ret=-1,t.msg="The newly generated primitive exceeds the partition range and cannot be generated",t.msgType="error",!1}else return o.remove(),pt.delete(o),t.ret=-1,t.msg="The newly generated primitive exceeds the partition range and cannot be generated",t.msgType="error",!1;return!0}return!1}function ewt(o){o.ret===0&&(os.getInstance().copySpecialParams.isRemoveSourceTarget&&o.refItems.forEach(t=>{o.rmCommands.push(Te.dispatch(t,"delete"))}),o.newItems.forEach(t=>{o.addCommands.push(Te.dispatch(t,"add"))}))}function Nqe(o,t,e){let r={ret:0,msg:"",msgType:"info",elements:new Set},i=null;o==="zoomDist"&&(i=new d0e);let n=[];for(let c of t){let h=o==="zoomDist"?twt(c,i):rwt(c,e);n.push(h)}let s=0,a="",l="";e:for(let c of n){if(c.ret!==0){s=c.ret,a=c.msg,l=c.msgType;for(let h of n){h.ret=s,h.msg=a,h.msgType=l;for(let u of h.newItems)kAe(u);h.newItems=[]}break e}for(let h of c.newItems)if(QDt(h,c)===!1){s=c.ret,a=c.msg,l=c.msgType;for(let d of n){d.ret=s,d.msg=a,d.msgType=l;for(let p of d.newItems)kAe(p);d.newItems=[]}break e}}if(s===0){r.msg="Copy Success!";let c=new ve("draw copyspecial"),h=os.getInstance().copySpecialParams.isRemoveSourceTarget,u=os.getInstance().copySpecialParams.primitiveType=="FPC Stiffener",d=!1;for(let p of n)u&&p.newItems.some(m=>m.type=="FPC Stiffener")&&(d=!0),ewt(p),h&&p.refItems.forEach(m=>{kAe(m)}),p.addCommands.forEach(m=>{c.addCommand(m)}),p.rmCommands.forEach(m=>{c.addCommand(m)}),p.newItems.forEach(m=>{r.elements.add(m)}),h||p.refItems.forEach(m=>{r.elements.add(m)}),je.executeCommand(c),A.publish("autoFill","");return d&&A.publish("checkOpenStiffenerLayer",{notShowTip:!0}),r}for(let c of n)for(let h of c.refItems)r.elements.add(h);return r.ret=s,r.msg=a,r.msgType=l,r}function twt(o,t){let e={ret:0,msg:"",msgType:"info",refItems:[],newItems:[],addCommands:[],rmCommands:[]},r=os.getInstance().copySpecialParams.isKeepNetProfile&&o.net||"",i=os.getInstance().copySpecialParams.primitiveType,n=+os.getInstance().copySpecialParams.layerId,s=qu(-1,o.type)||1;if(s=os.getInstance().copySpecialParams.primitiveType==="Board Outline"||os.getInstance().copySpecialParams.primitiveType==="Line"?os.getInstance().copySpecialParams.lineWidth:s,os.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"||os.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"){let a=os.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"?os.getInstance().copySpecialParams.zoomDist:-os.getInstance().copySpecialParams.zoomDist;if(o instanceof nr){let l=new S(-1,1).rotate(S.ORIGIN,o.rotation).normalize(),c=a*(2/Math.sqrt(2)),h=o.start.add(l.mul(c)),u=o.width+a*2,d=o.height+a*2;if(u<=0||d<=0)return e.ret=-1,e.msg="The scaled primitive is too small and cannot be generated",e.msgType="error",e;let p=Xt.addRect(i,n,h,u,d,r,!1,s,o.rotation,o.cornerRadius);p.net=r,p.partition=o.partition,e.refItems.push(o),e.newItems.push(p)}else if(o instanceof Sr){let l=o.radius+a;if(l<=0)return e.ret=-1,e.msg="The scaled primitive is too small and cannot be generated",e.msgType="error",e;let c=Zt.addCircle(i,n,o.center,l,s,!1,r);c.net=r,c.partition=o.partition,e.refItems.push(o),e.newItems.push(c)}else if(o instanceof ct){let l=o.getMathGraphics(),c=l instanceof Gt?l.getOutMostPolyline():l;if(o.type==="Line"&&!xu(l.primitives)&&(os.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||os.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"))return e.ret=-1,e.msg="The selected element is not closed and cannot be copied",e.msgType="error",e;let h=t.extends(c,a);if(e.refItems.push(o),h instanceof Array){if(h.length<=0)return e.ret=-1,e.msg="The scaled primitive is too small and cannot be generated",e.msgType="error",e;for(let m=0;m<h.length;m++)Mqe(o,[h[m]],n,i,s,r,e);return e}let u=fe.build2(h.primitives);u=u.asClose();let d=xY(_A,[u]),p=[];for(let m of d)Re.addAll(p,m.items);Mqe(o,d,n,i,s,r,e)}}return e}function Mqe(o,t,e,r,i,n,s){if(xr(t,(c,h)=>h.bbox().area()-c.bbox().area(),0,t.length),t.length<=0||t[0].items.length<=0)return s.ret=-1,s.msg="",s;let a=t[0].items,l=new io;for(let c=0;c<a.length;c++){let h=a[c].primitives,u=l.ptsToShapes(h,e,o.strokeWidth),d=Nm(u);if(d.length>0){let p=pt.addPolygon(r,e,[d],i,n,!1);p.net=n,p.partition=o.partition,BAe.includes(r)&&p.checkClose(),s.newItems.push(p)}}return s}function rwt(o,t){let e={ret:0,msg:"",msgType:"info",refItems:[],newItems:[],addCommands:[],rmCommands:[]},r=os.getInstance().copySpecialParams.isKeepNetProfile&&o.net||"",i=os.getInstance().copySpecialParams.zoomRatio,n=Qe.scale(os.getInstance().copySpecialParams.zoomRatio).setOrigin1(t),s=os.getInstance().copySpecialParams.primitiveType,a=+os.getInstance().copySpecialParams.layerId,l=qu(-1,o.type)||1;if(l=os.getInstance().copySpecialParams.primitiveType==="Board Outline"||os.getInstance().copySpecialParams.primitiveType==="Line"?os.getInstance().copySpecialParams.lineWidth:l,o instanceof nr){let c=o.width*i,h=o.height*i,u=o.radius*i,d=o.start.multiply3(n),p=Xt.addRect(s,a,d,c,h,r,o.locked,l,o.rotation,u);p.net=r,p.partition=o.partition,e.refItems.push(o),e.newItems.push(p)}else if(o instanceof Sr){let c=o.center.multiply3(n),h=o.radius*i,u=Zt.addCircle(s,a,c,h,l,!1,r);u.net=r,u.partition=o.partition,e.refItems.push(o),e.newItems.push(u)}else if(o instanceof ct){let c=[];if(o.iteratorChildren(y=>{c.push(y)}),c.length===1&&c[0]instanceof mt&&BAe.includes(s))return e.ret=-1,e.msg="The selected element is not closed and cannot be copied",e.msgType="error",e;let h=o.getMathGraphics(),u=[];h.primitives.forEach(y=>{let b=y.multiply3(n);u.push(b)});let p=new io().ptsToShapes(u,a,o.strokeWidth),m=Nm(p),g=pt.addPolygon(s,a,[m],l,r,!1);g.net=r,g.partition=o.partition,BAe.includes(s)&&g.checkClose(),e.refItems.push(o),e.newItems.push(g)}return e}function kAe(o){o&&(o instanceof nr?(Xt.delete(o),o.remove()):o instanceof Sr?(Zt.delete(o),o.remove()):o instanceof ct&&(pt.delete(o),o.remove()))}function kqe(o){let t=new Jt;return t.add("CANCEL",!0),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var BN=class BN{static getInstance(){return BN.instance==null&&(BN.instance=new BN),BN.instance}constructor(){this._inRunning=!1}get isRunning(){return this._inRunning}set isRunning(t){this._inRunning=t}};BN.instance=null;var FN=BN,p0e=class extends ci{constructor(t){super(),this.drawing=!0,this.isHoldPCBAttrPanel=!0,this.selections=[],this.mouseRightDownPageX=-1,this.mouseRightDownPageY=-1,this.isMouseLeftDown=!1,this.selectItems=new Set,this.hoverItems=new Set,this.copyOperationType=os.getInstance().copySpecialParams.copyOperationType,this.isWaittingSelectRefPositionStatus=!1,this.accessPrimitives=os.getInstance().copySpecialParams.primitiveTypeList.map(e=>e.value),jt.update(Pi.getInstance(),"Please select or box select the object to copy"),this.initSketcherAttrPanel(),this.cancelHightlightAllItems(),this.cancelAllSelectedMessageHandler=A.messageBus.subscribe("copySpecialParamUpdate",()=>{this.copyOperationType==="ZoomByRatio"&&(os.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||os.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist")&&(this.isWaittingSelectRefPositionStatus=!1,this.cancelHightlightHoverItems(),this.hoverItems.clear(),this.selectItems.clear(),jt.update(Pi.getInstance(),"Please select or box select the object to copy")),this.copyOperationType=os.getInstance().copySpecialParams.copyOperationType}),FN.getInstance().isRunning=!0}getCanUndo(){return!0}onKeyDown(t){yi.setArea(["Undo","Redo"]);let e=yi.getScene(),r=sr.getAction(e,t);switch(r||(r=sr.getAction(4,t)),r){case"Cancel":this.cancel();break;case"Undo":{A.publish("undo","");break}case"Redo":{A.publish("redo","");break}}A.publish("updateFrame","")}onMouseLeftDown(t){this.isMouseLeftDown=!0,this.realSceneLeftDownPageX=t.realSceneX,this.realSceneLeftDownPageY=t.realSceneY,this.clearSelectBox(),Ve.clearSelect(),this.start()}onMouseLeftUp(t){if(this.isWaittingSelectRefPositionStatus)this.selectItems.size&&this.doCopy(t.sceneX,t.sceneY);else if(this.selections.length>0){this.cancelHightlightHoverItems();let e=new _e().ext6(t.realSceneX,t.realSceneY).ext6(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY).build1(),r=new Set;this.realSceneLeftDownPageX>t.realSceneX?St.getInstance().flip?r=Q$(e,new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),!0):r=Q$(e,new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),!1):St.getInstance().flip?r=Q$(e,new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),!1):r=Q$(e,new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),!0),this.updateSelectItems(r,t.sceneX,t.sceneY,"RangeSelection"),this.updateHoverItems(this.selectItems,t.sceneX,t.sceneY,"RangeSelection"),this.hightlightHoverItems(),t.setIsBoxSelection(!0),this.selectItems.size>0&&(os.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||os.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"?this.selectItems.size&&this.doCopy(t.sceneX,t.sceneY):(jt.update(t,"Please select a reference point"),this.isWaittingSelectRefPositionStatus=!0))}else{let e=new ut(t.realSceneX,t.realSceneX,t.realSceneY,t.realSceneY),r=Vt.search(e,(i,n)=>n==null?!1:S0.includes(n)||n=="Copper",!1);this.updateSelectItems(r.getResult([...S0,"Copper"]),t.sceneX,t.sceneY,"SingleDotSelection"),this.selectItems.size&&(os.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||os.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"?this.doCopy(t.sceneX,t.sceneY):(jt.update(t,"Please select a reference point"),this.isWaittingSelectRefPositionStatus=!0))}this.clearSelectBox(),this.isMouseLeftDown=!1,this.realSceneLeftDownPageX=-1,this.realSceneLeftDownPageY=-1,A.publish("updateFrame","")}onMouseRightDown(t){this.mouseRightDownPageX=t.mouseX,this.mouseRightDownPageY=t.mouseY}onMouseRightUp(t){if(!(t.mouseX!==this.mouseRightDownPageX||t.mouseY!==this.mouseRightDownPageY)){if(ce.pcbConfig.endDrawing==="ctrl+rightClick"){if(t.ctrlKey){t.clearCrossFlag(),this.cancel();return}this.rightClickMenuData(t);return}if(t.ctrlKey){this.rightClickMenuData(t);return}t.clearCrossFlag(),this.cancel(),this.mouseRightDownPageX=-1,this.mouseRightDownPageY=-1}}onMouseWheel(t){}onMouseMove(t){if(this.isMouseLeftDown)this.updateSelectBox(t.realSceneX,t.realSceneY),this.cancelHightlightHoverItems(),this.hoverItems.clear(),this.selectItems.clear(),this.isWaittingSelectRefPositionStatus=!1;else if(this.selectItems.size<=0){this.cancelHightlightHoverItems();let e=new ut(t.realSceneX,t.realSceneX,t.realSceneY,t.realSceneY),r=Vt.search(e,(i,n)=>n==null?!1:S0.includes(n)||n=="Copper",!1);this.updateHoverItems(r.getResult([...S0,"Copper"]),t.sceneX,t.sceneY,"SingleDotSelection")}this.isWaittingSelectRefPositionStatus?jt.update(t,"Please select a reference point"):jt.update(t,"Please select or box select the object to copy"),this.hightlightHoverItems()}interrupt(){hn.destroy(),this.end()}cancel(){jt.cancel(),this.interrupt(),this.cancelHightlightHoverItems(),this.selectItems.clear(),this.hoverItems.clear(),this.isWaittingSelectRefPositionStatus=!1,A.publish("tool","dropdrag"),A.publish("destoryCanvasCross",null),A.publish("ExitSketcherAttrView",{type:"COPY_SPECIAL"}),this.cancelAllSelectedMessageHandler&&this.cancelAllSelectedMessageHandler.cancel(),FN.getInstance().isRunning=!1}rightClickMenuData(t){if(this.isMouseLeftDown)return;let e={state:"show",left:t.mouseX,top:t.mouseY,filter:kqe(t.adsorb)};Qt.getInstance().menuData(e,this),this.drawing=!1,Uu.getInstance().isOpenedContextmenu=!0}parse(t){let e=t.cmdKey;switch(this.drawing=!0,e.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}Uu.getInstance().isOpenedContextmenu=!1,A.publish("updateFrame","")}initSketcherAttrPanel(){A.publish("FlushSketcherAttrView",{type:"COPY_SPECIAL",isInitAllParams:!0})}updateSelectItems(t,e,r,i){this.selectItems.clear();let n=new Set;t.forEach(s=>{if(s===null||typeof s>"u"||s.isVisible===!1)return;let a=be.getLayer(s.layerId);if(!(!a||a.visible===!1)&&Bt.checkIsCanEditByItem(s)){if(s instanceof ii){let l=s.getParent();l&&n.add(l);return}if(s instanceof Ye){if(s.type==="Copper Region"){if(i==="RangeSelection"){n.add(s);return}s.isSelect(e,r)&&n.add(s);return}if(s.type==="Line"||s.type==="Board Outline"||s.type==="3D Shell - Outline"){if(i==="RangeSelection"){n.add(s);return}s.isSelect(e,r)&&n.add(s);return}this.accessPrimitives.indexOf(s.type)<=-1||n.add(s)}}}),this.selectItems=n}updateHoverItems(t,e,r,i){this.hoverItems.clear();let n=new Set;t.forEach(s=>{if(s===null||typeof s>"u"||s.isVisible===!1)return;let a=be.getLayer(s.layerId);if(!(!a||a.visible===!1)&&Bt.checkIsCanEditByItem(s)){if(s instanceof ii){n.add(s);let l=s.getParent();l&&n.add(l);return}if(s instanceof Ye){if(s.type==="Copper Region"){s.isSelect(e,r)&&(n.add(s),s.getCopperResult()&&n.add(s));return}if(s.type==="Line"||s.type==="Board Outline"||s.type==="3D Shell - Outline"){if(i==="RangeSelection"){n.add(s);return}s.isSelect(e,r)&&n.add(s);return}this.accessPrimitives.indexOf(s.type)<=-1||n.add(s)}}}),this.hoverItems=n}hightlightHoverItems(){this.hoverItems.forEach(t=>{t.isVisible!==!1&&t.click()})}cancelHightlightHoverItems(){this.hoverItems.forEach(t=>{t.isVisible!==!1&&t.visible()})}cancelHightlightAllItems(){Lc().forEach(t=>{t.isVisible!==!1&&t.visible()})}doCopy(t,e){let r=os.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||os.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"?"zoomDist":"zoomRatio";if(r==="zoomDist"){this.sortSelectedItems();let n=Array.from(this.selectItems)[0];this.selectItems.clear(),this.selectItems.add(n)}let i=Nqe(r,this.selectItems,new S(t,e));A.publish("ui/toastMsg",{type:i.msgType,msg:i.msg,timer:2},$()),this.cancelHightlightHoverItems(),this.selectItems.clear(),this.hoverItems.clear(),Ve.setSelect(i.elements,!1),this.isWaittingSelectRefPositionStatus=!1,jt.update(Pi.getInstance(),"Please select or box select the object to copy"),this.end()}updateSelectBox(t,e){let r=ce.themeConfig.canvasTheme,i=r.isSolidLine(r.selectBoxLineStyle),n=r.selectBoxColor;if(this.selections.length>0)this.selections[0].start=new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),this.selections[0].end=new S(t,this.realSceneLeftDownPageY),this.selections[1].start=new S(t,this.realSceneLeftDownPageY),this.selections[1].end=new S(t,e),this.selections[2].start=new S(t,e),this.selections[2].end=new S(this.realSceneLeftDownPageX,e),this.selections[3].start=new S(this.realSceneLeftDownPageX,e),this.selections[3].end=new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY);else{let s=new hr(1002,new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),new S(t,this.realSceneLeftDownPageY),i,n),a=new hr(1002,new S(t,this.realSceneLeftDownPageY),new S(t,e),i,n),l=new hr(1002,new S(t,e),new S(this.realSceneLeftDownPageX,e),i,n),c=new hr(1002,new S(this.realSceneLeftDownPageX,e),new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),i,n);this.selections.push(s),this.selections.push(a),this.selections.push(l),this.selections.push(c)}}clearSelectBox(){for(let t of this.selections)t.remove();this.selections.length=0}sortSelectedItems(){let t=[],e=[];for(let r of this.selectItems){if(r.layerId===be.getActiveLayerID()){t.push(r);continue}e.push(r)}this.selectItems=new Set([].concat(t,e))}};function Bqe(o){let t=new Jt;return t.add("CANCEL"),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var eK=class extends c1{constructor(){super();this.mouseLeftX=0;this.mouseLeftY=0;this.selections=new Array;this.items=new Set;this.drawing=!0,jt.update(Pi.getInstance(),"Please click or select the object you want to cross probe")}onKeyDown(e){let r=sr.getAction(3,e);switch(r==null&&(r=sr.getAction(4,e)),r){case"Cancel":this.cancel();break;case"Finish":case"place":this.onEnterPlace(e);return}}onMouseLeftDown(e){this.mouseLeftX=e.realSceneX,this.mouseLeftY=e.realSceneY,A.publish("clearSelect",""),this.start()}onMouseMove(e){let r=e.realSceneX,i=e.realSceneY;e.hovering=!0,e.hover(),e.leftDown&&this.updateSelectBox(r,i),this.drawing&&jt.update(e,"Please click or select the object you want to cross probe")}async onMouseLeftUp(e){let r=e.realSceneX,i=e.realSceneY;if(x.getInstance().isactive||await A.windowBridge.rpcCall("setTabActive",[x.getInstance().tabId],$()),this.selections.length>0){let n=new _e().ext6(r,i).ext6(this.mouseLeftX,this.mouseLeftY).build1();this.mouseLeftX>r?St.getInstance().flip?this.boxSelect(n,!0,e.ctrlKey):this.boxSelect(n,!1,e.ctrlKey):St.getInstance().flip?this.boxSelect(n,!1,e.ctrlKey):this.boxSelect(n,!0,e.ctrlKey),this.clearSelectBox(),e.setIsBoxSelection(!0)}else{let n=Wr.pointSelect(r,i);n=Array.from($t.filter(n)),this.select(n,e.ctrlKey)}A.publish("select",this.items),mw.notifySchToCrossProbe(!0),this.end()}async onMouseRightDown(e){x.getInstance().isactive||await A.windowBridge.rpcCall("setTabActive",[x.getInstance().tabId],$()),e.openMenu=!0}onMouseRightUp(e){if(e.openMenu){if(ce.pcbConfig.endDrawing=="ctrl+rightClick"){if(!e.ctrlKey){this.rightClickMenuData(e);return}}else if(e.ctrlKey){this.rightClickMenuData(e);return}this.cancel()}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Bqe(e.adsorb)};Qt.getInstance().menuData(r,this),this.drawing=!1}select(e,r){if(r)for(let i of e)this.items.has(i)?(i.visible(),this.items.delete(i)):(i.click(),this.items.add(i));else{this.items.forEach(i=>{i.visible(),this.items.delete(i)}),Ve.clearSelect();for(let i of e)i.click(),this.items.add(i)}}boxSelect(e,r,i){let n=new Array;r?n=this.leftToRight(e):n=this.rightToLeft(e),n=Wr.filterPartiton(n),this.select(n,i)}clearSelectBox(){for(let e of this.selections)e.remove();this.selections.length=0}updateSelectBox(e,r){let i=ce.themeConfig.canvasTheme,n=i.isSolidLine(i.selectBoxLineStyle),s=i.selectBoxColor;if(this.selections.length>0)this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(e,this.mouseLeftY),this.selections[1].start=new S(e,this.mouseLeftY),this.selections[1].end=new S(e,r),this.selections[2].start=new S(e,r),this.selections[2].end=new S(this.mouseLeftX,r),this.selections[3].start=new S(this.mouseLeftX,r),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY);else{let a=new hr(1002,new S(this.mouseLeftX,this.mouseLeftY),new S(e,this.mouseLeftY),n,s),l=new hr(1002,new S(e,this.mouseLeftY),new S(e,r),n,s),c=new hr(1002,new S(e,r),new S(this.mouseLeftX,r),n,s),h=new hr(1002,new S(this.mouseLeftX,r),new S(this.mouseLeftX,this.mouseLeftY),n,s);this.selections.push(a),this.selections.push(l),this.selections.push(c),this.selections.push(h)}}leftToRight(e){let r=$t.filterElement(Wr.getSelectInside(Ol(e),{boxChoose:!1,isBBox:!0}),{boxChoose:!0});return Array.from(r)}rightToLeft(e){let r=$t.filterElement(Wr.getSelectContect(Ol(e),{boxChoose:!0,isBBox:!0}),{boxChoose:!0});return _P(r)}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break}A.publish("updateFrame","")}interrupt(){this.end(),this.drawing=!1}cancel(){this.interrupt(),A.publish("tool","dropdrag")}};var f0e=class{constructor(t){this.tool=t,this.isHoldPCBAttrPanel=!1,A.subscribe("tool",this.update.bind(this)),A.subscribe("place_part(pcbtext)",this.placeText.bind(this)),A.subscribe("editPadShape",this.toggleEditPad.bind(this)),A.subscribe("redrawPolygonPad",this.toggleRedrawPad.bind(this)),A.subscribe("redrawPolygon",this.toggleRedraw.bind(this)),A.subscribe("DrawImage",this.drawImage.bind(this)),A.subscribe("DrawTrueColorPicture",this.drawTrueColorPicture.bind(this)),A.subscribe("toggle",this.toggle.bind(this)),A.subscribe("resetToolLastCmd",this.resetLastCmd.bind(this)),A.subscribe("userCancelCurrentCommand",this.receiveUserCommand.bind(this)),this.initDropDrag()}initDropDrag(){this.tool.setNextTool(new dh),ao.setTool(Ve),Yo.setTool(Ve),yi.setNonSelect(),Ve.dragging=!1,yi.dropDrag=!0,this.lastCmd="dropdrag"}receiveUserCommand(t){t.command&&A.publish("tool","dropdrag")}resetLastCmd(t){this.lastCmd=t}openCopperInterruptDialog(t){t!=="dropdrag"&&mU("pcb-copper-manager")&&A.publish("pcbdialogModify",{dialogType:"pcb-copper-manager",action:"saveAndCloseCopperDialog"})}update(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(x.getInstance().isReadOnlyMode)switch(t){case"dropdrag":case"MeasureDistance":case"copySpecial":case"rectangleOutside":case"rectangleInside":case"polygonInside":case"polygonOutside":case"lineTouched":case"connectedCopper":case"continuousSelection":case"boxselect":case"draw(annotation)":case"COPY":case"crossProbeTool":break;default:return}if(this.lastCmd===t)return;Mn.getInstance().allowPull=!0,we.drawing=!1,jt.cancel(),this.tool.clearClickPos(),this.openCopperInterruptDialog(t),this.lastCmd==="placeComponent"&&t==="dropdrag"&&A.windowBridge.publish("openPlaceClosedBottomBar",null,$()),A.publish("clearDimension",""),this.lastCmd=t,we.setCommand(t);let e=Ve.getSelects(),r=Array.from(Ve.getComponents());Pr.model=3,sl.addTool(null),ao.setTool(null),Yo.setTool(null),qf.clear(),jr.clearDrawTool(),Wh.setTool(null),this.tool.clearCrossFlag();let i=this.tool.getNextTool();if(i instanceof dh&&i.clear(),i instanceof eK&&i.drawing&&t==="dropdrag"){this.lastCmd="crossProbeTool";return}switch((this.needClearStatus(t)||i!=null&&i instanceof ko&&i.drawing)&&(this.tool.interrupt(),yi.setNonSelect()),yi.setDraw(),yi.dropDrag=!1,dt.destroy(),Yh.clearSketcherAttrView(),t){case"reuseLayoutRoute":{let n=new Ww(r);this.tool.setNextTool(n);break}case"createArrayDistributionTool":case"createArrayTool":{let n=new wpe(t,e);this.tool.setNextTool(n);break}case"draw(origin)":{let n=new _U;n.drawing=!0,yi.setPlace(),this.tool.setNextTool(n);break}case"draw(track)":{yi.setArea(["decrease_routing_width","increase_routing_width"]);let s=Ss.getInstance("Single wiring").doubleClickItem,a=new Vo("Single wiring"),l=a.getShiftStartControl();s&&l&&(this.tool.lastClickX=l.x,this.tool.lastClickY=l.y),a.drawing=!0,we.drawing=!0,this.tool.setNextTool(a),this.isHoldPCBAttrPanel=a.isHoldPCBAttrPanel;break}case"draw(difftrack)":{yi.setArea(["changeDiffPairFanOutMode"]);let n=new Vo("Differential pair wiring");n.drawing=!0,we.drawing=!0,this.tool.setNextTool(n),this.isHoldPCBAttrPanel=n.isHoldPCBAttrPanel;break}case"draw(multiTrack)":{yi.setArea(["IncreaseMultiSpace","decreaseMultiSpace","decrease_routing_width","increase_routing_width"]);let n=new Vo("Multi-route wiring");n.handleMultiSelectItem(e),n.drawing=!0,we.drawing=!0,this.tool.setNextTool(n),this.isHoldPCBAttrPanel=n.isHoldPCBAttrPanel;break}case"pcbOptimizedPath":{let n=new GU;n.handleSelectItems(e),n.drawing=!0,we.drawing=!0,this.tool.setNextTool(n),yi.setNonSelect();break}case"editPadShape":{if(e.length==1&&e[0]instanceof fn){let n=new wN;n.setPad(e[0]),this.tool.setNextTool(n),yi.currentCanUndoTool=!0}break}case"draw(rectSutureVia)":{let n=new ape;n.drawing=!0,this.tool.setNextTool(n);break}case"draw(lineSutureVia)":{let n=new zpe;this.tool.setNextTool(n);break}case"draw(polygonSutureVia)":{let n=new zU;this.tool.setNextTool(n);break}case"place_part(polygonpad)":{let n=new vU;n.drawing=!0,sl.addTool(n),this.tool.setNextTool(n);break}case"PlaceSinglePad":{let n=new rO;n.drawing=!0,sl.addTool(n),this.tool.setNextTool(n),yi.setPlace();break}case"place_part(testPad)":{let n=new RU;n.drawing=!0,sl.addTool(n),this.tool.setNextTool(n),yi.setPlace();break}case"place_part(line_pads)":{let n=new SU;n.drawing=!0,yi.setPlace(),this.tool.setNextTool(n);break}case"place_part(rect_pads)":{let n=new EU;n.drawing=!0,yi.setPlace(),this.tool.setNextTool(n);break}case"place_part(via)":{if(ce.pcbConfig.isPlaceViasAutoShove){let n=new y2;n.drawing=!0,we.drawing=!0,this.tool.setNextTool(n),yi.setPlace()}else{let n=new cy;n.drawing=!0,we.drawing=!0,this.tool.setNextTool(n),yi.setPlace()}break}case"place_part(pcbtext)":{let n=new AU;n.drawing=!0,this.tool.setNextTool(n),sl.addTool(n),yi.setPlace();break}case"draw(arc2)":{let n=new jC;n.drawing=!0,this.tool.setNextTool(n),Wh.setTool(n),sl.addTool(n);break}case"draw(arcCenter)":{let n=new YC;n.drawing=!0,this.tool.setNextTool(n),Wh.setTool(n),sl.addTool(n);break}case"draw(arc)":{let n=new XC;n.drawing=!0,this.tool.setNextTool(n),Wh.setTool(n),sl.addTool(n);break}case"draw(protractor)":{let n=new rpe;n.drawing=!0,this.tool.setNextTool(n);break}case"draw(rect)":{let n=new Tc("Line");n.drawing=!0,this.tool.setNextTool(n),Wh.setTool(n);break}case"draw(ROutline)":{let n=new Tc("Board Outline");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RSlot)":{let n=new Tc("Slot Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RRegion)":{if(x.getInstance().doctype===4&&be.getAllPinLayerIds().includes(be.getActiveLayer().layerID)){let n=new Nw(a=>{if(a){let l=new Tc("Fill Region");l.drawing=!0,this.tool.setNextTool(l)}}),s={command:"selectPadWithRegion",program:n,msg:"Please select a pad to associate"};A.publish("toggle",s)}else{let n=new Tc("Fill Region");n.drawing=!0,this.tool.setNextTool(n)}break}case"draw(annotation)":{let n=new Tc("Annotation");n.drawing=!0,this.tool.setNextTool(n);break}case"drawpartition(Rectangle)":{let n=new Tc("Partition");n.drawing=!0,this.tool.setNextTool(n);break}case"drawpartition(Circle)":{let n=new Sh("Partition");n.drawing=!0,this.tool.setNextTool(n);break}case"drawpartition(Polygon)":{let n=new rc("Partition");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RCutout)":{let n=new Tc("Cutout");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(CCutout)":{let n=new Sh("Cutout");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(PCutout)":{let n=new rc("Cutout");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RectFPCStiffener)":{let n=new Tc("FPC Stiffener");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RProhibit)":{let n=new Tc("Prohibited Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RConstraint)":{let n=new Tc("Constraint Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RCopper)":{let n=new Tc("Copper Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(stretchtrack)":{let n=new O3;if(n.drawing=!0,e.length==1){let s=e[0];if(n.source=!0,s instanceof Ar){let{x:a,y:l}=Ve.getLastClickPosition();n.addTrack(s,a,l)}else s instanceof Si&&n.addArcTracK(s)}this.tool.setNextTool(n);break}case"draw(circle)":{let n=new Sh("Line");n.drawing=!0,this.tool.setNextTool(n),Wh.setTool(n);break}case"draw(COutline)":{let n=new Sh("Board Outline");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(CSlot)":{let n=new Sh("Slot Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(CRegion)":{if(x.getInstance().doctype===4&&be.getAllPinLayerIds().includes(be.getActiveLayer().layerID)){let n=new Nw(a=>{if(a){let l=new Sh("Fill Region");l.drawing=!0,this.tool.setNextTool(l)}}),s={command:"selectPadWithRegion",program:n,msg:"Please select a pad to associate"};A.publish("toggle",s)}else{let n=new Sh("Fill Region");n.drawing=!0,this.tool.setNextTool(n)}break}case"draw(CirFPCStiffener)":{let n=new Sh("FPC Stiffener");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(CProhibit)":{let n=new Sh("Prohibited Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(CConstraint)":{let n=new Sh("Constraint Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(CCopper)":{let n=new Sh("Copper Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(POutline)":{let n=new rc("Board Outline");n.drawing=!0,sl.addTool(n),this.tool.setNextTool(n);break}case"draw(Line)":{let n=new rc("Line");sl.addTool(n),n.drawing=!0,this.tool.setNextTool(n),Wh.setTool(n);break}case"draw(PSlot)":{let n=new rc("Slot Region");n.drawing=!0,sl.addTool(n),this.tool.setNextTool(n);break}case"draw(PRegion)":{if(x.getInstance().doctype===4&&be.getAllPinLayerIds().includes(be.getActiveLayer().layerID)){let n=new Nw(a=>{if(a){let l=new rc("Fill Region");sl.addTool(l),l.drawing=!0,this.tool.setNextTool(l)}}),s={command:"selectPadWithRegion",program:n,msg:"Please select a pad to associate"};A.publish("toggle",s)}else{let n=new rc("Fill Region");sl.addTool(n),n.drawing=!0,this.tool.setNextTool(n)}break}case"draw(PolyFPCStiffener)":{let n=new rc("FPC Stiffener");n.drawing=!0,sl.addTool(n),this.tool.setNextTool(n);break}case"draw(PProhibit)":{let n=new rc("Prohibited Region");n.drawing=!0,sl.addTool(n),this.tool.setNextTool(n);break}case"draw(PConstraint)":{let n=new rc("Constraint Region");n.drawing=!0,sl.addTool(n),this.tool.setNextTool(n);break}case"draw(PCopper)":{let n=new rc("Copper Region");n.drawing=!0,sl.addTool(n),this.tool.setNextTool(n);break}case"draw(dimension)":{let n=new ipe;n.drawing=!0,this.tool.setNextTool(n);break}case"dropdrag":{this.tool.setNextTool(new dh),ao.setTool(Ve),Yo.setTool(Ve),Ve.dragging=!1,Ve.getSelects().length==0?(yi.setNonSelect(),Yh.type&&Yh.exitSketcherAttrView({type:Yh.type})):A.publish("flushSelectingInfo",""),yi.dropDrag=!0;break}case"COPY":{this.isHoldPCBAttrPanel=!0;let n=ZT.filter(e);if(n.length>0){if(A.publish("clearImageCopy","",$()),ce.pcbConfig.referencePointPcbSelectMethod=="select"){let s=new Fw;this.tool.setNextTool(s),yi.setPlace()}else Fw.copy(n),this.tool.setNextTool(new dh),this.lastCmd="dropdrag",we.setCommand(this.lastCmd);i instanceof dh&&(i.realdTimeHighLight.cancelhighLight(),i.realTimeHighLightNet.cancelHighLight())}else this.tool.setNextTool(new dh),this.lastCmd="dropdrag",we.setCommand(this.lastCmd);break}case"PASTE":{Yo.setTool(ic),this.tool.setNextTool(new iO),yi.setPlace();break}case"selectCenterObjectForVertical":case"selectCenterObjectForHorizontal":case"selectRefObjectForAlignLeft":case"selectRefObjectForAlignRight":case"selectRefObjectForAlignTop":case"selectRefObjectForAlignBottom":{let n=J$[t],s,a=new R9(0,0,[(l,c)=>{let h=Array.from(Wr.pointSelectBeforeFilter(l,c).getResult(dm)),u=Ve.getSelects();s=h.filter(m=>u.includes(m))[0];let d=zw(s),p;switch(n){case"align_left":case"align_right":p=!we.flipBoard==(n=="align_left")?d.LL():d.UR();break;case"align_top":p=d.UL();break;case"align_bottom":p=d.LR();break;case"align_vertical_center":case"align_horizontal_center":p=d.center();break;default:break}A.publish("alignSelectedObjs",{cmd:n,refPoint:p,refItemId:s.globalIndex}),A.publish("tool","dropdrag"),A.publish("select",e),A.publish("flushSelectingInfo","")}],(l,c)=>{let h=Array.from(Wr.pointSelectBeforeFilter(l,c).getResult(dm)),u=Ve.getSelects(),d=h.filter(p=>u.includes(p))[0];return h.length>0&&d!=null});A.publish("toggle",{command:"referencePoint",program:a,msg:"Please Select The Reference Object"});break}case"selectStartPoint":case"selectCenterPoint":{let n=new R9(0,0,[(s,a)=>{let l=x.getInstance().origin;A.publish("showArrayDistributionDlg",{refPoint:{x:s-l.x,y:a-l.y},unit:x.getInstance().unit},$())}]);A.publish("toggle",{command:"referencePoint",program:n,msg:t=="selectStartPoint"?"Please select a starting point":"Please select a center point"});break}case"CLIP":{if(ZT.filter(e).length>0){if(A.publish("clearImageCopy","",$()),ce.pcbConfig.referencePointPcbSelectMethod=="select"){let s=new xN;this.tool.setNextTool(s),yi.setPlace()}else xN.clip(),this.tool.setNextTool(new dh),this.lastCmd="dropdrag",we.setCommand(this.lastCmd);i instanceof dh&&(i.realdTimeHighLight.cancelhighLight(),i.realTimeHighLightNet.cancelHighLight())}else this.tool.setNextTool(new dh),this.lastCmd="dropdrag",we.setCommand(this.lastCmd);break}case"boxselect":{this.tool.setNextTool(new npe);break}case"component_distribute_by_region":{this.tool.setNextTool(new Qpe);break}case"draw(radius)":{let n=new ope;n.drawing=!0,this.tool.setNextTool(n);break}case"CreepageDistance":case"MeasureDistance":case"MeasureObjectDistance":{Hh.measureMode=t;let n=new iU(e);n.drawing=!0,this.tool.setNextTool(n),this.isHoldPCBAttrPanel=n.isHoldPCBAttrPanel;break}case"copySpecial":{let n=new p0e(e);n.drawing=!0,this.tool.setNextTool(n),this.isHoldPCBAttrPanel=n.isHoldPCBAttrPanel;break}case"continuousSelection":{let n=new Lpe;n.drawing=!0,this.tool.setNextTool(n);break}case"rectangleOutside":{let n=new K$;n.drawing=!0,this.tool.setNextTool(n);break}case"rectangleInside":{let n=new K$(!0);n.drawing=!0,this.tool.setNextTool(n);break}case"polygonInside":{let n=new Npe;n.drawing=!0,this.tool.setNextTool(n);break}case"polygonOutside":{let n=new kpe;n.drawing=!0,this.tool.setNextTool(n);break}case"lineTouched":{let n=new Bpe;n.drawing=!0,this.tool.setNextTool(n);break}case"connectedCopper":{let n=new n0e;i instanceof dh&&(i.realdTimeHighLight.cancelhighLight(),i.realTimeHighLightNet.cancelHighLight()),n.drawing=!0,this.tool.setNextTool(n);break}case"crossProbeTool":{let n=new eK;n.drawing=!0,this.tool.setNextTool(n);break}case"customPathRenumberPads":{let n=new Zpe;n.drawing=!0,this.tool.setNextTool(n);break}case"draw(R3dShellOutline)":{let n=new Tc("3D Shell - Outline");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(C3dShellOutline)":{let n=new Sh("3D Shell - Outline");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(P3dShellOutline)":{let n=new rc("3D Shell - Outline");n.drawing=!0,sl.addTool(n),this.tool.setNextTool(n);break}case"place_part(3dShellScrewPillar)":{let n=new DU;n.drawing=!0,sl.addTool(n),yi.setPlace(),this.tool.setNextTool(n);break}case"draw(3dShellSideSlotDatumLine)":{let n=new wU;n.drawing=!0,this.tool.setNextTool(n);break}case"draw(R3dShellSideSlotRegion)":{uh.toggleTool(),uh.setOnceCallback(()=>{let n=new Tc("3D Shell - Side Slot Region");n.drawing=!0,yi.setDraw(),this.tool.setNextTool(n)});break}case"draw(C3dShellSideSlotRegion)":{uh.toggleTool(),uh.setOnceCallback(()=>{let n=new Sh("3D Shell - Side Slot Region");n.drawing=!0,yi.setDraw(),this.tool.setNextTool(n)});break}case"draw(P3dShellSideSlotRegion)":{uh.toggleTool(),uh.setOnceCallback(()=>{let n=new rc("3D Shell - Side Slot Region");n.drawing=!0,yi.setDraw(),sl.addTool(n),this.tool.setNextTool(n)});break}case"draw(R3dShellTopSlotRegion)":{let n=new Tc("3D Shell - Top Slot Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(C3dShellTopSlotRegion)":{let n=new Sh("3D Shell - Top Slot Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(P3dShellTopSlotRegion)":{let n=new rc("3D Shell - Top Slot Region");n.drawing=!0,sl.addTool(n),this.tool.setNextTool(n);break}case"draw(R3dShellSideEntity)":{uh.toggleTool(),uh.setOnceCallback(()=>{let n=new Tc("3D Shell - Side Entity");n.drawing=!0,yi.setDraw(),this.tool.setNextTool(n)});break}case"draw(C3dShellSideEntity)":{uh.toggleTool(),uh.setOnceCallback(()=>{let n=new Sh("3D Shell - Side Entity");n.drawing=!0,yi.setDraw(),this.tool.setNextTool(n)});break}case"draw(P3dShellSideEntity)":{uh.toggleTool(),uh.setOnceCallback(()=>{let n=new rc("3D Shell - Side Entity");n.drawing=!0,yi.setDraw(),sl.addTool(n),this.tool.setNextTool(n)});break}case"draw(R3dShellTopBottomEntity)":{let n=new Tc("3D Shell - Top/Bottom Entity");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(C3dShellTopBottomEntity)":{let n=new Sh("3D Shell - Top/Bottom Entity");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(P3dShellTopBottomEntity)":{let n=new rc("3D Shell - Top/Bottom Entity");n.drawing=!0,sl.addTool(n),this.tool.setNextTool(n);break}case"place_part(stack_table)":{let n=new qpe;n.drawing=!0,this.tool.setNextTool(n),yi.setPlace();break}case"place_part(drill_table)":{let n=new Aae;n.drawing=!0,this.tool.setNextTool(n),yi.setPlace();break}case"connectPads":{let n=new i0e;n.drawing=!0,this.tool.setNextTool(n),yi.setPlace();break}case"Split":{let n=new s0e;n.initSplitUtils(e),e.forEach(s=>s.click()),sl.addTool(n),n.drawing=!0,this.isHoldPCBAttrPanel=!0,this.tool.setNextTool(n),Wh.setTool(n),Ve.setTool(n);break}case"SelectHelp":{let n=new UU;n.drawing=!0,yi.setPlace(),this.tool.setNextTool(n);break}}A.publish("updateCrossDirect",Pi.getInstance()),A.publish("refreshNextTool",""),A.publish("updateFrame",""),this.isHoldPCBAttrPanel||A.publish("flushSelectingInfo","")}placeText(){this.lastCmd=null,this.update("place_part(pcbtext)")}drawImage(t){if(yi.dropDrag=!1,this.lastCmd==="DrawImage")return;this.lastCmd="DrawImage",this.tool.interrupt();let e=new lpe(t);this.tool.setNextTool(e),yi.setPlace(),A.publish("refreshNextTool","")}drawTrueColorPicture(t){if(yi.dropDrag=!1,this.lastCmd==="DrawImage")return;this.lastCmd="DrawImage",this.tool.interrupt();let e=new rU(t);this.tool.setNextTool(e),yi.setPlace(),A.publish("refreshNextTool","")}toggleRedraw(t){this.lastCmd!=="redrawPolygon"&&ls.getInstance().init([t.profile],"edit Polygon node check lock",(e,r)=>{yi.dropDrag=!1,this.lastCmd="redrawPolygon",this.tool.interrupt();let i=new hpe(t.shapes,t.last,t.start,t.curr,t.profile,t.nextshapes,t.index,r.getCommand());sl.addTool(i),WC.ready=!0,this.tool.setNextTool(i)})}toggleRedrawPad(t){this.lastCmd!=="redrawPolygonPad"&&ls.getInstance().init([t.profile],"edit Polygon node check lock",(e,r)=>{yi.dropDrag=!1,this.lastCmd="redrawPolygonPad",this.tool.interrupt();let i=new xU(t.shapes,t.last,t.start,t.curr,t.profile,t.padDrillModels,r.getCommand(),t.history);this.tool.setNextTool(i)})}toggleEditPad(t){let e="editPadShape";this.lastCmd=e,A.publish("clearDimension","");let r=Ve.getSelects();if(r.length==1&&r[0]instanceof fn){let i=new wN(t.history);i.setPad(r[0]),this.tool.setNextTool(i),yi.currentCanUndoTool=!0}}toggle(t){if(x.getInstance().isReadOnlyMode)switch(t){case"referencePoint":case"referencePoint1":case"selectPadWithRegion":case"selectDatumLineWithRegion":break;default:return}if(!this.needMultiToggle(t.command)&&this.lastCmd===t.command)return;Mn.getInstance().allowPull=!0,this.tool.clearCrossFlag(),yi.dropDrag=!1,yi.setDraw();let e=this.tool.getNextTool(),r=t.command;if(this.openCopperInterruptDialog(t),r!=null){A.publish("clearDimension","");let i=this.lastCmd;switch(this.lastCmd=r,we.setCommand(r),r){case"draw(snake_track)":{Ve.onMouseLeftUp(Pi.getInstance()),this.tool.interrupt(),yi.setArea(["increaseSnakeGap","decreaseSnakeGap"]);let n=t.isDiffPair,s=t.data,a=!!s;s||(s=n?FAe.getDiffPairSnakeTrackToolConfig():FAe.getSnakeTrackToolConfig()),t.startPoint&&t.startPoint instanceof S&&(s.startPoint=t.startPoint,s.reOpenDialog=!0);let l;l=n?new $w(s.isSingleSide,s.type,s.width,s.minHeight,s.startPoint,s.mouseXY,s.restrictLength,s.additionalLength,s.reOpenDialog,s.addedTo,a):new qw(s.isSingleSide,s.type,s.width,s.minHeight,s.startPoint,s.mouseXY,s.restrictLength,s.additionalLength,s.reOpenDialog,s.addedTo,a),Wh.setTool(l),we.drawing=!0,this.tool.setNextTool(l);break}case"MouseSelect":{let n=new MN(t.cmd);this.tool.setNextTool(n);break}case"referencePoint":{let n=new cpe(this.tool,this.tool.drawing,this.tool.getNextTool(),t.program,t.msg);this.tool.setNextTool(n);break}case"referencePoint1":{let n=new WU(this.tool,this.tool.drawing,this.tool.getNextTool(),t.program,t.msg,t.assignReferPoint,t.needInput);this.tool.setNextTool(n);break}case"netSelect":{let n=this.tool.getNextTool();if(!Bt.isChildPcb()&&(!n||!(n instanceof Z$))){let s=new Z$(this.tool,i,this.tool.drawing,this.tool.getNextTool(),t.pcbBridgingCopperIndex);this.tool.setNextTool(s)}break}case"differentailNetSelect":{let n=t.formData,s=t.type,a=new LN(this.tool,this.tool.drawing,this.tool.getNextTool(),n,s);yi.setPlace(),this.tool.setNextTool(a);break}case"PadsPairPadSelect":{let n=t.formData,s=new MU(this.tool,this.tool.drawing,this.tool.getNextTool(),n);this.tool.setNextTool(s);break}case"batchMoveItem":case"BatchMoveSequentialItem":{let n=this.tool.getNextTool(),s=new e0e(this.tool,n);this.tool.setNextTool(s),s.execute(t);break}case"importDxf":{this.tool.interrupt();let n=xD.getInstance();this.tool.setNextTool(n);break}case"insertNode":{let n=Ve.getSelects(),{ready:s,position:a,selects:l}=t;ls.getInstance().init(l||n,"insert node check lock",(c,h)=>{s&&this.tool.interrupt();let u=new lue({selects:c},h);this.tool.setNextTool(u),s&&a&&u.changeToReady(a)});break}case"editOutline":{this.tool.interrupt();let n=new kU(t.item);n.initUtils(t.item),this.tool.setNextTool(n);break}case"placeComponent":{this.tool.interrupt();let n=new HU(t.device,t.source);this.tool.setNextTool(n),yi.setPlace();break}case"AddChamfer":{ls.getInstance().init(t.items,"add chamfer check lock",(n,s)=>{this.tool.interrupt();let a=new Ype(n,s.getCommand(),t.type);this.tool.setNextTool(a)});break}case"selectPadWithRegion":{let n=new jpe(this.tool,this.tool.drawing,this.tool.getNextTool(),t.program,t.msg);this.tool.setNextTool(n);break}case"selectDatumLineWithRegion":{let n=new Xpe(this.tool,this.tool.drawing,this.tool.getNextTool(),t.msg);yi.setPlace(),this.tool.setNextTool(n);break}case"MOVE_NODE":{let n=new LU(t.commands,t.filterItems,t.options);this.tool.setNextTool(n);let s=t.inputInfo;Pi.getInstance().realSceneX=s.x||s.realSceneX,Pi.getInstance().realSceneY=s.y||s.realSceneY,n.onMouseLeftDown(Pi.getInstance());break}case"PASTE2":{e instanceof dh&&(e.realdTimeHighLight.cancelhighLight(),e.realTimeHighLightNet.cancelHighLight()),Yo.setTool(ic);let n=new Q_(Ve.getSelects(),null,t.layerId);this.tool.setNextTool(n),yi.setPlace(),t.layerId?n.copyToOtherLayer(Ve.getSelects(),t.layerId):n.copyToCursor(Ve.getSelects());break}case"placePcb":{let n=new r0e(t.module);this.tool.setNextTool(n),n.drawing=!0,yi.setPlace(),n.hasItems().then(s=>{s||(A.publish("ui/toastMsg",{type:"warn",msg:"Place content empty!"},$()),A.publish("tool","dropdrag"))});break}}A.publish("updateCrossDirect",Pi.getInstance())}}needMultiToggle(t){switch(t){case"PASTE2":return!1;default:return!0}}needClearStatus(t){switch(t){case"selectStartPoint":case"selectCenterPoint":case"selectRefObjectForAlignLeft":case"selectRefObjectForAlignRight":case"selectRefObjectForAlignTop":case"selectRefObjectForAlignBottom":case"selectCenterObjectForVertical":case"selectCenterObjectForHorizontal":case"boxselect":case"component_distribute_by_region":case"netSelect":case"COPY":case"CLIP":case"customPathRenumberPads":case"rectangleInside":case"rectangleOutside":case"polygonInside":case"polygonOutside":case"lineTouched":case"connectedCopper":case"continuousSelection":case"draw(RCutout)":case"draw(CCutout)":case"draw(PCutout)":case"crossProbeTool":return!1;default:return!0}}};var Fqe=1.5,m0e=class extends ko{constructor(){super();this.isMouseRightDown=!1;this.prevRightX=0;this.prevRightY=0;this.isMouseMidDown=!1;this.prevMidY=0;this.zoomCenter=Mt.ORIGIN;this.camera=Ni(),A.subscribe("adaptAll",e=>{let{tabId:r}=e||{},i=x.getInstance();if(!(![23].includes(i.doctype)||(r?i.tabId!=r:!i.isactive))){if(Vt.size()>0){let n=Lc(),s=new _e;n.forEach(l=>{if(l.isVisible){if(l instanceof fr&&l.getText()=="")return;s.ext1(l.buildBBox())}});let a=Ii.getBBox();if(a instanceof ut&&s.ext1(a),Ta){let l=Ta.buildBox();if(s.ext1(l),s.valid()){let c=s.build1();vI(this.camera,c,.8)}}else if(s.valid()){let l=s.build1();vI(this.camera,l,.8)}}A.publish("updateFrame","")}}),A.subscribe("adaptBBox",(e,r=.8)=>{vI(this.camera,e,r),A.publish("updateFrame","")}),A.messageBus.rpcService("FootprintPadSize",()=>new Promise((e,r)=>{let i=Kt.getAllItem(),n={},s={};for(let a=0;a<i.length;a++){let l=i[a],c=l.getDimensionBBox();s[l.num]||(s[l.num]=[]),s[l.num].push(l.globalIndex),n[l.num]={width:c.width()*10,height:c.height()*10,number:l.globalIndex,no:l.num,gIdArr:s[l.num]}}e(Object.keys(n).map(a=>({...n[a]})))})),A.messageBus.rpcService("HighlightItemsInPreview",this.highlightItems.bind(this)),A.messageBus.rpcService("PreviewPanelize",e=>new _p().applyPanelize(e)),A.globalMessageBus.rpcService("PreviewPanelize2",e=>new _p().applyPanelize(e)),A.messageBus.subscribe("PreviewHighLightTool",()=>{let e=new CU;this.setNextTool(e)})}onKeyDown(e){A.publish("pcb_hotkey",{keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey},$())}onKeyUp(e){A.publish("pcb_hotkey",{keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey},$())}onMouseRightDown(e){this.prepare(e),e.realSceneDeltaX=0,e.realSceneDeltay=0,e.rightDown=!0,e.openMenu=!0,e.downTime=new Date().getTime(),this.isMouseRightDown=!0,this.prevRightX=e.mouseX,this.prevRightY=e.mouseY}onMouseLeftDown(e){F_(frameElement,"isPackageManager")=="true"&&(Ta?Ta.onMouseLeftDown(e):Vt.size()>0&&Kt.getAllItem().forEach(r=>{r.isSelect(e.realSceneX,e.realSceneY)?(r.click(),A.publish("setHighlightRowByNumber",r.num,$())):r.visible()}))}onDoubleClick(e){let r=(parent==null?void 0:parent.document.getElementsByTagName("iframe"))||[];for(let i of Array.from(r))i.contentWindow===window&&F_(i,"click_to_place")=="true"&&A.publish("clickPlaceBtn",x.getInstance().id,$())}onMouseRightUp(e){var r;this.prepare(e),this.isMouseRightDown=!1,e.openMenu&&A.publish("showPreviewRightClickMenu",{x:e.mouseX,y:e.mouseY,iframeElementId:(r=window.frameElement)==null?void 0:r.id,isEnableRemovableByBlur:!0},$()),e.rightDown=!1,e.openMenu=!1}onMouseMove(e){let r=new Date().getTime();if(this.isMouseRightDown){let i=e.mouseX-this.prevRightX,n=e.mouseY-this.prevRightY;this.camera.addOffset1(i,n),this.prevRightX=e.mouseX,this.prevRightY=e.mouseY}if(this.isMouseMidDown){let n=1-(e.mouseY-this.prevMidY)/e.canvasHeight*20;n<0&&(n=1),this.setScale(n),this.prevMidY=e.mouseY}this.prepare(e),e.rightDown&&r-e.downTime<120?e.openMenu=!0:e.rightDown&&(e.realSceneDeltaX!=0||e.realSceneDeltay!=0)&&(e.openMenu=!1),Ta&&Ta.onMouseMove(e),this.handler(i=>{i.onMouseMove(e)})}onMouseWheel(e){this.prepare(e);let r;e.deltaY<0?r=Fqe:r=1/Fqe,this.markZoomCenter(e),this.setScale(r),this.prepare(e)}onResize(e){x.getInstance().resize()}prepare(e){let r=this.mouseRealOffset(e);e.realSceneDeltaX=r.x-e.realSceneX,e.realSceneDeltay=r.y-e.realSceneY,e.realSceneX=r.x,e.realSceneY=r.y}markZoomCenter(e){this.zoomCenter=new Mt(e.mouseX,e.mouseY,0)}setScale(e){let r=this.camera.getScale();!isNaN(r)&&r!=0&&this.camera.scaleAtPoint1(e,this.zoomCenter.x,this.zoomCenter.y)}mouseRealOffset(e){let r=new Mt(e.mouseX,-e.mouseY,0),i=new Mt(e.canvasWidth/2,-e.canvasHeight/2,0);return r.sub(i).multiply4(this.camera.get2dCameraMatrix().inverse())}highlightItems(e){if(A.publish("clearSelect",""),e.length==0)return;let r=new er;e.forEach(i=>{let n=kt.getItem(i),s;if(n)n.getItems().forEach(a=>{a.click()});else{if(s=r.getItem(i),!s)return;$t.filter([s]).size>0&&(s instanceof Ki&&be.setActiveLayer(be.getLayer(s.layerId)),s.click())}}),A.publish("updateFrame","")}};var zqe=nd(Lb());function iwt(){function o(p=0,m=0){this.x=p,this.y=m}o.prototype.copy=function(){return new o(this.x,this.y)};function t(p,m,g){var y=p.length,b=m*g;this.w=m,this.h=g,this.size=b,b==y?this.data=new Int8Array(p):this.data=new Int8Array(b)}t.prototype.at=function(p,m){return p>=0&&p<this.w&&m>=0&&m<this.h&&this.data[this.w*m+p]===1},t.prototype.index=function(p){var m=new o;return m.y=Math.floor(p/this.w),m.x=p-m.y*this.w,m},t.prototype.flip=function(p,m){this.at(p,m)?this.data[this.w*m+p]=0:this.data[this.w*m+p]=1},t.prototype.copy=function(){return new t(this.data,this.w,this.h)};function e(){this.area=0,this.len=0,this.curve={},this.pt=[],this.minX=1e5,this.minY=1e5,this.maxX=-1,this.maxY=-1}function r(p){this.n=p,this.tag=new Array(p),this.c=new Array(p*3),this.alphaCurve=0,this.vertex=new Array(p),this.alpha=new Array(p),this.alpha0=new Array(p),this.beta=new Array(p)}var i=null,n=[],s={turnpolicy:"minority",turdsize:0,optcurve:!0,alphamax:1,opttolerance:.2};function a(p){var m;for(m in p)p.hasOwnProperty(m)&&s.hasOwnProperty(m)&&(s[m]=p[m])}function l(p,m){var g=p.copy(),y=new o(0,0),b,P=[];function T(O){for(var _=g.w*O.y+O.x;_<g.size&&g.data[_]!==1;)_++;return _<g.size&&g.index(_)}function I(O,_){var R,v,D;for(R=2;R<5;R++){for(D=0,v=-R+1;v<=R-1;v++)D+=g.at(O+v,_+R-1)?1:-1,D+=g.at(O+R-1,_+v-1)?1:-1,D+=g.at(O+v-1,_-R)?1:-1,D+=g.at(O-R,_+v)?1:-1;if(D>0)return 1;if(D<0)return 0}return 0}function C(O){var _=new e,R=O.x,v=O.y,D=0,w=1,F;for(_.sign=p.at(O.x,O.y)?"+":"-";_.pt.push(new o(R,v)),R>_.maxX&&(_.maxX=R),R<_.minX&&(_.minX=R),v>_.maxY&&(_.maxY=v),v<_.minY&&(_.minY=v),_.len++,R+=D,v+=w,_.area-=R*w,!(R===O.x&&v===O.y);){var H=g.at(R+(D+w-1)/2,v+(w-D-1)/2),z=g.at(R+(D-w-1)/2,v+(w+D-1)/2);z&&!H?m.turnpolicy==="right"||m.turnpolicy==="black"&&_.sign==="+"||m.turnpolicy==="white"&&_.sign==="-"||m.turnpolicy==="majority"&&I(R,v)||m.turnpolicy==="minority"&&!I(R,v)?(F=D,D=-w,w=F):(F=D,D=w,w=-F):z?(F=D,D=-w,w=F):H||(F=D,D=w,w=-F)}return _}function E(O){var _=O.pt[0].y,R=O.len,v,D,w,F,H,z;for(H=1;H<R;H++)if(v=O.pt[H].x,D=O.pt[H].y,D!==_){for(F=_<D?_:D,w=O.maxX,z=v;z<w;z++)g.flip(z,F);_=D}}for(;y=T(y);)b=C(y),E(b),b.area>m.turdsize&&P.push(b);return P}function c(p,m){function g(){this.data=[0,0,0,0,0,0,0,0,0]}g.prototype.at=function(X,Z){return this.data[X*3+Z]};function y(X,Z,Q,ae,he){this.x=X,this.y=Z,this.xy=Q,this.x2=ae,this.y2=he}function b(X,Z){return X>=Z?X%Z:X>=0?X:Z-1-(-1-X)%Z}function P(X,Z){return X.x*Z.y-X.y*Z.x}function T(X,Z,Q){return X<=Q?X<=Z&&Z<Q:X<=Z||Z<Q}function I(X){return X>0?1:X<0?-1:0}function C(X,Z){var Q=new Array(3),ae,he,re;for(Q[0]=Z.x,Q[1]=Z.y,Q[2]=1,re=0,ae=0;ae<3;ae++)for(he=0;he<3;he++)re+=Q[ae]*X.at(ae,he)*Q[he];return re}function E(X,Z,Q){var ae=new o;return ae.x=Z.x+X*(Q.x-Z.x),ae.y=Z.y+X*(Q.y-Z.y),ae}function O(X,Z){var Q=new o;return Q.y=I(Z.x-X.x),Q.x=-I(Z.y-X.y),Q}function _(X,Z){var Q=O(X,Z);return Q.y*(Z.x-X.x)-Q.x*(Z.y-X.y)}function R(X,Z,Q){var ae,he,re,se;return ae=Z.x-X.x,he=Z.y-X.y,re=Q.x-X.x,se=Q.y-X.y,ae*se-re*he}function v(X,Z,Q,ae){var he,re,se,K;return he=Z.x-X.x,re=Z.y-X.y,se=ae.x-Q.x,K=ae.y-Q.y,he*K-se*re}function D(X,Z,Q){var ae,he,re,se;return ae=Z.x-X.x,he=Z.y-X.y,re=Q.x-X.x,se=Q.y-X.y,ae*re+he*se}function w(X,Z,Q,ae){var he,re,se,K;return he=Z.x-X.x,re=Z.y-X.y,se=ae.x-Q.x,K=ae.y-Q.y,he*se+re*K}function F(X,Z){return Math.sqrt((X.x-Z.x)*(X.x-Z.x)+(X.y-Z.y)*(X.y-Z.y))}function H(X,Z,Q,ae,he){var re=1-X,se=new o;return se.x=re*re*re*Z.x+3*(re*re*X)*Q.x+3*(X*X*re)*ae.x+X*X*X*he.x,se.y=re*re*re*Z.y+3*(re*re*X)*Q.y+3*(X*X*re)*ae.y+X*X*X*he.y,se}function z(X,Z,Q,ae,he,re){var se,K,me,Oe,Ie,ue,Pe,j,J,oe;return se=v(X,Z,he,re),K=v(Z,Q,he,re),me=v(Q,ae,he,re),Oe=se-2*K+me,Ie=-2*se+2*K,ue=se,Pe=Ie*Ie-4*Oe*ue,Oe===0||Pe<0?-1:(j=Math.sqrt(Pe),J=(-Ie+j)/(2*Oe),oe=(-Ie-j)/(2*Oe),J>=0&&J<=1?J:oe>=0&&oe<=1?oe:-1)}function G(X){var Z,Q,ae;X.x0=X.pt[0].x,X.y0=X.pt[0].y,X.sums=[];var he=X.sums;for(he.push(new y(0,0,0,0,0)),Z=0;Z<X.len;Z++)Q=X.pt[Z].x-X.x0,ae=X.pt[Z].y-X.y0,he.push(new y(he[Z].x+Q,he[Z].y+ae,he[Z].xy+Q*ae,he[Z].x2+Q*Q,he[Z].y2+ae*ae))}function W(X){var Z=X.len,Q=X.pt,ae,he=new Array(Z),re=new Array(Z),se=new Array(4);X.lon=new Array(Z);var K=[new o,new o],me=new o,Oe=new o,Ie=new o,ue,Pe,j,J,oe,pe,ge,Se,De=0;for(Pe=Z-1;Pe>=0;Pe--)Q[Pe].x!=Q[De].x&&Q[Pe].y!=Q[De].y&&(De=Pe+1),re[Pe]=De;for(Pe=Z-1;Pe>=0;Pe--){for(se[0]=se[1]=se[2]=se[3]=0,ae=(3+3*(Q[b(Pe+1,Z)].x-Q[Pe].x)+(Q[b(Pe+1,Z)].y-Q[Pe].y))/2,se[ae]++,K[0].x=0,K[0].y=0,K[1].x=0,K[1].y=0,De=re[Pe],J=Pe;;){if(ue=0,ae=(3+3*I(Q[De].x-Q[J].x)+I(Q[De].y-Q[J].y))/2,se[ae]++,se[0]&&se[1]&&se[2]&&se[3]){he[Pe]=J,ue=1;break}if(me.x=Q[De].x-Q[Pe].x,me.y=Q[De].y-Q[Pe].y,P(K[0],me)<0||P(K[1],me)>0||(Math.abs(me.x)<=1&&Math.abs(me.y)<=1||(Oe.x=me.x+(me.y>=0&&(me.y>0||me.x<0)?1:-1),Oe.y=me.y+(me.x<=0&&(me.x<0||me.y<0)?1:-1),P(K[0],Oe)>=0&&(K[0].x=Oe.x,K[0].y=Oe.y),Oe.x=me.x+(me.y<=0&&(me.y<0||me.x<0)?1:-1),Oe.y=me.y+(me.x>=0&&(me.x>0||me.y<0)?1:-1),P(K[1],Oe)<=0&&(K[1].x=Oe.x,K[1].y=Oe.y)),J=De,De=re[J],!T(De,Pe,J)))break}ue===0&&(Ie.x=I(Q[De].x-Q[J].x),Ie.y=I(Q[De].y-Q[J].y),me.x=Q[J].x-Q[Pe].x,me.y=Q[J].y-Q[Pe].y,oe=P(K[0],me),pe=P(K[0],Ie),ge=P(K[1],me),Se=P(K[1],Ie),j=1e7,pe<0&&(j=Math.floor(oe/-pe)),Se>0&&(j=Math.min(j,Math.floor(-ge/Se))),he[Pe]=b(J+j,Z))}for(j=he[Z-1],X.lon[Z-1]=j,Pe=Z-2;Pe>=0;Pe--)T(Pe+1,he[Pe],j)&&(j=he[Pe]),X.lon[Pe]=j;for(Pe=Z-1;T(b(Pe+1,Z),j,X.lon[Pe]);Pe--)X.lon[Pe]=j}function L(X){function Z(pe,ge,Se){var De=pe.len,tt=pe.pt,Ze=pe.sums,Wt,Nr,Lr,Dr,Rr,ke,Yt,Ut,ar,Fe,it,ye,bt,zt,de=0;return Se>=De&&(Se-=De,de=1),de===0?(Wt=Ze[Se+1].x-Ze[ge].x,Nr=Ze[Se+1].y-Ze[ge].y,Dr=Ze[Se+1].x2-Ze[ge].x2,Lr=Ze[Se+1].xy-Ze[ge].xy,Rr=Ze[Se+1].y2-Ze[ge].y2,ke=Se+1-ge):(Wt=Ze[Se+1].x-Ze[ge].x+Ze[De].x,Nr=Ze[Se+1].y-Ze[ge].y+Ze[De].y,Dr=Ze[Se+1].x2-Ze[ge].x2+Ze[De].x2,Lr=Ze[Se+1].xy-Ze[ge].xy+Ze[De].xy,Rr=Ze[Se+1].y2-Ze[ge].y2+Ze[De].y2,ke=Se+1-ge+De),it=(tt[ge].x+tt[Se].x)/2-tt[0].x,ye=(tt[ge].y+tt[Se].y)/2-tt[0].y,zt=tt[Se].x-tt[ge].x,bt=-(tt[Se].y-tt[ge].y),Yt=(Dr-2*Wt*it)/ke+it*it,Ut=(Lr-Wt*ye-Nr*it)/ke+it*ye,ar=(Rr-2*Nr*ye)/ke+ye*ye,Fe=bt*bt*Yt+2*bt*zt*Ut+zt*zt*ar,Math.sqrt(Fe)}var Q,ae,he,re,se=X.len,K=new Array(se+1),me=new Array(se+1),Oe=new Array(se),Ie=new Array(se+1),ue=new Array(se+1),Pe=new Array(se+1),j,J,oe;for(Q=0;Q<se;Q++)oe=b(X.lon[b(Q-1,se)]-1,se),oe==Q&&(oe=b(Q+1,se)),oe<Q?Oe[Q]=se:Oe[Q]=oe;for(ae=1,Q=0;Q<se;Q++)for(;ae<=Oe[Q];)Ie[ae]=Q,ae++;for(Q=0,ae=0;Q<se;ae++)ue[ae]=Q,Q=Oe[Q];for(ue[ae]=se,he=ae,Q=se,ae=he;ae>0;ae--)Pe[ae]=Q,Q=Ie[Q];for(Pe[0]=0,K[0]=0,ae=1;ae<=he;ae++)for(Q=Pe[ae];Q<=ue[ae];Q++){for(J=-1,re=ue[ae-1];re>=Ie[Q];re--)j=Z(X,re,Q)+K[re],(J<0||j<J)&&(me[Q]=re,J=j);K[Q]=J}for(X.m=he,X.po=new Array(he),Q=se,ae=he-1;Q>0;ae--)Q=me[Q],X.po[ae]=Q}function B(X){function Z(Yt,Ut,ar,Fe,it){for(var ye=Yt.len,bt=Yt.sums,zt,de,qe,lt,Ne,et,At,dr,vr,Zr,xi,Zi=0;ar>=ye;)ar-=ye,Zi+=1;for(;Ut>=ye;)Ut-=ye,Zi-=1;for(;ar<0;)ar+=ye,Zi-=1;for(;Ut<0;)Ut+=ye,Zi+=1;zt=bt[ar+1].x-bt[Ut].x+Zi*bt[ye].x,de=bt[ar+1].y-bt[Ut].y+Zi*bt[ye].y,qe=bt[ar+1].x2-bt[Ut].x2+Zi*bt[ye].x2,lt=bt[ar+1].xy-bt[Ut].xy+Zi*bt[ye].xy,Ne=bt[ar+1].y2-bt[Ut].y2+Zi*bt[ye].y2,et=ar+1-Ut+Zi*ye,Fe.x=zt/et,Fe.y=de/et,At=(qe-zt*zt/et)/et,dr=(lt-zt*de/et)/et,vr=(Ne-de*de/et)/et,Zr=(At+vr+Math.sqrt((At-vr)*(At-vr)+4*dr*dr))/2,At-=Zr,vr-=Zr,Math.abs(At)>=Math.abs(vr)?(xi=Math.sqrt(At*At+dr*dr),xi!==0&&(it.x=-dr/xi,it.y=At/xi)):(xi=Math.sqrt(vr*vr+dr*dr),xi!==0&&(it.x=-vr/xi,it.y=dr/xi)),xi===0&&(it.x=it.y=0)}var Q=X.m,ae=X.po,he=X.len,re=X.pt,se=X.x0,K=X.y0,me=new Array(Q),Oe=new Array(Q),Ie=new Array(Q),ue=new Array(3),Pe,j,J,oe,pe,ge=new o;for(X.curve=new r(Q),j=0;j<Q;j++)J=ae[b(j+1,Q)],J=b(J-ae[j],he)+ae[j],me[j]=new o,Oe[j]=new o,Z(X,ae[j],J,me[j],Oe[j]);for(j=0;j<Q;j++)if(Ie[j]=new g,Pe=Oe[j].x*Oe[j].x+Oe[j].y*Oe[j].y,Pe===0)for(J=0;J<3;J++)for(oe=0;oe<3;oe++)Ie[j].data[J*3+oe]=0;else for(ue[0]=Oe[j].y,ue[1]=-Oe[j].x,ue[2]=-ue[1]*me[j].y-ue[0]*me[j].x,pe=0;pe<3;pe++)for(oe=0;oe<3;oe++)Ie[j].data[pe*3+oe]=ue[pe]*ue[oe]/Pe;var Se,De,tt,Ze,Wt,Nr,Lr,Dr,Rr,ke;for(j=0;j<Q;j++){for(Se=new g,De=new o,ge.x=re[ae[j]].x-se,ge.y=re[ae[j]].y-K,J=b(j-1,Q),pe=0;pe<3;pe++)for(oe=0;oe<3;oe++)Se.data[pe*3+oe]=Ie[J].at(pe,oe)+Ie[j].at(pe,oe);for(;;){if(Wt=Se.at(0,0)*Se.at(1,1)-Se.at(0,1)*Se.at(1,0),Wt!==0){De.x=(-Se.at(0,2)*Se.at(1,1)+Se.at(1,2)*Se.at(0,1))/Wt,De.y=(Se.at(0,2)*Se.at(1,0)-Se.at(1,2)*Se.at(0,0))/Wt;break}for(Se.at(0,0)>Se.at(1,1)?(ue[0]=-Se.at(0,1),ue[1]=Se.at(0,0)):Se.at(1,1)?(ue[0]=-Se.at(1,1),ue[1]=Se.at(1,0)):(ue[0]=1,ue[1]=0),Pe=ue[0]*ue[0]+ue[1]*ue[1],ue[2]=-ue[1]*ge.y-ue[0]*ge.x,pe=0;pe<3;pe++)for(oe=0;oe<3;oe++)Se.data[pe*3+oe]+=ue[pe]*ue[oe]/Pe}if(tt=Math.abs(De.x-ge.x),Ze=Math.abs(De.y-ge.y),tt<=.5&&Ze<=.5){X.curve.vertex[j]=new o(De.x+se,De.y+K);continue}if(Nr=C(Se,ge),Dr=ge.x,Rr=ge.y,Se.at(0,0)!==0)for(ke=0;ke<2;ke++)De.y=ge.y-.5+ke,De.x=-(Se.at(0,1)*De.y+Se.at(0,2))/Se.at(0,0),tt=Math.abs(De.x-ge.x),Lr=C(Se,De),tt<=.5&&Lr<Nr&&(Nr=Lr,Dr=De.x,Rr=De.y);if(Se.at(1,1)!==0)for(ke=0;ke<2;ke++)De.x=ge.x-.5+ke,De.y=-(Se.at(1,0)*De.x+Se.at(1,2))/Se.at(1,1),Ze=Math.abs(De.y-ge.y),Lr=C(Se,De),Ze<=.5&&Lr<Nr&&(Nr=Lr,Dr=De.x,Rr=De.y);for(pe=0;pe<2;pe++)for(oe=0;oe<2;oe++)De.x=ge.x-.5+pe,De.y=ge.y-.5+oe,Lr=C(Se,De),Lr<Nr&&(Nr=Lr,Dr=De.x,Rr=De.y);X.curve.vertex[j]=new o(Dr+se,Rr+K)}}function N(X){var Z=X.curve,Q=Z.n,ae=Z.vertex,he,re,se;for(he=0,re=Q-1;he<re;he++,re--)se=ae[he],ae[he]=ae[re],ae[re]=se}function U(X){var Z=X.curve.n,Q=X.curve,ae,he,re,se,K,me,Oe,Ie,ue;for(ae=0;ae<Z;ae++)he=b(ae+1,Z),re=b(ae+2,Z),ue=E(1/2,Q.vertex[re],Q.vertex[he]),K=_(Q.vertex[ae],Q.vertex[re]),K!==0?(se=R(Q.vertex[ae],Q.vertex[he],Q.vertex[re])/K,se=Math.abs(se),me=se>1?1-1/se:0,me=me/.75):me=4/3,Q.alpha0[he]=me,me>=m.alphamax?(Q.tag[he]="CORNER",Q.c[3*he+1]=Q.vertex[he],Q.c[3*he+2]=ue):(me<.55?me=.55:me>1&&(me=1),Oe=E(.5+.5*me,Q.vertex[ae],Q.vertex[he]),Ie=E(.5+.5*me,Q.vertex[re],Q.vertex[he]),Q.tag[he]="CURVE",Q.c[3*he+0]=Oe,Q.c[3*he+1]=Ie,Q.c[3*he+2]=ue),Q.alpha[he]=me,Q.beta[he]=.5;Q.alphacurve=1}function k(X){function Z(){this.pen=0,this.c=[new o,new o],this.t=0,this.s=0,this.alpha=0}function Q(Lr,Dr,Rr,ke,Yt,Ut,ar){var Fe=Lr.curve.n,it=Lr.curve,ye=it.vertex,bt,zt,de,qe,lt,Ne,et,At,dr,vr,Zr,xi,Zi,Fi,$i,yo,Ha,da,Ic,kp,Cc,Dt,Al;if(Dr==Rr||(bt=Dr,lt=b(Dr+1,Fe),zt=b(bt+1,Fe),qe=Ut[zt],qe===0))return 1;for(At=F(ye[Dr],ye[lt]),bt=zt;bt!=Rr;bt=zt)if(zt=b(bt+1,Fe),de=b(bt+2,Fe),Ut[zt]!=qe||I(v(ye[Dr],ye[lt],ye[zt],ye[de]))!=qe||w(ye[Dr],ye[lt],ye[zt],ye[de])<At*F(ye[zt],ye[de])*-.999847695156)return 1;if(Zr=it.c[b(Dr,Fe)*3+2].copy(),xi=ye[b(Dr+1,Fe)].copy(),Zi=ye[b(Rr,Fe)].copy(),Fi=it.c[b(Rr,Fe)*3+2].copy(),Ne=ar[Rr]-ar[Dr],Ne-=R(ye[0],it.c[Dr*3+2],it.c[Rr*3+2])/2,Dr>=Rr&&(Ne+=ar[Fe]),da=R(Zr,xi,Zi),Ic=R(Zr,xi,Fi),kp=R(Zr,Zi,Fi),Cc=da+kp-Ic,Ic==da||(Al=kp/(kp-Cc),Dt=Ic/(Ic-da),yo=Ic*Al/2,yo===0))return 1;for(Ha=Ne/yo,et=2-Math.sqrt(4-Ha/.3),ke.c[0]=E(Al*et,Zr,xi),ke.c[1]=E(Dt*et,Fi,Zi),ke.alpha=et,ke.t=Al,ke.s=Dt,xi=ke.c[0].copy(),Zi=ke.c[1].copy(),ke.pen=0,bt=b(Dr+1,Fe);bt!=Rr;bt=zt){if(zt=b(bt+1,Fe),Al=z(Zr,xi,Zi,Fi,ye[bt],ye[zt]),Al<-.5||($i=H(Al,Zr,xi,Zi,Fi),At=F(ye[bt],ye[zt]),At===0)||(dr=R(ye[bt],ye[zt],$i)/At,Math.abs(dr)>Yt)||D(ye[bt],ye[zt],$i)<0||D(ye[zt],ye[bt],$i)<0)return 1;ke.pen+=dr*dr}for(bt=Dr;bt!=Rr;bt=zt){if(zt=b(bt+1,Fe),Al=z(Zr,xi,Zi,Fi,it.c[bt*3+2],it.c[zt*3+2]),Al<-.5||($i=H(Al,Zr,xi,Zi,Fi),At=F(it.c[bt*3+2],it.c[zt*3+2]),At===0)||(dr=R(it.c[bt*3+2],it.c[zt*3+2],$i)/At,vr=R(it.c[bt*3+2],it.c[zt*3+2],ye[zt])/At,vr*=.75*it.alpha[zt],vr<0&&(dr=-dr,vr=-vr),dr<vr-Yt))return 1;dr<vr&&(ke.pen+=(dr-vr)*(dr-vr))}return 0}var ae=X.curve,he=ae.n,re=ae.vertex,se=new Array(he+1),K=new Array(he+1),me=new Array(he+1),Oe=new Array(he+1),Ie,ue,Pe,j,J=new Z,oe,pe,ge,Se,De,tt,Ze,Wt=new Array(he),Nr=new Array(he+1);for(ue=0;ue<he;ue++)ae.tag[ue]=="CURVE"?Wt[ue]=I(R(re[b(ue-1,he)],re[ue],re[b(ue+1,he)])):Wt[ue]=0;for(ge=0,Nr[0]=0,oe=ae.vertex[0],ue=0;ue<he;ue++)pe=b(ue+1,he),ae.tag[pe]=="CURVE"&&(Se=ae.alpha[pe],ge+=.3*Se*(4-Se)*R(ae.c[ue*3+2],re[pe],ae.c[pe*3+2])/2,ge+=R(oe,ae.c[ue*3+2],ae.c[pe*3+2])/2),Nr[ue+1]=ge;for(se[0]=-1,K[0]=0,me[0]=0,Pe=1;Pe<=he;Pe++)for(se[Pe]=Pe-1,K[Pe]=K[Pe-1],me[Pe]=me[Pe-1]+1,ue=Pe-2;ue>=0&&(j=Q(X,ue,b(Pe,he),J,m.opttolerance,Wt,Nr),!j);ue--)(me[Pe]>me[ue]+1||me[Pe]==me[ue]+1&&K[Pe]>K[ue]+J.pen)&&(se[Pe]=ue,K[Pe]=K[ue]+J.pen,me[Pe]=me[ue]+1,Oe[Pe]=J,J=new Z);for(Ie=me[he],De=new r(Ie),tt=new Array(Ie),Ze=new Array(Ie),Pe=he,ue=Ie-1;ue>=0;ue--)se[Pe]==Pe-1?(De.tag[ue]=ae.tag[b(Pe,he)],De.c[ue*3+0]=ae.c[b(Pe,he)*3+0],De.c[ue*3+1]=ae.c[b(Pe,he)*3+1],De.c[ue*3+2]=ae.c[b(Pe,he)*3+2],De.vertex[ue]=ae.vertex[b(Pe,he)],De.alpha[ue]=ae.alpha[b(Pe,he)],De.alpha0[ue]=ae.alpha0[b(Pe,he)],De.beta[ue]=ae.beta[b(Pe,he)],tt[ue]=Ze[ue]=1):(De.tag[ue]="CURVE",De.c[ue*3+0]=Oe[Pe].c[0],De.c[ue*3+1]=Oe[Pe].c[1],De.c[ue*3+2]=ae.c[b(Pe,he)*3+2],De.vertex[ue]=E(Oe[Pe].s,ae.c[b(Pe,he)*3+2],re[b(Pe,he)]),De.alpha[ue]=Oe[Pe].alpha,De.alpha0[ue]=Oe[Pe].alpha,tt[ue]=Oe[Pe].s,Ze[ue]=Oe[Pe].t),Pe=se[Pe];for(ue=0;ue<Ie;ue++)pe=b(ue+1,Ie),De.beta[ue]=tt[ue]/(tt[ue]+Ze[pe]);De.alphacurve=1,X.curve=De}for(var V=0;V<p.length;V++){var Y=p[V];G(Y),W(Y),L(Y),B(Y),Y.sign==="-"&&N(Y),U(Y),m.optcurve&&k(Y)}}function h(p,m,g,y){return y&&a(y),i=new t(p,m,g),n=l(i,s),c(n,s),n}function u(){i=null,n=[]}function d(){function p(P){var T=P.n,I,C,E,O,_=[];for(C=(T-1)*3+2,_[0]={type:"M",values:[P.c[C].x,P.c[C].y]},I=0;I<T;I++)P.tag[I]==="CURVE"?(E=I*3,O=E+1,C=O+1,_.push({type:"C",values:[P.c[E].x,P.c[E].y,P.c[O].x,P.c[O].y,P.c[C].x,P.c[C].y]})):P.tag[I]==="CORNER"&&(E=I*3+1,O=E+1,_.push({type:"L",values:[P.c[E].x,P.c[E].y]}),_.push({type:"L",values:[P.c[O].x,P.c[O].y]}));return _}var m=n.length,g,y,b=[];for(y=0;y<m;y++)g=n[y].curve,b[y]=p(g);return b}return{setOptions:a,process:h,clear:u,getPathDataArray:d}}function nwt(o,t,e="mm",r,i){let s={width:Vqe(o,e,"pixel"),height:Vqe(t,e,"pixel")}.width/r.width,a=[0,0,0,0],l=+a[0]+a[2]/2,c=+a[1]+a[3]/2,h,u=i.bbox;if(i[0]&&i[0][0]&&i[0][0].type){l-=u.width*s/2,c-=u.height*s/2,l=+on(l,2),c=+on(c,2);let d=function(g){return g*s+l},p=function(g){return g*s+c},m=i;m.forEach(function(g){owt(g,d,p)}),h=swt(m)}else{let d=JSON.parse(JSON.stringify(i));awt(d,s);let p=lwt(d);l-=(p.maxX-p.minX)/2,c-=(p.maxY-p.minY)/2,l=+on(l,2),c=+on(c,2),cwt(d,l,c),h=hwt(d)}return{path:h||null,width:o,height:t,unit:e}}function Vqe(o,t,e){if(t==e)return o*1;if(typeof o=="string"&&(arguments.length==2&&(e=t,t=o.replace(/^[-+.\d\s]+/,""),o=o.replace(/[^-+.\d\s]+$/,"")),o=+o),typeof o!="number"||!isFinite(o))throw Error("Invalid value for unit convert");if(t=t.toLowerCase(),e=e.toLowerCase(),t=="cm"?(t="mm",o*=10):t=="px"&&(t="pixel"),e=="cm"?(e="mm",o*=.1):e=="px"&&(e="pixel"),t==e)return o*1;if(!r(t)||!r(e))throw Error("Not supported unit convert "+t+" to "+e);switch(t+"2"+e){case"mil2pixel":return o*.1;case"mil2mm":return o*.0254;case"mil2inch":return o*.001;case"mm2pixel":return o/.254;case"mm2mil":return o/.0254;case"mm2inch":return o/25.4;case"pixel2mil":return o*10;case"pixel2mm":return o*.254;case"pixel2inch":return o*.01;case"inch2pixel":return o*100;case"inch2mil":return o*1e3;case"inch2mm":return o*25.4;default:break}throw Error("Not supported unit convert "+t+" to "+e);function r(i){return/^(pixel|mil|mm|inch)$/i.test(i)}}function owt(o,t,e){o.forEach(function(r){var i=r.values;switch(r.type){case"M":case"L":i[0]=t(i[0]),i[1]=e(i[1]);break;case"C":i[0]=t(i[0]),i[1]=e(i[1]),i[2]=t(i[2]),i[3]=e(i[3]),i[4]=t(i[4]),i[5]=e(i[5]);break;default:break}})}function swt(o){for(var t=[],e=0,r=o.length;e<r;e++)for(var i=o[e],n=0,s=i.length;n<s;n++){var a=i[n],l=a.values;t.push(a.type+l.join(" "))}return t.join("")}function awt(o,t){function e(r){r[0]*=t,r[1]*=t}t!==1&&o.forEach(function(r){r.forEach(e)})}function lwt(o){var t,e,r,i,n;return o.forEach(function(s){s.forEach(function(a){(t===n||a[0]<t)&&(t=a[0]),(e===n||a[1]<e)&&(e=a[1]),(r===n||a[0]>r)&&(r=a[0]),(i===n||a[1]>i)&&(i=a[1])})}),{minX:t||0,minY:e||0,maxX:r||0,maxY:i||0}}function cwt(o,t,e){function r(i){i[0]+=t,i[1]+=e}!t&&!e||o.forEach(function(i){i.forEach(r)})}function hwt(o){if(!o||!o.length)return"";function t(n,s){return(s===0?"M":" L")+n[0]+" "+n[1]}function e(n){return n.map(t).join("")+"Z"}if(o.groups){var r=o.groups.map(function(n){var s=n.map(function(a){return o[a]}).map(e).join("");return s});return r}var i=o.map(e).join("");return i}function uwt(o,t){t=parseInt(t);var e=o.length,r=e/t,i,n,s=1e9,a=1e9,l=-1,c=-1;e:for(n=0;n<r;n++)for(i=0;i<t;i++)if(o[i+n*t]){a=n;break e}e:for(i=0;i<t;i++)for(n=0;n<r;n++)if(o[i+n*t]){s=i;break e}e:for(n=r-1;n>=0;n--)for(i=t-1;i>=0;i--)if(o[i+n*t]){c=n;break e}e:for(i=t-1;i>=0;i--)for(n=r-1;n>=0;n--)if(o[i+n*t]){l=i;break e}return{x:s,y:a,width:l+1-s,height:c+1-a}}function dwt(o,t,e,r,i){if(!i)return r=r===!0,(function(g,y){for(var b=[],P=0,T=3,I=g.length;T<I;T+=4)b[P++]=g[T]<128==y;return b})(o,r);var n=pwt(o),s=n.values,a=n[0],l=n,c={},h=Object.keys(s).map(function(g){return Math.round(+g)}),u=h.map(function(g){return Math.abs(a-g)}),d=Math.max.apply(0,u),p,m=n.length;if(e<=0)for(p=0;p<m;p++)n[p]=n[p]==a!=r?1:0;else if(e>=1)for(p=0;p<m;p++)n[p]=Math.abs(a-n[p])==d!=r?1:0;else for(p=0;p<m;p++)n[p]=Math.abs(a-n[p])/d>e!=r?1:0;return n}function pwt(o){for(var t=new Uint8Array(o.length/4),e={},r=0,i=0,n=o.length-3;r<n;r+=4){var s=fwt(o[r],o[r+1],o[r+2],o[r+3]);e[s]=(e[s]||0)+1,t[i++]=s}return t.values=e,t}function fwt(o,t,e,r){if(r==255)return Gqe(o,t,e);if(r===0)return 100;r/=255;var i=240+r*(o-240),n=240+r*(t-240),s=240+r*(e-240);return Gqe(i,n,s)}function Gqe(o,t,e){return(30*o+59*t+11*e)/255+.5|0}function Uqe(o,t,e,r,i){let n=Due({width:t,height:e},o,{width:r,height:i});return mwt(o,n)}function mwt(o,t){let e=iwt(),r=1,i=document.createElement("canvas"),n=document.createElement("canvas"),s=i.getContext("2d"),a=n.getContext("2d"),l=.5,c=0,h=0,u=0,d=!1,p=!1;i.width-=0,n.width-=0,r=Math.ceil(Math.sqrt(1600*1600/(t.sourceImageWidth*t.sourceImageHeight)));let m=r*t.sourceImageWidth,g=r*t.sourceImageHeight;i.width=m,i.height=g,n.width=m,n.height=g,a.drawImage(o,0,0,m,g);let y=a.getImageData(0,0,m,g),b=dwt(y.data,parseInt(m),l,d,p);e.process(b,parseInt(m),parseInt(g),{alphamax:h,opttolerance:c,turdsize:u*r*r});let P=e.getPathDataArray();n.width-=0,a.beginPath(),P.forEach(function(_){gwt(_,s)}),a.fillStyle="#000",a.fill("evenodd"),a.drawImage(n,t.drawMarginLeft,t.drawMarginTop,t.drawImageWidth,t.drawImageHeight);let T=0,I=0,C={};P.length?(C=uwt(b,m),T=C.width/r,I=C.height/r):T=I=0;let E=P;return E.bbox=C,n=null,nwt(t.drawImageWidth,t.drawImageHeight,"mm",{width:T},E)}function gwt(o,t){o.forEach(function(e){var r=e.values;switch(e.type){case"M":t.moveTo(r[0],r[1]);break;case"L":t.lineTo(r[0],r[1]);break;case"C":t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case"Z":t.closePath();break;default:break}})}async function Hqe(o,t){return new Promise((e,r)=>{let i=document.createElement("canvas"),n=i.getContext("2d"),s=new Image;s.src=o,s.onload=()=>{i.width=s.naturalWidth,i.height=s.naturalHeight+50,n.drawImage(s,0,0,s.naturalWidth,s.naturalHeight),n.font="bold 50px Arial",n.fillStyle="black",n.textAlign="center",n.fillText(t,i.width/2+82,s.naturalHeight+45);let a=i.toDataURL("image/png");e(a)}})}var Yqe=nd(jD()),VAe=hI(),KC=VAe._MSG_BUS_=VAe._MSG_BUS_||new zqe.MessageBus,qs=ie.messageBus,VN=class o{constructor(){this._origin="SilkViewer";this.initCanvas_2d=!1;this.initCanvas_3d=!1;this._previewOptions={canvasSelector_2d:"#canvas-2d",canvasSelector_3d:"#canvas-3d",renderTimeout_3d:300*100,activeLayerId:3},this._configFPC={holeAvoid:{isAvoid:!1,ext:.1},solderAvoid:{isAvoid:!1,ext:.1},viaAvoid:{isAvoid:!1,ext:.1},padAvoid:{isAvoid:!1,ext:.1}}}static getInstance(){return o._instance||(o._instance=new o),o._instance}getOrigin(){return this._origin}setOrigin(t){this._origin=t}clearInstance(){o._instance=null}resetOptions(t){Object.assign(this._previewOptions,t)}async loadWebJson(t){let e=await this.webJson2DataString(t);return this.loadPcbFile(e)}async loadPcbFile(t){return t?await this.preview_2d(t)?await this.preview_3d(!1)?0:3:2:1}async toggleActiveLayer(t,e=!0){this._previewOptions.activeLayerId=t,qs.publish("toggleActiveLayerFromSilkView",{layerId:t,isFlip:e}),await this.preview_3d()}measureDistance(){qs.publish("tool","MeasureDistance")}async partImage(t){let e=await(await qs.rpcCall("getAllBoardBox")).message,r=e.width(),i=e.height(),n=MXe({width:r,height:i},t),s=await this.convertToImageData(t,n,"px(100)");qs.publish("DrawTrueColorPictureBySilkViewer",s)}async convertToImageData(t,e,r){document.createElement("canvas").getContext("2d").drawImage(t,e.sourceMarginLeft,e.sourceMarginTop,e.sourceImageWidth,e.sourceImageHeight,e.drawMarginLeft,e.drawMarginTop,e.drawImageWidth,e.drawImageHeight);let s=e.drawImageWidth,a=e.drawImageHeight,l=new Rue,c=await l.readImageSrcAsBlob(t.src),h=await l.getImageType(c),u=await l.readFileAsDataURL(c,!0);h&&(u=l.replaceDataUrlMineType(u,h)),u=await l.compressImageByCanvas(u,tAe);let p={hashId:await LXe(u),dataUrl:u,width:s,height:a,unit:r,base64:t.src};return console.log(p),p}async updateSilkScreenColor(t){qs.publish("updateSilkScreenColor",t),await this.preview_3d()}async updateSimulation(){return await this.preview_3d()}async saveFile(t){let e=Object.assign({workerJsUrl:t.decodeWorkerJsUrl,silk:!0,flyingProbe:!0,language:"zh-hans",type:"oneKeyExport",unit:"MM",useOldBool:!1,unUseWorkerZip:!0},t),r=await qs.rpcCall("generateGerberResult",e);return $0("saveFile",void 0,r),r.message}async webJson2DataString(t){return(await KC.rpcCall("/pcb/format/toPcb",{source:t})).message}preview_2d(t){return new Promise(async e=>{let{canvasSelector_2d:r,activeLayerId:i}=this._previewOptions;if(!gte(r)){e(!1);return}let s={doctype:23,envFlag:"silk-preview",active:!0,file:t,id:r,ignoreSensors:!0,clearAll:!1,activeLayerId:i};this.initCanvas_2d?await qs.rpcCall("loadPCB",s):(this.initCanvas_2d=!0,await qs.rpcCall("rpcInitFrameInfo",s)),qs.publish("show-all-layer",""),qs.publish("toggleActiveLayerFromSilkView",{layerId:i||3,isFlip:!1}),qs.publish("adaptAll",""),e(!0)})}preview_3d(t=!1){return new Promise(async e=>{let{canvasSelector_2d:r,canvasSelector_3d:i,renderTimeout_3d:n}=this._previewOptions,s=gte(i),a=gte(r);if(!s||!a){e(!0);return}let l=(await qs.rpcCall("/pcb/3d/source",{filterPcbPoly:!1,isColorfulSilk:!0,configFPC:JSON.parse(JSON.stringify(this._configFPC))})).message;if(t)await KC.rpcCall("/pcb/3d/shell/refresh",l);else if(!(await KC.rpcCall("/pcb/3d/load/data",{source:l,renderTimeout_3d:n,isColorfulSilk:!0})).message)return e(!1);let c=(await qs.rpcCall("/pcb/3d/blob","")).message;await KC.rpcCall("/pcb/3d/load/blob",c);let h=r;await KC.rpcCall("/pcb/3d/sync/3dview",[h,h,23,"silk-preview"]);let u=this._previewOptions.activeLayerId==3?"top":"bottom";await KC.publish("toggle3DView",{cmd:u}),this.initCanvas_3d||(KC.publish("3DViewModifyAttr",{key:"attr-silk-technology",value:"colorfulSilk"}),this.initCanvas_3d=!0),e(!0)})}async placeQRCode(t){let{img:e,text:r,imgSize:i,textSize:n,hasPosition:s,imgPosition:a,textPosition:l,layerId:c,rotation:h,textDirection:u,qrCodeRotation:d,plainCodeRotation:p}=t,m=await(await qs.rpcCall("getAllBoardBox")).message,g={};if(e){let y=m.width(),b=m.height(),{width:P,height:T,unit:I}=I$(i),C=new Image;C.src=e;let E=Due({width:y,height:b},C,{width:P,height:T}),O=await this.convertToImageData(C,E,I);if(!s){let R=m.center();if(a){let v=Xs.conversion("mm","mil",a.x)/10,D=Xs.conversion("mm","mil",a.y)/10;R=new S(v,D)}O.position=R}O.layerId=c;let _=d||h;O.qrCodeRotation=_&&-parseFloat(_.toString())/180*Math.PI,g.imageData=O}if(r){let y={};y.text=r;let{width:b,height:P,unit:T}=I$(n);if(y.width=b,y.height=P,y.unit=T,y.textDirection=u,!s){let C=m.center();if(l){let E=Xs.conversion("mm","mil",l.x)/10,O=Xs.conversion("mm","mil",l.y)/10;C=new S(E,O)}y.position=C}y.layerId=c;let I=p||h;y.plainCodeRotation=I&&-parseFloat(I.toString())/180*Math.PI,g.textData=y}qs.publish("PlaceQRCodeBySilkViewer",g)}async updateQRCodeSize(t){let{imgSize:e,textSize:r}=t;if(!e&&!r)return;let i=e&&I$(e)||null,n=r&&I$(r)||null;qs.publish("updateQRCodeSize",{img:i,text:n})}settingtextDirection(t){qs.publish("updateTextDirection",t)}async getQRCodePosition(){return await(await qs.rpcCall("getQRCodePosition")).message}async checkQRCodePos(t){await qs.rpcCall("pcb/setCheckingQRCode",t)}async getCounterBoreData(){return await(await qs.rpcCall("getCounterBoreData")).message}async getDiagram(){return await(await qs.rpcCall("getDiagram")).message}async getCommentInfo(){return await(await qs.rpcCall("getCommentInfo")).message}async getResultData(){if(["QRCodeViewer","ULViewer"].includes(this._origin)){let t=await this.getQRCodePosition(),e=await this.getCounterBoreData(),r=await(await qs.rpcCall("getULData")).message,i=await this.getDiagram();return JSON.stringify({qrCodeInfo:t,counterBoreData:e,ulData:r,diagram:i})}}listenQRcodeSize(t){qs.subscribe("changeQRCodeSize",e=>{t(e)})}listenCounterBore(t){qs.subscribe("transCounterBore",e=>{t(e)})}listenUpdateCode(t){qs.subscribe("updateCode",e=>{setTimeout(()=>{t(e)},50)})}listInitQRCounterBore(t){qs.subscribe("initQRCounterBore",e=>{t(e)})}async getFPCCollect(){return await(await qs.rpcCall("getFPCCollect")).message}async initQRCounterBore(t){if(typeof t=="string"&&(t=JSON.parse(t)),["QRCodeViewer","ULViewer"].includes(this._origin)){let{qrCodeInfo:e,counterBoreData:r}=t;if(e){let{layerId:i,qrCodeBbox:n,rotation:s,qrCodeSize:a,qrCode:l,qrCodeStart:c,plainCodeBbox:h,plainCode:u,plainCodeSize:d,plainCodePosition:p,direction:m}=e,g={},y,b;n&&(y=this.getBBoxByPosition(n),n.rotation&&(g.qrCodeRotation=n.rotation)),h&&(b=this.getBBoxByPosition(h),h.rotation&&(g.plainCodeRotation=h.rotation)),l&&u&&(g.textDirection=m),l&&this.queryParam(l,y,a,g,"img",c),u&&this.queryParam(u,b,d,g,"text",p),(l||u)&&(g.hasPosition=!1,g.layerId=i,g.rotation=s||0,await this.placeQRCode(g))}r&&r.length&&qs.publish("initCounterBore",r),qs.publish("initQRCounterBore",!0)}}getBBoxByPosition(t){let e,{leftDown:r,leftUp:i,rightUp:n,rightDown:s}=t,a=Math.min(r.x,i.x,n.x,s.x),l=Math.min(r.y,i.y,n.y,s.y),c=Math.max(r.x,i.x,n.x,s.x),h=Math.max(r.y,i.y,n.y,s.y);return e={minX:a,minY:l,maxX:c,maxY:h},e}queryGroupBbox(t,e){let r=new _e;return r.ext5(t.minX,t.maxX,t.minY,t.maxY),r.ext5(e.minX,e.maxX,e.minY,e.maxY),r.build()}queryParam(t,e,r,i,n,s){i[`${n}`]=t;let{minX:a,minY:l,maxX:c,maxY:h}=e;i[`${n}Size`]=r,i[`${n}Position`]=s}async updateSelectedCounterBore(t){return await(await qs.rpcCall("updateSelectedCounterBore",t)).message}async deleteCounterBore(t){return await(await qs.rpcCall("deleteCounterBore",t)).message}async placeULLogo(t){let e=await(await qs.rpcCall("getAllBoardBox")).message,r=e.width(),i=e.height();if(t.center){let a=Xs.conversion("mm","mil",t.center.x)/10,l=Xs.conversion("mm","mil",t.center.y)/10;t.center=new S(a,l)}else t.center=e.center();let n=await Hqe(t.img,t.text),s=new Image;s.src=n,t.width&&(t.width=C$(t.width,"mm")),t.height&&(t.height=C$(t.height,"mm")),t.rotation&&(t.rotation=-(parseFloat(t.rotation.toString())/180)*Math.PI),s.onload=()=>{let a=Uqe(s,r,i,t.width,t.height);qs.publish("DrawImage",{...a,...t})}}updateULSize(t){t.width&&(t.width=C$(t.width,"mm")),t.height&&(t.height=C$(t.height,"mm")),qs.publish("updateULSize",t)}updateRotation(t){let e;typeof t.rotation=="number"?e=-parseFloat(t.rotation.toString())/180*Math.PI:e={QRCodeAngle:-parseFloat(t.rotation.QRCodeAngle.toString())/180*Math.PI,plainCodeAngle:-parseFloat(t.rotation.plainCodeAngle.toString())/180*Math.PI},qs.publish("updateRotation",{angle:e,type:t.type})}cancelPlace(){qs.publish("cancelPlace")}openStiffenerLayer(){KC.publish("3DViewModifyAttr",{key:"attr-board-material",value:"substrate_fpc"}),this.setOrigin("FPCViewer"),qs.publish("checkOpenStiffenerLayer","")}drawFPCStiffener(t){switch(t){case"Rect":qs.publish("draw(RectFPCStiffener)");break;case"Circle":qs.publish("draw(CirFPCStiffener)");break;case"Polygon":qs.publish("draw(PolyFPCStiffener)");break;default:break}}listenFPCSize(t){qs.subscribe("changeFPCSize",e=>{t(e)})}listenCheckFPC(t){qs.subscribe("changeCheckFPCComponent",e=>{t(e)})}settingFPCComponent(t){qs.publish("updateFPCComponent",t)}polarSetting(t){qs.publish("PolarGridSetting",t)}gridSetting(t){qs.publish("GridSetting",t)}switchGridType(t){qs.publish("switchGridType",t),ie.publish("switchGridTypeBtn",t,window.top)}switchCoordinate(t){qs.publish("switchCoordinate",t)}avoidFPCSetting(t){this._configFPC=t}async exprotData(){let t={drillMap:["PTH","NPTH"],drillTable:!1,fileName:"Gerber_PCB.zip",fileUuid:"6c33564569f3e6e5@13bf9bd67ec047c4969ae169902a8977",flyingProbe:!1,format:{Integer:"3",Decimals:"6"},language:"zh-hans",layerConfigs:[{layerId:58,isMirror:!1},{layerId:59,isMirror:!1}],mainVersion:"dev",objectConfigs:["FPCStiffener"],silk:!1,title:"PCB1",unit:"IN",useOldBool:!1,userUuid:"8396956ad23840d2ae857110ee25cf3b"},e=(await qs.rpcCall("generateGerberResult",t)).message.data,r=await Yqe.default.loadAsync(await e);await KC.rpcCall("/engine/camera/setDirect",["0",!0]);let i=(await KC.rpcCall("/engine/capture/png",["0",{fixedWidth:2160,watermarkConfig:null}])).message;await KC.rpcCall("/engine/camera/setDirect",["0",!1]);let n=(await KC.rpcCall("/engine/capture/png",["0",{fixedWidth:2160,watermarkConfig:null}])).message;r.file("Gerber_TopStiffenerLayer_pit_0.2.png",i),r.file("Gerber_BottomStiffenerLayer_pib_0.2.png",n);let s=await r.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}}),a=(await qs.rpcCall("/pcb/3d/source",{filterPcbPoly:!1,isColorfulSilk:!0,configFPC:JSON.parse(JSON.stringify(this._configFPC))})).message,l=await this.getFPCCollect();return{gerberData:s,webData:a,fpcData:l}}};VAe.SilkViewerAPI=VN;var jqe=1.5,g0e=class extends ko{constructor(){super();this.isMouseRightDown=!1;this.prevRightX=0;this.prevRightY=0;this.isMouseMidDown=!1;this.prevMidY=0;this.zoomCenter=Mt.ORIGIN;this.lastClickX=null;this.lastClickY=null;this.camera=Ni(),this.setNextTool(new dh),A.subscribe("adaptAll",()=>{if(!(!x.getInstance().isactive||23!=x.getInstance().doctype)){if(Vt.size()>0){let e=Lc(),r=new _e;e.forEach(n=>{if(n.isVisible){if(n instanceof fr&&n.getText()=="")return;r.ext1(n.buildBBox())}});let i=Ii.getBBox();if(i instanceof ut&&r.ext1(i),Ta){let n=Ta.buildBox();if(r.ext1(n),r.valid()){let s=r.build1();vI(this.camera,s,.8)}}else if(r.valid()){let n=r.build1();vI(this.camera,n,.8)}}A.publish("updateFrame","")}}),A.subscribe("adaptBBox",(e,r=.8)=>{vI(this.camera,e,r),A.publish("updateFrame","")}),A.subscribe("show-all-layer",()=>{let e=be.layerMap||{};for(let r in e){let i=e[r];i.visible=!0}}),A.subscribe("toggleActiveLayerFromSilkView",e=>{let{layerId:r,isFlip:i}=e,n=["FPCViewer"].includes(VN.getInstance().getOrigin());this.toggleActiveLayerFromSilkView(r),i?this.flip():be.setActiveLayerId(r),n&&(St.getInstance().flip?be.setActiveLayerId(59):be.setActiveLayerId(58)),A.publish("toggleQRCodeLayer",r),RP.getInstance().onMouseWheel();let s=h0.getInstance().image;if(s){let a=s.center;s.layerId=r,s.center=a}}),A.messageBus.rpcService("getAllBoardBox",()=>nG()||N0()),A.subscribe("initCounterBore",e=>{RP.getInstance().initEditedItems(e),A.publish("updateFrame","")}),A.messageBus.rpcService("updateSelectedCounterBore",e=>{let r=RP.getInstance().updateSelectedCounterBore(e);return A.publish("updateFrame",""),r}),A.messageBus.rpcService("deleteCounterBore",e=>{let r=RP.getInstance().deleteEditedCounterBore(e);return A.publish("updateFrame",""),r}),A.subscribe("cancelPlace",()=>{this.nextTool!==null&&(this.nextTool instanceof Kr||this.nextTool instanceof h0)&&this.nextTool.cancel()})}flip(){!x.getInstance().isactive||23==x.getInstance().doctype||(St.getInstance().flip=!St.getInstance().flip,this.camera.setCameraDirect(!St.getInstance().flip),A.publish("updateFrame",""),we.flipBoard=St.getInstance().flip,St.getInstance().flip?be.setActiveLayerId(4):be.setActiveLayerId(3))}onKeyDown(e){A.publish("pcb_hotkey",{keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey},$())}onKeyUp(e){let r=yi.getScene(),i=sr.getAction(r,e);if(x.getInstance().envFlag=="silk-preview"&&e.keyCode==32){let s=Ve.getItems();(s.includes(Kr.QRCode)||s.includes(Kr.plainCode)||s.includes(h0.getInstance().image))&&(i="rotate_right")}switch(i){case"Delete Selected":A.publish("removeSelect","");break;case"rotate_right":A.publish("rotation",-ce.pcbConfig.rotate);break;case"Rotate Left":A.publish("rotation",ce.pcbConfig.rotate);break;case"Undo":{A.publish("undo","");break}case"Redo":{A.publish("redo","");break}}}onMouseRightDown(e){this.prepare(e),e.realSceneDeltaX=0,e.realSceneDeltay=0,e.rightDown=!0,e.openMenu=!0,e.downTime=new Date().getTime(),this.isMouseRightDown=!0,this.prevRightX=e.mouseX,this.prevRightY=e.mouseY,this.handler(r=>{r.onMouseRightDown(e)})}onMouseLeftDown(e){this.prepare(e),e.leftDown=!0,e.leftClick=!0,e.downTime=new Date().getTime(),this.handler(r=>{r.onMouseLeftDown(e)}),QT.getInstance().isQr()&&RP.getInstance().onMouseLeftDown(e)}onMouseLeftUp(e){this.prepare(e),this.handler(r=>{r.onMouseLeftUp(e)}),e.leftDown=!1,e.leftClick=!1}onMouseRightUp(e){this.prepare(e),this.isMouseRightDown=!1,this.handler(r=>{r.onMouseRightUp(e)}),e.rightDown=!1,e.openMenu=!1}onMouseMove(e){let r=new Date().getTime();if(this.isMouseRightDown){let i=e.mouseX-this.prevRightX,n=e.mouseY-this.prevRightY;this.camera.addOffset1(i,n),this.prevRightX=e.mouseX,this.prevRightY=e.mouseY}if(this.isMouseMidDown){let n=1-(e.mouseY-this.prevMidY)/e.canvasHeight*20;n<0&&(n=1),this.setScale(n),this.prevMidY=e.mouseY}this.prepare(e),e.rightDown&&r-e.downTime<120?e.openMenu=!0:e.rightDown&&(e.realSceneDeltaX!=0||e.realSceneDeltay!=0)&&(e.openMenu=!1),e.rightDown&&QT.getInstance().isQr()&&RP.getInstance().onMouseWheel(),Ta&&Ta.onMouseMove(e),this.handler(i=>{i.onMouseMove(e)}),QT.getInstance().isQr()&&RP.getInstance().onMouseMove(e)}onMouseWheel(e){this.prepare(e);let r;e.deltaY<0?r=jqe:r=1/jqe,this.markZoomCenter(e),this.setScale(r),this.prepare(e),this.handler(i=>{i.onMouseWheel(e)}),QT.getInstance().isQr()&&RP.getInstance().onMouseWheel()}onResize(e){x.getInstance().resize()}prepare(e){if(!e)return;e.lastSceneX=e.sceneX,e.lastSceneY=e.sceneY;let r=this.mouseRealOffset(e);e.realSceneDeltaX=r.x-e.realSceneX,e.realSceneDeltay=r.y-e.realSceneY,e.realSceneX=r.x,e.realSceneY=r.y,e.sceneDeltaX=r.x-e.sceneX,e.sceneDeltaY=r.y-e.sceneY,e.sceneX=r.x,e.sceneY=r.y,this.camera.setScreenPosition(new S(e.mouseX-e.canvasWidth/2,e.canvasHeight/2-e.mouseY))}markZoomCenter(e){this.zoomCenter=new Mt(e.mouseX,e.mouseY,0)}setScale(e){let r=this.camera.getScale();!isNaN(r)&&r!=0&&this.camera.scaleAtPoint1(e,this.zoomCenter.x,this.zoomCenter.y)}mouseRealOffset(e){let r=new Mt(e.mouseX,-e.mouseY,0),i=new Mt(e.canvasWidth/2,-e.canvasHeight/2,0);return r.sub(i).multiply4(this.camera.get2dCameraMatrix().inverse())}toggleActiveLayerFromSilkView(e){let r=[1,3,5,7,9,58],i=[2,4,6,8,10,59],n,s;r.includes(e)&&(n=!0,s=!1),i.includes(e)&&(n=!1,s=!0);for(let a of r)a!=null&&n!=null&&(be.getLayer(a).visible=n);for(let a of i)a!=null&&s!=null&&(be.getLayer(a).visible=s);A.publish("updateFrame","")}highlightItems(e){if(A.publish("clearSelect",""),e.length==0)return;let r=new er;e.forEach(i=>{let n=kt.getItem(i),s;if(n)n.getItems().forEach(a=>{a.click()});else{if(s=r.getItem(i),!s)return;$t.filter([s]).size>0&&(s instanceof Ki&&be.setActiveLayer(be.getLayer(s.layerId)),s.click())}}),A.publish("updateFrame","")}};var Xqe=17/16,ywt=30,y0e=8,b0e=class extends ko{constructor(){super();this.mouseLeftDown=!1;this.mouseRightDown=!1;this.mouseMidDown=!1;this.prevMouseX=-1;this.prevMouseY=-1;this.ctrlWheel=!1;this.bAltBlockCamera=!1;if(this.camera=Ni(),this.canvas=this.camera.getCanvas(),!this.canvas)throw new Error("Camera canvas error")}onKeyDown(e){}onKeyUp(e){}onMouseLeftDown(e){this.mouseLeftDown=!0,this.prevMouseX=e.mouseX,this.prevMouseY=e.mouseY}onMouseMidDown(e){this.mouseMidDown=!0,this.prevMouseX=e.mouseX,this.prevMouseY=e.mouseY}onMouseRightDown(e){this.mouseRightDown=!0,this.prevMouseX=e.mouseX,this.prevMouseY=e.mouseY}onMouseLeftUp(e){this.mouseLeftDown=!1}onMouseMidUp(e){this.mouseMidDown=!1}onMouseRightUp(e){this.mouseRightDown=!1}rotateCamera(e,r,i,n,s){let a=this.canvas.getBoundingClientRect(),l=a.top,c=a.left,h=new ut(-1,1,-1,1),u=(r-c)/this.canvas.clientWidth*2-1,d=-((i-l)/this.canvas.clientHeight*2-1);u=(u-h.minX)/h.width()*2-1,d=(d-h.minY)/h.height()*2-1;let p=e.getTar2Pos().z>0,m=n-r,g=s-i;e.rotateH(m/this.canvas.clientWidth/h.width()*2*(1-Math.abs(d))*y0e),e.rotateP(m/this.canvas.clientWidth/h.width()*2*d*y0e),e.rotateV(g/this.canvas.clientHeight/h.height()*2*(1-Math.abs(u))*y0e),e.rotateP(g/this.canvas.clientHeight/h.height()*2*u*y0e),e.getTar2Pos().z>0}onMouseMove(e){if(this.mouseLeftDown)this.rotateCamera(this.camera,this.prevMouseX,this.prevMouseY,e.mouseX,e.mouseY);else if(this.mouseRightDown){let r=e.mouseX-this.prevMouseX,i=e.mouseY-this.prevMouseY;this.camera.addOffset1(r,i)}else e.leftDown;this.prevMouseX=e.mouseX,this.prevMouseY=e.mouseY}onMouseLeave(e){}onMouseOut(e){}onMouseEnter(e){}onMouseOver(e){}onMouseWheel(e){this.bAltBlockCamera&&e.altKey||(this.ctrlWheel?e.ctrlKey?this.scale(e,this.camera):e.shiftKey?this.moveX(e,this.camera):this.moveY(e,this.camera):e.ctrlKey?this.moveY(e,this.camera):e.shiftKey?this.moveX(e,this.camera):Math.abs(e.deltaX)>Math.abs(e.deltaY)?this.moveX2(e,this.camera):this.scale(e,this.camera))}scale(e,r){let i=e.altKey?Xqe:(Xqe-1)*8+1,n=1,s=ne.greatereq(Math.abs(e.deltaY)/ywt,1)?1:.01;if(e.deltaY>0?n=1-(1-1/i)*s:n=1+(i-1)*s,r.isOrthCamera()){let a=this.canvas.getBoundingClientRect(),l=a.top,c=a.left;r.scaleAtPoint(n,(e.mouseX-c)/this.canvas.clientWidth*2-1,-((e.mouseY-l)/this.canvas.clientHeight*2-1))}else r.setScale(r.limitScale(n)*r.getScale())}moveX(e,r){r.addOffset(new Mt(e.deltaY>0?this.canvas.width/10:-this.canvas.width/10,0,0).scale(1/r.getScale()))}moveY(e,r){r.addOffset(new Mt(0,e.deltaY>0?-this.canvas.height/10:this.canvas.height/10,0).scale(1/r.getScale()))}moveX2(e,r){r.addOffset(new Mt(e.deltaX,0,0).scale(1/r.getScale()))}onDoubleClick(e){}onResize(e){}interrupt(){}restore(){}parse(e){}};var qqe,$qe,bwt=new URLSearchParams(($qe=(qqe=$())==null?void 0:qqe.location)==null?void 0:$qe.search).get("pcb3d")!=null,Kf=new qde(z_);Kf.install();function P0e(){if(x.getInstance().envFlag=="cnc-preview")Kf.setNextTool(new jde),x.getInstance().openRuler=!1,ie.publish("updateFrame","");else if(x.getInstance().envFlag=="silk-preview"){x.getInstance().openRuler=!1;let o=new g0e;Kf.setNextTool(o),new kue(o),ie.publish("updateFrame","")}else if(x.getInstance().doctype===23)Kf.setNextTool(new m0e),x.getInstance().openRuler=!1,ie.publish("updateFrame","");else{let o=x.getInstance().openRuler,t=new xpe;if(Kf.setNextTool(t),new f0e(t),bwt){let e=new b0e;ie.subscribe("previewTool",r=>{let i=Ni();i.is2D()?(x.getInstance().openRuler=!1,St.getInstance().renderGrid=!1,i.setCameraType(!1),i.setRotatable(!0),i.setObjectByBBox3(x.getInstance().getSceneBbox()),Kf.setNextTool(e)):(i.setCameraDirect(!0),i.setCameraType(!0),i.setRotatable(!1),i.setObject(Mt.ORIGIN,VPe),x.getInstance().openRuler=o,St.getInstance().renderGrid=!0,Kf.setNextTool(t))})}}}function jU(o,t,e=!0){if(e)if(o instanceof mt)o.start=t;else{let r=o.end,i=o.endAngle,n=o.startAngle,s=o.sweep,a;s==le.CW?a=(i-n-Vr)%Vr:a=(i-n+Vr)%Vr;let l=new ro,{center:c,radius:h,startAngle:u,endAngle:d,sweep:p}=l.pointToAngle(t,r,a);o.center=c,o.radius=h,o.startAngle=u,o.endAngle=d,o.sweep=p}else if(o instanceof mt)o.end=t;else{let r=o.start,i=o.endAngle,n=o.startAngle,s=o.sweep,a;s==le.CW?a=(i-n-Vr)%Vr:a=(i-n+Vr)%Vr;let l=new ro,{center:c,radius:h,startAngle:u,endAngle:d,sweep:p}=l.pointToAngle(r,t,a);o.center=c,o.radius=h,o.startAngle=u,o.endAngle=d,o.sweep=p}}var Mp=te.getInstance(),vKa=new Yde,sO=class extends ec{constructor(){super(...arguments);this.isSetByDialog=!1;this.selects=new Array;this.lineloop=null;this.addCustomCount=0;this.hasNonSignalLayerItem=!1}set(e){return this.lineloop=e,this}getHtmlData(e){var p,m;if(e instanceof mt||e instanceof vt){let g=e.getParent();this.idList.push(g?g.globalIndex:e.globalIndex)}else this.idList.push(e.globalIndex);this.count++;let r=x.getInstance().unit;this.selects.length=0;let i=kt.getCombin();if(e instanceof ct){this.selects=e.getSelects();let g=e.onlyOneChilds();g!=null&&(e=g)}else(e instanceof mt||e instanceof vt)&&this.selects.push(e);this.hasNonSignalLayerItem||(this.hasNonSignalLayerItem=!be.getLayer(e.layerId).isSignalLayer());let n=x.getInstance().origin;this.attrlist==null&&(this.attrlist={});let s=this.attrlist,a=null,l=null,c=null,h=e.globalIndex,u=((p=e.getParent())==null?void 0:p.globalIndex)||h,d=["Copper Region"];if((e instanceof mt||e instanceof vt)&&(h=e.globalIndex),e instanceof mt||e instanceof vt){let g=!1,y=e.getParent();if(y instanceof ct&&y.onlyOneChilds()!=null&&e instanceof mt&&(g=!0),s["attr-layerid"]==null||s["attr-layerid"].value!=He){let P=Zn.createLayerOptionsByLineloop(e,s["attr-layerid"]?s["attr-layerid"].options:[]);s["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",y.layerId),options:Zn.fixLayerOptions(e.layerId,P)}}(s["attr-combination"]==null||s["attr-combination"].value!=He)&&(s["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",kt.getGroupNameByGroupId(y.getGroupID())||""),options:i});let b=this.getTypes(y.type);(s["attr-2dline-type"]==null||s["attr-2dline-type"].value!=He)&&(s["attr-2dline-type"]={title:"Type",value:this.getCompareValue("attr-2dline-type",y.type),options:this.get2DLineTypeOption(g),types:b}),l=y.type,d.includes(l)||(s["attr-stroke-width"]==null||s["attr-stroke-width"].value!=He)&&(s["attr-stroke-width"]={title:"Stroke Width",value:this.getCompareValue("attr-stroke-width",Xe(y.strokeWidth,4,r,this.unitConversion))}),c=y.net,x.getInstance().doctype==3&&(s["attr-select-net"]==null||s["attr-select-net"].value!=He)&&(s["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",y.showNet),options:this.poolCache.allNetOptions||ze.getNet()}),(s["attr-locked"]==null||s["attr-locked"].value!=He)&&(s["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",y.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(s["attr-id"]==null||s["attr-id"].value!=He)&&(s["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${y.number}`),sourceId:y.globalIndex}),a=y.getComponent(),this.getSilkColor(y,s)}else{let g=!1;if(e instanceof ct&&e.onlyOneChilds()instanceof mt&&(g=!0),s["attr-layerid"]==null||s["attr-layerid"].value!=He){let P=Zn.createLayerOptionsByLineloop(e,s["attr-layerid"]?s["attr-layerid"].options:[]);s["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Zn.fixLayerOptions(e.layerId,P)}}(s["attr-combination"]==null||s["attr-combination"].value!=He)&&(s["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",kt.getGroupNameByGroupId(e.getGroupID())||""),options:i});let y=this.getTypes(e.type);(s["attr-2dline-type"]==null||s["attr-2dline-type"].value!=He)&&(s["attr-2dline-type"]={title:"Type",value:this.getCompareValue("attr-2dline-type",e.type),options:this.get2DLineTypeOption(g),types:y}),l=e.type,d.includes(l)||(s["attr-stroke-width"]==null||s["attr-stroke-width"].value!=He)&&(s["attr-stroke-width"]={title:"Stroke Width",value:this.getCompareValue("attr-stroke-width",Xe(e.strokeWidth,4,r,this.unitConversion))});let b=0;e instanceof ct&&(b=e.outlineLength(),(s["attr-length"]==null||s["attr-length"].value!=He)&&(s["attr-length"]={title:"Length",value:this.getCompareValue("attr-length",Xe(b,4,r,this.unitConversion))})),c=e.net,x.getInstance().doctype==3&&(s["attr-select-net"]==null||s["attr-select-net"].value!=He)&&(s["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.showNet),options:this.poolCache.allNetOptions||ze.getNet(),disable:x.getInstance().doctype==3}),(s["attr-locked"]==null||s["attr-locked"].value!=He)&&(s["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(s["attr-id"]==null||s["attr-id"].value!=He)&&(s["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${e.number}`),sourceId:e.globalIndex}),a=e.getComponent(),this.getSilkColor(e,s)}if(a!=null){if(a instanceof fd)(s["attr-prohibit-device"]==null||s["attr-prohibit-device"].value!=He)&&(s["attr-prohibit-device"]={title:"Prohibit Device",value:this.getCompareValue("attr-prohibit-device",a.device)}),(s["attr-prohibit-fill"]==null||s["attr-prohibit-fill"].value!=He)&&(s["attr-prohibit-fill"]={title:"Prohibit Fill",value:this.getCompareValue("attr-prohibit-fill",a.fill)}),(s["attr-prohibit-track"]==null||s["attr-prohibit-track"].value!=He)&&(s["attr-prohibit-track"]={title:"Prohibit Track",value:this.getCompareValue("attr-prohibit-track",a.track)}),(s["attr-prohibit-plane"]==null||s["attr-prohibit-plane"].value!=He)&&(s["attr-prohibit-plane"]={title:"Prohibit Plane",value:this.getCompareValue("attr-prohibit-plane",a.planzone)}),(s["attr-prohibit-copper"]==null||s["attr-prohibit-copper"].value!=He)&&(s["attr-prohibit-copper"]={title:"Prohibit Copper",value:this.getCompareValue("attr-prohibit-copper",a.copper)});else if(a instanceof nu){let g=Mp.getRegion(h)||{};if((s["attr-2dline-name"]==null||s["attr-2dline-name"].value!=He)&&(s["attr-2dline-name"]={title:"Name",value:this.getCompareValue("attr-2dline-name",a.name)}),s["attr-constraint-safe"]==null||s["attr-constraint-safe"].value!=He){let y=this.getRuleOptions("safe"),b;g.safeClearance&&(b=Mp.getSafeSpacing(g.safeClearance).name),s["attr-constraint-safe"]={title:"Safe Clearance Name",value:this.getCompareValue("attr-constraint-safe",b),options:y}}if((s["attr-constraint-other"]==null||s["attr-constraint-other"].value!=He)&&(s["attr-constraint-other"]={title:"Other Clearance Name",value:this.getCompareValue("attr-constraint-other",g.otherClearance),options:this.getRuleOptions("other")}),s["attr-constraint-creepage"]==null||s["attr-constraint-creepage"].value!=He){let y=this.getRuleOptions("creepage"),b;g.creepageClearance&&(b=Mp.getCreepageSpacing(g.creepageClearance).name),s["attr-constraint-creepage"]={title:"Creepage Clearance Name",value:this.getCompareValue("attr-constraint-creepage",b),options:y}}(s["attr-constraint-track"]==null||s["attr-constraint-track"].value!=He)&&(s["attr-constraint-track"]={title:"Track Name",value:this.getCompareValue("attr-constraint-track",g.track),options:this.getRuleOptions("track")}),(s["attr-constraint-diff"]==null||s["attr-constraint-diff"].value!=He)&&(s["attr-constraint-diff"]={title:"Diff Name",value:this.getCompareValue("attr-constraint-diff",g.diff),options:this.getRuleOptions("diff")}),(s["attr-constraint-radius"]==null||s["attr-constraint-radius"].value!=He)&&(s["attr-constraint-radius"]={title:"Radius Name",value:this.getCompareValue("attr-constraint-radius",g.radius),options:this.getRuleOptions("radius")}),(s["attr-constraint-copper"]==null||s["attr-constraint-copper"].value!=He)&&(s["attr-constraint-copper"]={title:"Copper Name",value:this.getCompareValue("attr-constraint-copper",g.copperPlane),options:this.getRuleOptions("copper")}),(s["attr-constraint-plane"]==null||s["attr-constraint-plane"].value!=He)&&(s["attr-constraint-plane"]={title:"Plane Name",value:this.getCompareValue("attr-constraint-plane",g.innerPlane),options:this.getRuleOptions("plane")})}else if(a instanceof Vn){(s["attr-2dline-name"]==null||s["attr-2dline-name"].value!=He)&&(s["attr-2dline-name"]={title:"Name",value:this.getCompareValue("attr-2dline-name",a.name)}),(s["attr-copper-fill-style"]==null||s["attr-copper-fill-style"].value!=He)&&(s["attr-copper-fill-style"]={title:"Fill Style",value:this.getCompareValue("attr-copper-fill-style",a.style),options:QBe()});let g=a.style=="solid";(s["attr-copper-line-width"]==null||s["attr-copper-line-width"].value!=He)&&(s["attr-copper-line-width"]={title:"Line Width",value:this.getCompareValue("attr-copper-line-width",Xe(a.gridLineWidth,4,r,this.unitConversion)),show:!g}),(s["attr-copper-line-spacing"]==null||s["attr-copper-line-spacing"].value!=He)&&(s["attr-copper-line-spacing"]={title:"Lineine Spacing",value:this.getCompareValue("attr-copper-line-spacing",Xe(a.clearance,4,r,this.unitConversion)),show:!g}),(s["attr-isolated-island"]==null||s["attr-isolated-island"].value!=He)&&(s["attr-isolated-island"]={title:"Isolated Island",value:this.getCompareValue("attr-isolated-island",a.keepIsland?"yes":"no")}),(s["attr-manufacture-optimization"]==null||s["attr-manufacture-optimization"].value!=He)&&(s["attr-manufacture-optimization"]={title:"Manufacture Optimization",value:this.getCompareValue("attr-manufacture-optimization",a.optimization?"yes":"no")}),(s["attr-manufacture-optimization-value"]==null||s["attr-manufacture-optimization-value"].value!=He)&&(s["attr-manufacture-optimization-value"]={title:"Manufacture Optimization Value",value:this.getCompareValue("attr-manufacture-optimization-value",Xe(a.optimizationValue,4,r,this.unitConversion))});let y=Mp.getRegion(h),b=y&&y.safeClearance?"2":"1";(s["attr-planezone-net-rule-type"]==null||s["attr-planezone-net-rule-type"].value!=He)&&(s["attr-planezone-net-rule-type"]={title:"Planezone Net Rule Type",value:this.getCompareValue("attr-planezone-net-rule-type",b)});let P=this.getSpacingRule(b,c,h);(s["attr-net-spacing-rule"]==null||s["attr-net-spacing-rule"].value!=He)&&(s["attr-net-spacing-rule"]={title:"Net Spacing Rule",value:this.getCompareValue("attr-net-spacing-rule",P.name),options:this.getRuleOptions("safe")});let T=R=>R.map(v=>P.getClearance(7,v)).map(v=>(r!="mil"?v=this.unitConversion.conversion1("mil",r,v*10):v=xe(v*10),v)),I=[11,8],C=T(kY.filter(R=>!I.includes(R))),E=T(I);(s["attr-net-spacing-list"]==null||s["attr-net-spacing-list"].value!=He)&&(s["attr-net-spacing-list"]={title:"Net Spacing",value:this.getCompareValue("attr-net-spacing-list",C)}),(s["attr-dist-border-outline-list"]==null||s["attr-dist-border-outline-list"].value!=He)&&(s["attr-dist-border-outline-list"]={title:"Distance To Border Outline",value:this.getCompareValue("attr-dist-border-outline-list",E)});let O=y&&y.copperPlane?"2":"1";(s["attr-planezone-thermal-rule-type"]==null||s["attr-planezone-thermal-rule-type"].value!=He)&&(s["attr-planezone-thermal-rule-type"]={title:"Planezone Net Rule Type",value:this.getCompareValue("attr-planezone-thermal-rule-type",O)});let _=this.getCopperRule(O,c,h);(s["attr-net-thermals-rule"]==null||s["attr-net-thermals-rule"].value!=He)&&(s["attr-net-thermals-rule"]={title:"Net Thermals Rule",value:this.getCompareValue("attr-net-thermals-rule",_.name),options:this.getRuleOptions("copper")}),(s["attr-pad-connection"]==null||s["attr-pad-connection"].value!=He)&&(s["attr-pad-connection"]={title:"Pad Connection",value:this.getCompareValue("attr-pad-connection",_.getSingleConnectMode(e.layerId))}),(s["attr-spoke-angles"]==null||s["attr-spoke-angles"].value!=He)&&(s["attr-spoke-angles"]={title:"Spoke Angles",value:this.getCompareValue("attr-spoke-angles",xe(_.getSingleLineAngle(e.layerId)/Math.PI*180,3))}),(s["attr-spoke-spacing"]==null||s["attr-spoke-spacing"].value!=He)&&(s["attr-spoke-spacing"]={title:"Spoke Spacing",value:this.getCompareValue("attr-spoke-spacing",Xe(_.getSingleLineClearance(e.layerId),4,r,this.unitConversion))}),(s["attr-spoke-width"]==null||s["attr-spoke-width"].value!=He)&&(s["attr-spoke-width"]={title:"Spoke Width",value:this.getCompareValue("attr-spoke-width",Xe(_.getSingleLineWidth(e.layerId),4,r,this.unitConversion))}),(s["attr-multi-layer-pad-connection"]==null||s["attr-multi-layer-pad-connection"].value!=He)&&(s["attr-multi-layer-pad-connection"]={title:"Pad Connection",value:this.getCompareValue("attr-multi-layer-pad-connection",_.getMultiConnectMode(e.layerId))}),(s["attr-multi-layer-spoke-angles"]==null||s["attr-multi-layer-spoke-angles"].value!=He)&&(s["attr-multi-layer-spoke-angles"]={title:"Spoke Angles",value:this.getCompareValue("attr-multi-layer-spoke-angles",xe(_.getMultiLineAngle(e.layerId)/Math.PI*180,3))}),(s["attr-multi-layer-spoke-spacing"]==null||s["attr-multi-layer-spoke-spacing"].value!=He)&&(s["attr-multi-layer-spoke-spacing"]={title:"Spoke Spacing",value:this.getCompareValue("attr-multi-layer-spoke-spacing",Xe(_.getMultiLineClearance(e.layerId),4,r,this.unitConversion))}),(s["attr-multi-layer-spoke-width"]==null||s["attr-multi-layer-spoke-width"].value!=He)&&(s["attr-multi-layer-spoke-width"]={title:"Spoke Width",value:this.getCompareValue("attr-multi-layer-spoke-width",Xe(_.getMultiLineWidth(e.layerId),4,r,this.unitConversion))}),(s["attr-track-connection"]==null||s["attr-track-connection"].value!=He)&&(s["attr-track-connection"]={title:"Track Connection",value:this.getCompareValue("attr-track-connection",_.getTrackConnect(e.layerId))})}else if(a instanceof ln){if((e.layerId==51||e.layerId==50)&&(s["attr-associated-pad-id"]==null||s["attr-associated-pad-id"].value!=He)&&(s["attr-associated-pad-id"]={title:"Associated Pad ID",value:this.getCompareValue("attr-associated-pad-id",a.padId)}),be.getAllSignalLayerIds().includes(e.layerId)){(s["attr-is-bridging-copper"]==null||s["attr-is-bridging-copper"].value!=He)&&(s["attr-is-bridging-copper"]={title:"Is Bridging Copper",value:this.getCompareValue("attr-is-bridging-copper",a.isBridgingCopper)});let y=(m=s["attr-bridging-copper-netlists"])==null?void 0:m.value,b=y!=null?this.isSameNetlist(y,a.networkList)?y:He:a.networkList;(s["attr-bridging-copper-netlists"]==null||s["attr-bridging-copper-netlists"].value!=He)&&(s["attr-bridging-copper-netlists"]={title:"Bridging Copper NetLists",value:b})}}else if(a instanceof Du){(s["attr-fpc-stiffener-material"]==null||s["attr-fpc-stiffener-material"].value!=He)&&(s["attr-fpc-stiffener-material"]={title:"Material",value:this.getCompareValue("attr-fpc-stiffener-material",a.material),options:Qu.getMaterialOptions()}),(s["attr-fpc-stiffener-model"]==null||s["attr-fpc-stiffener-model"].value!=He)&&(s["attr-fpc-stiffener-model"]={title:"Model",value:this.getCompareValue("attr-fpc-stiffener-model",a.fpcModel),options:Qu.getModelOptions(),show:a.material==="Tape"});let g=Qu.getThicknessOptions(a);(s["attr-fpc-stiffener-thickness"]==null||s["attr-fpc-stiffener-thickness"].value!=He)&&(s["attr-fpc-stiffener-thickness"]={title:"Thickness",value:this.getCompareValue("attr-fpc-stiffener-thickness",a.thickness),options:g,disabled:this.getCompareDisabledValue("attr-fpc-stiffener-thickness",g.length<=1)})}}if(e instanceof Sr)(s["attr-x"]==null||s["attr-x"].value!=He)&&(s["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",Xe(e.center.x-n.x,4,r,this.unitConversion))}),(s["attr-2dline-outline-type"]==null||s["attr-2dline-outline-type"].value!=He)&&(s["attr-2dline-outline-type"]={title:"Outline Type",value:this.getCompareValue("attr-2dline-outline-type",1)}),(s["attr-y"]==null||s["attr-y"].value!=He)&&(s["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",Xe(e.center.y-n.y,4,r,this.unitConversion))}),(s["attr-radius"]==null||s["attr-radius"].value!=He)&&(s["attr-radius"]={title:"Radius",value:this.getCompareValue("attr-radius",Xe(e.radius,4))}),(s["attr-length"]==null||s["attr-length"].value!=He)&&(s["attr-length"]={title:"Length",value:this.getCompareValue("attr-length",Xe(2*e.radius*Math.PI,4,r,this.unitConversion))});else if(e instanceof nr)if(e.isSelectChild()){let g=e.selectChildId/2,y=this.getStart(e,g),b=this.getEnd(e,g);(s["attr-2dline-outline-type"]==null||s["attr-2dline-outline-type"].value!=He)&&(s["attr-2dline-outline-type"]={title:"Outline Type",value:this.getCompareValue("attr-2dline-outline-type",3)}),(s["attr-start-x"]==null||s["attr-start-x"].value!=He)&&(s["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(y.x-n.x,4,r,this.unitConversion))}),(s["attr-start-y"]==null||s["attr-start-y"].value!=He)&&(s["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(y.y-n.y,4,r,this.unitConversion))}),(s["attr-end-x"]==null||s["attr-end-x"].value!=He)&&(s["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",Xe(b.x-n.x,4,r,this.unitConversion))}),(s["attr-end-y"]==null||s["attr-end-y"].value!=He)&&(s["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",Xe(b.y-n.y,4,r,this.unitConversion))}),(s["attr-line-length"]==null||s["attr-line-length"].value!=He)&&(s["attr-line-length"]={title:"Line Length",value:this.getCompareValue("attr-line-length",Xe(y.distance1(b),4,r,this.unitConversion))})}else(s["attr-2dline-outline-type"]==null||s["attr-2dline-outline-type"].value!=He)&&(s["attr-2dline-outline-type"]={title:"Outline Type",value:this.getCompareValue("attr-2dline-outline-type",2)}),(s["attr-start-x"]==null||s["attr-start-x"].value!=He)&&(s["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(e.start.x-n.x,4,r,this.unitConversion))}),(s["attr-start-y"]==null||s["attr-start-y"].value!=He)&&(s["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(e.start.y-n.y,4,r,this.unitConversion))}),(s["attr-width"]==null||s["attr-width"].value!=He)&&(s["attr-width"]={title:"Width",value:this.getCompareValue("attr-width",Xe(e.width,4,r,this.unitConversion))}),(s["attr-height"]==null||s["attr-height"].value!=He)&&(s["attr-height"]={title:"Height",value:this.getCompareValue("attr-height",Xe(e.height,4,r,this.unitConversion))}),(s["attr-corner-radius"]==null||s["attr-corner-radius"].value!=He)&&(s["attr-corner-radius"]={title:"Corner Radius",value:this.getCompareValue("attr-corner-radius",Xe(e.cornerRadius,4,r,this.unitConversion))}),(s["attr-rotation"]==null||s["attr-rotation"].value!=He)&&(s["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",uc(xe(e.rotation/Math.PI*180,3)))}),(s["attr-length"]==null||s["attr-length"].value!=He)&&(s["attr-length"]={title:"Length",value:this.getCompareValue("attr-length",Xe(2*(e.width+e.height),4,r,this.unitConversion))});else if(e instanceof mt)(s["attr-length"]==null||s["attr-length"].value!=He)&&(s["attr-length"]={title:"Length",value:this.getCompareValue("attr-length",Xe(e.length,4,r,this.unitConversion))}),(s["attr-2dline-outline-type"]==null||s["attr-2dline-outline-type"].value!=He)&&(s["attr-2dline-outline-type"]={title:"Outline Type",value:this.getCompareValue("attr-2dline-outline-type",3)}),(s["attr-start-x"]==null||s["attr-start-x"].value!=He)&&(s["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(e.start.x-n.x,4,r,this.unitConversion))}),(s["attr-start-y"]==null||s["attr-start-y"].value!=He)&&(s["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(e.start.y-n.y,4,r,this.unitConversion))}),(s["attr-end-x"]==null||s["attr-end-x"].value!=He)&&(s["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",Xe(e.end.x-n.x,4,r,this.unitConversion))}),(s["attr-end-y"]==null||s["attr-end-y"].value!=He)&&(s["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",Xe(e.end.y-n.y,4,r,this.unitConversion))}),(s["attr-line-length"]==null||s["attr-line-length"].value!=He)&&(s["attr-line-length"]={title:"Line Length",value:this.getCompareValue("attr-line-length",Xe(e.length,4,r,this.unitConversion))});else if(e instanceof vt)if((s["attr-length"]==null||s["attr-length"].value!=He)&&(s["attr-length"]={title:"length",value:this.getCompareValue("attr-length",Xe(e.length,4,r,this.unitConversion))}),(s["attr-2dline-outline-type"]==null||s["attr-2dline-outline-type"].value!=He)&&(s["attr-2dline-outline-type"]={title:"Outline Type",value:this.getCompareValue("attr-2dline-outline-type",4)}),(s["attr-arc-type"]==null||s["attr-arc-type"].value!=He)&&(s["attr-arc-type"]={title:"Arc Type",value:this.getCompareValue("attr-arc-type",e.arcType)}),(s["attr-arc-length"]==null||s["attr-arc-length"].value!=He)&&(s["attr-arc-length"]={title:"Arc Length",value:this.getCompareValue("attr-arc-length",Xe(e.length,4,r,this.unitConversion))}),e.arcType==1){let g=new ro,{start:y,end:b,angle:P}=g.angleToPoint(e.center,e.radius,e.startAngle,e.endAngle,e.sweep);(s["attr-start-x"]==null||s["attr-start-x"].value!=He)&&(s["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(y.x-n.x,4,r,this.unitConversion))}),(s["attr-start-y"]==null||s["attr-start-y"].value!=He)&&(s["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(y.y-n.y,4,r,this.unitConversion))}),(s["attr-end-x"]==null||s["attr-end-x"].value!=He)&&(s["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",Xe(b.x-n.x,4,r,this.unitConversion))}),(s["attr-end-y"]==null||s["attr-end-y"].value!=He)&&(s["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",Xe(b.y-n.y,4,r,this.unitConversion))}),(s["attr-arc-angle"]==null||s["attr-arc-angle"].value!=He)&&(s["attr-arc-angle"]={title:"Arc Angle",value:this.getCompareValue("attr-arc-angle",xe(P/Math.PI*180,3))})}else(s["attr-x"]==null||s["attr-x"].value!=He)&&(s["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",Xe(e.center.x-n.x,4,r,this.unitConversion))}),(s["attr-y"]==null||s["attr-y"].value!=He)&&(s["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",Xe(e.center.y-n.y,4,r,this.unitConversion))}),(s["attr-radius"]==null||s["attr-radius"].value!=He)&&(s["attr-radius"]={title:"Radius",value:this.getCompareValue("attr-radius",Xe(e.radius,4,r,this.unitConversion))}),(s["attr-start-arc-angle"]==null||s["attr-start-arc-angle"].value!=He)&&(s["attr-start-arc-angle"]={title:"Start Angle",value:this.getCompareValue("attr-start-arc-angle",xe(e.startAngle/Math.PI*180,3))}),(s["attr-end-arc-angle"]==null||s["attr-end-arc-angle"].value!=He)&&(s["attr-end-arc-angle"]={title:"End Angle",value:this.getCompareValue("attr-end-arc-angle",xe(e.endAngle/Math.PI*180,3))});else(s["attr-2dline-outline-type"]==null||s["attr-2dline-outline-type"].value!=He)&&(s["attr-2dline-outline-type"]={title:"Outline Type",value:this.getCompareValue("attr-2dline-outline-type",5)});return this}getCompareValue(e,r){if(this.attrlist!=null){let i=this.attrlist[e];if(i!=null&&String(i.value)!=String(r))return He}return r}isSameNetlist(e,r){if(e.length==r.length){for(let i of r)if(!e.includes(i))return!1;return!0}return!1}check(e){let r=new Set;if(this.lineloop instanceof mt||this.lineloop instanceof vt){let i=this.lineloop.getParent();this.checkPolygon(e,i,r)}else this.lineloop instanceof ct&&this.checkPolygon(e,this.lineloop,r);return r}checkPolygon(e,r,i){if(e["attr-2dline-type"]!=null){let n=e["attr-2dline-type"];r.type=="Line"&&n!="Line"?aU(r)==3&&i.add("If the figure is not closed, it will be closed automatically after conversion. Do you want to continue?"):["Fill Region","FPC Stiffener"].includes(r.type)&&r.isComplexPolygon()&&i.add([n,"does not support polygons with holes,do you want to split the shape?"])}}getTypes(e){var i;let r=(i=this.attrlist["attr-2dline-type"])==null?void 0:i.types;return r!=null?r.includes(e)||r.push(e):r=[e],r}modifyBy(e,r,i){var c;let n=null,s="",a=this.lineloop.globalIndex,l=((c=this.lineloop.getParent())==null?void 0:c.globalIndex)||a;if(this.lineloop instanceof mt||this.lineloop instanceof vt){let h=this.lineloop.getParent();s=h.net,a=h.globalIndex,this.modifyPolygon(e,h,r,i),n=h.getComponent()}else this.lineloop instanceof ct?(s=this.lineloop.net,this.modifyPolygon(e,this.lineloop,r,i,!1),n=this.lineloop.getComponent()):this.lineloop instanceof Sr?(s=this.lineloop.net,this.modifyCircle(e,this.lineloop,r),n=this.lineloop.getComponent()):this.lineloop instanceof nr&&(s=this.lineloop.net,this.modifyRect(e,this.lineloop,r),n=this.lineloop.getComponent());n!=null&&(n instanceof fd?this.modifyProhibitComponent(e,n):n instanceof nu?this.modifyConstraintComponent(e,n,l):n instanceof Vn?this.modifyFillComponent(e,n,s,a,l):n instanceof ln?this.modifyBridgingCopperComponent(e,n,r):n instanceof Du&&this.modifyFPCStiffenerComponent(e,n,r))}modifyCircle(e,r,i){let n=new ft,s=x.getInstance().origin;if(e["attr-2dline-type"]!=null){let a=e["attr-2dline-type"],l=r.type;r.type!==a&&g2(r.model,"delete"),r.type=a,l!==a&&gn.changeTypeToPour(r,i)}if(e["attr-layerid"]!=null){let a=r.layerId;if(r.layerId=parseInt(e["attr-layerid"]),r.locked)return;r.net=wu(r.net,r.layerId,r.type),a!=r.layerId&&r.type=="Copper Region"&&gn.changeModelLayer(r,a,i)}if(e["attr-stroke-width"]!=null){let a=parseFloat(e["attr-stroke-width"])/10;x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a>=Qc&&(r.strokeWidth=a)}if(e["attr-select-net"]!=null&&be.getLayer(r.layerId).isSignalLayer()&&(r.net=wu(e["attr-select-net"],r.layerId,r.type)),e["attr-locked"]!=null&&(r.locked=e["attr-locked"]=="yes"),e["attr-x"]!=null){if(r.locked)return;let a=parseFloat(e["attr-x"])/10;x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a=a+s.x,r.center=new S(a,r.center.y)}if(e["attr-y"]!=null){if(r.locked)return;let a=parseFloat(e["attr-y"])/10;x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a=a+s.y,r.center=new S(r.center.x,a)}if(e["attr-radius"]!=null){if(r.locked)return;let a=parseFloat(e["attr-radius"])/10;x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),r.radius=a}if(e["attr-combination"]!=null){if(r.locked)return;let a=this.modifyCombination(e["attr-combination"],r);i&&a.forEach(l=>{i.addCommand(l)})}e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?r.silkColor=null:r.silkColor=ee.of3(e["attr-silk-color"]))}modifyRect(e,r,i){let n=new ft,s=x.getInstance().origin;if(e["attr-2dline-type"]!=null){if(r.locked)return;let a=r.type,l=e["attr-2dline-type"];r.type!==l&&g2(r.model,"delete"),r.type=l,a!==l&&gn.changeTypeToPour(r,i)}if(e["attr-layerid"]!=null){if(r.locked)return;let a=r.layerId;r.layerId=parseInt(e["attr-layerid"]),r.net=wu(r.net,r.layerId,r.type),a!=r.layerId&&r.type=="Copper Region"&&gn.changeModelLayer(r,a,i)}if(e["attr-stroke-width"]!=null){if(r.locked)return;let a=parseFloat(e["attr-stroke-width"])/10;x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a>=Qc&&(r.strokeWidth=a)}if(e["attr-rotation"]!=null){if(r.locked)return;let a=parseFloat(e["attr-rotation"])/180*Math.PI;a=this.getValue(a),r.rotation=a}if(e["attr-select-net"]!=null&&be.getLayer(r.layerId).isSignalLayer()&&(r.net=wu(e["attr-select-net"],r.layerId,r.type)),e["attr-locked"]!=null&&(r.locked=e["attr-locked"]=="yes"),e["attr-start-x"]!=null){if(r.locked)return;let a=parseFloat(e["attr-start-x"])/10;if(x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a=a+s.x,r.isSelectChild()){let l=r.selectChildId/2,c=this.getStart(r,l),h=this.getStartCorner(r,l),u=new S(a,c.y);(l===0&&a>r.rightUp.x||l===2&&a<r.leftLow.x)&&r.setSelectChildIdByOver(this.getOverId(r.selectChildId)),this.updateRect(r,h,u)}else r.start=new S(a,r.start.y)}if(e["attr-start-y"]!=null){if(r.locked)return;let a=parseFloat(e["attr-start-y"])/10;if(x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a=a+s.y,r.isSelectChild()){let l=r.selectChildId/2,c=this.getStart(r,l),h=this.getStartCorner(r,l),u=new S(c.x,a);(l===1&&a<r.rightLow.y||l===3&&a>r.leftUp.y)&&r.setSelectChildIdByOver(this.getOverId(r.selectChildId)),this.updateRect(r,h,u)}else r.start=new S(r.start.x,a)}if(e["attr-end-x"]!=null){if(r.locked)return;let a=parseFloat(e["attr-end-x"])/10;if(x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a=a+s.x,r.isSelectChild()){let l=r.selectChildId/2,c=this.getEnd(r,l),h=this.getEndCorner(r,l),u=new S(a,c.y);(l===0&&a>r.rightLow.x||l===2&&a<r.leftUp.x)&&r.setSelectChildIdByOver(this.getOverId(r.selectChildId)),this.updateRect(r,h,u)}}if(e["attr-end-y"]!=null){if(r.locked)return;let a=parseFloat(e["attr-end-y"])/10;if(x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a=a+s.y,r.isSelectChild()){let l=r.selectChildId/2,c=this.getEnd(r,l),h=this.getEndCorner(r,l),u=new S(c.x,a);(l===1&&a<r.leftLow.y||l===3&&a>r.rightUp.y)&&r.setSelectChildIdByOver(this.getOverId(r.selectChildId)),this.updateRect(r,h,u)}}if(e["attr-width"]!=null){if(r.locked)return;let a=n.conversion(x.getInstance().unit,"mil",parseFloat(e["attr-width"])/10);if(a<Qc)return;bP()&&(r.height=r.height/r.width*a),r.width=a}if(e["attr-height"]!=null){if(r.locked)return;let a=n.conversion(x.getInstance().unit,"mil",parseFloat(e["attr-height"])/10);if(a<Qc)return;bP()&&(r.width=r.width/r.height*a),r.height=a}if(e["attr-corner-radius"]!=null){if(r.locked)return;let a=n.conversion(x.getInstance().unit,"mil",parseFloat(e["attr-corner-radius"])/10);a>=0&&(r.cornerRadius=a)}if(e["attr-combination"]!=null){if(r.locked)return;let a=this.modifyCombination(e["attr-combination"],r);i&&a.forEach(l=>{i.addCommand(l)})}e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?r.silkColor=null:r.silkColor=ee.of3(e["attr-silk-color"]))}getStartCorner(e,r){switch(r){case 0:return e.rightUp;case 1:return e.rightLow;case 2:return e.leftLow;case 3:return e.leftUp;default:return null}}getEndCorner(e,r){switch(r){case 0:return e.rightLow;case 1:return e.leftLow;case 2:return e.leftUp;case 3:return e.rightUp;default:return null}}getStart(e,r){switch(r){case 0:return e.leftLow;case 1:return e.leftUp;case 2:return e.rightUp;case 3:return e.rightLow;default:return null}}getEnd(e,r){switch(r){case 0:return e.leftUp;case 1:return e.rightUp;case 2:return e.rightLow;case 3:return e.leftLow}}updateRect(e,r,i){let n=Ae.rotateZForPoint(e.getUL(),-e.rotation),s=Ae.rotateZForPoint(e.getUL(),e.rotation);r=r.multiply4(n),i=i.multiply4(n);let a=this.getBBox(r,i);e.setLL(a.LL().multiply4(s)),e.setLR(a.LR().multiply4(s)),e.setUR(a.UR().multiply4(s)),e.setUL(a.UL().multiply4(s))}getBBox(e,r){let i=new _e;return i.ext2(e).ext2(r),i.build1()}getOverId(e){switch(e){case 0:return 4;case 2:return 6;case 4:return 0;case 6:return 2}}modifyPolygon(e,r,i,n,s=!0){let a=x.getInstance().origin,l=new ft;if(e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?r.silkColor=null:r.silkColor=ee.of3(e["attr-silk-color"])),e["attr-2dline-type"]!=null){let u=e["attr-2dline-type"],d=r.type;if(["Fill Region","FPC Stiffener"].includes(r.type)&&r.isComplexPolygon()){let p=iN([r],i);p.newPolygons.forEach(g=>{p.groupCommand.addCommand(Te.dispatch(g,"modify")),g.type=u,A.publish("hasModifyPcbItem",g)}),d!==u&&gn.changeTypeToPours(p.newPolygons,i);let m=[].concat(p.newPolygons,Ve.getSelects());A.publish("select",Array.from(new Set(m))),A.publish("flushService",""),A.publish("flushSelectingInfo","")}else r.type!==u&&g2(r.model,"delete"),r.type=u,pd(u)&&r.checkClose(),d!==u&&gn.changeTypeToPour(r,i)}if(e["attr-layerid"]!=null){if(r.locked)return;let u=r.layerId;r.layerId=parseInt(e["attr-layerid"]),r.net=wu(r.net,r.layerId,r.type),u!=r.layerId&&r.type=="Copper Region"&&gn.changeModelLayer(r,u,i)}if(e["attr-stroke-width"]!=null){if(r.locked)return;let u=parseFloat(e["attr-stroke-width"])/10;x.getInstance().unit!="mil"&&(u=l.conversion(x.getInstance().unit,"mil",u)),u>=Qc&&(r.strokeWidth=u)}if(e["attr-select-net"]!=null&&be.getLayer(r.layerId).isSignalLayer()&&(r.net=wu(e["attr-select-net"],r.layerId,r.type)),e["attr-locked"]!=null&&(r.locked=e["attr-locked"]=="yes"),e["attr-combination"]!=null){if(r.locked)return;let u=this.modifyCombination(e["attr-combination"],r);i&&u.forEach(d=>{i.addCommand(d)})}let c=r.getSelects();c.length==0&&(c=this.selects),r.onlyOneChilds()!=null&&(c=[r.onlyOneChilds()]);let h=r.isClose();for(let u of c){if(e["attr-start-x"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-start-x"])/10;x.getInstance().unit!="mil"&&(g=l.conversion(x.getInstance().unit,"mil",g)),g=g+a.x,u.start=new S(g,u.start.y)}if(e["attr-start-y"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-start-y"])/10;x.getInstance().unit!="mil"&&(g=l.conversion(x.getInstance().unit,"mil",g)),g=g+a.y,u.start=new S(u.start.x,g)}if(e["attr-length"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-length"])/10;if(x.getInstance().unit!="mil"&&(g=l.conversion(x.getInstance().unit,"mil",g)),g<=0)return;g<Qc&&(g=Qc),u.length=g}if(e["attr-end-x"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-end-x"])/10;x.getInstance().unit!="mil"&&(g=l.conversion(x.getInstance().unit,"mil",g)),g=g+a.x,u.end=new S(g,u.end.y)}if(e["attr-end-y"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-end-y"])/10;x.getInstance().unit!="mil"&&(g=l.conversion(x.getInstance().unit,"mil",g)),g=g+a.y,u.end=new S(u.end.x,g)}if(u instanceof vt){if(e["attr-arc-type"]!=null){if(r.locked)continue;u.arcType=parseInt(e["attr-arc-type"])}if(e["attr-arc-angle"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-arc-angle"]);if(Math.abs(g)<.001)g=.001;else if(Math.abs(g)>.001){let O=Math.abs(g)%360;O<.001&&O>0?g=.001:(O>359.999||O==0)&&(g=359.999)}let y=g/180*Math.PI,b=new ro,{center:P,radius:T,startAngle:I,endAngle:C,sweep:E}=b.pointToAngle(u.start,u.end,y);u.center=P,u.radius=T,u.startAngle=I,u.endAngle=C,u.sweep=E}if(e["attr-start-arc-angle"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-start-arc-angle"])/180*Math.PI;u.startAngle=g}if(e["attr-end-arc-angle"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-end-arc-angle"])/180*Math.PI;u.endAngle=g}if(e["attr-x"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-x"])/10;x.getInstance().unit!="mil"&&(g=l.conversion(x.getInstance().unit,"mil",g)),g=g+a.x,u.center=new S(g,u.center.y)}if(e["attr-y"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-y"])/10;x.getInstance().unit!="mil"&&(g=l.conversion(x.getInstance().unit,"mil",g)),g=g+a.y,u.center=new S(u.center.x,g)}if(e["attr-radius"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-radius"])/10;x.getInstance().unit!="mil"&&(g=l.conversion(x.getInstance().unit,"mil",g)),u.radius=g}}if(e["attr-combination"]!=null){if(r.locked)continue;let g=this.modifyCombination(e["attr-combination"],r);i&&g.forEach(y=>{i.addCommand(y)})}let d=r.getConnect(u,!0,s,h),p=r.getConnect(u,!1,s,h);d!=null&&jU(d,u.start,!1),p!=null&&jU(p,u.end);let m=e["attr-is-bridging-copper"];m!==void 0&&(r.model.component=m?r.model.component||new ln(m):null,eP(r.model.component))}}modifyProhibitComponent(e,r){r!=null&&(e["attr-prohibit-device"]!=null&&(r.device=e["attr-prohibit-device"]),e["attr-prohibit-track"]!=null&&(r.track=e["attr-prohibit-track"]),e["attr-prohibit-fill"]!=null&&(r.fill=e["attr-prohibit-fill"]),e["attr-prohibit-copper"]!=null&&(r.copper=e["attr-prohibit-copper"]),e["attr-prohibit-plane"]!=null&&(r.planzone=e["attr-prohibit-plane"]))}modifyConstraintComponent(e,r,i){if(e["attr-2dline-name"]!=null){let s=e["attr-2dline-name"];r.name!=s&&bAe("Constraint Region",s)&&r.modifyName(s)}if(Mp.getRegion(i)){if(e["attr-constraint-safe"]!=null){if(Mp.getRegion(i)==null)return;let l=e["attr-constraint-safe"];Mp.updateRegionSelector(i,{safeClearance:l})}if(e["attr-constraint-other"]!=null){let a=e["attr-constraint-other"];Mp.updateRegionSelector(i,{otherClearance:a})}if(e["attr-constraint-creepage"]!=null){if(Mp.getRegion(i)==null)return;let l=e["attr-constraint-creepage"];Mp.updateRegionSelector(i,{creepageClearance:l})}if(e["attr-constraint-track"]!=null){let a=e["attr-constraint-track"];Mp.updateRegionSelector(i,{track:a})}if(e["attr-constraint-diff"]!=null){let a=e["attr-constraint-diff"];Mp.updateRegionSelector(i,{diff:a})}if(e["attr-constraint-radius"]!=null){let a=e["attr-constraint-radius"];Mp.updateRegionSelector(i,{radius:a})}if(e["attr-constraint-copper"]!=null){let a=e["attr-constraint-copper"];Mp.updateRegionSelector(i,{copperPlane:a})}if(e["attr-constraint-plane"]!=null){let a=e["attr-constraint-plane"];Mp.updateRegionSelector(i,{innerPlane:a})}let s=Mp.getRegion(i);Xp.getInstance().publish("modify",s)}}modifyFillComponent(e,r,i,n,s){let a=new ft;if(r!=null){if(e["attr-2dline-name"]!=null){let u=e["attr-2dline-name"];r.name!=u&&bAe("Copper Region",u)&&r.modifyName(u)}if(e["attr-copper-fill-style"]!=null&&(r.style=e["attr-copper-fill-style"]),e["attr-copper-line-width"]!=null){let u=parseFloat(e["attr-copper-line-width"])/10;x.getInstance().unit!="mil"&&(u=a.conversion(x.getInstance().unit,"mil",u)),r.gridLineWidth=u}if(e["attr-copper-line-spacing"]!=null){let u=parseFloat(e["attr-copper-line-spacing"])/10;x.getInstance().unit!="mil"&&(u=a.conversion(x.getInstance().unit,"mil",u)),r.clearance=u}if(e["attr-isolated-island"]!=null&&(r.keepIsland=e["attr-isolated-island"]=="yes"),e["attr-manufacture-optimization"]!=null&&(r.optimization=e["attr-manufacture-optimization"]=="yes"),e["attr-manufacture-optimization-value"]!=null){let u=parseFloat(e["attr-manufacture-optimization-value"])/10;r.optimizationValue=a.conversion(x.getInstance().unit,"mil",u)}let l=Mp.getRegion(n),c,h=!1;if(e["attr-planezone-net-rule-type"]!=null)switch(e["attr-planezone-net-rule-type"]){case"1":{l&&(l.safeCopperPlane=null,l.safeClearance=null,c=l,h=!0,te.getInstance().deleteRegion(l.name));break}case"2":{let d=te.getInstance().addRegionSelector(n),p=te.getInstance().getSafeSpacingByNet(i,13);d.safeClearance=p.name,c=d;break}}if(e["attr-net-spacing-rule"]!=null){let u=e["attr-net-spacing-rule"];switch(l&&l.safeClearance?"2":"1"){case"1":{let p=te.getInstance().getNet(i);if(p!=null){let g=te.getInstance().getDefaultSafeSpacing().name!==u?u:"default";p.safeCopperPlane?p.safeCopperPlane=g:p.safeSpacing&&(p.safeSpacing=g),c=p}break}case"2":{let p=te.getInstance().addRegionSelector(n);p&&(p.safeClearance=u),c=p;break}}}if(e["attr-planezone-thermal-rule-type"]!=null)switch(e["attr-planezone-thermal-rule-type"]){case"1":{l&&(l.copperPlane=null),c=l;break}case"2":{let d=te.getInstance().addRegionSelector(n),p=te.getInstance().getCopperPlaneByNet(i);d.copperPlane=p.name,c=d;break}}if(e["attr-net-thermals-rule"]!=null){let u=e["attr-net-thermals-rule"];switch(l&&l.copperPlane?"2":"1"){case"1":{let p=te.getInstance().getNet(i);if(p!=null){let m=te.getInstance().getDefaultSafeSpacing();p.copperPlane=m.name!==u?u:"default",c=p}break}case"2":{let p=te.getInstance().addRegionSelector(n);p&&(p.copperPlane=u),c=p;break}}}c&&(h?Xp.getInstance().publish("delete",c):Xp.getInstance().publish("modify",c))}}modifyBridgingCopperComponent(e,r,i){var a;if(e["attr-layerid"]!=null){let l=this.lineloop instanceof mt||this.lineloop instanceof vt?this.lineloop.getParent():this.lineloop;if(vE(Number(e["attr-layerid"]))){if(l.locked)return;this.isSetByDialog?setTimeout(()=>{let c=Kf.getNextTool().getNextTool(),h=c instanceof Tc?"draw(RRegion)":c instanceof rc?"draw(PRegion)":"draw(CRegion)";A.publish("tool","dropdrag"),be.setActiveLayerId(Number(e["attr-layerid"])),dF(),A.publish("tool",h),A.publish("closeLastDialog","",$())}):(A.messageBus.publish("clearSelect",""),setTimeout(()=>{let c=new Nw(u=>{if(u){r.padId=u.globalIndex,$a.getInstance().addConnectRelatedId(u.globalIndex,l.globalIndex);let d=Te.dispatch(l,"modify");A.publish("updateFrame",""),i&&(i.addCommand(d),je.executeCommand(i))}else i&&i.undo();A.publish("tool","dropdrag")}),h={command:"selectPadWithRegion",program:c,msg:"Please select a pad to associate"};A.publish("toggle",h)}))}else{let c=r.padId;r.padId=null,c!=null&&$a.getInstance().delConnectRelatedId(c,l.globalIndex)}}let n=e["attr-is-bridging-copper"];if(n!=null){r.isBridgingCopper=n;let l=this.lineloop,c=ze.getItem(l.net);if(n?ze.delete(l):c&&!c.has(l)&&ze.addItem(l),l.model.netModified=!0,n&&r.networkList.length===0){let h=this.lineloop.getMathGraphics(this.lineloop.layerId),u=Array.from(Wr.rtreeSearchNotOutside(h).getResult(dd)).filter(d=>d instanceof ds&&d!==this.lineloop);r.networkList=(a=u[0])!=null&&a.net?[u[0].net]:[]}else!n&&r.networkList.length>0&&(r.networkList=[])}let s=e["attr-bridging-copper-netlists"];if(s)if(Array.isArray(s))r.networkList=s;else{let{index:l,value:c}=s;r.networkList[l]?c==""?r.networkList.splice(l,1):r.networkList[l]=c:c!==""&&r.networkList.push(c)}}modifyFPCStiffenerComponent(e,r,i){let n=new ft;if(e["attr-fpc-stiffener-material"]!=null){let s=e["attr-fpc-stiffener-material"];if(s.locked)return;Qu.correctMaterial(s,r)}if(e["attr-fpc-stiffener-model"]!=null){let s=e["attr-fpc-stiffener-model"];Qu.correctModel(s,r)}if(e["attr-fpc-stiffener-thickness"]!=null){let s=+e["attr-fpc-stiffener-thickness"];Qu.correctThickness(s,r)}Qu.correctAllProps(r)}get2DLineTypeOption(e=!1){return x.getInstance().doctype===4?e?[{value:"Line",text:"Line"}]:[{value:"Line",text:"Line"},{value:"Slot Region",text:"Slot Region"},{value:"Fill Region",text:"Fill Region"},{value:"Prohibited Region",text:"Prohibited Region"}]:e?[{value:"Line",text:"Line"}]:[{value:"Board Outline",text:"Board Outline"},{value:"Copper Region",text:"Copper Region"},{value:"Fill Region",text:"Fill Region"},{value:"Slot Region",text:"Slot Region"},{value:"Prohibited Region",text:"Prohibited Region"},{value:"Constraint Region",text:"Constraint Region"},{value:"Line",text:"Line"}]}getRuleOptions(e){let r=new Set;switch(e){case"safe":r=Mp.getAllSafeSpacing();break;case"other":r=Mp.getAllOtherSpacing();break;case"creepage":r=Mp.getAllCreepageSpacing();break;case"track":r=Mp.getAllTrackPhysics();break;case"diff":r=Mp.getAllDifferentialPhysics();break;case"radius":r=Mp.getAllRadiusPhysics();break;case"copper":r=Mp.getAllCopperPlane();break;case"plane":r=Mp.getAllInnerPlane();break}let i=[];return r.forEach(n=>{i.push({text:n.name,value:n.name,isDefault:n.isDefault})}),i}getRule(e,r,i,n,s,a){let l;switch(e){case"1":l=n(r);break;case"2":let c=te.getInstance().getRegion(i);c!=null&&(l=s(c));break}return l||(l=a()),l}getSpacingRule(e,r,i){return this.getRule(e,r,i,n=>te.getInstance().getSafeSpacingByNet(n,13),n=>te.getInstance().getSafeSpacing(n.safeClearance),()=>te.getInstance().getDefaultSafeSpacing())}getCopperRule(e,r,i){return this.getRule(e,r,i,n=>te.getInstance().getCopperPlaneByNet(n),n=>te.getInstance().getCopperPlane(n.copperPlane),()=>te.getInstance().getDefaultCopperPlane())}getPourName(){if(this.attrlist["attr-2dline-type"].value==="Copper Region"&&this.attrlist["attr-2dline-name"]){let e=this.attrlist["attr-2dline-name"].value,r=new Set(Ei.nameManager.getNums());return r.delete(e),Array.from(r)}return[]}getExtra(){return{isSignalLayer:(()=>{let e=be.getAllSignalLayerIds().includes(this.attrlist["attr-layerid"].value);return this.getCompareValue("hasParent",e)})(),pourNames:this.getPourName()}}};function XU(o,t,e=3){let r=new ft;t!="mil"&&(o=r.conversion("mil",t,o));let i=Math.pow(10,e);return Math.round(o*i)/i}var T0e=class extends ec{constructor(){super(...arguments);this.mark=null}set(e){return this.mark=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=x.getInstance().origin;this.attrlist==null&&(this.attrlist={});let i=this.attrlist,n=x.getInstance().unit,s;return this.getSilkColor(e,i),(i["attr-id"]==null||i["attr-id"].value!=He)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${e.number}`),sourceId:e.globalIndex}),e instanceof xa?(Uo.lastPrecision=e.precision,(i["attr-radius"]==null||i["attr-radius"].value!=He)&&(i["attr-radius"]={title:"Radius",value:this.getCompareValue("attr-radius",e.getArcRadius())}),s=1):e instanceof ca?(Go.lastPrecision=e.precision,(i["attr-length"]==null||i["attr-length"].value!=He)&&(i["attr-length"]={title:"Length",value:this.getCompareValue("attr-length",e.length)}),s=2):(is.lastPrecision=e.precision,s=3),(i["attr-tagging-type"]==null||i["attr-tagging-type"].value!=He)&&(i["attr-tagging-type"]={title:"Type",value:this.getCompareValue("attr-tagging-type",s),options:[{value:"1",text:"Radius Dimension"},{value:"2",text:"Length Dimension"},{value:"3",text:"Arc Dimension"}]}),(i["attr-layerid"]==null||i["attr-layerid"].value!=He)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Zn.abstractDimension()}),(i["attr-combination"]==null||i["attr-combination"].value!=He)&&(i["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",kt.getGroupNameByGroupId(e.getGroupID())||""),options:kt.getCombin(),hasParent:e.getParent()!=null}),e instanceof xa||e instanceof ca?(i["attr-unit"]==null||i["attr-unit"].value!=He)&&(i["attr-unit"]={title:"Unit",value:this.getCompareValue("attr-unit",e.unit)}):e instanceof ol&&(i["attr-rotation"]==null||i["attr-rotation"].value!=He)&&(i["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",uc(e.angle,e.precision))}),(i["attr-width"]==null||i["attr-width"].value!=He)&&(i["attr-width"]={title:"Width",value:this.getCompareValue("attr-width",XU(e.width*10,n))}),(i["attr-text-height"]==null||i["attr-text-height"].value!=He)&&(i["attr-text-height"]={title:"Text Height",value:this.getCompareValue("attr-text-height",XU(e.height*10,n))}),(i["attr-tagging-accuracy"]==null||i["attr-tagging-accuracy"].value!=He)&&(i["attr-tagging-accuracy"]={title:"Accuracy",value:this.getCompareValue("attr-tagging-accuracy",e.precision),options:[{value:0,text:0},{value:1,text:1},{value:2,text:2},{value:3,text:3},{value:4,text:4}]}),(i["attr-start-x"]==null||i["attr-start-x"].value!=He)&&(i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",XU((e.start.x-r.x)*10,n))}),(i["attr-start-y"]==null||i["attr-start-y"].value!=He)&&(i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",XU((e.start.y-r.y)*10,n))}),(i["attr-end-x"]==null||i["attr-end-x"].value!=He)&&(i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",XU((e.end.x-r.x)*10,n))}),(i["attr-end-y"]==null||i["attr-end-y"].value!=He)&&(i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",XU((e.end.y-r.y)*10,n))}),(i["attr-locked"]==null||i["attr-locked"].value!=He)&&(i["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),this}modifyBy(e,r){let i=new ft,n=x.getInstance().origin,s=x.getInstance().unit;if(e["attr-layerid"]!=null){if(this.mark.locked)return;let a=parseInt(e["attr-layerid"]);this.mark.layerId=a}if(e["attr-combination"]!=null){if(this.mark.locked)return;this.modifyCombination(e["attr-combination"],this.mark).forEach(l=>{r.addCommand(l)})}if(e["attr-unit"]!=null){let a=e["attr-unit"];(this.mark instanceof ca||this.mark instanceof xa)&&(this.mark.unit=a)}if(e["attr-rotation"]!=null){if(this.mark.locked)return;let a=parseFloat(e["attr-rotation"]);!isNaN(a)&&this.mark instanceof ol&&(this.mark.angle=a)}if(e["attr-length"]!=null){let a=this.mark.unit,l=parseFloat(e["attr-length"])/10;!isNaN(l)&&a!="mil"&&(l=i.conversion(a,"mil",l)),!isNaN(l)&&l>0&&this.mark instanceof ca&&(this.mark.length=l)}if(e["attr-width"]!=null){let a=parseFloat(e["attr-width"])/10;!isNaN(a)&&s!="mil"&&(a=i.conversion(s,"mil",a)),isNaN(a)||(this.mark.width=a)}if(e["attr-text-height"]!=null){let a=parseFloat(e["attr-text-height"])/10;!isNaN(a)&&s!="mil"&&(a=i.conversion(s,"mil",a)),isNaN(a)||(this.mark.height=a)}if(e["attr-tagging-accuracy"]!=null){let a=parseInt(e["attr-tagging-accuracy"]);this.mark.precision=a}if(e["attr-start-x"]!=null){if(this.mark.locked)return;let a=parseFloat(e["attr-start-x"])/10;!isNaN(a)&&s!="mil"&&(a=i.conversion(s,"mil",a)),a=a+n.x,isNaN(a)||(this.mark.start=new S(a,this.mark.start.y))}if(e["attr-start-y"]!=null){if(this.mark.locked)return;let a=parseFloat(e["attr-start-y"])/10;!isNaN(a)&&s!="mil"&&(a=i.conversion(s,"mil",a)),a=a+n.y,isNaN(a)||(this.mark.start=new S(this.mark.start.x,a))}if(e["attr-end-x"]!=null){if(this.mark.locked)return;let a=parseFloat(e["attr-end-x"])/10;!isNaN(a)&&s!="mil"&&(a=i.conversion(s,"mil",a)),a=a+n.x,isNaN(a)||(this.mark.end=new S(a,this.mark.end.y))}if(e["attr-end-y"]!=null){if(this.mark.locked)return;let a=parseFloat(e["attr-end-y"])/10;!isNaN(a)&&s!="mil"&&(a=i.conversion(s,"mil",a)),a=a+n.y,isNaN(a)||(this.mark.end=new S(this.mark.end.x,a))}if(e["attr-locked"]!=null){let a=e["attr-locked"]=="yes";this.mark.locked=a}e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?this.mark.silkColor=null:this.mark.silkColor=ee.of3(e["attr-silk-color"]))}};var tK=class extends ec{constructor(){super(...arguments);this.text=null;this.hasDefaultTextTypeface=!1}set(e){return this.text=e,this}getExtra(){return{hasDefaultTextTypeface:this.hasDefaultTextTypeface}}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=x.getInstance().unit,i=x.getInstance().origin;this.attrlist==null&&(this.attrlist={});let n=this.attrlist;return(n["attr-id"]==null||n["attr-id"].value!=He)&&(n["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${e.number}`),sourceId:e.globalIndex}),this.getSilkColor(e,n),e.key!=""?((n["attr-text-type"]==null||n["attr-text-type"].value!=He)&&(n["attr-text-type"]={title:"text type",value:this.getCompareValue("attr-text-type","componentAttr")}),e.key==="Footprint"||e.key==="Device"||e.key==="3D Model"||e.key==="3D Model Title"||e.key==="3D Model Transform"||e.key==="Add into BOM"?(n["attr-text-content"]==null||n["attr-text-content"].value!=He)&&(n["attr-text-content"]={title:e.key,value:this.getCompareValue("attr-text-content",e.value),disabled:!0}):(n["attr-text-content"]==null||n["attr-text-content"].value!=He)&&(n["attr-text-content"]={title:e.key,value:this.getCompareValue("attr-text-content",(()=>{var s;return e.getParent()instanceof Me&&e.key==="Name"?(s=e.getParent())==null?void 0:s.attrKeyValue[e.key]:e.value})())}),(n["attr-text-title"]==null||n["attr-text-title"].value!=He)&&(n["attr-text-title"]={title:"text title",value:this.getCompareValue("attr-text-title",e.key),disabled:!0})):((n["attr-text-type"]==null||n["attr-text-type"].value!=He)&&(n["attr-text-type"]={title:"text type",value:this.getCompareValue("attr-text-type","normal")}),(n["attr-text-content"]==null||n["attr-text-content"].value!=He)&&(n["attr-text-content"]={title:"Content",value:this.getCompareValue("attr-text-content",e.value)})),(n["attr-layerid"]==null||n["attr-layerid"].value!=He)&&(n["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Zn.pcbText()}),(n["attr-combination"]==null||n["attr-combination"].value!=He)&&(n["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",kt.getGroupNameByGroupId(e.getGroupID())||""),options:this.poolCache.combinationOptions,hasParent:e.getParent()!=null}),(n["attr-mirror"]==null||n["attr-mirror"].value!=He)&&(n["attr-mirror"]={title:"Mirror",value:this.getCompareValue("attr-mirror",e.mirror?"yes":"no")}),(n["attr-x"]==null||n["attr-x"].value!=He)&&(n["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",Xe(e.position.x-i.x,void 0,r,this.unitConversion))}),(n["attr-y"]==null||n["attr-y"].value!=He)&&(n["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",Xe(e.position.y-i.y,void 0,r,this.unitConversion))}),(n["attr-rotation"]==null||n["attr-rotation"].value!=He)&&(n["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",uc(xe(e.rotation/Math.PI*180,3)))}),(n["attr-locked"]==null||n["attr-locked"].value!=He)&&(n["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(n["attr-origin"]==null||n["attr-origin"].value!=He)&&(n["attr-origin"]={title:"Origin",value:this.getCompareValue("attr-origin",e.origin)}),this.hasDefaultTextTypeface||(this.hasDefaultTextTypeface=["default","default2","Serif","Sans Serif"].includes(e.fontFamily)),(n["attr-text-typeface"]==null||n["attr-text-typeface"].value!=He)&&(n["attr-text-typeface"]={title:"Typeface",value:this.getCompareValue("attr-text-typeface",e.fontFamily),options:Cie()}),(n["attr-text-size"]==null||n["attr-text-size"].value!=He)&&(n["attr-text-size"]={title:"Size",value:this.getCompareValue("attr-text-size",Xe(e.fontSize,void 0,r,this.unitConversion))}),e.model.type==0?this.getDefultHtmlData(e,n):this.getFontData(e,n),this}modifyBy(e,r){let i=new ft,n=x.getInstance().origin;if(e["attr-text-content"]!=null&&(x.getInstance().doctype==4&&e["attr-text-title"]==="Designator"&&!/\?$/gi.test(e["attr-text-content"])?(e["attr-text-content"]=e["attr-text-content"]||"",e["attr-text-content"]+="?"):x.getInstance().doctype==3&&this.text.key==="Designator"&&e["attr-text-content"]!=null&&(e["attr-text-content"]=e["attr-text-content"].replace(/\s/g,"")),this.text.value=e["attr-text-content"]),e["attr-layerid"]!=null){if(this.text.locked)return;let s=parseInt(e["attr-layerid"]);isNaN(s)||(this.text.layerId=s)}if(e["attr-mirror"]!=null){if(this.text.locked)return;let s=e["attr-mirror"]=="yes";this.text.mirror=s}if(e["attr-combination"]!=null){if(this.text.locked)return;this.modifyCombination(e["attr-combination"],this.text).forEach(a=>{r.addCommand(a)})}if(e["attr-x"]!=null){if(this.text.locked)return;let s=parseFloat(e["attr-x"])/10;isNaN(s)||(x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),s=s+n.x,this.text.position=new S(s,this.text.position.y))}if(e["attr-y"]!=null){if(this.text.locked)return;let s=parseFloat(e["attr-y"])/10;isNaN(s)||(x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),s=s+n.y,this.text.position=new S(this.text.position.x,s))}if(e["attr-rotation"]!=null){if(this.text.locked)return;let s=parseFloat(e["attr-rotation"])/180*Math.PI;isNaN(s)||(this.text.rotation=s)}if(e["attr-locked"]!=null){let s=e["attr-locked"]=="yes";this.text.locked=s}if(e["attr-origin"]!=null){if(this.text.locked)return;let s=parseInt(e["attr-origin"]);isNaN(s)||(this.text.origin=s)}if(e["attr-text-typeface"]!=null){let s=e["attr-text-typeface"];this.text.fontFamily=s,(s==""||["default","default2","Serif","Sans Serif"].includes(s))&&(this.text.strokeWidth=this.text.strokeWidth,this.text.fontSize=this.text.fontSize)}if(e["attr-text-size"]!=null){let s=parseFloat(e["attr-text-size"])/10;x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),this.text.fontSize=s}e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?this.text.silkColor=null:this.text.silkColor=ee.of3(e["attr-silk-color"])),this.text.model.type==0?this.modifyDefultText(this.text,e):this.modifyFont(this.text,e)}getFontData(e,r){let i=x.getInstance().unit;(r["attr-reversed-phase"]==null||r["attr-reversed-phase"].value!=He)&&(r["attr-reversed-phase"]={title:"Reversed",value:this.getCompareValue("attr-reversed-phase",e.reverse?"yes":"no")}),(r["attr-reversed-phase-extend"]==null||r["attr-reversed-phase-extend"].value!=He)&&(r["attr-reversed-phase-extend"]={title:"Reversed Extend",value:this.getCompareValue("attr-reversed-phase-extend",Xe(e.reverseExpansion,void 0,i,this.unitConversion))})}getDefultHtmlData(e,r){let i=x.getInstance().unit;(r["attr-text-stroke-width"]==null||r["attr-text-stroke-width"].value!=He)&&(r["attr-text-stroke-width"]={title:"Stroke Width",value:this.getCompareValue("attr-text-stroke-width",Xe(e.strokeWidth,void 0,i,this.unitConversion))}),(r["attr-reversed-phase"]==null||r["attr-reversed-phase"].value!=He)&&(r["attr-reversed-phase"]={title:"Reversed",value:this.getCompareValue("attr-reversed-phase","no")}),(r["attr-reversed-phase-extend"]==null||r["attr-reversed-phase-extend"].value!=He)&&(r["attr-reversed-phase-extend"]={title:"Reversed Extend",value:this.getCompareValue("attr-reversed-phase-extend","0")})}modifyDefultText(e,r){if(e.isEmpty)return;let i=new ft;if(r["attr-text-stroke-width"]!=null){let n=parseFloat(r["attr-text-stroke-width"])/10;x.getInstance().unit!="mil"&&(n=i.conversion(x.getInstance().unit,"mil",n)),e.strokeWidth=n}setTimeout(()=>{this.modifyFont(e,r)},0)}modifyFont(e,r){if(e.isEmpty)return;let i=new ft;if(r["attr-reversed-phase"]!=null){let n=r["attr-reversed-phase"]=="yes";e.reverse=n}if(r["attr-reversed-phase-extend"]!=null){let n=parseFloat(r["attr-reversed-phase-extend"])/10;x.getInstance().unit!="mil"&&(n=i.conversion(x.getInstance().unit,"mil",n)),e.reverseExpansion=n}}getFamily(){let e=new Array;for(let r of rt.defaultTextFamily)r!=""?e.push({value:r,text:r}):e.push({value:"default",text:"default"});return e}clearCache(){super.clearCache(),this.hasDefaultTextTypeface=!1}};var I0e=class extends ec{constructor(){super(...arguments);this.image=null}set(e){return this.image=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=x.getInstance().unit,i=x.getInstance().origin;this.attrlist==null&&(this.attrlist={});let n=this.attrlist;return this.getSilkColor(e,n),(n["attr-id"]==null||n["attr-id"].value!=He)&&(n["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${e.number}`),sourceId:e.globalIndex}),(n["attr-layerid"]==null||n["attr-layerid"].value!=He)&&(n["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Zn.image()}),(n["attr-width"]==null||n["attr-width"].value!=He)&&(n["attr-width"]={title:"Width",value:this.getCompareValue("attr-width",Xe(e.width,void 0,r,this.unitConversion))}),(n["attr-height"]==null||n["attr-height"].value!=He)&&(n["attr-height"]={title:"Height",value:this.getCompareValue("attr-height",Xe(e.height,void 0,r,this.unitConversion))}),(n["attr-mirror"]==null||n["attr-mirror"].value!=He)&&(n["attr-mirror"]={title:"Mirror",value:this.getCompareValue("attr-mirror",e.mirror?"yes":"no")}),(n["attr-combination"]==null||n["attr-combination"].value!=He)&&(n["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",kt.getGroupNameByGroupId(e.getGroupID())||""),options:this.poolCache.combinationOptions,hasParent:e.getParent()!=null}),(n["attr-start-x"]==null||n["attr-start-x"].value!=He)&&(n["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(e.start.x-i.x,void 0,r,this.unitConversion))}),(n["attr-start-y"]==null||n["attr-start-y"].value!=He)&&(n["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(e.start.y-i.y,void 0,r,this.unitConversion))}),(n["attr-rotation"]==null||n["attr-rotation"].value!=He)&&(n["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",uc(xe(e.rotation/Math.PI*180,3)))}),(n["attr-locked"]==null||n["attr-locked"].value!=He)&&(n["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),this}modifyBy(e,r){let n=new ft,s=x.getInstance().origin;if(e["attr-layerid"]!=null){if(this.image.locked)return;let a=parseInt(e["attr-layerid"]);this.image.layerId=a}if(e["attr-combination"]!=null){if(this.image.locked)return;this.modifyCombination(e["attr-combination"],this.image).forEach(l=>{r.addCommand(l)})}if(e["attr-width"]!=null){let a=parseFloat(e["attr-width"])/10;a=this.getValue(a),a=n.conversion(x.getInstance().unit,"mil",a),a>=nA&&(a=nA),a>0&&(a=Math.min(a,5e4),bP()&&(this.image.height=this.image.height/this.image.width*a),this.image.width=a)}if(e["attr-height"]!=null){let a=parseFloat(e["attr-height"])/10;a=this.getValue(a),a=n.conversion(x.getInstance().unit,"mil",a),length>=oA&&(length=oA),a>0&&(a=Math.min(a,5e4),bP()&&(this.image.width=this.image.width/this.image.height*a),this.image.height=a)}if(e["attr-mirror"]!=null){if(this.image.locked)return;let a=e["attr-mirror"]=="yes";this.image.mirror=a}if(e["attr-start-x"]!=null){if(this.image.locked)return;let a=parseFloat(e["attr-start-x"])/10;a=this.getValue(a),x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a=a+s.x;let l=new S(a,this.image.start.y);this.image.start=l}if(e["attr-start-y"]!=null){if(this.image.locked)return;let a=parseFloat(e["attr-start-y"])/10;a=this.getValue(a),x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a=a+s.y;let l=new S(this.image.start.x,a);this.image.start=l}if(e["attr-rotation"]!=null){if(this.image.locked)return;let a=parseFloat(e["attr-rotation"])/180*Math.PI;a=this.getValue(a),this.image.rotation=a}if(e["attr-locked"]!=null){let a=e["attr-locked"]=="yes";this.image.locked=a}e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?this.image.silkColor=null:this.image.silkColor=ee.of3(e["attr-silk-color"]))}};var ev=te.getInstance(),C0e=class extends ec{constructor(){super(...arguments);this.plane=null}set(e){return this.plane=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=x.getInstance().unit,i=e.layerId;this.attrlist==null&&(this.attrlist={});let n=this.attrlist;(n["attr-id"]==null||n["attr-id"].value!=He)&&(n["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${e.number}`),sourceId:e.globalIndex}),(n["attr-select-net"]==null||n["attr-select-net"].value!=He)&&(n["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.net),options:this.poolCache.allNetOptions||ze.getNet()});let s=Xd.fetchProfileItem(i);(n["attr-isolated-island"]==null||n["attr-isolated-island"].value!=He)&&(n["attr-isolated-island"]={title:"Keep Island",value:this.getCompareValue("attr-isolated-island",s&&s.keepIsland?"yes":"no")});let a=this.getSpacingRule("1",e.net,e.globalIndex);(n["attr-net-spacing-rule"]==null||n["attr-net-spacing-rule"].value!=He)&&(n["attr-net-spacing-rule"]={title:"Net Spacing Rule",value:this.getCompareValue("attr-net-spacing-rule",a.name),options:this.getRuleOptions("safe")});let l=p=>p.map(m=>a.getClearance(7,m)).map(m=>Xe(m,4,r,this.unitConversion)),c=[11,8],h=l(kY.filter(p=>!c.includes(p))),u=l(c);(n["attr-net-spacing-list"]==null||n["attr-net-spacing-list"].value!=He)&&(n["attr-net-spacing-list"]={title:"Network Spacing",value:this.getCompareValue("attr-net-spacing-list",h)}),(n["attr-dist-border-outline-list"]==null||n["attr-dist-border-outline-list"].value!=He)&&(n["attr-dist-border-outline-list"]={title:"Distance To Border Outline",value:this.getCompareValue("attr-dist-border-outline-list",u)});let d=this.getInnerRule("1",e.net,e.globalIndex);return(n["attr-net-thermals-rule"]==null||n["attr-net-thermals-rule"].value!=He)&&(n["attr-net-thermals-rule"]={title:"Net Thermals Rule",value:this.getCompareValue("attr-net-thermals-rule",d.name),options:this.getRuleOptions("plane")}),(n["attr-multi-layer-pad-connection"]==null||n["attr-multi-layer-pad-connection"].value!=He)&&(n["attr-multi-layer-pad-connection"]={title:"Pad Connection",value:this.getCompareValue("attr-multi-layer-pad-connection",d.getMultiConnectMode(i)),options:[{text:"Spoke",value:0},{text:"Direct",value:1},{text:"No Connection",value:2}]}),(n["attr-multi-layer-spoke-width"]==null||n["attr-multi-layer-spoke-width"].value!=He)&&(n["attr-multi-layer-spoke-width"]={title:"Spoke Width",value:this.getCompareValue("attr-multi-layer-spoke-width",Xe(d.getMultiLineWidth(i),void 0,r,this.unitConversion))}),(n["attr-multi-layer-spoke-spacing"]==null||n["attr-multi-layer-spoke-spacing"].value!=He)&&(n["attr-multi-layer-spoke-spacing"]={title:"Spoke Spacing",value:this.getCompareValue("attr-multi-layer-spoke-spacing",Xe(d.getMultiLineClearance(i),void 0,r,this.unitConversion))}),(n["attr-multi-layer-spoke-angles"]==null||n["attr-multi-layer-spoke-angles"].value!=He)&&(n["attr-multi-layer-spoke-angles"]={title:"Spoke Angles",value:this.getCompareValue("attr-multi-layer-spoke-angles",xe(d.getMultiLineAngle(i)/Math.PI*180,3)),options:[{text:"45 Degrees",value:45},{text:"90 Degrees",value:90}]}),this}getCompareValue(e,r){if(this.attrlist!=null){let i=this.attrlist[e];if(i!=null&&String(i.value)!=String(r))return He}return r}modifyBy(e,r){e["attr-select-net"]!=null&&(this.plane.net=e["attr-select-net"].toUpperCase());let i=this.plane.globalIndex,n=this.plane.net,s=te.getInstance().getNet(n);if(e["attr-net-spacing-rule"]!=null){let a=e["attr-net-spacing-rule"];if(s!=null){let c=te.getInstance().getDefaultSafeSpacing().name!==a?a:"default";s.safeCopperPlane?s.safeInnerPlane=c:s.safeSpacing&&(s.safeSpacing=c)}}if(e["attr-net-thermals-rule"]!=null){let a=e["attr-net-thermals-rule"];if(s!=null){let l=te.getInstance().getDefaultInnerPlane();s.innerPlane=l.name!==a?a:"default"}}if(e["attr-isolated-island"]!=null){let a=e["attr-isolated-island"],l=Xd.fetchProfileItem(this.plane.layerId);l.keepIsland=a==="yes",be.updatePlanzoneLayerKeepIsland(this.plane.layerId,l.keepIsland),Xd.updateProfileItem(this.plane.layerId,l),A.publish("rebuildSinglePlane",[this.plane.layerId])}}getRuleOptions(e){let r=new Set;switch(e){case"safe":r=ev.getAllSafeSpacing();break;case"other":r=ev.getAllOtherSpacing();break;case"creepage":r=ev.getAllCreepageSpacing();break;case"track":r=ev.getAllTrackPhysics();break;case"diff":r=ev.getAllDifferentialPhysics();break;case"radius":r=ev.getAllRadiusPhysics();break;case"copper":r=ev.getAllCopperPlane();break;case"plane":r=ev.getAllInnerPlane();break}let i=[];return r.forEach(n=>{i.push({text:n.name,value:n.name,isDefault:n.isDefault})}),i}getRule(e,r,i,n,s,a){let l;switch(e){case"1":l=n(r);break;case"2":let c=te.getInstance().getRegion(i);c!=null&&(l=s(c));break}return l||(l=a()),l}getSafeSpacingByNet(e){return ev.getSafeSpacingByNet(e,14)}getSpacingRule(e,r,i){let n=te.getInstance();return this.getRule(e,r,i,s=>this.getSafeSpacingByNet(s),s=>n.getSafeSpacing(s.safeClearance),()=>n.getDefaultSafeSpacing())}getInnerRule(e,r,i){return this.getRule(e,r,i,n=>te.getInstance().getInnerPlaneByNet(n),n=>te.getInstance().getInnerPlane(n.innerPlane),()=>te.getInstance().getDefaultInnerPlane())}};var S0e=class{constructor(){this.TAGGING=!0;this.PAD=!0;this.LINE2D=!0;this.TEXT=!0;this.COMPONENT_ATTR_TEXT=!0;this.COMPONENT=!0;this.TRACK=!0;this.VIA=!0;this.IMAGE=!0;this.TRUECOLORPICTRUE=!0;this.PLANEZONE=!0;this.TEARDROP=!0;this.SMARTDIMENSION=!0;this.D3SHELLOUTLINE=!0;this.D3SHELLSCREWPILLAR=!0;this.D3SHELLSLOTDATUNLINE=!0;this.D3SHELLGROOVINGAREA=!0;this.D3SHELLENTITY=!0;this.PADTEST=!0;this.FPC_STIFFENER=!0;this.COPPERRESULT=!0;this.ids=new Set;this.keepLast=!1}setStatus(t){let e=t.primitiveStatus;if(e!=null)for(let r of e)this.setStatus4AttributePrimitive(r.value,r.isChecked)}setStatus4AttributePrimitive(t,e){switch(t){case"TAGGING":this.TAGGING=e;break;case"PAD":this.PAD=e;break;case"2DLINE":this.LINE2D=e;break;case"TEXT":this.TEXT=e;break;case"COMPONENT_ATTR_TEXT":this.COMPONENT_ATTR_TEXT=e;break;case"DEVICE":this.COMPONENT=e;break;case"TRACK":this.TRACK=e;break;case"VIA":this.VIA=e;break;case"IMAGE":this.IMAGE=e;break;case"TRUECOLORPICTRUE":this.TRUECOLORPICTRUE=e;break;case"PLANEZONE":this.PLANEZONE=e;break;case"3D Shell - Outline":this.D3SHELLOUTLINE=e;break;case"3D Shell - Screw Pillar":this.D3SHELLSCREWPILLAR=e;break;case"3D Shell - Side Datum Line":this.D3SHELLSLOTDATUNLINE=e;break;case"3D Shell - Slot Region":this.D3SHELLGROOVINGAREA=e;break;case"3D Shell - Entity":this.D3SHELLENTITY=e;break;case"TESTPOINTER":{this.PADTEST=e;break}case"FPC_STIFFENER":{this.FPC_STIFFENER=e;break}case"TEARDROP":{this.TEARDROP=e;break}case"SMARTDIMENSION":{this.SMARTDIMENSION=e;break}case"COPPERRESULT":{this.COPPERRESULT=e;break}default:}}update(t){if(t.length==0)this.restore();else{this.keepLast=!1;let e=!1;for(let r of t)if(!this.ids.has(r.globalIndex)){e=!0;break}e&&this.restore(),this.ids.clear();for(let r of t)this.ids.add(r.globalIndex)}return this}inOld(t){return this.ids.has(t.globalIndex)}update4(t,e){return t&&this.restore(),this.ids.clear(),this.ids=e,this}getStatus4Types(t){let e={};for(let r of t){let i=this.getItemStatus4Type(r);r!=null&&i!=null&&(e[r]=i)}return e}getStatus(t){let e={};for(let r of t){let i=this.getType(r),n=this.getItemStatus(r);i!=null&&n!=null&&(e[i]=n)}return e}getItemStatus(t){return t instanceof ca?this.TAGGING:t instanceof ol?this.TAGGING:t instanceof xa?this.TAGGING:t instanceof Ri?t.isTestPad?this.PADTEST:this.PAD:t instanceof fn?this.PAD:t instanceof Sr?_c(t.layerId)?this.FPC_STIFFENER:ba(t.layerId)?this.get3DShellStatus(t):this.LINE2D:t instanceof nr?_c(t.layerId)?this.FPC_STIFFENER:ba(t.layerId)?this.get3DShellStatus(t):this.LINE2D:t instanceof ct?_c(t.layerId)?this.FPC_STIFFENER:t.type=="TearDrop"?this.TEARDROP:ba(t.layerId)?this.get3DShellStatus(t):this.LINE2D:t instanceof mt?_c(t.layerId)?this.FPC_STIFFENER:ba(t.layerId)?this.get3DShellStatus(t):this.LINE2D:t instanceof vt?_c(t.layerId)?this.FPC_STIFFENER:ba(t.layerId)?this.get3DShellStatus(t):this.LINE2D:t instanceof fr?t.key!==""?this.COMPONENT_ATTR_TEXT:this.TEXT:t instanceof Me?this.COMPONENT:t instanceof Ue?this.TRACK:t instanceof Ge?this.VIA:t instanceof Yn?this.IMAGE:t instanceof Rs?this.TRUECOLORPICTRUE:t instanceof Ki?this.PLANEZONE:t instanceof Nh?this.SMARTDIMENSION:t instanceof ii?this.COPPERRESULT:null}getItemStatus4Type(t){switch(t){case"TAGGING":return this.TAGGING;case"TESTPOINTER":return this.PADTEST;case"PAD":return this.PAD;case"FPC_STIFFENER":return this.FPC_STIFFENER;case"2DLINE":return this.LINE2D;case"TEARDROP":return this.TEARDROP;case"COMPONENT_ATTR_TEXT":return this.COMPONENT_ATTR_TEXT;case"TEXT":return this.TEXT;case"DEVICE":return this.COMPONENT;case"TRACK":return this.TRACK;case"VIA":return this.VIA;case"IMAGE":return this.IMAGE;case"TRUECOLORPICTRUE":return this.TRUECOLORPICTRUE;case"PLANEZONE":return this.PLANEZONE;case"3D Shell - Outline":return this.D3SHELLOUTLINE;case"3D Shell - Screw Pillar":return this.D3SHELLSCREWPILLAR;case"3D Shell - Side Datum Line":return this.D3SHELLSLOTDATUNLINE;case"3D Shell - Slot Region":return this.D3SHELLGROOVINGAREA;case"3D Shell - Entity":return this.D3SHELLENTITY;case"COPPERRESULT":return this.COPPERRESULT;case"SMARTDIMENSION":return this.SMARTDIMENSION;default:return null}}getType(t){return t instanceof ca?"TAGGING":t instanceof ol?"TAGGING":t instanceof xa?"TAGGING":t instanceof Ri?t.isTestPad?"TESTPOINTER":"PAD":t instanceof fn?"PAD":t instanceof Sr?_c(t.layerId)?"FPC_STIFFENER":ba(t.layerId)?this.get3DShellPrimitive(t):"2DLINE":t instanceof nr?_c(t.layerId)?"FPC_STIFFENER":ba(t.layerId)?this.get3DShellPrimitive(t):"2DLINE":t instanceof ct?_c(t.layerId)?"FPC_STIFFENER":t.type=="TearDrop"?"TEARDROP":ba(t.layerId)?this.get3DShellPrimitive(t):"2DLINE":t instanceof mt?_c(t.layerId)?"FPC_STIFFENER":ba(t.layerId)?this.get3DShellPrimitive(t):"2DLINE":t instanceof vt?_c(t.layerId)?"FPC_STIFFENER":ba(t.layerId)?this.get3DShellPrimitive(t):"2DLINE":t instanceof fr?t.key!==""?"COMPONENT_ATTR_TEXT":"TEXT":t instanceof Me?"DEVICE":t instanceof Ue?"TRACK":t instanceof Ge?"VIA":t instanceof Yn?"IMAGE":t instanceof Rs?"TRUECOLORPICTRUE":t instanceof Ki?"PLANEZONE":t instanceof Nh?"SMARTDIMENSION":t instanceof ii?"COPPERRESULT":null}get3DShellPrimitive(t){switch((t instanceof mt||t instanceof vt?t.getParent():t).type){case"3D Shell - Outline":return"3D Shell - Outline";case"3D Shell - Screw Pillar":return"3D Shell - Screw Pillar";case"3D Shell - Side Datum Line":return"3D Shell - Side Datum Line";case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":return"3D Shell - Slot Region";case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":return"3D Shell - Entity"}return null}get3DShellStatus(t){switch((t instanceof mt||t instanceof vt?t.getParent():t).type){case"3D Shell - Outline":return this.D3SHELLOUTLINE;case"3D Shell - Screw Pillar":return this.D3SHELLSCREWPILLAR;case"3D Shell - Side Datum Line":return this.D3SHELLSLOTDATUNLINE;case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":return this.D3SHELLGROOVINGAREA;case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":return this.D3SHELLENTITY}return null}restore(){this.TAGGING=!0,this.PAD=!0,this.LINE2D=!0,this.TEXT=!0,this.COMPONENT_ATTR_TEXT=!0,this.COMPONENT=!0,this.TRACK=!0,this.VIA=!0,this.IMAGE=!0,this.TRUECOLORPICTRUE=!0,this.PLANEZONE=!0,this.TEARDROP=!0,this.SMARTDIMENSION=!0,this.COPPERRESULT=!0,this.FPC_STIFFENER=!0,this.D3SHELLOUTLINE=!0,this.D3SHELLSCREWPILLAR=!0,this.D3SHELLSLOTDATUNLINE=!0,this.D3SHELLGROOVINGAREA=!0,this.D3SHELLENTITY=!0,this.PADTEST=!0,this.ids.clear()}};var E0e=class extends IP{constructor(){super()}getHtmlData(t){let e=super.getHtmlData(t);return delete e["attr-footprint-id"],this}};var tv=class extends ec{constructor(){super(...arguments);this.selects=new Array;this.d3ShellObj=null;this.obj=null}set(e){return this.d3ShellObj=e,this.obj=e instanceof mt||e instanceof vt?e.getParent():e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=x.getInstance().unit;this.selects.length=0,e instanceof ct?this.selects=e.getSelects():(e instanceof mt||e instanceof vt)&&this.selects.push(e),this.attrlist==null&&(this.attrlist={});let i=this.attrlist,n=e instanceof mt||e instanceof vt?e.getParent():e;(i["attr-layerid"]==null||i["attr-layerid"].value!=He)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",this.getCompareValue("attr-layerid",n.layerId)),options:Zn.createLayerOptionsByLineloop(n,i["attr-layerid"]?i["attr-layerid"].options:[]),disabled:!1}),(i["attr-combination"]==null||i["attr-combination"].value!=He)&&(i["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",this.getCompareValue("attr-combination",kt.getGroupNameByGroupId(n.getGroupID())||"")),options:this.poolCache.combinationOptions}),(i["attr-locked"]==null||i["attr-locked"].value!=He)&&(i["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",this.getCompareValue("attr-locked",n.locked?"yes":"no")),options:this.poolCache.lockSettingOptions}),(i["attr-id"]==null||i["attr-id"].value!=He)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",this.getCompareValue("attr-id",`${ur}${n.number}`)),sourceId:n.globalIndex});let s=n.type,a=n.getComponent();switch(s){case"3D Shell - Outline":{this.getOutlineAttrs(e,n,a);break}case"3D Shell - Screw Pillar":{this.getScrewPillarttrs(e,n,a);break}case"3D Shell - Side Datum Line":{this.getSideSlotDatumLineAttrs(e,n,a);break}case"3D Shell - Side Slot Region":{this.getSideSlotRegionAttrs(e,n,a);break}case"3D Shell - Top Slot Region":{this.getTopSlotRegionAttrs(e,n,a);break}case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":{this.getEntityAttrs(e,n,a);break}}return this}getOutlineAttrs(e,r,i){let n=x.getInstance().unit,s=this.attrlist;return s["attr-3d-shell-entityType"]={title:"Entity Type",value:this.getCompareValue("attr-3d-shell-entityType",r.type),disabled:!1},s["attr-3d-shell-type"]={title:"Type",value:this.getCompareValue("attr-3d-shell-type",i.type)},s["attr-3d-shell-push-cover-direction"]={title:"Push Cover Direction",value:this.getCompareValue("attr-3d-shell-push-cover-direction",i.pushCoverDir),options:[{text:"Shell X Axis Positive",value:1},{text:"Shell X Axis Negative",value:2},{text:"Shell Y Axis Positive",value:4},{text:"Shell Y Axis Negative",value:8}]},s["attr-3d-shell-top-inner-height"]={title:"Top Inner Height",value:this.getCompareValue("attr-3d-shell-top-inner-height",Xe(i.topInnerHeight,void 0,n,this.unitConversion))},s["attr-3d-shell-bottom-inner-height"]={title:"Bottom Inner Height",value:this.getCompareValue("attr-3d-shell-bottom-inner-height",Xe(i.bottomInnerHeight,void 0,n,this.unitConversion))},s["attr-3d-shell-height"]={title:"Overall height of shell",value:this.getCompareValue("attr-3d-shell-height",Xe(i.shellHeight))},s["attr-3d-shell-substrate-height"]={title:"PCB Height From The Bottom Surface of Shell",value:this.getCompareValue("attr-3d-shell-substrate-height",Xe(i.substrateHeight,void 0,n,this.unitConversion))},s["attr-3d-lower-shell-height"]={title:"Height of lower shell",value:this.getCompareValue("attr-3d-lower-shell-height",Xe(i.botShellHeight,void 0,n,this.unitConversion))},s["attr-3d-shell-thickness"]={title:"Shell thickness",value:this.getCompareValue("attr-3d-shell-thickness",Xe(i.shellThickness,void 0,n,this.unitConversion))},s["attr-3d-shell-line-width"]={title:"Line Width",value:this.getCompareValue("attr-3d-shell-line-width",Xe(r.strokeWidth,void 0,n,this.unitConversion))},Object.assign(s,this.getProfileAttrs(e)),s}getScrewPillarttrs(e,r,i){let n=x.getInstance().unit,s=this.attrlist,a=x.getInstance().origin;s["attr-3d-shell-entityType"]={title:"Entity Type",value:this.getCompareValue("attr-3d-shell-entityType",r.type),disabled:!1},s["attr-3d-shell-screw-specifications"]={title:"Screw specifications",value:this.getCompareValue("attr-3d-shell-screw-specifications",i.specification)},s["attr-3dshell-Shell-screw-column-height"]={title:"Height",value:this.getCompareValue("attr-3dshell-Shell-screw-column-height",Xe(i.height,void 0,n,this.unitConversion))},s["attr-3dshell-shell-screw-hole-diameter"]={title:"Hole Diameter",value:this.getCompareValue("attr-3dshell-shell-screw-hole-diameter",Xe(i.holeDiameter,void 0,n,this.unitConversion))},s["attr-3dshell-shell-screw-thickness"]={title:"Thickness",value:this.getCompareValue("attr-3dshell-shell-screw-thickness",Xe(i.thickness,void 0,n,this.unitConversion))},s["attr-3d-shell-need-stiffener"]={title:"Need Stiffener",value:this.getCompareValue("attr-3d-shell-need-stiffener",i.needStiffener)};let l=i.stiffenerProps;l&&(s["attr-3d-shell-stiffener-top-width"]={title:"Top Width of Stiffener",value:this.getCompareValue("attr-3d-shell-stiffener-top-width",Xe(l.topWidth,void 0,n,this.unitConversion))},s["attr-3d-shell-stiffener-bottom-width"]={title:"Bottom Width of Stiffener",value:this.getCompareValue("attr-3d-shell-stiffener-bottom-width",Xe(l.bottomWidth,void 0,n,this.unitConversion))},s["attr-3d-shell-stiffener-height"]={title:"Stiffener Height",value:this.getCompareValue("attr-3d-shell-stiffener-height",Xe(l.height,void 0,n,this.unitConversion))},s["attr-3d-shell-stiffener-thickness"]={title:"Stiffener Thickness",value:this.getCompareValue("attr-3d-shell-stiffener-thickness",Xe(l.stiffThickness,void 0,n,this.unitConversion))}),s["attr-3d-shell-need-counterbore"]={title:"Need Counterbore",value:this.getCompareValue("attr-3d-shell-need-counterbore",i.needCounterbore)};let c=i.counterboreProps;return c&&(s["attr-3d-shell-counterbore-height"]={title:"Counterbore Height",value:this.getCompareValue("attr-3d-shell-counterbore-height",Xe(c.height,void 0,n,this.unitConversion))},s["attr-3d-shell-counterbore-diameter"]={title:"Counterbore Diameter",value:this.getCompareValue("attr-3d-shell-counterbore-diameter",Xe(c.diameter,void 0,n,this.unitConversion))}),s["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",Xe(e.center.x-a.x,void 0,n,this.unitConversion))},s["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",Xe(e.center.y-a.y,void 0,n,this.unitConversion))},s}getSideSlotDatumLineAttrs(e,r,i){let n=x.getInstance().unit,s=this.attrlist,a=x.getInstance().origin;return s["attr-3d-shell-entityType"]={title:"Entity Type",value:this.getCompareValue("attr-3d-shell-entityType",r.type),disabled:!1},s["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(r.start.x-a.x,void 0,n,this.unitConversion))},s["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(r.start.y-a.y,void 0,n,this.unitConversion))},s["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",Xe(r.end.x-a.x,void 0,n,this.unitConversion))},s["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",Xe(r.end.y-a.y,void 0,n,this.unitConversion))},s}getEntityAttrs(e,r,i){let n=x.getInstance().unit,s=pt.getItem(i.lineId),a=this.attrlist;a["attr-3d-shell-entityType"]={title:"Entity Type",value:this.getCompareValue("attr-3d-shell-entityType","3D Shell - Entity"),disabled:!1},a["attr-3dshell-entity-region-type"]={title:"Entity Region Type",value:this.getCompareValue("attr-3dshell-entity-region-type",i.type)},a["attr-baseline"]={title:"Baseline",value:this.getCompareValue("attr-baseline",`${ur}${s==null?void 0:s.number}`),sourceId:i.lineId,readonly:!0},a["attr-3dshell-entity-region-stretch-length"]={title:"Stretch Length",value:this.getCompareValue("attr-3dshell-entity-region-stretch-length",Xe(i.stretchLength,void 0,n,this.unitConversion))};let l=null,c=D9.getOutline();return c&&c.getComponent().type==="T&B"&&(l=i.belong),a["attr-3dshell-entity-region-belong"]={title:"Belong",value:this.getCompareValue("attr-3dshell-entity-region-belong",l),options:wl.getBelongOptions()},a["attr-3d-shell-line-width"]={title:"Line Width",value:this.getCompareValue("attr-3d-shell-line-width",Xe(r.strokeWidth,void 0,n,this.unitConversion))},Object.assign(a,this.getProfileAttrs(e)),a}getTopSlotRegionAttrs(e,r,i){let n=x.getInstance().unit,s=this.attrlist;s["attr-3d-shell-entityType"]={title:"Entity Type",value:this.getCompareValue("attr-3d-shell-entityType","3D Shell - Slot Region"),disabled:!1},s["attr-3d-shell-grooving-type"]={title:"Grooving Type",value:this.getCompareValue("attr-3d-shell-grooving-type","top_bottom")},s["attr-3d-shell-slot-depth"]={title:"Slot depth",value:this.getCompareValue("attr-3d-shell-slot-depth",Xe(i.slotDepth,void 0,n,this.unitConversion))},s["attr-3d-shell-line-width"]={title:"Line Width",value:this.getCompareValue("attr-3d-shell-line-width",Xe(r.strokeWidth,void 0,n,this.unitConversion))};let a=new Set(i.slotOption);return s["attr-3dshell-slot-option-outline"]={title:"D3shell Outline",value:this.getCompareValue("attr-3dshell-slot-option-outline",a.has(4))},s["attr-3dshell-slot-option-screw-pillar"]={title:"D3shell ScrewPillar",value:this.getCompareValue("attr-3dshell-slot-option-screw-pillar",a.has(8))},s["attr-3dshell-slot-option-entity"]={title:"D3shell Entity",value:this.getCompareValue("attr-3dshell-slot-option-entity",a.has(16))},Object.assign(s,this.getProfileAttrs(e)),s}getSideSlotRegionAttrs(e,r,i){let n=pt.getItem(i.lineId),s=x.getInstance().unit,a=this.attrlist;a["attr-3d-shell-entityType"]={title:"Entity Type",value:this.getCompareValue("attr-3d-shell-entityType","3D Shell - Slot Region"),disabled:!1},a["attr-3d-shell-grooving-type"]={title:"Grooving Type",value:this.getCompareValue("attr-3d-shell-grooving-type","side")},a["attr-baseline"]={title:"Baseline",value:this.getCompareValue("attr-baseline",`${ur}${n.number}`),sourceId:i.lineId,readonly:!0},a["attr-3d-shell-slot-depth"]={title:"Slot depth",value:this.getCompareValue("attr-3d-shell-slot-depth",Xe(i.slotDepth,void 0,s,this.unitConversion))},a["attr-3d-shell-line-width"]={title:"Line Width",value:this.getCompareValue("attr-3d-shell-line-width",Xe(r.strokeWidth,void 0,s,this.unitConversion))};let l=new Set(i.slotOption);return a["attr-3dshell-slot-option-outline"]={title:"D3shell Outline",value:this.getCompareValue("attr-3dshell-slot-option-outline",l.has(4))},a["attr-3dshell-slot-option-screw-pillar"]={title:"D3shell ScrewPillar",value:this.getCompareValue("attr-3dshell-slot-option-screw-pillar",l.has(8))},a["attr-3dshell-slot-option-entity"]={title:"D3shell Entity",value:this.getCompareValue("attr-3dshell-slot-option-entity",l.has(16))},Object.assign(a,this.getProfileAttrs(e)),a}getProfileAttrs(e){let r=x.getInstance().unit,i=this.attrlist,n=x.getInstance().origin,s;if(e instanceof mt){let a=e;s="Line Outline",i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(a.start.x-n.x,void 0,r,this.unitConversion))},i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(a.start.y-n.y,void 0,r,this.unitConversion))},i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",Xe(a.end.x-n.x,void 0,r,this.unitConversion))},i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",Xe(a.end.y-n.y,void 0,r,this.unitConversion))}}else if(e instanceof ct&&this.selects.length===1&&this.selects[0]instanceof mt){let a=this.selects[0];s="Line Outline",i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(a.start.x-n.x,void 0,r,this.unitConversion))},i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(a.start.y-n.y,void 0,r,this.unitConversion))},i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",Xe(a.end.x-n.x,void 0,r,this.unitConversion))},i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",Xe(a.end.y-n.y))}}else if(e instanceof vt){let a=e;s="Arc Outline";let l=new ro,{start:c,end:h,angle:u}=l.angleToPoint(a.center,a.radius,a.startAngle,a.endAngle,a.sweep);i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(c.x-n.x,void 0,r,this.unitConversion))},i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(c.y-n.y,void 0,r,this.unitConversion))},i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",Xe(h.x-n.x,void 0,r,this.unitConversion))},i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",Xe(h.y-n.y,void 0,r,this.unitConversion))},i["attr-arc-angle"]={title:"Arc Angle",value:this.getCompareValue("attr-arc-angle",xe(u/Math.PI*180,3))}}else if(e instanceof ct&&this.selects.length===1&&this.selects[0]instanceof vt){let a=this.selects[0];s="Arc Outline";let l=new ro,{start:c,end:h,angle:u}=l.angleToPoint(a.center,a.radius,a.startAngle,a.endAngle,a.sweep);i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(c.x-n.x,void 0,r,this.unitConversion))},i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(c.y-n.y,void 0,r,this.unitConversion))},i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",Xe(h.x-n.x,void 0,r,this.unitConversion))},i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",Xe(h.y-n.y,void 0,r,this.unitConversion))},i["attr-arc-angle"]={title:"Arc Angle",value:this.getCompareValue("attr-arc-angle",xe(u/Math.PI*180,3))}}else if(e instanceof Sr){let a=e;s="Round Outline",i["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",Xe(a.center.x-n.x,void 0,r,this.unitConversion))},i["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",Xe(a.center.y-n.y,void 0,r,this.unitConversion))},i["attr-radius"]={title:"Radius",value:this.getCompareValue("attr-radius",Xe(a.radius,void 0,r,this.unitConversion))}}else if(e instanceof nr){let a=e;s="Rectangle Outline",i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(a.start.x-n.x,void 0,r,this.unitConversion))},i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(a.start.y-n.y,void 0,r,this.unitConversion))},i["attr-width"]={title:"Width",value:this.getCompareValue("attr-width",Xe(a.width,void 0,r,this.unitConversion))},i["attr-height"]={title:"Height",value:this.getCompareValue("attr-height",Xe(a.height,void 0,r,this.unitConversion))},i["attr-corner-radius"]={title:"Corner Radius",value:this.getCompareValue("attr-corner-radius",Xe(a.cornerRadius,void 0,r,this.unitConversion))},i["attr-rotation"]={title:"rotate",value:this.getCompareValue("attr-rotation",uc(xe(a.rotation/Math.PI*180,3)))}}return i["attr-profile-type"]={title:"ProfileModel type",value:this.getCompareValue("attr-profile-type",s),disabled:!1},i}modifyBy(e,r){let i=null;if(this.d3ShellObj instanceof mt||this.d3ShellObj instanceof vt){let n=this.d3ShellObj.getParent();this.modifyPolygon(e,n,r),i=n.getComponent()}else this.d3ShellObj instanceof ct?(this.modifyPolygon(e,this.d3ShellObj,r),i=this.d3ShellObj.getComponent()):this.d3ShellObj instanceof Sr?(this.modifyCircle(e,this.d3ShellObj,r),i=this.d3ShellObj.getComponent()):this.d3ShellObj instanceof nr&&(this.modifyRect(e,this.d3ShellObj,r),i=this.d3ShellObj.getComponent());i!=null&&(i instanceof K0?this.modifyD3ShellOutlineComponent(e,i):i instanceof um?this.modifyD3ShellScrewPillarComponent(e,i):i instanceof ou?this.modifyD3ShellSlotRegionComponent(e,i,r):i instanceof wl&&this.modifyD3ShellEntityComponent(e,i,r))}modifyCircle(e,r,i){let n=new ft,s=x.getInstance().origin;if(e["attr-layerid"]!=null){if(r.locked)return;r.layerId=parseInt(e["attr-layerid"])}if(e["attr-3d-shell-line-width"]!=null){let a=parseFloat(e["attr-3d-shell-line-width"])/10;x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),r.strokeWidth=a}if(e["attr-locked"]!=null&&(r.locked=e["attr-locked"]=="yes"),e["attr-x"]!=null){if(r.locked)return;let a=parseFloat(e["attr-x"])/10;x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a=a+s.x,r.center=new S(a,r.center.y)}if(e["attr-y"]!=null){if(r.locked)return;let a=parseFloat(e["attr-y"])/10;x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a=a+s.y,r.center=new S(r.center.x,a)}if(e["attr-radius"]!=null){if(r.locked)return;let a=parseFloat(e["attr-radius"])/10;x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),r.radius=a}if(e["attr-combination"]!=null){if(r.locked)return;let a=this.modifyCombination(e["attr-combination"],r);i&&a.forEach(l=>{i.addCommand(l)})}}modifyRect(e,r,i){let n=new ft,s=x.getInstance().origin;if(e["attr-layerid"]!=null){if(r.locked)return;r.layerId=parseInt(e["attr-layerid"])}if(e["attr-3d-shell-line-width"]!=null){let a=parseFloat(e["attr-3d-shell-line-width"])/10;x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),r.strokeWidth=a}if(e["attr-rotation"]!=null){if(r.locked)return;let a=parseFloat(e["attr-rotation"])/180*Math.PI;a=this.getValue(a),r.rotation=a}if(e["attr-locked"]!=null&&(r.locked=e["attr-locked"]=="yes"),e["attr-start-x"]!=null){if(r.locked)return;let a=parseFloat(e["attr-start-x"])/10;x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a=a+s.x,r.start=new S(a,r.start.y)}if(e["attr-start-y"]!=null){if(r.locked)return;let a=parseFloat(e["attr-start-y"])/10;x.getInstance().unit!="mil"&&(a=n.conversion(x.getInstance().unit,"mil",a)),a=a+s.y,r.start=new S(r.start.x,a)}if(e["attr-width"]!=null){if(r.locked)return;let a=n.conversion(x.getInstance().unit,"mil",parseFloat(e["attr-width"])/10);bP()&&(r.height=r.height/r.width*a),r.width=a}if(e["attr-height"]!=null){if(r.locked)return;let a=n.conversion(x.getInstance().unit,"mil",parseFloat(e["attr-height"])/10);bP()&&(r.width=r.width/r.height*a),r.height=a}if(e["attr-corner-radius"]!=null){if(r.locked)return;let a=n.conversion(x.getInstance().unit,"mil",parseFloat(e["attr-corner-radius"])/10);a>=0&&(r.cornerRadius=a)}if(e["attr-combination"]!=null){if(r.locked)return;let a=this.modifyCombination(e["attr-combination"],r);i&&a.forEach(l=>{i.addCommand(l)})}}modifyPolygon(e,r,i){let n=x.getInstance().origin,s=new ft;if(e["attr-layerid"]!=null){if(r.locked)return;r.layerId=parseInt(e["attr-layerid"])}if(e["attr-3d-shell-line-width"]!=null){let c=parseFloat(e["attr-3d-shell-line-width"])/10;x.getInstance().unit!="mil"&&(c=s.conversion(x.getInstance().unit,"mil",c)),r.strokeWidth=c}if(e["attr-locked"]!=null&&(r.locked=e["attr-locked"]=="yes"),e["attr-combination"]!=null){if(r.locked)return;let c=this.modifyCombination(e["attr-combination"],r);i&&c.forEach(h=>{i.addCommand(h)})}let a=r.getSelects();a.length==0&&(a=this.selects),r.onlyOneChilds()!=null&&(a=[r.onlyOneChilds()]);let l=r.isClose();for(let c of a){if(e["attr-start-x"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-start-x"])/10;x.getInstance().unit!="mil"&&(d=s.conversion(x.getInstance().unit,"mil",d)),d=d+n.x,c.start=new S(d,c.start.y)}if(e["attr-start-y"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-start-y"])/10;x.getInstance().unit!="mil"&&(d=s.conversion(x.getInstance().unit,"mil",d)),d=d+n.y,c.start=new S(c.start.x,d)}if(e["attr-end-x"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-end-x"])/10;x.getInstance().unit!="mil"&&(d=s.conversion(x.getInstance().unit,"mil",d)),d=d+n.x,c.end=new S(d,c.end.y)}if(e["attr-end-y"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-end-y"])/10;x.getInstance().unit!="mil"&&(d=s.conversion(x.getInstance().unit,"mil",d)),d=d+n.y,c.end=new S(c.end.x,d)}if(c instanceof vt){if(e["attr-arc-angle"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-arc-angle"]);if(Math.abs(d)<.001)d=.001;else if(Math.abs(d)>.001){let I=Math.abs(d)%360;I<.001&&I>0?d=.001:(I>359.999||I==0)&&(d=359.999)}let p=d/180*Math.PI,m=new ro,{center:g,radius:y,startAngle:b,endAngle:P,sweep:T}=m.pointToAngle(c.start,c.end,p);c.center=g,c.radius=y,c.startAngle=b,c.endAngle=P,c.sweep=T}if(e["attr-start-x"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-start-x"])/10;x.getInstance().unit!="mil"&&(d=s.conversion(x.getInstance().unit,"mil",d)),d=d+n.x,c.start=new S(d,c.start.y)}if(e["attr-start-y"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-start-y"])/10;x.getInstance().unit!="mil"&&(d=s.conversion(x.getInstance().unit,"mil",d)),d=d+n.y,c.start=new S(c.start.x,d)}if(e["attr-end-x"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-end-x"])/10;x.getInstance().unit!="mil"&&(d=s.conversion(x.getInstance().unit,"mil",d)),d=d+n.x,c.end=new S(d,c.end.y)}if(e["attr-end-y"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-end-y"])/10;x.getInstance().unit!="mil"&&(d=s.conversion(x.getInstance().unit,"mil",d)),d=d+n.y,c.end=new S(c.end.x,d)}}let h=r.getConnect(c,!0,!0,l),u=r.getConnect(c,!1,!0,l);h!=null&&jU(h,c.start,!1),u!=null&&jU(u,c.end)}}modifyD3ShellOutlineComponent(e,r){let i=new ft;if(e["attr-3d-shell-type"]!=null&&(r.type=e["attr-3d-shell-type"]),e["attr-3d-shell-push-cover-direction"]!=null&&(r.pushCoverDir=Number(e["attr-3d-shell-push-cover-direction"])),e["attr-3d-shell-top-inner-height"]!=null){let n=parseFloat(e["attr-3d-shell-top-inner-height"])/10;x.getInstance().unit!="mil"&&(n=i.conversion(x.getInstance().unit,"mil",n)),r.topInnerHeight=n}if(e["attr-3d-shell-bottom-inner-height"]!=null){let n=parseFloat(e["attr-3d-shell-bottom-inner-height"])/10;x.getInstance().unit!="mil"&&(n=i.conversion(x.getInstance().unit,"mil",n)),r.bottomInnerHeight=n}if(e["attr-3d-shell-height"]!=null){let n=parseFloat(e["attr-3d-shell-height"])/10;x.getInstance().unit!="mil"&&(n=i.conversion(x.getInstance().unit,"mil",n)),r.shellHeight=n}if(e["attr-3d-shell-substrate-height"]!=null){let n=parseFloat(e["attr-3d-shell-substrate-height"])/10;x.getInstance().unit!="mil"&&(n=i.conversion(x.getInstance().unit,"mil",n)),r.substrateHeight=n}if(e["attr-3d-lower-shell-height"]!=null){let n=parseFloat(e["attr-3d-lower-shell-height"])/10;x.getInstance().unit!="mil"&&(n=i.conversion(x.getInstance().unit,"mil",n)),r.botShellHeight=n}if(e["attr-3d-shell-thickness"]!=null){let n=parseFloat(e["attr-3d-shell-thickness"])/10;if(x.getInstance().unit!="mil"&&(n=i.conversion(x.getInstance().unit,"mil",n)),r.shellThickness=n,this.d3ShellObj instanceof mt||this.d3ShellObj instanceof vt){let s=this.d3ShellObj.getParent();s.strokeWidth=n}else this.d3ShellObj.strokeWidth=n}r.type==="DRAWER"&&this.d3ShellObj instanceof nr&&LD.correctPushCoverWidthAndHeight(r,this.d3ShellObj)&&A.publish("ui/toastMsg",{type:"warn",msg:"The width and height of the push cover type 3D shell should not be less than 5mm"},$())}modifyD3ShellScrewPillarComponent(e,r){let i=new ft;if(e["attr-3d-shell-screw-specifications"]!=null&&(r.specification=e["attr-3d-shell-screw-specifications"]),e["attr-3dshell-Shell-screw-column-height"]!=null){let s=parseFloat(e["attr-3dshell-Shell-screw-column-height"])/10;x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),ey.correctHeight(s,r)}if(e["automatic-calibration"]!=null&&(r.height=ey.getDefaultScrewHeight(this.obj.layerId)),e["attr-3dshell-shell-screw-hole-diameter"]!=null){let s=parseFloat(e["attr-3dshell-shell-screw-hole-diameter"])/10;x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),ey.correctHoleDiameter(s,r)&&(r.specification="Custom")}if(e["attr-3dshell-shell-screw-thickness"]!=null){let s=parseFloat(e["attr-3dshell-shell-screw-thickness"])/10;x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),ey.correctThickness(s,r)}if(e["attr-layerid"]!=null){let s=e["attr-layerid"]==55;r.needStiffener=s,r.needCounterbore=!s}if(e["attr-3d-shell-need-stiffener"]!=null){let s=e["attr-3d-shell-need-stiffener"]==="true";r.needStiffener=s}if(e["attr-3d-shell-stiffener-top-width"]!=null){let s=parseFloat(e["attr-3d-shell-stiffener-top-width"])/10;x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),ey.correctStiffenerTopWidth(s,r)&&(r.specification="Custom")}if(e["attr-3d-shell-stiffener-bottom-width"]!=null){let s=parseFloat(e["attr-3d-shell-stiffener-bottom-width"])/10;x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),ey.correctStiffenerBottomWidth(s,r)&&(r.specification="Custom")}if(e["attr-3d-shell-stiffener-height"]!=null){let s=parseFloat(e["attr-3d-shell-stiffener-height"])/10;x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),ey.correctStiffenerHeight(s,r)&&(r.specification="Custom")}if(e["attr-3d-shell-stiffener-thickness"]!=null){let s=parseFloat(e["attr-3d-shell-stiffener-thickness"])/10;x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),ey.correctStiffenerThickness(s,r)&&(r.specification="Custom")}if(e["attr-3d-shell-need-counterbore"]!=null){let s=e["attr-3d-shell-need-counterbore"]==="true";r.needCounterbore=s}if(e["attr-3d-shell-counterbore-height"]!=null){let s=parseFloat(e["attr-3d-shell-counterbore-height"])/10;x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),ey.correctCounterboreHeight(s,r)&&(r.specification="Custom")}if(e["attr-3d-shell-counterbore-diameter"]!=null){let s=parseFloat(e["attr-3d-shell-counterbore-diameter"])/10;x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),ey.correctCounterboreDiameter(s,r)&&(r.specification="Custom")}ey.correctAllProps(r),r.syncLatestData();let n=ey.getScrewPillarSizeInIframe(r);this.d3ShellObj.radius=n.outerRadius}modifyD3ShellEntityComponent(e,r,i){let n=new ft;if(e["attr-3dshell-entity-region-type"]!=null){let s=e["attr-3dshell-entity-region-type"];s==="top_bottom"?(r.lineId!=null&&$a.getInstance().delConnectRelatedId(r.lineId,this.obj.globalIndex),r.type=s,r.lineId=null,this.obj.type="3D Shell - Top/Bottom Entity"):s==="side"&&(A.messageBus.publish("clearSelect",""),uh.setGroup(i),uh.addItem(this.obj.globalIndex),uh.setOnceCallback(()=>{A.publish("tool","dropdrag")}),setTimeout(()=>{uh.toggleTool()},0))}if(e["attr-3dshell-entity-region-stretch-length"]!=null){let s=parseFloat(e["attr-3dshell-entity-region-stretch-length"])/10;x.getInstance().unit!="mil"&&(s=n.conversion(x.getInstance().unit,"mil",s)),r.stretchLength=s}if(e["attr-3dshell-entity-region-belong"]!=null){let s=e["attr-3dshell-entity-region-belong"];r.belong=Number(s)}e["automatic-calibration"]!=null&&(r.stretchLength=r.type==="side"?D9.getDefaultSideSlotDepth(r.lineId):D9.getDefaultTopSlotDepth())}modifyD3ShellSlotRegionComponent(e,r,i){let n=new ft;if(e["attr-3d-shell-slot-depth"]!=null){let s=parseFloat(e["attr-3d-shell-slot-depth"])/10;x.getInstance().unit!="mil"&&(s=n.conversion(x.getInstance().unit,"mil",s)),r.slotDepth=s}if(e["attr-3dshell-slot-option-outline"]!=null){let s=e["attr-3dshell-slot-option-outline"];r.updateSlotOption(4,s)}if(e["attr-3dshell-slot-option-screw-pillar"]!=null){let s=e["attr-3dshell-slot-option-screw-pillar"];r.updateSlotOption(8,s)}if(e["attr-3dshell-slot-option-entity"]!=null){let s=e["attr-3dshell-slot-option-entity"];r.updateSlotOption(16,s)}if(r.syncLatestData(),e["attr-3d-shell-grooving-type"]!=null){let s=this.getD3SlotRegionType(e["attr-3d-shell-grooving-type"]);if(s==="Top"){let a=r.lineId;r.type=s,r.lineId=null,this.obj.type="3D Shell - Top Slot Region",a!=null&&$a.getInstance().delConnectRelatedId(a,this.obj.globalIndex)}else s==="Side"&&(A.messageBus.publish("clearSelect",""),uh.setGroup(i),uh.addItem(this.obj.globalIndex),uh.setOnceCallback(()=>{A.publish("tool","dropdrag")}),setTimeout(()=>{uh.toggleTool()},0))}e["automatic-calibration"]!=null&&(r.slotDepth=r.type==="Side"?D9.getDefaultSideSlotDepth(r.lineId):D9.getDefaultTopSlotDepth())}getD3SlotRegionType(e){switch(e){case"Top":return"top_bottom";case"Side":return"side";case"top_bottom":return"Top";case"side":return"Side"}}};var O0e=class extends ec{constructor(){super(...arguments);this.mark=null}set(e){return this.mark=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++,this.attrlist==null&&(this.attrlist={});let r=this.attrlist;return this.getSilkColor(e,r),(r["attr-id"]==null||r["attr-id"].value!=He)&&(r["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${e.number}`),sourceId:e.globalIndex}),(r["attr-length"]==null||r["attr-length"].value!=He)&&(r["attr-length"]={title:"Length",value:this.getCompareValue("attr-length",e.length)}),this}modifyBy(e,r){let i=new ft,n=x.getInstance().unit;if(e["attr-length"]!=null){let s=parseFloat(e["attr-length"])/10;!isNaN(s)&&n!="mil"&&(s=i.conversion(n,"mil",s)),!isNaN(s)&&this.mark instanceof Nh&&(this.mark.length=s)}e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?this.mark.silkColor=null:this.mark.silkColor=ee.of3(e["attr-silk-color"]))}};function Zqe(o,t){let e=t["attr-select-net"];return!(e&&e.length>4096)}function Jqe(o){let t=o.type,e=V2;switch(t){case"3D Shell - Outline":{let r=o.getComponent(),{botShellHeight:i,shellThickness:n,type:s,shellHeight:a}=r;if(a<e||s==="T&B"&&(i<e||i>a))return!1;let c=new ft().mil2mm(n*10);if(c>3||c<1)return!1;break}}return!0}var $U=class o{constructor(t){this.type="Normal";this.preTask=null;this._state="Pending";this.weight=0;this.nextTaskList=[];t(this.getChangeStateCallback())}static all(t){let e=t.length;return e?new o(({resolve:r,reject:i})=>{let n=[];t.forEach((s,a)=>{s.next((l,c)=>{e--,n[a]=c,e||r(n)}).catch((l,c)=>{i(c)})})}):new o(r=>r.resolve())}set state(t){this._state==="Pending"&&(this._state=t)}get state(){return this._state}next(t){let e=new o(r=>{});return e.preTask=this,e.type="Normal",this.nextTaskList.push({task:e,callback:t}),this.doneNextTask(),e}catch(t){let e=new o(n=>{});e.preTask=this,e.type="Error",this.nextTaskList.push({task:e,callback:t});let r=e.preTask,i=null;for(;r&&(r.state==="Reject"&&(i=r),r.type!=="Error");)r=r.preTask;return i&&t(e.getChangeStateCallback(),i.message),e}release(t){this.updateState(this.weight-1,t)}add(){this.updateState(this.weight+1)}resolve(t){this.updateState(-1,t)}reject(t){this.updateState(1/0,t)}updateState(t,e){this.state==="Pending"&&(this.weight=t,this.message=e,isFinite(t)?t<0&&(this.state="Resolve"):this.state="Reject",this.doneNextTask())}doneNextTask(){this.state!=="Pending"&&(this.state==="Reject"?this.searchCatchTask(this).forEach(e=>{let{task:r,callback:i}=e;i(r.getChangeStateCallback(),this.message)}):this.nextTaskList.forEach(t=>{let{task:e,callback:r}=t;if(e.type!=="Error")try{r(e.getChangeStateCallback(),this.message)}catch(i){console.log(i)}}),this.nextTaskList=[])}searchCatchTask(t){let e=[t],r=[];for(;e.length;){let i=e.shift();if(!i)break;i.nextTaskList.forEach(n=>{n.task.type==="Error"?r.push(n):e.push(n.task)})}return r}getChangeStateCallback(){return{add:this.add.bind(this),release:this.release.bind(this),resolve:this.resolve.bind(this),reject:this.reject.bind(this)}}};var A0e=class extends ec{constructor(){super(...arguments);this.image=null}set(e){return this.image=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=x.getInstance().origin;this.attrlist==null&&(this.attrlist={});let i=this.attrlist;return(i["attr-id"]==null||i["attr-id"].value!=He)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${e.number}`),sourceId:e.globalIndex}),(i["attr-layerid"]==null||i["attr-layerid"].value!=He)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Zn.trueColorImage()}),(i["attr-width"]==null||i["attr-width"].value!=He)&&(i["attr-width"]={title:"Width",value:this.getCompareValue("attr-width",Xe(e.width))}),(i["attr-height"]==null||i["attr-height"].value!=He)&&(i["attr-height"]={title:"Height",value:this.getCompareValue("attr-height",Xe(e.height))}),(i["attr-mirror"]==null||i["attr-mirror"].value!=He)&&(i["attr-mirror"]={title:"Mirror",value:this.getCompareValue("attr-mirror",e.mirror?"yes":"no")}),(i["attr-combination"]==null||i["attr-combination"].value!=He)&&(i["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",kt.getGroupNameByGroupId(e.getGroupID())||""),options:kt.getCombin(),hasParent:e.getParent()!=null}),(i["attr-start-x"]==null||i["attr-start-x"].value!=He)&&(i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",Xe(e.start.x-r.x))}),(i["attr-start-y"]==null||i["attr-start-y"].value!=He)&&(i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",Xe(e.start.y-r.y))}),(i["attr-rotation"]==null||i["attr-rotation"].value!=He)&&(i["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",uc(xe(e.rotation/Math.PI*180,3)))}),(i["attr-locked"]==null||i["attr-locked"].value!=He)&&(i["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),this}modifyBy(e,r){let i=new ft,n=x.getInstance().origin;if(e["attr-layerid"]!=null){if(this.image.locked)return;let s=parseInt(e["attr-layerid"]);this.image.layerId=s}if(e["attr-combination"]!=null){if(this.image.locked)return;this.modifyCombination(e["attr-combination"],this.image).forEach(a=>{r.addCommand(a)})}if(e["attr-width"]!=null){let s=parseFloat(e["attr-width"])/10;s=this.getValue(s),s=i.conversion(x.getInstance().unit,"mil",s),s>=nA&&(s=nA),s>0&&(bP()&&(this.image.height=this.image.height/this.image.width*s),this.image.width=s)}if(e["attr-height"]!=null){let s=parseFloat(e["attr-height"])/10;s=this.getValue(s),s=i.conversion(x.getInstance().unit,"mil",s),length>=oA&&(length=oA),s>0&&(bP()&&(this.image.width=this.image.width/this.image.height*s),this.image.height=s)}if(e["attr-mirror"]!=null){if(this.image.locked)return;let s=e["attr-mirror"]=="yes";this.image.mirror=s}if(e["attr-start-x"]!=null){if(this.image.locked)return;let s=parseFloat(e["attr-start-x"])/10;s=this.getValue(s),x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),s=s+n.x;let a=new S(s,this.image.start.y);this.image.start=a}if(e["attr-start-y"]!=null){if(this.image.locked)return;let s=parseFloat(e["attr-start-y"])/10;s=this.getValue(s),x.getInstance().unit!="mil"&&(s=i.conversion(x.getInstance().unit,"mil",s)),s=s+n.y;let a=new S(this.image.start.x,s);this.image.start=a}if(e["attr-rotation"]!=null){if(this.image.locked)return;let s=parseFloat(e["attr-rotation"])/180*Math.PI;s=this.getValue(s),this.image.rotation=s}if(e["attr-locked"]!=null){let s=e["attr-locked"]=="yes";this.image.locked=s}}};var _0e=class extends ec{constructor(){super();this.tearDrop=null}set(e){return this.tearDrop=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=x.getInstance().origin;this.attrlist==null&&(this.attrlist={});let i=this.attrlist;return(i["attr-id"]==null||i["attr-id"].value!=He)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${e.number}`),sourceId:e.globalIndex}),(i["attr-layerid"]==null||i["attr-layerid"].value!=He)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:this.getLayer()}),(i["attr-select-net"]==null||i["attr-select-net"].value!=He)&&(i["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.showNet),options:this.poolCache.allNetOptions||ze.getNet()}),(i["attr-locked"]==null||i["attr-locked"].value!=He)&&(i["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(i["attr-combination"]==null||i["attr-combination"].value!=He)&&(i["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",kt.getGroupNameByGroupId(e.getGroupID())||""),options:kt.getCombin()}),this}modifyBy(e,r){if(e["attr-combination"]!=null){let i=this.modifyCombination(e["attr-combination"],this.tearDrop);r&&i.forEach(n=>{r.addCommand(n)})}}getLayer(){let e=new Array,i=$e.getInstance().getAllItem();for(let n of i)12!=n.layerId&&11!=n.layerId&&7!=n.layerId&&8!=n.layerId&&57!=n.layerId&&47!=n.layerId&&n.config&&!Rh(n.type)&&!_E(n.layerId)&&![52].includes(n.layerId)&&!ba(n.layerId)&&e.push({text:n.name,value:n.layerId});return e}};var v0e=class extends ec{constructor(){super();this.copperResult=null;this.showAddSolderMaskRegion=!0}set(e){return this.copperResult=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=x.getInstance().origin;this.attrlist==null&&(this.attrlist={});let i=this.attrlist;(i["attr-id"]==null||i["attr-id"].value!=He)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${ur}${e.number}`),sourceId:e.globalIndex}),(i["attr-layerid"]==null||i["attr-layerid"].value!=He)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:this.getLayer()}),(i["attr-select-net"]==null||i["attr-select-net"].value!=He)&&(i["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.showNet),options:this.poolCache.allNetOptions||ze.getNet()});let n=e.getParent();return(i["attr-select-parent-set"]==null||i["attr-select-parent-set"].value!=He)&&(i["attr-select-parent-set"]={title:"Parent",value:this.getCompareValue("attr-select-parent-set",n?`${ur}${n.number}`:""),sourceId:n?n.globalIndex:""}),[1,2].includes(e.layerId)||(this.showAddSolderMaskRegion=!1),this}getExtra(){return{showAddSolderMaskRegion:this.showAddSolderMaskRegion}}modifyBy(e,r){}getLayer(){let e=new Array,r=$e.getInstance().getAllItem();for(let i of r)12!=i.layerId&&11!=i.layerId&&7!=i.layerId&&8!=i.layerId&&57!=i.layerId&&47!=i.layerId&&i.config&&!Rh(i.type)&&!_E(i.layerId)&&![52].includes(i.layerId)&&!ba(i.layerId)&&e.push({text:i.name,value:i.layerId});return e}};var x0e=class extends so{constructor(t){super(),this.data=t.toJSON(),this.action="modify"}rebuild(){let{layerId:t,keepIsland:e}=this.data;be.updatePlanzoneLayerKeepIsland(t,e),Xd.updateProfileItem(t,new s6(t,e))}getItem(){return"ignore"}remove(){let{layerId:t,keepIsland:e}=this.data}modify(){let{layerId:t,keepIsland:e}=this.data;be.updatePlanzoneLayerKeepIsland(t,e),Xd.updateProfileItem(t,new s6(t,e))}upload(t){let e=this.isDelete(t),r=be.getLayerPhy(this.data.layerId);r!=null&&uF(r,e)}updateData(){}};function Qqe(o,t){Swt(o);let e=o,r=[];if(t.forEach(s=>{s.isChecked&&r.push(s.value)}),r.length<=0)return e.primitiveType=e.primitive.length===1?e.primitive[0]:"PCB",e;if(r.length===1)return e.primitiveType=r[0],e;if(r.length===2&&r.includes("TESTPOINTER")&&r.includes("PAD"))return e.primitiveType="PAD",e.primitiveTitle="Multiple Objects",e;let i="MULTI",n=Ewt(o,i);return n?(n.primitiveType=i,n):(console.warn("the selected element has no public attributes."),e.primitiveType=i,e.attrlist={[i]:{}},e)}function Swt(o){for(let t in o.attrlist)o.notShowNetPrimitive.has(t)&&delete o.attrlist[t]["attr-select-net"]}function Ewt(o,t){let e={},r=o.attrlist;Object.keys(r).forEach(l=>{e[l]=Object.keys(r[l])});let i=Owt(e);if(!i.length)return null;o.attrlist={[t]:{}};let n=Object.keys(r),s=o.attrlist[t];for(let l=0;l<n.length;l++){let c=r[n[l]];for(let h=0;h<i.length;h++){let u=i[h];s[u]?typeof s[u].options<"u"&&typeof c[u].options<"u"&&(s[u].options=Awt(s[u].options,c[u].options)):s[u]=c[u],String(s[u].value)!==String(c[u].value)&&(s[u].value=He)}}let a=Object.values(s);for(let l=0;l<a.length;l++)typeof a[l].options<"u"&&typeof a[l].value<"u"&&kx(a[l].options,"value",a[l].value).index<=-1&&a[l].value!==""&&a[l].options.unshift({text:a[l].value,value:a[l].value,disabled:!0});return o}function Owt(o){let t=Object.keys(o);if(!t.length)return[];let e=o[t[0]];return t.reduce((r,i,n,s)=>(e=e.filter(a=>o[i].indexOf(a)!==-1),e),o[t[0]]),e}function Awt(o=[],t=[]){let[e,r]=[o,t];o.length>t.length&&(e=t,r=o);let i=[];for(let n=0;n<e.length;n++)kx(r,"value",e[n].value).data&&i.push({text:e[n].text,value:e[n].value});return i}function e$e(o,t){let e=t.combination;typeof e.names<"u"&&(o.selectCount=e.names.length,o.selectNumberForId=e.names.length),o.primitiveTitle=mUe}function t$e(o,t={}){let e=[];return o.forEach(r=>{let i=typeof t[r]<"u"?t[r]:!0;e.push({title:r,value:r,isChecked:i})}),e}function r$e(o){if(typeof o.status>"u"){let t={};for(let e=0;e<o.primitive.length;e++)t[o.primitive[e]]=!0;o.status=t}}function i$e(o,t){let e=_wt(o,t);return{...o,...e,primitiveType:"-",primitiveTitle:"",unit:o.unit,status:o.status,doctype:o.doctype,callScene:o.callScene,combination:typeof o.combination=="object"?o.combination:null,extra:{...e.extra,...o.extra}}}function _wt(o,t){let e=o.primitive.filter(m=>o.status[m]===!0),r=e.length===1&&e[0]==="DEVICE",i=e.length===1&&e[0]==="PAD",n=new Set;if(o.primitive.length<=1){let m=o.primitive[0],g=t[m][0];return g.hasNonSignalLayerItem&&n.add(m),{attrlist:g.attrlist,idListOfPrimitive:g.idListOfPrimitive,selectNumberForId:g.selectNumberForId,selectCount:o.selectCount||g.selectCount,extra:g.extra,isOnlySelectedDevices:r,isOnlySelectedPads:i,notShowNetPrimitive:n}}let s={},a={},l=0,c=0,h={},u,d,p=o.status.PAD&&o.status.TESTPOINTER;for(let m=0;m<o.primitive.length;m++){let g=o.primitive[m];if(!o.status[g]||p&&g=="TESTPOINTER")continue;let y=t[g][0];s[g]=y.attrlist[g],a[g]=y.idListOfPrimitive[g],l+=y.selectNumberForId,c+=y.selectCount,u!==!0&&(u=y.extra.existingInDevice),d!==!0&&(d=y.extra.hasDefaultTextTypeface),y.hasNonSignalLayerItem&&n.add(g),h={...h,...y.extra,existingInDevice:u,hasDefaultTextTypeface:d}}return{attrlist:s,idListOfPrimitive:a,selectNumberForId:l,selectCount:c,extra:h,isOnlySelectedDevices:r,notShowNetPrimitive:n}}function KU(o){var s;let{body:t,head:e}=o;r$e(e);let r=t$e(e.primitive,e.status),i=i$e(e,t),n=Qqe(i,r);return n.isAllCombination=((s=e.combination)==null?void 0:s.isAllCombination)||!1,n.isAllCombination&&e$e(n,e),{blendedData:n,primitiveTypeList:r}}var R0e=class{constructor(){this.d3Shell=new tv;this.filter=new S0e;this.customComponents=new Map;this.logger=new Gi(1);this.updating=!1;this.pad=new IP,this.padTest=new E0e,this.polygonpad=new Mw,this.track=new Hde,this.arctrack=new Wde,this.via=new zde,this.component=new MX,this.lineloop=new sO,this.mark=new T0e,this.smartDimension=new O0e,this.text=new tK,this.image=new I0e,this.trueColorPicture=new A0e,this.plane=new C0e,this.d3ShellOutline=new tv,this.d3ShellScrewPillar=new tv,this.d3ShellSlotDatunLine=new tv,this.d3ShellGroovinGarea=new tv,this.d3ShellEntity=new tv,this.tearDrop=new _0e,this.fpcStiffener=new sO,this.annotation=new sO,this.componentAttrText=new tK,this.copperResult=new v0e,this.modifiedLayerIdsOnPlaneZone=[],this._modifiedKeysFromUI=new Set,A.subscribe("flushAttrPlane",this.flushDeviceAttrPlane.bind(this)),A.subscribe("selecting",this.parse.bind(this)),A.subscribe("attrUpdate",this.preprocess.bind(this),$()),A.subscribe("togglePrimitiveCheckedByPanel",t=>{this.filter.setStatus(t),this.filter.keepLast=!0,A.publish("flushSelectingInfo","")}),A.subscribe("selectSource",t=>this.selectSource=t),this.resetAllHtmlObjectCache()}getAttributePlaneFilterControl(){return this.filter}parse(t){this.antiShake==null?this.antiShake=this.send(t):(clearTimeout(this.antiShake),this.antiShake=this.send(t))}filter2(t){return t instanceof _n||t instanceof vw||t instanceof Ph||t instanceof Ye&&(t.type=="Annotation"||t.type=="Partition")}send(t){return setTimeout(()=>{var R;if(!x.getInstance().isactive||x.getInstance().doctype==23)return!1;let{items:e,triggerFrom:r}=t;if(this.resetAllHtmlObjectCache(),x.getInstance().envFlag==="cnc-preview"){let D=vje(e)[0],w=!1;if(D){let F=D instanceof ct||D instanceof Sr?D:D.getParent();if(F instanceof ct||F instanceof Sr){let H=F.globalIndex,z=F instanceof Sr?!0:F.isClose(),G=F.getComponent(),W=0,L=0,B=!1;G&&(G instanceof wl?(L=G.stretchLength,B=!0):G instanceof ou&&(W=G.slotDepth)),!L&&pt.getAllItem().some(U=>{let k=U.getComponent();return k&&k instanceof wl?(L=k.stretchLength,!0):!1});let N={id:H,isClose:z,isShell:B,depth:W,thickness:L};w=!0,A.publish("/ui/attributeForCnc",N,$())}}return!w&&A.publish("/ui/unAttributeForCnc","",$()),!1}let n=this.getHead(),s={};this.prevGetHtmlDataHandler();let a=!1,l=null,c=new Set,h=new Set,u=new Map,d=new Set,p=!1,m=0,g=0,y=0,b=null,P=!1,T=new Map;for(let v of e){if(!a&&Lo.isAnnotation(v)&&v instanceof nr&&(a=!0,l=v),this.filter2(v))continue;if(v instanceof mt||v instanceof vt){let z=v.getParent();z instanceof ct&&z.getSelects().length>1&&(v=z)}let D=v.getGroupID();if(D!=null&&D!=""){d.add(D);let z=u.get(D)||0;u.set(D,++z),g++}!P&&v instanceof Ue&&(b==null?(b=new jf(v,!1),y=v.length):b.all.has(v)?y+=v.length:(y=0,P=!0)),p||(p=!this.filter.inOld(v)),m++;let w=this.getType(v);if(w==null)continue;c.add(w),h.add(v.globalIndex);let F=this.getHtmlData(v);if(F==null)continue;let H=T.get(w);H==null&&(H=new Set,T.set(w,H)),H.add(F)}let I=T.size==1&&T.has("DEVICE"),C=T.size==1&&T.has("PAD");for(let[v,D]of T){let w=s[v];for(let F of D)I&&v=="DEVICE"&&F instanceof MX&&F.updateAttrlist4OnlyComponents(),C&&v=="PAD"&&(F instanceof IP||F instanceof Mw)&&F.updateAttrlist4OnlyPads(),w==null?(w=[F.getResult(v)],s[v]=w):this.merge(v,w[0],F.getResult(v))}!p&&m==0&&(p=!0);let E=this.filter.update4(p,h).getStatus4Types(c);if(T.has("PAD")&&T.has("TESTPOINTER")&&E.PAD&&E.TESTPOINTER&&(this.merge("PAD",s.PAD[0],s.TESTPOINTER[0],"TESTPOINTER"),delete s.TESTPOINTER),n.status=E,this.shieldCombination())this.selectSource=void 0,this.isAllCombination=!1;else{if(m!=g)n.combination=void 0;else{let v=!1;for(let[D,w]of u){let F=kt.getItem(D);if(F!=null&&F.size==w)v=!0;else{v=!1;break}}n.combination={isAllCombination:v,names:Array.from(d).map(D=>kt.getGroupNameByGroupId(D))}}(R=n.combination)!=null&&R.isAllCombination?this.isAllCombination=!0:this.isAllCombination=!1}if(y&&s.TRACK.forEach(v=>{v.attrlist.TRACK["attr-track-length"].value=Xe(y)}),m==0){let v=this.getHtmlData(null);c.add("PCB"),s.PCB=[v.getResult("PCB")]}a&&(n.Annotation={id:l.globalIndex},n.selectCount=e.length-1),c.forEach(v=>{n.primitive.push(v)}),n.readonly=x.getInstance().isReadOnlyMode,n.triggerFrom=r,n.triggerKeys=Array.from(this._modifiedKeysFromUI);let _={head:n,body:s};if(this.modifyAttributeDataByDrawCmd(_,we.getCommand()),n.primitive.length!==0){let v=KU(_);this.logger.debug2(v),A.publish("attributePlane",v,$())}this.antiShake=null,this.updating=!1,this.resetAllHtmlObjectCache(),this._modifiedKeysFromUI.clear()},100)}merge(t,e,r,i=t){let n=r.attrlist[i],s=e.attrlist[t];for(let a in n){let l=n[a],c=s[a];if(c!=null)if(t=="PAD"&&a=="attr-array")for(let h=0;h<c.value.length;h++){let u=c.value[h],d=l.value.find(p=>p.key==u.key);u.value!==d.value&&(u.value=He),(u.update||d.update)&&(u.update=!0)}else c.value!=l.value&&(c.value=He)}if(Re.addAll(e.idListOfPrimitive[t],r.idListOfPrimitive[i]),e.selectNumberForId+=r.selectNumberForId,e.selectCount+=r.selectCount,(e.isOnlySelectedDevices||r.isOnlySelectedDevices)&&(e.isOnlySelectedDevices=!0),(e.isOnlySelectedPads||r.isOnlySelectedPads)&&(e.isOnlySelectedPads=!0),e.notShowNetPrimitive||r.notShowNetPrimitive){let a=e.notShowNetPrimitive||new Set;r.notShowNetPrimitive&&Re.addAllSet(a,r.notShowNetPrimitive),e.notShowNetPrimitive=a}(e.hasNonSignalLayerItem||r.hasNonSignalLayerItem)&&(e.hasNonSignalLayerItem=!0),e.extra={...e.extra,...r.extra}}handleContactSameNetTrackLength(t){let e=t.filter(l=>l instanceof Ar||l instanceof Si),r=0;if(!e.length)return{length:r,collectTracks:e};let i=new jf(e[0],!1),n=[];for(let l of i.all)n.push(l.gId);let s=e.every(l=>n.includes(l.gId)),a=e.every(l=>l.net==e[0].net);if(s&&a)for(let l=0;l<e.length;l++)r+=e[l].length;return{length:r,collectTracks:e}}resetAllHtmlObjectCache(){Wh&&(Wh.poolCache={}),this.pad.poolCache={},this.padTest.poolCache={},this.polygonpad.poolCache={},this.track.poolCache={},this.arctrack.poolCache={},this.via.poolCache={},this.component.poolCache={},this.lineloop.poolCache={},this.mark.poolCache={},this.smartDimension.poolCache={},this.text.poolCache={},this.image.poolCache={},this.trueColorPicture.poolCache={},this.plane.poolCache={},this.d3ShellOutline.poolCache={},this.d3ShellScrewPillar.poolCache={},this.d3ShellSlotDatunLine.poolCache={},this.d3ShellGroovinGarea.poolCache={},this.d3ShellEntity.poolCache={},this.tearDrop.poolCache={},this.copperResult.poolCache={},this.fpcStiffener.poolCache={},this.annotation.poolCache={},this.componentAttrText.poolCache={},this.track.clearCache(),this.arctrack.clearCache(),this.pad.clearCache(),this.via.clearCache(),this.padTest.clearCache(),this.polygonpad.clearCache(),this.component.clearCache(),this.lineloop.clearCache(),this.mark.clearCache(),this.smartDimension.clearCache(),this.text.clearCache(),this.image.clearCache(),this.tearDrop.clearCache(),this.trueColorPicture.clearCache(),this.plane.clearCache(),this.d3ShellOutline.clearCache(),this.d3ShellScrewPillar.clearCache(),this.d3ShellSlotDatunLine.clearCache(),this.d3ShellGroovinGarea.clearCache(),this.d3ShellEntity.clearCache(),this.copperResult.clearCache(),this.fpcStiffener.clearCache(),this.annotation.clearCache(),this.componentAttrText.clearCache()}prevGetHtmlDataHandler(){let t=ze.getNet();Wh.poolCache.allNetOptions=t,this.pad.poolCache.allNetOptions=t,this.padTest.poolCache.allNetOptions=t,this.polygonpad.poolCache.allNetOptions=t,this.track.poolCache.allNetOptions=t,this.arctrack.poolCache.allNetOptions=t,this.via.poolCache.allNetOptions=t,this.component.poolCache.allNetOptions=t,this.lineloop.poolCache.allNetOptions=t,this.mark.poolCache.allNetOptions=t,this.smartDimension.poolCache.allNetOptions=t,this.text.poolCache.allNetOptions=t,this.image.poolCache.allNetOptions=t,this.trueColorPicture.poolCache.allNetOptions=t,this.plane.poolCache.allNetOptions=t,this.d3ShellOutline.poolCache.allNetOptions=t,this.d3ShellScrewPillar.poolCache.allNetOptions=t,this.d3ShellSlotDatunLine.poolCache.allNetOptions=t,this.d3ShellGroovinGarea.poolCache.allNetOptions=t,this.d3ShellEntity.poolCache.allNetOptions=t,this.tearDrop.poolCache.allNetOptions=t,this.copperResult.poolCache.allNetOptions=t,this.fpcStiffener.poolCache.allNetOptions=t,this.annotation.poolCache.allNetOptions=t,this.componentAttrText.poolCache.allNetOptions=t;let e=Zn.abstractTrack();this.track.poolCache.trackLayerOptions=e,this.arctrack.poolCache.trackLayerOptions=e;let r=kt.getCombin();this.pad.poolCache.combinationOptions=r,this.padTest.poolCache.combinationOptions=r,this.polygonpad.poolCache.combinationOptions=r,this.track.poolCache.combinationOptions=r,this.arctrack.poolCache.combinationOptions=r,this.via.poolCache.combinationOptions=r,this.component.poolCache.combinationOptions=r,this.lineloop.poolCache.combinationOptions=r,this.mark.poolCache.combinationOptions=r,this.smartDimension.poolCache.combinationOptions=r,this.text.poolCache.combinationOptions=r,this.image.poolCache.combinationOptions=r,this.trueColorPicture.poolCache.combinationOptions=r,this.plane.poolCache.combinationOptions=r,this.d3ShellOutline.poolCache.combinationOptions=r,this.d3ShellScrewPillar.poolCache.combinationOptions=r,this.d3ShellSlotDatunLine.poolCache.combinationOptions=r,this.d3ShellGroovinGarea.poolCache.combinationOptions=r,this.d3ShellEntity.poolCache.combinationOptions=r,this.tearDrop.poolCache.combinationOptions=r,this.copperResult.poolCache.combinationOptions=r,this.fpcStiffener.poolCache.combinationOptions=r,this.annotation.poolCache.combinationOptions=r,this.componentAttrText.poolCache.combinationOptions=r;let i=[{value:"yes",text:"Yes"},{value:"no",text:"No"}];this.pad.poolCache.lockSettingOptions=i,this.padTest.poolCache.lockSettingOptions=i,this.polygonpad.poolCache.lockSettingOptions=i,this.track.poolCache.lockSettingOptions=i,this.arctrack.poolCache.lockSettingOptions=i,this.via.poolCache.lockSettingOptions=i,this.component.poolCache.lockSettingOptions=i,this.lineloop.poolCache.lockSettingOptions=i,this.mark.poolCache.lockSettingOptions=i,this.smartDimension.poolCache.lockSettingOptions=i,this.text.poolCache.lockSettingOptions=i,this.image.poolCache.lockSettingOptions=i,this.trueColorPicture.poolCache.lockSettingOptions=i,this.plane.poolCache.lockSettingOptions=i,this.d3ShellOutline.poolCache.lockSettingOptions=i,this.d3ShellScrewPillar.poolCache.lockSettingOptions=i,this.d3ShellSlotDatunLine.poolCache.lockSettingOptions=i,this.d3ShellGroovinGarea.poolCache.lockSettingOptions=i,this.d3ShellEntity.poolCache.lockSettingOptions=i,this.tearDrop.poolCache.lockSettingOptions=i,this.copperResult.poolCache.lockSettingOptions=i,this.fpcStiffener.poolCache.lockSettingOptions=i,this.annotation.poolCache.lockSettingOptions=i,this.componentAttrText.poolCache.lockSettingOptions=i}getHtmlData(t){return t==null?Wh.getHtmlData():t instanceof Nh?this.smartDimension.getHtmlData(t):t instanceof ca?this.mark.getHtmlData(t):t instanceof ol?this.mark.getHtmlData(t):t instanceof xa?this.mark.getHtmlData(t):t instanceof Ri?t.isTestPad?this.padTest.getHtmlData(t):this.pad.getHtmlData(t):t instanceof fn?this.polygonpad.getHtmlData(t):t instanceof Sr?ba(t.layerId)?this.get3DShellHemlData(t):this.getProfileHtmlData(t):t instanceof nr?ba(t.layerId)?this.get3DShellHemlData(t):this.getProfileHtmlData(t):t instanceof ct?ba(t.layerId)?this.get3DShellHemlData(t):this.getProfileHtmlData(t):t instanceof mt?ba(t.layerId)?this.get3DShellHemlData(t):this.lineloop.getHtmlData(t):t instanceof vt?ba(t.layerId)?this.get3DShellHemlData(t):this.lineloop.getHtmlData(t):t instanceof fr?t.key!==""?this.componentAttrText.getHtmlData(t):this.text.getHtmlData(t):t instanceof Yn?this.image.getHtmlData(t):t instanceof Rs?this.trueColorPicture.getHtmlData(t):t instanceof Ar?this.track.getHtmlData(t):t instanceof Si?this.arctrack.getHtmlData(t):t instanceof Ge?this.via.getHtmlData(t):t instanceof Me?this.component.getHtmlData(t):t instanceof Ki?this.plane.getHtmlData(t):t instanceof ii?this.copperResult.getHtmlData(t):void 0}getType(t){return t instanceof Nh?"SMARTDIMENSION":t instanceof ca?"TAGGING":t instanceof ol?"TAGGING":t instanceof xa?"TAGGING":t instanceof Ri?t.isTestPad?"TESTPOINTER":"PAD":t instanceof fn?"PAD":t instanceof Sr?ba(t.layerId)?this.get3DShellPrimitive(t):_c(t.layerId)?"FPC_STIFFENER":"2DLINE":t instanceof nr?ba(t.layerId)?this.get3DShellPrimitive(t):_c(t.layerId)?"FPC_STIFFENER":Lo.isAnnotation(t)?"Annotation":"2DLINE":t instanceof ct?ba(t.layerId)?this.get3DShellPrimitive(t):_c(t.layerId)?"FPC_STIFFENER":t.type=="TearDrop"?"TEARDROP":"2DLINE":t instanceof mt?ba(t.layerId)?this.get3DShellPrimitive(t):_c(t.layerId)?"FPC_STIFFENER":"2DLINE":t instanceof vt?ba(t.layerId)?this.get3DShellPrimitive(t):_c(t.layerId)?"FPC_STIFFENER":"2DLINE":t instanceof fr?t.key!==""?"COMPONENT_ATTR_TEXT":"TEXT":t instanceof Me?"DEVICE":t instanceof Ue?"TRACK":t instanceof Ge?"VIA":t instanceof Yn?"IMAGE":t instanceof Rs?"TRUECOLORPICTRUE":t instanceof Ki?"PLANEZONE":t instanceof ii?"COPPERRESULT":void 0}get3DShellPrimitive(t){switch((t instanceof mt||t instanceof vt?t.getParent():t).type){case"3D Shell - Outline":return"3D Shell - Outline";case"3D Shell - Screw Pillar":return"3D Shell - Screw Pillar";case"3D Shell - Side Datum Line":return"3D Shell - Side Datum Line";case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":return"3D Shell - Slot Region";case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return"3D Shell - Entity";default:return}}get3DShellHemlData(t){switch((t instanceof mt||t instanceof vt?t.getParent():t).type){case"3D Shell - Outline":return this.d3ShellOutline.getHtmlData(t);case"3D Shell - Screw Pillar":return this.d3ShellScrewPillar.getHtmlData(t);case"3D Shell - Side Datum Line":return this.d3ShellSlotDatunLine.getHtmlData(t);case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":return this.d3ShellGroovinGarea.getHtmlData(t);case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return this.d3ShellEntity.getHtmlData(t)}}getProfileHtmlData(t){switch(t.type){case"FPC Stiffener":return this.fpcStiffener.getHtmlData(t);case"Annotation":return this.annotation.getHtmlData(t);case"TearDrop":return this.tearDrop.getHtmlData(t);default:return this.lineloop.getHtmlData(t)}}getHead(){return{primitive:new Array,unit:x.getInstance().unit,doctype:x.getInstance().doctype,tabid:x.getInstance().tabId,status:{}}}preprocess(t){if(!U$.executable())return;let e=new Set;ky.getInstance().set("Main");let r=t.head.primitive,i=t.body;for(let n of r){let s=i[n];switch(n){case"PAD":break;case"VIA":{let a=this.via.check(s);Re.addAllSet(e,a);break}case"FPC_STIFFENER":case"2DLINE":case"TEARDROP":{let a=new er;for(let l of s){let c=a.getItem(l["attr-id"]);if(c instanceof Ye){let h=this.lineloop.set(c).check(l);Re.addAllSet(e,h)}}break}}}if(e.size>0){let a=function(c,h){if(h){let u=new _0(c,()=>{let d=n.shift();a(d,n.length>0)},()=>{A.publish("selecting",{items:Ve.getItems()})});A.publish("openMsgbox",u)}else{let u=new _0(c,()=>{s.update(t)},()=>{A.publish("selecting",{items:Ve.getItems()})});A.publish("openMsgbox",u)}},n=Array.from(e),s=this,l=n.shift();a(l,n.length>0)}else this.update(t)}async update(t){if(!U$.executable())return;this.updating=!0;let e=t.head.primitive;if(x.getInstance().doctype===4&&e[0]==="FOOTPRINT")this.footprintAttrUpdate(t);else switch(t.head.action){case"modifyPrimitiveDataByPanel":await this.updatePcbitemData(t);break}!(e.length==1&&e[0]=="PCB")&&t.head.callScene==="ATTR_PANEL"&&(Pr.model=Pr.model,A.publish("tool","dropdrag")),A.publish("flushSelectingInfo",{triggerFrom:"ATTR_PLANE_UPDATE"}),x.getInstance().isactive&&x.getInstance().doctype===4&&this.flushDeviceAttrPlane({isUpdateDeviceData:"",doNotReloadPrjTree:""}),A.publish("clearDimension",""),A.publish("updateFrame","")}needShowAskPadMoveOptionDlg(t){if(tp.notAsking||!t.head.primitive.includes("PAD"))return[];if(!t.body.PAD.some(n=>n["attr-x"]!=null||n["attr-y"]!=null))return[];let r=new er,i=new Array;return t.body.PAD.forEach(n=>{let s=n["attr-id"],a=r.getItem(s);a instanceof Le&&a.getParent()instanceof Me&&i.push(a)}),i}moveOneObject(t){let e=Object.keys(t.body);if(e.length==1&&t.body[e[0]].length==1){let r=t.body[e[0]][0],i=Object.keys(r).some(l=>["attr-x","attr-y"].includes(l)),s=new er().getItem(r["attr-id"]);if(s==null)return!1;let a=s instanceof Le&&s.getParent()instanceof Me&&!tp.moveWhole;if(i&&!a){let l=this.getType(s);if(l==null)return!1;let c=this.getHtmlData(s).getResult(l).attrlist[l],h=Object.keys(r).includes("attr-x"),u,d=x.getInstance().unit;return h?u=new S(Bs(r["attr-x"]-c["attr-x"].value,d,"mil")/10,0):u=new S(0,Bs(r["attr-y"]-c["attr-y"].value,d,"mil")/10),ls.getInstance().init([s],"move one object",(p,m)=>{new l1(m).execute(p,u)}),!0}}return!1}async updatePcbitemData(t){if(!t.noNeedAskingPadMoveOption){let c=this.needShowAskPadMoveOptionDlg(t);if(c.length>0){tp.init(c,null,async()=>{t.noNeedAskingPadMoveOption=!0,await this.updatePcbitemData(t),A.publish("flushSelectingInfo","")});return}}if(this.moveOneObject(t))return;this.addHistory=!0;let e=new mi;e.createGroup("modify Primitive Data By Panel");let r=e.getCommand(),i=t.head.primitive,n=t.body,s=t.head,a=s.callScene||"ATTR_PANEL",l=[];this._modifiedKeysFromUI.clear(),this.recordModidifiedKeysFromUI(n);for(let c of i){let h=n[c];switch(c){case"PCB":Wh.modifyBy(h[0]);break;case"VIA":this.modifyVia(h,r);break;case"TRACK":this.modifyTrack(h,r);break;case"TEXT":this.modifyText(h,r),ti.changeTextAttribute(h);break;case"COMPONENT_ATTR_TEXT":this.modifyText(h,r),ti.changeTextAttribute(h);break;case"TAGGING":this.modifyTagging(h,r);break;case"SMARTDIMENSION":this.modifySmartDimension(h,r);break;case"PLANEZONE":this.modifyPlaneZone(h,r);break;case"TESTPOINTER":case"PAD":this.modifyPad(h,r);break;case"FPC_STIFFENER":case"2DLINE":case"TEARDROP":l.push(new $U(u=>{this.modifyLine2d(h,e,u,a),u.release()}));break;case"3D Shell - Outline":case"3D Shell - Screw Pillar":case"3D Shell - Side Datum Line":case"3D Shell - Slot Region":case"3D Shell - Entity":this.modifyD3Shell(h,e);break;case"IMAGE":this.modifyImage(h,r);break;case"TRUECOLORPICTRUE":this.modifyTrueColorPictrue(h,r);break;case"DEVICE":l.push(new $U(u=>{this.modifyDevice(h,r,s.deviceSinlgeSelected),setTimeout(()=>u.resolve(),0)}));break}}for(let[c,h]of this.customComponents)e.addCommand4Item(c,"modify"),await new $f().updateCustomFootprint(c,e.getCommand(),Array.from(h));this.customComponents.clear(),$U.all(l).next((c,h)=>{this.addHistory&&(e.needUndo?e.undo():e.checkOutlines(e.items,new Set))}),this.modifiedLayerIdsOnPlaneZone.forEach(c=>{let h=Xd.fetchProfileItem(c);h&&r.addCommand(new x0e(h))}),this.modifiedLayerIdsOnPlaneZone.length=0,A.publish("autoFill",""),A.publish("flushService","")}modifyVia(t,e){if(this.via.isNeedOpenNetDialog(t)){let i=this.via.getNewNet(t),n=new Array;for(let s of t){let a=s["attr-id"];a!=null&&n.push(a)}Fpe(n,i,e)}else for(let i of t){let n=Hr.getItem(i["attr-id"]);if(n==null)continue;let s=Te.dispatch(n,"modify");e.addCommand(s),A.publish("hasModifyPcbItem",n),this.via.set(n).modifyBy(i,e),A.publish("hasModifyPcbItem",n),this.needGenerateCustomFootprint(n,i)}}modifyTrack(t,e){let r=this.track.isNeedAddVia(t),i=new Set,n=new Set,s=new Array,a=this.handleMultiTracksModifyLength(t);a&&(t=a.datas);for(let l=0;l<t.length;l++){a&&(a.currentIndex=l);let c=t[l],h=pr.getItem(c["attr-id"]);if(h==null)continue;let u=new Nu(h);n.add(u);let d=Te.dispatch(h,"modify");e.addCommand(d),A.publish("hasModifyPcbItem",h),h instanceof Ar?this.track.set(h).modifyBy(c,e,a):h instanceof Si&&this.arctrack.set(h).modifyBy(c,e,a),r&&(s.push(h.start),s.push(h.end)),i.add(h),A.publish("hasModifyPcbItem",h)}r&&Array.from(i).forEach((l,c)=>{let h=Array.from(n)[c];if(h.onlyConnectTrack(h.startNodes)&&!h.isSameLayer(l,h.startNodes)){let u=l.net,d=te.getInstance().getRadiusPhysicsByNet(u),p=rt.getDefaultVia(l.start,d.defalutRadius,d.defalutInner);p.net=l.net,e.addCommand(Te.dispatch(p,"add")),A.publish("hasModifyPcbItem",p)}if(h.onlyConnectTrack(h.endNodes)&&!h.isSameLayer(l,h.endNodes)){let u=l.net,d=te.getInstance().getRadiusPhysicsByNet(u),p=rt.getDefaultVia(l.end,d.defalutRadius,d.defalutInner);p.net=l.net,e.addCommand(Te.dispatch(p,"add")),A.publish("hasModifyPcbItem",p)}})}handleMultiTracksModifyLength(t){let e={type:"lengthen",currentIndex:0,modifyIndex:0,sum:0,offset:0,originLength:0,datas:t};if(t.length<=1||!t[0]["attr-track-length"])return e;let r=[];t.forEach(h=>{r.push(h["attr-id"])});let i=[],n=pr.getItem(t[0]["attr-id"]),s=new Bu(n),a=[];s.tracks.forEach((h,u)=>{let d=t.find(p=>h.gId==p["attr-id"]);d&&(d.hasMultiTrack=!0,a.push(d),h.start=s.pts[u].start(),h.end=s.pts[u].end(),i.push(h))});let l=t.filter(h=>!s.tracks.find(u=>u.gId==h["attr-id"]));l.length&&a.push(...l),t=a;let c=this.handleContactSameNetTrackLength(i);if(c.length){let h=parseFloat(t[0]["attr-track-length"])/10;if(x.getInstance().unit!="mil"&&(h=new ft().conversion(x.getInstance().unit,"mil",h)),h=h<=.01?.01:h,c.length>h){let u=c.length-h,d=0,p=c.collectTracks.length;for(;d<u&&p>0;){p--;d+=c.collectTracks[p].length}e={type:"shorten",currentIndex:0,modifyIndex:p,sum:d,offset:u,originLength:c.length,datas:t}}else c.length<h&&(e={type:"lengthen",currentIndex:0,modifyIndex:c.collectTracks.length-1,sum:0,offset:0,originLength:c.length,datas:t})}return e}modifyText(t,e){for(let r of t){let i=ti.getItem(r["attr-id"]);if(i!=null){let n=i.getParent();if(n!=null){let s=Te.dispatch(n,"modify");e.addCommand(s)}else{let s=Te.dispatch(i,"modify");e.addCommand(s)}A.publish("hasModifyPcbItem",i),this.text.set(i).modifyBy(r,e)}}}modifyTagging(t,e){let r=new er;for(let i of t){let n=r.getItem(i["attr-id"]);if(n instanceof va){let s=Te.dispatch(n,"modify");e.addCommand(s),A.publish("hasModifyPcbItem",n),this.mark.set(n).modifyBy(i,e)}}}modifySmartDimension(t,e){let r=new er;if(t.length!==1)return;let i=t[0],n=r.getItem(i["attr-id"]);if(n instanceof Nh){let s=Bs(parseFloat(i["attr-length"])/10,x.getInstance().unit,"mil");isNaN(s)||(Vs.initGroupCommand(e),wh.setSmartDimensionLength(s,i["attr-id"]),this.mark.set(n).modifyBy(i))}}modifyPad(t,e){let r=new er;for(let i of t){let n=r.getItem(i["attr-id"]),s=i["attr-number"];if(!/[^a-zA-Z0-9]/.test(s)&&n instanceof Le){if(!Zqe(n,i))continue;let a=Te.dispatch(n,"modify");e.addCommand(a),A.publish("hasModifyPcbItem",n),n instanceof Ri?this.pad.set(n).modifyBy(i,e):n instanceof fn&&this.polygonpad.set(n).modifyBy(i,e),A.publish("hasModifyPcbItem",n),this.needGenerateCustomFootprint(n,i)}}}needGenerateCustomFootprint(t,e){let r=!1,i=t.getParent();if(i!=null&&i instanceof Me&&(t instanceof Ri?r=this.pad.isShapeChange(e,tp.moveWhole):t instanceof fn?r=this.polygonpad.isShapeChange(e):t instanceof Ge&&(r=this.via.isShapeChange(e)),r)){let n=this.customComponents.get(i);n==null&&(n=new Set,this.customComponents.set(i,n)),n.add(t)}return r}modifyLine2d(t,e,r,i="ATTR_PANEL"){let n=new er,s=new Array,a;for(let l of t){let c=n.getItem(l["attr-id"]);if(c instanceof Ye){let h=c.type,u=l["attr-2dline-type"];if(u&&u!=h){a=u;break}}}if(a){let u=function(d){let p=V_.convertProfile(d,a,l,!1);for(let m of p){if(m instanceof Ye)if(No(m.getMathGraphics(m.layerId,0))){if(m instanceof ct){let g=Vm(m,e.getCommand());m.type=="Copper Region"&&g.forEach(y=>{s.push(y.globalIndex)})}}else m.type=="Copper Region"&&s.push(m.globalIndex);e.items.push(m)}},l=e.getCommand(),c=[],h=[];for(let d of t){let p=n.getItem(d["attr-id"]);p instanceof Ye&&(["Fill Region","FPC Stiffener"].includes(p.type)&&p instanceof ct&&p.isComplexPolygon()?h.push(p):c.push(p))}if(h.length>0){let{newPolygons:d}=iN(h,l);d.forEach(p=>{u([p])})}c.length>0&&u(c)}else for(let l of t){let c=n.getItem(l["attr-id"]);c instanceof Ye&&(e.addCommand4Item(c,"modify"),this.lineloop.set(c).modifyBy(l,e.getCommand(),r),c.removeFill(),c.fill(),e.items.push(c),No(c.getMathGraphics(c.layerId,0))&&c instanceof ct&&Vm(c,e.getCommand()).forEach(u=>{s.push(u.globalIndex)}),c.type=="Copper Region"&&!e.needUndo&&(l["attr-2dline-name"]!=null||l["attr-stroke-width"]!=null||l["attr-locked"]!=null||s.push(c.globalIndex)),A.publish("hasModifyPcbItem",c))}i==="ATTR_PANEL"&&s.length>0&&!e.needUndo&&A.publish("rebuildSingleCopper",{ids:s,isLast:!0}),A.publish("open2DlineWornDialog","")}modifyD3Shell(t,e){let r=new er,i=[];t.filter(s=>{let a=r.getItem(s["attr-id"]);if(a instanceof Ye)return i.push(a),!0}).forEach((s,a)=>{let l=i[a];l!=null&&(e.addCommand4Item(l,"modify"),this.d3Shell.set(l).modifyBy(s,e.getCommand()),l.refreshRender(),l.removeFill(),l.fill(),(s["attr-3d-shell-grooving-type"]==="side"||s["attr-3dshell-entity-region-type"]==="side")&&(this.addHistory=!1),No(l.getMathGraphics(l.layerId,0))?l instanceof ct&&Vm(l,e.getCommand()):Jqe(l)||(e.needUndo=!0))})}modifyImage(t,e){for(let r of t){let i=Ln.getItem(r["attr-id"]);if(i==null)continue;let n=Te.dispatch(i,"modify");e.addCommand(n),A.publish("hasModifyPcbItem",i),this.image.set(i).modifyBy(r,e)}}modifyTrueColorPictrue(t,e){for(let r of t){let i=_o.getItem(r["attr-id"]);if(i==null)continue;let n=Te.dispatch(i,"modify");e.addCommand(n),A.publish("hasModifyPcbItem",i),this.trueColorPicture.set(i).modifyBy(r,e)}}modifyDevice(t,e,r){for(let i of t){let n=Cr.getItem(i["attr-id"]);if(n==null)continue;let s=Te.dispatch(n,"modify");e.addCommand(s),A.publish("hasModifyPcbItem",n),this.component.set(n).modifyBy(i,e,r),A.publish("hasModifyPcbItem",n)}}modifyPlaneZone(t,e){for(let r of t)if(r["attr-isolated-island"]!=null){let i=Qn.getItem(r["attr-id"]);this.modifiedLayerIdsOnPlaneZone.push(i.layerId)}for(let r of t){let i=Qn.getItem(r["attr-id"]);if(i==null)continue;let n=Te.dispatch(i,"modify");e.addCommand(n),A.publish("hasModifyPcbItem",i),this.plane.set(i).modifyBy(r),A.publish("hasModifyPcbItem",i)}}flushDeviceAttrPlane(t){let e={};e.primitive="FOOTPRINT",e.action="FOOTPRINT",e.unit=x.getInstance().unit,e.doctype=x.getInstance().doctype,e.from=x.getInstance().tabId,e.to="",e.owner=x.getInstance().owner;let r={},i=new A3;r.FOOTPRINT=i.getHtmlData();let n=i.getPadList(),s={head:e,body:r,activeTabId:this.updating?"pcb-attr":""};this.updating=!1,A.publish("updateFootprintAttributePlane",{result:s,list:n,params:t},$())}footprintAttrUpdate(t){let e=t.head.action,i=t.body.FOOTPRINT;switch(this.logger.debug2(i),e){case"modifyFootprintDataByPanel":new A3().modifyBy(i);break}}modifyAttributeDataByDrawCmd(t,e){if(!e||e==="dropdrag")return;let{body:r,head:i}=t;for(let n=0;n<i.primitive.length;n++){let s=i.primitive[n];if(!s||!r[s])continue;let a=r[s][0].attrlist[s];switch(s){case"PCB":{if([4,23].includes(i.doctype))break;let c=a["attr-start-via-size"],h=a["attr-via-inside-diameter"],u=a["attr-via-outside-diameter"];e==="place_part(via)"?(h.disabled=!1,u.disabled=!1):(h.disabled=c.disabled,u.disabled=c.disabled);break}}}}recordModidifiedKeysFromUI(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let i=t[e[r]];for(let n=0;n<i.length;n++){let s=Object.keys(i[n]);for(let a=0;a<s.length;a++)["attr-id"].indexOf(s[a])>=0||this._modifiedKeysFromUI.add(s[a])}}}shieldCombination(){let t=Ui.getInstance().getItem(12),e=(t==null?void 0:t.pick)===!1,r=this.selectSource!==void 0&&this.selectSource!==null&&(this.selectSource===1||this.selectSource===0);return e&&r}};var s$e=nd(Lb());var n$e=nd(Lb()),D0e=class{};D0e.LogExport=!1;var xwt=new Gi(0);async function o$e(o){let t="read3DSourceStream-time";pn(t);let e="";return await(0,n$e.flowRead)(o,{start:()=>{},update:a=>{e+=`${a}
`},end:()=>{}}),D0e.LogExport&&xwt.info1("readDataStr end"),Bi(t),e}var GAe=new Gi(0),ZU=class{};ZU.LogExport=!1;async function rK(o=1,t=!0,e=!0,r=!0,i=!0,n=ce.pcbConfig.isUsedJLCColorSilk,s=!1,a=!1,l=!1,c=!1,h=ce.pcbConfig.isAutoGenerate3dModel,u=1024*1024*1024,d,p,m){let g="create3DSource-time";pn(g);let y=crypto.randomUUID();(0,s$e.flowWrite)(y,async T=>{await rce(T,u,o,!1,e,r,i,n,s,a,l,c,h,d,p,m)});let b=await o$e(y),P={dataStr:null};if(ZU.LogExport&&GAe.info1("withModel start"),t){let T="";if(c){let I=await z3(o,!1,i,c,h,m);T=I.dataStr,Object.assign(P,I)}else T=await z3(o,!1,i,void 0,void 0,m);b+=T}return ZU.LogExport&&GAe.info1("withModel end"),ZU.LogExport&&GAe.info1("dataStr end"),Bi(g),c?(P.dataStr=b,P):b}var l$e=nd(jD());var a$e=`# Designed by EasyEDA Pro
`,Rwt=1440*60*1e3;async function c$e(o){let t="export3DModel-time";pn(t),console.log("/pcb/3d/model/export",o);let e={name:"",content:null},r=o.obj.indexOf("componentModel")>=0,i=o.obj.indexOf("via")>=0,n=o.obj.indexOf("silk")>=0,s=o.obj.indexOf("track")>=0,a=await rK(39.37,r,!1,!1,!0,!1,void 0,void 0,!i,!0,o.isAutoGenerate3dModel,void 0,void 0,o.solderColorMat,o.filterCompCondition);console.log("\u5BFC\u51FA3D\u6587\u4EF6\u65F63d\u9884\u89C8\u683C\u5F0F\u6E90\u7801\u7684\u5B57\u7B26\u4E32\u957F\u5EA6\uFF1A",a.dataStr.length);let l;if(o.type==="step"){Dwt();let c=[o.assembly?"assembly":void 0,s?"track":void 0,n?"silk":void 0],h=(await A.globalMessageBus.rpcCall("/model/export/pcb/step2",{dataStr:a.dataStr,exportDetails:!0,param:c,filename:o.pcbName,timeout:o.timeout,isSpeedPriority:o.isSpeedPriority,id:o.id},Rwt)).message;return h.isTimeout?{isTimeout:!0}:(l=h.statusIndex,e={name:o.name+".step",content:h.file},Bi(t),[a,l,e])}else if(o.type==="obj"){let c=(await A.globalMessageBus.rpcCall("/model/export/pcb/obj",{dataStr:a.dataStr,exportDetails:!0,exportSilk:n,exportTrack:s})).message;if(c.isTimeout)return{isTimeout:!0};let[h,u]=c.obj;l=c.statusIndex;let d=new l$e.default;return d.file(o.name+".mtl",a$e+h),d.file(o.name+".obj",a$e+`mtllib ${o.name+".mtl"}
`+u),Bi(t),new Promise(p=>{d.generateAsync({type:"blob",compression:"DEFLATE"}).then(m=>{e={name:o.name+".zip",content:m},p([a,l,e])})})}}var Dwt=(()=>{let o=!1;return()=>{o||(o=!0,A.globalMessageBus.subscribe("/worker/pcb2step/progress",t=>{A.publish("/model/export/pcb/step2/progress",t,$())}))}})();var h$e=nd(jD());async function w0e(o){return new Promise(async(t,e)=>{let r=!!o.__onlyGetFileContent,i="export3DShell-time";pn(i),console.log("/pcb/3d/shell/export_inframe",o);let n=0;if(Lwt()){t({error:null,sensorsData:{documentNumber3D:n,err:"shape overlap"}}),Bi(i);return}let a=CG(39.37,!0),l=await A.globalMessageBus.rpcCall(`/model/export/shell/${o.type}2`,[a,o.name,o.timeout],o.timeout);if(l.message=="Export timed out, if you have any questions, please contact customer service"){A.windowBridge.publish("exportTimeOut","",$()),t({error:null,sensorsData:{documentNumber3D:n,err:"time out"}}),Bi(i);return}if(l.message==="Memory leak"){UAe([],"There are too many 3D shell primitives and insufficient memory to generate them"),t({error:null,sensorsData:{documentNumber3D:n,err:"memory leak"}}),Bi(i);return}if(l.message instanceof Array){if(l.message.length){let u=l.message.map(p=>p.id);UAe(wwt(u),"The following components have problems. Thin surfaces will be formed following the export of the shell file. Please adjust before exporting: "),t({error:null,sensorsData:{documentNumber3D:n,err:"thin surface"}}),Bi(i);return}return}let c=await h$e.default.loadAsync(await l.message),h=Object.keys(c.files);if(n=h.length,o.getFile){let u=h[0],d=u&&c.file(u);if(!d){t({error:null,sensorsData:{documentNumber3D:n,err:"no files"},blobData:null,fileName:o.name}),Bi(i);return}let p=await d.async("arraybuffer"),m=u.split("."),g=o.name?o.name+"."+m[m.length-1]:u;t({data:new File([p],g),error:null,sensorsData:{documentNumber3D:n},blobData:p,fileName:o.name}),Bi(i);return}else c.generateAsync({type:"blob",compression:"DEFLATE"}).then(async u=>{let d;r===!1&&(o.getType?d=(await MC(u)).data:(s2?NC(u,o.name+".zip","zip"):Re.downloadFile(o.name+".zip",u),d=null)),t({data:d,error:null,sensorsData:{documentNumber3D:n},blobData:u,fileName:o.name}),Bi(i)})})}function wwt(o){let t=["3D Shell - Outline","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Top/Bottom Entity","3D Shell - Side Entity","3D Shell - Screw Pillar","3D Shell - Side Datum Line"],e=pt.getAllItem().filter(n=>t.includes(n.type)),r=Xt.getAllItem().filter(n=>t.includes(n.type)),i=Zt.getAllItem().filter(n=>t.includes(n.type));return o.map(n=>{let s;return s=e.find(a=>a.globalIndex===n),!s&&(s=r.find(a=>a.globalIndex===n)),!s&&(s=i.find(a=>a.globalIndex===n)),{text:s?`${ur}${s.number}`:"",id:s?s.globalIndex:""}})}function Lwt(){let o=["3D Shell - Top Slot Region","3D Shell - Side Slot Region"],t=pt.getAllItem().filter(c=>o.includes(c.type)),e=Xt.getAllItem().filter(c=>o.includes(c.type)),r=Zt.getAllItem().filter(c=>o.includes(c.type)),i=[];s(t),s(e),s(r);let n="The following components entirely overlap one another, resulting in thin surfaces when the shell file is exported. Please adjust before exporting: ";if(i.length>0)return i.forEach(c=>{UAe(c,n)}),!0;return!1;function s(c){for(let h=0;h<c.length;h++){let u=c[h];for(let d=h+1;d<c.length;d++){let p=c[d];a(u,p)&&i.push([{text:`${ur}${u.number}`,id:u.globalIndex},{text:`${ur}${p.number}`,id:p.globalIndex}])}}}function a(c,h){if(c.type!==h.type||c.layerId!==h.layerId)return!1;let u=c.getComponent(),d=h.getComponent();if(u.type==="Side"&&(!u.lineId||!d.lineId||!l(u.lineId,d.lineId)))return!1;let p=c.getMathGraphics(),m=h.getMathGraphics();return p instanceof Gt&&(p=p.items[0]),m instanceof Gt&&(m=m.items[0]),p.equals(m)}function l(c,h){if(c===h)return!0;let u=pt.getItem(c),d=pt.getItem(h);if(u&&d){let p=u.getMathGraphics().primitives[0],m=d.getMathGraphics().primitives[0];return p.equals(m)}return!1}}function UAe(o,t){let e=[`<span class="i18n">${t}</span> `];for(let r=0;r<o.length;r++){let i={text:o[r].text,attr:{pcbId:x.getInstance().tabId,id:o[r].id}};e.push(i,", ")}o.length&&e.pop(),A.publish("logPublishProxy",{type:"fatalError",msg:e,openTab:!0},$())}var u$e=nd(Lb()),h1=null;function d$e(){A.messageBus.rpcService("updateAllD3ShellOutlineSubstrateHeight",({substrateHeight:o})=>{LD.updateAllSubstrateHeight(o),A.publish("flushSelectingInfo",""),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}),A.messageBus.rpcService("/pcb/3d/materialSelected",()=>[tqe(),be.getAllCopperLayerIds()]),A.messageBus.rpcService("/pcb/3d/model/export",c$e),A.messageBus.rpcService("/pcb/3d/shell/export_inframe",w0e),A.messageBus.rpcService("/pcb/3d/source",({type:o,withModel:t,withShell:e,needPanelize:r,considerCanvasOrigin:i,isColorfulSilk:n,gnrBBoxOutlines:s,filterPcbPoly:a,filterVia:l,exportDetails:c,configFPC:h,solderColorMat:u,filterCompCondition:d})=>rK(o,t,e,r,i,n,s,a,l,c,void 0,h,u,d)),A.messageBus.rpcService("/pcb/3d/writeStreamSource",({channelId:o,minChunkSize:t,type:e,withModel:r=!0,withShell:i,needPanelize:n,considerCanvasOrigin:s,isColorfulSilk:a,gnrBBoxOutlines:l,filterPcbPoly:c,filterVia:h,exportDetails:u,configFPC:d,solderColorMat:p,filterCompCondition:m})=>((0,u$e.flowWrite)(o,async y=>{await rce(y,t,e,r,i,n,s,a,l,c,h,u,void 0,d,p,m)}),(async()=>{if(r&&u){let y=await z3(e,!1,s,!0,ce.pcbConfig.isAutoGenerate3dModel,m);return delete y.dataStr,y}})())),A.messageBus.rpcService("/footprint/3d/modelInfo",async()=>new Promise(async(o,t)=>{if(![4,23].includes(x.getInstance().doctype)){o(null);return}let e=ti.getAllItem(),r={"3D Model":"","3D Model Title":"","3D Model Transform":""};for(let s=0;s<e.length;s++){if(e[s].key==="3D Model"){r["3D Model"]=e[s].value;continue}if(e[s].key==="3D Model Title"){r["3D Model Title"]=e[s].value;continue}if(e[s].key==="3D Model Transform"){r["3D Model Transform"]=e[s].value;continue}}if(r["3D Model"]===""){o({dataStr:"",config:r});return}let i=r["3D Model"].split("|"),n=(await A.windowBridge.rpcCall("ui/getD3ModelItem",{d3modelPath:i[1],d3modelUuid:i[0]},$())).message;if(!n){o(null);return}o({dataStr:n.dataStr,config:r})})),A.messageBus.rpcService("/pcb/3d/blob",()=>Y3e()),A.messageBus.rpcService("/pcb/3d/openPreviewWindow",async o=>{if(h1){h1.focus();return}h1=window.previewWindow;let t,e=new Promise(i=>{t=i});h1.addEventListener("load",async()=>{h1.addEventListener("unload",()=>{h1=null,window.previewWindow=null,A.windowBridge.publish("/pcb/3d/closePreviewWindow",o.tabid,$())}),await A.windowBridge.rpcCall("/pcb/3d/load/data",await rK(),h1),await A.windowBridge.rpcCall("/pcb/3d/load/blob",Y3e(),h1),await A.windowBridge.rpcCall("/pcb/3d/sync/3dview",[o.tabid,o.pcbUuid],h1),t()});let r=()=>{h1.close(),window.removeEventListener("unload",r)};window.addEventListener("unload",r),await e}),A.messageBus.subscribe("/pcb/3d/model/updateSystemConfig",o=>{h1&&A.windowBridge.publish("/pcb/3d/model/updateSystemConfig",o,h1)}),A.windowBridge.subscribe("/pcb/3d/model/updateSystemConfig",$()),A.subscribe("needRefresh3DWindow",async()=>{h1&&(await A.windowBridge.rpcCall("/pcb/3d/shell/setShowMode",[!1,!1],h1),await A.windowBridge.rpcCall("/pcb/3d/shell/refresh",CG(1,!0),h1))})}var L0e=class{constructor(){this.on=!0;this.asyncText=0;this.modify=new Set;this.nets=new Map;this._needRePanelize=!1;this.awaitShake=null;this.componentChanged=!1;this.previousBBoxAndNet={};this.num=0;A.subscribe("hasModifyPcbItem",this.addModify.bind(this)),A.subscribe("hasModifyNet",this.addModifyNet.bind(this)),A.subscribe("flushService",this.flushService.bind(this)),A.subscribe("HistoryFlushService",this.historyFlushService.bind(this)),A.subscribe("AwaitService",this.awaitService.bind(this)),A.subscribe("DelayCopper",this.autoCopper.bind(this)),A.subscribe("DelayAutoAdaptAll",this.autoAdaptAll.bind(this)),A.subscribe("addAutoServiceModify",this.add2Modify.bind(this)),A.subscribe("CancelDelayAutoAdaptAll",this.cancelAutoAdaptAll.bind(this)),A.subscribe("ComponentChanged",t=>{!this.componentChanged&&t instanceof Me&&(this.componentChanged=!0)}),A.subscribe("AutoServiceClear",t=>{this.modify.clear(),this.nets.clear()}),A.subscribe("addPreviousBBoxAndNet",this.addPreviousBBoxAndNet.bind(this))}get needRePanelize(){return this._needRePanelize}set needRePanelize(t){this._needRePanelize=t}awaitService(t){this.asyncText>=0&&(this.asyncText+=t,this.asyncText==0&&this.awaitShake==null&&(this.awaitShake=this.awaitFun()),this.asyncText<0&&(this.asyncText=0))}awaitFun(){return setTimeout(()=>{this.asyncText>0?(this.awaitShake!=null&&clearTimeout(this.awaitShake),this.awaitShake=this.awaitFun()):(this.historyFlushService(),A.publish("flushSelectingInfo",""),this.awaitShake=null)},50)}itemNeedPanelize(t){var e;return t.isEmpty||!((e=ai.getInstance().getDefaultPanelize())!=null&&e.on)?!1:!!(t.layerId&&t.layerId==11||t instanceof nr||t instanceof Sr||t instanceof ct||t instanceof Me&&t.getOutlines().length)}addPreviousBBoxAndNet(t){t.forEach(e=>{this.previousBBoxAndNet[e.id]={net:e.net,bbox:e.bbox}})}addModify(t){if(!(t==null||!this.on||t instanceof qp||(Pc.getInstance().setModify(t),this.modify.add(t),this.needRePanelize=this.needRePanelize||this.itemNeedPanelize(t),!t.model))){if(t instanceof Me)t.getPads().forEach(n=>{this.addNet(n.net)}),t.getVias().forEach(n=>{this.addNet(n.net)});else if(t instanceof Ue)this.addNet(t.net),ze.modifyNet(t.net);else if(t instanceof Le)this.addNet(t.net),t.getParent()!=null&&ze.modifyNet(t.net);else if(t instanceof Ge)this.addNet(t.net);else if(t instanceof Ye)mp(t.layerId)&&(t.type=="Fill Region"||t.type=="Line"||t.type=="TearDrop")&&this.addNet(t.net);else if(t instanceof Ki)this.addNet(t.net);else if(t instanceof ii)this.addNet(t.net);else if(t instanceof mt){let r=t.getParent();r instanceof Ye&&mp(r.layerId)&&(r.type=="Fill Region"||r.type=="Line"||r.type=="TearDrop")&&(this.addNet(r.net),this.modify.add(r))}else if(t instanceof vt){let r=t.getParent();r instanceof Ye&&mp(r.layerId)&&(r.type=="Fill Region"||r.type=="Line"||r.type=="TearDrop")&&(this.addNet(r.net),this.modify.add(r))}}}addNet(t){this.num=(this.nets.get(t)||0)+1,this.nets.set(t,this.num)}initModify(t){if(this.on)for(let e of t)this.modify.add(e)}initModifyEnd(){var e;if(!this.on)return;if(this.nets=ze.getNetCount(),((e=ai.getInstance().getDefaultPanelize())==null?void 0:e.on)&&!this.needRePanelize){for(let r of this.modify)if(this.needRePanelize=this.needRePanelize||this.itemNeedPanelize(r),this.needRePanelize)break}}addModifyNet(t){this.addNet(t)}add2Modify(t){this.modify.add(t)}async updatePreviewModel(){this.componentChanged&&(h1&&await A.windowBridge.rpcCall("/pcb/3d/model/refresh",await z3(1,!0),h1),this.componentChanged=!1)}nearbySameNetObjects(){if(!ce.pcbConfig.realTimeUpdateUnusedLayers)return;let t={};for(let r of this.modify){let i=this.previousBBoxAndNet[r.globalIndex];if(i){let s=i.net;s&&e(i.bbox,s)}let n=r.net;r.isEmpty||(n?e(r.buildBBox(),n):(ce.pcbConfig.unusedPadRange!=3&&r instanceof Le&&r.layerId==12||ce.pcbConfig.unusedPadRange!=2&&r instanceof Ge)&&(t[""]==null&&(t[""]=new Set),t[""].add(r.globalIndex)))}return t;function e(r,i){t[i]||(t[i]=new Set);let n=new Array;ce.pcbConfig.unusedPadRange!=3&&n.push("Pad"),ce.pcbConfig.unusedPadRange!=2&&n.push("Via"),Vt.search4Types(r,n).getResult(n).forEach(a=>{a.net==i&&t[i].add(a.globalIndex)})}}async flushService(){if(this.on){if(Ya.rebuildingRatlineInWorker){Ya.needFlushService=!0;return}if(Ya.needFlushService=!1,A.publish("checkRemoveAllPlane",""),A.publish("updateRtree",""),A.publish("updateConnectRelation",this.modify),A.messageBus2.rpcCall("rebuildRatline",{nets:this.nets,nearbySameNetObjects:this.nearbySameNetObjects()}),Lo.getInstance().changeElements(this.modify),A.publish("updateDRC",this.modify),A.publish("updateRtree",""),A.publish("updateFrame",""),A.publish("updateRadiusMark",""),A.publish("updateLastModifyInPcb","",$()),A.publish("cycleNetwork",""),A.publish("updateNetLengthAndPadPairLength",new Set(this.nets.keys())),x.getInstance().doctype===bi.FOOTPRINT&&A.publish("flushAttrPlane",{isUpdateDeviceData:"",doNotReloadPrjTree:""}),this.modify.clear(),this.nets.clear(),setTimeout(()=>{A.publish("updateRtree","")},10),this.needRePanelize){this.needRePanelize=!1;let t=new _p;setTimeout(()=>t.reRender(),0)}this.updatePreviewModel(),A.publish("refreshHighLigth",""),je.increaseUpload()}}async historyFlushService(t){let{openPcb:e,unRebuildRatline:r,isOtherUser:i=!1,delayRatline:n}=t||{};if(A.publish("checkRemoveAllPlane",""),A.publish("updateRtree",""),!r&&!n&&A.messageBus2.rpcCall("rebuildRatline",{nets:this.nets}),e||A.publish("updateDRC",this.modify),Lo.getInstance().changeElements(this.modify),A.publish("updateRtree",""),A.publish("updateFrame",""),A.publish("updateRadiusMark",""),A.publish("updateLastModifyInPcb","",$()),A.publish("cycleNetwork",""),A.publish("updateNetLengthAndPadPairLength",new Set(this.nets.keys())),x.getInstance().doctype===bi.FOOTPRINT&&A.publish("flushAttrPlane",""),!r&&n&&this.nets.size>0){let s=new Map(this.nets);setTimeout(()=>{A.messageBus2.rpcCall("rebuildRatline",{nets:s})})}if(this.modify.clear(),this.nets.clear(),setTimeout(()=>{A.publish("updateRtree","")},10),this.needRePanelize){this.needRePanelize=!1;let s=new _p;setTimeout(()=>s.reRender(),0)}this.updatePreviewModel()}autoCopper(){this.antiShake==null&&(this.antiShake=this.delayCopper())}delayCopper(){return setTimeout(()=>{this.asyncText>0?(this.antiShake!=null&&clearTimeout(this.antiShake),this.antiShake=this.delayCopper()):(A.publish("rebuildCopper",{autoSave:!0}),this.antiShake=null)},10)}autoAdaptAll(){this.antiAutoAdaptAll==null&&(this.antiAutoAdaptAll=this.delayAdaptAll())}cancelAutoAdaptAll(){this.antiAutoAdaptAll!=null&&clearTimeout(this.antiAutoAdaptAll)}delayAdaptAll(){return setTimeout(()=>{if(this.asyncText>0)this.antiAutoAdaptAll!=null&&clearTimeout(this.antiAutoAdaptAll),this.antiAutoAdaptAll=this.delayAdaptAll();else{let t=x.getInstance().isactive;if(x.getInstance().isactive=!0,A.publish("adaptAll",1),x.getInstance().isactive=t,this.antiAutoAdaptAll=null,!Ya.multiThreadingOnOpen){let e="createPcbEditorToRendered-time";bre(e)&&(Bi(e),Pre())}}},10)}};var GN=class extends zh{constructor(){super(...arguments);this.mgr=Qs.getInstance()}addControllerCache(e){Vt.insert(e)}addImage(e,r,i,n,s,a,l,c){let h=cr(),u=Qs.getInstance().addImage(h,e,r,i,n,s,a,l,c),d=new Yn(u);return this.addControllerCache(d),d}addImageByModel(e,r=!1){if(r){let n=e.globalIndex;Qs.getInstance().getItem(n)==e&&Qs.getInstance().delete(e),e.globalIndex=cr(),Qs.getInstance().addModel(e)}let i=new Yn(e);return this.addControllerCache(i),i}rebuild(e,r,i,n,s,a,l,c,h){let u=Qs.getInstance().addImage(e,r,i,n,s,a,l,c,h),d=new Yn(u);return this.addControllerCache(d),d}copy(e){let{globalIndex:r,layerId:i,start:n,width:s,height:a,rotation:l,mirror:c,locked:h,template:u}=e;n=new S(n.x,n.y),u=vu(u);let d=r.slice(0,-16)+cr();return this.rebuild(d,i,n,s,a,l,c,h,u)}delete(e){e instanceof Yn&&Qs.getInstance().delete(e.model)}};var M0e=class extends zh{constructor(){super(...arguments);this.mgr=Wo.getInstance();this.nameManager=new Q0}addControllerCache(e){ze.addItem(e),Vt.insert(e)}addCopperByModel(e){let r=new ii(e);return this.addControllerCache(r),r}addCopper(e,r,i,n,s,a,l,c=.8){let h=cr(),u=Wo.getInstance().addCopper(h,e,r,i,n,s,a,l,!1,c),d=new ii(u);return this.addControllerCache(d),d}rebuildCopper(e,r,i,n,s,a,l,c,h=.8){let u=Wo.getInstance().addCopper(e,r,i,n,s,a,l,c,!1,h),d=new ii(u);return this.addControllerCache(d),d}delete(e){if(e instanceof Ye||e instanceof ii){let r=e.model,i=e.getParent();i&&i.refreshRender(),Wo.getInstance().delete(r,r.globalIndex)}}};var N0e=class extends zh{constructor(){super();this.mgr=Ho.getInstance();this.layerMapSet={};Ho.getInstance(),A.subscribe("startPlane",this.startPlane.bind(this)),A.subscribe("endPlane",this.endPlane.bind(this)),A.subscribe("endAllPlane",this.endAllPlane.bind(this))}addControllerCache(e){let r=e.layerId,i=this.layerMapSet[r];i==null&&(i=new Set,this.layerMapSet[r]=i),i.add(e),ze.addItem(e),Vt.insert(e)}addCopper(e,r,i,n){let s=cr(),a=Ho.getInstance().add(s,e,r,i,n),l=new Ki(a);return this.addControllerCache(l),l}addPlaneZoneByModel(e){let r=new Ki(e);return this.addControllerCache(r),r}rebuild(e,r,i,n,s){let a=Ho.getInstance().add(e,r,i,n,s),l=new Ki(a);return this.addControllerCache(l),l}startPlane(e){let r=this.layerMapSet[e];r!=null&&r.forEach(i=>{i.visible()})}endPlane(e){let r=this.layerMapSet[e];if(r!=null&&(r.forEach(i=>{i.hidden()}),r.size>0)){let i=Ve.getSelects(),n=i.filter(s=>s.layerId!=e);i.length>0&&n.length!=i.length&&Ve.select(n)}}endAllPlane(){let e=Object.values(this.layerMapSet),r=new Set;for(let i of e)for(let n of i)n.hidden(),r.add(n.layerId);if(r.size>0){let i=Ve.getSelects(),n=i.filter(s=>r.has(s.layerId));i.length>0&&n.length!=i.length&&Ve.select(n)}}delete(e){let r=e.globalIndex;if(e instanceof Ki){let i=this.layerMapSet[e.layerId];i&&i.delete(e),Ho.getInstance().delete(e.model,r)}}};var k0e=class{constructor(){this._storage={}}addProfileItem(t,e){this._storage[t]=e}updateProfileItem(t,e){this.hasProfileItem(t)&&(this._storage[t]=e)}hasProfileItem(t){return!!this._storage[t]}fetchProfileItem(t){return this._storage[t]}fetchAllProfileItems(){return Object.values(this._storage)}deleteProfileItem(t){return delete this._storage[t]}};var B0e=class{constructor(){this.isMove=!1;this.suspend=!0;this.modify=new Set;this.task=new Set;this.modifyTears=new Set;this.timeoutId=null;A.subscribe("isMoveSwitch",this.isMoveSwitch.bind(this)),A.subscribe("SetSuspend",this.setSuspend.bind(this)),A.subscribe("cheakTearDrop",this.addModify.bind(this)),A.subscribe("addModifyTeardrop",this.addMaodifyTeardrop.bind(this)),A.subscribe("flushTearDrop",this.flushService.bind(this)),A.subscribe("refreshTearDrop",this.refreshService.bind(this))}isMoveSwitch(t){this.isMove=t}setSuspend(t){this.suspend=t}addMaodifyTeardrop(t){t instanceof ct&&this.modifyTears.add(t)}addModify(t){t instanceof Em&&this.modify.add(t)}flushService(){this.timeoutId!=null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.timeoutId=setTimeout(()=>{if(this.suspend){let t=this.merge(),e=this.removeTears(t);this.addTears(e),this.task.clear()}else this.addTask();this.modify.clear(),this.modifyTears.clear(),this.timeoutId=null},0)}refreshService(){if(this.timeoutId!=null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.suspend){let t=this.merge(),e=this.removeTears(t);this.addTears(e),this.task.clear()}else this.addTask();this.modify.clear(),this.modifyTears.clear()}addTask(){this.modify.forEach(t=>{this.task.add(t)})}merge(){let t=new Set,e={};return this.task.size&&this.task.forEach(r=>{let{data:i}=r;e[i.globalIndex]=r}),this.modify.size&&this.modify.forEach(r=>{var h;let{action:i,data:n,item:s}=r,a=s instanceof Ar||s instanceof Si,l=((h=e[n.globalIndex])==null?void 0:h.action)==="add",c=i==="modify";a&&e[n.globalIndex]&&l&&c&&!this.checkTrack(s,n)||(e[n.globalIndex]&&delete e[n.globalIndex],e[n.globalIndex]=r)}),e}removeTears(t){let e=Object.keys(t),r=new Set;for(let i in t){let n=t[i],s=!1;if(n.action=="modify"?n.item.isEmpty?s=!0:n.item instanceof Ri?s=this.checkPad(n.item,n.data):n.item instanceof fn?s=this.checkPolygonPad(n.item,n.data):n.item instanceof Ar?s=this.checkTrack(n.item,n.data):n.item instanceof Si?s=this.checkArcTrack(n.item,n.data):n.item instanceof Ge&&(s=this.checkVia(n.item,n.data)):n.action=="delete"?s=!0:n.action=="add"&&this.getAddTears(n)&&r.add(i),s){let a=pt.getTears(i);if(a!=null){let l=new Set,c=!1;a.forEach(h=>{let u=h.getComponent().connects;if(this.keepTear(h,u,e))l.add(h);else{let p=new MT(h,"delete");je.stack!=null&&je.stack.length>0&&(je.stack.addCommand(p),c=!0),u.forEach(m=>{pt.getTears(m).delete(h)}),h.remove(),A.publish("delete",h),this.getAddTears(n)&&r.add(i)}}),c&&A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),a.clear(),l.size==0&&pt.clearIdMapTear(i),Re.addAllSet(a,l)}else this.getAddTears(n)&&r.add(i)}else this.getAddTears(n)&&r.add(i)}return je.increaseUpload(),r}keepTear(t,e,r){if(this.modifyTears.has(t))return t;if(this.isMove){let i=!0;if(e.forEach(n=>{r.includes(n)||(i=!1)}),i)return t}}addTears(t){t.size&&(console.log("tear ids...",t),A.publish("updateTears",t))}getAddTears(t){if(t.action=="modify"){let{item:e,data:r}=t;if(!e.isEmpty){if(e instanceof Ri&&this.checkPad(e,r))return e.globalIndex;if(e instanceof fn&&this.checkPolygonPad(e,r))return e.globalIndex;if(e instanceof Ar&&this.checkTrack(e,r))return e.globalIndex;if(e instanceof Si&&this.checkArcTrack(e,r))return e.globalIndex;if(e instanceof Ge&&this.checkVia(e,r))return e.globalIndex}}else if(t.action=="add"){let{item:e,data:r}=t;if(!e.isEmpty){if(e instanceof Ri)return e.globalIndex;if(e instanceof fn)return e.globalIndex;if(e instanceof Ar)return e.globalIndex;if(e instanceof Si)return e.globalIndex;if(e instanceof Ge)return e.globalIndex}}}checkPad(t,e){let{gId:r,layerId:i,type:n,num:s,center:a,topType:l,topWidth:c,topHeight:h,bottomType:u,bottomWidth:d,bottomHeight:p,innerType:m,innerWidth:g,innerHeight:y,rotation:b,locked:P,net:T,expansionType:I,pasteExpansion:C,topSolderExpansion:E,bottomSolderExpansion:O,plated:_,holeLength:R,holeRadius:v,holeShape:D,holeRotation:w,holeOffset:F}=e;return a=new S(a.x,a.y),t.layerId!=i||!t.center.equals(a)||t.topType!=l||t.topWidth!=c||t.topHeight!=h||t.bottomType!=u||t.bottomWidth!=d||t.bottomHeight!=p||t.innerType!=m||t.innerWidth!=g||t.innerHeight!=y||t.rotation!=b||t.net!=T}checkPolygonPad(t,e){let{globalIndex:r,layerId:i,num:n,center:s,rotation:a,shapes:l,net:c,locked:h,expansionType:u,pasteExpansion:d,topSolderExpansion:p,bottomSolderExpansion:m,plated:g,holeLength:y,holeRadius:b,holeShape:P,holeRotation:T,holeOffset:I}=e;return s=new S(s.x,s.y),t.layerId!=i?!0:t.num!=n?!1:!t.center.equals(s)||t.rotation!=a?!0:t.locked!=h?!1:t.net!=c?!0:!(t.expansionType!=u||t.pasteExpansion!=d||t.topSolderExpansion!=p||t.bottomSolderExpansion!=m||t.plated!=g||t.holeLength!=y||t.holeRadius!=b||t.holeShape!=P||t.holeRotation!=T||!t.holeOffset.equals(I))}checkTrack(t,e){let{layerId:r,start:i,end:n,width:s,net:a,center:l,radius:c,startAngle:h,endAngle:u,arcType:d}=e;if(t.layerId!=r)return!0;if(t instanceof Si){let p=new th(1e-4),m=new S(l.x,l.y);if(t.arcType!==d||!t.center.equals(m)||!p.eq(t.radius,c)||!p.eq(t.startAngle,h)||!p.eq(t.endAngle,u))return!0}else{let p=new S(i.x,i.y),m=new S(n.x,n.y);if(!t.start.equals(p)||!t.end.equals(m))return!0}return t.width!=s||t.net!=a}checkArcTrack(t,e){let{globalIndex:r,layerId:i,center:n,radius:s,startAngle:a,endAngle:l,sweep:c,width:h,locked:u,net:d}=e;return n=new S(n.x,n.y),t.layerId!=i||!t.center.equals(n)||t.radius!=s||t.startAngle!=a||t.endAngle!=l||t.sweep!=c||t.width!=h||t.net!=d}checkVia(t,e){let{globalIndex:r,type:i,name:n,startLayer:s,endLayer:a,net:l,radius:c,center:h,holeRadius:u,locked:d,expansion:p,topExpansion:m,bottomExpansion:g,isSuture:y}=e,b=new S(h.x,h.y);return t.type!=i||t.name!=n||t.startLayer!=s||t.endLayer!=a||t.net!=l||t.radius!=c||!t.center.equals(b)}};var HAe=class{getAllItems(t,e){let r=new Array,i=!!e;switch(t){case 1:return Cr.iterator((n,s)=>{i?e(n,s):r.push(n)}),r;case 2:return ti.iterator((n,s)=>{n.key!=""&&(i?e(n,s):r.push(n))}),r;case 3:return Cr.iterator((n,s)=>{let a=n.getItems();for(let l of a)l.layerId!=null&&(3==l.layerId||4==l.layerId)&&(i?e(l,s):r.push(l))}),r;case 4:return pr.iterator((n,s)=>{n.getParent()==null&&(i?e(n,s):r.push(n))}),r;case 5:return Kt.iterator((n,s)=>{n.isTestPad&&(i?e(n,s):r.push(n))}),r;case 6:return Kt.iterator((n,s)=>{n.isTestPad||(i?e(n,s):r.push(n))}),r;case 9:return Hr.iterator((n,s)=>{n.isSuture||(i?e(n,s):r.push(n))}),r;case 10:return Hr.iterator((n,s)=>{n.isSuture&&(i?e(n,s):r.push(n))}),r;case 13:return ti.iterator((n,s)=>{n.key==""&&n.getParent()==null&&(i?e(n,s):r.push(n))}),r;case 15:return Ln.iterator((n,s)=>{i?e(n,s):r.push(n)}),r;case 14:return _o.iterator((n,s)=>{i?e(n,s):r.push(n)}),r;case 16:{let n=function(s,a){s.getParent()==null&&(i?e(s,a):r.push(s))};return Go.iterator(n),Uo.iterator(n),is.iterator(n),r}case 17:{let n=function(s,a){s.type=="Board Outline"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 18:{let n=function(s,a){s.type=="Slot Region"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 21:{let n=function(s,a){s.type=="Copper Region"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),Ei.iterator((s,a)=>{i?e(s,a):r.push(s)}),r}case 19:{let n=function(s,a){s.type=="Fill Region"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 38:return Xt.iterator((n,s)=>{n.type=="Annotation"&&n.getParent()==null&&(i?e(n,s):r.push(n))}),r;case 20:{let n=function(s,a){s.type=="FPC Stiffener"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 23:{let n=function(s,a){s.type=="Prohibited Region"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 24:{let n=function(s,a){s.type=="Constraint Region"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 26:{let n=function(s,a){s.type=="Line"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 34:{pt.iterator((s,a)=>{s.type=="TearDrop"&&s.getParent()==null&&(i?e(s,a):r.push(s))});let n=Pr.getControl();return n instanceof f2&&n.interrupt(),r}case 11:return zo.iterator((n,s)=>{n.forEach(a=>{i?e(a,s):r.push(a)})}),r;case 27:{let n=function(s,a){s.type=="3D Shell - Outline"&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 28:{let n=function(s,a){s.type=="3D Shell - Screw Pillar"&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 29:{let n=function(s,a){s.type=="3D Shell - Side Datum Line"&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 31:{let n=function(s,a){s.type=="3D Shell - Side Slot Region"&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 30:{let n=function(s,a){s.type=="3D Shell - Top Slot Region"&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 33:{let n=function(s,a){s.type=="3D Shell - Side Entity"&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 32:{let n=function(s,a){s.type=="3D Shell - Top/Bottom Entity"&&(i?e(s,a):r.push(s))};return Zt.iterator(n),Xt.iterator(n),pt.iterator(n),r}default:return r}}updateDisplay(t,e){this.getAllItems(t,r=>{if(r!=null&&!r.isEmpty){if(r instanceof ii)return;e&&!r.isVisible?r.visible():!e&&r.isVisible&&r.hidden()}})}},UN=new HAe;var WAe=class{filter(t,e=!1){let r=be.getLayersByOrder(),i=this.getAnnotation(t);for(let a of r){let l=i.get(a);if(l!=null)return l[0]}let n=this.classify4LayerOrder(t,be.getActiveLayerID(),e);for(let a of r){let l=n.get(a);if(l!=null)return l[0]}let s=this.getPour(t);for(let a of r){let l=s.get(a);if(l!=null)return l[0]}return t[0]}wireFilter(t,e=!0){let r=be.getLayersByOrder(),i=this.getAnnotation(t);for(let l of r){let c=i.get(l);if(c!=null)return c[0]}let n=be.getMultLayer();n.visible&&r.unshift(n.layerID);let s=this.classify4LayerOrder(t,be.getActiveLayerID(),e);for(let l of r){let c=s.get(l);if(c!=null)return c[0]}let a=this.getPour(t);for(let l of r){let c=a.get(l);if(c!=null)return c[0]}return t[0]}getPour(t){let e=new Map;for(let r of t)if(r instanceof Ye&&r.type=="Copper Region")this.addMap(e,r.layerId,r);else if(r instanceof mt||r instanceof vt){let i=r.getParent();i!=null&&i instanceof Ye&&i.type=="Copper Region"&&this.addMap(e,r.layerId,r)}for(let[r,i]of e)this.sort(i);return e}getAnnotation(t){let e=new Map;for(let r of t)if(r instanceof nr&&r.type=="Annotation"){let i=j8(r.getComponent());for(let n of i)this.addMap(e,n,r)}for(let[r,i]of e)this.sort(i);return e}classify4LayerOrder(t,e,r=!1){let i=new Map;for(let n of t)if(n instanceof Ue)this.addMap(i,n.layerId,n);else if(n instanceof Le)this.addMap(i,n.layerId,n);else if(n instanceof Ge)this.addMap(i,be.getGrayIndex()==0?12:be.getActiveLayerID(),n);else if(n instanceof va)this.addMap(i,n.layerId,n);else if(n instanceof n0)this.addMap(i,n.layerId,n);else if(n instanceof fr)this.addMap(i,n.layerId,n);else if(n instanceof Ye)if(n.type=="Copper Region"){n.layerId==e&&this.addMap(i,n.layerId,n);continue}else if((n.type=="Prohibited Region"||n.type=="Constraint Region")&&n.layerId==12){let s=be.getAllCopperLayerIds();for(let a of s)this.addMap(i,a,n)}else this.addMap(i,n.layerId,n);else if(n instanceof ii)this.addMap(i,n.layerId,n);else if(n instanceof Ki)this.addMap(i,n.layerId,n);else if(n instanceof mt){let s=n.getParent();if(s!=null&&s instanceof Ye&&s.type=="Copper Region"){n.layerId==e&&this.addMap(i,n.layerId,n);continue}this.addMap(i,n.layerId,n)}else if(n instanceof vt){let s=n.getParent();if(s!=null&&s instanceof Ye&&s.type=="Copper Region"){n.layerId==e&&this.addMap(i,n.layerId,n);continue}this.addMap(i,n.layerId,n)}else n instanceof _n?this.addMap(i,57,n):n instanceof Me&&this.addMap(i,n.layerId,n);for(let[n,s]of i)this.sort(s,r);return i}addMap(t,e,r){let i=t.get(e);i==null&&(i=[],t.set(e,i)),i.push(r)}sort(t,e=!1){e||xr(t,(r,i)=>{let n=r.buildBBox().area()-i.buildBBox().area();return n==0?r.globalIndex>i.globalIndex?1:-1:n},0,t.length)}},zAe=new WAe;var JU=class{constructor(){this.userConfig={};this.pcbConfigUnSaved=!1;this.footprintConfigUnSaved=!1;this.INDEPENDENT="Independent Object";this.OUTLINE="Outline Object";this._3DSHELL="3D Shell";this._OTHER="Other";this._STATUS="Status";A.subscribe("applyFilter",this.applyFilter.bind(this)),A.subscribe("applyCheck",this.applyCheck.bind(this)),A.subscribe("filterSelectedConfig",this.filterSelectedConfig.bind(this)),A.subscribe("filterConfig",this.onChange.bind(this)),A.subscribe("flushConfig",this.flush.bind(this)),A.subscribe("ResetFilterConfig",this.resetConfig.bind(this)),A.messageBus.rpcService("pcb/getFilterConfig",this.getFilterConfig.bind(this))}applyFilter(t){this.setPick(0,!1);let e=t[0];if(!e||!(e instanceof Array))return;let r={},i={};for(let n=0;n<e.length;n++){let{lists:s}=e[n];for(let a=0;a<s.length;a++){let{key:l,checked:c,visible:h}=s[a],u=this.getElement(l);u&&(c!=null&&this.getPick(u)!==c&&(r[l]=c),h!=null&&this.getVisible(u)!==h&&(i[l]=h))}}for(let n of Object.keys(r||{}))this.setPick(this.getElement(n),r[n]);for(let n of Object.keys(i||{}))if(this.setVisible(this.getElement(n),i[n]),n==="DRCTAGGING"){let s=i[n];A.publish("toggleErrorNodeVisible",{visibleMap:{all:s},globalIndex:"all"},$())}this.flush()}applyCheck(t){A.publish("clearSelect",""),this.setPick(0,!1);let e=t[0];if(!e||!(e instanceof Array))return;let r={};for(let i=0;i<e.length;i++){let{lists:n}=e[i];for(let s=0;s<n.length;s++){let{key:a,checked:l}=n[s],c=this.getElement(a);c&&this.getPick(c)!==l&&(r[a]=l)}}for(let i of Object.keys(r||{}))this.setPick(this.getElement(i),r[i]);this.flush()}filterSelectedConfig(t){x.getInstance().doctype==3?this.pcbConfigSelected=t.configName:x.getInstance().doctype==4&&(this.footprintConfigSelected=t.configName),this.currentSelected=t}getPick(t){let e=Ui.getInstance().getItem(t);return e!=null?e.pick:!1}setPick(t,e){let r=Ui.getInstance().getItem(t);r!=null&&e!=null&&(r.pick=e,t!=38&&!x.getInstance().isPreview&&x.getInstance().compiler.uploadPrimitive(this.getUploadElement(t),{display:r.visible,pick:r.pick}),t==21&&!x.getInstance().isPreview&&x.getInstance().compiler.uploadPrimitive("COPPERFILLED",{display:r.visible,pick:r.pick}))}getUploadElement(t){switch(t){case 0:return"ALL";case 1:return"COMPONENT";case 2:return"PROPERTY";case 3:return"COMPONENTSILK";case 4:return"TRACK";case 5:return"TESTPOINT";case 20:return"FPC_STIFFENER";case 6:return"PAD";case 7:return"PADSPAIR";case 8:return"NETWORK";case 9:return"VIA";case 10:return"SUTUREHOLE";case 11:return"RATLINE";case 12:return"GROUP";case 13:return"TEXT";case 15:return"IMAGE";case 14:return"PICTURE";case 16:return"DIMENSION";case 17:return"BOARDOUTLINE";case 18:return"SLOTREGION";case 19:return"FILLREGIEN";case 21:return"COPPEROUTLINE";case 22:return"COPPEROUTLINE";case 23:return"PROHIBITEDREGION";case 24:return"CONSTRAINT";case 25:return"PARTITION";case 26:return"LINE";case 27:return"SHELL";case 31:return"SIDESHELLCUT";case 30:return"TOPSHELLCUT";case 33:return"SIDEENTITY";case 32:return"TOPBOTTOMENTITY";case 29:return"CREASE";case 28:return"BOSS";case 34:return"TEARDROP";case 36:return"LOCKED";case 37:return"UNLOCKED";default:return null}}getVisible(t){let e=Ui.getInstance().getItem(t);return e!=null?e.visible:!1}setVisible(t,e){let r=Ui.getInstance().getItem(t);if(r!=null&&e!=null&&r.visible!=e){t==9&&Jb.getInstance().setVisible(e);let i="elementFilter-time";if(pn(i),r.visible=e,t!=38&&!x.getInstance().isPreview&&x.getInstance().compiler.uploadPrimitive(this.getUploadElement(t),{display:r.visible,pick:r.pick}),UN.updateDisplay(r.type,r.visible),r.type==21&&(A.publish("toggleCopper",{all:!0,visible:e,ids:[]}),A.publish("getAllItems","Copper Region"),A.publish("refreshHighLigth",""),x.getInstance().isPreview||x.getInstance().compiler.uploadPrimitive("COPPERFILLED",{display:r.visible,pick:r.pick}),Yh.type?A.publish("FlushSketcherAttrView",{type:Yh.type}):A.publish("flushSelectingInfo",{triggerFrom:"FILTER_PLANE_UPDATE"})),r.type===1){this.setVisible(3,e),this.setVisible(2,e);let n=Ui.getInstance().getItem(6);UN.updateDisplay(n.type,n.visible)}Bi(i,.05)}}async resetConfig(){var e,r;let t=await this.getUserConfig()||{};x.getInstance().doctype==3?this.applyConfig(Ih.pcbConfig[this.pcbConfigSelected]||((e=t.pcb)==null?void 0:e[this.pcbConfigSelected])):x.getInstance().doctype==4&&this.applyConfig(Ih.footprintConfig[this.footprintConfigSelected]||((r=t.footprint)==null?void 0:r[this.footprintConfigSelected])),this.disableOperation(!0),this.flush()}async onChange(t){var r,i;let e=await this.getUserConfig()||{};x.getInstance().doctype==3?Ih.pcbConfig.hasOwnProperty(t)?(this.applyConfig(Ih.pcbConfig[t]),this.disableOperation(!0),this.pcbConfigSelected=t,this.currentSelected={configType:"systemConfig",configName:t},this.flush()):(r=e==null?void 0:e.pcb)!=null&&r.hasOwnProperty(t)&&(this.disableOperation(!1),this.pcbConfigSelected=t,this.currentSelected={configType:"userConfig",configName:t},this.applyFilter([e.pcb[t]])):x.getInstance().doctype==4&&(Ih.footprintConfig.hasOwnProperty(t)?(this.applyConfig(Ih.footprintConfig[t]),this.disableOperation(!0),this.footprintConfigSelected=t,this.currentSelected={configType:"systemConfig",configName:t},this.flush()):(i=e==null?void 0:e.footprint)!=null&&i.hasOwnProperty(t)&&(this.disableOperation(!1),this.footprintConfigSelected=t,this.currentSelected={configType:"userConfig",configName:t},this.applyFilter([e.footprint[t]])))}setPcbDefault(t,e){this.pcbConfigDefault=t,e&&(e.pcbConfigDefault=this.pcbConfigDefault)}getPcbDefault(){return this.pcbConfigDefault}setFootprintDefault(t,e){this.footprintConfigDefault=t,e&&(e.footprintConfigDefault=this.footprintConfigDefault)}getFootprintDefault(){return this.footprintConfigDefault}getElement(t){switch(t){case"COMPONENT":return 1;case"ATTR":return 2;case"TRACK":return 4;case"FPC_STIFFENER":return 20;case"PAD_TEST":return 5;case"PAD":return 6;case"VIA":return 9;case"SUTUREVIA":return 10;case"TEXT":return 13;case"IMAGE":return 15;case"PICTURE":return 14;case"DIMENSION":return 16;case"SHEETBOARD":return 17;case"SLOT":return 18;case"POUR":return 21;case"REGION":return 19;case"PROHIBIT":return 23;case"CONSTRAINT":return 24;case"LINE":return 26;case"PADSPAIR":return 7;case"NETWORK":return 8;case"TEARDROP":return 34;case"DRCTAGGING":return 35;case"COMBINATION":return 12;case"LOCKED":return 36;case"UNLOCKED":return 37;case"SHELL":return 27;case"BOSS":return 28;case"CREASE":return 29;case"SIDESHELLCUT":return 31;case"TOPSHELLCUT":return 30;case"TOPBOTTOMENTITY":return 32;case"SIDEENTITY":return 33;case"COMPONENTSILK":return 3;default:return null}}disableOperation(t){Ih.operation["Rename Config..."].disabled=t,Ih.operation["Save Config"].disabled=t,Ih.operation["Delete Config"].disabled=t}getCurrentConfig(){return{COMPONENT:this.getPick(1),ATTR:this.getPick(2),TRACK:this.getPick(4),PAD_TEST:this.getPick(5),PAD:this.getPick(6),VIA:this.getPick(9),SUTUREVIA:this.getPick(10),TEXT:this.getPick(13),IMAGE:this.getPick(15),PICTURE:this.getPick(14),DIMENSION:this.getPick(16),SHEETBOARD:this.getPick(17),SLOT:this.getPick(18),POUR:this.getPick(21),REGION:this.getPick(19),FPC_STIFFENER:this.getPick(20),PROHIBIT:this.getPick(23),CONSTRAINT:this.getPick(24),LINE:this.getPick(26),PADSPAIR:this.getPick(7),NETWORK:this.getPick(8),TEARDROP:this.getPick(34),COMBINATION:this.getPick(12),LOCKED:this.getPick(36),UNLOCKED:this.getPick(37),SHELL:this.getPick(27),BOSS:this.getPick(28),CREASE:this.getPick(29),SIDESHELLCUT:this.getPick(31),TOPSHELLCUT:this.getPick(30),TOPBOTTOMENTITY:this.getPick(32),SIDEENTITY:this.getPick(33)}}async isUnSaved(){var e,r;let t=await this.getUserConfig()||{};if(x.getInstance().doctype==3){if(Ih.pcbConfig.hasOwnProperty(this.pcbConfigSelected))return!this.isEqual(Ih.pcbConfig[this.pcbConfigSelected]);if((e=t==null?void 0:t.pcb)!=null&&e.hasOwnProperty(this.pcbConfigSelected))return!this.isEqual(t.pcb[this.pcbConfigSelected])}else if(x.getInstance().doctype==4){if(Ih.footprintConfig.hasOwnProperty(this.footprintConfigSelected))return!this.isEqual(Ih.footprintConfig[this.footprintConfigSelected]);if((r=t==null?void 0:t.footprint)!=null&&r.hasOwnProperty(this.footprintConfigSelected))return!this.isEqual(t.footprint[this.footprintConfigSelected])}}isEqual(t){for(let[e,r]of Object.entries(t||{}))if(this.getPick(this.getElement(e))!==r)return!1;return!0}applyConfig(t){this.setPick(0,!1);for(let[e,r]of Object.entries(t||{}))this.setPick(this.getElement(e),r)}async getUserConfig(){return this.userConfig=(await A.windowBridge.rpcCall("UserPreferencesGetCacheObj","filterConfig",$())).message,this.userConfig}async getNewUserConfig(){let t=await this.getUserConfig(),e={};x.getInstance().doctype===3?e=t==null?void 0:t.pcb:x.getInstance().doctype===4&&(e=t==null?void 0:t.footprint);for(let r of Object.keys(e||{}))Array.isArray(e[r])||(e[r]=this.oldConfig2NewConfig(e[r]));return e}setUserConfig(t){A.windowBridge.publish("savePreference",["filterConfig",t],$())}refreshHidden(){let t="refreshHidden-time";pn(t);let e=Ui.getInstance().getAllItem();for(let r of e)UN.updateDisplay(r.type,r.visible);Bi(t,.01)}filterAll(t,e,r={}){if(t instanceof mt||t instanceof vt){let i=t.getParent();if(i!=null&&i instanceof ct){let n=i.getParent();n!=null&&n instanceof Me?e.add(n):e.add(t)}}else if(t instanceof fr){let i=t.getParent();(t.showKey||t.showValue||i==null&&(t.showKey||t.showValue)||t.key!=""&&(t.showKey||t.showValue))&&e.add(t)}else if(t instanceof Le||t instanceof Ge)e.add(t);else{let i=t.getParent();i!=null&&i instanceof Me?e.add(i):e.add(t)}}filterAll1(t,e,r){if(t instanceof mt||t instanceof vt){let i=t.getParent();if(i!=null&&i instanceof ct){let n=i.getParent();n!=null&&n instanceof Me?e.add(n):e.add(t)}}else t instanceof fr?(t.getParent()==null&&(t.showKey||t.showValue)||t.key!=""&&(t.showKey||t.showValue))&&e.add(t):e.add(t)}isComponentCanSelectElement(t){return t instanceof Le||t instanceof Ge?!0:t instanceof fr&&t.key!=""}filterElement(t,e={}){let r=x.getInstance().envFlag=="silk-preview",{boxChoose:i=!1}=e,n=new Set;if(be.getGrayIndex()){let a=be.getActiveLayerID();t=Array.from(t).filter(l=>{let c=l.layerId;return l instanceof Ge?l.isContains(a):[12,47,11,57].includes(c)?!0:l instanceof nr&&l.type=="Annotation"?l.inActiveLayer(a):!c||a==c})}let s=new Set;return t.forEach(a=>{var l,c,h;if(!this.isComponentCanSelectElement(a)&&a.getParent()!=null&&a.getParent()instanceof Me&&(a=a.getParent()),this.getPick(0))this.filterAll(a,n,e);else{if(a instanceof Le){let d=a.getParent();if(d&&d.locked&&!this.getPick(36))return}if(a instanceof ii){let d=a.getParent();if(d&&d.locked&&!this.getPick(36))return}if(a instanceof zs&&a.locked&&!this.getPick(36))return;if(a instanceof zs&&!a.locked&&!this.getPick(37))return;if(a instanceof zs&&!this.checkLayer(a.layerId))return;let u=this.getElement4Item(a);u!=null&&this.getPick(u)&&this.getVisible(u)&&(u==2?a instanceof fr&&(a.showKey||a.showValue)&&n.add(a):r?(a.globalIndex==((l=Kr.QRCode)==null?void 0:l.globalIndex)||a.globalIndex==((c=Kr.plainCode)==null?void 0:c.globalIndex)||a.globalIndex==((h=h0.getInstance().image)==null?void 0:h.globalIndex)||a instanceof Ye&&a.type=="FPC Stiffener")&&n.add(a):n.add(a)),a instanceof Ki&&n.add(a),this.getPick(7)&&(a instanceof Ue||a instanceof Le||a instanceof Ge)&&(i?this.getPadpair(a,n):n.add(a)),this.getPick(8)&&Bo(a)!=null&&!(a instanceof Ye&&a.type=="Copper Region")&&!(a instanceof ii||a instanceof Ki)&&(i?a instanceof _n?a.isVisible&&this.getNet(a,n,s):this.getNet(a,n,s):n.add(a)),a instanceof _n&&n.add(a),this.getPick(12)&&this.getCombination(a,n)}}),n=this.filterOutOfCanEditArea(n),n=this.filterViaFenceCanSelect(n),i?this.filterParent(this.filter(n)):this.filter(n)}filterViaFenceCanSelect(t){if(!this.dialog)return t;let e=new Set;for(let r of t){let i=this.dialog.tool.validItem(r);i&&e.add(i)}return e}measureFilterElement(t){let e=new Set;return be.getGrayIndex()&&(t=Array.from(t).filter(r=>{let i=r.layerId,n=be.getActiveLayerID();if(r instanceof Ri&&i===12)return!0;if(r instanceof Ge){if(r.isContains(n))return!0;i=12}return!i||n==i})),t.forEach(r=>{let i=this.getElement4Item(r);if(r instanceof ii&&this.getVisible(i)){let n=r.getParent(),s=this.getElement4Item(n);if(n instanceof Ye&&n.type==="Copper Region"&&this.getPick(s)){e.add(r);return}}i==21||i==16||r instanceof _n||this.getPick(i)&&(i!=null&&this.getVisible(i)&&e.add(r),r instanceof Ki&&e.add(r),this.getPick(7)&&(r instanceof Ue||r instanceof Le||r instanceof Ge)&&e.add(r))}),this.filter(e)}setVisibleByItem(t,e){let r=this.getElement4Item(t);this.setVisible(r,e)}getElement4Item(t){if(t instanceof Ue)return 4;if(t instanceof Le)return t.isTestPad?5:6;if(t instanceof Ge)return t.isSuture?10:9;if(t instanceof fr)return t.key==""?13:2;if(t instanceof Yn)return 15;if(t instanceof Rs)return 14;if(t instanceof Ye||t instanceof vt||t instanceof mt){let e;if(t instanceof Ye)e=t.type;else{let r=t.getParent();if(r!=null&&r instanceof Ye){let i=r.getParent();if(i!=null&&i instanceof Me)return null;e=r.type}else return null}switch(e){case"Board Outline":return 17;case"Slot Region":return 18;case"Fill Region":return 19;case"TearDrop":return 34;case"FPC Stiffener":return 20;case"Copper Region":return 21;case"Prohibited Region":return 23;case"Constraint Region":return 24;case"Line":return 26;case"3D Shell - Outline":return 27;case"3D Shell - Screw Pillar":return 28;case"3D Shell - Side Datum Line":return 29;case"3D Shell - Side Slot Region":return 31;case"3D Shell - Top Slot Region":return 30;case"3D Shell - Side Entity":return 33;case"3D Shell - Top/Bottom Entity":return 32;case"Annotation":return 38}}else return t instanceof va?16:t instanceof Me?1:t instanceof ii?21:null}getPadpair(t,e){new dw(t).result.forEach(i=>{e.add(i)})}getNet(t,e,r){let i=Bo(t);if(r.has(i))return;let n=ze.getSameNetItemsWithoutPourAndPlaneZoneByItem(t);n.length>0&&r.add(i),n.forEach(s=>{var a;(s instanceof Ge||s.layerId==12&&s.type!="Slot Region"||(a=be.getLayer(s.layerId))!=null&&a.isSignalLayer())&&e.add(s)})}getCombination(t,e){if(t instanceof mt||t instanceof Le){let i=t.getParent();i!=null&&(t=i)}let r=t.getGroupID();r!=null&&kt.getItem(r).getItems().forEach(n=>{Bt.checkIsCanEditByItem(n)&&e.add(n)})}pointFilter(t,e,r,i,n){let s=this.filterElement(r,{boxChoose:!1}),a=new Array;if(we.smartMode&&Vs.clearHighlightSpot(),this.getPick(0)||this.getPick(1)&&this.getPick(6)?s.forEach(l=>{if(!(l instanceof zs&&l.locked&&!this.getPick(36))&&!(l instanceof zs&&!l.locked&&!this.getPick(37)))if(l instanceof Le){if(we.smartMode&&l.smartPad&&l.smartPad.isSelect(t,e))if(n)l.smartPad.highlightSpot(t,e);else{l.smartPad.selectOnePoint(t,e),a.length=0,s.clear();return}if(l.isSelect(t,e)){let c=l.getParent();c!=null?(a.push(l),s.delete(c)):a.push(l)}}else if(l instanceof Me&&l.isSelect(t,e)){let c=l.getPads(),h=!1;c.forEach(u=>{u.isSelect(t,e)&&(h=!0)}),i!=null&&i?a.push(l):h||a.push(l)}else a.push(l)}):s.forEach(l=>{a.push(l)}),this.getPick(7)||this.getPick(8)||this.getPick(12)){let l=this.filterActiveLayer(a);if(l!=null){let c=new Set;return this.getPick(8)&&!(l instanceof _n)&&this.isHasNetAttributes(l)&&this.getNet(l,c,new Set),c.size<=0&&this.getPick(7)&&this.getPadpair(l,c),c.size<=0&&this.getPick(12)&&this.getCombination(l,c),c.size>0?Array.from(c):[l]}else return[]}else if(this.getPick(21)){if(i!=null&&i)return a;if(a.length>0){let l=this.filterActiveLayer(a);return l==null?[]:[l]}else return[]}else{if(i!=null&&i)return a;if(a.length>0){xr(a,(c,h)=>c.buildBBox().area()-h.buildBBox().area(),0,a.length);let l=this.filterActiveLayer(a);return l==null?[]:[l]}else return[]}}isHasNetAttributes(t){if(Bo(t)==null)return!1;if(t instanceof Ge)return!0;let r=t.layerId,i=be.getLayer(r);return gr(r)||(i==null?void 0:i.isSignalLayer())}measureFilter(t,e,r){let i=this.measureFilterElement(r),n=new Array;if(this.getPick(1)&&this.getPick(6)?i.forEach(s=>{if(s instanceof Le){if(s.isSelect(t,e)){let a=s.getParent();a!=null?(n.push(s),i.delete(a)):n.push(s)}}else if(s instanceof Me&&s.isSelect(t,e)){let a=s.getPads(),l=!1;a.forEach(c=>{c.isSelect(t,e)&&(l=!0)}),n.push(s)}else n.push(s)}):i.forEach(s=>{n.push(s)}),this.getPick(7)){let s=this.filterActiveLayer(n);if(s!=null){let a=new Set;return a.size<=0&&this.getPick(7)&&this.getPadpair(s,a),a.size>0?Array.from(a):[s]}else return[]}else if(this.getPick(21))if(n.length>0){let s=this.filterActiveLayer(n);return s==null?[]:[s]}else return[];else if(n.length>0){xr(n,(a,l)=>a.buildBBox().area()-l.buildBBox().area(),0,n.length);let s=this.filterActiveLayer(n);return s==null?[]:[s]}else return[]}filterCombination(t){let e=this.filterActiveLayer(t);if(e!=null){let r=new Set;return r.size<=0&&this.getCombination(e,r),r.size>0?Array.from(r):[]}else return[]}selectNetFilter(t,e,r){let i=new Set;r.forEach(a=>{this.filterAll(a,i,{boxChoose:!1})}),i=this.filter(i);let n=new Array;i.forEach(a=>{if(a instanceof Le&&a.isSelect(t,e)){let l=a.getParent();l!=null?(n.push(a),i.delete(l)):n.push(a)}else if(a instanceof Me&&a.isSelect(t,e)){let l=a.getPads(),c=!1;l.forEach(h=>{h.isSelect(t,e)&&(c=!0)}),c||n.push(a)}else n.push(a)});let s=this.filterNetItems(n);return s==null?[]:s}filterNetItems1(t){let e=new Array;for(let r of t)if(!(r instanceof qp))if(r instanceof Ge)e.push(r);else if(r instanceof Le||r instanceof Ue)e.push(r);else if(r instanceof Ye)switch(r.type){case"Copper Region":case"Fill Region":case"Line":e.push(r)}else r instanceof Ki&&e.push(r);return e}filterNetItems(t){let e=new Array;for(let r of t)r instanceof qp||(r instanceof Ge||r instanceof Le||r instanceof Ue||r.layerId!=null&&be.getLayer(r.layerId).isCopperLayer())&&e.push(r);return e}selectItemFilter(t,e,r){let i=new Set;for(let a of r)this.filterAll1(a,i,!1);let n=this.filter(i),s=new Set;for(let a of n)if(a instanceof Le&&a.isSelect(t,e)){let l=a.getParent();l!=null?(s.add(a),n.delete(l)):s.add(a)}else if(a instanceof Me&&a.isSelect(t,e)){let l=!1,c=a.getPads();for(let h of c)if(h.isSelect(t,e)){l=!0;break}l||s.add(a)}else s.add(a);return s}filterActiveLayer(t,e){return zAe.filter(Array.from(t),e)}filterTrack(t,e=ce.pcbConfig.realTimeTrackSelectStats){switch(e){case"single":return[t];case"whole":{let r=new Set;return new jf(t,!1).all.forEach(n=>{Bt.checkIsCanEditByItem(n)&&r.add(n)}),Array.from(r)}}}isCanWireItem(t){if(t instanceof Ue)return!0;if(t instanceof Le)return!0;if(t instanceof Ge)return!0;if(t instanceof Ye||t instanceof vt||t instanceof mt){let e;if(t instanceof Ye)e=t.type;else{let r=t.getParent();if(r!=null&&r instanceof Ye){let i=r.getParent();if(i!=null&&i instanceof Me)return!1;e=r.type}else return!1}switch(e){case"Fill Region":case"TearDrop":case"Line":return gs(be.getLayer(t.layerId).type);default:return!1}}else return t instanceof ii?!0:t instanceof _n}filterWireElement(t,e){let r=new Set;t.forEach(s=>{let a=this.getElement4Item(s);this.isCanWireItem(s)&&(a==null||a!=null&&this.getVisible(a))&&r.add(s)});let i=Array.from(r);if(i=Array.from(this.filter(i,!0)),i.every(s=>s instanceof _n)||(i=i.filter(s=>!(s instanceof _n))),e)return Array.from(this.filterParent(new Set(i)));{let s=Array.from(this.filter(i,!0));return xr(s,(a,l)=>{let c=a.buildBBox().area(),h=l.buildBBox().area(),u=a instanceof Le||a instanceof Ge,d=l instanceof Le||l instanceof Ge;if(u&&!d)return-1;if(!u&&d)return 1;if(c===h){let p=a instanceof ct,m=l instanceof ct;return p&&!m?-1:!p&&m?1:0}return c-h},0,s.length),zAe.wireFilter(Array.from(s))}}filterOutOfCanEditArea(t){let e=new Set;return t.forEach(r=>{Bt.checkIsCanEditByItem(r)&&e.add(r)}),e}filter(t,e=!1){let r=new Set;return t.forEach(i=>{if(i.isVisible)if(i instanceof nr&&i.type=="Annotation")j8(i.getComponent()).find(a=>this.checkLayer(a))!=null&&r.add(i);else if(i instanceof Le||i instanceof Ue||i instanceof fr||i instanceof mt||i instanceof vt||i instanceof Ye||i instanceof Yn||i instanceof Rs||i instanceof va||i instanceof Me||i instanceof ii||i instanceof Ki)this.checkLayer(i.layerId,e)&&r.add(i);else if(i instanceof Ge)this.checkLayer(12,e)&&r.add(i);else if(i instanceof _n){let n=be.ratlineLayer;n.visible&&(e||!e&&!n.locked)&&r.add(i)}else r.add(i)}),r}checkPadByLayerVisible(t,e,r){if(t.model.modelType=="Pad"&&t.layerId==12){let i=t.model;if(t.smartPad!=null&&t.smartPad.isSelect(e,r)||be.getLayer(1).visible&&i.top.inShape(e,r,i.center,i.rotation)||be.getLayer(2).visible&&i.bottom.inShape(e,r,i.center,i.rotation))return!0;if(be.configInnerLayers.size>0){for(let n of be.configInnerLayers)if(be.getLayer(n).visible&&!i.isUnuseLayer(n)&&i.inner.inShape(e,r,i.center,i.rotation))return!0}return i.hole.inShape(e,r,i.center,i.rotation)}return!0}filterParent(t){let e=new Set;return t.forEach(r=>{let i=r.getParent();t.has(i)||e.add(r)}),e}filterParent2(t){let e=new Set;return t.forEach(r=>{let i=r.getParent();r instanceof fr&&i instanceof Me&&t.has(i)&&(r.showKey||r.showValue)?e.add(r):t.has(i)||e.add(r)}),e}handleNonPlatePadConnectNode(t,e){let r=[],i=Array.from(t);for(let n=0;n<i.length;n++){let s=i[n];s instanceof Le&&s.layerId==12&&!s.plated&&s.searchNode().forEach(a=>{!(a instanceof Ge)&&a.layerId!==e&&a.layerId!==12&&e!==12&&r.push(a.globalIndex)})}return t=i.filter(n=>!r.includes(n.globalIndex)),t}checkLayer(t,e=!1){let r=be.getLayer(t);return!!(r!=null&&r.visible&&(e||!e&&!(r!=null&&r.locked)))}setElement(t,e,r,i=""){A.publish("clearSelect",""),e!==void 0&&this.setPick(0,!1),t==0?this.setAll(e,r,i):(this.setPick(t,e),this.setVisible(t,r)),this.flush()}async flush(){let t=this.getElementFilters(),e=await this.getConfig();A.publish("updateFrame",""),A.publish("renderElementPanel",{data:t,config:e},$())}setAll(t,e,r=""){r==this.INDEPENDENT?(this.setIndepentCheck(t),this.setIndepentVisible(e)):r==this.OUTLINE?(this.setOutlineCheck(t),this.setOutlineVisible(e)):r==this._3DSHELL?(this.set3DShellCheck(t),this.set3DShellVisible(e)):r===this._OTHER?this.setVisible(34,e):r===this._STATUS||(this.setAllCheck(t),this.setAllVisible(e))}set3DShellCheck(t){t!==void 0&&(this.setPick(27,t),this.setPick(31,t),this.setPick(30,t),this.setPick(33,t),this.setPick(32,t),this.setPick(28,t),this.setPick(29,t))}set3DShellVisible(t){t!==void 0&&(this.setVisible(27,t),this.setVisible(31,t),this.setVisible(30,t),this.setVisible(33,t),this.setVisible(32,t),this.setVisible(28,t),this.setVisible(29,t))}setOutlineCheck(t){t!==void 0&&(this.setPick(17,t),this.setPick(18,t),this.setPick(19,t),this.setPick(21,t),this.setPick(23,t),this.setPick(26,t),this.setPick(24,t))}setOutlineVisible(t){t!==void 0&&(this.setVisible(17,t),this.setVisible(18,t),this.setVisible(19,t),this.setVisible(21,t),this.setVisible(23,t),this.setVisible(26,t),this.setVisible(24,t))}setIndepentCheck(t){t!==void 0&&(this.setPick(1,t),this.setPick(2,t),this.setPick(3,t),this.setPick(4,t),this.setPick(5,t),this.setPick(20,t),this.setPick(6,t),this.setPick(9,t),this.setPick(10,t),this.setPick(13,t),this.setPick(15,t),this.setPick(14,t),this.setPick(16,t))}setIndepentVisible(t){t!==void 0&&(this.setVisible(1,t),this.setVisible(2,t),this.setVisible(3,t),this.setVisible(4,t),this.setVisible(5,t),this.setVisible(20,t),this.setVisible(6,t),this.setVisible(9,t),this.setVisible(10,t),this.setVisible(13,t),this.setVisible(15,t),this.setVisible(14,t),this.setVisible(16,t))}setStatusCheck(t){t!==void 0&&(this.setPick(36,t),this.setPick(37,t))}setStatusVisible(t){t!==void 0&&(this.setVisible(36,t),this.setVisible(37,t))}setAllCheck(t){t!==void 0&&(this.setIndepentCheck(t),this.setOutlineCheck(t),this.set3DShellCheck(t),this.setOtherChecked(t))}setOtherChecked(t){this.setPick(7,t),this.setPick(8,t),this.setPick(12,t),this.setPick(34,t)}setOtherVisible(t){this.setVisible(7,t),this.setVisible(8,t),this.setVisible(12,t),this.setVisible(34,t)}setAllVisible(t){t!==void 0&&(this.setIndepentVisible(t),this.setOutlineVisible(t),this.set3DShellVisible(t),this.setOtherVisible(t))}routineItemCheck(t){return!(t==7||t==8||t==21||t==12||t==34)}getFilterAttribute(t,e,r,i,n=!0,s=!0){let a={title:t,value:e,key:Kl[e],isForAllWithCheck:r,isForAllWithVisible:i};return n&&(a.checked=this.getPick(e)),s&&(a.visible=this.getVisible(e)),a}getSystemFilterAttribute(t,e,r,i,n,s=!0,a=!0){let l={title:e,value:r,key:Kl[r],isForAllWithCheck:i,isForAllWithVisible:n};return s&&(l.checked=!!t[Kl[r]]),a&&(l.visible=!0),l}oldConfig2NewConfig(t){return[{title:this.INDEPENDENT,lists:[{title:"All",value:this.INDEPENDENT},this.getSystemFilterAttribute(t,"Component",1,!0,!0),this.getSystemFilterAttribute(t,"Component Property",2,!0,!0),this.getSystemFilterAttribute(t,"Component Silkscreen",3,!1,!0,!1),this.getSystemFilterAttribute(t,"Track",4,!0,!0),this.getSystemFilterAttribute(t,"Test Point",5,!0,!0),this.getSystemFilterAttribute(t,"Pad",6,!0,!0),this.getSystemFilterAttribute(t,"Via",9,!0,!0),this.getSystemFilterAttribute(t,"Suture Hole",10,!0,!0),this.getSystemFilterAttribute(t,"Text",13,!0,!0),this.getSystemFilterAttribute(t,"Colorful Image",14,!0,!0),this.getSystemFilterAttribute(t,"Image",15,!0,!0),this.getSystemFilterAttribute(t,"FPC Stiffener",20,!0,!0),this.getSystemFilterAttribute(t,"Dimension",16,!0,!0)]},{title:this.OUTLINE,lists:[{title:"All",value:this.OUTLINE},this.getSystemFilterAttribute(t,"Board Outline",17,!0,!0),this.getSystemFilterAttribute(t,"Slot Region",18,!0,!0),this.getSystemFilterAttribute(t,"Copper Region",21,!0,!0),this.getSystemFilterAttribute(t,"Fill Region",19,!0,!0),this.getSystemFilterAttribute(t,"Prohibited Region",23,!0,!0),this.getSystemFilterAttribute(t,"Line",26,!0,!0),this.getSystemFilterAttribute(t,"Constraint Region",24,!0,!0)]},{title:this._3DSHELL,lists:[{title:"All",value:this._3DSHELL},this.getSystemFilterAttribute(t,"3DShell.outline",27,!0,!0),this.getSystemFilterAttribute(t,"3DShell.screwPillar",28,!0,!0),this.getSystemFilterAttribute(t,"3DShell.sideDatumLine",29,!0,!0),this.getSystemFilterAttribute(t,"3DShell.sideSlotRegion",31,!0,!0),this.getSystemFilterAttribute(t,"3DShell.topBottomSlotRegion",30,!0,!0),this.getSystemFilterAttribute(t,"Side Entity",33,!0,!0),this.getSystemFilterAttribute(t,"Top/Bottom Entity",32,!0,!0)]},{title:"Other",lists:[this.getSystemFilterAttribute(t,"Pad Pair",7,!0,!1,!0,!1),this.getSystemFilterAttribute(t,"Net",8,!0,!1,!0,!1),this.getSystemFilterAttribute(t,"TearDrop",34,!0,!0),this.getSystemFilterAttribute(t,"DRC Marking",35,!0,!0),this.getSystemFilterAttribute(t,"Group",12,!0,!1,!0,!1)]},{title:"Status",lists:[this.getSystemFilterAttribute(t,"Locked",36,!0,!0,!0,!1),this.getSystemFilterAttribute(t,"UnLocked",37,!0,!0,!0,!1)]}]}getElementFilters(){return x.getInstance().doctype==3?{indepent:{title:this.INDEPENDENT,lists:[{title:"All",value:this.INDEPENDENT},this.getFilterAttribute("Component",1,!0,!0),this.getFilterAttribute("Component Property",2,!0,!0),this.getFilterAttribute("Component Silkscreen",3,!1,!0,!1),this.getFilterAttribute("Track",4,!0,!0),this.getFilterAttribute("Test Point",5,!0,!0),this.getFilterAttribute("Pad",6,!0,!0),this.getFilterAttribute("Via",9,!0,!0),this.getFilterAttribute("Suture Hole",10,!0,!0),this.getFilterAttribute("Text",13,!0,!0),this.getFilterAttribute("Colorful Image",14,!0,!0),this.getFilterAttribute("Image",15,!0,!0),this.getFilterAttribute("FPC Stiffener",20,!0,!0),this.getFilterAttribute("Dimension",16,!0,!0)]},f2dline:{title:this.OUTLINE,lists:[{title:"All",value:this.OUTLINE},this.getFilterAttribute("Board Outline",17,!0,!0),this.getFilterAttribute("Slot Region",18,!0,!0),this.getFilterAttribute("Copper Region",21,!0,!0),this.getFilterAttribute("Fill Region",19,!0,!0),this.getFilterAttribute("Prohibited Region",23,!0,!0),this.getFilterAttribute("Line",26,!0,!0),this.getFilterAttribute("Constraint Region",24,!0,!0)]},other:{title:"Other",lists:[this.getFilterAttribute("Pad Pair",7,!0,!1,!0,!1),this.getFilterAttribute("Net",8,!0,!1,!0,!1),this.getFilterAttribute("TearDrop",34,!0,!0),this.getFilterAttribute("DRC Marking",35,!0,!0),this.getFilterAttribute("Group",12,!0,!1,!0,!1)]},status:{title:"Status",lists:[this.getFilterAttribute("Locked",36,!0,!0,!0,!1),this.getFilterAttribute("UnLocked",37,!0,!0,!0,!1)]},d3shell:{title:this._3DSHELL,lists:[{title:"All",value:this._3DSHELL},this.getFilterAttribute("3DShell.outline",27,!0,!0),this.getFilterAttribute("3DShell.screwPillar",28,!0,!0),this.getFilterAttribute("3DShell.sideDatumLine",29,!0,!0),this.getFilterAttribute("3DShell.sideSlotRegion",31,!0,!0),this.getFilterAttribute("3DShell.topBottomSlotRegion",30,!0,!0),this.getFilterAttribute("Side Entity",33,!0,!0),this.getFilterAttribute("Top/Bottom Entity",32,!0,!0)]}}:x.getInstance().doctype==4?{indepent:{title:this.INDEPENDENT,lists:[{title:"All",value:this.INDEPENDENT},this.getFilterAttribute("Pad",6,!0,!0),this.getFilterAttribute("Via",9,!0,!0),this.getFilterAttribute("Text",13,!0,!0),this.getFilterAttribute("Component Property",2,!0,!0),this.getFilterAttribute("Image",15,!0,!0),this.getFilterAttribute("Dimension",16,!0,!0)]},f2dline:{title:this.OUTLINE,lists:[{title:"All",value:this.INDEPENDENT},this.getFilterAttribute("Slot Region",18,!0,!0),this.getFilterAttribute("Fill Region",19,!0,!0),this.getFilterAttribute("Prohibited Region",23,!0,!0),this.getFilterAttribute("Line",26,!0,!0)]}}:{}}getSystemElementFilters(){if(x.getInstance().doctype==3){let t={};for(let e of Object.keys(Ih.pcbConfig||{})){let r=Ih.pcbConfig[e];t[e]=[{title:this.INDEPENDENT,lists:[{title:"All",value:this.INDEPENDENT},this.getSystemFilterAttribute(r,"Component",1,!0,!0),this.getSystemFilterAttribute(r,"Component Property",2,!0,!0),this.getSystemFilterAttribute(r,"Component Silkscreen",3,!1,!0,!1),this.getSystemFilterAttribute(r,"Track",4,!0,!0),this.getSystemFilterAttribute(r,"Test Point",5,!0,!0),this.getSystemFilterAttribute(r,"Pad",6,!0,!0),this.getSystemFilterAttribute(r,"Via",9,!0,!0),this.getSystemFilterAttribute(r,"Suture Hole",10,!0,!0),this.getSystemFilterAttribute(r,"Text",13,!0,!0),this.getSystemFilterAttribute(r,"Colorful Image",14,!0,!0),this.getSystemFilterAttribute(r,"Image",15,!0,!0),this.getSystemFilterAttribute(r,"FPC Stiffener",20,!0,!0),this.getSystemFilterAttribute(r,"Dimension",16,!0,!0)]},{title:this.OUTLINE,lists:[{title:"All",value:this.OUTLINE},this.getSystemFilterAttribute(r,"Board Outline",17,!0,!0),this.getSystemFilterAttribute(r,"Slot Region",18,!0,!0),this.getSystemFilterAttribute(r,"Copper Region",21,!0,!0),this.getSystemFilterAttribute(r,"Fill Region",19,!0,!0),this.getSystemFilterAttribute(r,"Prohibited Region",23,!0,!0),this.getSystemFilterAttribute(r,"Line",26,!0,!0),this.getSystemFilterAttribute(r,"Constraint Region",24,!0,!0)]},{title:this._3DSHELL,lists:[{title:"All",value:this._3DSHELL},this.getSystemFilterAttribute(r,"3DShell.outline",27,!0,!0),this.getSystemFilterAttribute(r,"3DShell.screwPillar",28,!0,!0),this.getSystemFilterAttribute(r,"3DShell.sideDatumLine",29,!0,!0),this.getSystemFilterAttribute(r,"3DShell.sideSlotRegion",31,!0,!0),this.getSystemFilterAttribute(r,"3DShell.topBottomSlotRegion",30,!0,!0),this.getSystemFilterAttribute(r,"Side Entity",33,!0,!0),this.getSystemFilterAttribute(r,"Top/Bottom Entity",32,!0,!0)]},{title:"Other",lists:[this.getSystemFilterAttribute(r,"Pad Pair",7,!0,!1,!0,!1),this.getSystemFilterAttribute(r,"Net",8,!0,!1,!0,!1),this.getSystemFilterAttribute(r,"TearDrop",34,!0,!0),this.getSystemFilterAttribute(r,"DRC Marking",35,!0,!0),this.getSystemFilterAttribute(r,"Group",12,!0,!1,!0,!1)]},{title:"Status",lists:[this.getSystemFilterAttribute(r,"Locked",36,!0,!0,!0,!1),this.getSystemFilterAttribute(r,"UnLocked",37,!0,!0,!0,!1)]}]}return t}else if(x.getInstance().doctype==4){let t={};for(let e of Object.keys(Ih.footprintConfig||{})){let r=Ih.footprintConfig[e];t[e]=[{title:this.INDEPENDENT,lists:[{title:"All",value:this.INDEPENDENT},this.getSystemFilterAttribute(r,"Pad",6,!0,!0),this.getSystemFilterAttribute(r,"Via",9,!0,!0),this.getSystemFilterAttribute(r,"Text",13,!0,!0),this.getSystemFilterAttribute(r,"Component Property",2,!0,!0),this.getSystemFilterAttribute(r,"Image",15,!0,!0),this.getSystemFilterAttribute(r,"Dimension",16,!0,!0)]},{title:this.OUTLINE,lists:[{title:"All",value:this.INDEPENDENT},this.getSystemFilterAttribute(r,"Slot Region",18,!0,!0),this.getSystemFilterAttribute(r,"Fill Region",19,!0,!0),this.getSystemFilterAttribute(r,"Prohibited Region",23,!0,!0),this.getSystemFilterAttribute(r,"Line",26,!0,!0)]}]}return t}else return{}}updateConfigForSilkPreview(){if(x.getInstance().envFlag=="silk-preview"){let t=this.queryConfig(),e=Ih.silkViewerPcbConfig[t];this.applyConfig(e)}}queryConfig(){let t=["FPCViewer"].includes(VN.getInstance().getOrigin()),e=QT.getInstance().isQr();return t?(x.getInstance().openRuler=!0,St.getInstance().visible=T1.SHOW,"Only FPC STIFFENER"):e?"Only Image And Text":"Only Image"}async updateGetConfig(t=!1){var i,n;let e=await this.getUserConfig()||{},r=this.getSystemElementFilters();if(x.getInstance().doctype==3){if(!this.pcbConfigDefault){let s=e.pcbConfigDefault;s&&s.configName!=null&&(s=s.configName),this.pcbConfigSelected=this.pcbConfigDefault=s||"Common";let a=r[this.pcbConfigSelected];a||(a=(i=e.pcb)==null?void 0:i[this.pcbConfigSelected]),a?t&&this.applyFilter([a]):this.pcbConfigSelected=this.pcbConfigDefault="Common"}return{userConfig:await this.getNewUserConfig(),systemConfig:r,doctype:3,operation:this.getFilterOperateConfig(),selected:this.pcbConfigSelected,unSaved:await this.isUnSaved(),defaultValue:this.pcbConfigDefault}}else if(x.getInstance().doctype==4){if(!this.footprintConfigDefault){let s=e.footprintConfigDefault;s&&s.configName!=null&&(s=s.configName),this.footprintConfigSelected=this.footprintConfigDefault=s||"Common";let a=r[this.footprintConfigSelected];a||(a=(n=e.footprint)==null?void 0:n[this.footprintConfigSelected]),a?t&&this.applyFilter([a]):this.footprintConfigSelected=this.footprintConfigDefault="Common"}return{userConfig:await this.getNewUserConfig(),systemConfig:r,doctype:4,operation:this.getFilterOperateConfig(),selected:this.footprintConfigSelected,unSaved:await this.isUnSaved(),defaultValue:this.footprintConfigDefault}}else return{}}getFilterOperateConfig(){let t;return x.getInstance().doctype==3?t=Ih.pcbConfig[this.pcbConfigSelected]:x.getInstance().doctype==4&&(t=Ih.footprintConfig[this.footprintConfigSelected]),t?this.disableOperation(!0):this.disableOperation(!1),Ih.operation}async getConfig(){let t=await this.getNewUserConfig(),e=this.getSystemElementFilters();return x.getInstance().doctype==3?(!e[this.pcbConfigSelected]&&!t[this.pcbConfigSelected]&&(this.pcbConfigSelected=this.pcbConfigDefault="Common"),{userConfig:t,systemConfig:e,doctype:3,operation:Ih.operation,selected:{configName:this.pcbConfigSelected,configType:e.hasOwnProperty(this.pcbConfigSelected)?"systemConfig":"userConfig"},unSaved:await this.isUnSaved(),defaultValue:this.pcbConfigDefault}):x.getInstance().doctype==4?(!e[this.footprintConfigSelected]&&!t[this.footprintConfigSelected]&&(this.footprintConfigSelected=this.footprintConfigDefault="Common"),{userConfig:t,systemConfig:e,doctype:4,operation:Ih.operation,selected:{configName:this.footprintConfigSelected,configType:e.hasOwnProperty(this.footprintConfigSelected)?"systemConfig":"userConfig"},unSaved:await this.isUnSaved(),defaultValue:this.footprintConfigDefault}):{}}getElementFilterType(t){if(!t||!t.model)return;let r=t.model.modelType,i=t.getParent(),n=!1;if(i&&i.model.modelType==="Component"){let a=t.layerId;if(r=="Text"&&t.key)return 2;if(a==3||a==4)return 3;n=!0}if(["Rect","Circle","Polygon"].includes(r)){if(n)return 1;switch(t.model.type){case"Board Outline":return 17;case"Slot Region":return 18;case"Copper Region":return 21;case"Copper Region":return 17;case"Fill Region":return 19;case"Annotation":return 38;case"FPC Stiffener":return 20;case"Prohibited Region":return 23;case"Constraint Region":return 24;case"Line":return 26;case"TearDrop":return 34;case"3D Shell - Outline":return 27;case"3D Shell - Screw Pillar":return 28;case"3D Shell - Side Datum Line":return 29;case"3D Shell - Side Slot Region":return 31;case"3D Shell - Top Slot Region":return 30;case"3D Shell - Side Entity":return 33;case"3D Shell - Top/Bottom Entity":return 32;default:break}return}let s=null;switch(r){case"Component":s=1;break;case"Text":s=13;break;case"Track":case"ArcTrack":s=4;break;case"Pad":t.isTestPad?s=5:s=6;break;case"Via":t.isSuture?s=10:s=9;break;case"Image":s=15;break;case"Picture":s=14;break;case"Length Dimension":s=16;break;case"Ratline":s=11;break;case"Copper":s=21;break;default:break}return n&&[4,13,16,18].includes(s)&&(s=1),s}getElementFilterConfig(t){if(!t)return;let e=this.getElementFilterType(t);return Ui.getInstance().getItem(e)}getElementFilterVisible(t){let e=this.getElementFilterConfig(t);return e?e.visible:t instanceof Ki?be.getActiveLayerID()==t.layerId:!0}updateElementFilterVisible(t,e,r){if(!t)return!1;if(!t.isEmpty){t.updateFilterVisible=!1;let i=this.getElementFilterVisible(t);return i?e?t.click(r):t.visible():t.hidden(),t instanceof Me&&this.componentVisibleRefresh(i,t),!0}return!1}componentVisibleRefresh(t,e){let r=Ui.getInstance();[2,3,6].forEach(n=>{let s=r.getItem(n);if(s.visible!=t){if(n===2){this.refreshState(e.attributes,s.visible);return}if(n===6){this.refreshState(e.getPads(),s.visible);return}if(n===3){let a=e.getItems().filter(l=>l.layerId!=null&&(3==l.layerId||4==l.layerId));this.refreshState(a,s.visible)}}})}refreshState(t,e){for(let r of t)e&&!r.isVisible?r.visible():!e&&r.isVisible&&r.hidden()}updateElementsFilterVisible(t,e,r){t==null||t.forEach(i=>{this.updateElementFilterVisible(i,e,r)})}getFilterConfig(){let t={PlaneZone:!0},e=Ui.getInstance(),r={TopPad:6,BottomPad:6,MultiPad:6,Via:9,PadDrill:6,ViaDrill:9,Track:4,Text:13,Image:15,Dimension:16,BoardOutline:17,BoardCutout:18,CopperOutline:21,CopperFilled:21,TearDrop:34,"DRC Marking":35,SolidRegion:19,ProhibitedRegion:23,FPCStiffener:20,Line:26,ComponentProperty:2,ComponentSilkscreen:3,Shell_Outline:27,Shell_ScrewPillar:28,Shell_SideDatumLine:29,Shell_SideSlotRegion:30,Shell_TopBottomSlotRegion:30,Shell_SideEntity:31,Shell_TopBottomEntity:32};for(let i in r){let n=r[i],s=e.getItem(n);t[i]=s?s.visible:!0}return t}};var YAe=class extends XR{constructor(e){super("2.0",3);this.netMap=new Map;this.netMap=e}encodeRuleData(){let e=this.getNetModel(),r=te.getInstance().betweenNetRule,i=te.getInstance().getAllNetClass(),n=te.getInstance().getAllNetDifferentials(),s=te.getInstance().getAllEqualLengthGroups();e.forEach(a=>{this.feed("NET",a)}),e.forEach(a=>{this.feed("RULE_SELECTOR",a)}),i.forEach(a=>{this.feed("RULE_SELECTOR",a)}),n.forEach(a=>{this.feed("RULE_SELECTOR",a)}),s.forEach(a=>{this.feed("RULE_SELECTOR",a)}),r.rule.forEach(a=>{this.feed("RULE_SELECTOR",a)})}feed(e,r){let i=this.getItemFormat(e),n=this.getEncode(e),s={};for(let a of i)s[a]=this.getData(a,n,r);return this.uploadSource(e,s,r),s}getNetModel(){let e=new Set;for(let[r]of this.netMap){let i=te.getInstance().getNet(r);i==null&&(i=te.getInstance().addNet(r)),i!=null?e.add(i):console.warn(`${r}\u7F51\u7EDC\u65B0\u589E\u5931\u8D25`)}return e}getSource(){return this.encoder.getDataStr()}},p$e=YAe;var f$e=["EQ_LEN_GRP","NET","NET_CLASS"],jAe=class extends ET{constructor(e,r,i){super(e);this.netMap=new Map;this.netSuffix=null;this.netSuffix=r,this.netMap=i}pasteParseSource(e){let r=this.compiler.getHandle(),i=new og(this);this.compiler.setHandle(i,!0),this.compiler.consistencyManager.parseFull(e),this.compiler.setHandle(r,!0)}updateDecodeData(){this.handleNet();for(let e of this.decode.ruleSelect)this.updateRuleSelector(e);this.uploadRule()}updateRuleSelector(e){if(Array.isArray(e.select[0])&&e.select[0].length>0)this.handleBetweenNetRule(e);else{let r=e.select[0],i=e.select[1];if(!this.check(i,r))return;if(f$e.includes(r))for(let n in e.keyValue){let s=e.keyValue[n];Array.isArray(s)&&(s[1]=this.netMap.get(s[1]))}e.select[1]=`${i}${this.netSuffix}`,e.load(),this.handleNetLengthTolerance(i,e.select[1],r)}}handleNet(){for(let e of this.decode.net){if(!this.netMap.has(e.name))continue;let r=this.netMap.get(e.name);e.name=r,e.type!=null&&this.check(e.type,"NET_CLASS")?e.type=`${e.type}${this.netSuffix}`:e.type=null,e.DifferentailName!=null&&this.check(e.DifferentailName,"DIFF_PAIR")?e.DifferentailName=`${e.DifferentailName}${this.netSuffix}`:e.DifferentailName=null,e.EqualLengthGroupName!=null&&this.check(e.EqualLengthGroupName,"EQ_LEN_GRP")?e.EqualLengthGroupName=`${e.EqualLengthGroupName}${this.netSuffix}`:e.EqualLengthGroupName=null,e.load()}}handleBetweenNetRule(e){let r=!1;for(let i of e.select){let n=i[0],s=i[1];if(n==="NET_CLASS"){if(!this.check(s,"NET_CLASS")){r=!0;break}i[1]=`${s}${this.netSuffix}`}else if(n==="EQ_LEN_GRP"){if(!this.check(s,"EQ_LEN_GRP")){r=!0;break}i[1]=`${s}${this.netSuffix}`}else if(n==="NET"){if(!this.check(s,"NET")){r=!0;break}i[1]=this.netMap.get(s)}}r||e.load()}check(e,r){let i=new Set;switch(r){case"NET_CLASS":{i=te.getInstance().getNetClass(e).getNets();break}case"DIFF_PAIR":{i=new Set(te.getInstance().getNetDifferential(e).getNets());break}case"EQ_LEN_GRP":{i=te.getInstance().getEqualLengthGroup(e).getNets();break}case"NET":return this.netMap.has(e)}if(i.size===0)return!1;for(let n of i)if(!this.netMap.has(n))return!1;return!0}handleNetLengthTolerance(e,r,i){if(!f$e.includes(i))return;let n,s;i==="NET"?(n=te.getInstance().getNet(e),s=te.getInstance().getNet(r)):i==="EQ_LEN_GRP"?(n=te.getInstance().getEqualLengthGroup(e),s=te.getInstance().getEqualLengthGroup(r)):i==="NET_CLASS"&&(n=te.getInstance().getNetClass(e),s=te.getInstance().getNetClass(r)),s&&n&&!n.netLengthTolerancePhysics&&(s.netLengthTolerancePhysics="")}uploadRule(){let e=new Set,r=te.getInstance().getAllNetClass(),i=te.getInstance().betweenNetRule,n=te.getInstance().getAllNetDifferentials(),s=te.getInstance().getAllEqualLengthGroups();for(let[a,l]of this.netMap){let c=te.getInstance().getNet(l);e.add(c)}for(let a of e)this.compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",a)),this.compiler.uploadNet(a.name,or.getInstance().encode("NET",a));for(let a of r)this.compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",a));for(let a of i.rule)this.compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",a));for(let a of n)this.compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",a));for(let a of s)this.compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",a))}},m$e=jAe;var Mwt=["Constraint Region","Copper Region","3D Shell - Outline","3D Shell - Screw Pillar","3D Shell - Side Entity","3D Shell - Side Datum Line","3D Shell - Side Slot Region","3D Shell - Top/Bottom Entity","3D Shell - Top Slot Region"],F0e=class extends wi{constructor(){super();this.commandFactory=new ve("push component");this.commands=new ve("paste");this.mouseLeftX=0;this.mouseLeftY=0;this.unitConversion=new ft;this._drawing=!1;this.specialPasteNetMap=new Map;this.nthTime=1;this.tool=null;this.bridgingCoppers=new Array;this.customCopperMap=new Map;A.publish("updateFrame",""),A.subscribe("getPasteData",this.getPasteData.bind(this)),A.subscribe("rotateForAngle",this.rotateFor.bind(this))}get drawing(){return this._drawing}set drawing(e){this._drawing=e,this.tool!=null&&(this.tool.drawing=e)}reuseRepeat(e,r){var d;if(!x.getInstance().isactive||23==x.getInstance().doctype||e==null)return;let i=e.head,n=e.data,{position:s,combination:a}=i,l=new Array;r==null&&(r={});let c=new Array,h=new Set([...Zt.getAllItem(),...Xt.getAllItem(),...pt.getAllItem()].filter(p=>p.type=="Copper Region").map(p=>p.component.name));for(let p in n){let m=n[p];for(let g=0;g<m.length;g++){let y=JSON.parse(m[g]);if(y.type=="Copper Region"){let T=y.componentData.name,I=Ei.nameManager.getNum(T);if(h.has(I)){let C=1,E=I.split("-")[0];for(;h.has(`${E}-${C}`);)C++;I=`${E}-${C}`}y.componentData.name=I}let b=zC.getManager(Number(p));if(b==null)continue;(b instanceof CN||b instanceof SN||b instanceof GN)&&(d=be.getLayer(y.layerId))!=null&&d.isPlaneLayer()&&(y.layerId=1);let P=b.copy(y);l.push(P),y.globalIndex!=null&&(r[y.globalIndex]=P.globalIndex),P instanceof Ye&&P.type=="Copper Region"&&c.push({item:P,order:P.getComponent().order})}}for(let p of l)if(p instanceof ct&&p.type=="TearDrop"){let m=new Array;for(let g of p.getComponent().connects){let y=r[g];y!=null&&m.push(y)}pt.modifyConnect(p,m)}let u=c.sort((p,m)=>p==null||m==null?0:p.order-m.order).map(p=>p.item);gn.toLowest(u,!1);for(let p of l)p.click();return A.publish("updateFrame",""),{group:l,position:s}}generateUniqueIdInfo(){let e=x.getInstance().partitionId;return Cr.getAllItem().filter(r=>r.partition===e).reduce((r,i)=>{let n=i.attrKeyValue["Unique ID"];if(n){r.uniqueIdSet.add(n);let s=n.split("_")[0],a=r.prefixCountMap.get(s)||0,l=n.match(/_(\d+)$/),c=l?parseInt(l[1],10):0;r.prefixCountMap.set(s,Math.max(a,c))}return r},{uniqueIdSet:new Set,prefixCountMap:new Map})}getPasteData(e,r){var v,D;let i=x.getInstance().doctype;if(!x.getInstance().isactive||[23].includes(i))return;if(e==null){A.publish("tool","dropdrag");return}let n=e.copyData,s=n.layerIdReplacementTableMapping,l=Z2(s,"");if(!n.head.position&&!zC.getData()&&!n.head.type){A.publish("tool","dropdrag");return}let c=n.head,h=n.data,{position:u}=c,d=new Array,p=new Array;r==null&&(r={});let m;Ve.isSpecialPaste&&(m=this.generateRandomString(4));let g=i==4,{uniqueIdSet:y,prefixCountMap:b}=this.generateUniqueIdInfo(),P=w=>{let[F]=w.split("_"),H=b.get(F)||1,z=w;for(;y.has(z);)z=`${F}_${H}`,H++;return b.set(F,H),y.add(z),z},T=new Set,I=new Set(Cr.getAllItem().map(w=>w.designator)),C=new Set([...Zt.getAllItem(),...Xt.getAllItem(),...pt.getAllItem()].filter(w=>w.type=="Copper Region").map(w=>w.component.name));for(let w of Object.keys(h)){let F=zC.getManager(Number(w));if(F!=null)for(let H of h[w]){let z=JSON.parse(H),G=z.layerId,W=Z2(l,G);if(W&&(z.layerId=W),z.type=="Copper Region"){let U=z.componentData.name,k=Ei.nameManager.getNum(U);if(C.has(k)){let V=1,Y=k.split("-")[0];for(;C.has(`${Y}-${V}`);)V++;k=`${Y}-${V}`}z.componentData.name=k}if(z.type=="TearDrop"&&(F=pt),g&&(Number(w)==19||Mwt.includes(z.type)||(z.net&&(z.net=""),!this.itemLayerIsOpened(z)))||Bt.isChildPcb()&&F instanceof xw)continue;if((F instanceof CN||F instanceof SN||F instanceof GN)&&(v=be.getLayer(z.layerId))!=null&&v.isPlaneLayer()&&(z.layerId=1),F instanceof xw){let U=z.attrsMap["Unique ID"];if(U&&y.has(U)){let k=P(U);z.attrsMap["Unique ID"]=k;let V=(D=z.ATTR)==null?void 0:D.find(Y=>Y.key==="Unique ID");V&&(V.value=k)}}Ve.isSpecialPaste&&m!=null&&z.net&&(this.specialPasteNetMap.set(z.net,`${z.net}_$${m}`),z.net=z.net+`_$${m}`);let L=z.footprint,B=Z2(s,L),N=F instanceof xw?F.copy(z,B):F.copy(z);if(ce.pcbConfig.autoDesignator&&N instanceof Me&&I.has(N.designator)&&T.add(N),N.partition=z.partition,this.collectCopperSelectorMap(w,z,N.globalIndex),x.getInstance().doctype!=3&&(N instanceof Le||N instanceof Ge)&&(N.unusedInnerLayers=[]),N instanceof Me&&Ve.isSpecialPaste){let U=N.getItems();for(let k of U)"net"in k&&k.net&&(this.specialPasteNetMap.set(k.net,`${k.net}_$${m}`),k.net=k.net+`_$${m}`)}z.type=="Copper Region"&&N instanceof Ye?p.push(N):d.push(N),(z.globalIndex||z.gId)&&(r[z.globalIndex||z.gId]=N.globalIndex)}}if(ce.pcbConfig.autoDesignator&&!Ve.isSpecialPaste&&T.size&&MAe(T),Ve.isSpecialPaste){let w=new p$e(this.specialPasteNetMap),F=new m$e(x.getInstance().compiler,`_$${m}`,this.specialPasteNetMap);w.encodeRuleData(),F.pasteParseSource(w.getSource()),F.updateDecodeData()}let E=Kf.getNextTool()?Kf.getNextTool().getNextTool():null,O=E instanceof iO;if(d.length+p.length==0){A.publish("tool","dropdrag");return}else O&&E.initPastePanel().then(w=>F0.getInstance().toggle2ActiveLayer(n,r));p.sort((w,F)=>w.getComponent().order-F.getComponent().order),Re.addAll(d,p);for(let w of d)if(w instanceof ct&&w.type=="TearDrop"){let F=new Array;for(let H of w.getComponent().connects){let z=r[H];z!=null&&F.push(z)}F.length>1?pt.modifyConnect(w,F):w.type="Fill Region"}else if(w instanceof Ge&&w.type==1)if(w.resetReadRender(),g)w.type=0;else{let F=te.getInstance().getDefaultBlindPhysics();(F==null?void 0:F.getBlindVia(w.name))||(w.type=0)}else if(w instanceof Ye&&["3D Shell - Side Slot Region","3D Shell - Side Entity"].includes(w.type)){let F=w.getComponent(),H=r[F.lineId];H!=null&&(F.lineId=H)}if(!u){let w=_s(d),F;if(w.valid()&&(F=w.build1()),u=new S(F.center().x,F.center().y),d.length==1){let H=d[0];(H instanceof Ue||H instanceof mt||H instanceof vt||H instanceof ct)&&(u=H.start)}}this.mouseLeftX=u.x,this.mouseLeftY=u.y,this.transformTool=new ep(d),(O||E instanceof Q_)&&E.filterItems.clear();for(let w of this.transformTool.group)if((O||E instanceof Q_)&&(E.filterItems.add(w),w instanceof Me))for(let F of w.getItems())E.filterItems.add(F);let _=new Mt(Ma.x-this.mouseLeftX,Ma.y-this.mouseLeftY,0),R=Ae.translate1(_);return this.transformTool.transform(R),this.mouseLeftX=Ma.x,this.mouseLeftY=Ma.y,this.drawing=!0,A.publish("updateCross",""),A.publish("updateFrame",""),Ve.isSpecialPaste=!1,this.transformTool.recordStyle(),{tool:this.transformTool,position:u}}generateRandomString(e){for(var r="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",n=i.length,s=0;s<e;s++)r+=i.charAt(Math.floor(Math.random()*n));return r}itemLayerIsOpened(e){if(!e.layerId)return be.getLayer(e.startLayer).config||be.getLayer(e.endLayer).config;let r=be.getLayer(e.layerId);return r&&r.config}onKeyDown(e){var n;if(e.keyCode===32){if(((n=this.transformTool)==null?void 0:n.group.length)>0){let s=new S(this.mouseLeftX,this.mouseLeftY),a=Ae.translate(-s.x,-s.y,0).rotateZ(ce.pcbConfig.rotate).translate1(s.x,s.y,0);this.transformTool.transform(a)}}else e.keyCode===9?A.publish("openMainDialog",{cmd:23,data:{option:{unit:x.getInstance().unit}}}):e.keyCode===27&&this.cancel();let r=5;switch(sr.getAction(r,e)){case"Flip Right and Left":{this.turn("turnAround");break}case"Flip Up and Down":{this.turn("turnUpsideDown");break}}A.publish("updateFrame","")}onKeyUp(e){var r;if(((r=this.transformTool)==null?void 0:r.group.length)>0){let i=new Mt(e.sceneX-this.mouseLeftX,e.sceneY-this.mouseLeftY,0),n=Ae.translate1(i);this.transformTool.transform(n),this.mouseLeftX=e.sceneX,this.mouseLeftY=e.sceneY}}onMouseLeftUp(e){this.drawing&&(this.transformTool.complete(),this.handleBridgingCopperNets(),this.handleCustomCopperRule(),this.handleNets(e),this.handlePastePanel(),this.nthTime++)}handleBridgingCopperNets(){let e=ze.getAllNets();this.transformTool.group=this.transformTool.group.filter(r=>{if(r instanceof Ye&&r.type==="Fill Region"&&r.getComponent()instanceof ln){let i=r.getComponent();if(i.isBridgingCopper&&i.networkList){let n=ze.getSameNetItems(r.net);if(r.net!==""&&n.length==0&&i.networkList.length>0||n.length==1&&n[0]==r){ze.delete(r);let s=i.networkList.indexOf(r.net);s>-1&&(i.networkList.splice(s,1),r.net="")}return i.networkList=i.networkList.filter(s=>e.includes(s)),this.bridgingCoppers.push(r),!1}}return!0})}collectCopperSelectorMap(e,r,i){if(e!=="6"&&e!=="9"&&e!=="16"||r.type!=="Copper Region")return;let s=te.getInstance().getRegion(r.globalIndex);s&&this.customCopperMap.set(i,s)}handleCustomCopperRule(){let e=te.getInstance();for(let[r,i]of this.customCopperMap.entries()){if(!i)continue;let n=e.addRegionSelector(r);i.safeClearance&&(n.safeClearance=i.safeClearance),i.copperPlane&&(n.copperPlane=i.copperPlane),Xp.getInstance().publish("modify",n)}}getNearNetPcbItems(e){let r=new _e,i=()=>{if(this.transformTool.group.length<1)return{canSkip:!0,criticalItems:null};let m=new Set,g=new WeakMap;for(let T of this.transformTool.group)if(r.ext1(T.buildBBox()),m.add(T),T instanceof Me){let I=g.get(T)||T.getItems();g.set(T,I),I.forEach(C=>m.add(C))}let P=Vt.search4Types(r.build1(),ESe).getResult(dd).filter(T=>!m.has(T));return{canSkip:P.length===0,criticalItems:P}},n=(m,g)=>{if(!g||g.length===0)return m;let y=new _e;if(g.forEach(I=>y.ext1(I.buildBBox())),r.build1().area()*.8<y.build1().area())return m;let b=y.build1(),P=new Set,T=I=>{I.buildBBox().intersect(b)&&(P.add(I),I instanceof Me&&I.getItems().forEach(C=>{C.buildBBox().intersect(b)&&P.add(C)}))};return m.forEach(T),Array.from(P)},{canSkip:s,criticalItems:a}=i(),l=new Set;if(s)return{netsGroupSet:l,isMoreThan2Nets:!1};let c=this.transformTool.group.filter(m=>m instanceof Ye&&m.type=="Copper Region");if(c.length==this.transformTool.group.length){for(let m of c){let g=m.getMathGraphics(),y=Wr.getSelectContect(g),b=this.filterNearItemNet(y,m.layerId);l.add({group:[m],nets:b})}return{netsGroupSet:l,isMoreThan2Nets:!1}}let u=this.transformTool.group.length>8e4&&a?n(this.transformTool.group,a):this.transformTool.group,d=new ib(u);d.updateScene();let p=d.getNetPcbItems(e);return d.recycle(),d=null,p}filterNearItemNet(e,r){let i=new Set;for(let n of e){let s=Bo(n);if(!(n instanceof Ge&&n.startLayer!==r&&n.endLayer!==r)&&!(r!==12&&n.layerId!==12&&!(n instanceof Ge)&&n.layerId!==r)&&s){if(n instanceof Ue||n instanceof Ge||n instanceof Ri||n instanceof fn||n instanceof ii||n instanceof Ki)i.add(s);else if(n instanceof Ye&&(n.type=="Line"||n.type=="Fill Region")){if(!be.getLayer(n.layerId).isSignalLayer())return;i.add(s)}}}return i}handlePastePanel(){F0.getInstance().toggle2ActiveLayer(void 0,void 0,!0),F0.getInstance().reset()}toastInheritInfo(e){e&&A.publish("ui/toastMsg",{type:"info",msg:"Some networks were not inherited, please check",timer:6,autoHeight:!0},$())}handleNets(e){switch(F0.getInstance().inheritNet){case"KeepOriginNets":Bt.isChildPcb()&&this.transformTool.group.forEach(i=>i.net="");break;case"ClearNets":this.transformTool.group.forEach(i=>{i instanceof Me?i.getItems().forEach(n=>{Bo(n)!==null&&(n.net="")}):Bo(i)!==null&&(i.net="")});break;case"InheritNetsfromTouchedObjects":this.inheritNets(e);break}this.drawing&&this.complete()}inheritNets(e){let{netsGroupSet:r,isMoreThan2Nets:i}=this.getNearNetPcbItems(e);this.netsGroupSet=r,this.netsGroupSet.size>1?(this.mulGroupInheritNet(),this.toastInheritInfo(i)):this.netsGroupSet.size===1?this.singleGroupInheritNet(e,i):(Bt.isChildPcb()&&this.transformTool.group.forEach(n=>n.net=""),this.toastInheritInfo(i))}singleGroupInheritNet(e,r){this.nets=new Set;let i=!1;this.netsGroupSet.forEach(s=>{this.nets=s.nets,i=s.group.some(a=>a instanceof ii||a instanceof Ye&&(a.type=="Copper Region"||a.type=="Fill Region"))});let n=this.nets.size>1&&i;if(!this.nets.size||n){Bt.isChildPcb()&&this.netsGroupSet.forEach(s=>{s.group.forEach(a=>{a.net=""})}),n&&this.toastInheritInfo(r);return}else if(this.nets.size===1){let s=Array.from(this.nets)[0];this.netsGroupSet.forEach(a=>{a.group.forEach(l=>{l.net=s})})}else Bt.isChildPcb()?this.netsGroupSet.forEach(s=>{s.group.forEach(a=>{a.net=""})}):this.showNetsMenu(e)}mulGroupInheritNet(){this.netsGroupSet.forEach(e=>{let r=e.nets;if(r&&r.size===0)return;let i=r&&r instanceof Set&&r.size==1?Array.from(r)[0]:"";Bt.isChildPcb()&&(!r.size||r.size>1)&&(i=""),e.group.forEach(n=>{n.net=i})})}createATTR(e,r,i){let n=3;e.layerId==2&&(n=4);let s=ce.getDefaultFontSetting(),a=e.generateValidId(),l=ti.rebuild(a,n,r,!1,i,!1,s.defaultComponentFontTypeface,s.defaultComponentFontHeight,e.rotation,!1,S.ORIGIN,3,s.defaultComponentFontStrokeWidth,!1,0,!1,!0);return e.addAttribute(l),l}getUniqueIdCache(e){let r=Cr.getAllItem(),i=new Map;for(let n=0,s=r.length;n<s;n++){let a=r[n];if(a.partition!=x.getInstance().partitionId||e.has(a))continue;let l=r[n].attrKeyValue["Unique ID"],c=i.get(l)||0;c++,i.set(l,c)}return i}updateUniqueId(e,r){let i=this.getUniqueIdCache(r);for(let[n,s]of e){let a=n.split("_")[0];if(i.get(n)==null){let c=0;i.set(n,1);for(let h=1,u=s.length;h<u;h++){let d=s[h],p=`${a}_${h+c}`;for(;i.has(p);)p=`${a}_${h+ ++c}`;i.set(p,1),d.modifyATTRMap("Unique ID",p);let m=this.createATTR(d,"Unique ID",p),g=ps.getItem(d.deviceUUID);g.addAttr("Unique ID",g.getAttrData(d.model,m.model))}}else{let c=s.length;for(let h=0,u=s.length;h<u;h++){let d=s[h],p=`${a}_${h+c}`;for(;i.has(p);)p=`${a}_${h+ ++c}`;i.set(p,1),d.modifyATTRMap("Unique ID",p);let m=this.createATTR(d,"Unique ID",p),g=ps.getItem(d.deviceUUID);g.addAttr("Unique ID",g.getAttrData(d.model,m.model))}}}}complete(){var e;if(this.transformTool.complete(),this.bridgingCoppers.length>0&&(this.bridgingCoppers.forEach(r=>this.transformTool.group.push(r)),this.bridgingCoppers=new Array),this.transformTool.group.length>0){let r=new Map,i=new Set;for(let h of this.transformTool.group){if(!Bt.checkIsInCanEdit(h)){let u="beyond drawing range";Bt.showMassageTip(u,u);return}if(h instanceof Me){let u=h.attrsMap["Unique ID"];if(u){let d=r.get(u);d==null&&(d=new Array,r.set(u,d)),d.push(h),i.add(h)}}}this.updateUniqueId(r,i),A.publish("onlySelect",this.transformTool.group);let n=!1,s=CXe(this.transformTool.group);if(ce.pcbConfig.isPlaceViasAutoShove&&s){A.publish("updateRtree","");let h=this.transformTool.group.filter(u=>u instanceof Ge||u instanceof Ue);if(h.length>0){let u=new Br,d=J3(h,u);Jl.getInstance().init(),(e=this.shoveCommands)==null||e.undo(),this.shoveCommands=new Br,_9(d,this.shoveCommands,!0)}}if(ce.pcbConfig.moveComponent=="push"){for(let h of this.commandFactory.commands)this.commands.addCommand(h);this.commandFactory=new ve("push component")}let a=new mi;a.addGroup(this.commands);for(let h of this.transformTool.group)a.addCommand4Item(h,"add");this.addRuleCommand(a);let l;s&&(l=Tue(this.commands));for(let h of this.transformTool.group)gn.addOrder(h,a.getCommand());this.transformTool.group.length<1e3?a.checkOutlines(this.transformTool.group,new Set):a.execute(),this.commands=new ve("paste"),ce.pcbConfig.isPlaceViasAutoShove&&s&&(this.shoveCommands=new Br,Q3(),this.getNewViaAfterShove(l));let c=new Set;for(let h of this.transformTool.group)h.isEmpty||h instanceof Ye&&h.type=="Copper Region"&&c.add(h.globalIndex);this.transformTool.group.length=0,c.size>0&&A.publish("rebuildConnectCopper",Array.from(c))}this.subPosition=null,A.publish("tool","dropdrag"),dt.destroy()}getNewViaAfterShove(e){if(!e||Object.keys(e).length===0)return;let r=Object.values(e),i=[];for(let n of r){let s=Hr.getItem(n);for(let a of this.transformTool.group)a instanceof Ge&&s&&s.center.equals1(a.center)&&i.push(s)}A.publish("onlySelect",[].concat(i,this.transformTool.group.filter(n=>n instanceof Ue)))}pastePosition(e,r=!0){let i=new S(this.mouseLeftX,this.mouseLeftY),n=e.sub(i),s=Ae.translate(n.x,n.y,0);this.transformTool.group.length>0&&this.drawing&&(this.transformTool.transform(s),this.transformTool.complete(),r&&ah.realtimeCheckItems(this.transformTool.group),this.mouseLeftX=e.x,this.mouseLeftY=e.y)}applyValue(e){let r=new ft,{value:i,type:n,startPoint:s,cursorPoint:a}=e,l=new S(a.x-s.x,a.y-s.y).normalize();i=r.conversion(x.getInstance().unit,"mil",i/10),l=new S(l.x*i,l.y*i);let c=new S(l.x+s.x,l.y+s.y),h=new S(c.x-a.x,c.y-a.y),u=Ae.translate(h.x,h.y,0);this.transformTool.transform(u),this.complete()}showNetsMenu(e){if(this.drawing){this.drawing=!1;let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=this.getNetsMenuData().result,Qt.getInstance().menuData(r,this)}}getNetsMenuData(){let e=new Jt,r="INHERIT_NET:";return this.nets.forEach(i=>{if(i){let n={name:i,cmd:`${r+i}`,tips:"",option:{disabledI18n:!0}};e.addObj(n,!1,!1)}}),e}moveComponent(){if(this.transformTool.group.length>400)return;let e=Array.from(this.transformTool.group).filter(r=>r instanceof Me);if(this.transformTool.group.length==e.length&&e.length>0&&ce.pcbConfig.moveComponent!=="ignore"){let r=[],i=Ab(),n=e[0].model.buildBBox(),s=new S(n.minX,n.minY),a=new S(n.maxX,n.maxY);if(e.forEach(u=>{if(!this.subPosition){let p=u.position;this.subPosition=new S(this.mouseLeftX,this.mouseLeftY).sub(p)}r.push(`${ur}${u.number}`);let d=u.model.buildBBox();s=new S(Math.min(s.x,d.minX),Math.min(s.y,d.minY)),a=new S(Math.max(a.x,d.maxX),Math.max(a.y,d.maxY))}),new Set(r).size!==r.length)return;let l=new S(s.x,a.y),c=new S(a.x,s.y),h=new vs(e[0].layerId,s,l,c,a,e[0].locked);switch(ce.pcbConfig.moveComponent){case"push":this.commandFactory.undo(),this.commandFactory=new ve("push component");let u=new Map;JG(h,this.commandFactory,i,u,r,e),u.clear();break;case"block":$G(h,i,e);break}e.forEach(u=>{this.mouseLeftX=u.position.x+this.subPosition.x,this.mouseLeftY=u.position.y+this.subPosition.y})}}onMouseMove(e){var r;if(((r=this.transformTool)==null?void 0:r.group.length)>0&&this.drawing){let i=new Mt(e.sceneX-this.mouseLeftX,e.sceneY-this.mouseLeftY,0),n=Ae.translate1(i);this.transformTool.transform(n),this.mouseLeftX=e.sceneX,this.mouseLeftY=e.sceneY,this.moveComponent()}}interrupt(){var e;if((e=this.transformTool)!=null&&e.group){for(let r of this.transformTool.group)r.remove(),A.publish("delete",r);Ve.clearTempSelect(),this.transformTool.cancel(),this.drawing=!1,this.transformTool.group.length=0,this.customCopperMap.clear(),F0.getInstance().reset(),dt.destroy(),this.subPosition=null}}cancel(){var e;this.interrupt(),ce.pcbConfig.moveComponent=="push"&&((e=this.commandFactory)==null||e.undo(),this.commandFactory=new ve("push component")),A.publish("tool","dropdrag")}referPosition(e){var r;if(((r=this.transformTool.group)==null?void 0:r.length)>0){let i=new Mt(e.x-this.mouseLeftX,e.y-this.mouseLeftY,0),n=Ae.translate1(i);this.transformTool.transform(n),this.complete()}else A.publish("tool","dropdrag")}onMouseRightUp(e){if(e.openMenu)switch(ce.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.onMouseLeftUp(e):this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:t0e(this.transformTool.group,e.adsorb).result};Qt.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",$());break;case"ROTATE":this.rotate(i[1]);break;case"FLIP":i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"?this.turn("turnUpsideDown"):i[1]=="FLIP_LEFTANDRIGHT_BY_REFER_POINT"?this.turn("turnAroundByReferPoint"):i[1]=="FLIP_UPANDDOWN_BY_REFER_POINT"&&this.turn("turnUpsideDownByReferPoint");break;case"INHERIT_NET":let n=i[1];this.netsGroupSet.forEach(s=>{s.group.forEach(a=>{a.net=n})}),this.complete();break;case"TURNOVER":{J_(!1,this.transformTool.group);break}}A.publish("updateFrame","")}turn(e){var r;if(!(!x.getInstance().isactive||23==x.getInstance().doctype))switch(Yo.setTool(this),(r=this.transformTool)==null||r.sycn(),e){case"turnAround":Yo.turn(this.transformTool.group,!1,!1,new S(this.mouseLeftX,this.mouseLeftY));break;case"turnUpsideDown":Yo.turn(this.transformTool.group,!0,!1,new S(this.mouseLeftX,this.mouseLeftY));break;case"turnAroundByReferPoint":{let i={items:this.transformTool.group};Yo.turnByReferPoint(i,this);break}case"turnUpsideDownByReferPoint":{let i={items:this.transformTool.group,isTurnUpsideDown:!0};Yo.turnByReferPoint(i,this);break}}}rotate(e){let r=new S(this.mouseLeftX,this.mouseLeftY);if(e==="rotate_left"){let i=Ae.translate(-r.x,-r.y,0).rotateZ(ce.pcbConfig.rotate).translate1(r.x,r.y,0);this.transformTool.transform(i)}if(e==="rotate_right"){let i=Ae.translate(-r.x,-r.y,0).rotateZ(-ce.pcbConfig.rotate).translate1(r.x,r.y,0);this.transformTool.transform(i)}if(e==="rotate_reference_point"){let i={x:this.mouseLeftX,y:this.mouseLeftY,items:this.transformTool,executeCommand:!1};ao.rotateAssignReferPoint(i,this,null,null,this.rotateReferPointCallback.bind(this))}}rotateReferPointCallback(e,r,i,n){this.mouseLeftX=n.referPoint.x,this.mouseLeftY=n.referPoint.y;let s=new Mt(Ma.x-this.mouseLeftX,Ma.y-this.mouseLeftY,0),a=Ae.translate1(s);this.transformTool.transform(a),ah.realtimeCheckItems(this.transformTool.group),this.mouseLeftX=Ma.x,this.mouseLeftY=Ma.y}addRuleCommand(e){if(this.specialPasteNetMap.size>0){let r=new Set;for(let[i,n]of this.specialPasteNetMap){let s=te.getInstance().getNet(n);s.netClass&&(r.has(s.netClass)||(e.addCommand(Te.disPatchRule(s.netClass,"add")),r.add(s.netClass))),s.equalLengthGroup&&(r.has(s.equalLengthGroup)||(e.addCommand(Te.disPatchRule(s.equalLengthGroup,"add")),r.add(s.equalLengthGroup))),s.netDifferential&&(r.has(s.netDifferential)||(e.addCommand(Te.disPatchRule(s.netDifferential,"add")),r.add(s.netDifferential))),e.addCommand(Te.disPatchRule(s,"add"))}this.specialPasteNetMap.clear()}}rotateFor(e){let r=new S(this.mouseLeftX,this.mouseLeftY);this.transformTool.rotateForAngle(r,e)}};var V0e=class{constructor(t){this._info={};this._type=t}get type(){return this._type}set type(t){this._type=t}addSize(t){this._info[t.id]=t}removeSize(t){delete this._info[t.id]}get info(){return this._info}clear(){this._info={}}};var ZC=class{constructor(t,e){this._id=t,this._type=e}get id(){return this._id}set id(t){this._id=t}get type(){return this._type}set type(t){this._type=t}};function Gm(o,t,e=!0){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=[1,10,100,1e3],i=r[t]||Math.pow(10,t)||10;if(e){var n=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*i)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),n+o}else return Math.round(o*i+1e-10)/i}var G0e=class extends ZC{constructor(t,e,r,i,n){super(t,0),this._milDeltaX=e,this._milDeltaY=r,this._mmDeltaX=i,this._mmDeltaY=n}get milDeltaX(){return this._milDeltaX}set milDeltaX(t){this._milDeltaX=t}get milDeltaY(){return this._milDeltaY}set milDeltaY(t){this._milDeltaY=t}get mmDeltaX(){return Gm(this._mmDeltaX,4)}set mmDeltaX(t){this._mmDeltaX=t}get mmDeltaY(){return Gm(this._mmDeltaY,4)}set mmDeltaY(t){this._mmDeltaY=t}getMenu(){return{name:`${Gm(this.mmDeltaX*10,3)}, ${Gm(this.mmDeltaY*10,3)}mm | ${Gm(this.milDeltaX*10,1)}, ${Gm(this.milDeltaY*10,1)}mil`,cmd:`${this.id}`,tips:""}}getSizeAccordingToUnit(){let t=x.getInstance().unit;return t!=="mil"?{gridX:new ft().conversion(t,"mil",this._mmDeltaX),gridY:new ft().conversion(t,"mil",this._mmDeltaY)}:{gridX:this._milDeltaX,gridY:this._milDeltaY}}};var U0e=class extends ZC{constructor(t,e,r){super(t,1),this._mil=e,this._mm=r}get mil(){return this._mil}set mil(t){this._mil=t}get mm(){return this._mm}set mm(t){this._mm=t}getMenu(t=""){return{name:`${Gm(this.mm*10,3)}mm | ${Gm(this.mil*10,1)}mil`,cmd:`${t+this.id}`,tips:""}}getSizeAccordingToUnit(){let t=x.getInstance().unit;return t!=="mil"?new ft().conversion(t,"mil",this._mm):this._mil}};var H0e=class extends ZC{constructor(t,e,r,i,n){super(t,2),this._milInnerRadius=e,this._mmInnerRadius=r,this._milRadius=i,this._mmRadius=n}get milInnerRadius(){return this._milInnerRadius}set milInnerRadius(t){this._milInnerRadius=t}get mmInnerRadius(){return this._mmInnerRadius}set mmInnerRadius(t){this._mmInnerRadius=t}get milRadius(){return this._milRadius}set milRadius(t){this._milRadius=t}get mmRadius(){return this._mmRadius}set mmRadius(t){this._mmRadius=t}getMenu(t=""){return{name:`${Gm(this.mmInnerRadius*20,3)}, ${Gm(this.mmRadius*20,3)}mm | ${Gm(this.milInnerRadius*20,1)}, ${Gm(this.milRadius*20,1)}mil`,cmd:`${t+this.id}`,tips:""}}getSizeAccordingToUnit(){let t=x.getInstance().unit;return t!=="mil"?{innerRadius:new ft().conversion(t,"mil",this._mmInnerRadius),radius:new ft().conversion(t,"mil",this._mmRadius)}:{innerRadius:this._milInnerRadius,radius:this._milRadius}}};function g$e(){return{GridX:{number:5,unit:"mil"},GridY:{number:5,unit:"mil"}}}var W0e=class{constructor(){this.configGridType="grid";this.configMultiGridType="grid";this.configMultiRatio=5;this._crossCursor="Large";this._drcErrorStyle="1";this._displayComponentSpacing=!1;this._drcErrorZoom="keepConstantSize";this._graphicEffectMode="speedFirst";this._coreRenderingEngine="auto";this._UNIT="mil";this._FOOTPRINT_UNIT="mm";this._altGridSize=g$e();this._rotate=90;this._clickTrackSelect="single";this._showDiffLength=!0;this._showNetLength=!0;this._placeBlind=!1;this._trackFollowComponent=!0;this._rotateWhole="whole";this._moveComponent="ignore";this._autoChamfer2DLine="off";this._filletRadius2DLine=1.969;this._autoChamferTrack="off";this._filletRadiusTrack=1.969;this._startTrackWidth="last";this._startViaSize="last";this._showCrossCursor=!1;this._checkNetBeforeGerber=!0;this._checkDrcBeforeGerber=!0;this._trackFollow="moveKeep";this._trackFollowVia="moveKeep";this._autoTerminateRouting=!0;this._isUsedJLCColorSilk=!1;this._isAutoGenerate3dModel=!0;this._isPlaceViasAutoShove=!1;this._isAutoMoveCanvasDuringCrossProbe=!0;this._isAutoFitSelectionDuringCrossProbe=!1;this._isOtherObjectsDimDuringCrossProbe=!1;this._isCtrlDragToCopy=!1;this._snapToCenterWhileDragPadOrVia=!1;this._snapToOriginWhileDragFootprint=!1;this._alignToNearComponentOrPadWhileDrag=!1;this._isAssignNetForFreeTrack=!1;this._addTeardropAutomatically=!0;this._isKeepRefdesPaste="2";this._useDynamicInputBox=!0;this._displayProperty=!0;this._highLight=!0;this._defaultComponentFontTypeface="default";this._defaultComponentFontStrokeWidth=.6;this._defaultComponentFontHeight=4.5;this._highLightNet=!0;this._realTimeTrackSelectStats="single";this._wireConfirm="previous";this._endDrawing="ctrl+rightClick";this._addViaMethodWhileRoute="lastInflectionPoint";this._pcbLayerSelectedNameCache="";this._autoChangeLayerWhileRoutingVias=!0;this._dblclickPlaceViasWhileRouting=!0;this._routeAutoFanoutEnd=!1;this._isRebuildCopperAuto=!0;this._allowFootprintFlipping=!1;this.unusedPadOperation="remove";this.unusedPadRange=3;this.unusedPadOnlySelect=!0;this.realTimeUpdateUnusedLayers=!1;this._autoLoopUpMsgBox=!1;this.isInit=!0;this._referencePointPcbSelectMethod="default"}get autoLoopUpMsgBox(){return this._autoLoopUpMsgBox}set autoLoopUpMsgBox(t){this._autoLoopUpMsgBox=t}get realTimeTrackSelectStats(){return this._realTimeTrackSelectStats}get referencePointPcbSelectMethod(){return this._referencePointPcbSelectMethod}set referencePointPcbSelectMethod(t){this._referencePointPcbSelectMethod=t}get showCrossCursor(){return this._showCrossCursor}set showCrossCursor(t){this._showCrossCursor=t}get checkNetBeforeGerber(){return this._checkNetBeforeGerber}set checkNetBeforeGerber(t){this._checkNetBeforeGerber=t}get checkDrcBeforeGerber(){return this._checkDrcBeforeGerber}set checkDrcBeforeGerber(t){this._checkDrcBeforeGerber=t}get gridType(){return x.getInstance().gridType}set gridType(t){x.getInstance().gridType=t}get multiType(){return x.getInstance().multiType}set multiType(t){x.getInstance().multiType=t}get multiRatio(){return x.getInstance().multiRatio}set multiRatio(t){x.getInstance().multiRatio=t}get crossCursor(){return this._crossCursor}set crossCursor(t){this._crossCursor=t}get graphicEffectMode(){return this._graphicEffectMode}set graphicEffectMode(t){this._graphicEffectMode!=t&&(this._graphicEffectMode=t,this._graphicEffectMode=="effectFirst"?x.getInstance().setAntialias(!0):x.getInstance().setAntialias(!1))}get coreRenderingEngine(){return this._coreRenderingEngine}set coreRenderingEngine(t){typeof t<"u"&&this._coreRenderingEngine!=t&&(this._coreRenderingEngine=t,x.getInstance().coreRenderingEngine=t)}get drcErrorStyle(){return this._drcErrorStyle}set drcErrorStyle(t){this._drcErrorStyle!=t&&(this._drcErrorStyle=t,this.isInit||A.messageBus.rpcCall("getAllErrors",{isOpenDRCCustomCheck:Qa.getInstance().isOpenDRCCustomCheck}))}get displayComponentSpacing(){return this._displayComponentSpacing}set displayComponentSpacing(t){this._displayComponentSpacing!=t&&(this._displayComponentSpacing=t)}get drcErrorZoom(){return this._drcErrorZoom}set drcErrorZoom(t){this._drcErrorZoom!=t&&(this._drcErrorZoom=t,TU.arrowStyleInitialized=!1,this.isInit||A.messageBus.rpcCall("getAllErrors",{isOpenDRCCustomCheck:Qa.getInstance().isOpenDRCCustomCheck}))}get UNIT(){return this._UNIT}set UNIT(t){this._UNIT=t}get FOOTPRINT_UNIT(){return this._FOOTPRINT_UNIT}set FOOTPRINT_UNIT(t){this._FOOTPRINT_UNIT=t}get altGridSize(){return this._altGridSize}getAltGridSize(){let t=this._altGridSize.GridX,e=this._altGridSize.GridY,r=t.number/10,i=e.number/10,n=new ft;return x.getInstance().unit=="mil"?t.unit!=x.getInstance().unit&&(r=n.conversion(t.unit,x.getInstance().unit,r),i=n.conversion(e.unit,x.getInstance().unit,i)):t.unit==x.getInstance().unit&&(r=n.conversion(t.unit,"mil",r),i=n.conversion(e.unit,"mil",i)),{snapX:r,snapY:i}}set altGridSize(t){this._altGridSize=t,x.getInstance().altGridSize=t}get rotate(){return this._rotate/180*Math.PI}set rotate(t){this._rotate=t}get clickTrackSelect(){return this._clickTrackSelect}set clickTrackSelect(t){this._clickTrackSelect=t,this._realTimeTrackSelectStats=t}toggleRealTimeTrackSelectStats(t){t?this._realTimeTrackSelectStats=this._realTimeTrackSelectStats=="single"?"whole":"single":this._realTimeTrackSelectStats=this._clickTrackSelect}get showRuler(){return x.getInstance().openRuler}set showRuler(t){x.getInstance().openRuler!=t&&!x.getInstance().isPreview&&(x.getInstance().openRuler=t)}get isRebuildCopperAuto(){return this._isRebuildCopperAuto}set isRebuildCopperAuto(t){this._isRebuildCopperAuto=t,RC.getInstance().modifyDynamicCopper(t)}get allowFootprintFlipping(){return this._allowFootprintFlipping}set allowFootprintFlipping(t){this._allowFootprintFlipping=t}get padShowNet(){return ga.getInstance().padShowNet}set padShowNet(t){ga.getInstance().padShowNet!=t&&(ga.getInstance().padShowNet=t,Uw.padFlushNumNet(),A.publish("updateFrame",""))}get padShowNum(){return ga.getInstance().padShowNum}set padShowNum(t){ga.getInstance().padShowNum!=t&&(ga.getInstance().padShowNum=t,Uw.padFlushNumNet(),A.publish("updateFrame",""))}get trackShowNet(){return ga.getInstance().trackShowNet}set trackShowNet(t){ga.getInstance().trackShowNet!=t&&(ga.getInstance().trackShowNet=t,Uw.trackFlushNet())}get viaShowLayerPair(){return ga.getInstance().viaShowPair}set viaShowLayerPair(t){ga.getInstance().viaShowPair!=t&&(ga.getInstance().viaShowPair=t,Uw.viaFlushNet())}get viaShowNet(){return ga.getInstance().viaShowNet}set viaShowNet(t){ga.getInstance().viaShowNet!=t&&(ga.getInstance().viaShowNet=t,Uw.viaFlushNet())}get showDiffLength(){return this._showDiffLength}set showDiffLength(t){this._showDiffLength!=t&&(this._showDiffLength=t)}get showNetLength(){return this._showNetLength}set showNetLength(t){this._showNetLength!=t&&(this._showNetLength=t)}get placeBlind(){return this._placeBlind}set placeBlind(t){this._placeBlind=t}get trackFollowComponent(){return this._trackFollowComponent}set trackFollowComponent(t){this._trackFollowComponent=t}get rotateWhole(){return this._rotateWhole}set rotateWhole(t){this._rotateWhole=t}get moveComponent(){return this._moveComponent}set moveComponent(t){this._moveComponent=t}get autoChamfer2DLine(){return this._autoChamfer2DLine}set autoChamfer2DLine(t){this._autoChamfer2DLine=t}get filletRadius2DLine(){return this._filletRadius2DLine}set filletRadius2DLine(t){this._filletRadius2DLine=t}get autoChamferTrack(){return this._autoChamferTrack}set autoChamferTrack(t){this._autoChamferTrack=t}get filletRadiusTrack(){return this._filletRadiusTrack}set filletRadiusTrack(t){this._filletRadiusTrack=t}get startTrackWidth(){return this._startTrackWidth}set startTrackWidth(t){this._startTrackWidth=t}get startViaSize(){return this._startViaSize}set startViaSize(t){this._startViaSize=t}get trackFollow(){return this._trackFollow}set trackFollow(t){this._trackFollow=t}get trackFollowVia(){return this._trackFollowVia}set trackFollowVia(t){this._trackFollowVia=t}get autoTerminateRouting(){return this._autoTerminateRouting}set autoTerminateRouting(t){this._autoTerminateRouting=t}get isUsedJLCColorSilk(){return this._isUsedJLCColorSilk}set isUsedJLCColorSilk(t){this._isUsedJLCColorSilk=t}get isAutoGenerate3dModel(){return this._isAutoGenerate3dModel}set isAutoGenerate3dModel(t){this._isAutoGenerate3dModel=t}get isPlaceViasAutoShove(){return this._isPlaceViasAutoShove}set isPlaceViasAutoShove(t){this._isPlaceViasAutoShove=t}get isAutoMoveCanvasDuringCrossProbe(){return this._isAutoMoveCanvasDuringCrossProbe}set isAutoMoveCanvasDuringCrossProbe(t){this._isAutoMoveCanvasDuringCrossProbe=t}get isAutoFitSelectionDuringCrossProbe(){return this._isAutoFitSelectionDuringCrossProbe}set isAutoFitSelectionDuringCrossProbe(t){this._isAutoFitSelectionDuringCrossProbe=t}get isOtherObjectsDimDuringCrossProbe(){return this._isOtherObjectsDimDuringCrossProbe}set isOtherObjectsDimDuringCrossProbe(t){this._isOtherObjectsDimDuringCrossProbe=t}get isCtrlDragToCopy(){return this._isCtrlDragToCopy}set isCtrlDragToCopy(t){this._isCtrlDragToCopy=t}get snapToCenterWhileDragPadOrVia(){return this._snapToCenterWhileDragPadOrVia}set snapToCenterWhileDragPadOrVia(t){this._snapToCenterWhileDragPadOrVia=t}get snapToOriginWhileDragFootprint(){return this._snapToOriginWhileDragFootprint}set snapToOriginWhileDragFootprint(t){this._snapToOriginWhileDragFootprint=t}get alignToNearComponentOrPadWhileDrag(){return this._alignToNearComponentOrPadWhileDrag}set alignToNearComponentOrPadWhileDrag(t){this._alignToNearComponentOrPadWhileDrag=t}get isAssignNetForFreeTrack(){return this._isAssignNetForFreeTrack}set isAssignNetForFreeTrack(t){this._isAssignNetForFreeTrack=t}get addTeardropAutomatically(){return this._addTeardropAutomatically}set addTeardropAutomatically(t){this._addTeardropAutomatically=t}get isKeepRefdesPaste(){return this._isKeepRefdesPaste}set isKeepRefdesPaste(t){this._isKeepRefdesPaste=t}get autoDesignator(){return["2","1"].includes(this._isKeepRefdesPaste)}get designatorAnnocationType(){return this._isKeepRefdesPaste}set designatorAnnocationType(t){this._isKeepRefdesPaste=t}get useDynamicInputBox(){return this._useDynamicInputBox}set useDynamicInputBox(t){this._useDynamicInputBox=t}get displayProperty(){return this._displayProperty}set displayProperty(t){this._displayProperty=t}get highLight(){return this._highLight}set highLight(t){this._highLight=t}get highLightNet(){return this._highLightNet}set highLightNet(t){this._highLightNet=t}get wireConfirm(){return this._wireConfirm}set wireConfirm(t){this._wireConfirm=t}get endDrawing(){return this._endDrawing}set endDrawing(t){this._endDrawing=t}get addViaMethodWhileRoute(){return this._addViaMethodWhileRoute}set addViaMethodWhileRoute(t){this._addViaMethodWhileRoute=t}get pcbLayerSelectedNameCache(){return this._pcbLayerSelectedNameCache}set pcbLayerSelectedNameCache(t){this._pcbLayerSelectedNameCache=t}get autoChangeLayerWhileRoutingVias(){return this._autoChangeLayerWhileRoutingVias}set autoChangeLayerWhileRoutingVias(t){this._autoChangeLayerWhileRoutingVias=t}get dblclickPlaceViasWhileRouting(){return this._dblclickPlaceViasWhileRouting}set dblclickPlaceViasWhileRouting(t){this._dblclickPlaceViasWhileRouting=t}get routeAutoFanoutEnd(){return this._routeAutoFanoutEnd}set routeAutoFanoutEnd(t){this._routeAutoFanoutEnd=t}get defaultComponentFontTypeface(){return this._defaultComponentFontTypeface}set defaultComponentFontTypeface(t){typeof t=="string"&&(this._defaultComponentFontTypeface=t)}get defaultComponentFontStrokeWidth(){return this._defaultComponentFontStrokeWidth}set defaultComponentFontStrokeWidth(t){this._defaultComponentFontStrokeWidth=t}get defaultComponentFontHeight(){return this._defaultComponentFontHeight}set defaultComponentFontHeight(t){this._defaultComponentFontHeight=t}get layerPhyPerferenceConfig(){return this._layerPhyPerferenceConfig}set layerPhyPerferenceConfig(t){this._layerPhyPerferenceConfig=t}};var z0e=class{constructor(){this.canvasTheme=Ys.getInstance();this._canvasLayerTheme=[]}get canvasLayerTheme(){return this._canvasLayerTheme}set canvasLayerTheme(t){this._canvasLayerTheme=t}get canvasLayerThemeSelected(){return this._canvasLayerThemeSelected}set canvasLayerThemeSelected(t){this._canvasLayerThemeSelected=t}};var XAe=class{constructor(t,e,r,i){this.attr=t,this.obj=e,this.showKey=r,this.showValue=i}},Y0e=class{constructor(){this.attributes=new Set}add(t,e,r,i){let n=new XAe(t,e,r,i);this.attributes.add(n)}modify(t,e,r,i){let n=!1;this.attributes.forEach(s=>{!n&&s.attr===t&&(s.obj=e,s.showKey=r,s.showValue=i,n=!0)}),n||this.add(t,e,r,i)}getAttribute(t){for(let e of this.attributes)if(e.attr===t)return e;return null}restore(){this.attributes.clear()}};var j0e=class{constructor(){this.config={};this.COMMON_OPTION=["Grid Point","Extended Line"];this.LAYOUT_ROUTE_OPTION=["Footprint Center","Footprint Origin","Pad Center","Pad Vertices","Pad Edges","Via Center","Track Center"];this.OUTLINE_OPTION=["Endpoint","Midpoint","Intersection","Arc/Circle Center Point","Perpendicular Foot","Tangent Point","Region Center","Line Center"];this.config.Snapping="allLayers",this.config["Snap Distance"]={number:8,unit:"mil"};for(let t of this.COMMON_OPTION.concat(this.LAYOUT_ROUTE_OPTION,this.OUTLINE_OPTION))this.config[t]=!1}getConfig(t){return t?this.config[t]:JSON.parse(JSON.stringify(this.config))}setConfig(t){Fn(t,(e,r,i)=>{this.config[e]=r})}isNeedTrackObj(){return this.getConfig("Track Center")}isNeedViaObj(){return this.getConfig("Via Center")}isNeedPadObj(){return this.getConfig("Pad Center")||this.getConfig("Pad Vertices")||this.getConfig("Pad Edges")}isNeedOutlineObj(){for(let t of this.OUTLINE_OPTION)if(this.getConfig(t))return!0;return!1}isNeedComponentObj(){return this.getConfig("Footprint Center")||this.getConfig("Footprint Origin")||this.isNeedOutlineObj()}getNeedObjTypes(t){let e=[];return!t&&this.isNeedOutlineObj()&&e.push(mt,vt,nr,Sr,ct),this.isNeedPadObj()&&e.push(Le),this.isNeedViaObj()&&e.push(Ge),this.isNeedTrackObj()&&e.push(Ue),this.isNeedComponentObj()&&e.push(Me),e}getAdsorptionOutlines(){return this.OUTLINE_OPTION.filter(t=>this.config[t])}getSnapDistanceValue(){let{number:t,unit:e}=this.config["Snap Distance"];return new ft().conversion1(e,"mil",t)/10}};var X0e=class extends ZC{constructor(t,e,r,i){super(t,6),this._angleDelta=e,this._milStep=r,this._mmStep=i}get angleDelta(){return mh(this._angleDelta)}set angleDelta(t){this._angleDelta=t}get milStep(){return this._milStep}set milStep(t){this._milStep=t}get mmStep(){return this._mmStep}set mmStep(t){this._mmStep=t}getMenu(){return{name:`${Gm(this._angleDelta,1)}\xB0, ${Gm(this._mmStep*10,3)}mm | ${Gm(this._angleDelta,1)}\xB0, ${Gm(this._milStep*10,1)}mil`,cmd:`${this.id}`,tips:""}}getSizeAccordingToUnit(){let t=x.getInstance().unit;return t!=="mil"?new ft().conversion(t,"mil",this._mmStep):this._milStep}};var q0e=class{polarSetting(t){if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{angleDelta:e,milStep:r,isNeedUnitTranslate:i=!1,isNeedRadiansTranslate:n=!1}=t;n&&(e=mh(e)),i&&(r=new ft().conversion(x.getInstance().unit,"mil",r)),St.getInstance().angleDelta=e,St.getInstance().startAngle=we.startAngle,St.getInstance().endAngle=we.endAngle,St.getInstance().radius=r,St.getInstance().minRadius=we.minRadius,St.getInstance().maxRadius=we.maxRadius,A.publish("updateFrame",""),we.synchronize(),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),A.publish("flushSelectingInfo",""),Yh.type&&A.publish("FlushSketcherAttrView",{type:Yh.type})}gridSetting(t){if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let e=L9(),r,i,n,s,a,l=new ft,c=t.gridX.replace(/^[-+.\d\s]+/,""),h=t.gridX.replace(/[^-+.\d\s]+$/,"");n=l.conversion(c,"mil",parseFloat(h)/10);let u=t.gridY.replace(/^[-+.\d\s]+/,""),d=t.gridY.replace(/[^-+.\d\s]+$/,"");s=l.conversion(u,"mil",parseFloat(d)/10),t.visible!==void 0&&(r=t.visible),t.color&&(i=ee.of3(t.color)),t.style&&(a=t.style==="line"),St.getInstance().updateGridParam(r,n,s,a),(i=null)&&(St.getInstance().gridColor=i),!t.isTriggerBySnapSizeSetting&&ce.getAssociationPCBCanvasGridAndSnap()===1&&(St.getInstance().setSnapX(n/e.xRatio),St.getInstance().setSnapY(s/e.yRatio)),A.publish("flushSelectingInfo",""),Yh.type&&A.publish("FlushSketcherAttrView",{type:Yh.type}),A.publish("updateFrame",""),we.synchronize(),wp(),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}};var $0e=class extends ZC{constructor(t,e){super(t,3),this._family=e}get family(){return this._family}set family(t){this._family=t}getMenu(){return{name:this._family,cmd:`${this.id}`,tips:""}}};var qAe=class{updateLayerWithFootprint(){for(let t of DA.concat(FM)){let e=be.getLayer(t);if(e){let{type:r,name:i,order:n,activeColor:s,deactiveColor:a,active:l}=e;e&&be.modifyLayer(t,r,i,n,s,a,l,e.layerStatus)}}}updateLayerWithPCB(t,e,r=!1){let i=t[0].deactiveColorAlpha;for(let n=0;n<t.length;n++){let s=t[n],a=be.getLayer(+s.layerId);if(a){let{order:l,active:c}=a,h=a.type,u=a.name,d=e==="SYSTEMMGR_PCB_THEME"?h:s.layerType,p=e==="SYSTEMMGR_PCB_THEME"?u:s.layerName;be.modifyLayer(+s.layerId,d,p,l,ee.of5(s.activeColor,s.activeColorAlpha),ee.of5(s.deactiveColor,i),c,a.layerStatus),ED.deactiveAlpha=i,r&&Sp(+s.layerId)}}}},HN=new qAe;var b$e={prioritizeObjectSelection:"prioritizeObjectSelection",ADAPT_BOARDOUTLINE:"ADAPT_BOARDOUTLINE",ADDWITH_ROUTING:"ADDWITH_ROUTING",ADDWITH_TESTPOINTER:"ADDWITH_TESTPOINTER",ADDWITH_NODE:"ADDWITH_NODE",ADDWITH_ARC:"ADDWITH_ARC",ADDWITH_EQUALLENGTHTUNING:"ADDWITH_EQUALLENGTHTUNING",ADD_SOLDER_MASK:"ADD_SOLDER_MASK",ALIGNMENT:"ALIGNMENT",COMBINATION:"COMBINATION",COMBINATION_JOIN:"COMBINATION_JOIN",SECOND_COMBINATION:"SECOND_COMBINATION",COMBINATION_MOVE_OUT:"COMBINATION_MOVE_OUT",DISTRIBUTION:"DISTRIBUTION",FLIP:"FLIP",GRID:"GRID",SNAP_SIZE:"SNAP_SIZE",GRIDTYPE:"GRIDTYPE",LOCKED:"LOCKED",LOCKED_CANCEL:"LOCKED_CANCEL",OFFSET:"OFFSET",PACKAGE_EDIT_IN_PCB:"PACKAGE_EDIT_IN_PCB",PACKAGE_EDIT:"PACKAGE_EDIT",PACKAGE_REPLACE:"PACKAGE_REPLACE",RECOVER_FOOTPRINT:"RECOVER_FOOTPRINT",PACKAGE_ATTR:"PACKAGE_ATTR",UPDATE_COMPONENT:"UPDATE_COMPONENT",DEVICE_EDIT:"DEVICE_EDIT",SYMBOL_UPDATE:"SYMBOL_UPDATE",SYMBOL_EDIT:"SYMBOL_EDIT",SYMBOL_REPLACE:"SYMBOL_REPLACE",ALL:"ALL",PRIMITIV_COMPONENT:"PRIMITIV_COMPONENT",PRIMITIV_DEVICE_ATTR:"PRIMITIV_DEVICE_ATTR",PRIMITIV_PAD:"PRIMITIV_PAD",PRIMITIV_TRACK:"PRIMITIV_TRACK",PRIMITIV_PADPAIR:"PRIMITIV_PADPAIR",PRIMITIV_VIA:"PRIMITIV_VIA",PRIMITIV_SUTUREVIA:"PRIMITIV_SUTUREVIA",PRIMITIV_2DLINE:"PRIMITIV_2DLINE",PRIMITIV_ALL:"PRIMITIV_ALL",PRIMITIV_BOARD:"PRIMITIV_BOARD",PRIMITIV_SLOT:"PRIMITIV_SLOT",PRIMITIV_POUR:"PRIMITIV_POUR",Default:"Default","Only Component":"Only Component","Only Component Attribute":"Only Component Attribute","Only Track":"Only Track","Only Via":"Only Via","Only Pad Pair":"Only Pad Pair","Only Net":"Only Net","Only Group":"Only Group","Only Pad":"Only Pad","Only Line":"Only Line",PLACE_BURIEDHOLE:"PLACE_BURIEDHOLE",PAD_NUMBER:"PAD_NUMBER",ROTATE:"ROTATE",SETUP_WINDOWINGAREA:"SETUP_WINDOWINGAREA",STRETCHING_PUSHAWAY:"STRETCHING_PUSHAWAY",SINGlE_ROUTE:"SINGlE_ROUTE",CHANGETRACK:"CHANGETRACK",TURNOVER:"TURNOVER",GAP_STEP_VALUE:"GAP_STEP_VALUE",DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING:"DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING",VIA_SIZE:"VIA_SIZE",VIA_SIZE_FOLLOWRULES:"VIA_SIZE_FOLLOWRULES",VIA_SIZE_RULESSETTING:"VIA_SIZE_RULESSETTING",VIA_SIZE_COMMONLY_SETTING:"VIA_SIZE_COMMONLY_SETTING",VIA_TYPE:"VIA_TYPE",VIA_TYPE_THROUGH_VIA:"VIA_TYPE_THROUGH_VIA",VIA_TYPE_RULESSETTING:"VIA_TYPE_RULESSETTING",HIDE_SELECTED_COPPER_FILLS:"HIDE_SELECTED_COPPER_FILLS",SHOW_SELECTED_COPPER_FILLS:"SHOW_SELECTED_COPPER_FILLS",REBUILD_SELECTED:"REBUILD_SELECTED",COPPER_MANAGER:"COPPER_MANAGER",WIRING_AUTO:"WIRING_AUTO",WIRING_AUTO_CONNECT:"WIRING_AUTO_CONNECT",WIRING_AUTO_NET:"WIRING_AUTO_NET",WIRING_AUTO_ALL:"WIRING_AUTO_ALL",WIRING_CLEAR:"WIRING_CLEAR",WIRING_CLEAR_CONNECT:"WIRING_CLEAR_CONNECT",WIRING_CLEAR_NET:"WIRING_CLEAR_NET",WIRING_CLEAR_ALL:"WIRING_CLEAR_ALL",WIRING_CORNER_LINE45:"WIRING_CORNER_LINE45",WIRING_CORNER_LINE90:"WIRING_CORNER_LINE90",WIRING_CORNER_ARC90:"WIRING_CORNER_ARC90",WIRING_CORNER_ARC45:"WIRING_CORNER_ARC45",WIRING_CORNER_ARC:"WIRING_CORNER_ARC",WIRING_CORNER_FREEANGLE:"WIRING_CORNER_FREEANGLE",WIRING_MODE_PUSHAWAY:"WIRING_MODE_PUSHAWAY",WIRING_MODE_SURROUND_AND_PUSHAWAY:"WIRING_MODE_SURROUND_AND_PUSHAWAY",WIRING_MODE_SURROUND:"WIRING_MODE_SURROUND",WIRING_MODE_OBSTRUCT:"WIRING_MODE_OBSTRUCT",WIRING_MODE_IGNORE:"WIRING_MODE_IGNORE",WIRING_WIDTH:"WIRING_WIDTH",WIRING_WIDTH_FOLLOWRULES:"WIRING_WIDTH_FOLLOWRULES",WIRING_WIDTH_RULESSETTING:"WIRING_WIDTH_RULESSETTING",WIRING_WIDTH_COMMONLY_SSETTING:"WIRING_WIDTH_COMMONLY_SSETTING",WIDTH:"WIDTH",AUTO_TRIM_SILKSCREEN:"AUTO_TRIM_SILKSCREEN",MORE:"MORE",TABLE_SETTING:"TABLE_SETTING",ADSORBENT_CONFIG:"ADSORBENT_CONFIG",FILTER:"FILTER",DISPLAY:"DISPLAY",LOOKUP:"LOOKUP",SELECT_PARENT:"SELECT_PARENT",PLACETRANSFER:"PLACETRANSFER",RENUMBER:"RENUMBER",REFRESH:"REFRESH",SELECT:"SELECT",MOVE:"MOVE",MOVE_SEQUENTIAL:"MOVE_SEQUENTIAL",UNROUTE_ATTACHED_SEGMENTS:"UNROUTE_ATTACHED_SEGMENTS",UNROUTE_CONNECTIONS:"UNROUTE_CONNECTIONS",DETACHING_WIRES_FROM_DEVICES:"DETACHING_WIRES_FROM_DEVICES",UNROUTE_COMPONENT_CONNECTIONS:"UNROUTE_COMPONENT_CONNECTIONS",ATTRIBUTE:"ATTRIBUTE",NET:"NET",DEVICE:"DEVICE",SELECTED_ELEMENT:"SELECTED_ELEMENT",SELECTOVERLAP:"SELECTOVERLAP",CONNECT:"CONNECT",NET_COLOR:"NET_COLOR",INSERT_NODE:"INSERT_NODE",EDIT_BOUNDARY:"EDIT_BOUNDARY",GENERATE_D3_SHELL_OUTLINE:"GENERATE_D3_SHELL_OUTLINE",FORMAT_BRUSH:"FORMAT_BRUSH",DIVISION:"DIVISION",REPLACE_LAYER:"REPLACE_LAYER",REMOVE_LOOP:"REMOVE_LOOP",SELECT_NET:"SELECT_NET",ADD_NODE:"ADD_NODE",EDIT_NODE:"EDIT_NODE",MOVE_NODE:"MOVE_NODE",DELETE_NODE:"DELETE_NODE",COMMENT:"COMMENT",EXPAND:"EXPAND",MERGE_AS_CLOSED_OBJECT:"MERGE_AS_CLOSED_OBJECT",DISPERSED_AS_INDEPENDENT_LIEN:"DISPERSED_AS_INDEPENDENT_LIEN",MERGE_PADS:"MERGE_PADS",ONLY_SELECT:"ONLY_SELECT",CURRENT_PCB:"CURRENT_PCB",ALL_PROJECT:"ALL_PROJECT",OPTIMIZA_NONE:"OPTIMIZA_NONE",OPTIMIZA_WEAK:"OPTIMIZA_WEAK",OPTIMIZA_STRONG:"OPTIMIZA_STRONG",OPTIMIZATION:"OPTIMIZATION","opensubmenu-convertTo":"CONVERT_TO","opensubmenu-boardshape":"opensubmenu-boardshape",convertToBoard:"convertToBoard",convertToLineFromBoard:"convertToLineFromBoard"};var K0e=class{constructor(){this.gridSetting=new q0e;this.zoomType="roller";this.showUpdateBox=!1;this.dragMiddleMouseButton="moveCanvas";this.symbolLibManageMode="1";this.isPlaceViasAutoShove=!1;this.changeRepairLineTool=!0;this.init=!1;this.gridConfig=[],this.polarConfig=[],this.trackConfig=[],this.viaConfig=[],this.fontConfig=new V0e(3),this.pcbConfig=new W0e,this.themeConfig=new z0e,this.attributeConfig=new Y0e,this.adsorptionConfig=new j0e,this.hightShowConfig=new Vue,this.isAssociationPCBCanvasGridAndSnap=0,this.isAssociationPCBCanvasGridType=0,A.subscribe("updateSystemConfig",this.updatePreferences.bind(this),$()),A.subscribe("updateSystemConfig2",this.updatePreferences2.bind(this),$()),A.subscribe("updateAssociationPCBCanvasGridAndSnap",this.setAssociationPCBCanvasGridAndSnap.bind(this),$()),A.subscribe("updateAssociationPCBCanvasGridType",this.setAssociationPCBCanvasGridType.bind(this),$()),A.subscribe("GridSetting",this.gridSetting.gridSetting.bind(this),$()),A.subscribe("SnapSizeSetting",this.snapSizeSetting.bind(this),$()),A.subscribe("PolarGridSetting",this.gridSetting.polarSetting.bind(this),$()),A.subscribe("updatePcbLayerByTheme",this.updatePcbLayerByTheme.bind(this),$()),A.subscribe("changeRepairLineTool",()=>{this.changeRepairLineTool=!1},$())}getData(t,e){return t[e]!=null&&t[e].commonlyList!=null?t[e].commonlyList:null}updatePreferences(t){let e;x.getInstance().isactive&&!x.getInstance().isPreview&&(e=Q6()),this.updateSystemConfig(t.commSystemSetting,x.getInstance().isPreview),e&&this.uploadPreference(e,Q6()),A.publish("flushSelectingInfo","")}uploadPreference(t,e){let r=!1;for(let i in t)if(t[i]!=e[i]){r=!0;break}r&&Hi()}updatePreferences2(t){let{tabId:e,data:r}=t;x.getInstance().id===e&&(this.updateSystemConfig(r.commSystemSetting,x.getInstance().isPreview),A.publish("flushSelectingInfo",""))}snapSizeSetting(t){let e=L9(),r=new ft,i=t.snapX.replace(/^[-+.\d\s]+/,""),n=t.snapX.replace(/[^-+.\d\s]+$/,""),s=r.conversion(i,"mil",parseFloat(n)/10),a=t.snapY.replace(/^[-+.\d\s]+/,""),l=t.snapY.replace(/[^-+.\d\s]+$/,""),c=r.conversion(a,"mil",parseFloat(l)/10);St.getInstance().setSnapX(s),St.getInstance().setSnapY(c),!t.isTriggerByGridSizeSetting&&ce.getAssociationPCBCanvasGridAndSnap()===1&&(St.getInstance().setGridX(s*e.xRatio),St.getInstance().setGridY(c*e.yRatio)),wp(),A.publish("flushSelectingInfo","")}getAssociationPCBCanvasGridAndSnap(){return this.isAssociationPCBCanvasGridAndSnap}setAssociationPCBCanvasGridAndSnap(t){this.isAssociationPCBCanvasGridAndSnap=t}getAssociationPCBCanvasGridType(){return this.isAssociationPCBCanvasGridType}setAssociationPCBCanvasGridType(t){this.isAssociationPCBCanvasGridType=t}updateHotkeyForSilkPreview(){let t={Edit:[{cmdEditDisable:!0,funcE:"Delete - Selected",hotkey:"Delete",hotkeyCmd:"Delete",range:[10,2,3,6,4,5],scene:[2]}]};this.updateHotkey(t,{})}updateSystemConfig(t,e){if(t){if(this.getData(t,"PCB_COMM_GRID_SIZE")&&!e){let r=this.getData(t,"PCB_COMM_GRID_SIZE");this.updateGridConfig(r.value),this.updatePolarConfig(r.value2Polar)}if(this.getData(t,"PCB_COMM_TRACK_WIDTH")&&!e&&this.updateTrackConfig(this.getData(t,"PCB_COMM_TRACK_WIDTH")),this.getData(t,"PCB_COMM_VIA_SIZE")&&!e&&this.updateViaConfig(this.getData(t,"PCB_COMM_VIA_SIZE")),this.getData(t,"COMM_TYPEFACE")&&!e&&this.updateFontConfig(this.getData(t,"COMM_TYPEFACE")),t.PCB_FOOTPRINT!=null&&this.updatePcbConfig(t.PCB_FOOTPRINT,e),t.PCB_SHOW&&!e&&this.updateShowConfig(t.PCB_SHOW),t.PCB_THEME&&zBe(t.PCB_THEME)&&this.updateTheme(t.PCB_THEME),t.PCB_SHOW&&this.updateSelectAlpha(t.PCB_SHOW.selectAlpha),t.SYSTEM!=null&&(this.zoomType=t.SYSTEM.canvasZoomType,this.showUpdateBox=t.SYSTEM.isShowSymbol,this.dragMiddleMouseButton=t.SYSTEM.dragMiddleMouseButton,this.symbolLibManageMode=tXe(t.SYSTEM.symbolLibManage),this.systemAutoPanning=t.SYSTEM.autoPanning||null),t.HOTKEY!=null){let r=t.HOTKEY.menuHotkey||{},i=Ls(t.HOTKEY.menuHotkeyCfg)||{};Fn(r,(s,a)=>{i[s]&&Fn(["hotkey"],(c,h)=>{i[s][h]=a[h]})});let n=t.HOTKEY.active;typeof n=="string"&&n!=="custom"&&t.HOTKEY.hotkeyCfg[n]?this.updateHotkey(t.HOTKEY.hotkeyCfg[n],i):this.updateHotkey(t.HOTKEY.hotkey,i)}t.PROPERTY!=null&&!e&&this.updateProperty(t.PROPERTY.property),t.ADSORPTION!=null&&!e&&this.updateAdsorption(t.ADSORPTION),A.publish("updateFrame","")}}updatePcbLayerByThemeCall(t){this.updatePcbLayerByTheme(t)}updatePcbLayerByTheme(t){if(!x.getInstance().isactive||x.getInstance().isPreview)return;let e=t!=null&&t.canvasColorTheme?t.canvasColorTheme:this.themeConfig.canvasLayerTheme,r=t!=null&&t.canvasColorThemeSelected?t.canvasColorThemeSelected:this.themeConfig.canvasLayerThemeSelected,i;if(t.applyTheme){let n=[];for(let s of t.applyTheme){let a=be.getLayer(+s.layerId),l={layerId:a.layerID,layerType:a.type,layerName:a.name,status:a.status,activeColor:s.activeColor,activeColorAlpha:s.activeColorAlpha,deactiveColor:s.deactiveColor,deactiveColorAlpha:s.deactiveColorAlpha};n.push(l)}i=[{name:t.canvasColorThemeSelected,list:n}]}else i=e==null?void 0:e.filter((n,s)=>n.name==r);Array.isArray(i)&&i.length>0&&(HN.updateLayerWithPCB(i[0].list,"SYSTEMMGR_PCB_THEME",!0),BC(!0),Ys.getInstance().refreshRender(),A.publish("updateFrame",""),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()))}updateAdsorption(t){let e=t["Snapping Key"],r=t["Snap Distance Key"];this.adsorptionConfig.setConfig({[e.id]:e.options.value}),this.adsorptionConfig.setConfig({[r.id]:{number:r.options.value,unit:r.options.unit}});let i=t.Common.options,n=t["Layout/Route"].options,s=t["Outline Object"].options;for(let a of i.concat(n,s)){let{id:l,checked:c}=a;this.adsorptionConfig.setConfig({[l]:c})}}updateProperty(t){if(this.attributeConfig.restore(),t!=null&&t!=""){let e=JSON.parse(t);Object.values(e).forEach(r=>{if(r!=null){let i=!1,n=!1,s=r.showStatus;s!=null&&s.split(",").forEach(l=>{l==="All"?(i=!0,n=!0):l==="PCB(Name)"?i=!0:l==="PCB(Value)"?n=!0:l==="PCB(Name|Value)"&&(i=!0,n=!0)}),this.attributeConfig.add(r.property,r.object,i,n)}})}}updateHotkey(t,e){if(t==null)return;let r={},i={};Fn(e,(n,s)=>{if(s.hotkeyCmd){i[s.hotkeyCmd]={value:s,menuHotkeyCmd:n};return}let a=b$e[n];a&&(r[a]={value:s,menuHotkeyCmd:n})}),sr.restore(),$$.restore(),r6.restore();for(let n in t)t[n].forEach(a=>{let l=a.hotkeyCmd,c=this.fixCtrl(a.hotkey),h=Xde(l),u=a.publishName,d="",p="";if(i[l]&&(d=i[l].value.hotkey||"",p=i[l].menuHotkeyCmd),h!=null){let m=a.range,g=a.scene;for(let y of g)for(let b of m)u?$$.modify(y,b,c,h,l,d,p):sr.modify(y,b,c,h,l,d,p)}else{let m=a.command;if(m!=null){let g=a.hotkeyCmd,y=m.split("&lt;")[0];P$e.modify(g,y)}}});Fn(r,(n,s)=>{r6.addSubMenu(n,s.value.hotkey,s.menuHotkeyCmd)})}fixCtrl(t){return typeof t=="string"&&(r2?t=t.replace(/Ctrl/g,"Cmd"):(t=t.replace(/Control/g,"Ctrl"),t=t.replace(/Cmd/g,"Ctrl"),t=t.replace(/Control\+Cmd|Cmd\+Control/g,"Ctrl"))),t}updatePcbConfig(t,e){if(t!=null){if(e){this.pcbConfig.coreRenderingEngine=t.coreRenderingEngine;return}(this.pcbConfig.configGridType!=t.gridType||this.pcbConfig.configMultiGridType!=t.multiType||this.pcbConfig.configMultiRatio!=t.multiRatio)&&(this.pcbConfig.configGridType=t.gridType,this.pcbConfig.gridType=t.gridType,this.pcbConfig.configMultiGridType=t.multiType,this.pcbConfig.multiType=t.multiType,this.pcbConfig.configMultiRatio=t.multiRatio,this.pcbConfig.multiRatio=t.multiRatio,x.getInstance().isactive&&A.publish("switchGridTypeBtn",t.gridType,$())),this.pcbConfig.crossCursor=t.cursorSize,this.pcbConfig.drcErrorStyle=t.drcErrorStyle||"1",this.pcbConfig.displayComponentSpacing=t.displayComponentSpacing,this.pcbConfig.drcErrorZoom=t.drcErrorZoom||"followObjectScaling",this.pcbConfig.graphicEffectMode=t.graphicEffectMode,this.pcbConfig.coreRenderingEngine=t.coreRenderingEngine,this.pcbConfig.UNIT=t.newDocUint,this.pcbConfig.FOOTPRINT_UNIT=t.newFootprintDocUint,this.pcbConfig.altGridSize=t.altGridSize,this.pcbConfig.rotate=t.rotateSteppingAngle,this.pcbConfig.clickTrackSelect=t.clickTrackSelect,this.pcbConfig.showRuler=t.isShowRuler,this.pcbConfig.isRebuildCopperAuto=t.isRebuildCopperAuto,this.pcbConfig.allowFootprintFlipping=t.allowFootprintFlipping,this.pcbConfig.padShowNet=t.isShowNetInPad,this.pcbConfig.padShowNum=t.isShowNumberInPad,this.pcbConfig.trackShowNet=t.isShowNetInTrack,this.pcbConfig.viaShowLayerPair=t.isShowViaLayerPair,this.pcbConfig.viaShowNet=t.isShowNetInVia,this.pcbConfig.showDiffLength=t.isShowDiffLength,this.pcbConfig.showNetLength=t.isShowNetLength,this.pcbConfig.placeBlind=t.isPriorityViaToggleLayerRouting,this.pcbConfig.autoLoopUpMsgBox=t.selectLoopWindowRemovingLoop,this.pcbConfig.trackFollowComponent=t.isAutoFollowComponent,this.pcbConfig.rotateWhole=t.rotateWhole,this.pcbConfig.moveComponent=t.moveComponet,this.pcbConfig.autoChamfer2DLine=t.autoChamfer2DLine,this.pcbConfig.autoChamferTrack=t.autoChamferTrack,this.setFilletRadius(t),this.init||(this.pcbConfig.startTrackWidth=t.startTrackWidth,this.pcbConfig.startViaSize=t.startViaSize,this.init=!0),this.pcbConfig.showCrossCursor=t.isAlwaysShowCrossCursor,this.pcbConfig.checkNetBeforeGerber=t.isCheckNetBeforeGerber,this.pcbConfig.checkDrcBeforeGerber=t.isCheckDrcBeforeGerber,this.pcbConfig.trackFollow=t.trackFollow,this.pcbConfig.trackFollowVia=t.trackFollowVia,this.pcbConfig.autoTerminateRouting=t.autoTerminateRouting,this.pcbConfig.isUsedJLCColorSilk=t.isUsedJLCColorSilk,this.pcbConfig.isAutoGenerate3dModel=t.isAutoGenerate3dModel,this.pcbConfig.isPlaceViasAutoShove=t.isPlaceViasAutoShove,this.pcbConfig.isAutoMoveCanvasDuringCrossProbe=t.isAutoMoveCanvasDuringCrossProbe,this.pcbConfig.isAutoFitSelectionDuringCrossProbe=t.isAutoFitSelectionDuringCrossProbe,this.pcbConfig.isOtherObjectsDimDuringCrossProbe=t.isOtherObjectsDimDuringCrossProbe,this.pcbConfig.isCtrlDragToCopy=t.isCtrlDragToCopy,this.pcbConfig.snapToCenterWhileDragPadOrVia=t.snapToCenterWhileDragPadOrVia,this.pcbConfig.snapToOriginWhileDragFootprint=t.snapToOriginWhileDragFootprint,this.pcbConfig.alignToNearComponentOrPadWhileDrag=t.alignToNearComponentOrPadWhileDrag,this.pcbConfig.isAssignNetForFreeTrack=t.isAssignNetForFreeTrack,this.pcbConfig.addTeardropAutomatically=t.addTeardropAutomatically,this.pcbConfig.isKeepRefdesPaste=t.isKeepRefdesPaste,this.pcbConfig.useDynamicInputBox=t.useDynamicInputBox,this.pcbConfig.displayProperty=t.displayObjectPropertyHoverObject,this.pcbConfig.highLightNet=t.highlightNetHoverNet,this.pcbConfig.highLight=t.highlightObjectHoverObject,this.pcbConfig.autoChangeLayerWhileRoutingVias=t.autoChangeLayerWhileRoutingVias,this.pcbConfig.dblclickPlaceViasWhileRouting=t.dblclickPlaceViasWhileRouting,this.pcbConfig.routeAutoFanoutEnd=t.routeAutoFanoutEnd,this.pcbConfig.wireConfirm=t.trackConfirm,this.pcbConfig.endDrawing=t.endDrawing,this.pcbConfig.addViaMethodWhileRoute=t.addViaMethodWhileRoute,this.pcbConfig.referencePointPcbSelectMethod=t.referencePointPcbSelectMethod,this.pcbConfig.defaultComponentFontTypeface=t.defaultComponentFontTypeface,this.setDefaultComponentFontStrokeWidthUnit(t),this.setDefaultComponentFontHeightUnit(t),this.pcbConfig.isInit=!1}}updateTheme(t){if(t==null)return;let e=t.canvasPrimitiveSetting;this.themeConfig.canvasTheme.updateAll(e),this.themeConfig.canvasLayerTheme=t.canvasColorTheme,this.themeConfig.canvasLayerThemeSelected=t.canvasColorThemeSelected}updateSelectAlpha(t){this.themeConfig.canvasTheme.updateSelectAlpha(t)}updateGridConfig(t){t!=null&&(this.gridConfig=t.map((e,r)=>this.getGridSize(r.toString(),e.accuracyGridXMil,e.accuracyGridXMm,e.accuracyGridYMil,e.accuracyGridYMm)))}updatePolarConfig(t){t!=null&&(this.polarConfig=t.map((e,r)=>this.getPolarSize(r.toString(),e.angle,e.mil,e.mm)))}updateTrackConfig(t){t!=null&&(this.trackConfig=t.map((e,r)=>this.getTrackSize(r.toString(),e.trackWidthMil,e.trackWidthMm)))}updateFontConfig(t){if(t==null)return;let e=t.map((r,i)=>this.getFontSize(i.toString(),r.title));this.fontConfig.clear();for(let r of e)this.fontConfig.addSize(r)}updateShowConfig(t){t!=null&&(this.hightShowConfig.hightType=t.hightType,this.hightShowConfig.dragDarked=t.dragDarked,this.hightShowConfig.tempHight=t.tempHight,A.publish("updateHightShow",""))}updateViaConfig(t){t!=null&&(this.viaConfig=t.map((e,r)=>this.getViaSize(r.toString(),e.insideDiameterMil,e.insideDiameterMm,e.outersideDiameterMil,e.outersideDiameterMm)))}getGridSize(t,e,r,i,n){return new G0e(t,e/10,i/10,r/10,n/10)}getPolarSize(t,e,r,i){return new X0e(t,e,r/10,i/10)}getTrackSize(t,e,r){return new U0e(t,e/10,r/10)}getViaSize(t,e,r,i,n){return new H0e(t,e/20,r/20,i/20,n/20)}getFontSize(t,e){return new $0e(t,e)}getDragMiddleMouseButton(){return this.dragMiddleMouseButton}getSymbolLibManageMode(){return this.symbolLibManageMode}getDefaultFontSetting(){return{defaultComponentFontHeight:this.pcbConfig.defaultComponentFontHeight,defaultComponentFontStrokeWidth:this.pcbConfig.defaultComponentFontStrokeWidth,defaultComponentFontTypeface:this.pcbConfig.defaultComponentFontTypeface}}setDefaultComponentFontStrokeWidthUnit(t){let e=new ft,r=t.defaultComponentFontStrokeWidthUnit,i=+t.defaultComponentFontStrokeWidth;r!=="mil"&&(i=e.conversion("mm","mil",i)),this.pcbConfig.defaultComponentFontStrokeWidth=i/10}setDefaultComponentFontHeightUnit(t){let e=new ft,r=t.defaultComponentFontHeightUnit,i=+t.defaultComponentFontHeight;r!=="mil"&&(i=e.conversion("mm","mil",i)),this.pcbConfig.defaultComponentFontHeight=i/10}setFilletRadius(t){let e=new ft,r=t.filletRadiusUnit2DLine,i=+t.filletRadius2DLine;r!=="mil"&&(i=e.conversion("mm","mil",i)),this.pcbConfig.filletRadius2DLine=i/10;let n=t.filletRadiusUnitTrack,s=+t.filletRadiusTrack;n!=="mil"&&(s=e.conversion("mm","mil",s)),this.pcbConfig.filletRadiusTrack=s/10}getSystemAutoPanning(){return this.systemAutoPanning}};var Z0e=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return e.action="absolute-offset",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(t.action=="confirm"){let r=Ve.getSelects();if(r.length==0)return;let i=x.getInstance().unit,n=new S(Bs(t.offsetXY.offsetX,i,"pixel"),Bs(t.offsetXY.offsetY,i,"pixel"));ls.getInstance().init(r,"relative offset",(s,a)=>{tp.init(s,a,async(l,c)=>{if(new l1(c,{movePadItSelf:!tp.moveWhole,saveHistory:!1}).execute(l,n),!tp.moveWhole){let u=new Set;l.forEach(p=>{if(p instanceof Le){let m=p.getParent();m instanceof Me&&u.add(m)}});let d=new Array;for(let p of u){c.addCommand4Item(p,"modify");let g=new $f().updateCustomFootprint(p,c.getCommand(),l.filter(y=>y.getParent()==p));d.push(g)}await Promise.all(d)}c.execute(),setTimeout(()=>{A.publish("selecting",{items:l}),A.publish("flushService","")},0),Pr.refresh()})})}return!0}};function Fwt(o){switch(o){case"top":return 4;case"bottom":return 6;case"left":return 2;case"right":return 8;case"center":return 5;case"lefttop":return 1;case"leftbottom":return 3;case"righttop":return 7;case"rightbottom":return 9;default:return 3}}var QU=class extends fi{constructor(e){super();this.components=new Array;this.components=e,Ve.arrtDialog=this}open(e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r=new Array,i=new Array,n=new Set,s=new Set,a=[],l=new Set(Array.from(Ve.getSelects()));for(let u of this.components){u.numShape!=null&&(u.numShape.showKey||u.numShape.showValue)&&(n.add(u.numShape.key),l.has(u)&&s.add(u.numShape.key)),u.idShape!=null&&(u.idShape.showKey||u.idShape.showValue)&&(n.add(u.idShape.key),l.has(u)&&s.add(u.idShape.key)),u.deviceShape!=null&&(u.deviceShape.showKey||u.deviceShape.showValue)&&(n.add(u.deviceShape.key),l.has(u)&&s.add(u.deviceShape.key));for(let d of u.attributes)(d.showKey||d.showValue)&&(n.add(d.key),l.has(u)&&s.add(d.key));l.has(u)&&u.attrsObject&&a.push(this.getDesignatorRelativePostion(u,u.attrsObject.Designator))}for(let u of n)r.push({title:u,value:u,_selected:!0});for(let u of s)i.push({title:u,value:u,_selected:!0});let c=Array.from(new Set(a));return{action:"set-attr-text-position",allItemsAttrList:r,selectedItemsAttrList:i,extra:{designatorRelativePostion:c[0]}}}modify(e){let r=e.radio;r==="allItems"?this.components=Cr.getAllItem():r==="selectedItems"&&(this.components=Ve.getComponents()),e.action=="apply"&&this.comment(e)}comment(e){let r={};for(let c of this.components)for(let h of c.attributes)if(h.showKey||h.showValue){let u=r[h.key];u==null&&(u=new Array,r[h.key]=u),u.push(h)}let i=e["property-value"],n=e["text-position"],s=Fwt(n),a=r[i],l=new ve("batch modify attribute position");if(a!=null)for(let c of a){l.addCommand(Te.dispatch(c,"modify"));let h=c.getParent();h instanceof Me&&h.modifyAttrPosition(c,s)}l.length>0&&je.executeCommand(l)}close(e){return!x.getInstance().isactive||23==x.getInstance().doctype?void 0:(e.action=="confirm"&&(this.modify(e),this.comment(e),this.components=new Array,A.publish("updateFrame",""),A.publish("updateRtree",""),Ve.arrtDialog=null),!0)}update(){let e=Ve.getSelects(),r=e.length>0,i=new Set,n=new Set,s=[],a=new Set(e);for(let h of this.components){h.numShape!=null&&(h.numShape.showKey||h.numShape.showValue)&&(i.add(h.numShape.key),a.has(h)&&n.add(h.numShape.key)),h.idShape!=null&&(h.idShape.showKey||h.idShape.showValue)&&(i.add(h.idShape.key),a.has(h)&&n.add(h.idShape.key)),h.deviceShape!=null&&(h.deviceShape.showKey||h.deviceShape.showValue)&&(i.add(h.deviceShape.key),a.has(h)&&n.add(h.deviceShape.key));for(let u of h.attributes)(u.showKey||u.showValue)&&(i.add(u.key),a.has(h)&&n.add(u.key));a.has(h)&&h.attrsObject&&s.push(this.getDesignatorRelativePostion(h,h.attrsObject.Designator))}let l=Array.from(i).map(h=>({title:h,value:h,_selected:!0})),c=Array.from(n).map(h=>({title:h,value:h,_selected:!0}));A.publish("pcbAttrUpdate",{action:"set-attr-text-position",hasSelection:r,selectionCount:e.length,allItemsAttrList:l,selectedItemsAttrList:c,extra:{designatorRelativePostion:s[0]||"center"}},j0())}getDesignatorRelativePostion(e,r){if(!r)return"center";let i=on(e.model.bbox.minX,4),n=on(e.model.bbox.minY,4),s=on(e.model.bbox.maxX,4),a=on(e.model.bbox.maxY,4),l=on(r.model.box.center.x,4),c=on(r.model.box.center.y,4);if(l>=i&&l<=s)return c>a?"top":c<n?"bottom":"center";if(l>s)return c>a?"righttop":c<n?"rightbottom":"right";if(l<i)return c>a?"lefttop":c<n?"leftbottom":"left"}};var J0e=class J0e{constructor(){this.dialogIds=new Set;A.subscribe("refershDialog",()=>{for(let t of this.dialogIds)A.publish("pcbdialogModify",{dialogId:t})})}static getService(){return this.instance==null&&(this.instance=new J0e),this.instance}};J0e.instance=null;var Kw=J0e;var Q0e=class extends fi{constructor(t){super(),this.dialogType="pcb-copper-manager"}open(t){if(!x.getInstance().isactive||x.getInstance().doctype!=3)return;Kw.getService().dialogIds.add(this.id);let e=be.getSignalLayerOptions(!1);return{action:"copper-manager",table:this.getLayerList(),netList:ze.getNet(),layerList:e}}modify(t){var e;if(!(!x.getInstance().isactive||x.getInstance().doctype!=3))switch(t.action){case"apply":this.syncCopperOrderData(t);break;case"refreshCopperMangerDialog":A.publish("refreshCopperMangerDialog",{action:this.dialogType,data:t.data},$());break;case"modifyCopperMangerDialogParams":if(((e=t==null?void 0:t.data)==null?void 0:e.length)>0)A.publish("modifyCopperMangerDialogParams",{action:"modify",data:t.data},$());else{let r=be.getSignalLayerOptions(!1),i={table:this.getLayerList(),netList:ze.getNet(),layerList:r};A.publish("modifyCopperMangerDialogParams",{action:this.dialogType,data:i},$())}break;case"saveAndCloseCopperDialog":A.publish("saveAndCloseCopperDialog",{action:this.dialogType,data:{open:!0}},$());break}}close(t){return!x.getInstance().isactive||x.getInstance().doctype!=3?void 0:(Kw.getService().dialogIds.delete(this.id),t.action=="confirm"&&this.syncCopperOrderData(t),!0)}command(t){if(!x.getInstance().isactive||x.getInstance().doctype!=3)return!1;if(t.action=="callDesignRulesDialog"){let e={activeMenu:"Copper Zone"};if(t.data){let r,i=n=>{if(n.type=="Copper Region"&&t.data==n.globalIndex){let s=te.getInstance().getRegion(n.globalIndex),a=s&&s.copperPlane?"2":"1";r=this.getCopperRule(a,n.net,n.globalIndex).name}};this.curryFun(i)(),r&&(e.activeMenu="Safe Spacing",e.activeMenuName=r)}A.publish("openMainDialog",{cmd:5,data:{option:e}})}else if(t.action=="highLightSelectPour"){let e=[],r=i=>{i.type=="Copper Region"&&t.data.includes(i.globalIndex)&&e.push(i)};this.curryFun(r)(),A.publish("onlySelect",e),A.publish("updateFrame","")}else if(t.action=="highLightPour"){let e=r=>{r.type=="Copper Region"&&r.globalIndex==t.data&&!r.isHighLight&&r.click(!0)};this.curryFun(e)(),A.publish("updateFrame","")}else if(t.action=="unHighLightPour"){let e=Ve.getSelects().map(i=>i.globalIndex),r=i=>{i.type=="Copper Region"&&!e.includes(i.globalIndex)&&i.visible()};this.curryFun(r)(),A.publish("updateFrame","")}else if(t.action=="refreshPanelData"){let{id:e,value:r,type:i}=t.data,n=new ve("Modify Panel"),s=new mi;s.addGroup(n);let a=h=>{if(h.type=="Copper Region"&&h.globalIndex==e)switch(i){case"name":s.addCommand4Item(h,"modify"),h.getComponent().name=r;break;case"layer":s.addCommand4Item(h,"modify");let u=h.layerId;h.layerId=r,gn.changeModelLayer(h,u,s.getCommand()),h.clearCopper();break;case"net":s.addCommand4Item(h,"modify"),h.net=r;break}};this.curryFun(a)(),s.execute(),A.publish("updateFrame",""),A.publish("flushSelectingInfo","");let l=be.getSignalLayerOptions(!1),c={table:this.getLayerList(),netList:ze.getNet(),layerList:l};A.publish("modifyCopperMangerDialogParams",{action:this.dialogType,data:c},$())}else t.action=="deletedRow"?t.data.forEach(r=>{let i=r.id,s=new er().getItem(i);s!=null&&(s.remove(),A.publish("delete",s),A.publish("updateFrame",""))}):t.action=="rebuildSelected"?A.publish("rebuildSingleCopper",{ids:t.data,isLast:!1,isManual:!0}):t.action=="rebuildAll"&&(A.publish("rebuildCopper",{isManual:!0}),A.publish("rebuildPlane",{data:{id:[]},isManual:!0}));return!1}curryFun(t){return()=>{[].concat(Zt.getAllItem(),Xt.getAllItem(),pt.getAllItem()).forEach(e=>{t(e)})}}flatTableData(t){let e=[];return t.forEach(r=>r.forEach(i=>{i.layerName||(i.layer,e.push(i))})),e}syncCopperOrderData(t){let e=new ve("modify copper property"),r=new er,i=this.flatTableData(Object.values(t.table));this.syncActualPourData(i,e);let n={};if(this.checkName(i)){i.forEach(s=>{let a=s.id,l=r.getItem(a);if(l instanceof Ye){let c=l.getComponent();if(c instanceof Vn){let h=n[l.layerId];h||(h=n[l.layerId]=[]),h.push(l),c.name=s.name,l.net=s.net,l.layerId=parseInt(s.layer)}}});for(let s in n){let a=n[s],l=a[0].getComponent().order-1;for(let c of a){let h=c.getComponent();h.order>l||(e.addCommand(Te.dispatch(c,"modify")),h.order=l+1),l=h.order}}return je.executeCommand(e),A.publish("autoFill",""),!0}else return!1}checkName(t){let e=new Set;for(let r of t){if(r.name){if(e.has(r.name)){let i="The name already exists, please modify";return A.publish("openMsgbox",new w9(i)),!1}}else{let i="The name cannot be empty, please modify";return A.publish("openMsgbox",new w9(i)),!1}e.add(r.name)}return!0}syncActualPourData(t,e){let r=[].concat(Zt.getAllItem(),Xt.getAllItem(),pt.getAllItem()),i=t.map(s=>s.id),n=!1;r.forEach(s=>{if(s.type=="Copper Region"&&!i.includes(s.globalIndex)){n=!0;let a=Te.dispatch(s,"delete");A.publish("hasModifyPcbItem",s),e.addCommand(a),Pr.interrupt(),Pr.model=3,s.remove(),A.publish("delete",s)}})}getLayerList(){let t=gn.getOrders(),e=new er,r={},i=[];for(let s in t)i.push(...t[s].map(a=>a.globalIndex));if(be.getSignalLayerOptions(!1).forEach(s=>{let a=s.text;r[a]||(r[a]=[{layerName:a,id:"F"+a,FlayerId:Number(s.value),fixed:!0}])}),i.forEach(s=>{let a=e.getItem(s);if(a!=null&&a instanceof Ye){let l=a.getComponent();if(l instanceof Vn){let c=be.getLayerName(a.layerId);r[c].push({name:l.name,layer:a.layerId,net:a.net,id:s,parentName:c,lcEnableDragSort:!0})}}}),r["Bottom Layer"]){let s=r["Bottom Layer"];delete r["Bottom Layer"],r["Bottom Layer"]=s}return r}getCopperRule(t,e,r){let i=te.getInstance(),n;switch(t){case"1":{let s=i.getNet(e);n=i.getSafeSpacing(s==null?void 0:s.safeSpacing);break}case"2":{let s=i.getRegion(r);s!=null&&(n=i.getSafeSpacing(s.safeClearance));break}}return n||(n=i.getDefaultSafeSpacing()),n}};var efe=class extends fi{constructor(){super(...arguments);this.pcbList=[{title:"Track",value:"track",_isChecked:!1},{title:"Via",value:"via",_isChecked:!1},{title:"Suture Vias",value:"suture via",_isChecked:!1},{title:"Text",value:"text",_isChecked:!1},{title:"Device",value:"device",_isChecked:!1,disabled:Bt.isChildPcb()},{title:"Device Attribute",value:"attr",_isChecked:!1},{title:"Test Point",value:"testPoint",_isChecked:!1},{title:"FPC Stiffener",value:"fpcStiffener",_isChecked:!1},{title:"Pad",value:"pad",_isChecked:!1},{title:"Board Outline",value:"boardOutline",_isChecked:!1},{title:"Slot Region",value:"boardCutout",_isChecked:!1},{title:"Fill Region",value:"region",_isChecked:!1},{title:"Prohibited Region",value:"prohibit",_isChecked:!1},{title:"Constraint Region",value:"constraint",_isChecked:!1},{title:"Pour",value:"pour",_isChecked:!1},{title:"Line",value:"line",_isChecked:!1},{title:"Image",value:"image",_isChecked:!1},{title:"Colorful Image",value:"trueColorPicture",_isChecked:!1},{title:"Dimension",value:"dimension",_isChecked:!1},{title:"3D Shell - Outline",value:"3dShellOutline",_isChecked:!1},{title:"3D Shell - Screw Pillar",value:"3dShellScrewPillar",_isChecked:!1},{title:"3D Shell - Side Datum Line",value:"3dShellSideSlotDatumLine",_isChecked:!1},{title:"3D Shell - Side Slot Region",value:"3dShellSideSlotRegion",_isChecked:!1},{title:"3D Shell - Top/Bottom Slot Region",value:"3dShellTopSlotRegion",_isChecked:!1},{title:"3D Shell - Top/Bottom Entity",value:"3dShellTopBottomEntity",_isChecked:!1},{title:"3D Shell - Side Entity",value:"3dShellSlotEntity",_isChecked:!1},{title:"Teardrop",value:"teardrop",_isChecked:!1}];this.footprintList=[{title:"Text",value:"text",_isChecked:!1},{title:"Pad",value:"pad",_isChecked:!1},{title:"Via",value:"via",_isChecked:!1},{title:"Slot Region",value:"boardCutout",_isChecked:!1},{title:"Fill Region",value:"region",_isChecked:!1},{title:"Prohibited Region",value:"prohibit",_isChecked:!1},{title:"Line",value:"line",_isChecked:!1},{title:"Image",value:"image",_isChecked:!1},{title:"Dimension",value:"dimension",_isChecked:!1},{title:"Test Point",value:"testPoint",_isChecked:!1},{title:"FPC Stiffener",value:"fpcStiffener",_isChecked:!1}]}open(e){if(x.getInstance().doctype==3)return{action:"delete-target",list:this.pcbList};if(x.getInstance().doctype==4)return{action:"delete-target",list:this.footprintList}}modify(e){}close(e){return!x.getInstance().isactive||23==x.getInstance().doctype?void 0:(e.action=="confirm"&&A.publish("clearElements",e.data),!0)}};var oK=class extends fi{constructor(t,e){super(),this.dialogType="equal-length-tuning",this.option=t,this.tool=e}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r=new a1().getDesignRulers();return r.action="design-rules",this.option!=null&&(r.extra=this.option),r}modify(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;t.action=="apply"&&(new a1().setDesignRulers(t),this.flush())}close(t){return!x.getInstance().isactive||23==x.getInstance().doctype?void 0:(t.action=="confirm"&&(new a1().setDesignRulers(t),this.flush(),we.drawing?A.publish("refershDialog",""):(A.publish("tool","dropdrag"),Ve.getSelects().length>0&&A.publish("flushSelectingInfo",""))),A.publish("pcbdialogModify",{dialogType:"pcb-batch-fanout"}),!0)}flush(){this.tool!=null&&(this.tool instanceof Vo?this.tool.updateTrackWidth():(this.tool instanceof cy||this.tool instanceof y2)&&this.tool.updateViaRadius())}};function T$e(o){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(o=="component_distribute_by_region"){Ve.getComponents().length>0&&A.publish("tool","component_distribute_by_region");return}let t=Ve.getSelects(),e=new Set;if(t=t.filter(r=>{if(r.isEmpty)return!1;let i=r.getGroupID();if(i){if(e.has(i))return!1;e.add(i)}let n=r.getParent();return!(n&&t.includes(n))}),!(t.length<=1))switch(o){case"distribute_horizontal_equidistant":case"distribute_vertical_equidistant":case"distribute_left_side_edge_equidistant":case"distribute_top_side_edge_equidistant":{sK({cmd:o});break}case"distribute_horizontal_by_center_distance":case"distribute_vertical_by_center_distance":{let r=o=="distribute_horizontal_by_center_distance"?"x":"y",i=[];for(let s of t){let a=s.buildBBox();i.push(a.center()[r])}let n=(Math.max.apply(null,i)-Math.min.apply(null,i))/(i.length-1);A.publish("openMainDialog",{cmd:8,data:{option:{spacing:la(n,x.getInstance().unit),unit:x.getInstance().unit,cmd:o}}});break}case"distribute_horizontal_by_edges_distance":case"distribute_vertical_by_edges_distance":{let r=new Array;for(let n of t)n instanceof fr?r.push({bbox:mN(n),item:n}):r.push({bbox:n.buildBBox(),item:n});let i;if(o=="distribute_horizontal_by_edges_distance"){let[n,s]=r.reduce((c,h)=>[c[0].bbox.minX>h.bbox.minX?h:c[0],c[1].bbox.maxX<h.bbox.maxX?h:c[1]],[r[0],r[0]]),l=r.filter(c=>c.item!=n.item&&c.item!=s.item).reduce((c,h)=>c+h.bbox.width(),0);i=(s.bbox.minX-n.bbox.maxX-l)/(t.length-1)}else{let[n,s]=r.reduce((c,h)=>[c[0].bbox.minY>h.bbox.minY?h:c[0],c[1].bbox.maxY<h.bbox.maxY?h:c[1]],[r[0],r[0]]),l=r.filter(c=>c.item!=s.item&&c.item!=n.item).reduce((c,h)=>c+h.bbox.height(),0);i=(s.bbox.minY-n.bbox.maxY-l)/(t.length-1)}A.publish("openMainDialog",{cmd:8,data:{option:{spacing:la(i,x.getInstance().unit),unit:x.getInstance().unit,cmd:o}}});break}case"distribute":{A.publish("tool","createArrayDistributionTool");break}}}function sK(o){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let t=Ve.getSelects();ls.getInstance().init(t,o.cmd,(e,r)=>{let i={distribute_horizontal_equidistant:{axis:"x",pos:I=>I.UL().x},distribute_vertical_equidistant:{axis:"y",pos:I=>I.UL().y},distribute_left_side_edge_equidistant:{axis:"x",pos:I=>I.minX},distribute_top_side_edge_equidistant:{axis:"y",pos:I=>I.maxY},distribute_horizontal_by_center_distance:{axis:"x",pos:I=>I.center().x},distribute_vertical_by_center_distance:{axis:"y",pos:I=>I.center().y},distribute_horizontal_by_edges_distance:{axis:"x",pos:I=>I.center().x},distribute_vertical_by_edges_distance:{axis:"y",pos:I=>I.center().y}},n=i[o.cmd].pos,s=i[o.cmd].axis,a=o.spacing,l=new _e,c=[],h=0,u=0,d=e.reduce((I,C)=>{let E=C.getGroupID();return E&&I.add(E),I},new Set),p=new Set,m=new Array;for(let I of d)kt.getItem(I).getItems().every(O=>e.includes(O))?m.push(kt.getItem(I)):p.add(I);for(let I of e){let C=I.getGroupID();C?p.has(C)&&(m.push(I),p.delete(C)):m.push(I)}for(let I of m){let C;I instanceof fr?C=mN(I):C=I.buildBBox(),c.push({item:I,pos:n(C),width:C.width(),height:C.height(),bbox:C}),h+=C.width(),u+=C.height(),l.ext1(C)}let g,y,b=[];if(["distribute_horizontal_by_center_distance","distribute_vertical_by_center_distance"].includes(o.cmd))b=c.sort((I,C)=>I.pos-C.pos),a==null?(a=(b[b.length-1].pos-b[0].pos)/(b.length-1),g=b[0].pos):g=l.build1().center()[s]-a*(b.length-1)/2,y=b.map((I,C)=>{let E=g+a*C-I.pos;return s=="x"?new S(E,0):new S(0,E)});else if(o.cmd=="distribute_horizontal_by_edges_distance"){let[I,C]=c.reduce((_,R)=>[_[0].bbox.minX>R.bbox.minX?R:_[0],_[1].bbox.maxX<R.bbox.maxX?R:_[1]],[c[0],c[0]]),E=c.filter(_=>_.item!=I.item&&_.item!=C.item).sort((_,R)=>_.pos-R.pos);b=[].concat([I],E,[C]),y=[new S(0,0)];let O=b[0].bbox.maxX;for(let _=1;_<b.length;_++)O+=a+b[_].width/2,y.push(new S(O-b[_].pos,0)),O+=b[_].width/2}else if(o.cmd=="distribute_vertical_by_edges_distance"){let[I,C]=c.reduce((_,R)=>[_[0].bbox.minY>R.bbox.minY?R:_[0],_[1].bbox.maxY<R.bbox.maxY?R:_[1]],[c[0],c[0]]),E=c.filter(_=>_.item!=C.item&&_.item!=I.item).sort((_,R)=>_.pos-R.pos);b=[].concat([I],E,[C]),y=[new S(0,0)];let O=b[0].bbox.maxY;for(let _=1;_<b.length;_++)O+=a+b[_].height/2,y.push(new S(0,O-b[_].pos)),O+=b[_].height/2}else{b=c.sort((C,E)=>s=="x"?C.pos-E.pos:E.pos-C.pos),a==null&&(s=="x"?a=(l.build1().width()-h)/(b.length-1):a=(l.build1().height()-u)/(b.length-1)),g=l.build1().UL()[s];let I=0;y=b.map((C,E)=>{if(s=="x"){let O=g+a*E+I-C.pos;return I+=C.width,new S(O,0)}else if(s=="y"){let O=g-a*E+I-C.pos;return I-=C.height,new S(0,O)}})}let P=b.map(I=>I.item);new l1(r).execute(P,y)})}var tfe=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return e.action="distribute-spacing",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){return!x.getInstance().isactive||23==x.getInstance().doctype?void 0:(t.action=="confirm"&&sK(t),!0)}};var rfe=class extends fi{constructor(t){super();for(let e in t.attrConfig){let r=t.attrConfig[e];r.globalIndex&&delete r.globalIndex}this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return e.action="find-objects",this.option!=null&&(e.extra=this.option),e}modify(t){return!x.getInstance().isactive||23==x.getInstance().doctype?void 0:(t.action=="apply"&&A.publish("showFindItemInBottomBar",{data:E9.objMatched(t.objType,t.strMode,t.conditions,t.componentPropertyType,t.objRange),selectFirstRow:t.selectFirstRow},$()),!0)}close(t){}};var ife=class extends ec{constructor(){super(...arguments);this.component=null}set(e){return this.component=e,this}getHtmlData(e){let r={};r.footprintName=e.footprintId;let i=new Array;for(let n of e.getItems())n instanceof Ri&&i.push({text:n.num,value:n.num});return r.footprintList=i,r}getPadsData(e){let r=e.getItems(),i=new IP,n=new Array;for(let s of r)if(s instanceof Ri){let a=i.getHtmlData(s);n.push(a.getAttrList()),i.clearCache()}return n}getFootprintNumber(e){let i=Ji.getItem(e.footprintUUID).getComponents();return i!=null?i.length:0}modifyBy(e,r){}};var nfe=class extends fi{constructor(t){super(),this.component=t}open(t){let e=new ife,r={};r.primitive=["PAD"],r.unit=x.getInstance().unit,r.doctype=x.getInstance().doctype,r.tabid=x.getInstance().tabId,r.quantity=e.getFootprintNumber(this.component);let i={},n="footprintData";i[n]=e.getHtmlData(this.component),i.panelData=e.getPadsData(this.component);let s={head:r,body:i};return s.action="attribute-for-footprint-pad",s}modify(t){}close(t){}};var ofe=class extends fi{open(t){return{action:"global-cmd"}}modify(t){}close(t){return!x.getInstance().isactive||23==x.getInstance().doctype?void 0:(t.action=="confirm"&&A.publish("globalCommand",t["global-cmd"]),!0)}};var sfe=class extends fi{constructor(t){super(),this.data=t}open(t){return{action:"insert-image-file",data:this.data}}modify(t){}close(t){if(!t)return;let{action:e,type:r}=t;if(e=="confirm")switch(r){case"Image":{let i=t.pathDataString;if(i.path==""||i.path==null){let n=new w9("Please select a picture");A.publish("openMsgbox",n)}else A.publish("DrawImage",i);break}case"TrueColorPicture":{let{dataUrl:i,width:n,height:s,unit:a,fileName:l}=t,c=x.getInstance().compiler.uploadBlob(l,i);if(c.success){let h=c.hash,u={dataUrl:i,width:n,height:s,unit:a,hashId:h};if(Yd.getItem(h))A.publish("DrawTrueColorPicture",u);else{let p=new Image;p.src=i,p.onload=()=>{Yd.addTemplate(h,l,p),A.publish("DrawTrueColorPicture",u)}}}else A.publish("ui/toastMsg",{type:"warn",msg:"Import failed!"},$());break}}return!0}};var afe=class extends fi{constructor(){super()}open(t){return{action:"remove-unused-pad",operation:ce.pcbConfig.unusedPadOperation,range:ce.pcbConfig.unusedPadRange,onlySelect:ce.pcbConfig.unusedPadOnlySelect,realTimeUpdateUnusedLayers:ce.pcbConfig.realTimeUpdateUnusedLayers}}async modify(t){if(t.action=="apply"){ce.pcbConfig.unusedPadOperation=t.operation,ce.pcbConfig.unusedPadRange=t.range,ce.pcbConfig.unusedPadOnlySelect=t.onlySelect,ce.pcbConfig.realTimeUpdateUnusedLayers=!1;let r=new Array,i=Ve.getSelects(),n=i.map(l=>l.globalIndex);if(t.onlySelect){let l=new Set,c=new Set;i.filter(h=>{h instanceof Me?(h.getPads().forEach(u=>l.add(u)),h.getVias().forEach(u=>c.add(u))):h instanceof Le&&h.layerId==12?l.add(h):h instanceof Ge&&c.add(h)}),t.range=="1"?r=[].concat(Array.from(l),Array.from(c)):t.range=="2"?r=Array.from(l):t.range=="3"&&(r=Array.from(c))}else t.range=="1"?r=[].concat(Kt.getAllItem().filter(l=>l.layerId==12),Hr.getAllItem()):t.range=="2"?r=Kt.getAllItem().filter(l=>l.layerId==12):t.range=="3"&&(r=Hr.getAllItem());let s={};t.operation=="remove"&&(r=r.filter(l=>l.unusedInnerLayers.length==0)),t.operation=="restore"?s=r.reduce((l,c)=>(l[c.globalIndex]=[],l),{}):s=(await A.messageBus.rpcCall("unusedLayer",aK(r))).message;let a=await WN(s);if(r.length>0){je.executeCommand(a);let l=new er;A.publish("select",n.map(c=>{let h=l.getItem(c);return h.click(),h})),a.length>0&&A.publish("flushService",""),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}ce.pcbConfig.realTimeUpdateUnusedLayers=t.realTimeUpdateUnusedLayers,Hi()}}close(t){return!0}};async function WN(o){let t=new er,e=Object.keys(o),r=e.map(a=>t.getItem(a)).filter(a=>!a.isEmpty),i=new ve("Remove unused pad"),n=new Set;for(let a of r){let l=o[a.globalIndex]||[];if(l.toString()!=a.unusedInnerLayers.toString()){i.addCommand(Te.dispatch(a,"modify")),A.publish("hasModifyPcbItem",a),a.unusedInnerLayers=l;let c=a.getParent();c instanceof Me&&n.add(c)}}async function s(a){i.addCommand(Te.dispatch(a,"modify")),await new $f().updateCustomFootprint(a,i,r.filter(c=>c.getParent()==a))}for(let a of n){let l=!0;for(let c of a.getPads())if(c.unusedInnerLayers.length!=0){l=!1;break}if(l){for(let c of a.getVias())if(c.unusedInnerLayers.length!=0){l=!1;break}}l?await Vwt(a,i,e)||await s(a):await s(a)}return n.clear(),i}async function Vwt(o,t,e){let r=Ji.getItem(o.footprintUUID);if(r instanceof Xc){let i=Ji.getItem(r.source),n=new ng,s=x.getInstance().compilerChannel,a=new OS(i.uuid,i.projectId,s);a.setHandle(new og(n)),await a.init(),await a.destroy(),n.preAdjust();let l=new ng,c=new OS(r.uuid,i.projectId,s);c.setHandle(new og(l)),await c.init(),await c.destroy(),l.preAdjust();let h=new CV(new mi);[n.pad,l.pad,n.via,l.via].forEach(p=>{p.forEach(m=>{m.net="",m.ticket=[]})}),o.getPads().forEach(p=>{let m=l.pad.find(g=>o.globalIndex+g.index==p.globalIndex);m&&(m.unusedInnerLayers=p.unusedInnerLayers)}),o.getVias().forEach(p=>{let m=l.via.find(g=>o.globalIndex+g.index==p.globalIndex);m&&(m.unusedInnerLayers=p.unusedInnerLayers)});let u=h.pushItem(n.pad,l.pad),d=h.pushItem(n.via,l.via);if(!u.length&&!d.length)return n$(o,t,e),!0}return!1}function aK(o){let t={};o.forEach(e=>{let r=e.net||"";t[r]==null&&(t[r]={targets:[],ids:[]}),t[r].targets.push(e.globalIndex)});for(let e in t)t[e].ids=ze.getSameNetItems(e).map(r=>r.globalIndex);return t}var $Ae=class{toggleElementsLayer(t){let e=te.getInstance().getAllBlindPhysics(),r=this.createReferenceMap(t),i=pr.getAllItem(),n=Hr.getAllItem(),s=pt.getAllItem(),a=Xt.getAllItem(),l=Zt.getAllItem(),c=ti.getAllItem(),h=Ln.getAllItem(),u=_o.getAllItem(),d=Qn.getAllItem(),p=Ei.getAllItem();for(let b of e){let P=b.data,T=!1;for(let I of P){let C=I.startLayer,E=I.endLayer,O=r.get(C),_=r.get(E);C!==O.layerId&&(T=!0,I.startLayer=O.layerId),E!==_.layerId&&(T=!0,I.endLayer=_.layerId),T&&(I.name=this.resetBlindViaRuleName(O.layerId,_.layerId))}T&&(b.data=P)}for(let b of n){if(b.type==0)continue;let P=b.startLayer,T=b.endLayer,I=r.get(P),C=r.get(T),E=!1;P!==I.layerId&&(b.startLayer=I.layerId,E=!0),T!==C.layerId&&(b.endLayer=C.layerId,E=!0),E&&(b.name=this.resetBlindViaName(I.layerId,C.layerId))}let m=[].concat(i,c,h,u,d,s,a,l,p),g=new Array,y=new Set;for(let b of m){if(typeof b.layerId>"u")continue;let P=b.layerId,T=r.get(P);!T||P===T.layerId||(b.layerId=T.layerId,g.push(b),b instanceof Ye&&b.type=="Copper Region"&&y.add(b.globalIndex))}y.size&&(A.publish("rebuildSingleCopper",{ids:Array.from(y),isLast:!1,isManual:!0}),y.clear()),this.uploadModifiedElements(g)}createReferenceMap(t){let e=new Map;for(let r=0;r<t.length;r++)e.set(t[r].referenceLayerId,t[r]);return e}resetBlindViaRuleName(t,e){let r=this.getBlindLayerOrder(t),i=this.getBlindLayerOrder(e);return r<i?`${r}-${i}`:`${i}-${r}`}getBlindLayerOrder(t){return t==1?1:t==2?be.getAllSignalLayer().length:t-15+2}resetBlindViaName(t,e){let r=te.getInstance().getDefaultBlindPhysics();for(let i of r.getAllVias())if(i.startLayer===t&&i.endLayer===e)return i.name}uploadModifiedElements(t){if(t.length===0)return;let e=x.getInstance().compiler,r=or.getInstance(),i=e.consistencyManager.getMaxTicket(),n=0,s=0;for(let a of t)try{let l=a.globalIndex;if(a instanceof Rs){e.setTicket(++i);let c=r.encode("OBJ",a.model);e.uploadObj(l,c),n++}else if(a instanceof Yn){e.setTicket(++i);let c=r.encode("IMAGE",a.model);e.uploadImage(l,c),n++}else if(a instanceof fr){e.setTicket(++i);let c=r.encode("STRING",a.model);c&&(a.model.key!=""?e.uploadAttr(l,c):e.uploadString(l,c)),n++}else if(a instanceof Ue){if(e.setTicket(++i),a instanceof Si){let c=r.encode("ARC",a.model);e.uploadArc(l,c)}else if(a instanceof Ar){let c=r.encode("LINE",a.model);e.uploadLine(l,c)}n++}else if(a instanceof Ki)e.setTicket(++i),e.uploadLayerFill(a.layerId,r.encode("FILL",a.model)),n++;else if(a instanceof ii){let c=W1(a.getParent().globalIndex);c&&c instanceof Ye&&c.type==="Copper Region"?(e.setTicket(++i),e.uploadPoured(c.globalIndex,r.encode("POURED",Array.from(c.copperResultMap||[]))),n++):console.warn(`\u94FA\u94DC\u7ED3\u679C\u56FE\u5143 ${l} \u672A\u627E\u5230\u5BF9\u5E94\u7236\u8F6E\u5ED3\uFF0C\u8DF3\u8FC7\u4E0A\u4F20`)}else if(a instanceof ct||a instanceof nr||a instanceof Sr){let c=a.type,h=r.encodeProfile(a.model);KE(l,c,h),n++}}catch(l){s++,console.error(`\u4E0A\u4F20\u56FE\u5143 ${a.globalIndex} \u5931\u8D25:`,l)}}};function I$e(o){new $Ae().toggleElementsLayer(o)}var lfe=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return e.action="layerManager",this.option!=null&&(e.extra={...this.option,pcbLayerSelectedNameCache:ce.pcbConfig.pcbLayerSelectedNameCache,layerPhyPerferenceConfig:ce.pcbConfig.layerPhyPerferenceConfig||""}),e}modify(t){this.applyConfig(t),window.setTimeout(()=>{A.publish("updateFrame","")},100)}close(t){return!x.getInstance().isactive||23==x.getInstance().doctype?void 0:(t.action=="confirm"&&this.applyConfig(t),!0)}applyLayerConfig(t){let e=be.configInnerLayers.size,r=be.getAllLayer(),i=t.layerConfigArr,n=new iC,s=new Array,a=new Array,l,c=new Array;for(let h=0;h<r.length;h++){let u=n.toPlainObj(r[h]),d=!0,p=r[h].config;if(i.forEach(m=>{if(+m.layerId===u.layerId){d=!1;let g=Object.assign({},u,m),y=ee.of3(g.activeColor).getData();if(be.modifyLayer(g.layerId,g.layerType,g.layerName||r[h].name,r[h].order,ee.build(y[0],y[1],y[2],g.activeColorAlpha),ee.build(y[0],y[1],y[2],g.deactiveColorAlpha),r[h].active,g.status),ED.deactiveAlpha=g.deactiveColorAlpha,m.layerType==="PLANE"&&Xd.hasProfileItem(m.layerId)){let P=Xd.fetchProfileItem(m.layerId);be.updatePlanzoneLayerKeepIsland(m.layerId,P.keepIsland)}let b=be.getLayer(u.layerId).config;return d=!b,d||Sp(m.layerId),!p&&b?g.layerType=="PLANE"&&s.push(g.layerId):p&&!b?g.layerType=="PLANE"&&a.push(g.layerId):g.layerType=="SIGNAL"&&u.layerType=="PLANE"?a.push(g.layerId):g.layerType=="PLANE"&&u.layerType=="SIGNAL"&&s.push(g.layerId),!1}}),r[h].active&&(l=r[h]),d)if(r[h].active&&(l=be.getTopLayer()),be.modifyLayer(r[h].layerID,r[h].type,r[h].name,r[h].order,r[h].activeColor,r[h].deactiveColor,!1,0),c.push(r[h].layerID),Xd.hasProfileItem(r[h].layerID)&&Xd.deleteProfileItem(r[h].layerID),u.layerType=="CUSTOM"){let m=r[h].layerID,g=be.getLayer(m).config;(p!=g||g)&&Sp(m,d)}else Sp(r[h].layerID)}this.updateHasDeleteLayerComponentsBBox(c),l!=null&&be.setActiveLayer(l),t.upgraded&&I$e(t.layerConfigArr),Yie(),ga.getInstance().viaShowPair&&e!=be.configInnerLayers.size&&Hr.iterator(h=>h.refreshRender()),A.publish("clearSinglePlane",a),A.publish("rebuildSinglePlane",s),A.publish("autoRefresh3DColor",""),A.publish("autoFill",""),A.publish("FinishedHandleLayerUpdate",{},$())}updateHasDeleteLayerComponentsBBox(t){if(t.length==0)return;let e=Cr.getAllItem();for(let r of e)r.needUpdateBBox=!0}getPhyZIndex(t,e){switch(t){case 3:return 1;case 7:return 2;case 5:return 3;case 1:return 1e3;case 2:return 9e3;case 6:return 1e4;case 8:return 10001;case 4:return 10002;default:return 1e3+e-3}}applyLayerPhysConfig(t){let e=new ft;if(t.layerPhysConfigArr.length){be.delAllSubstrateLayers();let r=0,i=0;for(let n of t.layerPhysConfigArr)n.zIndex=this.getPhyZIndex(n["Layer Id"],i++),n.Type==="Substrate"&&(n["Layer Id"]=361+r,be.modifyLayer(n["Layer Id"],"SUBSTRATE",n.Layer,361+r,ee.build(0,0,0,0),ee.build(0,0,0,0),!1,0),r++),Sp(n["Layer Id"]),n.Thickness!=null&&(n.Thickness=e.mm2mil(n.Thickness)/10);be.setLayerPhys(t.layerPhysConfigArr,!0)}}async updateCanvas(){BC(!0),await this.removeUsedLayerForMultiLayerPads(),A.publish("flushService",""),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),A.publish("ui/toastMsg",{type:"info",msg:"Apply successfully!"},$())}async removeUsedLayerForMultiLayerPads(){if(!ce.pcbConfig.realTimeUpdateUnusedLayers)return;let t=[...Kt.getAllItem().filter(i=>i.layerId==12),...Hr.getAllItem()],e=(await A.messageBus.rpcCall("unusedLayer",aK(t))).message,r=await WN(e);t.length>0&&(je.executeCommand(r),A.publish("flushService",""))}updateSystemConfig(t){t.pcbLayerSelectedName&&(ce.pcbConfig.pcbLayerSelectedNameCache=t.pcbLayerSelectedName)}applyConfig(t){this.applyLayerConfig(t),this.applyLayerPhysConfig(t),this.updateCanvas(),this.updateSystemConfig(t),this.modifyPcbLayerPhyPerferenceConfig(t)}modifyPcbLayerPhyPerferenceConfig(t){typeof t.layerPhyPerferenceConfig<"u"&&(ce.pcbConfig.layerPhyPerferenceConfig=t.layerPhyPerferenceConfig,Hi())}createReferenceMap(t){let e=new Map;for(let r=0;r<t.length;r++)e.set(t[r].referenceLayerId,t[r]);return e}resetBlindViaRuleName(t,e){let r=this.getBlindLayerOrder(t),i=this.getBlindLayerOrder(e);return r<i?`${r}-${i}`:`${i}-${r}`}getBlindLayerOrder(t){return t==1?1:t==2?be.getAllSignalLayer().length:t-15+2}resetBlindViaName(t,e){let r=te.getInstance().getDefaultBlindPhysics();for(let i of r.getAllVias())if(i.startLayer===t&&i.endLayer===e)return i.name}};var cfe=class extends fi{constructor(t,e){super(),this.shape=t,this.tool=e,this.tool.setDialogHandler(this)}open(){let t=new sO;this.type=="open"&&nb(this.shape);let e=t.getHtmlData(this.shape),r={action:"attribute-for-2dline",head:{primitive:["2DLINE"],unit:x.getInstance().unit,doctype:x.getInstance().doctype},body:{"2DLINE":[e.getResult("2DLINE")]}};Kw.getService().dialogIds.add(this.id);let i=KU(r);return i.action=r.action,i}modify(t){if(!(!x.getInstance().isactive||23==x.getInstance().doctype)&&this.shape!=null&&t!=null){let e=new sO;e.isSetByDialog=!0,e.set(this.shape).modifyBy(t)}}close(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e=t.action;if(e=="confirm"){let r=new sO;r.isSetByDialog=!0,r.set(this.shape).modifyBy(t.body["2DLINE"]),this.tool.modify(!0)}else e=="closeOpenDialog"||this.tool.modify(!1);return this.tool.setDialogHandler(null),Kw.getService().dialogIds.delete(this.id),Pi.getInstance().clearCrossFlag(),!0}command(t){var e;return t.action=="netSelect"?(this.tool.toggleMode(1,(e=t==null?void 0:t.data)!=null?e:{}),!0):!1}closeOpenDialog(){let t={};t.dialogId=this.id,t.action="closeOpenDialog",A.publish("pcbdialogClose",t,$())}};var hfe=class extends fi{constructor(e,r,i){super();this.items=new Set;e.forEach(n=>{this.items.add(n)}),this.x=r,this.y=i}open(e){let r=new Array;return this.items.forEach(i=>{i instanceof Ue?r.push(this.getTrack(i)):i instanceof Ge?r.push(this.getVia(i)):i instanceof Le?r.push(this.getPad(i)):i instanceof Me?r.push(this.getDevice(i)):i instanceof Ye?r.push(this.getProfile(i)):i instanceof fr?r.push(this.getText(i)):i instanceof va?r.push(this.getTagging(i)):i instanceof Yn?r.push(this.getImage(i)):i instanceof Rs?r.push(this.getTrueColorPicture(i)):i instanceof ii?r.push(this.getCopperResult(i)):i instanceof qp&&r.push(this.getDRCResult(i))}),{action:"display-overlap-primitive",left:this.x,top:this.y,lists:r}}recory(){for(let e of this.items)e.visible()}modify(e){if(!e||!e.action)return;let{action:r,content:i,dialogId:n,id:s,title:a}=e,c=new er().getItem(s,{isContainDRCs:!0});switch(this.recory(),r){case"highlightTarget":{c&&c.click(),Ve.updateMousePosition();break}case"cancelHighlightTarget":{c&&c.visible(),A.publish("flushSelectingInfo","");break}}A.publish("flushService","")}close(e){return!0}command(e){if(e.id!=""){let i=new er().getItem(e.id);A.publish("clearSelect",""),i&&(i.updateFilterVisible=!0,i.click()),A.publish("onlySelect",i?[i]:[]),Pr.model=0}return!0}getTrack(e){return{title:"Track",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]}}getVia(e){return{title:"Via",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]}}getPad(e){return{title:"Pad",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]}}getDevice(e){return{title:"Device",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]}}getProfile(e){let r=be.getLayer(e.layerId).name;switch(e.type){case"3D Shell - Outline":return{title:"3D Shell - Outline",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]};case"3D Shell - Screw Pillar":return{title:"3D Shell - Screw Pillar",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]};case"3D Shell - Side Datum Line":return{title:"3D Shell - Side Datum Line",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]};case"3D Shell - Top Slot Region":case"3D Shell - Side Slot Region":return{title:"3D Shell - Slot Region",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]};case"Annotation":return{title:"Annotation",id:e.globalIndex,content:[]};default:return{title:e.type||"Outline Object",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]}}}getText(e){return{title:"Text",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]}}getTagging(e){return{title:"Tagging",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]}}getImage(e){return{title:"Image",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]}}getTrueColorPicture(e){return{title:"Colorful Image",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]}}getTearDrop(e){return{title:"Teardrop",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]}}getCopperResult(e){return{title:"Copper Fills",id:e.globalIndex,content:[{label:"id",value:`${ur}${e.number}`}]}}getDRCResult(e){return{title:"DRC\u3010DRC\u3011",id:e.globalIndex,content:[]}}};var ufe=class extends fi{constructor(t){super(),this.tool=t}open(t){return this.tool.getDialogData()}modify(t){}close(t){return this.tool.modifyByDialog(t),!0}command(t){return t.action=="netSelect"?(this.tool.toggleMode(1),!0):!1}};var pfe=class extends fi{constructor(){super()}open(t){let e=N9("typeface"),r=Xe(N9("height")),i=Xe(N9("strokeWidth"));return{action:"place-pcb-text",content:Bw,typeface:e||kZ,typefaceList:Cie(),height:r,strokeWidth:i}}modify(t){return!0}close(t){let e=new ft;if(t.action==="confirm"){let r=t["place-text-content"];if(r.trim()){let i=parseFloat(String(t["place-text-height"]))/10;x.getInstance().unit!="mil"&&(i=e.conversion(x.getInstance().unit,"mil",i));let n=parseFloat(String(t["place-text-strokewidth"]))/10;x.getInstance().unit!="mil"&&(n=e.conversion(x.getInstance().unit,"mil",n)),dfe("typeface",t["place-text-typeface"]),dfe("height",i),dfe("strokeWidth",n),OU(r),A.publish("place_part(pcbtext)","")}}return!0}};var ffe=class extends fi{constructor(t,e){super(),this.shape=t,this.currTool=e}open(){let t=new Mw;this.type=="open"&&nb(this.shape);let e=t.getHtmlData(this.shape),r={action:"attribute-for-pad",head:{primitive:["PAD"],unit:x.getInstance().unit,doctype:x.getInstance().doctype},body:{PAD:[e.getResult("PAD")]}},i=KU(r);return i.action=r.action,i}modify(t){new Mw().set(this.shape).modifyBy(t)}close(t){return!x.getInstance().isactive||23==x.getInstance().doctype?void 0:(t.action=="confirm"?this.currTool.modify(!0):this.currTool.modify(!1),!0)}command(t){var e;return t.action=="netSelect"?(this.currTool.toggleMode(1,(e=t==null?void 0:t.data)!=null?e:{}),!0):!1}};var mfe=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return e.action="relative-offset",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(t.action=="confirm"){let r=Ve.getSelects();if(r.length==0)return;ls.getInstance().init(r,"relative offset",(i,n)=>{tp.init(i,n,async(s,a)=>{let l=x.getInstance().unit,c=new S(Bs(t.newPos.x,l,"pixel"),Bs(t.newPos.y,l,"pixel")).add(x.getInstance().origin),h=this.calcOffset(s,c);if(new l1(a,{movePadItSelf:!tp.moveWhole,saveHistory:!1}).execute(s,h),!tp.moveWhole){let d=new Set;s.forEach(m=>{if(m instanceof Le){let g=m.getParent();g instanceof Me&&d.add(g)}});let p=new Array;for(let m of d){a.addCommand4Item(m,"modify");let y=new $f().updateCustomFootprint(m,a.getCommand(),s.filter(b=>b.getParent()==m));p.push(y)}await Promise.all(p)}a.execute(),setTimeout(()=>{A.publish("selecting",{items:s}),A.publish("flushService","")},0),Pr.refresh()})})}return!0}calcOffset(t,e){let r=new _e;for(let s of t){let a=s.buildBBox();r.ext1(a)}let n=r.build1().center();return new S(e.x-n.x,e.y-n.y)}};var gfe=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return e.action="set-part-elements",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(t.action=="confirm"&&t&&t.newPos&&!isNaN(t.newPos.positionX)&&!isNaN(t.newPos.positionY)){let r=x.getInstance().unit,i=new S(Bs(t.newPos.positionX,r,"pixel"),Bs(t.newPos.positionY,r,"pixel")).add(x.getInstance().origin);ic.referPosition(i),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}return!0}};var lK=class extends fi{open(t){return{action:"tear-drap","operation-type":rt.defaultTearDrop.operationType,"apply-scope":rt.defaultTearDrop.applyScope,"tear-shape":rt.defaultTearDrop.tearShape,"ignore-DRC":rt.defaultTearDrop.ignoreDRC,"round-pad-width":rt.defaultTearDrop.circleWidth,"round-pad-height":rt.defaultTearDrop.circleHeight,"circle-pad-via-checked":rt.defaultTearDrop.circlePadViaChecked,"rect-pad-width":rt.defaultTearDrop.otherWidth,"rect-pad-height":rt.defaultTearDrop.otherHeight,"special-shaped-pad-checked":rt.defaultTearDrop.specialShapedPadChecked,"routing-width":rt.defaultTearDrop.routingWidth,"routing-height":rt.defaultTearDrop.routingHeight,"routing-checked":rt.defaultTearDrop.routingChecked,"t-connection-width":rt.defaultTearDrop.TConnectionWidth,"t-connection-height":rt.defaultTearDrop.TConnectionHeight,"t-connection-checked":rt.defaultTearDrop.TConnectionChecked}}modify(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(t.action=="apply"){let r=t["apply-scope"],i=t["operation-type"],n=t["tear-shape"],s=t["ignore-DRC"],a=parseFloat(t["rect-pad-height"]),l=parseFloat(t["rect-pad-width"]),c=!!t["special-shaped-pad-checked"],h=parseFloat(t["round-pad-height"]),u=parseFloat(t["round-pad-width"]),d=!!t["circle-pad-via-checked"],p=parseFloat(t["routing-width"]),m=parseFloat(t["routing-height"]),g=!!t["routing-checked"],y=parseFloat(t["t-connection-width"]),b=parseFloat(t["t-connection-height"]),P=!!t["t-connection-checked"];rt.defaultTearDrop.operationType=i,rt.defaultTearDrop.applyScope=r,rt.defaultTearDrop.tearShape=n,rt.defaultTearDrop.ignoreDRC=s,rt.defaultTearDrop.circlePadViaChecked=d,rt.defaultTearDrop.circleHeight=h,rt.defaultTearDrop.circleWidth=u,rt.defaultTearDrop.specialShapedPadChecked=c,rt.defaultTearDrop.otherHeight=a,rt.defaultTearDrop.otherWidth=l,rt.defaultTearDrop.routingChecked=g,rt.defaultTearDrop.routingWidth=p,rt.defaultTearDrop.routingHeight=m,rt.defaultTearDrop.TConnectionChecked=P,rt.defaultTearDrop.TConnectionWidth=y,rt.defaultTearDrop.TConnectionHeight=b,this.withTearDrop(i,r,n,s,d,u/100,h/100,c,l/100,a/100,g,p/100,m/100,P,y/100,b/100)}return!0}close(t){if(!(!x.getInstance().isactive||23==x.getInstance().doctype))return!0}withTearDrop(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b=!0,P,T,I){if(t=="add"){if(!b&&P.length>1e3&&(T=!1,b=!0),T||A.publish("progressUpdate",[0,"add tear drop"],$()),!P){e=="all"?P=this.getConnectNodesForGlobalIndex():P=this.getSelectNodesForGlobalIndex();let E=this.getTears(P);this.delTears(E)}P=Array.from(new Set(P)),A.publish("addTearDrop",{operationType:t,applyScope:e,tearShape:r,ignoreDRC:i,circlePadViaChecked:n,roundWidth:s,roundeHeight:a,specialShapedPadChecked:l,otherWidth:c,otherHeight:h,routingChecked:u,routingWidth:d,routingHeight:p,TConnectionChecked:m,TConnectionWidth:g,TConnectionHeight:y,ids:P,hideProgress:T,addTeardropAutomatically:I,useWorker:b})}else{let C="removeTearDrop-time";pn(C);let E=new ve("remove tear dropall"),O,_;if(e=="all")O=this.getConnectNodes(),_=new Set(pt.getAllItem());else{O=this.getSelectNodes();let v=Array.from(O).map(D=>D.globalIndex);_=this.getTears(v)}let R=Ve.getSelects().filter(v=>!(v instanceof ct&&v.type=="TearDrop"));A.publish("onlySelect",R),_.forEach(v=>{if(v.type=="TearDrop"){let w=v.getComponent().connects.map(H=>pc(H)),F=w.filter(H=>H instanceof qr);if(F.length===2){if(!u)return}else if(F.length>2){if(!m)return}else if(F.length===1){let H=w.filter(z=>!(z instanceof qr));if(H.length!==1){let z=H[0];if(z instanceof Je){let G=z,W=F[0].layerId;if((W===1?G.top:W===2?G.bottom:G.inner).type==="ELLIPSE"){if(!n)return}else if(!l)return}else if(z instanceof It&&!n)return}else console.warn(`TearDrapDialog delete error "pad or Via":${H.length}`)}else console.warn('TearDrapDialog delete error "track"');E.addCommand(Te.dispatch(v,"delete")),v.getComponent().connects.forEach(H=>{pt.getTears(H).delete(v)}),A.publish("delete",v),v.remove()}}),je.executeCommand(E),Bi(C)}}delTears(t){let e=new ve("delete tear drop"),r=Ve.getSelects().filter(i=>!(i instanceof ct&&i.type=="TearDrop"));A.publish("onlySelect",r),t.forEach(i=>{i.getComponent().connects.forEach(a=>{pt.getTears(a).delete(i)});let s=new MT(i,"delete");e.addCommand(s),i.remove()}),e.length&&je.executeCommand(e)}getTears(t){let e=new Set;return pt.idMapTearsIsNull()||t.forEach(r=>{let i=pt.getTears(r);i!=null&&i.forEach(n=>{e.add(n)})}),e}getPadShape(t,e){return Io(t)?e.topType:2==t?e.bottomType:e.innerType}getConnectNodes(){let t=new Set;return Kt.getAllItem().forEach(n=>{t.add(n)}),Hr.getAllItem().forEach(n=>{t.add(n)}),pr.getAllItem().forEach(n=>{t.add(n)}),t}getConnectNodesForGlobalIndex(){let t=[];return Kt.getAllItem().forEach(n=>{t.push(n.globalIndex)}),Hr.getAllItem().forEach(n=>{t.push(n.globalIndex)}),pr.getAllItem().forEach(n=>{t.push(n.globalIndex)}),t}getConnectNodes1(){let t=new Set;return Kt.getAllItem().forEach(i=>{t.add(i)}),Hr.getAllItem().forEach(i=>{t.add(i)}),t}getSelectNodes(){let t=new Set;return Ve.getSelects().forEach(r=>{r instanceof Le||r instanceof Ge||r instanceof Ue?t.add(r):r instanceof Me&&r.getItems().forEach(n=>{(n instanceof Ue||n instanceof Le||n instanceof Ge)&&t.add(n)})}),t}getSelectNodesForGlobalIndex(){let t=[];return Ve.getSelects().forEach(r=>{r instanceof Le||r instanceof Ge||r instanceof Ue?t.push(r.globalIndex):r instanceof Me&&r.getItems().forEach(n=>{(n instanceof Ue||n instanceof Le||n instanceof Ge)&&t.push(n.globalIndex)})}),t}getSelectNodes1(){let t=new Set;return Ve.getSelects().forEach(r=>{r instanceof Le?t.add(r):r instanceof Ue?r.searchNode().forEach(n=>{(n instanceof Le||n instanceof Ge)&&t.add(n)}):r instanceof Ge?t.add(r):r instanceof Me&&(r.getPads().forEach(s=>{t.add(s)}),r.getVias().forEach(s=>{t.add(s)}))}),t}getTracks(t,e=!1){let r=new Array,i=t.searchNode();if(e){let n=i.filter(s=>s instanceof Le||s instanceof Ge);if(n&&n.length)return r}return i.forEach(n=>{n instanceof Ue&&r.push(n)}),r}getTracksForGlobalIndex(t,e=!1){let r=[],i=t.searchNode();if(e){let n=i.filter(s=>s instanceof Le||s instanceof Ge);if(n&&n.length)return r}return i.forEach(n=>{n instanceof Ue&&r.push(n.globalIndex)}),r}intersBBox(t,e,r,i,n){let s=this.getLimitPoints(t,i,n);return s.length==0&&(s=this.interPoints(t,e,r,i,n,0)),s}interPoints(t,e,r,i,n,s){let a;i?a=this.getLeft(n,e+r):a=this.getRight(n,e+r);let l=this.getPoints(t,a);if(s<6){let c=r/2;if(l.length==0)l=this.interPoints(t,e,c,i,n,s+1);else{let h=this.interPoints(t,e+c,c/2,i,n,s+1);h.length>0&&(l=h)}}return l}getLimitPoints(t,e,r){let i=new Array;t.primitives.forEach(s=>{this.getInters(s,r).length>0&&(i.push(s.start()),i.push(s.end()))});let n=null;if(e){if(r instanceof M){let s=0,a=r.end().sub(r.start()).normalize();i.forEach(l=>{let c=ir.foot(r,l),h=l.sub(c);a.cross(h)>0&&h.length()>s&&(n=l,s=h.length())})}else if(r instanceof q){let s=r.rx;i.forEach(a=>{let l=a.sub(r.center);l.length()<s&&(n=a,s=l.length())})}}else if(r instanceof M){let s=0,a=r.end().sub(r.start()).normalize();i.forEach(l=>{let c=ir.foot(r,l),h=l.sub(c);a.cross(h)<0&&h.length()>s&&(n=l,s=h.length())})}else if(r instanceof q){let s=r.rx;i.forEach(a=>{let l=a.sub(r.center);l.length()>s&&(n=a,s=l.length())})}return n==null?[]:[n]}isStart(t,e){return e.isSelect(t.start.x,t.start.y)}getShape(t,e){if(e instanceof Ri)if(Io(t.layerId)){let r=e.getTopShape(0);if(r!=null)return r}else if(2==t.layerId){let r=e.getBottomShape(0);if(r!=null)return r}else{let r=e.getInnerShape(0);if(r!=null)return r}else{let r=e.getMathGraphics(t.layerId,0);if(r!=null)return r}return null}dispatch(t,e,r,i){let n=this.isStart(t,e),s=this.getShape(t,e);return s!=null&&this.calculate(s,t,r,i,n)!=null,null}dispatchArc(t,e,r,i){let n=this.isStart(t,e),s=this.getShape(t,e);return s!=null&&s.primitives[0]instanceof q&&this.calculateCircle(s.primitives[0],t,r,i,n)!=null,null}calculateCircle(t,e,r,i,n){let s=this.getLine(e),a=this.getInters(t,s);if(a.length>0){let l=a[0],c=l.sub(t.center).normalize(),h=Math.sqrt(t.rx2-r*r/4),u=new S(-c.y,c.x),d=l.add(c.mul(i)),p=t.center.add(c.mul(h)),m=new M(d.sub(u.mul(100)),d.add(u.mul(100))),g=new M(p.sub(u.mul(100)),p.add(u.mul(100))),y=this.getInters(t,g),b=this.getLeft(s,e.width),P=new Array;if(b!=null)P=this.getInters(b,m);else return null;let T=this.getRight(s,e.width),I=this.getInters(T,m);if(P.length==0&&(n?P.push(b.end()):P.push(b.start())),P.length==0)return null;let C;if(P.length==1)C=P[0];else if(P.length>1){let O=e.length;n?P.forEach(_=>{let R=_.distance1(e.start);R<=O&&(O=R,C=_)}):P.forEach(_=>{let R=_.distance1(e.end);R<=O&&(O=R,C=_)})}if(I.length==0&&(n?I.push(T.end()):I.push(T.start())),I.length==0)return null;let E;if(I.length==1)E=I[0];else if(I.length>1){let O=e.length;n?I.forEach(_=>{let R=_.distance1(e.start);R<=O&&(O=R,E=_)}):I.forEach(_=>{let R=_.distance1(e.end);R<=O&&(O=R,E=_)})}if(C!=null&&E!=null&&y.length==2){let O=y[1].sub(y[0]).normalize(),_=E.sub(C).normalize();return O.dot(_)>0?(y.push(E),y.push(C)):(y.push(C),y.push(E)),y[0].distance2(y[1])<=C.distance2(E)?null:fe.build4(y).asClose()}else return null}}getLeft(t,e){if(e=e/2,t instanceof M){let r=t.end().sub(t.start()).normalize(),i=new S(-r.y,r.x).mul(e);return new M(t.start().add(i),t.end().add(i))}else{let r=t.rx;return r<e?null:q.build2(t.center,t.startAngle,t.endAngle(),r-e,r-e,t.sweep())}}getRight(t,e){if(e=e/2,t instanceof M){let r=t.end().sub(t.start()).normalize(),i=new S(r.y,-r.x).mul(e);return new M(t.start().add(i),t.end().add(i))}else{let r=t.rx;return q.build2(t.center,t.startAngle,t.endAngle(),r+e,r+e,t.sweep())}}calculate(t,e,r,i,n){let s=this.getLine(e),a=this.getLeft(s,e.width+r),l=this.getRight(s,e.width+r),c=this.getLeft(s,e.width),h=this.getRight(s,e.width),u=new Array,d=new Array,p=new Array,m=new Array;a!=null&&(u=this.getPoints(t,a)),l!=null&&(d=this.getPoints(t,l)),c!=null&&(p=this.getPoints(t,c)),h!=null&&(m=this.getPoints(t,h));let g,y;if(p.length==0||(p.length==1&&(g=p[0]),p.length>1&&p.forEach(C=>{let E=e.length;if(n){let O=C.distance1(e.start);O<=E&&(E=O,g=C)}else{let O=C.distance1(e.end);O<=E&&(E=O,g=C)}}),m.length==0))return null;m.length==1&&(y=m[0]),m.length>1&&m.forEach(C=>{let E=e.length;if(n){let O=C.distance1(e.start);O<=E&&(E=O,y=C)}else{let O=C.distance1(e.end);O<=E&&(E=O,y=C)}});let b,P;g!=null&&y!=null&&(b=this.getPoint4Distance(c,g,i,n),P=this.getPoint4Distance(h,y,i,n)),u.length==0&&(u=this.intersBBox(t,e.width,r,!0,s),u.length==0&&u.push(g));let T;if(u.length==1)T=u[0];else if(u.length>1){let C=Number.MAX_VALUE;u.forEach(E=>{let O=E.distance1(g);O<=C&&(C=O,T=E)})}d.length==0&&(d=this.intersBBox(t,e.width,r,!1,s),d.length==0&&d.push(y));let I;if(d.length==1)I=d[0];else if(d.length>1){let C=Number.MAX_VALUE;d.forEach(E=>{let O=E.distance1(y);O<=C&&(C=O,I=E)})}return b!=null&&P!=null&&T!=null&&I!=null?fe.build4([b,T,I,P]).asClose():null}getPoint(t,e){let r=Tt(t,e);if(r>0)for(let i=0;i<r;i+=2)return new S(Ee[i],Ee[i+1]);return null}getVector(t,e){if(t instanceof Ar)return e?t.end.sub(t.start):t.start.sub(t.end);if(t instanceof Si)if(e){let r=t.start.sub(t.center);return t.sweep==le.CCW?new S(-r.y,r.x):new S(r.y,-r.x)}else{let r=t.end.sub(t.center);return t.sweep==le.CCW?new S(r.y,-r.x):new S(-r.y,r.x)}}getPoints(t,e){let r=new Array;return t.primitives.forEach(i=>{this.getInters(i,e).forEach(s=>{r.push(s)})}),r}getInters(t,e){let r=new Array,i=Tt(t,e);if(i>0)for(let n=0;n<i;n+=2){let s=new S(Ee[n],Ee[n+1]);r.push(s)}return r}getLine(t){let e;return t instanceof Si?e=q.build2(t.center,t.startAngle/Math.PI*180,t.endAngle/Math.PI*180,t.radius,t.radius,t.sweep):e=new M(t.start,t.end),e}getPoint4Distance(t,e,r,i){if(t instanceof M){let n=t.end().sub(t.start()).normalize();return i?e.distance1(t.end())>r?e.add(n.mul(r)):t.end():e.distance1(t.start())>r?e.add(n.mul(-r)):t.start()}else{let n=Math.abs(r/t.rx),s=e.sub(t.center).normalize(),a=Math.atan2(s.y,s.x),l;i?t.sweep()==le.CCW?l=a+n:l=a-n:t.sweep()==le.CCW?l=a-n:l=a+n,l=(l%Vr+Vr)%Vr/Math.PI*180;let c=t.pointOn(l);return bf(t,c)?c:i?t.end():t.start()}}};function C$e(o){let t=new lK,e="add",r=rt.defaultTearDrop.applyScope,i=rt.defaultTearDrop.tearShape,n=rt.defaultTearDrop.ignoreDRC,s=rt.defaultTearDrop.circlePadViaChecked,a=rt.defaultTearDrop.circleWidth,l=rt.defaultTearDrop.circleHeight,c=rt.defaultTearDrop.specialShapedPadChecked,h=rt.defaultTearDrop.otherWidth,u=rt.defaultTearDrop.otherHeight,d=rt.defaultTearDrop.routingChecked,p=rt.defaultTearDrop.routingWidth,m=rt.defaultTearDrop.routingHeight,g=rt.defaultTearDrop.TConnectionChecked,y=rt.defaultTearDrop.TConnectionWidth,b=rt.defaultTearDrop.TConnectionHeight;return t.withTearDrop(e,r,i,n,s,a/100,l/100,c,h/100,u/100,d,p/100,m/100,g,y/100,b/100,!1,o,!0,!0)}var yfe=class extends fi{constructor(t,e,r){super(),this.text=t,this.x=e,this.y=r}open(t){let e=!1,r=!0,i=this.text.getParent();return i&&i instanceof Me&&(e=!0),["Unique ID","Name","Designator","Add into BOM","Convert to PCB"].includes(this.text.key)&&(r=!1),{action:"modify-pcb-text-suspension",left:this.x,top:this.y,content:this.getContent(),id:this.text.globalIndex,key:this.text.key,isComponentAttr:e,isEnableBreakLine:r}}modify(t){}close(t){var r,i;if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(t.action=="confirm"){let n=new ve("double click modify text");if(this.text.getParent()!=null?n.addCommand(Te.dispatch(this.text.getParent(),"modify")):n.addCommand(Te.dispatch(this.text,"modify")),OOe(x.getInstance().doctype,this.text.key,(r=this.text.getParent())==null?void 0:r.attrKeyValue[this.text.key])){let s=_Oe((i=this.text.getParent())==null?void 0:i.attrKeyValue[this.text.key])[0],a=this.text.getParent();if(a!=null&&a instanceof Me){a.modifyATTRMap(s,t["place-text-content"]);let l=a.getFormulaName();this.text.setValue(l)}}else this.text.value=t["place-text-content"];x.getInstance().doctype==4&&this.text.key=="Designator"&&!/\?$/gi.test(this.text.value)?(this.text.value=this.text.value||"",this.text.value+="?"):x.getInstance().doctype==3&&this.text.key=="Designator"&&(this.text.value=this.text.value||""),x.getInstance().doctype==4&&A.publish("flushAttrPlane",""),A.publish("clearSelect",""),n.length>0&&je.executeCommand(n)}return!0}getContent(){var t,e,r;return AOe(x.getInstance().doctype,this.text.key,(t=this.text.getParent())==null?void 0:t.attrKeyValue[this.text.key])&&!OOe(x.getInstance().doctype,this.text.key,(e=this.text.getParent())==null?void 0:e.attrKeyValue[this.text.key])?(r=this.text.getParent())==null?void 0:r.attrKeyValue[this.text.key]:this.text.value}};var bfe=class extends fi{constructor(t){super(),this.tool=t}getWidth(){return this.tool.getWidth()}open(t){return{action:"commonly-value-input",forms:[{type:"text",key:"input-value",value:Xe(this.tool!=null?this.getWidth():we.prevTrackWidth),tips:x.getInstance().unit,title:"",inputStatus:"selectAll"}],verificationType:1}}modify(t){}close(t){if(t.action=="confirm"){let i=new ft().conversion(x.getInstance().unit,"mil",parseFloat(t["input-value"])/10);if(!isNaN(i)&&!ne.less(i,Qc)){if(this.tool instanceof Vo)return this.tool.setWireWidth(i),Hi(),!0;this.tool&&this.tool.setWireWidth(i),we.prevTrackWidth=i,A.publish("flushSelectingInfo",""),Hi()}}return!0}};var Pfe=class extends fi{constructor(e){super();this.components=new Set;e.forEach(r=>{this.components.add(r)})}open(e){let r=new Set;this.components.forEach(n=>{let s=Ji.getItem(n.footprintUUID);r.add(s)});let i=new Array;return r.forEach(n=>{let s=n.uuid;i.push(s)}),{action:"update-footprint",footprintList:i}}modify(e){}close(e){if(!x.getInstance().isactive||x.getInstance().doctype!=3)return;if(e.action=="confirm"){let i=new W_("Update All","all"),n=new W_("Update Selected Only","select"),s=new FG("Whether to update all attributes of the same package in the canvas?",[i,n],a=>{a=="all"?this.updateAll(e):this.updateSelect(e),je.clear()});A.publish("openMsgbox",s)}return!0}update(e){}updateAll(e){let r=new ve("update all footprint ");e.updatedData.forEach(n=>{let s=n.uuid,l=Ji.getItem(s).getComponents(),c=new Array;for(let d of l){let p=Cr.getItem(d.globalIndex);c.push(p)}let h=new Array,u=new z1("2.0");for(let d of c){let p=u.save(d.model);h.push(p),A.publish("hasModifyPcbItem",d),r.addCommand(Te.dispatch(d,"delete")),d.remove(),A.publish("delete",d)}h.forEach(d=>{let p=new Y1(d);p.build();let m=p.items[0];A.publish("hasModifyPcbItem",m),r.addCommand(Te.dispatch(m,"add"))})}),je.executeCommand(r),A.publish("flushService","")}updateSelect(e){let r=new ve("update select footprint ");e.updatedData.forEach(n=>{let s=n.title,a=new Array;this.components.forEach(h=>{!h.isEmpty&&h.footprintId==s&&a.push(h)});let l=new Array,c=new z1("2.0");for(let h of a){let u=c.save(h.model);l.push(u),A.publish("hasModifyPcbItem",h),r.addCommand(Te.dispatch(h,"delete")),h.remove(),A.publish("delete",h)}l.forEach(h=>{h.forEach(u=>{u[6]=="Footprint"&&(u[7]=s)})}),l.forEach(h=>{let u=new Y1(h);u.build();let d=u.items[0];A.publish("hasModifyPcbItem",d),r.addCommand(Te.dispatch(d,"add"))})}),je.executeCommand(r),A.publish("flushService","")}uuid(){for(var e=[],r="0123456789abcdef",i=0;i<36;i++)e[i]=r.substr(Math.floor(Math.random()*16),1);e[14]="4",e[19]=r.substr(e[19]&3|8,1),e[8]=e[13]=e[18]=e[23]="-";var n=e.join("");return n}parseFootprintFile(e,r,i,n){let s=new Array;return s.push(["FOOTPRINT",e,{uuid:r,utime:i}]),JSON.parse(n).forEach(l=>{let c=l[0];this.isSingleItem(c)&&(c=="ATTR"&&l[6]=="Footprint"&&(l[7]=e),s.push(l))}),s.push(["END_FOOTPRINT"]),s}isSingleItem(e){switch(e){case"POUR":case"POLY":case"REGION":case"FILL":case"PAD":case"ARC":case"LINE":case"VIA":case"STRING":case"ATTR":case"DIMENSION":return!0}return!1}};var cK=class extends fi{constructor(e,r){super();this.item=null;this.tool=e,this.item=r}open(e){let r,i=x.getInstance().unit,n=new ft;if(r={action:"attribute-for-place-ind-via",netList:ze.getNet(),unit:i,needSelectNet:(this.tool instanceof cy||this.tool instanceof y2)&&x.getInstance().doctype==bi.PCB},this.item!=null)r.attrNet=this.item.net,r.outerDiameter=n.conversion("mil",i,this.item.radius*20),r.innerDiameter=n.conversion("mil",i,this.item.holeRadius*20);else{let s=te.getInstance().getDefaultRadiusPhysics();r.attrNet=rt.defaultVia.net,r.outerDiameter=n.conversion("mil",i,s.defalutRadius*20),r.innerDiameter=n.conversion("mil",i,s.defalutInner*20)}return r}modify(e){}close(e){if(e.action=="confirm"){let i=e.net;if(i==null&&(i=""),(this.tool instanceof cy||this.tool instanceof y2)&&this.item!=null&&(this.item.net=i,this.tool.flushNear(),rt.setDefaultVia(this.item),this.tool.modifyViaSize(e.holeRadius,e.radius,!1)),this.tool instanceof Vo&&(this.tool.modifyViaSize(e.holeRadius,e.radius),ie.publish("flushSelectingInfo","")),this.tool instanceof Vo){let n=this.tool.getNextTool();n?(n.viaSize(e.holeRadius,e.radius,this.tool.getEventStatus()),n.viaSize(e.holeRadius,e.radius)):this.tool.setViaSize(e.holeRadius,e.radius)}Hi()}return!0}};var Tfe=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return this.option!=null&&(e.extra=this.option),e.action="new-group",e}modify(t){}close(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(t.action=="confirm"){if(kt.getGroupByName(t.groupName))return A.publish("showPcbSlideMsg",["Group name already exists!"],$()),!1;let r=Ve.getSelects(),i=zD(r);if(i.length){let n=new ve("combination"),s=kt.combination(i,t.groupName),a=Te.dispatch(s,"add");n.addCommand(a),je.executeCommand(n),A.publish("showPcbSlideMsg",["{0} objects grouped successfully",[i.length]],$()),A.publish("flushSelectingInfo","")}else A.publish("ui/toastMsg",{type:"warn",msg:"None of the selected objects meets the conditions for joining the group"},$())}return!0}};var Ife=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return this.option!=null&&(e.extra=this.option),e.action="join-group",e}modify(t){}close(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(t.action=="confirm"){let r=Ve.getSelects(),i=zD(r);if(i.length){let n=new ve("joinCombination"),s=kt.getItem(t.groupId),a=Te.dispatch(s,"modify");n.addCommand(a),kt.joinCombination(i,t.groupId),je.executeCommand(n),A.publish("showPcbSlideMsg",["{0} objects join group successfully",[i.length]],$())}else A.publish("ui/toastMsg",{type:"warn",msg:"None of the selected objects meets the conditions for joining the group"},$())}return!0}};var Cfe=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e=wh.getItem(this.option.rulerId);A.publish("onlySelect",[e]);let r={};return this.option!=null&&(r.extra=this.option),r.action="edit-smart-dimension",r}modify(t){}close(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e=t.action,{value:r,rulerId:i,noChangeValue:n,isNew:s}=t;if(e=="confirm"&&!n)wh.setSmartDimensionLength(r,i,s);else{let a=new er,l=Vs.movedItems.map(c=>a.getItem(c));s&&Vs.addCommand(wh.getItem(i),"add"),Vs.executeCommand(),A.publish("hasModifyPcbItem",l),A.publish("flushService","")}return A.publish("flushSelectingInfo",""),!0}};var Sfe=class extends fi{constructor(t){super(),this.selectPadsNum=t.selectPadsNum,this.allPadsNum=t.allPadsNum}open(t){return{action:"renumber-pads",selectPadsNum:this.selectPadsNum,allPadsNum:this.allPadsNum}}modify(t){}close(t={}){return t.action=="confirm"&&(t.sequsence==="custom_path"?(NN.options=t,NN.customPathRenumber()):NN.renumber(t)),!0}};var Efe=class extends fi{constructor(t){super(),this.option=t}open(){if(!(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype))return{action:"generate-3d-shell-outline",extra:{...this.option}}}modify(t){}close(t){return!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype?void 0:(t.action=="confirm"&&this.generateD3ShellOutline(t.value),!0)}generateD3ShellOutline(t){let e=Ve.getSelects()[0];if((e instanceof mt||e instanceof vt)&&(e=e.getParent()),!(e instanceof Ye&&e.type==="Board Outline"))return;let r,i,n=53,s="3D Shell - Outline",a=qu(-1,s);if(e instanceof nr){let l=new S(-1,1).rotate(S.ORIGIN,e.rotation).normalize(),c=t*(2/Math.sqrt(2)),h=e.start.add(l.mul(c)),u=Xt.addRect(s,n,h,e.width+t*2,e.height+t*2,"",!1,a,e.rotation,e.cornerRadius);r=new ve("draw Rect"),i=Te.dispatch(u,"add")}else if(e instanceof Sr){let l=Zt.addCircle(s,n,e.center,e.radius+t,a,!1,"");r=new ve("draw 2DLine Circle "+s),i=Te.dispatch(l,"add")}else if(e instanceof ct){let l=new Array,c=Af(fe.build2(e.getMathGraphics().primitives),t);if(xr(c,function(p,m){return m.bbox().area()-p.bbox().area()},0,c.length),c.length>0&&c[0].items.length>0)l=c[0].items[0].primitives;else return;if(pd(s)&&!xu(l))return;let u=new io().ptsToShapes(l,n,e.strokeWidth),d=Nm(u);if(d.length>0){let p=pt.addPolygon(s,n,[d],a,"",!1);r=new ve("draw 2DLine Polygon "+s),i=Te.dispatch(p,"add")}}A.publish("autoFill",""),r!=null&&i!=null&&(r.addCommand(i),je.executeCommand(r))}};var Ofe=class extends fi{constructor(e){super();this.cache={};this.dialogType="equal-length-tuning",this.option=e,this.cache={isDiffPair:e.isDiffPair,startPoint:e.startPoint,mouseXY:e.mouseXY,reOpenDialog:e.reOpenDialog}}open(e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r={};return r.action="equal-length-tuning",this.option!=null&&(r.extra=this.option),r}modify(e){if(e.action==="updateNetLengthRule"){let{netLengthMin:r,netLengthMax:i}=e;A.publish("updateNetLengthRule",{netLengthMin:r,netLengthMax:i},$())}}command(e){let r=Wh.getTool();return(r instanceof qw||r instanceof $w)&&e.action=="netSelect"?(r.toggleMode(1),r.addedTo=e.data.addedTo,r.lengthType=e.data.lengthType,r.addedLength=e.data.addedLength,!0):!1}close(e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r=e.action,i=e.formData;if(r=="confirm"){let n=i.minHeight,s=i.isSingleSide,a=i.type,l=i.width,c=i.restrictLength,h=i.additionalLength,u=i.addedTo,{isDiffPair:d,startPoint:p,mouseXY:m,reOpenDialog:g}=this.cache,y={isSingleSide:s,type:a,width:l,minHeight:n,restrictLength:c,additionalLength:h,addedTo:u};A.publish("toggle",{command:"draw(snake_track)",isDiffPair:d,data:{...y,startPoint:p,mouseXY:m,reOpenDialog:g}}),d?A.publish("UPDATE_DIFF_PAIR_EQUAL_LENGTH_TUNING",y,$()):A.publish("UPDATE_EQUAL_LENGTH_TUNING",y,$())}return!0}};var Afe=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return e.action="edit-netClass",this.option!=null&&(e.extra=this.option),e}modify(t){this.handleData(t)}close(t){return this.handleData(t),!0}handleData(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e=t.action;if(e=="confirm"||e=="apply"){let{type:r,newNetClassList:i,oldNetClassList:n,changeName:s,nets:a,netClassName:l,oldNetClassName:c}=t;eI(r,i,n,s,a,l,c)}}};var _fe=class extends fi{constructor(t){super(),this.tool=t}open(t){let e=new ft;return{action:"commonly-value-input",forms:[{type:"text",key:"input-value",value:Xe(this.tool.stepSize),tips:x.getInstance().unit,title:"",inputStatus:"selectAll"}]}}modify(t){}close(t){if(t.action=="confirm"){let r=new ft;this.tool.stepSize=r.conversion(x.getInstance().unit,"mil",parseFloat(t["input-value"])/10)}return!0}};var vfe=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return e.action="action-for-locked-objects",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){return!x.getInstance().isactive||23==x.getInstance().doctype?void 0:(t.action=="confirm"?ls.getInstance().execute(t.status):(ls.getInstance().interrupt(),ie.publish("tool","dropdrag")),!0)}};var xfe=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return e.action="confirm-pad-move-option",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){return!x.getInstance().isactive||23==x.getInstance().doctype?void 0:(t.action=="confirm"?(tp.execute(t.moveWhole),tp.notAsking=t.notAsking):(tp.interrupt(),A.publish("tool","dropdrag")),!0)}};var Rfe=class extends zU{constructor(e={}){super(!1);this.profile=null;this.parseData(e)}parseData(e){let r=new ft,i=parseFloat(e["attr-via-column-spacing"])/10,n=parseFloat(e["attr-via-line-spacing"])/10,s=parseFloat(e["attr-via-inner-diameter"])/20,a=parseFloat(e["attr-via-diameter"])/20;this.operation=e["attr-via-operation"],this.ids=e["attr-ids"],this.columnSpacing=r.conversion(x.getInstance().unit,"mil",i),this.lineSpacing=r.conversion(x.getInstance().unit,"mil",n),this.radius=r.conversion(x.getInstance().unit,"mil",a),this.innerRadius=r.conversion(x.getInstance().unit,"mil",s),rt.setDefaultSutureVia(this.lineSpacing,this.columnSpacing)}getLayerId(){return this.profile!=null?this.profile.layerId:super.getLayerId()}handler(){this.operation==="Add"?this.addSutureVias():this.removeSutureVias()}async addSutureVias(){let e="addSutureVias-time";pn(e);let r=new er;this.ids.forEach(i=>{let n=r.getItem(i);n&&this.generateSutureVias(n)}),Bi(e)}async generateSutureVias(e){let r=()=>{this.net=e.net,this.profile=e};if(e instanceof ii)r(),await this.placeSutVias([e]);else if(e instanceof Ye&&e.type==="Copper Region")if(e.hasCopperRes()){r();let i=Array.from(e.getCopperResult()),{count:n,hasSameNetCoppers:s}=await this.placeSutVias(i,!0);this.hasEffectiveDrawn&&A.publish("rebuildCopperRegionDialog",{msg:""}),n==0&&!s&&A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before adding suture holes"},$())}else A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before adding suture holes"},$());else e instanceof Ki&&(r(),await this.placeSutVias([e]))}removeSutureVias(){let e="removeSutureVias-time";pn(e);let r=new er;this.ids.forEach(i=>{let n=r.getItem(i);n&&this.removeSuture(n)}),Bi(e)}removeSuture(e){e instanceof ii?this.rmSutViasInResult([e],e):e instanceof Ye&&e.type==="Copper Region"&&e.hasCopperRes()?this.rmSutViasInResult(e.getCopperResult(),e):e instanceof Ki?this.rmSutViasInResult([e],e):A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before removing suture holes"},$())}async placeSutVias(e,r=!1){let i=e.map(l=>oi.getFillOutline(l.model)),{vias:n,hasSameNetCoppers:s}=await this.placeSutureVias(i,r),a=n.length;if(!r&&a==0&&!s&&A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before adding suture holes"},$()),a>0){let l=new ve("draw suture via");for(let c of n){A.publish("hasModifyPcbItem",c);let h=Te.dispatch(c,"add");l.addCommand(h)}A.publish("onlySelect",n),l.length&&je.executeCommand(l),A.publish("flushService","")}return{count:a,hasSameNetCoppers:s}}searchSutureVia(e,r,i){if(r.net!==""||r instanceof ii)return i.searchNode().filter(h=>h instanceof Ge&&h.isSuture);let n=i.buildBBox(),s=Vt.searchByType(n,"Via").vias;if(s.size===0)return[];let a=r.net===""&&r instanceof Ki?r.pls[0]:r.model.getMathGraphics(),l=_u.getInstance().addCache(r.model.globalIndex,r.model.layerId,a,0),c=[];for(let h of s){if(!h.isSuture)continue;e.checkCache(l,bh.getCache(h.model),0).relate===0&&c.push(h)}return c}rmSutViasInResult(e,r){let i=new CC,n=new ve("delete suture via");for(let s of e){let a=this.searchSutureVia(i,r,s);for(let l of a)if(l.net==r.net&&xe(this.radius*2,2)==xe(l.radius*2,2)&&xe(this.innerRadius*2,2)==xe(l.holeRadius*2,2)){let c=Te.dispatch(l,"delete");n.addCommand(c),l.remove(),A.publish("delete",l)}}n.length&&je.executeCommand(n),A.publish("flushService","")}};var Dfe=class extends fi{constructor(t){super(),this.option=t}open(){if(!(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype))return this.getDialogData(this.option)}getDialogData(t){let e=x.getInstance().unit,r=new ft;return{action:"attribute-auto-place-sut-via",diameter:r.conversion("mil",e,t.radius*20),innerDiameter:r.conversion("mil",e,t.innerRadius*20),lineSpacing:r.conversion("mil",e,t.lineSpacing*10),columnSpacing:r.conversion("mil",e,t.columnSpacing*10),unit:e,ids:t.ids}}modify(t){}close(t){return!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype?void 0:(t.action=="confirm"&&new Rfe(t).handler(),!0)}};var wfe=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return e.action="delete-element",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e=t.action,r=t.status,i=pV.getInstance();return e=="confirm"?(i.execute("deleteAll"),i.changeDefSelect(r,"deleteAll")):e=="cancel"?(i.execute("remainComponent"),i.changeDefSelect(r,"remainComponent")):e=="close"&&(i.execute("remainAll"),ie.publish("tool","dropdrag")),!0}};var Lfe=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return e.action="combination-cancel",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){return!0}};var hK=te.getInstance(),Mfe=class extends fi{constructor(t){super(),this.dialogType="pcb-batch-fanout",this.data=t}open(t){return this.getDialogMessage()}async modify(t){if(!(!x.getInstance().isactive||![3].includes(x.getInstance().doctype)))if(t.action==="apply"){let e=t.formData,r=Ve.getSelects(),{message:i}=await ie.messageBus.rpcCall("batchFanout",{items:r,config:e});i||ie.publish("ui/toastMsg",{type:"info",msg:"Please select the component or pad to fanout on the canvas"},$())}else ie.publish("refreshBatchFanoutDialog",this.getDialogMessage(),$())}close(t){}getDialogMessage(){let t=hK.getDefaultBlindPhysics(),e=x.getInstance().unit,r=t.getOptions(),i=this.getViaLayerOptions(),n=this.getDefaultTrackRule(),s=this.getDefaultViaSizeRule(),a=this.getBlindViaSizeRule(),l={unit:e,blindRuleOptions:r,viaLayerOptions:i,defaultTrackRule:n,defaultViaSizeRule:s,blindViaRules:a};return{action:this.dialogType,data:l}}getViaLayerOptions(){let t=new Array,e=$e.getInstance().getAllItem();for(let r of e)r.config&&(gs(r.type)||Rh(r.type))&&t.push({text:r.name,value:r.layerId});return t}getDefaultTrackRule(){let t=hK.getDefaultTrackPhysics();return{defaultWidth:this.getNum(t.getDefaultWidth())}}getDefaultViaSizeRule(){let t=hK.getDefaultRadiusPhysics();return{defaultDiameter:this.getNum(t.defalutRadius)*2,defaultInnerDiameter:this.getNum(t.defalutInner)*2}}getBlindViaSizeRule(){let t=[],e=hK.getDefaultBlindPhysics().getAllVias();for(let r of e){let i=hK.getRadiusPhysicsByName(r.viaSizeRule);t.push({blindViaName:r.name,ViaSizeRule:{defaultDiameter:this.getNum(i.defalutRadius)*2,defaultInnerDiameter:this.getNum(i.defalutInner)*2}})}return t}getNum(t){return t*10}};var Nfe=class extends fi{constructor(t){super(),this.option=t}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return this.option!=null&&(e.extra=this.option),e.action="join-net-group",e}modify(t){}close(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(t.action=="confirm"){let r=t.isNetClass?te.getInstance().getNetClass(t.netGroup):te.getInstance().getEqualLengthGroup(t.netGroup);t.nets.map(i=>{let n=te.getInstance().getNet(i);r instanceof Eu?r.addNetwork(n):r.addEqualLengthGroup(n),Ql(i)}),t.isNetClass?A.publish("forceRenderTree",tn.NetClasses,$()):A.publish("forceRenderTree",tn.EqualLengthGroups,$()),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}return!0}};var kfe=class extends fi{constructor(t){super(),this.tool=t}open(t){return{action:"commonly-value-input",forms:[{type:"text",key:"input-value",value:this.tool.getColumns(),tips:"",title:"",inputStatus:"selectAll"}],verificationType:1}}modify(t){}close(t){if(t.action=="confirm"){let r=parseInt(t["input-value"]);!isNaN(r)&&!ne.less(r,.01)&&this.tool.setColumns(r)}return!0}};var Bfe=class extends fi{constructor(t,e,r){super(),this.option=t,this.tool=e,this.allReuseGroupInfo=r}open(t,e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r={};return r.action="reuse_layout_route",this.option!=null&&(r.extra=this.option),this.tool.drawing=!1,this.tool._isDialogOpen=!0,r}modify(t){}close(t){let{position:e,fac:r,others:i}=this.tool.otherInfo,{templateData:n}=this.option,{action:s}=t;if(s==="confirm")this.tool.drawing=!0;else return this.tool._isDialogOpen=!1,A.publish("tool","dropdrag"),!0;let a=this.handleTemplateData(t),l=n.templateInfos[0].id;return a.length==0&&i.length==0?(this.tool.sendMessage("No exact matching",null),A.publish("tool","dropdrag")):this.tool instanceof Ww&&this.tool.hasLock(a,e,r,i,l),this.tool._isDialogOpen=!1,!0}handleTemplateData(t){let{templateInfo:e,allNotMatch:r}=t;if(r)return[];if(this.allTemplateNotMatch(e))return[];let i=[],n=new Set;for(let a of e){let l=a.id;if(a.match.id===""){n.add(l);continue}for(let c of this.allReuseGroupInfo.reuseMap){let h;if(l===c.templateInfo.id){for(let u of c.matchList)u.id===a.match.id&&(h=u);c.matchList.length=0,c.matchList.push(h)}}}let s=[];for(let a of this.allReuseGroupInfo.reuseMap)n.has(a.templateInfo.id)||s.push(a);this.allReuseGroupInfo.reuseMap.length=0;for(let a of s)this.allReuseGroupInfo.reuseMap.push(a);return i.push(this.allReuseGroupInfo),i}allTemplateNotMatch(t){let e=!0;for(let r of t)if(r.match.id!==""){e=!1;break}return e}};var Ffe=class extends fi{constructor(){super()}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};return e.action="pinDelayManager",e.value=as.getInstance().getAllCompPadLenInfo(),e}modify(t){}close(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(t.action=="confirm"){let r=[],i=t.value.value,n=t.value.unit,s=as.getInstance(),a=new ft,l=[];for(let c of i){let h=c.hashId,u=!1;for(let d of c.pads)if(d.padLen!=null){let p=a.conversion(n,"mil",d.padLen)/10,m=s.getPadLen(h,d.hashId);if(!ne.eq(p,m)){let g=Kt.getItem(d.hashId);l.push(g),u=!0}}u&&r.push(c)}if(as.getInstance().updatePadLen(t.value),l.length>0){let c=new hu("2.0",x.getInstance().doctype,x.getInstance().compiler),h=new Set;l.forEach(u=>{ze.modifyNet(u.net),c.feed("PAD_NET",u.model),h.add(u.net)}),h.forEach(u=>{ze.getNetLength(u)}),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),A.publish("flushService","")}}return!0}};var zN=class zN{constructor(){this._netLists={};this.refreshNetLists(),A.subscribe("closeDialogAndRebuildCopper",this.rebuildCopper.bind(this))}static getInstance(){return zN.manager==null&&(zN.manager=new zN),zN.manager}get netLists(){return this._netLists}setNetLists(t){if(t)for(let[,e]of Object.entries(t)){let{net:r,checked:i,requiredQuantity:n}=e;this._netLists[r]&&(this._netLists[r]={checked:i,requiredQuantity:n})}}refreshNetLists(){let t=ze.getAllNets(),e=Object.keys(this._netLists);t.forEach(r=>{this._netLists[r]||(this._netLists[r]={checked:!0,requiredQuantity:1})}),e.forEach(r=>{t.includes(r)||delete this._netLists[r]})}rebuildCopper(){this.needRebuild&&A.publish("rebuildCopperRegionDialog",{msg:"Test point have been placed,do you want to rebuid the copper area?"})}};zN.manager=null;var YN=zN;var JC=class JC{static publishLog(t,e){let{type:r,message:i,timeStamp:n}=t;switch(e){case"start":A.publish("bottomBarLogGroupStart","Log",$()),A.publish("logI18nLogView1",{timeStamp:n,type:r,msg:i,openTab:!0},$());break;case"content":A.publish("bottomBarLog",{timeStamp:n,type:r,msg:i,openTab:!0},$());break;case"end":A.publish("logI18nLogView1",{timeStamp:n,type:r,msg:i,openTab:!0},$()),A.publish("bottomBarLogGroupEnd","Log",$());break}}static logStartGeneratingTestPoints(){this.publishLog({timeStamp:new Date().getTime(),type:"info",message:[{text:"Start generating test points"}]},"start")}static formatPads(t){return t.map(e=>({text:`(${xe(e.center.x,2)}, ${xe(e.center.y,2)}) , `,call:{cmd:"showAndUpdateCross",args:e.center}}))}static formatNets(t,e){return t.map(r=>({text:r,attr:{id:e(r).map(i=>i.globalIndex),pcbid:x.getInstance().tabId}}))}static logRemoveTestPoints(t,e,r){this.publishLog({timeStamp:r,type:"info",message:['<span class="i18n">remove test points</span>',String(e.length),'<span class="i18n">item</span>',...this.formatPads(e)]},"content")}static logGenerateTestPoints(t,e,r){let i=e.map(n=>({text:n.num,attr:{id:n.globalIndex,pcbid:x.getInstance().tabId}}));this.publishLog({timeStamp:r,type:"info",message:[{text:t,attr:{id:ze.getSameNetItems(t).map(n=>n.globalIndex),pcbid:x.getInstance().tabId}},'<span class="i18n">generates test points</span>',String(e.length),'<span class="i18n">item</span>',...i]},"content")}static logDRCViolation(t,e){this.publishLog({timeStamp:e,type:"info",message:[String(t.length),'<span class="i18n">net have no test points generated because of DRC violations</span>',...this.formatNets(t,r=>ze.getSameNetItems(r))]},"content")}static logRequiredNumberMet(t,e){this.publishLog({timeStamp:e,type:"info",message:[String(t.length),'<span class="i18n">net have no test points generated because the required number of test points was met</span>',...this.formatNets(t,r=>Kt.getAllTestPad().filter(i=>i.net===r))]},"content")}static logNoTracksNets(t,e){this.publishLog({timeStamp:e,type:"info",message:[String(t.length),'<span class="i18n">net have no test points generated because there were no regions to generate</span>',...this.formatNets(t,r=>ze.getSameNetItems(r))]},"content")}static logCurrentNetCoverage(t,e,r){let i=new Date().getTime(),n=r.toFixed(1);this.publishLog({timeStamp:i,type:"info",message:cY("Current Run: Net Coverage {0}% (Successfully Added Nets: {1} / Target Nets: {2})",{params:{0:n,1:t,2:e}})},"content")}static logGlobalCoverage(t,e,r){let i=new Date().getTime(),n=r.toFixed(1);this.publishLog({timeStamp:i,type:"info",message:cY("Global Testpoint Coverage: {0}% (Total Covered Nets: {1} / Total Nets: {2})",{params:{0:n,1:t,2:e}})},"content")}static logFinishGeneratingTestPoints(){this.publishLog({timeStamp:new Date().getTime(),type:"info",message:[{text:"Finish generating test points"}]},"end")}static clear(){JC.deleteMap=new Map,JC.addMap=new Map,JC.violateDRC=new Map,JC.overNum=new Map,JC.noTracksNetSet=new Map}};JC.deleteMap=new Map,JC.addMap=new Map,JC.violateDRC=new Map,JC.overNum=new Map,JC.noTracksNetSet=new Map;var kc=JC,KAe=class{constructor(){this.nodes=new Set,this.edges=new Map}addNode(t){this.nodes.add(t)}addEdge(t,e,r){this.edges.has(t)||this.edges.set(t,[]),this.edges.get(t).push({track:e,index:r,visited:!1})}markEdgeVisited(t,e,r){let i=this.edges.get(t);if(i){let n=i.find(s=>s.track===e&&s.index===r);n&&(n.visited=!0)}}isEdgeVisited(t,e,r){let i=this.edges.get(t);if(i){let n=i.find(s=>s.track===e&&s.index===r);return n?n.visited:!1}return!1}getEdgeId(t){return t.map(e=>e.globalIndex).sort().join("-")}getTracks(){let t=new Set;for(let[,e]of this.edges)for(let r of e)r.track.length&&r.track.forEach(i=>t.add(i));return Array.from(t)}},ZAe=class{constructor(t){this.ignoreDRC=t,this.visitedObjMap=new Map}createVisitedObjForCluster(t){let e=this.getVisitedObjForCluster(t);if(e)return e;let r;return this.ignoreDRC?r=new Array:r=this.buildVisitedObj(),this.visitedObjMap.set(t,r),r}getVisitedObjForCluster(t){return this.visitedObjMap.get(t)}buildVisitedObj(){return{visitedPads:new Map,visitedVias:new Map,visitedTracks:new Map}}},JAe=class{constructor(t){this.depth=0;this.maxDepthCache=new Map;this.exceedCount=new Map;this.exceedThreshold=t}getMaxDepth(t,e){if(!this.maxDepthCache.has(t)){let r=e();this.maxDepthCache.set(t,r)}return this.maxDepthCache.get(t)}incrementDepth(){this.depth++}decrementDepth(){this.depth--}hasExceededMaxDepth(t){return this.depth>=t}checkExceed(t){let e=this.exceedCount.get(t)||0;return e++,this.exceedCount.set(t,e),e>=this.exceedThreshold}reset(){this.depth=0}getExceedCount(t){return this.exceedCount.get(t)||0}},Vfe=class{constructor(t){this.init(t)}init(t){let{commonOptions:e,testPointOptions:r,netLists:i}=t;this.commonOptions=e,this.testPointOptions=r,this.step=this.calculateStep(),this.netLists=i.filter(n=>n.checked),this.groupCommand=new ve("Execute Auto Place Test Pad Service"),uf.onlyCheck=!0,YN.getInstance().needRebuild=!1,this.commonOptions.ignoreDRC||(this.recursionManager=new JAe(3))}execute(){if(pn("$$ AutoPlaceTestPadService"),!this.netLists.length)return;kc.logStartGeneratingTestPoints();let t=this.commonOptions.operationType;t==="Add"?this.handleAdd():t==="Remove"&&this.handleDelete(),this.groupCommand.length>0&&je.executeCommand(this.groupCommand),this.complete(),Bi("$$ AutoPlaceTestPadService")}complete(){A.publish("flushService",""),this.publishErrorLog(),kc.clear(),sn.getInstance().useForceModelPairClearance=!1,this.testPointCache=null,this.recursionManager=null}handleAdd(){this.commonOptions.removeExisting&&this.handleDelete(),this.commonOptions.allowedWithinComponent||(this.componentLists=Cr.getAllItem());let e=this.filterSatisfyQuantity(),r=this.divideEffectiveScope(e);this.run(r,e),this.rebuildCopper()}handleDelete(){let t=this.netLists.map(i=>i.net),e=Kt.getAllTestPad().filter(i=>!i.getParent()&&t.includes(i.net));switch(this.commonOptions.layer){case"Only Top":e=e.filter(i=>i.layerId==1);break;case"Only Bottom":e=e.filter(i=>i.layerId==2);break}e.forEach(i=>{let n=Te.dispatch(i,"delete");this.groupCommand.addCommand(n),i.remove();let s=kc.deleteMap.get(i.net)||{pads:[],timeStamp:new Date().getTime()};kc.deleteMap.set(i.net,{pads:[...s.pads,i],timeStamp:s.timeStamp})})}divideEffectiveScope(t){let e=t.map(s=>s.net);e.forEach(s=>{ze.getSameNetItems(s,l=>l instanceof Ue).length==0&&kc.noTracksNetSet.set(s,new Date().getTime())});let r=pr.getAllItem().filter(s=>e.includes(s.net));switch(this.testPointOptions.singleLayer&&(r=r.filter(s=>[1,2].includes(s.layerId))),this.commonOptions.layer){case"Only Top":r=r.filter(s=>s.layerId==1);break;case"Only Bottom":r=r.filter(s=>s.layerId==2);break}return r}filterSatisfyQuantity(){let t=new Array;for(let e of this.netLists){let{net:r,requiredQuantity:i}=e,n=ze.getSameNetItems(r,s=>s instanceof Le&&s.isTestPad);if(i<=n.length){kc.overNum.set(r,new Date().getTime());continue}n.length>0&&(e.requiredQuantity=e.requiredQuantity-n.length),t.push(e)}return t}compareClusters(t,e){var s,a;let r=l=>l===1?0:l===2?1:2,i=r((s=t.graph.getTracks()[0])==null?void 0:s.layerId),n=r((a=e.graph.getTracks()[0])==null?void 0:a.layerId);return i-n}buildCluster(t,e,r){let i=[t];for(r.add(t);i.length>0;){let n=i.shift();if(n instanceof Ue){let s=n.searchCycleNode();for(let a of s){if(a instanceof Le||a instanceof Ge){e.addNode(a);let l=new Bu(n,!0).all,c=Array.from(l);e.addEdge(a,c,e.getEdgeId(c))}r.has(a)||(r.add(a),i.push(a))}}}}clusterTracks(t){let e=new Map,r=new Set;for(let i of t)if(!r.has(i)){let n=new KAe;this.buildCluster(i,n,r);let s=Array.from(n.nodes).filter(c=>c instanceof Le),a=Array.from(n.nodes).filter(c=>c instanceof Ge),l={pads:s,vias:a,graph:n,isFull:!1};e.has(i.net)?e.get(i.net).push(l):e.set(i.net,[l])}for(let[i,n]of e)n.sort((s,a)=>this.compareClusters(s,a));return e}rebuildCopper(){for(let{pads:t}of kc.addMap.values())for(let e of t){let r=this.getModelPair(e,!0),i=Y5(r);if(uf.checkSpacing(i).fail.length>0){YN.getInstance().needRebuild=!0;break}}}breakPrimitives(t,e,r){let i=[],n=this.testPointOptions.singleLayer?3:4,s=[...e.pads,...e.vias],a=e.graph.getTracks();for(let c of t){let h=c.start(),u=c.end(),d=h,m=s.flatMap(y=>{let b=y.layerId===12?2:1,P=this.step+r.getItemMaxClearance(b,[n]),T=y.getMathGraphics(a[0].layerId,P);return this.findIntersections(c,T)}).sort((y,b)=>y.distance1(h)-b.distance1(h));for(let y of m){let b;c instanceof M?b=new M(d,y):c instanceof q&&(b=q.build4(d,y,c.center,c.rx,c.ry,c.sweep())),b&&i.push(b),d=y}let g;c instanceof M?g=new M(d,u):c instanceof q&&(g=q.build4(d,u,c.center,c.rx,c.ry,c.sweep())),g&&i.push(g)}return i.filter(c=>!s.some(h=>h.center.equals1(c.start())||h.center.equals1(c.end())))}calculateStep(){let{shape:t,rotationAngle:e}=this.testPointOptions,{diaMeter:r,width:i,height:n,ratio:s}=this.getShapeSpecificConfigs(t,this.testPointOptions),a=uc(parseFloat(e))/180*Math.PI,l,c=(h,u)=>{let d=Math.abs(h*Math.cos(a))+Math.abs(u*Math.sin(a)),p=Math.abs(h*Math.sin(a))+Math.abs(u*Math.cos(a));return{rotatedWidth:d,rotatedHeight:p}};switch(t){case"ELLIPSE":l=r/2;break;case"RECT":case"OVAL":{let{rotatedWidth:h,rotatedHeight:u}=c(i,n);l=Math.max(h,u)/2;break}default:throw l=r/2,new Error(`TestPad Error calculateStep: ${t}`)}return l}ignoreDRCPlaceTestPad(t,e,r){for(let i of t)if(!e.some(n=>n.equals1(i))){if(!this.commonOptions.allowedWithinComponent&&this.componentLists.some(l=>l.buildBBox().isContains(i)))continue;e.push(i);let n=this.placeTestPad(i,r),s=kc.addMap.get(r)||{pads:[],timeStamp:new Date().getTime()};return kc.addMap.set(r,{pads:[...s.pads,n],timeStamp:s.timeStamp}),this.add2Command(n),!0}return!1}ignoreDRCGenerateAl(t,e,r,i){this.testPointCache||(this.testPointCache=new Map);let n=`${e}-${t}`;if(this.testPointCache.has(n)){let b=this.testPointCache.get(n);return this.ignoreDRCPlaceTestPad(b,i,e)}let{pads:s,vias:a,graph:l}=r,c=l.getTracks().flatMap(b=>b.primitive),h=te.getInstance().getSafeSpacingByNet(e,2),u=this.testPointOptions.singleLayer?3:4,d=h.getItemMaxClearance(u,[3,4]),p=[...s,...a],m=this.step*2+d,g=this.breakPrimitives(c,r,h),y=this.generatePoints(g,m).filter(b=>!p.some(P=>Jr.inPolyline(b,P.getMathGraphics(l.getTracks()[0].layerId,d))));return this.testPointCache.set(n,y),this.ignoreDRCPlaceTestPad(y,i,e)}generateTestPointAl(t,e,r,i){var R;this.recursionManager.reset();let{pads:n,vias:s,graph:a}=r,{visitedPads:l,visitedVias:c}=i,h,u,d=!1;if(n.length&&l.size<n.length?(h=n,u=l):s.length&&c.size<s.length?(h=s,u=c):d=!0,d){let v=a.getTracks(),D=v.flatMap(F=>F.primitive),w=this.generatePoints(D,this.step*2+1);return w&&w.length?this.checkTestPadDRCError(t,e,v,w)?(r.isFull=!0,!1):!0:(r.isFull=!0,!1)}let p=h.find(v=>!u.has(v));if(!p)return r.isFull=!0,!1;let m,g,y,b,P=a.edges.get(p);if(!P)return r.isFull=!0,!1;let T=!1,I=0,C=10,E=te.getInstance().getSafeSpacingByNet(e,2),O=this.testPointOptions.singleLayer?3:4,_=E.getItemMaxClearance(O,[3,4]);for(;;){if(I>=C)return kc.violateDRC.set(e,new Date().getTime()),console.warn(`$$ AutoTestPad Max retries reached for net: ${e}. Forcing termination.`),!0;let v=!1;for(let w=0;w<P.length;w++){if(b=P[w],b.visited)continue;let F=b.track,H=(R=F.find(G=>p.model instanceof Je&&p.model.isUnuseLayer(G.layerId)))==null?void 0:R.layerId,z=p.model.getMathGraphics(H!=null?H:F[0].layerId,this.step+_);for(let G of F)if(g=this.findIntersections(G.primitive,z),T||(g=g.filter(W=>W.length&&!Array.from(u.values()).some(L=>Jr.inPolyline(W,L)))),g.length){y=F,m=p.model.getMathGraphics(H!=null?H:F[0].layerId),v=!0;break}if(v)break}if(v)if(u.set(p,m),this.checkTestPadDRCError(t,e,y,g)){if(b.visited=!0,P.some(F=>!F.visited))continue}else return!0;else b.visited=!0,T=!0,u.set(p,p.model.getMathGraphics(b.track[0].layerId));let D=this.findUnvisitedEdgeParams(a);if(!D){this.clusters.get(e).length==1&&kc.violateDRC.set(e,new Date().getTime());break}p=D.item,P=D.edgeParams,I++}return r.isFull=!0,!1}findUnvisitedEdgeParams(t){for(let[e,r]of t.edges)if(r.findIndex(n=>!n.visited)!==-1)return{item:e,edgeParams:r};return null}pointInPrimitive(t,e){let r=!1;return e instanceof M?r=Xa(t,e.start(),e.end(),.01):e instanceof q&&(r=xf(t,e.center,e.rx,e.startAngle/180*Math.PI,e.endAngle()/180*Math.PI,e.sweep(),.01)),r}findCluster(t){let e=t.filter(n=>!n.isFull),r=e.findIndex(n=>n.pads.length>0);if(r!==-1)return r;let i=e.findIndex(n=>n.vias.length>0);return i!==-1?i:t.length>0?0:null}run(t,e){if(e.length==0)return;this.clusters=this.clusterTracks(t);let r=this.commonOptions.ignoreDRC;for(let i of e){let n=new ZAe(r),{net:s,requiredQuantity:a}=i,l=this.clusters.get(s);if(!l)continue;let c=a,h=l.length,u=this.findCluster(l);if(u===null)continue;let d=0;for(;c>0;){let p=!1;for(let m=0;m<h;m++){let g=(u+d+m)%h,y=l[g];if(!y.isFull){if(r){let b=n.createVisitedObjForCluster(g);p=this.ignoreDRCGenerateAl(g,s,y,b)}else{let b=n.createVisitedObjForCluster(g);p=this.generateTestPointAl(g,s,y,b)}if(p){c--,d=(d+m+1)%h;break}}}if(!p){kc.violateDRC.set(s,new Date().getTime());break}}}}getModelPair(t,e=!1){let r=[],i=ple([t]),n=fle(i),s=new K1;return n.forEach((a,l)=>{for(let c of a)if(e)c instanceof lr&&c.type=="Copper Region"&&rG(s,l,c).forEach(h=>{c&&r.push([l,c,h])}),(c instanceof Pn||c instanceof Cn)&&rG(s,l,c).forEach(h=>{c&&r.push([l,c,h])});else{if(c instanceof lr&&c.type=="Copper Region"||c instanceof Pn||c instanceof Cn||c instanceof yt&&c.net==l.net)continue;if(!this.commonOptions.allowedWithinComponent&&c instanceof vi&&(l.layerId===12||l.layerId===c.layerId)){sn.getInstance().useForceModelPairClearance||(sn.getInstance().useForceModelPairClearance=!0),r.push([l,c,3]),sn.getInstance().ruleHelper.setModelPairClearance(.1,l,c,By(l.layerId,c.layerId),3),l.layerId===12&&(r.push([l,c,0]),sn.getInstance().ruleHelper.setModelPairClearance(.1,l,c,By(l.layerId,c.layerId),0));continue}s.checkSameNet=!0,rG(s,l,c).forEach(h=>{c&&r.push([l,c,h])}),s.checkSameNet=!1}}),r}checkTestPadDRCError(t,e,r,i,n,s=!1){let a=`${e}-${t}`,l=this.recursionManager,c=l.getMaxDepth(a,()=>{let u=te.getInstance().getSafeSpacingByNet(e,2),d=this.testPointOptions.singleLayer?3:4,p=u.getItemMaxClearance(d,[3,4]),m=this.step*2+p,g=r.flatMap(P=>P.primitive),y=this.clusters.get(e)[t].pads.filter(P=>!P.isTestPad),b=this.generatePoints(g,m).length*3+y.length;return b>50?50:b});if(l.hasExceededMaxDepth(c)){if(l.checkExceed(a))return kc.violateDRC.set(e,new Date().getTime()),this.clusters.get(e)[t].isFull=!0,console.warn(`$$ Max recursion depth exceeded threshold for net: ${e}.`),!1;console.warn(`$$ Max recursion depth exceeded for net: ${e} , times:${l.getExceedCount(a)}`)}else l.incrementDepth();let h=r.flatMap(u=>u.primitive);if(i.length===1){let u=this.placeTestPad(i[0],e);this.add2Command(u);let d=this.getModelPair(u),p=Y5(d),m=uf.checkSpacing(p);return m.fail.length?this.handleDRCError(u,m,h,i,n,t,e,r,s):this.handleNoDRCError(u,t,e,r,i,s)}else{let u=null,d=1/0;for(let p of i){let m=this.placeTestPad(p,e);this.add2Command(m);let g=this.getModelPair(m),y=Y5(g),b=uf.checkSpacing(y);b.fail.length<=d?(u&&(this.add2Command(u,"delete"),Kt.delete(u),u.remove()),d=b.fail.length,u=m):(this.add2Command(m,"delete"),Kt.delete(m),m.remove())}if(u){let p=this.getModelPair(u),m=Y5(p),g=uf.checkSpacing(m);return g.fail.length?this.handleDRCError(u,g,h,i,n,t,e,r,s):this.handleNoDRCError(u,t,e,r,i,s)}}return l.decrementDepth(),!1}handleDRCError(t,e,r,i,n,s,a,l,c){let h=-1/0,u;if(e.fail.every(p=>{let m=p.id1===t.globalIndex?pc(p.id2):pc(p.id1);return m instanceof ss&&m.type==="TearDrop"})){let p=kc.addMap.get(a)||[],m;return Array.isArray(p)?m={pads:p,timeStamp:new Date().getTime()}:m=p,kc.addMap.set(a,{pads:[...m.pads,t],timeStamp:m.timeStamp}),!1}for(let p of e.fail){let m=p.id1==t.globalIndex?pc(p.id2):pc(p.id1);if(m instanceof ss&&m.type=="TearDrop")continue;let g=0;m instanceof vi?g=.1:{clearance:g}=sn.getInstance().ruleHelper.getShape2Clearance(t.model,m,void 0,p.holeState);let y=g+p.distance;if(y>h){h=y;let b=m.getMathGraphics(p.collideLayerIds[0]==12?1:p.collideLayerIds[0]);u=AT.zoomPolygon(b,h+this.step)}}if(u){let m=r.flatMap(g=>this.findIntersections(g,u)).filter(g=>g.length).filter(g=>!i.some(y=>y.equals1(g)));if(n&&(m=m.filter(g=>!Jr.inPolyline(g,n))),m.length){if(this.add2Command(t,"delete"),Kt.delete(t),t.remove(),this.checkTestPadDRCError(s,a,l,m,u,c))return!0}else return this.add2Command(t,"delete"),Kt.delete(t),t.remove(),!0}return!1}handleNoDRCError(t,e,r,i,n,s){if(!s){let a=this.clusters.get(r)[e];a.pads.push(t),a.graph.addEdge(t,i,a.graph.getEdgeId(i));let l=kc.addMap.get(r)||{pads:[],timeStamp:new Date().getTime()};kc.addMap.set(r,{pads:[...l.pads,t],timeStamp:l.timeStamp})}return!1}findIntersections(t,e){let r=t.end(),i=t.bbox(),n=new Ba;n.add(r);for(let a of e.primitives){let l=a.bbox();if(!i.isIntersect(l))continue;let c=Tt(t,a);for(let h=0;h<c;h+=2){let u=new S(Ee[h],Ee[h+1]);n.add(u)}}let s=this.sortInters(n,t);if(s.length>0)return s.filter(a=>!a.equals1(r))}sortInters(t,e){let r=t.iterator(),i=new Array;for(;r.hasNext();){let n=r.next();i.push(n)}return dn(i,e)}add2Command(t,e="add"){let r=Te.dispatch(t,e);this.groupCommand.addCommand(r)}generatePoints(t,e){let r=[],i=0,n,s=(l,c,h)=>new S(l.x+h*(c.x-l.x),l.y+h*(c.y-l.y)),a=(l,c,h)=>{let u=[],d=h;if(l instanceof M){let p=l.start(),m=l.end();for(n=l.length();d<n;)u.push(s(p,m,d/n)),d+=c}else if(l instanceof q){n=l.length();let{startAngle:p,sweepAngle:m}=l;for(;d<n;){let g=d/n,y=p+g*m;u.push(l.pointOn(y)),d+=c}}return{points:u,remainingOffset:d-n}};return t.forEach(l=>{let c=a(l,e,i);r.push(...c.points),i=c.remainingOffset}),r}generateTestPadName(t){let e=Kt.getAllTestPad(),r=new Set(e.map(s=>{let a=s.getParent();return a&&a instanceof Me?a.designator+s.num:s.num})),i=1,n=t+i;for(;r.has(n);)i++,n=t+i;return n}getLayerCode(t,e,r){if(!e)return 12;switch(r){case"Only Top":return 1;case"Only Bottom":return 2;default:let{point:i,net:n}=t;for(let s of this.clusters.get(n)){let a=s.graph.getTracks().find(l=>l.isSelect(i.x,i.y));if(a)return a.layerId}}}convertValue(t){let e=parseFloat(t)/10;return VS(e)}getSolderConfigs(t){let e={};return[{key:"topSolder",configKey:"topSolder"},{key:"bottomSolder",configKey:"bottomSolder"},{key:"paste",configKey:"paste"},{key:"solder",configKey:"solder"}].forEach(i=>{let n=this.convertValue(t[i.key]);isNaN(n)||(e[i.configKey]=n)}),e}getShapeSpecificConfigs(t,e){let{diaMeter:r,width:i,height:n,ratio:s}=e,a={};switch(t){case"ELLIPSE":a.diaMeter=this.convertValue(r);break;case"RECT":a.width=this.convertValue(i),a.height=this.convertValue(n),a.ratio=ka(s/100,2);break;case"OVAL":a.width=this.convertValue(i),a.height=this.convertValue(n);break}return a}getTestPointConfig(){let{singleLayer:t,numberPrefix:e,shape:r,diaMeter:i,width:n,height:s,ratio:a,rotationAngle:l,holeDiaMeter:c,isFollowRule:h,topSolder:u,bottomSolder:d,paste:p,solder:m}=this.testPointOptions;return{singleLayer:t,num:this.generateTestPadName(e),type:r,rotation:uc(parseFloat(l))/180*Math.PI,holeDiaMeter:this.convertValue(c),isFollowRule:h,...this.getSolderConfigs({topSolder:u,bottomSolder:d,paste:p,solder:m}),...this.getShapeSpecificConfigs(r,{diaMeter:i,width:n,height:s,ratio:a})}}placeTestPad(t,e){(ze.getItem(e)==null||ze.getItem(e).size==0)&&(e="");let{singleLayer:r,num:i,type:n,diaMeter:s,width:a,height:l,ratio:c,rotation:h,holeDiaMeter:u,isFollowRule:d,topSolder:p,bottomSolder:m,paste:g,solder:y}=this.getTestPointConfig(),b=this.getLayerCode({point:t,net:e},r,this.commonOptions.layer),P=r?Math.min(a,l)*.3:u/2;s&&(a=s,l=s);let T,I,C,E;if(d){T=1;let w=te.getInstance();if(r){let F=w.getPasteExpansionByNet(e),H=w.getSolderExpansionByNet(e);b===1?(I=F.testPointTopExpansion,C=H.testPointTopExpansion):b===2&&(I=F.testPointBottomExpansion,E=H.testPointBottomExpansion)}else{let F=w.getSolderExpansionByNet(e);C=F.testPointTopExpansion,E=F.testPointBottomExpansion}}else T=2,r?(I=g,b===1?C=y:b===2&&(E=y)):(C=p,E=m);let O=a!=null?a:rt.defalutTestPad.topWidth,_=l!=null?l:rt.defalutTestPad.topHeight,R=c!=null?c:rt.defalutTestPad.topRatio,v=E!=null?E:rt.defalutTestPad.bottomSolderExpansion,D=Kt.addPad(b,1,"",t,n,O,_,R,n,O,_,R,n,O,_,R,h,!1,e,T,I,C,v,[],!0,rt.defalutTestPad.holeLength,P,rt.defalutTestPad.holeShape,rt.defalutTestPad.holeRotation,rt.defalutTestPad.holeOffset);return D.num=i,D.isTestPad=!0,D}publishErrorLog(){if((this.commonOptions.operationType=="Remove"||this.commonOptions.removeExisting)&&kc.deleteMap.forEach((n,s)=>{kc.logRemoveTestPoints(s,n.pads,n.timeStamp)}),kc.noTracksNetSet.size>0){let n=Array.from(kc.noTracksNetSet),s=n.map(([l])=>l),a=n[n.length-1][1];kc.logNoTracksNets(s,a)}if(this.commonOptions.operationType=="Add"&&kc.addMap.forEach((n,s)=>{kc.logGenerateTestPoints(s,n.pads,n.timeStamp)}),!this.commonOptions.ignoreDRC&&kc.violateDRC.size>0){let n=Array.from(kc.violateDRC),s=n.map(([l])=>l),a=n[n.length-1][1];kc.logDRCViolation(s,a)}if(kc.overNum.size>0){let n=Array.from(kc.overNum),s=n.map(([l])=>l),a=n[n.length-1][1];kc.logRequiredNumberMet(s,a)}if(this.commonOptions.operationType=="Add"&&this.netLists.length>0){let n=kc.addMap.size,s=n/this.netLists.length*100;kc.logCurrentNetCoverage(n,this.netLists.length,s)}let t=Kt.getAllTestPad(),e=new Set(t.map(n=>n.net)).size,r=ze.getNetCount().size,i=e/r*100;kc.logGlobalCoverage(e,r,i),kc.logFinishGeneratingTestPoints()}};var Gfe=class extends fi{constructor(){super();this.netListsStore=YN.getInstance()}getDialogData(){return this.netListsStore.refreshNetLists(),{action:"auto-place-test-pad",unit:x.getInstance().unit,netLists:this.netListsStore.netLists}}open(){if(!(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype))return this.getDialogData()}modify(e){}close(e){if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;if(e.action=="confirm"){this.netListsStore.setNetLists(e.netLists);let{commonOptions:i,testPointOptions:n,netLists:s}=e;new Vfe({commonOptions:i,testPointOptions:n,netLists:s}).execute()}return!0}};var uK=class extends Bh{constructor(e,r){super();this.lines=new Array;this.ps=e;let i=e.length;for(let n=0;n<i;n++){let s=e[n],a=new eo(s,{color:r});this.lines.push(a)}}display(){for(let e of this.lines)e.display()}remove(){for(let e of this.lines)e.remove()}};var Ufe=class{constructor(){this.objSpace=1;this.selectItems={lines:[],tracks:[],outlines:[],pads:[],fills:[],comps:[]};this.pointsNoDrc=[];this.viaPreviewData=[];this.validType=["Track","ArcTrack","Pad","Polygon","Rect","Circle","Component","Line","Arc"];this.outDiameter=na.getInstance().viaOutsideDiameter,this.insideDiameter=na.getInstance().viaInsideDiameter}getSelectItem(){return this.selectItems}get net(){return this._net||""}set net(t){this._net=t}updateSelectItems(t){this.clearSelectItems(),this.selectItems=this.filterItem(t)}resetGenerate(){let t=this.getFirstOutline(),e=t.out.length>0?this.mergeOutline(t.out):[],r=[];Re.addAll(r,e),Re.addAll(r,t.inner);let i=new z5(10),n=this.generateViaPos(r,0,i);this.pointsNoDrc=[n];let s=Math.abs(this.lineSpace)+Math.max(this.outDiameter,this.insideDiameter),a=[],l=[];for(let c=1;c<this.rowCount;c++){c==1&&(e.forEach(g=>{a.push(g.items[0]);for(let y=1;y<g.items.length;y++)l.push(g.items[y])}),t.inner.forEach(g=>{Re.addAll(l,g.items)}));let h=[];a.forEach(g=>{let y=gy.getExtendPolyLine(g,s);Re.addAll(h,y)});let u=h.length>0?this.mergeOutline(h):[],d=Array.from(u),p=[];l.forEach(g=>{let y=g.bbox();if(Math.abs(s)>y.width()||Math.abs(s)>y.height())return null;let b=Af(g,-s);Re.addAll(p,b)}),Re.addAll(d,p);let m=this.generateViaPos(d,c,i);this.pointsNoDrc.push(m),a=[],l=[],u.forEach(g=>{a.push(g.items[0]);for(let y=1;y<g.items.length;y++)l.push(g.items[y])}),p.forEach(g=>{Re.addAll(l,g.items)})}i.clear()}preview(t){let e=[];if(t){let r=[];this.pointsNoDrc.forEach(i=>{Re.addAll(r,i)}),e=this.getValidVia(r)}else return;this.clearPreview(),this.generateViaPreview(e)}clearPreview(){this.viaPreviewData.map(t=>t.remove()),this.viaPreviewData.length=0}generateViaFence(t){let e=[];if(t){let r=[];this.pointsNoDrc.forEach(i=>{Re.addAll(r,i)}),e=this.getValidVia(r)}else e=this.viaPreviewData.map(r=>r.center);if(e.length>0){let r=new ve("add viaFence"),i=te.getInstance().getSolderExpansionByNet(this.net),n=[];e.forEach(s=>{let a=Hr.addVia(0,"",1,2,this.net||"",this.outDiameter/2,s,this.insideDiameter/2,!1,1,i.viaTopExpansion,i.viaBottomExpansion);a.partition=x.getInstance().partitionId,a.updateFilterVisible=!0,a.visible(),n.push(a.model),ie.publish("hasModifyPcbItem",a),r.addCommand(Te.dispatch(a,"add"))}),je.executeCommand(r),ie.publish("flushService",""),ie.publish("ui/toastMsg",{type:"info",msg:"Placement Successful."},$()),ce.pcbConfig.isRebuildCopperAuto||this.checkDRCCopper(n)||ie.publish("rebuildCopperRegionDialog",{msg:"Via Fence have been placed,do you want to rebuild the copper area?"})}else ie.publish("ui/toastMsg",{type:"info",msg:"No vias have been placed. Please check and try again."},$())}checkDRCVia(t){let e=i=>i[0]instanceof Pn||i[1]instanceof Pn?!1:!(i[0]instanceof Cn||i[1]instanceof Cn);return!(kD.checkSpacingError([t],{disableProgressFromWorker:!0,excludeCheckPair:e}).fail.length>0)}checkDRCCopper(t){uf.onlyCheck=!0;let e=new Nf(nP());sn.getInstance().initialEnv(e);let r=!0;for(let i of t){let n=a=>a[0]instanceof Pn||a[1]instanceof Pn?!0:a[0]instanceof Cn||a[1]instanceof Cn;if(kD.checkSpacingError([i],{disableProgressFromWorker:!0,excludeCheckPair:n}).fail.length>0){r=!1;break}}return sn.getInstance().clear(),uf.onlyCheck=!1,r}generateViaPos(t,e,r){let i=[];t.forEach(h=>{Re.addAll(i,h.items)});let n=Math.max(this.outDiameter,this.insideDiameter)+this.viaSpace,s=Math.max(this.outDiameter,this.insideDiameter)+this.lineSpace,a=Math.max(n,s),l=[];i.forEach(h=>{let u=null,d=h.start(),p=[];c(d,p);for(let y=0;y<h.primitives.length;y++){let b=h.primitives[y],P=q.buildCircle(d,n),T=this.getIntersection(P,b).filter(C=>{if(u){if(C.distance2(u)<1e-4)return!1;if(b instanceof M){if(C.sub(d).dot(b.direct)>0)return!0}else if(b instanceof q){let E=this.getRelativeAngle(b,d);if(this.getRelativeAngle(b,C)>E)return!0}return!1}return!0}),I=T[0];if(T.length>1){if(b instanceof M){let C=b.start(),E=-1;T.forEach(O=>{let _=O.distance2(C);_>E&&(I=O,E=_)})}else if(b instanceof q){let C=null;T.forEach(E=>{let O=this.getRelativeAngle(b,E);if(C==null){I=E,C=O;return}O<C&&(I=E,C=O)})}}I?(u==null?u=b.start():u=d,d=I,c(d,p),y--):u=null}let m=h.start(),g=d;ne.less(m.distance1(g),n)&&p[p.length-1].p.equals(g)&&p.pop();for(let y of p)r.add(y),l.push(y.p)});function c(h,u){(r.items().length>0?r.search(h.bbox().extendOfSize(a)):[]).find(m=>{let g=m.p.distance1(h);return e==m.row?ne.less(g,n):ne.less(g,s)})||u.push(new QAe(h,e))}return l}getRelativeAngle(t,e){let r=Ht.regularD(t.startAngle),i=xe(Ht.regularD(e.angleD(t.center)-r),4);return t.sweep()==le.CCW?Ht.regularD(i):Ht.regularD(360-i)}getViaModel(t,e){let r=new Gg(`VIAFence_${e}`,0,"",1,2,[],this.net||"",this.outDiameter/2,t,this.insideDiameter/2,1,-100,-100,!1,null);return Tn.getInstance().addModel(r),r}getValidVia(t){hi.getInstance().update();let e=new z5(10),r,n=te.getInstance().getOtherSpacingByNet(this.net).holeClearance+this.insideDiameter,s=!1,a=1;return t.forEach(l=>{if(!(e.items().length>0?e.search(l.bbox().extendOfSize(n)):[]).find(u=>u.distance1(l)<n)){if(!this.ignoreDrc){if(!s){uf.onlyCheck=!0;let d=new Nf(nP());sn.getInstance().initialEnv(d),s=!0}r=this.getViaModel(l,a),a++;let u=this.checkDRCVia(r);if(Tn.getInstance().delete(r,r.globalIndex),r.remove(),!u)return}e.add(l)}}),s&&(uf.onlyCheck=!1),Os.getInstance().clear(),Array.from(e.items())}generateViaPreview(t){let e=[],r=Math.max(this.outDiameter,this.insideDiameter)/2;t.forEach(i=>{let n=q.buildCircle(i,r);e.push(n)}),this.displayPolyline(e)}displayPolyline(t){if(t!=null){let e=dP(t,1002);for(let r of e)r.color=ee.WHITE,this.viaPreviewData.push(r)}}getIntersection(t,e){let r=Tt(t,e);if(r>0){let i=[];for(let n=0;n<r;n+=2){let s=new S(Ee[n],Ee[n+1]);i.push(s)}return i}else return[]}showOutLines(t){t.forEach(e=>{if(Yr.inputDebugGraphics(new uK(e.items[0].primitives,ee.WHITE)),e.items.length>1)for(let r=1;r<e.items.length;r++)Yr.inputDebugGraphics(new uK(e.items[r].primitives,ee.RED))})}filterItem(t,e=this.objSpace>=0){let r={lines:[],tracks:[],outlines:[],pads:[],fills:[],comps:[]};for(let i of t)if(i instanceof Ye){let n=i.layerId,s=be.getLayer(n);if(s.type=="OUTLINE"||i.type=="Line"){if(i instanceof ct){let l=i.getMathGraphics();l instanceof fe&&l.isClose()?r.outlines.push(i):e&&r.lines.push(i)}else r.outlines.push(i);continue}if(!s.isCopperLayer())continue;switch(i.type){case"Fill Region":r.fills.push(i);break;default:break}}else i instanceof Le?r.pads.push(i):i instanceof Me?r.comps.push(i):i instanceof Ue&&e&&r.tracks.push(i);return r}validItem(t){let e=t.getParent();if(e&&e instanceof Ye&&(t=e),t instanceof Ye){let r=t.layerId,i=be.getLayer(r);if(i.type=="OUTLINE"||t.type=="Line")return t;if(!i.isCopperLayer())return null;switch(t.type){case"Fill Region":return t;default:return null}}else{if(t instanceof Le)return t;if(t instanceof Me)return t;if(t instanceof Ue)return t}return null}selectItem(t,e){this.clearSelectItems(),this.selectItems=this.filterItem(t,e);let r=[];for(let i in this.selectItems){let n=this.selectItems[i];Re.addAll(r,n)}Ve.select(t)}clearSelectItems(){for(let t in this.selectItems){let e=this.selectItems[t];e.length=0}}getFirstOutline(){let t=[],e=[],r=this.objSpace,i=Math.abs(this.objSpace)*2+Math.max(this.outDiameter,this.insideDiameter);for(let a of this.selectItems.lines){let l=a.getMathGraphics();l instanceof fe&&l.primitives.forEach(c=>{t.push(c.stroke(i+a.strokeWidth,kr.ROUND,le.CW))})}for(let a of this.selectItems.tracks){let l=a.getMathGraphics(a.layerId,i/2);t.push(l)}let n=Math.abs(this.objSpace)+Math.max(this.outDiameter,this.insideDiameter)/2;for(let a of this.selectItems.outlines){let l=a.getMathGraphics();s(l,n+a.strokeWidth/2)}for(let a of this.selectItems.pads)if(a instanceof Ri)a.getFileGraphics(a.layerId,0).forEach(l=>{s(l,n)});else{let l=a.layerId==12?1:a.layerId,c=a.getMathGraphics(l);s(c,n)}for(let a of this.selectItems.fills){let l=a.getMathGraphics();s(l,n)}for(let a of this.selectItems.comps){let l=a.getMathGraphics();s(l,n)}function s(a,l){if(a instanceof fe){if(a.area()>0&&(a=a.reverse()),a.primitives.length==1&&a.primitives[0]instanceof q){let c=a.primitives[0];if(Math.abs(c.sweepAngle)==360&&ne.eq(c.rx,c.ry)){if(r>=0){let h=[];h.push(fe.build2([q.buildCircle(c.center,c.rx+l)])),Re.addAll(t,h)}else{let h=c.rx-l;if(h>0){let u=[];u.push(fe.build2([q.buildCircle(c.center,h)])),Re.addAll(e,[new Gt(u)])}}return{out:t,inner:e}}}if(r>=0){let c=gy.getExtendPolyLine(a,l,!1);Re.addAll(t,c)}else{let c=a.bbox();if(Math.abs(l)>c.width()||Math.abs(l)>c.height())return null;let h=Af(a,-l);Re.addAll(e,h)}}else s(a.items[0],l)}return{out:t,inner:e}}mergeOutline(t){let e=new Kc,r=t.map(i=>[i]);return e.getUnionForSingle(r)}},QAe=class{constructor(t,e){this.row=e,this.p=t}bbox(){return this.p.bbox()}};var Hfe=class extends fi{constructor(){super();this.change=!1;let e=Ve.getItems();this.items={},this.tool=new Ufe,$t.dialog=this,Ve.dialog=this,this.tool.selectItem(e),this.nets=ze.getAllNets().toString(),this.hasSelect=e.length>0}open(e){let r=Ve.getItems();return{action:"add-pcb-via-fence",unit:x.getInstance().unit,outSideD:this.tool.outDiameter*10,inSideD:this.tool.insideDiameter*10,netOptions:ze.getNet(),hasSelect:r.length>0}}compareDataChange(e){let r=Ve.getItems(),i=Object.keys(this.items),n=!1;if(i.length==r.length)for(let s of r){let a=s.buildBBox();if(this.items[s.globalIndex]!=a){n=!0;break}}else n=!0;if(n){this.items={};for(let s of r){let a=s.buildBBox();this.items[s.globalIndex]=a}return this.tool.updateSelectItems(r),!0}return this.change?(this.change=!1,!0):!ne.eq(e.outSideD,this.tool.outDiameter)||!ne.eq(e.inSideD,this.tool.insideDiameter)||this.tool.objSpace!=null||!ne.eq(e.objSpace,this.tool.objSpace)||!ne.eq(e.lineSpace,this.tool.lineSpace)||!ne.eq(e.viaSpace,this.tool.viaSpace)||!ne.eq(e.rowCount,this.tool.rowCount)}handleData(e){let r={outSideD:e.outSideD/10,inSideD:e.inSideD/10,objSpace:e.objSpace/10,lineSpace:e.lineSpace/10,viaSpace:e.viaSpace/10,rowCount:e.rowCount,ignoreDrc:e.ignoreDrc,net:e.net},i=this.compareDataChange(r);return this.tool.outDiameter=r.outSideD,this.tool.insideDiameter=r.inSideD,this.tool.objSpace=r.objSpace,this.tool.lineSpace=r.lineSpace,this.tool.viaSpace=r.viaSpace,this.tool.rowCount=r.rowCount,this.tool.net=r.net,this.tool.ignoreDrc=r.ignoreDrc,i&&this.tool.resetGenerate(),!0}modify(e){}close(e){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let r=e.type;if(r=="modify"){let i=this.tool.objSpace,n=e.objSpace/10;return this.change=this.tool.objSpace!=null||!ne.eq(i,n),this.tool.objSpace=n,i>=0&&n<0&&this.tool.selectItem(Ve.getItems(),!1),!1}if(r=="preview"){let i=this.handleData(e);return this.tool.preview(i),!1}if(Ve.dialog=null,$t.dialog=null,jt.cancel(),this.tool.clearPreview(),r=="confirm"){let i=this.handleData(e);this.tool.generateViaFence(i)}return!0}update(){let e=Ve.getItems().length>0,r=ze.getAllNets().toString();(e!=this.hasSelect||this.nets!=r)&&(A.publish("pcbviaFenceUpdate",{netOptions:ze.getNet(),hasSelect:e},$()),this.hasSelect=e,this.nets=r)}};var Wfe=class extends fi{constructor(t,e){super(),this.position=t,this.tool=e}open(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e={};e.action="pcb-move-tab";let r=x.getInstance().origin,i=this.position.x-r.x,n=this.position.y-r.y;return e.refPoint={x:i,y:n},e}modify(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e=t.position,r=x.getInstance().origin,i=new S(e.x,e.y).add(r);return this.tool.moveTo(i.x,i.y),this.tool.moveToCenterWhenOutOfFrame(),!0}close(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e=t.action;if(e=="confirm"){let r=t.position,i=x.getInstance().origin,n=new S(r.x,r.y).add(i);this.tool.moveTo(n.x,n.y),this.tool.itemsMovedMouseUp(Pi.getInstance())}else if(e=="SelectRefer"){let r=new R9(0,0,[(n,s)=>{let a=x.getInstance().origin;n-=a.x,s-=a.y,ie.publish("openMainDialog",{cmd:48,data:{position:{x:n,y:s},tool:this.tool}})}]),i={command:"referencePoint",program:r,msg:"Please select a reference point"};ie.publish("toggle",i)}return!0}};var zfe=class extends fi{open(t,e){return{action:"convert-board-to-line",unit:x.getInstance().unit,width:10,layerId:1,options:Zn.fixLayerOptions(1,Zn.createLayerOptionsByType("Line"))}}modify(t){}close(t){if(t.action=="confirm"){let r=Cs.getInstance().board;if(r){let{width:i,layerId:n}=t;i=i/10;let s,a=r.toJSON();a.layerId=n,a.strokeWidth=i,a.type="Line",r instanceof nr?s=Xt.copy(a):r instanceof Sr?s=Zt.copy(a):r instanceof ct&&(s=pt.copy(a));let l=new ve("convert board to line");l.addCommand(Te.dispatch(s,"add")),A.publish("hasModifyPcbItem",s),je.executeCommand(l),A.publish("onlySelect",[s])}}}};var Yfe=class extends fi{constructor(t){super(),this.option=t}open(t){return Object.assign(t||this.option||{},{action:"cutout-to-avoid-dialog"})}modify(t){}close(t){DG(t)}};var jfe=class{constructor(){A.subscribe("openMainDialog",this.getDialog.bind(this))}dispatch(t,e){switch(t){case 0:return new Z0e(e.option);case 1:return new QU(e.foots);case 2:return new Q0e;case 4:return new efe;case 5:return e!=null?new oK(e.option,e.tool):new oK;case 6:return new Mfe(e.option);case 8:return new tfe(e.option);case 9:return new rfe(e.option);case 35:return new Afe(e);case 36:return new Nfe(e);case 34:return new Ofe(e);case 10:return new nfe(e.device);case 11:return new ofe;case 14:return new sfe(e.data);case 15:return new lfe(e.option);case 17:return new cfe(e.shape,e.tool);case 18:return new hfe(e.items,e.x,e.y);case 16:return new Sfe(e);case 19:return new ufe(e.tool);case 40:return new Dfe(e.option);case 47:return new Gfe;case 20:return new pfe;case 21:return new ffe(e.shape,e.tool);case 22:return new mfe(e.option);case 23:return new gfe(e.option);case 24:return new lK;case 25:return new yfe(e.text,e.x,e.y);case 26:return new bfe(e.tool);case 44:return new kfe(e.tool);case 37:return new _fe(e.tool);case 38:return new vfe(e.option);case 39:return new xfe(e.option);case 42:return new wfe(e.option);case 27:return new Pfe(e.device);case 28:return new cK(e.tool,e.item);case 29:return new cK(e.tool,e.item);case 30:return new Tfe(e.option);case 31:return new Ife(e.option);case 32:return new Cfe(e.option);case 33:return new Efe(e.option);case 41:return new mpe(e.option);case 43:return new Lfe(e.option);case 45:return new Bfe(e.info,e.tool,e.allReuseGroupInfo);case 46:return new Ffe;case 12:return new Hfe;case 48:return new Wfe(e.position,e.tool);case 49:return new zfe;case 50:return new Yfe(e)}}getDialog(t){A.publish("TempMaskRightClickMenu","");let e=this.dispatch(t.cmd,t.data);A.publish("openDialog",e)}};var Zw=class Zw extends sh{constructor(t,e){super(Zw.entityName,t,e)}isValid(){return!!this.entity.radius}parseEntity(t,e){let r=this.initEntity();e=t.next();let i=!1;for(;!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.center=ha(t);break;case 40:r.radius=e.value;break;case 230:i=e.value==-1;break;default:Zd(r,e);break}e=t.next()}return i&&(r.center=r.center.mirrorY()),this}initEntity(){return this.entity={type:Zw.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,center:null,radius:null},this.entity}multiply3(t){return super.multiply3(t),this.entity.center=this.vector2Multiply(this.entity.center,t),this.entity.radius=this.numberMultiply(this.entity.radius,t),this}bbox(){let t=this.entity,e=t.center.x-t.radius,r=t.center.y-t.radius,i=t.center.x+t.radius,n=t.center.y+t.radius;return new ut(e,i,r,n)}cloneOne(){let t=new Zw(null,null);return t.entity=this.cloneEntity(),t}static circle(t,e){let r=new Zw(null,null);return r.initEntity(),r.entity.center=t,r.entity.radius=e,r}entityDxfItems(){let t=this.entity;return t.layer=this.autoDefault(t.layer,"0"),super.entityDxfItems(),this.autoItem(5,t.handle),this.autoItem(100,"AcDbEntity"),Jd(this.dxfItems,t,"layer"),t.lineStroke&&this.autoItem(370,this.getLineStroke(t.lineStroke)),this.autoItem(100,"AcDbCircle"),Fh(this.dxfItems,t.center,10),this.autoItem(40,t.radius),this.dxfItems}static builder(t){let e=new Zw(null,null);return e.entity=t,e}};Zw.entityName="CIRCLE";var aO=Zw;var jN=class jN extends sh{constructor(t,e){super(jN.entityName,t,e)}cloneOne(){let t=new jN(null,null);return t.entity=this.cloneEntity(),t}isValid(){return this.validVertices(this.entity.vertexs)}parseEntity(t,e){let r={type:jN.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,elevation:null,depth:null,shape:null,hasContinuousLinetypePattern:null,numberOfVertices:null,vertexs:[],width:null,startWidth:null,endWidth:null,extrusionDirectionX:null,extrusionDirectionY:null,extrusionDirectionZ:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 38:r.elevation=e.value;break;case 39:r.depth=e.value;break;case 70:r.shape=(e.value&1)===1,r.hasContinuousLinetypePattern=(e.value&128)===128;break;case 90:r.numberOfVertices=e.value;break;case 10:r.vertexs=r.vertexs.concat(this.parseLWPolylineVertices(r.numberOfVertices,t));break;case 43:e.value!==0&&(r.width=e.value);break;case 40:e.value!==0&&(r.startWidth=e.value);break;case 41:e.value!==0&&(r.endWidth=e.value);break;case 210:r.extrusionDirectionX=e.value;break;case 220:r.extrusionDirectionY=e.value;break;case 230:r.extrusionDirectionZ=e.value;break;default:Zd(r,e);break}e=t.next()}return r.shape&&(r.vertexs=ZF(r.vertexs)),this.entity=r,this}parseLWPolylineVertices(t,e){if(!t||t<=0)throw Error("n must be greater than 0 verticies");let r=[],i=!1,n=!1,s=e.lastReadGroup;for(let a=0;a<t;a++){let l=new b3(null,null);for(l.initEntity();!this.isEof(s)&&!(s.code===0||n);){switch(s.code){case 10:if(i){n=!0;continue}i=!0,l.entity.center=ha(e);break;case 40:l.entity.startWidth=s.value;break;case 41:l.entity.endWidth=s.value;break;case 42:s.value!=0&&(l.entity.bulge=s.value);break;default:return e.rewind(),i&&r.push(l),e.rewind(),r}s=e.next()}l.isValid()?r.push(l):console.warn("vartex is bad data!"),i=!1,n=!1}return e.rewind(),r}multiply3(t){return super.multiply3(t),Aoe(this.entity.vertexs,t),this.entity.width=this.numberMultiply(this.entity.width,t),this}bbox(){return this.verticesBBox(this.entity.vertices)}entityDxfItems(){let t=this.entity;return t.layer=this.autoDefault(t.layer,"0"),super.entityDxfItems(),this.autoItem(5,t.handle),this.autoItem(100,"AcDbEntity"),Jd(this.dxfItems,t,"layer"),this.autoItem(100,"AcDbPolyline"),this.autoItem(90,t.numberOfVertices),this.autoItem(70,t.shape?1:0),this.autoItem(38,t.elevation),this.autoItem(39,t.depth),this.autoItem(43,t.width),this.autoItem(40,t.startWidth),this.autoItem(41,t.endWidth),this.autoItem(210,t.extrusionDirectionX),this.autoItem(220,t.extrusionDirectionY),this.autoItem(230,t.extrusionDirectionZ),this.autoEncoderVertexs(this.dxfItems),this.dxfItems}autoEncoderVertexs(t){let e=this.entity.vertexs;for(let r of e){let i=r.entity;Fh(t,i.center,10),i.bulge&&this.dxfItems.push([42,i.bulge])}}static builder(t){let e=new jN(null,null);return e.entity=t,e}};jN.entityName="LWPOLYLINE";var QC=jN;var XN=class XN extends sh{constructor(t,e){super(XN.entityName,t,e)}parseEntity(t,e){return null}initEntity(){return this.entity={type:XN.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,position:null,extrusionDirection:null,linkHandle:null,outlines:null,seedName:null},this.entity}isValid(){var t;return((t=this.entity.outlines)==null?void 0:t.length)>0}multiply3(t){let e=this.entity;e.position=this.vector2Multiply(e.position,t);let r=new Array(e.outlines.length),i=-1;for(let n of e.outlines)i++,r[i]=n.multiply3(t);return e.position=this.vector2Multiply(e.position,t),e.outlines=r,super.multiply3(t),this}bbox(){let t=new _e;return this.entity.outlines.forEach(e=>{t.ext1(e.bbox())}),t.build1()}cloneOne(){let t=new XN(null,null);return t.entity=this.cloneEntity(),t}entityDxfItems(){let t=this.entity;t.layer=this.autoDefault(t.layer,"0"),super.entityDxfItems(),this.autoItem(5,t.handle),this.autoItem(100,"AcDbEntity"),Jd(this.dxfItems,t,"layer"),this.autoItem(100,"AcDbHatch");let e=new Mt(0,0,1);return Fh(this.dxfItems,t.position||e,10,0),Fh(this.dxfItems,t.position||e,210),this.fillOutLineAndSeed(),this.dxfItems}fillOutLineAndSeed(){let t=this.entity.seedName;this.seedEncorder(t)}seedEncorder(t){let e=this.entity,r=e.outlines[0]instanceof aO,i=Di.convert(1,39.37,this.entity.unit||39.37);if(this.autoItem(2,t),this.autoItem(70,t==="SOLID"?1:0),this.autoItem(71,0),this.autoItem(91,e.outlines.length),this.autoEncorderOutline({name:t,isCircle:r}),t==="ANSI37")this.autoItem(97,1),this.autoItem(330,e.linkHandle),this.autoItem(75,0),this.autoItem(76,1),this.autoItem(52,0),this.autoItem(41,1),this.autoItem(77,0),this.autoItem(78,2),this.autoItem(53,45),this.autoItem(43,0),this.autoItem(44,0),this.autoItem(45,-2.245064030267287),this.autoItem(46,2.245064030267288),this.autoItem(79,0),this.autoItem(53,135),this.autoItem(43,0),this.autoItem(44,0),this.autoItem(45,-2.245064030267287),this.autoItem(46,-2.245064030267288),this.autoItem(79,0),this.autoItem(47,r?.8681437583925616:.0542074568195396),this.autoItem(98,1),this.autoItem(10,r?3.629517071192367:18.06657317416238),this.autoItem(20,r?33.92795499968543:5.650245182409889),this.autoItem(1001,"ACAD"),this.autoItem(1010,0),this.autoItem(1020,0),this.autoItem(1030,0);else if(t==="SOLID")this.autoItem(97,1),this.autoItem(330,e.linkHandle),this.autoItem(75,0),this.autoItem(76,1),this.autoItem(47,r?.8681437583925616:.4128176842155181),this.autoItem(98,1),this.autoItem(10,r?3.629517071192367:34.90568961886538),this.autoItem(20,r?33.92795499968543:22.81183545379326),this.autoItem(450,0),this.autoItem(451,0),this.autoItem(460,0),this.autoItem(461,0),this.autoItem(452,1),this.autoItem(462,1),this.autoItem(453,2),this.autoItem(463,0),this.autoItem(63,5),this.autoItem(421,255),this.autoItem(463,1),this.autoItem(63,7),this.autoItem(421,16777215),this.autoItem(470,"LINEAR"),this.autoItem(1001,"ACAD"),this.autoItem(1010,0),this.autoItem(1020,0),this.autoItem(1030,0);else throw new Error("not support this seed type: "+t)}autoEncorderOutline(t){let{isCircle:e}=t;for(let r=0;r<this.entity.outlines.length;r++){let i=this.entity.outlines[r];if(r>0&&this.autoItem(97,0),this.autoItem(92,7),this.autoItem(72,e?1:0),this.autoItem(73,1),i instanceof aO){let n=i.entity.center,s=i.entity.radius;this.autoItem(93,2),this.autoItem(10,n.x-s),this.autoItem(20,n.y),this.autoItem(42,1),this.autoItem(10,n.x+s),this.autoItem(20,n.y),this.autoItem(42,1)}else this.autoItem(93,i.entity.vertexs.length),i.autoEncoderVertexs(this.dxfItems)}}static builder(t){let e=new XN(null,null);return e.entity=t,e}scaleNumber(t,e){return isNaN(t)?t:t*e}};XN.entityName="HATCH";var dK=XN;var qN=class qN extends sh{constructor(t,e){super(qN.entityName,t,e)}cloneOne(){let t=new qN(null,null);return t.entity=this.cloneEntity(),t}isValid(){return!!this.entity.text}parseEntity(t,e){let r={type:qN.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,text:"",startPoint:null,endPoint:null,height:null,xScale:null,rotation:null,halign:null,valign:null,tiltAngle:null,pcbString:null,fontSize:null,fontFamily:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.startPoint=ha(t),r.endPoint||(r.endPoint=r.startPoint);break;case 11:r.endPoint=ha(t);break;case 40:r.height=e.value;break;case 41:r.xScale=e.value;break;case 461:r.fontSize=e.value;break;case 7:r.fontFamily=e.value;break;case 50:r.rotation=e.value;break;case 1:r.text=e.value;break;case 72:r.halign=e.value;break;case 73:r.valign=e.value;break;case 51:r.tiltAngle=e.value;default:Zd(r,e);break}e=t.next()}let i=new Ex(r.fontFamily||"NotoSerifCJKsc-Medium",r.fontSize||r.height,r.xScale,!1,!1),n=new S((r.startPoint.x+r.endPoint.x)/2,(r.startPoint.y+r.endPoint.y)/2);return r.pcbString=new BS("",this.pcb_layer,n,r.rotation,r.text,i,!1),this.entity=r,this}multiply3(t){return super.multiply3(t),this.entity.pcbString&&(this.entity.pcbString=this.entity.pcbString.multiply3(t)),this.entity.startPoint=this.vector2Multiply(this.entity.startPoint,t),this.entity.endPoint=this.vector2Multiply(this.entity.endPoint,t),this.entity.height=this.numberMultiply(this.entity.height,t),this.entity.fontSize=this.numberMultiply(this.entity.fontSize,t),this}bbox(){return this.entity.pcbString.bbox()}entityDxfItems(){let t=this.entity;return t.layer=this.autoDefault(t.layer,"0"),super.entityDxfItems(),this.autoItem(5,t.handle),this.autoItem(100,"AcDbEntity"),Jd(this.dxfItems,t,"layer"),this.autoItem(7,t.fontFamily),this.autoItem(461,t.fontSize),this.autoItem(100,"AcDbText"),Fh(this.dxfItems,t.startPoint,10),Fh(this.dxfItems,t.endPoint,11),this.autoItem(40,t.height),this.autoItem(1,t.text.replace(/\r|\n/g," ")),this.autoItem(50,t.rotation||0),this.autoItem(71,t.reverse?2:1),this.autoItem(72,t.halign||0),this.autoItem(41,t.xScale||1),this.autoItem(100,"AcDbText"),this.autoItem(73,t.valign||0),this.dxfItems}static builder(t){let e=new qN(null,null);return t.text=(t.text||"").trim(),e.entity=t,e}};qN.entityName="TEXT";var $N=qN;var Xfe=class{constructor(t){this.lastReadGroup=null;let e=t.trim().split(/\r\n|\r|\n/g);this._data=e,this._pointer=0,this._eof=!1}next(){if(!this.hasNext())throw new Error("Cannot call 'next' after EOF group has been read");let t=parseInt(this.getPointerValue());this._pointer++;let e=bX(t,this.getPointerValue());this._pointer++,t===0&&e==="EOF"&&(this._eof=!0);let r={code:t,value:e};return this.lastReadGroup=r,r}getPointerValue(){return this._data[this._pointer].trim()}hasNext(){return!(this._eof||this._pointer>this._data.length-2)}get isEOF(){return this._eof}rewind(t){t=t||1,this._pointer-=t*2}};var eH=class eH extends sh{constructor(t,e){super(eH.entityName,t,e)}cloneOne(){let t=new eH(null,null);return t.entity=this.cloneEntity(),t}isValid(){return this.validVertices()}parseEntity(t,e){let r={type:eH.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,vertices:null,invisibleEdge:null,shape:null,hasContinuousLinetypePattern:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 70:r.invisibleEdge=e.value,r.shape=(e.value&1)===1,r.hasContinuousLinetypePattern=(e.value&128)===128;break;case 10:r.vertices=Ooe(t,e),e=t.lastReadGroup;break;default:Zd(r,e);break}e=t.next()}return this.entity=r,this.autoPorts(),this}multiply3(t){return super.multiply3(t),this}bbox(){return this.verticesBBox(this.entity.vertices)}entityDxfItems(){let t=this.entity;super.entityDxfItems();for(let e in t){let r=t[e];if(!w0(r))switch(e){case"invisibleEdge":this.autoItem(70,r?0:1);break;case"vertices":Fh(this.dxfItems,r,10);break;default:Jd(this.dxfItems,t,e);break}}return this.dxfItems}};eH.entityName="3DFACE";var qfe=eH;var tH=class tH extends sh{constructor(t,e){super(tH.entityName,t,e)}parseEntity(t,e){let r=this.initEntity();for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.center=ha(t);break;case 220:r.extrusionDirection=ha(t);break;case 40:r.radius=e.value;break;case 50:r.startAngle=e.value;break;case 51:r.endAngle=e.value;break;default:Zd(r,e);break}e=t.next()}return r.extrusionDirection&&r.extrusionDirection.y===-1&&(r.center=new S(-r.center.x,r.center.y)),this.initArc(),this.autoPorts(),this}autoPorts(){this.entity.vertices=[this.entity.arc.start(),this.entity.arc.end()],super.autoPorts()}initArc(){let t=this.entity;this.entity.arc=q.build2(t.center,t.startAngle,t.endAngle,t.radius,t.radius,le.CCW)}initEntity(){return this.entity={type:tH.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,center:null,radius:null,startAngle:null,endAngle:null,arc:null,extrusionDirection:null},this.entity}isValid(){return!!this.entity.center}multiply3(t){return super.multiply3(t),this.entity.arc=this.entity.arc.multiply3(t),this.entity.center=this.vector2Multiply(this.entity.center,t),this.entity.radius=this.numberMultiply(this.entity.radius,t),this}bbox(){return this.entity.arc.bbox()}cloneOne(){let t=new tH(null,null);return t.entity=this.cloneEntity(),t}entityDxfItems(){let t=this.entity;super.entityDxfItems();for(let e in t){let r=t[e];if(!w0(r))switch(e){case"center":Fh(this.dxfItems,r,10);break;case"radius":this.autoItem(40,r);break;case"startAngle":this.autoItem(50,r);break;case"endAngle":this.autoItem(51,r);break;default:Jd(this.dxfItems,t,e);break}}return this.dxfItems}};tH.entityName="ARC";var KN=tH;var rH=class rH extends sh{constructor(t,e){super(rH.entityName,t,e)}isValid(){return!!this.entity.center}cloneOne(){let t=new rH(null,null);return t.entity=this.cloneEntity(),t}parseEntity(t,e){let r={type:rH.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,name:null,center:null,majorAxisEndPoint:null,axisRatio:null,startAngle:null,endAngle:null,stretching:null,a:null,b:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.center=ha(t);break;case 11:r.majorAxisEndPoint=ha(t);break;case 210:r.stretching=ha(t);break;case 40:r.axisRatio=e.value;break;case 41:r.startAngle=e.value;break;case 42:r.endAngle=e.value;break;case 2:r.name=e.value;break;default:Zd(r,e);break}e=t.next()}let i=r.center,n=r.majorAxisEndPoint,s=i.add(n),a=Math.abs(s.distance1(i)),l=r.axisRatio>1?a/r.axisRatio:a*r.axisRatio;return r.a=a,r.b=l,this.entity=r,r.vertices=this.getVertices(this.getVerticesNumber()),this}multiply3(t){return super.multiply3(t),this.entity.center=this.vector2Multiply(this.entity.center,t),this.entity.majorAxisEndPoint=this.vector2Multiply(this.entity.majorAxisEndPoint,t),this}bbox(){return this.verticesBBox(this.entity.vertices)}ellipsePolar2(t,e,r){return new S(t*Math.cos(r),e*Math.sin(r))}ellipsePolar(t,e,r){let i;return r-=3/2*Math.PI,i=t*(1-e*e)/(1-e*Math.cos(r)),new S(i*Math.cos(r),i*Math.sin(r))}getVertices(t){let e=this.entity,r=e.center,i=e.majorAxisEndPoint,n=e.a,s=e.b,a=Math.sqrt(n*n-s*s),l=a/n,c=i.x,h=i.y,u=Math.atan(h/c);isNaN(u)&&(console.warn("radio is NaN."),u=0),c<0&&(u+=Math.PI);let d=Qe.rotate(u).translate1(r),p=e.startAngle||0,m=e.endAngle||2*Math.PI,g=(m-p)/(t-1),y=[];for(let b=p;b<=m;b+=g)y.push(this.ellipsePolar2(n,s,b).multiply3(d));return y}getVerticesNumber(){let t=2*Math.PI,e=this.entity.startAngle||0,r=this.entity.endAngle||t,i=Math.abs((r-e)/t),n=t*this.entity.a*i,s=Math.floor(n/.1);return Math.min(Math.max(20,s),5e3)}entityDxfItems(){let t=this.entity;super.entityDxfItems();for(let e in t){let r=t[e];if(!w0(r))switch(e){case"center":Fh(this.dxfItems,r,10);break;case"majorAxisEndPoint":this.autoItem(11,r);break;case"stretching":Fh(this.dxfItems,r,210);break;case"axisRatio":this.autoItem(40,r);break;case"startAngle":this.autoItem(41,r);break;case"endAngle":this.autoItem(42,r);break;case"name":this.autoItem(2,r);break;default:Jd(this.dxfItems,t,e);break}}return this.dxfItems}};rH.entityName="ELLIPSE";var $fe=rH;var iH=class iH extends sh{constructor(t,e){super(iH.entityName,t,e)}cloneOne(){let t=new iH(null,null);return t.entity=this.cloneEntity(),t}parseEntity(t,e){let r={type:iH.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,shape:null,hasContinuousLinetypePattern:null,insert:null,name:null,rotate:0};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 70:r.shape=(e.value&1)===1,r.hasContinuousLinetypePattern=(e.value&128)===128;break;case 10:let i=Ooe(t,e);r.insert=i&&i[0],e=t.lastReadGroup;break;case 2:r.name=e.value;break;case 50:r.rotate=e.value;break;default:Zd(r,e);break}e=t.next()}return this.entity=r,this}isValid(){return!!this.entity.insert}multiply3(t){return super.multiply3(t),this}bbox(){return this.verticesBBox(this.entity.vertices)}get blockName(){return this.entity.name}entityDxfItems(){let t=this.entity;super.entityDxfItems();for(let e in t){let r=t[e];if(!w0(r))switch(e){case"shape":this.autoItem(70,Object.is(r,!1)?0:1);break;case"name":this.autoItem(2,r);break;case"insert":Fh(this.dxfItems,r,10);break;default:Jd(this.dxfItems,t,e);break}}return this.dxfItems}};iH.entityName="INSERT";var nH=iH;var oH=class oH extends sh{constructor(t,e){super(oH.entityName,t,e)}cloneOne(){let t=new oH(null,null);return t.entity=this.cloneEntity(),t}isValid(){return this.validVertices(this.entity.controlPoints)}parseEntity(t,e){let r={type:oH.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,controlPoints:null,fitPoints:null,startTangent:null,endTangent:null,knotValues:null,shape:null,periodic:null,rational:null,planar:null,linear:null,degreeOfSplineCurve:null,numberOfKnots:null,numberOfControlPoints:null,numberOfFitPoints:null,normalVector:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.controlPoints||(r.controlPoints=[]),r.controlPoints.push(ha(t));break;case 11:r.fitPoints||(r.fitPoints=[]),r.fitPoints.push(ha(t));break;case 12:r.startTangent=ha(t);break;case 13:r.endTangent=ha(t);break;case 40:r.knotValues||(r.knotValues=[]),r.knotValues.push(e.value);break;case 70:(e.value&1)!=0&&(r.shape=!0),(e.value&2)!=0&&(r.periodic=!0),(e.value&4)!=0&&(r.rational=!0),(e.value&8)!=0&&(r.planar=!0),(e.value&16)!=0&&(r.planar=!0,r.linear=!0);break;case 71:r.degreeOfSplineCurve=e.value;break;case 72:r.numberOfKnots=e.value;break;case 73:r.numberOfControlPoints=e.value;break;case 74:r.numberOfFitPoints=e.value;break;case 210:r.normalVector=ha(t);break;default:Zd(r,e);break}e=t.next()}return this.entity=r,r.vertices=this.getVertices(this.getVerticesNumber()),r.shape&&ZF(r.vertices),this.autoPorts(),this}multiply3(t){super.multiply3(t);let e=this.entity;return this.entity.controlPoints=this.verticesMultiply(e.controlPoints,t),this.entity.fitPoints=this.verticesMultiply(e.fitPoints,t),this.entity.startTangent=this.vector2Multiply(e.startTangent,t),this.entity.endTangent=this.vector2Multiply(e.endTangent,t),this.entity.normalVector=this.vector2Multiply(e.normalVector,t),this}bbox(){return this.verticesBBox(this.entity.vertices)}DeBoor(t,e,r){if(e==1)return this.Knot(t)<=r&&r<=this.Knot(t+1)?1:0;let i=this.Knot(t),s=this.Knot(t+e-1)-i,a=s===0?0:(r-i)/s*this.DeBoor(t,e-1,r),l=this.Knot(t+e),c=this.Knot(t+1),h=l-c,u=h===0?0:(l-r)/h*this.DeBoor(t+1,e-1,r);return a+u}getDeBoorPoint(t,e,r){let i=new S(0,0);for(let n=0;n<t;n++){let s=this.entity.controlPoints[n],a=this.DeBoor(n,e,r);i=i.add(s.multiply3(Qe.scale(a)))}return i}Knot(t){return this.entity.knotValues[t]}getVertices(t){let e=this.entity.knotValues.length,r=this.entity.controlPoints.length,i=this.Knot(0),n=this.Knot(e-1);t=Math.max(2,t);let s=(n-i)/(t-1),a=[],l=e-r,c=i;for(;c<=n;c+=s)a.push(this.getDeBoorPoint(r,l,c));return c-s!=n&&a.push(this.getDeBoorPoint(r,l,n)),a}getVerticesNumber(){let t=0,e=this.entity.controlPoints;for(let i=0;i<e.length-1;i++)t+=e[i].distance1(e[i+1]);let r=Math.floor(t/.5);return Math.min(Math.max(50,r),5e3)}entityDxfItems(){let t=this.entity;super.entityDxfItems();let e=$F(t,{shape:1,periodic:2,rational:4,linear:16,planar:8},!0,0);this.autoItem(70,e);for(let r in t){let i=t[r];if(!w0(i))switch(r){case"controlPoints":KF(this.dxfItems,i,10);break;case"fitPoints":KF(this.dxfItems,i,11);break;case"startTangent":KF(this.dxfItems,i,12);break;case"endTangent":KF(this.dxfItems,i,13);break;case"normalVector":KF(this.dxfItems,i,210);break;case"knotValues":i&&i.forEach(n=>{this.autoItem(40,n)});break;case"degreeOfSplineCurve":this.autoItem(71,i);break;case"numberOfKnots":this.autoItem(72,i);break;case"numberOfControlPoints":this.autoItem(73,i);break;case"numberOfFitPoints":this.autoItem(74,i);break;default:Jd(this.dxfItems,t,r);break}}return this.dxfItems}};oH.entityName="SPLINE";var Kfe=oH;var sH=class sH extends sh{constructor(t,e){super(sH.entityName,t,e)}cloneOne(){let t=new sH(null,null);return t.entity=this.cloneEntity(),t}isValid(){return!!this.entity.start&&!this.entity.start.equals(this.entity.end,10)}parseEntity(t,e){let r=this.initEntity();for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.start=ha(t);break;case 11:r.end=ha(t);break;case 210:r.extrusionDirection=ha(t);break;case 100:break;default:Zd(r,e);break}e=t.next()}return this.autoPorts(),this}autoPorts(){this.entity.vertices=[this.entity.start,this.entity.end],super.autoPorts()}initEntity(){return this.entity={type:sH.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,start:null,end:null,extrusionDirection:null},this.entity}multiply3(t){super.multiply3(t);let e=this.entity;return this.entity.start=this.vector2Multiply(e.start,t),this.entity.end=this.vector2Multiply(e.end,t),this.entity.extrusionDirection=this.vector2Multiply(e.extrusionDirection,t),this}bbox(){let t=this.entity;return this.verticesBBox([t.start,t.end])}entityDxfItems(){let t=this.entity;super.entityDxfItems();for(let e in t){let r=t[e];if(!w0(r))switch(e){case"start":Fh(this.dxfItems,r,10);break;case"end":Fh(this.dxfItems,r,11);break;case"extrusionDirection":Fh(this.dxfItems,r,210);break;default:Jd(this.dxfItems,t,e);break}}return this.dxfItems}};sH.entityName="LINE";var ZN=sH;var aH=class aH extends sh{constructor(t,e){super(aH.entityName,t,e)}isValid(){return this.validVertices(this.entity.vertexs)}cloneOne(){let t=new aH(null,null);return t.entity=this.cloneEntity(),t}parseEntity(t,e){let r={type:aH.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,vertexs:[],thickness:null,startWidth:null,endWidth:null,shape:null,includesCurveFitVertices:null,includesSplineFitVertices:null,is3dPolyline:null,is3dPolygonMesh:null,is3dPolygonMeshClosed:null,isPolyfaceMesh:null,hasContinuousLinetypePattern:null,extrusionDirection:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:case 20:break;case 30:break;case 39:r.thickness=e.value;break;case 40:r.startWidth=e.value;break;case 41:r.endWidth=e.value;break;case 70:r.shape=(e.value&1)!==0,r.includesCurveFitVertices=(e.value&2)!==0,r.includesSplineFitVertices=(e.value&4)!==0,r.is3dPolyline=(e.value&8)!==0,r.is3dPolygonMesh=(e.value&16)!==0,r.is3dPolygonMeshClosed=(e.value&32)!==0,r.isPolyfaceMesh=(e.value&64)!==0,r.hasContinuousLinetypePattern=(e.value&128)!==0;break;case 71:break;case 72:break;case 73:break;case 74:break;case 75:break;case 210:r.extrusionDirection=ha(t);break;default:Zd(r,e);break}e=t.next()}return r.vertexs=JGe(t,e),r.shape&&(r.vertexs=ZF(r.vertexs)),this.entity=r,this}multiply3(t){super.multiply3(t);let e=this.entity;return this.entity.thickness=this.numberMultiply(e.thickness,t),this.entity.startWidth=this.numberMultiply(e.startWidth,t),this.entity.endWidth=this.numberMultiply(e.endWidth,t),this.entity.extrusionDirection=this.vector2Multiply(e.extrusionDirection,t),Aoe(this.entity.vertexs,t),this}bbox(){return this.verticesBBox(this.entity.vertices)}entityDxfItems(){let t=this.entity;super.entityDxfItems(),this.autoItem(10,0),this.autoItem(20,0),this.autoItem(30,0);let e=$F(t,{shape:1,includesCurveFitVertices:2,includesSplineFitVertices:4,is3dPolyline:8,is3dPolygonMesh:16,is3dPolygonMeshClosed:32,isPolyfaceMesh:64,hasContinuousLinetypePattern:128},!0,0);this.autoItem(70,e);for(let r in t){let i=t[r];if(!w0(i))switch(r){case"thickness":this.autoItem(39,i);break;case"startWidth":this.autoItem(40,i);break;case"endWidth":this.autoItem(41,i);break;case"extrusionDirection":Fh(this.dxfItems,i,210);break;default:Jd(this.dxfItems,t,r);break}}return this.dxfItems}};aH.entityName="POLYLINE";var pK=aH;var JN=class JN extends sh{constructor(t,e){super(JN.entityName,t,e)}isValid(){return!!this.entity.text}cloneOne(){let t=new JN(null,null);return t.entity=this.cloneEntity(),t}parseEntity(t,e){let r={type:JN.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,text:[],position:null,height:null,width:null,rotation:null,attachmentPoint:null,drawingDirection:null,pcbString:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 3:case 1:r.text=r.text.concat(this.parseString(e.value));break;case 10:r.position=ha(t);break;case 11:let n=ha(t);r.rotation=n.angleD(S.ORIGIN);break;case 40:r.height=e.value;break;case 41:r.width=e.value;break;case 50:r.rotation=e.value;break;case 71:r.attachmentPoint=e.value;break;case 72:r.drawingDirection=e.value;break;default:Zd(r,e);break}e=t.next()}let i=new Ex("NotoSerifCJKsc-Medium",r.height,r.width,!1,!1);return r.pcbString=new BS("",this.pcb_layer,r.position,r.rotation,r.text.join(`\r
`),i,!1),this.entity=r,this}multiply3(t){super.multiply3(t);let e=this.entity;return e.pcbString&&(e.pcbString=e.pcbString.multiply3(t)),e.position=e.position.multiply3(t),e.height=this.numberMultiply(e.height,t),e.width=this.numberMultiply(e.width,t),this}bbox(){return this.entity.pcbString.bbox()}entityDxfItems(){let t=this.entity;return t.layer=this.autoDefault(t.layer,"0"),super.entityDxfItems(),this.autoItem(5,t.handle),this.autoItem(100,"AcDbEntity"),Jd(this.dxfItems,t,"layer"),this.autoItem(100,"AcDbMText"),Fh(this.dxfItems,t.position,10),this.autoItem(40,t.height),this.autoItem(41,t.width),this.autoItem(50,t.rotation||0),this.autoItem(71,t.attachmentPoint||1),this.autoItem(72,t.drawingDirection||5),this.autoItem(1,this.encoderMString(t.text)),this.dxfItems}static builder(t){let e=new JN(null,null);return e.entity=t,e}parseString(t){if(!t)return[""];let e=[];return t.split("\\P").forEach(r=>{r=r.replace(/\\f/g,"~F~"),r=r.replace(/^{/,"").replace(/}$/,""),r=r.replace(/(~F~)(.*?)(;)/g,""),e.push(r)}),e}encoderMString(t){if(!t)return"";let e=[];return t.forEach(r=>{e.push("{\\fSimSun|b0|i0|c134|p2;"+r+"}")}),e.join("\\P")}};JN.entityName="MTEXT";var Zfe=JN;var lH=class lH extends sh{constructor(t,e){super(lH.entityName,t,e)}cloneOne(){let t=new lH(null,null);return t.entity=this.cloneEntity(),t}isValid(){return this.validVertices()}parseEntity(t,e){let r=this.initEntity();for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 71:(e.value&2)!=0&&(r.isClose=!0),(e.value&4)!=0&&(r.noStartSealing=!0),(e.value&8)!=0&&(r.noEndSealing=!0);break;case 10:r.vertices.unshift(ha(t));break;case 11:r.vertices.push(ha(t));break;default:Zd(r,e);break}e=t.next()}return this.autoPorts(),this}initEntity(){return this.entity={type:lH.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,isClose:null,noStartSealing:null,noEndSealing:null,vertices:[]},this.entity}multiply3(t){return super.multiply3(t),this}bbox(){return this.verticesBBox(this.entity.vertices)}};lH.entityName="MLINE";var Jfe=lH;var cH=class cH extends sh{constructor(e,r){super(cH.entityName,null,null);this.place=null;this.place=r,e&&(this.parseEntity(),this.extendEntity(e,[1,0]))}cloneOne(){let e=new cH(null,this.place);return e.entity=this.cloneEntity(),e}isValid(){return this.validVertices(this.entity.entities)}parseEntity(){let e={type:cH.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,entities:[],shape:!1};return this.entity=e,this}extendEntity(e,r){if(!r)return console.error("ports is un linked whith MultiPoly."),this;if(!this.entity.ports&&!this.entity.shape)return this.entity.layer=e.entity.layer,this.entity.pcb_layer=e.entity.pcb_layer,this.entity.ports=[e.entity.ports[0],e.entity.ports[1]],this.entity.entities.push(e),this;if(!this.entity.ports)return console.warn("multiPoly is closed"),this;if(!e.entity.ports)return console.error("ports is null in MultiPoly."),this;if(r[0]===r[1])if(e instanceof KN){let i=e.entity.arc;e.entity.arc=q.build2(i.center,i.endAngle(),i.startAngle,i.rx,i.ry,i.sweepAngle>=0?le.CW:le.CCW),e.autoPorts()}else e.entity.vertices.reverse(),e instanceof ZN&&(e.entity.start=e.entity.vertices[0],e.entity.end=e.entity.vertices[1]),e.autoPorts();return r[0]===0?this.entity.entities.unshift(e):this.entity.entities.push(e),this.autoPorts(),this.autoShape(),this}autoPorts(){let e=this.entity.entities,r=e&&e.length;if(!r)return;let i=e[0],n=e[r-1];this.entity.ports=[i.entity.ports[0],n.entity.ports[1]]}autoShape(){return this.entity.shape?!0:this.entity.ports[0].equals(this.entity.ports[1],this.place)?(this.entity.ports=null,this.entity.shape=!0,!0):!1}multiply3(e){super.multiply3(e);let r=[];return this.entity.entities.forEach(i=>{r.push(i.multiply3(e))}),this.entity.entities=r,this}bbox(){let e=this.entity,r=new _e;return e.entities.forEach(n=>{r.ext1(n.bbox())}),r.valid()||r.ext6(0,0),r.build1()}};cH.entityName="MultiPoly";var fK=cH;var Qfe=class{constructor(){this._entityHandlers={};this.strokeWidth=10;this.lastHandle=0;this.pointerPlace=10;this._tableDefinitions={VPORT:{tableName:"viewPort",dxfSymbolName:"VPORT",parseTableRecords:null},LTYPE:{tableName:"lineType",dxfSymbolName:"LTYPE",parseTableRecords:null},LAYER:{tableName:"layer",dxfSymbolName:"LAYER",parseTableRecords:null}};this.registerDefaultEntityHandlers(),this.loadTableDefinitions(),this.parseUnit=1}registerEntityHandler(t){this._entityHandlers[t.entityName.toUpperCase()]=t}registerDefaultEntityHandlers(){this.registerEntityHandler(qfe),this.registerEntityHandler(KN),this.registerEntityHandler(aO),this.registerEntityHandler($fe),this.registerEntityHandler(nH),this.registerEntityHandler(ZN),this.registerEntityHandler(Jfe),this.registerEntityHandler(Kfe),this.registerEntityHandler(pK),this.registerEntityHandler(QC),this.registerEntityHandler(b3),this.registerEntityHandler(Zfe),this.registerEntityHandler($N)}loadTableDefinitions(){this._tableDefinitions.VPORT.parseTableRecords=this.parseViewPortRecords,this._tableDefinitions.LTYPE.parseTableRecords=this.parseLineTypes,this._tableDefinitions.LAYER.parseTableRecords=this.parseLayers}debugCode(t){return t.code+":"+t.value}log(t){return console.log(t)}parseSync(t){this.scanner=new Xfe(t);let e=this.scanner;for(this.layerSelectedInfo={},this.parseData={header:{},blocks:{},entities:null,tables:null,unit:null,scale:1,unitName:null,strokeWidth:null,layerConvertInfo:{},origin:null,CLASSES_items:null,TABLES_items:null,OBJECTS_items:null},this.curr=e.next();!e.isEOF;)if(this.curr.code===0&&this.curr.value==="SECTION"){if(this.curr=e.next(),this.curr.code!==2){console.error("Unexpected code %s after 0:SECTION",this.debugCode(this.curr)),this.curr=e.next();continue}this.curr.value==="HEADER"?this.parseHeader():this.curr.value==="BLOCKS"?this.parseBlocks():this.curr.value==="ENTITIES"?this.parseData.entities=this.parseEntities(!1):this.curr.value==="TABLES"?this.parseData.TABLES_items=this.readSection2Items():this.curr.value==="CLASSES"?this.parseData.CLASSES_items=this.readSection2Items():this.curr.value==="OBJECTS"?this.parseData.OBJECTS_items=this.readSection2Items():this.curr.value==="EOF"?this.log("EOF"):(console.warn("Skipping section '%s'",this.curr.value),this.curr=e.next())}else this.curr=e.next();let r=$Ge(this.getHeadValue("$INSUNITS"));this.parseData.unit=r.unit,this.parseData.unitName=r.name,this.parseData.scale=Di.convert(1,this.parseData.unit,this.parseUnit)||1,this.parseData.strokeWidth=this.strokeWidth,this.parseData.origin=this.getHeadValue("$PUCSORG");for(let i in this.parseData.layerConvertInfo){let n=this.parseData.layerConvertInfo[i];Ef(this.layerSelectedInfo,i)&&(n.selected=this.layerSelectedInfo[i])}return this}getHeadValue(t){return this.parseData.header?this.parseData.header[t]:null}get isEndSec(){return this.groupIs(0,"ENDSEC")}get isEndTab(){return this.groupIs(0,"ENDTAB")}get isEof(){return this.curr.value=="EOF"}parseHeader(){let t=this.parseData.header,e=this.scanner,r=this.headerCodeInfo={},i,n=null;for(this.curr=e.next();!this.isEof;){if(this.isEndSec){i&&(t[i]=n);break}else this.curr.code===9?(i&&(t[i]=n),i=this.curr.value):(this.curr.code===10?n={x:this.curr.value}:this.curr.code===20?n.y=this.curr.value:this.curr.code===30?n.z=this.curr.value:n=this.curr.value,r[i]=this.curr.code);this.curr=e.next()}this.curr=e.next()}parseBlocks(){let t=this.scanner,e=this.parseData.blocks,r;for(this.curr=t.next();!this.isEof&&!this.isEndSec;)if(this.groupIs(0,"BLOCK"))if(r=this.parseBlock(),!r.name)console.error('block with handle "'+r.handle+'" is missing a name.');else{let i=this.autoEntity(r);Ef(e,r.name)&&console.warn('block with handle "'+r.handle+'" is reapeat a name.'),i&&(e[r.name]=r)}else r?r.endBlock=this.parseEndBlock():this.curr=t.next()}parseBlock(){let t=this.scanner,e={entities:null,handle:null,ownerHandle:null,subclassTag:[],layer:null,name:null,name2:null,xrefPath:null,type:null,position:null,paperSpace:null,endBlock:null};this.curr=t.next();let r;for(;!this.isEof;){switch(r=this.curr.value,this.curr.code){case 0:if(r=="ENDBLK")break;e.entities=this.parseEntities(!0);break;case 5:e.handle=r,this.curr=t.next();break;case 330:e.ownerHandle=r,this.curr=t.next();break;case 100:e.subclassTag.push(r),this.curr=t.next();break;case 8:e.layer=r,this.curr=t.next();break;case 2:e.name=r,this.curr=t.next();break;case 3:e.name2=r,e.name||(e.name=r),this.curr=t.next();break;case 1:e.xrefPath=r,this.curr=t.next();break;case 70:e.type=r||0,this.curr=t.next();break;case 10:e.position=ha(t),this.curr=t.next();break;case 67:e.paperSpace=!!(r&&r==1),this.curr=t.next();break;default:this.curr=t.next()}if(this.groupIs(0,"ENDBLK")){this.curr=t.next();break}}return e}parseEndBlock(){let t=this.scanner;if(this.curr.code==5){let e=[];for(;!this.isEof&&this.curr.code!=0;)gP(e,this.curr.code,this.curr.value),this.curr=t.next();return e}else return this.curr=t.next(),null}parseTables(){let t=this.scanner;for(this.curr=t.next();!this.isEof&&!this.isEndSec;)if(this.groupIs(0,"TABLE")){this.curr=t.next();let e=this.curr.value,r=this._tableDefinitions[e];r?(this.parseData.tables||(this.parseData.tables={}),this.parseData.tables[r.tableName]=this.parseTable(r)):(console.warn("Unhandled Table "+e),this.curr=t.next())}else this.curr=t.next();this.curr=t.next()}parseTable(t){let e=this.scanner,r={handle:null,ownerHandle:null,records:null,expectedCount:null};this.curr=e.next();let i;for(;!this.isEndTab;)switch(i=this.curr.value,this.curr.code){case 5:r.handle=i,this.curr=e.next();break;case 330:r.ownerHandle=i,this.curr=e.next();break;case 100:i==="AcDbSymbolTable"?this.curr=e.next():this.curr=e.next();break;case 70:r.expectedCount=i,this.curr=e.next();break;case 0:if(i===t.dxfSymbolName)r.records=t.parseTableRecords.call(this);else return console.warn("tableDefinition.dxfSymbolName is wrong!",i),this.curr=e.next(),r;break;default:this.curr=e.next()}return this.curr=e.next(),r}parseViewPortRecords(){let t=this.scanner,e=[],r=this._initTabViewPort();this.curr=t.next();let i;for(;!this.isEndTab;)switch(i=this.curr.value,this.curr.code){case 2:r.name=i,this.curr=t.next();break;case 10:r.lowerLeftCorner=ha(t),this.curr=t.next();break;case 11:r.upperRightCorner=ha(t),this.curr=t.next();break;case 12:r.center=ha(t),this.curr=t.next();break;case 13:r.snapBasePoint=ha(t),this.curr=t.next();break;case 14:r.snapSpacing=ha(t),this.curr=t.next();break;case 15:r.gridSpacing=ha(t),this.curr=t.next();break;case 16:r.viewDirectionFromTarget=ha(t),this.curr=t.next();break;case 17:r.viewTarget=ha(t),this.curr=t.next();break;case 42:r.lensLength=i,this.curr=t.next();break;case 43:r.frontClippingPlane=i,this.curr=t.next();break;case 44:r.backClippingPlane=i,this.curr=t.next();break;case 45:r.viewHeight=i,this.curr=t.next();break;case 50:r.snapRotationAngle=i,this.curr=t.next();break;case 51:r.viewTwistAngle=i,this.curr=t.next();break;case 79:r.orthographicType=i,this.curr=t.next();break;case 110:r.ucsOrigin=ha(t),this.curr=t.next();break;case 111:r.ucsXAxis=ha(t),this.curr=t.next();break;case 112:r.ucsYAxis=ha(t),this.curr=t.next();break;case 281:r.renderMode=i,this.curr=t.next();break;case 292:r.defaultLightingOn=i,this.curr=t.next();break;case 330:r.ownerHandle=i,this.curr=t.next();break;case 63:case 421:case 431:r.ambientColor=i,this.curr=t.next();break;case 0:i==="VPORT"&&(e.push(r),r=this._initTabViewPort(),this.curr=t.next());break;default:this.curr=t.next();break}return e.push(r),e}parseLineTypes(){let t=this.scanner,e={},r,i,n=this._initTabLine();this.curr=t.next();let s;for(;!this.isEndTab;)switch(s=this.curr.value,this.curr.code){case 2:n.name=s,r=s,this.curr=t.next();break;case 3:n.description=s,this.curr=t.next();break;case 73:i=s,i>0&&(n.pattern=[]),this.curr=t.next();break;case 40:n.patternLength=s,this.curr=t.next();break;case 49:n.pattern===null&&(n.pattern=[]),n.pattern.push(s),this.curr=t.next();break;case 0:i>0&&i!==n.pattern.length&&console.warn("lengths do not match on LTYPE pattern"),e[r]=n,n=this._initTabLine(),this.curr=t.next();break;default:this.curr=t.next()}return e[r]=n,e}parseLayers(){let t=this.scanner,e={},r,i=this._initTabLayer();this.curr=t.next();let n;for(;!this.isEndTab;)switch(n=this.curr.value,this.curr.code){case 2:i.name=n,r=n,this.curr=t.next();break;case 62:i.visible=n>=0,i.colorIndex=Math.abs(n),i.color=Soe(i.colorIndex),this.curr=t.next();break;case 70:i.standardMark=n,i.frozen=(n&1)!=0||(n&2)!=0,this.curr=t.next();break;case 0:n==="LAYER"&&(e[r]=i,this.popLayerSelectedInfo(r,i),i=this._initTabLayer(),r=null,this.curr=t.next());break;default:this.curr=t.next();break}return e[r]=i,this.popLayerSelectedInfo(r,i),e}popLayerSelectedInfo(t,e){this.layerSelectedInfo||(this.layerSelectedInfo={}),this.layerSelectedInfo[t]=!e.frozen&&e.visible}_initTabViewPort(){return{name:null,lowerLeftCorner:null,upperRightCorner:null,center:null,snapBasePoint:null,snapSpacing:null,gridSpacing:null,viewDirectionFromTarget:null,viewTarget:null,lensLength:null,frontClippingPlane:null,backClippingPlane:null,viewHeight:null,snapRotationAngle:null,viewTwistAngle:null,orthographicType:null,ucsOrigin:null,ucsXAxis:null,ucsYAxis:null,renderMode:null,defaultLightingOn:null,ownerHandle:null,ambientColor:null}}_initTabLine(){return{name:null,description:null,pattern:null,patternLength:null}}_initTabLayer(){return{name:null,visible:null,colorIndex:null,color:null,standardMark:null,frozen:null}}parseEntities(t){let e=this.scanner,r=t?"ENDBLK":"ENDSEC",i=[];for(t||(this.curr=e.next());;){let n=this.curr.value;if(this.curr.code===0){if(n===r)break;let s,a=this._entityHandlers[n];if(a)s=new a(e,this.curr),this.curr=e.lastReadGroup;else{console.warn("Unhandled entity "+n),this.curr=e.next();continue}this.autoEntity(s,i)}else this.curr=e.next()}return t||(this.curr=e.next(),this.autoEntities(i)),i}groupIs(t,e){return this.curr.code===t&&this.curr.value===e}autoEntity(t,e){let r=e?t.entity:t;if(!r)throw new TypeError("entity cannot be undefined or null");if(t instanceof sh){if(!t.isValid())return console.warn("entity is not a valid data.",t.entity.type),!1}else return!0;return r.handle||(r.handle=(++this.lastHandle).toString()),r.layer&&(this.parseData.layerConvertInfo||(this.parseData.layerConvertInfo={}),this.parseData.layerConvertInfo[r.layer]||(this.parseData.layerConvertInfo[r.layer]={selected:!0,pcblayer:null})),e&&this.autoLinkedPoly(t,e),!0}autoLinkedPoly(t,e){let r=t.entity;if(!r.ports||!r.vertices){e.push(t);return}let i=null,n=r.ports;for(let s=0;s<e.length;s++){if(i=e[s].entity.ports,!i||!e[s].entity.pcb_layer.equals(t.entity.pcb_layer))continue;let a=KGe(i,n,this.pointerPlace);if(a!==null){if(a[0]==-1&&(a=[1,0]),e[s]instanceof fK)e[s].extendEntity(t,a);else{let l=new fK(bte(e,e[s]),this.pointerPlace).extendEntity(t,a);e.push(l)}return}}e.push(t)}insertBlock(t,e){let r=t.blockName,i=t.entity.insert;if(!r||!i){console.warn("this insert is no block name or no insertPoint:",r);return}let n=this.parseData.blocks[r];if(!n){console.warn("unmatch block named:",r);return}let s=n.entities;if(!s||!s.length)return console.warn("block is null"),null;let a=n.position;e||(e=Qe.translate(-a.x,-a.y)),e=e.rotateD(t.entity.rotate||0).setOrigin1(a).translate(i.x,i.y);let l=[],c=n.layer;return s.forEach(h=>{if(h instanceof nH){let u=this.insertBlock(h,e);u&&(l=l.concat(u))}else{let u=h.cloneOne();if(!u){console.warn("cloneOne is null:",h.entity.type);return}l.push(u.multiply3(e))}}),l.length>0?l:null}autoEntities(t){if(!t)return;let e=t.length;for(let r=0;r<e;r++){let i=t[r];i instanceof nH?(this.autoInsert(i,t),r--):(i instanceof QC||i instanceof pK)&&(this.autoVerTexPoly(i,t),r--)}}autoInsert(t,e){bte(e,t);let r=this.insertBlock(t);r&&(this.autoEntities(r),r.forEach(i=>{e.push(i)}))}autoVerTexPoly(t,e){bte(e,t);let r=t.entity.layer,i=t.entity.vertexs,n=[];for(let s=0;s<i.length-1;s++){let a=i[s].entity,l=i[s+1].entity,c=a.center,h=l.center;if(c.equals(h,this.pointerPlace)){console.warn("start equals end");continue}if(a.bulge){let u=new KN(null,null);u.initEntity(),u.entity.layer=r;let d=ZGe(c,h,a.bulge),p=d.radius,m=d.largeArcFlag,g=d.sweepFlag,y=q.build1(c,h,p,p,m,g);u.entity.arc=y,u.entity.center=y.center,u.entity.startAngle=y.startAngle,u.entity.endAngle=y.endAngle(),u.autoPorts(),this.autoLinkedPoly(u,n)}else{let u=new ZN(null,null);u.initEntity(),u.entity.layer=r,u.entity.start=c,u.entity.end=h,u.autoPorts(),this.autoLinkedPoly(u,n)}}n.forEach(s=>{e.push(s)})}readSection2Items(){let t=this.scanner,e=[];gP(e,0,"SECTION");let r=t.lastReadGroup;for(gP(e,r.code,r.value),this.curr=t.next();!this.isEof&&!this.isEndSec;)gP(e,this.curr.code,this.curr.value),this.curr=t.next();return gP(e,0,"ENDSEC"),this.curr=t.next(),e}};var S$e=`  0
SECTION
  2
HEADER
  9
$ACADVER
  1
AC1018
  9
$ACADMAINTVER
 70
   104
  9
$DWGCODEPAGE
  3
ANSI_936
  9
$LASTSAVEDBY
  1
win10
  9
$INSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$EXTMIN
 10
1.000000000000000E+20
 20
1.000000000000000E+20
 30
1.000000000000000E+20
  9
$EXTMAX
 10
-1.000000000000000E+20
 20
-1.000000000000000E+20
 30
-1.000000000000000E+20
  9
$LIMMIN
 10
0.0
 20
0.0
  9
$LIMMAX
 10
12.0
 20
9.0
  9
$ORTHOMODE
 70
     0
  9
$REGENMODE
 70
     1
  9
$FILLMODE
 70
     1
  9
$QTEXTMODE
 70
     0
  9
$MIRRTEXT
 70
     0
  9
$LTSCALE
 40
1.0
  9
$ATTMODE
 70
     1
  9
$TEXTSIZE
 40
0.2
  9
$TRACEWID
 40
0.05
  9
$TEXTSTYLE
  7
Standard
  9
$CLAYER
  8
0
  9
$CELTYPE
  6
ByLayer
  9
$CECOLOR
 62
   256
  9
$CELTSCALE
 40
1.0
  9
$DISPSILH
 70
     0
  9
$DIMSCALE
 40
1.0
  9
$DIMASZ
 40
0.18
  9
$DIMEXO
 40
0.0625
  9
$DIMDLI
 40
0.38
  9
$DIMRND
 40
0.0
  9
$DIMDLE
 40
0.0
  9
$DIMEXE
 40
0.18
  9
$DIMTP
 40
0.0
  9
$DIMTM
 40
0.0
  9
$DIMTXT
 40
0.18
  9
$DIMCEN
 40
0.09
  9
$DIMTSZ
 40
0.0
  9
$DIMTOL
 70
     0
  9
$DIMLIM
 70
     0
  9
$DIMTIH
 70
     1
  9
$DIMTOH
 70
     1
  9
$DIMSE1
 70
     0
  9
$DIMSE2
 70
     0
  9
$DIMTAD
 70
     0
  9
$DIMZIN
 70
     0
  9
$DIMBLK
  1

  9
$DIMASO
 70
     1
  9
$DIMSHO
 70
     1
  9
$DIMPOST
  1

  9
$DIMAPOST
  1

  9
$DIMALT
 70
     0
  9
$DIMALTD
 70
     2
  9
$DIMALTF
 40
25.4
  9
$DIMLFAC
 40
1.0
  9
$DIMTOFL
 70
     0
  9
$DIMTVP
 40
0.0
  9
$DIMTIX
 70
     0
  9
$DIMSOXD
 70
     0
  9
$DIMSAH
 70
     0
  9
$DIMBLK1
  1

  9
$DIMBLK2
  1

  9
$DIMSTYLE
  2
Standard
  9
$DIMCLRD
 70
     0
  9
$DIMCLRE
 70
     0
  9
$DIMCLRT
 70
     0
  9
$DIMTFAC
 40
1.0
  9
$DIMGAP
 40
0.09
  9
$DIMJUST
 70
     0
  9
$DIMSD1
 70
     0
  9
$DIMSD2
 70
     0
  9
$DIMTOLJ
 70
     1
  9
$DIMTZIN
 70
     0
  9
$DIMALTZ
 70
     0
  9
$DIMALTTZ
 70
     0
  9
$DIMUPT
 70
     0
  9
$DIMDEC
 70
     4
  9
$DIMTDEC
 70
     4
  9
$DIMALTU
 70
     2
  9
$DIMALTTD
 70
     2
  9
$DIMTXSTY
  7
Standard
  9
$DIMAUNIT
 70
     0
  9
$DIMADEC
 70
     0
  9
$DIMALTRND
 40
0.0
  9
$DIMAZIN
 70
     0
  9
$DIMDSEP
 70
    46
  9
$DIMATFIT
 70
     3
  9
$DIMFRAC
 70
     0
  9
$DIMLDRBLK
  1

  9
$DIMLUNIT
 70
     2
  9
$DIMLWD
 70
    -2
  9
$DIMLWE
 70
    -2
  9
$DIMTMOVE
 70
     0
  9
$LUNITS
 70
     2
  9
$LUPREC
 70
     4
  9
$SKETCHINC
 40
0.1
  9
$FILLETRAD
 40
0.0
  9
$AUNITS
 70
     0
  9
$AUPREC
 70
     0
  9
$MENU
  1
.
  9
$ELEVATION
 40
0.0
  9
$PELEVATION
 40
0.0
  9
$THICKNESS
 40
0.0
  9
$LIMCHECK
 70
     0
  9
$CHAMFERA
 40
0.0
  9
$CHAMFERB
 40
0.0
  9
$CHAMFERC
 40
0.0
  9
$CHAMFERD
 40
0.0
  9
$SKPOLY
 70
     0
  9
$TDCREATE
 40
2460560.605914352
  9
$TDUCREATE
 40
2460560.272581019
  9
$TDUPDATE
 40
2460560.629189815
  9
$TDUUPDATE
 40
2460560.295856482
  9
$TDINDWG
 40
0.0232870370
  9
$TDUSRTIMER
 40
0.0232870370
  9
$USRTIMER
 70
     1
  9
$ANGBASE
 50
0.0
  9
$ANGDIR
 70
     0
  9
$PDMODE
 70
     0
  9
$PDSIZE
 40
0.0
  9
$PLINEWID
 40
0.0
  9
$SPLFRAME
 70
     0
  9
$SPLINETYPE
 70
     6
  9
$SPLINESEGS
 70
     8
  9
$HANDSEED
  5
300
  9
$SURFTAB1
 70
     6
  9
$SURFTAB2
 70
     6
  9
$SURFTYPE
 70
     6
  9
$SURFU
 70
     6
  9
$SURFV
 70
     6
  9
$UCSBASE
  2

  9
$UCSNAME
  2

  9
$UCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$UCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$UCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$UCSORTHOREF
  2

  9
$UCSORTHOVIEW
 70
     0
  9
$UCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSBASE
  2

  9
$PUCSNAME
  2

  9
$PUCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$PUCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$PUCSORTHOREF
  2

  9
$PUCSORTHOVIEW
 70
     0
  9
$PUCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$USERI1
 70
     0
  9
$USERI2
 70
     0
  9
$USERI3
 70
     0
  9
$USERI4
 70
     0
  9
$USERI5
 70
     0
  9
$USERR1
 40
0.0
  9
$USERR2
 40
0.0
  9
$USERR3
 40
0.0
  9
$USERR4
 40
0.0
  9
$USERR5
 40
0.0
  9
$WORLDVIEW
 70
     1
  9
$SHADEDGE
 70
     3
  9
$SHADEDIF
 70
    70
  9
$TILEMODE
 70
     1
  9
$MAXACTVP
 70
    64
  9
$PINSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMCHECK
 70
     0
  9
$PEXTMIN
 10
0.0
 20
0.0
 30
0.0
  9
$PEXTMAX
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMMIN
 10
0.0
 20
0.0
  9
$PLIMMAX
 10
12.0
 20
9.0
  9
$UNITMODE
 70
     0
  9
$VISRETAIN
 70
     1
  9
$PLINEGEN
 70
     0
  9
$PSLTSCALE
 70
     1
  9
$TREEDEPTH
 70
  3020
  9
$CMLSTYLE
  2
Standard
  9
$CMLJUST
 70
     0
  9
$CMLSCALE
 40
1.0
  9
$PROXYGRAPHICS
 70
     1
  9
$MEASUREMENT
 70
     0
  9
$CELWEIGHT
370
    -1
  9
$ENDCAPS
280
     0
  9
$JOINSTYLE
280
     0
  9
$LWDISPLAY
290
     0
  9
$INSUNITS
 70
     4
  9
$HYPERLINKBASE
  1

  9
$STYLESHEET
  1

  9
$XEDIT
290
     1
  9
$CEPSNTYPE
380
     0
  9
$PSTYLEMODE
290
     0
  9
$FINGERPRINTGUID
  2
{FA9A02B2-7E04-C34E-BD13-02980AC2B394}
  9
$VERSIONGUID
  2
{964EB223-33A2-D549-8684-CDE005EE773C}
  9
$EXTNAMES
290
     1
  9
$PSVPSCALE
 40
0.0
  9
$OLESTARTUP
290
     0
  9
$SORTENTS
280
   127
  9
$INDEXCTL
280
     0
  9
$HIDETEXT
280
     1
  9
$XCLIPFRAME
290
     0
  9
$HALOGAP
280
     0
  9
$OBSCOLOR
 70
   257
  9
$OBSLTYPE
280
     0
  9
$INTERSECTIONDISPLAY
280
     0
  9
$INTERSECTIONCOLOR
 70
   257
  9
$DIMASSOC
280
     2
  9
$PROJECTNAME
  1

  0
ENDSEC
  0
SECTION
  2
CLASSES
  0
CLASS
  1
ACDBDICTIONARYWDFLT
  2
AcDbDictionaryWithDefault
  3
ObjectDBX Classes
 90
        0
 91
        1
280
     0
281
     0
  0
CLASS
  1
DICTIONARYVAR
  2
AcDbDictionaryVar
  3
ObjectDBX Classes
 90
        0
 91
       15
280
     0
281
     0
  0
CLASS
  1
MATERIAL
  2
AcDbMaterial
  3
ObjectDBX Classes
 90
     1153
 91
        3
280
     0
281
     0
  0
CLASS
  1
VISUALSTYLE
  2
AcDbVisualStyle
  3
ObjectDBX Classes
 90
     4095
 91
       24
280
     0
281
     0
  0
CLASS
  1
TABLESTYLE
  2
AcDbTableStyle
  3
ObjectDBX Classes
 90
     4095
 91
        1
280
     0
281
     0
  0
CLASS
  1
SCALE
  2
AcDbScale
  3
ObjectDBX Classes
 90
     1153
 91
       33
280
     0
281
     0
  0
CLASS
  1
MLEADERSTYLE
  2
AcDbMLeaderStyle
  3
ACDB_MLEADERSTYLE_CLASS
 90
     4095
 91
        2
280
     0
281
     0
  0
CLASS
  1
CELLSTYLEMAP
  2
AcDbCellStyleMap
  3
ObjectDBX Classes
 90
     1152
 91
        3
280
     0
281
     0
  0
CLASS
  1
EXACXREFPANELOBJECT
  2
ExAcXREFPanelObject
  3
EXAC_ESW
 90
     1025
 91
        0
280
     0
281
     0
  0
CLASS
  1
NPOCOLLECTION
  2
AcDbImpNonPersistentObjectsCollection
  3
ObjectDBX Classes
 90
     1153
 91
        0
280
     0
281
     0
  0
CLASS
  1
LAYER_INDEX
  2
AcDbLayerIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
SPATIAL_INDEX
  2
AcDbSpatialIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
IDBUFFER
  2
AcDbIdBuffer
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
ACDBSECTIONVIEWSTYLE
  2
AcDbSectionViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
CLASS
  1
ACDBDETAILVIEWSTYLE
  2
AcDbDetailViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
ENDSEC
  0
SECTION
  2
TABLES
  0
TABLE
  2
VPORT
  5
8
330
0
100
AcDbSymbolTable
 70
     1
  0
VPORT
  5
90
330
8
100
AcDbSymbolTableRecord
100
AcDbViewportTableRecord
  2
*Active
 70
     0
 10
0.0
 20
0.0
 11
1.0
 21
1.0
 12
97.5486911906951
 22
42.51345460271504
 13
0.0
 23
0.0
 14
0.5
 24
0.5
 15
0.5
 25
0.5
 16
0.0
 26
0.0
 36
1.0
 17
0.0
 27
0.0
 37
0.0
 40
78.45799938217576
 41
1.945409429280396
 42
50.0
 43
0.0
 44
0.0
 50
0.0
 51
0.0
 71
     0
 72
  1000
 73
     1
 74
     3
 75
     0
 76
     1
 77
     0
 78
     0
281
     0
 65
     1
110
0.0
120
0.0
130
0.0
111
1.0
121
0.0
131
0.0
112
0.0
122
1.0
132
0.0
 79
     0
146
0.0
1001
ACAD_NAV_VCDISPLAY
1070
     3
  0
ENDTAB
  0
TABLE
  2
LTYPE
  5
5
330
0
100
AcDbSymbolTable
 70
     1
  0
LTYPE
  5
14
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByBlock
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
15
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByLayer
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
16
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
Continuous
 70
     0
  3
Solid line
 72
    65
 73
     0
 40
0.0
  0
ENDTAB
  0
TABLE
  2
LAYER
  5
2
102
{ACAD_XDICTIONARY
360
18B
102
}
330
0
100
AcDbSymbolTable
 70
     1
  0
LAYER
  5
10
102
{ACAD_XDICTIONARY
360
E1
102
}
330
2
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
  2
0
 70
     0
 62
     7
  6
Continuous
370
    -3
390
F
  0
ENDTAB
  0
TABLE
  2
STYLE
  5
3
330
0
100
AcDbSymbolTable
 70
     2
  0
STYLE
  5
11
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Standard
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
ACAD
1000
Arial
1071
       34
  0
STYLE
  5
D7
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD
1000
Arial
1071
       34
  0
ENDTAB
  0
TABLE
  2
VIEW
  5
6
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
UCS
  5
7
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
APPID
  5
9
330
0
100
AcDbSymbolTable
 70
     7
  0
APPID
  5
12
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD
 70
     0
  0
APPID
  5
D8
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnoPO
 70
     0
  0
APPID
  5
D9
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnotative
 70
     0
  0
APPID
  5
DA
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMJAG
 70
     0
  0
APPID
  5
DB
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMTALN
 70
     0
  0
APPID
  5
102
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_MLEADERVER
 70
     0
  0
APPID
  5
1A3
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_NAV_VCDISPLAY
 70
     0
  0
ENDTAB
  0
TABLE
  2
DIMSTYLE
  5
A
330
0
100
AcDbSymbolTable
 70
     2
100
AcDbDimStyleTable
 71
     2
340
DC
340
27
  0
DIMSTYLE
105
27
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Standard
 70
     0
340
11
  0
DIMSTYLE
105
DC
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
340
11
1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD_DSTYLE_DIMJAG
1070
   388
1040
1.5
1001
ACAD_DSTYLE_DIMTALN
1070
   392
1070
     0
  0
ENDTAB
  0
TABLE
  2
BLOCK_RECORD
  5
1
330
0
100
AcDbSymbolTable
 70
     1
  0
BLOCK_RECORD
  5
1F
102
{ACAD_XDICTIONARY
360
15A
102
}
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Model_Space
340
22
  0
BLOCK_RECORD
  5
73
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space
340
74
  0
BLOCK_RECORD
  5
78
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space0
340
79
  0
ENDTAB
  0
ENDSEC
  0
SECTION
  2
BLOCKS
  0
BLOCK
  5
20
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockBegin
  2
*Model_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Model_Space
  1

  0
ENDBLK
  5
21
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
75
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space
  1

  0
ENDBLK
  5
76
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
7A
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space0
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space0
  1

  0
ENDBLK
  5
7B
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
ENDSEC
  0
SECTION
  2
ENTITIES
  0
ENDSEC
  0
SECTION
  2
OBJECTS
  0
DICTIONARY
  5
C
330
0
100
AcDbDictionary
281
     1
  3
ACAD_CIP_PREVIOUS_PRODUCT_INFO
350
1A2
  3
ACAD_COLOR
350
6C
  3
ACAD_DETAILVIEWSTYLE
350
1A8
  3
ACAD_GROUP
350
D
  3
ACAD_LAYOUT
350
1A
  3
ACAD_MATERIAL
350
6B
  3
ACAD_MLEADERSTYLE
350
D2
  3
ACAD_MLINESTYLE
350
17
  3
ACAD_PLOTSETTINGS
350
19
  3
ACAD_PLOTSTYLENAME
350
E
  3
ACAD_SCALELIST
350
B1
  3
ACAD_SECTIONVIEWSTYLE
350
1A5
  3
ACAD_TABLESTYLE
350
A6
  3
ACAD_VISUALSTYLE
350
95
  3
ACDB_RECOMPOSE_DATA
350
2BF
  3
AcDbVariableDictionary
350
59
  3
AcDsDecomposeData
350
2C5
  0
DICTIONARY
  5
18B
330
2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_LAYERSTATES
360
18C
  0
DICTIONARY
  5
E1
330
10
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
15A
330
1F
100
AcDbDictionary
280
     1
281
     1
  0
XRECORD
  5
1A2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
300
ACD
300
2021
300

  0
DICTIONARY
  5
6C
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A8
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A9
  0
DICTIONARY
  5
D
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Model
350
22
  3
\uFFFD\uFFFD\uFFFD\uFFFD1
350
74
  3
\uFFFD\uFFFD\uFFFD\uFFFD2
350
79
  0
DICTIONARY
  5
6B
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
ByBlock
350
93
  3
ByLayer
350
92
  3
Global
350
94
  0
DICTIONARY
  5
D2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Annotative
350
E0
  3
Standard
350
D3
  0
DICTIONARY
  5
17
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
18
  0
DICTIONARY
  5
19
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
ACDBDICTIONARYWDFLT
  5
E
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Normal
350
F
100
AcDbDictionaryWithDefault
340
F
  0
DICTIONARY
  5
B1
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
A0
350
B2
  3
A1
350
124
  3
A2
350
125
  3
A3
350
126
  3
A4
350
127
  3
A5
350
128
  3
A6
350
129
  3
A7
350
12A
  3
A8
350
12B
  3
A9
350
12C
  3
B0
350
12D
  3
B1
350
12E
  3
B2
350
12F
  3
B3
350
130
  3
B4
350
131
  3
B5
350
132
  3
B6
350
133
  3
B7
350
134
  3
B8
350
135
  3
B9
350
136
  3
C0
350
137
  3
C1
350
138
  3
C2
350
139
  3
C3
350
13A
  3
C4
350
13B
  3
C5
350
13C
  3
C6
350
13D
  3
C7
350
13E
  3
C8
350
13F
  3
C9
350
140
  3
D0
350
141
  3
D1
350
142
  3
D2
350
143
  0
DICTIONARY
  5
1A5
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A7
  0
DICTIONARY
  5
A6
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
A7
  0
DICTIONARY
  5
95
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
2dWireframe
350
9B
  3
Basic
350
9A
  3
Brighten
350
A1
  3
ColorChange
350
A5
  3
Conceptual
350
9E
  3
Dim
350
A0
  3
EdgeColorOff
350
172
  3
Facepattern
350
A4
  3
Flat
350
96
  3
FlatWithEdges
350
97
  3
Gouraud
350
98
  3
GouraudWithEdges
350
99
  3
Hidden
350
9D
  3
JitterOff
350
170
  3
Linepattern
350
A3
  3
OverhangOff
350
171
  3
Realistic
350
9F
  3
Shaded
350
17F
  3
Shaded with edges
350
17E
  3
Shades of Gray
350
17B
  3
Sketchy
350
17C
  3
Thicken
350
A2
  3
Wireframe
350
9C
  3
X-Ray
350
17D
  0
XRECORD
  5
2BF
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
 90
        1
330
A7
  0
DICTIONARY
  5
59
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
CAMERAHEIGHT
350
227
  3
CANNOSCALE
350
EB
  3
CMLEADERSTYLE
350
EA
  3
CTABLESTYLE
350
AB
  3
CVIEWDETAILSTYLE
350
1B4
  3
CVIEWSECTIONSTYLE
350
1B5
  3
DIMASSOC
350
5A
  3
HIDETEXT
350
5E
  3
INDEXCTL
350
226
  3
LAYEREVAL
350
14A
  3
LAYERNOTIFY
350
14B
  3
LIGHTINGUNITS
350
224
  3
MSLTSCALE
350
223
  3
SORTENTS
350
225
  3
XCLIPFRAME
350
228
  0
DICTIONARY
  5
2C5
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
AcDsRecords
350
2C7
  3
AcDsSchemas
350
2C6
1001
ACAD
1070
     2
  0
DICTIONARY
  5
18C
102
{ACAD_REACTORS
330
18B
102
}
330
18B
100
AcDbDictionary
281
     1
  0
ACDBDETAILVIEWSTYLE
  5
1A9
102
{ACAD_XDICTIONARY
360
2FE
102
}
102
{ACAD_REACTORS
330
1A8
102
}
330
1A8
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbDetailViewStyle
 70
     0
 71
     0
 90
        3
 71
     1
340
11
 62
   256
 40
0.24
340
0
 62
   256
 40
0.24
300

 40
0.36
280
     3
 71
     2
340
16
 90
       25
 62
   256
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewDetailId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
340
16
 90
       25
 62
   256
340
16
 90
       25
 62
   256
280
     0
  0
LAYOUT
  5
22
102
{ACAD_XDICTIONARY
360
191
102
}
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
none_device
  4
Letter_(8.50_x_11.00_Inches)
  6

 40
6.349999904632568
 41
6.349999904632568
 42
6.350006103515625
 43
6.350006103515625
 44
215.8999938964844
 45
279.3999938964844
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
3.560208697428376
 70
 11952
 72
     0
 73
     1
 74
     0
  7

 75
     0
147
0.28088241027059
 76
     0
 77
     2
 78
   300
148
0.1311165230791651
149
0.096403374003771
100
AcDbLayout
  1
Model
 70
     1
 71
     0
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
1F
331
90
  0
LAYOUT
  5
74
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\uFFFD\uFFFD\uFFFD\uFFFD1
 70
     1
 71
     1
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
73
  0
LAYOUT
  5
79
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\uFFFD\uFFFD\uFFFD\uFFFD2
 70
     1
 71
     2
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
78
  0
MATERIAL
  5
93
102
{ACAD_XDICTIONARY
360
185
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByBlock
  0
MATERIAL
  5
92
102
{ACAD_XDICTIONARY
360
183
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByLayer
  0
MATERIAL
  5
94
102
{ACAD_XDICTIONARY
360
10B
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
Global
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
1001
ACAD
1070
    -1
1070
     3
1070
     0
1000

1071
        0
1070
     0
  0
MLEADERSTYLE
  5
E0
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     1
143
0.125
1001
ACAD_MLEADERVER
1070
     2
  0
MLEADERSTYLE
  5
D3
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     0
143
0.125
1001
ACAD_MLEADERVER
1070
     2
  0
MLINESTYLE
  5
18
102
{ACAD_REACTORS
330
17
102
}
330
17
100
AcDbMlineStyle
  2
STANDARD
 70
     0
  3

 62
   256
 51
90.0
 52
90.0
 71
     2
 49
0.5
 62
   256
  6
BYLAYER
 49
-0.5
 62
   256
  6
BYLAYER
  0
ACDBPLACEHOLDER
  5
F
102
{ACAD_REACTORS
330
E
102
}
330
E
  0
SCALE
  5
B2
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:1
140
1.0
141
1.0
290
     1
  0
SCALE
  5
124
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:2
140
1.0
141
2.0
290
     0
  0
SCALE
  5
125
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:4
140
1.0
141
4.0
290
     0
  0
SCALE
  5
126
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:5
140
1.0
141
5.0
290
     0
  0
SCALE
  5
127
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:8
140
1.0
141
8.0
290
     0
  0
SCALE
  5
128
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:10
140
1.0
141
10.0
290
     0
  0
SCALE
  5
129
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:16
140
1.0
141
16.0
290
     0
  0
SCALE
  5
12A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:20
140
1.0
141
20.0
290
     0
  0
SCALE
  5
12B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:30
140
1.0
141
30.0
290
     0
  0
SCALE
  5
12C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:40
140
1.0
141
40.0
290
     0
  0
SCALE
  5
12D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:50
140
1.0
141
50.0
290
     0
  0
SCALE
  5
12E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:100
140
1.0
141
100.0
290
     0
  0
SCALE
  5
12F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
2:1
140
2.0
141
1.0
290
     0
  0
SCALE
  5
130
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
4:1
140
4.0
141
1.0
290
     0
  0
SCALE
  5
131
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
8:1
140
8.0
141
1.0
290
     0
  0
SCALE
  5
132
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
10:1
140
10.0
141
1.0
290
     0
  0
SCALE
  5
133
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
100:1
140
100.0
141
1.0
290
     0
  0
SCALE
  5
134
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/128" = 1'-0"
140
0.0078125
141
12.0
290
     0
  0
SCALE
  5
135
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/64" = 1'-0"
140
0.015625
141
12.0
290
     0
  0
SCALE
  5
136
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/32" = 1'-0"
140
0.03125
141
12.0
290
     0
  0
SCALE
  5
137
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/16" = 1'-0"
140
0.0625
141
12.0
290
     0
  0
SCALE
  5
138
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/32" = 1'-0"
140
0.09375
141
12.0
290
     0
  0
SCALE
  5
139
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/8" = 1'-0"
140
0.125
141
12.0
290
     0
  0
SCALE
  5
13A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/16" = 1'-0"
140
0.1875
141
12.0
290
     0
  0
SCALE
  5
13B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/4" = 1'-0"
140
0.25
141
12.0
290
     0
  0
SCALE
  5
13C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/8" = 1'-0"
140
0.375
141
12.0
290
     0
  0
SCALE
  5
13D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/2" = 1'-0"
140
0.5
141
12.0
290
     0
  0
SCALE
  5
13E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/4" = 1'-0"
140
0.75
141
12.0
290
     0
  0
SCALE
  5
13F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1" = 1'-0"
140
1.0
141
12.0
290
     0
  0
SCALE
  5
140
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1-1/2" = 1'-0"
140
1.5
141
12.0
290
     0
  0
SCALE
  5
141
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3" = 1'-0"
140
3.0
141
12.0
290
     0
  0
SCALE
  5
142
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
6" = 1'-0"
140
6.0
141
12.0
290
     0
  0
SCALE
  5
143
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1'-0" = 1'-0"
140
12.0
141
12.0
290
     0
  0
ACDBSECTIONVIEWSTYLE
  5
1A7
102
{ACAD_XDICTIONARY
360
2FC
102
}
102
{ACAD_REACTORS
330
1A5
102
}
330
1A5
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbSectionViewStyle
 70
     0
 71
     0
 90
       78
 71
     1
340
11
 62
   256
 40
0.24
340
0
340
0
 62
   256
 40
0.24
300
I, O, Q, S, X, Z
 40
0.48
 90
        3
 40
0.18
 90
        1
 71
     2
340
16
 90
       25
 62
   256
340
16
 90
       50
 62
   256
 40
0.24
 40
0.0
 40
0.24
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewSectionStartId>%-%<\\AcVar ViewSectionEndId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
 62
   256
 62
   257
300
ANSI31
 40
1.0
 90
        0
290
     0
290
     0
 90
        6
 40
0.0
 40
1.570796326794896
 40
0.2617993877991494
 40
1.308996938995747
 40
-0.2617993877991494
 40
1.832595714594046
  0
TABLESTYLE
  5
A7
102
{ACAD_XDICTIONARY
360
FF
102
}
102
{ACAD_REACTORS
330
A6
102
}
330
A6
100
AcDbTableStyle
  3
Standard
 70
     0
 71
     0
 40
0.06
 41
0.06
280
     0
281
     0
  7
Standard
140
0.18
170
     2
 62
     0
 63
     7
283
     0
274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.25
170
     5
 62
     0
 63
     7
283
     0
274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.18
170
     5
 62
     0
 63
     7
283
     0
274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  0
VISUALSTYLE
  5
9B
102
{ACAD_XDICTIONARY
360
2D5
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
2dWireframe
 70
     4
 71
     0
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9A
102
{ACAD_XDICTIONARY
360
2D3
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Basic
 70
     7
 71
     1
 72
     0
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A1
102
{ACAD_XDICTIONARY
360
2E1
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Brighten
 70
    12
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
50.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A5
102
{ACAD_XDICTIONARY
360
2E9
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
ColorChange
 70
    16
 71
     2
 72
     2
 73
     3
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     8
421
  8421504
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     8
424
  8421504
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9E
102
{ACAD_XDICTIONARY
360
2DB
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Conceptual
 70
     9
 71
     3
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
   257
 75
     1
175
     1
 42
40.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A0
102
{ACAD_XDICTIONARY
360
2DF
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Dim
 70
    11
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
-50.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
172
102
{ACAD_XDICTIONARY
360
2F0
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
EdgeColorOff
 70
    22
 71
     2
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A4
102
{ACAD_XDICTIONARY
360
2E7
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Facepattern
 70
    15
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
96
102
{ACAD_XDICTIONARY
360
2CB
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Flat
 70
     0
 71
     2
 72
     1
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
97
102
{ACAD_XDICTIONARY
360
2CD
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
FlatWithEdges
 70
     1
 71
     2
 72
     1
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
98
102
{ACAD_XDICTIONARY
360
2CF
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Gouraud
 70
     2
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
99
102
{ACAD_XDICTIONARY
360
2D1
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
GouraudWithEdges
 70
     3
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9D
102
{ACAD_XDICTIONARY
360
2D9
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Hidden
 70
     6
 71
     1
 72
     2
 73
     2
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
   257
 75
     2
175
     1
 42
40.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
170
102
{ACAD_XDICTIONARY
360
2EC
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
JitterOff
 70
    20
 71
     2
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
       10
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A3
102
{ACAD_XDICTIONARY
360
2E5
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Linepattern
 70
    14
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     7
175
     7
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
171
102
{ACAD_XDICTIONARY
360
2EE
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
OverhangOff
 70
    21
 71
     2
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        9
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9F
102
{ACAD_XDICTIONARY
360
2DD
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Realistic
 70
     8
 71
     2
 72
     3
 73
     0
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17F
102
{ACAD_XDICTIONARY
360
2FA
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded
 70
    27
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     8
425
  7895160
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        5
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17E
102
{ACAD_XDICTIONARY
360
2F8
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded with edges
 70
    26
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        2
 64
     7
 65
   257
 75
     2
175
     1
 42
1.0
 92
        8
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        5
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17B
102
{ACAD_XDICTIONARY
360
2F2
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shades of Gray
 70
    23
 71
     2
 72
     2
 73
     3
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
     7
 75
     1
175
     1
 42
40.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17C
102
{ACAD_XDICTIONARY
360
2F4
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Sketchy
 70
    24
 71
     1
 72
     2
 73
     2
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
     7
 75
     1
175
     1
 42
40.0
 92
       11
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     6
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A2
102
{ACAD_XDICTIONARY
360
2E3
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Thicken
 70
    13
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
       12
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9C
102
{ACAD_XDICTIONARY
360
2D7
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Wireframe
 70
     5
 71
     0
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17D
102
{ACAD_XDICTIONARY
360
2F6
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
X-Ray
 70
    25
 71
     2
 72
     2
 73
     1
 90
        1
 40
0.5
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
DICTIONARYVAR
  5
227
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
60.000000
  0
DICTIONARYVAR
  5
EB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1:1
  0
DICTIONARYVAR
  5
EA
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
AB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
1B4
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
1B5
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
5A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
5E
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
226
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14B
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
224
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
223
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
225
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
127
  0
DICTIONARYVAR
  5
228
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARY
  5
2C7
102
{ACAD_REACTORS
330
2C5
102
}
330
2C5
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
2C6
102
{ACAD_REACTORS
330
2C5
102
}
330
2C5
100
AcDbDictionary
281
     1
  3
1654967885312
350
2C0
  3
1654967885328
350
2C1
  3
1654967885344
350
2C2
  3
1654967885360
350
2C3
  3
1654967885376
350
2C4
  0
DICTIONARY
  5
2FE
330
1A9
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2FF
  0
DICTIONARY
  5
191
330
22
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
185
330
93
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2C9
  3
FBXASSET
360
186
  0
DICTIONARY
  5
183
330
92
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2C8
  3
FBXASSET
360
184
  0
DICTIONARY
  5
10B
330
94
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2CA
  3
BUMPTILE
360
10D
  3
DIFFUSETILE
360
10C
  3
FBXASSET
360
187
  3
OPACITYTILE
360
10E
  3
REFLECTIONTILE
360
10F
  0
DICTIONARY
  5
2FC
330
1A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2FD
  0
DICTIONARY
  5
FF
330
A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_ROUNDTRIP_2008_TABLESTYLE_CELLSTYLEMAP
360
2BE
  3
ACAD_XREC_ROUNDTRIP
360
2EB
  0
DICTIONARY
  5
2D5
330
9B
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2D6
  0
DICTIONARY
  5
2D3
330
9A
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2D4
  0
DICTIONARY
  5
2E1
330
A1
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2E2
  0
DICTIONARY
  5
2E9
330
A5
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2EA
  0
DICTIONARY
  5
2DB
330
9E
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2DC
  0
DICTIONARY
  5
2DF
330
A0
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2E0
  0
DICTIONARY
  5
2F0
330
172
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2F1
  0
DICTIONARY
  5
2E7
330
A4
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2E8
  0
DICTIONARY
  5
2CB
330
96
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2CC
  0
DICTIONARY
  5
2CD
330
97
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2CE
  0
DICTIONARY
  5
2CF
330
98
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2D0
  0
DICTIONARY
  5
2D1
330
99
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2D2
  0
DICTIONARY
  5
2D9
330
9D
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2DA
  0
DICTIONARY
  5
2EC
330
170
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2ED
  0
DICTIONARY
  5
2E5
330
A3
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2E6
  0
DICTIONARY
  5
2EE
330
171
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2EF
  0
DICTIONARY
  5
2DD
330
9F
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2DE
  0
DICTIONARY
  5
2FA
330
17F
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2FB
  0
DICTIONARY
  5
2F8
330
17E
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2F9
  0
DICTIONARY
  5
2F2
330
17B
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2F3
  0
DICTIONARY
  5
2F4
330
17C
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2F5
  0
DICTIONARY
  5
2E3
330
A2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2E4
  0
DICTIONARY
  5
2D7
330
9C
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2D8
  0
DICTIONARY
  5
2F6
330
17D
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2F7
  0
XRECORD
  5
2C0
102
{ACAD_REACTORS
330
2C6
102
}
330
2C6
100
AcDbXrecord
280
     1
  1
AcDb_Thumbnail_Schema
102
{ATTRRECORD
341
2C1
  2
AcDbDs::TreatedAsObjectData
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
2C2
  2
AcDbDs::Legacy
280
     1
291
     1
102
ATTRRECORD}
  2
AcDbDs::ID
280
    10
 91
        8
102
{ATTRRECORD
341
2C3
  2
AcDs:Indexable
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
2C4
  2
AcDbDs::HandleAttribute
280
     7
282
     1
102
ATTRRECORD}
  2
Thumbnail_Data
280
    15
 91
        0
  0
XRECORD
  5
2C1
102
{ACAD_REACTORS
330
2C6
102
}
330
2C6
100
AcDbXrecord
280
     1
  1
AcDbDs::TreatedAsObjectDataSchema
  2
AcDbDs::TreatedAsObjectData
280
     1
 91
        0
  0
XRECORD
  5
2C2
102
{ACAD_REACTORS
330
2C6
102
}
330
2C6
100
AcDbXrecord
280
     1
  1
AcDbDs::LegacySchema
  2
AcDbDs::Legacy
280
     1
 91
        0
  0
XRECORD
  5
2C3
102
{ACAD_REACTORS
330
2C6
102
}
330
2C6
100
AcDbXrecord
280
     1
  1
AcDbDs::IndexedPropertySchema
  2
AcDs:Indexable
280
     1
 91
        0
  0
XRECORD
  5
2C4
102
{ACAD_REACTORS
330
2C6
102
}
330
2C6
100
AcDbXrecord
280
     1
  1
AcDbDs::HandleAttributeSchema
  2
AcDbDs::HandleAttribute
280
     7
 91
        1
284
     1
  0
XRECORD
  5
2FF
102
{ACAD_REACTORS
330
2FE
102
}
330
2FE
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
XRECORD
  5
2C9
102
{ACAD_REACTORS
330
185
102
}
330
185
100
AcDbXrecord
280
     1
102
MATERIAL
148
0.0
149
0.0
149
0.0
 93
        0
 94
       63
282
     0
 72
     1
 77
     1
171
     1
175
     1
179
     1
273
     0
  0
XRECORD
  5
186
102
{ACAD_REACTORS
330
185
102
}
330
185
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
7581DE8E-A623-425F-9BF4-B3F4BE6C4F9A
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623B9A2F3B5FEC0000007C01000008000000636F72652E786D6C8D90416E83301045AF62CDB632D8040820E328B4E204BD80653BC44AB011B6AB1EBF262152BBEB6A467FFE9B197D76FA9EEFE84BAFDE38DB03CD08206DA553C64E3DC470C10DA01367AB73E1970D9015B3EE61
310
9381B3697571D925E96CD03624D53AA5775178AF0320794F4D0F5E5EF52C32114372F85BB608791393CEE8AB4B708C46A1E711A3D23E73317A055E0D4D53D6C71A9FC7A1C6657D18703354232ECFED4731B6B43CBED72CDF60CE82995FF7E5AA45D00A7841488B29C5A4F8A46547AAAEA8DE48D311C2F2CDFE078A8BFA2714
310
8D0D87627FF78979E0343DF21870966F59A4F2082AD52D37FE03504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623B6E137E0172010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C0810121947A1554ED00B38E05014B091B1518EDFE511A5A9D22AFD2A1F60CDEC7A67C698ED2E6D8306
310
69FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7166B4B65FCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B0FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2601EE7691A25EBC4DB1FF2C48B9255EEA5797C
310
F0A2FDE62D3C6C8268FD9A3032367366EBF6AAAE30525859621E52BAF182C0A3E17B106D69BC0DE3179A6E2965642CBF6B725DF96493AB955D858BDCB9ADC73C002113F1CD2D4464512F06D04338236388F09912BE0F1A028190AD3836571F67800659586D22604AED6ED4201A27612AF5E9F4A09F178CCC9D3075DA1C5C3F
310
9C113E3DE3F71DE1A885AAC084B0B03C3A3BEA64B38625B44E1A6FB017A4B46945F39C8D5F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F02504B0304140006080800AC70623BE001BAC07D0000009D0000000B0000006662782F636E782E786D6C4DCCD10AC2201886E15B91FFDCA6536B037548D87D8CE686
310
E4344CA3CB6F8B1D74F4C1C3C72B87CF1AD0DBE5974F51013D11402EDED3E4E3A2A096197780062D734AE5EF06288EAB53B03368B9E4549F074D6E1E6B289B061F1F07124689687987B9601C7373BD60C36E065B6A6DDF7341A93843A365F32B6DBB87F517504B0304140006080800AC70623B8E5068122901000012020000
310
310000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C8D515B6EC32010BC0AE22B55850D364E93081345557A825E801892A2C460F1A872FC2EB523B57FF961D1EECCECECAED8DFC71BFA36215AEF7ACC2A8A917183D7D65D7A9CD3996C30DA4B
310
11BC4F7F601839359A1E973496E2127C9E96D4E05D322E41D6796D96A48AD1248C861B7C7A1C872F33AA4AE5048878AD26355CD5C554AC8232E0A4882980013437292F96B465B46BF886F0AEE5841FDEDFC8A1FD3890233B1EB75BDE31D6AD453D13A5C8D9EA856E35D8B1676BC2B322852C45B2E3C3FE108C4A4663D950BA
310
258C11DA7C32BEA3DDAEE95EE96647A9A80BFC1F294FFA4952B62EB5CD6277A6452C99A8E78214DAE7D3ED61C6DC271F122AFD56D10C2F305545CB6A60FC1908E383E29A2F8A31F900EB5D5D4F8065DD2CBBE652D4E542107ECF07B15C53FE00504B0304140006080800AC70623B503B51794E010000330300003000000066
310
62782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F
310
77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347
310
DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F
310
504B0304140006080800AC70623B38FA165F680500003C100000340000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F6F626A656374732E786D6CAD575D6FA33814FD2B887D0E8424EDB42BCAA8499A2A1A756634D18CF6A15264C0A16CC146B6E9A4FBEBF7180C
310
019276B21F7908D8D8F7F3DCE36BFFE33ECFAC172A64CAD98DED3963DBA22CE271CA921BBB54BBD1956D7D0C7CC1B9EA2CB32D46727A63EB693BF013C1CBC24CC57447CA4C0D6657F33F2C1951466D2BCA889437B68C9E684E1C522A1E53F9ECC4441127D9ED1DCFA917F6C52682144F03A105119429588A790629566D94D7
310
1F8E6D37F05DFD3DF0F5BF59357D7B955BF9D3D79F32A9088B8E940DC44CBDD9F26E72713DBA98CDA6A3D9E5C41BCD57F3E5C8FB301D2F2E178BEBDBBB6B28964A4092B144D09D1DDC2336228D7CB7FED45A6C0C3F6552C419A351E53F3CAC6C3612635A5016238F2995D0D6F17ADC1F7A3A369DCF533D362ABBD3E779D5DD
310
D111D4D8DE3CBB96F2F04FB820CF41859054A3AA8E8F71B4C6DFF810B590F3CC7C4BA5951345454A322B4B4341C4AB1D60A95E12F83D311A9D42235C7B6007DE415ED75694C6AFB17BCACA5D99651A9A7650217B0BFC53252BCBD2BFA838AD0D36215765CAD4957148BD16D40EAE7DB79A0C7CFD984ECCC73A90D62E230952
310
0E37EBAF034717BAF6D64B3BF8B40AF71B5D8FA79517821754280D1F40AB495CF3D451326ABDB332A737C0995ECC0F41F986C87F46F91E4C41DE44BA9FED67468B1284C91D173972E38CAB9F356E5E46EDDBF10BF86CB0FA784D3BF3AF16FB6E6B6C9F30DECA1FC0A55373F5DFF3D78F5917A99DF405FE0B0A8C8BA909E526
310
2219A8E72165488806A595714C81CB77E1DE0ED6604A303B76912C680372F4E2BB2FF88EFF5A36D8AA52DF79322474C0B767303F625995056C7B032C473C592936CEBD15F38BFFA5666E979B4F9B52EC48441F0CB12CE92E65A9C2D979006FD7A05E227A1E3DD3D79F5CC470F438099B6E1272A34A22DA3AE63AF0497358E8
310
C141734F41847D09D79CE7FF42C3432A239A6584515E365ADA634863B52519D327A00AEB804E2703140BFA92EA4EA2B7A26716CEFA48A4850E597BE8B53CEDBCE1CBF7F56780D20EE6AF73A0F5F9B02A3CD07DC4332EB6E1EBB666421BE0C39E3EBA7FF4E16D22EA6A29407C85E586724C88B771BADB9512BC7B228A3FD68B
310
6EA65A22397E690AA8D158D7E40CEC8CDA23C2C0B7D1898640101CEC9C6D531CE328CB93CABBBA870A6425F70DF96199175B92F392A973C2346EFC69AC6F8577BB18F993A8E8C90E36D573340765C7343EA4AA87027D049DF0A9979E0F1757DEF2EEEA6E747B39412B35B9588DAEE7ABD9683E5DCDE677978BD9EAFAB6B5A8
310
B224F09B13AA5B8388264E44BF14A909F3F7F5A16CEDE08128E9DED705E526F5F3FBDA415BECBBD80380B71BD77991D19C3245347C1FF44BF68DA0ABE8C9A8E7D73949E81952BEDC6F063660E68C7D5F75A9D19F83BD6676A16BE1A410F554E621236936D8681C770A9618B79B50B6CF9AD19BA11E9978A20F953C4B63104E
310
6C2594E7548176CE607B915309C474BBF2D8DC1ECED8FD52F7838A84196D2C79226889330954036E65A4FAF3D66F68E174177563E3B0739EF1670AD1B690EA1B1BFCA6D2884A27C4F1A81B9F4A3820802EAC2541408DB02443675D6F6AC7ED2E1D1BD00F4E40A3BF5D724EB764FCEA116F4E8A02A7768F562BDB8C82E81F39
310
DE98631185D7B054AD2F8789D6994A0D2AAB76CADC0DD0423C1BD57BD4D7FB6E794EB5A61791B3EE49EF82A0963A524424D5BD40DB674CBA5D7E75D10A58EB2F569195097279BEA491A00073A90B1C28022A8CCC82284075F1FBE357C17117CDAD550A083C2E789E736606B7E62E6B6D9E70338D1F410B545F3FE464EC798F
310
55D76F2E22DB9048EA90583E63A22938EDC1006B00E4D1716A52E0EA1C0C96AF9796393066105A81F6A829ADAFE1168A47DF1C75A974C9B278B7F177ABA5008340CB1EFC0D504B0304140006080000AC70623B000000000000000000000000350000006662782F30333130353234382D343533342D344143372D413346412D
310
4531454539393435313135362F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E636660600000504B0304140006080000AC70
310
623B000000000000000000000000370000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30333130353234382D343533342D344143372D41
310
3346412D4531454539393435313135362F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11D
310
E607FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BF2C5666EFF000000A00100003B0000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F7265736F7572636573
310
2F636F72652E786D6C8D504B6E833010BD0A9A6D65B00910888CA3D02A27E8052C33A156821DF953F5F8B5132AB5BB6E6646EFA3797AFCF8B5DE8A4F745E5B33022B291468949DB5594688E1427A288E823B6BC32F191446AE38428641F0C5D978DF20654D4013126AEC8C1B28BDC70085BAA56304AF3E7095A58C2129FCB5
310
BC4B75950B96AC4C74D209EE834B018AE7933C4138F4363A859E574F56F018F5BC69F49C7EEA8B4607A29DFABEE9F62D399DA78E34DD6E22FDD49E49731ADEEAF3C09AFD6BC7AB6C163CE8F527A3722803CE206A4A07C218A1F53B6B0EB43DD4ED0BED0F94F22ACBFF98E27DFEA7296A1376F516F769F320580AF22004AF72
310
5F693DCA4C3B772BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B200
310
00005B436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623B9A2F3B5FEC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D
310
6C504B01021400140006080800AC70623B6E137E0172010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623BE001BAC07D0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B010214001400060808
310
00AC70623B8E506812290100001202000031000000000000000000000000005B0500006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D3
310
0600006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6C504B01021400140006080800AC70623B38FA165F680500003C10000034000000000000000000000000006F0800006662782F30333130353234382D343533342D344143372D413346412D4531
310
454539393435313135362F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000290E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F76657274696365732E62696E504B01021400
310
140006080800AC70623BF270F133060000000400000036000000000000000000000000007C0E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000
310
000000000000000000D60E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD1900000004101000036000000000000000000000000002B0F00006662782F30333130353234382D
310
343533342D344143372D413346412D4531454539393435313135362F6469726563746F72792E786D6C504B01021400140006080800AC70623BF2C5666EFF000000A00100003B000000000000000000000000000F1000006662782F30333130353234382D343533342D344143372D413346412D453145453939343531313536
310
2F7265736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000671100000000
  0
XRECORD
  5
2C8
102
{ACAD_REACTORS
330
183
102
}
330
183
100
AcDbXrecord
280
     1
102
MATERIAL
148
0.0
149
0.0
149
0.0
 93
        0
 94
       63
282
     0
 72
     1
 77
     1
171
     1
175
     1
179
     1
273
     0
  0
XRECORD
  5
184
102
{ACAD_REACTORS
330
183
102
}
330
183
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
778E3A9F-1AF3-452F-85C1-1BC15BD3F630
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BFD5588D4EC0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103891DC7C24471939CA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EF81EEFE8CBCCC17AD7012D0820E394D7D60D1DA478C50DA083E0B3F7F1970D9093A3E960
310
9141F061F6695A25E55D342E66D5796D56518660222075CF4D07417D9A511632C5EC08B76292EA260753D05797E194AC46CF2356E77DF66ACD0C62C768BD63971E5727D2E06DDF9C71BF7B3FE10BABF79BFA488FE4DCF07281058F767CDD57B391D168108C903DA61413F641B72DA95A56BD91A62584978BFD0F9426FD4F28
310
5917376C7DF7890510343FF218085E2E59E4F2082AD72537F103504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB5D38BAD72010000D40300000C0000006662782F636F72652E786D6CC553DB8E823014FC95A6AF1B68C11B9A52A3AB7EC1FE4085CA36424B4A4BFCFC3D5C8CEBC635EED3F200CDCC393D3353CAD697AA44AD
310
B48D323AC5514831923A33B9D2458ABD3B0509466BCEAC31EE5B19465A5432C51D8C392BACF1F50865463BA91DA0DAE4720445D348875156C222C54DF6292B110AEFA0A23987B5C8CEA2906114020D759C35CE8200340CE9DE989F8E1746069C33EF553EB22A8769EAA4A4C57C1147F3457CD806B31D4D82E936D907DBC5FB
310
2E38C4F3E564BE8936749F30D23573E65475559759299CCC318F295D065114D0F8239AAEE86C15CFDE68B2A29491AEFCAEC9D7F98B4D5E69378947B9435B837904427AE2875B88C8A146B4A0877046BA10E1D3277C1F340402213B712CAF3ECE00B53273C64E81C98DBF51AD28BD84A934A4FD837E5F303274C2D47E7370FD
310
7046FCF28CE73BC2510B5D8009E16079F4AED3C9060D6368B5B441EB2E481B5B89F2351B4F1CFE89BA897F282933A5B1FFA5888C0744C6DF8374F7917F01504B0304140006080800AC70623B09885E1C7E0000009D0000000B0000006662782F636E782E786D6C4DCCDF0A83201C86E15B91DFB9CBA6FD11D41063F711CB42
310
663A9C8E5DFE6A74B0A30F1E3E5E317C368FDE36BD5C0C12EA0B0164C33DCE2EAC124A5E700F685022C598FF6E80C2B459090783126B8AE579D26C97A9F8BCAB77E17122E586D5843498B3EE8699D114F39E5E713D76EDA84DCBB569A052A2FA95F63DC2EA0B504B0304140006080800AC70623B961D28872A010000120200
310
00310000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C8D515B6EC32010BC8AC557AA0A1BFC4A1C61A2C8514FD00B10435294182C1E558EDFA576A4F62F3F80666766875D76784CF7EC5B39AFADE911CD09CA9419ADD4E6DAA3182E7887B203
310
67CEDAF08786322326D5A30423CEAECEC67985466B8232015063A55A41E1BD0A281BEFF0E8911FBFD42472110330FC2D9FC578135795D31CCAC0E3CC070701B2A5493A11AFBAA1A68434B8ABB71FB81E8E15EE765589E969DB9E8E43DB1D8786158B90B318B55CE55A421C7DD1CABD6A92C49C053D3DE38F4E89A024E22521
310
1DA61493F293D67BD2ECCBE69DECF684B022D1FF89E22C5F14456D4255AE711799479CB2622970266D3CDF9F61D463B62E64A9DFC6ABF10D7192C35CCA0A040B11BE0F8E6DBD3AFA601D8C77733B0397C290926D5B7356A40DC1F5BB3EB8D336F90F504B0304140006080800AC70623B503B51794E01000033030000300000
310
006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1E
310
BC4F77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C54
310
2347DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F
310
103F504B0304140006080800AC70623B2EA4D28F640500003C100000340000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F6F626A656374732E786D6CAD575D739B3814FD2B0CFB6C30B1D3263B844E6CC71D4F376DA79E76F621331E01326103122389C4E9AFDF
310
231018B09D7A3FFC609090EEE7B94757FE875D9E59CF54C894B31BDB73C6B64559C4E394253776A9B6A32BDBFA10F88273D559665B8CE4F4C6D6D376E027829785998AE99694991ACC2E677F5A32A28CDA569411296F6C193DD29C38A4543CA6F2C98989224EB2DD399E532FEC8B4D04291E07420B222853B014F30C52ACDA
310
28AF3F1CDB6EE0BBFA7BE0EB7FB36A727A955BF9D3D79F32A9088B0E940DC44CBCE9E2EEE2F27A74399D4E46D37717DE68B69C2D46DEFBC978FE6E3EBFBEBDBB8662A90424194B04DDDAC147C446A491EFD69F5A8B8DE1C74C8A386334AAFC878795CD46624C0BCA62E431A512DA3A5E8FFB434FC7A6F379A2C7466577FA3C
310
AFBA3B3A821ADB9B67D7521EFE0517E439A810926A54D5F1318ED6F81BEFA316729E996FA9B472A2A84849666569288878B5032CD54B02BF2746A35368846B0FECC0DBCBEBDA8AD2F835768F59B92DB34C43D30E2A646F807FAA646559FA938AE3DA60137255A64C5D1987D46B41EDE0DA77ABC9C0D78FC985F95807D2DA66
310
2441CAE166FD75E0E85CD7DE6A61079F96E16EADEBF1B8F242F0820AA5E1036835896B9E3A4A46AD7756E6F40638D38BF93E28DF10F9CF28DFBD29C89B4877D3DDD468518230B9E522476E9C71F5B3C6CDCBA87D3B7C019F0D561FAE6967FED562DF6D8DED13C6A9FC015C3A3557FF3D7FFD987591DA495FE03FA3C0B89898
310
50AE2392817AEE53868468505A19C714B87C1BEEEC6005A604B36317C9823620072FBEFB8CEFF8AF6583AD2AF59D274342077C7B06F323965559C0B6136039E0C94AB171EE54CC2FFF979AB95DAC3FAD4BB12511BD37C4B2A0DB94A50A67E71EBC5D837A89E879F4445F5FB888E1E86112D6DD24E4469544B475CC75E093E6
310
B0D083BDE69E8208FB12AE39CFFF8586FB544634CB08A3BC6CB4B4C790C66A4B32A64F4015D6019D5C0C502CE873AA3B89DE8A9E5938EB2391163A64EDA1D7F2B473C297EFABCF00A51DCC5EFF20AF5DC20CF7741FF18C8B4DF8BAA999D006F8B0A78FEE1F7D789B88BA5A0A105F61B9A11C13E24D9C6EB7A504EF1E89E28F
310
D5BC9BA996480E5F9A026A34D63539053BA3F68830F06D74A2211004073B679B14C738CAF2A8F2AEEEA10259C93D213F2CF36243725E32754E98C68D3F8DF5ADF06E17235F888A1EED605D3D473350764CE31309D547D0119F7AE979FFFEEA6E727BBD1C79B74BB4529717CBD1D5E5DC1B79B3B977395B4C96EF2638E6FA15
310
D09C50DD1A44347122FAA5484D98BFAFF6656B07F74449F7635D506E523FBFAF1CB4C5BE8B3D0078BB71951719CD295344C3F75EBF64DF08BA8A9E8C7A7E9593849E21E5CBC7F5C006CC9CB1EFAB2E35FA32D86B66E7BA168E0A518F651E329266838DC671A7608971BB0965FBAC19BD19EA918927FA50C9B33406E1C45642
310
794E1568E70CB6173995404CB72B8FCDEDE18CDDCF753FA84898D1C6924782963893403548A78C547FDEFA0D2D9CEEA26E6C1C76CE13FE4C21DA16527D6383DF541A51E984381E75E353090704D085B52408D0139664E8ACEB4DEDB8DDA56303FAC10968F4B74BCEE9968C5F3DE2CD4951E0D4EED16A659B5110FD23C71B73
310
2CA2F01A96AAF5653FD13A53A909C03570A77DA0857832AA77A8AFB7DDF29C6A4D2F2267DD93DE04412D75A48848AA7B810EBA31E976F1D5452B60ADBE58455626C8E5F992468202CCA52E70A008A830320BA200D5F9EF0F5F05C75D34B7962920F030E779CE9919DC9ABBACB57EC4CD347E002D507DFD901763CF7BA8BA7E
310
7311D984445287C4F209134DC1690F065803200F8E53733D73750E06CB570BCB1C185308AD407BD094D6D7700BC5A36F8EBA54BA6459BCD9F8BBD552A040A0650FFE06504B0304140006080000AC70623B000000000000000000000000350000006662782F33394334313030352D393437462D344341332D393833322D3144
310
373644414336394143352F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B
310
000000000000000000000000370000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F33394334313030352D393437462D344341332D393833
310
322D3144373644414336394143352F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607
310
FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623B95BFD5E5FE000000A00100003B0000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265736F75726365732F63
310
6F72652E786D6C8D50596E833010BD0A9ADFCA603B1B41C611699213F40296992456828DBC543D7E4DA052FBD79F99D15B344F4F1CBE8667F1893E18675B60258502AD76BDB1B71652BC921A8A8314DEB9F84B06855503B630C120C5CDBB342E907636A28D19B5AEC70554216084423FF3D142D0771C54A952CC8AF02847A5
310
1FEA86252B339D755284E87380627E324D901E834B5E6310D5CC4A9192E9178DE9F34F7335E841EE38DBEEF8A5239B13ADC9FA589FC971F77E2217BEDDAFB61DEBE8B916D56496229AE127A3F6A822F62039A57BC218A1FC83AD1BBA69F8E68DD60DA5A29AE47F4C69ECFF694AC6C6155FE2CEB60092E5202F428A6AEA2BAF
310
5799794FDDCA6F504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B
310
436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BFD5588D4EC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D6C504B
310
01021400140006080800AC70623BB5D38BAD72010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623B09885E1C7E0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B01021400140006080800AC70
310
623B961D28872A0100001202000031000000000000000000000000005C0500006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D5060000
310
6662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6C504B01021400140006080800AC70623B2EA4D28F640500003C1000003400000000000000000000000000710800006662782F33394334313030352D393437462D344341332D393833322D3144373644
310
414336394143352F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000270E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F76657274696365732E62696E504B01021400140006
310
080800AC70623BF270F133060000000400000036000000000000000000000000007A0E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000000000
310
000000000000D40E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000290F00006662782F33394334313030352D393437
310
462D344341332D393833322D3144373644414336394143352F6469726563746F72792E786D6C504B01021400140006080800AC70623B95BFD5E5FE000000A00100003B000000000000000000000000000D1000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265
310
736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000641100000000
  0
XRECORD
  5
2CA
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
102
MATERIAL
148
0.0
149
0.0
149
0.0
 93
        0
 94
       63
282
     0
 72
     1
 77
     1
171
     1
175
     1
179
     1
273
     0
  0
XRECORD
  5
10D
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10C
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
187
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
 70
     0
 90
1778669749
  1
7E355024-1ABF-47F9-966E-F2159FBE82AB
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BDCE527C8EB0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103B15DC7C24471249FA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EFA9EEFE8CBACC17AD7032D0820E394D7D64D3DA478C52DA093E0ABF7F1970D9093B3E961
310
9341F069F569D925E55D342E66D5796D76518660222075CF4D0F417D9A591632C5EC08B76291EA262753D05797E194AC46CF2356E77DF66ACD0A621C9B73335C463C5E0E1457EC9DE2A1612D3E9233A92BD2D66333F07283058F767EDD57AB91D168108C9023A61413F641AB8ED41DABDF48DB11C2CBCDFE074A8BFE2794AC
310
8B07B6BFFBC402089A1F790C042FB72C72790495EB969BF801504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF32603847
310
2BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB24894EB71010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C085012194749244ED00B38E05014B091B1518EDFE511A5A9D228FD2A1F60CDEC7A67C6986D2F6D830669
310
FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7266B4B6DFCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B4FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2609EE7C92ED91F722F3FAC022F0ADF036F9F84A9
310
B7A63B1A47348DF364CFC8D8CC99ADDBABBAC2486165897948E9DA0B028F861F41B4A1F1268CDF68BAA19491B1FCAEC975E58B4DAE5676152E72E7B61EF300844CC40FB7109145BD18400FE18C8C21C2674AF83E68080442B6E2D85C7D9C011A6461B5898029B5BB5183689C84A9D4A7D3837E5F303277C2D4697370FD7046
310
F8F28CE73BC2510B5581096161797476D4C9660D4B689D34DE602F4869D38AE6351B4F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F01504B0304140006080800AC70623B3A54DFB77D0000009D0000000B0000006662782F636E782E786D6C4DCCD10A83201805E05791FFDEA5EBA76DA046A37C8F581632D3
310
613AF6F8B3D1C52E0E073E0E47B49FD591B7899B0D5E023F3120C63FC264FD2221A7995E81B44AC410D2DF0C881F5723616750628921BF0E9ACC3C66978A3AEB9F07B2A6D77AB87514F95953EC39D20EEF9C6AD60C88BC2EB940A544F57B2ABD1FAB2F504B0304140006080800AC70623B4A17098729010000120200003100
310
00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C8D515B6EC32010BC0AE22B55850D0E76930813A54A7C825E80DA244589C1E251E5F85D6A476AFFF2018B7667666759B1BF8F37F4AD7D30CEB6981514236D7B37187B69718A67B2C1682F8577
310
2EFE816164D5A85B9CD3588A8B77695A52BDB351DB0859EB06BD2455083A62D4DFE0D1E2D07FE951152A4540846B31A9FEAA2EBA600594012745881E0CA0B949BEB1A4CDB1EB4EDB03E1ACEA083F324E0EFC9D918E3627CED91ACE9B2867A214299961A19B01EC98B3D1FE59914C96229AF161BFF75A453D605951BA258C11
310
5A7D30BEA3F5AEAA5FE96647A92833FC1F294DC393A4646C5C578BDD9916B064A29C0B520C2E7DDE1E66F47D723EA2DC6F1574FF02531594D6AC69443903617C506CF8A218A2F3F0BDABEB2760593DCB365C8A326F08C2EFFA20E66DCA1F504B0304140006080800AC70623B503B51794E0100003303000030000000666278
310
2F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F7736
310
4A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347DEE0
310
50F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F504B
310
0304140006080800AC70623BD8F6D0D5660500003B100000340000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F6F626A656374732E786D6CAD575B8F9B3814FE2B887D064292B964C5504D92491555D3568D5AEDC348910187610730B2CD4C667FFD7E06438024
310
6DF6928780CDF1B97EE762EFC33E4B8D57CA45C2F23BD3B547A641F39045491EDF99A5DC59B7A6F1C1F73863B243661A39C9E89DA9B64DDF8B392B0BBD15D11D295339D85DCDFF304448736A1A614A84B83345F84C33629352B2888A173B2292D8F16E6FBB764DD8671B73523C0F981684D35C4253ECE7E062D44AB9FDE5C8
310
747CCF51DF7D4FFD6BAAC9792AA7B2A72F3FC985247978246CC066E24E970FE3AB9975359D4EACE9F5D8B5E6ABF9D2726F26A3C5F56231BB7F9841B0901C9CB4269CEE4CFF237CC393D073EA4FADC65AF1532A852CCF6958D90F0B2B9D35C78816348F10C7840A48EB583DEA2F5DE59BCEE7895A6B91DDEDCBACEA9EE8306A
310
746F9E5D4D59F0274C1097A0820BAA5055FB471B5AE36F74F05AC058AABF25C2C888A43C21A991260127FCDDF441AA487CAFC746A1932B842B0B4CDF3DF0EBEA8AD4F835764F69B92BD35441D3F42B646F817F2A45A559F217E5A7A54127C4AA4C7279AB0D92EF0535FD99E7549BBEA71E93B1FE583BD2D8A52446C86166FD
310
7560E842E5DE7A69FA9F56C17EA3F2F1B4F082B38272A9E0036835816B9ECA4B5AAC7B51E4D40118D3F3F9C129DFE0F9CF48DF832A881B4FF6D3FD544B919CE462C77886D8D8A3EA678C9A17AB7D3B7E413D1B501FD3B43BFF8AD8735A65FB05E35CFC002E159ADBFF1EBFBECFBA48ED84CFF75E91608C4FB42B372149517A
310
1E931C0151A03452862DD4F25DB037FD352A252A3B4E91D46F1D72F4E239AFF88EFF9A37AA5525BEF3CC11D041BDBDA0F2C397555A40B7336039AA9395606DDC399F5FFD2F3973BFDC7CDA947C4742FAA80BCB92EE923C91E89D07F07615EA05A267D10B7D7F633C82A1C741D8748390695102DE563E578E8F9B66A11607C9
310
3D0121CEC54CD53CEF17121E1311D2342539656523A56D430AAB6D91D17302B2B076E8643C4031A7AF899A247A143DB5D0EB439E14CA656DD36BEBB47DC696EFEBCF0025E8531690F440141CAA7DC852C6B7C1FBB62E8426B087237D70FFE8A35B3BD4515C00F80ACA4DC5D11EDE46C96E570A94DD134EFCB15E7403D5D691
310
E397267F1A89754A4E519C917A846BF43632310F7082BECEF26D822E8EAC3C29BC2B7B2840547CCFF00FCAACD8928C95B9BCC44DA3C69E46FB96797788116F4486CFA6BFA99ED61C153BA2D121543D10A80E74C2A65E786E1E265757A3F1D472EFE72B6B7AB39A59B3EBEB076B3576AF66ABF9C3EDF87EDE6A5469E27B4D83
310
EAA620BC8986E8953CD16EFEBE3E64ADE93F12299C8F753E3971FDFCBEB631157B0ECE00DFEDC17556A434A3B9240ABD8FEA25FD463054F478D4FBEB8CC4F4022E5F3E6E063A60E782735F55A6D1B7C159BDBB50B97092897C2EB32027493A38A80DB78B3CD66637AE6C9F75416F966AA5FD893154B03489506F2223A62CA3
310
1255E78262CF332A8098EE501EE9CBC305A75FEB71509220A58D26CF0413712A806AC0AD0C657FDFF80D139C1AA2EE4CF43AFB057F3A114D03A1BE3351DE6412526107E88E6AEEA998030218C2DA1A08A8913C4E3158D787DA757B4AF906E5070D50CB6F492E1996B45DBDBA9B91A240D3EE55D54A372D20FC478637EA1844
310
E23528656BCB61A335A61283CCAA8DD257034C102F5AF41EF9F573B35CBBA2E979E4A26BD24F415073B524E171752D50FA6995EE975F1D4C02C6FA8B51A4658C585ECEC9E214602E558203454085E6591009A82E7E7FFACA19AEA299B14A0081A705CB3296EBC5BDBECA1A9B675C4CA3279405AA6E1F623C72DDA76AE8D7F7
310
906D4004B549245EB0D1249CB260803500F2A89BEA10382A0603F2F5D2D00D630AA615688F66D2FA166E2079D4C551A54AB758163F9DFB9D8A1460E098D8FDBF01504B0304140006080000AC70623B000000000000000000000000350000006662782F30364446464539412D343132462D344431342D413442312D46303645
310
34343133343431372F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B0000
310
00000000000000000000370000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30364446464539412D343132462D344431342D413442312D
310
4630364534343133343431372F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607FB14
310
4396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BB40F7AF9FE000000A00100003B0000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F75726365732F636F72
310
652E786D6C8D504B6E833010BD0A9A6D65B00950828CA3109513F4029699502BC146FE543D7E4D42A576D7CDCCE87D344F8F9FBE967BF689CE6B6B7A6039850C8DB29336730F315C490BD94970676DF82583CCC8057BD860107C7636AE3BA4AC096842428D9D7007A5F7182053F774F4E0D5072E3297312485BFE5AB543739
310
63CEF244279DE03EB814207B3ED9260887DE46A7D0F3E2C90A1EA39E768D9ED24F7DD5E8408C63736E86CB1B192F0746AAF29591A1295B72A4675A57B4ADC766E0C566163CE8E527A37228034E204A4A8F843142CB775675B4EECAFA85B61DA5BCD8E47F4C719DFE698ADA8443B9C77DDA3C0896823C08C18BADAFB41E65A6
310
BD752BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B436F
310
6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BDCE527C8EB0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000094020000636E782E786D6C504B0102
310
1400140006080800AC70623BB24894EB71010000D40300000C00000000000000000000000000180300006662782F636F72652E786D6C504B01021400140006080800AC70623B3A54DFB77D0000009D0000000B00000000000000000000000000B30400006662782F636E782E786D6C504B01021400140006080800AC70623B
310
4A17098729010000120200003100000000000000000000000000590500006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D10600006662
310
782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6C504B01021400140006080800AC70623BD8F6D0D5660500003B10000034000000000000000000000000006D0800006662782F30364446464539412D343132462D344431342D413442312D46303645343431
310
33343431372F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000250E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F76657274696365732E62696E504B010214001400060808
310
00AC70623BF270F13306000000040000003600000000000000000000000000780E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E504B01021400140006080000AC70623B00000000000000000000000037000000000000000000
310
00000000D20E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000270F00006662782F30364446464539412D343132462D
310
344431342D413442312D4630364534343133343431372F6469726563746F72792E786D6C504B01021400140006080800AC70623BB40F7AF9FE000000A00100003B000000000000000000000000000B1000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F
310
75726365732F636F72652E786D6C504B0506000000000E000E0080040000621100000000
  0
XRECORD
  5
10E
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10F
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
2FD
102
{ACAD_REACTORS
330
2FC
102
}
330
2FC
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
CELLSTYLEMAP
  5
2BE
102
{ACAD_REACTORS
330
FF
102
}
330
FF
100
AcDbCellStyleMap
 90
        3
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
    32768
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.25
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        1
 91
        1
300
_TITLE
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        2
 91
        1
300
_HEADER
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        2
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        3
 91
        2
300
_DATA
309
CELLSTYLE_END
  0
XRECORD
  5
2EB
102
{ACAD_REACTORS
330
FF
102
}
330
FF
100
AcDbXrecord
280
     1
102
ACAD_ROUNDTRIP_PRE2007_TABLESTYLE
 90
      512
 91
        0
  1

 92
      512
 93
        0
  2

 94
      512
 95
        0
  3

  0
XRECORD
  5
2D6
102
{ACAD_REACTORS
330
2D5
102
}
330
2D5
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     1
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     0
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2D4
102
{ACAD_REACTORS
330
2D3
102
}
330
2D3
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2E2
102
{ACAD_REACTORS
330
2E1
102
}
330
2E1
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2EA
102
{ACAD_REACTORS
330
2E9
102
}
330
2E9
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2DC
102
{ACAD_REACTORS
330
2DB
102
}
330
2DB
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2E0
102
{ACAD_REACTORS
330
2DF
102
}
330
2DF
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2F1
102
{ACAD_REACTORS
330
2F0
102
}
330
2F0
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     0
102
RTVSPropertyOp1
 70
     0
102
RTVSPropertyOp2
 70
     0
102
RTVSPropertyOp3
 70
     0
102
RTVSPropertyOp4
 70
     0
102
RTVSPropertyOp5
 70
     0
102
RTVSPropertyOp6
 70
     0
102
RTVSPropertyOp7
 70
     0
102
RTVSPropertyOp8
 70
     0
102
RTVSPropertyOp9
 70
     0
102
RTVSPropertyOp10
 70
     0
102
RTVSPropertyOp11
 70
     0
102
RTVSPropertyOp12
 70
     0
102
RTVSPropertyOp13
 70
     0
102
RTVSPropertyOp14
 70
     2
102
RTVSPropertyOp15
 70
     0
102
RTVSPropertyOp16
 70
     0
102
RTVSPropertyOp17
 70
     0
102
RTVSPropertyOp18
 70
     0
102
RTVSPropertyOp19
 70
     0
102
RTVSPropertyOp20
 70
     0
102
RTVSPropertyOp21
 70
     0
102
RTVSPropertyOp22
 70
     0
102
RTVSPropertyOp23
 70
     0
102
RTVSPropertyOp24
 70
     0
102
RTVSPropertyOp25
 70
     0
102
RTVSPropertyOp26
 70
     0
102
RTVSPropertyOp27
 70
     0
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2E8
102
{ACAD_REACTORS
330
2E7
102
}
330
2E7
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2CC
102
{ACAD_REACTORS
330
2CB
102
}
330
2CB
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2CE
102
{ACAD_REACTORS
330
2CD
102
}
330
2CD
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2D0
102
{ACAD_REACTORS
330
2CF
102
}
330
2CF
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2D2
102
{ACAD_REACTORS
330
2D1
102
}
330
2D1
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2DA
102
{ACAD_REACTORS
330
2D9
102
}
330
2D9
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2ED
102
{ACAD_REACTORS
330
2EC
102
}
330
2EC
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     0
102
RTVSPropertyOp1
 70
     0
102
RTVSPropertyOp2
 70
     0
102
RTVSPropertyOp3
 70
     0
102
RTVSPropertyOp4
 70
     0
102
RTVSPropertyOp5
 70
     0
102
RTVSPropertyOp6
 70
     0
102
RTVSPropertyOp7
 70
     0
102
RTVSPropertyOp8
 70
     0
102
RTVSPropertyOp9
 70
     0
102
RTVSPropertyOp10
 70
     0
102
RTVSPropertyOp11
 70
     0
102
RTVSPropertyOp12
 70
     0
102
RTVSPropertyOp13
 70
     0
102
RTVSPropertyOp14
 70
     2
102
RTVSPropertyOp15
 70
     0
102
RTVSPropertyOp16
 70
     0
102
RTVSPropertyOp17
 70
     0
102
RTVSPropertyOp18
 70
     0
102
RTVSPropertyOp19
 70
     0
102
RTVSPropertyOp20
 70
     0
102
RTVSPropertyOp21
 70
     0
102
RTVSPropertyOp22
 70
     0
102
RTVSPropertyOp23
 70
     0
102
RTVSPropertyOp24
 70
     0
102
RTVSPropertyOp25
 70
     0
102
RTVSPropertyOp26
 70
     0
102
RTVSPropertyOp27
 70
     0
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2E6
102
{ACAD_REACTORS
330
2E5
102
}
330
2E5
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2EF
102
{ACAD_REACTORS
330
2EE
102
}
330
2EE
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     0
102
RTVSPropertyOp1
 70
     0
102
RTVSPropertyOp2
 70
     0
102
RTVSPropertyOp3
 70
     0
102
RTVSPropertyOp4
 70
     0
102
RTVSPropertyOp5
 70
     0
102
RTVSPropertyOp6
 70
     0
102
RTVSPropertyOp7
 70
     0
102
RTVSPropertyOp8
 70
     0
102
RTVSPropertyOp9
 70
     0
102
RTVSPropertyOp10
 70
     0
102
RTVSPropertyOp11
 70
     0
102
RTVSPropertyOp12
 70
     0
102
RTVSPropertyOp13
 70
     0
102
RTVSPropertyOp14
 70
     2
102
RTVSPropertyOp15
 70
     0
102
RTVSPropertyOp16
 70
     0
102
RTVSPropertyOp17
 70
     0
102
RTVSPropertyOp18
 70
     0
102
RTVSPropertyOp19
 70
     0
102
RTVSPropertyOp20
 70
     0
102
RTVSPropertyOp21
 70
     0
102
RTVSPropertyOp22
 70
     0
102
RTVSPropertyOp23
 70
     0
102
RTVSPropertyOp24
 70
     0
102
RTVSPropertyOp25
 70
     0
102
RTVSPropertyOp26
 70
     0
102
RTVSPropertyOp27
 70
     0
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2DE
102
{ACAD_REACTORS
330
2DD
102
}
330
2DD
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2FB
102
{ACAD_REACTORS
330
2FA
102
}
330
2FA
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2F9
102
{ACAD_REACTORS
330
2F8
102
}
330
2F8
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2F3
102
{ACAD_REACTORS
330
2F2
102
}
330
2F2
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2F5
102
{ACAD_REACTORS
330
2F4
102
}
330
2F4
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2E4
102
{ACAD_REACTORS
330
2E3
102
}
330
2E3
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2D8
102
{ACAD_REACTORS
330
2D7
102
}
330
2D7
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2F7
102
{ACAD_REACTORS
330
2F6
102
}
330
2F6
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
ENDSEC
  0
EOF
`;var e_e=`  0
SECTION
  2
HEADER
  9
$ACADVER
  1
AC1021
  9
$ACADMAINTVER
 70
    50
  9
$DWGCODEPAGE
  3
ANSI_936
  9
$LASTSAVEDBY
  1
win10
  9
$INSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$EXTMIN
 10
1.000000000000000E+20
 20
1.000000000000000E+20
 30
1.000000000000000E+20
  9
$EXTMAX
 10
-1.000000000000000E+20
 20
-1.000000000000000E+20
 30
-1.000000000000000E+20
  9
$LIMMIN
 10
0.0
 20
0.0
  9
$LIMMAX
 10
12.0
 20
9.0
  9
$ORTHOMODE
 70
     0
  9
$REGENMODE
 70
     1
  9
$FILLMODE
 70
     1
  9
$QTEXTMODE
 70
     0
  9
$MIRRTEXT
 70
     0
  9
$LTSCALE
 40
1.0
  9
$ATTMODE
 70
     1
  9
$TEXTSIZE
 40
0.2
  9
$TRACEWID
 40
0.05
  9
$TEXTSTYLE
  7
Standard
  9
$CLAYER
  8
0
  9
$CELTYPE
  6
ByLayer
  9
$CECOLOR
 62
   256
  9
$CELTSCALE
 40
1.0
  9
$DISPSILH
 70
     0
  9
$DIMSCALE
 40
1.0
  9
$DIMASZ
 40
0.18
  9
$DIMEXO
 40
0.0625
  9
$DIMDLI
 40
0.38
  9
$DIMRND
 40
0.0
  9
$DIMDLE
 40
0.0
  9
$DIMEXE
 40
0.18
  9
$DIMTP
 40
0.0
  9
$DIMTM
 40
0.0
  9
$DIMTXT
 40
0.18
  9
$DIMCEN
 40
0.09
  9
$DIMTSZ
 40
0.0
  9
$DIMTOL
 70
     0
  9
$DIMLIM
 70
     0
  9
$DIMTIH
 70
     1
  9
$DIMTOH
 70
     1
  9
$DIMSE1
 70
     0
  9
$DIMSE2
 70
     0
  9
$DIMTAD
 70
     0
  9
$DIMZIN
 70
     0
  9
$DIMBLK
  1

  9
$DIMASO
 70
     1
  9
$DIMSHO
 70
     1
  9
$DIMPOST
  1

  9
$DIMAPOST
  1

  9
$DIMALT
 70
     0
  9
$DIMALTD
 70
     2
  9
$DIMALTF
 40
25.4
  9
$DIMLFAC
 40
1.0
  9
$DIMTOFL
 70
     0
  9
$DIMTVP
 40
0.0
  9
$DIMTIX
 70
     0
  9
$DIMSOXD
 70
     0
  9
$DIMSAH
 70
     0
  9
$DIMBLK1
  1

  9
$DIMBLK2
  1

  9
$DIMSTYLE
  2
Standard
  9
$DIMCLRD
 70
     0
  9
$DIMCLRE
 70
     0
  9
$DIMCLRT
 70
     0
  9
$DIMTFAC
 40
1.0
  9
$DIMGAP
 40
0.09
  9
$DIMJUST
 70
     0
  9
$DIMSD1
 70
     0
  9
$DIMSD2
 70
     0
  9
$DIMTOLJ
 70
     1
  9
$DIMTZIN
 70
     0
  9
$DIMALTZ
 70
     0
  9
$DIMALTTZ
 70
     0
  9
$DIMUPT
 70
     0
  9
$DIMDEC
 70
     4
  9
$DIMTDEC
 70
     4
  9
$DIMALTU
 70
     2
  9
$DIMALTTD
 70
     2
  9
$DIMTXSTY
  7
Standard
  9
$DIMAUNIT
 70
     0
  9
$DIMADEC
 70
     0
  9
$DIMALTRND
 40
0.0
  9
$DIMAZIN
 70
     0
  9
$DIMDSEP
 70
    46
  9
$DIMATFIT
 70
     3
  9
$DIMFRAC
 70
     0
  9
$DIMLDRBLK
  1

  9
$DIMLUNIT
 70
     2
  9
$DIMLWD
 70
    -2
  9
$DIMLWE
 70
    -2
  9
$DIMTMOVE
 70
     0
  9
$DIMFXL
 40
1.0
  9
$DIMFXLON
 70
     0
  9
$DIMJOGANG
 40
0.7853981633974483
  9
$DIMTFILL
 70
     0
  9
$DIMTFILLCLR
 70
     0
  9
$DIMARCSYM
 70
     0
  9
$DIMLTYPE
  6

  9
$DIMLTEX1
  6

  9
$DIMLTEX2
  6

  9
$LUNITS
 70
     2
  9
$LUPREC
 70
     4
  9
$SKETCHINC
 40
0.1
  9
$FILLETRAD
 40
0.0
  9
$AUNITS
 70
     0
  9
$AUPREC
 70
     0
  9
$MENU
  1
.
  9
$ELEVATION
 40
0.0
  9
$PELEVATION
 40
0.0
  9
$THICKNESS
 40
0.0
  9
$LIMCHECK
 70
     0
  9
$CHAMFERA
 40
0.0
  9
$CHAMFERB
 40
0.0
  9
$CHAMFERC
 40
0.0
  9
$CHAMFERD
 40
0.0
  9
$SKPOLY
 70
     0
  9
$TDCREATE
 40
2460560.605914352
  9
$TDUCREATE
 40
2460560.272581019
  9
$TDUPDATE
 40
2460560.629363426
  9
$TDUUPDATE
 40
2460560.296030092
  9
$TDINDWG
 40
0.0234490741
  9
$TDUSRTIMER
 40
0.0234490741
  9
$USRTIMER
 70
     1
  9
$ANGBASE
 50
0.0
  9
$ANGDIR
 70
     0
  9
$PDMODE
 70
     0
  9
$PDSIZE
 40
0.0
  9
$PLINEWID
 40
0.0
  9
$SPLFRAME
 70
     0
  9
$SPLINETYPE
 70
     6
  9
$SPLINESEGS
 70
     8
  9
$HANDSEED
  5
33E
  9
$SURFTAB1
 70
     6
  9
$SURFTAB2
 70
     6
  9
$SURFTYPE
 70
     6
  9
$SURFU
 70
     6
  9
$SURFV
 70
     6
  9
$UCSBASE
  2

  9
$UCSNAME
  2

  9
$UCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$UCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$UCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$UCSORTHOREF
  2

  9
$UCSORTHOVIEW
 70
     0
  9
$UCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSBASE
  2

  9
$PUCSNAME
  2

  9
$PUCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$PUCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$PUCSORTHOREF
  2

  9
$PUCSORTHOVIEW
 70
     0
  9
$PUCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$USERI1
 70
     0
  9
$USERI2
 70
     0
  9
$USERI3
 70
     0
  9
$USERI4
 70
     0
  9
$USERI5
 70
     0
  9
$USERR1
 40
0.0
  9
$USERR2
 40
0.0
  9
$USERR3
 40
0.0
  9
$USERR4
 40
0.0
  9
$USERR5
 40
0.0
  9
$WORLDVIEW
 70
     1
  9
$SHADEDGE
 70
     3
  9
$SHADEDIF
 70
    70
  9
$TILEMODE
 70
     1
  9
$MAXACTVP
 70
    64
  9
$PINSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMCHECK
 70
     0
  9
$PEXTMIN
 10
0.0
 20
0.0
 30
0.0
  9
$PEXTMAX
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMMIN
 10
0.0
 20
0.0
  9
$PLIMMAX
 10
12.0
 20
9.0
  9
$UNITMODE
 70
     0
  9
$VISRETAIN
 70
     1
  9
$PLINEGEN
 70
     0
  9
$PSLTSCALE
 70
     1
  9
$TREEDEPTH
 70
  3020
  9
$CMLSTYLE
  2
Standard
  9
$CMLJUST
 70
     0
  9
$CMLSCALE
 40
1.0
  9
$PROXYGRAPHICS
 70
     1
  9
$MEASUREMENT
 70
     0
  9
$CELWEIGHT
370
    -1
  9
$ENDCAPS
280
     0
  9
$JOINSTYLE
280
     0
  9
$LWDISPLAY
290
     0
  9
$INSUNITS
 70
     4
  9
$HYPERLINKBASE
  1

  9
$STYLESHEET
  1

  9
$XEDIT
290
     1
  9
$CEPSNTYPE
380
     0
  9
$PSTYLEMODE
290
     0
  9
$FINGERPRINTGUID
  2
{FA9A02B2-7E04-C34E-BD13-02980AC2B394}
  9
$VERSIONGUID
  2
{964EB223-33A2-D549-8684-CDE005EE773C}
  9
$EXTNAMES
290
     1
  9
$PSVPSCALE
 40
0.0
  9
$OLESTARTUP
290
     0
  9
$SORTENTS
280
   127
  9
$INDEXCTL
280
     0
  9
$HIDETEXT
280
     1
  9
$XCLIPFRAME
290
     0
  9
$HALOGAP
280
     0
  9
$OBSCOLOR
 70
   257
  9
$OBSLTYPE
280
     0
  9
$INTERSECTIONDISPLAY
280
     0
  9
$INTERSECTIONCOLOR
 70
   257
  9
$DIMASSOC
280
     2
  9
$PROJECTNAME
  1

  9
$CAMERADISPLAY
290
     0
  9
$LENSLENGTH
 40
50.0
  9
$CAMERAHEIGHT
 40
60.0
  9
$STEPSPERSEC
 40
2.0
  9
$STEPSIZE
 40
6.0
  9
$3DDWFPREC
 40
2.0
  9
$PSOLWIDTH
 40
0.25
  9
$PSOLHEIGHT
 40
4.0
  9
$LOFTANG1
 40
1.570796326794896
  9
$LOFTANG2
 40
1.570796326794896
  9
$LOFTMAG1
 40
0.0
  9
$LOFTMAG2
 40
0.0
  9
$LOFTPARAM
 70
     7
  9
$LOFTNORMALS
280
     1
  9
$LATITUDE
 40
37.795
  9
$LONGITUDE
 40
-122.394
  9
$NORTHDIRECTION
 40
0.0
  9
$TIMEZONE
 70
 -8000
  9
$LIGHTGLYPHDISPLAY
280
     1
  9
$TILEMODELIGHTSYNCH
280
     1
  9
$CMATERIAL
347
92
  9
$SOLIDHIST
280
     0
  9
$SHOWHIST
280
     1
  9
$DWFFRAME
280
     2
  9
$DGNFRAME
280
     0
  9
$REALWORLDSCALE
290
     1
  9
$INTERFERECOLOR
 62
     1
  9
$INTERFEREOBJVS
345
9F
  9
$INTERFEREVPVS
346
9C
  9
$CSHADOW
280
     0
  9
$SHADOWPLANELOCATION
 40
0.0
  0
ENDSEC
  0
SECTION
  2
CLASSES
  0
CLASS
  1
ACDBDICTIONARYWDFLT
  2
AcDbDictionaryWithDefault
  3
ObjectDBX Classes
 90
        0
 91
        1
280
     0
281
     0
  0
CLASS
  1
DICTIONARYVAR
  2
AcDbDictionaryVar
  3
ObjectDBX Classes
 90
        0
 91
       15
280
     0
281
     0
  0
CLASS
  1
MATERIAL
  2
AcDbMaterial
  3
ObjectDBX Classes
 90
     1153
 91
        3
280
     0
281
     0
  0
CLASS
  1
VISUALSTYLE
  2
AcDbVisualStyle
  3
ObjectDBX Classes
 90
     4095
 91
       24
280
     0
281
     0
  0
CLASS
  1
TABLESTYLE
  2
AcDbTableStyle
  3
ObjectDBX Classes
 90
     4095
 91
        1
280
     0
281
     0
  0
CLASS
  1
SCALE
  2
AcDbScale
  3
ObjectDBX Classes
 90
     1153
 91
       33
280
     0
281
     0
  0
CLASS
  1
MLEADERSTYLE
  2
AcDbMLeaderStyle
  3
ACDB_MLEADERSTYLE_CLASS
 90
     4095
 91
        2
280
     0
281
     0
  0
CLASS
  1
CELLSTYLEMAP
  2
AcDbCellStyleMap
  3
ObjectDBX Classes
 90
     1152
 91
        4
280
     0
281
     0
  0
CLASS
  1
EXACXREFPANELOBJECT
  2
ExAcXREFPanelObject
  3
EXAC_ESW
 90
     1025
 91
        0
280
     0
281
     0
  0
CLASS
  1
NPOCOLLECTION
  2
AcDbImpNonPersistentObjectsCollection
  3
ObjectDBX Classes
 90
     1153
 91
        0
280
     0
281
     0
  0
CLASS
  1
LAYER_INDEX
  2
AcDbLayerIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
SPATIAL_INDEX
  2
AcDbSpatialIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
IDBUFFER
  2
AcDbIdBuffer
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
ACDBSECTIONVIEWSTYLE
  2
AcDbSectionViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
CLASS
  1
ACDBDETAILVIEWSTYLE
  2
AcDbDetailViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
ENDSEC
  0
SECTION
  2
TABLES
  0
TABLE
  2
VPORT
  5
8
330
0
100
AcDbSymbolTable
 70
     1
  0
VPORT
  5
90
330
8
100
AcDbSymbolTableRecord
100
AcDbViewportTableRecord
  2
*Active
 70
     0
 10
0.0
 20
0.0
 11
1.0
 21
1.0
 12
97.5486911906951
 22
42.51345460271504
 13
0.0
 23
0.0
 14
0.5
 24
0.5
 15
0.5
 25
0.5
 16
0.0
 26
0.0
 36
1.0
 17
0.0
 27
0.0
 37
0.0
 40
78.45799938217576
 41
1.945409429280396
 42
50.0
 43
0.0
 44
0.0
 50
0.0
 51
0.0
 71
     0
 72
  1000
 73
     1
 74
     3
 75
     0
 76
     1
 77
     0
 78
     0
281
     0
 65
     1
110
0.0
120
0.0
130
0.0
111
1.0
121
0.0
131
0.0
112
0.0
122
1.0
132
0.0
 79
     0
146
0.0
348
9B
 60
     3
 61
     5
292
     1
282
     1
141
0.0
142
0.0
 63
   250
421
  3355443
1001
ACAD_NAV_VCDISPLAY
1070
     3
  0
ENDTAB
  0
TABLE
  2
LTYPE
  5
5
330
0
100
AcDbSymbolTable
 70
     1
  0
LTYPE
  5
14
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByBlock
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
15
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByLayer
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
16
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
Continuous
 70
     0
  3
Solid line
 72
    65
 73
     0
 40
0.0
  0
ENDTAB
  0
TABLE
  2
LAYER
  5
2
102
{ACAD_XDICTIONARY
360
18B
102
}
330
0
100
AcDbSymbolTable
 70
     1
  0
LAYER
  5
10
102
{ACAD_XDICTIONARY
360
E1
102
}
330
2
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
  2
0
 70
     0
 62
     7
  6
Continuous
370
    -3
390
F
347
94
  0
ENDTAB
  0
TABLE
  2
STYLE
  5
3
330
0
100
AcDbSymbolTable
 70
     2
  0
STYLE
  5
11
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Standard
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
ACAD
1000
Arial
1071
       34
  0
STYLE
  5
D7
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD
1000
Arial
1071
       34
  0
ENDTAB
  0
TABLE
  2
VIEW
  5
6
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
UCS
  5
7
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
APPID
  5
9
330
0
100
AcDbSymbolTable
 70
     7
  0
APPID
  5
12
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD
 70
     0
  0
APPID
  5
D8
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnoPO
 70
     0
  0
APPID
  5
D9
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnotative
 70
     0
  0
APPID
  5
DA
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMJAG
 70
     0
  0
APPID
  5
DB
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMTALN
 70
     0
  0
APPID
  5
102
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_MLEADERVER
 70
     0
  0
APPID
  5
1A3
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_NAV_VCDISPLAY
 70
     0
  0
ENDTAB
  0
TABLE
  2
DIMSTYLE
  5
A
330
0
100
AcDbSymbolTable
 70
     2
100
AcDbDimStyleTable
 71
     2
340
DC
340
27
  0
DIMSTYLE
105
27
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Standard
 70
     0
340
11
  0
DIMSTYLE
105
DC
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
340
11
1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD_DSTYLE_DIMJAG
1070
   388
1040
1.5
1001
ACAD_DSTYLE_DIMTALN
1070
   392
1070
     0
  0
ENDTAB
  0
TABLE
  2
BLOCK_RECORD
  5
1
330
0
100
AcDbSymbolTable
 70
     1
  0
BLOCK_RECORD
  5
1F
102
{ACAD_XDICTIONARY
360
15A
102
}
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Model_Space
340
22
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
73
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space
340
74
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
78
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space0
340
79
 70
     0
280
     1
281
     0
  0
ENDTAB
  0
ENDSEC
  0
SECTION
  2
BLOCKS
  0
BLOCK
  5
20
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockBegin
  2
*Model_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Model_Space
  1

  0
ENDBLK
  5
21
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
75
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space
  1

  0
ENDBLK
  5
76
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
7A
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space0
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space0
  1

  0
ENDBLK
  5
7B
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
ENDSEC
  0
SECTION
  2
ENTITIES
  0
ENDSEC
  0
SECTION
  2
OBJECTS
  0
DICTIONARY
  5
C
330
0
100
AcDbDictionary
281
     1
  3
ACAD_CIP_PREVIOUS_PRODUCT_INFO
350
1A2
  3
ACAD_COLOR
350
6C
  3
ACAD_DETAILVIEWSTYLE
350
1A8
  3
ACAD_GROUP
350
D
  3
ACAD_LAYOUT
350
1A
  3
ACAD_MATERIAL
350
6B
  3
ACAD_MLEADERSTYLE
350
D2
  3
ACAD_MLINESTYLE
350
17
  3
ACAD_PLOTSETTINGS
350
19
  3
ACAD_PLOTSTYLENAME
350
E
  3
ACAD_SCALELIST
350
B1
  3
ACAD_SECTIONVIEWSTYLE
350
1A5
  3
ACAD_TABLESTYLE
350
A6
  3
ACAD_VISUALSTYLE
350
95
  3
ACDB_RECOMPOSE_DATA
350
301
  3
AcDbVariableDictionary
350
59
  3
AcDsDecomposeData
350
307
  0
DICTIONARY
  5
18B
330
2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_LAYERSTATES
360
18C
  0
DICTIONARY
  5
E1
330
10
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
15A
330
1F
100
AcDbDictionary
280
     1
281
     1
  0
XRECORD
  5
1A2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
300
ACD
300
2021
300

  0
DICTIONARY
  5
6C
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A8
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A9
  0
DICTIONARY
  5
D
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Model
350
22
  3
\u5E03\u5C401
350
74
  3
\u5E03\u5C402
350
79
  0
DICTIONARY
  5
6B
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
ByBlock
350
93
  3
ByLayer
350
92
  3
Global
350
94
  0
DICTIONARY
  5
D2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Annotative
350
E0
  3
Standard
350
D3
  0
DICTIONARY
  5
17
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
18
  0
DICTIONARY
  5
19
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
ACDBDICTIONARYWDFLT
  5
E
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Normal
350
F
100
AcDbDictionaryWithDefault
340
F
  0
DICTIONARY
  5
B1
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
A0
350
B2
  3
A1
350
124
  3
A2
350
125
  3
A3
350
126
  3
A4
350
127
  3
A5
350
128
  3
A6
350
129
  3
A7
350
12A
  3
A8
350
12B
  3
A9
350
12C
  3
B0
350
12D
  3
B1
350
12E
  3
B2
350
12F
  3
B3
350
130
  3
B4
350
131
  3
B5
350
132
  3
B6
350
133
  3
B7
350
134
  3
B8
350
135
  3
B9
350
136
  3
C0
350
137
  3
C1
350
138
  3
C2
350
139
  3
C3
350
13A
  3
C4
350
13B
  3
C5
350
13C
  3
C6
350
13D
  3
C7
350
13E
  3
C8
350
13F
  3
C9
350
140
  3
D0
350
141
  3
D1
350
142
  3
D2
350
143
  0
DICTIONARY
  5
1A5
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A7
  0
DICTIONARY
  5
A6
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
A7
  0
DICTIONARY
  5
95
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
2dWireframe
350
9B
  3
Basic
350
9A
  3
Brighten
350
A1
  3
ColorChange
350
A5
  3
Conceptual
350
9E
  3
Dim
350
A0
  3
EdgeColorOff
350
172
  3
Facepattern
350
A4
  3
Flat
350
96
  3
FlatWithEdges
350
97
  3
Gouraud
350
98
  3
GouraudWithEdges
350
99
  3
Hidden
350
9D
  3
JitterOff
350
170
  3
Linepattern
350
A3
  3
OverhangOff
350
171
  3
Realistic
350
9F
  3
Shaded
350
17F
  3
Shaded with edges
350
17E
  3
Shades of Gray
350
17B
  3
Sketchy
350
17C
  3
Thicken
350
A2
  3
Wireframe
350
9C
  3
X-Ray
350
17D
  0
XRECORD
  5
301
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
 90
        1
330
A7
  0
DICTIONARY
  5
59
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
CAMERAHEIGHT
350
227
  3
CANNOSCALE
350
EB
  3
CMLEADERSTYLE
350
EA
  3
CTABLESTYLE
350
AB
  3
CVIEWDETAILSTYLE
350
1B4
  3
CVIEWSECTIONSTYLE
350
1B5
  3
DIMASSOC
350
5A
  3
HIDETEXT
350
5E
  3
INDEXCTL
350
226
  3
LAYEREVAL
350
14A
  3
LAYERNOTIFY
350
14B
  3
LIGHTINGUNITS
350
224
  3
MSLTSCALE
350
223
  3
SORTENTS
350
225
  3
XCLIPFRAME
350
228
  0
DICTIONARY
  5
307
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
AcDsRecords
350
309
  3
AcDsSchemas
350
308
1001
ACAD
1070
     2
  0
DICTIONARY
  5
18C
102
{ACAD_REACTORS
330
18B
102
}
330
18B
100
AcDbDictionary
281
     1
  0
ACDBDETAILVIEWSTYLE
  5
1A9
102
{ACAD_XDICTIONARY
360
33C
102
}
102
{ACAD_REACTORS
330
1A8
102
}
330
1A8
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbDetailViewStyle
 70
     0
 71
     0
 90
        3
 71
     1
340
11
 62
   256
 40
0.24
340
0
 62
   256
 40
0.24
300

 40
0.36
280
     3
 71
     2
340
16
 90
       25
 62
   256
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewDetailId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
340
16
 90
       25
 62
   256
340
16
 90
       25
 62
   256
280
     0
  0
LAYOUT
  5
22
102
{ACAD_XDICTIONARY
360
191
102
}
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
none_device
  4
Letter_(8.50_x_11.00_Inches)
  6

 40
6.349999904632568
 41
6.349999904632568
 42
6.350006103515625
 43
6.350006103515625
 44
215.8999938964844
 45
279.3999938964844
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
3.560208697428376
 70
 11952
 72
     0
 73
     1
 74
     0
  7

 75
     0
147
0.28088241027059
 76
     0
 77
     2
 78
   300
148
0.1311165230791651
149
0.096403374003771
100
AcDbLayout
  1
Model
 70
     1
 71
     0
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
1F
331
90
  0
LAYOUT
  5
74
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C401
 70
     1
 71
     1
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
73
  0
LAYOUT
  5
79
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C402
 70
     1
 71
     2
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
78
  0
MATERIAL
  5
93
102
{ACAD_XDICTIONARY
360
185
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByBlock
 94
       63
  0
MATERIAL
  5
92
102
{ACAD_XDICTIONARY
360
183
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByLayer
 94
       63
  0
MATERIAL
  5
94
102
{ACAD_XDICTIONARY
360
10B
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
Global
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
 94
       63
1001
ACAD
1070
    -1
1070
     3
1070
     0
1000

1071
        0
1070
     0
  0
MLEADERSTYLE
  5
E0
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     1
143
0.125
1001
ACAD_MLEADERVER
1070
     2
  0
MLEADERSTYLE
  5
D3
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     0
143
0.125
1001
ACAD_MLEADERVER
1070
     2
  0
MLINESTYLE
  5
18
102
{ACAD_REACTORS
330
17
102
}
330
17
100
AcDbMlineStyle
  2
STANDARD
 70
     0
  3

 62
   256
 51
90.0
 52
90.0
 71
     2
 49
0.5
 62
   256
  6
BYLAYER
 49
-0.5
 62
   256
  6
BYLAYER
  0
ACDBPLACEHOLDER
  5
F
102
{ACAD_REACTORS
330
E
102
}
330
E
  0
SCALE
  5
B2
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:1
140
1.0
141
1.0
290
     1
  0
SCALE
  5
124
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:2
140
1.0
141
2.0
290
     0
  0
SCALE
  5
125
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:4
140
1.0
141
4.0
290
     0
  0
SCALE
  5
126
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:5
140
1.0
141
5.0
290
     0
  0
SCALE
  5
127
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:8
140
1.0
141
8.0
290
     0
  0
SCALE
  5
128
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:10
140
1.0
141
10.0
290
     0
  0
SCALE
  5
129
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:16
140
1.0
141
16.0
290
     0
  0
SCALE
  5
12A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:20
140
1.0
141
20.0
290
     0
  0
SCALE
  5
12B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:30
140
1.0
141
30.0
290
     0
  0
SCALE
  5
12C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:40
140
1.0
141
40.0
290
     0
  0
SCALE
  5
12D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:50
140
1.0
141
50.0
290
     0
  0
SCALE
  5
12E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:100
140
1.0
141
100.0
290
     0
  0
SCALE
  5
12F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
2:1
140
2.0
141
1.0
290
     0
  0
SCALE
  5
130
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
4:1
140
4.0
141
1.0
290
     0
  0
SCALE
  5
131
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
8:1
140
8.0
141
1.0
290
     0
  0
SCALE
  5
132
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
10:1
140
10.0
141
1.0
290
     0
  0
SCALE
  5
133
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
100:1
140
100.0
141
1.0
290
     0
  0
SCALE
  5
134
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/128" = 1'-0"
140
0.0078125
141
12.0
290
     0
  0
SCALE
  5
135
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/64" = 1'-0"
140
0.015625
141
12.0
290
     0
  0
SCALE
  5
136
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/32" = 1'-0"
140
0.03125
141
12.0
290
     0
  0
SCALE
  5
137
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/16" = 1'-0"
140
0.0625
141
12.0
290
     0
  0
SCALE
  5
138
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/32" = 1'-0"
140
0.09375
141
12.0
290
     0
  0
SCALE
  5
139
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/8" = 1'-0"
140
0.125
141
12.0
290
     0
  0
SCALE
  5
13A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/16" = 1'-0"
140
0.1875
141
12.0
290
     0
  0
SCALE
  5
13B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/4" = 1'-0"
140
0.25
141
12.0
290
     0
  0
SCALE
  5
13C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/8" = 1'-0"
140
0.375
141
12.0
290
     0
  0
SCALE
  5
13D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/2" = 1'-0"
140
0.5
141
12.0
290
     0
  0
SCALE
  5
13E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/4" = 1'-0"
140
0.75
141
12.0
290
     0
  0
SCALE
  5
13F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1" = 1'-0"
140
1.0
141
12.0
290
     0
  0
SCALE
  5
140
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1-1/2" = 1'-0"
140
1.5
141
12.0
290
     0
  0
SCALE
  5
141
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3" = 1'-0"
140
3.0
141
12.0
290
     0
  0
SCALE
  5
142
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
6" = 1'-0"
140
6.0
141
12.0
290
     0
  0
SCALE
  5
143
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1'-0" = 1'-0"
140
12.0
141
12.0
290
     0
  0
ACDBSECTIONVIEWSTYLE
  5
1A7
102
{ACAD_XDICTIONARY
360
33A
102
}
102
{ACAD_REACTORS
330
1A5
102
}
330
1A5
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbSectionViewStyle
 70
     0
 71
     0
 90
       78
 71
     1
340
11
 62
   256
 40
0.24
340
0
340
0
 62
   256
 40
0.24
300
I, O, Q, S, X, Z
 40
0.48
 90
        3
 40
0.18
 90
        1
 71
     2
340
16
 90
       25
 62
   256
340
16
 90
       50
 62
   256
 40
0.24
 40
0.0
 40
0.24
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewSectionStartId>%-%<\\AcVar ViewSectionEndId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
 62
   256
 62
   257
300
ANSI31
 40
1.0
 90
        0
290
     0
290
     0
 90
        6
 40
0.0
 40
1.570796326794896
 40
0.2617993877991494
 40
1.308996938995747
 40
-0.2617993877991494
 40
1.832595714594046
  0
TABLESTYLE
  5
A7
102
{ACAD_XDICTIONARY
360
FF
102
}
102
{ACAD_REACTORS
330
A6
102
}
330
A6
100
AcDbTableStyle
  3
Standard
 70
     0
 71
     0
 40
0.06
 41
0.06
280
     0
281
     0
  7
Standard
140
0.18
170
     2
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.25
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.18
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  0
VISUALSTYLE
  5
9B
102
{ACAD_XDICTIONARY
360
314
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
2dWireframe
 70
     4
 71
     0
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9A
102
{ACAD_XDICTIONARY
360
312
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Basic
 70
     7
 71
     1
 72
     0
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A1
102
{ACAD_XDICTIONARY
360
320
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Brighten
 70
    12
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
50.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A5
102
{ACAD_XDICTIONARY
360
328
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
ColorChange
 70
    16
 71
     2
 72
     2
 73
     3
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     8
421
  8421504
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     8
424
  8421504
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9E
102
{ACAD_XDICTIONARY
360
31A
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Conceptual
 70
     9
 71
     3
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
   257
 75
     1
175
     1
 42
40.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A0
102
{ACAD_XDICTIONARY
360
31E
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Dim
 70
    11
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
-50.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
172
102
{ACAD_XDICTIONARY
360
32E
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
EdgeColorOff
 70
    22
 71
     2
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A4
102
{ACAD_XDICTIONARY
360
326
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Facepattern
 70
    15
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
96
102
{ACAD_XDICTIONARY
360
30A
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Flat
 70
     0
 71
     2
 72
     1
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
97
102
{ACAD_XDICTIONARY
360
30C
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
FlatWithEdges
 70
     1
 71
     2
 72
     1
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
98
102
{ACAD_XDICTIONARY
360
30E
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Gouraud
 70
     2
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
99
102
{ACAD_XDICTIONARY
360
310
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
GouraudWithEdges
 70
     3
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9D
102
{ACAD_XDICTIONARY
360
318
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Hidden
 70
     6
 71
     1
 72
     2
 73
     2
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
   257
 75
     2
175
     1
 42
40.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
170
102
{ACAD_XDICTIONARY
360
32A
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
JitterOff
 70
    20
 71
     2
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
       10
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A3
102
{ACAD_XDICTIONARY
360
324
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Linepattern
 70
    14
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     7
175
     7
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
171
102
{ACAD_XDICTIONARY
360
32C
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
OverhangOff
 70
    21
 71
     2
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        9
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9F
102
{ACAD_XDICTIONARY
360
31C
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Realistic
 70
     8
 71
     2
 72
     3
 73
     0
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17F
102
{ACAD_XDICTIONARY
360
338
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded
 70
    27
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     8
425
  7895160
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        5
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17E
102
{ACAD_XDICTIONARY
360
336
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded with edges
 70
    26
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        2
 64
     7
 65
   257
 75
     2
175
     1
 42
1.0
 92
        8
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        5
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17B
102
{ACAD_XDICTIONARY
360
330
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shades of Gray
 70
    23
 71
     2
 72
     2
 73
     3
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
     7
 75
     1
175
     1
 42
40.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17C
102
{ACAD_XDICTIONARY
360
332
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Sketchy
 70
    24
 71
     1
 72
     2
 73
     2
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
     7
 75
     1
175
     1
 42
40.0
 92
       11
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     6
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A2
102
{ACAD_XDICTIONARY
360
322
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Thicken
 70
    13
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
       12
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9C
102
{ACAD_XDICTIONARY
360
316
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Wireframe
 70
     5
 71
     0
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17D
102
{ACAD_XDICTIONARY
360
334
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
X-Ray
 70
    25
 71
     2
 72
     2
 73
     1
 90
        1
 40
0.5
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
DICTIONARYVAR
  5
227
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
60.000000
  0
DICTIONARYVAR
  5
EB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1:1
  0
DICTIONARYVAR
  5
EA
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
AB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
1B4
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
1B5
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
5A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
5E
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
226
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14B
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
224
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
223
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
225
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
127
  0
DICTIONARYVAR
  5
228
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARY
  5
309
102
{ACAD_REACTORS
330
307
102
}
330
307
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
308
102
{ACAD_REACTORS
330
307
102
}
330
307
100
AcDbDictionary
281
     1
  3
1654967913120
350
302
  3
1654967913136
350
303
  3
1654967913152
350
304
  3
1654967913168
350
305
  3
1654967913184
350
306
  0
DICTIONARY
  5
33C
330
1A9
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
33D
  0
DICTIONARY
  5
191
330
22
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
185
330
93
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
186
  0
DICTIONARY
  5
183
330
92
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
184
  0
DICTIONARY
  5
10B
330
94
100
AcDbDictionary
280
     1
281
     1
  3
BUMPTILE
360
10D
  3
DIFFUSETILE
360
10C
  3
FBXASSET
360
187
  3
OPACITYTILE
360
10E
  3
REFLECTIONTILE
360
10F
  0
DICTIONARY
  5
33A
330
1A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
33B
  0
DICTIONARY
  5
FF
330
A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_ROUNDTRIP_2008_TABLESTYLE_CELLSTYLEMAP
360
300
  0
DICTIONARY
  5
314
330
9B
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
315
  0
DICTIONARY
  5
312
330
9A
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
313
  0
DICTIONARY
  5
320
330
A1
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
321
  0
DICTIONARY
  5
328
330
A5
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
329
  0
DICTIONARY
  5
31A
330
9E
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
31B
  0
DICTIONARY
  5
31E
330
A0
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
31F
  0
DICTIONARY
  5
32E
330
172
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
32F
  0
DICTIONARY
  5
326
330
A4
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
327
  0
DICTIONARY
  5
30A
330
96
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
30B
  0
DICTIONARY
  5
30C
330
97
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
30D
  0
DICTIONARY
  5
30E
330
98
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
30F
  0
DICTIONARY
  5
310
330
99
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
311
  0
DICTIONARY
  5
318
330
9D
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
319
  0
DICTIONARY
  5
32A
330
170
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
32B
  0
DICTIONARY
  5
324
330
A3
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
325
  0
DICTIONARY
  5
32C
330
171
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
32D
  0
DICTIONARY
  5
31C
330
9F
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
31D
  0
DICTIONARY
  5
338
330
17F
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
339
  0
DICTIONARY
  5
336
330
17E
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
337
  0
DICTIONARY
  5
330
330
17B
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
331
  0
DICTIONARY
  5
332
330
17C
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
333
  0
DICTIONARY
  5
322
330
A2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
323
  0
DICTIONARY
  5
316
330
9C
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
317
  0
DICTIONARY
  5
334
330
17D
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
335
  0
XRECORD
  5
302
102
{ACAD_REACTORS
330
308
102
}
330
308
100
AcDbXrecord
280
     1
  1
AcDb_Thumbnail_Schema
102
{ATTRRECORD
341
303
  2
AcDbDs::TreatedAsObjectData
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
304
  2
AcDbDs::Legacy
280
     1
291
     1
102
ATTRRECORD}
  2
AcDbDs::ID
280
    10
 91
        8
102
{ATTRRECORD
341
305
  2
AcDs:Indexable
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
306
  2
AcDbDs::HandleAttribute
280
     7
282
     1
102
ATTRRECORD}
  2
Thumbnail_Data
280
    15
 91
        0
  0
XRECORD
  5
303
102
{ACAD_REACTORS
330
308
102
}
330
308
100
AcDbXrecord
280
     1
  1
AcDbDs::TreatedAsObjectDataSchema
  2
AcDbDs::TreatedAsObjectData
280
     1
 91
        0
  0
XRECORD
  5
304
102
{ACAD_REACTORS
330
308
102
}
330
308
100
AcDbXrecord
280
     1
  1
AcDbDs::LegacySchema
  2
AcDbDs::Legacy
280
     1
 91
        0
  0
XRECORD
  5
305
102
{ACAD_REACTORS
330
308
102
}
330
308
100
AcDbXrecord
280
     1
  1
AcDbDs::IndexedPropertySchema
  2
AcDs:Indexable
280
     1
 91
        0
  0
XRECORD
  5
306
102
{ACAD_REACTORS
330
308
102
}
330
308
100
AcDbXrecord
280
     1
  1
AcDbDs::HandleAttributeSchema
  2
AcDbDs::HandleAttribute
280
     7
 91
        1
284
     1
  0
XRECORD
  5
33D
102
{ACAD_REACTORS
330
33C
102
}
330
33C
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
XRECORD
  5
186
102
{ACAD_REACTORS
330
185
102
}
330
185
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
7581DE8E-A623-425F-9BF4-B3F4BE6C4F9A
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623B9A2F3B5FEC0000007C01000008000000636F72652E786D6C8D90416E83301045AF62CDB632D8040820E328B4E204BD80653BC44AB011B6AB1EBF262152BBEB6A467FFE9B197D76FA9EEFE84BAFDE38DB03CD08206DA553C64E3DC470C10DA01367AB73E1970D9015B3EE61
310
9381B3697571D925E96CD03624D53AA5775178AF0320794F4D0F5E5EF52C32114372F85BB608791393CEE8AB4B708C46A1E711A3D23E73317A055E0D4D53D6C71A9FC7A1C6657D18703354232ECFED4731B6B43CBED72CDF60CE82995FF7E5AA45D00A7841488B29C5A4F8A46547AAAEA8DE48D311C2F2CDFE078A8BFA2714
310
8D0D87627FF78979E0343DF21870966F59A4F2082AD52D37FE03504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623B6E137E0172010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C0810121947A1554ED00B38E05014B091B1518EDFE511A5A9D22AFD2A1F60CDEC7A67C698ED2E6D8306
310
69FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7166B4B65FCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B0FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2601EE7691A25EBC4DB1FF2C48B9255EEA5797C
310
F0A2FDE62D3C6C8268FD9A3032367366EBF6AAAE30525859621E52BAF182C0A3E17B106D69BC0DE3179A6E2965642CBF6B725DF96493AB955D858BDCB9ADC73C002113F1CD2D4464512F06D04338236388F09912BE0F1A028190AD3836571F67800659586D22604AED6ED4201A27612AF5E9F4A09F178CCC9D3075DA1C5C3F
310
9C113E3DE3F71DE1A885AAC084B0B03C3A3BEA64B38625B44E1A6FB017A4B46945F39C8D5F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F02504B0304140006080800AC70623BE001BAC07D0000009D0000000B0000006662782F636E782E786D6C4DCCD10AC2201886E15B91FFDCA6536B037548D87D8CE686
310
E4344CA3CB6F8B1D74F4C1C3C72B87CF1AD0DBE5974F51013D11402EDED3E4E3A2A096197780062D734AE5EF06288EAB53B03368B9E4549F074D6E1E6B289B061F1F07124689687987B9601C7373BD60C36E065B6A6DDF7341A93843A365F32B6DBB87F517504B0304140006080800AC70623B8E5068122901000012020000
310
310000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C8D515B6EC32010BC0AE22B55850D364E93081345557A825E801892A2C460F1A872FC2EB523B57FF961D1EECCECECAED8DFC71BFA36215AEF7ACC2A8A917183D7D65D7A9CD3996C30DA4B
310
11BC4F7F601839359A1E973496E2127C9E96D4E05D322E41D6796D96A48AD1248C861B7C7A1C872F33AA4AE5048878AD26355CD5C554AC8232E0A4882980013437292F96B465B46BF886F0AEE5841FDEDFC8A1FD3890233B1EB75BDE31D6AD453D13A5C8D9EA856E35D8B1676BC2B322852C45B2E3C3FE108C4A4663D950BA
310
258C11DA7C32BEA3DDAEE95EE96647A9A80BFC1F294FFA4952B62EB5CD6277A6452C99A8E78214DAE7D3ED61C6DC271F122AFD56D10C2F305545CB6A60FC1908E383E29A2F8A31F900EB5D5D4F8065DD2CBBE652D4E542107ECF07B15C53FE00504B0304140006080800AC70623B503B51794E010000330300003000000066
310
62782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F
310
77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347
310
DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F
310
504B0304140006080800AC70623B38FA165F680500003C100000340000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F6F626A656374732E786D6CAD575D6FA33814FD2B887D0E8424EDB42BCAA8499A2A1A756634D18CF6A15264C0A16CC146B6E9A4FBEBF7180C
310
019276B21F7908D8D8F7F3DCE36BFFE33ECFAC172A64CAD98DED3963DBA22CE271CA921BBB54BBD1956D7D0C7CC1B9EA2CB32D46727A63EB693BF013C1CBC24CC57447CA4C0D6657F33F2C1951466D2BCA889437B68C9E684E1C522A1E53F9ECC4441127D9ED1DCFA917F6C52682144F03A105119429588A790629566D94D7
310
1F8E6D37F05DFD3DF0F5BF59357D7B955BF9D3D79F32A9088B8E940DC44CBDD9F26E72713DBA98CDA6A3D9E5C41BCD57F3E5C8FB301D2F2E178BEBDBBB6B28964A4092B144D09D1DDC2336228D7CB7FED45A6C0C3F6552C419A351E53F3CAC6C3612635A5016238F2995D0D6F17ADC1F7A3A369DCF533D362ABBD3E779D5DD
310
D111D4D8DE3CBB96F2F04FB820CF41859054A3AA8E8F71B4C6DFF810B590F3CC7C4BA5951345454A322B4B4341C4AB1D60A95E12F83D311A9D42235C7B6007DE415ED75694C6AFB17BCACA5D99651A9A7650217B0BFC53252BCBD2BFA838AD0D36215765CAD4957148BD16D40EAE7DB79A0C7CFD984ECCC73A90D62E230952
310
0E37EBAF034717BAF6D64B3BF8B40AF71B5D8FA79517821754280D1F40AB495CF3D451326ABDB332A737C0995ECC0F41F986C87F46F91E4C41DE44BA9FED67468B1284C91D173972E38CAB9F356E5E46EDDBF10BF86CB0FA784D3BF3AF16FB6E6B6C9F30DECA1FC0A55373F5DFF3D78F5917A99DF405FE0B0A8C8BA909E526
310
2219A8E72165488806A595714C81CB77E1DE0ED6604A303B76912C680372F4E2BB2FF88EFF5A36D8AA52DF79322474C0B767303F625995056C7B032C473C592936CEBD15F38BFFA5666E979B4F9B52EC48441F0CB12CE92E65A9C2D979006FD7A05E227A1E3DD3D79F5CC470F438099B6E1272A34A22DA3AE63AF0497358E8
310
C141734F41847D09D79CE7FF42C3432A239A6584515E365ADA634863B52519D327A00AEB804E2703140BFA92EA4EA2B7A26716CEFA48A4850E597BE8B53CEDBCE1CBF7F56780D20EE6AF73A0F5F9B02A3CD07DC4332EB6E1EBB666421BE0C39E3EBA7FF4E16D22EA6A29407C85E586724C88B771BADB9512BC7B228A3FD68B
310
6EA65A22397E690AA8D158D7E40CEC8CDA23C2C0B7D1898640101CEC9C6D531CE328CB93CABBBA870A6425F70DF96199175B92F392A973C2346EFC69AC6F8577BB18F993A8E8C90E36D573340765C7343EA4AA87027D049DF0A9979E0F1757DEF2EEEA6E747B39412B35B9588DAEE7ABD9683E5DCDE677978BD9EAFAB6B5A8
310
B224F09B13AA5B8388264E44BF14A909F3F7F5A16CEDE08128E9DED705E526F5F3FBDA415BECBBD80380B71BD77991D19C3245347C1FF44BF68DA0ABE8C9A8E7D73949E81952BEDC6F063660E68C7D5F75A9D19F83BD6676A16BE1A410F554E621236936D8681C770A9618B79B50B6CF9AD19BA11E9978A20F953C4B63104E
310
6C2594E7548176CE607B915309C474BBF2D8DC1ECED8FD52F7838A84196D2C79226889330954036E65A4FAF3D66F68E174177563E3B0739EF1670AD1B690EA1B1BFCA6D2884A27C4F1A81B9F4A3820802EAC2541408DB02443675D6F6AC7ED2E1D1BD00F4E40A3BF5D724EB764FCEA116F4E8A02A7768F562BDB8C82E81F39
310
DE98631185D7B054AD2F8789D6994A0D2AAB76CADC0DD0423C1BD57BD4D7FB6E794EB5A61791B3EE49EF82A0963A524424D5BD40DB674CBA5D7E75D10A58EB2F569195097279BEA491A00073A90B1C28022A8CCC82284075F1FBE357C17117CDAD550A083C2E789E736606B7E62E6B6D9E70338D1F410B545F3FE464EC798F
310
55D76F2E22DB9048EA90583E63A22938EDC1006B00E4D1716A52E0EA1C0C96AF9796393066105A81F6A829ADAFE1168A47DF1C75A974C9B278B7F177ABA5008340CB1EFC0D504B0304140006080000AC70623B000000000000000000000000350000006662782F30333130353234382D343533342D344143372D413346412D
310
4531454539393435313135362F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E636660600000504B0304140006080000AC70
310
623B000000000000000000000000370000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30333130353234382D343533342D344143372D41
310
3346412D4531454539393435313135362F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11D
310
E607FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BF2C5666EFF000000A00100003B0000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F7265736F7572636573
310
2F636F72652E786D6C8D504B6E833010BD0A9A6D65B00910888CA3D02A27E8052C33A156821DF953F5F8B5132AB5BB6E6646EFA3797AFCF8B5DE8A4F745E5B33022B291468949DB5594688E1427A288E823B6BC32F191446AE38428641F0C5D978DF20654D4013126AEC8C1B28BDC70085BAA56304AF3E7095A58C2129FCB5
310
BC4B75950B96AC4C74D209EE834B018AE7933C4138F4363A859E574F56F018F5BC69F49C7EEA8B4607A29DFABEE9F62D399DA78E34DD6E22FDD49E49731ADEEAF3C09AFD6BC7AB6C163CE8F527A3722803CE206A4A07C218A1F53B6B0EB43DD4ED0BED0F94F22ACBFF98E27DFEA7296A1376F516F769F320580AF22004AF72
310
5F693DCA4C3B772BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B200
310
00005B436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623B9A2F3B5FEC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D
310
6C504B01021400140006080800AC70623B6E137E0172010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623BE001BAC07D0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B010214001400060808
310
00AC70623B8E506812290100001202000031000000000000000000000000005B0500006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D3
310
0600006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6C504B01021400140006080800AC70623B38FA165F680500003C10000034000000000000000000000000006F0800006662782F30333130353234382D343533342D344143372D413346412D4531
310
454539393435313135362F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000290E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F76657274696365732E62696E504B01021400
310
140006080800AC70623BF270F133060000000400000036000000000000000000000000007C0E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000
310
000000000000000000D60E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD1900000004101000036000000000000000000000000002B0F00006662782F30333130353234382D
310
343533342D344143372D413346412D4531454539393435313135362F6469726563746F72792E786D6C504B01021400140006080800AC70623BF2C5666EFF000000A00100003B000000000000000000000000000F1000006662782F30333130353234382D343533342D344143372D413346412D453145453939343531313536
310
2F7265736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000671100000000
  0
XRECORD
  5
184
102
{ACAD_REACTORS
330
183
102
}
330
183
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
778E3A9F-1AF3-452F-85C1-1BC15BD3F630
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BFD5588D4EC0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103891DC7C24471939CA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EF81EEFE8CBCCC17AD7012D0820E394D7D60D1DA478C50DA083E0B3F7F1970D9093A3E960
310
9141F061F6695A25E55D342E66D5796D56518660222075CF4D07417D9A511632C5EC08B76292EA260753D05797E194AC46CF2356E77DF66ACD0C62C768BD63971E5727D2E06DDF9C71BF7B3FE10BABF79BFA488FE4DCF07281058F767CDD57B391D168108C903DA61413F641B72DA95A56BD91A62584978BFD0F9426FD4F28
310
5917376C7DF7890510343FF218085E2E59E4F2082AD72537F103504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB5D38BAD72010000D40300000C0000006662782F636F72652E786D6CC553DB8E823014FC95A6AF1B68C11B9A52A3AB7EC1FE4085CA36424B4A4BFCFC3D5C8CEBC635EED3F200CDCC393D3353CAD697AA44AD
310
B48D323AC5514831923A33B9D2458ABD3B0509466BCEAC31EE5B19465A5432C51D8C392BACF1F50865463BA91DA0DAE4720445D348875156C222C54DF6292B110AEFA0A23987B5C8CEA2906114020D759C35CE8200340CE9DE989F8E1746069C33EF553EB22A8769EAA4A4C57C1147F3457CD806B31D4D82E936D907DBC5FB
310
2E38C4F3E564BE8936749F30D23573E65475559759299CCC318F295D065114D0F8239AAEE86C15CFDE68B2A29491AEFCAEC9D7F98B4D5E69378947B9435B837904427AE2875B88C8A146B4A0877046BA10E1D3277C1F340402213B712CAF3ECE00B53273C64E81C98DBF51AD28BD84A934A4FD837E5F303274C2D47E7370FD
310
7046FCF28CE73BC2510B5D8009E16079F4AED3C9060D6368B5B441EB2E481B5B89F2351B4F1CFE89BA897F282933A5B1FFA5888C0744C6DF8374F7917F01504B0304140006080800AC70623B09885E1C7E0000009D0000000B0000006662782F636E782E786D6C4DCCDF0A83201C86E15B91DFB9CBA6FD11D41063F711CB42
310
663A9C8E5DFE6A74B0A30F1E3E5E317C368FDE36BD5C0C12EA0B0164C33DCE2EAC124A5E700F685022C598FF6E80C2B459090783126B8AE579D26C97A9F8BCAB77E17122E586D5843498B3EE8699D114F39E5E713D76EDA84DCBB569A052A2FA95F63DC2EA0B504B0304140006080800AC70623B961D28872A010000120200
310
00310000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C8D515B6EC32010BC8AC557AA0A1BFC4A1C61A2C8514FD00B10435294182C1E558EDFA576A4F62F3F80666766875D76784CF7EC5B39AFADE911CD09CA9419ADD4E6DAA3182E7887B203
310
67CEDAF08786322326D5A30423CEAECEC67985466B8232015063A55A41E1BD0A281BEFF0E8911FBFD42472110330FC2D9FC578135795D31CCAC0E3CC070701B2A5493A11AFBAA1A68434B8ABB71FB81E8E15EE765589E969DB9E8E43DB1D8786158B90B318B55CE55A421C7DD1CABD6A92C49C053D3DE38F4E89A024E22521
310
1DA61493F293D67BD2ECCBE69DECF684B022D1FF89E22C5F14456D4255AE711799479CB2622970266D3CDF9F61D463B62E64A9DFC6ABF10D7192C35CCA0A040B11BE0F8E6DBD3AFA601D8C77733B0397C290926D5B7356A40DC1F5BB3EB8D336F90F504B0304140006080800AC70623B503B51794E01000033030000300000
310
006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1E
310
BC4F77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C54
310
2347DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F
310
103F504B0304140006080800AC70623B2EA4D28F640500003C100000340000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F6F626A656374732E786D6CAD575D739B3814FD2B0CFB6C30B1D3263B844E6CC71D4F376DA79E76F621331E01326103122389C4E9AFDF
310
231018B09D7A3FFC609090EEE7B94757FE875D9E59CF54C894B31BDB73C6B64559C4E394253776A9B6A32BDBFA10F88273D559665B8CE4F4C6D6D376E027829785998AE99694991ACC2E677F5A32A28CDA569411296F6C193DD29C38A4543CA6F2C98989224EB2DD399E532FEC8B4D04291E07420B222853B014F30C52ACDA
310
28AF3F1CDB6EE0BBFA7BE0EB7FB36A727A955BF9D3D79F32A9088B0E940DC44CBCE9E2EEE2F27A74399D4E46D37717DE68B69C2D46DEFBC978FE6E3EBFBEBDBB8662A90424194B04DDDAC147C446A491EFD69F5A8B8DE1C74C8A386334AAFC878795CD46624C0BCA62E431A512DA3A5E8FFB434FC7A6F379A2C7466577FA3C
310
AFBA3B3A821ADB9B67D7521EFE0517E439A810926A54D5F1318ED6F81BEFA316729E996FA9B472A2A84849666569288878B5032CD54B02BF2746A35368846B0FECC0DBCBEBDA8AD2F835768F59B92DB34C43D30E2A646F807FAA646559FA938AE3DA60137255A64C5D1987D46B41EDE0DA77ABC9C0D78FC985F95807D2DA66
310
2441CAE166FD75E0E85CD7DE6A61079F96E16EADEBF1B8F242F0820AA5E1036835896B9E3A4A46AD7756E6F40638D38BF93E28DF10F9CF28DFBD29C89B4877D3DDD468518230B9E522476E9C71F5B3C6CDCBA87D3B7C019F0D561FAE6967FED562DF6D8DED13C6A9FC015C3A3557FF3D7FFD987591DA495FE03FA3C0B89898
310
50AE2392817AEE53868468505A19C714B87C1BEEEC6005A604B36317C9823620072FBEFB8CEFF8AF6583AD2AF59D274342077C7B06F323965559C0B6136039E0C94AB171EE54CC2FFF979AB95DAC3FAD4BB12511BD37C4B2A0DB94A50A67E71EBC5D837A89E879F4445F5FB888E1E86112D6DD24E4469544B475CC75E093E6
310
B0D083BDE69E8208FB12AE39CFFF8586FB544634CB08A3BC6CB4B4C790C66A4B32A64F4015D6019D5C0C502CE873AA3B89DE8A9E5938EB2391163A64EDA1D7F2B473C297EFABCF00A51DCC5EFF20AF5DC20CF7741FF18C8B4DF8BAA999D006F8B0A78FEE1F7D789B88BA5A0A105F61B9A11C13E24D9C6EB7A504EF1E89E28F
310
D5BC9BA996480E5F9A026A34D63539053BA3F68830F06D74A2211004073B679B14C738CAF2A8F2AEEEA10259C93D213F2CF36243725E32754E98C68D3F8DF5ADF06E17235F888A1EED605D3D473350764CE31309D547D0119F7AE979FFFEEA6E727BBD1C79B74BB4529717CBD1D5E5DC1B79B3B977395B4C96EF2638E6FA15
310
D09C50DD1A44347122FAA5484D98BFAFF6656B07F74449F7635D506E523FBFAF1CB4C5BE8B3D0078BB71951719CD295344C3F75EBF64DF08BA8A9E8C7A7E9593849E21E5CBC7F5C006CC9CB1EFAB2E35FA32D86B66E7BA168E0A518F651E329266838DC671A7608971BB0965FBAC19BD19EA918927FA50C9B33406E1C45642
310
794E1568E70CB6173995404CB72B8FCDEDE18CDDCF753FA84898D1C6924782963893403548A78C547FDEFA0D2D9CEEA26E6C1C76CE13FE4C21DA16527D6383DF541A51E984381E75E353090704D085B52408D0139664E8ACEB4DEDB8DDA56303FAC10968F4B74BCEE9968C5F3DE2CD4951E0D4EED16A659B5110FD23C71B73
310
2CA2F01A96AAF5653FD13A53A909C03570A77DA0857832AA77A8AFB7DDF29C6A4D2F2267DD93DE04412D75A48848AA7B810EBA31E976F1D5452B60ADBE58455626C8E5F992468202CCA52E70A008A830320BA200D5F9EF0F5F05C75D34B7962920F030E779CE9919DC9ABBACB57EC4CD347E002D507DFD901763CF7BA8BA7E
310
7311D984445287C4F209134DC1690F065803200F8E53733D73750E06CB570BCB1C185308AD407BD094D6D7700BC5A36F8EBA54BA6459BCD9F8BBD552A040A0650FFE06504B0304140006080000AC70623B000000000000000000000000350000006662782F33394334313030352D393437462D344341332D393833322D3144
310
373644414336394143352F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B
310
000000000000000000000000370000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F33394334313030352D393437462D344341332D393833
310
322D3144373644414336394143352F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607
310
FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623B95BFD5E5FE000000A00100003B0000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265736F75726365732F63
310
6F72652E786D6C8D50596E833010BD0A9ADFCA603B1B41C611699213F40296992456828DBC543D7E4DA052FBD79F99D15B344F4F1CBE8667F1893E18675B60258502AD76BDB1B71652BC921A8A8314DEB9F84B06855503B630C120C5CDBB342E907636A28D19B5AEC70554216084423FF3D142D0771C54A952CC8AF02847A5
310
1FEA86252B339D755284E87380627E324D901E834B5E6310D5CC4A9192E9178DE9F34F7335E841EE38DBEEF8A5239B13ADC9FA589FC971F77E2217BEDDAFB61DEBE8B916D56496229AE127A3F6A822F62039A57BC218A1FC83AD1BBA69F8E68DD60DA5A29AE47F4C69ECFF694AC6C6155FE2CEB60092E5202F428A6AEA2BAF
310
5799794FDDCA6F504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B
310
436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BFD5588D4EC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D6C504B
310
01021400140006080800AC70623BB5D38BAD72010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623B09885E1C7E0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B01021400140006080800AC70
310
623B961D28872A0100001202000031000000000000000000000000005C0500006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D5060000
310
6662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6C504B01021400140006080800AC70623B2EA4D28F640500003C1000003400000000000000000000000000710800006662782F33394334313030352D393437462D344341332D393833322D3144373644
310
414336394143352F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000270E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F76657274696365732E62696E504B01021400140006
310
080800AC70623BF270F133060000000400000036000000000000000000000000007A0E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000000000
310
000000000000D40E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000290F00006662782F33394334313030352D393437
310
462D344341332D393833322D3144373644414336394143352F6469726563746F72792E786D6C504B01021400140006080800AC70623B95BFD5E5FE000000A00100003B000000000000000000000000000D1000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265
310
736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000641100000000
  0
XRECORD
  5
10D
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10C
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
187
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
 70
     0
 90
1778669749
  1
7E355024-1ABF-47F9-966E-F2159FBE82AB
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BDCE527C8EB0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103B15DC7C24471249FA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EFA9EEFE8CBACC17AD7032D0820E394D7D64D3DA478C52DA093E0ABF7F1970D9093B3E961
310
9341F069F569D925E55D342E66D5796D76518660222075CF4D0F417D9A591632C5EC08B76291EA262753D05797E194AC46CF2356E77DF66ACD0A621C9B73335C463C5E0E1457EC9DE2A1612D3E9233A92BD2D66333F07283058F767EDD57AB91D168108C9023A61413F641AB8ED41DABDF48DB11C2CBCDFE074A8BFE2794AC
310
8B07B6BFFBC402089A1F790C042FB72C72790495EB969BF801504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF32603847
310
2BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB24894EB71010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C085012194749244ED00B38E05014B091B1518EDFE511A5A9D228FD2A1F60CDEC7A67C6986D2F6D830669
310
FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7266B4B6DFCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B4FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2609EE7C92ED91F722F3FAC022F0ADF036F9F84A9
310
B7A63B1A47348DF364CFC8D8CC99ADDBABBAC2486165897948E9DA0B028F861F41B4A1F1268CDF68BAA19491B1FCAEC975E58B4DAE5676152E72E7B61EF300844CC40FB7109145BD18400FE18C8C21C2674AF83E68080442B6E2D85C7D9C011A6461B5898029B5BB5183689C84A9D4A7D3837E5F303277C2D4697370FD7046
310
F8F28CE73BC2510B5581096161797476D4C9660D4B689D34DE602F4869D38AE6351B4F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F01504B0304140006080800AC70623B3A54DFB77D0000009D0000000B0000006662782F636E782E786D6C4DCCD10A83201805E05791FFDEA5EBA76DA046A37C8F581632D3
310
613AF6F8B3D1C52E0E073E0E47B49FD591B7899B0D5E023F3120C63FC264FD2221A7995E81B44AC410D2DF0C881F5723616750628921BF0E9ACC3C66978A3AEB9F07B2A6D77AB87514F95953EC39D20EEF9C6AD60C88BC2EB940A544F57B2ABD1FAB2F504B0304140006080800AC70623B4A17098729010000120200003100
310
00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C8D515B6EC32010BC0AE22B55850D0E76930813A54A7C825E80DA244589C1E251E5F85D6A476AFFF2018B7667666759B1BF8F37F4AD7D30CEB6981514236D7B37187B69718A67B2C1682F8577
310
2EFE816164D5A85B9CD3588A8B77695A52BDB351DB0859EB06BD2455083A62D4DFE0D1E2D07FE951152A4540846B31A9FEAA2EBA600594012745881E0CA0B949BEB1A4CDB1EB4EDB03E1ACEA083F324E0EFC9D918E3627CED91ACE9B2867A214299961A19B01EC98B3D1FE59914C96229AF161BFF75A453D605951BA258C11
310
5A7D30BEA3F5AEAA5FE96647A92833FC1F294DC393A4646C5C578BDD9916B064A29C0B520C2E7DDE1E66F47D723EA2DC6F1574FF02531594D6AC69443903617C506CF8A218A2F3F0BDABEB2760593DCB365C8A326F08C2EFFA20E66DCA1F504B0304140006080800AC70623B503B51794E0100003303000030000000666278
310
2F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F7736
310
4A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347DEE0
310
50F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F504B
310
0304140006080800AC70623BD8F6D0D5660500003B100000340000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F6F626A656374732E786D6CAD575B8F9B3814FE2B887D064292B964C5504D92491555D3568D5AEDC348910187610730B2CD4C667FFD7E06438024
310
6DF6928780CDF1B97EE762EFC33E4B8D57CA45C2F23BD3B547A641F39045491EDF99A5DC59B7A6F1C1F73863B243661A39C9E89DA9B64DDF8B392B0BBD15D11D295339D85DCDFF304448736A1A614A84B83345F84C33629352B2888A173B2292D8F16E6FBB764DD8671B73523C0F981684D35C4253ECE7E062D44AB9FDE5C8
310
747CCF51DF7D4FFD6BAAC9792AA7B2A72F3FC985247978246CC066E24E970FE3AB9975359D4EACE9F5D8B5E6ABF9D2726F26A3C5F56231BB7F9841B0901C9CB4269CEE4CFF237CC393D073EA4FADC65AF1532A852CCF6958D90F0B2B9D35C78816348F10C7840A48EB583DEA2F5DE59BCEE7895A6B91DDEDCBACEA9EE8306A
310
746F9E5D4D59F0274C1097A0820BAA5055FB471B5AE36F74F05AC058AABF25C2C888A43C21A991260127FCDDF441AA487CAFC746A1932B842B0B4CDF3DF0EBEA8AD4F835764F69B92BD35441D3F42B646F817F2A45A559F217E5A7A54127C4AA4C7279AB0D92EF0535FD99E7549BBEA71E93B1FE583BD2D8A52446C86166FD
310
7560E842E5DE7A69FA9F56C17EA3F2F1B4F082B38272A9E0036835816B9ECA4B5AAC7B51E4D40118D3F3F9C129DFE0F9CF48DF832A881B4FF6D3FD544B919CE462C77886D8D8A3EA678C9A17AB7D3B7E413D1B501FD3B43BFF8AD8735A65FB05E35CFC002E159ADBFF1EBFBECFBA48ED84CFF75E91608C4FB42B372149517A
310
1E931C0151A03452862DD4F25DB037FD352A252A3B4E91D46F1D72F4E239AFF88EFF9A37AA5525BEF3CC11D041BDBDA0F2C397555A40B7336039AA9395606DDC399F5FFD2F3973BFDC7CDA947C4742FAA80BCB92EE923C91E89D07F07615EA05A267D10B7D7F633C82A1C741D8748390695102DE563E578E8F9B66A11607C9
310
3D0121CEC54CD53CEF17121E1311D2342539656523A56D430AAB6D91D17302B2B076E8643C4031A7AF899A247A143DB5D0EB439E14CA656DD36BEBB47DC696EFEBCF0025E8531690F440141CAA7DC852C6B7C1FBB62E8426B087237D70FFE8A35B3BD4515C00F80ACA4DC5D11EDE46C96E570A94DD134EFCB15E7403D5D691
310
E397267F1A89754A4E519C917A846BF43632310F7082BECEF26D822E8EAC3C29BC2B7B2840547CCFF00FCAACD8928C95B9BCC44DA3C69E46FB96797788116F4486CFA6BFA99ED61C153BA2D121543D10A80E74C2A65E786E1E265757A3F1D472EFE72B6B7AB39A59B3EBEB076B3576AF66ABF9C3EDF87EDE6A5469E27B4D83
310
EAA620BC8986E8953CD16EFEBE3E64ADE93F12299C8F753E3971FDFCBEB631157B0ECE00DFEDC17556A434A3B9240ABD8FEA25FD463054F478D4FBEB8CC4F4022E5F3E6E063A60E782735F55A6D1B7C159BDBB50B97092897C2EB32027493A38A80DB78B3CD66637AE6C9F75416F966AA5FD893154B03489506F2223A62CA3
310
1255E78262CF332A8098EE501EE9CBC305A75FEB71509220A58D26CF0413712A806AC0AD0C657FDFF80D139C1AA2EE4CF43AFB057F3A114D03A1BE3351DE6412526107E88E6AEEA998030218C2DA1A08A8913C4E3158D787DA757B4AF906E5070D50CB6F492E1996B45DBDBA9B91A240D3EE55D54A372D20FC478637EA1844
310
E23528656BCB61A335A61283CCAA8DD257034C102F5AF41EF9F573B35CBBA2E979E4A26BD24F415073B524E171752D50FA6995EE975F1D4C02C6FA8B51A4658C585ECEC9E214602E558203454085E6591009A82E7E7FFACA19AEA299B14A0081A705CB3296EBC5BDBECA1A9B675C4CA3279405AA6E1F623C72DDA76AE8D7F7
310
906D4004B549245EB0D1249CB260803500F2A89BEA10382A0603F2F5D2D00D630AA615688F66D2FA166E2079D4C551A54AB758163F9DFB9D8A1460E098D8FDBF01504B0304140006080000AC70623B000000000000000000000000350000006662782F30364446464539412D343132462D344431342D413442312D46303645
310
34343133343431372F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B0000
310
00000000000000000000370000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30364446464539412D343132462D344431342D413442312D
310
4630364534343133343431372F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607FB14
310
4396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BB40F7AF9FE000000A00100003B0000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F75726365732F636F72
310
652E786D6C8D504B6E833010BD0A9A6D65B00950828CA3109513F4029699502BC146FE543D7E4D42A576D7CDCCE87D344F8F9FBE967BF689CE6B6B7A6039850C8DB29336730F315C490BD94970676DF82583CCC8057BD860107C7636AE3BA4AC096842428D9D7007A5F7182053F774F4E0D5072E3297312485BFE5AB543739
310
63CEF244279DE03EB814207B3ED9260887DE46A7D0F3E2C90A1EA39E768D9ED24F7DD5E8408C63736E86CB1B192F0746AAF29591A1295B72A4675A57B4ADC766E0C566163CE8E527A37228034E204A4A8F843142CB775675B4EECAFA85B61DA5BCD8E47F4C719DFE698ADA8443B9C77DDA3C0896823C08C18BADAFB41E65A6
310
BD752BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B436F
310
6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BDCE527C8EB0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000094020000636E782E786D6C504B0102
310
1400140006080800AC70623BB24894EB71010000D40300000C00000000000000000000000000180300006662782F636F72652E786D6C504B01021400140006080800AC70623B3A54DFB77D0000009D0000000B00000000000000000000000000B30400006662782F636E782E786D6C504B01021400140006080800AC70623B
310
4A17098729010000120200003100000000000000000000000000590500006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D10600006662
310
782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6C504B01021400140006080800AC70623BD8F6D0D5660500003B10000034000000000000000000000000006D0800006662782F30364446464539412D343132462D344431342D413442312D46303645343431
310
33343431372F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000250E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F76657274696365732E62696E504B010214001400060808
310
00AC70623BF270F13306000000040000003600000000000000000000000000780E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E504B01021400140006080000AC70623B00000000000000000000000037000000000000000000
310
00000000D20E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000270F00006662782F30364446464539412D343132462D
310
344431342D413442312D4630364534343133343431372F6469726563746F72792E786D6C504B01021400140006080800AC70623BB40F7AF9FE000000A00100003B000000000000000000000000000B1000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F
310
75726365732F636F72652E786D6C504B0506000000000E000E0080040000621100000000
  0
XRECORD
  5
10E
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10F
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
33B
102
{ACAD_REACTORS
330
33A
102
}
330
33A
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
CELLSTYLEMAP
  5
300
102
{ACAD_REACTORS
330
FF
102
}
330
FF
100
AcDbCellStyleMap
 90
        3
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
    32768
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.25
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        1
 91
        1
300
_TITLE
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        2
 91
        1
300
_HEADER
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        2
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        3
 91
        2
300
_DATA
309
CELLSTYLE_END
  0
XRECORD
  5
315
102
{ACAD_REACTORS
330
314
102
}
330
314
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     1
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     0
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
313
102
{ACAD_REACTORS
330
312
102
}
330
312
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
321
102
{ACAD_REACTORS
330
320
102
}
330
320
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
329
102
{ACAD_REACTORS
330
328
102
}
330
328
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
31B
102
{ACAD_REACTORS
330
31A
102
}
330
31A
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
31F
102
{ACAD_REACTORS
330
31E
102
}
330
31E
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
32F
102
{ACAD_REACTORS
330
32E
102
}
330
32E
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     0
102
RTVSPropertyOp1
 70
     0
102
RTVSPropertyOp2
 70
     0
102
RTVSPropertyOp3
 70
     0
102
RTVSPropertyOp4
 70
     0
102
RTVSPropertyOp5
 70
     0
102
RTVSPropertyOp6
 70
     0
102
RTVSPropertyOp7
 70
     0
102
RTVSPropertyOp8
 70
     0
102
RTVSPropertyOp9
 70
     0
102
RTVSPropertyOp10
 70
     0
102
RTVSPropertyOp11
 70
     0
102
RTVSPropertyOp12
 70
     0
102
RTVSPropertyOp13
 70
     0
102
RTVSPropertyOp14
 70
     2
102
RTVSPropertyOp15
 70
     0
102
RTVSPropertyOp16
 70
     0
102
RTVSPropertyOp17
 70
     0
102
RTVSPropertyOp18
 70
     0
102
RTVSPropertyOp19
 70
     0
102
RTVSPropertyOp20
 70
     0
102
RTVSPropertyOp21
 70
     0
102
RTVSPropertyOp22
 70
     0
102
RTVSPropertyOp23
 70
     0
102
RTVSPropertyOp24
 70
     0
102
RTVSPropertyOp25
 70
     0
102
RTVSPropertyOp26
 70
     0
102
RTVSPropertyOp27
 70
     0
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
327
102
{ACAD_REACTORS
330
326
102
}
330
326
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
30B
102
{ACAD_REACTORS
330
30A
102
}
330
30A
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
30D
102
{ACAD_REACTORS
330
30C
102
}
330
30C
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
30F
102
{ACAD_REACTORS
330
30E
102
}
330
30E
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
311
102
{ACAD_REACTORS
330
310
102
}
330
310
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
319
102
{ACAD_REACTORS
330
318
102
}
330
318
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
32B
102
{ACAD_REACTORS
330
32A
102
}
330
32A
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     0
102
RTVSPropertyOp1
 70
     0
102
RTVSPropertyOp2
 70
     0
102
RTVSPropertyOp3
 70
     0
102
RTVSPropertyOp4
 70
     0
102
RTVSPropertyOp5
 70
     0
102
RTVSPropertyOp6
 70
     0
102
RTVSPropertyOp7
 70
     0
102
RTVSPropertyOp8
 70
     0
102
RTVSPropertyOp9
 70
     0
102
RTVSPropertyOp10
 70
     0
102
RTVSPropertyOp11
 70
     0
102
RTVSPropertyOp12
 70
     0
102
RTVSPropertyOp13
 70
     0
102
RTVSPropertyOp14
 70
     2
102
RTVSPropertyOp15
 70
     0
102
RTVSPropertyOp16
 70
     0
102
RTVSPropertyOp17
 70
     0
102
RTVSPropertyOp18
 70
     0
102
RTVSPropertyOp19
 70
     0
102
RTVSPropertyOp20
 70
     0
102
RTVSPropertyOp21
 70
     0
102
RTVSPropertyOp22
 70
     0
102
RTVSPropertyOp23
 70
     0
102
RTVSPropertyOp24
 70
     0
102
RTVSPropertyOp25
 70
     0
102
RTVSPropertyOp26
 70
     0
102
RTVSPropertyOp27
 70
     0
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
325
102
{ACAD_REACTORS
330
324
102
}
330
324
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
32D
102
{ACAD_REACTORS
330
32C
102
}
330
32C
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     0
102
RTVSPropertyOp1
 70
     0
102
RTVSPropertyOp2
 70
     0
102
RTVSPropertyOp3
 70
     0
102
RTVSPropertyOp4
 70
     0
102
RTVSPropertyOp5
 70
     0
102
RTVSPropertyOp6
 70
     0
102
RTVSPropertyOp7
 70
     0
102
RTVSPropertyOp8
 70
     0
102
RTVSPropertyOp9
 70
     0
102
RTVSPropertyOp10
 70
     0
102
RTVSPropertyOp11
 70
     0
102
RTVSPropertyOp12
 70
     0
102
RTVSPropertyOp13
 70
     0
102
RTVSPropertyOp14
 70
     2
102
RTVSPropertyOp15
 70
     0
102
RTVSPropertyOp16
 70
     0
102
RTVSPropertyOp17
 70
     0
102
RTVSPropertyOp18
 70
     0
102
RTVSPropertyOp19
 70
     0
102
RTVSPropertyOp20
 70
     0
102
RTVSPropertyOp21
 70
     0
102
RTVSPropertyOp22
 70
     0
102
RTVSPropertyOp23
 70
     0
102
RTVSPropertyOp24
 70
     0
102
RTVSPropertyOp25
 70
     0
102
RTVSPropertyOp26
 70
     0
102
RTVSPropertyOp27
 70
     0
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
31D
102
{ACAD_REACTORS
330
31C
102
}
330
31C
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
339
102
{ACAD_REACTORS
330
338
102
}
330
338
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
337
102
{ACAD_REACTORS
330
336
102
}
330
336
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
331
102
{ACAD_REACTORS
330
330
102
}
330
330
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
333
102
{ACAD_REACTORS
330
332
102
}
330
332
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
323
102
{ACAD_REACTORS
330
322
102
}
330
322
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
317
102
{ACAD_REACTORS
330
316
102
}
330
316
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
335
102
{ACAD_REACTORS
330
334
102
}
330
334
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
ENDSEC
  0
EOF
`;var E$e=`  0
SECTION
  2
HEADER
  9
$ACADVER
  1
AC1024
  9
$ACADMAINTVER
 70
   226
  9
$DWGCODEPAGE
  3
ANSI_936
  9
$LASTSAVEDBY
  1
win10
  9
$INSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$EXTMIN
 10
1.000000000000000E+20
 20
1.000000000000000E+20
 30
1.000000000000000E+20
  9
$EXTMAX
 10
-1.000000000000000E+20
 20
-1.000000000000000E+20
 30
-1.000000000000000E+20
  9
$LIMMIN
 10
0.0
 20
0.0
  9
$LIMMAX
 10
12.0
 20
9.0
  9
$ORTHOMODE
 70
     0
  9
$REGENMODE
 70
     1
  9
$FILLMODE
 70
     1
  9
$QTEXTMODE
 70
     0
  9
$MIRRTEXT
 70
     0
  9
$LTSCALE
 40
1.0
  9
$ATTMODE
 70
     1
  9
$TEXTSIZE
 40
0.2
  9
$TRACEWID
 40
0.05
  9
$TEXTSTYLE
  7
Standard
  9
$CLAYER
  8
0
  9
$CELTYPE
  6
ByLayer
  9
$CECOLOR
 62
   256
  9
$CELTSCALE
 40
1.0
  9
$DISPSILH
 70
     0
  9
$DIMSCALE
 40
1.0
  9
$DIMASZ
 40
0.18
  9
$DIMEXO
 40
0.0625
  9
$DIMDLI
 40
0.38
  9
$DIMRND
 40
0.0
  9
$DIMDLE
 40
0.0
  9
$DIMEXE
 40
0.18
  9
$DIMTP
 40
0.0
  9
$DIMTM
 40
0.0
  9
$DIMTXT
 40
0.18
  9
$DIMCEN
 40
0.09
  9
$DIMTSZ
 40
0.0
  9
$DIMTOL
 70
     0
  9
$DIMLIM
 70
     0
  9
$DIMTIH
 70
     1
  9
$DIMTOH
 70
     1
  9
$DIMSE1
 70
     0
  9
$DIMSE2
 70
     0
  9
$DIMTAD
 70
     0
  9
$DIMZIN
 70
     0
  9
$DIMBLK
  1

  9
$DIMASO
 70
     1
  9
$DIMSHO
 70
     1
  9
$DIMPOST
  1

  9
$DIMAPOST
  1

  9
$DIMALT
 70
     0
  9
$DIMALTD
 70
     2
  9
$DIMALTF
 40
25.4
  9
$DIMLFAC
 40
1.0
  9
$DIMTOFL
 70
     0
  9
$DIMTVP
 40
0.0
  9
$DIMTIX
 70
     0
  9
$DIMSOXD
 70
     0
  9
$DIMSAH
 70
     0
  9
$DIMBLK1
  1

  9
$DIMBLK2
  1

  9
$DIMSTYLE
  2
Standard
  9
$DIMCLRD
 70
     0
  9
$DIMCLRE
 70
     0
  9
$DIMCLRT
 70
     0
  9
$DIMTFAC
 40
1.0
  9
$DIMGAP
 40
0.09
  9
$DIMJUST
 70
     0
  9
$DIMSD1
 70
     0
  9
$DIMSD2
 70
     0
  9
$DIMTOLJ
 70
     1
  9
$DIMTZIN
 70
     0
  9
$DIMALTZ
 70
     0
  9
$DIMALTTZ
 70
     0
  9
$DIMUPT
 70
     0
  9
$DIMDEC
 70
     4
  9
$DIMTDEC
 70
     4
  9
$DIMALTU
 70
     2
  9
$DIMALTTD
 70
     2
  9
$DIMTXSTY
  7
Standard
  9
$DIMAUNIT
 70
     0
  9
$DIMADEC
 70
     0
  9
$DIMALTRND
 40
0.0
  9
$DIMAZIN
 70
     0
  9
$DIMDSEP
 70
    46
  9
$DIMATFIT
 70
     3
  9
$DIMFRAC
 70
     0
  9
$DIMLDRBLK
  1

  9
$DIMLUNIT
 70
     2
  9
$DIMLWD
 70
    -2
  9
$DIMLWE
 70
    -2
  9
$DIMTMOVE
 70
     0
  9
$DIMFXL
 40
1.0
  9
$DIMFXLON
 70
     0
  9
$DIMJOGANG
 40
0.7853981633974483
  9
$DIMTFILL
 70
     0
  9
$DIMTFILLCLR
 70
     0
  9
$DIMARCSYM
 70
     0
  9
$DIMLTYPE
  6

  9
$DIMLTEX1
  6

  9
$DIMLTEX2
  6

  9
$DIMTXTDIRECTION
 70
     0
  9
$LUNITS
 70
     2
  9
$LUPREC
 70
     4
  9
$SKETCHINC
 40
0.1
  9
$FILLETRAD
 40
0.0
  9
$AUNITS
 70
     0
  9
$AUPREC
 70
     0
  9
$MENU
  1
.
  9
$ELEVATION
 40
0.0
  9
$PELEVATION
 40
0.0
  9
$THICKNESS
 40
0.0
  9
$LIMCHECK
 70
     0
  9
$CHAMFERA
 40
0.0
  9
$CHAMFERB
 40
0.0
  9
$CHAMFERC
 40
0.0
  9
$CHAMFERD
 40
0.0
  9
$SKPOLY
 70
     0
  9
$TDCREATE
 40
2460560.605914352
  9
$TDUCREATE
 40
2460560.272581019
  9
$TDUPDATE
 40
2460560.629502315
  9
$TDUUPDATE
 40
2460560.296168982
  9
$TDINDWG
 40
0.0235879630
  9
$TDUSRTIMER
 40
0.0235879630
  9
$USRTIMER
 70
     1
  9
$ANGBASE
 50
0.0
  9
$ANGDIR
 70
     0
  9
$PDMODE
 70
     0
  9
$PDSIZE
 40
0.0
  9
$PLINEWID
 40
0.0
  9
$SPLFRAME
 70
     0
  9
$SPLINETYPE
 70
     6
  9
$SPLINESEGS
 70
     8
  9
$HANDSEED
  5
37C
  9
$SURFTAB1
 70
     6
  9
$SURFTAB2
 70
     6
  9
$SURFTYPE
 70
     6
  9
$SURFU
 70
     6
  9
$SURFV
 70
     6
  9
$UCSBASE
  2

  9
$UCSNAME
  2

  9
$UCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$UCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$UCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$UCSORTHOREF
  2

  9
$UCSORTHOVIEW
 70
     0
  9
$UCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSBASE
  2

  9
$PUCSNAME
  2

  9
$PUCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$PUCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$PUCSORTHOREF
  2

  9
$PUCSORTHOVIEW
 70
     0
  9
$PUCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$USERI1
 70
     0
  9
$USERI2
 70
     0
  9
$USERI3
 70
     0
  9
$USERI4
 70
     0
  9
$USERI5
 70
     0
  9
$USERR1
 40
0.0
  9
$USERR2
 40
0.0
  9
$USERR3
 40
0.0
  9
$USERR4
 40
0.0
  9
$USERR5
 40
0.0
  9
$WORLDVIEW
 70
     1
  9
$SHADEDGE
 70
     3
  9
$SHADEDIF
 70
    70
  9
$TILEMODE
 70
     1
  9
$MAXACTVP
 70
    64
  9
$PINSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMCHECK
 70
     0
  9
$PEXTMIN
 10
0.0
 20
0.0
 30
0.0
  9
$PEXTMAX
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMMIN
 10
0.0
 20
0.0
  9
$PLIMMAX
 10
12.0
 20
9.0
  9
$UNITMODE
 70
     0
  9
$VISRETAIN
 70
     1
  9
$PLINEGEN
 70
     0
  9
$PSLTSCALE
 70
     1
  9
$TREEDEPTH
 70
  3020
  9
$CMLSTYLE
  2
Standard
  9
$CMLJUST
 70
     0
  9
$CMLSCALE
 40
1.0
  9
$PROXYGRAPHICS
 70
     1
  9
$MEASUREMENT
 70
     0
  9
$CELWEIGHT
370
    -1
  9
$ENDCAPS
280
     0
  9
$JOINSTYLE
280
     0
  9
$LWDISPLAY
290
     0
  9
$INSUNITS
 70
     4
  9
$HYPERLINKBASE
  1

  9
$STYLESHEET
  1

  9
$XEDIT
290
     1
  9
$CEPSNTYPE
380
     0
  9
$PSTYLEMODE
290
     0
  9
$FINGERPRINTGUID
  2
{FA9A02B2-7E04-C34E-BD13-02980AC2B394}
  9
$VERSIONGUID
  2
{964EB223-33A2-D549-8684-CDE005EE773C}
  9
$EXTNAMES
290
     1
  9
$PSVPSCALE
 40
0.0
  9
$OLESTARTUP
290
     0
  9
$SORTENTS
280
   127
  9
$INDEXCTL
280
     0
  9
$HIDETEXT
280
     1
  9
$XCLIPFRAME
280
     2
  9
$HALOGAP
280
     0
  9
$OBSCOLOR
 70
   257
  9
$OBSLTYPE
280
     0
  9
$INTERSECTIONDISPLAY
280
     0
  9
$INTERSECTIONCOLOR
 70
   257
  9
$DIMASSOC
280
     2
  9
$PROJECTNAME
  1

  9
$CAMERADISPLAY
290
     0
  9
$LENSLENGTH
 40
50.0
  9
$CAMERAHEIGHT
 40
60.0
  9
$STEPSPERSEC
 40
2.0
  9
$STEPSIZE
 40
6.0
  9
$3DDWFPREC
 40
2.0
  9
$PSOLWIDTH
 40
0.25
  9
$PSOLHEIGHT
 40
4.0
  9
$LOFTANG1
 40
1.570796326794896
  9
$LOFTANG2
 40
1.570796326794896
  9
$LOFTMAG1
 40
0.0
  9
$LOFTMAG2
 40
0.0
  9
$LOFTPARAM
 70
     7
  9
$LOFTNORMALS
280
     1
  9
$LATITUDE
 40
37.795
  9
$LONGITUDE
 40
-122.394
  9
$NORTHDIRECTION
 40
0.0
  9
$TIMEZONE
 70
 -8000
  9
$LIGHTGLYPHDISPLAY
280
     1
  9
$TILEMODELIGHTSYNCH
280
     1
  9
$CMATERIAL
347
92
  9
$SOLIDHIST
280
     0
  9
$SHOWHIST
280
     1
  9
$DWFFRAME
280
     2
  9
$DGNFRAME
280
     0
  9
$REALWORLDSCALE
290
     1
  9
$INTERFERECOLOR
 62
     1
  9
$INTERFEREOBJVS
345
9F
  9
$INTERFEREVPVS
346
9C
  9
$CSHADOW
280
     0
  9
$SHADOWPLANELOCATION
 40
0.0
  0
ENDSEC
  0
SECTION
  2
CLASSES
  0
CLASS
  1
ACDBDICTIONARYWDFLT
  2
AcDbDictionaryWithDefault
  3
ObjectDBX Classes
 90
        0
 91
        1
280
     0
281
     0
  0
CLASS
  1
DICTIONARYVAR
  2
AcDbDictionaryVar
  3
ObjectDBX Classes
 90
        0
 91
       15
280
     0
281
     0
  0
CLASS
  1
MATERIAL
  2
AcDbMaterial
  3
ObjectDBX Classes
 90
     1153
 91
        3
280
     0
281
     0
  0
CLASS
  1
VISUALSTYLE
  2
AcDbVisualStyle
  3
ObjectDBX Classes
 90
     4095
 91
       24
280
     0
281
     0
  0
CLASS
  1
TABLESTYLE
  2
AcDbTableStyle
  3
ObjectDBX Classes
 90
     4095
 91
        1
280
     0
281
     0
  0
CLASS
  1
SCALE
  2
AcDbScale
  3
ObjectDBX Classes
 90
     1153
 91
       33
280
     0
281
     0
  0
CLASS
  1
MLEADERSTYLE
  2
AcDbMLeaderStyle
  3
ACDB_MLEADERSTYLE_CLASS
 90
     4095
 91
        2
280
     0
281
     0
  0
CLASS
  1
CELLSTYLEMAP
  2
AcDbCellStyleMap
  3
ObjectDBX Classes
 90
     1152
 91
        5
280
     0
281
     0
  0
CLASS
  1
EXACXREFPANELOBJECT
  2
ExAcXREFPanelObject
  3
EXAC_ESW
 90
     1025
 91
        0
280
     0
281
     0
  0
CLASS
  1
NPOCOLLECTION
  2
AcDbImpNonPersistentObjectsCollection
  3
ObjectDBX Classes
 90
     1153
 91
        0
280
     0
281
     0
  0
CLASS
  1
LAYER_INDEX
  2
AcDbLayerIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
SPATIAL_INDEX
  2
AcDbSpatialIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
IDBUFFER
  2
AcDbIdBuffer
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
ACDBSECTIONVIEWSTYLE
  2
AcDbSectionViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
CLASS
  1
ACDBDETAILVIEWSTYLE
  2
AcDbDetailViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
ENDSEC
  0
SECTION
  2
TABLES
  0
TABLE
  2
VPORT
  5
8
330
0
100
AcDbSymbolTable
 70
     1
  0
VPORT
  5
90
330
8
100
AcDbSymbolTableRecord
100
AcDbViewportTableRecord
  2
*Active
 70
     0
 10
0.0
 20
0.0
 11
1.0
 21
1.0
 12
97.5486911906951
 22
42.51345460271504
 13
0.0
 23
0.0
 14
0.5
 24
0.5
 15
0.5
 25
0.5
 16
0.0
 26
0.0
 36
1.0
 17
0.0
 27
0.0
 37
0.0
 40
78.45799938217576
 41
1.945409429280396
 42
50.0
 43
0.0
 44
0.0
 50
0.0
 51
0.0
 71
     0
 72
  1000
 73
     1
 74
     3
 75
     0
 76
     1
 77
     0
 78
     0
281
     0
 65
     1
110
0.0
120
0.0
130
0.0
111
1.0
121
0.0
131
0.0
112
0.0
122
1.0
132
0.0
 79
     0
146
0.0
348
9B
 60
     3
 61
     5
292
     1
282
     1
141
0.0
142
0.0
 63
   250
421
  3355443
1001
ACAD_NAV_VCDISPLAY
1070
     3
  0
ENDTAB
  0
TABLE
  2
LTYPE
  5
5
330
0
100
AcDbSymbolTable
 70
     1
  0
LTYPE
  5
14
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByBlock
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
15
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByLayer
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
16
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
Continuous
 70
     0
  3
Solid line
 72
    65
 73
     0
 40
0.0
  0
ENDTAB
  0
TABLE
  2
LAYER
  5
2
102
{ACAD_XDICTIONARY
360
18B
102
}
330
0
100
AcDbSymbolTable
 70
     1
  0
LAYER
  5
10
102
{ACAD_XDICTIONARY
360
E1
102
}
330
2
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
  2
0
 70
     0
 62
     7
  6
Continuous
370
    -3
390
F
347
94
  0
ENDTAB
  0
TABLE
  2
STYLE
  5
3
330
0
100
AcDbSymbolTable
 70
     2
  0
STYLE
  5
11
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Standard
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
ACAD
1000
Arial
1071
       34
  0
STYLE
  5
D7
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD
1000
Arial
1071
       34
  0
ENDTAB
  0
TABLE
  2
VIEW
  5
6
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
UCS
  5
7
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
APPID
  5
9
330
0
100
AcDbSymbolTable
 70
     7
  0
APPID
  5
12
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD
 70
     0
  0
APPID
  5
D8
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnoPO
 70
     0
  0
APPID
  5
D9
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnotative
 70
     0
  0
APPID
  5
DA
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMJAG
 70
     0
  0
APPID
  5
DB
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMTALN
 70
     0
  0
APPID
  5
102
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_MLEADERVER
 70
     0
  0
APPID
  5
1A3
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_NAV_VCDISPLAY
 70
     0
  0
ENDTAB
  0
TABLE
  2
DIMSTYLE
  5
A
330
0
100
AcDbSymbolTable
 70
     2
100
AcDbDimStyleTable
 71
     2
340
DC
340
27
  0
DIMSTYLE
105
27
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Standard
 70
     0
340
11
  0
DIMSTYLE
105
DC
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
340
11
1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD_DSTYLE_DIMJAG
1070
   388
1040
1.5
1001
ACAD_DSTYLE_DIMTALN
1070
   392
1070
     0
  0
ENDTAB
  0
TABLE
  2
BLOCK_RECORD
  5
1
330
0
100
AcDbSymbolTable
 70
     1
  0
BLOCK_RECORD
  5
1F
102
{ACAD_XDICTIONARY
360
15A
102
}
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Model_Space
340
22
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
73
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space
340
74
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
78
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space0
340
79
 70
     0
280
     1
281
     0
  0
ENDTAB
  0
ENDSEC
  0
SECTION
  2
BLOCKS
  0
BLOCK
  5
20
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockBegin
  2
*Model_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Model_Space
  1

  0
ENDBLK
  5
21
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
75
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space
  1

  0
ENDBLK
  5
76
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
7A
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space0
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space0
  1

  0
ENDBLK
  5
7B
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
ENDSEC
  0
SECTION
  2
ENTITIES
  0
ENDSEC
  0
SECTION
  2
OBJECTS
  0
DICTIONARY
  5
C
330
0
100
AcDbDictionary
281
     1
  3
ACAD_CIP_PREVIOUS_PRODUCT_INFO
350
1A2
  3
ACAD_COLOR
350
6C
  3
ACAD_DETAILVIEWSTYLE
350
1A8
  3
ACAD_GROUP
350
D
  3
ACAD_LAYOUT
350
1A
  3
ACAD_MATERIAL
350
6B
  3
ACAD_MLEADERSTYLE
350
D2
  3
ACAD_MLINESTYLE
350
17
  3
ACAD_PLOTSETTINGS
350
19
  3
ACAD_PLOTSTYLENAME
350
E
  3
ACAD_SCALELIST
350
B1
  3
ACAD_SECTIONVIEWSTYLE
350
1A5
  3
ACAD_TABLESTYLE
350
A6
  3
ACAD_VISUALSTYLE
350
95
  3
ACDB_RECOMPOSE_DATA
350
33F
  3
AcDbVariableDictionary
350
59
  3
AcDsDecomposeData
350
345
  0
DICTIONARY
  5
18B
330
2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_LAYERSTATES
360
18C
  0
DICTIONARY
  5
E1
330
10
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
15A
330
1F
100
AcDbDictionary
280
     1
281
     1
  0
XRECORD
  5
1A2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
300
ACD
300
2021
300

  0
DICTIONARY
  5
6C
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A8
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A9
  0
DICTIONARY
  5
D
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Model
350
22
  3
\u5E03\u5C401
350
74
  3
\u5E03\u5C402
350
79
  0
DICTIONARY
  5
6B
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
ByBlock
350
93
  3
ByLayer
350
92
  3
Global
350
94
  0
DICTIONARY
  5
D2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Annotative
350
E0
  3
Standard
350
D3
  0
DICTIONARY
  5
17
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
18
  0
DICTIONARY
  5
19
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
ACDBDICTIONARYWDFLT
  5
E
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Normal
350
F
100
AcDbDictionaryWithDefault
340
F
  0
DICTIONARY
  5
B1
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
A0
350
B2
  3
A1
350
124
  3
A2
350
125
  3
A3
350
126
  3
A4
350
127
  3
A5
350
128
  3
A6
350
129
  3
A7
350
12A
  3
A8
350
12B
  3
A9
350
12C
  3
B0
350
12D
  3
B1
350
12E
  3
B2
350
12F
  3
B3
350
130
  3
B4
350
131
  3
B5
350
132
  3
B6
350
133
  3
B7
350
134
  3
B8
350
135
  3
B9
350
136
  3
C0
350
137
  3
C1
350
138
  3
C2
350
139
  3
C3
350
13A
  3
C4
350
13B
  3
C5
350
13C
  3
C6
350
13D
  3
C7
350
13E
  3
C8
350
13F
  3
C9
350
140
  3
D0
350
141
  3
D1
350
142
  3
D2
350
143
  0
DICTIONARY
  5
1A5
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A7
  0
DICTIONARY
  5
A6
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
A7
  0
DICTIONARY
  5
95
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
2dWireframe
350
9B
  3
Basic
350
9A
  3
Brighten
350
A1
  3
ColorChange
350
A5
  3
Conceptual
350
9E
  3
Dim
350
A0
  3
EdgeColorOff
350
172
  3
Facepattern
350
A4
  3
Flat
350
96
  3
FlatWithEdges
350
97
  3
Gouraud
350
98
  3
GouraudWithEdges
350
99
  3
Hidden
350
9D
  3
JitterOff
350
170
  3
Linepattern
350
A3
  3
OverhangOff
350
171
  3
Realistic
350
9F
  3
Shaded
350
17F
  3
Shaded with edges
350
17E
  3
Shades of Gray
350
17B
  3
Sketchy
350
17C
  3
Thicken
350
A2
  3
Wireframe
350
9C
  3
X-Ray
350
17D
  0
XRECORD
  5
33F
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
 90
        1
330
A7
  0
DICTIONARY
  5
59
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
CAMERAHEIGHT
350
227
  3
CANNOSCALE
350
EB
  3
CMLEADERSTYLE
350
EA
  3
CTABLESTYLE
350
AB
  3
CVIEWDETAILSTYLE
350
1B4
  3
CVIEWSECTIONSTYLE
350
1B5
  3
DIMASSOC
350
5A
  3
HIDETEXT
350
5E
  3
INDEXCTL
350
226
  3
LAYEREVAL
350
14A
  3
LAYERNOTIFY
350
14B
  3
LIGHTINGUNITS
350
224
  3
MSLTSCALE
350
223
  3
SORTENTS
350
225
  3
XCLIPFRAME
350
228
  0
DICTIONARY
  5
345
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
AcDsRecords
350
347
  3
AcDsSchemas
350
346
1001
ACAD
1070
     2
  0
DICTIONARY
  5
18C
102
{ACAD_REACTORS
330
18B
102
}
330
18B
100
AcDbDictionary
281
     1
  0
ACDBDETAILVIEWSTYLE
  5
1A9
102
{ACAD_XDICTIONARY
360
37A
102
}
102
{ACAD_REACTORS
330
1A8
102
}
330
1A8
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbDetailViewStyle
 70
     0
 71
     0
 90
        3
 71
     1
340
11
 62
   256
 40
0.24
340
0
 62
   256
 40
0.24
300

 40
0.36
280
     3
 71
     2
340
16
 90
       25
 62
   256
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewDetailId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
340
16
 90
       25
 62
   256
340
16
 90
       25
 62
   256
280
     0
  0
LAYOUT
  5
22
102
{ACAD_XDICTIONARY
360
191
102
}
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
none_device
  4
Letter_(8.50_x_11.00_Inches)
  6

 40
6.349999904632568
 41
6.349999904632568
 42
6.350006103515625
 43
6.350006103515625
 44
215.8999938964844
 45
279.3999938964844
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
3.560208697428376
 70
 11952
 72
     0
 73
     1
 74
     0
  7

 75
     0
147
0.28088241027059
 76
     0
 77
     2
 78
   300
148
0.1311165230791651
149
0.096403374003771
100
AcDbLayout
  1
Model
 70
     1
 71
     0
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
1F
331
90
  0
LAYOUT
  5
74
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C401
 70
     1
 71
     1
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
73
  0
LAYOUT
  5
79
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C402
 70
     1
 71
     2
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
78
  0
MATERIAL
  5
93
102
{ACAD_XDICTIONARY
360
185
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByBlock
 94
       63
  0
MATERIAL
  5
92
102
{ACAD_XDICTIONARY
360
183
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByLayer
 94
       63
  0
MATERIAL
  5
94
102
{ACAD_XDICTIONARY
360
10B
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
Global
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
 94
       63
1001
ACAD
1070
    -1
1070
     3
1070
     0
1000

1071
        0
1070
     0
  0
MLEADERSTYLE
  5
E0
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
179
     2
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     1
143
0.125
271
     0
272
     9
273
     9
  0
MLEADERSTYLE
  5
D3
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
179
     2
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     0
143
0.125
271
     0
272
     9
273
     9
  0
MLINESTYLE
  5
18
102
{ACAD_REACTORS
330
17
102
}
330
17
100
AcDbMlineStyle
  2
STANDARD
 70
     0
  3

 62
   256
 51
90.0
 52
90.0
 71
     2
 49
0.5
 62
   256
  6
BYLAYER
 49
-0.5
 62
   256
  6
BYLAYER
  0
ACDBPLACEHOLDER
  5
F
102
{ACAD_REACTORS
330
E
102
}
330
E
  0
SCALE
  5
B2
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:1
140
1.0
141
1.0
290
     1
  0
SCALE
  5
124
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:2
140
1.0
141
2.0
290
     0
  0
SCALE
  5
125
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:4
140
1.0
141
4.0
290
     0
  0
SCALE
  5
126
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:5
140
1.0
141
5.0
290
     0
  0
SCALE
  5
127
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:8
140
1.0
141
8.0
290
     0
  0
SCALE
  5
128
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:10
140
1.0
141
10.0
290
     0
  0
SCALE
  5
129
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:16
140
1.0
141
16.0
290
     0
  0
SCALE
  5
12A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:20
140
1.0
141
20.0
290
     0
  0
SCALE
  5
12B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:30
140
1.0
141
30.0
290
     0
  0
SCALE
  5
12C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:40
140
1.0
141
40.0
290
     0
  0
SCALE
  5
12D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:50
140
1.0
141
50.0
290
     0
  0
SCALE
  5
12E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:100
140
1.0
141
100.0
290
     0
  0
SCALE
  5
12F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
2:1
140
2.0
141
1.0
290
     0
  0
SCALE
  5
130
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
4:1
140
4.0
141
1.0
290
     0
  0
SCALE
  5
131
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
8:1
140
8.0
141
1.0
290
     0
  0
SCALE
  5
132
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
10:1
140
10.0
141
1.0
290
     0
  0
SCALE
  5
133
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
100:1
140
100.0
141
1.0
290
     0
  0
SCALE
  5
134
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/128" = 1'-0"
140
0.0078125
141
12.0
290
     0
  0
SCALE
  5
135
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/64" = 1'-0"
140
0.015625
141
12.0
290
     0
  0
SCALE
  5
136
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/32" = 1'-0"
140
0.03125
141
12.0
290
     0
  0
SCALE
  5
137
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/16" = 1'-0"
140
0.0625
141
12.0
290
     0
  0
SCALE
  5
138
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/32" = 1'-0"
140
0.09375
141
12.0
290
     0
  0
SCALE
  5
139
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/8" = 1'-0"
140
0.125
141
12.0
290
     0
  0
SCALE
  5
13A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/16" = 1'-0"
140
0.1875
141
12.0
290
     0
  0
SCALE
  5
13B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/4" = 1'-0"
140
0.25
141
12.0
290
     0
  0
SCALE
  5
13C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/8" = 1'-0"
140
0.375
141
12.0
290
     0
  0
SCALE
  5
13D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/2" = 1'-0"
140
0.5
141
12.0
290
     0
  0
SCALE
  5
13E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/4" = 1'-0"
140
0.75
141
12.0
290
     0
  0
SCALE
  5
13F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1" = 1'-0"
140
1.0
141
12.0
290
     0
  0
SCALE
  5
140
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1-1/2" = 1'-0"
140
1.5
141
12.0
290
     0
  0
SCALE
  5
141
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3" = 1'-0"
140
3.0
141
12.0
290
     0
  0
SCALE
  5
142
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
6" = 1'-0"
140
6.0
141
12.0
290
     0
  0
SCALE
  5
143
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1'-0" = 1'-0"
140
12.0
141
12.0
290
     0
  0
ACDBSECTIONVIEWSTYLE
  5
1A7
102
{ACAD_XDICTIONARY
360
378
102
}
102
{ACAD_REACTORS
330
1A5
102
}
330
1A5
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbSectionViewStyle
 70
     0
 71
     0
 90
       78
 71
     1
340
11
 62
   256
 40
0.24
340
0
340
0
 62
   256
 40
0.24
300
I, O, Q, S, X, Z
 40
0.48
 90
        3
 40
0.18
 90
        1
 71
     2
340
16
 90
       25
 62
   256
340
16
 90
       50
 62
   256
 40
0.24
 40
0.0
 40
0.24
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewSectionStartId>%-%<\\AcVar ViewSectionEndId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
 62
   256
 62
   257
300
ANSI31
 40
1.0
 90
        0
290
     0
290
     0
 90
        6
 40
0.0
 40
1.570796326794896
 40
0.2617993877991494
 40
1.308996938995747
 40
-0.2617993877991494
 40
1.832595714594046
  0
TABLESTYLE
  5
A7
102
{ACAD_XDICTIONARY
360
FF
102
}
102
{ACAD_REACTORS
330
A6
102
}
330
A6
100
AcDbTableStyle
280
     0
  3
Standard
 70
     0
 71
     0
 40
0.06
 41
0.06
280
     0
281
     0
  7
Standard
140
0.18
170
     2
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.25
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.18
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  0
VISUALSTYLE
  5
9B
102
{ACAD_XDICTIONARY
360
352
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
2dWireframe
 70
     4
177
     2
291
     0
 71
     0
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        0
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9A
102
{ACAD_XDICTIONARY
360
350
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Basic
 70
     7
177
     2
291
     1
 71
     1
176
     1
 72
     0
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     0
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A1
102
{ACAD_XDICTIONARY
360
35E
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Brighten
 70
    12
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
50.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A5
102
{ACAD_XDICTIONARY
360
366
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
ColorChange
 70
    16
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     3
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     8
421
  8421504
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     8
424
  8421504
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9E
102
{ACAD_XDICTIONARY
360
358
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Conceptual
 70
     9
177
     2
291
     0
 71
     3
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     2
176
     1
 91
        2
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
40.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A0
102
{ACAD_XDICTIONARY
360
35C
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Dim
 70
    11
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
-50.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
172
102
{ACAD_XDICTIONARY
360
36C
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
EdgeColorOff
 70
    22
177
     2
291
     1
 71
     2
176
     0
 72
     2
176
     0
 73
     0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 41
30.0
176
     0
 63
     7
421
 16777215
176
     0
 74
     1
176
     0
 91
        4
176
     0
 64
     7
176
     0
 65
   257
176
     0
 75
     1
176
     0
175
     1
176
     0
 42
1.0
176
     0
 92
        8
176
     2
 66
     7
176
     0
 43
1.0
176
     0
 76
     1
176
     0
 77
     6
176
     0
 78
     2
176
     0
 67
     7
176
     0
 79
     5
176
     0
170
     0
176
     0
171
     0
176
     0
290
     0
176
     0
 93
        1
176
     0
 44
0.0
176
     0
173
     0
176
     0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A4
102
{ACAD_XDICTIONARY
360
364
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Facepattern
 70
    15
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
96
102
{ACAD_XDICTIONARY
360
348
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Flat
 70
     0
177
     2
291
     1
 71
     2
176
     1
 72
     1
176
     1
 73
     1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     0
176
     1
 91
        0
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
       13
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
97
102
{ACAD_XDICTIONARY
360
34A
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
FlatWithEdges
 70
     1
177
     2
291
     1
 71
     2
176
     1
 72
     1
176
     1
 73
     1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        0
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        0
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
       13
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
98
102
{ACAD_XDICTIONARY
360
34C
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Gouraud
 70
     2
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     0
176
     1
 91
        0
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        0
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
       13
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
99
102
{ACAD_XDICTIONARY
360
34E
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
GouraudWithEdges
 70
     3
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        0
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        0
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
       13
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9D
102
{ACAD_XDICTIONARY
360
356
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Hidden
 70
     6
177
     2
291
     0
 71
     1
176
     1
 72
     2
176
     1
 73
     2
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     2
176
     1
 91
        2
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     2
176
     1
175
     1
176
     1
 42
40.0
176
     1
 92
        0
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
170
102
{ACAD_XDICTIONARY
360
368
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
JitterOff
 70
    20
177
     2
291
     1
 71
     2
176
     0
 72
     2
176
     0
 73
     0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 41
30.0
176
     0
 63
     7
421
 16777215
176
     0
 74
     1
176
     0
 91
        4
176
     0
 64
     7
176
     0
 65
   257
176
     0
 75
     1
176
     0
175
     1
176
     0
 42
1.0
176
     0
 92
       10
176
     2
 66
     7
176
     0
 43
1.0
176
     0
 76
     1
176
     0
 77
     6
176
     0
 78
     2
176
     0
 67
     7
176
     0
 79
     5
176
     0
170
     0
176
     0
171
     0
176
     0
290
     0
176
     0
 93
        1
176
     0
 44
0.0
176
     0
173
     0
176
     0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A3
102
{ACAD_XDICTIONARY
360
362
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Linepattern
 70
    14
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     7
176
     1
175
     7
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
171
102
{ACAD_XDICTIONARY
360
36A
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
OverhangOff
 70
    21
177
     2
291
     1
 71
     2
176
     0
 72
     2
176
     0
 73
     0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 41
30.0
176
     0
 63
     7
421
 16777215
176
     0
 74
     1
176
     0
 91
        4
176
     0
 64
     7
176
     0
 65
   257
176
     0
 75
     1
176
     0
175
     1
176
     0
 42
1.0
176
     0
 92
        9
176
     2
 66
     7
176
     0
 43
1.0
176
     0
 76
     1
176
     0
 77
     6
176
     0
 78
     2
176
     0
 67
     7
176
     0
 79
     5
176
     0
170
     0
176
     0
171
     0
176
     0
290
     0
176
     0
 93
        1
176
     0
 44
0.0
176
     0
173
     0
176
     0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9F
102
{ACAD_XDICTIONARY
360
35A
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Realistic
 70
     8
177
     2
291
     0
 71
     2
176
     1
 72
     3
176
     1
 73
     0
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     0
176
     1
 91
        0
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
       13
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17F
102
{ACAD_XDICTIONARY
360
376
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded
 70
    27
177
     2
291
     0
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     0
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     8
425
  7895160
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        5
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17E
102
{ACAD_XDICTIONARY
360
374
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded with edges
 70
    26
177
     2
291
     0
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        2
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     2
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        5
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17B
102
{ACAD_XDICTIONARY
360
36E
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shades of Gray
 70
    23
177
     2
291
     0
 71
     2
176
     1
 72
     2
176
     1
 73
     3
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     2
176
     1
 91
        2
176
     1
 64
     7
176
     1
 65
     7
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
40.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17C
102
{ACAD_XDICTIONARY
360
370
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Sketchy
 70
    24
177
     2
291
     0
 71
     1
176
     1
 72
     2
176
     1
 73
     2
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     2
176
     1
 91
        2
176
     1
 64
     7
176
     1
 65
     7
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
40.0
176
     1
 92
       11
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     6
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A2
102
{ACAD_XDICTIONARY
360
360
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Thicken
 70
    13
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
       12
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9C
102
{ACAD_XDICTIONARY
360
354
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Wireframe
 70
     5
177
     2
291
     0
 71
     0
176
     1
 72
     2
176
     1
 73
     0
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        0
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17D
102
{ACAD_XDICTIONARY
360
372
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
X-Ray
 70
    25
177
     2
291
     0
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        1
176
     1
 40
0.5
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        0
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
       13
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
DICTIONARYVAR
  5
227
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
60.000000
  0
DICTIONARYVAR
  5
EB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1:1
  0
DICTIONARYVAR
  5
EA
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
AB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
1B4
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
1B5
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
5A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
5E
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
226
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14B
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
224
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
223
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
225
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
127
  0
DICTIONARYVAR
  5
228
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARY
  5
347
102
{ACAD_REACTORS
330
345
102
}
330
345
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
346
102
{ACAD_REACTORS
330
345
102
}
330
345
100
AcDbDictionary
281
     1
  3
1654967914112
350
340
  3
1654967914128
350
341
  3
1654967914144
350
342
  3
1654967914160
350
343
  3
1654967914176
350
344
  0
DICTIONARY
  5
37A
330
1A9
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
37B
  0
DICTIONARY
  5
191
330
22
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
185
330
93
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
186
  0
DICTIONARY
  5
183
330
92
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
184
  0
DICTIONARY
  5
10B
330
94
100
AcDbDictionary
280
     1
281
     1
  3
BUMPTILE
360
10D
  3
DIFFUSETILE
360
10C
  3
FBXASSET
360
187
  3
OPACITYTILE
360
10E
  3
REFLECTIONTILE
360
10F
  0
DICTIONARY
  5
378
330
1A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
379
  0
DICTIONARY
  5
FF
330
A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_ROUNDTRIP_2008_TABLESTYLE_CELLSTYLEMAP
360
33E
  0
DICTIONARY
  5
352
330
9B
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
353
  0
DICTIONARY
  5
350
330
9A
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
351
  0
DICTIONARY
  5
35E
330
A1
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
35F
  0
DICTIONARY
  5
366
330
A5
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
367
  0
DICTIONARY
  5
358
330
9E
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
359
  0
DICTIONARY
  5
35C
330
A0
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
35D
  0
DICTIONARY
  5
36C
330
172
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
36D
  0
DICTIONARY
  5
364
330
A4
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
365
  0
DICTIONARY
  5
348
330
96
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
349
  0
DICTIONARY
  5
34A
330
97
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
34B
  0
DICTIONARY
  5
34C
330
98
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
34D
  0
DICTIONARY
  5
34E
330
99
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
34F
  0
DICTIONARY
  5
356
330
9D
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
357
  0
DICTIONARY
  5
368
330
170
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
369
  0
DICTIONARY
  5
362
330
A3
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
363
  0
DICTIONARY
  5
36A
330
171
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
36B
  0
DICTIONARY
  5
35A
330
9F
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
35B
  0
DICTIONARY
  5
376
330
17F
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
377
  0
DICTIONARY
  5
374
330
17E
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
375
  0
DICTIONARY
  5
36E
330
17B
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
36F
  0
DICTIONARY
  5
370
330
17C
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
371
  0
DICTIONARY
  5
360
330
A2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
361
  0
DICTIONARY
  5
354
330
9C
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
355
  0
DICTIONARY
  5
372
330
17D
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
373
  0
XRECORD
  5
340
102
{ACAD_REACTORS
330
346
102
}
330
346
100
AcDbXrecord
280
     1
  1
AcDb_Thumbnail_Schema
102
{ATTRRECORD
341
341
  2
AcDbDs::TreatedAsObjectData
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
342
  2
AcDbDs::Legacy
280
     1
291
     1
102
ATTRRECORD}
  2
AcDbDs::ID
280
    10
 91
        8
102
{ATTRRECORD
341
343
  2
AcDs:Indexable
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
344
  2
AcDbDs::HandleAttribute
280
     7
282
     1
102
ATTRRECORD}
  2
Thumbnail_Data
280
    15
 91
        0
  0
XRECORD
  5
341
102
{ACAD_REACTORS
330
346
102
}
330
346
100
AcDbXrecord
280
     1
  1
AcDbDs::TreatedAsObjectDataSchema
  2
AcDbDs::TreatedAsObjectData
280
     1
 91
        0
  0
XRECORD
  5
342
102
{ACAD_REACTORS
330
346
102
}
330
346
100
AcDbXrecord
280
     1
  1
AcDbDs::LegacySchema
  2
AcDbDs::Legacy
280
     1
 91
        0
  0
XRECORD
  5
343
102
{ACAD_REACTORS
330
346
102
}
330
346
100
AcDbXrecord
280
     1
  1
AcDbDs::IndexedPropertySchema
  2
AcDs:Indexable
280
     1
 91
        0
  0
XRECORD
  5
344
102
{ACAD_REACTORS
330
346
102
}
330
346
100
AcDbXrecord
280
     1
  1
AcDbDs::HandleAttributeSchema
  2
AcDbDs::HandleAttribute
280
     7
 91
        1
284
     1
  0
XRECORD
  5
37B
102
{ACAD_REACTORS
330
37A
102
}
330
37A
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
XRECORD
  5
186
102
{ACAD_REACTORS
330
185
102
}
330
185
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
7581DE8E-A623-425F-9BF4-B3F4BE6C4F9A
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623B9A2F3B5FEC0000007C01000008000000636F72652E786D6C8D90416E83301045AF62CDB632D8040820E328B4E204BD80653BC44AB011B6AB1EBF262152BBEB6A467FFE9B197D76FA9EEFE84BAFDE38DB03CD08206DA553C64E3DC470C10DA01367AB73E1970D9015B3EE61
310
9381B3697571D925E96CD03624D53AA5775178AF0320794F4D0F5E5EF52C32114372F85BB608791393CEE8AB4B708C46A1E711A3D23E73317A055E0D4D53D6C71A9FC7A1C6657D18703354232ECFED4731B6B43CBED72CDF60CE82995FF7E5AA45D00A7841488B29C5A4F8A46547AAAEA8DE48D311C2F2CDFE078A8BFA2714
310
8D0D87627FF78979E0343DF21870966F59A4F2082AD52D37FE03504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623B6E137E0172010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C0810121947A1554ED00B38E05014B091B1518EDFE511A5A9D22AFD2A1F60CDEC7A67C698ED2E6D8306
310
69FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7166B4B65FCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B0FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2601EE7691A25EBC4DB1FF2C48B9255EEA5797C
310
F0A2FDE62D3C6C8268FD9A3032367366EBF6AAAE30525859621E52BAF182C0A3E17B106D69BC0DE3179A6E2965642CBF6B725DF96493AB955D858BDCB9ADC73C002113F1CD2D4464512F06D04338236388F09912BE0F1A028190AD3836571F67800659586D22604AED6ED4201A27612AF5E9F4A09F178CCC9D3075DA1C5C3F
310
9C113E3DE3F71DE1A885AAC084B0B03C3A3BEA64B38625B44E1A6FB017A4B46945F39C8D5F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F02504B0304140006080800AC70623BE001BAC07D0000009D0000000B0000006662782F636E782E786D6C4DCCD10AC2201886E15B91FFDCA6536B037548D87D8CE686
310
E4344CA3CB6F8B1D74F4C1C3C72B87CF1AD0DBE5974F51013D11402EDED3E4E3A2A096197780062D734AE5EF06288EAB53B03368B9E4549F074D6E1E6B289B061F1F07124689687987B9601C7373BD60C36E065B6A6DDF7341A93843A365F32B6DBB87F517504B0304140006080800AC70623B8E5068122901000012020000
310
310000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C8D515B6EC32010BC0AE22B55850D364E93081345557A825E801892A2C460F1A872FC2EB523B57FF961D1EECCECECAED8DFC71BFA36215AEF7ACC2A8A917183D7D65D7A9CD3996C30DA4B
310
11BC4F7F601839359A1E973496E2127C9E96D4E05D322E41D6796D96A48AD1248C861B7C7A1C872F33AA4AE5048878AD26355CD5C554AC8232E0A4882980013437292F96B465B46BF886F0AEE5841FDEDFC8A1FD3890233B1EB75BDE31D6AD453D13A5C8D9EA856E35D8B1676BC2B322852C45B2E3C3FE108C4A4663D950BA
310
258C11DA7C32BEA3DDAEE95EE96647A9A80BFC1F294FFA4952B62EB5CD6277A6452C99A8E78214DAE7D3ED61C6DC271F122AFD56D10C2F305545CB6A60FC1908E383E29A2F8A31F900EB5D5D4F8065DD2CBBE652D4E542107ECF07B15C53FE00504B0304140006080800AC70623B503B51794E010000330300003000000066
310
62782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F
310
77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347
310
DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F
310
504B0304140006080800AC70623B38FA165F680500003C100000340000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F6F626A656374732E786D6CAD575D6FA33814FD2B887D0E8424EDB42BCAA8499A2A1A756634D18CF6A15264C0A16CC146B6E9A4FBEBF7180C
310
019276B21F7908D8D8F7F3DCE36BFFE33ECFAC172A64CAD98DED3963DBA22CE271CA921BBB54BBD1956D7D0C7CC1B9EA2CB32D46727A63EB693BF013C1CBC24CC57447CA4C0D6657F33F2C1951466D2BCA889437B68C9E684E1C522A1E53F9ECC4441127D9ED1DCFA917F6C52682144F03A105119429588A790629566D94D7
310
1F8E6D37F05DFD3DF0F5BF59357D7B955BF9D3D79F32A9088B8E940DC44CBDD9F26E72713DBA98CDA6A3D9E5C41BCD57F3E5C8FB301D2F2E178BEBDBBB6B28964A4092B144D09D1DDC2336228D7CB7FED45A6C0C3F6552C419A351E53F3CAC6C3612635A5016238F2995D0D6F17ADC1F7A3A369DCF533D362ABBD3E779D5DD
310
D111D4D8DE3CBB96F2F04FB820CF41859054A3AA8E8F71B4C6DFF810B590F3CC7C4BA5951345454A322B4B4341C4AB1D60A95E12F83D311A9D42235C7B6007DE415ED75694C6AFB17BCACA5D99651A9A7650217B0BFC53252BCBD2BFA838AD0D36215765CAD4957148BD16D40EAE7DB79A0C7CFD984ECCC73A90D62E230952
310
0E37EBAF034717BAF6D64B3BF8B40AF71B5D8FA79517821754280D1F40AB495CF3D451326ABDB332A737C0995ECC0F41F986C87F46F91E4C41DE44BA9FED67468B1284C91D173972E38CAB9F356E5E46EDDBF10BF86CB0FA784D3BF3AF16FB6E6B6C9F30DECA1FC0A55373F5DFF3D78F5917A99DF405FE0B0A8C8BA909E526
310
2219A8E72165488806A595714C81CB77E1DE0ED6604A303B76912C680372F4E2BB2FF88EFF5A36D8AA52DF79322474C0B767303F625995056C7B032C473C592936CEBD15F38BFFA5666E979B4F9B52EC48441F0CB12CE92E65A9C2D979006FD7A05E227A1E3DD3D79F5CC470F438099B6E1272A34A22DA3AE63AF0497358E8
310
C141734F41847D09D79CE7FF42C3432A239A6584515E365ADA634863B52519D327A00AEB804E2703140BFA92EA4EA2B7A26716CEFA48A4850E597BE8B53CEDBCE1CBF7F56780D20EE6AF73A0F5F9B02A3CD07DC4332EB6E1EBB666421BE0C39E3EBA7FF4E16D22EA6A29407C85E586724C88B771BADB9512BC7B228A3FD68B
310
6EA65A22397E690AA8D158D7E40CEC8CDA23C2C0B7D1898640101CEC9C6D531CE328CB93CABBBA870A6425F70DF96199175B92F392A973C2346EFC69AC6F8577BB18F993A8E8C90E36D573340765C7343EA4AA87027D049DF0A9979E0F1757DEF2EEEA6E747B39412B35B9588DAEE7ABD9683E5DCDE677978BD9EAFAB6B5A8
310
B224F09B13AA5B8388264E44BF14A909F3F7F5A16CEDE08128E9DED705E526F5F3FBDA415BECBBD80380B71BD77991D19C3245347C1FF44BF68DA0ABE8C9A8E7D73949E81952BEDC6F063660E68C7D5F75A9D19F83BD6676A16BE1A410F554E621236936D8681C770A9618B79B50B6CF9AD19BA11E9978A20F953C4B63104E
310
6C2594E7548176CE607B915309C474BBF2D8DC1ECED8FD52F7838A84196D2C79226889330954036E65A4FAF3D66F68E174177563E3B0739EF1670AD1B690EA1B1BFCA6D2884A27C4F1A81B9F4A3820802EAC2541408DB02443675D6F6AC7ED2E1D1BD00F4E40A3BF5D724EB764FCEA116F4E8A02A7768F562BDB8C82E81F39
310
DE98631185D7B054AD2F8789D6994A0D2AAB76CADC0DD0423C1BD57BD4D7FB6E794EB5A61791B3EE49EF82A0963A524424D5BD40DB674CBA5D7E75D10A58EB2F569195097279BEA491A00073A90B1C28022A8CCC82284075F1FBE357C17117CDAD550A083C2E789E736606B7E62E6B6D9E70338D1F410B545F3FE464EC798F
310
55D76F2E22DB9048EA90583E63A22938EDC1006B00E4D1716A52E0EA1C0C96AF9796393066105A81F6A829ADAFE1168A47DF1C75A974C9B278B7F177ABA5008340CB1EFC0D504B0304140006080000AC70623B000000000000000000000000350000006662782F30333130353234382D343533342D344143372D413346412D
310
4531454539393435313135362F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E636660600000504B0304140006080000AC70
310
623B000000000000000000000000370000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30333130353234382D343533342D344143372D41
310
3346412D4531454539393435313135362F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11D
310
E607FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BF2C5666EFF000000A00100003B0000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F7265736F7572636573
310
2F636F72652E786D6C8D504B6E833010BD0A9A6D65B00910888CA3D02A27E8052C33A156821DF953F5F8B5132AB5BB6E6646EFA3797AFCF8B5DE8A4F745E5B33022B291468949DB5594688E1427A288E823B6BC32F191446AE38428641F0C5D978DF20654D4013126AEC8C1B28BDC70085BAA56304AF3E7095A58C2129FCB5
310
BC4B75950B96AC4C74D209EE834B018AE7933C4138F4363A859E574F56F018F5BC69F49C7EEA8B4607A29DFABEE9F62D399DA78E34DD6E22FDD49E49731ADEEAF3C09AFD6BC7AB6C163CE8F527A3722803CE206A4A07C218A1F53B6B0EB43DD4ED0BED0F94F22ACBFF98E27DFEA7296A1376F516F769F320580AF22004AF72
310
5F693DCA4C3B772BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B200
310
00005B436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623B9A2F3B5FEC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D
310
6C504B01021400140006080800AC70623B6E137E0172010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623BE001BAC07D0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B010214001400060808
310
00AC70623B8E506812290100001202000031000000000000000000000000005B0500006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D3
310
0600006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6C504B01021400140006080800AC70623B38FA165F680500003C10000034000000000000000000000000006F0800006662782F30333130353234382D343533342D344143372D413346412D4531
310
454539393435313135362F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000290E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F76657274696365732E62696E504B01021400
310
140006080800AC70623BF270F133060000000400000036000000000000000000000000007C0E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000
310
000000000000000000D60E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD1900000004101000036000000000000000000000000002B0F00006662782F30333130353234382D
310
343533342D344143372D413346412D4531454539393435313135362F6469726563746F72792E786D6C504B01021400140006080800AC70623BF2C5666EFF000000A00100003B000000000000000000000000000F1000006662782F30333130353234382D343533342D344143372D413346412D453145453939343531313536
310
2F7265736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000671100000000
  0
XRECORD
  5
184
102
{ACAD_REACTORS
330
183
102
}
330
183
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
778E3A9F-1AF3-452F-85C1-1BC15BD3F630
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BFD5588D4EC0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103891DC7C24471939CA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EF81EEFE8CBCCC17AD7012D0820E394D7D60D1DA478C50DA083E0B3F7F1970D9093A3E960
310
9141F061F6695A25E55D342E66D5796D56518660222075CF4D07417D9A511632C5EC08B76292EA260753D05797E194AC46CF2356E77DF66ACD0C62C768BD63971E5727D2E06DDF9C71BF7B3FE10BABF79BFA488FE4DCF07281058F767CDD57B391D168108C903DA61413F641B72DA95A56BD91A62584978BFD0F9426FD4F28
310
5917376C7DF7890510343FF218085E2E59E4F2082AD72537F103504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB5D38BAD72010000D40300000C0000006662782F636F72652E786D6CC553DB8E823014FC95A6AF1B68C11B9A52A3AB7EC1FE4085CA36424B4A4BFCFC3D5C8CEBC635EED3F200CDCC393D3353CAD697AA44AD
310
B48D323AC5514831923A33B9D2458ABD3B0509466BCEAC31EE5B19465A5432C51D8C392BACF1F50865463BA91DA0DAE4720445D348875156C222C54DF6292B110AEFA0A23987B5C8CEA2906114020D759C35CE8200340CE9DE989F8E1746069C33EF553EB22A8769EAA4A4C57C1147F3457CD806B31D4D82E936D907DBC5FB
310
2E38C4F3E564BE8936749F30D23573E65475559759299CCC318F295D065114D0F8239AAEE86C15CFDE68B2A29491AEFCAEC9D7F98B4D5E69378947B9435B837904427AE2875B88C8A146B4A0877046BA10E1D3277C1F340402213B712CAF3ECE00B53273C64E81C98DBF51AD28BD84A934A4FD837E5F303274C2D47E7370FD
310
7046FCF28CE73BC2510B5D8009E16079F4AED3C9060D6368B5B441EB2E481B5B89F2351B4F1CFE89BA897F282933A5B1FFA5888C0744C6DF8374F7917F01504B0304140006080800AC70623B09885E1C7E0000009D0000000B0000006662782F636E782E786D6C4DCCDF0A83201C86E15B91DFB9CBA6FD11D41063F711CB42
310
663A9C8E5DFE6A74B0A30F1E3E5E317C368FDE36BD5C0C12EA0B0164C33DCE2EAC124A5E700F685022C598FF6E80C2B459090783126B8AE579D26C97A9F8BCAB77E17122E586D5843498B3EE8699D114F39E5E713D76EDA84DCBB569A052A2FA95F63DC2EA0B504B0304140006080800AC70623B961D28872A010000120200
310
00310000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C8D515B6EC32010BC8AC557AA0A1BFC4A1C61A2C8514FD00B10435294182C1E558EDFA576A4F62F3F80666766875D76784CF7EC5B39AFADE911CD09CA9419ADD4E6DAA3182E7887B203
310
67CEDAF08786322326D5A30423CEAECEC67985466B8232015063A55A41E1BD0A281BEFF0E8911FBFD42472110330FC2D9FC578135795D31CCAC0E3CC070701B2A5493A11AFBAA1A68434B8ABB71FB81E8E15EE765589E969DB9E8E43DB1D8786158B90B318B55CE55A421C7DD1CABD6A92C49C053D3DE38F4E89A024E22521
310
1DA61493F293D67BD2ECCBE69DECF684B022D1FF89E22C5F14456D4255AE711799479CB2622970266D3CDF9F61D463B62E64A9DFC6ABF10D7192C35CCA0A040B11BE0F8E6DBD3AFA601D8C77733B0397C290926D5B7356A40DC1F5BB3EB8D336F90F504B0304140006080800AC70623B503B51794E01000033030000300000
310
006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1E
310
BC4F77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C54
310
2347DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F
310
103F504B0304140006080800AC70623B2EA4D28F640500003C100000340000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F6F626A656374732E786D6CAD575D739B3814FD2B0CFB6C30B1D3263B844E6CC71D4F376DA79E76F621331E01326103122389C4E9AFDF
310
231018B09D7A3FFC609090EEE7B94757FE875D9E59CF54C894B31BDB73C6B64559C4E394253776A9B6A32BDBFA10F88273D559665B8CE4F4C6D6D376E027829785998AE99694991ACC2E677F5A32A28CDA569411296F6C193DD29C38A4543CA6F2C98989224EB2DD399E532FEC8B4D04291E07420B222853B014F30C52ACDA
310
28AF3F1CDB6EE0BBFA7BE0EB7FB36A727A955BF9D3D79F32A9088B0E940DC44CBCE9E2EEE2F27A74399D4E46D37717DE68B69C2D46DEFBC978FE6E3EBFBEBDBB8662A90424194B04DDDAC147C446A491EFD69F5A8B8DE1C74C8A386334AAFC878795CD46624C0BCA62E431A512DA3A5E8FFB434FC7A6F379A2C7466577FA3C
310
AFBA3B3A821ADB9B67D7521EFE0517E439A810926A54D5F1318ED6F81BEFA316729E996FA9B472A2A84849666569288878B5032CD54B02BF2746A35368846B0FECC0DBCBEBDA8AD2F835768F59B92DB34C43D30E2A646F807FAA646559FA938AE3DA60137255A64C5D1987D46B41EDE0DA77ABC9C0D78FC985F95807D2DA66
310
2441CAE166FD75E0E85CD7DE6A61079F96E16EADEBF1B8F242F0820AA5E1036835896B9E3A4A46AD7756E6F40638D38BF93E28DF10F9CF28DFBD29C89B4877D3DDD468518230B9E522476E9C71F5B3C6CDCBA87D3B7C019F0D561FAE6967FED562DF6D8DED13C6A9FC015C3A3557FF3D7FFD987591DA495FE03FA3C0B89898
310
50AE2392817AEE53868468505A19C714B87C1BEEEC6005A604B36317C9823620072FBEFB8CEFF8AF6583AD2AF59D274342077C7B06F323965559C0B6136039E0C94AB171EE54CC2FFF979AB95DAC3FAD4BB12511BD37C4B2A0DB94A50A67E71EBC5D837A89E879F4445F5FB888E1E86112D6DD24E4469544B475CC75E093E6
310
B0D083BDE69E8208FB12AE39CFFF8586FB544634CB08A3BC6CB4B4C790C66A4B32A64F4015D6019D5C0C502CE873AA3B89DE8A9E5938EB2391163A64EDA1D7F2B473C297EFABCF00A51DCC5EFF20AF5DC20CF7741FF18C8B4DF8BAA999D006F8B0A78FEE1F7D789B88BA5A0A105F61B9A11C13E24D9C6EB7A504EF1E89E28F
310
D5BC9BA996480E5F9A026A34D63539053BA3F68830F06D74A2211004073B679B14C738CAF2A8F2AEEEA10259C93D213F2CF36243725E32754E98C68D3F8DF5ADF06E17235F888A1EED605D3D473350764CE31309D547D0119F7AE979FFFEEA6E727BBD1C79B74BB4529717CBD1D5E5DC1B79B3B977395B4C96EF2638E6FA15
310
D09C50DD1A44347122FAA5484D98BFAFF6656B07F74449F7635D506E523FBFAF1CB4C5BE8B3D0078BB71951719CD295344C3F75EBF64DF08BA8A9E8C7A7E9593849E21E5CBC7F5C006CC9CB1EFAB2E35FA32D86B66E7BA168E0A518F651E329266838DC671A7608971BB0965FBAC19BD19EA918927FA50C9B33406E1C45642
310
794E1568E70CB6173995404CB72B8FCDEDE18CDDCF753FA84898D1C6924782963893403548A78C547FDEFA0D2D9CEEA26E6C1C76CE13FE4C21DA16527D6383DF541A51E984381E75E353090704D085B52408D0139664E8ACEB4DEDB8DDA56303FAC10968F4B74BCEE9968C5F3DE2CD4951E0D4EED16A659B5110FD23C71B73
310
2CA2F01A96AAF5653FD13A53A909C03570A77DA0857832AA77A8AFB7DDF29C6A4D2F2267DD93DE04412D75A48848AA7B810EBA31E976F1D5452B60ADBE58455626C8E5F992468202CCA52E70A008A830320BA200D5F9EF0F5F05C75D34B7962920F030E779CE9919DC9ABBACB57EC4CD347E002D507DFD901763CF7BA8BA7E
310
7311D984445287C4F209134DC1690F065803200F8E53733D73750E06CB570BCB1C185308AD407BD094D6D7700BC5A36F8EBA54BA6459BCD9F8BBD552A040A0650FFE06504B0304140006080000AC70623B000000000000000000000000350000006662782F33394334313030352D393437462D344341332D393833322D3144
310
373644414336394143352F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B
310
000000000000000000000000370000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F33394334313030352D393437462D344341332D393833
310
322D3144373644414336394143352F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607
310
FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623B95BFD5E5FE000000A00100003B0000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265736F75726365732F63
310
6F72652E786D6C8D50596E833010BD0A9ADFCA603B1B41C611699213F40296992456828DBC543D7E4DA052FBD79F99D15B344F4F1CBE8667F1893E18675B60258502AD76BDB1B71652BC921A8A8314DEB9F84B06855503B630C120C5CDBB342E907636A28D19B5AEC70554216084423FF3D142D0771C54A952CC8AF02847A5
310
1FEA86252B339D755284E87380627E324D901E834B5E6310D5CC4A9192E9178DE9F34F7335E841EE38DBEEF8A5239B13ADC9FA589FC971F77E2217BEDDAFB61DEBE8B916D56496229AE127A3F6A822F62039A57BC218A1FC83AD1BBA69F8E68DD60DA5A29AE47F4C69ECFF694AC6C6155FE2CEB60092E5202F428A6AEA2BAF
310
5799794FDDCA6F504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B
310
436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BFD5588D4EC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D6C504B
310
01021400140006080800AC70623BB5D38BAD72010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623B09885E1C7E0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B01021400140006080800AC70
310
623B961D28872A0100001202000031000000000000000000000000005C0500006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D5060000
310
6662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6C504B01021400140006080800AC70623B2EA4D28F640500003C1000003400000000000000000000000000710800006662782F33394334313030352D393437462D344341332D393833322D3144373644
310
414336394143352F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000270E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F76657274696365732E62696E504B01021400140006
310
080800AC70623BF270F133060000000400000036000000000000000000000000007A0E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000000000
310
000000000000D40E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000290F00006662782F33394334313030352D393437
310
462D344341332D393833322D3144373644414336394143352F6469726563746F72792E786D6C504B01021400140006080800AC70623B95BFD5E5FE000000A00100003B000000000000000000000000000D1000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265
310
736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000641100000000
  0
XRECORD
  5
10D
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10C
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
187
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
 70
     0
 90
1778669749
  1
7E355024-1ABF-47F9-966E-F2159FBE82AB
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BDCE527C8EB0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103B15DC7C24471249FA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EFA9EEFE8CBACC17AD7032D0820E394D7D64D3DA478C52DA093E0ABF7F1970D9093B3E961
310
9341F069F569D925E55D342E66D5796D76518660222075CF4D0F417D9A591632C5EC08B76291EA262753D05797E194AC46CF2356E77DF66ACD0A621C9B73335C463C5E0E1457EC9DE2A1612D3E9233A92BD2D66333F07283058F767EDD57AB91D168108C9023A61413F641AB8ED41DABDF48DB11C2CBCDFE074A8BFE2794AC
310
8B07B6BFFBC402089A1F790C042FB72C72790495EB969BF801504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF32603847
310
2BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB24894EB71010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C085012194749244ED00B38E05014B091B1518EDFE511A5A9D228FD2A1F60CDEC7A67C6986D2F6D830669
310
FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7266B4B6DFCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B4FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2609EE7C92ED91F722F3FAC022F0ADF036F9F84A9
310
B7A63B1A47348DF364CFC8D8CC99ADDBABBAC2486165897948E9DA0B028F861F41B4A1F1268CDF68BAA19491B1FCAEC975E58B4DAE5676152E72E7B61EF300844CC40FB7109145BD18400FE18C8C21C2674AF83E68080442B6E2D85C7D9C011A6461B5898029B5BB5183689C84A9D4A7D3837E5F303277C2D4697370FD7046
310
F8F28CE73BC2510B5581096161797476D4C9660D4B689D34DE602F4869D38AE6351B4F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F01504B0304140006080800AC70623B3A54DFB77D0000009D0000000B0000006662782F636E782E786D6C4DCCD10A83201805E05791FFDEA5EBA76DA046A37C8F581632D3
310
613AF6F8B3D1C52E0E073E0E47B49FD591B7899B0D5E023F3120C63FC264FD2221A7995E81B44AC410D2DF0C881F5723616750628921BF0E9ACC3C66978A3AEB9F07B2A6D77AB87514F95953EC39D20EEF9C6AD60C88BC2EB940A544F57B2ABD1FAB2F504B0304140006080800AC70623B4A17098729010000120200003100
310
00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C8D515B6EC32010BC0AE22B55850D0E76930813A54A7C825E80DA244589C1E251E5F85D6A476AFFF2018B7667666759B1BF8F37F4AD7D30CEB6981514236D7B37187B69718A67B2C1682F8577
310
2EFE816164D5A85B9CD3588A8B77695A52BDB351DB0859EB06BD2455083A62D4DFE0D1E2D07FE951152A4540846B31A9FEAA2EBA600594012745881E0CA0B949BEB1A4CDB1EB4EDB03E1ACEA083F324E0EFC9D918E3627CED91ACE9B2867A214299961A19B01EC98B3D1FE59914C96229AF161BFF75A453D605951BA258C11
310
5A7D30BEA3F5AEAA5FE96647A92833FC1F294DC393A4646C5C578BDD9916B064A29C0B520C2E7DDE1E66F47D723EA2DC6F1574FF02531594D6AC69443903617C506CF8A218A2F3F0BDABEB2760593DCB365C8A326F08C2EFFA20E66DCA1F504B0304140006080800AC70623B503B51794E0100003303000030000000666278
310
2F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F7736
310
4A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347DEE0
310
50F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F504B
310
0304140006080800AC70623BD8F6D0D5660500003B100000340000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F6F626A656374732E786D6CAD575B8F9B3814FE2B887D064292B964C5504D92491555D3568D5AEDC348910187610730B2CD4C667FFD7E06438024
310
6DF6928780CDF1B97EE762EFC33E4B8D57CA45C2F23BD3B547A641F39045491EDF99A5DC59B7A6F1C1F73863B243661A39C9E89DA9B64DDF8B392B0BBD15D11D295339D85DCDFF304448736A1A614A84B83345F84C33629352B2888A173B2292D8F16E6FBB764DD8671B73523C0F981684D35C4253ECE7E062D44AB9FDE5C8
310
747CCF51DF7D4FFD6BAAC9792AA7B2A72F3FC985247978246CC066E24E970FE3AB9975359D4EACE9F5D8B5E6ABF9D2726F26A3C5F56231BB7F9841B0901C9CB4269CEE4CFF237CC393D073EA4FADC65AF1532A852CCF6958D90F0B2B9D35C78816348F10C7840A48EB583DEA2F5DE59BCEE7895A6B91DDEDCBACEA9EE8306A
310
746F9E5D4D59F0274C1097A0820BAA5055FB471B5AE36F74F05AC058AABF25C2C888A43C21A991260127FCDDF441AA487CAFC746A1932B842B0B4CDF3DF0EBEA8AD4F835764F69B92BD35441D3F42B646F817F2A45A559F217E5A7A54127C4AA4C7279AB0D92EF0535FD99E7549BBEA71E93B1FE583BD2D8A52446C86166FD
310
7560E842E5DE7A69FA9F56C17EA3F2F1B4F082B38272A9E0036835816B9ECA4B5AAC7B51E4D40118D3F3F9C129DFE0F9CF48DF832A881B4FF6D3FD544B919CE462C77886D8D8A3EA678C9A17AB7D3B7E413D1B501FD3B43BFF8AD8735A65FB05E35CFC002E159ADBFF1EBFBECFBA48ED84CFF75E91608C4FB42B372149517A
310
1E931C0151A03452862DD4F25DB037FD352A252A3B4E91D46F1D72F4E239AFF88EFF9A37AA5525BEF3CC11D041BDBDA0F2C397555A40B7336039AA9395606DDC399F5FFD2F3973BFDC7CDA947C4742FAA80BCB92EE923C91E89D07F07615EA05A267D10B7D7F633C82A1C741D8748390695102DE563E578E8F9B66A11607C9
310
3D0121CEC54CD53CEF17121E1311D2342539656523A56D430AAB6D91D17302B2B076E8643C4031A7AF899A247A143DB5D0EB439E14CA656DD36BEBB47DC696EFEBCF0025E8531690F440141CAA7DC852C6B7C1FBB62E8426B087237D70FFE8A35B3BD4515C00F80ACA4DC5D11EDE46C96E570A94DD134EFCB15E7403D5D691
310
E397267F1A89754A4E519C917A846BF43632310F7082BECEF26D822E8EAC3C29BC2B7B2840547CCFF00FCAACD8928C95B9BCC44DA3C69E46FB96797788116F4486CFA6BFA99ED61C153BA2D121543D10A80E74C2A65E786E1E265757A3F1D472EFE72B6B7AB39A59B3EBEB076B3576AF66ABF9C3EDF87EDE6A5469E27B4D83
310
EAA620BC8986E8953CD16EFEBE3E64ADE93F12299C8F753E3971FDFCBEB631157B0ECE00DFEDC17556A434A3B9240ABD8FEA25FD463054F478D4FBEB8CC4F4022E5F3E6E063A60E782735F55A6D1B7C159BDBB50B97092897C2EB32027493A38A80DB78B3CD66637AE6C9F75416F966AA5FD893154B03489506F2223A62CA3
310
1255E78262CF332A8098EE501EE9CBC305A75FEB71509220A58D26CF0413712A806AC0AD0C657FDFF80D139C1AA2EE4CF43AFB057F3A114D03A1BE3351DE6412526107E88E6AEEA998030218C2DA1A08A8913C4E3158D787DA757B4AF906E5070D50CB6F492E1996B45DBDBA9B91A240D3EE55D54A372D20FC478637EA1844
310
E23528656BCB61A335A61283CCAA8DD257034C102F5AF41EF9F573B35CBBA2E979E4A26BD24F415073B524E171752D50FA6995EE975F1D4C02C6FA8B51A4658C585ECEC9E214602E558203454085E6591009A82E7E7FFACA19AEA299B14A0081A705CB3296EBC5BDBECA1A9B675C4CA3279405AA6E1F623C72DDA76AE8D7F7
310
906D4004B549245EB0D1249CB260803500F2A89BEA10382A0603F2F5D2D00D630AA615688F66D2FA166E2079D4C551A54AB758163F9DFB9D8A1460E098D8FDBF01504B0304140006080000AC70623B000000000000000000000000350000006662782F30364446464539412D343132462D344431342D413442312D46303645
310
34343133343431372F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B0000
310
00000000000000000000370000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30364446464539412D343132462D344431342D413442312D
310
4630364534343133343431372F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607FB14
310
4396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BB40F7AF9FE000000A00100003B0000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F75726365732F636F72
310
652E786D6C8D504B6E833010BD0A9A6D65B00950828CA3109513F4029699502BC146FE543D7E4D42A576D7CDCCE87D344F8F9FBE967BF689CE6B6B7A6039850C8DB29336730F315C490BD94970676DF82583CCC8057BD860107C7636AE3BA4AC096842428D9D7007A5F7182053F774F4E0D5072E3297312485BFE5AB543739
310
63CEF244279DE03EB814207B3ED9260887DE46A7D0F3E2C90A1EA39E768D9ED24F7DD5E8408C63736E86CB1B192F0746AAF29591A1295B72A4675A57B4ADC766E0C566163CE8E527A37228034E204A4A8F843142CB775675B4EECAFA85B61DA5BCD8E47F4C719DFE698ADA8443B9C77DDA3C0896823C08C18BADAFB41E65A6
310
BD752BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B436F
310
6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BDCE527C8EB0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000094020000636E782E786D6C504B0102
310
1400140006080800AC70623BB24894EB71010000D40300000C00000000000000000000000000180300006662782F636F72652E786D6C504B01021400140006080800AC70623B3A54DFB77D0000009D0000000B00000000000000000000000000B30400006662782F636E782E786D6C504B01021400140006080800AC70623B
310
4A17098729010000120200003100000000000000000000000000590500006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D10600006662
310
782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6C504B01021400140006080800AC70623BD8F6D0D5660500003B10000034000000000000000000000000006D0800006662782F30364446464539412D343132462D344431342D413442312D46303645343431
310
33343431372F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000250E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F76657274696365732E62696E504B010214001400060808
310
00AC70623BF270F13306000000040000003600000000000000000000000000780E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E504B01021400140006080000AC70623B00000000000000000000000037000000000000000000
310
00000000D20E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000270F00006662782F30364446464539412D343132462D
310
344431342D413442312D4630364534343133343431372F6469726563746F72792E786D6C504B01021400140006080800AC70623BB40F7AF9FE000000A00100003B000000000000000000000000000B1000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F
310
75726365732F636F72652E786D6C504B0506000000000E000E0080040000621100000000
  0
XRECORD
  5
10E
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10F
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
379
102
{ACAD_REACTORS
330
378
102
}
330
378
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
CELLSTYLEMAP
  5
33E
102
{ACAD_REACTORS
330
FF
102
}
330
FF
100
AcDbCellStyleMap
 90
        3
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
    32768
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.25
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        1
 91
        1
300
_TITLE
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        2
 91
        1
300
_HEADER
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        2
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        3
 91
        2
300
_DATA
309
CELLSTYLE_END
  0
XRECORD
  5
353
102
{ACAD_REACTORS
330
352
102
}
330
352
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     1
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     0
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
351
102
{ACAD_REACTORS
330
350
102
}
330
350
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
35F
102
{ACAD_REACTORS
330
35E
102
}
330
35E
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
367
102
{ACAD_REACTORS
330
366
102
}
330
366
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
359
102
{ACAD_REACTORS
330
358
102
}
330
358
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
35D
102
{ACAD_REACTORS
330
35C
102
}
330
35C
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
36D
102
{ACAD_REACTORS
330
36C
102
}
330
36C
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
365
102
{ACAD_REACTORS
330
364
102
}
330
364
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
349
102
{ACAD_REACTORS
330
348
102
}
330
348
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
34B
102
{ACAD_REACTORS
330
34A
102
}
330
34A
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
34D
102
{ACAD_REACTORS
330
34C
102
}
330
34C
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
34F
102
{ACAD_REACTORS
330
34E
102
}
330
34E
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
357
102
{ACAD_REACTORS
330
356
102
}
330
356
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
369
102
{ACAD_REACTORS
330
368
102
}
330
368
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
363
102
{ACAD_REACTORS
330
362
102
}
330
362
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
36B
102
{ACAD_REACTORS
330
36A
102
}
330
36A
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
35B
102
{ACAD_REACTORS
330
35A
102
}
330
35A
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
377
102
{ACAD_REACTORS
330
376
102
}
330
376
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
375
102
{ACAD_REACTORS
330
374
102
}
330
374
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
36F
102
{ACAD_REACTORS
330
36E
102
}
330
36E
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
371
102
{ACAD_REACTORS
330
370
102
}
330
370
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
361
102
{ACAD_REACTORS
330
360
102
}
330
360
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
355
102
{ACAD_REACTORS
330
354
102
}
330
354
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
373
102
{ACAD_REACTORS
330
372
102
}
330
372
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
ENDSEC
  0
EOF
`;var O$e=`  0
SECTION
  2
HEADER
  9
$ACADVER
  1
AC1027
  9
$ACADMAINTVER
 70
   125
  9
$DWGCODEPAGE
  3
ANSI_936
  9
$LASTSAVEDBY
  1
win10
  9
$REQUIREDVERSIONS
160
                 0
  9
$INSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$EXTMIN
 10
1.000000000000000E+20
 20
1.000000000000000E+20
 30
1.000000000000000E+20
  9
$EXTMAX
 10
-1.000000000000000E+20
 20
-1.000000000000000E+20
 30
-1.000000000000000E+20
  9
$LIMMIN
 10
0.0
 20
0.0
  9
$LIMMAX
 10
12.0
 20
9.0
  9
$ORTHOMODE
 70
     0
  9
$REGENMODE
 70
     1
  9
$FILLMODE
 70
     1
  9
$QTEXTMODE
 70
     0
  9
$MIRRTEXT
 70
     0
  9
$LTSCALE
 40
1.0
  9
$ATTMODE
 70
     1
  9
$TEXTSIZE
 40
0.2
  9
$TRACEWID
 40
0.05
  9
$TEXTSTYLE
  7
Standard
  9
$CLAYER
  8
0
  9
$CELTYPE
  6
ByLayer
  9
$CECOLOR
 62
   256
  9
$CELTSCALE
 40
1.0
  9
$DISPSILH
 70
     0
  9
$DIMSCALE
 40
1.0
  9
$DIMASZ
 40
0.18
  9
$DIMEXO
 40
0.0625
  9
$DIMDLI
 40
0.38
  9
$DIMRND
 40
0.0
  9
$DIMDLE
 40
0.0
  9
$DIMEXE
 40
0.18
  9
$DIMTP
 40
0.0
  9
$DIMTM
 40
0.0
  9
$DIMTXT
 40
0.18
  9
$DIMCEN
 40
0.09
  9
$DIMTSZ
 40
0.0
  9
$DIMTOL
 70
     0
  9
$DIMLIM
 70
     0
  9
$DIMTIH
 70
     1
  9
$DIMTOH
 70
     1
  9
$DIMSE1
 70
     0
  9
$DIMSE2
 70
     0
  9
$DIMTAD
 70
     0
  9
$DIMZIN
 70
     0
  9
$DIMBLK
  1

  9
$DIMASO
 70
     1
  9
$DIMSHO
 70
     1
  9
$DIMPOST
  1

  9
$DIMAPOST
  1

  9
$DIMALT
 70
     0
  9
$DIMALTD
 70
     2
  9
$DIMALTF
 40
25.4
  9
$DIMLFAC
 40
1.0
  9
$DIMTOFL
 70
     0
  9
$DIMTVP
 40
0.0
  9
$DIMTIX
 70
     0
  9
$DIMSOXD
 70
     0
  9
$DIMSAH
 70
     0
  9
$DIMBLK1
  1

  9
$DIMBLK2
  1

  9
$DIMSTYLE
  2
Standard
  9
$DIMCLRD
 70
     0
  9
$DIMCLRE
 70
     0
  9
$DIMCLRT
 70
     0
  9
$DIMTFAC
 40
1.0
  9
$DIMGAP
 40
0.09
  9
$DIMJUST
 70
     0
  9
$DIMSD1
 70
     0
  9
$DIMSD2
 70
     0
  9
$DIMTOLJ
 70
     1
  9
$DIMTZIN
 70
     0
  9
$DIMALTZ
 70
     0
  9
$DIMALTTZ
 70
     0
  9
$DIMUPT
 70
     0
  9
$DIMDEC
 70
     4
  9
$DIMTDEC
 70
     4
  9
$DIMALTU
 70
     2
  9
$DIMALTTD
 70
     2
  9
$DIMTXSTY
  7
Standard
  9
$DIMAUNIT
 70
     0
  9
$DIMADEC
 70
     0
  9
$DIMALTRND
 40
0.0
  9
$DIMAZIN
 70
     0
  9
$DIMDSEP
 70
    46
  9
$DIMATFIT
 70
     3
  9
$DIMFRAC
 70
     0
  9
$DIMLDRBLK
  1

  9
$DIMLUNIT
 70
     2
  9
$DIMLWD
 70
    -2
  9
$DIMLWE
 70
    -2
  9
$DIMTMOVE
 70
     0
  9
$DIMFXL
 40
1.0
  9
$DIMFXLON
 70
     0
  9
$DIMJOGANG
 40
0.7853981633974483
  9
$DIMTFILL
 70
     0
  9
$DIMTFILLCLR
 70
     0
  9
$DIMARCSYM
 70
     0
  9
$DIMLTYPE
  6

  9
$DIMLTEX1
  6

  9
$DIMLTEX2
  6

  9
$DIMTXTDIRECTION
 70
     0
  9
$LUNITS
 70
     2
  9
$LUPREC
 70
     4
  9
$SKETCHINC
 40
0.1
  9
$FILLETRAD
 40
0.0
  9
$AUNITS
 70
     0
  9
$AUPREC
 70
     0
  9
$MENU
  1
.
  9
$ELEVATION
 40
0.0
  9
$PELEVATION
 40
0.0
  9
$THICKNESS
 40
0.0
  9
$LIMCHECK
 70
     0
  9
$CHAMFERA
 40
0.0
  9
$CHAMFERB
 40
0.0
  9
$CHAMFERC
 40
0.0
  9
$CHAMFERD
 40
0.0
  9
$SKPOLY
 70
     0
  9
$TDCREATE
 40
2460560.605914352
  9
$TDUCREATE
 40
2460560.272581019
  9
$TDUPDATE
 40
2460560.629675926
  9
$TDUUPDATE
 40
2460560.296342593
  9
$TDINDWG
 40
0.0237615741
  9
$TDUSRTIMER
 40
0.0237615741
  9
$USRTIMER
 70
     1
  9
$ANGBASE
 50
0.0
  9
$ANGDIR
 70
     0
  9
$PDMODE
 70
     0
  9
$PDSIZE
 40
0.0
  9
$PLINEWID
 40
0.0
  9
$SPLFRAME
 70
     0
  9
$SPLINETYPE
 70
     6
  9
$SPLINESEGS
 70
     8
  9
$HANDSEED
  5
38A
  9
$SURFTAB1
 70
     6
  9
$SURFTAB2
 70
     6
  9
$SURFTYPE
 70
     6
  9
$SURFU
 70
     6
  9
$SURFV
 70
     6
  9
$UCSBASE
  2

  9
$UCSNAME
  2

  9
$UCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$UCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$UCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$UCSORTHOREF
  2

  9
$UCSORTHOVIEW
 70
     0
  9
$UCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSBASE
  2

  9
$PUCSNAME
  2

  9
$PUCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$PUCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$PUCSORTHOREF
  2

  9
$PUCSORTHOVIEW
 70
     0
  9
$PUCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$USERI1
 70
     0
  9
$USERI2
 70
     0
  9
$USERI3
 70
     0
  9
$USERI4
 70
     0
  9
$USERI5
 70
     0
  9
$USERR1
 40
0.0
  9
$USERR2
 40
0.0
  9
$USERR3
 40
0.0
  9
$USERR4
 40
0.0
  9
$USERR5
 40
0.0
  9
$WORLDVIEW
 70
     1
  9
$SHADEDGE
 70
     3
  9
$SHADEDIF
 70
    70
  9
$TILEMODE
 70
     1
  9
$MAXACTVP
 70
    64
  9
$PINSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMCHECK
 70
     0
  9
$PEXTMIN
 10
0.0
 20
0.0
 30
0.0
  9
$PEXTMAX
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMMIN
 10
0.0
 20
0.0
  9
$PLIMMAX
 10
12.0
 20
9.0
  9
$UNITMODE
 70
     0
  9
$VISRETAIN
 70
     1
  9
$PLINEGEN
 70
     0
  9
$PSLTSCALE
 70
     1
  9
$TREEDEPTH
 70
  3020
  9
$CMLSTYLE
  2
Standard
  9
$CMLJUST
 70
     0
  9
$CMLSCALE
 40
1.0
  9
$PROXYGRAPHICS
 70
     1
  9
$MEASUREMENT
 70
     0
  9
$CELWEIGHT
370
    -1
  9
$ENDCAPS
280
     0
  9
$JOINSTYLE
280
     0
  9
$LWDISPLAY
290
     0
  9
$INSUNITS
 70
     4
  9
$HYPERLINKBASE
  1

  9
$STYLESHEET
  1

  9
$XEDIT
290
     1
  9
$CEPSNTYPE
380
     0
  9
$PSTYLEMODE
290
     0
  9
$FINGERPRINTGUID
  2
{FA9A02B2-7E04-C34E-BD13-02980AC2B394}
  9
$VERSIONGUID
  2
{964EB223-33A2-D549-8684-CDE005EE773C}
  9
$EXTNAMES
290
     1
  9
$PSVPSCALE
 40
0.0
  9
$OLESTARTUP
290
     0
  9
$SORTENTS
280
   127
  9
$INDEXCTL
280
     0
  9
$HIDETEXT
280
     1
  9
$XCLIPFRAME
280
     2
  9
$HALOGAP
280
     0
  9
$OBSCOLOR
 70
   257
  9
$OBSLTYPE
280
     0
  9
$INTERSECTIONDISPLAY
280
     0
  9
$INTERSECTIONCOLOR
 70
   257
  9
$DIMASSOC
280
     2
  9
$PROJECTNAME
  1

  9
$CAMERADISPLAY
290
     0
  9
$LENSLENGTH
 40
50.0
  9
$CAMERAHEIGHT
 40
60.0
  9
$STEPSPERSEC
 40
2.0
  9
$STEPSIZE
 40
6.0
  9
$3DDWFPREC
 40
2.0
  9
$PSOLWIDTH
 40
0.25
  9
$PSOLHEIGHT
 40
4.0
  9
$LOFTANG1
 40
1.570796326794896
  9
$LOFTANG2
 40
1.570796326794896
  9
$LOFTMAG1
 40
0.0
  9
$LOFTMAG2
 40
0.0
  9
$LOFTPARAM
 70
     7
  9
$LOFTNORMALS
280
     1
  9
$LATITUDE
 40
37.795
  9
$LONGITUDE
 40
-122.394
  9
$NORTHDIRECTION
 40
0.0
  9
$TIMEZONE
 70
 -8000
  9
$LIGHTGLYPHDISPLAY
280
     1
  9
$TILEMODELIGHTSYNCH
280
     1
  9
$CMATERIAL
347
92
  9
$SOLIDHIST
280
     0
  9
$SHOWHIST
280
     1
  9
$DWFFRAME
280
     2
  9
$DGNFRAME
280
     0
  9
$REALWORLDSCALE
290
     1
  9
$INTERFERECOLOR
 62
     1
  9
$INTERFEREOBJVS
345
9F
  9
$INTERFEREVPVS
346
9C
  9
$CSHADOW
280
     0
  9
$SHADOWPLANELOCATION
 40
0.0
  0
ENDSEC
  0
SECTION
  2
CLASSES
  0
CLASS
  1
ACDBDICTIONARYWDFLT
  2
AcDbDictionaryWithDefault
  3
ObjectDBX Classes
 90
        0
 91
        1
280
     0
281
     0
  0
CLASS
  1
DICTIONARYVAR
  2
AcDbDictionaryVar
  3
ObjectDBX Classes
 90
        0
 91
       15
280
     0
281
     0
  0
CLASS
  1
MATERIAL
  2
AcDbMaterial
  3
ObjectDBX Classes
 90
     1153
 91
        3
280
     0
281
     0
  0
CLASS
  1
VISUALSTYLE
  2
AcDbVisualStyle
  3
ObjectDBX Classes
 90
     4095
 91
       24
280
     0
281
     0
  0
CLASS
  1
TABLESTYLE
  2
AcDbTableStyle
  3
ObjectDBX Classes
 90
     4095
 91
        1
280
     0
281
     0
  0
CLASS
  1
SCALE
  2
AcDbScale
  3
ObjectDBX Classes
 90
     1153
 91
       33
280
     0
281
     0
  0
CLASS
  1
MLEADERSTYLE
  2
AcDbMLeaderStyle
  3
ACDB_MLEADERSTYLE_CLASS
 90
     4095
 91
        2
280
     0
281
     0
  0
CLASS
  1
CELLSTYLEMAP
  2
AcDbCellStyleMap
  3
ObjectDBX Classes
 90
     1152
 91
        6
280
     0
281
     0
  0
CLASS
  1
EXACXREFPANELOBJECT
  2
ExAcXREFPanelObject
  3
EXAC_ESW
 90
     1025
 91
        0
280
     0
281
     0
  0
CLASS
  1
NPOCOLLECTION
  2
AcDbImpNonPersistentObjectsCollection
  3
ObjectDBX Classes
 90
     1153
 91
        0
280
     0
281
     0
  0
CLASS
  1
LAYER_INDEX
  2
AcDbLayerIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
SPATIAL_INDEX
  2
AcDbSpatialIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
IDBUFFER
  2
AcDbIdBuffer
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
ACDBSECTIONVIEWSTYLE
  2
AcDbSectionViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
CLASS
  1
ACDBDETAILVIEWSTYLE
  2
AcDbDetailViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
ENDSEC
  0
SECTION
  2
TABLES
  0
TABLE
  2
VPORT
  5
8
330
0
100
AcDbSymbolTable
 70
     1
1001
ACAD
1000
DbSaveVer
1071
      224
  0
VPORT
  5
90
330
8
100
AcDbSymbolTableRecord
100
AcDbViewportTableRecord
  2
*Active
 70
     0
 10
0.0
 20
0.0
 11
1.0
 21
1.0
 12
97.5486911906951
 22
42.51345460271504
 13
0.0
 23
0.0
 14
0.5
 24
0.5
 15
0.5
 25
0.5
 16
0.0
 26
0.0
 36
1.0
 17
0.0
 27
0.0
 37
0.0
 40
78.45799938217576
 41
1.945409429280396
 42
50.0
 43
0.0
 44
0.0
 50
0.0
 51
0.0
 71
     0
 72
  1000
 73
     1
 74
     3
 75
     0
 76
     1
 77
     0
 78
     0
281
     0
 65
     1
110
0.0
120
0.0
130
0.0
111
1.0
121
0.0
131
0.0
112
0.0
122
1.0
132
0.0
 79
     0
146
0.0
348
9B
 60
     3
 61
     5
292
     1
282
     1
141
0.0
142
0.0
 63
   250
421
  3355443
1001
ACAD_NAV_VCDISPLAY
1070
     3
  0
ENDTAB
  0
TABLE
  2
LTYPE
  5
5
330
0
100
AcDbSymbolTable
 70
     1
  0
LTYPE
  5
14
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByBlock
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
15
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByLayer
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
16
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
Continuous
 70
     0
  3
Solid line
 72
    65
 73
     0
 40
0.0
  0
ENDTAB
  0
TABLE
  2
LAYER
  5
2
102
{ACAD_XDICTIONARY
360
18B
102
}
330
0
100
AcDbSymbolTable
 70
     1
  0
LAYER
  5
10
102
{ACAD_XDICTIONARY
360
E1
102
}
330
2
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
  2
0
 70
     0
 62
     7
  6
Continuous
370
    -3
390
F
347
94
348
0
  0
ENDTAB
  0
TABLE
  2
STYLE
  5
3
330
0
100
AcDbSymbolTable
 70
     2
  0
STYLE
  5
11
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Standard
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
ACAD
1000
Arial
1071
       34
  0
STYLE
  5
D7
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD
1000
Arial
1071
       34
  0
ENDTAB
  0
TABLE
  2
VIEW
  5
6
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
UCS
  5
7
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
APPID
  5
9
330
0
100
AcDbSymbolTable
 70
     7
  0
APPID
  5
12
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD
 70
     0
  0
APPID
  5
D8
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnoPO
 70
     0
  0
APPID
  5
D9
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnotative
 70
     0
  0
APPID
  5
DA
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMJAG
 70
     0
  0
APPID
  5
DB
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMTALN
 70
     0
  0
APPID
  5
102
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_MLEADERVER
 70
     0
  0
APPID
  5
1A3
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_NAV_VCDISPLAY
 70
     0
  0
ENDTAB
  0
TABLE
  2
DIMSTYLE
  5
A
330
0
100
AcDbSymbolTable
 70
     2
100
AcDbDimStyleTable
 71
     2
340
DC
340
27
  0
DIMSTYLE
105
27
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Standard
 70
     0
340
11
  0
DIMSTYLE
105
DC
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
340
11
1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD_DSTYLE_DIMJAG
1070
   388
1040
1.5
1001
ACAD_DSTYLE_DIMTALN
1070
   392
1070
     0
  0
ENDTAB
  0
TABLE
  2
BLOCK_RECORD
  5
1
330
0
100
AcDbSymbolTable
 70
     1
  0
BLOCK_RECORD
  5
1F
102
{ACAD_XDICTIONARY
360
15A
102
}
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Model_Space
340
22
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
73
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space
340
74
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
78
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space0
340
79
 70
     0
280
     1
281
     0
  0
ENDTAB
  0
ENDSEC
  0
SECTION
  2
BLOCKS
  0
BLOCK
  5
20
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockBegin
  2
*Model_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Model_Space
  1

  0
ENDBLK
  5
21
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
75
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space
  1

  0
ENDBLK
  5
76
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
7A
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space0
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space0
  1

  0
ENDBLK
  5
7B
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
ENDSEC
  0
SECTION
  2
ENTITIES
  0
ENDSEC
  0
SECTION
  2
OBJECTS
  0
DICTIONARY
  5
C
330
0
100
AcDbDictionary
281
     1
  3
ACAD_CIP_PREVIOUS_PRODUCT_INFO
350
1A2
  3
ACAD_COLOR
350
6C
  3
ACAD_DETAILVIEWSTYLE
350
1A8
  3
ACAD_GROUP
350
D
  3
ACAD_LAYOUT
350
1A
  3
ACAD_MATERIAL
350
6B
  3
ACAD_MLEADERSTYLE
350
D2
  3
ACAD_MLINESTYLE
350
17
  3
ACAD_PLOTSETTINGS
350
19
  3
ACAD_PLOTSTYLENAME
350
E
  3
ACAD_SCALELIST
350
B1
  3
ACAD_SECTIONVIEWSTYLE
350
1A5
  3
ACAD_TABLESTYLE
350
A6
  3
ACAD_VISUALSTYLE
350
95
  3
ACDB_RECOMPOSE_DATA
350
37D
  3
AcDbVariableDictionary
350
59
  3
AcDsDecomposeData
350
383
  0
DICTIONARY
  5
18B
330
2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_LAYERSTATES
360
18C
  0
DICTIONARY
  5
E1
330
10
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
15A
330
1F
100
AcDbDictionary
280
     1
281
     1
  0
XRECORD
  5
1A2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
300
ACD
300
2021
300

  0
DICTIONARY
  5
6C
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A8
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A9
  0
DICTIONARY
  5
D
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Model
350
22
  3
\u5E03\u5C401
350
74
  3
\u5E03\u5C402
350
79
  0
DICTIONARY
  5
6B
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
ByBlock
350
93
  3
ByLayer
350
92
  3
Global
350
94
  0
DICTIONARY
  5
D2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Annotative
350
E0
  3
Standard
350
D3
  0
DICTIONARY
  5
17
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
18
  0
DICTIONARY
  5
19
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
ACDBDICTIONARYWDFLT
  5
E
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Normal
350
F
100
AcDbDictionaryWithDefault
340
F
  0
DICTIONARY
  5
B1
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
A0
350
B2
  3
A1
350
124
  3
A2
350
125
  3
A3
350
126
  3
A4
350
127
  3
A5
350
128
  3
A6
350
129
  3
A7
350
12A
  3
A8
350
12B
  3
A9
350
12C
  3
B0
350
12D
  3
B1
350
12E
  3
B2
350
12F
  3
B3
350
130
  3
B4
350
131
  3
B5
350
132
  3
B6
350
133
  3
B7
350
134
  3
B8
350
135
  3
B9
350
136
  3
C0
350
137
  3
C1
350
138
  3
C2
350
139
  3
C3
350
13A
  3
C4
350
13B
  3
C5
350
13C
  3
C6
350
13D
  3
C7
350
13E
  3
C8
350
13F
  3
C9
350
140
  3
D0
350
141
  3
D1
350
142
  3
D2
350
143
  0
DICTIONARY
  5
1A5
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A7
  0
DICTIONARY
  5
A6
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
A7
  0
DICTIONARY
  5
95
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
2dWireframe
350
9B
  3
Basic
350
9A
  3
Brighten
350
A1
  3
ColorChange
350
A5
  3
Conceptual
350
9E
  3
Dim
350
A0
  3
EdgeColorOff
350
172
  3
Facepattern
350
A4
  3
Flat
350
96
  3
FlatWithEdges
350
97
  3
Gouraud
350
98
  3
GouraudWithEdges
350
99
  3
Hidden
350
9D
  3
JitterOff
350
170
  3
Linepattern
350
A3
  3
OverhangOff
350
171
  3
Realistic
350
9F
  3
Shaded
350
17F
  3
Shaded with edges
350
17E
  3
Shades of Gray
350
17B
  3
Sketchy
350
17C
  3
Thicken
350
A2
  3
Wireframe
350
9C
  3
X-Ray
350
17D
  0
XRECORD
  5
37D
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
 90
        1
330
A7
  0
DICTIONARY
  5
59
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
CAMERAHEIGHT
350
227
  3
CANNOSCALE
350
EB
  3
CMLEADERSTYLE
350
EA
  3
CTABLESTYLE
350
AB
  3
CVIEWDETAILSTYLE
350
1B4
  3
CVIEWSECTIONSTYLE
350
1B5
  3
DIMASSOC
350
5A
  3
HIDETEXT
350
5E
  3
INDEXCTL
350
226
  3
LAYEREVAL
350
14A
  3
LAYERNOTIFY
350
14B
  3
LIGHTINGUNITS
350
224
  3
MSLTSCALE
350
223
  3
SORTENTS
350
225
  3
XCLIPFRAME
350
228
  0
DICTIONARY
  5
383
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
AcDsRecords
350
385
  3
AcDsSchemas
350
384
1001
ACAD
1070
     2
  0
DICTIONARY
  5
18C
102
{ACAD_REACTORS
330
18B
102
}
330
18B
100
AcDbDictionary
281
     1
  0
ACDBDETAILVIEWSTYLE
  5
1A9
102
{ACAD_XDICTIONARY
360
388
102
}
102
{ACAD_REACTORS
330
1A8
102
}
330
1A8
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbDetailViewStyle
 70
     0
 71
     0
 90
        3
 71
     1
340
11
 62
   256
 40
0.24
340
0
 62
   256
 40
0.24
300

 40
0.36
280
     3
 71
     2
340
16
 90
       25
 62
   256
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewDetailId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
340
16
 90
       25
 62
   256
340
16
 90
       25
 62
   256
280
     0
  0
LAYOUT
  5
22
102
{ACAD_XDICTIONARY
360
191
102
}
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
none_device
  4
Letter_(8.50_x_11.00_Inches)
  6

 40
6.349999904632568
 41
6.349999904632568
 42
6.350006103515625
 43
6.350006103515625
 44
215.8999938964844
 45
279.3999938964844
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
3.560208697428376
 70
 11952
 72
     0
 73
     1
 74
     0
  7

 75
     0
147
0.28088241027059
 76
     0
 77
     2
 78
   300
148
0.1311165230791651
149
0.096403374003771
100
AcDbLayout
  1
Model
 70
     1
 71
     0
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
1F
331
90
  0
LAYOUT
  5
74
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C401
 70
     1
 71
     1
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
73
  0
LAYOUT
  5
79
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C402
 70
     1
 71
     2
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
78
  0
MATERIAL
  5
93
102
{ACAD_XDICTIONARY
360
185
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByBlock
 94
       63
  0
MATERIAL
  5
92
102
{ACAD_XDICTIONARY
360
183
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByLayer
 94
       63
  0
MATERIAL
  5
94
102
{ACAD_XDICTIONARY
360
10B
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
Global
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
 94
       63
1001
ACAD
1070
    -1
1070
     3
1070
     0
1000

1071
        0
1070
     0
  0
MLEADERSTYLE
  5
E0
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
179
     2
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     1
143
0.125
271
     0
272
     9
273
     9
298
     0
  0
MLEADERSTYLE
  5
D3
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
179
     2
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     0
143
0.125
271
     0
272
     9
273
     9
298
     0
  0
MLINESTYLE
  5
18
102
{ACAD_REACTORS
330
17
102
}
330
17
100
AcDbMlineStyle
  2
STANDARD
 70
     0
  3

 62
   256
 51
90.0
 52
90.0
 71
     2
 49
0.5
 62
   256
  6
BYLAYER
 49
-0.5
 62
   256
  6
BYLAYER
  0
ACDBPLACEHOLDER
  5
F
102
{ACAD_REACTORS
330
E
102
}
330
E
  0
SCALE
  5
B2
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:1
140
1.0
141
1.0
290
     1
  0
SCALE
  5
124
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:2
140
1.0
141
2.0
290
     0
  0
SCALE
  5
125
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:4
140
1.0
141
4.0
290
     0
  0
SCALE
  5
126
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:5
140
1.0
141
5.0
290
     0
  0
SCALE
  5
127
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:8
140
1.0
141
8.0
290
     0
  0
SCALE
  5
128
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:10
140
1.0
141
10.0
290
     0
  0
SCALE
  5
129
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:16
140
1.0
141
16.0
290
     0
  0
SCALE
  5
12A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:20
140
1.0
141
20.0
290
     0
  0
SCALE
  5
12B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:30
140
1.0
141
30.0
290
     0
  0
SCALE
  5
12C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:40
140
1.0
141
40.0
290
     0
  0
SCALE
  5
12D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:50
140
1.0
141
50.0
290
     0
  0
SCALE
  5
12E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:100
140
1.0
141
100.0
290
     0
  0
SCALE
  5
12F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
2:1
140
2.0
141
1.0
290
     0
  0
SCALE
  5
130
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
4:1
140
4.0
141
1.0
290
     0
  0
SCALE
  5
131
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
8:1
140
8.0
141
1.0
290
     0
  0
SCALE
  5
132
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
10:1
140
10.0
141
1.0
290
     0
  0
SCALE
  5
133
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
100:1
140
100.0
141
1.0
290
     0
  0
SCALE
  5
134
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/128" = 1'-0"
140
0.0078125
141
12.0
290
     0
  0
SCALE
  5
135
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/64" = 1'-0"
140
0.015625
141
12.0
290
     0
  0
SCALE
  5
136
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/32" = 1'-0"
140
0.03125
141
12.0
290
     0
  0
SCALE
  5
137
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/16" = 1'-0"
140
0.0625
141
12.0
290
     0
  0
SCALE
  5
138
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/32" = 1'-0"
140
0.09375
141
12.0
290
     0
  0
SCALE
  5
139
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/8" = 1'-0"
140
0.125
141
12.0
290
     0
  0
SCALE
  5
13A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/16" = 1'-0"
140
0.1875
141
12.0
290
     0
  0
SCALE
  5
13B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/4" = 1'-0"
140
0.25
141
12.0
290
     0
  0
SCALE
  5
13C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/8" = 1'-0"
140
0.375
141
12.0
290
     0
  0
SCALE
  5
13D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/2" = 1'-0"
140
0.5
141
12.0
290
     0
  0
SCALE
  5
13E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/4" = 1'-0"
140
0.75
141
12.0
290
     0
  0
SCALE
  5
13F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1" = 1'-0"
140
1.0
141
12.0
290
     0
  0
SCALE
  5
140
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1-1/2" = 1'-0"
140
1.5
141
12.0
290
     0
  0
SCALE
  5
141
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3" = 1'-0"
140
3.0
141
12.0
290
     0
  0
SCALE
  5
142
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
6" = 1'-0"
140
6.0
141
12.0
290
     0
  0
SCALE
  5
143
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1'-0" = 1'-0"
140
12.0
141
12.0
290
     0
  0
ACDBSECTIONVIEWSTYLE
  5
1A7
102
{ACAD_XDICTIONARY
360
386
102
}
102
{ACAD_REACTORS
330
1A5
102
}
330
1A5
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbSectionViewStyle
 70
     0
 71
     0
 90
       78
 71
     1
340
11
 62
   256
 40
0.24
340
0
340
0
 62
   256
 40
0.24
300
I, O, Q, S, X, Z
 40
0.48
 90
        3
 40
0.18
 90
        1
 71
     2
340
16
 90
       25
 62
   256
340
16
 90
       50
 62
   256
 40
0.24
 40
0.0
 40
0.24
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewSectionStartId>%-%<\\AcVar ViewSectionEndId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
 62
   256
 62
   257
300
ANSI31
 40
1.0
 90
        0
290
     0
290
     0
 90
        6
 40
0.0
 40
1.570796326794896
 40
0.2617993877991494
 40
1.308996938995747
 40
-0.2617993877991494
 40
1.832595714594046
  0
TABLESTYLE
  5
A7
102
{ACAD_XDICTIONARY
360
FF
102
}
102
{ACAD_REACTORS
330
A6
102
}
330
A6
100
AcDbTableStyle
280
     0
  3
Standard
 70
     0
 71
     0
 40
0.06
 41
0.06
280
     0
281
     0
  7
Standard
140
0.18
170
     2
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.25
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.18
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  0
VISUALSTYLE
  5
9B
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
2dWireframe
 70
     4
177
     3
291
     0
 70
    58
 90
        0
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9A
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Basic
 70
     7
177
     3
291
     1
 70
    58
 90
        1
176
     1
 90
        0
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A1
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Brighten
 70
    12
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
50.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A5
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
ColorChange
 70
    16
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        3
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     8
420
  8421504
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     8
420
  8421504
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9E
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Conceptual
 70
     9
177
     3
291
     0
 70
    58
 90
        3
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A0
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Dim
 70
    11
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
-50.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
172
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
EdgeColorOff
 70
    22
177
     3
291
     1
 70
    58
 90
        2
176
     0
 90
        2
176
     0
 90
        0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 40
30.0
176
     0
 62
     7
420
 16777215
176
     0
 90
        1
176
     0
 90
        4
176
     0
 62
     7
176
     0
 62
   257
176
     0
 90
        1
176
     0
 90
        1
176
     0
 40
1.0
176
     0
 90
        8
176
     2
 62
     7
176
     0
 40
1.0
176
     0
 90
        1
176
     0
 90
        6
176
     0
 90
        2
176
     0
 62
     7
176
     0
 90
        5
176
     0
 90
        0
176
     0
 90
        0
176
     0
290
     0
176
     0
 90
        1
176
     0
 40
0.0
176
     0
 90
        0
176
     0
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A4
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Facepattern
 70
    15
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
96
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Flat
 70
     0
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        1
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
97
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
FlatWithEdges
 70
     1
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        1
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
98
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Gouraud
 70
     2
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
99
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
GouraudWithEdges
 70
     3
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9D
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Hidden
 70
     6
177
     3
291
     0
 70
    58
 90
        1
176
     1
 90
        2
176
     1
 90
        2
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        2
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
170
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
JitterOff
 70
    20
177
     3
291
     1
 70
    58
 90
        2
176
     0
 90
        2
176
     0
 90
        0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 40
30.0
176
     0
 62
     7
420
 16777215
176
     0
 90
        1
176
     0
 90
        4
176
     0
 62
     7
176
     0
 62
   257
176
     0
 90
        1
176
     0
 90
        1
176
     0
 40
1.0
176
     0
 90
       10
176
     2
 62
     7
176
     0
 40
1.0
176
     0
 90
        1
176
     0
 90
        6
176
     0
 90
        2
176
     0
 62
     7
176
     0
 90
        5
176
     0
 90
        0
176
     0
 90
        0
176
     0
290
     0
176
     0
 90
        1
176
     0
 40
0.0
176
     0
 90
        0
176
     0
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A3
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Linepattern
 70
    14
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        7
176
     1
 90
        7
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
171
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
OverhangOff
 70
    21
177
     3
291
     1
 70
    58
 90
        2
176
     0
 90
        2
176
     0
 90
        0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 40
30.0
176
     0
 62
     7
420
 16777215
176
     0
 90
        1
176
     0
 90
        4
176
     0
 62
     7
176
     0
 62
   257
176
     0
 90
        1
176
     0
 90
        1
176
     0
 40
1.0
176
     0
 90
        9
176
     2
 62
     7
176
     0
 40
1.0
176
     0
 90
        1
176
     0
 90
        6
176
     0
 90
        2
176
     0
 62
     7
176
     0
 90
        5
176
     0
 90
        0
176
     0
 90
        0
176
     0
290
     0
176
     0
 90
        1
176
     0
 40
0.0
176
     0
 90
        0
176
     0
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9F
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Realistic
 70
     8
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17F
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded
 70
    27
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     8
420
  7895160
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        5
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17E
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded with edges
 70
    26
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        2
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        5
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17B
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shades of Gray
 70
    23
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        3
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
     7
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17C
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Sketchy
 70
    24
177
     3
291
     0
 70
    58
 90
        1
176
     1
 90
        2
176
     1
 90
        2
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
     7
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
       11
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        6
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A2
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Thicken
 70
    13
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
       12
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9C
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Wireframe
 70
     5
177
     3
291
     0
 70
    58
 90
        0
176
     1
 90
        2
176
     1
 90
        0
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17D
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
X-Ray
 70
    25
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
0.5
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
DICTIONARYVAR
  5
227
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
60.000000
  0
DICTIONARYVAR
  5
EB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1:1
  0
DICTIONARYVAR
  5
EA
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
AB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
1B4
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
1B5
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
5A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
5E
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
226
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14B
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
224
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
223
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
225
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
127
  0
DICTIONARYVAR
  5
228
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARY
  5
385
102
{ACAD_REACTORS
330
383
102
}
330
383
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
384
102
{ACAD_REACTORS
330
383
102
}
330
383
100
AcDbDictionary
281
     1
  3
1654967909088
350
37E
  3
1654967909104
350
37F
  3
1654967909120
350
380
  3
1654967909136
350
381
  3
1654967909152
350
382
  0
DICTIONARY
  5
388
330
1A9
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
389
  0
DICTIONARY
  5
191
330
22
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
185
330
93
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
186
  0
DICTIONARY
  5
183
330
92
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
184
  0
DICTIONARY
  5
10B
330
94
100
AcDbDictionary
280
     1
281
     1
  3
BUMPTILE
360
10D
  3
DIFFUSETILE
360
10C
  3
FBXASSET
360
187
  3
OPACITYTILE
360
10E
  3
REFLECTIONTILE
360
10F
  0
DICTIONARY
  5
386
330
1A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
387
  0
DICTIONARY
  5
FF
330
A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_ROUNDTRIP_2008_TABLESTYLE_CELLSTYLEMAP
360
37C
  0
XRECORD
  5
37E
102
{ACAD_REACTORS
330
384
102
}
330
384
100
AcDbXrecord
280
     1
  1
AcDb_Thumbnail_Schema
102
{ATTRRECORD
341
37F
  2
AcDbDs::TreatedAsObjectData
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
380
  2
AcDbDs::Legacy
280
     1
291
     1
102
ATTRRECORD}
  2
AcDbDs::ID
280
    10
 91
        8
102
{ATTRRECORD
341
381
  2
AcDs:Indexable
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
382
  2
AcDbDs::HandleAttribute
280
     7
282
     1
102
ATTRRECORD}
  2
Thumbnail_Data
280
    15
 91
        0
  0
XRECORD
  5
37F
102
{ACAD_REACTORS
330
384
102
}
330
384
100
AcDbXrecord
280
     1
  1
AcDbDs::TreatedAsObjectDataSchema
  2
AcDbDs::TreatedAsObjectData
280
     1
 91
        0
  0
XRECORD
  5
380
102
{ACAD_REACTORS
330
384
102
}
330
384
100
AcDbXrecord
280
     1
  1
AcDbDs::LegacySchema
  2
AcDbDs::Legacy
280
     1
 91
        0
  0
XRECORD
  5
381
102
{ACAD_REACTORS
330
384
102
}
330
384
100
AcDbXrecord
280
     1
  1
AcDbDs::IndexedPropertySchema
  2
AcDs:Indexable
280
     1
 91
        0
  0
XRECORD
  5
382
102
{ACAD_REACTORS
330
384
102
}
330
384
100
AcDbXrecord
280
     1
  1
AcDbDs::HandleAttributeSchema
  2
AcDbDs::HandleAttribute
280
     7
 91
        1
284
     1
  0
XRECORD
  5
389
102
{ACAD_REACTORS
330
388
102
}
330
388
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
XRECORD
  5
186
102
{ACAD_REACTORS
330
185
102
}
330
185
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
7581DE8E-A623-425F-9BF4-B3F4BE6C4F9A
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623B9A2F3B5FEC0000007C01000008000000636F72652E786D6C8D90416E83301045AF62CDB632D8040820E328B4E204BD80653BC44AB011B6AB1EBF262152BBEB6A467FFE9B197D76FA9EEFE84BAFDE38DB03CD08206DA553C64E3DC470C10DA01367AB73E1970D9015B3EE61
310
9381B3697571D925E96CD03624D53AA5775178AF0320794F4D0F5E5EF52C32114372F85BB608791393CEE8AB4B708C46A1E711A3D23E73317A055E0D4D53D6C71A9FC7A1C6657D18703354232ECFED4731B6B43CBED72CDF60CE82995FF7E5AA45D00A7841488B29C5A4F8A46547AAAEA8DE48D311C2F2CDFE078A8BFA2714
310
8D0D87627FF78979E0343DF21870966F59A4F2082AD52D37FE03504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623B6E137E0172010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C0810121947A1554ED00B38E05014B091B1518EDFE511A5A9D22AFD2A1F60CDEC7A67C698ED2E6D8306
310
69FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7166B4B65FCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B0FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2601EE7691A25EBC4DB1FF2C48B9255EEA5797C
310
F0A2FDE62D3C6C8268FD9A3032367366EBF6AAAE30525859621E52BAF182C0A3E17B106D69BC0DE3179A6E2965642CBF6B725DF96493AB955D858BDCB9ADC73C002113F1CD2D4464512F06D04338236388F09912BE0F1A028190AD3836571F67800659586D22604AED6ED4201A27612AF5E9F4A09F178CCC9D3075DA1C5C3F
310
9C113E3DE3F71DE1A885AAC084B0B03C3A3BEA64B38625B44E1A6FB017A4B46945F39C8D5F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F02504B0304140006080800AC70623BE001BAC07D0000009D0000000B0000006662782F636E782E786D6C4DCCD10AC2201886E15B91FFDCA6536B037548D87D8CE686
310
E4344CA3CB6F8B1D74F4C1C3C72B87CF1AD0DBE5974F51013D11402EDED3E4E3A2A096197780062D734AE5EF06288EAB53B03368B9E4549F074D6E1E6B289B061F1F07124689687987B9601C7373BD60C36E065B6A6DDF7341A93843A365F32B6DBB87F517504B0304140006080800AC70623B8E5068122901000012020000
310
310000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C8D515B6EC32010BC0AE22B55850D364E93081345557A825E801892A2C460F1A872FC2EB523B57FF961D1EECCECECAED8DFC71BFA36215AEF7ACC2A8A917183D7D65D7A9CD3996C30DA4B
310
11BC4F7F601839359A1E973496E2127C9E96D4E05D322E41D6796D96A48AD1248C861B7C7A1C872F33AA4AE5048878AD26355CD5C554AC8232E0A4882980013437292F96B465B46BF886F0AEE5841FDEDFC8A1FD3890233B1EB75BDE31D6AD453D13A5C8D9EA856E35D8B1676BC2B322852C45B2E3C3FE108C4A4663D950BA
310
258C11DA7C32BEA3DDAEE95EE96647A9A80BFC1F294FFA4952B62EB5CD6277A6452C99A8E78214DAE7D3ED61C6DC271F122AFD56D10C2F305545CB6A60FC1908E383E29A2F8A31F900EB5D5D4F8065DD2CBBE652D4E542107ECF07B15C53FE00504B0304140006080800AC70623B503B51794E010000330300003000000066
310
62782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F
310
77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347
310
DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F
310
504B0304140006080800AC70623B38FA165F680500003C100000340000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F6F626A656374732E786D6CAD575D6FA33814FD2B887D0E8424EDB42BCAA8499A2A1A756634D18CF6A15264C0A16CC146B6E9A4FBEBF7180C
310
019276B21F7908D8D8F7F3DCE36BFFE33ECFAC172A64CAD98DED3963DBA22CE271CA921BBB54BBD1956D7D0C7CC1B9EA2CB32D46727A63EB693BF013C1CBC24CC57447CA4C0D6657F33F2C1951466D2BCA889437B68C9E684E1C522A1E53F9ECC4441127D9ED1DCFA917F6C52682144F03A105119429588A790629566D94D7
310
1F8E6D37F05DFD3DF0F5BF59357D7B955BF9D3D79F32A9088B8E940DC44CBDD9F26E72713DBA98CDA6A3D9E5C41BCD57F3E5C8FB301D2F2E178BEBDBBB6B28964A4092B144D09D1DDC2336228D7CB7FED45A6C0C3F6552C419A351E53F3CAC6C3612635A5016238F2995D0D6F17ADC1F7A3A369DCF533D362ABBD3E779D5DD
310
D111D4D8DE3CBB96F2F04FB820CF41859054A3AA8E8F71B4C6DFF810B590F3CC7C4BA5951345454A322B4B4341C4AB1D60A95E12F83D311A9D42235C7B6007DE415ED75694C6AFB17BCACA5D99651A9A7650217B0BFC53252BCBD2BFA838AD0D36215765CAD4957148BD16D40EAE7DB79A0C7CFD984ECCC73A90D62E230952
310
0E37EBAF034717BAF6D64B3BF8B40AF71B5D8FA79517821754280D1F40AB495CF3D451326ABDB332A737C0995ECC0F41F986C87F46F91E4C41DE44BA9FED67468B1284C91D173972E38CAB9F356E5E46EDDBF10BF86CB0FA784D3BF3AF16FB6E6B6C9F30DECA1FC0A55373F5DFF3D78F5917A99DF405FE0B0A8C8BA909E526
310
2219A8E72165488806A595714C81CB77E1DE0ED6604A303B76912C680372F4E2BB2FF88EFF5A36D8AA52DF79322474C0B767303F625995056C7B032C473C592936CEBD15F38BFFA5666E979B4F9B52EC48441F0CB12CE92E65A9C2D979006FD7A05E227A1E3DD3D79F5CC470F438099B6E1272A34A22DA3AE63AF0497358E8
310
C141734F41847D09D79CE7FF42C3432A239A6584515E365ADA634863B52519D327A00AEB804E2703140BFA92EA4EA2B7A26716CEFA48A4850E597BE8B53CEDBCE1CBF7F56780D20EE6AF73A0F5F9B02A3CD07DC4332EB6E1EBB666421BE0C39E3EBA7FF4E16D22EA6A29407C85E586724C88B771BADB9512BC7B228A3FD68B
310
6EA65A22397E690AA8D158D7E40CEC8CDA23C2C0B7D1898640101CEC9C6D531CE328CB93CABBBA870A6425F70DF96199175B92F392A973C2346EFC69AC6F8577BB18F993A8E8C90E36D573340765C7343EA4AA87027D049DF0A9979E0F1757DEF2EEEA6E747B39412B35B9588DAEE7ABD9683E5DCDE677978BD9EAFAB6B5A8
310
B224F09B13AA5B8388264E44BF14A909F3F7F5A16CEDE08128E9DED705E526F5F3FBDA415BECBBD80380B71BD77991D19C3245347C1FF44BF68DA0ABE8C9A8E7D73949E81952BEDC6F063660E68C7D5F75A9D19F83BD6676A16BE1A410F554E621236936D8681C770A9618B79B50B6CF9AD19BA11E9978A20F953C4B63104E
310
6C2594E7548176CE607B915309C474BBF2D8DC1ECED8FD52F7838A84196D2C79226889330954036E65A4FAF3D66F68E174177563E3B0739EF1670AD1B690EA1B1BFCA6D2884A27C4F1A81B9F4A3820802EAC2541408DB02443675D6F6AC7ED2E1D1BD00F4E40A3BF5D724EB764FCEA116F4E8A02A7768F562BDB8C82E81F39
310
DE98631185D7B054AD2F8789D6994A0D2AAB76CADC0DD0423C1BD57BD4D7FB6E794EB5A61791B3EE49EF82A0963A524424D5BD40DB674CBA5D7E75D10A58EB2F569195097279BEA491A00073A90B1C28022A8CCC82284075F1FBE357C17117CDAD550A083C2E789E736606B7E62E6B6D9E70338D1F410B545F3FE464EC798F
310
55D76F2E22DB9048EA90583E63A22938EDC1006B00E4D1716A52E0EA1C0C96AF9796393066105A81F6A829ADAFE1168A47DF1C75A974C9B278B7F177ABA5008340CB1EFC0D504B0304140006080000AC70623B000000000000000000000000350000006662782F30333130353234382D343533342D344143372D413346412D
310
4531454539393435313135362F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E636660600000504B0304140006080000AC70
310
623B000000000000000000000000370000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30333130353234382D343533342D344143372D41
310
3346412D4531454539393435313135362F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11D
310
E607FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BF2C5666EFF000000A00100003B0000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F7265736F7572636573
310
2F636F72652E786D6C8D504B6E833010BD0A9A6D65B00910888CA3D02A27E8052C33A156821DF953F5F8B5132AB5BB6E6646EFA3797AFCF8B5DE8A4F745E5B33022B291468949DB5594688E1427A288E823B6BC32F191446AE38428641F0C5D978DF20654D4013126AEC8C1B28BDC70085BAA56304AF3E7095A58C2129FCB5
310
BC4B75950B96AC4C74D209EE834B018AE7933C4138F4363A859E574F56F018F5BC69F49C7EEA8B4607A29DFABEE9F62D399DA78E34DD6E22FDD49E49731ADEEAF3C09AFD6BC7AB6C163CE8F527A3722803CE206A4A07C218A1F53B6B0EB43DD4ED0BED0F94F22ACBFF98E27DFEA7296A1376F516F769F320580AF22004AF72
310
5F693DCA4C3B772BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B200
310
00005B436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623B9A2F3B5FEC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D
310
6C504B01021400140006080800AC70623B6E137E0172010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623BE001BAC07D0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B010214001400060808
310
00AC70623B8E506812290100001202000031000000000000000000000000005B0500006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D3
310
0600006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6C504B01021400140006080800AC70623B38FA165F680500003C10000034000000000000000000000000006F0800006662782F30333130353234382D343533342D344143372D413346412D4531
310
454539393435313135362F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000290E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F76657274696365732E62696E504B01021400
310
140006080800AC70623BF270F133060000000400000036000000000000000000000000007C0E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000
310
000000000000000000D60E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD1900000004101000036000000000000000000000000002B0F00006662782F30333130353234382D
310
343533342D344143372D413346412D4531454539393435313135362F6469726563746F72792E786D6C504B01021400140006080800AC70623BF2C5666EFF000000A00100003B000000000000000000000000000F1000006662782F30333130353234382D343533342D344143372D413346412D453145453939343531313536
310
2F7265736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000671100000000
  0
XRECORD
  5
184
102
{ACAD_REACTORS
330
183
102
}
330
183
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
778E3A9F-1AF3-452F-85C1-1BC15BD3F630
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BFD5588D4EC0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103891DC7C24471939CA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EF81EEFE8CBCCC17AD7012D0820E394D7D60D1DA478C50DA083E0B3F7F1970D9093A3E960
310
9141F061F6695A25E55D342E66D5796D56518660222075CF4D07417D9A511632C5EC08B76292EA260753D05797E194AC46CF2356E77DF66ACD0C62C768BD63971E5727D2E06DDF9C71BF7B3FE10BABF79BFA488FE4DCF07281058F767CDD57B391D168108C903DA61413F641B72DA95A56BD91A62584978BFD0F9426FD4F28
310
5917376C7DF7890510343FF218085E2E59E4F2082AD72537F103504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB5D38BAD72010000D40300000C0000006662782F636F72652E786D6CC553DB8E823014FC95A6AF1B68C11B9A52A3AB7EC1FE4085CA36424B4A4BFCFC3D5C8CEBC635EED3F200CDCC393D3353CAD697AA44AD
310
B48D323AC5514831923A33B9D2458ABD3B0509466BCEAC31EE5B19465A5432C51D8C392BACF1F50865463BA91DA0DAE4720445D348875156C222C54DF6292B110AEFA0A23987B5C8CEA2906114020D759C35CE8200340CE9DE989F8E1746069C33EF553EB22A8769EAA4A4C57C1147F3457CD806B31D4D82E936D907DBC5FB
310
2E38C4F3E564BE8936749F30D23573E65475559759299CCC318F295D065114D0F8239AAEE86C15CFDE68B2A29491AEFCAEC9D7F98B4D5E69378947B9435B837904427AE2875B88C8A146B4A0877046BA10E1D3277C1F340402213B712CAF3ECE00B53273C64E81C98DBF51AD28BD84A934A4FD837E5F303274C2D47E7370FD
310
7046FCF28CE73BC2510B5D8009E16079F4AED3C9060D6368B5B441EB2E481B5B89F2351B4F1CFE89BA897F282933A5B1FFA5888C0744C6DF8374F7917F01504B0304140006080800AC70623B09885E1C7E0000009D0000000B0000006662782F636E782E786D6C4DCCDF0A83201C86E15B91DFB9CBA6FD11D41063F711CB42
310
663A9C8E5DFE6A74B0A30F1E3E5E317C368FDE36BD5C0C12EA0B0164C33DCE2EAC124A5E700F685022C598FF6E80C2B459090783126B8AE579D26C97A9F8BCAB77E17122E586D5843498B3EE8699D114F39E5E713D76EDA84DCBB569A052A2FA95F63DC2EA0B504B0304140006080800AC70623B961D28872A010000120200
310
00310000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C8D515B6EC32010BC8AC557AA0A1BFC4A1C61A2C8514FD00B10435294182C1E558EDFA576A4F62F3F80666766875D76784CF7EC5B39AFADE911CD09CA9419ADD4E6DAA3182E7887B203
310
67CEDAF08786322326D5A30423CEAECEC67985466B8232015063A55A41E1BD0A281BEFF0E8911FBFD42472110330FC2D9FC578135795D31CCAC0E3CC070701B2A5493A11AFBAA1A68434B8ABB71FB81E8E15EE765589E969DB9E8E43DB1D8786158B90B318B55CE55A421C7DD1CABD6A92C49C053D3DE38F4E89A024E22521
310
1DA61493F293D67BD2ECCBE69DECF684B022D1FF89E22C5F14456D4255AE711799479CB2622970266D3CDF9F61D463B62E64A9DFC6ABF10D7192C35CCA0A040B11BE0F8E6DBD3AFA601D8C77733B0397C290926D5B7356A40DC1F5BB3EB8D336F90F504B0304140006080800AC70623B503B51794E01000033030000300000
310
006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1E
310
BC4F77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C54
310
2347DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F
310
103F504B0304140006080800AC70623B2EA4D28F640500003C100000340000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F6F626A656374732E786D6CAD575D739B3814FD2B0CFB6C30B1D3263B844E6CC71D4F376DA79E76F621331E01326103122389C4E9AFDF
310
231018B09D7A3FFC609090EEE7B94757FE875D9E59CF54C894B31BDB73C6B64559C4E394253776A9B6A32BDBFA10F88273D559665B8CE4F4C6D6D376E027829785998AE99694991ACC2E677F5A32A28CDA569411296F6C193DD29C38A4543CA6F2C98989224EB2DD399E532FEC8B4D04291E07420B222853B014F30C52ACDA
310
28AF3F1CDB6EE0BBFA7BE0EB7FB36A727A955BF9D3D79F32A9088B0E940DC44CBCE9E2EEE2F27A74399D4E46D37717DE68B69C2D46DEFBC978FE6E3EBFBEBDBB8662A90424194B04DDDAC147C446A491EFD69F5A8B8DE1C74C8A386334AAFC878795CD46624C0BCA62E431A512DA3A5E8FFB434FC7A6F379A2C7466577FA3C
310
AFBA3B3A821ADB9B67D7521EFE0517E439A810926A54D5F1318ED6F81BEFA316729E996FA9B472A2A84849666569288878B5032CD54B02BF2746A35368846B0FECC0DBCBEBDA8AD2F835768F59B92DB34C43D30E2A646F807FAA646559FA938AE3DA60137255A64C5D1987D46B41EDE0DA77ABC9C0D78FC985F95807D2DA66
310
2441CAE166FD75E0E85CD7DE6A61079F96E16EADEBF1B8F242F0820AA5E1036835896B9E3A4A46AD7756E6F40638D38BF93E28DF10F9CF28DFBD29C89B4877D3DDD468518230B9E522476E9C71F5B3C6CDCBA87D3B7C019F0D561FAE6967FED562DF6D8DED13C6A9FC015C3A3557FF3D7FFD987591DA495FE03FA3C0B89898
310
50AE2392817AEE53868468505A19C714B87C1BEEEC6005A604B36317C9823620072FBEFB8CEFF8AF6583AD2AF59D274342077C7B06F323965559C0B6136039E0C94AB171EE54CC2FFF979AB95DAC3FAD4BB12511BD37C4B2A0DB94A50A67E71EBC5D837A89E879F4445F5FB888E1E86112D6DD24E4469544B475CC75E093E6
310
B0D083BDE69E8208FB12AE39CFFF8586FB544634CB08A3BC6CB4B4C790C66A4B32A64F4015D6019D5C0C502CE873AA3B89DE8A9E5938EB2391163A64EDA1D7F2B473C297EFABCF00A51DCC5EFF20AF5DC20CF7741FF18C8B4DF8BAA999D006F8B0A78FEE1F7D789B88BA5A0A105F61B9A11C13E24D9C6EB7A504EF1E89E28F
310
D5BC9BA996480E5F9A026A34D63539053BA3F68830F06D74A2211004073B679B14C738CAF2A8F2AEEEA10259C93D213F2CF36243725E32754E98C68D3F8DF5ADF06E17235F888A1EED605D3D473350764CE31309D547D0119F7AE979FFFEEA6E727BBD1C79B74BB4529717CBD1D5E5DC1B79B3B977395B4C96EF2638E6FA15
310
D09C50DD1A44347122FAA5484D98BFAFF6656B07F74449F7635D506E523FBFAF1CB4C5BE8B3D0078BB71951719CD295344C3F75EBF64DF08BA8A9E8C7A7E9593849E21E5CBC7F5C006CC9CB1EFAB2E35FA32D86B66E7BA168E0A518F651E329266838DC671A7608971BB0965FBAC19BD19EA918927FA50C9B33406E1C45642
310
794E1568E70CB6173995404CB72B8FCDEDE18CDDCF753FA84898D1C6924782963893403548A78C547FDEFA0D2D9CEEA26E6C1C76CE13FE4C21DA16527D6383DF541A51E984381E75E353090704D085B52408D0139664E8ACEB4DEDB8DDA56303FAC10968F4B74BCEE9968C5F3DE2CD4951E0D4EED16A659B5110FD23C71B73
310
2CA2F01A96AAF5653FD13A53A909C03570A77DA0857832AA77A8AFB7DDF29C6A4D2F2267DD93DE04412D75A48848AA7B810EBA31E976F1D5452B60ADBE58455626C8E5F992468202CCA52E70A008A830320BA200D5F9EF0F5F05C75D34B7962920F030E779CE9919DC9ABBACB57EC4CD347E002D507DFD901763CF7BA8BA7E
310
7311D984445287C4F209134DC1690F065803200F8E53733D73750E06CB570BCB1C185308AD407BD094D6D7700BC5A36F8EBA54BA6459BCD9F8BBD552A040A0650FFE06504B0304140006080000AC70623B000000000000000000000000350000006662782F33394334313030352D393437462D344341332D393833322D3144
310
373644414336394143352F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B
310
000000000000000000000000370000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F33394334313030352D393437462D344341332D393833
310
322D3144373644414336394143352F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607
310
FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623B95BFD5E5FE000000A00100003B0000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265736F75726365732F63
310
6F72652E786D6C8D50596E833010BD0A9ADFCA603B1B41C611699213F40296992456828DBC543D7E4DA052FBD79F99D15B344F4F1CBE8667F1893E18675B60258502AD76BDB1B71652BC921A8A8314DEB9F84B06855503B630C120C5CDBB342E907636A28D19B5AEC70554216084423FF3D142D0771C54A952CC8AF02847A5
310
1FEA86252B339D755284E87380627E324D901E834B5E6310D5CC4A9192E9178DE9F34F7335E841EE38DBEEF8A5239B13ADC9FA589FC971F77E2217BEDDAFB61DEBE8B916D56496229AE127A3F6A822F62039A57BC218A1FC83AD1BBA69F8E68DD60DA5A29AE47F4C69ECFF694AC6C6155FE2CEB60092E5202F428A6AEA2BAF
310
5799794FDDCA6F504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B
310
436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BFD5588D4EC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D6C504B
310
01021400140006080800AC70623BB5D38BAD72010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623B09885E1C7E0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B01021400140006080800AC70
310
623B961D28872A0100001202000031000000000000000000000000005C0500006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D5060000
310
6662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6C504B01021400140006080800AC70623B2EA4D28F640500003C1000003400000000000000000000000000710800006662782F33394334313030352D393437462D344341332D393833322D3144373644
310
414336394143352F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000270E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F76657274696365732E62696E504B01021400140006
310
080800AC70623BF270F133060000000400000036000000000000000000000000007A0E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000000000
310
000000000000D40E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000290F00006662782F33394334313030352D393437
310
462D344341332D393833322D3144373644414336394143352F6469726563746F72792E786D6C504B01021400140006080800AC70623B95BFD5E5FE000000A00100003B000000000000000000000000000D1000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265
310
736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000641100000000
  0
XRECORD
  5
10D
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10C
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
187
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
 70
     0
 90
1778669749
  1
7E355024-1ABF-47F9-966E-F2159FBE82AB
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BDCE527C8EB0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103B15DC7C24471249FA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EFA9EEFE8CBACC17AD7032D0820E394D7D64D3DA478C52DA093E0ABF7F1970D9093B3E961
310
9341F069F569D925E55D342E66D5796D76518660222075CF4D0F417D9A591632C5EC08B76291EA262753D05797E194AC46CF2356E77DF66ACD0A621C9B73335C463C5E0E1457EC9DE2A1612D3E9233A92BD2D66333F07283058F767EDD57AB91D168108C9023A61413F641AB8ED41DABDF48DB11C2CBCDFE074A8BFE2794AC
310
8B07B6BFFBC402089A1F790C042FB72C72790495EB969BF801504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF32603847
310
2BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB24894EB71010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C085012194749244ED00B38E05014B091B1518EDFE511A5A9D228FD2A1F60CDEC7A67C6986D2F6D830669
310
FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7266B4B6DFCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B4FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2609EE7C92ED91F722F3FAC022F0ADF036F9F84A9
310
B7A63B1A47348DF364CFC8D8CC99ADDBABBAC2486165897948E9DA0B028F861F41B4A1F1268CDF68BAA19491B1FCAEC975E58B4DAE5676152E72E7B61EF300844CC40FB7109145BD18400FE18C8C21C2674AF83E68080442B6E2D85C7D9C011A6461B5898029B5BB5183689C84A9D4A7D3837E5F303277C2D4697370FD7046
310
F8F28CE73BC2510B5581096161797476D4C9660D4B689D34DE602F4869D38AE6351B4F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F01504B0304140006080800AC70623B3A54DFB77D0000009D0000000B0000006662782F636E782E786D6C4DCCD10A83201805E05791FFDEA5EBA76DA046A37C8F581632D3
310
613AF6F8B3D1C52E0E073E0E47B49FD591B7899B0D5E023F3120C63FC264FD2221A7995E81B44AC410D2DF0C881F5723616750628921BF0E9ACC3C66978A3AEB9F07B2A6D77AB87514F95953EC39D20EEF9C6AD60C88BC2EB940A544F57B2ABD1FAB2F504B0304140006080800AC70623B4A17098729010000120200003100
310
00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C8D515B6EC32010BC0AE22B55850D0E76930813A54A7C825E80DA244589C1E251E5F85D6A476AFFF2018B7667666759B1BF8F37F4AD7D30CEB6981514236D7B37187B69718A67B2C1682F8577
310
2EFE816164D5A85B9CD3588A8B77695A52BDB351DB0859EB06BD2455083A62D4DFE0D1E2D07FE951152A4540846B31A9FEAA2EBA600594012745881E0CA0B949BEB1A4CDB1EB4EDB03E1ACEA083F324E0EFC9D918E3627CED91ACE9B2867A214299961A19B01EC98B3D1FE59914C96229AF161BFF75A453D605951BA258C11
310
5A7D30BEA3F5AEAA5FE96647A92833FC1F294DC393A4646C5C578BDD9916B064A29C0B520C2E7DDE1E66F47D723EA2DC6F1574FF02531594D6AC69443903617C506CF8A218A2F3F0BDABEB2760593DCB365C8A326F08C2EFFA20E66DCA1F504B0304140006080800AC70623B503B51794E0100003303000030000000666278
310
2F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F7736
310
4A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347DEE0
310
50F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F504B
310
0304140006080800AC70623BD8F6D0D5660500003B100000340000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F6F626A656374732E786D6CAD575B8F9B3814FE2B887D064292B964C5504D92491555D3568D5AEDC348910187610730B2CD4C667FFD7E06438024
310
6DF6928780CDF1B97EE762EFC33E4B8D57CA45C2F23BD3B547A641F39045491EDF99A5DC59B7A6F1C1F73863B243661A39C9E89DA9B64DDF8B392B0BBD15D11D295339D85DCDFF304448736A1A614A84B83345F84C33629352B2888A173B2292D8F16E6FBB764DD8671B73523C0F981684D35C4253ECE7E062D44AB9FDE5C8
310
747CCF51DF7D4FFD6BAAC9792AA7B2A72F3FC985247978246CC066E24E970FE3AB9975359D4EACE9F5D8B5E6ABF9D2726F26A3C5F56231BB7F9841B0901C9CB4269CEE4CFF237CC393D073EA4FADC65AF1532A852CCF6958D90F0B2B9D35C78816348F10C7840A48EB583DEA2F5DE59BCEE7895A6B91DDEDCBACEA9EE8306A
310
746F9E5D4D59F0274C1097A0820BAA5055FB471B5AE36F74F05AC058AABF25C2C888A43C21A991260127FCDDF441AA487CAFC746A1932B842B0B4CDF3DF0EBEA8AD4F835764F69B92BD35441D3F42B646F817F2A45A559F217E5A7A54127C4AA4C7279AB0D92EF0535FD99E7549BBEA71E93B1FE583BD2D8A52446C86166FD
310
7560E842E5DE7A69FA9F56C17EA3F2F1B4F082B38272A9E0036835816B9ECA4B5AAC7B51E4D40118D3F3F9C129DFE0F9CF48DF832A881B4FF6D3FD544B919CE462C77886D8D8A3EA678C9A17AB7D3B7E413D1B501FD3B43BFF8AD8735A65FB05E35CFC002E159ADBFF1EBFBECFBA48ED84CFF75E91608C4FB42B372149517A
310
1E931C0151A03452862DD4F25DB037FD352A252A3B4E91D46F1D72F4E239AFF88EFF9A37AA5525BEF3CC11D041BDBDA0F2C397555A40B7336039AA9395606DDC399F5FFD2F3973BFDC7CDA947C4742FAA80BCB92EE923C91E89D07F07615EA05A267D10B7D7F633C82A1C741D8748390695102DE563E578E8F9B66A11607C9
310
3D0121CEC54CD53CEF17121E1311D2342539656523A56D430AAB6D91D17302B2B076E8643C4031A7AF899A247A143DB5D0EB439E14CA656DD36BEBB47DC696EFEBCF0025E8531690F440141CAA7DC852C6B7C1FBB62E8426B087237D70FFE8A35B3BD4515C00F80ACA4DC5D11EDE46C96E570A94DD134EFCB15E7403D5D691
310
E397267F1A89754A4E519C917A846BF43632310F7082BECEF26D822E8EAC3C29BC2B7B2840547CCFF00FCAACD8928C95B9BCC44DA3C69E46FB96797788116F4486CFA6BFA99ED61C153BA2D121543D10A80E74C2A65E786E1E265757A3F1D472EFE72B6B7AB39A59B3EBEB076B3576AF66ABF9C3EDF87EDE6A5469E27B4D83
310
EAA620BC8986E8953CD16EFEBE3E64ADE93F12299C8F753E3971FDFCBEB631157B0ECE00DFEDC17556A434A3B9240ABD8FEA25FD463054F478D4FBEB8CC4F4022E5F3E6E063A60E782735F55A6D1B7C159BDBB50B97092897C2EB32027493A38A80DB78B3CD66637AE6C9F75416F966AA5FD893154B03489506F2223A62CA3
310
1255E78262CF332A8098EE501EE9CBC305A75FEB71509220A58D26CF0413712A806AC0AD0C657FDFF80D139C1AA2EE4CF43AFB057F3A114D03A1BE3351DE6412526107E88E6AEEA998030218C2DA1A08A8913C4E3158D787DA757B4AF906E5070D50CB6F492E1996B45DBDBA9B91A240D3EE55D54A372D20FC478637EA1844
310
E23528656BCB61A335A61283CCAA8DD257034C102F5AF41EF9F573B35CBBA2E979E4A26BD24F415073B524E171752D50FA6995EE975F1D4C02C6FA8B51A4658C585ECEC9E214602E558203454085E6591009A82E7E7FFACA19AEA299B14A0081A705CB3296EBC5BDBECA1A9B675C4CA3279405AA6E1F623C72DDA76AE8D7F7
310
906D4004B549245EB0D1249CB260803500F2A89BEA10382A0603F2F5D2D00D630AA615688F66D2FA166E2079D4C551A54AB758163F9DFB9D8A1460E098D8FDBF01504B0304140006080000AC70623B000000000000000000000000350000006662782F30364446464539412D343132462D344431342D413442312D46303645
310
34343133343431372F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B0000
310
00000000000000000000370000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30364446464539412D343132462D344431342D413442312D
310
4630364534343133343431372F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607FB14
310
4396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BB40F7AF9FE000000A00100003B0000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F75726365732F636F72
310
652E786D6C8D504B6E833010BD0A9A6D65B00950828CA3109513F4029699502BC146FE543D7E4D42A576D7CDCCE87D344F8F9FBE967BF689CE6B6B7A6039850C8DB29336730F315C490BD94970676DF82583CCC8057BD860107C7636AE3BA4AC096842428D9D7007A5F7182053F774F4E0D5072E3297312485BFE5AB543739
310
63CEF244279DE03EB814207B3ED9260887DE46A7D0F3E2C90A1EA39E768D9ED24F7DD5E8408C63736E86CB1B192F0746AAF29591A1295B72A4675A57B4ADC766E0C566163CE8E527A37228034E204A4A8F843142CB775675B4EECAFA85B61DA5BCD8E47F4C719DFE698ADA8443B9C77DDA3C0896823C08C18BADAFB41E65A6
310
BD752BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B436F
310
6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BDCE527C8EB0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000094020000636E782E786D6C504B0102
310
1400140006080800AC70623BB24894EB71010000D40300000C00000000000000000000000000180300006662782F636F72652E786D6C504B01021400140006080800AC70623B3A54DFB77D0000009D0000000B00000000000000000000000000B30400006662782F636E782E786D6C504B01021400140006080800AC70623B
310
4A17098729010000120200003100000000000000000000000000590500006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D10600006662
310
782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6C504B01021400140006080800AC70623BD8F6D0D5660500003B10000034000000000000000000000000006D0800006662782F30364446464539412D343132462D344431342D413442312D46303645343431
310
33343431372F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000250E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F76657274696365732E62696E504B010214001400060808
310
00AC70623BF270F13306000000040000003600000000000000000000000000780E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E504B01021400140006080000AC70623B00000000000000000000000037000000000000000000
310
00000000D20E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000270F00006662782F30364446464539412D343132462D
310
344431342D413442312D4630364534343133343431372F6469726563746F72792E786D6C504B01021400140006080800AC70623BB40F7AF9FE000000A00100003B000000000000000000000000000B1000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F
310
75726365732F636F72652E786D6C504B0506000000000E000E0080040000621100000000
  0
XRECORD
  5
10E
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10F
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
387
102
{ACAD_REACTORS
330
386
102
}
330
386
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
CELLSTYLEMAP
  5
37C
102
{ACAD_REACTORS
330
FF
102
}
330
FF
100
AcDbCellStyleMap
 90
        3
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
    32768
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.25
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        1
 91
        1
300
_TITLE
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        2
 91
        1
300
_HEADER
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        2
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        3
 91
        2
300
_DATA
309
CELLSTYLE_END
  0
ENDSEC
  0
SECTION
  2
ACDSDATA
 70
     2
 71
     8
  0
ACDSSCHEMA
 90
        0
  1
AcDb_Thumbnail_Schema
  2
AcDbDs::ID
280
    10
 91
        8
  2
Thumbnail_Data
280
    15
 91
        0
101
ACDSRECORD
 95
        0
 90
        1
  2
AcDbDs::TreatedAsObjectData
280
     1
291
     1
101
ACDSRECORD
 95
        0
 90
        2
  2
AcDbDs::Legacy
280
     1
291
     1
101
ACDSRECORD
  1
AcDbDs::ID
 90
        3
  2
AcDs:Indexable
280
     1
291
     1
101
ACDSRECORD
  1
AcDbDs::ID
 90
        4
  2
AcDbDs::HandleAttribute
280
     7
282
     1
  0
ACDSSCHEMA
 90
        1
  1
AcDbDs::TreatedAsObjectDataSchema
  2
AcDbDs::TreatedAsObjectData
280
     1
 91
        0
  0
ACDSSCHEMA
 90
        2
  1
AcDbDs::LegacySchema
  2
AcDbDs::Legacy
280
     1
 91
        0
  0
ACDSSCHEMA
 90
        3
  1
AcDbDs::IndexedPropertySchema
  2
AcDs:Indexable
280
     1
 91
        0
  0
ACDSSCHEMA
 90
        4
  1
AcDbDs::HandleAttributeSchema
  2
AcDbDs::HandleAttribute
280
     7
 91
        1
284
     1
  0
ACDSRECORD
 90
        0
  2
AcDbDs::ID
280
    10
320
22
  2
Thumbnail_Data
280
    15
 94
      896
310
89504E470D0A1A0A0000000D49484452000001000000009108030000001BE1960600000300504C5445212830FFFFFF2128300000000000000000000000000000000000000000000000000000330000660000990000CC0000FF0033000033330033660033990033CC0033FF0066000066330066660066990066CC0066FF0099
310
000099330099660099990099CC0099FF00CC0000CC3300CC6600CC9900CCCC00CCFF00FF0000FF3300FF6600FF9900FFCC00FFFF3300003300333300663300993300CC3300FF3333003333333333663333993333CC3333FF3366003366333366663366993366CC3366FF3399003399333399663399993399CC3399FF33CC00
310
33CC3333CC6633CC9933CCCC33CCFF33FF0033FF3333FF6633FF9933FFCC33FFFF6600006600336600666600996600CC6600FF6633006633336633666633996633CC6633FF6666006666336666666666996666CC6666FF6699006699336699666699996699CC6699FF66CC0066CC3366CC6666CC9966CCCC66CCFF66FF0066
310
FF3366FF6666FF9966FFCC66FFFF9900009900339900669900999900CC9900FF9933009933339933669933999933CC9933FF9966009966339966669966999966CC9966FF9999009999339999669999999999CC9999FF99CC0099CC3399CC6699CC9999CCCC99CCFF99FF0099FF3399FF6699FF9999FFCC99FFFFCC0000CC00
310
33CC0066CC0099CC00CCCC00FFCC3300CC3333CC3366CC3399CC33CCCC33FFCC6600CC6633CC6666CC6699CC66CCCC66FFCC9900CC9933CC9966CC9999CC99CCCC99FFCCCC00CCCC33CCCC66CCCC99CCCCCCCCCCFFCCFF00CCFF33CCFF66CCFF99CCFFCCCCFFFFFF0000FF0033FF0066FF0099FF00CCFF00FFFF3300FF3333
310
FF3366FF3399FF33CCFF33FFFF6600FF6633FF6666FF6699FF66CCFF66FFFF9900FF9933FF9966FF9999FF99CCFF99FFFFCC00FFCC33FFCC66FFCC99FFCCCCFFCCFFFFFF00FFFF33FFFF66FFFF99FFFFCCFFFFFF0000000D0D0D1A1A1A2828283535354343435050505D5D5D6B6B6B787878868686939393A1A1A1AEAEAEBB
310
BBBBC9C9C9D6D6D6E4E4E4F1F1F1FFFFFF0000000000000000000000000000000000000000000000000000000000002E4550F10000003B4944415478DAEDC13101000000C2A0F54F6D0B2FA0000000000000000000000000000000000000000000000000000000000000000000000000CE06919100016C9A5B1B0000000049
310
454E44AE426082
  0
ENDSEC
  0
EOF
`;var A$e=`  0
SECTION
  2
HEADER
  9
$ACADVER
  1
AC1032
  9
$ACADMAINTVER
 90
      174
  9
$DWGCODEPAGE
  3
ANSI_936
  9
$LASTSAVEDBY
  1
win10
  9
$REQUIREDVERSIONS
160
                 0
  9
$INSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$EXTMIN
 10
1.000000000000000E+20
 20
1.000000000000000E+20
 30
1.000000000000000E+20
  9
$EXTMAX
 10
-1.000000000000000E+20
 20
-1.000000000000000E+20
 30
-1.000000000000000E+20
  9
$LIMMIN
 10
0.0
 20
0.0
  9
$LIMMAX
 10
12.0
 20
9.0
  9
$ORTHOMODE
 70
     0
  9
$REGENMODE
 70
     1
  9
$FILLMODE
 70
     1
  9
$QTEXTMODE
 70
     0
  9
$MIRRTEXT
 70
     0
  9
$LTSCALE
 40
1.0
  9
$ATTMODE
 70
     1
  9
$TEXTSIZE
 40
0.2
  9
$TRACEWID
 40
0.05
  9
$TEXTSTYLE
  7
Standard
  9
$CLAYER
  8
0
  9
$CELTYPE
  6
ByLayer
  9
$CECOLOR
 62
   256
  9
$CELTSCALE
 40
1.0
  9
$DISPSILH
 70
     0
  9
$DIMSCALE
 40
1.0
  9
$DIMASZ
 40
0.18
  9
$DIMEXO
 40
0.0625
  9
$DIMDLI
 40
0.38
  9
$DIMRND
 40
0.0
  9
$DIMDLE
 40
0.0
  9
$DIMEXE
 40
0.18
  9
$DIMTP
 40
0.0
  9
$DIMTM
 40
0.0
  9
$DIMTXT
 40
0.18
  9
$DIMCEN
 40
0.09
  9
$DIMTSZ
 40
0.0
  9
$DIMTOL
 70
     0
  9
$DIMLIM
 70
     0
  9
$DIMTIH
 70
     1
  9
$DIMTOH
 70
     1
  9
$DIMSE1
 70
     0
  9
$DIMSE2
 70
     0
  9
$DIMTAD
 70
     0
  9
$DIMZIN
 70
     0
  9
$DIMBLK
  1

  9
$DIMASO
 70
     1
  9
$DIMSHO
 70
     1
  9
$DIMPOST
  1

  9
$DIMAPOST
  1

  9
$DIMALT
 70
     0
  9
$DIMALTD
 70
     2
  9
$DIMALTF
 40
25.4
  9
$DIMLFAC
 40
1.0
  9
$DIMTOFL
 70
     0
  9
$DIMTVP
 40
0.0
  9
$DIMTIX
 70
     0
  9
$DIMSOXD
 70
     0
  9
$DIMSAH
 70
     0
  9
$DIMBLK1
  1

  9
$DIMBLK2
  1

  9
$DIMSTYLE
  2
Standard
  9
$DIMCLRD
 70
     0
  9
$DIMCLRE
 70
     0
  9
$DIMCLRT
 70
     0
  9
$DIMTFAC
 40
1.0
  9
$DIMGAP
 40
0.09
  9
$DIMJUST
 70
     0
  9
$DIMSD1
 70
     0
  9
$DIMSD2
 70
     0
  9
$DIMTOLJ
 70
     1
  9
$DIMTZIN
 70
     0
  9
$DIMALTZ
 70
     0
  9
$DIMALTTZ
 70
     0
  9
$DIMUPT
 70
     0
  9
$DIMDEC
 70
     4
  9
$DIMTDEC
 70
     4
  9
$DIMALTU
 70
     2
  9
$DIMALTTD
 70
     2
  9
$DIMTXSTY
  7
Standard
  9
$DIMAUNIT
 70
     0
  9
$DIMADEC
 70
     0
  9
$DIMALTRND
 40
0.0
  9
$DIMAZIN
 70
     0
  9
$DIMDSEP
 70
    46
  9
$DIMATFIT
 70
     3
  9
$DIMFRAC
 70
     0
  9
$DIMLDRBLK
  1

  9
$DIMLUNIT
 70
     2
  9
$DIMLWD
 70
    -2
  9
$DIMLWE
 70
    -2
  9
$DIMTMOVE
 70
     0
  9
$DIMFXL
 40
1.0
  9
$DIMFXLON
 70
     0
  9
$DIMJOGANG
 40
0.7853981633974483
  9
$DIMTFILL
 70
     0
  9
$DIMTFILLCLR
 70
     0
  9
$DIMARCSYM
 70
     0
  9
$DIMLTYPE
  6

  9
$DIMLTEX1
  6

  9
$DIMLTEX2
  6

  9
$DIMTXTDIRECTION
 70
     0
  9
$LUNITS
 70
     2
  9
$LUPREC
 70
     4
  9
$SKETCHINC
 40
0.1
  9
$FILLETRAD
 40
0.0
  9
$AUNITS
 70
     0
  9
$AUPREC
 70
     0
  9
$MENU
  1
.
  9
$ELEVATION
 40
0.0
  9
$PELEVATION
 40
0.0
  9
$THICKNESS
 40
0.0
  9
$LIMCHECK
 70
     0
  9
$CHAMFERA
 40
0.0
  9
$CHAMFERB
 40
0.0
  9
$CHAMFERC
 40
0.0
  9
$CHAMFERD
 40
0.0
  9
$SKPOLY
 70
     0
  9
$TDCREATE
 40
2460560.605914352
  9
$TDUCREATE
 40
2460560.272581019
  9
$TDUPDATE
 40
2460560.629861111
  9
$TDUUPDATE
 40
2460560.296527778
  9
$TDINDWG
 40
0.0239467593
  9
$TDUSRTIMER
 40
0.0239467593
  9
$USRTIMER
 70
     1
  9
$ANGBASE
 50
0.0
  9
$ANGDIR
 70
     0
  9
$PDMODE
 70
     0
  9
$PDSIZE
 40
0.0
  9
$PLINEWID
 40
0.0
  9
$SPLFRAME
 70
     0
  9
$SPLINETYPE
 70
     6
  9
$SPLINESEGS
 70
     8
  9
$HANDSEED
  5
38C
  9
$SURFTAB1
 70
     6
  9
$SURFTAB2
 70
     6
  9
$SURFTYPE
 70
     6
  9
$SURFU
 70
     6
  9
$SURFV
 70
     6
  9
$UCSBASE
  2

  9
$UCSNAME
  2

  9
$UCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$UCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$UCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$UCSORTHOREF
  2

  9
$UCSORTHOVIEW
 70
     0
  9
$UCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSBASE
  2

  9
$PUCSNAME
  2

  9
$PUCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$PUCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$PUCSORTHOREF
  2

  9
$PUCSORTHOVIEW
 70
     0
  9
$PUCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$USERI1
 70
     0
  9
$USERI2
 70
     0
  9
$USERI3
 70
     0
  9
$USERI4
 70
     0
  9
$USERI5
 70
     0
  9
$USERR1
 40
0.0
  9
$USERR2
 40
0.0
  9
$USERR3
 40
0.0
  9
$USERR4
 40
0.0
  9
$USERR5
 40
0.0
  9
$WORLDVIEW
 70
     1
  9
$SHADEDGE
 70
     3
  9
$SHADEDIF
 70
    70
  9
$TILEMODE
 70
     1
  9
$MAXACTVP
 70
    64
  9
$PINSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMCHECK
 70
     0
  9
$PEXTMIN
 10
0.0
 20
0.0
 30
0.0
  9
$PEXTMAX
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMMIN
 10
0.0
 20
0.0
  9
$PLIMMAX
 10
12.0
 20
9.0
  9
$UNITMODE
 70
     0
  9
$VISRETAIN
 70
     1
  9
$PLINEGEN
 70
     0
  9
$PSLTSCALE
 70
     1
  9
$TREEDEPTH
 70
  3020
  9
$CMLSTYLE
  2
Standard
  9
$CMLJUST
 70
     0
  9
$CMLSCALE
 40
1.0
  9
$PROXYGRAPHICS
 70
     1
  9
$MEASUREMENT
 70
     0
  9
$CELWEIGHT
370
    -1
  9
$ENDCAPS
280
     0
  9
$JOINSTYLE
280
     0
  9
$LWDISPLAY
290
     0
  9
$INSUNITS
 70
     4
  9
$HYPERLINKBASE
  1

  9
$STYLESHEET
  1

  9
$XEDIT
290
     1
  9
$CEPSNTYPE
380
     0
  9
$PSTYLEMODE
290
     0
  9
$FINGERPRINTGUID
  2
{FA9A02B2-7E04-C34E-BD13-02980AC2B394}
  9
$VERSIONGUID
  2
{964EB223-33A2-D549-8684-CDE005EE773C}
  9
$EXTNAMES
290
     1
  9
$PSVPSCALE
 40
0.0
  9
$OLESTARTUP
290
     0
  9
$SORTENTS
280
   127
  9
$INDEXCTL
280
     0
  9
$HIDETEXT
280
     1
  9
$XCLIPFRAME
280
     2
  9
$HALOGAP
280
     0
  9
$OBSCOLOR
 70
   257
  9
$OBSLTYPE
280
     0
  9
$INTERSECTIONDISPLAY
280
     0
  9
$INTERSECTIONCOLOR
 70
   257
  9
$DIMASSOC
280
     2
  9
$PROJECTNAME
  1

  9
$CAMERADISPLAY
290
     0
  9
$LENSLENGTH
 40
50.0
  9
$CAMERAHEIGHT
 40
60.0
  9
$STEPSPERSEC
 40
2.0
  9
$STEPSIZE
 40
6.0
  9
$3DDWFPREC
 40
2.0
  9
$PSOLWIDTH
 40
0.25
  9
$PSOLHEIGHT
 40
4.0
  9
$LOFTANG1
 40
1.570796326794896
  9
$LOFTANG2
 40
1.570796326794896
  9
$LOFTMAG1
 40
0.0
  9
$LOFTMAG2
 40
0.0
  9
$LOFTPARAM
 70
     7
  9
$LOFTNORMALS
280
     1
  9
$LATITUDE
 40
37.795
  9
$LONGITUDE
 40
-122.394
  9
$NORTHDIRECTION
 40
0.0
  9
$TIMEZONE
 70
 -8000
  9
$LIGHTGLYPHDISPLAY
280
     1
  9
$TILEMODELIGHTSYNCH
280
     1
  9
$CMATERIAL
347
92
  9
$SOLIDHIST
280
     0
  9
$SHOWHIST
280
     1
  9
$DWFFRAME
280
     2
  9
$DGNFRAME
280
     0
  9
$REALWORLDSCALE
290
     1
  9
$INTERFERECOLOR
 62
     1
  9
$INTERFEREOBJVS
345
9F
  9
$INTERFEREVPVS
346
9C
  9
$CSHADOW
280
     0
  9
$SHADOWPLANELOCATION
 40
0.0
  0
ENDSEC
  0
SECTION
  2
CLASSES
  0
CLASS
  1
ACDBDICTIONARYWDFLT
  2
AcDbDictionaryWithDefault
  3
ObjectDBX Classes
 90
        0
 91
        1
280
     0
281
     0
  0
CLASS
  1
DICTIONARYVAR
  2
AcDbDictionaryVar
  3
ObjectDBX Classes
 90
        0
 91
       15
280
     0
281
     0
  0
CLASS
  1
MATERIAL
  2
AcDbMaterial
  3
ObjectDBX Classes
 90
     1153
 91
        3
280
     0
281
     0
  0
CLASS
  1
VISUALSTYLE
  2
AcDbVisualStyle
  3
ObjectDBX Classes
 90
     4095
 91
       24
280
     0
281
     0
  0
CLASS
  1
TABLESTYLE
  2
AcDbTableStyle
  3
ObjectDBX Classes
 90
     4095
 91
        1
280
     0
281
     0
  0
CLASS
  1
SCALE
  2
AcDbScale
  3
ObjectDBX Classes
 90
     1153
 91
       33
280
     0
281
     0
  0
CLASS
  1
MLEADERSTYLE
  2
AcDbMLeaderStyle
  3
ACDB_MLEADERSTYLE_CLASS
 90
     4095
 91
        2
280
     0
281
     0
  0
CLASS
  1
CELLSTYLEMAP
  2
AcDbCellStyleMap
  3
ObjectDBX Classes
 90
     1152
 91
        7
280
     0
281
     0
  0
CLASS
  1
EXACXREFPANELOBJECT
  2
ExAcXREFPanelObject
  3
EXAC_ESW
 90
     1025
 91
        0
280
     0
281
     0
  0
CLASS
  1
NPOCOLLECTION
  2
AcDbImpNonPersistentObjectsCollection
  3
ObjectDBX Classes
 90
     1153
 91
        0
280
     0
281
     0
  0
CLASS
  1
LAYER_INDEX
  2
AcDbLayerIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
SPATIAL_INDEX
  2
AcDbSpatialIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
IDBUFFER
  2
AcDbIdBuffer
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
ACDBSECTIONVIEWSTYLE
  2
AcDbSectionViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
CLASS
  1
ACDBDETAILVIEWSTYLE
  2
AcDbDetailViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
ENDSEC
  0
SECTION
  2
TABLES
  0
TABLE
  2
VPORT
  5
8
330
0
100
AcDbSymbolTable
 70
     1
1001
ACAD
1000
DbSaveVer
1071
      224
  0
VPORT
  5
90
330
8
100
AcDbSymbolTableRecord
100
AcDbViewportTableRecord
  2
*Active
 70
     0
 10
0.0
 20
0.0
 11
1.0
 21
1.0
 12
97.5486911906951
 22
42.51345460271504
 13
0.0
 23
0.0
 14
0.5
 24
0.5
 15
0.5
 25
0.5
 16
0.0
 26
0.0
 36
1.0
 17
0.0
 27
0.0
 37
0.0
 40
78.45799938217576
 41
1.945409429280396
 42
50.0
 43
0.0
 44
0.0
 50
0.0
 51
0.0
 71
     0
 72
  1000
 73
     1
 74
     3
 75
     0
 76
     1
 77
     0
 78
     0
281
     0
 65
     1
110
0.0
120
0.0
130
0.0
111
1.0
121
0.0
131
0.0
112
0.0
122
1.0
132
0.0
 79
     0
146
0.0
348
9B
 60
     3
 61
     5
292
     1
282
     1
141
0.0
142
0.0
 63
   250
421
  3355443
1001
ACAD_NAV_VCDISPLAY
1070
     3
  0
ENDTAB
  0
TABLE
  2
LTYPE
  5
5
330
0
100
AcDbSymbolTable
 70
     1
  0
LTYPE
  5
14
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByBlock
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
15
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByLayer
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
16
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
Continuous
 70
     0
  3
Solid line
 72
    65
 73
     0
 40
0.0
  0
ENDTAB
  0
TABLE
  2
LAYER
  5
2
102
{ACAD_XDICTIONARY
360
18B
102
}
330
0
100
AcDbSymbolTable
 70
     1
  0
LAYER
  5
10
102
{ACAD_XDICTIONARY
360
E1
102
}
330
2
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
  2
0
 70
     0
 62
     7
  6
Continuous
370
    -3
390
F
347
94
348
0
  0
ENDTAB
  0
TABLE
  2
STYLE
  5
3
330
0
100
AcDbSymbolTable
 70
     2
  0
STYLE
  5
11
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Standard
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
ACAD
1000
Arial
1071
       34
  0
STYLE
  5
D7
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD
1000
Arial
1071
       34
  0
ENDTAB
  0
TABLE
  2
VIEW
  5
6
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
UCS
  5
7
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
APPID
  5
9
330
0
100
AcDbSymbolTable
 70
     7
  0
APPID
  5
12
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD
 70
     0
  0
APPID
  5
D8
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnoPO
 70
     0
  0
APPID
  5
D9
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnotative
 70
     0
  0
APPID
  5
DA
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMJAG
 70
     0
  0
APPID
  5
DB
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMTALN
 70
     0
  0
APPID
  5
102
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_MLEADERVER
 70
     0
  0
APPID
  5
1A3
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_NAV_VCDISPLAY
 70
     0
  0
ENDTAB
  0
TABLE
  2
DIMSTYLE
  5
A
330
0
100
AcDbSymbolTable
 70
     2
100
AcDbDimStyleTable
 71
     2
340
DC
340
27
  0
DIMSTYLE
105
27
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Standard
 70
     0
340
11
  0
DIMSTYLE
105
DC
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
340
11
1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD_DSTYLE_DIMJAG
1070
   388
1040
1.5
1001
ACAD_DSTYLE_DIMTALN
1070
   392
1070
     0
  0
ENDTAB
  0
TABLE
  2
BLOCK_RECORD
  5
1
330
0
100
AcDbSymbolTable
 70
     1
  0
BLOCK_RECORD
  5
1F
102
{ACAD_XDICTIONARY
360
15A
102
}
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Model_Space
340
22
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
73
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space
340
74
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
78
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space0
340
79
 70
     0
280
     1
281
     0
  0
ENDTAB
  0
ENDSEC
  0
SECTION
  2
BLOCKS
  0
BLOCK
  5
20
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockBegin
  2
*Model_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Model_Space
  1

  0
ENDBLK
  5
21
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
75
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space
  1

  0
ENDBLK
  5
76
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
7A
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space0
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space0
  1

  0
ENDBLK
  5
7B
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
ENDSEC
  0
SECTION
  2
ENTITIES
  0
ENDSEC
  0
SECTION
  2
OBJECTS
  0
DICTIONARY
  5
C
330
0
100
AcDbDictionary
281
     1
  3
ACAD_CIP_PREVIOUS_PRODUCT_INFO
350
1A2
  3
ACAD_COLOR
350
6C
  3
ACAD_DETAILVIEWSTYLE
350
1A8
  3
ACAD_GROUP
350
D
  3
ACAD_LAYOUT
350
1A
  3
ACAD_MATERIAL
350
6B
  3
ACAD_MLEADERSTYLE
350
D2
  3
ACAD_MLINESTYLE
350
17
  3
ACAD_PLOTSETTINGS
350
19
  3
ACAD_PLOTSTYLENAME
350
E
  3
ACAD_SCALELIST
350
B1
  3
ACAD_SECTIONVIEWSTYLE
350
1A5
  3
ACAD_TABLESTYLE
350
A6
  3
ACAD_VISUALSTYLE
350
95
  3
ACDB_RECOMPOSE_DATA
350
38B
  3
AcDbVariableDictionary
350
59
  0
DICTIONARY
  5
18B
330
2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_LAYERSTATES
360
18C
  0
DICTIONARY
  5
E1
330
10
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
15A
330
1F
100
AcDbDictionary
280
     1
281
     1
  0
XRECORD
  5
1A2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
300
ACD
300
2021
300

  0
DICTIONARY
  5
6C
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A8
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A9
  0
DICTIONARY
  5
D
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Model
350
22
  3
\u5E03\u5C401
350
74
  3
\u5E03\u5C402
350
79
  0
DICTIONARY
  5
6B
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
ByBlock
350
93
  3
ByLayer
350
92
  3
Global
350
94
  0
DICTIONARY
  5
D2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Annotative
350
E0
  3
Standard
350
D3
  0
DICTIONARY
  5
17
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
18
  0
DICTIONARY
  5
19
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
ACDBDICTIONARYWDFLT
  5
E
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Normal
350
F
100
AcDbDictionaryWithDefault
340
F
  0
DICTIONARY
  5
B1
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
A0
350
B2
  3
A1
350
124
  3
A2
350
125
  3
A3
350
126
  3
A4
350
127
  3
A5
350
128
  3
A6
350
129
  3
A7
350
12A
  3
A8
350
12B
  3
A9
350
12C
  3
B0
350
12D
  3
B1
350
12E
  3
B2
350
12F
  3
B3
350
130
  3
B4
350
131
  3
B5
350
132
  3
B6
350
133
  3
B7
350
134
  3
B8
350
135
  3
B9
350
136
  3
C0
350
137
  3
C1
350
138
  3
C2
350
139
  3
C3
350
13A
  3
C4
350
13B
  3
C5
350
13C
  3
C6
350
13D
  3
C7
350
13E
  3
C8
350
13F
  3
C9
350
140
  3
D0
350
141
  3
D1
350
142
  3
D2
350
143
  0
DICTIONARY
  5
1A5
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A7
  0
DICTIONARY
  5
A6
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
A7
  0
DICTIONARY
  5
95
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
2dWireframe
350
9B
  3
Basic
350
9A
  3
Brighten
350
A1
  3
ColorChange
350
A5
  3
Conceptual
350
9E
  3
Dim
350
A0
  3
EdgeColorOff
350
172
  3
Facepattern
350
A4
  3
Flat
350
96
  3
FlatWithEdges
350
97
  3
Gouraud
350
98
  3
GouraudWithEdges
350
99
  3
Hidden
350
9D
  3
JitterOff
350
170
  3
Linepattern
350
A3
  3
OverhangOff
350
171
  3
Realistic
350
9F
  3
Shaded
350
17F
  3
Shaded with edges
350
17E
  3
Shades of Gray
350
17B
  3
Sketchy
350
17C
  3
Thicken
350
A2
  3
Wireframe
350
9C
  3
X-Ray
350
17D
  0
XRECORD
  5
38B
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
 90
        1
330
A7
  0
DICTIONARY
  5
59
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
CAMERAHEIGHT
350
227
  3
CANNOSCALE
350
EB
  3
CMLEADERSTYLE
350
EA
  3
CTABLESTYLE
350
AB
  3
CVIEWDETAILSTYLE
350
1B4
  3
CVIEWSECTIONSTYLE
350
1B5
  3
DIMASSOC
350
5A
  3
HIDETEXT
350
5E
  3
INDEXCTL
350
226
  3
LAYEREVAL
350
14A
  3
LAYERNOTIFY
350
14B
  3
LIGHTINGUNITS
350
224
  3
MSLTSCALE
350
223
  3
SORTENTS
350
225
  3
XCLIPFRAME
350
228
  0
DICTIONARY
  5
18C
102
{ACAD_REACTORS
330
18B
102
}
330
18B
100
AcDbDictionary
281
     1
  0
ACDBDETAILVIEWSTYLE
  5
1A9
102
{ACAD_REACTORS
330
1A8
102
}
330
1A8
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
300
Imperial24
 90
        0
100
AcDbDetailViewStyle
 70
     0
 71
     0
 90
        3
 71
     1
340
11
 62
   256
 40
0.24
340
0
 62
   256
 40
0.24
300

 40
0.36
280
     3
 71
     2
340
16
 90
       25
 62
   256
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewDetailId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
340
16
 90
       25
 62
   256
340
16
 90
       25
 62
   256
280
     0
  0
LAYOUT
  5
22
102
{ACAD_XDICTIONARY
360
191
102
}
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
none_device
  4
Letter_(8.50_x_11.00_Inches)
  6

 40
6.349999904632568
 41
6.349999904632568
 42
6.350006103515625
 43
6.350006103515625
 44
215.8999938964844
 45
279.3999938964844
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
3.560208697428376
 70
 11952
 72
     0
 73
     1
 74
     0
  7

 75
     0
147
0.28088241027059
 76
     0
 77
     2
 78
   300
148
0.1311165230791651
149
0.096403374003771
100
AcDbLayout
  1
Model
 70
     1
 71
     0
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
1F
331
90
  0
LAYOUT
  5
74
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C401
 70
     1
 71
     1
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
73
  0
LAYOUT
  5
79
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C402
 70
     1
 71
     2
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
78
  0
MATERIAL
  5
93
102
{ACAD_XDICTIONARY
360
185
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByBlock
 94
       63
  0
MATERIAL
  5
92
102
{ACAD_XDICTIONARY
360
183
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByLayer
 94
       63
  0
MATERIAL
  5
94
102
{ACAD_XDICTIONARY
360
10B
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
Global
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
 94
       63
1001
ACAD
1070
    -1
1070
     3
1070
     0
1000

1071
        0
1070
     0
  0
MLEADERSTYLE
  5
E0
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
179
     2
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     1
143
0.125
271
     0
272
     9
273
     9
298
     0
  0
MLEADERSTYLE
  5
D3
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
179
     2
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     0
143
0.125
271
     0
272
     9
273
     9
298
     0
  0
MLINESTYLE
  5
18
102
{ACAD_REACTORS
330
17
102
}
330
17
100
AcDbMlineStyle
  2
STANDARD
 70
     0
  3

 62
   256
 51
90.0
 52
90.0
 71
     2
 49
0.5
 62
   256
  6
BYLAYER
 49
-0.5
 62
   256
  6
BYLAYER
  0
ACDBPLACEHOLDER
  5
F
102
{ACAD_REACTORS
330
E
102
}
330
E
  0
SCALE
  5
B2
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:1
140
1.0
141
1.0
290
     1
  0
SCALE
  5
124
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:2
140
1.0
141
2.0
290
     0
  0
SCALE
  5
125
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:4
140
1.0
141
4.0
290
     0
  0
SCALE
  5
126
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:5
140
1.0
141
5.0
290
     0
  0
SCALE
  5
127
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:8
140
1.0
141
8.0
290
     0
  0
SCALE
  5
128
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:10
140
1.0
141
10.0
290
     0
  0
SCALE
  5
129
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:16
140
1.0
141
16.0
290
     0
  0
SCALE
  5
12A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:20
140
1.0
141
20.0
290
     0
  0
SCALE
  5
12B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:30
140
1.0
141
30.0
290
     0
  0
SCALE
  5
12C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:40
140
1.0
141
40.0
290
     0
  0
SCALE
  5
12D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:50
140
1.0
141
50.0
290
     0
  0
SCALE
  5
12E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:100
140
1.0
141
100.0
290
     0
  0
SCALE
  5
12F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
2:1
140
2.0
141
1.0
290
     0
  0
SCALE
  5
130
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
4:1
140
4.0
141
1.0
290
     0
  0
SCALE
  5
131
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
8:1
140
8.0
141
1.0
290
     0
  0
SCALE
  5
132
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
10:1
140
10.0
141
1.0
290
     0
  0
SCALE
  5
133
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
100:1
140
100.0
141
1.0
290
     0
  0
SCALE
  5
134
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/128" = 1'-0"
140
0.0078125
141
12.0
290
     0
  0
SCALE
  5
135
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/64" = 1'-0"
140
0.015625
141
12.0
290
     0
  0
SCALE
  5
136
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/32" = 1'-0"
140
0.03125
141
12.0
290
     0
  0
SCALE
  5
137
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/16" = 1'-0"
140
0.0625
141
12.0
290
     0
  0
SCALE
  5
138
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/32" = 1'-0"
140
0.09375
141
12.0
290
     0
  0
SCALE
  5
139
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/8" = 1'-0"
140
0.125
141
12.0
290
     0
  0
SCALE
  5
13A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/16" = 1'-0"
140
0.1875
141
12.0
290
     0
  0
SCALE
  5
13B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/4" = 1'-0"
140
0.25
141
12.0
290
     0
  0
SCALE
  5
13C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/8" = 1'-0"
140
0.375
141
12.0
290
     0
  0
SCALE
  5
13D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/2" = 1'-0"
140
0.5
141
12.0
290
     0
  0
SCALE
  5
13E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/4" = 1'-0"
140
0.75
141
12.0
290
     0
  0
SCALE
  5
13F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1" = 1'-0"
140
1.0
141
12.0
290
     0
  0
SCALE
  5
140
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1-1/2" = 1'-0"
140
1.5
141
12.0
290
     0
  0
SCALE
  5
141
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3" = 1'-0"
140
3.0
141
12.0
290
     0
  0
SCALE
  5
142
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
6" = 1'-0"
140
6.0
141
12.0
290
     0
  0
SCALE
  5
143
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1'-0" = 1'-0"
140
12.0
141
12.0
290
     0
  0
ACDBSECTIONVIEWSTYLE
  5
1A7
102
{ACAD_REACTORS
330
1A5
102
}
330
1A5
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
300
Imperial24
 90
        0
100
AcDbSectionViewStyle
 70
     0
 71
     0
 90
       78
 71
     1
340
11
 62
   256
 40
0.24
340
0
340
0
 62
   256
 40
0.24
300
I, O, Q, S, X, Z
 40
0.48
 90
        3
 40
0.18
 90
        1
 71
     2
340
16
 90
       25
 62
   256
340
16
 90
       50
 62
   256
 40
0.24
 40
0.0
 40
0.24
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewSectionStartId>%-%<\\AcVar ViewSectionEndId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
 62
   256
 62
   257
300
ANSI31
 40
1.0
 90
        0
290
     0
290
     0
 90
        6
 40
0.0
 40
1.570796326794896
 40
0.2617993877991494
 40
1.308996938995747
 40
-0.2617993877991494
 40
1.832595714594046
  0
TABLESTYLE
  5
A7
102
{ACAD_XDICTIONARY
360
FF
102
}
102
{ACAD_REACTORS
330
A6
102
}
330
A6
100
AcDbTableStyle
280
     0
  3
Standard
 70
     0
 71
     0
 40
0.06
 41
0.06
280
     0
281
     0
  7
Standard
140
0.18
170
     2
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.25
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.18
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  0
VISUALSTYLE
  5
9B
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
2dWireframe
 70
     4
177
     3
291
     0
 70
    58
 90
        0
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
9A
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Basic
 70
     7
177
     3
291
     1
 70
    58
 90
        1
176
     1
 90
        0
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
A1
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Brighten
 70
    12
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
50.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
A5
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
ColorChange
 70
    16
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        3
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     8
420
  8421504
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     8
420
  8421504
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
9E
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Conceptual
 70
     9
177
     3
291
     0
 70
    58
 90
        3
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
A0
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Dim
 70
    11
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
-50.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
172
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
EdgeColorOff
 70
    22
177
     3
291
     1
 70
    58
 90
        2
176
     0
 90
        2
176
     0
 90
        0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 40
30.0
176
     0
 62
     7
420
 16777215
176
     0
 90
        1
176
     0
 90
        4
176
     0
 62
     7
176
     0
 62
   257
176
     0
 90
        1
176
     0
 90
        1
176
     0
 40
1.0
176
     0
 90
        8
176
     2
 62
     7
176
     0
 40
1.0
176
     0
 90
        1
176
     0
 90
        6
176
     0
 90
        2
176
     0
 62
     7
176
     0
 90
        5
176
     0
 90
        0
176
     0
 90
        0
176
     0
290
     0
176
     0
 90
        1
176
     0
 40
0.0
176
     0
 90
        0
176
     0
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
A4
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Facepattern
 70
    15
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
96
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Flat
 70
     0
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        1
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
97
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
FlatWithEdges
 70
     1
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        1
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
98
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Gouraud
 70
     2
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
99
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
GouraudWithEdges
 70
     3
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
9D
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Hidden
 70
     6
177
     3
291
     0
 70
    58
 90
        1
176
     1
 90
        2
176
     1
 90
        2
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        2
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
170
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
JitterOff
 70
    20
177
     3
291
     1
 70
    58
 90
        2
176
     0
 90
        2
176
     0
 90
        0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 40
30.0
176
     0
 62
     7
420
 16777215
176
     0
 90
        1
176
     0
 90
        4
176
     0
 62
     7
176
     0
 62
   257
176
     0
 90
        1
176
     0
 90
        1
176
     0
 40
1.0
176
     0
 90
       10
176
     2
 62
     7
176
     0
 40
1.0
176
     0
 90
        1
176
     0
 90
        6
176
     0
 90
        2
176
     0
 62
     7
176
     0
 90
        5
176
     0
 90
        0
176
     0
 90
        0
176
     0
290
     0
176
     0
 90
        1
176
     0
 40
0.0
176
     0
 90
        0
176
     0
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
A3
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Linepattern
 70
    14
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        7
176
     1
 90
        7
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
171
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
OverhangOff
 70
    21
177
     3
291
     1
 70
    58
 90
        2
176
     0
 90
        2
176
     0
 90
        0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 40
30.0
176
     0
 62
     7
420
 16777215
176
     0
 90
        1
176
     0
 90
        4
176
     0
 62
     7
176
     0
 62
   257
176
     0
 90
        1
176
     0
 90
        1
176
     0
 40
1.0
176
     0
 90
        9
176
     2
 62
     7
176
     0
 40
1.0
176
     0
 90
        1
176
     0
 90
        6
176
     0
 90
        2
176
     0
 62
     7
176
     0
 90
        5
176
     0
 90
        0
176
     0
 90
        0
176
     0
290
     0
176
     0
 90
        1
176
     0
 40
0.0
176
     0
 90
        0
176
     0
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
9F
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Realistic
 70
     8
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
17F
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded
 70
    27
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     8
420
  7895160
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        5
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
17E
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded with edges
 70
    26
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        2
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        5
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
17B
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shades of Gray
 70
    23
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        3
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
     7
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
17C
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Sketchy
 70
    24
177
     3
291
     0
 70
    58
 90
        1
176
     1
 90
        2
176
     1
 90
        2
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
     7
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
       11
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        6
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
A2
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Thicken
 70
    13
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
       12
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
9C
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Wireframe
 70
     5
177
     3
291
     0
 70
    58
 90
        0
176
     1
 90
        2
176
     1
 90
        0
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
17D
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
X-Ray
 70
    25
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
0.5
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
DICTIONARYVAR
  5
227
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
60.000000
  0
DICTIONARYVAR
  5
EB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1:1
  0
DICTIONARYVAR
  5
EA
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
AB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
1B4
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
1B5
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
5A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
5E
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
226
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14B
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
224
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
223
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
225
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
127
  0
DICTIONARYVAR
  5
228
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARY
  5
191
330
22
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
185
330
93
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
186
  0
DICTIONARY
  5
183
330
92
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
184
  0
DICTIONARY
  5
10B
330
94
100
AcDbDictionary
280
     1
281
     1
  3
BUMPTILE
360
10D
  3
DIFFUSETILE
360
10C
  3
FBXASSET
360
187
  3
OPACITYTILE
360
10E
  3
REFLECTIONTILE
360
10F
  0
DICTIONARY
  5
FF
330
A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_ROUNDTRIP_2008_TABLESTYLE_CELLSTYLEMAP
360
38A
  0
XRECORD
  5
186
102
{ACAD_REACTORS
330
185
102
}
330
185
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
7581DE8E-A623-425F-9BF4-B3F4BE6C4F9A
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623B9A2F3B5FEC0000007C01000008000000636F72652E786D6C8D90416E83301045AF62CDB632D8040820E328B4E204BD80653BC44AB011B6AB1EBF262152BBEB6A467FFE9B197D76FA9EEFE84BAFDE38DB03CD08206DA553C64E3DC470C10DA01367AB73E1970D9015B3EE61
310
9381B3697571D925E96CD03624D53AA5775178AF0320794F4D0F5E5EF52C32114372F85BB608791393CEE8AB4B708C46A1E711A3D23E73317A055E0D4D53D6C71A9FC7A1C6657D18703354232ECFED4731B6B43CBED72CDF60CE82995FF7E5AA45D00A7841488B29C5A4F8A46547AAAEA8DE48D311C2F2CDFE078A8BFA2714
310
8D0D87627FF78979E0343DF21870966F59A4F2082AD52D37FE03504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623B6E137E0172010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C0810121947A1554ED00B38E05014B091B1518EDFE511A5A9D22AFD2A1F60CDEC7A67C698ED2E6D8306
310
69FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7166B4B65FCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B0FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2601EE7691A25EBC4DB1FF2C48B9255EEA5797C
310
F0A2FDE62D3C6C8268FD9A3032367366EBF6AAAE30525859621E52BAF182C0A3E17B106D69BC0DE3179A6E2965642CBF6B725DF96493AB955D858BDCB9ADC73C002113F1CD2D4464512F06D04338236388F09912BE0F1A028190AD3836571F67800659586D22604AED6ED4201A27612AF5E9F4A09F178CCC9D3075DA1C5C3F
310
9C113E3DE3F71DE1A885AAC084B0B03C3A3BEA64B38625B44E1A6FB017A4B46945F39C8D5F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F02504B0304140006080800AC70623BE001BAC07D0000009D0000000B0000006662782F636E782E786D6C4DCCD10AC2201886E15B91FFDCA6536B037548D87D8CE686
310
E4344CA3CB6F8B1D74F4C1C3C72B87CF1AD0DBE5974F51013D11402EDED3E4E3A2A096197780062D734AE5EF06288EAB53B03368B9E4549F074D6E1E6B289B061F1F07124689687987B9601C7373BD60C36E065B6A6DDF7341A93843A365F32B6DBB87F517504B0304140006080800AC70623B8E5068122901000012020000
310
310000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C8D515B6EC32010BC0AE22B55850D364E93081345557A825E801892A2C460F1A872FC2EB523B57FF961D1EECCECECAED8DFC71BFA36215AEF7ACC2A8A917183D7D65D7A9CD3996C30DA4B
310
11BC4F7F601839359A1E973496E2127C9E96D4E05D322E41D6796D96A48AD1248C861B7C7A1C872F33AA4AE5048878AD26355CD5C554AC8232E0A4882980013437292F96B465B46BF886F0AEE5841FDEDFC8A1FD3890233B1EB75BDE31D6AD453D13A5C8D9EA856E35D8B1676BC2B322852C45B2E3C3FE108C4A4663D950BA
310
258C11DA7C32BEA3DDAEE95EE96647A9A80BFC1F294FFA4952B62EB5CD6277A6452C99A8E78214DAE7D3ED61C6DC271F122AFD56D10C2F305545CB6A60FC1908E383E29A2F8A31F900EB5D5D4F8065DD2CBBE652D4E542107ECF07B15C53FE00504B0304140006080800AC70623B503B51794E010000330300003000000066
310
62782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F
310
77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347
310
DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F
310
504B0304140006080800AC70623B38FA165F680500003C100000340000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F6F626A656374732E786D6CAD575D6FA33814FD2B887D0E8424EDB42BCAA8499A2A1A756634D18CF6A15264C0A16CC146B6E9A4FBEBF7180C
310
019276B21F7908D8D8F7F3DCE36BFFE33ECFAC172A64CAD98DED3963DBA22CE271CA921BBB54BBD1956D7D0C7CC1B9EA2CB32D46727A63EB693BF013C1CBC24CC57447CA4C0D6657F33F2C1951466D2BCA889437B68C9E684E1C522A1E53F9ECC4441127D9ED1DCFA917F6C52682144F03A105119429588A790629566D94D7
310
1F8E6D37F05DFD3DF0F5BF59357D7B955BF9D3D79F32A9088B8E940DC44CBDD9F26E72713DBA98CDA6A3D9E5C41BCD57F3E5C8FB301D2F2E178BEBDBBB6B28964A4092B144D09D1DDC2336228D7CB7FED45A6C0C3F6552C419A351E53F3CAC6C3612635A5016238F2995D0D6F17ADC1F7A3A369DCF533D362ABBD3E779D5DD
310
D111D4D8DE3CBB96F2F04FB820CF41859054A3AA8E8F71B4C6DFF810B590F3CC7C4BA5951345454A322B4B4341C4AB1D60A95E12F83D311A9D42235C7B6007DE415ED75694C6AFB17BCACA5D99651A9A7650217B0BFC53252BCBD2BFA838AD0D36215765CAD4957148BD16D40EAE7DB79A0C7CFD984ECCC73A90D62E230952
310
0E37EBAF034717BAF6D64B3BF8B40AF71B5D8FA79517821754280D1F40AB495CF3D451326ABDB332A737C0995ECC0F41F986C87F46F91E4C41DE44BA9FED67468B1284C91D173972E38CAB9F356E5E46EDDBF10BF86CB0FA784D3BF3AF16FB6E6B6C9F30DECA1FC0A55373F5DFF3D78F5917A99DF405FE0B0A8C8BA909E526
310
2219A8E72165488806A595714C81CB77E1DE0ED6604A303B76912C680372F4E2BB2FF88EFF5A36D8AA52DF79322474C0B767303F625995056C7B032C473C592936CEBD15F38BFFA5666E979B4F9B52EC48441F0CB12CE92E65A9C2D979006FD7A05E227A1E3DD3D79F5CC470F438099B6E1272A34A22DA3AE63AF0497358E8
310
C141734F41847D09D79CE7FF42C3432A239A6584515E365ADA634863B52519D327A00AEB804E2703140BFA92EA4EA2B7A26716CEFA48A4850E597BE8B53CEDBCE1CBF7F56780D20EE6AF73A0F5F9B02A3CD07DC4332EB6E1EBB666421BE0C39E3EBA7FF4E16D22EA6A29407C85E586724C88B771BADB9512BC7B228A3FD68B
310
6EA65A22397E690AA8D158D7E40CEC8CDA23C2C0B7D1898640101CEC9C6D531CE328CB93CABBBA870A6425F70DF96199175B92F392A973C2346EFC69AC6F8577BB18F993A8E8C90E36D573340765C7343EA4AA87027D049DF0A9979E0F1757DEF2EEEA6E747B39412B35B9588DAEE7ABD9683E5DCDE677978BD9EAFAB6B5A8
310
B224F09B13AA5B8388264E44BF14A909F3F7F5A16CEDE08128E9DED705E526F5F3FBDA415BECBBD80380B71BD77991D19C3245347C1FF44BF68DA0ABE8C9A8E7D73949E81952BEDC6F063660E68C7D5F75A9D19F83BD6676A16BE1A410F554E621236936D8681C770A9618B79B50B6CF9AD19BA11E9978A20F953C4B63104E
310
6C2594E7548176CE607B915309C474BBF2D8DC1ECED8FD52F7838A84196D2C79226889330954036E65A4FAF3D66F68E174177563E3B0739EF1670AD1B690EA1B1BFCA6D2884A27C4F1A81B9F4A3820802EAC2541408DB02443675D6F6AC7ED2E1D1BD00F4E40A3BF5D724EB764FCEA116F4E8A02A7768F562BDB8C82E81F39
310
DE98631185D7B054AD2F8789D6994A0D2AAB76CADC0DD0423C1BD57BD4D7FB6E794EB5A61791B3EE49EF82A0963A524424D5BD40DB674CBA5D7E75D10A58EB2F569195097279BEA491A00073A90B1C28022A8CCC82284075F1FBE357C17117CDAD550A083C2E789E736606B7E62E6B6D9E70338D1F410B545F3FE464EC798F
310
55D76F2E22DB9048EA90583E63A22938EDC1006B00E4D1716A52E0EA1C0C96AF9796393066105A81F6A829ADAFE1168A47DF1C75A974C9B278B7F177ABA5008340CB1EFC0D504B0304140006080000AC70623B000000000000000000000000350000006662782F30333130353234382D343533342D344143372D413346412D
310
4531454539393435313135362F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E636660600000504B0304140006080000AC70
310
623B000000000000000000000000370000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30333130353234382D343533342D344143372D41
310
3346412D4531454539393435313135362F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11D
310
E607FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BF2C5666EFF000000A00100003B0000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F7265736F7572636573
310
2F636F72652E786D6C8D504B6E833010BD0A9A6D65B00910888CA3D02A27E8052C33A156821DF953F5F8B5132AB5BB6E6646EFA3797AFCF8B5DE8A4F745E5B33022B291468949DB5594688E1427A288E823B6BC32F191446AE38428641F0C5D978DF20654D4013126AEC8C1B28BDC70085BAA56304AF3E7095A58C2129FCB5
310
BC4B75950B96AC4C74D209EE834B018AE7933C4138F4363A859E574F56F018F5BC69F49C7EEA8B4607A29DFABEE9F62D399DA78E34DD6E22FDD49E49731ADEEAF3C09AFD6BC7AB6C163CE8F527A3722803CE206A4A07C218A1F53B6B0EB43DD4ED0BED0F94F22ACBFF98E27DFEA7296A1376F516F769F320580AF22004AF72
310
5F693DCA4C3B772BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B200
310
00005B436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623B9A2F3B5FEC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D
310
6C504B01021400140006080800AC70623B6E137E0172010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623BE001BAC07D0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B010214001400060808
310
00AC70623B8E506812290100001202000031000000000000000000000000005B0500006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D3
310
0600006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6C504B01021400140006080800AC70623B38FA165F680500003C10000034000000000000000000000000006F0800006662782F30333130353234382D343533342D344143372D413346412D4531
310
454539393435313135362F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000290E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F76657274696365732E62696E504B01021400
310
140006080800AC70623BF270F133060000000400000036000000000000000000000000007C0E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000
310
000000000000000000D60E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD1900000004101000036000000000000000000000000002B0F00006662782F30333130353234382D
310
343533342D344143372D413346412D4531454539393435313135362F6469726563746F72792E786D6C504B01021400140006080800AC70623BF2C5666EFF000000A00100003B000000000000000000000000000F1000006662782F30333130353234382D343533342D344143372D413346412D453145453939343531313536
310
2F7265736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000671100000000
  0
XRECORD
  5
184
102
{ACAD_REACTORS
330
183
102
}
330
183
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
778E3A9F-1AF3-452F-85C1-1BC15BD3F630
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BFD5588D4EC0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103891DC7C24471939CA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EF81EEFE8CBCCC17AD7012D0820E394D7D60D1DA478C50DA083E0B3F7F1970D9093A3E960
310
9141F061F6695A25E55D342E66D5796D56518660222075CF4D07417D9A511632C5EC08B76292EA260753D05797E194AC46CF2356E77DF66ACD0C62C768BD63971E5727D2E06DDF9C71BF7B3FE10BABF79BFA488FE4DCF07281058F767CDD57B391D168108C903DA61413F641B72DA95A56BD91A62584978BFD0F9426FD4F28
310
5917376C7DF7890510343FF218085E2E59E4F2082AD72537F103504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB5D38BAD72010000D40300000C0000006662782F636F72652E786D6CC553DB8E823014FC95A6AF1B68C11B9A52A3AB7EC1FE4085CA36424B4A4BFCFC3D5C8CEBC635EED3F200CDCC393D3353CAD697AA44AD
310
B48D323AC5514831923A33B9D2458ABD3B0509466BCEAC31EE5B19465A5432C51D8C392BACF1F50865463BA91DA0DAE4720445D348875156C222C54DF6292B110AEFA0A23987B5C8CEA2906114020D759C35CE8200340CE9DE989F8E1746069C33EF553EB22A8769EAA4A4C57C1147F3457CD806B31D4D82E936D907DBC5FB
310
2E38C4F3E564BE8936749F30D23573E65475559759299CCC318F295D065114D0F8239AAEE86C15CFDE68B2A29491AEFCAEC9D7F98B4D5E69378947B9435B837904427AE2875B88C8A146B4A0877046BA10E1D3277C1F340402213B712CAF3ECE00B53273C64E81C98DBF51AD28BD84A934A4FD837E5F303274C2D47E7370FD
310
7046FCF28CE73BC2510B5D8009E16079F4AED3C9060D6368B5B441EB2E481B5B89F2351B4F1CFE89BA897F282933A5B1FFA5888C0744C6DF8374F7917F01504B0304140006080800AC70623B09885E1C7E0000009D0000000B0000006662782F636E782E786D6C4DCCDF0A83201C86E15B91DFB9CBA6FD11D41063F711CB42
310
663A9C8E5DFE6A74B0A30F1E3E5E317C368FDE36BD5C0C12EA0B0164C33DCE2EAC124A5E700F685022C598FF6E80C2B459090783126B8AE579D26C97A9F8BCAB77E17122E586D5843498B3EE8699D114F39E5E713D76EDA84DCBB569A052A2FA95F63DC2EA0B504B0304140006080800AC70623B961D28872A010000120200
310
00310000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C8D515B6EC32010BC8AC557AA0A1BFC4A1C61A2C8514FD00B10435294182C1E558EDFA576A4F62F3F80666766875D76784CF7EC5B39AFADE911CD09CA9419ADD4E6DAA3182E7887B203
310
67CEDAF08786322326D5A30423CEAECEC67985466B8232015063A55A41E1BD0A281BEFF0E8911FBFD42472110330FC2D9FC578135795D31CCAC0E3CC070701B2A5493A11AFBAA1A68434B8ABB71FB81E8E15EE765589E969DB9E8E43DB1D8786158B90B318B55CE55A421C7DD1CABD6A92C49C053D3DE38F4E89A024E22521
310
1DA61493F293D67BD2ECCBE69DECF684B022D1FF89E22C5F14456D4255AE711799479CB2622970266D3CDF9F61D463B62E64A9DFC6ABF10D7192C35CCA0A040B11BE0F8E6DBD3AFA601D8C77733B0397C290926D5B7356A40DC1F5BB3EB8D336F90F504B0304140006080800AC70623B503B51794E01000033030000300000
310
006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1E
310
BC4F77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C54
310
2347DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F
310
103F504B0304140006080800AC70623B2EA4D28F640500003C100000340000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F6F626A656374732E786D6CAD575D739B3814FD2B0CFB6C30B1D3263B844E6CC71D4F376DA79E76F621331E01326103122389C4E9AFDF
310
231018B09D7A3FFC609090EEE7B94757FE875D9E59CF54C894B31BDB73C6B64559C4E394253776A9B6A32BDBFA10F88273D559665B8CE4F4C6D6D376E027829785998AE99694991ACC2E677F5A32A28CDA569411296F6C193DD29C38A4543CA6F2C98989224EB2DD399E532FEC8B4D04291E07420B222853B014F30C52ACDA
310
28AF3F1CDB6EE0BBFA7BE0EB7FB36A727A955BF9D3D79F32A9088B0E940DC44CBCE9E2EEE2F27A74399D4E46D37717DE68B69C2D46DEFBC978FE6E3EBFBEBDBB8662A90424194B04DDDAC147C446A491EFD69F5A8B8DE1C74C8A386334AAFC878795CD46624C0BCA62E431A512DA3A5E8FFB434FC7A6F379A2C7466577FA3C
310
AFBA3B3A821ADB9B67D7521EFE0517E439A810926A54D5F1318ED6F81BEFA316729E996FA9B472A2A84849666569288878B5032CD54B02BF2746A35368846B0FECC0DBCBEBDA8AD2F835768F59B92DB34C43D30E2A646F807FAA646559FA938AE3DA60137255A64C5D1987D46B41EDE0DA77ABC9C0D78FC985F95807D2DA66
310
2441CAE166FD75E0E85CD7DE6A61079F96E16EADEBF1B8F242F0820AA5E1036835896B9E3A4A46AD7756E6F40638D38BF93E28DF10F9CF28DFBD29C89B4877D3DDD468518230B9E522476E9C71F5B3C6CDCBA87D3B7C019F0D561FAE6967FED562DF6D8DED13C6A9FC015C3A3557FF3D7FFD987591DA495FE03FA3C0B89898
310
50AE2392817AEE53868468505A19C714B87C1BEEEC6005A604B36317C9823620072FBEFB8CEFF8AF6583AD2AF59D274342077C7B06F323965559C0B6136039E0C94AB171EE54CC2FFF979AB95DAC3FAD4BB12511BD37C4B2A0DB94A50A67E71EBC5D837A89E879F4445F5FB888E1E86112D6DD24E4469544B475CC75E093E6
310
B0D083BDE69E8208FB12AE39CFFF8586FB544634CB08A3BC6CB4B4C790C66A4B32A64F4015D6019D5C0C502CE873AA3B89DE8A9E5938EB2391163A64EDA1D7F2B473C297EFABCF00A51DCC5EFF20AF5DC20CF7741FF18C8B4DF8BAA999D006F8B0A78FEE1F7D789B88BA5A0A105F61B9A11C13E24D9C6EB7A504EF1E89E28F
310
D5BC9BA996480E5F9A026A34D63539053BA3F68830F06D74A2211004073B679B14C738CAF2A8F2AEEEA10259C93D213F2CF36243725E32754E98C68D3F8DF5ADF06E17235F888A1EED605D3D473350764CE31309D547D0119F7AE979FFFEEA6E727BBD1C79B74BB4529717CBD1D5E5DC1B79B3B977395B4C96EF2638E6FA15
310
D09C50DD1A44347122FAA5484D98BFAFF6656B07F74449F7635D506E523FBFAF1CB4C5BE8B3D0078BB71951719CD295344C3F75EBF64DF08BA8A9E8C7A7E9593849E21E5CBC7F5C006CC9CB1EFAB2E35FA32D86B66E7BA168E0A518F651E329266838DC671A7608971BB0965FBAC19BD19EA918927FA50C9B33406E1C45642
310
794E1568E70CB6173995404CB72B8FCDEDE18CDDCF753FA84898D1C6924782963893403548A78C547FDEFA0D2D9CEEA26E6C1C76CE13FE4C21DA16527D6383DF541A51E984381E75E353090704D085B52408D0139664E8ACEB4DEDB8DDA56303FAC10968F4B74BCEE9968C5F3DE2CD4951E0D4EED16A659B5110FD23C71B73
310
2CA2F01A96AAF5653FD13A53A909C03570A77DA0857832AA77A8AFB7DDF29C6A4D2F2267DD93DE04412D75A48848AA7B810EBA31E976F1D5452B60ADBE58455626C8E5F992468202CCA52E70A008A830320BA200D5F9EF0F5F05C75D34B7962920F030E779CE9919DC9ABBACB57EC4CD347E002D507DFD901763CF7BA8BA7E
310
7311D984445287C4F209134DC1690F065803200F8E53733D73750E06CB570BCB1C185308AD407BD094D6D7700BC5A36F8EBA54BA6459BCD9F8BBD552A040A0650FFE06504B0304140006080000AC70623B000000000000000000000000350000006662782F33394334313030352D393437462D344341332D393833322D3144
310
373644414336394143352F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B
310
000000000000000000000000370000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F33394334313030352D393437462D344341332D393833
310
322D3144373644414336394143352F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607
310
FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623B95BFD5E5FE000000A00100003B0000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265736F75726365732F63
310
6F72652E786D6C8D50596E833010BD0A9ADFCA603B1B41C611699213F40296992456828DBC543D7E4DA052FBD79F99D15B344F4F1CBE8667F1893E18675B60258502AD76BDB1B71652BC921A8A8314DEB9F84B06855503B630C120C5CDBB342E907636A28D19B5AEC70554216084423FF3D142D0771C54A952CC8AF02847A5
310
1FEA86252B339D755284E87380627E324D901E834B5E6310D5CC4A9192E9178DE9F34F7335E841EE38DBEEF8A5239B13ADC9FA589FC971F77E2217BEDDAFB61DEBE8B916D56496229AE127A3F6A822F62039A57BC218A1FC83AD1BBA69F8E68DD60DA5A29AE47F4C69ECFF694AC6C6155FE2CEB60092E5202F428A6AEA2BAF
310
5799794FDDCA6F504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B
310
436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BFD5588D4EC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D6C504B
310
01021400140006080800AC70623BB5D38BAD72010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623B09885E1C7E0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B01021400140006080800AC70
310
623B961D28872A0100001202000031000000000000000000000000005C0500006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D5060000
310
6662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6C504B01021400140006080800AC70623B2EA4D28F640500003C1000003400000000000000000000000000710800006662782F33394334313030352D393437462D344341332D393833322D3144373644
310
414336394143352F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000270E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F76657274696365732E62696E504B01021400140006
310
080800AC70623BF270F133060000000400000036000000000000000000000000007A0E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000000000
310
000000000000D40E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000290F00006662782F33394334313030352D393437
310
462D344341332D393833322D3144373644414336394143352F6469726563746F72792E786D6C504B01021400140006080800AC70623B95BFD5E5FE000000A00100003B000000000000000000000000000D1000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265
310
736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000641100000000
  0
XRECORD
  5
10D
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10C
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
187
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
 70
     0
 90
1778669749
  1
7E355024-1ABF-47F9-966E-F2159FBE82AB
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BDCE527C8EB0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103B15DC7C24471249FA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EFA9EEFE8CBACC17AD7032D0820E394D7D64D3DA478C52DA093E0ABF7F1970D9093B3E961
310
9341F069F569D925E55D342E66D5796D76518660222075CF4D0F417D9A591632C5EC08B76291EA262753D05797E194AC46CF2356E77DF66ACD0A621C9B73335C463C5E0E1457EC9DE2A1612D3E9233A92BD2D66333F07283058F767EDD57AB91D168108C9023A61413F641AB8ED41DABDF48DB11C2CBCDFE074A8BFE2794AC
310
8B07B6BFFBC402089A1F790C042FB72C72790495EB969BF801504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF32603847
310
2BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB24894EB71010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C085012194749244ED00B38E05014B091B1518EDFE511A5A9D228FD2A1F60CDEC7A67C6986D2F6D830669
310
FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7266B4B6DFCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B4FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2609EE7C92ED91F722F3FAC022F0ADF036F9F84A9
310
B7A63B1A47348DF364CFC8D8CC99ADDBABBAC2486165897948E9DA0B028F861F41B4A1F1268CDF68BAA19491B1FCAEC975E58B4DAE5676152E72E7B61EF300844CC40FB7109145BD18400FE18C8C21C2674AF83E68080442B6E2D85C7D9C011A6461B5898029B5BB5183689C84A9D4A7D3837E5F303277C2D4697370FD7046
310
F8F28CE73BC2510B5581096161797476D4C9660D4B689D34DE602F4869D38AE6351B4F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F01504B0304140006080800AC70623B3A54DFB77D0000009D0000000B0000006662782F636E782E786D6C4DCCD10A83201805E05791FFDEA5EBA76DA046A37C8F581632D3
310
613AF6F8B3D1C52E0E073E0E47B49FD591B7899B0D5E023F3120C63FC264FD2221A7995E81B44AC410D2DF0C881F5723616750628921BF0E9ACC3C66978A3AEB9F07B2A6D77AB87514F95953EC39D20EEF9C6AD60C88BC2EB940A544F57B2ABD1FAB2F504B0304140006080800AC70623B4A17098729010000120200003100
310
00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C8D515B6EC32010BC0AE22B55850D0E76930813A54A7C825E80DA244589C1E251E5F85D6A476AFFF2018B7667666759B1BF8F37F4AD7D30CEB6981514236D7B37187B69718A67B2C1682F8577
310
2EFE816164D5A85B9CD3588A8B77695A52BDB351DB0859EB06BD2455083A62D4DFE0D1E2D07FE951152A4540846B31A9FEAA2EBA600594012745881E0CA0B949BEB1A4CDB1EB4EDB03E1ACEA083F324E0EFC9D918E3627CED91ACE9B2867A214299961A19B01EC98B3D1FE59914C96229AF161BFF75A453D605951BA258C11
310
5A7D30BEA3F5AEAA5FE96647A92833FC1F294DC393A4646C5C578BDD9916B064A29C0B520C2E7DDE1E66F47D723EA2DC6F1574FF02531594D6AC69443903617C506CF8A218A2F3F0BDABEB2760593DCB365C8A326F08C2EFFA20E66DCA1F504B0304140006080800AC70623B503B51794E0100003303000030000000666278
310
2F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F7736
310
4A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347DEE0
310
50F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F504B
310
0304140006080800AC70623BD8F6D0D5660500003B100000340000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F6F626A656374732E786D6CAD575B8F9B3814FE2B887D064292B964C5504D92491555D3568D5AEDC348910187610730B2CD4C667FFD7E06438024
310
6DF6928780CDF1B97EE762EFC33E4B8D57CA45C2F23BD3B547A641F39045491EDF99A5DC59B7A6F1C1F73863B243661A39C9E89DA9B64DDF8B392B0BBD15D11D295339D85DCDFF304448736A1A614A84B83345F84C33629352B2888A173B2292D8F16E6FBB764DD8671B73523C0F981684D35C4253ECE7E062D44AB9FDE5C8
310
747CCF51DF7D4FFD6BAAC9792AA7B2A72F3FC985247978246CC066E24E970FE3AB9975359D4EACE9F5D8B5E6ABF9D2726F26A3C5F56231BB7F9841B0901C9CB4269CEE4CFF237CC393D073EA4FADC65AF1532A852CCF6958D90F0B2B9D35C78816348F10C7840A48EB583DEA2F5DE59BCEE7895A6B91DDEDCBACEA9EE8306A
310
746F9E5D4D59F0274C1097A0820BAA5055FB471B5AE36F74F05AC058AABF25C2C888A43C21A991260127FCDDF441AA487CAFC746A1932B842B0B4CDF3DF0EBEA8AD4F835764F69B92BD35441D3F42B646F817F2A45A559F217E5A7A54127C4AA4C7279AB0D92EF0535FD99E7549BBEA71E93B1FE583BD2D8A52446C86166FD
310
7560E842E5DE7A69FA9F56C17EA3F2F1B4F082B38272A9E0036835816B9ECA4B5AAC7B51E4D40118D3F3F9C129DFE0F9CF48DF832A881B4FF6D3FD544B919CE462C77886D8D8A3EA678C9A17AB7D3B7E413D1B501FD3B43BFF8AD8735A65FB05E35CFC002E159ADBFF1EBFBECFBA48ED84CFF75E91608C4FB42B372149517A
310
1E931C0151A03452862DD4F25DB037FD352A252A3B4E91D46F1D72F4E239AFF88EFF9A37AA5525BEF3CC11D041BDBDA0F2C397555A40B7336039AA9395606DDC399F5FFD2F3973BFDC7CDA947C4742FAA80BCB92EE923C91E89D07F07615EA05A267D10B7D7F633C82A1C741D8748390695102DE563E578E8F9B66A11607C9
310
3D0121CEC54CD53CEF17121E1311D2342539656523A56D430AAB6D91D17302B2B076E8643C4031A7AF899A247A143DB5D0EB439E14CA656DD36BEBB47DC696EFEBCF0025E8531690F440141CAA7DC852C6B7C1FBB62E8426B087237D70FFE8A35B3BD4515C00F80ACA4DC5D11EDE46C96E570A94DD134EFCB15E7403D5D691
310
E397267F1A89754A4E519C917A846BF43632310F7082BECEF26D822E8EAC3C29BC2B7B2840547CCFF00FCAACD8928C95B9BCC44DA3C69E46FB96797788116F4486CFA6BFA99ED61C153BA2D121543D10A80E74C2A65E786E1E265757A3F1D472EFE72B6B7AB39A59B3EBEB076B3576AF66ABF9C3EDF87EDE6A5469E27B4D83
310
EAA620BC8986E8953CD16EFEBE3E64ADE93F12299C8F753E3971FDFCBEB631157B0ECE00DFEDC17556A434A3B9240ABD8FEA25FD463054F478D4FBEB8CC4F4022E5F3E6E063A60E782735F55A6D1B7C159BDBB50B97092897C2EB32027493A38A80DB78B3CD66637AE6C9F75416F966AA5FD893154B03489506F2223A62CA3
310
1255E78262CF332A8098EE501EE9CBC305A75FEB71509220A58D26CF0413712A806AC0AD0C657FDFF80D139C1AA2EE4CF43AFB057F3A114D03A1BE3351DE6412526107E88E6AEEA998030218C2DA1A08A8913C4E3158D787DA757B4AF906E5070D50CB6F492E1996B45DBDBA9B91A240D3EE55D54A372D20FC478637EA1844
310
E23528656BCB61A335A61283CCAA8DD257034C102F5AF41EF9F573B35CBBA2E979E4A26BD24F415073B524E171752D50FA6995EE975F1D4C02C6FA8B51A4658C585ECEC9E214602E558203454085E6591009A82E7E7FFACA19AEA299B14A0081A705CB3296EBC5BDBECA1A9B675C4CA3279405AA6E1F623C72DDA76AE8D7F7
310
906D4004B549245EB0D1249CB260803500F2A89BEA10382A0603F2F5D2D00D630AA615688F66D2FA166E2079D4C551A54AB758163F9DFB9D8A1460E098D8FDBF01504B0304140006080000AC70623B000000000000000000000000350000006662782F30364446464539412D343132462D344431342D413442312D46303645
310
34343133343431372F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B0000
310
00000000000000000000370000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30364446464539412D343132462D344431342D413442312D
310
4630364534343133343431372F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607FB14
310
4396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BB40F7AF9FE000000A00100003B0000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F75726365732F636F72
310
652E786D6C8D504B6E833010BD0A9A6D65B00950828CA3109513F4029699502BC146FE543D7E4D42A576D7CDCCE87D344F8F9FBE967BF689CE6B6B7A6039850C8DB29336730F315C490BD94970676DF82583CCC8057BD860107C7636AE3BA4AC096842428D9D7007A5F7182053F774F4E0D5072E3297312485BFE5AB543739
310
63CEF244279DE03EB814207B3ED9260887DE46A7D0F3E2C90A1EA39E768D9ED24F7DD5E8408C63736E86CB1B192F0746AAF29591A1295B72A4675A57B4ADC766E0C566163CE8E527A37228034E204A4A8F843142CB775675B4EECAFA85B61DA5BCD8E47F4C719DFE698ADA8443B9C77DDA3C0896823C08C18BADAFB41E65A6
310
BD752BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B436F
310
6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BDCE527C8EB0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000094020000636E782E786D6C504B0102
310
1400140006080800AC70623BB24894EB71010000D40300000C00000000000000000000000000180300006662782F636F72652E786D6C504B01021400140006080800AC70623B3A54DFB77D0000009D0000000B00000000000000000000000000B30400006662782F636E782E786D6C504B01021400140006080800AC70623B
310
4A17098729010000120200003100000000000000000000000000590500006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D10600006662
310
782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6C504B01021400140006080800AC70623BD8F6D0D5660500003B10000034000000000000000000000000006D0800006662782F30364446464539412D343132462D344431342D413442312D46303645343431
310
33343431372F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000250E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F76657274696365732E62696E504B010214001400060808
310
00AC70623BF270F13306000000040000003600000000000000000000000000780E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E504B01021400140006080000AC70623B00000000000000000000000037000000000000000000
310
00000000D20E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000270F00006662782F30364446464539412D343132462D
310
344431342D413442312D4630364534343133343431372F6469726563746F72792E786D6C504B01021400140006080800AC70623BB40F7AF9FE000000A00100003B000000000000000000000000000B1000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F
310
75726365732F636F72652E786D6C504B0506000000000E000E0080040000621100000000
  0
XRECORD
  5
10E
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10F
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
CELLSTYLEMAP
  5
38A
102
{ACAD_REACTORS
330
FF
102
}
330
FF
100
AcDbCellStyleMap
 90
        3
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
    32768
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.25
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        1
 91
        1
300
_TITLE
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        2
 91
        1
300
_HEADER
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        2
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        3
 91
        2
300
_DATA
309
CELLSTYLE_END
  0
ENDSEC
  0
SECTION
  2
ACDSDATA
 70
     2
 71
     8
  0
ACDSSCHEMA
 90
        0
  1
AcDb_Thumbnail_Schema
  2
AcDbDs::ID
280
    10
 91
        8
  2
Thumbnail_Data
280
    15
 91
        0
101
ACDSRECORD
 95
        0
 90
        1
  2
AcDbDs::TreatedAsObjectData
280
     1
291
     1
101
ACDSRECORD
 95
        0
 90
        2
  2
AcDbDs::Legacy
280
     1
291
     1
101
ACDSRECORD
  1
AcDbDs::ID
 90
        3
  2
AcDs:Indexable
280
     1
291
     1
101
ACDSRECORD
  1
AcDbDs::ID
 90
        4
  2
AcDbDs::HandleAttribute
280
     7
282
     1
  0
ACDSSCHEMA
 90
        1
  1
AcDbDs::TreatedAsObjectDataSchema
  2
AcDbDs::TreatedAsObjectData
280
     1
 91
        0
  0
ACDSSCHEMA
 90
        2
  1
AcDbDs::LegacySchema
  2
AcDbDs::Legacy
280
     1
 91
        0
  0
ACDSSCHEMA
 90
        3
  1
AcDbDs::IndexedPropertySchema
  2
AcDs:Indexable
280
     1
 91
        0
  0
ACDSSCHEMA
 90
        4
  1
AcDbDs::HandleAttributeSchema
  2
AcDbDs::HandleAttribute
280
     7
 91
        1
284
     1
  0
ACDSRECORD
 90
        0
  2
AcDbDs::ID
280
    10
320
22
  2
Thumbnail_Data
280
    15
 94
      896
310
89504E470D0A1A0A0000000D49484452000001000000009108030000001BE1960600000300504C5445212830FFFFFF2128300000000000000000000000000000000000000000000000000000330000660000990000CC0000FF0033000033330033660033990033CC0033FF0066000066330066660066990066CC0066FF0099
310
000099330099660099990099CC0099FF00CC0000CC3300CC6600CC9900CCCC00CCFF00FF0000FF3300FF6600FF9900FFCC00FFFF3300003300333300663300993300CC3300FF3333003333333333663333993333CC3333FF3366003366333366663366993366CC3366FF3399003399333399663399993399CC3399FF33CC00
310
33CC3333CC6633CC9933CCCC33CCFF33FF0033FF3333FF6633FF9933FFCC33FFFF6600006600336600666600996600CC6600FF6633006633336633666633996633CC6633FF6666006666336666666666996666CC6666FF6699006699336699666699996699CC6699FF66CC0066CC3366CC6666CC9966CCCC66CCFF66FF0066
310
FF3366FF6666FF9966FFCC66FFFF9900009900339900669900999900CC9900FF9933009933339933669933999933CC9933FF9966009966339966669966999966CC9966FF9999009999339999669999999999CC9999FF99CC0099CC3399CC6699CC9999CCCC99CCFF99FF0099FF3399FF6699FF9999FFCC99FFFFCC0000CC00
310
33CC0066CC0099CC00CCCC00FFCC3300CC3333CC3366CC3399CC33CCCC33FFCC6600CC6633CC6666CC6699CC66CCCC66FFCC9900CC9933CC9966CC9999CC99CCCC99FFCCCC00CCCC33CCCC66CCCC99CCCCCCCCCCFFCCFF00CCFF33CCFF66CCFF99CCFFCCCCFFFFFF0000FF0033FF0066FF0099FF00CCFF00FFFF3300FF3333
310
FF3366FF3399FF33CCFF33FFFF6600FF6633FF6666FF6699FF66CCFF66FFFF9900FF9933FF9966FF9999FF99CCFF99FFFFCC00FFCC33FFCC66FFCC99FFCCCCFFCCFFFFFF00FFFF33FFFF66FFFF99FFFFCCFFFFFF0000000D0D0D1A1A1A2828283535354343435050505D5D5D6B6B6B787878868686939393A1A1A1AEAEAEBB
310
BBBBC9C9C9D6D6D6E4E4E4F1F1F1FFFFFF0000000000000000000000000000000000000000000000000000000000002E4550F10000003B4944415478DAEDC13101000000C2A0F54F6D0B2FA0000000000000000000000000000000000000000000000000000000000000000000000000CE06919100016C9A5B1B0000000049
310
454E44AE426082
  0
ENDSEC
  0
EOF
`;function _$e(o){return o==0?S$e:o==1?e_e:o==2?E$e:o==3?O$e:o==4?A$e:e_e}var v$e=new Qfe,eme=class{constructor(){this.delimiter=`\r
`;this.entityMap=new Map}initTemplate(t){this.templateDxfData||(this.templateDxfData=v$e.parseSync(_$e(t)).parseData,this.headerCodeInfo=Ls(v$e.headerCodeInfo))}getCurrentBlob(){return this.currentBlob}clearCurrentBlob(){this.currentBlob=null}decodeInit(t,e){this.initTemplate(e),this.dxfArr=[];let r=this.templateDxfData,i=t.origin||new S(0,0),n=Qe.translate(-i.x,-i.y).scale(Di.convert(1,t.unit,r.unit));this.matrix=n,this.decoderHeader(this.extends(r.header,t.header)),this.decoderClasses(),this.decoderTables(t.tables),this.decoderBlocks(this.extends(r.blocks,t.blocks),this.matrix)}handleDecodeEntity(t,e){t=="start"?this.decoderEntities(this.templateDxfData.entities,this.matrix):(this.handleEnFileData(e),this.autoEndSection(),this.decoderObjects(),this.autoItem(0,"EOF"),this.handleFileData())}decode(t){let{items:e,layer:r}=t;if(!e||!e.length)return this;let i=this.autoEntityItems(e);if(!i)return this;let n=this.entityMap.get(r);return typeof n<"u"?n.push(i):this.entityMap.set(r,[i]),this}extends(t,e){return Array.isArray(t)?t.concat(e):Object.assign({},t,e)}getDxfFileContent(){return this.dxfArr.join(this.delimiter)}handleDataByPiece(t){let e=t.length>=3?t.length/3:t.length,r=[];for(let i=0;i<t.length;i+=e)r.push(t.slice(i,i+e));return r}async handleEnFileData(t){for(let r of t){let i=this.entityMap.get(r);if(i!=null&&i.length){this.entityMap.delete(r);let n=this.handleDataByPiece(i);i=null;for(let s of n){for(let a of s)this.dxfArr.push(a);this.handleFileData()}}}let e=this.entityMap.keys();for(let r of e){let i=this.entityMap.get(r);if(this.entityMap.delete(r),i!=null&&i.length){for(let n of i)this.dxfArr.push(n);this.handleFileData()}}}handleFileData(t=this.dxfArr.join(this.delimiter)){let e=this.currentBlob?[this.currentBlob,this.delimiter+t]:[t];this.currentBlob=new Blob(e,{endings:"native"}),this.dxfArr=[]}downLoadFile1(t){let e=t+".dxf";s2?NC(this.currentBlob,e,"dxf"):ip.downloadFile(e,this.currentBlob),this.currentBlob=null}downLoadFile(t){if(s2){let e={dataStr:this.getDxfFileContent(),title:t+".dxf",extension:"dxf"};ie.windowBridge.publish("ui/exportFileClient",e,$())}else ip.downloadFileASCII(t+".dxf",this.getDxfFileContent())}autoItem(t,e){let r=[];gP(r,t,e);let i=r[0];!i||i.length!=2||this.dxfArr.push(["  "+i[0],i[1]].join(this.delimiter))}autoItems(t){if(t)for(let e of t)this.autoItem(e[0],e[1])}autoStartSection(t){this.autoItem(0,"SECTION"),this.autoItem(2,t)}autoEndSection(){this.autoItem(0,"ENDSEC")}autoNumber(t){return isNaN(t)?0:t}autoVerctor2(t){this.autoItem(10,this.autoNumber(t&&t.x)),this.autoItem(20,this.autoNumber(t&&t.y))}decoderHeader(t){this.autoStartSection("HEADER");let e=this.headerCodeInfo,r=Object.keys(e);for(let i=0;i<r.length;i++){let n=r[i];this.autoItem(9,n);let s=e[n],a=t[n];if(typeof a=="object"&&Ef(a,"x")){let l=[];Fh(l,a,10),this.autoItems(l)}else isNaN(s)?console.error("code must be a number!"):this.autoItem(s,a)}this.autoEndSection()}decoderClasses(){this.autoItems(this.templateDxfData.CLASSES_items)}decoderTables(t){let e=this.decorderLayerItems(t&&t.layers),r=Array.from(this.templateDxfData.TABLES_items);if(e&&e.length){let i=this.indexOfItem(r,[0,"LAYER"]);i===-1?console.error("the templateDxfData has no LAYER table."):r.splice(i,0,...e)}this.autoItems(r)}indexOfItem(t,e){if(!t||!e)return-1;let r=0;for(let i of t){if(i[0]===e[0]&&i[1]===e[1])return r;r++}return-1}autoLayerName(t){return(t||"").replace(/\s/g,"-")}decorderLayerItems(t){if(!t)return;let e=[];for(let r in t){let i=t[r];e.push([0,"LAYER"]),e.push([5,r]),e.push([100,"AcDbSymbolTableRecord"]),e.push([100,"AcDbLayerTableRecord"]),e.push([2,this.autoLayerName(i.name)]),e.push([70,0]),e.push([420,parseInt(i.activeColor.toString().slice(1),16)]),e.push([6,"Continuous"]),e.push([370,-3]),e.push([390,"F"]),e.push([347,21])}return e}decoderObjects(){this.autoItems(this.templateDxfData.OBJECTS_items)}decoderBlocks(t,e){if(!(!t||!Object.keys(t).length)){this.autoStartSection("BLOCKS");for(let r in t)this.decoderBlock(r,t[r],e);this.autoEndSection()}}decoderBlock(t,e,r){this.autoItem(0,"BLOCK"),this.autoItem(5,e.handle),this.autoItem(330,e.ownerHandle),this.autoItem(100,e.subclassTag[0]),e.paperSpace&&this.autoItem(67,e.paperSpace),this.autoItem(8,this.autoLayerName(e.layer)),this.autoItem(100,e.subclassTag[1]),this.autoItem(2,e.name||e.name2||t),this.autoItem(70,e.type||0),this.autoVerctor2(e.position),this.autoItem(3,e.name||e.name2||t),this.autoItem(1,e.xrefPath||""),this.decoderEntities(e.entities,r),this.autoItem(0,"ENDBLK"),this.autoItems(e.endBlock)}decoderEntities(t,e){if(!t){console.warn("entites is null data");return}this.autoStartSection("ENTITIES"),t.forEach(r=>{let i=r.multiply3(e).entityDxfItems();!i||!i.length||this.autoItems(i)})}autoEntityItems(t){if(!t)return null;let e=[],r,i;for(let n of t)i=n[0],r=n[1],r==null&&(r=0),r=bX(i,r),!Object.is(NaN,r)&&e.push("  "+i+this.delimiter+r);return e.join(this.delimiter)}};var B9=new eme,tme=class{constructor(){this.handleIndex=-1;this.clearance=0;this.defaultStroke=1;this.defaultPadStroke=0;this.defaultViaStroke=0;this.layerOrder=[2,4,6,8,10,1,3,5,7,9,11,12,13,14,47];this.exportLayers=[];this.layerConfigMap=new Xl;this.isPanelize=!1;this.matrixArr=[];this.cur=0;this.hasShape=!1;A.subscribe("exportDxfFile",this.export.bind(this)),A.messageBus.rpcService("exportDxfFileRPC",async t=>await this.export(t))}async export(t){if(!x.getInstance().isactive||23==x.getInstance().doctype)return null;let e="exportDxf-time";pn(e);let r={};r._start=performance.now(),await this.updateProgress(),this.handleIndex=1024,this.data={header:{$LWDISPLAY:this.autoStroke()},blocks:{},entities:[],tables:null,unit:10,unitName:"px(100)",scale:1,strokeWidth:10,layerConvertInfo:{},origin:x.getInstance().origin,CLASSES_items:null,TABLES_items:null,OBJECTS_items:null},this.hasShape=!1,this.entities_cache={},this.layerConfigMap.clear();let i=[];for(let a of t.layerConfigs)a.check&&(this.layerConfigMap.put(a.layerId,a),i.push(a.layerId));let n=t.objectConfigs;if(this.getMatrixArr(),await this.updateProgress(),r._initEnd=performance.now(),r.$init=r._initEnd-r._start,this.parseLayers(i),this.resetPanelizeState(),await this.updateProgress(),r._parseLayersEnd=performance.now(),r.parseLayers=r._parseLayersEnd-r._initEnd,B9.decodeInit(this.data,t.version),await this.updateProgress(),B9.handleDecodeEntity("start"),await this.updateProgress(),r._decodeEntityStartEnd=performance.now(),r.decodeEntityStart=r._decodeEntityStartEnd-r._parseLayersEnd,this.parseLineShape(n),await this.updateProgress(),r._parseLineShapeEnd=performance.now(),r.parseLineShape=r._parseLineShapeEnd-r._decodeEntityStartEnd,this.parseImage(n),await this.updateProgress(),r._parseImageEnd=performance.now(),r.parseImage=r._parseImageEnd-r._parseLineShapeEnd,this.parseTrack(n),await this.updateProgress(),r._parseTrackEnd=performance.now(),r.parseTrack=r._parseTrackEnd-r._parseImageEnd,this.parsePads(n),await this.updateProgress(),r._parsePadskEnd=performance.now(),r.parsePads=r._parsePadskEnd-r._parseTrackEnd,this.parseVias(n),await this.updateProgress(),r._parseViasEnd=performance.now(),r.parseVias=r._parseViasEnd-r._parsePadskEnd,this.parseTexts(n),await this.updateProgress(),r._parseTextsEnd=performance.now(),r.parseTexts=r._parseTextsEnd-r._parseViasEnd,this.parseDemension(n),await this.updateProgress(),r._parseDemensionEnd=performance.now(),r.parseDemension=r._parseDemensionEnd-r._parseTextsEnd,this.parseComponentSilkscreen(n),await this.updateProgress(),r._parseComponentSilkscreenEnd=performance.now(),r.parseComponentSilkscreen=r._parseComponentSilkscreenEnd-r._parseDemensionEnd,this.parsePanelize(),await this.updateProgress(),r._parsePanelizeEnd=performance.now(),r.parsePanelize=r._parsePanelizeEnd-r._parseComponentSilkscreenEnd,r.$parse=r._parsePanelizeEnd-r._initEnd,!this.hasShape)return A.publish("message",{type:"warn",message:"The exported file is empty, please check the layer or object."},$()),this.updateProgress(1),null;B9.handleDecodeEntity("end",this.orderLayerNameArr()),await this.updateProgress(),r._decodeEntityEndEnd=performance.now(),r.decodeEntityEnd=r._decodeEntityEndEnd-r._parsePanelizeEnd,(typeof t.__isOnlyGetData>"u"||t.__isOnlyGetData===!1)&&(B9.downLoadFile1(t.title||"*"),this.updateProgress(1),this.cur=0),r._downLoadFileEnd=performance.now(),r.$file=r._downLoadFileEnd-r._parsePanelizeEnd,r.$all=performance.now()-r._start,console.warn(r),Bi(e);let s=B9.getCurrentBlob();return B9.clearCurrentBlob(),{blobData:s}}autoLayerConfig(t){return Object.assign({layerId:t,isMirror:!1,transparency:0},this.layerConfigMap.get(t))}autoEntity(t,e){t||console.warn("entity was null data!"),this.autoLayerConfig(e).isMirror&&(t=t.multiply3(Qe.MIRROR_X.setOrigin1(this.data.origin))),this.isPanelize&&this.parseEntityPanelize(t),B9.matrix&&(t=t.multiply3(B9.matrix));let i={items:t.entityDxfItems(),name:t.name,layer:t.entity.layer};B9.decode(i),this.hasShape=!0}orderLayerNameArr(){let t=[];for(let e of this.layerOrder){let r=this.autoLayer(e);t.push(r)}return t}autoLoadEntity(){let t=this.entities_cache;this.layerOrder.forEach(e=>{let r=this.autoLayer(e),i=t[r];i&&(this.data.entities=this.data.entities.concat(i),delete t[r])});for(let e in t)this.data.entities=this.data.entities.concat(t[e])}autoStroke(t){return Object.is(t,void 0)?this.defaultStroke:t}parseLayers(t){t&&(this.exportLayers=t,this.data.tables||(this.data.tables={}),this.data.tables.layers={},t.forEach(e=>{let r=$e.getInstance().getLayer(e);r&&(this.data.tables.layers[this.autoHandle()]={name:r.name,activeColor:r.activeColor})}))}allowLayer(t){return this.exportLayers.includes(t)}autoHandle(){return(this.handleIndex++).toString()}autoLayerName(t){return(t||"").replace(/\s/g,"-")}autoLayer(t){let e=$e.getInstance().getLayer(t);return e?this.autoLayerName(e.name):"0"}autoCircle(t,e,r,i,n){if(n){let c=aO.builder({type:aO.entityName,pcb_layer:null,handle:this.autoHandle(),layer:this.autoLayer(t),center:e,radius:r,lineStroke:i});n.layerId||(n.layerId=t),n.linkHandle=c.entity.handle,n.outlines=[c.cloneOne()],this.autoHatch(n)}let s=new S(e.x-r,e.y),a=new S(e.x+r,e.y),l=[q.build1(s,a,r,r,!1,le.CCW),q.build1(a,s,r,r,!1,le.CCW)];this.parsePoly2(t,l,null,{width:i})}parsePoly(t,e,r,i){if(!e)return;let n=e instanceof Gt?e.items:[e],s=!!r;for(let a of n){let l=a.primitives;if(r&&l.length>1){let c=[];a.points(.1,h=>{c.push(h)}),l=fe.build4(c).primitives}this.parsePoly2(t,l,r,i,s)}}parsePoly2(t,e,r,i,n=!1){if(!e)return;let s=this.autoStroke(i&&i.width),a=[];for(let u of e){let d=u instanceof q;if(u instanceof M||u instanceof q){let p,m;p=u.start(),m=u.end();let g=p.equals(m);if(e.length==1&&u instanceof q&&g){this.autoCircle(t,u.center,u.rx,s,r);return}if(g)continue;let y=0;d&&(y=on(u.bulge,3),d&&u.sweepAngle<0&&(y=-y)),this.autoPushVertex(a,p,y),this.autoPushVertex(a,m)}else console.warn("need to parse this shape:",u)}let l=a.length;if(l==0)return;let c=!1;if(l>1&&a[0].entity.center.equals(a[l-1].entity.center)&&(a.pop(),c=!0),a.length<2)return;let h=QC.builder({type:QC.entityName,pcb_layer:null,handle:this.autoHandle(),layer:this.autoLayer(t),elevation:null,depth:null,shape:c,hasContinuousLinetypePattern:null,numberOfVertices:a.length,vertexs:a,width:s,startWidth:null,endWidth:null,extrusionDirectionX:null,extrusionDirectionY:null,extrusionDirectionZ:null});r&&(r.layerId||(r.layerId=t),r.linkHandle=h.entity.handle,n?r.outlines?r.outlines.push(h.cloneOne()):r.outlines=[h.cloneOne()]:r.outlines=[h.cloneOne()],this.autoHatch(r)),this.autoEntity(h,t)}autoPushVertex(t,e,r){let i=t&&t[t.length-1];if(i&&i.entity.center.equals(e)){r&&(i.entity.bulge=r);return}let n=b3.builderNull();n.entity.center=e,r&&(n.entity.bulge=r),t.push(n)}parsePads(t){if(!t)return;let e=[],r=[],i=[],n=[];t.includes("TopPad")&&(r=[1,5,7],r=r.filter(h=>this.allowLayer(h)),r.length&&e.push(1)),t.includes("BottomPad")&&(i=[2,6,8],i=i.filter(h=>this.allowLayer(h)),i.length&&e.push(2));let s=t.includes("MultiPad"),a=t.includes("PadDrill");(s||a)&&(n=s?[2,1,12,5,7,6,8]:[],a&&n.push(47),n=n.filter(h=>this.allowLayer(h)),n.length&&e.push(12));let l={1:r,2:i,12:n};if(e.length==0)return;let c=$n.getInstance().getAllItem();for(let h=0;h<c.length;h++){let u=c[h];if(!e.includes(u.layerId))continue;let d=l[u.layerId];d.length&&this.parsePad(u,d)}}parsePad(t,e){let r=this.clearance,i={width:this.defaultPadStroke};for(let n of e){let s=t.getFileGraphics(n,r);if(s)for(let a of s){let l=this.getHatchInfo("Fill Region");this.parsePoly(n,a,l,i)}}}parseTexts(t){let e=t.includes("Text"),r=t.includes("ComponentProperty");if(e||r){let i=mo.getInstance().getAllItem();for(let n of i)this.allowLayer(n.layerId)&&n.value&&(e&&n.key===""||n.key!=""&&r)&&this.parseMText(n)}}getTextAlign(t){let e=0,r=0;return t==1?(e=3,r=0):t==2?(e=2,r=0):t==3?(e=1,r=0):t==4?(e=3,r=1):t==5?(e=2,r=1):t==6?(e=1,r=1):t==7?(e=3,r=2):t==8?(e=2,r=2):t==9&&(e=1,r=2),{valign:e,halign:r}}parseMText(t){let{fontSize:e,fontFamily:r}=t,i=this.splitOneLineText(t),n=ms(t.layerId),s=!n&&t.mirror||n&&!t.mirror;this.autoLayerConfig(t.layerId).isMirror&&(s=!s);let l=t.rotation*180/Math.PI,c=s?-l:l;for(let h of i){if(!h.text)return;let u=h.position,d=this.getTextAlign(t.origin);this.autoEntity($N.builder({type:$N.entityName,pcb_layer:null,handle:this.autoHandle(),layer:this.autoLayer(t.layerId),text:h.text,startPoint:u,endPoint:u,xScale:1.1,halign:d.halign,valign:d.valign,tiltAngle:0,height:h.textHeight,rotation:c,pcbString:null,reverse:s,fontSize:e*.7,fontFamily:r}),t.layerId)}}splitOneLineText(t){let e=t.value.split(`
`);if(e.length<2||t.getParent()!=null){let{showKey:a,showValue:l,key:c,value:h}=t,u=a&&l;return[{position:t.position,text:(a?c:"")+(u?":":"")+(l?h:""),textHeight:t.height*.7}]}let r=t.box.leftUp,i=[],n=t.box.leftUp.sub(t.box.leftLow).normalize(),s=t.box.height/e.length;return e.forEach((a,l)=>{let c=r.sub(n.mul(s*(l+1)));i.push({position:c,text:a,textHeight:s/1.2})}),i}parseVias(t){let e=t.includes("Via"),r=t.includes("ViaDrill");if(!e&&!r)return;let i=this.clearance,n={width:this.defaultViaStroke},s=e?[12,5,6]:[];if(r&&s.push(47),s=s.filter(l=>this.allowLayer(l)),!s.length)return;let a=Tn.getInstance().getAllItem();for(let l of a)for(let c of s){let h=l.getFileGraphics(c,i);if(h)for(let u of h)this.parsePoly(c,u,void 0,n)}}parseLineShape(t){let e=[],r=!1;for(let i of t)switch(i){case"BoardOutline":e.push("Board Outline");break;case"BoardCutout":e.push("Slot Region");break;case"CopperOutline":e.push("Copper Region");break;case"SolidRegion":e.push("Fill Region");break;case"ProhibitedRegion":e.push("Prohibited Region");case"TearDrop":e.push("TearDrop");break;case"Line":e.push("Line");break;case"Shell_Outline":e.push("3D Shell - Outline");break;case"Shell_ScrewPillar":e.push("3D Shell - Screw Pillar");break;case"Shell_SideDatumLine":e.push("3D Shell - Side Datum Line");break;case"Shell_TopBottomSlotRegion":e.push("3D Shell - Top Slot Region");break;case"Shell_SideSlotRegion":e.push("3D Shell - Side Slot Region");break;case"Shell_SideEntity":e.push("3D Shell - Side Entity");break;case"Shell_TopBottomEntity":e.push("3D Shell - Top/Bottom Entity");break;case"FPCStiffener":e.push("FPC Stiffener");break;case"CopperFilled":r=!0;break;default:break}if(e.length){let i=rn.getInstance().getAllItem(),n=zi.getInstance().getAllItem(),s=Mi.getInstance().getAllItem(),a=i.concat(n).concat(s);for(let l of a){let{type:c,layerId:h,strokeWidth:u}=l;e.includes(c)&&this.allowLayer(h)&&this.parsePoly(h,l.getMathGraphics(h),this.getHatchInfo(c),{width:u})}}if(r){let i=[];Wo.getInstance().getAllItem().forEach(a=>{a.style!=="none"&&this.allowLayer(a.layerId)&&i.push(a)});let n=[],s=[];i.some(a=>{a.getOutline().forEach(l=>{l&&(n.push(l),s.push({style:a.style,layerId:a.layerId}))})}),n.forEach((a,l)=>{let c=s[l],h=this.getHatchInfo(c.style==="solid"?"Fill Region":"Copper Region");this.parsePoly(c.layerId,a,h,{width:.2})})}Qn.iterator(i=>{let{layerId:n,style:s}=i;this.allowLayer(n)&&i.getOutline().forEach(a=>{let l=this.getHatchInfo(s?"Fill Region":"Line");this.parsePoly(n,a,l,{width:.2})})})}getPanelize(t){let e=ai.getInstance().getDefaultPanelize();if(!(e==null?void 0:e.success))return[];let i=ai.getInstance().getProfileGroup(t),n=ai.getInstance().getPadGroup(t),s=ai.getInstance().getText(t),a=t==12?ai.getInstance().slots.map(l=>({primitives:l.getMathGraphics(t).primitives,type:l.type,strokeWidth:l.strokeWidth})):[];return[].concat(i,n,s,a)}getMatrixArr(){let t=ai.getInstance().offset;if(Object.is(t,null))return;let{success:e}=ai.getInstance().getDefaultPanelize();if(!e)return;let{row:r,column:i,borderAtTopBottom:n}=ai.getInstance().getDefaultPanelize(),s=[];for(let a=1;a<=r;a++)for(let l=1;l<=i;l++){if(a==1&&l==1&&!n&&!n)continue;let c=Qe.translate(t.x*(l-1),t.y*(a-1));s.push(c)}s.length!==0&&(this.matrixArr=s)}parseEntityPanelize(t){var r,i,n;if(!((r=this.matrixArr)!=null&&r.length))return;let{onlyOutline:e}=ai.getInstance().getDefaultPanelize();if(!(e&&t.entity.layer!=((i=$e.getInstance().getLayer(11))==null?void 0:i.name))&&t.entity.layer!==((n=$e.getInstance().getLayer(56))==null?void 0:n.name)){for(let s of this.matrixArr){let a=t.cloneOne().multiply3(s).multiply3(B9.matrix);a.entity.handle=this.autoHandle();let c={items:a.entityDxfItems(),name:a.name,layer:a.entity.layer};B9.decode(c)}this.hasShape=!0}}resetPanelizeState(){if(this.isPanelize=!1,!this.allowLayer(11))return;let t=ai.getInstance().offset;if(Object.is(t,null))return;let{success:e}=ai.getInstance().getDefaultPanelize();e&&(this.isPanelize=!0)}parsePanelize(){if(this.isPanelize){this.isPanelize=!1;for(let t of this.exportLayers){let e=this.getPanelize(t);for(let r of e)r instanceof fe?this.parsePoly(t,r):r instanceof Li?this.parseMText(r):r.primitives&&r.primitives.length>0&&this.parsePoly(t,fe.build2(r.primitives),this.getHatchInfo(r.type),{width:r.strokeWidth})}this.isPanelize=!0}}async updateProgress(t){let e=t;t||(e=(this.cur+=.2)/4),A.publish("progressUpdate",[e,"Export DXF"],$()),await new Promise(r=>{setTimeout(r,30)})}autoHatch(t){var e;if(((e=t.outlines)==null?void 0:e.length)>0){let r=[];for(let i of t.outlines)r.push(i.cloneOne());this.autoEntity(dK.builder({type:dK.entityName,pcb_layer:null,handle:this.autoHandle(),layer:this.autoLayer(t.layerId),seedName:t.name,position:null,extrusionDirection:null,linkHandle:t.linkHandle,outlines:r}),t.layerId)}}getHatchInfo(t){let e=null;switch(t){case"Board Outline":case"Line":case"Copper Region":break;case"Fill Region":case"Slot Region":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":case"FPC Stiffener":e={name:"SOLID",layerId:null,linkHandle:null,outlines:null};break;case"Prohibited Region":e={name:"ANSI37",layerId:null,linkHandle:null,outlines:null};break}return e}parseImage(t){if(t.includes("Image")){let e=Qs.getInstance().getAllItem();for(let r of e){let i=r.layerId;if(!this.allowLayer(i))continue;r.getPath().forEach(s=>{let a=[];s.pl.points(1,l=>{a.push(l)}),this.parsePoly(i,fe.build4(a),this.getHatchInfo(i===56?"Line":"Fill Region"),{width:this.autoStroke()})})}}}parseTrack(t){let e=[],r,i;if(t.includes("Track")){let n=An.getInstance().getAllItem();for(let s of n)if(r=s.layerId,!!this.allowLayer(r)&&(i=s.width,!s.start.equals(s.end))){if(e=this.autoLwPoly(e,s.primitive,{layerId:r,width:i}),e.length>1){let a=QC.builder({type:QC.entityName,pcb_layer:null,handle:this.autoHandle(),layer:this.autoLayer(r),elevation:null,depth:null,shape:!1,hasContinuousLinetypePattern:null,numberOfVertices:e.length,vertexs:e,width:i,startWidth:null,endWidth:null,extrusionDirectionX:null,extrusionDirectionY:null,extrusionDirectionZ:null});this.autoEntity(a,r)}e=[]}}}autoLwPoly(t,e,r){let i=e.start(),n=e.end(),s=0;if(e instanceof q&&(s=on(e.bulge,3),e.sweepAngle<0)){let c=i;i=n,n=c}let a=t.length,l=t[a-1];if(a===0)this.autoPushVertex(t,i,s),this.autoPushVertex(t,n);else if(l&&l.entity.center.equals(i))s&&(l.entity.bulge=s),this.autoPushVertex(t,n);else if(t.length>1){r=r||{};let c=r.layerId||1,h=QC.builder({type:QC.entityName,pcb_layer:null,handle:this.autoHandle(),layer:this.autoLayer(c),elevation:null,depth:null,shape:!1,hasContinuousLinetypePattern:null,numberOfVertices:t.length,vertexs:t,width:this.autoStroke(r.width),startWidth:null,endWidth:null,extrusionDirectionX:null,extrusionDirectionY:null,extrusionDirectionZ:null});this.autoEntity(h,c);let u=[];return this.autoPushVertex(u,i,s),this.autoPushVertex(u,n),u}return t}parseDemension(t){if(t.includes("Dimension")){let e=Ka.getInstance().getAllItem(),r=Za.getInstance().getAllItem(),i=Sl.getInstance().getAllItem(),n=e.concat(r).concat(i);for(let s of n){if(!this.allowLayer(s.layerId))continue;let a=s.getBaseGraphics();for(let l of a)this.parsePoly2(s.layerId,l)}}}parseComponentSilkscreen(t){if(!t.includes("ComponentSilkscreen"))return;let e=xs.getInstance().getAllItem();for(let r of e){let i=r.getItems();for(let n of i){let s=+n.layerId;if(this.allowLayer(s)){if(n instanceof Li)this.parseMText(n);else if(n instanceof lr){let{strokeWidth:a}=n,l=n.getMathGraphics();l&&this.parsePoly(s,l,this.getHatchInfo(n.type),{width:a})}}}}}};var rme=class{constructor(){this.tool=null;this.state=tr.getInstance();A.subscribe("toggleRouteCorner",t=>{switch(t){case"routeLine(WIRING_CORNER_LINE45)":this.state.type="WIRING_CORNER_LINE45";break;case"routeLine(WIRING_CORNER_LINE90)":this.state.type="WIRING_CORNER_LINE90";break;case"routeLine(WIRING_CORNER_ARC45)":this.state.type="WIRING_CORNER_ARC45";break;case"routeLine(WIRING_CORNER_ARC90)":this.state.type="WIRING_CORNER_ARC90";break;case"routeLine(WIRING_CORNER_ARC)":this.state.type="WIRING_CORNER_ARC";break;case"routeLine(WIRING_CORNER_FREEANGLE)":this.state.type="WIRING_CORNER_FREEANGLE";break}this.tool!=null&&this.tool.wireCorner(this.state.type),Yh.type&&A.publish("FlushSketcherAttrView",{type:Yh.type}),Hi()}),A.subscribe("toggleRouteMode",t=>{switch(t){case"routeMode(WIRING_MODE_OBSTRUCT)":this.state.mode="WIRING_MODE_OBSTRUCT";break;case"routeMode(WIRING_MODE_SURROUND)":this.state.mode="WIRING_MODE_SURROUND";break;case"routeMode(WIRING_MODE_IGNORE)":this.state.mode="WIRING_MODE_IGNORE";break;case"routeMode(WIRING_MODE_PUSHAWAY)":this.state.mode="WIRING_MODE_PUSHAWAY";break;case"routeMode(WIRING_MODE_SURROUND_AND_PUSHAWAY)":this.state.mode="WIRING_MODE_SURROUND_AND_PUSHAWAY";break}this.tool!=null&&this.tool.wireMode(this.state.mode),A.publish("flushSelectingInfo",""),Hi()}),A.subscribe("WireWidth",this.wireWidth.bind(this))}addDrawTool(t){this.tool=t,this.tool!=null&&(this.tool instanceof Vo||this.tool instanceof rc||this.tool instanceof Tc||this.tool instanceof Sh||this.tool instanceof YC||this.tool instanceof XC||this.tool instanceof jC)&&(we.isRouting=!0)}clearDrawTool(){this.tool!=null&&(this.tool instanceof Vo||this.tool instanceof rc||this.tool instanceof Tc||this.tool instanceof Sh||this.tool instanceof YC||this.tool instanceof XC||this.tool instanceof jC)&&(we.isRouting=!1),this.tool=null}toggleWidth(t){if(t=="WIRING_WIDTH_COMMONLY_SSETTING")A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",$());else if(t=="WIRING_WIDTH_RULESSETTING"){let e={activeMenu:"Track"};A.publish("openMainDialog",{cmd:5,data:{option:e}})}else if(t=="WIRING_WIDTH_INPUT")A.publish("openMainDialog",{cmd:26,data:{tool:this.tool}});else if(this.tool!=null&&(this.tool instanceof Vo||this.tool instanceof rc||this.tool instanceof Tc||this.tool instanceof Sh||this.tool instanceof YC||this.tool instanceof XC||this.tool instanceof jC))this.tool.toggleWidth(t);else{let r=ce.trackConfig[t].getSizeAccordingToUnit();we.prevTrackWidth=r}}getNextType(){return this.state.getNextType(we.diffTrack)}wireWidth(t){if(this.tool!=null&&t.length==2&&(this.tool instanceof Vo||this.tool instanceof rc)){let e=parseFloat(t[1])/10;isNaN(e)||(x.getInstance().unit!="mil"&&(e=new ft().conversion(x.getInstance().unit,"mil",e)),this.tool.setWireWidth(e),Hi()),A.publish("updateFrame","")}Yh.type&&A.publish("FlushSketcherAttrView",{type:Yh.type})}getTool(){return this.tool}};var ime=class{constructor(t,e,r,i,n){this.hotKey=t,this.action=e,this.uiAction=r,this.subHotkey=i,this.menuHotkeyCmd=n}},rv=class{constructor(){this.pcbMap=new Array;this.ftMap=new Array}modifyPcb(t,e,r,i,n){let s=!1;if(this.pcbMap.forEach(a=>{!s&&a.action===e&&(a.hotKey=t,a.uiAction=r,a.subHotkey=i,a.menuHotkeyCmd=n,s=!0)}),!s){let a=new ime(t,e,r,i,n);this.pcbMap.push(a)}}modifyFootprint(t,e,r,i,n){let s=!1;if(this.ftMap.forEach(a=>{!s&&a.action===e&&(a.hotKey=t,a.uiAction=r,a.subHotkey=i,a.menuHotkeyCmd=n,s=!0)}),!s){let a=new ime(t,e,r,i,n);this.ftMap.push(a)}}setConfig(t,e,r,i,n,s){switch(t){case 1:this.modifyPcb(e,r,i,n,s),this.modifyFootprint(e,r,i,n,s);break;case 4:this.modifyPcb(e,r,i,n,s);break;case 5:this.modifyFootprint(e,r,i,n,s);break}}getAction(t){let e=this.getHotkeyByKey(t);return e?e.action:null}getHotkeyByKey(t){if(x.getInstance().doctype===3||23==x.getInstance().doctype){for(let e of this.pcbMap)if(e.hotKey===t)return e;return null}else if(x.getInstance().doctype===4){for(let e of this.ftMap)if(e.hotKey===t)return e;return null}return null}getHotkeyByKey2(t){if(x.getInstance().doctype===3||23==x.getInstance().doctype){for(let e of this.pcbMap)if(e.hotKey===t||e.subHotkey===t)return e;return null}else if(x.getInstance().doctype===4){for(let e of this.ftMap)if(e.hotKey===t||e.subHotkey===t)return e;return null}return null}getHotkey(t){if(x.getInstance().doctype===3||23==x.getInstance().doctype){for(let e of this.pcbMap)if(e.action===t)return e.hotKey;return null}else if(x.getInstance().doctype===4){for(let e of this.ftMap)if(e.action===t)return e.hotKey;return null}return null}getHotkeyInfo(t){if(x.getInstance().doctype===3||23==x.getInstance().doctype){for(let e of this.pcbMap)if(e.action===t)return e;return null}else if(x.getInstance().doctype===4){for(let e of this.ftMap)if(e.action===t)return e;return null}return null}};var x$e={F1:!0,F4:!0,F6:!0,F7:!0,F9:!0,F10:!0,"Ctrl+Shift+R":!0,"Ctrl+Shift+O":!0,"Ctrl+Shift+B":!0,"Shift+Alt+E":!0,"Ctrl+Shift+G":!0,"Ctrl+L":!0,"Ctrl+Tab":function(){return!0},"Ctrl+Shift":!0,"Ctrl+H":!0,"Ctrl+Page Down":!0,"Ctrl+Shift+H":!0,"Shift+Alt+H":!0,"Ctrl+Shift+E":!0,"Ctrl+Shift+C":!0,"Ctrl+Shift+T":!0,"Ctrl+Shift+D":!0,"Ctrl+Shift+M":!0,"Ctrl+Shift+X":!0,"Ctrl+J":!0,"Ctrl+N":!0,"Ctrl+O":!0,"Ctrl+P":!0,"Ctrl+S":!0,Space:!0,"Ctrl+F":!0,"Ctrl+Shift+F":!0,"Ctrl+A":!0,"Alt+V":!0,Alt:!0,"Cmd+W":!0,"Ctrl+1":!0,"Ctrl+2":!0,"Ctrl+3":!0,"Ctrl+4":!0,"Ctrl+5":!0,"Ctrl+6":!0,"Ctrl+7":!0,"Ctrl+8":!0,"Ctrl+9":!0,"Ctrl+K":!0,"Ctrl+E":!0,F5:!0,"Ctrl+R":!0,"Shift+F5":!0,ESC:!0,"Ctrl+U":!0,"Ctrl+G":!0,"Ctrl+=":!0,Enter:!0,"Ctrl+-":!0,"Ctrl+0":!0,"Shift+Esc":!0,"Ctrl+T":!0,"Ctrl+Shift+N":!0,"Ctrl+W":!0,"Ctrl+F4":!0,"Ctrl+Page Up":!0,"Ctrl+Shift+Tab":!0},mK=class{constructor(){this.scenes={};this.hotkeys=new Set;this.scenes[1]=new rv,this.scenes[2]=new rv,this.scenes[3]=new rv,this.scenes[4]=new rv,this.scenes[5]=new rv,this.scenes[6]=new rv}restore(){this.hotkeys.clear()}modify(t,e,r,i,n,s,a){let l=this.scenes[t];l!=null&&(l.setConfig(e,r,i,n,s,a),this.hotkeys.add(r))}getHotKey(t){let e=this.getKeyCode(t.keyCode);return t.altKey&&e!=="Alt"&&(e="Alt+"+e),t.shiftKey&&e!=="Shift"&&(e="Shift+"+e),(r2?t.realCtrlKey:t.ctrlKey)&&e!=="Ctrl"&&e!="Control"&&(e=r2?"Control+"+e:"Ctrl+"+e),r2&&t.metaKey&&e!=="Cmd"&&(e="Cmd+"+e),e}getCtrlShift(){return(r2?"Control+":"Ctrl+")+"Shift"}shouldPreventHotkey(t){if(!t)return!1;let e={};for(let r in x$e){let i=this.fixCtrl(r);e[i]=x$e[r]}return typeof e[t]=="function"?e[t]():e[t]}fixCtrl(t){return typeof t=="string"&&(r2?t=t.replace(/Ctrl/g,"Cmd"):(t=t.replace(/Control\+Cmd|Cmd\+Control/g,"Ctrl"),t=t.replace(/Control/g,"Ctrl"),t=t.replace(/Cmd/g,"Ctrl"))),t}getLocalAction(t,e){let r=this.getHotKey(e),i=this.scenes[6];if(i!=null){let n=i.getAction(r.toString());if(t.includes(n))return n&&A.windowBridge.publish("sensorsEventsReport",{eventName:"hotkey",eventType:"pcb",eventData:{hotkey:r.toString(),function:n}},$()),n}return null}getAction(t,e){let r=this.getHotKey(e);if(this.handleHotkeyAction)return this.handleHotkeyAction;if(Array.isArray(t))for(let i of t){let n=this.scenes[i];if(n!=null){let s=n.getAction(r.toString()),a=yi.overrideAction[i];if(a!=null&&s!=null&&a.indexOf(s)>=0)return A.windowBridge.publish("sensorsEventsReport",{eventName:"hotkey",eventType:"pcb",eventData:{hotkey:r.toString(),function:s}},$()),this.hotkeyIsValid(e,s)?s:null;if(s!=null&&a==null)return A.windowBridge.publish("sensorsEventsReport",{eventName:"hotkey",eventType:"pcb",eventData:{hotkey:r.toString(),function:s}},$()),this.hotkeyIsValid(e,s)?s:null}}else{let i=this.scenes[t];if(i!=null){let n=i.getAction(r.toString());return n&&A.windowBridge.publish("sensorsEventsReport",{eventName:"hotkey",eventType:"pcb",eventData:{hotkey:r.toString(),function:n}},$()),i.getAction(r.toString())}}return null}hotkeyIsValid(t,e){return e?!0:!t.mouseInFrame&&e?!!this.scenes[1].getHotkeyInfo(e):!0}getConfigHotkey(t){let e="";for(let r in this.scenes)if(e=this.scenes[r].getHotkey(t),e==null)e="";else return e;return e}getConfigHotkeyInfo(t){let e;for(let r in this.scenes)if(e=this.scenes[r].getHotkeyInfo(t),e!=null)return e;return null}getKeyCode(t){switch(t){case 65:return"A";case 66:return"B";case 67:return"C";case 68:return"D";case 69:return"E";case 70:return"F";case 71:return"G";case 72:return"H";case 73:return"I";case 74:return"J";case 75:return"K";case 76:return"L";case 77:return"M";case 78:return"N";case 79:return"O";case 80:return"P";case 81:return"Q";case 82:return"R";case 83:return"S";case 84:return"T";case 85:return"U";case 86:return"V";case 87:return"W";case 88:return"X";case 89:return"Y";case 90:return"Z";case 48:return 0;case 49:return 1;case 50:return 2;case 51:return 3;case 52:return 4;case 53:return 5;case 54:return 6;case 55:return 7;case 56:return 8;case 57:return 9;case 96:return"Num0";case 97:return"Num1";case 98:return"Num2";case 99:return"Num3";case 100:return"Num4";case 101:return"Num5";case 102:return"Num6";case 103:return"Num7";case 104:return"Num8";case 105:return"Num9";case 106:return"Num*";case 107:return"Num+";case 108:return"Enter";case 109:return"Num-";case 110:return"Num.";case 111:return"Num/";case 112:return"F1";case 113:return"F2";case 114:return"F3";case 115:return"F4";case 116:return"F5";case 117:return"F6";case 118:return"F7";case 119:return"F8";case 120:return"F9";case 121:return"F10";case 122:return"F11";case 123:return"F12";case 8:return r2?"Delete":"Backspace";case 27:return"Esc";case 39:return"Right";case 37:return"Left";case 40:return"Down";case 38:return"Up";case gb.sub:return"-";case 190:return".";case 32:return"Space";case 9:return"Tab";case 33:return"Page Up";case 34:return"Page Down";case 13:return"Enter";case 45:return"Insert";case gb.SEMICOLON:return";";case 46:return"Delete";case 192:return"`";case 191:return"/";case 144:return"NumLock";case 17:return r2?"Control":"Ctrl";case 36:return"Home";case 35:return"End";case 16:return"Shift";case 219:return"[";case 221:return"]";case 220:return"\\";case gb.EQUAL:return"=";case 188:return",";case 222:return"'";case 20:return"CapeLock";case 18:return"Alt";case 91:return r2?"Cmd":"";default:return"Cmd"}}isAltAndDirection(t){if(t.toString().startsWith("Alt"))return!0;let e={F4:!0,F6:!0,F7:!0,F9:!0,F10:!0},r=["Right","Left"],i=!1;for(let n=0,s=r.length;n<s;n++)if(t==="Alt+"+r[n]){i=!0;break}return e[t]&&(i=!0),i}useBrowserHotkey(t){let e=!1;return{F11:!0,"Ctrl+V":!0}[t]&&(e=!0),e}},nme=class extends mK{getHotkeyInfo(t,e){let r=this.getHotKey(e);if(Array.isArray(t))for(let i of t){let n=this.scenes[i];if(n!=null){let s=n.getHotkeyByKey(r.toString());if(s){let a=s.uiAction;return A.windowBridge.publish("sensorsEventsReport",{eventName:"hotkey",eventType:"pcb",eventData:{hotkey:r.toString(),function:a}},$()),s}}}else{let i=this.scenes[t];if(i!=null){let n=i.getHotkeyByKey(r.toString());return n&&A.windowBridge.publish("sensorsEventsReport",{eventName:"hotkey",eventType:"pcb",eventData:{hotkey:r.toString(),function:n.uiAction}},$()),n}}return null}};var ome=class{constructor(){this.lexicalSplit=" ";this.sentenceSplit=";";this.cmdMap={};this.cmdMap.x="Absolute",this.cmdMap.ix="Relative",this.cmdMap.iy="RelativeY",this.cmdMap.l="ToggleLayer",this.cmdMap.z="DisplayLayer",this.cmdMap.s="Find",this.cmdMap.w="WireWidth",A.subscribe("globalCommand",this.parse.bind(this))}modify(t,e){let r=this.getKey(t);r!=null&&(delete this.cmdMap[r],this.cmdMap[e.toLocaleLowerCase()]=t)}getKey(t){for(let e in this.cmdMap)if(this.cmdMap[e]==t)return e;return null}parse(t){let e=t.split(this.sentenceSplit);for(let r of e){let i=this.parseSentence(r,this.lexicalSplit);i[0]=this.cmdMap[i[0].toLocaleLowerCase()],A.publish(i[0],i)}}parseSentence(t,e){let r=new Array,i=t.split(e);for(let n=0,s=i.length;n<s;n++){let a=i[n];switch(a){case";":case" ":case"":break;default:r.push(a)}}return r}};var sme=class{constructor(){this.inputInfo=Pi.getInstance();this.joinGroup=!1;this.ungroupSelected=!1;this.flip=!1;this.has2DLine=!1;this.canDispersedLine=!1;this.hasMultiUnCloseLine=!1;this.hasSelected=!1;this.hasMoreThanOneSelected=!1;this.hasSelectedDevice=!1;this.hasSelectedPad=!1;this.hasSelectedNet=!1;this.onlyAbstractProfile=!1;this.canDupToOtherLayer=!1;this.canDupToCursor=!1;this.onlyDevice=!1;this.twoDevice=!1;this._canIntersectionAggregate=!1;this._canSubtractionExclusive=!1;this._canBooleanSplit=!1;this._canSplit=!1;this._canCutout=!1;this._canAvoidSlotsOrPads=!1;this.route=!1;this._rotate=!1;this._canCopy=!1;this._isRouting=!1;this._redo=!1;this._undo=!1;this._adsorb=!0;this._realTimeDRC=!1;this._flipBoard=!1;this._removeLoop=!0;this._autoTrimSilkscreen=!0;this.command="";this.moveStatus=!1;this._smartMode=!1;this._editPadShapeMode=!1;this._grayState=0;this._diffTrack=!1;this._oldTrackParam={type:null,mode:null};this._docNeedUpdate=!1;this._topBoardColor="#FFFFFF";this._topSilkscreenColor="#000000";this._bottomBoardColor="#FFFFFF";this._bottomSilkscreenColor="#000000";this._footprintIsConnectDevice=!1;this._drawingProfile=!1;this.hasPoly2DLine=!1;this.canConvert2dLine=!1;this.hasBoard=!1;this._isShowBottomLayerScrollBarShow=!0;this.needSelectAlignRefObject=!1;this.needSelectAlignRefObjectForCenters=!0;this.isCheckedCrossProbeMode=!0;this._prevTrackWidth=null;this._stretchTrackMinCorner=1;ie.messageBus.rpcService("pcb/getTopMenuStatus",this.getTopMenuStatus.bind(this)),ie.messageBus.rpcService("/pcb/model/2dPreview/setPattern",()=>St.getInstance().pattern)}get footprintIsConnectDevice(){return x.getInstance().footprintIsConnectDevice}set footprintIsConnectDevice(t){x.getInstance().footprintIsConnectDevice=t}get drawing(){return this._drawingProfile}set drawing(t){this._drawingProfile=t}get docNeedUpdate(){return this._docNeedUpdate}set docNeedUpdate(t){this._docNeedUpdate=t}get smartMode(){return this._smartMode}set smartMode(t){this._smartMode=t,this.synchronize()}get editPadShapeMode(){return this._editPadShapeMode}set editPadShapeMode(t){this._editPadShapeMode=t}get grayState(){return this._grayState}set grayState(t){this._grayState=t,this.synchronize()}setCommand(t){this.command=t,this.synchronize()}getCommand(){return this.command}get ruler(){return x.getInstance().openRuler}get sizeFollowRule(){return ce.pcbConfig.startViaSize=="rule"}set sizeFollowRule(t){ce.pcbConfig.startViaSize=t?"rule":"last"}get prevTrackWidth(){return this._prevTrackWidth==null&&(this._prevTrackWidth=1),this._prevTrackWidth}set prevTrackWidth(t){this._prevTrackWidth=t,this.synchronize()}get stretchTrackMinCorner(){return this._stretchTrackMinCorner}set stretchTrackMinCorner(t){this._stretchTrackMinCorner=Math.floor(t)}get widthFollowRule(){return ce.pcbConfig.startTrackWidth==="rule"}set widthFollowRule(t){ce.pcbConfig.startTrackWidth=t?"rule":"last",this.synchronize()}set undo(t){this._undo=t,this.synchronize()}set redo(t){this._redo=t,this.synchronize()}get scale(){return Ni().getScale()}get canvasWidth(){return this.inputInfo.canvasWidth}get canvasHeight(){return this.inputInfo.canvasHeight}get mouseRealX(){return this.inputInfo.mouseX}get mouseRealY(){return this.inputInfo.mouseY}get mouseX(){return Fo(new S(this.inputInfo.sceneX,this.inputInfo.sceneY)).x}get mouseY(){return Fo(new S(this.inputInfo.sceneX,this.inputInfo.sceneY)).y}get sceneX(){return this.inputInfo.sceneX}get sceneY(){return this.inputInfo.sceneY}get tabId(){return x.getInstance().tabId}get doctype(){return x.getInstance().doctype}get isShowBottomLayerScrollBarShow(){return this._isShowBottomLayerScrollBarShow}set isShowBottomLayerScrollBarShow(t){this._isShowBottomLayerScrollBarShow=t}select(t){let{hasSelected:e,rotate:r,canCopy:i,flipMenu:n,hasMoreThanOneSelected:s,hasSelectedDevice:a,hasSelectedPad:l,hasSelectedNet:c,onlyAbstractProfile:h,canDupToOtherLayer:u,canDupToCursor:d,onlyDevice:p,twoDevice:m,joinGroup:g,ungroupSelected:y,route:b,flip:P,has2DLine:T,canDispersedLine:I,hasMultiUnCloseLine:C,canIntersectionAggregate:E,canSubtractionExclusive:O,canBooleanSplit:_,canSplit:R,canCutout:v,hasPoly2DLine:D,canConvert2dLine:w,hasBoard:F,canAvoidSlotsOrPads:H}=t;this.hasSelected=e,this.rotate=r,this.canCopy=i,this.flipMenu=n,this.hasMoreThanOneSelected=s,this.hasSelectedDevice=a,this.hasSelectedPad=l,this.hasSelectedNet=c,this.onlyAbstractProfile=h,this.canDupToOtherLayer=u,this.canDupToCursor=d,this.onlyDevice=p,this.twoDevice=m,this.joinGroup=g,this.ungroupSelected=y,this.flip=P,this.route=b,this.has2DLine=T,this.canDispersedLine=I,this.hasMultiUnCloseLine=C,this._canIntersectionAggregate=E,this._canSubtractionExclusive=O,this._canBooleanSplit=_,this._canSplit=R,this._canCutout=v,this.hasPoly2DLine=D,this.canConvert2dLine=w,this.hasBoard=F,this._canAvoidSlotsOrPads=H,this.synchronize()}allowFlip(t){this.flip=t,this.synchronize()}move(t){this.moveStatus=t,this.flipMenu=!this.moveStatus,this.synchronize()}set adsorb(t){this._adsorb=t,this.synchronize()}set isRouting(t){this._isRouting=t,this.synchronize()}get realTimeDRC(){return this._realTimeDRC}set realTimeDRC(t){this._realTimeDRC=t,this.synchronize()}get adsorb(){return this._adsorb}set flipBoard(t){this._flipBoard=t,this.synchronize()}get flipBoard(){return this._flipBoard}set removeLoop(t){this._removeLoop=t,this.synchronize(),Yh.type&&ie.publish("FlushSketcherAttrView",{type:Yh.type}),ie.publish("flushSelectingInfo","")}get removeLoop(){return this._removeLoop}get autoTrimSilkscreen(){return this._autoTrimSilkscreen}set autoTrimSilkscreen(t){this._autoTrimSilkscreen=t,this.synchronize()}set rotate(t){this._rotate=t,this.synchronize()}get rotate(){return this._rotate}set canCopy(t){this._canCopy=t,this.synchronize()}get canCopy(){return this._canCopy}get diffTrack(){return this._diffTrack}get canIntersectionAggregate(){return this._canIntersectionAggregate}get canSubtractionExclusive(){return this._canSubtractionExclusive}get canBooleanSplit(){return this._canBooleanSplit}get canSplit(){return this._canSplit}get canCutout(){return this._canCutout}get canAvoidSlotsOrPads(){return this._canAvoidSlotsOrPads}set diffTrack(t){this._diffTrack=t,this.synchronize()}get gridX(){return St.getInstance().getGridX()}get gridY(){return St.getInstance().getGridY()}get snapX(){return St.getInstance().getSnapX()}get snapY(){return St.getInstance().getSnapY()}get topBoardColor(){return this._topBoardColor}set topBoardColor(t){this._topBoardColor=t}get topSilkscreenColor(){return this._topSilkscreenColor}set topSilkscreenColor(t){this._topSilkscreenColor=t}get bottomBoardColor(){return this._bottomBoardColor}set bottomBoardColor(t){this._bottomBoardColor=t}get bottomSilkscreenColor(){return this._bottomSilkscreenColor}set bottomSilkscreenColor(t){this._bottomSilkscreenColor=t}get angleDelta(){return St.getInstance().angleDelta}get radius(){return St.getInstance().radius}get startAngle(){return St.getInstance().startAngle}get endAngle(){return St.getInstance().endAngle}get minRadius(){return St.getInstance().minRadius}get maxRadius(){return St.getInstance().maxRadius}get gridType(){return x.getInstance().gridType}set gridType(t){x.getInstance().gridType=t,this.realSynchronize()}get multiType(){return x.getInstance().multiType}set multiType(t){x.getInstance().multiType=t,this.realSynchronize()}get multiRatio(){return x.getInstance().multiRatio}set multiRatio(t){x.getInstance().multiRatio=t,this.realSynchronize()}getGridTypeByNum(t){switch(t){case 0:return"none";case 1:return"grid";case 2:return"outlets"}}getGridTypeByStr(t){switch(t){case"none":return 0;case"grid":return 1;case"outlets":return 2}}updateGridRange(t,e,r,i){St.getInstance().startAngle=t,St.getInstance().endAngle=e,St.getInstance().minRadius=r,St.getInstance().maxRadius=i}synchronize(){this.antiShake==null?this.antiShake=this.update(this.getCheck(),this.getDisable()):(clearTimeout(this.antiShake),this.antiShake=this.update(this.getCheck(),this.getDisable()));let t=Ni().getScale(),e=Xe(this.gridX),r=Xe(this.gridY),i=Xe(this.snapX),n=Xe(this.snapY),s=x.getInstance().unit,a=on(MM(St.getInstance().angleDelta),1,!0),l=Xs.conversion1("mil",x.getInstance().unit,St.getInstance().radius*10),c=x.getInstance().tabId;ie.publish("setSG",{scale:t,gridX:e,gridY:r,snapX:i,snapY:n,unit:s,polarAngleStep:a,polarRadiuStep:l,tabId:c},$())}updatePartialState(t){ie.publish("PartialRefreshTopMenuState",t,$())}realSynchronize(){this.updateRealInfo()}getValue(t){return+(t*10).toFixed(t.toString().length+1)}getCheck(){let t={},e=tr.getInstance();return t[`Grid(${this.getValue(this.gridX)}mil,${this.getValue(this.gridY)}mil)`]=!0,t[`Snap(${this.getValue(this.snapX)}mil,${this.getValue(this.snapY)}mil)`]=!0,t[`GridPolar(${W2(this.angleDelta)},${this.getValue(this.radius)})`]=!0,t[`switchGridType(${this.gridType})`]=!0,t[`trackWidth(${this.getValue(this.prevTrackWidth)})`]=!0,t[`unit(${x.getInstance().unit})`]=!0,t.toggleRealTimeDRC=this.realTimeDRC,t.toggleAdsorb=this.adsorb,t.flipBoard=this.flipBoard,t.autoTrimSilkscreen=this.autoTrimSilkscreen,t.smartSize=this.smartMode,t.removeLoop=this.removeLoop,t[`brightness(${this.grayState})`]=!0,t["trackWidthSetting(WIRING_WIDTH_FOLLOWRULES)"]=this.widthFollowRule,t.showRuler=x.getInstance().openRuler,t[`routeLine(${e.type})`]=!0,t[`routeMode(${e.mode})`]=!0,t}getDisable(){return{joinGroup:this.joinGroup,ungroupSelected:this.ungroupSelected,flip:this.flip,has2DLine:this.has2DLine,canDispersedLine:this.canDispersedLine,hasMultiUnCloseLine:this.hasMultiUnCloseLine,canIntersectionAggregate:this._canIntersectionAggregate,canSubtractionExclusive:this._canSubtractionExclusive,canBooleanSplit:this._canBooleanSplit,canSplit:this._canSplit,hasSelected:this.hasSelected,hasMoreThanOneSelected:this.hasMoreThanOneSelected,hasSelectedDevice:this.hasSelectedDevice,hasSelectedPad:this.hasSelectedPad,hasSelectedNet:this.hasSelectedNet,onlyAbstractProfile:this.onlyAbstractProfile,canDupToOtherLayer:this.canDupToOtherLayer,canDupToCursor:this.canDupToCursor,onlyDevice:this.onlyDevice,twoDevice:this.twoDevice,route:this.route,redo:this._redo,undo:this._undo,isRoutingOrNotFollowRule:this._isRouting||!this.widthFollowRule,ruler:this.ruler,command:this.command,rotate:this.rotate,canCopy:this.canCopy,flipMenu:this.flipMenu,notDiffTrack:!this.diffTrack,canCutout:this._canCutout,hasPoly2DLine:this.hasPoly2DLine,canConvert2dLine:this.canConvert2dLine,hasBoard:this.hasBoard,canAvoidSlotsOrPads:this._canAvoidSlotsOrPads}}updateRealInfo(){let t={canvasWidth:this.canvasWidth,canvasHeight:this.canvasHeight,mouseRealX:this.mouseRealX,mouseRealY:this.mouseRealY,mouseX:this.mouseX,mouseY:this.mouseY,sceneX:this.sceneX,sceneY:this.sceneY,tabId:this.tabId,doctype:this.doctype,unit:x.getInstance().unit,scale:this.scale,adsrop:this.adsorb,gridType:this.gridType,coordinateType:St.getInstance().currentCoord};ie.publish("pcbCanvasINFO",t,$())}update(t,e){return ie.publish("enablePcbMenuItem",e,$()),setTimeout(()=>{23!=x.getInstance().doctype&&(ie.publish("switchCoordinateBtn",St.getInstance().currentCoord?"cartesian":"polar",$()),ie.publish("setPcbMenuItemChecked",t,$()),ie.publish("switchViewBtn",x.getInstance().renderMode?"outline":"normal",$()))},200)}getTopMenuStatus(){return{gridType:this.gridType}}};var ame=class extends kG{constructor(t){super(),this.radiusMarkItem=t,this.point=t.end,t.setRadiusLength(0)}doAction(t){if(t instanceof Sr&&t.type=="Copper Region"){if(t.isSelectOnlyLine(this.point.x,this.point.y))return this.radiusMarkItem.setRadiusLength(t.radius),!0}else if(t instanceof ct){let e=t.selectEdges(this.point.x,this.point.y);for(let r of e)if(r instanceof vt)return this.radiusMarkItem.setRadiusLength(r.radius),!0}else{if((t instanceof vt||t instanceof Si||t instanceof Sr)&&t.isSelect(this.point.x,this.point.y))return this.radiusMarkItem.setRadiusLength(t.radius),!0;if(t instanceof nr){let e=t.getHoveredArc(this.point.x,this.point.y);return e?(this.radiusMarkItem.setRadiusLength(e.rx),!0):!1}}return!1}};var lme=class{constructor(){A.subscribe("updateRadiusMark",this.computeRadius.bind(this))}computeRadius(t){Uo.iterator(e=>{this.updateRadius(e)})}updateRadius(t){if(t.getParent()!=null)return;let e=t.end,r=new ut(e.x,e.x,e.y,e.y),i=Vt.search4Types(r,wCe);i.setOnceAction(new ame(t)),i.once(wCe)}};var gK=class{constructor(t,e,r,i,n){this._referX=t,this._referY=e,this.cbs1=r,this.cbs2=i,this.cbs3=n}setReferPoint(t,e){this._referX=t,this._referY=e,this.cbs1(t,e)}movePoint(t,e){let r={x:t,y:e};return this.cbs2(r)}setEndPoint(t,e){this._endX=t,this._endY=e,this.cbs3(t,e,!1)}interrupt(){this.cbs3(null,null,!0)}get referX(){return this._referX}set referX(t){this._referX=t}get referY(){return this._referY}set referY(t){this._referY=t}get endX(){return this._endX}set endX(t){this._endX=t}get endY(){return this._endY}set endY(t){this._endY=t}};var cme=class{constructor(){this.currTool=null;this.subline=null;this.currAngle=0;this.executeCommand=!1;this.drawing=!1;this.model=null;this.first=!0;A.subscribe("ROTATE",this.parse.bind(this)),A.subscribe("rotateAssignAngle",this.rotateAssignAngle.bind(this))}parse(t){!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype||this.currTool!=null&&(this.drawing=!0,this.currTool.parse({cmdKey:"ROTATE:"+t}))}rotate(t,e,r){for(let i of r)i.rotateFor(t,e)}selectReferPointCallback(t,e){if(this.drawing){this.referPoint={x:t,y:e},Pr.model=3;let r=new S(t,e);return this.subline=new hr(1002,r,r,!0,ee.WHITE),this.cb1&&this.cb1(t,e),this.tool.recordStyle(),this.referPoint}}selectReferPointMoving(t){if(this.drawing){this.first&&(this.clearFilterItems(),this.setFilterItems(this.tool.group),this.first=!1);let e=new S(this.referPoint.x,this.referPoint.y),r=new S(t.x,t.y),i=r.angle(e);return this.subline&&(this.subline.end=r),this.tool.rotateFor(e,i-this.currAngle),this.cb2&&this.cb2(this.referPoint,t),this.currAngle=i,this.currAngle||0}return 0}selectEndPoint(t,e,r){if(this.drawing){if(this.drawing=!1,Pr.model=this.model,this.model=null,A.windowBridge.publish("removeRuler",{pcbId:x.getInstance().tabId,type:"circle"},$()),this.subline&&(this.subline.remove(),this.subline=null),r)this.tool.cancel(),this.commands.undo();else if(this.executeCommand&&this.commands.length){let i=new mi;i.addGroup(this.commands),this.tool.complete(),i.checkOutlines(Array.from(this.tool.group),new Set)}return this.cb3&&this.cb3(t,e,r,{angle:this.currAngle,referPoint:this.referPoint,commands:this.commands}),this.clearFilterItems(),this.currAngle}}rotateReferPoint(t,e,r,i,n){this.first=!0,Fn(t.items,(l,c,h)=>{(c instanceof mt||c instanceof vt)&&(t.items[h]=c.getParent())}),this.tool=t.items,this.executeCommand=t.executeCommand,this.setTool(e),this.cb1=r,this.cb2=i,this.cb3=n,this.subline=null,this.currAngle=0,this.drawing=!0,this.model=Pr.model,this.commands=new ve("Rotate By Reference Point"),t.commands&&t.commands.length>0&&t.commands.commands.forEach(l=>this.commands.addCommand(l)),Fn(this.tool.group,(l,c)=>{let h=Te.dispatch(c,"modify");this.commands.addCommand(h),c instanceof Ye&&(Te.dispatchCoppers(c,"delete",this.commands),c.clearCopper())});let s=new gK(0,0,this.selectReferPointCallback.bind(this),this.selectReferPointMoving.bind(this),this.selectEndPoint.bind(this)),a={command:"referencePoint1",program:s,msg:"Please select a reference point",needInput:!0};A.publish("toggle",a)}rotateAssignReferPoint(t,e,r,i,n){this.first=!0;let{x:s,y:a}=t;Fn(t.items.group,(h,u,d)=>{u instanceof mt&&(t.items.group[d]=u.getParent())}),this.tool=t.items,this.executeCommand=t.executeCommand,this.setTool(e),this.cb1=r,this.cb2=i,this.cb3=n,this.subline=null,this.currAngle=0,this.drawing=!0,this.model=Pr.model,this.commands=new ve("Rotate By Reference Point"),Fn(this.tool.group,(h,u)=>{let d=Te.dispatch(u,"modify");this.commands.addCommand(d)});let l=new gK(0,0,this.selectReferPointCallback.bind(this),this.selectReferPointMoving.bind(this),this.selectEndPoint.bind(this)),c={command:"referencePoint1",program:l,msg:"",assignReferPoint:{x:s,y:a},needInput:!0};A.publish("toggle",c)}setFilterItems(t){t.forEach(e=>{e!=null&&(di.filterItems.add(e),e instanceof Me&&e.getItems().forEach(r=>{di.filterItems.add(r)}))})}clearFilterItems(){di.filterItems.clear()}setTool(t){this.currTool=t}getTool(){return this.currTool}rotateAssignAngle(t){this.drawing=!1,Pr.model=this.model,this.model=null;let{x:e,y:r}=t;this.currTool!=null&&this.currTool instanceof WU&&this.currTool.completed({x:e,y:r}),this.subline&&(this.subline.remove(),this.subline=null);let i=t.angle/180*Math.PI,n=new S(this.referPoint.x,this.referPoint.y);this.tool.rotateFor(n,i-this.currAngle),this.tool.complete(),this.executeCommand&&this.commands.length&&je.executeCommand(this.commands),this.cb3&&this.cb3(e,r,!1,{angle:i,referPoint:this.referPoint}),this.clearFilterItems()}};var R$e=(i=>(i[i.turnAround="FLIP_LEFTANDRIGHT"]="turnAround",i[i.turnUpsideDown="FLIP_UPANDDOWN"]="turnUpsideDown",i[i.turnAroundByReferPoint="FLIP_LEFTANDRIGHT_BY_REFER_POINT"]="turnAroundByReferPoint",i[i.turnUpsideDownByReferPoint="FLIP_UPANDDOWN_BY_REFER_POINT"]="turnUpsideDownByReferPoint",i))(R$e||{}),uy=class uy{constructor(){this.currTool=null;this.items=new Array;this._flipQueue=[];this._isProcessingFlip=!1;this._currentFlipProgress=0;this._progressBase=0;A.subscribe("turn",this.parse.bind(this))}parse(t){!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype||this.currTool!=null&&this.currTool.parse({cmdKey:"FLIP:"+R$e[t]})}async processFlipQueue(){if(!(this._isProcessingFlip||this._flipQueue.length===0)){this._isProcessingFlip=!0,this._currentFlipProgress<=uy.FLIP_PROGRESS_START&&(this._progressBase=uy.FLIP_PROGRESS_START),this.showFlipProgress();try{for(;this._flipQueue.length>0;){let t=this._flipQueue.shift();t&&await t()}}catch(t){console.error("Error processing flip operation:",t),this.clearFlipQueue(),this.closeProgress();return}finally{let t=this._flipQueue.length===0;this._isProcessingFlip=!1,t?(this.closeProgress(),this._currentFlipProgress=0,this._progressBase=0):this.processFlipQueue()}}}addFlipToQueue(t){if(this._isProcessingFlip){this._flipQueue.length>=uy.MAX_QUEUE_SIZE&&(console.warn(`Flip queue size limit (${uy.MAX_QUEUE_SIZE}) reached, discarding oldest operation`),this.showQueueFullWarning(),this._flipQueue.shift()),this._flipQueue.push(t);return}this._flipQueue.length>=uy.MAX_QUEUE_SIZE&&(console.warn(`Flip queue size limit (${uy.MAX_QUEUE_SIZE}) reached, discarding oldest operation`),this.showQueueFullWarning(),this._flipQueue.shift()),this._flipQueue.push(t),this.processFlipQueue()}showQueueFullWarning(){A.publish("ui/toastMsg",{type:"warning",msg:['<span class="i18n">Too many flip operations in queue. Please wait for current operations to complete.</span>']},$())}showFlipProgress(){this._progressBase>=1&&(this._progressBase=Math.max(uy.FLIP_PROGRESS_START,1-uy.FLIP_PROGRESS_RANGE)),A.publish("progressUpdate",[this._progressBase,"flipping components"],$())}closeProgress(){A.publish("progressUpdate",[1,"flipping components"],$())}updateFlipProgress(t,e){let r=e>0?t/e*uy.FLIP_PROGRESS_RANGE:0,i=this._progressBase+r;i=Math.min(i,1),this._currentFlipProgress=i,A.publish("progressUpdate",[this._currentFlipProgress,"flipping components"],$())}clearFlipQueue(){this._flipQueue=[],this._isProcessingFlip=!1,this._currentFlipProgress=0,this._progressBase=0}turn(t,e,r,i){let n=i!=null?i:this.getCenter(t);ls.getInstance().init(t,"flip to"+KT,async(s,a)=>{if(!s||s.length===0)return;let l=async()=>{let c=a.getCommand(),h=e?{x:1,y:-1,z:1}:{x:-1,y:1,z:1},u=ce.pcbConfig.allowFootprintFlipping;s.forEach(d=>{if(d instanceof Me)u&&c.addCommand(Te.dispatch(d,"modify"));else if(d instanceof va)c.addCommand(Te.dispatch(d,"modify"));else if(d instanceof Le)d.getParent()==null&&c.addCommand(Te.dispatch(d,"modify"));else if(d instanceof mt||d instanceof vt){let p=d.getParent();p!=null&&p instanceof ct&&p.getParent()==null&&c.addCommand(Te.dispatch(p,"modify"))}else d instanceof Ye?d.getParent()==null&&c.addCommand(Te.dispatch(d,"modify")):d instanceof fr?c.addCommand(Te.dispatch(d,"modify")):d instanceof Yn?c.addCommand(Te.dispatch(d,"modify")):c.addCommand(Te.dispatch(d,"modify"))}),await this.turnCbInternal(n.x,n.y,e,h,c,s,r,null)};this.addFlipToQueue(l)})}turnByReferPoint(t,e,r){this.items=t.items,this.scalePoint=t.isTurnUpsideDown?{x:1,y:-1,z:1}:{x:-1,y:1,z:1},this.isTurnUpsideDown=t.isTurnUpsideDown,this.executeCommand=t.executeCommand,this.setTool(e),this.cb=r,this.commands=new ve("flip to"+KT),this.items.forEach(a=>{if(a instanceof Me)ce.pcbConfig.allowFootprintFlipping&&this.commands.addCommand(Te.dispatch(a,"modify"));else if(a instanceof va)this.commands.addCommand(Te.dispatch(a,"modify"));else if(a instanceof Le)a.getParent()==null&&this.commands.addCommand(Te.dispatch(a,"modify"));else if(a instanceof mt||a instanceof vt){let l=a.getParent();l!=null&&l instanceof ct&&l.getParent()==null&&this.commands.addCommand(Te.dispatch(l,"modify"))}else a instanceof Ye?a.getParent()==null&&this.commands.addCommand(Te.dispatch(a,"modify")):a instanceof fr?this.commands.addCommand(Te.dispatch(a,"modify")):a instanceof Yn?this.commands.addCommand(Te.dispatch(a,"modify")):this.commands.addCommand(Te.dispatch(a,"modify"))});let i=async(a,l)=>{let c=async()=>{await this.turnCb(a,l)};this.addFlipToQueue(c)},n=new R9(0,0,[i]),s={command:"referencePoint",program:n,msg:"Please select a reference point"};A.publish("toggle",s)}async turnCb(t,e){let{x:r,y:i,z:n}=this.scalePoint;this.shouldShowFlipTip(this.items)&&this.tips(),await this.flipItems(t,e,r,i,n,this.isTurnUpsideDown,this.items,this.commands),this.commands.length>0&&this.executeCommand&&this.checkOutlines(this.commands,this.items),this.cb&&this.cb(),this.cb=null,this.flushAttrAndSetCenter(t,e)}async turnCbInternal(t,e,r,i,n,s,a,l){this.shouldShowFlipTip(s)&&this.tips();let{x:c,y:h,z:u}=i;await this.flipItems(t,e,c,h,u,r,s,n),n.length>0&&a&&this.checkOutlines(n,s),l&&l(),this.flushAttrAndSetCenter(t,e)}checkOutlines(t,e){let r=new Set;e.forEach(n=>{if(n instanceof mt||n instanceof vt){let s=n.getParent();if(s!=null&&s instanceof Ye){r.add(s);return}}r.add(n),A.publish("hasModifyPcbItem",n)});let i=new mi;i.addGroup(t),i.checkOutlines(Array.from(r),new Set)}setTool(t){this.currTool=t,t!=null?we.allowFlip(!0):we.allowFlip(!1)}async flipItems(t,e,r,i,n,s,a,l){let c=[],h=Ae.translate(-t,-e,0).scale(r,i,n).translate1(t,e,0),u=Array.from(a),d=u.length;if(d===0)return;let p=ce.pcbConfig.allowFootprintFlipping,m=new Map,g=[];u.forEach((b,P)=>{if(b instanceof Me){if(p){let T=qf.updateComponentFootprint(b,s,new S(t,e),l);m.set(P,T)}}else g.push({item:b,index:P})});async function y(b,P){let T=new Set,I=Array.from(b.entries()).map(([C,E])=>E.then(()=>{if(T.add(C),T.size%uy.PROGRESS_UPDATE_INTERVAL===0||T.size===b.size){let O=g.length+T.size;this.updateFlipProgress(O,P)}}));await Promise.all(I)}for(let{item:b,index:P}of g){if(b instanceof va)b.flip(h);else if(b instanceof Le)b.getParent()==null&&b.flip(h);else if(b instanceof mt||b instanceof vt){let I=b.getParent();if(I!=null&&I instanceof ct&&I.getParent()==null){let E=I.globalIndex;c.includes(E)||(c.push(E),I.transform(h))}}else b instanceof Ye?b.getParent()==null&&(b instanceof nr?(b.start=b.getUR().multiply4(h),b.rotation=Math.PI*2-b.rotation,s&&(b.rotation=b.rotation+Math.PI)):b.transform(h)):b instanceof fr?(b.position=b.position.multiply4(h),b.mirror=!b.mirror,s&&(b.rotation=b.rotation+Math.PI),b.click()):b instanceof Yn||b instanceof Rs?(b.start=b.start.multiply4(h),b.mirror=!b.mirror,s&&(b.rotation=b.rotation+Math.PI)):b.transform(h);let T=g.findIndex(I=>I.index===P)+1;(T%uy.PROGRESS_UPDATE_INTERVAL===0||T===g.length)&&this.updateFlipProgress(T,d)}await y.call(this,m,d)}flushAttrAndSetCenter(t,e){this.currTool instanceof fU&&A.publish("flushSelectingInfo",""),this.currTool instanceof Gw&&this.currTool.setCenter(t,e)}buildItemsBBox(t){let e=new _e;for(let r of t)if(r instanceof xa){let{start:i,end:n,strokeWidth:s}=r,a=new _e;for(let l of B4(i,n))a.ext1(l.bbox());a.ext7(s/2),e.ext1(a.build())}else e.ext1(r.buildBBox());return e.build1()}getCenter(t){return this.buildItemsBBox(t!=null?t:this.items).center()}shouldShowFlipTip(t){let e=ce.pcbConfig.allowFootprintFlipping;return(t instanceof Array?t:Array.from(t)).some(i=>i instanceof Me)&&!e}tips(){A.publish("ui/toastMsg",{type:"info",msg:[{value:'"Allow Footprint Flipping" is not enabled and the selected footprint is being ignored. To enable it, please go to'},{text:"PCB Settings",call:{name:"commonButtonsSetting(PCB_FOOTPRINT)",args:{scrollTo:"allowFootprintFlipping"}},class:"space-btn-blue"}]},$())}};uy.FLIP_PROGRESS_RANGE=.8,uy.FLIP_PROGRESS_START=.1,uy.MAX_QUEUE_SIZE=20,uy.PROGRESS_UPDATE_INTERVAL=10;var hme=uy;var ume=class{constructor(){this.lastScene=[1];this.lastDropDrag=!1;this._dropDrag=!1;this.nonCanvas=1;this.scene=[1];this.needHistoryTool=new Set;this.overrideAction={}}get currentCanUndoTool(){return this._currentCanUndoTool}set currentCanUndoTool(t){this._currentCanUndoTool=t}get dropDrag(){return this._dropDrag}set dropDrag(t){this.lastDropDrag=this._dropDrag,this._dropDrag=t}saveSceneToSession(t){let r=!!window["USE-IFRAME-FOR-MAIN"]?window:$();r!=null&&r.sensorsDataFromTopWindow&&(r.sensorsDataFromTopWindow.canvasStatus=t)}getScene(){return this.scene}setArea(t){this.overrideAction[6]=t,this.scene.splice(0,0,6)}setDraw(){this.lastScene=Array.from(this.scene),this.scene=[4],this.saveSceneToSession("\u7ED8\u5236")}setPlace(){this.lastScene=Array.from(this.scene),this.scene=[5],this.saveSceneToSession("\u653E\u7F6E")}setSelect(){this.lastScene=Array.from(this.scene),this.scene=[2],this.saveSceneToSession("\u9009\u4E2D")}setNonSelect(){this.lastScene=Array.from(this.scene),this.scene=[3],this.saveSceneToSession("\u672A\u9009\u4E2D")}resetLastScene(){this.scene=Array.from(this.lastScene),this.dropDrag=this.lastDropDrag}};var Jw=class o extends fr{constructor(e){super(e);this.isBase=!0;this.sendDeleteMsg=!1}static build(e,r,i,n,s){let a=new Ed(su(),s,0,"",!1,e,!0,"default",n,0,r,3,i,!1,0,!1,!1,[],0,0,!1);return new o(a)}setColor(e){Oo.getInstance().textConfig.setCustomColor(this.globalIndex,e),this.refreshRender()}remove(){Oo.getInstance().textConfig.setCustomColor(this.globalIndex,null),super.remove()}setBBoxModify(){}setLayerModify(e){}};var hH=class extends ws{constructor(e=!1){super();this._isCheck=!1;this.allDimesionText=[];this.allDimesion=[];this.margin=2;this.textNum=0;this.alreadyPDimensions=[];this.alreadyLSDimensions=[];this.isCheckEnd=!1;this.checkCache=[];this.dimensionPositionXArr=[];this.textContentList=[];this.logger=new Gi(4);this.UNIT=x.getInstance().unit,this.pads=Kt.getAllItem(),this.tracks=pr.getAllItem(),this.polygons=pt.getAllItem(),this.images=Ln.getAllItem(),this.rects=Xt.getAllItem(),this.circles=Zt.getAllItem(),this.dimensions=Go.getAllItem(),this.radius=Uo.getAllItem(),this.allPads=[].concat(...this.pads),this.getBBox(),this.isPreview=e}getBBox(){let e=[].concat(...this.allPads,...this.tracks,...this.polygons,...this.images,...this.rects,...this.circles,...this.radius),r=_s(e);if(r.valid()){let i=r.build1();this.UL=i.UL(),this.UR=i.UR(),this.LL=i.LL(),this.LR=i.LR(),this.center=i.center()}}buildBox(){let e=new _e;return this.allDimesion.forEach(r=>{e.ext1(r.buildBBox())}),e.valid()?e.build1():null}getTextPosition(e){let r=this.dimensionPositionXArr.sort((c,h)=>h-c),i=Math.max(Math.ceil(this.UR.sub(this.LR).y/(e*1.2)),5),n=new S(r[0]+12,this.UR.y),s=this.UR.sub(this.LR).y,a=Math.floor(this.textNum/i),l=n.add(new S(a*18,-(this.textNum%i)*3));return this.textNum++,l}exportRawItemNums(e){let r=[];return e.forEach(i=>{r.push(i._num)}),r}sortByXOrY(e,r){return e.sort((n,s)=>{let a=n.center.x,l=n.center.y,c=s.center.x,h=s.center.y;if(r==="X")return Math.abs(a-c)>1e-4?a-c:Math.abs(l-h)>1e-4?h-l:0;if(r==="Y")return Math.abs(l-h)>1e-4?h-l:Math.abs(a-c)>1e-4?a-c:0})}groupSortByX(){let e=[],r=1e5,i=[];this.sortByXItems=this.sortByXOrY(this.allPads,"X"),this.logger.debug3("%s %s","rawSortItems-X",this.exportRawItemNums(this.sortByXItems));for(let n=0;n<this.sortByXItems.length;n++){let s=this.sortByXItems[n],a=i.length>0?s.center.x-i[i.length-1].center.x:0;r===1e5?(i.push(s),e.push(i),a=100001):Math.abs(r-a)<.01||r>1e5?i.push(s):(a=1e6,i=[s],n<this.sortByXItems.length-1&&e.push(i)),r=a}return e}groupSortByY(){let e=[],r=1e5,i=[];this.sortByYItems=this.sortByXOrY(this.allPads,"Y"),this.logger.debug3("%s %s","rawSortItems-Y",this.exportRawItemNums(this.sortByYItems));for(let n=0;n<this.sortByYItems.length;n++){let s=this.sortByYItems[n],a=i.length>0?s.center.y-i[i.length-1].center.y:0;r===1e5?(i.push(s),e.push(i),a=100001):Math.abs(r-a)<.01||r>1e5?i.push(s):(a=1e6,i=[s],n<this.sortByYItems.length-1&&e.push(i)),r=a}return e}addDimension(e,r,i,n,s,a=3){let l=cr(),c=i.sub(this.center),h=new S(0,0),u=new S(0,0),d=!1,p=[],m=(E,O)=>{E==="x"?c.y>0?(h=new S(i.x,this.UL.y+O),u=new S(n.x,this.UL.y+O),d=!0):(h=new S(i.x,this.LL.y-O),u=new S(n.x,this.LL.y-O)):E==="y"&&(c.x>0?(h=new S(this.LR.x+O,i.y),u=new S(this.LR.x+O,n.y),d=!0):(h=new S(this.LL.x-O,i.y),u=new S(this.LL.x-O,n.y)))};m(s,this.margin),this.allDimesion.map(E=>{p.push(E)});let g=_s(p);if(g.valid()){let E=g.build1(),O=ut.extend3(h,u);E.isIntersect(O)&&(this.margin=this.margin+1.5*1.2,m(s,this.margin))}let y=Math.pow(10,a);if(Math.round(u.sub(h).length()*y)/y===0)return{dimension:{},textContent:{},layer:{},textTitle:r,textValue:"",length:0};let b=new vw(l,e,r,h,u,i,n,a,1.5,.1,this.UNIT,d);this.allDimesion.push(b),this.dimensionPositionXArr.push(u.x);let P=e,T=b.getLength(),I=1;this.UNIT!="mil"&&(T=new ft().conversion1("mil",this.UNIT,T),I=3),T=Math.round(T*y)/y;let C=`${r}: ${MIe(T,I)}${this.UNIT}`;return{dimension:b,textContent:C,layer:P,textTitle:r,textValue:`${MIe(T,I)}${this.UNIT}`,length:T}}endAddDimension(){this.checkCache.sort((r,i)=>{let n=s=>Math.abs(s.end[s.direction]-s.start[s.direction]);return n(r)-n(i)}),this.dimensionPositionXArr=[];let e=[];this.checkCache.forEach(r=>{let{dimension:i,textContent:n,layer:s,textTitle:a,textValue:l,length:c}=this.addDimension(r.layerId,r.text,r.start,r.end,r.direction,r.precision);c!==0&&e.push({dimension:i,textContent:n,layer:s,textTitle:a,textValue:l,length:c})}),e.forEach(({dimension:r,textContent:i,layer:n,textTitle:s,textValue:a,length:l})=>{if(this.isPreview)this.textContentList.push({textTitle:s,textValue:a,highPrecisionValue:l}),this.allDimesionText.push([r,s]);else{let c=Jw.build(i,this.getTextPosition(1.5),.1,1.5,n);this.allDimesionText.push([r,c])}})}prevAddDimension(e,r,i,n,s,a=3){s==="y"&&i.y<n.y&&([i,n]=[n,i]),this.checkCache.push({layerId:e,text:r,start:i,end:n,direction:s,precision:a})}setPitchDimension(){this.sortByYItemGroup=this.groupSortByX(),this.sortByXItemGroup=this.groupSortByY();let e=this.sortByXItemGroup.length,r=this.sortByYItemGroup.length,i=n=>{let s=[];for(let a=0;a<n.length;a++){let l=n[a],c=[];l.forEach(h=>{c.push(h._num)}),s.push(c)}return s};e>=1&&(e>1?(this.prevAddDimension(13,"P1",this.sortByXItemGroup[0][0].center,this.sortByXItemGroup[0][1].center,"x"),this.prevAddDimension(13,"P3",this.sortByXItemGroup[e-1][0].center,this.sortByXItemGroup[e-1][1].center,"x"),this.alreadyPDimensions.push([this.sortByXItemGroup[0][0].num,this.sortByXItemGroup[0][1].num]),this.alreadyPDimensions.push([this.sortByXItemGroup[e-1][0].num,this.sortByXItemGroup[e-1][1].num])):e===1&&(this.prevAddDimension(13,"P1",this.sortByXItemGroup[0][0].center,this.sortByXItemGroup[0][1].center,"x"),this.alreadyPDimensions.push([this.sortByXItemGroup[0][0].num,this.sortByXItemGroup[0][1].num]))),r>=1&&(r>1?(this.prevAddDimension(13,"P2",this.sortByYItemGroup[0][0].center,this.sortByYItemGroup[0][1].center,"y"),this.prevAddDimension(13,"P4",this.sortByYItemGroup[r-1][0].center,this.sortByYItemGroup[r-1][1].center,"y"),this.alreadyPDimensions.push([this.sortByYItemGroup[0][0].num,this.sortByYItemGroup[0][1].num]),this.alreadyPDimensions.push([this.sortByYItemGroup[r-1][0].num,this.sortByYItemGroup[r-1][1].num])):r===1&&(this.prevAddDimension(13,"P2",this.sortByYItemGroup[0][0].center,this.sortByYItemGroup[0][1].center,"y"),this.alreadyPDimensions.push([this.sortByYItemGroup[0][0].num,this.sortByYItemGroup[0][1].num])))}getLeadSpanPosition(e){let r=null,i=null,n=null,s=null,a=c=>{if(gr(c.layerId))!r||!i?(r=c.center,i=c.center,n=c.num,s=c.num):r[e]>c.center[e]?(r=c.center,n=c.num):i[e]<c.center[e]&&(i=c.center,s=c.num);else{let h=c.buildBBox(),u=[h.UL(),h.LL(),h.LR(),h.UR()],d=fe.build4(u).primitives,p=c.getMathGraphics(),m=[];p.primitives.forEach(P=>{d.forEach(T=>{let I=Tt(P,T);for(let C=0;C<I;C+=2){let E=new S(Ee[C],Ee[C+1]);m.push(E)}})});let g=[];e==="x"?m.length<1?g=[h.UL().add(h.LL()).mul(.5),h.UR().add(h.LR()).mul(.5)]:g=m.sort((P,T)=>Math.abs(P.x-T.x)>1e-4?P.x-T.x:Math.abs(P.y-T.y)>1e-4?P.y-T.y:0):m.length<1?g=[h.UL().add(h.UR()).mul(.5),h.LL().add(h.LR()).mul(.5)]:g=m.sort((P,T)=>Math.abs(P.y-T.y)>1e-4?P.y-T.y:Math.abs(P.x-T.x)>1e-4?P.x-T.x:0);let y=g[0],b=g[g.length-1];!r||!i?(r=y,i=b,n=s=c.num):r[e]>y[e]?(r=y,n=c.num):i[e]<b[e]&&(i=b,s=c.num)}};return this.allPads.forEach(c=>{a(c)}),this.alreadyLSDimensions.push([n,s]),this.alreadyPDimensions.some(c=>c[0]===n&&c[1]===s?!0:c[1]===n&&c[0]===s)?null:[r,i]}setLeadSpanDimension(){let e=this.getLeadSpanPosition("x"),r=this.getLeadSpanPosition("y");e&&this.prevAddDimension(13,"LS1",e[0],e[1],"x"),r&&this.prevAddDimension(13,"LS2",r[0],r[1],"y")}setComponentDimension(){let e=new _e,r=new Array,i=new ft,n=.5;if(Fn(this.tracks,(s,a)=>{if(!a.isEmpty&&a.layerId===3){let l=a.getMathGraphics(a.layerId,0);Re.addAll(r,l.primitives),e.ext1(l.bbox())}}),Fn(this.polygons,(s,a)=>{if(!a.isEmpty&&a.layerId===3){let l=a.onlyOneChilds();if(l instanceof vt&&i.conversion1("mil","mm",l.radius*10)<n)return!1;let c=a.getMathGraphics(a.layerId,0);Re.addAll(r,c.primitives),e.ext1(c.bbox())}}),Fn(this.images,(s,a)=>{if(!a.isEmpty&&a.layerId===3){let l=a.getMathGraphics(a.layerId,0);Re.addAll(r,l.primitives),e.ext1(l.bbox())}}),Fn(this.rects,(s,a)=>{if(!a.isEmpty&&a.layerId===3){let l=a.getMathGraphics();Re.addAll(r,l.primitives),e.ext1(l.bbox())}}),Fn(this.circles,(s,a)=>{let l=i.conversion1("mil","mm",a.radius*10);if(!a.isEmpty&&a.layerId===3&&l>=n){let c=a.getMathGraphics();Re.addAll(r,c.primitives),e.ext1(c.bbox())}}),Fn(this.dimensions,(s,a)=>{if(!a.isEmpty&&a.layerId===3){let l=a.getMathGraphics();Re.addAll(r,l.primitives),e.ext1(l.bbox())}}),Fn(this.radius,(s,a)=>{if(!a.isEmpty&&a.layerId===3){let l=a.getMathGraphics();Re.addAll(r,l.primitives),e.ext1(l.bbox())}}),e.valid()){let s=e.build1();"DOCUMENT",this.prevAddDimension(13,"L",s.UL(),s.UR(),"x"),this.prevAddDimension(13,"W",s.LL(),s.UL(),"y")}}setPadDimension(){let e={},r=[];this.allPads.forEach(i=>{let n=i.getDimensionBBox(),s=n.width().toFixed(4)+"|"+n.height().toFixed(4);wy(e,s).push(i)});for(let i in e)e[i].sort((s,a)=>s.num-a.num),this.alreadyLSDimensions.some(s=>{let a=e[i][0].num;return s[0]===a&&s[1]===a})||r.push(e[i][0]);r.forEach((i,n)=>{let s=i.getDimensionBBox(),a=s.UL().add(s.UR()).mul(.5),l=s.LL().add(s.LR()).mul(.5),c=s.UL().add(s.LL()).mul(.5),h=s.UR().add(s.LR()).mul(.5),u=s.width(),d=s.height();this.prevAddDimension(13,u>=d?`PW${n+1}`:`PL${n+1}`,a,l,"y"),this.prevAddDimension(13,u>=d?`PL${n+1}`:`PW${n+1}`,c,h,"x")})}setAllDimension(e="mil"){if(this.UNIT=e||x.getInstance().unit,this.textContentList=[],this.allPads.length>1&&(this.setPitchDimension(),this.setLeadSpanDimension()),this.setComponentDimension(),this.setPadDimension(),this.endAddDimension(),this.isPreview)return this.textContentList}interrupt(){return this.allDimesionText.forEach(e=>{e[0].remove(),e[1]instanceof Jw&&e[1].remove()}),this.allDimesion.forEach(e=>{e.remove()}),!0}allDimensionVisible(e){let r=!1;return this.allDimesionText.forEach(n=>{!r&&n[0].isVisible!=e&&(r=!0),i(n[0]),n[1]instanceof Jw&&i(n[1])}),this.allDimesion.forEach(n=>{!r&&n.isVisible!=e&&(r=!0),i(n)}),r;function i(n){e?n.visible():n.hidden()}}onMouseLeftDown(e){if(this.isPreview){let r=e.realSceneX,i=e.realSceneY,n=[];this.allDimesionText.forEach(s=>{let a=!1;s[0].isSelect(r,i)&&(a=!0,n=s),s[0].hightlight(a)}),A.publish("setHighlightRowByNumber",n[1]||"",$())}return!0}onMouseLeftUp(){return!0}onMouseMove(e){let r=e.realSceneX,i=e.realSceneY;return this.isPreview||this.allDimesionText.forEach(n=>{let s=!1;n.map(a=>{a.isSelect(r,i)&&(s=!0)}),n[0].hightlight(s),n[1].setColor(s?ee.RED:ee.WHITE)}),!0}highlightDimension(e){this.allDimesionText.forEach(r=>{r[1]===e?r[0].hightlight(!0):r[0].hightlight(!1)})}};var dme=class{constructor(){this.currTool=null;this.currTool=null}changeTool(t){this.currTool=t}applyInputAtCursorValue(t){this==null||this.applyInputAtCursorValue(t)}valueInputEnd(t){this==null||this.valueInputEnd(t)}};var pme=class{constructor(t,e,r,i,n,s){this.id=t,this.start=e,this.end=r,this.condition=i,this.startIndex=n,this.endIndex=s}set condition(t){this._condition=t}get condition(){return this._condition}};var fme=class extends wi{addControllerCache(t){this.map.set(t.globalIndex,t),Vt.insert(t)}addDimension(t,e,r,i,n,s,a,l,c,h){let u=cr(),d=new Nh(u,t,e,r,i,n,s,a,l,c,h);return d.model=gR.getInstance().addDimension(u,t,e,r,i,n,x.getInstance().unit=="mil"?1:3,s,a,x.getInstance().unit,l),this.addControllerCache(d),d}rebuild(t,e,r,i,n,s,a,l,c,h,u){let d=new Nh(t,e,r,i,n,s,a,l,c,h,u);return d.restriction=ZE.getItem(t),d.model=gR.getInstance().addDimension(t,e,r,i,n,s,x.getInstance().unit=="mil"?1:3,a,l,x.getInstance().unit,c),this.addControllerCache(d),d}delete(t){t instanceof Nh&&(gR.getInstance().delete(t.model),this.map.delete(t.globalIndex))}clearAll(){let t=this.getAllItem();for(let e of t)e.remove(),this.delete(e)}setSmartDimensionLength(t,e,r=!1){let i=this.getItem(e);if(!i)return;let n=Kt.getItem(i.restriction.end),s=Kt.getItem(i.restriction.start);if(!s||!n)return;if(A.publish("clearDimension",""),s.locked&&n.locked)A.publish("ui/toastMsg",{type:"warn",msg:"The associated pad has been locked"},$());else{let c,h,u,d;n.locked?(c=s,h=n.globalIndex,u=i.end,d=i.start):(c=n,h=s.globalIndex,u=i.start,d=i.end);let p=0,m=0;switch(i.restriction.condition){case 0:d.x-u.x<0&&(t=-t),p=t-(d.x-u.x);break;case 1:d.y-u.y<0&&(t=-t),m=t-(d.y-u.y);break;case 2:let g=Math.atan2(d.y-u.y,d.x-u.x),y=t*Math.cos(g),b=t*Math.sin(g);p=y+u.x-d.x,m=b+u.y-d.y;break}(p!=0||m!=0)&&Y8.move(c.globalIndex,new S(p,m),!0,h,r?e:null)}let a=new er,l=Vs.movedItems.map(c=>a.getItem(c));Vs.addCommand(this.getItem(e),r?"add":"modify"),Vs.executeCommand(),A.publish("hasModifyPcbItem",l),A.publish("flushService","")}};var mme=class{constructor(){this.map={}}getItem(t){for(let e in this.map){let r=this.map[e].filter(i=>i.id==t);if(r.length)return r[0]}}addDRestriction(t,e,r,i,n,s){let a=new pme(t,e,r,i,n,s);return[e,r].forEach(l=>{let c=this.map[l];c==null&&(c=new Array,this.map[l]=c);let h=c.findIndex(u=>u.id==a.id);h>=0?c[h].condition!=a.condition&&(c[h].condition=a.condition):c.push(a)}),a}removeRestriction(t){for(let e in this.map)this.map[e]=this.map[e].filter(r=>r.id!=t),this.map[e].length==0&&delete this.map[e]}find(t){let e={};return t.forEach(r=>{let i=this.map[r];i!=null&&(e[r]=i.filter(n=>!!wh.getItem(n.id)))}),e}findAll(t){let e=new Set,r=new Set,i=new Set;for(let n of t)r.add(n),i.add(n);for(;r.size>0;){let n=new Set;for(let s of r){let a=this.map[s];a!=null&&a.forEach(l=>{e.add(l),!i.has(l.start)&&!n.has(l.start)&&(n.add(l.start),i.add(l.start)),!i.has(l.end)&&!n.has(l.end)&&(n.add(l.end),i.add(l.end))})}r.clear(),r=n}return t.forEach(n=>{if(!r.has(n)){let s=this.map[n];s!=null&&s.forEach(a=>{e.add(a),r.add(a.start),r.add(a.end)})}}),e}};var gme=class{constructor(){this._control=null;this.dimension=null;this.start=null;this.end=null;this.startSpots=[];this.highlightedSpots=[];this.bbox=null;this.condition=null;this.startId=null;this.endId=null;this.startIndex=null;this.endIndex=null;this.spotColor=ee.build(.7,.7,0,.7);this.state=0;this.command=new ve("Smart Dimension");this.initCommandFromOutside=!1;this._historyItems=new Set;this.moveOffsetFromStart=null;this.needMoreClickToDrag=!0;this.justSelectOnePoint=!1;this.historyState=2}get control(){return this._control}set control(t){this._control=t}addCommand(t,e){this._historyItems.has(t.globalIndex)||(this.command.addCommand(Te.dispatch(t,e)),this._historyItems.add(t.globalIndex))}executeCommand(){this.command.length>0&&(this.initCommandFromOutside||je.executeCommand(this.command),this.initCommandFromOutside=!1,this._historyItems=new Set,this.command=new ve("Smart Dimension"))}initGroupCommand(t){return this.initCommandFromOutside=!0,this.command=t}get movedItems(){return Array.from(this._historyItems)}reAddRestriction(t){this.startId=t.restriction.start,this.startIndex=t.restriction.startIndex,this.start=t.left,this.endId=t.restriction.end,this.endIndex=t.restriction.endIndex,this.end=t.right,this.condition=t.restriction.condition,this.dimension=t,this.bbox=new _e().ext2(this.start).ext2(this.end).build1(),this.state=2,this.historyState=1}highlightSpot(t,e){this.clearHighlightSpot();let r=new n_(su(),1002,t,e);r.color=this.spotColor,this.highlightedSpots.push(r)}clearHighlightSpot(){this.highlightedSpots.forEach(t=>t.remove()),this.highlightedSpots.length=0}addRestriction(t,e,r,i){if(this.start==null)this.startId=t,this.startIndex=e,this.start=r,this.startSpots.push(new n_(su(),1002,this.start,i)),this.startSpots[this.startSpots.length-1].color=this.spotColor,this.state=1;else if(this.startId!=t&&this.startSpots.length>0){this.endId=t,this.endIndex=e,this.end=r;let n=this.startSpots[this.startSpots.length-1].radius;this.startSpots.forEach(s=>s.remove()),this.startSpots=[],this.dimension=wh.addDimension(13,this.start,this.end,this.start,this.end,1.5,.09,!1,n,i),this.bbox=new _e().ext2(this.start).ext2(this.end).build1(),this.state=2,this.historyState=0}}move(t){if(this.justSelectOnePoint=!1,this._control&&(t.leftDown?this._control.onMouseMove(t):this._control.onMouseUpMove(t)),this.dimension!==null){this.historyState==1&&(this.addCommand(this.dimension,"modify"),this.historyState=2);let e=new S(t.sceneX,t.sceneY);this.moveOffsetFromStart||(this.moveOffsetFromStart=this.dimension.start.sub(e));let r=e.add(this.moveOffsetFromStart);if(this.bbox.isContainsX(e.x)&&!this.bbox.isContainsY(e.y)||ne.eq(this.start.y,this.end.y)){let i=new S(this.start.x,r.y),n=new S(this.end.x,r.y);this.condition=0,this.dimension.modifyDimension(i,n)}else if(!this.bbox.isContainsX(e.x)&&this.bbox.isContainsY(e.y)||ne.eq(this.start.x,this.end.x)){this.condition=1;let i=new S(r.x,this.start.y),n=new S(r.x,this.end.y);this.dimension.modifyDimension(i,n)}else{this.condition=2;let i=this.end.sub(this.start).normalize(),n=new S(-i.y,i.x),s=r.sub(this.start).dot(n),a=this.start.add(n.mul(s)),l=a.add(this.end.sub(this.start));this.dimension.modifyDimension(a,l)}return this.moveOffsetFromStart=new S(0,0),!0}return!1}build(){if(this.state==2){if(this.dimension.end.equals1(this.dimension.right)||this.dimension.start.equals1(this.dimension.left))return;if(this.condition!=null){let t=ZE.getItem(this.dimension.globalIndex);t&&t.condition!=this.condition&&this.isCloseLoop(this.dimension.globalIndex)&&A.publish("showPcbAlertMsg","This size is the determined size!",$());let e=ZE.addDRestriction(this.dimension.globalIndex,this.startId,this.endId,this.condition,this.startIndex,this.endIndex);this.dimension.restriction=e,this.state=0,this.historyState==0?(A.publish("openMainDialog",{cmd:32,data:{option:{value:this.dimension.length+this.dimension.unit,rulerId:this.dimension.globalIndex,unit:this.dimension.unit,isNew:!0}}}),this.isCloseLoop(this.dimension.globalIndex)&&A.publish("showPcbAlertMsg","This size is the determined size!",$())):this.command.length>0&&this.executeCommand()}return Vt.insert(this.dimension),this.dimension=null,this.start=null,this.end=null,this.bbox=null,this.condition=null,this.startId=null,this.endId=null,this.startIndex=null,this.endIndex=null,this.historyState=2,this.moveOffsetFromStart=null,!0}return!1}isCloseLoop(t){let e=wh.getItem(t),r=e.restriction.start,i=e.restriction.end,n=new Set,s=new Set([r]);for(;s.size>0;){let l=ZE.find(s);s.clear();for(let c in l)n.add(c);for(let c in l){let h=l[c];for(let u of h)if(!(!a(u.condition)||u.id==t)&&(n.has(u.start)||s.add(u.start),n.has(u.end)||s.add(u.end),s.has(i)))return!0}}return!1;function a(l){return e.restriction.condition==2||l==2?!0:e.restriction.condition==l}}cancel(){this.clearHighlightSpot(),this.startSpots.forEach(t=>t.remove()),this.startSpots=[],this.dimension!=null&&(this.dimension.remove(),this.dimension=null),this.start=null,this.end=null,this.bbox=null,this.condition=null,this.startId=null,this.endId=null,this.startIndex=null,this.endIndex=null,this.historyState=2,this.state!=0&&(this.state=0,A.publish("flushService",""))}exit(){this.dimension&&wh.delete(this.dimension),this.cancel()}};var yK=class{constructor(){this.pads=new Array;this.limitReg=null;this.logger=new Gi(4)}set options(t){this._options=t}get options(){return this._options}renumber(t){this.logger.debug1(t);let{range:e,sequsence:r,prefix:i,suffix:n,rule:s,step:a,isLimit:l,selectItems:c}=t;this.pads=new Array,this.commands=new ve("Renumber Pads");let h=Kt.getAllItem();if((c||(e==="selectPads"?Ve.getSelects():h)).forEach(d=>{if(d instanceof Le){let p=Te.dispatch(d,"modify");this.commands.addCommand(p),this.pads.push(d)}}),!!this.pads.length){if(this.sortPads(r),s==="suffix_prefix_Increment"&&this.renumberGroup1(r),r==="anti_clockwise"){let d=this.renumberGroup2(),p=Object.keys(d).length;if(p>5){this.logger.debug3("%s %s: %s","\u6392\u5E8F\u540E...\uFF0C\u9006\u65F6\u9488\uFF0C\u5206\u7EC4 > 5",p,this.pads);return}else if(p===5){this.logger.debug3("%s %s: %s","\u6392\u5E8F\u540E...\uFF0C\u9006\u65F6\u9488\uFF0C\u5206\u7EC4 = 5",p,this.pads);return}}if(this.logger.debug3("%s %s: %s","\u6392\u5E8F\u540E...",r,this.pads),this.limitReg=l?/[IOQSXZ]/gim:null,s==="prefixIncrement"){n=this.checkLimitStr(n);let d=i;this.pads.forEach(p=>{let m=d+n;p.num=m,delete p.renumberGroup,d=this.increaseAffix(d,a)})}else if(s==="suffixIncrement"){i=this.checkLimitStr(i);let d=n;this.pads.forEach(p=>{let m=i+d;p.num=m,delete p.renumberGroup,d=this.increaseAffix(d,a)})}else{let d=i,p=n,m=this.pads[0].renumberGroup;this.pads.forEach(g=>{let{renumberGroup:y}=g;m!==y&&(m=y,d=this.increaseAffix(d,a),p=n);let b=d+p;g.num=b,delete g.renumberGroup,p=this.increaseAffix(p,a)})}this.commands.length&&je.executeCommand(this.commands),A.publish("clearSelect",""),A.publish("flushAttrPlane","")}}sortPads(t){let e=this.pads.length,r;this.left_bottom_point=this.pads[0].center,t==="anti_clockwise"?(this.pads.forEach(i=>{let n=i.center;n.y<this.left_bottom_point.y?this.left_bottom_point=n:n.y===this.left_bottom_point.y&&n.x<this.left_bottom_point.x&&(this.left_bottom_point=n)}),this.logger.debug3("%s %s","\u9006\u65F6\u9488\u7F16\u53F7...\uFF0C\u5DE6\u4E0B\u89D2\u7684\u70B9...",this.left_bottom_point),r=this.anti_clockwise.bind(this)):t==="vertical_horizontal"?r=this.vertical_horizontal.bind(this):t==="horizontal_vertical"?r=this.horizontal_vertical.bind(this):t==="custom_path"&&(r=this.custom_path.bind(this));for(let i=0;i<e-1;i++)for(let n=0;n<e-1-i;n++){let s=this.pads[n].center,a=this.pads[n+1].center;if(r(s,a)){let l=this.pads[n];this.pads[n]=this.pads[n+1],this.pads[n+1]=l}}}renumberGroup1(t){let e=1,r=t==="vertical_horizontal"?"x":"y";this.pads[0].renumberGroup=e;let i=new th(.01);for(let n=1;n<this.pads.length;n++)i.eq(this.pads[n].center[r],this.pads[n-1].center[r])?this.pads[n].renumberGroup=this.pads[n-1].renumberGroup:(e++,this.pads[n].renumberGroup=e)}renumberGroup2(){let t=1,e="y";this.pads[0].renumberGroup=t;let r={[t]:1},i=0,n=null,s=null,a=new th(.01);for(let l=1;l<this.pads.length;l++)if(a.eq(this.pads[l].center[e],this.pads[i].center[e]))this.pads[l].renumberGroup=this.pads[i].renumberGroup,r[t]+=1,s=null,n=null;else if(r[t]===1)if(n){let c=e==="y"?"x":"y";a.eq(this.pads[l].center[c],this.pads[n].center[c])?(this.pads.splice(i,1),e=c,t--,this.pads[l].renumberGroup=this.pads[n].renumberGroup,r[t]+=1,i=n,l-=1):(this.pads[l].renumberGroup=t,s=l),n=null}else s&&(a.eq(this.pads[l].center[e],this.pads[s].center[e])?(this.pads.splice(i,1),this.pads[l].renumberGroup=this.pads[s].renumberGroup,r[t]+=1,i=s,l-=1):(this.pads[l].renumberGroup=t,r[t]=1,i=l),s=null);else e=e==="y"?"x":"y",t++,this.pads[l].renumberGroup=t,r[t]=1,n=i,i=l,s=null;return r}checkLimitStr(t){return this.limitReg&&this.limitReg.test(t)?t.replace(this.limitReg,function(e){return e==="Z"?"A":String.fromCharCode(e.charCodeAt(0)+1)}):t}anti_clockwise(t,e){let r=Math.abs(Math.atan2(t.y-this.left_bottom_point.y,t.x-this.left_bottom_point.x)*180/Math.PI),i=Math.abs(Math.atan2(e.y-this.left_bottom_point.y,e.x-this.left_bottom_point.x)*180/Math.PI),n=new th(.01);return n.eq(e.x,this.left_bottom_point.x)&&n.eq(e.y,this.left_bottom_point.y)||r>i?!0:r===i&&n.eq(t.x,e.x)&&n.greater(t.y,e.y)?!1:r===i&&n.eq(t.x,e.x)&&n.less(t.y,e.y)||r===i&&n.eq(t.y,e.y)&&n.greater(t.x,e.x)?!0:(r===i&&n.eq(t.y,e.y)&&n.less(t.x,e.x),!1)}custom_path(t,e){return t.index>e.index}horizontal_vertical(t,e){let r=new th(.01);return r.less(t.y,e.y)?!0:r.eq(t.y,e.y)?r.greater(t.x,e.x):!1}vertical_horizontal(t,e){let r=new th(.01);return r.greater(t.x,e.x)?!0:r.eq(t.x,e.x)?r.less(t.y,e.y):!1}increaseAffix(t,e){if(t==="")return"";if(/^[0-9]+$/.test(t))return(Number(t)+e).toString();if(/^[A-Z]+$/i.test(t)){let r=t.length-1,i=t.substr(0,r),n=t[r],s=n.charCodeAt(0),a=90;return s<a&&s+e<=a?(n=String.fromCharCode(s+e),n=this.checkLimitStr(n)):s<a&&s+e>a?(i=i?this.increaseAffix(i,1):"A",i=this.checkLimitStr(i),n=String.fromCharCode(65+(e-(90-s)-1)),n=this.checkLimitStr(n)):s===a&&(i=i?this.increaseAffix(i,1):"A",i=this.checkLimitStr(i),n=String.fromCharCode(65+(e-1)),n=this.checkLimitStr(n)),i+n}else return t}customPathRenumber(){if(A.messageBus.publish("tool","customPathRenumberPads"),this.options.range==="allPads"){let e=Kt.getAllItem();e.forEach(r=>{r.click()}),A.publish("select",e)}}};var yme=class{get toleranceTargetNet(){return this._targetNet}set toleranceTargetNet(t){this._targetNet=t}getToleranceTargetNet(t){if(!t)return;let e=te.getInstance().getNet(t);if(!e||!e.equalLengthGroup)return;let r=e.equalLengthGroup.targetNet;if(r)this.toleranceTargetNet=r;else{let i=e.equalLengthGroup.getAllNetIds(),n=i.map(a=>ze.getNetLength(a)),s=0;n.forEach((a,l)=>{n[l]>n[s]&&(s=l)}),this.toleranceTargetNet=i[s]}}cancel(){this.toleranceTargetNet=null,A.publish("showPcbMsgAtCursor",{show:!1},$())}update(t,e){let r=Fo(new S(t.sceneX,t.sceneY));(e=="Please Select The Reference Object"||e=="Please select a reference point")&&(r=r.add1(20,0)),A.publish("showPcbMsgAtCursor",{text:e,pos:r,show:!0,id:"textCursorMsg",tabId:x.getInstance().tabId},$())}updateNetLengthMsg(t,e){let{diffPairLength:r,netLength:i,net:n,additionalLength:s,hasIncreased:a}=e,l=e.netLength2!=null?e.netLength2:i;if(n){let c=te.getInstance().getNet(n),h=x.getInstance().unit;if(c!=null){let u=null,d=null,p=null,m=null;i!=null&&A.publish("updateNets",{updateNetLength:{[n]:i},unit:h},$());let g={};if(i!=null&&(g.updateNetLength={[n]:i}),c.netLengthPhysics!=null&&i!=null){let y=te.getInstance().getNetLengthPhysics(c.netLengthPhysics);u={netLength:la(i,h),netLengthMin:la(y.netLengthMin,h),netLengthMax:la(y.netLengthMax,h)}}if(c.netLengthTolerancePhysics!=null&&this.toleranceTargetNet&&l!=null){let y=te.getInstance().getNetLengthTolerancePhysics(c.netLengthTolerancePhysics).netLengthTolerance,b=ze.getNetLength(this.toleranceTargetNet);d={netLengthDiff:la(l-b,h),tolerance:la(y,h)},g.red={[n]:Math.abs(l-b)>y},ce.pcbConfig.showNetLength||(d=null)}if(c.netDifferential!=null&&r!=null){let y=c.netDifferential,b=te.getInstance().getDifferentialPhysics(y.differentialPhysics);p={diffPairLength:la(r,h),diffPairLengthMax:la(b.differentialPairLenTolerMax,h)}}s!=null&&(m={additionalLength:la(s,h),hasIncreased:la(a,h)}),u||d||p||m?A.publish("showPcbMsgAtCursor",{id:"netLengthCursorMsg",show:!0,data:{...u,...p,...m,...d},pos:t?Fo(new S(t.sceneX,t.sceneY)):null,tabId:x.getInstance().tabId,showNetLength:ce.pcbConfig.showNetLength,showDiffLength:ce.pcbConfig.showDiffLength},$()):this.cancel()}}}updateNetLengthMsg2(t,e){let{diffPairLength:r,netLength:i,net:n,additionalLength:s,hasIncreased:a}=e,l=e.netLength2!=null?e.netLength2:i;if(n){let c=te.getInstance().getNet(n),h=x.getInstance().unit;if(c!=null){let u=null,d=null,p=null,m=null;i!=null&&A.publish("updateNets",{updateNetLength:{[n]:i},unit:h},$());let g={unit:h};if(i!=null&&(g.updateNetLength={[n]:i}),c.netLengthPhysics!=null&&i!=null){let y=te.getInstance().getNetLengthPhysics(c.netLengthPhysics);u={netLength:la(i,h),netLengthMin:la(y.netLengthMin,h),netLengthMax:la(y.netLengthMax,h)}}if(c.netLengthTolerancePhysics!=null&&this.toleranceTargetNet&&l!=null){let y=te.getInstance().getNetLengthTolerancePhysics(c.netLengthTolerancePhysics).netLengthTolerance,b=ze.getNetLength(this.toleranceTargetNet);d={netLengthDiff:la(l-b,h),tolerance:la(y,h)},g.red={[n]:Math.abs(l-b)>y},ce.pcbConfig.showNetLength||(d=null)}if(c.netDifferential!=null&&r!=null){let y=c.netDifferential,b=te.getInstance().getDifferentialPhysics(y.differentialPhysics),P=dCe(r.len_P,h)-dCe(r.len_N,h);p={diffPairLength:la(P,h,h),diffPairLengthMax:la(b.differentialPairLenTolerMax,h)}}s!=null&&(m={additionalLength:la(s,h),hasIncreased:la(a,h)}),i!=null&&A.publish("updateNets",g,$()),u||d||p||m?A.publish("showPcbMsgAtCursor",{id:"netLengthCursorMsg",show:!0,data:{...u,...p,...m,...d},pos:t?Fo(new S(t.sceneX,t.sceneY)):null,tabId:x.getInstance().tabId,showNetLength:ce.pcbConfig.showNetLength,showDiffLength:ce.pcbConfig.showDiffLength},$()):this.cancel()}}}};var D$e=nd(Lb());var bme=class{constructor(){this._collectors=[]}putItem(t,e){if(!t||t instanceof fe&&t.primitives.length==0)return;let r=null;if(!(t instanceof fe&&t.isClose(e))&&this.iterator(n=>{let s=n.putItem(t,e);return s&&(r=n),!s}),r)return this.autoLink(r,e);this._collectors.push(t instanceof fe?t:fe.build2([t]))}autoLink(t,e){let r=t.primitives.length,i=this._collectors.indexOf(t),n=!1,s=0,a=-1;for(let l=0;l<this._collectors.length;l++){let c=this._collectors[l];if(l==i)continue;let h=c.primitives.length;if(n=r>h?t.putItem(c,e):c.putItem(t,e),n){r>h?(s=l,a=i):(s=i,a=l),this._collectors.splice(s,1);break}}return{sucess:n,delConnect:s,connect:a}}iterator(t){for(let e=0;e<this._collectors.length;e++){let r=this._collectors[e];if(!t(r,e))return}}get size(){return this._collectors.length}};var Pme=class{constructor(){this.trackMap=new Xl;this.viaMap=new Xl}addTrack(t,e,r,i,n,s){let a=cr(),l=An.getInstance().addTrack(a,t,e,r,i,n,s);return new Ar(l)}addVia(t,e,r,i,n,s,a,l,c,h,u,d,p=new Array,m=!1){let g=cr();s=bo(s),l=bo(l),t==0&&m&&(t=2);let y=Tn.getInstance().addVia(g,t,e,r,i,n,s,a,l,c,h,u,d,p,m);return new Ge(y)}clear(){this.trackMap.clear(),this.viaMap.clear()}clearPreview(){this.trackMap.iterator((t,e)=>{for(let r of e)r.update(),r.remove(),An.getInstance().delete(r.model,r.model.globalIndex);return!0}),this.viaMap.iterator((t,e)=>(e.update(),e.remove(),Tn.getInstance().delete(e.model,e.model.globalIndex),!0)),this.trackMap.clear(),this.viaMap.clear()}addCommand(t){if(!t)return;let e=x.getInstance().partitionId;this.trackMap.iterator((r,i)=>{for(let n of i){let s=pr.addTrackByModel(n.model);s.partition=e,t.addCommand4Item(s,"add")}return!0}),this.viaMap.iterator((r,i)=>{let n=Hr.addViaByModel(i.model);return n.partition=e,t.addCommand4Item(n,"add"),!0})}};var Tme=class{constructor(){this.workerBus=null;this.worker=null;this.state=2;this.manager=new Pme;this.matrixRes=null;this.historyGroup=null;this.selectNets=null;this._curProgressTitle="";this.workerName="pcbRouterWorker";this.config={routingRange:0,routingCorner:0,isKeep:!0,viaQuatity:0,routingEffectPriority:1,routingNetPriority:0,layers:[1,2,12],ignoreNets:[]};A.subscribe("pcb/autoRouting",t=>{this.autoRouting(t,!1)}),A.subscribe("pcb/routerResult",this.routerResult.bind(this)),A.subscribe("pcb/routerInterrupt",this.routerInterrupt.bind(this)),A.subscribe("pcb/routerProgress",t=>{let e=this.getProgressTitle(t.stage);this.updateProgress(t.progress,e,!1)})}getConfig(){return Ls(this.config)}loadWorker(t=!1){this.terminateWorker();let e={name:this.workerName};t?this.worker=new Worker(`editor?entry=pcb-router-worker.js${$().location.search.replace(/\?/,"&")}`,e):this.worker=new Worker(`editor?entry=pangolin-worker.js${$().location.search.replace(/\?/,"&")}`,e),this.worker.onerror=this.handleWorkerError,this.workerBus=new D$e.WorkerMessageBridge(A.messageBus,this.worker)}terminateWorker(){this.worker&&this.worker.terminate(),this.worker=null}handleWorkerError(t){console.error("router worker error:",t.message),this.terminateWorker()}async autoRouting(t,e=!1){if(!x.getInstance().isactive||![bi.PCB,bi.PCBMODULE].includes(x.getInstance().doctype)||!this.isAllowRouter(!0))return;let r=1e3,i=(parent.location.search||"").match(/pangolinStage=(\d+)/);i&&(r=parseInt(i[1]));let n=e?!1:t.routingEffectPriority===0,s=await this.createPangolinJson(t,!0,r,n);if(e)return this.matrixRes=null,s;if(!s)return;this.loadWorker(!0),this.toggleRouterState(0);let l=n?"pangolin/autoRoutingJR":"pangolin/autoRouting_wasm";$0(l,{color:"#9c50ff"}),this.workerBus.publish(l,{json:s,options:{VISUAL_DEBUG_TYPE:parent.window.VISUAL_DEBUG_TYPE,ROUTING_OPT_PATH_ALGO:parent.window.ROUTING_OPT_PATH_ALGO,STAGE:r}}),this.config.isKeep||(this.clearRoute(!1,void 0,this.selectNets),A.publish("updateFrame",""))}async autoRoutingForJR(t){if(!x.getInstance().isactive||![bi.PCB,bi.PCBMODULE].includes(x.getInstance().doctype)||!this.isAllowRouter(!0))return;let e=1e3,r=(parent.location.search||"").match(/pangolinStage=(\d+)/);r&&(e=parseInt(r[1]));let i=await this.createPangolinJson(t,!0,e,!0);return this.matrixRes=null,i}getProgressTitle(t){switch(t){case 1:return"Track optimizing...";case 2:return"Routing...";case 3:return"Initializing...";default:return"Autorouting..."}}routerResult(t){if(this.state!==1){console.error("Auto Routing is stop!",this.state);return}try{$0("PangolinResJson",void 0,t),this.updateCanvas(t),t.finish||t.progress===1?t.progress=1:t.progress=Math.min(t.progress,.99);let e=this.getProgressTitle(t.stage);this.updateProgress(t.progress,e)}catch(e){q0({type:"error",message:"Automatic Routing interrupt: "+e,shortMsg:"Automatic Routing interrupt!"}),this.routerInterrupt()}}previewJsonInCanvas(t){let e=new mi;e.createGroup("previewJsonInCanvas");let r=this.getMatrixRes(),i=null;i=this.parsePangolinPoints(t.board.path,r),this.drawPolygon({type:"Board Outline",layerId:11,pl:i},e),t.traces.forEach(n=>{i=this.parsePangolinPoints(n.path,r),this.drawPolygon({type:"Line",layerId:this.getProLayer(n.layer),pl:i,width:this.autoPangolinNum(n.width,r)},e)}),t.pins.forEach(n=>{i=this.parsePangolinPoints(n.path,r);let s=this.getProLayer(n.layer),a=s==12;this.drawPolygon({type:a?"Slot Region":"Fill Region",layerId:s,pl:i},e)}),t.vias.forEach(n=>{let s=this.parsePangolinPoint(n.location,r);i=fe.build2([q.buildCircle(s,this.autoPangolinNum(Math.max(n.size[0],n.size[1])/2,r),le.CCW)]),this.drawPolygon({type:"Slot Region",layerId:12,pl:i},e)}),t.keepouts.forEach(n=>{i=this.parsePangolinPoints(n.path,r),this.drawPolygon({type:"Prohibited Region",layerId:this.getProLayer(n.layer),pl:i},e)}),e.execute()}drawPolygon(t,e){if(!t.pl||t.pl.primitives.length==0)return;Object.is(t.locked,void 0)&&(t.locked=!0),t.net||(t.net=""),t.width||(t.width=1);let r=t.pl.primitives[0];if(t.type!="Line"&&t.pl.primitives.length==1&&r instanceof M){let s=pr.addTrack(t.layerId,r.start(),r.end(),t.width,t.locked,t.net);return e.addCommand4Item(s,"add")}let n=new au().create4Pl(t.type,t.layerId,t.pl,t.width,t.net,!1);e.addCommand4Item(n,"add")}parsePangolinPoint(t,e){let[r,i]=t,n=new S(r,i);return e&&(n=n.multiply3(e)),n}parsePangolinPoints(t,e){let r=t.map(i=>this.parsePangolinPoint(i,e));return r.length?fe.build4(r):null}updateCanvas(t){this.manager.clearPreview(),this.historyGroup.createGroup("autoRouting_each"),this.updateTracks(t.traces||t.tracks,this.getMatrixRes()),this.updateVias(t.vias,this.getMatrixRes()),Do.modify(),A.publish("updateFrame","")}clearRoute(t,e,r){hhe(this.historyGroup.getCommand(),t,e,r,!1)}autoBool2Num(t){return t?1:0}getPolylineInsideMap(t){let e={},r=1;for(let i=0;i<t.length;i++){let n=t[i],s=n.bbox(),a=[];for(let l in e)e[l].some(h=>{let u=h.bbox();if(s.isInside(u)||u.isInside(s))return a.push(l),!0});if(a.length===0)e[r++]=[n];else if(a.length===1)e[a[0]].push(n),e[a[0]]=e[a[0]].sort((l,c)=>c.bbox().area()-l.bbox().area());else{let l=[n];a.forEach(c=>{l.push(...e[c]),delete e[c]}),e[r++]=l.sort((c,h)=>h.bbox().area()-c.bbox().area())}}return e}getMatrix(){let t=10,e=39.37,r=Di.convert(1,t,e),i=Qe.scale(r),n=Qe.scale(1/r);return{matrix:i,matrixRes:n}}async createPangolinJson(t,e=!0,r=0,i=!0){t=Object.assign(this.config,t),this.historyGroup||(this.historyGroup=new mi,this.historyGroup.createGroup("autoRouting_total"));let n=r===3;n&&(t.isKeep=!1);let{matrix:s,matrixRes:a}=this.getMatrix();this.matrixRes=a;let l=t.routingCorner,c=[],h=[],u=this.getFilterBoard(),d=null;if(!u||u.length===0){let qe="Please draw a board outline first!";q0({type:"error",message:qe,shortMsg:qe});return}else if(u.length>1){let qe=new _e,lt=[];u.forEach(et=>{qe.ext1(et.buildBBox()),lt.push(...et.getMathGraphics().primitives)});let Ne=new oh(qe.build1(),2,1.2,new Gi(2),lt).detect();if(Ne.items.length===1)d=Ne.items[0];else{let et=this.getPolylineInsideMap(Ne.items);if(Object.keys(et).length>1){let dr="Found multiple board outlines, please change the extra board outlines as solt regions or delete them. All board outlines",vr=[dr+":"];u.forEach((Zr,xi)=>{vr.push(xi==0?" ":", "),vr.push({attr:{id:Zr.globalIndex,pcbid:x.getInstance().tabId},text:ur+Zr.number})}),e&&q0({type:"error",message:vr,shortMsg:dr});return}else{let dr=0,vr=null,Zr=$e.getInstance().getAllCopperLayerIds(),xi=null;Ne.items.forEach(Zi=>{let Fi=Zi.bbox().area();Fi>dr?(dr=Fi,vr&&h.push({path:this.autoPangolinPointsForArc(vr.asClose(),s),layers:Zr}),vr=Zi):h.push({path:this.autoPangolinPointsForArc(Zi.asClose(),s),layers:Zr})}),d=vr}}}let p=d||d||u[0].getMathGraphics(),m=Bt.isChildPcb();m&&(p=this.getChildPcbBoardOutline(p));let g=p.bbox(),y=this.autoPangolinBBox2(g,s),b=this.autoPangolinPointsForArc(p,s),P=te.getInstance().getDefaultSafeSpacing(),T=this.autoPangolinNum(P.getItemsMaxClearance([0,1,2,5],[11]),s),I=null;if(t.routingRange!=0){if(I=[],(t.routingRange==2?Ve.getComponents():Ve.getItems()).forEach(lt=>{if(lt instanceof Me)lt.getItems().forEach(Ne=>{if(Ne instanceof ds){let et=Ne.net;et&&!I.includes(et)&&I.push(et)}});else{let Ne=Bo(lt);Ne&&!I.includes(Ne)&&I.push(Ne)}}),I=I.filter(lt=>!t.ignoreNets.includes(lt)),I.length===0){let lt="No network selected!";q0({type:"error",message:lt,shortMsg:lt});return}}else t.ignoreNets.length>0&&(I=ze.getAllNets(),I=I.filter(qe=>!t.ignoreNets.includes(qe)));this.selectNets=I;let C=[],E={},O=[],_=[],R=new Xl,v=te.getInstance(),D={},w={},F=v.getAllNetClass();F&&(F.forEach(qe=>{let lt=qe.name,Ne=qe._nets;w[lt]=Array.from(Ne)}),D.netClasses=w);let H={},z=v.getAllNetDifferentials();z&&(z.forEach(qe=>{let lt=qe.name,Ne=qe.positiveNet,et=qe.negativeNet;H[lt]=[Ne.name,et.name]}),D.differentialPairClasses=H);let G={},W=v.getAllSafeSpacing(),L=[];W&&W.forEach(qe=>{L.push(qe.name)});let B={};L.forEach(qe=>{let lt=v.getSafeSpacing(qe),Ne=lt.status==0,et=$e.getInstance().getAllCopperLayerIds(),At=[];if(Ne){let dr={layers:et,trackToTrack:lt.getClearance(0,0),trackToVia:lt.getClearance(0,5),trackToPad:Math.max(lt.getClearance(0,1),lt.getClearance(0,2)),trackToFillRegion:lt.getClearance(0,6),trackToProhibitedRegion:Math.max(lt.getClearance(0,8),lt.getClearance(0,15)),trackToBoardOutline:lt.getClearance(0,11),viaToVia:lt.getClearance(5,5),viaToPad:Math.max(lt.getClearance(5,1),lt.getClearance(5,2)),viaToFillRegion:lt.getClearance(5,6),viaToProhibitedRegion:Math.max(lt.getClearance(5,8),lt.getClearance(5,15)),viaToBoardOutline:lt.getClearance(5,11)};this.transformRuleUnitToMM(dr),At.push(dr)}else et.forEach(dr=>{let vr={layers:[dr],trackToTrack:lt.getClearance(0,0,dr),trackToVia:lt.getClearance(0,5,dr),trackToPad:Math.max(lt.getClearance(0,1,dr),lt.getClearance(0,2,dr)),trackToFillRegion:lt.getClearance(0,6,dr),trackToProhibitedRegion:Math.max(lt.getClearance(0,8,dr),lt.getClearance(0,15,dr)),trackToBoardOutline:lt.getClearance(0,11,dr),viaToVia:lt.getClearance(5,5,dr),viaToPad:Math.max(lt.getClearance(5,1,dr),lt.getClearance(5,2,dr)),viaToFillRegion:lt.getClearance(5,6,dr),viaToProhibitedRegion:Math.max(lt.getClearance(5,8,dr),lt.getClearance(5,15,dr)),viaToBoardOutline:lt.getClearance(5,11,dr)};this.transformRuleUnitToMM(vr),At.push(vr)});B[qe]=At}),E.safeClearances=B;let N=v.getAllTrackPhysics(),U=[];N&&N.forEach(qe=>{U.push(qe.name)});let k={};U.forEach(qe=>{let lt=v.getTrackPhysics(qe),Ne=$e.getInstance().getAllCopperLayerIds(),et=[];if(Ne.forEach(dr=>{let vr=xe(Di.convert(lt.getMinWidth(dr)*10,1,39.37),3),Zr=xe(Di.convert(lt.getDefaultWidth(dr)*10,1,39.37),3),xi=xe(Di.convert(lt.getMaxWidth(dr)*10,1,39.37),3),Zi=[vr,Zr,xi];et.push(Zi)}),et.every(dr=>JSON.stringify(dr)===JSON.stringify(et[0]))){let dr=[{layers:Ne,trackWidth:et[0]}];k[qe]=dr}else{let dr=Ne.map((vr,Zr)=>({layer:vr,trackWidth:et[Zr]}));k[qe]=dr}}),E.trackWidths=k;let V=v.getAllRadiusPhysics(),Y=[];V&&V.forEach(qe=>{Y.push(qe.name)});let X={};Y.forEach(qe=>{let lt=v.getRadiusPhysics(qe),Ne=lt.defalutRadius*2,et=lt.defalutInner*2,At=[xe(Di.convert(Ne*10,1,39.37),3),xe(Di.convert(et*10,1,39.37),3)];X[qe]=At}),E.viaSizes=X;let Z=v.getAllDifferentialPhysics(),Q=[];Z&&Z.forEach(qe=>{Q.push(qe.name)});let ae={};Q.forEach(qe=>{let lt=v.getDifferentialPhysics(qe),Ne=xe(Di.convert(lt.differentialPairLenTolerMax*10,1,39.37),3);Ne<.127&&(Ne=.127);let et=$e.getInstance().getAllCopperLayerIds(),At=[];if(et.forEach(vr=>{let Zr=xe(Di.convert(lt.getStrokeWidthMin(vr)*10,1,39.37),3),xi=xe(Di.convert(lt.getStrokeWidthDefault(vr)*10,1,39.37),3),Zi=xe(Di.convert(lt.getStrokeWidthMax(vr)*10,1,39.37),3),Fi=xe(Di.convert(lt.getDifferentialPairSpacingMin(vr)*10,1,39.37),3),$i=xe(Di.convert(lt.getDifferentialPairSpacingDefault(vr)*10,1,39.37),3),yo=[Zr,xi,Zi,Fi,$i];At.push(yo)}),At.every(vr=>JSON.stringify(vr)===JSON.stringify(At[0]))){let vr=[{layers:et,lengthTolerance:Ne,width:At[0].slice(0,3),clearance:At[0].slice(3)}];ae[qe]=vr}else{let vr=et.map((Zr,xi)=>({layer:Zr,lengthTolerance:Ne,width:At[xi].slice(0,3),clearance:At[xi].slice(3)}));ae[qe]=vr}}),E.differentialPairs=ae;let he=v.getAllNetLengthPhysics(),re=[];he&&he.forEach(qe=>{re.push(qe.name)});let se={};re.forEach(qe=>{let lt=v.getNetLengthPhysics(qe),Ne=xe(Di.convert(lt.netLengthMin*10,1,39.37),3),et=xe(Di.convert(lt.netLengthMax*10,1,39.37),3);se[qe]=[Ne,et]}),E.trackLengths=se;let K=new Set(this.selectNets),me=v.getAllNets(),Oe=K.size>0?new Set([...me].filter(qe=>K.has(qe.name))):me;for(let qe of Oe){let lt=qe.name;if(!lt)continue;let Ne={net:lt,routing:!t.ignoreNets.includes(lt),safeClearance:qe.safeSpacing=="default"?v.getDefaultSafeSpacing().name:qe.safeSpacing,trackWidth:qe.trackPhysics=="default"?v.getDefaultTrackPhysics().name:qe.trackPhysics,viaSize:qe.radiusPhysics=="default"?v.getDefaultRadiusPhysics().name:qe.radiusPhysics,differentialPair:qe.differentialPhysics=="default"?v.getDefaultDifferentialPhysics().name:qe.differentialPhysics,trackLength:qe.netLengthPhysics=="default"?v.getDefaultNetLengthPhysics().name:qe.netLengthPhysics};if(C.push(Ne),L.includes(qe.safeSpacing))G[qe.safeSpacing]||(G[qe.safeSpacing]=[]),G[qe.safeSpacing].push(qe.name);else if(qe.safeSpacing=="default"){let da=v.getDefaultSafeSpacing().name;G[da]||(G[da]=[]),G[da].push(qe.name)}let At=v.getSafeSpacingByNet(lt,0).getItemMaxClearance(0,[0,1,2,5]),dr=v.getTrackPhysicsByNet(lt).getDefaultWidth(),vr=v.getRadiusPhysicsByNet(lt);if(vr.defalutRadius<=0||vr.defalutInner<=0||vr.defalutInner>=vr.defalutRadius){e&&q0({type:"error",message:["Found incorrect via size of"," ",{text:"Design Rule",i18n:!0,call:{topic:"DesignRuler"}}," ",", it must large than 0 mm, and via outside diameter must large than inside diameter, please modify"],shortMsg:"Incorrect via size!"});return}if(dr<=0){e&&q0({type:"error",message:["Found incorrect track width of"," ",{text:"Design Rule",i18n:!0,call:{topic:"DesignRuler"}}," ",{text:", it must large than 0 mm, please modify",i18nContext:"routing-dlg-track"}],shortMsg:"Incorrect track width!"});return}let Zr=[this.autoPangolinNum(vr.defalutRadius*2,s),this.autoPangolinNum(vr.defalutInner*2,s)],xi=this.autoPangolinNum(dr,s),Zi=this.autoPangolinNum(At,s),Fi=[Zr.toString(),xi.toString(),Zi.toString()].join("-"),$i=I&&!I.includes(lt),yo=this.autoBool2Num(!$i);if(R.contains(Fi)){_.push([lt,R.get(Fi),yo]);continue}O.push({viaSize:Zr,width:xi,clearance:Zi});let Ha=O.length-1;R.put(Fi,Ha),_.push([lt,Ha,yo])}D.netClearancesClasses=G,O.length&&_.push(["",0,this.autoBool2Num(!1)]);let Ie=t.isKeep||n,ue={},Pe={},j={},J=[],oe=Kt.getAllItem();oe=this.partitionFilter(oe),oe.forEach(qe=>{if(!(qe instanceof Ri||qe instanceof fn))return;let lt=qe.globalIndex,Ne=qe.net,et=qe.buildBBox(),At=this.autoPangolinBBox(et,s),dr=qe.layerId,vr=!1,Zr=null;if(qe.model.padStyle.type=="ELLIPSE"&&(Zr=xe(Di.convert(qe.model.padStyle.width*10,1,39.37),3)),gr(dr)&&qe instanceof Ri){let $i=qe.top,yo=qe.bottom,Ha=qe.inner;($i&&$i.type==="ELLIPSE"||yo&&yo.type==="ELLIPSE"||Ha&&Ha.type==="ELLIPSE")&&(Zr=this.getEllipsePadDiameter(qe.model));let da=0,Ic=Math.max(qe.topWidth,qe.topHeight);if(Ic>da&&(da=Ic,dr=1),Ic=Math.max(qe.bottomWidth,qe.bottomHeight),Ic>da&&(da=Ic,dr=2),Ic=Math.max(qe.innerWidth,qe.innerHeight),Ic>da){da=Ic;let kp=qe.getOneInnerInUse();kp&&(dr=kp)}(qe.holeLength>da||qe.holeRadius*2>da)&&(vr=!0)}let xi=this.autoPangolinPointsForArc(vr?qe.hole.getShape(0,qe.center,qe.rotation):qe.getMathGraphics(dr),s),Zi=this.getPangolinLayer(qe.layerId);if(J.push({net:Ne,layer:Zi,bbox:At,location:this.autoPangolinPoint(qe.center,s),rotation:Ht.toDegrees(qe.rotation),path:xi}),!(qe.getParent()instanceof Me)){let $i=[];gr(qe.layerId)?$i=$e.getInstance().getAllSignalLayerIds():$i.push(qe.layerId);let yo={number:qe.num,layers:$i,location:this.autoPangolinPoint(qe.center,s),path:xi,diameter:Zr};Pe[lt]=yo,j[lt]=Ne}}),_=this.fixRoutingPriority(_,J,t.routingNetPriority);let pe=[];if(Ie){let qe=[];pr.getAllItem().forEach(Ne=>{if(qe.includes(Ne.gId))return;let et=$t.filterTrack(Ne),At=Ne.gId;et=this.partitionFilter(et),et.forEach(dr=>{if(!(dr instanceof Ue))return;let vr=[...dr.searchAllConnectNode()].filter(Fi=>Fi instanceof Ri&&(Fi.layerId===12||Fi.layerId===dr.layerId)),Zr=[];vr.length>0&&vr.forEach(Fi=>{if(Fi.getParent()instanceof Me){let $i=Fi.getParent(),yo=$i.globalIndex;Zr.push([$i.designator,this.extractPrefix(Fi.globalIndex,yo)])}}),qe.push(dr.gId);let xi={id:dr.gId,width:xe(this.autoPangolinNum(dr.width,s),3),layer:this.getPangolinLayer(dr.layerId),net:dr.net,path:null,pads:Zr},Zi=dr instanceof Si?fe.build4(dr.model.primitive.points(.1)):fe.build4([dr.start,dr.end]);gx(ue,At,()=>({collector:new bme,traceConfig:xi})).collector.putItem(Zi)})})}let ge=[];(t.isKeep||n)&&this.partitionFilter(Hr.getAllItem()).forEach(lt=>{ge.push({id:lt.globalIndex,location:this.autoPangolinPoint2(lt.center,s),size:[this.autoPangolinNum(lt.radius*2,s),this.autoPangolinNum(lt.holeRadius*2,s)],net:lt.net})});let Se={},De=["Prohibited Region","Slot Region","Fill Region","Line"];Xt.getAllItem().concat(Zt.getAllItem()).concat(pt.getAllItem()).forEach(qe=>{let{type:lt,layerId:Ne,strokeWidth:et,net:At}=qe,dr=[];if(Ne==12?dr=$e.getInstance().getAllSignalLayerIds():dr.push(Ne),lt==="Partition"&&qe.model.component instanceof Dc){let vr=qe.model.component.fileUuid;if(!m&&vr){let Zr=this.getPolylineOutline(qe,Ne);this.autoPushFillRegionPath(c,Zr,s,Ne,p,At)}return}if(!(!this.isSingleLayer(Ne)&&!gr(Ne)&&lt!=="Board Outline")){if(De.includes(lt)){let vr=qe.getComponent();if(lt==="Prohibited Region"&&vr instanceof fd&&!vr.track)return;let Zr=this.getPangolinLayer(Ne),xi=this.getPolylineOutline(qe,Zr);if(lt==="Line"&&be.getLayer(Ne).isCopperLayer()){let Zi={id:qe.globalIndex,width:xe(this.autoPangolinNum(qe.strokeWidth,s),3),layer:Ne,net:"",path:this.autoPushPath(xi,s,p),pads:[]};pe.push(Zi)}if(xi.closed())lt==="Fill Region"&&this.autoPushFillRegionPath(c,xi,s,Ne,p,At),(lt==="Prohibited Region"||lt==="Slot Region")&&this.autoPushProhibitedRegionPath(h,xi,s,dr,p);else return xi.primitives.forEach(Zi=>{let Fi=Zi.stroke(et,kr.ROUND,le.CW).asClose();lt==="Fill Region"&&this.autoPushFillRegionPath(c,Fi,s,Ne,p,At),(lt==="Prohibited Region"||lt==="Slot Region")&&this.autoPushProhibitedRegionPath(h,Fi,s,dr,p)})}if(lt=="Constraint Region"){let vr=qe.globalIndex,Zr=qe.constrainName,xi=this.getPangolinLayer(Ne),Zi=this.getPolylineOutline(qe,xi),Fi=this.autoPushPath(Zi,s,p),$i=v.getAllConstraintRegions(),yo=Array.from($i).find(da=>da.name===vr),Ha={layers:dr,safeClearance:yo.safeClearance,trackWidth:yo.track,viaSize:yo.radius,differentialPair:yo.diff,path:Fi};Se[Zr]=Ha}}}),(!t.isKeep||n)&&this.clearRoute(!1,void 0,this.selectNets);for(let qe in ue){let lt=ue[qe],Ne=lt.traceConfig;lt.collector.iterator(et=>{let At=Object.assign({},Ne,{path:this.autoPangolinPointsForArc(et,s)});return pe.push(At),!0})}let tt=[],Ze=[],Wt={},Nr=Cr.getAllItem().map(qe=>qe.footprintUUID),Lr=Array.from(new Set(Nr));Lr&&Lr.forEach(qe=>{Ze.push(Ji.getItem(qe))}),Ze&&Ze.forEach(qe=>{let lt=qe.id,Ne=qe.uuid,et=qe.getBBox();if(!et)return;let At=this.autoPangolinBBox2(et,s),dr=qe.origin,vr=qe.getPads(),Zr={};vr.length>0&&vr.forEach(Zi=>{let Fi=Zi.globalIndex,$i=Zi.layerId,yo=Zi.center,Ha=yo.sub(dr),da=this.autoPangolinPoint2(Ha,s),Ic=Zi.rotation,kp=Zi.getMathGraphics($i),Cc=this.getFootprintNewOutlineByMatrix(kp,dr),Dt=this.autoPangolinPointsForArc(Cc,s),Al=null;Zi.padStyle.type=="ELLIPSE"&&(Al=xe(Di.convert(Zi.padStyle.width*10,1,39.37),3));let ht=[];if(ht.push($i),$i==12){ht=$e.getInstance().getAllSignalLayerIds();let Qr=Zi.top,Vi=Zi.bottom,jn=Zi.inner;(Qr&&Qr.type==="ELLIPSE"||Vi&&Vi.type==="ELLIPSE"||jn&&jn.type==="ELLIPSE")&&(Al=this.getEllipsePadDiameter(Zi));let wn=Zi.hole,ta=Zi.pasteExpansion||0,Na=Zi.topSolderExpansion||0,Us=Zi.bottomSolderExpansion||0,ra=VE(1,yo,Ic,Qr,Vi,jn,wn,ta,Na,Us),mu=VE(2,yo,Ic,Qr,Vi,jn,wn,ta,Na,Us),nc=ra.area(),id=mu.area(),Sc=nc>id?Zi.getMathGraphics(1):Zi.getMathGraphics(2),Pl=this.getFootprintNewOutlineByMatrix(Sc,dr);Dt=this.autoPangolinPointsForArc(Pl,s)}let _t={number:Zi.num,layers:ht,location:da,path:Dt,diameter:Al};Zr[Fi]=_t});let xi={pads:Zr,bbox:At};Wt[lt]?(Wt[lt+"_"+Ne]=xi,tt.push(Ne)):Wt[lt]=xi});let Dr={},Rr=Cr.getAllItem(),ke={},Yt={};Rr.forEach(qe=>{let lt=qe.attrKeyValue["Unique ID"];lt&&(ke[qe.globalIndex]=lt,Yt[lt]=qe.globalIndex)});let Ut=(await A.windowBridge.rpcCall("getAutoLayoutSymbolInfoByUniqueId",{uniqueID:Object.values(ke),pcbUuid:x.getInstance().tabId},$())).message||{};if(Rr){let qe={};Rr.forEach(et=>{let At=et.globalIndex,dr=et.designator;dr in qe?qe[dr].push(At):qe[dr]=[At];let vr={},Zr={};et.getPads().forEach($i=>{let yo=$i.globalIndex,Ha=$i.net,da=$i.num;yo.includes(et.globalIndex)&&(yo=yo.replace(et.globalIndex,"")),vr[yo]=Ha,Zr[yo]=this.getPinName(Ut,dr,da)});let Zi=tt.includes(et.footprintUUID)?et.footprintId+"_"+et.footprintUUID:et.footprintId,Fi={name:et.device,footprint:Zi,layer:et.layerId,location:this.autoPangolinPoint2(et.position,s),rotation:xe(Ht.toDegrees(et.rotation),4),nets:vr,pinName:Zr,reuseModules:{moduleName:et.reuseBlock,groupID:et.combinationID,channelID:et.channelID}};Dr[dr]=Fi});let lt=[],Ne=[];for(let et in qe){let At=qe[et];At.length>1&&(lt.push(...Array(At.length).fill(et)),Ne.push(...At))}if(lt.length>0){let et="Auto component routing failed, has duplicated designator, please modify",At=[et+":"];Ne.forEach((dr,vr)=>{At.push(vr==0?" ":", "),At.push({attr:{id:dr,pcbid:x.getInstance().tabId},text:lt[vr]})}),q0({type:"error",message:At,shortMsg:et});return}}let ar={pads:Pe,bbox:[0,0,0,0]};Object.keys(ar.pads).length!==0&&(Wt.FREEPADFOOTPRINT=ar,Dr.eFREEPADCOMPONENT={name:"d_FREEPADCOMPONENT",footprint:"FREEPADFOOTPRINT",layer:1,location:[0,0],rotation:0,nets:j,reuseModules:{moduleName:null,groupID:null,channelID:null}});let Fe=[],it=t.layers;it.length==0&&it.push(1,2,12),it.includes(12)&&(it=$e.getInstance().getAllSignalLayerIds());let ye=t.ignoreLayers;i&&(it.forEach(qe=>{let lt=this.getPlaneLayerNet(qe);Fe.push({name:be.getLayerName(qe),layerID:qe,isRoute:!0,net:lt})}),ye&&ye.forEach(qe=>{let lt=this.getPlaneLayerNet(qe);Fe.push({name:be.getLayerName(qe),layerID:qe,isRoute:!1,net:lt})}));let bt="";l==0?bt="45":l==1?bt="90":l==2?bt="arc":bt="any",ti.getAllItem().forEach(qe=>{if(be.getLayer(qe.layerId).isCopperLayer()&&qe.showValue){let lt=qe.getMathGraphics(qe.layerId);this.autoPushProhibitedRegionPath(h,lt,s,[qe.layerId],p)}});let de={boardOutline:{bbox:y,path:b},layers:i?Fe:{route:it,notRoute:ye},routingCorner:bt,rules:E,classes:D,nets:C,components:Dr,footprints:Wt,constraintRegions:Se,tracks:pe,vias:ge,fillRegions:c,prohibitedRegions:h};return $0("\u81EA\u52A8\u5E03\u7EBFJSON",void 0,de),de}getChildPcbBoardOutline(t){let e=Bt.getJudgeCanEditArea();if(!(t&&e&&e instanceof fe))return t;let r=new Fs(t,e,0).relation;if([1,2].includes(r)){let i=t.bbox().area(),n=e.bbox().area();i>n&&(t=e)}else t=new Kc().getIntersection([t],[e],[2,2])[0].items[0];return t}partitionFilter(t){return Bt.isChildPcb()||(t=t.filter(r=>r.partition=="")),t}autoPushKeepPath(t,e,r,i,n){new fc(e,n,0).relation!==3&&t.push({path:this.autoPangolinPoints(e,r),layer:i})}autoPushFillRegionPath(t,e,r,i,n,s){new fc(e,n,0).relation!==3&&t.push({path:this.autoPangolinPointsForArc(e,r),layer:i,net:s})}autoPushProhibitedRegionPath(t,e,r,i,n){new fc(e,n,0).relation!==3&&t.push({path:this.autoPangolinPointsForArc(e,r),layers:i})}autoPushPath(t,e,r){return new fc(t,r,0).relation!==3?this.autoPangolinPointsForArc(t,e):[]}fixRoutingPriority(t,e,r){let i={},n={},s=t.map(c=>(n[c[0]]=c,c[0])),a={};if(e.forEach(c=>{wy(i,c.net).push(c),a[c.net]?a[c.net]++:a[c.net]=1}),r===0)return t;if(r===1)WBe(s);else if(r===2)s.sort().sort((c,h)=>{let u=c.includes("$"),d=h.includes("$");return u&&!d?1:!u&&d?-1:0});else if(r===3||r===4){let c=r===3?1:-1;s.sort((h,u)=>(a[u]-a[h])*c)}else if(r===5||r===6){let c=r===5?1:-1;s.sort((h,u)=>(zo.getRatlineLengthByName(u)-zo.getRatlineLengthByName(h))*c)}else return t;let l=[];return s.forEach(c=>{l.push(n[c])}),l}getPangolinLayer(t){return t}getProLayer(t){return t}getPlaneLayerNet(t){let e=Qn.layerMapSet[t];return e&&e.size>0&&Array.from(e)[0].net||""}isSingleLayer(t){return be.getLayer(t).isSignalLayer()}autoPangolinPoint(t,e){return e&&(t=t.multiply3(e)),[t.x,t.y]}autoPangolinPoint2(t,e){return e&&(t=t.multiply3(e)),[xe(t.x,4),xe(t.y,4)]}autoPangolinBBox(t,e){return[this.autoPangolinPoint(t.LL(),e),this.autoPangolinPoint(t.UR(),e)]}autoPangolinBBox2(t,e){return t=t.transform(e),[xe(t.minX,4),xe(t.maxX,4),xe(t.minY,4),xe(t.maxY,4)]}areArraysEqual(t,e){return t[0]===e[0]&&t[1]===e[1]}autoPangolinPoints(t,e){let r=[],i="";return t.points(.1,n=>{let s=this.autoPangolinPoint(n,e),a=s.join("_");i!==a&&(i=a,r.push(s))}),r}autoPangolinPointsForPad(t,e){let r=[],i="";return t.points(.01,n=>{let s=this.autoPangolinPoint(n,e),a=s.join("_");i!==a&&(i=a,r.push(s))}),r}autoPangolinPointsForArc(t,e){let r=[];return t.primitives.forEach(i=>{if(i instanceof q)if(i.isCircle()){let n=i.sweepAngle/2,s=q.build3(i.center,i.startAngle,i.sweepAngle/2,i.rx,i.ry),a=this.autoPangolinPoint(s.start(),e),c=[...this.autoPangolinPoint(s.end(),e),n],h=[...a,n];(r.length===0||!this.areArraysEqual(r[r.length-1],a))&&r.push(a),r.push(c),r.push(h)}else{let n=this.autoPangolinPoint(i.start(),e),s=this.autoPangolinPoint(i.end(),e),a=i.sweepAngle,l=[...s,a];(r.length===0||!this.areArraysEqual(r[r.length-1],n))&&r.push(n),r.push(l)}else{let n=this.autoPangolinPoint(i.start(),e),s=this.autoPangolinPoint(i.end(),e);(r.length===0||!this.areArraysEqual(r[r.length-1],n))&&r.push(n),r.push(s)}}),r}autoPangolinResPoint(t,e){let r=new S(t[0],t[1]);return e?r.multiply3(e):r}autoPangolinNum(t,e){return e&&(t=t*e.iScale),t}isAllowRouter(t=!0){let e=te.getInstance().getDefaultSafeSpacing(),r=e.getClearance(11,0),i=e.getClearance(11,5);return r<=0||i<=0?(t&&q0({type:"error",message:["Found incorrect board outline clearance of"," ",{text:"Design Rule",i18n:!0,call:{topic:"DesignRuler"}}," ",", it must large than 0 mm, please modify"],shortMsg:"Incorrect board outline clearance!"}),!1):!0}toggleRouterState(t,e=!1,r=1){let i=this.state;if(t===0){if(i!=2)return;this.routerReady()}else{if(t===1)return;if(t===2){if(i!=1){this.state=t;return}this.routerEnd(e,r)}else if(t===3){if(i!=1){this.state=2;return}this.routerInterrupt()}}}routerReady(){this.state=0,this.startTime=new Date,this.manager.clear(),this._curProgressTitle="",this.state=1,this.updateProgress(0,this._curProgressTitle),this.historyGroup||(this.historyGroup=new mi,this.historyGroup.createGroup("autoRouting_total"));let t=be.getRatlineLayer();t.visible?(t.visible=!1,this._ratlineVisible=!0):this._ratlineVisible=!1}routerEnd(t=!1,e=1){this.terminateWorker(),this._ratlineVisible&&(be.getRatlineLayer().visible=!0),this.manager.addCommand(this.historyGroup),this.historyGroup&&this.historyGroup.execute(),this.historyGroup=null,this.putLogs(t),this.state=2,this.updateProgress(e,this._curProgressTitle)}routerInterrupt(t){let e="",r=!1;if(typeof t=="string"?(e=t,r=!1):t&&(r=t.manual,e=t.message),r){this.terminateWorker(),this.toggleRouterState(2);return}e&&q0({type:"error",message:e,shortMsg:e}),this._ratlineVisible&&(be.getRatlineLayer().visible=!0),this.manager.clearPreview(),this.historyGroup&&this.historyGroup.undo(),this.historyGroup=null,this.putLogs(!0),this.state=2,this.updateProgress(1,this._curProgressTitle)}updateTracks(t,e){let r=this,i=this.manager.trackMap;t&&t.forEach(s=>{let a=s.id;n(a,s)});function n(s,a){if(i.contains(s)){console.error("Repeated item:",a);return}let l=r.getProLayer(a.layer),c=a.path,h=r.autoPangolinNum(a.width,e),u=null,d=null,p=[];for(let m=0;m<c.length;m++){let g=r.autoPangolinResPoint(c[m],e);if(!u||u.equals(g)){u=g;continue}else d=g;let y=r.manager.addTrack(l,u,d,h,!1,a.net);p.push(y),u=d}i.put(s,p)}}updateVias(t,e){let r=this,i=this.manager.viaMap;t&&t.forEach(s=>{let a=s.id;n(a,s)});function n(s,a){if(i.contains(s)){console.error("Repeated item:",a);return}let l=r.autoPangolinResPoint(a.location,e),[c,h]=[r.autoPangolinNum(a.size[0]/2,e),r.autoPangolinNum(a.size[1]/2,e)],u=r.manager.addVia(0,"",1,2,a.net,c,l,h,!1,1,null,null);i.put(s,u)}}updateProgress(t,e,r=!0){if($().location.search.includes("pcbdebug"))return;isNaN(t)&&(t=1,console.error("There has undesired number of progress: ",t));let i=!0;e=e||this._curProgressTitle||this.getProgressTitle(0),this._curProgressTitle&&this._curProgressTitle!=e&&A.publish("/pro-ui/progressUpdate",{progress:1,title:this._curProgressTitle},$()),this._curProgressTitle=e,A.publish("/pro-ui/progressUpdate",{progress:t,title:e,closeFn:{messageTopic:"pcb/routerInterrupt",messageTopicData:{manual:!0},onlyInitiative:!0},showTitle:i},$()),t>=1&&r&&this.toggleRouterState(2)}putLogs(t=!1){if(t)return;let e=0;this.manager.trackMap.iterator((r,i)=>(e+=i.length,!0)),setTimeout(()=>{q0({type:"info",message:"Auto routing completed! Add tracks: {0}, add vias: {1}, nets completion: {2}, use time: {3}s.",shortMsg:"Auto routing completed!",replace:{0:e.toString(),1:Object.keys(this.manager.viaMap.origin()).length.toString(),2:((1-zo.getAllNets().length/ze.getAllNets().length)*100).toFixed(2)+"%",3:((new Date().getTime()-this.startTime.getTime())/1e3).toFixed(2).toString()},timeout:3e3})},20)}transformRuleUnitToMM(t){for(let e in t)if(t.hasOwnProperty(e)){let r=t[e];e!=="layer"&&e!=="layers"&&(t[e]=xe(Di.convert(r*10,1,39.37),3))}}getPolylineOutline(t,e){let r=t.getMathGraphics(e);if(!r)return;let i;return r instanceof Gt?i=r.items[0]:i=r,i}getEllipsePadDiameter(t){let e=t.top,r=t.bottom,i=t.inner,n=[];if(e&&e.type==="ELLIPSE"&&n.push(e.width),r&&r.type==="ELLIPSE"&&n.push(r.width),i&&i.type==="ELLIPSE"&&n.push(i.width),n.length>0){let s=n.length>1?Math.max(...n):n[0];return xe(Di.convert(s*10,1,39.37),3)}}getFilterBoard(){return uu().filter(t=>!t.getParent())}getPinName(t,e,r){for(let i in t)if(t.hasOwnProperty(i)){let n=t[i];for(let s of n)if(s.designator===e&&s.pinName&&s.pinName[r]!==void 0)return s.pinName[r]}}getMatrixRes(){return this.matrixRes||this.getMatrix().matrixRes}extractPrefix(t,e){return t.startsWith(e)?t.substring(e.length):t}getFootprintNewOutlineByMatrix(t,e){let r=Qe.translate(-e.x,-e.y);return t.multiply3(r)}};var bK=new Di(10,39.37).ratio;async function w$e(o){let t=new Array,e=new Array,r=0,i={},n={},s=x.getInstance().origin,a=await $q();console.debug("components 2 model",a);let l=Cr.getAllItem();for(let g=0;g<l.length;g++){let y=l[g],b=y.attrKeyValue;if(y.layerId===1){let P=await h(y);t.push(P)}else e.push(await h(y));i[b["Supplier Part"]+","+b.Value]=c(y),A.publish("progressUpdate",[g/l.length,"smtUILoading"],$())}return m();function c(g){let y=g.attrKeyValue,b={is_base:!0,proc:"SMT",mode:"smtWeld",lc_model:y["LCSC Part Name"],lc_pkg:y["Supplier Footprint"],lc_ma:null,t:"None",q:2,tv:"None",ta:"None",ba:"None",value:y.Value||"",Name:g.getFormulaName()||"",Supplier:y.Supplier||""};for(let P in y)P!="Name"&&P!="Unique ID"&&P!="Add into BOM"&&P!="Designator"&&P!="Device"&&P!="Footprint"&&P!="3D Model"&&P!="3D Model Title"&&P!="3D Model Transform"&&(b[P]=y[P]);return b}async function h(g){let y=g.attrKeyValue,b=y["3D Model"]||"",P=g.attrKeyValue["3D Model Transform"]||"0,0,0,0,0,0,0,0,0",{uuid:T,path:I}=OG(b),C=a[`${T}|${I}`]||b,E=Ji.getItem(g.footprintUUID).getOrigin(),O=new Di(10,1).ratio,{pins:_,bbox:R}=gx(n,g.footprintId,()=>{let G=0,W=Ji.getItem(g.footprintUUID),L=new _e;for(let[,N]of W.getItems()){let U=N==null?void 0:N.layerId;N instanceof Li&&N.key!=""||(N instanceof Je?(G++,L.ext1(N.buildBBox())):(U===3||U===4)&&L.ext1(N.buildBBox()))}let B=L.valid()?L.build1():null;return{pins:G,bbox:B}});r++;let v=g.position.sub(s).mul(bK),D={},w=P&&P.trim().startsWith("v2:"),F="0,0,0,0,0,0,0,0,0";if(w){let G=(await A.windowBridge.rpcCall("/engine/loadModelAndV2ToV1",{uuid:C||"default_model",transformV2:P},$())).message;G&&(F=`${G.dx},${G.dy},${G.dz},${G.rz},${G.rx},${G.ry},${G.x},${G.y},${G.z}`)}else F=P;let H=F.split(",").map(G=>parseFloat(G));D={uuid:C,dx:H[0]/10*O,dy:H[1]/10*O,dz:H[2]/10*O,rz:H[3],rx:H[4],ry:H[5],x:(H[6]/10-E.x)*O,y:(H[7]/10-E.y)*O,z:H[8]/10*O};let z=g.layerId===1?g.rotation:(3*Math.PI-g.rotation)%(2*Math.PI);return{model:D,pick_index:r,bom_index:r,deviceUuid:g.deviceUUID,des:y.Designator,ft_name:y.Footprint,ft_pins:_,cm:g.getFormulaName()||y.Device,lc_code:y["Supplier Part"]+","+y.Value,is_mount:!0,sel_mount:!1,source:"lceda-pro",ec:{x:v.x,y:v.y,ang:Ht.toDegrees(z),dx:(R==null?void 0:R.width())*bK,dy:(R==null?void 0:R.height())*bK,cx:((R==null?void 0:R.center().x)-E.x)*bK,cy:((R==null?void 0:R.center().y)-E.y)*bK},oc:{x:`${v.x}mm`,y:`${v.y}mm`,rx:null,ry:null,px:null,py:null,ang:`${z}`}}}function u(){let g=Math.round(new Date().getTime());return{create_time:g,modify_time:g,modify_user:"lceda-pro",software:"",data_type:"ERP_ORDER_CREATOR",customer_code:x.getInstance().customerCode,pcb_order:"",board:o.board,pcb_name:o.pcbName,smt_order:"",version:1}}function d(){return{assembler_total_num:t.length+e.length,top_assembler_total_num:t.length,bot_assembler_total_num:e.length}}function p(){return{file_info:u(),check_info:d(),comp_info:i,designator_info:[{name:"default",x_datum:0,y_datum:0,mirror_x_datum:0,mirror_y_datum:0,set:[{name:"default",x_offset:0,y_offset:0,ang:0}],top:t,bottom:e}]}}function m(){let g=p();return JSON.stringify({sum:"1231313215456",data:JSON.stringify(g)})}}var Ywt=new ft,Ime=class{constructor(){this.disable=!1}cut(t,e,r,i){let n=i.event,s=new Array;for(let u=0;u<i.lineArcs.length;u++){let d=i.lineArcs[u];d instanceof Yi||d instanceof hr?d.length>1e-8&&(i.lineArcs[u]=c(d)):s.push(d)}let a=new Array,l=new Array;for(let u=0;u<s.length;u++)if(s[u].length>1e-8){let d=[s[u]];for(l.push(s[u]);s[u+1]&&s[u].end.equals1(s[u+1].start);)d.push(s[u+1]),l.push(s[u+1]),u++;a.push(d)}else s[u].remove();if(n.cutSilkLines.length>0){let u=n.cutSilkLines[n.cutSilkLines.length-1],d=u[u.length-1];d instanceof Yi&&a.length>0&&a[0][0].start.equals1(d.end)&&(u.push(...a[0]),a.shift())}return n.cutSilkLines.push(...a),l;function c(u){if(!u)return;let d=u.start,p=[],m=new PF,g=u.buildBBox(),y=Vt.searchByType(g,"Pad"),b,P,T=[];for(let C of y.pads){if(e===3&&![12,1].includes(C.layerId)||e===4&&![12,2].includes(C.layerId))continue;let E,O=Ywt.conversion("mm","mil",.15)/10;if((e===3||e===4)&&(E=C.getMathGraphics(e===3?1:2),E=AT.zoomPolygon(E,O+u.width/2)),!E)continue;T.push(E);let _=E.primitives;for(let R=0;R<_.length;R++){let v=Tt(h(u),_[R]);if(v>0)for(let D=0;D<v;D+=2){let w=new S(Ee[D],Ee[D+1]);p.push(w)}}m.pointInPolyline(u.start,E)&&(b=!0),m.pointInPolyline(u.end,E)&&(P=!0)}p.sort((C,E)=>C.distance2(d)-E.distance2(d));let I=[];for(let C=0;C<p.length;C++){for(;p[C+1]&&p[C].equals1(p[C+1]);)C++;I.push(p[C])}if(p=I,p.length>0&&(e===3||e===4)){b||p.unshift(u.start),P||p.push(u.end);for(let C=0;C<p.length;C+=2)if(p[C+1]){if(!(!b&&C===0)){let _=new S(p[C].x-d.x,p[C].y-d.y),R=_.length(),v=_.normalize(),D=new S(v.x*R,v.y*R);p[C]=new S(D.x+d.x,D.y+d.y)}if(!(!P&&C+1===p.length-1)){let _=new S(p[C+1].x-d.x,p[C+1].y-d.y),R=_.length(),v=_.normalize(),D=new S(v.x*R,v.y*R);p[C+1]=new S(D.x+d.x,D.y+d.y)}let E=new S((p[C].x+p[C+1].x)/2,(p[C].y+p[C+1].y)/2),O=!1;for(let _=0;_<T.length;_++)if(m.pointInPolyline(E,T[_])){O=!0;break}!O&&p[C].distance2(p[C+1])>1e-8&&p[C].distance2(d)-p[C+1].distance2(d)<0&&s.push(Yi.build(t,p[C],p[C+1],u.width,r))}}else u.length>1e-8&&s.push(Yi.build(t,u.start,u.end,u.width,r));return u.remove(),s[s.length-1]}function h(u){if(u instanceof Yi||u instanceof Zo)return u.primitive;if(u instanceof hr)return new M(u.start,u.end);if(u instanceof ns)return q.build2(u.center,u.startAngle,u.endAngle,u.radius,u.radius,u.sweep)}}canCut(){return!this.disable&&we.autoTrimSilkscreen&&x.getInstance().doctype===bi.FOOTPRINT}};var Cme=class{constructor(){this.group=null;this.globalIndexs=[];this.succCallback=[];this.isToggleTool=!1;this.sideBaseLine=null}setGroup(t){this.group=t}addItem(t){let e=Array.isArray(t)?t:[t];this.globalIndexs.push(...e)}completed(){let t=this.sideBaseLine;t&&(this.updateItems(),this.succCallback.forEach(e=>e(t))),this.resetState()}getBaseLine(){return this.sideBaseLine}pushBaseLine(t){if(t instanceof ct&&t.type==="3D Shell - Side Datum Line"){this.sideBaseLine=t;return}this.sideBaseLine=null}addCallback(t){typeof t=="function"&&this.succCallback.push(t)}setOnceCallback(t){typeof t=="function"&&(this.succCallback.length=0,this.succCallback.push(t))}toggleTool(){if(this.isToggleTool)return;this.isToggleTool=!0,this.sideBaseLine=null;let t={command:"selectDatumLineWithRegion",msg:"Please select a Side Datum Line"};A.publish("toggle",t)}interrupt(){this.resetState(),this.sideBaseLine=null}resetState(){this.globalIndexs.length=0,this.succCallback.length=0,this.group=null,this.isToggleTool=!1}updateItems(){let t=this.sideBaseLine,e=new er;this.globalIndexs.forEach(r=>{let i=e.getItem(r);if(i instanceof Ye&&this.isD3ShellSlotOrEntity(i.type)){let n=i.getComponent(),s=n.lineId,a=this.isD3ShellSlot(i.type);this.isTopBottomType(i.type)&&(i.type=a?"3D Shell - Side Slot Region":"3D Shell - Side Entity",i.refreshStyle()),n=i.getComponent(),n.type=a?"Side":"side",n.lineId=t.globalIndex,$a.getInstance().delConnectRelatedId(s,r),$a.getInstance().addConnectRelatedId(t.globalIndex,r)}}),this.group instanceof ve&&je.executeCommand(this.group),A.publish("updateFrame","")}isD3ShellSlot(t){return t==="3D Shell - Top Slot Region"||t==="3D Shell - Side Slot Region"}isTopBottomType(t){return t==="3D Shell - Top Slot Region"||t==="3D Shell - Top/Bottom Entity"}isD3ShellSlotOrEntity(t){return t==="3D Shell - Top Slot Region"||t==="3D Shell - Side Slot Region"||t==="3D Shell - Top/Bottom Entity"||t==="3D Shell - Side Entity"}};var Sme=class extends zh{constructor(){super(...arguments);this.mgr=e0.getInstance()}addControllerCache(e){Vt.insert(e)}addImage(e,r,i,n,s,a,l,c){let h=cr();e=wj(e);let u=e0.getInstance().addImage(h,e,r,i,n,s,a,l,c),d=new Rs(u);return this.addControllerCache(d),d}addImageByModel(e,r=!1){if(r){let n=e.globalIndex;e0.getInstance().getItem(n)==e&&e0.getInstance().delete(e,n),e.globalIndex=cr(),e0.getInstance().addModel(e)}let i=new Rs(e);return this.addControllerCache(i),i}rebuild(e,r,i,n,s,a,l,c,h){r=wj(r);let u=e0.getInstance().addImage(e,r,i,n,s,a,l,c,h),d=new Rs(u);return this.addControllerCache(d),d}copy(e){let{globalIndex:r,layerId:i,start:n,width:s,height:a,rotation:l,mirror:c,locked:h,hashId:u}=e;n=new S(n.x,n.y);let d=r.slice(0,-16)+cr();return this.rebuild(d,i,n,s,a,l,c,h,u)}delete(e){if(e instanceof Rs){let r=e.globalIndex;e0.getInstance().delete(e.model,r)}}};function PK(o){let t=$e.getInstance().getLayer(o);x.getInstance().compiler.uploadSilkOpts(o,or.getInstance().encode("SILK_OPTS",t))}var Eme=class extends ec{constructor(){super(...arguments);this.tool=null;this.wiringRouterParam=al.getInstance()}set(){return this}getTool(){return this.tool}setTool(e){this.tool=e}get isFootPrint(){return x.getInstance().doctype===4}getHtmlData(){this.attrlist==null&&(this.attrlist={},this.idList=["canvas"]);let e=this.attrlist,r=new ft;(e["attr-id"]==null||e["attr-id"].value!=He)&&(e["attr-id"]={title:"ID",value:"canvas"}),(e["attr-coosys-type"]==null||e["attr-coosys-type"].value!=He)&&(e["attr-coosys-type"]={title:"Coordinate System Type",value:St.getInstance().currentCoord?1:2}),(e["attr-unit"]==null||e["attr-unit"].value!=He)&&(e["attr-unit"]={title:"Unit",value:x.getInstance().unit,options:[{value:"mil",text:"mil"},{value:"mm",text:"mm"}]}),(e["attr-grid-type"]==null||e["attr-grid-type"].value!=He)&&(e["attr-grid-type"]={title:"Grid Type",value:we.gridType,options:[{value:"grid",text:"Grid"},{value:"outlets",text:"Grid Dot"},{value:"none",text:"None"}]}),(e["attr-multi-grid-type"]==null||e["attr-multi-grid-type"].value!=He)&&(e["attr-multi-grid-type"]={title:"Bold Grid Type",value:we.multiType,options:[{value:"grid",text:"Grid"},{value:"outlets",text:"Grid Dot"},{value:"none",text:"None"}]}),(e["attr-multi-grid-ratio"]==null||e["attr-multi-grid-ratio"].value!=He)&&(e["attr-multi-grid-ratio"]={title:"Bold Grid Ratio",value:we.multiRatio});let i=r.conversion1("mil",x.getInstance().unit,St.getInstance().getGridX()*10),n=r.conversion1("mil",x.getInstance().unit,St.getInstance().getGridY()*10);(e["attr-grid-size"]==null||e["attr-grid-size"].value!=He)&&(e["attr-grid-size"]={title:"Grid Size",value:i==n?i:`${i},${n}`}),(e["attr-polar-angle-step"]==null||e["attr-polar-angle-step"].value!=He)&&(e["attr-polar-angle-step"]={title:"Grid Size",value:on(MM(St.getInstance().angleDelta),1,!0)});let s=x.getInstance().unit,a=r.conversion("mil",x.getInstance().unit,St.getInstance().radius);(e["attr-polar-radiu-step"]==null||e["attr-polar-radiu-step"].value!=He)&&(e["attr-polar-radiu-step"]={title:"Grid Size",value:s==="mm"?on(a*10,3):on(a*10,1)});let l=r.conversion1("mil",x.getInstance().unit,St.getInstance().getSnapX()*10),c=r.conversion1("mil",x.getInstance().unit,St.getInstance().getSnapY()*10);(e["attr-snap-size"]==null||e["attr-snap-size"].value!=He)&&(e["attr-snap-size"]={title:"Snap Size",value:l==c?l:`${l},${c}`});let h=x.getInstance().altGridSize,u=r.conversion1(h.GridX.unit,x.getInstance().unit,h.GridX.number),d=r.conversion1(h.GridY.unit,x.getInstance().unit,h.GridY.number);(e["attr-alt-grid-size"]==null||e["attr-alt-grid-size"].value!=He)&&(e["attr-alt-grid-size"]={title:"Alt Snap Size",value:u==d?u:`${u},${d}`}),(e["attr-snap"]==null||e["attr-snap"].value!=He)&&(e["attr-snap"]={title:"Snap",value:we.adsorb?"yes":"no"}),this.isFootPrint||(e["attr-start-track-width"]==null||e["attr-start-track-width"].value!=He)&&(e["attr-start-track-width"]={title:"Start Track Width",value:ce.pcbConfig.startTrackWidth,options:[{text:"Follow Rule",value:"rule"},{text:"Customize",value:"last"}]});let p;if(this.isFootPrint?p=we.prevTrackWidth:this.tool instanceof Vo?p=this.tool.getWireWidth():(this.tool instanceof rc||this.tool instanceof jC||this.tool instanceof YC||this.tool instanceof XC||this.tool instanceof Sh||this.tool instanceof Tc)&&(p=ce.pcbConfig.startTrackWidth=="rule"?this.wiringRouterParam.getTrackWidth(1).value:we.prevTrackWidth),p==null&&(p=this.wiringRouterParam.getTrackWidth(1).value),(e["attr-track-width"]==null||e["attr-track-width"].value!=He)&&(e["attr-track-width"]={title:"Track Width",value:r.conversion1("mil",x.getInstance().unit,p*10),disabled:x.getInstance().doctype==3&&!we.drawing&&ce.pcbConfig.startTrackWidth=="rule"}),!this.isFootPrint){(e["attr-start-via-size"]==null||e["attr-start-via-size"].value!=He)&&(e["attr-start-via-size"]={title:"Start Via Size",value:ce.pcbConfig.startViaSize,options:[{text:"Follow Rule",value:"rule"},{text:"Customize",value:"last"}]});let m,g;if(we.drawing&&(this.tool instanceof cy||this.tool instanceof y2)){let P=this.tool.getViaRadius();m=P.radius,g=P.innerRadius}else if(this.tool instanceof Vo){let P=this.tool.getViaRadius();m=P.radius,g=P.innerRadius}else m=this.wiringRouterParam.getViaOutsideDiameter().value/20,g=this.wiringRouterParam.getViaInsideDiameter().value/20;(e["attr-via-outside-diameter"]==null||e["attr-via-outside-diameter"].value!=He)&&(e["attr-via-outside-diameter"]={title:"Via Outside Diameter",value:r.conversion1("mil",x.getInstance().unit,m*20),disabled:!we.drawing&&ce.pcbConfig.startViaSize=="rule"}),(e["attr-via-inside-diameter"]==null||e["attr-via-inside-diameter"].value!=He)&&(e["attr-via-inside-diameter"]={title:"Via Inside Diameter",value:r.conversion1("mil",x.getInstance().unit,g*20),disabled:!we.drawing&&ce.pcbConfig.startViaSize=="rule"}),(e["attr-routing-mode"]==null||e["attr-routing-mode"].value!=He)&&(e["attr-routing-mode"]={title:"Routing Mode",value:tr.getInstance().mode,options:[{value:"WIRING_MODE_PUSHAWAY",text:"Push"},{value:"WIRING_MODE_SURROUND_AND_PUSHAWAY",text:"Around & Push"},{value:"WIRING_MODE_SURROUND",text:"Around"},{value:"WIRING_MODE_OBSTRUCT",text:"Block"},{value:"WIRING_MODE_IGNORE",text:"Ignore"}]}),(e["attr-routing-pushVia"]==null||e["attr-routing-pushVia"].value!=He)&&(e["attr-routing-pushVia"]={title:"Push Via",value:this.wiringRouterParam.getPushVia(),options:[{value:"OPTIMIZA_OPEN",text:"On"},{value:"OPTIMIZA_NONE",text:"Off"}]}),(e["attr-routing-pathOptimization4BePushed"]==null||e["attr-routing-pathOptimization4BePushed"].value!=He)&&(e["attr-routing-pathOptimization4BePushed"]={title:"Be Pushed Track Path Optimization",value:this.wiringRouterParam.getPathOptimization4BePushed(),options:[{value:0,text:"Individual Segment"},{value:1,text:"Full Routing"},{value:2,text:"None"}]}),(e["attr-routing-currentPathOptimization"]==null||e["attr-routing-currentPathOptimization"].value!=He)&&(e["attr-routing-currentPathOptimization"]={title:"Current Track Path Optimization",value:this.wiringRouterParam.getCurrentPathOptimization(),options:[{value:"OPTIMIZA_STRONG",text:"Strong"},{value:"OPTIMIZA_WEAK",text:"Weak"},{value:"OPTIMIZA_NONE",text:"Off"}]}),(e["attr-remove-loop"]==null||e["attr-remove-loop"].value!=He)&&(e["attr-remove-loop"]={title:"Remove Loop",value:this.wiringRouterParam.getRemoveLoop().value});let y=this.wiringRouterParam.getRemoveLoop().removeLoopOptions[0];(e["attr-remove-circuits-containing-vias"]==null||e["attr-remove-circuits-containing-vias"].value!=He)&&(e["attr-remove-circuits-containing-vias"]={title:"Remove Loops With Vias",value:y.value});let b=this.wiringRouterParam.getRemoveLoop().removeLoopOptions[1];(e["attr-remove-antenna"]==null||e["attr-remove-antenna"].value!=He)&&(e["attr-remove-antenna"]={title:"Remove Antenna",value:b.value}),(e["attr-copper-region"]==null||e["attr-copper-region"].value!=He)&&(e["attr-copper-region"]={title:"Hide Copper Region",value:this.wiringRouterParam.getHideCopper()})}return(e["attr-rotating-object"]==null||e["attr-rotating-object"].value!=He)&&(e["attr-rotating-object"]={title:"Rotation Objects",value:ce.pcbConfig.rotateWhole,options:[{text:"Rotate Single Object",value:"single"},{text:"Rotate the Selected Whole",value:"whole"}]}),(e["attr-track-follow"]==null||e["attr-track-follow"].value!=He)&&(e["attr-track-follow"]={title:"Move Footprint The Wire Follows",value:ce.pcbConfig.trackFollow,options:[{text:"Yes",value:"moveKeep"},{text:"No",value:"moveDisconnect"}]}),(e["attr-track-minimum-corner"]==null||e["attr-track-minimum-corner"].value!=He)&&(e["attr-track-minimum-corner"]={title:"Minimum Track Corners",value:this.wiringRouterParam.getTrackMinCorner()}),(e["attr-auto-trim-silkscreen"]==null||e["attr-auto-trim-silkscreen"].value!=He)&&(e["attr-auto-trim-silkscreen"]={title:"Auto Cut Silkscreen",value:we.autoTrimSilkscreen?"yes":"no"}),(e["attr-top-side-board-color"]==null||e["attr-top-side-board-color"].value!=He)&&(e["attr-top-side-board-color"]={title:"Top Side Board Color",value:we.topBoardColor}),(e["attr-bottom-side-board-color"]==null||e["attr-bottom-side-board-color"].value!=He)&&(e["attr-bottom-side-board-color"]={title:"Bottom Side Board Color",value:we.bottomBoardColor}),(e["attr-top-side-silkscreen-color"]==null||e["attr-top-side-silkscreen-color"].value!=He)&&(e["attr-top-side-silkscreen-color"]={title:"Top Side Silkscreen Color",value:we.topSilkscreenColor}),(e["attr-bottom-side-silkscreen-color"]==null||e["attr-bottom-side-silkscreen-color"].value!=He)&&(e["attr-bottom-side-silkscreen-color"]={title:"Bottom Side Silkscreen Color",value:we.bottomSilkscreenColor}),(e["attr-range"]==null||e["attr-range"].value!=He)&&(e["attr-range"]={title:"Highlight",value:{explodeRatio:x.getInstance().forceValue}}),this}modifyBy(e){let r=new ft;for(let i in e){let n=e[i];switch(i){case"attr-id":break;case"attr-unit":{FC(n);break}case"attr-grid-type":{A.messageBus.publish("switchGridType",n),A.publish("switchGridTypeBtn",n,$());break}case"attr-multi-grid-type":{A.messageBus.publish("switchMultiGridType",n);break}case"attr-multi-grid-ratio":{A.messageBus.publish("switchMultiGridRatio",n);break}case"attr-polar-mixin-step":{let s=n.split(",")[0],a=n.split(",")[1],l=parseFloat(s),c=parseFloat(a)/10;typeof a>"u"&&(c=l);let h=E8e(l);c=r.conversion(x.getInstance().unit,"mil",c);let u=St.getInstance().angleDelta,d=St.getInstance().radius;if(u===h&&d===c)break;St.getInstance().angleDelta=h,St.getInstance().radius=c,wp();break}case"attr-grid-size":case"attr-snap-size":case"attr-alt-grid-size":{let s=n.toString().split(/,|，/),a,l;if(s.length==1?a=l=parseFloat(s[0]):s.length==2&&(a=parseFloat(s[0]),l=parseFloat(s[1])),a==null||l==null||isNaN(a)||isNaN(l))return;let c=ce.getAssociationPCBCanvasGridAndSnap()===1,h=c?L9():{xRatio:1,yRatio:1},u=r.conversion(x.getInstance().unit,"mil",a)/10,d=r.conversion(x.getInstance().unit,"mil",l)/10;if(i=="attr-grid-size")St.getInstance().setGridX(bo(u)),St.getInstance().setGridY(bo(d)),c&&(St.getInstance().setSnapX(bo(u/h.xRatio)),St.getInstance().setSnapY(bo(d/h.yRatio)));else if(i=="attr-snap-size")St.getInstance().setSnapX(bo(u)),St.getInstance().setSnapY(bo(d)),c&&(St.getInstance().setGridX(bo(u*h.xRatio)),St.getInstance().setGridY(bo(d*h.yRatio)));else if(i=="attr-alt-grid-size"){let p={GridX:{number:a,unit:x.getInstance().unit},GridY:{number:l,unit:x.getInstance().unit}};x.getInstance().altGridSize=p}wp();break}case"attr-snap":{A.publish("toggleAdsorb",n=="yes");break}case"attr-start-track-width":{this.wiringRouterParam.setStartTrackWidth(n),(this.tool instanceof rc||this.tool instanceof jC||this.tool instanceof YC||this.tool instanceof XC||this.tool instanceof Sh||this.tool instanceof Tc)&&this.tool.setWireWidth(this.wiringRouterParam.getTrackWidth().value),Hi();break}case"attr-track-width":{if(+n<=0)return;let s=r.conversion(x.getInstance().unit,"mil",n)/10;s>=Qc&&(this.tool instanceof rc||this.tool instanceof jC||this.tool instanceof YC||this.tool instanceof XC||this.tool instanceof Sh||this.tool instanceof Tc?(this.tool.setWireWidth(s),we.prevTrackWidth=s):this.wiringRouterParam.setTrackWidth(s*10),Hi());break}case"attr-start-via-size":{if(this.isFootPrint)break;this.tool instanceof Vo||(this.wiringRouterParam.setStartViaSize(n),n=="rule"&&(this.tool instanceof cy||this.tool instanceof y2)&&this.tool.updateViaRadius()),Hi();break}case"attr-via-outside-diameter":case"attr-via-inside-diameter":{if(this.isFootPrint)break;if(+n<=0)return;let s=r.conversion(x.getInstance().unit,"mil",n)/20;s>=Qc/2&&(this.tool instanceof cy||this.tool instanceof y2?i=="attr-via-inside-diameter"?this.tool.modifyViaSize(s,this.tool.getViaRadius().radius,!1):this.tool.modifyViaSize(this.tool.getViaRadius().innerRadius,s,!1):rt.setDefaultVia({net:null,holeRadius:i=="attr-via-inside-diameter"?s:null,radius:i=="attr-via-outside-diameter"?s:null}),Hi());break}case"attr-routing-mode":{if(this.isFootPrint)break;this.tool instanceof Vo?this.tool.wireMode(n):this.wiringRouterParam.setRoutingMode(n),Hi();break}case"attr-routing-pushVia":{if(this.isFootPrint)break;this.wiringRouterParam.setPushVia(n,!0);break}case"attr-routing-pathOptimization4BePushed":{if(this.isFootPrint)break;this.wiringRouterParam.setPathOptimization4BePushed(n,!0);break}case"attr-routing-currentPathOptimization":{if(this.isFootPrint)break;this.wiringRouterParam.setCurrentPathOptimization(n,!0);break}case"attr-remove-loop":{if(this.isFootPrint)break;A.publish("removeLoop",n=="yes");break}case"attr-remove-circuits-containing-vias":{if(this.isFootPrint)break;this.wiringRouterParam.setRemoveLoop(n,"Remove Circuits Containing Vias",!0);break}case"attr-remove-antenna":{if(this.isFootPrint)break;this.wiringRouterParam.setRemoveLoop(n,"Remove Antenna",!0);break}case"attr-copper-region":{if(this.isFootPrint)break;this.wiringRouterParam.setHideCopper(n,!0);break}case"attr-rotating-object":{ce.pcbConfig.rotateWhole=n,Hi();break}case"attr-track-follow":{ce.pcbConfig.trackFollow=n,Hi();break}case"attr-track-minimum-corner":{this.wiringRouterParam.setTrackMinCorner(n,!0);break}case"attr-auto-trim-silkscreen":{we.autoTrimSilkscreen=n=="yes",Hi();break}case"attr-top-side-board-color":{we.topBoardColor=n,PK(3),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$());break}case"attr-top-side-silkscreen-color":{we.topSilkscreenColor=n,PK(3),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$());break}case"attr-bottom-side-board-color":{we.bottomBoardColor=n,PK(4),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$());break}case"attr-bottom-side-silkscreen-color":{we.bottomSilkscreenColor=n,PK(4),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$());break}case"attr-range":{n!=null&&!isNaN(n)&&A.publish("highlightValue",n);break}default:throw Error("Unexpected key for canvas html")}}}};var Ome=class{constructor(){A.subscribe("checkRemoveAllPlane",this.checkRemoveAllPlane.bind(this))}checkRemoveAllPlane(){let t=je.stack;if(!t||!t.commands.some(a=>a instanceof Wg))return;let e=Qn.getAllItem();if(e.length<=0)return;let r=Xt.getAllItem(),i=Zt.getAllItem(),n=pt.getAllItem();[].concat(r,i,n).filter(a=>a instanceof Ye&&(a.type=="Board Outline"||a.type=="Line"&&a.layerId==11)).length>0||e.forEach(a=>{t.addCommand(Te.dispatch(a,"delete")),a.remove(),A.publish("hasModifyPcbItem",a),A.publish("delete",a)})}};var Ame=class{constructor(){this.hotkeys={}}addSubMenu(t,e,r){this.hotkeys[t]={hotkey:e,menuCmd:r}}restore(){this.hotkeys={}}getMenuHotkeyConfigInfo(t){return this.hotkeys[t]}};var r_e=["Track","ArcTrack","Pad","Via","Polygon","Circle","Rect","Copper"],_me=class{constructor(t=!0){this.checkMap=new Map;this.result=new Map;this.toBeCheckMap=new Map;this.filter=new Hd;this.check=new r9;this.filterPlane=!1;this.filter.whetherCheckNet=t}update(t){this.checkMap=new Map;for(let e of t)if(e instanceof Me){let r=e.getPads();for(let n=0;n<r.length;n++)this.updateNode(r[n]);let i=e.getVias();for(let n=0;n<i.length;n++)this.updateNode(i[n])}else this.updateNode(e)}updateLoopTypeConnect(t){this.checkMap=new Map;for(let e of t)(e instanceof Ue||e instanceof Le||e instanceof Ge)&&this.updateLoopNode(e)}getMap(){let t=new Array;for(let[,e]of this.toBeCheckMap)for(let[,r]of e)t.push([r[0].model,r[1].model]);return t}sycnResult(t){for(let[e,r]of t){this.result.get(e)==null&&this.result.set(e,new Map);for(let[i,n]of r)this.result.get(e).set(i,n)}}getResult(){return this.result}updateLoopNode(t){if(!(t instanceof ds)||t.isEmpty)return;let e=this.searchNode(t);for(let r of e)if(r&&r instanceof ds&&r!=t&&!this.checkConnect(t,r)&&this.filter.needCheckIntersection(t.model,r.model)){let i=this.check.isConnect(t.model,r.model);i||this.add2BeCheckMap(t,r),this.add2Result(t,r,i),this.addCheckMap(t,r)}}searchNode(t){if(t==null||t.isEmpty)return[];if(t instanceof Le)return this.searchPadAndViaCycleNode(t);if(t instanceof Ge)return this.searchPadAndViaCycleNode(t);if(t instanceof Ue){let e;return t instanceof Ar?e=nh.trackToOctagon(t.start,t.end,t.width):t instanceof Si&&(e=t.buildBBox()),this.searchAbstractTrackCycleNode(e,t)}return[]}searchPadAndViaCycleNode(t){return Vt.conditionSearch(t.buildBBox(),e=>{let r=e.item;return!!(!r.isEmpty&&r!=t&&r instanceof Ue&&this.filter.needCheckIntersection(r.model,t.model))},(e,r)=>{switch(r){case"Track":case"ArcTrack":{if(t instanceof Ge){if(t.isContains(e))return!0}else if(t.layerId==12||e==t.layerId)return!0;return!1}default:return!1}}).getTracks()}searchAbstractTrackCycleNode(t,e){return Vt.conditionSearch(t,r=>{let i=r.item;return i instanceof ds&&i.net==e.net},(r,i)=>{switch(i){case"Track":case"ArcTrack":return r==e.layerId;case"Via":return!0;case"Pad":return r==12||r==e.layerId}return!1}).getTPV()}updateNode(t){if(!(t instanceof ds)||t.isEmpty)return;let e=this.search(t).getConnectNodes();for(let r of e)if(!(this.filterPlane&&r instanceof A0)&&r&&r instanceof ds&&r!=t&&!this.checkConnect(t,r)&&this.filter.needCheckIntersection(t.model,r.model)){let i=this.check.isConnect(t.model,r.model);i||this.add2BeCheckMap(t,r),this.add2Result(t,r,i),this.addCheckMap(t,r)}}getBBox(t){return t instanceof Ar?nh.trackToOctagon(t.start,t.end,t.width):t.buildBBox()}search(t){let e=t.buildBBox();if(e==null)return new rD;if(t instanceof Le){let r;return t.layerId==12?r=(i,n)=>n=="Track"||n=="ArcTrack"||n=="Via"||n=="Pad"?!0:n=="Polygon"||n=="Circle"||n=="Rect"||n=="Copper"?!!(i!=12&&mp(i)):!1:r=(i,n)=>(n=="Track"||n=="ArcTrack")&&i==t.layerId||(i==12||i==t.layerId)&&(n=="Via"||n=="Pad")?!0:n=="Polygon"||n=="Circle"||n=="Rect"||n=="Copper"?i==t.layerId:!1,Vt.search4Types(e,r_e,r)}else if(t instanceof Ge){let r=(i,n)=>(n=="Track"||n=="ArcTrack")&&t.isContains(i)||(i==12||t.isContains(i))&&(n=="Via"||n=="Pad")?!0:n=="Polygon"||n=="Circle"||n=="Rect"||n=="Copper"?!!t.isContains(i):!1;return Vt.search4Types(e,r_e,r)}else if(t instanceof Ue){let r=this.getBBox(t),i=(n,s)=>(s=="Track"||s=="ArcTrack")&&t.layerId==n||s=="Pad"&&(n==12||n==t.layerId)||s=="Via"?!0:s=="Polygon"||s=="Circle"||s=="Rect"||s=="Copper"?n==t.layerId:!1;return Vt.search4Types(r,r_e,i)}else return Vt.search(e)}checkConnect(t,e){if(t.globalIndex<e.globalIndex){let r=this.checkMap.get(t.globalIndex);if(r!=null)return r.get(e.globalIndex)!=null}else{let r=this.checkMap.get(e.globalIndex);if(r!=null)return r.get(t.globalIndex)!=null}return!1}addCheckMap(t,e){let{globalIndex:r}=t,{globalIndex:i}=e;if(r>i){let n=i;i=r,r=n}this.checkMap.get(r)==null&&this.checkMap.set(r,new Map),this.checkMap.get(r).set(i,!0)}add2Result(t,e,r){let{globalIndex:i}=t,{globalIndex:n}=e;if(i>n){let s=n;n=i,i=s}this.result.get(i)==null&&this.result.set(i,new Map),this.result.get(i).set(n,r)}add2BeCheckMap(t,e){let{globalIndex:r}=t,{globalIndex:i}=e;if(r>i){let n=i;i=r,r=n}this.toBeCheckMap.get(r)==null&&this.toBeCheckMap.set(r,new Map),this.toBeCheckMap.get(r).set(i,[t,e])}clear(){this.checkMap=new Map,this.result=new Map,this.toBeCheckMap=new Map}getFilterWhetherCheckNet(){return this.filter.whetherCheckNet}changeFilterWhetherCheckNet(t){this.filter.whetherCheckNet=t}};var vme=class{constructor(){this.notAsking=!1;this.moveWhole=!0}init(t,e,r){this.items=t||[],this.action=r,this.commandFactory=e,this.padsOfComponent=this.items.some(i=>i instanceof Le&&i.getParent()instanceof Me),this.padsOfComponent?this.notAsking?this.execute(this.moveWhole):A.publish("openMainDialog",{cmd:39,data:{option:{moveWhole:this.moveWhole}}}):this.action(this.items,this.commandFactory)}execute(t){this.moveWhole=t,this.action(this.items,this.commandFactory),this.interrupt()}interrupt(){this.action=null}};var i_e=!1,n_e=0,xme=class o{constructor(){this.restrictLength=i_e;this.additionalLength=n_e;this.subscribe("INIT_PCB_CONFIG",this.initConfig.bind(this)),this.subscribe("UPDATE_PCB_CONFIG",this.updateConfig.bind(this))}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}subscribe(t,e){A.subscribe(t,e)}initConfig(t){this.config=t,this.restrictLength=i_e,this.additionalLength=n_e}updateConfig(t){let{config:e,others:r}=t;e&&(this.config=e),r&&(this.restrictLength=r.restrictLength||i_e,this.additionalLength=r.additionalLength||n_e)}getSnakeTrackToolConfig(){let t=this.config.EQUAL_LENGTH_TUNING;return t?{...t,restrictLength:this.restrictLength,additionalLength:this.additionalLength}:{}}getDiffPairSnakeTrackToolConfig(){let t=this.config.DIFF_PAIR_EQUAL_LENGTH_TUNING;return t?{...t,restrictLength:this.restrictLength,additionalLength:this.additionalLength}:{}}getPcbReaTimeDRC(){return this.config.PCB_REALTIME_DRC||{}}};var Qw=class o extends ZI{constructor(){super(),this.params=BU.getInstance()}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}createHeader(t){let e=this.createBaseHeader();return e.id=t,e.action=t,e.tabId=x.getInstance().tabId,e}createBody(...t){return{glossMode:{mode:this.params.glossMode},glossOption:{pushTrack:this.params.pushTrack},trackCanvas:this.createCanvas()}}handleHeaderUpdate(...t){}handleBodyUpdate(t,e){this.params.glossMode=e.glossMode.mode,this.params.pushTrack=e.glossOption.pushTrack,this.updateCanvas(e.trackCanvas)}createCanvas(){let t={},e=al.getInstance();return t.unit=e.getUnit(),t.gridType=e.getGridType(),t.blodGridType=e.getBlodGridType(),t.blodGridRatio=e.getBlodGridRatio(),t.gridSize=e.getGridSize(),t.snapSize=e.getSnapSize(),t.snap=e.getSnap(),t.altSnapSize=e.getAltSnapSize(),t}updateCanvas(t){let{unit:e,gridType:r,blodGridType:i,blodGridRatio:n,gridSize:s,snapSize:a,snap:l,altSnapSize:c}=t,h=al.getInstance(),u=h.getUnit(),d=h.getGridType(),p=h.getBlodGridType(),m=h.getBlodGridRatio(),g=String(h.getGridSize()),y=String(h.getSnapSize()),b=h.getSnap().value,P=h.getAltSnapSize(),T=!1;e!==u&&(T=!0,h.setUnit(e)),r!==d&&(T=!0,h.setGridType(r)),i!==p&&(T=!0,h.setBlodGridType(i)),n!==m&&(T=!0,h.setBlodGridRatio(n)),s!==g&&(T=!0,this.updateCanvasGirdSnap("attr-grid-size",s)),a!==y&&(T=!0,this.updateCanvasGirdSnap("attr-snap-size",a)),l.value!==b&&(T=!0,h.setSnap(l.value)),c!==P&&(T=!0,this.updateCanvasGirdSnap("attr-alt-grid-size",c)),T&&wp()}updateCanvasGirdSnap(t,e){let r=al.getInstance(),i=e.toString().split(/,|，/),n,s;i.length==1?n=s=parseFloat(i[0]):i.length==2&&(n=parseFloat(i[0]),s=parseFloat(i[1])),!(isNaN(n)||isNaN(s))&&(t=="attr-grid-size"?r.setGridSize(n,s):t=="attr-snap-size"?r.setSnapSize(n,s):t=="attr-alt-grid-size"&&r.setAltSnapSize(n,s))}};var Rme=class{constructor(){this.isUnmounted=!1;this._type=null,this._ui2PCBAboutAttrDataUpdateTimer=null,ie.subscribe("FlushSketcherAttrView",this.flushSketcherAttrView.bind(this)),ie.subscribe("ExitSketcherAttrView",this.exitSketcherAttrView.bind(this)),ie.subscribe("UI2PCBAboutAttrDataUpdate",this.ui2PCBAboutAttrDataUpdate.bind(this))}get type(){return this._type}set type(t){this._type=t}flushSketcherAttrView(t){var s;this.isUnmounted=!1;let e=t.type,r=!!t.isInitAllParams,i=(s=t.switchTab)!=null?s:!1,n={};switch(this.type=e,this.type){case"DIST_MEASURE":{n.header=Uu.getInstance().createHeader("DIST_MEASURE"),n.body=Uu.getInstance().createBody(r);let a=n.body.startTarget.allElements,l=n.body.endTarget.allElements;n.body.startTarget.allElements=[],n.body.endTarget.allElements=[],n.body=Ls(n.body),Uu.getInstance().correct(a,l);break}case"SINGLE_WIRE":{n.header=na.getInstance().createHeader("SINGLE_WIRE"),n.body=na.getInstance().createBody("SINGLE_WIRE"),n.body=Ls(n.body);break}case"DIFF_WIRE":{n.header=na.getInstance().createHeader("DIFF_WIRE"),n.body=na.getInstance().createBody("DIFF_WIRE"),n.body=Ls(n.body);break}case"MULTI_WIRE":{n.header=na.getInstance().createHeader("MULTI_WIRE"),n.body=na.getInstance().createBody("MULTI_WIRE"),n.body=Ls(n.body);break}case"TRACK_OPTIMIZATION":{n.header=Qw.getInstance().createHeader("TRACK_OPTIMIZATION"),n.body=Qw.getInstance().createBody(),n.body=Ls(n.body);break}case"COPY_SPECIAL":{n.header=os.getInstance().createHeader("COPY_SPECIAL"),n.body=os.getInstance().createBody(),n.body=Ls(n.body);break}case"PASTE":{if(F0.getInstance().isUnmounted)break;n.header=F0.getInstance().createHeader("PASTE"),n.body=F0.getInstance().createBody("PASTE"),n.body=Ls(n.body);break}}n.header&&(n.header.switchTab=i,ie.publish("PCB2UIAboutRenderSketcherAttrView",n,$()))}ui2PCBAboutAttrDataUpdate(t){this.isUnmounted||(window.clearTimeout(this._ui2PCBAboutAttrDataUpdateTimer),this._ui2PCBAboutAttrDataUpdateTimer=window.setTimeout(()=>{let{header:e,body:r}=t;if(e.tabId===x.getInstance().tabId)switch(e.action){case"DIST_MEASURE":{Uu.getInstance().handleHeaderUpdate(e),Uu.getInstance().handleBodyUpdate(r),ie.publish("FlushSketcherAttrView",{type:"DIST_MEASURE"});break}case"SINGLE_WIRE":{na.getInstance().handleHeaderUpdate(e),na.getInstance().handleBodyUpdate("SINGLE_WIRE",r),ie.publish("FlushSketcherAttrView",{type:"SINGLE_WIRE"});break}case"DIFF_WIRE":{na.getInstance().handleHeaderUpdate(e),na.getInstance().handleBodyUpdate("DIFF_WIRE",r),ie.publish("FlushSketcherAttrView",{type:"DIFF_WIRE"});break}case"MULTI_WIRE":{na.getInstance().handleHeaderUpdate(e),na.getInstance().handleBodyUpdate("MULTI_WIRE",r),ie.publish("FlushSketcherAttrView",{type:"MULTI_WIRE"});break}case"TRACK_OPTIMIZATION":{Qw.getInstance().handleHeaderUpdate(e),Qw.getInstance().handleBodyUpdate("TRACK_OPTIMIZATION",r),ie.publish("FlushSketcherAttrView",{type:"TRACK_OPTIMIZATION"});break}case"COPY_SPECIAL":{os.getInstance().handleHeaderUpdate(e),os.getInstance().handleBodyUpdate(r,e),ie.publish("FlushSketcherAttrView",{type:"COPY_SPECIAL"});break}case"PASTE":{F0.getInstance().handleHeaderUpdate(e),F0.getInstance().handleBodyUpdate("PASTE",r),ie.publish("FlushSketcherAttrView",{type:"PASTE"});break}}}))}exitSketcherAttrView(t){this.exit();let e=t.type,r={};switch(e){case"DIST_MEASURE":{r.header=Uu.getInstance().createHeader("DIST_MEASURE"),r.body=null,Uu.getInstance().distMeasureParams.reset();break}case"SINGLE_WIRE":{r.header=na.getInstance().createHeader("SINGLE_WIRE"),r.body=null;break}case"DIFF_WIRE":{r.header=na.getInstance().createHeader("DIFF_WIRE"),r.body=null;break}case"MULTI_WIRE":{r.header=na.getInstance().createHeader("MULTI_WIRE"),r.body=null;break}case"TRACK_OPTIMIZATION":r.header=Qw.getInstance().createHeader("TRACK_OPTIMIZATION"),r.body=null;case"COPY_SPECIAL":r.header=os.getInstance().createHeader("COPY_SPECIAL"),r.body=null;case"PASTE":r.header=F0.getInstance().createHeader("PASTE"),r.body=null}r.header&&ie.publish("PCB2UIAboutExitSketcherAttrView",r,$()),this.type=null}clearSketcherAttrView(){this.exit();let t=["DIST_MEASURE","SINGLE_WIRE","DIFF_WIRE","MULTI_WIRE","COPY_SPECIAL","PASTE"];for(let e of t){let r={};r.header=na.getInstance().createHeader(e),r.body=null,r.header&&ie.publish("PCB2UIAboutExitSketcherAttrView",r,$())}}exit(){this.isUnmounted=!0,window.clearTimeout(this._ui2PCBAboutAttrDataUpdateTimer),this._ui2PCBAboutAttrDataUpdateTimer=null}};var tMl=Wo.getInstance(),Dme=class{constructor(){A.subscribe("rebuildConnectCopper",this.rebuildConnectCopper.bind(this))}getOrders(t){let e={};for(let r of pt.getAllItem())if(r.type=="Copper Region"&&(!t||r.layerId==t)&&r.getComponent()instanceof Vn){let i=r.layerId,n=e[i];n==null&&(n=new Array,e[i]=n),n.push(r)}for(let r of Zt.getAllItem())if(r.type=="Copper Region"&&(!t||r.layerId==t)&&r.getComponent()instanceof Vn){let i=r.layerId,n=e[i];n==null&&(n=new Array,e[i]=n),n.push(r)}for(let r of Xt.getAllItem())if(r.type=="Copper Region"&&(!t||r.layerId==t)&&r.getComponent()instanceof Vn){let i=r.layerId,n=e[i];n==null&&(n=new Array,e[i]=n),n.push(r)}for(let r in e)e[r].sort((n,s)=>n.getComponent().order-s.getComponent().order);return e}getOrders4Layer(t){return(this.getOrders(t)[t]||[]).map(i=>i.globalIndex)}getNextOrders4Layer(t){let r=this.getOrders(t)[t]||[];for(let i=r.length-1;i>=0;i--){let n=r[i];if(n.type=="Copper Region"){let s=n.getComponent();if(s!=null)return s.order+1}}return 0}addOrder(t,e){if(!(t instanceof Ye&&t.type=="Copper Region"))return;console.time("copperOrder");let r=t.model,i=r.layerId,n=this.getOrders(i)[i]||[],a=Vt.search4Types(r.buildBBox(),S0).getResult(S0).filter(c=>!c.isEmpty&&c instanceof Ye&&c.globalIndex!=r.globalIndex&&c.layerId==r.layerId&&c.type=="Copper Region").sort((c,h)=>{let u=n.indexOf(c),d=n.indexOf(h);return u==-1?(console.warn("\u6709\u94FA\u94DC\u6CA1\u6709\u6DFB\u52A0\u4F18\u5148\u7EA7:"+c.globalIndex),-1):d==-1?(console.warn("\u6709\u94FA\u94DC\u6CA1\u6709\u6DFB\u52A0\u4F18\u5148\u7EA7:"+c.globalIndex),1):u-d}),l=this.getContainAB(a,r);if(l){let c=n.indexOf(l);if(c!==-1){let h=l.getComponent().order;t.getComponent().order=h,h++;for(let u=c;u<n.length;u++){let d=n[u];if(d.type=="Copper Region"&&d!=t){let p=d.getComponent();p instanceof Vn&&p.order<h&&(e.addCommand(Te.dispatch(d,"modify")),p.order=h,h++)}}}else{let h=n[n.length-1];h!=t&&(t.getComponent().order=h.getComponent().order+1)}}else{let c=n[n.length-1];c!=t&&(t.getComponent().order=c.getComponent().order+1)}console.timeEnd("copperOrder")}changeModelLayer(t,e,r){t.type=="Copper Region"&&this.addOrder(t,r)}changeTypeToPour(t,e){t.type=="Copper Region"&&this.addOrder(t,e)}changeTypeToPours(t,e){t.forEach(r=>{r.type=="Copper Region"&&this.addOrder(r,e)})}rebuildConnectCopper(t){let e=new Set;for(let r of t)this.getNeedRebuildCopper(r,e);A.publish("rebuildSingleCopper",{ids:Array.from(e),isLast:!0})}getNeedRebuildCopper(t,e){let r=Mj(t);if(this.getOrder(t)==null)return;Vt.search4Types(r.bbox,S0).getResult(S0).filter(s=>!s.isEmpty&&s instanceof Ye&&s.globalIndex!=r.globalIndex&&s.layerId==r.layerId&&s.type=="Copper Region"?(this.needRebuildCopper(s,r),!0):!1).forEach(s=>{e.add(s.globalIndex)}),e.add(t)}getOrder(t){let e=this.getModelById(t);return e?this.getOrderByModel(e):null}getOrderByModel(t){if(t.type!="Copper Region")return null;let e=t.component;return e instanceof Vn?e.order:null}needRebuildCopper(t,e){let r=t.model.getMathGraphics(),i=e.getMathGraphics();return new Fs(r,i,0).relation==3}getModelById(t){let e=Mj(t);return e&&e.type=="Copper Region"?e:null}setOrder(t,e,r){if(e==0)this.toHighest([t],r);else if(e>0){let i=this.getOrders(t.layerId)[t.layerId]||[];if(i.length>0)this.insertAfter([t],i[e-1],r);else if(t instanceof Ye&&t.type=="Copper Region"){let n=t.getComponent();n instanceof Vn&&(n.order=0)}}else this.toLowest([t])}toHighest(t,e){let r={};t.forEach(n=>{n instanceof Ye&&n.type=="Copper Region"&&(r[n.layerId]||(r[n.layerId]=[]),r[n.layerId].push(n))});let i=this.getOrders();for(let n in r){let a=r[n].sort((h,u)=>this.getOrder(h.globalIndex)-this.getOrder(u.globalIndex)),l=0;for(let h of a)if(h instanceof Ye&&h.type=="Copper Region"){let u=h.getComponent();u instanceof Vn&&(u.order=l,l++)}let c=i[+n];for(let h of c)if(h instanceof Ye&&h.type=="Copper Region"&&!a.includes(h)){let u=h.getComponent();u instanceof Vn&&u.order<l&&(e.addCommand(Te.dispatch(h,"modify")),u.order=l,l++)}}}insertAfter(t,e,r){let i={};t.forEach(h=>{h instanceof Ye&&h.type=="Copper Region"&&(i[h.layerId]||(i[h.layerId]=[]),i[h.layerId].push(h))});let n=this.getOrders(),s=i[e.layerId]||[],a=n[e.layerId]||[],l,c=a.indexOf(e);if(c!==-1)l=e.getComponent().order+1;else{let h=a[a.length-1];h!=null?l=h.getComponent().order+1:l=0}for(let h of s)if(h instanceof Ye&&h.type=="Copper Region"){let u=h.getComponent();u instanceof Vn&&(u.order=l,l++)}if(c>=0)for(let h=c+1;h<a.length;h++){let u=a[h];if(u instanceof Ye&&u.type=="Copper Region"&&!s.includes(u)){let d=u.getComponent();d instanceof Vn&&d.order<l&&(r.addCommand(Te.dispatch(u,"modify")),d.order=l,l++)}}for(let h in i)if(+h!=e.layerId){let u=n[+h]||[],d=u[u.length-1],p;d==null?p=0:p=d.getComponent().order+1;for(let m of s)if(m instanceof Ye&&m.type=="Copper Region"){let g=m.getComponent();g instanceof Vn&&(g.order=p,p++)}}}toLowest(t,e=!0){let r={};t.forEach(n=>{n instanceof Ye&&n.type=="Copper Region"&&(r[n.layerId]||(r[n.layerId]=[]),r[n.layerId].push(n))});let i=this.getOrders();for(let n in r){let s=r[n],a;e?a=s.sort((u,d)=>this.getOrder(u.globalIndex)-this.getOrder(d.globalIndex)):a=s;let l=i[+n]||[],c=l[l.length-1],h;c==null?h=0:h=c.getComponent().order+1;for(let u of a)if(u instanceof Ye&&u.type=="Copper Region"){let d=u.getComponent();d instanceof Vn&&(d.order=h,h++)}}}getContainAB(t,e){for(let r of t){let i=r.buildBBox();if(!e.bbox.isInside(i))continue;let l=r.model.getMathGraphics(),c=e.getMathGraphics();switch(new Fs(l,c,0).relation){case 2:case 3:continue;case 1:return r}if(!this.isIntersect(l,c))return r}return null}isIntersect(t,e){let r=[];t.points(.1,l=>{r.push(l)});let i=AB.getSweep(r),n=new o_e(t.primitives,.001,i?le.CW:le.CCW);switch(new Fs(fe.build2(n.path).asClose(),e,0).relation){case 1:return!1}return!0}},o_e=class{constructor(t,e,r){this.path=new Array;let i=new Array;for(let s of t){if(s instanceof M&&s.length()<1e-8)continue;let a=this.getPrimitive(s,e,r);a!=null&&i.push(a)}for(let s=0,a=i.length;s<a;s++){let l=i[s],c=i[s+1];if(c!=null){let h=this.getPoint(l,c);if(h!=null){let u=this.modifyPrimitiveEnd(l,h),d=this.modifyPrimitiveStart(c,h);i.splice(s,2,u,d)}}}let n=fe.build2(i);this.path=n.primitives}getNearPoint(t,e){let i=new ir(t,new M(e,e)).getLine();return i.start().distance2(e)<i.end().distance2(e)?i.end():i.start()}isParaller(t,e){if(t instanceof M&&e instanceof M){let r=t.direct.cross(e.direct);if(ne.eq(r,0))return!0}return!1}getPoint(t,e){let r=Tt(t,e),i=null,n=Number.MAX_VALUE,s=this.isParaller(t,e),a=null;for(let l=0;l<r;l+=2){let c=new S(Ee[l],Ee[l+1]),h=c.distance2(t.start());h<n&&(i=c,n=h),a==null?a=c:a=a.add(c)}return s&&r>0&&a!=null?a.mul(2/r):i}modifyPrimitiveStart(t,e){if(t instanceof M)return new M(e,t.end());if(t instanceof q){let r=e.angleD(t.center);return q.build2(t.center,r,t.endAngle(),t.rx,t.ry,t.sweep())}return null}modifyPrimitiveEnd(t,e){if(t instanceof M)return new M(t.start(),e);if(t instanceof q){let r=e.angleD(t.center);return q.build2(t.center,t.startAngle,r,t.rx,t.ry,t.sweep())}return null}getInters(t,e,r){let i=-1;for(let n=r,s=e.length;n<s;n++){let a=e[n];Tt(t,a)>0&&(i=n)}return i}getPrimitive(t,e,r){if(t instanceof M){let i=t.end().sub(t.start()).normalize(),n=new S(-i.y,i.x).mul(e);r==le.CW&&(n=n.mul(-1));let s=t.start().sub(i.mul(e)).add(n),a=t.end().add(i.mul(e)).add(n);return new M(s,a)}else if(t instanceof q){let i=t.rx;return t.sweep()==le.CCW?r==le.CCW?i=t.rx-e:i=t.rx+e:r==le.CCW?i=t.rx+e:i=t.rx-e,i<=0?null:q.build2(t.center,t.startAngle,t.endAngle(),i,i,t.sweep())}return null}};var wme=class wme{static getInstance(){return this.instanceItem===null&&(this.instanceItem=new wme),this.instanceItem}constructor(){this._activeStatus="active"}get activeStatus(){return this._activeStatus}set activeStatus(t){this._activeStatus=t}};wme.instanceItem=null;var eL=wme;function ua(o,t,e){let r=[];for(let i=0;i<o.length;i++)o[i][t]===e&&r.push(o[i]);return r}function Lme(o){let t=[];return t.push(o.end.x*10),t.push(o.end.y*10),t.push(o.start.x*10),t.push(o.start.y*10),t.push(o.textPosition.x*10),t.push(o.textPosition.y*10),t}function Mme(o){let t=[];return t.push(o.left.x*10),t.push(o.left.y*10),t.push(o.start.x*10),t.push(o.start.y*10),t.push(o.end.x*10),t.push(o.end.y*10),t.push(o.right.x*10),t.push(o.right.y*10),t}function Nme(o){let t=[];return t.push(o.start.x*10),t.push(o.start.y*10),t.push(o.center.x*10),t.push(o.center.y*10),t.push(o.end.x*10),t.push(o.end.y*10),t}function dy(o){let t=o.model;if(o instanceof ct){let r=o.toJSON();delete r.componentData,delete r.shapes;let i=py(o);return r.pathString=i||"",r.strokeWidth=Xe(r.strokeWidth,3,"mil"),{...r,pcbItemPrimitiveType:t.modelType}}if(o instanceof Ue){if(o instanceof Si||o instanceof vt){let i=o.toJSON(),n=o.center.add(new S(Math.cos(o.startAngle),Math.sin(o.startAngle)).mul(o.radius)),s=o.center.add(new S(Math.cos(o.endAngle),Math.sin(o.endAngle)).mul(o.radius));return{...i,startX:Xe(n.x,3,"mil"),startY:Xe(n.y,3,"mil"),endX:Xe(s.x,3,"mil"),endY:Xe(s.y,3,"mil"),width:i.width*10,arcAngle:Ht.toDegrees(t.angle),pcbItemPrimitiveType:t.modelType}}let r=o.toJSON();return r.start=new S(Xe(r.start.x,3,"mil"),Xe(r.start.y,3,"mil")),r.end=new S(Xe(r.end.x,3,"mil"),Xe(r.end.y,3,"mil")),r.width=Xe(r.width,3,"mil"),{...r,startX:r.start.x,startY:r.start.y,endX:r.end.x,endY:r.end.y,pcbItemPrimitiveType:t.modelType}}if(o instanceof Le){let r=o.toJSON();return r.center=new S(Xe(r.center.x,3,"mil"),Xe(r.center.y,3,"mil")),r.rotation=Ht.toDegrees(r.rotation),r.topSolderExpansion=Xe(r.topSolderExpansion,3,"mil"),r.bottomSolderExpansion=Xe(r.bottomSolderExpansion,3,"mil"),r.pasteExpansion=Xe(r.pasteExpansion,3,"mil"),{...r,padRule:o.model.padRule?o.model.padRule:null,holeAspect:o.holeShape?[o.holeShape,(o.holeRadius*10||0)*2,o.holeLength*10||0]:null,padTypeAspect:o.model.padType,defaultPadShapeAspect:uH(o.model),specialPadShapeAspect:dH(o.model),pcbItemPrimitiveType:t.modelType,parentId:o.getParent()?o.getParent().globalIndex:null}}if(o instanceof Yn){let r=o.toJSON();return r.start=new S(Xe(r.start.x,3,"mil"),Xe(r.start.y,3,"mil")),r.width=Xe(r.width,3,"mil"),r.height=Xe(r.height,3,"mil"),{...r,imageType:o.model.modelType==="Image"?"Image":"Picture",pathString:o instanceof Yn?TP(o.getRealPath()).join(" "):"",pcbItemPrimitiveType:t.modelType}}if(o instanceof ca||o instanceof xa||o instanceof ol){let r=o.toJSON();return r.width=Xe(r.width,3,"mil"),{...r,dimensionType:o.type,coordinateSet:o.type==="Length Dimension"?Mme(o):o.type==="Radius Dimension"?Lme(o):Nme(o),unit:x.getInstance().unit,pcbItemPrimitiveType:t.modelType}}if(o instanceof Ge){let r=o.toJSON();return r.center=new S(Xe(r.center.x,3,"mil"),Xe(r.center.y,3,"mil")),r.radius=Xe(r.radius,3,"mil"),r.holeRadius=Xe(r.holeRadius,3,"mil"),{...r,pcbItemPrimitiveType:t.modelType}}let e=o.toJSON();if(typeof e.componentData=="object"&&e.componentData!==null&&e.componentData.model&&delete e.componentData,e.pcbItemPrimitiveType=t.modelType,t.modelType=="Rect"||t.modelType=="Circle"){let r=TP([o.getMathGraphics()]).join(" ");switch(e.pathString=r||"",e.strokeWidth=Xe(e.strokeWidth,3,"mil"),t.modelType){case"Rect":e.start=new S(Xe(e.start.x,3,"mil"),Xe(e.start.y,3,"mil")),e.width=Xe(e.width,3,"mil"),e.height=Xe(e.height,3,"mil"),e.rotation=Ht.toDegrees(e.rotation),e.cornerRadius=Xe(e.cornerRadius,3,"mil");break;case"Circle":e.center=new S(Xe(e.center.x,3,"mil"),Xe(e.center.y,3,"mil")),e.radius=Xe(e.radius,3,"mil");break;default:break}}return e}function py(o){if(o instanceof ct){let t=o.getMathGraphics();return $b(2,{pl:t})}else if(o instanceof nr){let{start:t,width:e,height:r,rotation:i,radius:n}=o,s={start:t,width:e,height:r,rotation:i,radius:n};return $b(1,s)}else if(o instanceof Sr){let t=o.center,e=o.radius;return $b(0,{center:t,radius:e})}}function rd(o){o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}function uH(o){if(o instanceof Je)if(o.isPolygon()){let t;return[1,2,15].forEach(e=>{let r=o.getPad(e);r&&(t=r)}),["POLYGON",F1(t.pl,10)]}else return o.layerId==12?o.top.type=="RECT"?[o.top.type,Xe(o.top.width,3,"mil"),Xe(o.top.height,3,"mil"),o.top.ratio*100]:[o.top.type,Xe(o.top.width,3,"mil"),Xe(o.top.height,3,"mil")]:o.layerId==1?o.top.type=="RECT"?[o.top.type,Xe(o.top.width,3,"mil"),Xe(o.top.height,3,"mil"),o.top.ratio*100]:[o.top.type,Xe(o.top.width,3,"mil"),Xe(o.top.height,3,"mil")]:o.bottom.type=="RECT"?[o.bottom.type,Xe(o.bottom.width,3,"mil"),Xe(o.bottom.height,3,"mil"),o.bottom.ratio*100]:[o.bottom.type,Xe(o.bottom.width,3,"mil"),Xe(o.bottom.height,3,"mil")]}function dH(o){let t=new Array;return o instanceof Je&&!o.isPolygon()&&o.type==2&&(o.top.type=="RECT"?t.push([1,1,[o.top.type,Xe(o.top.width,3,"mil"),Xe(o.top.height,3,"mil"),o.top.ratio*100]]):t.push([1,1,[o.top.type,Xe(o.top.width,3,"mil"),Xe(o.top.height,3,"mil")]]),o.inner.type=="RECT"?t.push([1,2,[o.inner.type,Xe(o.inner.width,3,"mil"),Xe(o.inner.height,3,"mil"),o.inner.ratio*100]]):t.push([1,2,[o.inner.type,Xe(o.inner.width,3,"mil"),Xe(o.inner.height,3,"mil")]]),o.bottom.type=="RECT"?t.push([2,2,[o.bottom.type,Xe(o.bottom.width,3,"mil"),Xe(o.bottom.height,3,"mil"),o.bottom.ratio*100]]):t.push([2,2,[o.bottom.type,Xe(o.bottom.width,3,"mil"),Xe(o.bottom.height,3,"mil")]])),t}var tL=null;function L$e(o,t){o.messageBus.rpcService("pcb/extensionAPI/document-getRatlineStatus",async()=>({status:eL.getInstance().activeStatus})),o.messageBus.rpcService("pcb/extensionAPI/document-setRatlineStatus",async e=>{let{status:r}=e;return eL.getInstance().activeStatus=r,{status:eL.getInstance().activeStatus}}),o.messageBus.rpcService("pcb/extensionAPI/document-convertCanvasOriginToDataOrigin",async e=>{let{x:r,y:i}=e,n=r/10,s=i/10,a=x.getInstance().origin;return{x:(n+a.x)*10,y:(s+a.y)*10}}),o.messageBus.rpcService("pcb/extensionAPI/document-convertDataOriginToCanvasOrigin",async e=>{let{x:r,y:i}=e,n=r/10,s=i/10,a=x.getInstance().origin;return{x:(n-a.x)*10,y:(s-a.y)*10}}),o.messageBus.rpcService("pcb/extensionAPI/document-getCanvasOrigin",async e=>{let r=x.getInstance().origin;return{offsetX:r.x*10,offsetY:r.y*10}}),o.messageBus.rpcService("pcb/extensionAPI/document-setCanvasOrigin",async e=>{let{offsetX:r,offsetY:i}=e,n=new S(r/10,i/10);return _3(n),!0}),o.messageBus.rpcService("pcb/extensionAPI/document-navigateToCoordinates",async e=>{let{x:r,y:i}=e,n=new ut(r/10-200,r/10+200,i/10-200,i/10+200);return o.publish("AdaptBBox2",{box:n,showCrossLines:!1,onlyMove:!0}),o.publish("updateFrame",""),typeof tL=="number"&&(o.publish("HiddenCanvasCrossLine",null),tL=null),window.clearTimeout(tL),window.requestAnimationFrame(()=>{tL=window.setTimeout(()=>{o.publish("SetCanvasCrossLine",{box:n,delay:3e3})},75)}),!0}),o.messageBus.rpcService("pcb/extensionAPI/document-navigateToRegion",async e=>{let{left:r,right:i,top:n,bottom:s}=e,a=(r+i)/2,l=(n+s)/2,c=Math.abs(r-i)/2,h=Math.abs(n-s)/2,u=new ut(a/10-c/10,a/10+c/10,l/10-h/10,l/10+h/10);return o.publish("AdaptBBox2",{box:u,showCrossLines:!1,onlyMove:!0}),o.publish("updateFrame",""),typeof tL=="number"&&(o.publish("hiddenCanvasRectRegion",null),tL=null),window.clearTimeout(tL),window.requestAnimationFrame(()=>{tL=window.setTimeout(()=>{o.publish("showCanvasRectRegion",{box:u,delay:3e3})},75)}),!0}),o.messageBus.rpcService("pcb/extensionAPI/document-getPrimitivesInRegion",async e=>{let{left:r,right:i,top:n,bottom:s,leftToRight:a}=e,l=(r+i)/2,c=(n+s)/2,h=Math.abs(r-i)/2,u=Math.abs(n-s)/2,d=new ut(l/10-h/10,l/10+h/10,c/10-u/10,c/10+u/10);return t.getItemsByBBox(d,a).filter(g=>typeof g.toJSON=="function").map(g=>dy(g))}),o.messageBus.rpcService("pcb/extensionAPI/document-getPrimitiveAtPoint",async e=>{let{x:r,y:i}=e,n=Wr.pointSelect(r/10,i/10);return n=Array.from($t.filter(n)),Wr.filterPartiton(n).filter(l=>typeof l.toJSON=="function").map(l=>dy(l))}),o.messageBus.rpcService("pcb/extensionAPI/document-getCurrentFilterConfiguration",async()=>new JU().getCurrentConfig())}function pH(o,t,e){let r=e.map(n=>n.designator),i=t.map(n=>String(n.num));if(o.indexOf(":")>=0){let n=o.split(":"),s=n[0],a=n[1];if(r.indexOf(s)<=-1||i.indexOf(a)<=-1)return null;let l=Re.queryItem(e,"designator",s);if(l.index<=-1)return null;let c=Re.queryItem(t,"num",a);return c.index<=-1?null:{belongDeiviceId:l.data.globalIndex,designator:s,id:c.data.globalIndex,isDissociate:!1,nets:[],number:a}}else{let n=o,s=Re.queryItem(t,"number",+n.slice(ur.length));return s.index<=-1?null:{belongDeiviceId:"",designator:"",id:s.data.globalIndex,isDissociate:!0,nets:[],number:"",text:n}}}function kme(o){return typeof o=="string"?!0:Array.isArray(o)?o.every(t=>typeof t=="string"):!1}function jwt(o){if(Array.isArray(o)&&o.length===2){let[t,e]=o;if(typeof t=="string"&&typeof e=="string")return!0}if(Array.isArray(o)){for(let t of o)if(!Array.isArray(t)||t.length!==2||typeof t[0]!="string"||typeof t[1]!="string")return!1;return!0}return!1}function Xwt(o,t){return o.sort().toString()===t.sort().toString()}function M$e(o,t){for(let e of t)for(let r of o){let i,n="",s="";if(e[0].indexOf(":")>=0?n=r.pad1.designator+":"+r.pad1.number:n=r.pad1.id,e[1].indexOf(":")>=0?s=r.pad2.designator+":"+r.pad2.number:s=r.pad2.id,i=[n,s],Xwt(e,i))return!1}return!0}function QN(o,t){let e=Object.keys(o),r=Object.keys(t);if(e.length!==r.length)return!0;for(let i of e){if(!r.includes(i))return!0;let n=o[i],s=t[i];if(n.length!==s.length)return!0;for(let a=0;a<n.length;a++)if(n[a]!==s[a])return!0}return!1}function qwt(o){let t=new Set;for(let e in o)if(o.hasOwnProperty(e))for(let r of o[e]){if(t.has(r))return!1;t.add(r)}return!0}function $wt(o,t){Array.isArray(t)||(t=[t]);for(let e in o)if(o.hasOwnProperty(e)){let r=o[e];for(let i of t)if(r.includes(i))return!1}return!0}function Bme(o){let t=o.toRGBA();return{r:t[0],g:t[1],b:t[2],alpha:t[3]}}var Kwt=o=>{if(o.type==="net"&&o.name){let t=te.getInstance().getNet(o.name);t!=null&&t.netDifferential&&(o["Differential Pair"]=t.netDifferential.differentialPhysics)}};function N$e(o,t){o.messageBus.rpcService("pcb/extensionAPI/drc-check",async e=>{let{strict:r,userInterface:i,includeVerboseError:n}=e;if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let s=await Ihe({isOpenDRCCustomCheck:!0}),a=Au.panelManager.getErrorTree(s);Au.updateVisibility(!0),o.publish("getAllErrorsBack",a,$());let l=!1,c=[];for(let h of s)h.list.length!==0&&(l=!0,c.push(h));return n?c:!l}),o.messageBus.rpcService("pcb/extensionAPI/drc-getCurrentRuleConfigurationName",async e=>{if(!(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype))return{ruleTemplateName:te.getInstance().getRuleTemplateName()}}),o.messageBus.rpcService("pcb/extensionAPI/drc-getCurrentRuleConfiguration",async e=>{if(!(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype))return{...Fu.getDesignRulers()}}),o.messageBus.rpcService("pcb/extensionAPI/drc-overwriteCurrentRuleConfiguration",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let r=new a1,i=r.getDesignRulers();return e.configName?r.setDesignRulers({...i,Rule:e.ruleConfiguration,RuleTemplateName:e.configName}):r.setDesignRulers({...i,Rule:e.ruleConfiguration}),!0}),o.messageBus.rpcService("pcb/extensionAPI/drc-getNetRules",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let n=new a1().getDesignRulers().Net,s=a=>{Kwt(a),a.sub&&a.sub.forEach(s)};return n.forEach(s),n}),o.messageBus.rpcService("pcb/extensionAPI/drc-overwriteNetRules",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{netRules:r}=e,i=new a1,n=i.getDesignRulers();return i.setDesignRulers({...n,Net:r}),!0}),o.messageBus.rpcService("pcb/extensionAPI/drc-getNetByNetRules",async e=>!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype?void 0:new a1().getDesignRulers().NetnetList),o.messageBus.rpcService("pcb/extensionAPI/drc-overwriteNetByNetRules",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{netByNetRules:r}=e,i=new a1,n=i.getDesignRulers();return i.setDesignRulers({...n,NetnetList:r}),!0}),o.messageBus.rpcService("pcb/extensionAPI/drc-getRegionRules",async e=>!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype?void 0:new a1().getDesignRulers().constraintRegion),o.messageBus.rpcService("pcb/extensionAPI/drc-overwriteRegionRules",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{regionRules:r}=e,i=new a1,n=i.getDesignRulers();return i.setDesignRulers({...n,constraintRegion:r}),!0}),o.messageBus.rpcService("pcb/extensionAPI/drc-createNetClass",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{netClassName:r,nets:i,color:n}=e,s={[r]:i},a=ze.getAllNets(),l=!0;if(i.forEach(c=>{a.includes(c)||(l=!1)}),!l)return!1;if(n){let c=ee.of2(n.r,n.g,n.b,n.alpha);dD(i,c)}return eI("new-net-class",s)}),o.messageBus.rpcService("pcb/extensionAPI/drc-deleteNetClass",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{netClassName:r}=e;if(typeof r!="string"||r.trim()=="")return!1;let n=Fu.getDesignRulers().Net.filter(l=>l.type==="netClass"),s={};n.forEach(l=>{s[l.name]=l.sub.map(c=>c.name)});let a={};return Object.keys(s).forEach(l=>{r!==l&&(a[l]=Ls(s[l]))}),QN(a,s)?eI("edit-net-class",a,s):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-modifyNetClassName",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{originalNetClassName:r,netClassName:i}=e,s=Fu.getDesignRulers().Net.filter(c=>c.type==="netClass"),a={};s.forEach(c=>{a[c.name]=c.sub.map(h=>h.name)});let l={};return Object.keys(a).forEach(c=>{if(c===r){l[i]=Ls(a[c]);return}l[c]=Ls(a[c])}),eI("edit-net-class",l,a)}),o.messageBus.rpcService("pcb/extensionAPI/drc-addNetToNetClass",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{net:r,netClassName:i}=e;if(typeof i!="string"||!kme(r)||typeof r=="string"&&!te.getInstance().getNet(r)||r instanceof Array&&!r.every(c=>te.getInstance().getNet(c)))return!1;let s=Fu.getDesignRulers().Net.filter(c=>c.type==="netClass"),a={};s.forEach(c=>{a[c.name]=c.sub.map(h=>h.name)});let l={};return Object.keys(a).forEach(c=>{if(c===i){if(l[i]=Ls(a[c]),typeof r=="string"){l[i].push(r);return}if(r instanceof Array){r.forEach(h=>{l[i].push(h)});return}return}l[c]=Ls(a[c])}),QN(l,a)&&qwt(l)?eI("edit-net-class",l,a):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-removeNetFromNetClass",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{net:r,netClassName:i}=e;if(typeof i!="string"||!kme(r))return!1;let s=Fu.getDesignRulers().Net.filter(c=>c.type==="netClass"),a={};s.forEach(c=>{a[c.name]=c.sub.map(h=>h.name)});let l={};return Object.keys(a).forEach(c=>{if(c===i){if(l[i]=Ls(a[c]),typeof r=="string"){let h=l[i].indexOf(r);h>=0&&l[i].splice(h,1);return}if(r instanceof Array){r.forEach(h=>{let u=l[i].indexOf(h);u>=0&&l[i].splice(u,1)});return}return}l[c]=Ls(a[c])}),QN(l,a)?eI("edit-net-class",l,a):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-getAllNetClasses",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let r=[];return Fu.getDesignRulers().Net.filter(s=>s.type==="netClass").forEach(s=>{let a={name:"",nets:[]};a.name=s.name,s.sub.forEach(h=>{a.nets.push(h.name)});let l=ze.getSpecialColor(a.nets[0]),c=!0;for(let h=1;h<a.nets.length;h++){let u=ze.getSpecialColor(a.nets[h]);if(u.r!==l.r||u.g!==l.g||u.b!==l.b){c=!1;break}}c?a.color=Bme(l):a.color=Bme(ee.BLACK),r.push(a)}),r}),o.messageBus.rpcService("pcb/extensionAPI/drc-createEqualLengthNetGroup",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{equalLengthNetGroupName:r,nets:i,color:n}=e,s={[r]:i},a=ze.getAllNets(),l=!0;if(i.forEach(c=>{a.includes(c)||(l=!1)}),!l)return!1;if(n){let c=ee.of2(n.r,n.g,n.b,n.alpha);dD(i,c)}return eI("new-equal-length-group",s)}),o.messageBus.rpcService("pcb/extensionAPI/drc-deleteEqualLengthNetGroup",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{equalLengthNetGroupName:r}=e;if(typeof r!="string"||r.trim()=="")return!1;let n=Fu.getDesignRulers().Net.filter(l=>l.type==="equalLengthGroup"),s={};n.forEach(l=>{s[l.name]=l.sub.map(c=>c.name)});let a={};return Object.keys(s).forEach(l=>{r!==l&&(a[l]=Ls(s[l]))}),QN(a,s)?eI("edit-equal-length-group",a,s):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-modifyEqualLengthNetGroupName",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{originalEqualLengthNetGroupName:r,equalLengthNetGroupName:i}=e;if(typeof r!="string"||r.trim()==""||typeof i!="string"||i.trim()=="")return!1;let s=Fu.getDesignRulers().Net.filter(c=>c.type==="equalLengthGroup"),a={};s.forEach(c=>{a[c.name]=c.sub.map(h=>h.name)});let l={};return Object.keys(a).forEach(c=>{if(c===r){l[i]=Ls(a[c]);return}l[c]=Ls(a[c])}),QN(l,a)?eI("edit-equal-length-group",l,a):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-addNetToEqualLengthNetGroup",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{net:r,equalLengthNetGroupName:i}=e;if(typeof i!="string"||!kme(r)||typeof r=="string"&&!te.getInstance().getNet(r)||r instanceof Array&&!r.every(c=>te.getInstance().getNet(c)))return!1;let s=Fu.getDesignRulers().Net.filter(c=>c.type==="equalLengthGroup"),a={};if(s.forEach(c=>{a[c.name]=c.sub.map(h=>h.name)}),!$wt(a,r))return!1;let l={};return Object.keys(a).forEach(c=>{if(c===i){if(l[i]=Ls(a[c]),typeof r=="string"){l[i].push(r);return}if(r instanceof Array){r.forEach(h=>{l[i].push(h)});return}return}l[c]=Ls(a[c])}),QN(l,a)?eI("edit-equal-length-group",l,a):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-removeNetFromEqualLengthNetGroup",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{net:r,equalLengthNetGroupName:i}=e;if(typeof i!="string"||!kme(r))return!1;let s=Fu.getDesignRulers().Net.filter(c=>c.type==="equalLengthGroup"),a={};s.forEach(c=>{a[c.name]=c.sub.map(h=>h.name)});let l={};return Object.keys(a).forEach(c=>{if(c===i){if(l[i]=Ls(a[c]),typeof r=="string"){let h=l[i].indexOf(r);h>=0&&l[i].splice(h,1);return}if(r instanceof Array){r.forEach(h=>{let u=l[i].indexOf(h);u>=0&&l[i].splice(u,1)});return}return}l[c]=Ls(a[c])}),QN(l,a)?eI("edit-equal-length-group",l,a):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-getAllEqualLengthNetGroups",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let r=[];return Fu.getDesignRulers().Net.filter(s=>s.type==="equalLengthGroup").forEach(s=>{let a={name:"",nets:[]};a.name=s.name,s.sub.forEach(h=>{a.nets.push(h.name)});let l=ze.getSpecialColor(a.nets[0]),c=!0;for(let h=1;h<a.nets.length;h++){let u=ze.getSpecialColor(a.nets[h]);if(u.r!==l.r||u.g!==l.g||u.b!==l.b){c=!1;break}}c?a.color=Bme(l):a.color=Bme(ee.BLACK),r.push(a)}),r}),o.messageBus.rpcService("pcb/extensionAPI/drc-createPadPairGroup",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{padPairGroupName:r,padPairs:i}=e,n=nO();for(let u=0;u<n.length;u++){let d=n[u].details;if(!M$e(d,i))return!1}let s=Cr.getAllItem(),a=Kt.getAllItem(),l=[],c=!0;if(i.forEach(u=>{let d=u[0],p=u[1],m={pad1:null,pad2:null};if(!d||!p)return;let g=pH(d,a,s),y=pH(p,a,s);if(!g||!y){c=!1;return}m.pad1=g,m.pad2=y,l.push(m)}),!c)return!1;let h=Re.queryItem(n,"groupName",r);return h.index>=0?l.forEach(u=>{h.data.details.push(u),h.data.action="UPDATED"}):n.push({groupName:r,oldGroupName:r,action:"CREATED",details:l}),Hw(Ls(n)),!0}),o.messageBus.rpcService("pcb/extensionAPI/drc-deletePadPairGroup",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{padPairGroupName:r}=e;if(typeof r!="string"||r.trim()=="")return!1;let i=nO(),n=Re.queryItem(i,"groupName",r);return n.index<=-1?!1:(n.data.action="DELETED",Hw(Ls(i)),!0)}),o.messageBus.rpcService("pcb/extensionAPI/drc-modifyPadPairGroupName",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{originalPadPairGroupName:r,padPairGroupName:i}=e;if(typeof r!="string"||r.trim()==""||typeof i!="string"||i.trim()=="")return!1;let n=nO(),s=Re.queryItem(n,"groupName",r);return s.index<=-1?!1:(s.data.groupName=i,s.data.action="UPDATED",Hw(Ls(n)),!0)}),o.messageBus.rpcService("pcb/extensionAPI/drc-addPadPairToPadPairGroup",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{padPairGroupName:r,padPair:i}=e;if(typeof r!="string"||r.trim()==""||!jwt(i))return!1;let n=nO();for(let d=0;d<n.length;d++){let p=n[d].details,m=i[0]instanceof Array?i:[i];if(!M$e(p,m))return!1}let s=Re.queryItem(n,"groupName",r);if(s.index<=-1)return!1;let a=i[0]instanceof Array?i:[i],l=Cr.getAllItem(),c=Kt.getAllItem(),h=[],u=!0;return a.forEach(d=>{let p=d[0],m=d[1],g={pad1:null,pad2:null};if(!p||!m)return;let y=pH(p,c,l),b=pH(m,c,l);if(!y||!b){u=!1;return}g.pad1=y,g.pad2=b,h.push(g)}),u?(h.forEach(d=>{s.data.details.push(d),s.data.action="CREATED"}),Hw(Ls(n)),!0):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-removePadPairFromPadPairGroup",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let{padPairGroupName:r,padPair:i}=e,n=nO(),s=Re.queryItem(n,"groupName",r);if(s.index<=-1)return!1;let a=i[0]instanceof Array?i:[i],l=Cr.getAllItem(),c=Kt.getAllItem(),h=[],u=!1;return a.forEach(d=>{let p=d[0],m=d[1],g={pad1:null,pad2:null};if(!p||!m)return;let y=pH(p,c,l),b=pH(m,c,l);!y||!b||(g.pad1=y,g.pad2=b,h.push(g))}),h.forEach(d=>{let p=d.pad1,m=d.pad2,g=-1,y=-1;if(p.designator&&p.number)for(let b=0;b<s.data.details.length;b++){let P=s.data.details[b].pad1;if(P.designator===p.designator&&P.number===p.number){g=b;break}}else if(p.text){for(let b=0;b<s.data.details.length;b++)if(s.data.details[b].pad1.id===p.text){g=b;break}}if(m.designator&&m.number)for(let b=0;b<s.data.details.length;b++){let P=s.data.details[b].pad2;if(P.designator===m.designator&&P.number===m.number){y=b;break}}else if(m.text){for(let b=0;b<s.data.details.length;b++)if(s.data.details[b].pad2.id===m.text){y=b;break}}g>=0&&y>=0&&g===y&&(u=!0,s.data.details.splice(g,1),s.data.action="UPDATED")}),Hw(Ls(n)),!!u}),o.messageBus.rpcService("pcb/extensionAPI/drc-getAllPadPairGroups",async e=>!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype?void 0:nO()),o.messageBus.rpcService("pcb/extensionAPI/drc-getPadPairGroupMinWireLength",async e=>{if(!x.getInstance().isactive||bi.FOOTPRINTVIEW==x.getInstance().doctype)return;let i=nO().filter(s=>s.groupName==e.padPairGroupName)[0];if(!i)return;let n=[];return i.details.forEach(s=>{let a=dX(s.pad1),l=dX(s.pad2);if(a&&l){let c=s.pad1.designator.length>1?`${s.pad1.designator}:${s.pad1.number}`:s.pad1.id,h=s.pad2.designator.length>1?`${s.pad2.designator}:${s.pad2.number}`:s.pad2.id,d=jF(s.pad1,s.pad2).netMinLength*10;n.push({padPair:[c,h],minWireLength:d})}}),n})}function k$e(o){let t=be.configInnerLayers.size,e=be.getAllLayer(),r=o,i=new iC,n=new Array,s=new Array,a,l=new Array;for(let c=0;c<e.length;c++){let h=i.toPlainObj(e[c]),u=!0,d=e[c].config;if(r.forEach(p=>{if(+p.layerId===h.layerId){u=!1;let m=Object.assign({},h,p),g=ee.of3(m.activeColor).getData();if(be.modifyLayer(m.layerId,m.layerType,m.layerName||e[c].name,e[c].order,ee.build(g[0],g[1],g[2],m.activeColorAlpha),ee.build(g[0],g[1],g[2],m.deactiveColorAlpha),e[c].active,m.status),ED.deactiveAlpha=m.deactiveColorAlpha,p.layerType==="PLANE"&&Xd.hasProfileItem(p.layerId)){let b=Xd.fetchProfileItem(p.layerId);be.updatePlanzoneLayerKeepIsland(p.layerId,b.keepIsland)}let y=be.getLayer(h.layerId).config;return u=!y,u||Sp(p.layerId),!d&&y?m.layerType=="PLANE"&&n.push(m.layerId):d&&!y?m.layerType=="PLANE"&&s.push(m.layerId):m.layerType=="SIGNAL"&&h.layerType=="PLANE"?s.push(m.layerId):m.layerType=="PLANE"&&h.layerType=="SIGNAL"&&n.push(m.layerId),!1}}),e[c].active&&(a=e[c]),u)if(e[c].active&&(a=be.getTopLayer()),be.modifyLayer(e[c].layerID,e[c].type,e[c].name,e[c].order,e[c].activeColor,e[c].deactiveColor,!1,0),l.push(e[c].layerID),Xd.hasProfileItem(e[c].layerID)&&Xd.deleteProfileItem(e[c].layerID),h.layerType=="CUSTOM"){let p=e[c].layerID,m=be.getLayer(p).config;(d!=m||m)&&Sp(p,u)}else Sp(e[c].layerID)}if(l.length){let c=Cr.getAllItem();for(let h of c)h.needUpdateBBox=!0}a!=null&&be.setActiveLayer(a),ga.getInstance().viaShowPair&&t!=be.configInnerLayers.size&&Hr.iterator(c=>c.refreshRender()),A.publish("clearSinglePlane",s),A.publish("rebuildSinglePlane",n),A.publish("autoRefresh3DColor",""),A.publish("autoFill","")}async function B$e(){if(!ce.pcbConfig.realTimeUpdateUnusedLayers)return;let o=[...Kt.getAllItem().filter(r=>r.layerId==12),...Hr.getAllItem()],t=(await A.messageBus.rpcCall("unusedLayer",aK(o))).message,e=await WN(t);o.length>0&&je.executeCommand(e)}function Fme(o,t={}){let{visible:e,locked:r}=t;typeof e<"u"&&(o.visible=!!e),typeof r<"u"&&(o.locked=!!r)}function F$e(o,t){o.messageBus.rpcService("pcb/extensionAPI/pcblayer-getAllLayers",async()=>be.getAllLayer().map(r=>({layerId:r.layerID,type:r.type,name:r.name,order:r.order,activeColor:r.activeColor.toString(),activeColorAlpha:r.activeColor.alpha,deactiveColor:r.deactiveColor.toString(),deactiveColorAlpha:r.deactiveColor.alpha,visible:r.visible,locked:r.locked,active:r.active,layerStatus:r.layerStatus}))),o.messageBus.rpcService("pcb/extensionAPI/pcblayer-selectLayerById",async e=>{let{layerId:r}=e;return be.setActiveLayerId(+r),o.publish("flushService",""),o.publish("updateFrame",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcblayer-setLayerStatus",async e=>{let{layerIds:r,visible:i,locked:n,setOtherLayerInvisible:s=!1,setOtherLayerVisible:a=!1}=e;if(typeof r>"u"||r.length<=0){let l=be.getAllLayer();for(let c=0;c<l.length;c++)Fme(l[c],{visible:i,locked:n});return o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),Bf.getInstance().updateLayerInfo(),!0}for(let l=0;l<r.length;l++){let c=r[l],h=be.getLayer(+c);if(!h)return!1;let u=be.getAllLayer();if(s)for(let d=0;d<u.length;d++)r.indexOf(u[d].layerID)>=0||Fme(u[d],{visible:!1});if(a)for(let d=0;d<u.length;d++)r.indexOf(u[d].layerID)>=0||Fme(u[d],{visible:!0});Fme(h,{visible:i,locked:n})}return o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),Bf.getInstance().updateLayerInfo(),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcblayer-setLayerData",async e=>{let{layerList:r}=e;return k$e(r.map(i=>({activeColor:i.activeColor,activeColorAlpha:i.activeColorAlpha,deactiveColor:i.deactiveColor,deactiveColorAlpha:i.deactiveColorAlpha,layerId:i.layerId,layerName:i.name,layerType:i.type,locked:i.locked,referenceLayerId:i.layerId,status:i.layerStatus}))),BC(!0),await B$e(),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcblayer-setLayerThemeProfile",async e=>!e.canvasColorTheme||!e.canvasColorTheme.length||!e.canvasColorThemeSelected?!1:(ce.updatePcbLayerByThemeCall(e),!0))}function V$e(o,t){o.messageBus.rpcService("pcb/extensionAPI/pcbmanufacturedata-getGerberFile",async e=>{try{return await TG(e)}catch(r){return console.warn(r),{__isError:!0,__message:r.message}}}),o.messageBus.rpcService("pcb/extensionAPI/pcbmanufacturedata-get3DShellFile",async e=>{try{return await w0e(e)}catch(r){return console.warn(r),{__isError:!0,__message:r.message}}}),o.messageBus.rpcService("pcb/extensionAPI/pcbmanufacturedata-getSourcePCBInfo",async e=>JSON.parse(JSON.stringify(new RD))),o.messageBus.rpcService("pcb/extensionAPI/pcbmanufacturedata-getIPC_D_356AFile",async e=>zYe(e))}function G$e(o,t){o.messageBus.rpcService("pcb/extensionAPI/math-convertImageToComplexPolygon",async e=>{let{data:r}=e,i=new Array;return F3(r.path).forEach(s=>{let a=F1(s);i.push(a)}),i}),o.messageBus.rpcService("pcb/extensionAPI/math-getCenter",async e=>{let r=Yb(e);return new BI(r).center})}function U$e(o,t){o.messageBus.rpcService("pcb/extensionAPI/pcbnet-getAllNetsInfo",async()=>{let e=ze.getAllNets(),r=[];return e&&e.forEach(i=>{r.push({net:i,color:ze.getSpecialColor(i),length:ze.getNetLength(i)*10})}),r}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-getNet",async e=>{let{net:r}=e;return ze.getAllNets().includes(r)?{net:r,color:ze.getSpecialColor(r),length:ze.getNetLength(r)*10}:void 0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-setNetColor",async e=>{let{net:r,color:i}=e;if(!ze.getAllNets().includes(r))return!1;if(i){let s=ee.build(i.r,i.g,i.b,i.alpha);return dD([r],s),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),!0}else return!1}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-getAllNets",async()=>ze.getAllNets()),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-getNetLength",async e=>{let{netName:r}=e;return ze.getAllNets().includes(r)?ze.getNetLength(r):void 0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-getAllPrimitivesByNet",async e=>{let{netName:r,primitiveTypes:i=[]}=e,n=ze.getSameNetItems(r),s=[];for(let a=0;a<n.length;a++){let l=n[a],c=l.model;c.modelType&&(i.length&&i.indexOf(c)<=-1||s.push(dy(l)))}return s}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-selectNet",async e=>{let{netName:r}=e,i=ze.getSameNetItems(r),n=new Set;for(let s=0;s<i.length;s++)i[s].click(),n.add(i[s]);return t.setSelect(n),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-unselectNet",async e=>{let{netName:r}=e;return t.cancelNetSelect([r]),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-unselectAllNets",async()=>{let e=ze.getAllNets();return t.cancelNetSelect(e),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-highlightNet",async e=>{let{netName:r}=e;return A9.getInstance().highLightNets(new Set([r])),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-unhighlightNet",async e=>{let{netName:r}=e;return A9.getInstance().unhighLightNets(new Set([r])),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-unhighlightAllNets",async()=>{let e=ze.getAllNets();return A9.getInstance().unhighLightNets(new Set(e)),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),!0})}function H$e(o,t){o.messageBus.rpcService("pcb/extensionAPI/pcbprimitive-getPrimitivesBBox",async e=>{let r=[];return e.forEach(i=>{let n=pc(i);n&&n.bbox&&r.push(n.bbox)}),r})}function s_e(o){return{primitiveLock:"locked"}[o]||o}function W$e(o,t){o.messageBus.rpcService("pcb/extensionAPI/arc-create",async e=>{let r=new ve("create arc for api"),{net:i,layerId:n,startX:s,startY:a,endX:l,endY:c,arcAngle:h,lineWidth:u,interactiveMode:d,primitiveLock:p}=e,m=be.getLayer(n),g=new ro,{center:y,radius:b,startAngle:P,endAngle:T,sweep:I}=g.pointToAngle(new S(s/10,a/10),new S(l/10,c/10),Ht.toRadians(h)),C=null;return typeof i<"u"&&m&&m.isSignalLayer()?C=pr.addArcTrack(n,y,b,P,T,I,u/10,!!p,i,d===1?1:2):C=qc.addArc(n,y,b,u/10,P,T,I,!!p,d===1?1:2),r.addCommand(Te.dispatch(C,"add")),je.executeCommand(r),o.publish("hasModifyPcbItem",C),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),{primitiveId:C.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/arc-delete",async e=>{let r=new ve("delete arc for api"),{primitiveIds:i}=e,n=[],s=[],a=new er;for(let l=0;l<i.length;l++){let c=a.getItem(i[l]);c&&(r.addCommand(Te.dispatch(c,"delete")),c.remove(),o.publish("delete",c),s.push(c),n.push(i[l]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/arc-modify",async e=>{let r=new ve("modify arc for api"),{primitiveId:i,data:n}=e,{net:s,layerId:a,startX:l,startY:c,endX:h,endY:u,arcAngle:d,lineWidth:p,interactiveMode:m,primitiveLock:g}=n,b=new er().getItem(i);if(!b)return null;if(b instanceof Si){let E=b;if(r.addCommand(Te.dispatch(E,"modify")),E.net!==s&&(E.net=s),E.layerId!==a)if($e.getInstance().getAllSignalLayerIds().includes(a))E.layerId=a;else return null;if(E.start.x!==l/10){let v=new S(l/10,E.start.y);E.start=v}if(E.start.y!==c/10){let v=new S(E.start.x,c/10);E.start=v}if(E.end.x!==h/10){let v=new S(h/10,E.end.y);E.end=v}if(E.end.y!==u/10){let v=new S(E.end.x,u/10);E.end=v}E.angle!==Ht.toRadians(d)&&(E.angle=Ht.toRadians(d)),E.arcType!==m&&(E.arcType=m),E.width!==p/10&&(E.width=p/10),E.locked!==!!g&&(E.locked=!!g),je.executeCommand(r),o.publish("hasModifyPcbItem",E),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$());let O=E.toJSON(),_=O.center.add(new S(Math.cos(O.startAngle),Math.sin(O.startAngle)).mul(O.radius)),R=O.center.add(new S(Math.cos(O.endAngle),Math.sin(O.endAngle)).mul(O.radius));return{...O,startX:_.x,startY:_.y,endX:R.x,endY:R.y}}let P=b;if(r.addCommand(Te.dispatch(P,"modify")),P.layerId!==a)if($e.getInstance().getAllSignalLayerIds().includes(a))P.layerId=a;else return null;if(P.start.x!==l/10){let E=new S(l/10,P.start.y);P.start=E}if(P.start.y!==c/10){let E=new S(P.start.x,c/10);P.start=E}if(P.end.x!==h/10){let E=new S(h/10,P.end.y);P.end=E}if(P.end.y!==u/10){let E=new S(P.end.x,u/10);P.end=E}P.width!==p/10&&(P.width=p/10),P.locked!==!!g&&(P.locked=!!g),je.executeCommand(r),o.publish("hasModifyPcbItem",P),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$());let T=P.toJSON(),I=T.center.add(new S(Math.cos(T.startAngle),Math.sin(T.startAngle)).mul(T.radius)),C=T.center.add(new S(Math.cos(T.endAngle),Math.sin(T.endAngle)).mul(T.radius));return{...T,startX:I.x,startY:I.y,endX:C.x,endY:C.y}}),o.messageBus.rpcService("pcb/extensionAPI/arc-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=new er;for(let s=0;s<r.length;s++){let a=n.getItem(r[s]);if(!a)continue;let l=a.toJSON(),c=a.center.add(new S(Math.cos(a.startAngle),Math.sin(a.startAngle)).mul(a.radius)),h=a.center.add(new S(Math.cos(a.endAngle),Math.sin(a.endAngle)).mul(a.radius));i.push({...l,arcAngle:Ht.toDegrees(a.angle),startX:c.x*10,startY:c.y*10,endX:h.x*10,endY:h.y*10})}return i}),o.messageBus.rpcService("pcb/extensionAPI/arc-getAll",async e=>{let{net:r,layerId:i,primitiveLock:n}=e,a=pr.getAllItem().filter(l=>l instanceof Si).map(l=>{let c=l.toJSON(),h=l.center.add(new S(Math.cos(l.startAngle),Math.sin(l.startAngle)).mul(l.radius)),u=l.center.add(new S(Math.cos(l.endAngle),Math.sin(l.endAngle)).mul(l.radius));return{...c,arcAngle:Ht.toDegrees(l.angle),startX:h.x*10,startY:h.y*10,endX:u.x*10,endY:u.y*10}});return typeof r<"u"&&(a=ua(a,s_e("net"),r)),typeof i<"u"&&(a=ua(a,s_e("layerId"),i)),typeof n<"u"&&(a=ua(a,s_e("primitiveLock"),n)),a}),o.messageBus.rpcService("pcb/extensionAPI/arc-getAdjacentPrimitives",async e=>new er().getItem(e).searchNode().filter(a=>a.globalIndex!==e).filter(a=>typeof a.toJSON=="function").map(a=>dy(a))),o.messageBus.rpcService("pcb/extensionAPI/arc-getEntireTrack",async e=>[...pr.getItem(e).searchAllConnectNode()].filter(n=>typeof n.toJSON=="function").map(n=>dy(n)))}function z$e(o){return{primitiveLock:"locked"}[o]||o}function Y$e(o){return o.toLowerCase().replace(/\s+/g,"")}function e7(o,t,e){o.attrKeyText[t]!=null?o.attrKeyText[t].value=e:o.modifyATTRMap(t,e)}function Zwt(o,t,e){let r=3;o.layerId==2&&(r=4);let i=ce.getDefaultFontSetting(),n=o.generateValidId(),s=ti.rebuild(n,r,t,!1,e,!1,i.defaultComponentFontTypeface,i.defaultComponentFontHeight,o.rotation,!1,S.ORIGIN,3,i.defaultComponentFontStrokeWidth,!1,0,!1,!0);return o.addAttribute(s),s}function j$e(o,t){o.messageBus.rpcService("pcb/extensionAPI/component-create",async e=>{let{deviceUuid:r,footprintUuid:i,layerId:n,x:s,y:a,rotation:l,primitiveLock:c}=e,h=x.getInstance().compilerChannel;await Ji.add(i,h);let u=await ps.add(r,h);if(!u)return{primitiveId:null};let d=new e2,p=cr(),m=d.build(u.createComponent(p),new S(s/10,a/10));m.visible(),m.layerId=n,m.rotation=Ht.toRadians(l),ao.rotate(m.position,rt.footprintDefault.rotation,[m]),m.locked=c,m.attributes.forEach(y=>{let b=ce.attributeConfig.getAttribute(y.key);b!=null&&(y.showKey=b.showKey,y.showValue=b.showValue)});let g=new ve("draw component");return g.addCommand(Te.dispatch(m,"add")),je.executeCommand(g),o.publish("hasModifyPcbItem",m),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),m.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/component-delete",async e=>{let r=new ve("delete component for API"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=Cr.getItem(i[a]);l&&(r.addCommand(Te.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/component-modify",async e=>{let r=new ve("Modify Component For API"),{primitiveId:i,data:n}=e,{componentData:s={},layerId:a,x:l,y:c,rotation:h,primitiveLock:u,newAddIntoBom:d,designator:p,name:m,uniqueId:g,manufacturer:y,manufacturerId:b,supplier:P,supplierId:T,otherProperty:I}=n,C=Cr.getItem(i),E=1e-10;if(!C)return null;if(r.addCommand(Te.dispatch(C,"modify")),C.layerId!==a)if([1,2].includes(a))C.layerId=a;else return null;if(Math.abs(C.position.x-l/10)>E){let O=new S(l/10,C.position.y);C.position=O}if(Math.abs(C.position.y-c/10)>E){let O=new S(C.position.x,c/10);C.position=O}if(C.rotation!==Ht.toRadians(h)&&(C.rotation=Ht.toRadians(h)),C.locked!==!!u&&(C.locked=!!u),C.attrsMap["Add into BOM"]!==d&&C.modifyATTRMap("Add into BOM",d),C.attrKeyText.Designator.value!==p&&(C.attrKeyText.Designator.value=p),C.attrsMap.Name!==m&&e7(C,"Name",m),C.attrsMap["Unique ID"]!==g&&e7(C,"Unique ID",g),C.attrsMap.Manufacturer!==y&&e7(C,"Manufacturer",y),C.attrsMap["Manufacturer Part"]!==b&&e7(C,"Manufacturer Part",b),C.attrsMap.Supplier!==P&&e7(C,"Supplier",P),C.attrsMap["Supplier Part"]!==T&&e7(C,"Supplier Part",T),typeof I<"u"&&Object.keys(I).length!==0){let O={};for(let _ in C.attrsMap){let R=Y$e(_);O[R]||(O[R]=[]),O[R].push(_)}Object.keys(I).forEach(_=>{let R=Y$e(_),v=O[R];if(v){let D=I[_];v.forEach(w=>{C.attrsMap[w]!==D&&e7(C,w,D)})}else C.modifyATTRMap(_,I[_])})}return je.executeCommand(r),o.publish("hasModifyPcbItem",C),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),C.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/component-getByIds",async e=>{let{primitiveIds:r}=e,i=[];for(let n=0;n<r.length;n++){let s=Cr.getItem(r[n]);if(!s)continue;let a={...s.toJSON(),footprintItemId:s.footprintUUID},l=new S(a.position.x*10,a.position.y*10);a.position=l,a.rotation=Ht.toDegrees(a.rotation),i.push(a)}return i}),o.messageBus.rpcService("pcb/extensionAPI/component-getAll",async e=>{let{layer:r,primitiveLock:i}=e,s=Cr.getAllItem().map(a=>{let l=a.toJSON(),c=new S(l.position.x*10,l.position.y*10);return l.position=c,l.rotation=Ht.toDegrees(l.rotation),{...l,footprintItemId:a.footprintUUID}});return typeof r<"u"&&(s=ua(s,z$e("layerId"),r)),typeof i<"u"&&(s=ua(s,z$e("primitiveLock"),i)),s}),o.messageBus.rpcService("pcb/extensionAPI/component-getAllPinsByPrimitiveId",async e=>{let r=Cr.getItem(e);if(!r)return null;let i=[];return r.getPads().forEach(s=>{let a=s.toJSON();a.padRule=s.model.padRule?s.model.padRule:null,a.holeAspect=s.holeShape?[s.holeShape,(s.holeRadius||0)*2,s.holeLength||0]:null,a.padTypeAspect=s.model.padType,a.defaultPadShapeAspect=uH(s.model),a.specialPadShapeAspect=dH(s.model),a.center=new S(Xe(a.center.x,3,"mil"),Xe(a.center.y,3,"mil")),a.bottomSolderExpansion=Xe(a.bottomSolderExpansion,3,"mil"),a.pasteExpansion=Xe(a.pasteExpansion,3,"mil"),a.topSolderExpansion=Xe(a.topSolderExpansion,3,"mil"),a.rotation=Ht.toDegrees(a.rotation),i.push(a)}),i}),o.messageBus.rpcService("pcb/extensionAPI/component-setAttribute",async e=>{let r=new ve("Set Attribute For API"),{primitiveId:i,visible:n}=e,s=Cr.getItem(i);if(!s)return null;if(r.addCommand(Te.dispatch(s,"modify")),typeof n<"u"){let a=Object.keys(n)[0],l=Object.values(n)[0].value.toString();if(s.attrKeyText[a]==null){let h=Zwt(s,a,l)}let c=s.attrKeyText[a];typeof n[a].keyVisible=="boolean"&&(c.showKey=n[a].keyVisible),typeof n[a].valueVisible=="boolean"&&(c.showValue=n[a].valueVisible)}return je.executeCommand(r),o.publish("hasModifyPcbItem",s),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),s.toJSON()})}function X$e(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function q$e(o,t){o.messageBus.rpcService("pcb/extensionAPI/dimension-create",async e=>{let r=new ve("create dimension for api"),{dimensionType:i,coordinateSet:n,layer:s,unit:a,lineWidth:l,precision:c,primitiveLock:h,textHeight:u}=e,d=null,p,m,g,y,b;if(i==="Length Dimension")m=new S(n[0]/10,n[1]/10),p=new S(n[2]/10,n[3]/10),y=new S(n[4]/10,n[5]/10),g=new S(n[6]/10,n[7]/10),d=Go.addDimension(s,p,y,m,g,c,u?u/10:10,l/10,a,h);else if(i==="Radius Dimension"){y=new S(n[0]/10,n[1]/10),p=new S(n[2]/10,n[3]/10);let P=n[4]/10,T=n[4];d=Uo.addRadius(s,p,y,T,u?u/10:8,P,c,a,h)}else i==="Protractor Dimension"&&(p=new S(n[0]/10,n[1]/10),b=new S(n[2]/10,n[3]/10),y=new S(n[4]/10,n[5]/10),d=is.addProtractor(s,l/10,u?u/10:4.5,c,b,p,y,h));return r.addCommand(Te.dispatch(d,"add")),je.executeCommand(r),o.publish("hasModifyPcbItem",d),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),{primitiveId:d?d.model.globalIndex:void 0}}),o.messageBus.rpcService("pcb/extensionAPI/dimension-delete",async e=>{let r=new ve("delete dimension for api"),{primitiveIds:i}=e,n=[],s=[],a=new er;for(let l=0;l<i.length;l++){let c=a.getItem(i[l]);c&&(r.addCommand(Te.dispatch(c,"delete")),c.remove(),o.publish("delete",c),s.push(c),n.push(i[l]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/dimension-modify",async e=>{let r=new ve("modify dimension for api"),{primitiveId:i,data:n}=e,{dimensionType:s,coordinateSet:a,layerId:l,unit:c,lineWidth:h,precision:u,primitiveLock:d}=n,m=new er().getItem(i);if(!m)return null;if(m instanceof ca){if(r.addCommand(Te.dispatch(m,"modify")),typeof l<"u")if(Zn.abstractDimension().some(y=>y.value===l))m.layerId=l;else return null;typeof h<"u"&&(m.width=h/10),typeof u<"u"&&(m.precision=u),typeof d<"u"&&(m.locked=d),typeof c<"u"&&(m.unit=c),typeof a<"u"&&(m.left=new S(a[0]/10,a[1]/10),m.start=new S(a[2]/10,a[3]/10),m.end=new S(a[4]/10,a[5]/10),m.right=new S(a[6]/10,a[7]/10))}else m instanceof xa?(r.addCommand(Te.dispatch(m,"modify")),typeof l<"u"&&(m.layerId=l),typeof h<"u"&&(m.width=h/10),typeof u<"u"&&(m.precision=u),typeof d<"u"&&(m.locked=d),typeof c<"u"&&(m.unit=c),typeof a<"u"&&(m.end=new S(a[0]/10,a[1]/10),m.start=new S(a[2]/10,a[3]/10),m.textPosition=new S(a[4]/10,a[5]/10))):m instanceof ol&&(r.addCommand(Te.dispatch(m,"modify")),typeof l<"u"&&(m.layerId=l),typeof h<"u"&&(m.width=h/10),typeof u<"u"&&(m.precision=u),typeof d<"u"&&(m.locked=d),typeof a<"u"&&(m.start=new S(a[0]/10,a[1]/10),m.center=new S(a[2]/10,a[3]/10),m.end=new S(a[4]/10,a[5]/10)));return je.executeCommand(r),o.publish("hasModifyPcbItem",m),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),m.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/dimension-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=new er;for(let s=0;s<r.length;s++){let a=n.getItem(r[s]);if(!a)continue;let l=a.toJSON();l.width=l.width*10,i.push({...l,dimensionType:a.type,coordinateSet:a.type==="Length Dimension"?Mme(a):a.type==="Radius Dimension"?Lme(a):Nme(a),unit:x.getInstance().unit})}return i}),o.messageBus.rpcService("pcb/extensionAPI/dimension-getAll",async e=>{let{layer:r,primitiveLock:i}=e,n=Go.getAllItem(),s=Uo.getAllItem(),a=is.getAllItem(),l=[].concat(n,s,a).map(c=>{let h=c.toJSON();return h.width=h.width*10,{...h,dimensionType:c.type,coordinateSet:c.type==="Length Dimension"?Mme(c):c.type==="Radius Dimension"?Lme(c):Nme(c),unit:x.getInstance().unit}});return typeof r<"u"&&(l=ua(l,X$e("layer"),r)),typeof i<"u"&&(l=ua(l,X$e("primitiveLock"),i)),l})}function eS(o,t,e,r,i,n,s,a=!1){let l=o;if(r=wu(r,e,t),s=s[0]instanceof Array?s:[s],s.length==1&&s[0].length==0)return;let c=new Array;for(let u of s)if(u[0]=="CIRCLE"||u[0]=="C"){let d=new S(parseFloat(u[1])/10,parseFloat(u[2])/10),p=parseFloat(u[3])/10;return a?zi.getInstance().addCircle(l,t,e,d,p,n,i,r):new $p(l,t,e,d,p,n,i,r,null,null)}else if(u[0]=="R"){let d=new S(parseFloat(u[1])/10,parseFloat(u[2])/10),p=parseFloat(u[3])/10,m=parseFloat(u[4])/10,g=parseFloat(u[5])/180*Math.PI;isNaN(g)&&(g=0);let y;return this.version<"1.5"?y=Math.min(p,m)/2*(parseFloat(u[6])||0):y=(parseFloat(u[6])||0)/10,a?rn.getInstance().addRect(l,t,e,d,p,m,r,i,n,g,y):new Zp(l,t,e,d,p,m,g,y,r,n,i,null,null)}else{let d=new S(parseFloat(u[0])/10,parseFloat(u[1])/10),p=new ro,m=new On,g=!1,y={layerId:e,strokeWidth:n,locked:i};for(let T=2,I=u.length;T<I;)if(u[T]=="L"){let C=new S(parseFloat(u[T+1])/10,parseFloat(u[T+2])/10),E=cr(),O=new ih(E,d,C,y);m.addLast(O),d=C,T+=3,g=!0}else if(u[T]=="ARC"||u[T]=="CARC"){g=!1;let C=parseFloat(u[T+1])/180*Math.PI,E=new S(parseFloat(u[T+2])/10,parseFloat(u[T+3])/10);if(ne.greater(Ht.regular(C),0)&&!d.equals1(E)){let{center:O,radius:_,startAngle:R,endAngle:v,sweep:D}=p.pointToAngle(d,E,C),w=null;u[T]=="ARC"?w=1:w=2;let F=cr(),H=new yh(F,O,_,R,v,D,y,w);m.addLast(H)}d=E,T+=4}else if(g){let C=new S(parseFloat(u[T])/10,parseFloat(u[T+1])/10),E=cr(),O=new ih(E,d,C,y);m.addLast(O),d=C,T+=2}let b=m.toArray();m.clear();let P=0;for(let T of b)if(P+=T.length,P>1e-8)break;if(P<1e-8||e!=11&&pd(t)&&!xu(b.map(T=>T.primitive),1e-4)){for(let T of b)T.remove();return null}b.length>0&&c.push(b)}let h=a?Mi.getInstance().addPolygon(l,t,e,c,n,r,i,null,null):new Jp(l,t,e,c,n,r,i,null,null);return h.type=="Board Outline"&&!h.isClose()&&(h.type="Line"),h}function a_e(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function Vme(){let o=pt.getAllItem().filter(r=>r.type==="Fill Region"||r.type==="Slot Region"),t=Xt.getAllItem().filter(r=>r.type==="Fill Region"||r.type==="Slot Region"),e=Zt.getAllItem().filter(r=>r.type==="Fill Region"||r.type==="Slot Region");return[].concat(o,t,e).filter(r=>!r.getParent())}function l_e(o){let t,e=o.getSelects();return e.length===1&&e[0]instanceof Le&&(t=e[0].globalIndex),new ln(t)}function $$e(o,t,e){let r=null;if(e.modelType==="Circle")t!==12&&(e.component=l_e(o)),r=Zt.addCircleByModel(e);else if(e.modelType==="Rect")t!==12&&(e.component=l_e(o)),r=Xt.addRectByModel(e);else if(e.modelType==="Polygon"){t!==12&&(e.component=l_e(o));let i=new Array;for(let n of e.childrens){let s=new Array;for(let a of n)s.push($c(a));i.push(s)}r=pt.addPolygonByModel(e,i)}return r}function Jwt(o,t){if(o.length!==t.length)return!1;for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}function Gme(o,t){t&&o.publish("hasModifyPcbItem",t),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}function K$e(o,t){o.messageBus.rpcService("pcb/extensionAPI/fill-create",async e=>{let r=new ve("create fill for api"),{layer:i,complexPolygon:n,net:s,lineWidth:a,primitiveLock:l}=e,c=cr(),h=eS(c,i==12?"Slot Region":"Fill Region",i,s,!!l,a/10,n,!0),u=$$e(t,i,h);return r.addCommand(Te.dispatch(u,"add")),je.executeCommand(r),Gme(o,u),{primitiveId:u.globalIndex,lineWidth:u.strokeWidth*10}}),o.messageBus.rpcService("pcb/extensionAPI/fill-delete",async e=>{let r=new ve("delete fill for api"),{primitiveIds:i}=e,n=[],s=[],a=new er;for(let l=0;l<i.length;l++){let c=a.getItem(i[l]);c&&(r.addCommand(Te.dispatch(c,"delete")),c.remove(),o.publish("delete",c),s.push(c),n.push(i[l]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/fill-modify",async e=>{let r=new ve("modify fill for api"),{primitiveId:i,data:n}=e,{layerId:s,polygonSource:a,net:l,lineWidth:c,primitiveLock:h}=n,u=Vme(),p=u.map(b=>b.globalIndex).indexOf(i);if(p<=-1)return;let m=u[p],g=py(m);if(!Jwt(g[0],a)){let b=new ve("modify shape for fill api");t.clearSelect(),b.addCommand(Te.dispatch(m,"delete")),t.setSelect([m]),o.publish("removeSelect","");let P=eS(i,s==12?"Slot Region":"Fill Region",s,l,!!h,c/10,a,!0);if(P.modelType=="Circle"||P.modelType=="Rect"||P.modelType=="Polygon"){let T=$$e(t,s,P);return b.addCommand(Te.dispatch(T,"add")),je.executeCommand(b),Gme(o,T),{primitiveId:T.globalIndex,lineWidth:T.strokeWidth*10}}else return null}if(r.addCommand(Te.dispatch(m,"modify")),typeof s<"u")if(Zn.fixLayerOptions(s,Zn.createLayerOptionsByLineloop(m)).some(P=>P.value===s))m.layerId=s;else return null;typeof l<"u"&&(m.net=l),m.strokeWidth!==c/10&&(m.strokeWidth=c/10),typeof h<"u"&&(m.locked=!!h),je.executeCommand(r),Gme(o,m);let y=m.toJSON();return y.polygonSource=a,delete y.componentData,delete y.silkColor,y}),o.messageBus.rpcService("pcb/extensionAPI/fill-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=Vme(),s=n.map(a=>a.globalIndex);for(let a=0;a<r.length;a++){let l=s.indexOf(r[a]);if(l<=-1)continue;let c=n[l],h=c.toJSON();delete h.componentData,delete h.shapes,delete h.silkColor;let u=py(c);h.path=u,h.strokeWidth=h.strokeWidth*10,i.push(h)}return i}),o.messageBus.rpcService("pcb/extensionAPI/fill-getAll",async e=>{let{layer:r,net:i,primitiveLock:n}=e,s=Vme(),a=s.map(l=>{let c=l.toJSON();return{...c,strokeWidth:c.strokeWidth*10}});for(let l=0;l<a.length;l++)a[l].path=py(s[l]),delete a[l].componentData,delete a[l].shapes,delete a[l].silkColor;return typeof r<"u"&&(a=ua(a,a_e("layer"),r)),typeof i<"u"&&(a=ua(a,a_e("net"),i)),typeof n<"u"&&(a=ua(a,a_e("primitiveLock"),n)),a}),o.messageBus.rpcService("pcb/extensionAPI/fill-convertToType",async e=>{let r=new ve("modify type for fill api"),{primitiveId:i,type:n}=e,s=Vme(),l=s.map(u=>u.globalIndex).indexOf(i);if(l<=-1)return;let c=s[l];r.addCommand(Te.dispatch(c,"modify"));let h=c.toJSON();return n=="line"?c.type="Line":n=="copper"?(c.type="Copper Region",h.copperInfo=c.component.toJSON(),gn.addOrder(c,r),h.pourPriority=gn.getOrder(c.globalIndex)+1):n=="region"&&(c.type="Prohibited Region"),delete h.componentData,delete h.silkColor,je.executeCommand(r),Gme(o,c),h})}function Z$e(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function J$e(o,t){o.messageBus.rpcService("pcb/extensionAPI/image-create",async e=>{let r=new ve("create image for api"),{x:i,y:n,complexPolygon:s,layer:a,width:l,height:c,rotation:h,horizonMirror:u,primitiveLock:d}=e,p=vu(s),m=Ln.addImage(a,new S(i/10,n/10),l/10,c/10,Ht.toRadians(h),u,d,p);return r.addCommand(Te.dispatch(m,"add")),je.executeCommand(r),o.publish("hasModifyPcbItem",m),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),{primitiveId:m.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/image-delete",async e=>{let r=new ve("delete image for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=Ln.getItem(i[a]);l&&(r.addCommand(Te.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/image-modify",async e=>{let r=new ve("modify image for api"),{primitiveId:i,data:n}=e,{x:s,y:a,complexPolygon:l,layerId:c,width:h,height:u,rotation:d,horizonMirror:p,primitiveLock:m}=n,g=Ln.getItem(i),y=1e-10;if(!g)return null;if(r.addCommand(Te.dispatch(g,"modify")),Math.abs(g.start.x-s/10)>y){let b=new S(s/10,g.start.y);g.start=b}if(Math.abs(g.start.y-a/10)>y){let b=new S(g.start.x,a/10);g.start=b}if(typeof c<"u")if(Zn.image().some(P=>P.value===c))g.layerId=c;else return null;return g.width!==h/10&&(g.width=h/10),g.height!==u/10&&(g.height=u/10),g.rotation!==Ht.toRadians(d)&&(g.rotation=Ht.toRadians(d)),typeof p<"u"&&(g.mirror=p),typeof m<"u"&&(g.locked=!!m),je.executeCommand(r),o.publish("hasModifyPcbItem",g),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),g.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/image-getByIds",async e=>{let{primitiveIds:r}=e,i=[];for(let n=0;n<r.length;n++){let s=Ln.getItem(r[n]);if(!s)continue;let a=s.toJSON(),l=s.model.modelType==="Image"?"Image":"Picture",c=s instanceof Yn?TP(s.getRealPath()).join(" "):"";a.imageType=l,a.pathString=c,a.start=new S(a.start.x*10,a.start.y*10),a.height=a.height*10,a.width=a.width*10,a.rotation=Ht.toDegrees(a.rotation),i.push(a)}return i}),o.messageBus.rpcService("pcb/extensionAPI/image-getAll",async e=>{let{layer:r,primitiveLock:i}=e,n=Ln.getAllItem(),s=_o.getAllItem(),a=[].concat(n,s).map(l=>({...l.toJSON(),start:new S(l.start.x*10,l.start.y*10),height:l.height*10,width:l.width*10,rotation:Ht.toDegrees(l.rotation),imageType:l.model.modelType==="Image"?"Image":"Picture",pathString:l instanceof Yn?TP(l.getRealPath()).join(" "):""}));return typeof r<"u"&&(a=ua(a,Z$e("layer"),r)),typeof i<"u"&&(a=ua(a,Z$e("primitiveLock"),i)),a})}function Q$e(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function eKe(o,t){o.messageBus.rpcService("pcb/extensionAPI/object-create",async e=>{let r=new ve("create object for api"),{layer:i,topLeftX:n,topLeftY:s,binaryData:a,width:l,height:c,rotation:h,mirror:u,fileName:d,primitiveLock:p}=e,m=x.getInstance().compiler.uploadBlob(d,a);if(!m.success)return;let g=m.hash;if(!Yd.getItem(g)){let P=new Image;P.src=a,Yd.addTemplate(g,d,P)}let b=_o.addImage(i,new S(n/10,s/10),l/10,c/10,Ht.toRadians(h),u,p,g);return r.addCommand(Te.dispatch(b,"add")),je.executeCommand(r),o.publish("hasModifyPcbItem",b),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),{primitiveId:b.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/object-delete",async e=>{let r=new ve("delete object for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=_o.getItem(i[a]);l&&(r.addCommand(Te.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/object-modify",async e=>{let r=new ve("modify object for api"),{primitiveId:i,data:n}=e,{topLeftX:s,topLeftY:a,layerId:l,width:c,height:h,rotation:u,mirror:d,primitiveLock:p}=n,m=_o.getItem(i),g=1e-10;if(!m)return null;if(r.addCommand(Te.dispatch(m,"modify")),Math.abs(m.start.x-s/10)>g){let y=new S(s/10,m.start.y);m.start=y}if(Math.abs(m.start.y-a/10)>g){let y=new S(m.start.x,a/10);m.start=y}if(typeof l<"u")if(Zn.trueColorImage().some(b=>b.value===l))m.layerId=l;else return null;return m.width!==c/10&&(m.width=c/10),m.height!==h/10&&(m.height=h/10),m.rotation!==Ht.toRadians(u)&&(m.rotation=Ht.toRadians(u)),typeof d<"u"&&(m.mirror=d),typeof p<"u"&&(m.locked=!!p),je.executeCommand(r),o.publish("hasModifyPcbItem",m),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),m.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/object-getByIds",async e=>{let{primitiveIds:r}=e,i=[];for(let n=0;n<r.length;n++){let s=_o.getItem(r[n]);if(!s)continue;let a=s.toJSON(),l="Picture",c="";a.imageType=l,a.pathString=c,a.start=new S(a.start.x*10,a.start.y*10),a.height=a.height*10,a.width=a.width*10,a.rotation=Ht.toDegrees(a.rotation),i.push(a)}return i}),o.messageBus.rpcService("pcb/extensionAPI/object-getAll",async e=>{let{layer:r,primitiveLock:i}=e,s=_o.getAllItem().map(a=>({...a.toJSON(),start:new S(a.start.x*10,a.start.y*10),height:a.height*10,width:a.width*10,rotation:Ht.toDegrees(a.rotation),imageType:"Picture",pathString:""}));return typeof r<"u"&&(s=ua(s,Q$e("layer"),r)),typeof i<"u"&&(s=ua(s,Q$e("primitiveLock"),i)),s})}function tKe(o){return{Divergent:0,"Direct-connected":1,"Non-connected":2}[o]}function Qwt(o){return/^\d+$/.test(o)?o:o.replace(/-/g,"").toUpperCase()}function rKe(o,t){o.messageBus.rpcService("pcb/extensionAPI/pad-create",async e=>{let r=new ve("create pads for api"),{layer:i,padNumber:n,x:s,y:a,rotation:l,pad:c,net:h,hole:u,holeOffsetX:d,holeOffsetY:p,holeRotation:m,metallization:g,padType:y,specialPad:b,solderMaskAndPasteMaskExpansion:P,heatWelding:T,primitiveLock:I}=e,C=c[0],E=c[1],O=c[2],_=C==="RECT"?c[3]/100:null,R=u?u[0]:null,v=null,D=null;u&&(u[0]==="ROUND"?(v=null,D=u[1]/2/10):(D=u[1]/2/10,v=u[2]/10));let w=P?2:1,F=P?(P==null?void 0:P.topPasteMask)/10:null,H=P?(P==null?void 0:P.topSolderMask)/10:null,z=P?(P==null?void 0:P.bottomSolderMask)/10:null,G=T?T==null?void 0:T.divergenceAngle:null,W=T?T==null?void 0:T.divergenceLineWidth:null,L=T?T==null?void 0:T.divergenceSpacing:null,B=T?T==null?void 0:T.connectionMethod:null,N;G||W||L||B?N=_f.buildByJson({lineAngle:Ht.toRadians(G),lineWidth:W/10,lineClearance:L/10,connectMode:tKe(B)}):N=null;let U=Kt.addPad(+i,1,n,new S(s/10,a/10),C,E/10,O/10,_!==null?_:E/10/2,C,E/10,O/10,_!==null?_:E/2,C,E/10,O/10,_!==null?_:E/10/2,Ht.toRadians(l),I,h,w,F,H,z,[],g,v,D,R,Ht.toRadians(m),new S(d/10,p/10),N,y);return U.num=Qwt(n),r.addCommand(Te.dispatch(U,"add")),je.executeCommand(r),o.publish("hasModifyPcbItem",U),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),{primitiveId:U.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/pad-delete",async e=>{let r=new ve("delete Pads for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=Kt.getItem(i[a]);l&&(r.addCommand(Te.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/pad-modify",async e=>{let r=new ve("modify pads for api"),{primitiveId:i,data:n}=e,{layerId:s,padNumber:a,x:l,y:c,rotation:h,pad:u,net:d,hole:p,holeOffsetX:m,holeOffsetY:g,holeRotation:y,metallization:b,padFunction:P,specialPad:T,solderMaskAndPasteMaskExpansion:I,heatWelding:C,primitiveLock:E}=n,O=u[0],_=u[1],R=u[2],v=O==="RECT"?u[3]/100:0,D=p?p[0]:null,w=null,F=null;p&&(p[0]==="ROUND"?(w=null,F=p[1]/2/10):(F=p[1]/2/10,w=p[2]/10));let H=I?I==null?void 0:I.topPasteMask:null,z=I?I==null?void 0:I.bottomPasteMask:null,G=H||z,W=I?I==null?void 0:I.topSolderMask:null,L=I?I==null?void 0:I.bottomSolderMask:null,B=C?C==null?void 0:C.divergenceAngle:null,N=C?C==null?void 0:C.divergenceLineWidth:null,U=C?C==null?void 0:C.divergenceSpacing:null,k=C?C==null?void 0:C.connectionMethod:null,V=Kt.getItem(i);if(!V)return null;if(r.addCommand(Te.dispatch(V,"modify")),typeof d<"u"&&(V.net=d),typeof l<"u"){let Y=new S(l/10,V.center.y);V.center=Y}if(typeof c<"u"){let Y=new S(V.center.x,c/10);V.center=Y}return typeof h<"u"&&(V.rotation=Ht.toRadians(h)),typeof s<"u"&&(V.layerId=+s),typeof a<"u"&&(V.num=a),typeof u<"u"&&(+s===1?V.top=$o.getStyle(O,_,R,v,null):+s===2?V.bottom=$o.getStyle(O,_,R,v,null):(V.top=$o.getStyle(O,_,R,v,null),V.bottom=$o.getStyle(O,_,R,v,null),V.inner=$o.getStyle(O,_,R,v,null))),typeof _<"u"&&(V.topWidth=_/10,V.innerWidth=_/10,V.bottomWidth=_/10),typeof R<"u"&&(V.topHeight=R/10,V.innerHeight=R/10,V.bottomHeight=R/10),typeof p<"u"&&(V.hole=new xx(w||V.holeLength,F||V.holeRadius,D||V.holeShape,y?Ht.toRadians(y):V.holeRotation,new S(m/10||V.holeOffset.x,g/10||V.holeOffset.y))),typeof C<"u"&&(V.padRule=_f.buildByJson({lineAngle:Ht.toRadians(B),lineWidth:N/10,lineClearance:U/10,connectMode:tKe(k)})),typeof I<"u"&&(V.padExpansion=new qB(2,G/10||V.pasteExpansion,W/10||V.topSolderExpansion,L/10||V.bottomSolderExpansion)),typeof E<"u"&&(V.locked=!!E),typeof b<"u"&&(V.plated=b),je.executeCommand(r),o.publish("hasModifyPcbItem",V),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),V.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/pad-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=new er;for(let s=0;s<r.length;s++){let a=n.getItem(r[s]);if(!a)continue;let l=a.toJSON();l.padRule=a.model.padRule?a.model.padRule:null;let c=null;a.holeShape==="ROUND"?c=[a.holeShape,(a.holeRadius*10||0)*2]:a.holeShape=="SLOT"&&(c=[a.holeShape,(a.holeRadius*10||0)*2,a.holeLength*10||0]),l.holeAspect=c,l.padTypeAspect=a.model.padType,l.defaultPadShapeAspect=uH(a.model),l.specialPadShapeAspect=dH(a.model),i.push(l)}return i}),o.messageBus.rpcService("pcb/extensionAPI/pad-getAll",async e=>Kt.getAllItem().map(n=>{let s=null;return n.holeShape==="ROUND"?s=[n.holeShape,(n.holeRadius*10||0)*2]:n.holeShape=="SLOT"&&(s=[n.holeShape,(n.holeRadius*10||0)*2,n.holeLength*10||0]),{...n.toJSON(),padRule:n.model.padRule?n.model.padRule:null,holeAspect:s,padTypeAspect:n.model.padType,defaultPadShapeAspect:uH(n.model),specialPadShapeAspect:dH(n.model)}})),o.messageBus.rpcService("pcb/extensionAPI/pad-getConnectedPrimitives",async e=>Kt.getItem(e).searchNode().filter(s=>s.globalIndex!==e).filter(s=>typeof s.toJSON=="function").map(s=>dy(s)))}function c_e(o){return{primitiveLock:"locked"}[o]||o}function h_e(){let o=pt.getAllItem().filter(r=>r.type==="Line"||r.type==="Board Outline"),t=Xt.getAllItem().filter(r=>r.type==="Line"||r.type==="Board Outline"),e=Zt.getAllItem().filter(r=>r.type==="Line"||r.type==="Board Outline");return[].concat(o,t,e)}function eLt(o){let t=pt.getItem(o),e=Xt.getItem(o),r=Zt.getItem(o);if(t)return t;if(e)return e;if(r)return r}function iKe(o){let t=null;if(o.modelType==="Circle")t=Zt.addCircleByModel(o);else if(o.modelType==="Line")t=$u.addByModel(o);else if(o.modelType==="Rect")t=Xt.addRectByModel(o);else if(o.modelType==="Polygon"){let e=new Array;for(let r of o.childrens){let i=new Array;for(let n of r)i.push($c(n));e.push(i)}t=pt.addPolygonByModel(o,e)}return t}function tLt(o,t){if(o.length!==t.length)return!1;for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}function Ume(o,t){t&&o.publish("hasModifyPcbItem",t),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}function nKe(o,t){o.messageBus.rpcService("pcb/extensionAPI/polylines-create",async e=>{let r=new ve("create polyline for api"),{net:i,layerId:n,polygonSource:s,lineWidth:a,primitiveLock:l}=e,c=cr(),h=eS(c,"Line",n,i,!!l,a/10,s,!0),u=iKe(h);return r.addCommand(Te.dispatch(u,"add")),je.executeCommand(r),Ume(o,u),{primitiveId:u.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/polylines-delete",async e=>{let r=new ve("delete polyline for api"),{primitiveIds:i}=e,n=[],s=[],a=new er;for(let l=0;l<i.length;l++){let c=a.getItem(i[l]);c&&(r.addCommand(Te.dispatch(c,"delete")),c.remove(),o.publish("delete",c),s.push(c),n.push(i[l]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/polylines-modify",async e=>{let r=new ve("modify polyline for api"),{primitiveId:i,data:n}=e,{net:s,layerId:a,polygonSource:l,lineWidth:c,primitiveLock:h}=n,u=cr(),d=eLt(i);if(!d)return null;let p=py(d);if(!tLt(p[0],l)){let m=new ve("modify shape for polyline api");t.clearSelect(),m.addCommand(Te.dispatch(d,"delete")),t.setSelect([d]),o.publish("removeSelect","");let g=eS(u,"Line",a,s,!!h,c/10,l,!0);if(g.modelType=="Circle"||g.modelType=="Rect"||g.modelType=="Polygon"||g.modelType==="Line"){let y=iKe(g);return m.addCommand(Te.dispatch(y,"add")),je.executeCommand(m),Ume(o,y),{primitiveId:y.globalIndex}}else return null}if(r.addCommand(Te.dispatch(d,"modify")),typeof s<"u"&&(d.net=s),typeof a<"u")if(Zn.fixLayerOptions(a,Zn.createLayerOptionsByLineloop(d)).some(g=>g.value===a))d.layerId=a;else return null;return d.strokeWidth!==c/10&&(d.strokeWidth=c/10),typeof h<"u"&&(d.locked=!!h),je.executeCommand(r),Ume(o,d),d.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/polylines-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=h_e(),s=n.map(a=>a.globalIndex);for(let a=0;a<r.length;a++){let l=s.indexOf(r[a]);if(l<=-1)continue;let c=n[l],h=c.toJSON();delete h.componentData,delete h.shapes;let u=py(c);h.path=u,h.strokeWidth=h.strokeWidth*10,i.push(h)}return i}),o.messageBus.rpcService("pcb/extensionAPI/polylines-getAll",async e=>{let{net:r,layerId:i,primitiveLock:n}=e,s=h_e().filter(l=>!l.getParent()),a=s.map(l=>{let c=l.toJSON();return{...c,strokeWidth:c.strokeWidth*10}});typeof r<"u"&&(a=ua(a,c_e("net"),r)),typeof i<"u"&&(a=ua(a,c_e("layerId"),i)),typeof n<"u"&&(a=ua(a,c_e("primitiveLock"),n));for(let l=0;l<a.length;l++)delete a[l].componentData,delete a[l].shapes,a[l].path=py(s[l]);return a}),o.messageBus.rpcService("pcb/extensionAPI/polylines-convertToType",async e=>{let r=new ve("modify type for polyline api"),{primitiveId:i,type:n}=e,s=h_e(),l=s.map(u=>u.globalIndex).indexOf(i);if(l<=-1)return;let c=s[l];r.addCommand(Te.dispatch(c,"modify"));let h=c.toJSON();return n=="fill"?c.type="Fill Region":n=="copper"?(c.type="Copper Region",h.copperInfo=c.component.toJSON(),gn.addOrder(c,r),h.pourPriority=gn.getOrder(c.globalIndex)+1):n=="region"&&(c.type="Prohibited Region"),delete h.componentData,delete h.silkColor,je.executeCommand(r),Ume(o,c),h})}function u_e(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function Hme(){let o=pt.getAllItem().filter(r=>r.type==="Copper Region"),t=Xt.getAllItem().filter(r=>r.type==="Copper Region"),e=Zt.getAllItem().filter(r=>r.type==="Copper Region");return[].concat(o,t,e)}function d_e(o,t,e,r){let i=Ei.nameManager.getNum(r||"pour1");Ei.nameManager.add(i);let{style:n,gridLineWidth:s,clearance:a,keepIsland:l,optimization:c,optimizationValue:h}=Tm.fillComponent,u=gn.getNextOrders4Layer(o);return new Vn(t||n,s,a,e||l,c,i,u,h)}function oKe(o,t,e,r){let i=null;if(o.modelType==="Circle")o.component=d_e(o.layerId,t,e,r),i=Zt.addCircleByModel(o);else if(o.modelType==="Rect")o.component=d_e(o.layerId,t,e,r),i=Xt.addRectByModel(o);else if(o.modelType==="Polygon"){o.component=d_e(o.layerId,t,e,r);let n=new Array;for(let s of o.childrens){let a=new Array;for(let l of s)a.push($c(l));n.push(a)}i=pt.addPolygonByModel(o,n)}return i}function rLt(o,t){if(o.length!==t.length)return!1;for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}function Wme(o,t){t&&o.publish("hasModifyPcbItem",t),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}function zme(o){return gn.getNextOrders4Layer(o.layerId)}function sKe(o,t){o.messageBus.rpcService("pcb/extensionAPI/copper-create",async e=>{let r=new ve("create pour for api"),{net:i,layer:n,complexPolygon:s,pourFillMethod:a,preserveSilos:l,pourName:c,pourPriority:h,lineWidth:u,primitiveLock:d}=e,p=cr(),m=eS(p,"Copper Region",n,i,!!d,u/10,s,!0),g=oKe(m,a,l,c);h&&gn.setOrder(g,h,r);let y=zme(g);return r.addCommand(Te.dispatch(g,"add")),je.executeCommand(r),Wme(o,g),{primitiveId:g.globalIndex,pourName:g.component.name,pourPriority:y,lineWidth:g.strokeWidth*10}}),o.messageBus.rpcService("pcb/extensionAPI/copper-delete",async e=>{let r=new ve("delete pour for api"),{primitiveIds:i}=e,n=[],s=[],a=new er;for(let l=0;l<i.length;l++){let c=a.getItem(i[l]);c&&(r.addCommand(Te.dispatch(c,"delete")),c.remove(),o.publish("delete",c),s.push(c),n.push(i[l]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/copper-modify",async e=>{let r=new ve("modify pour for api"),{primitiveId:i,data:n}=e,{net:s,layerId:a,polygonSource:l,pourFillMethod:c,preserveSilos:h,pourName:u,pourPriority:d,lineWidth:p,primitiveLock:m}=n,g=Hme(),b=g.map(C=>C.globalIndex).indexOf(i);if(b<=-1)return;let P=g[b],T=py(P);if(!rLt(T[0],l)){let C=new ve("modify shape for pour api");t.clearSelect(),C.addCommand(Te.dispatch(P,"delete")),t.setSelect([P]),o.publish("removeSelect","");let E=eS(i,"Copper Region",a,s,!!m,p/10,l,!0);if(E.modelType=="Circle"||E.modelType=="Rect"||E.modelType=="Polygon"){let O=oKe(E,c,h,u);d&&gn.setOrder(O,d,r);let _=zme(O);return C.addCommand(Te.dispatch(O,"add")),je.executeCommand(C),Wme(o,O),{primitiveId:O.globalIndex,pourName:O.component.name,pourPriority:_,lineWidth:O.strokeWidth*10}}else return null}if(r.addCommand(Te.dispatch(P,"modify")),P.net!==s&&(P.net=s),P.layerId!==a)if(Zn.fixLayerOptions(a,Zn.createLayerOptionsByLineloop(P)).some(E=>E.value===a))P.layerId=a;else return null;if(typeof c<"u"){let C=P.component;C.style=c}if(typeof h<"u"){let C=P.component;C.keepIsland=h}if(typeof u<"u"){let C=P.component;C.name=u}typeof d<"u"&&gn.setOrder(P,d,r),P.strokeWidth!==p/10&&(P.strokeWidth=p/10),typeof m<"u"&&(P.locked=!!m),je.executeCommand(r),Wme(o,P);let I=P.toJSON();return I.polygonSource=l,delete I.componentData,delete I.silkColor,I}),o.messageBus.rpcService("pcb/extensionAPI/copper-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=Hme(),s=n.map(a=>a.globalIndex);for(let a=0;a<r.length;a++){let l=s.indexOf(r[a]);if(l<=-1)continue;let c=n[l],h=c.toJSON();delete h.componentData,delete h.shapes,delete h.silkColor;let u=py(c);h.path=u,h.copperInfo=c.component.toJSON();let d=gn.getOrder(c.globalIndex);d||(d=zme(c)),h.pourPriority=d,h.strokeWidth=h.strokeWidth*10,i.push(h)}return i}),o.messageBus.rpcService("pcb/extensionAPI/copper-getCopperRegion",async e=>{let{primitiveId:r}=e;return Ei.getAllItem().filter(s=>s.getParent().globalIndex===r).map(s=>({...s.toJSON(),pourPrimitiveId:s.getParent().globalIndex}))}),o.messageBus.rpcService("pcb/extensionAPI/copper-getAll",async e=>{let{layer:r,net:i,primitiveLock:n}=e,s=Hme(),a=s.map(l=>{let c=l.toJSON();return{...c,strokeWidth:c.strokeWidth*10}});for(let l=0;l<a.length;l++){a[l].path=py(s[l]),a[l].copperInfo=s[l].component.toJSON();let c=gn.getOrder(s[l].globalIndex);c||(c=zme(s[l])),a[l].pourPriority=c,delete a[l].componentData,delete a[l].shapes,delete a[l].silkColor}return typeof r<"u"&&(a=ua(a,u_e("layer"),r)),typeof i<"u"&&(a=ua(a,u_e("net"),i)),typeof n<"u"&&(a=ua(a,u_e("primitiveLock"),n)),a}),o.messageBus.rpcService("pcb/extensionAPI/copper-convertToType",async e=>{let r=new ve("modify type for pour api"),{primitiveId:i,type:n}=e,s=Hme(),l=s.map(u=>u.globalIndex).indexOf(i);if(l<=-1)return;let c=s[l];r.addCommand(Te.dispatch(c,"modify"));let h=c.toJSON();return n=="line"?c.type="Line":n=="fill"?c.type="Fill Region":n=="region"&&(c.type="Prohibited Region"),delete h.componentData,delete h.silkColor,je.executeCommand(r),Wme(o,c),h})}function rL(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function Yme(){let o=pt.getAllItem().filter(r=>r.type==="Constraint Region"||r.type==="Prohibited Region"),t=Xt.getAllItem().filter(r=>r.type==="Constraint Region"||r.type==="Prohibited Region"),e=Zt.getAllItem().filter(r=>r.type==="Constraint Region"||r.type==="Prohibited Region");return[].concat(o,t,e)}function jme(o){let t={device:!1,track:!1,copper:!1,fill:!1,planzone:!1,constraintRegion:!1};return o&&o.forEach(e=>{switch(e){case 2:t.device=!0;break;case 6:t.fill=!0;break;case 5:t.track=!0;break;case 7:t.copper=!0;break;case 8:t.planzone=!0;break;case 9:t.constraintRegion=!0;break}}),t}function aKe(o,t,e){let r=null;if(o.modelType==="Circle")t.constraintRegion?(e&&(o.component=new nu(e)),r=Zt.addCircleByModel(o)):(o.component=new fd(t.device,t.track,t.copper,t.fill,t.planzone),r=Zt.addCircleByModel(o));else if(o.modelType==="Rect")t.constraintRegion?(e&&(o.component=new nu(e)),r=Xt.addRectByModel(o)):(o.component=new fd(t.device,t.track,t.copper,t.fill,t.planzone),r=Xt.addRectByModel(o));else if(o.modelType==="Polygon"){let i=new Array;for(let n of o.childrens){let s=new Array;for(let a of n)s.push($c(a));i.push(s)}t.constraintRegion?(e&&(o.component=new nu(e)),r=pt.addPolygonByModel(o,i)):(o.component=new fd(t.device,t.track,t.copper,t.fill,t.planzone),r=pt.addPolygonByModel(o,i))}return r}function iLt(o,t){if(o.length!==t.length)return!1;for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}function Xme(o,t){t&&o.publish("hasModifyPcbItem",t),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}function lKe(o,t){o.messageBus.rpcService("pcb/extensionAPI/region-create",async e=>{let r=new ve("create region for api"),{layer:i,complexPolygon:n,ruleType:s,regionName:a,lineWidth:l,primitiveLock:c}=e,h=cr(),u=jme(s),d=eS(h,u.constraintRegion?"Constraint Region":"Prohibited Region",i,null,!!c,l/10,n,!0),p=aKe(d,u,a);return r.addCommand(Te.dispatch(p,"add")),je.executeCommand(r),Xme(o,p),{primitiveId:p.globalIndex,lineWidth:p.strokeWidth*10}}),o.messageBus.rpcService("pcb/extensionAPI/region-delete",async e=>{let r=new ve("delete region for api"),{primitiveIds:i}=e,n=[],s=[],a=new er;for(let l=0;l<i.length;l++){let c=a.getItem(i[l]);c&&(r.addCommand(Te.dispatch(c,"delete")),c.remove(),o.publish("delete",c),s.push(c),n.push(i[l]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/region-modify",async e=>{let r=new ve("modify region for api"),{primitiveId:i,data:n}=e,{layerId:s,polygonSource:a,ruleType:l,regionName:c,lineWidth:h,primitiveLock:u}=n,d=Yme(),m=d.map(P=>P.globalIndex).indexOf(i);if(m<=-1)return;let g=d[m],y=py(g);if(!iLt(y[0],a)){let P=new ve("modify shape for region api");t.clearSelect(),P.addCommand(Te.dispatch(g,"delete")),t.setSelect([g]),o.publish("removeSelect","");let T=jme(l),I=eS(i,T.constraintRegion?"Constraint Region":"Prohibited Region",s,null,!!u,h/10,a,!0);if(I.modelType=="Circle"||I.modelType=="Rect"||I.modelType=="Polygon"){let C=aKe(I,T,c);return P.addCommand(Te.dispatch(C,"add")),je.executeCommand(P),Xme(o,C),{primitiveId:C.globalIndex,lineWidth:C.strokeWidth*10}}else return null}if(r.addCommand(Te.dispatch(g,"modify")),typeof s<"u")if(Zn.fixLayerOptions(s,Zn.createLayerOptionsByLineloop(g)).some(T=>T.value===s))g.layerId=s;else return null;if(typeof l<"u"&&g.type=="Prohibited Region"){let P=jme(l),T=g.component;T.device=P.device,T.fill=P.fill,T.track=P.track,T.copper=P.copper,T.planzone=P.planzone}if(typeof c<"u"&&g.type=="Constraint Region"){let P=g.component;P.name=c}g.strokeWidth!==h/10&&(g.strokeWidth=h/10),typeof u<"u"&&(g.locked=!!u),je.executeCommand(r),Xme(o,g);let b=g.toJSON();return b.polygonSource=a,delete b.componentData,delete b.net,delete b.silkColor,b}),o.messageBus.rpcService("pcb/extensionAPI/region-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=Yme(),s=n.map(a=>a.globalIndex);for(let a=0;a<r.length;a++){let l=s.indexOf(r[a]);if(l<=-1)continue;let c=n[l],h=c.toJSON();h.type=="Prohibited Region"?(h.device=h.componentData.device,h.fill=h.componentData.fill,h.track=h.componentData.track,h.copper=h.componentData.copper,h.planzone=h.componentData.planzone):h.name=h.componentData.name,delete h.componentData,delete h.shapes,delete h.silkColor,delete h.net;let u=py(c);h.path=u,h.strokeWidth=h.strokeWidth*10,i.push(h)}return i}),o.messageBus.rpcService("pcb/extensionAPI/region-getAll",async e=>{let{layer:r,ruleType:i,primitiveLock:n}=e,s=Yme(),a=s.map(l=>{let c=l.toJSON();return{...c,strokeWidth:c.strokeWidth*10}});for(let l=0;l<a.length;l++)a[l].type=="Prohibited Region"?(a[l].device=a[l].componentData.device,a[l].fill=a[l].componentData.fill,a[l].track=a[l].componentData.track,a[l].copper=a[l].componentData.copper,a[l].planzone=a[l].componentData.planzone):a[l].name=a[l].componentData.name,a[l].path=py(s[l]),delete a[l].componentData,delete a[l].shapes,delete a[l].net,delete a[l].silkColor;if(typeof r<"u"&&(a=ua(a,rL("layer"),r)),typeof i<"u"){let l=jme(i);l.device&&(a=ua(a,rL("device"),l.device)),l.fill&&(a=ua(a,rL("fill"),l.fill)),l.track&&(a=ua(a,rL("track"),l.track)),l.copper&&(a=ua(a,rL("copper"),l.copper)),l.planzone&&(a=ua(a,rL("planzone"),l.planzone)),l.constraintRegion&&(a=ua(a,rL("type"),"Constraint Region"))}return typeof n<"u"&&(a=ua(a,rL("primitiveLock"),n)),a}),o.messageBus.rpcService("pcb/extensionAPI/region-convertToType",async e=>{let r=new ve("modify type for region api"),{primitiveId:i,type:n}=e,s=Yme(),l=s.map(u=>u.globalIndex).indexOf(i);if(l<=-1)return;let c=s[l];r.addCommand(Te.dispatch(c,"modify"));let h=c.toJSON();return n=="line"?c.type="Line":n=="copper"?(c.type="Copper Region",h.copperInfo=c.component.toJSON(),gn.addOrder(c,r),h.pourPriority=gn.getOrder(c.globalIndex)+1):n=="fill"&&(c.type="Fill Region"),delete h.componentData,delete h.silkColor,je.executeCommand(r),Xme(o,c),h})}function cKe(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function hKe(o,t){o.messageBus.rpcService("pcb/extensionAPI/string-create",async e=>{let{layer:r,x:i,y:n,text:s,fontFamily:a,fontSize:l,lineWidth:c,alignMode:h,rotation:u,reverse:d,expansion:p,mirror:m,primitiveLock:g}=e,y=new ve("create texts for api"),b=ti.addText(r,"",!1,s,!0,a,l/10,Ht.toRadians(u),!!g,new S(i/10,n/10),h,c/10,d,p,m);return y.addCommand(Te.dispatch(b,"add")),je.executeCommand(y),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),{primitiveId:b.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/string-delete",async e=>{let r=new ve("delete texts for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=ti.getItem(i[a]);l&&(r.addCommand(Te.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/string-modify",async e=>{let r=new ve("modify texts for api"),{primitiveId:i,data:n}=e,{layer:s,x:a,y:l,text:c,fontFamily:h,fontSize:u,lineWidth:d,alignMode:p,rotation:m,reverse:g,expansion:y,mirror:b,primitiveLock:P}=n,T=ti.getItem(i),I=1e-10;if(!T)return null;if(r.addCommand(Te.dispatch(T,"modify")),T.layerId!==s)if(Zn.pcbText().some(E=>E.value===s))T.layerId=s;else return null;if(Math.abs(T.position.x-a/10)>I){let C=new S(a/10,T.position.y);T.position=C}if(Math.abs(T.position.y-l/10)>I){let C=new S(T.position.x,l/10);T.position=C}if(T.value!==c&&(T.value=c),T.fontFamily!==h&&(T.fontFamily=h),T.fontSize!==u/10&&(T.fontSize=u/10),T.strokeWidth!==d/10&&(T.strokeWidth=d/10),T.origin!==p&&(T.origin=p),T.rotation!==Ht.toRadians(m)&&(T.rotation=Ht.toRadians(m)),T.reverse!==g){if(h==="default")return console.debug("[DEBUG]: \u9ED8\u8BA4\u5B57\u4F53\u4E0D\u652F\u6301\u8BBE\u7F6E\u53CD\u76F8"),!1;T.reverse=g}return T.reverseExpansion!==y/10&&(T.reverseExpansion=y/10),T.mirror!==b&&(T.mirror=b),T.locked!==P&&(T.locked=P),je.executeCommand(r),o.publish("hasModifyPcbItem",T),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),T.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/string-getByIds",async e=>{let{primitiveIds:r}=e,i=[];for(let n=0;n<r.length;n++){let s=ti.getItem(r[n]);s&&i.push(s.toJSON())}return i}),o.messageBus.rpcService("pcb/extensionAPI/string-getAll",async e=>{let{layer:r,primitiveLock:i}=e,s=ti.getAllItem().filter(a=>!a.getParent()).map(a=>a.toJSON());return typeof r<"u"&&(s=ua(s,cKe("layer"),r)),typeof i<"u"&&(s=ua(s,cKe("primitiveLock"),i)),s})}function p_e(o){return{primitiveLock:"locked"}[o]||o}function uKe(o,t){o.messageBus.rpcService("pcb/extensionAPI/track-create",async e=>{let{net:r,layerId:i,startX:n,startY:s,endX:a,endY:l,lineWidth:c,primitiveLock:h}=e,u=pr.addTrack(i,new S(n/10,s/10),new S(a/10,l/10),c/10,!!h,r),d=new ve("create track for api");return d.addCommand(Te.dispatch(u,"add")),je.executeCommand(d),o.publish("hasModifyPcbItem",u),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),{primitiveId:u.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/track-delete",async e=>{let r=new ve("delete tracks for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=pr.getItem(i[a]);l&&(r.addCommand(Te.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/track-modify",async e=>{let r=new ve("modify tracks for api"),{primitiveId:i,data:n}=e,{net:s,layerId:a,startX:l,startY:c,endX:h,endY:u,lineWidth:d,primitiveLock:p}=n,m=pr.getItem(i);if(!m)return null;if(r.addCommand(Te.dispatch(m,"modify")),m.net!==s&&(m.net=s),m.layerId!==+a)if($e.getInstance().getAllSignalLayerIds().includes(+a))m.layerId=+a;else return null;if(m.start.x!==l/10){let y=new S(l/10,m.start.y);m.start=y}if(m.start.y!==c/10){let y=new S(m.start.x,c/10);m.start=y}if(m.end.x!==h/10){let y=new S(h/10,m.end.y);m.end=y}if(m.end.y!==u/10){let y=new S(m.end.x,u/10);m.end=y}m.width!==d/10&&(m.width=d/10),m.locked!==!!p&&(m.locked=!!p),je.executeCommand(r),o.publish("hasModifyPcbItem",m),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$());let g=m.toJSON();return{...g,startX:g.start.x,startY:g.start.y,endX:g.end.x,endY:g.end.y}}),o.messageBus.rpcService("pcb/extensionAPI/track-getByIds",async e=>{let{primitiveIds:r}=e,i=[];for(let n=0;n<r.length;n++){let s=pr.getItem(r[n]);if(!s)continue;let a=s.toJSON();i.push({...a,startX:a.start.x*10,startY:a.start.y*10,endX:a.end.x*10,endY:a.end.y*10,width:a.width*10})}return i}),o.messageBus.rpcService("pcb/extensionAPI/track-getAll",async e=>{let{net:r,layerId:i,primitiveLock:n}=e,a=pr.getAllItem().filter(l=>l instanceof Ar).map(l=>{let c=l.toJSON();return{...c,startX:c.start.x*10,startY:c.start.y*10,endX:c.end.x*10,endY:c.end.y*10,width:c.width*10}});return typeof r<"u"&&(a=ua(a,p_e("net"),r)),typeof i<"u"&&(a=ua(a,p_e("layerId"),i)),typeof n<"u"&&(a=ua(a,p_e("primitiveLock"),n)),a}),o.messageBus.rpcService("pcb/extensionAPI/track-getAdjacentPrimitives",async e=>pr.getItem(e).searchNode().filter(s=>s.globalIndex!==e).filter(s=>typeof s.toJSON=="function").map(s=>dy(s))),o.messageBus.rpcService("pcb/extensionAPI/track-getEntireTrack",async e=>[...pr.getItem(e).searchAllConnectNode()].filter(n=>typeof n.toJSON=="function").map(n=>dy(n)))}function dKe(o){return{primitiveLock:"locked"}[o]||o}function pKe(o,t){o.messageBus.rpcService("pcb/extensionAPI/via-create",async e=>{let r=new ve("create vias for api"),{net:i,x:n,y:s,holeDiameter:a,diameter:l,viaType:c,designRuleBlindViaName:h,solderMaskExpansion:u,primitiveLock:d}=e,p=1,m=2,g=h||"";if(g.length>0&&!te.getInstance().getBlindPhysics().data.some(C=>C.name===g))return;let y=u?2:1,b=u?u.topSolderMask/10:null,P=u?u.bottomSolderMask/10:null,T=Hr.addVia(c,g,p,m,i,l/10/2,new S(n/10,s/10),a/10/2,!!d,y,b,P);return r.addCommand(Te.dispatch(T,"add")),je.executeCommand(r),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),{primitiveId:T.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/via-delete",async e=>{let r=new ve("delete vias for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=Hr.getItem(i[a]);l&&(r.addCommand(Te.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/via-modify",async e=>{let r=new ve("modify Vias for api"),{primitiveId:i,data:n}=e,{net:s,x:a,y:l,holeDiameter:c,diameter:h,viaType:u,designRuleBlindViaName:d,solderMaskExpansion:p,primitiveLock:m}=n,g=Hr.getItem(i),y=1e-10;if(!g)return null;if(r.addCommand(Te.dispatch(g,"modify")),typeof s<"u"&&(g.net=s),Math.abs(g.center.x-a/10)>y){let b=new S(a/10,g.center.y);g.center=b}if(Math.abs(g.center.y-l/10)>y){let b=new S(g.center.x,l/10);g.center=b}return Math.abs(g.holeRadius-c/10/2)>y&&(g.holeRadius=c/10/2),Math.abs(g.radius-h/10/2)>y&&(g.radius=h/10/2),typeof u<"u"&&(g.type=u),typeof p<"u"&&(g.viaExpansion=new XB(2,p.topSolderMask/10,p.bottomSolderMask/10)),typeof m<"u"&&(g.locked=!!m),je.executeCommand(r),o.publish("hasModifyPcbItem",g),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),g.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/via-getByIds",async e=>{let{primitiveIds:r}=e,i=[];for(let n=0;n<r.length;n++){let s=Hr.getItem(r[n]);s&&i.push(s.toJSON())}return i}),o.messageBus.rpcService("pcb/extensionAPI/via-getAll",async e=>{let{net:r,primitiveLock:i}=e,s=Hr.getAllItem().map(a=>a.toJSON());return typeof r<"u"&&(s=ua(s,dKe("net"),r)),typeof i<"u"&&(s=ua(s,dKe("primitiveLock"),i)),s}),o.messageBus.rpcService("pcb/extensionAPI/via-getAdjacentPrimitives",async e=>Hr.getItem(e).searchNode().filter(s=>s.globalIndex!==e).filter(s=>typeof s.toJSON=="function").map(s=>dy(s)))}function fKe(o,t){o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-getAllSelectedPrimitiveIds",async()=>t.getItems().map(r=>r.globalIndex)),o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-getAllSelectedPrimitives",async()=>t.getItems().filter(i=>typeof i.toJSON=="function").map(i=>dy(i))),o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-doSelectPrimitives",async e=>{let r=e.primitiveIds;Array.isArray(r)||(r=[r]);let i=new er,n=[];for(let s=0;s<r.length;s++){let a=i.getItem(r[s]);a&&n.push(a)}return t.setSelect(n,!1),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),n.length>0}),o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-doCrossProbeSelect",async e=>{let{components:r=[],pins:i=[],nets:n=[],highlight:s,select:a}=e;t.clearSelect(),t.cancelAllElementsHightlight(!0);let l=Cr.getAllItem(),c=Kt.getAllItem(),h=new Set,u=[],d=new Map,p=Array.from(r);for(let m=0;m<i.length;m++){if(i[m].indexOf("_")>=0){let g=i[m].split("_");p.push(g[0]);let y=d.get(g[0]);typeof y>"u"&&(y=[]),y.push(g[1]),d.set(g[0],[...y]);continue}u.push(i[m])}for(let m=0;m<u.length;m++)for(let g=0;g<c.length;g++)c[g].num===u[m]&&h.add(c[g]);for(let m=0;m<p.length;m++)for(let g=0;g<l.length;g++)if(l[g].designator===p[m]){r.indexOf(p[m])>=0&&h.add(l[g]);let y=l[g].getPads(),b=d.get(p[m])||[];for(let P=0;P<b.length;P++)for(let T=0;T<y.length;T++)y[T].num===b[P]&&h.add(y[T])}if(n.length)for(let m=0;m<n.length;m++){let g=ze.getSameNetItems(n[m]);for(let y=0;y<g.length;y++)h.add(g[y])}if(h.size&&(a&&t.setSelect(h),s)){let m=new Set;for(let g of h)m.add(g.globalIndex);t.highlight.highlightUnselect(m)}return o.publish("flushService",""),o.publish("updateFrame",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-doCrossProbeSelectByObject",async e=>{let{components:r=[],pins:i=[],nets:n=[]}=e,s={parts:r,pins:i,nets:n,partKey:"Designator"};return o.publish("pcbCrossProbe",s),!0}),o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-clearSelected",async()=>(t.clearSelect(),!0)),o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-getCurrentMousePosition",async()=>{let e=Kf.getInputInfo();return{x:e.sceneX*10,y:e.sceneY*10}})}function mKe(o,t){o.messageBus.rpcService("pcb/extensionAPI/attribute-delete",async e=>{let r=new ve("hide attrs for API"),{primitiveIds:i}=e,n=[];for(let s=0;s<i.length;s++){let a=ti.getItem(i[s]);a&&(r.addCommand(Te.dispatch(a,"modify")),o.publish("hasModifyPcbItem",a),a.showKey=!1,a.showValue=!1,n.push(i[s]))}return je.executeCommand(r),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),n}),o.messageBus.rpcService("pcb/extensionAPI/attribute-modify",async e=>{let r=new ve("modify attrs for api"),{primitiveId:i,data:n}=e,{layer:s,x:a,y:l,key:c,value:h,keyVisible:u,valueVisible:d,fontFamily:p,fontSize:m,lineWidth:g,alignMode:y,rotation:b,reverse:P,expansion:T,mirror:I,primitiveLock:C}=n,E=ti.getItem(i),O=1e-10;if(!E)return null;if(r.addCommand(Te.dispatch(E,"modify")),E.layerId!==s)if(Zn.pcbText().some(R=>R.value===s))E.layerId=s;else return null;if(Math.abs(E.position.x-a/10)>O){let _=new S(a/10,E.position.y);E.position=_}if(Math.abs(E.position.y-l/10)>O){let _=new S(E.position.x,l/10);E.position=_}if(E.key!==c&&(E.key=c),E.value!==h&&(E.value=h),E.showKey!==u&&(E.showKey=u),E.showValue!==d&&(E.showValue=d),E.fontFamily!==p&&(E.fontFamily=p),E.fontSize!==m/10&&(E.fontSize=m/10),E.strokeWidth!==g/10&&(E.strokeWidth=g/10),E.origin!==y&&(E.origin=y),E.rotation!==Ht.toRadians(b)&&(E.rotation=Ht.toRadians(b)),E.reverse!==P){if(p==="default")return console.debug("[DEBUG]: \u9ED8\u8BA4\u5B57\u4F53\u4E0D\u652F\u6301\u8BBE\u7F6E\u53CD\u76F8"),!1;E.reverse=P}return E.reverseExpansion!==T/10&&(E.reverseExpansion=T/10),E.mirror!==I&&(E.mirror=I),E.locked!==C&&(E.locked=C),je.executeCommand(r),o.publish("hasModifyPcbItem",E),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),E.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/attribute-getByIds",async e=>{let{primitiveIds:r}=e,n=Cr.getAllItem().map(a=>a.toJSON().ATTR.map(l=>({...l,parentPrimitiveId:a.globalIndex}))).flat(),s=[];for(let a=0;a<r.length;a++){let l=n.filter(c=>c.globalIndex===r[a])[0];l&&s.push(l)}return s}),o.messageBus.rpcService("pcb/extensionAPI/attribute-getAll",async()=>Cr.getAllItem().map(i=>({attrs:i.toJSON().ATTR,parentPrimitiveId:i.globalIndex})))}function gKe(o,t){t&&o.publish("hasModifyPcbItem",t),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}function yKe(o,t){o.messageBus.rpcService("pcb/extensionAPI/poured-delete",async e=>{let r=new ve("delete poured for api"),{primitiveIds:i}=e,n=[],s=[],a=Ei.getAllItem();for(let l=0;l<i.length;l++){let c=i[l],h=a.filter(u=>u.getParent().globalIndex===c);for(let u=0;u<h.length;u++){let d=h[u];d&&(r.addCommand(Te.dispatch(d,"delete")),d.remove(),o.publish("delete",d),s.push(d))}n.push(c)}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/poured-deletePourFills",async e=>{let r=new ve("delete PourFills for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=Ei.getItem(i[a]);l&&(r.addCommand(Te.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&rd(o),je.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/poured-convertToFill",async e=>{let r=new ve("convertToFill for api"),{pourFillId:i}=e,n=Ei.getItem(i);r.addCommand(Te.dispatch(n,"modify")),nN("CONVERT_TO_FILL_REGION",[n]);let s=t.getSelects().filter(a=>a instanceof ct&&a.type==="Fill Region")[0];return je.executeCommand(r),gKe(o,n),s.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/poured-addSolderMaskFill",async e=>{let r=new ve("addSolderMaskFill for api"),{pourFillId:i}=e,n=Ei.getItem(i);r.addCommand(Te.dispatch(n,"add"));let s;if(Io(n.layerId))s=5;else if(2==n.layerId)s=6;else return;let a=V_.convertCopperResult2FillRegion([n],!0,r);return a.forEach(l=>{(l.layerId!=s||!l.net)&&(r.addCommand(Te.dispatch(l,"modify")),l.layerId=s,l.net=null)}),je.executeCommand(r),gKe(o,n),a[0].toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/poured-getAll",async()=>Ei.getAllItem().map(i=>({...i.toJSON(),pourPrimitiveId:i.getParent().globalIndex})))}function bKe(o,t){pKe(o,t),uKe(o,t),W$e(o,t),nKe(o,t),j$e(o,t),N$e(o,t),L$e(o,t),rKe(o,t),J$e(o,t),eKe(o,t),lKe(o,t),K$e(o,t),sKe(o,t),q$e(o,t),fKe(o,t),F$e(o,t),U$e(o,t),V$e(o,t),H$e(o,t),G$e(o,t),hKe(o,t),mKe(o,t),yKe(o,t)}function PKe(o){let t;if(o.useCustomSize)o.path=`["R",0,0,${o.customWidth*10},${o.customHeight*10},0,0]`,t=[`["POLY", "e0", 0, "", 11, 10, ${o.path}, 0]`];else if(o.isSetjson){let e=JSON.parse(o.path);t=nLt(e),ai.getInstance().useSetJsonFirst=!0,ai.getInstance().setJsonParamCache=e.ui_params_sum}else o.path=o.path||'[["R",0,0,1000,500,0,0]]',t=JSON.parse(o.path).map(e=>`["POLY", "e0", 0, "", 11, 10, ${JSON.stringify(e)}, 0]`);return oLt(t)}function nLt(o){let t=new Array;for(let r of o.set.marks){let i=rI(r.dia,o.unit),n=rI(r.x,o.unit),s=rI(r.y,o.unit),a=rI(.5,"mm");[1,2].forEach(l=>{t.push(["PAD",cr(),0,"",l,"",n,s,0,null,["ELLIPSE",i,i],[],0,0,null,1,0,a,null,null,null,0,null,null,null,null,[]])})}let e=[];for(let r of o.set.stamp_holes)for(let i of r.holes)e.push(i);for(let r of o.set.tool_holes)e.push(r);for(let r of e){let i=rI(r.x,o.unit),n=rI(r.y,o.unit),s=rI(r.dia/2,o.unit);t.push(["FILL",cr(),0,"",12,1,0,[["CIRCLE",i,n,s]],0])}t.push(...qme(o.set.margins.vertexs,o.unit)),o.set.margins.vertexs_holes&&t.push(...qme(o.set.margins.vertexs_holes.map(r=>r.vertexs),o.unit)),t.push(...qme(o.set.margins.vertexs,o.unit));for(let r=0;r<o.set.repeat.length;r++){let i=o.set.repeat[r],n=o.pcs[i.key];for(let s=0;s<i.repeat_x;s++)for(let a=0;a<i.repeat_y;a++){let l=new S(i.dis_x*s,i.dis_y*a),c=i.rotate!=0;t.push(...qme(n.outline.vertexs,o.unit,l,c,r==0&&s==0&&a==0))}}return t.map(r=>JSON.stringify(r))}function qme(o,t,e=new S(0,0),r=!1,i=!1){let n=[];o=JSON.parse(JSON.stringify(o));for(let l of o)if(l.length)for(let c=0;c<l.length;c++){let h=l[c];h.xc!=null&&(h.xc+=e.x,h.yc+=e.y),h.x+=e.x,h.y+=e.y}let s=new Array;for(let l of o){if(!l.length)continue;let c=new S(rI(l.at(-1).x,t),rI(l.at(-1).y,t)),h=[c.x,c.y],u=new Array;s.push(u);for(let d=0;d<l.length;d++){let p=l[d],m=p.xc!=null,g=rI(p.x,t),y=rI(p.y,t),b=new S(h.at(-2),h.at(-1)),P=new S(g,y);if(m){let T=rI(p.xc,t),I=rI(p.yc,t),C=new S(T,I),E=C.distance1(P),O=q.build4(b,P,C,E,E,p.ccw?le.CCW:le.CW);h.push("ARC",O.sweepAngle,g,y),u.push(O)}else{let T=new M(b,P);h.push("L",g,y),u.push(T)}}}let a;if(r){let l=new _e;s.flat(2).forEach(h=>{l.ext1(h.bbox())}),a=l.build1().center()}return s.forEach((l,c)=>{let h=[];l.forEach((u,d)=>{let p;if(r){let m=Ae.rotateZForPoint(a,Math.PI);p=u.multiply3(m.toMatrix3())}else p=u;d==0&&h.push(p.start().x,p.start().y),p instanceof q?h.push("ARC",p.sweepAngle,p.end().x,p.end().y):h.push("L",p.end().x,p.end().y)}),n.push(["POLY",cr(),0,"",11,10,h,i?1:0])}),n}function oLt(o){return`["DOCTYPE","PCB","1.7"]
["HEAD",{"editorVersion":"dev","importFlag":0}]
["CANVAS",0,0,"mil",5,5,5,5,5,5,2,0,5]
["LAYER",1,"TOP","Top Layer",3,"#ff0000",1,"#7f0000",0.5]
["LAYER",2,"BOTTOM","Bottom Layer",3,"#0000ff",1,"#00007f",0.5]
["LAYER",3,"TOP_SILK","Top Silkscreen Layer",3,"#ffcc00",1,"#7f6600",0.5]
["LAYER",4,"BOT_SILK","Bottom Silkscreen Layer",3,"#66cc33",1,"#336619",0.5]
["LAYER",5,"TOP_SOLDER_MASK","Top Solder Mask Layer",3,"#800080",0.7,"#400040",0.5]
["LAYER",6,"BOT_SOLDER_MASK","Bottom Solder Mask Layer",3,"#aa00ff",0.7,"#55007f",0.5]
["LAYER",7,"TOP_PASTE_MASK","Top Paste Mask Layer",3,"#808080",1,"#404040",0.5]
["LAYER",8,"BOT_PASTE_MASK","Bottom Paste Mask Layer",3,"#800000",1,"#400000",0.5]
["LAYER",9,"TOP_ASSEMBLY","Top Assembly Layer",3,"#33cc99",1,"#19664c",0.5]
["LAYER",10,"BOT_ASSEMBLY","Bottom Assembly Layer",3,"#5555ff",1,"#2a2a7f",0.5]
["LAYER",11,"OUTLINE","Board Outline Layer",3,"#ff00ff",1,"#7f007f",0.5]
["LAYER",12,"MULTI","Multi-Layer",3,"#c0c0c0",1,"#606060",0.5]
["LAYER",13,"DOCUMENT","Document Layer",3,"#ffffff",1,"#7f7f7f",0.5]
["LAYER",14,"MECHANICAL","Mechanical Layer",3,"#f022f0",1,"#781178",0.5]
["LAYER",15,"SIGNAL","Inner1",0,"#999966",1,"#4c4c33",0.5]
["LAYER",16,"SIGNAL","Inner2",0,"#008000",1,"#004000",0.5]
["LAYER",17,"SIGNAL","Inner3",0,"#00ff00",1,"#007f00",0.5]
["LAYER",18,"SIGNAL","Inner4",0,"#bc8e00",1,"#5e4700",0.5]
["LAYER",19,"SIGNAL","Inner5",0,"#70dbfa",1,"#39503f",0.5]
["LAYER",20,"SIGNAL","Inner6",0,"#00cc66",1,"#006633",0.5]
["LAYER",21,"SIGNAL","Inner7",0,"#9966ff",1,"#4c337f",0.5]
["LAYER",22,"SIGNAL","Inner8",0,"#800080",1,"#400040",0.5]
["LAYER",23,"SIGNAL","Inner9",0,"#008080",1,"#004040",0.5]
["LAYER",24,"SIGNAL","Inner10",0,"#15935f",1,"#0a492f",0.5]
["LAYER",25,"SIGNAL","Inner11",0,"#000080",1,"#000040",0.5]
["LAYER",26,"SIGNAL","Inner12",0,"#00b400",1,"#005a00",0.5]
["LAYER",27,"SIGNAL","Inner13",0,"#2e4756",1,"#17232b",0.5]
["LAYER",28,"SIGNAL","Inner14",0,"#99842f",1,"#4c4217",0.5]
["LAYER",29,"SIGNAL","Inner15",0,"#ffffaa",1,"#7f7f55",0.5]
["LAYER",30,"SIGNAL","Inner16",0,"#99842f",1,"#4c4217",0.5]
["LAYER",31,"SIGNAL","Inner17",0,"#2e4756",1,"#17232b",0.5]
["LAYER",32,"SIGNAL","Inner18",0,"#3535ff",1,"#1a1a7f",0.5]
["LAYER",33,"SIGNAL","Inner19",0,"#8000bc",1,"#40005e",0.5]
["LAYER",34,"SIGNAL","Inner20",0,"#43ae5f",1,"#21572f",0.5]
["LAYER",35,"SIGNAL","Inner21",0,"#c3ecce",1,"#617667",0.5]
["LAYER",36,"SIGNAL","Inner22",0,"#728978",1,"#39443c",0.5]
["LAYER",37,"SIGNAL","Inner23",0,"#39503f",1,"#1c281f",0.5]
["LAYER",38,"SIGNAL","Inner24",0,"#0c715d",1,"#06382e",0.5]
["LAYER",39,"SIGNAL","Inner25",0,"#5a8a80",1,"#2d4540",0.5]
["LAYER",40,"SIGNAL","Inner26",0,"#2b937e",1,"#15493f",0.5]
["LAYER",41,"SIGNAL","Inner27",0,"#23999d",1,"#114c4e",0.5]
["LAYER",42,"SIGNAL","Inner28",0,"#45b4e3",1,"#225a71",0.5]
["LAYER",43,"SIGNAL","Inner29",0,"#215da1",1,"#102e50",0.5]
["LAYER",44,"SIGNAL","Inner30",0,"#4564d7",1,"#22326b",0.5]
["LAYER",45,"SIGNAL","Inner31",0,"#6969e9",1,"#343474",0.5]
["LAYER",46,"SIGNAL","Inner32",0,"#9069e9",1,"#483474",0.5]
["LAYER",47,"HOLE","Hole Layer",3,"#222222",1,"#111111",0.5]
["LAYER",48,"COMPONENT_SHAPE","Component Shape Layer",1,"#00cccc",1,"#006666",0.5]
["LAYER",49,"COMPONENT_MARKING","Component Marking Layer",1,"#66ffcc",1,"#337f66",0.5]
["LAYER",50,"PIN_SOLDERING","Pin Soldering Layer",1,"#cc9999",1,"#664c4c",0.5]
["LAYER",51,"PIN_FLOATING","Pin Floating Layer",1,"#ff99ff",1,"#7f4c7f",0.5]
["LAYER",52,"COMPONENT_MODEL","Component Model Layer",0,"#ffffff",1,"#7f7f7f",0.5]
["LAYER",53,"3D_SHELL_OUTLINE","3D Shell Outline Layer",3,"#66ff99",1,"#337f4c",0.5]
["LAYER",54,"3D_SHELL_TOP","3D Shell Top Layer",3,"#ffccff",1,"#7f667f",0.5]
["LAYER",55,"3D_SHELL_BOTTOM","3D Shell Bottom Layer",3,"#0066cc",1,"#003366",0.5]
["LAYER",56,"DRILL_DRAWING","Drill Drawing Layer",3,"#008080",1,"#004040",0.5]
["LAYER",57,"OTHER","Ratline Layer",7,"#6464ff",1,"#32327f",0.5]
["LAYER",58,"TOP_STIFFENER","Top Stiffener Layer",0,"#eee666",1,"#777333",0.5]
["LAYER",59,"BOTTOM_STIFFENER","Bottom Stiffener Layer",0,"#ccff00",1,"#667f00",0.5]
["LAYER",71,"CUSTOM","Custom1",0,"#9069e9",1,"#483474",0.5]
["LAYER",72,"CUSTOM","Custom2",0,"#6969e9",1,"#343474",0.5]
["LAYER",73,"CUSTOM","Custom3",0,"#4564d7",1,"#22326b",0.5]
["LAYER",74,"CUSTOM","Custom4",0,"#215da1",1,"#102e50",0.5]
["LAYER",75,"CUSTOM","Custom5",0,"#45b4e3",1,"#225a71",0.5]
["LAYER",76,"CUSTOM","Custom6",0,"#23999d",1,"#114c4e",0.5]
["LAYER",77,"CUSTOM","Custom7",0,"#2b937e",1,"#15493f",0.5]
["LAYER",78,"CUSTOM","Custom8",0,"#5a8a80",1,"#2d4540",0.5]
["LAYER",79,"CUSTOM","Custom9",0,"#0c715d",1,"#06382e",0.5]
["LAYER",80,"CUSTOM","Custom10",0,"#39503f",1,"#1c281f",0.5]
["LAYER",81,"CUSTOM","Custom11",0,"#728978",1,"#39443c",0.5]
["LAYER",82,"CUSTOM","Custom12",0,"#c3ecce",1,"#617667",0.5]
["LAYER",83,"CUSTOM","Custom13",0,"#43ae5f",1,"#21572f",0.5]
["LAYER",84,"CUSTOM","Custom14",0,"#8000bc",1,"#40005e",0.5]
["LAYER",85,"CUSTOM","Custom15",0,"#3535ff",1,"#1a1a7f",0.5]
["LAYER",86,"CUSTOM","Custom16",0,"#2e4756",1,"#17232b",0.5]
["LAYER",87,"CUSTOM","Custom17",0,"#99842f",1,"#4c4217",0.5]
["LAYER",88,"CUSTOM","Custom18",0,"#ffffaa",1,"#7f7f55",0.5]
["LAYER",89,"CUSTOM","Custom19",0,"#99842f",1,"#4c4217",0.5]
["LAYER",90,"CUSTOM","Custom20",0,"#2e4756",1,"#17232b",0.5]
["LAYER",91,"CUSTOM","Custom21",0,"#00b400",1,"#005a00",0.5]
["LAYER",92,"CUSTOM","Custom22",0,"#000080",1,"#000040",0.5]
["LAYER",93,"CUSTOM","Custom23",0,"#15935f",1,"#0a492f",0.5]
["LAYER",94,"CUSTOM","Custom24",0,"#008080",1,"#004040",0.5]
["LAYER",95,"CUSTOM","Custom25",0,"#800080",1,"#400040",0.5]
["LAYER",96,"CUSTOM","Custom26",0,"#9966ff",1,"#4c337f",0.5]
["LAYER",97,"CUSTOM","Custom27",0,"#00cc66",1,"#006633",0.5]
["LAYER",98,"CUSTOM","Custom28",0,"#70dbfa",1,"#39503f",0.5]
["LAYER",99,"CUSTOM","Custom29",0,"#bc8e00",1,"#5e4700",0.5]
["LAYER",100,"CUSTOM","Custom30",0,"#00ff00",1,"#007f00",0.5]
["LAYER",101,"SUBSTRATE","Dielectric1",0,"#000000",1,"#000000",0.5]
["LAYER_PHYS",3,null,0,null,null,1]
["LAYER_PHYS",7,null,0,null,null,1]
["LAYER_PHYS",5,"",0.394,3.3,0.02,1]
["LAYER_PHYS",1,null,1.379,null,null,1]
["LAYER_PHYS",101,"FR4",59.449,4.5,0,1]
["LAYER_PHYS",2,null,1.378,null,null,1]
["LAYER_PHYS",6,"",0.394,3.3,0.02,1]
["LAYER_PHYS",8,null,0,null,null,1]
["LAYER_PHYS",4,null,0,null,null,1]
["ACTIVE_LAYER",1]
`+o.join(`
`)+`
["PANELIZE",0,1,1,0,0,1]
["PANELIZE_STAMP",1,0,1,21.6535,8,33.4646]
["PANELIZE_SIDE",1,1,236.2205,78.7402,39.3701,19.685]
["PANELIZE_STAMP",0,0,1,21.6535,8,33.4646]
["PANELIZE_SIDE",0,0,236.2205,78.7402,39.3701,19.685]`}function rI(o,t){return on(Bs(o,t,"mil"),4)}var TKe={NotAddIntoBomWithNcMark:null,NotAddIntoBomWithXMark:null,IsolatedTopPad:6,ThroughHoleTopPad:6,SurfaceMountTopPad:6,IsolatedBottomPad:6,ThroughHoleBottomPad:6,SurfaceMountBottomPad:6,IsolatedMultiPad:6,ThroughHoleMultiPad:6,Via:9,PadDrill:6,ViaDrill:9,BoardOutline:17,BoardCutout:18,CopperOutline:21,CopperFilled:21,Track:4,Text:13,Image:15,Dimension:16,SolidRegion:19,ProhibitedRegion:23,FPCStiffener:20,Line:26,PlaneZone:null,ThroughHoleComponentSilkscreen:3,SurfaceMountComponentSilkscreen:3,ThroughHoleComponentProperty:2,SurfaceMountComponentProperty:2,TearDrop:34,Shell_Outline:27,Shell_ScrewPillar:28,Shell_SideDatumLine:29,Shell_SideSlotRegion:31,Shell_TopBottomSlotRegion:30,Shell_SideEntity:33,Shell_TopBottomEntity:32};var f_e=[14,13,11,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,59,10,8,6,2,4,58,9,7,5,1,3,12,47,56],m_e=["NotAddIntoBomWithNcMark","NotAddIntoBomWithXMark"],$me=0;var IKe=.5,CKe=4,SKe={CopperOutline:"Copper Region",SolidRegion:"Fill Region",ProhibitedRegion:"Prohibited Region",FPCStiffener:"FPC Stiffener",Line:"Line",TearDrop:"TearDrop",Shell_Outline:"3D Shell - Outline",Shell_ScrewPillar:"3D Shell - Screw Pillar",Shell_SideDatumLine:"3D Shell - Side Datum Line",Shell_SideSlotRegion:"3D Shell - Side Slot Region",Shell_TopBottomSlotRegion:"3D Shell - Top Slot Region",Shell_SideEntity:"3D Shell - Side Entity",Shell_TopBottomEntity:"3D Shell - Top/Bottom Entity",BoardOutline:"Board Outline"},EKe=["PadDrill","IsolatedTopPad","ThroughHoleTopPad","SurfaceMountTopPad","IsolatedBottomPad","ThroughHoleBottomPad","SurfaceMountBottomPad","IsolatedMultiPad","ThroughHoleMultiPad"];var SK=15,T_e=30,I_e=19,sLt=29,nge=256,S_e=nge+1+sLt,OKe=2*S_e+1,TK=256,aLt=7,AKe=16,_Ke=17,vKe=18,g_e=16,oge=-1,lLt=1,Kme=2,cLt=0,mH=0,xKe=1,hLt=3,MP=4,U9=0,kKe=1,Zme=2,H9=-2,uLt=-3,fH=-5,RKe=[0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,0,0,16,17,18,18,19,19,20,20,20,20,21,21,21,21,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29];function Np(){var o=this;function t(i){var n=o.dyn_tree,s=o.stat_desc.static_tree,a=o.stat_desc.extra_bits,l=o.stat_desc.extra_base,c=o.stat_desc.max_length,h,u,d,p,m,g,y=0;for(p=0;p<=SK;p++)i.bl_count[p]=0;for(n[i.heap[i.heap_max]*2+1]=0,h=i.heap_max+1;h<OKe;h++)u=i.heap[h],p=n[n[u*2+1]*2+1]+1,p>c&&(p=c,y++),n[u*2+1]=p,!(u>o.max_code)&&(i.bl_count[p]++,m=0,u>=l&&(m=a[u-l]),g=n[u*2],i.opt_len+=g*(p+m),s&&(i.static_len+=g*(s[u*2+1]+m)));if(y!==0){do{for(p=c-1;i.bl_count[p]===0;)p--;i.bl_count[p]--,i.bl_count[p+1]+=2,i.bl_count[c]--,y-=2}while(y>0);for(p=c;p!==0;p--)for(u=i.bl_count[p];u!==0;)d=i.heap[--h],!(d>o.max_code)&&(n[d*2+1]!=p&&(i.opt_len+=(p-n[d*2+1])*n[d*2],n[d*2+1]=p),u--)}}function e(i,n){var s=0;do s|=i&1,i>>>=1,s<<=1;while(--n>0);return s>>>1}function r(i,n,s){var a=[],l=0,c,h,u;for(c=1;c<=SK;c++)a[c]=l=l+s[c-1]<<1;for(h=0;h<=n;h++)u=i[h*2+1],u!==0&&(i[h*2]=e(a[u]++,u))}o.build_tree=function(i){var n=o.dyn_tree,s=o.stat_desc.static_tree,a=o.stat_desc.elems,l,c,h=-1,u;for(i.heap_len=0,i.heap_max=OKe,l=0;l<a;l++)n[l*2]!==0?(i.heap[++i.heap_len]=h=l,i.depth[l]=0):n[l*2+1]=0;for(;i.heap_len<2;)u=i.heap[++i.heap_len]=h<2?++h:0,n[u*2]=1,i.depth[u]=0,i.opt_len--,s&&(i.static_len-=s[u*2+1]);for(o.max_code=h,l=Math.floor(i.heap_len/2);l>=1;l--)i.pqdownheap(n,l);u=a;do l=i.heap[1],i.heap[1]=i.heap[i.heap_len--],i.pqdownheap(n,1),c=i.heap[1],i.heap[--i.heap_max]=l,i.heap[--i.heap_max]=c,n[u*2]=n[l*2]+n[c*2],i.depth[u]=Math.max(i.depth[l],i.depth[c])+1,n[l*2+1]=n[c*2+1]=u,i.heap[1]=u++,i.pqdownheap(n,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],t(i),r(n,o.max_code,i.bl_count)}}Np._length_code=[0,1,2,3,4,5,6,7,8,8,9,9,10,10,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28],Np.base_length=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],Np.base_dist=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],Np.d_code=function(o){return o<256?RKe[o]:RKe[256+(o>>>7)]},Np.extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Np.extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Np.extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Np.bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function fy(o,t,e,r,i){var n=this;n.static_tree=o,n.extra_bits=t,n.extra_base=e,n.elems=r,n.max_length=i}fy.static_ltree=[12,8,140,8,76,8,204,8,44,8,172,8,108,8,236,8,28,8,156,8,92,8,220,8,60,8,188,8,124,8,252,8,2,8,130,8,66,8,194,8,34,8,162,8,98,8,226,8,18,8,146,8,82,8,210,8,50,8,178,8,114,8,242,8,10,8,138,8,74,8,202,8,42,8,170,8,106,8,234,8,26,8,154,8,90,8,218,8,58,8,186,8,122,8,250,8,6,8,134,8,70,8,198,8,38,8,166,8,102,8,230,8,22,8,150,8,86,8,214,8,54,8,182,8,118,8,246,8,14,8,142,8,78,8,206,8,46,8,174,8,110,8,238,8,30,8,158,8,94,8,222,8,62,8,190,8,126,8,254,8,1,8,129,8,65,8,193,8,33,8,161,8,97,8,225,8,17,8,145,8,81,8,209,8,49,8,177,8,113,8,241,8,9,8,137,8,73,8,201,8,41,8,169,8,105,8,233,8,25,8,153,8,89,8,217,8,57,8,185,8,121,8,249,8,5,8,133,8,69,8,197,8,37,8,165,8,101,8,229,8,21,8,149,8,85,8,213,8,53,8,181,8,117,8,245,8,13,8,141,8,77,8,205,8,45,8,173,8,109,8,237,8,29,8,157,8,93,8,221,8,61,8,189,8,125,8,253,8,19,9,275,9,147,9,403,9,83,9,339,9,211,9,467,9,51,9,307,9,179,9,435,9,115,9,371,9,243,9,499,9,11,9,267,9,139,9,395,9,75,9,331,9,203,9,459,9,43,9,299,9,171,9,427,9,107,9,363,9,235,9,491,9,27,9,283,9,155,9,411,9,91,9,347,9,219,9,475,9,59,9,315,9,187,9,443,9,123,9,379,9,251,9,507,9,7,9,263,9,135,9,391,9,71,9,327,9,199,9,455,9,39,9,295,9,167,9,423,9,103,9,359,9,231,9,487,9,23,9,279,9,151,9,407,9,87,9,343,9,215,9,471,9,55,9,311,9,183,9,439,9,119,9,375,9,247,9,503,9,15,9,271,9,143,9,399,9,79,9,335,9,207,9,463,9,47,9,303,9,175,9,431,9,111,9,367,9,239,9,495,9,31,9,287,9,159,9,415,9,95,9,351,9,223,9,479,9,63,9,319,9,191,9,447,9,127,9,383,9,255,9,511,9,0,7,64,7,32,7,96,7,16,7,80,7,48,7,112,7,8,7,72,7,40,7,104,7,24,7,88,7,56,7,120,7,4,7,68,7,36,7,100,7,20,7,84,7,52,7,116,7,3,8,131,8,67,8,195,8,35,8,163,8,99,8,227,8],fy.static_dtree=[0,5,16,5,8,5,24,5,4,5,20,5,12,5,28,5,2,5,18,5,10,5,26,5,6,5,22,5,14,5,30,5,1,5,17,5,9,5,25,5,5,5,21,5,13,5,29,5,3,5,19,5,11,5,27,5,7,5,23,5],fy.static_l_desc=new fy(fy.static_ltree,Np.extra_lbits,nge+1,S_e,SK),fy.static_d_desc=new fy(fy.static_dtree,Np.extra_dbits,0,T_e,SK),fy.static_bl_desc=new fy(null,Np.extra_blbits,0,I_e,aLt);var dLt=9,pLt=8;function lO(o,t,e,r,i){var n=this;n.good_length=o,n.max_lazy=t,n.nice_length=e,n.max_chain=r,n.func=i}var BKe=0,rge=1,t7=2,F9=[new lO(0,0,0,0,BKe),new lO(4,4,8,4,rge),new lO(4,5,16,8,rge),new lO(4,6,32,32,rge),new lO(4,4,16,16,t7),new lO(8,16,32,32,t7),new lO(8,16,128,128,t7),new lO(8,32,128,256,t7),new lO(32,128,258,1024,t7),new lO(32,258,258,4096,t7)],Jme=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],V9=0,Qme=1,IK=2,ege=3,fLt=32,y_e=42,tge=113,CK=666,b_e=8,mLt=0,P_e=1,gLt=2,u0=3,ige=258,iI=ige+u0+1;function DKe(o,t,e,r){var i=o[t*2],n=o[e*2];return i<n||i==n&&r[t]<=r[e]}function yLt(){var o=this,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v,D,w,F,H,z,G,W,L=new Np,B=new Np,N=new Np;o.depth=[];var U,k,V,Y,X,Z,Q,ae;o.bl_count=[],o.heap=[],z=[],G=[],W=[];function he(){var Fe;for(c=2*n,u[p-1]=0,Fe=0;Fe<p-1;Fe++)u[Fe]=0;v=F9[D].max_lazy,F=F9[D].good_length,H=F9[D].nice_length,R=F9[D].max_chain,C=0,b=0,O=0,P=_=u0-1,I=0,d=0}function re(){var Fe;for(Fe=0;Fe<S_e;Fe++)z[Fe*2]=0;for(Fe=0;Fe<T_e;Fe++)G[Fe*2]=0;for(Fe=0;Fe<I_e;Fe++)W[Fe*2]=0;z[TK*2]=1,o.opt_len=o.static_len=0,V=X=0}function se(){L.dyn_tree=z,L.stat_desc=fy.static_l_desc,B.dyn_tree=G,B.stat_desc=fy.static_d_desc,N.dyn_tree=W,N.stat_desc=fy.static_bl_desc,Q=0,ae=0,Z=8,re()}o.pqdownheap=function(Fe,it){for(var ye=o.heap,bt=ye[it],zt=it<<1;zt<=o.heap_len&&(zt<o.heap_len&&DKe(Fe,ye[zt+1],ye[zt],o.depth)&&zt++,!DKe(Fe,bt,ye[zt],o.depth));)ye[it]=ye[zt],it=zt,zt<<=1;ye[it]=bt};function K(Fe,it){var ye,bt=-1,zt,de=Fe[1],qe=0,lt=7,Ne=4;for(de===0&&(lt=138,Ne=3),Fe[(it+1)*2+1]=65535,ye=0;ye<=it;ye++)zt=de,de=Fe[(ye+1)*2+1],!(++qe<lt&&zt==de)&&(qe<Ne?W[zt*2]+=qe:zt!==0?(zt!=bt&&W[zt*2]++,W[AKe*2]++):qe<=10?W[_Ke*2]++:W[vKe*2]++,qe=0,bt=zt,de===0?(lt=138,Ne=3):zt==de?(lt=6,Ne=3):(lt=7,Ne=4))}function me(){var Fe;for(K(z,L.max_code),K(G,B.max_code),N.build_tree(o),Fe=I_e-1;Fe>=3&&W[Np.bl_order[Fe]*2+1]===0;Fe--);return o.opt_len+=3*(Fe+1)+5+5+4,Fe}function Oe(Fe){o.pending_buf[o.pending++]=Fe}function Ie(Fe){Oe(Fe&255),Oe(Fe>>>8&255)}function ue(Fe){Oe(Fe>>8&255),Oe(Fe&255&255)}function Pe(Fe,it){var ye,bt=it;ae>g_e-bt?(ye=Fe,Q|=ye<<ae&65535,Ie(Q),Q=ye>>>g_e-ae,ae+=bt-g_e):(Q|=Fe<<ae&65535,ae+=bt)}function j(Fe,it){var ye=Fe*2;Pe(it[ye]&65535,it[ye+1]&65535)}function J(Fe,it){var ye,bt=-1,zt,de=Fe[1],qe=0,lt=7,Ne=4;for(de===0&&(lt=138,Ne=3),ye=0;ye<=it;ye++)if(zt=de,de=Fe[(ye+1)*2+1],!(++qe<lt&&zt==de)){if(qe<Ne)do j(zt,W);while(--qe!==0);else zt!==0?(zt!=bt&&(j(zt,W),qe--),j(AKe,W),Pe(qe-3,2)):qe<=10?(j(_Ke,W),Pe(qe-3,3)):(j(vKe,W),Pe(qe-11,7));qe=0,bt=zt,de===0?(lt=138,Ne=3):zt==de?(lt=6,Ne=3):(lt=7,Ne=4)}}function oe(Fe,it,ye){var bt;for(Pe(Fe-257,5),Pe(it-1,5),Pe(ye-4,4),bt=0;bt<ye;bt++)Pe(W[Np.bl_order[bt]*2+1],3);J(z,Fe-1),J(G,it-1)}function pe(){ae==16?(Ie(Q),Q=0,ae=0):ae>=8&&(Oe(Q&255),Q>>>=8,ae-=8)}function ge(){Pe(P_e<<1,3),j(TK,fy.static_ltree),pe(),1+Z+10-ae<9&&(Pe(P_e<<1,3),j(TK,fy.static_ltree),pe()),Z=7}function Se(Fe,it){var ye,bt,zt;if(o.pending_buf[Y+V*2]=Fe>>>8&255,o.pending_buf[Y+V*2+1]=Fe&255,o.pending_buf[U+V]=it&255,V++,Fe===0?z[it*2]++:(X++,Fe--,z[(Np._length_code[it]+nge+1)*2]++,G[Np.d_code(Fe)*2]++),!(V&8191)&&D>2){for(ye=V*8,bt=C-b,zt=0;zt<T_e;zt++)ye+=G[zt*2]*(5+Np.extra_dbits[zt]);if(ye>>>=3,X<Math.floor(V/2)&&ye<Math.floor(bt/2))return!0}return V==k-1}function De(Fe,it){var ye,bt,zt=0,de,qe;if(V!==0)do ye=o.pending_buf[Y+zt*2]<<8&65280|o.pending_buf[Y+zt*2+1]&255,bt=o.pending_buf[U+zt]&255,zt++,ye===0?j(bt,Fe):(de=Np._length_code[bt],j(de+nge+1,Fe),qe=Np.extra_lbits[de],qe!==0&&(bt-=Np.base_length[de],Pe(bt,qe)),ye--,de=Np.d_code(ye),j(de,it),qe=Np.extra_dbits[de],qe!==0&&(ye-=Np.base_dist[de],Pe(ye,qe)));while(zt<V);j(TK,Fe),Z=Fe[TK*2+1]}function tt(){ae>8?Ie(Q):ae>0&&Oe(Q&255),Q=0,ae=0}function Ze(Fe,it,ye){tt(),Z=8,ye&&(Ie(it),Ie(~it)),o.pending_buf.set(l.subarray(Fe,Fe+it),o.pending),o.pending+=it}function Wt(Fe,it,ye){Pe((mLt<<1)+(ye?1:0),3),Ze(Fe,it,!0)}function Nr(Fe,it,ye){var bt,zt,de=0;D>0?(L.build_tree(o),B.build_tree(o),de=me(),bt=o.opt_len+3+7>>>3,zt=o.static_len+3+7>>>3,zt<=bt&&(bt=zt)):bt=zt=it+5,it+4<=bt&&Fe!=-1?Wt(Fe,it,ye):zt==bt?(Pe((P_e<<1)+(ye?1:0),3),De(fy.static_ltree,fy.static_dtree)):(Pe((gLt<<1)+(ye?1:0),3),oe(L.max_code+1,B.max_code+1,de+1),De(z,G)),re(),ye&&tt()}function Lr(Fe){Nr(b>=0?b:-1,C-b,Fe),b=C,t.flush_pending()}function Dr(){var Fe,it,ye,bt;do{if(bt=c-O-C,bt===0&&C===0&&O===0)bt=n;else if(bt==-1)bt--;else if(C>=n+n-iI){l.set(l.subarray(n,n+n),0),E-=n,C-=n,b-=n,Fe=p,ye=Fe;do it=u[--ye]&65535,u[ye]=it>=n?it-n:0;while(--Fe!==0);Fe=n,ye=Fe;do it=h[--ye]&65535,h[ye]=it>=n?it-n:0;while(--Fe!==0);bt+=n}if(t.avail_in===0)return;Fe=t.read_buf(l,C+O,bt),O+=Fe,O>=u0&&(d=l[C]&255,d=(d<<y^l[C+1]&255)&g)}while(O<iI&&t.avail_in!==0)}function Rr(Fe){var it=65535,ye;for(it>r-5&&(it=r-5);;){if(O<=1){if(Dr(),O===0&&Fe==mH)return V9;if(O===0)break}if(C+=O,O=0,ye=b+it,(C===0||C>=ye)&&(O=C-ye,C=ye,Lr(!1),t.avail_out===0)||C-b>=n-iI&&(Lr(!1),t.avail_out===0))return V9}return Lr(Fe==MP),t.avail_out===0?Fe==MP?IK:V9:Fe==MP?ege:Qme}function ke(Fe){var it=R,ye=C,bt,zt,de=_,qe=C>n-iI?C-(n-iI):0,lt=H,Ne=a,et=C+ige,At=l[ye+de-1],dr=l[ye+de];_>=F&&(it>>=2),lt>O&&(lt=O);do if(bt=Fe,!(l[bt+de]!=dr||l[bt+de-1]!=At||l[bt]!=l[ye]||l[++bt]!=l[ye+1])){ye+=2,bt++;do;while(l[++ye]==l[++bt]&&l[++ye]==l[++bt]&&l[++ye]==l[++bt]&&l[++ye]==l[++bt]&&l[++ye]==l[++bt]&&l[++ye]==l[++bt]&&l[++ye]==l[++bt]&&l[++ye]==l[++bt]&&ye<et);if(zt=ige-(et-ye),ye=et-ige,zt>de){if(E=Fe,de=zt,zt>=lt)break;At=l[ye+de-1],dr=l[ye+de]}}while((Fe=h[Fe&Ne]&65535)>qe&&--it!==0);return de<=O?de:O}function Yt(Fe){for(var it=0,ye;;){if(O<iI){if(Dr(),O<iI&&Fe==mH)return V9;if(O===0)break}if(O>=u0&&(d=(d<<y^l[C+(u0-1)]&255)&g,it=u[d]&65535,h[C&a]=u[d],u[d]=C),it!==0&&(C-it&65535)<=n-iI&&w!=Kme&&(P=ke(it)),P>=u0)if(ye=Se(C-E,P-u0),O-=P,P<=v&&O>=u0){P--;do C++,d=(d<<y^l[C+(u0-1)]&255)&g,it=u[d]&65535,h[C&a]=u[d],u[d]=C;while(--P!==0);C++}else C+=P,P=0,d=l[C]&255,d=(d<<y^l[C+1]&255)&g;else ye=Se(0,l[C]&255),O--,C++;if(ye&&(Lr(!1),t.avail_out===0))return V9}return Lr(Fe==MP),t.avail_out===0?Fe==MP?IK:V9:Fe==MP?ege:Qme}function Ut(Fe){for(var it=0,ye,bt;;){if(O<iI){if(Dr(),O<iI&&Fe==mH)return V9;if(O===0)break}if(O>=u0&&(d=(d<<y^l[C+(u0-1)]&255)&g,it=u[d]&65535,h[C&a]=u[d],u[d]=C),_=P,T=E,P=u0-1,it!==0&&_<v&&(C-it&65535)<=n-iI&&(w!=Kme&&(P=ke(it)),P<=5&&(w==lLt||P==u0&&C-E>4096)&&(P=u0-1)),_>=u0&&P<=_){bt=C+O-u0,ye=Se(C-1-T,_-u0),O-=_-1,_-=2;do++C<=bt&&(d=(d<<y^l[C+(u0-1)]&255)&g,it=u[d]&65535,h[C&a]=u[d],u[d]=C);while(--_!==0);if(I=0,P=u0-1,C++,ye&&(Lr(!1),t.avail_out===0))return V9}else if(I!==0){if(ye=Se(0,l[C-1]&255),ye&&Lr(!1),C++,O--,t.avail_out===0)return V9}else I=1,C++,O--}return I!==0&&(ye=Se(0,l[C-1]&255),I=0),Lr(Fe==MP),t.avail_out===0?Fe==MP?IK:V9:Fe==MP?ege:Qme}function ar(Fe){return Fe.total_in=Fe.total_out=0,Fe.msg=null,o.pending=0,o.pending_out=0,e=tge,i=mH,se(),he(),U9}o.deflateInit=function(Fe,it,ye,bt,zt,de){return bt||(bt=b_e),zt||(zt=pLt),de||(de=cLt),Fe.msg=null,it==oge&&(it=6),zt<1||zt>dLt||bt!=b_e||ye<9||ye>15||it<0||it>9||de<0||de>Kme?H9:(Fe.dstate=o,s=ye,n=1<<s,a=n-1,m=zt+7,p=1<<m,g=p-1,y=Math.floor((m+u0-1)/u0),l=new Uint8Array(n*2),h=[],u=[],k=1<<zt+6,o.pending_buf=new Uint8Array(k*4),r=k*4,Y=Math.floor(k/2),U=3*k,D=it,w=de,ar(Fe))},o.deflateEnd=function(){return e!=y_e&&e!=tge&&e!=CK?H9:(o.pending_buf=null,u=null,h=null,l=null,o.dstate=null,e==tge?uLt:U9)},o.deflateParams=function(Fe,it,ye){var bt=U9;return it==oge&&(it=6),it<0||it>9||ye<0||ye>Kme?H9:(F9[D].func!=F9[it].func&&Fe.total_in!==0&&(bt=Fe.deflate(xKe)),D!=it&&(D=it,v=F9[D].max_lazy,F=F9[D].good_length,H=F9[D].nice_length,R=F9[D].max_chain),w=ye,bt)},o.deflateSetDictionary=function(Fe,it,ye){var bt=ye,zt,de=0;if(!it||e!=y_e)return H9;if(bt<u0)return U9;for(bt>n-iI&&(bt=n-iI,de=ye-bt),l.set(it.subarray(de,de+bt),0),C=bt,b=bt,d=l[0]&255,d=(d<<y^l[1]&255)&g,zt=0;zt<=bt-u0;zt++)d=(d<<y^l[zt+(u0-1)]&255)&g,h[zt&a]=u[d],u[d]=zt;return U9},o.deflate=function(Fe,it){var ye,bt,zt,de,qe;if(it>MP||it<0)return H9;if(!Fe.next_out||!Fe.next_in&&Fe.avail_in!==0||e==CK&&it!=MP)return Fe.msg=Jme[Zme-H9],H9;if(Fe.avail_out===0)return Fe.msg=Jme[Zme-fH],fH;if(t=Fe,de=i,i=it,e==y_e&&(bt=b_e+(s-8<<4)<<8,zt=(D-1&255)>>1,zt>3&&(zt=3),bt|=zt<<6,C!==0&&(bt|=fLt),bt+=31-bt%31,e=tge,ue(bt)),o.pending!==0){if(t.flush_pending(),t.avail_out===0)return i=-1,U9}else if(t.avail_in===0&&it<=de&&it!=MP)return t.msg=Jme[Zme-fH],fH;if(e==CK&&t.avail_in!==0)return Fe.msg=Jme[Zme-fH],fH;if(t.avail_in!==0||O!==0||it!=mH&&e!=CK){switch(qe=-1,F9[D].func){case BKe:qe=Rr(it);break;case rge:qe=Yt(it);break;case t7:qe=Ut(it);break;default:}if((qe==IK||qe==ege)&&(e=CK),qe==V9||qe==IK)return t.avail_out===0&&(i=-1),U9;if(qe==Qme){if(it==xKe)ge();else if(Wt(0,0,!1),it==hLt)for(ye=0;ye<p;ye++)u[ye]=0;if(t.flush_pending(),t.avail_out===0)return i=-1,U9}}return it!=MP?U9:kKe}}function FKe(){var o=this;o.next_in_index=0,o.next_out_index=0,o.avail_in=0,o.total_in=0,o.avail_out=0,o.total_out=0}FKe.prototype={deflateInit:function(o,t){var e=this;return e.dstate=new yLt,t||(t=SK),e.dstate.deflateInit(e,o,t)},deflate:function(o){var t=this;return t.dstate?t.dstate.deflate(t,o):H9},deflateEnd:function(){var o=this;if(!o.dstate)return H9;var t=o.dstate.deflateEnd();return o.dstate=null,t},deflateParams:function(o,t){var e=this;return e.dstate?e.dstate.deflateParams(e,o,t):H9},deflateSetDictionary:function(o,t){var e=this;return e.dstate?e.dstate.deflateSetDictionary(e,o,t):H9},read_buf:function(o,t,e){var r=this,i=r.avail_in;return i>e&&(i=e),i===0?0:(r.avail_in-=i,o.set(r.next_in.subarray(r.next_in_index,r.next_in_index+i),t),r.next_in_index+=i,r.total_in+=i,i)},flush_pending:function(){var o=this,t=o.dstate.pending;t>o.avail_out&&(t=o.avail_out),t!==0&&(o.next_out.set(o.dstate.pending_buf.subarray(o.dstate.pending_out,o.dstate.pending_out+t),o.next_out_index),o.next_out_index+=t,o.dstate.pending_out+=t,o.total_out+=t,o.avail_out-=t,o.dstate.pending-=t,o.dstate.pending===0&&(o.dstate.pending_out=0))}};function C_e(o){var t=this,e=new FKe,r=512,i=mH,n=new Uint8Array(r),s=o?o.level:oge;typeof s>"u"&&(s=oge),e.deflateInit(s),e.next_out=n,t.append=function(a,l){var c,h=[],u=0,d=0,p=0,m;if(a.length){e.next_in_index=0,e.next_in=a,e.avail_in=a.length;do{if(e.next_out_index=0,e.avail_out=r,c=e.deflate(i),c!=U9)throw new Error("deflating: "+e.msg);e.next_out_index&&(e.next_out_index==r?h.push(new Uint8Array(n)):h.push(new Uint8Array(n.subarray(0,e.next_out_index)))),p+=e.next_out_index,l&&e.next_in_index>0&&e.next_in_index!=u&&(l(e.next_in_index),u=e.next_in_index)}while(e.avail_in>0||e.avail_out===0);return m=new Uint8Array(p),h.forEach(function(g){m.set(g,d),d+=g.length}),m}},t.flush=function(){var a,l=[],c=0,h=0,u;do{if(e.next_out_index=0,e.avail_out=r,a=e.deflate(MP),a!=kKe&&a!=U9)throw new Error("deflating: "+e.msg);r-e.avail_out>0&&l.push(new Uint8Array(n.subarray(0,e.next_out_index))),h+=e.next_out_index}while(e.avail_in>0||e.avail_out===0);return e.deflateEnd(),u=new Uint8Array(h),l.forEach(function(d){u.set(d,c),c+=d.length}),u}}var bLt={Arial:{bbox:"-665 -325 2000 1006",flags:"32",stemV:"80",italicAngle:"0",ascender:"1006",decender:"-325",capHeight:"500",widths:"278 278 355 556 556 889 667 191 333 333 389 584 278 333 278 278 556 556 556 556 556 556 556 556 556 556 278 278 584 584 584 556 1015 667 667 722 722 667 611 778 722 278 500 667 556 833 722 778 667 778 722 667 611 722 667 944 667 667 611 278 278 278 469 556 333 556 556 500 556 556 278 556 556 222 222 500 222 833 556 556 556 556 333 500 278 556 500 722 500 500 500 334 260 334 584 500 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 278 333 556 556 556 556 260 556 333 737 370 556 584 333 737 552 400 549 333 333 333 576 537 333 333 333 365 556 834 834 834 611 667 667 667 667 667 667 1000 722 667 667 667 667 278 278 278 278 722 722 778 778 778 778 778 584 778 722 722 722 722 667 667 611 556 556 556 556 556 556 889 500 556 556 556 556 278 278 278 278 556 556 556 556 556 556 556 549 611 556 556 556 556 500 556 500",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:879},{start:884,end:885},{start:890,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:976,end:1299},{start:1306,end:1309},{start:1425,end:1479},{start:1488,end:1514},{start:1520,end:1524},{start:1536,end:1539},{start:1547,end:1557},{start:1563,end:1563},{start:1566,end:1567},{start:1569,end:1594},{start:1600,end:1630},{start:1632,end:1791},{start:1872,end:1901},{start:7424,end:7626},{start:7678,end:7835},{start:7838,end:7838},{start:7840,end:7929},{start:7936,end:7957},{start:7960,end:7965},{start:7968,end:8005},{start:8008,end:8013},{start:8016,end:8023},{start:8025,end:8025},{start:8027,end:8027},{start:8029,end:8029},{start:8031,end:8061},{start:8064,end:8116},{start:8118,end:8132},{start:8134,end:8147},{start:8150,end:8155},{start:8157,end:8175},{start:8178,end:8180},{start:8182,end:8190},{start:8192,end:8207},{start:8210,end:8226},{start:8230,end:8230},{start:8234,end:8240},{start:8242,end:8244},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8286,end:8286},{start:8298,end:8303},{start:8319,end:8319},{start:8336,end:8340},{start:8352,end:8373},{start:8376,end:8376},{start:8432,end:8432},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8471},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8525,end:8526},{start:8531,end:8532},{start:8539,end:8542},{start:8580,end:8580},{start:8592,end:8597},{start:8616,end:8616},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8725,end:8725},{start:8729,end:8730},{start:8734,end:8735},{start:8745,end:8745},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:8962,end:8962},{start:8976,end:8976},{start:8992,end:8993},{start:9472,end:9472},{start:9474,end:9474},{start:9484,end:9484},{start:9488,end:9488},{start:9492,end:9492},{start:9496,end:9496},{start:9500,end:9500},{start:9508,end:9508},{start:9516,end:9516},{start:9524,end:9524},{start:9532,end:9532},{start:9552,end:9580},{start:9600,end:9600},{start:9604,end:9604},{start:9608,end:9608},{start:9612,end:9612},{start:9616,end:9619},{start:9632,end:9633},{start:9642,end:9644},{start:9650,end:9650},{start:9658,end:9658},{start:9660,end:9660},{start:9668,end:9668},{start:9674,end:9676},{start:9679,end:9679},{start:9688,end:9689},{start:9702,end:9702},{start:9786,end:9788},{start:9792,end:9792},{start:9794,end:9794},{start:9824,end:9824},{start:9827,end:9827},{start:9829,end:9830},{start:9834,end:9835},{start:9839,end:9839},{start:11360,end:11373},{start:11377,end:11383},{start:11799,end:11799},{start:42775,end:42785},{start:42888,end:42892},{start:64257,end:64258},{start:64285,end:64310},{start:64312,end:64316},{start:64318,end:64318},{start:64320,end:64321},{start:64323,end:64324},{start:64326,end:64433},{start:64467,end:64489},{start:64508,end:64511},{start:64606,end:64610},{start:64830,end:64831},{start:65010,end:65010},{start:65020,end:65020},{start:65056,end:65059},{start:65152,end:65276},{start:65532,end:65532}]},Verdana:{bbox:"-559 -303 1446 1050",flags:"32",stemV:"0",italicAngle:"0",ascender:"1005",decender:"-209",capHeight:"727",widths:"351 393 458 818 635 1076 726 268 454 454 635 818 363 454 363 454 635 635 635 635 635 635 635 635 635 635 454 454 818 818 818 545 1000 683 685 698 770 632 574 775 751 420 454 692 556 842 748 787 603 787 695 683 616 731 683 988 685 615 685 454 454 454 818 635 635 600 623 520 623 595 351 623 632 274 344 591 274 972 632 606 623 623 426 520 394 632 591 818 591 591 525 634 454 634 818 632 635 545 268 635 458 818 635 635 635 1521 683 454 1069 545 685 545 545 268 268 458 458 545 635 1000 635 976 520 454 981 545 525 615 351 393 635 635 635 635 454 635 635 1000 545 644 818 454 1000 635 541 818 541 541 635 641 635 363 635 541 545 644 1000 1000 1000 545 683 683 683 683 683 683 984 698 632 632 632 632 420 420 420 420 775 748 787 787 787 787 787 818 787 731 731 731 731 615 605 620 600 600 600 600 600 600 955 520 595 595 595 595 274 274 274 274 611 632 606 606 606 606 606 818 606 632 632 632 632 591 623 591",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:383},{start:399,end:399},{start:402,end:402},{start:416,end:417},{start:431,end:432},{start:506,end:511},{start:536,end:539},{start:601,end:601},{start:710,end:711},{start:713,end:713},{start:728,end:733},{start:768,end:769},{start:771,end:771},{start:777,end:777},{start:803,end:803},{start:819,end:819},{start:839,end:839},{start:894,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:1025,end:1103},{start:1105,end:1119},{start:1144,end:1145},{start:1148,end:1149},{start:1159,end:1159},{start:1168,end:1171},{start:1174,end:1175},{start:1178,end:1181},{start:1186,end:1187},{start:1192,end:1193},{start:1198,end:1203},{start:1208,end:1215},{start:1240,end:1241},{start:1256,end:1257},{start:1306,end:1309},{start:1380,end:1380},{start:1408,end:1408},{start:3647,end:3647},{start:7808,end:7813},{start:7838,end:7838},{start:7840,end:7929},{start:8210,end:8213},{start:8215,end:8226},{start:8230,end:8230},{start:8239,end:8240},{start:8242,end:8244},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8308,end:8309},{start:8311,end:8312},{start:8319,end:8319},{start:8352,end:8373},{start:8376,end:8376},{start:8432,end:8432},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8470},{start:8480,end:8480},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8539,end:8542},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8725,end:8725},{start:8729,end:8730},{start:8734,end:8734},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:9472,end:9472},{start:9474,end:9474},{start:9484,end:9484},{start:9488,end:9488},{start:9492,end:9492},{start:9496,end:9496},{start:9633,end:9633},{start:9642,end:9643},{start:9674,end:9674},{start:9679,end:9679},{start:9702,end:9702},{start:9834,end:9834},{start:11373,end:11373},{start:11377,end:11379},{start:42779,end:42783},{start:42888,end:42892},{start:64257,end:64258},{start:65509,end:65510},{start:65533,end:65533}]},ArialBlack:{bbox:"-193 -306 1687 1083",flags:"32",stemV:"180",italicAngle:"0",ascender:"1100",decender:"-309",capHeight:"0",widths:"333 333 500 660 666 1000 889 277 389 389 556 660 333 333 333 277 666 666 666 666 666 666 666 666 666 666 333 333 660 660 660 610 740 777 777 777 777 722 666 833 833 389 666 833 666 943 833 833 722 833 777 722 722 833 777 1000 777 777 722 389 277 389 660 500 333 666 666 666 666 666 389 666 666 333 333 666 333 1000 666 666 666 666 443 610 443 666 610 943 666 610 556 389 277 389 660 666 666 500 277 666 500 1000 666 666 333 1000 722 333 1000 500 722 500 500 277 277 500 500 500 500 1000 333 950 610 333 1000 500 556 777 333 333 666 666 660 666 277 666 333 799 399 666 660 333 799 500 399 660 399 399 333 666 850 333 333 399 399 666 1000 1000 1000 610 777 777 777 777 777 777 1000 777 722 722 722 722 389 389 389 389 777 833 833 833 833 833 833 660 833 833 833 833 833 777 722 666 666 666 666 666 666 666 1000 666 666 666 666 666 333 333 333 333 666 666 666 666 666 666 666 660 666 666 666 666 666 610 666 610",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:383},{start:402,end:402},{start:506,end:511},{start:536,end:539},{start:710,end:711},{start:713,end:713},{start:728,end:733},{start:894,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:1025,end:1036},{start:1038,end:1103},{start:1105,end:1116},{start:1118,end:1119},{start:1168,end:1169},{start:7808,end:7813},{start:7922,end:7923},{start:8211,end:8213},{start:8215,end:8222},{start:8224,end:8226},{start:8230,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8308,end:8309},{start:8311,end:8312},{start:8319,end:8319},{start:8355,end:8356},{start:8359,end:8359},{start:8364,end:8364},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8470},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8539,end:8542},{start:8592,end:8597},{start:8616,end:8616},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8725,end:8725},{start:8729,end:8730},{start:8734,end:8735},{start:8745,end:8745},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:8962,end:8962},{start:8976,end:8976},{start:8992,end:8993},{start:9472,end:9472},{start:9474,end:9474},{start:9484,end:9484},{start:9488,end:9488},{start:9492,end:9492},{start:9496,end:9496},{start:9500,end:9500},{start:9508,end:9508},{start:9516,end:9516},{start:9524,end:9524},{start:9532,end:9532},{start:9552,end:9580},{start:9600,end:9600},{start:9604,end:9604},{start:9608,end:9608},{start:9612,end:9612},{start:9616,end:9619},{start:9632,end:9633},{start:9642,end:9644},{start:9650,end:9650},{start:9658,end:9658},{start:9660,end:9660},{start:9668,end:9668},{start:9674,end:9675},{start:9679,end:9679},{start:9688,end:9689},{start:9702,end:9702},{start:9786,end:9788},{start:9792,end:9792},{start:9794,end:9794},{start:9824,end:9824},{start:9827,end:9827},{start:9829,end:9830},{start:9834,end:9835},{start:64257,end:64258}]},ArialNarrow:{bbox:"-182 -306 999 1085",flags:"32",stemV:"0",italicAngle:"0",ascender:"935",decender:"-211",capHeight:"0",widths:"228 228 291 456 456 729 546 157 272 272 318 479 228 272 228 228 456 456 456 456 456 456 456 456 456 456 228 228 479 479 479 456 832 546 546 591 591 546 500 638 591 228 410 546 456 683 591 638 546 638 591 546 500 591 546 773 546 546 500 228 228 228 384 456 272 456 456 410 456 456 228 456 456 182 182 410 182 683 456 456 456 456 272 410 228 456 410 591 410 410 410 273 212 273 479 456 456 287 182 456 272 819 456 456 272 819 546 272 819 287 500 287 287 182 182 272 272 287 456 819 272 819 410 272 773 287 410 546 228 272 456 456 456 456 212 456 272 604 303 456 479 272 604 500 399 548 272 272 272 576 439 271 272 272 298 456 684 684 684 500 546 546 546 546 546 546 819 591 546 546 546 546 228 228 228 228 591 591 638 638 638 638 638 479 638 591 591 591 591 546 546 500 456 456 456 456 456 456 729 410 456 456 456 456 228 228 228 228 456 456 456 456 456 456 456 548 500 456 456 456 456 410 456 410",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:383},{start:402,end:402},{start:506,end:511},{start:536,end:539},{start:710,end:711},{start:713,end:713},{start:728,end:733},{start:894,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:1025,end:1036},{start:1038,end:1103},{start:1105,end:1116},{start:1118,end:1119},{start:1168,end:1169},{start:7808,end:7813},{start:7922,end:7923},{start:8211,end:8213},{start:8215,end:8222},{start:8224,end:8226},{start:8230,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8319,end:8319},{start:8355,end:8356},{start:8359,end:8359},{start:8364,end:8364},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8470},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8539,end:8542},{start:8592,end:8597},{start:8616,end:8616},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8725,end:8725},{start:8729,end:8730},{start:8734,end:8735},{start:8745,end:8745},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:8962,end:8962},{start:8976,end:8976},{start:8992,end:8993},{start:9472,end:9472},{start:9474,end:9474},{start:9484,end:9484},{start:9488,end:9488},{start:9492,end:9492},{start:9496,end:9496},{start:9500,end:9500},{start:9508,end:9508},{start:9516,end:9516},{start:9524,end:9524},{start:9532,end:9532},{start:9552,end:9580},{start:9600,end:9600},{start:9604,end:9604},{start:9608,end:9608},{start:9612,end:9612},{start:9616,end:9619},{start:9632,end:9633},{start:9642,end:9644},{start:9650,end:9650},{start:9658,end:9658},{start:9660,end:9660},{start:9668,end:9668},{start:9674,end:9675},{start:9679,end:9679},{start:9688,end:9689},{start:9702,end:9702},{start:9786,end:9788},{start:9792,end:9792},{start:9794,end:9794},{start:9824,end:9824},{start:9827,end:9827},{start:9829,end:9830},{start:9834,end:9835},{start:64257,end:64258}]},Tahoma:{bbox:"-599 -215 1515 1034",flags:"32",stemV:"0",italicAngle:"0",ascender:"1000",decender:"-206",capHeight:"727",widths:"312 332 401 727 545 976 673 210 382 382 545 727 302 363 302 382 545 545 545 545 545 545 545 545 545 545 353 353 727 727 727 473 909 599 589 600 678 561 521 667 675 373 416 587 497 770 667 707 551 707 620 557 583 655 596 901 580 576 559 382 382 382 727 545 545 524 552 461 552 526 318 552 557 228 281 498 228 839 557 542 552 552 360 446 334 557 498 742 495 498 444 480 382 480 727 557 545 454 210 545 397 817 545 545 545 1390 557 382 976 454 559 454 454 210 210 401 401 454 545 909 545 875 446 382 908 454 444 576 312 332 545 545 545 545 382 545 545 928 493 573 727 363 928 545 470 727 493 493 545 567 545 353 545 493 493 573 1000 1000 1000 473 599 599 599 599 599 599 913 600 561 561 561 561 373 373 373 373 698 667 707 707 707 707 707 727 707 655 655 655 655 576 565 548 524 524 524 524 524 524 879 461 526 526 526 526 228 228 228 228 545 557 542 542 542 542 542 727 542 557 557 557 557 498 552 498",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:831},{start:834,end:879},{start:884,end:885},{start:890,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:976,end:1016},{start:1020,end:1299},{start:1306,end:1309},{start:1329,end:1366},{start:1369,end:1375},{start:1377,end:1415},{start:1417,end:1418},{start:1425,end:1479},{start:1488,end:1514},{start:1520,end:1524},{start:1536,end:1539},{start:1547,end:1557},{start:1563,end:1563},{start:1566,end:1567},{start:1569,end:1594},{start:1600,end:1630},{start:1632,end:1791},{start:1872,end:1901},{start:3585,end:3642},{start:3647,end:3675},{start:7424,end:7626},{start:7678,end:7835},{start:7838,end:7838},{start:7840,end:7929},{start:7936,end:7957},{start:7960,end:7965},{start:7968,end:8005},{start:8008,end:8013},{start:8016,end:8023},{start:8025,end:8025},{start:8027,end:8027},{start:8029,end:8029},{start:8031,end:8061},{start:8064,end:8116},{start:8118,end:8132},{start:8134,end:8147},{start:8150,end:8155},{start:8157,end:8175},{start:8178,end:8180},{start:8182,end:8190},{start:8192,end:8207},{start:8210,end:8226},{start:8230,end:8230},{start:8239,end:8240},{start:8242,end:8244},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8286,end:8286},{start:8319,end:8319},{start:8336,end:8340},{start:8352,end:8373},{start:8432,end:8432},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8470},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8525,end:8526},{start:8539,end:8542},{start:8580,end:8580},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8729,end:8730},{start:8734,end:8734},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:9633,end:9633},{start:9642,end:9643},{start:9674,end:9674},{start:9676,end:9676},{start:9679,end:9679},{start:9702,end:9702},{start:9839,end:9839},{start:11360,end:11373},{start:11377,end:11383},{start:11799,end:11799},{start:42775,end:42785},{start:42888,end:42892},{start:64257,end:64258},{start:64285,end:64310},{start:64312,end:64316},{start:64318,end:64318},{start:64320,end:64321},{start:64323,end:64324},{start:64326,end:64433},{start:64467,end:64489},{start:64508,end:64511},{start:64606,end:64610},{start:64830,end:64831},{start:65010,end:65010},{start:65020,end:65020},{start:65056,end:65059},{start:65152,end:65276},{start:65532,end:65533}]},CourierNew:{bbox:"-121 -679 622 1020",flags:"33",stemV:"0",italicAngle:"0",ascender:"832",decender:"-300",capHeight:"571",widths:"600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:566},{start:568,end:740},{start:748,end:879},{start:884,end:885},{start:890,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:976,end:1299},{start:1306,end:1309},{start:1425,end:1479},{start:1488,end:1514},{start:1520,end:1524},{start:1536,end:1539},{start:1547,end:1557},{start:1563,end:1563},{start:1566,end:1567},{start:1569,end:1594},{start:1600,end:1630},{start:1632,end:1791},{start:1872,end:1901},{start:7424,end:7626},{start:7678,end:7829},{start:7831,end:7835},{start:7838,end:7838},{start:7840,end:7929},{start:7936,end:7957},{start:7960,end:7965},{start:7968,end:8005},{start:8008,end:8013},{start:8016,end:8023},{start:8025,end:8025},{start:8027,end:8027},{start:8029,end:8029},{start:8031,end:8061},{start:8064,end:8116},{start:8118,end:8132},{start:8134,end:8147},{start:8150,end:8155},{start:8157,end:8175},{start:8178,end:8180},{start:8182,end:8190},{start:8204,end:8207},{start:8210,end:8213},{start:8215,end:8226},{start:8230,end:8230},{start:8240,end:8240},{start:8242,end:8244},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8286,end:8286},{start:8319,end:8319},{start:8336,end:8340},{start:8352,end:8373},{start:8432,end:8432},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8470},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8525,end:8526},{start:8531,end:8532},{start:8539,end:8542},{start:8580,end:8580},{start:8592,end:8597},{start:8616,end:8616},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8725,end:8725},{start:8729,end:8730},{start:8734,end:8735},{start:8745,end:8745},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:8962,end:8962},{start:8976,end:8976},{start:8992,end:8993},{start:9472,end:9472},{start:9474,end:9474},{start:9484,end:9484},{start:9488,end:9488},{start:9492,end:9492},{start:9496,end:9496},{start:9500,end:9500},{start:9508,end:9508},{start:9516,end:9516},{start:9524,end:9524},{start:9532,end:9532},{start:9552,end:9580},{start:9600,end:9600},{start:9604,end:9604},{start:9608,end:9608},{start:9612,end:9612},{start:9616,end:9619},{start:9632,end:9633},{start:9642,end:9644},{start:9650,end:9650},{start:9658,end:9658},{start:9660,end:9660},{start:9668,end:9668},{start:9674,end:9676},{start:9679,end:9679},{start:9688,end:9689},{start:9702,end:9702},{start:9786,end:9788},{start:9792,end:9792},{start:9794,end:9794},{start:9824,end:9824},{start:9827,end:9827},{start:9829,end:9830},{start:9834,end:9835},{start:9839,end:9839},{start:11360,end:11373},{start:11377,end:11383},{start:11799,end:11799},{start:42775,end:42785},{start:42888,end:42892},{start:64257,end:64258},{start:64285,end:64310},{start:64312,end:64316},{start:64318,end:64318},{start:64320,end:64321},{start:64323,end:64324},{start:64326,end:64433},{start:64467,end:64489},{start:64508,end:64511},{start:64520,end:64521},{start:64526,end:64526},{start:64530,end:64530},{start:64561,end:64562},{start:64575,end:64580},{start:64590,end:64591},{start:64600,end:64601},{start:64606,end:64610},{start:64618,end:64618},{start:64621,end:64624},{start:64627,end:64629},{start:64654,end:64655},{start:64657,end:64657},{start:64660,end:64660},{start:64668,end:64678},{start:64680,end:64680},{start:64682,end:64682},{start:64684,end:64684},{start:64688,end:64688},{start:64713,end:64726},{start:64728,end:64728},{start:64730,end:64733},{start:64816,end:64816},{start:64828,end:64831},{start:64904,end:64904},{start:65010,end:65010},{start:65020,end:65020},{start:65056,end:65059},{start:65152,end:65276},{start:65279,end:65279},{start:65532,end:65532}]},MSGothic:{bbox:"-121 -136 996 859",flags:"33",stemV:"0",italicAngle:"0",ascender:"859",decender:"-140",capHeight:"679",widths:"500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 1000 1000 1000 500 1000 500 500 500 500 500 500 500 1000 1000 1000 1000 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 1000 1000 500 500 500 500 500 500 500 1000 1000 500 500 1000 500 1000 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 1000 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 1000 500 500 500 500 500 500 500 500",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:383},{start:402,end:402},{start:506,end:511},{start:536,end:539},{start:710,end:711},{start:713,end:713},{start:728,end:733},{start:894,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:1025,end:1036},{start:1038,end:1103},{start:1105,end:1116},{start:1118,end:1119},{start:1168,end:1169},{start:7808,end:7813},{start:7922,end:7923},{start:8211,end:8213},{start:8215,end:8222},{start:8224,end:8226},{start:8230,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8308,end:8309},{start:8311,end:8312},{start:8319,end:8319},{start:8355,end:8356},{start:8359,end:8359},{start:8364,end:8364},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8470},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8539,end:8542},{start:8592,end:8597},{start:8616,end:8616},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8725,end:8725},{start:8729,end:8730},{start:8734,end:8735},{start:8745,end:8745},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:8962,end:8962},{start:8976,end:8976},{start:8992,end:8993},{start:9472,end:9472},{start:9474,end:9474},{start:9484,end:9484},{start:9488,end:9488},{start:9492,end:9492},{start:9496,end:9496},{start:9500,end:9500},{start:9508,end:9508},{start:9516,end:9516},{start:9524,end:9524},{start:9532,end:9532},{start:9552,end:9580},{start:9600,end:9600},{start:9604,end:9604},{start:9608,end:9608},{start:9612,end:9612},{start:9616,end:9619},{start:9632,end:9633},{start:9642,end:9644},{start:9650,end:9650},{start:9658,end:9658},{start:9660,end:9660},{start:9668,end:9668},{start:9674,end:9675},{start:9679,end:9679},{start:9688,end:9689},{start:9702,end:9702},{start:9786,end:9788},{start:9792,end:9792},{start:9794,end:9794},{start:9824,end:9824},{start:9827,end:9827},{start:9829,end:9830},{start:9834,end:9835},{start:64257,end:64258}]},SimHei:{bbox:"-11 -156 996 859",flags:"32",stemV:"0",italicAngle:"0",ascender:"859",decender:"-140",capHeight:"687",widths:"1 95 500 738 813 1000",ordering:"GB1",registry:"Adobe",supplement:"2",encoding:"UniGB-UCS2-H",ranges:[{start:32,end:126},{start:164,end:164},{start:167,end:168},{start:176,end:177},{start:183,end:183},{start:215,end:215},{start:224,end:225},{start:232,end:234},{start:236,end:237},{start:242,end:243},{start:247,end:247},{start:249,end:250},{start:252,end:252},{start:257,end:257},{start:275,end:275},{start:283,end:283},{start:299,end:299},{start:324,end:324},{start:328,end:328},{start:333,end:333},{start:363,end:363},{start:462,end:462},{start:464,end:464},{start:466,end:466},{start:468,end:468},{start:470,end:470},{start:472,end:472},{start:474,end:474},{start:476,end:476},{start:505,end:505},{start:593,end:593},{start:609,end:609},{start:711,end:711},{start:713,end:715},{start:729,end:729},{start:913,end:929},{start:931,end:937},{start:945,end:961},{start:963,end:969},{start:1025,end:1025},{start:1040,end:1103},{start:1105,end:1105},{start:8208,end:8208},{start:8211,end:8214},{start:8216,end:8217},{start:8220,end:8221},{start:8229,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8245,end:8245},{start:8251,end:8251},{start:8364,end:8364},{start:8451,end:8451},{start:8453,end:8453},{start:8457,end:8457},{start:8470,end:8470},{start:8481,end:8481},{start:8544,end:8555},{start:8560,end:8569},{start:8592,end:8595},{start:8598,end:8601},{start:8712,end:8712},{start:8719,end:8719},{start:8721,end:8721},{start:8725,end:8725},{start:8730,end:8730},{start:8733,end:8736},{start:8739,end:8739},{start:8741,end:8741},{start:8743,end:8747},{start:8750,end:8750},{start:8756,end:8759},{start:8765,end:8765},{start:8776,end:8776},{start:8780,end:8780},{start:8786,end:8786},{start:8800,end:8801},{start:8804,end:8807},{start:8814,end:8815},{start:8853,end:8853},{start:8857,end:8857},{start:8869,end:8869},{start:8895,end:8895},{start:8978,end:8978},{start:9312,end:9321},{start:9332,end:9371},{start:9472,end:9547},{start:9552,end:9587},{start:9601,end:9615},{start:9619,end:9621},{start:9632,end:9633},{start:9650,end:9651},{start:9660,end:9661},{start:9670,end:9671},{start:9675,end:9675},{start:9678,end:9679},{start:9698,end:9701},{start:9733,end:9734},{start:9737,end:9737},{start:9792,end:9792},{start:9794,end:9794},{start:11905,end:11905},{start:11908,end:11908},{start:11912,end:11912},{start:11915,end:11916},{start:11927,end:11927},{start:11943,end:11943},{start:11946,end:11946},{start:11950,end:11950},{start:11955,end:11955},{start:11958,end:11959},{start:11963,end:11963},{start:11978,end:11978},{start:12272,end:12283},{start:12288,end:12291},{start:12293,end:12311},{start:12317,end:12318},{start:12321,end:12329},{start:12350,end:12350},{start:12353,end:12435},{start:12443,end:12446},{start:12449,end:12534},{start:12540,end:12542},{start:12549,end:12585},{start:12832,end:12841},{start:12849,end:12849},{start:12963,end:12963},{start:13198,end:13199},{start:13212,end:13214},{start:13217,end:13217},{start:13252,end:13252},{start:13262,end:13262},{start:13265,end:13266},{start:13269,end:13269},{start:13312,end:19893},{start:19968,end:40869},{start:59277,end:59286},{start:59335,end:59335},{start:59414,end:59416},{start:59422,end:59422},{start:59430,end:59430},{start:59435,end:59436},{start:59441,end:59442},{start:59451,end:59451},{start:59459,end:59459},{start:59476,end:59477},{start:59492,end:59492},{start:63788,end:63788},{start:63865,end:63865},{start:63893,end:63893},{start:63975,end:63975},{start:63985,end:63985},{start:64012,end:64015},{start:64017,end:64017},{start:64019,end:64020},{start:64024,end:64024},{start:64031,end:64033},{start:64035,end:64036},{start:64039,end:64041},{start:65072,end:65073},{start:65075,end:65092},{start:65097,end:65106},{start:65108,end:65111},{start:65113,end:65126},{start:65128,end:65131},{start:65281,end:65374},{start:65504,end:65509}],widthOfString:(o,t)=>{let e=0;for(let r=0;r<o.length;r++)e+=/[^\x00-\x7f]/.test(o[r])?1:.5;return e*t}},SimSun:{bbox:"-8 -145 1000 859",flags:"32",stemV:"0",italicAngle:"0",ascender:"859",decender:"-141",capHeight:"175",widths:"1 95 500",ordering:"GB1",registry:"Adobe",supplement:"2",encoding:"UniGB-UCS2-H",ranges:[{start:32,end:126},{start:164,end:164},{start:167,end:168},{start:176,end:177},{start:183,end:183},{start:215,end:215},{start:224,end:225},{start:232,end:234},{start:236,end:237},{start:242,end:243},{start:247,end:247},{start:249,end:250},{start:252,end:252},{start:257,end:257},{start:275,end:275},{start:283,end:283},{start:299,end:299},{start:324,end:324},{start:328,end:328},{start:333,end:333},{start:363,end:363},{start:462,end:462},{start:464,end:464},{start:466,end:466},{start:468,end:468},{start:470,end:470},{start:472,end:472},{start:474,end:474},{start:476,end:476},{start:505,end:505},{start:593,end:593},{start:609,end:609},{start:711,end:711},{start:713,end:715},{start:729,end:729},{start:913,end:929},{start:931,end:937},{start:945,end:961},{start:963,end:969},{start:1025,end:1025},{start:1040,end:1103},{start:1105,end:1105},{start:8208,end:8208},{start:8211,end:8214},{start:8216,end:8217},{start:8220,end:8221},{start:8229,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8245,end:8245},{start:8251,end:8251},{start:8364,end:8364},{start:8451,end:8451},{start:8453,end:8453},{start:8457,end:8457},{start:8470,end:8470},{start:8481,end:8481},{start:8544,end:8555},{start:8560,end:8569},{start:8592,end:8595},{start:8598,end:8601},{start:8712,end:8712},{start:8719,end:8719},{start:8721,end:8721},{start:8725,end:8725},{start:8730,end:8730},{start:8733,end:8736},{start:8739,end:8739},{start:8741,end:8741},{start:8743,end:8747},{start:8750,end:8750},{start:8756,end:8759},{start:8765,end:8765},{start:8776,end:8776},{start:8780,end:8780},{start:8786,end:8786},{start:8800,end:8801},{start:8804,end:8807},{start:8814,end:8815},{start:8853,end:8853},{start:8857,end:8857},{start:8869,end:8869},{start:8895,end:8895},{start:8978,end:8978},{start:9312,end:9321},{start:9332,end:9371},{start:9472,end:9547},{start:9552,end:9587},{start:9601,end:9615},{start:9619,end:9621},{start:9632,end:9633},{start:9650,end:9651},{start:9660,end:9661},{start:9670,end:9671},{start:9675,end:9675},{start:9678,end:9679},{start:9698,end:9701},{start:9733,end:9734},{start:9737,end:9737},{start:9792,end:9792},{start:9794,end:9794},{start:11905,end:11905},{start:11908,end:11908},{start:11912,end:11912},{start:11915,end:11916},{start:11927,end:11927},{start:11943,end:11943},{start:11946,end:11946},{start:11950,end:11950},{start:11955,end:11955},{start:11958,end:11959},{start:11963,end:11963},{start:11978,end:11978},{start:12272,end:12283},{start:12288,end:12291},{start:12293,end:12311},{start:12317,end:12318},{start:12321,end:12329},{start:12350,end:12350},{start:12353,end:12435},{start:12443,end:12446},{start:12449,end:12534},{start:12540,end:12542},{start:12549,end:12585},{start:12832,end:12841},{start:12849,end:12849},{start:12963,end:12963},{start:13198,end:13199},{start:13212,end:13214},{start:13217,end:13217},{start:13252,end:13252},{start:13262,end:13262},{start:13265,end:13266},{start:13269,end:13269},{start:13312,end:19893},{start:19968,end:40869},{start:59277,end:59286},{start:59335,end:59335},{start:59414,end:59416},{start:59422,end:59422},{start:59430,end:59430},{start:59435,end:59436},{start:59441,end:59442},{start:59451,end:59451},{start:59459,end:59459},{start:59476,end:59477},{start:59492,end:59492},{start:63788,end:63788},{start:63865,end:63865},{start:63893,end:63893},{start:63975,end:63975},{start:63985,end:63985},{start:64012,end:64015},{start:64017,end:64017},{start:64019,end:64020},{start:64024,end:64024},{start:64031,end:64033},{start:64035,end:64036},{start:64039,end:64041},{start:65072,end:65073},{start:65075,end:65092},{start:65097,end:65106},{start:65108,end:65111},{start:65113,end:65126},{start:65128,end:65131},{start:65281,end:65374},{start:65504,end:65509}],widthOfString:(o,t)=>{let e=0;for(let r=0;r<o.length;r++)e+=/[^\x00-\x7f]/.test(o[r])?1:.5;return e*t}},KaiTi:{bbox:"-8 -145 1000 859",flags:"32",stemV:"0",italicAngle:"0",ascender:"859",decender:"-141",capHeight:"175",widths:"1 95 500",ordering:"GB1",registry:"Adobe",supplement:"2",encoding:"UniGB-UCS2-H",ranges:[{start:32,end:126},{start:164,end:164},{start:167,end:168},{start:176,end:177},{start:183,end:183},{start:215,end:215},{start:224,end:225},{start:232,end:234},{start:236,end:237},{start:242,end:243},{start:247,end:247},{start:249,end:250},{start:252,end:252},{start:257,end:257},{start:275,end:275},{start:283,end:283},{start:299,end:299},{start:324,end:324},{start:328,end:328},{start:333,end:333},{start:363,end:363},{start:462,end:462},{start:464,end:464},{start:466,end:466},{start:468,end:468},{start:470,end:470},{start:472,end:472},{start:474,end:474},{start:476,end:476},{start:505,end:505},{start:593,end:593},{start:609,end:609},{start:711,end:711},{start:713,end:715},{start:729,end:729},{start:913,end:929},{start:931,end:937},{start:945,end:961},{start:963,end:969},{start:1025,end:1025},{start:1040,end:1103},{start:1105,end:1105},{start:8208,end:8208},{start:8211,end:8214},{start:8216,end:8217},{start:8220,end:8221},{start:8229,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8245,end:8245},{start:8251,end:8251},{start:8364,end:8364},{start:8451,end:8451},{start:8453,end:8453},{start:8457,end:8457},{start:8470,end:8470},{start:8481,end:8481},{start:8544,end:8555},{start:8560,end:8569},{start:8592,end:8595},{start:8598,end:8601},{start:8712,end:8712},{start:8719,end:8719},{start:8721,end:8721},{start:8725,end:8725},{start:8730,end:8730},{start:8733,end:8736},{start:8739,end:8739},{start:8741,end:8741},{start:8743,end:8747},{start:8750,end:8750},{start:8756,end:8759},{start:8765,end:8765},{start:8776,end:8776},{start:8780,end:8780},{start:8786,end:8786},{start:8800,end:8801},{start:8804,end:8807},{start:8814,end:8815},{start:8853,end:8853},{start:8857,end:8857},{start:8869,end:8869},{start:8895,end:8895},{start:8978,end:8978},{start:9312,end:9321},{start:9332,end:9371},{start:9472,end:9547},{start:9552,end:9587},{start:9601,end:9615},{start:9619,end:9621},{start:9632,end:9633},{start:9650,end:9651},{start:9660,end:9661},{start:9670,end:9671},{start:9675,end:9675},{start:9678,end:9679},{start:9698,end:9701},{start:9733,end:9734},{start:9737,end:9737},{start:9792,end:9792},{start:9794,end:9794},{start:11905,end:11905},{start:11908,end:11908},{start:11912,end:11912},{start:11915,end:11916},{start:11927,end:11927},{start:11943,end:11943},{start:11946,end:11946},{start:11950,end:11950},{start:11955,end:11955},{start:11958,end:11959},{start:11963,end:11963},{start:11978,end:11978},{start:12272,end:12283},{start:12288,end:12291},{start:12293,end:12311},{start:12317,end:12318},{start:12321,end:12329},{start:12350,end:12350},{start:12353,end:12435},{start:12443,end:12446},{start:12449,end:12534},{start:12540,end:12542},{start:12549,end:12585},{start:12832,end:12841},{start:12849,end:12849},{start:12963,end:12963},{start:13198,end:13199},{start:13212,end:13214},{start:13217,end:13217},{start:13252,end:13252},{start:13262,end:13262},{start:13265,end:13266},{start:13269,end:13269},{start:13312,end:19893},{start:19968,end:40869},{start:59277,end:59286},{start:59335,end:59335},{start:59414,end:59416},{start:59422,end:59422},{start:59430,end:59430},{start:59435,end:59436},{start:59441,end:59442},{start:59451,end:59451},{start:59459,end:59459},{start:59476,end:59477},{start:59492,end:59492},{start:63788,end:63788},{start:63865,end:63865},{start:63893,end:63893},{start:63975,end:63975},{start:63985,end:63985},{start:64012,end:64015},{start:64017,end:64017},{start:64019,end:64020},{start:64024,end:64024},{start:64031,end:64033},{start:64035,end:64036},{start:64039,end:64041},{start:65072,end:65073},{start:65075,end:65092},{start:65097,end:65106},{start:65108,end:65111},{start:65113,end:65126},{start:65128,end:65131},{start:65281,end:65374},{start:65504,end:65509}],widthOfString:(o,t)=>{let e=0;for(let r=0;r<o.length;r++)e+=/[^\x00-\x7f]/.test(o[r])?1:.5;return e*t}},FangSong:{bbox:"-8 -145 1000 859",flags:"32",stemV:"0",italicAngle:"0",ascender:"859",decender:"-141",capHeight:"175",widths:"1 95 500",ordering:"GB1",registry:"Adobe",supplement:"2",encoding:"UniGB-UCS2-H",ranges:[{start:32,end:126},{start:164,end:164},{start:167,end:168},{start:176,end:177},{start:183,end:183},{start:215,end:215},{start:224,end:225},{start:232,end:234},{start:236,end:237},{start:242,end:243},{start:247,end:247},{start:249,end:250},{start:252,end:252},{start:257,end:257},{start:275,end:275},{start:283,end:283},{start:299,end:299},{start:324,end:324},{start:328,end:328},{start:333,end:333},{start:363,end:363},{start:462,end:462},{start:464,end:464},{start:466,end:466},{start:468,end:468},{start:470,end:470},{start:472,end:472},{start:474,end:474},{start:476,end:476},{start:505,end:505},{start:593,end:593},{start:609,end:609},{start:711,end:711},{start:713,end:715},{start:729,end:729},{start:913,end:929},{start:931,end:937},{start:945,end:961},{start:963,end:969},{start:1025,end:1025},{start:1040,end:1103},{start:1105,end:1105},{start:8208,end:8208},{start:8211,end:8214},{start:8216,end:8217},{start:8220,end:8221},{start:8229,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8245,end:8245},{start:8251,end:8251},{start:8364,end:8364},{start:8451,end:8451},{start:8453,end:8453},{start:8457,end:8457},{start:8470,end:8470},{start:8481,end:8481},{start:8544,end:8555},{start:8560,end:8569},{start:8592,end:8595},{start:8598,end:8601},{start:8712,end:8712},{start:8719,end:8719},{start:8721,end:8721},{start:8725,end:8725},{start:8730,end:8730},{start:8733,end:8736},{start:8739,end:8739},{start:8741,end:8741},{start:8743,end:8747},{start:8750,end:8750},{start:8756,end:8759},{start:8765,end:8765},{start:8776,end:8776},{start:8780,end:8780},{start:8786,end:8786},{start:8800,end:8801},{start:8804,end:8807},{start:8814,end:8815},{start:8853,end:8853},{start:8857,end:8857},{start:8869,end:8869},{start:8895,end:8895},{start:8978,end:8978},{start:9312,end:9321},{start:9332,end:9371},{start:9472,end:9547},{start:9552,end:9587},{start:9601,end:9615},{start:9619,end:9621},{start:9632,end:9633},{start:9650,end:9651},{start:9660,end:9661},{start:9670,end:9671},{start:9675,end:9675},{start:9678,end:9679},{start:9698,end:9701},{start:9733,end:9734},{start:9737,end:9737},{start:9792,end:9792},{start:9794,end:9794},{start:11905,end:11905},{start:11908,end:11908},{start:11912,end:11912},{start:11915,end:11916},{start:11927,end:11927},{start:11943,end:11943},{start:11946,end:11946},{start:11950,end:11950},{start:11955,end:11955},{start:11958,end:11959},{start:11963,end:11963},{start:11978,end:11978},{start:12272,end:12283},{start:12288,end:12291},{start:12293,end:12311},{start:12317,end:12318},{start:12321,end:12329},{start:12350,end:12350},{start:12353,end:12435},{start:12443,end:12446},{start:12449,end:12534},{start:12540,end:12542},{start:12549,end:12585},{start:12832,end:12841},{start:12849,end:12849},{start:12963,end:12963},{start:13198,end:13199},{start:13212,end:13214},{start:13217,end:13217},{start:13252,end:13252},{start:13262,end:13262},{start:13265,end:13266},{start:13269,end:13269},{start:13312,end:19893},{start:19968,end:40869},{start:59277,end:59286},{start:59335,end:59335},{start:59414,end:59416},{start:59422,end:59422},{start:59430,end:59430},{start:59435,end:59436},{start:59441,end:59442},{start:59451,end:59451},{start:59459,end:59459},{start:59476,end:59477},{start:59492,end:59492},{start:63788,end:63788},{start:63865,end:63865},{start:63893,end:63893},{start:63975,end:63975},{start:63985,end:63985},{start:64012,end:64015},{start:64017,end:64017},{start:64019,end:64020},{start:64024,end:64024},{start:64031,end:64033},{start:64035,end:64036},{start:64039,end:64041},{start:65072,end:65073},{start:65075,end:65092},{start:65097,end:65106},{start:65108,end:65111},{start:65113,end:65126},{start:65128,end:65131},{start:65281,end:65374},{start:65504,end:65509}],widthOfString:(o,t)=>{let e=0;for(let r=0;r<o.length;r++)e+=/[^\x00-\x7f]/.test(o[r])?1:.5;return e*t}},LiSu:{bbox:"-8 -145 1000 859",flags:"32",stemV:"0",italicAngle:"0",ascender:"859",decender:"-141",capHeight:"175",widths:"1 95 500",ordering:"GB1",registry:"Adobe",supplement:"2",encoding:"UniGB-UCS2-H",ranges:[{start:32,end:126},{start:164,end:164},{start:167,end:168},{start:176,end:177},{start:183,end:183},{start:215,end:215},{start:224,end:225},{start:232,end:234},{start:236,end:237},{start:242,end:243},{start:247,end:247},{start:249,end:250},{start:252,end:252},{start:257,end:257},{start:275,end:275},{start:283,end:283},{start:299,end:299},{start:324,end:324},{start:328,end:328},{start:333,end:333},{start:363,end:363},{start:462,end:462},{start:464,end:464},{start:466,end:466},{start:468,end:468},{start:470,end:470},{start:472,end:472},{start:474,end:474},{start:476,end:476},{start:505,end:505},{start:593,end:593},{start:609,end:609},{start:711,end:711},{start:713,end:715},{start:729,end:729},{start:913,end:929},{start:931,end:937},{start:945,end:961},{start:963,end:969},{start:1025,end:1025},{start:1040,end:1103},{start:1105,end:1105},{start:8208,end:8208},{start:8211,end:8214},{start:8216,end:8217},{start:8220,end:8221},{start:8229,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8245,end:8245},{start:8251,end:8251},{start:8364,end:8364},{start:8451,end:8451},{start:8453,end:8453},{start:8457,end:8457},{start:8470,end:8470},{start:8481,end:8481},{start:8544,end:8555},{start:8560,end:8569},{start:8592,end:8595},{start:8598,end:8601},{start:8712,end:8712},{start:8719,end:8719},{start:8721,end:8721},{start:8725,end:8725},{start:8730,end:8730},{start:8733,end:8736},{start:8739,end:8739},{start:8741,end:8741},{start:8743,end:8747},{start:8750,end:8750},{start:8756,end:8759},{start:8765,end:8765},{start:8776,end:8776},{start:8780,end:8780},{start:8786,end:8786},{start:8800,end:8801},{start:8804,end:8807},{start:8814,end:8815},{start:8853,end:8853},{start:8857,end:8857},{start:8869,end:8869},{start:8895,end:8895},{start:8978,end:8978},{start:9312,end:9321},{start:9332,end:9371},{start:9472,end:9547},{start:9552,end:9587},{start:9601,end:9615},{start:9619,end:9621},{start:9632,end:9633},{start:9650,end:9651},{start:9660,end:9661},{start:9670,end:9671},{start:9675,end:9675},{start:9678,end:9679},{start:9698,end:9701},{start:9733,end:9734},{start:9737,end:9737},{start:9792,end:9792},{start:9794,end:9794},{start:11905,end:11905},{start:11908,end:11908},{start:11912,end:11912},{start:11915,end:11916},{start:11927,end:11927},{start:11943,end:11943},{start:11946,end:11946},{start:11950,end:11950},{start:11955,end:11955},{start:11958,end:11959},{start:11963,end:11963},{start:11978,end:11978},{start:12272,end:12283},{start:12288,end:12291},{start:12293,end:12311},{start:12317,end:12318},{start:12321,end:12329},{start:12350,end:12350},{start:12353,end:12435},{start:12443,end:12446},{start:12449,end:12534},{start:12540,end:12542},{start:12549,end:12585},{start:12832,end:12841},{start:12849,end:12849},{start:12963,end:12963},{start:13198,end:13199},{start:13212,end:13214},{start:13217,end:13217},{start:13252,end:13252},{start:13262,end:13262},{start:13265,end:13266},{start:13269,end:13269},{start:13312,end:19893},{start:19968,end:40869},{start:59277,end:59286},{start:59335,end:59335},{start:59414,end:59416},{start:59422,end:59422},{start:59430,end:59430},{start:59435,end:59436},{start:59441,end:59442},{start:59451,end:59451},{start:59459,end:59459},{start:59476,end:59477},{start:59492,end:59492},{start:63788,end:63788},{start:63865,end:63865},{start:63893,end:63893},{start:63975,end:63975},{start:63985,end:63985},{start:64012,end:64015},{start:64017,end:64017},{start:64019,end:64020},{start:64024,end:64024},{start:64031,end:64033},{start:64035,end:64036},{start:64039,end:64041},{start:65072,end:65073},{start:65075,end:65092},{start:65097,end:65106},{start:65108,end:65111},{start:65113,end:65126},{start:65128,end:65131},{start:65281,end:65374},{start:65504,end:65509}],widthOfString:(o,t)=>{let e=0;for(let r=0;r<o.length;r++)e+=/[^\x00-\x7f]/.test(o[r])?1:.5;return e*t}}},iL=bLt,wKe=(function(){function o(){this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=null}return o.prototype={ensureBuffer:function(t){var e=this.buffer,r=e?e.byteLength:0;if(t<r)return e;for(var i=512;i<t;)i<<=1;for(var n=new Uint8Array(i),s=0;s<r;++s)n[s]=e[s];return this.buffer=n},getByte:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return this.buffer[this.pos++]},getBytes:function(t){var e=this.pos;if(t){this.ensureBuffer(e+t);for(var r=e+t;!this.eof&&this.bufferLength<r;)this.readBlock();var i=this.bufferLength;r>i&&(r=i)}else{for(;!this.eof;)this.readBlock();var r=this.bufferLength}return this.pos=r,this.buffer.subarray(e,r)},lookChar:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos])},getChar:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos++])},makeSubStream:function(t,e,r){for(var i=t+e;this.bufferLength<=i&&!this.eof;)this.readBlock();return new Stream(this.buffer,t,e,r)},skip:function(t){t||(t=1),this.pos+=t},reset:function(){this.pos=0}},o})(),VKe=(function(){if(typeof Uint32Array>"u")return;var o=new Uint32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),t=new Uint32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),e=new Uint32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),r=[new Uint32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],i=[new Uint32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];function n(a){throw new Error(a)}function s(a){var l=0,c=a[l++],h=a[l++];(c==-1||h==-1)&&n("Invalid header in flate stream"),(c&15)!=8&&n("Unknown compression method in flate stream"),((c<<8)+h)%31!=0&&n("Bad FCHECK in flate stream"),h&32&&n("FDICT bit set in flate stream"),this.bytes=a,this.bytesPos=l,this.codeSize=0,this.codeBuf=0,wKe.call(this)}return s.prototype=Object.create(wKe.prototype),s.prototype.getBits=function(a){for(var l=this.codeSize,c=this.codeBuf,h=this.bytes,u=this.bytesPos,d;l<a;)typeof(d=h[u++])>"u"&&n("Bad encoding in flate stream"),c|=d<<l,l+=8;return d=c&(1<<a)-1,this.codeBuf=c>>a,this.codeSize=l-=a,this.bytesPos=u,d},s.prototype.getCode=function(a){for(var l=a[0],c=a[1],h=this.codeSize,u=this.codeBuf,d=this.bytes,p=this.bytesPos;h<c;){var m;typeof(m=d[p++])>"u"&&n("Bad encoding in flate stream"),u|=m<<h,h+=8}var g=l[u&(1<<c)-1],y=g>>16,b=g&65535;return(h==0||h<y||y==0)&&n("Bad encoding in flate stream"),this.codeBuf=u>>y,this.codeSize=h-y,this.bytesPos=p,b},s.prototype.generateHuffmanTable=function(a){for(var l=a.length,c=0,h=0;h<l;++h)a[h]>c&&(c=a[h]);for(var u=1<<c,d=new Uint32Array(u),p=1,m=0,g=2;p<=c;++p,m<<=1,g<<=1)for(var y=0;y<l;++y)if(a[y]==p){for(var b=0,P=m,h=0;h<p;++h)b=b<<1|P&1,P>>=1;for(var h=b;h<u;h+=g)d[h]=p<<16|y;++m}return[d,c]},s.prototype.readBlock=function(){function a(N,U,k,V,Y){for(var X=N.getBits(k)+V;X-- >0;)U[_++]=Y}var l=this.getBits(3);if(l&1&&(this.eof=!0),l>>=1,l==0){var c=this.bytes,h=this.bytesPos,u;typeof(u=c[h++])>"u"&&n("Bad block header in flate stream");var d=u;typeof(u=c[h++])>"u"&&n("Bad block header in flate stream"),d|=u<<8,typeof(u=c[h++])>"u"&&n("Bad block header in flate stream");var p=u;typeof(u=c[h++])>"u"&&n("Bad block header in flate stream"),p|=u<<8,p!=(~d&65535)&&n("Bad uncompressed block length in flate stream"),this.codeBuf=0,this.codeSize=0;var m=this.bufferLength,g=this.ensureBuffer(m+d),y=m+d;this.bufferLength=y;for(var b=m;b<y;++b){if(typeof(u=c[h++])>"u"){this.eof=!0;break}g[b]=u}this.bytesPos=h;return}var P,T;if(l==1)P=r,T=i;else if(l==2){for(var I=this.getBits(5)+257,C=this.getBits(5)+1,E=this.getBits(4)+4,O=Array(o.length),_=0;_<E;)O[o[_++]]=this.getBits(3);for(var R=this.generateHuffmanTable(O),v=0,_=0,D=I+C,w=new Array(D);_<D;){var F=this.getCode(R);F==16?a(this,w,2,3,v):F==17?a(this,w,3,3,v=0):F==18?a(this,w,7,11,v=0):w[_++]=v=F}P=this.generateHuffmanTable(w.slice(0,I)),T=this.generateHuffmanTable(w.slice(I,D))}else n("Unknown block type in flate stream");for(var g=this.buffer,H=g?g.length:0,z=this.bufferLength;;){var G=this.getCode(P);if(G<256){z+1>=H&&(g=this.ensureBuffer(z+1),H=g.length),g[z++]=G;continue}if(G==256){this.bufferLength=z;return}G-=257,G=t[G];var W=G>>16;W>0&&(W=this.getBits(W));var v=(G&65535)+W;G=this.getCode(T),G=e[G],W=G>>16,W>0&&(W=this.getBits(W));var L=(G&65535)+W;z+v>=H&&(g=this.ensureBuffer(z+v),H=g.length);for(var B=0;B<v;++B,++z)g[z]=g[z-L]}},s})(),PLt=(function(){var o,t,e;r.load=function(i,n,s){var a;return typeof n=="function"&&(s=n),a=new XMLHttpRequest,a.open("GET",i,!0),a.responseType="arraybuffer",a.onload=function(){var l,c;return l=new Uint8Array(a.response||a.mozResponseArrayBuffer),c=new r(l),n==null||n.getContext,typeof s=="function"?s(c):void 0},a.send(null)},t=1,e=2,o=0;function r(i){var n,s,a,l,c,h,u,d,p,m,g,y,b,P,T;for(this.data=i,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},h=null;;){switch(n=this.readUInt32(),m=(function(){var I,C;for(C=[],u=I=0;I<4;u=++I)C.push(String.fromCharCode(this.data[this.pos++]));return C}).call(this).join(""),m){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(n);break;case"fcTL":h&&this.animation.frames.push(h),this.pos+=4,h={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},c=this.readUInt16(),l=this.readUInt16()||100,h.delay=1e3*c/l,h.disposeOp=this.data[this.pos++],h.blendOp=this.data[this.pos++],h.data=[];break;case"IDAT":case"fdAT":for(m==="fdAT"&&(this.pos+=4,n-=4),i=(h==null?void 0:h.data)||this.imgData,u=b=0;0<=n?b<n:b>n;u=0<=n?++b:--b)i.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(a=this.palette.length/3,this.transparency.indexed=this.read(n),this.transparency.indexed.length>a)throw new Error("More transparent colors than palette size");if(g=a-this.transparency.indexed.length,g>0)for(u=P=0;0<=g?P<g:P>g;u=0<=g?++P:--P)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(n)[0];break;case 2:this.transparency.rgb=this.read(n)}break;case"tEXt":y=this.read(n),d=y.indexOf(0),p=String.fromCharCode.apply(String,y.slice(0,d)),this.text[p]=String.fromCharCode.apply(String,y.slice(d+1));break;case"IEND":h&&this.animation.frames.push(h),this.colors=(function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}).call(this),this.hasAlphaChannel=(T=this.colorType)===4||T===6,s=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*s,this.colorSpace=(function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}).call(this),this.imgData=new Uint8Array(this.imgData);return;default:this.pos+=n}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return r.prototype.read=function(i){var n,s,a;for(a=[],n=s=0;0<=i?s<i:s>i;n=0<=i?++s:--s)a.push(this.data[this.pos++]);return a},r.prototype.readUInt32=function(){var i,n,s,a;return i=this.data[this.pos++]<<24,n=this.data[this.pos++]<<16,s=this.data[this.pos++]<<8,a=this.data[this.pos++],i|n|s|a},r.prototype.readUInt16=function(){var i,n;return i=this.data[this.pos++]<<8,n=this.data[this.pos++],i|n},r.prototype.decodePixels=function(i){var n=this.pixelBitlength/8,s=new Uint8Array(this.width*this.height*n),a=0,l=this;if(i==null&&(i=this.imgData),i.length===0)return new Uint8Array(0);i=new VKe(i),i=i.getBytes();function c(h,u,d,p){var m,g,y,b,P,T,I,C,E,O,_,R,v,D,w,F,H,z,G,W,L,B=Math.ceil((l.width-h)/d),N=Math.ceil((l.height-u)/p),U=l.width==B&&l.height==N;for(D=n*B,R=U?s:new Uint8Array(D*N),T=i.length,v=0,g=0;v<N&&a<T;){switch(i[a++]){case 0:for(b=H=0;H<D;b=H+=1)R[g++]=i[a++];break;case 1:for(b=z=0;z<D;b=z+=1)m=i[a++],P=b<n?0:R[g-n],R[g++]=(m+P)%256;break;case 2:for(b=G=0;G<D;b=G+=1)m=i[a++],y=(b-b%n)/n,w=v&&R[(v-1)*D+y*n+b%n],R[g++]=(w+m)%256;break;case 3:for(b=W=0;W<D;b=W+=1)m=i[a++],y=(b-b%n)/n,P=b<n?0:R[g-n],w=v&&R[(v-1)*D+y*n+b%n],R[g++]=(m+Math.floor((P+w)/2))%256;break;case 4:for(b=L=0;L<D;b=L+=1)m=i[a++],y=(b-b%n)/n,P=b<n?0:R[g-n],v===0?w=F=0:(w=R[(v-1)*D+y*n+b%n],F=y&&R[(v-1)*D+(y-1)*n+b%n]),I=P+w-F,C=Math.abs(I-P),O=Math.abs(I-w),_=Math.abs(I-F),C<=O&&C<=_?E=P:O<=_?E=w:E=F,R[g++]=(m+E)%256;break;default:throw new Error("Invalid filter algorithm: "+i[a-1])}if(!U){var k=((u+v*p)*l.width+h)*n,V=v*D;for(b=0;b<B;b+=1){for(var Y=0;Y<n;Y+=1)s[k++]=R[V++];k+=(d-1)*n}}v++}}return l.interlaceMethod==1?(c(0,0,8,8),c(4,0,8,8),c(0,4,4,8),c(2,0,4,4),c(0,2,2,4),c(1,0,2,2),c(0,1,1,2)):c(0,0,1,1),s},r.prototype.decodePalette=function(){var i,n,s,a,l,c,h,u,d,p;for(a=this.palette,h=this.transparency.indexed||[],c=new Uint8Array((h.length||0)+a.length),l=0,s=a.length,i=0,n=u=0,d=a.length;u<d;n=u+=3)c[l++]=a[n],c[l++]=a[n+1],c[l++]=a[n+2],c[l++]=(p=h[i++])!=null?p:255;return c},r.prototype.copyToImageData=function(i,n){var s,a,l,c,h,u,d,p,m,g,y;if(a=this.colors,m=null,s=this.hasAlphaChannel,this.palette.length&&(m=(y=this._decodedPalette)!=null?y:this._decodedPalette=this.decodePalette(),a=4,s=!0),l=i.data||i,p=l.length,h=m||n,c=u=0,a===1)for(;c<p;)d=m?n[c/4]*4:u,g=h[d++],l[c++]=g,l[c++]=g,l[c++]=g,l[c++]=s?h[d++]:255,u=d;else for(;c<p;)d=m?n[c/4]*4:u,l[c++]=h[d++],l[c++]=h[d++],l[c++]=h[d++],l[c++]=s?h[d++]:255,u=d},r.prototype.decode=function(){var i;return i=new Uint8Array(this.width*this.height*4),this.copyToImageData(i,this.decodePixels()),i},r.prototype.renderFrame=function(i,n){var s,a,l;return a=this.animation.frames,s=a[n],l=a[n-1],n===0&&i.clearRect(0,0,this.width,this.height),(l==null?void 0:l.disposeOp)===t?i.clearRect(l.xOffset,l.yOffset,l.width,l.height):(l==null?void 0:l.disposeOp)===e&&i.putImageData(l.imageData,l.xOffset,l.yOffset),s.blendOp===o&&i.clearRect(s.xOffset,s.yOffset,s.width,s.height),i.drawImage(s.image,s.xOffset,s.yOffset)},r.prototype.animate=function(i){var n,s,a,l,c,h,u=this;return s=0,h=this.animation,l=h.numFrames,a=h.frames,c=h.numPlays,(n=function(){var d,p;if(d=s++%l,p=a[d],u.renderFrame(i,d),l>1&&s/l<c)return u.animation._timeout=setTimeout(n,p.delay)})()},r.prototype.stopAnimation=function(){var i;return clearTimeout((i=this.animation)!=null?i._timeout:void 0)},r})(),LKe=PLt,b2=(function(o){"use strict";function t(r){if(typeof r!="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var i={};this.subscribe=function(n,s,a){if(a=a||!1,typeof n!="string"||typeof s!="function"||typeof a!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");i.hasOwnProperty(n)||(i[n]={});var l=Math.random().toString(35);return i[n][l]=[s,!!a],l},this.unsubscribe=function(n){for(var s in i)if(i[s][n])return delete i[s][n],Object.keys(i[s]).length===0&&delete i[s],!0;return!1},this.publish=function(n){if(i.hasOwnProperty(n)){var s=Array.prototype.slice.call(arguments,1),a=[];for(var l in i[n]){var c=i[n][l];try{c[0].apply(r,s)}catch(h){o.console&&console.error("jsPDF PubSub Error",h.message,h)}c[1]&&a.push(l)}a.length&&a.forEach(this.unsubscribe)}},this.getTopics=function(){return i}}function e(r,i,n,s){var a={},l=[],c=1;typeof r=="object"&&(a=r,r=a.orientation,i=a.unit||i,n=a.format||n,s=a.compress||a.compressPdf||s,l=a.filters||(s===!0?["FlateEncode"]:l),c=typeof a.userUnit=="number"?Math.abs(a.userUnit):1),i=i||"mm",r=(""+(r||"P")).toLowerCase();var h=a.putOnlyUsedFonts||!0,u={},d={internal:{},__private__:{}};d.__private__.PubSub=t;var p="1.4",m=d.__private__.getPdfVersion=function(){return p},g=d.__private__.setPdfVersion=function(Ce){p=Ce};let y={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};var b=d.__private__.getPageFormats=function(){return y},P=d.__private__.getPageFormat=function(Ce){return y[Ce]};typeof n=="string"&&(n=P(n)),n=n||P("a4");var T=d.f2=d.__private__.f2=function(Ce){if(isNaN(Ce))throw new Error("Invalid argument passed to jsPDF.f2");return Ce.toFixed(2)},I=d.__private__.f3=function(Ce){if(isNaN(Ce))throw new Error("Invalid argument passed to jsPDF.f3");return Ce.toFixed(3)},C="00000000000000000000000000000000",E=d.__private__.getFileId=function(){return C},O=d.__private__.setFileId=function(Ce){return Ce=Ce||"12345678901234567890123456789012".split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(Math.random()*16))}).join(""),C=Ce,C};d.setFileId=function(Ce){return O(Ce),this},d.getFileId=function(){return E()};var _,R=d.__private__.convertDateToPDFDate=function(Ce){var nt="",Lt=Ce.getTimezoneOffset(),yr=Lt<0?"+":"-",ei=Math.floor(Math.abs(Lt/60)),Qi=Math.abs(Lt%60),yn=[yr,F(ei),"'",F(Qi),"'"].join("");return nt=["D:",Ce.getFullYear(),F(Ce.getMonth()+1),F(Ce.getDate()),F(Ce.getHours()),F(Ce.getMinutes()),F(Ce.getSeconds()),yn].join(""),nt},v=d.__private__.convertPDFDateToDate=function(Ce){var nt=parseInt(Ce.substr(2,4),10),Lt=parseInt(Ce.substr(6,2),10)-1,yr=parseInt(Ce.substr(8,2),10),ei=parseInt(Ce.substr(10,2),10),Qi=parseInt(Ce.substr(12,2),10),yn=parseInt(Ce.substr(14,2),10),xn=parseInt(Ce.substr(16,2),10),ph=parseInt(Ce.substr(20,2),10),Wa=new Date(nt,Lt,yr,ei,Qi,yn,0);return Wa},D=d.__private__.setCreationDate=function(Ce){var nt,Lt=/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|\-0[0-9]|\-1[0-1])\'(0[0-9]|[1-5][0-9])\'?$/;if(typeof Ce>"u"&&(Ce=new Date),typeof Ce=="object"&&Object.prototype.toString.call(Ce)==="[object Date]")nt=R(Ce);else if(Lt.test(Ce))nt=Ce;else throw new Error("Invalid argument passed to jsPDF.setCreationDate");return _=nt,_},w=d.__private__.getCreationDate=function(Ce){var nt=_;return Ce==="jsDate"&&(nt=v(_)),nt};d.setCreationDate=function(Ce){return D(Ce),this},d.getCreationDate=function(Ce){return w(Ce)};var F=d.__private__.padd2=function(Ce){return("0"+parseInt(Ce)).slice(-2)},H=!1,z=[],G=[],W,L=0,B,N=d.__private__.setCustomOutputDestination=function(Ce){B=Ce},U=d.__private__.resetCustomOutputDestination=function(Ce){B=void 0},k=d.__private__.out=function(Ce){var nt;return Ce=typeof Ce=="string"?Ce:Ce.toString(),typeof B>"u"?nt=H?z[W]:G:nt=B,nt.push(Ce),H||(L+=Ce.length+1),nt},V=d.__private__.write=function(Ce){return k(arguments.length===1?Ce.toString():Array.prototype.join.call(arguments," "))},Y=d.__private__.getArrayBuffer=function(Ce){if(Ce instanceof ArrayBuffer)return Ce;for(var nt=Ce.length,Lt=new ArrayBuffer(nt),yr=new Uint8Array(Lt);nt--;)yr[nt]=Ce.charCodeAt(nt);return Lt},X={0:0,90:1,180:0,270:-1,360:0},Z={0:1,90:0,180:-1,270:0,360:1},Q={Helvetica:["helvetica","normal","WinAnsiEncoding"],"Helvetica-Bold":["helvetica","bold","WinAnsiEncoding"],"Helvetica-Oblique":["helvetica","italic","WinAnsiEncoding"],"Helvetica-BoldOblique":["helvetica","bolditalic","WinAnsiEncoding"],Courier:["courier","normal","WinAnsiEncoding"],"Courier-Bold":["courier","bold","WinAnsiEncoding"],"Courier-Oblique":["courier","italic","WinAnsiEncoding"],"Courier-BoldOblique":["courier","bolditalic","WinAnsiEncoding"],"Times-Roman":["Times-Roman","normal","WinAnsiEncoding"],"Times-Bold":["times","bold","WinAnsiEncoding"],"Times-Italic":["times","italic","WinAnsiEncoding"],"Times-BoldItalic":["times","bolditalic","WinAnsiEncoding"],ZapfDingbats:["zapfdingbats","normal",null],Symbol:["symbol","normal",null]},ae=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","Times-Roman","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]],he=d.__private__.getStandardFonts=function(Ce){return ae},re=a.fontSize||16,se=d.__private__.setFontSize=d.setFontSize=function(Ce){return re=Ce,this},K=d.__private__.getFontSize=d.getFontSize=function(){return re},me=a.R2L||!1,Oe=d.__private__.setR2L=d.setR2L=function(Ce){return me=Ce,this},Ie=d.__private__.getR2L=d.getR2L=function(Ce){return me},ue,Pe=d.__private__.setZoomMode=function(Ce){var nt=[void 0,null,"fullwidth","fullheight","fullpage","original"];if(/^\d*\.?\d*\%$/.test(Ce))ue=Ce;else if(!isNaN(Ce))ue=parseInt(Ce,10);else if(nt.indexOf(Ce)!==-1)ue=Ce;else throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+Ce+'" is not recognized.')},j=d.__private__.getZoomMode=function(){return ue},J,oe=d.__private__.setPageMode=function(Ce){var nt=[void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"];if(nt.indexOf(Ce)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+Ce+'" is not recognized.');J=Ce},pe=d.__private__.getPageMode=function(){return J},ge,Se=d.__private__.setLayoutMode=function(Ce){var nt=[void 0,null,"continuous","single","twoleft","tworight","two"];if(nt.indexOf(Ce)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+Ce+'" is not recognized.');ge=Ce},De=d.__private__.getLayoutMode=function(){return ge},tt=d.__private__.setDisplayMode=d.setDisplayMode=function(Ce,nt,Lt){return Pe(Ce),Se(nt),oe(Lt),this},Ze={title:"",subject:"",author:"",keywords:"",creator:""},Wt=d.__private__.getDocumentProperty=function(Ce){if(Object.keys(Ze).indexOf(Ce)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return Ze[Ce]},Nr=d.__private__.getDocumentProperties=function(Ce){return Ze},Lr=d.__private__.setDocumentProperties=d.setProperties=d.setDocumentProperties=function(Ce){for(var nt in Ze)Ze.hasOwnProperty(nt)&&Ce[nt]&&(Ze[nt]=Ce[nt]);return this},Dr=d.__private__.setDocumentProperty=function(Ce,nt){if(Object.keys(Ze).indexOf(Ce)===-1){console.warn("Invalid arguments passed to jsPDF.setDocumentProperty");return}return Ze[Ce]=nt},Rr=0,ke=[],Yt={},Ut={},ar,Fe,it=0,ye=[],bt=[],zt=new t(d),de=a.hotfixes||[],qe=d.__private__.newObject=function(){var Ce=lt();return Ne(Ce,!0),Ce},lt=d.__private__.newObjectDeferred=function(){return Rr++,ke[Rr]=function(){return L},Rr},Ne=function(Ce,nt){return nt=typeof nt=="boolean"?nt:!1,ke[Ce]=L,nt&&k(Ce+" 0 obj"),Ce},et=d.__private__.newAdditionalObject=function(){var Ce=lt(),nt={objId:Ce,content:""};return bt.push(nt),nt},At=lt(),dr=lt(),vr=d.__private__.decodeColorString=function(Ce){var nt=Ce.split(" ");if(nt.length===2&&(nt[1]==="g"||nt[1]==="G")){var Lt=parseFloat(nt[0]);nt=[Lt,Lt,Lt,"r"]}for(var yr="#",ei=0;ei<3;ei++)yr+=("0"+Math.floor(parseFloat(nt[ei])*255).toString(16)).slice(-2);return yr},Zr=d.__private__.encodeColorString=function(Ce){var nt;typeof Ce=="string"&&(Ce={ch1:Ce});var Lt=Ce.ch1,yr=Ce.ch2,ei=Ce.ch3,Qi=Ce.ch4,yn=Ce.precision,xn=Ce.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof Lt=="string"&&Lt.charAt(0)!=="#"){var ph=new RGBColor(Lt);if(ph.ok)Lt=ph.toHex();else if(!/^\d*\.?\d*$/.test(Lt))throw new Error('Invalid color "'+Lt+'" passed to jsPDF.encodeColorString.')}if(typeof Lt=="string"&&/^#[0-9A-Fa-f]{3}$/.test(Lt)&&(Lt="#"+Lt[1]+Lt[1]+Lt[2]+Lt[2]+Lt[3]+Lt[3]),typeof Lt=="string"&&/^#[0-9A-Fa-f]{6}$/.test(Lt)){var Wa=parseInt(Lt.substr(1),16);Lt=Wa>>16&255,yr=Wa>>8&255,ei=Wa&255}if(typeof yr>"u"||typeof Qi>"u"&&Lt===yr&&yr===ei)if(typeof Lt=="string")nt=Lt+" "+xn[0];else switch(Ce.precision){case 2:nt=T(Lt/255)+" "+xn[0];break;case 3:default:nt=I(Lt/255)+" "+xn[0]}else if(typeof Qi>"u"||typeof Qi=="object"){if(Qi&&!isNaN(Qi.a)&&Qi.a===0)return nt=["1.000","1.000","1.000",xn[1]].join(" "),nt;if(typeof Lt=="string")nt=[Lt,yr,ei,xn[1]].join(" ");else switch(Ce.precision){case 2:nt=[T(Lt/255),T(yr/255),T(ei/255),xn[1]].join(" ");break;default:case 3:nt=[I(Lt/255),I(yr/255),I(ei/255),xn[1]].join(" ")}}else if(typeof Lt=="string")nt=[Lt,yr,ei,Qi,xn[2]].join(" ");else switch(Ce.precision){case 2:nt=[T(Lt/255),T(yr/255),T(ei/255),T(Qi/255),xn[2]].join(" ");break;case 3:default:nt=[I(Lt/255),I(yr/255),I(ei/255),I(Qi/255),xn[2]].join(" ")}return nt},xi=d.__private__.getFilters=function(){return l},Zi=d.__private__.putStream=function(Ce){Ce=Ce||{};var nt=Ce.data||"",Lt=Ce.filters||xi(),yr=Ce.alreadyAppliedFilters||[],ei=Ce.addLength1||!1,Qi=nt.length,yn={};Lt===!0&&(Lt=["FlateEncode"]);var xn=Ce.additionalKeyValues||[];typeof e.API.processDataByFilters<"u"?yn=e.API.processDataByFilters(nt,Lt):yn={data:nt,reverseChain:[]};var ph=yn.reverseChain+(Array.isArray(yr)?yr.join(" "):yr.toString());yn.data.length!==0&&(xn.push({key:"Length",value:yn.data.length}),ei===!0&&xn.push({key:"Length1",value:Qi})),ph.length!=0&&(ph.split("/").length-1===1?xn.push({key:"Filter",value:ph}):xn.push({key:"Filter",value:"["+ph+"]"})),k("<<");for(var Wa=0;Wa<xn.length;Wa++)k("/"+xn[Wa].key+" "+xn[Wa].value);k(">>"),yn.data.length!==0&&(k("stream"),k(yn.data),k("endstream"))},Fi=d.__private__.putPage=function(Ce){var nt=Ce.mediaBox,Lt=Ce.number,yr=Ce.data,ei=Ce.objId,Qi=Ce.contentsObjId;Ne(ei,!0);var yn=ye[W].mediaBox.topRightX-ye[W].mediaBox.bottomLeftX,xn=ye[W].mediaBox.topRightY-ye[W].mediaBox.bottomLeftY;k("<</Type /Page"),k("/Parent "+Ce.rootDictionaryObjId+" 0 R"),k("/Resources "+Ce.resourceDictionaryObjId+" 0 R"),k("/MediaBox ["+parseFloat(T(Ce.mediaBox.bottomLeftX))+" "+parseFloat(T(Ce.mediaBox.bottomLeftY))+" "+T(Ce.mediaBox.topRightX)+" "+T(Ce.mediaBox.topRightY)+"]"),Ce.cropBox!==null&&k("/CropBox ["+T(Ce.cropBox.bottomLeftX)+" "+T(Ce.cropBox.bottomLeftY)+" "+T(Ce.cropBox.topRightX)+" "+T(Ce.cropBox.topRightY)+"]"),Ce.bleedBox!==null&&k("/BleedBox ["+T(Ce.bleedBox.bottomLeftX)+" "+T(Ce.bleedBox.bottomLeftY)+" "+T(Ce.bleedBox.topRightX)+" "+T(Ce.bleedBox.topRightY)+"]"),Ce.trimBox!==null&&k("/TrimBox ["+T(Ce.trimBox.bottomLeftX)+" "+T(Ce.trimBox.bottomLeftY)+" "+T(Ce.trimBox.topRightX)+" "+T(Ce.trimBox.topRightY)+"]"),Ce.artBox!==null&&k("/ArtBox ["+T(Ce.artBox.bottomLeftX)+" "+T(Ce.artBox.bottomLeftY)+" "+T(Ce.artBox.topRightX)+" "+T(Ce.artBox.topRightY)+"]"),typeof Ce.userUnit=="number"&&Ce.userUnit!==1&&k("/UserUnit "+Ce.userUnit),zt.publish("putPage",{objId:ei,pageContext:ye[Lt],pageNumber:Lt,page:yr}),k("/Contents "+Qi+" 0 R"),k(">>"),k("endobj");var ph=yr.join(`
`);return Ne(Qi,!0),Zi({data:ph,filters:xi()}),k("endobj"),ei},$i=d.__private__.putPages=function(){var Ce,nt,Lt,yr=[];for(Ce=1;Ce<=it;Ce++)ye[Ce].objId=lt(),ye[Ce].contentsObjId=lt();for(Ce=1;Ce<=it;Ce++)yr.push(Fi({number:Ce,data:z[Ce],objId:ye[Ce].objId,contentsObjId:ye[Ce].contentsObjId,mediaBox:ye[Ce].mediaBox,cropBox:ye[Ce].cropBox,bleedBox:ye[Ce].bleedBox,trimBox:ye[Ce].trimBox,artBox:ye[Ce].artBox,userUnit:ye[Ce].userUnit,rootDictionaryObjId:At,resourceDictionaryObjId:dr}));Ne(At,!0),k("<</Type /Pages");var ei="/Kids [";for(Lt=0;Lt<it;Lt++)ei+=yr[Lt]+" 0 R ";k(ei+"]"),k("/Count "+it),k(">>"),k("endobj"),zt.publish("postPutPages")},yo=function(Ce){zt.publish("putFont",{font:Ce,out:k,newObject:qe,putStream:Zi}),Ce.isAlreadyPutted!==!0&&(Ce.objectNumber=qe(),k("<<"),k("/Type /Font"),k("/BaseFont /"+Ce.postScriptName),k("/Subtype /Type1"),typeof Ce.encoding=="string"&&k("/Encoding /"+Ce.encoding),k("/FirstChar 32"),k("/LastChar 255"),k(">>"),k("endobj"))},Ha=function(){for(var Ce in Yt)Yt.hasOwnProperty(Ce)&&(h===!1||h===!0&&u.hasOwnProperty(Ce))&&yo(Yt[Ce])},da=function(){k("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),k("/Font <<");for(var Ce in Yt)Yt.hasOwnProperty(Ce)&&(h===!1||h===!0&&u.hasOwnProperty(Ce))&&k("/"+Ce+" "+Yt[Ce].objectNumber+" 0 R");if(k(">>"),k("/XObject <<"),zt.publish("putXobjectDict"),k(">>"),Object.keys(ov).length>0){k("/ExtGState <<");for(var nt in ov)ov.hasOwnProperty(nt)&&k(" /"+ov[nt]+" << /CA "+nt+" /ca "+nt+" >>");k(">>")}},Ic=function(){Ha(),zt.publish("putResources"),Ne(dr,!0),k("<<"),da(),k(">>"),k("endobj"),zt.publish("postPutResources")},kp=function(){zt.publish("putAdditionalObjects");for(var Ce=0;Ce<bt.length;Ce++){var nt=bt[Ce];Ne(nt.objId,!0),k(nt.content),k("endobj")}zt.publish("postPutAdditionalObjects")},Cc=function(Ce,nt,Lt){Ut.hasOwnProperty(nt)||(Ut[nt]={}),Ut[nt][Lt]=Ce},Dt=function(Ce,nt,Lt,yr,ei){ei=ei||!1;var Qi="F"+(Object.keys(Yt).length+1).toString(10),yn={id:Qi,postScriptName:Ce,fontName:nt.match(/^\w+-(en|cn)\,*/)?nt.replace(/-(en|cn)/,""):nt,fontStyle:Lt,encoding:yr,isStandardFont:ei,metadata:{}},xn,ph;if(iL[nt.split(",")[0]]){xn=iL[nt.split(",")[0]],yn.metadata.bbox=xn.bbox,yn.metadata.flags=xn.flags,yn.metadata.stemV=xn.stemV,yn.metadata.italicAngle=xn.italicAngle,yn.metadata.ascender=xn.ascender,yn.metadata.decender=xn.decender,yn.metadata.capHeight=xn.capHeight,yn.metadata.widths=xn.widths,yn.metadata.ordering=xn.ordering,yn.metadata.registry=xn.registry,yn.metadata.supplement=xn.supplement,yn.encoding=xn.encoding,yn.metadata.Unicode={},ph=xn.widths.split(" "),yn.metadata.Unicode.widths={};for(var Wa=0;Wa<ph.length;Wa++)yn.metadata.Unicode.widths[32+Wa]=+ph[Wa];yn.metadata.Unicode.widths.fof=1e3,yn.metadata.Unicode.kerning={},yn.metadata.widthOfString=xn.widthOfString}var Bp=this;return zt.publish("addFont",{font:yn,instance:Bp}),Qi!==void 0&&(Yt[Qi]=yn,Cc(Qi,nt,Lt)),Qi},Al=function(Ce){for(var nt=0,Lt=ae.length;nt<Lt;nt++){var yr=Dt(Ce[nt][0],Ce[nt][1],Ce[nt][2],ae[nt][3],!0);u[yr]=!0;var ei=Ce[nt][0].split("-");Cc(yr,ei[0],ei[1]||"")}zt.publish("addFonts",{fonts:Yt,dictionary:Ut})},ht=function(Ce){return Ce.foo=function(){try{return Ce.apply(this,arguments)}catch(yr){var nt=yr.stack||"";~nt.indexOf(" at ")&&(nt=nt.split(" at ")[1]);var Lt="Error in function "+nt.split(`
`)[0].split("<")[0]+": "+yr.message;if(o.console)o.console.error(Lt,yr),o.alert&&alert(Lt);else throw new Error(Lt)}},Ce.foo.bar=Ce,Ce.foo},_t=function(Ce,nt){var Lt,yr,ei,Qi,yn,xn,ph,Wa,Bp;if(nt=nt||{},ei=nt.sourceEncoding||"Unicode",yn=nt.outputEncoding,(nt.autoencode||yn)&&Yt[ar].metadata&&Yt[ar].metadata[ei]&&Yt[ar].metadata[ei].encoding&&(Qi=Yt[ar].metadata[ei].encoding,!yn&&Yt[ar].encoding&&(yn=Yt[ar].encoding),!yn&&Qi.codePages&&(yn=Qi.codePages[0]),typeof yn=="string"&&(yn=Qi[yn]),yn)){for(ph=!1,xn=[],Lt=0,yr=Ce.length;Lt<yr;Lt++)Wa=yn[Ce.charCodeAt(Lt)],Wa?xn.push(String.fromCharCode(Wa)):xn.push(Ce[Lt]),xn[Lt].charCodeAt(0)>>8&&(ph=!0);Ce=xn.join("")}for(Lt=Ce.length;ph===void 0&&Lt!==0;)Ce.charCodeAt(Lt-1)>>8&&(ph=!0),Lt--;if(!ph)return Ce;for(xn=nt.noBOM?[]:[254,255],Lt=0,yr=Ce.length;Lt<yr;Lt++){if(Wa=Ce.charCodeAt(Lt),Bp=Wa>>8,Bp>>8)throw new Error("Character at position "+Lt+" of string '"+Ce+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");xn.push(Bp),xn.push(Wa-(Bp<<8))}return String.fromCharCode.apply(void 0,xn)},rr=d.__private__.pdfEscape=d.pdfEscape=function(Ce,nt){return _t(Ce,nt).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Qr=d.__private__.beginPage=function(Ce,nt){var Lt,yr=typeof nt=="string"&&nt.toLowerCase();if(typeof Ce=="string"&&(Lt=P(Ce.toLowerCase()))&&(Ce=Lt[0],nt=Lt[1]),Array.isArray(Ce)&&(nt=Ce[1],Ce=Ce[0]),(isNaN(Ce)||isNaN(nt))&&(Ce=n[0],nt=n[1]),yr){switch(yr.substr(0,1)){case"l":nt>Ce&&(yr="s");break;case"p":Ce>nt&&(yr="s");break}yr==="s"&&(Lt=Ce,Ce=nt,nt=Lt)}(Ce>14400||nt>14400)&&(console.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),Ce=Math.min(14400,Ce),nt=Math.min(14400,nt)),n=[Ce,nt],H=!0,z[++it]=[],ye[it]={objId:0,contentsObjId:0,userUnit:Number(c),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(Ce),topRightY:Number(nt)}},wn(it)},Vi=function(){Qr.apply(this,arguments),JZe(ZZe),k(c7),t1e!==0&&k(t1e+" J"),r1e!==0&&k(r1e+" j"),zt.publish("addPage",{pageNumber:it})},jn=function(Ce){Ce>0&&Ce<=it&&(z.splice(Ce,1),it--,W>it&&(W=it),this.setPage(W))},wn=function(Ce){Ce>0&&Ce<=it&&(W=Ce)},ta=d.__private__.getNumberOfPages=d.getNumberOfPages=function(){return z.length-1},Na=function(Ce,nt,Lt){var yr=void 0,ei,Qi;Ce=Ce!==void 0?Ce:Yt[ar].fontName;var yn=Ce.split(",")[0];return Lt=Lt||{},Qi=Ce.toLowerCase(),Ut[Ce]?(Ce=Ce!==void 0?Ce:Yt[ar].fontName,nt=nt!==void 0?nt:Yt[ar].fontStyle,Ut[Qi]!==void 0&&Ut[Qi][nt]!==void 0?yr=Ut[Qi][nt]:Ut[Ce]!==void 0&&Ut[Ce][nt]!==void 0?yr=Ut[Ce][nt]:Lt.disableWarning===!1&&console.warn("Unable to look up font label for font '"+Ce+"', '"+nt+"'. Refer to getFontList() for available fonts."),!yr&&!Lt.noFallback&&(yr=Ut.times[nt],yr==null&&(yr=Ut.times.normal)),yr):(Q[yn]?yr=Dt(Ce,Ce!=yn?Ce:Q[Ce][0],Q[yn][1],Q[yn][2],!0):yr=Dt(Ce,Ce,"normal"),ar||(ar=yr),yr)},Us=d.__private__.putInfo=function(){qe(),k("<<"),k("/Producer (jsPDF "+e.version+")");for(var Ce in Ze)Ze.hasOwnProperty(Ce)&&Ze[Ce]&&k("/"+Ce.substr(0,1).toUpperCase()+Ce.substr(1)+" ("+rr(Ze[Ce])+")");k("/CreationDate ("+_+")"),k(">>"),k("endobj")},ra=d.__private__.putCatalog=function(Ce){Ce=Ce||{};var nt=Ce.rootDictionaryObjId||At;switch(qe(),k("<<"),k("/Type /Catalog"),k("/Pages "+nt+" 0 R"),ue||(ue="fullwidth"),ue){case"fullwidth":k("/OpenAction [3 0 R /FitH null]");break;case"fullheight":k("/OpenAction [3 0 R /FitV null]");break;case"fullpage":k("/OpenAction [3 0 R /Fit]");break;case"original":k("/OpenAction [3 0 R /XYZ null null 1]");break;default:var Lt=""+ue;Lt.substr(Lt.length-1)==="%"&&(ue=parseInt(ue)/100),typeof ue=="number"&&k("/OpenAction [3 0 R /XYZ null null "+T(ue)+"]")}switch(ge||(ge="continuous"),ge){case"continuous":k("/PageLayout /OneColumn");break;case"single":k("/PageLayout /SinglePage");break;case"two":case"twoleft":k("/PageLayout /TwoColumnLeft");break;case"tworight":k("/PageLayout /TwoColumnRight");break}J&&k("/PageMode /"+J),zt.publish("putCatalog"),k(">>"),k("endobj")},mu=d.__private__.putTrailer=function(){k("trailer"),k("<<"),k("/Size "+(Rr+1)),k("/Root "+Rr+" 0 R"),k("/Info "+(Rr-1)+" 0 R"),k("/ID [ <"+C+"> <"+C+"> ]"),k(">>")},nc=d.__private__.putHeader=function(){k("%PDF-"+p),k("%\xBA\xDF\xAC\xE0")},id=d.__private__.putXRef=function(){var Ce=1,nt="0000000000";for(k("xref"),k("0 "+(Rr+1)),k("0000000000 65535 f "),Ce=1;Ce<=Rr;Ce++){var Lt=ke[Ce];typeof Lt=="function"?k((nt+ke[Ce]()).slice(-10)+" 00000 n "):typeof ke[Ce]<"u"?k((nt+ke[Ce]).slice(-10)+" 00000 n "):k("0000000000 00000 n ")}},Sc=d.__private__.buildDocument=function(Ce="string"){H=!1,Rr=0,L=0,G=[],ke=[],bt=[],At=lt(),dr=lt(),zt.publish("buildDocument"),nc(),$i(),d.internal.pages.length=0,kp(),Ic(),Us(),ra();var nt=L;id(),mu(),k("startxref"),k(""+nt),k("%%EOF"),H=!0,BLt(ye),ye.length=0;let Lt;return Ce==="arrayBuffer"?Lt=Pl():Lt=G.join(`
`),G.length=0,Lt},Pl=d.__private__.getContentArrayBuffer=function(){let Ce=0;for(let ei of G)Ce+=ei.length,++Ce;let nt=new ArrayBuffer(Ce),Lt=new Uint8Array(nt),yr=0;for(let ei of G){for(let Qi=0;Qi<ei.length;Qi++)Lt[yr++]=ei.charCodeAt(Qi);Lt[yr++]=10}return nt},Fl=d.__private__.getBlob=function(Ce){return new Blob([Y(Ce)],{type:"application/pdf"})},d1=d.output=d.__private__.output=ht(function(Ce,nt){nt=nt||{};var Lt=Sc();switch(typeof nt=="string"?nt={filename:nt}:nt.filename=nt.filename||"generated.pdf",Ce){case void 0:return Lt;case"save":d.save(nt.filename);break;case"arraybuffer":return Y(Lt);case"blob":return Fl(Lt);case"bloburi":case"bloburl":if(typeof o.URL<"u"&&typeof o.URL.createObjectURL=="function")return o.URL&&o.URL.createObjectURL(Fl(Lt))||void 0;f,console.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":return"data:application/pdf;filename="+nt.filename+";base64,"+btoa(Lt);case"dataurlnewwindow":var yr='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}  </style><body><iframe src="'+this.output("datauristring")+'"></iframe></body></html>',ei=o.open();if(ei!==null&&ei.document.write(yr),ei||typeof safari>"u")return ei;case"datauri":case"dataurl":return o.document.location.href="data:application/pdf;filename="+nt.filename+";base64,"+btoa(Lt);default:return null}}),G0=function(Ce){return Array.isArray(de)===!0&&de.indexOf(Ce)>-1};switch(i){case"pt":Fe=1;break;case"mm":Fe=72/25.4;break;case"cm":Fe=72/2.54;break;case"in":Fe=.72;break;case"px":G0("px_scaling")==!0?Fe=72/96:Fe=96/72;break;case"pc":Fe=12;break;case"em":Fe=12;break;case"ex":Fe=6;break;default:if(Number.isNaN(i))throw new Error("Invalid unit: "+i);Fe=Number(i);break}D(),O();var NP=d.__private__.getPageInfo=function(Ce){if(isNaN(Ce)||Ce%1!==0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");var nt=ye[Ce].objId;return{objId:nt,pageNumber:Ce,pageContext:ye[Ce]}},nI=d.__private__.getPageInfoByObjId=function(Ce){var nt;for(var Lt in ye)if(ye[Lt].objId===Ce){nt=Lt;break}if(isNaN(Ce)||Ce%1!==0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");return NP(Lt)},iv=d.__private__.getCurrentPageInfo=function(){return{objId:ye[W].objId,pageNumber:W,pageContext:ye[W]}};d.addPage=function(){return Vi.apply(this,arguments),this},d.setPage=function(){return wn.apply(this,arguments),this},d.insertPage=function(Ce){return this.addPage(),this.movePage(W,Ce),this},d.movePage=function(Ce,nt){if(Ce>nt){for(var Lt=z[Ce],yr=ye[Ce],ei=Ce;ei>nt;ei--)z[ei]=z[ei-1],ye[ei]=ye[ei-1];z[nt]=Lt,ye[nt]=yr,this.setPage(nt)}else if(Ce<nt){for(var Lt=z[Ce],yr=ye[Ce],ei=Ce;ei<nt;ei++)z[ei]=z[ei+1],ye[ei]=ye[ei+1];z[nt]=Lt,ye[nt]=yr,this.setPage(nt)}return this},d.deletePage=function(){return jn.apply(this,arguments),this};var IH=d.__private__.saveGraphicState=d.saveGraphicState=function(){k("q")},R_e=d.__private__.restoreGraphicState=d.restoreGraphicState=function(){k("Q")},z9=d.__private__.text=d.text=function(Ce,nt,Lt,yr){var ei;typeof Ce=="number"&&typeof nt=="number"&&(typeof Lt=="string"||Array.isArray(Lt))&&(ei=Lt,Lt=nt,nt=Ce,Ce=ei);var Qi;typeof Array.isArray(nt)&&nt.length===6&&(Qi=nt,nt=0,Lt=0);var p1=arguments[3],P2=arguments[4],uO=arguments[5];if((typeof p1!="object"||p1===null)&&(typeof P2=="string"&&(uO=P2,P2=null),typeof p1=="string"&&(uO=p1,p1=null),typeof p1=="number"&&(P2=p1,p1=null),yr={flags:p1,angle:P2,align:uO}),p1=p1||{},p1.noBOM=p1.noBOM||!0,p1.autoencode=p1.autoencode||!0,isNaN(nt)||isNaN(Lt)||typeof Ce>"u"||Ce===null)return console.warn("Invalid arguments passed to jsPDF.text"),Wa;if(Ce.length===0)return Wa;var yn="",xn=!1,ph=typeof yr.lineHeightFactor=="number"?yr.lineHeightFactor:aL,Wa=yr.scope||this;function Bp(Oh){return Oh=Oh.split("	").join(Array(yr.TabLen||9).join(" ")),rr(Oh,p1)}function sv(Oh){for(var Dd=Oh.concat(),cp=[],wb=Dd.length,U0;wb--;)U0=Dd.shift(),typeof U0=="string"?cp.push(U0):Array.isArray(Oh)&&U0.length===1?cp.push(U0[0]):cp.push([U0[0],U0[1],U0[2]]);return cp}function MK(Oh,Dd){var cp;if(typeof Oh=="string")cp=Dd(Oh)[0];else if(Array.isArray(Oh)){for(var wb=Oh.concat(),U0=[],T2=wb.length,cI,X9;T2--;)cI=wb.shift(),typeof cI=="string"?U0.push(Dd(cI)[0]):Array.isArray(cI)&&cI[0]==="string"&&(X9=Dd(cI[0],cI[1],cI[2]),U0.push([X9[0],X9[1],X9[2]]));cp=U0}return cp}function NK(Oh,Dd){var cp=iL[Dd.split(",")[0]];if(cp){var wb=cp.encoding;if(!(wb==="WinAnsiEncoding"&&Oh>255)){for(var U0=cp.ranges,T2=0;T2<U0.length;T2++)if(Oh>=U0[T2].start&&Oh<=U0[T2].end)return!0;return!1}}}function kK(Oh){var Dd;for(var cp in iL)if(iL.hasOwnProperty(cp)){if(Dd=iL[cp].ranges,iL[cp].encoding==="WinAnsiEncoding"&&Oh>255)continue;for(var wb=0;wb<Dd.length;wb++)if(Oh>=Dd[wb].start&&Oh<=Dd[wb].end)return cp}return""}function tS(Oh,Dd){var cp=!1,wb,U0=[],T2,cI,X9,fO,lv=Dd.split(",")[1]||"";Dd=Dd.split(",")[0];var bJe=["Helvetica","Helvetica-Bold","Helvetica-Oblique","Helvetica-BoldOblique","Courier","Courier-Bold","Courier-Oblique","Courier-BoldOblique","Times-Roman","Times-Bold","Times-Italic","Times-BoldItalic","ZapfDingbats","Symbol"];if(!/[^\x00-\x7f]/.test(Oh)&&bJe.indexOf(Dd)>-1)return;let z_e=uJe==="WinAnsiEncoding",Y_e=z_e?1:4;for(var FP=0;FP<Oh.length;FP+=Y_e)wb=z_e?Oh.charCodeAt(FP):+`0x${Oh.slice(FP,FP+Y_e)}`,NK(wb,Dd)?cp&&fO!==Dd&&(U0.push({partStr:Oh.slice(T2,FP),fontName:fO+(lv?","+lv:"")}),T2=FP,fO=Dd):(cp=!0,X9=kK(wb),FP===0?(T2=FP,cI=!0,fO=X9):cI?fO!==X9&&(U0.push({partStr:Oh.slice(T2,FP),fontName:fO+(lv?","+lv:"")}),T2=FP,fO=X9):(U0.push({partStr:Oh.slice(0,FP),fontName:Dd+(lv?","+lv:"")}),cI=!0,T2=FP,fO=X9));if(cp)return U0.push({partStr:Oh.slice(T2),fontName:fO+(lv?","+lv:"")}),U0}var kP=!1,SH=!0;if(typeof Ce=="string")kP=!0;else if(Array.isArray(Ce)){for(var N_e=Ce.concat(),yf=[],BP=N_e.length,BK;BP--;)BK=N_e.shift(),(typeof BK!="string"||Array.isArray(BK)&&typeof BK[0]!="string")&&(SH=!1);kP=SH}if(kP===!1)throw new Error('Type of text must be string or Array. "'+Ce+'" is not recognized.');var uJe=Yt[ar].encoding;typeof Ce=="string"&&(Ce.match(/[\\r?\\n]/)?Ce=Ce.split(/\\r\\n|\\r|\\n/g):Ce=[Ce]);var FK=re/Wa.internal.scaleFactor,VK=FK*(aL-1);switch(yr.baseline){case"bottom":Lt-=VK;break;case"top":Lt+=FK-VK;break;case"hanging":Lt+=FK-2*VK;break;case"middle":Lt+=FK/2-VK;break;case"ideographic":case"alphabetic":default:break}var av=yr.maxWidth||0;av>0&&(typeof Ce=="string"?Ce=Wa.splitTextToSize(Ce,av):Object.prototype.toString.call(Ce)==="[object Array]"&&(Ce=Wa.splitTextToSize(Ce.join(" "),av)));var lL={text:Ce,x:nt,y:Lt,options:yr,mutex:{pdfEscape:rr,activeFontKey:ar,fonts:Yt,activeFontSize:re}};zt.publish("preProcessText",lL),Ce=lL.text,yr=lL.options;var P2=+yr.angle||0,h7=Wa.internal.scaleFactor,n1e=[];if(P2){P2*=Math.PI/180;var k_e=Math.cos(P2),B_e=Math.sin(P2);n1e=[T(k_e),T(B_e),T(B_e*-1),T(k_e)]}var UK=yr.charSpace;typeof UK<"u"&&(yn+=I(UK*h7)+` Tc
`);var zMt=yr.lang,YMt=-1,aI=-1,dJe=typeof yr.renderingMode<"u"?yr.renderingMode:yr.stroke,o1e=Wa.internal.getCurrentPageInfo().pageContext;switch(dJe){case 0:case!1:case"fill":aI=0;break;case 1:case!0:case"stroke":aI=1;break;case 2:case"fillThenStroke":aI=2;break;case 3:case"invisible":aI=3;break;case 4:case"fillAndAddForClipping":aI=4;break;case 5:case"strokeAndAddPathForClipping":aI=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":aI=6;break;case 7:case"addToPathForClipping":aI=7;break}var pJe=typeof o1e.usedRenderingMode<"u"?o1e.usedRenderingMode:-1;aI!==-1?yn+=aI+` Tr
`:pJe!==-1&&(yn+=`0 Tr
`),aI!==-1&&(o1e.usedRenderingMode=aI);var uO=yr.align||"left",GK=re*ph,fJe=Wa.internal.pageSize.getWidth(),h7=Wa.internal.scaleFactor,mJe=mJe,EH=Yt[ar],UK=yr.charSpace||e1e,jMt,av=yr.maxWidth||0,Pg,p1={},HK=[];if(Object.prototype.toString.call(Ce)==="[object Array]"){var yf=sv(Ce),gJe=0,dO,WK,Pg;uO!=="left"&&(Pg=yf.map(function(cp){return Wa.getStringUnitWidth(cp,{font:EH,charSpace:UK,fontSize:re})*re/h7}));var WK=Math.max.apply(Math,Pg),zK=0,F_e,pO;if(uO==="right"){gJe=nt-WK,Z.hasOwnProperty(yr.angle)?nt-=Pg[0]*Z[yr.angle]:nt-=Pg[0]*Math.cos(P2),X.hasOwnProperty(yr.angle)?Lt+=Pg[0]*X[yr.angle]:Lt+=Pg[0]*Math.sin(P2),Ce=[];for(var xo=0,BP=yf.length;xo<BP;xo++)F_e=WK-Pg[xo],xo===0?(pO=ap(nt),dO=lp(Lt)):(pO=(zK-Pg[xo])*h7,dO=-GK),Ce.push([yf[xo],pO,dO]),zK=Pg[xo]}else if(uO==="center"){Z.hasOwnProperty(yr.angle)?nt-=Pg[0]/2*Z[yr.angle]:nt-=Pg[0]/2*Math.cos(P2),X.hasOwnProperty(yr.angle)?Lt+=Pg[0]/2*X[yr.angle]:Lt+=Pg[0]/2*Math.sin(P2),Ce=[];for(var xo=0,BP=yf.length;xo<BP;xo++)F_e=(WK-Pg[xo])/2,xo===0?(pO=ap(nt),dO=lp(Lt)):(pO=(zK-Pg[xo])/2*h7,dO=-GK),Ce.push([yf[xo],pO,dO]),zK=Pg[xo]}else if(uO==="left"){Ce=[];for(var xo=0,BP=yf.length;xo<BP;xo++)dO=xo===0?lp(Lt):-GK,pO=xo===0?ap(nt):0,Ce.push(yf[xo])}else if(uO==="justify"){Ce=[];for(var av=av!==0?av:fJe,xo=0,BP=yf.length;xo<BP;xo++)dO=xo===0?lp(Lt):-GK,pO=xo===0?ap(nt):0,xo<BP-1&&HK.push(((av-Pg[xo])/(yf[xo].split(" ").length-1)*h7).toFixed(2)),Ce.push([yf[xo],pO,dO])}else throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".')}var yJe=typeof yr.R2L=="boolean"?yr.R2L:me;yJe===!0&&(Ce=MK(Ce,function(Oh,Dd,cp){return[Oh.split("").reverse().join(""),Dd,cp]}));var lL={text:Ce,x:nt,y:Lt,options:yr,mutex:{pdfEscape:rr,activeFontKey:ar,fonts:Yt,activeFontSize:re}};zt.publish("postProcessText",lL),Ce=lL.text,xn=lL.mutex.isHex;var yf=sv(Ce);Ce=[];for(var YK=0,BP=yf.length,jK,XK,lI,u7="",qK,s1e,Y9=[],a1e=EH?EH.fontName:"",V_e=!1,G_e=new Map,xo=0;a1e&&xo<BP;xo++)Array.isArray(yf[xo])?qK=yf[xo][0]:qK=yf[xo],s1e=tS(qK,a1e),s1e?(Y9[xo]=s1e,V_e=!0):(Y9[xo]=null,G_e.set(xo,qK));V_e&&G_e.forEach((Oh,Dd)=>{Y9[Dd]=[{partStr:Oh,fontName:a1e}]});for(var j9,U_e,OH,H_e,W_e,xo=0;xo<BP;xo++){if(u7="",Y9[xo]){lI="";for(var AH=0;AH<Y9[xo].length;AH++)j9=Y9[xo][AH],j9&&j9.fontName&&j9.fontName!==OH&&(xo===0&&(W_e=!0),H_e=!0,U_e=ar,this.setFont(j9.fontName),lI+="/"+ar+" "+re+` Tf
`,u[ar]=!0,OH=j9.fontName,ar=U_e),/[^\x00-\x7f]/.test(j9.partStr)?lI+="<"+this.stringToHex(j9.fontName?j9.partStr:" ")+(AH===Y9[xo].length-1?">":`> Tj
`):lI+=(xn?"<":"(")+j9.partStr+(AH===Y9[xo].length-1?xn?">":")":(xn?">":")")+` Tj
`)}Array.isArray(yf[xo])?(jK=parseFloat(yf[xo][1]),XK=parseFloat(yf[xo][2]),Y9[xo]||(lI=(xn?"<":"(")+yf[xo][0]+(xn?">":")")),YK=1):(jK=ap(nt),XK=lp(Lt),Y9[xo]||(lI="",xo>0&&OH&&EH.fontName!==OH&&(lI+="/"+ar+" "+re+` Tf
`,OH=EH.fontName),lI+=(xn?"<":"(")+yf[xo]+(xn?">":")"))),HK!==void 0&&HK[xo]!==void 0&&(u7=HK[xo]+` Tw
`),Qi!=null&&Qi.length&&xo===0?Ce.push(u7+Qi.join(" ")+` Tm
`+lI):n1e.length!==0&&xo===0?Ce.push(u7+n1e.join(" ")+" "+jK.toFixed(2)+" "+XK.toFixed(2)+` Tm
`+lI):YK===1||YK===0&&xo===0?Ce.push(u7+jK.toFixed(2)+" "+XK.toFixed(2)+` Td
`+lI):Ce.push(u7+lI)}YK===0?Ce=Ce.join(` Tj
T* `):Ce=Ce.join(` Tj
`),Ce+=` Tj
`;var $K=`BT
`+(W_e?"":"/"+ar+" "+re+` Tf
`)+(re*ph).toFixed(2)+` TL
`+Qge+`
`;return $K+=yn,$K+=Ce,$K+="ET",k($K),H_e||(u[ar]=!0),Wa},DK=d.__private__.lstext=d.lstext=function(Ce,nt,Lt,yr){return console.warn("jsPDF.lstext is deprecated"),this.text(Ce,nt,Lt,{charSpace:yr})},D_e=d.__private__.clip=d.clip=function(Ce){k(Ce==="evenodd"?"W*":"W"),k("n")},w_e=d.__private__.clip_fixed=d.clip_fixed=function(Ce){console.log("clip_fixed is deprecated"),d.clip(Ce)},nv=d.__private__.isValidStyle=function(Ce){var nt=[void 0,null,"S","F","DF","FD","f","f*","B","B*"],Lt=!1;return nt.indexOf(Ce)!==-1&&(Lt=!0),Lt},oI=d.__private__.getStyle=function(Ce){var nt="S";return Ce==="F"?nt="f":Ce==="FD"||Ce==="DF"?nt="B":(Ce==="f"||Ce==="f*"||Ce==="B"||Ce==="B*")&&(nt=Ce),nt},sI=d.__private__.line=d.line=function(Ce,nt,Lt,yr){return isNaN(Ce)||isNaN(nt)||isNaN(Lt)||isNaN(yr)?(console.warn("Invalid arguments passed to jsPDF.line"),this):this.lines([[Lt-Ce,yr-nt]],Ce,nt)},hO=d.__private__.lines=d.lines=function(Ce,nt,Lt,yr,ei,Qi){var yn,xn,ph,Wa,Bp,sv,MK,NK,kK,tS,kP,SH;if(typeof Ce=="number"&&(SH=Lt,Lt=nt,nt=Ce,Ce=SH),yr=yr||[1,1],Qi=Qi||!1,isNaN(nt)||isNaN(Lt)||!Array.isArray(Ce)||!Array.isArray(yr)||!nv(ei)||typeof Qi!="boolean")return console.warn("Invalid arguments passed to jsPDF.lines"),this;for(k(I(ap(nt))+" "+I(lp(Lt))+" m "),yn=yr[0],xn=yr[1],Wa=Ce.length,tS=nt,kP=Lt,ph=0;ph<Wa;ph++)Bp=Ce[ph],Bp.length===2?(tS=Bp[0]*yn+tS,kP=Bp[1]*xn+kP,k(I(ap(tS))+" "+I(lp(kP))+" l")):(sv=Bp[0]*yn+tS,MK=Bp[1]*xn+kP,NK=Bp[2]*yn+tS,kK=Bp[3]*xn+kP,tS=Bp[4]*yn+tS,kP=Bp[5]*xn+kP,k(I(ap(sv))+" "+I(lp(MK))+" "+I(ap(NK))+" "+I(lp(kK))+" "+I(ap(tS))+" "+I(lp(kP))+" c"));return Qi&&k(" h"),ei!==null&&k(oI(ei)),this},wK=d.__private__.rect=d.rect=function(Ce,nt,Lt,yr,ei){return isNaN(Ce)||isNaN(nt)||isNaN(Lt)||isNaN(yr)||!nv(ei)?(console.warn("Invalid arguments passed to jsPDF.rect"),this):(k([T(ap(Ce)),T(lp(nt)),T(Lt*Fe),T(-yr*Fe),"re"].join(" ")),ei!==null&&k(oI(ei)),this)},AMt=d.__private__.triangle=d.triangle=function(Ce,nt,Lt,yr,ei,Qi,yn){return isNaN(Ce)||isNaN(nt)||isNaN(Lt)||isNaN(yr)||isNaN(ei)||isNaN(Qi)||!nv(yn)?(console.warn("Invalid arguments passed to jsPDF.triangle"),this):(this.lines([[Lt-Ce,yr-nt],[ei-Lt,Qi-yr],[Ce-ei,nt-Qi]],Ce,nt,[1,1],yn,!0),this)},_Mt=d.__private__.roundedRect=d.roundedRect=function(Ce,nt,Lt,yr,ei,Qi,yn){if(isNaN(Ce)||isNaN(nt)||isNaN(Lt)||isNaN(yr)||isNaN(ei)||isNaN(Qi)||!nv(yn))return console.warn("Invalid arguments passed to jsPDF.roundedRect"),this;var xn=4/3*(Math.SQRT2-1);return this.lines([[Lt-2*ei,0],[ei*xn,0,ei,Qi-Qi*xn,ei,Qi],[0,yr-2*Qi],[0,Qi*xn,-(ei*xn),Qi,-ei,Qi],[-Lt+2*ei,0],[-(ei*xn),0,-ei,-(Qi*xn),-ei,-Qi],[0,-yr+2*Qi],[0,-(Qi*xn),ei*xn,-Qi,ei,-Qi]],Ce+ei,nt,[1,1],yn),this},vMt=d.__private__.ellipse=d.ellipse=function(Ce,nt,Lt,yr,ei){if(isNaN(Ce)||isNaN(nt)||isNaN(Lt)||isNaN(yr)||!nv(ei))return console.warn("Invalid arguments passed to jsPDF.ellipse"),this;var Qi=4/3*(Math.SQRT2-1)*Lt,yn=4/3*(Math.SQRT2-1)*yr;return k([T(ap(Ce+Lt)),T(lp(nt)),"m",T(ap(Ce+Lt)),T(lp(nt-yn)),T(ap(Ce+Qi)),T(lp(nt-yr)),T(ap(Ce)),T(lp(nt-yr)),"c"].join(" ")),k([T(ap(Ce-Qi)),T(lp(nt-yr)),T(ap(Ce-Lt)),T(lp(nt-yn)),T(ap(Ce-Lt)),T(lp(nt)),"c"].join(" ")),k([T(ap(Ce-Lt)),T(lp(nt+yn)),T(ap(Ce-Qi)),T(lp(nt+yr)),T(ap(Ce)),T(lp(nt+yr)),"c"].join(" ")),k([T(ap(Ce+Qi)),T(lp(nt+yr)),T(ap(Ce+Lt)),T(lp(nt+yn)),T(ap(Ce+Lt)),T(lp(nt)),"c"].join(" ")),ei!==null&&k(oI(ei)),this},xMt=d.__private__.circle=d.circle=function(Ce,nt,Lt,yr){return isNaN(Ce)||isNaN(nt)||isNaN(Lt)||!nv(yr)?(console.warn("Invalid arguments passed to jsPDF.circle"),this):this.ellipse(Ce,nt,Lt,Lt,yr)};d.setFont=function(Ce,nt){return ar=Na(Ce,nt,{disableWarning:!1}),this},d.setFontStyle=d.setFontType=function(Ce){return ar=Na(void 0,Ce),this};var RMt=d.__private__.getFontList=d.getFontList=function(){var Ce={},nt,Lt,yr;for(nt in Ut)if(Ut.hasOwnProperty(nt)){Ce[nt]=yr=[];for(Lt in Ut[nt])Ut[nt].hasOwnProperty(Lt)&&yr.push(Lt)}return Ce};d.addFont=function(Ce,nt,Lt,yr){yr=yr,Dt.call(this,Ce,nt,Lt,yr)};var Jge=0,DMt=d.setLineWidthIncrement=function(Ce){isNaN(Ce)||(Jge=+Ce)},ZZe=a.lineWidth||.200025,JZe=d.__private__.setLineWidth=d.setLineWidth=function(Ce,nt){return Jge&&!nt&&(Ce=Ce>1||Ce===0?Ce:Ce+Jge),k((Ce*Fe).toFixed(2)+" w"),this},wMt=d.__private__.setLineDash=e.API.setLineDash=function(Ce,nt){return Ce=Ce||[],nt=nt||0,isNaN(nt)||!Array.isArray(Ce)?(console.warn("Invalid arguments passed to jsPDF.setLineDash"),this):(Ce=Ce.map(function(Lt){return(Lt*Fe).toFixed(3)}).join(" "),nt=parseFloat((nt*Fe).toFixed(3)),k("["+Ce+"] "+nt+" d"),this)},aL,L_e=d.__private__.getLineHeight=d.getLineHeight=function(){return re*aL},aL,L_e=d.__private__.getLineHeight=d.getLineHeight=function(){return re*aL},QZe=d.__private__.setLineHeightFactor=d.setLineHeightFactor=function(Ce){return Ce=Ce||1,typeof Ce=="number"&&(aL=Ce),this},eJe=d.__private__.getLineHeightFactor=d.getLineHeightFactor=function(){return aL};QZe(a.lineHeight);var ap=d.__private__.getHorizontalCoordinate=function(Ce){return Ce*Fe},lp=d.__private__.getVerticalCoordinate=function(Ce,nt){return ye[nt||W].mediaBox.topRightY-ye[nt||W].mediaBox.bottomLeftY-Ce*Fe},tJe=d.__private__.getHorizontalCoordinateString=function(Ce){return T(Ce*Fe)},rJe=d.__private__.getVerticalCoordinateString=function(Ce,nt){return T(ye[nt||W].mediaBox.topRightY-ye[nt||W].mediaBox.bottomLeftY-Ce*Fe)},c7=a.strokeColor||"0 G",LMt=d.__private__.getStrokeColor=d.getDrawColor=function(){return vr(c7)},MMt=d.__private__.setStrokeColor=d.setDrawColor=function(Ce,nt,Lt,yr){var ei={ch1:Ce,ch2:nt,ch3:Lt,ch4:yr,pdfColorType:"draw",precision:2};return c7=Zr(ei),k(c7),this},iJe="1",nJe=0,ov={},NMt=d.setColorWithOpacity=function(Ce,nt,Lt,yr,ei){var Qi={ch1:Ce,ch2:nt,ch3:Lt,pdfColorType:"draw",precision:2};ei!=="S"&&ei!=="F"&&ei!=="FD"&&(ei="S"),yr!=null?yr=T(yr):yr="1",iJe=yr,ov[yr]||(ov[yr]="a"+nJe++),(ei==="S"||ei==="FD")&&(c7=Zr(Qi),k(c7+" /"+ov[yr]+" gs")),(ei==="F"||ei==="FD")&&(Qi.pdfColorType="fill",CH=Zr(Qi),k(CH+" /"+ov[yr]+" gs"))},kMt=d.setCTM=function(Ce,nt,Lt,yr,ei,Qi){k([Ce,nt,Lt,yr,ei,Qi,"cm"].join(" "))},CH=a.fillColor||"0 g",BMt=d.__private__.getFillColor=d.getFillColor=function(){return vr(CH)},FMt=d.__private__.setFillColor=d.setFillColor=function(Ce,nt,Lt,yr){var ei={ch1:Ce,ch2:nt,ch3:Lt,ch4:yr,pdfColorType:"fill",precision:2};return CH=Zr(ei),k(CH),this},Qge=a.textColor||"0 g",oJe=d.__private__.getTextColor=d.getTextColor=function(){return vr(Qge)},VMt=d.__private__.setTextColor=d.setTextColor=function(Ce,nt,Lt,yr){var ei={ch1:Ce,ch2:nt,ch3:Lt,ch4:yr,pdfColorType:"text",precision:3};return Qge=Zr(ei),this},e1e=a.charSpace||0,sJe=d.__private__.getCharSpace=d.getCharSpace=function(){return e1e},GMt=d.__private__.setCharSpace=d.setCharSpace=function(Ce){if(isNaN(Ce))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return e1e=Ce,this},t1e=0;d.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2};var UMt=d.__private__.setLineCap=d.setLineCap=function(Ce){var nt=d.CapJoinStyles[Ce];if(nt===void 0)throw new Error("Line cap style of '"+Ce+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return t1e=nt,k(nt+" J"),this},r1e=0,HMt=d.__private__.setLineJoin=d.setLineJoin=function(Ce){var nt=d.CapJoinStyles[Ce];if(nt===void 0)throw new Error("Line join style of '"+Ce+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return r1e=nt,k(nt+" j"),this},M_e,WMt=d.__private__.setMiterLimit=d.setMiterLimit=function(Ce){if(Ce=Ce||0,isNaN(Ce))throw new Error("Invalid argument passed to jsPDF.setMiterLimit");return M_e=parseFloat(T(Ce*Fe)),k(M_e+" M"),this};d.save=function(Ce,nt){if(Ce=Ce||"generated.pdf",nt=nt||{},nt.returnPromise=nt.returnPromise||!1,nt.returnPromise===!1)saveAs(Fl(Sc()),Ce),typeof saveAs.unload=="function"&&o.setTimeout&&setTimeout(saveAs.unload,911);else return new Promise(function(Lt,yr){try{var ei=saveAs(Fl(Sc()),Ce);typeof saveAs.unload=="function"&&o.setTimeout&&setTimeout(saveAs.unload,911),Lt(ei)}catch(Qi){yr(Qi.message)}})},d.getPDFBlob=function(){return Fl(Sc("arrayBuffer"))};var i1e=[],aJe=async function(Ce,nt){ye[Ce].objId=lt(),ye[Ce].contentsObjId=lt(),i1e.push(await lJe({number:Ce,data:z[Ce],objId:ye[Ce].objId,contentsObjId:ye[Ce].contentsObjId,mediaBox:ye[Ce].mediaBox,cropBox:ye[Ce].cropBox,bleedBox:ye[Ce].bleedBox,trimBox:ye[Ce].trimBox,artBox:ye[Ce].artBox,userUnit:ye[Ce].userUnit,rootDictionaryObjId:At,resourceDictionaryObjId:dr},nt))},lJe=async function(Ce,nt){var Lt=Ce.number,yr=Ce.data,ei=Ce.objId,Qi=Ce.contentsObjId;return Ne(ei,!0),k("<</Type /Page"),k("/Parent "+Ce.rootDictionaryObjId+" 0 R"),k("/Resources "+Ce.resourceDictionaryObjId+" 0 R"),k("/MediaBox ["+parseFloat(T(Ce.mediaBox.bottomLeftX))+" "+parseFloat(T(Ce.mediaBox.bottomLeftY))+" "+T(Ce.mediaBox.topRightX)+" "+T(Ce.mediaBox.topRightY)+"]"),Ce.cropBox!==null&&k("/CropBox ["+T(Ce.cropBox.bottomLeftX)+" "+T(Ce.cropBox.bottomLeftY)+" "+T(Ce.cropBox.topRightX)+" "+T(Ce.cropBox.topRightY)+"]"),Ce.bleedBox!==null&&k("/BleedBox ["+T(Ce.bleedBox.bottomLeftX)+" "+T(Ce.bleedBox.bottomLeftY)+" "+T(Ce.bleedBox.topRightX)+" "+T(Ce.bleedBox.topRightY)+"]"),Ce.trimBox!==null&&k("/TrimBox ["+T(Ce.trimBox.bottomLeftX)+" "+T(Ce.trimBox.bottomLeftY)+" "+T(Ce.trimBox.topRightX)+" "+T(Ce.trimBox.topRightY)+"]"),Ce.artBox!==null&&k("/ArtBox ["+T(Ce.artBox.bottomLeftX)+" "+T(Ce.artBox.bottomLeftY)+" "+T(Ce.artBox.topRightX)+" "+T(Ce.artBox.topRightY)+"]"),typeof Ce.userUnit=="number"&&Ce.userUnit!==1&&k("/UserUnit "+Ce.userUnit),zt.publish("putPage",{objId:ei,pageContext:ye[Lt],pageNumber:Lt,page:yr}),k("/Contents "+Qi+" 0 R"),k(">>"),k("endobj"),await nt(0),Ne(Qi,!0),await cJe({data:yr,filters:xi(),onProgress:nt}),k("endobj"),await nt(1),ei},cJe=async function(Ce){Ce=Ce||{};var nt=Ce.data||[],Lt=nt.length+nt.reduce((ph,Wa)=>(ph+=Wa.length,ph),-1),yr=Ce.addLength1||!1,ei=Lt,Qi=Ce.onProgress,yn=Ce.additionalKeyValues||[];Lt!==0&&(yn.push({key:"Length",value:Lt}),yr===!0&&yn.push({key:"Length1",value:ei})),k("<<");for(var xn=0;xn<yn.length;xn++)k("/"+yn[xn].key+" "+yn[xn].value);if(k(">>"),Lt!==0){k("stream");let ph=1e7,Wa=0,Bp=[];for(let sv of nt)Bp.push(sv),Wa+=sv.length,Wa>=ph&&(k(Bp.join(`
`)),Bp.length=0,Wa=0,await Qi(1));Bp.length>0&&(k(Bp.join(`
`)),await Qi(1)),k("endstream")}},hJe=d.__private__.putPageEnd=function(){Ne(At,!0),k("<</Type /Pages");var Ce="/Kids [";for(let nt=0;nt<it;nt++)Ce+=i1e[nt]+" 0 R ";k(Ce+"]"),k("/Count "+it),k(">>"),k("endobj"),i1e.length=0};d.buildDocumentStart=function(Ce="string"){H=!1,Rr=0,L=0,G=[],ke=[],bt=[],At=lt(),dr=lt(),nc(),H=!0;let nt;return Ce==="arrayBuffer"?nt=Pl():nt=G.join(`
`)+`
`,G.length=0,nt},d.buildDocumentContent=async function(Ce="string",nt=1,Lt){H=!1,await aJe(nt,async yr=>{let ei;Ce==="arrayBuffer"?ei=Pl():ei=G.join(`
`)+`
`,G.length=0,await Lt({data:ei,value:yr})}),delete d.internal.pages[d.internal.pages.length-2],d.internal.pages.at(-1).length=0,H=!0},d.buildDocumentEnd=function(Ce="string"){H=!1,hJe(),kp(),Ic(),Us(),ra();var nt=L;id(),mu(),k("startxref"),k(""+nt),k("%%EOF"),H=!0,ye.length=0;let Lt;return Ce==="arrayBuffer"?Lt=Pl():Lt=G.join(`
`),G.length=0,Lt};for(var LK in e.API)e.API.hasOwnProperty(LK)&&(LK==="events"&&e.API.events.length?(function(Ce,nt){var Lt,yr,ei;for(ei=nt.length-1;ei!==-1;ei--)Lt=nt[ei][0],yr=nt[ei][1],Ce.subscribe.apply(Ce,[Lt].concat(typeof yr=="function"?[yr]:yr))})(zt,e.API.events):d[LK]=e.API[LK]);return d.internal={pdfEscape:rr,getStyle:oI,getFont:function(){return Yt[Na.apply(d,arguments)]},getFontSize:K,getCharSpace:sJe,getTextColor:oJe,getLineHeight:L_e,getLineHeightFactor:eJe,write:V,getHorizontalCoordinate:ap,getVerticalCoordinate:lp,getCoordinateString:tJe,getVerticalCoordinateString:rJe,collections:{},newObject:qe,newAdditionalObject:et,newObjectDeferred:lt,newObjectDeferredBegin:Ne,getFilters:xi,putStream:Zi,events:zt,scaleFactor:Fe,pageSize:{getWidth:function(){return(ye[W].mediaBox.topRightX-ye[W].mediaBox.bottomLeftX)/Fe},setWidth:function(Ce){ye[W].mediaBox.topRightX=Ce*Fe+ye[W].mediaBox.bottomLeftX},getHeight:function(){return(ye[W].mediaBox.topRightY-ye[W].mediaBox.bottomLeftY)/Fe},setHeight:function(Ce){ye[W].mediaBox.topRightY=Ce*Fe+ye[W].mediaBox.bottomLeftY}},output:d1,getNumberOfPages:ta,pages:z,out:k,f2:T,f3:I,getPageInfo:NP,getPageInfoByObjId:nI,getCurrentPageInfo:iv,getPDFVersion:m,hasHotfix:G0},Object.defineProperty(d.internal.pageSize,"width",{get:function(){return(ye[W].mediaBox.topRightX-ye[W].mediaBox.bottomLeftX)/Fe},set:function(Ce){ye[W].mediaBox.topRightX=Ce*Fe+ye[W].mediaBox.bottomLeftX},enumerable:!0,configurable:!0}),Object.defineProperty(d.internal.pageSize,"height",{get:function(){return(ye[W].mediaBox.topRightY-ye[W].mediaBox.bottomLeftY)/Fe},set:function(Ce){ye[W].mediaBox.topRightY=Ce*Fe+ye[W].mediaBox.bottomLeftY},enumerable:!0,configurable:!0}),Vi(n,r),zt.publish("initialized"),d}return e.API={events:[]},e.version="0.0.0",e})(self),GKe=b2;(function(o,t){"use strict";var e=function(L){return L=L||{},this.isStrokeTransparent=L.isStrokeTransparent||!1,this.strokeOpacity=L.strokeOpacity||1,this.strokeStyle=L.strokeStyle||"#000000",this.fillStyle=L.fillStyle||"#000000",this.isFillTransparent=L.isFillTransparent||!1,this.fillOpacity=L.fillOpacity||1,this.font=L.font||"10px sans-serif",this.textBaseline=L.textBaseline||"alphabetic",this.textAlign=L.textAlign||"left",this.lineWidth=L.lineWidth||1,this.lineJoin=L.lineJoin||"miter",this.lineCap=L.lineCap||"butt",this.path=L.path||[],this.transform=typeof L.transform<"u"?L.transform.clone():new W,this.globalCompositeOperation=L.globalCompositeOperation||"normal",this.globalAlpha=L.globalAlpha||1,this.clip_path=L.clip_path||[],this.currentPoint=L.currentPoint||new z,this.miterLimit=L.miterLimit||10,this.lastPoint=L.lastPoint||new z,this.ignoreClearRect=typeof L.ignoreClearRect=="boolean"?L.ignoreClearRect:!0,this},r,i,n,s,a,l;o.events.push(["initialized",function(){this.context2d=new c(this),r=this.internal.f2,i=this.internal.f3,n=this.internal.getCoordinateString,s=this.internal.getVerticalCoordinateString,a=this.internal.getHorizontalCoordinate,l=this.internal.getVerticalCoordinate}]);var c=function(L){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var B=L;Object.defineProperty(this,"pdf",{get:function(){return L}});var N=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return N},set:function(he){N=!!he}});var U=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return U},set:function(he){U=!!he}});var k=0;Object.defineProperty(this,"posX",{get:function(){return k},set:function(he){isNaN(he)||(k=he)}});var V=0;Object.defineProperty(this,"posY",{get:function(){return V},set:function(he){isNaN(he)||(V=he)}});var Y=!1;Object.defineProperty(this,"autoPaging",{get:function(){return Y},set:function(he){Y=!!he}});var X=0;Object.defineProperty(this,"lastBreak",{get:function(){return X},set:function(he){X=he}});var Z=[];Object.defineProperty(this,"pageBreaks",{get:function(){return Z},set:function(he){Z=he}});var Q=new e;Object.defineProperty(this,"ctx",{get:function(){return Q},set:function(he){he instanceof e&&(Q=he)}}),Object.defineProperty(this,"path",{get:function(){return Q.path},set:function(he){Q.path=he}});var ae=[];Object.defineProperty(this,"ctxStack",{get:function(){return ae},set:function(he){ae=he}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(he){var re;re=h(he),this.ctx.fillStyle=re.style,this.ctx.isFillTransparent=re.a===0,this.ctx.fillOpacity=re.a,this.pdf.setFillColor(re.r,re.g,re.b,{a:re.a}),this.pdf.setTextColor(re.r,re.g,re.b,{a:re.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(he){var re=h(he);this.ctx.strokeStyle=re.style,this.ctx.isStrokeTransparent=re.a===0,this.ctx.strokeOpacity=re.a,re.a===0?this.pdf.setDrawColor(255,255,255):re.a===1?this.pdf.setDrawColor(re.r,re.g,re.b):this.pdf.setDrawColor(re.r,re.g,re.b)}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(he){["butt","round","square"].indexOf(he)!==-1&&(this.ctx.lineCap=he,this.pdf.setLineCap(he))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(he){isNaN(he)||(this.ctx.lineWidth=he,this.pdf.setLineWidth(he))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(he){["bevel","round","miter"].indexOf(he)!==-1&&(this.ctx.lineJoin=he,this.pdf.setLineJoin(he))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(he){isNaN(he)||(this.ctx.miterLimit=he,this.pdf.setMiterLimit(he))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(he){this.ctx.textBaseline=he}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(he){["right","end","center","left","start"].indexOf(he)!==-1&&(this.ctx.textAlign=he)}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(he){this.ctx.font=he;var re,se;if(re=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z]+?)\s*$/i,se=re.exec(he),se!==null)var K=se[1],me=se[2],Oe=se[3],Ie=se[4],ue=se[5],Pe=se[6];else return;ue==="px"?Ie=Math.floor(parseFloat(Ie)):ue==="em"?Ie=Math.floor(parseFloat(Ie)*this.pdf.getFontSize()):Ie=Math.floor(parseFloat(Ie)),this.pdf.setFontSize(Ie);var j="";(Oe==="bold"||parseInt(Oe,10)>=700||K==="bold")&&(j="bold"),K==="italic"&&(j+="italic"),j.length===0&&(j="normal");for(var J="",oe=Pe.toLowerCase().replace(/"|'/g,"").split(/\s*,\s*/),pe={arial:"Helvetica",verdana:"Helvetica",helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",courier:"Courier",times:"Times",cursive:"Times",fantasy:"Times",serif:"Times"},ge=0;ge<oe.length;ge++)if(this.pdf.internal.getFont(oe[ge],j,{noFallback:!0,disableWarning:!0})!==void 0){J=oe[ge];break}else if(j==="bolditalic"&&this.pdf.internal.getFont(oe[ge],"bold",{noFallback:!0,disableWarning:!0})!==void 0)J=oe[ge],j="bold";else if(this.pdf.internal.getFont(oe[ge],"normal",{noFallback:!0,disableWarning:!0})!==void 0){J=oe[ge],j="normal";break}if(J===""){for(var ge=0;ge<oe.length;ge++)if(pe[oe[ge]]){J=pe[oe[ge]];break}}J=J===""?"Times":J,this.pdf.setFont(J,j)}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(he){this.ctx.globalCompositeOperation=he}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(he){this.ctx.globalAlpha=he}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(he){this.ctx.ignoreClearRect=!!he}})};c.prototype.fill=function(){y.call(this,"fill",!1)},c.prototype.stroke=function(){y.call(this,"stroke",!1)},c.prototype.beginPath=function(){this.path=[{type:"begin"}]},c.prototype.moveTo=function(L,B){if(isNaN(L)||isNaN(B)){console.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),console.warn("Invalid arguments passed to jsPDF.context2d.moveTo");return}var N=this.ctx.transform.applyToPoint(new z(L,B));this.path.push({type:"mt",x:N.x,y:N.y}),this.ctx.lastPoint=new z(L,B)},c.prototype.closePath=function(){this.path.push({type:"close"})},c.prototype.closeSubpath=function(){this.path.push({type:"h"})},c.prototype.lineTo=function(L,B){if(isNaN(L)||isNaN(B)){console.warn("Invalid arguments passed to jsPDF.context2d.lineTo");return}var N=this.ctx.transform.applyToPoint(new z(L,B));this.path.push({type:"lt",x:N.x,y:N.y}),this.ctx.lastPoint=new z(N.x,N.y)},c.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),y.call(this,null,!0)},c.prototype.quadraticCurveTo=function(L,B,N,U){if(isNaN(N)||isNaN(U)||isNaN(L)||isNaN(B)){console.warn("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");return}var k=this.ctx.transform.applyToPoint(new z(N,U)),V=this.ctx.transform.applyToPoint(new z(L,B));this.path.push({type:"qct",x1:V.x,y1:V.y,x:k.x,y:k.y}),this.ctx.lastPoint=new z(k.x,k.y)},c.prototype.bezierCurveTo=function(L,B,N,U,k,V){if(isNaN(k)||isNaN(V)||isNaN(L)||isNaN(B)||isNaN(N)||isNaN(U)){console.warn("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");return}var Y=this.ctx.transform.applyToPoint(new z(k,V)),X=this.ctx.transform.applyToPoint(new z(L,B)),Z=this.ctx.transform.applyToPoint(new z(N,U));this.path.push({type:"bct",x1:X.x,y1:X.y,x2:Z.x,y2:Z.y,x:Y.x,y:Y.y}),this.ctx.lastPoint=new z(Y.x,Y.y)},c.prototype.arc=function(L,B,N,U,k,V,Y,X,Z,Q,ae,he){if(isNaN(k)||isNaN(V)||isNaN(Y)||isNaN(Z)||isNaN(ae)){console.warn("Invalid arguments passed to jsPDF.context2d.arc");return}if(he=!!he,!this.ctx.transform.isIdentity){var re=this.ctx.transform.applyToPoint(new z(k,V));k=re.x,V=re.y;var se=this.ctx.transform.applyToPoint(new z(0,Y)),K=this.ctx.transform.applyToPoint(new z(0,0));Y=Math.sqrt(Math.pow(se.x-K.x,2)+Math.pow(se.y-K.y,2))}Math.abs(Q)-Math.abs(Z)>=2*Math.PI&&(Z=0,Q=2*Math.PI),ae>=2*Math.PI&&(Z=0,ae=2*Math.PI),this.path.push({type:"arc",x:k,y:V,startX:L,startY:B,endX:N,endY:U,radius:Y,radius2:X,startAngle:Z,endAngle:Q,totalAngle:ae,counterclockwise:he})},c.prototype.rect=function(L,B,N,U){if(isNaN(L)||isNaN(B)||isNaN(N)||isNaN(U)){console.warn("Invalid arguments passed to jsPDF.context2d.rect");return}this.moveTo(L,B),this.lineTo(L+N,B),this.lineTo(L+N,B+U),this.lineTo(L,B+U),this.lineTo(L,B),this.lineTo(L+N,B),this.lineTo(L,B)},c.prototype.clearRect=function(L,B,N,U){if(isNaN(L)||isNaN(B)||isNaN(N)||isNaN(U)){console.warn("Invalid arguments passed to jsPDF.context2d.clearRect");return}this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(L,B,N,U))},c.prototype.save=function(L){L=typeof L=="boolean"?L:!0;for(var B=this.pdf.internal.getCurrentPageInfo().pageNumber,N=0;N<this.pdf.internal.getNumberOfPages();N++)this.pdf.setPage(N+1),this.pdf.internal.out("q");if(this.pdf.setPage(B),L){this.ctx.fontSize=this.pdf.internal.getFontSize();var U=new e(this.ctx);this.ctxStack.push(this.ctx),this.ctx=U}},c.prototype.restore=function(L){L=typeof L=="boolean"?L:!0;for(var B=this.pdf.internal.getCurrentPageInfo().pageNumber,N=0;N<this.pdf.internal.getNumberOfPages();N++)this.pdf.setPage(N+1),this.pdf.internal.out("Q");this.pdf.setPage(B),L&&this.ctxStack.length!==0&&(this.ctx=this.ctxStack.pop(),this.fillStyle=this.ctx.fillStyle,this.strokeStyle=this.ctx.strokeStyle,this.font=this.ctx.font,this.lineCap=this.ctx.lineCap,this.lineWidth=this.ctx.lineWidth,this.lineJoin=this.ctx.lineJoin)};var h=function(L){var B=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,N=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\s*\)/,U=/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/,k,V,Y,X;if(L.isCanvasGradient===!0&&(L=L.getColor()),!L)return{r:0,g:0,b:0,a:0,style:L};if(U.test(L))k=0,V=0,Y=0,X=0;else{var Z=B.exec(L);if(Z!==null)k=parseInt(Z[1]),V=parseInt(Z[2]),Y=parseInt(Z[3]),X=1;else if(Z=N.exec(L),Z!==null)k=parseInt(Z[1]),V=parseInt(Z[2]),Y=parseInt(Z[3]),X=parseFloat(Z[4]);else{if(X=1,typeof L=="string"&&L.charAt(0)!=="#"){var Q=new RGBColor(L);Q.ok?L=Q.toHex():L="#000000"}L.length===4?(k=L.substring(1,2),k+=k,V=L.substring(2,3),V+=V,Y=L.substring(3,4),Y+=Y):(k=L.substring(1,3),V=L.substring(3,5),Y=L.substring(5,7)),k=parseInt(k,16),V=parseInt(V,16),Y=parseInt(Y,16)}}return{r:k,g:V,b:Y,a:X,style:L}},u=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},d=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};c.prototype.scale=function(L,B){if(isNaN(L)||isNaN(B)){console.warn("Invalid arguments passed to jsPDF.context2d.scale");return}var N=new W(L,0,0,B,0,0);this.ctx.transform=this.ctx.transform.multiply(N)},c.prototype.rotate=function(L){if(isNaN(L)){console.warn("Invalid arguments passed to jsPDF.context2d.rotate");return}var B=new W(Math.cos(L),Math.sin(L),-Math.sin(L),Math.cos(L),0,0);this.ctx.transform=this.ctx.transform.multiply(B)},c.prototype.translate=function(L,B){if(isNaN(L)||isNaN(B)){console.warn("Invalid arguments passed to jsPDF.context2d.translate");return}var N=new W(1,0,0,1,L,B);this.ctx.transform=this.ctx.transform.multiply(N)},c.prototype.transform=function(L,B,N,U,k,V){if(isNaN(L)||isNaN(B)||isNaN(N)||isNaN(U)||isNaN(k)||isNaN(V)){console.warn("Invalid arguments passed to jsPDF.context2d.transform");return}var Y=new W(L,B,N,U,k,V);this.ctx.transform=this.ctx.transform.multiply(Y)},c.prototype.setTransform=function(L,B,N,U,k,V){L=isNaN(L)?1:L,B=isNaN(B)?0:B,N=isNaN(N)?0:N,U=isNaN(U)?1:U,k=isNaN(k)?0:k,V=isNaN(V)?0:V,this.ctx.transform=new W(L,B,N,U,k,V)},c.prototype.drawImage=function(L,B,N,U,k,V,Y,X,Z){var Q=this.pdf.getImageProperties(L),ae=1,he=1,re=!1,se=1,K=1,me=1,Oe=1;typeof U<"u"&&typeof X<"u"&&(re=!0,se=X/U,K=Z/k,ae=Q.width/U*X/U,he=Q.height/k*Z/k),typeof V>"u"&&(V=B,Y=N,B=0,N=0),typeof U<"u"&&typeof X>"u"&&(X=U,Z=k),typeof U>"u"&&typeof X>"u"&&(X=Q.width,Z=Q.height);var Ie=this.ctx.transform.decompose(),ue=D(Ie.rotate.shx);me=Ie.scale.sx,me=Ie.scale.sy;var Pe=new W;Pe=Pe.multiply(Ie.translate),Pe=Pe.multiply(Ie.skew),Pe=Pe.multiply(Ie.scale);for(var j=Pe.applyToPoint(new z(X,Z)),J=Pe.applyToRectangle(new G(V-B*se,Y-N*K,U*ae,k*he)),oe=p.call(this,J),pe=[],ge=0;ge<oe.length;ge+=1)pe.indexOf(oe[ge])===-1&&pe.push(oe[ge]);pe.sort();var Se;if(this.autoPaging)for(var De=pe[0],tt=pe[pe.length-1],Ze=De;Ze<tt+1;Ze++){if(this.pdf.setPage(Ze),this.ctx.clip_path.length!==0){var Wt=this.path;Se=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=g(Se,this.posX,-1*this.pdf.internal.pageSize.height*(Ze-1)+this.posY),b.call(this,"fill",!0),this.path=Wt}var Nr=JSON.parse(JSON.stringify(J));Nr=g([Nr],this.posX,-1*this.pdf.internal.pageSize.height*(Ze-1)+this.posY)[0],this.pdf.addImage(L,"jpg",Nr.x,Nr.y,Nr.w,Nr.h,null,null,ue)}else this.pdf.addImage(L,"jpg",J.x,J.y,J.w,J.h,null,null,ue)};var p=function(L,B,N){var U=[];switch(B=B||this.pdf.internal.pageSize.width,N=N||this.pdf.internal.pageSize.height,L.type){default:case"mt":case"lt":U.push(Math.floor((L.y+this.posY)/N)+1);break;case"arc":U.push(Math.floor((L.y+this.posY-L.radius)/N)+1),U.push(Math.floor((L.y+this.posY+L.radius)/N)+1);break;case"qct":var k=F(this.ctx.lastPoint.x,this.ctx.lastPoint.y,L.x1,L.y1,L.x,L.y);U.push(Math.floor(k.y/N)+1),U.push(Math.floor((k.y+k.h)/N)+1);break;case"bct":var V=H(this.ctx.lastPoint.x,this.ctx.lastPoint.y,L.x1,L.y1,L.x2,L.y2,L.x,L.y);U.push(Math.floor(V.y/N)+1),U.push(Math.floor((V.y+V.h)/N)+1);break;case"rect":U.push(Math.floor((L.y+this.posY)/N)+1),U.push(Math.floor((L.y+L.h+this.posY)/N)+1)}for(var Y=0;Y<U.length;Y+=1)for(;this.pdf.internal.getNumberOfPages()<U[Y];)m.call(this);return U},m=function(){var L=this.fillStyle,B=this.strokeStyle,N=this.font,U=this.lineCap,k=this.lineWidth,V=this.lineJoin;this.pdf.addPage(),this.fillStyle=L,this.strokeStyle=B,this.font=N,this.lineCap=U,this.lineWidth=k,this.lineJoin=V},g=function(L,B,N){for(var U=0;U<L.length;U++)switch(L[U].type){case"bct":L[U].x2+=B,L[U].y2+=N;case"qct":L[U].x1+=B,L[U].y1+=N;case"mt":case"lt":case"arc":default:L[U].x+=B,L[U].y+=N}return L},y=function(L,B){for(var N=this.fillStyle,U=this.strokeStyle,k=this.font,V=this.lineCap,Y=this.lineWidth,X=this.lineJoin,Z=JSON.parse(JSON.stringify(this.path)),Q=JSON.parse(JSON.stringify(this.path)),ae,he,re=[],se=0;se<Q.length;se++)if(typeof Q[se].x<"u")for(var K=p.call(this,Q[se]),me=0;me<K.length;me+=1)re.indexOf(K[me])===-1&&re.push(K[me]);for(var se=0;se<re.length;se++)for(;this.pdf.internal.getNumberOfPages()<re[se];)m.call(this);if(re.sort(),this.autoPaging)for(var Oe=re[0],Ie=re[re.length-1],se=Oe;se<Ie+1;se++){if(this.pdf.setPage(se),this.fillStyle=N,this.strokeStyle=U,this.lineCap=V,this.lineWidth=Y,this.lineJoin=X,this.ctx.clip_path.length!==0){var ue=this.path;ae=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=g(ae,this.posX,-1*this.pdf.internal.pageSize.height*(se-1)+this.posY),b.call(this,L,!0),this.path=ue}he=JSON.parse(JSON.stringify(Z)),this.path=g(he,this.posX,-1*this.pdf.internal.pageSize.height*(se-1)+this.posY),(B===!1||se===0)&&b.call(this,L,B)}else b.call(this,L,B);this.path=Z},b=function(L,B){if(!(L==="stroke"&&!B&&d.call(this))&&!(L!=="stroke"&&!B&&u.call(this))){var N=[],U=this.ctx.globalAlpha;this.ctx.fillOpacity<1&&(U=this.ctx.fillOpacity);for(var k=this.path,V=0;V<k.length;V++){var Y=k[V];switch(Y.type){case"begin":N.push({begin:!0});break;case"close":N.push({close:!0});break;case"mt":N.push({start:Y,deltas:[],abs:[]});break;case"lt":var X=N.length;if(!isNaN(k[V-1].x)){if(k[V-1].type==="arc")var K=[Y.x-k[V-1].endX,Y.y-k[V-1].endY];else var K=[Y.x-k[V-1].x,Y.y-k[V-1].y];if(X>0){for(X;X>=0;X--)if(N[X-1].close!==!0&&N[X-1].begin!==!0){N[X-1].deltas.push(K),N[X-1].abs.push(Y);break}}}break;case"bct":var K=[Y.x1-k[V-1].x,Y.y1-k[V-1].y,Y.x2-k[V-1].x,Y.y2-k[V-1].y,Y.x-k[V-1].x,Y.y-k[V-1].y];N[N.length-1].deltas.push(K);break;case"qct":var Z=k[V-1].x+2/3*(Y.x1-k[V-1].x),Q=k[V-1].y+2/3*(Y.y1-k[V-1].y),ae=Y.x+2/3*(Y.x1-Y.x),he=Y.y+2/3*(Y.y1-Y.y),re=Y.x,se=Y.y,K=[Z-k[V-1].x,Q-k[V-1].y,ae-k[V-1].x,he-k[V-1].y,re-k[V-1].x,se-k[V-1].y];N[N.length-1].deltas.push(K);break;case"arc":N.push({deltas:[],abs:[],arc:!0}),Array.isArray(N[N.length-1].abs)&&N[N.length-1].abs.push(Y);break;case"h":N.push({closeSubpath:!0});break}}var me;B?me=null:L==="stroke"?me="stroke":L==="fill"?me="fill":me="strokeFill";for(var V=0;V<N.length;V++){if(N[V].closeSubpath){this.pdf.internal.out("h");continue}if(N[V].arc)for(var Oe=N[V].abs,Ie=0;Ie<Oe.length;Ie++){var ue=Oe[Ie];if(typeof ue.startAngle<"u"){var Pe=D(ue.startAngle),j=D(ue.totalAngle),J=ue.x,oe=ue.y;P.call(this,J,oe,ue.radius,ue.radius2,Pe,j,ue.counterclockwise,null,B)}else N[V].deltas[Ie-1]&&E.call(this,ue.x-N[V].deltas[Ie-1][0],ue.y-N[V].deltas[Ie-1][1]),E.call(this,ue.x,ue.y)}if(!N[V].arc&&N[V].close!==!0&&N[V].begin!==!0){var J=N[V].start.x,oe=N[V].start.y;O.call(this,N[V].deltas,J,oe,null,null)}}me&&T.call(this,me),B&&I.call(this)}};c.prototype.drawPaths=b;var P=function(L,B,N,U,k,V,Y,X,Z){for(var Q=!1,ae=this.pdf.internal.scaleFactor,he=w(k),re=w(V),se=R.call(this,N,U,he,re,Y),K=null,me=0;me<se.length;me++){var Oe=se[me];Q&&me===0&&C.call(this,Oe.x1+L,Oe.y1+B),_.call(this,L,B,Oe.x2,Oe.y2,Oe.x3,Oe.y3,Oe.x4,Oe.y4)}Z?I.call(this):T.call(this,X)},T=function(L){switch(L){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f");break;case"strokeFill":this.pdf.internal.out("B");break}},I=function(){this.pdf.clip()},C=function(L,B){this.pdf.internal.out(n(L)+" "+s(B)+" m")},E=function(L,B,N,U){N=N||0,U=U||0,this.pdf.internal.out(n(L+N)+" "+s(B+U)+" l")},O=function(L,B,N){return this.pdf.lines(L,B,N,null,null)},_=function(L,B,N,U,k,V,Y,X){this.pdf.internal.out([r(a(N+L)),r(l(U+B)),r(a(k+L)),r(l(V+B)),r(a(Y+L)),r(l(X+B)),"c"].join(" "))},R=function(L,B,N,U,k){var V=1e-5,Y=Math.PI*2,X=N;(X<Y||X>Y)&&(X=X%Y);var Z=U;(Z<Y||Z>Y)&&(Z=Z%Y);for(var Q=[],ae=Math.PI/2,he=k?-1:1,re=N,se=Math.min(Y,Z);se>V;){var K=re+he*Math.min(se,ae);Q.push(v.call(this,L,B,re,K)),se-=Math.abs(K-re),re=K}return Q},v=function(L,B,N,U){var k=(U-N)/2,V=L/B,Y=B*Math.cos(k),X=B*Math.sin(k),Z=Y,Q=-X,ae=Z*Z+Q*Q,he=ae+Z*Y+Q*X,re=4/3*(Math.sqrt(2*ae*he)-he)/(Z*X-Q*Y),se=Z-re*Q,K=Q+re*Z,me=se,Oe=-K,Ie=k+N,ue=Math.cos(Ie),Pe=Math.sin(Ie),j={x1:L*Math.cos(N),y1:B*Math.sin(N),x2:se*ue-K*Pe,y2:se*Pe+K*ue,x3:me*ue-Oe*Pe,y3:me*Pe+Oe*ue,x4:L*Math.cos(U),y4:B*Math.sin(U)};return j.x2*=V,j.x3*=V,j},D=function(L){return L*180/Math.PI},w=function(L){return L*Math.PI/180},F=function(L,B,N,U,k,V){var Y=L+(N-L)*.5,X=B+(U-B)*.5,Z=k+(N-k)*.5,Q=V+(U-V)*.5,ae=Math.min(L,k,Y,Z),he=Math.max(L,k,Y,Z),re=Math.min(B,V,X,Q),se=Math.max(B,V,X,Q);return new G(ae,re,he-ae,se-re)},H=function(L,B,N,U,k,V,Y,X){for(var Z=N-L,Q=U-B,ae=k-N,he=V-U,re=Y-k,se=X-V,K=40,me,Oe,Ie,ue,Pe,j,J,oe,pe,ge,Se,De,tt,Fe,Ze,Wt,Nr,Lr,Dr,Rr,ke,Yt,Ut,ar,Fe=0;Fe<K+1;Fe++)me=Fe/K,Oe=L+me*Z,Ie=B+me*Q,ue=N+me*ae,Pe=U+me*he,j=k+me*re,J=V+me*se,Dr=ue-Oe,Rr=Pe-Ie,ke=j-ue,Yt=J-Pe,ge=Oe+me*Dr,Se=Ie+me*Rr,oe=ue+me*ke,pe=Pe+me*Yt,Ut=oe-ge,ar=pe-Se,De=ge+me*Ut,tt=Se+me*ar,Fe==0?(Ze=De,Wt=tt,Nr=De,Lr=tt):(Ze=Math.min(Ze,De),Wt=Math.min(Wt,tt),Nr=Math.max(Nr,De),Lr=Math.max(Lr,tt));return new G(Math.round(Ze),Math.round(Wt),Math.round(Nr-Ze),Math.round(Lr-Wt))},z=function(L,B){var N=L||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return N},set:function(V){isNaN(V)||(N=parseFloat(V))}});var U=B||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return U},set:function(V){isNaN(V)||(U=parseFloat(V))}});var k="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return k},set:function(V){k=V.toString()}}),this},G=function(L,B,N,U){z.call(this,L,B),this.type="rect";var k=N||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return k},set:function(Y){isNaN(Y)||(k=parseFloat(Y))}});var V=U||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return V},set:function(Y){isNaN(Y)||(V=parseFloat(Y))}}),this},W=function(L,B,N,U,k,V){var Y=[];return Object.defineProperty(this,"sx",{get:function(){return Y[0]},set:function(X){Y[0]=Math.round(X*1e5)/1e5}}),Object.defineProperty(this,"shy",{get:function(){return Y[1]},set:function(X){Y[1]=Math.round(X*1e5)/1e5}}),Object.defineProperty(this,"shx",{get:function(){return Y[2]},set:function(X){Y[2]=Math.round(X*1e5)/1e5}}),Object.defineProperty(this,"sy",{get:function(){return Y[3]},set:function(X){Y[3]=Math.round(X*1e5)/1e5}}),Object.defineProperty(this,"tx",{get:function(){return Y[4]},set:function(X){Y[4]=Math.round(X*1e5)/1e5}}),Object.defineProperty(this,"ty",{get:function(){return Y[5]},set:function(X){Y[5]=Math.round(X*1e5)/1e5}}),Object.defineProperty(this,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(this,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(this,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(this,"isIdentity",{get:function(){return!(this.sx!==1||this.shy!==0||this.shx!==0||this.sy!==1||this.tx!==0||this.ty!==0)}}),this.sx=isNaN(L)?1:L,this.shy=isNaN(B)?0:B,this.shx=isNaN(N)?0:N,this.sy=isNaN(U)?1:U,this.tx=isNaN(k)?0:k,this.ty=isNaN(V)?0:V,this};W.prototype.multiply=function(L){var B=L.sx*this.sx+L.shy*this.shx,N=L.sx*this.shy+L.shy*this.sy,U=L.shx*this.sx+L.sy*this.shx,k=L.shx*this.shy+L.sy*this.sy,V=L.tx*this.sx+L.ty*this.shx+this.tx,Y=L.tx*this.shy+L.ty*this.sy+this.ty;return new W(B,N,U,k,V,Y)},W.prototype.decompose=function(){var L=this.sx,B=this.shy,N=this.shx,U=this.sy,k=this.tx,V=this.ty,Y=Math.sqrt(L*L+B*B);L/=Y,B/=Y;var X=L*N+B*U;N-=L*X,U-=B*X;var Z=Math.sqrt(N*N+U*U);return N/=Z,U/=Z,X/=Z,L*U<B*N&&(L=-L,B=-B,X=-X,Y=-Y),{scale:new W(Y,0,0,Z,0,0),translate:new W(1,0,0,1,k,V),rotate:new W(L,B,-B,L,0,0),skew:new W(1,0,X,1,0,0)}},W.prototype.applyToPoint=function(L){var B=L.x*this.sx+L.y*this.shx+this.tx,N=L.x*this.shy+L.y*this.sy+this.ty;return new z(B,N)},W.prototype.applyToRectangle=function(L){var B=this.applyToPoint(L),N=this.applyToPoint(new z(L.x+L.w,L.y+L.h));return new G(B.x,B.y,N.x-B.x,N.y-B.y)},W.prototype.clone=function(){var L=this.sx,B=this.shy,N=this.shx,U=this.sy,k=this.tx,V=this.ty;return new W(L,B,N,U,k,V)}})(b2.API,typeof self<"u"&&self||typeof window<"u"&&window||typeof global<"u"&&global||Function('return typeof this === "object" && this.content')()||Function("return this")()),(function(o,t){"use strict";var e=o.API,r=e.stringToHex=function(c){for(var h="",u=0;u<c.length;u++){var d=""+c.charCodeAt(u).toString(16);d.length===3?d="0"+d:d.length===2&&(d="00"+d),h+=d}return h},i=e.pdfEscape16=function(c,h){for(var u=h.metadata.Unicode.widths,d=["","0","00","000","0000"],p=[""],m=0,g=c.length,y;m<g;++m){if(y=h.metadata.characterToGlyph(c.charCodeAt(m)),h.metadata.glyIdsUsed.push(y),h.metadata.toUnicode[y]=c.charCodeAt(m),u.indexOf(y)==-1&&(u.push(y),u.push([parseInt(h.metadata.widthOfGlyph(y),10)])),y=="0")return p.join("");y=y.toString(16),p.push(d[4-y.length],y)}return p.join("")},n=function(c,h,u,d){if(c&&c.metadata&&!c.isStandardFont&&c.encoding!="WinAnsiEncoding"&&iL[c.fontName.split(",")[0]]){var p=u();h("<<"),h("/Type /FontDescriptor"),h("/FontName /"+c.fontName),h("/FontBBox ["+c.metadata.bbox+"]"),h("/Flags "+c.metadata.flags),h("/StemV "+c.metadata.stemV),h("/ItalicAngle "+c.metadata.italicAngle),h("/Ascent "+c.metadata.ascender),h("/Descent "+c.metadata.decender),h("/CapHeight "+c.metadata.capHeight),h(">>"),h("endobj");var m=u();h("<<"),h("/Type /Font"),h("/BaseFont /"+c.fontName),h("/FontDescriptor "+p+" 0 R"),h("/W ["+c.metadata.widths+"]"),h("/Subtype /CIDFontType2"),h("/CIDSystemInfo"),h("<<"),h("/Ordering ("+c.metadata.ordering+")"),h("/Registry ("+c.metadata.registry+")"),h("/Supplement "+c.metadata.supplement),h(">>"),h(">>"),h("endobj"),c.objectNumber=u(),h("<<"),h("/Type /Font"),h("/Subtype /Type0"),h("/BaseFont /"+c.fontName),h("/Encoding /"+c.encoding),h("/DescendantFonts ["+m+" 0 R]"),h(">>"),h("endobj"),c.isAlreadyPutted=!0}};e.events.push(["putFont",function(c){n(c.font,c.out,c.newObject,c.putStream)}]);var s=function(c,h,u,d){if(!c.isStandardFont&&c.encoding==="WinAnsiEncoding"){var p=u();h("<<"),h("/Descent "+c.metadata.decender),h("/CapHeight "+c.metadata.capHeight),h("/StemV "+c.metadata.stemV),h("/Type /FontDescriptor"),h("/Flags "+c.metadata.flags),h("/FontBBox ["+c.metadata.bbox+"]"),h("/FontName /"+c.fontName),h("/ItalicAngle "+c.metadata.italicAngle),h("/Ascent "+c.metadata.ascender),h(">>"),h("endobj"),c.objectNumber=u(),h("<</Subtype/TrueType/Type/Font/BaseFont/"+c.fontName+"/FontDescriptor "+p+" 0 R/Encoding/"+c.encoding+" /FirstChar 32 /LastChar 255 /Widths ["+c.metadata.widths+"]>>"),h("endobj"),c.isAlreadyPutted=!0}};e.events.push(["putFont",function(c){s(c.font,c.out,c.newObject,c.putStream)}]);var a=function(c){var h=c.text||"",u=c.x,d=c.y,p=c.options||{},m,g=c.mutex||{},y=g.pdfEscape,b=g.activeFontKey,P=g.fonts,z,T=0,I=g.activeFontSize,C=0,E,O="",_=0,R=0,v,D,w,F="",H,z=b,G=P[z].encoding;if(P[z].encoding!=="Identity-H"&&P[z].encoding!=="UniGB-UCS2-H")return h=h.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)"),{text:h,x:u,y:d,options:p,mutex:g};var W=0;for(F=h,z=H?getFont(H.font,H.fontStyle):b,Object.prototype.toString.call(h)==="[object Array]"&&(F=h[0]),R=0;R<F.length;R+=1)O+=F[R];var L="";return parseInt(z.slice(1))<14||G==="WinAnsiEncoding"?L=r(O):G==="Identity-H"&&(L=i(O,P[z])),g.isHex=!0,{text:L,x:u,y:d,options:p,mutex:g}},l=function(c){var h=c.text||"",u=c.x,d=c.y,p=c.options,m=c.mutex,g=p.lang,y=[],b,P={text:h,x:u,y:d,options:p,mutex:m};if(Object.prototype.toString.call(h)==="[object Array]"){var T=0;for(T=0;T<h.length;T+=1)Object.prototype.toString.call(h[T])==="[object Array]"?h[T].length===3?y.push([a(Object.assign({},P,{text:h[T][0]})).text,h[T][1],h[T][2]]):y.push(a(Object.assign({},P,{text:h[T]})).text):y.push(a(Object.assign({},P,{text:h[T]})).text);c.text=y}else c.text=a(Object.assign({},P,{text:h})).text};e.events.push(["postProcessText",l])})(b2,typeof self<"u"&&self||typeof global<"u"&&global||typeof window<"u"&&window||Function("return this")()),(function(o){"use strict";var t="addImage_",e={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},r=o.getImageFileTypeByImageData=function(C,E){E=E||"UNKNOWN";var O,_,R="UNKNOWN",v,D,w;o.isArrayBufferView(C)&&(C=o.arrayBufferToBinaryString(C));for(w in e)for(v=e[w],O=0;O<v.length;O+=1){for(D=!0,_=0;_<v[O].length;_+=1)if(v[O][_]!==void 0&&v[O][_]!==C.charCodeAt(_)){D=!1;break}if(D===!0){R=w;break}}return R==="UNKNOWN"&&E!=="UNKNOWN"&&(console.warn('FileType of Image not recognized. Processing image as "'+E+'".'),R=E),R},i=function(C){for(var E=this.internal.newObject(),O=this.internal.write,_=this.internal.putStream,R=this.internal.getFilters,v=R();v.indexOf("FlateEncode")!==-1;)v.splice(v.indexOf("FlateEncode"),1);C.n=E;var D=[];if(D.push({key:"Type",value:"/XObject"}),D.push({key:"Subtype",value:"/Image"}),D.push({key:"Width",value:C.w}),D.push({key:"Height",value:C.h}),C.cs===this.color_spaces.INDEXED?D.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(C.pal.length/3-1)+" "+("smask"in C?E+2:E+1)+" 0 R]"}):(D.push({key:"ColorSpace",value:"/"+C.cs}),C.cs===this.color_spaces.DEVICE_CMYK&&D.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),D.push({key:"BitsPerComponent",value:C.bpc}),"dp"in C&&D.push({key:"DecodeParms",value:"<<"+C.dp+">>"}),"trns"in C&&C.trns.constructor==Array){for(var w="",F=0,H=C.trns.length;F<H;F++)w+=C.trns[F]+" "+C.trns[F]+" ";D.push({key:"Mask",value:"["+w+"]"})}"smask"in C&&D.push({key:"SMask",value:E+1+" 0 R"});var z=typeof C.f<"u"?["/"+C.f]:void 0;if(_({data:C.data,additionalKeyValues:D,alreadyAppliedFilters:z}),O("endobj"),"smask"in C){var G="/Predictor "+C.p+" /Colors 1 /BitsPerComponent "+C.bpc+" /Columns "+C.w,W={w:C.w,h:C.h,cs:"DeviceGray",bpc:C.bpc,dp:G,data:C.smask};"f"in C&&(W.f=C.f),i.call(this,W)}C.cs===this.color_spaces.INDEXED&&(this.internal.newObject(),_({data:this.arrayBufferToBinaryString(new Uint8Array(C.pal))}),O("endobj"))},n=function(){var C=this.internal.collections[t+"images"];for(var E in C)i.call(this,C[E])},s=function(){var C=this.internal.collections[t+"images"],E=this.internal.write,O;for(var _ in C)O=C[_],E("/I"+O.i,O.n,"0","R")},a=function(C){return C&&typeof C=="string"&&(C=C.toUpperCase()),C in o.image_compression?C:o.image_compression.NONE},l=function(){var C=this.internal.collections[t+"images"];return C||(this.internal.collections[t+"images"]=C={},this.internal.events.subscribe("putResources",n),this.internal.events.subscribe("putXobjectDict",s)),C},c=function(C){var E=0;return C&&(E=Object.keys?Object.keys(C).length:(function(O){var _=0;for(var R in O)O.hasOwnProperty(R)&&_++;return _})(C)),E},h=function(C){return typeof C>"u"||C===null||C.length===0},u=function(C){return typeof C=="string"?o.sHashCode(C):o.isArrayBufferView(C)?o.sHashCode(o.arrayBufferToBinaryString(C)):null},d=function(C){return typeof o["process"+C.toUpperCase()]=="function"},p=function(C){return typeof C=="object"&&C.nodeType===1},m=function(C,E){if(C.nodeName==="IMG"&&C.hasAttribute("src")){var O=""+C.getAttribute("src");if(O.indexOf("data:image/")===0)return unescape(O)}if(C.nodeName==="CANVAS"){var _=C;return C.toDataURL("image/jpeg",1)}var _=document.createElement("canvas");_.width=C.clientWidth||C.width,_.height=C.clientHeight||C.height;var R=_.getContext("2d");if(!R)throw"addImage requires canvas to be supported by browser.";return R.drawImage(C,0,0,_.width,_.height),_.toDataURL((""+E).toLowerCase()=="png"?"image/png":"image/jpeg")},g=function(C,E){var O;if(E){for(var _ in E)if(C===E[_].alias){O=E[_];break}}return O},y=function(C,E,O){return!C&&!E&&(C=-96,E=-96),C<0&&(C=-1*O.w*72/C/this.internal.scaleFactor),E<0&&(E=-1*O.h*72/E/this.internal.scaleFactor),C===0&&(C=E*O.w/O.h),E===0&&(E=C*O.h/O.w),[C,E]},b=function(C,E,O,_,R,v,D,w=0,F,H){var z=y.call(this,O,_,R),G=this.internal.getCoordinateString,W=this.internal.getVerticalCoordinateString;O=z[0],_=z[1],D[v]=R,w*=Math.PI/180;var L=Math.cos(w),B=Math.sin(w),N=function(Y){return Y.toFixed(4)},U=[N(L),N(B),N(B*-1),N(L),0,0,"cm"];this.internal.write("q");let k=F==="top"?N(B)*_:0,V=F==="top"?(1-N(L))*_:0;this.internal.write([1,"0","0",1,G(C),W(E+_),"cm"].join(" ")),H&&this.internal.write([-1,"0","0",1,"0","0","cm"].join(" ")),this.internal.write(U.join(" ")),this.internal.write([1,"0","0",1,G(k),G(-V),"cm"].join(" ")),this.internal.write([G(O),"0","0",G(_),"0","0","cm"].join(" ")),this.internal.write("/I"+R.i+" Do"),this.internal.write("Q")};o.color_spaces={DEVICE_RGB:"DeviceRGB",DEVICE_GRAY:"DeviceGray",DEVICE_CMYK:"DeviceCMYK",CAL_GREY:"CalGray",CAL_RGB:"CalRGB",LAB:"Lab",ICC_BASED:"ICCBased",INDEXED:"Indexed",PATTERN:"Pattern",SEPARATION:"Separation",DEVICE_N:"DeviceN"},o.decode={DCT_DECODE:"DCTDecode",FLATE_DECODE:"FlateDecode",LZW_DECODE:"LZWDecode",JPX_DECODE:"JPXDecode",JBIG2_DECODE:"JBIG2Decode",ASCII85_DECODE:"ASCII85Decode",ASCII_HEX_DECODE:"ASCIIHexDecode",RUN_LENGTH_DECODE:"RunLengthDecode",CCITT_FAX_DECODE:"CCITTFaxDecode"},o.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},o.sHashCode=function(C){C=C||"";var E=0,O,_;if(C.length===0)return E;for(O=0;O<C.length;O++)_=C.charCodeAt(O),E=(E<<5)-E+_,E|=0;return E},o.isString=function(C){return typeof C=="string"},o.validateStringAsBase64=function(C){C=C||"",C.toString().trim();var E=!0;return C.length===0&&(E=!1),C.length%4!==0&&(E=!1),/^[A-Za-z0-9+\/]+$/.test(C.substr(0,C.length-2))===!1&&(E=!1),/^[A-Za-z0-9\/][A-Za-z0-9+\/]|[A-Za-z0-9+\/]=|==$/.test(C.substr(-2))===!1&&(E=!1),E},o.extractInfoFromBase64DataURI=function(C){return/^data:([\w]+?\/([\w\+]+?));\S*;*base64,(.+)$/g.exec(C)},o.extractImageFromDataUrl=function(C){C=C||"";var E=C.split("base64,"),O=null;if(E.length===2){var _=/^data:(\w*\/\w*);*(charset=[\w=-]*)*;*$/.exec(E[0]);Array.isArray(_)&&(O={mimeType:_[1],charset:_[2],data:E[1]})}return O},o.supportsArrayBuffer=function(){return typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"},o.isArrayBuffer=function(C){return this.supportsArrayBuffer()?C instanceof ArrayBuffer:!1},o.isArrayBufferView=function(C){return!this.supportsArrayBuffer()||typeof Uint32Array>"u"?!1:C instanceof Int8Array||C instanceof Uint8Array||typeof Uint8ClampedArray<"u"&&C instanceof Uint8ClampedArray||C instanceof Int16Array||C instanceof Uint16Array||C instanceof Int32Array||C instanceof Uint32Array||C instanceof Float32Array||C instanceof Float64Array},o.binaryStringToUint8Array=function(C){for(var E=C.length,O=new Uint8Array(E),_=0;_<E;_++)O[_]=C.charCodeAt(_);return O},o.arrayBufferToBinaryString=function(C){if(typeof atob=="function")return atob(this.arrayBufferToBase64(C))},o.arrayBufferToBase64=function(C){for(var E="",O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_=new Uint8Array(C),R=_.byteLength,v=R%3,D=R-v,w,F,H,z,G,W=0;W<D;W=W+3)G=_[W]<<16|_[W+1]<<8|_[W+2],w=(G&16515072)>>18,F=(G&258048)>>12,H=(G&4032)>>6,z=G&63,E+=O[w]+O[F]+O[H]+O[z];return v==1?(G=_[D],w=(G&252)>>2,F=(G&3)<<4,E+=O[w]+O[F]+"=="):v==2&&(G=_[D]<<8|_[D+1],w=(G&64512)>>10,F=(G&1008)>>4,H=(G&15)<<2,E+=O[w]+O[F]+O[H]+"="),E},o.createImageInfo=function(C,E,O,_,R,v,D,w,F,H,z,G,W){var L={alias:w,w:E,h:O,cs:_,bpc:R,i:D,data:C};return v&&(L.f=v),F&&(L.dp=F),H&&(L.trns=H),z&&(L.pal=z),G&&(L.smask=G),W&&(L.p=W),L},o.addImage=function(C,E,O,_,R,v,D,w,F,H,z){"use strict";var G="";if(typeof E!="string"){var W=v;v=R,R=_,_=O,O=E,E=W}if(typeof C=="object"&&!p(C)&&"imageData"in C){var L=C;C=L.imageData,E=L.format||E||"UNKNOWN",O=L.x||O||0,_=L.y||_||0,R=L.w||R,v=L.h||v,D=L.alias||D,w=L.compression||w,F=L.rotation||L.angle||F}var B=this.internal.getFilters();if(w===void 0&&B.indexOf("FlateEncode")!==-1&&(w="SLOW"),typeof C=="string"&&(C=unescape(C)),isNaN(O)||isNaN(_))return console.warn("Invalid coordinates passed to jsPDF.addImage"),this;var N=l.call(this),U,k;if(!(U=g(C,N))&&(p(C)&&(C=m(C,E)),h(D)&&(D=u(C)),!(U=g(D,N)))){if(this.isString(C))if(G=this.convertStringToImageData(C),G!=="")C=G;else return console.warn("tmpImageData is empty."),this;if(E=this.getImageFileTypeByImageData(C,E),!d(E))return console.warn("addImage does not support files of type '"+E+"', please ensure that a plugin for '"+E+"' support is added."),this;if(this.supportsArrayBuffer()&&(C instanceof Uint8Array||(k=C,C=this.binaryStringToUint8Array(C))),U=this["process"+E.toUpperCase()](C,c(N),D,a(w),k),!U)return console.warn("An unknown error occurred whilst processing the image"),this}return b.call(this,O,_,R,v,U,U.i,N,F,H,z),this},o.convertStringToImageData=function(C){var E,O="",_;if(this.isString(C)){var E=this.extractImageFromDataUrl(C);_=E!==null?E.data:C;try{O=atob(_)}catch(v){return o.validateStringAsBase64(_)?console.warn("atob-Error in jsPDF.convertStringToImageData "+v.message):console.warn("Supplied Data is not a valid base64-String jsPDF.convertStringToImageData "),""}}return O};var P=function(C){"use strict";var E,O,_;if(r(C)!=="JPEG")throw new Error("getJpegSize requires a binary string jpeg file");for(var R=C.charCodeAt(4)*256+C.charCodeAt(5),v=4,D=C.length;v<D;){if(v+=R,C.charCodeAt(v)!==255)throw new Error("getJpegSize could not find the size of the image");if(C.charCodeAt(v+1)===192||C.charCodeAt(v+1)===193||C.charCodeAt(v+1)===194||C.charCodeAt(v+1)===195||C.charCodeAt(v+1)===196||C.charCodeAt(v+1)===197||C.charCodeAt(v+1)===198||C.charCodeAt(v+1)===199)return O=C.charCodeAt(v+5)*256+C.charCodeAt(v+6),E=C.charCodeAt(v+7)*256+C.charCodeAt(v+8),_=C.charCodeAt(v+9),[E,O,_];v+=2,R=C.charCodeAt(v)*256+C.charCodeAt(v+1)}},T=function(C){var E=C[0]<<8|C[1];if(E!==65496)throw new Error("Supplied data is not a JPEG");for(var O=C.length,_=(C[4]<<8)+C[5],R=4,v,D,w,F;R<O;){if(R+=_,v=I(C,R),_=(v[2]<<8)+v[3],(v[1]===192||v[1]===194)&&v[0]===255&&_>7)return v=I(C,R+5),D=(v[2]<<8)+v[3],w=(v[0]<<8)+v[1],F=v[4],{width:D,height:w,numcomponents:F};R+=2}throw new Error("getJpegSizeFromBytes could not find the size of the image")},I=function(C,E){return C.subarray(E,E+5)};o.processJPEG=function(C,E,O,_,R,v){"use strict";var D=this.decode.DCT_DECODE,w=8,F;if(!this.isString(C)&&!this.isArrayBuffer(C)&&!this.isArrayBufferView(C))return null;if(this.isString(C)&&(F=P(C)),this.isArrayBuffer(C)&&(C=new Uint8Array(C)),this.isArrayBufferView(C)&&(F=T(C),C=R||this.arrayBufferToBinaryString(C)),v===void 0)switch(F.numcomponents){case 1:v=this.color_spaces.DEVICE_GRAY;break;case 4:v=this.color_spaces.DEVICE_CMYK;break;default:case 3:v=this.color_spaces.DEVICE_RGB;break}return this.createImageInfo(C,F.width,F.height,v,w,D,E,O)},o.processJPG=function(){return this.processJPEG.apply(this,arguments)},o.getImageProperties=function(C){var E,O="",_,R;if(p(C)&&(C=m(C)),this.isString(C)&&(O=this.convertStringToImageData(C),O!==""&&(C=O)),_=this.getImageFileTypeByImageData(C),!d(_))throw new Error("addImage does not support files of type '"+_+"', please ensure that a plugin for '"+_+"' support is added.");if(this.supportsArrayBuffer()&&(C instanceof Uint8Array||(R=C,C=this.binaryStringToUint8Array(C))),E=this["process"+_.toUpperCase()](C),!E)throw new Error("An unknown error occurred whilst processing the image");return{fileType:_,width:E.w,height:E.h,colorSpace:E.cs,compressionMode:E.f,bitsPerComponent:E.bpc}}})(b2.API),(function(o){"use strict";var t=function(){return typeof LKe!="function"||typeof VKe!="function"},e=function(P){return P!==o.image_compression.NONE&&r()},r=function(){var P=typeof C_e=="function";if(!P)throw new Error("requires deflate.js for compression");return P},i=function(P,T,I,C){var E=5,O=h;switch(C){case o.image_compression.FAST:E=3,O=c;break;case o.image_compression.MEDIUM:E=6,O=u;break;case o.image_compression.SLOW:E=9,O=d;break}P=a(P,T,I,O);var _=new Uint8Array(n(E)),R=s(P),v=new C_e(E),D=v.append(P),w=v.flush(),F=_.length+D.length+w.length,H=new Uint8Array(F+4);return H.set(_),H.set(D,_.length),H.set(w,_.length+D.length),H[F++]=R>>>24&255,H[F++]=R>>>16&255,H[F++]=R>>>8&255,H[F++]=R&255,o.arrayBufferToBinaryString(H)},n=function(P,T){var I=8,C=Math.LOG2E*Math.log(32768)-8,E=C<<4|I,O=E<<8,_=Math.min(3,(T-1&255)>>1);return O|=_<<6,O|=0,O+=31-O%31,[E,O&255&255]},s=function(P,T){for(var I=1,C=I&65535,E=I>>>16&65535,O=P.length,_,R=0;O>0;){_=O>T?T:O,O-=_;do C+=P[R++],E+=C;while(--_);C%=65521,E%=65521}return(E<<16|C)>>>0},a=function(P,T,I,C){for(var E=P.length/T,O=new Uint8Array(P.length+E),_=m(),R=0,v,D,w;R<E;R++){if(w=R*T,v=P.subarray(w,w+T),C)O.set(C(v,I,D),w+R);else{for(var F=0,H=_.length,z=[];F<H;F++)z[F]=_[F](v,I,D);var G=g(z.concat());O.set(z[G],w+R)}D=v}return O},l=function(P,T,I){var C=Array.apply([],P);return C.unshift(0),C},c=function(P,T,I){var C=[],E=0,O=P.length,_;for(C[0]=1;E<O;E++)_=P[E-T]||0,C[E+1]=P[E]-_+256&255;return C},h=function(P,T,I){var C=[],E=0,O=P.length,_;for(C[0]=2;E<O;E++)_=I&&I[E]||0,C[E+1]=P[E]-_+256&255;return C},u=function(P,T,I){var C=[],E=0,O=P.length,_,R;for(C[0]=3;E<O;E++)_=P[E-T]||0,R=I&&I[E]||0,C[E+1]=P[E]+256-(_+R>>>1)&255;return C},d=function(P,T,I){var C=[],E=0,O=P.length,_,R,v,D;for(C[0]=4;E<O;E++)_=P[E-T]||0,R=I&&I[E]||0,v=I&&I[E-T]||0,D=p(_,R,v),C[E+1]=P[E]-D+256&255;return C},p=function(P,T,I){var C=P+T-I,E=Math.abs(C-P),O=Math.abs(C-T),_=Math.abs(C-I);return E<=O&&E<=_?P:O<=_?T:I},m=function(){return[l,c,h,u,d]},g=function(P){for(var T=0,I=P.length,C,E,O;T<I;)C=y(P[T].slice(1)),(C<E||!E)&&(E=C,O=T),T++;return O},y=function(P){for(var T=0,I=P.length,C=0;T<I;)C+=Math.abs(P[T++]);return C},b=function(P){var T;switch(P){case o.image_compression.FAST:T=11;break;case o.image_compression.MEDIUM:T=13;break;case o.image_compression.SLOW:T=14;break;default:T=12;break}return T};o.processPNG=function(P,T,I,C,E){"use strict";var O=this.color_spaces.DEVICE_RGB,_=this.decode.FLATE_DECODE,R=8,v,D,w,F,H,z;if(this.isArrayBuffer(P)&&(P=new Uint8Array(P)),this.isArrayBufferView(P)){if(t())throw new Error("PNG support requires png.js and zlib.js");if(v=new LKe(P),P=v.imgData,R=v.bits,O=v.colorSpace,F=v.colors,[4,6].indexOf(v.colorType)!==-1){if(v.bits===8)for(var G=v.pixelBitlength==32?new Uint32Array(v.decodePixels().buffer):v.pixelBitlength==16?new Uint16Array(v.decodePixels().buffer):new Uint8Array(v.decodePixels().buffer),W=G.length,L=new Uint8Array(W*v.colors),B=new Uint8Array(W),N=v.pixelBitlength-v.bits,U=0,k=0,V,Y;U<W;U++){for(V=G[U],Y=0;Y<N;)L[k++]=V>>>Y&255,Y=Y+v.bits;B[U]=V>>>Y&255}if(v.bits===16){for(var G=new Uint32Array(v.decodePixels().buffer),W=G.length,L=new Uint8Array(W*(32/v.pixelBitlength)*v.colors),B=new Uint8Array(W*(32/v.pixelBitlength)),X=v.colors>1,U=0,k=0,Z=0,V;U<W;)V=G[U++],L[k++]=V>>>0&255,X&&(L[k++]=V>>>16&255,V=G[U++],L[k++]=V>>>0&255),B[Z++]=V>>>16&255;R=8}e(C)?(P=i(L,v.width*v.colors,v.colors,C),z=i(B,v.width,1,C)):(P=L,z=B,_=null)}if(v.colorType===3&&(O=this.color_spaces.INDEXED,H=v.palette,v.transparency.indexed)){for(var Q=v.transparency.indexed,ae=0,U=0,W=Q.length;U<W;++U)ae+=Q[U];if(ae=ae/255,ae===W-1&&Q.indexOf(0)!==-1)w=[Q.indexOf(0)];else if(ae!==W){for(var G=v.decodePixels(),B=new Uint8Array(G.length),U=0,W=G.length;U<W;U++)B[U]=Q[G[U]];z=i(B,v.width,1)}}var he=b(C);return _===this.decode.FLATE_DECODE?D="/Predictor "+he+" /Colors "+F+" /BitsPerComponent "+R+" /Columns "+v.width:D="/Colors "+F+" /BitsPerComponent "+R+" /Columns "+v.width,(this.isArrayBuffer(P)||this.isArrayBufferView(P))&&(P=this.arrayBufferToBinaryString(P)),(z&&this.isArrayBuffer(z)||this.isArrayBufferView(z))&&(z=this.arrayBufferToBinaryString(z)),this.createImageInfo(P,v.width,v.height,O,R,_,T,I,D,w,H,z,he)}throw new Error("Unsupported PNG image data, try using JPEG instead.")}})(b2.API),(function(o){"use strict";var t=o.getCharWidthsArray=function(s,a){a=a||{};var l=a.font||this.internal.getFont(),c=a.fontSize||this.internal.getFontSize(),h=a.charSpace||this.internal.getCharSpace(),u=a.widths?a.widths:l.metadata.Unicode.widths,d=u.fof?u.fof:1,p=a.kerning?a.kerning:l.metadata.Unicode.kerning,m=p.fof?p.fof:1,g,y,b,P=0,T=u[0]||d,I=[];for(g=0,y=s.length;g<y;g++){if(b=s.charCodeAt(g),b>255)I.push(1);else if(typeof l.metadata.widthOfString=="function")try{I.push((l.metadata.widthOfGlyph(l.metadata.characterToGlyph(b))+h*(1e3/c)||0)/1e3)}catch{I.push(.5)}else I.push((u[b]||T)/d+(p[b]&&p[b][P]||0)/m);P=b}return I},e=o.getArraySum=function(s){for(var a=s.length,l=0;a;)a--,l+=s[a];return l},r=o.getStringUnitWidth=function(s,a){a=a||{};var l=a.fontSize||this.internal.getFontSize(),c=a.font||this.internal.getFont(),h=a.charSpace||this.internal.getCharSpace(),u=0;return typeof c.metadata.widthOfString=="function"?u=c.metadata.widthOfString(s,l,h)/l:u=e(t.apply(this,arguments)),u},i=function(s,a,l,c){for(var h=[],u=0,d=s.length,p=0;u!==d&&p+a[u]<l;)p+=a[u],u++;h.push(s.slice(0,u));var m=u;for(p=0;u!==d;)p+a[u]>c&&(h.push(s.slice(m,u)),p=0,m=u),p+=a[u],u++;return m!==u&&h.push(s.slice(m,u)),h},n=function(s,a,l){l||(l={});var c=[],h=[c],u=l.textIndent||0,d=0,p=0,m,g,y=s.split(" "),b=t.apply(this,[" ",l])[0],P,T,I,C;if(l.lineIndent===-1?C=y[0].length+2:C=l.lineIndent||0,C){var E=Array(C).join(" "),O=[];y.map(function(v){v=v.split(/\s*\n/),v.length>1?O=O.concat(v.map(function(D,w){return(w&&D.length?`
`:"")+D})):O.push(v[0])}),y=O,C=r.apply(this,[E,l])}for(P=0,T=y.length;P<T;P++){var _=0;if(m=y[P],C&&m[0]==`
`&&(m=m.substr(1),_=1),g=t.apply(this,[m,l]),p=e(g),u+d+p>a||_){if(p>a){for(I=i.apply(this,[m,g,a-(u+d),a]),c.push(I.shift()),c=[I.pop()];I.length;)h.push([I.shift()]);p=e(g.slice(m.length-(c[0]?c[0].length:0)))}else c=[m];h.push(c),u=p+C,d=b}else c.push(m),u+=d+p,d=b}if(C)var R=function(v,D){return(D?E:"")+v.join(" ")};else var R=function(v){return v.join(" ")};return h.map(R)};o.splitTextToSize=function(s,a,l){"use strict";l=l||{};var c=l.fontSize||this.internal.getFontSize(),h=(function(y){var b={0:1},P={};if(!y.widths||!y.kerning){var T=this.internal.getFont(y.fontName,y.fontStyle),I="Unicode";return T.metadata[I]?{widths:T.metadata[I].widths||b,kerning:T.metadata[I].kerning||P}:{font:T.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}else return{widths:y.widths,kerning:y.kerning};return{widths:b,kerning:P}}).call(this,l),u;Array.isArray(s)?u=s:u=s.split(/\r?\n/);var d=1*this.internal.scaleFactor*a/c;h.textIndent=l.textIndent?l.textIndent*1*this.internal.scaleFactor/c:0,h.lineIndent=l.lineIndent;var p,m,g=[];for(p=0,m=u.length;p<m;p++)g=g.concat(n.apply(this,[u[p],d,h]));return g}})(b2.API),(function(o){"use strict";var t=function(n){for(var s="0123456789abcdef",a="klmnopqrstuvwxyz",l={},c=0;c<a.length;c++)l[a[c]]=s[c];var h,u={},d=1,p,m=u,g=[],y,b="",P="",T,I=n.length-1,C;for(c=1;c!=I;)C=n[c],c+=1,C=="'"?p?(T=p.join(""),p=h):p=[]:p?p.push(C):C=="{"?(g.push([m,T]),m={},T=h):C=="}"?(y=g.pop(),y[0][y[1]]=m,T=h,m=y[0]):C=="-"?d=-1:T===h?l.hasOwnProperty(C)?(b+=l[C],T=parseInt(b,16)*d,d=1,b=""):b+=C:l.hasOwnProperty(C)?(P+=l[C],m[T]=parseInt(P,16)*d,d=1,T=h,P=""):P+=C;return u},e={codePages:["WinAnsiEncoding"],WinAnsiEncoding:t("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},r={Unicode:{Courier:e,"Courier-Bold":e,"Courier-BoldOblique":e,"Courier-Oblique":e,Helvetica:e,"Helvetica-Bold":e,"Helvetica-BoldOblique":e,"Helvetica-Oblique":e,"Times-Roman":e,"Times-Bold":e,"Times-BoldItalic":e,"Times-Italic":e}},i={Unicode:{"Courier-Oblique":t("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":t("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":t("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:t("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":t("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":t("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:t("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:t("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":t("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:t("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":t("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":t("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":t("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":t("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};o.events.push(["addFont",function(n){var s=n.font,a,l,c="Unicode",h;a=i[c][s.postScriptName.split(",")[0]],a&&(s.metadata[c]?l=s.metadata[c]:l=s.metadata[c]={},l.widths=a.widths,l.kerning=a.kerning),h=r[c][s.postScriptName.split(",")[0]],h&&(s.metadata[c]?l=s.metadata[c]:l=s.metadata[c]={},l.encoding=h,h.codePages&&h.codePages.length&&(s.encoding=h.codePages[0]))}])})(b2.API);function G9(o,t){if(this.pos=0,this.buffer=o,this.datav=new DataView(o.buffer),this.is_with_alpha=!!t,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,["BM","BA","CI","CP","IC","PT"].indexOf(this.flag)===-1)throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}G9.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var o=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(o);for(var t=0;t<o;t++){var e=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0);this.palette[t]={red:i,green:r,blue:e,quad:n}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},G9.prototype.parseBGR=function(){this.pos=this.offset;try{var o="bit"+this.bitPP,t=this.width*this.height*4;this.data=new Uint8Array(t),this[o]()}catch(e){console.log("bit decode error:"+e)}},G9.prototype.bit1=function(){for(var o=Math.ceil(this.width/8),t=o%4,e=this.height>=0?this.height-1:-this.height,e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,i=0;i<o;i++)for(var n=this.datav.getUint8(this.pos++,!0),s=r*this.width*4+i*8*4,a=0;a<8&&i*8+a<this.width;a++){var l=this.palette[n>>7-a&1];this.data[s+a*4]=l.blue,this.data[s+a*4+1]=l.green,this.data[s+a*4+2]=l.red,this.data[s+a*4+3]=255}t!=0&&(this.pos+=4-t)}},G9.prototype.bit4=function(){for(var o=Math.ceil(this.width/2),t=o%4,e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,i=0;i<o;i++){var n=this.datav.getUint8(this.pos++,!0),s=r*this.width*4+i*2*4,a=n>>4,l=n&15,c=this.palette[a];if(this.data[s]=c.blue,this.data[s+1]=c.green,this.data[s+2]=c.red,this.data[s+3]=255,i*2+1>=this.width)break;c=this.palette[l],this.data[s+4]=c.blue,this.data[s+4+1]=c.green,this.data[s+4+2]=c.red,this.data[s+4+3]=255}t!=0&&(this.pos+=4-t)}},G9.prototype.bit8=function(){for(var o=this.width%4,t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var i=this.datav.getUint8(this.pos++,!0),n=e*this.width*4+r*4;if(i<this.palette.length){var s=this.palette[i];this.data[n]=s.red,this.data[n+1]=s.green,this.data[n+2]=s.blue,this.data[n+3]=255}else this.data[n]=255,this.data[n+1]=255,this.data[n+2]=255,this.data[n+3]=255}o!=0&&(this.pos+=4-o)}},G9.prototype.bit15=function(){for(var o=this.width%3,t=parseInt("11111",2),e=t,r=this.height-1;r>=0;r--){for(var i=this.bottom_up?r:this.height-1-r,n=0;n<this.width;n++){var s=this.datav.getUint16(this.pos,!0);this.pos+=2;var a=(s&e)/e*255|0,l=(s>>5&e)/e*255|0,c=(s>>10&e)/e*255|0,h=s>>15?255:0,u=i*this.width*4+n*4;this.data[u]=c,this.data[u+1]=l,this.data[u+2]=a,this.data[u+3]=h}this.pos+=o}},G9.prototype.bit16=function(){for(var o=this.width%3,t=parseInt("11111",2),e=t,r=parseInt("111111",2),i=r,n=this.height-1;n>=0;n--){for(var s=this.bottom_up?n:this.height-1-n,a=0;a<this.width;a++){var l=this.datav.getUint16(this.pos,!0);this.pos+=2;var c=255,h=(l&e)/e*255|0,u=(l>>5&i)/i*255|0,d=(l>>11)/e*255|0,p=s*this.width*4+a*4;this.data[p]=d,this.data[p+1]=u,this.data[p+2]=h,this.data[p+3]=c}this.pos+=o}},G9.prototype.bit24=function(){for(var o=this.height-1;o>=0;o--){for(var t=this.bottom_up?o:this.height-1-o,e=0;e<this.width;e++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0),s=t*this.width*4+e*4;this.data[s]=n,this.data[s+1]=i,this.data[s+2]=r,this.data[s+3]=255}this.pos+=this.width%4}},G9.prototype.bit32=function(){for(var o=this.height-1;o>=0;o--)for(var t=this.bottom_up?o:this.height-1-o,e=0;e<this.width;e++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),a=t*this.width*4+e*4;this.data[a]=n,this.data[a+1]=i,this.data[a+2]=r,this.data[a+3]=s}},G9.prototype.getData=function(){return this.data};function TLt(o){var t=0;if(o[t++]!==71||o[t++]!==73||o[t++]!==70||o[t++]!==56||(o[t++]+1&253)!==56||o[t++]!==97)throw"Invalid GIF 87a/89a header.";var e=o[t++]|o[t++]<<8,r=o[t++]|o[t++]<<8,i=o[t++],n=i>>7,s=i&7,a=1<<s+1,l=o[t++];o[t++];var c=null;n&&(c=t,t+=a*3);var h=!0,u=[],d=0,p=null,m=0,g=null;for(this.width=e,this.height=r;h&&t<o.length;)switch(o[t++]){case 33:switch(o[t++]){case 255:if(o[t]!==11||o[t+1]==78&&o[t+2]==69&&o[t+3]==84&&o[t+4]==83&&o[t+5]==67&&o[t+6]==65&&o[t+7]==80&&o[t+8]==69&&o[t+9]==50&&o[t+10]==46&&o[t+11]==48&&o[t+12]==3&&o[t+13]==1&&o[t+16]==0)t+=14,g=o[t++]|o[t++]<<8,t++;else for(t+=12;;){var y=o[t++];if(y===0)break;t+=y}break;case 249:if(o[t++]!==4||o[t+4]!==0)throw"Invalid graphics extension block.";var b=o[t++];d=o[t++]|o[t++]<<8,p=o[t++],b&1||(p=null),m=b>>2&7,t++;break;case 254:for(;;){var y=o[t++];if(y===0)break;t+=y}break;default:throw"Unknown graphic control label: 0x"+o[t-1].toString(16)}break;case 44:var P=o[t++]|o[t++]<<8,T=o[t++]|o[t++]<<8,I=o[t++]|o[t++]<<8,C=o[t++]|o[t++]<<8,E=o[t++],O=E>>7,_=E>>6&1,R=E&7,v=1<<R+1,D=c,w=!1;if(O){var w=!0;D=t,t+=v*3}var F=t;for(t++;;){var y=o[t++];if(y===0)break;t+=y}u.push({x:P,y:T,width:I,height:C,has_local_palette:w,palette_offset:D,data_offset:F,data_length:t-F,transparent_index:p,interlaced:!!_,delay:d,disposal:m});break;case 59:h=!1;break;default:throw"Unknown gif block: 0x"+o[t-1].toString(16)}this.numFrames=function(){return u.length},this.loopCount=function(){return g},this.frameInfo=function(H){if(H<0||H>=u.length)throw"Frame index out of range.";return u[H]},this.decodeAndBlitFrameBGRA=function(H,z){var G=this.frameInfo(H),W=G.width*G.height,L=new Uint8Array(W);MKe(o,G.data_offset,L,W);var B=G.palette_offset,N=G.transparent_index;N===null&&(N=256);var U=G.width,k=e-U,V=U,Y=(G.y*e+G.x)*4,X=((G.y+G.height)*e+G.x)*4,Z=Y,Q=k*4;G.interlaced===!0&&(Q+=(U+k)*4*7);for(var ae=8,he=0,re=L.length;he<re;++he){var se=L[he];if(V===0&&(Z+=Q,V=U,Z>=X&&(Q=k+(U+k)*4*(ae-1),Z=Y+(U+k)*(ae<<1),ae>>=1)),se===N)Z+=4;else{var K=o[B+se*3],me=o[B+se*3+1],Oe=o[B+se*3+2];z[Z++]=Oe,z[Z++]=me,z[Z++]=K,z[Z++]=255}--V}},this.decodeAndBlitFrameRGBA=function(H,z){var G=this.frameInfo(H),W=G.width*G.height,L=new Uint8Array(W);MKe(o,G.data_offset,L,W);var B=G.palette_offset,N=G.transparent_index;N===null&&(N=256);var U=G.width,k=e-U,V=U,Y=(G.y*e+G.x)*4,X=((G.y+G.height)*e+G.x)*4,Z=Y,Q=k*4;G.interlaced===!0&&(Q+=(U+k)*4*7);for(var ae=8,he=0,re=L.length;he<re;++he){var se=L[he];if(V===0&&(Z+=Q,V=U,Z>=X&&(Q=k+(U+k)*4*(ae-1),Z=Y+(U+k)*(ae<<1),ae>>=1)),se===N)Z+=4;else{var K=o[B+se*3],me=o[B+se*3+1],Oe=o[B+se*3+2];z[Z++]=K,z[Z++]=me,z[Z++]=Oe,z[Z++]=255}--V}}}function MKe(o,t,e,r){for(var i=o[t++],n=1<<i,s=n+1,a=s+1,l=i+1,c=(1<<l)-1,h=0,u=0,d=0,p=o[t++],m=new Int32Array(4096),g=null;;){for(;h<16&&p!==0;)u|=o[t++]<<h,h+=8,p===1?p=o[t++]:--p;if(h<l)break;var y=u&c;if(u>>=l,h-=l,y===n){a=s+1,l=i+1,c=(1<<l)-1,g=null;continue}else if(y===s)break;for(var b=y<a?y:g,P=0,T=b;T>n;)T=m[T]>>8,++P;var I=T,C=d+P+(b!==y?1:0);if(C>r){console.log("Warning, gif stream longer than expected.");return}e[d++]=I,d+=P;var E=d;for(b!==y&&(e[d++]=I),T=b;P--;)T=m[T],e[--E]=T&255,T>>=8;g!==null&&a<4096&&(m[a++]=g<<8|I,a>=c+1&&l<12&&(++l,c=c<<1|1)),g=y}return d!==r&&console.log("Warning, gif stream shorter than expected."),e}function UKe(o){var t=this,e=Math.round,r=Math.floor,i=new Array(64),n=new Array(64),s=new Array(64),a=new Array(64),l,c,h,u,d=new Array(65535),p=new Array(65535),m=new Array(64),g=new Array(64),y=[],b=0,P=7,T=new Array(64),I=new Array(64),C=new Array(64),E=new Array(256),O=new Array(2048),_,R=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],v=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],D=[0,1,2,3,4,5,6,7,8,9,10,11],w=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],F=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],H=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],z=[0,1,2,3,4,5,6,7,8,9,10,11],G=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function L(ue){for(var Pe=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],j=0;j<64;j++){var J=r((Pe[j]*ue+50)/100);J<1?J=1:J>255&&(J=255),i[R[j]]=J}for(var oe=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],pe=0;pe<64;pe++){var ge=r((oe[pe]*ue+50)/100);ge<1?ge=1:ge>255&&(ge=255),n[R[pe]]=ge}for(var Se=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],De=0,tt=0;tt<8;tt++)for(var Ze=0;Ze<8;Ze++)s[De]=1/(i[R[De]]*Se[tt]*Se[Ze]*8),a[De]=1/(n[R[De]]*Se[tt]*Se[Ze]*8),De++}function B(ue,Pe){for(var j=0,J=0,oe=new Array,pe=1;pe<=16;pe++){for(var ge=1;ge<=ue[pe];ge++)oe[Pe[J]]=[],oe[Pe[J]][0]=j,oe[Pe[J]][1]=pe,J++,j++;j*=2}return oe}function N(){l=B(v,D),c=B(H,z),h=B(w,F),u=B(G,W)}function U(){for(var ue=1,Pe=2,j=1;j<=15;j++){for(var J=ue;J<Pe;J++)p[32767+J]=j,d[32767+J]=[],d[32767+J][1]=j,d[32767+J][0]=J;for(var oe=-(Pe-1);oe<=-ue;oe++)p[32767+oe]=j,d[32767+oe]=[],d[32767+oe][1]=j,d[32767+oe][0]=Pe-1+oe;ue<<=1,Pe<<=1}}function k(){for(var ue=0;ue<256;ue++)O[ue]=19595*ue,O[ue+256>>0]=38470*ue,O[ue+512>>0]=7471*ue+32768,O[ue+768>>0]=-11059*ue,O[ue+1024>>0]=-21709*ue,O[ue+1280>>0]=32768*ue+8421375,O[ue+1536>>0]=-27439*ue,O[ue+1792>>0]=-5329*ue}function V(ue){for(var Pe=ue[0],j=ue[1]-1;j>=0;)Pe&1<<j&&(b|=1<<P),j--,P--,P<0&&(b==255?(Y(255),Y(0)):Y(b),P=7,b=0)}function Y(ue){y.push(ue)}function X(ue){Y(ue>>8&255),Y(ue&255)}function Z(ue,Pe){var j,J,oe,pe,ge,Se,De,tt,Ze=0,Wt,Nr=8,Lr=64;for(Wt=0;Wt<Nr;++Wt){j=ue[Ze],J=ue[Ze+1],oe=ue[Ze+2],pe=ue[Ze+3],ge=ue[Ze+4],Se=ue[Ze+5],De=ue[Ze+6],tt=ue[Ze+7];var Dr=j+tt,Rr=j-tt,ke=J+De,Yt=J-De,Ut=oe+Se,ar=oe-Se,Fe=pe+ge,it=pe-ge,ye=Dr+Fe,bt=Dr-Fe,zt=ke+Ut,de=ke-Ut;ue[Ze]=ye+zt,ue[Ze+4]=ye-zt;var qe=(de+bt)*.707106781;ue[Ze+2]=bt+qe,ue[Ze+6]=bt-qe,ye=it+ar,zt=ar+Yt,de=Yt+Rr;var lt=(ye-de)*.382683433,Ne=.5411961*ye+lt,et=1.306562965*de+lt,At=zt*.707106781,dr=Rr+At,vr=Rr-At;ue[Ze+5]=vr+Ne,ue[Ze+3]=vr-Ne,ue[Ze+1]=dr+et,ue[Ze+7]=dr-et,Ze+=8}for(Ze=0,Wt=0;Wt<Nr;++Wt){j=ue[Ze],J=ue[Ze+8],oe=ue[Ze+16],pe=ue[Ze+24],ge=ue[Ze+32],Se=ue[Ze+40],De=ue[Ze+48],tt=ue[Ze+56];var Zr=j+tt,xi=j-tt,Zi=J+De,Fi=J-De,$i=oe+Se,yo=oe-Se,Ha=pe+ge,da=pe-ge,Ic=Zr+Ha,kp=Zr-Ha,Cc=Zi+$i,Dt=Zi-$i;ue[Ze]=Ic+Cc,ue[Ze+32]=Ic-Cc;var Al=(Dt+kp)*.707106781;ue[Ze+16]=kp+Al,ue[Ze+48]=kp-Al,Ic=da+yo,Cc=yo+Fi,Dt=Fi+xi;var ht=(Ic-Dt)*.382683433,_t=.5411961*Ic+ht,rr=1.306562965*Dt+ht,Qr=Cc*.707106781,Vi=xi+Qr,jn=xi-Qr;ue[Ze+40]=jn+_t,ue[Ze+24]=jn-_t,ue[Ze+8]=Vi+rr,ue[Ze+56]=Vi-rr,Ze++}var wn;for(Wt=0;Wt<Lr;++Wt)wn=ue[Wt]*Pe[Wt],m[Wt]=wn>0?wn+.5|0:wn-.5|0;return m}function Q(){X(65504),X(16),Y(74),Y(70),Y(73),Y(70),Y(0),Y(1),Y(1),Y(0),X(1),X(1),Y(0),Y(0)}function ae(ue,Pe){X(65472),X(17),Y(8),X(Pe),X(ue),Y(3),Y(1),Y(17),Y(0),Y(2),Y(17),Y(1),Y(3),Y(17),Y(1)}function he(){X(65499),X(132),Y(0);for(var ue=0;ue<64;ue++)Y(i[ue]);Y(1);for(var Pe=0;Pe<64;Pe++)Y(n[Pe])}function re(){X(65476),X(418),Y(0);for(var ue=0;ue<16;ue++)Y(v[ue+1]);for(var Pe=0;Pe<=11;Pe++)Y(D[Pe]);Y(16);for(var j=0;j<16;j++)Y(w[j+1]);for(var J=0;J<=161;J++)Y(F[J]);Y(1);for(var oe=0;oe<16;oe++)Y(H[oe+1]);for(var pe=0;pe<=11;pe++)Y(z[pe]);Y(17);for(var ge=0;ge<16;ge++)Y(G[ge+1]);for(var Se=0;Se<=161;Se++)Y(W[Se])}function se(){X(65498),X(12),Y(3),Y(1),Y(0),Y(2),Y(17),Y(3),Y(17),Y(0),Y(63),Y(0)}function K(ue,Pe,j,J,oe){for(var pe=oe[0],ge=oe[240],Se,De=16,tt=63,Ze=64,Wt=Z(ue,Pe),Nr=0;Nr<Ze;++Nr)g[R[Nr]]=Wt[Nr];var Lr=g[0]-j;j=g[0],Lr==0?V(J[0]):(Se=32767+Lr,V(J[p[Se]]),V(d[Se]));for(var Dr=63;Dr>0&&g[Dr]==0;Dr--);if(Dr==0)return V(pe),j;for(var Rr=1,ke;Rr<=Dr;){for(var Yt=Rr;g[Rr]==0&&Rr<=Dr;++Rr);var Ut=Rr-Yt;if(Ut>=De){ke=Ut>>4;for(var ar=1;ar<=ke;++ar)V(ge);Ut=Ut&15}Se=32767+g[Rr],V(oe[(Ut<<4)+p[Se]]),V(d[Se]),Rr++}return Dr!=tt&&V(pe),j}function me(){for(var ue=String.fromCharCode,Pe=0;Pe<256;Pe++)E[Pe]=ue(Pe)}this.encode=function(ue,Pe){var j=new Date().getTime();Pe&&Oe(Pe),y=new Array,b=0,P=7,X(65496),Q(),he(),ae(ue.width,ue.height),re(),se();var J=0,oe=0,pe=0;b=0,P=7,this.encode.displayName="_encode_";for(var ge=ue.data,Se=ue.width,De=ue.height,tt=Se*4,Ze=Se*3,Wt,Nr=0,Lr,Dr,Rr,ke,Yt,Ut,ar,Fe;Nr<De;){for(Wt=0;Wt<tt;){for(ke=tt*Nr+Wt,Yt=ke,Ut=-1,ar=0,Fe=0;Fe<64;Fe++)ar=Fe>>3,Ut=(Fe&7)*4,Yt=ke+ar*tt+Ut,Nr+ar>=De&&(Yt-=tt*(Nr+1+ar-De)),Wt+Ut>=tt&&(Yt-=Wt+Ut-tt+4),Lr=ge[Yt++],Dr=ge[Yt++],Rr=ge[Yt++],T[Fe]=(O[Lr]+O[Dr+256>>0]+O[Rr+512>>0]>>16)-128,I[Fe]=(O[Lr+768>>0]+O[Dr+1024>>0]+O[Rr+1280>>0]>>16)-128,C[Fe]=(O[Lr+1280>>0]+O[Dr+1536>>0]+O[Rr+1792>>0]>>16)-128;J=K(T,s,J,l,h),oe=K(I,a,oe,c,u),pe=K(C,a,pe,c,u),Wt+=32}Nr+=8}if(P>=0){var it=[];it[1]=P+1,it[0]=(1<<P+1)-1,V(it)}return X(65497),new Uint8Array(y)};function Oe(ue){if(ue<=0&&(ue=1),ue>100&&(ue=100),_!=ue){var Pe=0;ue<50?Pe=Math.floor(5e3/ue):Pe=Math.floor(200-ue*2),L(Pe),_=ue}}function Ie(){var ue=new Date().getTime();o||(o=50),me(),N(),U(),k(),Oe(o);var Pe=new Date().getTime()-ue}Ie()}(function(o){"use strict";o.processBMP=function(t,e,r,i,n){var s=new G9(t,!1),a=s.width,l=s.height,c=100,h=s.getData(),u={data:h,width:a,height:l},d=new UKe(c),p=d.encode(u,c);return o.processJPEG.call(this,p,e,r,i)}})(b2.API);(function(o){"use strict";o.processGIF89A=function(t,e,r,i,n){var s=new TLt(t),a=s.width,l=s.height,c=100,h=[];s.decodeAndBlitFrameRGBA(0,h);var u=new Uint8Array(a*l*4),d={data:h,width:a,height:l},p=new UKe(c),m=p.encode(d,c);return o.processJPEG.call(this,m,e,r,i)},o.processGIF87A=o.processGIF89A})(b2.API);(function(o){"use strict";var t=function(e){if(typeof e<"u"&&e!="")return!0};return b2.API.events.push(["addPage",function(e){var r=this.internal.getPageInfo(e.pageNumber);r.pageContext.annotations=[]}]),o.events.push(["putPage",function(e){for(var r=this.internal.getCoordinateString,i=this.internal.getVerticalCoordinateString,n=this.internal.getPageInfoByObjId(e.objId),s=e.pageContext.annotations,a,l,c,h=!1,u=0;u<s.length&&!h;u++)switch(a=s[u],a.type){case"link":(t(a.options.url)||t(a.options.pageNumber)||t(a.options.js))&&(h=!0);break;case"reference":case"text":case"freetext":h=!0;break}if(h!=!1){this.internal.write("/Annots [");for(var d=0;d<s.length;d++)switch(a=s[d],a.type){case"reference":this.internal.write(" "+a.object.objId+" 0 R ");break;case"text":var p=this.internal.newAdditionalObject(),m=this.internal.newAdditionalObject(),g=a.title||"Note";l="/Rect ["+r(a.bounds.x)+" "+i(a.bounds.y+a.bounds.h,n.pageNumber)+" "+r(a.bounds.x+a.bounds.w)+" "+i(a.bounds.y,n.pageNumber)+"] ",c="<</Type /Annot /Subtype /Text "+l+`/Contents ${a.contentType==="code"?"<":"("}`+a.contents+`${a.contentType==="code"?">":")"}`,c+=" /Popup "+m.objId+" 0 R",c+=" /P "+n.objId+" 0 R",c+=` /T ${a.contentType==="code"?"<":"("}`+g+`${a.contentType==="code"?">":")"} >>`,p.content=c;var y=p.objId+" 0 R",b=30;l="/Rect ["+r(a.bounds.x+b)+" "+i(a.bounds.y+a.bounds.h,n.pageNumber)+" "+r(a.bounds.x+a.bounds.w+b)+" "+i(a.bounds.y,n.pageNumber)+"] ",c="<</Type /Annot /Subtype /Popup "+l+" /Parent "+y,a.open&&(c+=" /Open true"),c+=" >>",m.content=c,this.internal.write(p.objId,"0 R",m.objId,"0 R");break;case"freetext":l="/Rect ["+r(a.bounds.x)+" "+i(a.bounds.y,n.pageNumber)+" "+r(a.bounds.x+a.bounds.w)+" "+i(a.bounds.y+a.bounds.h,n.pageNumber)+"] ";var P=a.color||"#000000";c="<</Type /Annot /Subtype /FreeText "+l+`/Contents ${a.contentType==="code"?"<":"("}`+a.contents+`${a.contentType==="code"?">":")"}`,c+=" /DS(font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+P+")",c+=" /Border [0 0 0]",c+=" >>",this.internal.write(c);break;case"link":if(a.options.name){var T=this.annotations._nameMap[a.options.name];a.options.pageNumber=T.page,a.options.top=T.y}else a.options.top||(a.options.top=0);if(l="/Rect ["+r(a.x)+" "+i(a.y,n.pageNumber)+" "+r(a.x+a.w)+" "+i(a.y+a.h,n.pageNumber)+"] ",c="",a.options.url)c="<</Type /Annot /Subtype /Link "+l+"/Border [0 0 0] /A <</S /URI /URI ("+a.options.url+") >>";else if(a.options.pageNumber){var I=this.internal.getPageInfo(a.options.pageNumber);switch(c="<</Type /Annot /Subtype /Link "+l+"/Border [0 0 0] /Dest ["+I.objId+" 0 R",a.options.magFactor=a.options.magFactor||"XYZ",a.options.magFactor){case"Fit":c+=" /Fit]";break;case"FitH":c+=" /FitH "+a.options.top+"]";break;case"FitV":a.options.left=a.options.left||0,c+=" /FitV "+a.options.left+"]";break;case"XYZ":default:var C=i(a.options.top);a.options.left=a.options.left||0,typeof a.options.zoom>"u"&&(a.options.zoom=0),c+=" /XYZ "+a.options.left+" "+C+" "+a.options.zoom+"]";break}}else a.options.js&&(c=`<</Type /Annot /Subtype /Link ${l} /Border [0 0 0] /A << /Type /Action /S /JavaScript /JS ${a.options.contentType==="code"?"<":"("} ${a.options.js} ${a.options.contentType==="code"?">":")"} >>`);c!=""&&(c+=" >>",this.internal.write(c));break}this.internal.write("]")}}]),o.createAnnotation=function(e){var r=this.internal.getCurrentPageInfo();switch(e.type){case"link":this.link(e.bounds.x,e.bounds.y,e.bounds.w,e.bounds.h,e);break;case"text":case"freetext":r.pageContext.annotations.push(e);break}},o.link=function(e,r,i,n,s){var a=this.internal.getCurrentPageInfo();a.pageContext.annotations.push({x:e,y:r,w:i,h:n,options:s,type:"link"})},o.textWithLink=function(e,r,i,n){var s=this.getTextWidth(e),a=this.internal.getLineHeight()/this.internal.scaleFactor;return this.text(e,r,i,n),i+=a*.2,this.link(r,i-a,s,a,n),s},o.getTextWidth=function(e){var r=this.internal.getFontSize(),i=this.getStringUnitWidth(e)*r/this.internal.scaleFactor;return i},this})(b2.API);(function(o){var t;return o.events.push(["postPutResources",function(){var e=this,r=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var i=e.outline.render().split(/\r\n/),n=0;n<i.length;n++){var s=i[n],a=r.exec(s);if(a!=null){var l=a[1];e.internal.newObjectDeferredBegin(l,!1)}e.internal.write(s)}if(this.outline.createNamedDestinations){for(var c=this.internal.pages.length,h=[],n=0;n<c;n++){var u=e.internal.newObject();h.push(u);var d=e.internal.getPageInfo(n+1);e.internal.write("<< /D["+d.objId+" 0 R /XYZ null null null]>> endobj")}var p=e.internal.newObject();e.internal.write("<< /Names [ ");for(var n=0;n<h.length;n++)e.internal.write("(page_"+(n+1)+")"+h[n]+" 0 R");e.internal.write(" ] >>","endobj"),t=e.internal.newObject(),e.internal.write("<< /Dests "+p+" 0 R"),e.internal.write(">>","endobj")}}]),o.events.push(["putCatalog",function(){var e=this;e.outline.root.children.length>0&&(e.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&e.internal.write("/Names "+t+" 0 R"))}]),o.events.push(["initialized",function(){var e=this;e.outline={createNamedDestinations:!1,root:{children:[]}},e.outline.add=function(r,i,n){var s={title:i,options:n,children:[]};return r==null&&(r=this.root),r.children.push(s),s},e.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=e,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},e.outline.genIds_r=function(r){r.id=e.internal.newObjectDeferred();for(var i=0;i<r.children.length;i++)this.genIds_r(r.children[i])},e.outline.renderRoot=function(r){this.objStart(r),this.line("/Type /Outlines"),r.children.length>0&&(this.line("/First "+this.makeRef(r.children[0])),this.line("/Last "+this.makeRef(r.children[r.children.length-1]))),this.line("/Count "+this.count_r({count:0},r)),this.objEnd()},e.outline.renderItems=function(r){for(var i=this.ctx.pdf.internal.getVerticalCoordinateString,n=0;n<r.children.length;n++){var s=r.children[n];this.objStart(s),this.line("/Title "+this.makeString(s.title)),this.line("/Parent "+this.makeRef(r)),n>0&&this.line("/Prev "+this.makeRef(r.children[n-1])),n<r.children.length-1&&this.line("/Next "+this.makeRef(r.children[n+1])),s.children.length>0&&(this.line("/First "+this.makeRef(s.children[0])),this.line("/Last "+this.makeRef(s.children[s.children.length-1])));var a=this.count=this.count_r({count:0},s);if(a>0&&this.line("/Count "+a),s.options&&s.options.pageNumber){let{bbox:u,useMark:d}=s.options;if(u){let{x:p,y:m,width:g,height:y}=u,b=Math.max(g,y),P=`this.removeField('arrow');var a = this.addField('arrow','text',${s.options.pageNumber-1},[${p},${m},${p+g},${m-y}]);a.textColor=color.blue;a.value=""`;var l=e.internal.newObject();e.internal.write("<</D["+(s.options.pageNumber-1)+` /XYZ 0 ${i(0)} 0]/S/GoTo/Next `+(l+1)+" 0 R>> endobj"),e.internal.newObject(),e.internal.write(`<</JS(this.zoomType=zoomtype.fitV;var box=this.getPageBox('Media',${s.options.pageNumber-1});var scale=(box[2]-box[0])/${b}/5;this.zoom*=scale;var scrollX=${p+g/2}-(box[2]-box[0])/2/scale;var scrollY=${m-y/2}-(box[3]-box[1])/2/scale;this.scroll(scrollX,scrollY);${d?P:""})/S/JavaScript>> endobj`),this.line("/A "+l+" 0 R")}else{var c=e.internal.getPageInfo(s.options.pageNumber);this.line("/Dest ["+c.objId+" 0 R /XYZ 0 "+i(0)+" 0]")}}this.objEnd()}for(var h=0;h<r.children.length;h++)this.renderItems(r.children[h])},e.outline.line=function(r){this.ctx.val+=r+`\r
`},e.outline.makeRef=function(r){return r.id+" 0 R"},e.outline.makeString=function(r){return"("+e.internal.pdfEscape(r)+")"},e.outline.objStart=function(r){this.ctx.val+=`\r
`+r.id+` 0 obj\r
<<\r
`},e.outline.objEnd=function(){this.ctx.val+=`>> \r
endobj\r
`},e.outline.count_r=function(r,i){for(var n=0;n<i.children.length;n++)r.count++,this.count_r(r,i.children[n]);return r.count}}]),this})(b2.API);(function(o){"use strict";var t=function(a){var l,c,h,u,d,p,m,g,y,b;for(/[^\x00-\xFF]/.test(a),l="\0\0\0\0".slice(a.length%4||4),a+=l,c=[],h=0,u=a.length;u>h;h+=4)d=(a.charCodeAt(h)<<24)+(a.charCodeAt(h+1)<<16)+(a.charCodeAt(h+2)<<8)+a.charCodeAt(h+3),d!==0?(b=d%85,d=(d-b)/85,y=d%85,d=(d-y)/85,g=d%85,d=(d-g)/85,m=d%85,d=(d-m)/85,p=d%85,c.push(p+33,m+33,g+33,y+33,b+33)):c.push(122);return(function(P,T){for(var I=T;I>0;I--)P.pop()})(c,l.length),String.fromCharCode.apply(String,c)+"~>"},e=function(a){var l,c,h,u,d,p=String,m="length",g=255,y="charCodeAt",b="slice",P="replace";for(a[b](-2),a=a[b](0,-2)[P](/\s/g,"")[P]("z","!!!!!"),l="uuuuu"[b](a[m]%5||5),a+=l,h=[],u=0,d=a[m];d>u;u+=5)c=52200625*(a[y](u)-33)+614125*(a[y](u+1)-33)+7225*(a[y](u+2)-33)+85*(a[y](u+3)-33)+(a[y](u+4)-33),h.push(g&c>>24,g&c>>16,g&c>>8,g&c);return(function(T,I){for(var C=I;C>0;C--)T.pop()})(h,l[m]),p.fromCharCode.apply(p,h)},r=function(a){return a.split("").map(function(l){return("0"+l.charCodeAt().toString(16)).slice(-2)}).join("")+">"},i=function(a){var l=new RegExp(/^([0-9A-Fa-f]{2})+$/);if(a=a.replace(/\s/g,""),a.indexOf(">")!==-1&&(a=a.substr(0,a.indexOf(">"))),a.length%2&&(a+="0"),l.test(a)===!1)return"";for(var c="",h=0;h<a.length;h+=2)c+=String.fromCharCode("0x"+(a[h]+a[h+1]));return c},n=function(a,l){var c=new Uint8Array(a.byteLength+l.byteLength);return c.set(new Uint8Array(a),0),c.set(new Uint8Array(l),a.byteLength),c},s=function(a){for(var l=[],c=a.length,h,u;c--;)l[c]=a.charCodeAt(c);return h=o.adler32cs.from(a),u=new C_e(6),a=u.append(new Uint8Array(l)),a=n(a,u.flush()),l=new Uint8Array(a.byteLength+6),l.set(new Uint8Array([120,156])),l.set(a,2),l.set(new Uint8Array([h&255,h>>8&255,h>>16&255,h>>24&255]),a.byteLength+2),a=l.reduce(function(d,p){return d+String.fromCharCode(p)},""),a};o.processDataByFilters=function(a,l){"use strict";var c=0,h=a||"",u=[];for(l=l||[],typeof l=="string"&&(l=[l]),c=0;c<l.length;c+=1)switch(l[c]){case"ASCII85Decode":case"/ASCII85Decode":h=e(h),u.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":h=t(h),u.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":h=i(h),u.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":h=r(h),u.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":h=s(h),u.push("/FlateDecode");break;default:throw new Error('The filter: "'+l[c]+'" is not implemented')}return{data:h,reverseChain:u.reverse().join(" ")}}})(b2.API);(function(o,t){o.API.adler32cs=t()})(b2,function(){var o=typeof ArrayBuffer=="function"&&typeof Uint8Array=="function",t=null,e=(function(){if(!o)return function(){return!1};try{var c={};typeof c.Buffer=="function"&&(t=c.Buffer)}catch{}return function(h){return h instanceof ArrayBuffer||t!==null&&h instanceof t}})(),r=(function(){return t!==null?function(c){return new t(c,"utf8").toString("binary")}:function(c){return unescape(encodeURIComponent(c))}})(),i=65521,n=function(c,h){for(var u=c&65535,d=c>>>16,p=0,m=h.length;p<m;p++)u=(u+(h.charCodeAt(p)&255))%i,d=(d+u)%i;return(d<<16|u)>>>0},s=function(c,h){for(var u=c&65535,d=c>>>16,p=0,m=h.length;p<m;p++)u=(u+h[p])%i,d=(d+u)%i;return(d<<16|u)>>>0},a={},l=a.Adler32=(function(){var c=function(u){if(!(this instanceof c))throw new TypeError("Constructor cannot called be as a function.");if(!isFinite(u=u===null?1:+u))throw new Error("First arguments needs to be a finite number.");this.checksum=u>>>0},h=c.prototype={};return h.constructor=c,c.from=(function(u){return u.prototype=h,u})(function(u){if(!(this instanceof c))throw new TypeError("Constructor cannot called be as a function.");if(u===null)throw new Error("First argument needs to be a string.");this.checksum=n(1,u.toString())}),c.fromUtf8=(function(u){return u.prototype=h,u})(function(u){if(!(this instanceof c))throw new TypeError("Constructor cannot called be as a function.");if(u===null)throw new Error("First argument needs to be a string.");var d=r(u.toString());this.checksum=n(1,d)}),o&&(c.fromBuffer=(function(u){return u.prototype=h,u})(function(u){if(!(this instanceof c))throw new TypeError("Constructor cannot called be as a function.");if(!e(u))throw new Error("First argument needs to be ArrayBuffer.");var d=new Uint8Array(u);return this.checksum=s(1,d)})),h.update=function(u){if(u===null)throw new Error("First argument needs to be a string.");return u=u.toString(),this.checksum=n(this.checksum,u)},h.updateUtf8=function(u){if(u===null)throw new Error("First argument needs to be a string.");var d=r(u.toString());return this.checksum=n(this.checksum,d)},o&&(h.updateBuffer=function(u){if(!e(u))throw new Error("First argument needs to be ArrayBuffer.");var d=new Uint8Array(u);return this.checksum=s(this.checksum,d)}),h.clone=function(){return new l(this.checksum)},c})();return a.from=function(c){if(c===null)throw new Error("First argument needs to be a string.");return n(1,c.toString())},a.fromUtf8=function(c){if(c===null)throw new Error("First argument needs to be a string.");var h=r(c.toString());return n(1,h)},o&&(a.fromBuffer=function(c){if(!e(c))throw new Error("First argument need to be ArrayBuffer.");var h=new Uint8Array(c);return s(1,h)}),a}),b2.API.TTFFont=(function(){o.open=function(t){return new o(t)};function o(t){var e;if(this.rawData=t,e=this.contents=new nL(t),this.contents.pos=4,e.readString(4)==="ttcf")throw new Error("TTCF not supported.");e.pos=0,this.parse(),this.subset=new kLt(this),this.registerTTF()}return o.prototype.parse=function(){return this.directory=new ILt(this.contents),this.head=new SLt(this),this.name=new vLt(this),this.cmap=new HKe(this),this.toUnicode={},this.hhea=new ELt(this),this.maxp=new xLt(this),this.hmtx=new RLt(this),this.post=new ALt(this),this.os2=new OLt(this),this.loca=new MLt(this),this.glyf=new DLt(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},o.prototype.registerTTF=function(){var t,e,r,i,n;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var s,a,l,c;for(l=this.bbox,c=[],s=0,a=l.length;s<a;s++)t=l[s],c.push(Math.round(t*this.scaleFactor));return c}).call(this),this.stemV=0,this.post.exists?(i=this.post.italic_angle,e=i>>16,r=i&255,e&32768&&(e=-((e^65535)+1)),this.italicAngle=+(""+e+"."+r)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(n=this.familyClass)===1||n===2||n===3||n===4||n===5||n===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},o.prototype.characterToGlyph=function(t){var e;return((e=this.cmap.unicode)!=null?e.codeMap[t]:void 0)||0},o.prototype.widthOfGlyph=function(t){var e;return e=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*e},o.prototype.widthOfString=function(t,e,r){var i,n,s,a,l;for(t=""+t,a=0,n=0,l=t.length;0<=l?n<l:n>l;n=0<=l?++n:--n)i=t.charCodeAt(n),a+=this.widthOfGlyph(this.characterToGlyph(i))+r*(1e3/e)||0;return s=e/1e3,a*s},o.prototype.lineHeight=function(t,e){var r;return e==null&&(e=!1),r=e?this.lineGap:0,(this.ascender+r-this.decender)/1e3*t},o})();var nL=(function(){function o(t){this.data=t!=null?t:[],this.pos=0,this.length=this.data.length}return o.prototype.readByte=function(){return this.data[this.pos++]},o.prototype.writeByte=function(t){return this.data[this.pos++]=t},o.prototype.readUInt32=function(){var t,e,r,i;return t=this.readByte()*16777216,e=this.readByte()<<16,r=this.readByte()<<8,i=this.readByte(),t+e+r+i},o.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(t&255)},o.prototype.readInt32=function(){var t;return t=this.readUInt32(),t>=2147483648?t-4294967296:t},o.prototype.writeInt32=function(t){return t<0&&(t+=4294967296),this.writeUInt32(t)},o.prototype.readUInt16=function(){var t,e;return t=this.readByte()<<8,e=this.readByte(),t|e},o.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(t&255)},o.prototype.readInt16=function(){var t;return t=this.readUInt16(),t>=32768?t-65536:t},o.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},o.prototype.readString=function(t){var e,r;for(r=[],e=0;0<=t?e<t:e>t;e=0<=t?++e:--e)r[e]=String.fromCharCode(this.readByte());return r.join("")},o.prototype.writeString=function(t){var e,r,i;for(i=[],e=0,r=t.length;0<=r?e<r:e>r;e=0<=r?++e:--e)i.push(this.writeByte(t.charCodeAt(e)));return i},o.prototype.readShort=function(){return this.readInt16()},o.prototype.writeShort=function(t){return this.writeInt16(t)},o.prototype.readLongLong=function(){var t,e,r,i,n,s,a,l;return t=this.readByte(),e=this.readByte(),r=this.readByte(),i=this.readByte(),n=this.readByte(),s=this.readByte(),a=this.readByte(),l=this.readByte(),t&128?((t^255)*72057594037927940+(e^255)*281474976710656+(r^255)*1099511627776+(i^255)*4294967296+(n^255)*16777216+(s^255)*65536+(a^255)*256+(l^255)+1)*-1:t*72057594037927940+e*281474976710656+r*1099511627776+i*4294967296+n*16777216+s*65536+a*256+l},o.prototype.writeLongLong=function(t){var e,r;return e=Math.floor(t/4294967296),r=t&4294967295,this.writeByte(e>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(e&255),this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(r&255)},o.prototype.readInt=function(){return this.readInt32()},o.prototype.writeInt=function(t){return this.writeInt32(t)},o.prototype.read=function(t){var e,r;for(e=[],r=0;0<=t?r<t:r>t;r=0<=t?++r:--r)e.push(this.readByte());return e},o.prototype.write=function(t){var e,r,i,n;for(n=[],r=0,i=t.length;r<i;r++)e=t[r],n.push(this.writeByte(e));return n},o})(),ILt=(function(){var o;function t(e){var r,i,n;for(this.scalarType=e.readInt(),this.tableCount=e.readShort(),this.searchRange=e.readShort(),this.entrySelector=e.readShort(),this.rangeShift=e.readShort(),this.tables={},i=0,n=this.tableCount;0<=n?i<n:i>n;i=0<=n?++i:--i)r={tag:e.readString(4),checksum:e.readInt(),offset:e.readInt(),length:e.readInt()},this.tables[r.tag]=r}return t.prototype.encode=function(e){var r,i,n,s,a,l,c,h,u,d,p,m,g,y;m=Object.keys(e).length,l=Math.log(2),u=Math.floor(Math.log(m)/l)*16,s=Math.floor(u/l),h=m*16-u,i=new nL,i.writeInt(this.scalarType),i.writeShort(m),i.writeShort(u),i.writeShort(s),i.writeShort(h),n=m*16,c=i.pos+n,a=null,g=[];for(y in e)for(p=e[y],i.writeString(y),i.writeInt(o(p)),i.writeInt(c),i.writeInt(p.length),g=g.concat(p),y==="head"&&(a=c),c+=p.length;c%4;)g.push(0),c++;return i.write(g),d=o(i.data),r=2981146554-d,i.pos=a+8,i.writeUInt32(r),i.data},o=function(e){var r,i,n,s;for(e=WKe.call(e);e.length%4;)e.push(0);for(n=new nL(e),i=0,r=0,s=e.length;r<s;r=r+=4)i+=n.readUInt32();return i&4294967295},t})(),W9,CLt={}.hasOwnProperty,cO=function(o,t){for(var e in t)CLt.call(t,e)&&(o[e]=t[e]);function r(){this.constructor=o}return r.prototype=t.prototype,o.prototype=new r,o.__super__=t.prototype,o};W9=(function(){function o(t){var e;this.file=t,e=this.file.directory.tables[this.tag],this.exists=!!e,e&&(this.offset=e.offset,this.length=e.length,this.parse(this.file.contents))}return o.prototype.parse=function(){},o.prototype.encode=function(){},o.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},o})();var SLt=(function(o){cO(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="head",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.revision=e.readInt(),this.checkSumAdjustment=e.readInt(),this.magicNumber=e.readInt(),this.flags=e.readShort(),this.unitsPerEm=e.readShort(),this.created=e.readLongLong(),this.modified=e.readLongLong(),this.xMin=e.readShort(),this.yMin=e.readShort(),this.xMax=e.readShort(),this.yMax=e.readShort(),this.macStyle=e.readShort(),this.lowestRecPPEM=e.readShort(),this.fontDirectionHint=e.readShort(),this.indexToLocFormat=e.readShort(),this.glyphDataFormat=e.readShort()},t.prototype.encode=function(e){var r;return r=new nL,r.writeInt(this.version),r.writeInt(this.revision),r.writeInt(this.checkSumAdjustment),r.writeInt(this.magicNumber),r.writeShort(this.flags),r.writeShort(this.unitsPerEm),r.writeLongLong(this.created),r.writeLongLong(this.modified),r.writeShort(this.xMin),r.writeShort(this.yMin),r.writeShort(this.xMax),r.writeShort(this.yMax),r.writeShort(this.macStyle),r.writeShort(this.lowestRecPPEM),r.writeShort(this.fontDirectionHint),r.writeShort(e),r.writeShort(this.glyphDataFormat),r.data},t})(W9),NKe=(function(){function o(t,e){var r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=e+t.readInt(),d=t.pos,t.pos=this.offset,this.format=t.readUInt16(),this.length=t.readUInt16(),this.language=t.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(l=0;l<256;++l)this.codeMap[l]=t.readByte();break;case 4:for(m=t.readUInt16(),p=m/2,t.pos+=6,n=(function(){var C,E;for(E=[],l=C=0;0<=p?C<p:C>p;l=0<=p?++C:--C)E.push(t.readUInt16());return E})(),t.pos+=2,y=(function(){var C,E;for(E=[],l=C=0;0<=p?C<p:C>p;l=0<=p?++C:--C)E.push(t.readUInt16());return E})(),c=(function(){var C,E;for(E=[],l=C=0;0<=p?C<p:C>p;l=0<=p?++C:--C)E.push(t.readUInt16());return E})(),h=(function(){var C,E;for(E=[],l=C=0;0<=p?C<p:C>p;l=0<=p?++C:--C)E.push(t.readUInt16());return E})(),i=(this.length-t.pos+this.offset)/2,a=(function(){var C,E;for(E=[],l=C=0;0<=i?C<i:C>i;l=0<=i?++C:--C)E.push(t.readUInt16());return E})(),l=P=0,I=n.length;P<I;l=++P)for(b=n[l],g=y[l],r=T=g;g<=b?T<=b:T>=b;r=g<=b?++T:--T)h[l]===0?s=r+c[l]:(u=h[l]/2+(r-g)-(p-l),s=a[u]||0,s!==0&&(s+=c[l])),this.codeMap[r]=s&65535}t.pos=d}return o.encode=function(t,e){var r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,R,v,D,w,F,H,z,G,W,L,B,N,U,k,V,Y,X,Z,Q,ae,he,re,se,K;switch(H=new nL,s=Object.keys(t).sort(function(me,Oe){return me-Oe}),e){case"macroman":for(g=0,y=(function(){var me=[];for(m=0;m<256;++m)me.push(0);return me})(),P={0:0},n={},z=0,B=s.length;z<B;z++)i=s[z],P[he=t[i]]==null&&(P[he]=++g),n[i]={old:t[i],new:P[t[i]]},y[i]=P[t[i]];return H.writeUInt16(1),H.writeUInt16(0),H.writeUInt32(12),H.writeUInt16(0),H.writeUInt16(262),H.writeUInt16(0),H.write(y),{charMap:n,subtable:H.data,maxGlyphID:g+1};case"unicode":for(w=[],u=[],T=0,P={},r={},b=c=null,G=0,N=s.length;G<N;G++)i=s[G],C=t[i],P[C]==null&&(P[C]=++T),r[i]={old:C,new:P[C]},a=P[C]-i,(b==null||a!==c)&&(b&&u.push(b),w.push(i),c=a),b=i;for(b&&u.push(b),u.push(65535),w.push(65535),R=w.length,v=R*2,_=2*Math.pow(Math.log(R)/Math.LN2,2),d=Math.log(_/2)/Math.LN2,O=2*R-_,l=[],E=[],p=[],m=W=0,U=w.length;W<U;m=++W){if(D=w[m],h=u[m],D===65535){l.push(0),E.push(0);break}if(F=r[D].new,D-F>=32768)for(l.push(0),E.push(2*(p.length+R-m)),i=L=D;D<=h?L<=h:L>=h;i=D<=h?++L:--L)p.push(r[i].new);else l.push(F-D),E.push(0)}for(H.writeUInt16(3),H.writeUInt16(1),H.writeUInt32(12),H.writeUInt16(4),H.writeUInt16(16+R*8+p.length*2),H.writeUInt16(0),H.writeUInt16(v),H.writeUInt16(_),H.writeUInt16(d),H.writeUInt16(O),Q=0,k=u.length;Q<k;Q++)i=u[Q],H.writeUInt16(i);for(H.writeUInt16(0),ae=0,V=w.length;ae<V;ae++)i=w[ae],H.writeUInt16(i);for(re=0,Y=l.length;re<Y;re++)a=l[re],H.writeUInt16(a);for(se=0,X=E.length;se<X;se++)I=E[se],H.writeUInt16(I);for(K=0,Z=p.length;K<Z;K++)g=p[K],H.writeUInt16(g);return{charMap:r,subtable:H.data,maxGlyphID:T+1}}},o})(),HKe=(function(o){cO(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="cmap",t.prototype.parse=function(e){var r,i,n;for(e.pos=this.offset,this.version=e.readUInt16(),n=e.readUInt16(),this.tables=[],this.unicode=null,i=0;0<=n?i<n:i>n;i=0<=n?++i:--i)r=new NKe(e,this.offset),this.tables.push(r),r.isUnicode&&this.unicode==null&&(this.unicode=r);return!0},t.encode=function(e,r){var i,n;return r==null&&(r="macroman"),i=NKe.encode(e,r),n=new nL,n.writeUInt16(0),n.writeUInt16(1),i.table=n.data.concat(i.subtable),i},t})(W9),ELt=(function(o){cO(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="hhea",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.ascender=e.readShort(),this.decender=e.readShort(),this.lineGap=e.readShort(),this.advanceWidthMax=e.readShort(),this.minLeftSideBearing=e.readShort(),this.minRightSideBearing=e.readShort(),this.xMaxExtent=e.readShort(),this.caretSlopeRise=e.readShort(),this.caretSlopeRun=e.readShort(),this.caretOffset=e.readShort(),e.pos+=8,this.metricDataFormat=e.readShort(),this.numberOfMetrics=e.readUInt16()},t})(W9),OLt=(function(o){cO(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="OS/2",t.prototype.parse=function(e){if(e.pos=this.offset,this.version=e.readUInt16(),this.averageCharWidth=e.readShort(),this.weightClass=e.readUInt16(),this.widthClass=e.readUInt16(),this.type=e.readShort(),this.ySubscriptXSize=e.readShort(),this.ySubscriptYSize=e.readShort(),this.ySubscriptXOffset=e.readShort(),this.ySubscriptYOffset=e.readShort(),this.ySuperscriptXSize=e.readShort(),this.ySuperscriptYSize=e.readShort(),this.ySuperscriptXOffset=e.readShort(),this.ySuperscriptYOffset=e.readShort(),this.yStrikeoutSize=e.readShort(),this.yStrikeoutPosition=e.readShort(),this.familyClass=e.readShort(),this.panose=(function(){var r,i;for(i=[],r=0;r<10;++r)i.push(e.readByte());return i})(),this.charRange=(function(){var r,i;for(i=[],r=0;r<4;++r)i.push(e.readInt());return i})(),this.vendorID=e.readString(4),this.selection=e.readShort(),this.firstCharIndex=e.readShort(),this.lastCharIndex=e.readShort(),this.version>0&&(this.ascent=e.readShort(),this.descent=e.readShort(),this.lineGap=e.readShort(),this.winAscent=e.readShort(),this.winDescent=e.readShort(),this.codePageRange=(function(){var r,i;for(i=[],r=0;r<2;r=++r)i.push(e.readInt());return i})(),this.version>1))return this.xHeight=e.readShort(),this.capHeight=e.readShort(),this.defaultChar=e.readShort(),this.breakChar=e.readShort(),this.maxContext=e.readShort()},t})(W9),ALt=(function(o){cO(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="post",t.prototype.parse=function(e){var r,i,n;switch(e.pos=this.offset,this.format=e.readInt(),this.italicAngle=e.readInt(),this.underlinePosition=e.readShort(),this.underlineThickness=e.readShort(),this.isFixedPitch=e.readInt(),this.minMemType42=e.readInt(),this.maxMemType42=e.readInt(),this.minMemType1=e.readInt(),this.maxMemType1=e.readInt(),this.format){case 65536:break;case 131072:i=e.readUInt16(),this.glyphNameIndex=[];var s;for(s=0;0<=i?s<i:s>i;s=0<=i?++s:--s)this.glyphNameIndex.push(e.readUInt16());for(this.names=[],n=[];e.pos<this.offset+this.length;)r=e.readByte(),n.push(this.names.push(e.readString(r)));return n;case 151552:return i=e.readUInt16(),this.offsets=e.read(i);case 196608:break;case 262144:return this.map=(function(){var a,l,c;for(c=[],s=a=0,l=this.file.maxp.numGlyphs;0<=l?a<l:a>l;s=0<=l?++a:--a)c.push(e.readUInt32());return c}).call(this)}},t})(W9),_Lt=(function(){function o(t,e){this.raw=t,this.length=t.length,this.platformID=e.platformID,this.encodingID=e.encodingID,this.languageID=e.languageID}return o})(),vLt=(function(o){cO(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="name",t.prototype.parse=function(e){var r,i,n,s,a,l,c,h,u,d,p;for(e.pos=this.offset,e.readShort(),r=e.readShort(),l=e.readShort(),i=[],s=0;0<=r?s<r:s>r;s=0<=r?++s:--s)i.push({platformID:e.readShort(),encodingID:e.readShort(),languageID:e.readShort(),nameID:e.readShort(),length:e.readShort(),offset:this.offset+l+e.readShort()});for(c={},s=u=0,d=i.length;u<d;s=++u)n=i[s],e.pos=n.offset,h=e.readString(n.length),a=new _Lt(h,n),c[p=n.nameID]==null&&(c[p]=[]),c[n.nameID].push(a);this.strings=c,this.copyright=c[0],this.fontFamily=c[1],this.fontSubfamily=c[2],this.uniqueSubfamily=c[3],this.fontName=c[4],this.version=c[5];try{this.postscriptName=c[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=c[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=c[7],this.manufacturer=c[8],this.designer=c[9],this.description=c[10],this.vendorUrl=c[11],this.designerUrl=c[12],this.license=c[13],this.licenseUrl=c[14],this.preferredFamily=c[15],this.preferredSubfamily=c[17],this.compatibleFull=c[18],this.sampleText=c[19]},t})(W9),xLt=(function(o){cO(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="maxp",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.numGlyphs=e.readUInt16(),this.maxPoints=e.readUInt16(),this.maxContours=e.readUInt16(),this.maxCompositePoints=e.readUInt16(),this.maxComponentContours=e.readUInt16(),this.maxZones=e.readUInt16(),this.maxTwilightPoints=e.readUInt16(),this.maxStorage=e.readUInt16(),this.maxFunctionDefs=e.readUInt16(),this.maxInstructionDefs=e.readUInt16(),this.maxStackElements=e.readUInt16(),this.maxSizeOfInstructions=e.readUInt16(),this.maxComponentElements=e.readUInt16(),this.maxComponentDepth=e.readUInt16()},t})(W9),RLt=(function(o){cO(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="hmtx",t.prototype.parse=function(e){var r,i,n,s,a,l,c;for(e.pos=this.offset,this.metrics=[],r=0,l=this.file.hhea.numberOfMetrics;0<=l?r<l:r>l;r=0<=l?++r:--r)this.metrics.push({advance:e.readUInt16(),lsb:e.readInt16()});for(n=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=(function(){var h,u;for(u=[],r=h=0;0<=n?h<n:h>n;r=0<=n?++h:--h)u.push(e.readInt16());return u})(),this.widths=(function(){var h,u,d,p;for(d=this.metrics,p=[],h=0,u=d.length;h<u;h++)s=d[h],p.push(s.advance);return p}).call(this),i=this.widths[this.widths.length-1],c=[],r=a=0;0<=n?a<n:a>n;r=0<=n?++a:--a)c.push(this.widths.push(i));return c},t.prototype.forGlyph=function(e){return e in this.metrics?this.metrics[e]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[e-this.metrics.length]}},t})(W9),WKe=[].slice,DLt=(function(o){cO(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="glyf",t.prototype.parse=function(){return this.cache={}},t.prototype.glyphFor=function(e){var r,i,n,s,a,l,c,h,u,d;return e in this.cache?this.cache[e]:(s=this.file.loca,r=this.file.contents,i=s.indexOf(e),n=s.lengthOf(e),n===0?this.cache[e]=null:(r.pos=this.offset+i,l=new nL(r.read(n)),a=l.readShort(),h=l.readShort(),d=l.readShort(),c=l.readShort(),u=l.readShort(),a===-1?this.cache[e]=new LLt(l,h,d,c,u):this.cache[e]=new wLt(l,a,h,d,c,u),this.cache[e]))},t.prototype.encode=function(e,r,i){var n,s,a,l,c,h;for(l=[],a=[],c=0,h=r.length;c<h;c++)s=r[c],n=e[s],a.push(l.length),n&&(l=l.concat(n.encode(i)));return a.push(l.length),{table:l,offsets:a}},t})(W9),wLt=(function(){function o(t,e,r,i,n,s){this.raw=t,this.numberOfContours=e,this.xMin=r,this.yMin=i,this.xMax=n,this.yMax=s,this.compound=!1}return o.prototype.encode=function(){return this.raw.data},o})(),LLt=(function(){var o,t,e,r,i;o=1,r=8,t=32,e=64,i=128;function n(s,a,l,c,h){var u,d;for(this.raw=s,this.xMin=a,this.yMin=l,this.xMax=c,this.yMax=h,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],u=this.raw;d=u.readShort(),this.glyphOffsets.push(u.pos),this.glyphIDs.push(u.readUInt16()),!!(d&t);)d&o?u.pos+=4:u.pos+=2,d&i?u.pos+=8:d&e?u.pos+=4:d&r&&(u.pos+=2)}return n.prototype.encode=function(){var s,a,l,c;for(a=new nL(WKe.call(this.raw.data)),c=this.glyphIDs,s=0,l=c.length;s<l;++s)a.pos=this.glyphOffsets[s];return a.data},n})(),MLt=(function(o){cO(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="loca",t.prototype.parse=function(e){var r,i;return e.pos=this.offset,r=this.file.head.indexToLocFormat,r===0?this.offsets=(function(){var n,s;for(s=[],i=0,n=this.length;i<n;i+=2)s.push(e.readUInt16()*2);return s}).call(this):this.offsets=(function(){var n,s;for(s=[],i=0,n=this.length;i<n;i+=4)s.push(e.readUInt32());return s}).call(this)},t.prototype.indexOf=function(e){return this.offsets[e]},t.prototype.lengthOf=function(e){return this.offsets[e+1]-this.offsets[e]},t.prototype.encode=function(e,r){for(var i=new Uint32Array(this.offsets.length),n=0,s=0,a=0;a<i.length;++a)if(i[a]=n,s<r.length&&r[s]==a){++s,i[a]=n;var l=this.offsets[a],c=this.offsets[a+1]-l;c>0&&(n+=c)}for(var h=new Array(i.length*4),u=0;u<i.length;++u)h[4*u+3]=i[u]&255,h[4*u+2]=(i[u]&65280)>>8,h[4*u+1]=(i[u]&16711680)>>16,h[4*u]=(i[u]&4278190080)>>24;return h},t})(W9),NLt=function(o){var t,e,r;e={};for(t in o)r=o[t],e[r]=t;return e},kLt=(function(){function o(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return o.prototype.generateCmap=function(){var t,e,r,i,n;i=this.font.cmap.tables[0].codeMap,t={},n=this.subset;for(e in n)r=n[e],t[e]=i[r];return t},o.prototype.glyphsFor=function(t){var e,r,i,n,s,a,l;for(i={},s=0,a=t.length;s<a;s++)n=t[s],i[n]=this.font.glyf.glyphFor(n);e=[];for(n in i)r=i[n],r!=null&&r.compound&&e.push.apply(e,r.glyphIDs);if(e.length>0){l=this.glyphsFor(e);for(n in l)r=l[n],i[n]=r}return i},o.prototype.encode=function(t,e){var r,i,n,s,a,l,c,h,u,d,p,m,g,y,b;r=HKe.encode(this.generateCmap(),"unicode"),s=this.glyphsFor(t),p={0:0},b=r.charMap;for(i in b)l=b[i],p[l.old]=l.new;d=r.maxGlyphID;for(m in s)m in p||(p[m]=d++);return h=NLt(p),u=Object.keys(h).sort(function(P,T){return P-T}),g=(function(){var P,T,I;for(I=[],P=0,T=u.length;P<T;P++)a=u[P],I.push(h[a]);return I})(),n=this.font.glyf.encode(s,g,p),c=this.font.loca.encode(n.offsets,g),y={cmap:this.font.cmap.raw(),glyf:n.table,loca:c,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(e)},this.font.os2.exists&&(y["OS/2"]=this.font.os2.raw()),this.font.directory.encode(y)},o})();function BLt(o){for(let t in o)Array.isArray(o[t])&&(o[t].length=0),delete o[t]}(function(o){"use strict";var t,e,r,i=6,n=13,s,a={x:void 0,y:void 0,w:void 0,h:void 0,ln:void 0},l=1,c=function(m,g,y,b,P){a={x:m,y:g,w:y,h:b,ln:P}},h=function(){return a},u,d,p={left:0,top:0,bottom:0};o.setHeaderFunction=function(m){s=m},o.getTextDimensions=function(m,g){var y=this.table_font_size||this.internal.getFontSize(),b=this.internal.getFont().fontStyle;g=g||{};var P=g.scaleFactor||this.internal.scaleFactor,T=0,I=0,C=0,E=0,O=0;if(typeof m=="string")T=this.getStringUnitWidth(m)*y,T!==0&&(I=1);else if(Object.prototype.toString.call(m)==="[object Array]"){for(var _=0;_<m.length;_++)E=this.getStringUnitWidth(m[_])*y,T<E&&(T=E);T!==0&&(I=m.length)}else throw new Error("getTextDimensions expects text-parameter to be of type String or an Array of Strings.");return T=T/P,C=Math.max((I*y*this.getLineHeightFactor()-y*(this.getLineHeightFactor()-1))/P,0),{w:T,h:C}},o.cellAddPage=function(){var m=this.margins||p;this.addPage(),c(m.left,m.top,void 0,void 0),l+=1},o.cellInitialize=function(){a={x:void 0,y:void 0,w:void 0,h:void 0,ln:void 0},l=1},o.cell=async function(m,g,y,b,P,T,I){var C=h(),E=!1;if(C.ln!==void 0)if(C.ln===T)m=C.x+C.w,g=C.y;else{var O=this.margins||p;C.y+C.h+b+n>=this.internal.pageSize.getHeight()-O.bottom&&(await(u==null?void 0:u()),this.cellAddPage(),await(d==null?void 0:d()),E=!0),g=h().y+h().h,E&&(g=(O==null?void 0:O.top)||n+10)}if(P[0]!==void 0)if(this.printingHeaderRow?this.rect(m,g,y,b,"FD"):this.rect(m,g,y,b),I==="right"){P instanceof Array||(P=[P]);for(var _=0;_<P.length;_++){var R=P[_],v=this.getStringUnitWidth(R)*this.internal.getFontSize()/this.internal.scaleFactor;this.text(R,m+y-v-i,g+this.internal.getLineHeight()*(_+1)+i)}}else this.text(P,m+i,g+this.internal.getLineHeight()+i);return c(m,g,y,b,T),this},o.arrayMax=function(m,g){var y=m[0],b,P,T;for(b=0,P=m.length;b<P;b+=1)T=m[b],g?g(y,T)===-1&&(y=T):T>y&&(y=T);return y},o.table=async function(m,g,y,b,P){if(!y)throw"No data for PDF table";var T=[],I=[],C,E,O,_,R={},v={},D,w,F=[],H,z=[],G,W,L,B=!1,N=!0,U=12,k=p;if(k.width=this.internal.pageSize.getWidth(),P&&(P.autoSize===!0&&(B=!0),P.printHeaders===!1&&(N=!1),P.fontSize&&(U=P.fontSize),P.css&&typeof P.css["font-size"]<"u"&&(U=P.css["font-size"]*16),P.margins&&(k=P.margins),P.beforeCellAddPage&&(u=P.beforeCellAddPage),P.afterCellAddPage&&(d=P.afterCellAddPage)),this.lnMod=0,a={x:void 0,y:void 0,w:void 0,h:void 0,ln:void 0},l=1,this.printHeaders=N,this.margins=k,this.setFontSize(U),this.table_font_size=U,b==null)T=Object.keys(y[0]);else if(b[0]&&typeof b[0]!="string"){var V=1;for(E=0,O=b.length;E<O;E+=1)C=b[E],T.push(C.name),I.push(C.prompt),v[C.name]=C.width*V}else T=b;if(B)for(L=function(X){return X[C]},E=0,O=T.length;E<O;E+=1){for(C=T[E],R[C]=y.map(L),F.push(this.getTextDimensions(I[E]||C,{scaleFactor:1}).w),w=R[C],H=0,_=w.length;H<_;H+=1)D=w[H],F.push(this.getTextDimensions(D,{scaleFactor:1}).w);v[C]=o.arrayMax(F),F=[]}if(N){var Y=this.calculateLineHeight(T,v,I.length?I:T);for(E=0,O=T.length;E<O;E+=1)C=T[E],z.push([m,g,v[C],Y,I.length?I[E]:C]);this.setTableHeaderRow(z),await this.printHeaderRow(1,!1)}for(E=0,O=y.length;E<O;E+=1){var Y;for(G=y[E],Y=this.calculateLineHeight(T,v,G),H=0,W=T.length;H<W;H+=1)C=T[H],await this.cell(m,g,v[C],Y,G[C],E+2,C.align)}return this.lastCellPos=a,this.table_x=m,this.table_y=g,this},o.calculateLineHeight=function(m,g,y){for(var b,P=0,T=0;T<m.length;T++){b=m[T];let C=Array.isArray(y)?T:b;y[C]=this.splitTextToSize(String(y[C]),g[b]-i);var I=this.internal.getLineHeight()*y[C].length/.72+i;I>P&&(P=I)}return P},o.setTableHeaderRow=function(m){this.tableHeaderRow=m},o.printHeaderRow=async function(m,g){if(!this.tableHeaderRow)throw"Property tableHeaderRow does not exist.";var y,b,P,T;if(this.printingHeaderRow=!0,s!==void 0){var I=s(this,l);c(I[0],I[1],I[2],I[3],-1)}this.setFont("Arial,Bold");var C=[];for(P=0,T=this.tableHeaderRow.length;P<T;P+=1)this.setFillColor(200,200,200),y=this.tableHeaderRow[P],g&&(this.margins.top=n,y[1]=this.margins&&this.margins.top||0,C.push(y)),b=[].concat(y),await this.cell.apply(this,b.concat(m));C.length>0&&this.setTableHeaderRow(C),this.setFont("Arial"),this.printingHeaderRow=!1}})(GKe.API);var zKe=GKe;var VLt=["\u5B8B\u4F53","Times New Roman","Arial","helvetica","sans-serif","monospace","Tahoma","Courier New","MS Gothic","Arial Black","Arial Narrow","Verdana","\u9ED1\u4F53","\u6977\u4F53","\u4EFF\u5B8B","\u96B6\u4E66"];function GLt(o,t,e,r,i,n,s,a,l){var c=Math.PI*2;function h(k,V,Y,X){var Z=k*Y+V*X,Q=Math.sqrt((k*k+V*V)*(Y*Y+X*X)),ae=Math.acos(Z/Q);return k*X-V*Y<0&&(ae=-ae),ae}function u(k){for(;k>=c;)k-=c;for(;k<0;)k+=c;return k}function d(k){return k.rx=s,k.ry=a,k.startAngle=k.theta1,k.endAngle=u(k.theta1+k.delta_theta),k}var p,m,g,y,b=1e-5;s<0&&(s=-s),a<0&&(a=-a),s==a&&(l=0);var P=Math.sin(l),T=Math.cos(l),I=(o-e)/2,C=(t-r)/2,E=(o+e)/2,O=(t+r)/2;if(s<b||a<b)return g=h(1,0,e-o,r-t),d({cx:E,cy:O,theta1:g,delta_theta:Math.PI});var _=T*I+P*C,R=T*C-P*I,v=_*_/(s*s)+R*R/(a*a);v>1&&(s=s*Math.sqrt(v),a=a*Math.sqrt(v));var D=s*a,w=s*R,F=a*_,H=w*w+F*F;if(!H)return d({cx:E,cy:O,theta1:0,delta_theta:0});var z=(D*D-H)/H;z=Math.sqrt(Math.abs(z)),!!i==!!n&&(z=-z);var G=z*w/a,W=-z*F/s;p=T*G-P*W+E,m=P*G+T*W+O;var L=(_-G)/s,B=(_+G)/s,N=(R-W)/a,U=(R+W)/a;for(g=h(1,0,L,N),y=h(L,N,-B,-U);y>c;)y-=c;for(;y<0;)y+=c;return(n===!1||n===0)&&(y-=c),d({cx:p,cy:m,theta1:g,delta_theta:y})}var ULt={Properties:"\u5C5E\u6027"},EK=class{constructor(t){this.config=t;this.originX=0;this.originY=0;this.width=0;this.height=0;this.isMirror=!1;this.multiWatermark=(t,e,r,i)=>{this.pdfDoc.text(t,e.x,e.y,{align:"left",baseline:"bottom",angle:360-r.angleD(e)}),i&&this.pdfDoc.line(e.x,e.y,r.x,r.y)}}get needAnnot(){return this.config.needAnnot}get needMenu(){return this.config.needMenu}get language(){return this.config.language||"en"}get onlyShowStroke(){return this.config.onlyShowStroke}get segmentedExport(){return this.config.segmentedExport}get pdfWatermarkConfig(){return this.config.pdfWatermarkConfig}get customPdfWatermarkConfig(){return this.config.customPdfWatermarkConfig}async generateOne(t,e,r,i){let{bbox:n,shapes:s,color:a,isMirror:l,textArr:c,id:h,colorType:u,backgroundColor:d}=t;n||(n=new ut(-1,1,-1,1));let p=n.maxX-n.minX,m=n.maxY-n.minY;this.originX=n.minX,this.originY=n.maxY,this.width=p,this.height=m,this.isMirror=l,this.colorType=u,this.onProgress=e,this.jsonObj=t,this.pdfDoc?r&&(this.pdfDoc.addPage([p*.72,m*.72],p>m?"l":"p"),this.setBackground(n,this.colorType,d)):(this.pdfDoc=new zKe({orientation:p>m?"l":"p",format:[p*.72,m*.72],unit:"in"}),this.segmentedExport&&await e({title:`CreatePDF ${this.getCurrentPageNumber()} ${h}`,value:0,data:this.pdfDoc.buildDocumentStart("arrayBuffer")}),this.setBackground(n,this.colorType,d)),this.setPageColor(this.colorType,a),this.pdfDoc.saveGraphicState(),l&&this.pdfDoc.setCTM(-1,0,0,1,p*.72,0),r&&this.preDealText(c);for(let g=0;g<s.length;g++)await this.createShape(s[g]),g%1e4||await e({value:g/s.length*.7,title:`CreatePDF ${this.getCurrentPageNumber()} ${h}`});this.pdfDoc.restoreGraphicState(),i&&((m9||kEe)&&(this.setWatermark(this.pdfWatermarkConfig),this.setWatermark(this.customPdfWatermarkConfig)),this.segmentedExport&&await this.pdfDoc.buildDocumentContent("arrayBuffer",this.getCurrentPageNumber(),async g=>{await e({title:`CreatePDF ${this.getCurrentPageNumber()} ${h}`,data:g.data,value:.7+.3*g.value})})),await e({title:`CreatePDF ${this.getCurrentPageNumber()} ${h}`,value:1})}generateEnd(t){if(t&&this.outLine(t),this.segmentedExport)return this.pdfDoc.buildDocumentEnd("arrayBuffer")}outLine(t){let e=this;for(let i of t)r(i,null);function r(i,n){let{pageNumber:s,name:a}=i;if(!e.pdfDoc)return;let l=e.pdfDoc.outline.add(n,a,{pageNumber:s});if(i.children)for(let c of i.children)r(c,l)}}setPageColor(t,e){t==="Black on White"&&(e=[0,0,0,e[3]]),t==="White on Black"&&(e=[255,255,255,e[3]]),this.pageColor=e,e[3]&&e[3]!==1?this.pdfDoc.setColorWithOpacity(...e,"FD"):(e[3]=e[3]||$me,this.pdfDoc.setColorWithOpacity(...e,"FD")),this.pdfDoc.setTextColor(...this.bgColor)}setBackground(t,e,r){let i=[255,255,255],s=[0,0,0];e==="Black on White"?s=i:e==="Full Color"&&r&&(s=r.toRGBA().slice(0,3)),this.bgColor=s,this.pdfDoc.setFillColor(...s),this.pdfDoc.rect(t.minX-this.originX,-(t.maxY-this.originY),t.maxX-t.minX,t.maxY-t.minY,"F")}preDealText(t){for(let e of t){let{rotation:r,fontSize:i,fontFamily:n,matrix:s}=e,a=e.content;n=this.getFontFamily(n),i=this.getFontSize(i,n),this.pdfDoc.setFont(n,"normal"),this.pdfDoc.setFontSize(i);let l=a.split(`
`);this.pdfDoc.text(l,[s.data[0].toFixed(2),s.data[1].toFixed(2),s.data[4].toFixed(2),s.data[5].toFixed(2),((s.data[12]-this.originX)*.72-Math.sin(r)*(l.length-1)*i).toFixed(2),((s.data[13]+this.height-this.originY)*.72+Math.cos(r)*(l.length-1)*i).toFixed(2)])}}async createShape(t){let e=t.color,r=t.opacity;if(e?e==="transparent"?this.onlyShowStroke?this.pdfDoc.setColorWithOpacity(...this.bgColor,Math.max(r||$me),"F"):this.pdfDoc.setColorWithOpacity(...this.bgColor,Math.max(r||$me),"FD"):(this.pdfDoc.setColorWithOpacity(...e,"FD"),this.pdfDoc.setTextColor(...e.slice(0,3),{a:e.at(-1)})):(this.pdfDoc.setColorWithOpacity(...this.pageColor,"FD"),this.pdfDoc.setTextColor(...this.pageColor.slice(0,3),{a:this.pageColor.at(-1)})),t.primitives){let{primitives:i,strokeWidth:n,style:s,color:a,opacity:l,lineJoin:c}=t;n&&!this.onlyShowStroke?this.pdfDoc.setLineWidth(n||0):this.pdfDoc.setLineWidth(0),this.pdfDoc.setLineJoin(c||"0");for(let h of i){if(s!=="S"&&i.length>1){i.filter(u=>!(u instanceof M)).length?this.path(i,this.getPDFStyle(s)):this.lines(i,this.getPDFStyle(s));break}h instanceof M?this.line(h):h instanceof q?this.arc(h,this.getPDFStyle(s)):h instanceof Mr&&this.bezier(h,this.getPDFStyle(s))}}else t.headers?(this.pdfDoc.setFont(this.getFontFamily("Arial")),await this.table(t)):t.attr?this.setComponentAttr(t):this.text(t)}arc(t,e){let[r,i,n,s,a]=[t.rx,t.ry,t.start(),t.end(),t.center],{x:l,y:c}=a,[h,u,d,p]=[n.x,s.x,n.y,s.y];if(H2(h,u,1e-12)&&H2(d,p,1e-12)&&H2(r,i,1e-12))return this.circle({x:l,y:c,r},e);let m=this.pdfDoc.context2d;m.beginPath(),m.moveTo(h-this.originX,this.originY-d),this.context2dDrawArc(t,!1,e),m.closePath(),e=e==="F"?"fill":e==="S"?"stroke":"strokeFill",m.drawPaths(e)}bezier(t,e){let{x:r,y:i}=t.start(),n=this.pdfDoc.context2d;n.beginPath(),n.moveTo(r-this.originX,this.originY-i),this.context2dDrawBezier(t,!1),n.closePath(),e=e==="F"?"fill":e==="S"?"stroke":"strokeFill",n.drawPaths(e)}text(t){let{strokeWidth:e}=t;this.pdfDoc.setLineWidth(e||0);let r=t.shapes||[],i=[];if(!r.length)return;for(let s of r)s&&(s instanceof Kp?i.push(s):this.path(s.primitives,"S"));let n=i.reduce((s,a,l)=>(s.push(...a.pl.primitives),l!==i.length-1&&s.push("m"),s),[]);n.length&&this.path(n,"F")}line(t){let[e,r]=[t.start(),t.end()],[i,n,s,a]=[e.x,e.y,r.x,r.y];i-=this.originX,s-=this.originX,n=this.originY-n,a=this.originY-a,this.pdfDoc.setLineCap("1"),this.pdfDoc.line(i,n,s,a)}circle(t,e){let{x:r,y:i,r:n}=t;r-=this.originX,i=this.originY-i,this.pdfDoc.circle(r,i,n,e||"F")}lines(t,e){let{x:r,y:i}=t[0].start();r-=this.originX,i=this.originY-i;let n=t.slice(1).reduce((s,a,l)=>{let c=a.start(),u=t[l].start(),[d,p]=[c.x,c.y],[m,g]=[u.x,u.y];return s.push([d-m,-(p-g)]),s},[]);this.pdfDoc.lines(n,r,i,[1,1],e,!0)}isCircleArc(t){try{let[e,r,i,n]=[t.rx,t.ry,t.center,t.start(),t.end()],[s,a,l,c]=[i.x,n.x,i.y,n.y];return s===a&&l===c&&e===r}catch{return!1}}path(t,e){let r=t[0],{x:i,y:n}=r.start();i-=this.originX,n=this.originY-n;let s=this.pdfDoc.context2d,a=!1;s.beginPath(),this.pdfDoc.setLineCap(1),t[0]instanceof q&&this.isCircleArc(t[0])||s.moveTo(i,n);for(let l of t)l==="m"?a=!0:(l instanceof q?this.context2dDrawArc(l,a,e):l instanceof M?this.context2dDrawLine(l,a):l instanceof Mr&&this.context2dDrawBezier(l,a),a=!1);s.closePath(),e=e==="F"?"fill":e==="S"?"stroke":"strokeFill",s.drawPaths(e)}context2dDrawArc(t,e=!1,r){let i=this.pdfDoc.context2d,[n,s,a,l,c,h,u]=[t.rx,t.ry,t.sweepAngle,t.center,t.start(),t.end(),t.isCCW],{x:d,y:p}=l,[m,g,y,b]=[c.x,h.x,c.y,h.y];if(H2(m,g,1e-12)&&H2(y,b,1e-12)&&H2(n,s,1e-12)){this.circle({x:d,y:p,r:n},r);return}d-=this.originX,m-=this.originX,g-=this.originX,p=this.originY-p,y=this.originY-y,b=this.originY-b,a=a*Math.PI/180;let P=Math.abs(a)>Tu?1:0,T=GLt(m,y,g,b,P,!u,n,s,0);e&&i.moveTo(m,y),i.arc(m,y,g,b,T.cx,T.cy,T.rx,T.ry,T.startAngle,T.endAngle,Math.abs(T.delta_theta),T.delta_theta<0)}context2dDrawLine(t,e=!1){let r=this.pdfDoc.context2d,i=t.end(),n=t.start(),{x:s,y:a}=i;s-=this.originX,a=this.originY-a,e&&r.moveTo(n.x-this.originX,this.originY-n.y),r.lineTo(s,a)}context2dDrawBezier(t,e=!1){let r=this.pdfDoc.context2d,{controls:i}=t,[n,s,a,l,c,h,u,d]=[i[0].x-this.originX,this.originY-i[0].y,i[1].x-this.originX,this.originY-i[1].y,i[2].x-this.originX,this.originY-i[2].y,i[3].x-this.originX,this.originY-i[3].y];e&&r.moveTo(n,s),r.bezierCurveTo(a,l,c,h,u,d)}setComponentAttr(t){let{attr:e,box:r,device:i,globalIndex:n}=t;e.ID={k:"ID",v:n};let s="",a=[`'${this.language==="en"?"Properties":ULt.Properties}:'`],{leftUp:l,leftLow:c,rightUp:h,rightLow:u,width:d,height:p}=r,m=[l.x,c.x,u.x,h.x],g=[l.y,c.y,u.y,h.y],y=h.x-l.x===0&&l.y-c.y===0,[b,P]=[y?p:d,y?d:p],[T,I]=[this.isMirror?this.width-Math.max(...m):Math.min(...m),Math.max(...g)];T=this.isMirror?T+this.originX:T-this.originX,I=this.originY-I;for(let O of E(e)){let{k:_,v:R}=O,v=`${_} : ${R}`;s+=`${v}
`,a.push(`'${v.replace(/'/g,"\\'")}'`)}this.needAnnot&&this.pdfDoc.createAnnotation({type:"text",contentType:"code",title:C(i),bounds:{x:T,y:I,w:b,h:P},contents:C(s),open:!1}),this.needMenu&&this.pdfDoc.createAnnotation({type:"link",contentType:"code",bounds:{x:T,y:I,w:b,h:P},js:C(`var item = app.popUpMenu([${a.join(", ")}] )`)});function C(O){let _="FEFF";for(let v=0;v<O.length;v++){let w=O.charCodeAt(v).toString(16);_+=R(w)}function R(v){let D=v,w=4-v.length;for(;w;)D=`0${D}`,w--;return D}return _}function E(O){let _=["Layer","ID","Name","Unique ID","Add into BOM","Designator","Device","Footprint","zh"],R=[],v=[];return Fn(O,(D,w,F)=>{_.includes(D)?R.push({k:D,v:w}):v.push({k:D,v:w})}),R.sort((D,w)=>(D=_.indexOf(D.k),w=_.indexOf(w.k),D>w?1:-1)),v.sort((D,w)=>D.k.localeCompare(w.k)),R.concat(v).map(D=>{let{k:w,v:F}=D.v;return{k:w,v:F}})}}setWatermark(t){if(!t)return;let{fontSize:e,color:r,rowGap:i,columnGap:n,deg:s,underline:a=!1,italic:l=!1,bold:c=!1,fontFamily:h="serif"}=t,u=t.text;this.pdfDoc.setFont(this.getFontFamily(h,c,l)),this.pdfDoc.setFontSize(this.getFontSize(e,h)),this.pdfDoc.setTextColor(...r.slice(0,3),{a:r[r.length-1]}),this.pdfDoc.setColorWithOpacity(...r,"FD"),a&&this.pdfDoc.setLineWidth(e/9);let d=this.pdfDoc.getTextWidth(u),p=this.pdfDoc.getLineHeightFactor()*e;if(!i&&!n){let O=this.width/2,_=this.height/2;this.centerWatermark(u,O,_,s,a,d,p);return}let m=d+n,g=p+i,y=(s||0)/180*Math.PI,b=on(Math.cos(y),4),P=on(Math.sin(y),4),T=new S(g*P,g*b),I=new S(m*b,-m*P),C=new ut(0,this.width,0,this.height),E=new S(0,p);[1,-1].forEach((O,_)=>{let R=T.mul(O),v=!0,D=_===0?E:E.add(R),w=D.add1(d,0).rotateD(D,360-s),F=new _e().ext3([D,w]).build();for(;v;){v=!1;let H=new S(D.x,D.y).add(I),z=H.add1(d,0).rotateD(H,360-s),G=new _e().ext3([H,z]).build();for(;G.isInside(C)||G.isIntersect(C);)this.multiWatermark(u,H,z,a),H=H.add(I),z=H.add1(d,0).rotateD(H,360-s),G=new _e().ext3([H,z]).build(),v=!0;let W=new S(D.x,D.y).add(I.mul(-1)),L=W.add1(d,0).rotateD(W,360-s),B=new _e().ext3([W,L]).build();for(;B.isInside(C)||B.isIntersect(C);)this.multiWatermark(u,W,L,a),W=W.add(I.mul(-1)),L=W.add1(d,0).rotateD(W,360-s),B=new _e().ext3([W,L]).build(),v=!0;(F.isInside(C)||F.isIntersect(C))&&(this.multiWatermark(u,D,w,a),v=!0);let N=D.distance2(H),U=W.distance2(D),k=U===N?S.ORIGIN:U>N?I.mul(-1):I;D=D.add(k).add(R),w=D.add1(d,0).rotateD(D,360-s),F=new _e().ext3([D,w]).build()}})}centerWatermark(t,e,r,i,n,s,a){if(this.pdfDoc.text(t,e,r,{align:"center",baseline:"middle",angle:i}),n){let l=new S(e,r).add1(s*.5,a/2).rotateD(new S(e,r),360-i),c=new S(e,r).add1(-s*.5,a/2).rotateD(new S(e,r),360-i);this.pdfDoc.line(l.x,l.y,c.x,c.y)}}async table(t){let{x:e,y:r,headers:i,data:n,config:s}=t,a=this.getFontSize(s.fontSize||10,void 0);await this.pdfDoc.table(e-this.originX,this.originY-r,n,i,{...s,fontSize:a,beforeCellAddPage:async()=>{(m9||kEe)&&(this.setWatermark(this.pdfWatermarkConfig),this.setWatermark(this.customPdfWatermarkConfig)),this.segmentedExport&&await this.pdfDoc.buildDocumentContent("arrayBuffer",this.getCurrentPageNumber(),async l=>{await this.onProgress({title:`CreatePDF ${this.getCurrentPageNumber()} ${this.jsonObj.id}`,data:l.data,value:.7+.3*l.value})}),this.pdfDoc.setFont("Arial"),this.pdfDoc.setFontSize(a),this.pdfDoc.setColorWithOpacity(...this.pageColor,"FD"),this.pdfDoc.setTextColor(...this.pageColor.slice(0,3))}})}getFontFamily(t,e,r){let i="",n="";return VLt.includes(t)?t=="Times New Roman"?t="Times-Roman":t=="Courier New"?t="CourierNew":t=="helvetica"?t="Helvetica":t=="sans-serif"?t="Tahoma":t=="monospace"||t=="Courier New"?t="CourierNew":t=="MS Gothic"?t="MSGothic":t=="Arial Black"?t="ArialBlack":t=="Arial Narrow"?t="ArialNarrow":t==="\u5B8B\u4F53"?t="SimSun":t==="\u9ED1\u4F53"?t="SimHei":t==="\u6977\u4F53"?t="KaiTi":t==="\u4EFF\u5B8B"?t="FangSong":t==="\u96B6\u4E66"&&(t="LiSu"):t="Arial",e&&(e===!0||e=="bold"||e=="bolder"||Number(e)>=600)&&(i="Bold"),r&&r===!0&&(n="Italic"),t+(i||n?","+i+n:"")}getFontSize(t,e){return t*.72}getPDFStyle(t){return this.onlyShowStroke?"S":t}getPDFBlob(){return this.pdfDoc?this.pdfDoc.getPDFBlob():null}getCurrentPageNumber(){var t;return(t=this.pdfDoc)==null?void 0:t.getNumberOfPages()}removePDFDoc(){delete this.pdfDoc}};var O_e=nd(jD());var iZe=nd(Lb());function XKe(o){return o.pageSet==="merged"||o.pageSet==="separated"}function E_e(o,t,e,r){return o.type==="Board Outline"&&r==="separated"?!0:!(!e.has(o.layerId)||!t.has(o.type))}function zLt(o){return o.reduce((t,e)=>{let r=SKe[e];return r&&t.set(r,1),t},new Map)}function qKe(o){return o.reduce((t,e)=>(t.set(e.layerId,1),t),new Map)}function $Ke(o){return o.reduce((t,e)=>(t.set(e,1),t),new Map)}function KKe(o,t=[],e=[],r){let i=zLt(e),n=qKe(t),s=$Ke(e),a=new ft;zi.getInstance().getAllItem().forEach(I=>{n.has(56)&&I.type==="Slot Region"&&a.conversion1("px(100)","mm",I.radius*2)<=_Ee&&o.ext1(I.center.bbox().extendOfSize(YV/2)),E_e(I,i,n,r)&&o.ext1(I.buildBBox())}),rn.getInstance().getAllItem().forEach(I=>{E_e(I,i,n,r)&&o.ext1(I.buildBBox())}),Mi.getInstance().getAllItem().forEach(I=>{E_e(I,i,n,r)&&o.ext1(I.buildBBox())});let l=n.has(3),c=n.has(4),h=s.has("SurfaceMountComponentSilkscreen"),u=s.has("ThroughHoleComponentSilkscreen"),d=s.has("NotAddIntoBomWithNcMark"),p=s.has("NotAddIntoBomWithXMark");(h||u||d||p)&&xs.getInstance().getAllItem().forEach(I=>{let C=YLt(I);d||p?o.ext1(I.buildBBox()):I.layerId===1?l&&s.has(C)&&o.ext1(I.buildBBox()):I.layerId===2&&c&&s.has(C)&&o.ext1(I.buildBBox())}),s.has("CopperFilled")&&Wo.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())}),s.has("Dimension")&&(Ka.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())}),Za.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())}),Sl.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())})),s.has("Image")&&Qs.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())});let m=s.has("PadDrill"),g=n.has(47);EKe.some(I=>s.has(I))&&$n.getInstance().getAllItem().forEach(I=>{n.has(56)&&o.ext1(I.center.bbox().extendOfSize(YV/2));let C=jLt(I);switch(I.layerId){case 1:{s.has(C)&&[1,5,7].some(E=>n.has(E))&&o.ext1(I.buildBBox());break}case 2:{s.has(C)&&[2,6,8].some(E=>n.has(E))&&o.ext1(I.buildBBox());break}case 12:{(m&&g||s.has(C)&&[2,6,8,1,5,7].some(E=>n.has(E)))&&o.ext1(I.buildBBox());break}default:throw Error(`getBBox: not support pad on layer:${I.layerId}`)}});let y=s.has("Via"),b=s.has("ViaDrill");(y||b)&&Tn.getInstance().getAllItem().forEach(I=>{n.has(56)&&o.ext1(I.center.bbox().extendOfSize(YV/2)),(n.has(I.layerId)||b&&n.has(47)||y&&[12,5,6].some(C=>n.has(C)))&&o.ext1(I.buildBBox())}),s.has("PlaneZone")&&Ho.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())});let P=s.has("Text"),T=s.has("SurfaceMountComponentProperty")||s.has("ThroughHoleComponentProperty");(P||T)&&mo.getInstance().getAllItem().forEach(I=>{let C=sge(I);n.has(I.layerId)&&s.has(C)&&I.getText()&&o.ext1(I.buildBBox())}),s.has("Track")&&An.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())})}function ZKe(o,t){switch(t){case"Bottom Auto Designator Placement":case"Top Auto Designator Placement":{let e=t==="Bottom Auto Designator Placement"?2:1;xs.getInstance().getAllItem().forEach(r=>{r.layerId===e&&o.ext1(r.buildBBox())}),zi.getInstance().getAllItem().concat(rn.getInstance().getAllItem()).concat(Mi.getInstance().getAllItem()).forEach(r=>{r.type==="Board Outline"&&o.ext1(r.buildBBox())});break}case"BOM":default:break}}function YLt(o){return rC(o)?"SurfaceMountComponentSilkscreen":"ThroughHoleComponentSilkscreen"}function jLt(o){let t=o.getParent(),e=o.layerId;if(t==null)switch(e){case 1:return t?t instanceof vi?rC(t)?"SurfaceMountTopPad":"ThroughHoleTopPad":void 0:"IsolatedTopPad";case 2:return t?t instanceof vi?rC(t)?"SurfaceMountBottomPad":"ThroughHoleBottomPad":void 0:"IsolatedTopPad";case 12:return t?t instanceof vi?"ThroughHoleMultiPad":void 0:"IsolatedTopPad";default:throw Error(`getPadType: pad can not use layerId:${e}`)}}function sge(o){let t=o.getParent();if(o.key&&t instanceof vi)return rC(t)?"SurfaceMountComponentProperty":"ThroughHoleComponentProperty";if(!o.key&&!t)return"Text";if(!o.key&&t instanceof vi&&[3,4].includes(o.layerId))return rC(t)?"SurfaceMountComponentSilkscreen":"ThroughHoleComponentSilkscreen"}function age(o){return{matrix:o.getMatrix(),bbox:o.bbox,rotation:o.rotation,fontSize:o.fontSize,fontFamily:o.fontFamily,strokeWidth:o.strokeWidth,content:o.getText(),shapes:o.getRealOutline()}}function JKe(o,t){let e=qKe(o),r=$Ke(t);return mo.getInstance().getAllItem().reduce((i,n)=>{if(!e.has(n.layerId))return i;let s=sge(n);return r.has(s)&&i.push({content:n.getText(),rotation:n.rotation,matrix:n.matrix,fontSize:n.fontSize,fontFamily:n.fontFamily}),i},[])}function lge(o,t){let e=o.getParent();switch(t){case"IsolatedTopPad":case"IsolatedMultiPad":case"IsolatedBottomPad":return e==null;case"SurfaceMountBottomPad":case"SurfaceMountTopPad":return e instanceof vi&&rC(e);case"ThroughHoleBottomPad":case"ThroughHoleTopPad":case"ThroughHoleMultiPad":return e instanceof vi&&!rC(e);case"PadDrill":return!0;default:throw Error("matchPad: error used!")}}function QKe(o,t){if(o.key==="")return!1;let e=o.getParent();switch(t){case"SurfaceMountComponentProperty":return e instanceof vi&&rC(e);case"ThroughHoleComponentProperty":return e instanceof vi&&!rC(e);default:throw Error("matchComponentProperty: error used!")}}function eZe(o,t){switch(t){case"SurfaceMountComponentSilkscreen":return rC(o);case"ThroughHoleComponentSilkscreen":return!rC(o);default:throw Error("matchComponentSilkscreen: error used!")}}var rZe=nd(jD());var gH=class{constructor(t){this.parent=t}async generatePageEnd(t,e){let r=this.parent.ops.customPage.indexOf(t);if(this.parent.ops.pageSet==="separated"&&this.parent.ops.fileType!=="printPDF"){if(this.parent.ops.segmentedExport)await e({title:"CreatePDF",value:(r+1)/this.parent.ops.customPage.length,description:"",data:this.parent.createPDF.generateEnd()});else{this.parent.jsZIP||(this.parent.jsZIP=new rZe.default);let i=this.parent.createPDF.getPDFBlob();this.parent.jsZIP.file(this.getZipPath(t.name),i)}this.parent.createPDF.removePDFDoc()}}getZipPath(t){switch(this.parent.ops.pageSet){case"separated":case"merged":return`${t}.pdf`;default:return}}};var V0=class V0 extends gH{static getCellWidth(t){switch(t){case"Description":return this.DESCRIPTION_COLUMN_WIDTH;case"Designator":return this.DESIGNATOR_COLUMN_WIDTH;default:return this.DEFAULT_COLUMN_WIDTH}}async generatePage(t,e){let{colorType:r,name:i,specialFlag:n,bomInfo:s}=t,a=!0,l=!0,c=await this.getShapes(s),h=new ut(0,V0.PAGE_WIDTH,0,V0.PAGE_HEIGHT),u=this.parent.ops.customPage.indexOf(t);for(let d=0;d<c.length;d++)await this.parent.createPDF.generateOne({id:n,color:[0,0,0,1],isMirror:!1,shapes:c[d],bbox:h,textArr:[],colorType:r,backgroundColor:ee.WHITE},async p=>{let{data:m,value:g,title:y}=p,b=this.getZipPath(i);await e({title:"CreatePDF",value:(u+(d+g)/c.length)/this.parent.ops.customPage.length,data:m,path:b})},a,l);await this.generatePageEnd(t,e)}async getShapes(t){let r=((await ie.windowBridge.rpcCall("getBomCsv",{...t,selectedId:x.getInstance().id},$())).message||[]).filter(d=>d!==`
`).map(d=>d.split("	")),[i=[],...n]=r,s=[],a=[],l=V0.PAGE_WIDTH-V0.MARGIN*2,c=0,h=[];for(let d of i){let p=V0.getCellWidth(d);c+=p,c<=l?h.push({name:d,prompt:d,width:p}):(c=0,s.push(h),a.push([]),h=[{name:d,prompt:d,width:p}])}h.length&&s.push(h)&&a.push([]);for(let d of n){let p=0;for(let m=0;m<s.length;m++){let g=p+s[m].length;a[m].push(d.slice(p,g).reduce((y,b,P)=>(y[s[m][P].name]=b,y),{})),p=g}}let u=s.map((d,p)=>[{x:V0.MARGIN,y:V0.PAGE_HEIGHT-V0.MARGIN,headers:d,data:a[p],config:{fontSize:V0.FONT_SIZE,margins:{left:V0.MARGIN,top:V0.MARGIN,bottom:V0.MARGIN,width:V0.PAGE_WIDTH-2*V0.MARGIN}}}]);return u.length?u:[[]]}};V0.MARGIN=39.37,V0.DESCRIPTION_COLUMN_WIDTH=236.22,V0.DESIGNATOR_COLUMN_WIDTH=157.48,V0.DEFAULT_COLUMN_WIDTH=78.74,V0.PAGE_WIDTH=1170,V0.PAGE_HEIGHT=825,V0.FONT_SIZE=12;var cge=V0;var u1=class u1 extends gH{constructor(e,r){super(e);this.type=r}get componentLayerId(){if(this.type==="TOP")return 1;if(this.type==="BOTTOM")return 2}get isMirror(){return this.type==="BOTTOM"}async generatePage(e,r){let{colorType:i,name:n,specialFlag:s}=e,a=!0,l=!0,{shapes:c,preText:h}=this.getShapes(),{cloneShapes:u,clonePreText:d}=this.getClonePanlizeShapes(c,h),p=this.parent.ops.customPage.indexOf(e);await this.parent.createPDF.generateOne({id:s,color:[0,0,0,1],isMirror:this.isMirror,shapes:w1(c,u),bbox:this.parent.pageBBox,textArr:a&&w1(h,d),colorType:i,backgroundColor:ee.WHITE},async m=>{let{data:g,value:y,title:b}=m,P=this.getZipPath(n);await r({title:"CreatePDF",value:(p+y)/this.parent.ops.customPage.length,data:g,path:P})},a,l),await this.generatePageEnd(e,r)}getShapes(){let e=this.parent.getBoardOutline(11).map(s=>(s.color=u1.OUTLINE_COLOR,s)),r=[],i=[],n=[];for(let s of xs.getInstance().getAllItem()){let{box:a,layerId:l,designator:c}=s;if(l===this.componentLayerId){let{width:h,height:u,rotation:d,center:p}=a,m=Math.min(h,u),g=[new M(a.leftLow,a.leftUp),new M(a.leftUp,a.rightUp),new M(a.rightUp,a.rightLow),new M(a.rightLow,a.leftLow)];r.push({primitives:g,style:"S",color:u1.BOX_COLOR,strokeWidth:0});let y=Math.min(Math.max(m*3/4,u1.MIN_DESIGNATOR_HEIGHT),u1.MAX_DESIGNATOR_HEIGHT),b=h>u?d:(es+d)%Vr;b<0&&(b+=Vr),b-u1.ROTATION_LIMIT_1>1e-4&&u1.ROTATION_LIMIT_2-b>1e-4&&(b>es*3?b=u1.ROTATION_LIMIT_1:b=Math.max(b+Tu,u1.ROTATION_LIMIT_2));let{path:P,width:T,height:I}=Gd(c,y,y/10),C=5,E=new Ed(void 0,l,void 0,"",!1,c,!0,"default",y,b,p,C,this.getFontStrokeWidth(y),!1,0,!1,!1,P,T,I,!1),O=age(E);O.color=u1.DESIGNATOR_COLOR,i.push(O),n.push({content:E.getText(),rotation:E.rotation,matrix:E.matrix,fontSize:E.fontSize,fontFamily:E.fontFamily})}}return{shapes:[].concat(e,r,i),preText:n}}getClonePanlizeShapes(e,r){let i=this.parent.getClonePanelizeShapes(e,null),n=[];if(this.parent.panelizeInfo.success&&!this.parent.panelizeInfo.onlyOutline){let{row:s,column:a}=this.parent.panelizeInfo,l=ai.getInstance().offset;for(let c=0;c<s;c++)for(let h=0;h<a;h++){if(c===0&&h===0)continue;let u=Ae.translate(l.x*h,l.y*c,0);for(let d of r){let{matrix:p}=d,m=p.multiply4(u);n.push({...d,matrix:m})}}}return{cloneShapes:i,clonePreText:n}}getFontStrokeWidth(e){return this.parent.ops.onlyShowStroke?0:e/10}};u1.DESIGNATOR_COLOR=[255,0,0,1],u1.OUTLINE_COLOR=[192,128,192,1],u1.BOX_COLOR=[0,0,0,1],u1.MAX_DESIGNATOR_HEIGHT=4.7244,u1.MIN_DESIGNATOR_HEIGHT=2.3622,u1.ROTATION_LIMIT_1=es,u1.ROTATION_LIMIT_2=es*3+es/90;var OK=u1;var yH=class o{constructor(t,e,r){this.ops=t;this.panelizeInfo=e;this.bridge=r;this.clearance=0;this.bboxFac=new _e;this.bomPageTool=new cge(this);this.topAutoDesignatorPageTool=new OK(this,"TOP");this.bottomAutoDesignatorPageTool=new OK(this,"BOTTOM");this._state="NORMAL";this._componentAttrMap=new Map;this._i18nMap=new Map;o.CURRENT_INSTANCE=this,t.customPage.forEach(i=>{var n,s,a;(n=i.layer)==null||n.sort((l,c)=>f_e.indexOf(l.layerId)>f_e.indexOf(c.layerId)?1:-1),(s=i.object)==null||s.sort((l,c)=>m_e.indexOf(l)>m_e.indexOf(c)?1:-1),i.layerMap=(a=i.layer)==null?void 0:a.reduce((l,c)=>(l.set(c.layerId,c),l),new Map),Fn(i.objectColor||{},(l,c)=>{let h=wIe(c);h&&(i.objectColor[l]=h)})})}get objectColor(){return this.ops.customPage[this.currentPageIndex].objectColor}get willCreatePageNumber(){var t;return(((t=this.createPDF)==null?void 0:t.getCurrentPageNumber())||0)+1}getSpecialPageTool(t){if(t==="BOM")return this.bomPageTool;if(t==="Top Auto Designator Placement")return this.topAutoDesignatorPageTool;if(t==="Bottom Auto Designator Placement")return this.bottomAutoDesignatorPageTool}get state(){return this._state}async getPdf(t,e,r){let{pageSet:i,needAnnot:n,needMenu:s,fileName:a,language:l,onlyShowStroke:c,customPage:h,fileType:u,pdfWatermarkConfig:d,segmentedExport:p,customPdfWatermarkConfig:m}=this.ops,g=n||s,y=[],b=i==="merged";this.isMerge=b,this.pageSet=i,this.pageBBox=this.getPageBBox(),this.onInterrupt=r;let P=this.createPDF=new EK({needAnnot:n,needMenu:s,language:l,onlyShowStroke:c,pdfWatermarkConfig:d,segmentedExport:p,customPdfWatermarkConfig:m});if(await aY(h,async(C,E,O)=>{if(this.state==="INTERRUPT")return;let{layer:_=[],object:R,colorType:v,name:D,background:w,specialFlag:F}=E;this.colorType=v,this.currentPageIndex=O;let H=i==="paged"?this.willCreatePageNumber:1;if(y.push({name:D,pageNumber:H}),F&&await this.getSpecialPageTool(F).generatePage(E,e),await aY(_,async(z,G,W)=>{if(this.state==="INTERRUPT")return;let{layerId:L,color:B}=G,N=ee.of3(B).toRGBA(),U=$e.getInstance().getLayer(L),{isMirror:k,transparency:V}=G,Y=g?await this.getComponentAttr(L,b):[],X=this.getPanelize(L,R),Z=R.reduce((he,re)=>{let se=this.getObjectShape(L,re);return w1(se,this.getClonePanelizeShapes(se,re)),re==="CopperFilled"||re==="Image"||re==="PlaneZone"?se.concat(he):he.concat(se)},Y.concat(X));if(L===56&&R.includes("PadDrill")&&R.includes("ViaDrill")){let he=this.getDrillDrawingLayerDrill();w1(Z,w1(he,this.getClonePanelizeShapes(he,null)))}N[3]=1-V*.01;let Q=W===0||i==="separated",ae=W===_.length-1||i==="separated";if(await P.generateOne({id:L,color:N,isMirror:k,shapes:Z,bbox:this.pageBBox,textArr:Q&&this.getPrePageText(),colorType:v,backgroundColor:(w==null?void 0:w.color)&&ee.of3(w==null?void 0:w.color)},async he=>{let{data:re,value:se,title:K}=he,me=I(D,U);await e({title:"CreatePDF",value:(O+(se+W)/_.length)/h.length,data:re,path:me})},Q,ae),i==="separated"&&u!=="printPDF"){if(p)await e({title:"CreatePDF",value:(O+(1+W)/_.length)/h.length,description:"",data:P.generateEnd()});else{this.jsZIP||(this.jsZIP=new O_e.default);let he=P.getPDFBlob();this.jsZIP.file(`${I(D,U)}.pdf`,he)}P.removePDFDoc()}}),i==="merged"&&u!=="printPDF"){if(p)await e({title:"CreatePDF",value:(O+1)/h.length,description:"",data:P.generateEnd()});else{this.jsZIP||(this.jsZIP=new O_e.default);let z=P.getPDFBlob();this.jsZIP.file(`${I(D,void 0)}.pdf`,z)}P.removePDFDoc()}}),this.state==="INTERRUPT")return;if(i==="separated"||i==="merged"){if(!p){u==="printPDF"?t(P.getPDFBlob(),null,null):await this.jsZIP.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}}).then(C=>t(C,a,"zip"));return}}else{let C=P.generateEnd(y);await e({title:"CreatePDF",value:1,description:"",data:C})}await e({title:"DownloadPDF",value:0});let T=p?null:P.getPDFBlob();await t(T,a,i==="paged"?"pdf":"zip"),await e({title:"DownloadPDF",value:1});function I(C,E){switch(i){case"separated":return`${C}/${E.name}.pdf`;case"merged":return`${C}.pdf`;default:return}}}getObjectShape(t,e){switch(e){case"NotAddIntoBomWithNcMark":return this.getNotAddIntoBomWithNcMark(t);case"NotAddIntoBomWithXMark":return this.getNotAddIntoBomWithXMark(t);case"IsolatedTopPad":case"ThroughHoleTopPad":case"SurfaceMountTopPad":return this.getTopPad(t,e);case"IsolatedBottomPad":case"ThroughHoleBottomPad":case"SurfaceMountBottomPad":return this.getBottomPad(t,e);case"IsolatedMultiPad":case"ThroughHoleMultiPad":return this.getMultiPad(t,e);case"Via":return this.getVia(t);case"PadDrill":return this.getPadDrill(t);case"ViaDrill":return this.getViaDrill(t);case"Track":return this.getTrack(t);case"Text":return this.getText(t);case"Image":return this.getImage(t);case"Dimension":return this.getDimension(t);case"BoardOutline":return this.getBoardOutline(t);case"BoardCutout":return this.getBoardCutout(t);case"CopperOutline":return this.getCopperOutline(t);case"CopperFilled":return this.getCopperFilled(t);case"SolidRegion":return this.getSolidRegion(t);case"ProhibitedRegion":return this.getProhibitedRegion(t);case"FPCStiffener":return this.getFPCStiffener(t);case"Line":return this.getLine(t);case"PlaneZone":return this.getPlaneZone(t);case"SurfaceMountComponentProperty":case"ThroughHoleComponentProperty":return this.getComponentProperty(t,e);case"SurfaceMountComponentSilkscreen":case"ThroughHoleComponentSilkscreen":return this.getComponentSilkscreen(t,e);case"TearDrop":return this.getTearDropShapes(t);case"Shell_Outline":case"Shell_ScrewPillar":case"Shell_SideDatumLine":case"Shell_SideSlotRegion":case"Shell_TopBottomSlotRegion":case"Shell_SideEntity":case"Shell_TopBottomEntity":return this.getShellShapes(t,e);default:return console.warn(`${e}\u83B7\u53D6\u56FE\u5143\u6570\u636E\u5931\u8D25\uFF0C\u65E0\u76F8\u5E94\u83B7\u53D6\u56FE\u5F62\u65B9\u6CD5\uFF01`),[]}}getNotAddIntoBomWithNcMark(t){return xs.getInstance().getAllItem().reduce((e,r)=>{let{box:i,addIntoBom:n}=r;if(n==="no"){let{width:a,height:l,rotation:c,center:h}=i,d=Math.min(a,l)*2/3,{path:p,width:m,height:g}=Gd("NC",d,d/10),y=5,b=new Ed(void 0,t,void 0,"",!1,"NC",!0,"default",d,c,h,y,d/10,!1,0,ms(t),!1,p,m,g,!1),P=this.textModel2PDFText(b,"NotAddIntoBomWithNcMark");P.color&&(P.color[3]=.5),e.push(P)}return e},[])}getNotAddIntoBomWithXMark(t){let e=this.getObjectColorWithA("NotAddIntoBomWithXMark",t);e&&(e[3]=.5);let r="S";return xs.getInstance().getAllItem().reduce((i,n)=>{let{box:s,addIntoBom:a}=n;if(a==="no"){let{width:l,height:c,rotation:h,center:u}=s,d=Math.min(l,c),p=[new M(s.leftLow,s.rightUp),new M(s.leftUp,s.rightLow)];i.push({primitives:p,style:r,color:e,strokeWidth:d*2/30})}return i},[])}getTopPad(t,e){let r=[1,5,7],i="F",n=t===1?this.getObjectColorWithA(e,t):void 0;return r.includes(t)?$n.getInstance().getAllItem().filter(a=>a.layerId===1).reduce((a,l)=>{if(!lge(l,e))return a;let c=l.getMathGraphics(t,this.clearance);return c&&a.push({...c,style:i,color:n}),a},[]):[]}getBottomPad(t,e){let r=[2,6,8],i="F",n=t===2?this.getObjectColorWithA(e,t):void 0;return r.includes(t)?$n.getInstance().getAllItem().filter(a=>a.layerId===2).reduce((a,l)=>{if(!lge(l,e))return a;let c=l.getMathGraphics(t,this.clearance);return c&&a.push({...c,style:i,color:n}),a},[]):[]}getMultiPad(t,e){return[2,1,12,5,7,6,8].includes(t)||Ms(t)?this.getMultiPadData(t,e):[]}getMultiPadData(t,e){let r="F",i=t===12?this.getObjectColorWithA(e,t):void 0;return $n.getInstance().getAllItem().filter(s=>s.layerId===12&&lge(s,e)).reduce((s,a)=>{var c,h;if(t===12&&(a.type===2||a.unusedInnerLayers.length))return s;let l=a.getFileGraphics(t,this.clearance);if(l){let u=[];for(let m of l)m!=null&&(w1(u,m.primitives),m!==l[l.length-1]&&u.push("m"));let d={primitives:u,style:r,color:i},p=null;if(t===47&&this.colorType!=="Full Color"){d.color="transparent";let m=(h=(c=this.ops.customPage[this.currentPageIndex].layerMap)==null?void 0:c.get(t))==null?void 0:h.transparency;m!=null&&(d.opacity=1-m*.01),p={...d,style:"S"},delete p.color}s.push(d),p&&s.push(p)}return s},[])}getVia(t){let r=[12,5,6].includes(t);return this.isMerge||(r=r||[1,2].includes(t)||Ms(t)),r?this.getViaData(t,"Via"):[]}getViaData(t,e){let r="F",i=[12,5,6,47],n=this.getObjectColorWithA(e,t);return Tn.getInstance().getAllItem().reduce((s,a)=>{var c,h,u;if(t===12&&a.unusedInnerLayers.length)return s;if(a.type===1){let p=t===2?100:t,{startLayer:m,endLayer:g}=a;if(m=m===2?100:m,g=g===2?100:g,(p<m||p>g)&&!i.includes(t))return s}let l=a.getFileGraphics(t,this.clearance);if(l){let d=[];for(let g of l)g!=null&&(w1(d,g.primitives),g!==l[l.length-1]&&d.push("m"));let p={primitives:d,style:r,color:n},m=null;if(t===47&&this.colorType!=="Full Color"){p.color="transparent";let g=(u=(h=(c=this.ops.customPage[this.currentPageIndex])==null?void 0:c.layerMap)==null?void 0:h.get(t))==null?void 0:u.transparency;g!=null&&(p.opacity=1-g*.01),m={...p,style:"S"},delete m.color}s.push(p),m&&s.push(m)}return s},[])}getPadDrill(t){return[47].includes(t)?this.getMultiPadData(t,"PadDrill"):[]}getViaDrill(t){return[47].includes(t)?this.getViaData(t,"ViaDrill"):[]}getTrack(t){let e="S",r=this.getObjectColorWithA("Track",t);return An.getInstance().getAllItem().reduce((i,n)=>{if(n.layerId===t){let s=n.width,a={primitives:[n.primitive]};a&&i.push({...a,strokeWidth:s,style:e,color:r})}return i},[])}getText(t){return mo.getInstance().getAllItem().filter(e=>e.layerId===t&&e.key==="").map(e=>this.textModel2PDFText(e,"Text"))}getImage(t){let e="F",r=this.getObjectColorWithA("Image",t);return Qs.getInstance().getAllItem().reduce((i,n)=>{if(n.layerId===t){let s=n.getPath(),a=s.reduce((l,c,h)=>{let u=c.pl.primitives;return h!==s.length-1&&u.push("m"),w1(l,u),l},[]);i.push({primitives:a,style:e,color:r})}return i},[])}getDimension(t){let e=this.getObjectColorWithA("Dimension",t);return Ka.getInstance().getAllItem().concat(Za.getInstance().getAllItem()).concat(Sl.getInstance().getAllItem()).reduce((r,i)=>{if(i.layerId===t){let n=i.getBaseGraphics();for(let s of n)r.push({primitives:s,style:"S",strokeWidth:i.strokeWidth,color:e})}return r},[])}getBoardOutline(t){return this.pageSet==="separated"&&(t=11),this.getLine2DTypeShape(t,"Board Outline",this.getObjectColorWithA("BoardOutline",t))}getBoardCutout(t){return this.getLine2DTypeShape(t,"Slot Region",this.getObjectColorWithA("BoardCutout",t))}getCopperOutline(t){return this.getLine2DTypeShape(t,"Copper Region",this.getObjectColorWithA("CopperOutline",t))}getCopperFilled(t){let e=this.getObjectColorWithA("CopperFilled",t);return rn.getInstance().getAllItem().concat(zi.getInstance().getAllItem()).concat(Mi.getInstance().getAllItem()).reduce((r,i)=>(i.layerId===t&&i.type=="Copper Region"&&i.iteratorCopper(n=>{let s=Wo.getInstance().getItem(n);if(!s)return;let a=s.style==="solid",l=a?s.optimization?s.optimizationWidth||0:null:s.gridLineWidth||0,c=a?l!=null?"FD":"F":"S",h=a&&s.optimization?"1":void 0,u=s.getOutline(),d=[];u.forEach((p,m)=>{w1(d,p.primitives),d.push("m")}),r.push({primitives:d,style:c,strokeWidth:l,lineJoin:h,color:e})}),r),[])}getSolidRegion(t){return this.getLine2DTypeShape(t,"Fill Region",this.getObjectColorWithA("SolidRegion",t))}getProhibitedRegion(t){return this.getLine2DTypeShape(t,"Prohibited Region",this.getObjectColorWithA("ProhibitedRegion",t))}getFPCStiffener(t){return this.getLine2DTypeShape(t,"FPC Stiffener",this.getObjectColorWithA("FPCStiffener",t))}getLine(t){return this.getLine2DTypeShape(t,"Line",this.getObjectColorWithA("Line",t))}getShellShapes(t,e){let r=null;if(e==="Shell_Outline"?r="3D Shell - Outline":e==="Shell_ScrewPillar"?r="3D Shell - Screw Pillar":e==="Shell_SideDatumLine"?r="3D Shell - Side Datum Line":e==="Shell_SideSlotRegion"?r="3D Shell - Side Slot Region":e==="Shell_TopBottomSlotRegion"?r="3D Shell - Top Slot Region":e==="Shell_SideEntity"?r="3D Shell - Side Entity":e==="Shell_TopBottomEntity"&&(r="3D Shell - Top/Bottom Entity"),!Object.is(r,null))return this.getLine2DTypeShape(t,r,this.getObjectColorWithA(e,t))}async getComponentAttr(t,e){let r=e?[1]:[1,3,7,5,9],i=e?[2]:[2,4,8,10,6];if(!r.includes(t)&&!i.includes(t))return[];{let n=r.includes(t)?1:2,s=[];for(let a of xs.getInstance().getAllItem())if(a.layerId===n){let{attrKeyValue:l,box:c,device:h,globalIndex:u}=a,d=this._componentAttrMap.get(u);if(d){if(d[0]===this.currentPageIndex)continue;s.push(d[1])}else{let p={};await aY(l,async(m,g,y)=>{p[m]={k:await this.i18n(m),v:g}}),p.Layer||(p.Layer={k:await this.i18n("Layer"),v:await this.i18n($e.getInstance().getLayer(a.layerId).name)}),this._componentAttrMap.set(u,[this.currentPageIndex,{attr:p,box:c,device:h,globalIndex:u}]),s.push(this._componentAttrMap.get(u)[1])}}return s}}getPlaneZone(t){let e="F",r=this.getObjectColorWithA("PlaneZone",t);return Ho.getInstance().getAllItem().reduce((i,n)=>{if(n.layerId===t){let s=n.getOutline(),a=[];s.forEach((l,c)=>{w1(a,l.primitives),a.push("m")}),i.push({primitives:a,style:e,color:r})}return i},[])}getComponentProperty(t,e){return mo.getInstance().getAllItem().filter(i=>i.layerId===t&&QKe(i,e)&&i.getText()).map(i=>this.textModel2PDFText(i,e))}getComponentSilkscreen(t,e){if(![4,3].includes(t))return[];let r=this.getObjectColorWithA(e,t);return xs.getInstance().getAllItem().reduce((i,n)=>(eZe(n,e)&&n.getItems().filter(a=>a.layerId&&a.layerId===t).forEach(a=>{if(a.layerId&&a.layerId===t){if(a instanceof Li)a.key===""&&i.push(this.textModel2PDFText(a,e));else if(a instanceof lr){let{strokeWidth:l}=a,c=["Line","Board Outline","Copper Region"].includes(a.type)?"S":"F",h=a.getMathGraphics(t,this.clearance);if(h){let u=this.polylineOrGroup2PDFShape(h,{strokeWidth:l,style:c,color:r});i.push(u)}}}}),i),[])}getLine2DTypeShape(t,e,r){return zi.getInstance().getAllItem().concat(rn.getInstance().getAllItem()).concat(Mi.getInstance().getAllItem()).reduce((i,n)=>{var s,a,l,c,h,u;if(!(n.getParent()&&[4,3].includes(t))&&n.type===e&&t===n.layerId){let{strokeWidth:d}=n,p=["Line","Board Outline","Copper Region","3D Shell - Outline","3D Shell - Screw Pillar","3D Shell - Side Datum Line","Prohibited Region"].includes(e)?"S":"F",m=n.getMathGraphics(t,this.clearance),g=m?m instanceof Gt?m.items.sort((b,P)=>b.bbox().area()>P.bbox().area()?-1:1):[m]:null,y=g==null?void 0:g.reduce((b,P,T)=>(w1(b,P.primitives),T!==g.length-1&&b.push("m"),b),[]);if(y!=null&&y.length){let b={primitives:y,strokeWidth:d,style:p,color:r};if(this.pageSet==="separated"&&e==="Board Outline"){if(b.color=this.getObjectColorWithA("BoardOutline",11),!b.color)switch(this.colorType){case"Black on White":{b.color=[0,0,0,1];break}case"Full Color":{b.color=wIe((a=(s=this.ops.customPage[this.currentPageIndex])==null?void 0:s.layerMap.get(t))==null?void 0:a.color)||$e.getInstance().getLayer(t).activeColor.toRGBA();break}case"White on Black":{b.color=[255,255,255,1];break}}let T=(c=(l=this.ops.customPage[this.currentPageIndex])==null?void 0:l.layerMap.get(t))==null?void 0:c.transparency;T!=null&&(b.color[3]=1-T*.01)}let P=null;if(e==="Slot Region"&&this.colorType!=="Full Color"){b.color="transparent";let T=(u=(h=this.ops.customPage[this.currentPageIndex])==null?void 0:h[t])==null?void 0:u.transparency;T!=null&&(b.opacity=1-T*.01),P={...b,style:"S"},delete P.color}e==="Prohibited Region"&&i.push(this.getFillGrid(n)),i.push(b),P&&i.push(P)}}return i},[])}getDrillDrawingLayerDrill(){let t=this.getDrillConfig();if(t==null)return[];let e=YV;return t.reduce((r,i)=>{let{position:n,text:s,image:a}=i;if(a!=null){let l=new _e;a.forEach(p=>{l.ext1(p.bbox())});let c=l.build1(),h=c.center(),u=Qe.translate(-h.x,-h.y).scale(e/c.width()*1.4).translate1(n),d=a.reduce((p,m,g)=>{let y=m.primitives.map(b=>b.multiply3(u));return w1(p,y),g!==a.length-1&&p.push("m"),p},[]);r.push({primitives:d,style:"F"})}if(s!=null){let{center:l,width:c,height:h}=this.getPolyLinesCenterAndWH(...s),u=Qe.translate(-l.x,-l.y).scale(e/Math.max(c,h)/1.8*1.4*2).translate1(n),d=s.reduce((p,m)=>{let g=m.primitives.map(y=>y.multiply3(u));return w1(p,g),p},[]);r.push({primitives:d,style:"S",strokeWidth:.1*2})}return r},[])}getPolyLinesCenterAndWH(...t){console.time("calculate polyline center");let[e,r,i,n]=[1/0,1/0,-1/0,-1/0];for(let c of t)for(let h of c.primitives){let[u,d,p,m]=[h.start().x,h.end().x,h.start().y,h.end().y];e=Math.min(u,d,e),i=Math.max(u,d,i),r=Math.min(p,m,r),n=Math.max(p,m,n)}let s=new S((e+i)/2||0,(r+n)/2||0),a=Math.abs(i-e),l=Math.abs(n-r);return console.timeEnd("calculate polyline center"),{center:s,width:a,height:l}}getPanelize(t,e){var a;if(!((a=this.panelizeInfo)==null?void 0:a.success))return[];let i=e.includes("BoardOutline")?ai.getInstance().getProfileGroup(t).map(l=>({...l,style:"S"})):[],n=ai.getInstance().getPadGroup(t),s=ai.getInstance().getText(t).map(l=>this.textModel2PDFText(l,sge(l)));return[].concat(i,n,s)}getClonePanelizeShapes(t,e){let{success:r,row:i,column:n,onlyOutline:s}=this.panelizeInfo;if(!r||s&&e!=="BoardCutout")return[];let a=[],l=ai.getInstance().offset;for(let c=0;c<i;c++)for(let h=0;h<n;h++){if(c===0&&h===0)continue;let u=Qe.translate(l.x*h,l.y*c);for(let d of t)if(d.primitives){let p={...d,primitives:d.primitives.slice()};p.primitives.forEach((m,g)=>{m instanceof Tl&&(p.primitives[g]=m.multiply3(u))}),a.push(p)}else if(d instanceof Li){let p=d.getRealOutline().map(C=>{let E=C instanceof Kp?C.pl.primitives:C.primitives;return E.forEach((O,_)=>{E[_]=O.multiply3(u)}),C}),{rotation:m,fontSize:g,fontFamily:y,layerId:b,mirror:P,strokeWidth:T,bbox:I}=d;a.push({bbox:I.transform(u),rotation:m,fontSize:g,fontFamily:y,layerId:b,mirror:P,content:d.getText(),shapes:p,strokeWidth:T})}else if(typeof d.fontSize<"u"){let p=d.matrix.multiply4(u.toMatrix4()),m=d.bbox.transform(u),g=d.shapes.map(y=>{let b=y.clone(),P=b instanceof Kp?b.pl.primitives:b.primitives;return P.forEach((T,I)=>{P[I]=T.multiply3(u)}),b});a.push({...d,shapes:g,matrix:p,bbox:m})}}return a}getSlotBgShape(){return zi.getInstance().getAllItem().concat(rn.getInstance().getAllItem()).concat(Mi.getInstance().getAllItem()).reduce((t,e)=>{if(e.type==="Slot Region"){let{strokeWidth:r}=e,i="F",n=e.getMathGraphics(47,this.clearance);if(n){let s={...n,strokeWidth:r,style:i};s.color="transparent",t.push(s)}}return t},[])}getTearDropShapes(t){let e=Mi.getInstance().getAllItem(),r=[],i="FD",n=this.getObjectColorWithA("TearDrop",t);return e.forEach(s=>{if(s.type=="TearDrop"){if(t!==s.layerId)return;let a=s.getMathGraphics(t);a&&r.push({...a,style:i,color:n})}}),r}extendShapeBBox(t){this.getShapesBBoxFac(t,this.bboxFac)}getShapesBBoxFac(t,e){for(let r of t)if(r.primitives){let i=new _e;for(let n of r.primitives)n!="m"&&i.ext1(n.bbox());if(i.valid()){let n=i.build1(),s=r.strokeWidth;s&&(n=n.extendOfSize(s/2+IKe)),e.ext1(n)}}else typeof r.fontSize<"u"&&e.ext1(r.bbox);return e}fac2BBox(t){try{return t.build1()}catch{return null}}textModel2PDFText(t,e){let r=age(t),i=this.getObjectColorWithA(e,t.layerId);return{...r,color:i}}polylineOrGroup2PDFShape(t,e){if(t instanceof fe)return{primitives:t.primitives,...e};if(t instanceof Gt){let r=[];for(let i of t.items)i!=null&&(w1(r,i.primitives),i!==t.items.at(-1)&&r.push("m"));return{primitives:r,...e}}}getFillGrid(t){if(t instanceof Po)return this.getCircleFillGrid(t);{let e=t.getMathGraphics();e=e instanceof Gt?e.items[0]:e;let r=vA(e),i=0,n="S",s=ee.Gray.toRGBA();return{primitives:r,strokeWidth:i,style:n,color:s}}}getCircleFillGrid(t){let e=new Array,r=t.center.add(new S(-1,1).mul(t.radius*Math.sqrt(2)/2)),i=t.center.add(new S(1,-1).mul(t.radius*Math.sqrt(2)/2)),n=r.y-r.x,s=i.y-i.x,a=6;for(n-=a;n>s;n-=a){let g=2*(n-t.center.y-t.center.x),y=t.center.x*t.center.x-t.radius*t.radius+(n-t.center.y)*(n-t.center.y),b=Math.sqrt(g*g-8*y),P=(-g+b)/4,T=(-g-b)/4,I=P+n,C=T+n,E=new M(new S(P,I),new S(T,C));e.push(E)}let l=t.center.add(new S(1,1).mul(t.radius*Math.sqrt(2)/2)),c=t.center.add(new S(-1,-1).mul(t.radius*Math.sqrt(2)/2)),h=l.y+l.x,u=c.y+c.x;for(h-=a;h>u;h-=a){let g=2*(t.center.y-h-t.center.x),y=t.center.x*t.center.x-t.radius*t.radius+(t.center.y-h)*(t.center.y-h),b=Math.sqrt(g*g-8*y),P=(-g+b)/4,T=(-g-b)/4,I=-P+h,C=-T+h,E=new M(new S(P,I),new S(T,C));e.push(E)}let d=0,p="S",m=ee.Gray.toRGBA();return{primitives:e,strokeWidth:d,style:p,color:m}}async i18n(t){if(this._i18nMap.has(t))return this._i18nMap.get(t);if(this.bridge instanceof iZe.WindowMessageBridge){let e=(await this.bridge.rpcCall("i18n",t,top)).message;return this._i18nMap.set(t,e),e}else{let e=(await this.bridge.rpcCall("i18n",t)).message;return this._i18nMap.set(t,e),e}}getDrillConfig(){return this._drillConfig=this._drillConfig||VWe()}getPrePageText(){var r,i;let e=(()=>{let n=this.ops.customPage.filter(l=>l.checked),{layer:s,object:a}=n[this.currentPageIndex];return JKe(s,a)})();if(!((r=this.panelizeInfo)!=null&&r.success)||(i=this.panelizeInfo)!=null&&i.onlyOutline)return e;{let{row:n,column:s}=this.panelizeInfo,a=ai.getInstance().offset,l=[];for(let c=0;c<n;c++)for(let h=0;h<s;h++){if(c===0&&h===0)continue;let u=Ae.translate(a.x*h,a.y*c,0);for(let d of e){let{matrix:p}=d,m=p.multiply4(u);l.push({...d,matrix:m})}}return w1(e,l)}}getPageBBox(){var r;let e=(()=>{let i=new _e;for(let n of this.ops.customPage)n.specialFlag?ZKe(i,n.specialFlag):KKe(i,n.layer,n.object,this.ops.pageSet);try{return i.build().extendOfSize(CKe)}catch{return new ut(-1,1,-1,1)}}).bind(this)();if((r=this.panelizeInfo)!=null&&r.success){let{row:i,column:n}=this.panelizeInfo,s=ai.getInstance().bbox;if(this.panelizeInfo.onlyOutline)return ut.extend2(s,e);{let a=ai.getInstance().offset,l=Qe.translate(a.x*(n-1),a.y*(i-1));return ut.extend2(ut.extend2(e,e.transform(l)),s)}}else return e}getObjectColorWithA(t,e){var i;let r=(i=this.objectColor)==null?void 0:i[t];return r&&[...r.slice(0,3),1-this.ops.customPage[this.currentPageIndex].layerMap.get(e).transparency]}setInterrupt(t){var e;this.state!=="INTERRUPT"&&(this._state="INTERRUPT",(e=this.onInterrupt)==null||e.call(this,t))}exit(){o.CURRENT_INSTANCE=null}};function nZe(o){return new Promise(async(t,e)=>{console.time("CreatePDF:_getDataByMain"),l9&&console.log(`CreatePDF: before _getDataByMain used js heap size:${performance.memory.usedJSHeapSize/1024/1024}MB`);let r=XKe(o),i=o.segmentedExport?new fB(o.fileName+(r?".zip":".pdf")):null;await(i==null?void 0:i.create());let n=new yH(o,ai.getInstance().getDefaultPanelize(),A.windowBridge),s=i&&r?new iYe:null,a;s&&(s.ondata=async(l,c,h)=>{try{c!=null&&c.length&&await(i==null?void 0:i.write(c.buffer)),h&&i.close()}catch(u){n.setInterrupt(u)}}),await n.getPdf(async(l,c,h)=>{n.state!=="INTERRUPT"&&(s?(a==null||a.push(new Uint8Array,!0),s==null||s.end()):i==null||i.close(),t({data:l,fileName:c,extension:h}),console.timeEnd("CreatePDF:_getDataByMain"),l9&&console.log(`CreatePDF: after _getDataByMain used js heap size:${performance.memory.usedJSHeapSize/1024/1024}MB`))},async l=>{try{if(n.state==="INTERRUPT")return;let{value:c,title:h,data:u,path:d}=l,p=h==="CreatePDF"?.9*c:.9+c*.1,m=(u==null?void 0:u.length)||(u==null?void 0:u.byteLength);if(A.windowBridge.publish("progressUpdate",[p,"exportFile"],$()),m)if(s){d&&(a==null?void 0:a.filename)!==d&&(a==null||a.push(new Uint8Array,!0),a=new rYe(d),s.add(a));let g=u instanceof ArrayBuffer?new Uint8Array(u):ip.stringToUint8Array(u);a.push(g)}else i&&await(i==null?void 0:i.write(u));await hY(10)}catch(c){n.setInterrupt(c)}},async l=>{s?s==null||s.terminate():i==null||i.cancel(),A.windowBridge.publish("progressUpdate",[1,"exportFile"],$()),e(l||"\u6D41\u7A0B\u5DF2\u4E2D\u65AD")}).finally(()=>{n.exit()})})}async function oZe(o){Mn.getInstance().allowPull=!1,console.time("CreatePDF:_getDataByWorker"),l9&&console.log(`CreatePDF: before _getDataByWorker used js heap size:${performance.memory.usedJSHeapSize/1024/1024}MB`);let t=new xC().encode(),r=await pf.getInstance().addWorker(`editor?entry=pcb-decode-worker.js${$().location.search.replace(/\?/,"&")}`).rpcCall("exportFile",{world:t,config:o,panelize:ai.getInstance().getDefaultPanelize()}).catch(l=>{throw l}),{workerName:i,data:n,fileName:s,extension:a}=r.message;return pf.getInstance().deleteWorker(i),Mn.getInstance().allowPull=!0,console.timeEnd("CreatePDF:_getDataByWorker"),l9&&console.log(`CreatePDF: after _getDataByWorker used js heap size:${performance.memory.usedJSHeapSize/1024/1024}MB`),{data:n,fileName:s,extension:a}}function sZe(o){var t,e;(e=(t=yH.CURRENT_INSTANCE)==null?void 0:t.setInterrupt)==null||e.call(t,o)}async function aZe(o,t=!1){A.windowBridge.publish("progressUpdate",[0,"exportFile",void 0,{messageTopic:"pcb/exportFile/cancel",onlyInitiative:!0,messageTopicData:"\u7528\u6237\u4E3B\u52A8\u53D6\u6D88\u5BFC\u51FA"}],$()),qLt(o,t);let e=t?await oZe(o):await nZe(o),{data:r,fileName:i,extension:n}=e;if(o.fileType==="printPDF"){let s=URL.createObjectURL(r);A.windowBridge.publish("popupNewWindowDialog",[s],$())}else o.segmentedExport||(s2?NC(r,`${i}.${n}`,n):ip.downloadFile(`${i}.${n}`,r));A.windowBridge.publish("progressUpdate",[1,"exportFile"],$())}function qLt(o,t){let{fileType:e,pageSet:r}=o;$Lt()&&e==="filePdf"?o.segmentedExport=!0:o.segmentedExport=!1,o.fileType==="printPDF"&&(o.needMenu=!1)}function $Lt(){var o,t,e;return(e=(t=(o=$())==null?void 0:o.navigator)==null?void 0:t.serviceWorker)==null?void 0:e.controller}async function lZe(o,t=!1){A.windowBridge.publish("progressUpdate",[0,"exportFile",void 0,{messageTopic:"pcb/exportFile/cancel",onlyInitiative:!0,messageTopicData:"\u7528\u6237\u4E3B\u52A8\u53D6\u6D88\u5BFC\u51FA"}],$());let e=t?await oZe(o):await nZe(o);A.windowBridge.publish("progressUpdate",[1,"exportFile"],$());let{data:r,fileName:i,extension:n}=e;return{data:(await MC(r)).data,fileName:i,extension:n}}var Db=te.getInstance();var hge=class{constructor(){this.startIndex=0;this.endIndex=300;this._pcbNames=[];this.searchValue="";this._yesOrNo=["Yes","No"];this._origin=["Upper Left","Middle Left","Lower Left","Upper Center","Middle Center","Lower Center","Upper Right","Middle Right","Lower Right"];this._attrsForDocType={4:["Component Property","Pad","Test Point","FPC Stiffener","Text","Via","Slot Region","Fill Region","Prohibited Region","Line","Dimension","Image"],3:["Component","Component Property","Pad","Test Point","FPC Stiffener","Text","Track","Via","Suture Via","Board Outline","Slot Region","Copper Region","Fill Region","Prohibited Region","Constraint Region","Line","Dimension","Image","Colorful Image","Group","3D Shell - Outline","3D Shell - Screw Pillar","3D Shell - Side Datum Line","3D Shell - Slot Region","3D Shell - Entity"]};this._inputType=this.getInputType(this.pcbNames),A.messageBus.rpcService("getFindResult",({startIndex:t,endIndex:e})=>(this.startIndex=t,this.endIndex=e,this.getResult())),A.messageBus.rpcService("setSearchData",({value:t,valueEn:e})=>this.searchValue!=t?(this.searchValue==""&&(this.oldData=this.passFilter),t==""?(this.passFilter=this.oldData,this.oldData=null):this.passFilter=this.filterData(t,e),this.startIndex=0,this.endIndex=300,this.searchValue=t,this.passFilter.length==0?[]:this.getResult()):!1)}filterData(t,e){var a;let r=this.oldData,i=this.configForFindObj,n=[],s=Object.keys(i).filter(l=>l!="getAllItem"&&l!="is");t=t.replace(/\./g,"\\.").replace(/\(/g,"\\(").replace(/\)/g,"\\)").replace(/-/g,"\\-").replace(/\?/g,"\\?").replace(/\*/g,"\\*").replace(/\+/g,"\\+");for(let l=0;l<r.length;l++){let c=r[l],h=this.getObj(c,s);for(let u of s){let d=(a=this._inputType[u])!=null&&a.translate?e:t,p=new RegExp(d,"im");if(h[u]&&p.test(h[u])){n.push(c);break}}}return n}get pcbNames(){return this._pcbNames}set pcbNames(t){this._pcbNames=t,this._inputType=this.getInputType(t)}getInputType(t){return{All:{type:"textInput",translate:!0},Layer:{type:"select",translate:!0},"Start Layer":{type:"select",translate:!0},"End Layer":{type:"select",translate:!0},Designator:{type:"textInput",translate:!1},Footprint:{type:"textInput",translate:!1},Device:{type:"textInput",translate:!1},ID:{type:"textInput",translate:!1},globalIndex:{type:"textInput",translate:!1},"Unique ID":{type:"textInput",translate:!1},"3D Model":{type:"textInput",translate:!1},"Group ID":{type:"textInput",translate:!1},"Channel ID":{type:"textInput",translate:!1},Rotation:{type:"textInputWithNumber",translate:!1},Locked:{type:"select",translate:!0,value:this._yesOrNo},"Property Name":{type:"select",translate:!0,value:this.allPropertyNameShow()},Text:{type:"textInput",translate:!1},"Property Value":{type:"textInput",translate:!1},Mirror:{type:"select",translate:!0,value:this._yesOrNo},Inverted:{type:"select",translate:!0,value:this._yesOrNo},"Inverted Expansion":{type:"textInputWithUnit",translate:!1},"Font Family":{type:"select",translate:!0,value:this.getFontFamilyOption()},"Line Width":{type:"textInputWithUnit",translate:!1},Height:{type:"textInputWithUnit",translate:!1},Radius:{type:"textInputWithUnit",translate:!1},"Corner Radius Ratio":{type:"textInputWithNumber",translate:!1},"Corner Radius":{type:"textInputWithUnit",translate:!1},Origin:{type:"select",translate:!0,value:this._origin},Number:{type:"textInput",translate:!1},Net:{type:"select",translate:!1,value:this.allNet(),clearBtn:!0},Size:{type:"select",translate:!0,value:["General","Custom"]},Shape:{type:"select",translate:!0,value:["Rectangle","Round","Polygon"]},Width:{type:"textInputWithUnit",translate:!1},Diameter:{type:"textInputWithUnit",translate:!1},"Hole Shape":{type:"select",translate:!0,value:["Round","Slot"]},"Hole Diameter":{type:"textInputWithUnit",translate:!1},"Hole Width":{type:"textInputWithUnit",translate:!1},"Hole Length":{type:"textInputWithUnit",translate:!1},"Hole Rotation":{type:"textInputWithNumber",translate:!1},Plated:{type:"select",translate:!0,value:this._yesOrNo},"TopLayer Solder Mask Expansion":{type:"textInputWithUnit",translate:!1},"BottomLayer Solder Mask Expansion":{type:"textInputWithUnit",translate:!1},"Paste Mask Expansion":{type:"textInputWithUnit",translate:!1},"Type.attr":{type:"select",translate:!0},Belong:{type:"select",translate:!0},"Via Type":{type:"select",translate:!0,value:["Through Via","Blind Via"]},Length:{type:"textInputWithUnit",translate:!1},"Via Outside Diameter":{type:"textInputWithUnit",translate:!1},"Via Inside Diameter":{type:"textInputWithUnit",translate:!1},Name:{type:"textInput",translate:!1},"Fill Style":{type:"select",translate:!0,value:["Solid","Grid 45\xB0","Grid 90\xB0"]},"Grid Line Width":{type:"textInputWithUnit",translate:!1},"Grid Line Spacing":{type:"textInputWithUnit",translate:!1},"Keep Island":{type:"select",translate:!0,value:this._yesOrNo},"Improve Fabrication":{type:"select",translate:!0,value:this._yesOrNo},Precision:{type:"textInputWithNumber",translate:!1},"Dimension Type":{type:"select",translate:!0,value:["Length","Angle","Radius"]},Unit:{type:"select",translate:!1,value:["mm","cm","mil","inch"]},"Overall height of shell":{type:"textInputWithUnit",translate:!1},"PCB Height From The Bottom Surface of Shell":{type:"textInputWithUnit",translate:!1},"Height of lower shell":{type:"textInputWithUnit",translate:!1},"Shell thickness":{type:"textInputWithUnit",translate:!1},"Group Name":{type:"textInput",translate:!1},"Reuse Block":{type:"select",translate:!1,value:this.reuseBlocks(t),clearBtn:!0},"Screw specifications":{type:"select",translate:!0,value:["M2","M3","M4","M5","M6","Custom"]},"3DShell.screwHoleDiameter":{type:"textInputWithUnit",translate:!1},"3DShell.screwThickness":{type:"textInputWithUnit",translate:!1},"Need Stiffener":{type:"select",translate:!0,value:this._yesOrNo},"Top Width of Stiffener":{type:"textInputWithUnit",translate:!1},"Bottom Width of Stiffener":{type:"textInputWithUnit",translate:!1},"Stiffener Height":{type:"textInputWithUnit",translate:!1},"Stiffener Thickness":{type:"textInputWithUnit",translate:!1},"Need Counterbore":{type:"select",translate:!0,value:this._yesOrNo},"Counterbore Height":{type:"textInputWithUnit",translate:!1},"Counterbore Diameter":{type:"textInputWithUnit",translate:!1},Baseline:{type:"textInput",translate:!1},"Slot depth":{type:"textInputWithUnit",translate:!1},"Stretch Length":{type:"textInputWithUnit",translate:!1},"Add into BOM":{type:"select",translate:!0,value:this._yesOrNo},"Silk Screen Color":{type:"textInput",translate:!1},Material:{type:"select",translate:!0,i18nContext:"FPCStiffenerAttr"},Model:{type:"select",translate:!0,i18nContext:"FPCStiffenerAttr"},Thickness:{type:"select",translate:!0,i18nContext:"FPCStiffenerAttr"},"Safe Spacing":{type:"select",translate:!1},"Other Spacing":{type:"select",translate:!1},Track:{type:"select",translate:!1},"Differential Pair":{type:"select",translate:!1},"Via Size":{type:"select",translate:!1},"Plane Zone":{type:"select",translate:!1},"Copper Zone":{type:"select",translate:!1},"Copper Bridge":{type:"select",translate:!0,value:this._yesOrNo},"Copper Bridge List":{type:"textInput",translate:!1}}}configForObjType(t){switch(t){case"Component":{let e={Layer:{attr:"layerId",value:[1,2],cannotDisplay:!0},Designator:{attr:"name"},Footprint:{attr:"footprintId"},Device:{attr:"device"},ID:{attr:"number",cannotDisplay:!0},globalIndex:{attr:"globalIndex",cannotDisplay:!0},Name:{attr:r=>r.getFormulaName()},"Unique ID":{attr:r=>r.attrKeyValue["Unique ID"]},"Add into BOM":{attr:r=>r.attrKeyValue["Add into BOM"]==="yes"},"3D Model":{attr:r=>r.attrKeyValue["3D Model Title"]},Rotation:{attr:"rotation",cannotDisplay:!0},Locked:{attr:"locked",cannotDisplay:!0},"Silk Screen Color":{attr:r=>r.silkColor!=null?r.silkColor.toString().toUpperCase():1===r.layerId?we.topSilkscreenColor.toString().toUpperCase():we.bottomSilkscreenColor.toString().toUpperCase(),cannotDisplay:!0},"Group Name":{attr:r=>kt.getGroupNameByGroupId(r.getGroupID()),cannotDisplay:!0},"Reuse Block":{attr:"reuseBlock",cannotDisplay:!0},"Group ID":{attr:r=>r.model.combinationID,cannotDisplay:!0},"Channel ID":{attr:r=>r.model.channelID,cannotDisplay:!0}};return this.allPropertyName().filter(r=>!["Footprint","Designator","Device","nameAlias","3D Model Title","3D Model Transform","Standardization Check"].includes(r)).forEach(r=>{e[r]||(e[`attrs-${r}`]={attr:r})}),{...e,is:r=>r instanceof Me,getAllItem:()=>Cr.getAllItem()}}case"Component Property":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Text")},"Property Value":{attr:"value"},Mirror:{attr:"mirror"},Inverted:{attr:"reverse"},"Inverted Expansion":{attr:"reverseExpansion"},"Font Family":{attr:"fontFamily"},"Line Width":{attr:"strokeWidth"},Height:{attr:"fontSize"},Rotation:{attr:"rotation"},Locked:{attr:"locked"},Origin:{attr:"origin"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Silk Screen Color":{attr:e=>e.silkColor!=null?e.silkColor.toString().toUpperCase():1===e.layerId?we.topSilkscreenColor.toString().toUpperCase():we.bottomSilkscreenColor.toString().toUpperCase()},is:e=>e instanceof fr&&!!e.key,getAllItem:()=>ti.getAllItem().filter(e=>!!e.key&&(e.showKey||e.showValue))};case"Pad":return{Layer:{attr:"layerId",value:[1,2,12]},Number:{attr:"num"},Net:{attr:"net"},ID:{attr:"number"},globalIndex:{attr:"globalIndex",cannotDisplay:!0},Size:{attr:"type"},Shape:{attr:e=>e instanceof fn?"POLYGON":this.mergeSimilarValue([e.topType,e.innerType,e.bottomType]),value:["Rectangle","Round","Oval","Polygon"]},Width:{attr:e=>this.mergeSimilarValue([e.topWidth,e.innerWidth,e.bottomWidth])},Height:{attr:e=>this.mergeSimilarValue([e.topHeight,e.innerHeight,e.bottomHeight])},Diameter:{attr:e=>this.mergeSimilarValue([e.topWidth,e.innerWidth,e.bottomWidth])},"Corner Radius Ratio":{attr:e=>this.mergeSimilarValue([e.topRatio*100,e.innerRatio*100,e.bottomRatio*100])},"Hole Shape":{attr:"holeShape"},"Hole Diameter":{attr:e=>e.holeRadius*2},"Hole Width":{attr:e=>e.holeRadius*2},"Hole Length":{attr:"holeLength"},"Hole Rotation":{attr:"holeRotation"},Plated:{attr:e=>e.layerId==12?e.plated:""},Rotation:{attr:"rotation"},Locked:{attr:"locked"},"TopLayer Solder Mask Expansion":{attr:"topSolderExpansion"},"BottomLayer Solder Mask Expansion":{attr:"bottomSolderExpansion"},"Paste Mask Expansion":{attr:"pasteExpansion"},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Le&&!e.isTestPad,getAllItem:()=>Kt.getAllItem().filter(e=>!e.isTestPad)};case"Test Point":return{Layer:{attr:"layerId",value:[1,2,12]},Number:{attr:"num"},Net:{attr:"net"},ID:{attr:"number"},globalIndex:{attr:"globalIndex",cannotDisplay:!0},Size:{attr:"type"},Shape:{attr:e=>e instanceof fn?"POLYGON":this.mergeSimilarValue([e.topType,e.innerType,e.bottomType]),value:["Rectangle","Round","Oval","Polygon"]},Width:{attr:e=>this.mergeSimilarValue([e.topWidth,e.innerWidth,e.bottomWidth])},Height:{attr:e=>this.mergeSimilarValue([e.topHeight,e.innerHeight,e.bottomHeight])},Diameter:{attr:e=>this.mergeSimilarValue([e.topWidth,e.innerWidth,e.bottomWidth])},"Corner Radius Ratio":{attr:e=>this.mergeSimilarValue([e.topRatio*100,e.innerRatio*100,e.bottomRatio*100])},"Hole Shape":{attr:"holeShape"},"Hole Diameter":{attr:e=>e.holeRadius*2},"Hole Width":{attr:e=>e.holeRadius*2},"Hole Length":{attr:"holeLength"},"Hole Rotation":{attr:"holeRotation"},Plated:{attr:e=>e.layerId==12?e.plated:""},Locked:{attr:"locked"},"TopLayer Solder Mask Expansion":{attr:"topSolderExpansion"},"BottomLayer Solder Mask Expansion":{attr:"bottomSolderExpansion"},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Le&&e.isTestPad,getAllItem:()=>Kt.getAllItem().filter(e=>e.isTestPad)};case"FPC Stiffener":return{Layer:{attr:"layerId",value:[58,59]},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Material:{attr:e=>{var i;let r=e.getComponent();if(r instanceof Du)return(i=Qu.getMaterialOptions().filter(s=>s.value===r.material)[0])==null?void 0:i.text},value:Qu.getMaterialOptions().map(e=>e.text)},Model:{attr:e=>{var i;let r=e.getComponent();if(r instanceof Du)return(i=Qu.getModelOptions().filter(s=>s.value===r.fpcModel)[0])==null?void 0:i.text},value:Qu.getModelOptions().map(e=>e.text)},Thickness:{attr:e=>{var i;let r=e.getComponent();if(r instanceof Du)return(i=Qu.getThicknessOptions(r).filter(s=>s.value===r.thickness)[0])==null?void 0:i.text},value:Qu.getMixThicknessOptions().map(e=>e.text)},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="FPC Stiffener"&&!(e.getParent()instanceof Me))};case"Text":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Text")},Text:{attr:"value"},Mirror:{attr:"mirror"},Inverted:{attr:"reverse"},"Inverted Expansion":{attr:"reverseExpansion"},"Font Family":{attr:"fontFamily"},"Line Width":{attr:"strokeWidth"},Height:{attr:"fontSize"},Rotation:{attr:"rotation"},Locked:{attr:"locked"},Origin:{attr:"origin"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof fr&&!e.key&&!e.getParent(),getAllItem:()=>ti.getAllItem().filter(e=>!e.key&&!e.getParent())};case"Track":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Signal")},Width:{attr:"width"},Length:{attr:"length"},Net:{attr:"net"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Locked:{attr:"locked"},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Ue,getAllItem:()=>pr.getAllItem()};case"Via":return{"Via Type":{attr:"type"},"Type.attr":{attr:"name",value:this.getAllBlindVia().ruleNames},"Start Layer":{attr:"startLayer",value:this.getAllBlindVia().startLayers},"End Layer":{attr:"endLayer",value:this.getAllBlindVia().endLayers},Net:{attr:"net"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Via Outside Diameter":{attr:e=>e.radius*2},"Via Inside Diameter":{attr:e=>e.holeRadius*2},Locked:{attr:"locked"},"TopLayer Solder Mask Expansion":{attr:"topExpansion"},"BottomLayer Solder Mask Expansion":{attr:"bottomExpansion"},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Ge,getAllItem:()=>Hr.getAllItem()};case"Suture Via":return{"Via Type":{attr:"type"},"Type.attr":{attr:"name",value:this.getAllBlindVia().ruleNames},"Start Layer":{attr:"startLayer",value:be.getAllCopperLayerIds()},"End Layer":{attr:"endLayer",value:be.getAllCopperLayerIds()},Net:{attr:"net"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Via Outside Diameter":{attr:e=>e.radius*2},"Via Inside Diameter":{attr:e=>e.holeRadius*2},Locked:{attr:"locked"},"TopLayer Solder Mask Expansion":{attr:"topExpansion"},"BottomLayer Solder Mask Expansion":{attr:"bottomExpansion"},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Ge&&e.isSuture,getAllItem:()=>Hr.getAllItem().filter(e=>e.isSuture)};case"Board Outline":return{"Line Width":{attr:"strokeWidth"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Board Outline")};case"Slot Region":return{"Line Width":{attr:"strokeWidth"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Slot Region")};case"Copper Region":return{Name:{attr:e=>e.component.name},Layer:{attr:"layerId",value:this.getAllowedLayers("Signal")},"Line Width":{attr:"strokeWidth"},Net:{attr:"net"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Fill Style":{attr:e=>e.component.style},"Grid Line Width":{attr:e=>e.component.gridLineWidth},"Grid Line Spacing":{attr:e=>e.component.clearance},"Keep Island":{attr:e=>e.component.keepIsland},"Improve Fabrication":{attr:e=>e.component.optimization},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Copper Region")};case"Fill Region":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Fill Region")},"Line Width":{attr:"strokeWidth"},Net:{attr:"net"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},"Copper Bridge":{attr:e=>{var r;return(r=e.component)==null?void 0:r.isBridgingCopper}},"Copper Bridge List":{attr:e=>{var r;return(r=e.component)==null?void 0:r.networkList}},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Fill Region"&&!(e.getParent()&&e.getParent()instanceof Me))};case"Prohibited Region":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Fill Region")},"Line Width":{attr:"strokeWidth"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Prohibited Region")};case"Constraint Region":return{Name:{attr:e=>e.component.name},Layer:{attr:"layerId",value:this.getAllowedLayers("Constraint Region")},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},"Corner Radius":{attr:e=>e.cornerRadius||0},"Safe Spacing":{attr:e=>{let r=Db.getRegion(e.globalIndex);return r?r.safeClearance:null},value:Array.from(Db.getAllSafeSpacing()).map(e=>e.name)},"Other Spacing":{attr:e=>{let r=Db.getRegion(e.globalIndex);return r?r.otherClearance:null},value:Array.from(Db.getAllOtherSpacing()).map(e=>e.name)},"Creepage Distance":{attr:e=>{let r=Db.getRegion(e.globalIndex);return r?r.creepageClearance:null},value:Array.from(Db.getAllCreepageSpacing()).map(e=>e.name)},Track:{attr:e=>{let r=Db.getRegion(e.globalIndex);return r?r.track:null},value:Array.from(Db.getAllTrackPhysics()).map(e=>e.name)},"Differential Pair":{attr:e=>{let r=Db.getRegion(e.globalIndex);return r?r.diff:null},value:Array.from(Db.getAllDifferentialPhysics()).map(e=>e.name)},"Via Size":{attr:e=>{let r=Db.getRegion(e.globalIndex);return r?r.radius:null},value:Array.from(Db.getAllRadiusPhysics()).map(e=>e.name)},"Copper Zone":{attr:e=>{let r=Db.getRegion(e.globalIndex);return r?r.copperPlane:null},value:Array.from(Db.getAllCopperPlane()).map(e=>e.name)},"Plane Zone":{attr:e=>{let r=Db.getRegion(e.globalIndex);return r?r.innerPlane:null},value:Array.from(Db.getAllInnerPlane()).map(e=>e.name)},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Constraint Region")};case"Line":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Line")},"Line Width":{attr:"strokeWidth"},Net:{attr:"net"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Line"&&!(e.getParent()&&e.getParent()instanceof Me))};case"Dimension":return{Layer:{attr:"layerId",value:[13,3,4]},Unit:{attr:"unit"},"Line Width":{attr:"width"},Height:{attr:"height"},Precision:{attr:"precision"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof ca||e instanceof ol||e instanceof xa,getAllItem(){return[].concat(Go.getAllItem(),is.getAllItem(),Uo.getAllItem())}};case"Image":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Text")},Mirror:{attr:"mirror"},Rotation:{attr:"rotation"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Yn,getAllItem:()=>Ln.getAllItem()};case"Colorful Image":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Text")},Mirror:{attr:"mirror"},Rotation:{attr:"rotation"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Rs,getAllItem:()=>_o.getAllItem()};case"Group":return{"Group Name":{attr:e=>e.model.name,cannotDisplay:!0},is:e=>e instanceof Ph,getAllItem:()=>kt.getAllItem()};case"3D Shell - Outline":return{"Type.attr":{attr:e=>e.getComponent().getShowType(),value:["Push cover","Upper and lower shell"]},Layer:{attr:"layerId",value:[53]},"Overall height of shell":{attr:e=>e.getComponent().shellHeight},"PCB Height From The Bottom Surface of Shell":{attr:e=>e.getComponent().substrateHeight},"Height of lower shell":{attr:e=>e.getComponent().botShellHeight},"Shell thickness":{attr:e=>e.getComponent().shellThickness},"Line Width":{attr:"strokeWidth"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="3D Shell - Outline"&&!(e.getParent()&&e.getParent()instanceof Me))};case"3D Shell - Screw Pillar":return{"Screw specifications":{attr:e=>e.getComponent().specification},Layer:{attr:"layerId",value:[54,55]},Height:{attr:e=>e.getComponent().height},"3DShell.screwHoleDiameter":{attr:e=>e.getComponent().holeDiameter},"3DShell.screwThickness":{attr:e=>e.getComponent().holeDiameter},"Need Stiffener":{attr:e=>e.getComponent().needStiffener},"Top Width of Stiffener":{attr:e=>{let r=e.getComponent();return r.stiffenerProps?r.stiffenerProps.topWidth:0}},"Bottom Width of Stiffener":{attr:e=>{let r=e.getComponent();return r.stiffenerProps?r.stiffenerProps.bottomWidth:0}},"Stiffener Height":{attr:e=>{let r=e.getComponent();return r.stiffenerProps?r.stiffenerProps.height:0}},"Stiffener Thickness":{attr:e=>{let r=e.getComponent();return r.stiffenerProps?r.stiffenerProps.stiffThickness:0}},"Need Counterbore":{attr:e=>e.getComponent().needCounterbore},"Counterbore Height":{attr:e=>{let r=e.getComponent();return r.counterboreProps?r.counterboreProps.height:0}},"Counterbore Diameter":{attr:e=>{let r=e.getComponent();return r.counterboreProps?r.counterboreProps.diameter:0}},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="3D Shell - Screw Pillar"&&!(e.getParent()&&e.getParent()instanceof Me),[Sr])};case"3D Shell - Side Datum Line":return{Layer:{attr:"layerId",value:[54,55]},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="3D Shell - Side Datum Line"&&!(e.getParent()&&e.getParent()instanceof Me),[ct])};case"3D Shell - Slot Region":return{"Type.attr":{attr:e=>e.getComponent().getShowType(),value:["Top/Bottom Slot Region","Side Slot Region"]},Layer:{attr:"layerId",value:[54,55]},Baseline:{attr:e=>e.type==="3D Shell - Top/Bottom Entity"?null:e.getComponent().lineId},"Slot depth":{attr:e=>e.getComponent().slotDepth},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>["3D Shell - Side Slot Region","3D Shell - Top Slot Region"].includes(e.type)&&!(e.getParent()&&e.getParent()instanceof Me))};case"3D Shell - Entity":return{"Type.attr":{attr:e=>e.getComponent().type=="side"?"Side Entity":"Top/Bottom Entity",value:["Top/Bottom Entity","Side Entity"]},Layer:{attr:"layerId",value:[54,55]},Baseline:{attr:e=>e.type==="3D Shell - Top/Bottom Entity"?null:e.getComponent().lineId},"Stretch Length":{attr:e=>e.getComponent().stretchLength},Belong:{attr:e=>{if(e.type==="3D Shell - Top/Bottom Entity")return null;let r=e.getComponent();return wl.getBelongOptions()[r.belong].text},value:wl.getBelongOptions().map(e=>e.text)},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>kt.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>["3D Shell - Side Entity","3D Shell - Top/Bottom Entity"].includes(e.type)&&!(e.getParent()&&e.getParent()instanceof Me))}}}getShape(t){return t instanceof Sr||t.getParent()instanceof Sr?"Round":t instanceof nr||t.getParent()instanceof nr?"Rectangle":"Polygon"}getAllAttrConfig(t,e){if(t!=3&&t!=4)return;let r={},i=e&&e.plainObj;this._attrsForDocType[t].forEach(s=>{let a=Ls(this.configForObjType(s));t==4&&(delete a.Net,delete a["Copper Bridge"],delete a["Copper Bridge List"]),i&&(delete a.getAllItem,delete a.is);for(let l in a)i&&typeof a[l].attr=="function"&&delete a[l].attr,a[l].value&&(a[l].value=this.convertCanvasValueToShowStrOrStrArr(l,a[l].value));r[s]=a});let n={};for(let s in this._inputType)n[s]=this._inputType[s],this._inputType[s].value=="function"&&(n[s].value=this._inputType[s].value());return{attrConfig:r,inputType:n,unit:x.getInstance().unit}}getAllItemAndIsMethodOf2DLine(t,e=[Sr,ct,nr]){return{is:r=>e.some(i=>r instanceof i)&&t(r),getAllItem:()=>[].concat(e.includes(ct)?pt.getAllItem():[],e.includes(nr)?Xt.getAllItem():[],e.includes(Sr)?Zt.getAllItem():[]).filter(t)}}mergeSimilarValue(t){return Array.from(new Set(t.filter(e=>!!e)))}allPropertyName(){let t=[];return Cr.getAllItem().forEach(r=>Array.prototype.push.apply(t,Object.keys(r.attrKeyValue))),this.mergeSimilarValue(t)}getFontFamilyOption(){let t=new Array;for(let e in ce.fontConfig.info){let r=ce.fontConfig.info[e];t.push(r.family)}return t}allPropertyNameShow(){let t=ti.getAllItem().filter(e=>!!e.key&&(e.showKey||e.showValue)).map(e=>e.key);return this.mergeSimilarValue(t)}getAllBlindVia(){let t=[],e=new Set([1,2]),r=new Set([1,2]);for(let i of te.getInstance().getAllBlindPhysics())for(let n of i.data)t.push(n.name),e.add(n.startLayer),r.add(n.endLayer);return{ruleNames:t,startLayers:Array.from(e),endLayers:Array.from(r)}}getAllowedLayers(t){switch(t){case"Text":return be.getAllLayer().filter(e=>e.visible?!["TOP_SOLDER_MASK","BOT_SOLDER_MASK","OUTLINE","MULTI","PLANE","HOLE"].includes(e.type):!1).map(e=>e.layerID);case"Signal":return be.getAllSignalLayer().filter(e=>e.visible).map(e=>e.layerID);case"Fill Region":return be.getAllLayer().filter(e=>e.visible?!["OUTLINE","MULTI","PLANE","HOLE"].includes(e.type):!1).map(e=>e.layerID);case"Constraint Region":{let e=new Array,r=be.getAllLayer();for(let i of r)(gr(i.layerID)||i.config&&i.isSignalLayer()||i.config&&i.isPlaneLayer())&&e.push(i.layerID);return e}case"Line":return be.getAllLayer().filter(e=>e.visible?!["MULTI","PLANE","HOLE"].includes(e.type):!1).map(e=>e.layerID);default:throw Error("Wrong forType")}}allNet(){return Pd(ze.getAllNets())}reuseBlocks(t){let e=Cr.getAllItem().map(i=>i.reuseBlock),r=Array.from(new Set(e.concat(t))).filter(i=>!!i);return Pd(r)}convertCanvasValueToShowStrOrStrArr(t,e){return Array.isArray(e)?e.map(r=>this.convertCanvasValueToShowStr(t,r)):this.convertCanvasValueToShowStr(t,e)}convertCanvasValueToShowStr(t,e){if(e==null||typeof e=="number"&&isNaN(e))return"";let r=e;switch(t){case"Start Layer":case"End Layer":case"Layer":r=be.getLayer(e).name;break;case"Size":r=e==1?"General":"Custom";break;case"Via Type":r=e==1?"Blind Via":"Through Via";break;case"Rotation":case"Hole Rotation":r=BE(Wte(e/Math.PI*180),{decimalPlacesShow:1});break;case"Origin":r=this._origin[e-1];break;case"Fill Style":r=e=="45grid"?"Grid 45\xB0":e=="90grid"?"Grid 90\xB0":"Solid";break;case"Shape":case"Hole Shape":switch(e){case"RECT":r="Rectangle";break;case"ELLIPSE":r="Round";break;case"OVAL":r="Oval";break;case"POLYGON":r="Polygon";break;case"SLOT":r="Slot";break}break;default:this._inputType[t]&&(this._inputType[t].type==="textInputWithUnit"?r=la(e,x.getInstance().unit):this._inputType[t].value==this._yesOrNo&&(r=e===!0?"Yes":e===!1?"No":""))}return String(r)}removeAttrPrefix(t){return t.startsWith("attrs-")?t.split("attrs-")[1]:t}getElementAttrValue(t,e,r){let i,n=r[e].attr;return typeof n=="function"?i=n(t):e.startsWith("attrs-")?i=t.attrKeyValue[n]:n==="number"?i=t.getParent()?`${ur}${t.getParent().number}${ur}${t[n]}`:`${ur}${t[n]}`:i=t[n],i}matchDisplayCond(t,e,r){var s,a;let i=(s=t.attrKeyText[e])==null?void 0:s.showKey,n=(a=t.attrKeyText[e])==null?void 0:a.showValue;switch(r){case"onlyKey":return i&&!n;case"onlyValue":return!i&&n;case"both":return i&&n;case"none":return!i&&!n;default:return!0}}matchConditionForOneAttr(t,e,r,i,n,s){var u;if(r===void 0)return!1;let a=t=="Copper Bridge List",l=s&&((u=this._inputType[t])!=null&&u.translate)&&i.attrValueEn||i.attrValue;if((l==null||l==="")&&i.mode=="contain")return!0;l=l==null?"":l.toString();let c=Array.isArray(r)?r:[r],h=!1;for(let d=0;d<c.length;d++){let p=c[d],m=this.convertCanvasValueToShowStr(t,p),g=n.includes("caseSensitive");if(i.mode==="equal"){let T;if(a){let I=new Set(l.split(" ")),C=new Set(c);T=I.size===C.size&&[...I].every(E=>C.has(E))}else T=g?m===l:m.toLowerCase()===l.toLowerCase();l!==""&&T&&t.startsWith("attrs-")&&e.add(t),h=T||h;continue}if(i.mode==="contain"&&a){h=l.split(" ").every(I=>c.some(C=>C.includes(I))),h&&t.startsWith("attrs-")&&e.add(t);continue}let y=n.includes("wildChar");if(!n.includes("expression")){let T=y?/[\/\\+^$|\-()\[\]{}!]/g:/[\/*\\+?^$|\-()\[\]{}!]/g;l=l.replace(T,I=>"\\"+I)}y&&(l=l.replace(/\*/g,".*").replace(/\?/g,"."));try{new RegExp(l)}catch{this.errorMsg="Regular Expression Illegal!";return}let P=new RegExp(l,g?"":"i").test(m);l!==""&&P&&t.startsWith("attrs-")&&e.add(t),h=P||h}return h}matchEveryConditions(t,e,r,i,n,s){let a=Object.keys(i).filter(l=>l!="getAllItem"&&l!="is");return t.every(l=>{let c=l.attrName=="All",h=c?a:[l.attrName],u=!1;for(let d=0;d<h.length;d++){let p=h[d];if(!(s=="Component"&&!this.matchDisplayCond(e,this.removeAttrPrefix(p),l.attrDisplay)))if(l.mode=="any")u=!0;else{let m=this.getElementAttrValue(e,p,i);u=this.matchConditionForOneAttr(p,r,m,l,n,c)||u}}return u})}objMatched(t,e,r,i,n="currentPage"){this.errorMsg=null;let s="findObjMatched-time";pn(s),this.startIndex=0,this.endIndex=300,this.searchValue="";let a=new Set;this.configForFindObj=this.getAllAttrConfig(x.getInstance().doctype).attrConfig[t];let l;n=="selected"&&this.configForFindObj.is?l=Ve.getSelects().filter(m=>this.configForFindObj.is(m)):l=this.configForFindObj.getAllItem();let c=l.filter(m=>t=="Component Property"&&i!="any"&&m.key!=i?!1:this.matchEveryConditions(r,m,a,this.configForFindObj,e,t));if(this.objType=t,this.passFilter=c,this.errorMsg){A.publish("showPcbAlertMsg",this.errorMsg,$());return}if(c.length==0)return{valueArr:[],titleArr:[]};let h=this.getResult(),u=Object.keys(this.configForFindObj).filter(m=>m!="getAllItem"&&m!="is"),d=new Set([t].concat(u.filter(m=>!m.startsWith("attrs-")||a.has(m)).map(m=>this.removeAttrPrefix(m)))),p=c.map(m=>m.globalIndex);return Bi(s),{valueArr:h,titleArr:Array.from(d),needTranslate:this._inputType,allIds:p}}getResult(){let t=this.passFilter,e=this.objType,r=this.configForFindObj;if(!t||!t.length||!e)throw Error("\u6CA1\u6709\u67E5\u627E\u7ED3\u679C");let i=new Array(t.length).fill(null),n=Object.keys(r).filter(s=>s!="getAllItem"&&s!="is");for(let s=this.startIndex;s<Math.min(this.endIndex,t.length);s++){let a=t[s];i[s]=this.getObj(a,n)}return i}getObj(t,e){let r=this.objType,i=this.configForFindObj,n={};if(t instanceof Me)n[r]=t.name;else if(t instanceof Ph)n[r]=t.globalIndex;else if(t instanceof Le&&t.getParent()){let s=t.getParent();s instanceof Me&&(n[r]=`${s.name}: ${t.num}`)}else n[r]=`${ur}${t.number}`;for(let s of e)n[this.removeAttrPrefix(s)]=this.convertCanvasValueToShowStrOrStrArr(s,this.getElementAttrValue(t,s,i));return n}};var uge=class{static getActiveTab(){var t;return(t=$().UI)==null?void 0:t.tabBar.getActiveTab()}static getTabDocType(t){var e;return(e=$().UI)==null?void 0:e.tabBar.getTabDocType(t)}};uge.handlers={};var cZe="|";var dge=class o{constructor(){this._layerId=1005;this._maskMap={};this._maskShapeMap={};this._nextIdIndex=0;this._defaultStyle=this.styleReviseByDefault(),A.messageBus.subscribe("pcb/addRectMasks",t=>{let{masks:e,tabId:r,adaptAll:i}=t||{},n=x.getInstance();[23].includes(n.doctype)||(r?n.tabId!=r:!n.isactive)||(e.forEach(s=>{this.addMask(s)}),i&&A.publish("adaptAll",{tabId:r}))}),A.messageBus.subscribe("pcb/clearRectMasks",t=>{let{tabId:e}=t||{},r=x.getInstance();[23].includes(r.doctype)||(e?r.tabId!=e:!r.isactive)||this.clear()}),A.messageBus.subscribe("pcb/positioningMark",t=>{let{id:e,tabId:r}=t||{},i=t==null?void 0:t.opt,n=x.getInstance();[23].includes(n.doctype)||(r?n.tabId!=r:!n.isactive)||(r&&(i=Object.assign(i,{tabId:r})),this.positioningMark(e,i))}),A.messageBus.subscribe("pcb/updateMaskState",t=>{let{ids:e,tabId:r,state:i}=t||{},n=x.getInstance();if([23].includes(n.doctype)||(r?n.tabId!=r:!n.isactive))return;(Array.isArray(e)?e:[e]).forEach(a=>{let l=this.getMask(a);!l||l.state==i||(l.state=i,this.resetMaskState(l))})})}static getInstance(){return o._instance||(o._instance=new o),o._instance}autoId(){return"mask_"+this._nextIdIndex++}getMask(t){return this._maskMap[t]}getMaskShape(t){return this._maskShapeMap[t]}getBBoxes(t){if(Array.isArray(t))return t.map(r=>e(r));return[e(t)];function e(r){return new ut(r.minX,r.maxX,r.minY,r.maxY)}}styleColorRevise(t){return t&&(typeof t.strokeColor=="string"&&(t.strokeColor=ee.of3(t.strokeColor)),typeof t.highlightColor=="string"&&(t.highlightColor=ee.of3(t.highlightColor)),t)}isNoneBBox(t){return t.width()==0&&t.height()==0}styleReviseByDefault(t){let e=this._defaultStyle||{strokeColor:ee.WHITE,strokeWidth:.1,highlightColor:ee.WHITE};return t=Object.assign({},e,this.styleColorRevise(t)),t}addMask(t){(!t.id||this.getMaskShape(t.id))&&(t.id=this.autoId());let{id:e,bboxes:r,style:i}=t,n=this.getBBoxes(r),s=this.styleReviseByDefault(i),a=[],l=new er;return n.forEach(c=>{if(this.isNoneBBox(c))if(t.links){if(!t.links.some(p=>{let m=l.getItem(p);if(m&&(c=m.buildBBox(),c))return!0}))return}else return;let h=new Zp(cr(),"Line",this._layerId,c.UL(),c.width(),c.height(),0,0,"",s.strokeWidth,!1,null,null,c),u=new nr(h);a.push(u),this.refreshMask(u,t)}),this._maskShapeMap[e]=a.length==1?a[0]:a,e}resetMaskState(t){var i;let{id:e}=t,r=this.getMaskShape(e);return r?(e==((i=this._lastPositionMask)==null?void 0:i.id)&&(this._lastPositionMask=null),Array.isArray(r)?r.forEach(n=>{this.refreshMask(n,t)}):this.refreshMask(r,t),e):this.addMask(t)}refreshMask(t,e){let{id:r,state:i,style:n}=e,s=Object.assign({},this._defaultStyle,n);e.style=s,i==0?(t.color=s.strokeColor,t.strokeWidth=s.strokeWidth,t.visible()):i==1?t.hidden():i==2&&(s.highlightColor&&(t.color=s.highlightColor),t.strokeWidth=s.strokeWidth+.5,t.visible()),A.publish("updateFrame",""),this._maskMap[r]=e}positioningMark(t,e){let r=this.getMaskShape(t),i=this.getMask(t);if(!r||!i)return;e=Object.assign({adaptAll:!1,selectLink:!0},e);let{tabId:n,adaptAll:s,selectLink:a}=e,l=new _e;(Array.isArray(r)?r:[r]).forEach(u=>{l.ext1(u.buildBBox())}),l.valid()||this.getBBoxes(i.bboxes).forEach(u=>{l.ext1(u.bbox())});let c=l.build().center();if(Ve.highlight.cancelHighlightUnselect(),A.publish("clearSelect",{tabId:n}),this._lastPositionMask&&this._lastPositionMask.id!=t){let u=this.getMask(this._lastPositionMask.id);if(u){u.state=this._lastPositionMask.state;let d=this.getMaskShape(this._lastPositionMask.id);Array.isArray(d)?d.forEach(p=>{this.refreshMask(p,u)}):this.refreshMask(d,u)}}s&&A.publish("adaptAll",{tabId:n});let h=new Mt(c.x,c.y,0);if(Ni().setTarget(h),mc.show(c),mc.click(),clearTimeout(this._crossTimer),this._crossTimer=setTimeout(()=>{mc.remove(),A.publish("updateFrame","")},1e3),i.state==0&&(this._lastPositionMask=Ls(i),i.state=2,Array.isArray(r)?r.forEach(u=>{this.refreshMask(u,i)}):this.refreshMask(r,i)),a&&i.links){let u=new er,d=new Set;i.links.forEach(p=>{let m=u.getItem(p);m&&(d.add(m),m.click())}),d.size>0&&Ve.select(d)}A.publish("updateFrame","")}deleteMask(t){let e=this.getMaskShape(t),r=this.getMask(t);return!e||!r?!1:(Array.isArray(e)?e.forEach(i=>i.remove()):e.remove(),delete this._maskShapeMap[t],delete this._maskMap[t],A.publish("updateFrame",""),!0)}clear(){for(let t in this._maskShapeMap){let e=this._maskShapeMap[t];Array.isArray(e)?e.forEach(r=>r.remove()):e.remove(),delete this._maskShapeMap[t]}this._maskMap={},this._lastPositionMask=null,this._nextIdIndex=0,A.publish("updateFrame","")}};var pge=class{getBoardInfo(){let t=0,e=0,r=uu();if(r.length>0){let n=new _e;if(r.forEach(s=>{let a=s.getMathGraphics();n.ext1(a.bbox())}),n.valid()){let s=n.build1();t=s.width(),e=s.height()}}return`${Xe(t,null,"mil")}mil x ${Xe(e,null,"mil")}mil(${Xe(t,null,"mm")}mm x ${Xe(e,null,"mm")}mm)`}getLayerAndShape(){var h;let t=new Map,e=new Set,r=new Set;this.setLayerMapShapes(An.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes($n.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(Tn.getInstance().getAllItem(),t,e,r),this.setProfile2LayerMapShapes(zi.getInstance().getAllItem(),t,e,r),this.setProfile2LayerMapShapes(rn.getInstance().getAllItem(),t,e,r),this.setProfile2LayerMapShapes(Mi.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(mo.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(Qs.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(xs.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(Wo.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(Ho.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(Ka.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(Sl.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(Za.getInstance().getAllItem(),t,e,r);let i=Array.from(e),n=Array.from(r),s=new Array,a=new Map;for(let u of n){let d=0;for(let p of i){let m=((h=t.get(u))==null?void 0:h.get(p))||0;s.push(m),d+=m,a.set(p,(a.get(p)||0)+m)}s.push(d)}let l=0;for(let u of i){let d=a.get(u)||0;l+=d,s.push(d)}s.push(l),i.push("Total");let c=n.map(u=>{var d;return((d=$e.getInstance().getLayer(u))==null?void 0:d.name)||""});return c.push("Total"),{rowKeys:i,colKeys:c,data:s}}setLayerMapShapes(t,e,r,i){let n=null,s=0;for(let a of t)n=e.get(a.layerId),i.add(a.layerId),n==null&&(n=new Map,e.set(a.layerId,n)),r.add(a.modelType),s=(n.get(a.modelType)||0)+1,n.set(a.modelType,s)}setProfile2LayerMapShapes(t,e,r,i){let n=null,s=0;for(let a of t)n=e.get(a.layerId),i.add(a.layerId),n==null&&(n=new Map,e.set(a.layerId,n)),r.add(a.type),s=(n.get(a.type)||0)+1,n.set(a.type,s)}getNetInfo(){var s,a;let t=te.getInstance().getAllNets(),e=new Array,r=new Array,i=new Array,n=new Array;for(let l of t){let c=l.name,h=((s=l.color)==null?void 0:s.toString())||"default",u=((a=ze.getItem(c))==null?void 0:a.size)||0;n.push({net:c,color:h,count:u})}n.sort((l,c)=>c.count-l.count);for(let{net:l,color:c,count:h}of n)e.push(l),r.push(c),i.push(h);return{nets:e,colors:r,counts:i}}getWireMode(){switch(tr.getInstance().mode){case"WIRING_MODE_PUSHAWAY":return"Push";case"WIRING_MODE_SURROUND":return"Around";case"WIRING_MODE_SURROUND_AND_PUSHAWAY":return"Around & Push";case"WIRING_MODE_OBSTRUCT":return"Block";case"WIRING_MODE_IGNORE":return"Ignore"}return""}getMoveComponentMode(){switch(ce.pcbConfig.moveComponent){case"push":return"Push";case"block":return"Block";case"ignore":return"Ignore"}return""}getRealTimeInfo(){let t=ah.switch,e=ce.pcbConfig.addTeardropAutomatically,r=ce.pcbConfig.isPlaceViasAutoShove,i=ce.pcbConfig.coreRenderingEngine,n=ce.pcbConfig.graphicEffectMode=="speedFirst"?"Speed Priority":"Quality Priority",s=this.getMoveComponentMode(),a=ce.pcbConfig.realTimeUpdateUnusedLayers,l=this.getWireMode(),h=ai.getInstance().getDefaultPanelize();return{"Real-Time DRC":t,"Add Teardrop Automatically":e,"Move/Place/Paste Via Follows Routing Mode":r,"Rendering Engine":i,"Display Effect":n,"Move Component":s,"Remove Unused Pad":a,"Routing Mode":l}}getRenderInfo(){try{return mf.scene.getInfo()}catch{return{engine:"fail",fps:0,ptNum:0}}}getResult(){return{BoardSize:this.getBoardInfo(),LayerAndShape:this.getLayerAndShape(),net:this.getNetInfo(),realTimeInfo:this.getRealTimeInfo(),render:this.getRenderInfo()}}};function hZe(o){return window.localStorage.getItem(o)}var fge=class{bindListener(t){}};var mge=class extends fge{bindListener(t){let e=new ow(new ob);e.setProxy(new dU(t),!1),t.setHandle(e)}};var gge=class{bindListener(t){}};var yge=class extends f8{constructor(e){super();this.proxy=null;this.device=e}setProxy(e){this.proxy=e}async onDocDetail(e,r,i){let n=new m8;n.onDocDetail(e,r,i);let s=new Map,a=new Map,l=new Map,c=new Set;for(let u in this.device.attrMap){let d=this.device.attrMap[u],p=n.attr[u];p==null?l.set(u,d):d!=p?a.set(u,p):c.add(u)}for(let u in n.attr)c.has(u)||l.has(u)||a.has(u)||s.set(u,n.attr[u]);for(let u of this.device.getComponents()){let d=u.getAttr(),p=v8(u);for(let[m,g]of s){let y=d[m],b=!0;y!=null?Cp(y,u)?b=!1:(y.value=g,this.addModel(y)):p[m]!=null&&(b=!1),b&&u.modifyATTRMap(m,g)}for(let[m,g]of a){let y=d[m],b=!0;y!=null?Cp(y,u)?b=!1:(y.value=g,this.addModel(y)):p[m]!=null&&(b=!1),b&&u.modifyATTRMap(m,g)}for(let[m,g]of l){let y=d[m],b=!0;if(y!=null)if(Cp(y,u))b=!1;else{let T=Wi.getInstance().getItem(u.footprintUUID).getValue(m);T!=null&&(y.value=T,this.addModel(y),b=!1,u.modifyATTRMap(m,T))}else p[m]!=null&&(b=!1);b&&u.deleteATTRMap(m)}}let h=this.device.footprintUUID!=n.footprintUUID?this.getTemplate4Device():[];this.device.sycn(n),await this.update(h,n.footprintUUID)}getTemplate4Device(){let e=new Array;for(let r of this.device.getComponents())r.footprintUUID==this.device.footprintUUID&&!Cp(r.idShape,r)&&e.push(r);return e}async update(e,r){for(let i of e)await this.proxy.replaceFootprint(i,r)}addModel(e){e!=null&&this.proxy!=null&&this.proxy.addModel(e,null)}deleteModel(e){e!=null&&this.proxy!=null&&this.proxy.deleteModel(e)}};var bge=class extends X3{build(){for(let t of this.models){let e=$c(t);e instanceof fr&&vp.addText(e),e.refreshRender(),ie.publish("hasModifyPcbItem",e)}km.historyFlushService(),ie.publish("updateRtree",""),ie.publish("flushSelectingInfo",""),this.clear()}getLayer(t){return null}addNet(t){}getLayerPhy(t){}getNetModel(t){}getCombination(t){}addCombination(t){}deleteModel(t){super.deleteModel(t),q3(t),km.historyFlushService()}preAdjust(t){let e=Cr.getItem(t.globalIndex);new oP(e,"modify"),Te.dispatch(e,"delete"),ie.publish("hasModifyPcbItem",e)}async replaceFootprint(t,e){this.preAdjust(t);let i=new z1("2.0").save(t);this.deleteModel(t);let n=new Y1(i);await n.replaceFootprint(e);for(let s of n.items)ie.publish("hasModifyPcbItem",s);km.historyFlushService(),ie.publish("updateRtree",""),ie.publish("flushSelectingInfo","")}};var Pge=class extends gge{bindListener(t){let e=new yge(t);e.setProxy(new bge),t.setHandle(e)}};var Tge=class{constructor(){this.debugLines=[];this.debugLines2=[];this.debugArcs=[];this.debugArrows=[];this.debugLineOrArcs=[]}displayLines(t,e=ee.of3("#FFFF00")){for(let r=0;r<t.length;r++){let i=t[r],n=new eo(i,{color:e});n.display(),this.debugLines.push(n)}}clearLines(){for(let t=0;t<this.debugLines.length;t++)this.debugLines[t].remove();this.debugLines.length=0}displayPoints(t,e=ee.of3("#FFFF00")){for(let r=0;r<t.length-1;r++){let i=new M(t[r],t[r+1]),n=new eo(i,{color:e});n.display(),this.debugLines2.push(n)}if(t.length===1){let r=new eo(new M(t[0],t[0]),{color:e});r.display(),this.debugLines2.push(r)}}clearPoints(){for(let t=0;t<this.debugLines2.length;t++)this.debugLines2[t].remove();this.debugLines2.length=0}displayArc(t,e=ee.of3("#FFFF00")){let r=new eo(t,{color:e});r.display();let i=new eo(new M(t.start(),t.start()),{color:e}),n=new eo(new M(t.end(),t.end()),{color:e});i.display(),n.display(),this.debugArcs.push(i,n),this.debugArcs.push(r)}clearArcs(){for(let t=0;t<this.debugArcs.length;t++)this.debugArcs[t].remove();this.debugArcs.length=0}displayArrow(t,e,r=ee.of3("#FFFF00")){let i=new eo(new M(t,t.add(e)),{color:r});i.display(),this.debugArrows.push(i)}clearArrows(){for(let t=0;t<this.debugArrows.length;t++)this.debugArrows[t].remove();this.debugArrows.length=0}displayLineOrArc(t,e=ee.of3("#FFFF00")){let r=new eo(t,{color:e});r.display(),this.debugLineOrArcs.push(r)}displayPolyline(t,e=ee.of3("#FFFF00")){t.primitives.forEach(r=>{(r instanceof M||r instanceof q)&&this.displayLineOrArc(r,e)})}clearLineOrArcs(){for(let t=0;t<this.debugLineOrArcs.length;t++)this.debugLineOrArcs[t].remove();this.debugLineOrArcs.length=0}clear(){this.clearPoints(),this.clearArcs(),this.clearArrows(),this.clearLines(),this.clearLineOrArcs()}};var Ige=class{constructor(t,e){this.horizontal=new Array;this.vertical=new Array;this.distance=new Array;this.tool=new er;this.id=t,this.restriction=e}canMove(t){let e=this.tool.getItem(t);return e!=null&&!e.locked}moveItemInAllowedDirection(t,e,r,i,n){if(i[t])return;r=t=="x"?new S(r.x,0):new S(0,r.y);let s=Ae.translate(r.x,r.y,0);switch(this.restriction.condition){case 0:s=Ae.translate(r.x,0,0),r=new S(r.x,0);break;case 1:s=Ae.translate(0,r.y,0),r=new S(0,r.y);break;case 2:break}let a=this.restriction.start==this.id?this.restriction.end:this.restriction.start;if(n==a)return;if(!this.canMove(a)){i[t]=!0;return}if(e[t].has(a))return;e[t].add(a);let l=this.tool.getItem(a);Vs.addCommand(l,"modify"),l.transform(s),this.horizontal.forEach(c=>{c.moveItemInAllowedDirection(t,e,r,i)}),this.vertical.forEach(c=>{c.moveItemInAllowedDirection(t,e,r,i)}),this.distance.forEach(c=>{c.moveItemInAllowedDirection(t,e,r,i)})}};var Cge=class{constructor(){}get isMoving(){return this.gId!=null}move(t,e,r=!0,i=null,n=null){this.gId=t;let s={x:new Set([this.gId]),y:new Set([this.gId])},a={x:!1,y:!1},l=this.createTree();["x","y"].forEach(c=>{if(l[c].forEach(h=>{h.moveItemInAllowedDirection(c,s,e,a,i)}),a[c])s[c].clear();else{let h=Kt.getItem(this.gId);Vs.addCommand(h,"modify");let u=Ae.translate(c=="x"?e.x:0,c=="y"?e.y:0,0);h.transform(u)}}),s.x.size==0&&s.y.size==0&&r?A.publish("ui/toastMsg",{type:"warn",msg:"The associated pad has been locked"},$()):this.updateDimension(s,e,i,n),this.gId=null}updateDimension(t,e,r,i){if(!Object.keys(t).length)return;wh.getAllItem().forEach(a=>{let l=a.restriction;if(!l)return;let c=u(t,e,l.start),h=u(t,e,l.end);if(!c&&!h)return;if(c&&h&&c.equals1(h)){Vs.addCommand(a,"modify");let d=Ae.translate(c.x,c.y,0);a.transform(d)}else{if(c){l.id!==i&&Vs.addCommand(a,"modify");let d=Ae.translate(c.x,c.y,0);a.left=a.left.multiply4(d)}if(h){l.id!==i&&Vs.addCommand(a,"modify");let d=Ae.translate(h.x,h.y,0);a.right=a.right.multiply4(d)}}function u(d,p,m){let g=d.x.has(m),y=d.y.has(m);if(g&&y)return new S(p.x,p.y);if(g)return new S(p.x,0);if(y)return new S(0,p.y)}})}createTree(){return{x:this.createTreeInOneDirection("x"),y:this.createTreeInOneDirection("y")}}createTreeInOneDirection(t){let e=new Set,r=new Set,i=new Set([this.gId]),n={};for(;i.size>0;){let c=ZE.find(i);i.clear();for(let h in c)e.add(h);for(let h in c){let u=c[h];for(let d of u)if(l(d.condition)&&!r.has(d)){let p=new Ige(h,d),m=n[h];m==null&&(m=new Array,n[h]=m),m.push(p),e.has(d.start)||i.add(d.start),e.has(d.end)||i.add(d.end),r.add(d)}}}let s=n[this.gId]||[],a=new Set([this.gId]);return this.iters(a,n,s),s;function l(c){return t=="x"?c==2||c==0:c==2||c==1}}iters(t,e,r){for(let i of r){let n;if(i.restriction.start==i.id?n=i.restriction.end:i.restriction.end==i.id&&(n=i.restriction.start),n&&!t.has(n)){let s=e[n];if(t.add(n),s!=null){for(let a of s)switch(a.restriction.condition){case 0:i.horizontal.push(a);break;case 1:i.vertical.push(a);break;case 2:i.distance.push(a);break}this.iters(t,e,s)}}}}};async function Sge(o){return(await A.windowBridge.rpcCall("pro-ui/getWatermarkConfig",{watermarkType:o},$())).message}function Ege(o,t,e,r,i){if(!o||!t||!e||typeof i!="function")return;let{rowWithRowGap:n,columnWithColumnGap:s,deg:a}=o,l=r.x,c=r.y,h=Math.max(t,e),u=h*2,d=h*2,p=Math.ceil(u/s),m=Math.ceil(d/n);for(let g=0;g<p;g++)for(let y=0;y<m;y++){let b,P;a>0?(b=l+g*s,P=c+y*n-(d-e)):(b=l+g*s-(u-t)/2,P=c+y*n-(d-e)/2),i(new S(b,P))}}function uZe(o,t="image/png",e,r){return new Promise(i=>{try{let n=o.width,s=o.height,a=document.createElement("canvas");a.width=n,a.height=s;let l=a.getContext("2d");if(!l)return console.error("Failed to get canvas 2D context"),i(null);if(l.putImageData(o,0,0),r){let{text:c,fontSize:h,deg:u,color:d}=r,p=u*Math.PI/180,m=h+"px serif",g=`rgba(${d.join(",")})`;Ege(r,n,s,S.ORIGIN,y=>{l.save(),l.rotate(p),l.font=m,l.fillStyle=g,l.fillText(c,y.x,y.y),l.restore()})}a.toBlob(c=>{if(!c)return console.error("Canvas toBlob failed"),i(null);i(c)},t,e)}catch(n){console.error(n),i(null)}})}async function Oge(o){var i;let t={success:!1,errorMsg:""};if(typeof ClipboardItem>"u")return t.errorMsg="ClipboardItem API \u4E0D\u88AB\u5F53\u524D\u6D4F\u89C8\u5668\u652F\u6301",t;if(!((i=navigator.clipboard)!=null&&i.write))return t.errorMsg="\u526A\u8D34\u677F API \u4E0D\u88AB\u5F53\u524D\u6D4F\u89C8\u5668\u652F\u6301",t;window.focus();let e={};if((Array.isArray(o)?o:[o]).forEach(n=>{let s=n.type;if(!s){t.errorMsg="Blob \u7C7B\u578B\u65E0\u6548\uFF0C\u8BF7\u6307\u5B9A MIME \u7C7B\u578B";return}e[s]=n}),Object.keys(e).length==0)return t;try{return await navigator.clipboard.write([new ClipboardItem(e)]),t.success=!0,t}catch(n){return n instanceof TypeError?t.errorMsg="\u521B\u5EFA\u526A\u8D34\u677F\u9879\u76EE\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 MIME \u7C7B\u578B":n.name==="NotAllowedError"?t.errorMsg="\u526A\u8D34\u677F\u5199\u5165\u6743\u9650\u88AB\u62D2\u7EDD":t.errorMsg=`\u590D\u5236\u5230\u526A\u8D34\u677F\u5931\u8D25: ${n.message}`,console.error(n),t}}async function dZe(o){let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return console.error("Could not create canvas context"),null;t.width=o instanceof VideoFrame?o.displayWidth:o.width,t.height=o instanceof VideoFrame?o.displayHeight:o.height;try{if(o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof ImageBitmap||o instanceof OffscreenCanvas)e.drawImage(o,0,0);else if(o instanceof HTMLVideoElement)o.readyState<HTMLMediaElement.HAVE_CURRENT_DATA&&await new Promise(i=>{o.addEventListener("loadeddata",()=>i(),{once:!0})}),e.drawImage(o,0,0,t.width,t.height);else if(o instanceof VideoFrame)e.drawImage(o,0,0,o.displayWidth,o.displayHeight),o.close();else return console.error("Unsupported image source type"),null}catch(i){return console.error(`Failed to draw image source: ${i}`),null}return t.toDataURL("image/png")}function pZe(){A.publish("ui/toastMsg",{type:"warn",msg:"No selected primitives!"},j0())}function Age(o,t=""){let e=null;o?e={type:"success",msg:"Copy Success!"}:e={type:"error",msg:{text:"Copy Failed: {error}!",i18nParam:{error:t}}},A.publish("ui/toastMsg",e,j0())}function _ge(o){let t=Ve.getSelects();if(!t||t.length==0)return pZe(),null;let{getParentShape:e,filterRatline:r}=o||{},i=new Set,n=new _e,s=new Set;t.forEach(l=>{if(l.isEmpty||r&&l instanceof _n)return;if(e){let d=l.getParent();d&&!(d instanceof Me)&&(l=d)}if(s.has(l))return;let c=l.globalIndex,h;try{h=l.bbox()}catch{}let u;l instanceof Me&&(u=l.getAttrBBox()),s.add(l),i.add(c),h&&n.ext1(h),u&&n.ext1(u)});let a=n.build1();return{selectSet:s,selectedIds:i,selectedBBox:a}}function fZe(o){let t=be.getRatlineLayer(),e=t.visible,r=$t.getVisible(35),i=new Set;return yAe(n=>{var l;let s=n.globalIndex;if(o.has(s)||!n.isVisible||n instanceof Me)return;let a=(l=n.getParent())==null?void 0:l.globalIndex;a&&o.has(a)||(i.add(s),n.hidden())}),Ve.clearSelect(),e&&(t.visible=!1),r&&$t.setVisible(35,!1),Do.modify(),{hiddenIds:i,ratlineVisible:e,drcVisible:r}}function mZe(o,t,e=!1,r=!1){e&&(be.getRatlineLayer().visible=e),r&&$t.setVisible(35,r),A.publish("onlySelect",o),t&&yAe(i=>{let n=i.globalIndex;t.has(n)&&i.visible()}),Do.modify()}function vge(o,t){let e=x.getInstance(),r=10,i=4096,{minPixelLength:n,maxPixelLength:s,canvasScale:a}=t||{};if(n>0||(n=r),s>0||(s=i),!a){let g=e.getRatio();a=Ni().getScale()/g}let l=Math.ceil(o.width()),c=Math.ceil(o.height()),h=a,u=Math.ceil(h*l),d=Math.ceil(h*c),p=u<n||d<n,m=u>s||d>s;if(p||m){let g=c/l,y=m?s:n;if(m){let b=g<1?y*g:y/g;g<1?(u=y,d=b):(u=b,d=y)}else{let b=g>1?y*g:y/g;g>1?(u=y,d=b):(u=b,d=y)}h=u/l}return{showWidth:u,showHeight:d,scale:h}}async function A_e(o,t){t||(t=new Map);let e=new Set;for(let r of o)if(!r.isEmpty){if(r instanceof Rs){let i=r.hashId,n=r.source,s=await dZe(n);s&&t.set(i,s)}else if(r instanceof Me){let i=r.footprintUUID;if(e.has(i))continue;A_e(r.getItems(),t),e.add(i)}}return t}function gZe(o,t){let e=[];for(let r of o){if(r.isEmpty)continue;let i=r.getParent();t&&i&&t.has(i.globalIndex)||i&&o.has(i)||e.push(r)}return e}var Um=class{constructor(t,e,r,i){this._total=0;this._cur=0;this.childMap=[];this._percent=0;this._lastPercent=0;this.minUpdateProgress=.005;this.name=t||"",this._total=e||0,this.setMinUpdateProgress(i),this.bindTickCall(r),this._update()}_update(){this._total<0&&(this._total=0),this._cur>this._total&&(this._cur=this._total);let t=1,e=this.childMap.length,r=this._total+e*t,i=this._cur;return this.childMap.forEach(n=>{i+=n._percent*t}),this._percent=r==0?0:i/r,this._percent}get percent(){return this._percent}setMinUpdateProgress(t){t>=0&&t<=1&&(this.minUpdateProgress=t)}bindTickCall(t){this._tickCall=t}resetTotal(t){this._total=t,this._update()}start(t){if(t==this)return console.warn("IncorrectUse: cause a circular reference","at","TaskProgress.start"),t;let e=this.childMap;return e.includes(t)||(e.push(t),t._super=this,this._update()),t}startNumbers(t){t>0&&(this._total+=t,this._update())}end(t=!0){this._total==0&&(this._total=1),this._cur=this._total,t&&this.childMap.forEach(r=>r.end(t));let e=this._update();return this.tickCall(),e}tick(t=1){this._cur+=t;let e=this._update();return this.tickCall(),e}tickCall(){this._percent-this._lastPercent<this.minUpdateProgress||(this._lastPercent=this._percent,typeof this._tickCall=="function"&&this._tickCall.call(null,this._percent,this.name),this._super&&(this._super._update(),this._super.tickCall()))}};var oL={enableTransparentBackground:!0},yZe=3.5;var xge=class o{constructor(){this.params=oL;this.initTool()}static getInstance(){return this._instance||(this._instance=new o),this._instance}initTool(){}resetParams(t){this.params=t?Object.assign({},oL,t):oL}async exportSelects(t){let{enableTransparentBackground:e}=this.params,r=4;t||(t=new Um("export-png/export-selects")),t.startNumbers(r);let i=_ge({getParentShape:!0,filterRatline:!0});if(!i)return t.tick(r),null;let{selectSet:n,selectedIds:s,selectedBBox:a}=i,l=Array.from(n);t.tick();let{hiddenIds:c,ratlineVisible:h,drcVisible:u}=fZe(s),d=we.smartMode&&Kt.allSmartPadVisible(!1);d&&wh.iterator(O=>{O.visible()});let p=!1;Ta&&(p=Ta.allDimensionVisible(!1)),(d||p)&&Do.modify(),t.tick();let g=a.extendOfSize(1),{showWidth:y,showHeight:b,scale:P}=vge(g,{canvasScale:yZe});e&&mf.scene.modifyBgColor(ee.build(0,0,0,0));let I=await mf.scene.getCaptureImageData(Math.floor(y),Math.floor(b),g,P,!1),C=new ImageData(I.data,I.width,I.height);t.tick();let E=x.getInstance();return e&&mf.scene.modifyBgColor(E.backgroundColor),mZe(l,c,h,u),d&&Kt.allSmartPadVisible(!0),p&&Ta&&Ta.allDimensionVisible(!0),(d||p)&&Do.modify(),t.tick(),C}async exportSelectsToClipboard(t,e){this.resetParams(t);let r=3;e||(e=new Um("export-png/export-selects-to-clipboard")),e.startNumbers(r);let i=await this.exportSelects(e);if(!i)return e.tick(r),!1;e.tick();let n=await Sge("1"),s=await uZe(i,void 0,void 0,n);e.tick();let a=await Oge(s);e.tick();let{success:l,errorMsg:c}=a;return Age(l,c),l}};var bZe="http://www.w3.org/2000/svg",PZe="http://www.w3.org/1999/xlink",TZe="none";var Rge=class o{constructor(){}initEncoderState(t,e,r){this.encodeOptions=e,this.encodeItems=t,this.initProgress(r),this.svgShapeSourceMap=new Map,this.svgNetTextSourceMap=new Map,this.componentTemplateSourceMap=new Map,this.encodingNet=!1,this.encodingRes=null}initProgress(t){let e=this.encodeItems.length;t||(t=new Um("svg-encoder")),t.startNumbers(e),this.progress=t}generateSvgSource(t,e,r){return this.initEncoderState(t,e,r),this.encoding(),this.finishEncoding(),this.checkValid()?this.encodingRes:null}encoding(){this.encodingShape(),this.encodeEncoderResult()}encodingShape(){let t=this.encodeItems,e=this.progress;this.beforeShapeEncoding(),t.forEach(r=>{this.encodePcbShape(r),e.tick()}),this.afterShapeEncoding()}putSvgShapeSource(t,e){if(!t)return;let r=this.svgShapeSourceMap,i=r.get(e);if(!i){if(!be.getLayer(e))return;i=[],r.set(e,i)}i.push(t)}putSvgNetTextSource(t,e){if(!t)return;let r=this.svgNetTextSourceMap,i=r.get(e);i||(i=[],r.set(e,i)),i.push(t)}encodeSvgSource(t,e,r=""){let i=`<${t}`;for(let n in e){let s=e[n];i+=Object.is(s,null)?` ${n}`:` ${n}="${s}"`}return i+=">",r&&(i+=r),i+=`</${t}>`,i}encodeBoolStr(t){return t?"true":"false"}encodeBoolNumber(t){return t?1:0}encodeColor(t){return t?t.toString():TZe}encodeNumber(t,e){return isNaN(t)?0:(isNaN(e)&&(e=this.encodeOptions.decimalPlaces),XBe(t,e,!1))}encodeOpacity(t){return t>1&&t<100?t/100:Math.max(0,Math.min(t,1))}encodePoint(t){return new S(t.x,-t.y)}encodeTransform(t){let e=t.data;return`matrix(${e[0]},${e[1]},${e[3]},${e[4]},${e[6]},${e[7]})`}encodePolyline(t,e){let r=t instanceof fe?[t]:t.items,i=new f9;r.forEach(l=>{i.encPl(l),l.isClose()&&i.close(!0)});let n=i.toString(),s={...e,d:n};return this.encodeSvgSource("path",s)}encodePrimitive(t,e){if(t instanceof q&&t.isCircle())return this.encodeCircle(t,e);let r=new f9;r.encPt(t);let i=r.toString(),n={...e,d:i};return this.encodeSvgSource("path",n)}encodeCircle(t,e){let r=this.encodePoint(t.center),i={...e,cx:r.x,cy:r.y,r:this.encodeNumber(t.rx)};return this.encodeSvgSource("circle",i)}encodeRect(t,e,r,i,n,s,a){let l=this.encodePoint(t),c=this.encodeNumber(i),h={...a,x:l.x,y:l.y,width:this.encodeNumber(e),height:this.encodeNumber(r)};if(c!=0&&(h.rx=h.ry=c),n!=0){let d=this.encodePoint(s),p=Qe.rotateD(-n).setOrigin1(d);h.transform=this.encodeTransform(p)}return this.encodeSvgSource("rect",h)}encodeImage(t,e,r,i,n,s,a){let l=this.encodePoint(e),c={...a,href:t,x:l.x,y:l.y,width:this.encodeNumber(r),height:this.encodeNumber(i)};if(s||n!=0){let u=s?Qe.rotateD(-n).multiply3(Qe.MIRROR_X).setOrigin1(l):Qe.rotateD(-n).setOrigin1(l);c.transform=this.encodeTransform(u)}return this.encodeSvgSource("image",c)}encodeShapeId(t){let e=t.model,r=t.getParent(),i=r?this.encodeShapeId(r):"",n=e.number;return i+`${ur}${n}`}encodeAngle(t){return W2(t)}beforeShapeEncoding(){}encodePcbShape(t){try{if(t.isEmpty)return;t instanceof Ar||t instanceof Si?this.encodePcbTrack(t):t instanceof Sr?this.encodePcbCircle(t):t instanceof nr?this.encodePcbRect(t):t instanceof ct?this.encodePcbPolygon(t):t instanceof fr?this.encodePcbText(t):t instanceof Ge?this.encodePcbVia(t):t instanceof Ri||t instanceof fn?this.encodePcbPad(t):t instanceof ol?this.encodePcbProtractor(t):t instanceof ca?this.encodePcbDimension(t):t instanceof xa?this.encodePcbRadiusMark(t):t instanceof Yn?this.encodePcbImage(t):t instanceof Rs?this.encodePcbPicture(t):t instanceof Me?this.encodePcbComponent(t):console.warn("Unsupported shape",this.encodeShapeId(t))}catch(e){console.error(e)}}encodeShapeBaseAttrs(t){let r=t.model.modelType||"",i={id:this.encodeShapeId(t),"data-layer-id":t.layerId,"data-model-type":r,"data-locked":this.encodeBoolStr(t.locked)};return t.isVisible||(i.visibility="hidden"),i}encodeProfileAttrs(t){let r=t.model.type,i=t.strokeWidth,n=t.lineColor,s=this.encodeShapeBaseAttrs(t),a=this.encodeColor(null),c=Math.max(.2,this.encodeNumber(i));switch(s["data-line-type"]=r,s["stroke-width"]=c,r){case"Slot Region":{let h=be.getLayer(47).color;s.fill=this.encodeColor(h),s.stroke=this.encodeColor(ee.WHITE);break}case"Slot Region":case"Fill Region":case"Constraint Region":case"TearDrop":case"FPC Stiffener":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":case"3D Shell - Screw Pillar":case"3D Shell - Outline":{n&&!n.equals(ee.BLACK)?s.stroke=this.encodeColor(n):s.stroke=a;break}default:{s.fill=a;break}}return s}encodeNetText(t,e,r,i,n,s,a,l,c,h){if(!r)return;let d=this.encodeOptions.viewScale,p=l*d,m=c*d;if(p<s||m<s)return;p=Math.max(s,Math.min(p,a)),m=Math.max(s,Math.min(m,a));let g=Math.min(3,Math.min(p,m)/d),y=this.encodePoint(i),b=this.encodeNumber(y.x),P=this.encodeNumber(y.y),T="0.1em",I={"data-parent-id":t,x:b,y:P,"font-size":g,"text-anchor":"middle","alignment-baseline":"middle",dy:T};if(n!=0){let E=Qe.rotateD(-n).setOrigin1(y);I.transform=this.encodeTransform(E)}h&&(I.fill=this.encodeColor(h));let C=this.encodeSvgSource("text",I,r);this.putSvgNetTextSource(C,t)}encodePcbTrack(t){let e=this.encodeOptions.ignoreNet,r=this.encodingNet,i=this.encodeShapeId(t),n=t.layerId,s=t.model.primitive,a=t.width,l=t.net;if(!r){let u={...this.encodeShapeBaseAttrs(t),fill:this.encodeColor(null),"stroke-width":this.encodeNumber(a)},d=this.encodePrimitive(s,u);this.putSvgShapeSource(d,n)}if(l&&ga.getInstance().trackShowNet&&!e){let h=s.midPoint,u=s.length(),d=s.start(),p=s.end(),m=this.encodeAngle(p.angle(d));this.encodeNetText(i,n,l,h,m,12,30,u,a,null)}}encodeProfileFilling(t){t.model.type=="Prohibited Region"&&this.encodeProfileProhibitAreaFilling(t)}encodeProfileProhibitAreaFilling(t){let e=this.encodeOptions.viewScale,r=this.encodeShapeId(t),i=t.fillColor||ee.Gray,n=t.layerId,a=1/e,l=[];if(t instanceof Sr){let d=t.center,p=t.radius,m=d.add(new S(-1,1).mul(p*Math.sqrt(2)/2)),g=d.add(new S(1,-1).mul(p*Math.sqrt(2)/2)),y=m.y-m.x,b=g.y-g.x,P=p*2,T=Math.max(1,Math.min(6,P));for(y-=T;y>b;y-=T){let _=2*(y-d.y-d.x),R=d.x*d.x-p*p+(y-d.y)*(y-d.y),v=Math.sqrt(_*_-8*R),D=(-_+v)/4,w=(-_-v)/4,F=D+y,H=w+y,z=new M(new S(D,F),new S(w,H));l.push(z)}let I=d.add(new S(1,1).mul(p*Math.sqrt(2)/2)),C=d.add(new S(-1,-1).mul(p*Math.sqrt(2)/2)),E=I.y+I.x,O=C.y+C.x;for(E-=T;E>O;E-=T){let _=2*(d.y-E-d.x),R=d.x*d.x-p*p+(d.y-E)*(d.y-E),v=Math.sqrt(_*_-8*R),D=(-_+v)/4,w=(-_-v)/4,F=-D+E,H=-w+E,z=new M(new S(D,F),new S(w,H));l.push(z)}}else if(t instanceof nr){let d=t.getMathGraphics();d&&(l=vA(d))}else{let d=t.getMathGraphics(),p=d instanceof fe?d:d.items[0];p&&(l=vA(p))}if(l.length==0)return;let c="";l.forEach(d=>{let p={},m=this.encodePrimitive(d,p);c+=m});let h={"data-layer-id":n,"data-parent-id":r,fill:this.encodeColor(null),stroke:this.encodeColor(i),"stroke-width":this.encodeNumber(a)},u=this.encodeSvgSource("g",h,c);this.putSvgShapeSource(u,n)}encodeProfileBaseTexts(t){this.encodeProfileHoleBaseText(t),this.encodeProfileFpcBaseText(t)}encodeProfileHoleBaseText(t){let r=t.model.type,i="";if(r=="Constraint Region"?i=t.constrainName:r=="Partition"&&(i=t.lineColor.alpha===0?"":t.partitionName),!i)return;let n=this.encodeShapeId(t),s=t.layerId,a=0,l=10,c=15,h=null,u,d=0,p=0;if(t instanceof Sr)u=t.center,d=t.radius*2,p=d;else if(t instanceof nr){let g=t.leftLow,y=t.rightUp;u=g.add(y).mul(.5),d=t.width,p=t.height}else{let g=t.outline,y=new BI(g);u=y.center,d=g.bbox().width(),p=y.high}d=d*.75,this.encodeNetText(n,s,i,u,a,l,c,d,p,h)}encodeProfileFpcBaseText(t){if(t.model.type!="FPC Stiffener")return;let i=t.fpcMaterial;if(!i)return;let n=t.fpcThickness+"mm",s=this.encodeShapeId(t),a=t.layerId,l=0,c=10,h=15,u=ee.build(.2,.4,.8,1),d,p=0,m=0;if(t instanceof Sr)d=t.center,p=t.radius*2,m=p;else if(t instanceof nr){let P=t.leftLow,T=t.rightUp;d=P.add(T).mul(.5),p=t.width,m=t.height}else{let P=t.outline,T=new BI(P);d=T.center,p=P.bbox().width(),m=T.high}let g=d.add1(0,.25*m),y=d.add1(0,-.25*m);p=p*.75,this.encodeNetText(s,a,i,g,l,c,h,p,m,u),this.encodeNetText(s,a,n,y,l,c,h,p,m,u)}encodePcbCircle(t){let e=t.layerId,r=t.model.primitive,i=this.encodeProfileAttrs(t),n=this.encodePrimitive(r,i);this.encodeProfileFilling(t),this.encodeProfileBaseTexts(t),this.putSvgShapeSource(n,e)}encodePcbRect(t){let e=t.layerId,r=t.model.leftUp,i=t.width,n=t.height,s=t.cornerRadius,a=this.encodeAngle(t.rotation),l=this.encodeProfileAttrs(t),c=this.encodeRect(r,i,n,s,a,r,l);this.encodeProfileFilling(t),this.encodeProfileBaseTexts(t),this.putSvgShapeSource(c,e)}encodePcbPolygon(t){let e=t.layerId,r=t.getMathGraphics(),i=this.encodeProfileAttrs(t),n=this.encodePolyline(r,i);this.encodeProfileFilling(t),this.encodeProfileBaseTexts(t),this.putSvgShapeSource(n,e)}encodePcbText(t){let e=t.layerId,r=t.matrix.toMatrix3(),i=t.path.map(c=>c.multiply3(r)),n=t.strokeWidth,s=t.model.type==0,a=this.encodeShapeBaseAttrs(t),l="";if(s){let c={...a,fill:this.encodeColor(null),"stroke-width":this.encodeNumber(n)},h="";i.forEach(u=>{let d={},p=this.encodePolyline(u,d);h+=p}),l=this.encodeSvgSource("g",c,h)}else{let c={...a,stroke:this.encodeColor(null)};l=this.encodePolyline(new Gt(i),c)}this.putSvgShapeSource(l,e)}encodePcbVia(t){this.encodePcbViaShapes(t),this.encodePcbViaBaseTexts(t)}encodePcbViaShapes(t){let e=this.encodeShapeId(t),r=t.center,i=t.radius,n=q.buildCircle(r,i,le.CCW),s=t.type==1,a=this.encodeColor(null);(t.unusedInnerLayers.length>0?t.usedLayers:t.grayIndex!=0?t.allLayers:[12]).forEach(p=>{let m={"data-layer-id":p,"data-parent-id":e,stroke:a},g=this.encodeCircle(n,m);this.putSvgShapeSource(g,p)});let c=t.holeRadius,h=47;if(s){let p=t.startLayer,m=t.endLayer,g=be.getLayer(p).color,y=be.getLayer(m).color,b=270,P=90,T=q.build2(r,b,P,c,c,le.CCW),I=q.build2(r,P,b,c,c,le.CCW),C={"data-parent-id":e,stroke:a},E={...C,"data-layer-id":p,fill:this.encodeColor(g)},O={...C,"data-layer-id":m,fill:this.encodeColor(y)},_=this.encodePrimitive(T,E),R=this.encodePrimitive(I,O);this.putSvgShapeSource(_,h),this.putSvgShapeSource(R,h)}else{let p=t.holeColor,m=q.buildCircle(r,c,le.CCW),g={"data-layer-id":h,"data-parent-id":e,stroke:a};p&&!p.equals(ee.BLACK)&&(g.fill=this.encodeColor(p));let y=this.encodeCircle(m,g);this.putSvgShapeSource(y,h)}let u=t.topExpansion+i;if(u>0){let p=q.buildCircle(r,u,le.CCW),m=5,g={"data-layer-id":m,"data-parent-id":e,stroke:a},y=this.encodeCircle(p,g);this.putSvgShapeSource(y,m)}let d=t.bottomExpansion+i;if(d>0){let p=q.buildCircle(r,d,le.CCW),m=6,g={"data-layer-id":m,"data-parent-id":e,stroke:a},y=this.encodeCircle(p,g);this.putSvgShapeSource(y,m)}}encodePcbViaBaseTexts(t){let e=ga.getInstance(),r=e.viaShowNet,i=e.viaShowPair,n=r?t.net:"",s=i?t.layerPairStr:"";if(!n&&!s)return;let a=this.encodeOptions.ignoreNet,l=this.encodingNet,c=this.encodeShapeId(t),h=t.layerId,u=t.center,d=t.radius,p=t.holeRadius,m=d*2,g=p*2,y=this.getPadOrViaBaseTextPosition(n,s),b=u,P=u;if(y==1){let I=g*.25;b=new S(u.x,u.y-I),P=new S(u.x,u.y+I),g*=.5}let T=0;n&&!a&&this.encodeNetText(c,h,n,b,T,12,30,m,g),!l&&s&&this.encodeNetText(c,h,s,P,T,12,30,m,g)}encodePcbPad(t){this.encodingNet||this.encodePcbPadShapes(t),this.encodePcbPadBaseTexts(t)}encodePcbPadShapes(t){let e=t.model,r=e.top,i=e.inner,n=e.bottom;this.encodePcbSinglePadShape(r,1,t),i&&(t.usedLayers.length>0||t.type==2||t.grayIndex!=0?t.usedLayers.filter(l=>![1,2].includes(l)):[t.layerId]).forEach(l=>{this.encodePcbSinglePadShape(i,l,t)}),this.encodePcbSinglePadShape(n,2,t),this.encodePcbPadHoleShape(t)}encodePcbSinglePadShape(t,e,r){if(!t)return;let i=t.type,n=e,s=this.encodeShapeId(r),a=r.center,l=r.rotation,c=t.width,h=t.height,u=t.ratio,d=e==1,p=i=="POLYGON"?t.pl:null,m={"data-parent-id":s,"data-layer-id":n},g=this.encodePcbSinglePadShapeByOptions(i,a,l,c,h,u,m,p);g&&this.putSvgShapeSource(g,n);let y=this.getPadSolderExpansion(r,e);if(y||y==0){let P=d?5:6,T=p?NM(p,y):null,I=c+y*2,C=h+y*2,E=this.encodePcbSinglePadShapeByOptions(i,a,l,I,C,u,m,T);E&&this.putSvgShapeSource(E,P)}let b=this.getPadPasteExpansion(r,e);if(b||b==0){let P=d?7:8,T=c+b*2,I=h+b*2,C=p?NM(p,y):null,E=this.encodePcbSinglePadShapeByOptions(i,a,l,T,I,u,m,C);E&&this.putSvgShapeSource(E,P)}}encodePcbSinglePadShapeByOptions(t,e,r,i,n,s,a,l){let c;if(i<=0||n<=0)return c;let h=this.encodeColor(null);switch(t){case"ELLIPSE":{let u=q.buildCircle(e,i/2,le.CCW),d={...a,stroke:h};c=this.encodeCircle(u,d);break}case"OVAL":{c=this.encodePcbPadHoleShapeByOptions(e,i,n,r,a);break}case"RECT":{let u=i/2,d=n/2,p=Math.min(u,d)*s,m=this.encodeAngle(r),g=e.add1(-u,d);c=this.encodeRect(g,i,n,p,m,e,a);break}case"POLYGON":{if(l){let u={...a,stroke:h};c=this.encodePolyline(l,u)}break}}return c}encodePcbPadHoleShape(t){let e=t.model,r=e.hole;if(!r)return;let i=this.encodeShapeId(t),n=e.rotation,s=e.center,l=r.holeRadius*2,c=r.holeLength,h=r.holeRotation,u=r.holeOffset,d=Ae.rotateZ(h).translate1(u.x,u.y,0).rotateZ(n).translate1(s.x,s.y,0),p=S.ORIGIN.multiply4(d),m=47,g={"data-layer-id":m,"data-parent-id":i},y=this.encodePcbPadHoleShapeByOptions(p,l,c,h,g);y&&this.putSvgShapeSource(y,m)}encodePcbPadHoleShapeByOptions(t,e,r,i,n){let s=this.encodeColor(null),a=Math.abs(e-r),l="";if(a>1e-4){let c,h=0;if(e>r){let d=(e-r)/2,p=new S(-d,0).rotate(S.ORIGIN,i).add(t),m=new S(d,0).rotate(S.ORIGIN,i).add(t);c=new M(p,m),h=r}else{let d=(r-e)/2,p=new S(0,-d).rotate(S.ORIGIN,i).add(t),m=new S(0,d).rotate(S.ORIGIN,i).add(t);c=new M(p,m),h=e}let u={...n,fill:s,"stroke-width":this.encodeNumber(h)};l=this.encodePrimitive(c,u)}else{let c={...n,stroke:s},h=q.buildCircle(t,e/2,le.CCW);l=this.encodeCircle(h,c)}return l}encodePcbPadBaseTexts(t){let e=ga.getInstance(),r=e.padShowNet,i=e.padShowNum,n=r?t.net:"",s=i?t.num:"";if(!n&&!s)return;let a=this.encodeOptions.ignoreNet,l=this.encodingNet,c=this.encodeShapeId(t),h=t.layerId,u=t.center,d=t.rotation,p=this.getPadOrViaBaseTextPosition(n,s),m=this.padIsCircle(t),g=m?new S(1,0):new S(Math.cos(d),Math.sin(d)),y=new S(-g.y,g.x),b=Math.atan2(g.y,g.x);(b<-es||b>es)&&(y=new S(g.y,-g.x)),b<0&&(g=g.mul(-1));let P=u,T=u,I=this.getPadWidth(t),C=this.getPadHeight(t);if(p==1)if(I>=C){let _=y.mul(C*.25);P=u.sub(_),T=u.add(_),C*=.5}else{let _=g.mul(I*.25);P=u.sub(_),T=u.add(_),I*=.5}let E=d;I==C||m?E=0:(I<C&&(E+=es),E=pT(E));let O=this.encodeAngle(E);if(C>I){let _=I;I=C,C=_}n&&!a&&this.encodeNetText(c,h,n,P,O,12,30,I,C),!l&&s&&this.encodeNetText(c,h,s,T,O,12,30,I,C)}encodePcbProtractor(t){let e=t.layerId,r=t.center,i=t.start,n=t.end,s=t.strokeWidth,{startAngle:a,endAngle:l,sweep:c,textAngleCenter:h,textAngleRadius:u}=this.getPcbProtractorShapeData(t),d=new M(i,r),p=new M(r,n),m=fe.build2([d,p]),g={},y=this.encodePolyline(m,g),b=10,P=q.build2(r,a,l,b,b,c),T={},I=this.encodePrimitive(P,T),C="",E=t.textMatrix.toMatrix3();t.textPath.map(W=>W.multiply3(E)).forEach(W=>{let L={},B=this.encodePolyline(W,L);C+=B});let _={},R=this.encodeSvgSource("g",_,C),v=q.buildCircle(h,u,c),D={},w=this.encodePrimitive(v,D),H={...this.encodeShapeBaseAttrs(t),fill:this.encodeColor(null),"stroke-width":this.encodeNumber(s)},z=y+I+R+w,G=this.encodeSvgSource("g",H,z);this.putSvgShapeSource(G,e)}encodePcbDimension(t){let e=t.layerId,r=t.start,i=t.end,n=t.left,s=t.right,a=t.lineLen,l=t.arrLineLen,c=t.strokeWidth,u=t.model.text.width,d=kS(r,i,n,s,u,a,l),p="";d.forEach(R=>{let v={},D=this.encodePrimitive(R,v);p+=D});let m={},g=this.encodeSvgSource("g",m,p),y="",b=t.textMatrix.toMatrix3();t.textPath.map(R=>R.multiply3(b)).forEach(R=>{let v={},D=this.encodePolyline(R,v);y+=D});let T={},I=this.encodeSvgSource("g",T,y),E={...this.encodeShapeBaseAttrs(t),fill:this.encodeColor(null),"stroke-width":this.encodeNumber(c)},O=g+I,_=this.encodeSvgSource("g",E,O);this.putSvgShapeSource(_,e)}encodePcbRadiusMark(t){let e=t.layerId,r=t.start,i=t.end,n=t.strokeWidth,s=t.model.text,a=i.sub(r).normalize(),l=Math.PI/4,c=3,h=Ae.rotateZ(l),u=Ae.rotateZ(-l),d=a.multiply4(h).mul(c),p=a.multiply4(u).mul(c),m=[new M(r,i),new M(i,i.sub(d)),new M(i,i.sub(p))],g="";m.forEach(D=>{let w={},F=this.encodePrimitive(D,w);g+=F});let y={},b=this.encodeSvgSource("g",y,g),P="",T=t.textMatrix.toMatrix3();t.textPath.map(D=>D.multiply3(T)).forEach(D=>{let w={},F=this.encodePolyline(D,w);P+=F});let C={},E=this.encodeSvgSource("g",C,P),_={...this.encodeShapeBaseAttrs(t),fill:this.encodeColor(null),"stroke-width":this.encodeNumber(n)},R=b+E,v=this.encodeSvgSource("g",_,R);this.putSvgShapeSource(v,e)}encodePcbImage(t){let e=t.layerId,r=t.matrix.toMatrix3(),i=t.path.map(c=>c.multiply3(r)),n=new Gt(i),a={...this.encodeShapeBaseAttrs(t),stroke:this.encodeColor(null)},l=this.encodePolyline(n,a);this.putSvgShapeSource(l,e)}encodePcbPicture(t){let e=this.encodeOptions.pictureDataUrlMap;if(!e)return;let r=t.hashId,i=e.get(r);if(!i)return;let n=t.layerId,s=t.leftUp,a=t.width,l=t.height,c=this.encodeAngle(t.rotation),h=ms(n)!=t.mirror,u=this.encodeShapeBaseAttrs(t),d=this.encodeImage(i,s,a,l,c,h,u);this.putSvgShapeSource(d,n)}encodePcbComponent(t){let e=t.footprintUUID,r=t.layerId,i=t.position,n=t.rotation,s=this.encodingNet,a=e+"-"+r;if(this.encodePcbComponentTemplate(t,a)){let c=this.encodeShapeBaseAttrs(t),h=this.encodePoint(i),u=Qe.rotate(-n).translate1(h),d={...c,"xlink:href":`#${a}`,x:0,y:0,transform:this.encodeTransform(u)},p=this.encodeSvgSource("use",d);this.putSvgShapeSource(p,r)}t.iterateAttrs(c=>{(c.showKey||c.showValue)&&this.encodePcbShape(c)}),this.encodingNet=!0,t.iterateShapes(c=>{(c instanceof Ue||c instanceof Le||c instanceof Ge)&&c.net&&this.encodePcbShape(c)}),this.encodingNet=s}encodePcbComponentTemplate(t,e){let r=this.componentTemplateSourceMap;if(r.has(e))return r.get(e);let i=this.encodeOptions,n=t.model,s=t.position,a=t.rotation,l=S.ORIGIN,c=0,h=!s.equals1(l)||a!=c;if(h){let g=l.sub(s),y=c-a,b=Ae.translate1(new Mt(g.x,g.y,0)).rotateZ(y);n.transform(b)}let u=t.getItems(),d={...i,onlyKeepShapesSource:!0,shapesGroupNodeId:e,ignoreNet:!0},p=new o().generateSvgSource(u,d),m=p==null?void 0:p.svgSource;if(h){let g=s.sub(l),y=a-c,b=Ae.rotateZ(y).translate(new Mt(g.x,g.y,0));n.transform(b)}return r.set(e,m),m}afterShapeEncoding(){}encodeLayerAttrs(t){let e=t.layerID,r=this.encodeColor(t.color),i=this.encodeOpacity(1),n=this.encodeOpacity(1),s="round",a={"data-layer-id":e,fill:r,"fill-opacity":i,stroke:r,"stroke-opacity":n,"stroke-linecap":s,"stroke-linejoin":s};return t.visible||(a.visibility="hidden"),a}encodeShapesAttrs(){let t="shapes";return{id:t}}encodeShapeNetTextsAttrs(){let t="shape-net-texts",e=this.encodeColor(ee.WHITE),r=this.encodeColor(ee.BLACK),i=.01,n="Consolas,Courier,Monospace";return{id:t,fill:e,stroke:r,"stroke-width":i,"font-family":n}}getSvgViewData(){let{encodeItemsBBox:t,viewWidth:e,viewHeight:r,viewScale:i}=this.encodeOptions,n=t.width(),s=t.height(),a=n*i,l=s*i,c=t.UL();return{svgWidth:a,svgHeight:l,viewLeftTop:c,physicalWidth:n,physicalHeight:s}}encodeBackGroundShape(t){let{enableTransparentBackground:e}=this.encodeOptions,{viewLeftTop:r,physicalWidth:i,physicalHeight:n}=t,s=x.getInstance().getBgColor(),a=e?0:s.alpha,l="background",c={id:l,stroke:this.encodeColor(null),fill:this.encodeColor(s),"fill-opacity":this.encodeOpacity(a)};return this.encodeRect(r,i,n,0,0,r,c)}encodeSvgAttrs(t){let e=this.encodeOptions.viewScale,{svgWidth:r,svgHeight:i,viewLeftTop:n,physicalWidth:s,physicalHeight:a}=t,l=this.encodePoint(n),c=[l.x,l.y,s,a].join(" ");return{width:r,height:i,"data-view-scale":this.encodeNumber(e),viewBox:c,xmlns:bZe,"xmlns:xlink":PZe}}encodeWatermark(){let{watermarkConfig:t,viewScale:e}=this.encodeOptions;if(!t)return"";let{svgWidth:r,svgHeight:i}=this.getSvgViewData(),n=[],{text:s,fontSize:a,deg:l,color:c}=t,h=1/e,u=a/e,d="0.1em",p=255,m=c&&c.length>=4&&ee.build(c[0]/p,c[1]/p,c[2]/p,c[3]),g=this.encodeColor(m);Ege(t,r,i,S.ORIGIN,P=>{let T=this.encodePoint(P.scale(1/e)),I=this.encodeNumber(T.x),C=this.encodeNumber(T.y),E={x:I,y:C};if(l!=0){let _=Qe.rotateD(l).setOrigin1(T);E.transform=this.encodeTransform(_)}let O=this.encodeSvgSource("text",E,s);n.push(O)});let y="watermarks",b={id:y,"stroke-width":h,"font-size":u,"text-anchor":"middle","alignment-baseline":"middle",dy:d};return g&&(b.stroke=g,b.fill=g),this.encodeSvgSource("g",b,n.join(""))}encodeEncoderResult(){let t=this.encodeOptions,e=t.onlyKeepShapesSource,r=t.shapesGroupNodeId,i=this.svgShapeSourceMap,n=this.svgNetTextSourceMap,s=this.componentTemplateSourceMap,a=this.getSvgViewData(),l=this.encodeBackGroundShape(a),c="";s.forEach(F=>{c+=F});let h={},u=this.encodeSvgSource("defs",h,c),d="";Array.from(i.keys()).sort((F,H)=>be.getLayer(H).order-be.getLayer(F).order).forEach(F=>{let H=be.getLayer(F),G=i.get(F).join(""),W=this.encodeLayerAttrs(H),L=this.encodeSvgSource("g",W,G);d+=L});let g=this.encodeShapesAttrs(),y=this.encodeSvgSource("g",g,d),b="";n.forEach(F=>{b+=F.join("")});let P=this.encodeShapeNetTextsAttrs(),T=this.encodeSvgSource("g",P,b),I=y+T,C=r||"shapes-net-texts-group",E={id:C},O=this.encodeSvgSource("g",E,I),_=this.encodeWatermark(),R=l+u+O+_,v=this.encodeSvgAttrs(a),D=this.encodeSvgSource("svg",v,R),w=`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
`;this.encodingRes={svgSource:e?O:w+D}}checkValid(){return!0}finishEncoding(){this.cycleMemory()}cycleMemory(){this.encodeItems=null,this.progress=null,this.svgShapeSourceMap=null,this.svgNetTextSourceMap=null}getPadOrViaBaseTextPosition(t,e){return t!=""&&e!=""?1:t!=""&&e==""?2:t==""&&e!=""?2:3}padIsCircle(t){let e=t.model;return t.layerId==2?e.bottom.type=="ELLIPSE":e.top.type=="ELLIPSE"}getPadWidth(t){var i,n;let e=t.layerId,r=t.model;return e==2?(i=r.bottom)==null?void 0:i.width:(n=r.top)==null?void 0:n.width}getPadHeight(t){var i,n;let e=t.layerId,r=t.model;return e==2?(i=r.bottom)==null?void 0:i.height:(n=r.top)==null?void 0:n.height}getPadSolderExpansion(t,e){return e==1?t.topSolderExpansion:e==2?t.bottomSolderExpansion:null}getPadPasteExpansion(t,e){return e==1||e==2?t.pasteExpansion:null}getPcbProtractorShapeData(t){let e=t.layerId,r=t.center,i=t.start,n=t.end,s=t.viewWidth,a=t.viewHeight,l=t.strokeWidth,c=t.textMatrix,h=i.sub(r),u=n.sub(r),d=Math.atan2(h.y,h.x),p=Math.atan2(u.y,u.x);d==p&&(p+=1e-8);let g=h.cross(u)>=0?le.CCW:le.CW,b=new S(s,a).multiply4(c).add1(ms(e)?-1:1,0),P=l/2+.1;return{startAngle:this.encodeAngle(d),endAngle:this.encodeAngle(p),sweep:g,textAngleCenter:b,textAngleRadius:P}}};var Dge=class o{constructor(){this.params=oL;this.initTool()}static getInstance(){return this._instance||(this._instance=new o),this._instance}initTool(){}resetParams(t){this.params=t?Object.assign({},oL,t):oL}async exportSelects(t){let{enableTransparentBackground:e}=this.params,r=2;t||(t=new Um("export-svg/export-selects")),t.startNumbers(r);let i=_ge({getParentShape:!0,filterRatline:!0});if(!i)return t.tick(r),null;let{selectSet:n,selectedIds:s,selectedBBox:a}=i;t.tick();let c=a.extendOfSize(1),{showWidth:h,showHeight:u,scale:d}=vge(c),p=gZe(n,s),m=await A_e(p),g=await Sge("1"),y={encodeItemsBBox:c,viewWidth:h,viewHeight:u,viewScale:d,decimalPlaces:5,pictureDataUrlMap:m,watermarkConfig:g,enableTransparentBackground:e},b=new Rge().generateSvgSource(p,y,t);return t.tick(),b?b.svgSource:null}async exportSelectsToClipboard(t,e){this.resetParams(t);let r=3;e||(e=new Um("export-svg/export-selects-to-clipboard")),e.startNumbers(r);let i=await this.exportSelects(e);if(!i)return e.tick(r),!1;e.tick();let n=new Blob([i],{type:"image/svg+xml"}),s=new Blob([i],{type:"text/plain"});e.tick();let a=await Oge([n,s]);e.tick();let{success:l,errorMsg:c}=a;return Age(l,c),l}};var wge=class{constructor(){this.moveTool=null;this._flipping=!1}flipComponent(t,e,r,i){let n=this.getCenter(r);this._flipping=!0;let s=i||new ve("flip-component"),a=new mi().addGroup(s);ls.getInstance().init(r,a,async(l,c)=>{if(ce.pcbConfig.allowFootprintFlipping){i=c.getCommand();for(let h of l)h instanceof Me&&(i.addCommand(Te.dispatch(h,"modify")),await this.updateComponentFootprint(h,t=="Flip Up and Down",n,i));if(!this.moveTool){let h=new mi().addGroup(i);this.toggleMove(l,e,h),this.moveTool=Kf.getNextTool().getNextTool()}}else A.windowBridge.rpcCall("tipsModalBackToPcb","flipComponent",$()).then(async h=>{if(h.message.action=="yes"){i=c.getCommand();for(let u of l)u instanceof Me&&(i.addCommand(Te.dispatch(u,"modify")),await this.updateComponentFootprint(u,t=="Flip Up and Down",n,i))}if(!this.moveTool){let u=new mi().addGroup(i);this.toggleMove(l,e,u),this.moveTool=Kf.getNextTool().getNextTool()}})})}async updateComponentFootprint(t,e,r,i){t.flip(e,r),await new $f().updateCustomFootprint(t,i,t.getItems()),A.publish("autoFill","")}toggleMove(t,e,r){let i={command:"batchMoveItem",refer:new u2(t,e.x,e.y),menu:"MOVE_BY_REFERENCE_POINT",isContinuousMode:!1,commandFactory:r};A.publish("toggle",i)}clear(){this.moveTool=null,this._flipping=!1}getCenter(t){let e=new _e;for(let r of t)e.ext1(r.buildBBox());return e.build1().center()}getStatus(){return this._flipping}};var A=ie,je=new Zue,Vt=new CF(20,()=>new rD),be=new Jue,ze=new sde,pr=new CN,Kt=new ede,Hr=new tde,Zt=new rde,Xt=new ide,gn=new Dme,ti=new SN,is=new nde,Go=new ode,wh=new fme,Uo=new hde,oql=new Que,kt=new ade,$u=new ude,qc=new dde,pt=new pde,jr=new rme,Eb=Wy.getInstance(),Xd=new k0e,P$e=new ome,zC=new cde,Vpe=new R0e,Yh=new Rme,Ji=Wi.getInstance(),Cr=new xw,epe=new mde,Pr=new xde,zo=new Rde,Vh=new wde,Eo=new Bde,ah=new iG(!0),Ua=new dme,ao=new cme,NN=new yK,Yo=new hme,rt=new Vde,OT=new L0e,uh=new Cme,sql=new lme,aql=new Ome,lql=new B0e,Ln=new GN,_o=new Sme,Ei=new M0e,Qn=new N0e,$t=new JU,ic=new F0e,ce=new K0e,x3=Qa.getInstance(),FAe=xme.getInstance(),ps=gh.getInstance(),sr=new mK,$$=new nme,r6=new Ame,cql=new tme,IZe=xge.getInstance(),CZe=Dge.getInstance(),we=new sme,rqe=new Gde,hql=new Ude,AP=new Tme;new jfe;var yi=new ume,sl=new Fde,use=new fde,Bw="",E9=new hge,ZE=new mme,Vs=new gme,Y8=new Cge,jt=new yme,tp=new vme,Ii=new fse,Fu=new a1,td=new Ime,Wh=new Eme,j4=new UF,Zb=new _me,qf=new wge,Au=new vpe,JT={isChecked:!1,outlineInfoForQRCode:null,coverOil:!0};Ji.bindListener(new mge);ps.bindListener(new Pge);bKe(ie,Ve);var JLt=new Tge;Window.endPointDebug=JLt;var __e={typeface:kZ,height:12,strokeWidth:.8};function dfe(o,t){typeof __e[o]<"u"&&(__e[o]=t)}var N9=o=>__e[o];function bP(){return hZe("linked-width-height")=="1"}function OU(o){Bw=o}function FC(o,t=!0){!x.getInstance().isactive||23==x.getInstance().doctype||(eqe(x.getInstance().unit,o),x.getInstance().unit=o,we.smartMode&&wh.getAllItem().forEach(r=>r.unit=o),A.publish("updateFrame",""),A.publish("flushSelectingInfo",""),Ta&&setTimeout(()=>{A.publish("checkDimension",{on:!0})},10),x.getInstance().doctype===4&&(A.publish("flushAttrPlane",{isUpdateDeviceData:"",doNotReloadPrjTree:""}),A.publish("flushWizardOption",{unit:o},$())),dt.updateUnit(o),A.publish("updateNetLengthUnit",o,window.top),t&&!x.getInstance().isReadOnlyMode&&A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),Lge(),wp())}function Lge(){switch(Yh.type){case"DIST_MEASURE":Uu.getInstance().hasSettingResult&&(Uu.getInstance().refreshMeasureResultBySelectedElements(),A.publish("FlushSketcherAttrView",{type:"DIST_MEASURE"}));break;case"SINGLE_WIRE":A.publish("FlushSketcherAttrView",{type:"SINGLE_WIRE"});break;case"DIFF_WIRE":A.publish("FlushSketcherAttrView",{type:"DIFF_WIRE"});break;case"MULTI_WIRE":A.publish("FlushSketcherAttrView",{type:"MULTI_WIRE"});break;case"COPY_SPECIAL":A.publish("FlushSketcherAttrView",{type:"COPY_SPECIAL"});break;case"PASTE":A.publish("FlushSketcherAttrView",{type:"PASTE"});break}}async function NC(o,t,e){let r=await MC(o);A.windowBridge.publish("exportFileClientWay",{data:{fileData:r.data,fileTitle:t,extension:e}},$())}A.messageBus.subscribe("pcb/exportFileClient",o=>{let{dataStr:t,title:e,extension:r}=o;t&&NC(new Blob([t],{endings:"native"}),e,r)});function n$(o,t,e=[]){let r=Ji.getItem(o.footprintUUID);if(r instanceof Xc){t.addCommand(Te.dispatch(o,"delete"));let n=new z1("2.0").replace(o.model,"Footprint",r.source);A.publish("clearSelect",""),o.remove(),A.publish("delete",o);let s=new Y1(n);s.build();let a=s.items[0];for(let h of o.model.getPads())if(!e.includes(h.globalIndex)){let u=a.getPads().find(d=>d.globalIndex==h.globalIndex);u&&(u.unusedInnerLayers=h.unusedInnerLayers)}let l=Ui.getInstance().getItem(2),c=Ui.getInstance().getItem(3);UN.updateDisplay(2,l.visible),UN.updateDisplay(3,c.visible),A.publish("hasModifyPcbItem",a),t.addCommand(Te.dispatch(a,"add"))}}A.subscribe("TrackWidthSetting",o=>{if(x.getInstance().isactive){if(o==="WIRING_WIDTH_FOLLOWRULES"){let t=ce.pcbConfig.startTrackWidth=="rule"?"last":"rule";ce.pcbConfig.startTrackWidth=t,we.widthFollowRule=t=="rule"}else{let t=ce.trackConfig;if(!t||!t.length)return;let e=o;for(let r in t)if(Math.abs(Number(t[r].mil)*10-Number(o))<.001){e=r;break}jr.toggleWidth(e),Hi()}A.publish("flushSelectingInfo",""),Lge()}});A.subscribe("updateRtree",o=>{Vt.init||(Vt.flushWhenNeed(),Vt.init=!0);let t="updateRTree-time";pn(t);let e=o==null?void 0:o.refreshAll,r=new Set,i=!1;if(!e)for(let[u,d]of rj)for(let p of d)p&&p.item&&(p.item.isEmpty||r.add(p),Vt.remove(p,u),i=!0);i&&Vt.flushDeleteWhenNeed();for(let u of r)Vt.insert(u);r.clear(),r=null,i&&Vt.flushWhenNeed(),rj.clear();let n=e,s=new Set,a=new Set;if(!e){for(let u of ure)h(u),n=!0;ure.clear()}Vt.itorTree(u=>{if(e){for(let d of u.items)n=!0,d.item.isEmpty?s.add(d):a.add(d);return}for(let d of u.changeList)n=!0,d.item.isEmpty?s.add(d):a.add(d);u.changeList.clear()});for(let u of s)Vt.remove(u);s.clear(),s=null;for(let u of a)Vt.remove(u);n&&Vt.flushDeleteWhenNeed();for(let u of a)u.update(),Vt.insert(u);a.clear(),a=null,n&&Vt.flushWhenNeed(),Bi(t,.05);let l=20;nj(t).length>=l&&QLt(l);function c(u,d){if(!u)return;let p=u;p&&(u.isEmpty?s.add(p):a.add(p))}function h(u){if(!u)return;let d=u.globalIndex;c(u,d);let p=u.getParent();p&&p instanceof Ye&&c(u,d)}});function QLt(o){let t="updateRTree-time",e="rebuildRatline-time",r="updateDRC-time",i="updateConnectRelation-time";RCe({[t]:"\u66F4\u65B0RTree",[e]:"\u91CD\u5EFA\u98DE\u7EBF",[r]:"\u66F4\u65B0DRC",[i]:"\u66F4\u65B0\u8FDE\u63A5\u5173\u7CFB"},`autoFlushService-Time(${o})`)}A.subscribe("undo",()=>{if(!(!x.getInstance().isactive||23==x.getInstance().doctype||!yi.currentCanUndoTool))if(hy.getInstance().hasActiveToolHistory()&&hy.getInstance().canUndo())hy.getInstance().undo();else{let o=TN.getInstance();o.stash(),A.publish("clearDimension",""),je.undo(),o.pop()}});A.subscribe("redo",()=>{if(!(!x.getInstance().isactive||23==x.getInstance().doctype||!yi.currentCanUndoTool))if(hy.getInstance().hasActiveToolHistory()&&hy.getInstance().canRedo())hy.getInstance().redo();else{let o=TN.getInstance();o.stash(),A.publish("clearDimension",""),je.redo(),o.pop()}});A.subscribe("UnitConver",FC.bind(void 0));A.messageBus.rpcService("FileSource",async o=>{var r;o&&o.useCompilerSave&&await((r=x.getInstance().compiler)==null?void 0:r.save());let t=x.getInstance();return new hu("2.0",t.doctype).save()});A.messageBus.rpcService("pcb/saveCompiler",async o=>{var i;let t=Wi.getInstance().getAllItem();for(let n of t)if(n instanceof Xc){let s=await n.getInstance().save();s.success||console.log(s.message)}let e=await((i=x.getInstance().compiler)==null?void 0:i.save()),r=await RC.getInstance().saveCopper();return!r.success&&e.success&&(e=r),e});A.messageBus.rpcService("pcb/closePcbPage",async()=>{var o;Ve.closePcbPage(),Mn.getInstance().allowPull=!1,await((o=x.getInstance().compiler)==null?void 0:o.destroy()),await Wi.getInstance().clear(),await gh.getInstance().clear(),x.getInstance().compilerChannel.dispose(),RC.getInstance().closeDynamicCopper(),Yh.clearSketcherAttrView()});A.messageBus.rpcService("FileSourceForSelected",o=>{let t=Ve.getSelects(),e=x.getInstance().origin,r=_s(t);if(r.valid()){let n=r.build();x.getInstance().origin=new S(n.minX,n.minY)}let i=new hu("2.0",3).saveSelected(o);return x.getInstance().origin=e,i});A.messageBus.rpcService("footprintIsExist",({uuid:o,source:t})=>{t=t.split(cZe)[0]||"";let e=Wi.getInstance().getItem(o),r=Wi.getInstance().getItem(t);return e instanceof Xc&&e.components.size>0&&e.uuid==o?!0:r instanceof XI&&r.components.size>0&&r.uuid==t});A.messageBus.rpcService("addCustomFootprint",o=>Qse(o));A.messageBus.rpcService("FileSourceForPanelizePreview",()=>{let o=x.getInstance();return new hu("2.0",o.doctype).onlyOutline()});A.messageBus.rpcService("getCanvasParam",()=>new Promise((o,t)=>{let e=new ft,r={visible:St.getInstance().visible,color:ce.themeConfig.canvasTheme.gridColor,snapX:e.conversion1("mil",x.getInstance().unit,St.getInstance().getSnapX())*10+x.getInstance().unit,snapY:e.conversion1("mil",x.getInstance().unit,St.getInstance().getSnapY())*10+x.getInstance().unit,style:St.getInstance().pattern?"line":"dot",origin:x.getInstance().origin,unit:x.getInstance().unit};o({...r,adsorb:we.adsorb,realTimeDRC:ah.switch,grayState:we.grayState})}));A.messageBus.rpcService("pcb/getAllTestPoints",()=>{let o=Kt.getAllTestPad(),t=new ft;return{items:o.map(r=>{let{net:i,num:n,layerId:s,center:a}=r,l=r.getParent();l&&(n=`${l.designator}${n?"-"+n:""}`);let c=0;s==12&&(c=t.conversion1("mil",x.getInstance().unit,r.hole.holeRadius*20));let h=x.getInstance().origin,u=t.conversion1("mil",x.getInstance().unit,(a.x-h.x)*10),d=t.conversion1("mil",x.getInstance().unit,(a.y-h.y)*10),p=be.getLayer(s).name;return{x:u,y:d,layerName:p,num:n,net:i,holeSize:c}}),UNIT:x.getInstance().unit,nets:ze.getAllNets()}});A.messageBus.rpcService("getAllComponentWithSelectionState",o=>{let e=Ve.getSelects().filter(r=>r instanceof Me).map(r=>r.globalIndex);return Cr.getAllItem().map(r=>({attributes:r.attrKeyValue,deviceUUID:r.deviceUUID,footprintUUID:r.footprintUUID,isSelected:e.includes(r.globalIndex),ID:r.globalIndex}))});A.messageBus.rpcService("getDeviceComponent",o=>ps.getItem(o).getComponents().map(e=>e.globalIndex));A.messageBus.rpcService("getSelectFtUuids",()=>new Promise((o,t)=>{let e=Ve.getSelects(),r=new Array;e.forEach(i=>{i instanceof Me&&r.push(i.footprintUUID)}),o({uuids:r})}));A.messageBus.rpcService("pcb/getRouterNets",o=>new Promise((t,e)=>{let r=ze.getAllNets();t({nets:r})}));A.messageBus.rpcService("restoreHistoryNode",o=>new Promise(async(t,e)=>{function r(){if(o.pcbs&&o.pcbs[x.getInstance().id]){let n=o.pcbs[x.getInstance().id].canvas;new IC(x.getInstance().compiler).parseFull(n)}t(!0)}function i(){Ya.rebuildingRatlineInWorker?setTimeout(()=>{i()},50):r()}Ya.rebuildingRatlineInWorker?i():r()}));A.subscribe("restoreCanvasDefault",()=>{x.getInstance().compilerChannel.pull(),be.getLayer(1).layerStatus==0&&(be.checkDefault(),te.getInstance().correctDefault(),Bf.getInstance().updateLayerInfo())},$());A.messageBus.rpcService("/pcb/bomMerge/source",w$e);A.messageBus.rpcService("unitConversion",o=>new ft().conversion(o.unit,x.getInstance().unit,o.value));function zw(o){return o instanceof fr?mN(o):o instanceof Ye&&(o.type!="Line"||o.layerId==11)?o.getMathGraphics().bbox():o.buildBBox()}function yqe(o){return o instanceof Me||o instanceof fr?o.position:o instanceof n0?o.start:o.buildBBox().center()}A.messageBus.rpcService("toggleSmartSizeMode",o=>new Promise((t,e)=>{o!==""&&we.smartMode==o&&t(o),A.publish("clearDimension",""),we.smartMode=!we.smartMode,we.smartMode?(Kt.allAddSmartPad(),A.publish("updateRtree","")):(wh.clearAll(),Kt.removeAllSmartPad(),A.publish("flushService",""),A.publish("tool","draw(origin)"),A.publish("tool","dropdrag"),A.publish("flushSelectingInfo","")),A.publish("updateFrame",""),t(we.smartMode)}));A.messageBus.subscribe("exitEditPadShapeMode",o=>{let t=Kf.getNextTool().getNextTool();(t instanceof wN||t instanceof xU)&&t.completed()});A.subscribe("clearAllPcbHistory",(o=!1)=>{x.getInstance().doctype===3&&je.clear(),o&&x.getInstance().doctype===4&&x.getInstance().projectId!=null&&je.clear()},$());A.messageBus.rpcService("PhysicalStackingConfig",()=>new Promise((o,t)=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return o([]);let e=new ft,r=be.getLayerPhys().map(i=>({"Layer Id":i.layerId,Layer:i.layerName,Type:null,Material:i.material,Thickness:i.thickness!=null?xe(e.mil2mm(i.thickness*10),3):null,Permittivity:i.permittivity,"Loss Tangent":i.lossTangent,"Layer Type":i.layerType,zIndex:i.zIndex}));o(r)}));A.subscribe("pcb/exportFile/cancel",o=>{!x.getInstance().isactive||23==x.getInstance().doctype||sZe(o)});A.subscribe("pcb/exportFile",o=>{!x.getInstance().isactive||23==x.getInstance().doctype||aZe(o)});A.messageBus.rpcService("pcb/getExportFileData",async o=>!x.getInstance().isactive||23==x.getInstance().doctype?void 0:await lZe(o));A.subscribe("progressUpdate",o=>{console.debug(o),A.publish("pcbUpdateProgress",o,$())});A.subscribe("syncFromContentModel",o=>{let t=JSON.parse(o),e=new u5().decode(t);Eo.syncFromContentModel(e)});A.messageBus.rpcService("i18n",async o=>(await A.windowBridge.rpcCall("i18n",o,top)).message);window.onunload=()=>{Kue(),x.getInstance().compilerChannel.dispose(),A.publish("editPageClose",{uuid:x.getInstance().tabId,doctype:x.getInstance().doctype},$())};A.messageBus.rpcService("getMousePosition",o=>{if(o)return Fo(new S(o.x,o.y))});var Ta=null;A.messageBus.subscribe("checkDimension",o=>{let t=new hH,e=o.on||!Ta;if(Ta&&(Ta.interrupt(),Ta=null),e){let r=o.unit?o.unit:x.getInstance().unit;t.setAllDimension(r),Ta=t}A.publish("updateFrame","")});A.messageBus.rpcService("checkDimensionForUi",async()=>{Ta&&(Ta.interrupt(),Ta=null);let o=new hH(!0),t="mil",e=o.setAllDimension(t);Ta=o;let r=Lc(),i=new _e;r.forEach(s=>{i.ext1(s.buildBBox())});let n=o.buildBox();if(i.ext1(n),i.valid()){let s=i.build1();A.publish("adaptBBox",s)}return A.publish("updateFrame",""),e});A.messageBus.rpcService("toggleDimension",o=>{let t=new hH(!0);if(Ta){Ta.interrupt(),Ta=null;let e=t.setAllDimension(o.unit);return Ta=t,A.publish("updateFrame",""),e}else return[]});A.messageBus.subscribe("highlightDimension",o=>{Ta&&(Ta.highlightDimension(o.title),A.publish("updateFrame",""))});A.messageBus.subscribe("highlightPad",o=>{let t=Kt.getAllItem(),e=[];for(let r=0;r<t.length;r++)t[r].visible(),o.indexOf(t[r].globalIndex)>=0&&e.push(t[r]);for(let r=0;r<e.length;r++)e[r].click();A.publish("updateFrame","")});A.messageBus.subscribe("clearDimension",o=>{Ta&&(Ta.interrupt(),Ta=null,o&&A.publish("adaptAll",""),A.publish("updateFrame",""))});A.messageBus.rpcService("getAttrList",o=>{let t;o==="allItems"?t=Cr.getAllItem():o==="selectedItems"&&(t=Ve.getComponents());let e=new QU(t),{allItemsAttrList:r,selectedItemsAttrList:i}=e.open();return r});A.subscribe("applyInputAtCursorValue",o=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;Ua.applyInputAtCursorValue.bind(Ua.currTool)(o)});A.subscribe("restoreInputAtCursorValue",()=>{!x.getInstance().isactive||23==x.getInstance().doctype||(dt.editingWhat="")});A.subscribe("valueInputEnd",o=>{Ua.valueInputEnd.bind(Ua.currTool)(o)});A.messageBus.rpcService("setTableParameter",o=>{let t=+o.strokeWidth/10;x.getInstance().unit!=="mil"&&(t=new ft().conversion(x.getInstance().unit,"mil",t)),rt.defaultTable.lineWidth=t,rt.defaultTable.fontSize=+o.fontSize});A.subscribe("updateGridRange",o=>{let{startAngle:t,endAngle:e,minRadius:r,maxRadius:i}=o;we.updateGridRange(mh(t),mh(e),I3(r),I3(i))},$());A.messageBus.rpcService("getGridRange",()=>new Promise((o,t)=>{o({startAngle:W2(we.startAngle),endAngle:W2(we.endAngle),minRadius:QF(we.minRadius),maxRadius:QF(we.maxRadius),unit:x.getInstance().unit})}));A.subscribe("refreshFootprintAttrPanel",o=>{x.getInstance().doctype==4&&A.publish("flushAttrPlane","")},$());A.subscribe("footprintIsConnectDevice",o=>{we.footprintIsConnectDevice=o},$());A.messageBus.rpcService("getFootprintAttr",o=>new A3().getHtmlData());A.messageBus.rpcService("getTabIdAndDocType",()=>({tabId:x.getInstance().tabId,docType:x.getInstance().doctype}));A.messageBus.rpcService("fetchPCBCanvasProfile",o=>({topBoardColor:we.topBoardColor,topSilkscreenColor:we.topSilkscreenColor,bottomBoardColor:we.bottomBoardColor,bottomSilkscreenColor:we.bottomSilkscreenColor}));A.messageBus.rpcService("destoryTriangleDistmeasureTool",()=>(hn.destroy(),A.publish("tool","dropdrag"),!0));A.messageBus.rpcService("isRuningTriangleDistmeasureTool",()=>hn.isRuning);A.messageBus.rpcService("destoryCopySpecialTool",()=>(A.publish("tool","dropdrag"),FN.getInstance().isRunning=!1,!0));A.messageBus.rpcService("isRuningCopySpecialTool",()=>FN.getInstance().isRunning);A.subscribe("updateHistoryMode",o=>{x.getInstance().doctype===3&&(x.getInstance().isHistoryMode=o)},$());A.subscribe("checkIfSelectAlignRefObject",o=>{we.needSelectAlignRefObject=o});A.subscribe("checkIfSelectAlignRefObjectForCenters",o=>{we.needSelectAlignRefObjectForCenters=o});A.subscribe("isCheckedCrossProbeMode",o=>{we.isCheckedCrossProbeMode=o},$());A.messageBus.rpcService("pcb/getComponentInfoById",o=>o.map(e=>{let r={id:e},i=Cr.getItem(e);if(i){r.designator=i.designator||e;let n=i.attrKeyValue;r.footprint=n.Footprint,r.footprintUuid=i.footprintUUID,r.name=i.getFormulaName()||n.Value||n.Device,r.d3Model=n["3D Model Title"]}return r}));A.messageBus.rpcService("pcb/editCustomFootprint",o=>{A.publish("PcbEditFootprint1",o)});function RVe(o){if(!o)return;let t=or.getInstance().encode("PARTITION",o.model);x.getInstance().compiler.uploadPartition(o.globalIndex,{name:t.name,fileUuid:"",path:t.path});let e=new hu("2.0",3,x.getInstance().compiler),r=o.buildBBox(),i=Vt.search(r).getAllItems(),n=[],s=[];i.forEach(a=>{if(a.partition==o.globalIndex){if(a.partition=null,a.refreshRender(),a instanceof ii){n.push(a.model);return}else if(a instanceof Ki){s.push(a.model);return}a.model instanceof vi?e.feedComponent(a.model):(a.model instanceof Je||a.model instanceof It)&&a.model.getParent()!=null?x.getInstance().compiler.uploadPadNet(or.getInstance().encode("PAD_NET",a.model)):e.feedItem(a.model)}}),e.feedCopper(n),e.feedInner(s)}A.messageBus.rpcService("getPcbScene",()=>yi.getScene());A.messageBus.rpcService("pcb/getMouseRecorder",()=>{let o=Kf.getInputInfo(),t=Kf.getRatio();return{clientX:o.mouseX/t,clientY:o.mouseY/t}});A.globalMessageBus.rpcService("GetPanelizePreviewFile2",PKe);A.globalMessageBus.rpcService("getPanelizeSetJson2",()=>{if(Ii.offset==null){let o=ai.getInstance().setJsonParamCache;new _p().applyPanelize(o)}return Ii.getDataForDFM()});A.messageBus.rpcService("pcb/editor/getDxfLayerType2NameMap",()=>{let o=be.getAllLayer(),t={};for(let e of o)if(!gr(e.layerID)&&!_c(e.layerID)&&e.config&&![47,52].includes(e.layerID)&&!ba(e.layerID)&&57!=e.layerID&&!IA(e.layerID)){let r=e.type;r=="CUSTOM"&&e.layerID!=71?r=r+","+(e.layerID-71+1):(r=="SIGNAL"||r=="PLANE")&&e.layerID!=15&&(r=r+","+(e.layerID-15+1)),t[r]=e.name}return t});A.messageBus.rpcService("pcb/editor/getLayerInfoMap",o=>{let{onlyPolyLayer:t}=o||{},e=be.getAllLayer(),r={};for(let i of e){if(!i.config||t&&!(!gr(i.layerID)&&!_c(i.layerID)&&![47,52].includes(i.layerID)&&!ba(i.layerID)&&57!=i.layerID&&!IA(i.layerID)))continue;let n=i.layerID,s={layerId:n,isPlane:i.isPlaneLayer(),layerName:i.name,layerColor:i.color.toString(),isVisible:i.visible};r[n]=s}return r});A.messageBus.rpcService("pro-pcb/editor/batchUpdateShapeState",o=>{let{shapeIds:t,layerId:e,strokeWidth:r,scale:i,isVisible:n,isRemove:s}=o||{};if(!t||t.length==0)return!1;let a=Lc(),l=new Array(t.length),c=0,h=new Set(t);if(a.forEach(d=>{h.has(d.globalIndex)&&(l[c++]=d)}),l.length==0)return!1;let u=!1;if(!s&&e>0&&be.getLayer(e)&&(l.forEach(p=>{p.layerId=e}),u=!0),!s&&r>0&&l.forEach(d=>{d instanceof vt||d instanceof mt?(d.width=r,u=!0):d instanceof Ye||d instanceof fr?(d.strokeWidth=r,u=!0):d instanceof Sr&&(d.strokeWidth=r)}),!s&&i>0&&i!=1){let d=Ae.scale(i);l.forEach(p=>{p.transform(d),p instanceof ct?p.model.childrens.forEach(m=>{m.forEach(g=>{g instanceof yh&&(g.radius*=i)})}):p instanceof fr?p.fontSize*=i:p instanceof Sr&&(p.radius*=i)}),u=!0}return jBe(n)||(l.forEach(d=>{n?d.visible():d.hidden()}),u=!0),s&&(l.forEach(d=>{d.remove()}),u=!0),u&&(A.publish("updateModify",""),A.publish("adaptAll",""),A.publish("autoFill","")),u});A.messageBus.rpcService("pcb/createDownloadStream",async o=>{let t=new fB(o);return await t.create(),t.uuid});A.messageBus.rpcService("pcb/writeDownloadStream",async({id:o,data:t})=>{var e;await((e=fB.getOpenedStream(o))==null?void 0:e.write(t))});A.messageBus.rpcService("pcb/closeDownloadStream",async o=>{var t;await((t=fB.getOpenedStream(o))==null?void 0:t.close())});A.messageBus.rpcService("pcb/getBgColor",()=>x.getInstance().getBgColor().toString());A.messageBus.rpcService("pcb/getExportObjects",()=>Object.entries(TKe).reduce((o,[t,e])=>(e!=null?Ui.getInstance().getItem(e).visible&&o.push(t):o.push(t),o),[]));A.messageBus.rpcService("pcb/performanceData",()=>new pge().getResult());A.messageBus.rpcService("pcb/getDefaultPngSize",(o=!0)=>{let e=2160,r=o?N0():$ue(),i=r.width()/r.height(),n=e/i;return(e>4096||n>4096)&&(e>n?(n=4096/i,e=4096):(e=4096*i,n=4096)),{width:e,height:n}});A.messageBus.rpcService("pcb/setCheckingQRCode",async o=>{var d,p;console.log("pcb/setCheckingQRCode");let{enableDetection:t,coverOil:e}=o;if(JT.isChecked=t,JT.coverOil=e,!t||JT.outlineInfoForQRCode)return;let r;for(let m of be.getAllLayer())if(m.type==="ANALYSIS_OUT_LINE"){r=m.layerID;break}let i=[],n;if(r!=null){n=new Set;let m=(p=(d=Vt.map.get("Polygon"))==null?void 0:d.get(r))==null?void 0:p.items;if(m==null)n=new Set;else for(let g of m){let y=g.item;y instanceof ct&&n.add(y)}}else n=new Set;if(Array.from(n).filter(m=>!m.getParent()).sort((m,g)=>parseInt(m.globalIndex.slice(1))-parseInt(g.globalIndex.slice(1))).forEach(m=>{if(!(m instanceof ct)){console.error("!(item instanceof PcbPolygon)");return}Re.addAll(i,m.primitives)}),i.length!==0){JT.outlineInfoForQRCode=fe.build2(i);return}let s=null,a=[Gl.UNION],l=new _e;Vt.search(Vt.bbox(),m=>m===11).getProfiles().forEach(m=>{l.ext1(m.buildBBox());let g=m.getMathGraphics();if(g instanceof fe)a.push(new hs([g.area(.1)>0?g.reverse():g]));else{let y=g.items.sort((P,T)=>T.bbox().area()-P.bbox().area()),b=[y[0].area(.1)>0?y[0].reverse():y[0]];y.slice(1).forEach(P=>{b.push(P.area(.1)>0?P:P.reverse())}),a.push(new hs(b))}});let c=l.build1(),h=HP([Gl.DIFF,fe.build6(c.extendOfSize(Math.max(c.width(),c.height()))),a]);if(s){let m=s?Qe.scale(10,10):null;h.items.forEach(g=>{g.items.forEach((y,b)=>{s.initColor(b===0?ee.RED:ee.Golden).addPly(y.multiply3(m))})}),s.draw()}let u;if(h.items.length>=2){let m=h.items.slice();xr(m,(y,b)=>b.bbox().area()-y.bbox().area(),0,m.length);let g=m.slice(1);if(g.length===1){let y=g[0];y.items.length===1&&(u=y.items[0])}}u||(u=fe.build6(await(await A.messageBus.rpcCall("getAllBoardBox")).message)),JT.outlineInfoForQRCode=u});dge.getInstance();A.subscribe("modifyRulerTheme",o=>{let t="#FFFFFF",e="#858585",{rulerBgColor:r,rulerStringColor:i}=o;try{Ys.getInstance().rulerBackgroundColor=NIe(r),Ys.getInstance().rulerStringColor=NIe(i)}catch(n){console.error("RulerBackgroundColor Error:",n),Ys.getInstance().rulerBackgroundColor=ee.of3(t),Ys.getInstance().rulerStringColor=ee.of3(e)}},$());var M9=new ft,SZe="-",eMt=10,EZe=20,tMt=30,v_e=M9.mm2mil(1)/10,rMt=M9.mm2mil(3)/10,r7=class extends Xo{constructor(){super(...arguments);this._mainContent=-1;this._isSetHighlight=!1;this._isDestroyed=!0}get globalIndex(){var e;return(e=this._viewDataModel)==null?void 0:e.globalIndex}get name(){var e;return(e=this._viewDataModel)==null?void 0:e.name}get position(){var e;return(e=this._viewDataModel)==null?void 0:e.position}get errType(){var e;return(e=this._viewDataModel)==null?void 0:e.errType}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get locked(){var e;return(e=this._viewDataModel)==null?void 0:e.locked}get contentModel(){var e;return(e=this._viewDataModel)==null?void 0:e.contentModel}get matrix(){var e;return(e=this._viewDataModel)==null?void 0:e.matrix}get bbox2(){var e;return(e=this._viewDataModel)==null?void 0:e.bbox2}get layer(){return bn.getInstance().getLayer(this.layerId).layer}get plane(){return this.layer.plane}shapeVisible(){if(this._isDestroyed){let e=ce.pcbConfig.drcErrorStyle,r=ce.pcbConfig.drcErrorZoom;e==="1"?mf.scene.setDrcRenderStyle(cQ.CROSS):e==="2"&&mf.scene.setDrcRenderStyle(cQ.TRIANGLE);let i=e==="2"?this.getCombineFontDescribes():{leftText:"",rightText:""},n=r==="keepConstantSize"?m0.FIXED:m0.ZOOM;mf.scene.setDrcRenderModel(n);let[s,a,l,c]=r==="keepConstantSize"?[eMt,tMt,EZe,EZe]:[v_e,rMt,v_e,v_e];this._mainContent=this.plane.createOrUpdateDrc(-1,this.position,0,s,a,l,c,i.leftText,i.rightText,this.color,void 0,this.engineGroupId)}}mainVisible(){this.shapeVisible()}maskVisible(e=!1){let r=Ni().getScale();if(e===!0){ce.pcbConfig.drcErrorStyle==="1"&&(ce.pcbConfig.drcErrorZoom==="keepConstantSize"?typeof this._mainContent<"u"&&this._mainContent!==-1&&(this.plane.setHighLightPtNum(this._mainContent,1,1),this._isSetHighlight=!0):ce.pcbConfig.drcErrorZoom==="followObjectScaling"&&typeof this._mainContent<"u"&&this._mainContent!==-1&&(this.plane.setHighLightPtNum(this._mainContent,1,1),this._isSetHighlight=!0)),ce.pcbConfig.drcErrorStyle==="2"&&(ce.pcbConfig.drcErrorZoom==="keepConstantSize"?typeof this._mainContent<"u"&&this._mainContent!==-1&&(this.plane.setHighLightPtNum(this._mainContent,1,1),this._isSetHighlight=!0):ce.pcbConfig.drcErrorZoom==="followObjectScaling"&&typeof this._mainContent<"u"&&this._mainContent!==-1&&(this.plane.setHighLightPtNum(this._mainContent,1,1),this._isSetHighlight=!0));return}if(e===!1){this.maskRemove();return}}visible(){this.maskVisible(!1),this.mainVisible(),this._isDestroyed=!1}highlight(){this.mainVisible(),this.maskVisible(!0),this._isDestroyed=!1}mainRemove(){typeof this._mainContent<"u"&&this._mainContent!==-1&&this.plane.removePt(this._mainContent)}maskRemove(){typeof this._mainContent<"u"&&this._mainContent!==-1&&this._isSetHighlight&&(this.plane.removeHighLightPt(this._mainContent),this._isSetHighlight=!1)}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.maskRemove(),this.mainRemove(),this._isDestroyed=!0,this._mainContent=-1}getCombineFontDescribes(){let e={leftText:"",rightText:""};if(this.contentModel instanceof sf||this.contentModel instanceof iP)return e.leftText=this.getPrimitiveFontDescribe(this.contentModel.obj1Type),e.rightText=this.getPrimitiveFontDescribe(this.contentModel.obj2Type),e;e.leftText=this.getPrimitiveFontDescribe(this.contentModel.obj1Type||this.contentModel.objType||this.contentModel.obj2Type);let r=this.contentModel.errorType;return this.contentModel instanceof Qy?(e.leftText="L",e.rightText="W"):this.contentModel instanceof Jy||this.contentModel instanceof eb||r==="Net Length Range"||this.contentModel instanceof xT||r==="Net Length Tolerance"?(e.leftText="L",e.rightText="N"):this.contentModel instanceof Zy?e.rightText="N":this.contentModel instanceof rP||this.contentModel instanceof tb?(e.leftText="V",e.rightText="D"):this.contentModel instanceof Ky?e.rightText="I":this.contentModel instanceof rb?(e.leftText="L",e.rightText="W"):this.contentModel instanceof s3?(e.leftText="O",e.rightText="O"):e.rightText=SZe,e}getPrimitiveFontDescribe(e){let i={Line:"L",Track:"L",Device:"C","TH Test Point":"P","SMD Test Point":"P","Test Point":"P","TH Pad":"P","SMD Pad":"P",Via:"V",Text:"S","Fill Region":"S","Copper Region":"S","Copper Region(Filled)":"S","Bridging Copper":"S",TearDrop:"S","Plane Zone":"S",Image:"S",Picture:"S",Hole:"H","Slot Region":"H","Prohibited Region":"K","Board Outline":"O"}[e];return i||(console.warn(`Unmatched DRC ObjType: ${e}`),e||SZe)}getBBoxs(){return[this.plane.getPtBboxById(this._mainContent)]}};var sL=class extends Cu{constructor(t,e=null){super(t,e)}getId(){return this.id}visible(t,e,r,i,n,s,a,l=null,c,h){if(this.layerId!==t&&this.isValidId()){let u=this.plane;this.forceVisibleHighLight(!1),u.removePt(this.id),this.resetId()}this.layerId=t,!Sa.unRefreshScene&&(this.id=this.plane.createOrUpdateScaleString(this.id,e,r,i,n,s,a,void 0,l!=null?l:void 0,c,h))}getBBox(){return this.plane.getPtBboxById(this.id)}};var vK=class extends Cu{constructor(t,e=null){super(t,e)}getId(){return this.id}visible(t,e,r,i,n){this.layerId!==t&&this.isValidId()&&(this.plane.removePt(this.id),this.resetId()),this.layerId=t,!Sa.unRefreshScene&&(this.id=this.plane.createOrUpdateDrcArrow(this.id,e,r,i,n))}getBBox(){return this.plane.getPtBboxById(this.id)}};var i7=class extends Xo{constructor(){super(...arguments);this._isSetHighlight=!1;this._startArrowId=-1;this._endArrowId=-1;this._textId=-1;this.startArrow=null;this.endArrow=null;this.zoomText=null;this.fixText=null;this.direction=new S(0,0);this.lineAngle=0;this.perpDirection=new S(0,0)}get renderModel(){return ce.pcbConfig.drcErrorZoom==="keepConstantSize"?m0.FIXED:m0.ZOOM}get plane(){return this.layerId?bn.getInstance().getLayer(this.layerId).layer.plane:null}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get startPoint(){var e;return(e=this._viewDataModel)==null?void 0:e.start}get endPoint(){var e;return(e=this._viewDataModel)==null?void 0:e.end}get manualHighLight(){var e;return(e=this._viewDataModel)==null?void 0:e.manualHighLight}get viewGroupId(){var e;return this.getEngineGroupId((e=this._viewDataModel)==null?void 0:e.viewGroupId)}get str(){var e;return((e=this._viewDataModel)==null?void 0:e.text)||""}get textAngle(){let e=(this.lineAngle+2*Tu)%(2*Tu);return e>=Tu/2&&e<=3*Tu/2?this.lineAngle+Tu:this.lineAngle}get textWidth(){var e;return((e=this._viewDataModel)==null?void 0:e.textWidth)||0}get textHeight(){return this.renderModel===m0.FIXED?6:M9.mm2mil(.5)/10}get highlightColor(){var e;return(e=this._viewDataModel)==null?void 0:e.highlightColor}calculateLineGeometry(){!this.startPoint||!this.endPoint||(this.direction=new S(this.endPoint.x-this.startPoint.x,this.endPoint.y-this.startPoint.y),this.lineAngle=Math.atan2(this.direction.y,this.direction.x),this.perpDirection=new S(-this.direction.y,this.direction.x).normalize())}get textPosition(){return!this.startPoint||!this.endPoint?new S(0,0):this.startPoint.add(this.endPoint).mul(.5).add(this.perpDirection.mul(5))}updateArrows(){var e,r;!this.startPoint||!this.endPoint||!this.plane||(this.calculateLineGeometry(),this.startArrow||(this.startArrow=new vK(this.layerId)),this.startArrow.visible(this.layerId,this.startPoint,this.lineAngle,void 0,this.viewGroupId),this._startArrowId=(e=this.startArrow.getId())!=null?e:-1,this.endArrow||(this.endArrow=new vK(this.layerId)),this.endArrow.visible(this.layerId,this.endPoint,this.lineAngle+Tu,void 0,this.viewGroupId),this._endArrowId=(r=this.endArrow.getId())!=null?r:-1)}updateText(){this.str&&(this.renderModel===m0.ZOOM?this.updateZoomText():this.updateFixedText())}updateZoomText(){var e;this.zoomText||(this.zoomText=new sL(this.layerId)),this.zoomText.visible(this.layerId,this.str,this.textPosition,this.textAngle,this.textWidth,this.textHeight,void 0,this.viewGroupId),this._textId=(e=this.zoomText.getId())!=null?e:-1}updateFixedText(){var e;this.fixText||(this.fixText=new jl(this.layerId)),this.fixText.visible(this.layerId,this.str,this.textPosition,this.textAngle,Wc,zc,this.textWidth,this.textHeight,void 0,this.viewGroupId),this._textId=(e=this.fixText.getId())!=null?e:-1}setHighlightVisible(e){this.plane&&(e&&!this._isSetHighlight?(this._startArrowId!==-1&&this.plane.setHighLightPtNum(this._startArrowId,1,1),this._endArrowId!==-1&&this.plane.setHighLightPtNum(this._endArrowId,1,1),this._textId!==-1&&this.plane.setHighLightPtNum(this._textId,1,1),this._isSetHighlight=!0):!e&&this._isSetHighlight&&(this._startArrowId!==-1&&this.plane.removeHighLightPt(this._startArrowId),this._endArrowId!==-1&&this.plane.removeHighLightPt(this._endArrowId),this._textId!==-1&&this.plane.removeHighLightPt(this._textId),this._isSetHighlight=!1))}visible(){this.calculateLineGeometry(),this.updateArrows(),this.updateText(),this.setHighlightVisible(!1)}highlight(){this.visible(),this.setHighlightVisible(!0)}modify(e,r){super.modify(e,r),this._viewDataModel=e,this.calculateLineGeometry(),r==="Only Main"?this.visible():r==="Main And Highlight"&&this.highlight()}remove(){var e,r,i,n;this.setHighlightVisible(!1),(e=this.startArrow)==null||e.remove(),(r=this.endArrow)==null||r.remove(),(i=this.zoomText)==null||i.remove(),(n=this.fixText)==null||n.remove(),this.startArrow=null,this.endArrow=null,this.zoomText=null,this.fixText=null,this._isSetHighlight=!1,this._startArrowId=-1,this._endArrowId=-1,this._textId=-1}getBBoxs(){let e=[];if(this.startArrow){let i=this.startArrow.getBBox();i&&e.push(i)}if(this.endArrow){let i=this.endArrow.getBBox();i&&e.push(i)}let r=null;return this.renderModel===m0.ZOOM&&this.zoomText?r=this.zoomText.getBBox():this.fixText&&(r=this.fixText.getBBox()),r&&e.push(r),e}};var n7=class extends Xo{constructor(){super(...arguments);this.circle=null;this.zoomText=null;this.fixText=null;this.circleMask=null;this.renderModel=ce.pcbConfig.drcErrorZoom==="keepConstantSize"?m0.FIXED:m0.ZOOM;this._circleId=-1;this._textId=-1;this._circleMaskId=-1;this._isSetHighlight=!1}get plane(){return this.layerId?bn.getInstance().getLayer(this.layerId).layer.plane:null}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get layerModified(){var e;return(e=this._viewDataModel)==null?void 0:e.layerModified}get viewGroupId(){var e;return this.getEngineGroupId((e=this._viewDataModel)==null?void 0:e.viewGroupId)}get center(){var e;return(e=this._viewDataModel)==null?void 0:e.center}get radius(){var e;return(e=this._viewDataModel)==null?void 0:e.radius}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}get str(){var e;return(e=this._viewDataModel)==null?void 0:e.str}get textPosition(){var e;return(e=this._viewDataModel)==null?void 0:e.textPosition}get angle(){var e,r;return(r=(e=this._viewDataModel)==null?void 0:e.angle)!=null?r:0}get textWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.textWidth}get textHeight(){var e;return(e=this._viewDataModel)==null?void 0:e.textHeight}get textColor(){var e;return(e=this._viewDataModel)==null?void 0:e.textColor}get highlightColor(){var e;return(e=this._viewDataModel)==null?void 0:e.highlightColor}get highLightType(){var e;return(e=this._viewDataModel)==null?void 0:e.highLightType}get forceUpdateMask(){var e;return((e=this._viewDataModel)==null?void 0:e.forceUpdateMask)||!1}updateCircle(){var r,i;(!this.circle||this.layerModified)&&((r=this.circle)==null||r.remove(),this.circle=new fl(this.layerId)),this.circle.visible(this.layerId,this.center,this.radius,M9.mm2mil(.1)/10,0,Vr,le.CCW,this.color,this.engineGroupId),this.circle&&(this._circleId=(i=this.circle.getId())!=null?i:-1)}updateCircleMask(e=!1){var i,n;(e||this.forceUpdateMask||!this.circleMask||this.layerModified)&&((i=this.circleMask)==null||i.remove(),this.circleMask=new fl(1002),this.circleMask.visible(1002,this.center,this.radius,M9.mm2mil(.1)/10,0,Vr,le.CCW,this.highlightColor,this.engineGroupId),this.circleMask&&(this._circleMaskId=(n=this.circleMask.getId())!=null?n:-1))}updateString(){mf.scene.setDrcRenderModel(this.renderModel),this.renderModel==m0.ZOOM?this.updateScaleString():this.renderModel==m0.FIXED&&this.updateFixedString()}updateScaleString(){var r,i;(!this.zoomText||this.layerModified)&&((r=this.zoomText)==null||r.remove(),this.zoomText=new sL(this.layerId)),this.zoomText.visible(this.layerId,this.str,this.textPosition,this.angle,this.textWidth,this.textHeight,this.textColor,this.engineGroupId),this.zoomText&&(this._textId=(i=this.zoomText.getId())!=null?i:-1)}updateFixedString(){var r,i;(!this.fixText||this.layerModified)&&((r=this.fixText)==null||r.remove(),this.fixText=new jl(this.layerId)),this.fixText.visible(this.layerId,this.str,this.textPosition,this.angle,Wc,zc,this.textWidth,this.textHeight,void 0,this.viewGroupId),this.fixText&&(this._textId=(i=this.fixText.getId())!=null?i:-1)}setHighlightVisible(e){this.plane&&(e&&!this._isSetHighlight?(this._circleId!==-1&&this.plane.setHighLightPtNum(this._circleId,1,1),this._textId!==-1&&this.plane.setHighLightPtNum(this._textId,1,1),this._circleMaskId!==-1&&this.plane.setHighLightPtNum(this._circleMaskId,1,1),this._isSetHighlight=!0):!e&&this._isSetHighlight&&(this._circleId!==-1&&this.plane.removeHighLightPt(this._circleId),this._textId!==-1&&this.plane.removeHighLightPt(this._textId),this._circleMaskId!==-1&&this.plane.removeHighLightPt(this._circleMaskId),this._isSetHighlight=!1))}handleHighlight(e=!1){this.updateCircle(),this.updateCircleMask(!0),this.updateString(),this.setHighlightVisible(!0)}removeMask(){var e;this.circleMask&&(this.plane&&this._circleMaskId!==-1&&this.plane.removeHighLightPt(this._circleMaskId),(e=this.circleMask)==null||e.remove(),this.circleMask=null,this._circleMaskId=-1)}visible(){this.updateCircle(),this.updateString(),this.removeMask(),this.setHighlightVisible(!1)}highlight(e=!1){this.handleHighlight(e)}modify(e,r){super.modify(e,r),this._viewDataModel=e,r==="Only Main"?this.visible():r==="Main And Highlight"&&this.highlight(e.forceUpdateMask)}remove(){var e,r,i;this.setHighlightVisible(!1),(e=this.circle)==null||e.remove(),(r=this.zoomText)==null||r.remove(),(i=this.fixText)==null||i.remove(),this.removeMask(),this.circle=null,this.zoomText=null,this.fixText=null,this._circleId=-1,this._textId=-1,this._circleMaskId=-1}getBBoxs(){let e=this.circle.getBBox(),r;return this.renderModel==m0.ZOOM?r=this.zoomText.getBBox():this.renderModel==m0.FIXED&&(r=this.fixText.getBBox()),[e,r]}};var o7=class extends Xo{constructor(){super(...arguments);this._isSetHighlight=!1;this._textId=-1;this.lines=[];this.zoomText=null;this.fixText=null;this.lineAngle=0}get renderModel(){return ce.pcbConfig.drcErrorZoom==="keepConstantSize"?m0.FIXED:m0.ZOOM}get plane(){return this.layerId?bn.getInstance().getLayer(this.layerId).layer.plane:null}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get startPoint(){var e;return(e=this._viewDataModel)==null?void 0:e.start}get endPoint(){var e;return(e=this._viewDataModel)==null?void 0:e.end}get manualHighLight(){var e;return(e=this._viewDataModel)==null?void 0:e.manualHighLight}get viewGroupId(){var e;return this.getEngineGroupId((e=this._viewDataModel)==null?void 0:e.viewGroupId)}get str(){var i,n;let e=((i=this._viewDataModel)==null?void 0:i.ruleText)||"",r=((n=this._viewDataModel)==null?void 0:n.text)||"";if(e&&r)return`<${e}(${r})`}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}get textAngle(){let e=(this.lineAngle+2*Tu)%(2*Tu);return e>=Tu/2&&e<=3*Tu/2?this.lineAngle+Tu:this.lineAngle}get textWidth(){var e;return((e=this._viewDataModel)==null?void 0:e.textWidth)||0}get textHeight(){let e=new ft;return this.renderModel===m0.FIXED?6:e.mm2mil(.5)/10}get textColor(){var e;return(e=this._viewDataModel)==null?void 0:e.textColor}get highlightColor(){var e;return(e=this._viewDataModel)==null?void 0:e.highlightColor}updateLines(){var i,n;this.lines.forEach(s=>s.remove()),this.lines=[];let e=new _e;if(!((i=this._viewDataModel)!=null&&i.path))return;for(let s of this._viewDataModel.path){if(s instanceof M){let a=new Ws(this.layerId);a.visible(this.layerId,s.start().clone(),s.end().clone(),.01,this.color,this.viewGroupId),this.lines.push(a)}else if(s instanceof q){let a=new fl(this.layerId),l=s.center,c=s.ry,h=mh(s.startAngle),u=mh(s.sweepAngle),d=u+h,p=u>=0?le.CCW:le.CW;a.visible(this.layerId,l,c,.01,h,d,p,this.color,this.viewGroupId),this.lines.push(a)}e.ext1(s.bbox())}let r=(n=e.build())==null?void 0:n.center();this.textPosition=new S(r.x,r.y+1)}updateText(){this.str&&(this.renderModel===m0.ZOOM?this.updateZoomText():this.updateFixedText())}updateZoomText(){var e;this.zoomText||(this.zoomText=new sL(this.layerId)),this.zoomText.visible(this.layerId,this.str,this.textPosition,this.textAngle,this.textWidth,this.textHeight,void 0,this.viewGroupId),this._textId=(e=this.zoomText.getId())!=null?e:-1}updateFixedText(){var e;this.fixText||(this.fixText=new jl(this.layerId)),this.fixText.visible(this.layerId,this.str,this.textPosition,this.textAngle,Wc,zc,this.textWidth,this.textHeight,this.textColor,this.viewGroupId),this._textId=(e=this.fixText.getId())!=null?e:-1}setHighlightVisible(e){this.plane&&(e&&!this._isSetHighlight?(this.lines.forEach(r=>{let i=r.getId();i!==-1&&this.plane.setHighLightPtNum(i,1,1)}),this._textId!==-1&&this.plane.setHighLightPtNum(this._textId,1,1),this._isSetHighlight=!0):!e&&this._isSetHighlight&&(this.lines.forEach(r=>{let i=r.getId();i!==-1&&this.plane.removeHighLightPt(i)}),this._textId!==-1&&this.plane.removeHighLightPt(this._textId),this._isSetHighlight=!1))}visible(){this.updateLines(),this.updateText(),this.setHighlightVisible(!1)}highlight(){this.visible(),this.setHighlightVisible(!0)}modify(e,r){super.modify(e,r),this._viewDataModel=e,r==="Only Main"?this.visible():r==="Main And Highlight"&&this.highlight()}remove(){var e,r;this.setHighlightVisible(!1),this.lines.forEach(i=>i.remove()),this.lines=[],(e=this.zoomText)==null||e.remove(),(r=this.fixText)==null||r.remove(),this.zoomText=null,this.fixText=null,this._textId=-1,this._isSetHighlight=!1}getBBoxs(){let e=[],r=new _e;this.lines.forEach(n=>{let s=n.getBBox();s&&r.ext1(s)}),e.push(r.build());let i=null;return this.renderModel===m0.ZOOM&&this.zoomText?i=this.zoomText.getBBox():this.fixText&&(i=this.fixText.getBBox()),i&&e.push(i),e}};var x_e=class{constructor(){this.groupMap=new Map;this.tempMap=new Map;this.fpcOrConstraintIdMap=new Map;this.sameModel=new Set([23,2,21,6])}isMatch(t,e){switch(e){case 0:return t instanceof dY;case 1:return t instanceof pY;case 2:return t instanceof fY;case 3:return t instanceof DM;case 24:return t instanceof WM;case 4:return t instanceof yY;case 5:return t instanceof bY;case 6:return t instanceof PY;case 7:return t instanceof TY;case 8:return t instanceof IY;case 9:return t instanceof CY;case 10:return t instanceof YY;case 11:return t instanceof SY;case 12:return t instanceof UY;case 13:return t instanceof zx;case 14:return t instanceof HY;case 15:return t instanceof WY;case 21:return t instanceof cT;case 22:return t instanceof jY;case 23:return t instanceof XY;case 25:return t instanceof zY;case 27:return t instanceof gY;case 28:return t instanceof qY;case 29:return t instanceof $Y;case 31:return t instanceof ZY;case 32:return t instanceof JY;case 33:return t instanceof QY;case 17:return t instanceof r7;case 18:return t instanceof i7;case 19:return t instanceof n7;case 20:return t instanceof o7;default:return!1}}createNewView(t){switch(t){case 22:return new jY;case 0:return new dY;case 9:return new CY;case 23:return new XY;case 2:return new fY;case 8:return new IY;case 1:return new pY;case 21:return new cT;case 25:return new zY;case 12:return new UY;case 24:return new WM;case 3:return new DM;case 13:return new zx;case 27:return new gY;case 4:return new yY;case 5:return new bY;case 6:return new PY;case 7:return new TY;case 10:return new YY;case 11:return new SY;case 14:return new HY;case 15:return new WY;case 16:return new zx;case 28:return this.panelizeView==null&&(this.panelizeView=new qY),this.panelizeView;case 29:return new $Y;case 31:return new ZY;case 32:return new JY;case 33:return new QY;case 30:return new are;case 17:return new r7;case 18:return new i7;case 19:return new n7;case 20:return new o7;default:return null}}clearTemp(){this.tempMap=null}getMap4Type(t){return this.tempMap=this.groupMap.get(t),this.tempMap==null&&(this.tempMap=new Map,this.groupMap.set(t,this.tempMap)),this.tempMap}getType(t){switch(t){case 23:return 2;case 2:return 23;case 21:return 6;case 6:return 21;default:return null}}createView(t,e,r){return this.view=r.get(t),!this.view&&this.sameModel.has(e)&&(this.view=this.getView(t,this.getType(e))),this.isMatch(this.view,e)?this.view:(this.view!=null&&(this.view.remove(),this.sameModel.has(e)&&this.delete(t,this.getType(e))),this.view=this.createNewView(e),r.set(t,this.view),this.view)}getView(t,e){var r;return(r=this.groupMap.get(e))==null?void 0:r.get(t)}delete(t,e){var i;if(this.tempMap=this.groupMap.get(e),this.tempMap==null)return;let r=this.tempMap.get(t);r!=null&&r.remove(),this.tempMap.delete(t),(i=this.fpcOrConstraintIdMap.get(e))==null||i.delete(t)}clear(){this.groupMap.clear(),this.fpcOrConstraintIdMap.clear()}iterator(t){e:for(let[,e]of this.groupMap)for(let[r,i]of e)if(t(i,r))break e}},ay=new x_e;var s7=class s7{constructor(){this.map={};this._netBaseRefreshStatus=0;this.engineGroupIdMap=new Map;this._lastGroupInfo=new Map;this.id=-1}static getInstance(){return s7.manager==null&&(s7.manager=new s7),s7.manager}getNetBaseRefreshStatus(t,e,r,i,n){let s=0,a=0;return s=T0.update(s,a++,t),s=T0.update(s,a++,e),s=T0.update(s,a++,r),s=T0.update(s,a++,i),s=T0.update(s,a++,n),s}getNetBaseRefreshByStatus(t){T0.has(t,0),T0.has(t,0);let e=0,r=T0.has(t,e++),i=T0.has(t,e++),n=T0.has(t,e++),s=T0.has(t,e++),a=T0.has(t,e++);return{topDiff:r,botDiff:i,multiDiff:n,topStiffenerDiff:s,botStiffenerDiff:a}}refreshBaseNetByLayerStatus(){var T;if(ay.fpcOrConstraintIdMap.size==0)return;let t=this.getLayer(47).status.visible,e=this.getLayer(1).status.visible,r=this.getLayer(2).status.visible,i=this.getLayer(12).status.visible,n=t!=e,s=t!=r,a=t!=i,l=(T=this.getLayer(1003))==null?void 0:T.status.visible,c=this.getLayer(58).status.visible,h=this.getLayer(59).status.visible,u=l!=c,d=l!=h,p=this.getNetBaseRefreshByStatus(this._netBaseRefreshStatus),m=n!=p.topDiff,g=s!=p.botDiff,y=a!=p.multiDiff,b=u!=p.topStiffenerDiff,P=d!=p.botStiffenerDiff;(m||g||y||b||P)&&(ay.fpcOrConstraintIdMap.forEach((I,C)=>{I.forEach(E=>{let O=ay.getView(E,C);if(O instanceof WM||O instanceof DM||O instanceof zx){let _=O.layerId;(_==1&&m||_==2&&g||_==12&&y)&&(this.getLayer(_).status.visible?O.holeBaseNetVisible():O.holeBaseNetRemove()),(_==58&&b||_==59&&P)&&(this.getLayer(_).status.visible?O.fpcBaseNetVisible():O.fpcBaseNetRemove())}})}),this._netBaseRefreshStatus=this.getNetBaseRefreshStatus(n,s,a,u,d))}refresh(){this.refreshBaseNetByLayerStatus()}addLayer(t,e,r,i,n,s,a,l){if(this.scene||(this.scene=t,this.layerGroup=new x2(void 0,!1,"planes"),this.scene.group.add(this.layerGroup)),this.map[e]==null){let c=new fte(t,e,r,i,n,s,this.checkIgnoreForceHighLight(e),a,this.layerGroup,l);return this.map[e]=c,c}else{let c=this.map[e];return c.order=r,c.copperOrder=l,c.activeColor=i,c.deactiveColor=n,c.status=s,c.isUnderGrid=a,c}}checkIgnoreForceHighLight(t){switch(t){case 48:case 51:case 50:case 49:return!0;default:return!1}}getLayer(t){return this.map[t]}deleteLayer(t){let e=this.map[t];e.clear(),delete this.map[t],this.layerGroup.remove(e.layer.plane)}getEngineGroupId(t){if(!t)return-1;if(!Ya.useWebgl)return this.id=this.engineGroupIdMap.get(t),this.id==null?(this.id=this.scene.addPtGroup(),this.engineGroupIdMap.set(t,this.id),this.id):this.id}removeEngineGroup(t){this.id=this.engineGroupIdMap.get(t),this.id!=null&&(this.engineGroupIdMap.delete(t),this.scene.removePtGroup(this.id))}setEngineGroupVisible(t,e){if(!this.engineGroupIdMap.has(t))return;let r=this.engineGroupIdMap.get(t),i=this._lastGroupInfo.get(r);i&&i.visible==e.visible&&i.highLightType==e.highLightType&&i.doubleRgb==e.doubleRgb||(this.scene.setPtGroup(r,e.visible,e.doubleRgb,e.highLightType,e.isForceHighLight),this._lastGroupInfo.set(r,e))}getHighLightPlane(t){return this.scene.getHighLightPlane(t)}setHighLightColor(t,e){return this.scene.setHighLightColor(t,e)}};s7.manager=null;var bn=s7;var bH=class{refresh(){}};var Mge=class extends bH{constructor(t){super(),this.frame=t}notify(t){let e=bn.getInstance(),r;for(let i of t)r=i.getRenderData(),e.addLayer(this.frame.scene,r.layerId,r.order,r.activeColor,r.deactiveColor,r.layerState,r.isUnderGrid,r.copperOrder)}refresh(){bn.getInstance().refresh()}};function OZe(o){return"getBBoxs"in o&&typeof o.getBBoxs=="function"}var Nge=class{constructor(t=new TU){this.injectorMap=new Map;this.styleProxy=t}identifyViewType(t){return t instanceof r7||t instanceof i7||t instanceof n7||t instanceof o7}initViewStyle(t){if(this.identifyViewType(t))try{this.styleProxy.setupDrcArrowStyle()}catch(r){console.error(`ViewChannel: Failed to initialize style ${r}`)}}inject(t,e){if(!this.isInjectable(t))return;let r=i=>{e.injectedBBox(i),i&&Vt.insert(e)};this.injectorMap.set(t,r),this.injectViewBBox(t)}injectViewBBox(t){let e=this.injectorMap.get(t);if(e)try{let r=OZe(t)?t.getBBoxs():null;e(r)}catch(r){console.error("ViewChannel: BBox injection failed:",t,r),e(null)}}remove(t){let e=this.injectorMap.get(t);e&&(e(null),this.injectorMap.delete(t))}isInjectable(t){let e=this.identifyViewType(t),r=OZe(t);return e&&r&&!this.injectorMap.has(t)}};var kge=class extends bH{constructor(){super(...arguments);this.viewChannel=new Nge}notifyShape(e,r){if(e.size==0)return;let i,n,s,a,l=!1,c=ay.getMap4Type(r);for(let[h,u]of e){n=this.getEngineGroupId(h);for(let d of u)if(s=d.globalIndex,i=d.getViewState(),i=="Not Shown")d instanceof zs&&d.resetReadRender(),ay.delete(s,r),this.viewChannel.remove(c.get(s));else{if(a=ay.createView(s,r,c),!a)continue;!l&&[17,18,19,20].includes(r)&&(this.viewChannel.initViewStyle(a),l=!0),a.engineGroupId=n,a.modify(d.getRenderData(),i),d.resetModelNotify&&d.resetModelNotify(),this.viewChannel.inject(a,d)}}}notifyProfile(e,r){var c;if(e.size==0)return;let i,n,s,a,l=ay.getMap4Type(r);for(let[h,u]of e){n=this.getEngineGroupId(h);for(let d of u)if(s=d.globalIndex,i=d.getViewState(),i=="Not Shown")d instanceof zs&&d.resetReadRender(),ay.delete(s,r);else{if(a=ay.createView(s,r,l),!a)continue;if(this.isFpcOrConstraint(d)){let p=ay.fpcOrConstraintIdMap.get(r);p==null&&(p=new Set,ay.fpcOrConstraintIdMap.set(r,p)),p.add(s)}else(c=ay.fpcOrConstraintIdMap.get(r))==null||c.delete(s);a.engineGroupId=n,a.modify(d.getRenderData(),i),d.resetModelNotify&&d.resetModelNotify()}}}notifyLineOrArc(e,r){for(let[i,n]of r)if(i==null){let s=new Map;for(let a of n){let l=a.viewGroupId,c=s.get(l);c==null&&(c=new Set,s.set(l,c)),c.add(a)}this.notifyShape(s,e)}else this.notifyShape(r,e)}notify(e){if(e.size==0)return;this.refreshHighLightColor();let r=e.get(8);r!=null&&(this.notifyLineOrArc(8,this.getGroupIdMap(r)),e.delete(8));let i=e.get(1);i!=null&&(this.notifyLineOrArc(1,this.getGroupIdMap(i)),e.delete(1));for(let[n,s]of e)n==3||n==24||n==13?this.notifyProfile(this.getGroupIdMap(s),n):this.notifyShape(this.getGroupIdMap(s),n),s.length=0;ay.clearTemp()}getGroupIdMap(e){let r=new Map,i;for(let n of e){i=n.viewGroupId;let s=r.get(i);s==null&&(s=new Set,r.set(i,s)),s.add(n)}return r}getEngineGroupId(e){if(e)return bn.getInstance().getEngineGroupId(e)}isFpcOrConstraint(e){if(e.model&&e.model instanceof lr){let r=e.model.component;return r==null?!1:r instanceof Du||r instanceof nu}}refixHighLightColor(e){if(e.equals(ee.BLACK,!0)){let r=ee.DefaultHighLightColor;return e.alpha==1?r:ee.build(r.r,r.g,r.b,e.alpha)}return e}refreshHighLightColor(){if(!W8e())return;let e=this.refixHighLightColor(tj(!1)),r=this.refixHighLightColor(tj(!0)),i=bn.getInstance();i.setHighLightColor(e,1),i.setHighLightColor(r,0),z8e(!1)}};var AZe=!!window["USE-IFRAME-FOR-MAIN"];if(!AZe)try{$().sensorsDataFromTopWindow}catch{AZe=window["USE-IFRAME-FOR-MAIN"]=!0}var mf=new pte(z_);function _Ze(){mf.renderFrame(),requestAnimationFrame(_Ze)}requestAnimationFrame(_Ze);var iMt=new kge,nMt=new Mge(mf);Do.setState(iMt);Do.setLayerState(nMt);ie.subscribe("updateModify",()=>{Do.modify()});function Bge(){let o=0;for(let t of Bg){t.active&&(o=t.layerId);let e=be.addPcbLayer(t.layerId,t.type,t.name,t.order,t.activeColor,t.deactiveColor,t.active,t.layerStatus);e.layerID===57&&(e.locked=!0)}be.setActiveLayerId(o)}var a7=class a7{static getInstance(){return a7.manager==null&&(a7.manager=new a7),a7.manager}constructor(){this._currUser=zb.getInstance()}get currUser(){return this._currUser.currUser}get selectMap(){return this._currUser.selectMap}get selectIdMap(){return this._currUser.selectIdMap}get colorMap(){return this._currUser.colorMap}get maskColorMap(){return this._currUser.maskColorMap}async otherSelect(t,e,r=!1){var h,u;if(t==this.currUser)return;let i=new er,n=this.selectMap.get(t);n||(n=new Set,this.selectMap.put(t,n));let s=new Set,a=[],l=new Set;e.forEach(d=>{n.has(d.id)?s.add(d.id):a.push(d),l.add(d.id)}),n.forEach(d=>{if(s.has(d))return;let p=this.selectIdMap.get(d);if(p&&(p.selectUserIds.delete(t),p.selectUserIds.size==0&&this.selectIdMap.del(d),p.currId==t)){let m=i.getItemByType(d,p.type);p.selectUserIds.size>0?(p.currId=Array.from(p.selectUserIds).shift(),m.click(!1,!0)):m&&!m.isEmpty&&m.visible(!0)}});let c=this.colorMap.get(t);if(!c){let d=(await ie.windowBridge.rpcCall("getUserColor",t,$())).message;if(!d){console.warn("\u989C\u8272\u83B7\u53D6\u4E0D\u5230"),r||this.destroy(t);return}c=ee.of3(d),this.maskColorMap.put(t,c);let p=(u=(h=ce)==null?void 0:h.themeConfig)==null?void 0:u.canvasTheme;if(p){let m=p.selectTransparency;c=ee.of6(c,1-m)}this.colorMap.put(t,c)}a.forEach(({type:d,id:p})=>{let m=this.selectIdMap.get(p);if(m){m.selectUserIds.add(t);return}let g=i.getItemByType(p,d),y=new Set;if(y.add(t),!g||g.isEmpty){m={selectUserIds:y,currId:t,type:d},this.selectIdMap.put(p,m);return}g.isHighLight?m={selectUserIds:y,currId:this.currUser,type:d}:(m={selectUserIds:y,currId:t,type:d},g.click(!1,!0)),this.selectIdMap.put(p,m)}),this.selectMap.put(t,l),ie.publish("updateFrame","")}destroy(t){t!=this.currUser&&(this.otherSelect(t,[],!0),this.colorMap.del(t),this.selectMap.del(t),this.maskColorMap.del(t))}};a7.manager=null;var Fge=a7;var Vge=class{constructor(){this.lastStr=""}};var Gge=class extends Vge{constructor(){super();this.selectHandle=null;this.selectManage=null;this.setHandle(Fge.getInstance()),this.setManage(Ve)}setHandle(e){this.selectHandle=e}setManage(e){this.selectManage=e}async onSelected(e,r,i){var s;if(!i)return;let n=JSON.parse(i);n.action=="select"&&await((s=this.selectHandle)==null?void 0:s.otherSelect(e.uuid,n.data))}getSelect(){return this.selectManage.getSelectStr()}onDestroy(e,r){var i;(i=this.selectHandle)==null||i.destroy(e)}};var Uge=class{supports(t){return!1}execute(t){}};var Hge=class extends Uge{supports(t){return t.operation=="Main"}execute(t){switch(t.action){case"add":case"modify":{let e=t.data;e instanceof N1?this.uploadRule(e):this.uploadRuleSelector(e);break}case"delete":{let e=t.data;e instanceof N1?x.getInstance().compiler.deleteRule(mm(Oie(e)),e.name):x.getInstance().compiler.deleteRuleSelector(Eie(e));break}}}checkModelRule(t){t instanceof lr}uploadRuleSelector(t){x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",t))}uploadRule(t){x.getInstance().compiler.uploadRule(or.getInstance().encode("RULE",t))}uploadRuleTemplate(){x.getInstance().compiler.uploadRuleTemplate(or.getInstance().encode("RULE_TEMPLATE"))}};(()=>{let o=ee.build(1,1,1,.5),t=ee.build(1,1,1,1),e=$e.getInstance().addHelpLayer(1001,"OTHER","DRCError",new vf(3),ee.of1(16438793),ee.of1(16438793)),r=$e.getInstance().addHelpLayer(1002,"OTHER","montu",new vf(3),o,o),i=$e.getInstance().addHelpLayer(1005,"OTHER","montu2",new vf(3),t,t),n=$e.getInstance().addHelpLayer(1003,"OTHER","TextColor",new vf(3),o,o),s=$e.getInstance().addHelpLayer(1004,"OTHER","PartitionLayer",new vf(3),t,t),a=$e.getInstance().addHelpLayer(1006,"OTHER","board",new vf(3),ee.of1(0),ee.of1(0)),l=new m2(e,!1,4);Au.DRCLayer=l,new m2(r,!1,1),new m2(n,!1,5),new m2(s,!1,6),new m2(i,!1,1),new m2(a,!1,1,!0);let c=async h=>{var J,oe,pe,ge;if(!h)return;let{docType:u,tabId:d,saveFile:p,unActive:m,highlightItems:g,commSystemSetting:y,pcbConfig:b,drcCustomSetting:P,isNew:T,owner:I,importFlag:C,source:E,customerCode:O,clientOnlineService:_,isReadOnlyMode:R,isConcurrentStrictMode:v,pcbLevelType:D,isFromBasicLibrary:w,alignNeedSelectRefObject:F,alignNeedSelectRefObjectForCenters:H,name:z,projectTitle:G,footprintIsConnectDevice:W,hideDxfLoading:L,activeLayerId:B,unChangeRepairLineTool:N,isPlaceViasAutoShove:U,isPreview:k,dataStr:V,isOldDataString:Y,user:X,currOpenProjectId:Z,isNeedInitRuleWhenCreatedByCBBTemplate:Q,envFlag:ae,isCheckedCrossProbeMode:he}=h,re=x.getInstance();Mn.getInstance().start();let se=((J=document.querySelector('meta[name="editorMainVersion"]'))==null?void 0:J.getAttribute("content"))||"",K="rpcInitFrameInfoInit-time";pn(K),ce.changeRepairLineTool=!N,ce.isPlaceViasAutoShove=!!U,re.editorVersion=se,re.owner=I,re.importFlag=C,re.source=E,re.customerCode=O,re.clientOnlineService=_,re.isReadOnlyMode=R,re.isConcurrentStrictMode=v,re.name=z,re.projectTitle=G,re.currOpenProjectId=Z,re.workerName="main",Bt.setIsChildPcb(D=="CHILD"),we.needSelectAlignRefObject=F,we.needSelectAlignRefObjectForCenters=H,we.isCheckedCrossProbeMode=he,u==3&&!k&&(re.currVersionUUid=(await ie.windowBridge.rpcCall("getCurrVersion","",$())).message||""),Aje(y,P,k,u),await mf.initScene(u),yhe(u,d,k,ae),!k&&u===4&&(HN.updateLayerWithFootprint(),we.footprintIsConnectDevice=W),b&&(bhe(b),che(b.PCB_REALTIME_DRC.checked,!0)),Bge();let me=!k&&u===3&&!Sa.unRebuildRatline&&jA.userWorker&&!m;Ya.multiThreadingOnOpen=me;let Oe;if(me){let Se=re.id,De=re.projectId,tt={uuid:Se,docType:u,projectId:De,env:{tabId:re.tabId,windowTabId:(oe=$())==null?void 0:oe._TAB_ID_}},Ze=pf.getInstance();await Ze.addWorker(`editor?entry=pcb-ratline-worker.js${$().location.search.replace(/\?/,"&")}`,!1,"pcb-ratline-worker").rpcCall("rebuildRatlineInWorker",{world:tt}),Ya.rebuildingRatlineInWorker=!0,Oe=Ze.getLastWorkerId(),Mn.getInstance().allowPull=!1}let Ie=re.compiler,ue=new L0(Ie);if(k&&V)await ue.parseSourceByCompiler(V,Y);else try{!k&&Ie instanceof Pu&&(ue.mulSelect=!0),await ue.init(new iie(ue))}catch(Se){if(!k)throw new Error(Se)}if(T=ue.isNew,ue.build({unRebuildRatline:me}),zb.getInstance().currentUser=X,x.getInstance().doctype==4||x.getInstance().doctype==23){let Se=new ow(new ob);Se.setProxy(new aw),Ie.setHandle(Se)}else{let Se=new wG;Se.setProxy(new aw),Se.setTool(new ob),Se.setAttrUtils(new lw),Ie.setHandle(Se),ue.mulSelect&&Ie.setSelectHandle(new Gge),Dn.getInstance().syncPartitionStatus()}if(ky.getInstance().set("Main"),jB.getInstance().subscript(new Hge),BC(!m,!1,T),!re.isactive){ie.publish("updateModify","");return}P0e(),_je(),Bi(K);let Pe=ae=="cnc-preview";if(ae=="silk-preview")QT.getInstance().init();else if(k||Pe){ie.publish("DelayAutoAdaptAll",""),ie.publish("updateFrame",""),u!==3&&$t.setVisible(2,!1),L&&ie.publish("toggleDxfLoadingState",!1,$());let Se=be.getAllLayer(),De=Pe?DA:DA.concat(FM);for(let tt of Se)tt.config&&(De.indexOf(tt.layerID)>=0?tt.visible=!1:tt.visible=!0)}else if(!k&&u===4)T&&(re.unit=ce.pcbConfig.FOOTPRINT_UNIT),wc.getTemplate().checkMustAttr(),be.checkLayerPhys(),ie.publish("DelayAutoAdaptAll",""),ie.publish("saveFootprintDataSuccess",h),ie.publish("flushAttrPlane","");else if(!k&&u===3){(T||Q)&&await Vh.initRuleManager();let Se=!0;if(Ei.getAllItem().length>0?Se=!1:Se=!0,Se&&!Sa.unRebuildCopperWhenOpening){let De=vD();if(De.length>0&&Ei.getAllItem().length===0){let tt=x.getInstance().tabId,Ze=['<span class="i18n">Found un-poured copper region object(s), suggesting rebuild copper region(s) at copper region manager.</span>',"<span>{</span>",...De.map(Wt=>({attr:{id:Wt.globalIndex,pcbId:tt},text:`${ur}${Wt.number}`})),"<span>}</span>"];ie.publish("bottomBarLog",{type:"warn",msg:Ze},$())}}BC(!m,!0,T),T&&(re.unit=ce.pcbConfig.UNIT),ie.publish("DelayAutoAdaptAll",""),be.checkLayerPhys()}if(ie.publish("updateTopMenuItemCheckStatus","",$()),p&&ie.publish("file_save","",$()),g&&ie.publish("highlightItems",{globalIndexArr:g}),B&&!isNaN(B)&&be.setActiveLayerId(B),T){te.getInstance().correctDefault();let Se=(pe=y==null?void 0:y.PCB_THEME)==null?void 0:pe.canvasColorTheme,De=(ge=y==null?void 0:y.PCB_THEME)==null?void 0:ge.canvasColorThemeSelected,tt=Se==null?void 0:Se.filter((Ze,Wt)=>Ze.name==De);Array.isArray(tt)&&tt.length>0&&HN.updateLayerWithPCB(tt[0].list,"NORMAL")}if(be.checkDefault(),be.hiddenAllPlanes(),we.gridType=re.gridType,we.multiType=re.multiType,we.multiRatio=re.multiRatio,be.setActiveLayerId($e.getInstance().activeLayer),T&&new hu("2.0",re.doctype,re.compiler).uploadInitData(),!w){let Se=pf.getInstance();Se.hasWorker(Oe)?Se.setWorkerState(Oe,"mainThreadRunEnd",!0):ie.publish("hideLoading","",$())}return ize&&be.getAllCopperLayer().length>=6&&ie.publish("doCommand_ui",["checkJLCPCBPersonCoupon"],$()),ie.publish("updateModify",""),Ie instanceof Pu&&(Ie.initFinished=!0),Au.initialize(),!0};ie.messageBus.rpcService("rpcInitFrameInfo",c)})();(()=>{let o=ee.build(1,1,1,.5),t=$e.getInstance().addHelpLayer(1001,"OTHER","DRCError",new vf(3),ee.of1(16438793),ee.of1(16438793)),e=$e.getInstance().addHelpLayer(1002,"OTHER","montu",new vf(3),o,o);new m2(t,!1,4),new m2(e,!1,1),ie.messageBus.rpcService("rpcExportInitFrameInfo",async r=>{var V;let{docType:i,tabId:n,saveFile:s,unActive:a,highlightItems:l,commSystemSetting:c,pcbConfig:h,drcCustomSetting:u,isNew:d,owner:p,importFlag:m,source:g,customerCode:y,clientOnlineService:b,isReadOnlyMode:P,isConcurrentStrictMode:T,pcbLevelType:I,isFromBasicLibrary:C,alignNeedSelectRefObject:E,alignNeedSelectRefObjectForCenters:O,name:_,projectTitle:R,footprintIsConnectDevice:v,hideDxfLoading:D,activeLayerId:w,unChangeRepairLineTool:F,isPlaceViasAutoShove:H,currOpenProjectId:z,isPreview:G,envFlag:W,isCheckedCrossProbeMode:L}=r,B=x.getInstance(),N=((V=document.querySelector('meta[name="editorMainVersion"]'))==null?void 0:V.getAttribute("content"))||"";B.editorVersion=N,B.owner=p,B.importFlag=m,B.source=g,B.customerCode=y,B.clientOnlineService=b,B.isReadOnlyMode=P,B.isConcurrentStrictMode=T,B.currOpenProjectId=z,B.name=_,B.projectTitle=R,we.needSelectAlignRefObject=E,we.needSelectAlignRefObjectForCenters=O,we.isCheckedCrossProbeMode=L,yhe(i,n,G,W),!G&&i===4&&(HN.updateLayerWithFootprint(),we.footprintIsConnectDevice=v),h&&bhe(h),Bge(),P0e();let U=B.compiler,k=new L0(U);return await k.init(),k.build(),x.getInstance().doctype===3&&(ie.publish("updateRtree",""),ie.publish("DelayAutoAdaptAll",""),be.checkLayerPhys()),!0})})();function vZe(){ie.subscribe("FlushAttrPlane",()=>{ie.publish("flushSelectingInfo","")})}function xZe(){ie.subscribe("delete",o=>{if(!(o!=null&&o.isBase)){if(o instanceof mt||o instanceof vt){vb.getInstance().delete(o,o.globalIndex);return}Vt.remove(o),oMt(o,o.globalIndex)}}),ie.subscribe("autoFill",()=>{sMt()}),ie.subscribe("autoRefresh3DColor",()=>{aMt()}),ie.subscribe("updateExpansion",()=>{lMt()}),ie.messageBus.rpcService("/pcb/cncPolygonUpdate",async o=>{if(!isNaN(o.scale)&&o.scale!=1){let n=N0();if(n){let s=n.center(),a=Ae.scale(o.scale,o.scale,1).setOrigin(s.x,s.y,1);[].concat(pt.getAllItem(),Xt.getAllItem(),Zt.getAllItem(),pr.getAllItem(),ti.getAllItem()).forEach(l=>{l.transform(a),ie.publish("hasModifyPcbItem",l)})}ie.publish("flushSelectingInfo",""),ie.publish("flushService","")}if(o.apply2All&&o.depth>0&&(o.id="",r()),!o.id)return e(),!0;let t=pt.getItem(o.id)||Zt.getItem(o.id);if(!t)return!1;try{let n=t.getComponent();if(n&&n instanceof wl){if(isNaN(o.thickness))return!0;n.stretchLength=Math.abs(o.thickness)}else{if(isNaN(o.depth))return!0;e(),i(t)}}catch{return!1}return!0;function e(){if(isNaN(o.depth))return;let n=Zt.getAllItem(),s=pt.getAllItem();[].concat(n,s).some(a=>{let l=a.getComponent();return l&&l instanceof wl?(l.stretchLength=Math.abs(o.thickness),!0):!1})}function r(){if(isNaN(o.thickness))return;let n=Zt.getAllItem(),s=pt.getAllItem();[].concat(n,s).some(a=>{i(a)})}function i(n){if(!n)return;let s=n.getComponent();if(!(s&&s instanceof wl))if(n.type="3D Shell - Top Slot Region",n.layerId=54,s instanceof ou)s.type="Top",s.slotDepth=Math.abs(o.depth);else{let a=[4,8,16],l=new ou("Top",Math.abs(o.depth),a,"");n.setComponent(l)}}})}function oMt(o,t){let e=null;if(typeof o.getParent=="function"&&(e=o.getParent()),e instanceof Ye&&(e.model.deleteCopper(t),e.deleteCopperResult(o,t)),ze.delete(o),Ve.deleteItem(o),o instanceof Sr)o.type=="Board"?Cs.getInstance().deleteBoard(o):Zt.delete(o);else if(o instanceof Me)Cr.delete(o),ps.delete(o.model),Ji.deleteComponent(o.model);else if(o instanceof oR)ps.delete(o);else if(o instanceof ii)Ei.delete(o);else if(o instanceof ca)Go.delete(o);else if(o instanceof Yn)Ln.delete(o);else if(o instanceof Ri){let r=o.getParent();r!=null&&as.getInstance().deletePadLen(r.globalIndex,o.globalIndex),Kt.delete(o)}else if(o instanceof Ki)Qn.delete(o);else if(o instanceof ct)o.type=="Board"?Cs.getInstance().deleteBoard(o):pt.delete(o);else if(o instanceof fn){let r=o.getParent();r!=null&&as.getInstance().deletePadLen(r.globalIndex,o.globalIndex),Kt.delete(o)}else o instanceof ol?is.delete(o):o instanceof xa?Uo.delete(o):o instanceof nr?o.type=="Board"?Cs.getInstance().deleteBoard(o):Xt.delete(o):o instanceof Nh?wh.delete(o):o instanceof fr?ti.delete(o):o instanceof Ue?pr.delete(o):o instanceof Rs?_o.delete(o):o instanceof Ge&&Hr.delete(o);Eo.deleteByPcbItem([o],!0),kt.delete(o)}function sMt(){pt.autoFill(),Zt.autoFill(),Xt.autoFill()}function aMt(){pt.autoRefreshAll(),Zt.autoRefreshAll(),Xt.autoRefreshAll()}function lMt(){Kt.updateExpansion(),Hr.updateExpansion()}function RZe(){if(window["META-PANELIZE-ENV"]||!/\bcll\b/.test($().location.search))return;let o=[];A.subscribe("/debug/draw",t=>{o.forEach(i=>i.remove()),o.length=0;let e=1e3,r=be.getLayer(e);r||(r=be.addPcbLayer(e,"CUSTOM","debug",100,ee.GREEN,ee.GREEN,!0,1)),be.setActiveLayerId(e);for(let i in t){let n=ee.of3(i),s=t[i],a=s.points;for(let d=0;d<a.length;d+=2)o.push(new qi(e,new S(a[d],a[d+1]),!1,n));let l=s.lines;for(let d=0;d<l.length;d+=4)o.push(new hr(e,new S(l[d],l[d+1]),new S(l[d+2],l[d+3]),!0,n));let c=s.arcs;for(let d=0;d<c.length;d+=6)o.push(ns.build(e,new S(c[d],c[d+1]),c[d+2],c[d+3],c[d+4],c[d+5],n));let h=s.texts;for(let d=0;d<h.length;d+=5){let p=new S(h[d],h[d+1]),m=Jw.build(h[d+2],p,h[d+3],h[d+4],e);m.setColor(n),o.push(m)}let u=s.beziers;if(u){let d=[];for(let p=0;p<u.length;)if(typeof u[p]=="number")d.push(new S(u[p],u[p+1])),p+=2;else{let g=new Mr(d).points(.01);for(let y=0;y<g.length-1;y++){let b=g[y],P=g[y+1];o.push(new hr(e,b,P,!0,n))}p++,d.length=0}}}A.publish("updateFrame","")}),A.subscribe("/debug/downloadFile",t=>{Re.downloadFile(t.fileName,new Blob([t.buffer]))})}function DZe(){let o=Cr.getAllItem(),t=n("Designator",s=>s.name.match(/[^\d]*/)[0]||"None",o),e=n("Device",s=>s.device,o),r=n("Footprint",s=>s.footprintId,o),i=n("Name",s=>s.getFormulaName()||"None",o);function n(s,a,l){let c={};return l.forEach(h=>{let u={globalIndex:h.globalIndex,name:s==="Device"||s=="Name"?h.name:`${h.name} (${h.device})`},d=a(h);c[d]?c[d].push(u):c[d]=[u]}),AM(Object.keys(c).map(h=>({amount:c[h].length,name:h,children:Pd(c[h],"name"),attributes:{categoryBy:s,name:h}})),"name")}return{Designator:t,Device:e,Footprint:r,Name:i}}function wZe(){ie.messageBus.rpcService("setNetColor",jGe),ie.messageBus.rpcService("getAllDifferentailRules",()=>{let o=Fu.getDesignRulers();return new Promise((t,e)=>{t(o.NetDifferentails)})}),ie.subscribe("DeletePadsPairGroup",({gropNames:o})=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let t=te.getInstance();o.forEach(e=>{var i;let r=(i=te.getInstance().getPadsPairGroupItemByGroupName(e))==null?void 0:i.number;t.deletePadsPairGroup(e),j$(r)}),ie.publish("forceRenderTree",tn.PadsPairGroups,$()),ie.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}),ie.subscribe("getAllItems",o=>{!x.getInstance().isactive||23==x.getInstance().doctype||(eze(),setTimeout(()=>{ie.publish("getAllItemsBack",tze(o),$())},10))}),ie.subscribe("getAllNets",o=>{!x.getInstance().isactive||23==x.getInstance().doctype||ie.publish("getAllNetsBack",{Net:zGe(o),Component:YGe(),isCompleted:tn.ALLNETROOT==o},$())}),ie.subscribe("getAllComponents",()=>{!x.getInstance().isactive||23==x.getInstance().doctype||ie.publish("getAllComponentsBack",DZe(),$())}),ie.messageBus.rpcService("getDRCResultTree",o=>new Promise(async(t,e)=>{t(Au.panelManager.getErrorTree(o))})),ie.messageBus.rpcService("getAllErrors",o=>new Promise(async(t,e)=>{var s;let r=!1,i=await Ihe(o),n=Au.panelManager.getErrorTree(i);Au.updateVisibility(!0),ie.publish("getAllErrorsBack",n,$()),Array.isArray(n)&&Number((s=n[0])==null?void 0:s.title[1].match(/\d+/g)[0])>0&&(r=!0),t(r)})),ie.subscribe("RemovePadsPairFromGroup",({itemNames:o})=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let t=te.getInstance();o.forEach(e=>{let r=t.getPadsPairGroupItemByGroupName(e.netClassName);r&&(r.deletePadsPairGroupDetailItemByPairName(e.netName),Y$(e.netClassName))}),ie.publish("forceRenderTree",tn.PadsPairGroups,$()),ie.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}),ie.subscribe("deleteNetClass",({type:o,names:t})=>{!x.getInstance().isactive||23==x.getInstance().doctype||(o=="delete-net-class"?(t.forEach(e=>{let i=te.getInstance().getNetClass(e).getAllNets().map(n=>n.name);te.getInstance().deleteNetClass(e);for(let n of i)Ql(n);x.getInstance().compiler.deleteRuleSelector(["NET_CLASS",e])}),ie.publish("forceRenderTree",tn.NetClasses,$())):(t.forEach(e=>{let i=te.getInstance().getEqualLengthGroup(e).getAllNets().map(n=>n.name);te.getInstance().deleteEqualLengthGroup(e);for(let n of i)Ql(n);x.getInstance().compiler.deleteRuleSelector(["EQ_LEN_GRP",e])}),ie.publish("forceRenderTree",tn.EqualLengthGroups,$())),ie.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()))}),ie.subscribe("removeNetFromNetClass",({type:o,arr:t})=>{!x.getInstance().isactive||23==x.getInstance().doctype||(o=="remove-from-net-class"?(t.forEach(e=>{let r=te.getInstance().getNetClass(e.netClassName);r.removeNetwork(e.netName),Ql(e.netName),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",r))}),ie.publish("forceRenderTree",tn.NetClasses,$())):(t.forEach(e=>{let r=te.getInstance().getEqualLengthGroup(e.netClassName);r.removeNetwork(e.netName),Ql(e.netName),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",r))}),ie.publish("forceRenderTree",tn.EqualLengthGroups,$())),ie.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()))}),ie.messageBus.rpcService("addNetDifferentail",({title:o,postiveNet:t,negativeNet:e})=>new Promise((r,i)=>{if(te.getInstance().getNetDifferential(o))r(!1);else{let n=te.getInstance().addNetDifferential(o,t,e);t&&Ql(t),e&&Ql(e),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",n)),ie.publish("forceRenderTree",tn.Differentials,$()),ie.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),r({NetDifferentails:Fu.getDesignRulers().NetDifferentails,option:Fu.getDesignRulers().option})}})),ie.messageBus.rpcService("addNetDifferentailArr",o=>new Promise((t,e)=>{let r=[];Fn(o,(i,n)=>{te.getInstance().getNetDifferential(n.title)&&r.push(n.title)}),r.length>0?t(r):(Fn(o,(i,n)=>{let{title:s,positiveNet:a,negativeNet:l}=n;te.getInstance().addNetDifferential(s,a,l),a&&Ql(a),l&&Ql(l),x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",n))}),ie.publish("forceRenderTree",tn.Differentials,$()),ie.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),t(!0))})),ie.messageBus.rpcService("renameDifferentail",({oldName:o,newName:t,postiveNet:e,negativeNet:r})=>new Promise((i,n)=>{if(o!==t&&te.getInstance().getNetDifferential(t))i(!1);else{te.getInstance().renameNetDifferential(o,t,e,r),e&&Ql(e),r&&Ql(r);let s=te.getInstance().getNetDifferential(t);x.getInstance().compiler.uploadRuleSelector(or.getInstance().encode("RULE_SELECTOR",s)),ie.publish("forceRenderTree",tn.Differentials,$()),ie.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),i({NetDifferentails:Fu.getDesignRulers().NetDifferentails,option:Fu.getDesignRulers().option})}})),ie.messageBus.rpcService("deleteDifferentail",o=>new Promise((t,e)=>{(!x.getInstance().isactive||23==x.getInstance().doctype)&&t(!1);let r=o.map(i=>{let n=te.getInstance().getNetDifferential(i);return{name:n.name,positiveNet:n.positiveNet.name,negativeNet:n.negativeNet.name}});te.getInstance().deleteNetDifferential(o);for(let i of r)i.positiveNet&&Ql(i.positiveNet),i.negativeNet&&Ql(i.negativeNet),x.getInstance().compiler.deleteRuleSelector(["DIFF_PAIR",i.name]);ie.publish("forceRenderTree",tn.Differentials,$()),ie.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),t({NetDifferentails:Fu.getDesignRulers().NetDifferentails,option:Fu.getDesignRulers().option})}))}function LZe(){ie.subscribe("updateIFrameState",o=>{let t=o.head;Qt.getInstance().close(),Lo.getInstance().cancel(),t.to===x.getInstance().tabId?BC(o.body.active):BC(!1),(x.getInstance().doctype==3||x.getInstance().doctype==4)&&!x.getInstance().isactive&&(x.getInstance().isactive=!0,ie.publish("tool","dropdrag"),x.getInstance().isactive=!1),x.getInstance().doctype===4&&x.getInstance().isactive&&ie.publish("flushAttrPlane",{isUpdateDeviceData:!0}),23==x.getInstance().doctype&&we.synchronize()},$()),ie.messageBus.subscribe("switchGridType",o=>{let t=!1;we.gridType!=o&&(we.gridType=o,t=!0),ce.getAssociationPCBCanvasGridType()==1&&we.multiType!=o&&(we.multiType=o,t=!0),t&&(wp(),Lge(),ie.publish("flushSelectingInfo",""),ie.publish("flushService",""))}),ie.messageBus.subscribe("switchMultiGridType",o=>{let t=!1;we.multiType!=o&&(we.multiType=o,t=!0),ce.getAssociationPCBCanvasGridType()==1&&we.gridType!=o&&(we.gridType=o,t=!0),t&&(wp(),ie.publish("flushSelectingInfo",""),ie.publish("flushService",""))}),ie.messageBus.subscribe("switchMultiGridRatio",o=>{we.multiRatio!=o&&(we.multiRatio=o,wp(),ie.publish("flushSelectingInfo",""),ie.publish("flushService",""))})}function MZe(o){if(Ve.getSelects().length)switch(o){case"align_left":case"align_right":case"align_top":case"align_bottom":{we.needSelectAlignRefObject?A.publish("tool",J$[o]):xK({cmd:o});break}case"align_vertical_center":case"align_horizontal_center":{we.needSelectAlignRefObjectForCenters?A.publish("tool",J$[o]):xK({cmd:o});break}case"align_grid":{xK({cmd:o});break}}}function xK(o){let{cmd:t,refPoint:e,refItemId:r}=o;if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let i=Ve.getSelects().filter(n=>n.globalIndex!=r);i.length&&ls.getInstance().init(i,t,(n,s)=>{let a=new l1(s);n=Array.from(a.getParentElements(n,!0).keys());let l=new _e,c=[],h=[],u={};for(let m of n){let g=m.getGroupID();if(g)u[g]||(u[g]=[]),u[g].push(m);else{let y=zw(m);c.push(m),h.push(y),l.ext1(y)}}Object.entries(u).forEach(([m,g])=>{let y;if(g.length>1){let b=new _e;kt.getItem(m).getItems().forEach(I=>b.ext1(zw(I))),y=b.build1()}else y=zw(g[0]);c.push(g[0]),h.push(y),l.ext1(y)});let d=l.build1(),p=[];if(d!=null){switch(t){case"align_top":{let m=e?e.y:d.maxY;p=h.map(g=>new S(0,m-g.maxY));break}case"align_bottom":{let m=e?e.y:d.minY;p=h.map(g=>new S(0,m-g.minY));break}case"align_left":case"align_right":{let m=!we.flipBoard==(t=="align_left"),g=e?e.x:m?d.minX:d.maxX;p=h.map(y=>new S(g-(m?y.minX:y.maxX),0));break}case"align_grid":{let m=St.getInstance().getSnapX(),g=St.getInstance().getSnapY(),y=x.getInstance().origin;p=c.map((b,P)=>{let T=b.position||h[P].center();return new S(Math.round((T.x-y.x)/m)*m+y.x-T.x,Math.round((T.y-y.y)/g)*g+y.y-T.y)});break}case"align_horizontal_center":{p=h.map(m=>new S((e?e.x:d.center().x)-m.center().x,0));break}case"align_vertical_center":{p=h.map(m=>new S(0,(e?e.y:d.center().y)-m.center().y));break}}p.length>0&&a.execute(c,p)}A.publish("updateFrame",""),Pr.refresh(),A.publish("flushSelectingInfo","")})}var Wge=class extends fi{constructor(e){super();this.layerId="input-value";this.items=e}open(e){let r=Zn.getLayerListByType(this.items).map(n=>({title:n.text,value:n.value})),i={};return i.action="commonly-value-input",i.forms=[{type:"select",title:"Layer",options:r,tips:"",key:this.layerId,inputStatus:"focus"}],i}modify(e){}close(e){if(e.action=="confirm"){let r=+e[this.layerId];A.publish("toggle",{command:"PASTE2",layerId:r,done:!0})}return!0}};var zge=class{constructor(){this.defaultStrokeWidthOnBreakRect2Line=1;this.result=[]}breakUp(t){this.resetTempVariables(),this.items=t,this.result.length=0,this.commands=new ve("line break up"),t=t.filter(n=>{let s=she(n);return!ohe(s,n)});let e=new Array;for(let n of t){let s=this.getMathGraphicsMap(n);e.push([`${n.globalIndex}`,s,n.strokeWidth])}let r=this.seek2dLineGroupInterSection(e);for(let n of t){let s=this.seekSelfInterSection(n),a=[];if(r[n.globalIndex]){var i=Object.values(r[n.globalIndex]);i.forEach(l=>{l.forEach(c=>{this.pushPointFilterSame(c,a)})})}Array.isArray(s)&&a.push(...s),this.break(n,a)}this.result.forEach(n=>{A.publish("hasModifyPcbItem",n)})}break(t,e){t instanceof ct?this.dealPolygon(t,e):t instanceof Sr?this.dealCircle(t,e):t instanceof nr&&this.dealRect(t,e)}removeModelCommand(t){this.commands.addCommand(Te.dispatch(t,"delete")),A.publish("delete",t),t.remove()}resetTempVariables(){this.mathGraphics2IdMap={},this.newLinesLen=0}dealCircle(t,e){let r=t.layerId===12?1:t.layerId,i=[],n=t.center,s=t.radius,a=this.getInitialStrokeWidth(t);if(!e.length||e.length===1){let l=new S(n.x+s,n.y),c=new S(n.x-s,n.y),h=new S(n.x-s,n.y),u=new S(n.x+s,n.y),d=l.angle(n),p=c.angle(n),m=h.angle(n),g=u.angle(n),y=this.createSingleArcPolygon("Line",n,s,d,p,a,r,le.CCW),b=this.createSingleArcPolygon("Line",n,s,m,g,a,r,le.CCW);y!=null&&(y.partition=x.getInstance().partitionId,this.result.push(y),this.commands.addCommand(Te.dispatch(y,"add"))),b!=null&&(b.partition=x.getInstance().partitionId,this.result.push(b),this.commands.addCommand(Te.dispatch(b,"add"))),this.removeModelCommand(t);return}if(e.length>1){let l=e[0][1];e.forEach(([u,d],p)=>{if(p>0){let m=this.getRad(l,n,d);i.push([m,d])}});let c=i.concat([[0,l]]).sort(([u,d],[p,m])=>p-u).map(u=>u[1]),h=le.CW;c.map((u,d)=>{let p,m=u.angle(n),g;d===c.length-1?g=c[0].angle(n):g=c[d+1].angle(n);let y=this.createSingleArcPolygon("Line",n,s,m,g,a,r,h);y!=null&&(y.partition=x.getInstance().partitionId,this.result.push(y),this.commands.addCommand(Te.dispatch(y,"add")))})}this.removeModelCommand(t)}flatten(t){return t.reduce((e,r)=>(e.push(...r),e),[])}dealPolygon(t,e){let r=this,i=Math.pow,n=Math.sqrt,s=t.layerId,a=this.flatten(t.getChildrens()),l=this.getInitialStrokeWidth(t);if(!(a.length===1&&!e.length)){if(!e.length){let c=new io;a.map(h=>{let u=c.clone4(h.model),d=pt.addPolygon("Line",t.layerId,[[u]],l,"",!1);d.partition=x.getInstance().partitionId,this.result.push(d),r.commands.addCommand(Te.dispatch(d,"add"))}),r.removeModelCommand(t);return}for(let c=0,h=a.length;c<h;c++){let u=a[c],d={x:u.start.x,y:u.start.y},p=r.searchIntersByLine(u,e);if(u instanceof vt){r.dealArc(u,p,l,t.type);continue}if(!p.length){let T=new io().clone4(u.model),I=pt.addPolygon("Line",t.layerId,[[T]],l,"",!1);I.partition=x.getInstance().partitionId,this.result.push(I),r.commands.addCommand(Te.dispatch(I,"add"));continue}if(p.length===1){let P=new S(p[0].x,p[0].y),T=r.createSinglePolygon("Line",u.start,P,l,s),I=r.createSinglePolygon("Line",P,u.end,l,s);T.partition=x.getInstance().partitionId,I.partition=x.getInstance().partitionId,this.result.push(T),this.result.push(I),r.commands.addCommand(Te.dispatch(T,"add")),r.commands.addCommand(Te.dispatch(I,"add"));continue}let m=[];p.forEach(P=>{let T=n(i(P.x-d.x,2)+i(P.y-d.y,2));m.push([T,P])});let g=m.sort(([P,T],[I,C])=>P-I).map(P=>P[1]),y=[].concat([u.start],g,[u.end]),b=new io;y.map((P,T)=>{if(T!==y.length-1){let I=y[T+1],C=b.addLine(P,I,t.layerId,l),E=pt.addPolygon("Line",t.layerId,[[C]],l,"",!1);E.partition=x.getInstance().partitionId,this.result.push(E),r.commands.addCommand(Te.dispatch(E,"add"))}})}this.removeModelCommand(t)}}dealArc(t,e,r,i){let n=this,s=t.center,a=t.radius,l=t.layerId;if(e.length===1){let c=e[0].angle(s),h=t.end.angle(s),u=t.start.angle(s),d=this.createSingleArcPolygon(i,s,a,u,c,r,l,t.sweep),p=this.createSingleArcPolygon(i,s,a,c,h,r,l,t.sweep);d!=null&&(d.partition=x.getInstance().partitionId,this.result.push(d),n.commands.addCommand(Te.dispatch(d,"add"))),p!=null&&(p.partition=x.getInstance().partitionId,this.result.push(p),n.commands.addCommand(Te.dispatch(p,"add")))}else{let c=t.center,h=t.radius;e.push(t.start,t.end);let u=n.sortIntersForArc(t,e);u.map((d,p)=>{if(p!==u.length-1){let m=d.angle(c),g=u[p+1].angle(c),y=this.createSingleArcPolygon("Line",c,h,m,g,r,l,t.sweep);y!=null&&(y.partition=x.getInstance().partitionId,this.result.push(y),n.commands.addCommand(Te.dispatch(y,"add")))}})}}sortIntersForArc(t,e){let r=[];for(let a=0,l=e.length;a<l;a++){let c=t.midPoint.distance2(e[a]),h=t.start.distance2(e[a]),u=t.end.distance2(e[a]);r.push([c,h,u,e[a]])}r.sort(([a,l,c],[h,u,d])=>a-h);let i=[],n=[],s=[];return r.forEach(a=>{let[l,c,h]=a;c>h?n.push(a):c<h?i.push(a):s.push(a)}),i=i.sort(([a,l,c],[h,u,d])=>h-a),n=n.sort(([a,l,c],[h,u,d])=>a-h),[].concat(i,s,n).map(a=>a[3])}dealRect(t,e){let r=this,i=Math.pow,n=Math.sqrt,s=t.layerId,a=this.getInitialStrokeWidth(t);if(!e.length){r.dispersionRect(t).map(c=>{this.result.push(c),r.commands.addCommand(Te.dispatch(c,"add"))}),this.removeModelCommand(t);return}let l=this.getRectLines(t);for(let c=0,h=l.length;c<h;c++){let u=l[c],d=r.searchIntersBySideForRect(u,c,e),p=[].concat([u.start],d,[u.end]);p=dn(p,u.primitive);let m=p.length,g=p[0];for(let y=1;y<m;y++){let b=p[y];if(u instanceof Yi){let P=r.createSinglePolygon("Line",g,b,a,s);P.partition=x.getInstance().partitionId,this.result.push(P),r.commands.addCommand(Te.dispatch(P,"add"))}else if(u instanceof Zo){let P=g.angle(u.center),T=b.angle(u.center),I=g.equals(u.start)?u.sweep:u.sweep==le.CW?le.CCW:le.CW,C=r.createSingleArcPolygon("Line",u.center,u.radius,P,T,a,s,I);C!=null&&(C.partition=x.getInstance().partitionId,this.result.push(C),r.commands.addCommand(Te.dispatch(C,"add")))}g=b}}l.forEach(c=>{c.remove()}),this.removeModelCommand(t)}getChildrens(t){return t instanceof ct?t.getChildrens():t instanceof nr?this.getRectLines(t):null}getRectLines(t){let e=t.layerId,r=t.strokeWidth,i=t.getMathGraphics(),n=new Array;for(let s of i.primitives)if(s instanceof M){let a=Yi.build(e,s.start(),s.end(),r);n.push(a)}else if(s instanceof q){let a=Zo.build(e,s.center,s.rx,r,mh(s.startAngle),mh(s.endAngle()),s.sweep());n.push(a)}return n}dispersionRect(t){let e=this.getInitialStrokeWidth(t),r=t.layerId,i=t.getMathGraphics(),s=new io().plToShapes(i,r,e),a=new Array;for(let l of s){let c=pt.addPolygon("Line",r,[[l]],e,"",!1);c.partition=x.getInstance().partitionId,a.push(c)}return a}createSinglePolygon(t,e,r,i,n,s="",a=!1){let c=new io().addLine(e,r,n,i);return pt.addPolygon(t,n,[[c]],i,s,a)}createSingleArcPolygon(t,e,r,i,n,s,a,l,c="",h=!1,u=1){if(Math.abs(i-n)<1e-4)return null;let d=qc.addArc(a,e,r,s,i,n,l,h,u);return pt.addPolygon(t,a,[[d]],s,c,h)}searchIntersBySideForRect(t,e,r){let i=[];for(let[n,s]of r)e===n&&!this.checkIsInflectPoint(t,s)&&i.push(s);return i}searchIntersByLine(t,e){let r=[];for(let[i,n]of e)t.globalIndex===i&&!this.checkIsInflectPoint(t,n)&&r.push(n);return r}checkIsInflectPoint(t,e){return!!(e.equals(t.start)||e.equals(t.end))}getAngleAOB(t,e,r){var i=t.x-e.x,n=t.y-e.y,s=r.x-e.x,a=r.y-e.y,l=i*s+n*a,c=Math.sqrt(i*i+n*n),h=Math.sqrt(s*s+a*a),u=l/(c*h);return u=u>1?1:u<-1?-1:u,Math.acos(u)}getRad(t,e,r){let i=t.x-e.x,n=t.y-e.y,s=r.x-e.x,a=r.y-e.y;return Math.atan2(a,s)-Math.atan2(n,i)}seekSelfInterSection(t){let e;if(t instanceof ct){let r=t.getChildrens();for(let i=0;i<r.length;i++){let n=r[i],s=[];for(let l=0,c=n.length;l<c;l++)s.push(n[l].primitive);let a=t.globalIndex;for(let l=0;l<s.length;l++)for(let c=0;c<s.length;c++){if(l===c||Math.abs(l-c)==1)continue;let h=s[l],u=s[c],d=Tt(h,u);if(d>0)for(let p=0;p<d;p+=2){let m=new S(Ee[p],Ee[p+1]),g=l,y=c;a in this.mathGraphics2IdMap&&(g=this.mathGraphics2IdMap[a][i][l],y=this.mathGraphics2IdMap[a][i][c],typeof e!="object"?e=[[g,m],[y,m]]:(e.push([g,m]),e.push([y,m])))}}}}return e}seek2dLineGroupInterSection(t){let e={};for(let[r,i,n]of t)if(!e[r])for(let[s,a,l]of t){if(r==s)continue;let c=this.seekSingleLineInterSection(i,a,r,n,l);c&&(e[r]?e[r][s]?c.forEach(h=>this.pushPointFilterSame(h,e[r][s])):e[r][s]=c:e[r]={[s]:c})}return e}pushPointFilterSame(t,e){return e.some(i=>i[1].equals(t[1]))||e.push(t),e}seekSingleLineInterSection(t,e,r,i,n){let s=[];for(let a=0;a<t.length;a++){let l=t[a];for(let c=0,h=l.primitives.length;c<h;c++)for(let u=0;u<e.length;u++){let d=e[u];for(let p=0,m=d.primitives.length;p<m;p++){let g=l.primitives[c],y=d.primitives[p],b=Tt(g,y);if(b>0)for(let P=0;P<b;P+=2){let T=new S(Ee[P],Ee[P+1]),I=c;r in this.mathGraphics2IdMap&&(I=this.mathGraphics2IdMap[r][a][c]),this.pushPointFilterSame([I,T],s)}else{let T=new ir(g,y).getLine();if(T.length()<=(i+n)/2){let I=new ir(g,new M(T.start(),T.start())),C=c;r in this.mathGraphics2IdMap&&(C=this.mathGraphics2IdMap[r][a][c]);let E=T.start(),O=T.end();I.getDistance()<1e-4?this.pushPointFilterSame([C,E],s):this.pushPointFilterSame([C,O],s)}}}}}return s}showPrimitive(t){t instanceof M?new hr(1002,t.start(),t.end(),!1,ee.BLUE):t instanceof q&&ns.build(1002,t.center,t.rx,t.startAngle/180*Math.PI,t.endAngle()/180*Math.PI,t.sweep(),ee.BLUE)}getMathGraphicsMap(t){if(t instanceof ct){this.mathGraphics2IdMap[t.globalIndex]=t.getChildrens().map(r=>r.map(i=>i.globalIndex));let e=t.getMathGraphics();return e instanceof Gt?e.items:[e]}return[t.getMathGraphics()]}getInitialStrokeWidth(t){return t.type==="Slot Region"||t.type==="Copper Region"||t.type==="Fill Region"||t.type==="FPC Stiffener"||t.type==="Prohibited Region"||t.type==="Constraint Region"?this.defaultStrokeWidthOnBreakRect2Line:t.strokeWidth}};function NZe(){ie.messageBus.rpcService("updateDRCCustomConfig",o=>{x3.updateConfig(o)}),ie.subscribe("getLastText",()=>{!x.getInstance().isactive||23==x.getInstance().doctype||(ie.publish("interrupt",""),ie.publish("openMainDialog",{cmd:20}))}),ie.messageBus.rpcService("PcbDeviceStandardization",()=>{let o=Cr.getAllItem(),t=o.map(i=>{let n=i.attrKeyValue;return{ids:i.globalIndex,"Standardization Check":!n["Standardization Check"]||n["Standardization Check"]==="true"?"true":"false","Add into BOM":n["Add into BOM"]==="yes"?"yes":"no",Comment:PH(n.Comment||n.Name||n.Value||n["Manufacturer Part"]||i.device,n),Designator:i.name,Device:i.device,Footprint:i.footprintId,Manufacturer:PH(n.Manufacturer,n),"Manufacturer Part":PH(n["Manufacturer Part"],n),Supplier:PH(n.Supplier,n),"Supplier Part":PH(n["Supplier Part"],n),Value:PH(n.Value,n)}}),e=["Add into BOM","Comment","Device","Footprint","Manufacturer","Manufacturer Part","Supplier","Supplier Part","Value"],r={};for(let i=0;i<o.length;i++){let n=t[i],s=e.map(a=>n[a]).join("@");r[s]||(r[s]=[]),r[s].push(n)}return Object.values(r).map(i=>({...i[0],ids:i.map(n=>n.ids),Designator:i.map(n=>n.Designator)}))}),ie.messageBus.rpcService("PcbDeviceStandardization_setCheck",o=>{console.log("***config",o);let{ids:t,checked:e}=o;if(!t||!t.length)return;let r=x.getInstance().compiler;t.forEach(i=>{let n=Cr.getItem(i);n.modifyATTRMap("Standardization Check",e?"true":"false"),r.uploadComponent(i,or.getInstance().encode("COMPONENT",n.model))}),ie.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}),ie.subscribe("unlockALL",()=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;ie.publish("clearSelect","");let o=new ve("top menu unlock all lock pcb item"),t=Lc(),e=new Array;t.forEach(r=>{r.locked&&(o.addCommand(Te.dispatch(r,"modify")),r.locked=!1,e.push(r),r.click())}),o.length>0&&je.executeCommand(o),ie.publish("select",e)}),ie.subscribe("ungroupAll",()=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;ie.publish("clearSelect","");let o=new ve("top menu cancel all combinations pcb item"),t=kt.getAllItem(),e=new Array;t.forEach(r=>{o.addCommand(Te.dispatch(r,"delete")),r.getItems().forEach(i=>{e.push(i),i.click()}),r.dissolution(),ie.publish("delete",r)}),o.length>0&&(je.executeCommand(o),ie.publish("showPcbSlideMsg",["Ungrouped successfully"],$())),ie.publish("select",e)}),ie.subscribe("alignSelectedObjs",xK),ie.subscribe("distributeSelectedObjs",sK),ie.subscribe("combination",MWe),ie.subscribe("joinCombination",kWe),ie.subscribe("dissolution",NWe),ie.subscribe("removeFromCombination",BWe),ie.subscribe("distribute",T$e),ie.subscribe("align",MZe),ie.subscribe("offset",YXe),ie.subscribe("flip",jXe),ie.subscribe("flip2OppositeSide",R$),ie.subscribe("convertTo",pje),ie.subscribe("splitWhenConvertPolygon",dje),ie.subscribe("unrouteClearConnect",TMt),ie.subscribe("unrouteClearNetwork",IMt),ie.subscribe("mergeAsClosedLine",bMt),ie.subscribe("dispersedAsIndependentLine",PMt),ie.subscribe("EDIT_BOUNDARY",pU),ie.subscribe("attrData",cMt),ie.subscribe("addFilletOrChamfer",hMt),ie.subscribe("equalLengthTuning",mMt),ie.subscribe("booleanOperation",uMt),ie.subscribe("cutoutToAvoid",dMt),ie.subscribe("duplicateToCursor",pMt),ie.subscribe("duplicateToOtherLayer",fMt),ie.subscribe("interchange",gMt),ie.subscribe("batchMove",XXe),ie.subscribe("convertToBoard",m$),ie.subscribe("convertToLineFromBoard",WG),ie.subscribe("copyToSvg",async o=>{let t="copyToSvg",e=new Um(t,0,i=>{console.log(t,"progress",i)}),r=await CZe.exportSelectsToClipboard(o,e);return e.end(),r}),ie.subscribe("copyToPng",async o=>{let t="copyToPng",e=new Um(t,0,i=>{console.log(t,"progress",i)}),r=await IZe.exportSelectsToClipboard(o,e);return e.end(),r})}function PH(o,t){if(/\=\{(.*)\}/gi.test(o)){let e=/\=\{(.*)\}/gi.exec(o);if(e&&e[1])return t[e[1]]||""}return o||""}function cMt(){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let o=Cr.getAllItem();ie.publish("openMainDialog",{cmd:1,data:{foots:o}})}function hMt(o){if(!x.getInstance().isactive)return;let t={command:"AddChamfer",items:Ve.getSelects(),type:o=="ADD_FILLET"?"fillet":"chamfer"};ie.publish("toggle",t)}function uMt(o){!x.getInstance().isactive||23==x.getInstance().doctype||rhe(o)}function dMt(o){x.getInstance().isactive&&DG(o)}function pMt(){ie.publish("toggle",{command:"PASTE2"})}function fMt(){if(!we.canDupToOtherLayer)return;let o=new Wge(Ve.getSelects());ie.publish("openDialog",o)}function mMt(o=!1){if(!(!x.getInstance().isactive||23==x.getInstance().doctype)&&x.getInstance().doctype===3){let t=Ve.getLastClickPosition(),e=Ve.getLastUpPosition(),r=Ve.getItems(),i={command:"draw(snake_track)",isDiffPair:o,startPoint:null};t&&e&&t.equals1(e)&&r.length&&(i.startPoint=t),ie.publish("toggle",i)}}function gMt(){if(Ve.getItems().length==Ve.getComponents().length&&Ve.getComponents().length==2){let o=Ve.getComponents()[0],t=Ve.getComponents()[1],e=o.getGroupID(),r=t.getGroupID();if(e!=null&&e==r){let i=new w9("Cannot Swap Location for objects within the same group");ie.publish("openMsgbox",i)}else{let i=[o,t];ls.getInstance().init(i,"interchange 2 device position",(n,s)=>{yMt(n,s,i)})}}}function yMt(o,t,e){let r=o[0],i=o[1],n=r.position,a=(i?i.position:e.find(h=>h!==r).position).sub(n),l=Ae.translate(a.x,a.y,0),c=Ae.translate(-a.x,-a.y,0);for(let h of o)t.addCommand4Item(h,"modify");r.transform(l),i==null||i.transform(c);for(let h of o)ie.publish("hasModifyPcbItem",h);t.checkOutlines(o,new Set),ie.publish("flushService","")}function bMt(){let o=new C9,t=_P(Ve.getSelects());o.build(t,(e,r,i)=>{e.length&&ie.publish("showPcbSlideMsg",["{0} line Merge succeeded",[e.length]],$())}),ie.publish("flushSelectingInfo",""),ie.publish("flushService","")}function PMt(){let o=_P(Ve.getSelects()),t=new zge;t.breakUp(o);let e=t.result,r=0;t.commands.length&&(t.commands.commands.forEach(i=>{i.getAction()==="add"&&(r+=1)}),je.executeCommand(t.commands)),r>0&&(ie.publish("flushService",""),ie.publish("showPcbSlideMsg",["{0} line dispersed succeeded",[r]],$())),e.length>0&&ie.publish("onlySelect",e)}function TMt(){if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let o=Ve.getSelects();if(o.some(t=>t instanceof Me||t instanceof Ue||t instanceof Ge||t instanceof Le)){let t=new ve("unroute - clear connect"),e=new Set;o.forEach(i=>{if(!i.locked)if(i instanceof Me){let n=i.getItems();for(let s of n)(s instanceof Ue||s instanceof Ge||s instanceof Le)&&e.add(s)}else{if(!(i instanceof Ue||i instanceof Ge||i instanceof Le))return;e.add(i)}}),Hue(e).forEach(i=>{let n=i.getParent();!i.isEmpty&&(i instanceof Ue&&!n||i instanceof Ge&&!n)&&!Ps(i.model)&&(t.addCommand(Te.dispatch(i,"delete")),ie.publish("hasModifyPcbItem",i),i.remove(),ie.publish("delete",i))}),ie.publish("clearSelect",""),t.length>0&&je.executeCommand(t)}ie.publish("flushService","")}function IMt(){if(Ve.getSelects().some(t=>t instanceof Me||t instanceof Ue||t instanceof Ge||t instanceof Le)){let t=new ve("unroute - clear noework");Ve.getSelects().forEach(e=>{if(e.locked)return;let r=new Array;e instanceof Me?CMt(e,r):r=ze.getSameNetItemsWithoutPourAndPlaneZoneByItem(e),r.forEach(i=>{Ps(i.model)||!i.isEmpty&&(i instanceof Ue||i instanceof Ge)&&(i.getParent()||(t.addCommand(Te.dispatch(i,"delete")),ie.publish("hasModifyPcbItem",i),i.remove(),ie.publish("delete",i)))})}),ie.publish("clearSelect",""),t.length>0&&je.executeCommand(t)}ie.publish("flushService","")}function CMt(o,t){let e=o.getItems();for(let r of e)(r instanceof Ue||r instanceof Ge||r instanceof Le)&&ze.getSameNetItemsWithoutPourAndPlaneZoneByItem(r).forEach(n=>{!t.find(s=>s.globalIndex==n.globalIndex)&&t.push(n)})}var Yge=class extends fi{constructor(){super()}open(t){return{action:"panelize",unit:x.getInstance().unit,panelizeParam:ai.getInstance().getDefaultPanelize(),bbox:_p.getOutlineBbox()}}modify(t){}close(t){if(t.action=="confirm"){let r=new _p,i=r.recordHistory();r.applyPanelize(t.panelizeParam),je.executeCommand(i)}return!0}};var jge=class extends fi{constructor(){super()}open(t){let e=Kt.getAllItem().filter(s=>s instanceof Ri),r=new ft,i=x.getInstance().origin,n=e.map(s=>{let a,l,c;s.layerId==2?(a=s.bottomType,l=s.bottomWidth,c=s.bottomHeight):(a=s.topType,l=s.topWidth,c=s.topHeight);let h=s.center.x-i.x,u=s.center.y-i.y;return{padNumber:s.num,layer:s.layerId==1?"T":s.layerId==2?"B":"M",centerX:BE(r.conversion("mil","mm",h*10),{decimalPlacesShow:3}),centerY:BE(r.conversion("mil","mm",u*10),{decimalPlacesShow:3}),width:BE(r.conversion("mil","mm",l*10),{decimalPlacesShow:3}),height:BE(r.conversion("mil","mm",c*10),{decimalPlacesShow:3}),rotation:Math.round(Ht.toDegrees(s.rotation)),shape:a=="ELLIPSE"?"Round":a=="RECT"?"Rectangle":"Oval"}});return{action:"pad-coordinate-file",pads:Pd(n,"padNumber")}}modify(t){return!0}close(t){if(t.action=="confirm"){let r=x.getInstance().origin,i=new ve("Create Pads According to Pad Coordinate File"),n=Kt.getAllItem(),s=new Set,a=new ft;t.pads.forEach(l=>{let c=l.padNumber,h=a.conversion(t.unit,"mil",l.centerX)/10+r.x,u=a.conversion(t.unit,"mil",l.centerY)/10+r.y,d=new S(h,u),p=a.conversion(t.unit,"mil",l.width)/10,m=a.conversion(t.unit,"mil",l.height)/10,g=l.layer=="T"?1:l.layer=="B"?2:12,y=l.shape=="Rectangle"?"RECT":ne.eq(p,m)&&l.shape=="Round"?"ELLIPSE":"OVAL",b=Ht.toRadians(l.rotation),P=n.filter(T=>T.num==l.padNumber&&!s.has(T.globalIndex))[0];if(P&&P instanceof Ri){if(s.add(P.globalIndex),!SMt(P,g,y,p,m,b,c)){let T=new IP;i.addCommand(Te.dispatch(P,"modify"));let I=a.conversion(t.unit,x.getInstance().unit,l.width),C=a.conversion(t.unit,x.getInstance().unit,l.height),E=a.conversion("mil",x.getInstance().unit,P.holeRadius*20),O=a.conversion("mil",x.getInstance().unit,P.holeLength*10),_=P.holeShape=="ROUND"?Math.min(I,C):I;T.set(P).modifyBy({"attr-pad-shape-showtype":1,"attr-pad-general-width":I,"attr-pad-general-height":C,"attr-pad-general-shape":y,"attr-pad-hole-diameter":ne.greater(E,_)||!P.holeRadius?_*.6:E,"attr-pad-hole-length":ne.greater(O,C)||!P.holeLength?C*.6:O,"attr-layerid":g,"attr-rotation":l.rotation})}P.center.equals1(d)||(P.center=d)}else{let T=Kt.addPad(g,rt.defalutPad.type,c,d,y,p,m,0,y,p,m,0,y,p,m,0,b,!1,"",rt.defalutPad.expansionType,rt.defalutPad.pasteExpansion,rt.defalutPad.topSolderExpansion,rt.defalutPad.bottomSolderExpansion,[],!0,Math.min(p,m)*.6,Math.min(p,m)*.3,"ROUND",rt.defalutPad.holeRotation,rt.defalutPad.holeOffset);T.num=c,i.addCommand(Te.dispatch(T,"add"))}}),n.forEach(l=>{s.has(l.globalIndex)||(i.addCommand(Te.dispatch(l,"delete")),A.publish("delete",l),l.remove())}),i.length>0&&(je.executeCommand(i),A.publish("flushService",""),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())),A.publish("flushAttrPlane",{isUpdateDeviceData:"",doNotReloadPrjTree:""})}}};function SMt(o,t,e,r,i,n,s){return!(!o||o.num!=s||o.layerId!=t||!ne.eq(o.rotation,n)||(o.layerId==1||o.layerId==12)&&(!ne.eq(o.topWidth,r)||!ne.eq(o.topHeight,i)||o.topType!=e)||(o.layerId==2||o.layerId==12)&&(!ne.eq(o.bottomWidth,r)||!ne.eq(o.bottomHeight,i)||o.bottomType!=e)||o.layerId==12&&(!ne.eq(o.innerWidth,r)||!ne.eq(o.innerHeight,i)||o.innerType!=e))}var Xge=class o{constructor(){this._isSameProject=!0;this.paramUnit=10;this._maxDiffSize=2;this._noneBBox={minX:0,minY:0,maxX:0,maxY:0}}async compare(t){try{if(this.initProgress(t.progressCall||this.defaultProgressCall.bind(this)),!this.checkParams(t))return this.errorCall("error","Document data abnormality"),this._progress.end(),null;let r=await this.decoding();return r?(this.objectClassify(r),this.compareByObject(),this.integrateResult(),await Wi.clearOtherProjectManagerMap(),await gh.clearOtherProjectManagerMap(),this.exportComparisonResult()):(this.errorCall("error","Document decoding exception"),this._progress.end(),null)}catch{this.errorCall("error","Comparison failed, program exception")}}async compareByModels(t,e){this._params=e,this.dataStateInit();try{let r=new Array,i=new Array,{modelsMap:n,deleted:s}=await this.contrastHistoryNode(t);for(let[a,l]of n.entries()){if(l instanceof Li&&!l.getText())continue;let c=pc(a);c&&r.push(c),i.push(l)}for(let a of s){let l=pc(a);if(!(l instanceof Li&&!l.getText())&&l){let c=l.getParent();if(c&&s.includes(c.globalIndex))continue;r.push(l)}}return this.initProgress(e.progressCall||this.defaultProgressCall.bind(this)),this._curPcbIsFirst=!0,r.forEach(a=>{let l=this.getAreaIndex(a.center);this.putObject2ClassifyMap(a.layerId,l,this.getShapeType(a),a)}),this._curPcbIsFirst=!1,i.forEach(a=>{let l=this.getAreaIndex(a.center);this.putObject2ClassifyMap(a.layerId,l,this.getShapeType(a),a)}),this.compareByObject(),this.integrateResult(),await Wi.clearOtherProjectManagerMap(),await gh.clearOtherProjectManagerMap(),this.exportComparisonResult()}catch{this.errorCall("error","Comparison failed, program exception")}}async contrastHistoryNode(t){let e=new Map,r=x.getInstance().compiler,i=new ET(r),n=i.getDecodeTool(),s=r.getHandle();r.setHandle(new og(i),!0),new IC(r).parseFull(t);let a=n.getDeletedIds();return n.preAdjust(),l(i.getDecodeTool()),r.setHandle(s),{modelsMap:e,deleted:a};function l(h){c(h.layer),c(h.layerPhys),c(h.net),c(h.ruleTemplateName),c(h.rule),c(h.ruleSelect),c(h.group),c(h.font),c(h.via),c(h.pad),c(h.line),c(h.arc),c(h.poly),c(h.fill),c(h.fpcFill),c(h.region),c(h.partition),c(h.pour),c(h.copper),c(h.image),c(h.objs),c(h.tearDrop),c(h.str),c(h.attr),c(h.dimension),c(h.component),c(h.shells),c(h.shellCuts),c(h.shellEntity),c(h.creases),c(h.bosses),c(h.padsPairGroup),c(h.activeLayer)}function c(h){for(let u of h){u.resultNeedToBeCached=!1;let d=u.finish();d instanceof ki&&e.set(d.globalIndex,d)}}}compareFootprint(t,e){try{return this.initProgress(t.progressCall||this.defaultProgressCall.bind(this)),this.checkFootprintParams(t)?(this._pcbCommonData1=e._pcbCommonData1,this._pcbCommonData2=e._pcbCommonData2,this._decodingProgress.end(),this.objectClassifyByFootprint(t.footprint1,t.footprint2),this.compareByObject(),this.integrateResult(),this.exportComparisonResult()):(this.errorCall("error","Document data abnormality"),this._progress.end(),null)}catch{this.errorCall("error","Comparison failed, program exception")}}initProgress(t){this._progress=new Um("pcb comparison",0,t),this._paramsInitProgress=new Um("params init"),this._decodingProgress=new Um("document decoding"),this._classifyProgress=new Um("object classify"),this._comparisonProgress=new Um("object comparison"),this._integrationProgress=new Um("result integration"),this._progress.start(this._paramsInitProgress),this._progress.start(this._decodingProgress),this._progress.start(this._classifyProgress),this._progress.start(this._comparisonProgress),this._progress.start(this._integrationProgress)}defaultProgressCall(t,e){$0(e||"",void 0,t*100+"%")}defaultErrorCall(t,e,r){console.error(t,e,r)}checkParams(t){if(!t)return!1;let{pcbUuid1:e,pcbUuid2:r,valUnit:i,deviation:n,comparisonSize:s,pcbWorld1:a,pcbWorld2:l}=t,c=this._paramsInitProgress;if(!e||!r)return!1;t.errorCall||(t.errorCall=this.defaultErrorCall.bind(this));let h=!1,u=this.paramUnit;i!=u&&(t.valUnit=u,h=!0),n>0?h&&(t.deviation=Di.convert(t.deviation,i,u)):t.deviation=Di.convert(1,1,u),s>0?h&&(t.comparisonSize=Di.convert(t.comparisonSize,i,u)):t.comparisonSize=Di.convert(100,1,u);let d=Di.convert(10,1,u);return t.comparisonSize<d&&(t.comparisonSize=d),a.uuid||(a.uuid=e),l.uuid||(l.uuid=r),this.dataStateInit(),this._params=t,this._isSameProject=(t.pcbWorld1.projectId||"")==(t.pcbWorld2.projectId||""),c.end(),!0}checkFootprintParams(t){if(!t)return!1;let{valUnit:e,deviation:r,comparisonSize:i,footprint1:n,footprint2:s}=t,a=this._paramsInitProgress;if(!n||!s)return!1;t.errorCall||(t.errorCall=this.defaultErrorCall.bind(this));let l=!1,c=this.paramUnit;e!=c&&(t.valUnit=c,l=!0),r>0?l&&(t.deviation=Di.convert(t.deviation,e,c)):t.deviation=Di.convert(1,1,c),i>0?l&&(t.comparisonSize=Di.convert(t.comparisonSize,e,c)):t.comparisonSize=Di.convert(100,1,c);let h=Di.convert(10,1,c);return t.comparisonSize<h&&(t.comparisonSize=h),this.dataStateInit(),this._params=t,this._isSameProject=!1,a.end(),!0}creatDefaultRule(){let t=10,e=Di.convert(2,1,t),r=Di.convert(-1e3,1,t),i=Di.convert(2,1,t),n=Di.convert(0,1,t),s=Di.convert(-1e3,1,t);return{layerNameMap:{},rule:{solderMaskExpansionDefault:{pad:{topExpansion:e,botExpansion:e},via:{topExpansion:r,botExpansion:r},testPad:{topExpansion:i,botExpansion:i}},pasteMaskExpansionDefault:{pad:{topExpansion:n,botExpansion:n},testPad:{topExpansion:s,botExpansion:s}}}}}dataStateInit(){this._pcbCommonData1=this.creatDefaultRule(),this._pcbCommonData2=this.creatDefaultRule(),this._pcbObjectClassifyMap1={},this._pcbObjectClassifyMap2={},this._comparedMap={},this._lessMapCache={},this._moreMapCache={},this._comparisonResultMap={},this._footprintCompareResultMap={},this._totalIdsMap={},this._realTypeMap1={},this._realTypeMap2={}}initDecodingEnv(t){if(!t)return;let{projectId:e}=t;AUe(t),gh.otherDecodingProjectId=e,Wi.otherDecodingProjectId=e}async decoding(){let{pcbWorld1:t,pcbWorld2:e}=this._params,r=this._decodingProgress;r.startNumbers(2),this.initLayer(),this.initDecodingEnv(t);let i=VX(t),n=new E5(i,t);await n.onlyCompiler(),r.tick(),this.initDecodingEnv(e);let s=VX(e),a=new E5(s,e);return await a.onlyCompiler(),r.tick(),r.end(),{decode1:n.getDecodeTool(),decode2:a.getDecodeTool()}}initLayer(){let t=$e.getInstance();if(t.getAllItem().length>0)return!1;let e=0;for(let r of Bg){r.active&&(e=r.layerId);let{layerId:i,type:n,name:s,order:a,activeColor:l,deactiveColor:c,active:h,layerStatus:u}=r,d=vf.build(u!=0,u==1,!1);t.addLayer(i,n,s,d,l,c)}return!0}objectClassify(t){let{pcbWorld1:e,pcbWorld2:r}=this._params,{decode1:i,decode2:n}=t,s=this._classifyProgress;return s.startNumbers(2),this.initDecodingEnv(e),Wi.otherDecodingProjectId=e.projectId,this._curDecodeTool=i,this._curPcbIsFirst=!0,this.modelClassify(this._pcbCommonData1),s.tick(),this.initDecodingEnv(r),this._curDecodeTool=n,this._curPcbIsFirst=!1,this.modelClassify(this._pcbCommonData2),s.tick(),this._curDecodeTool=null,s.end(),!0}objectClassifyByFootprint(t,e){let r=this._classifyProgress;return r.startNumbers(2),this._curPcbIsFirst=!0,this.footprintModelClassify(t),r.tick(),this._curPcbIsFirst=!1,this.footprintModelClassify(e),r.tick(),this._curDecodeTool=null,r.end(),!0}modelClassify(t){let e=this._curDecodeTool;e&&(e.preAdjust(),this.handleLayers(e.layer,t),this.ruleHandler(e.rule,t),this.padHandler(),this.viaHandler(),this.lineHandler(),this.arcHandler(),this.polyHandler(),this.fillHandler(),this.fpcFillHandler(),this.regionHandler(),this.partitionHandler(),this.pourHandler(),this.copperHandler(),this.imageHandler(),this.objHandler(),this.tearDropHandler(),this.stringHandler(),this.attrHandler(),this.dimensionHandler(),this.componentHandler(),this.shellsHandler(),this.shellCutsHandler(),this.shellEntityHandler(),this.creasesHandler(),this.bossesHandler())}getShapeType(t){return{Component:"Component",Track:"Track",ArcTrack:"ArcTrack",Line:"Line",Arc:"Arc",Rect:"Rect",Circle:"Circle",Pad:"Pad",Via:"Via",Text:"Text",Image:"Image",Picture:"Colorful Image",TearDrop:"TearDrop","Length Dimension":"Dimension","Protractor Dimension":"Protractor","Radius Dimension":"RadiusMark",Hole:"Slot",Polygon:"Polyline"}[t.modelType]||"Shape"}footprintModelClassify(t){t.iterator(e=>{if(e instanceof Li&&e.key)return!0;let r=this.getShapeType(e),i=this.getAreaIndex(e.center);return this.putObject2ClassifyMap(e.layerId,i,r,e),!0})}handleLayers(t,e){if(!t)return;let r=e.layerNameMap;t.forEach(i=>{r[i.layerId]=i.getName()})}ruleHandler(t,e){if(!t)return;let{solderMaskExpansionDefault:r,pasteMaskExpansionDefault:i}=e.rule;t.forEach(s=>{s.resultNeedToBeCached=!1;let a=s.toJson(),l=a.context;if(!(!a.isDefault&&!l))if(Array.isArray(l)){let c=0;l[c++],a.type=="9"?(r.pad.topExpansion=n(l[c++]),r.pad.botExpansion=n(l[c++]),r.via.topExpansion=n(l[c++]),r.via.botExpansion=n(l[c++]),r.testPad.topExpansion=n(l[c++]),r.testPad.botExpansion=n(l[c++])):a.type=="8"&&(i.pad.topExpansion=n(l[c++]),i.pad.botExpansion=n(l[c++]),i.testPad.topExpansion=n(l[c++]),i.testPad.botExpansion=n(l[c++]))}else a.type=="9"?(r.pad.topExpansion=n(l.padTopExpan),r.pad.botExpansion=n(l.padBotExpan),r.via.topExpansion=n(l.viaTopExpan),r.via.botExpansion=n(l.viaBotExpan),r.testPad.topExpansion=n(l.testPointTopExpan),r.testPad.botExpansion=n(l.testPointBotExpan)):a.type=="8"&&(i.pad.topExpansion=n(l.padTopExpan),i.pad.botExpansion=n(l.padBotExpan),i.testPad.topExpansion=n(l.testPointTopExpan),i.testPad.botExpansion=n(l.testPointBotExpan))});function n(s){return Di.convert(s,1,10)}}shapeFilter(t){return!1}layerFilter(t){return!1}getAreaIndex(t){let e=this._params.comparisonSize,r=Math.floor(t.x/e),i=Math.floor(t.y/e);return r+","+i}getObjId(t){return t.globalIndex}getObjShowId(t){let e=t.getParent(),r=e?this.getObjShowId(e):"",i=t.number;return r+`${ur}${i}`}getComparedKey(t,e){return this.getObjId(t)+","+this.getObjId(e)}putObject2ClassifyMap(t,e,r,i){let n=this._curPcbIsFirst,s=n?this._pcbObjectClassifyMap1:this._pcbObjectClassifyMap2;s[t]?s[t][e]?s[t][e][r]?s[t][e][r].push(i):s[t][e][r]=[i]:s[t][e]={[r]:[i]}:s[t]={[e]:{[r]:[i]}};let a=this._totalIdsMap,l=this.getObjId(i);a[r]||(a[r]={pcbIds1:[],pcbIds2:[],comparisonIdMap:{}}),n?a[r].pcbIds1.push(l):a[r].pcbIds2.push(l)}padHandler(){let t="Pad";this.shapeFilter(t)||this._curDecodeTool.pad.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish(),i=this.getAreaIndex(r.center);this.putObject2ClassifyMap(r.layerId,i,t,r)}catch(r){console.warn(r)}}})}viaHandler(){let t="Via";this.shapeFilter(t)||this._curDecodeTool.via.forEach(e=>{if(this.layerFilter(e.shapeLayerId))return;e.resultNeedToBeCached=!1;let r=e.getName();try{let i=e.finish();i.name=r;let n=this.getAreaIndex(i.center);this.putObject2ClassifyMap(i.layerId,n,t,i)}catch(i){console.warn(i)}})}lineHandler(){let t="Track";this.shapeFilter(t)||this._curDecodeTool.line.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish(),i=this.getAreaIndex(r.center);this.putObject2ClassifyMap(r.layerId,i,t,r)}catch(r){console.warn(r)}}})}arcHandler(){let t="ArcTrack";this.shapeFilter(t)||this._curDecodeTool.arc.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish(),i=this.getAreaIndex(r.center);this.putObject2ClassifyMap(r.layerId,i,t,r)}catch(r){console.warn(r)}}})}profileHandle(t){let e,r,i=null;if(t instanceof Po)r=t.center,e="Circle",i=t.type;else if(t instanceof Aa)r=t.bbox.center(),e="Rect",i=t.type;else if(t instanceof ss)r=t.bbox.center(),e="Polyline",i=t.type;else if(t instanceof Cn)r=t.bbox.center(),e="PlaneZone",i=e;else return null;if(this.shapeFilter(i))return null;this._curPcbIsFirst?this._realTypeMap1[this.getObjId(t)]=i:this._realTypeMap2[this.getObjId(t)]=i;let n=this.getAreaIndex(r);this.putObject2ClassifyMap(t.layerId,n,e,t)}polyHandler(){let t="Polyline";this.shapeFilter(t)||this._curDecodeTool.poly.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish();this.profileHandle(r)}catch(r){console.warn(r)}}})}fillHandler(){let t="Fill";this.shapeFilter(t)||this._curDecodeTool.fill.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish();this.profileHandle(r)}catch(r){console.warn(r)}}})}fpcFillHandler(){let t="FpcFill";this.shapeFilter(t)||this._curDecodeTool.fpcFill.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish();this.profileHandle(r)}catch(r){console.warn(r)}}})}regionHandler(){let t="Region";this.shapeFilter(t)||this._curDecodeTool.region.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish();this.profileHandle(r)}catch(r){console.warn(r)}}})}partitionHandler(){this._curDecodeTool.partition.forEach(t=>{if(!this.layerFilter(t.shapeLayerId)){t.resultNeedToBeCached=!1;try{let e=t.finish();this.profileHandle(e)}catch(e){console.warn(e)}}})}pourHandler(){let t="Pour";this.shapeFilter(t)||this._curDecodeTool.pour.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish();this.profileHandle(r)}catch(r){console.warn(r)}}})}copperHandler(){let t="Copper";this.shapeFilter(t)||this._curDecodeTool.copper.forEach(e=>{e.coppers.forEach(r=>{if(!this.layerFilter(r.shapeLayerId)){r.resultNeedToBeCached=!1;try{let i=r.finish(),n=this.getAreaIndex(i.bbox.center());this.putObject2ClassifyMap(i.layerId,n,t,i)}catch(i){console.warn(i)}}})})}imageHandler(){let t="Image";this.shapeFilter(t)||this._curDecodeTool.image.forEach(e=>{if(this.layerFilter(e.shapeLayerId))return;e.resultNeedToBeCached=!1;let r=e.finish(!0),i=this.getAreaIndex(r.bbox.center());this.putObject2ClassifyMap(r.layerId,i,t,r)})}objHandler(){let t="Colorful Image";this.shapeFilter(t)||this._curDecodeTool.objs.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish(),i=this.getAreaIndex(r.bbox.center());this.putObject2ClassifyMap(r.layerId,i,t,r)}catch(r){console.warn(r)}}})}tearDropHandler(){let t="TearDrop";this.shapeFilter(t)||this._curDecodeTool.tearDrop.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish();this.profileHandle(r)}catch(r){console.warn(r)}}})}stringHandler(){let t="Text";this.shapeFilter(t)||this._curDecodeTool.str.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish(),i=this.getAreaIndex(r.position);this.putObject2ClassifyMap(r.layerId,i,t,r)}catch(r){console.warn(r)}}})}attrHandler(){let t="Component Property";this.shapeFilter(t)||this._curDecodeTool.attr.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish();if(!r.getText())return;let i=this.getAreaIndex(r.position);this.putObject2ClassifyMap(r.layerId,i,t,r)}catch(r){console.warn(r)}}})}dimensionHandler(){let t="DimensionTool";this.shapeFilter(t)||this._curDecodeTool.dimension.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish(),i;if(r instanceof Rf)i="Dimension";else if(r instanceof zd)i="Protractor";else if(r instanceof Df)i="RadiusMark";else return;let n=this.getAreaIndex(r.bbox.center());this.putObject2ClassifyMap(r.layerId,n,i,r)}catch(r){console.warn(r)}}})}componentHandler(){let t="Component";this.shapeFilter(t)||this._curDecodeTool.component.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish();if(!r)return;let i=this.getAreaIndex(r.position);this.putObject2ClassifyMap(r.layerId,i,t,r)}catch(r){console.warn(r)}}})}shellsHandler(){let t="Shell";this.shapeFilter(t)||this._curDecodeTool.shells.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish();this.profileHandle(r)}catch(r){console.warn(r)}}})}shellCutsHandler(){let t="ShellCut";this.shapeFilter(t)||this._curDecodeTool.shellCuts.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish();this.profileHandle(r)}catch(r){console.warn(r)}}})}shellEntityHandler(){let t="ShellEntity";this.shapeFilter(t)||this._curDecodeTool.shellEntity.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish();this.profileHandle(r)}catch(r){console.warn(r)}}})}creasesHandler(){let t="Crease";this.shapeFilter(t)||this._curDecodeTool.creases.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish();this.profileHandle(r)}catch(r){console.warn(r)}}})}bossesHandler(){let t="Boss";this.shapeFilter(t)||this._curDecodeTool.bosses.forEach(e=>{if(!this.layerFilter(e.shapeLayerId)){e.resultNeedToBeCached=!1;try{let r=e.finish();this.profileHandle(r)}catch(r){console.warn(r)}}})}compareByObject(){let t=this._comparisonProgress,e=this._pcbObjectClassifyMap1,r=this._pcbObjectClassifyMap2,i=Object.keys(e),n=Object.keys(r),s=Fb(i,n);s.less.forEach(a=>{let l=e[a];for(let c in l){let h=l[c];for(let u in h)h[u].forEach(d=>{this.addLess(u,d)})}}),s.more.forEach(a=>{let l=r[a];for(let c in l){let h=l[c];for(let u in h)h[u].forEach(p=>{this.addMore(u,p)})}}),s.same.forEach(a=>{let l=e[a],c=r[a],h=Object.keys(l),u=Object.keys(c),d=Fb(h,u);d.less.forEach(p=>{let m=l[p];for(let g in m)m[g].forEach(y=>{this.addLess(g,y)})}),d.more.forEach(p=>{let m=c[p];for(let g in m)m[g].forEach(y=>{this.addMore(g,y)})}),d.same.forEach(p=>{let m=l[p],g=c[p],y=Object.keys(m),b=Object.keys(g),P=Fb(y,b);P.less.forEach(T=>{m[T].forEach(I=>{this.addLess(T,I)})}),P.more.forEach(T=>{g[T].forEach(I=>{this.addMore(T,I)})}),P.same.forEach(T=>{let I=m[T],C=g[T];this.compareObjectsByType(T,I,C)})})}),t.end()}compareObjectsByType(t,e,r){switch(t){case"Pad":case"ComponentPad":this.compareObjects(t,e,r,i=>i.center,this.comparePad);break;case"Via":this.compareObjects(t,e,r,i=>i.center,this.compareVia);break;case"Track":this.compareObjects(t,e,r,i=>i.center,this.compareTrack);break;case"ArcTrack":this.compareObjects(t,e,r,i=>i.center,this.compareArcTrack);break;case"Polyline":this.compareObjects(t,e,r,i=>i.bbox.center(),this.compare2DPoly);break;case"Circle":this.compareObjects(t,e,r,i=>i.bbox.center(),this.compare2DCircle);break;case"Rect":this.compareObjects(t,e,r,i=>i.bbox.center(),this.compare2DRect);break;case"PlaneZone":this.compareObjects(t,e,r,i=>i.bbox.center(),this.comparePlaneZone);break;case"Copper":this.compareObjects(t,e,r,i=>i.bbox.center(),this.compareCopper);break;case"Image":this.compareObjects(t,e,r,i=>i.bbox.center(),this.compareImage);break;case"Colorful Image":this.compareObjects(t,e,r,i=>i.bbox.center(),this.comparePicture);break;case"Dimension":this.compareObjects(t,e,r,i=>i.bbox.center(),this.compareDimension);break;case"Protractor":this.compareObjects(t,e,r,i=>i.bbox.center(),this.compareProtractor);break;case"RadiusMark":this.compareObjects(t,e,r,i=>i.bbox.center(),this.compareRadiusMark);break;case"Text":case"Component Property":this.compareObjects(t,e,r,i=>i.position,this.compareText);break;case"Component":this.compareObjects(t,e,r,i=>i.position,this.compareComponent);break;default:console.warn("Not supported yet objectType:",t);break}}pointSort(t,e){return t.x!=e.x?t.x-e.x:t.y-e.y}equalLayer(t,e){if(t>=71&&e>=71){let r=this._pcbCommonData1.layerNameMap[t],i=this._pcbCommonData2.layerNameMap[e];return r==i}return t==e}equalFloat(t,e,r=1e-5){return Math.abs(t-e)<=r}equalRadian(t,e,r=.001){return Math.abs(Ht.regular(t)-Ht.regular(e))<=r}equalAngle(t,e,r){return Math.abs(Ht.regularD(t)-Ht.regularD(e))<=r}equalFloatByDeviation(t,e,r=3){return on(Math.abs(t-e),r)<=this._params.deviation}equalVector2(t,e){return on(t.distance1(e),3)<=this._params.deviation}equalLine(t,e){let r=t.start(),i=t.end(),n=e.start(),s=e.end();return OA([r,i],[n,s])?this.equalVector2(r,n)&&this.equalVector2(i,s)||this.equalVector2(r,s)&&this.equalVector2(i,n):!1}equalArc(t,e){if(t.isLarge()!=e.isLarge()||!this.equalFloatByDeviation(t.rx,e.rx)||!this.equalFloatByDeviation(t.ry,e.ry)||!this.equalVector2(t.center,e.center))return!1;if(t.sweep()==e.sweep()){if(!this.equalVector2(t.start(),e.start())||!this.equalVector2(t.end(),e.end()))return!1}else if(!this.equalVector2(t.start(),e.end())||!this.equalVector2(t.end(),e.start()))return!1;return!0}equalRect(t,e){return!(!this.equalFloatByDeviation(t.width,e.width)||!this.equalFloatByDeviation(t.height,e.height)||!this.equalAngle(t.angle,e.angle)||!this.equalFloatByDeviation(t.radius,e.radius)||!this.equalVector2(t.leftUpPoint,e.leftUpPoint))}comparePolyline(t,e){let r=this,i=t.primitives,n=e.primitives,s=T(i),a=T(n),l={},c={},h={},u={},d=Object.keys(s),p=Object.keys(a),m=Fb(d,p),g=[];m.less.forEach(_=>{let{lines:R,arcs:v,rects:D}=s[_];return R&&R.length>0&&R.forEach((w,F)=>I(w,"lines",_,F,!1)),v&&v.length>0&&v.forEach((w,F)=>I(w,"arcs",_,F,!1)),D&&D.length>0&&D.forEach((w,F)=>I(w,"rects",_,F,!1)),!1}),m.more.forEach(_=>{let{lines:R,arcs:v,rects:D}=a[_];return R&&R.length>0&&R.forEach((w,F)=>C(w,"lines",_,F,!1)),v&&v.length>0&&v.forEach((w,F)=>C(w,"arcs",_,F,!1)),D&&D.length>0&&D.forEach((w,F)=>C(w,"rects",_,F,!1)),!1}),m.same.forEach(_=>{let{lines:R,arcs:v,rects:D}=s[_],{lines:w,arcs:F,rects:H}=a[_];E(R,w,"lines",_,_,r.equalLine),E(v,F,"arcs",_,_,r.equalArc),E(D,H,"rects",_,_,r.equalRect)});let y=Object.keys(l),b=Object.keys(c),P=Fb(y,b);return P.less.forEach(_=>{let R=l[_];for(let v in R){let{items:D,indexMap:w}=R[v];D.forEach((F,H)=>{I(F,_,v,w[H],!0)})}}),P.more.forEach(_=>{let R=c[_];for(let v in R){let{items:D,indexMap:w}=R[v];D.forEach((F,H)=>{C(F,_,v,w[H],!0)})}}),P.same.forEach(_=>{let R=l[_],v=c[_],D;switch(_){case"lines":D=r.equalLine;break;case"arcs":D=r.equalArc;break;case"rects":D=r.equalRect;break;default:break}if(!D)return;let w=[];for(let F in R){let{items:H,indexMap:z}=R[F];H.forEach((G,W)=>{let L=!1,B=z[W];for(let N in v){let{items:U,indexMap:k}=v[N];if(L=U.some((V,Y)=>{let X=k[Y],Z=[N,X].join("-");if(w.includes(Z)||O(_,F,B,N,X))return!1;let ae=D.call(r,G,V);return ae&&w.push(Z),ae}),L)break}L||I(G,_,F,B,!0)})}for(let F in v){let{items:H,indexMap:z}=v[F];H.forEach((G,W)=>{let L=z[W],B=[F,L].join("-");w.includes(B)||C(G,_,F,L,!0)})}}),{lessMapReal:h,moreMapReal:u};function T(_){let R={};return _.forEach(v=>{if(v instanceof M){let D=r.getAreaIndex(v.center());R[D]?R[D].lines?R[D].lines.push(v):R[D].lines=[v]:R[D]={lines:[v]}}else if(v instanceof q){let D=r.getAreaIndex(v.center);R[D]?R[D].arcs?R[D].arcs.push(v):R[D].arcs=[v]:R[D]={arcs:[v]}}else if(v instanceof $H){let D=r.getAreaIndex(v.center());R[D]?R[D].rects?R[D].rects.push(v):R[D].rects=[v]:R[D]={rects:[v]}}else console.warn("Unsupported Type",v)}),R}function I(_,R,v,D,w){let F=w?h:l;F[R]||(F[R]={});let H=F[R];H[v]?(H[v].items.push(_),H[v].indexMap.push(D)):H[v]={items:[_],indexMap:[D]}}function C(_,R,v,D,w){let F=w?u:c;F[R]||(F[R]={});let H=F[R];H[v]?(H[v].items.push(_),H[v].indexMap.push(D)):H[v]={items:[_],indexMap:[D]}}function E(_,R,v,D,w,F){if((_==null?void 0:_.length)>0&&(R==null?void 0:R.length)>0){let H=[],z=[];_.some((G,W)=>z.length==R.length?!0:(R.some((L,B)=>{if(z.includes(B)||O(v,D,W,w,B))return!1;let U=F.call(r,G,L);return U&&(H.push(W),z.push(B)),U}),!1)),H.length<_.length&&_.forEach((G,W)=>{H.includes(W)||I(G,v,D,W,!1)}),z.length<R.length&&R.forEach((G,W)=>{z.includes(W)||C(G,v,w,W,!1)})}else(_==null?void 0:_.length)>0?_.forEach((H,z)=>I(H,v,D,z,!1)):(R==null?void 0:R.length)>0&&R.forEach((H,z)=>C(H,v,w,z,!1))}function O(_,R,v,D,w){let F=[_,R,v,D,w].join("-");return g.includes(F)?!0:(g.push(F),!1)}}compareObjects(t,e,r,i,n){let s=e.sort((g,y)=>this.pointSort(i(g),i(y))),a=r.sort((g,y)=>this.pointSort(i(g),i(y))),l=[],c=[],h=new Set,u={};s.forEach((g,y)=>{if(c.length==a.length){this.addLess(t,g);return}let b=-1,P,T={},I=new Set;a.some((C,E)=>{if(c.includes(E))return!1;let O=n.call(this,g,C),_=this.getComparedKey(g,C);return this._comparedMap[_]=O,O.diffWeight==0?(b=E,P=O,!0):(T[E]=O,I.add(E),!1)}),b>=0?(this.updateComparisonResults(t,"same",this.shape2ComparisonResultObject(g,t,!0,P.overDiffBBox1),this.shape2ComparisonResultObject(a[b],t,!1,P.overDiffBBox2)),l.push(y),c.push(b)):(I.forEach(C=>{h.add(C)}),u[y]=T)}),c.length+h.size<a.length&&a.forEach((g,y)=>{c.includes(y)||h.has(y)||this.addMore(t,g)});let d={},p=new Set,m=new Set;for(let g in u){let y=+g;if(l.includes(y))continue;p.add(y);let b=u[g];for(let P in b){let T=+P;if(c.includes(T))continue;m.add(T);let C=b[P].diffWeight;if(C>this._maxDiffSize)continue;d[C]||(d[C]={});let E=d[C];E[y]?E[y].push(T):E[y]=[T]}}p.forEach(g=>{let y=s[g];this.addLess(t,y)}),m.forEach(g=>{let y=a[g];this.addMore(t,y)})}comparePad(t,e){let r=this,i=[],n=t.getParent(),s=e.getParent(),a=!1;if(!n&&!s?a=!0:n instanceof vi&&s instanceof vi&&(a=n.footprintId==s.footprintId),!a)return{diffTypes:["Parent"],diffWeight:this._maxDiffSize+1};if(this.equalLayer(t.layerId,e.layerId)||i.push("Layer"),t.net!=e.net&&i.push("Net"),this.equalVector2(t.center,e.center)||i.push("Pick and Place"),t.num!=e.num&&i.push("Number"),(!g(t.top,e.top)||!g(t.bottom,e.bottom)||!g(t.inner,e.inner))&&i.push("Shape"),!this.equalRadian(t.rotation,e.rotation))if(i.includes("Shape"))i.push("Rotation");else{let b=[t.top,t.bottom,e.inner].filter(T=>!!T)[0];b.type=="ELLIPSE"||b.type=="OVAL"&&b.width==b.height||i.push("Rotation")}y(t.hole,e.hole)||i.push("Hole");let l=t.topSolderExpansion,c=t.bottomSolderExpansion,h=t.pasteExpansion;if(t.expansionType==1){let{solderMaskExpansionDefault:b,pasteMaskExpansionDefault:P}=this._pcbCommonData1.rule;l=b.pad.topExpansion,c=b.pad.botExpansion,h=P.pad.topExpansion}let u=e.topSolderExpansion,d=e.bottomSolderExpansion,p=e.pasteExpansion;if(e.expansionType==1){let{solderMaskExpansionDefault:b,pasteMaskExpansionDefault:P}=this._pcbCommonData2.rule;u=b.pad.topExpansion,d=b.pad.botExpansion,p=P.pad.topExpansion}(l!=u&&!(isNaN(l)&&isNaN(u))||c!=d&&!(isNaN(c)&&isNaN(d)))&&i.push("Solder Mask Expansion"),h!=p&&!(isNaN(h)&&isNaN(p))&&i.push("Paste Mask Expansion");let m=i.length;return{diffTypes:i,diffWeight:m};function g(b,P){if(!b||!P)return!0;let T=b.type==P.type&&b.width==P.width&&b.height==P.height&&b.ratio==P.ratio;if(T&&b.pl&&P.pl)if(b.pl.primitives.length!=P.pl.primitives.length)T=!1;else{let I=r.comparePolyline(b.pl,P.pl);T=Object.keys(I.lessMapReal).length==0&&Object.keys(I.moreMapReal).length==0}return T}function y(b,P){return!b||!P?!0:b.holeShape==P.holeShape&&b.holeLength==P.holeLength&&b.holeRadius==P.holeRadius&&r.equalVector2(b.holeOffset,P.holeOffset)}}compareVia(t,e){let r=[];t.net!=e.net&&r.push("Net"),this.equalVector2(t.center,e.center)||r.push("Pick and Place"),t.type!=e.type&&r.push("Type"),this.equalFloat(t.radius,e.radius)||r.push("Outside Diameter"),this.equalFloat(t.holeRadius,e.holeRadius)||r.push("Inside Diameter"),t.name!=e.name&&r.push("Layer Pair");let i=t.topExpansion,n=t.bottomExpansion;if(t.expansionType==1){let{solderMaskExpansionDefault:c}=this._pcbCommonData1.rule;i=c.via.topExpansion,n=c.via.botExpansion}let s=e.topExpansion,a=e.bottomExpansion;if(e.expansionType==1){let{solderMaskExpansionDefault:c}=this._pcbCommonData2.rule;s=c.via.topExpansion,a=c.via.botExpansion}i!=s&&!(isNaN(i)&&isNaN(s))&&r.push("TopLayer Solder Mask Expansion"),n!=a&&!(isNaN(n)&&isNaN(a))&&r.push("BottomLayer Solder Mask Expansion");let l=r.length;return{diffTypes:r,diffWeight:l}}compareTrack(t,e){let r=[];this.equalLayer(t.layerId,e.layerId)||r.push("Layer"),t.net!=e.net&&r.push("Net"),this.equalLine(t.primitive,e.primitive)||r.push("Path"),t.width!=e.width&&r.push("Stroke Width");let i=r.length;return{diffTypes:r,diffWeight:i}}compareArcTrack(t,e){let r=[];this.equalLayer(t.layerId,e.layerId)||r.push("Layer"),t.net!=e.net&&r.push("Net"),this.equalArc(t.primitive,e.primitive)||r.push("Path"),t.width!=e.width&&r.push("Stroke Width");let i=r.length;return{diffTypes:r,diffWeight:i}}compare2DProfile(t,e){let r=this,i=[],n=0;this.equalLayer(t.layerId,e.layerId)||i.push("Layer"),t.net!=e.net&&i.push("Net");let s=t.type==e.type;if(!s){i.push("Type");let h=["Board Outline","Copper Region","Fill Region","Slot Region","Prohibited Region","Constraint Region","Line"];n+=h.includes(t.type)&&h.includes(e.type)?1:2}if(this.equalFloat(t.strokeWidth,e.strokeWidth)||i.push("Stroke Width"),s){let h=t.component,u=e.component;switch(t.type){case"Board Outline":case"Slot Region":case"Fill Region":case"TearDrop":case"Line":case"LINESUTUREVIA":case"3D Shell - Outline":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":case"3D Shell - Screw Pillar":case"3D Shell - Side Datum Line":case"Partition":case"Cutout":case"Constraint Region":case"Annotation":break;case"Copper Region":a(h,u);break;case"Prohibited Region":l(h,u);break;case"FPC Stiffener":c(h,u);break;default:break}}return{diffTypes:i,overWeight:n};function a(h,u){if(!h||!u){h!=u&&i.push("CopperArea Properties");return}h.style!=u.style?i.push("Fill Style"):(r.equalFloat(h.gridLineWidth,u.gridLineWidth)||i.push("Line Width"),r.equalFloat(h.clearance,u.clearance)||i.push("Line Spacing")),h.keepIsland!=u.keepIsland&&i.push("Keep Island"),h.optimization!=u.optimization&&i.push("Optimization"),r.equalFloat(h.optimizationValue,u.optimizationValue)||i.push("Mininum Optimized Width")}function l(h,u){if(!h||!u){h!=u&&i.push("Prohibited Option");return}(h.device!=u.device||h.track!=u.track||h.copper!=u.copper||h.fill!=u.fill||h.planzone!=u.planzone)&&i.push("Prohibited Option")}function c(h,u){if(!h||!u){h!=u&&i.push("FPC Stiffener");return}h.material!=u.material&&i.push("Material"),h.thickness!=u.thickness&&i.push("Thickness")}}compare2DPoly(t,e){let r=this.compare2DProfile(t,e),i=r.diffTypes,n=r.overWeight,s=t.outline,a=e.outline,l=t.strokeWidth,c=e.strokeWidth,h,u;s instanceof fe?h=[s]:h=s.items,a instanceof fe?u=[a]:u=a.items;let d=h.length,p=u.length,m=Math.min(d,p),g=[],y=[],b=0,P=!1;for(let I=0;I<m;I++){let C=h[I],E=u[I];if(C.primitives.length!=E.primitives.length){P=!0;continue}let{lessMapReal:O,moreMapReal:_}=this.comparePolyline(C,E);if(O)for(let R in O){let v=O[R];for(let D in v)v[D].items.forEach(F=>{g.push(this.getPrimitiveBBox(F,l)),b++})}if(_)for(let R in _){let v=_[R];for(let D in v)v[D].items.forEach(F=>{y.push(this.getPrimitiveBBox(F,c)),b++})}}if(d>m)for(let I=m;I<d;I++){let C=h[I];b+=C.primitives.length,C.primitives.forEach(E=>{g.push(this.getPrimitiveBBox(E,l))})}if(p>m)for(let I=m;I<p;I++){let C=u[I];b+=C.primitives.length,C.primitives.forEach(E=>{y.push(this.getPrimitiveBBox(E,c))})}(P||b>0)&&i.push("Path");let T=i.length+n;return{diffTypes:i,diffWeight:T,overDiffBBox1:g.length>0?g:void 0,overDiffBBox2:y.length>0?y:void 0}}compare2DCircle(t,e){let r=this.compare2DProfile(t,e),i=r.diffTypes,n=r.overWeight;(t.radius!=e.radius||!this.equalVector2(t.center,e.center))&&i.push("Path");let s=i.length+n;return{diffTypes:i,diffWeight:s}}compare2DRect(t,e){let r=this.compare2DProfile(t,e),i=r.diffTypes,n=r.overWeight;(!this.equalFloat(t.width,e.width)||!this.equalFloat(t.height,e.height)||!this.equalRadian(t.rotation,e.rotation)||!this.equalFloat(t.radius,e.radius)||!this.equalVector2(t.start,e.start))&&i.push("Path");let s=i.length+n;return{diffTypes:i,diffWeight:s}}comparAbstractFill(t,e){let r=[];this.equalLayer(t.layerId,e.layerId)||r.push("Layer"),t.net!=e.net&&r.push("Net");let i=t.pls,n=e.pls,s=i.length,a=n.length,l=Math.min(s,a),c=[],h=[],u=0,d=!1;for(let p=0;p<l;p++){let m=i[p],g=n[p];if(m.primitives.length!=g.primitives.length){d=!0;continue}let{lessMapReal:y,moreMapReal:b}=this.comparePolyline(m,g);if(y)for(let P in y){let T=y[P];for(let I in T)T[I].items.forEach(E=>{c.push(this.getPrimitiveBBox(E)),u++})}if(b)for(let P in b){let T=b[P];for(let I in T)T[I].items.forEach(E=>{h.push(this.getPrimitiveBBox(E)),u++})}}if(s>l)for(let p=l;p<s;p++){let m=i[p];u+=m.primitives.length,m.primitives.forEach(g=>{c.push(this.getPrimitiveBBox(g))})}if(a>l)for(let p=l;p<a;p++){let m=n[p];u+=m.primitives.length,m.primitives.forEach(g=>{h.push(this.getPrimitiveBBox(g))})}return(d||u>0)&&r.push("Path"),{diffTypes:r,overWeight:0,overDiffBBox1:c,overDiffBBox2:h}}comparePlaneZone(t,e){let r=this.comparAbstractFill(t,e),i=r.diffTypes,n=r.overWeight,s=r.overDiffBBox1,a=r.overDiffBBox2,l=i.length+n;return{diffTypes:i,diffWeight:l,overDiffBBox1:s,overDiffBBox2:a}}compareCopper(t,e){let r=this.comparAbstractFill(t,e),i=r.diffTypes,n=r.overWeight,s=r.overDiffBBox1,a=r.overDiffBBox2,l=i.length+n;return{diffTypes:i,diffWeight:l,overDiffBBox1:s,overDiffBBox2:a}}compareImage(t,e){let r=[],i=t.template.toString()==e.template.toString();i?(this.equalLayer(t.layerId,e.layerId)||r.push("Layer"),this.equalVector2(t.start,e.start)||r.push("Pick and Place"),this.equalRadian(t.rotation,e.rotation)||r.push("Rotation"),this.equalFloat(t.width,e.width)||r.push("Width"),this.equalFloat(t.height,e.height)||r.push("Height"),t.mirror!=e.mirror&&r.push("Mirror")):r.push("Shape");let n=i?r.length>0?1:0:this._maxDiffSize+1;return{diffTypes:r,diffWeight:n}}comparePicture(t,e){let r=[],i=t.hashId==e.hashId;i?(this.equalLayer(t.layerId,e.layerId)||r.push("Layer"),this.equalVector2(t.start,e.start)||r.push("Pick and Place"),this.equalRadian(t.rotation,e.rotation)||r.push("Rotation"),this.equalFloat(t.width,e.width)||r.push("Width"),this.equalFloat(t.height,e.height)||r.push("Height"),t.mirror!=e.mirror&&r.push("Mirror")):r.push("Shape");let n=i?r.length>0?1:0:this._maxDiffSize+1;return{diffTypes:r,diffWeight:n}}compareDimension(t,e){let r=[],i=t.precision==e.precision?t.precision:5,n=on(t.length,i)==on(e.length,i);n?(this.equalLayer(t.layerId,e.layerId)||r.push("Layer"),(!this.equalVector2(t.start,e.start)||!this.equalVector2(t.end,e.end)||!this.equalVector2(t.left,e.left)||!this.equalVector2(t.right,e.right))&&r.push("Pick and Place"),t.unit!=e.unit&&r.push("Unit"),this.equalFloat(t.text.strokeWidth,e.text.strokeWidth)||r.push("Width"),t.text.fontSize!=e.text.fontSize&&r.push("Text Height"),t.precision!=e.precision&&r.push("Dimension Accuracy")):r.push("Length");let s=n?r.length:this._maxDiffSize+1;return{diffTypes:r,diffWeight:s}}compareProtractor(t,e){let r=[],i=t.precision==e.precision?t.precision:5,n=on(t.angle,i)==on(e.angle,i);n?(this.equalLayer(t.layerId,e.layerId)||r.push("Layer"),(!this.equalVector2(t.start,e.start)||!this.equalVector2(t.end,e.end)||!this.equalVector2(t.center,e.center))&&r.push("Pick and Place"),this.equalFloat(t.strokeWidth,e.strokeWidth)||r.push("Width"),this.equalFloat(t.text.fontSize,e.text.fontSize)||r.push("Text Height"),t.precision!=e.precision&&r.push("Dimension Accuracy")):r.push("Rotation");let s=n?r.length:this._maxDiffSize+1;return{diffTypes:r,diffWeight:s}}compareRadiusMark(t,e){let r=[],i=t.precision==e.precision?t.precision:5,n=on(t.radius,i)==on(e.radius,i);n?(this.equalLayer(t.layerId,e.layerId)||r.push("Layer"),(!this.equalVector2(t.start,e.start)||!this.equalVector2(t.end,e.end))&&r.push("Pick and Place"),t.unit!=e.unit&&r.push("Unit"),this.equalFloat(t.strokeWidth,e.strokeWidth)||r.push("Width"),this.equalFloat(t.text.fontSize,e.text.fontSize)||r.push("Text Height"),t.precision!=e.precision&&r.push("Dimension Accuracy")):r.push("Rotation");let s=n?r.length:this._maxDiffSize+1;return{diffTypes:r,diffWeight:s}}compareText(t,e){let r=[],i=t.getParent(),n=e.getParent(),s=!1;if(!i&&!n?s=!0:i instanceof vi&&n instanceof vi&&(s=i.footprintId==n.footprintId),!s)return{diffTypes:["Parent"],diffWeight:this._maxDiffSize+1};this.equalLayer(t.layerId,e.layerId)||r.push("Layer"),this.equalVector2(t.position,e.position)||r.push("Pick and Place"),this.equalRadian(t.rotation,e.rotation)||r.push("Rotation"),t.origin!=e.origin&&r.push("Origin"),t.getText()!=e.getText()&&r.push("Content"),t.mirror!=e.mirror&&r.push("Mirror"),t.fontFamily!=e.fontFamily&&r.push("Font Family"),this.equalFloat(t.strokeWidth,e.strokeWidth)||r.push("Stroke Width"),t.fontSize!=e.fontSize&&r.push("Height"),(t.reverse!=e.reverse||t.reverseExpansion!=e.reverseExpansion)&&r.push("Inverted");let a=r.length;return{diffTypes:r,diffWeight:a}}compareComponent(t,e){var a,l;let r=[],i=[],n=[];if(this.equalLayer(t.layerId,e.layerId)||r.push("Layer"),t.footprintId!=e.footprintId&&r.push("Footprint Name"),this.equalVector2(t.position,e.position)||r.push("Pick and Place"),this.equalRadian(t.rotation,e.rotation)||r.push("Rotation"),r.length==0){let c=!1;if(this._isSameProject&&(c=t.footprintUUID==e.footprintUUID),!c){let h=t.footprintUUID+"-"+e.footprintUUID,u=this._footprintCompareResultMap[h];if(!u){let m=this._params,g=Wi.getInstance(m.pcbWorld1.projectId).getItem(t.footprintUUID),y=Wi.getInstance(m.pcbWorld2.projectId).getItem(e.footprintUUID),b=new o().compareFootprint({valUnit:m.valUnit,deviation:m.deviation,comparisonSize:m.comparisonSize,footprint1:g,footprint2:y},this),P=[],T=[];if(!b)c=!1;else{let I=b.comparisonResultMap;for(let C in I){let E=I[C];for(let O in E){if(O=="same")continue;E[O].forEach(R=>{var w,F;let v=(w=R.object1)==null?void 0:w.bboxes;Array.isArray(v)?P.push(v[0]):v&&P.push(v);let D=(F=R.object2)==null?void 0:F.bboxes;Array.isArray(D)?T.push(D[0]):D&&T.push(D)})}}c=P.length==0&&T.length==0}u={isSame:c,diffBBox1:P,diffBBox2:T},this._footprintCompareResultMap[h]=u}c=u.isSame;let d,p;(a=u.diffBBox1)==null||a.forEach(m=>{d||(d=this.getComponentMatrix(t));let g=new ut(m.minX,m.maxX,m.minY,m.maxY).transform(d);i.push(this.bbox2json(g))}),(l=u.diffBBox2)==null||l.forEach(m=>{p||(p=this.getComponentMatrix(e));let g=new ut(m.minX,m.maxX,m.minY,m.maxY).transform(p);n.push(this.bbox2json(g))})}if(c){let h=[],u=[];t.attributes.forEach(d=>{d.getText()&&h.push(d)}),e.attributes.forEach(d=>{d.getText()&&u.push(d)}),this.compareObjectsByType("Component Property",h,u),this.compareObjectsByType("ComponentPad",t.getPads(),e.getPads())}else r.push("Footprint")}let s=r.length;return{diffTypes:r,diffWeight:s,overDiffBBox1:i,overDiffBBox2:n}}getComponentMatrix(t){let e=t.position,r=t.rotation,i=t.layerId==2;return Qe.translate1(S.ORIGIN).rotate(i?r-Math.PI:r).translate1(e)}bbox2json(t){return{minX:t.minX,minY:t.minY,maxX:t.maxX,maxY:t.maxY}}getPrimitiveBBox(t,e){return this.bbox2json(e>0?t.bbox().extendSize(e):t.bbox())}getShapeBBox(t){let e;if(t instanceof Je)e=t.getBBox();else{if(t instanceof Li)return this._noneBBox;e=t.bbox}return this.bbox2json(e)}shape2ComparisonResultObject(t,e,r,i){let n=this.getShapeBBox(t);i&&i.length==0&&i.unshift(n);let s=t.layerId,a=(r?this._pcbCommonData1:this._pcbCommonData2).layerNameMap[s]||s.toString(),l=this.getObjId(t),c=this.getObjShowId(t),h=r?this._realTypeMap1[l]:this._realTypeMap2[l];return h&&(e=h),{type:e,id:l,showId:c,layerId:s,layerName:a,bboxes:i||n}}addLess(t,e){if(this._lessMapCache[t])this._lessMapCache[t].push(e);else return this._lessMapCache[t]=[e]}addMore(t,e){if(this._moreMapCache[t])this._moreMapCache[t].push(e);else return this._moreMapCache[t]=[e]}updateComparisonResults(t,e,r,i,n){if(e=="modify"&&(!n||n.diffWeight==0)){console.warn("Please confirm the difference type!",[r,i]);return}let s={type:e,object1:r,object2:i,diffTypes:n==null?void 0:n.diffTypes};this._comparisonResultMap[t]?this._comparisonResultMap[t][e]?this._comparisonResultMap[t][e].push(s):this._comparisonResultMap[t][e]=[s]:this._comparisonResultMap[t]={[e]:[s]};let a=this._totalIdsMap;a[t]||(a[t]={pcbIds1:[],pcbIds2:[],comparisonIdMap:{}});let l=a[t].comparisonIdMap[e];l||(l=a[t].comparisonIdMap[e]=[]);let c=(r==null?void 0:r.id)||"",h=(i==null?void 0:i.id)||"";l.push(`${c}-${h}`)}integrateResult(){let t=this._integrationProgress,e=this._lessMapCache,r=this._moreMapCache,i=Object.keys(e),n=Object.keys(r),s=Fb(i,n);s.less.forEach(a=>{e[a].forEach(l=>{this.updateComparisonResults(a,"less",this.shape2ComparisonResultObject(l,a,!0),null)})}),s.more.forEach(a=>{r[a].forEach(l=>{this.updateComparisonResults(a,"more",null,this.shape2ComparisonResultObject(l,a,!1))})}),s.same.forEach(a=>{let l=e[a],c=r[a];this.integrateObjectsByType(a,l,c)}),t.end()}integrateObjectsByType(t,e,r){switch(t){case"Pad":case"ComponentPad":this.integrateObjects(t,e,r,this.comparePad);break;case"Via":this.integrateObjects(t,e,r,this.compareVia);break;case"Track":this.integrateObjects(t,e,r,this.compareTrack);break;case"ArcTrack":this.integrateObjects(t,e,r,this.compareArcTrack);break;case"Polyline":this.integrateObjects(t,e,r,this.compare2DPoly);break;case"Circle":this.integrateObjects(t,e,r,this.compare2DCircle);break;case"Rect":this.integrateObjects(t,e,r,this.compare2DRect);break;case"PlaneZone":this.integrateObjects(t,e,r,this.comparePlaneZone);break;case"Copper":this.integrateObjects(t,e,r,this.compareCopper);break;case"Image":this.integrateObjects(t,e,r,this.compareImage);break;case"Colorful Image":this.integrateObjects(t,e,r,this.comparePicture);break;case"Dimension":this.integrateObjects(t,e,r,this.compareDimension);break;case"Protractor":this.integrateObjects(t,e,r,this.compareProtractor);break;case"RadiusMark":this.integrateObjects(t,e,r,this.compareRadiusMark);break;case"Text":case"Component Property":this.integrateObjects(t,e,r,this.compareText);break;case"Component":this.integrateObjects(t,e,r,this.compareComponent);break;default:console.warn("Not supported yet objectType:",t);break}}integrateObjects(t,e,r,i){let n={},s={},a=[],l=[];e.forEach(b=>{let P=this.getObjId(b);n[P]=b,a.push(P)}),r.forEach(b=>{let P=this.getObjId(b);s[P]=b,l.push(P)});let c=Fb(a,l),h=[],u=[],d=[],p=[];c.same.forEach(b=>{let P=n[b],T=s[b],I=this.getComparedKey(P,T),C=this._comparedMap[I]||i.call(this,P,T);if(C.diffWeight==0){h.push(b),u.push(b),this.updateComparisonResults(t,"same",this.shape2ComparisonResultObject(P,t,!0),this.shape2ComparisonResultObject(T,t,!1));return}this._comparedMap[I]=C,C.diffWeight<=this._maxDiffSize&&(this.updateComparisonResults(t,"modify",this.shape2ComparisonResultObject(P,t,!0,C.overDiffBBox1),this.shape2ComparisonResultObject(T,t,!1,C.overDiffBBox2),C),d.push(b),p.push(b))});let m={};for(let b in n){if(h.includes(b)||d.includes(b))continue;let P=n[b];for(let T in s){if(u.includes(T)||p.includes(T))continue;let I=s[T],C=this.getComparedKey(P,I),E=this._comparedMap[C]||i.call(this,P,I);if(this._comparedMap[C]=E,E.diffWeight==0){h.push(b),u.push(T),this.updateComparisonResults(t,"same",this.shape2ComparisonResultObject(P,t,!0),this.shape2ComparisonResultObject(I,t,!1));continue}E.diffWeight<=this._maxDiffSize&&(m[b]?m[b][T]=E:m[b]={[T]:E})}}let g={};for(let b in m){let P=m[b];for(let T in P){let C=P[T].diffTypes.length;g[C]?g[C][b]?g[C][b].push(T):g[C][b]=[T]:g[C]={[b]:[T]}}}Object.keys(g).sort((b,P)=>+b-+P).forEach(b=>{let P=g[b];for(let T in P){if(h.includes(T)||d.includes(T))continue;P[T].some(C=>{if(u.includes(C)||p.includes(C))return!1;let E=m[T][C];return this.updateComparisonResults(t,"modify",this.shape2ComparisonResultObject(n[T],t,!0,E.overDiffBBox1),this.shape2ComparisonResultObject(s[C],t,!1,E.overDiffBBox2),m[T][C]),d.push(T),p.push(C),!0})}}),h.length+d.length<a.length&&a.some(b=>{if(h.includes(b)||d.includes(b))return!1;let P=n[b];return this.updateComparisonResults(t,"less",this.shape2ComparisonResultObject(P,t,!0),null),d.length==a.length}),u.length+p.length<l.length&&l.some(b=>{if(u.includes(b)||p.includes(b))return!1;let P=s[b];return this.updateComparisonResults(t,"more",null,this.shape2ComparisonResultObject(P,t,!1)),p.length==l.length})}exportComparisonResult(){let t=this._comparisonResultMap,e=this._totalIdsMap,r={},i=!1;for(let s in e){let a=e[s],{pcbIds1:l,pcbIds2:c,comparisonIdMap:h}=a,u=new Set(l),d=new Set(c),p=[],m=[],g=new Set,y=new Set;for(let T in h)h[T].forEach(C=>{let E=C.split("-"),O=E[0],_=E[1];O&&(u.delete(O),p.includes(O)?g.add(O):p.push(O)),_&&(d.delete(_),m.includes(_)?y.add(_):m.push(_))});let b=u.size+g.size,P=d.size+y.size;b+P>0&&(i=!0,r[s]={},b>0&&(r[s].pcb1={},u.size>0&&(r[s].pcb1.notInComparisonIds=Array.from(u)),g.size>0&&(r[s].pcb1.repeatIds=Array.from(g))),P>0&&(r[s].pcb2={},d.size>0&&(r[s].pcb2.notInComparisonIds=Array.from(d)),y.size>0&&(r[s].pcb2.repeatIds=Array.from(y))))}i||(r=null),this._progress.end(),this.dataStateInit();let n={totalIdsMap:e,abnormalIdMap:r,comparisonResultMap:t};return $0("comparisonResult",void 0,n),r&&$0("abnormalIdMap",{color:"#FF9800"},r),n}errorCall(t,e,r){var n;let i=(n=this._params)==null?void 0:n.errorCall;i&&i(t,e,r),console.warn(t,e,r)}};async function kZe(o){let t="";if(!x.getInstance().isactive||23==x.getInstance().doctype)return;x.getInstance().doctype==4&&(t="Component Property"),E9.pcbNames=o;let e=E9.getAllAttrConfig(x.getInstance().doctype),r=Ve.getSelects(),i=new Set;r.forEach(h=>{let u=h.getParent();h instanceof mt||h instanceof vt?i.add(u):u instanceof Me&&r.includes(u)||i.add(h)});let n=Array.from(i);if(n.length>0){let h=new Set;if(Vpe.isAllCombination)t="Group";else{for(let u of n){let d=new Set;for(let p in e.attrConfig)e.attrConfig[p].is(u)&&d.add(p);if(d.size>0)if(h.size==0)h=new Set(Array.from(d));else{if(Array.from(d).every(m=>!h.has(m))){h=new Set;break}h=new Set(Array.from(h).filter(m=>d.has(m)))}}h.size>0&&(t=Array.from(h)[0])}}let s={},a,l;if(t=="Group"?l=n.map(h=>kt.getItem(h.model.getGroupID())):l=n,t){let h=e.attrConfig[t];for(let d in h)if(h.hasOwnProperty(d))for(let p of l){let m=E9.convertCanvasValueToShowStrOrStrArr(d,E9.getElementAttrValue(p,d,h));if(s[d]==null)s[d]=m instanceof Array?m[0]:m;else if(m!==s[d]){s[d]="<...>";break}}let u=new Set;if(t=="Component Property"){for(let d of n)u.add(d.key);u.size==1&&(a=Array.from(u)[0])}}E9.pcbNames=o;let c=E9.getAllAttrConfig(x.getInstance().doctype,{plainObj:!0});A.publish("openMainDialog",{cmd:9,data:{option:{...c,objTypeName:t,values:s,componentPropertyType:a}}})}var qge=class{constructor(t,e,r){this.layer=new CR;this.layerPhys=new xR;this.activeLayer=new SR;this.ruleTemplateName=new zR;this.rule=new WR;this.ruleSelect=new _R;this.padsPairGroup=new NR;this.padsPairGroupDetail=new kR;this.source=!1;this.version=t,this.doctype=e,this.compiler=r,this.format=new Vg().getConfig(t),this.compiler==null&&(this.encoder=new Bk(x.getInstance().id))}get ignorePartitionId(){return this.doctype!=3}getCommonSource(){var t;return this.saveCommonData(),(t=this.encoder)==null?void 0:t.getDataStr()}saveCommonData(){$e.getInstance().getAllItem().forEach(v=>{this.feed("LAYER",v)}),$e.getInstance().getLayerPhys().forEach(v=>{this.feed("LAYER_PHYS",v)}),this.feed("ACTIVE_LAYER");let r=te.getInstance(),i=r.getAllSafeSpacing(),n=r.getAllOtherSpacing(),s=r.getAllCreepageSpacing(),a=r.getAllTrackPhysics(),l=r.getAllNetLengthPhysics(),c=r.getAllNetLengthTolerancePhysics(),h=r.getAllDifferentialPhysics(),u=r.getAllBlindPhysics(),d=r.getAllRadiusPhysics(),p=r.getAllInnerPlane(),m=r.getAllCopperPlane(),g=r.getAllPasteExpansion(),y=r.getAllSolderExpansion(),b=r.getAllAutoRouterRules(),P=r.getAllNetClass(),T=r.getAllNets(),I=r.getAllNetDifferentials(),C=r.getAllEqualLengthGroups(),E=r.getAllPadsPairGroups(),O=r.getAllRegions();this.feed("RULE_TEMPLATE"),i.forEach(v=>{this.feed("RULE",v)}),n.forEach(v=>{this.feed("RULE",v)}),s.forEach(v=>{this.feed("RULE",v)}),a.forEach(v=>{this.feed("RULE",v)}),l.forEach(v=>{this.feed("RULE",v)}),c.forEach(v=>{this.feed("RULE",v)}),h.forEach(v=>{this.feed("RULE",v)}),u.forEach(v=>{this.feed("RULE",v)}),d.forEach(v=>{this.feed("RULE",v)}),p.forEach(v=>{this.feed("RULE",v)}),m.forEach(v=>{this.feed("RULE",v)}),g.forEach(v=>{this.feed("RULE",v)}),y.forEach(v=>{this.feed("RULE",v)}),b.forEach(v=>{this.feed("RULE",v)}),E.forEach(v=>{this.feed("EQLEN_GRP",v)});let _=[];E.forEach(v=>{v.details.forEach(D=>{_.push(D)})}),_.forEach(v=>{this.feed("EQLEN",v)}),P.forEach(v=>{this.feed("RULE_SELECTOR",v)}),T.forEach(v=>{this.feed("RULE_SELECTOR",v)}),I.forEach(v=>{this.feed("RULE_SELECTOR",v)}),C.forEach(v=>{this.feed("RULE_SELECTOR",v)}),r.betweenNetRule.rule.forEach(v=>{this.feed("RULE_SELECTOR",v)}),O.forEach(v=>{this.feed("RULE_SELECTOR",v)})}feed(t,e){let r=this.getItemFormat(t),i=this.getEncode(t),n={};for(let s of r)this.ignorePartitionId&&s=="partitionId"||(n[s]=this.getData(s,i,e));return this.uploadSource(t,n,e),n}getItemFormat(t){return this.format[t]}getEncode(t){switch(t){case"LAYER":return this.layer;case"LAYER_PHYS":return this.layerPhys;case"ACTIVE_LAYER":return this.activeLayer;case"RULE_TEMPLATE":return this.ruleTemplateName;case"RULE":return this.rule;case"RULE_SELECTOR":return this.ruleSelect;case"EQLEN_GRP":return this.padsPairGroup;case"EQLEN":return this.padsPairGroupDetail}}getData(t,e,r){return e.getData(t,r)}uploadSource(t,e,r){var i;if(this.encoder!=null)switch(t){case"CANVAS":return this.encoder.uploadCanvas(e);case"LAYER":return this.encoder.uploadLayer(r.layerId,e);case"LAYER_PHYS":return this.encoder.uploadLayerPhys(r.layerId,e);case"ACTIVE_LAYER":return this.encoder.uploadActiveLayer(e);case"NET":return this.encoder.uploadNet(r.name,e);case"PRIMITIVE":return this.encoder.uploadPrimitive(r,e);case"GROUP":return this.encoder.uploadGroup(r.globalIndex,e);case"VIA":return this.encoder.uploadVia(r.globalIndex,e);case"PAD":return this.encoder.uploadPad(r.globalIndex,e);case"LINE":return this.encoder.uploadLine(r.globalIndex,e);case"ARC":case"CARC":return this.encoder.uploadArc(r.globalIndex,e);case"POLY":return this.encoder.uploadPoly(r.globalIndex,e);case"FILL":return this.encoder.uploadFill(r.globalIndex,e);case"FPC_FILL":return this.encoder.uploadFpcFill(r.globalIndex,e);case"REGION":return this.encoder.uploadRegion(r.globalIndex,e);case"PARTITION":return this.encoder.uploadPartition(r.globalIndex,e);case"POUR":return this.encoder.uploadPour(r.globalIndex,e);case"POURED":return this.encoder.uploadPoured((i=r[0])==null?void 0:i.getParent().globalIndex,e);case"IMAGE":return this.encoder.uploadImage(r.globalIndex,e);case"OBJ":return this.encoder.uploadObj(r.globalIndex,e);case"TEARDROP":return this.encoder.uploadTeardrop(r.globalIndex,e);case"STRING":return this.encoder.uploadString(r.globalIndex,e);case"ATTR":return this.encoder.uploadAttr(r.globalIndex,e);case"DIMENSION":return this.encoder.uploadDimension(r.globalIndex,e);case"COMPONENT":return this.encoder.uploadComponent(r.globalIndex,e);case"PAD_NET":return this.encoder.uploadPadNet(e);case"RULE_TEMPLATE":return this.encoder.uploadRuleTemplate(e);case"RULE":return this.encoder.uploadRule(e);case"RULE_SELECTOR":return this.encoder.uploadRuleSelector(e);case"EQLEN_GRP":return this.encoder.uploadEQLenGrp(r.number,e);case"SHELLCUT":return this.encoder.uploadShellCut(r.globalIndex,e);case"SHELL_ENTITY":return this.encoder.uploadShellEntity(r.globalIndex,e);case"SHELL":return this.encoder.uploadShell(r.globalIndex,e);case"CREASE":return this.encoder.uploadCrease(r.globalIndex,e);case"BOSS":return this.encoder.uploadBoss(r.globalIndex,e);case"PANELIZE":return this.encoder.uploadPanelize(e);case"SILK_OPTS":return this.encoder.uploadSilkOpts(r.layerId,e);case"PREFERENCE":return this.encoder.uploadPreference(e);case"INNER":return this.encoder.uploadLayerFill(r[0].layerId,e)}}};var $ge=class{constructor(t=null){this.modelNetGroup=new Map;this.layerIds=new Set;this.signalLayerIds=new Set;this.filter=t}sycnLayers(){return this.layerIds=new Set($e.getInstance().getAllCopperLayerIds()),this.signalLayerIds=new Set($e.getInstance().getAllSignalLayerIds()),this}classify4Nets(){this.classify4Net(An.getInstance().getAllItem()),this.classify4Net(Tn.getInstance().getAllItem()),this.classify4Net($n.getInstance().getAllItem()),this.classify4Net(Wo.getInstance().getAllItem()),this.classify4Net(Ho.getInstance().getAllItem()),this.classify4Net(Mi.getInstance().getAllItem()),this.classify4Net(rn.getInstance().getAllItem()),this.classify4Net(zi.getInstance().getAllItem())}classify(){this.classify4Nets(),An.getInstance().recycle(),Tn.getInstance().recycle(),$n.getInstance().recycle(),Wo.getInstance().recycle(),Ho.getInstance().recycle(),Mi.getInstance().recycle(),rn.getInstance().recycle(),zi.getInstance().recycle(),xs.getInstance().recycle()}classify4Net(t){for(let e of t)this.addModel(e)}addModel(t){switch(t.modelType){case"Track":case"ArcTrack":case"Via":case"Pad":case"Copper":case"Inner":{this.add2Map(t.net,t.modelType,t);break}case"Polygon":case"Rect":case"Circle":{switch(t.type){case"Line":{this.signalLayerIds.has(t.layerId)&&this.add2Map(t.net,t.modelType,t);break}case"Fill Region":case"TearDrop":{this.layerIds.has(t.layerId)&&this.add2Map(t.net,t.modelType,t);break}default:break}break}default:break}}add2Map(t,e,r){if(this.filter!=null&&!this.filter.has(t)||t==null)return;let i=this.modelNetGroup.get(t);i==null&&(i=new Map,this.modelNetGroup.set(t,i));let n=i.get(e);n==null&&(n=new Set,i.set(e,n)),n.add(r)}};var Kge=class{constructor(){this.via=new $I;this.pad=new qE;this.line=new JE;this.arc=new QE;this.poly=new e3;this.fill=new KI;this.copper=new d3;this.tear=new t3;this.format=new Vg().getConfig("2.0")}encode(t){let e=new Array(t.size),r=0;for(let[i,n]of t){let s=new Array;for(let[a,l]of n)switch(a){case"Track":{let c=this.getTrackData(l);s.push({itemType:"LINE",data:c});break}case"ArcTrack":{let c=this.getArcTrackData(l);s.push({itemType:"ARC",data:c});break}case"Via":{let c=this.getViaData(l);s.push({itemType:"VIA",data:c});break}case"Pad":{let c=this.getPadData(l);s.push({itemType:"PAD",data:c});break}case"Copper":{let c=this.getCopperData(l);s.push({itemType:"POURED",data:c});break}case"Inner":{let c=this.getPlaneZoneData(l);s.push({itemType:"FILL",data:c});break}case"Polygon":case"Rect":case"Circle":{let c=new Array,h=new Array,u=new Array,d=this.getItemFormat("POLY"),p=this.getItemFormat("FILL"),m=this.getItemFormat("TEARDROP");for(let g of l)switch(g.type){case"Line":{let b=this.getRes(d,this.poly,{},g);c.push(b);break}case"Fill Region":{let b=this.getRes(p,this.fill,{},g);h.push(b);break}case"TearDrop":{let b=this.getRes(m,this.tear,{},g);u.push(b);break}default:break}if(c.length>0&&s.push({itemType:"POLY",data:c}),h.length>0){s.push({itemType:"FILL",data:h});break}if(u.length>0){s.push({itemType:"TEARDROP",data:u});break}break}default:break}e[r]={net:i,data:s},r++}return e}getResData(t,e){for(let[r,i]of e)switch(r){case"Track":{let n=this.getTrackData(i);t.push({itemType:"LINE",data:n});break}case"ArcTrack":{let n=this.getArcTrackData(i);t.push({itemType:"ARC",data:n});break}case"Via":{let n=this.getViaData(i);t.push({itemType:"VIA",data:n});break}case"Pad":{let n=this.getPadData(i);t.push({itemType:"PAD",data:n});break}case"Copper":{let n=this.getCopperData(i);t.push({itemType:"POURED",data:n});break}case"Inner":{let n=this.getPlaneZoneData(i);t.push({itemType:"FILL",data:n});break}case"Polygon":case"Rect":case"Circle":{let n=new Array,s=new Array,a=new Array,l=this.getItemFormat("POLY"),c=this.getItemFormat("FILL"),h=this.getItemFormat("TEARDROP");for(let u of i)switch(u.type){case"Line":{let p=this.getRes(l,this.poly,{},u);n.push(p);break}case"Fill Region":{let p=this.getRes(c,this.fill,{},u);s.push(p);break}case"TearDrop":{let p=this.getRes(h,this.tear,{},u);a.push(p);break}default:break}if(n.length>0&&t.push({itemType:"POLY",data:n}),s.length>0){t.push({itemType:"FILL",data:s});break}if(a.length>0){t.push({itemType:"TEARDROP",data:a});break}break}default:break}}getRes(t,e,r,i){for(let n of t)r[n]=this.getData(n,e,i);return r.id=i.globalIndex,r.number=i.number,r}getItemFormat(t){return this.format[t]}getData(t,e,r){return e.getData(t,r)}getResult(t,e,r){let i=new Array(r.size),n=0,s=this.getItemFormat(t);for(let a of r)i[n]=this.getRes(s,e,{},a),n++;return i}getCopperResult(t,e,r){let i=new Array(r.size),n=0,s=Array.from(r),a=e.getData("",s),l=r.size;for(;n<l;){let c=s[n],h=a[n];h.id=c.globalIndex,h.number=c.number,h.style=c.style,h.gridLineWidth=c.gridLineWidth,h.layerId=c.layerId,h.net=c.net,h.clearance=c.clearance,h.optimization=c.optimization,h.optimizationValue=c.optimizationWidth,i[n]=h,n++}return i}getTrackData(t){let e=new Array(t.size),r=0;for(let i of t)e[r]={partitionId:i.partition,groupId:i.getGroupID()||"",layerId:i.layerId,locked:!1,zIndex:i.zIndex,netName:i.net,startX:i.start.x*10,startY:i.start.y*10,endX:i.end.x*10,endY:i.end.y*10,width:i.width*10,id:i.globalIndex,number:i.number},r++;return e}getArcTrackData(t){return this.getResult("ARC",this.arc,t)}getPadData(t){let e=new Array(t.size),r=0;for(let i of t)e[r]={partitionId:i.partition,groupId:i.getGroupID(),layerId:i.layerId,locked:i.locked,zIndex:i.zIndex,netName:i.net,num:i.num,centerX:i.center.x*10,centerY:i.center.y*10,padAngle:i.rotation/Math.PI*180,hole:qCe(i),defaultPad:jCe(i),specialPad:XCe(i),padOffsetX:i.holeOffset.x*10,padOffsetY:i.holeOffset.y*10,relativeAngle:i.holeRotation/Math.PI*180,plated:i.plated,padType:i.isTestPad?d8(1):d8(0),topSolderExpansion:null,bottomSolderExpansion:null,topPasteExpansion:null,bottomPasteExpansion:null,connectMode:null,spokeSpace:null,spokeWidth:null,spokeAngle:null,unusedInnerLayers:i.unusedInnerLayers,padLen:i.padLen*10,refs:[],id:i.globalIndex,number:i.number},r++;return e}getViaData(t){return this.getResult("VIA",this.via,t)}getCopperData(t){return this.getCopperResult("POURED",this.copper,t)}getPlaneZoneData(t){return this.getResult("FILL",this.fill,t)}};var EMt=new Set(["ARC","LINE"]),OMt=new Set(["FILL","IMAGE","POLY","POUR","REGION"]),Zge=class{constructor(t){this.data=t}netCount(t){let e=new Map;for(let[r,i]of t){let n=0;for(let[,s]of i)n+=s.length;e.set(r,n)}for(let[r,i]of this.data.modelNetGroup){let n=e.get(r)||0;for(let[,s]of i)n+=s.size;e.set(r,n)}return e}netGourp(t){let e=0,r=new Array,i=new Array;for(let[n,s]of t)i.push(n),e+=s,e>4e4&&(e=0,r.push(i),i=new Array);return i.length>0&&r.push(i),r}stringify(t,e){let r=new Kge,i=new Array;for(let n of t){if(n=="")continue;let s=new Array,a=e.get(n),l=this.data.modelNetGroup.get(n);if(a!=null)for(let[c,h]of a){let u=new On;for(let d of h)this.filter4Layer(c,d.layerId)&&u.add(d);s.push({itemType:c,data:u.toArray()})}l!=null&&r.getResData(s,l),e.delete(n),this.data.modelNetGroup.delete(n),i.push({net:n,data:s})}return JSON.stringify(i)}filter4Layer(t,e){return e==null?!0:EMt.has(t)?$e.getInstance().isSignalLayer(e):OMt.has(t)?$e.getInstance().isValidLayer(e):!0}generateData(t){let e=this.netCount(t);return this.netGourp(e)}};function BZe(){return new qge("2.0",3).getCommonSource()}function FZe(o){let t=new Map,e=new $ge(o);e.sycnLayers().classify4Nets();let r=new Zge(e),i=r.generateData(t),n=new Array;for(let s of i)n.push(r.stringify(s,t));return n}var VZe=1200*1e3,l7=class l7{static updateNetVersion(t){for(let e of t)l7.netVersionMap.set(e,this.id++)}static async rebuildAll(t){let e=new Map(l7.netVersionMap);for(let a of t)zo.removeNetRatlines(a),Mh.deleteJumpWireCache(a);let r=pf.getInstance(),i=r.addWorker("editor?entry=pcb-ratline-worker.js",!0,"pcb-ratline-worker"),n=r.getLastWorkerId();(await i.rpcCall("ratlineEnviromentInit",BZe(),VZe)).message;let s=FZe(t);for(;s.length>0;){let a=(await i.rpcCall("singrebuildRatlineTopic",s.pop(),VZe)).message;a=a.filter(l=>e.get(l.net)>=l7.netVersionMap.get(l.net)),Mh.input(a)}r.deleteWorker(n)}};l7.netVersionMap=new Map,l7.id=0;var RK=l7;function GZe(){ie.subscribe("updateDRC",t=>{if(!x.getInstance().isactive||x.getInstance().doctype!=3||!ah.switch)return;let e="updateDRC-time";pn(e);let r=t instanceof Set?t:new Set(t);r.forEach(n=>{n.model instanceof Aa&&n.model.type=="Annotation"&&r.delete(n)}),ah.realtimeCheckItems(r);let{checkSpecifications:i}=Pb.getCurrentStrategy();r.size&&ah.switch&&i&&(Eo.deleteAllConnectError(),Eo.deleteAllNetLengthError(),Eo.deleteAllNetLengthToleranceError(),ah.checkNetLength(r),ah.checkNetLengthTolerance(r),Eo.syncFromContentModel()),Bi(e,.01)}),ie.subscribe("updateTears",t=>{!ce.pcbConfig.addTeardropAutomatically||!t.size||!x.getInstance().isactive||23==x.getInstance().doctype||C$e(Array.from(t))}),ie.messageBus.rpcService("pcb/getAllEnableLayer",()=>{let t=be.getAllEnableLayer(),e=[];return t.forEach(r=>e.push(r.layerID)),e}),ie.messageBus.subscribe("deleteConnects",t=>{pt.deleteConnects(t.item,t.connects)}),ie.messageBus.rpcService("pcb/historyComparison",async t=>{let e=x.getInstance().unit,r=x.getInstance().id,i={valUnit:bL(e),deviation:Bs(1,"mil",e),comparisonSize:Bs(100,"mil",e)};i.errorCall=(s,a,l)=>{};let n=await new Xge().compareByModels(t.diffCanvas,i);ie.publish("pro-ui/pcbComparisonTreeData",{pcbTabId1:t.leftTabId,pcbTabId2:t.rightTabId,pcbName1:t.tabTitle,pcbName2:t.tabTitle,pcbComparisonResult:n},$())}),ie.messageBus.rpcService("modifyIPC2552",({data:t,ids:e})=>{if(!x.getInstance().isactive||3!==x.getInstance().doctype)return;let r=new ve("modify component IPC2552"),i=e.map(n=>Cr.getItem(n));i.forEach(n=>{r.addCommand(Te.dispatch(n,"modify")),n.modifyATTRMap("IPC/DAC-2552",t)}),i.length>0&&(je.executeCommand(r),ie.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()))}),ie.messageBus.rpcService("pcb/getFPCStiffenerInfo",()=>{let t=!!Qu.getOneStiffener(),e=Tc.readyType==="FPC Stiffener"||Sh.readyType==="FPC Stiffener"||rc.readyType==="FPC Stiffener";return{hasFPCProfile:t,isDrawingFPCProfile:e}}),ie.subscribe("checkOpenStiffenerLayer",t=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e=be.getLayer(58),r=be.getLayer(59);(e.layerStatus===0||r.layerStatus===0)&&(e.layerStatus=1,r.layerStatus=1,Sp(e.layerID),Sp(r.layerID),Bf.getInstance().updateLayerInfo(),be.setLayerPhys(Sje,!0),t.notShowTip||ie.publish("ui/toastMsg",{type:"info",msg:"FPC stiffener(only for JLCPCB ordering) is the material used to increase the strength of a specific area. "+"it will open the relevant layer for you in the layer manager. Tip: JLCPCB doesn't support to fabricate more than four layers FPC flexiable board.",timer:6,autoHeight:!0},$()))}),ie.subscribe("updateConnectRelation",t=>{!x.getInstance().isactive||23==x.getInstance().doctype||epe.update(t)});async function o(t){if(!ce.pcbConfig.realTimeUpdateUnusedLayers||t==null||Object.keys(t).length==0)return;let e=be.getAllSignalLayerIds(),r={};for(let n in t){let s=new Set,a=Array.from(t[n]);for(let l of t[n]){let c=pc(l),h=new Array;c instanceof Je&&c.layerId==12?h.push(12,...e):c instanceof It&&(h.push(12),c.type==1?e.forEach(d=>{c.isContains(d)&&h.push(d)}):h.push(...e)),Vt.search4Types(c.buildBBox(),dd,d=>h.includes(d)).getResult(dd).forEach(d=>{A_(d.model)==n&&s.add(d.globalIndex)})}r[n]={targets:a,ids:[...s]}}let i=(await ie.messageBus.rpcCall("unusedLayer",r)).message;if(i){let n=await WN(i);if(je.stack!=null&&je.stack.length>0&&n.commands.forEach(s=>je.stack.addCommand(s)),n.length>0){let s=ce.pcbConfig.realTimeUpdateUnusedLayers;ce.pcbConfig.realTimeUpdateUnusedLayers=!1,ie.publish("flushService",""),ce.pcbConfig.realTimeUpdateUnusedLayers=s}}}ie.messageBus2.rpcService("rebuildRatline",async({nets:t,nearbySameNetObjects:e})=>{if([23,4].includes(x.getInstance().doctype)||Sa.unRebuildRatline||eL.getInstance().activeStatus==="inactive")return;let r=new Map(t),i=new Set,n=new Set,s=new Set;for(let[c,h]of r)i.add(c),h>800&&c!=""?s.add(c):n.add(c);RK.updateNetVersion(i),await o(e);let a="rebuildRatline-time";pn(a),n.size>0&&(jA.rebuildAll(n),n.clear()),s.size>0&&await RK.rebuildAll(s);let l=new Array;for(let[c]of r){let h=Vh.getNet(c);h!=null&&(l.push(h.name),h.showRatline=h.showRatline)}l.length>0&&ie.publish("updateRatlineNet",fX(l),$()),Bi(a,.01),ie.publish("updateFrame","")}),ie.subscribe("updateNetLengthAndPadPairLength",async t=>{if(!x.getInstance().isactive||[23,4].includes(x.getInstance().doctype)||!t.size)return;t.forEach(s=>ze.getNetLength(s));let r=te.getInstance().getAllPadsPairGroupsInstances().map(s=>({groupName:s.groupName,groupColor:s.groupColor,details:s.details})),i={},n=x.getInstance().unit;r.forEach(s=>{i[s.groupName]={},s.details.forEach(a=>{let l=pX(a.pad1),c=pX(a.pad2);for(let h of l)for(let u of c)if(h&&u&&(t.has(h.net)||t.has(u.net))){let d=jF(a.pad1,a.pad2),p=`${a.pad1Title}-${a.pad2Title}`;if(i[s.groupName][p]={netLength:0,unit:n},d.netMinLength>0){i[s.groupName][p].netLength=d.netMinLength;return}}})}),ie.publish("updatePairPairLength",i,$())}),ie.subscribe("openDesignRuleDialog",t=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let e="",r="Rule",i="Safe Spacing";typeof t=="object"&&t!==null?(e=t.activeMenuName?t.activeMenuName:"",r=t.activeTab?t.activeTab:r,i=t.activeMenu?t.activeMenu:i):e=t,ie.publish("openMainDialog",{cmd:5,data:{option:{activeTab:r,activeMenuName:e,activeMenu:i}}})}),ie.subscribe("openPanelizeDlg",()=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;if(!uu().length){ie.publish("showPcbAlertMsg","Please create board outline first!",$());return}ie.publish("openDialog",new Yge)}),ie.subscribe("removeUnusedPadDlg",()=>{!x.getInstance().isactive||23==x.getInstance().doctype||ie.publish("openDialog",new afe)}),ie.subscribe("padCoordinateFileDlg",()=>{!x.getInstance().isactive||x.getInstance().doctype!=4||ie.publish("openDialog",new jge)}),ie.subscribe("openCreateArrayDialog",()=>{!x.getInstance().isactive||23==x.getInstance().doctype||ie.publish("tool","createArrayTool")}),ie.subscribe("findObjects_PCB",kZe),ie.subscribe("showEditNetClassDlg",({type:t,nets:e,from:r,data:i,netClassName:n,selectedNets:s,allNets:a})=>{if(!(!x.getInstance().isactive||23==x.getInstance().doctype)&&x.getInstance().doctype===3){a=a||ze.getAllNets();let l=new Set;for(let d of a){let p=e5(d);p&&l.add(p)}s=s||e||[];let c={},h,u=t.includes("net-class");r=="designRuleDlg"?h=i.filter(d=>d.type==(u?"netClass":"equalLengthGroup")):h=Fu.getDesignRulers().Net.filter(p=>p.type===(u?"netClass":"equalLengthGroup")),!h.length&&t.indexOf("join-")==0&&(t=t.replace("join-","new-")),h.forEach(d=>c[d.name]=d.sub.map(p=>p.name)),ie.publish("openMainDialog",{cmd:35,data:{type:t,selectedNets:s,allNets:Array.from(l),netClassName:n,netClass:c,from:r}})}}),ie.subscribe("joinNetGroupDlg",({nets:t,data:e,isNetClass:r,from:i})=>{if(!(!x.getInstance().isactive||23==x.getInstance().doctype)&&x.getInstance().doctype===3){let n;i=="designRuleDlg"?n=e.filter(s=>s.type==(r?"netClass":"equalLengthGroup")):n=Fu.getDesignRulers().Net.filter(a=>a.type===(r?"netClass":"equalLengthGroup")),ie.publish("openMainDialog",{cmd:36,data:{nets:t,isNetClass:r,from:i,netGroups:n.reduce((s,a)=>(s[a.name]=a.sub.map(l=>l.name),s),{})}})}}),ie.subscribe("openLayerManagerDialog",()=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let t=[],e=be.getAllLayer(),r=be.getLayerPhys(),i=new ft,n=new iC;for(let l of e)t.push(n.toPlainObj(l));let s=r?be.getLayerPhys().map(l=>{let c=l.thickness,h=c!=null?i.mil2mm(c*10):0;return{"Layer Id":l.layerId,Layer:l.layerName,Type:null,Material:l.material,Thickness:h,Permittivity:l.permittivity,"Loss Tangent":l.lossTangent,"Layer Type":l.layerType,zIndex:l.zIndex}}):[];s.sort((l,c)=>l.zIndex-c.zIndex);let a=[{layerList:t},{layerPhyList:s}];ie.publish("openMainDialog",{cmd:15,data:{option:{panels:a}}})}),ie.subscribe("netLengthRuleChanged",()=>{if(!x.getInstance().isactive||23==x.getInstance().doctype)return;let t=Wh.getTool();(t instanceof qw||t instanceof $w)&&t.updateNetLengthRuleInDialog()}),ie.messageBus.rpcService("pcb/editor/checkingAndOpenEnableLayerDlg",async t=>{if(!(!x.getInstance().isactive||23==x.getInstance().doctype))return await UX(t)}),ie.messageBus.rpcService("pcb/editor/enablePcbLayers",t=>{if(!(!x.getInstance().isactive||23==x.getInstance().doctype))return be.enableLayers(t)}),ie.messageBus.rpcService("pcb/editor/getLayerTableMappingOfFootprint",t=>{if(!(!x.getInstance().isactive||23==x.getInstance().doctype))return Wi.getInstance().getLayerTableMapping(t)})}function UZe(){ie.messageBus.subscribe("switchRenderMode",o=>{x.getInstance().renderMode!==o&&(x.getInstance().renderMode=o)}),ie.messageBus.subscribe("switchCoordinate",o=>{St.getInstance().currentCoord!=o&&(St.getInstance().currentCoord=o,ie.publish("flushService",""))}),ie.messageBus.rpcService("exportPCBPng",async o=>{let{width:t,height:e,withoutPanelize:r=!0}=o,i=r?N0():$ue();i||(i=new ut(-t/2,t/2,-e/2,e/2));let n=Math.ceil(t*i.height()/i.width()),s=t/i.width();n>e&&(s=e/i.height()),s*=.99;let a=Array.from(Ve.getItems());for(let h of a)h.visible();Do.modify();let l=await mf.scene.getCaptureImageData(t,e,i,s),c=x.getInstance().compiler.consistencyManager.getMaxTicket();for(let h of a)h.click();return Do.modify(),{width:l.width,height:l.height,data:l.data,colorSpace:l.colorSpace,ticket:c}}),ie.subscribe("showRuler",o=>{x.getInstance().isPreview||x.getInstance().doctype==0||(typeof o<"u"?x.getInstance().openRuler=!!o:x.getInstance().openRuler=!x.getInstance().openRuler,we.synchronize(),ie.publish("updateFrame",""))})}var HZe=o=>new Promise((t,e)=>{let r=o instanceof Array?o:[o];for(let i of r){let{primitiveId:n,newTitle:s}=i,a=Dn.getInstance().getItemById(n);if(!a){t(!1);continue}let l=a.getComponent();if(l.name!=s&&(l.name=s,!x.getInstance().isPreview)){let c=or.getInstance().encode("PARTITION",a.model);x.getInstance().compiler.uploadPartition(n,{name:s,fileUuid:l.fileUuid,path:c.path}),A.publish("hasModifyPcbItem",a),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$())}a.refreshRender()}A.publish("updateFrame",""),t(!0)});var WZe=async({partitionId:o,oldSubPcbUuid:t,newSubPcbUuid:e})=>{let r=new ve("create partition");return r.createPartitionFile=!0,Ve.interrupt(),!!await Pje(o,r,t,e)};var zZe=new RegExp(/(_([0-9]+))$/),TH=class extends X3{addModel(t,e){this.models.add(t),this.map.set(t,e)}addLayer(t,e){this.layers.set(t,e)}addNet(t){this.nets.add(t)}addCombination(t){this.combination.add(t)}build(){for(let t of this.nets)Vh.addNetByModel(t);for(let[t]of this.layers)be.addPcbLayerByModel(t).refreshRender();for(let t of this.models){let e=$c(t);sw(e),this.addGroup(e),e.refreshRender(),ie.publish("hasModifyPcbItem",e)}km.historyFlushService()}addGroup(t){let e=t.model.getGroupID();if(e!=null){let r=kt.getItem(e);if(r==null)r=kt.rebuild(e,[t]);else if(r.addItem(t),t instanceof Me&&t.attrsMap["Reuse Block"]==null){let i=r.name;i!=null&&zZe.test(i)&&(t.reuseBlock=i.replace(zZe,""),t.combinationID==""&&(t.combinationID=i.replace(t.reuseBlock+"_","")))}}}getLayer(t){return $e.getInstance().getLayer(t)}};var YZe=async({partitionId:o,partitionNameMap:t})=>{let e=new er,r=Dn.getInstance().getItemById(o);if(r){let i=r.model.component,n=i.fileUuid;if(n){let s=new Pu(n,x.getInstance().projectId,x.getInstance().compilerChannel),a=new L0(s);await a.init(void 0,!0);let l=s.getHandle(),c=new j3,h=new TH;c.setProxy(h),l.setClientTool(c);let u=a.getDecode().component.filter(y=>y.partition==o).map(y=>y.index);await l.setAll(y=>y instanceof Yy?u.includes(y.parentIndex):y.partition==o),l.deleteAll(y=>{let b=e.getItem(y);b&&b.remove()});let d=new hu("2.0",3,x.getInstance().compiler),p=[],m=[];h.models.forEach(y=>{switch(y.partition==o&&(y.partition=null),y.modelType){case"Copper":{p.push(y);return}case"Inner":{m.push(y);return}}y instanceof vi?d.feedComponent(y):(y instanceof Je||y instanceof It)&&y.getParent()!=null?x.getInstance().compiler.uploadPadNet(or.getInstance().encode("PAD_NET",y)):d.feedItem(y)}),d.feedCopper(p),d.feedInner(m),h.build(),i.fileUuid="",i.name=t[o];let g=or.getInstance().encode("PARTITION",r.model);return x.getInstance().compiler.uploadPartition(o,{name:i.name,fileUuid:"",path:g.path}),await s.destroy(),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),!0}return!1}return!1};var XZe=async({partitionId:o,mainPCBUuid:t,selectedUuid:e})=>{let r=new er,i=new Pu(e,x.getInstance().projectId,x.getInstance().compilerChannel),n=new L0(i);await n.init(void 0,!0);let s=i.getHandle(),a=new j3,l=new TH;a.setProxy(l),a.setAttrUtils(new lw),s.setClientTool(a);let c={};for(let g of n.getDecode().component)c[g.index]=g.partition;let h=jZe(e,t,o,g=>g instanceof lR?g.index:g instanceof Yy&&c[g.parentIndex]||g.partition);await s.setAll(h),s.deleteAll(g=>{let y=r.getItem(g);y&&y.remove()});let u=new hu("2.0",3,x.getInstance().compiler),d=[],p=[],m=jZe(e,t,o,g=>g instanceof lr&&g.type=="Partition"?g.globalIndex:g.partition);return l.models.forEach(g=>{if(m(g)){switch(g.modelType){case"Copper":{d.push(g);return}case"Inner":{p.push(g);return}}g instanceof vi?u.feedComponent(g):(g instanceof Je||g instanceof It)&&g.getParent()!=null?x.getInstance().compiler.uploadPadNet(or.getInstance().encode("PAD_NET",g)):u.feedItem(g)}}),u.feedCopper(d),u.feedInner(p),l.build(),await i.destroy(),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),null};function jZe(o,t,e,r){let i=!x.getInstance().partitionId,n=o==t,s=!i&&!Dn.getInstance().getItemById(e);i||(n||s)&&(e=x.getInstance().partitionId);let a=!0;if(i&&!n||!i&&!n&&!s)a=!0;else if(!i&&n||!i&&!n&&s)a=!1;else throw Error("\u4E0D\u53EF\u80FD\u90FD\u662F\u4E3B\u56FE");return l=>r(l)==e==a}var qZe=async function(o){return new Promise(t=>{let{primitiveId:e}=o,r=Dn.getInstance().getItemById(e),n=r.getMathGraphics(r.layerId).primitives.map(d=>d.bbox()),s=r.model.component,a=new hu("2.0",3,x.getInstance().compiler),l=r.buildBBox();if(l==null)throw new Error("Parition shape Error!!!");let c=Vt.search(l).getAllItems(),h=[],u=[];c.forEach(d=>{if(d.partition==r.globalIndex){switch(d.partition=null,d.refreshRender(),d.model.modelType){case"Copper":{h.push(d.model);return}case"Inner":{u.push(d.model);return}}d.model instanceof vi?a.feedComponent(d.model):(d.model instanceof Je||d.model instanceof It)&&d.model.getParent()!=null?x.getInstance().compiler.uploadPadNet(or.getInstance().encode("PAD_NET",d.model)):a.feedItem(d.model)}}),a.feedCopper(h),a.feedInner(u),Dn.getInstance().deleteName(s.name),r.model.modelType==="Rect"?Xt.delete(r):r.model.modelType==="Circle"?Zt.delete(r):r.model.modelType==="Polygon"&&pt.delete(r),qI(r.globalIndex,"Partition"),r.remove(),pr.getAllItem().forEach(d=>{let p=d.buildBBox();n.some(m=>p.isIntersect(m))&&A.publish("hasModifyPcbItem",d)}),A.publish("delete",r),A.publish("setPcbTabUnSaved",[x.getInstance().tabId,!0],$()),A.publish("autoFill",""),A.publish("flushService",""),A.publish("updateFrame",""),t(!0)})};var $Ze=async function(){return new Promise(o=>{let t=Dn.getInstance().getName();o({name:t})})};function KZe(){A.messageBus.rpcService("getPartitions",async o=>{let t=[];if(x.getInstance().id==o)Dn.getInstance().getAllItem().forEach(e=>{let r=e.getComponent();t.push({id:e.globalIndex,name:r.name,fileUuid:r.fileUuid})});else{let e=new Pu(o,x.getInstance().projectId,x.getInstance().compilerChannel),r=new L0(e);await r.init(),r.getDecodeTool().partition.forEach(i=>{t.push({id:i.index,name:i.name,fileUuid:i.fileUuid})}),await e.destroy()}return t}),A.messageBus.rpcService("updatePartitionItemTitle",HZe),A.messageBus.rpcService("partitionAndCreateSubPcb",WZe),A.messageBus.rpcService("partitionMergeToMain",YZe),A.messageBus.rpcService("partitionMergeToCurrent",XZe),A.messageBus.rpcService("deletePartitionItem",qZe),A.messageBus.rpcService("continueDeletePartitionItem",()=>(je.partitionNeedAskBeforeDelete=!1,je.undo(),!0)),A.messageBus.rpcService("getNextNameOfDrawPartition",$Ze)}xZe();LZe();wZe();d$e();XGe();KZe();NZe();UZe();vZe();GZe();RZe();})();
/*! Bundled license information:

is-buffer/index.js:
  (*!
   * Determine if an object is a Buffer
   *
   * @author   Feross Aboukhadijeh <https://feross.org>
   * @license  MIT
   *)

jszip/dist/jszip.min.js:
  (*!
  
  JSZip v3.10.1 - A JavaScript class for generating and reading zip files
  <http://stuartk.com/jszip>
  
  (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
  Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
  
  JSZip uses the library pako released under the MIT license :
  https://github.com/nodeca/pako/blob/main/LICENSE
  *)

kitsune/dist/index.js:
  (*! Bundled license information:
  
  three/build/three.core.js:
  three/build/three.module.js:
    (**
     * @license
     * Copyright 2010-2024 Three.js Authors
     * SPDX-License-Identifier: MIT
     *)
  *)

lc-protocol/dist/index.js:
  (*! Bundled license information:
  
  crypto-js/ripemd160.js:
    (** @preserve
    	(c) 2012 by Cédric Mesnil. All rights reserved.
    
    	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
    
    	    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    	    - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    
    	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    	*)
  
  crypto-js/mode-ctr-gladman.js:
    (** @preserve
     * Counter block mode compatible with  Dr Brian Gladman fileenc.c
     * derived from CryptoJS.mode.CTR
     * Jan Hruby jhruby.web@gmail.com
     *)
  *)

lc-editor-common/dist/index.js:
  (*! Bundled license information:
  
  lc-protocol/dist/index.js:
    (*! Bundled license information:
    
    crypto-js/ripemd160.js:
      (** @preserve
      	(c) 2012 by Cédric Mesnil. All rights reserved.
      
      	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
      
      	    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
      	    - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
      
      	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      	*)
    
    crypto-js/mode-ctr-gladman.js:
      (** @preserve
       * Counter block mode compatible with  Dr Brian Gladman fileenc.c
       * derived from CryptoJS.mode.CTR
       * Jan Hruby jhruby.web@gmail.com
       *)
    *)
  *)

lc-jspdf/dist/index.js:
  (**
   * @license
   * Copyright (c) 2017 Aras Abbasi
   *
   * Licensed under the MIT License.
   * http://opensource.org/licenses/mit-license
   *)
  (**
   * @license
   * Copyright (c) 2014 Steven Spungin (TwelveTone LLC)  steven@twelvetone.tv
   *
   * Licensed under the MIT License.
   * http://opensource.org/licenses/mit-license
   *)
  (**
   * @license
   * jsPDF filters PlugIn
   * Copyright (c) 2014 Aras Abbasi
   *
   * Licensed under the MIT License.
   * http://opensource.org/licenses/mit-license
   *)
  (**
   * @license
   * Copyright (c) 2012 chick307 <chick307@gmail.com>
   *
   * Licensed under the MIT License.
   * http://opensource.org/licenses/mit-license
   *)
  (**
   * @license
   * ====================================================================
   * Copyright (c) 2013 Youssef Beddad, youssef.beddad@gmail.com
   *               2013 Eduardo Menezes de Morais, eduardo.morais@usp.br
   *               2013 Lee Driscoll, https://github.com/lsdriscoll
   *               2014 Juan Pablo Gaviria, https://github.com/juanpgaviria
   *               2014 James Hall, james@parall.ax
   *               2014 Diego Casorran, https://github.com/diegocr
   *
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to deal in the Software without restriction, including
   * without limitation the rights to use, copy, modify, merge, publish,
   * distribute, sublicense, and/or sell copies of the Software, and to
   * permit persons to whom the Software is furnished to do so, subject to
   * the following conditions:
   *
   * The above copyright notice and this permission notice shall be
   * included in all copies or substantial portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
   * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
   * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
   * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
   * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   * ====================================================================
   *)
*/
//# sourceMappingURL=https://modules.lceda.cn/pro-pcb/3.2.131.14eacd6b/js/pcb.js.map
